summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
Diffstat (limited to 'svx')
-rw-r--r--svx/AllLangResTarget_about.mk45
-rwxr-xr-xsvx/AllLangResTarget_gal.mk48
-rw-r--r--svx/AllLangResTarget_ofa.mk46
-rw-r--r--svx/AllLangResTarget_svx.mk136
-rw-r--r--svx/AllLangResTarget_textconversiondlgs.mk47
-rwxr-xr-xsvx/JunitTest_svx_unoapi.mk53
-rw-r--r--svx/Library_svx.mk236
-rw-r--r--svx/Library_svxcore.mk455
-rw-r--r--svx/Library_textconversiondlgs.mk66
-rw-r--r--svx/Makefile38
-rw-r--r--svx/Module_svx.mk52
-rw-r--r--svx/Package_inc.mk560
-rw-r--r--svx/Package_sdi.mk33
-rw-r--r--svx/doc/UML/edit_engine_UNO_implementation.zuml1
-rw-r--r--svx/doc/UML/grid_control_implementation.zumlbin0 -> 36412 bytes
-rw-r--r--svx/doc/UML/readme.txt9
-rw-r--r--svx/doc/drawing_layer_UNO_objects.odgbin0 -> 13284 bytes
-rw-r--r--svx/inc/accessibility.hrc87
-rw-r--r--svx/inc/dgdefs_.hxx341
-rw-r--r--svx/inc/dialdll.hxx42
-rw-r--r--svx/inc/dragmt3d.hxx153
-rw-r--r--svx/inc/drawuiks.hxx73
-rw-r--r--svx/inc/extrusiondepthdialog.hxx60
-rw-r--r--svx/inc/float3d.hrc184
-rw-r--r--svx/inc/fmhelp.hrc113
-rw-r--r--svx/inc/fontworkgallery.hrc72
-rw-r--r--svx/inc/galbrws2.hxx181
-rw-r--r--svx/inc/gallery.hrc212
-rw-r--r--svx/inc/galobj.hxx238
-rw-r--r--svx/inc/galtheme.hrc77
-rw-r--r--svx/inc/globlmn_tmpl.hrc1236
-rw-r--r--svx/inc/helpid.hrc283
-rw-r--r--svx/inc/lightdlg.hxx75
-rw-r--r--svx/inc/pch/precompiled_svx.cxx29
-rw-r--r--svx/inc/pch/precompiled_svx.hxx962
-rw-r--r--svx/inc/sjctrl.hxx630
-rw-r--r--svx/inc/svdibrow.hxx144
-rw-r--r--svx/inc/svdpomv.hxx58
-rw-r--r--svx/inc/svdshort.hxx91
-rw-r--r--svx/inc/svx/AccessibleControlShape.hxx216
-rw-r--r--svx/inc/svx/AccessibleGraphicShape.hxx123
-rw-r--r--svx/inc/svx/AccessibleOLEShape.hxx133
-rwxr-xr-xsvx/inc/svx/AccessibleShape.hxx410
-rw-r--r--svx/inc/svx/AccessibleShapeInfo.hxx109
-rw-r--r--svx/inc/svx/AccessibleShapeTreeInfo.hxx216
-rw-r--r--svx/inc/svx/AccessibleTableShape.hxx132
-rw-r--r--svx/inc/svx/AccessibleTextHelper.hxx431
-rw-r--r--svx/inc/svx/ActionDescriptionProvider.hxx65
-rw-r--r--svx/inc/svx/ChildrenManager.hxx216
-rw-r--r--svx/inc/svx/DescriptionGenerator.hxx217
-rw-r--r--svx/inc/svx/EnhancedCustomShape2d.hxx221
-rw-r--r--svx/inc/svx/EnhancedCustomShapeFunctionParser.hxx214
-rw-r--r--svx/inc/svx/EnhancedCustomShapeGeometry.hxx101
-rw-r--r--svx/inc/svx/EnhancedCustomShapeTypeNames.hxx39
-rw-r--r--svx/inc/svx/IAccessibleParent.hxx95
-rw-r--r--svx/inc/svx/IAccessibleViewForwarder.hxx132
-rw-r--r--svx/inc/svx/IAccessibleViewForwarderListener.hxx74
-rw-r--r--svx/inc/svx/ParseContext.hxx91
-rwxr-xr-xsvx/inc/svx/ShapeTypeHandler.hxx237
-rw-r--r--svx/inc/svx/SmartTagCtl.hxx86
-rw-r--r--svx/inc/svx/SmartTagItem.hxx96
-rw-r--r--svx/inc/svx/SmartTagMgr.hxx234
-rw-r--r--svx/inc/svx/SpellDialogChildWindow.hxx125
-rw-r--r--svx/inc/svx/SvxShapeTypes.hxx88
-rw-r--r--svx/inc/svx/UnoNamespaceMap.hxx45
-rw-r--r--svx/inc/svx/XPropertyTable.hxx44
-rw-r--r--svx/inc/svx/algitem.hxx202
-rw-r--r--svx/inc/svx/anchorid.hxx42
-rw-r--r--svx/inc/svx/bmpmask.hxx200
-rw-r--r--svx/inc/svx/camera3d.hxx94
-rw-r--r--svx/inc/svx/charmap.hxx140
-rw-r--r--svx/inc/svx/checklbx.hxx94
-rw-r--r--svx/inc/svx/chrtitem.hxx385
-rw-r--r--svx/inc/svx/clipboardctl.hxx66
-rw-r--r--svx/inc/svx/clipfmtitem.hxx67
-rw-r--r--svx/inc/svx/colrctrl.hxx145
-rw-r--r--svx/inc/svx/connctrl.hxx77
-rw-r--r--svx/inc/svx/contdlg.hxx142
-rw-r--r--svx/inc/svx/ctredlin.hxx431
-rw-r--r--svx/inc/svx/cube3d.hxx95
-rw-r--r--svx/inc/svx/dataaccessdescriptor.hxx164
-rw-r--r--svx/inc/svx/databaselocationinput.hxx97
-rw-r--r--svx/inc/svx/databaseregistrationui.hxx53
-rw-r--r--svx/inc/svx/dbaexchange.hxx299
-rw-r--r--svx/inc/svx/dbaobjectex.hxx94
-rwxr-xr-xsvx/inc/svx/dbcharsethelper.hxx66
-rw-r--r--svx/inc/svx/dbexch.hrc57
-rwxr-xr-xsvx/inc/svx/dbtoolsclient.hxx235
-rw-r--r--svx/inc/svx/def3d.hxx54
-rw-r--r--svx/inc/svx/deflt3d.hxx135
-rw-r--r--svx/inc/svx/dialcontrol.hxx138
-rw-r--r--svx/inc/svx/dialmgr.hxx49
-rwxr-xr-xsvx/inc/svx/dialogs.hrc1053
-rw-r--r--svx/inc/svx/dlgctl3d.hxx215
-rw-r--r--svx/inc/svx/dlgctrl.hxx539
-rw-r--r--svx/inc/svx/dlgutil.hxx47
-rw-r--r--svx/inc/svx/drawitem.hxx246
-rw-r--r--svx/inc/svx/dstribut_enum.hxx53
-rw-r--r--svx/inc/svx/e3ditem.hxx73
-rw-r--r--svx/inc/svx/e3dsceneupdater.hxx74
-rw-r--r--svx/inc/svx/e3dundo.hxx124
-rw-r--r--svx/inc/svx/exthelpid.hrc42
-rw-r--r--svx/inc/svx/extrud3d.hxx110
-rw-r--r--svx/inc/svx/extrusionbar.hxx61
-rw-r--r--svx/inc/svx/extrusioncolorcontrol.hxx56
-rw-r--r--svx/inc/svx/f3dchild.hxx51
-rw-r--r--svx/inc/svx/fillctrl.hxx108
-rw-r--r--svx/inc/svx/flagsdef.hxx103
-rw-r--r--svx/inc/svx/float3d.hxx313
-rw-r--r--svx/inc/svx/fmdmod.hxx45
-rw-r--r--svx/inc/svx/fmdpage.hxx76
-rw-r--r--svx/inc/svx/fmglob.hxx66
-rw-r--r--svx/inc/svx/fmgridcl.hxx216
-rw-r--r--svx/inc/svx/fmgridif.hxx551
-rw-r--r--svx/inc/svx/fmmodel.hxx102
-rw-r--r--svx/inc/svx/fmobjfac.hxx51
-rw-r--r--svx/inc/svx/fmpage.hxx87
-rw-r--r--svx/inc/svx/fmresids.hrc264
-rw-r--r--svx/inc/svx/fmsearch.hxx95
-rw-r--r--svx/inc/svx/fmshell.hxx191
-rw-r--r--svx/inc/svx/fmsrccfg.hxx156
-rw-r--r--svx/inc/svx/fmsrcimp.hxx401
-rw-r--r--svx/inc/svx/fmtools.hxx234
-rw-r--r--svx/inc/svx/fmview.hxx166
-rw-r--r--svx/inc/svx/fntctl.hxx69
-rw-r--r--svx/inc/svx/fntctrl.hxx90
-rw-r--r--svx/inc/svx/fntszctl.hxx69
-rw-r--r--svx/inc/svx/fontlb.hxx138
-rw-r--r--svx/inc/svx/fontwork.hxx197
-rw-r--r--svx/inc/svx/fontworkbar.hxx61
-rw-r--r--svx/inc/svx/fontworkgallery.hxx131
-rw-r--r--svx/inc/svx/formatpaintbrushctrl.hxx73
-rw-r--r--svx/inc/svx/framebordertype.hxx65
-rw-r--r--svx/inc/svx/framelink.hxx727
-rw-r--r--svx/inc/svx/framelinkarray.hxx537
-rw-r--r--svx/inc/svx/frmdirlbox.hxx106
-rw-r--r--svx/inc/svx/frmsel.hxx204
-rw-r--r--svx/inc/svx/galbrws.hxx116
-rw-r--r--svx/inc/svx/galctrl.hxx191
-rw-r--r--svx/inc/svx/gallery.hxx174
-rw-r--r--svx/inc/svx/gallery1.hxx183
-rw-r--r--svx/inc/svx/galmisc.hxx262
-rw-r--r--svx/inc/svx/galtheme.hxx231
-rw-r--r--svx/inc/svx/globl3d.hxx53
-rw-r--r--svx/inc/svx/grafctrl.hxx191
-rw-r--r--svx/inc/svx/graphctl.hxx193
-rw-r--r--svx/inc/svx/grfcrop.hxx80
-rw-r--r--svx/inc/svx/grfflt.hxx69
-rw-r--r--svx/inc/svx/gridctrl.hxx623
-rw-r--r--svx/inc/svx/hdft.hxx136
-rw-r--r--svx/inc/svx/helperhittest3d.hxx110
-rw-r--r--svx/inc/svx/hlnkitem.hxx110
-rw-r--r--svx/inc/svx/htmlmode.hxx51
-rw-r--r--svx/inc/svx/hyperdlg.hxx58
-rw-r--r--svx/inc/svx/hyprlink.hxx43
-rw-r--r--svx/inc/svx/ifaceids.hxx45
-rw-r--r--svx/inc/svx/imapdlg.hxx211
-rw-r--r--svx/inc/svx/insctrl.hxx62
-rw-r--r--svx/inc/svx/ipolypolygoneditorcontroller.hxx76
-rw-r--r--svx/inc/svx/itemwin.hxx197
-rw-r--r--svx/inc/svx/langbox.hxx128
-rw-r--r--svx/inc/svx/lathe3d.hxx122
-rw-r--r--svx/inc/svx/layctrl.hxx79
-rw-r--r--svx/inc/svx/lboxctrl.hxx86
-rw-r--r--svx/inc/svx/linectrl.hxx175
-rw-r--r--svx/inc/svx/measctrl.hxx70
-rw-r--r--svx/inc/svx/modctrl.hxx60
-rw-r--r--svx/inc/svx/msdffdef.hxx1223
-rw-r--r--svx/inc/svx/numfmtsh.hxx267
-rw-r--r--svx/inc/svx/numinf.hxx100
-rw-r--r--svx/inc/svx/numvset.hxx165
-rw-r--r--svx/inc/svx/obj3d.hxx328
-rw-r--r--svx/inc/svx/objfac3d.hxx56
-rw-r--r--svx/inc/svx/ofaitem.hxx53
-rw-r--r--svx/inc/svx/optgenrl.hxx50
-rw-r--r--svx/inc/svx/optgrid.hxx180
-rw-r--r--svx/inc/svx/orienthelper.hxx132
-rw-r--r--svx/inc/svx/pagectrl.hxx170
-rw-r--r--svx/inc/svx/pageitem.hxx157
-rw-r--r--svx/inc/svx/paraprev.hxx113
-rw-r--r--svx/inc/svx/passwd.hxx86
-rw-r--r--svx/inc/svx/pfiledlg.hxx62
-rw-r--r--svx/inc/svx/polygn3d.hxx89
-rw-r--r--svx/inc/svx/polypolygoneditor.hxx76
-rw-r--r--svx/inc/svx/polysc3d.hxx50
-rw-r--r--svx/inc/svx/postattr.hxx133
-rw-r--r--svx/inc/svx/prtqry.hxx40
-rw-r--r--svx/inc/svx/pszctrl.hxx62
-rw-r--r--svx/inc/svx/rectenum.hxx46
-rw-r--r--svx/inc/svx/relfld.hxx73
-rw-r--r--svx/inc/svx/rotmodit.hxx69
-rw-r--r--svx/inc/svx/rubydialog.hxx204
-rw-r--r--svx/inc/svx/ruler.hxx270
-rw-r--r--svx/inc/svx/rulritem.hxx303
-rw-r--r--svx/inc/svx/scene3d.hxx252
-rw-r--r--svx/inc/svx/sdangitm.hxx59
-rw-r--r--svx/inc/svx/sdasaitm.hxx82
-rw-r--r--svx/inc/svx/sdasitm.hxx146
-rw-r--r--svx/inc/svx/sderitm.hxx42
-rw-r--r--svx/inc/svx/sdgcoitm.hxx86
-rw-r--r--svx/inc/svx/sdgcpitm.hxx54
-rw-r--r--svx/inc/svx/sdggaitm.hxx55
-rw-r--r--svx/inc/svx/sdginitm.hxx52
-rw-r--r--svx/inc/svx/sdgluitm.hxx69
-rw-r--r--svx/inc/svx/sdgmoitm.hxx62
-rw-r--r--svx/inc/svx/sdgtritm.hxx51
-rw-r--r--svx/inc/svx/sdmetitm.hxx61
-rw-r--r--svx/inc/svx/sdooitm.hxx58
-rw-r--r--svx/inc/svx/sdprcitm.hxx79
-rw-r--r--svx/inc/svx/sdr/animation/animationstate.hxx83
-rw-r--r--svx/inc/svx/sdr/animation/objectanimator.hxx57
-rw-r--r--svx/inc/svx/sdr/animation/scheduler.hxx159
-rw-r--r--svx/inc/svx/sdr/attribute/sdrfilltextattribute.hxx80
-rw-r--r--svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx92
-rw-r--r--svx/inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx82
-rw-r--r--svx/inc/svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx81
-rw-r--r--svx/inc/svx/sdr/attribute/sdrlineshadowtextattribute.hxx79
-rw-r--r--svx/inc/svx/sdr/attribute/sdrshadowtextattribute.hxx76
-rw-r--r--svx/inc/svx/sdr/attribute/sdrtextattribute.hxx130
-rw-r--r--svx/inc/svx/sdr/contact/displayinfo.hxx129
-rw-r--r--svx/inc/svx/sdr/contact/objectcontact.hxx229
-rw-r--r--svx/inc/svx/sdr/contact/objectcontactofobjlistpainter.hxx153
-rw-r--r--svx/inc/svx/sdr/contact/objectcontactofpageview.hxx153
-rw-r--r--svx/inc/svx/sdr/contact/objectcontacttools.hxx62
-rw-r--r--svx/inc/svx/sdr/contact/viewcontact.hxx172
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofe3d.hxx120
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofe3dcube.hxx71
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofe3dextrude.hxx71
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofe3dlathe.hxx71
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofe3dpolygon.hxx71
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx122
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofe3dsphere.hxx71
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofgraphic.hxx94
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofgroup.hxx75
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofmasterpagedescriptor.hxx85
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofpageobj.hxx80
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofsdrcaptionobj.hxx70
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofsdrcircobj.hxx70
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofsdredgeobj.hxx70
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofsdrmeasureobj.hxx70
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofsdrmediaobj.hxx89
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofsdrobj.hxx99
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofsdrobjcustomshape.hxx73
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofsdrole2obj.hxx81
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofsdrpage.hxx311
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofsdrpathobj.hxx70
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofsdrrectobj.hxx70
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactoftextobj.hxx65
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofunocontrol.hxx101
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofvirtobj.hxx70
-rw-r--r--svx/inc/svx/sdr/contact/viewobjectcontact.hxx157
-rw-r--r--svx/inc/svx/sdr/contact/viewobjectcontactofe3d.hxx82
-rw-r--r--svx/inc/svx/sdr/contact/viewobjectcontactofe3dscene.hxx62
-rw-r--r--svx/inc/svx/sdr/contact/viewobjectcontactofgraphic.hxx81
-rw-r--r--svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx59
-rw-r--r--svx/inc/svx/sdr/contact/viewobjectcontactofmasterpagedescriptor.hxx65
-rw-r--r--svx/inc/svx/sdr/contact/viewobjectcontactofpageobj.hxx71
-rw-r--r--svx/inc/svx/sdr/contact/viewobjectcontactofsdrmediaobj.hxx72
-rw-r--r--svx/inc/svx/sdr/contact/viewobjectcontactofsdrobj.hxx61
-rw-r--r--svx/inc/svx/sdr/contact/viewobjectcontactofsdrole2obj.hxx62
-rw-r--r--svx/inc/svx/sdr/contact/viewobjectcontactofsdrpage.hxx246
-rw-r--r--svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx142
-rw-r--r--svx/inc/svx/sdr/contact/viewobjectcontactredirector.hxx74
-rw-r--r--svx/inc/svx/sdr/event/eventhandler.hxx140
-rw-r--r--svx/inc/svx/sdr/overlay/overlayanimatedbitmapex.hxx105
-rw-r--r--svx/inc/svx/sdr/overlay/overlaybitmapex.hxx76
-rw-r--r--svx/inc/svx/sdr/overlay/overlaycrosshair.hxx59
-rw-r--r--svx/inc/svx/sdr/overlay/overlayhatchrect.hxx81
-rw-r--r--svx/inc/svx/sdr/overlay/overlayhelpline.hxx68
-rw-r--r--svx/inc/svx/sdr/overlay/overlayline.hxx68
-rw-r--r--svx/inc/svx/sdr/overlay/overlaymanager.hxx150
-rw-r--r--svx/inc/svx/sdr/overlay/overlaymanagerbuffered.hxx113
-rw-r--r--svx/inc/svx/sdr/overlay/overlayobject.hxx203
-rw-r--r--svx/inc/svx/sdr/overlay/overlayobjectcell.hxx70
-rw-r--r--svx/inc/svx/sdr/overlay/overlayobjectlist.hxx85
-rw-r--r--svx/inc/svx/sdr/overlay/overlaypolypolygon.hxx67
-rw-r--r--svx/inc/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx70
-rw-r--r--svx/inc/svx/sdr/overlay/overlayrollingrectangle.hxx85
-rw-r--r--svx/inc/svx/sdr/overlay/overlayselection.hxx95
-rw-r--r--svx/inc/svx/sdr/overlay/overlaytools.hxx278
-rw-r--r--svx/inc/svx/sdr/overlay/overlaytriangle.hxx72
-rw-r--r--svx/inc/svx/sdr/primitive2d/primitiveFactory2d.hxx84
-rw-r--r--svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx140
-rw-r--r--svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx87
-rw-r--r--svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx76
-rw-r--r--svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx97
-rw-r--r--svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx88
-rw-r--r--svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx120
-rw-r--r--svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx84
-rw-r--r--svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx133
-rw-r--r--svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx78
-rw-r--r--svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx92
-rw-r--r--svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx80
-rw-r--r--svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx60
-rw-r--r--svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx90
-rw-r--r--svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx305
-rw-r--r--svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx64
-rw-r--r--svx/inc/svx/sdr/primitive3d/sdrattributecreator3d.hxx63
-rw-r--r--svx/inc/svx/sdr/properties/attributeproperties.hxx101
-rw-r--r--svx/inc/svx/sdr/properties/captionproperties.hxx75
-rw-r--r--svx/inc/svx/sdr/properties/circleproperties.hxx75
-rw-r--r--svx/inc/svx/sdr/properties/connectorproperties.hxx71
-rw-r--r--svx/inc/svx/sdr/properties/customshapeproperties.hxx94
-rw-r--r--svx/inc/svx/sdr/properties/defaultproperties.hxx112
-rw-r--r--svx/inc/svx/sdr/properties/e3dcompoundproperties.hxx79
-rw-r--r--svx/inc/svx/sdr/properties/e3dextrudeproperties.hxx66
-rw-r--r--svx/inc/svx/sdr/properties/e3dlatheproperties.hxx66
-rw-r--r--svx/inc/svx/sdr/properties/e3dproperties.hxx72
-rw-r--r--svx/inc/svx/sdr/properties/e3dsceneproperties.hxx96
-rw-r--r--svx/inc/svx/sdr/properties/e3dsphereproperties.hxx66
-rw-r--r--svx/inc/svx/sdr/properties/emptyproperties.hxx104
-rw-r--r--svx/inc/svx/sdr/properties/graphicproperties.hxx75
-rw-r--r--svx/inc/svx/sdr/properties/groupproperties.hxx129
-rw-r--r--svx/inc/svx/sdr/properties/itemsettools.hxx76
-rw-r--r--svx/inc/svx/sdr/properties/measureproperties.hxx75
-rw-r--r--svx/inc/svx/sdr/properties/oleproperties.hxx69
-rw-r--r--svx/inc/svx/sdr/properties/pageproperties.hxx80
-rw-r--r--svx/inc/svx/sdr/properties/properties.hxx197
-rw-r--r--svx/inc/svx/sdr/properties/rectangleproperties.hxx69
-rw-r--r--svx/inc/svx/sdr/properties/textproperties.hxx97
-rw-r--r--svx/inc/svx/sdr/table/tabledesign.hxx54
-rw-r--r--svx/inc/svx/sdrcomment.hxx105
-rw-r--r--svx/inc/svx/sdrhittesthelper.hxx78
-rw-r--r--svx/inc/svx/sdrmasterpagedescriptor.hxx101
-rw-r--r--svx/inc/svx/sdrobjectfilter.hxx58
-rw-r--r--svx/inc/svx/sdrobjectuser.hxx60
-rw-r--r--svx/inc/svx/sdrpageuser.hxx60
-rw-r--r--svx/inc/svx/sdrpagewindow.hxx143
-rw-r--r--svx/inc/svx/sdrpaintwindow.hxx167
-rw-r--r--svx/inc/svx/sdshcitm.hxx46
-rw-r--r--svx/inc/svx/sdshitm.hxx44
-rw-r--r--svx/inc/svx/sdshtitm.hxx42
-rw-r--r--svx/inc/svx/sdsxyitm.hxx51
-rw-r--r--svx/inc/svx/sdtaaitm.hxx47
-rw-r--r--svx/inc/svx/sdtacitm.hxx40
-rw-r--r--svx/inc/svx/sdtaditm.hxx61
-rw-r--r--svx/inc/svx/sdtagitm.hxx51
-rw-r--r--svx/inc/svx/sdtaiitm.hxx45
-rw-r--r--svx/inc/svx/sdtaitm.hxx89
-rw-r--r--svx/inc/svx/sdtakitm.hxx105
-rw-r--r--svx/inc/svx/sdtayitm.hxx44
-rw-r--r--svx/inc/svx/sdtcfitm.hxx42
-rw-r--r--svx/inc/svx/sdtditm.hxx60
-rw-r--r--svx/inc/svx/sdtfchim.hxx57
-rw-r--r--svx/inc/svx/sdtfsitm.hxx71
-rw-r--r--svx/inc/svx/sdtmfitm.hxx69
-rw-r--r--svx/inc/svx/sdynitm.hxx55
-rw-r--r--svx/inc/svx/selctrl.hxx61
-rw-r--r--svx/inc/svx/selectioncontroller.hxx86
-rwxr-xr-xsvx/inc/svx/shapeproperty.hxx59
-rw-r--r--svx/inc/svx/shapepropertynotifier.hxx148
-rw-r--r--svx/inc/svx/simptabl.hxx180
-rw-r--r--svx/inc/svx/sphere3d.hxx88
-rw-r--r--svx/inc/svx/splitcelldlg.hxx62
-rw-r--r--svx/inc/svx/srchdlg.hxx302
-rw-r--r--svx/inc/svx/stddlg.hxx51
-rw-r--r--svx/inc/svx/strarray.hxx53
-rw-r--r--svx/inc/svx/subtoolboxcontrol.hxx55
-rw-r--r--svx/inc/svx/svdattr.hxx76
-rw-r--r--svx/inc/svx/svdattrx.hxx85
-rw-r--r--svx/inc/svx/svdcrtv.hxx209
-rw-r--r--svx/inc/svx/svddef.hxx313
-rw-r--r--svx/inc/svx/svddrag.hxx192
-rw-r--r--svx/inc/svx/svddrgmt.hxx324
-rw-r--r--svx/inc/svx/svddrgv.hxx321
-rw-r--r--svx/inc/svx/svdedtv.hxx461
-rw-r--r--svx/inc/svx/svdedxv.hxx306
-rw-r--r--svx/inc/svx/svdetc.hxx356
-rw-r--r--svx/inc/svx/svdfield.hxx36
-rw-r--r--svx/inc/svx/svdglev.hxx119
-rw-r--r--svx/inc/svx/svdglob.hxx69
-rw-r--r--svx/inc/svx/svdglue.hxx151
-rw-r--r--svx/inc/svx/svdhdl.hxx534
-rw-r--r--svx/inc/svx/svdhlpln.hxx107
-rw-r--r--svx/inc/svx/svditer.hxx81
-rw-r--r--svx/inc/svx/svditext.hxx37
-rw-r--r--svx/inc/svx/svdlayer.hxx160
-rw-r--r--svx/inc/svx/svdmark.hxx412
-rw-r--r--svx/inc/svx/svdmodel.hxx772
-rw-r--r--svx/inc/svx/svdmrkv.hxx539
-rw-r--r--svx/inc/svx/svdoashp.hxx265
-rw-r--r--svx/inc/svx/svdoattr.hxx90
-rw-r--r--svx/inc/svx/svdobj.hxx1186
-rw-r--r--svx/inc/svx/svdocapt.hxx171
-rw-r--r--svx/inc/svx/svdocirc.hxx153
-rw-r--r--svx/inc/svx/svdoedge.hxx436
-rw-r--r--svx/inc/svx/svdograf.hxx228
-rw-r--r--svx/inc/svx/svdogrp.hxx125
-rw-r--r--svx/inc/svx/svdomeas.hxx217
-rw-r--r--svx/inc/svx/svdomedia.hxx93
-rw-r--r--svx/inc/svx/svdoole2.hxx190
-rw-r--r--svx/inc/svx/svdopage.hxx76
-rw-r--r--svx/inc/svx/svdopath.hxx195
-rw-r--r--svx/inc/svx/svdorect.hxx137
-rw-r--r--svx/inc/svx/svdotable.hxx342
-rw-r--r--svx/inc/svx/svdotext.hxx610
-rw-r--r--svx/inc/svx/svdouno.hxx163
-rw-r--r--svx/inc/svx/svdoutl.hxx60
-rw-r--r--svx/inc/svx/svdovirt.hxx165
-rw-r--r--svx/inc/svx/svdpage.hxx618
-rw-r--r--svx/inc/svx/svdpagv.hxx297
-rw-r--r--svx/inc/svx/svdpntv.hxx580
-rw-r--r--svx/inc/svx/svdpoev.hxx110
-rw-r--r--svx/inc/svx/svdpool.hxx63
-rw-r--r--svx/inc/svx/svdsnpv.hxx338
-rw-r--r--svx/inc/svx/svdsob.hxx133
-rw-r--r--svx/inc/svx/svdstr.hrc790
-rw-r--r--svx/inc/svx/svdtext.hxx88
-rw-r--r--svx/inc/svx/svdtrans.hxx326
-rw-r--r--svx/inc/svx/svdtypes.hxx169
-rw-r--r--svx/inc/svx/svdundo.hxx882
-rw-r--r--svx/inc/svx/svdview.hxx339
-rw-r--r--svx/inc/svx/svdviter.hxx126
-rw-r--r--svx/inc/svx/svdxcgv.hxx162
-rw-r--r--svx/inc/svx/svimbase.hxx212
-rw-r--r--svx/inc/svx/svx3ditems.hxx377
-rw-r--r--svx/inc/svx/svxcommands.h604
-rw-r--r--svx/inc/svx/svxdlg.hxx507
-rw-r--r--svx/inc/svx/svxdllapi.h40
-rw-r--r--svx/inc/svx/svxerr.hxx110
-rw-r--r--svx/inc/svx/svxgrahicitem.hxx54
-rwxr-xr-xsvx/inc/svx/svxids.hrc1328
-rw-r--r--svx/inc/svx/svxitems.hrc174
-rw-r--r--svx/inc/svx/swframeexample.hxx101
-rw-r--r--svx/inc/svx/swframeposstrings.hxx94
-rw-r--r--svx/inc/svx/swframevalidation.hxx87
-rw-r--r--svx/inc/svx/sxallitm.hxx69
-rw-r--r--svx/inc/svx/sxcaitm.hxx60
-rw-r--r--svx/inc/svx/sxcecitm.hxx93
-rw-r--r--svx/inc/svx/sxcgitm.hxx43
-rw-r--r--svx/inc/svx/sxciaitm.hxx51
-rw-r--r--svx/inc/svx/sxcikitm.hxx55
-rw-r--r--svx/inc/svx/sxcllitm.hxx58
-rw-r--r--svx/inc/svx/sxctitm.hxx52
-rw-r--r--svx/inc/svx/sxekitm.hxx58
-rw-r--r--svx/inc/svx/sxelditm.hxx64
-rw-r--r--svx/inc/svx/sxenditm.hxx78
-rw-r--r--svx/inc/svx/sxfiitm.hxx57
-rw-r--r--svx/inc/svx/sxlayitm.hxx56
-rw-r--r--svx/inc/svx/sxlogitm.hxx51
-rw-r--r--svx/inc/svx/sxmbritm.hxx48
-rw-r--r--svx/inc/svx/sxmfsitm.hxx42
-rw-r--r--svx/inc/svx/sxmkitm.hxx55
-rw-r--r--svx/inc/svx/sxmlhitm.hxx85
-rw-r--r--svx/inc/svx/sxmoitm.hxx41
-rw-r--r--svx/inc/svx/sxmovitm.hxx51
-rw-r--r--svx/inc/svx/sxmsitm.hxx43
-rw-r--r--svx/inc/svx/sxmspitm.hxx51
-rw-r--r--svx/inc/svx/sxmsuitm.hxx40
-rw-r--r--svx/inc/svx/sxmtaitm.hxx51
-rw-r--r--svx/inc/svx/sxmtfitm.hxx58
-rw-r--r--svx/inc/svx/sxmtpitm.hxx77
-rw-r--r--svx/inc/svx/sxmtritm.hxx49
-rw-r--r--svx/inc/svx/sxmuitm.hxx54
-rw-r--r--svx/inc/svx/sxoneitm.hxx69
-rw-r--r--svx/inc/svx/sxonitm.hxx44
-rw-r--r--svx/inc/svx/sxopitm.hxx48
-rw-r--r--svx/inc/svx/sxraitm.hxx42
-rw-r--r--svx/inc/svx/sxreaitm.hxx56
-rw-r--r--svx/inc/svx/sxreoitm.hxx56
-rw-r--r--svx/inc/svx/sxroaitm.hxx42
-rw-r--r--svx/inc/svx/sxrooitm.hxx42
-rw-r--r--svx/inc/svx/sxsaitm.hxx42
-rw-r--r--svx/inc/svx/sxsalitm.hxx51
-rw-r--r--svx/inc/svx/sxsiitm.hxx45
-rw-r--r--svx/inc/svx/sxsoitm.hxx51
-rw-r--r--svx/inc/svx/sxtraitm.hxx69
-rw-r--r--svx/inc/svx/tabarea.hxx76
-rw-r--r--svx/inc/svx/tabline.hxx66
-rw-r--r--svx/inc/svx/tbcontrl.hxx447
-rw-r--r--svx/inc/svx/tbxalign.hxx54
-rw-r--r--svx/inc/svx/tbxcolor.hxx71
-rw-r--r--svx/inc/svx/tbxcolorupdate.hxx85
-rw-r--r--svx/inc/svx/tbxctl.hxx62
-rw-r--r--svx/inc/svx/tbxcustomshapes.hxx68
-rw-r--r--svx/inc/svx/tbxdraw.hxx75
-rw-r--r--svx/inc/svx/txencbox.hxx121
-rw-r--r--svx/inc/svx/txenctab.hxx55
-rw-r--r--svx/inc/svx/ucsubset.hrc155
-rw-r--r--svx/inc/svx/ucsubset.hxx81
-rw-r--r--svx/inc/svx/unoapi.hxx102
-rw-r--r--svx/inc/svx/unofill.hxx44
-rw-r--r--svx/inc/svx/unomaster.hxx66
-rw-r--r--svx/inc/svx/unomid.hxx117
-rw-r--r--svx/inc/svx/unomod.hxx66
-rw-r--r--svx/inc/svx/unomodel.hxx112
-rw-r--r--svx/inc/svx/unopage.hxx160
-rw-r--r--svx/inc/svx/unopool.hxx96
-rw-r--r--svx/inc/svx/unoprov.hxx149
-rw-r--r--svx/inc/svx/unoshape.hxx892
-rw-r--r--svx/inc/svx/unoshcol.hxx101
-rw-r--r--svx/inc/svx/unoshprp.hxx534
-rw-r--r--svx/inc/svx/unoshtxt.hxx101
-rw-r--r--svx/inc/svx/verttexttbxctrl.hxx67
-rw-r--r--svx/inc/svx/view3d.hxx277
-rw-r--r--svx/inc/svx/viewlayoutitem.hxx63
-rw-r--r--svx/inc/svx/viewpt3d.hxx132
-rw-r--r--svx/inc/svx/volume3d.hxx33
-rw-r--r--svx/inc/svx/wrapfield.hxx58
-rw-r--r--svx/inc/svx/xattr.hxx67
-rw-r--r--svx/inc/svx/xbitmap.hxx100
-rw-r--r--svx/inc/svx/xbtmpit.hxx76
-rw-r--r--svx/inc/svx/xcolit.hxx67
-rw-r--r--svx/inc/svx/xdash.hxx77
-rw-r--r--svx/inc/svx/xdef.hxx102
-rw-r--r--svx/inc/svx/xenum.hxx62
-rw-r--r--svx/inc/svx/xexch.hxx67
-rw-r--r--svx/inc/svx/xfillit.hxx51
-rw-r--r--svx/inc/svx/xfillit0.hxx63
-rw-r--r--svx/inc/svx/xflasit.hxx54
-rw-r--r--svx/inc/svx/xflbckit.hxx58
-rw-r--r--svx/inc/svx/xflbmpit.hxx60
-rw-r--r--svx/inc/svx/xflbmsli.hxx56
-rw-r--r--svx/inc/svx/xflbmsxy.hxx88
-rw-r--r--svx/inc/svx/xflbmtit.hxx56
-rw-r--r--svx/inc/svx/xflboxy.hxx79
-rw-r--r--svx/inc/svx/xflbstit.hxx56
-rw-r--r--svx/inc/svx/xflbtoxy.hxx79
-rw-r--r--svx/inc/svx/xflclit.hxx63
-rw-r--r--svx/inc/svx/xflftrit.hxx72
-rw-r--r--svx/inc/svx/xflgrit.hxx74
-rw-r--r--svx/inc/svx/xflhtit.hxx76
-rw-r--r--svx/inc/svx/xfltrit.hxx54
-rw-r--r--svx/inc/svx/xftadit.hxx55
-rw-r--r--svx/inc/svx/xftdiit.hxx50
-rw-r--r--svx/inc/svx/xftmrit.hxx50
-rw-r--r--svx/inc/svx/xftouit.hxx50
-rw-r--r--svx/inc/svx/xftsfit.hxx55
-rw-r--r--svx/inc/svx/xftshcit.hxx53
-rw-r--r--svx/inc/svx/xftshit.hxx56
-rw-r--r--svx/inc/svx/xftshtit.hxx49
-rw-r--r--svx/inc/svx/xftshxy.hxx67
-rw-r--r--svx/inc/svx/xftstit.hxx50
-rw-r--r--svx/inc/svx/xgrad.hxx86
-rw-r--r--svx/inc/svx/xgrscit.hxx54
-rw-r--r--svx/inc/svx/xhatch.hxx65
-rw-r--r--svx/inc/svx/xit.hxx88
-rw-r--r--svx/inc/svx/xlineit.hxx54
-rw-r--r--svx/inc/svx/xlineit0.hxx59
-rw-r--r--svx/inc/svx/xlinjoit.hxx60
-rw-r--r--svx/inc/svx/xlnasit.hxx55
-rw-r--r--svx/inc/svx/xlnclit.hxx58
-rw-r--r--svx/inc/svx/xlndsit.hxx80
-rw-r--r--svx/inc/svx/xlnedcit.hxx55
-rw-r--r--svx/inc/svx/xlnedit.hxx72
-rw-r--r--svx/inc/svx/xlnedwit.hxx59
-rw-r--r--svx/inc/svx/xlnstcit.hxx56
-rw-r--r--svx/inc/svx/xlnstit.hxx72
-rw-r--r--svx/inc/svx/xlnstwit.hxx58
-rw-r--r--svx/inc/svx/xlntrit.hxx54
-rw-r--r--svx/inc/svx/xlnwtit.hxx55
-rw-r--r--svx/inc/svx/xmleohlp.hxx149
-rw-r--r--svx/inc/svx/xmlexchg.hxx104
-rw-r--r--svx/inc/svx/xmlgrhlp.hxx163
-rw-r--r--svx/inc/svx/xmlsecctrl.hxx59
-rw-r--r--svx/inc/svx/xoutbmp.hxx97
-rw-r--r--svx/inc/svx/xpoly.hxx212
-rw-r--r--svx/inc/svx/xpool.hxx60
-rw-r--r--svx/inc/svx/xsetit.hxx53
-rw-r--r--svx/inc/svx/xsflclit.hxx58
-rw-r--r--svx/inc/svx/xtable.hxx653
-rw-r--r--svx/inc/svx/xtextit.hxx48
-rw-r--r--svx/inc/svx/xtextit0.hxx72
-rw-r--r--svx/inc/svx/zoom_def.hxx8
-rw-r--r--svx/inc/svx/zoomctrl.hxx59
-rw-r--r--svx/inc/svx/zoomitem.hxx91
-rw-r--r--svx/inc/svx/zoomsliderctrl.hxx62
-rw-r--r--svx/inc/svx/zoomslideritem.hxx68
-rw-r--r--svx/inc/svxempty.hxx45
-rw-r--r--svx/inc/tbunocontroller.hxx89
-rw-r--r--svx/inc/tbunosearchcontrollers.hxx282
-rw-r--r--svx/inc/uiks.hxx89
-rw-r--r--svx/inc/unomlstr.hxx57
-rw-r--r--svx/inc/xpolyimp.hxx106
-rw-r--r--svx/prj/build.lst2
-rw-r--r--svx/prj/d.lst0
-rwxr-xr-xsvx/prj/makefile.mk40
-rw-r--r--svx/qa/unoapi/Test.java52
-rw-r--r--svx/qa/unoapi/knownissues.xcl90
-rw-r--r--svx/qa/unoapi/svx.sce31
-rw-r--r--svx/qa/unoapi/testdocuments/SvxShape.sxdbin0 -> 6344 bytes
-rw-r--r--svx/qa/unoapi/testdocuments/crazy-blue.jpgbin0 -> 4451 bytes
-rw-r--r--svx/qa/unoapi/testdocuments/space-metal.jpgbin0 -> 4313 bytes
-rw-r--r--svx/sdi/fmslots.sdi770
-rw-r--r--svx/sdi/svx.sdi15138
-rw-r--r--svx/sdi/svxitems.sdi698
-rw-r--r--svx/sdi/svxslots.hrc33
-rw-r--r--svx/sdi/svxslots.sdi77
-rw-r--r--svx/sdi/xoitems.sdi163
-rw-r--r--svx/source/accessibility/AccessibleControlShape.cxx920
-rw-r--r--svx/source/accessibility/AccessibleEmptyEditSource.cxx356
-rw-r--r--svx/source/accessibility/AccessibleEmptyEditSource.hxx100
-rw-r--r--svx/source/accessibility/AccessibleFrameSelector.cxx740
-rw-r--r--svx/source/accessibility/AccessibleGraphicShape.cxx212
-rw-r--r--svx/source/accessibility/AccessibleOLEShape.cxx232
-rwxr-xr-xsvx/source/accessibility/AccessibleShape.cxx1244
-rw-r--r--svx/source/accessibility/AccessibleShapeInfo.cxx84
-rw-r--r--svx/source/accessibility/AccessibleShapeTreeInfo.cxx223
-rw-r--r--svx/source/accessibility/AccessibleTextEventQueue.cxx111
-rw-r--r--svx/source/accessibility/AccessibleTextEventQueue.hxx103
-rw-r--r--svx/source/accessibility/AccessibleTextHelper.cxx2077
-rw-r--r--svx/source/accessibility/ChildrenManager.cxx180
-rw-r--r--svx/source/accessibility/ChildrenManagerImpl.cxx1098
-rw-r--r--svx/source/accessibility/ChildrenManagerImpl.hxx577
-rw-r--r--svx/source/accessibility/DGColorNameLookUp.cxx148
-rw-r--r--svx/source/accessibility/DescriptionGenerator.cxx484
-rw-r--r--svx/source/accessibility/GraphCtlAccessibleContext.cxx1027
-rwxr-xr-xsvx/source/accessibility/ShapeTypeHandler.cxx338
-rw-r--r--svx/source/accessibility/SvxShapeTypes.cxx207
-rw-r--r--svx/source/accessibility/accessibility.src262
-rw-r--r--svx/source/accessibility/charmapacc.cxx891
-rw-r--r--svx/source/accessibility/svxrectctaccessiblecontext.cxx1206
-rw-r--r--svx/source/core/coreservices.cxx145
-rw-r--r--svx/source/customshapes/EnhancedCustomShape2d.cxx2175
-rw-r--r--svx/source/customshapes/EnhancedCustomShape3d.cxx752
-rw-r--r--svx/source/customshapes/EnhancedCustomShape3d.hxx78
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeEngine.cxx471
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeEngine.hxx124
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeFontWork.cxx910
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeFontWork.hxx45
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx1212
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeGeometry.cxx8273
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeHandle.cxx93
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeHandle.hxx69
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx321
-rw-r--r--svx/source/customshapes/tbxcustomshapes.cxx204
-rw-r--r--svx/source/dialog/SpellDialogChildWindow.cxx119
-rw-r--r--svx/source/dialog/_bmpmask.cxx1241
-rw-r--r--svx/source/dialog/_contdlg.cxx1161
-rw-r--r--svx/source/dialog/bmpmask.hrc62
-rw-r--r--svx/source/dialog/bmpmask.src373
-rw-r--r--svx/source/dialog/charmap.cxx893
-rw-r--r--svx/source/dialog/checklbx.cxx277
-rw-r--r--svx/source/dialog/connctrl.cxx387
-rw-r--r--svx/source/dialog/contdlg.hrc87
-rw-r--r--svx/source/dialog/contdlg.src290
-rw-r--r--svx/source/dialog/contimp.hxx127
-rw-r--r--svx/source/dialog/contwnd.cxx358
-rw-r--r--svx/source/dialog/contwnd.hxx90
-rw-r--r--svx/source/dialog/ctredlin.cxx1531
-rw-r--r--svx/source/dialog/ctredlin.hrc70
-rw-r--r--svx/source/dialog/ctredlin.src365
-rw-r--r--svx/source/dialog/databaseregistrationui.cxx69
-rw-r--r--svx/source/dialog/dialcontrol.cxx572
-rw-r--r--svx/source/dialog/dialmgr.cxx54
-rw-r--r--svx/source/dialog/dlgctl3d.cxx1323
-rw-r--r--svx/source/dialog/dlgctrl.cxx2287
-rw-r--r--svx/source/dialog/dlgctrl.src34
-rw-r--r--svx/source/dialog/dlgutil.cxx55
-rw-r--r--svx/source/dialog/docrecovery.cxx2181
-rw-r--r--svx/source/dialog/docrecovery.hrc292
-rw-r--r--svx/source/dialog/docrecovery.src654
-rw-r--r--svx/source/dialog/fntctrl.cxx851
-rw-r--r--svx/source/dialog/fontlb.cxx189
-rw-r--r--svx/source/dialog/fontwork.cxx1283
-rw-r--r--svx/source/dialog/fontwork.hrc67
-rw-r--r--svx/source/dialog/fontwork.src560
-rw-r--r--svx/source/dialog/framelink.cxx1531
-rw-r--r--svx/source/dialog/framelinkarray.cxx1247
-rw-r--r--svx/source/dialog/frmdirlbox.cxx127
-rw-r--r--svx/source/dialog/frmsel.cxx1205
-rw-r--r--svx/source/dialog/frmsel.src70
-rw-r--r--svx/source/dialog/graphctl.cxx960
-rw-r--r--svx/source/dialog/grfflt.cxx793
-rw-r--r--svx/source/dialog/hdft.cxx983
-rw-r--r--svx/source/dialog/hdft.hrc52
-rw-r--r--svx/source/dialog/hdft.src383
-rw-r--r--svx/source/dialog/hyperdlg.cxx107
-rw-r--r--svx/source/dialog/hyprdlg.hxx143
-rw-r--r--svx/source/dialog/hyprlink.cxx999
-rw-r--r--svx/source/dialog/hyprlink.hrc58
-rw-r--r--svx/source/dialog/hyprlink.src167
-rw-r--r--svx/source/dialog/imapdlg.cxx1055
-rw-r--r--svx/source/dialog/imapdlg.hrc106
-rw-r--r--svx/source/dialog/imapdlg.src369
-rw-r--r--svx/source/dialog/imapimp.hxx56
-rw-r--r--svx/source/dialog/imapwnd.cxx1069
-rw-r--r--svx/source/dialog/imapwnd.hxx226
-rw-r--r--svx/source/dialog/langbox.cxx526
-rw-r--r--svx/source/dialog/langbox.src49
-rw-r--r--svx/source/dialog/language.src66
-rw-r--r--svx/source/dialog/measctrl.cxx199
-rw-r--r--svx/source/dialog/optgrid.cxx415
-rw-r--r--svx/source/dialog/optgrid.hrc71
-rw-r--r--svx/source/dialog/optgrid.src372
-rw-r--r--svx/source/dialog/orienthelper.cxx206
-rw-r--r--svx/source/dialog/pagectrl.cxx421
-rw-r--r--svx/source/dialog/paraprev.cxx238
-rw-r--r--svx/source/dialog/passwd.cxx136
-rw-r--r--svx/source/dialog/passwd.hrc51
-rw-r--r--svx/source/dialog/passwd.src156
-rw-r--r--svx/source/dialog/pfiledlg.cxx280
-rw-r--r--svx/source/dialog/prtqry.cxx62
-rw-r--r--svx/source/dialog/prtqry.src74
-rw-r--r--svx/source/dialog/relfld.cxx146
-rw-r--r--svx/source/dialog/rlrcitem.cxx166
-rw-r--r--svx/source/dialog/rlrcitem.hxx51
-rw-r--r--svx/source/dialog/rubydialog.cxx990
-rw-r--r--svx/source/dialog/rubydialog.hrc53
-rw-r--r--svx/source/dialog/rubydialog.src221
-rw-r--r--svx/source/dialog/ruler.hrc37
-rw-r--r--svx/source/dialog/ruler.src137
-rw-r--r--svx/source/dialog/rulritem.cxx743
-rw-r--r--svx/source/dialog/sdstring.src1289
-rw-r--r--svx/source/dialog/sendreportgen.cxx53
-rw-r--r--svx/source/dialog/sendreportunx.cxx272
-rw-r--r--svx/source/dialog/sendreportw32.cxx260
-rw-r--r--svx/source/dialog/simptabl.cxx579
-rw-r--r--svx/source/dialog/srchctrl.cxx90
-rw-r--r--svx/source/dialog/srchctrl.hxx51
-rw-r--r--svx/source/dialog/srchdlg.cxx2549
-rw-r--r--svx/source/dialog/srchdlg.hrc93
-rw-r--r--svx/source/dialog/srchdlg.src442
-rw-r--r--svx/source/dialog/stddlg.cxx67
-rw-r--r--svx/source/dialog/strarray.cxx99
-rw-r--r--svx/source/dialog/svxbmpnumvalueset.cxx572
-rw-r--r--svx/source/dialog/svxbmpnumvalueset.src127
-rw-r--r--svx/source/dialog/svxdlg.cxx41
-rw-r--r--svx/source/dialog/svxgrahicitem.cxx50
-rw-r--r--svx/source/dialog/svxruler.cxx3976
-rw-r--r--svx/source/dialog/swframeexample.cxx737
-rw-r--r--svx/source/dialog/swframeposstrings.cxx76
-rw-r--r--svx/source/dialog/swframeposstrings.src245
-rw-r--r--svx/source/dialog/txencbox.cxx254
-rw-r--r--svx/source/dialog/txenctab.cxx76
-rw-r--r--svx/source/dialog/txenctab.src122
-rwxr-xr-xsvx/source/dialog/ucsubset.src511
-rw-r--r--svx/source/dialog/wrapfield.cxx61
-rw-r--r--svx/source/engine3d/camera3d.cxx392
-rw-r--r--svx/source/engine3d/cube3d.cxx199
-rw-r--r--svx/source/engine3d/deflt3d.cxx81
-rw-r--r--svx/source/engine3d/dragmt3d.cxx789
-rw-r--r--svx/source/engine3d/e3dsceneupdater.cxx130
-rw-r--r--svx/source/engine3d/e3dundo.cxx180
-rw-r--r--svx/source/engine3d/extrud3d.cxx264
-rw-r--r--svx/source/engine3d/float3d.cxx3333
-rw-r--r--svx/source/engine3d/float3d.src1490
-rw-r--r--svx/source/engine3d/helperhittest3d.cxx295
-rw-r--r--svx/source/engine3d/helperminimaldepth3d.cxx212
-rw-r--r--svx/source/engine3d/helperminimaldepth3d.hxx60
-rw-r--r--svx/source/engine3d/lathe3d.cxx277
-rw-r--r--svx/source/engine3d/obj3d.cxx1280
-rw-r--r--svx/source/engine3d/objfac3d.cxx110
-rw-r--r--svx/source/engine3d/polygn3d.cxx361
-rw-r--r--svx/source/engine3d/polysc3d.cxx74
-rw-r--r--svx/source/engine3d/scene3d.cxx884
-rw-r--r--svx/source/engine3d/sphere3d.cxx226
-rw-r--r--svx/source/engine3d/string3d.src116
-rw-r--r--svx/source/engine3d/svx3ditems.cxx547
-rw-r--r--svx/source/engine3d/view3d.cxx1927
-rw-r--r--svx/source/engine3d/view3d1.cxx230
-rw-r--r--svx/source/engine3d/viewpt3d2.cxx394
-rw-r--r--svx/source/fmcomp/dbaexchange.cxx732
-rw-r--r--svx/source/fmcomp/dbaobjectex.cxx187
-rw-r--r--svx/source/fmcomp/fmgridcl.cxx2144
-rw-r--r--svx/source/fmcomp/fmgridif.cxx2967
-rw-r--r--svx/source/fmcomp/gridcell.cxx4843
-rw-r--r--svx/source/fmcomp/gridcols.cxx114
-rw-r--r--svx/source/fmcomp/gridctrl.cxx3893
-rw-r--r--svx/source/fmcomp/gridctrl.src259
-rw-r--r--svx/source/fmcomp/trace.cxx124
-rw-r--r--svx/source/fmcomp/xmlexchg.cxx93
-rw-r--r--svx/source/form/ParseContext.cxx249
-rw-r--r--svx/source/form/dataaccessdescriptor.cxx567
-rw-r--r--svx/source/form/databaselocationinput.cxx314
-rw-r--r--svx/source/form/datalistener.cxx98
-rw-r--r--svx/source/form/datanavi.cxx3732
-rw-r--r--svx/source/form/datanavi.src1195
-rw-r--r--svx/source/form/dbcharsethelper.cxx59
-rw-r--r--svx/source/form/dbtoolsclient.cxx366
-rw-r--r--svx/source/form/delayedevent.cxx68
-rw-r--r--svx/source/form/filtnav.cxx2085
-rw-r--r--svx/source/form/filtnav.src62
-rw-r--r--svx/source/form/fmPropBrw.cxx722
-rw-r--r--svx/source/form/fmcontrolbordermanager.cxx445
-rw-r--r--svx/source/form/fmcontrollayout.cxx328
-rw-r--r--svx/source/form/fmdmod.cxx131
-rw-r--r--svx/source/form/fmdocumentclassification.cxx214
-rw-r--r--svx/source/form/fmdpage.cxx146
-rw-r--r--svx/source/form/fmexch.cxx443
-rw-r--r--svx/source/form/fmexpl.cxx707
-rw-r--r--svx/source/form/fmexpl.src383
-rw-r--r--svx/source/form/fmitems.cxx69
-rw-r--r--svx/source/form/fmmodel.cxx369
-rw-r--r--svx/source/form/fmobj.cxx736
-rw-r--r--svx/source/form/fmobjfac.cxx278
-rw-r--r--svx/source/form/fmpage.cxx282
-rw-r--r--svx/source/form/fmpgeimp.cxx739
-rw-r--r--svx/source/form/fmscriptingenv.cxx522
-rw-r--r--svx/source/form/fmservs.cxx106
-rw-r--r--svx/source/form/fmshell.cxx1516
-rw-r--r--svx/source/form/fmshimp.cxx4259
-rw-r--r--svx/source/form/fmsrccfg.cxx363
-rw-r--r--svx/source/form/fmsrcimp.cxx1301
-rw-r--r--svx/source/form/fmstring.src491
-rw-r--r--svx/source/form/fmtextcontroldialogs.cxx131
-rw-r--r--svx/source/form/fmtextcontrolfeature.cxx131
-rw-r--r--svx/source/form/fmtextcontrolshell.cxx1398
-rw-r--r--svx/source/form/fmtools.cxx496
-rw-r--r--svx/source/form/fmundo.cxx1349
-rw-r--r--svx/source/form/fmview.cxx623
-rw-r--r--svx/source/form/fmvwimp.cxx1918
-rw-r--r--svx/source/form/formcontrolfactory.cxx733
-rw-r--r--svx/source/form/formcontroller.cxx4334
-rw-r--r--svx/source/form/formcontrolling.cxx604
-rw-r--r--svx/source/form/formdispatchinterceptor.cxx214
-rw-r--r--svx/source/form/formfeaturedispatcher.cxx241
-rw-r--r--svx/source/form/formshell.src228
-rw-r--r--svx/source/form/formtoolbars.cxx117
-rw-r--r--svx/source/form/legacyformcontroller.cxx226
-rw-r--r--svx/source/form/navigatortree.cxx2322
-rw-r--r--svx/source/form/navigatortreemodel.cxx1126
-rw-r--r--svx/source/form/sdbdatacolumn.cxx287
-rw-r--r--svx/source/form/sqlparserclient.cxx62
-rw-r--r--svx/source/form/stringlistresource.cxx71
-rw-r--r--svx/source/form/tabwin.cxx476
-rw-r--r--svx/source/form/tbxform.cxx477
-rw-r--r--svx/source/form/typeconversionclient.cxx58
-rw-r--r--svx/source/form/typemap.cxx65
-rw-r--r--svx/source/form/xfm_addcondition.cxx193
-rw-r--r--svx/source/gallery2/codec.cxx173
-rw-r--r--svx/source/gallery2/codec.hxx51
-rw-r--r--svx/source/gallery2/galbrws.cxx285
-rw-r--r--svx/source/gallery2/galbrws1.cxx715
-rw-r--r--svx/source/gallery2/galbrws1.hxx135
-rw-r--r--svx/source/gallery2/galbrws2.cxx1253
-rw-r--r--svx/source/gallery2/galctrl.cxx723
-rw-r--r--svx/source/gallery2/galexpl.cxx515
-rw-r--r--svx/source/gallery2/gallery.src493
-rw-r--r--svx/source/gallery2/gallery1.cxx923
-rw-r--r--svx/source/gallery2/gallerydrawmodel.hxx44
-rw-r--r--svx/source/gallery2/galmisc.cxx669
-rw-r--r--svx/source/gallery2/galobj.cxx607
-rw-r--r--svx/source/gallery2/galtheme.cxx1599
-rw-r--r--svx/source/gallery2/galtheme.src341
-rw-r--r--svx/source/inc/AccessibleFrameSelector.hxx149
-rw-r--r--svx/source/inc/DGColorNameLookUp.hxx99
-rw-r--r--svx/source/inc/GraphCtlAccessibleContext.hxx281
-rw-r--r--svx/source/inc/charmapacc.hxx278
-rw-r--r--svx/source/inc/clonelist.hxx57
-rw-r--r--svx/source/inc/datalistener.hxx79
-rw-r--r--svx/source/inc/datanavi.hrc180
-rw-r--r--svx/source/inc/datanavi.hxx601
-rw-r--r--svx/source/inc/delayedevent.hxx87
-rw-r--r--svx/source/inc/docrecovery.hxx973
-rw-r--r--svx/source/inc/filtnav.hxx372
-rw-r--r--svx/source/inc/fmPropBrw.hxx124
-rw-r--r--svx/source/inc/fmcontrolbordermanager.hxx268
-rw-r--r--svx/source/inc/fmcontrollayout.hxx93
-rw-r--r--svx/source/inc/fmdocumentclassification.hxx87
-rw-r--r--svx/source/inc/fmexch.hxx283
-rw-r--r--svx/source/inc/fmexpl.hrc40
-rw-r--r--svx/source/inc/fmexpl.hxx612
-rw-r--r--svx/source/inc/fmgroup.hxx120
-rw-r--r--svx/source/inc/fmhlpids.hrc36
-rw-r--r--svx/source/inc/fmitems.hxx72
-rw-r--r--svx/source/inc/fmobj.hxx134
-rw-r--r--svx/source/inc/fmpgeimp.hxx170
-rw-r--r--svx/source/inc/fmprop.hrc179
-rw-r--r--svx/source/inc/fmscriptingenv.hxx99
-rw-r--r--svx/source/inc/fmservs.hxx90
-rw-r--r--svx/source/inc/fmshimp.hxx608
-rw-r--r--svx/source/inc/fmslotinvalidator.hxx55
-rw-r--r--svx/source/inc/fmtextcontroldialogs.hxx70
-rw-r--r--svx/source/inc/fmtextcontrolfeature.hxx105
-rw-r--r--svx/source/inc/fmtextcontrolshell.hxx224
-rw-r--r--svx/source/inc/fmundo.hxx230
-rw-r--r--svx/source/inc/fmurl.hxx60
-rw-r--r--svx/source/inc/fmvwimp.hxx316
-rw-r--r--svx/source/inc/formcontrolfactory.hxx119
-rw-r--r--svx/source/inc/formcontroller.hxx593
-rw-r--r--svx/source/inc/formcontrolling.hxx308
-rw-r--r--svx/source/inc/formdispatchinterceptor.hxx119
-rw-r--r--svx/source/inc/formfeaturedispatcher.hxx157
-rw-r--r--svx/source/inc/formtoolbars.hxx90
-rw-r--r--svx/source/inc/frmsel.hrc38
-rw-r--r--svx/source/inc/frmselimpl.hxx305
-rw-r--r--svx/source/inc/gridcell.hxx1156
-rw-r--r--svx/source/inc/gridcols.hxx62
-rw-r--r--svx/source/inc/linectrl.hrc28
-rw-r--r--svx/source/inc/recoveryui.hxx155
-rw-r--r--svx/source/inc/sdbdatacolumn.hxx140
-rw-r--r--svx/source/inc/sqlparserclient.hxx79
-rw-r--r--svx/source/inc/stringlistresource.hxx86
-rw-r--r--svx/source/inc/svdoimp.hxx111
-rw-r--r--svx/source/inc/svdoutlinercache.hxx54
-rw-r--r--svx/source/inc/svxrectctaccessiblecontext.hxx566
-rw-r--r--svx/source/inc/tabwin.hxx141
-rw-r--r--svx/source/inc/tbxform.hxx166
-rw-r--r--svx/source/inc/trace.hxx68
-rw-r--r--svx/source/inc/treevisitor.hxx109
-rw-r--r--svx/source/inc/typeconversionclient.hxx92
-rw-r--r--svx/source/inc/unogalthemeprovider.hxx100
-rw-r--r--svx/source/inc/unopolyhelper.hxx55
-rw-r--r--svx/source/inc/xfm_addcondition.hxx92
-rw-r--r--svx/source/inc/xmlxtexp.hxx70
-rw-r--r--svx/source/inc/xmlxtimp.hxx64
-rw-r--r--svx/source/intro/about_ooo.hrc1083
-rw-r--r--svx/source/intro/about_ooo.src40
-rw-r--r--svx/source/items/SmartTagItem.cxx123
-rw-r--r--svx/source/items/algitem.cxx765
-rw-r--r--svx/source/items/chrtitem.cxx538
-rw-r--r--svx/source/items/clipfmtitem.cxx180
-rw-r--r--svx/source/items/customshapeitem.cxx386
-rw-r--r--svx/source/items/drawitem.cxx557
-rw-r--r--svx/source/items/e3ditem.cxx170
-rw-r--r--svx/source/items/grfitem.cxx197
-rw-r--r--svx/source/items/hlnkitem.cxx430
-rw-r--r--svx/source/items/numfmtsh.cxx1869
-rw-r--r--svx/source/items/numinf.cxx250
-rw-r--r--svx/source/items/ofaitem.cxx91
-rw-r--r--svx/source/items/pageitem.cxx338
-rw-r--r--svx/source/items/postattr.cxx192
-rw-r--r--svx/source/items/rotmodit.cxx178
-rw-r--r--svx/source/items/svxempty.cxx40
-rw-r--r--svx/source/items/svxerr.cxx54
-rw-r--r--svx/source/items/svxerr.src174
-rw-r--r--svx/source/items/svxitems.src393
-rw-r--r--svx/source/items/viewlayoutitem.cxx211
-rw-r--r--svx/source/items/zoomitem.cxx231
-rw-r--r--svx/source/items/zoomslideritem.cxx280
-rw-r--r--svx/source/mnuctrls/SmartTagCtl.cxx225
-rw-r--r--svx/source/mnuctrls/clipboardctl.cxx163
-rw-r--r--svx/source/mnuctrls/fntctl.cxx182
-rw-r--r--svx/source/mnuctrls/fntszctl.cxx211
-rw-r--r--svx/source/mnuctrls/mnuctrls.src81
-rw-r--r--svx/source/sdr/animation/animationstate.cxx148
-rw-r--r--svx/source/sdr/animation/objectanimator.cxx52
-rw-r--r--svx/source/sdr/animation/scheduler.cxx315
-rw-r--r--svx/source/sdr/attribute/sdrfilltextattribute.cxx92
-rw-r--r--svx/source/sdr/attribute/sdrformtextattribute.cxx423
-rw-r--r--svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx185
-rw-r--r--svx/source/sdr/attribute/sdrlinefillshadowtextattribute.cxx95
-rw-r--r--svx/source/sdr/attribute/sdrlineshadowtextattribute.cxx93
-rw-r--r--svx/source/sdr/attribute/sdrshadowtextattribute.cxx85
-rw-r--r--svx/source/sdr/attribute/sdrtextattribute.cxx461
-rw-r--r--svx/source/sdr/contact/displayinfo.cxx110
-rw-r--r--svx/source/sdr/contact/objectcontact.cxx322
-rw-r--r--svx/source/sdr/contact/objectcontactofobjlistpainter.cxx226
-rw-r--r--svx/source/sdr/contact/objectcontactofpageview.cxx485
-rw-r--r--svx/source/sdr/contact/objectcontacttools.cxx104
-rw-r--r--svx/source/sdr/contact/sdrmediawindow.cxx193
-rw-r--r--svx/source/sdr/contact/sdrmediawindow.hxx69
-rw-r--r--svx/source/sdr/contact/viewcontact.cxx329
-rw-r--r--svx/source/sdr/contact/viewcontactofe3d.cxx227
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dcube.cxx105
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dextrude.cxx100
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dlathe.cxx115
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dpolygon.cxx186
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dscene.cxx478
-rw-r--r--svx/source/sdr/contact/viewcontactofe3dsphere.cxx98
-rw-r--r--svx/source/sdr/contact/viewcontactofgraphic.cxx463
-rw-r--r--svx/source/sdr/contact/viewcontactofgroup.cxx103
-rw-r--r--svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx126
-rw-r--r--svx/source/sdr/contact/viewcontactofpageobj.cxx105
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx179
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrcircobj.cxx117
-rw-r--r--svx/source/sdr/contact/viewcontactofsdredgeobj.cxx79
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx143
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx184
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrobj.cxx194
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx241
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrole2obj.cxx130
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrpage.cxx726
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrpathobj.cxx145
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrrectobj.cxx104
-rw-r--r--svx/source/sdr/contact/viewcontactoftextobj.cxx51
-rw-r--r--svx/source/sdr/contact/viewcontactofunocontrol.cxx181
-rw-r--r--svx/source/sdr/contact/viewcontactofvirtobj.cxx116
-rw-r--r--svx/source/sdr/contact/viewobjectcontact.cxx438
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofe3d.cxx101
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx148
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofgraphic.cxx333
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofgroup.cxx115
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx153
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofpageobj.cxx352
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx176
-rwxr-xr-xsvx/source/sdr/contact/viewobjectcontactofsdrobj.cxx152
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx243
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx729
-rwxr-xr-xsvx/source/sdr/contact/viewobjectcontactofunocontrol.cxx1937
-rw-r--r--svx/source/sdr/contact/viewobjectcontactredirector.cxx60
-rw-r--r--svx/source/sdr/event/eventhandler.cxx162
-rw-r--r--svx/source/sdr/overlay/overlayanimatedbitmapex.cxx217
-rw-r--r--svx/source/sdr/overlay/overlaybitmapex.cxx113
-rw-r--r--svx/source/sdr/overlay/overlaycrosshair.cxx84
-rw-r--r--svx/source/sdr/overlay/overlayhatchrect.cxx94
-rw-r--r--svx/source/sdr/overlay/overlayhelpline.cxx93
-rw-r--r--svx/source/sdr/overlay/overlayline.cxx107
-rw-r--r--svx/source/sdr/overlay/overlaymanager.cxx393
-rw-r--r--svx/source/sdr/overlay/overlaymanagerbuffered.cxx538
-rw-r--r--svx/source/sdr/overlay/overlayobject.cxx216
-rw-r--r--svx/source/sdr/overlay/overlayobjectcell.cxx111
-rw-r--r--svx/source/sdr/overlay/overlayobjectlist.cxx184
-rw-r--r--svx/source/sdr/overlay/overlaypolypolygon.cxx99
-rw-r--r--svx/source/sdr/overlay/overlayprimitive2dsequenceobject.cxx61
-rw-r--r--svx/source/sdr/overlay/overlayrollingrectangle.cxx150
-rw-r--r--svx/source/sdr/overlay/overlayselection.cxx237
-rw-r--r--svx/source/sdr/overlay/overlaytools.cxx493
-rw-r--r--svx/source/sdr/overlay/overlaytriangle.cxx106
-rw-r--r--svx/source/sdr/primitive2d/primitivefactory2d.cxx132
-rw-r--r--svx/source/sdr/primitive2d/sdrattributecreator.cxx1028
-rw-r--r--svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx177
-rw-r--r--svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx124
-rw-r--r--svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx130
-rw-r--r--svx/source/sdr/primitive2d/sdrdecompositiontools.cxx486
-rw-r--r--svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx278
-rw-r--r--svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx177
-rw-r--r--svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx510
-rw-r--r--svx/source/sdr/primitive2d/sdrole2primitive2d.cxx190
-rw-r--r--svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx201
-rw-r--r--svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx147
-rw-r--r--svx/source/sdr/primitive2d/sdrprimitivetools.cxx176
-rw-r--r--svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx162
-rw-r--r--svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx497
-rw-r--r--svx/source/sdr/primitive3d/sdrattributecreator3d.cxx158
-rw-r--r--svx/source/sdr/properties/attributeproperties.cxx628
-rw-r--r--svx/source/sdr/properties/captionproperties.cxx120
-rw-r--r--svx/source/sdr/properties/circleproperties.cxx157
-rw-r--r--svx/source/sdr/properties/connectorproperties.cxx107
-rw-r--r--svx/source/sdr/properties/customshapeproperties.cxx239
-rw-r--r--svx/source/sdr/properties/defaultproperties.cxx237
-rw-r--r--svx/source/sdr/properties/e3dcompoundproperties.cxx165
-rw-r--r--svx/source/sdr/properties/e3dextrudeproperties.cxx90
-rw-r--r--svx/source/sdr/properties/e3dlatheproperties.cxx100
-rw-r--r--svx/source/sdr/properties/e3dproperties.cxx106
-rw-r--r--svx/source/sdr/properties/e3dsceneproperties.cxx334
-rw-r--r--svx/source/sdr/properties/e3dsphereproperties.cxx85
-rw-r--r--svx/source/sdr/properties/emptyproperties.cxx153
-rw-r--r--svx/source/sdr/properties/graphicproperties.cxx143
-rw-r--r--svx/source/sdr/properties/groupproperties.cxx298
-rw-r--r--svx/source/sdr/properties/itemsettools.cxx146
-rw-r--r--svx/source/sdr/properties/measureproperties.cxx141
-rw-r--r--svx/source/sdr/properties/oleproperties.cxx80
-rw-r--r--svx/source/sdr/properties/pageproperties.cxx101
-rw-r--r--svx/source/sdr/properties/properties.cxx189
-rw-r--r--svx/source/sdr/properties/rectangleproperties.cxx84
-rw-r--r--svx/source/sdr/properties/textproperties.cxx638
-rw-r--r--svx/source/smarttags/SmartTagMgr.cxx552
-rw-r--r--svx/source/src/app.hrc441
-rw-r--r--svx/source/src/app.src90
-rw-r--r--svx/source/src/errtxt.src515
-rw-r--r--svx/source/src/hidgen.hrc33
-rw-r--r--svx/source/stbctrls/insctrl.cxx131
-rw-r--r--svx/source/stbctrls/modctrl.cxx98
-rw-r--r--svx/source/stbctrls/pszctrl.cxx447
-rw-r--r--svx/source/stbctrls/selctrl.cxx154
-rw-r--r--svx/source/stbctrls/stbctrls.h55
-rw-r--r--svx/source/stbctrls/stbctrls.src327
-rw-r--r--svx/source/stbctrls/xmlsecctrl.cxx208
-rw-r--r--svx/source/stbctrls/zoomctrl.cxx223
-rw-r--r--svx/source/stbctrls/zoomsliderctrl.cxx448
-rw-r--r--svx/source/svdraw/ActionDescriptionProvider.cxx82
-rw-r--r--svx/source/svdraw/clonelist.cxx134
-rw-r--r--svx/source/svdraw/gradtrns.cxx538
-rw-r--r--svx/source/svdraw/gradtrns.hxx64
-rw-r--r--svx/source/svdraw/impgrfll.cxx255
-rw-r--r--svx/source/svdraw/polypolygoneditor.cxx190
-rw-r--r--svx/source/svdraw/sdrcomment.cxx98
-rw-r--r--svx/source/svdraw/sdrhittesthelper.cxx173
-rw-r--r--svx/source/svdraw/sdrmasterpagedescriptor.cxx142
-rw-r--r--svx/source/svdraw/sdrpagewindow.cxx468
-rw-r--r--svx/source/svdraw/sdrpaintwindow.cxx312
-rw-r--r--svx/source/svdraw/selectioncontroller.cxx114
-rw-r--r--svx/source/svdraw/svdattr.cxx2429
-rw-r--r--svx/source/svdraw/svdcrtv.cxx964
-rw-r--r--svx/source/svdraw/svddrag.cxx153
-rw-r--r--svx/source/svdraw/svddrgm1.hxx277
-rw-r--r--svx/source/svdraw/svddrgmt.cxx3662
-rw-r--r--svx/source/svdraw/svddrgv.cxx1006
-rw-r--r--svx/source/svdraw/svdedtv.cxx1046
-rw-r--r--svx/source/svdraw/svdedtv1.cxx1784
-rw-r--r--svx/source/svdraw/svdedtv2.cxx2139
-rw-r--r--svx/source/svdraw/svdedxv.cxx2146
-rw-r--r--svx/source/svdraw/svdetc.cxx1118
-rw-r--r--svx/source/svdraw/svdfmtf.cxx1028
-rw-r--r--svx/source/svdraw/svdfmtf.hxx166
-rw-r--r--svx/source/svdraw/svdglev.cxx422
-rw-r--r--svx/source/svdraw/svdglue.cxx450
-rw-r--r--svx/source/svdraw/svdhdl.cxx2417
-rw-r--r--svx/source/svdraw/svdhlpln.cxx149
-rw-r--r--svx/source/svdraw/svdibrow.cxx1299
-rw-r--r--svx/source/svdraw/svditer.cxx110
-rw-r--r--svx/source/svdraw/svdlayer.cxx458
-rw-r--r--svx/source/svdraw/svdmark.cxx1040
-rw-r--r--svx/source/svdraw/svdmodel.cxx2258
-rw-r--r--svx/source/svdraw/svdmrkv.cxx2177
-rw-r--r--svx/source/svdraw/svdmrkv1.cxx724
-rw-r--r--svx/source/svdraw/svdoashp.cxx3504
-rw-r--r--svx/source/svdraw/svdoattr.cxx180
-rw-r--r--svx/source/svdraw/svdobj.cxx3310
-rw-r--r--svx/source/svdraw/svdocapt.cxx851
-rw-r--r--svx/source/svdraw/svdocirc.cxx1169
-rw-r--r--svx/source/svdraw/svdoedge.cxx2497
-rw-r--r--svx/source/svdraw/svdograf.cxx1426
-rw-r--r--svx/source/svdraw/svdogrp.cxx801
-rw-r--r--svx/source/svdraw/svdomeas.cxx1494
-rw-r--r--svx/source/svdraw/svdomedia.cxx285
-rw-r--r--svx/source/svdraw/svdoole2.cxx2242
-rw-r--r--svx/source/svdraw/svdopage.cxx195
-rw-r--r--svx/source/svdraw/svdopath.cxx3118
-rw-r--r--svx/source/svdraw/svdorect.cxx620
-rw-r--r--svx/source/svdraw/svdotext.cxx2132
-rw-r--r--svx/source/svdraw/svdotextdecomposition.cxx1258
-rw-r--r--svx/source/svdraw/svdotextpathdecomposition.cxx824
-rw-r--r--svx/source/svdraw/svdotxat.cxx462
-rw-r--r--svx/source/svdraw/svdotxdr.cxx285
-rw-r--r--svx/source/svdraw/svdotxed.cxx350
-rw-r--r--svx/source/svdraw/svdotxfl.cxx58
-rw-r--r--svx/source/svdraw/svdotxln.cxx350
-rw-r--r--svx/source/svdraw/svdotxtr.cxx558
-rw-r--r--svx/source/svdraw/svdouno.cxx665
-rw-r--r--svx/source/svdraw/svdoutl.cxx132
-rw-r--r--svx/source/svdraw/svdoutlinercache.cxx115
-rw-r--r--svx/source/svdraw/svdovirt.cxx659
-rw-r--r--svx/source/svdraw/svdpage.cxx2032
-rw-r--r--svx/source/svdraw/svdpagv.cxx1133
-rw-r--r--svx/source/svdraw/svdpntv.cxx1548
-rw-r--r--svx/source/svdraw/svdpoev.cxx745
-rw-r--r--svx/source/svdraw/svdsnpv.cxx730
-rw-r--r--svx/source/svdraw/svdstr.src2940
-rw-r--r--svx/source/svdraw/svdtext.cxx224
-rw-r--r--svx/source/svdraw/svdtrans.cxx1271
-rw-r--r--svx/source/svdraw/svdundo.cxx1871
-rw-r--r--svx/source/svdraw/svdview.cxx1604
-rw-r--r--svx/source/svdraw/svdviter.cxx351
-rw-r--r--svx/source/svdraw/svdxcgv.cxx894
-rw-r--r--svx/source/table/accessiblecell.cxx584
-rw-r--r--svx/source/table/accessiblecell.hxx149
-rw-r--r--svx/source/table/accessibletableshape.cxx723
-rw-r--r--svx/source/table/cell.cxx1809
-rw-r--r--svx/source/table/cell.hxx244
-rw-r--r--svx/source/table/cellcursor.cxx590
-rw-r--r--svx/source/table/cellcursor.hxx83
-rw-r--r--svx/source/table/celleditsource.cxx1056
-rw-r--r--svx/source/table/celleditsource.hxx89
-rw-r--r--svx/source/table/cellrange.cxx132
-rw-r--r--svx/source/table/cellrange.hxx72
-rw-r--r--svx/source/table/celltypes.hxx109
-rw-r--r--svx/source/table/propertyset.cxx259
-rw-r--r--svx/source/table/propertyset.hxx109
-rw-r--r--svx/source/table/svdotable.cxx2820
-rw-r--r--svx/source/table/table.src34
-rw-r--r--svx/source/table/tablecolumn.cxx305
-rw-r--r--svx/source/table/tablecolumn.hxx88
-rw-r--r--svx/source/table/tablecolumns.cxx141
-rw-r--r--svx/source/table/tablecolumns.hxx71
-rw-r--r--svx/source/table/tablecontroller.cxx2618
-rw-r--r--svx/source/table/tablecontroller.hxx170
-rw-r--r--svx/source/table/tabledesign.cxx808
-rw-r--r--svx/source/table/tablehandles.cxx314
-rw-r--r--svx/source/table/tablehandles.hxx96
-rw-r--r--svx/source/table/tablelayouter.cxx1300
-rw-r--r--svx/source/table/tablelayouter.hxx178
-rw-r--r--svx/source/table/tablemodel.cxx1258
-rw-r--r--svx/source/table/tablemodel.hxx225
-rw-r--r--svx/source/table/tablerow.cxx381
-rw-r--r--svx/source/table/tablerow.hxx92
-rw-r--r--svx/source/table/tablerows.cxx136
-rw-r--r--svx/source/table/tablerows.hxx71
-rw-r--r--svx/source/table/tablertfexporter.cxx284
-rw-r--r--svx/source/table/tablertfimporter.cxx447
-rw-r--r--svx/source/table/tableundo.cxx559
-rw-r--r--svx/source/table/tableundo.hxx259
-rw-r--r--svx/source/table/viewcontactoftableobj.cxx736
-rw-r--r--svx/source/table/viewcontactoftableobj.hxx72
-rw-r--r--svx/source/tbxctrls/colorwindow.hxx48
-rw-r--r--svx/source/tbxctrls/colrctrl.cxx661
-rw-r--r--svx/source/tbxctrls/colrctrl.src84
-rw-r--r--svx/source/tbxctrls/extrusioncontrols.cxx1052
-rw-r--r--svx/source/tbxctrls/extrusioncontrols.hrc120
-rw-r--r--svx/source/tbxctrls/extrusioncontrols.hxx260
-rw-r--r--svx/source/tbxctrls/extrusioncontrols.src801
-rw-r--r--svx/source/tbxctrls/fillctrl.cxx846
-rw-r--r--svx/source/tbxctrls/fontworkgallery.cxx818
-rw-r--r--svx/source/tbxctrls/fontworkgallery.src328
-rw-r--r--svx/source/tbxctrls/formatpaintbrushctrl.cxx120
-rw-r--r--svx/source/tbxctrls/grafctrl.cxx1290
-rw-r--r--svx/source/tbxctrls/grafctrl.hrc28
-rw-r--r--svx/source/tbxctrls/grafctrl.src192
-rw-r--r--svx/source/tbxctrls/itemwin.cxx825
-rw-r--r--svx/source/tbxctrls/layctrl.cxx899
-rw-r--r--svx/source/tbxctrls/lboxctrl.cxx351
-rw-r--r--svx/source/tbxctrls/lboxctrl.hrc30
-rw-r--r--svx/source/tbxctrls/lboxctrl.src77
-rw-r--r--svx/source/tbxctrls/linectrl.cxx784
-rw-r--r--svx/source/tbxctrls/linectrl.src34
-rw-r--r--svx/source/tbxctrls/subtoolboxcontrol.cxx84
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx2860
-rw-r--r--svx/source/tbxctrls/tbcontrl.src189
-rw-r--r--svx/source/tbxctrls/tbunocontroller.cxx429
-rw-r--r--svx/source/tbxctrls/tbunosearchcontrollers.cxx873
-rw-r--r--svx/source/tbxctrls/tbunosearchcontrollers.src33
-rw-r--r--svx/source/tbxctrls/tbxalign.cxx141
-rw-r--r--svx/source/tbxctrls/tbxcolor.cxx118
-rw-r--r--svx/source/tbxctrls/tbxcolorupdate.cxx208
-rw-r--r--svx/source/tbxctrls/tbxdraw.hrc31
-rw-r--r--svx/source/tbxctrls/tbxdrctl.cxx120
-rw-r--r--svx/source/tbxctrls/verttexttbxctrl.cxx123
-rw-r--r--svx/source/toolbars/extrusionbar.cxx1374
-rw-r--r--svx/source/toolbars/extrusionbar.src56
-rw-r--r--svx/source/toolbars/fontworkbar.cxx641
-rw-r--r--svx/source/toolbars/fontworkbar.src53
-rw-r--r--svx/source/unodialogs/textconversiondlgs/buttongroup.hrc65
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_dialogs.src293
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx895
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hrc53
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx201
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.src192
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_direction_ids.hrc34
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_direction_tmpl.hrc51
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx285
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx143
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx201
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hrc43
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx90
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src121
-rw-r--r--svx/source/unodialogs/textconversiondlgs/resid.cxx52
-rw-r--r--svx/source/unodialogs/textconversiondlgs/resid.hxx50
-rw-r--r--svx/source/unodialogs/textconversiondlgs/resids.hrc33
-rw-r--r--svx/source/unodialogs/textconversiondlgs/services.cxx63
-rw-r--r--svx/source/unodraw/UnoGraphicExporter.cxx1283
-rw-r--r--svx/source/unodraw/UnoGraphicExporter.hxx40
-rw-r--r--svx/source/unodraw/UnoNameItemTable.cxx341
-rw-r--r--svx/source/unodraw/UnoNameItemTable.hxx91
-rw-r--r--svx/source/unodraw/UnoNamespaceMap.cxx314
-rw-r--r--svx/source/unodraw/XPropertyTable.cxx743
-rw-r--r--svx/source/unodraw/gluepts.cxx548
-rw-r--r--svx/source/unodraw/recoveryui.cxx399
-rw-r--r--svx/source/unodraw/shapeimpl.hxx129
-rw-r--r--svx/source/unodraw/shapepropertynotifier.cxx207
-rw-r--r--svx/source/unodraw/tableshape.cxx194
-rw-r--r--svx/source/unodraw/unobtabl.cxx122
-rw-r--r--svx/source/unodraw/unoctabl.cxx393
-rw-r--r--svx/source/unodraw/unodraw.src42
-rw-r--r--svx/source/unodraw/unodtabl.cxx108
-rw-r--r--svx/source/unodraw/unogtabl.cxx107
-rw-r--r--svx/source/unodraw/unohtabl.cxx105
-rw-r--r--svx/source/unodraw/unomlstr.cxx72
-rw-r--r--svx/source/unodraw/unomod.cxx778
-rw-r--r--svx/source/unodraw/unomtabl.cxx482
-rw-r--r--svx/source/unodraw/unopage.cxx1006
-rw-r--r--svx/source/unodraw/unopool.cxx430
-rw-r--r--svx/source/unodraw/unoprov.cxx1428
-rw-r--r--svx/source/unodraw/unoshap2.cxx2157
-rw-r--r--svx/source/unodraw/unoshap3.cxx1210
-rw-r--r--svx/source/unodraw/unoshap4.cxx996
-rw-r--r--svx/source/unodraw/unoshape.cxx4661
-rw-r--r--svx/source/unodraw/unoshcol.cxx258
-rw-r--r--svx/source/unodraw/unoshtxt.cxx1155
-rw-r--r--svx/source/unodraw/unottabl.cxx107
-rw-r--r--svx/source/unogallery/unogalitem.cxx485
-rw-r--r--svx/source/unogallery/unogalitem.hxx126
-rw-r--r--svx/source/unogallery/unogaltheme.cxx433
-rw-r--r--svx/source/unogallery/unogaltheme.hxx110
-rw-r--r--svx/source/unogallery/unogalthemeprovider.cxx316
-rw-r--r--svx/source/xml/xmleohlp.cxx819
-rw-r--r--svx/source/xml/xmlexport.cxx283
-rw-r--r--svx/source/xml/xmlgrhlp.cxx1163
-rw-r--r--svx/source/xml/xmlxtexp.cxx492
-rw-r--r--svx/source/xml/xmlxtimp.cxx488
-rw-r--r--svx/source/xoutdev/_xoutbmp.cxx768
-rw-r--r--svx/source/xoutdev/_xpoly.cxx2135
-rw-r--r--svx/source/xoutdev/xattr.cxx5778
-rw-r--r--svx/source/xoutdev/xattr2.cxx1712
-rw-r--r--svx/source/xoutdev/xattrbmp.cxx894
-rw-r--r--svx/source/xoutdev/xexch.cxx204
-rw-r--r--svx/source/xoutdev/xpool.cxx235
-rw-r--r--svx/source/xoutdev/xtabbtmp.cxx294
-rw-r--r--svx/source/xoutdev/xtabcolr.cxx548
-rw-r--r--svx/source/xoutdev/xtabdash.cxx378
-rw-r--r--svx/source/xoutdev/xtabgrdt.cxx372
-rw-r--r--svx/source/xoutdev/xtabhtch.cxx374
-rw-r--r--svx/source/xoutdev/xtable.cxx511
-rw-r--r--svx/source/xoutdev/xtablend.cxx395
-rw-r--r--svx/uiconfig/layout/delzip1
-rw-r--r--svx/uiconfig/layout/layout.mk33
-rw-r--r--svx/uiconfig/layout/makefile.mk46
-rw-r--r--svx/uiconfig/layout/zoom.xml59
-rw-r--r--svx/util/gal.dxp20
-rw-r--r--svx/util/hidother.hrc27
-rw-r--r--svx/util/hidother.src74
-rw-r--r--svx/util/svx.component76
-rw-r--r--svx/util/svx.dxp2
-rw-r--r--svx/util/svxcore.component49
-rw-r--r--svx/util/svxpch.cxx69
-rw-r--r--svx/util/textconversiondlgs.component34
-rw-r--r--svx/workben/edittest.cxx1795
-rw-r--r--svx/workben/makefile.mk72
-rw-r--r--svx/workben/msview/makefile.mk72
-rw-r--r--svx/workben/msview/msview.cxx1224
-rw-r--r--svx/workben/msview/msview.xml294
-rw-r--r--svx/workben/msview/xmlconfig.cxx575
-rw-r--r--svx/workben/msview/xmlconfig.hxx108
-rw-r--r--svx/xml/AccessibleControlShape.xml40
-rw-r--r--svx/xml/AccessibleEditableTextPara.xml37
-rw-r--r--svx/xml/AccessibleGraphicShape.xml41
-rw-r--r--svx/xml/AccessibleImageBullet.xml34
-rw-r--r--svx/xml/AccessibleOLEShape.xml41
-rw-r--r--svx/xml/AccessibleShape.xml39
-rw-r--r--svx/xml/SvxDrawPage.xml16
-rw-r--r--svx/xml/SvxGraphCtrlAccessibleContext.xml19
-rw-r--r--svx/xml/SvxGraphicExporter.xml16
-rw-r--r--svx/xml/SvxGraphicObject.xml16
-rw-r--r--svx/xml/SvxShape.xml16
-rw-r--r--svx/xml/SvxShapeCircle.xml16
-rw-r--r--svx/xml/SvxShapeCollection.xml16
-rw-r--r--svx/xml/SvxShapeConnector.xml16
-rw-r--r--svx/xml/SvxShapeControl.xml16
-rw-r--r--svx/xml/SvxShapeDimensioning.xml16
-rw-r--r--svx/xml/SvxShapeGroup.xml16
-rw-r--r--svx/xml/SvxShapePolyPolygon.xml16
-rw-r--r--svx/xml/SvxShapePolyPolygonBezier.xml16
-rw-r--r--svx/xml/SvxUnoNumberingRules.xml16
-rw-r--r--svx/xml/SvxUnoText.xml16
-rw-r--r--svx/xml/SvxUnoTextContent.xml16
-rw-r--r--svx/xml/SvxUnoTextContentEnum.xml16
-rw-r--r--svx/xml/SvxUnoTextCursor.xml16
-rw-r--r--svx/xml/SvxUnoTextField.xml16
-rw-r--r--svx/xml/SvxUnoTextRange.xml16
-rw-r--r--svx/xml/SvxUnoTextRangeEnumeration.xml16
1321 files changed, 463356 insertions, 0 deletions
diff --git a/svx/AllLangResTarget_about.mk b/svx/AllLangResTarget_about.mk
new file mode 100644
index 000000000000..0d08c0075665
--- /dev/null
+++ b/svx/AllLangResTarget_about.mk
@@ -0,0 +1,45 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_AllLangResTarget_AllLangResTarget,about))
+
+$(eval $(call gb_AllLangResTarget_set_reslocation,about,svx))
+
+$(eval $(call gb_AllLangResTarget_add_srs,about,svx/about))
+
+$(eval $(call gb_SrsTarget_SrsTarget,svx/about))
+
+$(eval $(call gb_SrsTarget_set_include,svx/about,\
+ $$(INCLUDE) \
+ -I$(OUTDIR)/inc \
+ -I$(SRCDIR)/svx/inc/ \
+))
+
+$(eval $(call gb_SrsTarget_add_files,svx/about,\
+ svx/source/intro/about_ooo.src \
+))
+
diff --git a/svx/AllLangResTarget_gal.mk b/svx/AllLangResTarget_gal.mk
new file mode 100755
index 000000000000..eb0b5b15c444
--- /dev/null
+++ b/svx/AllLangResTarget_gal.mk
@@ -0,0 +1,48 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_AllLangResTarget_AllLangResTarget,gal))
+
+$(eval $(call gb_AllLangResTarget_set_reslocation,gal,svx))
+
+$(eval $(call gb_AllLangResTarget_add_srs,gal,svx/gal))
+
+$(eval $(call gb_SrsTarget_SrsTarget,svx/gal))
+
+$(eval $(call gb_SrsTarget_set_include,svx/gal,\
+ $$(INCLUDE) \
+ -I$(OUTDIR)/inc \
+ -I$(SRCDIR)/svx/source/gallery \
+ -I$(SRCDIR)/svx/inc/ \
+))
+
+$(eval $(call gb_SrsTarget_add_files,svx/gal,\
+ svx/source/gallery2/gallery.src \
+ svx/source/gallery2/galtheme.src \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/svx/AllLangResTarget_ofa.mk b/svx/AllLangResTarget_ofa.mk
new file mode 100644
index 000000000000..964b6562b3dd
--- /dev/null
+++ b/svx/AllLangResTarget_ofa.mk
@@ -0,0 +1,46 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_AllLangResTarget_AllLangResTarget,ofa))
+
+$(eval $(call gb_AllLangResTarget_set_reslocation,ofa,svx))
+
+$(eval $(call gb_AllLangResTarget_add_srs,ofa,svx/ofa))
+
+$(eval $(call gb_SrsTarget_SrsTarget,svx/ofa))
+
+$(eval $(call gb_SrsTarget_set_include,svx/ofa,\
+ $$(INCLUDE) \
+ -I$(OUTDIR)/inc \
+ -I$(SRCDIR)/svx/inc/ \
+))
+
+$(eval $(call gb_SrsTarget_add_files,svx/ofa,\
+ svx/source/src/errtxt.src \
+ svx/source/src/app.src \
+))
+
diff --git a/svx/AllLangResTarget_svx.mk b/svx/AllLangResTarget_svx.mk
new file mode 100644
index 000000000000..b2707b01a637
--- /dev/null
+++ b/svx/AllLangResTarget_svx.mk
@@ -0,0 +1,136 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_AllLangResTarget_AllLangResTarget,svx))
+
+$(eval $(call gb_AllLangResTarget_set_reslocation,svx,svx))
+
+$(eval $(call gb_AllLangResTarget_add_srs,svx,\
+ svx/res \
+))
+
+$(eval $(call gb_SrsTarget_SrsTarget,svx/res))
+
+$(eval $(call gb_SrsTarget_set_include,svx/res,\
+ $$(INCLUDE) \
+ -I$(OUTDIR)/inc \
+ -I$(WORKDIR)/inc \
+ -I$(WORKDIR)/inc/svx \
+ -I$(SRCDIR)/svx/source/inc \
+ -I$(SRCDIR)/svx/source/dialog \
+ -I$(SRCDIR)/svx/inc/ \
+))
+
+$(eval $(call gb_SrsTarget_add_files,svx/res,\
+ svx/source/accessibility/accessibility.src \
+ svx/source/dialog/bmpmask.src \
+ svx/source/dialog/contdlg.src \
+ svx/source/dialog/ctredlin.src \
+ svx/source/dialog/dlgctrl.src \
+ svx/source/dialog/docrecovery.src \
+ svx/source/dialog/fontwork.src \
+ svx/source/dialog/frmsel.src \
+ svx/source/dialog/hdft.src \
+ svx/source/dialog/hyprlink.src \
+ svx/source/dialog/imapdlg.src \
+ svx/source/dialog/langbox.src \
+ svx/source/dialog/language.src \
+ svx/source/dialog/optgrid.src \
+ svx/source/dialog/passwd.src \
+ svx/source/dialog/prtqry.src \
+ svx/source/dialog/rubydialog.src \
+ svx/source/dialog/ruler.src \
+ svx/source/dialog/sdstring.src \
+ svx/source/dialog/srchdlg.src \
+ svx/source/dialog/svxbmpnumvalueset.src \
+ svx/source/dialog/swframeposstrings.src \
+ svx/source/dialog/txenctab.src \
+ svx/source/dialog/ucsubset.src \
+ svx/source/engine3d/float3d.src \
+ svx/source/engine3d/string3d.src \
+ svx/source/fmcomp/gridctrl.src \
+ svx/source/form/datanavi.src \
+ svx/source/form/filtnav.src \
+ svx/source/form/fmexpl.src \
+ svx/source/form/fmstring.src \
+ svx/source/form/formshell.src \
+ svx/source/items/svxerr.src \
+ svx/source/items/svxitems.src \
+ svx/source/mnuctrls/mnuctrls.src \
+ svx/source/stbctrls/stbctrls.src \
+ svx/source/svdraw/svdstr.src \
+ svx/source/table/table.src \
+ svx/source/tbxctrls/colrctrl.src \
+ svx/source/tbxctrls/extrusioncontrols.src \
+ svx/source/tbxctrls/fontworkgallery.src \
+ svx/source/tbxctrls/grafctrl.src \
+ svx/source/tbxctrls/lboxctrl.src \
+ svx/source/tbxctrls/linectrl.src \
+ svx/source/tbxctrls/tbcontrl.src \
+ svx/source/tbxctrls/tbunosearchcontrollers.src \
+ svx/source/toolbars/extrusionbar.src \
+ svx/source/toolbars/fontworkbar.src \
+ svx/source/unodraw/unodraw.src \
+))
+
+$(call gb_SrsPartTarget_get_target,svx/source/fmcomp/gridctrl.src) : $(WORKDIR)/inc/svx/globlmn.hrc
+$(call gb_SrsPartTarget_get_target,svx/source/form/fmexpl.src) : $(WORKDIR)/inc/svx/globlmn.hrc
+$(call gb_SrsPartTarget_get_target,svx/source/form/datanavi.src) : $(WORKDIR)/inc/svx/globlmn.hrc
+$(call gb_SrsPartTarget_get_target,svx/source/form/formshell.src) : $(WORKDIR)/inc/svx/globlmn.hrc
+$(call gb_SrsTarget_get_clean_target,svx/res) : $(WORKDIR)/inc/svx/globlmn.hrc_clean
+
+# hack !!!
+# just a temporary - globlmn.hrc about to be removed!
+ifeq ($(strip $(WITH_LANG)),)
+$(WORKDIR)/inc/svx/globlmn.hrc : $(SRCDIR)/svx/inc/globlmn_tmpl.hrc
+ echo copying $@
+ -mkdir -p $(WORKDIR)/inc/svx
+ cp $(SRCDIR)/svx/inc/globlmn_tmpl.hrc $(WORKDIR)/inc/svx/globlmn.hrc
+ rm -f $(WORKDIR)/inc/svx/lastrun.mk
+else
+-include $(WORKDIR)/inc/svx/lastrun.mk
+ifneq ($(gb_lastrun_globlmn),MERGED)
+.PHONY : $(WORKDIR)/inc/svx/globlmn.hrc
+endif
+$(WORKDIR)/inc/svx/globlmn.hrc : $(SRCDIR)/svx/inc/globlmn_tmpl.hrc $(gb_SrsPartMergeTarget_SDFLOCATION)/svx/inc/localize.sdf
+ echo merging $@
+ -mkdir -p $(WORKDIR)/inc/svx
+ rm -f $(WORKDIR)/inc/svx/lastrun.mk
+ echo gb_lastrun_globlmn:=MERGED > $(WORKDIR)/inc/svx/lastrun.mk
+ $(call gb_Helper_abbreviate_dirs_native, \
+ $(gb_SrsPartMergeTarget_TRANSEXCOMMAND) \
+ -p svx \
+ -i $< -o $@ -m $(gb_SrsPartMergeTarget_SDFLOCATION)/svx/inc/localize.sdf -l all)
+endif
+
+.PHONY : $(WORKDIR)/inc/svx/globlmn.hrc_clean
+$(WORKDIR)/inc/svx/globlmn.hrc_clean :
+ rm -f $(WORKDIR)/inc/svx/lastrun.mk \
+ $(WORKDIR)/inc/svx/globlmn.hrc
+
+
+# vim: set noet sw=4 ts=4:
diff --git a/svx/AllLangResTarget_textconversiondlgs.mk b/svx/AllLangResTarget_textconversiondlgs.mk
new file mode 100644
index 000000000000..d30ccd40641b
--- /dev/null
+++ b/svx/AllLangResTarget_textconversiondlgs.mk
@@ -0,0 +1,47 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_AllLangResTarget_AllLangResTarget,textconversiondlgs))
+
+$(eval $(call gb_AllLangResTarget_set_reslocation,textconversiondlgs,svx))
+
+$(eval $(call gb_AllLangResTarget_add_srs,textconversiondlgs,\
+ svx/textconversiondlgs \
+))
+
+$(eval $(call gb_SrsTarget_SrsTarget,svx/textconversiondlgs))
+
+$(eval $(call gb_SrsTarget_set_include,svx/textconversiondlgs,\
+ $$(INCLUDE) \
+ -I$(OUTDIR)/inc \
+ -I$(SRCDIR)/svx/inc/ \
+))
+
+$(eval $(call gb_SrsTarget_add_files,svx/textconversiondlgs,\
+ svx/source/unodialogs/textconversiondlgs/chinese_dialogs.src \
+))
+
diff --git a/svx/JunitTest_svx_unoapi.mk b/svx/JunitTest_svx_unoapi.mk
new file mode 100755
index 000000000000..d6597f85e8e7
--- /dev/null
+++ b/svx/JunitTest_svx_unoapi.mk
@@ -0,0 +1,53 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_JunitTest_JunitTest,svx_unoapi))
+
+$(eval $(call gb_JunitTest_set_defs,svx_unoapi,\
+ $$(DEFS) \
+ -Dorg.openoffice.test.arg.sce=$(SRCDIR)/svx/qa/unoapi/svx.sce \
+ -Dorg.openoffice.test.arg.xcl=$(SRCDIR)/svx/qa/unoapi/knownissues.xcl \
+ -Dorg.openoffice.test.arg.tdoc=$(SRCDIR)/svx/qa/unoapi/testdocuments \
+))
+
+$(eval $(call gb_JunitTest_add_jars,svx_unoapi,\
+ $(OUTDIR)/bin/OOoRunner.jar \
+ $(OUTDIR)/bin/ridl.jar \
+ $(OUTDIR)/bin/test.jar \
+ $(OUTDIR)/bin/unoil.jar \
+ $(OUTDIR)/bin/jurt.jar \
+))
+
+$(eval $(call gb_JunitTest_add_sourcefiles,svx_unoapi,\
+ svx/qa/unoapi/Test \
+))
+
+$(eval $(call gb_JunitTest_add_classes,svx_unoapi,\
+ org.openoffice.svx.qa.unoapi.Test \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk
new file mode 100644
index 000000000000..4ce5250f77a5
--- /dev/null
+++ b/svx/Library_svx.mk
@@ -0,0 +1,236 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_Library_Library,svx))
+
+$(eval $(call gb_Library_set_componentfile,svx,svx/util/svx))
+
+$(eval $(call gb_Library_set_include,svx,\
+ -I$(SRCDIR)/svx/inc \
+ -I$(SRCDIR)/svx/source/inc \
+ -I$(SRCDIR)/svx/inc/pch \
+ $$(SOLARINC) \
+ -I$(OUTDIR)/inc/offuh \
+))
+
+$(eval $(call gb_Library_set_defs,svx,\
+ $$(DEFS) \
+ -DSVX_DLLIMPLEMENTATION \
+ -DBOOST_SPIRIT_USE_OLD_NAMESPACE \
+))
+
+$(eval $(call gb_Library_add_linked_libs,svx,\
+ basegfx \
+ sb \
+ comphelper \
+ cppuhelper \
+ cppu \
+ drawinglayer \
+ editeng \
+ i18nisolang1 \
+ icuuc \
+ sal \
+ sfx \
+ sot \
+ stl \
+ svl \
+ svt \
+ svxcore \
+ tk \
+ tl \
+ ucbhelper \
+ utl \
+ vcl \
+ vos3 \
+ xo \
+ xcr \
+ $(gb_STDLIBS) \
+))
+
+$(eval $(call gb_Library_add_exception_objects,svx,\
+ svx/source/accessibility/AccessibleControlShape \
+ svx/source/accessibility/AccessibleEmptyEditSource \
+ svx/source/accessibility/AccessibleFrameSelector \
+ svx/source/accessibility/AccessibleGraphicShape \
+ svx/source/accessibility/AccessibleOLEShape \
+ svx/source/accessibility/AccessibleShape \
+ svx/source/accessibility/AccessibleShapeInfo \
+ svx/source/accessibility/AccessibleShapeTreeInfo \
+ svx/source/accessibility/AccessibleTextEventQueue \
+ svx/source/accessibility/AccessibleTextHelper \
+ svx/source/accessibility/charmapacc \
+ svx/source/accessibility/ChildrenManager \
+ svx/source/accessibility/ChildrenManagerImpl \
+ svx/source/accessibility/DescriptionGenerator \
+ svx/source/accessibility/DGColorNameLookUp \
+ svx/source/accessibility/GraphCtlAccessibleContext \
+ svx/source/accessibility/ShapeTypeHandler \
+ svx/source/accessibility/svxrectctaccessiblecontext \
+ svx/source/accessibility/SvxShapeTypes \
+ svx/source/customshapes/EnhancedCustomShape3d \
+ svx/source/customshapes/EnhancedCustomShapeEngine \
+ svx/source/customshapes/EnhancedCustomShapeFontWork \
+ svx/source/customshapes/EnhancedCustomShapeHandle \
+ svx/source/customshapes/tbxcustomshapes \
+ svx/source/dialog/_bmpmask \
+ svx/source/dialog/charmap \
+ svx/source/dialog/connctrl \
+ svx/source/dialog/_contdlg \
+ svx/source/dialog/contwnd \
+ svx/source/dialog/ctredlin \
+ svx/source/dialog/databaseregistrationui \
+ svx/source/dialog/dialcontrol \
+ svx/source/dialog/dlgctl3d \
+ svx/source/dialog/dlgctrl \
+ svx/source/dialog/docrecovery \
+ svx/source/dialog/fntctrl \
+ svx/source/dialog/fontlb \
+ svx/source/dialog/fontwork \
+ svx/source/dialog/framelinkarray \
+ svx/source/dialog/frmdirlbox \
+ svx/source/dialog/frmsel \
+ svx/source/dialog/graphctl \
+ svx/source/dialog/grfflt \
+ svx/source/dialog/hdft \
+ svx/source/dialog/hyperdlg \
+ svx/source/dialog/hyprlink \
+ svx/source/dialog/imapdlg \
+ svx/source/dialog/imapwnd \
+ svx/source/dialog/measctrl \
+ svx/source/dialog/optgrid \
+ svx/source/dialog/orienthelper \
+ svx/source/dialog/pagectrl \
+ svx/source/dialog/paraprev \
+ svx/source/dialog/passwd \
+ svx/source/dialog/pfiledlg \
+ svx/source/dialog/prtqry \
+ svx/source/dialog/relfld \
+ svx/source/dialog/rlrcitem \
+ svx/source/dialog/rubydialog \
+ svx/source/dialog/rulritem \
+ svx/source/dialog/SpellDialogChildWindow \
+ svx/source/dialog/srchctrl \
+ svx/source/dialog/srchdlg \
+ svx/source/dialog/strarray \
+ svx/source/dialog/svxbmpnumvalueset \
+ svx/source/dialog/svxgrahicitem \
+ svx/source/dialog/svxruler \
+ svx/source/dialog/swframeexample \
+ svx/source/dialog/swframeposstrings \
+ svx/source/dialog/txencbox \
+ svx/source/dialog/txenctab \
+ svx/source/dialog/wrapfield \
+ svx/source/engine3d/float3d \
+ svx/source/fmcomp/dbaobjectex \
+ svx/source/form/databaselocationinput \
+ svx/source/form/dbcharsethelper \
+ svx/source/form/filtnav \
+ svx/source/form/fmobjfac \
+ svx/source/form/fmPropBrw \
+ svx/source/form/fmsrccfg \
+ svx/source/form/fmsrcimp \
+ svx/source/form/tabwin \
+ svx/source/form/tbxform \
+ svx/source/items/algitem \
+ svx/source/items/hlnkitem \
+ svx/source/items/numfmtsh \
+ svx/source/items/numinf \
+ svx/source/items/ofaitem \
+ svx/source/items/pageitem \
+ svx/source/items/postattr \
+ svx/source/items/rotmodit \
+ svx/source/items/SmartTagItem \
+ svx/source/items/svxempty \
+ svx/source/items/svxerr \
+ svx/source/items/viewlayoutitem \
+ svx/source/items/zoomitem \
+ svx/source/items/zoomslideritem \
+ svx/source/mnuctrls/clipboardctl \
+ svx/source/mnuctrls/fntctl \
+ svx/source/mnuctrls/fntszctl \
+ svx/source/mnuctrls/SmartTagCtl \
+ svx/source/stbctrls/pszctrl \
+ svx/source/stbctrls/insctrl \
+ svx/source/stbctrls/selctrl \
+ svx/source/stbctrls/xmlsecctrl \
+ svx/source/stbctrls/modctrl \
+ svx/source/stbctrls/zoomsliderctrl \
+ svx/source/stbctrls/zoomctrl \
+ svx/source/svdraw/ActionDescriptionProvider \
+ svx/source/smarttags/SmartTagMgr \
+ svx/source/svdraw/impgrfll \
+ svx/source/table/accessiblecell \
+ svx/source/table/accessibletableshape \
+ svx/source/table/celleditsource \
+ svx/source/table/tabledesign \
+ svx/source/table/tablertfexporter \
+ svx/source/table/tablertfimporter \
+ svx/source/tbxctrls/colrctrl \
+ svx/source/tbxctrls/fillctrl \
+ svx/source/tbxctrls/formatpaintbrushctrl \
+ svx/source/tbxctrls/grafctrl \
+ svx/source/tbxctrls/itemwin \
+ svx/source/tbxctrls/layctrl \
+ svx/source/tbxctrls/lboxctrl \
+ svx/source/tbxctrls/linectrl \
+ svx/source/tbxctrls/subtoolboxcontrol \
+ svx/source/tbxctrls/tbunocontroller \
+ svx/source/tbxctrls/tbunosearchcontrollers \
+ svx/source/tbxctrls/tbxalign \
+ svx/source/tbxctrls/tbxcolor \
+ svx/source/tbxctrls/tbxdrctl \
+ svx/source/tbxctrls/verttexttbxctrl \
+ svx/source/unodraw/recoveryui \
+ svx/source/unodraw/unoctabl \
+ svx/source/unodraw/UnoNamespaceMap \
+ svx/source/unodraw/unopool \
+ svx/source/unodraw/unoshcol \
+ svx/source/unogallery/unogalitem \
+ svx/source/unogallery/unogaltheme \
+ svx/source/unogallery/unogalthemeprovider \
+))
+
+ifeq ($(OS),LINUX)
+$(eval $(call gb_Library_add_exception_objects,svx,\
+ svx/source/dialog/sendreportunx \
+))
+else
+ifeq ($(OS),WNT)
+$(eval $(call gb_Library_add_linked_libs,svx,\
+ advapi32 \
+))
+$(eval $(call gb_Library_add_exception_objects,svx,\
+ svx/source/dialog/sendreportw32 \
+))
+else
+$(eval $(call gb_Library_add_exception_objects,svx,\
+ svx/source/dialog/sendreportgen \
+))
+endif
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
new file mode 100644
index 000000000000..dd31e6b4bdd1
--- /dev/null
+++ b/svx/Library_svxcore.mk
@@ -0,0 +1,455 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_Library_Library,svxcore))
+
+$(eval $(call gb_Library_set_componentfile,svxcore,svx/util/svxcore))
+
+$(eval $(call gb_Library_add_sdi_headers,svx,svx/sdi/svxslots))
+
+$(eval $(call gb_Library_add_package_headers,svxcore,\
+ svx_inc \
+ svx_sdi \
+))
+
+$(eval $(call gb_Library_set_include,svxcore,\
+ -I$(SRCDIR)/svx/inc \
+ -I$(SRCDIR)/svx/inc/pch \
+ -I$(SRCDIR)/svx/source/inc \
+ $$(INCLUDE) \
+ -I$(OUTDIR)/inc/offuh \
+ -I$(WORKDIR)/SdiTarget/svx/sdi \
+))
+
+#BOOST switch in customshapes
+#dialog:
+#.IF "$(GUI)"=="WNT"
+#CFLAGS+= -DUNICODE -D_UNICODE
+#.ENDIF
+
+$(eval $(call gb_Library_set_defs,svxcore,\
+ $$(DEFS) \
+ -DSVX_DLLIMPLEMENTATION \
+ -DBOOST_SPIRIT_USE_OLD_NAMESPACE \
+))
+
+$(eval $(call gb_Library_add_linked_libs,svxcore,\
+ avmedia \
+ basegfx \
+ sb \
+ comphelper \
+ cppuhelper \
+ cppu \
+ drawinglayer \
+ editeng \
+ fwe \
+ i18nisolang1 \
+ icuuc \
+ lng \
+ sal \
+ sfx \
+ sot \
+ stl \
+ svl \
+ svt \
+ tk \
+ tl \
+ ucbhelper \
+ utl \
+ vcl \
+ vos3 \
+ xo \
+ $(gb_STDLIBS) \
+))
+
+$(eval $(call gb_Library_add_exception_objects,svxcore,\
+ svx/source/core/coreservices \
+ svx/source/customshapes/EnhancedCustomShape2d \
+ svx/source/customshapes/EnhancedCustomShapeGeometry \
+ svx/source/customshapes/EnhancedCustomShapeTypeNames \
+ svx/source/dialog/checklbx \
+ svx/source/dialog/dialmgr \
+ svx/source/dialog/dlgutil \
+ svx/source/dialog/framelink \
+ svx/source/dialog/langbox \
+ svx/source/dialog/simptabl \
+ svx/source/dialog/stddlg \
+ svx/source/dialog/svxdlg \
+ svx/source/engine3d/camera3d \
+ svx/source/engine3d/cube3d \
+ svx/source/engine3d/deflt3d \
+ svx/source/engine3d/dragmt3d \
+ svx/source/engine3d/e3dsceneupdater \
+ svx/source/engine3d/e3dundo \
+ svx/source/engine3d/extrud3d \
+ svx/source/engine3d/helperhittest3d \
+ svx/source/engine3d/helperminimaldepth3d \
+ svx/source/engine3d/lathe3d \
+ svx/source/engine3d/obj3d \
+ svx/source/engine3d/objfac3d \
+ svx/source/engine3d/polygn3d \
+ svx/source/engine3d/polysc3d \
+ svx/source/engine3d/scene3d \
+ svx/source/engine3d/sphere3d \
+ svx/source/engine3d/svx3ditems \
+ svx/source/engine3d/view3d \
+ svx/source/engine3d/view3d1 \
+ svx/source/engine3d/viewpt3d2 \
+ svx/source/fmcomp/dbaexchange \
+ svx/source/fmcomp/fmgridcl \
+ svx/source/fmcomp/fmgridif \
+ svx/source/fmcomp/gridcell \
+ svx/source/fmcomp/gridcols \
+ svx/source/fmcomp/gridctrl \
+ svx/source/fmcomp/trace \
+ svx/source/fmcomp/xmlexchg \
+ svx/source/form/dataaccessdescriptor \
+ svx/source/form/datalistener \
+ svx/source/form/datanavi \
+ svx/source/form/dbtoolsclient \
+ svx/source/form/delayedevent \
+ svx/source/form/fmcontrolbordermanager \
+ svx/source/form/fmcontrollayout \
+ svx/source/form/fmdmod \
+ svx/source/form/fmdocumentclassification \
+ svx/source/form/fmdpage \
+ svx/source/form/fmexch \
+ svx/source/form/fmexpl \
+ svx/source/form/fmitems \
+ svx/source/form/fmmodel \
+ svx/source/form/fmobj \
+ svx/source/form/fmpage \
+ svx/source/form/fmpgeimp \
+ svx/source/form/fmscriptingenv \
+ svx/source/form/fmservs \
+ svx/source/form/fmshell \
+ svx/source/form/fmshimp \
+ svx/source/form/fmtextcontroldialogs \
+ svx/source/form/fmtextcontrolfeature \
+ svx/source/form/fmtextcontrolshell \
+ svx/source/form/fmtools \
+ svx/source/form/fmundo \
+ svx/source/form/fmview \
+ svx/source/form/fmvwimp \
+ svx/source/form/formcontrolfactory \
+ svx/source/form/formcontroller \
+ svx/source/form/formcontrolling \
+ svx/source/form/formdispatchinterceptor \
+ svx/source/form/formfeaturedispatcher \
+ svx/source/form/formtoolbars \
+ svx/source/form/legacyformcontroller \
+ svx/source/form/navigatortree \
+ svx/source/form/navigatortreemodel \
+ svx/source/form/ParseContext \
+ svx/source/form/sdbdatacolumn \
+ svx/source/form/sqlparserclient \
+ svx/source/form/stringlistresource \
+ svx/source/form/typeconversionclient \
+ svx/source/form/typemap \
+ svx/source/form/xfm_addcondition \
+ svx/source/gallery2/codec \
+ svx/source/gallery2/galbrws \
+ svx/source/gallery2/galbrws1 \
+ svx/source/gallery2/galbrws2 \
+ svx/source/gallery2/galctrl \
+ svx/source/gallery2/galexpl \
+ svx/source/gallery2/gallery1 \
+ svx/source/gallery2/galmisc \
+ svx/source/gallery2/galobj \
+ svx/source/gallery2/galtheme \
+ svx/source/items/chrtitem \
+ svx/source/items/clipfmtitem \
+ svx/source/items/customshapeitem \
+ svx/source/items/drawitem \
+ svx/source/items/e3ditem \
+ svx/source/items/grfitem \
+ svx/source/sdr/animation/scheduler \
+ svx/source/sdr/animation/objectanimator \
+ svx/source/sdr/animation/animationstate \
+ svx/source/sdr/attribute/sdrlinefillshadowtextattribute \
+ svx/source/sdr/attribute/sdrfilltextattribute \
+ svx/source/sdr/attribute/sdrshadowtextattribute \
+ svx/source/sdr/attribute/sdrtextattribute \
+ svx/source/sdr/attribute/sdrlineshadowtextattribute \
+ svx/source/sdr/attribute/sdrformtextattribute \
+ svx/source/sdr/attribute/sdrformtextoutlineattribute \
+ svx/source/sdr/contact/viewobjectcontactofgroup \
+ svx/source/sdr/contact/viewobjectcontactofsdrpage \
+ svx/source/sdr/contact/viewcontactofpageobj \
+ svx/source/sdr/contact/viewcontactofe3d \
+ svx/source/sdr/contact/viewcontactofe3dcube \
+ svx/source/sdr/contact/viewcontactofsdrmediaobj \
+ svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor \
+ svx/source/sdr/contact/viewobjectcontactofpageobj \
+ svx/source/sdr/contact/viewobjectcontactofe3dscene \
+ svx/source/sdr/contact/viewcontactofgraphic \
+ svx/source/sdr/contact/viewobjectcontactredirector \
+ svx/source/sdr/contact/viewcontactofsdrcircobj \
+ svx/source/sdr/contact/viewcontactofgroup \
+ svx/source/sdr/contact/viewcontactofunocontrol \
+ svx/source/sdr/contact/viewcontactofsdrobjcustomshape \
+ svx/source/sdr/contact/viewcontactofsdrobj \
+ svx/source/sdr/contact/objectcontact \
+ svx/source/sdr/contact/viewcontactoftextobj \
+ svx/source/sdr/contact/viewcontactofe3dlathe \
+ svx/source/sdr/contact/viewcontactofsdrpage \
+ svx/source/sdr/contact/viewcontactofe3dextrude \
+ svx/source/sdr/contact/viewcontactofmasterpagedescriptor \
+ svx/source/sdr/contact/viewcontact \
+ svx/source/sdr/contact/viewcontactofsdrole2obj \
+ svx/source/sdr/contact/displayinfo \
+ svx/source/sdr/contact/objectcontacttools \
+ svx/source/sdr/contact/viewcontactofe3dscene \
+ svx/source/sdr/contact/viewcontactofsdrrectobj \
+ svx/source/sdr/contact/viewobjectcontactofsdrole2obj \
+ svx/source/sdr/contact/viewobjectcontactofunocontrol \
+ svx/source/sdr/contact/viewobjectcontactofgraphic \
+ svx/source/sdr/contact/sdrmediawindow \
+ svx/source/sdr/contact/viewobjectcontactofsdrmediaobj \
+ svx/source/sdr/contact/viewcontactofsdrcaptionobj \
+ svx/source/sdr/contact/viewcontactofvirtobj \
+ svx/source/sdr/contact/viewcontactofe3dsphere \
+ svx/source/sdr/contact/viewcontactofe3dpolygon \
+ svx/source/sdr/contact/viewcontactofsdredgeobj \
+ svx/source/sdr/contact/viewobjectcontact \
+ svx/source/sdr/contact/viewobjectcontactofsdrobj \
+ svx/source/sdr/contact/objectcontactofpageview \
+ svx/source/sdr/contact/viewcontactofsdrpathobj \
+ svx/source/sdr/contact/viewcontactofsdrmeasureobj \
+ svx/source/sdr/contact/objectcontactofobjlistpainter \
+ svx/source/sdr/contact/viewobjectcontactofe3d \
+ svx/source/sdr/event/eventhandler \
+ svx/source/sdr/overlay/overlayline \
+ svx/source/sdr/overlay/overlaycrosshair \
+ svx/source/sdr/overlay/overlayrollingrectangle \
+ svx/source/sdr/overlay/overlaytriangle \
+ svx/source/sdr/overlay/overlayselection \
+ svx/source/sdr/overlay/overlayhatchrect \
+ svx/source/sdr/overlay/overlaybitmapex \
+ svx/source/sdr/overlay/overlaymanagerbuffered \
+ svx/source/sdr/overlay/overlayhelpline \
+ svx/source/sdr/overlay/overlayanimatedbitmapex \
+ svx/source/sdr/overlay/overlaypolypolygon \
+ svx/source/sdr/overlay/overlayobjectcell \
+ svx/source/sdr/overlay/overlaytools \
+ svx/source/sdr/overlay/overlayprimitive2dsequenceobject \
+ svx/source/sdr/overlay/overlayobject \
+ svx/source/sdr/overlay/overlaymanager \
+ svx/source/sdr/overlay/overlayobjectlist \
+ svx/source/sdr/primitive2d/sdrellipseprimitive2d \
+ svx/source/sdr/primitive2d/sdrprimitivetools \
+ svx/source/sdr/primitive2d/sdrtextprimitive2d \
+ svx/source/sdr/primitive2d/primitivefactory2d \
+ svx/source/sdr/primitive2d/sdrolecontentprimitive2d \
+ svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d \
+ svx/source/sdr/primitive2d/sdrgrafprimitive2d \
+ svx/source/sdr/primitive2d/sdrole2primitive2d \
+ svx/source/sdr/primitive2d/sdrpathprimitive2d \
+ svx/source/sdr/primitive2d/sdrrectangleprimitive2d \
+ svx/source/sdr/primitive2d/sdrcaptionprimitive2d \
+ svx/source/sdr/primitive2d/sdrconnectorprimitive2d \
+ svx/source/sdr/primitive2d/sdrmeasureprimitive2d \
+ svx/source/sdr/primitive2d/sdrattributecreator \
+ svx/source/sdr/primitive2d/sdrdecompositiontools \
+ svx/source/sdr/primitive3d/sdrattributecreator3d \
+ svx/source/sdr/properties/pageproperties \
+ svx/source/sdr/properties/e3dsceneproperties \
+ svx/source/sdr/properties/itemsettools \
+ svx/source/sdr/properties/captionproperties \
+ svx/source/sdr/properties/e3dextrudeproperties \
+ svx/source/sdr/properties/e3dproperties \
+ svx/source/sdr/properties/measureproperties \
+ svx/source/sdr/properties/customshapeproperties \
+ svx/source/sdr/properties/rectangleproperties \
+ svx/source/sdr/properties/groupproperties \
+ svx/source/sdr/properties/properties \
+ svx/source/sdr/properties/e3dlatheproperties \
+ svx/source/sdr/properties/graphicproperties \
+ svx/source/sdr/properties/circleproperties \
+ svx/source/sdr/properties/emptyproperties \
+ svx/source/sdr/properties/e3dsphereproperties \
+ svx/source/sdr/properties/defaultproperties \
+ svx/source/sdr/properties/textproperties \
+ svx/source/sdr/properties/attributeproperties \
+ svx/source/sdr/properties/connectorproperties \
+ svx/source/sdr/properties/e3dcompoundproperties \
+ svx/source/sdr/properties/oleproperties \
+ svx/source/svdraw/clonelist \
+ svx/source/svdraw/gradtrns \
+ svx/source/svdraw/polypolygoneditor \
+ svx/source/svdraw/sdrcomment \
+ svx/source/svdraw/sdrhittesthelper \
+ svx/source/svdraw/sdrmasterpagedescriptor \
+ svx/source/svdraw/sdrpagewindow \
+ svx/source/svdraw/sdrpaintwindow \
+ svx/source/svdraw/selectioncontroller \
+ svx/source/svdraw/svdattr \
+ svx/source/svdraw/svdcrtv \
+ svx/source/svdraw/svddrag \
+ svx/source/svdraw/svddrgmt \
+ svx/source/svdraw/svddrgv \
+ svx/source/svdraw/svdedtv \
+ svx/source/svdraw/svdedtv1 \
+ svx/source/svdraw/svdedtv2 \
+ svx/source/svdraw/svdedxv \
+ svx/source/svdraw/svdetc \
+ svx/source/svdraw/svdfmtf \
+ svx/source/svdraw/svdglev \
+ svx/source/svdraw/svdglue \
+ svx/source/svdraw/svdhdl \
+ svx/source/svdraw/svdhlpln \
+ svx/source/svdraw/svdibrow \
+ svx/source/svdraw/svditer \
+ svx/source/svdraw/svdlayer \
+ svx/source/svdraw/svdmark \
+ svx/source/svdraw/svdmodel \
+ svx/source/svdraw/svdmrkv \
+ svx/source/svdraw/svdmrkv1 \
+ svx/source/svdraw/svdoashp \
+ svx/source/svdraw/svdoattr \
+ svx/source/svdraw/svdobj \
+ svx/source/svdraw/svdocapt \
+ svx/source/svdraw/svdocirc \
+ svx/source/svdraw/svdoedge \
+ svx/source/svdraw/svdograf \
+ svx/source/svdraw/svdogrp \
+ svx/source/svdraw/svdomeas \
+ svx/source/svdraw/svdomedia \
+ svx/source/svdraw/svdoole2 \
+ svx/source/svdraw/svdopage \
+ svx/source/svdraw/svdopath \
+ svx/source/svdraw/svdorect \
+ svx/source/svdraw/svdotext \
+ svx/source/svdraw/svdotextdecomposition \
+ svx/source/svdraw/svdotextpathdecomposition \
+ svx/source/svdraw/svdotxat \
+ svx/source/svdraw/svdotxdr \
+ svx/source/svdraw/svdotxed \
+ svx/source/svdraw/svdotxfl \
+ svx/source/svdraw/svdotxln \
+ svx/source/svdraw/svdotxtr \
+ svx/source/svdraw/svdouno \
+ svx/source/svdraw/svdoutl \
+ svx/source/svdraw/svdoutlinercache \
+ svx/source/svdraw/svdovirt \
+ svx/source/svdraw/svdpage \
+ svx/source/svdraw/svdpagv \
+ svx/source/svdraw/svdpntv \
+ svx/source/svdraw/svdpoev \
+ svx/source/svdraw/svdsnpv \
+ svx/source/svdraw/svdtext \
+ svx/source/svdraw/svdtrans \
+ svx/source/svdraw/svdundo \
+ svx/source/svdraw/svdview \
+ svx/source/svdraw/svdviter \
+ svx/source/svdraw/svdxcgv \
+ svx/source/table/cell \
+ svx/source/table/cellcursor \
+ svx/source/table/cellrange \
+ svx/source/table/propertyset \
+ svx/source/table/svdotable \
+ svx/source/table/tablecolumn \
+ svx/source/table/tablecolumns \
+ svx/source/table/tablecontroller \
+ svx/source/table/tablehandles \
+ svx/source/table/tablelayouter \
+ svx/source/table/tablemodel \
+ svx/source/table/tablerow \
+ svx/source/table/tablerows \
+ svx/source/table/tableundo \
+ svx/source/table/viewcontactoftableobj \
+ svx/source/tbxctrls/extrusioncontrols \
+ svx/source/tbxctrls/fontworkgallery \
+ svx/source/tbxctrls/tbcontrl \
+ svx/source/tbxctrls/tbxcolorupdate \
+ svx/source/toolbars/extrusionbar \
+ svx/source/toolbars/fontworkbar \
+ svx/source/unodraw/gluepts \
+ svx/source/unodraw/shapepropertynotifier \
+ svx/source/unodraw/tableshape \
+ svx/source/unodraw/unobtabl \
+ svx/source/unodraw/unodtabl \
+ svx/source/unodraw/UnoGraphicExporter \
+ svx/source/unodraw/unogtabl \
+ svx/source/unodraw/unohtabl \
+ svx/source/unodraw/unomlstr \
+ svx/source/unodraw/unomod \
+ svx/source/unodraw/unomtabl \
+ svx/source/unodraw/UnoNameItemTable \
+ svx/source/unodraw/unopage \
+ svx/source/unodraw/unoprov \
+ svx/source/unodraw/unoshap2 \
+ svx/source/unodraw/unoshap3 \
+ svx/source/unodraw/unoshap4 \
+ svx/source/unodraw/unoshape \
+ svx/source/unodraw/unoshtxt \
+ svx/source/unodraw/unottabl \
+ svx/source/unodraw/XPropertyTable \
+ svx/source/xml/xmleohlp \
+ svx/source/xml/xmlexport \
+ svx/source/xml/xmlgrhlp \
+ svx/source/xml/xmlxtexp \
+ svx/source/xml/xmlxtimp \
+ svx/source/xoutdev/xattr \
+ svx/source/xoutdev/xattr2 \
+ svx/source/xoutdev/xattrbmp \
+ svx/source/xoutdev/xexch \
+ svx/source/xoutdev/_xoutbmp \
+ svx/source/xoutdev/_xpoly \
+ svx/source/xoutdev/xpool \
+ svx/source/xoutdev/xtabbtmp \
+ svx/source/xoutdev/xtabcolr \
+ svx/source/xoutdev/xtabdash \
+ svx/source/xoutdev/xtabgrdt \
+ svx/source/xoutdev/xtabhtch \
+ svx/source/xoutdev/xtable \
+ svx/source/xoutdev/xtablend \
+))
+
+# the following source file can't be compiled with optimization by some compilers (crash or endless loop):
+# Solaris Sparc with Sun compiler, gcc on MacOSX and Linux PPC
+# the latter is currently not supported by gbuild and needs a fix here later
+ifeq ($(OS),$(filter-out SOLARIS MACOSX,$(OS)))
+$(eval $(call gb_Library_add_exception_objects,svxcore,\
+ svx/source/customshapes/EnhancedCustomShapeFunctionParser \
+))
+else
+$(eval $(call gb_Library_add_cxxobjects,svxcore,\
+ svx/source/customshapes/EnhancedCustomShapeFunctionParser \
+ , $(gb_COMPILERNOOPTFLAGS) $(gb_LinkTarget_EXCEPTIONFLAGS) \
+))
+endif
+
+$(eval $(call gb_SdiTarget_SdiTarget,svx/sdi/svxslots,svx/sdi/svx))
+
+$(eval $(call gb_SdiTarget_set_include,svx/sdi/svxslots,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/svx/inc \
+ -I$(SRCDIR)/svx/sdi \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/svx/Library_textconversiondlgs.mk b/svx/Library_textconversiondlgs.mk
new file mode 100644
index 000000000000..c2ddae4fe131
--- /dev/null
+++ b/svx/Library_textconversiondlgs.mk
@@ -0,0 +1,66 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_Library_Library,textconversiondlgs))
+
+$(eval $(call gb_Library_set_componentfile,textconversiondlgs,svx/util/textconversiondlgs))
+
+$(eval $(call gb_Library_set_include,textconversiondlgs,\
+ -I$(SRCDIR)/svx/inc \
+ -I$(SRCDIR)/svx/inc/pch \
+ $$(INCLUDE) \
+ -I$(OUTDIR)/inc/offuh \
+))
+
+$(eval $(call gb_Library_set_defs,textconversiondlgs,\
+ $$(DEFS) \
+))
+
+$(eval $(call gb_Library_add_linked_libs,textconversiondlgs,\
+ comphelper \
+ cppuhelper \
+ cppu \
+ sal \
+ svl \
+ svt \
+ stl \
+ tk \
+ tl \
+ utl \
+ vcl \
+ $(gb_STDLIBS) \
+))
+
+$(eval $(call gb_Library_add_exception_objects,textconversiondlgs,\
+ svx/source/unodialogs/textconversiondlgs/services \
+ svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog \
+ svx/source/unodialogs/textconversiondlgs/chinese_translationdialog \
+ svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog \
+ svx/source/unodialogs/textconversiondlgs/resid \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/svx/Makefile b/svx/Makefile
new file mode 100644
index 000000000000..90947b2e5f48
--- /dev/null
+++ b/svx/Makefile
@@ -0,0 +1,38 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+ifeq ($(strip $(SOLARENV)),)
+$(error No environment set!)
+endif
+
+gb_PARTIALBUILD := T
+GBUILDDIR := $(SOLARENV)/gbuild
+include $(GBUILDDIR)/gbuild.mk
+
+$(eval $(call gb_Module_make_global_targets,$(shell ls $(dir $(realpath $(firstword $(MAKEFILE_LIST))))/Module*.mk)))
+
+# vim: set noet sw=4 ts=4:
diff --git a/svx/Module_svx.mk b/svx/Module_svx.mk
new file mode 100644
index 000000000000..d9288ea9e6b1
--- /dev/null
+++ b/svx/Module_svx.mk
@@ -0,0 +1,52 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_Module_Module,svx))
+
+$(eval $(call gb_Module_add_targets,svx,\
+ Library_svx \
+ Library_svxcore \
+ Library_textconversiondlgs \
+ AllLangResTarget_svx \
+ AllLangResTarget_ofa \
+ AllLangResTarget_gal \
+ AllLangResTarget_about \
+ AllLangResTarget_textconversiondlgs \
+ Package_inc \
+ Package_sdi \
+))
+
+$(eval $(call gb_Module_add_subsequentcheck_targets,svx,\
+ JunitTest_svx_unoapi \
+))
+
+#todo: noopt for EnhanceCustomShapesFunctionParser.cxx on Solaris Sparc and MacOSX
+#todo: -DBOOST_SPIRIT_USE_OLD_NAMESPACE only in CustomShapes ?
+#todo: -DUNICODE and -D_UNICODE on WNT for source/dialog
+#todo: globlmn.hrc
+#todo: component file
+# vim: set noet ts=4 sw=4:
diff --git a/svx/Package_inc.mk b/svx/Package_inc.mk
new file mode 100644
index 000000000000..81066e9c7bff
--- /dev/null
+++ b/svx/Package_inc.mk
@@ -0,0 +1,560 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_Package_Package,svx_inc,$(SRCDIR)/svx/inc))
+
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxsoitm.hxx,svx/sxsoitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdshtitm.hxx,svx/sdshtitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/polysc3d.hxx,svx/polysc3d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/dataaccessdescriptor.hxx,svx/dataaccessdescriptor.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdoashp.hxx,svx/svdoashp.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/dbaobjectex.hxx,svx/dbaobjectex.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/EnhancedCustomShapeTypeNames.hxx,svx/EnhancedCustomShapeTypeNames.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xftdiit.hxx,svx/xftdiit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/fntctl.hxx,svx/fntctl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdattr.hxx,svx/svdattr.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/imapdlg.hxx,svx/imapdlg.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/formatpaintbrushctrl.hxx,svx/formatpaintbrushctrl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xcolit.hxx,svx/xcolit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xftmrit.hxx,svx/xftmrit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svxcommands.h,svx/svxcommands.h))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdview.hxx,svx/svdview.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxraitm.hxx,svx/sxraitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxroaitm.hxx,svx/sxroaitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/AccessibleTableShape.hxx,svx/AccessibleTableShape.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xflbmsxy.hxx,svx/xflbmsxy.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/dlgctl3d.hxx,svx/dlgctl3d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdtaiitm.hxx,svx/sdtaiitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xtextit.hxx,svx/xtextit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/EnhancedCustomShapeFunctionParser.hxx,svx/EnhancedCustomShapeFunctionParser.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/ucsubset.hxx,svx/ucsubset.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sderitm.hxx,svx/sderitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/obj3d.hxx,svx/obj3d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/dbcharsethelper.hxx,svx/dbcharsethelper.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdangitm.hxx,svx/sdangitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/grfcrop.hxx,svx/grfcrop.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxtraitm.hxx,svx/sxtraitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/orienthelper.hxx,svx/orienthelper.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxonitm.hxx,svx/sxonitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xflbmpit.hxx,svx/xflbmpit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xlineit.hxx,svx/xlineit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/SmartTagItem.hxx,svx/SmartTagItem.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xpoly.hxx,svx/xpoly.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/ParseContext.hxx,svx/ParseContext.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/numinf.hxx,svx/numinf.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/objfac3d.hxx,svx/objfac3d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/tbxcolorupdate.hxx,svx/tbxcolorupdate.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdhdl.hxx,svx/svdhdl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdedxv.hxx,svx/svdedxv.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/SmartTagMgr.hxx,svx/SmartTagMgr.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/shapeproperty.hxx,svx/shapeproperty.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/galtheme.hxx,svx/galtheme.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/anchorid.hxx,svx/anchorid.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/unoshprp.hxx,svx/unoshprp.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/viewlayoutitem.hxx,svx/viewlayoutitem.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/fmmodel.hxx,svx/fmmodel.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/scene3d.hxx,svx/scene3d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/fmgridif.hxx,svx/fmgridif.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdasitm.hxx,svx/sdasitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svddrgmt.hxx,svx/svddrgmt.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xlnasit.hxx,svx/xlnasit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xlndsit.hxx,svx/xlndsit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/hyprlink.hxx,svx/hyprlink.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/framelinkarray.hxx,svx/framelinkarray.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdetc.hxx,svx/svdetc.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xflbmtit.hxx,svx/xflbmtit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdtfsitm.hxx,svx/sdtfsitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/txencbox.hxx,svx/txencbox.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/e3ditem.hxx,svx/e3ditem.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xoutbmp.hxx,svx/xoutbmp.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdotable.hxx,svx/svdotable.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xftshcit.hxx,svx/xftshcit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxlogitm.hxx,svx/sxlogitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxrooitm.hxx,svx/sxrooitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/fontwork.hxx,svx/fontwork.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxcecitm.hxx,svx/sxcecitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdginitm.hxx,svx/sdginitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdpntv.hxx,svx/svdpntv.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/fontlb.hxx,svx/fontlb.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xfillit0.hxx,svx/xfillit0.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xsflclit.hxx,svx/xsflclit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdrpageuser.hxx,svx/sdrpageuser.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xbtmpit.hxx,svx/xbtmpit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svxids.hrc,svx/svxids.hrc))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/galmisc.hxx,svx/galmisc.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxmfsitm.hxx,svx/sxmfsitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/extrusioncolorcontrol.hxx,svx/extrusioncolorcontrol.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/fmsrccfg.hxx,svx/fmsrccfg.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/pageitem.hxx,svx/pageitem.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdrpaintwindow.hxx,svx/sdrpaintwindow.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxmkitm.hxx,svx/sxmkitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xfillit.hxx,svx/xfillit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xflftrit.hxx,svx/xflftrit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxopitm.hxx,svx/sxopitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/unofill.hxx,svx/unofill.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/drawitem.hxx,svx/drawitem.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xmlgrhlp.hxx,svx/xmlgrhlp.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/fmresids.hrc,svx/fmresids.hrc))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/zoomitem.hxx,svx/zoomitem.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdtcfitm.hxx,svx/sdtcfitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdmetitm.hxx,svx/sdmetitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/fmtools.hxx,svx/fmtools.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/fntszctl.hxx,svx/fntszctl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxsiitm.hxx,svx/sxsiitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxlayitm.hxx,svx/sxlayitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/unomid.hxx,svx/unomid.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/frmsel.hxx,svx/frmsel.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/e3dsceneupdater.hxx,svx/e3dsceneupdater.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdcrtv.hxx,svx/svdcrtv.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/itemwin.hxx,svx/itemwin.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdtfchim.hxx,svx/sdtfchim.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/wrapfield.hxx,svx/wrapfield.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/fntctrl.hxx,svx/fntctrl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdxcgv.hxx,svx/svdxcgv.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/dbtoolsclient.hxx,svx/dbtoolsclient.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/rotmodit.hxx,svx/rotmodit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/layctrl.hxx,svx/layctrl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/rectenum.hxx,svx/rectenum.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdopath.hxx,svx/svdopath.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/unoshtxt.hxx,svx/unoshtxt.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdopage.hxx,svx/svdopage.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xftadit.hxx,svx/xftadit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xlnstcit.hxx,svx/xlnstcit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/splitcelldlg.hxx,svx/splitcelldlg.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdynitm.hxx,svx/sdynitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/rulritem.hxx,svx/rulritem.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/fillctrl.hxx,svx/fillctrl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/SvxShapeTypes.hxx,svx/SvxShapeTypes.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/galctrl.hxx,svx/galctrl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/fmdmod.hxx,svx/fmdmod.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/exthelpid.hrc,svx/exthelpid.hrc))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/fmsearch.hxx,svx/fmsearch.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/pfiledlg.hxx,svx/pfiledlg.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxmovitm.hxx,svx/sxmovitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/fmsrcimp.hxx,svx/fmsrcimp.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxsalitm.hxx,svx/sxsalitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdoole2.hxx,svx/svdoole2.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdsnpv.hxx,svx/svdsnpv.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/gallery1.hxx,svx/gallery1.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/passwd.hxx,svx/passwd.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xgrscit.hxx,svx/xgrscit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdglev.hxx,svx/svdglev.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/fontworkbar.hxx,svx/fontworkbar.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/EnhancedCustomShapeGeometry.hxx,svx/EnhancedCustomShapeGeometry.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svxitems.hrc,svx/svxitems.hrc))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/fmpage.hxx,svx/fmpage.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/srchdlg.hxx,svx/srchdlg.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxcaitm.hxx,svx/sxcaitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/subtoolboxcontrol.hxx,svx/subtoolboxcontrol.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdasaitm.hxx,svx/sdasaitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/dbexch.hrc,svx/dbexch.hrc))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/unomaster.hxx,svx/unomaster.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdedtv.hxx,svx/svdedtv.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xlinjoit.hxx,svx/xlinjoit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxmbritm.hxx,svx/sxmbritm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/AccessibleGraphicShape.hxx,svx/AccessibleGraphicShape.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xlnstit.hxx,svx/xlnstit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/volume3d.hxx,svx/volume3d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/animation/scheduler.hxx,svx/sdr/animation/scheduler.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/animation/animationstate.hxx,svx/sdr/animation/animationstate.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/animation/objectanimator.hxx,svx/sdr/animation/objectanimator.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/overlay/overlayhelpline.hxx,svx/sdr/overlay/overlayhelpline.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/overlay/overlayobjectcell.hxx,svx/sdr/overlay/overlayobjectcell.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/overlay/overlaymanager.hxx,svx/sdr/overlay/overlaymanager.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx,svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/overlay/overlayobjectlist.hxx,svx/sdr/overlay/overlayobjectlist.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/overlay/overlayhatchrect.hxx,svx/sdr/overlay/overlayhatchrect.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/overlay/overlaytools.hxx,svx/sdr/overlay/overlaytools.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/overlay/overlayselection.hxx,svx/sdr/overlay/overlayselection.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/overlay/overlaytriangle.hxx,svx/sdr/overlay/overlaytriangle.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/overlay/overlaypolypolygon.hxx,svx/sdr/overlay/overlaypolypolygon.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/overlay/overlaymanagerbuffered.hxx,svx/sdr/overlay/overlaymanagerbuffered.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/overlay/overlayrollingrectangle.hxx,svx/sdr/overlay/overlayrollingrectangle.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/overlay/overlayline.hxx,svx/sdr/overlay/overlayline.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/overlay/overlaycrosshair.hxx,svx/sdr/overlay/overlaycrosshair.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/overlay/overlayobject.hxx,svx/sdr/overlay/overlayobject.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/overlay/overlayanimatedbitmapex.hxx,svx/sdr/overlay/overlayanimatedbitmapex.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/overlay/overlaybitmapex.hxx,svx/sdr/overlay/overlaybitmapex.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/event/eventhandler.hxx,svx/sdr/event/eventhandler.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/itemsettools.hxx,svx/sdr/properties/itemsettools.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/connectorproperties.hxx,svx/sdr/properties/connectorproperties.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/e3dlatheproperties.hxx,svx/sdr/properties/e3dlatheproperties.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/circleproperties.hxx,svx/sdr/properties/circleproperties.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/e3dsphereproperties.hxx,svx/sdr/properties/e3dsphereproperties.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/captionproperties.hxx,svx/sdr/properties/captionproperties.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/customshapeproperties.hxx,svx/sdr/properties/customshapeproperties.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/attributeproperties.hxx,svx/sdr/properties/attributeproperties.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/rectangleproperties.hxx,svx/sdr/properties/rectangleproperties.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/pageproperties.hxx,svx/sdr/properties/pageproperties.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/oleproperties.hxx,svx/sdr/properties/oleproperties.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/textproperties.hxx,svx/sdr/properties/textproperties.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/emptyproperties.hxx,svx/sdr/properties/emptyproperties.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/e3dextrudeproperties.hxx,svx/sdr/properties/e3dextrudeproperties.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/properties.hxx,svx/sdr/properties/properties.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/defaultproperties.hxx,svx/sdr/properties/defaultproperties.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/e3dproperties.hxx,svx/sdr/properties/e3dproperties.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/groupproperties.hxx,svx/sdr/properties/groupproperties.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/graphicproperties.hxx,svx/sdr/properties/graphicproperties.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/e3dcompoundproperties.hxx,svx/sdr/properties/e3dcompoundproperties.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/e3dsceneproperties.hxx,svx/sdr/properties/e3dsceneproperties.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/properties/measureproperties.hxx,svx/sdr/properties/measureproperties.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/table/tabledesign.hxx,svx/sdr/table/tabledesign.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/primitive2d/primitiveFactory2d.hxx,svx/sdr/primitive2d/primitiveFactory2d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx,svx/sdr/primitive2d/sdrpathprimitive2d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx,svx/sdr/primitive2d/sdrtextprimitive2d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/primitive2d/sdrprimitivetools.hxx,svx/sdr/primitive2d/sdrprimitivetools.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx,svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx,svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx,svx/sdr/primitive2d/svx_primitivetypes2d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx,svx/sdr/primitive2d/sdrdecompositiontools.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx,svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx,svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx,svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx,svx/sdr/primitive2d/sdrellipseprimitive2d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx,svx/sdr/primitive2d/sdrole2primitive2d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/primitive2d/sdrattributecreator.hxx,svx/sdr/primitive2d/sdrattributecreator.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx,svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx,svx/sdr/primitive2d/sdrgrafprimitive2d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/primitive3d/sdrattributecreator3d.hxx,svx/sdr/primitive3d/sdrattributecreator3d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewcontactofe3dextrude.hxx,svx/sdr/contact/viewcontactofe3dextrude.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewcontactofvirtobj.hxx,svx/sdr/contact/viewcontactofvirtobj.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewcontactofe3dscene.hxx,svx/sdr/contact/viewcontactofe3dscene.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/objectcontacttools.hxx,svx/sdr/contact/objectcontacttools.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/objectcontact.hxx,svx/sdr/contact/objectcontact.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewcontactofpageobj.hxx,svx/sdr/contact/viewcontactofpageobj.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewcontactofe3dcube.hxx,svx/sdr/contact/viewcontactofe3dcube.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewobjectcontactofsdrole2obj.hxx,svx/sdr/contact/viewobjectcontactofsdrole2obj.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx,svx/sdr/contact/viewobjectcontactofunocontrol.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/objectcontactofpageview.hxx,svx/sdr/contact/objectcontactofpageview.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewcontactofe3dpolygon.hxx,svx/sdr/contact/viewcontactofe3dpolygon.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewobjectcontactofsdrpage.hxx,svx/sdr/contact/viewobjectcontactofsdrpage.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewobjectcontactofsdrobj.hxx,svx/sdr/contact/viewobjectcontactofsdrobj.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/objectcontactofobjlistpainter.hxx,svx/sdr/contact/objectcontactofobjlistpainter.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewobjectcontactofe3dscene.hxx,svx/sdr/contact/viewobjectcontactofe3dscene.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewcontact.hxx,svx/sdr/contact/viewcontact.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewobjectcontactofpageobj.hxx,svx/sdr/contact/viewobjectcontactofpageobj.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewcontactofsdrcaptionobj.hxx,svx/sdr/contact/viewcontactofsdrcaptionobj.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewcontactofsdrcircobj.hxx,svx/sdr/contact/viewcontactofsdrcircobj.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewcontactofsdrole2obj.hxx,svx/sdr/contact/viewcontactofsdrole2obj.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewcontactoftextobj.hxx,svx/sdr/contact/viewcontactoftextobj.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewcontactofsdrpage.hxx,svx/sdr/contact/viewcontactofsdrpage.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewcontactofunocontrol.hxx,svx/sdr/contact/viewcontactofunocontrol.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewcontactofsdredgeobj.hxx,svx/sdr/contact/viewcontactofsdredgeobj.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewobjectcontactofmasterpagedescriptor.hxx,svx/sdr/contact/viewobjectcontactofmasterpagedescriptor.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewobjectcontactofe3d.hxx,svx/sdr/contact/viewobjectcontactofe3d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewcontactofe3dsphere.hxx,svx/sdr/contact/viewcontactofe3dsphere.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewcontactofsdrobjcustomshape.hxx,svx/sdr/contact/viewcontactofsdrobjcustomshape.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewcontactofe3d.hxx,svx/sdr/contact/viewcontactofe3d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewobjectcontact.hxx,svx/sdr/contact/viewobjectcontact.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewcontactofsdrpathobj.hxx,svx/sdr/contact/viewcontactofsdrpathobj.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewcontactofsdrmediaobj.hxx,svx/sdr/contact/viewcontactofsdrmediaobj.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewcontactofmasterpagedescriptor.hxx,svx/sdr/contact/viewcontactofmasterpagedescriptor.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewcontactofe3dlathe.hxx,svx/sdr/contact/viewcontactofe3dlathe.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewobjectcontactofsdrmediaobj.hxx,svx/sdr/contact/viewobjectcontactofsdrmediaobj.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewcontactofgraphic.hxx,svx/sdr/contact/viewcontactofgraphic.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewobjectcontactredirector.hxx,svx/sdr/contact/viewobjectcontactredirector.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewobjectcontactofgraphic.hxx,svx/sdr/contact/viewobjectcontactofgraphic.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewcontactofgroup.hxx,svx/sdr/contact/viewcontactofgroup.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/displayinfo.hxx,svx/sdr/contact/displayinfo.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewcontactofsdrobj.hxx,svx/sdr/contact/viewcontactofsdrobj.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewcontactofsdrmeasureobj.hxx,svx/sdr/contact/viewcontactofsdrmeasureobj.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewcontactofsdrrectobj.hxx,svx/sdr/contact/viewcontactofsdrrectobj.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/contact/viewobjectcontactofgroup.hxx,svx/sdr/contact/viewobjectcontactofgroup.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx,svx/sdr/attribute/sdrformtextoutlineattribute.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/attribute/sdrformtextattribute.hxx,svx/sdr/attribute/sdrformtextattribute.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/attribute/sdrlineshadowtextattribute.hxx,svx/sdr/attribute/sdrlineshadowtextattribute.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/attribute/sdrfilltextattribute.hxx,svx/sdr/attribute/sdrfilltextattribute.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx,svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/attribute/sdrshadowtextattribute.hxx,svx/sdr/attribute/sdrshadowtextattribute.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdr/attribute/sdrtextattribute.hxx,svx/sdr/attribute/sdrtextattribute.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/dialcontrol.hxx,svx/dialcontrol.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxmlhitm.hxx,svx/sxmlhitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/optgenrl.hxx,svx/optgenrl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/unoshcol.hxx,svx/unoshcol.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdtagitm.hxx,svx/sdtagitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xftsfit.hxx,svx/xftsfit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdograf.hxx,svx/svdograf.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/cube3d.hxx,svx/cube3d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xlnwtit.hxx,svx/xlnwtit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/zoom_def.hxx,svx/zoom_def.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/charmap.hxx,svx/charmap.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/connctrl.hxx,svx/connctrl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdtacitm.hxx,svx/sdtacitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/hyperdlg.hxx,svx/hyperdlg.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/tbxctl.hxx,svx/tbxctl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/f3dchild.hxx,svx/f3dchild.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdogrp.hxx,svx/svdogrp.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/simptabl.hxx,svx/simptabl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxelditm.hxx,svx/sxelditm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/zoomslideritem.hxx,svx/zoomslideritem.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xftshtit.hxx,svx/xftshtit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/float3d.hxx,svx/float3d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xlntrit.hxx,svx/xlntrit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdmodel.hxx,svx/svdmodel.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdtext.hxx,svx/svdtext.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/AccessibleTextHelper.hxx,svx/AccessibleTextHelper.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdtayitm.hxx,svx/sdtayitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdtmfitm.hxx,svx/sdtmfitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/zoomsliderctrl.hxx,svx/zoomsliderctrl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/polygn3d.hxx,svx/polygn3d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdglob.hxx,svx/svdglob.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/graphctl.hxx,svx/graphctl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xpool.hxx,svx/xpool.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/framelink.hxx,svx/framelink.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/unoprov.hxx,svx/unoprov.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/checklbx.hxx,svx/checklbx.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/selctrl.hxx,svx/selctrl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdggaitm.hxx,svx/sdggaitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xflbtoxy.hxx,svx/xflbtoxy.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/tabline.hxx,svx/tabline.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdpool.hxx,svx/svdpool.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/stddlg.hxx,svx/stddlg.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/databaseregistrationui.hxx,svx/databaseregistrationui.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xdef.hxx,svx/xdef.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/algitem.hxx,svx/algitem.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxfiitm.hxx,svx/sxfiitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/grfflt.hxx,svx/grfflt.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/databaselocationinput.hxx,svx/databaselocationinput.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxmsuitm.hxx,svx/sxmsuitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/dialmgr.hxx,svx/dialmgr.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xdash.hxx,svx/xdash.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/grafctrl.hxx,svx/grafctrl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xlineit0.hxx,svx/xlineit0.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xfltrit.hxx,svx/xfltrit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/viewpt3d.hxx,svx/viewpt3d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xflbmsli.hxx,svx/xflbmsli.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxmoitm.hxx,svx/sxmoitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/htmlmode.hxx,svx/htmlmode.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xmlsecctrl.hxx,svx/xmlsecctrl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svx3ditems.hxx,svx/svx3ditems.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/camera3d.hxx,svx/camera3d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/measctrl.hxx,svx/measctrl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdooitm.hxx,svx/sdooitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdpage.hxx,svx/svdpage.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdsob.hxx,svx/svdsob.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdshcitm.hxx,svx/sdshcitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdtaitm.hxx,svx/sdtaitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdtrans.hxx,svx/svdtrans.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdgtritm.hxx,svx/sdgtritm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/tbxdraw.hxx,svx/tbxdraw.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdprcitm.hxx,svx/sdprcitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/unomodel.hxx,svx/unomodel.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/IAccessibleViewForwarderListener.hxx,svx/IAccessibleViewForwarderListener.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdlayer.hxx,svx/svdlayer.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xflasit.hxx,svx/xflasit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xflclit.hxx,svx/xflclit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxsaitm.hxx,svx/sxsaitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/verttexttbxctrl.hxx,svx/verttexttbxctrl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/contdlg.hxx,svx/contdlg.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svxerr.hxx,svx/svxerr.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdpagv.hxx,svx/svdpagv.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdocapt.hxx,svx/svdocapt.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdfield.hxx,svx/svdfield.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/relfld.hxx,svx/relfld.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/AccessibleShapeInfo.hxx,svx/AccessibleShapeInfo.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/numvset.hxx,svx/numvset.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdrcomment.hxx,svx/sdrcomment.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/txenctab.hxx,svx/txenctab.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdorect.hxx,svx/svdorect.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xftshit.hxx,svx/xftshit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/pagectrl.hxx,svx/pagectrl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxreoitm.hxx,svx/sxreoitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdtypes.hxx,svx/svdtypes.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/ucsubset.hrc,svx/ucsubset.hrc))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/pszctrl.hxx,svx/pszctrl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdattrx.hxx,svx/svdattrx.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdtditm.hxx,svx/sdtditm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/swframevalidation.hxx,svx/swframevalidation.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xgrad.hxx,svx/xgrad.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdpoev.hxx,svx/svdpoev.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xflbckit.hxx,svx/xflbckit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xtextit0.hxx,svx/xtextit0.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxreaitm.hxx,svx/sxreaitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/lboxctrl.hxx,svx/lboxctrl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/fontworkgallery.hxx,svx/fontworkgallery.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/ShapeTypeHandler.hxx,svx/ShapeTypeHandler.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdstr.hrc,svx/svdstr.hrc))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svditext.hxx,svx/svditext.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxekitm.hxx,svx/sxekitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svxgrahicitem.hxx,svx/svxgrahicitem.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xflbstit.hxx,svx/xflbstit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/galbrws.hxx,svx/galbrws.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/unomod.hxx,svx/unomod.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xlnclit.hxx,svx/xlnclit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/deflt3d.hxx,svx/deflt3d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/e3dundo.hxx,svx/e3dundo.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/ChildrenManager.hxx,svx/ChildrenManager.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/fmgridcl.hxx,svx/fmgridcl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdobj.hxx,svx/svdobj.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxmtaitm.hxx,svx/sxmtaitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/clipboardctl.hxx,svx/clipboardctl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xtable.hxx,svx/xtable.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdgcoitm.hxx,svx/sdgcoitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdovirt.hxx,svx/svdovirt.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/fmshell.hxx,svx/fmshell.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/IAccessibleParent.hxx,svx/IAccessibleParent.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdmark.hxx,svx/svdmark.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/strarray.hxx,svx/strarray.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdgluitm.hxx,svx/sdgluitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdtakitm.hxx,svx/sdtakitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/SpellDialogChildWindow.hxx,svx/SpellDialogChildWindow.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xexch.hxx,svx/xexch.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/gallery.hxx,svx/gallery.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/dlgctrl.hxx,svx/dlgctrl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/DescriptionGenerator.hxx,svx/DescriptionGenerator.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xenum.hxx,svx/xenum.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/numfmtsh.hxx,svx/numfmtsh.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/fmglob.hxx,svx/fmglob.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/framebordertype.hxx,svx/framebordertype.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdomeas.hxx,svx/svdomeas.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/insctrl.hxx,svx/insctrl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdoedge.hxx,svx/svdoedge.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/bmpmask.hxx,svx/bmpmask.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdshitm.hxx,svx/sdshitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svddef.hxx,svx/svddef.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/tbcontrl.hxx,svx/tbcontrl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/dstribut_enum.hxx,svx/dstribut_enum.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxcllitm.hxx,svx/sxcllitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/rubydialog.hxx,svx/rubydialog.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/ipolypolygoneditorcontroller.hxx,svx/ipolypolygoneditorcontroller.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/AccessibleOLEShape.hxx,svx/AccessibleOLEShape.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/extrusionbar.hxx,svx/extrusionbar.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/AccessibleControlShape.hxx,svx/AccessibleControlShape.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/paraprev.hxx,svx/paraprev.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xftshxy.hxx,svx/xftshxy.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/tbxcustomshapes.hxx,svx/tbxcustomshapes.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdrhittesthelper.hxx,svx/sdrhittesthelper.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdviter.hxx,svx/svdviter.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/ofaitem.hxx,svx/ofaitem.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/frmdirlbox.hxx,svx/frmdirlbox.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/EnhancedCustomShape2d.hxx,svx/EnhancedCustomShape2d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxoneitm.hxx,svx/sxoneitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/msdffdef.hxx,svx/msdffdef.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/globl3d.hxx,svx/globl3d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xattr.hxx,svx/xattr.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxmuitm.hxx,svx/sxmuitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdsxyitm.hxx,svx/sdsxyitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/postattr.hxx,svx/postattr.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdoattr.hxx,svx/svdoattr.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/prtqry.hxx,svx/prtqry.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sphere3d.hxx,svx/sphere3d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdomedia.hxx,svx/svdomedia.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xflboxy.hxx,svx/xflboxy.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/swframeposstrings.hxx,svx/swframeposstrings.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svditer.hxx,svx/svditer.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxmspitm.hxx,svx/sxmspitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/fmobjfac.hxx,svx/fmobjfac.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdocirc.hxx,svx/svdocirc.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svxdlg.hxx,svx/svxdlg.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxenditm.hxx,svx/sxenditm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/def3d.hxx,svx/def3d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/UnoNamespaceMap.hxx,svx/UnoNamespaceMap.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxciaitm.hxx,svx/sxciaitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/polypolygoneditor.hxx,svx/polypolygoneditor.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdgmoitm.hxx,svx/sdgmoitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/linectrl.hxx,svx/linectrl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xlnedcit.hxx,svx/xlnedcit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxmsitm.hxx,svx/sxmsitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdtaditm.hxx,svx/sdtaditm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdotext.hxx,svx/svdotext.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/chrtitem.hxx,svx/chrtitem.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xbitmap.hxx,svx/xbitmap.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxallitm.hxx,svx/sxallitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/dlgutil.hxx,svx/dlgutil.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/unopage.hxx,svx/unopage.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svddrag.hxx,svx/svddrag.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/AccessibleShapeTreeInfo.hxx,svx/AccessibleShapeTreeInfo.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxcgitm.hxx,svx/sxcgitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xlnedwit.hxx,svx/xlnedwit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdouno.hxx,svx/svdouno.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdrmasterpagedescriptor.hxx,svx/sdrmasterpagedescriptor.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxcikitm.hxx,svx/sxcikitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdoutl.hxx,svx/svdoutl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/shapepropertynotifier.hxx,svx/shapepropertynotifier.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxctitm.hxx,svx/sxctitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/dbaexchange.hxx,svx/dbaexchange.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxmtritm.hxx,svx/sxmtritm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdrobjectuser.hxx,svx/sdrobjectuser.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/AccessibleShape.hxx,svx/AccessibleShape.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/hlnkitem.hxx,svx/hlnkitem.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xhatch.hxx,svx/xhatch.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/swframeexample.hxx,svx/swframeexample.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xlnstwit.hxx,svx/xlnstwit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xit.hxx,svx/xit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdhlpln.hxx,svx/svdhlpln.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/ctredlin.hxx,svx/ctredlin.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/lathe3d.hxx,svx/lathe3d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/optgrid.hxx,svx/optgrid.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/langbox.hxx,svx/langbox.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/clipfmtitem.hxx,svx/clipfmtitem.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xsetit.hxx,svx/xsetit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/tabarea.hxx,svx/tabarea.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/SmartTagCtl.hxx,svx/SmartTagCtl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/tbxcolor.hxx,svx/tbxcolor.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdmrkv.hxx,svx/svdmrkv.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/modctrl.hxx,svx/modctrl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/unoapi.hxx,svx/unoapi.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/ruler.hxx,svx/ruler.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdrobjectfilter.hxx,svx/sdrobjectfilter.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxmtfitm.hxx,svx/sxmtfitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdundo.hxx,svx/svdundo.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/hdft.hxx,svx/hdft.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xmlexchg.hxx,svx/xmlexchg.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/IAccessibleViewForwarder.hxx,svx/IAccessibleViewForwarder.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/dialogs.hrc,svx/dialogs.hrc))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/extrud3d.hxx,svx/extrud3d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/unopool.hxx,svx/unopool.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xflhtit.hxx,svx/xflhtit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xlnedit.hxx,svx/xlnedit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xmleohlp.hxx,svx/xmleohlp.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/ifaceids.hxx,svx/ifaceids.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xftouit.hxx,svx/xftouit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/selectioncontroller.hxx,svx/selectioncontroller.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdrpagewindow.hxx,svx/sdrpagewindow.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdgcpitm.hxx,svx/sdgcpitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/view3d.hxx,svx/view3d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/unoshape.hxx,svx/unoshape.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xflgrit.hxx,svx/xflgrit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/ActionDescriptionProvider.hxx,svx/ActionDescriptionProvider.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/gridctrl.hxx,svx/gridctrl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/tbxalign.hxx,svx/tbxalign.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svimbase.hxx,svx/svimbase.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/zoomctrl.hxx,svx/zoomctrl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svddrgv.hxx,svx/svddrgv.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/XPropertyTable.hxx,svx/XPropertyTable.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xftstit.hxx,svx/xftstit.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdglue.hxx,svx/svdglue.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/helperhittest3d.hxx,svx/helperhittest3d.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/flagsdef.hxx,svx/flagsdef.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdtaaitm.hxx,svx/sdtaaitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/fmview.hxx,svx/fmview.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/svxdllapi.h,svx/svxdllapi.h))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/colrctrl.hxx,svx/colrctrl.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/fmdpage.hxx,svx/fmdpage.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxmtpitm.hxx,svx/sxmtpitm.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/globlmn.hrc,globlmn_tmpl.hrc))
+
diff --git a/svx/Package_sdi.mk b/svx/Package_sdi.mk
new file mode 100644
index 000000000000..0a43a1ae7be3
--- /dev/null
+++ b/svx/Package_sdi.mk
@@ -0,0 +1,33 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_Package_Package,svx_sdi,$(SRCDIR)/svx/sdi))
+$(eval $(call gb_Package_add_file,svx_sdi,inc/svx/svx.sdi,svx.sdi))
+$(eval $(call gb_Package_add_file,svx_sdi,inc/svx/svxitems.sdi,svxitems.sdi))
+$(eval $(call gb_Package_add_file,svx_sdi,inc/svx/xoitems.sdi,xoitems.sdi))
+
+
diff --git a/svx/doc/UML/edit_engine_UNO_implementation.zuml b/svx/doc/UML/edit_engine_UNO_implementation.zuml
new file mode 100644
index 000000000000..d0faf5adeca4
--- /dev/null
+++ b/svx/doc/UML/edit_engine_UNO_implementation.zuml
@@ -0,0 +1 @@
+PK2l¼ \ No newline at end of file
diff --git a/svx/doc/UML/grid_control_implementation.zuml b/svx/doc/UML/grid_control_implementation.zuml
new file mode 100644
index 000000000000..139cd3fd8b56
--- /dev/null
+++ b/svx/doc/UML/grid_control_implementation.zuml
Binary files differ
diff --git a/svx/doc/UML/readme.txt b/svx/doc/UML/readme.txt
new file mode 100644
index 000000000000..7b9fc0a73a96
--- /dev/null
+++ b/svx/doc/UML/readme.txt
@@ -0,0 +1,9 @@
+This folder contains UML diagrams for certain implementations within this project.
+
+To view/edit them, you need "Poseidon for UML". The free community edition (which
+is completely sufficient for all documents herein) is available from
+http://www.gentleware.com/.
+
+It is probably also possible to open the documents with ArgoUML, the free open source
+UML tool which Poseidon for UML is based on. Visit http://argouml.tigris.org/ to
+obtain ArgoUML.
diff --git a/svx/doc/drawing_layer_UNO_objects.odg b/svx/doc/drawing_layer_UNO_objects.odg
new file mode 100644
index 000000000000..69b0ceb44f88
--- /dev/null
+++ b/svx/doc/drawing_layer_UNO_objects.odg
Binary files differ
diff --git a/svx/inc/accessibility.hrc b/svx/inc/accessibility.hrc
new file mode 100644
index 000000000000..3e386be0daf1
--- /dev/null
+++ b/svx/inc/accessibility.hrc
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _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
+#define RID_SVXSTR_A11Y_TEXTHELPER_START (RID_SVXSTR_ACCESSIBILITY_START + 70)
+
+// 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/dgdefs_.hxx b/svx/inc/dgdefs_.hxx
new file mode 100644
index 000000000000..bf030e26d751
--- /dev/null
+++ b/svx/inc/dgdefs_.hxx
@@ -0,0 +1,341 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define optlingu_0a SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define insctrl_01 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define insctrl_03 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define insctrl_06 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define zoomctrl_03 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define zoomctrl_05 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define pszctrl_01 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define selctrl_01 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define selctrl_02 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define selctrl_05 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define modctrl_01 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_02 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_08 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_09 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_0a SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_11 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_12 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_13 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_35 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_37 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_38 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_39 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_3a SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_3c SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_3d SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_3e SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_3f SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_40 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_41 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_42 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_43 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_44 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_45 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_46 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_47 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_48 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_49 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_4a SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_4e SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_4f SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_53 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_54 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_58 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_59 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_5c SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_5f SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_63 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_64 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_65 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define tbcontrl_66 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define linectrl_01 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define linectrl_03 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define linectrl_04 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define linectrl_05 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define linectrl_06 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define linectrl_08 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define linectrl_09 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define linectrl_0a SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define linectrl_0e SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define fillctrl_01 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define fillctrl_03 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define fillctrl_05 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define fillctrl_06 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define fillctrl_08 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define itemwin_01 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define itemwin_08 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define itemwin_10 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define itemwin_12 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define itemwin_19 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define itemwin_1f SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define layctrl_09 SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define layctrl_0d SEG_SEGCLASS(STARTING_SEG000,STARTING_CODE)
+#define pszctrl_03 SEG_SEGCLASS(STARTWORK_SEG000,STARTWORK_CODE)
+#define tcovmain_01 SEG_SEGCLASS(STARTWORK_SEG000,STARTWORK_CODE)
+#define pszctrl_04 SEG_SEGCLASS(STARTWORK_SEG000,STARTWORK_CODE)
+#define pszctrl_05 SEG_SEGCLASS(STARTWORK_SEG000,STARTWORK_CODE)
+#define tcovidle_01 SEG_SEGCLASS(STARTWORK_SEG000,STARTWORK_CODE)
+#define optgrid_02 SEG_SEGCLASS(STARTWORK_SEG000,STARTWORK_CODE)
+#define optgrid_17 SEG_SEGCLASS(STARTWORK_SEG000,STARTWORK_CODE)
+#define optgrid_16 SEG_SEGCLASS(STARTWORK_SEG000,STARTWORK_CODE)
+#define optgrid_01 SEG_SEGCLASS(STARTWORK_SEG000,STARTWORK_CODE)
+#define optgrid_18 SEG_SEGCLASS(STARTWORK_SEG000,STARTWORK_CODE)
+#define optgrid_15 SEG_SEGCLASS(STARTWORK_SEG000,STARTWORK_CODE)
+#define modctrl_02 SEG_SEGCLASS(STARTWORK_SEG000,STARTWORK_CODE)
+#define modctrl_04 SEG_SEGCLASS(STARTWORK_SEG000,STARTWORK_CODE)
+#define adritem_07 SEG_SEGCLASS(STARTWORK_SEG000,STARTWORK_CODE)
+#define adritem_28 SEG_SEGCLASS(STARTWORK_SEG000,STARTWORK_CODE)
+#define optgrid_12 SEG_SEGCLASS(STARTWORK_SEG000,STARTWORK_CODE)
+#define optpath_01 SEG_SEGCLASS(STARTSLICE_SEG000,STARTSLICE_CODE)
+#define optpath_02 SEG_SEGCLASS(STARTSLICE_SEG000,STARTSLICE_CODE)
+#define optpath_04 SEG_SEGCLASS(STARTSLICE_SEG000,STARTSLICE_CODE)
+#define optitems_01 SEG_SEGCLASS(STARTSLICE_SEG001,STARTSLICE_CODE)
+#define optitems_02 SEG_SEGCLASS(STARTSLICE_SEG001,STARTSLICE_CODE)
+#define optitems_04 SEG_SEGCLASS(STARTSLICE_SEG001,STARTSLICE_CODE)
+#define optgenrl_01 SEG_SEGCLASS(STARTSLICE_SEG001,STARTSLICE_CODE)
+#define optgenrl_02 SEG_SEGCLASS(STARTSLICE_SEG001,STARTSLICE_CODE)
+#define optgenrl_04 SEG_SEGCLASS(STARTSLICE_SEG002,STARTSLICE_CODE)
+#define optgenrl_06 SEG_SEGCLASS(STARTSLICE_SEG002,STARTSLICE_CODE)
+#define optgenrl_08 SEG_SEGCLASS(STARTSLICE_SEG002,STARTSLICE_CODE)
+#define adritem_25 SEG_SEGCLASS(STARTSLICE_SEG002,STARTSLICE_CODE)
+#define optgenrl_0b SEG_SEGCLASS(STARTSLICE_SEG003,STARTSLICE_CODE)
+#define adritem_04 SEG_SEGCLASS(STARTSLICE_SEG003,STARTSLICE_CODE)
+#define opttypes_01 SEG_SEGCLASS(STARTSLICE_SEG003,STARTSLICE_CODE)
+#define optlingu_01 SEG_SEGCLASS(STARTSLICE_SEG003,STARTSLICE_CODE)
+#define optlingu_03 SEG_SEGCLASS(STARTSLICE_SEG003,STARTSLICE_CODE)
+#define optlingu_05 SEG_SEGCLASS(STARTSLICE_SEG004,STARTSLICE_CODE)
+#define optlingu_09 SEG_SEGCLASS(STARTSLICE_SEG004,STARTSLICE_CODE)
+#define optgrid_03 SEG_SEGCLASS(STARTSLICE_SEG005,STARTSLICE_CODE)
+#define optgrid_07 SEG_SEGCLASS(STARTSLICE_SEG005,STARTSLICE_CODE)
+#define optgrid_08 SEG_SEGCLASS(STARTSLICE_SEG005,STARTSLICE_CODE)
+#define optgrid_0a SEG_SEGCLASS(STARTSLICE_SEG006,STARTSLICE_CODE)
+#define linectrl_0c SEG_SEGCLASS(STARTSLICE_SEG006,STARTSLICE_CODE)
+#define itemwin_0a SEG_SEGCLASS(STARTSLICE_SEG006,STARTSLICE_CODE)
+#define linectrl_0d SEG_SEGCLASS(STARTSLICE_SEG006,STARTSLICE_CODE)
+#define fillctrl_04 SEG_SEGCLASS(STARTSLICE_SEG007,STARTSLICE_CODE)
+#define optpath_07 SEG_SEGCLASS(CALLOPT_SEG000,CALLOPT_CODE)
+#define optitems_06 SEG_SEGCLASS(CALLOPT_SEG000,CALLOPT_CODE)
+#define optitems_07 SEG_SEGCLASS(CALLOPT_SEG000,CALLOPT_CODE)
+#define optitems_0b SEG_SEGCLASS(CALLOPT_SEG000,CALLOPT_CODE)
+#define optgenrl_03 SEG_SEGCLASS(CALLOPT_SEG000,CALLOPT_CODE)
+#define optgrid_09 SEG_SEGCLASS(CALLOPT_SEG000,CALLOPT_CODE)
+#define tbcontrl_36 SEG_SEGCLASS(CALLOPT_SEG000,CALLOPT_CODE)
+#define fillctrl_07 SEG_SEGCLASS(CALLOPT_SEG000,CALLOPT_CODE)
+#define optpath_03 SEG_SEGCLASS(SLICES_SEG000,SLICES_CODE)
+#define optlingu_04 SEG_SEGCLASS(SLICES_SEG000,SLICES_CODE)
+#define pszctrl_02 SEG_SEGCLASS(SLICES_SEG001,SLICES_CODE)
+#define tbcontrl_3b SEG_SEGCLASS(SLICES_SEG001,SLICES_CODE)
+#define optgenrl_07 SEG_SEGCLASS(SLICES_SEG001,SLICES_CODE)
+#define optgenrl_0a SEG_SEGCLASS(SLICES_SEG002,SLICES_CODE)
+#define adritem_06 SEG_SEGCLASS(SLICES_SEG002,SLICES_CODE)
+#define adritem_29 SEG_SEGCLASS(SLICES_SEG002,SLICES_CODE)
+#define optgrid_11 SEG_SEGCLASS(SLICES_SEG002,SLICES_CODE)
+#define optgrid_13 SEG_SEGCLASS(SLICES_SEG002,SLICES_CODE)
+#define insctrl_02 SEG_SEGCLASS(SLICES_SEG002,SLICES_CODE)
+#define tbcontrl_4b SEG_SEGCLASS(SLICES_SEG002,SLICES_CODE)
+#define tbcontrl_50 SEG_SEGCLASS(SLICES_SEG002,SLICES_CODE)
+#define tbcontrl_55 SEG_SEGCLASS(SLICES_SEG002,SLICES_CODE)
+#define linectrl_02 SEG_SEGCLASS(SLICES_SEG003,SLICES_CODE)
+#define linectrl_07 SEG_SEGCLASS(SLICES_SEG003,SLICES_CODE)
+#define linectrl_0b SEG_SEGCLASS(SLICES_SEG003,SLICES_CODE)
+#define fillctrl_02 SEG_SEGCLASS(SLICES_SEG003,SLICES_CODE)
+#define itemwin_02 SEG_SEGCLASS(SLICES_SEG003,SLICES_CODE)
+#define itemwin_09 SEG_SEGCLASS(SLICES_SEG003,SLICES_CODE)
+#define itemwin_11 SEG_SEGCLASS(SLICES_SEG003,SLICES_CODE)
+#define itemwin_1a SEG_SEGCLASS(SLICES_SEG003,SLICES_CODE)
+#define itemwin_20 SEG_SEGCLASS(SLICES_SEG003,SLICES_CODE)
+#define layctrl_0a SEG_SEGCLASS(SLICES_SEG003,SLICES_CODE)
+#define layctrl_0e SEG_SEGCLASS(SLICES_SEG003,SLICES_CODE)
+#define fntctl_01 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define fntctl_02 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define fntctl_03 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define fntctl_04 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define fntctl_05 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define fntctl_06 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define fntctl_07 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define fntszctl_01 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define fntszctl_02 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define fntszctl_03 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define fntszctl_04 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define fntszctl_05 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optpath_05 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optpath_06 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optdict_01 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optdict_02 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optdict_03 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optdict_04 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optdict_05 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optdict_06 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optdict_07 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optdict_08 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optdict_09 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optdict_0a SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optdict_0b SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optitems_03 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optitems_05 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optitems_08 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optitems_09 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optitems_0a SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optitems_0c SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optitems_0d SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optitems_0e SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optspell_01 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optspell_02 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optspell_03 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optspell_04 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optspell_05 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optspell_06 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optspell_07 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optgenrl_05 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optgenrl_09 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define adritem_01 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define adritem_26 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define adritem_27 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define adritem_2a SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define opttypes_02 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optlingu_02 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optlingu_06 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optlingu_07 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optlingu_08 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optgrid_04 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optgrid_05 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optgrid_06 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optgrid_0b SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optgrid_0c SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optgrid_0d SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optgrid_0e SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optgrid_0f SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optgrid_10 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define optgrid_14 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define insctrl_04 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define insctrl_05 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define zoomctrl_01 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define zoomctrl_02 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define zoomctrl_06 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define zoomctrl_07 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define selctrl_03 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define selctrl_04 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define modctrl_03 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define tbcontrl_01 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define tbcontrl_03 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define tbcontrl_04 SEG_SEGCLASS(UNUSED_SEG000,UNUSED_CODE)
+#define tbcontrl_05 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_06 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_07 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_0b SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_0c SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_0d SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_0e SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_0f SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_10 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_14 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_15 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_16 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_17 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_18 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_19 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_1a SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_1b SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_1c SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_1d SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_1e SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_1f SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_20 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_21 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_22 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_23 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_24 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_25 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_26 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_27 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_28 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_29 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_2a SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_2b SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_2c SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_2d SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_2e SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_2f SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_30 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_31 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_32 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_33 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_34 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_4c SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_4d SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_51 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_52 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_56 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_57 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_5a SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_5b SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_5d SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_5e SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_60 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_61 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define tbcontrl_62 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define fillctrl_09 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define itemwin_03 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define itemwin_04 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define itemwin_05 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define itemwin_06 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define itemwin_07 SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define itemwin_0b SEG_SEGCLASS(UNUSED_SEG001,UNUSED_CODE)
+#define itemwin_0c SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define itemwin_0d SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define itemwin_0e SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define itemwin_0f SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define itemwin_13 SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define itemwin_14 SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define itemwin_15 SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define itemwin_16 SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define itemwin_17 SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define itemwin_18 SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define itemwin_1b SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define itemwin_1c SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define itemwin_1d SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define itemwin_1e SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define itemwin_21 SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define itemwin_22 SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define itemwin_23 SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define itemwin_24 SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define itemwin_25 SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define itemwin_26 SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define layctrl_01 SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define layctrl_02 SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define layctrl_03 SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define layctrl_04 SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define layctrl_05 SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define layctrl_06 SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define layctrl_07 SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define layctrl_08 SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define layctrl_0b SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define layctrl_0c SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define layctrl_0f SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
+#define layctrl_10 SEG_SEGCLASS(UNUSED_SEG002,UNUSED_CODE)
diff --git a/svx/inc/dialdll.hxx b/svx/inc/dialdll.hxx
new file mode 100644
index 000000000000..d76ff286eb9a
--- /dev/null
+++ b/svx/inc/dialdll.hxx
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_DIALDLL_HXX
+#define _SVX_DIALDLL_HXX
+
+// class SvxDialogDll ----------------------------------------------------
+
+class SvxDialogDll
+{
+public:
+ SvxDialogDll();
+ ~SvxDialogDll();
+
+ static void ResetResMgr();
+};
+
+#endif
+
diff --git a/svx/inc/dragmt3d.hxx b/svx/inc/dragmt3d.hxx
new file mode 100644
index 000000000000..a8560dbbb366
--- /dev/null
+++ b/svx/inc/dragmt3d.hxx
@@ -0,0 +1,153 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _E3D_DRAGMT3D_HXX
+#define _E3D_DRAGMT3D_HXX
+
+#include <svx/svddrgmt.hxx>
+#include <svx/view3d.hxx>
+#include <basegfx/polygon/b3dpolypolygon.hxx>
+#include <vcl/timer.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+
+class E3dScene;
+
+/*************************************************************************
+|*
+|* Parameter fuer Interaktion eines 3D-Objektes
+|*
+\************************************************************************/
+class E3dDragMethodUnit
+{
+public:
+ E3dObject* mp3DObj;
+ basegfx::B3DPolyPolygon maWireframePoly;
+ basegfx::B3DHomMatrix maDisplayTransform;
+ basegfx::B3DHomMatrix maInvDisplayTransform;
+ basegfx::B3DHomMatrix maInitTransform;
+ basegfx::B3DHomMatrix maTransform;
+ sal_Int32 mnStartAngle;
+ sal_Int32 mnLastAngle;
+
+ E3dDragMethodUnit()
+ : mp3DObj(0),
+ maWireframePoly(),
+ maDisplayTransform(),
+ maInvDisplayTransform(),
+ maInitTransform(),
+ maTransform(),
+ mnStartAngle(0),
+ mnLastAngle(0)
+ {}
+};
+
+/*************************************************************************
+|*
+|* Ableitung von SdrDragMethod fuer 3D-Objekte
+|*
+\************************************************************************/
+
+class E3dDragMethod : public SdrDragMethod
+{
+protected:
+ ::std::vector< E3dDragMethodUnit > maGrp;
+ E3dDragConstraint meConstraint;
+ Point maLastPos;
+ Rectangle maFullBound;
+ bool mbMoveFull;
+ bool mbMovedAtAll;
+
+public:
+ TYPEINFO();
+ E3dDragMethod(
+ SdrDragView &rView,
+ const SdrMarkList& rMark,
+ E3dDragConstraint eConstr = E3DDRAG_CONSTR_XYZ,
+ sal_Bool bFull = sal_False);
+
+ virtual void TakeSdrDragComment(String& rStr) const;
+ virtual bool BeginSdrDrag();
+ virtual void MoveSdrDrag(const Point& rPnt);
+ virtual void CancelSdrDrag();
+ virtual bool EndSdrDrag(bool bCopy);
+
+ E3dView& Get3DView() { return (E3dView&)getSdrDragView(); }
+
+ // for migration from XOR to overlay
+ virtual void CreateOverlayGeometry(::sdr::overlay::OverlayManager& rOverlayManager);
+};
+
+
+/*************************************************************************
+|*
+|* Ableitung von SdrDragMethod zum Drehen von 3D-Objekten
+|*
+\************************************************************************/
+
+class E3dDragRotate : public E3dDragMethod
+{
+ basegfx::B3DPoint maGlobalCenter;
+
+public:
+ TYPEINFO();
+ E3dDragRotate(
+ SdrDragView &rView,
+ const SdrMarkList& rMark,
+ E3dDragConstraint eConstr = E3DDRAG_CONSTR_XYZ,
+ sal_Bool bFull = sal_False);
+
+ virtual void MoveSdrDrag(const Point& rPnt);
+ virtual Pointer GetSdrDragPointer() const;
+};
+
+
+/*************************************************************************
+|*
+|* Ableitung von SdrDragMethod zum Verschieben von 3D-Subobjekten
+|*
+\************************************************************************/
+
+class E3dDragMove : public E3dDragMethod
+{
+ SdrHdlKind meWhatDragHdl;
+ Point maScaleFixPos;
+
+public:
+ TYPEINFO();
+ E3dDragMove(
+ SdrDragView &rView,
+ const SdrMarkList& rMark,
+ SdrHdlKind eDrgHdl = HDL_MOVE,
+ E3dDragConstraint eConstr = E3DDRAG_CONSTR_XYZ,
+ sal_Bool bFull = sal_False);
+
+ virtual void MoveSdrDrag(const Point& rPnt);
+ virtual Pointer GetSdrDragPointer() const;
+};
+
+
+#endif // _E3D_DRAGMT3D_HXX
diff --git a/svx/inc/drawuiks.hxx b/svx/inc/drawuiks.hxx
new file mode 100644
index 000000000000..19b7fe3cba97
--- /dev/null
+++ b/svx/inc/drawuiks.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SDUIKS_HXX
+#define _SDUIKS_HXX
+
+#include <usr/uiks.hxx>
+
+#define UIK_SHAPEFACTORY UIK_DRAWING(00)
+#define UIK_POLYGONFACTORY UIK_DRAWING(01)
+#define UIK_TEXTSHAPEFACTORY UIK_DRAWING(02)
+#define UIK_SNAPFACTORY UIK_DRAWING(03)
+
+#define UIK_DRAWPAGES UIK_DRAWING(10)
+#define UIK_DRAWPAGESUMMARIZER UIK_DRAWING(11)
+#define UIK_DRAWPAGEXPANDER UIK_DRAWING(12)
+
+#define UIK_XSHAPEDESCRIPTOR UIK_DRAWING(20)
+#define UIK_XSHAPE UIK_DRAWING(21)
+#define UIK_XSHAPECONNECTOR UIK_DRAWING(22)
+#define UIK_XCONNECTABLESHAPE UIK_DRAWING(23)
+#define UIK_XSHAPE3D UIK_DRAWING(24)
+#define UIK_XSHAPEGROUP UIK_DRAWING(25)
+#define UIK_XSHAPEMIRROR UIK_DRAWING(26)
+#define UIK_XSHAPEALIGNER UIK_DRAWING(27)
+#define UIK_XSHAPEARRANGER UIK_DRAWING(28)
+#define UIK_XCONVERTABLESHAPE UIK_DRAWING(29)
+#define UIK_XANIMATEDSHAPEFACTORY UIK_DRAWING(2a)
+
+#define UIK_DRAWPAGE UIK_DRAWING(30)
+#define UIK_SHAPES UIK_DRAWING(31)
+#define UIK_XSHAPEGROUPER UIK_DRAWING(35)
+#define UIK_XSHAPECOMBINER UIK_DRAWING(36)
+#define UIK_SHAPEBINDER UIK_DRAWING(37)
+#define UIK_DRAWLAYER UIK_DRAWING(38)
+
+#define SD_UIK_PRESENTATION UIK_DRAWING(40)
+#define SD_UIK_PRESENTATION_NAVIGATION UIK_DRAWING(41)
+#define SD_UIK_CUSTOM_PRESENTATION UIK_DRAWING(42)
+#define SD_UIK_CUSTOM_PRESENTATIONS UIK_DRAWING(43)
+//#define SD_UIK_CUSTOM_PRESENTATIONS UIK_DRAWING(44)
+
+#define SD_UIK_ZOOM UIK_DRAWING(50)
+#define SD_UIK_DRAW_VIEW UIK_DRAWING(51)
+#define SD_UIK_OUTLINE_VIEW UIK_DRAWING(52)
+#define SD_UIK_SLIDE_VIEW UIK_DRAWING(53)
+
+#define SD_UIK_PRESENTATION_STYLES UIK_DRAWING(60)
+
+#endif
diff --git a/svx/inc/extrusiondepthdialog.hxx b/svx/inc/extrusiondepthdialog.hxx
new file mode 100644
index 000000000000..600e646e8cb6
--- /dev/null
+++ b/svx/inc/extrusiondepthdialog.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_EXTRUSIONDEPTHDIALOG_HXX
+#define _SVX_EXTRUSIONDEPTHDIALOG_HXX
+
+#include "svx/svxdllapi.h"
+
+#include <vcl/fixed.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/field.hxx>
+
+namespace svx {
+
+class ExtrusionDepthDialog : public ModalDialog
+{
+ FixedText maFLDepth;
+ MetricField maMtrDepth;
+ OKButton maOKButton;
+ CancelButton maCancelButton;
+ HelpButton maHelpButton;
+
+ FieldUnit meDefaultUnit;
+
+public:
+ ExtrusionDepthDialog( Window* pParent, double fDepth, FieldUnit eDefaultUnit );
+ ~ExtrusionDepthDialog();
+
+ double getDepth() const;
+};
+
+}
+
+#endif // _SVX_EXTRUSIONDEPTHDIALOG_HXX
+
diff --git a/svx/inc/float3d.hrc b/svx/inc/float3d.hrc
new file mode 100644
index 000000000000..259317275e8b
--- /dev/null
+++ b/svx/inc/float3d.hrc
@@ -0,0 +1,184 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <svx/dialogs.hrc>
+
+//#define FLT_WIN_3D 827
+
+#define BTN_GEO 2
+#define BTN_REPRESENTATION 3
+#define BTN_LIGHT 4
+#define BTN_TEXTURE 5
+#define BTN_MATERIAL 6
+#define BTN_UPDATE 7
+#define BTN_ASSIGN 8
+
+// Unterer Teil
+#define BTN_PERSPECTIVE 9
+#define BTN_CHANGE_TO_3D 10
+#define BTN_LATHE_OBJ 11
+#define CTL_PREVIEW 12
+#define CTL_LIGHT_PREVIEW 13
+
+// Geometrie
+#define FT_HORIZONTAL 24
+#define NUM_HORIZONTAL 25
+#define FT_VERTICAL 26
+#define NUM_VERTICAL 27
+#define FL_SEGMENTS 28
+#define FT_PERCENT_DIAGONAL 29
+#define MTR_PERCENT_DIAGONAL 30
+#define FT_BACKSCALE 31
+#define MTR_BACKSCALE 32
+#define FT_END_ANGLE 33
+#define MTR_END_ANGLE 34
+#define FT_DEPTH 35
+#define MTR_DEPTH 36
+#define FL_GEOMETRIE 37
+
+#define BTN_NORMALS_OBJ 38
+#define BTN_NORMALS_FLAT 39
+#define BTN_NORMALS_SPHERE 40
+#define BTN_TWO_SIDED_LIGHTING 41
+#define BTN_NORMALS_INVERT 42
+#define FL_NORMALS 43
+
+#define BTN_DOUBLE_SIDED 44
+
+// Darstellung
+#define FT_SHADEMODE 45
+#define LB_SHADEMODE 46
+#define BTN_SHADOW_3D 47
+#define FT_SLANT 48
+#define MTR_SLANT 49
+#define FL_SHADOW 50
+#define FT_DISTANCE 51
+#define MTR_DISTANCE 52
+#define FT_FOCAL_LENGTH 53
+#define MTR_FOCAL_LENGTH 54
+#define FL_CAMERA 55
+#define FL_REPRESENTATION 56
+
+// Beleuchtung
+#define BTN_LIGHT_1 60
+#define BTN_LIGHT_2 61
+#define BTN_LIGHT_3 62
+#define BTN_LIGHT_4 63
+#define BTN_LIGHT_5 64
+#define BTN_LIGHT_6 65
+#define BTN_LIGHT_7 66
+#define BTN_LIGHT_8 67
+#define LB_LIGHT_1 68
+#define LB_LIGHT_2 69
+#define LB_LIGHT_3 70
+#define LB_LIGHT_4 71
+#define LB_LIGHT_5 72
+#define LB_LIGHT_6 73
+#define LB_LIGHT_7 74
+#define LB_LIGHT_8 75
+#define BTN_LIGHT_COLOR 76
+#define FT_LIGHTSOURCE 77
+#define LB_AMBIENTLIGHT 78
+#define BTN_AMBIENT_COLOR 79
+#define FT_AMBIENTLIGHT 80
+#define FL_LIGHT 81
+
+// Texturen
+#define FT_TEX_KIND 90
+#define BTN_TEX_LUMINANCE 91
+#define BTN_TEX_COLOR 92
+#define FT_TEX_MODE 93
+#define BTN_TEX_REPLACE 94
+#define BTN_TEX_MODULATE 95
+#define BTN_TEX_BLEND 96
+#define FT_TEX_PROJECTION_X 97
+#define BTN_TEX_PARALLEL_X 98
+#define BTN_TEX_CIRCLE_X 99
+#define BTN_TEX_OBJECT_X 100
+#define FT_TEX_PROJECTION_Y 101
+#define BTN_TEX_PARALLEL_Y 102
+#define BTN_TEX_CIRCLE_Y 103
+#define BTN_TEX_OBJECT_Y 104
+#define FT_TEX_FILTER 105
+#define BTN_TEX_FILTER 106
+#define FL_TEXTURE 107
+
+// Material
+//#define CTL_MATERIAL 110
+#define FL_MATERIAL 111
+
+#define FT_MAT_COLOR 112
+#define LB_MAT_COLOR 113
+#define BTN_MAT_COLOR 114
+#define FT_MAT_EMISSION 115
+#define LB_MAT_EMISSION 116
+#define BTN_EMISSION_COLOR 117
+#define FT_MAT_SPECULAR 118
+#define LB_MAT_SPECULAR 119
+#define BTN_SPECULAR_COLOR 120
+#define FT_MAT_SPECULAR_INTENSITY 121
+#define MTR_MAT_SPECULAR_INTENSITY 122
+#define FL_MAT_SPECULAR 123
+#define FT_MAT_FAVORITES 124
+#define LB_MAT_FAVORITES 125
+
+
+//#define BTN_MAT_FAVORITES 125
+//#define BTN_MAT_EDITOR 126
+
+
+// high contrast
+#define BMP_GEO_H 130
+#define BMP_REPRESENTATION_H 131
+#define BMP_LIGHT_H 132
+#define BMP_TEXTURE_H 133
+#define BMP_MATERIAL_H 134
+#define BMP_UPDATE_H 135
+#define BMP_ASSIGN_H 136
+#define BMP_CHANGE_TO_3D_H 137
+#define BMP_LATHE_OBJ_H 138
+#define BMP_PERSPECTIVE_H 139
+#define BMP_NORMALS_OBJ_H 142
+#define BMP_NORMALS_FLAT_H 143
+#define BMP_NORMALS_SPHERE_H 144
+#define BMP_NORMALS_INVERT_H 145
+#define BMP_TWO_SIDED_LIGHTING_H 146
+#define BMP_DOUBLE_SIDED_H 147
+#define BMP_SHADOW_3D_H 148
+#define BMP_3DLIGHT_H 149
+#define BMP_LIGHT_COLOR_H 150
+#define BMP_AMBIENT_COLOR_H 151
+#define BMP_TEX_LUMINANCE_H 152
+#define BMP_TEX_COLOR_H 153
+#define BMP_TEX_REPLACE_H 154
+#define BMP_TEX_MODULATE_H 155
+#define BMP_TEX_BLEND_H 156
+#define BMP_TEX_OBJECT_H 157
+#define BMP_TEX_PARALLEL_H 158
+#define BMP_TEX_CIRCLE_H 159
+#define BMP_TEX_FILTER_H 160
+#define BMP_COLORDLG_H 161
+
diff --git a/svx/inc/fmhelp.hrc b/svx/inc/fmhelp.hrc
new file mode 100644
index 000000000000..7230df0c6da6
--- /dev/null
+++ b/svx/inc/fmhelp.hrc
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FMHELP_HRC
+#define _SVX_FMHELP_HRC
+
+// Help-Ids --------------------------------------------------------------
+#define HID_DLG_DBMSG "SVX_HID_DLG_DBMSG"
+#define HID_FORM_NAVIGATOR "SVX_HID_FORM_NAVIGATOR"
+#define HID_FORM_NAVIGATOR_WIN "SVX_HID_FORM_NAVIGATOR_WIN"
+#define HID_FIELD_SEL "SVX_HID_FIELD_SEL"
+#define HID_FIELD_SEL_WIN "SVX_HID_FIELD_SEL_WIN"
+#define HID_FILTER_NAVIGATOR "SVX_HID_FILTER_NAVIGATOR"
+#define HID_FILTER_NAVIGATOR_WIN "SVX_HID_FILTER_NAVIGATOR_WIN"
+#define HID_FM_DLG_SEARCH "SVX_HID_FM_DLG_SEARCH"
+#define HID_SEARCH_TEXT "SVX_HID_SEARCH_TEXT"
+#define HID_SEARCH_ALLFIELDS "SVX_HID_SEARCH_ALLFIELDS"
+#define HID_SEARCH_FIELDSELECTION "SVX_HID_SEARCH_FIELDSELECTION"
+#define HID_SEARCH_POSITION "SVX_HID_SEARCH_POSITION"
+#define HID_SEARCH_FORMATTER "SVX_HID_SEARCH_FORMATTER"
+#define HID_SEARCH_CASE "SVX_HID_SEARCH_CASE"
+#define HID_SEARCH_BACKWARD "SVX_HID_SEARCH_BACKWARD"
+#define HID_SEARCH_STARTOVER "SVX_HID_SEARCH_STARTOVER"
+#define HID_SEARCH_WILDCARD "SVX_HID_SEARCH_WILDCARD"
+#define HID_SEARCH_REGULAR "SVX_HID_SEARCH_REGULAR"
+#define HID_SEARCH_APPROX "SVX_HID_SEARCH_APPROX"
+#define HID_SEARCH_APPROXSETTINGS "SVX_HID_SEARCH_APPROXSETTINGS"
+#define HID_SEARCH_BTN_SEARCH "SVX_HID_SEARCH_BTN_SEARCH"
+#define HID_SEARCH_BTN_CLOSE "SVX_HID_SEARCH_BTN_CLOSE"
+#define HID_CONTROLS_DATE_N_TIME "SVX_HID_CONTROLS_DATE_N_TIME"
+#define HID_GRID_TRAVEL_FIRST "SVX_HID_GRID_TRAVEL_FIRST"
+#define HID_GRID_TRAVEL_PREV "SVX_HID_GRID_TRAVEL_PREV"
+#define HID_GRID_TRAVEL_NEXT "SVX_HID_GRID_TRAVEL_NEXT"
+#define HID_GRID_TRAVEL_LAST "SVX_HID_GRID_TRAVEL_LAST"
+#define HID_GRID_TRAVEL_NEW "SVX_HID_GRID_TRAVEL_NEW"
+#define HID_GRID_TRAVEL_ABSOLUTE "SVX_HID_GRID_TRAVEL_ABSOLUTE"
+#define HID_GRID_NUMBEROFRECORDS "SVX_HID_GRID_NUMBEROFRECORDS"
+#define UID_SEARCH_RECORDSTATUS "SVX_UID_SEARCH_RECORDSTATUS"
+#define UID_FORMPROPBROWSER_FRAME "SVX_UID_FORMPROPBROWSER_FRAME"
+#define UID_ABSOLUTE_RECORD_WINDOW "SVX_UID_ABSOLUTE_RECORD_WINDOW"
+#define HID_DATA_NAVIGATOR_WIN "SVX_HID_DATA_NAVIGATOR_WIN"
+#define HID_XFORMS_ADDDATAITEM_DLG "SVX_HID_XFORMS_ADDDATAITEM_DLG"
+#define HID_XFORMS_ADDCONDITION_DLG "SVX_HID_XFORMS_ADDCONDITION_DLG"
+#define HID_XFORMS_NAMESPACEITEM_DLG "SVX_HID_XFORMS_NAMESPACEITEM_DLG"
+#define HID_XFORMS_NAMESPACEITEM_LIST "SVX_HID_XFORMS_NAMESPACEITEM_LIST"
+#define HID_XFORMS_MANAGENAMESPACE_DLG "SVX_HID_XFORMS_MANAGENAMESPACE_DLG"
+#define HID_MN_XFORMS_MODELS_ADD "SVX_HID_MN_XFORMS_MODELS_ADD"
+#define HID_MN_XFORMS_MODELS_EDIT "SVX_HID_MN_XFORMS_MODELS_EDIT"
+#define HID_MN_XFORMS_MODELS_REMOVE "SVX_HID_MN_XFORMS_MODELS_REMOVE"
+#define HID_MN_XFORMS_INSTANCES_ADD "SVX_HID_MN_XFORMS_INSTANCES_ADD"
+#define HID_MN_XFORMS_INSTANCES_EDIT "SVX_HID_MN_XFORMS_INSTANCES_EDIT"
+#define HID_MN_XFORMS_INSTANCES_REMOVE "SVX_HID_MN_XFORMS_INSTANCES_REMOVE"
+#define HID_MN_XFORMS_SHOW_DETAILS "SVX_HID_MN_XFORMS_SHOW_DETAILS"
+#define HID_XFORMS_TOOLBOX "SVX_HID_XFORMS_TOOLBOX"
+#define HID_XFORMS_TOOLBOX_ITEM_ADD "SVX_HID_XFORMS_TOOLBOX_ITEM_ADD"
+#define HID_XFORMS_TOOLBOX_ITEM_ADD_ELEMENT "SVX_HID_XFORMS_TOOLBOX_ITEM_ADD_ELEMENT"
+#define HID_XFORMS_TOOLBOX_ITEM_ADD_ATTRIBUTE "SVX_HID_XFORMS_TOOLBOX_ITEM_ADD_ATTRIBUTE"
+#define HID_XFORMS_TOOLBOX_ITEM_EDIT "SVX_HID_XFORMS_TOOLBOX_ITEM_EDIT"
+#define HID_XFORMS_TOOLBOX_ITEM_REMOVE "SVX_HID_XFORMS_TOOLBOX_ITEM_REMOVE"
+#define HID_XFORMS_ITEMS_LIST "SVX_HID_XFORMS_ITEMS_LIST"
+#define HID_XFORMS_MODELS_LIST "SVX_HID_XFORMS_MODELS_LIST"
+#define HID_XFORMS_MODELS_MENUBTN "SVX_HID_XFORMS_MODELS_MENUBTN"
+#define HID_XFORMS_INSTANCES_MENUBTN "SVX_HID_XFORMS_INSTANCES_MENUBTN"
+#define HID_XFORMS_ADDSUBMISSION_DLG "SVX_HID_XFORMS_ADDSUBMISSION_DLG"
+#define HID_XFORMS_ADDMODEL_DLG "SVX_HID_XFORMS_ADDMODEL_DLG"
+#define HID_XFORMS_ADDINSTANCE_DLG "SVX_HID_XFORMS_ADDINSTANCE_DLG"
+#define HID_XFORMS_MID_INSERT_CONTROL "SVX_HID_XFORMS_MID_INSERT_CONTROL"
+#define HID_XFORMS_TAB_CONTROL "SVX_HID_XFORMS_TAB_CONTROL"
+#define HID_FM_DELETEROWS "SVX_HID_FM_DELETEROWS"
+#define HID_FM_INSERTCOL "SVX_HID_FM_INSERTCOL"
+#define HID_FM_CHANGECOL "SVX_HID_FM_CHANGECOL"
+#define HID_FM_DELETECOL "SVX_HID_FM_DELETECOL"
+#define HID_FM_HIDECOL "SVX_HID_FM_HIDECOL"
+#define HID_FM_SHOWCOLS "SVX_HID_FM_SHOWCOLS"
+#define HID_FM_SHOWCOLS_MORE "SVX_HID_FM_SHOWCOLS_MORE"
+#define HID_FM_SHOWALLCOLS "SVX_HID_FM_SHOWALLCOLS"
+#define HID_FM_DELETE "SVX_HID_FM_DELETE"
+#define HID_FM_FILTER_EDIT "SVX_HID_FM_EDIT"
+#define HID_FM_FILTER_IS_NULL "SVX_HID_FM_FILTER_IS_NULL"
+#define HID_FM_FILTER_IS_NOT_NULL "SVX_HID_FM_IS_NOT_NULL"
+#define HID_FM_NEW "SVX_HID_FM_NEW"
+#define HID_FM_NEW_FORM "SVX_HID_FM_NEW_FORM"
+#define HID_FM_NEW_HIDDEN "SVX_HID_FM_NEW_HIDDEN"
+#define HID_FM_RENAME_OBJECT "SVX_HID_FM_RENAME_OBJECT"
+#define HID_MENU_FM_TEXTATTRIBUTES_STYLE "SVX_HID_MENU_FM_TEXTATTRIBUTES_STYLE"
+#define HID_MENU_FM_TEXTATTRIBUTES_ALIGNMENT "SVX_HID_MENU_FM_TEXTATTRIBUTES_ALIGNMENT"
+#define HID_MENU_FM_TEXTATTRIBUTES_SPACING "SVX_HID_MENU_FM_TEXTATTRIBUTES_SPACING"
+
+#endif
+
diff --git a/svx/inc/fontworkgallery.hrc b/svx/inc/fontworkgallery.hrc
new file mode 100644
index 000000000000..e03c04d0f1ca
--- /dev/null
+++ b/svx/inc/fontworkgallery.hrc
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <svx/dialogs.hrc>
+
+#define FL_FAVORITES 1
+#define CTL_FAVORITES 2
+#define BTN_OK 3
+#define BTN_CANCEL 4
+#define MF_VALUE 7
+#define FT_VALUE 8
+#define BTN_HELP 9
+
+#define STR_CLICK_TO_ADD_TEXT 1
+
+
+#define STR_ALIGN_LEFT 1
+#define STR_ALIGN_CENTER 2
+#define STR_ALIGN_RIGHT 3
+#define STR_ALIGN_WORD 4
+#define STR_ALIGN_STRETCH 5
+#define STR_CHARS_SPACING_VERY_TIGHT 6
+#define STR_CHARS_SPACING_TIGHT 7
+#define STR_CHARS_SPACING_NORMAL 8
+#define STR_CHARS_SPACING_LOOSE 9
+#define STR_CHARS_SPACING_VERY_LOOSE 10
+#define STR_CHARS_SPACING_CUSTOM 11
+#define STR_CHARS_SPACING_KERN_PAIRS 12
+
+#define IMG_FONTWORK_ALIGN_LEFT_16 1
+#define IMG_FONTWORK_ALIGN_LEFT_16_H 2
+#define IMG_FONTWORK_ALIGN_LEFT_26 3
+#define IMG_FONTWORK_ALIGN_LEFT_26_H 4
+#define IMG_FONTWORK_ALIGN_CENTER_16 5
+#define IMG_FONTWORK_ALIGN_CENTER_16_H 6
+#define IMG_FONTWORK_ALIGN_CENTER_26 7
+#define IMG_FONTWORK_ALIGN_CENTER_26_H 8
+#define IMG_FONTWORK_ALIGN_RIGHT_16 9
+#define IMG_FONTWORK_ALIGN_RIGHT_16_H 10
+#define IMG_FONTWORK_ALIGN_RIGHT_26 11
+#define IMG_FONTWORK_ALIGN_RIGHT_26_H 12
+#define IMG_FONTWORK_ALIGN_WORD_16 13
+#define IMG_FONTWORK_ALIGN_WORD_16_H 14
+#define IMG_FONTWORK_ALIGN_WORD_26 15
+#define IMG_FONTWORK_ALIGN_WORD_26_H 16
+#define IMG_FONTWORK_ALIGN_STRETCH_16 17
+#define IMG_FONTWORK_ALIGN_STRETCH_16_H 18
+#define IMG_FONTWORK_ALIGN_STRETCH_26 19
+#define IMG_FONTWORK_ALIGN_STRETCH_26_H 20
diff --git a/svx/inc/galbrws2.hxx b/svx/inc/galbrws2.hxx
new file mode 100644
index 000000000000..8e5ca04c6173
--- /dev/null
+++ b/svx/inc/galbrws2.hxx
@@ -0,0 +1,181 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_GALBRWS2_HXX_
+#define _SVX_GALBRWS2_HXX_
+
+#include <vcl/lstbox.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/timer.hxx>
+#include <vcl/toolbox.hxx>
+#include <svtools/transfer.hxx>
+#include <svl/lstner.hxx>
+#include <svtools/miscopt.hxx>
+#include "svx/galbrws.hxx"
+
+// ----------------------
+// - GalleryBrowserMode -
+// ----------------------
+
+enum GalleryBrowserMode
+{
+ GALLERYBROWSERMODE_NONE = 0,
+ GALLERYBROWSERMODE_ICON = 1,
+ GALLERYBROWSERMODE_LIST = 2,
+ GALLERYBROWSERMODE_PREVIEW = 3
+};
+
+// -----------------
+// - GalleryTravel -
+// -----------------
+
+enum GalleryBrowserTravel
+{
+ GALLERYBROWSERTRAVEL_CURRENT = 0,
+ GALLERYBROWSERTRAVEL_FIRST = 1,
+ GALLERYBROWSERTRAVEL_LAST = 2,
+ GALLERYBROWSERTRAVEL_PREVIOUS = 3,
+ GALLERYBROWSERTRAVEL_NEXT = 4
+};
+
+// ------------------------
+// - GalleryItemTextFlags -
+// ------------------------
+
+#define GALLERY_ITEM_THEMENAME 0x00000001
+#define GALLERY_ITEM_TITLE 0x00000002
+#define GALLERY_ITEM_PATH 0x00000004
+
+// ------------------
+// - GalleryToolBox -
+// ------------------
+
+class GalleryToolBox : public ToolBox
+{
+private:
+
+ virtual void KeyInput( const KeyEvent& rKEvt );
+
+public:
+
+ GalleryToolBox( GalleryBrowser2* pParent );
+ ~GalleryToolBox();
+};
+
+// -------------------
+// - GalleryBrowser2 -
+// -------------------
+
+class Gallery;
+class GalleryTheme;
+class GalleryIconView;
+class GalleryListView;
+class GalleryPreview;
+class Menu;
+class SgaObject;
+
+class GalleryBrowser2 : public Control, public SfxListener
+{
+ friend class GalleryBrowser;
+ using Control::Notify;
+ using Window::KeyInput;
+
+private:
+
+ SvtMiscOptions maMiscOptions;
+ Gallery* mpGallery;
+ GalleryTheme* mpCurTheme;
+ GalleryIconView* mpIconView;
+ GalleryListView* mpListView;
+ GalleryPreview* mpPreview;
+ GalleryToolBox maViewBox;
+ FixedLine maSeparator;
+ FixedText maInfoBar;
+ Point maDragStartPos;
+ sal_uIntPtr mnCurActionPos;
+ GalleryBrowserMode meMode;
+ GalleryBrowserMode meLastMode;
+ sal_Bool mbCurActionIsLinkage;
+
+ void InitSettings();
+
+ void ImplUpdateViews( sal_uInt16 nSelectionId );
+ void ImplUpdateInfoBar();
+ sal_uIntPtr ImplGetSelectedItemId( const Point* pSelPosPixel, Point& rSelPos );
+ void ImplSelectItemId( sal_uIntPtr nItemId );
+ void ImplExecute( sal_uInt16 nId );
+
+ // Control
+ virtual void Resize();
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ // SfxListener
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ DECL_LINK( MenuSelectHdl, Menu* pMenu );
+ DECL_LINK( SelectObjectHdl, void* );
+ DECL_LINK( SelectTbxHdl, ToolBox* );
+ DECL_LINK( MiscHdl, void* );
+
+private:
+
+ static GalleryBrowserMode meInitMode;
+
+public:
+
+ static String GetItemText( const GalleryTheme& rTheme, const SgaObject& rObj, sal_uIntPtr nItemTextFlags );
+
+public:
+
+ GalleryBrowser2( GalleryBrowser* pParent, const ResId& rResId, Gallery* pGallery );
+ ~GalleryBrowser2();
+
+ void SelectTheme( const String& rThemeName );
+
+ GalleryBrowserMode GetMode() const { return meMode; }
+ void SetMode( GalleryBrowserMode eMode );
+
+ Window* GetViewWindow() const;
+
+ void Travel( GalleryBrowserTravel eTravel );
+
+ INetURLObject GetURL() const;
+ String GetFilterName() const;
+ Graphic GetGraphic() const;
+ sal_Bool GetVCDrawModel( FmFormModel& rModel ) const;
+ sal_Bool IsLinkage() const;
+
+ sal_Int8 AcceptDrop( DropTargetHelper& rTarget, const AcceptDropEvent& rEvt );
+ sal_Int8 ExecuteDrop( DropTargetHelper& rTarget, const ExecuteDropEvent& rEvt );
+ void StartDrag( Window* pWindow, const Point* pDragPoint = NULL );
+ void TogglePreview( Window* pWindow, const Point* pPreviewPoint = NULL );
+ void ShowContextMenu( Window* pWindow, const Point* pContextPoint = NULL );
+ sal_Bool KeyInput( const KeyEvent& rEvt, Window* pWindow );
+};
+
+#endif
diff --git a/svx/inc/gallery.hrc b/svx/inc/gallery.hrc
new file mode 100644
index 000000000000..852b1f14c7de
--- /dev/null
+++ b/svx/inc/gallery.hrc
@@ -0,0 +1,212 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_DIALOGS_HRC
+#include <svx/dialogs.hrc>
+#endif
+#include "galtheme.hrc"
+
+// -----------
+// - Defines -
+// -----------
+
+// Dialoge
+#define RID_SVXDLG_GALLERYBROWSER (RID_SVX_GALLERY_START + 5)
+
+// Gallery-Strings
+#define RID_SVXSTR_EXTFORMAT1_SYS (RID_SVX_GALLERY_START + 15)
+#define RID_SVXSTR_EXTFORMAT1_UI (RID_SVX_GALLERY_START + 16)
+#define RID_SVXSTR_EXTFORMAT2_SYS (RID_SVX_GALLERY_START + 17)
+#define RID_SVXSTR_EXTFORMAT2_UI (RID_SVX_GALLERY_START + 18)
+#define RID_SVXSTR_EXTFORMAT3_SYS (RID_SVX_GALLERY_START + 19)
+#define RID_SVXSTR_EXTFORMAT3_UI (RID_SVX_GALLERY_START + 20)
+#define RID_SVXSTR_EXTFORMAT4_SYS (RID_SVX_GALLERY_START + 21)
+#define RID_SVXSTR_EXTFORMAT4_UI (RID_SVX_GALLERY_START + 22)
+#define RID_SVXSTR_EXTFORMAT5_SYS (RID_SVX_GALLERY_START + 23)
+#define RID_SVXSTR_EXTFORMAT5_UI (RID_SVX_GALLERY_START + 24)
+#define RID_SVXSTR_GALLERY_FOPENERROR (RID_SVX_GALLERY_START + 11)
+#define RID_SVXSTR_GALLERY_NOTHEME (RID_SVX_GALLERY_START + 13)
+#define RID_SVXSTR_GALLERY_DELETEOBJ (RID_SVX_GALLERY_START + 14)
+#define RID_SVXSTR_GALLERY_ACTUALIZE_PROGRESS (RID_SVX_GALLERY_START + 25)
+#define RID_SVXSTR_GALLERY_FILTER (RID_SVX_GALLERY_START + 26)
+#define RID_SVXSTR_GALLERY_LENGTH (RID_SVX_GALLERY_START + 27)
+#define RID_SVXSTR_GALLERY_SIZE (RID_SVX_GALLERY_START + 28)
+#define RID_SVXSTR_GALLERY_DELETEDD (RID_SVX_GALLERY_START + 29)
+#define RID_SVXSTR_GALLERY_SGIERROR (RID_SVX_GALLERY_START + 31)
+#define RID_SVXSTR_GALLERY_NEWTHEME (RID_SVX_GALLERY_START + 32)
+#define RID_SVXSTR_GALLERY_BROWSER (RID_SVX_GALLERY_START + 33)
+#define RID_SVXSTR_GALLERY_THEMEERR (RID_SVX_GALLERY_START + 34)
+#define RID_SVXSTR_GALLERY_IMPORTTHEME (RID_SVX_GALLERY_START + 41)
+#define RID_SVXSTR_GALLERY_CREATETHEME (RID_SVX_GALLERY_START + 42)
+#define RID_SVXSTR_GALLERY_DIALOGID (RID_SVX_GALLERY_START + 80)
+#define RID_SVXSTR_GALLERY_DELETETHEME (RID_SVX_GALLERY_START + 83)
+#define RID_SVXSTR_GALLERY_TITLE (RID_SVX_GALLERY_START + 84)
+#define RID_SVXSTR_GALLERY_PATH (RID_SVX_GALLERY_START + 85)
+#define RID_SVXSTR_GALLERY_ICONVIEW (RID_SVX_GALLERY_START + 86)
+#define RID_SVXSTR_GALLERY_LISTVIEW (RID_SVX_GALLERY_START + 87)
+
+// Controls fuer Gallery
+#define RID_SVXMN_GALLERY1 (RID_SVX_GALLERY_START + 36)
+#define RID_SVXMN_GALLERY2 (RID_SVX_GALLERY_START + 37)
+
+// Images
+#define RID_SVXBMP_GALLERY (RID_SVX_GALLERY_START + 46)
+#define RID_SVXBMP_THEME (RID_SVX_GALLERY_START + 47)
+#define RID_SVXBMP_THEME_NORMAL (RID_SVX_GALLERY_START + 48)
+#define RID_SVXBMP_THEME_IMPORTED (RID_SVX_GALLERY_START + 50)
+#define RID_SVXBMP_THEME_READONLY (RID_SVX_GALLERY_START + 52)
+#define RID_SVXBMP_THEME_DEFAULT (RID_SVX_GALLERY_START + 54)
+#define RID_SVXIMG_GALLERY_VIEW_ICON (RID_SVX_GALLERY_START + 56)
+#define RID_SVXIMG_GALLERY_VIEW_LIST (RID_SVX_GALLERY_START + 57)
+#define RID_SVXIMG_GALLERY_VIEW_ICON_HC (RID_SVX_GALLERY_START + 58)
+#define RID_SVXIMG_GALLERY_VIEW_LIST_HC (RID_SVX_GALLERY_START + 59)
+
+// Gallery-Bitmaps fuer Sounds
+#define RID_SVXBMP_GALLERY_SOUND_0 (RID_SVX_GALLERY_START + 61)
+#define RID_SVXBMP_GALLERY_SOUND_1 (RID_SVX_GALLERY_START + 62)
+#define RID_SVXBMP_GALLERY_SOUND_2 (RID_SVX_GALLERY_START + 63)
+#define RID_SVXBMP_GALLERY_SOUND_3 (RID_SVX_GALLERY_START + 64)
+#define RID_SVXBMP_GALLERY_SOUND_4 (RID_SVX_GALLERY_START + 65)
+#define RID_SVXBMP_GALLERY_SOUND_5 (RID_SVX_GALLERY_START + 66)
+#define RID_SVXBMP_GALLERY_SOUND_6 (RID_SVX_GALLERY_START + 67)
+#define RID_SVXBMP_GALLERY_SOUND_7 (RID_SVX_GALLERY_START + 68)
+#define RID_SVXBMP_GALLERY_MEDIA (RID_SVX_GALLERY_START + 71)
+
+// lokale Defines
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+
+#define CTL_GALLERY 1
+#define FL_THEMELIST 2
+#define LBX_THEMELIST 1
+#define FL_INFO 1
+#define FT_SIZE 1
+#define FT_DEPTH 2
+#define FT_MEMSIZE 3
+#define FT_FORMAT 4
+#define FT_CLIPART 5
+#define FT_BMPSIZE 6
+#define FT_BMPDEPTH 7
+#define FT_BMPMEM 8
+#define FT_BMPFORMAT 9
+#define BTN_BROWSER 1
+#define FL_THEME 1
+#define FL_PATH 4
+#define FL_FOUND 2
+#define FL_THEMEFILES 3
+#define EDT_PATH 1
+#define EDT_FILETYPE 1
+#define LBX_FOUND 1
+#define LBX_THEMEFILES 2
+#define BTN_TAKE 5
+#define BTN_CLEAR 6
+#define BTN_NEWTHEME 2
+#define BTN_IMPORT 5
+#define BTN_CLEARTHEME 3
+#define BTN_RENAMETHEME 7
+#define BTN_PATH 1
+#define BTN_SEARCH 4
+#define CBX_SUBDIRS 1
+#define CBX_TAKEALL 2
+#define CBX_PREVIEW 3
+#define CBX_CLEARALL 3
+#define FT_PATH 1
+#define FT_FILETYPE 2
+#define CBB_FILETYPE 1
+#define BTN_CLEARTHEMEFILE 6
+#define CTL_BROWSER 1
+#define FL_BROWSER 1
+#define FL_DRIVES 2
+#define LBX_DRIVE 1
+#define EDT_NEWTHEME 1
+#define FL_SEARCH_DIR 1
+#define FL_SEARCH_TYPE 2
+#define FT_SEARCH_DIR 1
+#define FT_SEARCH_TYPE 2
+#define FL_TAKE_PROGRESS 1
+#define FT_TAKE_FILE 1
+#define EDT_RENAMETHEME 1
+#define BTN_ADD 2
+#define CBX_LINKAGE 1
+#define WND_PREVIEW 1
+#define FT_FOUND 1
+#define BTN_TAKEALL 1
+#define BTN_PREVIEW 6
+#define WND_BRSPRV 1
+#define BTN_THEME 2
+#define BTN_RECOVER 3
+#define BTN_CLOSEBROWSER 7
+#define LBX_THEME2 1
+#define FL_THEME2 1
+#define BTN_NEWTHEME2 1
+#define BTN_RENAMETHEME2 3
+#define BTN_CLEARTHEME2 2
+#define BTN_CLOSETHEME 4
+#define MN_ADDMENU 2
+#define MN_ADD 6
+#define MN_ADD_LINK 8
+#define MN_PREVIEW 10
+#define MN_DELETE 12
+#define MN_BACKGROUND 14
+#define MN_TITLE 15
+#define MN_COPYCLIPBOARD 16
+#define MN_PASTECLIPBOARD 17
+
+#define MN_NEWTHEME 20
+#define MN_ACTUALIZE 21
+#define MN_RENAME 22
+#define MN_PROPERTIES 23
+#define MN_ASSIGN_ID 24
+
+#define FL_ACTUALIZE_PROGRESS 1
+#define FT_ACTUALIZE_FILE 1
+#define FL_ID 1
+#define MTF_ID 1
+#define LB_RESNAME 1
+#define BTN_RESNAME 1
+#define EDT_TITLE 20
+#define FL_TITLE 21
+
+// Gallery-TabDialog
+#define FI_MS_IMAGE 1
+#define FT_MS_NAME 1
+#define EDT_MS_NAME 1
+#define FL_MS_GENERAL_FIRST 1
+#define FT_MS_TYPE 2
+#define FT_MS_SHOW_TYPE 3
+#define FT_MS_PATH 4
+#define FT_MS_SHOW_PATH 5
+#define FT_MS_CONTENT 6
+#define FT_MS_SHOW_CONTENT 7
+#define FL_MS_GENERAL_SECOND 2
+#define FT_MS_CHANGEDATE 10
+#define FT_MS_SHOW_CHANGEDATE 11
+
+// Gallery Browser
+#define GALLERY_BROWSER1 1
+#define GALLERY_BROWSER2 2
+#define GALLERY_SPLITTER 1
diff --git a/svx/inc/galobj.hxx b/svx/inc/galobj.hxx
new file mode 100644
index 000000000000..2f558c8679ce
--- /dev/null
+++ b/svx/inc/galobj.hxx
@@ -0,0 +1,238 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_GALOBJ_HXX_
+#define _SVX_GALOBJ_HXX_
+
+#include <tools/urlobj.hxx>
+#include <vcl/graph.hxx>
+#include "svx/galmisc.hxx"
+
+// -----------
+// - Defines -
+// -----------
+
+#define S_THUMB 80
+
+// -----------------------------------------------------------------------------
+
+#define SGA_FORMAT_NONE 0x00000000L
+#define SGA_FORMAT_STRING 0x00000001L
+#define SGA_FORMAT_GRAPHIC 0x00000010L
+#define SGA_FORMAT_SOUND 0x00000100L
+#define SGA_FORMAT_OLE 0x00001000L
+#define SGA_FORMAT_SVDRAW 0x00010000L
+#define SGA_FORMAT_ALL 0xFFFFFFFFL
+
+// ----------------
+// - GalSoundType -
+// ----------------
+
+enum GalSoundType
+{
+ SOUND_STANDARD = 0,
+ SOUND_COMPUTER = 1,
+ SOUND_MISC = 2,
+ SOUND_MUSIC = 3,
+ SOUND_NATURE = 4,
+ SOUND_SPEECH = 5,
+ SOUND_TECHNIC = 6,
+ SOUND_ANIMAL = 7
+};
+
+// -------------
+// - SgaObject -
+// -------------
+
+class SVX_DLLPUBLIC SgaObject
+{
+ friend class GalleryTheme;
+
+private:
+
+ void ImplUpdateURL( const INetURLObject& rNewURL ) { aURL = rNewURL; }
+
+protected:
+
+ Bitmap aThumbBmp;
+ GDIMetaFile aThumbMtf;
+ INetURLObject aURL;
+ String aUserName;
+ String aTitle;
+ sal_Bool bIsValid;
+ sal_Bool bIsThumbBmp;
+
+ virtual void WriteData( SvStream& rOut, const String& rDestDir ) const;
+ virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion );
+
+ sal_Bool CreateThumb( const Graphic& rGraphic );
+
+public:
+
+ SgaObject();
+ virtual ~SgaObject() {};
+
+ virtual SgaObjKind GetObjKind() const = 0;
+ virtual sal_uInt16 GetVersion() const = 0;
+
+ virtual Bitmap GetThumbBmp() const { return aThumbBmp; }
+ const GDIMetaFile& GetThumbMtf() const { return aThumbMtf; }
+ const INetURLObject& GetURL() const { return aURL; }
+ sal_Bool IsValid() const { return bIsValid; }
+ sal_Bool IsThumbBitmap() const { return bIsThumbBmp; }
+
+ const String GetTitle() const;
+ void SetTitle( const String& rTitle );
+
+ friend SvStream& operator<<( SvStream& rOut, const SgaObject& rObj );
+ friend SvStream& operator>>( SvStream& rIn, SgaObject& rObj );
+};
+
+// ------------------
+// - SgaObjectSound -
+// ------------------
+
+class SgaObjectSound : public SgaObject
+{
+private:
+
+ GalSoundType eSoundType;
+
+ virtual void WriteData( SvStream& rOut, const String& rDestDir ) const;
+ virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion );
+
+ virtual sal_uInt16 GetVersion() const { return 6; }
+
+public:
+
+ SgaObjectSound();
+ SgaObjectSound( const INetURLObject& rURL );
+ virtual ~SgaObjectSound();
+
+ virtual SgaObjKind GetObjKind() const { return SGA_OBJ_SOUND; }
+ virtual Bitmap GetThumbBmp() const;
+ GalSoundType GetSoundType() const { return eSoundType; }
+};
+
+// -------------------
+// - SgaObjectSvDraw -
+// -------------------
+
+class FmFormModel;
+
+class SgaObjectSvDraw : public SgaObject
+{
+ using SgaObject::CreateThumb;
+
+private:
+
+ sal_Bool CreateThumb( const FmFormModel& rModel );
+
+ virtual void WriteData( SvStream& rOut, const String& rDestDir ) const;
+ virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion );
+
+ virtual sal_uInt16 GetVersion() const { return 5; }
+
+public:
+
+ SgaObjectSvDraw();
+ SgaObjectSvDraw( const FmFormModel& rModel, const INetURLObject& rURL );
+ SgaObjectSvDraw( SvStream& rIStm, const INetURLObject& rURL );
+ virtual ~SgaObjectSvDraw() {};
+
+ virtual SgaObjKind GetObjKind() const { return SGA_OBJ_SVDRAW; }
+
+public:
+
+ static sal_Bool DrawCentered( OutputDevice* pOut, const FmFormModel& rModel );
+};
+
+// ----------------
+// - SgaObjectBmp -
+// ----------------
+
+class SgaObjectBmp: public SgaObject
+{
+private:
+
+ void Init( const Graphic& rGraphic, const INetURLObject& rURL );
+
+ virtual void WriteData( SvStream& rOut, const String& rDestDir ) const;
+ virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion );
+
+ virtual sal_uInt16 GetVersion() const { return 5; }
+
+public:
+
+ SgaObjectBmp();
+ SgaObjectBmp( const INetURLObject& rURL );
+ SgaObjectBmp( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormat );
+ virtual ~SgaObjectBmp() {};
+
+ virtual SgaObjKind GetObjKind() const { return SGA_OBJ_BMP; }
+};
+
+// -----------------
+// - SgaObjectAnim -
+// -----------------
+
+class SgaObjectAnim : public SgaObjectBmp
+{
+private:
+
+ SgaObjectAnim( const INetURLObject& ) {};
+
+public:
+
+ SgaObjectAnim();
+ SgaObjectAnim( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormatName );
+
+ virtual ~SgaObjectAnim() {};
+
+ virtual SgaObjKind GetObjKind() const { return SGA_OBJ_ANIM; }
+};
+
+// -----------------
+// - SgaObjectINet -
+// -----------------
+
+class SgaObjectINet : public SgaObjectAnim
+{
+private:
+
+ SgaObjectINet( const INetURLObject& ) {};
+
+public:
+
+ SgaObjectINet();
+ SgaObjectINet( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormatName );
+
+ virtual ~SgaObjectINet() {};
+
+ virtual SgaObjKind GetObjKind() const { return SGA_OBJ_INET; }
+};
+#endif
diff --git a/svx/inc/galtheme.hrc b/svx/inc/galtheme.hrc
new file mode 100644
index 000000000000..483c397983ed
--- /dev/null
+++ b/svx/inc/galtheme.hrc
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _GALTHEME_HRC_
+#define _GALTHEME_HRC_
+
+#define RID_GALLERYSTR_THEME_START (6000)
+
+#define RID_GALLERYSTR_THEME_3D (RID_GALLERYSTR_THEME_START + 1)
+#define RID_GALLERYSTR_THEME_ANIMATIONS (RID_GALLERYSTR_THEME_START + 2)
+#define RID_GALLERYSTR_THEME_BULLETS (RID_GALLERYSTR_THEME_START + 3)
+#define RID_GALLERYSTR_THEME_OFFICE (RID_GALLERYSTR_THEME_START + 4)
+#define RID_GALLERYSTR_THEME_FLAGS (RID_GALLERYSTR_THEME_START + 5)
+#define RID_GALLERYSTR_THEME_FLOWCHARTS (RID_GALLERYSTR_THEME_START + 6)
+#define RID_GALLERYSTR_THEME_EMOTICONS (RID_GALLERYSTR_THEME_START + 7)
+#define RID_GALLERYSTR_THEME_PHOTOS (RID_GALLERYSTR_THEME_START + 8)
+#define RID_GALLERYSTR_THEME_BACKGROUNDS (RID_GALLERYSTR_THEME_START + 9)
+#define RID_GALLERYSTR_THEME_HOMEPAGE (RID_GALLERYSTR_THEME_START + 10)
+#define RID_GALLERYSTR_THEME_INTERACTION (RID_GALLERYSTR_THEME_START + 11)
+#define RID_GALLERYSTR_THEME_MAPS (RID_GALLERYSTR_THEME_START + 12)
+#define RID_GALLERYSTR_THEME_PEOPLE (RID_GALLERYSTR_THEME_START + 13)
+#define RID_GALLERYSTR_THEME_SURFACES (RID_GALLERYSTR_THEME_START + 14)
+#define RID_GALLERYSTR_THEME_HTMLBUTTONS (RID_GALLERYSTR_THEME_START + 15)
+#define RID_GALLERYSTR_THEME_POWERPOINT (RID_GALLERYSTR_THEME_START + 16)
+#define RID_GALLERYSTR_THEME_RULERS (RID_GALLERYSTR_THEME_START + 17)
+#define RID_GALLERYSTR_THEME_SOUNDS (RID_GALLERYSTR_THEME_START + 18)
+#define RID_GALLERYSTR_THEME_SYMBOLS (RID_GALLERYSTR_THEME_START + 19)
+#define RID_GALLERYSTR_THEME_MYTHEME (RID_GALLERYSTR_THEME_START + 20)
+#define RID_GALLERYSTR_THEME_USERSOUNDS (RID_GALLERYSTR_THEME_START + 21)
+
+#define RID_GALLERYSTR_THEME_ARROWS (RID_GALLERYSTR_THEME_START + 22)
+#define RID_GALLERYSTR_THEME_BALLOONS (RID_GALLERYSTR_THEME_START + 23)
+#define RID_GALLERYSTR_THEME_KEYBOARD (RID_GALLERYSTR_THEME_START + 24)
+#define RID_GALLERYSTR_THEME_TIME (RID_GALLERYSTR_THEME_START + 25)
+#define RID_GALLERYSTR_THEME_PRESENTATION (RID_GALLERYSTR_THEME_START + 26)
+#define RID_GALLERYSTR_THEME_CALENDAR (RID_GALLERYSTR_THEME_START + 27)
+#define RID_GALLERYSTR_THEME_NAVIGATION (RID_GALLERYSTR_THEME_START + 28)
+#define RID_GALLERYSTR_THEME_COMMUNICATION (RID_GALLERYSTR_THEME_START + 29)
+#define RID_GALLERYSTR_THEME_FINANCES (RID_GALLERYSTR_THEME_START + 30)
+#define RID_GALLERYSTR_THEME_COMPUTER (RID_GALLERYSTR_THEME_START + 31)
+
+#define RID_GALLERYSTR_THEME_CLIMA (RID_GALLERYSTR_THEME_START + 32)
+#define RID_GALLERYSTR_THEME_EDUCATION (RID_GALLERYSTR_THEME_START + 33)
+#define RID_GALLERYSTR_THEME_TROUBLE (RID_GALLERYSTR_THEME_START + 34)
+#define RID_GALLERYSTR_THEME_SCREENBEANS (RID_GALLERYSTR_THEME_START + 35)
+
+#define RID_GALLERYSTR_THEME_DUMMY5 (RID_GALLERYSTR_THEME_START + 36)
+#define RID_GALLERYSTR_THEME_FONTWORK (RID_GALLERYSTR_THEME_START + 37)
+#define RID_GALLERYSTR_THEME_FONTWORK_VERTICAL (RID_GALLERYSTR_THEME_START + 38)
+
+#define RID_GALLERYSTR_THEME_FIRST RID_GALLERYSTR_THEME_3D
+#define RID_GALLERYSTR_THEME_LAST RID_GALLERYSTR_THEME_FONTWORK_VERTICAL
+
+#endif
diff --git a/svx/inc/globlmn_tmpl.hrc b/svx/inc/globlmn_tmpl.hrc
new file mode 100644
index 000000000000..e86a684d93f2
--- /dev/null
+++ b/svx/inc/globlmn_tmpl.hrc
@@ -0,0 +1,1236 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _GLOBLMN_HRC
+#define _GLOBLMN_HRC
+
+/*------------------------------------------------------------------------
+ Beschreibung: Menu-IDs
+------------------------------------------------------------------------*/
+#define ITEM_FORM_CONFIG \
+ Identifier = SID_FM_CONFIG ; \
+ Command = ".uno:Config" ; \
+ DropDown = TRUE ;
+
+#define ITEM_FORM_CONTROL_PROPERTIES\
+ Identifier = SID_FM_CTL_PROPERTIES ; \
+ Command = ".uno:ControlProperties" ; \
+ Text [ en-US ] = "Con~trol..." ; \
+
+#define ITEM_FORM_PROPERTIES\
+ Identifier = SID_FM_PROPERTIES ; \
+ Command = ".uno:FormProperties" ; \
+ Text [ en-US ] = "For~m..." ; \
+
+#define ITEM_REPLACE_CONTROL\
+ Identifier = SID_FM_CHANGECONTROLTYPE ;\
+ Command = ".uno:ChangeControlType" ; \
+ Text [ en-US ] = "~Replace with"; \
+
+#define ITEM_FORMAT_TEMPLATECATALOG \
+ Identifier = SID_STYLE_CATALOG ; \
+ Command = ".uno:StyleCatalog" ; \
+ Text [ en-US ] = "~Catalog..." ; \
+
+#define ITEM_FORMAT_TEMPLATE \
+ Identifier = SID_STYLE_DESIGNER ; \
+ Command = ".uno:DesignerDialog" ; \
+ Text [ en-US ] = "St~ylist" ; \
+
+#define ITEM_FORMAT_AUTOFORMAT \
+ Identifier = SID_AUTOFORMAT ; \
+ Command = ".uno:AutoFormat" ; \
+ Text [ en-US ] = "Auto~Format..." ;\
+
+#define ITEM_FORMAT_CHAR_DLG \
+ Identifier = SID_CHAR_DLG ; \
+ Command = ".uno:FontDialog" ; \
+ Text [ en-US ] = "C~haracter..." ;\
+
+#define ITEM_FORMAT_PARA_DLG \
+ Identifier = SID_PARA_DLG ; \
+ Command = ".uno:ParagraphDialog" ; \
+ Text [ en-US ] = "P~aragraph..." ;\
+
+#define ITEM_FORMAT_FONTWORK \
+ Identifier = SID_FONTWORK ; \
+ Command = ".uno:FontWork" ; \
+ Text [ en-US ] = "F~ontwork" ;\
+
+#define ITEM_EDIT_CUT \
+ Identifier = SID_CUT ; \
+ Command = ".uno:Cut" ; \
+ Text [ en-US ] = "Cu~t" ;\
+
+#define ITEM_EDIT_COPY \
+ Identifier = SID_COPY ; \
+ Command = ".uno:Copy" ; \
+ Text [ en-US ] = "~Copy" ;\
+
+#define ITEM_EDIT_DELETE \
+ Identifier = SID_DELETE ; \
+ Command = ".uno:Delete" ; \
+ Text [ en-US ] = "~Delete" ;\
+
+#define ITEM_FORMAT_ATTR_CHAR_FONT \
+ Identifier = SID_ATTR_CHAR_FONT ; \
+ Command = ".uno:CharFontName" ; \
+ Text [ en-US ] = "Font" ;\
+
+#define ITEM_FORMAT_ATTR_CHAR_FONTHEIGHT \
+ Identifier = SID_ATTR_CHAR_FONTHEIGHT ; \
+ Command = ".uno:FontHeight" ; \
+ Text [ en-US ] = "Size" ;\
+
+#define ITEM_FORMAT_ATTR_CHAR_WEIGHT \
+ Identifier = SID_ATTR_CHAR_WEIGHT ; \
+ Command = ".uno:Bold" ; \
+ Text [ en-US ] = "Bold" ; \
+
+#define ITEM_FORMAT_ATTR_CHAR_POSTURE \
+ Identifier = SID_ATTR_CHAR_POSTURE ; \
+ Command = ".uno:Italic" ; \
+ Text [ en-US ] = "Italic" ;\
+
+#define ITEM_FORMAT_ATTR_CHAR_UNDERLINE \
+ Identifier = SID_ATTR_CHAR_UNDERLINE ; \
+ Command = ".uno:Underline" ; \
+ Text [ en-US ] = "Underline" ;\
+
+#define ITEM_FORMAT_ATTR_CHAR_OVERLINE \
+ Identifier = SID_ATTR_CHAR_OVERLINE ; \
+ Command = ".uno:Overline" ; \
+ Text [ en-US ] = "Overline" ;\
+
+#define ITEM_FORMAT_ATTR_CHAR_STRIKEOUT \
+ Identifier = SID_ATTR_CHAR_STRIKEOUT ; \
+ Command = ".uno:Strikeout" ; \
+ Text [ en-US ] = "Strikethrough" ;\
+
+#define ITEM_FORMAT_ATTR_CHAR_SHADOWED \
+ Identifier = SID_ATTR_CHAR_SHADOWED ; \
+ Command = ".uno:Shadowed" ; \
+ Text [ en-US ] = "Shadow" ;\
+
+#define ITEM_FORMAT_ATTR_CHAR_CONTOUR \
+ Identifier = SID_ATTR_CHAR_CONTOUR ; \
+ Command = ".uno:OutlineFont" ; \
+ Text [ en-US ] = "Outline" ;\
+
+#define ITEM_FORMAT_SET_SUPER_SCRIPT \
+ Identifier = SID_SET_SUPER_SCRIPT; \
+ Command = CMD_SID_SET_SUPER_SCRIPT; \
+ Text [ en-US ] = "Su~perscript"; \
+
+#define ITEM_FORMAT_SET_SUB_SCRIPT \
+ Identifier = SID_SET_SUB_SCRIPT; \
+ Command = CMD_SID_SET_SUB_SCRIPT; \
+ Text [ en-US ] = "Su~bscript"; \
+
+
+#define ITEM_FORMAT_ATTR_PARA_ADJUST_LEFT \
+ Identifier = SID_ATTR_PARA_ADJUST_LEFT ; \
+ Command = ".uno:LeftPara" ; \
+ Text [ en-US ] = "~Left" ;\
+
+#define ITEM_FORMAT_ATTR_PARA_ADJUST_RIGHT \
+ Identifier = SID_ATTR_PARA_ADJUST_RIGHT ; \
+ Command = ".uno:RightPara" ; \
+ Text [ en-US ] = "~Right" ;\
+
+#define ITEM_FORMAT_ATTR_PARA_ADJUST_CENTER \
+ Identifier = SID_ATTR_PARA_ADJUST_CENTER ; \
+ Command = ".uno:CenterPara" ; \
+ Text [ en-US ] = "~Centered" ;\
+
+#define ITEM_FORMAT_ATTR_PARA_ADJUST_BLOCK \
+ Identifier = SID_ATTR_PARA_ADJUST_BLOCK ; \
+ Command = ".uno:JustifyPara" ; \
+ Text [ en-US ] = "Justified" ;\
+
+#define ITEM_FORMAT_PARA_LINESPACE_10 \
+ Identifier = SID_ATTR_PARA_LINESPACE_10 ; \
+ Command = ".uno:SpacePara1" ; \
+ Text [ en-US ] = "Single" ;\
+
+#define ITEM_FORMAT_PARA_LINESPACE_15 \
+ Identifier = SID_ATTR_PARA_LINESPACE_15 ; \
+ Command = ".uno:SpacePara15" ; \
+ Text [ en-US ] = "1.5 lines" ;\
+
+#define ITEM_FORMAT_PARA_LINESPACE_20 \
+ Identifier = SID_ATTR_PARA_LINESPACE_20 ; \
+ Command = ".uno:SpacePara2" ; \
+ Text [ en-US ] = "~Double" ;\
+
+#define ITEM_FORMAT_FRAME_TO_TOP \
+ Identifier = SID_FRAME_TO_TOP ; \
+ Command = ".uno:BringToFront" ; \
+ Text [ en-US ] = "~Bring to Front" ;\
+
+#define ITEM_FORMAT_FRAME_TO_BOTTOM \
+ Identifier = SID_FRAME_TO_BOTTOM ; \
+ Command = ".uno:SendToBack" ; \
+ Text [ en-US ] = "~Send to Back" ;\
+
+#define ITEM_FORMAT_OBJECT_ALIGN \
+ Identifier = SID_OBJECT_ALIGN ; \
+ Command = ".uno:ObjectAlign" ; \
+ Text [ en-US ] = "A~lignment" ;\
+
+#define ITEM_FORMAT_OBJECT_ALIGN_LEFT \
+ Identifier = SID_OBJECT_ALIGN_LEFT ; \
+ Command = ".uno:ObjectAlignLeft" ; \
+ Text [ en-US ] = "~Left" ;\
+
+#define ITEM_FORMAT_OBJECT_ALIGN_CENTER \
+ Identifier = SID_OBJECT_ALIGN_CENTER ; \
+ Command = ".uno:AlignCenter" ; \
+ Text [ en-US ] = "~Centered" ;\
+
+#define ITEM_FORMAT_OBJECT_ALIGN_RIGHT \
+ Identifier = SID_OBJECT_ALIGN_RIGHT ; \
+ Command = ".uno:ObjectAlignRight" ; \
+ Text [ en-US ] = "~Right" ;\
+
+#define ITEM_FORMAT_OBJECT_ALIGN_UP \
+ Identifier = SID_OBJECT_ALIGN_UP ; \
+ Command = ".uno:AlignUp" ; \
+ Text [ en-US ] = "~Top" ;\
+
+#define ITEM_FORMAT_OBJECT_ALIGN_MIDDLE \
+ Identifier = SID_OBJECT_ALIGN_MIDDLE ; \
+ Command = ".uno:AlignMiddle" ; \
+ Text [ en-US ] = "C~enter" ;\
+
+#define ITEM_FORMAT_OBJECT_ALIGN_DOWN \
+ Identifier = SID_OBJECT_ALIGN_DOWN ; \
+ Command = ".uno:AlignDown" ; \
+ Text [ en-US ] = "~Bottom" ;\
+
+#define ITEM_FORMAT_ATTRIBUTES_LINE \
+ Identifier = SID_ATTRIBUTES_LINE ; \
+ Command = ".uno:FormatLine" ; \
+ Text [ en-US ] = "L~ine..." ;\
+
+#define ITEM_FORMAT_ATTRIBUTES_AREA \
+ Identifier = SID_ATTRIBUTES_AREA ; \
+ Command = ".uno:FormatArea" ; \
+ Text [ en-US ] = "A~rea..." ;\
+
+#define ITEM_FORMAT_ATTR_TRANSFORM \
+ Identifier = SID_ATTR_TRANSFORM ; \
+ Command = ".uno:TransformDialog" ; \
+ Text [ en-US ] = "Position and Si~ze..." ;\
+
+#define ITEM_FORMAT_OBJECT_HEAVEN \
+ Identifier = SID_OBJECT_HEAVEN ; \
+ Command = ".uno:SetObjectToForeground" ; \
+ Text [ en-US ] = "~To Foreground" ;\
+
+#define ITEM_FORMAT_OBJECT_HELL \
+ Identifier = SID_OBJECT_HELL ; \
+ Command = ".uno:SetObjectToBackground" ; \
+ Text [ en-US ] = "T~o Background" ;\
+
+#define ITEM_FORMAT_BEZIER_EDIT \
+ Identifier = SID_BEZIER_EDIT ; \
+ Command = ".uno:ToggleObjectBezierMode" ; \
+ Text [ en-US ] = "Edit ~Points" ;\
+
+#define ITEM_FILE_PICKLIST \
+ Identifier = SID_PICKLIST ; \
+ Command = ".uno:PickList" ; \
+ Text [ en-US ] = "~File" ; \
+
+#define ITEM_FILE_NEWDOC \
+ Identifier = SID_NEWDOCDIRECT ; \
+ Command = ".uno:AddDirect" ; \
+ Text [ en-US ] = "~New" ;\
+
+#define ITEM_FILE_OPENDOC \
+ Identifier = SID_OPENDOC ; \
+ Command = ".uno:Open" ; \
+ Text [ en-US ] = "~Open..." ;\
+
+
+#define ITEM_FILE_AUTOPILOT \
+ MenuItem\
+ {\
+ Identifier = SID_AUTOPILOTMENU ; \
+ Command = ".uno:AutoPilotMenu" ; \
+ Text [ en-US ] = "A~utoPilot" ; \
+ };
+
+#define ITEM_FILE_CLOSEDOC \
+ Identifier = SID_CLOSEDOC ; \
+ Command = ".uno:CloseDoc" ; \
+ Text [ en-US ] = "~Close" ;\
+
+#define ITEM_FILE_SAVEDOC \
+ Identifier = SID_SAVEDOC ; \
+ Command = ".uno:Save" ; \
+ Text [ en-US ] = "~Save" ; \
+
+#define ITEM_FILE_SAVEDOCS \
+ Identifier = SID_SAVEDOCS ; \
+ Command = ".uno:SaveAll" ; \
+ Text [ en-US ] = "Sa~ve All" ; \
+
+#define ITEM_FILE_SAVEASDOC \
+ Identifier = SID_SAVEASDOC ; \
+ Command = ".uno:SaveAs" ; \
+ Text [ en-US ] = "Save ~As..." ; \
+
+#define ITEM_FILE_EXPORTDOC \
+ Identifier = SID_EXPORTDOC ; \
+ Command = ".uno:ExportTo" ; \
+ Text [ en-US ] = "Expor~t..." ; \
+
+#define ITEM_FILE_EXPORTDOCASPDF \
+ Identifier = SID_EXPORTDOCASPDF ; \
+ Command = ".uno:ExportToPDF" ; \
+ Text [ en-US ] = "Export as P~DF..." ; \
+
+#define ITEM_FILE_VERSIONDIALOG \
+ Identifier = SID_VERSION ; \
+ Command = ".uno:VersionDialog" ; \
+ Text [ en-US ] = "Versions..." ; \
+
+#define ITEM_FILE_LASTVERSIONDOC \
+ Identifier = SID_RELOAD ; \
+ Command = ".uno:Reload" ; \
+ Text [ en-US ] = "Reload" ;\
+
+#define ITEM_FILE_DOCINFO \
+ Identifier = SID_DOCINFO ; \
+ Command = ".uno:SetDocumentProperties" ; \
+ Text [ en-US ] = "Propert~ies..." ;\
+
+#define ITEM_FILE_DOCTEMPLATE \
+ Identifier = MN_TEMPLATES; \
+ Command = ".uno:TemplateMenu" ; \
+ Text [ en-US ] = "~Templates" ;\
+ SubMenu = Menu \
+ { \
+ ItemList = \
+ { \
+ MenuItem \
+ { \
+ Identifier = SID_ORGANIZER ; \
+ Command = ".uno:Organizer" ; \
+ Text [ en-US ] = "~Organize...";\
+ }; \
+ MenuItem \
+ { \
+ Identifier = SID_TEMPLATE_ADDRESSBOKSOURCE; \
+ Command = ".uno:AddressBookSource" ; \
+ Text [ en-US ] = "~Address Book Source..."; \
+ }; \
+ MenuItem \
+ { \
+ Identifier = SID_DOCTEMPLATE ; \
+ Command = ".uno:SaveAsTemplate" ; \
+ Text [ en-US ] = "~Save...";\
+ }; \
+ MenuItem \
+ { \
+ Identifier = SID_OPENTEMPLATE ; \
+ Command = ".uno:OpenTemplate" ; \
+ Text [ en-US ] = "~Edit...";\
+ }; \
+ }; \
+ }; \
+
+#define ITEM_FILE_PRINTPREVIEW \
+ Identifier = SID_PRINTPREVIEW ; \
+ Command = ".uno:PrintPreview" ; \
+ Text [ en-US ] = "Pa~ge Preview" ;\
+
+#define ITEM_FILE_SETUPPRINTER \
+ Identifier = SID_SETUPPRINTER ; \
+ Command = ".uno:PrinterSetup" ; \
+ Text [ en-US ] = "P~rinter Settings..." ; \
+
+#define ITEM_FILE_PRINTDOC \
+ Identifier = SID_PRINTDOC ; \
+ Command = ".uno:Print" ; \
+ Text [ en-US ] = "~Print..." ; \
+
+#define ITEM_FILE_MAIL_SENDDOC \
+ Identifier = SID_MAIL_SENDDOC ; \
+ Command = ".uno:SendMail" ; \
+ Text [ en-US ] = "Document as ~E-mail..." ; \
+
+#define ITEM_FILE_MAIL_SENDDOCASPDF \
+ Identifier = SID_MAIL_SENDDOCASPDF ; \
+ Command = ".uno:SendMailDocAsPDF" ; \
+ Text [ en-US ] = "Document as P~DF Attachment..." ; \
+
+
+#define ITEM_FILE_QUITAPP \
+ Identifier = SID_QUITAPP ; \
+ Command = ".uno:Quit" ; \
+ Text [ en-US ] = "E~xit" ; \
+
+#define ITEM_FILE_LOGOUT \
+ Identifier = SID_LOGOUT ; \
+ Command = ".uno:Logout" ; \
+ Text [ en-US ] = "Logout" ; \
+
+#define ITEM_EDIT_UNDO \
+ Identifier = SID_UNDO ; \
+ Command = ".uno:UndoAction" ; \
+ Text [ en-US ] = "Can't Undo" ; \
+
+#define ITEM_EDIT_REDO \
+ Identifier = SID_REDO ; \
+ Command = ".uno:Redo" ; \
+ Text [ en-US ] = "Can't Restore" ; \
+
+#define ITEM_EDIT_REPEAT \
+ Identifier = SID_REPEAT ; \
+ Command = ".uno:Repeat" ; \
+ Text [ en-US ] = "~Repeat" ; \
+
+#define ITEM_EDIT_PASTE \
+ Identifier = SID_PASTE ; \
+ Command = ".uno:Paste" ; \
+ Text [ en-US ] = "~Paste" ; \
+
+#define ITEM_EDIT_SELECTALL \
+ Identifier = SID_SELECTALL ; \
+ Command = ".uno:SelectAll" ; \
+ Text [ en-US ] = "Select ~All" ; \
+
+#define ITEM_EDIT_SEARCH_DLG \
+ Identifier = SID_SEARCH_DLG ; \
+ Command = ".uno:SearchDialog" ; \
+ Text [ en-US ] = "~Find & Replace..." ; \
+
+#define ITEM_EDIT_NAVIGATOR \
+ Identifier = SID_NAVIGATOR ; \
+ Command = ".uno:Navigator" ; \
+ Text [ en-US ] = "~Navigator" ; \
+
+
+#define ITEM_EDIT_BIBLIOGRAPHY \
+ Identifier = SID_COMP_BIBLIOGRAPHY ; \
+ Command = ".uno:BibliographyComponent" ; \
+ Text [ en-US ] = "~Bibliography Database"; \
+
+#define ITEM_EDIT_PLUGINS_ACTIVE \
+ Identifier = SID_PLUGINS_ACTIVE ; \
+ Command = ".uno:PlugInsActive" ; \
+ Text [ en-US ] = "P~lug-in" ; \
+
+#define ITEM_EDIT_IMAP \
+ Identifier = SID_IMAP ; \
+ Command = ".uno:ImageMapDialog" ; \
+ Text [ en-US ] = "ImageMap" ; \
+
+#define ITEM_EDIT_OBJECT \
+ Identifier = SID_OBJECT ; \
+ Command = ".uno:ObjectMenue" ; \
+ Text [ en-US ] = "~Object" ; \
+
+#define ITEM_VIEW_ATTR_ZOOM \
+ Identifier = SID_ATTR_ZOOM ; \
+ Command = ".uno:Zoom" ; \
+ Text [ en-US ] = "~Zoom..." ; \
+
+#define ITEM_VIEW_TOGGLEFUNCTIONBAR \
+ Identifier = SID_TOGGLEFUNCTIONBAR ; \
+ Command = ".uno:FunctionBarVisible" ; \
+ Text [ en-US ] = "~Function Bar" ; \
+
+#define ITEM_VIEW_TOGGLEOBJECTBAR \
+ Identifier = SID_TOGGLEOBJECTBAR ; \
+ Command = ".uno:ObjectBarVisible" ; \
+ Text [ en-US ] = "~Object Bar" ; \
+
+#define ITEM_VIEW_TOGGLEINETBAR \
+ Identifier = SID_TOGGLEINETBAR ; \
+ Command = CMD_SID_TOGGLEINETBAR; \
+ Text [ en-US ] = "Internet Bar" ; \
+
+#define ITEM_VIEW_TOGGLESTATUSBAR \
+ Identifier = SID_TOGGLESTATUSBAR ; \
+ Command = ".uno:StatusBarVisible" ; \
+ Text [ en-US ] = "~Status Bar" ; \
+
+#define ITEM_VIEW_TOGGLEIMESTATUSWINDOW \
+ Identifier = SID_SHOW_IME_STATUS_WINDOW ; \
+ Command = ".uno:ShowImeStatusWindow" ; \
+ Text [ en-US ] = "~Input Method Status"; \
+
+#define ITEM_VIEW_TASKBAR \
+ Identifier = SID_TASKBAR ; \
+ Command = ".uno:TaskBarVisible" ; \
+ Text [ en-US ] = "~Status Bar" ; \
+
+#define ITEM_VIEW_COLORBAR \
+ Identifier = SID_COLOR_CONTROL ; \
+ Command = ".uno:ColorControl" ; \
+ Text [ en-US ] = "~Color Bar" ; \
+
+#define ITEM_VIEW_FULLSCREEN \
+ Identifier = SID_WIN_FULLSCREEN ; \
+ Command = ".uno:FullScreen" ; \
+ Text [ en-US ] = "F~ull Screen" ; \
+
+
+#define ITEM_VIEW_SCREENMODE \
+ MenuItem\
+ {\
+ ITEM_VIEW_FULLSCREEN\
+ };
+
+#define ITEM_VIEW_BROWSER_MODE \
+ Identifier = SID_BROWSER_MODE ; \
+ Command = ".uno:BrowseView" ; \
+ Text [ en-US ] = "~Online Layout" ; \
+
+#define ITEM_VIEW_BROWSER \
+ Identifier = SID_BROWSER ; \
+ Command = ".uno:Beamer" ; \
+ Text [ en-US ] = "~Beamer" ; \
+
+
+#define ITEM_INSERT_HYPERLINK_INSERT \
+ Identifier = SID_HYPERLINK_INSERT ; \
+ Command = ".uno:InsertHyperlink" ; \
+ Text [ en-US ] = "~Hyperlink Bar" ; \
+
+#define ITEM_INSERT_INSERT_GRAPHIC \
+ Identifier = SID_INSERT_GRAPHIC ; \
+ Command = ".uno:InsertGraphic" ; \
+ Text [ en-US ] = "~Graphics..." ; \
+
+#define ITEM_INSERT_TWAIN_SELECT \
+ MenuItem\
+ {\
+ Identifier = SID_TWAIN_SELECT ; \
+ Command = ".uno:TwainSelect" ; \
+ Text [ en-US ] = "~Select Source..." ; \
+ };
+
+#define ITEM_INSERT_TWAIN_TRANSFER \
+ MenuItem\
+ {\
+ Identifier = SID_TWAIN_TRANSFER ; \
+ Command = ".uno:TwainTransfer" ; \
+ Text [ en-US ] = "~Request..." ; \
+ };
+
+#define ITEM_INSERT_TWAIN_MENU \
+ MenuItem\
+ {\
+ Identifier = SID_SCAN ; \
+ Command = ".uno:Scan" ; \
+ Text [ en-US ] = "Scan" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ ITEM_INSERT_TWAIN_SELECT\
+ ITEM_INSERT_TWAIN_TRANSFER\
+ };\
+ };\
+ };
+
+#define ITEM_INSERT_INSERT_DIAGRAM \
+ Identifier = SID_INSERT_DIAGRAM ; \
+ Command = ".uno:InsertObjectChart" ; \
+ Text [ en-US ] = "~Chart..." ; \
+
+#define ITEM_INSERT_GALLERY \
+ Identifier = SID_GALLERY ; \
+ Command = ".uno:Gallery" ; \
+ Text [ en-US ] = "~Gallery" ; \
+
+#define ITEM_INSERT_INSERTDOC \
+ Identifier = SID_INSERTDOC ; \
+ Command = ".uno:InsertDoc" ; \
+ Text [ en-US ] = "~File..." ; \
+
+#define TMP_SID_INSERT_PLUGIN \
+ MenuItem\
+ {\
+ Identifier = SID_INSERT_PLUGIN ; \
+ Command = ".uno:InsertPlugin" ; \
+ Text [ en-US ] = "~Plug-in..." ; \
+ };
+
+#define TMP_SID_INSERT_SOUND \
+ MenuItem\
+ {\
+ Identifier = SID_INSERT_SOUND ; \
+ Command = ".uno:InsertSound" ; \
+ Text [ en-US ] = "~Sound..." ; \
+ };
+
+#define TMP_SID_INSERT_VIDEO \
+ MenuItem\
+ {\
+ Identifier = SID_INSERT_VIDEO ; \
+ Command = ".uno:InsertVideo" ; \
+ Text [ en-US ] = "~Video..." ; \
+ };
+
+#define ITEM_INSERT_OBJECT_MN \
+ MenuItem\
+ {\
+ Identifier = SID_MN_INSERT_OBJECT_DLGS ; \
+ Command = ".uno:ObjectMenu" ; \
+ Text [ en-US ] = "~Object" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ Identifier = SID_INSERT_OBJECT ; \
+ Command = ".uno:InsertObject" ; \
+ Text [ en-US ] = "~OLE Object..." ; \
+ };\
+ TMP_SID_INSERT_PLUGIN\
+ TMP_SID_INSERT_SOUND\
+ TMP_SID_INSERT_VIDEO\
+ MenuItem\
+ {\
+ Identifier = SID_INSERT_MATH ; \
+ Command = ".uno:InsertMath" ; \
+ Text [ en-US ] = "~Formula..." ; \
+ };\
+ };\
+ };\
+ };
+
+#define ITEM_INSERT_OBJECT_PORTAL \
+ MenuItem\
+ {\
+ Identifier = SID_MN_INSERT_OBJECT_DLGS ; \
+ Command = ".uno:ObjectMenu" ; \
+ Text [ en-US ] = "~Object" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ Identifier = SID_INSERT_OBJECT ; \
+ Command = ".uno:InsertObject" ; \
+ Text [ en-US ] = "~OLE Object..." ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_INSERT_MATH ; \
+ Command = ".uno:InsertMath" ; \
+ Text [ en-US ] = "~Formula" ; \
+ };\
+ };\
+ };\
+ };
+
+#define ITEM_FORMAT_NUMBERING \
+ MenuItem\
+ {\
+ Identifier = DEFINE_SLOTID_FOR_NUMBER_BULLETS ; \
+ Text [ en-US ] = "~Numbering/Bullets..." ; \
+ };
+
+
+
+#define ITEM_FORMAT \
+ Identifier = SID_OBJECTMENU0 ; \
+ Command = ".uno:FormatMenu" ; \
+ Text [ en-US ] = "F~ormat" ; \
+
+#define ITEM_TOOLS_ID SID_ADDONLIST
+
+#define ITEM_TOOLS_MACROS \
+ Identifier = SID_SCRIPTORGANIZER ; \
+ Command = ".uno:ScriptOrganizer" ; \
+ Text [ en-US ] = "Scripts/Macros" ; \
+
+/*
+#define ITEM_TOOLS_MACROS \
+ Command = ".uno:MacrosMenu" ; \
+ Text [ en-US ] = "~Macros" ; \
+ SubMenu = Menu \
+ { \
+ ItemList = \
+ { \
+ MenuItem \
+ { \
+ Identifier = SID_RECORDMACRO ; \
+ Command = ".uno:MacroRecorder" ; \
+ Text [ en-US ] = "Record Macro"; }; \
+ MenuItem \
+ { \
+ Identifier = SID_BASICCHOOSER ; \
+ Command = ".uno:MacroDialog" ; \
+ Text [ en-US ] = "~Macro..." ; \
+ }; \
+ }; \
+ }; \
+
+*/
+
+#define ITEM_TOOLS_BASICCHOOSER ITEM_TOOLS_MACROS
+
+#define ITEM_TOOLS_CONFIG \
+ Identifier = SID_CONFIG ; \
+ Command = ".uno:ConfigureDialog"; \
+ Text [ en-US ] = "~Configure..." ; \
+
+
+#define ITEM_TOOLS_AUTO_CORRECT \
+ MenuItem\
+ {\
+ Identifier = SID_AUTO_CORRECT_DLG ; \
+ Command = ".uno:AutoCorrectDlg" ; \
+ Text [ en-US ] = "~AutoCorrect..." ; \
+ };
+
+#define ITEM_SD_GRAPHIC_OPTIONS \
+ MenuItem\
+ {\
+ Identifier = SID_SD_GRAPHIC_OPTIONS ; \
+ Command = ".uno:SdGraphicOptions" ; \
+ Text [ en-US ] = "~Drawing..." ; \
+ };
+
+#define ITEM_MN_OPTIONS \
+ MenuItem\
+ {\
+ Identifier = SID_OPTIONS_TREEDIALOG ; \
+ Command = ".uno:OptionsTreeDialog" ; \
+ Text [ en-US ] = "~Options..." ; \
+ };
+
+
+/*------------------------------------------------------------------------
+ Beschreibung: Menu Window-IDs
+------------------------------------------------------------------------*/
+#define ITEM_WINDOW_MDIWINDOWLIST \
+ Identifier = SID_MDIWINDOWLIST ; \
+ Command = ".uno:WindowList" ; \
+ Text [ en-US ] = "~Window" ; \
+
+#define ITEM_WINDOW_CLONEWIN \
+ Identifier = SID_NEWWINDOW ; \
+ Command = ".uno:NewWindow" ; \
+ Text [ en-US ] = "~New Window" ; \
+
+#define ITEM_WINDOW_CASCADEWINS \
+ MenuItem\
+ {\
+ Identifier = SID_CASCADEWINS ; \
+ Command = ".uno:Cascade" ; \
+ Text [ en-US ] = "~Cascade" ; \
+ };
+
+#define ITEM_WINDOW_TILEWINS \
+ MenuItem\
+ {\
+ Identifier = SID_TILEWINS ; \
+ Command = ".uno:Tile" ; \
+ Text [ en-US ] = "~Tile" ; \
+ };
+
+#define ITEM_WINDOW_HORIZONTALWINS \
+ MenuItem\
+ {\
+ Identifier = SID_HORIZONTALWINS ; \
+ Command = ".uno:ArrangeHorizontal" ; \
+ Text [ en-US ] = "~Horizontally" ; \
+ };
+
+#define ITEM_WINDOW_VERTICALWINS \
+ MenuItem\
+ {\
+ Identifier = SID_VERTICALWINS ; \
+ Command = ".uno:ArrangeVertical" ; \
+ Text [ en-US ] = "~Vertically" ; \
+ };
+
+#define ITEM_WINDOW_CLOSEWIN \
+ Identifier = SID_CLOSEWIN ; \
+ Command = ".uno:CloseWin" ; \
+ Text [ en-US ] = "Close Window" ; \
+
+#define ITEM_HYPERLINK_DIALOG \
+ MenuItem\
+ {\
+ Identifier = SID_HYPERLINK_DIALOG ; \
+ Command = ".uno:HyperlinkDialog" ; \
+ Text [ en-US ] = "~Hyperlink" ; \
+ } ;
+
+#define ITEM_POLY_MERGE \
+ MenuItem\
+ {\
+ Identifier = SID_POLY_MERGE ; \
+ Command = ".uno:Merge" ; \
+ Text [ en-US ] = "~Merge" ; \
+ };
+#define ITEM_POLY_SUBSTRACT \
+ MenuItem\
+ {\
+ Identifier = SID_POLY_SUBSTRACT ; \
+ Command = ".uno:Substract" ; \
+ Text [ en-US ] = "~Subtract" ; \
+ };
+#define ITEM_POLY_INTERSECT \
+ MenuItem\
+ {\
+ Identifier = SID_POLY_INTERSECT ; \
+ Command = ".uno:Intersect" ; \
+ Text [ en-US ] = "I~ntersect" ; \
+ };
+
+#define MNSUB_FORMEN \
+ MenuItem \
+ { \
+ Identifier = SID_POLY_FORMEN ; \
+ Command = ".uno:PolyFormen" ; \
+ Text [ en-US ] = "~Shapes" ; \
+ SubMenu = Menu \
+ {\
+ ItemList = \
+ {\
+ ITEM_POLY_MERGE \
+ ITEM_POLY_SUBSTRACT \
+ ITEM_POLY_INTERSECT \
+ };\
+ };\
+ };
+
+
+/*------------------------------------------------------------------------
+ Beschreibung: Menu Window
+------------------------------------------------------------------------*/
+#define GLOBLMN_CLONEWIN \
+ MenuItem\
+ {\
+ ITEM_WINDOW_CLONEWIN\
+ };\
+ MenuItem\
+ {\
+ ITEM_WINDOW_CLOSEWIN\
+ };\
+ MenuItem\
+ {\
+ Separator = TRUE ; \
+ };
+
+#ifdef MN_SW_WEB
+ //#define GLOBLMN_CLONEWIN
+ #define GLOBLMN_WINMN MenuItem MN_WEBWIN
+#elif defined MN_SW_GLOBAL
+ #define GLOBLMN_WINMN MenuItem MN_GLOBALWIN
+#else
+ #define GLOBLMN_WINMN MenuItem MN_WIN
+#endif
+
+#define ITEM_WINDOW_MENU \
+ GLOBLMN_WINMN \
+ {\
+ ITEM_WINDOW_MDIWINDOWLIST\
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ GLOBLMN_CLONEWIN \
+ };\
+ };\
+ };
+
+/*------------------------------------------------------------------------
+ Beschreibung: Menu Help-IDs
+------------------------------------------------------------------------*/
+#define ITEM_HELP_HELPMENU \
+ Identifier = SID_HELPMENU ; \
+ Command = ".uno:HelpMenu" ; \
+ Text [ en-US ] = "~Help" ; \
+
+#define ITEM_HELP_HELPINDEX \
+ Identifier = SID_HELPINDEX ; \
+ Command = ".uno:HelpIndex" ; \
+ Text [ en-US ] = "~Contents" ; \
+
+#define ITEM_HELP_HELPONHELP \
+ Identifier = SID_HELPONHELP ; \
+ Command = ".uno:HelpOnHelp" ; \
+ Text [ en-US ] = "Using Help" ; \
+
+#define ITEM_HELP_HELP_PI \
+ Identifier = SID_HELP_PI ; \
+ Command = ".uno:HelperDialog" ; \
+ Text [ en-US ] = "Help ~Agent" ; \
+
+#define ITEM_HELP_HELPTIPS \
+ Identifier = SID_HELPTIPS ; \
+ Command = ".uno:HelpTip" ; \
+ Text [ en-US ] = "~Tips" ; \
+
+#define ITEM_HELP_BALLOONHELP \
+ Identifier = SID_HELPBALLOONS ; \
+ Command = ".uno:ActiveHelp" ; \
+ Text [ en-US ] = "~Extended Tips" ; \
+
+#define ITEM_HELP_SUPPORTPAGE \
+ Identifier = SID_HELP_SUPPORTPAGE ; \
+ Command = ".uno:HelpSupport" ; \
+ Text [ en-US ] = "~Support" ; \
+
+#define ITEM_HELP_ONLINE_REGISTRATION \
+ Identifier = SID_ONLINE_REGISTRATION ; \
+ Command = ".uno:OnlineRegistrationDlg" ; \
+ Text [ en-US ] = "~Registration..." ; \
+
+
+#define ITEM_HELP_ABOUT \
+ Identifier = SID_ABOUT ; \
+ Command = ".uno:About" ; \
+ Text [ en-US ] = "A~bout %PRODUCTNAME..." ; \
+
+/*------------------------------------------------------------------------
+ Beschreibung: Menu Help
+------------------------------------------------------------------------*/
+#define ITEM_HELP_MENU \
+ MenuItem MN_HELP\
+ {\
+ ITEM_HELP_HELPMENU\
+ Help = TRUE ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ ITEM_HELP_HELPINDEX\
+ };\
+ MenuItem\
+ {\
+ Separator = TRUE ; \
+ };\
+ MenuItem\
+ {\
+ ITEM_HELP_HELP_PI\
+ };\
+ MenuItem\
+ {\
+ ITEM_HELP_HELPTIPS\
+ };\
+ MenuItem\
+ {\
+ ITEM_HELP_BALLOONHELP\
+ };\
+ MenuItem\
+ {\
+ Separator = TRUE ; \
+ };\
+ MenuItem\
+ {\
+ ITEM_HELP_SUPPORTPAGE\
+ };\
+ MenuItem\
+ {\
+ ITEM_HELP_ONLINE_REGISTRATION\
+ };\
+ MenuItem\
+ {\
+ Separator = TRUE ; \
+ };\
+ MenuItem\
+ {\
+ ITEM_HELP_ABOUT\
+ About = TRUE ; \
+ };\
+ };\
+ };\
+ };
+/*------------------------------------------------------------------------
+ Beschreibung: Kontextmenues
+------------------------------------------------------------------------*/
+
+#define ITEM_POPUP_TEMPLATE_EDIT \
+ Identifier = SID_STYLE_EDIT ; \
+ Command = ".uno:EditStyle" ; \
+ Text [ en-US ] = "Edit Paragraph Style..." ; \
+
+ // Gruppen-/Kombination-Funktionen
+#define ITEM_POPUP_GROUP \
+ Identifier = SID_GROUP ; \
+ Command = ".uno:FormatGroup" ; \
+ Text [ en-US ] = "~Group" ; \
+
+#define ITEM_POPUP_UNGROUP \
+ Identifier = SID_UNGROUP ; \
+ Command = ".uno:FormatUngroup" ; \
+ Text [ en-US ] = "~Ungroup" ; \
+
+#define ITEM_POPUP_ENTER_GROUP \
+ Identifier = SID_ENTER_GROUP ; \
+ Command = ".uno:EnterGroup" ; \
+ Text [ en-US ] = "~Edit Group" ; \
+
+#define ITEM_POPUP_LEAVE_GROUP \
+ Identifier = SID_LEAVE_GROUP ; \
+ Command = ".uno:LeaveGroup" ; \
+ Text [ en-US ] = "E~xit Group" ; \
+
+#define ITEM_GROUP_MENU \
+ MenuItem\
+ {\
+ Identifier = SID_MN_GROUP ; \
+ Command = ".uno:GroupMenu" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ ITEM_POPUP_GROUP\
+ };\
+ MenuItem\
+ {\
+ ITEM_POPUP_UNGROUP\
+ };\
+ MenuItem\
+ {\
+ ITEM_POPUP_ENTER_GROUP\
+ };\
+ MenuItem\
+ {\
+ ITEM_POPUP_LEAVE_GROUP\
+ };\
+ };\
+ };\
+ Text [ en-US ] = "~Group" ; \
+ };
+
+#define ITEM_DATASOURCE_ADMINISTRATION \
+ MenuItem \
+ { \
+ Identifier = SID_DATASOURCE_ADMINISTRATION ; \
+ Command = ".uno:DatasourceAdministration" ; \
+ Text [ en-US ] = "~Data Sources..." ; \
+ };
+
+#define ITEM_VIEW_DATA_SOURCE_BROWSER \
+ Identifier = SID_VIEW_DATA_SOURCE_BROWSER; \
+ Command = ".uno:ViewDataSourceBrowser" ; \
+ Text [ en-US ] = "~Data Sources" ; \
+
+/*------------------------------------------------------------------------
+ Beschreibung: Toolbar-IDs
+------------------------------------------------------------------------*/
+#define ITEM_TOOLBAR_SET_JUSTIFY_PARA \
+ Identifier = SID_ATTR_PARA_ADJUST_BLOCK ; \
+ Command = ".uno:JustifyPara" ; \
+
+#define ITEM_TOOLBAR_NEWDOCDIRECT \
+ Identifier = SID_NEWDOCDIRECT ; \
+ Command = ".uno:AddDirect" ; \
+
+#define ITEM_TOOLBAR_PRINTDOCDIRECT \
+ Identifier = SID_PRINTDOCDIRECT ; \
+ Command = ".uno:PrintDefault" ; \
+
+#define ITEM_TOOLBAR_INSERT_DRAW \
+ Identifier = SID_INSERT_DRAW ; \
+ Command = ".uno:InsertDraw" ; \
+ DropDown = TRUE ;
+
+#define ITEM_TOOLBAR_CHOOSE_CONTROLS \
+ Identifier = SID_CHOOSE_CONTROLS ; \
+ Command = ".uno:ChooseControls" ; \
+ DropDown = TRUE ;
+
+#define ITEM_TOOLBAR_AUTOSPELL_CHECK \
+ Identifier = SID_AUTOSPELL_CHECK ; \
+ Command = ".uno:SpellOnline" ; \
+
+#define ITEM_TOOLBAR_TEMPLATE_APPLY \
+ Identifier = SID_STYLE_APPLY ; \
+ Command = ".uno:StyleApply" ; \
+
+#define ITEM_TOOLBAR_ATTR_CHAR_COLOR \
+ Identifier = SID_ATTR_CHAR_COLOR ; \
+ Command = ".uno:Color" ; \
+ DropDown = TRUE ;
+
+#define ITEM_TOOLBAR_BACKGROUND_PATTERN \
+ Identifier = SID_BACKGROUND_PATTERN ; \
+ Command = ".uno:BackgroundPatternController" ; \
+ DropDown = TRUE ;
+
+#define ITEM_TOOLBAR_BACKGROUND_COLOR \
+ Identifier = SID_BACKGROUND_COLOR ; \
+ Command = ".uno:BackgroundColor" ; \
+ DropDown = TRUE ;
+
+#define ITEM_TOOLBAR_ATTR_BORDER \
+ Identifier = SID_ATTR_BORDER ; \
+ Command = ".uno:BorderStyle" ; \
+
+#define ITEM_TOOLBAR_FRAME_LINESTYLE \
+ Identifier = SID_FRAME_LINESTYLE ; \
+ Command = ".uno:LineStyle" ; \
+
+#define ITEM_TOOLBAR_FRAME_LINECOLOR \
+ Identifier = SID_FRAME_LINECOLOR ; \
+ Command = ".uno:FrameLineColor" ; \
+
+#define ITEM_TOOLBAR_SIM_START \
+ Identifier = SID_SIM_START ; \
+ Command = ".uno:LaunchStarImage" ; \
+
+#define ITEM_TOOLBAR_ATTR_LINEEND_STYLE \
+ Identifier = SID_ATTR_LINEEND_STYLE ; \
+ Command = ".uno:LineEndStyle" ; \
+ DropDown = TRUE ;
+
+#define ITEM_TOOLBAR_ATTR_LINE_STYLE \
+ Identifier = SID_ATTR_LINE_STYLE ; \
+ Command = ".uno:XLineStyle" ; \
+
+#define ITEM_TOOLBAR_ATTR_LINE_WIDTH \
+ Identifier = SID_ATTR_LINE_WIDTH ; \
+ Command = ".uno:LineWidth" ; \
+
+#define ITEM_TOOLBAR_ATTR_LINE_COLOR \
+ Identifier = SID_ATTR_LINE_COLOR ; \
+ Command = ".uno:XLineColor" ; \
+
+#define ITEM_TOOLBAR_ATTR_FILL_STYLE \
+ Identifier = SID_ATTR_FILL_STYLE ; \
+ Command = ".uno:FillStyle" ; \
+
+#define ITEM_TOOLBAR_OBJECT_ROTATE \
+ Identifier = SID_OBJECT_ROTATE ; \
+ Command = ".uno:ToggleObjectRotateMode" ; \
+
+#define ITEM_VIEW_OFFICEBAR \
+ Identifier = SID_GROUPVIEW; \
+ Command = CMD_SID_GROUPVIEW; \
+ Text [ en-US ] = "~Office Bar" ; \
+
+
+#define ITEM_TRANSLITERATE_MENU\
+ MenuItem\
+ {\
+ Identifier = SID_MN_SUB_TRANSLITERATE ; \
+ Command = ".uno:TransliterateMenu" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ Identifier = SID_TRANSLITERATE_SENTENCE_CASE; \
+ Command = ".uno:ChangeCaseToSentenceCase" ; \
+ Text [ en-US ] = "~Sentence case";\
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_TRANSLITERATE_LOWER; \
+ Command = ".uno:ChangeCaseToLower" ; \
+ Text [ en-US ] = "~lowercase";\
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_TRANSLITERATE_UPPER ; \
+ Command = ".uno:ChangeCaseToUpper" ; \
+ Text [ en-US ] = "~UPPERCASE";\
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_TRANSLITERATE_TITLE_CASE; \
+ Command = ".uno:ChangeCaseToTitleCase" ; \
+ Text [ en-US ] = "~Capitalize Every Word";\
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_TRANSLITERATE_TOGGLE_CASE; \
+ Command = ".uno:ChangeCaseToToggleCase" ; \
+ Text [ en-US ] = "~tOGGLE cASE";\
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_TRANSLITERATE_HALFWIDTH; \
+ Command = ".uno:ChangeCaseToHalfWidth" ; \
+ Text [ en-US ] = "H~alf-width";\
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_TRANSLITERATE_FULLWIDTH; \
+ Command = ".uno:ChangeCaseToFullWidth" ; \
+ Text [ en-US ] = "Full-width";\
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_TRANSLITERATE_HIRAGANA; \
+ Command = ".uno:ChangeCaseToHiragana" ; \
+ Text [ en-US ] = "~Hiragana";\
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_TRANSLITERATE_KATAGANA; \
+ Command = ".uno:ChangeCaseToKatakana" ; \
+ Text [ en-US ] = "~Katakana";\
+ };\
+ };\
+ };\
+ Text [ en-US ] = "Case/Characters";\
+ };
+
+#define ITEM_OPEN_HYPERLINK \
+ Identifier = SID_OPEN_HYPERLINK ; \
+ Command = CMD_SID_OPEN_HYPERLINK; \
+ Text [ en-US ] = "~Open Hyperlink" ; \
+
+#define ITEM_OPEN_SMARTTAGMENU \
+ Identifier = SID_OPEN_SMARTTAGMENU ; \
+ Command = CMD_SID_OPEN_SMARTTAGMENU; \
+ Text [ en-US ] = "Open ~Smart Tag Menu" ; \
+
+
+#define ITEM_OPEN_XML_FILTERSETTINGS \
+ Identifier = SID_OPEN_XML_FILTERSETTINGS ; \
+ Command = CMD_SID_OPEN_XML_FILTERSETTINGS; \
+ Text [ en-US ] = "~XML Filter Settings..."; \
+
+#define ITEM_HANGUL_HANJA_CONVERSION \
+ Identifier = SID_HANGUL_HANJA_CONVERSION; \
+ Command = CMD_SID_HANGUL_HANJA_CONVERSION; \
+ Text [ en-US ] = "Hangul/Hanja Conversion..."; \
+
+#endif // #ifndef _GLOBLMN_HRC
diff --git a/svx/inc/helpid.hrc b/svx/inc/helpid.hrc
new file mode 100644
index 000000000000..be75fe019f96
--- /dev/null
+++ b/svx/inc/helpid.hrc
@@ -0,0 +1,283 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_HELPID_HRC
+#define _SVX_HELPID_HRC
+
+#include <svx/exthelpid.hrc>
+#include <svx/svxcommands.h>
+#include <sfx2/sfxcommands.h>
+
+// Help-Ids --------------------------------------------------------------
+#define HID_ALIGN_TBX "SVX_HID_ALIGN_TBX"
+#define HID_BMPMASK_CTL_PIPETTE "SVX_HID_BMPMASK_CTL_PIPETTE"
+#define HID_BMPMASK_CTL_QCOL_1 "SVX_HID_BMPMASK_CTL_QCOL_1"
+#define HID_BMPMASK_TBI_PIPETTE "SVX_HID_BMPMASK_TBI_PIPETTE"
+#define HID_COLOR_CTL_COLORS "SVX_HID_COLOR_CTL_COLORS"
+#define HID_CONTDLG_APPLY "SVX_HID_CONTDLG_APPLY"
+#define HID_CONTDLG_AUTOCONTOUR "SVX_HID_CONTDLG_AUTOCONTOUR"
+#define HID_CONTDLG_CIRCLE "SVX_HID_CONTDLG_CIRCLE"
+#define HID_CONTDLG_FREEPOLY "SVX_HID_CONTDLG_FREEPOLY"
+#define HID_CONTDLG_GRAPHWND "SVX_HID_CONTDLG_GRAPHWND"
+#define HID_CONTDLG_PIPETTE "SVX_HID_CONTDLG_PIPETTE"
+#define HID_CONTDLG_POLY "SVX_HID_CONTDLG_POLY"
+#define HID_CONTDLG_POLYDELETE "SVX_HID_CONTDLG_POLYDELETE"
+#define HID_CONTDLG_POLYEDIT "SVX_HID_CONTDLG_POLYEDIT"
+#define HID_CONTDLG_POLYINSERT "SVX_HID_CONTDLG_POLYINSERT"
+#define HID_CONTDLG_POLYMOVE "SVX_HID_CONTDLG_POLYMOVE"
+#define HID_CONTDLG_RECT "SVX_HID_CONTDLG_RECT"
+#define HID_CONTDLG_REDO "SVX_HID_CONTDLG_REDO"
+#define HID_CONTDLG_SELECT "SVX_HID_CONTDLG_SELECT"
+#define HID_CONTDLG_TOOLBOX "SVX_HID_CONTDLG_TOOLBOX"
+#define HID_CONTDLG_UNDO "SVX_HID_CONTDLG_UNDO"
+#define HID_CONTDLG_WORKPLACE "SVX_HID_CONTDLG_WORKPLACE"
+#define HID_CTL_FONTWORK_FAVORITES "SVX_HID_CTL_FONTWORK_FAVORITES"
+#define HID_CTRL3D_HSCROLL "SVX_HID_CTRL3D_HSCROLL"
+#define HID_CTRL3D_SWITCHER "SVX_HID_CTRL3D_SWITCHER"
+#define HID_CTRL3D_VSCROLL "SVX_HID_CTRL3D_VSCROLL"
+#define HID_CTRL_COLOR "SVX_HID_CTRL_COLOR"
+#define HID_DRAWTOOL_TBX "SVX_HID_DRAWTOOL_TBX"
+#define HID_EDITENG_SPELLER_ADDWORD "SVX_HID_EDITENG_SPELLER_ADDWORD"
+#define HID_EDITENG_SPELLER_AUTOCORRECT "SVX_HID_EDITENG_SPELLER_AUTOCORRECT"
+#define HID_EDITENG_SPELLER_IGNORE "SVX_HID_EDITENG_SPELLER_IGNORE"
+#define HID_EDITENG_SPELLER_PARALANGUAGE "SVX_HID_EDITENG_SPELLER_PARALANGUAGE"
+#define HID_EDITENG_SPELLER_START "SVX_HID_EDITENG_SPELLER_START"
+#define HID_EDITENG_SPELLER_WORDLANGUAGE "SVX_HID_EDITENG_SPELLER_WORDLANGUAGE"
+#define HID_FILL_ATTR_LISTBOX "SVX_HID_FILL_ATTR_LISTBOX"
+#define HID_FILL_TYPE_LISTBOX "SVX_HID_FILL_TYPE_LISTBOX"
+#define HID_FONTWORK_CTL_FORMS "SVX_HID_FONTWORK_CTL_FORMS"
+#define HID_FONTWORK_TBI_ADJUST_AUTOSIZE "SVX_HID_FONTWORK_TBI_ADJUST_AUTOSIZE"
+#define HID_FONTWORK_TBI_ADJUST_CENTER "SVX_HID_FONTWORK_TBI_ADJUST_CENTER"
+#define HID_FONTWORK_TBI_ADJUST_LEFT "SVX_HID_FONTWORK_TBI_ADJUST_LEFT"
+#define HID_FONTWORK_TBI_ADJUST_MIRROR "SVX_HID_FONTWORK_TBI_ADJUST_MIRROR"
+#define HID_FONTWORK_TBI_ADJUST_RIGHT "SVX_HID_FONTWORK_TBI_ADJUST_RIGHT"
+#define HID_FONTWORK_TBI_OUTLINE "SVX_HID_FONTWORK_TBI_OUTLINE"
+#define HID_FONTWORK_TBI_SHADOW_NORMAL "SVX_HID_FONTWORK_TBI_SHADOW_NORMAL"
+#define HID_FONTWORK_TBI_SHADOW_OFF "SVX_HID_FONTWORK_TBI_SHADOW_OFF"
+#define HID_FONTWORK_TBI_SHADOW_SLANT "SVX_HID_FONTWORK_TBI_SHADOW_SLANT"
+#define HID_FONTWORK_TBI_SHOWFORM "SVX_HID_FONTWORK_TBI_SHOWFORM"
+#define HID_FONTWORK_TBI_STYLE_OFF "SVX_HID_FONTWORK_TBI_STYLE_OFF"
+#define HID_FONTWORK_TBI_STYLE_ROTATE "SVX_HID_FONTWORK_TBI_STYLE_ROTATE"
+#define HID_FONTWORK_TBI_STYLE_SLANTX "SVX_HID_FONTWORK_TBI_STYLE_SLANTX"
+#define HID_FONTWORK_TBI_STYLE_SLANTY "SVX_HID_FONTWORK_TBI_STYLE_SLANTY"
+#define HID_FONTWORK_TBI_STYLE_UPRIGHT "SVX_HID_FONTWORK_TBI_STYLE_UPRIGHT"
+#define HID_FORMAT_FOOTER "SVX_HID_FORMAT_FOOTER"
+#define HID_FORMAT_HEADER "SVX_HID_FORMAT_HEADER"
+// free
+#define HID_GALLERY_ICONVIEW "SVX_HID_GALLERY_ICONVIEW"
+#define HID_GALLERY_LISTVIEW "SVX_HID_GALLERY_LISTVIEW"
+#define HID_GALLERY_MN_ADD "SVX_HID_GALLERY_MN_ADD"
+#define HID_GALLERY_MN_ADDMENU "SVX_HID_GALLERY_MN_ADDMENU"
+#define HID_GALLERY_MN_ADD_LINK "SVX_HID_GALLERY_MN_ADD_LINK"
+#define HID_GALLERY_MN_BACKGROUND "SVX_HID_GALLERY_MN_BACKGROUND"
+#define HID_GALLERY_MN_COPYCLIPBOARD "SVX_HID_GALLERY_MN_COPYCLIPBOARD"
+#define HID_GALLERY_MN_DELETE "SVX_HID_GALLERY_MN_DELETE"
+#define HID_GALLERY_MN_PASTECLIPBOARD "SVX_HID_GALLERY_MN_PASTECLIPBOARD"
+#define HID_GALLERY_MN_PREVIEW "SVX_HID_GALLERY_MN_PREVIEW"
+#define HID_GALLERY_NEWTHEME "SVX_HID_GALLERY_NEWTHEME"
+#define HID_GALLERY_PREVIEW "SVX_HID_GALLERY_PREVIEW"
+#define HID_GALLERY_PROPERTIES "SVX_HID_GALLERY_PROPERTIES"
+#define HID_GALLERY_RENAME "SVX_HID_GALLERY_RENAME"
+#define HID_GALLERY_THEMELIST "SVX_HID_GALLERY_THEMELIST"
+// free
+#define HID_GALLERY_WINDOW "SVX_HID_GALLERY_WINDOW"
+#define HID_GRFFILTER "SVX_HID_GRFFILTER"
+#define HID_GRFFILTER_EMBOSS "SVX_HID_GRFFILTER_EMBOSS"
+#define HID_GRFFILTER_INVERT "SVX_HID_GRFFILTER_INVERT"
+#define HID_GRFFILTER_MOSAIC "SVX_HID_GRFFILTER_MOSAIC"
+#define HID_GRFFILTER_POPART "SVX_HID_GRFFILTER_POPART"
+#define HID_GRFFILTER_POSTER "SVX_HID_GRFFILTER_POSTER"
+#define HID_GRFFILTER_REMOVENOISE "SVX_HID_GRFFILTER_REMOVENOISE"
+#define HID_GRFFILTER_SEPIA "SVX_HID_GRFFILTER_SEPIA"
+#define HID_GRFFILTER_SHARPEN "SVX_HID_GRFFILTER_SHARPEN"
+#define HID_GRFFILTER_SMOOTH "SVX_HID_GRFFILTER_SMOOTH"
+#define HID_GRFFILTER_SOBEL "SVX_HID_GRFFILTER_SOBEL"
+#define HID_GRFFILTER_SOLARIZE "SVX_HID_GRFFILTER_SOLARIZE"
+
+#define HID_IMAPDLG_ACTIVE "SVX_HID_IMAPDLG_ACTIVE"
+#define HID_IMAPDLG_APPLY "SVX_HID_IMAPDLG_APPLY"
+#define HID_IMAPDLG_CIRCLE "SVX_HID_IMAPDLG_CIRCLE"
+#define HID_IMAPDLG_FREEPOLY "SVX_HID_IMAPDLG_FREEPOLY"
+#define HID_IMAPDLG_GRAPHWND "SVX_HID_IMAPDLG_GRAPHWND"
+#define HID_IMAPDLG_MACRO "SVX_HID_IMAPDLG_MACRO"
+#define HID_IMAPDLG_OPEN "SVX_HID_IMAPDLG_OPEN"
+#define HID_IMAPDLG_POLY "SVX_HID_IMAPDLG_POLY"
+#define HID_IMAPDLG_POLYDELETE "SVX_HID_IMAPDLG_POLYDELETE"
+#define HID_IMAPDLG_POLYEDIT "SVX_HID_IMAPDLG_POLYEDIT"
+#define HID_IMAPDLG_POLYINSERT "SVX_HID_IMAPDLG_POLYINSERT"
+#define HID_IMAPDLG_POLYMOVE "SVX_HID_IMAPDLG_POLYMOVE"
+#define HID_IMAPDLG_PROPERTY "SVX_HID_IMAPDLG_PROPERTY"
+#define HID_IMAPDLG_RECT "SVX_HID_IMAPDLG_RECT"
+#define HID_IMAPDLG_REDO "SVX_HID_IMAPDLG_REDO"
+#define HID_IMAPDLG_SAVEAS "SVX_HID_IMAPDLG_SAVEAS"
+#define HID_IMAPDLG_SELECT "SVX_HID_IMAPDLG_SELECT"
+#define HID_IMAPDLG_TOOLBOX "SVX_HID_IMAPDLG_TOOLBOX"
+#define HID_IMAPDLG_UNDO "SVX_HID_IMAPDLG_UNDO"
+#define HID_MENU_EXTRUSION_DEPTH "SVX_HID_MENU_EXTRUSION_DEPTH"
+#define HID_MENU_EXTRUSION_DIRECTION "SVX_HID_MENU_EXTRUSION_DIRECTION"
+#define HID_MENU_EXTRUSION_LIGHTING "SVX_HID_MENU_EXTRUSION_LIGHTING"
+#define HID_MENU_EXTRUSION_SURFACE "SVX_HID_MENU_EXTRUSION_SURFACE"
+#define HID_MNU_FUNC_AVG "SVX_HID_MNU_FUNC_AVG"
+#define HID_MNU_FUNC_COUNT "SVX_HID_MNU_FUNC_COUNT"
+#define HID_MNU_FUNC_COUNT2 "SVX_HID_MNU_FUNC_COUNT2"
+#define HID_MNU_FUNC_MAX "SVX_HID_MNU_FUNC_MAX"
+#define HID_MNU_FUNC_MIN "SVX_HID_MNU_FUNC_MIN"
+#define HID_MNU_FUNC_NONE "SVX_HID_MNU_FUNC_NONE"
+#define HID_MNU_FUNC_SUM "SVX_HID_MNU_FUNC_SUM"
+#define HID_MNU_ZOOM_100 "SVX_HID_MNU_ZOOM_100"
+#define HID_MNU_ZOOM_150 "SVX_HID_MNU_ZOOM_150"
+#define HID_MNU_ZOOM_200 "SVX_HID_MNU_ZOOM_200"
+#define HID_MNU_ZOOM_50 "SVX_HID_MNU_ZOOM_50"
+#define HID_MNU_ZOOM_75 "SVX_HID_MNU_ZOOM_75"
+#define HID_MNU_ZOOM_OPTIMAL "SVX_HID_MNU_ZOOM_OPTIMAL"
+#define HID_MNU_ZOOM_PAGE_WIDTH "SVX_HID_MNU_ZOOM_PAGE_WIDTH"
+#define HID_MNU_ZOOM_WHOLE_PAGE "SVX_HID_MNU_ZOOM_WHOLE_PAGE"
+#define HID_OPTIONS_GRID "SVX_HID_OPTIONS_GRID"
+#define HID_PASSWORD "SVX_HID_PASSWORD"
+#define HID_POPUP_COLOR "SVX_HID_POPUP_COLOR"
+#define HID_POPUP_COLOR_CTRL "SVX_HID_POPUP_COLOR_CTRL"
+#define HID_POPUP_EXTRUSION_DEPTH "SVX_HID_POPUP_EXTRUSION_DEPTH"
+#define HID_POPUP_EXTRUSION_DIRECTION "SVX_HID_POPUP_EXTRUSION_DIRECTION"
+#define HID_POPUP_EXTRUSION_LIGHTING "SVX_HID_POPUP_EXTRUSION_LIGHTING"
+#define HID_POPUP_EXTRUSION_SURFACE "SVX_HID_POPUP_EXTRUSION_SURFACE"
+#define HID_POPUP_FONTWORK_ALIGN "SVX_HID_POPUP_FONTWORK_ALIGN"
+#define HID_POPUP_FONTWORK_CHARSPACE "SVX_HID_POPUP_FONTWORK_CHARSPACE"
+#define HID_POPUP_FRAME "SVX_HID_POPUP_FRAME"
+#define HID_POPUP_LINE "SVX_HID_POPUP_LINE"
+#define HID_POPUP_LINEEND "SVX_HID_POPUP_LINEEND"
+#define HID_POPUP_LINEEND_CTRL "SVX_HID_POPUP_LINEEND_CTRL"
+#define HID_REDLINING_FILTER_BTN_REF "SVX_HID_REDLINING_FILTER_BTN_REF"
+#define HID_REDLINING_FILTER_CB_ACTION "SVX_HID_REDLINING_FILTER_CB_ACTION"
+#define HID_REDLINING_FILTER_CB_AUTOR "SVX_HID_REDLINING_FILTER_CB_AUTOR"
+#define HID_REDLINING_FILTER_CB_COMMENT "SVX_HID_REDLINING_FILTER_CB_COMMENT"
+#define HID_REDLINING_FILTER_CB_DATE "SVX_HID_REDLINING_FILTER_CB_DATE"
+#define HID_REDLINING_FILTER_CB_RANGE "SVX_HID_REDLINING_FILTER_CB_RANGE"
+#define HID_REDLINING_FILTER_DF_DATE "SVX_HID_REDLINING_FILTER_DF_DATE"
+#define HID_REDLINING_FILTER_DF_DATE2 "SVX_HID_REDLINING_FILTER_DF_DATE2"
+#define HID_REDLINING_FILTER_ED_COMMENT "SVX_HID_REDLINING_FILTER_ED_COMMENT"
+#define HID_REDLINING_FILTER_ED_RANGE "SVX_HID_REDLINING_FILTER_ED_RANGE"
+#define HID_REDLINING_FILTER_IB_CLOCK "SVX_HID_REDLINING_FILTER_IB_CLOCK"
+#define HID_REDLINING_FILTER_IB_CLOCK2 "SVX_HID_REDLINING_FILTER_IB_CLOCK2"
+#define HID_REDLINING_FILTER_LB_ACTION "SVX_HID_REDLINING_FILTER_LB_ACTION"
+#define HID_REDLINING_FILTER_LB_AUTOR "SVX_HID_REDLINING_FILTER_LB_AUTOR"
+#define HID_REDLINING_FILTER_LB_DATE "SVX_HID_REDLINING_FILTER_LB_DATE"
+#define HID_REDLINING_FILTER_PAGE "SVX_HID_REDLINING_FILTER_PAGE"
+#define HID_REDLINING_FILTER_TF_DATE "SVX_HID_REDLINING_FILTER_TF_DATE"
+#define HID_REDLINING_FILTER_TF_DATE2 "SVX_HID_REDLINING_FILTER_TF_DATE2"
+#define HID_REDLINING_TABCONTROL "SVX_HID_REDLINING_TABCONTROL"
+#define HID_REDLINING_VIEW_DG_VIEW "SVX_HID_REDLINING_VIEW_DG_VIEW"
+#define HID_REDLINING_VIEW_DG_VIEW_HEADER "SVX_HID_REDLINING_VIEW_DG_VIEW_HEADER"
+#define HID_REDLINING_VIEW_DG_VIEW_TABLE "SVX_HID_REDLINING_VIEW_DG_VIEW_TABLE"
+#define HID_REDLINING_VIEW_PAGE "SVX_HID_REDLINING_VIEW_PAGE"
+#define HID_REDLINING_VIEW_PB_ACCEPT "SVX_HID_REDLINING_VIEW_PB_ACCEPT"
+#define HID_REDLINING_VIEW_PB_ACCEPTALL "SVX_HID_REDLINING_VIEW_PB_ACCEPTALL"
+#define HID_REDLINING_VIEW_PB_REJECT "SVX_HID_REDLINING_VIEW_PB_REJECT"
+#define HID_REDLINING_VIEW_PB_REJECTALL "SVX_HID_REDLINING_VIEW_PB_REJECTALL"
+#define HID_REDLINING_VIEW_PB_UNDO "SVX_HID_REDLINING_VIEW_PB_UNDO"
+#define HID_RUBY_DIALOG "SVX_HID_RUBY_DIALOG"
+#define HID_STYLE_LISTBOX "SVX_HID_STYLE_LISTBOX"
+#define HID_SVXTBX_ALIGNMENT "SVX_HID_SVXTBX_ALIGNMENT"
+#define HID_SVXTBX_DRAW "SVX_HID_SVXTBX_DRAW"
+#define HID_SVXTBX_UNDO_REDO_CTRL "SVX_HID_SVXTBX_UNDO_REDO_CTRL"
+#define HID_SVX_CHINESE_DICTIONARY_CB_REVERSE "SVX_HID_SVX_CHINESE_DICTIONARY_CB_REVERSE"
+#define HID_SVX_CHINESE_DICTIONARY_LB_HEADER "SVX_HID_SVX_CHINESE_DICTIONARY_LB_HEADER"
+#define HID_SVX_CHINESE_DICTIONARY_LB_TO_SIMPLIFIED "SVX_HID_SVX_CHINESE_DICTIONARY_LB_TO_SIMPLIFIED"
+#define HID_SVX_CHINESE_DICTIONARY_LB_TO_TRADITIONAL "SVX_HID_SVX_CHINESE_DICTIONARY_LB_TO_TRADITIONAL"
+#define HID_SVX_CHINESE_DICTIONARY_RB_CONVERSION_TO_SIMPLIFIED "SVX_HID_SVX_CHINESE_DICTIONARY_RB_CONVERSION_TO_SIMPLIFIED"
+#define HID_SVX_CHINESE_DICTIONARY_RB_CONVERSION_TO_TRADITIONAL "SVX_HID_SVX_CHINESE_DICTIONARY_RB_CONVERSION_TO_TRADITIONAL"
+#define HID_SVX_CHINESE_TRANSLATION_CB_USE_VARIANTS "SVX_HID_SVX_CHINESE_TRANSLATION_CB_USE_VARIANTS"
+#define HID_SVX_CHINESE_TRANSLATION_RB_CONVERSION_TO_SIMPLIFIED "SVX_HID_SVX_CHINESE_TRANSLATION_RB_CONVERSION_TO_SIMPLIFIED"
+#define HID_SVX_CHINESE_TRANSLATION_RB_CONVERSION_TO_TRADITIONAL "SVX_HID_SVX_CHINESE_TRANSLATION_RB_CONVERSION_TO_TRADITIONAL"
+#define HID_SVX_MDLG_DOCRECOVERY_BROKEN "SVX_HID_SVX_MDLG_DOCRECOVERY_BROKEN"
+#define HID_SVX_MDLG_DOCRECOVERY_PROGR "SVX_HID_SVX_MDLG_DOCRECOVERY_PROGR"
+#define HID_SVX_MDLG_ERR_REP_OPTIONS "SVX_HID_SVX_MDLG_ERR_REP_OPTIONS"
+#define HID_SVX_MDLG_ERR_REP_PREVIEW "SVX_HID_SVX_MDLG_ERR_REP_PREVIEW"
+#define HID_SVX_TABDLG_DOCRECOVERY "SVX_HID_SVX_TABDLG_DOCRECOVERY"
+#define HID_SVX_TP_DOCRECOVERY_RECOVER "SVX_HID_SVX_TP_DOCRECOVERY_RECOVER"
+#define HID_SVX_TP_DOCRECOVERY_SAVE "SVX_HID_SVX_TP_DOCRECOVERY_SAVE"
+#define HID_SVX_TP_ERR_REP_SEND "SVX_HID_SVX_TP_ERR_REP_SEND"
+#define HID_SVX_TP_ERR_REP_WELCOME "SVX_HID_SVX_TP_ERR_REP_WELCOME"
+
+#define HID_VALUESET_EXTRUSION_DIRECTION "SVX_HID_VALUESET_EXTRUSION_DIRECTION"
+#define HID_VALUESET_EXTRUSION_LIGHTING "SVX_HID_VALUESET_EXTRUSION_LIGHTING"
+#define HID_WIN_FONTWORK_ALIGN "SVX_HID_WIN_FONTWORK_ALIGN"
+#define HID_WIN_FONTWORK_CHARSPACE "SVX_HID_WIN_FONTWORK_CHARSPACE"
+#define HID_XMLSEC_CALL "SVX_HID_XMLSEC_CALL"
+#define HID_OFA_HYPERLINK_DLG "SVX_HID_OFA_HYPERLINK_DLG"
+#define HID_OFA_HYPERLINK_NAME "SVX_HID_OFA_HYPERLINK_NAME"
+#define HID_OFA_HYPERLINK_SEARCH "SVX_HID_OFA_HYPERLINK_SEARCH"
+#define HID_OFA_HYPERLINK_TARGET "SVX_HID_OFA_HYPERLINK_TARGET"
+#define HID_OFA_HYPERLINK_URL "SVX_HID_OFA_HYPERLINK_URL"
+#define HID_OFA_HYPERLINK_URL_TXT "SVX_HID_OFA_HYPERLINK_URL_TXT"
+#define HID_AUTOCORR_DLG "SVX_HID_AUTOCORR_DLG"
+#define HID_SVXCTL_MAIL_ATTACH "SVX_HID_SVXCTL_MAIL_ATTACH"
+#define HID_SVXDLG_REGISTRATION "SVX_HID_SVXDLG_REGISTRATION"
+#define HID_SVXDLG_TREE_BASE "SVX_HID_SVXDLG_TREE_BASE"
+#define HID_SVXDLG_TREE_CHART "SVX_HID_SVXDLG_TREE_CHART"
+#define HID_SVXDLG_TREE_FILTER "SVX_HID_SVXDLG_TREE_FILTER"
+#define HID_SVXDLG_TREE_LANGUAGE "SVX_HID_SVXDLG_TREE_LANGUAGE"
+#define HID_SVXWIN_MAIL_ATTACH "SVX_HID_SVXWIN_MAIL_ATTACH"
+#define HID_SVXWIN_MAIL_HEADER "SVX_HID_SVXWIN_MAIL_HEADER"
+#define HID_SVX_DLGFORMNEW "SVX_HID_SVX_DLGFORMNEW"
+#define HID_SVX_DLGTABNEW "SVX_HID_SVX_DLGTABNEW"
+#define HID_SVX_HYPERLINK "SVX_HID_SVX_HYPERLINK"
+#define HID_SVX_MAILATTACH_ASCII_CB "SVX_HID_SVX_MAILATTACH_ASCII_CB"
+#define HID_SVX_MAILATTACH_HTML_CB "SVX_HID_SVX_MAILATTACH_HTML_CB"
+#define HID_SVX_MAILATTACH_OFFICE_CB "SVX_HID_SVX_MAILATTACH_OFFICE_CB"
+#define HID_SVX_MAILATTACH_PRIORITY_LB "SVX_HID_SVX_MAILATTACH_PRIORITY_LB"
+#define HID_SVX_MAILATTACH_RECEIPT_CB "SVX_HID_SVX_MAILATTACH_RECEIPT_CB"
+#define HID_SVX_MAILATTACH_RTF_CB "SVX_HID_SVX_MAILATTACH_RTF_CB"
+#define HID_SVX_MAILHEAD_HEAD_WIN "SVX_HID_SVX_MAILHEAD_HEAD_WIN"
+#define HID_SVX_MAILHEAD_PRIORITY_LB "SVX_HID_SVX_MAILHEAD_PRIORITY_LB"
+#define HID_SVX_MAILHEAD_PROTOCOL_LB "SVX_HID_SVX_MAILHEAD_PROTOCOL_LB"
+#define HID_SVX_MAILHEAD_RCPT_CB "SVX_HID_SVX_MAILHEAD_RCPT_CB"
+#define HID_SVX_MAILHEAD_RCPT_ED "SVX_HID_SVX_MAILHEAD_RCPT_ED"
+#define HID_SVX_MAILHEAD_RCPT_LB "SVX_HID_SVX_MAILHEAD_RCPT_LB"
+#define HID_SVX_MAILHEAD_RECEIPT_CB "SVX_HID_SVX_MAILHEAD_RECEIPT_CB"
+#define HID_SVX_MAILHEAD_ROLE_LB "SVX_HID_SVX_MAILHEAD_ROLE_LB"
+#define HID_SVX_MAILHEAD_SUBJECT_ED "SVX_HID_SVX_MAILHEAD_SUBJECT_ED"
+#define HID_SVX_MAILMENU_ADDADDRESS "SVX_HID_SVX_MAILMENU_ADDADDRESS"
+#define HID_SVX_MAILMENU_COPYLINK "SVX_HID_SVX_MAILMENU_COPYLINK"
+#define HID_SVX_MAILMENU_DELETE "SVX_HID_SVX_MAILMENU_DELETE"
+#define HID_SVX_MAILMENU_FILE "SVX_HID_SVX_MAILMENU_FILE"
+#define HID_SVX_MAILMENU_OPEN "SVX_HID_SVX_MAILMENU_OPEN"
+#define HID_SVX_MAILMENU_RENAME "SVX_HID_SVX_MAILMENU_RENAME"
+#define HID_SVX_MAILMENU_SAVEAS "SVX_HID_SVX_MAILMENU_SAVEAS"
+#define HID_SVX_MAILMENU_SIG1 "SVX_HID_SVX_MAILMENU_SIG1"
+#define HID_SVX_MAILMENU_SIG2 "SVX_HID_SVX_MAILMENU_SIG2"
+#define HID_SVX_MAILMENU_SIG3 "SVX_HID_SVX_MAILMENU_SIG3"
+#define HID_SVX_MAILMENU_SIG4 "SVX_HID_SVX_MAILMENU_SIG4"
+#define HID_SVX_MAILTOOLBOX "SVX_HID_SVX_MAILTOOLBOX"
+#define HID_SVX_SENDMENU_ENCRYPT "SVX_HID_SVX_SENDMENU_ENCRYPT"
+#define HID_SVX_SENDMENU_PLAIN "SVX_HID_SVX_SENDMENU_PLAIN"
+#define HID_SVX_SENDMENU_SIGN "SVX_HID_SVX_SENDMENU_SIGN"
+#define HID_SVX_SENDMENU_SIGNANDENCRYPT "SVX_HID_SVX_SENDMENU_SIGNANDENCRYPT"
+#define HID_SVX_TP_APPEARANCE "SVX_HID_SVX_TP_APPEARANCE"
+#define HID_SVX_TP_DESKTOP "SVX_HID_SVX_TP_DESKTOP"
+#define HID_CT_THES_ALTERNATIVES "SVX_HID_CT_THES_ALTERNATIVES"
+
+#endif
+
diff --git a/svx/inc/lightdlg.hxx b/svx/inc/lightdlg.hxx
new file mode 100644
index 000000000000..0e9afebb42b5
--- /dev/null
+++ b/svx/inc/lightdlg.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _SVX_LIGHT3D_HXX_
+#define _SVX_LIGHT3D_HXX_
+
+#include <svx/dlgctl3d.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/group.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <sfx2/basedlgs.hxx>
+
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+#include <svx/dlgctrl.hxx>
+
+/*************************************************************************
+|*
+|* 3D-Tab-Dialog
+|*
+\************************************************************************/
+
+class Svx3DTabDialog : public SfxTabDialog
+{
+private:
+ const SfxItemSet& rOutAttrs;
+
+public:
+ Svx3DTabDialog( Window* pParent, const SfxItemSet* pAttr );
+ ~Svx3DTabDialog();
+};
+
+/*************************************************************************
+|*
+|* 3D-SingleTab-Dialog
+|*
+\************************************************************************/
+class Svx3DSingleTabDialog : public SfxSingleTabDialog
+{
+private:
+ const SfxItemSet& rOutAttrs;
+
+public:
+ Svx3DSingleTabDialog( Window* pParent, const SfxItemSet* pAttr );
+ ~Svx3DSingleTabDialog();
+};
+
+#endif // _SVX_LIGHT3D_HXX_
+
diff --git a/svx/inc/pch/precompiled_svx.cxx b/svx/inc/pch/precompiled_svx.cxx
new file mode 100644
index 000000000000..71c3408c6f31
--- /dev/null
+++ b/svx/inc/pch/precompiled_svx.cxx
@@ -0,0 +1,29 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svx.hxx"
+
diff --git a/svx/inc/pch/precompiled_svx.hxx b/svx/inc/pch/precompiled_svx.hxx
new file mode 100644
index 000000000000..f6c1a594fdd5
--- /dev/null
+++ b/svx/inc/pch/precompiled_svx.hxx
@@ -0,0 +1,962 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): Generated on 2006-09-01 17:50:08.279739
+
+#ifdef PRECOMPILED_HEADERS
+//---MARKER---
+#include "sal/config.h"
+#include "avmedia/mediaitem.hxx"
+#include "avmedia/mediawindow.hxx"
+#include "basegfx/matrix/b2dhommatrix.hxx"
+#include "basegfx/numeric/ftools.hxx"
+#include "basegfx/point/b2dpoint.hxx"
+#include "basegfx/point/b3dpoint.hxx"
+#include "basegfx/polygon/b2dlinegeometry.hxx"
+#include "basegfx/polygon/b2dpolygon.hxx"
+#include "basegfx/polygon/b2dpolygontools.hxx"
+#include "basegfx/polygon/b2dpolypolygon.hxx"
+#include "basegfx/polygon/b2dpolypolygontools.hxx"
+#include "basegfx/polygon/b3dpolygon.hxx"
+#include "basegfx/polygon/b3dpolypolygon.hxx"
+#include "basegfx/polygon/b3dpolypolygontools.hxx"
+#include "basegfx/range/b2drange.hxx"
+#include "basegfx/vector/b2dvector.hxx"
+#include "basegfx/vector/b3dvector.hxx"
+#include "basic/basmgr.hxx"
+#include "basic/sbmod.hxx"
+#include "basic/sbuno.hxx"
+#include "basic/sbx.hxx"
+#include "basic/sbxvar.hxx"
+#include "boost/scoped_ptr.hpp"
+#include "boost/shared_ptr.hpp"
+#include "boost/spirit/include/classic_core.hpp"
+#include "com/sun/star/accessibility/AccessibleEventId.hpp"
+#include "com/sun/star/accessibility/AccessibleEventObject.hpp"
+#include "com/sun/star/accessibility/AccessibleRelationType.hpp"
+#include "com/sun/star/accessibility/AccessibleRole.hpp"
+#include "com/sun/star/accessibility/AccessibleStateType.hpp"
+#include "com/sun/star/accessibility/AccessibleTextType.hpp"
+#include "com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp"
+#include "com/sun/star/accessibility/TextSegment.hpp"
+#include "com/sun/star/accessibility/XAccessible.hpp"
+#include "com/sun/star/accessibility/XAccessibleAction.hpp"
+#include "com/sun/star/accessibility/XAccessibleContext.hpp"
+#include "com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp"
+#include "com/sun/star/accessibility/XAccessibleEventListener.hpp"
+#include "com/sun/star/accessibility/XAccessibleImage.hpp"
+#include "com/sun/star/accessibility/XAccessibleRelationSet.hpp"
+#include "com/sun/star/accessibility/XAccessibleSelection.hpp"
+#include "com/sun/star/accessibility/XAccessibleStateSet.hpp"
+#include "com/sun/star/accessibility/XAccessibleTable.hpp"
+#include "com/sun/star/accessibility/XAccessibleTextAttributes.hpp"
+#include "com/sun/star/accessibility/XAccessibleValue.hpp"
+#include "com/sun/star/awt/CharSet.hpp"
+#include "com/sun/star/awt/FocusChangeReason.hpp"
+#include "com/sun/star/awt/FontDescriptor.hpp"
+#include "com/sun/star/awt/FontFamily.hpp"
+#include "com/sun/star/awt/FontPitch.hpp"
+#include "com/sun/star/awt/FontSlant.hpp"
+#include "com/sun/star/awt/FontType.hpp"
+#include "com/sun/star/awt/FontWeight.hpp"
+#include "com/sun/star/awt/FontWidth.hpp"
+#include "com/sun/star/awt/Gradient.hpp"
+#include "com/sun/star/awt/GradientStyle.hpp"
+#include "com/sun/star/awt/Key.hpp"
+#include "com/sun/star/awt/KeyEvent.hpp"
+#include "com/sun/star/awt/KeyModifier.hpp"
+#include "com/sun/star/awt/LineEndFormat.hpp"
+#include "com/sun/star/awt/PosSize.hpp"
+#include "com/sun/star/awt/RasterOperation.hpp"
+#include "com/sun/star/awt/Rectangle.hpp"
+#include "com/sun/star/awt/ScrollBarOrientation.hpp"
+#include "com/sun/star/awt/SimpleFontMetric.hpp"
+#include "com/sun/star/awt/Size.hpp"
+#include "com/sun/star/awt/TextAlign.hpp"
+#include "com/sun/star/awt/VisualEffect.hpp"
+#include "com/sun/star/awt/WindowAttribute.hpp"
+#include "com/sun/star/awt/WindowDescriptor.hpp"
+#include "com/sun/star/awt/XBitmap.hpp"
+#include "com/sun/star/awt/XCheckBox.hpp"
+#include "com/sun/star/awt/XComboBox.hpp"
+#include "com/sun/star/awt/XControl.hpp"
+#include "com/sun/star/awt/XControlContainer.hpp"
+#include "com/sun/star/awt/XControlModel.hpp"
+#include "com/sun/star/awt/XDevice.hpp"
+#include "com/sun/star/awt/XFocusListener.hpp"
+#include "com/sun/star/awt/XFont.hpp"
+#include "com/sun/star/awt/XGraphics.hpp"
+#include "com/sun/star/awt/XImageConsumer.hpp"
+#include "com/sun/star/awt/XItemListener.hpp"
+#include "com/sun/star/awt/XLayoutConstrains.hpp"
+#include "com/sun/star/awt/XListBox.hpp"
+#include "com/sun/star/awt/XMouseListener.hpp"
+#include "com/sun/star/awt/XProgressMonitor.hpp"
+#include "com/sun/star/awt/XTabController.hpp"
+#include "com/sun/star/awt/XTabControllerModel.hpp"
+#include "com/sun/star/awt/XTextListener.hpp"
+#include "com/sun/star/awt/XToolkit.hpp"
+#include "com/sun/star/awt/XVclWindowPeer.hpp"
+#include "com/sun/star/awt/XWindow.hpp"
+#include "com/sun/star/awt/XWindowListener.hpp"
+#include "com/sun/star/awt/XWindowPeer.hpp"
+#include "com/sun/star/beans/NamedValue.hpp"
+#include "com/sun/star/beans/PropertyAttribute.hpp"
+#include "com/sun/star/beans/PropertyChangeEvent.hpp"
+#include "com/sun/star/beans/PropertyState.hpp"
+#include "com/sun/star/beans/PropertyValue.hpp"
+#include "com/sun/star/beans/PropertyValues.hdl"
+#include "com/sun/star/beans/PropertyValues.hpp"
+#include "com/sun/star/beans/XFastPropertySet.hpp"
+#include "com/sun/star/beans/XIntrospection.hpp"
+#include "com/sun/star/beans/XMultiPropertySet.hpp"
+#include "com/sun/star/beans/XMultiPropertyStates.hpp"
+#include "com/sun/star/beans/XPropertyChangeListener.hpp"
+#include "com/sun/star/beans/XPropertySet.hpp"
+#include "com/sun/star/beans/XPropertySetInfo.hpp"
+#include "com/sun/star/beans/XPropertyState.hpp"
+#include "com/sun/star/chart/ChartAxisArrangeOrderType.hpp"
+#include "com/sun/star/container/ContainerEvent.hpp"
+#include "com/sun/star/container/NoSuchElementException.hpp"
+#include "com/sun/star/container/XChild.hpp"
+#include "com/sun/star/container/XContainer.hpp"
+#include "com/sun/star/container/XContainerListener.hpp"
+#include "com/sun/star/container/XContainerQuery.hpp"
+#include "com/sun/star/container/XContentEnumerationAccess.hpp"
+#include "com/sun/star/container/XEnumeration.hpp"
+#include "com/sun/star/container/XEnumerationAccess.hpp"
+#include "com/sun/star/container/XHierarchicalNameAccess.hpp"
+#include "com/sun/star/container/XIdentifierContainer.hpp"
+#include "com/sun/star/container/XIndexAccess.hpp"
+#include "com/sun/star/container/XIndexContainer.hpp"
+#include "com/sun/star/container/XIndexReplace.hpp"
+#include "com/sun/star/container/XNameAccess.hpp"
+#include "com/sun/star/container/XNameContainer.hpp"
+#include "com/sun/star/container/XNameReplace.hpp"
+#include "com/sun/star/container/XNamed.hpp"
+#include "com/sun/star/container/XSet.hpp"
+#include "com/sun/star/datatransfer/DataFlavor.hpp"
+#include "com/sun/star/datatransfer/XTransferable.hpp"
+#include "com/sun/star/datatransfer/clipboard/XClipboard.hpp"
+#include "com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp"
+#include "com/sun/star/datatransfer/dnd/DNDConstants.hpp"
+#include "com/sun/star/datatransfer/dnd/XDragGestureRecognizer.hpp"
+#include "com/sun/star/datatransfer/dnd/XDropTarget.hpp"
+#include "com/sun/star/document/EventObject.hpp"
+#include "com/sun/star/document/UpdateDocMode.hpp"
+#include "com/sun/star/document/XActionLockable.hpp"
+#include "com/sun/star/document/XBinaryStreamResolver.hpp"
+#include "com/sun/star/document/XDocumentInfoSupplier.hpp"
+#include "com/sun/star/document/XEmbeddedObjectResolver.hpp"
+#include "com/sun/star/document/XEventBroadcaster.hpp"
+#include "com/sun/star/document/XEventListener.hpp"
+#include "com/sun/star/document/XEventsSupplier.hpp"
+#include "com/sun/star/document/XExporter.hpp"
+#include "com/sun/star/document/XFilter.hpp"
+#include "com/sun/star/document/XGraphicObjectResolver.hpp"
+#include "com/sun/star/document/XImporter.hpp"
+#include "com/sun/star/document/XLinkTargetSupplier.hpp"
+#include "com/sun/star/document/XMimeTypeInfo.hpp"
+#include "com/sun/star/drawing/BitmapMode.hpp"
+#include "com/sun/star/drawing/CameraGeometry.hpp"
+#include "com/sun/star/drawing/CircleKind.hpp"
+#include "com/sun/star/drawing/ColorMode.hpp"
+#include "com/sun/star/drawing/ConnectionType.hpp"
+#include "com/sun/star/drawing/ConnectorType.hpp"
+#include "com/sun/star/drawing/DashStyle.hpp"
+#include "com/sun/star/drawing/Direction3D.hpp"
+#include "com/sun/star/drawing/DoubleSequence.hpp"
+#include "com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp"
+#include "com/sun/star/drawing/EnhancedCustomShapeGluePointType.hpp"
+#include "com/sun/star/drawing/EnhancedCustomShapeParameter.hpp"
+#include "com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp"
+#include "com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp"
+#include "com/sun/star/drawing/EnhancedCustomShapeSegment.hpp"
+#include "com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp"
+#include "com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp"
+#include "com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp"
+#include "com/sun/star/drawing/FillStyle.hpp"
+#include "com/sun/star/drawing/FlagSequence.hpp"
+#include "com/sun/star/drawing/Hatch.hpp"
+#include "com/sun/star/drawing/HomogenMatrix.hpp"
+#include "com/sun/star/drawing/HomogenMatrix3.hpp"
+#include "com/sun/star/drawing/LineDash.hpp"
+#include "com/sun/star/drawing/LineJoint.hpp"
+#include "com/sun/star/drawing/LineStyle.hpp"
+#include "com/sun/star/drawing/MeasureKind.hpp"
+#include "com/sun/star/drawing/MeasureTextHorzPos.hpp"
+#include "com/sun/star/drawing/MeasureTextVertPos.hpp"
+#include "com/sun/star/drawing/NormalsKind.hpp"
+#include "com/sun/star/drawing/PolyPolygonShape3D.hpp"
+#include "com/sun/star/drawing/PolygonFlags.hpp"
+#include "com/sun/star/drawing/PolygonKind.hpp"
+#include "com/sun/star/drawing/Position3D.hpp"
+#include "com/sun/star/drawing/ProjectionMode.hpp"
+#include "com/sun/star/drawing/RectanglePoint.hpp"
+#include "com/sun/star/drawing/ShadeMode.hpp"
+#include "com/sun/star/drawing/TextAdjust.hpp"
+#include "com/sun/star/drawing/TextAnimationDirection.hpp"
+#include "com/sun/star/drawing/TextAnimationKind.hpp"
+#include "com/sun/star/drawing/TextFitToSizeType.hpp"
+#include "com/sun/star/drawing/TextHorizontalAdjust.hpp"
+#include "com/sun/star/drawing/TextVerticalAdjust.hpp"
+#include "com/sun/star/drawing/TextureKind.hpp"
+#include "com/sun/star/drawing/TextureMode.hpp"
+#include "com/sun/star/drawing/TextureProjectionMode.hpp"
+#include "com/sun/star/drawing/XGluePointsSupplier.hpp"
+#include "com/sun/star/drawing/XShapeDescriptor.hpp"
+#include "com/sun/star/embed/Aspects.hpp"
+#include "com/sun/star/embed/ElementModes.hpp"
+#include "com/sun/star/embed/EmbedMisc.hpp"
+#include "com/sun/star/embed/EmbedStates.hpp"
+#include "com/sun/star/embed/EntryInitModes.hpp"
+#include "com/sun/star/embed/NoVisualAreaSizeException.hpp"
+#include "com/sun/star/embed/XEmbedObjectCreator.hpp"
+#include "com/sun/star/embed/XEmbedObjectFactory.hpp"
+#include "com/sun/star/embed/XEmbedPersist.hpp"
+#include "com/sun/star/embed/XEmbeddedObject.hpp"
+#include "com/sun/star/embed/XInsertObjectDialog.hpp"
+#include "com/sun/star/embed/XLinkageSupport.hpp"
+#include "com/sun/star/embed/XStorage.hpp"
+#include "com/sun/star/embed/XTransactedObject.hpp"
+#include "com/sun/star/form/DatabaseDeleteEvent.hpp"
+#include "com/sun/star/form/DatabaseParameterEvent.hpp"
+#include "com/sun/star/form/ErrorEvent.hpp"
+#include "com/sun/star/form/FormButtonType.hpp"
+#include "com/sun/star/form/FormComponentType.hpp"
+#include "com/sun/star/form/ListSourceType.hpp"
+#include "com/sun/star/form/NavigationBarMode.hpp"
+#include "com/sun/star/form/TabulatorCycle.hpp"
+#include "com/sun/star/form/XBoundComponent.hpp"
+#include "com/sun/star/form/XBoundControl.hpp"
+#include "com/sun/star/form/XConfirmDeleteBroadcaster.hpp"
+#include "com/sun/star/form/XConfirmDeleteListener.hpp"
+#include "com/sun/star/form/XDatabaseParameterBroadcaster2.hpp"
+#include "com/sun/star/form/XDatabaseParameterListener.hpp"
+#include "com/sun/star/form/XForm.hpp"
+#include "com/sun/star/form/XFormComponent.hpp"
+#include "com/sun/star/form/runtime/XFormController.hpp"
+#include "com/sun/star/form/XFormControllerListener.hpp"
+#include "com/sun/star/form/XFormsSupplier.hpp"
+#include "com/sun/star/form/XFormsSupplier2.hpp"
+#include "com/sun/star/form/XGrid.hpp"
+#include "com/sun/star/form/XGridColumnFactory.hpp"
+#include "com/sun/star/form/XGridFieldDataSupplier.hpp"
+#include "com/sun/star/form/XGridPeer.hpp"
+#include "com/sun/star/form/XImageProducerSupplier.hpp"
+#include "com/sun/star/form/XLoadListener.hpp"
+#include "com/sun/star/form/XLoadable.hpp"
+#include "com/sun/star/form/XReset.hpp"
+#include "com/sun/star/form/XResetListener.hpp"
+#include "com/sun/star/form/binding/XBindableValue.hpp"
+#include "com/sun/star/form/binding/XListEntrySink.hpp"
+#include "com/sun/star/form/binding/XValueBinding.hpp"
+#include "com/sun/star/form/submission/XSubmissionSupplier.hpp"
+#include "com/sun/star/form/validation/XFormComponentValidityListener.hpp"
+#include "com/sun/star/form/validation/XValidatableFormComponent.hpp"
+#include "com/sun/star/frame/DispatchDescriptor.hpp"
+#include "com/sun/star/frame/DispatchInformation.hpp"
+#include "com/sun/star/frame/FeatureStateEvent.hpp"
+#include "com/sun/star/frame/FrameSearchFlag.hpp"
+#include "com/sun/star/frame/XComponentLoader.hpp"
+#include "com/sun/star/frame/XController.hpp"
+#include "com/sun/star/frame/XDesktop.hpp"
+#include "com/sun/star/frame/XDispatch.hpp"
+#include "com/sun/star/frame/XDispatchInformationProvider.hpp"
+#include "com/sun/star/frame/XDispatchProvider.hpp"
+#include "com/sun/star/frame/XDispatchProviderInterception.hpp"
+#include "com/sun/star/frame/XDispatchProviderInterceptor.hpp"
+#include "com/sun/star/frame/XFrame.hpp"
+#include "com/sun/star/frame/XFrameActionListener.hpp"
+#include "com/sun/star/frame/XFrames.hpp"
+#include "com/sun/star/frame/XFramesSupplier.hpp"
+#include "com/sun/star/frame/XInterceptorInfo.hpp"
+#include "com/sun/star/frame/XModel.hpp"
+#include "com/sun/star/frame/XModuleManager.hpp"
+#include "com/sun/star/frame/XStatusListener.hpp"
+#include "com/sun/star/frame/XStorable.hpp"
+#include "com/sun/star/frame/XSynchronousDispatch.hpp"
+#include "com/sun/star/frame/status/ClipboardFormats.hpp"
+#include "com/sun/star/frame/status/FontHeight.hpp"
+#include "com/sun/star/frame/status/ItemStatus.hpp"
+#include "com/sun/star/frame/status/LeftRightMargin.hpp"
+#include "com/sun/star/frame/status/UpperLowerMargin.hpp"
+#include "com/sun/star/frame/status/UpperLowerMarginScale.hpp"
+#include "com/sun/star/gallery/GalleryItemType.hpp"
+#include "com/sun/star/gallery/XGalleryItem.hpp"
+#include "com/sun/star/gallery/XGalleryTheme.hpp"
+#include "com/sun/star/gallery/XGalleryThemeProvider.hpp"
+#include "com/sun/star/graphic/XGraphic.hpp"
+#include "com/sun/star/graphic/XGraphicProvider.hpp"
+#include "com/sun/star/graphic/XGraphicRenderer.hpp"
+#include "com/sun/star/i18n/CharacterIteratorMode.hdl"
+#include "com/sun/star/i18n/CharacterIteratorMode.hpp"
+#include "com/sun/star/i18n/CollatorOptions.hpp"
+#include "com/sun/star/i18n/ForbiddenCharacters.hpp"
+#include "com/sun/star/i18n/InputSequenceCheckMode.hpp"
+#include "com/sun/star/i18n/KCharacterType.hpp"
+#include "com/sun/star/i18n/ScriptType.hdl"
+#include "com/sun/star/i18n/ScriptType.hpp"
+#include "com/sun/star/i18n/TextConversionOption.hdl"
+#include "com/sun/star/i18n/TextConversionOption.hpp"
+#include "com/sun/star/i18n/TextConversionType.hpp"
+#include "com/sun/star/i18n/TransliterationModules.hpp"
+#include "com/sun/star/i18n/UnicodeScript.hpp"
+#include "com/sun/star/i18n/UnicodeType.hdl"
+#include "com/sun/star/i18n/WordType.hpp"
+#include "com/sun/star/i18n/XBreakIterator.hpp"
+#include "com/sun/star/i18n/XExtendedInputSequenceChecker.hpp"
+#include "com/sun/star/i18n/XExtendedTextConversion.hpp"
+#include "com/sun/star/i18n/XForbiddenCharacters.hpp"
+#include "com/sun/star/i18n/XTextConversion.hpp"
+#include "com/sun/star/inspection/XObjectInspector.hpp"
+#include "com/sun/star/inspection/XObjectInspectorModel.hpp"
+#include "com/sun/star/io/IOException.hpp"
+#include "com/sun/star/io/XActiveDataControl.hpp"
+#include "com/sun/star/io/XActiveDataSink.hpp"
+#include "com/sun/star/io/XActiveDataSource.hpp"
+#include "com/sun/star/io/XInputStream.hpp"
+#include "com/sun/star/io/XInputStreamProvider.hpp"
+#include "com/sun/star/io/XMarkableStream.hpp"
+#include "com/sun/star/io/XObjectInputStream.hpp"
+#include "com/sun/star/io/XObjectOutputStream.hpp"
+#include "com/sun/star/io/XOutputStream.hpp"
+#include "com/sun/star/io/XPersistObject.hpp"
+#include "com/sun/star/io/XSeekable.hdl"
+#include "com/sun/star/io/XStream.hpp"
+#include "com/sun/star/lang/DisposedException.hpp"
+#include "com/sun/star/lang/EventObject.hpp"
+#include "com/sun/star/lang/IllegalArgumentException.hpp"
+#include "com/sun/star/lang/IndexOutOfBoundsException.hpp"
+#include "com/sun/star/lang/Locale.hpp"
+#include "com/sun/star/lang/NoSupportException.hpp"
+#include "com/sun/star/lang/ServiceNotRegisteredException.hpp"
+#include "com/sun/star/lang/XComponent.hpp"
+#include "com/sun/star/lang/XEventListener.hpp"
+#include "com/sun/star/lang/XInitialization.hpp"
+#include "com/sun/star/lang/XMultiComponentFactory.hpp"
+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "com/sun/star/lang/XServiceDisplayName.hpp"
+#include "com/sun/star/lang/XServiceInfo.hpp"
+#include "com/sun/star/lang/XServiceName.hpp"
+#include "com/sun/star/lang/XSingleComponentFactory.hpp"
+#include "com/sun/star/lang/XTypeProvider.hpp"
+#include "com/sun/star/lang/XUnoTunnel.hpp"
+#include "com/sun/star/linguistic2/ConversionDictionaryType.hpp"
+#include "com/sun/star/linguistic2/ConversionDirection.hdl"
+#include "com/sun/star/linguistic2/ConversionPropertyType.hpp"
+#include "com/sun/star/linguistic2/DictionaryEvent.hpp"
+#include "com/sun/star/linguistic2/DictionaryEventFlags.hpp"
+#include "com/sun/star/linguistic2/DictionaryListEvent.hpp"
+#include "com/sun/star/linguistic2/DictionaryListEventFlags.hpp"
+#include "com/sun/star/linguistic2/DictionaryType.hpp"
+#include "com/sun/star/linguistic2/SpellFailure.hpp"
+#include "com/sun/star/linguistic2/XAvailableLocales.hpp"
+#include "com/sun/star/linguistic2/XConversionDictionary.hpp"
+#include "com/sun/star/linguistic2/XConversionDictionaryList.hpp"
+#include "com/sun/star/linguistic2/XConversionPropertyType.hpp"
+#include "com/sun/star/linguistic2/XDictionary.hpp"
+#include "com/sun/star/linguistic2/XDictionary1.hpp"
+#include "com/sun/star/linguistic2/XDictionaryEntry.hpp"
+#include "com/sun/star/linguistic2/XDictionaryEventListener.hpp"
+#include "com/sun/star/linguistic2/XDictionaryList.hpp"
+#include "com/sun/star/linguistic2/XDictionaryListEventListener.hpp"
+#include "com/sun/star/linguistic2/XHyphenatedWord.hpp"
+#include "com/sun/star/linguistic2/XHyphenator.hpp"
+#include "com/sun/star/linguistic2/XLinguServiceManager.hdl"
+#include "com/sun/star/linguistic2/XLinguServiceManager.hpp"
+#include "com/sun/star/linguistic2/XMeaning.hpp"
+#include "com/sun/star/linguistic2/XPossibleHyphens.hpp"
+#include "com/sun/star/linguistic2/XSpellAlternatives.hpp"
+#include "com/sun/star/linguistic2/XSpellChecker.hpp"
+#include "com/sun/star/linguistic2/XSpellChecker1.hpp"
+#include "com/sun/star/linguistic2/XSupportedLocales.hpp"
+#include "com/sun/star/linguistic2/XThesaurus.hpp"
+#include "com/sun/star/media/XPlayer.hpp"
+#include "com/sun/star/media/ZoomLevel.hpp"
+#include "com/sun/star/plugin/PluginDescription.hpp"
+#include "com/sun/star/plugin/XPluginManager.hpp"
+#include "com/sun/star/reflection/XIdlClass.hpp"
+#include "com/sun/star/reflection/XIdlMethod.hpp"
+#include "com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp"
+#include "com/sun/star/reflection/XProxyFactory.hpp"
+#include "com/sun/star/registry/XRegistryKey.hpp"
+#include "com/sun/star/registry/XSimpleRegistry.hpp"
+#include "com/sun/star/script/ScriptEvent.hpp"
+#include "com/sun/star/script/ScriptEventDescriptor.hpp"
+#include "com/sun/star/script/XEventAttacherManager.hpp"
+#include "com/sun/star/script/XInvocation.hpp"
+#include "com/sun/star/script/XLibraryContainer.hpp"
+#include "com/sun/star/script/XScriptListener.hpp"
+#include "com/sun/star/script/XTypeConverter.hpp"
+#include "com/sun/star/script/browse/BrowseNodeFactoryViewTypes.hpp"
+#include "com/sun/star/script/browse/BrowseNodeTypes.hpp"
+#include "com/sun/star/script/browse/XBrowseNode.hpp"
+#include "com/sun/star/script/browse/XBrowseNodeFactory.hpp"
+#include "com/sun/star/script/provider/ScriptErrorRaisedException.hpp"
+#include "com/sun/star/script/provider/ScriptExceptionRaisedException.hpp"
+#include "com/sun/star/script/provider/ScriptFrameworkErrorType.hpp"
+#include "com/sun/star/script/provider/XScriptProvider.hpp"
+#include "com/sun/star/script/provider/XScriptProviderSupplier.hpp"
+#include "com/sun/star/sdb/CommandType.hpp"
+#include "com/sun/star/sdb/ParametersRequest.hpp"
+#include "com/sun/star/sdb/RowChangeAction.hpp"
+#include "com/sun/star/sdb/RowChangeEvent.hpp"
+#include "com/sun/star/sdb/SQLContext.hpp"
+#include "com/sun/star/sdb/SQLErrorEvent.hpp"
+#include "com/sun/star/sdb/XColumn.hpp"
+#include "com/sun/star/sdb/XColumnUpdate.hpp"
+#include "com/sun/star/sdb/XCompletedConnection.hpp"
+#include "com/sun/star/sdb/XInteractionSupplyParameters.hpp"
+#include "com/sun/star/sdb/XQueriesSupplier.hpp"
+#include "com/sun/star/sdb/XResultSetAccess.hpp"
+#include "com/sun/star/sdb/XRowSetApproveBroadcaster.hpp"
+#include "com/sun/star/sdb/XRowSetApproveListener.hpp"
+#include "com/sun/star/sdb/XRowSetSupplier.hpp"
+#include "com/sun/star/sdb/XSQLErrorBroadcaster.hpp"
+#include "com/sun/star/sdb/XSQLErrorListener.hpp"
+#include "com/sun/star/sdb/XSQLQueryComposer.hpp"
+#include "com/sun/star/sdb/XSQLQueryComposerFactory.hpp"
+#include "com/sun/star/sdb/XSingleSelectQueryComposer.hpp"
+#include "com/sun/star/sdbc/ColumnValue.hpp"
+#include "com/sun/star/sdbc/DataType.hpp"
+#include "com/sun/star/sdbc/ResultSetConcurrency.hpp"
+#include "com/sun/star/sdbc/ResultSetType.hpp"
+#include "com/sun/star/sdbc/XConnection.hpp"
+#include "com/sun/star/sdbc/XDataSource.hpp"
+#include "com/sun/star/sdbc/XDatabaseMetaData.hpp"
+#include "com/sun/star/sdbc/XPreparedStatement.hpp"
+#include "com/sun/star/sdbc/XResultSet.hpp"
+#include "com/sun/star/sdbc/XResultSetUpdate.hpp"
+#include "com/sun/star/sdbc/XRow.hpp"
+#include "com/sun/star/sdbc/XRowSet.hpp"
+#include "com/sun/star/sdbc/XRowSetListener.hpp"
+#include "com/sun/star/sdbc/XStatement.hpp"
+#include "com/sun/star/sdbcx/Privilege.hpp"
+#include "com/sun/star/sdbcx/XColumnsSupplier.hpp"
+#include "com/sun/star/sdbcx/XDataDescriptorFactory.hpp"
+#include "com/sun/star/sdbcx/XDeleteRows.hpp"
+#include "com/sun/star/sdbcx/XRowLocate.hpp"
+#include "com/sun/star/sdbcx/XTablesSupplier.hpp"
+#include "com/sun/star/security/XDocumentDigitalSignatures.hpp"
+#include "com/sun/star/style/BreakType.hpp"
+#include "com/sun/star/style/CaseMap.hpp"
+#include "com/sun/star/style/GraphicLocation.hpp"
+#include "com/sun/star/style/LineSpacing.hpp"
+#include "com/sun/star/style/LineSpacingMode.hpp"
+#include "com/sun/star/style/NumberingType.hpp"
+#include "com/sun/star/style/PageStyleLayout.hpp"
+#include "com/sun/star/style/ParagraphAdjust.hpp"
+#include "com/sun/star/style/TabStop.hpp"
+#include "com/sun/star/style/VerticalAlignment.hpp"
+#include "com/sun/star/style/XStyle.hpp"
+#include "com/sun/star/style/XStyleFamiliesSupplier.hpp"
+#include "com/sun/star/table/BorderLine.hpp"
+#include "com/sun/star/table/CellAddress.hpp"
+#include "com/sun/star/table/CellContentType.hpp"
+#include "com/sun/star/table/CellHoriJustify.hpp"
+#include "com/sun/star/table/CellOrientation.hpp"
+#include "com/sun/star/table/CellRangeAddress.hpp"
+#include "com/sun/star/table/CellVertJustify.hpp"
+#include "com/sun/star/table/ShadowFormat.hpp"
+#include "com/sun/star/table/ShadowLocation.hpp"
+#include "com/sun/star/table/TableBorder.hpp"
+#include "com/sun/star/table/TableOrientation.hpp"
+#include "com/sun/star/task/XInteractionHandler.hpp"
+#include "com/sun/star/task/XStatusIndicator.hpp"
+#include "com/sun/star/task/XStatusIndicatorFactory.hpp"
+#include "com/sun/star/text/CharacterCompressionType.hpp"
+#include "com/sun/star/text/ControlCharacter.hpp"
+#include "com/sun/star/text/FilenameDisplayFormat.hpp"
+#include "com/sun/star/text/FontEmphasis.hpp"
+#include "com/sun/star/text/GraphicCrop.hpp"
+#include "com/sun/star/text/HoriOrientation.hpp"
+#include "com/sun/star/text/RelOrientation.hpp"
+#include "com/sun/star/text/RubyAdjust.hpp"
+#include "com/sun/star/text/TextContentAnchorType.hpp"
+#include "com/sun/star/text/VertOrientation.hpp"
+#include "com/sun/star/text/WrapTextMode.hpp"
+#include "com/sun/star/text/WritingMode.hpp"
+#include "com/sun/star/text/WritingMode2.hpp"
+#include "com/sun/star/text/XDefaultNumberingProvider.hpp"
+#include "com/sun/star/text/XNumberingFormatter.hpp"
+#include "com/sun/star/text/XNumberingTypeInfo.hpp"
+#include "com/sun/star/text/XRubySelection.hpp"
+#include "com/sun/star/text/XSimpleText.hpp"
+#include "com/sun/star/text/XText.hpp"
+#include "com/sun/star/text/XTextContent.hpp"
+#include "com/sun/star/text/XTextCursor.hpp"
+#include "com/sun/star/text/XTextField.hdl"
+#include "com/sun/star/text/XTextField.hpp"
+#include "com/sun/star/text/XTextRange.hpp"
+#include "com/sun/star/text/XTextRangeCompare.hpp"
+#include "com/sun/star/text/XTextRangeMover.hpp"
+#include "com/sun/star/ucb/CommandAbortedException.hpp"
+#include "com/sun/star/ucb/NameClash.hpp"
+#include "com/sun/star/ucb/NumberedSortingInfo.hpp"
+#include "com/sun/star/ucb/TransferInfo.hpp"
+#include "com/sun/star/ucb/XAnyCompare.hpp"
+#include "com/sun/star/ucb/XAnyCompareFactory.hpp"
+#include "com/sun/star/ucb/XCommandEnvironment.hpp"
+#include "com/sun/star/ucb/XContent.hpp"
+#include "com/sun/star/ucb/XContentAccess.hpp"
+#include "com/sun/star/ucb/XContentProvider.hpp"
+#include "com/sun/star/ucb/XSimpleFileAccess.hpp"
+#include "com/sun/star/ucb/XSortedDynamicResultSetFactory.hpp"
+#include "com/sun/star/ui/ImageType.hpp"
+#include "com/sun/star/ui/ItemStyle.hpp"
+#include "com/sun/star/ui/ItemType.hpp"
+#include "com/sun/star/ui/UIElementType.hpp"
+#include "com/sun/star/ui/XImageManager.hpp"
+#include "com/sun/star/ui/XModuleUIConfigurationManager.hpp"
+#include "com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp"
+#include "com/sun/star/ui/XUIConfiguration.hpp"
+#include "com/sun/star/ui/XUIConfigurationListener.hpp"
+#include "com/sun/star/ui/XUIConfigurationManager.hpp"
+#include "com/sun/star/ui/XUIConfigurationManagerSupplier.hpp"
+#include "com/sun/star/ui/XUIConfigurationPersistence.hpp"
+#include "com/sun/star/ui/XUIConfigurationStorage.hpp"
+#include "com/sun/star/ui/XUIElement.hpp"
+#include "com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp"
+#include "com/sun/star/ui/dialogs/ExecutableDialogResults.hpp"
+#include "com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp"
+#include "com/sun/star/ui/dialogs/FilePreviewImageFormats.hpp"
+#include "com/sun/star/ui/dialogs/ListboxControlActions.hpp"
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+#include "com/sun/star/ui/dialogs/XExecutableDialog.hpp"
+#include "com/sun/star/ui/dialogs/XFilePicker.hpp"
+#include "com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp"
+#include "com/sun/star/ui/dialogs/XFilePickerListener.hpp"
+#include "com/sun/star/ui/dialogs/XFilePickerNotifier.hpp"
+#include "com/sun/star/ui/dialogs/XFilePreview.hpp"
+#include "com/sun/star/ui/dialogs/XFilterManager.hpp"
+#include "com/sun/star/ui/dialogs/XFolderPicker.hpp"
+#include "com/sun/star/uno/Any.h"
+#include "com/sun/star/uno/Any.hxx"
+#include "com/sun/star/uno/Exception.hpp"
+#include "com/sun/star/uno/Reference.h"
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "com/sun/star/uno/Sequence.h"
+#include "com/sun/star/uno/Sequence.hxx"
+#include "com/sun/star/uno/Type.h"
+#include "com/sun/star/uno/XAggregation.hpp"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "com/sun/star/uno/XNamingService.hpp"
+#include "com/sun/star/util/Date.hpp"
+#include "com/sun/star/util/DateTime.hpp"
+#include "com/sun/star/util/Language.hpp"
+#include "com/sun/star/util/MeasureUnit.hpp"
+#include "com/sun/star/util/NumberFormat.hpp"
+#include "com/sun/star/util/SearchAlgorithms.hpp"
+#include "com/sun/star/util/SearchFlags.hpp"
+#include "com/sun/star/util/SearchOptions.hpp"
+#include "com/sun/star/util/SearchResult.hpp"
+#include "com/sun/star/util/SortField.hpp"
+#include "com/sun/star/util/SortFieldType.hpp"
+#include "com/sun/star/util/URL.hpp"
+#include "com/sun/star/util/XCancellable.hpp"
+#include "com/sun/star/util/XChangesBatch.hpp"
+#include "com/sun/star/util/XCloneable.hpp"
+#include "com/sun/star/util/XCloseable.hpp"
+#include "com/sun/star/util/XFlushable.hpp"
+#include "com/sun/star/util/XLocalizedAliases.hpp"
+#include "com/sun/star/util/XModeChangeBroadcaster.hpp"
+#include "com/sun/star/util/XModeChangeListener.hpp"
+#include "com/sun/star/util/XModeSelector.hpp"
+#include "com/sun/star/util/XModifiable.hpp"
+#include "com/sun/star/util/XModifyBroadcaster.hpp"
+#include "com/sun/star/util/XModifyListener.hpp"
+#include "com/sun/star/util/XNumberFormatTypes.hpp"
+#include "com/sun/star/util/XNumberFormats.hpp"
+#include "com/sun/star/util/XNumberFormatsSupplier.hpp"
+#include "com/sun/star/util/XNumberFormatter.hpp"
+#include "com/sun/star/util/XTextSearch.hpp"
+#include "com/sun/star/util/XURLTransformer.hpp"
+#include "com/sun/star/util/logging/LogLevel.hpp"
+#include "com/sun/star/util/logging/XLogger.hpp"
+#include "com/sun/star/view/XSelectionChangeListener.hpp"
+#include "com/sun/star/view/XSelectionSupplier.hpp"
+#include "com/sun/star/xforms/XFormsSupplier.hpp"
+#include "com/sun/star/xforms/XFormsUIHelper1.hpp"
+#include "com/sun/star/xforms/XModel.hpp"
+#include "com/sun/star/xforms/XSubmission.hpp"
+#include "com/sun/star/xml/AttributeData.hpp"
+#include "com/sun/star/xml/dom/DOMException.hpp"
+#include "com/sun/star/xml/dom/XDocument.hpp"
+#include "com/sun/star/xml/dom/XNode.hpp"
+#include "com/sun/star/xml/dom/events/XEventListener.hpp"
+#include "com/sun/star/xml/dom/events/XEventTarget.hpp"
+#include "com/sun/star/xml/sax/InputSource.hpp"
+#include "com/sun/star/xml/sax/SAXParseException.hpp"
+#include "com/sun/star/xml/sax/XAttributeList.hpp"
+#include "com/sun/star/xml/sax/XDocumentHandler.hpp"
+#include "com/sun/star/xml/sax/XParser.hpp"
+#include "comphelper/accessibleeventnotifier.hxx"
+#include "comphelper/anytostring.hxx"
+#include "comphelper/broadcasthelper.hxx"
+#include "comphelper/componentcontext.hxx"
+#include "comphelper/configurationhelper.hxx"
+#include "comphelper/container.hxx"
+#include "comphelper/embeddedobjectcontainer.hxx"
+#include "comphelper/enumhelper.hxx"
+#include "comphelper/implementationreference.hxx"
+#include "comphelper/interaction.hxx"
+#include "comphelper/numbers.hxx"
+#include "comphelper/processfactory.hxx"
+#include "comphelper/propertycontainer.hxx"
+#include "comphelper/propertysethelper.hxx"
+#include "comphelper/regpathhelper.hxx"
+#include "comphelper/scopeguard.hxx"
+#include "comphelper/seqstream.hxx"
+#include "comphelper/sequence.hxx"
+#include "comphelper/sequenceashashmap.hxx"
+#include "comphelper/sequenceasvector.hxx"
+#include "comphelper/servicehelper.hxx"
+#include "comphelper/storagehelper.hxx"
+#include "comphelper/types.hxx"
+#include "comphelper/uno3.hxx"
+#include "connectivity/IParseContext.hxx"
+#include "connectivity/dbexception.hxx"
+#include "connectivity/sqlnode.hxx"
+#include "connectivity/sqlparse.hxx"
+#include "cppuhelper/bootstrap.hxx"
+#include "cppuhelper/compbase12.hxx"
+#include "cppuhelper/compbase2.hxx"
+#include "cppuhelper/compbase3.hxx"
+#include "cppuhelper/compbase4.hxx"
+#include "cppuhelper/compbase6.hxx"
+#include "cppuhelper/compbase7.hxx"
+#include "cppuhelper/component.hxx"
+#include "cppuhelper/component_context.hxx"
+#include "cppuhelper/exc_hlp.hxx"
+#include "cppuhelper/factory.hxx"
+#include "cppuhelper/implbase1.hxx"
+#include "cppuhelper/implbase11.hxx"
+#include "cppuhelper/implbase12.hxx"
+#include "cppuhelper/implbase2.hxx"
+#include "cppuhelper/implbase3.hxx"
+#include "cppuhelper/implbase4.hxx"
+#include "cppuhelper/implbase5.hxx"
+#include "cppuhelper/implbase6.hxx"
+#include "cppuhelper/implbase8.hxx"
+#include "cppuhelper/implementationentry.hxx"
+#include "cppuhelper/interfacecontainer.h"
+#include "cppuhelper/interfacecontainer.hxx"
+#include "cppuhelper/propshlp.hxx"
+#include "cppuhelper/queryinterface.hxx"
+#include "cppuhelper/servicefactory.hxx"
+#include "cppuhelper/typeprovider.hxx"
+#include "cppuhelper/weak.hxx"
+#include "cppuhelper/weakagg.hxx"
+#include "cppuhelper/weakref.hxx"
+#include "i18npool/lang.h"
+#include "i18npool/mslangid.hxx"
+#include "jvmfwk/framework.h"
+#include "linguistic/lngprops.hxx"
+#include "osl/diagnose.h"
+#include "osl/endian.h"
+#include "osl/file.hxx"
+#include "osl/interlck.h"
+#include "osl/module.h"
+#include "osl/module.hxx"
+#include "osl/mutex.hxx"
+#include "osl/nlsupport.h"
+#include "osl/process.h"
+#include "osl/security.hxx"
+#include "rsc/rscsfx.hxx"
+#include "rtl/bootstrap.hxx"
+#include "rtl/cipher.h"
+#include "rtl/crc.h"
+#include "rtl/digest.h"
+#include "rtl/locale.h"
+#include "rtl/logfile.hxx"
+#include "rtl/math.hxx"
+#include "rtl/memory.h"
+#include "rtl/tencinfo.h"
+#include "rtl/textenc.h"
+#include "rtl/ustrbuf.hxx"
+#include "rtl/ustring.hxx"
+#include "rtl/uuid.h"
+#include "sal/config.h"
+#include "sal/main.h"
+#include "sal/types.h"
+#include "sfx2/bindings.hxx"
+#include "sfx2/ctrlitem.hxx"
+#include "sfx2/dispatch.hxx"
+#include "sfx2/docfilt.hxx"
+#include "sfx2/event.hxx"
+#include "sfx2/frame.hxx"
+#include "sfx2/frmdescr.hxx"
+#include "sfx2/imagemgr.hxx"
+#include "sfx2/imgmgr.hxx"
+#include "sfx2/linkmgr.hxx"
+#include "sfx2/linksrc.hxx"
+#include "sfx2/lnkbase.hxx"
+#include "sfx2/minarray.hxx"
+#include "sfx2/minfitem.hxx"
+#include "sfx2/mnuitem.hxx"
+#include "sfx2/module.hxx"
+#include "sfx2/msg.hxx"
+#include "sfx2/msgpool.hxx"
+#include "sfx2/objface.hxx"
+#include "sfx2/objitem.hxx"
+#include "sfx2/progress.hxx"
+#include "sfx2/querystatus.hxx"
+#include "sfx2/request.hxx"
+#include "sfx2/sfxdefs.hxx"
+#include "sfx2/sfxdlg.hxx"
+#include "sfx2/sfxhelp.hxx"
+#include "sfx2/sfxhtml.hxx"
+#include "sfx2/sfxstatuslistener.hxx"
+#include "sfx2/sfxuno.hxx"
+#include "sfx2/shell.hxx"
+#include "svl/srchdefs.hxx"
+#include "sfx2/tplpitem.hxx"
+#include "sfx2/viewfrm.hxx"
+#include "sot/clsids.hxx"
+#include "sot/exchange.hxx"
+#include "sot/factory.hxx"
+#include "sot/formats.hxx"
+#include <map>
+#include <set>
+#include <slist>
+#include <vector>
+#include "svtools/FilterConfigItem.hxx"
+#include "svtools/accessibilityoptions.hxx"
+#include "svl/adrparse.hxx"
+#include "svtools/apearcfg.hxx"
+#include "svl/brdcst.hxx"
+#include "unotools/cacheoptions.hxx"
+#include "svl/cjkoptions.hxx"
+#include "unotools/cmdoptions.hxx"
+#include "svl/cntwall.hxx"
+#include "svtools/colorcfg.hxx"
+#include "svl/ctloptions.hxx"
+#include "unotools/defaultoptions.hxx"
+#include "unotools/dynamicmenuoptions.hxx"
+#include "svtools/ehdl.hxx"
+#include "svl/eitem.hxx"
+#include "unotools/eventcfg.hxx"
+#include "unotools/extendedsecurityoptions.hxx"
+#include "svl/filenotation.hxx"
+#include "svl/flagitem.hxx"
+#include "unotools/fltrcfg.hxx"
+#include "unotools/fontoptions.hxx"
+#include "svtools/fontsubstconfig.hxx"
+#include "svtools/helpopt.hxx"
+#include "svl/hint.hxx"
+#include "svtools/htmlkywd.hxx"
+#include "svtools/htmltokn.h"
+#include "svtools/imagemgr.hxx"
+#include "svtools/imapcirc.hxx"
+#include "svtools/imapobj.hxx"
+#include "svtools/imappoly.hxx"
+#include "svtools/imaprect.hxx"
+#include "svtools/inetimg.hxx"
+#include "unotools/inetoptions.hxx"
+#include "svl/intitem.hxx"
+#include "svl/isethint.hxx"
+#include "svl/itemiter.hxx"
+#include "svl/itempool.hxx"
+#include "svl/itemprop.hxx"
+#include "svl/itemset.hxx"
+#include "unotools/javaoptions.hxx"
+#include "svl/languageoptions.hxx"
+#include "unotools/lingucfg.hxx"
+#include "unotools/linguprops.hxx"
+#include "svl/lngmisc.hxx"
+#include "svtools/localresaccess.hxx"
+#include "svl/lstner.hxx"
+#include "svl/macitem.hxx"
+#include "svtools/menuoptions.hxx"
+#include "svl/metitem.hxx"
+#include "unotools/misccfg.hxx"
+#include "svtools/miscopt.hxx"
+#include "unotools/moduleoptions.hxx"
+#include "svl/numuno.hxx"
+#include "unotools/optionsdlg.hxx"
+#include "svtools/parhtml.hxx"
+#include "svtools/parrtf.hxx"
+#include "unotools/pathoptions.hxx"
+#include "svl/poolitem.hxx"
+#include "unotools/printwarningoptions.hxx"
+#include "svl/ptitem.hxx"
+#include "svl/rectitem.hxx"
+#include "svl/rngitem.hxx"
+#include "svtools/rtfkeywd.hxx"
+#include "svtools/rtfout.hxx"
+#include "svtools/rtftoken.h"
+#include "unotools/saveopt.hxx"
+#include "unotools/searchopt.hxx"
+#include "unotools/securityoptions.hxx"
+#include "svl/sfontitm.hxx"
+#include "svl/slstitm.hxx"
+#include "svl/smplhint.hxx"
+#include "svtools/soerr.hxx"
+#include "unotools/sourceviewconfig.hxx"
+#include "unotools/startoptions.hxx"
+#include "svtools/stdmenu.hxx"
+#include "svtools/stringtransfer.hxx"
+#include "svl/stritem.hxx"
+#include "svl/style.hxx"
+#include "svl/svarray.hxx"
+#include "svl/svstdarr.hxx"
+#include "unotools/syslocaleoptions.hxx"
+#include "svl/szitem.hxx"
+#include "svtools/textdata.hxx"
+#include "svtools/transfer.hxx"
+#include "svtools/txtcmp.hxx"
+#include "svl/undo.hxx"
+#include "unotools/undoopt.hxx"
+#include "svtools/unoevent.hxx"
+#include "svtools/unoimap.hxx"
+#include "svl/urihelper.hxx"
+#include "svl/urlbmk.hxx"
+#include "unotools/useroptions.hxx"
+#include "unotools/viewoptions.hxx"
+#include "svl/visitem.hxx"
+#include "svl/whiter.hxx"
+#include "sys/stat.h"
+#include "sys/types.h"
+#include "toolkit/awt/vclxdevice.hxx"
+#include "toolkit/controls/unocontrol.hxx"
+#include "tools/bigint.hxx"
+#include "tools/color.hxx"
+#include "tools/config.hxx"
+#include "tools/contnr.hxx"
+#include "tools/debug.hxx"
+#include "tools/diagnose_ex.h"
+#include "tools/dynary.hxx"
+#include "tools/errcode.hxx"
+#include "tools/errinf.hxx"
+#include "tools/fract.hxx"
+#include "tools/gen.hxx"
+#include "tools/globname.hxx"
+#include "tools/inetdef.hxx"
+#include "tools/line.hxx"
+#include "tools/link.hxx"
+#include "tools/list.hxx"
+#include "tools/multisel.hxx"
+#include "tools/poly.hxx"
+#include "tools/rc.h"
+#include "tools/rc.hxx"
+#include "tools/rcid.h"
+#include "tools/ref.hxx"
+#include "tools/resary.hxx"
+#include "tools/resid.hxx"
+#include "tools/resmgr.hxx"
+#include "tools/rtti.hxx"
+#include "tools/shl.hxx"
+#include "tools/solar.h"
+#include "tools/stack.hxx"
+#include "tools/string.hxx"
+#include "tools/table.hxx"
+#include "tools/tenccvt.hxx"
+#include "tools/urlobj.hxx"
+#include "tools/vcompat.hxx"
+#include "tools/vector2d.hxx"
+#include "tools/weakbase.hxx"
+#include "tools/wldcrd.hxx"
+#include "tools/zcodec.hxx"
+#include "ucbhelper/commandenvironment.hxx"
+#include "ucbhelper/configurationkeys.hxx"
+#include "ucbhelper/content.hxx"
+#include "ucbhelper/contentbroker.hxx"
+#include "unicode/ubidi.h"
+#include "uno/lbnames.h"
+#include "uno/mapping.hxx"
+#include "unotools/accessiblerelationsethelper.hxx"
+#include "unotools/accessiblestatesethelper.hxx"
+#include "unotools/bootstrap.hxx"
+#include "unotools/charclass.hxx"
+#include "unotools/collatorwrapper.hxx"
+#include "unotools/configitem.hxx"
+#include "unotools/configmgr.hxx"
+#include "unotools/confignode.hxx"
+#include "unotools/configpathes.hxx"
+#include "unotools/configvaluecontainer.hxx"
+#include "unotools/localfilehelper.hxx"
+#include "unotools/processfactory.hxx"
+#include "comphelper/servicehelper.hxx"
+#include "unotools/streamwrap.hxx"
+#include "unotools/textsearch.hxx"
+#include "unotools/transliterationwrapper.hxx"
+#include "unotools/ucbhelper.hxx"
+#include "vcl/abstdlg.hxx"
+#include "vcl/animate.hxx"
+#include "vcl/bitmap.hxx"
+#include "vcl/bitmapex.hxx"
+#include "vcl/bmpacc.hxx"
+#include "vcl/cmdevt.h"
+#include "vcl/configsettings.hxx"
+#include "vcl/controllayout.hxx"
+#include "vcl/cursor.hxx"
+#include "vcl/decoview.hxx"
+#include "vcl/dndhelp.hxx"
+#include "tools/fldunit.hxx"
+#include "vcl/fntstyle.hxx"
+#include "unotools/fontcvt.hxx"
+#include "vcl/gdimtf.hxx"
+#include "vcl/help.hxx"
+#include "vcl/image.hxx"
+#include "vcl/jobset.hxx"
+#include "vcl/keycodes.hxx"
+#include "vcl/mapmod.hxx"
+#include "vcl/menu.hxx"
+#include "vcl/mnemonic.hxx"
+#include "vcl/pointr.hxx"
+#include "vcl/region.hxx"
+#include "vcl/salbtype.hxx"
+#include "vcl/stdtext.hxx"
+#include "vcl/timer.hxx"
+#include "vcl/unohelp.hxx"
+#include "vcl/unohelp2.hxx"
+#include "vcl/wall.hxx"
+#include "tools/wintypes.hxx"
+#include "vos/mutex.hxx"
+#include "vos/ref.hxx"
+#include "vos/refernce.hxx"
+#include "vos/thread.hxx"
+#include "vos/xception.hxx"
+#include "xmloff/DashStyle.hxx"
+#include "xmloff/GradientStyle.hxx"
+#include "xmloff/HatchStyle.hxx"
+#include "xmloff/ImageStyle.hxx"
+#include "xmloff/MarkerStyle.hxx"
+#include "xmloff/attrlist.hxx"
+#include "xmloff/nmspmap.hxx"
+#include "xmloff/xmlcnimp.hxx"
+#include "xmloff/xmlictxt.hxx"
+#include "xmloff/xmlnmspe.hxx"
+#include "xmloff/xmlstyle.hxx"
+#include "xmloff/xmltoken.hxx"
+#include "xmlscript/xmldlg_imexp.hxx"
+//---MARKER---
+#endif
+
diff --git a/svx/inc/sjctrl.hxx b/svx/inc/sjctrl.hxx
new file mode 100644
index 000000000000..c0d49c6d0895
--- /dev/null
+++ b/svx/inc/sjctrl.hxx
@@ -0,0 +1,630 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef SOLAR_JAVA
+
+#ifndef _SFXSFXJS_HXX
+#include <sfx2/sfxjs.hxx>
+#endif
+
+class VCControl;
+class VCForm;
+class VCManager;
+class VCRadioManager;
+
+
+// Basis-Klasse aller VCControl-Wrapper-Klassen
+// Haelt Verweis auf das Control und handelt einige gemeinsame Properties
+class ImpSjJScriptControlBase
+{
+ protected:
+ VCControl* pControl;
+
+ public:
+ // Beibehalten bis zum Vollupdate
+ /*
+ String getName() const;
+ void setName( const String & aStrg );
+ String getValue() const;
+ String getType() const;
+ */
+
+ // Methoden von Java --> C++ (f"ur Properties)
+ //--------------------------------------------
+ String ImpGetName() const;
+ void ImpSetName( const String & aStrg );
+ String ImpGetValue() const;
+ void ImpSetValue( const String & aStrg );
+ String ImpGetType() const;
+
+ // Konstruktor
+ ImpSjJScriptControlBase::ImpSjJScriptControlBase( VCControl* _pControl );
+};
+
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+// Button-Control
+class ImpSjJScriptButtonObject : public SjJScriptButtonObject, ImpSjJScriptControlBase
+{
+ public:
+ // Methoden von Java --> C++ (f"ur Properties)
+ //--------------------------------------------
+ // Basisklassen-Properties, werden an ImpSjJScriptControlBase durchgereicht
+ virtual String getName() const;
+ virtual void setName( const String & aStrg );
+ virtual String getValue() const;
+ virtual void setValue( const String & aStrg );
+ virtual String getType() const;
+
+ // Methoden des Objektes
+ virtual void click();
+
+ // Events (C++ --> Java)
+ //----------------------
+ // Neue Event-Schnittstelle mit Function-Objekten
+ virtual SjJScriptFunctionObject* getOnClick_Fct() const;
+ virtual void setOnClick_Fct( SjJScriptFunctionObject* pFunctionObject );
+ virtual String getOnClick() const;
+ virtual void setOnClick( const String & aSourceStrg );
+ void onClick();
+
+ // Konstruktor
+ ImpSjJScriptButtonObject( VCControl* _pControl, SjJSbxObject * p );
+};
+
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+// PasswordControl (Edit-Control zur Password-Eingabe)
+class ImpSjJScriptPasswordObject : public SjJScriptPasswordObject, ImpSjJScriptControlBase
+{
+ public:
+ // Methoden von Java --> C++ (f"ur Properties)
+ //--------------------------------------------
+ // Basisklassen-Properties, werden an ImpSjJScriptControlBase durchgereicht
+ virtual String getName() const;
+ virtual void setName( const String & aStrg );
+ virtual String getValue() const;
+ virtual String getType() const;
+
+ virtual String getDefaultValue() const;
+ virtual void setDefaultValue( const String & aStrg );
+ virtual void setValue( const String & aStrg );
+
+ // Methoden des Objektes
+ virtual void focus();
+ virtual void blur();
+ virtual void select();
+
+ // Events (C++ --> Java)
+ //----------------------
+ // keine !
+
+ // Konstruktor
+ ImpSjJScriptPasswordObject( VCControl* _pControl, SjJSbxObject * p );
+};
+
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+class ImpSjJScriptCheckboxObject : public SjJScriptCheckboxObject, ImpSjJScriptControlBase
+{
+ public:
+ // Methoden von Java --> C++ (f"ur Properties)
+ //--------------------------------------------
+ // Basisklassen-Properties, werden an ImpSjJScriptControlBase durchgereicht
+ virtual String getName() const;
+ virtual void setName( const String & aStrg );
+ virtual String getValue() const;
+ virtual String getType() const;
+
+ virtual sal_Bool getChecked() const;
+ virtual void setChecked( sal_Bool bCheck );
+ virtual sal_Bool getDefaultChecked() const;
+ virtual void setDefaultChecked( sal_Bool bCheck );
+ // getValue() wird in der Basisklasse definiert
+ virtual void setValue( const String & aStrg );
+
+ // Methoden des Objektes
+ virtual void click();
+
+ // Events (C++ --> Java)
+ //----------------------
+ // Neue Event-Schnittstelle mit Function-Objekten
+ virtual SjJScriptFunctionObject* getOnClick_Fct() const;
+ virtual void setOnClick_Fct( SjJScriptFunctionObject* pFunctionObject );
+ virtual String getOnClick() const;
+ virtual void setOnClick( const String & aSourceStrg );
+ void onClick();
+
+ // Konstruktor
+ ImpSjJScriptCheckboxObject( VCControl* _pControl, SjJSbxObject * p );
+};
+
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+// Wrapper-Klasse fuer RadioArray
+class ImpSjJScriptRadioArray: public SjJSbxArrayObject
+{
+ VCRadioManager* pMgr;
+public:
+ sal_Int32 ImpSjJScriptRadioArray::getLength() const;
+ SjJSbxObject* ImpSjJScriptRadioArray::getElement( sal_Int32 nIndex ) const;
+ SjJSbxObject* ImpSjJScriptRadioArray::getElement_String( const String & aName ) const;
+
+ // Konstruktor
+ ImpSjJScriptRadioArray::ImpSjJScriptRadioArray( VCRadioManager* _pMgr, SjJSbxObject * p );
+};
+
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+class ImpSjJScriptRadioObject : public SjJScriptRadioObject, ImpSjJScriptControlBase
+{
+ public:
+ // Methoden von Java --> C++ (f"ur Properties)
+ //--------------------------------------------
+ // Basisklassen-Properties, werden an ImpSjJScriptControlBase durchgereicht
+ virtual String getName() const;
+ virtual void setName( const String & aStrg );
+ virtual String getValue() const;
+ virtual String getType() const;
+
+ // Properties von SjJScriptCheckboxObject
+ virtual sal_Bool getChecked() const;
+ virtual void setChecked( sal_Bool bCheck );
+ virtual sal_Bool getDefaultChecked() const;
+ virtual void setDefaultChecked( sal_Bool bCheck );
+ // getValue() wird in der Basisklasse definiert
+ virtual void setValue( const String & aStrg );
+
+ // yyy Raus zum inkompatiblen
+ //virtual sal_Int32 getLength();
+
+ // Methoden des Objektes
+ virtual void click();
+
+ // Events (C++ --> Java)
+ // Neue Event-Schnittstelle mit Function-Objekten
+ virtual SjJScriptFunctionObject* getOnClick_Fct() const;
+ virtual void setOnClick_Fct( SjJScriptFunctionObject* pFunctionObject );
+ virtual String getOnClick() const;
+ virtual void setOnClick( const String & aSourceStrg );
+ void onClick();
+
+ // Konstruktor
+ ImpSjJScriptRadioObject( VCControl* _pControl, SjJSbxObject * p );
+};
+
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+class ImpSjJScriptSelectObject : public SjJScriptSelectObject, ImpSjJScriptControlBase
+{
+ public:
+ // Methoden von Java --> C++ (f"ur Properties)
+ //--------------------------------------------
+ // Basisklassen-Properties, werden an ImpSjJScriptControlBase durchgereicht
+ virtual String getName() const;
+ virtual void setName( const String & aStrg );
+ virtual String getValue() const;
+ virtual String getType() const;
+
+ virtual sal_Int32 getLength();
+ virtual sal_Int32 getSelectedIndex() const;
+ virtual void setSelectedIndex( sal_Int32 nNo );
+
+ // liefert eine Array von Option-Objekten
+ //yyy Raus zum inkompatiblen
+ //virtual SjJSbxArrayObject * getOptions();
+
+ // Methoden des Objektes
+ virtual void focus();
+ virtual void blur();
+
+ // Events (C++ --> Java)
+ //----------------------
+ // Neue Event-Schnittstelle mit Function-Objekten
+ virtual SjJScriptFunctionObject* getOnBlur_Fct() const;
+ virtual void setOnBlur_Fct( SjJScriptFunctionObject* pFunctionObject );
+ virtual SjJScriptFunctionObject* getOnChange_Fct() const;
+ virtual void setOnChange_Fct( SjJScriptFunctionObject* pFunctionObject );
+ virtual SjJScriptFunctionObject* getOnFocus_Fct() const;
+ virtual void setOnFocus_Fct( SjJScriptFunctionObject* pFunctionObject );
+ virtual String getOnBlur() const;
+ virtual void setOnBlur( const String & aSourceStrg );
+ void onBlur();
+ virtual String getOnChange() const;
+ virtual void setOnChange( const String & aSourceStrg );
+ void onChange();
+ virtual String getOnFocus() const;
+ virtual void setOnFocus( const String & aSourceStrg );
+ void onFocus();
+
+ // SjJSbxArrayObject-Methoden
+ virtual sal_Int32 getLength() const;
+ // Zugriff "uber den Index
+ virtual SjJSbxObject * getElement( sal_Int32 nIndex ) const;
+ // Zugriff "uber den Namen
+ // native Java-Methoden k"onnen (noch) nicht "uberladen werden
+ //virtual SjJSbxObject * getElement_String( const String & aName ) const;
+
+ // Konstruktor
+ ImpSjJScriptSelectObject( VCControl* _pControl, SjJSbxObject * p );
+
+ // zum Setzen von Eintr"agen am Objket (zum Aufruf von Java aus) 15.1.1997
+ virtual void setOption( sal_Int32 nIndex, const String & aOptionText,
+ const String & aOptionValue,
+ sal_Bool bDefaultSelected, sal_Bool bSelected );
+
+ // Schnittstelle fuer die Properties der Option-Objekte
+ virtual sal_Bool getOptionDefaultSelected( sal_Int32 nIndex ) const;
+ virtual void setOptionDefaultSelected( sal_Bool bSelected, sal_Int32 nIndex );
+ virtual sal_Bool getOptionSelected( sal_Int32 nIndex ) const;
+ virtual void setOptionSelected( sal_Bool bSelected, sal_Int32 nIndex );
+ virtual String getOptionText( sal_Int32 nIndex ) const;
+ virtual void setOptionText( const String & sText, sal_Int32 nIndex );
+ virtual void setOptionValue( const String & sText, sal_Int32 nIndex );
+ virtual String getOptionValue( sal_Int32 nIndex ) const;
+};
+
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+// Wieso von Controlbase abgeleitet?
+
+class ImpSjJScriptOptionObject : public SjJScriptOptionObject, ImpSjJScriptControlBase
+{
+ sal_uInt16 nListBoxIndex;
+ public:
+ // Methoden von Java --> C++ (f"ur Properties)
+ //--------------------------------------------
+ virtual sal_Bool getdefaultSelected() const;
+ virtual void setdefaultSelected( sal_Bool bSelected );
+ virtual sal_Int32 getIndex() const;
+ virtual sal_Bool getSelected() const;
+ virtual void setSelected( sal_Bool bSelected );
+
+
+ //yyy Zum Vollupdate raus:
+ /*
+ virtual sal_Int32 getSelectedIndex() const;
+ virtual void setSelectedIndex( sal_Int32 nNo );
+ */
+
+
+ virtual String getText() const;
+ virtual void setText( const String & sText );
+ // getValue() wird in der Basisklasse definiert
+ virtual String getValue() const;
+ virtual void setValue( const String & aStrg );
+
+
+ // DUMMY-Methoden
+ virtual String getName() const { return "";}
+ virtual void setName( const String &s) { }
+ virtual String getType() const { return "";}
+ // Methoden des Objektes
+ // keine !
+
+ // Events (C++ --> Java)
+ //----------------------
+ // keine !
+
+ // Konstruktor
+ ImpSjJScriptOptionObject( VCControl* _pControl, SjJSbxObject * p, sal_uInt16 _nListBoxIndex );
+};
+
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+// Eigene Klasse fuer forms-Array anlegen
+class SjJSbxFormsArray: public SfxJSArray
+{
+ VCManager* pManager;
+
+ public:
+ // SjJSbxArrayObject-Methoden
+ virtual sal_Int32 getLength() const;
+ // Zugriff "uber den Index
+ virtual SjJSbxObject * getElement( sal_Int32 nIndex ) const;
+ // Zugriff "uber den Namen
+ // native Java-Methoden k"onnen (noch) nicht "uberladen werden
+ virtual SjJSbxObject * getElement_String( const String & aName ) const;
+
+ // Konstruktor
+ SjJSbxFormsArray( VCManager * _pManager, SjJSbxObject * p );
+};
+
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+class ImpSjJScriptTextObject : public SjJScriptTextObject, ImpSjJScriptControlBase
+{
+ public:
+ // Methoden von Java --> C++ (f"ur Properties)
+ //--------------------------------------------
+ // Basisklassen-Properties, werden an ImpSjJScriptControlBase durchgereicht
+ virtual String getName() const;
+ virtual void setName( const String & aStrg );
+ virtual String getValue() const;
+ virtual String getType() const;
+
+ virtual String getDefaultValue() const;
+ virtual void setDefaultValue( const String & aStrg );
+ // getValue() wird in der Basisklasse definiert
+ virtual void setValue( const String & aStrg );
+
+ // Methoden des Objektes
+ virtual void focus();
+ virtual void blur();
+ virtual void select();
+
+ // Events (C++ --> Java)
+ //----------------------
+ // Neue Event-Schnittstelle mit Function-Objekten
+ virtual SjJScriptFunctionObject* getOnBlur_Fct() const;
+ virtual void setOnBlur_Fct( SjJScriptFunctionObject* pFunctionObject );
+ virtual SjJScriptFunctionObject* getOnChange_Fct() const;
+ virtual void setOnChange_Fct( SjJScriptFunctionObject* pFunctionObject );
+ virtual SjJScriptFunctionObject* getOnFocus_Fct() const;
+ virtual void setOnFocus_Fct( SjJScriptFunctionObject* pFunctionObject );
+ virtual SjJScriptFunctionObject* getOnSelect_Fct() const;
+ virtual void setOnSelect_Fct( SjJScriptFunctionObject* pFunctionObject );
+ virtual String getOnBlur() const;
+ virtual void setOnBlur( const String & aSourceStrg );
+ void onBlur();
+ virtual String getOnChange() const;
+ virtual void setOnChange( const String & aSourceStrg );
+ void onChange();
+ virtual String getOnFocus() const;
+ virtual void setOnFocus( const String & aSourceStrg );
+ void onFocus();
+ virtual String getOnSelect() const;
+ virtual void setOnSelect( const String & aSourceStrg );
+ void onSelect();
+
+ // Konstruktor
+ ImpSjJScriptTextObject( VCControl* _pControl, SjJSbxObject * p );
+};
+
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+class ImpSjJScriptTextareaObject : public SjJScriptTextareaObject, ImpSjJScriptControlBase
+{
+ public:
+ // Methoden von Java --> C++ (f"ur Properties)
+ //--------------------------------------------
+ // Basisklassen-Properties, werden an ImpSjJScriptControlBase durchgereicht
+ virtual String getName() const;
+ virtual void setName( const String & aStrg );
+ virtual String getValue() const;
+ virtual String getType() const;
+
+ virtual String getDefaultValue() const;
+ virtual void setDefaultValue( const String & aStrg );
+ // getValue() wird in der Basisklasse definiert
+ virtual void setValue( const String & aStrg );
+
+ // Methoden des Objektes
+ virtual void focus();
+ virtual void blur();
+ virtual void select();
+
+ // Events (C++ --> Java)
+ //----------------------
+ // Neue Event-Schnittstelle mit Function-Objekten
+ virtual SjJScriptFunctionObject* getOnBlur_Fct() const;
+ virtual void setOnBlur_Fct( SjJScriptFunctionObject* pFunctionObject );
+ virtual SjJScriptFunctionObject* getOnChange_Fct() const;
+ virtual void setOnChange_Fct( SjJScriptFunctionObject* pFunctionObject );
+ virtual SjJScriptFunctionObject* getOnFocus_Fct() const;
+ virtual void setOnFocus_Fct( SjJScriptFunctionObject* pFunctionObject );
+ virtual SjJScriptFunctionObject* getOnSelect_Fct() const;
+ virtual void setOnSelect_Fct( SjJScriptFunctionObject* pFunctionObject );
+ virtual String getOnBlur() const;
+ virtual void setOnBlur( const String & aSourceStrg );
+ void onBlur();
+ virtual String getOnChange() const;
+ virtual void setOnChange( const String & aSourceStrg );
+ void onChange();
+ virtual String getOnFocus() const;
+ virtual void setOnFocus( const String & aSourceStrg );
+ void onFocus();
+ virtual String getOnSelect() const;
+ virtual void setOnSelect( const String & aSourceStrg );
+ void onSelect();
+
+ // Konstruktor
+ ImpSjJScriptTextareaObject( VCControl* _pControl, SjJSbxObject * p );
+};
+
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+class ImpSjJScriptSubmitObject : public SjJScriptSubmitObject, ImpSjJScriptControlBase
+{
+ // Identisch mit ButtonObject
+ public:
+ // Methoden von Java --> C++ (f"ur Properties)
+ //--------------------------------------------
+ // Basisklassen-Properties, werden an ImpSjJScriptControlBase durchgereicht
+ virtual String getName() const;
+ virtual void setName( const String & aStrg );
+ virtual String getValue() const;
+ virtual void setValue( const String & aStrg );
+ virtual String getType() const;
+
+ // Methoden des Objektes
+ virtual void click();
+
+ // Events (C++ --> Java)
+ //----------------------
+ // Neue Event-Schnittstelle mit Function-Objekten
+ virtual SjJScriptFunctionObject* getOnClick_Fct() const;
+ virtual void setOnClick_Fct( SjJScriptFunctionObject* pFunctionObject );
+ virtual String getOnClick() const;
+ virtual void setOnClick( const String & aSourceStrg );
+ void onClick();
+
+ // Konstruktor
+ ImpSjJScriptSubmitObject( VCControl* _pControl, SjJSbxObject * p );
+};
+
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+class ImpSjJScriptResetObject : public SjJScriptResetObject, ImpSjJScriptControlBase
+{
+ // Identisch mit ButtonObject
+ public:
+ // Methoden von Java --> C++ (f"ur Properties)
+ //--------------------------------------------
+ // Basisklassen-Properties, werden an ImpSjJScriptControlBase durchgereicht
+ virtual String getName() const;
+ virtual void setName( const String & aStrg );
+ virtual String getValue() const;
+ virtual void setValue( const String & aStrg );
+ virtual String getType() const;
+
+ // Methoden des Objektes
+ virtual void click();
+
+ // Events (C++ --> Java)
+ //----------------------
+ // Neue Event-Schnittstelle mit Function-Objekten
+ virtual SjJScriptFunctionObject* getOnClick_Fct() const;
+ virtual void setOnClick_Fct( SjJScriptFunctionObject* pFunctionObject );
+ virtual String getOnClick() const;
+ virtual void setOnClick( const String & aSourceStrg );
+ void onClick();
+
+ // Konstruktor
+ ImpSjJScriptResetObject( VCControl* _pControl, SjJSbxObject * p );
+};
+
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+class ImpSjJScriptHiddenObject : public SjJScriptHiddenObject, ImpSjJScriptControlBase
+{
+ public:
+ // Methoden von Java --> C++ (f"ur Properties)
+ //--------------------------------------------
+ // Basisklassen-Properties, werden an ImpSjJScriptControlBase durchgereicht
+ virtual String getName() const;
+ virtual void setName( const String & aStrg );
+ virtual String getValue() const;
+ virtual String getType() const;
+
+ // getValue() wird in der Basisklasse definiert
+ virtual void setValue( const String & aStrg );
+
+ // Methoden des Objektes
+ // keine !
+
+ // Events (C++ --> Java)
+ //----------------------
+ // keine !
+
+ // Konstruktor
+ ImpSjJScriptHiddenObject( VCControl* _pControl, SjJSbxObject * p );
+};
+
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+class ImpSjJScriptFileUploadObject : public SjJScriptFileUploadObject, ImpSjJScriptControlBase
+{
+ public:
+ // Methoden von Java --> C++ (f"ur Properties)
+ //--------------------------------------------
+ // Basisklassen-Properties, werden an ImpSjJScriptControlBase durchgereicht
+ virtual String getName() const;
+ virtual void setName( const String & aStrg );
+ virtual String getValue() const;
+ virtual String getType() const;
+
+ // Methoden des Objektes
+ // keine !
+
+ // Events (C++ --> Java)
+ //----------------------
+ // keine !
+
+ // Konstruktor
+ ImpSjJScriptFileUploadObject( VCControl* _pControl, SjJSbxObject * p );
+};
+
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+class ImpSjJScriptFormObject : public SjJScriptFormObject
+{
+ VCForm* pVCForm;
+
+ public:
+ // Methoden von Java --> C++ (f"ur Properties)
+ //--------------------------------------------
+ virtual String getName() const;
+ virtual void setName( const String & aStrg );
+ virtual String getValue() const;
+ virtual String getType() const;
+
+ virtual String getAction() const;
+ virtual void setAction( const String & sValue );
+ virtual String getEncoding() const;
+ virtual void setEncoding( const String & sValue );
+ virtual String getMethod() const;
+ virtual void setMethod( const String & sValue );
+ virtual String getTarget() const;
+ virtual void setTarget( const String & sValue );
+
+ // SjJSbxArrayObject-Methoden
+ sal_Int32 getLength() const;
+ SjJSbxObject* getElement( sal_Int32 nIndex ) const;
+ SjJSbxObject* getElement_String( const String & aName ) const;
+
+ // liefert ein Array-Objekt mit Elementen vom Typ JScriptAbstractControlsObject
+ // yyy Raus zum inkompatiblen
+ //virtual SjJSbxArrayObject * getElements();
+
+ // Zugriff ueber den Namen eines Controls (falls ein Name zugeordnet ist)
+ // yyy Raus zum inkompatiblen
+ //virtual SjJSbxObject * getElement( const String & aName );
+
+ // Methoden des Objektes
+ virtual void submit();
+ virtual void reset();
+
+ // Events (C++ --> Java)
+ //----------------------
+ // Neue Event-Schnittstelle mit Function-Objekten
+ virtual SjJScriptFunctionObject* getOnSubmit_Fct() const;
+ virtual void setOnSubmit_Fct( SjJScriptFunctionObject* pFunctionObject );
+ virtual SjJScriptFunctionObject* getOnReset_Fct() const;
+ virtual void setOnReset_Fct( SjJScriptFunctionObject* pFunctionObject );
+ virtual String getOnSubmit() const;
+ virtual void setOnSubmit( const String & aSourceStrg );
+ void onSubmit();
+ virtual String getOnReset() const;
+ virtual void setOnReset( const String & aSourceStrg );
+ void onReset();
+
+ // Konstruktor
+ ImpSjJScriptFormObject( VCForm* _pVCForm, SjJSbxObject * p );
+};
+
+#endif
diff --git a/svx/inc/svdibrow.hxx b/svx/inc/svdibrow.hxx
new file mode 100644
index 000000000000..0d20b950a49c
--- /dev/null
+++ b/svx/inc/svdibrow.hxx
@@ -0,0 +1,144 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDIBROW_HXX
+#define _SVDIBROW_HXX
+
+#include <svtools/brwbox.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/floatwin.hxx>
+
+class SfxItemSet;
+class ImpItemListRow;
+class BrowserMouseEvent;
+
+class _SdrItemBrowserControl: public BrowseBox
+{
+friend class ImpItemEdit;
+ Container aList;
+ long nAktPaintRow;
+ Edit* pEditControl;
+ XubString aWNamMerk;
+ Link aEntryChangedHdl;
+ Link aSetDirtyHdl;
+ ImpItemListRow* pAktChangeEntry;
+ long nLastWhichOfs;
+ sal_uInt16 nLastWhich;
+ sal_uInt16 nLastWhichOben;
+ sal_uInt16 nLastWhichUnten;
+ FASTBOOL bWhichesButNames;
+ FASTBOOL bDontHideIneffectiveItems;
+ FASTBOOL bDontSortItems;
+ FASTBOOL bShowWhichIds;
+ FASTBOOL bShowRealValues;
+private:
+#if _SOLAR__PRIVATE
+ void ImpCtor();
+ void ImpSetEntry(const ImpItemListRow& rEntry, sal_uIntPtr nEntryNum);
+ ImpItemListRow* ImpGetEntry(sal_uIntPtr nPos) const { return (ImpItemListRow*)aList.GetObject(nPos); }
+ void ImpSaveWhich();
+ void ImpRestoreWhich();
+#endif // __PRIVATE
+protected:
+ virtual long GetRowCount() const;
+ virtual sal_Bool SeekRow(long nRow);
+ virtual void PaintField(OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId) const;
+ virtual void DoubleClick(const BrowserMouseEvent&);
+ virtual void KeyInput(const KeyEvent& rEvt);
+ virtual void Select();
+ virtual void SetDirty(); // wird z.B. bei Modusumschaltungen gerufen
+ virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex);
+ virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint);
+public:
+ _SdrItemBrowserControl(Window* pParent, WinBits nBits=WB_3DLOOK|WB_BORDER|WB_TABSTOP);
+ virtual ~_SdrItemBrowserControl();
+ void Clear();
+ void SetAttributes(const SfxItemSet* pAttr, const SfxItemSet* p2ndSet=NULL);
+ sal_uIntPtr GetCurrentPos() const;
+ sal_uInt16 GetCurrentWhich() const;
+ virtual FASTBOOL BegChangeEntry(sal_uIntPtr nPos);
+ virtual FASTBOOL EndChangeEntry();
+ virtual void BrkChangeEntry();
+
+ /** GetCellText returns the text at the given position
+ @param _nRow
+ the number of the row
+ @param _nColId
+ the ID of the column
+ @return
+ the text out of the cell
+ */
+ virtual String GetCellText(long _nRow, sal_uInt16 _nColId) const;
+
+ const ImpItemListRow* GetAktChangeEntry() const { return pAktChangeEntry; }
+ XubString GetNewEntryValue() const { return pEditControl->GetText(); }
+ void SetEntryChangedHdl(const Link& rLink) { aEntryChangedHdl=rLink; }
+ const Link& GetEntryChangedHdl() const { return aEntryChangedHdl; }
+ void SetSetDirtyHdl(const Link& rLink) { aSetDirtyHdl=rLink; }
+ const Link& GetSetDirtyHdl() const { return aSetDirtyHdl; }
+};
+
+#define WB_STDSIZEABLEDOCKWIN (WB_STDDOCKWIN|WB_3DLOOK|WB_CLOSEABLE|WB_SIZEMOVE)
+#define WB_STDSIZEABLEFLOATWIN (WB_STDFLOATWIN|WB_3DLOOK|WB_CLOSEABLE|WB_SIZEMOVE)
+
+class _SdrItemBrowserWindow: public FloatingWindow {
+ _SdrItemBrowserControl aBrowse;
+public:
+ _SdrItemBrowserWindow(Window* pParent, WinBits nBits=WB_STDSIZEABLEDOCKWIN);
+ virtual ~_SdrItemBrowserWindow();
+ virtual void Resize();
+ virtual void GetFocus();
+ void Clear() { aBrowse.Clear(); }
+ void SetAttributes(const SfxItemSet* pAttr, const SfxItemSet* p2ndSet=NULL) { aBrowse.SetAttributes(pAttr,p2ndSet); }
+ void SetFloatingMode(FASTBOOL /*bOn*/) {}
+ const _SdrItemBrowserControl& GetBrowserControl() const { return aBrowse; }
+ _SdrItemBrowserControl& GetBrowserControl() { return aBrowse; }
+};
+
+class SdrView;
+
+class SdrItemBrowser: public _SdrItemBrowserWindow {
+ Timer aIdleTimer;
+ SdrView* pView;
+ FASTBOOL bDirty;
+private:
+ static Window* ImpGetViewWin(SdrView& rView);
+ DECL_LINK(IdleHdl,Timer*);
+ DECL_LINK(ChangedHdl,_SdrItemBrowserControl*);
+ DECL_LINK(SetDirtyHdl,_SdrItemBrowserControl*);
+public:
+ SdrItemBrowser(SdrView& rView);
+ void ForceParent();
+ void SetView(SdrView& rView) { pView=&rView; ForceParent(); SetDirty(); }
+ void SetDirty();
+ void Undirty();
+ void ForceUndirty() { if (bDirty) Undirty(); }
+};
+
+#endif //_SVDIBROW_HXX
+
+
diff --git a/svx/inc/svdpomv.hxx b/svx/inc/svdpomv.hxx
new file mode 100644
index 000000000000..5ed76f739c68
--- /dev/null
+++ b/svx/inc/svdpomv.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#error dieser Header entfaellt nun!
+
+#ifndef _SVDPOMV_HXX
+#define _SVDPOMV_HXX
+
+#include <svx/svdmrkv.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@@ @@@@ @@ @@ @@ @@ @@ @@@@ @@@@@ @@ @@ @@ @@ @@ @@@@@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@
+// @@@@@ @@ @@ @@ @@@@ @@@@@@@ @@@@@@ @@@@@ @@@@ @@@@@ @@ @@@@ @@@@@@@
+// @@ @@ @@ @@ @@ @@ @ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@
+// @@ @@@@ @@@@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@ @@@@@ @@ @@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class SdrPolyMarkView: public SdrMarkView {
+private:
+#ifndef _SVDRAW_HXX
+ void ImpClearVars();
+#endif
+public:
+ SdrPolyMarkView(SdrModel* pModel1, OutputDevice* pOut = 0L);
+ ~SdrPolyMarkView();
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDPOMV_HXX
+
diff --git a/svx/inc/svdshort.hxx b/svx/inc/svdshort.hxx
new file mode 100644
index 000000000000..2b28525cbb51
--- /dev/null
+++ b/svx/inc/svdshort.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#error svdshort wird nicht mehr verwendet!
+
+#ifndef _SVDSHORT_HXX
+#define _SVDSHORT_HXX
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifdef Weg_Mit_Den_Doofen_Abkuerzungen
+ // Statistik - Stand 02-03-1995
+ // Haeufigkeit Ersparnis
+#define SdrHelpLineKind SdrFLK /* HL ist schon besetzt */
+#define SdrHelpLineList SdrFLL /* HL ist schon besetzt */
+#define SdrHelpLine SdrFL /* HL ist schon besetzt */
+#define SdrObjTransformInfoRec SdrTI
+#define SdrDragCrook SdrDC
+#define SdrDragMirror SdrDI
+#define SdrDragMovHdl SdrDH
+#define SdrDragResize SdrDZ
+#define SdrDragRotate SdrDR
+#define SdrDragShear SdrDE
+#define SdrDragMove SdrDM
+#define SdrCreateCmd SdrCC
+#define SdrUndoAttrObj SdrAU
+#define SdrObjKind SdrOK
+#define SdrUndoGroup SdrUG
+#define SdrUndoAction SdrUA
+#define SdrAttrObj SdrAO
+#define SdrGrafObj SdrGO
+#define SdrMarkList SdrML
+#define SdrHdlList SdrHL
+#define SdrLayerAdmin SdrLA
+#define SdrObjUserCall SdrUC
+#define SdrObjUnknown SdrUO
+#define SdrExchangeView SdrXV
+#define SdrCreateView SdrCV
+#define SdrOle2Obj SdrOO
+#define SdrObjGeoData SdrGD
+#define SdrDragView SdrDV
+#define SdrSnapView SdrSV
+#define SdrObjList SdrOL
+#define SdrEdgeObj SdrEO
+#define SdrCircObj SdrCO
+#define SdrObjGroup SdrOG
+#define SdrPage SdrPg
+#define SdrObjEditView SdrOV
+#define SdrModel SdrMD
+#define SdrEditView SdrEV
+#define SdrPaintView SdrNV
+#define SdrPolyObj SdrPO
+#define SdrRectObj SdrRO
+#define SdrTextObj SdrTO
+#define SdrMarkView SdrMV
+#define SdrPathObj SdrBO
+#define SdrPageView SdrPV
+#define SdrDragStat SdrDS
+#define SdrVirtObj SdrVO
+#define SdrObject SdrO
+
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDSHORT_HXX
+
diff --git a/svx/inc/svx/AccessibleControlShape.hxx b/svx/inc/svx/AccessibleControlShape.hxx
new file mode 100644
index 000000000000..60158c0a55d3
--- /dev/null
+++ b/svx/inc/svx/AccessibleControlShape.hxx
@@ -0,0 +1,216 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_CONTROL_SHAPE_HXX
+#define _SVX_ACCESSIBILITY_ACCESSIBLE_CONTROL_SHAPE_HXX
+
+#include <svx/AccessibleShape.hxx>
+
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/util/XModeChangeBroadcaster.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <cppuhelper/implbase3.hxx>
+#include <comphelper/uno3.hxx>
+
+namespace com { namespace sun { namespace star { namespace awt {
+ class XControl;
+} } } }
+
+namespace comphelper
+{
+ class OWrappedAccessibleChildrenManager;
+}
+
+class SdrObject;
+namespace accessibility {
+
+ typedef ::cppu::ImplHelper4 < ::com::sun::star::beans::XPropertyChangeListener
+ , ::com::sun::star::util::XModeChangeListener
+ , ::com::sun::star::container::XContainerListener
+ , ::com::sun::star::accessibility::XAccessibleEventListener
+ > AccessibleControlShape_Base;
+/** @descr
+*/
+class AccessibleControlShape
+ :public AccessibleShape
+ ,public AccessibleControlShape_Base
+{
+public:
+ //===== internal ========================================================
+ AccessibleControlShape(
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo);
+ virtual ~AccessibleControlShape( );
+
+protected:
+ //--- XAccessible ----------------------------------------
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL getAccessibleContext( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //--- XAccessibleComponent -------------------------------
+ /// forward the focus to the contained control(in alive mode)
+ virtual void SAL_CALL grabFocus( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //--- XAccessibleContext ---------------------------------
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+
+ //--- XServiceInfo ---------------------------------------
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //--- XInterface -----------------------------------------
+ DECLARE_XINTERFACE( )
+
+ //--- XTypeProvider --------------------------------------
+ DECLARE_XTYPEPROVIDER( )
+
+ //--- XPropertyChangeListener ----------------------------
+ virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ //--- XComponent -----------------------------------------
+ virtual void SAL_CALL disposing( );
+
+ //--- XEventListener -------------------------------------
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException);
+
+ //--- XModeChangeListener --------------------------------
+ virtual void SAL_CALL modeChanged( const ::com::sun::star::util::ModeChangeEvent& _rSource ) throw(::com::sun::star::uno::RuntimeException);
+
+ //--- XAccessibleEventListener ----------------------------
+ virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ //--- document::XEventListener ----------------------------
+ using AccessibleShape::notifyEvent;
+
+ // XVclContainerListener
+ virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ /** Initialize a new shape. See the documentation of the base' constructor
+ for the reason of this method's existence.
+ */
+ virtual void Init( );
+
+ /// Create a name string that contains the accessible name.
+ virtual ::rtl::OUString
+ CreateAccessibleBaseName( )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ /** Create a unique name string that contains the accessible name. The
+ name consists of the base name and the index.
+ */
+ virtual ::rtl::OUString
+ CreateAccessibleName( )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ /// Create a description string that contains the accessible description.
+ virtual ::rtl::OUString
+ CreateAccessibleDescription( )
+ throw(::com::sun::star::uno::RuntimeException);
+
+#ifdef DBG_UTIL
+ /// Set the specified state
+ virtual sal_Bool SetState( sal_Int16 _nState );
+#endif // DBG_UTIL
+
+ /// (safely) reads the given property from the model of the UNO control
+ ::rtl::OUString getControlModelStringProperty( const ::rtl::OUString& _rPropertyName ) const SAL_THROW(( ));
+
+ /// ensure that our control model exists(will be retrieved upon need only)
+ sal_Bool ensureControlModelAccess( ) SAL_THROW(( ));
+
+ /// ensures that we're listening for the given property if(and only if!) necessary
+ sal_Bool ensureListeningState( const sal_Bool _bCurrentlyListening, const sal_Bool _bNeedNewListening,
+ const ::rtl::OUString& _rPropertyName );
+
+ /// starts multiplexing the state changes of our aggregate context
+ void startStateMultiplexing( );
+ /// stops multiplexing the state changes of our aggregate context
+ void stopStateMultiplexing( );
+
+ /// retrieves the SdrObject of the shape we represent
+ SdrObject* getSdrObject( ) const;
+
+ /** adjusts our AccessibleRole, depending on the control type we're working for
+
+ <p>Only to be called during inituialization</p>
+ */
+ void adjustAccessibleRole( );
+
+ /** initializes composed states of the context
+
+ <p>Some of the states of our inner context need to be propagated to the "composed context", too
+ (such as "checked" for check boxes). At lifetime, this is done by multiplexing state changes,
+ at initialization time, this method is used.</p>
+ */
+ void initializeComposedState( );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ m_xControlModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
+ m_xModelPropsMeta; // cache this for performance reasons
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >
+ m_xUnoControl; // our UNO control
+
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessibleContext >
+ m_aControlContext; // the AccessibleContext of the control
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation >
+ m_xControlContextProxy; // the proxy for "aggregating" the AccessibleContext of the control
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider >
+ m_xControlContextTypeAccess; // cached interface of our aggregate
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
+ m_xControlContextComponent; // cached interface of our aggregate
+
+ ::comphelper::OWrappedAccessibleChildrenManager*
+ m_pChildManager;
+
+ sal_Bool m_bListeningForName : 1; // are we currently listening for changes of the "Name" property?
+ sal_Bool m_bListeningForDesc : 1; // are we currently listening for changes of the "HelpText" property?
+ sal_Bool m_bMultiplexingStates : 1; // are we currently multiplexing state changes of the native context?
+ sal_Bool m_bDisposeNativeContext : 1; // do we need to dispose mxNativeContextComponent?
+ sal_Bool m_bWaitingForControl : 1; // if we are created before our control exists, we need to wait for it to appear ...
+
+private:
+ /** Don't use the default constructor. Use the public constructor that
+ takes the original shape and the parent as arguments instead.
+ */
+ AccessibleControlShape( );
+
+ /// Don't use the constructor. not implemented.
+ AccessibleControlShape(const AccessibleControlShape&);
+
+ /// Don't use the assignment operator. not implemented.
+ AccessibleControlShape& operator= (const AccessibleControlShape&);
+};
+
+} // end of namespace accessibility
+
+#endif
diff --git a/svx/inc/svx/AccessibleGraphicShape.hxx b/svx/inc/svx/AccessibleGraphicShape.hxx
new file mode 100644
index 000000000000..09cee5c069ad
--- /dev/null
+++ b/svx/inc/svx/AccessibleGraphicShape.hxx
@@ -0,0 +1,123 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_GRAPHIC_SHAPE_HXX
+#define _SVX_ACCESSIBILITY_ACCESSIBLE_GRAPHIC_SHAPE_HXX
+
+#include <svx/AccessibleShape.hxx>
+#include <com/sun/star/accessibility/XAccessibleImage.hpp>
+#include "svx/svxdllapi.h"
+
+namespace accessibility {
+
+/** @descr
+ This class makes graphic shapes accessible. With respect to its
+ base class <type>AccessibleShape</type> it supports the additional
+ <type>XAccessibleImage</type> interface.
+*/
+class SVX_DLLPUBLIC AccessibleGraphicShape
+ : public AccessibleShape,
+ public ::com::sun::star::accessibility::XAccessibleImage
+{
+public:
+ //===== internal ========================================================
+ AccessibleGraphicShape (
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo);
+
+ virtual ~AccessibleGraphicShape (void);
+
+ //===== XAccessibleImage ================================================
+
+ ::rtl::OUString SAL_CALL getAccessibleImageDescription (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ sal_Int32 SAL_CALL getAccessibleImageHeight (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ sal_Int32 SAL_CALL getAccessibleImageWidth (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== 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 (void)
+ throw ();
+
+ virtual void SAL_CALL
+ release (void)
+ throw ();
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XTypeProvider ===================================================
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL
+ getTypes (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ /// Create a name string that contains the accessible name.
+ virtual ::rtl::OUString
+ CreateAccessibleBaseName ()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Create a description string that contains the accessible description.
+ virtual ::rtl::OUString
+ CreateAccessibleDescription ()
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ /** Don't use the default constructor. Use the public constructor that
+ takes the original shape and the parent as arguments instead.
+ */
+ SVX_DLLPRIVATE AccessibleGraphicShape (void);
+
+ /// Don't use the constructor. Not yet implemented.
+ SVX_DLLPRIVATE AccessibleGraphicShape (const AccessibleGraphicShape&);
+
+ /// Don't use the assignment operator. Not yet implemented.
+ SVX_DLLPRIVATE AccessibleGraphicShape& operator= (const AccessibleGraphicShape&);
+};
+
+} // end of namespace accessibility
+
+#endif
diff --git a/svx/inc/svx/AccessibleOLEShape.hxx b/svx/inc/svx/AccessibleOLEShape.hxx
new file mode 100644
index 000000000000..27cd0f5fe237
--- /dev/null
+++ b/svx/inc/svx/AccessibleOLEShape.hxx
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_OLE_SHAPE_HXX
+#define _SVX_ACCESSIBILITY_ACCESSIBLE_OLE_SHAPE_HXX
+
+#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_SHAPE_MANAGER_HXX
+#include <svx/AccessibleShape.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_ACTION_HPP_
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#endif
+#include "svx/svxdllapi.h"
+
+namespace accessibility {
+
+/** @descr
+ This class makes OLE objects accessible. With respect to its
+ base class <type>AccessibleShape</type> it supports the additional
+ <type>XAccessibleAction</type> interface.
+*/
+class SVX_DLLPUBLIC AccessibleOLEShape
+ : public AccessibleShape,
+ public ::com::sun::star::accessibility::XAccessibleAction
+{
+public:
+ //===== internal ========================================================
+ AccessibleOLEShape (
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo);
+ virtual ~AccessibleOLEShape (void);
+
+ //===== XAccessibleAction ===============================================
+
+ sal_Int32 SAL_CALL getAccessibleActionCount (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ sal_Bool SAL_CALL doAccessibleAction (sal_Int32 nIndex)
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ ::rtl::OUString SAL_CALL getAccessibleActionDescription (sal_Int32 nIndex)
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleKeyBinding> SAL_CALL getAccessibleActionKeyBinding (
+ sal_Int32 nIndex)
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ //===== XInterface ======================================================
+
+ virtual com::sun::star::uno::Any SAL_CALL
+ queryInterface (const com::sun::star::uno::Type & rType)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ acquire (void)
+ throw ();
+
+ virtual void SAL_CALL
+ release (void)
+ throw ();
+
+ //===== XServiceInfo ====================================================
+
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XTypeProvider ===================================================
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL
+ getTypes (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ /// Create a name string that contains the accessible name.
+ virtual ::rtl::OUString
+ CreateAccessibleBaseName ()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Create a description string that contains the accessible description.
+ virtual ::rtl::OUString
+ CreateAccessibleDescription ()
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ /** Don't use the default constructor. Use the public constructor that
+ takes the original shape and the parent as arguments instead.
+ */
+ SVX_DLLPRIVATE AccessibleOLEShape (void);
+
+ /// Don't use the constructor. Not yet implemented.
+ SVX_DLLPRIVATE AccessibleOLEShape (const AccessibleOLEShape&);
+
+ /// Don't use the assignment operator. Not yet implemented.
+ SVX_DLLPRIVATE AccessibleOLEShape& operator= (const AccessibleOLEShape&);
+};
+
+} // end of namespace accessibility
+
+#endif
diff --git a/svx/inc/svx/AccessibleShape.hxx b/svx/inc/svx/AccessibleShape.hxx
new file mode 100755
index 000000000000..e1979294b2d8
--- /dev/null
+++ b/svx/inc/svx/AccessibleShape.hxx
@@ -0,0 +1,410 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_SHAPE_HXX
+#define _SVX_ACCESSIBILITY_ACCESSIBLE_SHAPE_HXX
+
+#include <editeng/AccessibleContextBase.hxx>
+#include <editeng/AccessibleComponentBase.hxx>
+#include <svx/IAccessibleViewForwarderListener.hxx>
+#include <com/sun/star/document/XEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <svx/AccessibleTextHelper.hxx>
+#include "svx/svxdllapi.h"
+#include "ChildrenManager.hxx"
+
+class SdrObject;
+
+namespace accessibility {
+
+class AccessibleShapeInfo;
+class AccessibleShapeTreeInfo;
+class IAccessibleParent;
+
+/** This base class provides a base implementation for all shapes. For more
+ detailed documentation about the methods refer to the descriptions of
+ the implemented interfaces. These are, among others,
+ <type>XAccessible</type>, <type>XAccessibleContext</type>,
+ <type>XAccessibleComponent</type> and
+ <type>XAccessibleExtendedComponent</type>.
+
+ <p>The children of a shape can stem from two sources which, in case of
+ SVX and SD shapes, are mutually exclusive. This implementation,
+ however, handles both simultaniously to cope with future extensions or
+ shapes from other projects.
+ <ul>
+ <li>If this shape is a group shape, i.e. a
+ <type>SvxShapeGroup</type> or a <type>Svx3DSceneObject</type>, it
+ can have nested shapes.</li>
+ <li>If this shape is a descendant from <type>SvxShapeText</type>
+ then the text paragraphs are its children.</li>
+ </ul>
+ </p>
+
+ <p>Accessible shapes do not listen for disposing() calls of the UNO
+ shapes they make accessible. This is the task of their owner, usually a
+ container, who can then call dispose() at the accessible object.</p>
+*/
+class SVX_DLLPUBLIC AccessibleShape
+ : public AccessibleContextBase,
+ public AccessibleComponentBase,
+ public IAccessibleViewForwarderListener,
+ public ::com::sun::star::document::XEventListener,
+ public ::com::sun::star::lang::XUnoTunnel
+{
+public:
+ //===== internal ========================================================
+
+ /** Create a new accessible object that makes the given shape accessible.
+ @param rShapeInfo
+ This object contains all information specific to the new
+ accessible shape. That are e.g. the shape to be made accessible
+ and the accessible object that will become the parent of the new
+ object.
+ @param rShapeTreeInfo
+ Bundel of information passed to this shape and all of its desendants.
+ @attention
+ Always call the <member>init</member> method after creating a
+ new accessible shape. This is one way to overcome the potential
+ problem of registering the new object with e.g. event
+ broadcasters. That would delete the new object if a broadcaster
+ would not keep a strong reference to the new object.
+ */
+ AccessibleShape (
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo);
+
+ /** The destructor releases its children manager and text engine if
+ still existent. These are responsible to send appropriate events.
+ */
+ virtual ~AccessibleShape (void);
+
+ /** Initialize a new shape. See the documentation of the constructor
+ for the reason of this method's existence.
+ */
+ virtual void Init (void);
+
+ /** Compare two accessible shapes using object identity
+ @param rShape
+ This is the second operand.
+ @return
+ Returns true if both shapes are the same object.
+ */
+ virtual bool operator== (const AccessibleShape& rShape);
+
+ /** Set the specified state. If the state is <const>FOCUSED</const>
+ then, additionally to the inherited functionality, the focus
+ listeners registered with the <type>XAccessibleComponent</type>
+ interface are called (if that state really changes).
+
+ @param aState
+ The state to turn on.
+
+ @return
+ The returned flag indicates whether the specified state has been
+ changed (<TRUE/>), i.e. it has formerly not been set.
+ */
+ virtual sal_Bool SetState (sal_Int16 aState);
+
+ /** Reset the specified state. If the state is <const>FOCUSED</const>
+ then, additionally to the inherited functionality, the focus
+ listeners registered with the <type>XAccessibleComponent</type>
+ interface are called (if that state really changes).
+
+ @param aState
+ The state to turn off.
+
+ @return
+ The returned flag indicates whether the specified state has been
+ changed (<TRUE/>), i.e. it has formerly been set.
+ */
+ virtual sal_Bool ResetState (sal_Int16 aState);
+
+ /** Return the state of the specified state. Take the
+ <const>FOCUSED</const> state from the accessible edit engine.
+
+ @param aState
+ The state for which to return its value.
+ @return
+ A value of <TRUE/> indicates that the state is set. A <FALSE/>
+ value indicates an unset state or the inability to access the
+ entity that manages the state set.
+
+ */
+ sal_Bool GetState (sal_Int16 aState);
+
+
+ //===== XAccessibleContext ==============================================
+
+ /// Return the number of currently visible children.
+ virtual sal_Int32 SAL_CALL
+ getAccessibleChildCount (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return the specified child.
+ @param nIndex
+ Index of the requested child.
+ @return
+ Reference of the requested child which is the accessible object
+ of a visible shape.
+ @raises IndexOutOfBoundsException
+ Throws an exception if the index is not valid.
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> SAL_CALL
+ getAccessibleChild (sal_Int32 nIndex)
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+
+ /// Return the set of current states.
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
+ getAccessibleStateSet (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return this objects index among the parents children.
+ virtual sal_Int32 SAL_CALL
+ getAccessibleIndexInParent (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XAccessibleComponent ============================================
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleAtPoint (const ::com::sun::star::awt::Point& aPoint)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int32 SAL_CALL getForeground (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int32 SAL_CALL getBackground (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+
+ //===== XComponent ========================================================
+
+ using WeakComponentImplHelperBase::addEventListener;
+ using WeakComponentImplHelperBase::removeEventListener;
+
+ //===== XAccessibleEventBroadcaster =====================================
+
+ /** This call is forwarded to a) the base class and b) to the
+ accessible edit engine if it is present.
+
+ @param rxListener
+ This listener is informed about accessibility events.
+ */
+ virtual void SAL_CALL
+ addEventListener (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** This call is forwarded to a) the base class and b) to the
+ accessible edit engine if it is present.
+
+ @param rxListener
+ This listener will not be informed about accessibility events
+ anymore.
+ */
+ virtual void SAL_CALL
+ removeEventListener (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //===== 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 (void)
+ throw ();
+
+ virtual void SAL_CALL
+ release (void)
+ throw ();
+
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XTypeProvider ===================================================
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL
+ getTypes (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== IAccessibleViewForwarderListener ================================
+ virtual void ViewForwarderChanged (ChangeType aChangeType,
+ const IAccessibleViewForwarder* pViewForwarder);
+
+ //===== lang::XEventListener ============================================
+
+ /** Listen for disposing events of the model. The accessible shape
+ remains functional when this happens.
+ */
+ virtual void SAL_CALL
+ disposing (const ::com::sun::star::lang::EventObject& Source)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== document::XEventListener ========================================
+
+ virtual void SAL_CALL
+ notifyEvent (const ::com::sun::star::document::EventObject& rEventObject)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //===== XUnoTunnel ========================================================
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelImplementationId() throw();
+ static AccessibleShape* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxIFace ) throw();
+ sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& _rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ //===== Misc ========================================================
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ GetXShape();
+
+ /** set the index _nIndex at the accessible shape
+ @param _nIndex
+ The new index in parent.
+ */
+ inline void setIndexInParent(sal_Int32 _nIndex) { m_nIndexInParent = _nIndex; }
+
+protected:
+ /// Children manager. May be empty if there are no children.
+ ChildrenManager* mpChildrenManager;
+
+ /// Reference to the actual shape.
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape> mxShape;
+
+ /** Bundle of information passed to all shapes in a document tree.
+ */
+ AccessibleShapeTreeInfo maShapeTreeInfo;
+
+ /** Index that is appended to the object's name to disambiguate between
+ different names with the otherwise same name.
+ */
+ long mnIndex;
+
+ /** the index in parent.
+ */
+ sal_Int32 m_nIndexInParent;
+
+ /** The accessible text engine. May be NULL if it can not be created.
+ */
+ AccessibleTextHelper* mpText;
+
+ /** This object can be used to modify the child list of our parent.
+ */
+ IAccessibleParent* mpParent;
+
+ /** This object can be removed when we have an extra interface to ask if the shape is selected
+ */
+ SdrObject* m_pShape;
+
+ /** This method is called from the component helper base class while
+ disposing.
+ */
+ virtual void SAL_CALL disposing (void);
+
+ /** Create a base name string that contains the accessible name.
+ */
+ virtual ::rtl::OUString
+ CreateAccessibleBaseName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Create a unique name string that contains the accessible name. The
+ name consists of the base name and the index.
+ */
+ virtual ::rtl::OUString
+ CreateAccessibleName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Create a description string that contains the accessible description.
+ virtual ::rtl::OUString
+ CreateAccessibleDescription (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Update the <const>OPAQUE</const> and <const>SELECTED</const> state.
+ */
+ virtual void UpdateStates (void);
+
+private:
+ /** Don't use the default constructor. Use the public constructor that
+ takes the original shape and the parent as arguments instead.
+ */
+ SVX_DLLPRIVATE explicit AccessibleShape (void);
+ /// Don't use the copy constructor. Is there any use for it?
+ SVX_DLLPRIVATE explicit AccessibleShape (const AccessibleShape&);
+ /// Don't use the assignment operator. Do we need this?
+ SVX_DLLPRIVATE AccessibleShape& operator= (const AccessibleShape&);
+
+ /** Call this method when the title, name, or description of the mxShape
+ member (may) have been changed.
+ This method adapts the name and description members of the
+ AccessibleContextBase base class.
+ */
+ void UpdateNameAndDescription (void);
+};
+
+} // end of namespace accessibility
+
+#endif
diff --git a/svx/inc/svx/AccessibleShapeInfo.hxx b/svx/inc/svx/AccessibleShapeInfo.hxx
new file mode 100644
index 000000000000..3aa8908087dd
--- /dev/null
+++ b/svx/inc/svx/AccessibleShapeInfo.hxx
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_SHAPE_INFO_HXX
+#define _SVX_ACCESSIBILITY_ACCESSIBLE_SHAPE_INFO_HXX
+
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <svx/IAccessibleParent.hxx>
+#include "svx/svxdllapi.h"
+
+namespace accessibility {
+
+/** @descr
+ This class is a container for the information specific for a single
+ shape that is passed to the constructor of that shape. It allows to
+ separate the class definitions of the shapes from the information
+ needed on construction. Only the shapes' implementation has to be
+ adapted to a modified <type>AccessibleShapeInfo</type> definition.
+
+ <p>Note that this class complements the
+ <type>AccessibleShapeTreeInfo</type> interface which contains
+ information that is passed to all shapes in a subtree not just to a
+ single shape. </p>
+*/
+class SVX_DLLPUBLIC AccessibleShapeInfo
+{
+public:
+ /** The shape itself for which an accessible object is to be
+ constructed.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape> mxShape;
+
+ /** The accessible parent object of the shape.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> mxParent;
+
+ /** This object that may be realized by the same implementation as that
+ of that of <member>mxParent</member> can be used to modify
+ parent/child relationships with the shape as initiator.
+ Note that NULL is a valid value for this member.
+ */
+ IAccessibleParent* mpChildrenManager;
+
+ /** This index is used to disambiguate names of accessible objects. A
+ value of (the default) -1 leads to the use of the object's z-order
+ instead. Because that is not a good substitute, better pass an ever
+ increasing counter.
+ */
+ sal_Int32 mnIndex;
+
+ /** Copy the given values into the members described above.
+ */
+ AccessibleShapeInfo (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape>& rxShape,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent,
+ IAccessibleParent* pChildrenManager,
+ sal_Int32 nIndex = -1);
+
+ /** Copy the given values into the members described above.
+ The accessible parent implementation object is set to NULL.
+ */
+ AccessibleShapeInfo (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape>& rxShape,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent,
+ sal_Int32 nIndex = -1);
+
+ ~AccessibleShapeInfo (void);
+
+ AccessibleShapeInfo (const AccessibleShapeInfo&);
+private:
+ // Don't use these three methods.
+ SVX_DLLPRIVATE explicit AccessibleShapeInfo (void);
+ SVX_DLLPRIVATE AccessibleShapeInfo& operator= (const AccessibleShapeInfo&);
+};
+
+} // end of namespace accessibility
+
+#endif
diff --git a/svx/inc/svx/AccessibleShapeTreeInfo.hxx b/svx/inc/svx/AccessibleShapeTreeInfo.hxx
new file mode 100644
index 000000000000..f43f0666a437
--- /dev/null
+++ b/svx/inc/svx/AccessibleShapeTreeInfo.hxx
@@ -0,0 +1,216 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_SHAPE_TREE_INFO_HXX
+#define _SVX_ACCESSIBILITY_ACCESSIBLE_SHAPE_TREE_INFO_HXX
+
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/document/XEventBroadcaster.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <svx/IAccessibleViewForwarder.hxx>
+#include "svx/svxdllapi.h"
+
+class SdrView;
+class Window;
+
+namespace accessibility {
+
+/** This class bundles all information that is passed down the tree of
+ accessible shapes so that each shape has access to that info.
+
+ There are basically four members that can be set and queried:
+ <ul>
+ <li>The model broadcaster is used for getting notified about shape
+ changes. Using this broadcaster makes in unnecessary to register at
+ each shape seperately.</li>
+ <li>The view forwarder is responsible for transformation between
+ coordinate systems and for providing the visible area both with respect
+ to a specific window.</li>
+ <li>The SdrView is used for creating accessible edit engines.</li>
+ <li>The Window is used for creating accessible edit engines.</li>
+ </ul>
+*/
+class SVX_DLLPUBLIC AccessibleShapeTreeInfo
+{
+public:
+ /** Deprecated. Don't use this constructor any more.
+ */
+ AccessibleShapeTreeInfo (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleComponent>& rxDocumentWindow,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XEventBroadcaster>& rxBroadcaster);
+
+ /** Use this constructor to create an empty object that is filled later
+ with more meaningfull data.
+ */
+ AccessibleShapeTreeInfo (void);
+
+ /** Create a copy of the given shape info.
+ @param rInfo
+ The shape tree info object to copy.
+ */
+ AccessibleShapeTreeInfo (const AccessibleShapeTreeInfo& rInfo);
+
+ ~AccessibleShapeTreeInfo (void);
+
+ AccessibleShapeTreeInfo& operator= (const AccessibleShapeTreeInfo& rInfo);
+
+ /** Deprecated. Don't use this method.
+ */
+ void SetDocumentWindow (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleComponent>& rxViewWindow);
+ /** Deprecated. Don't use this method.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleComponent>
+ GetDocumentWindow (void) const;
+
+ /** Deprecated. Use the correctly named SetModelBroadcaster method
+ instead.
+ */
+ void SetControllerBroadcaster (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XEventBroadcaster>& rxControllerBroadcaster);
+ /** Deprecated. Use the correctly named GetModelBroadcaster method
+ instead.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XEventBroadcaster>
+ GetControllerBroadcaster (void) const;
+
+ /** Set a new broadcaster that sends events indicating shape changes.
+ The broadcaster usually is or belongs to a document model.
+ @param rxModelBroadcaster
+ The new broadcaster. It replaces the current one. An empty
+ reference may be passed to unset the broadcaster
+ */
+ void SetModelBroadcaster (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XEventBroadcaster>& rxModelBroadcaster);
+
+ /** Return the current model broadcaster.
+ @return
+ The returned reference may be empty if the broadcaster has not
+ been set or has been set to an empty reference.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XEventBroadcaster>
+ GetModelBroadcaster (void) const;
+
+ /** Set the view that will be used to construct SvxTextEditSources which
+ in turn are used to create accessible edit engines.
+ @param pView
+ The new SdrView that replaces the current one. A NULL pointer
+ may be passed to unset the view.
+ */
+ void SetSdrView (SdrView* pView);
+
+ /** Return the current SdrView.
+ @return
+ The returned value may be NULL.
+ */
+ SdrView* GetSdrView (void) const;
+
+ /** Set a new controller. This will usually but not necessarily
+ correspond to the SdrView.
+ @param rxController
+ The new controller that replaces the current one. An empty
+ reference may be passed to unset the controller.
+ */
+ void SetController (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XController>& rxController);
+
+ /** Return the currently set controller.
+ @return
+ The reference to the currently set controller may be empty.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XController>
+ GetController (void) const;
+
+ /** Set the window that is used to construct SvxTextEditSources which in
+ turn is used to create accessible edit engines.
+ */
+ void SetWindow (Window* pWindow);
+
+ /** Return the current Window.
+ @return
+ The returned value may be NULL.
+ */
+ Window* GetWindow (void) const;
+
+ /** The view forwarder allows the transformation between internal
+ and pixel coordinates and can be asked for the visible area.
+ @param pViewForwarder
+ This view forwarder replaces the current one.
+ */
+ void SetViewForwarder (const IAccessibleViewForwarder* pViewForwarder);
+
+ /** Return the current view forwarder.
+ @return
+ The returned pointer may be NULL.
+ */
+ const IAccessibleViewForwarder* GetViewForwarder (void) const;
+
+private:
+ /** Deprecated.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleComponent> mxDocumentWindow;
+
+ /** this broadcaster sends events indicating shape changes.
+ The broadcaster usually is or belongs to a document model.
+
+ This once was named mxControllerBroadcaster.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XEventBroadcaster> mxModelBroadcaster;
+
+ /** This view is necessary to construct an SvxTextEditSource which in
+ turn is used to create an accessible edit engine.
+ */
+ SdrView* mpView;
+
+ /** The controller is used e.g. for obtaining the selected shapes.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XController> mxController;
+
+ /** This window is necessary to construct an SvxTextEditSource which in
+ turn is used to create an accessible edit engine.
+ */
+ Window* mpWindow;
+
+ /** The view forwarder allows the transformation between internal
+ and pixel coordinates and can be asked for the visible area.
+ */
+ const IAccessibleViewForwarder* mpViewForwarder;
+};
+
+} // end of namespace accessibility
+
+#endif
diff --git a/svx/inc/svx/AccessibleTableShape.hxx b/svx/inc/svx/AccessibleTableShape.hxx
new file mode 100644
index 000000000000..9f3edef84a3c
--- /dev/null
+++ b/svx/inc/svx/AccessibleTableShape.hxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_TABLE_SHAPE_HXX
+#define _SVX_ACCESSIBILITY_ACCESSIBLE_TABLE_SHAPE_HXX
+
+#include <com/sun/star/table/XTable.hpp>
+#include <com/sun/star/accessibility/XAccessibleTable.hpp>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+
+#include <rtl/ref.hxx>
+
+#include <cppuhelper/implbase2.hxx>
+
+#include <svx/AccessibleShape.hxx>
+
+#include <boost/noncopyable.hpp>
+
+namespace sdr { namespace table {
+ class SvxTableController;
+} }
+
+namespace accessibility
+{
+ class AccessibleTableShapeImpl;
+
+ typedef ::cppu::ImplInheritanceHelper2< AccessibleShape,
+ ::com::sun::star::accessibility::XAccessibleSelection,
+ ::com::sun::star::accessibility::XAccessibleTable
+ > AccessibleTableShape_Base;
+/** @descr
+*/
+class AccessibleTableShape : boost::noncopyable, public AccessibleTableShape_Base
+{
+public:
+ AccessibleTableShape( const AccessibleShapeInfo& rShapeInfo, const AccessibleShapeTreeInfo& rShapeTreeInfo );
+ virtual ~AccessibleTableShape( );
+
+ virtual void Init (void);
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire( ) throw ();
+ virtual void SAL_CALL release( ) throw ();
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL getAccessibleContext( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole (void) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleTable
+ virtual sal_Int32 SAL_CALL getAccessibleRowCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleColumnCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleRowDescription( sal_Int32 nRow ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleColumnDescription( sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL getAccessibleRowHeaders( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL getAccessibleColumnHeaders( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleRows( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleColumns( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleCaption( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleSummary( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleRow( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleSelection
+ virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL clearAccessibleSelection( ) throw ( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL selectAllAccessibleChildren( ) throw ( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw ( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException );
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL disposing( );
+
+ using AccessibleShape::disposing;
+
+protected:
+ virtual ::rtl::OUString CreateAccessibleBaseName(void) throw (::com::sun::star::uno::RuntimeException);
+
+ sdr::table::SvxTableController* getTableController();
+
+ void checkCellPosition( sal_Int32 nCol, sal_Int32 nRow ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
+ void getColumnAndRow( sal_Int32 nChildIndex, sal_Int32& rnColumn, sal_Int32& rnRow ) throw (::com::sun::star::lang::IndexOutOfBoundsException );
+
+private:
+ rtl::Reference< AccessibleTableShapeImpl > mxImpl;
+};
+
+} // end of namespace accessibility
+
+#endif
diff --git a/svx/inc/svx/AccessibleTextHelper.hxx b/svx/inc/svx/AccessibleTextHelper.hxx
new file mode 100644
index 000000000000..1d0b8cdf8cfb
--- /dev/null
+++ b/svx/inc/svx/AccessibleTextHelper.hxx
@@ -0,0 +1,431 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_ACCESSILE_TEXT_HELPER_HXX_
+#define _SVX_ACCESSILE_TEXT_HELPER_HXX_
+
+#include <memory>
+#include <sal/types.h>
+#include <tools/gen.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include "svx/svxdllapi.h"
+
+
+class SvxTextForwarder;
+class SvxViewForwarder;
+class SvxEditSource;
+
+namespace accessibility
+{
+
+ class AccessibleTextHelper_Impl;
+
+ /** Helper class for objects containing EditEngine/Outliner text
+
+ This class provides the methods from the XAccessibleContext,
+ XAccessibleEventBroadcaster and XAccessibleComponent
+ interfaces, that are common to all accessible objects
+ containing an edit engine.
+
+ The text contained in the EditEngine/Outliner is presented as
+ children of this class, namely for every text paragraph a
+ AccessibleEditableTextPara child object is generated. As this
+ class manages these children for itself, it has to send out
+ AccessibleEventId::CHILD events on your
+ behalf. Thus, you must forward every call to your
+ addEventListener()/removeEventListener() methods to the
+ AccessibleTextHelper (methods
+ AddEventListener/RemoveEventListener), otherwise none or not
+ every one of your event listener will notice child changes.
+
+ You have to implement the SvxEditSource, SvxTextForwarder,
+ SvxViewForwarder and SvxEditViewForwarder interfaces in order
+ to enable your object to cooperate with this
+ class. SvxTextForwarder encapsulates the fact that text
+ objects do not necessarily have an EditEngine at their
+ disposal, SvxViewForwarder and SvxEditViewForwarder do the
+ same for the document and the edit view. The three mentioned
+ forwarder objects are not stored by the AccessibleTextHelper,
+ but fetched every time from the SvxEditSource. So you are best
+ off making your SvxEditSource::Get*Forwarder methods cache the
+ current forwarder.
+
+ To support changes in edit mode or conversion of fixed text
+ into EditEngine text, you can change the SvxEditSource this
+ class is referring to. This might render all children invalid
+ and change the child count, since the AccessibleTextHelper
+ reinitializes itself from scratch.
+
+ This class registers itself at the SvxEditSource as a state
+ listener and manages the state of its children (i.e. the
+ paragraphs). See the method documentation of
+ AccessibleTextHelper::SetEditSource for the expected
+ events. Generally, be prepared that when sending any of these
+ events via SvxEditSource::GetBroadcaster() broadcaster, the
+ AccessibleTextHelper will call the SvxEditSource and their
+ forwarder to update it's state. Avoid being inconsistent in
+ the facts you tell in the events, e.g. when sending a
+ TEXT_HINT_PARAINSERTED event, the
+ SvxEditSource::GetTextForwarder().GetParagraphCount() should
+ already include the newly inserted paragraph.
+
+ @attention All public methods must not be called with any
+ mutex hold, except when calling from the main thread (with
+ holds the solar mutex), unless stated otherwise. This is
+ because they themselves might need the solar mutex in addition
+ to the object mutex, and the ordering of the locking must be:
+ first solar mutex, then object mutex. Furthermore, state
+ change events might be fired internally.
+
+ @derive Use this class in an aggregation and forward, or
+ derive from it and overwrite. If the Remove/AddEventListener
+ methods are overwritten, make sure FireEvent is adapted,
+ too.
+
+ @see SvxEditSource
+ @see SvxTextForwarder
+ @see SvxViewForwarder
+ @see SvxEditViewForwarder
+ */
+ class SVX_DLLPUBLIC AccessibleTextHelper
+ {
+
+ public:
+ typedef ::std::vector< sal_Int16 > VectorOfStates;
+
+ /** Create accessible text object for given edit source
+
+ @param pEditSource
+ The edit source to use. Object ownership is transferred
+ from the caller to the callee. The object listens on the
+ SvxEditSource for object disposal, so no provisions have
+ to be taken if the caller destroys the data (e.g. the
+ model) contained in the given SvxEditSource.
+
+ */
+ explicit AccessibleTextHelper( ::std::auto_ptr< SvxEditSource > pEditSource );
+ virtual ~AccessibleTextHelper();
+
+ protected:
+
+ // declared, but not defined
+ AccessibleTextHelper( const AccessibleTextHelper& );
+ // declared, but not defined
+ AccessibleTextHelper& operator= ( const AccessibleTextHelper& );
+
+ public:
+ /** Query the current edit source
+
+ @attention This method returns by reference, so you are
+ responsible for serialization (typically, you aquired the
+ solar mutex when calling this method). Thus, the method
+ should only be called from the main office thread.
+
+ */
+ virtual const SvxEditSource& GetEditSource() const SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Set the current edit source
+
+ @attention Might fire state change events, therefore,
+ don't hold any mutex except solar mutex, which you are
+ required to lock before. This method should only be called
+ from the main office thread.
+
+ The EditSource set here is required to broadcast out the
+ following hints: EDITSOURCE_HINT_PARASMOVED,
+ EDITSOURCE_HINT_SELECTIONCHANGED, TEXT_HINT_MODIFIED,
+ TEXT_HINT_PARAINSERTED, TEXT_HINT_PARAREMOVED,
+ TEXT_HINT_TEXTHEIGHTCHANGED,
+ TEXT_HINT_VIEWSCROLLED. Otherwise, not all state changes
+ will get noticed by the accessibility object. Further
+ more, when the corresponding core object or the model is
+ dying, either the edit source must be set to NULL or it
+ has to broadcast a SFX_HINT_DYING hint.
+
+ If the SvxEditSource's managed text can change between
+ edit/non-edit mode (i.e. there are times when
+ SvxEditSource::GetEditViewForwarder(sal_False) returns
+ NULL), then the two additional hints are required:
+ HINT_BEGEDIT and HINT_ENDEDIT. When the
+ AccessibleTextHelper receives a HINT_BEGEDIT, it expects
+ the SvxEditSource already in edit mode. On a HINT_ENDEDIT,
+ edit mode must already been left. The rationale for these
+ events are the fact that focus and selection have to be
+ updated in edit mode, and completely relinquished and
+ reset to the parent (for the focus) in non-edit mode.
+
+ This class does not have a dispose method, since it is not
+ a UNO component. Nevertheless, it holds C++ references to
+ several core objects, so you should issue a
+ SetEditSource(::std::auto_ptr<SvxEditSource>(NULL)) in
+ your dispose() method.
+
+ @param pEditSource
+ The new edit source to set. Object ownership is transferred
+ from the caller to the callee.
+ */
+ virtual void SetEditSource( ::std::auto_ptr< SvxEditSource > pEditSource ) SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Set the event source
+
+ You should set the event source before registering any
+ event listener and before requesting any child. Children
+ of this object receive the event source as their parent
+ accessible object. That is, the event source is best set
+ in your object's init method.
+
+ @attention When setting a reference here, you should call
+ Dispose() when you as the owner are disposing, since until
+ then this object will hold that reference
+
+ @param rInterface
+ The interface that should be set as the source for
+ accessibility events sent by this object.
+ */
+ virtual void SetEventSource( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rInterface );
+
+ /** Get the event source
+
+ @return the interface that is set as the source for
+ accessibility events sent by this object.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetEventSource() const;
+
+ /** Set offset of EditEngine/Outliner from parent
+
+ If the origin of the underlying EditEngine/Outliner does
+ not correspond to the upper left corner of the object
+ using this class, you have to specify the offset.
+
+ @attention Might fire state change events, therefore,
+ don't hold any mutex except solar mutex, which you are
+ required to lock before. This method should only be called
+ from the main office thread.
+
+ @param rPoint
+ The offset in screen coordinates (i.e. pixel)
+ */
+ virtual void SetOffset( const Point& rPoint );
+
+ /** Query offset of EditEngine/Outliner from parent
+
+ @return the offset in screen coordinates (i.e. pixel)
+ */
+ virtual Point GetOffset() const;
+
+ /** Set offset the object adds to all children's indices
+
+ This can be used if the owner of this object has children
+ handled by itself. Setting an offset different from 0
+ leads to this object mimicking that all it's children are
+ within the range [nOffset, GetChildCount()+nOffset). That
+ means, GetChild() also expects the index to be in this
+ range.
+
+ @attention Might fire state change events, therefore,
+ don't hold any mutex except solar mutex, which you are
+ required to lock before. This method should only be called
+ from the main office thread.
+
+ @param nOffset
+ The offset to add to every children's index.
+ */
+ virtual void SetStartIndex( sal_Int32 nOffset );
+
+ /** Query offset the object adds to all children's indices
+
+ @return the offset to add to every children's index.
+ */
+ virtual sal_Int32 GetStartIndex() const;
+
+ /** Sets a vector of additional accessible states.
+
+ The states are passed to every created child object
+ (text paragraph). The state values are defined in
+ com::sun::star::accessibility::AccessibleStateType.
+
+ This function has to be called before querying for
+ any children (e.g. with GetChild()).
+ */
+ void SetAdditionalChildStates( const VectorOfStates& rChildStates );
+
+ /** Returns the additional accessible states for children.
+ */
+ const VectorOfStates& GetAdditionalChildStates() const;
+
+ /** Update the visible children
+
+ @attention Might fire state change events, therefore,
+ don't hold any mutex except solar mutex, which you are
+ required to lock before. This method should only be called
+ from the main office thread.
+
+ This method reevaluates the visibility of all
+ childrens. Call this method if your visibility state has
+ changed somehow, e.g. if the visible area has changed and
+ the AccessibleTextHelper isn't notified internally
+ (e.g. via TEXT_HINT_VIEWSCROLLED). Normally, there should
+ not be a need to call this method.
+ */
+ virtual void UpdateChildren() SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Drop all references and enter disposed state
+
+ This method drops all references to external objects (also
+ the event source reference set via SetEventSource()) and
+ sets the object into the disposed state (i.e. the methods
+ return default values or throw a uno::DisposedException
+ exception).
+ */
+ virtual void Dispose();
+
+ /** Set the focus state of the accessibility object
+
+ Since this class handles children which also might get the
+ focus, the user of this class is encouraged to delegate
+ focus handling. Whenever the focus state of the
+ surrounding object changes, this method has to be called.
+
+ The protocol of focus handling for a user of this class is
+ then to call SetFocus() with the appropriate focus state,
+ and HaveFocus() to determine the focus state you tell the
+ outside.
+
+ @attention Might fire state change events, therefore,
+ don't hold any mutex except solar mutex, which you are
+ required to lock before. This method should only be called
+ from the main office thread.
+
+ @param bHaveFocus
+ Whether we got or we lost the focus. Set to sal_True if
+ focus is gotten, sal_False otherwise.
+
+ @see HaveFocus()
+ */
+ virtual void SetFocus( sal_Bool bHaveFocus = sal_True ) SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Query the focus state of the surrounding object
+
+ If focus handling is delegated to this class, determine
+ focus state with this method. Be prepared that even if you
+ set the focus with SetFocus(sal_True), this method might
+ return sal_False. This is the case if one of the children
+ actually got the focus.
+
+ @return the state of the focus ownership
+ */
+ virtual sal_Bool HaveFocus() SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Call this method to invoke all event listeners with the given event
+
+ @attention Fires state change events, therefore, don't hold any mutex
+
+ @param nEventId
+ Id of the event to send, @see AccessibleEventId
+
+ @param rNewValue
+ The value we've changed into
+
+ @param rOldValue
+ The old value before the change
+ */
+ virtual void FireEvent( const sal_Int16 nEventId,
+ const ::com::sun::star::uno::Any& rNewValue = ::com::sun::star::uno::Any(),
+ const ::com::sun::star::uno::Any& rOldValue = ::com::sun::star::uno::Any() ) const;
+
+ /** Call this method to invoke all event listeners with the given event
+
+ @attention Fires state change events, therefore, don't hold any mutex
+
+ @param rEvent
+ The event to send, @see AccessibleEventObject
+
+ */
+ // TODO: make that virtual next time
+ void FireEvent( const ::com::sun::star::accessibility::AccessibleEventObject& rEvent ) const;
+
+ /** Query select state of the text managed by this object
+
+ @attention Don't call with locked mutexes. You may hold
+ the solar mutex, but this method aquires it anyway.
+
+ @return sal_True, if the text or parts of it are currently selected
+ */
+ virtual sal_Bool IsSelected() const;
+
+ // XAccessibleContext child handling methods
+ //-----------------------------------------------------------------
+ /** Implements getAccessibleChildCount
+
+ @attention Don't call with locked mutexes. You may hold
+ the solar mutex, but this method aquires it anyway.
+ */
+ virtual sal_Int32 GetChildCount() SAL_THROW((::com::sun::star::uno::RuntimeException));
+ /** Implements getAccessibleChild
+
+ @attention Don't call with locked mutexes. You may hold
+ the solar mutex, but this method aquires it anyway.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetChild( sal_Int32 i ) SAL_THROW((::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException));
+
+ // XAccessibleEventBroadcaster child related methods
+ //-----------------------------------------------------------------
+ /** Implements addEventListener
+
+ @attention Don't call with locked mutexes
+ */
+ virtual void AddEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) SAL_THROW((::com::sun::star::uno::RuntimeException));
+ /** Implements removeEventListener
+
+ @attention Don't call with locked mutexes
+ */
+ virtual void RemoveEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ // XAccessibleComponent child related methods
+ //-----------------------------------------------------------------
+ /** Implements getAccessibleAt
+
+ @attention Don't call with locked mutexes. You may hold
+ the solar mutex, but this method aquires it anyway.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL GetAt( const ::com::sun::star::awt::Point& aPoint ) SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ private:
+
+ /// @dyn
+ const std::auto_ptr< AccessibleTextHelper_Impl > mpImpl;
+
+ };
+
+} // end of namespace accessibility
+
+#endif /* _SVX_ACCESSILE_TEXT_HELPER_HXX_ */
diff --git a/svx/inc/svx/ActionDescriptionProvider.hxx b/svx/inc/svx/ActionDescriptionProvider.hxx
new file mode 100644
index 000000000000..5b6e0ab9ab35
--- /dev/null
+++ b/svx/inc/svx/ActionDescriptionProvider.hxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_ACTIONDESCRIPTIONPROVIDER_HXX
+#define _SVX_ACTIONDESCRIPTIONPROVIDER_HXX
+
+#include "svx/svxdllapi.h"
+
+// header for class OUString
+#include <rtl/ustring.hxx>
+
+//-----------------------------------------------------------------------------
+/** This class provides localized descriptions for some basic actions done with objects.
+The strings are intended to be provided to the user e.g. as description for undo actions in the menu.
+The name of the object acted on and the type of action needs to be given as input parameter.
+*/
+
+class SVX_DLLPUBLIC ActionDescriptionProvider
+{
+public:
+ enum ActionType
+ {
+ INSERT
+ , DELETE
+ , CUT
+ , MOVE
+ , RESIZE
+ , ROTATE
+ , TRANSFORM
+ , FORMAT
+ , MOVE_TOTOP
+ , MOVE_TOBOTTOM
+ , POS_SIZE
+ };
+
+public:
+ static ::rtl::OUString createDescription( ActionType eActionType
+ , const ::rtl::OUString& rObjectName );
+};
+
+#endif
diff --git a/svx/inc/svx/ChildrenManager.hxx b/svx/inc/svx/ChildrenManager.hxx
new file mode 100644
index 000000000000..131f834eac03
--- /dev/null
+++ b/svx/inc/svx/ChildrenManager.hxx
@@ -0,0 +1,216 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_ACCESSIBILITY_CHILDREN_MANAGER_HXX
+#define _SVX_ACCESSIBILITY_CHILDREN_MANAGER_HXX
+
+#include <svx/IAccessibleViewForwarderListener.hxx>
+#include <svx/AccessibleShapeTreeInfo.hxx>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <memory>
+#include "svx/svxdllapi.h"
+
+namespace accessibility {
+
+class AccessibleContextBase;
+class AccessibleShape;
+class ChildrenManagerImpl;
+
+/** The <type>AccessibleChildrenManager</type> class acts as a cache of the
+ accessible objects of the currently visible shapes of a draw page and as
+ a factory to create the corresponding accessible object for a given
+ shape.
+
+ <p>There are two sources of shapes. The first is a list of UNO shapes.
+ It is passes to the constructor and can be re-set with a call to
+ <member>SetShapeList</member>. Accessibility objects which represent
+ these shapes are constructed usually on demand. The second source is a
+ set of single <type>AccessibleShape</type> objects added by calls to
+ <member>AddAccessibleShape</member>. These are not modified by this
+ class. They are only copied into the list of visible shapes depending
+ on their visibility. The later list can be cleared by calling
+ <member>ClearAccessibleShapeList</member>. The actual set of children
+ accessible through the <member>GetChildrenCount</member> and
+ <member>GetChild</member> methods are the accessible objects that lie
+ completely or partially inside the visible area obtained from the view
+ forwarder in the shape tree info.</p>
+
+ <p>A children manager registers itself at the broadcaster passed to its
+ constructor and transforms/forwards the recieved events to the listeners
+ of the also given context base. The transformation process includes
+ interpreting a <type>document::XEventListener</type>, the change from
+ XShape references to the associated XAccessible reference, and the
+ creation of an XAccessibleEventObject. The event object is then passed
+ to the <method>fireEvent</method> method of the context and from there
+ forwarded to all listeners.</p>
+
+ <p>Note that some of the data given to the constructor is passed to the
+ accessible shape objects created by that child manager which in turn
+ pass these data to their child managers. The data is thus propagated
+ down a tree of child managers/accessible shape objects from a top level
+ class that is usually a document/model. This is the way to give all
+ accessible objects access to data normally known only to the top level
+ owner of the shapes.</p>
+*/
+class SVX_DLLPUBLIC ChildrenManager
+ : public IAccessibleViewForwarderListener
+{
+public:
+ /** Create a children manager, which manages the children of the given
+ parent. The parent is used for creating accessible objects. The
+ list of shapes for which to create those objects is not derived from
+ the parent and has to be provided seperately by calling one of the
+ update methods.
+ @param rxParent
+ The parent of the accessible objects which will be created
+ on demand at some point of time in the future.
+ @param rxShapeList
+ List of UNO shapes to manage.
+ @param rShapeTreeInfo
+ Bundel of information passed down the shape tree.
+ @param rContext
+ An accessible context object that is called for fireing events
+ for new and deleted children, i.e. that holds a list of
+ listeners to be informed.
+ */
+ ChildrenManager (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes>& rxShapeList,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo,
+ AccessibleContextBase& rContext);
+
+ /** If there still are managed children these are marked as DEFUNC and
+ released.
+ */
+ virtual ~ChildrenManager (void);
+
+ /** Return the number of currently visible accessible children.
+ @return
+ If there are no children a 0 is returned.
+ */
+ long GetChildCount (void) const throw ();
+
+ /** Return the requested accessible child or throw and
+ IndexOutOfBoundsException if the given index is invalid.
+ @param nIndex
+ Index of the requested child. Call getChildCount for obtaining
+ the number of children.
+ @return
+ In case of a valid index this method returns a reference to the
+ requested accessible child. This reference is empty if it has
+ not been possible to create the accessible object of the
+ corresponding shape.
+ @raises
+ Throws an IndexOutOfBoundsException if the index is not valid.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>
+ GetChild (long nIndex)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IndexOutOfBoundsException);
+
+ /** Update the child manager. Take care of a modified set of children
+ and modified visible area. This method can optimize the update
+ process with respect seperate updates of a modified children list
+ and visible area.
+ @param bCreateNewObjectsOnDemand
+ If </true> then accessible objects associated with the visible
+ shapes are created only when asked for. No event is sent on
+ creation. If </false> then the accessible objects are created
+ before this method returns and events are sent to inform the
+ listeners of the new object.
+ */
+ void Update (bool bCreateNewObjectsOnDemand = true);
+
+ /** Replace the list of UNO shapes by the specified list.
+ @param xShapeList
+ The new list of shapes.
+ */
+ void SetShapeList (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes>& xShapeList);
+
+ /** Add an accessible shape. The difference to the UNO shapes in the
+ list passed to the constructor the specified object does not have to
+ be created by the shape factory. This gives the caller full control
+ over object creation.
+
+ @param pShape
+ This class <em>does</em> take ownership of the argument.
+ */
+ void AddAccessibleShape (std::auto_ptr<AccessibleShape> pShape);
+
+ /** Clear the list of accessible shapes which have been added by
+ previous calls to <member>AddAccessibleShape</member>.
+ */
+ void ClearAccessibleShapeList (void);
+
+ /** Take a new event shape tree info. Call this method to inform the
+ children manager of a change of the info bundle.
+ @param rShapeTreeInfo
+ The new info that replaces the current one.
+ */
+ void SetInfo (AccessibleShapeTreeInfo& rShapeTreeInfo);
+
+ /** Update the SELECTED and FOCUSED states of all visible children
+ according to the given selection. This includes setting
+ <em>and</em> resetting the states.
+ */
+ void UpdateSelection (void);
+
+ /** Return whether one of the shapes managed by this object has
+ currently the focus.
+ @return
+ Returns <true/> when there is a shape that has the focus and
+ <false/> when there is no such shape.
+ */
+ bool HasFocus (void);
+
+ /** When there is a shape that currently has the focus,
+ i.e. <member>HasFocus()</member> returns <true/> then remove the
+ focus from that shape. Otherwise nothing changes.
+ */
+ void RemoveFocus (void);
+
+ //===== IAccessibleViewForwarderListener ================================
+ virtual void ViewForwarderChanged (ChangeType aChangeType,
+ const IAccessibleViewForwarder* pViewForwarder);
+
+protected:
+ ChildrenManagerImpl* mpImpl;
+
+private:
+ // Don't use the copy constructor or the assignment operator. They are
+ // not implemented (and are not intended to be).
+ SVX_DLLPRIVATE ChildrenManager (const ChildrenManager&);
+ SVX_DLLPRIVATE ChildrenManager& operator= (const ChildrenManager&);
+};
+
+} // end of namespace accessibility
+
+#endif
diff --git a/svx/inc/svx/DescriptionGenerator.hxx b/svx/inc/svx/DescriptionGenerator.hxx
new file mode 100644
index 000000000000..501b350eef05
--- /dev/null
+++ b/svx/inc/svx/DescriptionGenerator.hxx
@@ -0,0 +1,217 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _SVX_ACCESSIBILITY_DESCRIPTION_GENERATOR_HXX
+#define _SVX_ACCESSIBILITY_DESCRIPTION_GENERATOR_HXX
+
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <rtl/ustrbuf.hxx>
+#include "svx/svxdllapi.h"
+
+
+namespace accessibility {
+
+/** This class creates description strings for shapes.
+ <p>Initialized with a given shape additional calls to the
+ <member>addProperty</member> method will build a descriptive string that
+ starts with a general shape description and the shapes style. Appended
+ are all the specified property names and values that differ from the
+ default values in the style.</p>
+*/
+class SVX_DLLPUBLIC DescriptionGenerator
+{
+public:
+ enum PropertyType {
+ COLOR,
+ INTEGER,
+ STRING,
+ FILL_STYLE
+ };
+
+ /** Creates a new description generator with an empty description
+ string. Usually you will want to call initialize next to specifiy
+ a general description of the shape.
+ @param xShape
+ The shape from which properties will be extracted by later calls
+ to <member>addProperty</member>.
+ */
+ DescriptionGenerator (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape>& xShape);
+
+ ~DescriptionGenerator (void);
+
+ /** Initialize the description with the given prefix followed by the
+ shape's style in parantheses and a colon.
+ @param sPrefix
+ An introductory description of the shape that is made more
+ specific by later calls to <member>addProperty</member>.
+ */
+ void Initialize (::rtl::OUString sPrefix);
+
+ /** Initialize the description with the specified string from the
+ resource followed by the shape's style in parantheses and a colon.
+ @param nResourceId
+ A resource id the specifies the introductory description of the
+ shape that is made more specific by later calls to
+ <member>addProperty</member>.
+ */
+ void Initialize (sal_Int32 nResourceId);
+
+ /** Returns the description string and then resets it. Usually called
+ as last method before destroying the object.
+ @return
+ The description string in its current form.
+ */
+ ::rtl::OUString operator() (void);
+
+ /** Add the given property name and its associated value to the
+ description string. If the property value does not differ from the
+ default value of the shape's style then the description string is
+ not modified.
+ @param sPropertyName
+ The Name of the property to append.
+ @param aType
+ Type of the property's value. It controls the transformation
+ into the value's string representation.
+ @param sLocalizedName
+ Localized name of the property. An empty string tells the
+ method to use the property name instead.
+ @param nWhichId
+ This which id is used to localize the property value. If it is
+ not known a value of -1 signals to use a default representation.
+ */
+ void AddProperty (const ::rtl::OUString& sPropertyName,
+ PropertyType aType,
+ const ::rtl::OUString& sLocalizedName=::rtl::OUString(),
+ long nWhichId=-1);
+
+ /** Add the given property name and its associated value to the
+ description string. If the property value does not differ from the
+ default value of the shape's style then the description string is
+ not modified. This method forwards the request to its cousing but
+ first replaces the id of the localized name by the associated string
+ from the resource.
+ @param sPropertyName
+ The Name of the property to append.
+ @param aType
+ Type of the property's value. It controls the transformation
+ into the value's string representation.
+ @param nResourceId
+ Id of the kocalized name of the property int the resource.
+ @param nWhichId
+ This which id is used to localize the property value. If it is
+ not known a value of -1 signals to use a default representation.
+ */
+ void AddProperty (const ::rtl::OUString& sPropertyName,
+ PropertyType aType,
+ sal_Int32 nResourceId,
+ long nWhichId=-1);
+
+ /** Append the given string as is to the current description.
+ @param sString
+ String to append to the current description. It is not modified
+ in any way.
+ */
+ void AppendString (const ::rtl::OUString& sString);
+
+ /** This method adds for debuging and development the list of all known
+ properties to the description. Don't use in production code.
+ */
+ void AddPropertyNames (void);
+
+ /** Add properties that describe line and border attributes.
+ */
+ void AddLineProperties (void);
+
+ /** Add properties that describe how areas are filled.
+ */
+ void AddFillProperties (void);
+
+ /** Add properties that describesattributes of 3D objects.
+ */
+ void Add3DProperties (void);
+
+ /** Add properties that describe text attributes.
+ */
+ void AddTextProperties (void);
+
+private:
+ /// Reference to the shape from which the properties are extracted.
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> mxShape;
+
+ /// Reference to the shape's property set.
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> mxSet;
+
+ /// The description string that is build.
+ ::rtl::OUStringBuffer msDescription;
+
+ /** This flag is used to determine whether to insert a separator e.g. a
+ comma before the next property.
+ */
+ bool mbIsFirstProperty;
+
+ /** Add a property value formated as color to the description string.
+ */
+ SVX_DLLPRIVATE void AddColor (const ::rtl::OUString& sPropertyName,
+ const ::rtl::OUString& sLocalizedName);
+
+ /** Add a property value of unknown type to the description string.
+ */
+ SVX_DLLPRIVATE void AddUnknown (const ::rtl::OUString& sPropertyName,
+ const ::rtl::OUString& sLocalizedName);
+
+ /** Add a property value formated as integer to the description string.
+ */
+ SVX_DLLPRIVATE void AddInteger (const ::rtl::OUString& sPropertyName,
+ const ::rtl::OUString& sLocalizedName);
+
+ /** Add a property value formated as string to the description string.
+ @param sPropertyName
+ Name of the property.
+ */
+ SVX_DLLPRIVATE void AddString (const ::rtl::OUString& sPropertyName,
+ const ::rtl::OUString& sLocalizedName, long nWhichId = -1);
+
+ /** Add a property value formated as fill style to the description
+ string. If the fill style is <const>HATCH</const>,
+ <const>GRADIENT</const>, or <const>BITMAP</const>, then the of the
+ hatch, gradient, or bitmap is appended as well.
+ @param sPropertyName
+ Name of the property. Usually this will be "FillStyle".
+ */
+ SVX_DLLPRIVATE void AddFillStyle (const ::rtl::OUString& sPropertyName,
+ const ::rtl::OUString& sLocalizedName);
+};
+
+
+} // end of namespace accessibility
+
+
+#endif
+
diff --git a/svx/inc/svx/EnhancedCustomShape2d.hxx b/svx/inc/svx/EnhancedCustomShape2d.hxx
new file mode 100644
index 000000000000..b3b944513e60
--- /dev/null
+++ b/svx/inc/svx/EnhancedCustomShape2d.hxx
@@ -0,0 +1,221 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ENHANCEDCUSTOMSHAPE2D_HXX
+#define _ENHANCEDCUSTOMSHAPE2D_HXX
+
+#include <svx/msdffdef.hxx>
+#include <svx/sdasitm.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/awt/Point.hpp>
+#include <svl/itemset.hxx>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameter.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
+#include <svx/EnhancedCustomShapeFunctionParser.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+#define DFF_CUSTOMSHAPE_FLIP_V 1
+#define DFF_CUSTOMSHAPE_FLIP_H 2
+#define DFF_CUSTOMSHAPE_EXCH 4
+
+class SdrModel;
+class SdrObject;
+class SfxItemSet;
+struct SvxMSDffVertPair;
+struct SvxMSDffCalculationData;
+struct SvxMSDffTextRectangles;
+class SvxMSDffAdjustmentHandle;
+
+#define HANDLE_FLAGS_MIRRORED_X 0x0001
+#define HANDLE_FLAGS_MIRRORED_Y 0x0002
+#define HANDLE_FLAGS_SWITCHED 0x0004
+#define HANDLE_FLAGS_POLAR 0x0008
+#define HANDLE_FLAGS_MAP 0x0010
+#define HANDLE_FLAGS_RANGE_X_MINIMUM 0x0020
+#define HANDLE_FLAGS_RANGE_X_MAXIMUM 0x0040
+#define HANDLE_FLAGS_RANGE_Y_MINIMUM 0x0080
+#define HANDLE_FLAGS_RANGE_Y_MAXIMUM 0x0100
+#define HANDLE_FLAGS_RADIUS_RANGE_MINIMUM 0x0200
+#define HANDLE_FLAGS_RADIUS_RANGE_MAXIMUM 0x0400
+#define HANDLE_FLAGS_REFX 0x0800
+#define HANDLE_FLAGS_REFY 0x1000
+#define HANDLE_FLAGS_REFANGLE 0x2000
+#define HANDLE_FLAGS_REFR 0x4000
+
+// MSDFF_HANDLE_FLAGS_RANGE_Y seems to be not defined in
+// escher, but we are using it internally in to differentiate
+// between X_RANGE and Y_RANGE
+
+class SdrPathObj;
+
+class EnhancedCustomShape2d : public SfxItemSet
+{
+ SdrObject* pCustomShapeObj;
+ MSO_SPT eSpType;
+
+ sal_Int32 nCoordLeft;
+ sal_Int32 nCoordTop;
+ sal_Int32 nCoordWidth;
+ sal_Int32 nCoordHeight;
+ Rectangle aLogicRect;
+
+ double fXScale;
+ double fYScale;
+ double fXRatio;
+ double fYRatio;
+
+ sal_Int32 nXRef;
+ sal_Int32 nYRef;
+ sal_uInt32 nFlags;
+ sal_uInt32 nColorData;
+
+ /*
+
+ */
+ com::sun::star::uno::Sequence< rtl::OUString > seqEquations;
+ std::vector< ::boost::shared_ptr< EnhancedCustomShape::ExpressionNode > > vNodesSharedPtr;
+
+
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > seqSegments;
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair> seqCoordinates;
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame > seqTextFrames;
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair> seqGluePoints;
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > seqAdjustmentValues;
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValues > seqHandles;
+
+ sal_Bool bTextFlow : 1;
+ sal_Bool bFilled : 1;
+ sal_Bool bStroked : 1;
+
+ sal_Bool bFlipH;
+ sal_Bool bFlipV;
+ sal_Int32 nRotateAngle;
+
+ sal_Bool SetAdjustValueAsDouble( const double& rValue, const sal_Int32 nIndex );
+ sal_Int32 GetLuminanceChange( sal_uInt32 nIndex ) const;
+ Color GetColorData( const Color& rFillColor, sal_uInt32 nIndex ) const;
+ void AdaptObjColor(SdrPathObj& rObj, const SfxItemSet& rCustomShapeSet,
+ sal_uInt32& nColorIndex, sal_uInt32 nColorCount);
+ sal_Bool GetParameter( double& rParameterReturnValue, const com::sun::star::drawing::EnhancedCustomShapeParameter&,
+ const sal_Bool bReplaceGeoWidth, const sal_Bool bReplaceGeoHeight ) const;
+ Point GetPoint( const com::sun::star::drawing::EnhancedCustomShapeParameterPair&,
+ const sal_Bool bScale = sal_True, const sal_Bool bReplaceGeoSize = sal_False ) const;
+
+ void CreateSubPath( sal_uInt16& rSrcPt, sal_uInt16& rSegmentInd, std::vector< SdrPathObj* >& rObjectList,
+ sal_Bool bLineGeometryNeededOnly, sal_Bool bSortFilledObjectsToBack );
+ SdrObject* CreatePathObj( sal_Bool bLineGeometryNeededOnly );
+ const sal_Int32* ApplyShapeAttributes( const SdrCustomShapeGeometryItem& rItem );
+
+ public :
+
+ struct Handle
+ {
+ sal_uInt32 nFlags;
+
+ sal_Bool bMirroredX;
+ sal_Bool bMirroredY;
+ sal_Bool bSwitched;
+
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aPosition;
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aPolar;
+
+ sal_Int32 nRefX;
+ sal_Int32 nRefY;
+ sal_Int32 nRefAngle;
+ sal_Int32 nRefR;
+
+ com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum;
+ com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum;
+ com::sun::star::drawing::EnhancedCustomShapeParameter aXRangeMinimum;
+ com::sun::star::drawing::EnhancedCustomShapeParameter aXRangeMaximum;
+ com::sun::star::drawing::EnhancedCustomShapeParameter aYRangeMinimum;
+ com::sun::star::drawing::EnhancedCustomShapeParameter aYRangeMaximum;
+
+ Handle() : bMirroredX ( sal_False ), bMirroredY ( sal_False ), bSwitched( sal_False ),
+ nRefX( -1 ), nRefY( -1 ), nRefAngle( -1 ), nRefR( -1 ) {};
+ };
+
+ sal_Bool IsFlipVert() { return bFlipV; };
+ sal_Bool IsFlipHorz() { return bFlipH; };
+ sal_Int32 GetRotateAngle() { return nRotateAngle; };
+
+ SVX_DLLPUBLIC SdrObject* CreateLineGeometry();
+ SVX_DLLPUBLIC SdrObject* CreateObject( sal_Bool bLineGeometryNeededOnly );
+ SVX_DLLPUBLIC void ApplyGluePoints( SdrObject* pObj );
+ SVX_DLLPUBLIC Rectangle GetTextRect() const;
+
+ SVX_DLLPUBLIC sal_uInt32 GetHdlCount() const;
+ SVX_DLLPUBLIC sal_Bool GetHandlePosition( const sal_uInt32 nIndex, Point& rReturnPosition ) const;
+ SVX_DLLPUBLIC sal_Bool SetHandleControllerPosition( const sal_uInt32 nIndex, const com::sun::star::awt::Point& rPosition );
+
+ SVX_DLLPUBLIC EnhancedCustomShape2d( SdrObject* pSdrObjCustomShape );
+ SVX_DLLPUBLIC ~EnhancedCustomShape2d();
+
+ enum EnumFunc
+ {
+ ENUM_FUNC_PI,
+ ENUM_FUNC_LEFT,
+ ENUM_FUNC_TOP,
+ ENUM_FUNC_RIGHT,
+ ENUM_FUNC_BOTTOM,
+ ENUM_FUNC_XSTRETCH,
+ ENUM_FUNC_YSTRETCH,
+ ENUM_FUNC_HASSTROKE,
+ ENUM_FUNC_HASFILL,
+ ENUM_FUNC_WIDTH,
+ ENUM_FUNC_HEIGHT,
+ ENUM_FUNC_LOGWIDTH,
+ ENUM_FUNC_LOGHEIGHT
+ };
+ double GetEnumFunc( const EnumFunc eVal ) const;
+
+ double GetAdjustValueAsDouble( const sal_Int32 nIndex ) const;
+ double GetEquationValueAsDouble( const sal_Int32 nIndex ) const;
+ sal_Int32 GetAdjustValueAsInteger( const sal_Int32 nIndex, const sal_Int32 nDefault = 0 ) const;
+
+ SVX_DLLPUBLIC static rtl::OUString GetEquation( const sal_uInt16 nFlags, sal_Int16 nPara1, sal_Int16 nPara2, sal_Int16 nPara3 );
+
+ static void AppendEnhancedCustomShapeEquationParameter( rtl::OUString& rParameter, const sal_Int16 nPara, const sal_Bool bIsSpecialValue );
+
+ static void SetEnhancedCustomShapeEquationParameter( com::sun::star::drawing::EnhancedCustomShapeParameter&
+ rParameter, const sal_Int16 nPara, const sal_Bool bIsSpecialValue );
+ SVX_DLLPUBLIC static void SetEnhancedCustomShapeParameter( com::sun::star::drawing::EnhancedCustomShapeParameter&
+ rParameter, const sal_Int32 nValue );
+ SVX_DLLPUBLIC static void SetEnhancedCustomShapeHandleParameter( com::sun::star::drawing::EnhancedCustomShapeParameter&
+ rParameter, const sal_Int32 nPara, const sal_Bool bIsSpecialValue, sal_Bool bHorz );
+ static sal_Bool ConvertSequenceToEnhancedCustomShape2dHandle( const com::sun::star::beans::PropertyValues& rHandleProperties,
+ EnhancedCustomShape2d::Handle& rDestinationHandle );
+ static void SwapStartAndEndArrow( SdrObject* pObj );
+};
+#endif
+
diff --git a/svx/inc/svx/EnhancedCustomShapeFunctionParser.hxx b/svx/inc/svx/EnhancedCustomShapeFunctionParser.hxx
new file mode 100644
index 000000000000..fa529bca8494
--- /dev/null
+++ b/svx/inc/svx/EnhancedCustomShapeFunctionParser.hxx
@@ -0,0 +1,214 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ENHANCEDCUSTOMSHAPEFUNCTIONPARSER_HXX
+#define _ENHANCEDCUSTOMSHAPEFUNCTIONPARSER_HXX
+
+#include <sal/config.h>
+#include <boost/shared_ptr.hpp>
+#include "EnhancedCustomShapeFunctionParser.hxx"
+#include <com/sun/star/drawing/EnhancedCustomShapeParameter.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
+#include <vector>
+
+#include <svx/svxdllapi.h>
+
+struct EnhancedCustomShapeEquation
+{
+ sal_Int32 nOperation;
+ sal_Int32 nPara[ 3 ];
+
+ EnhancedCustomShapeEquation() :
+ nOperation ( 0 )
+ {
+ nPara[ 0 ] = nPara[ 1 ] = nPara[ 2 ] = 0;
+ }
+};
+
+class EnhancedCustomShape2d;
+
+namespace EnhancedCustomShape {
+
+enum ExpressionFunct
+{
+ FUNC_CONST,
+
+ ENUM_FUNC_PI,
+ ENUM_FUNC_LEFT,
+ ENUM_FUNC_TOP,
+ ENUM_FUNC_RIGHT,
+ ENUM_FUNC_BOTTOM,
+ ENUM_FUNC_XSTRETCH,
+ ENUM_FUNC_YSTRETCH,
+ ENUM_FUNC_HASSTROKE,
+ ENUM_FUNC_HASFILL,
+ ENUM_FUNC_WIDTH,
+ ENUM_FUNC_HEIGHT,
+ ENUM_FUNC_LOGWIDTH,
+ ENUM_FUNC_LOGHEIGHT,
+ ENUM_FUNC_ADJUSTMENT,
+ ENUM_FUNC_EQUATION,
+
+ UNARY_FUNC_ABS,
+ UNARY_FUNC_SQRT,
+ UNARY_FUNC_SIN,
+ UNARY_FUNC_COS,
+ UNARY_FUNC_TAN,
+ UNARY_FUNC_ATAN,
+ UNARY_FUNC_NEG,
+
+ BINARY_FUNC_PLUS,
+ BINARY_FUNC_MINUS,
+ BINARY_FUNC_MUL,
+ BINARY_FUNC_DIV,
+ BINARY_FUNC_MIN,
+ BINARY_FUNC_MAX,
+ BINARY_FUNC_ATAN2,
+
+ TERNARY_FUNC_IF
+};
+
+#define EXPRESSION_FLAG_SUMANGLE_MODE 1
+
+SVX_DLLPUBLIC void FillEquationParameter( const com::sun::star::drawing::EnhancedCustomShapeParameter&, const sal_Int32, EnhancedCustomShapeEquation& );
+
+class ExpressionNode
+{
+public:
+ virtual ~ExpressionNode();
+
+ /** Predicate whether this node is constant.
+
+ This predicate returns true, if this node is
+ neither time- nor ViewInfo dependent. This allows
+ for certain obtimizations, i.e. not the full
+ expression tree needs be represented by
+ ExpressionNodes.
+
+ @returns true, if the note is constant
+ */
+ virtual bool isConstant() const = 0;
+
+ /** Operator to calculate function value.
+
+ This method calculates the function value.
+ */
+ virtual double operator()() const = 0;
+
+ /** Operator to retrieve the type of expression node
+ */
+ virtual ExpressionFunct getType() const = 0;
+
+ /** Operator to retrieve the ms version of expression
+ */
+ virtual com::sun::star::drawing::EnhancedCustomShapeParameter fillNode(
+ std::vector< EnhancedCustomShapeEquation >& rEquations, ExpressionNode* pOptionalArg, sal_uInt32 nFlags ) = 0;
+};
+typedef ::boost::shared_ptr< ExpressionNode > ExpressionNodeSharedPtr;
+
+/** This exception is thrown, when the arithmetic expression
+ parser failed to parse a string.
+ */
+struct ParseError
+{
+ ParseError() {}
+ ParseError( const char* ) {}
+};
+
+class FunctionParser
+{
+public:
+
+ /** Parse a string
+
+ The following grammar is accepted by this method:
+ <code>
+
+ number_digit = '0'|'1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9'
+
+ number = number number_digit | number_digit
+
+ identifier = 'pi'|'left'|'top'|'right'|'bottom'|'xstretch'|'ystretch'|
+ 'hasstroke'|'hasfill'|'width'|'height'|'logwidth'|'logheight'
+
+ unary_function = 'abs'|'sqrt'|'sin'|'cos'|'tan'|'atan'
+ binary_function = 'min'|'max'|'atan2'
+ ternary_function = 'if'
+
+ function_reference = '?' 'a-z,A-Z,0-9' ' '
+ modifier_reference = '$' '0-9' ' '
+
+ basic_expression =
+ number |
+ identifier |
+ function_reference |
+ unary_function '(' additive_expression ')' |
+ binary_function '(' additive_expression ',' additive_expression ')' |
+ ternary_function '(' additive_expression ',' additive_expression ',
+ ' additive_expression ')' | '(' additive_expression ')'
+
+ unary_expression = '-' basic_expression
+
+ multiplicative_expression =
+ basic_expression |
+ multiplicative_expression '*' basic_expression |
+ multiplicative_expression '/' basic_expression
+
+ additive_expression =
+ multiplicative_expression |
+ additive_expression '+' multiplicative_expression |
+ additive_expression '-' multiplicative_expression
+
+ </code>
+
+ @param rFunction
+ The string to parse
+
+ @param rCustoShape
+ The CustomShape is required for calculation of dynamic values such
+ "hasstroke", function references and or modifier references ...
+
+ @throws ParseError if an invalid expression is given.
+
+ @return the generated function object.
+ */
+
+ SVX_DLLPUBLIC static ExpressionNodeSharedPtr parseFunction( const ::rtl::OUString& rFunction, const EnhancedCustomShape2d& rCustoShape );
+
+private:
+ // disabled constructor/destructor, since this is
+ // supposed to be a singleton
+ FunctionParser();
+
+ // default: disabled copy/assignment
+ FunctionParser(const FunctionParser&);
+ FunctionParser& operator=( const FunctionParser& );
+};
+
+}
+
+#endif /* _ENHANCEDCUSTOMSHAPEFUNCTIONPARSER_HXX */
diff --git a/svx/inc/svx/EnhancedCustomShapeGeometry.hxx b/svx/inc/svx/EnhancedCustomShapeGeometry.hxx
new file mode 100644
index 000000000000..2ee9824ce547
--- /dev/null
+++ b/svx/inc/svx/EnhancedCustomShapeGeometry.hxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ENHANCEDCUSTOMSHAPEGEOMETRY_HXX
+#define _ENHANCEDCUSTOMSHAPEGEOMETRY_HXX
+
+#include <sal/types.h>
+#include <svx/msdffdef.hxx>
+
+struct SvxMSDffVertPair
+{
+ sal_Int32 nValA;
+ sal_Int32 nValB;
+};
+struct SvxMSDffCalculationData
+{
+ sal_uInt16 nFlags;
+ sal_Int16 nVal[ 3 ];
+};
+struct SvxMSDffTextRectangles
+{
+ SvxMSDffVertPair nPairA;
+ SvxMSDffVertPair nPairB;
+};
+
+#define MSDFF_HANDLE_FLAGS_MIRRORED_X 0x0001
+#define MSDFF_HANDLE_FLAGS_MIRRORED_Y 0x0002
+#define MSDFF_HANDLE_FLAGS_SWITCHED 0x0004
+#define MSDFF_HANDLE_FLAGS_POLAR 0x0008
+#define MSDFF_HANDLE_FLAGS_MAP 0x0010
+#define MSDFF_HANDLE_FLAGS_RANGE 0x0020
+#define MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL 0x0080
+#define MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL 0x0100
+#define MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL 0x0200
+#define MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL 0x0400
+#define MSDFF_HANDLE_FLAGS_CENTER_X_IS_SPECIAL 0x0800
+#define MSDFF_HANDLE_FLAGS_CENTER_Y_IS_SPECIAL 0x1000
+#define MSDFF_HANDLE_FLAGS_RADIUS_RANGE 0x2000
+
+struct SvxMSDffHandle
+{
+ sal_uInt32 nFlags;
+ sal_Int32 nPositionX, nPositionY, nCenterX, nCenterY, nRangeXMin, nRangeXMax, nRangeYMin, nRangeYMax;
+};
+struct mso_CustomShape
+{
+ SvxMSDffVertPair* pVertices;
+ sal_uInt32 nVertices;
+ sal_uInt16* pElements;
+ sal_uInt32 nElements;
+ SvxMSDffCalculationData* pCalculation;
+ sal_uInt32 nCalculation;
+ sal_Int32* pDefData;
+ SvxMSDffTextRectangles* pTextRect;
+ sal_uInt32 nTextRect;
+ sal_Int32 nCoordWidth;
+ sal_Int32 nCoordHeight;
+ sal_Int32 nXRef;
+ sal_Int32 nYRef;
+ SvxMSDffVertPair* pGluePoints;
+ sal_uInt32 nGluePoints;
+ SvxMSDffHandle* pHandles;
+ sal_uInt32 nHandles;
+};
+
+#define MSO_I | (sal_Int32)0x80000000
+
+sal_Bool SortFilledObjectsToBackByDefault( MSO_SPT eSpType );
+SVX_DLLPUBLIC sal_Bool IsCustomShapeFilledByDefault( MSO_SPT eSpType );
+SVX_DLLPUBLIC sal_Int16 GetCustomShapeConnectionTypeDefault( MSO_SPT eSpType );
+
+// #i28269#
+SVX_DLLPUBLIC sal_Bool IsCustomShapeStrokedByDefault( MSO_SPT eSpType );
+
+SVX_DLLPUBLIC const mso_CustomShape* GetCustomShapeContent( MSO_SPT eSpType );
+
+#endif
diff --git a/svx/inc/svx/EnhancedCustomShapeTypeNames.hxx b/svx/inc/svx/EnhancedCustomShapeTypeNames.hxx
new file mode 100644
index 000000000000..054af2e3af41
--- /dev/null
+++ b/svx/inc/svx/EnhancedCustomShapeTypeNames.hxx
@@ -0,0 +1,39 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ENHANCED_CUSTOMSHAPE_TYPE_NAMES_HXX
+#define _ENHANCED_CUSTOMSHAPE_TYPE_NAMES_HXX
+#include <svx/msdffdef.hxx>
+#include <rtl/ustring.hxx>
+
+namespace EnhancedCustomShapeTypeNames
+{
+ SVX_DLLPUBLIC MSO_SPT Get( const rtl::OUString& );
+ SVX_DLLPUBLIC rtl::OUString Get( const MSO_SPT );
+}
+
+#endif
diff --git a/svx/inc/svx/IAccessibleParent.hxx b/svx/inc/svx/IAccessibleParent.hxx
new file mode 100644
index 000000000000..be97a49e982b
--- /dev/null
+++ b/svx/inc/svx/IAccessibleParent.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_ACCESSIBILITY_IACCESSIBLE_PARENT_HXX
+#define _SVX_ACCESSIBILITY_IACCESSIBLE_PARENT_HXX
+
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <sal/types.h>
+
+namespace accessibility {
+
+class AccessibleShape;
+class AccessibleShapeTreeInfo;
+
+/** This interface contains methods missing from the
+ <type>XAccessibleContext</type> interface that allow the modification of
+ parent/child relationship.
+*/
+class IAccessibleParent
+{
+public:
+ /** Allow for a virtual destructor.
+ */
+ virtual ~IAccessibleParent (void){};
+
+ /** A call to this method requests the implementor to replace one child
+ with another and send the appropriate notifications. That are two
+ child events: One notifying the removal of the current child and one
+ about the existence of the new child. The index of the new child is
+ implementation dependent, i.e. it is not garanteed that the
+ replacement has the same index as the current child has.
+
+ <p>A default implementation can just use the ShapeTypeHandler::CreateAccessibleObject
+ to let a factory create the new instance with the parameters given, and then
+ place the new shape into the own structures.</p>
+
+ @param pCurrentChild
+ This child is about to be replaced.
+
+ @param _rxShape
+ The UNO shape which the old and new child represent
+
+ @param _nIndex
+ The IndexInParent of the old child. Note that the index in
+ parent of the replacement is not necessarily the same as
+ that of the current child.
+
+ @param _rShapeTreeInfo
+ The TreeInfo for the old child.
+
+ @return
+ If the replacement has taken place successfully <TRUE/> is
+ returned. If the replacement can not be carried out or an error
+ occurs that does not result in an exception then <FALSE/> is
+ returned.
+
+ @raises RuntimeException
+ in case something went heavily wrong
+ */
+ virtual sal_Bool ReplaceChild (
+ AccessibleShape* pCurrentChild,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& _rxShape,
+ const long _nIndex,
+ const AccessibleShapeTreeInfo& _rShapeTreeInfo
+ ) throw (::com::sun::star::uno::RuntimeException) = 0;
+};
+
+} // end of namespace accessibility
+
+#endif
diff --git a/svx/inc/svx/IAccessibleViewForwarder.hxx b/svx/inc/svx/IAccessibleViewForwarder.hxx
new file mode 100644
index 000000000000..e9d099edf4a9
--- /dev/null
+++ b/svx/inc/svx/IAccessibleViewForwarder.hxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_ACCESSIBILITY_IACCESSIBLE_VIEW_FORWARDER_HXX
+#define _SVX_ACCESSIBILITY_IACCESSIBLE_VIEW_FORWARDER_HXX
+
+#include <sal/types.h>
+#include <tools/gen.hxx>
+
+
+namespace accessibility {
+
+
+
+/** <p>This interface provides the means to transform between internal
+ coordinates in 100th of mm and screen coordinates without giving direct
+ access to the underlying view. Each view forwarder represents a
+ specific real or virtual window. A call to
+ <method>GetVisibleArea</method> returns the visible rectangle that
+ corresponds to this window.</p>
+
+ <p>This interface is similar to the <type>SvxViewForwarder</type> but
+ differs in two important points: Firstly the <member>GetVisArea</member>
+ method returns a rectangle in internal coordinates and secondly the
+ transformation methods do not require explicit mapmodes. These have to
+ be provided implicitely by the classes that implement this
+ interface. A third, less important, difference are the additional
+ transfomation methods for sizes. The reasons for their existince are
+ convenience and improved performance.</p>
+
+ @attention
+ Note, that modifications of the underlying view that lead to
+ different transformations between internal and screen coordinates or
+ change the validity of the forwarder have to be signaled seperately.
+*/
+class IAccessibleViewForwarder
+{
+public:
+ virtual ~IAccessibleViewForwarder (void){};
+
+ /** This method informs you about the state of the forwarder. Do not
+ use it when the returned value is <false/>.
+
+ @return
+ Return <true/> if the view forwarder is valid and <false/> else.
+ */
+ virtual sal_Bool IsValid (void) const = 0;
+
+ /** Returns the area of the underlying document that is visible in the
+ * corresponding window.
+
+ @return
+ The rectangle of the visible part of the document. The values
+ are, contrary to the base class, in internal coordinates of
+ 100th of mm.
+ */
+ virtual Rectangle GetVisibleArea() const = 0;
+
+ /** Transform the specified point from internal coordinates in 100th of
+ mm to an absolute screen position.
+
+ @param rPoint
+ Point in internal coordinates (100th of mm).
+
+ @return
+ The same point but in screen coordinates relative to the upper
+ left corner of the (current) screen.
+ */
+ virtual Point LogicToPixel (const Point& rPoint) const = 0;
+
+ /** Transform the specified size from internal coordinates in 100th of
+ mm to a screen oriented pixel size.
+
+ @param rSize
+ Size in internal coordinates (100th of mm).
+
+ @return
+ The same size but in screen coordinates.
+ */
+ virtual Size LogicToPixel (const Size& rSize) const = 0;
+
+ /** Transform the specified point from absolute screen coordinates to
+ internal coordinates (100th of mm).
+
+ @param rPoint
+ Point in screen coordinates relative to the upper left corner of
+ the (current) screen.
+
+ @return
+ The same point but in internal coordinates (100th of mm).
+ */
+ virtual Point PixelToLogic (const Point& rPoint) const = 0;
+
+ /** Transform the specified size from screen coordinates to internal
+ coordinates (100th of mm).
+
+ @param rSize
+ Size in screen coordinates.
+
+ @return
+ The same size but in internal coordinates (100th of mm).
+ */
+ virtual Size PixelToLogic (const Size& rSize) const = 0;
+};
+
+} // end of namespace accessibility
+
+#endif
diff --git a/svx/inc/svx/IAccessibleViewForwarderListener.hxx b/svx/inc/svx/IAccessibleViewForwarderListener.hxx
new file mode 100644
index 000000000000..6c876a64bc70
--- /dev/null
+++ b/svx/inc/svx/IAccessibleViewForwarderListener.hxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_ACCESSIBILITY_IACCESSIBLE_VIEW_FORWARDER_LISTENER_HXX
+#define _SVX_ACCESSIBILITY_IACCESSIBLE_VIEW_FORWARDER_LISTENER_HXX
+
+#include <sal/types.h>
+#include <tools/gen.hxx>
+
+
+namespace accessibility {
+
+class IAccessibleViewForwarder;
+
+/** <p>The purpose of this interface is to notify a user of an
+ IAccessibleViewForwarder when that view forwarder changes its
+ properties. Such a change may be one of the following:
+ <ul>
+ <li>Change of the coordinate transformation.</li>
+ <li>Change of the visible area (which in turn results in a change of the
+ coordinate transformation.</li>
+ <li>Change of the validity state of the view forwarder.</li>
+*/
+class IAccessibleViewForwarderListener
+{
+public:
+ /** Enumeration of the different change types.
+ */
+ enum ChangeType {TRANSFORMATION, VISIBLE_AREA, STATE};
+
+ /** This method is called to indicate a change of the specified view
+ forwarder.
+ @param aChangeType
+ The type of the change. TRANSFORMATION indicates a change of
+ the coordinate transformation with a constant visible area. If
+ the visible area changes, just use VISIBLE_AREA. This changes
+ the transformation implicitly. The value STATE indicates a
+ change of the validity state. Check the IsValid method of the
+ view forwarder before doing further calls.
+ @param pViewForwarder
+ The modified view forwarder. It is specified just in case that
+ there is more than one view forwarder in use at the same time.
+ */
+ virtual void ViewForwarderChanged (ChangeType aChangeType,
+ const IAccessibleViewForwarder* pViewForwarder) = 0;
+};
+
+} // end of namespace accessibility
+
+#endif
diff --git a/svx/inc/svx/ParseContext.hxx b/svx/inc/svx/ParseContext.hxx
new file mode 100644
index 000000000000..6b0ec247a39e
--- /dev/null
+++ b/svx/inc/svx/ParseContext.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SVX_QUERYDESIGNCONTEXT_HXX
+#define SVX_QUERYDESIGNCONTEXT_HXX
+
+#include "svx/svxdllapi.h"
+#include <connectivity/IParseContext.hxx>
+#include <tools/string.hxx>
+#include <unotools/localedatawrapper.hxx>
+
+
+#include <vector>
+
+namespace svxform
+{
+ //==========================================================================
+ //= OSystemParseContext
+ //==========================================================================
+ class SVX_DLLPUBLIC OSystemParseContext : public ::connectivity::IParseContext
+ {
+ private:
+
+ ::std::vector< String > m_aLocalizedKeywords;
+
+ public:
+ OSystemParseContext();
+
+ virtual ~OSystemParseContext();
+ // retrieves language specific error messages
+ virtual ::rtl::OUString getErrorMessage(ErrorCode _eCodes) const;
+
+ // retrieves language specific keyword strings (only ASCII allowed)
+ virtual ::rtl::OString getIntlKeywordAscii(InternationalKeyCode _eKey) const;
+
+ // finds out, if we have an international keyword (only ASCII allowed)
+ virtual InternationalKeyCode getIntlKeyCode(const ::rtl::OString& rToken) const;
+
+ /** get's a locale instance which should be used when parsing in the context specified by this instance
+ <p>if this is not overridden by derived classes, it returns the static default locale.</p>
+ */
+ virtual ::com::sun::star::lang::Locale getPreferredLocale( ) const;
+
+ public:
+ // helper methods to ease access to some of the characteristics of the locale
+ sal_Unicode getNumDecimalSep( ) const;
+ sal_Unicode getNumThousandSep( ) const;
+ };
+
+ //==========================================================================
+ //= OParseContextClient
+ //==========================================================================
+ /** helper class which needs access to a (shared and ref-counted) OSystemParseContext
+ instance.
+ */
+ class SVX_DLLPUBLIC OParseContextClient
+ {
+ protected:
+ OParseContextClient();
+ virtual ~OParseContextClient();
+
+ const OSystemParseContext* getParseContext() const;
+ };
+}
+#endif // SVX_QUERYDESIGNCONTEXT_HXX
+
+
+
diff --git a/svx/inc/svx/ShapeTypeHandler.hxx b/svx/inc/svx/ShapeTypeHandler.hxx
new file mode 100755
index 000000000000..1b8a7b6947c6
--- /dev/null
+++ b/svx/inc/svx/ShapeTypeHandler.hxx
@@ -0,0 +1,237 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_ACCESSIBILITY_SHAPE_TYPE_HANDLER_HXX
+#define _SVX_ACCESSIBILITY_SHAPE_TYPE_HANDLER_HXX
+
+#include <svx/AccessibleShapeTreeInfo.hxx>
+#include <svx/AccessibleShapeInfo.hxx>
+#include <svx/AccessibleShape.hxx>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <comphelper/stl_types.hxx>
+#include <com/sun/star/document/XEventBroadcaster.hpp>
+#include "svx/svxdllapi.h"
+
+#include <rtl/ustring.hxx>
+#include <vector>
+#include <hash_map>
+
+namespace accessibility {
+
+/** Use an integer to represent shape type ids. A ShapeTypeId is unique
+ inside one project but is not over the project boundaries.
+*/
+typedef int ShapeTypeId;
+
+/** Define the function type for creating accessible objects for given
+ service names.
+*/
+typedef AccessibleShape* (*tCreateFunction)
+ (const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo,
+ ShapeTypeId nId);
+
+/** Each shape type is described by listing its id, its service name and a
+ function which creates a new accessible object that can represent that
+ service. The id has to be unique with respect to the create function.
+*/
+struct ShapeTypeDescriptor
+{
+ ShapeTypeId mnShapeTypeId;
+ rtl::OUString msServiceName;
+ tCreateFunction maCreateFunction;
+ ShapeTypeDescriptor (
+ ShapeTypeId nId, const rtl::OUString& sName, tCreateFunction aFunction)
+ : mnShapeTypeId (nId),
+ msServiceName (sName),
+ maCreateFunction (aFunction)
+ {}
+ ShapeTypeDescriptor (void)
+ : mnShapeTypeId (-1),
+ msServiceName (),
+ maCreateFunction (NULL)
+ {}
+};
+
+/** @descr
+ This class is a singleton that has the purpose to transform between
+ service names of shapes and associated enum values and to create new
+ accessible objects for given shapes.
+*/
+class SVX_DLLPUBLIC ShapeTypeHandler
+{
+public:
+ enum { UNKNOWN_SHAPE_TYPE = 0 };
+
+ /** This function returns a reference to the only instance of this class.
+ Use this instance to retrieve a shape's type and service name.
+ @return
+ Returns a reference to a <type>ShapeTypeHandler</type> object.
+ */
+ static ShapeTypeHandler& Instance (void);
+
+ /** Determines the type id of a shape with the given service name.
+ @param aServiceName
+ Service name of the shape for which to return the type id.
+ @return
+ Returns the type id of the shape with the given service name or
+ -1 when the service name is not known.
+ */
+ ShapeTypeId GetTypeId (const ::rtl::OUString& aServiceName) const;
+
+ /** Determines the type id of the specified shape.
+ @param xShape
+ Reference to the shape for which to return the type id.
+ @return
+ Returns the type id of the specified shape or
+ -1 when the given reference is either not
+ set or the referenced object does not support the
+ <type>XShapeDescriptor</type> interface.
+ */
+ ShapeTypeId GetTypeId (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape>& rxShape) const;
+
+ /** Return the service name of a shape with the specified type.
+ @param aTypeId
+ Id of the shape type for which to retrieve the service name.
+ An unknown shape id results in an empty string.
+ @return
+ The returned string contains the service name, with which a
+ shape of the given type can be created.
+ */
+ const ::rtl::OUString& GetServiceName (ShapeTypeId aTypeId) const;
+
+ /** Create a new accessible object for the given shape.
+ @param rShapeInfo
+ Bundle of information passed to the new accessible shape.
+ @param rShapeTreeInfo
+ Bundle of information passed down the shape tree.
+ @return
+ Pointer to the implementation object that implements the
+ <code>XAccessible</code> interface. This pointer may be NULL
+ if the specified shape is of unknown type.
+ */
+ AccessibleShape*
+ CreateAccessibleObject (
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo) const;
+
+ /** Compatibility function.
+ */
+ AccessibleShape*
+ CreateAccessibleObject (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape>& rxShape,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo) const
+ {
+ AccessibleShapeInfo aShapeInfo(rxShape, rxParent);
+ return CreateAccessibleObject (aShapeInfo, rShapeTreeInfo);
+ }
+
+ /** Add new shape types to the internal tables. Each new shape type is
+ described by one shape type descriptor. See
+ <type>ShapeTypeDescriptor</type> for more details.
+
+ @param nDescriptorCount
+ Number of new shape types.
+ @param aDescriptorList
+ Array of new shape type descriptors.
+ @return
+ The returned flag indicates whether the specified shape
+ descriptors have been successfully added.
+ */
+ bool AddShapeTypeList (int nDescriptorCount,
+ ShapeTypeDescriptor aDescriptorList[]);
+
+ /// get the accessible base name for an object
+ static ::rtl::OUString CreateAccessibleBaseName (
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape)
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ // Declare default constructor, copy constructor, destructor, and
+ // assignment operation protected so that no one accidentally creates a
+ // second instance of this singleton class or deletes it.
+ ShapeTypeHandler (void);
+ ShapeTypeHandler (const ShapeTypeHandler& aHandler); // never implemented, this is a singleton class
+ ShapeTypeHandler& operator= (const ShapeTypeHandler& aHandler); // never implemented, this is a singleton class
+
+ /** This destructor is never called at the moment. But because this
+ class is a singleton this is not a problem.
+ */
+ virtual ~ShapeTypeHandler (void);
+
+private:
+ /// Pointer to the only instance of this class.
+ static ShapeTypeHandler* instance;
+
+ /** List of shape type descriptors. This list is normally build up in
+ several steps when libraries that implement shapes are loaded and
+ call the addShapeTypeList method. After that no modifications of
+ the list take place.
+ */
+ ::std::vector<ShapeTypeDescriptor> maShapeTypeDescriptorList;
+
+ /** This hash map allows the fast look up of a type descriptor for a
+ given service name.
+ */
+ typedef ::std::hash_map<
+ ::rtl::OUString,ShapeTypeId,
+ ::rtl::OUStringHash,
+ // ::comphelper::UStringHash,
+ ::comphelper::UStringEqual> tServiceNameToSlotId;
+ mutable tServiceNameToSlotId maServiceNameToSlotId;
+
+ /** Determine the slot id of the specified shape type. With this id
+ internal methods can access the associated type descriptor.
+ @param aServiceName
+ Service name of the shape for which to return the slot id.
+ @return
+ Returns the slot id of the shape with the given service name or
+ 0 when the service name is not known.
+ */
+ SVX_DLLPRIVATE long GetSlotId (const ::rtl::OUString& aServiceName) const;
+
+ /** Determine the slot id of the specified shape type. With this id
+ internal methods can access the associated type descriptor.
+ @param rxShape
+ Shape for which to return the slot id.
+ @return
+ Returns the slot id of the shape with the given service name or
+ 0 when the service name is not known.
+ */
+ SVX_DLLPRIVATE long GetSlotId (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape>& rxShape) const;
+};
+
+} // end of namespace accessible
+
+#endif
diff --git a/svx/inc/svx/SmartTagCtl.hxx b/svx/inc/svx/SmartTagCtl.hxx
new file mode 100644
index 000000000000..87c6d69ebaaf
--- /dev/null
+++ b/svx/inc/svx/SmartTagCtl.hxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_SMARTTAGSCONTROL_HXX
+#define _SVX_SMARTTAGSCONTROL_HXX
+
+// include ---------------------------------------------------------------
+
+#include <tools/link.hxx>
+#include <sfx2/mnuitem.hxx>
+#include "svx/svxdllapi.h"
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <vector>
+
+class SfxBindings;
+class SvxSmartTagItem;
+class PopupMenu;
+
+namespace com { namespace sun { namespace star { namespace smarttags {
+ class XSmartTagAction;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace container {
+ class XStringKeyMap;
+} } } }
+
+// class SvxFontMenuControl ----------------------------------------------
+
+class SVX_DLLPUBLIC SvxSmartTagsControl : public SfxMenuControl
+{
+private:
+ PopupMenu* mpMenu;
+ Menu& mrParent;
+ const SvxSmartTagItem* mpSmartTagItem;
+
+ struct InvokeAction
+ {
+ com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > mxAction;
+ com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > mxSmartTagProperties;
+ sal_uInt32 mnActionID;
+ InvokeAction( com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > xAction,
+ com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > xSmartTagProperties,
+ sal_uInt32 nActionID ) : mxAction( xAction ), mxSmartTagProperties( xSmartTagProperties ), mnActionID( nActionID ) {}
+ };
+
+ std::vector< InvokeAction > maInvokeActions;
+
+ void FillMenu();
+ DECL_LINK( MenuSelect, PopupMenu * );
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+
+public:
+ SvxSmartTagsControl( sal_uInt16 nId, Menu&, SfxBindings& );
+ ~SvxSmartTagsControl();
+
+ virtual PopupMenu* GetPopup() const;
+ SFX_DECL_MENU_CONTROL();
+};
+
+#endif
diff --git a/svx/inc/svx/SmartTagItem.hxx b/svx/inc/svx/SmartTagItem.hxx
new file mode 100644
index 000000000000..666160b3a745
--- /dev/null
+++ b/svx/inc/svx/SmartTagItem.hxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_SMARTTAGITEM_HXX
+#define _SVX_SMARTTAGITEM_HXX
+
+// include ---------------------------------------------------------------
+
+#include <svl/poolitem.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/smarttags/XSmartTagAction.hpp>
+#include "svx/svxdllapi.h"
+
+namespace com { namespace sun { namespace star { namespace container {
+ class XStringKeyMap;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace text {
+ class XTextRange;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace frame {
+ class XController;
+} } } }
+
+// class SvxSmartTagItem -----------------------------------------------------
+
+class SVX_DLLPUBLIC SvxSmartTagItem : public SfxPoolItem
+{
+ const com::sun::star::uno::Sequence < com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > > > maActionComponentsSequence;
+ const com::sun::star::uno::Sequence < com::sun::star::uno::Sequence< sal_Int32 > > maActionIndicesSequence;
+ const com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > > maStringKeyMaps;
+ const com::sun::star::uno::Reference<com::sun::star::text::XTextRange> mxRange;
+ const com::sun::star::uno::Reference<com::sun::star::frame::XController> mxController;
+ const com::sun::star::lang::Locale maLocale;
+ const rtl::OUString maApplicationName;
+ const rtl::OUString maRangeText;
+
+public:
+ TYPEINFO();
+
+ SvxSmartTagItem( const sal_uInt16 nId,
+ const com::sun::star::uno::Sequence < com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > > >& rActionComponentsSequence,
+ const com::sun::star::uno::Sequence < com::sun::star::uno::Sequence< sal_Int32 > >& rActionIndicesSequence,
+ const com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > >& rStringKeyMaps,
+ const com::sun::star::uno::Reference<com::sun::star::text::XTextRange> rRange,
+ const com::sun::star::uno::Reference<com::sun::star::frame::XController> rController,
+ const com::sun::star::lang::Locale rLocale,
+ const rtl::OUString& rApplicationName,
+ const rtl::OUString& rRangeText );
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; // leer
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const; // leer
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; // leer
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); // leer
+
+ const com::sun::star::uno::Sequence < com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > > >& GetActionComponentsSequence() const { return maActionComponentsSequence; }
+ const com::sun::star::uno::Sequence < com::sun::star::uno::Sequence< sal_Int32 > >& GetActionIndicesSequence() const { return maActionIndicesSequence; }
+ const com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > >& GetStringKeyMaps() const { return maStringKeyMaps; }
+ const com::sun::star::uno::Reference<com::sun::star::text::XTextRange>& GetTextRange() const { return mxRange; }
+ const com::sun::star::uno::Reference<com::sun::star::frame::XController>& GetController() const { return mxController; }
+ const com::sun::star::lang::Locale& GetLocale() const { return maLocale; }
+ const rtl::OUString GetApplicationName() const { return maApplicationName; }
+ const rtl::OUString GetRangeText() const { return maRangeText; }
+};
+
+#endif // #ifndef _SVX_SMARTTAGITEM_HXX
+
+
diff --git a/svx/inc/svx/SmartTagMgr.hxx b/svx/inc/svx/SmartTagMgr.hxx
new file mode 100644
index 000000000000..3dc7233bbc4e
--- /dev/null
+++ b/svx/inc/svx/SmartTagMgr.hxx
@@ -0,0 +1,234 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SMARTTAGMGR_HXX
+#define _SMARTTAGMGR_HXX
+
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/util/XChangesListener.hpp>
+#include "svx/svxdllapi.h"
+
+#include <vector>
+#include <map>
+#include <set>
+
+namespace com { namespace sun { namespace star { namespace uno {
+ class XComponentContext;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace smarttags {
+ class XSmartTagRecognizer;
+ class XSmartTagAction;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace text {
+ class XTextMarkup;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace i18n {
+ class XBreakIterator;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace lang {
+ struct Locale;
+ struct EventObject;
+ struct ChangesEvent;
+ class XMultiServiceFactory;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace beans {
+ class XPropertySet;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace frame {
+ class XController;
+} } } }
+
+/** A reference to a smart tag action
+
+ An action service can support various actions. Therefore an ActionReference
+ consists of a reference to the service and and index.
+ */
+struct ActionReference
+{
+ com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > mxSmartTagAction;
+ sal_Int32 mnSmartTagIndex;
+ ActionReference( com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > xSmartTagAction, sal_Int32 nSmartTagIndex )
+ : mxSmartTagAction( xSmartTagAction), mnSmartTagIndex( nSmartTagIndex ) {}
+};
+
+/** The smart tag manager maintains all installed action and recognizer services
+
+ This class organizes the available smarttag libraries and provides access functions
+ to these libraries. The smart tag manager is a singleton.
+*/
+class SVX_DLLPUBLIC SmartTagMgr : public cppu::WeakImplHelper2< ::com::sun::star::util::XModifyListener,
+ ::com::sun::star::util::XChangesListener >
+{
+private:
+
+ const rtl::OUString maApplicationName;
+ std::vector< com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagRecognizer > > maRecognizerList;
+ std::vector< com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > > maActionList;
+ std::set< rtl::OUString > maDisabledSmartTagTypes;
+ std::multimap < rtl::OUString, ActionReference > maSmartTagMap;
+ mutable com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > mxBreakIter;
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF;
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext> mxContext;
+ com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > mxConfigurationSettings;
+ bool mbLabelTextWithSmartTags;
+
+ /** Checks for installed smart tag recognizers/actions and stores them in
+ maRecognizerList and maActionList.
+ */
+ void LoadLibraries();
+
+ /** Prepare configuration access.
+ */
+ void PrepareConfiguration( const rtl::OUString& rConfigurationGroupName );
+
+ /** Reads the configuration data.
+ */
+ void ReadConfiguration( bool bExcludedTypes, bool bRecognize );
+
+ /** Registeres the smart tag manager as listener at the package manager.
+ */
+ void RegisterListener();
+
+ /** Sets up a map that maps smart tag type names to actions references.
+ */
+ void AssociateActionsWithRecognizers();
+
+ void CreateBreakIterator() const;
+
+public:
+
+ SmartTagMgr( const rtl::OUString& rApplicationName );
+ virtual ~SmartTagMgr();
+
+ /** Triggeres configuration reading, library loading and listener registration
+ NOTE: MUST BE CALLED AFTER CONSTRUCTION!
+ */
+ void Init( const rtl::OUString& rConfigurationGroupName );
+
+ /** Dispatches the recognize call to all installed smart tag recognizers
+
+ @param rText
+ The string to be scanned by the recognizers.
+
+ @param xMarkup
+ The object allows the recognizers to store any found smart tags.
+
+ @param xController
+ The current controller of the document.
+
+ @param rLocale
+ The locale of rText.
+
+ @param nStart
+ The start offset of the text to be scanned in rText.
+
+ @param nLen
+ The length of the text to be scanned.
+
+ */
+ void Recognize( const rtl::OUString& rText,
+ const com::sun::star::uno::Reference< com::sun::star::text::XTextMarkup > xMarkup,
+ const com::sun::star::uno::Reference< com::sun::star::frame::XController > xController,
+ const com::sun::star::lang::Locale& rLocale,
+ sal_uInt32 nStart, sal_uInt32 nLen ) const;
+
+ /** Returns all action references associated with a given list of smart tag types
+
+ @param rSmartTagTypes
+ The list of types
+
+ @param rActionComponentsSequence
+ Output parameter
+
+ @param rActionIndicesSequence
+ Output parameter
+ */
+ void GetActionSequences( com::sun::star::uno::Sequence < rtl::OUString >& rSmartTagTypes,
+ com::sun::star::uno::Sequence < com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > > >& rActionComponentsSequence,
+ com::sun::star::uno::Sequence < com::sun::star::uno::Sequence< sal_Int32 > >& rActionIndicesSequence ) const;
+
+ /** Returns the caption for a smart tag type.
+
+ @param rSmartTagType
+ The given smart tag type.
+
+ @param rLocale
+ The locale.
+ */
+ rtl::OUString GetSmartTagCaption( const rtl::OUString& rSmartTagType, const com::sun::star::lang::Locale& rLocale ) const;
+
+ /** Returns true if the given smart tag type is enabled.
+ */
+ bool IsSmartTagTypeEnabled( const rtl::OUString& rSmartTagType ) const;
+
+ /** Enable or disable smart tags.
+ */
+ bool IsLabelTextWithSmartTags() const { return mbLabelTextWithSmartTags; }
+
+ /** Returns the number of registered recognizers.
+ */
+ sal_uInt32 NumberOfRecognizers() const { return maRecognizerList.size(); }
+
+ /** Returns a recognizer.
+ */
+ com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagRecognizer >
+ GetRecognizer( sal_uInt32 i ) const { return maRecognizerList[i]; }
+
+ /** Is smart tag recognization active?
+ */
+ bool IsSmartTagsEnabled() const { return 0 != NumberOfRecognizers() &&
+ IsLabelTextWithSmartTags(); }
+
+ /** Writes configuration settings.
+ */
+ void WriteConfiguration( const bool* bLabelTextWithSmartTags,
+ const std::vector< rtl::OUString >* pDisabledTypes ) const;
+
+ /** Returns the name of the application this instance has been created by.
+ */
+ const rtl::OUString GetApplicationName() const { return maApplicationName; }
+
+ // ::com::sun::star::lang::XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::util::XModifyListener
+ virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::util::XChangesListener
+ virtual void SAL_CALL changesOccurred( const ::com::sun::star::util::ChangesEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+#endif
diff --git a/svx/inc/svx/SpellDialogChildWindow.hxx b/svx/inc/svx/SpellDialogChildWindow.hxx
new file mode 100644
index 000000000000..016def2576dc
--- /dev/null
+++ b/svx/inc/svx/SpellDialogChildWindow.hxx
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_SPELL_DIALOG_CHILD_WINDOW_HXX
+#define SVX_SPELL_DIALOG_CHILD_WINDOW_HXX
+
+#include <sfx2/childwin.hxx>
+#include <editeng/SpellPortions.hxx>
+#include "svx/svxdllapi.h"
+#include <vcl/image.hxx>
+
+class AbstractSpellDialog;
+
+namespace svx {
+
+/** The child window wrapper of the actual spellin dialog. To use the
+ spelling dialog in an application you have to do the ususal things:
+ <ol>
+ <li>Call this class' RegisterChildWindow() method with the module
+ as second argument that you want the dialog included in.</li>
+ <li>In the SFX_IMPL_INTERFACE implementation of the view shell
+ that wants to use the dialog call SFX_CHILDWINDOW_REGISTRATION()
+ with the id returned by this class' GetChildWindowId()
+ method.</li>
+ <li>Include the item associated with this child window to the SDI
+ description of the view shell.</li>
+ </ol>
+*/
+class SVX_DLLPUBLIC SpellDialogChildWindow
+ : public SfxChildWindow
+{
+ friend class SpellDialog;
+ AbstractSpellDialog* m_pAbstractSpellDialog;
+public:
+ SpellDialogChildWindow (
+ Window*pParent,
+ sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo);
+ virtual ~SpellDialogChildWindow ();
+
+protected:
+ /** This abstract method has to be defined by a derived class. It
+ returns the next wrong sentence.
+ @return
+ returns an empty vector if no error could be found
+ */
+ virtual SpellPortions GetNextWrongSentence (bool bRecheck) = 0;
+
+ /** This abstract method applies the changes made in the spelling dialog
+ to the document.
+ The dialog always updates its settings when it gets the focus. The document
+ can rely on the fact that the methods ApplyChangedSentence() is called for the
+ position that the last GetNextWrongSentence() returned.
+ If 'bRecheck' is set to true then the same sentence should be rechecked once from
+ the start. This should be used too find errors that the user has introduced by
+ manual changes in the edit field, and in order to not miss the still following errors
+ in that sentence.
+ */
+ virtual void ApplyChangedSentence(const SpellPortions& rChanged, bool bRecheck ) = 0;
+ /** This methods determines whether the application supports AutoCorrection
+ */
+ virtual bool HasAutoCorrection();
+ /** This method adds a word pair to the AutoCorrection - if available
+ */
+ virtual void AddAutoCorrection(const String& rOld, const String& rNew, LanguageType eLanguage);
+ /** Return the sfx bindings for this child window. They are
+ retrieved from the dialog so they do not have to be stored in
+ this class as well. The bindings may be necessary to be used
+ by the abstract methods.
+ */
+ /** This method determines if grammar checking is supported
+ */
+ virtual bool HasGrammarChecking();
+ /** determines if grammar checking is switched on
+ */
+ virtual bool IsGrammarChecking();
+ /** switches grammar checking on/off
+ */
+ virtual void SetGrammarChecking(bool bOn);
+
+ SfxBindings& GetBindings (void) const;
+ /** Set the spell dialog into the 'resume' state. This method should be called
+ to notify the SpellDialog about changes in the document that invalidate the
+ current state which results in disabling most of the dialog controls and presenting
+ a "Resume" button that initiates a reinitialization.
+ */
+ void InvalidateSpellDialog();
+ /** Notifies the ChildWindow about the get focus event. The ChildWindow should no check if
+ the spelling dialog should be set to the 'Resume' state by calling InvalidateSpellDialog()
+ */
+ virtual void GetFocus() = 0;
+ /** Notifies the ChildWindow about the lose focus event. The ChildWindow should use it to save
+ the current selection/state.
+ */
+ virtual void LoseFocus() = 0;
+};
+
+} // end of namespace ::svx
+
+#endif
diff --git a/svx/inc/svx/SvxShapeTypes.hxx b/svx/inc/svx/SvxShapeTypes.hxx
new file mode 100644
index 000000000000..b4c76f19354b
--- /dev/null
+++ b/svx/inc/svx/SvxShapeTypes.hxx
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_ACCESSIBILITY_SVX_SHAPE_TYPES_HXX
+#define _SVX_ACCESSIBILITY_SVX_SHAPE_TYPES_HXX
+
+#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_SHAPE_HXX
+#include <svx/ShapeTypeHandler.hxx>
+#endif
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+namespace accessibility {
+
+/** Register the SVX draw shape types with the ShapeTypeHandler singleton.
+ This method is usually called from the shape type handler constructor.
+*/
+void RegisterDrawShapeTypes (void);
+
+/** Enum describing all shape types known in the SVX project.
+*/
+enum SvxShapeTypes
+{
+ DRAWING_RECTANGLE = 1,
+ DRAWING_ELLIPSE,
+ DRAWING_CONTROL,
+ DRAWING_CONNECTOR,
+ DRAWING_MEASURE,
+ DRAWING_LINE,
+ DRAWING_POLY_POLYGON,
+ DRAWING_POLY_LINE,
+ DRAWING_OPEN_BEZIER,
+ DRAWING_CLOSED_BEZIER,
+ DRAWING_OPEN_FREEHAND,
+ DRAWING_CLOSED_FREEHAND,
+ DRAWING_POLY_POLYGON_PATH,
+ DRAWING_POLY_LINE_PATH,
+ DRAWING_GRAPHIC_OBJECT,
+ DRAWING_GROUP,
+ DRAWING_TEXT,
+ DRAWING_OLE,
+ DRAWING_PAGE,
+ DRAWING_CAPTION,
+ DRAWING_FRAME,
+ DRAWING_PLUGIN,
+ DRAWING_APPLET,
+ DRAWING_3D_SCENE,
+ DRAWING_3D_CUBE,
+ DRAWING_3D_SPHERE,
+ DRAWING_3D_LATHE,
+ DRAWING_3D_EXTRUDE,
+ DRAWING_CUSTOM,
+ DRAWING_TABLE, /* = 30 */
+ DRAWING_MEDIA, /* = 31 */
+ DRAWING_END = DRAWING_MEDIA
+};
+
+/** List of shape type descriptors corresponding to the
+ <type>SvxShapeTypes</type> enum.
+*/
+extern ShapeTypeDescriptor aSvxShapeTypeList[];
+
+} // end of namespace accessibility
+
+#endif
diff --git a/svx/inc/svx/UnoNamespaceMap.hxx b/svx/inc/svx/UnoNamespaceMap.hxx
new file mode 100644
index 000000000000..7e3a1be005b8
--- /dev/null
+++ b/svx/inc/svx/UnoNamespaceMap.hxx
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_UNONAMESPACEMAP_HXX_
+#define _SVX_UNONAMESPACEMAP_HXX_
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include "svx/svxdllapi.h"
+
+class SfxItemPool;
+
+namespace svx {
+
+SVX_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL NamespaceMap_createInstance( sal_uInt16* pWhichIds, SfxItemPool* pPool );
+
+/** deprecated */
+SVX_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL NamespaceMap_createInstance( sal_uInt16* pWhichIds, SfxItemPool* pPool1, SfxItemPool* pPool2 );
+
+}
+
+#endif // _SVX_UNONAMESPACEMAP_HXX_
diff --git a/svx/inc/svx/XPropertyTable.hxx b/svx/inc/svx/XPropertyTable.hxx
new file mode 100644
index 000000000000..59ca1e1e086a
--- /dev/null
+++ b/svx/inc/svx/XPropertyTable.hxx
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XPROPERTYTABLE_HXX
+#define _SVX_XPROPERTYTABLE_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include "svx/svxdllapi.h"
+#include <svx/xtable.hxx>
+
+SVX_DLLPUBLIC ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXColorTable_createInstance( XPropertyTable* pTable ) throw();
+SVX_DLLPUBLIC ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXLineEndTable_createInstance( XPropertyList* pList ) throw();
+SVX_DLLPUBLIC ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXDashTable_createInstance( XPropertyList* pList ) throw();
+SVX_DLLPUBLIC ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXHatchTable_createInstance( XPropertyList* pList ) throw();
+SVX_DLLPUBLIC ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXGradientTable_createInstance( XPropertyList* pList ) throw();
+SVX_DLLPUBLIC ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxUnoXBitmapTable_createInstance( XPropertyList* pList ) throw();
+
+#endif
+
+
diff --git a/svx/inc/svx/algitem.hxx b/svx/inc/svx/algitem.hxx
new file mode 100644
index 000000000000..6d4f92571dc0
--- /dev/null
+++ b/svx/inc/svx/algitem.hxx
@@ -0,0 +1,202 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_ALGITEM_HXX
+#define _SVX_ALGITEM_HXX
+
+// include ---------------------------------------------------------------
+
+#include <svx/svxids.hrc>
+#include <svl/poolitem.hxx>
+#include <svl/eitem.hxx>
+#include <editeng/svxenum.hxx>
+#include "svx/svxdllapi.h"
+
+class SvStream;
+
+//------------------------------------------------------------------------
+
+
+
+class SVX_DLLPUBLIC SvxHorJustifyItem: public SfxEnumItem
+{
+public:
+ TYPEINFO();
+
+ SvxHorJustifyItem( const sal_uInt16 nId );
+
+ SvxHorJustifyItem(
+ const SvxCellHorJustify eJustify /*= SVX_HOR_JUSTIFY_STANDARD*/,
+ const sal_uInt16 nId );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual sal_uInt16 GetValueCount() const;
+ virtual String GetValueText( sal_uInt16 nVal ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const;
+
+ inline SvxHorJustifyItem& operator=(const SvxHorJustifyItem& rHorJustify)
+ {
+ SetValue( rHorJustify.GetValue() );
+ return *this;
+ }
+};
+
+
+//------------------------------------------------------------------------
+
+
+class SVX_DLLPUBLIC SvxVerJustifyItem: public SfxEnumItem
+{
+public:
+ TYPEINFO();
+
+ SvxVerJustifyItem( const sal_uInt16 nId );
+
+ SvxVerJustifyItem(
+ const SvxCellVerJustify eJustify /*= SVX_VER_JUSTIFY_STANDARD*/,
+ const sal_uInt16 nId );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual sal_uInt16 GetValueCount() const;
+ virtual String GetValueText( sal_uInt16 nVal ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const;
+
+ inline SvxVerJustifyItem& operator=(const SvxVerJustifyItem& rVerJustify)
+ {
+ SetValue( rVerJustify.GetValue() );
+ return *this;
+ }
+};
+
+
+//------------------------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxOrientationItem: public SfxEnumItem
+{
+public:
+ TYPEINFO();
+
+ SvxOrientationItem(
+ const SvxCellOrientation eOrientation /*= SVX_ORIENTATION_STANDARD*/,
+ const sal_uInt16 nId );
+
+ SvxOrientationItem(
+ sal_Int32 nRotation, sal_Bool bStacked,
+ const sal_uInt16 nId );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual sal_uInt16 GetValueCount() const;
+ virtual String GetValueText( sal_uInt16 nVal ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const;
+
+ inline SvxOrientationItem& operator=(const SvxOrientationItem& rOrientation)
+ {
+ SetValue( rOrientation.GetValue() );
+ return *this;
+ }
+
+ /** Returns sal_True, if the item represents STACKED state. */
+ sal_Bool IsStacked() const;
+ /** Returns the rotation this item represents (returns nStdAngle for STANDARD and STACKED state). */
+ sal_Int32 GetRotation( sal_Int32 nStdAngle = 0 ) const;
+ /** Fills this item according to passed item values. */
+ void SetFromRotation( sal_Int32 nRotation, sal_Bool bStacked );
+};
+
+//------------------------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxMarginItem: public SfxPoolItem
+{
+ sal_Int16 nLeftMargin;
+ sal_Int16 nTopMargin;
+ sal_Int16 nRightMargin;
+ sal_Int16 nBottomMargin;
+public:
+ TYPEINFO();
+ SvxMarginItem( const sal_uInt16 nId );
+ SvxMarginItem( sal_Int16 nLeft, sal_Int16 nTop /*= 0*/,
+ sal_Int16 nRight /*= 0*/, sal_Int16 nBottom /*= 0*/,
+ const sal_uInt16 nId );
+ SvxMarginItem( const SvxMarginItem& );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const;
+ virtual SvStream& Store( SvStream&, sal_uInt16 nItemVersion ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ sal_Int16 GetLeftMargin() const {return nLeftMargin; }
+ sal_Bool SetLeftMargin(sal_Int16 nLeft);
+ sal_Int16 GetTopMargin() const {return nTopMargin; }
+ sal_Bool SetTopMargin(sal_Int16 nTop);
+ sal_Int16 GetRightMargin() const {return nRightMargin; }
+ sal_Bool SetRightMargin(sal_Int16 nRight);
+ sal_Int16 GetBottomMargin() const {return nBottomMargin; }
+ sal_Bool SetBottomMargin(sal_Int16 nBottom);
+
+ inline SvxMarginItem& operator=(const SvxMarginItem& rMargin)
+ {
+ nLeftMargin = rMargin.nLeftMargin;
+ nTopMargin = rMargin.nTopMargin;
+ nRightMargin = rMargin.nRightMargin;
+ nBottomMargin = rMargin.nBottomMargin;
+ return *this;
+ }
+};
+
+#endif
+
diff --git a/svx/inc/svx/anchorid.hxx b/svx/inc/svx/anchorid.hxx
new file mode 100644
index 000000000000..976d0dc504c6
--- /dev/null
+++ b/svx/inc/svx/anchorid.hxx
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_ANCHORID_HXX
+#define _SVX_ANCHORID_HXX
+
+
+enum SvxAnchorIds
+{
+ SVX_OBJ_AT_CNTNT = 0x01, //Absatzgebundener Rahmen
+ SVX_OBJ_IN_CNTNT = 0x02, //Zeichengebundener Rahmen
+ SVX_OBJ_PAGE = 0x04, //Seitengebundener Rahmen
+ SVX_OBJ_AT_FLY = 0x08 //Rahmengebundener Rahmen
+// SVX_OBJ_AUTO_CNTNT = 0x10 //Automatisch positionierter, absatzgebundener Rahmen
+};
+
+
+
+#endif
diff --git a/svx/inc/svx/bmpmask.hxx b/svx/inc/svx/bmpmask.hxx
new file mode 100644
index 000000000000..39ae551db3dd
--- /dev/null
+++ b/svx/inc/svx/bmpmask.hxx
@@ -0,0 +1,200 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _BMPMASK_HXX_
+#define _BMPMASK_HXX_
+
+#include <sfx2/ctrlitem.hxx>
+#include <sfx2/dockwin.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/group.hxx>
+#include <vcl/graph.hxx>
+#include "svx/svxdllapi.h"
+
+#include <svx/dlgctrl.hxx>
+
+/*************************************************************************
+|*
+|* class SvxBmpMaskSelectItem
+|*
+\************************************************************************/
+class SvxBmpMask;
+
+class SvxBmpMaskSelectItem : public SfxControllerItem
+{
+private:
+ SvxBmpMask &rBmpMask;
+
+protected:
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+
+public:
+ SvxBmpMaskSelectItem( sal_uInt16 nId, SvxBmpMask& rMask,
+ SfxBindings& rBindings );
+};
+
+/*************************************************************************
+|*
+|* Ableitung vom SfxChildWindow als 'Beh"alter' f"ur Float
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC SvxBmpMaskChildWindow : public SfxChildWindow
+{
+ public:
+ SvxBmpMaskChildWindow( Window*,
+ sal_uInt16, SfxBindings*,
+ SfxChildWinInfo* );
+
+ SFX_DECL_CHILDWINDOW(SvxBmpMaskChildWindow);
+};
+
+/*************************************************************************
+|*
+|* class SvxBmpMask
+|*
+\************************************************************************/
+
+class MaskData;
+class MaskSet;
+class ColorWindow;
+
+class SVX_DLLPUBLIC SvxBmpMask : public SfxDockingWindow
+{
+ friend class MaskData;
+ friend class MaskSet;
+
+ Window* pParentWin;
+ Size aLastSize;
+ ToolBox aTbxPipette;
+ ColorWindow* pCtlPipette;
+ PushButton aBtnExec;
+ FixedLine aGrpQ;
+
+ CheckBox aCbx1;
+ MaskSet* pQSet1;
+ MetricField aSp1;
+ ColorLB aLbColor1;
+
+ CheckBox aCbx2;
+ MaskSet* pQSet2;
+ MetricField aSp2;
+ ColorLB aLbColor2;
+
+ CheckBox aCbx3;
+ MaskSet* pQSet3;
+ MetricField aSp3;
+ ColorLB aLbColor3;
+
+ CheckBox aCbx4;
+ MaskSet* pQSet4;
+ MetricField aSp4;
+ ColorLB aLbColor4;
+
+ MaskData* pData;
+ CheckBox aCbxTrans;
+ ColorLB aLbColorTrans;
+ FixedText aFt1;
+ FixedText aFt2;
+ FixedText aFt3;
+ const XColorTable* pColTab;
+ Color aPipetteColor;
+ SvxBmpMaskSelectItem aSelItem;
+
+ Image maImgPipette;
+ Image maImgPipetteH;
+
+ virtual sal_Bool Close();
+
+#ifdef BMPMASK_PRIVATE
+
+ sal_uInt16 InitColorArrays( Color* pSrcCols, Color* pDstCols,
+ sal_uIntPtr* pTols );
+
+ Bitmap ImpMask( const Bitmap& rBitmap );
+ BitmapEx ImpMask( const BitmapEx& rBitmapEx );
+ GDIMetaFile ImpMask( const GDIMetaFile& rMtf );
+ Animation ImpMask( const Animation& rAnimation );
+ BitmapEx ImpMaskTransparent( const BitmapEx& rBitmapEx,
+ const Color& rColor,
+ const long nTol );
+ BitmapEx ImpReplaceTransparency( const BitmapEx& rBmpEx,
+ const Color& rColor );
+ Animation ImpReplaceTransparency( const Animation& rAnim,
+ const Color& rColor );
+ GDIMetaFile ImpReplaceTransparency( const GDIMetaFile& rMtf,
+ const Color& rColor );
+
+#endif // BMPMASK_PRIVATE
+
+public:
+
+ SvxBmpMask( SfxBindings *pBindinx,
+ SfxChildWindow *pCW,
+ Window* pParent,
+ const ResId& rResId );
+ ~SvxBmpMask();
+
+ void SetColor( const Color& rColor );
+ void PipetteClicked();
+
+ sal_Bool NeedsColorTable() const;
+ void SetColorTable( const XColorTable* pColorTable );
+
+ void SetExecState( sal_Bool bEnable );
+
+ Graphic Mask( const Graphic& rGraphic );
+
+ sal_Bool IsEyedropping() const;
+
+ void onSelect( MaskSet* pSet );
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ void ApplyStyle();
+
+private:
+
+ /** Set names for accessible objects. This is necessary for objects
+ like the source color checkboxes which initially have no name and
+ for which the description would be read by AT.
+ */
+ SVX_DLLPRIVATE void SetAccessibleNames (void);
+};
+
+/*************************************************************************
+|*
+|* Defines
+|*
+\************************************************************************/
+
+#define SVXBMPMASK() ( (SvxBmpMask*) ( SfxViewFrame::Current()->GetChildWindow( \
+ SvxBmpMaskChildWindow::GetChildWindowId() )-> \
+ GetWindow() ) )
+
+#endif // _BMPMASK_HXX_
+
diff --git a/svx/inc/svx/camera3d.hxx b/svx/inc/svx/camera3d.hxx
new file mode 100644
index 000000000000..73cd1824933f
--- /dev/null
+++ b/svx/inc/svx/camera3d.hxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CAMERA3D_HXX
+#define _CAMERA3D_HXX
+
+#include <svx/viewpt3d.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* Kamera-Ableitung
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC Camera3D : public Viewport3D
+{
+ protected:
+ basegfx::B3DPoint aResetPos;
+ basegfx::B3DPoint aResetLookAt;
+ double fResetFocalLength;
+ double fResetBankAngle;
+
+ basegfx::B3DPoint aPosition;
+ basegfx::B3DPoint aLookAt;
+ double fFocalLength;
+ double fBankAngle;
+
+ FASTBOOL bAutoAdjustProjection;
+
+ public:
+ Camera3D(const basegfx::B3DPoint& rPos, const basegfx::B3DPoint& rLookAt,
+ double fFocalLen = 35.0, double fBankAng = 0);
+ Camera3D();
+
+ // Anfangswerte wieder herstellen
+ void Reset();
+
+ void SetDefaults(const basegfx::B3DPoint& rPos, const basegfx::B3DPoint& rLookAt,
+ double fFocalLen = 35.0, double fBankAng = 0);
+
+ void SetViewWindow(double fX, double fY, double fW, double fH);
+
+ void SetPosition(const basegfx::B3DPoint& rNewPos);
+ const basegfx::B3DPoint& GetPosition() const { return aPosition; }
+ void SetLookAt(const basegfx::B3DPoint& rNewLookAt);
+ const basegfx::B3DPoint& GetLookAt() const { return aLookAt; }
+ void SetPosAndLookAt(const basegfx::B3DPoint& rNewPos, const basegfx::B3DPoint& rNewLookAt);
+
+ // Brennweite in mm
+ void SetFocalLength(double fLen);
+ void SetFocalLengthWithCorrect(double fLen);
+ double GetFocalLength() const { return fFocalLength; }
+
+ // Neigung links/rechts
+ void SetBankAngle(double fAngle);
+ double GetBankAngle() const { return fBankAngle; }
+
+ // Um die Kameraposition drehen, LookAt wird dabei veraendert
+ void Rotate(double fHAngle, double fVAngle);
+
+ // Um den Blickpunkt drehen, Position wird dabei veraendert
+ void RotateAroundLookAt(double fHAngle, double fVAngle);
+
+ void SetAutoAdjustProjection(FASTBOOL bAdjust = sal_True)
+ { bAutoAdjustProjection = bAdjust; }
+ FASTBOOL IsAutoAdjustProjection() const { return bAutoAdjustProjection; }
+};
+
+#endif // _CAMERA3D_HXX
diff --git a/svx/inc/svx/charmap.hxx b/svx/inc/svx/charmap.hxx
new file mode 100644
index 000000000000..88662b3b4cdd
--- /dev/null
+++ b/svx/inc/svx/charmap.hxx
@@ -0,0 +1,140 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_CHARMAP_HXX
+#define _SVX_CHARMAP_HXX
+
+// include ---------------------------------------------------------------
+
+#include <vcl/ctrl.hxx>
+#include <vcl/metric.hxx>
+#include <vcl/scrbar.hxx>
+#include <map>
+#include <tools/shl.hxx> //add CHINA001
+#include <tools/debug.hxx> //add CHINA001
+#include "svx/svxdllapi.h"
+
+// define ----------------------------------------------------------------
+
+#define COLUMN_COUNT 16
+#define ROW_COUNT 8
+
+namespace svx
+{
+ struct SvxShowCharSetItem;
+ class SvxShowCharSetVirtualAcc;
+}
+
+// class SvxShowCharSet --------------------------------------------------
+
+class SVX_DLLPUBLIC SvxShowCharSet : public Control
+{
+public:
+ SvxShowCharSet( Window* pParent, const ResId& rResId );
+ ~SvxShowCharSet();
+
+ void SetFont( const Font& rFont );
+
+ void SelectCharacter( sal_uInt32 cNew, sal_Bool bFocus = sal_False );
+ sal_UCS4 GetSelectCharacter() const;
+
+ Link GetDoubleClickHdl() const { return aDoubleClkHdl; }
+ void SetDoubleClickHdl( const Link& rLink ) { aDoubleClkHdl = rLink; }
+ Link GetSelectHdl() const { return aSelectHdl; }
+ void SetSelectHdl( const Link& rHdl ) { aSelectHdl = rHdl; }
+ Link GetHighlightHdl() const { return aHighHdl; }
+ void SetHighlightHdl( const Link& rHdl ) { aHighHdl = rHdl; }
+ Link GetPreSelectHdl() const { return aHighHdl; }
+ void SetPreSelectHdl( const Link& rHdl ) { aPreSelectHdl = rHdl; }
+ static sal_uInt32& getSelectedChar();
+
+#ifdef _SVX_CHARMAP_CXX_
+ ::svx::SvxShowCharSetItem* ImplGetItem( int _nPos );
+ int FirstInView( void) const;
+ int LastInView( void) const;
+ int PixelToMapIndex( const Point&) const;
+ void SelectIndex( int index, sal_Bool bFocus = sal_False );
+ void DeSelect();
+ inline sal_Bool IsSelected(sal_uInt16 _nPos) const { return _nPos == nSelectedIndex; }
+ inline sal_uInt16 GetSelectIndexId() const { return sal::static_int_cast<sal_uInt16>(nSelectedIndex); }
+ sal_uInt16 GetRowPos(sal_uInt16 _nPos) const;
+ sal_uInt16 GetColumnPos(sal_uInt16 _nPos) const;
+
+ void ImplFireAccessibleEvent( short nEventId,
+ const ::com::sun::star::uno::Any& rOldValue,
+ const ::com::sun::star::uno::Any& rNewValue );
+ ScrollBar* getScrollBar();
+ void ReleaseAccessible();
+ sal_Int32 getMaxCharCount() const;
+#endif // _SVX_CHARMAP_CXX_
+
+protected:
+ virtual void Paint( const Rectangle& );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void GetFocus();
+ virtual void LoseFocus();
+ virtual void StateChanged( StateChangedType nStateChange );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+
+
+
+private:
+ typedef ::std::map<sal_Int32, ::svx::SvxShowCharSetItem*> ItemsMap;
+ ItemsMap m_aItems;
+ Link aDoubleClkHdl;
+ Link aSelectHdl;
+ Link aHighHdl;
+ Link aPreSelectHdl;
+ ::svx::SvxShowCharSetVirtualAcc* m_pAccessible;
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xAccessible;
+ long nX;
+ long nY;
+ sal_Bool bDrag;
+
+ sal_Int32 nSelectedIndex;
+
+ FontCharMap maFontCharMap;
+ ScrollBar aVscrollSB;
+ Size aOrigSize;
+ Point aOrigPos;
+
+private:
+ void DrawChars_Impl( int n1, int n2);
+ void InitSettings( sal_Bool bForeground, sal_Bool bBackground);
+ // abstraction layers are: Unicode<->MapIndex<->Pixel
+ Point MapIndexToPixel( int) const;
+ DECL_LINK( VscrollHdl, ScrollBar* );
+};
+
+#endif
+
diff --git a/svx/inc/svx/checklbx.hxx b/svx/inc/svx/checklbx.hxx
new file mode 100644
index 000000000000..073284d02617
--- /dev/null
+++ b/svx/inc/svx/checklbx.hxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_CHECKLBX_HXX
+#define _SVX_CHECKLBX_HXX
+
+// include ---------------------------------------------------------------
+
+
+#include <svtools/svtreebx.hxx>
+#include <svtools/svlbitm.hxx>
+
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+#include "svx/svxdllapi.h"
+
+// class SvxCheckListBox -------------------------------------------------
+
+class SVX_DLLPUBLIC SvxCheckListBox : public SvTreeListBox
+{
+ using Window::GetText;
+
+private:
+ SvLBoxButtonData* pCheckButton;
+
+#ifdef _SVX_CHECKLBX_CXX
+ SVX_DLLPRIVATE void Init_Impl();
+#endif
+
+ using SvTreeListBox::InsertEntry;
+ // Avoid ambiguity with new InsertEntry:
+ virtual SvLBoxEntry* InsertEntry( const XubString& rText, SvLBoxEntry* pParent,
+ sal_Bool bChildsOnDemand,
+ sal_uIntPtr nPos, void* pUserData,
+ SvLBoxButtonKind eButtonKind );
+
+public:
+ SvxCheckListBox( Window* pParent, WinBits nWinStyle = 0 );
+ SvxCheckListBox( Window* pParent, const ResId& rResId );
+ SvxCheckListBox( Window* pParent, const ResId& rResId,
+ const Image& rNormalStaticImage,
+ const Image& rHighContrastStaticImage );
+ ~SvxCheckListBox();
+
+ void InsertEntry ( const String& rStr,
+ sal_uInt16 nPos = LISTBOX_APPEND,
+ void* pUserData = NULL,
+ SvLBoxButtonKind eButtonKind =
+ SvLBoxButtonKind_enabledCheckbox );
+ void RemoveEntry ( sal_uInt16 nPos );
+
+ void SelectEntryPos ( sal_uInt16 nPos, sal_Bool bSelect = sal_True );
+ sal_uInt16 GetSelectEntryPos () const;
+
+ String GetText ( sal_uInt16 nPos ) const;
+ sal_uInt16 GetCheckedEntryCount() const;
+ void CheckEntryPos ( sal_uInt16 nPos, sal_Bool bCheck = sal_True );
+ sal_Bool IsChecked ( sal_uInt16 nPos ) const;
+ void ToggleCheckButton ( SvLBoxEntry* pEntry );
+
+ void* SetEntryData ( sal_uInt16 nPos, void* pNewData );
+ void* GetEntryData ( sal_uInt16 nPos ) const;
+
+ virtual void MouseButtonDown ( const MouseEvent& rMEvt );
+ virtual void KeyInput ( const KeyEvent& rKEvt );
+};
+
+
+#endif
+
diff --git a/svx/inc/svx/chrtitem.hxx b/svx/inc/svx/chrtitem.hxx
new file mode 100644
index 000000000000..bc68bf1df705
--- /dev/null
+++ b/svx/inc/svx/chrtitem.hxx
@@ -0,0 +1,385 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_CHRTITEM_HXX
+#define _SVX_CHRTITEM_HXX
+
+// include ---------------------------------------------------------------
+
+#include <svl/eitem.hxx>
+#include "svx/svxdllapi.h"
+
+//------------------------------------------------------------------------
+
+enum SvxChartStyle
+{
+ CHSTYLE_2D_LINE,
+ CHSTYLE_2D_STACKEDLINE,
+ CHSTYLE_2D_PERCENTLINE,
+ CHSTYLE_2D_COLUMN,
+ CHSTYLE_2D_STACKEDCOLUMN,
+ CHSTYLE_2D_PERCENTCOLUMN,
+ CHSTYLE_2D_BAR,
+ CHSTYLE_2D_STACKEDBAR,
+ CHSTYLE_2D_PERCENTBAR,
+ CHSTYLE_2D_AREA,
+ CHSTYLE_2D_STACKEDAREA,
+ CHSTYLE_2D_PERCENTAREA,
+ CHSTYLE_2D_PIE,
+ CHSTYLE_3D_STRIPE,
+ CHSTYLE_3D_COLUMN,
+ CHSTYLE_3D_FLATCOLUMN,
+ CHSTYLE_3D_STACKEDFLATCOLUMN,
+ CHSTYLE_3D_PERCENTFLATCOLUMN,
+ CHSTYLE_3D_AREA,
+ CHSTYLE_3D_STACKEDAREA,
+ CHSTYLE_3D_PERCENTAREA,
+ CHSTYLE_3D_SURFACE,
+ CHSTYLE_3D_PIE,
+ CHSTYLE_2D_XY,
+ CHSTYLE_3D_XYZ,
+ CHSTYLE_2D_LINESYMBOLS,
+ CHSTYLE_2D_STACKEDLINESYM,
+ CHSTYLE_2D_PERCENTLINESYM,
+ CHSTYLE_2D_XYSYMBOLS,
+ CHSTYLE_3D_XYZSYMBOLS,
+ CHSTYLE_2D_DONUT1,
+ CHSTYLE_2D_DONUT2,
+ CHSTYLE_3D_BAR,
+ CHSTYLE_3D_FLATBAR,
+ CHSTYLE_3D_STACKEDFLATBAR,
+ CHSTYLE_3D_PERCENTFLATBAR,
+ CHSTYLE_2D_PIE_SEGOF1,
+ CHSTYLE_2D_PIE_SEGOFALL,
+ CHSTYLE_2D_NET,
+ CHSTYLE_2D_NET_SYMBOLS,
+ CHSTYLE_2D_NET_STACK,
+ CHSTYLE_2D_NET_SYMBOLS_STACK,
+ CHSTYLE_2D_NET_PERCENT,
+ CHSTYLE_2D_NET_SYMBOLS_PERCENT,
+ CHSTYLE_2D_CUBIC_SPLINE,
+ CHSTYLE_2D_CUBIC_SPLINE_SYMBOL,
+ CHSTYLE_2D_B_SPLINE,
+ CHSTYLE_2D_B_SPLINE_SYMBOL,
+ CHSTYLE_2D_CUBIC_SPLINE_XY,
+ CHSTYLE_2D_CUBIC_SPLINE_SYMBOL_XY,
+ CHSTYLE_2D_B_SPLINE_XY,
+ CHSTYLE_2D_B_SPLINE_SYMBOL_XY,
+ CHSTYLE_2D_XY_LINE,
+ CHSTYLE_2D_LINE_COLUMN,
+ CHSTYLE_2D_LINE_STACKEDCOLUMN,
+ CHSTYLE_2D_STOCK_1,
+ CHSTYLE_2D_STOCK_2,
+ CHSTYLE_2D_STOCK_3,
+ CHSTYLE_2D_STOCK_4,
+ CHSTYLE_ADDIN
+};
+
+#define CHSTYLE_COUNT (CHSTYLE_ADDIN + 1)
+
+enum SvxChartDataDescr
+{
+ CHDESCR_NONE,
+ CHDESCR_VALUE,
+ CHDESCR_PERCENT,
+ CHDESCR_TEXT,
+ CHDESCR_TEXTANDPERCENT,
+ CHDESCR_NUMFORMAT_PERCENT,
+ CHDESCR_NUMFORMAT_VALUE,
+ CHDESCR_TEXTANDVALUE
+};
+
+#define CHDESCR_COUNT (CHDESCR_TEXTANDVALUE + 1)
+
+enum SvxChartLegendPos
+{
+ CHLEGEND_NONE,
+ CHLEGEND_LEFT,
+ CHLEGEND_TOP,
+ CHLEGEND_RIGHT,
+ CHLEGEND_BOTTOM,
+ CHLEGEND_NONE_TOP,
+ CHLEGEND_NONE_LEFT,
+ CHLEGEND_NONE_RIGHT,
+ CHLEGEND_NONE_BOTTOM
+};
+
+#define CHLEGEND_COUNT (CHLEGEND_BOTTOM + 1)
+
+enum SvxChartTextOrder
+{
+ CHTXTORDER_SIDEBYSIDE,
+ CHTXTORDER_UPDOWN,
+ CHTXTORDER_DOWNUP,
+ CHTXTORDER_AUTO
+};
+
+#define CHTXTORDER_COUNT (CHTXTORDER_AUTO + 1)
+
+enum SvxChartTextOrient
+{
+ CHTXTORIENT_AUTOMATIC,
+ CHTXTORIENT_STANDARD,
+ CHTXTORIENT_BOTTOMTOP,
+ CHTXTORIENT_STACKED,
+ CHTXTORIENT_TOPBOTTOM
+};
+
+#define CHTXTORIENT_COUNT (CHTXTORIENT_TOPBOTTOM + 1)
+
+enum SvxChartKindError
+{
+ CHERROR_NONE,
+ CHERROR_VARIANT,
+ CHERROR_SIGMA,
+ CHERROR_PERCENT,
+ CHERROR_BIGERROR,
+ CHERROR_CONST,
+ CHERROR_STDERROR,
+ CHERROR_RANGE
+};
+
+#define CHERROR_COUNT (CHERROR_RANGE + 1)
+
+enum SvxChartIndicate
+{
+ CHINDICATE_NONE,
+ CHINDICATE_BOTH,
+ CHINDICATE_UP,
+ CHINDICATE_DOWN
+};
+
+#define CHINDICATE_COUNT (CHINDICATE_DOWN + 1)
+
+enum SvxChartRegress
+{
+ CHREGRESS_NONE,
+ CHREGRESS_LINEAR,
+ CHREGRESS_LOG,
+ CHREGRESS_EXP,
+ CHREGRESS_POWER
+};
+
+#define CHREGRESS_COUNT (CHREGRESS_POWER + 1)
+
+//------------------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxChartStyleItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+ SvxChartStyleItem(SvxChartStyle eStyle /*= CHSTYLE_2D_LINE*/,
+ sal_uInt16 nId );
+ SvxChartStyleItem(SvStream& rIn, sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ sal_uInt16 GetValueCount() const { return CHSTYLE_COUNT; }
+ SvxChartStyle GetValue() const
+ { return (SvxChartStyle)SfxEnumItem::GetValue(); }
+};
+
+//------------------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxChartRegressItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+ SvxChartRegressItem(SvxChartRegress eRegress /*= CHREGRESS_LINEAR*/,
+ sal_uInt16 nId );
+ SvxChartRegressItem(SvStream& rIn, sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ sal_uInt16 GetValueCount() const { return CHREGRESS_COUNT; }
+ SvxChartRegress GetValue() const
+ { return (SvxChartRegress)SfxEnumItem::GetValue(); }
+ sal_uInt16 GetVersion (sal_uInt16 nFileFormatVersion) const;
+};
+
+//------------------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxChartDataDescrItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+ SvxChartDataDescrItem(SvxChartDataDescr eDataDescr /*= CHDESCR_NONE*/,
+ sal_uInt16 nId );
+ SvxChartDataDescrItem(SvStream& rIn,
+ sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ sal_uInt16 GetValueCount() const { return CHDESCR_COUNT; }
+ SvxChartDataDescr GetValue() const
+ { return (SvxChartDataDescr)SfxEnumItem::GetValue(); }
+};
+
+//------------------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxChartLegendPosItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+ SvxChartLegendPosItem(SvxChartLegendPos eLegendPos /*= CHLEGEND_NONE*/,
+ sal_uInt16 nId );
+ SvxChartLegendPosItem(SvStream& rIn,
+ sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ sal_uInt16 GetValueCount() const { return CHLEGEND_COUNT; }
+ SvxChartLegendPos GetValue() const
+ { return (SvxChartLegendPos)SfxEnumItem::GetValue(); }
+};
+
+//------------------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxChartTextOrderItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+ SvxChartTextOrderItem(SvxChartTextOrder eOrder /*= CHTXTORDER_SIDEBYSIDE*/,
+ sal_uInt16 nId );
+ SvxChartTextOrderItem(SvStream& rIn,
+ sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ sal_uInt16 GetValueCount() const { return CHTXTORDER_COUNT; }
+ SvxChartTextOrder GetValue() const
+ { return (SvxChartTextOrder)SfxEnumItem::GetValue(); }
+};
+
+//------------------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxChartTextOrientItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+ SvxChartTextOrientItem(SvxChartTextOrient /*eOrient = CHTXTORIENT_STANDARD*/,
+ sal_uInt16 nId );
+ SvxChartTextOrientItem(SvStream& rIn,
+ sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ sal_uInt16 GetValueCount() const { return CHTXTORDER_COUNT; }
+ SvxChartTextOrient GetValue() const
+ { return (SvxChartTextOrient)SfxEnumItem::GetValue(); }
+};
+
+//------------------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxChartKindErrorItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+ SvxChartKindErrorItem(SvxChartKindError /*eOrient = CHERROR_NONE*/,
+ sal_uInt16 nId );
+ SvxChartKindErrorItem(SvStream& rIn,
+ sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ sal_uInt16 GetValueCount() const { return CHERROR_COUNT; }
+ SvxChartKindError GetValue() const
+ { return (SvxChartKindError)SfxEnumItem::GetValue(); }
+
+ sal_uInt16 GetVersion (sal_uInt16 nFileFormatVersion) const;
+};
+
+//------------------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxChartIndicateItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+ SvxChartIndicateItem(SvxChartIndicate eOrient /*= CHINDICATE_NONE*/,
+ sal_uInt16 nId );
+ SvxChartIndicateItem(SvStream& rIn,
+ sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ sal_uInt16 GetValueCount() const { return CHINDICATE_COUNT; }
+ SvxChartIndicate GetValue() const
+ { return (SvxChartIndicate)SfxEnumItem::GetValue(); }
+
+ sal_uInt16 GetVersion (sal_uInt16 nFileFormatVersion) const;
+};
+
+//------------------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxDoubleItem : public SfxPoolItem
+{
+ double fVal;
+
+public:
+ TYPEINFO();
+ SvxDoubleItem(double fValue /*= 0.0*/, sal_uInt16 nId );
+ SvxDoubleItem(SvStream& rIn, sal_uInt16 nId );
+ SvxDoubleItem(const SvxDoubleItem& rItem);
+
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+
+
+ virtual String GetValueText() const;
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0) const;
+
+ virtual int operator == (const SfxPoolItem&) const;
+ virtual SfxPoolItem* Clone(SfxItemPool *pPool = NULL) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVersion) const;
+ virtual SvStream& Store(SvStream& rOut, sal_uInt16 nItemVersion ) const;
+
+ virtual double GetMin() const;
+ virtual double GetMax() const;
+
+ virtual SfxFieldUnit GetUnit() const;
+
+ double GetValue() const { return fVal; }
+ void SetValue(double fNewVal) { fVal = fNewVal; }
+};
+
+#endif // _SVX_CHRTITEM_HXX
+
diff --git a/svx/inc/svx/clipboardctl.hxx b/svx/inc/svx/clipboardctl.hxx
new file mode 100644
index 000000000000..bcfafe6c93f7
--- /dev/null
+++ b/svx/inc/svx/clipboardctl.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_CLIPBOARDCTL_HXX_
+#define _SVX_CLIPBOARDCTL_HXX_
+
+#include <sfx2/tbxctrl.hxx>
+#include <sfx2/ctrlitem.hxx>
+#include <svl/poolitem.hxx>
+
+
+#include "svx/svxdllapi.h"
+
+class PopupMenu;
+class SvxClipboardFmtItem;
+
+
+class SVX_DLLPUBLIC SvxClipBoardControl : public SfxToolBoxControl
+{
+ SfxPoolItem* pClipboardFmtItem;
+ PopupMenu* pPopup;
+ sal_uInt16 nItemId;
+ sal_Bool bDisabled;
+
+ void DelPopup();
+
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SvxClipBoardControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxClipBoardControl();
+
+ virtual SfxPopupWindowType GetPopupWindowType() const;
+ virtual SfxPopupWindow* CreatePopupWindow();
+ virtual void StateChanged( sal_uInt16 nSID,
+ SfxItemState eState,
+ const SfxPoolItem* pState );
+};
+
+
+#endif
+
diff --git a/svx/inc/svx/clipfmtitem.hxx b/svx/inc/svx/clipfmtitem.hxx
new file mode 100644
index 000000000000..79a430892e89
--- /dev/null
+++ b/svx/inc/svx/clipfmtitem.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_CLIPFMTITEM_HXX
+#define _SVX_CLIPFMTITEM_HXX
+
+// include ---------------------------------------------------------------
+
+#include <tools/gen.hxx>
+#include <svl/poolitem.hxx>
+#include "svx/svxdllapi.h"
+
+// class SvxClipboardFmtItem ----------------------------------------------
+struct SvxClipboardFmtItem_Impl;
+
+class SVX_DLLPUBLIC SvxClipboardFmtItem : public SfxPoolItem
+{
+ SvxClipboardFmtItem_Impl* pImpl;
+protected:
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+public:
+ TYPEINFO();
+ SvxClipboardFmtItem( sal_uInt16 nId = 0 );
+ SvxClipboardFmtItem( const SvxClipboardFmtItem& );
+ virtual ~SvxClipboardFmtItem();
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId );
+
+ void AddClipbrdFormat( sal_uIntPtr nId, sal_uInt16 nPos = USHRT_MAX );
+ void AddClipbrdFormat( sal_uIntPtr nId, const String& rName,
+ sal_uInt16 nPos = USHRT_MAX );
+ sal_uInt16 Count() const;
+
+ sal_uIntPtr GetClipbrdFormatId( sal_uInt16 nPos ) const;
+ const String& GetClipbrdFormatName( sal_uInt16 nPos ) const;
+};
+
+
+#endif
+
diff --git a/svx/inc/svx/colrctrl.hxx b/svx/inc/svx/colrctrl.hxx
new file mode 100644
index 000000000000..c13d01c8a768
--- /dev/null
+++ b/svx/inc/svx/colrctrl.hxx
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_COLRCTRL_HXX
+#define _SVX_COLRCTRL_HXX
+
+#include <sfx2/dockwin.hxx>
+#include <sfx2/childwin.hxx>
+#include <svtools/valueset.hxx>
+#include <svtools/transfer.hxx>
+#include <svl/lstner.hxx>
+#include "svx/svxdllapi.h"
+
+class XColorTable;
+class SvData;
+
+/*************************************************************************
+|*
+|* SvxColorValueSet
+|*
+\************************************************************************/
+
+class SvxColorValueSet : public ValueSet, public DragSourceHelper
+{
+ using ValueSet::StartDrag;
+
+private:
+
+ sal_Bool bLeft;
+ Point aDragPosPixel;
+
+protected:
+
+ void DoDrag();
+
+ // ValueSet
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void Command(const CommandEvent& rCEvt );
+
+ // DragSourceHelper
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPtPixel );
+
+ DECL_STATIC_LINK(SvxColorValueSet, ExecDragHdl, void*);
+
+public:
+ SvxColorValueSet( Window* pParent, WinBits nWinStyle = WB_ITEMBORDER );
+ SvxColorValueSet( Window* pParent, const ResId& rResId );
+
+ sal_Bool IsLeftButton() const { return bLeft; }
+};
+
+/*************************************************************************
+|*
+|* Ableitung vom SfxChildWindow als "Behaelter" fuer Controller
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC SvxColorChildWindow : public SfxChildWindow
+{
+ public:
+ SvxColorChildWindow( Window*, sal_uInt16, SfxBindings*,
+ SfxChildWinInfo* );
+
+ SFX_DECL_CHILDWINDOW(SvxColorChildWindow);
+};
+
+/*************************************************************************
+|*
+|* SvxColorDockingWindow
+|*
+\************************************************************************/
+
+class SvxColorDockingWindow : public SfxDockingWindow, public SfxListener
+{
+ friend class SvxColorChildWindow;
+
+private:
+ XColorTable* pColorTable;
+ SvxColorValueSet aColorSet;
+ sal_uInt16 nLeftSlot;
+ sal_uInt16 nRightSlot;
+ sal_uInt16 nCols;
+ sal_uInt16 nLines;
+ long nCount;
+ Size aColorSize;
+ Size aItemSize;
+
+//#if 0 // _SOLAR__PRIVATE
+ void FillValueSet();
+ void SetSize();
+ DECL_LINK( SelectHdl, void * );
+
+ /** This function is called when the window gets the focus. It grabs
+ the focus to the color value set so that it can be controlled with
+ the keyboard.
+ */
+ virtual void GetFocus (void);
+//#endif
+
+protected:
+ virtual sal_Bool Close();
+ virtual void Resize();
+ virtual void Resizing( Size& rSize );
+
+public:
+ SvxColorDockingWindow( SfxBindings* pBindings,
+ SfxChildWindow *pCW,
+ Window* pParent,
+ const ResId& rResId );
+ ~SvxColorDockingWindow();
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ void SetSlotIDs( sal_uInt16 nLeft, sal_uInt16 nRight )
+ { nLeftSlot = nLeft; nRightSlot = nRight; }
+
+ virtual long Notify( NotifyEvent& rNEvt );
+};
+
+#endif
+
diff --git a/svx/inc/svx/connctrl.hxx b/svx/inc/svx/connctrl.hxx
new file mode 100644
index 000000000000..daab7e093ef1
--- /dev/null
+++ b/svx/inc/svx/connctrl.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_CONNCTRL_HXX
+#define _SVX_CONNCTRL_HXX
+
+// include ---------------------------------------------------------------
+
+#ifndef _CTRL_HXX //autogen
+#include <vcl/ctrl.hxx>
+#endif
+#include "svx/svxdllapi.h"
+
+class SfxItemSet;
+class SdrEdgeObj;
+class SdrView;
+class SdrObjList;
+
+/*************************************************************************
+|*
+|* SvxXConnectionPreview
+|*
+\************************************************************************/
+class SVX_DLLPUBLIC SvxXConnectionPreview : public Control
+{
+ friend class SvxConnectionPage;
+
+private:
+ const SfxItemSet& rAttrs;
+ SdrEdgeObj* pEdgeObj;
+ SdrObjList* pObjList;
+ const SdrView* pView;
+
+ SVX_DLLPRIVATE void SetStyles();
+public:
+ SvxXConnectionPreview( Window* pParent, const ResId& rResId,
+ const SfxItemSet& rInAttrs );
+ ~SvxXConnectionPreview();
+
+ virtual void Paint( const Rectangle& rRect );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+
+ void SetAttributes( const SfxItemSet& rInAttrs );
+ sal_uInt16 GetLineDeltaAnz();
+
+ void Construct();
+ void SetView( const SdrView* pSdrView ) { pView = pSdrView; }
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+};
+
+
+#endif // _SVX_CONNCTRL_HXX
+
diff --git a/svx/inc/svx/contdlg.hxx b/svx/inc/svx/contdlg.hxx
new file mode 100644
index 000000000000..c0e78425dcdd
--- /dev/null
+++ b/svx/inc/svx/contdlg.hxx
@@ -0,0 +1,142 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CONTDLG_HXX_
+#define _CONTDLG_HXX_
+
+#include <sfx2/basedlgs.hxx>
+#include <sfx2/ctrlitem.hxx>
+#include <sfx2/childwin.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* Ableitung vom SfxChildWindow als "Behaelter" fuer Float
+|*
+\************************************************************************/
+
+class Graphic;
+
+class SVX_DLLPUBLIC SvxContourDlgChildWindow : public SfxChildWindow
+{
+ public:
+
+ SvxContourDlgChildWindow( Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo* );
+
+ SFX_DECL_CHILDWINDOW( SvxContourDlgChildWindow );
+
+ static void UpdateContourDlg( const Graphic& rGraphic, sal_Bool bGraphicLinked,
+ const PolyPolygon* pPolyPoly = NULL,
+ void* pEditingObj = NULL );
+};
+
+#ifndef _REDUCED_ContourDlg_HXX_
+#define _REDUCED_CONTDLG_HXX_
+
+class SvxSuperContourDlg;
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+class SvxContourDlgItem : public SfxControllerItem
+{
+ SvxSuperContourDlg& rDlg;
+
+protected:
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+
+public:
+
+ SvxContourDlgItem( sal_uInt16 nId, SvxSuperContourDlg& rDlg, SfxBindings& rBindings );
+};
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC SvxContourDlg : public SfxFloatingWindow
+{
+ using Window::Update;
+
+ SvxSuperContourDlg* pSuperClass;
+
+//#if 0 // _SOLAR__PRIVATE
+
+protected:
+
+ void SetSuperClass( SvxSuperContourDlg& rSuperClass ) { pSuperClass = &rSuperClass; }
+
+//#endif // __PRIVATE
+
+public:
+
+ SvxContourDlg( SfxBindings *pBindings, SfxChildWindow *pCW,
+ Window* pParent, const ResId& rResId );
+ ~SvxContourDlg();
+
+ void SetExecState( sal_Bool bEnable );
+
+ void SetGraphic( const Graphic& rGraphic );
+ void SetGraphicLinked( sal_Bool bLinked );
+ const Graphic& GetGraphic() const;
+ sal_Bool IsGraphicChanged() const;
+
+ void SetPolyPolygon( const PolyPolygon& rPolyPoly );
+ PolyPolygon GetPolyPolygon();
+
+ void SetEditingObject( void* pObj );
+ const void* GetEditingObject() const;
+
+ void Update( const Graphic& rGraphic, sal_Bool bGraphicLinked,
+ const PolyPolygon* pPolyPoly = NULL, void* pEditingObj = NULL );
+
+ static PolyPolygon CreateAutoContour( const Graphic& rGraphic,
+ const Rectangle* pRect = NULL,
+ const sal_uIntPtr nFlags = 0L );
+ static void ScaleContour( PolyPolygon& rContour, const Graphic& rGraphic,
+ const MapUnit eUnit, const Size& rDisplaySize );
+};
+
+/*************************************************************************
+|*
+|* Defines
+|*
+\************************************************************************/
+
+#define SVXCONTOURDLG() ( (SvxContourDlg*) ( SfxViewFrame::Current()->GetChildWindow( \
+ SvxContourDlgChildWindow::GetChildWindowId() )-> \
+ GetWindow() ) )
+
+#endif // _REDUCED_CONTDLG_HXX_
+#endif // _CONTDLG_HXX_
+
diff --git a/svx/inc/svx/ctredlin.hxx b/svx/inc/svx/ctredlin.hxx
new file mode 100644
index 000000000000..1189a7a8a7be
--- /dev/null
+++ b/svx/inc/svx/ctredlin.hxx
@@ -0,0 +1,431 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_CTREDLIN_HXX
+#define _SVX_CTREDLIN_HXX
+
+#ifndef _MOREBTN_HXX //autogen
+#include <vcl/morebtn.hxx>
+#endif
+#ifndef _COMBOBOX_HXX //autogen
+#include <vcl/combobox.hxx>
+#endif
+#include <svtools/headbar.hxx>
+#include <svtools/svtabbx.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/tabpage.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+
+#ifndef _SVX_SIMPTABL
+#include <svx/simptabl.hxx>
+#endif
+#include <vcl/tabctrl.hxx>
+#include <tools/datetime.hxx>
+#include <svtools/txtcmp.hxx>
+#include "svx/svxdllapi.h"
+
+#define FLT_DATE_BEFORE 0
+#define FLT_DATE_SINCE 1
+#define FLT_DATE_EQUAL 2
+#define FLT_DATE_NOTEQUAL 3
+#define FLT_DATE_BETWEEN 4
+#define FLT_DATE_SAVE 5
+
+
+// Struct fuer Datums-Sortierung
+
+class SVX_DLLPUBLIC RedlinData
+{
+public:
+ RedlinData();
+ virtual ~RedlinData();
+ sal_Bool bDisabled;
+ DateTime aDateTime;
+ void* pData;
+};
+
+class SvxRedlinEntry : public SvLBoxEntry
+{
+public:
+ SvxRedlinEntry();
+ virtual ~SvxRedlinEntry();
+};
+
+// Klasse fuer die Darstellung von schriftabhaengigen Strings
+class SvLBoxColorString : public SvLBoxString
+{
+private:
+
+ Color aPrivColor;
+
+public:
+ SvLBoxColorString( SvLBoxEntry*,sal_uInt16 nFlags,const XubString& rStr,
+ const Color& rCol);
+ SvLBoxColorString();
+ ~SvLBoxColorString();
+
+ void Paint( const Point&, SvLBox& rDev, sal_uInt16 nFlags,SvLBoxEntry* );
+ SvLBoxItem* Create() const;
+};
+
+class SVX_DLLPUBLIC SvxRedlinTable : public SvxSimpleTable
+{
+ using SvTabListBox::InsertEntry;
+
+private:
+
+ sal_Bool bIsCalc;
+ sal_uInt16 nDatePos;
+ sal_Bool bAuthor;
+ sal_Bool bDate;
+ sal_Bool bComment;
+ sal_uInt16 nDaTiMode;
+ DateTime aDaTiFirst;
+ DateTime aDaTiLast;
+ DateTime aDaTiFilterFirst;
+ DateTime aDaTiFilterLast;
+ String aAuthor;
+ Color aEntryColor;
+ String aCurEntry;
+ utl::TextSearch* pCommentSearcher;
+ Link aColCompareLink;
+
+protected:
+
+ virtual StringCompare ColCompare(SvLBoxEntry*,SvLBoxEntry*);
+ virtual void InitEntry(SvLBoxEntry*,const XubString&,const Image&,const Image&,SvLBoxButtonKind);
+
+
+
+public:
+
+ SvxRedlinTable( Window* pParent,WinBits nBits );
+ SvxRedlinTable( Window* pParent,const ResId& rResId);
+ ~SvxRedlinTable();
+
+ // For FilterPage only {
+ void SetFilterDate(sal_Bool bFlag=sal_True);
+ void SetDateTimeMode(sal_uInt16 nMode);
+ void SetFirstDate(const Date&);
+ void SetLastDate(const Date&);
+ void SetFirstTime(const Time&);
+ void SetLastTime(const Time&);
+ void SetFilterAuthor(sal_Bool bFlag=sal_True);
+ void SetAuthor(const String &);
+ void SetFilterComment(sal_Bool bFlag=sal_True);
+ void SetCommentParams( const utl::SearchParam* pSearchPara );
+
+ void UpdateFilterTest();
+ // } For FilterPage only
+
+ void SetCalcView(sal_Bool bFlag=sal_True);
+ sal_Bool IsValidCalcEntry(const String& ,RedlinData *pUserData);
+ sal_Bool IsValidWriterEntry(const String& ,RedlinData *pUserData);
+
+ // keine NULL-Ptr. ueberpruefung {
+ sal_Bool IsValidEntry(const String* pAuthor,const DateTime *pDateTime,const String* pComment);
+ sal_Bool IsValidEntry(const String* pAuthor,const DateTime *pDateTime);
+ sal_Bool IsValidComment(const String* pComment);
+ // }
+
+ SvLBoxEntry* InsertEntry(const String& ,RedlinData *pUserData,
+ SvLBoxEntry* pParent=NULL,sal_uIntPtr nPos=LIST_APPEND);
+
+ SvLBoxEntry* InsertEntry(const String& ,RedlinData *pUserData,const Color&,
+ SvLBoxEntry* pParent=NULL,sal_uIntPtr nPos=LIST_APPEND);
+
+
+ virtual SvLBoxEntry* CreateEntry() const;
+
+ void SetColCompareHdl(const Link& rLink ) { aColCompareLink = rLink; }
+ const Link& GetColCompareHdl() const { return aColCompareLink; }
+
+
+};
+
+//==================================================================
+// Filter- Tabpage
+//==================================================================
+class SVX_DLLPUBLIC SvxTPFilter: public TabPage
+{
+private:
+
+ Link aReadyLink;
+ Link aModifyLink;
+ Link aModifyDateLink;
+ Link aModifyAuthorLink;
+ Link aModifyRefLink;
+ Link aRefLink;
+ Link aModifyComLink;
+
+ SvxRedlinTable* pRedlinTable;
+ CheckBox aCbDate;
+ ListBox aLbDate;
+ DateField aDfDate;
+ TimeField aTfDate;
+ ImageButton aIbClock;
+ FixedText aFtDate2;
+ DateField aDfDate2;
+ TimeField aTfDate2;
+ ImageButton aIbClock2;
+ CheckBox aCbAuthor;
+ ListBox aLbAuthor;
+ CheckBox aCbRange;
+ Edit aEdRange;
+ PushButton aBtnRange;
+ ListBox aLbAction;
+ CheckBox aCbComment;
+ Edit aEdComment;
+ String aActionStr;
+ String aRangeStr;
+ String aStrMyName;
+ sal_Bool bModified;
+
+ DECL_LINK( SelDateHdl, ListBox* );
+ DECL_LINK( RowEnableHdl, CheckBox* );
+ DECL_LINK( TimeHdl, ImageButton* );
+ DECL_LINK( ModifyHdl, void* );
+ DECL_LINK( ModifyDate, void* );
+ DECL_LINK( RefHandle, PushButton* );
+
+
+protected:
+
+ void ShowDateFields(sal_uInt16 nKind);
+ void EnableDateLine1(sal_Bool bFlag);
+ void EnableDateLine2(sal_Bool bFlag);
+
+public:
+ SvxTPFilter( Window * pParent);
+
+ virtual void DeactivatePage();
+ void SetRedlinTable(SvxRedlinTable*);
+
+ String GetMyName() const;
+ Date GetFirstDate() const;
+ void SetFirstDate(const Date &aDate);
+ Time GetFirstTime() const;
+ void SetFirstTime(const Time &aTime);
+
+ Date GetLastDate() const;
+ void SetLastDate(const Date &aDate);
+ Time GetLastTime() const;
+ void SetLastTime(const Time &aTime);
+
+ void SetDateMode(sal_uInt16 nMode);
+ sal_uInt16 GetDateMode();
+
+ void ClearAuthors();
+ void InsertAuthor( const String& rString, sal_uInt16 nPos = LISTBOX_APPEND );
+ sal_uInt16 GetSelectedAuthorPos();
+ String GetSelectedAuthor()const;
+ void SelectedAuthorPos(sal_uInt16 nPos);
+ sal_uInt16 SelectAuthor(const String& aString);
+ void SetComment(const String &rComment);
+ String GetComment()const;
+
+
+ // Methoden fuer Calc {
+ void SetRange(const String& rString);
+ String GetRange() const;
+ void HideRange(sal_Bool bHide=sal_True);
+ void DisableRange(sal_Bool bFlag=sal_True);
+ void SetFocusToRange();
+ // } Methoden fuer Calc
+
+ void HideClocks(sal_Bool bHide=sal_True);
+ void DisableRef(sal_Bool bFlag);
+
+ sal_Bool IsDate();
+ sal_Bool IsAuthor();
+ sal_Bool IsRange();
+ sal_Bool IsAction();
+ sal_Bool IsComment();
+
+ void ShowAction(sal_Bool bShow=sal_True);
+
+ void CheckDate(sal_Bool bFlag=sal_True);
+ void CheckAuthor(sal_Bool bFlag=sal_True);
+ void CheckRange(sal_Bool bFlag=sal_True);
+ void CheckAction(sal_Bool bFlag=sal_True);
+ void CheckComment(sal_Bool bFlag=sal_True);
+
+ ListBox* GetLbAction();
+
+ void SetReadyHdl( const Link& rLink ) { aReadyLink= rLink; }
+ const Link& GetReadyHdl() const { return aReadyLink; }
+
+ void SetModifyHdl( const Link& rLink ) { aModifyLink = rLink; }
+ const Link& GetModifyHdl() const { return aModifyLink; }
+
+ void SetModifyDateHdl( const Link& rLink ) { aModifyDateLink = rLink; }
+ const Link& GetModifyDateHdl() const { return aModifyDateLink; }
+
+ void SetModifyAuthorHdl( const Link& rLink ) { aModifyAuthorLink = rLink; }
+ const Link& GetModifyAuthorHdl() const { return aModifyAuthorLink; }
+
+ void SetModifyCommentHdl(const Link& rLink ) { aModifyComLink = rLink; }
+ const Link& GetModifyCommentHdl() const { return aModifyComLink; }
+
+
+ // Methoden fuer Calc {
+ void SetModifyRangeHdl( const Link& rLink ) { aModifyRefLink = rLink; }
+ const Link& GetModifyRangeHdl() const { return aModifyRefLink; }
+
+ void SetRefHdl( const Link& rLink ) { aRefLink = rLink; }
+ const Link& GetRefHdl() const { return aRefLink; }
+
+ void Enable( bool bEnable = true, bool bChild = true );
+ void Disable( bool bChild = true );
+
+ // } Methoden fuer Calc
+};
+
+
+//==================================================================
+// View- Tabpage
+//==================================================================
+
+class SVX_DLLPUBLIC SvxTPView: public TabPage
+{
+private:
+
+ Link AcceptClickLk;
+ Link AcceptAllClickLk;
+ Link RejectClickLk;
+ Link RejectAllClickLk;
+ Link UndoClickLk;
+
+ SvxRedlinTable aViewData;
+ PushButton PbAccept;
+ PushButton PbReject;
+ PushButton PbAcceptAll;
+ PushButton PbRejectAll;
+ PushButton PbUndo;
+ String aTitle1;
+ String aTitle2;
+ String aTitle3;
+ String aTitle4;
+ String aTitle5;
+ String aStrMyName;
+ long nDistance;
+ Size aMinSize;
+
+ DECL_LINK( PbClickHdl, PushButton* );
+
+
+protected:
+
+ void Resize();
+
+public:
+ SvxTPView( Window * pParent);
+
+ String GetMyName() const;
+
+ void InsertWriterHeader();
+ void InsertCalcHeader();
+ SvxRedlinTable* GetTableControl();
+
+ void EnableAccept(sal_Bool nFlag=sal_True);
+ void EnableAcceptAll(sal_Bool nFlag=sal_True);
+ void EnableReject(sal_Bool nFlag=sal_True);
+ void EnableRejectAll(sal_Bool nFlag=sal_True);
+ void EnableUndo(sal_Bool nFlag=sal_True);
+
+ void DisableAccept() {EnableAccept(sal_False);}
+ void DisableAcceptAll() {EnableAcceptAll(sal_False);}
+ void DisableReject() {EnableReject(sal_False);}
+ void DisableRejectAll() {EnableRejectAll(sal_False);}
+ void DisableUndo() {EnableUndo(sal_False);}
+
+ void ShowUndo(sal_Bool nFlag=sal_True);
+ void HideUndo() {ShowUndo(sal_False);}
+ sal_Bool IsUndoVisible();
+
+ Size GetMinSizePixel();
+
+ void SetAcceptClickHdl( const Link& rLink ) { AcceptClickLk = rLink; }
+ const Link& GetAcceptClickHdl() const { return AcceptClickLk; }
+
+ void SetAcceptAllClickHdl( const Link& rLink ) { AcceptAllClickLk = rLink; }
+ const Link& GetAcceptAllClickHdl() const { return AcceptAllClickLk; }
+
+ void SetRejectClickHdl( const Link& rLink ) { RejectClickLk = rLink; }
+ const Link& GetRejectClickHdl() const { return RejectClickLk; }
+
+ void SetRejectAllClickHdl( const Link& rLink ) { RejectAllClickLk = rLink; }
+ const Link& GetRejectAllClickHdl() const { return RejectAllClickLk; }
+
+ void SetUndoClickHdl( const Link& rLink ) { UndoClickLk = rLink; }
+ const Link& GetUndoAllClickHdl() const { return UndoClickLk; }
+};
+
+//==================================================================
+// Redlining - Control (Accept- Changes)
+//==================================================================
+
+class SVX_DLLPUBLIC SvxAcceptChgCtr : public Control
+{
+private:
+
+ Link aMinSizeLink;
+ TabControl aTCAccept;
+ SvxTPFilter* pTPFilter;
+ SvxTPView* pTPView;
+ Size aMinSize;
+
+protected:
+
+ virtual void Resize();
+
+public:
+ SvxAcceptChgCtr( Window* pParent, WinBits nWinStyle = 0 );
+ SvxAcceptChgCtr( Window* pParent, const ResId& rResId );
+
+ ~SvxAcceptChgCtr();
+
+ Size GetMinSizePixel() const;
+
+ void ShowFilterPage();
+ void ShowViewPage();
+
+ sal_Bool IsFilterPageVisible();
+ sal_Bool IsViewPageVisible();
+
+ SvxTPFilter* GetFilterPage();
+ SvxTPView* GetViewPage();
+ SvxRedlinTable* GetViewTable();
+
+ void SetMinSizeHdl( const Link& rLink ) { aMinSizeLink= rLink; }
+ const Link& GetMinSizeHdl() const { return aMinSizeLink; }
+};
+
+
+#endif // _SVX_CTREDLIN_HXX
+
diff --git a/svx/inc/svx/cube3d.hxx b/svx/inc/svx/cube3d.hxx
new file mode 100644
index 000000000000..a69a06ab721c
--- /dev/null
+++ b/svx/inc/svx/cube3d.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _E3D_CUBE3D_HXX
+#define _E3D_CUBE3D_HXX
+
+#include <svx/obj3d.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* |
+|* 3D-Quader erzeugen; aPos: Zentrum oder links, unten, hinten |__
+|* (abhaengig von bPosIsCenter) /
+|* Mit nSideFlags kann angegeben werden, ob nur ein Teil der
+|* Quaderflaechen erzeugt werden kann; die entsprechenden Bits
+|* sind in dem enum definiert. Das Flag bDblSided legt fest,
+|* ob die erzeugten Flaechen doppelseitig sind (nur sinnvoll,
+|* wenn nicht alle Flaechen erzeugt wurden).
+|*
+\************************************************************************/
+
+enum { CUBE_BOTTOM = 0x0001, CUBE_BACK = 0x0002, CUBE_LEFT = 0x0004,
+ CUBE_TOP = 0x0008, CUBE_RIGHT = 0x0010, CUBE_FRONT = 0x0020,
+ CUBE_FULL = 0x003F, CUBE_OPEN_TB = 0x0036, CUBE_OPEN_LR = 0x002B,
+ CUBE_OPEN_FB = 0x001D };
+
+class SVX_DLLPUBLIC E3dCubeObj : public E3dCompoundObject
+{
+private:
+ // Parameter
+ basegfx::B3DPoint aCubePos;
+ basegfx::B3DVector aCubeSize;
+ sal_uInt16 nSideFlags;
+
+ // BOOLeans
+ unsigned bPosIsCenter : 1;
+
+protected:
+ void SetDefaultAttributes(E3dDefaultAttributes& rDefault);
+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+
+public:
+ TYPEINFO();
+ E3dCubeObj(E3dDefaultAttributes& rDefault, basegfx::B3DPoint aPos, const basegfx::B3DVector& r3DSize);
+ E3dCubeObj();
+
+ virtual sal_uInt16 GetObjIdentifier() const;
+ virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const;
+
+ virtual void operator=(const SdrObject&);
+
+ // Lokale Parameter setzen mit Geometrieneuerzeugung
+ void SetCubePos(const basegfx::B3DPoint& rNew);
+ const basegfx::B3DPoint& GetCubePos() { return aCubePos; }
+
+ void SetCubeSize(const basegfx::B3DVector& rNew);
+ const basegfx::B3DVector& GetCubeSize() { return aCubeSize; }
+
+ void SetPosIsCenter(sal_Bool bNew);
+ sal_Bool GetPosIsCenter() { return (sal_Bool)bPosIsCenter; }
+
+ void SetSideFlags(sal_uInt16 nNew);
+ sal_uInt16 GetSideFlags() { return nSideFlags; }
+
+ // TakeObjName...() ist fuer die Anzeige in der UI, z.B. "3 Rahmen selektiert".
+ virtual void TakeObjNameSingul(String& rName) const;
+ virtual void TakeObjNamePlural(String& rName) const;
+};
+
+#endif // _E3D_CUBE3D_HXX
diff --git a/svx/inc/svx/dataaccessdescriptor.hxx b/svx/inc/svx/dataaccessdescriptor.hxx
new file mode 100644
index 000000000000..f765b1fce2b9
--- /dev/null
+++ b/svx/inc/svx/dataaccessdescriptor.hxx
@@ -0,0 +1,164 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_DATACCESSDESCRIPTOR_HXX_
+#define _SVX_DATACCESSDESCRIPTOR_HXX_
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "svx/svxdllapi.h"
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ class ODADescriptorImpl;
+
+ //====================================================================
+ //= DataAccessDescriptorProperty
+ //====================================================================
+ enum DataAccessDescriptorProperty
+ {
+ daDataSource, /// data source name (string)
+ daDatabaseLocation, /// database file URL (string)
+ daConnectionResource, /// database driver URL (string)
+ daConnection, /// connection (XConnection)
+
+ daCommand, /// command (string)
+ daCommandType, /// command type (long)
+ daEscapeProcessing, /// escape processing (boolean)
+ daFilter, /// additional filter (string)
+ daCursor, /// the cursor (XResultSet)
+
+ daColumnName, /// column name (string)
+ daColumnObject, /// column object (XPropertySet)
+
+ daSelection, /// selection (sequence< any >)
+ daBookmarkSelection, /// selection are bookmarks? (boolean)
+
+ daComponent /// component name (XContent)
+ };
+
+ //====================================================================
+ //= ODataAccessDescriptor
+ //====================================================================
+ /** class encapsulating the <type scope="com::sun::star::sdb">DataAccessDescriptor</type> service.
+ */
+ class SVX_DLLPUBLIC ODataAccessDescriptor
+ {
+ protected:
+ ODADescriptorImpl* m_pImpl;
+
+ public:
+ ODataAccessDescriptor();
+ ODataAccessDescriptor( const ODataAccessDescriptor& _rSource );
+ ODataAccessDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rValues );
+ ODataAccessDescriptor( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rValues );
+
+ // allows to construct a descriptor from an Any containing either an XPropertySet or a property value sequence
+ ODataAccessDescriptor( const ::com::sun::star::uno::Any& _rValues );
+
+ const ODataAccessDescriptor& operator=(const ODataAccessDescriptor& _rSource);
+
+ ~ODataAccessDescriptor();
+
+ /** returns the descriptor as property set
+ <p>If you call this method more than once, without writing any values between both calls, the same object
+ is returned. If you wrote values, a new object is returned.</p>
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ createPropertySet();
+ /** returns the descriptor as property value sequence
+ <p>If you call this method more than once, without writing any values between both calls, the same object
+ is returned. If you wrote values, a new object is returned.</p>
+ */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
+ createPropertyValueSequence();
+
+ /** returns the descriptor as Any sequence
+ <p>If you call this method more than once, without writing any values between both calls, the same object
+ is returned. If you wrote values, a new object is returned.</p>
+ */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+ createAnySequence();
+
+ /** initialized the descriptor from the property set given
+ <p>If <arg>_bClear</arg> is <TRUE/>, the descriptor will clear all it's current settings before
+ initializing with the new ones.</p>
+ */
+ void initializeFrom(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxValues,
+ sal_Bool _bClear = sal_True);
+
+ /** initialized the descriptor from the property values given
+ <p>If <arg>_bClear</arg> is <TRUE/>, the descriptor will clear all it's current settings before
+ initializing with the new ones.</p>
+ */
+ void initializeFrom(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rValues,
+ sal_Bool _bClear = sal_True);
+
+ /// checks whether or not a given property is present in the descriptor
+ sal_Bool has(DataAccessDescriptorProperty _eWhich) const;
+
+ /** erases the given property from the descriptor
+ */
+ void erase(DataAccessDescriptorProperty _eWhich);
+
+ /** empties the descriptor
+ */
+ void clear();
+
+ /// return the value of a given property
+ const ::com::sun::star::uno::Any& operator [] ( DataAccessDescriptorProperty _eWhich ) const;
+
+ /** return the (modifiable) value of a given property
+ <p>This operator is not allowed to be called if the descriptor is readonly.</p>
+ */
+ ::com::sun::star::uno::Any& operator [] ( DataAccessDescriptorProperty _eWhich );
+
+
+ /** returns either the data source name if given or the database location
+ */
+ ::rtl::OUString getDataSource() const;
+
+
+ /** set the data source name, if it is not file URL
+ @param _sDataSourceNameOrLocation
+ the data source name or database location
+ */
+ void setDataSource(const ::rtl::OUString& _sDataSourceNameOrLocation);
+ };
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+#endif // _SVX_DATACCESSDESCRIPTOR_HXX_
+
+
diff --git a/svx/inc/svx/databaselocationinput.hxx b/svx/inc/svx/databaselocationinput.hxx
new file mode 100644
index 000000000000..694a679bb7a9
--- /dev/null
+++ b/svx/inc/svx/databaselocationinput.hxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_DATABASELOCATIONINPUT_HXX
+#define SVX_DATABASELOCATIONINPUT_HXX
+
+#include "svx/svxdllapi.h"
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+class PushButton;
+class String;
+namespace svt { class OFileURLControl; }
+namespace comphelper { class ComponentContext; }
+
+#include <memory>
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ //====================================================================
+ //= DatabaseLocationInputController
+ //====================================================================
+ class DatabaseLocationInputController_Impl;
+ /** helper class to control controls needed to input a database location
+
+ If you allow, in your dialog, to save a database document, then you usually
+ have a OFileURLControl for inputting the actual location, and a push button
+ to browse for a location.
+
+ This helper class controls such two UI elements.
+ */
+ class SVX_DLLPUBLIC DatabaseLocationInputController
+ {
+ public:
+ DatabaseLocationInputController(
+ const ::comphelper::ComponentContext& _rContext,
+ ::svt::OFileURLControl& _rLocationInput,
+ PushButton& _rBrowseButton
+ );
+ ~DatabaseLocationInputController();
+
+ /** sets the given URL at the input control, after translating it into a system path
+ */
+ void setURL( const String& _rURL );
+
+ /** returns the current database location, in form of an URL (not a system path)
+ */
+ String getURL() const;
+
+ /** prepares committing the database location entered in the input field
+
+ Effectively, this method checks whether the file in the location already
+ exists, and if so, it asks the user whether to overwrite it.
+
+ If the method is called multiple times, this check only happens when the location
+ changed since the last call.
+ */
+ bool prepareCommit();
+
+ private:
+ ::std::auto_ptr< DatabaseLocationInputController_Impl >
+ m_pImpl;
+ };
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+#endif // SVX_DATABASELOCATIONINPUT_HXX
diff --git a/svx/inc/svx/databaseregistrationui.hxx b/svx/inc/svx/databaseregistrationui.hxx
new file mode 100644
index 000000000000..d168ed5b036b
--- /dev/null
+++ b/svx/inc/svx/databaseregistrationui.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_DATABASE_REGISTRATION_UI_HXX
+#define SVX_DATABASE_REGISTRATION_UI_HXX
+
+#include "svx/svxdllapi.h"
+#include <tools/solar.h>
+
+class Window;
+
+#define SID_SB_POOLING_ENABLED (RID_OFA_START + 247)
+#define SID_SB_DRIVER_TIMEOUTS (RID_OFA_START + 248)
+#define SID_SB_DB_REGISTER (RID_OFA_START + 249)
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ /** opens a dialog which allows the user to administrate the database registrations
+ */
+ sal_uInt16 SVX_DLLPUBLIC administrateDatabaseRegistration( Window* _parentWindow );
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+#endif // SVX_DATABASE_REGISTRATION_UI_HXX
diff --git a/svx/inc/svx/dbaexchange.hxx b/svx/inc/svx/dbaexchange.hxx
new file mode 100644
index 000000000000..a5a178f68389
--- /dev/null
+++ b/svx/inc/svx/dbaexchange.hxx
@@ -0,0 +1,299 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_DBAEXCHANGE_HXX_
+#define _SVX_DBAEXCHANGE_HXX_
+
+#include <svtools/transfer.hxx>
+#include <comphelper/stl_types.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <svx/dataaccessdescriptor.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include "svx/svxdllapi.h"
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+// column transfer formats
+#define CTF_FIELD_DESCRIPTOR 0x0001 // the field descriptor format
+#define CTF_CONTROL_EXCHANGE 0x0002 // the control exchange format
+#define CTF_COLUMN_DESCRIPTOR 0x0004 // data access descriptor for a column
+
+ //====================================================================
+ //= OColumnTransferable
+ //====================================================================
+ class SVX_DLLPUBLIC OColumnTransferable : public TransferableHelper
+ {
+ protected:
+ ODataAccessDescriptor m_aDescriptor;
+ ::rtl::OUString m_sCompatibleFormat;
+ sal_Int32 m_nFormatFlags;
+
+ public:
+ /** construct the transferable
+ */
+ OColumnTransferable(
+ const ::rtl::OUString& _rDatasource
+ ,const ::rtl::OUString& _rConnectionResource
+ ,const sal_Int32 _nCommandType
+ ,const ::rtl::OUString& _rCommand
+ ,const ::rtl::OUString& _rFieldName
+ ,sal_Int32 _nFormats
+ );
+
+ /** construct the transferable from a data access descriptor
+
+ Note that some of the aspects, in particular all which cannot be represented
+ as string, can only be transported via the CTF_COLUMN_DESCRIPTOR format.
+
+ @param _rDescriptor
+ The descriptor for the column. It must contain at least
+ <ul><li>information sufficient to create a connection, that is, either one of DataSource, DatabaseLocation,
+ ConnectionResource, and daConnection</li>
+ <li>a Command</li>
+ <li>a CommandType</li>
+ <li>a ColumnName or ColumnObject</li>
+ </ul>
+ */
+ OColumnTransferable(
+ const ODataAccessDescriptor& _rDescriptor,
+ sal_Int32 _nFormats
+ );
+
+ /** construct the transferable from a DatabaseForm component and a field name
+
+ @param _rxForm
+ the form which is bound to the data source which's field is to be dragged
+
+ @param _rFieldName
+ the name of the field to be dragged
+
+ @param _rxColumn
+ the column object. Won't be used if <arg>_nFormats</arg> does not include the CTF_COLUMN_DESCRIPTOR
+ flag.<br/>
+ May be <NULL/>.
+
+ @param _rxConnection
+ the connection the column belongs to. Won't be used if <arg>_nFormats</arg> does not include the CTF_COLUMN_DESCRIPTOR
+ flag.<br/>
+ May be <NULL/>.
+
+ @param _nFormats
+ supported formats. Must be a combination of the CTF_XXX flags
+ */
+ OColumnTransferable(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForm,
+ const ::rtl::OUString& _rFieldName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ sal_Int32 _nFormats
+ );
+
+ /** checks whether or not a column descriptor can be extracted from the data flavor vector given
+ @param _rFlavors
+ available flavors
+ @param _nFormats
+ formats to accept
+ */
+ static sal_Bool canExtractColumnDescriptor(const DataFlavorExVector& _rFlavors, sal_Int32 _nFormats);
+
+ /** extracts a column descriptor from the transferable given
+ */
+ static sal_Bool extractColumnDescriptor(
+ const TransferableDataHelper& _rData
+ ,::rtl::OUString& _rDatasource
+ ,::rtl::OUString& _rDatabaseLocation
+ ,::rtl::OUString& _rConnectionResource
+ ,sal_Int32& _nCommandType
+ ,::rtl::OUString& _rCommand
+ ,::rtl::OUString& _rFieldName
+ );
+
+ /** extracts a column descriptor from the transferable given
+ */
+ static ODataAccessDescriptor
+ extractColumnDescriptor(const TransferableDataHelper& _rData);
+
+ /** adds the data contained in the object to the given data container
+ <p>This method helps you treating this class as simple container class:<br/>
+ At the moment, it is a data container and a transferable.
+ Using <method>addDataToContainer</method>, you can treat the class as dumb data container,
+ doing the Drag'n'Drop with a <type>TransferDataContainer</type> instance (which may contain
+ additional formats)</p>
+ @TODO
+ split this class into a two separate classes: one for the data container aspect, one for
+ the transfer aspect
+ */
+ void addDataToContainer( TransferDataContainer* _pContainer );
+
+ protected:
+ // TransferableHelper overridables
+ virtual void AddSupportedFormats();
+ virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+
+ static sal_uInt32 getDescriptorFormatId();
+
+ private:
+ SVX_DLLPRIVATE void implConstruct(
+ const ::rtl::OUString& _rDatasource
+ ,const ::rtl::OUString& _rConnectionResource
+ ,const sal_Int32 _nCommandType
+ ,const ::rtl::OUString& _rCommand
+ ,const ::rtl::OUString& _rFieldName
+ );
+ };
+
+ //====================================================================
+ //= ODataAccessObjectTransferable
+ //====================================================================
+ /** class for transfering data access objects (tables, queries, statements ...)
+ */
+ class SVX_DLLPUBLIC ODataAccessObjectTransferable : public TransferableHelper
+ {
+ ODataAccessDescriptor m_aDescriptor;
+ ::rtl::OUString m_sCompatibleObjectDescription;
+ // needed to provide a SOT_FORMATSTR_ID_SBA_DATAEXCHANGE format
+
+ public:
+ /** should be used copying and the connection is needed.
+ @param _rDatasource
+ The data source name.
+ @param _nCommandType
+ The kind of command. @see com.sun.star.sdbc.CommandType
+ @param _rCommand
+ The command, either a name of a table or query or a SQL statement.
+ */
+ ODataAccessObjectTransferable(
+ const ::rtl::OUString& _rDatasourceOrLocation
+ ,const ::rtl::OUString& _rConnectionResource
+ ,const sal_Int32 _nCommandType
+ ,const ::rtl::OUString& _rCommand
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection
+ );
+
+ /** should be used when copying a query object and no connection is available.
+ @param _rDatasource
+ The data source name.
+ @param _nCommandType
+ The kind of command. @see com.sun.star.sdbc.CommandType
+ @param _rCommand
+ The command, either a name of a table or query or a SQL statement.
+ */
+ ODataAccessObjectTransferable(
+ const ::rtl::OUString& _rDatasourceOrLocation
+ ,const ::rtl::OUString& _rConnectionResource
+ ,const sal_Int32 _nCommandType
+ ,const ::rtl::OUString& _rCommand
+ );
+
+ /** with this ctor, only the object descriptor format will be provided
+ */
+ ODataAccessObjectTransferable(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxLivingForm
+ );
+
+ /** checks whether or not an object descriptor can be extracted from the data flavor vector given
+ @param _rFlavors
+ available flavors
+ @param _nFormats
+ formats to accept
+ */
+ static sal_Bool canExtractObjectDescriptor(const DataFlavorExVector& _rFlavors);
+
+ /** extracts a object descriptor from the transferable given
+ */
+ static ODataAccessDescriptor
+ extractObjectDescriptor(const TransferableDataHelper& _rData);
+
+ protected:
+ virtual void AddSupportedFormats();
+ virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ virtual void ObjectReleased();
+
+ protected:
+ const ODataAccessDescriptor& getDescriptor() const { return m_aDescriptor; }
+ ODataAccessDescriptor& getDescriptor() { return m_aDescriptor; }
+ protected:
+ void addCompatibleSelectionDescription(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rSelRows
+ );
+ // normally, a derived class could simply access getDescriptor[daSelection] and place the sequence therein
+ // but unfortunately, we have this damned compatible format, and this can't be accessed in
+ // derived classes (our class is the only one which should be contaminated with this)
+
+ private:
+ SVX_DLLPRIVATE void construct( const ::rtl::OUString& _rDatasourceOrLocation
+ ,const ::rtl::OUString& _rConnectionResource
+ ,const sal_Int32 _nCommandType
+ ,const ::rtl::OUString& _rCommand
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection
+ ,sal_Bool _bAddCommand
+ ,const ::rtl::OUString& _sActiveCommand);
+ };
+
+ //====================================================================
+ //= OMultiColumnTransferable
+ //====================================================================
+ /** class for transfering multiple columns
+ */
+ class SVX_DLLPUBLIC OMultiColumnTransferable : public TransferableHelper
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_aDescriptors;
+
+ public:
+ OMultiColumnTransferable(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _aDescriptors);
+
+ void push_back(ODataAccessDescriptor& _aDescriptor);
+
+ /** checks whether or not an object descriptor can be extracted from the data flavor vector given
+ @param _rFlavors
+ available flavors
+ @param _nFormats
+ formats to accept
+ */
+ static sal_Bool canExtractDescriptor(const DataFlavorExVector& _rFlavors);
+
+ /** extracts a object descriptor from the transferable given
+ */
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > extractDescriptor(const TransferableDataHelper& _rData);
+
+ protected:
+ virtual void AddSupportedFormats();
+ virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ virtual void ObjectReleased();
+ static sal_uInt32 getDescriptorFormatId();
+ };
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+#endif // _SVX_DBAEXCHANGE_HXX_
+
diff --git a/svx/inc/svx/dbaobjectex.hxx b/svx/inc/svx/dbaobjectex.hxx
new file mode 100644
index 000000000000..a1c7867e0a5d
--- /dev/null
+++ b/svx/inc/svx/dbaobjectex.hxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_DBAOBJECTEX_HXX
+#define SVX_DBAOBJECTEX_HXX
+
+#include <svtools/transfer.hxx>
+#include <comphelper/stl_types.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/ucb/XContent.hpp>
+#include <svx/dataaccessdescriptor.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include "svx/svxdllapi.h"
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ //====================================================================
+ //= OComponentTransferable
+ //====================================================================
+ class SVX_DLLPUBLIC OComponentTransferable : public TransferableHelper
+ {
+ protected:
+ ODataAccessDescriptor m_aDescriptor;
+
+ public:
+ /** construct the transferable
+ */
+ OComponentTransferable(
+ const ::rtl::OUString& _rDatasourceOrLocation
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent>& _xContent
+ );
+
+ /** checks whether or not a component descriptor can be extracted from the data flavor vector given
+ @param _rFlavors
+ available flavors
+ */
+ static sal_Bool canExtractComponentDescriptor(const DataFlavorExVector& _rFlavors,sal_Bool _bForm );
+
+ /** extracts a component descriptor from the transferable given
+ */
+ static sal_Bool extractComponentDescriptor(
+ const TransferableDataHelper& _rData
+ ,sal_Bool _bExtractForm
+ ,::rtl::OUString& _rDatasourceOrLocation
+ ,::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent>& _xContent
+ );
+
+ /** extracts a component descriptor from the transferable given
+ */
+ static ODataAccessDescriptor
+ extractComponentDescriptor(const TransferableDataHelper& _rData);
+
+ protected:
+ // TransferableHelper overridables
+ virtual void AddSupportedFormats();
+ virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+
+ static sal_uInt32 getDescriptorFormatId(sal_Bool _bExtractForm);
+ };
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+#endif // SVX_DBAOBJECTEX_HXX
+
diff --git a/svx/inc/svx/dbcharsethelper.hxx b/svx/inc/svx/dbcharsethelper.hxx
new file mode 100755
index 000000000000..40ec31c37d85
--- /dev/null
+++ b/svx/inc/svx/dbcharsethelper.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_DBCHARSETHELPER_HXX
+#define SVX_DBCHARSETHELPER_HXX
+#include "svx/svxdllapi.h"
+#include "svx/dbtoolsclient.hxx"
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ //====================================================================
+ //= ODataAccessCharsetHelper
+ //====================================================================
+ class SVX_DLLPUBLIC ODataAccessCharsetHelper : public ODbtoolsClient
+ {
+ protected:
+ mutable ::rtl::Reference< ::connectivity::simple::IDataAccessCharSet > m_xCharsetHelper;
+
+ protected:
+ virtual bool ensureLoaded() const;
+
+ public:
+ ODataAccessCharsetHelper( );
+
+ inline sal_Int32 getSupportedTextEncodings( ::std::vector< rtl_TextEncoding >& _rEncs ) const
+ {
+ if ( ensureLoaded() )
+ return m_xCharsetHelper->getSupportedTextEncodings( _rEncs );
+ return 0;
+ }
+ };
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
+#endif // SVX_DBCHARSETCLIENT_HXX
+
+
diff --git a/svx/inc/svx/dbexch.hrc b/svx/inc/svx/dbexch.hrc
new file mode 100644
index 000000000000..faa2274987cd
--- /dev/null
+++ b/svx/inc/svx/dbexch.hrc
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_DBEXCH_HRC
+#define _SVX_DBEXCH_HRC
+
+// Format zum Uebertragen von Daten aus dem DatenbankBrowser
+// Format: "Datenbankname";"Tabellen/QueryName"; 1/0(fuer Tabelle/Abfrage); SQL-Statement;Selektionsliste
+// Name der Tabelle kann leer sein
+// Feldtrenner ist "ASCII 11" !!!!
+// Selektionsliste:"" // alle selektiert
+// | "1;2;...n" // Selektierte Saetze, Start bei 1
+#define SBA_DATAEXCHANGE_FORMAT "SBA-DATAFORMAT"
+
+// Feldtrenner ist "ASCII 11" !!!!
+// Format zum Uebertragen von Feldname aus dem DatenbankBrowser
+// "Datenbankname";"Tabellen/QueryName";0(Tabelle) / 1(Abfrage) / 2(SQL) / 3(NATIVE_SQL);"Feldname"
+#define SBA_FIELDEXCHANGE_FORMAT "SBA-FIELDFORMAT"
+
+// Feldtrenner ist "ASCII 11" !!!!
+// Format zum Uebertragen von Feldinhalten aus dem DatenbankBrowser
+// "Datenbankname";"Tabellen/QueryName";1/0(fuer Tabelle/Abfrage);"Feldname";"FeldInhalt"
+#define SBA_FIELDDATAEXCHANGE_FORMAT "SBA-FIELDDATAFORMAT"
+
+// Office-internes Format (entspricht der private-URL )
+// Wird vom Writer und Calc benutzt, wenn Explorer-Contents gedraggt werden
+#define SBA_PRIVATEURL_EXCHANGE_FORMAT "SBA-PRIVATEURLFORMAT"
+
+// SBA-internes Format fuer das erzeugen von Joins in der RelationsShell
+#define SBA_JOIN_EXCHANGE_FORMAT "SBA-JOINFORMAT"
+
+
+#endif // _SVX_DBEXCH_HRC
+
diff --git a/svx/inc/svx/dbtoolsclient.hxx b/svx/inc/svx/dbtoolsclient.hxx
new file mode 100755
index 000000000000..7df0dd5c38cb
--- /dev/null
+++ b/svx/inc/svx/dbtoolsclient.hxx
@@ -0,0 +1,235 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_DBTOOLSCLIENT_HXX
+#define SVX_DBTOOLSCLIENT_HXX
+
+#include <connectivity/virtualdbtools.hxx>
+#include <osl/mutex.hxx>
+#include <osl/module.h>
+#include <tools/solar.h>
+#include <unotools/sharedunocomponent.hxx>
+#include "svx/svxdllapi.h"
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ typedef ::utl::SharedUNOComponent< ::com::sun::star::sdbc::XConnection > SharedConnection;
+
+ //====================================================================
+ //= ODbtoolsClient
+ //====================================================================
+ /** base class for classes which want to use dbtools features with load-on-call
+ of the dbtools lib.
+ */
+ class SVX_DLLPUBLIC ODbtoolsClient
+ {
+ private:
+ static ::osl::Mutex s_aMutex;
+ static sal_Int32 s_nClients;
+ static oslModule s_hDbtoolsModule;
+ static ::connectivity::simple::createDataAccessToolsFactoryFunction
+ s_pFactoryCreationFunc;
+ //add by BerryJia for fixing Bug97420 Time:2002-9-12-11:00(PRC time)
+ mutable sal_Bool m_bCreateAlready;
+
+ private:
+ mutable ::rtl::Reference< ::connectivity::simple::IDataAccessToolsFactory > m_xDataAccessFactory;
+
+ protected:
+ ODbtoolsClient();
+ virtual ~ODbtoolsClient();
+
+ virtual bool ensureLoaded() const;
+
+ protected:
+ const ::rtl::Reference< ::connectivity::simple::IDataAccessToolsFactory >&
+ getFactory() const { return m_xDataAccessFactory; }
+
+ private:
+ static void registerClient();
+ static void revokeClient();
+ };
+
+ //====================================================================
+ //= OStaticDataAccessTools
+ //====================================================================
+ class SVX_DLLPUBLIC OStaticDataAccessTools : public ODbtoolsClient
+ {
+ protected:
+ mutable ::rtl::Reference< ::connectivity::simple::IDataAccessTools > m_xDataAccessTools;
+
+ protected:
+ virtual bool ensureLoaded() const;
+
+ public:
+ OStaticDataAccessTools();
+
+ const ::rtl::Reference< ::connectivity::simple::IDataAccessTools >& getDataAccessTools() const { return m_xDataAccessTools; }
+
+ // ------------------------------------------------
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> getNumberFormats(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _rxConn,
+ sal_Bool _bAllowDefault
+ ) const;
+
+ // ------------------------------------------------
+ sal_Int32 getDefaultNumberFormat(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatTypes >& _xTypes,
+ const ::com::sun::star::lang::Locale& _rLocale );
+
+ // ------------------------------------------------
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection_withFeedback(
+ const ::rtl::OUString& _rDataSourceName,
+ const ::rtl::OUString& _rUser,
+ const ::rtl::OUString& _rPwd,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory
+ ) const SAL_THROW ( (::com::sun::star::sdbc::SQLException) );
+
+ // ------------------------------------------------
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> connectRowset(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory,
+ sal_Bool _bSetAsActiveConnection
+ ) const SAL_THROW ( ( ::com::sun::star::sdbc::SQLException
+ , ::com::sun::star::lang::WrappedTargetException
+ , ::com::sun::star::uno::RuntimeException) );
+
+ // ------------------------------------------------
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getRowSetConnection(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet)
+ const SAL_THROW ( (::com::sun::star::uno::RuntimeException) );
+
+ // ------------------------------------------------
+ void TransferFormComponentProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxOld,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxNew,
+ const ::com::sun::star::lang::Locale& _rLocale
+ ) const;
+
+ // ------------------------------------------------
+ ::rtl::OUString quoteName(
+ const ::rtl::OUString& _rQuote,
+ const ::rtl::OUString& _rName
+ ) const;
+
+ // ------------------------------------------------
+ ::rtl::OUString composeTableNameForSelect(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xTable
+ ) const;
+
+ // ------------------------------------------------
+ ::com::sun::star::sdb::SQLContext prependContextInfo(
+ ::com::sun::star::sdbc::SQLException& _rException,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const ::rtl::OUString& _rContextDescription,
+ const ::rtl::OUString& _rContextDetails
+ ) const;
+
+ // ------------------------------------------------
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource > getDataSource(
+ const ::rtl::OUString& _rsRegisteredName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory
+ ) const;
+
+ // ------------------------------------------------
+ /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::INSERT
+ @param _rxCursorSet the property set
+ */
+ sal_Bool canInsert(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const;
+
+ // ------------------------------------------------
+ /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::UPDATE
+ @param _rxCursorSet the property set
+ */
+ sal_Bool canUpdate(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const;
+
+ // ------------------------------------------------
+ /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::DELETE
+ @param _rxCursorSet the property set
+ */
+ sal_Bool canDelete(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const;
+
+ // ------------------------------------------------
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
+ getFieldsByCommandDescriptor(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const sal_Int32 _nCommandType,
+ const ::rtl::OUString& _rCommand,
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _rxKeepFieldsAlive,
+ ::dbtools::SQLExceptionInfo* _pErrorInfo = NULL
+ ) SAL_THROW( ( ) );
+
+ // ------------------------------------------------
+ ::com::sun::star::uno::Sequence< ::rtl::OUString >
+ getFieldNamesByCommandDescriptor(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const sal_Int32 _nCommandType,
+ const ::rtl::OUString& _rCommand,
+ ::dbtools::SQLExceptionInfo* _pErrorInfo = NULL
+ ) SAL_THROW( ( ) );
+
+ // ------------------------------------------------
+ bool isEmbeddedInDatabase(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent,
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxActualConnection
+ );
+
+ // ------------------------------------------------
+ bool isEmbeddedInDatabase(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent
+ );
+ };
+
+ //====================================================================
+ //= DBToolsObjectFactory
+ //====================================================================
+ class SVX_DLLPUBLIC DBToolsObjectFactory : public ODbtoolsClient
+ {
+ public:
+ DBToolsObjectFactory();
+ ~DBToolsObjectFactory();
+
+ // ------------------------------------------------
+ ::std::auto_ptr< ::dbtools::FormattedColumnValue > createFormattedColumnValue(
+ const ::comphelper::ComponentContext& _rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& _rxRowSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn
+ );
+ };
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
+#endif // SVX_DBTOOLSCLIENT_HXX
+
+
diff --git a/svx/inc/svx/def3d.hxx b/svx/inc/svx/def3d.hxx
new file mode 100644
index 000000000000..57f68cd7805b
--- /dev/null
+++ b/svx/inc/svx/def3d.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_DEF3D_HXX
+#define _SVX_DEF3D_HXX
+
+#ifndef _INC_MATH
+#include <math.h>
+#endif
+#include <tools/solar.h>
+
+const double fPiDiv180 = 0.01745329251994;
+const double EPSILON = 1e-06;
+
+#define DEG2RAD(fAngle) (fPiDiv180 * (fAngle))
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+++ 3D-Hilfsfunktionen +++++++++++++++++++++++++++++++++++++++++++++++++
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+enum E3dDragConstraint { E3DDRAG_CONSTR_X = 0x0001,
+ E3DDRAG_CONSTR_Y = 0x0002,
+ E3DDRAG_CONSTR_Z = 0x0004,
+ E3DDRAG_CONSTR_XY = 0x0003,
+ E3DDRAG_CONSTR_XZ = 0x0005,
+ E3DDRAG_CONSTR_YZ = 0x0006,
+ E3DDRAG_CONSTR_XYZ = 0x0007
+};
+
+#endif
diff --git a/svx/inc/svx/deflt3d.hxx b/svx/inc/svx/deflt3d.hxx
new file mode 100644
index 000000000000..c09cbafd8e1f
--- /dev/null
+++ b/svx/inc/svx/deflt3d.hxx
@@ -0,0 +1,135 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _E3D_DEFLT3D_HXX
+#define _E3D_DEFLT3D_HXX
+
+#include <basegfx/point/b3dpoint.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+#include "svx/svxdllapi.h"
+#include <tools/color.hxx>
+
+/*************************************************************************
+|*
+|* Klasse zum verwalten der 3D-Default Attribute
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC E3dDefaultAttributes
+{
+private:
+ // Compound-Objekt
+ Color aDefaultAmbientColor;
+ sal_Bool bDefaultCreateNormals;
+ sal_Bool bDefaultCreateTexture;
+
+ // Cube-Objekt
+ basegfx::B3DPoint aDefaultCubePos;
+ basegfx::B3DVector aDefaultCubeSize;
+ sal_uInt16 nDefaultCubeSideFlags;
+ sal_Bool bDefaultCubePosIsCenter;
+
+ // Sphere-Objekt
+ basegfx::B3DPoint aDefaultSphereCenter;
+ basegfx::B3DVector aDefaultSphereSize;
+
+ // Lathe-Objekt
+ long nDefaultLatheEndAngle;
+ sal_Bool bDefaultLatheSmoothed;
+ sal_Bool bDefaultLatheSmoothFrontBack;
+ sal_Bool bDefaultLatheCharacterMode;
+ sal_Bool bDefaultLatheCloseFront;
+ sal_Bool bDefaultLatheCloseBack;
+
+ // Extrude-Objekt
+ sal_Bool bDefaultExtrudeSmoothed;
+ sal_Bool bDefaultExtrudeSmoothFrontBack;
+ sal_Bool bDefaultExtrudeCharacterMode;
+ sal_Bool bDefaultExtrudeCloseFront;
+ sal_Bool bDefaultExtrudeCloseBack;
+
+public:
+ // Konstruktor
+ E3dDefaultAttributes();
+
+ // Defaults zuruecksetzen
+ void Reset();
+
+ // Getter/Setter fuer Default-Werte aller 3D-Objekte
+ // Compound-Objekt
+ const Color& GetDefaultAmbientColor() { return aDefaultAmbientColor; }
+ void SetDefaultAmbientColor(const Color& rNew) { aDefaultAmbientColor = rNew; }
+
+ sal_Bool GetDefaultCreateNormals() const { return bDefaultCreateNormals; }
+ void SetDefaultCreateNormals(const sal_Bool bNew) { bDefaultCreateNormals = bNew; }
+ sal_Bool GetDefaultCreateTexture() const { return bDefaultCreateTexture; }
+ void SetDefaultCreateTexture(const sal_Bool bNew) { bDefaultCreateTexture = bNew; }
+
+ // Cube-Objekt
+ const basegfx::B3DPoint& GetDefaultCubePos() { return aDefaultCubePos; }
+ void SetDefaultCubePos(const basegfx::B3DPoint& rNew) { aDefaultCubePos = rNew; }
+ const basegfx::B3DVector& GetDefaultCubeSize() { return aDefaultCubeSize; }
+ void SetDefaultCubeSize(const basegfx::B3DVector& rNew) { aDefaultCubeSize = rNew; }
+ sal_uInt16 GetDefaultCubeSideFlags() const { return nDefaultCubeSideFlags; }
+ void SetDefaultCubeSideFlags(const sal_uInt16 nNew) { nDefaultCubeSideFlags = nNew; }
+ sal_Bool GetDefaultCubePosIsCenter() const { return bDefaultCubePosIsCenter; }
+ void SetDefaultCubePosIsCenter(const sal_Bool bNew) { bDefaultCubePosIsCenter = bNew; }
+
+ // Sphere-Objekt
+ const basegfx::B3DPoint& GetDefaultSphereCenter() { return aDefaultSphereCenter; }
+ void SetDefaultSphereCenter(const basegfx::B3DPoint& rNew) { aDefaultSphereCenter = rNew; }
+ const basegfx::B3DVector& GetDefaultSphereSize() { return aDefaultSphereSize; }
+ void SetDefaultSphereSize(const basegfx::B3DPoint& rNew) { aDefaultSphereSize = rNew; }
+
+ // Lathe-Objekt
+ long GetDefaultLatheEndAngle() const { return nDefaultLatheEndAngle; }
+ void SetDefaultLatheEndAngle(const long nNew) { nDefaultLatheEndAngle = nNew; }
+ sal_Bool GetDefaultLatheSmoothed() const { return bDefaultLatheSmoothed; }
+ void SetDefaultLatheSmoothed(const sal_Bool bNew) { bDefaultLatheSmoothed = bNew; }
+ sal_Bool GetDefaultLatheSmoothFrontBack() const { return bDefaultLatheSmoothFrontBack; }
+ void SetDefaultLatheSmoothFrontBack(const sal_Bool bNew) { bDefaultLatheSmoothFrontBack = bNew; }
+ sal_Bool GetDefaultLatheCharacterMode() const { return bDefaultLatheCharacterMode; }
+ void SetDefaultLatheCharacterMode(const sal_Bool bNew) { bDefaultLatheCharacterMode = bNew; }
+ sal_Bool GetDefaultLatheCloseFront() const { return bDefaultLatheCloseFront; }
+ void SetDefaultLatheCloseFront(const sal_Bool bNew) { bDefaultLatheCloseFront = bNew; }
+ sal_Bool GetDefaultLatheCloseBack() const { return bDefaultLatheCloseBack; }
+ void SetDefaultLatheCloseBack(const sal_Bool bNew) { bDefaultLatheCloseBack = bNew; }
+
+ // Extrude-Objekt
+ sal_Bool GetDefaultExtrudeSmoothed() const { return bDefaultExtrudeSmoothed; }
+ void SetDefaultExtrudeSmoothed(const sal_Bool bNew) { bDefaultExtrudeSmoothed = bNew; }
+ sal_Bool GetDefaultExtrudeSmoothFrontBack() const { return bDefaultExtrudeSmoothFrontBack; }
+ void SetDefaultExtrudeSmoothFrontBack(const sal_Bool bNew) { bDefaultExtrudeSmoothFrontBack = bNew; }
+ sal_Bool GetDefaultExtrudeCharacterMode() const { return bDefaultExtrudeCharacterMode; }
+ void SetDefaultExtrudeCharacterMode(const sal_Bool bNew) { bDefaultExtrudeCharacterMode = bNew; }
+ sal_Bool GetDefaultExtrudeCloseFront() const { return bDefaultExtrudeCloseFront; }
+ void SetDefaultExtrudeCloseFront(const sal_Bool bNew) { bDefaultExtrudeCloseFront = bNew; }
+ sal_Bool GetDefaultExtrudeCloseBack() const { return bDefaultExtrudeCloseBack; }
+ void SetDefaultExtrudeCloseBack(const sal_Bool bNew) { bDefaultExtrudeCloseBack = bNew; }
+};
+
+#endif // _E3D_DEFLT3D_HXX
diff --git a/svx/inc/svx/dialcontrol.hxx b/svx/inc/svx/dialcontrol.hxx
new file mode 100644
index 000000000000..3b63ac1f4b4d
--- /dev/null
+++ b/svx/inc/svx/dialcontrol.hxx
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_DIALCONTROL_HXX
+#define SVX_DIALCONTROL_HXX
+
+#include <memory>
+#include <vcl/ctrl.hxx>
+#include <sfx2/itemconnect.hxx>
+#include "svx/svxdllapi.h"
+
+class NumericField;
+
+namespace svx {
+
+// ============================================================================
+
+struct DialControl_Impl;
+
+/** This control allows to input a rotation angle, visualized by a dial.
+
+ Usage: A single click sets a rotation angle rounded to steps of 15 degrees.
+ Dragging with the left mouse button sets an exact rotation angle. Pressing
+ the ESCAPE key during mouse drag cancels the operation and restores the old
+ state of the control.
+
+ It is possible to link a numeric field to this control using the function
+ SetLinkedField(). The DialControl will take full control of this numeric
+ field:
+ - Sets the rotation angle to the numeric field in mouse operations.
+ - Shows the value entered/modified in the numeric field.
+ - Enables/disables/shows/hides the field according to own state changes.
+ */
+class SVX_DLLPUBLIC DialControl : public Control
+{
+public:
+ explicit DialControl( Window* pParent, const Size& rSize, const Font& rFont, WinBits nWinStyle = 0 );
+ explicit DialControl( Window* pParent, const Size& rSize, WinBits nWinStyle = 0 );
+ explicit DialControl( Window* pParent, const ResId& rResId );
+ virtual ~DialControl();
+
+ virtual void Paint( const Rectangle& rRect );
+
+ virtual void StateChanged( StateChangedType nStateChange );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void LoseFocus();
+
+ /** Returns true, if the control is not in "don't care" state. */
+ bool HasRotation() const;
+ /** Sets the control to "don't care" state. */
+ void SetNoRotation();
+
+ /** Returns the current rotation angle in 1/100 degrees. */
+ sal_Int32 GetRotation() const;
+ /** Sets the rotation to the passed value (in 1/100 degrees). */
+ void SetRotation( sal_Int32 nAngle );
+
+ /** Links the passed numeric edit field to the control (bi-directional). */
+ void SetLinkedField( NumericField* pField );
+ /** Returns the linked numeric edit field, or 0. */
+ NumericField* GetLinkedField() const;
+
+ /** The passed handler is called whenever the totation value changes. */
+ void SetModifyHdl( const Link& rLink );
+ /** Returns the current modify handler. */
+ const Link& GetModifyHdl() const;
+
+private:
+ void Init( const Size& rWinSize, const Font& rWinFont );
+ void Init( const Size& rWinSize );
+ void InvalidateControl();
+
+ void ImplSetRotation( sal_Int32 nAngle, bool bBroadcast );
+ void ImplSetFieldLink( const Link& rLink );
+
+ void HandleMouseEvent( const Point& rPos, bool bInitial );
+ void HandleEscapeEvent();
+
+ DECL_LINK( LinkedFieldModifyHdl, NumericField* );
+
+ std::auto_ptr< DialControl_Impl > mpImpl;
+};
+
+// ============================================================================
+
+/** Wrapper for usage of a DialControl in item connections. */
+class SVX_DLLPUBLIC DialControlWrapper : public sfx::SingleControlWrapper< DialControl, sal_Int32 >
+{
+public:
+ explicit DialControlWrapper( DialControl& rDial );
+
+ virtual bool IsControlDontKnow() const;
+ virtual void SetControlDontKnow( bool bSet );
+
+ virtual sal_Int32 GetControlValue() const;
+ virtual void SetControlValue( sal_Int32 nValue );
+};
+
+// ----------------------------------------------------------------------------
+
+/** An item<->control connection for a DialControl. */
+typedef sfx::ItemControlConnection< sfx::Int32ItemWrapper, DialControlWrapper > DialControlConnection;
+
+// ============================================================================
+
+} // namespace svx
+
+#endif
+
diff --git a/svx/inc/svx/dialmgr.hxx b/svx/inc/svx/dialmgr.hxx
new file mode 100644
index 000000000000..8c29edc04620
--- /dev/null
+++ b/svx/inc/svx/dialmgr.hxx
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_DIALMGR_HXX
+#define _SVX_DIALMGR_HXX
+
+// include ---------------------------------------------------------------
+
+#include <tools/resid.hxx>
+#include "svx/svxdllapi.h"
+
+// forward ---------------------------------------------------------------
+
+class ResMgr;
+struct SVX_DLLPUBLIC DialogsResMgr
+{
+ static ResMgr* GetResMgr();
+};
+
+#define DIALOG_MGR() (*DialogsResMgr::GetResMgr())
+#define SVX_RES(i) ResId(i,DIALOG_MGR())
+#define SVX_RESSTR(i) UniString(ResId(i,DIALOG_MGR()))
+#define SVX_RESSSTR(i) String(ResId(i,DIALOG_MGR()))
+
+#endif
+
diff --git a/svx/inc/svx/dialogs.hrc b/svx/inc/svx/dialogs.hrc
new file mode 100755
index 000000000000..b28b150bd487
--- /dev/null
+++ b/svx/inc/svx/dialogs.hrc
@@ -0,0 +1,1053 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_DIALOGS_HRC
+#define _SVX_DIALOGS_HRC
+
+// include ------------------------------------------------------------------
+
+#include <svx/svxids.hrc>
+#include <sfx2/dialogs.hrc>
+
+// Resource-Id's ------------------------------------------------------------
+
+// Bitte FIRSTFREE pflegen!!! (gilt nicht f"ur Strings)
+#define RID_SVX_FIRSTFREE 305
+
+// some strings also used in CUI
+#define RID_SVXERRCTX (RID_SVX_START + 351)
+#define RID_SVXSTR_COLOR (RID_SVX_START + 179)
+#define RID_SVXSTR_TRANSPARENT (RID_SVX_START + 190)
+#define RID_SVXSTR_AUTOMATIC (RID_SVX_START + 841)
+#define RID_SVXSTR_INVISIBLE (RID_SVX_START + 178)
+#define RID_SVXSTR_NONE (RID_SVX_START + 183)
+#define RID_SVXSTR_SOLID (RID_SVX_START + 160)
+#define RID_SVXSTR_LINEEND (RID_SVX_START + 237)
+#define RID_SVXSTR_GRADIENT (RID_SVX_START + 161)
+#define RID_SVXSTR_HATCH (RID_SVX_START + 180)
+#define RID_SVXSTR_BITMAP (RID_SVX_START + 167)
+#define RID_SVXSTR_LINESTYLE (RID_SVX_START + 173)
+#define RID_SVXSTR_FIELDUNIT_TABLE (RID_SVX_START + 311)
+#define RID_SVXSTR_COLOR_USER (RID_SVX_START + 250)
+
+// factory IDs of tabpages implemented in CUI
+#define RID_SVXPAGE_CHAR_TWOLINES (RID_SVX_START + 242)
+#define RID_SVXPAGE_EXT_PARAGRAPH (RID_SVX_START + 7)
+#define RID_SVXPAGE_GRFCROP (RID_SVX_START + 238)
+#define RID_SVXPAGE_CHAR_NAME (RID_SVX_START + 239)
+#define RID_SVXPAGE_CHAR_EFFECTS (RID_SVX_START + 240)
+#define RID_SVXPAGE_CHAR_POSITION (RID_SVX_START + 241)
+#define RID_SVXPAGE_STD_PARAGRAPH (RID_SVX_START + 6)
+#define RID_SVXPAGE_ALIGN_PARAGRAPH (RID_SVX_START + 187)
+#define RID_SVXPAGE_PARA_ASIAN (RID_SVX_START + 245)
+#define RID_SVXPAGE_TABULATOR (RID_SVX_START + 2)
+#define RID_SFXPAGE_DBREGISTER (RID_OFA_START + 123)
+#define RID_SVXPAGE_NUMBERFORMAT (RID_SVX_START + 41)
+#define RID_SVXPAGE_ALIGNMENT (RID_SVX_START + 90)
+#define RID_SVXPAGE_BORDER (RID_SVX_START + 5)
+#define RID_SVXPAGE_BACKGROUND (RID_SVX_START + 1)
+#define RID_SVXPAGE_PAGE (RID_SVX_START + 25)
+#define RID_SVXPAGE_LINE (RID_SVX_START + 51)
+#define RID_SVXPAGE_AREA (RID_SVX_START + 56)
+#define RID_SVXPAGE_SHADOW (RID_SVX_START + 61)
+#define RID_SVXPAGE_TRANSPARENCE (RID_SVX_START + 54)
+#define RID_SVXPAGE_TEXTATTR (RID_SVX_START + 153)
+#define RID_SVXPAGE_TEXTANIMATION (RID_SVX_START + 184)
+#define RID_SVXPAGE_MEASURE (RID_SVX_START + 161)
+#define RID_SVXPAGE_CONNECTION (RID_SVX_START + 191)
+#define RID_SVXPAGE_LINE_DEF (RID_SVX_START + 52)
+#define RID_SVXPAGE_LINEEND_DEF (RID_SVX_START + 53)
+#define RID_SVXPAGE_NUM_OPTIONS (RID_SVX_START + 219)
+#define RID_SVXPAGE_NUM_POSITION (RID_SVX_START + 220)
+#define RID_SVXPAGE_PICK_SINGLE_NUM (RID_SVX_START + 215)
+#define RID_SVXPAGE_PICK_BULLET (RID_SVX_START + 216)
+#define RID_SVXPAGE_PICK_NUM (RID_SVX_START + 217)
+#define RID_SVXPAGE_PICK_BMP (RID_SVX_START + 218)
+#define RID_SVXPAGE_CAPTION (RID_SVX_START + 150)
+#define RID_SVXPAGE_SWPOSSIZE (RID_SVX_START + 288)
+#define RID_SVXPAGE_POSITION_SIZE (RID_SVX_START + 87)
+#define RID_SVXPAGE_EVENTASSIGN (RID_SVX_START + 303)
+#define RID_SVXPAGE_HATCH (RID_SVX_START + 57)
+#define RID_SVXPAGE_BITMAP (RID_SVX_START + 58)
+#define RID_SVXPAGE_GRADIENT (RID_SVX_START + 59)
+#define RID_SVXPAGE_ANGLE (RID_SVX_START + 48)
+#define RID_SVXPAGE_SLANT (RID_SVX_START + 49)
+#define RID_SVXPAGE_DISTRIBUTE (RID_SVX_START + 236)
+#define RID_SVXPAGE_IMPROVEMENT (RID_SVX_START + 302)
+#define RID_SVXPAGE_MACROASSIGN (RID_SVX_START + 296)
+
+
+// why extra defines for pages that already exist?
+#define RID_SCH_TransformTabDLG_SVXPAGE_ANGLE (RID_SVX_START + 998)
+#define RID_SCH_TransformTabDLG_SVXPAGE_SLANT (RID_SVX_START + 999)
+
+// ID of tabpages implemented in SVX, but used in CUI
+#define RID_SVXPAGE_GRID (RID_SVX_START + 152)
+
+// factory IDs of dialogs implemented in CUI
+#define RID_SVX_GRFFILTER_DLG_SEPIA (RID_SVX_START + 334)
+#define RID_SVX_GRFFILTER_DLG_POSTER (RID_SVX_START + 335)
+#define RID_SVX_GRFFILTER_DLG_MOSAIC (RID_SVX_START + 332)
+#define RID_SVX_GRFFILTER_DLG_SOLARIZE (RID_SVX_START + 333)
+#define RID_SVX_GRFFILTER_DLG_EMBOSS (RID_SVX_START + 336)
+#define RID_SVXDLG_SEARCHFORMAT (RID_SVX_START + 21)
+#define RID_SVXDLG_CHARMAP ( RID_SVX_START + 10 )
+#define RID_SVXDLG_POSTIT ( RID_SVX_START + 8 )
+
+// only needed for layout:
+#define RID_SVXDLG_ZOOM ( RID_SVX_START + 0 )
+
+// IDs of options pages of applications
+#define RID_SW_TP_MAILCONFIG (RID_OFA_START + 102)
+#define RID_SW_TP_STD_FONT_CJK (RID_OFA_START + 247)
+#define RID_SW_TP_STD_FONT_CTL (RID_OFA_START + 251)
+#define RID_SW_TP_OPTLOAD_PAGE (RID_OFA_START + 214)
+#define RID_SW_TP_CONTENT_OPT (RID_OFA_START + 206)
+#define RID_SW_TP_OPTSHDWCRSR (RID_OFA_START + 211)
+#define RID_SW_TP_STD_FONT (RID_OFA_START + 208)
+#define RID_SW_TP_OPTPRINT_PAGE (RID_OFA_START + 209)
+#define RID_SW_TP_OPTTABLE_PAGE (RID_OFA_START + 210)
+#define RID_SW_TP_REDLINE_OPT (RID_OFA_START + 212)
+#define RID_SW_TP_OPTCOMPATIBILITY_PAGE (RID_OFA_START + 255)
+#define RID_SW_TP_HTML_CONTENT_OPT (RID_OFA_START + 240)
+#define RID_SW_TP_HTML_OPTPRINT_PAGE (RID_OFA_START + 242)
+#define RID_SW_TP_HTML_OPTTABLE_PAGE (RID_OFA_START + 243)
+#define RID_SW_TP_HTML_OPTGRID_PAGE (RID_OFA_START + 244)
+#define RID_SW_TP_HTML_OPTSHDWCRSR (RID_OFA_START + 246)
+#define RID_SW_TP_BACKGROUND (RID_OFA_START + 217)
+#define RID_SW_TP_OPTCAPTION_PAGE (RID_OFA_START + 256)
+#define SID_SC_TP_LAYOUT (RID_OFA_START + 218)
+#define SID_SC_TP_CONTENT (RID_OFA_START + 219)
+#define SID_SC_TP_INPUT (RID_OFA_START + 220)
+#define SID_SC_TP_GRID (RID_OFA_START + 221)
+#define SID_SC_TP_USERLISTS (RID_OFA_START + 222)
+#define SID_SC_TP_CALC (RID_OFA_START + 223)
+#define SID_SC_TP_CHANGES (RID_OFA_START + 224)
+#define RID_SC_TP_PRINT (RID_OFA_START + 248)
+#define SID_SI_TP_PRINT (RID_OFA_START + 236)
+#define SID_SI_TP_CONTENTS (RID_OFA_START + 232)
+#define SID_SI_TP_SNAP (RID_OFA_START + 234)
+#define SID_SI_TP_MISC (RID_OFA_START + 237)
+#define SID_SD_TP_PRINT (RID_OFA_START + 220)
+#define SID_SD_TP_CONTENTS (RID_OFA_START + 225)
+#define SID_SD_TP_SNAP (RID_OFA_START + 227)
+#define SID_SD_TP_MISC (RID_OFA_START + 231)
+#define RID_OFA_TP_INTERNATIONAL_SD (RID_OFA_START + 253)
+#define RID_OFA_TP_INTERNATIONAL_IMPR (RID_OFA_START + 254)
+#define RID_OFA_TP_INTERNATIONAL (RID_OFA_START + 252) // calc
+
+//---------------------------------------------------------------------
+// ResId's fuer die Zeichen-TabPages
+#define RID_SVXPAGE_CHAR_STD (RID_SVX_START + 3)
+#define RID_SVXPAGE_CHAR_EXT (RID_SVX_START + 4)
+
+// moved ids +8 ... +17 to "ModalDialog" resource ids
+
+// ResId fuer den Suchen/Ersetzen-Dialog
+#define RID_SVXDLG_SEARCH (RID_SVX_START + 20)
+
+// ResId fuer die PageDialog
+#define RID_SVXPAGE_FOOTER (RID_SVX_START + 26)
+#define RID_SVXPAGE_HEADER (RID_SVX_START + 27)
+#define RID_SVXQBX_DELETE_HEADFOOT (RID_SVX_START + 28)
+
+// ResId's fuer Dialoge aus StarDraw
+#define RID_SVXPAGE_POSITION (RID_SVX_START + 46)
+#define RID_SVXPAGE_SIZE (RID_SVX_START + 47)
+#define RID_SVXSW_FRAMEPOSITIONS (RID_SVX_START + 289)
+
+#define RID_SVXIL_FRAME (RID_SVX_START + 65)
+#define RID_SVXIL_FRAME_HC (RID_SVX_START + 66)
+
+#define RID_SVXDLG_3D (RID_SVX_START + 70)
+#define RID_SVXPAGE_LIGHT3D (RID_SVX_START + 71)
+#define RID_SVXPAGE_3DATTR (RID_SVX_START + 72)
+#define RID_SVXFLOAT_3D (RID_SVX_START + 209)
+
+#define RID_SVXIMAGE_LIGHT_ON (RID_SVX_START + 210)
+#define RID_SVXIMAGE_LIGHT_OFF (RID_SVX_START + 211)
+#define RID_SVXIMAGE_LIGHT_ON_H (RID_SVX_START + 212)
+#define RID_SVXIMAGE_LIGHT_OFF_H (RID_SVX_START + 213)
+#define RID_SVXIMAGE_COLORDLG (RID_SVX_START + 214)
+#define RID_SVXIMAGE_COLORDLG_H (RID_SVX_START + 215)
+
+#define RID_SVXFLOAT3D_FAVORITE (RID_SVX_START + 73)
+#define RID_SVXFLOAT3D_FIX_X (RID_SVX_START + 74)
+#define RID_SVXFLOAT3D_FIX_Y (RID_SVX_START + 75)
+#define RID_SVXFLOAT3D_FIX_Z (RID_SVX_START + 76)
+#define RID_SVXFLOAT3D_FIX_R (RID_SVX_START + 77)
+#define RID_SVXFLOAT3D_FIX_G (RID_SVX_START + 78)
+#define RID_SVXFLOAT3D_FIX_B (RID_SVX_START + 84)
+
+// Ids fuer FrameBitmaps durch ImageList ersetzt
+// 67 bis 72 frei
+
+// ResId fuer den Gitter- und Raster-Dialog
+#define RID_SVXDLG_GRID (RID_SVX_START + 79)
+
+// ResId's fuer FontMenu-Controls
+#define RID_MN_FONTSIZE (RID_SVX_START + 80)
+
+// ResId's fuer Undo-TbxControls
+#define RID_SVXTBX_UNDO (RID_SVX_START + 81)
+
+// ResId fuer Zoom-Popup-Menue
+#define RID_SVXMNU_ZOOM (RID_SVX_START + 82)
+
+// ResId fuer Funktions-Popup-Menue
+#define RID_SVXMNU_PSZ_FUNC (RID_SVX_START + 83)
+#define RID_SVXMNU_XMLSECSTATBAR (RID_SVX_START + 84)
+
+// ResId fuer Position- und Size-Bitmap
+#define RID_SVXBMP_POSITION (RID_SVX_START + 85)
+#define RID_SVXBMP_SIZE (RID_SVX_START + 86)
+
+#define RID_SVXBMP_SIGNET (RID_SVX_START + 87)
+#define RID_SVXBMP_SIGNET_H (RID_SVX_START + 88)
+#define RID_SVXBMP_SIGNET_BROKEN (RID_SVX_START + 89)
+#define RID_SVXBMP_SIGNET_BROKEN_H (RID_SVX_START + 90)
+#define RID_SVXBMP_SIGNET_NOTVALIDATED (RID_SVX_START + 91)
+#define RID_SVXBMP_SIGNET_NOTVALIDATED_H (RID_SVX_START + 92)
+
+#define RID_SVXBMP_SLIDERBUTTON (RID_SVX_START + 67)
+#define RID_SVXBMP_SLIDERDECREASE (RID_SVX_START + 68)
+#define RID_SVXBMP_SLIDERINCREASE (RID_SVX_START + 69)
+#define RID_SVXBMP_SLIDERBUTTON_HC (RID_SVX_START + 70)
+#define RID_SVXBMP_SLIDERDECREASE_HC (RID_SVX_START + 71)
+#define RID_SVXBMP_SLIDERINCREASE_HC (RID_SVX_START + 72)
+
+// Resource mit Bitmaps fuer die CheckListBox
+#define RID_CHECKLISTBOX_BITMAPS (RID_SVX_START + 91)
+
+// Menu fuers Lineal
+#define RID_SVXMN_RULER (RID_SVX_START + 92)
+
+// FontWork-Dialog
+#define RID_SVXDLG_FONTWORK (RID_SVX_START + 93)
+
+// FontWork-ValueSet-Bitmaps
+#define RID_SVXBMP_FONTWORK_FORM1 (RID_SVX_START + 94)
+#define RID_SVXBMP_FONTWORK_FORM2 (RID_SVX_START + 95)
+#define RID_SVXBMP_FONTWORK_FORM3 (RID_SVX_START + 96)
+#define RID_SVXBMP_FONTWORK_FORM4 (RID_SVX_START + 97)
+#define RID_SVXBMP_FONTWORK_FORM5 (RID_SVX_START + 98)
+#define RID_SVXBMP_FONTWORK_FORM6 (RID_SVX_START + 99)
+#define RID_SVXBMP_FONTWORK_FORM7 (RID_SVX_START + 100)
+#define RID_SVXBMP_FONTWORK_FORM8 (RID_SVX_START + 101)
+#define RID_SVXBMP_FONTWORK_FORM9 (RID_SVX_START + 102)
+#define RID_SVXBMP_FONTWORK_FORM10 (RID_SVX_START + 103)
+#define RID_SVXBMP_FONTWORK_FORM11 (RID_SVX_START + 104)
+#define RID_SVXBMP_FONTWORK_FORM12 (RID_SVX_START + 105)
+
+#define RID_SVXBMP_SHADOW_XDIST (RID_SVX_START + 110)
+#define RID_SVXBMP_SHADOW_YDIST (RID_SVX_START + 111)
+#define RID_SVXBMP_SHADOW_ANGLE (RID_SVX_START + 112)
+#define RID_SVXBMP_SHADOW_SIZE (RID_SVX_START + 113)
+
+#define RID_SVXCTRL_COLOR (RID_SVX_START + 117)
+
+// fuer ToolboxControl-Style
+#define RID_SVXTBX_STYLE (RID_SVX_START + 120)
+
+#define RID_SVXDLG_HYPERLINK (RID_SVX_START + 140)
+#define RID_SVXDLG_PASSWORD (RID_SVX_START + 141)
+
+// ResId fuer InternetPage
+#define RID_SVXPAGE_INTERNET (RID_SVX_START + 154)
+
+//InetDlg
+#define RID_SVXPAGE_INET_CACHE (RID_SVX_START + 158)
+#define RID_SVXPAGE_INET_TYPE (RID_SVX_START + 159)
+
+#define RID_SVXPAGE_BROWSER_OTHER (RID_SVX_START + 202)
+#define RID_CACHE_EXTRA_DLG (RID_SVX_START + 203)
+
+// OnlineRegistration
+#define RID_SVXDLG_REGISTER (RID_SVX_START + 193)
+#define RID_SVXPAGE_REGISTER_1 (RID_SVX_START + 194)
+#define RID_SVXPAGE_REGISTER_2 (RID_SVX_START + 195)
+#define RID_SVXPAGE_REGISTER_3 (RID_SVX_START + 196)
+#define RID_SVXPAGE_REGISTER_4 (RID_SVX_START + 197)
+#define RID_SVXPAGE_REGISTER_5 (RID_SVX_START + 198)
+#define RID_SVXPAGE_REGISTER_6 (RID_SVX_START + 199)
+
+// 3D-Entfernung/Perspektive Bitmaps
+#define RID_SVXBMP_3D_DISTANCE_01 (RID_SVX_START + 162)
+#define RID_SVXBMP_3D_DISTANCE_02 (RID_SVX_START + 163)
+#define RID_SVXBMP_3D_DISTANCE_03 (RID_SVX_START + 164)
+#define RID_SVXBMP_3D_DISTANCE_04 (RID_SVX_START + 165)
+#define RID_SVXBMP_3D_DISTANCE_05 (RID_SVX_START + 166)
+#define RID_SVXBMP_3D_DISTANCE_06 (RID_SVX_START + 167)
+#define RID_SVXBMP_3D_DISTANCE_07 (RID_SVX_START + 168)
+#define RID_SVXBMP_3D_DISTANCE_08 (RID_SVX_START + 169)
+#define RID_SVXBMP_3D_DISTANCE_09 (RID_SVX_START + 170)
+#define RID_SVXBMP_3D_DISTANCE_10 (RID_SVX_START + 171)
+
+#define RID_SVXBMP_3D_FOCAL_LENGTH_01 (RID_SVX_START + 172)
+#define RID_SVXBMP_3D_FOCAL_LENGTH_02 (RID_SVX_START + 173)
+#define RID_SVXBMP_3D_FOCAL_LENGTH_03 (RID_SVX_START + 174)
+#define RID_SVXBMP_3D_FOCAL_LENGTH_04 (RID_SVX_START + 175)
+#define RID_SVXBMP_3D_FOCAL_LENGTH_05 (RID_SVX_START + 176)
+#define RID_SVXBMP_3D_FOCAL_LENGTH_06 (RID_SVX_START + 177)
+#define RID_SVXBMP_3D_FOCAL_LENGTH_07 (RID_SVX_START + 178)
+#define RID_SVXBMP_3D_FOCAL_LENGTH_08 (RID_SVX_START + 179)
+#define RID_SVXBMP_3D_FOCAL_LENGTH_09 (RID_SVX_START + 180)
+#define RID_SVXBMP_3D_FOCAL_LENGTH_10 (RID_SVX_START + 181)
+
+// Ids fuer Autokorrektur
+#define RID_SVX_AUTOCORR (RID_SVX_START + 192)
+
+// Auswahl ext. Linguitik
+#define RID_SVX_OPT_EXT_LINGU (RID_SVX_START + 193)
+
+// TabPage und Dialog f"ur LDAP-Server
+#define RID_SVXPAGE_LDAP (RID_SVX_START + 204)
+#define RID_SVXDLG_LDAP (RID_SVX_START + 205)
+
+// Dialog fuer Funktionen
+#define RID_SVXDLG_CALCFUNC (RID_SVX_START + 206)
+
+// QueryBox for Exit Recovery Wizard
+#define RID_SVXQB_EXIT_RECOVERY (RID_SVX_START + 215)
+
+// ResId fuer den ImportGraphic-Dialog
+#define RID_SVXRES_IMPORTGRAPHIC (RID_SVX_START + 499)
+
+
+#define RID_SVXCTRL_RECTBTNS (RID_SVX_START + 226)
+
+// ResId's f???r Hyperlink-Dialog-Tabpages
+
+// ResId's for Starone impl. bitmaps
+#define RID_UNODRAW_OBJECTS (RID_SVX_START + 233)
+#define RID_UNODRAW_OLE2 (RID_SVX_START + 234)
+#define RID_UNODRAW_GRAPHICS (RID_SVX_START + 235)
+
+#define RID_SVXIMG_NOTCHECKED (RID_SVX_START + 243)
+#define RID_SVXIMG_CHECKED (RID_SVX_START + 244)
+
+#define RID_SVXDLG_RUBY (RID_SVX_START + 247)
+
+#define RID_SVXBMP_FONTWORK_FORM1_H (RID_SVX_START + 260)
+#define RID_SVXBMP_FONTWORK_FORM2_H (RID_SVX_START + 261)
+#define RID_SVXBMP_FONTWORK_FORM3_H (RID_SVX_START + 262)
+#define RID_SVXBMP_FONTWORK_FORM4_H (RID_SVX_START + 263)
+#define RID_SVXBMP_FONTWORK_FORM5_H (RID_SVX_START + 264)
+#define RID_SVXBMP_FONTWORK_FORM6_H (RID_SVX_START + 265)
+#define RID_SVXBMP_FONTWORK_FORM7_H (RID_SVX_START + 266)
+#define RID_SVXBMP_FONTWORK_FORM8_H (RID_SVX_START + 267)
+#define RID_SVXBMP_FONTWORK_FORM9_H (RID_SVX_START + 268)
+#define RID_SVXBMP_FONTWORK_FORM10_H (RID_SVX_START + 269)
+#define RID_SVXBMP_FONTWORK_FORM11_H (RID_SVX_START + 270)
+#define RID_SVXBMP_FONTWORK_FORM12_H (RID_SVX_START + 271)
+#define RID_SVXIMG_GRAF_RED_H (RID_SVX_START + 276)
+#define RID_SVXIMG_GRAF_GREEN_H (RID_SVX_START + 277)
+#define RID_SVXIMG_GRAF_BLUE_H (RID_SVX_START + 278)
+#define RID_SVXIMG_GRAF_LUMINANCE_H (RID_SVX_START + 279)
+#define RID_SVXIMG_GRAF_CONTRAST_H (RID_SVX_START + 280)
+#define RID_SVXIMG_GRAF_GAMMA_H (RID_SVX_START + 281)
+#define RID_SVXIMG_GRAF_TRANSPARENCE_H (RID_SVX_START + 282)
+#define RID_SVXIMG_CHECKED_H (RID_SVX_START + 285)
+
+#define RID_SVXDLG_TEXTCONTROL_CHARATTR (RID_SVX_START + 286)
+#define RID_SVXDLG_TEXTCONTROL_PARAATTR (RID_SVX_START + 287)
+
+// !!! please update RID_SVX_FIRSTFREE !!! see line 46
+
+// Strings ------------------------------------------------------------------
+
+
+// Strings fuer die Sprachen (HM-Abhaengig)
+#define RID_SVXSTR_LANGUAGE_BEGIN (RID_SVX_START + 0)
+#define RID_SVXSTR_LANGUAGE_ALL (RID_SVX_START + 15)
+
+// Messages im DBMgr-Bereich
+#define RID_SVXSTR_DBINI (RID_SVX_START + 60)
+#define RID_SVXSTR_DBDRV (RID_SVX_START + 61)
+#define RID_SVXSTR_NODBDRV (RID_SVX_START + 62)
+#define RID_SVXSTR_DBCANTOPEN (RID_SVX_START + 63)
+#define RID_SVXSTR_DBINACTIVE (RID_SVX_START + 64)
+#define RID_SVXSTR_SELECT (RID_SVX_START + 65)
+#define RID_SVXSTR_DESELECT (RID_SVX_START + 66)
+#define RID_SVXSTR_MERGE (RID_SVX_START + 67)
+#define RID_SVXSTR_INSERT (RID_SVX_START + 68)
+#define RID_SVXSTR_NOSELECT (RID_SVX_START + 69)
+#define RID_SVXSTR_CANT_OPEN_DB (RID_SVX_START + 70)
+#define RID_SVXSTR_INVALID_RECORD (RID_SVX_START + 71)
+#define RID_SVXSTR_NOSET_MATCHING (RID_SVX_START + 72)
+
+// Strings aus dem Suchen-Dialog
+#define RID_SVXSTR_SEARCH_STYLES (RID_SVX_START + 80)
+#define RID_SVXSTR_SEARCH (RID_SVX_START + 81)
+#define RID_SVXSTR_REPLACE (RID_SVX_START + 82)
+
+#define RID_SVXSTR_FULLSIZE (RID_SVX_START + 144)
+
+// ResIds fuer die verschiedenen Strings des PageDlgs
+#define RID_SVXSTR_CALC_PAGE (RID_SVX_START + 146)
+#define RID_SVXSTR_DRAW_PAGE (RID_SVX_START + 147)
+
+// Strings der ToolBox-Controls aus tbcontrl.cxx
+#define RID_SVXSTR_FILLPATTERN (RID_SVX_START + 191)
+#define RID_SVXSTR_FRAME (RID_SVX_START + 192)
+#define RID_SVXSTR_FRAME_COLOR (RID_SVX_START + 194)
+#define RID_SVXSTR_FRAME_STYLE (RID_SVX_START + 195)
+#define RID_SVXSTR_EXTRAS_CHARBACKGROUND (RID_SVX_START + 196)
+#define RID_SVXSTR_CLEARFORM (RID_SVX_START + 197)
+#define RID_SVXSTR_MORE (RID_SVX_START + 198)
+
+
+// Strings der UndoTbxControls
+#define RID_SVXSTR_UNDO (RID_SVX_START + 200)
+#define RID_SVXSTR_REDO (RID_SVX_START + 201)
+#define RID_SVXSTR_ACTION (RID_SVX_START + 202)
+#define RID_SVXSTR_ACTIONS (RID_SVX_START + 203)
+
+// Strings fuer Insert/Overwrite
+#define RID_SVXSTR_INSERT_TEXT (RID_SVX_START + 210)
+#define RID_SVXSTR_OVERWRITE_TEXT (RID_SVX_START + 211)
+
+// Strings fuer Selection Mode
+#define RID_SVXSTR_SELMODE_STD (RID_SVX_START + 212)
+#define RID_SVXSTR_SELMODE_ER (RID_SVX_START + 213)
+#define RID_SVXSTR_SELMODE_ERG (RID_SVX_START + 214)
+
+#define RID_SVXSTR_XMLSEC_SIG_OK (RID_SVX_START + 222)
+#define RID_SVXSTR_XMLSEC_SIG_OK_NO_VERIFY (RID_SVX_START + 223)
+#define RID_SVXSTR_XMLSEC_SIG_NOT_OK (RID_SVX_START + 224)
+#define RID_SVXSTR_XMLSEC_NO_SIG (RID_SVX_START + 225)
+#define RID_SVXSTR_XMLSEC_SIG_CERT_OK_PARTIAL_SIG (RID_SVX_START + 226)
+
+// weitere ID bei 219
+
+// String-ResId fuer den ImportGraphic-Dialog
+#define RID_SVXSTR_ALL_FILES (RID_SVX_START + 241)
+
+// Strings des Lineals
+#define RID_SVXSTR_RULER_START (RID_SVX_START + 245)
+#define RID_SVXSTR_RULER_TAB_LEFT (RID_SVX_START + 245)
+#define RID_SVXSTR_RULER_TAB_RIGHT (RID_SVX_START + 246)
+#define RID_SVXSTR_RULER_TAB_DECIMAL (RID_SVX_START + 247)
+#define RID_SVXSTR_RULER_TAB_CENTER (RID_SVX_START + 248)
+
+// Schlie"ssen (im TabDialog Line/Area)
+#define RID_SVXSTR_CLOSE (RID_SVX_START + 260)
+
+// FontWork-ValueSet-Strings
+#define RID_SVXSTR_FONTWORK_FORM1 (RID_SVX_START + 261)
+#define RID_SVXSTR_FONTWORK_FORM2 (RID_SVX_START + 262)
+#define RID_SVXSTR_FONTWORK_FORM3 (RID_SVX_START + 263)
+#define RID_SVXSTR_FONTWORK_FORM4 (RID_SVX_START + 264)
+#define RID_SVXSTR_FONTWORK_FORM5 (RID_SVX_START + 265)
+#define RID_SVXSTR_FONTWORK_FORM6 (RID_SVX_START + 266)
+#define RID_SVXSTR_FONTWORK_FORM7 (RID_SVX_START + 267)
+#define RID_SVXSTR_FONTWORK_FORM8 (RID_SVX_START + 268)
+#define RID_SVXSTR_FONTWORK_FORM9 (RID_SVX_START + 269)
+#define RID_SVXSTR_FONTWORK_FORM10 (RID_SVX_START + 270)
+#define RID_SVXSTR_FONTWORK_FORM11 (RID_SVX_START + 271)
+#define RID_SVXSTR_FONTWORK_FORM12 (RID_SVX_START + 272)
+#define RID_SVXSTR_FONTWORK_UNDOCREATE (RID_SVX_START + 273)
+
+// Farben-Strings
+#define RID_SVXSTR_BLACK (RID_SVX_START + 275)
+#define RID_SVXSTR_BLUE (RID_SVX_START + 276)
+#define RID_SVXSTR_GREEN (RID_SVX_START + 277)
+#define RID_SVXSTR_CYAN (RID_SVX_START + 278)
+#define RID_SVXSTR_RED (RID_SVX_START + 279)
+#define RID_SVXSTR_MAGENTA (RID_SVX_START + 280)
+#define RID_SVXSTR_BROWN (RID_SVX_START + 281)
+#define RID_SVXSTR_GREY (RID_SVX_START + 282)
+#define RID_SVXSTR_LIGHTGREY (RID_SVX_START + 283)
+#define RID_SVXSTR_LIGHTBLUE (RID_SVX_START + 284)
+#define RID_SVXSTR_LIGHTGREEN (RID_SVX_START + 285)
+#define RID_SVXSTR_LIGHTCYAN (RID_SVX_START + 286)
+#define RID_SVXSTR_LIGHTRED (RID_SVX_START + 287)
+#define RID_SVXSTR_LIGHTMAGENTA (RID_SVX_START + 288)
+#define RID_SVXSTR_YELLOW (RID_SVX_START + 289)
+#define RID_SVXSTR_WHITE (RID_SVX_START + 290)
+#define RID_SVXSTR_BLUEGREY (RID_SVX_START + 291)
+#define RID_SVXSTR_ORANGE (RID_SVX_START + 292)
+
+// Linienenden-Strings
+#define RID_SVXSTR_ARROW (RID_SVX_START + 300)
+#define RID_SVXSTR_SQUARE (RID_SVX_START + 301)
+#define RID_SVXSTR_CIRCLE (RID_SVX_START + 302)
+
+#define RID_SVXSTR_TRANSPARENCE (RID_SVX_START + 305)
+#define RID_SVXSTR_CENTERED (RID_SVX_START + 306)
+#define RID_SVXSTR_NOTCENTERED (RID_SVX_START + 307)
+
+// String-Arrays
+#define RID_SVXSTR_TEXTENCODING_TABLE (RID_SVX_START + 312)
+
+// Hyperlink-Dlg
+#define RID_SVXMN_HYPERLINK (RID_SVX_START + 321)
+// Hyperlink-QueryBoxen
+#define RID_SVXQB_NOCONNECT (RID_SVX_START + 322)
+#define RID_SVXQB_DONTEXIST (RID_SVX_START + 323)
+//color configuration
+
+// Graphic filter
+#define RID_SVX_GRFFILTER_START (RID_SVX_START + 330)
+#define RID_SVXTBX_GRFFILTER (RID_SVX_START + 331)
+
+#define RID_SVXERRCODE (RID_SVX_START + 350)
+
+// gallery
+#define RID_SVX_GALLERY_START (RID_SVX_START + 360)
+#define RID_SVX_GALLERY_END (RID_SVX_START + 410)
+
+#define RID_SVXSTR_MEM_ERROR (RID_SVX_START + 415)
+#define RID_SVXSTR_DLG_TITLE_INFO (RID_SVX_START + 416)
+
+// Define - Bereich fuer BmpMaskierung
+// !!! aus diesem Bereich keine Defines benutzen !!!
+#define RID_SVX_BMPMASK_START (RID_SVX_START + 420)
+#define RID_SVX_BMPMASK_END (RID_SVX_START + 440)
+
+// Define - Bereich fuer IMAP-Editor
+// !!! aus diesem Bereich keine Defines benutzen !!!
+#define RID_SVX_IMAP_START (RID_SVX_START + 450)
+#define RID_SVX_IMAP_END (RID_SVX_START + 460)
+
+// Define - Bereich fuer Contour-Editor
+// !!! aus diesem Bereich keine Defines benutzen !!!
+#define RID_SVX_CONTOUR_START (RID_SVX_START + 461)
+#define RID_SVX_CONTOUR_END (RID_SVX_START + 471)
+
+#define RID_SVXIMG_GRAF_RED (RID_SVX_START + 472)
+#define RID_SVXIMG_GRAF_GREEN (RID_SVX_START + 473)
+#define RID_SVXIMG_GRAF_BLUE (RID_SVX_START + 474)
+#define RID_SVXIMG_GRAF_LUMINANCE (RID_SVX_START + 475)
+#define RID_SVXIMG_GRAF_CONTRAST (RID_SVX_START + 476)
+#define RID_SVXIMG_GRAF_GAMMA (RID_SVX_START + 477)
+#define RID_SVXIMG_GRAF_TRANSPARENCE (RID_SVX_START + 478)
+
+#define RID_SVX_RELOAD_NORMAL (RID_SVX_START + 480)
+#define RID_SVX_RELOAD_SPECIAL (RID_SVX_START + 481)
+
+// Defines fuer die 3D-Engine
+#define RID_SVX_3D_UNDO_EXCHANGE_PASTE (RID_SVX_START + 489)
+#define RID_SVX_3D_CREATE_LATHE (RID_SVX_START + 490)
+#define RID_SVX_3D_UNDO_SEGMENTS (RID_SVX_START + 491)
+#define RID_SVX_3D_UNDO_DEEPTH (RID_SVX_START + 492)
+#define RID_SVX_3D_UNDO_FOCAL (RID_SVX_START + 493)
+#define RID_SVX_3D_UNDO_CAMPOS (RID_SVX_START + 494)
+#define RID_SVX_3D_UNDO_ROTATE (RID_SVX_START + 495)
+#define RID_SVX_3D_UNDO_EXTRUDE (RID_SVX_START + 496)
+#define RID_SVX_3D_UNDO_LATHE (RID_SVX_START + 497)
+#define RID_SVX_3D_UNDO_BREAK_LATHE (RID_SVX_START + 498)
+#define RID_SVX_3D_UNDO_ATTRIBUTES (RID_SVX_START + 499)
+
+#define RID_STR_FULLNUMS_START (RID_SVX_START + 500)//?
+#define RID_STR_FULLNUMS_1 (RID_STR_FULLNUMS_START )//?
+#define RID_STR_FULLNUMS_2 (RID_STR_FULLNUMS_START + 1)//?
+#define RID_STR_FULLNUMS_3 (RID_STR_FULLNUMS_START + 2)//?
+#define RID_STR_FULLNUMS_4 (RID_STR_FULLNUMS_START + 3)//?
+#define RID_STR_FULLNUMS_5 (RID_STR_FULLNUMS_START + 4)//?
+#define RID_STR_FULLNUMS_6 (RID_STR_FULLNUMS_START + 5)//?
+#define RID_STR_FULLNUMS_7 (RID_STR_FULLNUMS_START + 6)//?
+#define RID_STR_FULLNUMS_8 (RID_STR_FULLNUMS_START + 7)//?
+#define RID_STR_FULLNUMS_7_HTML (RID_SVX_START + 510)//?
+
+// RID_SVX_END == (RID_SVX_START + 499) !!!
+// am besten ab 520 frei (RB)
+// seit der Erfindung eigener Resourcen fuer jedes Projekt kann es hier keine
+// Obergrenze geben (abgesehen von USHRT_MAX) (os)
+#define RID_STR_BULLET_THEME (RID_SVX_START + 508)
+
+
+// ResIds for graphics drawmode
+#define RID_SVXSTR_GRAFMODE_STANDARD (RID_SVX_START + 520)
+#define RID_SVXSTR_GRAFMODE_GREYS (RID_SVX_START + 521)
+#define RID_SVXSTR_GRAFMODE_MONO (RID_SVX_START + 522)
+#define RID_SVXSTR_GRAFMODE_WATERMARK (RID_SVX_START + 523)
+
+
+// Strings for Plugin-Filedialog
+#define STR_INSERT_VIDEO_EXTFILTER_IVF (RID_SVX_START + 524)
+#define STR_INSERT_VIDEO_EXTFILTER_AVI (RID_SVX_START + 525)
+#define STR_INSERT_VIDEO_EXTFILTER_MOV (RID_SVX_START + 526)
+#define STR_INSERT_VIDEO_EXTFILTER_MPEG (RID_SVX_START + 527)
+#define STR_EXTFILTER_ALL (RID_SVX_START + 528)
+#define STR_INSERT_SOUND_TITLE (RID_SVX_START + 529)
+#define STR_INSERT_VIDEO_TITLE (RID_SVX_START + 530)
+
+#define RID_SVXSTR_BACKGROUND (RID_SVX_START + 531)
+
+// BM: some additional standard colors
+#define RID_SVXSTR_VIOLET (RID_SVX_START + 540)
+#define RID_SVXSTR_BORDEAUX (RID_SVX_START + 541)
+#define RID_SVXSTR_PALE_YELLOW (RID_SVX_START + 542)
+#define RID_SVXSTR_PALE_GREEN (RID_SVX_START + 543)
+#define RID_SVXSTR_DKVIOLET (RID_SVX_START + 544)
+#define RID_SVXSTR_SALMON (RID_SVX_START + 545)
+#define RID_SVXSTR_SEABLUE (RID_SVX_START + 546)
+#define RID_SVXSTR_COLOR_SUN (RID_SVX_START + 547)
+
+// JP: string resource ids for table-autoformat-names, used in SW/SC
+// !!! Urgent: the order of Ids is persistent. New Ids have to append !!!
+#define RID_SVXSTR_TBLAFMT_BEGIN (RID_SVX_START + 560)
+#define RID_SVXSTR_TBLAFMT_3D RID_SVXSTR_TBLAFMT_BEGIN
+#define RID_SVXSTR_TBLAFMT_BLACK1 (RID_SVX_START + 561)
+#define RID_SVXSTR_TBLAFMT_BLACK2 (RID_SVX_START + 562)
+#define RID_SVXSTR_TBLAFMT_BLUE (RID_SVX_START + 563)
+#define RID_SVXSTR_TBLAFMT_BROWN (RID_SVX_START + 564)
+#define RID_SVXSTR_TBLAFMT_CURRENCY (RID_SVX_START + 565)
+#define RID_SVXSTR_TBLAFMT_CURRENCY_3D (RID_SVX_START + 566)
+#define RID_SVXSTR_TBLAFMT_CURRENCY_GRAY (RID_SVX_START + 567)
+#define RID_SVXSTR_TBLAFMT_CURRENCY_LAVENDER (RID_SVX_START + 568)
+#define RID_SVXSTR_TBLAFMT_CURRENCY_TURQUOISE (RID_SVX_START + 569)
+#define RID_SVXSTR_TBLAFMT_GRAY (RID_SVX_START + 570)
+#define RID_SVXSTR_TBLAFMT_GREEN (RID_SVX_START + 571)
+#define RID_SVXSTR_TBLAFMT_LAVENDER (RID_SVX_START + 572)
+#define RID_SVXSTR_TBLAFMT_RED (RID_SVX_START + 573)
+#define RID_SVXSTR_TBLAFMT_TURQUOISE (RID_SVX_START + 574)
+#define RID_SVXSTR_TBLAFMT_YELLOW (RID_SVX_START + 575)
+#define RID_SVXSTR_TBLAFMT_END (RID_SVX_START + 576)
+
+// string resources for XLineJoint item
+#define RID_SVXSTR_LINEJOINT_NONE RID_SVXSTR_NONE
+#define RID_SVXSTR_LINEJOINT_MIDDLE (RID_SVX_START + 589 )
+#define RID_SVXSTR_LINEJOINT_BEVEL (RID_SVX_START + 590 )
+#define RID_SVXSTR_LINEJOINT_MITER (RID_SVX_START + 591 )
+#define RID_SVXSTR_LINEJOINT_ROUND (RID_SVX_START + 592 )
+
+// Default-Color-Names
+#define RID_SVXSTR_BLACK_DEF (RID_SVX_START + 595)
+#define RID_SVXSTR_BLUE_DEF (RID_SVX_START + 596)
+#define RID_SVXSTR_GREEN_DEF (RID_SVX_START + 597)
+#define RID_SVXSTR_CYAN_DEF (RID_SVX_START + 598)
+#define RID_SVXSTR_RED_DEF (RID_SVX_START + 599)
+#define RID_SVXSTR_MAGENTA_DEF (RID_SVX_START + 600)
+#define RID_SVXSTR_BROWN_DEF (RID_SVX_START + 601)
+#define RID_SVXSTR_GREY_DEF (RID_SVX_START + 602)
+#define RID_SVXSTR_LIGHTGREY_DEF (RID_SVX_START + 603)
+#define RID_SVXSTR_LIGHTBLUE_DEF (RID_SVX_START + 604)
+#define RID_SVXSTR_LIGHTGREEN_DEF (RID_SVX_START + 605)
+#define RID_SVXSTR_LIGHTCYAN_DEF (RID_SVX_START + 606)
+#define RID_SVXSTR_LIGHTRED_DEF (RID_SVX_START + 607)
+#define RID_SVXSTR_LIGHTMAGENTA_DEF (RID_SVX_START + 608)
+#define RID_SVXSTR_YELLOW_DEF (RID_SVX_START + 609)
+#define RID_SVXSTR_WHITE_DEF (RID_SVX_START + 610)
+#define RID_SVXSTR_BLUEGREY_DEF (RID_SVX_START + 611)
+#define RID_SVXSTR_ORANGE_DEF (RID_SVX_START + 612)
+#define RID_SVXSTR_VIOLET_DEF (RID_SVX_START + 613)
+#define RID_SVXSTR_BORDEAUX_DEF (RID_SVX_START + 614)
+#define RID_SVXSTR_PALE_YELLOW_DEF (RID_SVX_START + 615)
+#define RID_SVXSTR_PALE_GREEN_DEF (RID_SVX_START + 616)
+#define RID_SVXSTR_DKVIOLET_DEF (RID_SVX_START + 617)
+#define RID_SVXSTR_SALMON_DEF (RID_SVX_START + 618)
+#define RID_SVXSTR_SEABLUE_DEF (RID_SVX_START + 619)
+#define RID_SVXSTR_COLOR_SUN_DEF (RID_SVX_START + 620)
+#define RID_SVXSTR_COLOR_CHART (RID_SVX_START + 621)
+#define RID_SVXSTR_COLOR_CHART_DEF (RID_SVX_START + 622)
+
+// Default-Gradient-Names
+#define RID_SVXSTR_GRDT0_DEF (RID_SVX_START + 631)
+#define RID_SVXSTR_GRDT1_DEF (RID_SVX_START + 632)
+#define RID_SVXSTR_GRDT2_DEF (RID_SVX_START + 633)
+#define RID_SVXSTR_GRDT3_DEF (RID_SVX_START + 634)
+#define RID_SVXSTR_GRDT4_DEF (RID_SVX_START + 635)
+#define RID_SVXSTR_GRDT5_DEF (RID_SVX_START + 636)
+#define RID_SVXSTR_GRDT6_DEF (RID_SVX_START + 637)
+#define RID_SVXSTR_GRDT7_DEF (RID_SVX_START + 638)
+#define RID_SVXSTR_GRDT8_DEF (RID_SVX_START + 639)
+#define RID_SVXSTR_GRDT9_DEF (RID_SVX_START + 640)
+#define RID_SVXSTR_GRDT0 (RID_SVX_START + 641)
+#define RID_SVXSTR_GRDT1 (RID_SVX_START + 642)
+#define RID_SVXSTR_GRDT2 (RID_SVX_START + 643)
+#define RID_SVXSTR_GRDT3 (RID_SVX_START + 644)
+#define RID_SVXSTR_GRDT4 (RID_SVX_START + 645)
+#define RID_SVXSTR_GRDT5 (RID_SVX_START + 646)
+#define RID_SVXSTR_GRDT6 (RID_SVX_START + 647)
+#define RID_SVXSTR_GRDT7 (RID_SVX_START + 648)
+#define RID_SVXSTR_GRDT8 (RID_SVX_START + 649)
+#define RID_SVXSTR_GRDT9 (RID_SVX_START + 650)
+#define RID_SVXSTR_GRDT_DEF_START RID_SVXSTR_GRDT0_DEF
+#define RID_SVXSTR_GRDT_DEF_END RID_SVXSTR_GRDT9_DEF
+#define RID_SVXSTR_GRDT_START RID_SVXSTR_GRDT0
+#define RID_SVXSTR_GRDT_END RID_SVXSTR_GRDT9
+
+// Default-Hatch-Names
+#define RID_SVXSTR_HATCH0_DEF (RID_SVX_START + 661)
+#define RID_SVXSTR_HATCH1_DEF (RID_SVX_START + 662)
+#define RID_SVXSTR_HATCH2_DEF (RID_SVX_START + 663)
+#define RID_SVXSTR_HATCH3_DEF (RID_SVX_START + 664)
+#define RID_SVXSTR_HATCH4_DEF (RID_SVX_START + 665)
+#define RID_SVXSTR_HATCH5_DEF (RID_SVX_START + 666)
+#define RID_SVXSTR_HATCH6_DEF (RID_SVX_START + 667)
+#define RID_SVXSTR_HATCH7_DEF (RID_SVX_START + 668)
+#define RID_SVXSTR_HATCH8_DEF (RID_SVX_START + 669)
+#define RID_SVXSTR_HATCH9_DEF (RID_SVX_START + 670)
+#define RID_SVXSTR_HATCH10_DEF (RID_SVX_START + 671)
+#define RID_SVXSTR_HATCH0 (RID_SVX_START + 672)
+#define RID_SVXSTR_HATCH1 (RID_SVX_START + 673)
+#define RID_SVXSTR_HATCH2 (RID_SVX_START + 674)
+#define RID_SVXSTR_HATCH3 (RID_SVX_START + 675)
+#define RID_SVXSTR_HATCH4 (RID_SVX_START + 676)
+#define RID_SVXSTR_HATCH5 (RID_SVX_START + 677)
+#define RID_SVXSTR_HATCH6 (RID_SVX_START + 678)
+#define RID_SVXSTR_HATCH7 (RID_SVX_START + 679)
+#define RID_SVXSTR_HATCH8 (RID_SVX_START + 680)
+#define RID_SVXSTR_HATCH9 (RID_SVX_START + 681)
+#define RID_SVXSTR_HATCH10 (RID_SVX_START + 682)
+#define RID_SVXSTR_HATCH_DEF_START RID_SVXSTR_HATCH0_DEF
+#define RID_SVXSTR_HATCH_DEF_END RID_SVXSTR_HATCH10_DEF
+#define RID_SVXSTR_HATCH_START RID_SVXSTR_HATCH0
+#define RID_SVXSTR_HATCH_END RID_SVXSTR_HATCH10
+
+// Default-Bitmap-Names
+#define RID_SVXSTR_BMP0_DEF (RID_SVX_START + 691)
+#define RID_SVXSTR_BMP1_DEF (RID_SVX_START + 692)
+#define RID_SVXSTR_BMP2_DEF (RID_SVX_START + 693)
+#define RID_SVXSTR_BMP3_DEF (RID_SVX_START + 694)
+#define RID_SVXSTR_BMP4_DEF (RID_SVX_START + 695)
+#define RID_SVXSTR_BMP5_DEF (RID_SVX_START + 696)
+#define RID_SVXSTR_BMP6_DEF (RID_SVX_START + 697)
+#define RID_SVXSTR_BMP7_DEF (RID_SVX_START + 698)
+#define RID_SVXSTR_BMP8_DEF (RID_SVX_START + 699)
+#define RID_SVXSTR_BMP9_DEF (RID_SVX_START + 700)
+#define RID_SVXSTR_BMP10_DEF (RID_SVX_START + 701)
+#define RID_SVXSTR_BMP11_DEF (RID_SVX_START + 702)
+#define RID_SVXSTR_BMP12_DEF (RID_SVX_START + 703)
+#define RID_SVXSTR_BMP13_DEF (RID_SVX_START + 704)
+#define RID_SVXSTR_BMP14_DEF (RID_SVX_START + 705)
+#define RID_SVXSTR_BMP15_DEF (RID_SVX_START + 706)
+#define RID_SVXSTR_BMP16_DEF (RID_SVX_START + 707)
+#define RID_SVXSTR_BMP17_DEF (RID_SVX_START + 708)
+#define RID_SVXSTR_BMP18_DEF (RID_SVX_START + 709)
+#define RID_SVXSTR_BMP19_DEF (RID_SVX_START + 710)
+#define RID_SVXSTR_BMP20_DEF (RID_SVX_START + 711)
+#define RID_SVXSTR_BMP21_DEF (RID_SVX_START + 712)
+#define RID_SVXSTR_BMP0 (RID_SVX_START + 713)
+#define RID_SVXSTR_BMP1 (RID_SVX_START + 714)
+#define RID_SVXSTR_BMP2 (RID_SVX_START + 715)
+#define RID_SVXSTR_BMP3 (RID_SVX_START + 716)
+#define RID_SVXSTR_BMP4 (RID_SVX_START + 717)
+#define RID_SVXSTR_BMP5 (RID_SVX_START + 718)
+#define RID_SVXSTR_BMP6 (RID_SVX_START + 719)
+#define RID_SVXSTR_BMP7 (RID_SVX_START + 720)
+#define RID_SVXSTR_BMP8 (RID_SVX_START + 721)
+#define RID_SVXSTR_BMP9 (RID_SVX_START + 722)
+#define RID_SVXSTR_BMP10 (RID_SVX_START + 723)
+#define RID_SVXSTR_BMP11 (RID_SVX_START + 724)
+#define RID_SVXSTR_BMP12 (RID_SVX_START + 725)
+#define RID_SVXSTR_BMP13 (RID_SVX_START + 726)
+#define RID_SVXSTR_BMP14 (RID_SVX_START + 727)
+#define RID_SVXSTR_BMP15 (RID_SVX_START + 728)
+#define RID_SVXSTR_BMP16 (RID_SVX_START + 729)
+#define RID_SVXSTR_BMP17 (RID_SVX_START + 730)
+#define RID_SVXSTR_BMP18 (RID_SVX_START + 731)
+#define RID_SVXSTR_BMP19 (RID_SVX_START + 732)
+#define RID_SVXSTR_BMP20 (RID_SVX_START + 733)
+#define RID_SVXSTR_BMP21 (RID_SVX_START + 734)
+#define RID_SVXSTR_BMP_DEF_START RID_SVXSTR_BMP0_DEF
+#define RID_SVXSTR_BMP_DEF_END RID_SVXSTR_BMP21_DEF
+#define RID_SVXSTR_BMP_START RID_SVXSTR_BMP0
+#define RID_SVXSTR_BMP_END RID_SVXSTR_BMP21
+
+// Default-Linestyle-Names
+#define RID_SVXSTR_DASH0_DEF (RID_SVX_START + 740)
+#define RID_SVXSTR_DASH1_DEF (RID_SVX_START + 741)
+#define RID_SVXSTR_DASH2_DEF (RID_SVX_START + 742)
+#define RID_SVXSTR_DASH3_DEF (RID_SVX_START + 743)
+#define RID_SVXSTR_DASH4_DEF (RID_SVX_START + 744)
+#define RID_SVXSTR_DASH5_DEF (RID_SVX_START + 745)
+#define RID_SVXSTR_DASH6_DEF (RID_SVX_START + 746)
+#define RID_SVXSTR_DASH7_DEF (RID_SVX_START + 747)
+#define RID_SVXSTR_DASH8_DEF (RID_SVX_START + 748)
+#define RID_SVXSTR_DASH9_DEF (RID_SVX_START + 749)
+#define RID_SVXSTR_DASH10_DEF (RID_SVX_START + 750)
+#define RID_SVXSTR_DASH11_DEF (RID_SVX_START + 751)
+#define RID_SVXSTR_DASH0 (RID_SVX_START + 752)
+#define RID_SVXSTR_DASH1 (RID_SVX_START + 753)
+#define RID_SVXSTR_DASH2 (RID_SVX_START + 754)
+#define RID_SVXSTR_DASH3 (RID_SVX_START + 755)
+#define RID_SVXSTR_DASH4 (RID_SVX_START + 756)
+#define RID_SVXSTR_DASH5 (RID_SVX_START + 757)
+#define RID_SVXSTR_DASH6 (RID_SVX_START + 758)
+#define RID_SVXSTR_DASH7 (RID_SVX_START + 759)
+#define RID_SVXSTR_DASH8 (RID_SVX_START + 760)
+#define RID_SVXSTR_DASH9 (RID_SVX_START + 761)
+#define RID_SVXSTR_DASH10 (RID_SVX_START + 762)
+#define RID_SVXSTR_DASH11 (RID_SVX_START + 763)
+#define RID_SVXSTR_DASH_DEF_START RID_SVXSTR_DASH0_DEF
+#define RID_SVXSTR_DASH_DEF_END RID_SVXSTR_DASH11_DEF
+#define RID_SVXSTR_DASH_START RID_SVXSTR_DASH0
+#define RID_SVXSTR_DASH_END RID_SVXSTR_DASH11
+
+// Default-Line-End-Names
+#define RID_SVXSTR_LEND0_DEF (RID_SVX_START + 770)
+#define RID_SVXSTR_LEND1_DEF (RID_SVX_START + 771)
+#define RID_SVXSTR_LEND2_DEF (RID_SVX_START + 772)
+#define RID_SVXSTR_LEND3_DEF (RID_SVX_START + 773)
+#define RID_SVXSTR_LEND4_DEF (RID_SVX_START + 774)
+#define RID_SVXSTR_LEND5_DEF (RID_SVX_START + 775)
+#define RID_SVXSTR_LEND6_DEF (RID_SVX_START + 776)
+#define RID_SVXSTR_LEND7_DEF (RID_SVX_START + 777)
+#define RID_SVXSTR_LEND8_DEF (RID_SVX_START + 778)
+#define RID_SVXSTR_LEND9_DEF (RID_SVX_START + 779)
+#define RID_SVXSTR_LEND10_DEF (RID_SVX_START + 780)
+#define RID_SVXSTR_LEND11_DEF (RID_SVX_START + 781)
+#define RID_SVXSTR_LEND0 (RID_SVX_START + 782)
+#define RID_SVXSTR_LEND1 (RID_SVX_START + 783)
+#define RID_SVXSTR_LEND2 (RID_SVX_START + 784)
+#define RID_SVXSTR_LEND3 (RID_SVX_START + 785)
+#define RID_SVXSTR_LEND4 (RID_SVX_START + 786)
+#define RID_SVXSTR_LEND5 (RID_SVX_START + 787)
+#define RID_SVXSTR_LEND6 (RID_SVX_START + 788)
+#define RID_SVXSTR_LEND7 (RID_SVX_START + 789)
+#define RID_SVXSTR_LEND8 (RID_SVX_START + 790)
+#define RID_SVXSTR_LEND9 (RID_SVX_START + 791)
+#define RID_SVXSTR_LEND10 (RID_SVX_START + 792)
+#define RID_SVXSTR_LEND11 (RID_SVX_START + 793)
+#define RID_SVXSTR_LEND_DEF_START RID_SVXSTR_LEND0_DEF
+#define RID_SVXSTR_LEND_DEF_END RID_SVXSTR_LEND11_DEF
+#define RID_SVXSTR_LEND_START RID_SVXSTR_LEND0
+#define RID_SVXSTR_LEND_END RID_SVXSTR_LEND11
+
+#define RID_SVXSTR_QRY_PRINT_TITLE (RID_SVX_START + 802)
+#define RID_SVXSTR_QRY_PRINT_MSG (RID_SVX_START + 803)
+#define RID_SVXSTR_QRY_PRINT_ALL (RID_SVX_START + 804)
+#define RID_SVXSTR_QRY_PRINT_SELECTION (RID_SVX_START + 805)
+
+// strings for graphic attributes/undo
+#define RID_SVXSTR_GRAFCROP (RID_SVX_START + 820)
+#define RID_SVXSTR_UNDO_GRAFMODE (RID_SVX_START + 821)
+#define RID_SVXSTR_UNDO_GRAFRED (RID_SVX_START + 822)
+#define RID_SVXSTR_UNDO_GRAFGREEN (RID_SVX_START + 823)
+#define RID_SVXSTR_UNDO_GRAFBLUE (RID_SVX_START + 824)
+#define RID_SVXSTR_UNDO_GRAFLUMINANCE (RID_SVX_START + 825)
+#define RID_SVXSTR_UNDO_GRAFCONTRAST (RID_SVX_START + 826)
+#define RID_SVXSTR_UNDO_GRAFGAMMA (RID_SVX_START + 827)
+#define RID_SVXSTR_UNDO_GRAFTRANSPARENCY (RID_SVX_START + 828)
+#define RID_SVXSTR_UNDO_GRAFCROP (RID_SVXSTR_GRAFCROP)
+
+// listbox control for UNDO and REDO
+#define RID_SVXTBX_UNDO_REDO_CTRL (RID_SVX_START + 845)
+#define RID_SVXSTR_NUM_UNDO_ACTIONS (RID_SVX_START + 846)
+#define RID_SVXSTR_NUM_REDO_ACTIONS (RID_SVX_START + 847)
+#define RID_SVXSTR_NUM_UNDO_ACTION (RID_SVX_START + 848)
+#define RID_SVXSTR_NUM_REDO_ACTION (RID_SVX_START + 849)
+
+// Default-transparence-gradient-names
+#define RID_SVXSTR_TRASNGR0_DEF (RID_SVX_START + 850)
+#define RID_SVXSTR_TRASNGR0 (RID_SVX_START + 851)
+#define RID_SVXSTR_TRASNGR_DEF_START RID_SVXSTR_TRASNGR0_DEF
+#define RID_SVXSTR_TRASNGR_DEF_END RID_SVXSTR_TRASNGR0_DEF
+#define RID_SVXSTR_TRASNGR_START RID_SVXSTR_TRASNGR0
+#define RID_SVXSTR_TRASNGR_END RID_SVXSTR_TRASNGR0
+
+#define RID_SVXSTR_BORDER_CONTROL (RID_SVX_START + 852)
+
+// Accessibility strings. The actual string ids are defined in
+// svx/inc/accessibility.hrc, the strings are defined in
+// svx/source/accessibility/accessibility.src
+#define RID_SVXSTR_ACCESSIBILITY_START (RID_SVX_START + 860)
+#define RID_SVXSTR_ACCESSIBILITY_END (RID_SVX_START + 950)
+
+// 984: free
+#define RID_SVXFLOAT_EXTRUSION_DIRECTION (RID_SVX_START + 985)
+
+#define RID_SVX_EXTRUSION_BAR (RID_SVX_START + 986)
+#define RID_SVX_FONTWORK_BAR (RID_SVX_START + 987)
+
+#define RID_SVXFLOAT_EXTRUSION_DEPTH (RID_SVX_START + 988)
+#define RID_SVXFLOAT_EXTRUSION_LIGHTING (RID_SVX_START + 989)
+#define RID_SVXFLOAT_EXTRUSION_SURFACE (RID_SVX_START + 990)
+#define RID_SVXSTR_EXTRUSION_COLOR (RID_SVX_START + 991)
+
+#define RID_SVXSTR_DEPTH_0 (RID_SVX_START + 992)
+#define RID_SVXSTR_DEPTH_1 (RID_SVX_START + 993)
+#define RID_SVXSTR_DEPTH_2 (RID_SVX_START + 994)
+#define RID_SVXSTR_DEPTH_3 (RID_SVX_START + 995)
+#define RID_SVXSTR_DEPTH_4 (RID_SVX_START + 996)
+
+#define RID_SVXSTR_DEPTH_0_INCH (RID_SVX_START + 997)
+#define RID_SVXSTR_DEPTH_1_INCH (RID_SVX_START + 998)
+#define RID_SVXSTR_DEPTH_2_INCH (RID_SVX_START + 999)
+#define RID_SVXSTR_DEPTH_3_INCH (RID_SVX_START + 1000)
+#define RID_SVXSTR_DEPTH_4_INCH (RID_SVX_START + 1001)
+
+#define RID_SVXFLOAT_FONTWORK_ALIGNMENT (RID_SVX_START + 1002)
+#define RID_SVXFLOAT_FONTWORK_CHARSPACING (RID_SVX_START + 1003)
+
+/* #i35426# DR 2004-10-19: (RID_SVX_START+1002) and (RID_SVX_START+1003) are
+ already used for RID_SVXFLOAT_FONTWORK_ALIGNMENT and
+ RID_SVXFLOAT_FONTWORK_CHARSPACING above. But these IDs describe floating
+ windows, and the following IDs are for strings, so this is no conflict. */
+#define RID_SVXSTR_PAGES (RID_SVX_START + 1002)
+
+#define RID_SVXSTR_UNDO_APPLY_FONTWORK_SHAPE (RID_SVX_START + 1118)
+#define RID_SVXSTR_UNDO_APPLY_FONTWORK_SAME_LETTER_HEIGHT (RID_SVX_START + 1119)
+#define RID_SVXSTR_UNDO_APPLY_FONTWORK_ALIGNMENT (RID_SVX_START + 1120)
+#define RID_SVXSTR_UNDO_APPLY_FONTWORK_KERN_CHARACTER_PAIRS (RID_SVX_START + 1121)
+#define RID_SVXSTR_UNDO_APPLY_FONTWORK_CHARACTER_SPACING (RID_SVX_START + 1122)
+#define RID_SVXSTR_UNDO_APPLY_EXTRUSION_ON_OFF (RID_SVX_START + 1123)
+#define RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_DOWN (RID_SVX_START + 1124)
+#define RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_UP (RID_SVX_START + 1125)
+#define RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_LEFT (RID_SVX_START + 1126)
+#define RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_RIGHT (RID_SVX_START + 1127)
+#define RID_SVXSTR_UNDO_APPLY_EXTRUSION_DEPTH (RID_SVX_START + 1128)
+#define RID_SVXSTR_UNDO_APPLY_EXTRUSION_ORIENTATION (RID_SVX_START + 1129)
+#define RID_SVXSTR_UNDO_APPLY_EXTRUSION_PROJECTION (RID_SVX_START + 1130)
+#define RID_SVXSTR_UNDO_APPLY_EXTRUSION_LIGHTING (RID_SVX_START + 1131)
+#define RID_SVXSTR_UNDO_APPLY_EXTRUSION_BRIGHTNESS (RID_SVX_START + 1132)
+#define RID_SVXSTR_UNDO_APPLY_EXTRUSION_SURFACE (RID_SVX_START + 1133)
+#define RID_SVXSTR_UNDO_APPLY_EXTRUSION_COLOR (RID_SVX_START + 1134)
+
+#define RID_SVXSTR_SELMODE_BLK (RID_SVX_START + 1167)
+#define RID_SVXSTR_STYLEFAMILY_TABLEDESIGN (RID_SVX_START + 1168)
+ // if you add here, remember to adjust RID_SVXSTR_NEXTFREE
+
+#define RID_SVXSTR_BULLET_DESCRIPTIONS (RID_SVX_START + 1138)//?
+#define RID_SVXSTR_SINGLENUM_DESCRIPTIONS (RID_SVX_START + 1146)//?
+#define RID_SVXSTR_OUTLINENUM_DESCRIPTIONS (RID_SVX_START + 1154)//?
+#define RID_SVXSTR_BULLET_DESCRIPTION_0 (RID_SVXSTR_BULLET_DESCRIPTIONS + 0)//?
+#define RID_SVXSTR_BULLET_DESCRIPTION_1 (RID_SVXSTR_BULLET_DESCRIPTIONS + 1)//?
+#define RID_SVXSTR_BULLET_DESCRIPTION_2 (RID_SVXSTR_BULLET_DESCRIPTIONS + 2)//?
+#define RID_SVXSTR_BULLET_DESCRIPTION_3 (RID_SVXSTR_BULLET_DESCRIPTIONS + 3)//?
+#define RID_SVXSTR_BULLET_DESCRIPTION_4 (RID_SVXSTR_BULLET_DESCRIPTIONS + 4)//?
+#define RID_SVXSTR_BULLET_DESCRIPTION_5 (RID_SVXSTR_BULLET_DESCRIPTIONS + 5)//?
+#define RID_SVXSTR_BULLET_DESCRIPTION_6 (RID_SVXSTR_BULLET_DESCRIPTIONS + 6)//?
+#define RID_SVXSTR_BULLET_DESCRIPTION_7 (RID_SVXSTR_BULLET_DESCRIPTIONS + 7)//?
+#define RID_SVXSTR_SINGLENUM_DESCRIPTION_0 (RID_SVXSTR_SINGLENUM_DESCRIPTIONS + 0)//?
+#define RID_SVXSTR_SINGLENUM_DESCRIPTION_1 (RID_SVXSTR_SINGLENUM_DESCRIPTIONS + 1)//?
+#define RID_SVXSTR_SINGLENUM_DESCRIPTION_2 (RID_SVXSTR_SINGLENUM_DESCRIPTIONS + 2)//?
+#define RID_SVXSTR_SINGLENUM_DESCRIPTION_3 (RID_SVXSTR_SINGLENUM_DESCRIPTIONS + 3)//?
+#define RID_SVXSTR_SINGLENUM_DESCRIPTION_4 (RID_SVXSTR_SINGLENUM_DESCRIPTIONS + 4)//?
+#define RID_SVXSTR_SINGLENUM_DESCRIPTION_5 (RID_SVXSTR_SINGLENUM_DESCRIPTIONS + 5)//?
+#define RID_SVXSTR_SINGLENUM_DESCRIPTION_6 (RID_SVXSTR_SINGLENUM_DESCRIPTIONS + 6)//?
+#define RID_SVXSTR_SINGLENUM_DESCRIPTION_7 (RID_SVXSTR_SINGLENUM_DESCRIPTIONS + 7)//?
+#define RID_SVXSTR_OUTLINENUM_DESCRIPTION_0 (RID_SVXSTR_OUTLINENUM_DESCRIPTIONS + 0)//?
+#define RID_SVXSTR_OUTLINENUM_DESCRIPTION_1 (RID_SVXSTR_OUTLINENUM_DESCRIPTIONS + 1)//?
+#define RID_SVXSTR_OUTLINENUM_DESCRIPTION_2 (RID_SVXSTR_OUTLINENUM_DESCRIPTIONS + 2)//?
+#define RID_SVXSTR_OUTLINENUM_DESCRIPTION_3 (RID_SVXSTR_OUTLINENUM_DESCRIPTIONS + 3)//?
+#define RID_SVXSTR_OUTLINENUM_DESCRIPTION_4 (RID_SVXSTR_OUTLINENUM_DESCRIPTIONS + 4)//?
+#define RID_SVXSTR_OUTLINENUM_DESCRIPTION_5 (RID_SVXSTR_OUTLINENUM_DESCRIPTIONS + 5)//?
+#define RID_SVXSTR_OUTLINENUM_DESCRIPTION_6 (RID_SVXSTR_OUTLINENUM_DESCRIPTIONS + 6)//?
+#define RID_SVXSTR_OUTLINENUM_DESCRIPTION_7 (RID_SVXSTR_OUTLINENUM_DESCRIPTIONS + 7)//?
+
+#define RID_SVXSTR_FINDBAR_FIND (RID_SVX_START + 1190)
+
+#define RID_SVXSTR_NEXTFREE (RID_SVX_START + 1191)
+
+// ----------------------------------------------------------------------------
+// if we have _a_lot_ time, we should group the resource ids by type, instead
+// of grouping them by semantics. The reason is that resource ids have to be
+// unique relative to a fixed type (you can't have two dialogs with the same
+// resource id), but they do not need to be unique gloablly (means you can have
+// a dialog and a string, both with the same id)
+// I suggest sticking to per-type ids instead of per-semantic ids, this is
+// better maintainable (IMO), and does not waste that much ids
+// fs@openoffice.org
+
+// ----------------------------------------------------------------------------
+// "Window" resource ids
+
+
+// ----------------------------------------------------------------------------
+// "ModalDialog" resource ids
+
+#define RID_SVX_MDLG_FONTWORK_GALLERY ( RID_SVX_START + 2 )
+#define RID_SVX_MDLG_EXTRUSION_DEPTH ( RID_SVX_START + 3 )
+
+// ----------------------------------------------------------------------------
+// "Menu" resource ids
+#define RID_SVX_MDLG_SCRIPTORG_NEWLIB ( RID_SVX_START + 7 )
+#define RID_SVX_MDLG_FONTWORK_CHARSPACING ( RID_SVX_START + 19 )
+
+// ResId fuer den ImportClipboard-Dialog
+// depricated
+//#define RID_SVXDLG_CLIPBOARD ( RID_SVX_START + 9 )
+
+// ResId fuer den Sonderzeichen-Dialog
+
+// allgemeine DBMgr-Dialoge
+// depricated
+//#define RID_SVX_DBSELDLG ( RID_SVX_START + 11 )
+//#define RID_SVX_DBEDDLG ( RID_SVX_START + 12 )
+//#define RID_SVX_DBLOGON ( RID_SVX_START + 13 )
+//#define RID_SVX_RECDLG ( RID_SVX_START + 14 )
+//#define RID_SVX_BRSEEKDLG ( RID_SVX_START + 15 )
+//#define RID_SVX_BRCFGDLG ( RID_SVX_START + 16 )
+//#define RID_SVX_BRSORTDLG ( RID_SVX_START + 17 )
+
+// document recovery and error report
+// recycling ids from DBMgr
+#define RID_SVX_MDLG_DOCRECOVERY_PROGR ( RID_SVX_START + 11 )
+#define RID_SVX_MDLG_DOCRECOVERY_BROKEN ( RID_SVX_START + 12 )
+#define RID_SVX_MDLG_ERR_REP_OPTIONS ( RID_SVX_START + 13 )
+#define RID_SVX_MDLG_ERR_REP_PREVIEW ( RID_SVX_START + 14 )
+
+#define RID_SVX_TABDLG_DOCRECOVERY ( RID_SVX_START + 0 )
+
+#define RID_SVXPAGE_DOCRECOVERY_SAVE ( RID_SVX_START + 8 )
+#define RID_SVXPAGE_DOCRECOVERY_RECOVER ( RID_SVX_START + 9 )
+#define RID_SVXPAGE_ERR_REP_WELCOME ( RID_SVX_START + 10 )
+#define RID_SVXPAGE_ERR_REP_SEND ( RID_SVX_START + 11 )
+
+// ----------------------------------------------------------------------------
+
+// !!!! double defined ID's (see below) !!!
+#define RID_OFA_AUTOCORR_DLG (RID_OFA_START + 101)
+
+#define RID_OFA_GENERAL_OPTIONS_DLG (RID_OFA_START + 105)
+#define RID_OFADLG_INTERNET (RID_OFA_START + 106)
+#define RID_OFA_TABNEW_DLG (RID_OFA_START + 107)
+#define RID_OFADLG_BROWSER (RID_OFA_START + 108)
+#define RID_OFA_FORMNEW_DLG (RID_OFA_START + 112)
+#define RID_OFA_TABPROPERTIES (RID_OFA_START + 113)
+#define RID_OFADLG_REGISTRATION (RID_OFA_START + 114)
+#define RID_OFADLG_AWCP_VALUES (RID_OFA_START + 117)
+
+// TabPages --------------------------------------------------------------
+
+// !!!! double defined ID's (see above) !!!
+
+#define OFA_TP_APPEARANCE (RID_OFA_START + 203)
+#define OFA_TP_TABPROPERTIES_GENERAL (RID_OFA_START + 204)
+
+//die RID_??_TP_* stehen nochmal im offids.hrc
+
+#define RID_SW_TP_LAYOUT_OPT (RID_OFA_START + 207)
+#define RID_SW_TP_OPTINSERT_PAGE (RID_OFA_START + 213)
+#define RID_SW_TP_OPTTEST_PAGE (RID_OFA_START + 215)
+#define RID_SW_TP_OPTSRCVIEW (RID_OFA_START + 216)
+#define RID_SW_TP_OPTINSERT_HTML_PAGE (RID_OFA_START + 238)
+#define RID_SW_TP_HTML_LAYOUT_OPT (RID_OFA_START + 241)
+#define SID_SD_TP_LAYOUT (RID_OFA_START + 226)
+#define SID_SD_TP_SCALE (RID_OFA_START + 228)
+#define SID_SD_TP_GRID (RID_OFA_START + 229)
+#define SID_SI_TP_LAYOUT (RID_OFA_START + 233)
+#define SID_SI_TP_GRID (RID_OFA_START + 235)
+#define SID_SC_TP_MISC (RID_OFA_START + 239)
+#define OFA_TP_TABPROPERTIES_TEXT (RID_OFA_START + 245)
+#define OFA_TP_HELPERPROG (RID_OFA_START + 249)
+
+#endif
+
diff --git a/svx/inc/svx/dlgctl3d.hxx b/svx/inc/svx/dlgctl3d.hxx
new file mode 100644
index 000000000000..aa85b4e6a391
--- /dev/null
+++ b/svx/inc/svx/dlgctl3d.hxx
@@ -0,0 +1,215 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_DLGCTL3D_HXX
+#define _SVX_DLGCTL3D_HXX
+
+#include <vcl/ctrl.hxx>
+#include <vcl/scrbar.hxx>
+#include <vcl/button.hxx>
+#include <svl/itemset.hxx>
+#include "svx/svxdllapi.h"
+#include <basegfx/vector/b3dvector.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+class FmFormModel;
+class FmFormPage;
+class E3dView;
+class E3dPolyScene;
+class E3dObject;
+
+//////////////////////////////////////////////////////////////////////////////
+
+#define PREVIEW_OBJECTTYPE_SPHERE 0x0000
+#define PREVIEW_OBJECTTYPE_CUBE 0x0001
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SVX_DLLPUBLIC Svx3DPreviewControl : public Control
+{
+protected:
+ FmFormModel* mpModel;
+ FmFormPage* mpFmPage;
+ E3dView* mp3DView;
+ E3dPolyScene* mpScene;
+ E3dObject* mp3DObj;
+ sal_uInt16 mnObjectType;
+
+ void Construct();
+
+public:
+ Svx3DPreviewControl(Window* pParent, const ResId& rResId);
+ Svx3DPreviewControl(Window* pParent, WinBits nStyle = 0);
+ ~Svx3DPreviewControl();
+
+ virtual void Paint( const Rectangle& rRect );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void Resize();
+
+ void Reset();
+ virtual void SetObjectType(sal_uInt16 nType);
+ sal_uInt16 GetObjectType() const { return( mnObjectType ); }
+ SfxItemSet Get3DAttributes() const;
+ virtual void Set3DAttributes(const SfxItemSet& rAttr);
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SVX_DLLPUBLIC Svx3DLightControl : public Svx3DPreviewControl
+{
+ // Callback for interactive changes
+ Link maUserInteractiveChangeCallback;
+ Link maUserSelectionChangeCallback;
+ Link maChangeCallback;
+ Link maSelectionChangeCallback;
+
+ // lights
+ sal_uInt32 maSelectedLight;
+
+ // extra objects for light control
+ E3dObject* mpExpansionObject;
+ E3dObject* mpLampBottomObject;
+ E3dObject* mpLampShaftObject;
+ std::vector< E3dObject* > maLightObjects;
+
+ // 3d rotations of object
+ double mfRotateX;
+ double mfRotateY;
+ double mfRotateZ;
+
+ // interaction parameters
+ Point maActionStartPoint;
+ sal_Int32 mnInteractionStartDistance;
+ double mfSaveActionStartHor;
+ double mfSaveActionStartVer;
+ double mfSaveActionStartRotZ;
+
+ // bitfield
+ unsigned mbMouseMoved : 1;
+ unsigned mbGeometrySelected : 1;
+
+ void Construct2();
+ void ConstructLightObjects();
+ void AdaptToSelectedLight();
+ void TrySelection(Point aPosPixel);
+
+public:
+ Svx3DLightControl(Window* pParent, const ResId& rResId);
+ Svx3DLightControl(Window* pParent, WinBits nStyle = 0);
+ ~Svx3DLightControl();
+
+ virtual void Paint(const Rectangle& rRect);
+ virtual void MouseButtonDown(const MouseEvent& rMEvt);
+ virtual void Tracking( const TrackingEvent& rTEvt );
+ virtual void Resize();
+
+ virtual void SetObjectType(sal_uInt16 nType);
+
+ // User Callback eintragen
+ void SetUserInteractiveChangeCallback(Link aNew) { maUserInteractiveChangeCallback = aNew; }
+ void SetUserSelectionChangeCallback(Link aNew) { maUserSelectionChangeCallback = aNew; }
+ void SetChangeCallback(Link aNew) { maChangeCallback = aNew; }
+ void SetSelectionChangeCallback(Link aNew) { maSelectionChangeCallback = aNew; }
+
+ // selection checks
+ bool IsSelectionValid();
+ bool IsGeometrySelected() { return mbGeometrySelected; }
+
+ // get/set position of selected lamp in polar coordinates, Hor:[0..360.0[ and Ver:[-90..90] degrees
+ void GetPosition(double& rHor, double& rVer);
+ void SetPosition(double fHor, double fVer);
+
+ // get/set rotation of 3D object
+ void SetRotation(double fRotX, double fRotY, double fRotZ);
+ void GetRotation(double& rRotX, double& rRotY, double& rRotZ);
+
+ void SelectLight(sal_uInt32 nLightNumber);
+ virtual void Set3DAttributes(const SfxItemSet& rAttr);
+ sal_uInt32 GetSelectedLight() { return maSelectedLight; }
+
+ // light data access
+ bool GetLightOnOff(sal_uInt32 nNum) const;
+ Color GetLightColor(sal_uInt32 nNum) const;
+ basegfx::B3DVector GetLightDirection(sal_uInt32 nNum) const;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SVX_DLLPUBLIC SvxLightCtl3D : public Control
+{
+private:
+ // local controls
+ Svx3DLightControl maLightControl;
+ ScrollBar maHorScroller;
+ ScrollBar maVerScroller;
+ PushButton maSwitcher;
+
+ // Callback bei interaktiven Aenderungen
+ Link maUserInteractiveChangeCallback;
+ Link maUserSelectionChangeCallback;
+
+public:
+ SvxLightCtl3D( Window* pParent, const ResId& rResId);
+ SvxLightCtl3D( Window* pParent, WinBits nStyle = 0);
+ ~SvxLightCtl3D();
+
+ // Reagiere auf Groessenaenderungen
+ virtual void Resize();
+ void NewLayout();
+
+ // Selektion auf Gueltigkeit pruefen
+ void CheckSelection();
+
+ // Um weitere Einstellungen nach Aussen zu bringen...
+ Svx3DLightControl& GetSvx3DLightControl() { return maLightControl; }
+
+ // User Callback eintragen
+ void SetUserInteractiveChangeCallback(Link aNew) { maUserInteractiveChangeCallback = aNew; }
+ void SetUserSelectionChangeCallback(Link aNew) { maUserSelectionChangeCallback = aNew; }
+
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void GetFocus();
+ virtual void LoseFocus();
+
+protected:
+
+ DECL_LINK( InternalInteractiveChange, void*);
+ DECL_LINK( InternalSelectionChange, void*);
+ DECL_LINK( ScrollBarMove, void*);
+ DECL_LINK( ButtonPress, void*);
+
+ // Lokale Parameter Initialisieren
+ void Init();
+
+ void move( double fDeltaHor, double fDeltaVer );
+};
+
+#endif // _SCH_DLGCTL3D_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/inc/svx/dlgctrl.hxx b/svx/inc/svx/dlgctrl.hxx
new file mode 100644
index 000000000000..a6c2ce21829e
--- /dev/null
+++ b/svx/inc/svx/dlgctrl.hxx
@@ -0,0 +1,539 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_DLG_CTRL_HXX
+#define _SVX_DLG_CTRL_HXX
+
+// include ---------------------------------------------------------------
+
+#include <svtools/ctrlbox.hxx>
+#include <sfx2/tabdlg.hxx>
+#include "svx/svxdllapi.h"
+#include <svx/rectenum.hxx>
+#include <vcl/graph.hxx>
+#ifndef _XTABLE_HXX
+class XBitmapEntry;
+class XBitmapList;
+class XColorEntry;
+class XColorTable;
+class XDash;
+class XDashEntry;
+class XDashList;
+class XGradient;
+class XGradientEntry;
+class XGradientList;
+class XHatch;
+class XHatchEntry;
+class XHatchList;
+class XLineEndEntry;
+class XLineEndList;
+class XFillAttrSetItem;
+#endif
+
+class XOBitmap;
+class XOutdevItemPool;
+
+namespace com { namespace sun { namespace star { namespace awt {
+ struct Point;
+} } } }
+
+/*************************************************************************
+|*
+|* Von SfxTabPage abgeleitet, um vom Control ueber virtuelle Methode
+|* benachrichtigt werden zu koennen.
+|*
+\************************************************************************/
+class SvxTabPage : public SfxTabPage
+{
+
+public:
+ SvxTabPage( Window* pParent, ResId Id, const SfxItemSet& rInAttrs ) :
+ SfxTabPage( pParent, Id, rInAttrs ) {}
+
+ virtual void PointChanged( Window* pWindow, RECT_POINT eRP ) = 0;
+};
+
+/*************************************************************************
+|*
+|* Control zur Darstellung und Auswahl der Eckpunkte (und Mittelpunkt)
+|* eines Objekts
+|*
+\************************************************************************/
+typedef sal_uInt16 CTL_STATE;
+#define CS_NOHORZ 1 // no horizontal input information is used
+#define CS_NOVERT 2 // no vertikal input information is used
+
+class SvxRectCtlAccessibleContext;
+
+class SVX_DLLPUBLIC SvxRectCtl : public Control
+{
+private:
+ SVX_DLLPRIVATE void InitSettings( sal_Bool bForeground, sal_Bool bBackground );
+ SVX_DLLPRIVATE void InitRectBitmap( void );
+ SVX_DLLPRIVATE Bitmap& GetRectBitmap( void );
+ SVX_DLLPRIVATE void Resize_Impl();
+
+protected:
+ SvxRectCtlAccessibleContext* pAccContext;
+ sal_uInt16 nBorderWidth;
+ sal_uInt16 nRadius;
+ Size aSize;
+ Point aPtLT, aPtMT, aPtRT;
+ Point aPtLM, aPtMM, aPtRM;
+ Point aPtLB, aPtMB, aPtRB;
+ Point aPtNew;
+ RECT_POINT eRP, eDefRP;
+ CTL_STYLE eCS;
+ Bitmap* pBitmap;
+ CTL_STATE m_nState;
+
+ // #103516# Added a possibility to completely disable this control
+ sal_Bool mbCompleteDisable;
+
+ RECT_POINT GetRPFromPoint( Point ) const;
+ Point GetPointFromRP( RECT_POINT ) const;
+ void SetFocusRect( const Rectangle* pRect = NULL ); // pRect == NULL -> calculate rectangle in method
+ Point SetActualRPWithoutInvalidate( RECT_POINT eNewRP ); // returns the last point
+
+ virtual void GetFocus();
+ virtual void LoseFocus();
+
+ Point GetApproxLogPtFromPixPt( const Point& rRoughPixelPoint ) const;
+public:
+ SvxRectCtl( Window* pParent, const ResId& rResId, RECT_POINT eRpt = RP_MM,
+ sal_uInt16 nBorder = 200, sal_uInt16 nCircle = 80, CTL_STYLE eStyle = CS_RECT );
+ virtual ~SvxRectCtl();
+
+ virtual void Paint( const Rectangle& rRect );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void KeyInput( const KeyEvent& rKeyEvt );
+ virtual void StateChanged( StateChangedType nStateChange );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ virtual void Resize();
+
+ void Reset();
+ RECT_POINT GetActualRP() const;
+ void SetActualRP( RECT_POINT eNewRP );
+
+ void SetState( CTL_STATE nState );
+
+ sal_uInt8 GetNumOfChilds( void ) const; // returns number of usable radio buttons
+
+ Rectangle CalculateFocusRectangle( void ) const;
+ Rectangle CalculateFocusRectangle( RECT_POINT eRectPoint ) const;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+
+ RECT_POINT GetApproxRPFromPixPt( const ::com::sun::star::awt::Point& rPixelPoint ) const;
+
+ // #103516# Added a possibility to completely disable this control
+ sal_Bool IsCompletelyDisabled() const { return mbCompleteDisable; }
+ void DoCompletelyDisable(sal_Bool bNew);
+};
+
+/*************************************************************************
+|*
+|* Control zur Darstellung und Auswahl des Winkels der Eckpunkte
+|* eines Objekts
+|*
+\************************************************************************/
+class SvxAngleCtl : public SvxRectCtl
+{
+private:
+ void Initialize();
+
+protected:
+ Font aFont;
+ Size aFontSize;
+ sal_Bool bPositive;
+
+public:
+ SvxAngleCtl( Window* pParent, const ResId& rResId );
+ SvxAngleCtl( Window* pParent, const ResId& rResId, Size aSize );
+
+ void ChangeMetric()
+ { bPositive = !bPositive; }
+ virtual void Paint( const Rectangle& rRect );
+};
+
+/*************************************************************************
+|*
+|* Preview-Control zur Darstellung von Bitmaps
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC SvxBitmapCtl
+{
+protected:
+ Size aSize;
+ sal_uInt16 nLines;
+ Color aPixelColor, aBackgroundColor;
+ const sal_uInt16* pBmpArray;
+
+public:
+ SvxBitmapCtl( Window* pParent, const Size& rSize );
+ ~SvxBitmapCtl();
+
+ XOBitmap GetXBitmap();
+
+ void SetBmpArray( const sal_uInt16* pPixel ) { pBmpArray = pPixel; }
+ void SetLines( sal_uInt16 nLns ) { nLines = nLns; }
+ void SetPixelColor( Color aColor ) { aPixelColor = aColor; }
+ void SetBackgroundColor( Color aColor ) { aBackgroundColor = aColor; }
+};
+
+/*************************************************************************
+|*
+|* Control zum Editieren von Bitmaps
+|*
+\************************************************************************/
+class SVX_DLLPUBLIC SvxPixelCtl : public Control
+{
+private:
+ using OutputDevice::SetLineColor;
+
+protected:
+ sal_uInt16 nLines, nSquares;
+ Color aPixelColor;
+ Color aBackgroundColor;
+ Color aLineColor;
+ Size aRectSize;
+ sal_uInt16* pPixel;
+ sal_Bool bPaintable;
+
+ void ChangePixel( sal_uInt16 nPixel );
+
+public:
+ SvxPixelCtl( Window* pParent, const ResId& rResId,
+ sal_uInt16 nNumber = 8 );
+ ~SvxPixelCtl();
+
+ virtual void Paint( const Rectangle& rRect );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+
+ void SetXBitmap( const XOBitmap& rXOBitmap );
+
+ void SetPixelColor( const Color& rCol ) { aPixelColor = rCol; }
+ void SetBackgroundColor( const Color& rCol ) { aBackgroundColor = rCol; }
+ void SetLineColor( const Color& rCol ) { aLineColor = rCol; }
+
+ sal_uInt16 GetLineCount() const { return nLines; }
+ Color GetPixelColor() const { return aPixelColor; }
+ Color GetBackgroundColor() const { return aBackgroundColor; }
+
+ sal_uInt16 GetBitmapPixel( const sal_uInt16 nPixelNumber );
+ sal_uInt16* GetBitmapPixelPtr() { return pPixel; }
+
+ void SetPaintable( sal_Bool bTmp ) { bPaintable = bTmp; }
+ void Reset();
+};
+
+/*************************************************************************
+|*
+|* ColorLB kann mit Farben und Namen gefuellt werden
+|*
+\************************************************************************/
+class SVX_DLLPUBLIC ColorLB : public ColorListBox
+{
+
+public:
+ ColorLB( Window* pParent, ResId Id ) : ColorListBox( pParent, Id ) {}
+ ColorLB( Window* pParent, WinBits aWB ) : ColorListBox( pParent, aWB ) {}
+
+ virtual void Fill( const XColorTable* pTab );
+
+ void Append( XColorEntry* pEntry, Bitmap* pBmp = NULL );
+ void Modify( XColorEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL );
+};
+
+/*************************************************************************
+|*
+|* HatchingLB
+|*
+\************************************************************************/
+class SVX_DLLPUBLIC HatchingLB : public ListBox
+{
+
+public:
+ HatchingLB( Window* pParent, ResId Id, sal_Bool bUserDraw = sal_True );
+ HatchingLB( Window* pParent, WinBits aWB, sal_Bool bUserDraw = sal_True );
+
+ virtual void Fill( const XHatchList* pList );
+ virtual void UserDraw( const UserDrawEvent& rUDEvt );
+
+ void Append( XHatchEntry* pEntry, Bitmap* pBmp = NULL );
+ void Modify( XHatchEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL );
+ void SelectEntryByList( const XHatchList* pList, const String& rStr,
+ const XHatch& rXHatch, sal_uInt16 nDist = 0 );
+
+private:
+ XHatchList* mpList;
+ sal_Bool mbUserDraw;
+};
+
+/*************************************************************************
+|*
+|* GradientLB
+|*
+\************************************************************************/
+class SVX_DLLPUBLIC GradientLB : public ListBox
+{
+public:
+ GradientLB( Window* pParent, ResId Id, sal_Bool bUserDraw = sal_True );
+ GradientLB( Window* pParent, WinBits aWB, sal_Bool bUserDraw = sal_True );
+
+ virtual void Fill( const XGradientList* pList );
+ virtual void UserDraw( const UserDrawEvent& rUDEvt );
+
+ void Append( XGradientEntry* pEntry, Bitmap* pBmp = NULL );
+ void Modify( XGradientEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL );
+ void SelectEntryByList( const XGradientList* pList, const String& rStr,
+ const XGradient& rXGradient, sal_uInt16 nDist = 0 );
+
+private:
+ XGradientList* mpList;
+ sal_Bool mbUserDraw;
+};
+
+/*************************************************************************
+|*
+|* BitmapLB
+|*
+\************************************************************************/
+class SVX_DLLPUBLIC BitmapLB : public ListBox
+{
+public:
+ BitmapLB( Window* pParent, ResId Id, sal_Bool bUserDraw = sal_True );
+
+ virtual void Fill( const XBitmapList* pList );
+ virtual void UserDraw( const UserDrawEvent& rUDEvt );
+
+ void Append( XBitmapEntry* pEntry, Bitmap* pBmp = NULL );
+ void Modify( XBitmapEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL );
+ void SelectEntryByList( const XBitmapList* pList, const String& rStr,
+ const Bitmap& rBmp);
+
+private:
+ VirtualDevice aVD;
+ Bitmap aBitmap;
+
+ XBitmapList* mpList;
+ sal_Bool mbUserDraw;
+
+ SVX_DLLPRIVATE void SetVirtualDevice();
+};
+
+/*************************************************************************
+|*
+|* FillAttrLB vereint alle Fuellattribute in einer ListBox
+|*
+\************************************************************************/
+class FillAttrLB : public ColorListBox
+{
+private:
+ VirtualDevice aVD;
+ Bitmap aBitmap;
+
+ void SetVirtualDevice();
+
+public:
+ FillAttrLB( Window* pParent, ResId Id );
+ FillAttrLB( Window* pParent, WinBits aWB );
+
+ virtual void Fill( const XColorTable* pTab );
+ virtual void Fill( const XHatchList* pList );
+ virtual void Fill( const XGradientList* pList );
+ virtual void Fill( const XBitmapList* pList );
+
+ void SelectEntryByList( const XBitmapList* pList, const String& rStr,
+ const Bitmap& rBmp);
+};
+
+/*************************************************************************
+|*
+|* FillTypeLB
+|*
+\************************************************************************/
+class FillTypeLB : public ListBox
+{
+
+public:
+ FillTypeLB( Window* pParent, ResId Id ) : ListBox( pParent, Id ) {}
+ FillTypeLB( Window* pParent, WinBits aWB ) : ListBox( pParent, aWB ) {}
+
+ virtual void Fill();
+};
+
+/*************************************************************************
+|*
+|* LineLB
+|*
+\************************************************************************/
+class SVX_DLLPUBLIC LineLB : public ListBox
+{
+
+public:
+ LineLB( Window* pParent, ResId Id ) : ListBox( pParent, Id ) {}
+ LineLB( Window* pParent, WinBits aWB ) : ListBox( pParent, aWB ) {}
+
+ virtual void Fill( const XDashList* pList );
+
+ void Append( XDashEntry* pEntry, Bitmap* pBmp = NULL );
+ void Modify( XDashEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL );
+ void SelectEntryByList( const XDashList* pList, const String& rStr,
+ const XDash& rDash, sal_uInt16 nDist = 0 );
+ void FillStyles();
+};
+
+/*************************************************************************
+|*
+|* LineEndsLB
+|*
+\************************************************************************/
+class SVX_DLLPUBLIC LineEndLB : public ListBox
+{
+
+public:
+ LineEndLB( Window* pParent, ResId Id ) : ListBox( pParent, Id ) {}
+ LineEndLB( Window* pParent, WinBits aWB ) : ListBox( pParent, aWB ) {}
+
+ virtual void Fill( const XLineEndList* pList, sal_Bool bStart = sal_True );
+
+ void Append( XLineEndEntry* pEntry, Bitmap* pBmp = NULL,
+ sal_Bool bStart = sal_True );
+ void Modify( XLineEndEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL,
+ sal_Bool bStart = sal_True );
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SdrObject;
+class SdrModel;
+
+class SvxPreviewBase : public Control
+{
+private:
+ SdrModel* mpModel;
+ VirtualDevice* mpBufferDevice;
+
+protected:
+ void InitSettings(bool bForeground, bool bBackground);
+
+ // prepare buffered paint
+ void LocalPrePaint();
+
+ // end and output buffered paint
+ void LocalPostPaint();
+
+public:
+ SvxPreviewBase( Window* pParent, const ResId& rResId );
+ virtual ~SvxPreviewBase();
+
+ // change support
+ virtual void StateChanged(StateChangedType nStateChange);
+ virtual void DataChanged(const DataChangedEvent& rDCEvt);
+
+ // dada read access
+ SdrModel& getModel() const { return *mpModel; }
+ OutputDevice& getBufferDevice() const { return *mpBufferDevice; }
+};
+
+/*************************************************************************
+|*
+|* SvxLinePreview
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC SvxXLinePreview : public SvxPreviewBase
+{
+private:
+ SdrObject* mpLineObjA;
+ SdrObject* mpLineObjB;
+ SdrObject* mpLineObjC;
+
+ //#58425# Symbole auf einer Linie (z.B. StarChart)
+ Graphic* mpGraphic;
+ sal_Bool mbWithSymbol;
+ Size maSymbolSize;
+
+public:
+ SvxXLinePreview( Window* pParent, const ResId& rResId );
+ virtual ~SvxXLinePreview();
+
+ void SetLineAttributes(const SfxItemSet& rItemSet);
+
+ void ShowSymbol( sal_Bool b ) { mbWithSymbol = b; };
+ void SetSymbol( Graphic* p, const Size& s );
+ void ResizeSymbol( const Size& s );
+
+ virtual void Paint( const Rectangle& rRect );
+};
+
+/*************************************************************************
+|*
+|* SvxXRectPreview
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC SvxXRectPreview : public SvxPreviewBase
+{
+private:
+ SdrObject* mpRectangleObject;
+
+public:
+ SvxXRectPreview( Window* pParent, const ResId& rResId );
+ virtual ~SvxXRectPreview();
+
+ void SetAttributes(const SfxItemSet& rItemSet);
+
+ virtual void Paint( const Rectangle& rRect );
+};
+
+/*************************************************************************
+|*
+|* SvxXShadowPreview
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC SvxXShadowPreview : public SvxPreviewBase
+{
+private:
+ SdrObject* mpRectangleObject;
+ SdrObject* mpRectangleShadow;
+
+public:
+ SvxXShadowPreview( Window* pParent, const ResId& rResId );
+ virtual ~SvxXShadowPreview();
+
+ void SetRectangleAttributes(const SfxItemSet& rItemSet);
+ void SetShadowAttributes(const SfxItemSet& rItemSet);
+ void SetShadowPosition(const Point& rPos);
+
+ virtual void Paint( const Rectangle& rRect );
+};
+
+#endif // _SVX_DLG_CTRL_HXX
+
diff --git a/svx/inc/svx/dlgutil.hxx b/svx/inc/svx/dlgutil.hxx
new file mode 100644
index 000000000000..9f0d5190daed
--- /dev/null
+++ b/svx/inc/svx/dlgutil.hxx
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_DLGUTIL_HXX
+#define _SVX_DLGUTIL_HXX
+
+// include ---------------------------------------------------------------
+#include <svtools/unitconv.hxx>
+#include <svx/svxdllapi.h>
+
+// macro -----------------------------------------------------------------
+
+// typedef ---------------------------------------------------------------
+
+// Functions -------------------------------------------------------------
+class SfxItemSet;
+
+SVX_DLLPUBLIC FieldUnit GetModuleFieldUnit( const SfxItemSet& );
+
+#define OUTPUT_DRAWMODE_COLOR (DRAWMODE_DEFAULT)
+#define OUTPUT_DRAWMODE_CONTRAST (DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT)
+
+#endif
+
diff --git a/svx/inc/svx/drawitem.hxx b/svx/inc/svx/drawitem.hxx
new file mode 100644
index 000000000000..1f8536068c76
--- /dev/null
+++ b/svx/inc/svx/drawitem.hxx
@@ -0,0 +1,246 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_DRAWITEM_HXX
+#define _SVX_DRAWITEM_HXX
+
+// include ---------------------------------------------------------------
+
+#include <svl/poolitem.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/drawing/LineDash.hpp>
+#include "svx/svxdllapi.h"
+
+//==================================================================
+// SvxColorTableItem
+//==================================================================
+
+class XColorTable;
+
+class SVX_DLLPUBLIC SvxColorTableItem: public SfxPoolItem
+{
+ XColorTable* pColorTable;
+
+public:
+ TYPEINFO();
+ SvxColorTableItem();
+ SvxColorTableItem( XColorTable* pTable,
+ sal_uInt16 nWhich );
+ SvxColorTableItem( const SvxColorTableItem& );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId );
+
+ XColorTable* GetColorTable() const { return pColorTable; }
+ void SetColorTable( XColorTable* pTable ) {
+ pColorTable = pTable; }
+};
+
+
+//==================================================================
+// SvxGradientListItem
+//==================================================================
+
+
+class XGradientList;
+
+class SVX_DLLPUBLIC SvxGradientListItem: public SfxPoolItem
+{
+ XGradientList* pGradientList;
+
+public:
+ TYPEINFO();
+ SvxGradientListItem();
+ SvxGradientListItem( XGradientList* pList,
+ sal_uInt16 nWhich );
+ SvxGradientListItem( const SvxGradientListItem& );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId );
+
+ XGradientList* GetGradientList() const { return pGradientList; }
+ void SetGradientList( XGradientList* pList ) {
+ pGradientList = pList; }
+};
+
+
+
+//==================================================================
+// SvxHatchListItem
+//==================================================================
+
+
+class XHatchList;
+
+class SVX_DLLPUBLIC SvxHatchListItem: public SfxPoolItem
+{
+ XHatchList* pHatchList;
+
+public:
+ TYPEINFO();
+ SvxHatchListItem();
+ SvxHatchListItem( XHatchList* pList,
+ sal_uInt16 nWhich );
+ SvxHatchListItem( const SvxHatchListItem& );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId );
+
+ XHatchList* GetHatchList() const { return pHatchList; }
+ void SetHatchList( XHatchList* pList ) {
+ pHatchList = pList; }
+};
+
+
+
+//==================================================================
+// SvxBitmapListItem
+//==================================================================
+
+
+class XBitmapList;
+
+class SVX_DLLPUBLIC SvxBitmapListItem: public SfxPoolItem
+{
+ XBitmapList* pBitmapList;
+
+public:
+ TYPEINFO();
+ SvxBitmapListItem();
+ SvxBitmapListItem( XBitmapList* pBL,
+ sal_uInt16 nWhich );
+ SvxBitmapListItem( const SvxBitmapListItem& );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId );
+
+ XBitmapList* GetBitmapList() const { return pBitmapList; }
+ void SetBitmapList( XBitmapList* pList ) {
+ pBitmapList = pList; }
+};
+
+
+
+//==================================================================
+// SvxDashListItem
+//==================================================================
+
+
+class XDashList;
+
+class SVX_DLLPUBLIC SvxDashListItem: public SfxPoolItem
+{
+ XDashList* pDashList;
+
+public:
+ TYPEINFO();
+ SvxDashListItem();
+ SvxDashListItem( XDashList* pList,
+ sal_uInt16 nWhich );
+ SvxDashListItem( const SvxDashListItem& );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId );
+
+ XDashList* GetDashList() const { return pDashList; }
+ void SetDashList( XDashList* pList );
+};
+
+
+
+//==================================================================
+// SvxLineEndListItem
+//==================================================================
+
+
+class XLineEndList;
+
+class SVX_DLLPUBLIC SvxLineEndListItem: public SfxPoolItem
+{
+ XLineEndList* pLineEndList;
+
+public:
+ TYPEINFO();
+ SvxLineEndListItem();
+ SvxLineEndListItem( XLineEndList* pList,
+ sal_uInt16 nWhich );
+ SvxLineEndListItem( const SvxLineEndListItem& );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId );
+
+ XLineEndList* GetLineEndList() const { return pLineEndList; }
+ void SetLineEndList( XLineEndList* pList ) {
+ pLineEndList = pList; }
+};
+
+
+
+
+#endif
+
diff --git a/svx/inc/svx/dstribut_enum.hxx b/svx/inc/svx/dstribut_enum.hxx
new file mode 100644
index 000000000000..23001f888e70
--- /dev/null
+++ b/svx/inc/svx/dstribut_enum.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_DSTRIBUT_ENUM_HXX
+#define _SVX_DSTRIBUT_ENUM_HXX
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+enum SvxDistributeHorizontal
+{
+ SvxDistributeHorizontalNone = 0,
+ SvxDistributeHorizontalLeft,
+ SvxDistributeHorizontalCenter,
+ SvxDistributeHorizontalDistance,
+ SvxDistributeHorizontalRight
+};
+
+enum SvxDistributeVertical
+{
+ SvxDistributeVerticalNone = 0,
+ SvxDistributeVerticalTop,
+ SvxDistributeVerticalCenter,
+ SvxDistributeVerticalDistance,
+ SvxDistributeVerticalBottom
+};
+
+#endif // _SVX_DSTRIBUT_ENUM_HXX
+
diff --git a/svx/inc/svx/e3ditem.hxx b/svx/inc/svx/e3ditem.hxx
new file mode 100644
index 000000000000..aef5de313ed9
--- /dev/null
+++ b/svx/inc/svx/e3ditem.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVXE3DITEM_HXX
+#define _SVXE3DITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+#include "svx/svxdllapi.h"
+
+#ifndef _SVXVECT3DITEM_HXX
+#define _SVXVECT3DITEM_HXX
+
+class SvStream;
+
+class SVX_DLLPUBLIC SvxB3DVectorItem : public SfxPoolItem
+{
+ basegfx::B3DVector aVal;
+
+public:
+ TYPEINFO();
+ SvxB3DVectorItem();
+ SvxB3DVectorItem( sal_uInt16 nWhich, const basegfx::B3DVector& rVal );
+ SvxB3DVectorItem( sal_uInt16 nWhich, SvStream & );
+ SvxB3DVectorItem( const SvxB3DVectorItem& );
+ ~SvxB3DVectorItem();
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16 nVersion) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ const basegfx::B3DVector& GetValue() const { return aVal; }
+ void SetValue( const basegfx::B3DVector& rNewVal ) {
+ DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
+ aVal = rNewVal;
+ }
+
+ virtual sal_uInt16 GetVersion (sal_uInt16 nFileFormatVersion) const;
+};
+
+#endif
+
+#endif
+
+
diff --git a/svx/inc/svx/e3dsceneupdater.hxx b/svx/inc/svx/e3dsceneupdater.hxx
new file mode 100644
index 000000000000..ad38491945d5
--- /dev/null
+++ b/svx/inc/svx/e3dsceneupdater.hxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _E3D_SCENEUPDATER_HXX
+#define _E3D_SCENEUPDATER_HXX
+
+#include <svx/svxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SdrObject;
+class E3dScene;
+namespace drawinglayer { namespace geometry {
+ class ViewInformation3D;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+// This class is a helper to encapsulate 3D object changes which shall change the
+// scene's 2D geometry. E.g. when moving one 3D object in a scene, the visualisation
+// would not change since the scene's 2D attributes are defined by it's 2D object
+// transformation and the changed content would be projected to the same 2D bounds
+// as before. To reflect the fact that the 2D positions may 'change' for the user's
+// imagination, it is necessary to calculate a new 2D object transformation of the scene
+// (the SnapRect) using the old 3D transformation stack and the eventually changed
+// 3D content and tu use it. This is only wanted if changes to the scene's
+// content are intended to change the scene's 2D geometry attributes
+
+class SVX_DLLPUBLIC E3DModifySceneSnapRectUpdater
+{
+ // the scene which may be changed. This gets set to the outmost scene
+ // of the to-be-changed 3D object when the scene has a 3d transformation
+ // stack at construction time. In all other cases it's set to zero and
+ // no action needs to be taken
+ E3dScene* mpScene;
+
+ // the 3d transformation stack at the time of construction, valid when
+ // mpScene is not zero
+ drawinglayer::geometry::ViewInformation3D* mpViewInformation3D;
+
+public:
+ // the constructor evaluates and sets the members at construction time
+ E3DModifySceneSnapRectUpdater(const SdrObject* pObject);
+
+ // the destructor will take action if mpScene is not zero and modify the
+ // 2D geomeztry of the target scene
+ ~E3DModifySceneSnapRectUpdater();
+};
+
+#endif // _E3D_SCENEUPDATER_HXX
diff --git a/svx/inc/svx/e3dundo.hxx b/svx/inc/svx/e3dundo.hxx
new file mode 100644
index 000000000000..4c087ff4f88e
--- /dev/null
+++ b/svx/inc/svx/e3dundo.hxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _E3D_UNDO_HXX
+#define _E3D_UNDO_HXX
+
+#include <svx/svdundo.hxx>
+class E3DObject;
+#include <svx/scene3d.hxx>
+#include "svx/svxdllapi.h"
+
+class E3dView;
+
+/************************************************************************\
+|*
+|* Basisklasse fuer alle 3D-Undo-Aktionen.
+|*
+\************************************************************************/
+class E3dUndoAction : public SdrUndoAction
+{
+
+ protected :
+ E3dObject *pMy3DObj;
+
+ public:
+ TYPEINFO();
+ E3dUndoAction (SdrModel *pModel,
+ E3dObject *p3DObj) :
+ SdrUndoAction (*pModel),
+ pMy3DObj (p3DObj)
+ {
+ }
+
+ virtual ~E3dUndoAction ();
+
+ virtual sal_Bool CanRepeat(SfxRepeatTarget&) const;
+};
+
+/************************************************************************\
+|*
+|* Undo fuer 3D-Rotation ueber die Rotationsmatrizen (ob das wohl klappt ?)
+|*
+\************************************************************************/
+class E3dRotateUndoAction : public E3dUndoAction
+{
+ basegfx::B3DHomMatrix aMyOldRotation;
+ basegfx::B3DHomMatrix aMyNewRotation;
+
+ public:
+ TYPEINFO();
+ E3dRotateUndoAction (SdrModel *pModel,
+ E3dObject *p3DObj,
+ const basegfx::B3DHomMatrix &aOldRotation,
+ const basegfx::B3DHomMatrix &aNewRotation) :
+ E3dUndoAction (pModel, p3DObj),
+ aMyOldRotation (aOldRotation),
+ aMyNewRotation (aNewRotation)
+ {
+ }
+
+ virtual ~E3dRotateUndoAction ();
+
+ virtual void Undo();
+ virtual void Redo();
+
+};
+
+/************************************************************************\
+|*
+|* Undo fuer 3D-Attribute (Implementiert ueber Set3DAttributes())
+|*
+\************************************************************************/
+class SVX_DLLPUBLIC E3dAttributesUndoAction : public SdrUndoAction
+{
+ using SdrUndoAction::Repeat;
+
+ SdrObject* pObject;
+ E3dView* pView;
+ sal_Bool bUseSubObjects;
+
+ const SfxItemSet aNewSet;
+ const SfxItemSet aOldSet;
+
+ public:
+ TYPEINFO();
+ E3dAttributesUndoAction( SdrModel &rModel, E3dView* pView,
+ E3dObject* pInObject,
+ const SfxItemSet& rNewSet,
+ const SfxItemSet& rOldSet,
+ sal_Bool bUseSubObj);
+
+ virtual ~E3dAttributesUndoAction();
+
+ virtual sal_Bool CanRepeat(SfxRepeatTarget& rView) const;
+ virtual void Undo();
+ virtual void Redo();
+ virtual void Repeat();
+};
+
+#endif // _E3D_CUBE3D_HXX
diff --git a/svx/inc/svx/exthelpid.hrc b/svx/inc/svx/exthelpid.hrc
new file mode 100644
index 000000000000..360a4914c10e
--- /dev/null
+++ b/svx/inc/svx/exthelpid.hrc
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_EXTHELPID_HRC
+#define _SVX_EXTHELPID_HRC
+// include ---------------------------------------------------------------
+
+// these HIDs are used in SVX and also in other modules, mainly CUI
+// the reason is that different controls have the same help texts assigned
+// but are implemented in different libraries
+// to avoid "exporting" the whole HID list only those few ones that are shared
+// are moved to this exported (delivered) hrc file
+
+// Help-Ids --------------------------------------------------------------
+#define HID_GALLERY_ACTUALIZE "SVX_HID_GALLERY_ACTUALIZE"
+#define HID_GALLERY_TITLE "SVX_HID_GALLERY_TITLE"
+
+#endif
+
diff --git a/svx/inc/svx/extrud3d.hxx b/svx/inc/svx/extrud3d.hxx
new file mode 100644
index 000000000000..0d4372fba6a3
--- /dev/null
+++ b/svx/inc/svx/extrud3d.hxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _E3D_EXTRUD3D_HXX
+#define _E3D_EXTRUD3D_HXX
+
+#include <svx/obj3d.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* 3D-Extrusionsobjekt aus uebergebenem 2D-Polygon erzeugen
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC E3dExtrudeObj : public E3dCompoundObject
+{
+private:
+ // to allow sdr::properties::E3dExtrudeProperties access to SetGeometryValid()
+ friend class sdr::properties::E3dExtrudeProperties;
+
+ // Geometrie, die dieses Objekt bestimmt
+ basegfx::B2DPolyPolygon maExtrudePolygon;
+
+protected:
+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+ virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
+ void SetDefaultAttributes(E3dDefaultAttributes& rDefault);
+
+public:
+ TYPEINFO();
+
+ E3dExtrudeObj(E3dDefaultAttributes& rDefault, const basegfx::B2DPolyPolygon& rPP, double fDepth);
+ E3dExtrudeObj();
+
+ // PercentDiagonal: 0..100, before 0.0..0.5
+ sal_uInt16 GetPercentDiagonal() const
+ { return ((const Svx3DPercentDiagonalItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_PERCENT_DIAGONAL)).GetValue(); }
+
+ // BackScale: 0..100, before 0.0..1.0
+ sal_uInt16 GetPercentBackScale() const
+ { return ((const Svx3DBackscaleItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_BACKSCALE)).GetValue(); }
+
+ // BackScale: 0..100, before 0.0..1.0
+ sal_uInt32 GetExtrudeDepth() const
+ { return ((const Svx3DDepthItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_DEPTH)).GetValue(); }
+
+ // #107245# GetSmoothNormals() for bExtrudeSmoothed
+ sal_Bool GetSmoothNormals() const
+ { return ((const Svx3DSmoothNormalsItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_SMOOTH_NORMALS)).GetValue(); }
+
+ // #107245# GetSmoothLids() for bExtrudeSmoothFrontBack
+ sal_Bool GetSmoothLids() const
+ { return ((const Svx3DSmoothLidsItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_SMOOTH_LIDS)).GetValue(); }
+
+ // #107245# GetCharacterMode() for bExtrudeCharacterMode
+ sal_Bool GetCharacterMode() const
+ { return ((const Svx3DCharacterModeItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_CHARACTER_MODE)).GetValue(); }
+
+ // #107245# GetCloseFront() for bExtrudeCloseFront
+ sal_Bool GetCloseFront() const
+ { return ((const Svx3DCloseFrontItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_CLOSE_FRONT)).GetValue(); }
+
+ // #107245# GetCloseBack() for bExtrudeCloseBack
+ sal_Bool GetCloseBack() const
+ { return ((const Svx3DCloseBackItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_CLOSE_BACK)).GetValue(); }
+
+ virtual sal_uInt16 GetObjIdentifier() const;
+
+ virtual void operator=(const SdrObject&);
+
+ // TakeObjName...() ist fuer die Anzeige in der UI, z.B. "3 Rahmen selektiert".
+ virtual void TakeObjNameSingul(String& rName) const;
+ virtual void TakeObjNamePlural(String& rName) const;
+
+ // Lokale Parameter setzen/lesen mit Geometrieneuerzeugung
+ void SetExtrudePolygon(const basegfx::B2DPolyPolygon &rNew);
+ const basegfx::B2DPolyPolygon &GetExtrudePolygon() { return maExtrudePolygon; }
+
+ // Aufbrechen
+ virtual sal_Bool IsBreakObjPossible();
+ virtual SdrAttrObj* GetBreakObj();
+};
+
+#endif // _E3D_EXTRUD3D_HXX
+
diff --git a/svx/inc/svx/extrusionbar.hxx b/svx/inc/svx/extrusionbar.hxx
new file mode 100644
index 000000000000..44a2c5e2f917
--- /dev/null
+++ b/svx/inc/svx/extrusionbar.hxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_EXTRUSION_BAR_HXX
+#define _SVX_EXTRUSION_BAR_HXX
+
+#include <sfx2/shell.hxx>
+#include <sfx2/module.hxx>
+#include <svx/ifaceids.hxx>
+#include "svx/svxdllapi.h"
+
+class SfxViewShell;
+class SdrView;
+
+/************************************************************************/
+
+namespace svx
+{
+
+SVX_DLLPUBLIC bool checkForSelectedCustomShapes( SdrView* pSdrView, bool bOnlyExtruded );
+
+class SVX_DLLPUBLIC ExtrusionBar : public SfxShell
+{
+public:
+ TYPEINFO();
+ SFX_DECL_INTERFACE(SVX_INTERFACE_EXTRUSION_BAR)
+
+ ExtrusionBar(SfxViewShell* pViewShell );
+ ~ExtrusionBar();
+
+ static void execute( SdrView* pSdrView, SfxRequest& rReq, SfxBindings& rBindings );
+ static void getState( SdrView* pSdrView, SfxItemSet& rSet );
+};
+
+}
+
+#endif // _SVX_EXTRUSION_BAR_HXX
diff --git a/svx/inc/svx/extrusioncolorcontrol.hxx b/svx/inc/svx/extrusioncolorcontrol.hxx
new file mode 100644
index 000000000000..a592d8646a6f
--- /dev/null
+++ b/svx/inc/svx/extrusioncolorcontrol.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_EXTRUSIONCOLORCONTROL_HXX
+#define _SVX_EXTRUSIONCOLORCONTROL_HXX
+
+#include <sfx2/tbxctrl.hxx>
+#include "svx/svxdllapi.h"
+#include "svx/tbxcolorupdate.hxx"
+
+namespace svx {
+
+class SVX_DLLPUBLIC ExtrusionColorControl : public SfxToolBoxControl
+{
+private:
+ ToolboxButtonColorUpdater* mpBtnUpdater;
+
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ ExtrusionColorControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~ExtrusionColorControl();
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ virtual SfxPopupWindowType GetPopupWindowType() const;
+ virtual SfxPopupWindow* CreatePopupWindow();
+};
+
+}
+
+#endif // _SVX_EXTRUSIONCOLORCONTROL_HXX
+
diff --git a/svx/inc/svx/f3dchild.hxx b/svx/inc/svx/f3dchild.hxx
new file mode 100644
index 000000000000..ebc85d1fc6c5
--- /dev/null
+++ b/svx/inc/svx/f3dchild.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _SVX_F3DCHILD_HXX
+#define _SVX_F3DCHILD_HXX
+
+
+#include <sfx2/childwin.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* Ableitung vom SfxChildWindow als "Behaelter" fuer 3D Window
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC Svx3DChildWindow : public SfxChildWindow
+{
+ public:
+ Svx3DChildWindow( Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo* );
+
+ SFX_DECL_CHILDWINDOW(Svx3DChildWindow);
+};
+
+#endif // _SVX_F3DCHILD_HXX
+
diff --git a/svx/inc/svx/fillctrl.hxx b/svx/inc/svx/fillctrl.hxx
new file mode 100644
index 000000000000..ebca73fc7a06
--- /dev/null
+++ b/svx/inc/svx/fillctrl.hxx
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _FILLCTRL_HXX
+#define _FILLCTRL_HXX
+
+#include <svl/lstner.hxx>
+#include <sfx2/tbxctrl.hxx>
+#include "svx/svxdllapi.h"
+
+class XFillStyleItem;
+class XFillColorItem;
+class XFillGradientItem;
+class XFillHatchItem;
+class XFillBitmapItem;
+class FillControl;
+class SvxFillTypeBox;
+class SvxFillAttrBox;
+class ListBox;
+
+/*************************************************************************
+|*
+|* Klassen fuer Flaechenattribute (Controls und Controller)
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC SvxFillToolBoxControl: public SfxToolBoxControl
+{
+private:
+ XFillStyleItem* pStyleItem;
+ XFillColorItem* pColorItem;
+ XFillGradientItem* pGradientItem;
+ XFillHatchItem* pHatchItem;
+ XFillBitmapItem* pBitmapItem;
+
+ FillControl* pFillControl;
+ SvxFillTypeBox* pFillTypeLB;
+ SvxFillAttrBox* pFillAttrLB;
+
+ sal_Bool bUpdate;
+ sal_Bool bIgnoreStatusUpdate;
+ sal_uInt16 eLastXFS;
+
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SvxFillToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxFillToolBoxControl();
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ void Update( const SfxPoolItem* pState );
+ virtual Window* CreateItemWindow( Window *pParent );
+ void IgnoreStatusUpdate( sal_Bool bSet );
+};
+
+//========================================================================
+
+class FillControl : public Window
+{
+private:
+ friend class SvxFillToolBoxControl;
+
+ SvxFillTypeBox* pLbFillType;
+ SvxFillAttrBox* pLbFillAttr;
+ Size aLogicalFillSize;
+ Size aLogicalAttrSize;
+ Timer aDelayTimer;
+
+//#if 0 // _SOLAR__PRIVATE
+ DECL_LINK( DelayHdl, Timer * );
+ DECL_LINK( SelectFillTypeHdl, ListBox * );
+ DECL_LINK( SelectFillAttrHdl, ListBox * );
+//#endif
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+public:
+ FillControl( Window* pParent, WinBits nStyle = 0 );
+ ~FillControl();
+
+ virtual void Resize();
+};
+
+#endif // _FILLCTRL_HXX
+
diff --git a/svx/inc/svx/flagsdef.hxx b/svx/inc/svx/flagsdef.hxx
new file mode 100644
index 000000000000..9a6ca6f838e6
--- /dev/null
+++ b/svx/inc/svx/flagsdef.hxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FLAGSDEF_HXX
+#define _SVX_FLAGSDEF_HXX
+
+// defines ---------------------------------------------------------------
+
+//CHINA001 copy from border.hxx
+// Border-Modes for paragraphs, textframes and tables
+#define SW_BORDER_MODE_PARA 0x01
+#define SW_BORDER_MODE_TABLE 0x02
+#define SW_BORDER_MODE_FRAME 0x04
+
+//CHINA001 flags for SvxBackgroundTabPage
+#define SVX_SHOW_SELECTOR 0x01
+#define SVX_SHOW_PARACTL 0x02
+#define SVX_ENABLE_TRANSPARENCY 0x04
+#define SVX_SHOW_TBLCTL 0x08
+
+//CHINA001 flags for SvxBorderTabPage
+#define SVX_HIDESHADOWCTL 0x01
+
+//CHINA001 copy from chardlg.hxx
+#define DISABLE_CASEMAP ((sal_uInt16)0x0001)
+#define DISABLE_WORDLINE ((sal_uInt16)0x0002)
+#define DISABLE_BLINK ((sal_uInt16)0x0004)
+#define DISABLE_UNDERLINE_COLOR ((sal_uInt16)0x0008)
+
+#define DISABLE_LANGUAGE ((sal_uInt16)0x0010)
+#define DISABLE_HIDE_LANGUAGE ((sal_uInt16)0x0020)
+
+//CHINA001 flags for SvxCharBasePage's child class
+#define SVX_PREVIEW_CHARACTER 0x01
+//CHINA001 flags for SvxCharNamePage
+#define SVX_RELATIVE_MODE 0x02
+//CHINA001 flags for SvxCharEffectsPage
+#define SVX_ENABLE_FLASH 0x04
+
+
+//CHINA001 copy from numfmt.hxx
+#define SVX_NUMVAL_STANDARD -1234.12345678901234
+#define SVX_NUMVAL_CURRENCY -1234
+#define SVX_NUMVAL_PERCENT -0.1295
+#define SVX_NUMVAL_TIME 36525.5678935185
+#define SVX_NUMVAL_DATE 36525.5678935185
+#define SVX_NUMVAL_BOOLEAN 1
+
+//CHINA001 copy from page.hxx
+// enum ------------------------------------------------------------------
+
+enum SvxModeType
+{
+ SVX_PAGE_MODE_STANDARD,
+ SVX_PAGE_MODE_CENTER,
+ SVX_PAGE_MODE_PRESENTATION
+};
+// define ----------------------------------------------------------------
+
+// 1/2 cm in TWIPS
+// wird auch fuer Minimalgrosse der LayFrms aller Arten benutzt
+#define MM50 283 //from original svx/inc/paragrph.hxx
+
+//--------------from original svx/inc/tabstpge.hxx
+#define TABTYPE_LEFT 0x0001
+#define TABTYPE_RIGHT 0x0002
+#define TABTYPE_CENTER 0x0004
+#define TABTYPE_DEZIMAL 0x0008
+#define TABTYPE_ALL 0x000F
+
+#define TABFILL_NONE 0x0010
+#define TABFILL_POINT 0x0020
+#define TABFILL_DASHLINE 0x0040
+#define TABFILL_SOLIDLINE 0x0080
+#define TABFILL_SPECIAL 0x0100
+#define TABFILL_ALL 0x01F0
+
+//-----
+
+#endif
diff --git a/svx/inc/svx/float3d.hxx b/svx/inc/svx/float3d.hxx
new file mode 100644
index 000000000000..13eb8a697de0
--- /dev/null
+++ b/svx/inc/svx/float3d.hxx
@@ -0,0 +1,313 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_FLOAT3D_HXX
+#define _SVX_FLOAT3D_HXX
+
+#include <sfx2/ctrlitem.hxx>
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+#include <sfx2/dockwin.hxx>
+#ifndef _IMAGEBTN_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <svtools/valueset.hxx>
+#include <svtools/stdctrl.hxx>
+#include "svx/svxdllapi.h"
+
+#include <svx/f3dchild.hxx>
+#include <svx/dlgctl3d.hxx>
+#include <svx/dlgctrl.hxx>
+#include <svx/svdmodel.hxx>
+
+enum ViewType3D
+{
+ VIEWTYPE_GEO = 1,
+ VIEWTYPE_REPRESENTATION,
+ VIEWTYPE_LIGHT,
+ VIEWTYPE_TEXTURE,
+ VIEWTYPE_MATERIAL
+};
+
+class SdrModel;
+class FmFormModel;
+class FmFormPage;
+class VirtualDevice;
+class E3dView;
+class SdrPageView;
+class Svx3DCtrlItem;
+class SvxConvertTo3DItem;
+
+//------------------------------------------------------------------------
+struct Svx3DWinImpl;
+
+class SVX_DLLPUBLIC Svx3DWin : public SfxDockingWindow
+{
+ friend class Svx3DChildWindow;
+ friend class Svx3DCtrlItem;
+ using Window::Update;
+
+private:
+ ImageButton aBtnGeo;
+ ImageButton aBtnRepresentation;
+ ImageButton aBtnLight;
+ ImageButton aBtnTexture;
+ ImageButton aBtnMaterial;
+ ImageButton aBtnUpdate;
+ ImageButton aBtnAssign;
+
+// Geometrie
+ FixedText aFtPercentDiagonal;
+ MetricField aMtrPercentDiagonal;
+ FixedText aFtBackscale;
+ MetricField aMtrBackscale;
+ FixedText aFtEndAngle;
+ MetricField aMtrEndAngle;
+ FixedText aFtDepth;
+ MetricField aMtrDepth;
+ FixedLine aFLGeometrie;
+
+ FixedText aFtHorizontal;
+ NumericField aNumHorizontal;
+ FixedText aFtVertical;
+ NumericField aNumVertical;
+ FixedLine aFLSegments;
+
+ ImageButton aBtnNormalsObj;
+ ImageButton aBtnNormalsFlat;
+ ImageButton aBtnNormalsSphere;
+ ImageButton aBtnNormalsInvert;
+ ImageButton aBtnTwoSidedLighting;
+ FixedLine aFLNormals;
+
+ ImageButton aBtnDoubleSided;
+
+// Darstellung
+ FixedText aFtShademode;
+ ListBox aLbShademode;
+ ImageButton aBtnShadow3d;
+ FixedText aFtSlant;
+ MetricField aMtrSlant;
+ FixedLine aFLShadow;
+ FixedText aFtDistance;
+ MetricField aMtrDistance;
+ FixedText aFtFocalLeng;
+ MetricField aMtrFocalLength;
+ FixedLine aFLCamera;
+ FixedLine aFLRepresentation;
+
+// Beleuchtung
+ ImageButton aBtnLight1;
+ ImageButton aBtnLight2;
+ ImageButton aBtnLight3;
+ ImageButton aBtnLight4;
+ ImageButton aBtnLight5;
+ ImageButton aBtnLight6;
+ ImageButton aBtnLight7;
+ ImageButton aBtnLight8;
+ ColorLB aLbLight1;
+ ColorLB aLbLight2;
+ ColorLB aLbLight3;
+ ColorLB aLbLight4;
+ ColorLB aLbLight5;
+ ColorLB aLbLight6;
+ ColorLB aLbLight7;
+ ColorLB aLbLight8;
+
+ ImageButton aBtnLightColor;
+ FixedText aFTLightsource;
+
+ // #99694# Keyboard shortcuts activate the next control, so the
+ // order needed to be changed here
+ FixedText aFTAmbientlight; // Text label
+ ColorLB aLbAmbientlight; // ListBox
+ ImageButton aBtnAmbientColor; // color button
+
+ FixedLine aFLLight;
+
+// Texturen
+ FixedText aFtTexKind;
+ ImageButton aBtnTexLuminance;
+ ImageButton aBtnTexColor;
+ FixedText aFtTexMode;
+ ImageButton aBtnTexReplace;
+ ImageButton aBtnTexModulate;
+ ImageButton aBtnTexBlend;
+ FixedText aFtTexProjectionX;
+ ImageButton aBtnTexObjectX;
+ ImageButton aBtnTexParallelX;
+ ImageButton aBtnTexCircleX;
+ FixedText aFtTexProjectionY;
+ ImageButton aBtnTexObjectY;
+ ImageButton aBtnTexParallelY;
+ ImageButton aBtnTexCircleY;
+ FixedText aFtTexFilter;
+ ImageButton aBtnTexFilter;
+ FixedLine aFLTexture;
+
+// Material
+// Materialeditor
+ FixedText aFtMatFavorites;
+ ListBox aLbMatFavorites;
+ FixedText aFtMatColor;
+ ColorLB aLbMatColor;
+ ImageButton aBtnMatColor;
+ FixedText aFtMatEmission;
+ ColorLB aLbMatEmission;
+ ImageButton aBtnEmissionColor;
+ FixedText aFtMatSpecular;
+ ColorLB aLbMatSpecular;
+ ImageButton aBtnSpecularColor;
+ FixedText aFtMatSpecularIntensity;
+ MetricField aMtrMatSpecularIntensity;
+ FixedLine aFLMatSpecular;
+ FixedLine aFLMaterial;
+
+// Unterer Teil
+ ImageButton aBtnConvertTo3D;
+ ImageButton aBtnLatheObject;
+ ImageButton aBtnPerspective;
+ Svx3DPreviewControl aCtlPreview;
+ SvxLightCtl3D aCtlLightPreview;
+
+// der Rest ...
+ Image aImgLightOn;
+ Image aImgLightOff;
+ sal_Bool bUpdate;
+ ViewType3D eViewType;
+ Size aSize;
+
+ // Model, Page, View etc. fuer Favoriten
+ FmFormModel* pModel;
+ FmFormPage* pFmPage;
+ VirtualDevice* pVDev;
+ E3dView* p3DView;
+ List* pFavorSetList;
+ List* pMatFavSetList;
+
+ SfxBindings* pBindings;
+ Svx3DCtrlItem* pControllerItem;
+
+ SvxConvertTo3DItem* pConvertTo3DItem;
+ SvxConvertTo3DItem* pConvertTo3DLatheItem;
+
+ Svx3DWinImpl* mpImpl;
+ SfxMapUnit ePoolUnit;
+ FieldUnit eFUnit;
+
+ // ItemSet used to remember set 2d attributes
+ SfxItemSet* mpRemember2DAttributes;
+
+ sal_Bool bOnly3DChanged;
+
+ //------------------------------------
+
+ DECL_LINK( ClickViewTypeHdl, void * );
+ DECL_LINK( ClickUpdateHdl, void * );
+ DECL_LINK( ClickAssignHdl, void * );
+ DECL_LINK( ClickHdl, PushButton * );
+ DECL_LINK( ClickColorHdl, PushButton * );
+ DECL_LINK( SelectHdl, void * );
+ DECL_LINK( ModifyHdl, void * );
+ DECL_LINK( ClickLightHdl, PushButton * );
+
+ DECL_LINK( DoubleClickHdl, void * );
+
+ DECL_LINK( ChangeLightCallbackHdl, void * );
+ DECL_LINK( ChangeSelectionCallbackHdl, void * );
+
+ SVX_DLLPRIVATE void Construct();
+ SVX_DLLPRIVATE void Reset();
+
+ SVX_DLLPRIVATE sal_Bool LBSelectColor( ColorLB* pLb, const Color& rColor );
+ SVX_DLLPRIVATE sal_uInt16 GetLightSource( const PushButton* pBtn = NULL );
+ SVX_DLLPRIVATE ColorLB* GetLbByButton( const PushButton* pBtn = NULL );
+
+ SVX_DLLPRIVATE bool GetUILightState( ImageButton& aBtn ) const;
+ SVX_DLLPRIVATE void SetUILightState( ImageButton& aBtn, bool bState );
+
+protected:
+ virtual void Resize();
+
+public:
+ Svx3DWin( SfxBindings* pBindings, SfxChildWindow *pCW,
+ Window* pParent );
+ ~Svx3DWin();
+
+ void InitColorLB( const SdrModel* pDoc );
+ sal_Bool IsUpdateMode() const { return bUpdate; }
+
+ void Update( SfxItemSet& rSet );
+ void GetAttr( SfxItemSet& rSet );
+
+ void UpdatePreview(); // nach oben (private)
+ void DocumentReload(); // #83951#
+};
+
+/*************************************************************************
+|*
+|* ControllerItem fuer 3D-Window (Floating/Docking)
+|*
+\************************************************************************/
+
+class Svx3DCtrlItem : public SfxControllerItem
+{
+ Svx3DWin* p3DWin;
+
+ protected:
+ virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
+ const SfxPoolItem* pState );
+
+ public:
+ Svx3DCtrlItem( sal_uInt16, Svx3DWin*, SfxBindings* );
+};
+
+/*************************************************************************
+|*
+|* ControllerItem fuer Status eines Slots
+|* (SID_CONVERT_TO_3D, SID_CONVERT_TO_3D_LATHE_FAST)
+|*
+\************************************************************************/
+
+class SvxConvertTo3DItem : public SfxControllerItem
+{
+ sal_Bool bState;
+
+protected:
+ virtual void StateChanged(sal_uInt16 nSId, SfxItemState eState, const SfxPoolItem* pState);
+
+public:
+ SvxConvertTo3DItem(sal_uInt16 nId, SfxBindings* pBindings);
+ sal_Bool GetState() const { return bState; }
+};
+
+#endif // _SVX_FLOAT3D_HXX
+
diff --git a/svx/inc/svx/fmdmod.hxx b/svx/inc/svx/fmdmod.hxx
new file mode 100644
index 000000000000..26af5971be03
--- /dev/null
+++ b/svx/inc/svx/fmdmod.hxx
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FMDMOD_HXX
+#define _SVX_FMDMOD_HXX
+
+#include <svx/unomod.hxx>
+#include "svx/svxdllapi.h"
+
+class SVX_DLLPUBLIC SvxFmMSFactory : public SvxUnoDrawMSFactory
+{
+
+public:
+ SvxFmMSFactory() {};
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance(const ::rtl::OUString& ServiceSpecifier) throw( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments(const ::rtl::OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments) throw( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+};
+
+#endif // _SVX_FMDMOD_HXX
+
diff --git a/svx/inc/svx/fmdpage.hxx b/svx/inc/svx/fmdpage.hxx
new file mode 100644
index 000000000000..70fe7eb74eaf
--- /dev/null
+++ b/svx/inc/svx/fmdpage.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FMDPAGE_HXX
+#define _SVX_FMDPAGE_HXX
+
+#include <com/sun/star/form/XFormsSupplier2.hpp>
+#include <svx/unopage.hxx>
+#include <comphelper/uno3.hxx>
+#include "svx/svxdllapi.h"
+
+//==================================================================
+// SvxFmDrawPage
+//==================================================================
+class SVX_DLLPUBLIC SvxFmDrawPage :public SvxDrawPage
+ ,public ::com::sun::star::form::XFormsSupplier2
+{
+protected:
+
+ // Erzeugen eines SdrObjects anhand einer Description. Kann von
+ // abgeleiteten Klassen dazu benutzt werden, eigene ::com::sun::star::drawing::Shapes zu
+ // unterstuetzen (z.B. Controls)
+ virtual SdrObject *_CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xShape )throw ();
+
+ // Die folgende Methode wird gerufen, wenn ein SvxShape-Objekt angelegt
+ // werden soll. abgeleitete Klassen koennen hier eine Ableitung oder
+ // ein ein SvxShape aggregierendes Objekt anlegen.
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > _CreateShape( SdrObject *pObj ) const throw ();
+
+public:
+ SvxFmDrawPage( SdrPage* pPage );
+ virtual ~SvxFmDrawPage() throw ();
+
+ // UNO Anbindung
+ DECLARE_UNO3_AGG_DEFAULTS(SvxFmDrawPage, SvxDrawPage);
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XFormsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL getForms(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XFormsSupplier2
+ virtual sal_Bool SAL_CALL hasForms(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ // ::com::sun::star::lang::XServiceInfo
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+};
+
+#endif // _SVX_FMDPAGE_HXX
+
diff --git a/svx/inc/svx/fmglob.hxx b/svx/inc/svx/fmglob.hxx
new file mode 100644
index 000000000000..c361e13a759a
--- /dev/null
+++ b/svx/inc/svx/fmglob.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_FMGLOB_HXX
+#define _SVX_FMGLOB_HXX
+
+#include <tools/solar.h>
+#include <svx/svdobj.hxx>
+#include <com/sun/star/form/FormComponentType.hpp>
+
+const sal_uInt32 FmFormInventor = sal_uInt32('F')*0x00000001+
+ sal_uInt32('M')*0x00000100+
+ sal_uInt32('0')*0x00010000+
+ sal_uInt32('1')*0x01000000;
+
+const sal_uInt16 OBJ_FM_CONTROL = ::com::sun::star::form::FormComponentType::CONTROL;
+ // fuer FormularKomponenten
+const sal_uInt16 OBJ_FM_EDIT = ::com::sun::star::form::FormComponentType::TEXTFIELD;
+const sal_uInt16 OBJ_FM_BUTTON = ::com::sun::star::form::FormComponentType::COMMANDBUTTON;
+const sal_uInt16 OBJ_FM_FIXEDTEXT = ::com::sun::star::form::FormComponentType::FIXEDTEXT;
+const sal_uInt16 OBJ_FM_LISTBOX = ::com::sun::star::form::FormComponentType::LISTBOX;
+const sal_uInt16 OBJ_FM_CHECKBOX = ::com::sun::star::form::FormComponentType::CHECKBOX;
+const sal_uInt16 OBJ_FM_COMBOBOX = ::com::sun::star::form::FormComponentType::COMBOBOX;
+const sal_uInt16 OBJ_FM_RADIOBUTTON = ::com::sun::star::form::FormComponentType::RADIOBUTTON;
+const sal_uInt16 OBJ_FM_GROUPBOX = ::com::sun::star::form::FormComponentType::GROUPBOX;
+const sal_uInt16 OBJ_FM_GRID = ::com::sun::star::form::FormComponentType::GRIDCONTROL;
+const sal_uInt16 OBJ_FM_IMAGEBUTTON = ::com::sun::star::form::FormComponentType::IMAGEBUTTON;
+const sal_uInt16 OBJ_FM_FILECONTROL = ::com::sun::star::form::FormComponentType::FILECONTROL;
+const sal_uInt16 OBJ_FM_DATEFIELD = ::com::sun::star::form::FormComponentType::DATEFIELD;
+const sal_uInt16 OBJ_FM_TIMEFIELD = ::com::sun::star::form::FormComponentType::TIMEFIELD;
+const sal_uInt16 OBJ_FM_NUMERICFIELD = ::com::sun::star::form::FormComponentType::NUMERICFIELD;
+const sal_uInt16 OBJ_FM_CURRENCYFIELD = ::com::sun::star::form::FormComponentType::CURRENCYFIELD;
+const sal_uInt16 OBJ_FM_PATTERNFIELD = ::com::sun::star::form::FormComponentType::PATTERNFIELD;
+const sal_uInt16 OBJ_FM_HIDDEN = ::com::sun::star::form::FormComponentType::HIDDENCONTROL;
+const sal_uInt16 OBJ_FM_IMAGECONTROL = ::com::sun::star::form::FormComponentType::IMAGECONTROL;
+const sal_uInt16 OBJ_FM_FORMATTEDFIELD = ::com::sun::star::form::FormComponentType::PATTERNFIELD + 1;
+const sal_uInt16 OBJ_FM_SCROLLBAR = ::com::sun::star::form::FormComponentType::PATTERNFIELD + 2;
+const sal_uInt16 OBJ_FM_SPINBUTTON = ::com::sun::star::form::FormComponentType::PATTERNFIELD + 3;
+const sal_uInt16 OBJ_FM_NAVIGATIONBAR = ::com::sun::star::form::FormComponentType::PATTERNFIELD + 4;
+
+#endif // _FM_FMGLOB_HXX
+
diff --git a/svx/inc/svx/fmgridcl.hxx b/svx/inc/svx/fmgridcl.hxx
new file mode 100644
index 000000000000..c0e9e7e34d78
--- /dev/null
+++ b/svx/inc/svx/fmgridcl.hxx
@@ -0,0 +1,216 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FMGRIDCL_HXX
+#define _SVX_FMGRIDCL_HXX
+
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+
+#include <svx/gridctrl.hxx>
+#include <svtools/transfer.hxx>
+#include "svx/svxdllapi.h"
+
+//==================================================================
+// FmGridHeader
+//==================================================================
+struct FmGridHeaderData;
+class SVX_DLLPUBLIC FmGridHeader
+ :public ::svt::EditBrowserHeader
+ ,public DropTargetHelper
+{
+protected:
+ FmGridHeaderData* m_pImpl;
+
+ // trigger context menu execution
+ void triggerColumnContextMenu( const ::Point& _rPreferredPos );
+
+public:
+ FmGridHeader( BrowseBox* pParent, WinBits nWinBits = WB_STDHEADERBAR | WB_DRAG );
+ ~FmGridHeader();
+
+public:
+ struct AccessControl { friend class FmGridControl; private: AccessControl() { } };
+
+ inline void triggerColumnContextMenu( const ::Point& _rPreferredPos, const AccessControl& )
+ {
+ triggerColumnContextMenu( _rPreferredPos );
+ }
+
+protected:
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ virtual void Select();
+
+ /** the value returned by GetItemPos is meaningless for the grid model if there are hidden columns,
+ so use GetModelColumnPos instead
+ */
+ sal_uInt16 GetModelColumnPos(sal_uInt16 nId) const;
+
+ /** This is called before executing a context menu for a column. rMenu contains the initial entries
+ handled by this base class' method (which always has to be called).
+ Derived classes may alter the menu in any way and handle any additional entries in
+ PostExecuteColumnContextMenu.
+ All disabled entries will be removed before executing the menu, so be careful with separators
+ near entries you probably wish to disable ...
+ */
+ virtual void PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rMenu);
+ /** After executing the context menu for a column this method is called.
+ */
+ virtual void PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMenu& rMenu, sal_uInt16 nExecutionResult);
+
+ // DropTargetHelper
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+
+ /** selects the column at the selection supplier.
+ @param nColumnId
+ The column id.
+ */
+ void notifyColumnSelect(sal_uInt16 nColumnId);
+private:
+ DECL_LINK( OnAsyncExecuteDrop, void* );
+};
+
+//==================================================================
+// FmGridControl
+//==================================================================
+class FmXGridPeer;
+class SVX_DLLPUBLIC FmGridControl : public DbGridControl
+
+{
+ friend class FmGridHeader;
+ friend class FmXGridPeer;
+
+ FmXGridPeer* m_pPeer;
+ sal_Int32 m_nCurrentSelectedColumn; // this is the column model (not the view) posisition ...
+ sal_uInt16 m_nMarkedColumnId;
+ sal_Bool m_bSelecting;
+ sal_Bool m_bInColumnMove : 1;
+
+public:
+ FmGridControl(
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >,
+ Window* pParent,
+ FmXGridPeer* _pPeer,
+ WinBits nBits);
+
+ // Window
+ virtual void KeyInput( const KeyEvent& rKEvt );
+
+ // ::com::sun::star::beans::XPropertyChangeListener
+ void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt);
+
+ // ::com::sun::star::form::XPositioningListener
+ void positioned(const ::com::sun::star::lang::EventObject& rEvent);
+
+ // XBound
+ sal_Bool commit();
+
+ // ::com::sun::star::form::XInsertListener
+ void inserted(const ::com::sun::star::lang::EventObject& rEvent);
+
+ // ::com::sun::star::form::XRestoreListener
+ void restored(const ::com::sun::star::lang::EventObject& rEvent);
+
+ void markColumn(sal_uInt16 nId);
+ sal_Bool isColumnMarked(sal_uInt16 nId) const;
+
+ sal_Int32 GetSelectedColumn() const;
+
+ /** return the name of the specified object.
+ @param eObjType
+ The type to ask for
+ @param _nPosition
+ The position of a tablecell (index position), header bar colum/row cell
+ @return
+ The name of the specified object.
+ */
+ virtual ::rtl::OUString GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const;
+
+ /** return the description of the specified object.
+ @param eObjType
+ The type to ask for
+ @param _nPosition
+ The position of a tablecell (index position), header bar colum/row cell
+ @return
+ The description of the specified object.
+ */
+ virtual ::rtl::OUString GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const;
+
+protected:
+ virtual void Command(const CommandEvent& rEvt);
+
+ virtual BrowserHeader* imp_CreateHeaderBar(BrowseBox* pParent);
+ virtual long QueryMinimumRowHeight();
+ virtual void RowHeightChanged();
+ virtual void ColumnResized(sal_uInt16 nId);
+ virtual void ColumnMoved(sal_uInt16 nId);
+ virtual void DeleteSelectedRows();
+ virtual void SetDesignMode(sal_Bool bMode);
+ virtual void CellModified();
+ virtual void HideColumn(sal_uInt16 nId);
+ virtual void ShowColumn(sal_uInt16 nId);
+
+ sal_Bool IsInColumnMove() const {return m_bInColumnMove;}
+
+ virtual void BeginCursorAction();
+ virtual void EndCursorAction();
+ virtual void Select();
+
+ // Initialisieren der Spalten
+ // a.) nur ueber Spaltenbeschreibung
+ virtual void InitColumnsByModels(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& xColumns);
+ // b.) im alivemode ueber Datenbankfelder
+ virtual void InitColumnsByFields(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xFields);
+
+ // some kind of impl version (for one single column) of our version of InitColumnsByFields
+ void InitColumnByField(
+ DbGridColumn* _pColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumnModel,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxFieldsByNames,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& _rxFieldsByIndex
+ );
+
+ FmXGridPeer* GetPeer() const {return m_pPeer;}
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>
+ getSelectionBookmarks();
+ sal_Bool selectBookmarks(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>& _rBookmarks);
+
+ /** returns if a column is selected
+ @param nColumnId
+ The column id.
+ @param _pColumn
+ The column to compare with.
+ @return
+ <TRUE/> if the column is selected, otherwise <FALSE/>
+ */
+ sal_Bool isColumnSelected(sal_uInt16 nColumnId,DbGridColumn* _pColumn);
+};
+
+#endif // _SVX_FMGRIDCL_HXX
+
diff --git a/svx/inc/svx/fmgridif.hxx b/svx/inc/svx/fmgridif.hxx
new file mode 100644
index 000000000000..df21245bc99b
--- /dev/null
+++ b/svx/inc/svx/fmgridif.hxx
@@ -0,0 +1,551 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FMGRIDIF_HXX
+#define _SVX_FMGRIDIF_HXX
+
+#include "svx/svxdllapi.h"
+
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XContainer.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <com/sun/star/sdbc/XRowSetListener.hpp>
+#include <com/sun/star/sdb/XRowSetSupplier.hpp>
+#include <com/sun/star/form/XReset.hpp>
+#include <com/sun/star/form/XBoundComponent.hpp>
+#include <com/sun/star/form/XLoadListener.hpp>
+#include <com/sun/star/form/XGridControl.hpp>
+#include <com/sun/star/form/XGridPeer.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/frame/XDispatchProviderInterception.hpp>
+#include <com/sun/star/view/XSelectionChangeListener.hpp>
+#include <com/sun/star/util/XModeSelector.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+
+#include <tools/wintypes.hxx>
+#include <toolkit/controls/unocontrol.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/implbase10.hxx>
+
+#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_19)
+#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_19
+#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 19
+#include <comphelper/implbase_var.hxx>
+#endif
+
+
+class DbGridColumn;
+
+class OWeakSubObject : public ::cppu::OWeakObject
+{
+protected:
+ ::cppu::OWeakObject& m_rParent;
+
+public:
+ OWeakSubObject(::cppu::OWeakObject& rParent) : m_rParent(rParent) { }
+
+ virtual void SAL_CALL acquire() throw() { m_rParent.acquire(); }
+ virtual void SAL_CALL release() throw() { m_rParent.release(); }
+};
+
+//==================================================================
+// FmXModifyMultiplexer
+//==================================================================
+class FmXModifyMultiplexer :public OWeakSubObject
+ ,public ::cppu::OInterfaceContainerHelper
+ ,public ::com::sun::star::util::XModifyListener
+{
+public:
+ FmXModifyMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex );
+ DECLARE_UNO3_DEFAULTS(FmXModifyMultiplexer,OWeakSubObject);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::lang::XEventListener
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::util::XModifyListener
+ virtual void SAL_CALL modified(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException);
+
+// resolve ambiguity : both OWeakObject and OInterfaceContainerHelper have these memory operators
+ void * SAL_CALL operator new( size_t size ) throw() { return OWeakSubObject::operator new(size); }
+ void SAL_CALL operator delete( void * p ) throw() { OWeakSubObject::operator delete(p); }
+};
+
+//==================================================================
+// FmXUpdateMultiplexer
+//==================================================================
+class FmXUpdateMultiplexer : public OWeakSubObject,
+ public ::cppu::OInterfaceContainerHelper,
+ public ::com::sun::star::form::XUpdateListener
+{
+public:
+ FmXUpdateMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex );
+ DECLARE_UNO3_DEFAULTS(FmXUpdateMultiplexer,OWeakSubObject);
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::lang::XEventListener
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::form::XUpdateListener
+ virtual sal_Bool SAL_CALL approveUpdate(const ::com::sun::star::lang::EventObject &) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updated(const ::com::sun::star::lang::EventObject &) throw(::com::sun::star::uno::RuntimeException);
+
+// resolve ambiguity : both OWeakObject and OInterfaceContainerHelper have these memory operators
+ void * SAL_CALL operator new( size_t size ) throw() { return OWeakSubObject::operator new(size); }
+ void SAL_CALL operator delete( void * p ) throw() { OWeakSubObject::operator delete(p); }
+};
+
+//==================================================================
+// FmXSelectionMultiplexer
+//==================================================================
+class FmXSelectionMultiplexer :public OWeakSubObject
+ ,public ::cppu::OInterfaceContainerHelper
+ ,public ::com::sun::star::view::XSelectionChangeListener
+{
+public:
+ FmXSelectionMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex );
+ DECLARE_UNO3_DEFAULTS(FmXSelectionMultiplexer, OWeakSubObject);
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::lang::XEventListener
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::view::XSelectionChangeListener
+ virtual void SAL_CALL selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+// resolve ambiguity : both OWeakObject and OInterfaceContainerHelper have these memory operators
+ void * SAL_CALL operator new( size_t size ) throw() { return OWeakSubObject::operator new(size); }
+ void SAL_CALL operator delete( void * p ) throw() { OWeakSubObject::operator delete(p); }
+};
+
+//==================================================================
+// FmXGridControlMultiplexer
+//==================================================================
+class FmXGridControlMultiplexer :public OWeakSubObject
+ ,public ::cppu::OInterfaceContainerHelper
+ ,public ::com::sun::star::form::XGridControlListener
+{
+public:
+ FmXGridControlMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex );
+ DECLARE_UNO3_DEFAULTS( FmXGridControlMultiplexer, OWeakSubObject );
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::lang::XEventListener
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::view::XSelectionChangeListener
+ virtual void SAL_CALL columnChanged( const ::com::sun::star::lang::EventObject& _event ) throw (::com::sun::star::uno::RuntimeException);
+
+// resolve ambiguity : both OWeakObject and OInterfaceContainerHelper have these memory operators
+ void * SAL_CALL operator new( size_t size ) throw() { return OWeakSubObject::operator new(size); }
+ void SAL_CALL operator delete( void * p ) throw() { OWeakSubObject::operator delete(p); }
+};
+
+//==================================================================
+// FmXContainerMultiplexer
+//==================================================================
+class FmXContainerMultiplexer : public OWeakSubObject,
+ public ::cppu::OInterfaceContainerHelper,
+ public ::com::sun::star::container::XContainerListener
+{
+public:
+ FmXContainerMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex);
+ DECLARE_UNO3_DEFAULTS(FmXContainerMultiplexer,OWeakSubObject);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::lang::XEventListener
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::container::XContainerListener
+ virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& Event) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& Event) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& Event) throw(::com::sun::star::uno::RuntimeException);
+
+// resolve ambiguity : both OWeakObject and OInterfaceContainerHelper have these memory operators
+ void * SAL_CALL operator new( size_t size ) throw() { return OWeakSubObject::operator new(size); }
+ void SAL_CALL operator delete( void * p ) throw() { OWeakSubObject::operator delete(p); }
+};
+
+//==================================================================
+// FmXGridControl
+//==================================================================
+typedef ::cppu::ImplHelper10< ::com::sun::star::form::XBoundComponent,
+ ::com::sun::star::form::XGridControl,
+ ::com::sun::star::util::XModifyBroadcaster,
+ ::com::sun::star::container::XIndexAccess,
+ ::com::sun::star::container::XEnumerationAccess,
+ ::com::sun::star::util::XModeSelector,
+ ::com::sun::star::container::XContainer,
+ ::com::sun::star::frame::XDispatchProvider,
+ ::com::sun::star::frame::XDispatchProviderInterception,
+ ::com::sun::star::view::XSelectionSupplier
+ > FmXGridControl_BASE;
+
+class FmXGridPeer;
+class SVX_DLLPUBLIC FmXGridControl :public UnoControl
+ ,public FmXGridControl_BASE
+{
+ FmXModifyMultiplexer m_aModifyListeners;
+ FmXUpdateMultiplexer m_aUpdateListeners;
+ FmXContainerMultiplexer m_aContainerListeners;
+ FmXSelectionMultiplexer m_aSelectionListeners;
+ FmXGridControlMultiplexer m_aGridControlListeners;
+
+protected:
+ sal_uInt16 m_nPeerCreationLevel;
+ sal_Bool m_bInDraw;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory;
+
+public:
+ FmXGridControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&);
+ virtual ~FmXGridControl();
+
+ // UNO Anbindung
+ DECLARE_UNO3_AGG_DEFAULTS(FmXGridControl, UnoControl);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(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 ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::lang::XComponent
+ virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::lang::XServiceInfo
+ virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw();
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw();
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw();
+
+// ::com::sun::star::awt::XControl
+ virtual void SAL_CALL createPeer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& _rToolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDesignMode(sal_Bool bOn) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::awt::XView
+ virtual void SAL_CALL draw( sal_Int32 x, sal_Int32 y ) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::form::XBoundComponent
+ virtual void SAL_CALL addUpdateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XUpdateListener >& l) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeUpdateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XUpdateListener >& l) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL commit() throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::container::XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::container::XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration() throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::container::XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 _rIndex) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::form::XGridControl
+ virtual void SAL_CALL addGridControlListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XGridControlListener >& _listener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeGridControlListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XGridControlListener >& _listener ) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::form::XGrid (base of XGridControl)
+ virtual sal_Int16 SAL_CALL getCurrentColumnPosition() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setCurrentColumnPosition(sal_Int16 nPos) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::form::XGridFieldDataSupplier (base of XGridControl)
+ virtual ::com::sun::star::uno::Sequence< sal_Bool > SAL_CALL queryFieldDataType( const ::com::sun::star::uno::Type& xType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL queryFieldData( sal_Int32 nRow, const ::com::sun::star::uno::Type& xType ) throw(::com::sun::star::uno::RuntimeException);
+
+// UnoControl
+ virtual ::rtl::OUString GetComponentServiceName();
+
+// ::com::sun::star::util::XModifyBroadcaster
+ virtual void SAL_CALL addModifyListener(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& l) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& l) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::util::XModeSelector
+ virtual void SAL_CALL setMode(const ::rtl::OUString& Mode) throw(::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getMode() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedModes() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsMode(const ::rtl::OUString& Mode) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::container::XContainer
+ virtual void SAL_CALL addContainerListener(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& l) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeContainerListener(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& l) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::frame::XDispatchProvider
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch(const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL queryDispatches(const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::frame::XDispatchProviderInterception
+ virtual void SAL_CALL registerDispatchProviderInterceptor(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& xInterceptor) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL releaseDispatchProviderInterceptor(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& xInterceptor) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::view::XSelectionSupplier
+ virtual sal_Bool SAL_CALL select( const ::com::sun::star::uno::Any& aSelection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getSelection( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ virtual FmXGridPeer* imp_CreatePeer(Window* pParent);
+ // ImplCreatePeer waere besser ;) geht aber nicht, da dann nicht exportiert
+
+};
+
+//==================================================================
+// FmXGridPeer -> Peer fuers Gridcontrol
+//==================================================================
+typedef ::comphelper::ImplHelper19 < ::com::sun::star::form::XGridPeer,
+ ::com::sun::star::form::XBoundComponent,
+ ::com::sun::star::form::XGridControl,
+ ::com::sun::star::sdb::XRowSetSupplier,
+ ::com::sun::star::util::XModifyBroadcaster,
+ ::com::sun::star::beans::XPropertyChangeListener,
+ ::com::sun::star::container::XContainerListener,
+ ::com::sun::star::sdbc::XRowSetListener,
+ ::com::sun::star::form::XLoadListener,
+ ::com::sun::star::view::XSelectionChangeListener,
+ ::com::sun::star::container::XIndexAccess,
+ ::com::sun::star::container::XEnumerationAccess,
+ ::com::sun::star::util::XModeSelector,
+ ::com::sun::star::container::XContainer,
+ ::com::sun::star::frame::XStatusListener,
+ ::com::sun::star::frame::XDispatchProvider,
+ ::com::sun::star::frame::XDispatchProviderInterception,
+ ::com::sun::star::form::XResetListener,
+ ::com::sun::star::view::XSelectionSupplier
+ > FmXGridPeer_BASE;
+class FmGridControl;
+class SVX_DLLPUBLIC FmXGridPeer :public VCLXWindow
+ ,public FmXGridPeer_BASE
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > m_xColumns;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > m_xCursor;
+ ::cppu::OInterfaceContainerHelper m_aModifyListeners,
+ m_aUpdateListeners,
+ m_aContainerListeners,
+ m_aSelectionListeners,
+ m_aGridControlListeners;
+
+ ::rtl::OUString m_aMode;
+ sal_Int32 m_nCursorListening;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > m_xFirstDispatchInterceptor;
+
+ sal_Bool m_bInterceptingDispatch;
+
+ sal_Bool* m_pStateCache;
+ // one bool for each supported url
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > * m_pDispatchers;
+ // one dispatcher for each supported url
+ // (I would like to have a vector here but including the stl in an exported file seems
+ // very risky to me ....)
+
+ class GridListenerDelegator;
+ friend class GridListenerDelegator;
+ GridListenerDelegator* m_pGridListener;
+
+protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory;
+ ::osl::Mutex m_aMutex;
+
+public:
+ FmXGridPeer(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&);
+ ~FmXGridPeer();
+
+ // spaeter Constructor, immer nach dem realen Constructor zu rufen !
+ void Create(Window* pParent, WinBits nStyle);
+
+// UNO Anbindung
+ DECLARE_UNO3_DEFAULTS(FmXGridPeer, VCLXWindow);
+ 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 ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::lang::XUnoTunnel
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelImplementationId() throw();
+ static FmXGridPeer* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxIFace ) throw();
+ sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& _rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::form::XGridPeer
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > SAL_CALL getColumns( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setColumns( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& aColumns ) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::lang::XComponent
+ virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::lang::XEventListener
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::form::XBoundComponent
+ virtual void SAL_CALL addUpdateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XUpdateListener >& l) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeUpdateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XUpdateListener >& l) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL commit() throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::container::XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::container::XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration() throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::container::XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 _rIndex) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::beans::XPropertyChangeListener
+ virtual void SAL_CALL SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::form::XLoadListener
+ virtual void SAL_CALL loaded(const ::com::sun::star::lang::EventObject& rEvent) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL unloaded(const ::com::sun::star::lang::EventObject& rEvent) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL unloading(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL reloading(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL reloaded(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::sdbc::XRowSetListener
+ virtual void SAL_CALL cursorMoved(const ::com::sun::star::lang::EventObject& event) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL rowChanged(const ::com::sun::star::lang::EventObject& event) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL rowSetChanged(const ::com::sun::star::lang::EventObject& event) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::container::XContainerListener
+ virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& Event) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& Event) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& Event) throw(::com::sun::star::uno::RuntimeException);
+
+// VCLXWindow
+ virtual void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ CreateAccessibleContext();
+
+// ::com::sun::star::form::XGridControl
+ virtual void SAL_CALL addGridControlListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XGridControlListener >& _listener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeGridControlListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XGridControlListener >& _listener ) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::form::XGrid (base of XGridControl)
+ virtual sal_Int16 SAL_CALL getCurrentColumnPosition() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setCurrentColumnPosition(sal_Int16 nPos) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::form::XGridFieldDataSupplier (base of XGridControl)
+ virtual ::com::sun::star::uno::Sequence< sal_Bool > SAL_CALL queryFieldDataType( const ::com::sun::star::uno::Type& xType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL queryFieldData( sal_Int32 nRow, const ::com::sun::star::uno::Type& xType ) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::sdb::XRowSetSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > SAL_CALL getRowSet() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setRowSet(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xDataSource) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::util::XModifyBroadcaster
+ virtual void SAL_CALL addModifyListener(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& l) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& l) throw(::com::sun::star::uno::RuntimeException);
+
+// UnoControl
+ virtual void SAL_CALL SAL_CALL setDesignMode(sal_Bool bOn) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isDesignMode() throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::view::XSelectionChangeListener
+ virtual void SAL_CALL selectionChanged(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException);
+
+ void CellModified();
+
+// PropertyListening
+ void updateGrid(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& _rDatabaseCursor);
+ void startCursorListening();
+ void stopCursorListening();
+
+// ::com::sun::star::util::XModeSelector
+ virtual void SAL_CALL setMode(const ::rtl::OUString& Mode) throw(::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getMode() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedModes() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsMode(const ::rtl::OUString& Mode) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::container::XContainer
+ virtual void SAL_CALL addContainerListener(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& l) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeContainerListener(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& l) throw(::com::sun::star::uno::RuntimeException);
+
+ void columnVisible(DbGridColumn* pColumn);
+ void columnHidden(DbGridColumn* pColumn);
+
+// ::com::sun::star::awt::XView
+ virtual void SAL_CALL draw( sal_Int32 x, sal_Int32 y ) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::frame::XDispatchProvider
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch(const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL queryDispatches(const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::frame::XDispatchProviderInterception
+ virtual void SAL_CALL registerDispatchProviderInterceptor(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& xInterceptor) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL releaseDispatchProviderInterceptor(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& xInterceptor) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::frame::XStatusListener
+ virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::form::XResetListener
+ virtual sal_Bool SAL_CALL approveReset(const ::com::sun::star::lang::EventObject& rEvent) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL resetted(const ::com::sun::star::lang::EventObject& rEvent) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::view::XSelectionSupplier
+ virtual sal_Bool SAL_CALL select( const ::com::sun::star::uno::Any& aSelection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getSelection( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ virtual FmGridControl* imp_CreateControl(Window* pParent, WinBits nStyle);
+
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::util::URL>& getSupportedURLs();
+ static ::com::sun::star::uno::Sequence<sal_uInt16>& getSupportedGridSlots();
+ void ConnectToDispatcher();
+ void DisConnectFromDispatcher();
+ void UpdateDispatches(); // will connect if not already connected and just update else
+
+ /** If a derived class wants to listen at some column properties, it doesn't have
+ to overload all methods affecting columns (setColumns, elementInserted, elementRemoved ...)
+ Instead it may use addColumnListeners and removeColumnListeners which are called in all
+ the cases.
+ */
+ virtual void addColumnListeners(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xCol);
+ virtual void removeColumnListeners(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xCol);
+
+ void selectionChanged();
+ void columnChanged();
+
+ DECL_LINK(OnQueryGridSlotState, void*);
+ DECL_LINK(OnExecuteGridSlot, void*);
+};
+
+
+
+#endif // _SVX_FMGRID_HXX
+
diff --git a/svx/inc/svx/fmmodel.hxx b/svx/inc/svx/fmmodel.hxx
new file mode 100644
index 000000000000..b5308510229a
--- /dev/null
+++ b/svx/inc/svx/fmmodel.hxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_FMMODEL_HXX
+#define _SVX_FMMODEL_HXX
+
+#include <svx/svdmodel.hxx>
+#include "svx/svxdllapi.h"
+
+class SfxObjectShell;
+class SfxItemPool;
+class VCItemPool;
+class FmXUndoEnvironment;
+class SfxObjectShell;
+class SbxObject;
+class SbxArray;
+class SbxValue;
+
+struct FmFormModelImplData;
+class SVX_DLLPUBLIC FmFormModel :
+ public SdrModel
+{
+private:
+ FmFormModelImplData* m_pImpl;
+ SfxObjectShell* m_pObjShell;
+
+ sal_Bool m_bOpenInDesignMode : 1;
+ sal_Bool m_bAutoControlFocus : 1;
+
+ SVX_DLLPRIVATE FmFormModel( const FmFormModel& ); // never implemented
+ SVX_DLLPRIVATE void operator=(const FmFormModel& rSrcModel); // never implemented
+
+public:
+ TYPEINFO();
+
+ FmFormModel(SfxItemPool* pPool=NULL, SfxObjectShell* pPers=NULL );
+ FmFormModel(const XubString& rPath, SfxItemPool* pPool=NULL,
+ SfxObjectShell* pPers=NULL );
+ FmFormModel(SfxItemPool* pPool, SfxObjectShell* pPers, FASTBOOL bUseExtColorTable);
+ FmFormModel(const XubString& rPath, SfxItemPool* pPool, SfxObjectShell* pPers,
+ FASTBOOL bUseExtColorTable);
+
+ virtual ~FmFormModel();
+
+ virtual SdrPage* AllocPage(FASTBOOL bMasterPage);
+ virtual void InsertPage(SdrPage* pPage, sal_uInt16 nPos=0xFFFF);
+ virtual SdrPage* RemovePage(sal_uInt16 nPgNum);
+ virtual void MovePage(sal_uInt16 nPgNum, sal_uInt16 nNewPos);
+ virtual void InsertMasterPage(SdrPage* pPage, sal_uInt16 nPos=0xFFFF);
+ virtual SdrPage* RemoveMasterPage(sal_uInt16 nPgNum);
+
+ virtual SdrLayerID GetControlExportLayerId( const SdrObject& rObj ) const;
+ SfxObjectShell* GetObjectShell() const { return m_pObjShell; }
+ void SetObjectShell( SfxObjectShell* pShell );
+
+ sal_Bool GetOpenInDesignMode() const { return m_bOpenInDesignMode; }
+ void SetOpenInDesignMode( sal_Bool _bOpenDesignMode );
+
+ sal_Bool GetAutoControlFocus() const { return m_bAutoControlFocus; }
+ void SetAutoControlFocus( sal_Bool _bAutoControlFocus );
+
+ /** check whether the OpenInDesignMode has been set explicitly or been loaded (<FALSE/>)
+ or if it still has the default value from construction (<TRUE/>)
+ */
+ sal_Bool OpenInDesignModeIsDefaulted();
+
+ /** determines whether form controls should use the SdrModel's reference device for text rendering
+ */
+ sal_Bool ControlsUseRefDevice() const;
+
+ FmXUndoEnvironment& GetUndoEnv();
+
+private:
+ void implSetOpenInDesignMode( sal_Bool _bOpenDesignMode, sal_Bool _bForce );
+};
+
+#endif // _FM_FMMODEL_HXX
+
diff --git a/svx/inc/svx/fmobjfac.hxx b/svx/inc/svx/fmobjfac.hxx
new file mode 100644
index 000000000000..7d10ea2ab7b4
--- /dev/null
+++ b/svx/inc/svx/fmobjfac.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_FMOBJFAC_HXX
+#define _SVX_FMOBJFAC_HXX
+
+#include <tools/link.hxx>
+#include "svx/svxdllapi.h"
+
+class SdrObjFactory;
+
+
+
+class SVX_DLLPUBLIC FmFormObjFactory
+{
+public:
+ FmFormObjFactory();
+ ~FmFormObjFactory();
+
+ DECL_LINK(MakeObject, SdrObjFactory*);
+};
+
+
+
+
+#endif // _FM_FMOBJFAC_HXX
+
diff --git a/svx/inc/svx/fmpage.hxx b/svx/inc/svx/fmpage.hxx
new file mode 100644
index 000000000000..d50187f7b81b
--- /dev/null
+++ b/svx/inc/svx/fmpage.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_FMPAGE_HXX
+#define _SVX_FMPAGE_HXX
+
+#include <svx/svdpage.hxx>
+#include <comphelper/uno3.hxx>
+#include "svx/svxdllapi.h"
+
+class StarBASIC;
+class FmFormModel;
+class FmFormPageImpl; // haelt die Liste aller Forms
+
+FORWARD_DECLARE_INTERFACE(container,XNameContainer)
+
+class SdrView;
+class SfxJSArray;
+class HelpEvent;
+
+class SVX_DLLPUBLIC FmFormPage : public SdrPage
+{
+ friend class FmFormObj;
+ FmFormPageImpl* m_pImpl;
+ String m_sPageName;
+ StarBASIC* m_pBasic;
+
+public:
+ TYPEINFO();
+
+ FmFormPage(FmFormModel& rModel,StarBASIC*, FASTBOOL bMasterPage=sal_False);
+ FmFormPage(const FmFormPage& rPage);
+ ~FmFormPage();
+
+ virtual void SetModel(SdrModel* pNewModel);
+
+ virtual SdrPage* Clone() const;
+ using SdrPage::Clone;
+
+ virtual void InsertObject(SdrObject* pObj, sal_uLong nPos = CONTAINER_APPEND,
+ const SdrInsertReason* pReason=NULL);
+
+ virtual SdrObject* RemoveObject(sal_uLong nObjNum);
+
+ // Zugriff auf alle Formulare
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& GetForms( bool _bForceCreate = true ) const;
+
+#ifndef SVX_LIGHT
+ FmFormPageImpl& GetImpl() const { return *m_pImpl; }
+#endif // SVX_LIGHT
+
+public:
+ const String& GetName() const { return m_sPageName; }
+ void SetName( const String& rName ) { m_sPageName = rName; }
+ StarBASIC* GetBasic() const { return m_pBasic; }
+ sal_Bool RequestHelp(
+ Window* pWin,
+ SdrView* pView,
+ const HelpEvent& rEvt );
+};
+
+#endif // _SVX_FMPAGE_HXX
+
diff --git a/svx/inc/svx/fmresids.hrc b/svx/inc/svx/fmresids.hrc
new file mode 100644
index 000000000000..f6843801e522
--- /dev/null
+++ b/svx/inc/svx/fmresids.hrc
@@ -0,0 +1,264 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FMRESIDS_HRC
+#define _SVX_FMRESIDS_HRC
+
+// include -----------------------------------------------------------
+#include <svl/solar.hrc>
+
+// unnamed ressources -------------------------------------------------------
+// sub ressources .....................
+
+// ImageList-Id's -----------------------------------------------------------
+#define RID_SVXIMGLIST_FMEXPL (RID_FORMS_START + 0)
+#define RID_SVXIMGLIST_FMEXPL_HC (RID_FORMS_START + 2)
+
+// Image-Id's -----------------------------------------------------------
+//#define SID_FMSLOTS_START (SID_SVX_START + 592) -> svxids.hrc
+#define RID_SVXIMG_FORM SID_FM_CONFIG
+#define RID_SVXIMG_CONTROL SID_CHOOSE_CONTROLS
+#define RID_SVXIMG_COLLAPSEDNODE (RID_FORMS_START + 2)
+#define RID_SVXIMG_EXPANDEDNODE (RID_FORMS_START + 3)
+#define RID_SVXIMG_BUTTON SID_FM_PUSHBUTTON
+#define RID_SVXIMG_RADIOBUTTON SID_FM_RADIOBUTTON
+#define RID_SVXIMG_CHECKBOX SID_FM_CHECKBOX
+#define RID_SVXIMG_FIXEDTEXT SID_FM_FIXEDTEXT
+#define RID_SVXIMG_GROUPBOX SID_FM_GROUPBOX
+#define RID_SVXIMG_EDIT SID_FM_EDIT
+#define RID_SVXIMG_LISTBOX SID_FM_LISTBOX
+#define RID_SVXIMG_COMBOBOX SID_FM_COMBOBOX
+#define RID_SVXIMG_FORMS (RID_FORMS_START +13)
+#define RID_SVXIMG_IMAGEBUTTON SID_FM_IMAGEBUTTON
+#define RID_SVXIMG_IMAGECONTROL SID_FM_IMAGECONTROL
+#define RID_SVXIMG_FILECONTROL SID_FM_FILECONTROL
+#define RID_SVXIMG_DATEFIELD SID_FM_DATEFIELD
+#define RID_SVXIMG_TIMEFIELD SID_FM_TIMEFIELD
+#define RID_SVXIMG_NUMERICFIELD SID_FM_NUMERICFIELD
+#define RID_SVXIMG_CURRENCYFIELD SID_FM_CURRENCYFIELD
+#define RID_SVXIMG_PATTERNFIELD SID_FM_PATTERNFIELD
+#define RID_SVXIMG_HIDDEN (RID_FORMS_START +22)
+#define RID_SVXIMG_GRID SID_FM_DBGRID
+#define RID_SVXIMG_FORMATTEDFIELD SID_FM_FORMATTEDFIELD
+#define RID_SVXIMG_FILTER SID_FM_FILTERCRIT
+#define RID_SVXIMG_DATE_N_TIME_FIELDS SID_FM_TWOFIELDS_DATE_N_TIME
+#define RID_SVXIMG_FIELD (RID_FORMS_START +27)
+#define RID_SVXIMG_SCROLLBAR SID_FM_SCROLLBAR
+#define RID_SVXIMG_SPINBUTTON SID_FM_SPINBUTTON
+#define RID_SVXIMG_NAVIGATIONBAR SID_FM_NAVIGATIONBAR
+
+// Dialog-Id's -----------------------------------------------------------
+#define RID_SVXTBX_FORM (RID_FORMS_START + 1)
+#define TBX_FORM (RID_FORMS_START + 2)
+#define RID_SVXDLG_ADD_TABLE (RID_FORMS_START + 3)
+#define RID_SVXDLG_TAB_ORDER (RID_FORMS_START + 4)
+#define RID_SVXDLG_SETFORM (RID_FORMS_START + 5)
+#define RID_SVX_FMEXPLORER (RID_FORMS_START + 6)
+#define RID_SVXDLG_ADD_DATAITEM (RID_FORMS_START + 12)
+#define RID_SVXDLG_ADD_CONDITION (RID_FORMS_START + 13)
+#define RID_SVXDLG_NAMESPACE_ITEM (RID_FORMS_START + 14)
+#define RID_SVXDLG_MANAGE_NAMESPACE (RID_FORMS_START + 15)
+#define RID_SVXDLG_ADD_SUBMISSION (RID_FORMS_START + 16)
+#define RID_SVXDLG_ADD_MODEL (RID_FORMS_START + 17)
+#define RID_SVXDLG_ADD_INSTANCE (RID_FORMS_START + 18)
+#define RID_SVXWIN_DATANAVIGATOR (RID_FORMS_START + 19)
+#define RID_SVX_XFORMS_TABPAGES (RID_FORMS_START + 20)
+
+// Toolbars ------------------------------------------------------------
+#define RID_SVXTBX_FORM_NAVIGATION (RID_FORMS_START + 1)
+#define RID_SVXTBX_FORM_FILTER (RID_FORMS_START + 2)
+#define RID_SVXTBX_TEXT_CONTROL_ATTRIBUTES (RID_FORMS_START + 3)
+#define RID_SVXTBX_CONTROLS (RID_FORMS_START + 4)
+#define RID_SVXTBX_MORECONTROLS (RID_FORMS_START + 5)
+#define RID_SVXTBX_FORMDESIGN (RID_FORMS_START + 6)
+
+// Menu-Id's -----------------------------------------------------------
+#define RID_FMEXPLORER_POPUPMENU (RID_FORMS_START + 0)
+#define RID_SVXMNU_ROWS (RID_FORMS_START + 1)
+#define RID_SVXMNU_COLS (RID_FORMS_START + 2)
+#define RID_SVXMNU_CELL (RID_FORMS_START + 3)
+#define RID_FMSHELL_CONVERSIONMENU (RID_FORMS_START + 4)
+#define RID_FM_FILTER_MENU (RID_FORMS_START + 5)
+#define RID_FM_TEXTATTRIBUTE_MENU (RID_FORMS_START + 6)
+#define MENU_FM_TEXTATTRIBITES_STYLE (RID_FORMS_START + 7)
+#define MENU_FM_TEXTATTRIBITES_ALIGNMENT (RID_FORMS_START + 8)
+#define MENU_FM_TEXTATTRIBITES_SPACING (RID_FORMS_START + 9)
+#define RID_MENU_DATANAVIGATOR (RID_FORMS_START + 10)
+
+// QueryBox-Id's -----------------------------------------------------------
+#define RID_QRY_SAVEMODIFIED (RID_FORMS_START + 1)
+#define RID_QRY_REMOVE_MODEL (RID_FORMS_START + 2)
+#define RID_QRY_REMOVE_INSTANCE (RID_FORMS_START + 3)
+#define RID_QRY_REMOVE_ELEMENT (RID_FORMS_START + 4)
+#define RID_QRY_REMOVE_ATTRIBUTE (RID_FORMS_START + 5)
+#define RID_QRY_LINK_WARNING (RID_FORMS_START + 6)
+#define RID_QRY_REMOVE_SUBMISSION (RID_FORMS_START + 7)
+#define RID_QRY_REMOVE_BINDING (RID_FORMS_START + 8)
+
+// ErrorBox-Id's -----------------------------------------------------------
+#define RID_ERR_INVALID_XMLNAME (RID_FORMS_START + 1)
+#define RID_ERR_INVALID_XMLPREFIX (RID_FORMS_START + 2)
+#define RID_ERR_DOUBLE_MODELNAME (RID_FORMS_START + 3)
+#define RID_ERR_EMPTY_SUBMISSIONNAME (RID_FORMS_START + 4)
+
+// String-Id's -----------------------------------------------------------
+#define RID_STR_FORMSHELL (RID_FORMS_START + 10)
+#define RID_STR_STDFORMNAME (RID_FORMS_START + 11)
+#define RID_STR_REC_TEXT (RID_FORMS_START + 12)
+#define RID_STR_REC_FROM_TEXT (RID_FORMS_START + 13)
+#define RID_STR_UNDO_PROPERTY (RID_FORMS_START + 14)
+#define RID_STR_UNDO_CONTAINER_INSERT (RID_FORMS_START + 15)
+#define RID_STR_UNDO_CONTAINER_REMOVE (RID_FORMS_START + 16)
+#define RID_STR_UNDO_CONTAINER_REMOVE_MULTIPLE (RID_FORMS_START + 27)
+#define RID_STR_UNDO_CONTAINER_REPLACE (RID_FORMS_START + 28)
+#define RID_STR_UNDO_TABORDER (RID_FORMS_START + 29)
+#define RID_STR_UNDO_DELETE_LOGICAL (RID_FORMS_START + 30)
+#define RID_STR_UNDO_MODEL_REPLACE (RID_FORMS_START + 31)
+#define RID_STR_NAVIGATIONBAR (RID_FORMS_START + 32)
+#define RID_STR_DEFAULT_CONTROL (RID_FORMS_START + 33)
+#define RID_STR_FORM (RID_FORMS_START + 36)
+#define RID_STR_FIELDSELECTION (RID_FORMS_START + 37)
+#define RID_STR_NO_PROPERTIES (RID_FORMS_START + 38)
+#define RID_STR_PROPERTIES_CONTROL (RID_FORMS_START + 39)
+#define RID_STR_PROPERTIES_FORM (RID_FORMS_START + 40)
+#define RID_STR_FMEXPLORER (RID_FORMS_START + 41)
+#define RID_STR_FORMS (RID_FORMS_START + 42)
+#define RID_STR_WRITEERROR (RID_FORMS_START + 43)
+#define RID_STR_DELETECONFIRM_RECORD (RID_FORMS_START + 44)
+#define RID_STR_DELETECONFIRM (RID_FORMS_START + 45)
+#define RID_STR_GROUPBOX (RID_FORMS_START + 46)
+#define RID_STR_NAVIGATION (RID_FORMS_START + 47)
+#define RID_STR_COLUMN (RID_FORMS_START + 48)
+#define RID_STR_DATE (RID_FORMS_START + 49)
+#define RID_STR_TIME (RID_FORMS_START + 50)
+#define RID_STR_PROPTITLE_NAVBAR (RID_FORMS_START + 51)
+#define RID_STR_PROPTITLE_PUSHBUTTON (RID_FORMS_START + 52)
+#define RID_STR_PROPTITLE_RADIOBUTTON (RID_FORMS_START + 53)
+#define RID_STR_PROPTITLE_CHECKBOX (RID_FORMS_START + 54)
+#define RID_STR_PROPTITLE_FIXEDTEXT (RID_FORMS_START + 55)
+#define RID_STR_PROPTITLE_GROUPBOX (RID_FORMS_START + 56)
+#define RID_STR_PROPTITLE_EDIT (RID_FORMS_START + 57)
+#define RID_STR_PROPTITLE_LISTBOX (RID_FORMS_START + 58)
+#define RID_STR_PROPTITLE_COMBOBOX (RID_FORMS_START + 59)
+#define RID_STR_PROPTITLE_IMAGEBUTTON (RID_FORMS_START + 60)
+#define RID_STR_PROPTITLE_IMAGECONTROL (RID_FORMS_START + 61)
+#define RID_STR_PROPTITLE_FILECONTROL (RID_FORMS_START + 62)
+#define RID_STR_PROPTITLE_DATEFIELD (RID_FORMS_START + 63)
+#define RID_STR_PROPTITLE_TIMEFIELD (RID_FORMS_START + 64)
+#define RID_STR_PROPTITLE_NUMERICFIELD (RID_FORMS_START + 65)
+#define RID_STR_PROPTITLE_CURRENCYFIELD (RID_FORMS_START + 66)
+#define RID_STR_PROPTITLE_PATTERNFIELD (RID_FORMS_START + 67)
+#define RID_STR_PROPTITLE_DBGRID (RID_FORMS_START + 68)
+#define RID_STR_PROPTITLE_MULTISELECT (RID_FORMS_START + 69)
+#define RID_STR_DELETECONFIRM_RECORDS (RID_FORMS_START + 70)
+#define RID_STR_CONTROL (RID_FORMS_START + 71)
+#define RID_STR_POSTFIX_DATE (RID_FORMS_START + 72)
+#define RID_STR_POSTFIX_TIME (RID_FORMS_START + 73)
+#define RID_STR_NODATACONTROLS (RID_FORMS_START + 77)
+#define RID_STR_FILTER_NAVIGATOR (RID_FORMS_START + 78)
+#define RID_STR_FILTER_FILTER_FOR (RID_FORMS_START + 79)
+#define RID_STR_FILTER_FILTER_OR (RID_FORMS_START + 80)
+#define RID_STR_PROPTITLE_FORMATTED (RID_FORMS_START + 81)
+#define RID_STR_SYNTAXERROR (RID_FORMS_START + 82)
+ // FREE
+#define RID_STR_NOCONTROLS_FOR_EXTERNALDISPLAY (RID_FORMS_START + 84)
+#define RID_STR_AUTOFIELD (RID_FORMS_START + 89)
+#define RID_STR_SVT_SQL_SYNTAX_ERROR (RID_FORMS_START + 90)
+#define RID_STR_SVT_SQL_SYNTAX_VALUE_NO_LIKE (RID_FORMS_START + 91)
+#define RID_STR_SVT_SQL_SYNTAX_FIELD_NO_LIKE (RID_FORMS_START + 92)
+#define RID_STR_SVT_SQL_SYNTAX_CRIT_NO_COMPARE (RID_FORMS_START + 93)
+#define RID_STR_SVT_SQL_SYNTAX_INT_NO_VALID (RID_FORMS_START + 94)
+#define RID_STR_SVT_SQL_SYNTAX_ACCESS_DAT_NO_VALID (RID_FORMS_START + 95)
+#define RID_STR_SVT_SQL_SYNTAX_REAL_NO_VALID (RID_FORMS_START + 96)
+#define RID_STR_SVT_SQL_SYNTAX_TABLE (RID_FORMS_START + 97)
+#define RID_STR_SVT_SQL_SYNTAX_COLUMN (RID_FORMS_START + 98)
+#define RID_STR_PROPTITLE_SCROLLBAR (RID_FORMS_START + 99)
+#define RID_STR_PROPTITLE_SPINBUTTON (RID_FORMS_START + 100)
+#define RID_STR_PROPTITLE_HIDDEN (RID_FORMS_START + 101)
+ // FREE
+ // FREE
+ // FREE
+ // FREE
+ // FREE
+ // FREE
+ // FREE
+ // FREE
+ // FREE
+ // FREE
+ // FREE
+ // FREE
+ // FREE
+ // FREE
+ // FREE
+ // FREE
+ // FREE
+ // FREE
+ // FREE
+ // FREE
+ // FREE
+ // FREE
+#define RID_STR_DATANAVIGATOR (RID_FORMS_START + 124)
+#define RID_STR_DATANAV_SUBM_PARENT (RID_FORMS_START + 125)
+#define RID_STR_DATANAV_SUBM_ID (RID_FORMS_START + 126)
+#define RID_STR_DATANAV_SUBM_ACTION (RID_FORMS_START + 127)
+#define RID_STR_DATANAV_SUBM_METHOD (RID_FORMS_START + 128)
+#define RID_STR_DATANAV_SUBM_REF (RID_FORMS_START + 129)
+#define RID_STR_DATANAV_SUBM_BIND (RID_FORMS_START + 130)
+#define RID_STR_DATANAV_SUBM_REPLACE (RID_FORMS_START + 131)
+#define RID_STR_DATANAV_ADD_ELEMENT (RID_FORMS_START + 132)
+#define RID_STR_DATANAV_EDIT_ELEMENT (RID_FORMS_START + 133)
+#define RID_STR_DATANAV_REMOVE_ELEMENT (RID_FORMS_START + 134)
+#define RID_STR_DATANAV_ADD_ATTRIBUTE (RID_FORMS_START + 135)
+#define RID_STR_DATANAV_EDIT_ATTRIBUTE (RID_FORMS_START + 136)
+#define RID_STR_DATANAV_REMOVE_ATTRIBUTE (RID_FORMS_START + 137)
+#define RID_STR_DATANAV_ADD_BINDING (RID_FORMS_START + 138)
+#define RID_STR_DATANAV_EDIT_BINDING (RID_FORMS_START + 139)
+#define RID_STR_DATANAV_REMOVE_BINDING (RID_FORMS_START + 140)
+#define RID_STR_DATANAV_ADD_SUBMISSION (RID_FORMS_START + 141)
+#define RID_STR_DATANAV_EDIT_SUBMISSION (RID_FORMS_START + 142)
+#define RID_STR_DATANAV_REMOVE_SUBMISSION (RID_FORMS_START + 143)
+#define RID_STR_DATANAV_LINKWARN_BUTTON (RID_FORMS_START + 144)
+#define RID_STR_SVT_SQL_SYNTAX_TABLE_OR_QUERY (RID_FORMS_START + 145)
+#define RID_STR_SVT_SQL_SYNTAX_TABLE_EXISTS (RID_FORMS_START + 146)
+#define RID_STR_SVT_SQL_SYNTAX_QUERY_EXISTS (RID_FORMS_START + 147)
+#define RID_STR_READONLY_VIEW (RID_FORMS_START + 148)
+#define RID_STR_ALREADYEXISTOVERWRITE (RID_FORMS_START + 149)
+#define RID_STR_OBJECT_LABEL (RID_FORMS_START + 150)
+
+// Error-String-Id's -----------------------------------------------------------
+#define RID_ERR_START (RID_FORMS_START + 600)
+#define RID_ERR_CONTEXT_ADDFORM (RID_ERR_START + 0)
+#define RID_ERR_DUPLICATE_NAME (RID_ERR_START + 1)
+#define RID_ERR_FIELDREQUIRED (RID_ERR_START + 2)
+#define RID_ERR_NO_ELEMENT (RID_ERR_START + 4)
+
+// untyped resources ----------------------------------------------------------
+
+#define RID_RSC_TABWIN_PREFIX ( RID_FORMS_START + 0 )
+#define RID_RSC_SQL_INTERNATIONAL ( RID_FORMS_START + 1 )
+
+#endif // _FM_FMPAGE_HXX
+
diff --git a/svx/inc/svx/fmsearch.hxx b/svx/inc/svx/fmsearch.hxx
new file mode 100644
index 000000000000..b2722c7016b9
--- /dev/null
+++ b/svx/inc/svx/fmsearch.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _FMSEARCH_HXX
+#define _FMSEARCH_HXX
+
+#include <com/sun/star/sdbc/XResultSet.hpp>
+
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+
+#ifndef _DIALOG_HXX //autogen
+#include <vcl/dialog.hxx>
+#endif
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+#include <vcl/combobox.hxx>
+#include <vcl/lstbox.hxx>
+#include <tools/link.hxx>
+#include <comphelper/uno3.hxx>
+#include <comphelper/stl_types.hxx>
+#include <tools/string.hxx>
+#include "svx/svxdllapi.h"
+
+FORWARD_DECLARE_INTERFACE(util,XNumberFormatsSupplier)
+
+// ===================================================================================================
+// Hilfsmethoden
+
+SVX_DLLPUBLIC sal_Bool IsSearchableControl( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xControl,
+ ::rtl::OUString* pCurrentText = NULL);
+ // check if the control has one of the interfaces we can use for searching
+ // *pCurrentText will be filled with the current text of the control (as used when searching this control)
+
+// ===================================================================================================
+// Hilfsstrukturen
+
+struct FmFoundRecordInformation
+{
+ ::com::sun::star::uno::Any aPosition; // Bookmark des Datensatzes, in dem der Text gefunden wurde
+ sal_Int16 nFieldPos; // dito : die relative Position der Spalte (im Stringnamen in Feldliste im Constructor)
+ sal_Int16 nContext; // Kontext, in dem gesucht und gefunden wurde (falls die aktuelle Suche verschiedene solche kennt)
+};
+
+// ===================================================================================================
+// = struct FmSearchContext - Informationen fuer Suche in verschiedenen Kontexten
+// ===================================================================================================
+
+struct FmSearchContext
+{
+ // [in]
+ sal_Int16 nContext; // die Nummer des Kontextes
+ // [out]
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> xCursor; // der Iterator fuer diesen Kontext
+ String strUsedFields; // eine Liste von durch ';' getrennten Feldnamen
+ ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >
+ arrFields; // die korrespondierenden Text-Interfaces fuer die Felder in strUsedFields
+ String sFieldDisplayNames; // if not empty : names to be displayed for the searchable fields (must have the same token count as strUsedFields !)
+};
+
+#endif // _FMSEARCH_HXX
diff --git a/svx/inc/svx/fmshell.hxx b/svx/inc/svx/fmshell.hxx
new file mode 100644
index 000000000000..f37eeab8c5e6
--- /dev/null
+++ b/svx/inc/svx/fmshell.hxx
@@ -0,0 +1,191 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FMSHELL_HXX
+#define _SVX_FMSHELL_HXX
+
+// ***************************************************************************************************
+// ***************************************************************************************************
+// ***************************************************************************************************
+
+#include <sfx2/shell.hxx>
+#include <sfx2/module.hxx>
+#include <vcl/event.hxx>
+
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+#include <svx/fmview.hxx>
+#include "svx/svxdllapi.h"
+
+#include <svx/ifaceids.hxx>
+
+//========================================================================
+class FmFormModel;
+class FmFormPage;
+class SvxFmTabWin;
+class FmXFormShell;
+class FmFormView;
+class SdrView;
+class SdrPage;
+class SdrUnoObj;
+
+namespace com { namespace sun { namespace star { namespace form {
+ class XForm;
+ namespace runtime {
+ class XFormController;
+ }
+} } } }
+
+namespace svx
+{
+ class ISdrObjectFilter;
+}
+
+//========================================================================
+class SVX_DLLPUBLIC FmDesignModeChangedHint : public SfxHint
+{
+ sal_Bool m_bDesignMode;
+
+public:
+ TYPEINFO();
+ FmDesignModeChangedHint( sal_Bool bDesMode );
+ virtual ~FmDesignModeChangedHint();
+
+ sal_Bool GetDesignMode() const { return m_bDesignMode; }
+};
+
+//========================================================================
+class SVX_DLLPUBLIC FmFormShell : public SfxShell
+{
+ friend class FmFormView;
+ friend class FmXFormShell;
+
+ FmXFormShell* m_pImpl;
+ FmFormView* m_pFormView;
+ FmFormModel* m_pFormModel;
+ SfxViewShell* m_pParentShell;
+
+ sal_uInt16 m_nLastSlot;
+ sal_Bool m_bDesignMode : 1;
+ sal_Bool m_bHasForms : 1; // Flag welches festhaelt, ob Formulare auf einer Seite
+ // vorhanden sind, nur für den DesignMode, siehe UIFeatureChanged!
+
+ // die Markierungen einer FormView haben sich geaendert ...
+ void NotifyMarkListChanged(FmFormView*);
+ // (die FormView selber ist kein Broadcaster, deshalb kann sie den Formular-Explorer, den dieses
+ // Ereignis interesiert, nicht sauber verstaendigen (sie koennte sich lediglich von der Application
+ // das Navigator-Fenster geben lassen, aber das wollen wir ja nicht, ge ? ...))
+
+ class FormShellWaitObject
+ {
+ Window* m_pWindow;
+ public:
+ FormShellWaitObject(const FmFormShell* _pShell);
+ ~FormShellWaitObject();
+ };
+ friend class FormShellWaitObject;
+
+ const OutputDevice* GetCurrentViewDevice() const { return m_pFormView ? m_pFormView->GetActualOutDev() : NULL; }
+
+public:
+ SFX_DECL_INTERFACE(SVX_INTERFACE_FORM_SH)
+ TYPEINFO();
+
+ FmFormShell(SfxViewShell* pParent, FmFormView* pView = NULL);
+ virtual ~FmFormShell();
+
+ virtual void Execute( SfxRequest& );
+ virtual void GetState( SfxItemSet& );
+ virtual sal_Bool HasUIFeature( sal_uInt32 nFeature );
+
+ void ExecuteTextAttribute( SfxRequest& );
+ void GetTextAttributeState( SfxItemSet& );
+
+ sal_Bool GetY2KState(sal_uInt16& nReturn);
+ void SetY2KState(sal_uInt16 n);
+
+ void SetView(FmFormView* pView);
+
+ FmFormView* GetFormView() const { return m_pFormView; }
+ FmFormModel* GetFormModel() const { return m_pFormModel; }
+ FmFormPage* GetCurPage() const;
+ FmXFormShell* GetImpl() const {return m_pImpl;};
+
+ sal_uInt16 PrepareClose(sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False);
+
+ bool IsActiveControl() const;
+ void ForgetActiveControl();
+ void SetControlActivationHandler( const Link& _rHdl );
+
+ virtual void Activate(sal_Bool bMDI);
+ virtual void Deactivate(sal_Bool bMDI);
+
+ // helper methods for implementing XFormLayerAccess
+ SdrUnoObj* GetFormControl(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxModel,
+ const SdrView& _rView,
+ const OutputDevice& _rDevice,
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _out_rxControl
+ ) const;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > GetFormController(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm,
+ const SdrView& _rView,
+ const OutputDevice& _rDevice
+ ) const;
+
+ /** puts the focus into the document window, if current a form control has the focus. Otherwise, moves the focus
+ to the control belonging to the given SdrUnoObj.
+ */
+ void ToggleControlFocus(
+ const SdrUnoObj& i_rNextCandidate,
+ const SdrView& i_rView,
+ OutputDevice& i_rDevice
+ ) const;
+
+ ::std::auto_ptr< ::svx::ISdrObjectFilter >
+ CreateFocusableControlFilter(
+ const SdrView& i_rView,
+ const OutputDevice& i_rDevice
+ ) const;
+
+ sal_Bool IsDesignMode() const { return m_bDesignMode; }
+ void SetDesignMode( sal_Bool _bDesignMode );
+
+protected:
+ void GetFormState(SfxItemSet &rSet, sal_uInt16 nWhich);
+
+ // gibt es ein Formular auf der aktuellen Seite?
+ void DetermineForms(sal_Bool bInvalidate);
+ void impl_setDesignMode( sal_Bool bDesign);
+};
+
+// ***************************************************************************************************
+// ***************************************************************************************************
+// ***************************************************************************************************
+
+#endif // _SVX_FMSHELL_HXX
diff --git a/svx/inc/svx/fmsrccfg.hxx b/svx/inc/svx/fmsrccfg.hxx
new file mode 100644
index 000000000000..3705f32b7494
--- /dev/null
+++ b/svx/inc/svx/fmsrccfg.hxx
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _FMSRCCF_HXX_
+#define _FMSRCCF_HXX_
+
+#include <tools/string.hxx>
+#include <unotools/configvaluecontainer.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include "svx/svxdllapi.h"
+
+// ===================================================================================================
+
+#define MATCHING_ANYWHERE 0
+#define MATCHING_BEGINNING 1
+#define MATCHING_END 2
+#define MATCHING_WHOLETEXT 3
+
+// diese Konstanten duerfen NICHT einfach geaendert werden, da der SearchDialog aus den Einstellungen seiner ListBox
+// keine Umrechnungen vornimmt, sondern die einfach in die entsprechenden Methoden der SearchEngine steckt
+// (wenn man also die Konstanten oder die Reihenfolge der Listbox-Eintraege im Dialog aendert, muss das jeweils andere
+// angepasst werden)
+
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ // ===================================================================================================
+ // = struct FmSearchParams - Parameter einer Suche
+ // ===================================================================================================
+
+ struct SVX_DLLPUBLIC FmSearchParams
+ {
+ protected:
+ sal_Int32 nTransliterationFlags;
+ // they're way too sensitive for direct access ....
+
+ public:
+ // no bit fields at all (want to pass the addresses to the OConfigurationValueContainer)
+ ::com::sun::star::uno::Sequence< ::rtl::OUString >
+ aHistory;
+ ::rtl::OUString sSingleSearchField;
+
+ sal_Int16 nSearchForType;
+ sal_Int16 nPosition;
+ sal_Int16 nLevOther;
+ sal_Int16 nLevShorter;
+ sal_Int16 nLevLonger;
+ sal_Bool bLevRelaxed;
+
+ sal_Bool bAllFields;
+ sal_Bool bUseFormatter;
+ sal_Bool bBackwards;
+ sal_Bool bWildcard;
+ sal_Bool bRegular;
+ sal_Bool bApproxSearch;
+ // the last three are mutually exclusive
+
+ sal_Bool bSoundsLikeCJK;
+
+ // ......................................
+ FmSearchParams();
+
+ sal_Bool isIgnoreWidthCJK( ) const;
+ void setIgnoreWidthCJK( sal_Bool _bIgnore );
+
+ sal_Int32 getTransliterationFlags( ) const { return nTransliterationFlags; }
+ void setTransliterationFlags( sal_Int32 _nFlags ) { nTransliterationFlags = _nFlags; }
+
+ sal_Bool isCaseSensitive( ) const;
+ void setCaseSensitive( sal_Bool _bCase );
+ };
+
+ // ===================================================================================================
+ // = class FmSearchConfigItem - ein ConfigItem, dass sich Suchparameter merkt
+ // ===================================================================================================
+
+ class SVX_DLLPUBLIC FmSearchConfigItem
+ :protected FmSearchParams
+ ,public ::utl::OConfigurationValueContainer
+ // order matters!
+ {
+ private:
+ ::osl::Mutex m_aMutex;
+
+ // wrapper properties:
+ // some of the members of FmSearchParams are must be translated to be stored in the configuration
+ ::rtl::OUString m_sSearchForType;
+ ::rtl::OUString m_sSearchPosition;
+
+ sal_Bool m_bIsMatchCase;
+ sal_Bool m_bIsMatchFullHalfWidthForms;
+ sal_Bool m_bIsMatchHiraganaKatakana;
+ sal_Bool m_bIsMatchContractions;
+ sal_Bool m_bIsMatchMinusDashCho_on;
+ sal_Bool m_bIsMatchRepeatCharMarks;
+ sal_Bool m_bIsMatchVariantFormKanji;
+ sal_Bool m_bIsMatchOldKanaForms;
+ sal_Bool m_bIsMatch_DiZi_DuZu;
+ sal_Bool m_bIsMatch_BaVa_HaFa;
+ sal_Bool m_bIsMatch_TsiThiChi_DhiZi;
+ sal_Bool m_bIsMatch_HyuIyu_ByuVyu;
+ sal_Bool m_bIsMatch_SeShe_ZeJe;
+ sal_Bool m_bIsMatch_IaIya;
+ sal_Bool m_bIsMatch_KiKu;
+ sal_Bool m_bIsIgnorePunctuation;
+ sal_Bool m_bIsIgnoreWhitespace;
+ sal_Bool m_bIsIgnoreProlongedSoundMark;
+ sal_Bool m_bIsIgnoreMiddleDot;
+
+ public:
+ FmSearchConfigItem();
+ ~FmSearchConfigItem();
+
+ const FmSearchParams& getParams( ) const;
+ void setParams( const FmSearchParams& _rParams );
+
+ private:
+ SVX_DLLPRIVATE void implTranslateFromConfig( );
+ SVX_DLLPRIVATE void implTranslateToConfig( );
+ };
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
+// ===================================================================================================
+
+#endif // _FMSRCCF_HXX_
+
diff --git a/svx/inc/svx/fmsrcimp.hxx b/svx/inc/svx/fmsrcimp.hxx
new file mode 100644
index 000000000000..3a3af0ac7d8f
--- /dev/null
+++ b/svx/inc/svx/fmsrcimp.hxx
@@ -0,0 +1,401 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _FMSRCIMP_HXX
+#define _FMSRCIMP_HXX
+
+#include <svx/fmtools.hxx>
+#include "svx/svxdllapi.h"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/XCheckBox.hpp>
+#include <com/sun/star/awt/XListBox.hpp>
+#include <com/sun/star/awt/XTextComponent.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/stl_types.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <osl/mutex.hxx>
+#include <unotools/charclass.hxx>
+#include <unotools/collatorwrapper.hxx>
+#include <vos/thread.hxx>
+
+#include <deque>
+
+// ===================================================================================================
+// = class FmSearchThread - wie der Name schon sagt
+// ===================================================================================================
+
+class FmSearchEngine;
+class FmSearchThread : public ::vos::OThread
+{
+ FmSearchEngine* m_pEngine;
+ Link m_aTerminationHdl;
+
+ virtual void SAL_CALL run();
+ virtual void SAL_CALL onTerminated();
+
+public:
+ FmSearchThread(FmSearchEngine* pEngine) : m_pEngine(pEngine) { }
+ void setTerminationHandler(Link aHdl) { m_aTerminationHdl = aHdl; }
+};
+
+// ===================================================================================================
+// = struct FmSearchProgress - diese Struktur bekommt der Owner der SearchEngine fuer Status-Updates
+// = (und am Ende der Suche)
+// ===================================================================================================
+
+struct FmSearchProgress
+{
+ enum STATE { STATE_PROGRESS, STATE_PROGRESS_COUNTING, STATE_CANCELED, STATE_SUCCESSFULL, STATE_NOTHINGFOUND, STATE_ERROR };
+ // (Bewegung auf neuen Datensatz; Fortschritt beim Zaehlen von Datensaetzen; abgebrochen; Datensatz gefunden;
+ // nichts gefunden, irgendein nicht zu handelnder Fehler)
+ STATE aSearchState;
+
+ // aktueller Datensatz - immer gueltig (ist zum Beispiel bei Abbrechen auch fuer das Weitersuchen interesant)
+ sal_uInt32 nCurrentRecord;
+ // Ueberlauf - nur gueltig bei STATE_PROGRESS
+ sal_Bool bOverflow;
+
+ // die Position des Such-Cursors - bei STATE_SUCCESSFULL, STATE_CANCELED und STATE_NOTHING_FOUND gueltig
+ ::com::sun::star::uno::Any aBookmark;
+ // das Feld, in dem der Text gefunden wurde - bei STATE_SUCCESSFULL gueltig
+ sal_Int32 nFieldIndex;
+};
+
+// ===================================================================================================
+// = class FmRecordCountListener - Hilfsklasse fuer FmSearchEngine, lauscht an einem Cursor und teilt
+// = Aenderungem im RecordCount mit
+// ===================================================================================================
+
+class FmRecordCountListener : public ::cppu::WeakImplHelper1< ::com::sun::star::beans::XPropertyChangeListener>
+{
+// Atribute
+ Link m_lnkWhoWantsToKnow;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xListening;
+
+// Attribut-Zugriff
+public:
+ Link SetPropChangeHandler(const Link& lnk);
+
+// Oprationen
+public:
+ FmRecordCountListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& dbcCursor);
+ // the set has to support the sdb::ResultSet service
+ virtual ~FmRecordCountListener();
+
+ // DECLARE_UNO3_AGG_DEFAULTS(FmPropertyListener, UsrObject);
+ // virtual sal_Bool queryInterface(::com::sun::star::uno::Uik aUik, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rOut);
+
+// ::com::sun::star::lang::XEventListener
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::beans::XPropertyChangeListener
+ virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException);
+
+ void DisConnect();
+
+private:
+ void NotifyCurrentCount();
+
+};
+
+// ===================================================================================================
+// = class FmSearchEngine - Impl-Klasse fuer FmSearchDialog
+// ===================================================================================================
+
+namespace svxform {
+ // We have three possible control types we may search in, determined by the supported interfaces : ::com::sun::star::awt::XTextComponent, ::com::sun::star::awt::XListBox, ::com::sun::star::awt::XCheckBox.
+ // While searching we don't want to do this distinction for every control in every round. So we need some helpers.
+ class ControlTextWrapper
+ {
+ // attributes
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xControl;
+ // attribute access
+ public:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getControl() const{ return m_xControl; }
+ public:
+ ControlTextWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xControl) { m_xControl = _xControl; }
+ virtual ~ControlTextWrapper() { }
+
+ virtual ::rtl::OUString getCurrentText() const = 0;
+ };
+ class SimpleTextWrapper : public ControlTextWrapper
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent > m_xText;
+ public:
+ SimpleTextWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent >& _xText);
+ virtual ::rtl::OUString getCurrentText() const;
+ };
+ class ListBoxWrapper : public ControlTextWrapper
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XListBox > m_xBox;
+ public:
+ ListBoxWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XListBox >& _xBox);
+ virtual ::rtl::OUString getCurrentText() const;
+ };
+ class CheckBoxWrapper : public ControlTextWrapper
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XCheckBox > m_xBox;
+ public:
+ CheckBoxWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XCheckBox >& _xBox);
+ virtual ::rtl::OUString getCurrentText() const;
+ };
+}
+
+enum FMSEARCH_MODE { SM_BRUTE, SM_ALLOWSCHEDULE, SM_USETHREAD };
+
+DECLARE_STL_VECTOR( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>, InterfaceArray);
+
+class SVX_DLLPUBLIC FmSearchEngine
+{
+ friend class FmSearchThread;
+
+ enum SEARCH_RESULT { SR_FOUND, SR_NOTFOUND, SR_ERROR, SR_CANCELED };
+ enum SEARCHFOR_TYPE { SEARCHFOR_STRING, SEARCHFOR_NULL, SEARCHFOR_NOTNULL };
+
+ // zugrundeliegende Daten
+ CursorWrapper m_xSearchCursor;
+ std::deque<sal_Int32> m_arrFieldMapping;
+ // da der Iterator durchaus mehr Spalten haben kann, als ich eigentlich verwalte (in meiner Feld-Listbox),
+ // muss ich mir hier ein Mapping dieser ::com::sun::star::form-Schluessel auf die Indizies der entsprechenden Spalten im Iterator halten
+
+ // der Formatter
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > m_xFormatSupplier;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xFormatter;
+
+ CharClass m_aCharacterClassficator;
+ CollatorWrapper m_aStringCompare;
+
+ // die Sammlung aller interesanten Felder (bzw. ihre ::com::sun::star::data::XDatabaseVariant-Interfaces und ihre FormatKeys)
+ struct FieldInfo
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn > xContents;
+ sal_uInt32 nFormatKey;
+ sal_Bool bDoubleHandling;
+ };
+
+ DECLARE_STL_VECTOR(FieldInfo, FieldCollection);
+ FieldCollection m_arrUsedFields;
+ sal_Int32 m_nCurrentFieldIndex; // der letzte Parameter von RebuildUsedFields, ermoeglicht mir Checks in FormatField
+
+ DECLARE_STL_VECTOR(svxform::ControlTextWrapper*, ControlTextSuppliers);
+ ControlTextSuppliers m_aControlTexts;
+
+ sal_Bool m_bUsingTextComponents;
+ CursorWrapper m_xOriginalIterator;
+ CursorWrapper m_xClonedIterator;
+
+ // Daten fuer Entscheidung, in welchem Feld ich ein "Found" akzeptiere
+ ::com::sun::star::uno::Any m_aPreviousLocBookmark; // Position, an der ich zuletzt fuendig war
+ FieldCollectionIterator m_iterPreviousLocField; // dito Feld
+
+ // Kommunikation mit dem Thread, der die eigentliche Suche durchfuehrt
+ ::rtl::OUString m_strSearchExpression; // Hinrichtung
+ SEARCHFOR_TYPE m_eSearchForType; // dito
+ SEARCH_RESULT m_srResult; // Rueckrichtung
+
+ // der Link, dem ich Fortschritte und Ergebnisse mitteile
+ Link m_aProgressHandler;
+ sal_Bool m_bSearchingCurrently : 1; // laeuft gerade eine (asynchrone) Suche ?
+ sal_Bool m_bCancelAsynchRequest : 1; // soll abgebrochen werden ?
+ ::osl::Mutex m_aCancelAsynchAccess; // Zugriff auf m_bCancelAsynchRequest (eigentlich nur bei
+ // m_eMode == SM_USETHREAD interesant)
+ FMSEARCH_MODE m_eMode; //CHINA001 FmSearchDialog::SEARCH_MODE m_eMode; // der aktuelle Modus
+ // der aktuelle Modus
+
+ // Parameter fuer die Suche
+ sal_Bool m_bFormatter : 1; // Feldformatierung benutzen
+ sal_Bool m_bForward : 1; // Richtung
+ sal_Bool m_bWildcard : 1; // Platzhalter-Suche ?
+ sal_Bool m_bRegular : 1; // regulaerer Ausdruck
+ sal_Bool m_bLevenshtein : 1; // Levenshtein-Suche
+ sal_Bool m_bTransliteration : 1; // Levenshtein-Suche
+
+ sal_Bool m_bLevRelaxed : 1; // Parameter fuer Levenshtein-Suche
+ sal_uInt16 m_nLevOther;
+ sal_uInt16 m_nLevShorter;
+ sal_uInt16 m_nLevLonger;
+
+ sal_uInt16 m_nPosition; // wenn nicht regulaer oder lev, dann einer der MATCHING_...-Werte
+
+ sal_Int32 m_nTransliterationFlags;
+
+// -------------
+// Memberzugriff
+private:
+ SVX_DLLPRIVATE sal_Bool CancelRequested(); // liefert eine durch m_aCancelAsynchAccess gesicherte Auswertung von m_bCancelAsynchRequest
+
+public:
+ void SetCaseSensitive(sal_Bool bSet);
+ sal_Bool GetCaseSensitive() const;
+
+ void SetFormatterUsing(sal_Bool bSet); // das ist etwas umfangreicher, deshalb kein hier inline ....
+ sal_Bool GetFormatterUsing() const { return m_bFormatter; }
+
+ void SetDirection(sal_Bool bForward) { m_bForward = bForward; }
+ sal_Bool GetDirection() const { return m_bForward; }
+
+ void SetWildcard(sal_Bool bSet) { m_bWildcard = bSet; }
+ sal_Bool GetWildcard() const { return m_bWildcard; }
+
+ void SetRegular(sal_Bool bSet) { m_bRegular = bSet; }
+ sal_Bool GetRegular() const { return m_bRegular; }
+
+ void SetLevenshtein(sal_Bool bSet) { m_bLevenshtein = bSet; }
+ sal_Bool GetLevenshtein() const { return m_bLevenshtein; }
+
+ void SetIgnoreWidthCJK(sal_Bool bSet);
+ sal_Bool GetIgnoreWidthCJK() const;
+
+ void SetTransliteration(sal_Bool bSet) { m_bTransliteration = bSet; }
+ sal_Bool GetTransliteration() const { return m_bTransliteration; }
+
+ void SetLevRelaxed(sal_Bool bSet) { m_bLevRelaxed = bSet; }
+ sal_Bool GetLevRelaxed() const { return m_bLevRelaxed; }
+ void SetLevOther(sal_uInt16 nHowMuch) { m_nLevOther = nHowMuch; }
+ sal_uInt16 GetLevOther() const { return m_nLevOther; }
+ void SetLevShorter(sal_uInt16 nHowMuch) { m_nLevShorter = nHowMuch; }
+ sal_uInt16 GetLevShorter() const { return m_nLevShorter; }
+ void SetLevLonger(sal_uInt16 nHowMuch) { m_nLevLonger = nHowMuch; }
+ sal_uInt16 GetLevLonger() const { return m_nLevLonger; }
+ // die ganzen Lev-Werte werden nur bei m_bLevenshtein==sal_True beachtet
+
+ void SetTransliterationFlags(sal_Int32 _nFlags) { m_nTransliterationFlags = _nFlags; }
+ sal_Int32 GetTransliterationFlags() const { return m_nTransliterationFlags; }
+
+ void SetPosition(sal_uInt16 nValue) { m_nPosition = nValue; }
+ sal_uInt16 GetPosition() const { return m_nPosition; }
+ // Position wird bei m_bWildCard==sal_True nicht beachtet
+
+ FMSEARCH_MODE GetSearchMode() const { return m_eMode; }
+
+public:
+ /** zwei Constructoren, beide analog zu denen des FmSearchDialog, Erklaerung siehe also dort ....
+ xCursor muss jeweils den ::com::sun::star::data::DatabaseCursor-Service implementieren.
+ wenn eMode == SM_USETHREAD, sollte ein ProgressHandler gesetzt sein, da dann die Ergebnisuebermittlung ueber diesen
+ Handler erfolgt.
+ Ist eMode != SM_USETHREAD, kehren SearchNext und StarOver nicht zurueck, bevor die Suche (erfolgreich oder nicht) beendet
+ wurde, dann kann man das Ergebnis danach abfragen. Ist zusaetzlich der ProgressHandler gesetzt, wird dieser fuer jeden neuen
+ Datensatz sowie am Ende der Suche aufgerufen.
+ */
+ FmSearchEngine(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& xCursor,
+ const ::rtl::OUString& strVisibleFields,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xFormat,
+ FMSEARCH_MODE eMode);//CHINA001 FmSearchDialog::SEARCH_MODE eMode);
+ FmSearchEngine(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& xCursor,
+ const ::rtl::OUString& strVisibleFields,
+ const InterfaceArray& arrFields,
+ FMSEARCH_MODE eMode); //CHINA001 FmSearchDialog::SEARCH_MODE eMode);
+
+ virtual ~FmSearchEngine();
+
+ /** der Link wird fuer jeden Datensatz und nach Beendigung der Suche aufgerufen, Parameter ist ein Zeiger auf
+ eine FmSearchProgress-Struktur
+ der Handler sollte auf jeden Fall Thread-sicher sein
+ */
+ void SetProgressHandler(Link aHdl) { m_aProgressHandler = aHdl; }
+
+ /// das naechste Vorkommen suchen (Werte fuer nDirection siehe DIRECTION_*-defines)
+ void SearchNext(const ::rtl::OUString& strExpression);
+ /// analogous, search for "NULL" (_bSearchForNull==sal_True) or "not NULL"
+ void SearchNextSpecial(sal_Bool _bSearchForNull);
+ /// das naechste Vorkommen suchen, abhaengig von nDirection wird dabei am Anfang oder am Ende neu begonnen
+ void StartOver(const ::rtl::OUString& strExpression);
+ /// analogous, search for "NULL" (_bSearchForNull==sal_True) or "not NULL"
+ void StartOverSpecial(sal_Bool _bSearchForNull);
+ /// die Angaben ueber letzte Fundstelle invalidieren
+ void InvalidatePreviousLoc();
+
+ /** baut m_arrUsedFields neu auf (nFieldIndex==-1 bedeutet alle Felder, ansonsten gibt es den Feldindex an)
+ wenn bForce nicht gesetzt ist, passiert bei nFieldIndex == m_nCurrentFieldIndex nichts
+ (ruft InvalidatePreviousLoc auf)
+ */
+ void RebuildUsedFields(sal_Int32 nFieldIndex, sal_Bool bForce = sal_False);
+ ::rtl::OUString FormatField(sal_Int32 nWhich);
+
+ /// kehrt sofort zurueck; nachdem wirklich abgebrochen wurde, wird der ProgressHandler mit STATE_CANCELED aufgerufen
+ void CancelSearch();
+
+ /** nur gueltig, wenn nicht gerade eine (asynchrone) Suche laeuft, die naechste Suche wird dann auf dem neuen Iterator
+ mit den neuen Parametern durchgefuehrt
+ */
+ sal_Bool SwitchToContext(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& xCursor, const ::rtl::OUString& strVisibleFields, const InterfaceArray& arrFields,
+ sal_Int32 nFieldIndex);
+
+protected:
+ void Init(const ::rtl::OUString& strVisibleFields);
+
+ void SearchNextImpl();
+ // diese Impl-Methode laeuft im SearchThread
+
+ // start a thread-search (or call SearchNextImpl directly, depending on the search mode)
+ void ImplStartNextSearch();
+
+private:
+ SVX_DLLPRIVATE void clearControlTexts();
+ SVX_DLLPRIVATE void fillControlTexts(const InterfaceArray& arrFields);
+
+ // three methods implementing a complete search loop (null/not null, wildcard, SearchText)
+ // (they all have some code in common, but with this solution we have do do a distinction only once per search (before
+ // starting the loop), not in every loop step
+ SVX_DLLPRIVATE SEARCH_RESULT SearchSpecial(sal_Bool _bSearchForNull, sal_Int32& nFieldPos, FieldCollectionIterator& iterFieldLoop,
+ const FieldCollectionIterator& iterBegin, const FieldCollectionIterator& iterEnd);
+ SVX_DLLPRIVATE SEARCH_RESULT SearchWildcard(const ::rtl::OUString& strExpression, sal_Int32& nFieldPos, FieldCollectionIterator& iterFieldLoop,
+ const FieldCollectionIterator& iterBegin, const FieldCollectionIterator& iterEnd);
+ SVX_DLLPRIVATE SEARCH_RESULT SearchRegularApprox(const ::rtl::OUString& strExpression, sal_Int32& nFieldPos, FieldCollectionIterator& iterFieldLoop,
+ const FieldCollectionIterator& iterBegin, const FieldCollectionIterator& iterEnd);
+
+ SVX_DLLPRIVATE void PropagateProgress(sal_Bool _bDontPropagateOverflow);
+ // ruft den ProgressHandler mit STATE_PROGRESS und der aktuellen Position des SearchIterators auf
+
+ // helpers, die ich mehrmals brauche
+ SVX_DLLPRIVATE sal_Bool MoveCursor();
+ // bewegt m_xSearchIterator unter Beachtung von Richtung/Ueberlauf Cursor
+ SVX_DLLPRIVATE sal_Bool MoveField(sal_Int32& nPos, FieldCollectionIterator& iter, const FieldCollectionIterator& iterBegin, const FieldCollectionIterator& iterEnd);
+ // bewegt den Iterator unter Beachtung von Richtung/Ueberlauf Iterator/Ueberlauf Cursor
+ SVX_DLLPRIVATE void BuildAndInsertFieldInfo(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xAllFields, sal_Int32 nField);
+ // baut eine FieldInfo zum Feld Nummer nField (in xAllFields) auf und fuegt sie zu m_arrUsedFields hinzu
+ // xAllFields muss den DatabaseRecord-Service unterstuetzen
+ SVX_DLLPRIVATE ::rtl::OUString FormatField(const FieldInfo& rField);
+ // formatiert das Feld mit dem NumberFormatter
+
+ SVX_DLLPRIVATE sal_Bool HasPreviousLoc() { return m_aPreviousLocBookmark.hasValue(); }
+
+ DECL_LINK(OnSearchTerminated, FmSearchThread*);
+ // wird vom SuchThread benutzt, nach Rueckkehr aus diesem Handler loescht sich der Thread selber
+ DECL_LINK(OnNewRecordCount, void*);
+};
+
+#endif // _FMSRCIMP_HXX
+
diff --git a/svx/inc/svx/fmtools.hxx b/svx/inc/svx/fmtools.hxx
new file mode 100644
index 000000000000..f98919fe47d8
--- /dev/null
+++ b/svx/inc/svx/fmtools.hxx
@@ -0,0 +1,234 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FMTOOLS_HXX
+#define _SVX_FMTOOLS_HXX
+
+#include "svx/svxdllapi.h"
+
+#include <com/sun/star/sdb/SQLContext.hpp>
+#include <com/sun/star/sdb/XSQLQueryComposerFactory.hpp>
+#include <com/sun/star/sdbcx/Privilege.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#include <com/sun/star/sdb/XColumn.hpp>
+#include <com/sun/star/sdb/XColumnUpdate.hpp>
+#include <com/sun/star/sdb/SQLErrorEvent.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
+#include <com/sun/star/sdbcx/XRowLocate.hpp>
+#include <com/sun/star/sdbc/XDataSource.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/XDispatchProviderInterception.hpp>
+#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/frame/FeatureStateEvent.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/awt/FontUnderline.hpp>
+#include <com/sun/star/awt/FontStrikeout.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/io/XObjectInputStream.hpp>
+#include <com/sun/star/io/XObjectOutputStream.hpp>
+#include <com/sun/star/io/XPersistObject.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/util/XNumberFormats.hpp>
+
+#include <tools/wintypes.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <comphelper/uno3.hxx>
+#include <comphelper/stl_types.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <svl/svstdarr.hxx>
+
+#include <set>
+
+class Window;
+
+//==================================================================
+// allgemeine Typen
+//==================================================================
+// displaying a database exception for the user
+// display info about a simple ::com::sun::star::sdbc::SQLException
+void displayException(const ::com::sun::star::sdbc::SQLException&, Window* _pParent = NULL);
+void displayException(const ::com::sun::star::sdbc::SQLWarning&, Window* _pParent = NULL);
+SVX_DLLPUBLIC void displayException(const ::com::sun::star::sdb::SQLContext&, Window* _pParent = NULL);
+void displayException(const ::com::sun::star::sdb::SQLErrorEvent&, Window* _pParent = NULL);
+void displayException(const ::com::sun::star::uno::Any&, Window* _pParent = NULL);
+
+sal_Int32 getElementPos(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& xCont, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& xElement);
+
+SVX_DLLPUBLIC ::rtl::OUString getLabelName(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& xControlModel);
+
+// ===================================================================================================
+// = class CursorWrapper - eine Hilfsklasse, die parallel mit je einem ::com::sun::star::uno::Reference<XDatabaseUpdateCursor>,
+// XDatabaseBookmarkCursor und XDatabaseDirectCursor arbeitet
+// ===================================================================================================
+
+class CursorWrapper
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xGeneric;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> m_xMoveOperations;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XRowLocate> m_xBookmarkOperations;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier> m_xColumnsSupplier;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xPropertyAccess;
+
+public:
+ // Construction/Destruction
+ CursorWrapper() { }
+ CursorWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxCursor, sal_Bool bUseCloned = sal_False);
+ SVX_DLLPUBLIC CursorWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _rxCursor, sal_Bool bUseCloned = sal_False);
+ // bei bUseCloned == sal_True wird der Cursor ueber das XCloneable-Interface (dass er besitzen muss) gedoubled und
+ // erst dann benutzt
+
+ friend bool operator==(const CursorWrapper& lhs, const CursorWrapper& rhs)
+ {
+ return lhs.m_xGeneric.get() == rhs.m_xGeneric.get();
+ }
+
+ sal_Bool is() const { return m_xMoveOperations.is(); }
+ sal_Bool Is() const { return m_xMoveOperations.is(); }
+
+ CursorWrapper* operator ->() { return this; }
+ operator const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& () const{ return m_xGeneric; }
+
+ // 'Konvertierungen'
+ const CursorWrapper& operator=(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& xCursor);
+ operator const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& () const { return m_xMoveOperations; }
+ operator const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XRowLocate>& () const { return m_xBookmarkOperations; }
+ operator const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier>& () const { return m_xColumnsSupplier; }
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& getPropertySet() const { return m_xPropertyAccess; }
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& getResultSet() const { return m_xMoveOperations; }
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XRowLocate >& getRowLocate() const { return m_xBookmarkOperations; }
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier >& getColumnsSupplier() const { return m_xColumnsSupplier; }
+
+ // das normale queryInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& type) throw ( ::com::sun::star::uno::RuntimeException )
+ { return m_xMoveOperations->queryInterface(type); }
+
+ // ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XRowLocate>
+ ::com::sun::star::uno::Any getBookmark(void)
+ throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException )
+ { return m_xBookmarkOperations->getBookmark(); }
+ sal_Bool moveToBookmark(const ::com::sun::star::uno::Any& bookmark) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ) { return m_xBookmarkOperations->moveToBookmark(bookmark); }
+ sal_Bool moveRelativeToBookmark(const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ) { return m_xBookmarkOperations->moveRelativeToBookmark(bookmark, rows); }
+ sal_Int32 compareBookmarks(const ::com::sun::star::uno::Any& lhs, const ::com::sun::star::uno::Any& rhs) const throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ) { return m_xBookmarkOperations->compareBookmarks(lhs, rhs); }
+ sal_Int32 hasOrderedBookmarks(void) const throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ) { return m_xBookmarkOperations->hasOrderedBookmarks(); }
+ sal_Int32 hashBookmark(const ::com::sun::star::uno::Any& bookmark) const throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ) { return m_xBookmarkOperations->hashBookmark(bookmark); }
+
+ // ::com::sun::star::sdbc::XResultSet
+ sal_Bool isBeforeFirst() const { return m_xMoveOperations->isBeforeFirst(); }
+ sal_Bool isAfterLast() const { return m_xMoveOperations->isAfterLast(); }
+ sal_Bool isFirst() const { return m_xMoveOperations->isFirst(); }
+ sal_Bool isLast() const { return m_xMoveOperations->isLast(); }
+ void beforeFirst() { m_xMoveOperations->beforeFirst(); }
+ sal_Bool first() { return m_xMoveOperations->first(); }
+ sal_Bool last() { return m_xMoveOperations->last(); }
+ sal_Int32 getRow() const { return m_xMoveOperations->getRow(); }
+ sal_Bool absolute(sal_Int32 nPosition) { return m_xMoveOperations->absolute(nPosition); }
+ sal_Bool relative(sal_Int32 nCount) { return m_xMoveOperations->relative(nCount); }
+ sal_Bool previous() { return m_xMoveOperations->previous(); }
+ sal_Bool next() { return m_xMoveOperations->next(); }
+ void refreshRow() { m_xMoveOperations->refreshRow(); }
+ sal_Bool rowUpdated() { return m_xMoveOperations->rowUpdated(); }
+ sal_Bool rowInserted() { return m_xMoveOperations->rowInserted(); }
+ sal_Bool rowDeleted() { return m_xMoveOperations->rowDeleted(); }
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> getStatement() { return m_xMoveOperations->getStatement(); }
+ // ::com::sun::star::sdbcx::XColumnsSupplier
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> getColumns() const throw( ::com::sun::star::uno::RuntimeException ) { return m_xColumnsSupplier->getColumns(); }
+private:
+ void ImplConstruct(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _rxCursor, sal_Bool bUseCloned);
+};
+
+
+class FmXDisposeMultiplexer;
+class FmXDisposeListener
+{
+ friend class FmXDisposeMultiplexer;
+
+ FmXDisposeMultiplexer* m_pAdapter;
+ ::osl::Mutex& m_rMutex;
+
+public:
+ FmXDisposeListener(::osl::Mutex& _rMutex) : m_pAdapter(NULL), m_rMutex(_rMutex) { }
+ virtual ~FmXDisposeListener();
+
+ virtual void disposing(const ::com::sun::star::lang::EventObject& _rEvent, sal_Int16 _nId) throw( ::com::sun::star::uno::RuntimeException ) = 0;
+
+protected:
+ void setAdapter(FmXDisposeMultiplexer* pAdapter);
+};
+
+//==============================================================================
+
+class FmXDisposeMultiplexer :public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener>
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent> m_xObject;
+ FmXDisposeListener* m_pListener;
+ sal_Int16 m_nId;
+
+ virtual ~FmXDisposeMultiplexer();
+public:
+ FmXDisposeMultiplexer(FmXDisposeListener* _pListener, const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>& _rxObject, sal_Int16 _nId = -1);
+
+// ::com::sun::star::lang::XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+
+ void dispose();
+};
+
+// ==================================================================
+
+sal_Int16 getControlTypeByObject(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo>& _rxObject);
+ // get the object type (OBJ_FM_...) from the services the object supports
+
+//==================================================================
+sal_Bool isRowSetAlive(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rxRowSet);
+ // checks if the ::com::sun::star::sdbcx::XColumnsSupplier provided by _rxRowSet supllies any columns
+
+//==================================================================
+typedef ::std::set < ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ , ::comphelper::OInterfaceCompare< ::com::sun::star::uno::XInterface >
+ > InterfaceBag;
+
+#endif // _SVX_FMTOOLS_HXX
+
diff --git a/svx/inc/svx/fmview.hxx b/svx/inc/svx/fmview.hxx
new file mode 100644
index 000000000000..52fa30650184
--- /dev/null
+++ b/svx/inc/svx/fmview.hxx
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_FMVIEW_HXX
+#define _SVX_FMVIEW_HXX
+
+#include <svx/view3d.hxx>
+#include <comphelper/uno3.hxx>
+#include "svx/svxdllapi.h"
+
+FORWARD_DECLARE_INTERFACE(util,XNumberFormats)
+FORWARD_DECLARE_INTERFACE(beans,XPropertySet)
+
+class OutputDevice;
+class FmFormModel;
+class FmPageViewWinRec;
+class FmFormObj;
+class FmFormPage;
+class FmFormShell;
+class FmXFormView;
+
+namespace svx {
+ class ODataAccessDescriptor;
+ struct OXFormsDescriptor;
+}
+
+class SdrUnoObj;
+namespace com { namespace sun { namespace star { namespace form {
+ class XForm;
+ namespace runtime {
+ class XFormController;
+ }
+} } } }
+
+class SVX_DLLPUBLIC FmFormView : public E3dView
+{
+ FmXFormView* pImpl;
+ FmFormShell* pFormShell;
+
+ void Init();
+
+public:
+ TYPEINFO();
+
+ FmFormView(FmFormModel* pModel, OutputDevice* pOut = 0L);
+ virtual ~FmFormView();
+
+ /** create a control pair (label/bound control) for the database field description given.
+ @param rFieldDesc
+ description of the field. see clipboard format SBA-FIELDFORMAT
+ @deprecated
+ This method is deprecated. Use the version with a ODataAccessDescriptor instead.
+ */
+ SdrObject* CreateFieldControl(const UniString& rFieldDesc) const;
+
+ /** create a control pair (label/bound control) for the database field description given.
+ */
+ SdrObject* CreateFieldControl( const ::svx::ODataAccessDescriptor& _rColumnDescriptor );
+
+ /** create a control pair (label/bound control) for the xforms description given.
+ */
+ SdrObject* CreateXFormsControl( const ::svx::OXFormsDescriptor &_rDesc );
+
+ virtual void MarkListHasChanged();
+ virtual void AddWindowToPaintView(OutputDevice* pNewWin);
+ virtual void DeleteWindowFromPaintView(OutputDevice* pOldWin);
+
+ static void createControlLabelPair(
+ OutputDevice* _pOutDev,
+ sal_Int32 _nXOffsetMM,
+ sal_Int32 _nYOffsetMM,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats >& _rxNumberFormats,
+ sal_uInt16 _nControlObjectID,
+ const ::rtl::OUString& _rFieldPostfix,
+ sal_uInt32 _nInventor,
+ sal_uInt16 _nLabelObjectID,
+ SdrPage* _pLabelPage,
+ SdrPage* _pControlPage,
+ SdrModel* _pModel,
+ SdrUnoObj*& _rpLabel,
+ SdrUnoObj*& _rpControl
+ );
+
+ virtual SdrPageView* ShowSdrPage(SdrPage* pPage);
+ virtual void HideSdrPage();
+
+ // for copying complete form structures, not only control models
+ virtual SdrModel* GetMarkedObjModel() const;
+ using E3dView::Paste;
+ virtual sal_Bool Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
+
+ virtual sal_Bool MouseButtonDown( const MouseEvent& _rMEvt, Window* _pWin );
+
+ /** grab the focus to the first form control on the view
+ @param _bForceSync
+ <TRUE/> if the handling should be done synchronously.
+ */
+ SVX_DLLPRIVATE void GrabFirstControlFocus( sal_Bool _bForceSync = sal_False );
+
+ /** returns the form controller for a given form and a given device
+ */
+ SVX_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >
+ GetFormController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm, const OutputDevice& _rDevice ) const;
+
+ // SdrView
+ sal_Bool KeyInput(const KeyEvent& rKEvt, Window* pWin);
+
+ /// shortcut to "GetSdrPageView() ? PTR_CAST( FmFormPage, GetSdrPageView() ) : NULL"
+ FmFormPage* GetCurPage();
+
+ SVX_DLLPRIVATE void ActivateControls(SdrPageView*);
+ SVX_DLLPRIVATE void DeactivateControls(SdrPageView*);
+
+ SVX_DLLPRIVATE void ChangeDesignMode(sal_Bool bDesign);
+
+ SVX_DLLPRIVATE FmXFormView* GetImpl() const { return pImpl; }
+ SVX_DLLPRIVATE FmFormShell* GetFormShell() const { return pFormShell; }
+
+ struct FormShellAccess { friend class FmFormShell; private: FormShellAccess() { } };
+ void SetFormShell( FmFormShell* pShell, FormShellAccess ) { pFormShell = pShell; }
+
+ struct ImplAccess { friend class FmXFormView; private: ImplAccess() { } };
+ void SetMoveOutside( bool _bMoveOutside, ImplAccess ) { E3dView::SetMoveOutside( _bMoveOutside ); }
+ virtual void InsertControlContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& xCC);
+ virtual void RemoveControlContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& xCC);
+
+ virtual SdrPaintWindow* BeginCompleteRedraw(OutputDevice* pOut);
+ virtual void EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer);
+
+ SVX_DLLPRIVATE const OutputDevice* GetActualOutDev() const {return pActualOutDev;}
+ SVX_DLLPRIVATE sal_Bool checkUnMarkAll(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xSource);
+
+private:
+ SVX_DLLPRIVATE void AdjustMarks(const SdrMarkList& rMarkList);
+ SVX_DLLPRIVATE FmFormObj* getMarkedGrid() const;
+ protected:
+ using E3dView::SetMoveOutside;
+};
+
+#endif // _FML_FMVIEW_HXX
+
diff --git a/svx/inc/svx/fntctl.hxx b/svx/inc/svx/fntctl.hxx
new file mode 100644
index 000000000000..57bcdc0c6705
--- /dev/null
+++ b/svx/inc/svx/fntctl.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FNTCTL_HXX
+#define _SVX_FNTCTL_HXX
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/mnuitem.hxx>
+#include <svl/lstner.hxx>
+#include "svx/svxdllapi.h"
+
+
+
+class FontNameMenu;
+class SfxBindings;
+
+// class SvxFontMenuControl ----------------------------------------------
+
+class SVX_DLLPUBLIC SvxFontMenuControl : public SfxMenuControl, public SfxListener
+{
+private:
+ FontNameMenu* pMenu;
+ Menu& rParent;
+
+//#if 0 // _SOLAR__PRIVATE
+ SVX_DLLPRIVATE void FillMenu();
+ DECL_LINK( MenuSelect, FontNameMenu * );
+ SVX_DLLPRIVATE virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ SVX_DLLPRIVATE virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+//#endif
+
+public:
+ SvxFontMenuControl( sal_uInt16 nId, Menu&, SfxBindings& );
+ ~SvxFontMenuControl();
+
+ virtual PopupMenu* GetPopup() const;
+
+ SFX_DECL_MENU_CONTROL();
+};
+
+
+
+#endif
+
diff --git a/svx/inc/svx/fntctrl.hxx b/svx/inc/svx/fntctrl.hxx
new file mode 100644
index 000000000000..4be1173db44c
--- /dev/null
+++ b/svx/inc/svx/fntctrl.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FNTCTRL_HXX
+#define _SVX_FNTCTRL_HXX
+
+// include ---------------------------------------------------------------
+
+#include <vcl/window.hxx>
+#include <editeng/svxfont.hxx>
+#include "svx/svxdllapi.h"
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+// forward ---------------------------------------------------------------
+
+class FontPrevWin_Impl;
+
+// class SvxFontPrevWindow -----------------------------------------------
+
+class SVX_DLLPUBLIC SvxFontPrevWindow : public Window
+{
+ using OutputDevice::SetFont;
+private:
+ FontPrevWin_Impl* pImpl;
+
+ SVX_DLLPRIVATE void InitSettings( sal_Bool bForeground, sal_Bool bBackground );
+
+public:
+ SvxFontPrevWindow( Window* pParent, const ResId& rId );
+ virtual ~SvxFontPrevWindow();
+
+ virtual void StateChanged( StateChangedType nStateChange );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ // Aus Effizienz-gr"unden nicht const
+ SvxFont& GetFont();
+ const SvxFont& GetFont() const;
+ void SetFont( const SvxFont& rFont );
+ void SetFont( const SvxFont& rNormalFont, const SvxFont& rCJKFont, const SvxFont& rCTLFont );
+ void SetCJKFont( const SvxFont& rFont );
+ void SetCTLFont( const SvxFont& rFont );
+ SvxFont& GetCJKFont();
+ SvxFont& GetCTLFont();
+ void SetColor( const Color& rColor );
+ void ResetColor();
+ void SetBackColor( const Color& rColor );
+ void UseResourceText( sal_Bool bUse = sal_True );
+ void Paint( const Rectangle& );
+
+ sal_Bool IsTwoLines() const;
+ void SetTwoLines(sal_Bool bSet);
+
+ void SetBrackets(sal_Unicode cStart, sal_Unicode cEnd);
+
+ void SetFontWidthScale( sal_uInt16 nScaleInPercent );
+
+ void AutoCorrectFontColor( void );
+
+ void SetPreviewText( const ::rtl::OUString& rString );
+ void SetFontNameAsPreviewText();
+};
+
+#endif // #ifndef _SVX_FNTCTRL_HXX
+
diff --git a/svx/inc/svx/fntszctl.hxx b/svx/inc/svx/fntszctl.hxx
new file mode 100644
index 000000000000..9ae8da4a27d7
--- /dev/null
+++ b/svx/inc/svx/fntszctl.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FNTSZCTL_HXX
+#define _SVX_FNTSZCTL_HXX
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/mnuitem.hxx>
+#include "svx/svxdllapi.h"
+
+
+
+class SfxBindings;
+class FontSizeMenu;
+
+// class SvxFontSizeMenuControl ------------------------------------------
+
+class SVX_DLLPUBLIC SvxFontSizeMenuControl : public SfxMenuControl
+{
+private:
+ FontSizeMenu* pMenu;
+ Menu& rParent;
+ SfxStatusForwarder aFontNameForwarder;
+
+//#if 0 // _SOLAR__PRIVATE
+ DECL_LINK( MenuSelect, FontSizeMenu * );
+//#endif
+
+protected:
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+
+public:
+ SvxFontSizeMenuControl( sal_uInt16 nId, Menu&, SfxBindings& );
+ ~SvxFontSizeMenuControl();
+
+ virtual PopupMenu* GetPopup() const;
+
+ SFX_DECL_MENU_CONTROL();
+};
+
+
+
+#endif
+
diff --git a/svx/inc/svx/fontlb.hxx b/svx/inc/svx/fontlb.hxx
new file mode 100644
index 000000000000..8051eded95b6
--- /dev/null
+++ b/svx/inc/svx/fontlb.hxx
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_FONTLB_HXX
+#define SVX_FONTLB_HXX
+
+#ifndef _SVTABBOX_HXX
+#include <svtools/svtabbx.hxx>
+#endif
+#include <vcl/virdev.hxx>
+#include "svx/svxdllapi.h"
+#include <layout/layout.hxx>
+
+// ============================================================================
+
+/** A list box string item which stores its text and font. */
+class SvLBoxFontString : public SvLBoxString
+{
+private:
+ Font maFont; /// The font used by this item.
+ bool mbUseColor; /// true = use font color, false = default listbox color.
+
+public:
+ SvLBoxFontString();
+ SvLBoxFontString(
+ SvLBoxEntry* pEntry,
+ sal_uInt16 nFlags,
+ const XubString& rString,
+ const Font& rFont,
+ const Color* pColor = NULL );
+
+ virtual ~SvLBoxFontString();
+
+ /** Creates a new empty list box item. */
+ virtual SvLBoxItem* Create() const;
+
+ void InitViewData( SvLBox*,SvLBoxEntry*,SvViewDataItem* );
+
+ /** Paints this entry to the specified position, using the own font settings. */
+ void Paint(
+ const Point& rPos,
+ SvLBox& rDev,
+ sal_uInt16 nFlags,
+ SvLBoxEntry* pEntry );
+};
+
+
+// ============================================================================
+
+/** A list box supporting formatted string entries. */
+class SVX_DLLPUBLIC SvxFontListBox : public SvTabListBox
+{
+private:
+ Font maStdFont; /// Used for entries without specific font.
+
+ // The following members are used to store additional parameters for InitEntry().
+ Font maEntryFont; /// Current entry font used in InitEntry().
+ const Color* mpEntryColor; /// Current entry color used in InitEntry().
+ bool mbUseFont; /// true = Use maEntryFont/mpEntryColor in InitEntry().
+
+public:
+ SvxFontListBox( Window* pParent, const ResId& rResId );
+
+ /** Inserts a list entry and sets the font used for this entry.
+ @param pColor The font color. NULL = use default listbox text color. */
+ void InsertFontEntry(
+ const String& rString, const Font& rFont, const Color* pColor = NULL );
+
+ /** Selects/deselects an entry specified by its position in the list box. */
+ void SelectEntryPos( sal_uInt16 nPos, bool bSelect = true );
+ /** Removes a selection. */
+ void SetNoSelection();
+
+ /** Returns the position of the entry currently selected or LIST_APPEND. */
+ sal_uLong GetSelectEntryPos() const;
+ /** Returns the text of the selected entry or an empty string. */
+ XubString GetSelectEntry() const;
+
+protected:
+ /** Initializes a new SvLBoxFontString entry.
+ @descr Uses current value of maEntryFont to set the entry font (if mbUseFont is true). */
+ virtual void InitEntry(
+ SvLBoxEntry* pEntry,
+ const XubString& rEntryText,
+ const Image& rCollImg,
+ const Image& rExpImg,
+ SvLBoxButtonKind eButtonKind );
+};
+
+#if ENABLE_LAYOUT
+
+namespace layout
+{
+class SvxFontListBoxImpl;
+class SVX_DLLPUBLIC SvxFontListBox : public ListBox
+{
+ /*DECL_GET_IMPL( SvxFontListBox );
+ DECL_CONSTRUCTORS( SvxFontListBox, ListBox, WB_BORDER );
+ DECL_GET_WINDOW (SvxFontListBox);*/
+
+public:
+ SvxFontListBox( Context*, const char* );
+ ~SvxFontListBox ();
+ sal_uInt16 InsertFontEntry (String const& entry, Font const& font, Color const* color=0);
+};
+};
+
+#endif
+
+
+// ============================================================================
+
+#endif
+
diff --git a/svx/inc/svx/fontwork.hxx b/svx/inc/svx/fontwork.hxx
new file mode 100644
index 000000000000..2e696fdaaee6
--- /dev/null
+++ b/svx/inc/svx/fontwork.hxx
@@ -0,0 +1,197 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FONTWORK_HXX
+#define _SVX_FONTWORK_HXX
+
+// include ---------------------------------------------------------------
+
+#ifndef _TOOLBOX_HXX //autogen
+#include <vcl/toolbox.hxx>
+#endif
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#include <svtools/valueset.hxx>
+#include <sfx2/dockwin.hxx>
+#include <sfx2/ctrlitem.hxx>
+#include <svx/xenum.hxx>
+#include <svx/dlgctrl.hxx>
+#include "svx/svxdllapi.h"
+
+// forward ---------------------------------------------------------------
+
+class SdrView;
+class SdrPageView;
+class SdrObject;
+
+class XFormTextAdjustItem;
+class XFormTextDistanceItem;
+class XFormTextStartItem;
+class XFormTextMirrorItem;
+class XFormTextStdFormItem;
+class XFormTextHideFormItem;
+class XFormTextOutlineItem;
+class XFormTextShadowItem;
+class XFormTextShadowColorItem;
+class XFormTextShadowXValItem;
+class XFormTextShadowYValItem;
+
+/*************************************************************************
+|*
+|* ControllerItem fuer Fontwork
+|*
+\************************************************************************/
+
+class SvxFontWorkDialog;
+
+class SvxFontWorkControllerItem : public SfxControllerItem
+{
+ SvxFontWorkDialog &rFontWorkDlg;
+
+protected:
+ virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState);
+
+public:
+ SvxFontWorkControllerItem(sal_uInt16 nId, SvxFontWorkDialog&, SfxBindings&);
+};
+
+/*************************************************************************
+|*
+|* Ableitung vom SfxChildWindow als "Behaelter" fuer Fontwork-Dialog
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC SvxFontWorkChildWindow : public SfxChildWindow
+{
+ public:
+ SvxFontWorkChildWindow(Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo*);
+ SFX_DECL_CHILDWINDOW(SvxFontWorkChildWindow);
+};
+
+/*************************************************************************
+|*
+|* Floating Window zur Attributierung von Texteffekten
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC SvxFontWorkDialog : public SfxDockingWindow
+{
+ #define CONTROLLER_COUNT 12
+
+ SvxFontWorkControllerItem* pCtrlItems[CONTROLLER_COUNT];
+
+ ValueSet aFormSet;
+
+ ToolBox aTbxStyle;
+ ToolBox aTbxAdjust;
+
+ FixedImage aFbDistance;
+ MetricField aMtrFldDistance;
+ FixedImage aFbTextStart;
+ MetricField aMtrFldTextStart;
+
+ ToolBox aTbxShadow;
+
+ FixedImage aFbShadowX;
+ MetricField aMtrFldShadowX;
+ FixedImage aFbShadowY;
+ MetricField aMtrFldShadowY;
+
+ ColorLB aShadowColorLB;
+
+ SfxBindings& rBindings;
+ Timer aInputTimer;
+ sal_Bool bUserZoomedIn;
+
+ sal_uInt16 nLastStyleTbxId;
+ sal_uInt16 nLastAdjustTbxId;
+ sal_uInt16 nLastShadowTbxId;
+ long nSaveShadowX;
+ long nSaveShadowY;
+ long nSaveShadowAngle;
+ long nSaveShadowSize;
+
+ ImageList maImageList;
+ ImageList maImageListH;
+
+ const XColorTable* pColorTable;
+
+#ifdef _SVX_FONTWORK_CXX
+ friend class SvxFontWorkChildWindow;
+ friend class SvxFontWorkControllerItem;
+
+ DECL_LINK( SelectStyleHdl_Impl, void * );
+ DECL_LINK( SelectAdjustHdl_Impl, void * );
+ DECL_LINK( SelectShadowHdl_Impl, void * );
+
+ DECL_LINK( ModifyInputHdl_Impl, void * );
+ DECL_LINK( InputTimoutHdl_Impl, void * );
+
+ DECL_LINK( FormSelectHdl_Impl, void * );
+ DECL_LINK( ColorSelectHdl_Impl, void * );
+
+ void SetStyle_Impl(const XFormTextStyleItem*);
+ void SetAdjust_Impl(const XFormTextAdjustItem*);
+ void SetDistance_Impl(const XFormTextDistanceItem*);
+ void SetStart_Impl(const XFormTextStartItem*);
+ void SetMirror_Impl(const XFormTextMirrorItem*);
+ void SetStdForm_Impl(const XFormTextStdFormItem*);
+ void SetShowForm_Impl(const XFormTextHideFormItem*);
+ void SetOutline_Impl(const XFormTextOutlineItem*);
+ void SetShadow_Impl(const XFormTextShadowItem*,
+ sal_Bool bRestoreValues = sal_False);
+ void SetShadowColor_Impl(const XFormTextShadowColorItem*);
+ void SetShadowXVal_Impl(const XFormTextShadowXValItem*);
+ void SetShadowYVal_Impl(const XFormTextShadowYValItem*);
+#endif
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ void ApplyImageList();
+
+ protected:
+ virtual void Zoom();
+ virtual SfxChildAlignment CheckAlignment( SfxChildAlignment eActAlign,
+ SfxChildAlignment eAlign );
+
+ public:
+ SvxFontWorkDialog( SfxBindings *pBindinx,
+ SfxChildWindow *pCW,
+ Window* pParent,
+ const ResId& rResId );
+ ~SvxFontWorkDialog();
+
+ void SetColorTable(const XColorTable* pTable);
+ void SetActive(sal_Bool bActivate = sal_True);
+
+ void CreateStdFormObj(SdrView& rView, SdrPageView& rPV,
+ const SfxItemSet& rAttr, SdrObject& rOldObj,
+ XFormTextStdForm eForm);
+};
+
+#endif // _SVX_FONTWORK_HXX
+
diff --git a/svx/inc/svx/fontworkbar.hxx b/svx/inc/svx/fontworkbar.hxx
new file mode 100644
index 000000000000..95d5135075bb
--- /dev/null
+++ b/svx/inc/svx/fontworkbar.hxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_FONTWORK_BAR_HXX
+#define _SVX_FONTWORK_BAR_HXX
+
+#include <sfx2/shell.hxx>
+#include <sfx2/module.hxx>
+#include <svx/ifaceids.hxx>
+#include "svx/svxdllapi.h"
+
+class SfxViewShell;
+class SdrView;
+
+/************************************************************************/
+
+namespace svx
+{
+
+bool SVX_DLLPUBLIC checkForSelectedFontWork( SdrView* pSdrView, sal_uInt32& nCheckStatus );
+
+class SVX_DLLPUBLIC FontworkBar : public SfxShell
+{
+public:
+ TYPEINFO();
+ SFX_DECL_INTERFACE(SVX_INTERFACE_FONTWORK_BAR)
+
+ FontworkBar(SfxViewShell* pViewShell );
+ ~FontworkBar();
+
+ static void execute( SdrView* pSdrView, SfxRequest& rReq, SfxBindings& rBindings );
+ static void getState( SdrView* pSdrView, SfxItemSet& rSet );
+};
+
+}
+
+#endif // _SVX_FONTWORK_BAR_HXX
diff --git a/svx/inc/svx/fontworkgallery.hxx b/svx/inc/svx/fontworkgallery.hxx
new file mode 100644
index 000000000000..36502ccecca5
--- /dev/null
+++ b/svx/inc/svx/fontworkgallery.hxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _SVX_FONTWORK_GALLERY_DIALOG_HXX
+#define _SVX_FONTWORK_GALLERY_DIALOG_HXX
+
+#include "svx/svxdllapi.h"
+
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/field.hxx>
+
+#include <svtools/valueset.hxx>
+
+#include <sfx2/tbxctrl.hxx>
+
+#include <vector>
+
+class FmFormModel;
+class SdrView;
+class Window;
+class SdrTextObj;
+class SdrObject;
+class SdrModel;
+
+class SfxBindings;
+class SfxStatusForwarder;
+
+//------------------------------------------------------------------------
+
+namespace svx
+{
+
+class SVX_DLLPUBLIC FontWorkShapeTypeControl : public SfxToolBoxControl
+{
+ using SfxToolBoxControl::Select;
+
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ FontWorkShapeTypeControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~FontWorkShapeTypeControl();
+
+ virtual void Select( sal_Bool bMod1 = sal_False );
+ virtual SfxPopupWindowType GetPopupWindowType() const;
+ virtual SfxPopupWindow* CreatePopupWindow();
+};
+
+//------------------------------------------------------------------------
+
+class FontworkCharacterSpacingDialog : public ModalDialog
+{
+ FixedText maFLScale;
+ MetricField maMtrScale;
+ OKButton maOKButton;
+ CancelButton maCancelButton;
+ HelpButton maHelpButton;
+
+public:
+ FontworkCharacterSpacingDialog( Window* pParent, sal_Int32 nScale );
+ ~FontworkCharacterSpacingDialog();
+
+ sal_Int32 getScale() const;
+};
+
+
+class SVX_DLLPUBLIC FontWorkGalleryDialog : public ModalDialog
+{
+ ValueSet maCtlFavorites;
+ FixedLine maFLFavorites;
+ OKButton maOKButton;
+ CancelButton maCancelButton;
+ HelpButton maHelpButton;
+
+ sal_uInt16 mnThemeId;
+
+ SdrView* mpSdrView;
+ FmFormModel* mpModel;
+
+ String maStrClickToAddText;
+
+ DECL_LINK( DoubleClickFavoriteHdl, void * );
+ DECL_LINK( ClickOKHdl, void * );
+ DECL_LINK( ClickTextDirectionHdl, ImageButton * );
+
+ SdrObject** mppSdrObject;
+ SdrModel* mpDestModel;
+
+ void initfavorites(sal_uInt16 nThemeId, std::vector< Bitmap * >& rFavorites);
+ void insertSelectedFontwork();
+ void changeText( SdrTextObj* pObj );
+ void fillFavorites( sal_uInt16 nThemeId, std::vector< Bitmap * >& rFavorites );
+
+ std::vector< Bitmap * > maFavoritesHorizontal;
+
+public:
+ FontWorkGalleryDialog( SdrView* pView, Window* pParent, sal_uInt16 nSID );
+ ~FontWorkGalleryDialog();
+
+ // SJ: if the SdrObject** is set, the SdrObject is not inserted into the page when executing the dialog
+ void SetSdrObjectRef( SdrObject**, SdrModel* pModel );
+};
+
+}
+
+#endif
diff --git a/svx/inc/svx/formatpaintbrushctrl.hxx b/svx/inc/svx/formatpaintbrushctrl.hxx
new file mode 100644
index 000000000000..9f06a58c8b1d
--- /dev/null
+++ b/svx/inc/svx/formatpaintbrushctrl.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_FORMATPAINTBRUSHCTRL_HXX
+#define _SVX_FORMATPAINTBRUSHCTRL_HXX
+
+// header for class SfxToolBoxControl
+#include <sfx2/tbxctrl.hxx>
+// header for class Timer
+#include <vcl/timer.hxx>
+#include "svx/svxdllapi.h"
+
+//.............................................................................
+namespace svx
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class SVX_DLLPUBLIC FormatPaintBrushToolBoxControl : public SfxToolBoxControl
+{
+ using SfxToolBoxControl::Select;
+
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ FormatPaintBrushToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~FormatPaintBrushToolBoxControl();
+
+ virtual void DoubleClick();
+ virtual void Click();
+ virtual void Select( sal_Bool bMod1 = sal_False );
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+private:
+ DECL_LINK( WaitDoubleClickHdl, void* );
+ void impl_executePaintBrush();
+
+private:
+ bool m_bPersistentCopy;//indicates that the content of the format clipboard should not be erased after paste
+ Timer m_aDoubleClickTimer;
+};
+
+//.............................................................................
+} //namespace svx
+//.............................................................................
+#endif
diff --git a/svx/inc/svx/framebordertype.hxx b/svx/inc/svx/framebordertype.hxx
new file mode 100644
index 000000000000..f720c215fffc
--- /dev/null
+++ b/svx/inc/svx/framebordertype.hxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_FRAMEBORDERTYPE_HXX
+#define SVX_FRAMEBORDERTYPE_HXX
+
+#include "svx/svxdllapi.h"
+
+namespace svx {
+
+// ============================================================================
+
+/** Enumerates all borders a frame selection control can contain. */
+enum FrameBorderType
+{
+ FRAMEBORDER_NONE, /// No border (special state).
+ FRAMEBORDER_LEFT, /// Left frame border.
+ FRAMEBORDER_RIGHT, /// Right frame border.
+ FRAMEBORDER_TOP, /// Top frame border.
+ FRAMEBORDER_BOTTOM, /// Bottom frame border.
+ FRAMEBORDER_HOR, /// Inner horizontal frame border.
+ FRAMEBORDER_VER, /// Inner vertical frame border.
+ FRAMEBORDER_TLBR, /// Top-left to bottom-right frame border.
+ FRAMEBORDER_BLTR /// Bottom-left to top-right frame border.
+};
+
+/** The number of valid frame border types (excluding FRAMEBORDER_NONE). */
+const int FRAMEBORDERTYPE_COUNT = 8;
+
+/** Returns the frame border type from a 0-based integer index. */
+SVX_DLLPUBLIC FrameBorderType GetFrameBorderTypeFromIndex( size_t nIndex );
+
+/** Returns the zero-based index of a valid frame border type. */
+size_t GetIndexFromFrameBorderType( FrameBorderType eBorder );
+
+// ============================================================================
+
+} // namespace svx
+
+#endif
+
diff --git a/svx/inc/svx/framelink.hxx b/svx/inc/svx/framelink.hxx
new file mode 100644
index 000000000000..9d5e2cd3b1c6
--- /dev/null
+++ b/svx/inc/svx/framelink.hxx
@@ -0,0 +1,727 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_FRAMELINK_HXX
+#define SVX_FRAMELINK_HXX
+
+#include <algorithm>
+#include <sal/types.h>
+#include <tools/gen.hxx>
+#include <tools/color.hxx>
+#include "svx/svxdllapi.h"
+
+class OutputDevice;
+class SvxBorderLine;
+
+namespace svx {
+namespace frame {
+
+// ============================================================================
+// Enums
+// ============================================================================
+
+/** Specifies how the reference points for frame borders are used.
+ */
+enum RefMode
+{
+ /** Frame borders are drawn centered to the reference points. */
+ REFMODE_CENTERED,
+
+ /** The reference points specify the begin of the frame border width.
+
+ The result is that horizontal lines are drawn below, and vertical lines
+ are drawn right of the reference points.
+ */
+ REFMODE_BEGIN,
+
+ /** The reference points specify the end of the frame border width.
+
+ The result is that horizontal lines are drawn above, and vertical lines
+ are drawn left of the reference points.
+ */
+ REFMODE_END
+};
+
+// ============================================================================
+// Classes
+// ============================================================================
+
+/** Contains the widths of primary and secondary line of a frame style.
+
+ In the following, "frame style" is a complete style of one frame border,
+ i.e. the double line at the left side of the frame. A "line" is always a
+ trivial single line, i.e. the first line of a double frame style.
+
+ The following states of the members of this struct are valid:
+
+ mnPrim mnDist mnSecn frame style
+ -------------------------------------------------
+ 0 0 0 invisible
+ >0 0 0 single
+ >0 >0 >0 double
+
+ The behaviour of the member functions for other states is not defined.
+
+ Per definition the primary line in double frame styles is:
+ - The top line for horizontal frame borders.
+ - The left line for vertical frame borders.
+ - The bottom-left line for top-left to bottom-right diagonal frame borders.
+ - The top-left line for bottom-left to top-right diagonal frame borders.
+
+ The following picture shows the upper end of a vertical double frame
+ border.
+
+ |<---------------- GetWidth() ----------------->|
+ | |
+ |<----- mnPrim ----->||<- mnDist ->||<- mnSecn >|
+ | || || |
+ ###################### #############
+ ###################### #############
+ ###################### #############
+ ###################### #############
+ ###################### | #############
+ ###################### | #############
+ |
+ |<- middle of the frame border
+ */
+class SVX_DLLPUBLIC Style
+{
+public:
+ /** Constructs an invisible frame style. */
+ inline explicit Style() : meRefMode( REFMODE_CENTERED ), mnPrim( 0 ), mnDist( 0 ), mnSecn( 0 ), mbDotted( false ) {}
+ /** Constructs a frame style with passed line widths. */
+ inline explicit Style( sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS ) :
+ meRefMode( REFMODE_CENTERED ), mbDotted( false )
+ { Set( nP, nD, nS ); }
+ /** Constructs a frame style with passed color and line widths. */
+ inline explicit Style( const Color& rColor, sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS ) :
+ meRefMode( REFMODE_CENTERED ), mbDotted( false )
+ { Set( rColor, nP, nD, nS ); }
+ /** Constructs a frame style from the passed SvxBorderLine struct. */
+ inline explicit Style( const SvxBorderLine& rBorder, double fScale = 1.0, sal_uInt16 nMaxWidth = SAL_MAX_UINT16, bool /*bUseDots*/ = false ) :
+ meRefMode( REFMODE_CENTERED ) { Set( rBorder, fScale, nMaxWidth ); }
+ /** Constructs a frame style from the passed SvxBorderLine struct. Clears the style, if pBorder is 0. */
+ inline explicit Style( const SvxBorderLine* pBorder, double fScale = 1.0, sal_uInt16 nMaxWidth = SAL_MAX_UINT16, bool /*bUseDots*/ = false ) :
+ meRefMode( REFMODE_CENTERED ) { Set( pBorder, fScale, nMaxWidth ); }
+
+ inline RefMode GetRefMode() const { return meRefMode; }
+ inline const Color& GetColor() const { return maColor; }
+ inline sal_uInt16 Prim() const { return mnPrim; }
+ inline sal_uInt16 Dist() const { return mnDist; }
+ inline sal_uInt16 Secn() const { return mnSecn; }
+ inline bool Dotted() const { return mbDotted; }
+
+ /** Returns the total width of this frame style. */
+ inline sal_uInt16 GetWidth() const { return mnPrim + mnDist + mnSecn; }
+
+
+ /** Sets the frame style to invisible state. */
+ void Clear();
+ /** Sets the frame style to the passed line widths. */
+ void Set( sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS );
+ /** Sets the frame style to the passed line widths. */
+ void Set( const Color& rColor, sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS );
+ /** Sets the frame style to the passed SvxBorderLine struct. */
+ void Set( const SvxBorderLine& rBorder, double fScale = 1.0, sal_uInt16 nMaxWidth = SAL_MAX_UINT16, bool /*bUseDots*/ = false );
+ /** Sets the frame style to the passed SvxBorderLine struct. Clears the style, if pBorder is 0. */
+ void Set( const SvxBorderLine* pBorder, double fScale = 1.0, sal_uInt16 nMaxWidth = SAL_MAX_UINT16, bool /*bUseDots*/ = false );
+
+ /** Sets a new reference point handling mode, does not modify other settings. */
+ inline void SetRefMode( RefMode eRefMode ) { meRefMode = eRefMode; }
+ /** Sets a new color, does not modify other settings. */
+ inline void SetColor( const Color& rColor ) { maColor = rColor; }
+ /** Sets whether to use dotted style for single hair lines. */
+ inline void SetDotted( bool bDotted ) { mbDotted = bDotted; }
+
+ /** Scales the style by the specified scaling factor. Ensures that visible lines keep visible. */
+ Style& ScaleSelf( double fScale, sal_uInt16 nMaxWidth = SAL_MAX_UINT16 );
+ /** Returns this style scaled by the specified scaling factor. Ensures that visible lines keep visible. */
+ Style Scale( double fScale, sal_uInt16 nMaxWidth = SAL_MAX_UINT16 ) const;
+
+ /** Mirrors this style (exchanges primary and secondary), if it is a double frame style. */
+ Style& MirrorSelf();
+ /** Returns this style mirrored, if it is a double frame style, otherwise a simple copy. */
+ Style Mirror() const;
+
+private:
+ Color maColor; /// The color of the line(s) of this frame border.
+ RefMode meRefMode; /// Reference point handling for this frame border.
+ sal_uInt16 mnPrim; /// Width of primary (single, left, or top) line.
+ sal_uInt16 mnDist; /// Distance between primary and secondary line.
+ sal_uInt16 mnSecn; /// Width of secondary (right or bottom) line.
+ bool mbDotted; /// true = Draw dotted lines; false = Draw solid lines.
+};
+
+bool operator==( const Style& rL, const Style& rR );
+SVX_DLLPUBLIC bool operator<( const Style& rL, const Style& rR );
+
+inline bool operator!=( const Style& rL, const Style& rR ) { return !(rL == rR); }
+inline bool operator>( const Style& rL, const Style& rR ) { return rR < rL; }
+inline bool operator<=( const Style& rL, const Style& rR ) { return !(rR < rL); }
+inline bool operator>=( const Style& rL, const Style& rR ) { return !(rL < rR); }
+
+// ----------------------------------------------------------------------------
+
+/** Extends the Style struct with an angle for diagonal frame borders.
+
+ The angle is specified in radian (a full circle is equivalent to 2*PI).
+ It is dependent on the context, how the value is interpreted, i.e. it may
+ specify the angle to a horizontal or vertical frame border.
+ */
+class DiagStyle : public Style
+{
+public:
+ /** Constructs an invisible diagonal frame style. */
+ inline explicit DiagStyle() : mfAngle( 0.0 ) {}
+ /** Constructs a diagonal frame style passed style and angle. */
+ inline explicit DiagStyle( const Style& rStyle, double fAngle ) :
+ Style( rStyle ), mfAngle( fAngle ) {}
+
+ inline double GetAngle() const { return mfAngle; }
+
+ /** Returns this style mirrored, if it is a double frame style, otherwise a simple copy. */
+ inline DiagStyle Mirror() const { return DiagStyle( Style::Mirror(), mfAngle ); }
+
+private:
+ double mfAngle; /// Angle between this and hor. or vert. border.
+};
+
+// ============================================================================
+// Various helper functions
+// ============================================================================
+
+/** Returns the angle between horizontal border of a rectangle and its diagonal.
+
+ The returned values represents the inner angle between the diagonals and
+ horizontal borders, and is therefore in the range [0,PI/2] (inclusive). The
+ passed sizes may be negative, calculation is done with absolute values.
+ */
+SVX_DLLPUBLIC double GetHorDiagAngle( long nWidth, long nHeight );
+
+/** Returns the angle between horizontal border of a rectangle and its diagonal.
+
+ The returned values represents the inner angle between the diagonals and
+ horizontal borders, and is therefore in the range [0,PI/2] (inclusive). The
+ passed rectangle positions may be unordered, they are adjusted internally.
+ */
+inline double GetHorDiagAngle( long nX1, long nX2, long nY1, long nY2 )
+{ return GetHorDiagAngle( nX2 - nX1, nY2 - nY1 ); }
+
+/** Returns the angle between horizontal border of a rectangle and its diagonal.
+
+ The returned values represents the inner angle between the diagonals and
+ horizontal borders, and is therefore in the range [0,PI/2] (inclusive). The
+ passed rectangle edges may be unordered, they are adjusted internally.
+ */
+inline double GetHorDiagAngle( const Point& rP1, const Point& rP2 )
+{ return GetHorDiagAngle( rP2.X() - rP1.X(), rP2.Y() - rP1.Y() ); }
+
+/** Returns the angle between horizontal border of a rectangle and its diagonal.
+
+ The returned values represents the inner angle between the diagonals and
+ horizontal borders, and is therefore in the range [0,PI/2] (inclusive).
+ */
+inline double GetHorDiagAngle( const Rectangle& rRect )
+{ return GetHorDiagAngle( rRect.GetWidth(), rRect.GetHeight() ); }
+
+// ----------------------------------------------------------------------------
+
+/** Returns the angle between vertical border of a rectangle and its diagonal.
+
+ The returned values represents the inner angle between the diagonals and
+ vertical borders, and is therefore in the range [0,PI/2] (inclusive). The
+ passed sizes may be negative, calculation is done with absolute values.
+ */
+inline double GetVerDiagAngle( long nWidth, long nHeight )
+{ return GetHorDiagAngle( nHeight, nWidth ); }
+
+/** Returns the angle between vertical border of a rectangle and its diagonal.
+
+ The returned values represents the inner angle between the diagonals and
+ vertical borders, and is therefore in the range [0,PI/2] (inclusive). The
+ passed rectangle positions may be unordered, they are adjusted internally.
+ */
+inline double GetVerDiagAngle( long nX1, long nX2, long nY1, long nY2 )
+{ return GetVerDiagAngle( nX2 - nX1, nY2 - nY1 ); }
+
+/** Returns the angle between vertical border of a rectangle and its diagonal.
+
+ The returned values represents the inner angle between the diagonals and
+ vertical borders, and is therefore in the range [0,PI/2] (inclusive). The
+ passed rectangle edges may be unordered, they are adjusted internally.
+ */
+inline double GetVerDiagAngle( const Point& rP1, const Point& rP2 )
+{ return GetVerDiagAngle( rP2.X() - rP1.X(), rP2.Y() - rP1.Y() ); }
+
+/** Returns the angle between vertical border of a rectangle and its diagonal.
+
+ The returned values represents the inner angle between the diagonals and
+ vertical borders, and is therefore in the range [0,PI/2] (inclusive).
+ */
+inline double GetVerDiagAngle( const Rectangle& rRect )
+{ return GetVerDiagAngle( rRect.GetWidth(), rRect.GetHeight() ); }
+
+// ============================================================================
+
+/** Returns an X coordinate for a diagonal frame border in the specified height.
+
+ This function is for usage with the top-left end of a top-left to
+ bottom-right diagonal frame border, connected to the left end of a
+ horizontal frame border.
+
+ The function returns the relative X position (i.e. for a polygon) of the
+ diagonal frame border according to the specified relative Y position. The
+ mentioned positions are relative to the reference point of both frame
+ borders.
+
+ +----------------------------------------------------------
+ | The horizontal frame border.
+ | |
+ - - - - - - | --+-- <---- Reference point for horizontal and diagonal frame borders.
+ ^ | \ | \
+ nVerOffs | \ \ <--- The diagonal frame border.
+ v +---\ \------------------------------------------------
+ - - - - - - - - -\- - -X <----- The function calculates the X position of i.e.
+ \ \ this point (relative from X of reference point).
+ \ \
+ Primary -->\ \<-- Secondary
+
+ @param nVerOffs
+ The vertical position of the point to be calculated, relative to the Y
+ coordinate of the reference point.
+ @param nDiagOffs
+ The width offset across the diagonal frame border (0 = middle),
+ regardless of the gradient of the diagonal frame border (always
+ vertical to the direction of the diagonal frame border). This value is
+ not related in any way to the reference point. For details about
+ relative width offsets, see description of class Style.
+ @param fAngle
+ Inner (right) angle between diagonal and horizontal frame border.
+ */
+SVX_DLLPUBLIC long GetTLDiagOffset( long nVerOffs, long nDiagOffs, double fAngle );
+
+/** Returns an X coordinate for a diagonal frame border in the specified height.
+
+ This function is for usage with the bottom-left end of a bottom-left to
+ top-right diagonal frame border, connected to the left end of a horizontal
+ frame border.
+
+ The function returns the relative X position (i.e. for a polygon) of the
+ diagonal frame border according to the specified relative Y position. The
+ mentioned positions are relative to the reference point of both frame
+ borders.
+
+ Primary -->/ /<--- Secondary
+ / /
+ / / The function calculates the X position of i.e.
+ - - - - - - - - -/- - -X <----- this point (relative from X of reference point).
+ ^ +---/ /------------------------------------------------
+ nVerOffs | / / <--- The diagonal frame border.
+ v | / | /
+ - - - - - - | --+-- <---- Reference point for horizontal and diagonal frame borders.
+ | |
+ | The horizontal frame border.
+ +----------------------------------------------------------
+
+ @param nVerOffs
+ The vertical position of the point to be calculated, relative to the Y
+ coordinate of the reference point.
+ @param nDiagOffs
+ The width offset across the diagonal frame border (0 = middle),
+ regardless of the gradient of the diagonal frame border (always
+ vertical to the direction of the diagonal frame border). This value is
+ not related in any way to the reference point. For details about
+ relative width offsets, see description of class Style.
+ @param fAngle
+ Inner (right) angle between diagonal and horizontal frame border.
+ */
+long GetBLDiagOffset( long nVerOffs, long nDiagOffs, double fAngle );
+
+/** Returns an X coordinate for a diagonal frame border in the specified height.
+
+ This function is for usage with the bottom-right end of a top-left to
+ bottom-right diagonal frame border, connected to the right end of a
+ horizontal frame border.
+
+ @param nVerOffs
+ The vertical position of the point to be calculated, relative to the Y
+ coordinate of the reference point.
+ @param nDiagOffs
+ The width offset across the diagonal frame border (0 = middle),
+ regardless of the gradient of the diagonal frame border (always
+ vertical to the direction of the diagonal frame border). This value is
+ not related in any way to the reference point. For details about
+ relative width offsets, see description of class Style.
+ @param fAngle
+ Inner (left) angle between diagonal and horizontal frame border.
+ */
+long GetBRDiagOffset( long nVerOffs, long nDiagOffs, double fAngle );
+
+/** Returns an X coordinate for a diagonal frame border in the specified height.
+
+ This function is for usage with the top-right end of a bottom-left to
+ top-right diagonal frame border, connected to the right end of a horizontal
+ frame border.
+
+ @param nVerOffs
+ The vertical position of the point to be calculated, relative to the Y
+ coordinate of the reference point.
+ @param nDiagOffs
+ The width offset across the diagonal frame border (0 = middle),
+ regardless of the gradient of the diagonal frame border (always
+ vertical to the direction of the diagonal frame border). This value is
+ not related in any way to the reference point. For details about
+ relative width offsets, see description of class Style.
+ @param fAngle
+ Inner (left) angle between diagonal and horizontal frame border.
+ */
+long GetTRDiagOffset( long nVerOffs, long nDiagOffs, double fAngle );
+
+// ============================================================================
+
+/** Checks whether two horizontal frame borders are "connectable".
+
+ Two borders are "connectable" in terms of this function, if both can be
+ drawn with only one call of a border drawing function. This means, the two
+ frame borders must have equal style and color, and none of the other
+ vertical and diagonal frame borders break the lines of the two borders in
+ any way (i.e. two vertical double frame borders would break the horizonal
+ frame borders). Of course this function can be used for vertical frame
+ borders as well.
+
+ The follong picture shows the meaning of all passed parameters:
+
+ \ rTFromT /
+ \ | /
+ rTFromTL | rTFromTR
+ \ | /
+ \ | /
+ ======== rLBorder ========= ========== rRBorder =======
+ / | \
+ / | \
+ rBFromBL | rBFromBR
+ / | \
+ / rBFromB \
+
+ @return
+ True, if rLBorder and rRBorder can be drawn in one step without
+ interruption at their connection point.
+ */
+SVX_DLLPUBLIC bool CheckFrameBorderConnectable(
+ const Style& rLBorder, /// Style of the left frame border to connect.
+ const Style& rRBorder, /// Style of the right frame border to connect.
+
+ const Style& rTFromTL, /// Diagonal frame border from top-left to connection point.
+ const Style& rTFromT, /// Vertical frame border from top to connection point.
+ const Style& rTFromTR, /// Horizontal frame border from top-right to connection point.
+
+ const Style& rBFromBL, /// Diagonal frame border from bottom-left to connection point.
+ const Style& rBFromB, /// Vertical frame border from bottom to connection point.
+ const Style& rBFromBR /// Horizontal frame border from bottom-right to connection point.
+);
+
+// ============================================================================
+// Drawing functions
+// ============================================================================
+
+/** Draws a horizontal frame border, regards all connected frame styles.
+
+ The frame style to draw is passed as parameter rBorder. The function
+ calculates the adjustment in X direction for left and right end of primary
+ and secondary line of the frame border (the style may present a double
+ line). The line ends may differ according to the connected frame styles
+ coming from top, bottom, left, right, and/or diagonal.
+
+ Thick frame styles are always drawn centered (in width) to the passed
+ reference points. The Y coordinates of both reference points must be equal
+ (the line cannot be drawn slanted).
+
+ The function preserves all settings of the passed output device.
+
+ All parameters starting with "rL" refer to the left end of the processed
+ frame border, all parameters starting with "rR" refer to the right end.
+ The following part of the parameter name starting with "From" specifies
+ where the frame border comes from. Example: "rLFromTR" means the frame
+ border coming from top-right, connected to the left end of rBorder (and
+ therefore a diagonal frame border).
+
+ The follong picture shows the meaning of all passed parameters:
+
+ rLFromT / \ rRFromT
+ | / \ |
+ | rLFromTR rRFromTL |
+ | / \ |
+ | / \ |
+ --- rLFromL --- ============== rBorder ============== --- rRFromR ---
+ | \ / |
+ | \ / |
+ | rLFromBR rRFromBL |
+ | \ / |
+ rLFromB \ / rRFromB
+ */
+SVX_DLLPUBLIC void DrawHorFrameBorder(
+ OutputDevice& rDev, /// The output device used to draw the frame border.
+
+ const Point& rLPos, /// Reference point for left end of the processed frame border.
+ const Point& rRPos, /// Reference point for right end of the processed frame border.
+ const Style& rBorder, /// Style of the processed frame border.
+
+ const DiagStyle& rLFromTR, /// Diagonal frame border from top-right to left end of rBorder.
+ const Style& rLFromT, /// Vertical frame border from top to left end of rBorder.
+ const Style& rLFromL, /// Horizontal frame border from left to left end of rBorder.
+ const Style& rLFromB, /// Vertical frame border from bottom to left end of rBorder.
+ const DiagStyle& rLFromBR, /// Diagonal frame border from bottom-right to left end of rBorder.
+
+ const DiagStyle& rRFromTL, /// Diagonal frame border from top-left to right end of rBorder.
+ const Style& rRFromT, /// Vertical frame border from top to right end of rBorder.
+ const Style& rRFromR, /// Horizontal frame border from right to right end of rBorder.
+ const Style& rRFromB, /// Vertical frame border from bottom to right end of rBorder.
+ const DiagStyle& rRFromBL, /// Diagonal frame border from bottom-left to right end of rBorder.
+
+ const Color* pForceColor = 0 /// If specified, overrides frame border color.
+);
+
+// ----------------------------------------------------------------------------
+
+/** Draws a horizontal frame border, regards all connected frame styles.
+
+ This is a simplified version of the DrawHorFrameBorder() function described
+ above. It does not support diagonal connected frame borders. See description
+ above for additional details about the parameters.
+
+ The function preserves all settings of the passed output device.
+ */
+void SVX_DLLPUBLIC DrawHorFrameBorder(
+ OutputDevice& rDev, /// The output device used to draw the frame border.
+
+ const Point& rLPos, /// Reference point for left end of the processed frame border.
+ const Point& rRPos, /// Reference point for right end of the processed frame border.
+ const Style& rBorder, /// Style of the processed frame border.
+
+ const Style& rLFromT, /// Vertical frame border from top to left end of rBorder.
+ const Style& rLFromL, /// Horizontal frame border from left to left end of rBorder.
+ const Style& rLFromB, /// Vertical frame border from bottom to left end of rBorder.
+
+ const Style& rRFromT, /// Vertical frame border from top to right end of rBorder.
+ const Style& rRFromR, /// Horizontal frame border from right to right end of rBorder.
+ const Style& rRFromB, /// Vertical frame border from bottom to right end of rBorder.
+
+ const Color* pForceColor = 0 /// If specified, overrides frame border color.
+);
+
+// ----------------------------------------------------------------------------
+
+/** Draws a horizontal frame border without connected frame styles.
+
+ This is the most simplified version of the DrawHorFrameBorder() function
+ described above. See description above for additional details about the
+ parameters.
+
+ The function preserves all settings of the passed output device.
+ */
+void SVX_DLLPUBLIC DrawHorFrameBorder(
+ OutputDevice& rDev, /// The output device used to draw the frame border.
+ const Point& rLPos, /// Reference point for left end of the processed frame border.
+ const Point& rRPos, /// Reference point for right end of the processed frame border.
+ const Style& rBorder, /// Style of the frame border to draw.
+ const Color* pForceColor = 0 /// If specified, overrides frame border color.
+);
+
+// ============================================================================
+
+/** Draws a vertical frame border, regards all connected frame styles.
+
+ The frame style to draw is passed as parameter rBorder. The function
+ calculates the adjustment in Y direction for top and bottom end of primary
+ and secondary line of the frame border (the style may present a double
+ line). The line ends may differ according to the connected frame styles
+ coming from left, right, top, bottom, and/or diagonal.
+
+ Thick frame styles are always drawn centered (in width) to the passed
+ reference points. The X coordinates of both reference points must be equal
+ (the line cannot be drawn slanted).
+
+ The function preserves all settings of the passed output device.
+
+ All parameters starting with "rT" refer to the top end of the processed
+ frame border, all parameters starting with "rB" refer to the bottom end.
+ The following part of the parameter name starting with "From" specifies
+ where the frame border comes from. Example: "rTFromBL" means the frame
+ border coming from bottom-left, connected to the top end of rBorder (and
+ therefore a diagonal frame border).
+
+ The follong picture shows the meaning of all passed parameters:
+
+ |
+ rTFromT
+ |
+ |
+ --- rTFromL --- --- rTFromR ---
+ / # \
+ / # \
+ rTFromBL # rTFromBR
+ / # \
+ / # \
+ #
+ rBorder
+ #
+ \ # /
+ \ # /
+ rBFromTL # rBFromTR
+ \ # /
+ \ # /
+ --- rBFromL --- --- rBFromR ---
+ |
+ |
+ rBFromB
+ |
+ */
+SVX_DLLPUBLIC void DrawVerFrameBorder(
+ OutputDevice& rDev, /// The output device used to draw the frame border.
+
+ const Point& rTPos, /// Reference point for top end of the processed frame border.
+ const Point& rBPos, /// Reference point for bottom end of the processed frame border.
+ const Style& rBorder, /// Style of the processed frame border.
+
+ const DiagStyle& rTFromBL, /// Diagonal frame border from bottom-right to top end of rBorder.
+ const Style& rTFromL, /// Horizontal frame border from left to top end of rBorder.
+ const Style& rTFromT, /// Vertical frame border from top to top end of rBorder.
+ const Style& rTFromR, /// Horizontal frame border from right to top end of rBorder.
+ const DiagStyle& rTFromBR, /// Diagonal frame border from bottom-right to top end of rBorder.
+
+ const DiagStyle& rBFromTL, /// Diagonal frame border from top-left to bottom end of rBorder.
+ const Style& rBFromL, /// Horizontal frame border from left to bottom end of rBorder.
+ const Style& rBFromB, /// Vertical frame border from bottom to bottom end of rBorder.
+ const Style& rBFromR, /// Horizontal frame border from right to bottom end of rBorder.
+ const DiagStyle& rBFromTR, /// Diagonal frame border from top-right to bottom end of rBorder.
+
+ const Color* pForceColor = 0 /// If specified, overrides frame border color.
+);
+
+// ----------------------------------------------------------------------------
+
+/** Draws a vertical frame border, regards all connected frame styles.
+
+ This is a simplified version of the DrawVerFrameBorder() function described
+ above. It does not support diagonal connected frame borders. See description
+ above for additional details about the parameters.
+
+ The function preserves all settings of the passed output device.
+ */
+void SVX_DLLPUBLIC DrawVerFrameBorder(
+ OutputDevice& rDev, /// The output device used to draw the frame border.
+
+ const Point& rTPos, /// Reference point for top end of the processed frame border.
+ const Point& rBPos, /// Reference point for bottom end of the processed frame border.
+ const Style& rBorder, /// Style of the processed frame border.
+
+ const Style& rTFromL, /// Horizontal frame border from left to top end of rBorder.
+ const Style& rTFromT, /// Vertical frame border from top to top end of rBorder.
+ const Style& rTFromR, /// Horizontal frame border from right to top end of rBorder.
+
+ const Style& rBFromL, /// Horizontal frame border from left to bottom end of rBorder.
+ const Style& rBFromB, /// Vertical frame border from bottom to bottom end of rBorder.
+ const Style& rBFromR, /// Horizontal frame border from right to bottom end of rBorder.
+
+ const Color* pForceColor = 0 /// If specified, overrides frame border color.
+);
+
+// ----------------------------------------------------------------------------
+
+/** Draws a vertical frame border without connected frame styles.
+
+ This is the most simplified version of the DrawVerFrameBorder() function
+ described above. See description above for additional details about the
+ parameters.
+
+ The function preserves all settings of the passed output device.
+ */
+void SVX_DLLPUBLIC DrawVerFrameBorder(
+ OutputDevice& rDev, /// The output device used to draw the frame border.
+ const Point& rTPos, /// Reference point for top end of the processed frame border.
+ const Point& rBPos, /// Reference point for bottom end of the processed frame border.
+ const Style& rBorder, /// Style of the frame border to draw.
+ const Color* pForceColor = 0 /// If specified, overrides frame border color.
+);
+
+// ----------------------------------------------------------------------------
+
+/** Draws a vertical slanted frame border without connected frame styles.
+
+ This is an extended version of the simple DrawVerFrameBorder() function
+ described above. It accepts start and end reference points with different
+ X coordinates. See description above for additional details about the
+ parameters (except the restriction on the reference points).
+
+ The function preserves all settings of the passed output device.
+ */
+void SVX_DLLPUBLIC DrawVerFrameBorderSlanted(
+ OutputDevice& rDev, /// The output device used to draw the frame border.
+ const Point& rTPos, /// Reference point for top end of the processed frame border.
+ const Point& rBPos, /// Reference point for bottom end of the processed frame border.
+ const Style& rBorder, /// Style of the frame border to draw.
+ const Color* pForceColor = 0 /// If specified, overrides frame border color.
+);
+
+// ============================================================================
+
+/** Draws both diagonal frame borders, regards all connected frame styles.
+
+ One or both passed diagonal frame styles may be invisible.
+
+ The function preserves all settings of the passed output device.
+ */
+SVX_DLLPUBLIC void DrawDiagFrameBorders(
+ OutputDevice& rDev, /// The output device used to draw the frame border.
+
+ const Rectangle& rRect, /// Rectangle for both diagonal frame borders.
+ const Style& rTLBR, /// Style of the processed top-left to bottom-right diagonal frame border.
+ const Style& rBLTR, /// Style of the processed bottom-left to top-right diagonal frame border.
+
+ const Style& rTLFromB, /// Vertical frame border from bottom to top-left end of rTLBR.
+ const Style& rTLFromR, /// Horizontal frame border from right to top-left end of rTLBR.
+ const Style& rBRFromT, /// Vertical frame border from top to bottom-right end of rTLBR.
+ const Style& rBRFromL, /// Horizontal frame border from left to bottom-right end of rTLBR.
+
+ const Style& rBLFromT, /// Vertical frame border from top to bottom-left end of rBLTR.
+ const Style& rBLFromR, /// Horizontal frame border from right to bottom-left end of rBLTR.
+ const Style& rTRFromB, /// Vertical frame border from bottom to top-right end of rBLTR.
+ const Style& rTRFromL, /// Horizontal frame border from left to top-right end of rBLTR.
+
+ const Color* pForceColor = 0, /// If specified, overrides frame border color.
+ bool bDiagDblClip = false /// true = Use clipping for crossing double frame borders.
+);
+
+// ============================================================================
+
+} // namespace frame
+} // namespace svx
+
+/* Yes, I love ASCII art. :-) -DR- */
+
+#endif
+
diff --git a/svx/inc/svx/framelinkarray.hxx b/svx/inc/svx/framelinkarray.hxx
new file mode 100644
index 000000000000..cebb4e0395e4
--- /dev/null
+++ b/svx/inc/svx/framelinkarray.hxx
@@ -0,0 +1,537 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_FRAMELINKARRAY_HXX
+#define SVX_FRAMELINKARRAY_HXX
+
+#include <svx/framelink.hxx>
+
+#include <memory>
+
+#include <vector>
+#include "svx/svxdllapi.h"
+
+namespace svx {
+namespace frame {
+
+// ============================================================================
+
+
+struct Cell
+{
+ Style maLeft;
+ Style maRight;
+ Style maTop;
+ Style maBottom;
+ Style maTLBR;
+ Style maBLTR;
+ long mnAddLeft;
+ long mnAddRight;
+ long mnAddTop;
+ long mnAddBottom;
+ bool mbMergeOrig;
+ bool mbOverlapX;
+ bool mbOverlapY;
+
+ explicit Cell();
+
+ inline bool IsMerged() const { return mbMergeOrig || mbOverlapX || mbOverlapY; }
+ inline bool IsOverlapped() const { return mbOverlapX || mbOverlapY; }
+
+ void MirrorSelfX( bool bMirrorStyles, bool bSwapDiag );
+ void MirrorSelfY( bool bMirrorStyles, bool bSwapDiag );
+};
+
+typedef std::vector< long > LongVec;
+typedef std::vector< Cell > CellVec;
+
+struct ArrayImpl
+{
+ CellVec maCells;
+ LongVec maWidths;
+ LongVec maHeights;
+ mutable LongVec maXCoords;
+ mutable LongVec maYCoords;
+ size_t mnWidth;
+ size_t mnHeight;
+ size_t mnFirstClipCol;
+ size_t mnFirstClipRow;
+ size_t mnLastClipCol;
+ size_t mnLastClipRow;
+ mutable bool mbXCoordsDirty;
+ mutable bool mbYCoordsDirty;
+ bool mbDiagDblClip;
+
+ explicit ArrayImpl( size_t nWidth, size_t nHeight, bool bDiagDblClip );
+
+ inline bool IsValidPos( size_t nCol, size_t nRow ) const
+ { return (nCol < mnWidth) && (nRow < mnHeight); }
+ inline size_t GetIndex( size_t nCol, size_t nRow ) const
+ { return nRow * mnWidth + nCol; }
+
+ const Cell& GetCell( size_t nCol, size_t nRow ) const;
+ Cell& GetCellAcc( size_t nCol, size_t nRow );
+
+ size_t GetMergedFirstCol( size_t nCol, size_t nRow ) const;
+ size_t GetMergedFirstRow( size_t nCol, size_t nRow ) const;
+ size_t GetMergedLastCol( size_t nCol, size_t nRow ) const;
+ size_t GetMergedLastRow( size_t nCol, size_t nRow ) const;
+
+ const Cell& GetMergedOriginCell( size_t nCol, size_t nRow ) const;
+ Cell& GetMergedOriginCellAcc( size_t nCol, size_t nRow );
+
+ bool IsMergedOverlappedLeft( size_t nCol, size_t nRow ) const;
+ bool IsMergedOverlappedRight( size_t nCol, size_t nRow ) const;
+ bool IsMergedOverlappedTop( size_t nCol, size_t nRow ) const;
+ bool IsMergedOverlappedBottom( size_t nCol, size_t nRow ) const;
+
+ bool IsInClipRange( size_t nCol, size_t nRow ) const;
+ bool IsColInClipRange( size_t nCol ) const;
+ bool IsRowInClipRange( size_t nRow ) const;
+
+ inline size_t GetMirrorCol( size_t nCol ) const { return mnWidth - nCol - 1; }
+ inline size_t GetMirrorRow( size_t nRow ) const { return mnHeight - nRow - 1; }
+
+ long GetColPosition( size_t nCol ) const;
+ long GetRowPosition( size_t nRow ) const;
+
+ long GetColWidth( size_t nFirstCol, size_t nLastCol ) const;
+ long GetRowHeight( size_t nFirstRow, size_t nLastRow ) const;
+
+ double GetHorDiagAngle( size_t nCol, size_t nRow, bool bSimple = false ) const;
+ double GetVerDiagAngle( size_t nCol, size_t nRow, bool bSimple = false ) const;
+};
+
+/** Stores frame styles of an array of cells, supports merged ranges.
+
+ This class is able to store the frame styles of an array of cells and to
+ draw the entire array or parts of it to any output device.
+
+ Every cell contains the style of the left, right, top, bottom, top-left to
+ bottom-right, and bottom-left to top-right frame border.
+
+ On drawing, the thicker frame border of neighbored cells is selected
+ automatically. All borders are drawn "connected", that means, the correct
+ start and end coordinates of all lines of the borders are calculated,
+ especaially, if they are drawn together with diagonal frame borders.
+
+ This array fully supports merged cell ranges. In a merged range, the frame
+ borders of the top-left cell is extended to the entire range, and all other
+ cells in that range are overlapped. Again, all connected frame borders,
+ also diagonals and frame borders from adjacent merged ranges, are handled
+ automatically.
+
+ Additionally, a clipping range can be set. If such a range is used, all
+ frame borders outside this range are completely ignored, and are not used
+ in the connected border calculation anymore.
+
+ The array can be mirrored in both directions. It is possible to specify,
+ whether to mirror the double frame styles, and whether to swap diagonal
+ frame borders.
+ */
+class SVX_DLLPUBLIC Array
+{
+public:
+ /** Constructs an empty array. */
+ explicit Array();
+
+ /** Constructs an array with the specified width and height. */
+ explicit Array( size_t nWidth, size_t nHeight );
+
+ /** Destructs the array. */
+ ~Array();
+
+ // array size and column/row indexes --------------------------------------
+
+ /** Reinitializes the array with the specified size. Clears all styles. */
+ void Initialize( size_t nWidth, size_t nHeight );
+
+ /** Clears all line styles, column widths, row heights, merge data, and the clip range. */
+ void Clear();
+
+ /** Returns the number of columns in the array. */
+ size_t GetColCount() const;
+
+ /** Returns the number of rows in the array. */
+ size_t GetRowCount() const;
+
+ /** Returns the number of cells in the array. */
+ size_t GetCellCount() const;
+
+ /** Returns the column index of the specified cell index. */
+ size_t GetColFromIndex( size_t nCellIndex ) const;
+
+ /** Returns the row index of the specified cell index. */
+ size_t GetRowFromIndex( size_t nCellIndex ) const;
+
+ /** Returns the cell index from the cell address (nCol,nRow). */
+ size_t GetCellIndex( size_t nCol, size_t nRow, bool bRTL = false) const;
+
+ // cell border styles -----------------------------------------------------
+
+ /** Sets the left frame style of the cell (nCol,nRow). Ignores merged ranges. */
+ void SetCellStyleLeft( size_t nCol, size_t nRow, const Style& rStyle );
+
+ /** Sets the right frame style of the cell (nCol,nRow). Ignores merged ranges. */
+ void SetCellStyleRight( size_t nCol, size_t nRow, const Style& rStyle );
+
+ /** Sets the top frame style of the cell (nCol,nRow). Ignores merged ranges. */
+ void SetCellStyleTop( size_t nCol, size_t nRow, const Style& rStyle );
+
+ /** Sets the bottom frame style of the specified cell (nCol,nRow). Ignores merged ranges. */
+ void SetCellStyleBottom( size_t nCol, size_t nRow, const Style& rStyle );
+
+ /** Sets the top-left to bottom-right frame style of the cell (nCol,nRow). Ignores merged ranges. */
+ void SetCellStyleTLBR( size_t nCol, size_t nRow, const Style& rStyle );
+
+ /** Sets the bottom-left to top-right frame style of the cell (nCol,nRow). Ignores merged ranges. */
+ void SetCellStyleBLTR( size_t nCol, size_t nRow, const Style& rStyle );
+
+ /** Sets both diagonal frame styles of the specified cell (nCol,nRow). Ignores merged ranges. */
+ void SetCellStyleDiag( size_t nCol, size_t nRow, const Style& rTLBR, const Style& rBLTR );
+
+ /** Sets the left frame style of the specified column. Ignores merged ranges. */
+ void SetColumnStyleLeft( size_t nCol, const Style& rStyle );
+
+ /** Sets the right frame style of the specified column. Ignores merged ranges. */
+ void SetColumnStyleRight( size_t nCol, const Style& rStyle );
+
+ /** Sets the top frame style of the specified row. Ignores merged ranges. */
+ void SetRowStyleTop( size_t nRow, const Style& rStyle );
+
+ /** Sets the bottom frame style of the specified row. Ignores merged ranges. */
+ void SetRowStyleBottom( size_t nRow, const Style& rStyle );
+
+ /** Returns the left frame style of the cell (nCol,nRow).
+ @param bSimple
+ true = Ignores merged ranges and neighbor cells;
+ false = Returns thicker of own left style or right style of the cell to the left.
+ Returns the style only if visible (i.e. at left border of a merged range).
+ @return
+ The left frame style or an invisible style for invalid cell addresses. */
+ const Style& GetCellStyleLeft( size_t nCol, size_t nRow, bool bSimple = false ) const;
+
+ /** Returns the right frame style of the cell (nCol,nRow).
+ @param bSimple
+ true = Ignores merged ranges and neighbor cells;
+ false = Returns thicker of own right style or left style of the cell to the right.
+ Returns the style only if visible (i.e. at right border of a merged range).
+ @return
+ The left frame style or an invisible style for invalid cell addresses. */
+ const Style& GetCellStyleRight( size_t nCol, size_t nRow, bool bSimple = false ) const;
+
+ /** Returns the top frame style of the cell (nCol,nRow).
+ @param bSimple
+ true = Ignores merged ranges and neighbor cells;
+ false = Returns thicker of own top style or bottom style of the cell above.
+ Returns the style only if visible (i.e. at top border of a merged range).
+ @return
+ The top frame style or an invisible style for invalid cell addresses. */
+ const Style& GetCellStyleTop( size_t nCol, size_t nRow, bool bSimple = false ) const;
+
+ /** Returns the top frame style of the cell (nCol,nRow).
+ @param bSimple
+ true = Ignores merged ranges and neighbor cells;
+ false = Returns thicker of own top style or bottom style of the cell above.
+ Returns the style only if visible (i.e. at top border of a merged range).
+ @return
+ The top frame style or an invisible style for invalid cell addresses. */
+ const Style& GetCellStyleBottom( size_t nCol, size_t nRow, bool bSimple = false ) const;
+
+ /** Returns the top-left to bottom-right frame style of the cell (nCol,nRow).
+ @param bSimple
+ true = Ignores merged ranges;
+ false = Returns the visible style (i.e. from top-left corner of a merged range).
+ @return
+ The top-left to bottom-right frame style or an invisible style for invalid cell addresses. */
+ const Style& GetCellStyleTLBR( size_t nCol, size_t nRow, bool bSimple = false ) const;
+
+ /** Returns the bottom-left to top-right frame style of the cell (nCol,nRow).
+ @param bSimple
+ true = Ignores merged ranges;
+ false = Returns the visible style (i.e. from top-left corner of a merged range).
+ @return
+ The bottom-left to top-right frame style or an invisible style for invalid cell addresses. */
+ const Style& GetCellStyleBLTR( size_t nCol, size_t nRow, bool bSimple = false ) const;
+
+ /** Returns the top-left to bottom-right frame style of the cell (nCol,nRow).
+ @return
+ The top-left to bottom-right frame style, if the cell is not part of
+ a merged range, or if (nCol,nRow) is the top-left corner of a merged
+ range (useful to find connected frame styles).
+ An invisible style for invalid cell addresses. */
+ const Style& GetCellStyleTL( size_t nCol, size_t nRow ) const;
+
+ /** Returns the top-left to bottom-right frame style of the cell (nCol,nRow).
+ @return
+ The top-left to bottom-right frame style, if the cell is not part of
+ a merged range, or if (nCol,nRow) is the bottom-right corner of a
+ merged range (useful to find connected frame styles).
+ An invisible style for invalid cell addresses. */
+ const Style& GetCellStyleBR( size_t nCol, size_t nRow ) const;
+
+ /** Returns the bottom-left to top-right frame style of the cell (nCol,nRow).
+ @return
+ The bottom-left to top-right frame style, if the cell is not part of
+ a merged range, or if (nCol,nRow) is the bottom-left corner of a
+ merged range (useful to find connected frame styles).
+ An invisible style for invalid cell addresses. */
+ const Style& GetCellStyleBL( size_t nCol, size_t nRow ) const;
+
+ /** Returns the bottom-left to top-right frame style of the cell (nCol,nRow).
+ @return
+ The bottom-left to top-right frame style, if the cell is not part of
+ a merged range, or if (nCol,nRow) is the top-right corner of a
+ merged range (useful to find connected frame styles).
+ An invisible style for invalid cell addresses. */
+ const Style& GetCellStyleTR( size_t nCol, size_t nRow ) const;
+
+ // cell merging -----------------------------------------------------------
+
+ /** Inserts a new merged cell range.
+ @precond The range must not intersect other merged ranges. */
+ void SetMergedRange( size_t nFirstCol, size_t nFirstRow, size_t nLastCol, size_t nLastRow );
+
+ /** Removes the merged cell range that contains (nCol,nRow). */
+ void RemoveMergedRange( size_t nCol, size_t nRow );
+
+ /** Sets an additional left width for the merged range that contains (nCol,nRow).
+ @descr Useful to handle merged ranges that are not completely part of the array.
+ @precond The merged range must be at the left border of the array. */
+ void SetAddMergedLeftSize( size_t nCol, size_t nRow, long nAddSize );
+
+ /** Sets an additional right width for the merged range that contains (nCol,nRow).
+ @descr Useful to handle merged ranges that are not completely part of the array.
+ @precond The merged range must be at the right border of the array. */
+ void SetAddMergedRightSize( size_t nCol, size_t nRow, long nAddSize );
+
+ /** Sets an additional top height for the merged range that contains (nCol,nRow).
+ @descr Useful to handle merged ranges that are not completely part of the array.
+ @precond The merged range must be at the top border of the array. */
+ void SetAddMergedTopSize( size_t nCol, size_t nRow, long nAddSize );
+
+ /** Sets an additional bottom height for the merged range that contains (nCol,nRow).
+ @descr Useful to handle merged ranges that are not completely part of the array.
+ @precond The merged range must be at the bottom border of the array. */
+ void SetAddMergedBottomSize( size_t nCol, size_t nRow, long nAddSize );
+
+ /** Returns true, if the cell (nCol,nRow) is part of a merged range. */
+ bool IsMerged( size_t nCol, size_t nRow ) const;
+
+ /** Returns true, if the cell (nCol,nRow) is the top-left corner of a merged range. */
+ bool IsMergedOrigin( size_t nCol, size_t nRow ) const;
+
+ /** Returns true, if the cell (nCol,nRow) is overlapped by a merged range. */
+ bool IsMergedOverlapped( size_t nCol, size_t nRow ) const;
+
+ /** Returns true, if the left border of the cell (nCol,nRow) is overlapped by a merged range. */
+ bool IsMergedOverlappedLeft( size_t nCol, size_t nRow ) const;
+
+ /** Returns true, if the right border of the cell (nCol,nRow) is overlapped by a merged range. */
+ bool IsMergedOverlappedRight( size_t nCol, size_t nRow ) const;
+
+ /** Returns true, if the top border of the cell (nCol,nRow) is overlapped by a merged range. */
+ bool IsMergedOverlappedTop( size_t nCol, size_t nRow ) const;
+
+ /** Returns true, if the bottom border of the cell (nCol,nRow) is overlapped by a merged range. */
+ bool IsMergedOverlappedBottom( size_t nCol, size_t nRow ) const;
+
+ /** Returns the address of the top-left cell of the merged range that contains (nCol,nRow). */
+ void GetMergedOrigin( size_t& rnFirstCol, size_t& rnFirstRow, size_t nCol, size_t nRow ) const;
+
+ /** Returns the range size of the merged range thst contains (nCol,nRow). */
+ void GetMergedSize( size_t& rnWidth, size_t& rnHeight, size_t nCol, size_t nRow ) const;
+
+ /** Returns the top-left and bottom-right address of the merged range that contains (nCol,nRow). */
+ void GetMergedRange( size_t& rnFirstCol, size_t& rnFirstRow,
+ size_t& rnLastCol, size_t& rnLastRow, size_t nCol, size_t nRow ) const;
+
+ // clipping ---------------------------------------------------------------
+
+ /** Sets a clipping range.
+ @descr
+ No cell borders outside of this clipping range will be drawn. In
+ difference to simply using the DrawRange() function with the same
+ range, a clipping range causes the drawing functions to completely
+ ignore the frame styles connected from outside. This is used i.e.
+ in Calc to print single pages and to draw the print preview.
+ Partly visible diagonal frame borders in merged ranges are correctly
+ clipped too. This array can handle only one clip range at a time. */
+ void SetClipRange( size_t nFirstCol, size_t nFirstRow, size_t nLastCol, size_t nLastRow );
+
+ /** Removes the clipping range set with the SetClipRange() function. */
+ void RemoveClipRange();
+
+ /** Returns true, if the cell (bCol,nRow) is inside the current clip range. */
+ bool IsInClipRange( size_t nCol, size_t nRow ) const;
+
+ /** Returns the rectangle (output coordinates) of the current clipping range. */
+ Rectangle GetClipRangeRectangle() const;
+
+ // cell coordinates -------------------------------------------------------
+
+ /** Sets the X output coordinate of the left column. */
+ void SetXOffset( long nXOffset );
+
+ /** Sets the Y output coordinate of the top row. */
+ void SetYOffset( long nYOffset );
+
+ /** Sets the output width of the specified column. */
+ void SetColWidth( size_t nCol, long nWidth );
+
+ /** Sets the output height of the specified row. */
+ void SetRowHeight( size_t nRow, long nHeight );
+
+ /** Sets the same output width for all columns. */
+ void SetAllColWidths( long nWidth );
+
+ /** Sets the same output height for all rows. */
+ void SetAllRowHeights( long nHeight );
+
+ /** Returns the X output coordinate of the left border of the specified column.
+ @descr The column index <array-width> returns the X output coordinate
+ of the right array border. */
+ long GetColPosition( size_t nCol ) const;
+
+ /** Returns the Y output coordinate of the top border of the specified row.
+ @descr The row index <array-height> returns the Y output coordinate
+ of the bottom array border. */
+ long GetRowPosition( size_t nRow ) const;
+
+ /** Returns the output width of the specified column. */
+ long GetColWidth( size_t nCol ) const;
+
+ /** Returns the output width of the specified range of columns. */
+ long GetColWidth( size_t nFirstCol, size_t nLastCol ) const;
+
+ /** Returns the output height of the specified row. */
+ long GetRowHeight( size_t nRow ) const;
+
+ /** Returns the output height of the specified range of rows. */
+ long GetRowHeight( size_t nFirstRow, size_t nLastRow ) const;
+
+ /** Returns the output width of the entire array. */
+ long GetWidth() const;
+
+ /** Returns the output height of the entire array. */
+ long GetHeight() const;
+
+ /** Returns the top-left output position of the cell (nCol,nRow).
+ @param bSimple
+ true = Ignores merged ranges;
+ false = Returns output position of top-left corner of merged ranges. */
+ Point GetCellPosition( size_t nCol, size_t nRow, bool bSimple = false ) const;
+
+ /** Returns the output size of the cell (nCol,nRow).
+ @param bSimple
+ true = Ignores merged ranges;
+ false = Returns total output size of merged ranges. */
+ Size GetCellSize( size_t nCol, size_t nRow, bool bSimple = false ) const;
+
+ /** Returns the output rectangle of the cell (nCol,nRow).
+ @param bSimple
+ true = Ignores merged ranges;
+ false = Returns total output rectangle of merged ranges. */
+ Rectangle GetCellRect( size_t nCol, size_t nRow, bool bSimple = false ) const;
+
+ // diagonal frame borders -------------------------------------------------
+
+ /** Returns the angle between horizontal and diagonal border of the cell (nCol,nRow).
+ @param bSimple
+ true = Ignores merged ranges;
+ false = Returns the horizontal angle of merged ranges. */
+ double GetHorDiagAngle( size_t nCol, size_t nRow, bool bSimple = false ) const;
+
+ /** Returns the angle between vertical and diagonal border of the cell (nCol,nRow).
+ @param bSimple
+ true = Ignores merged ranges;
+ false = Returns the vertical angle of merged ranges. */
+ double GetVerDiagAngle( size_t nCol, size_t nRow, bool bSimple = false ) const;
+
+ /** Specifies whether to use polygon clipping to draw diagonal frame borders.
+ @descr
+ If enabled, diagonal frame borders are drawn interrupted, if they are
+ crossed by a double frame border. Polygon clipping is very expensive
+ and should only be used for very small output devices (i.e. in the
+ Border tab page). Default after construction is OFF. */
+ void SetUseDiagDoubleClipping( bool bSet );
+
+ /** Returns true, if polygon clipping is used to draw diagonal frame borders. */
+ bool GetUseDiagDoubleClipping() const;
+
+ // mirroring --------------------------------------------------------------
+
+ /** Mirrors the entire array horizontally.
+ @param bMirrorStyles
+ true = Swap primary and secondary line of all vertical double frame borders.
+ @param bSwapDiag
+ true = Swap top-left to bottom-right and bottom-left to top-right frame borders. */
+ void MirrorSelfX( bool bMirrorStyles, bool bSwapDiag );
+
+ /** Mirrors the entire array vertically.
+ @param bMirrorStyles
+ true = Swap primary and secondary line of all horizontal double frame borders.
+ @param bSwapDiag
+ true = Swap top-left to bottom-right and bottom-left to top-right frame borders. */
+ void MirrorSelfY( bool bMirrorStyles, bool bSwapDiag );
+
+ // drawing ----------------------------------------------------------------
+
+ /** Draws the cell (nCol,nRow), if it is inside the clipping range.
+ @param pForceColor
+ If not NULL, only this color will be used to draw all frame borders. */
+ void DrawCell( OutputDevice& rDev, size_t nCol, size_t nRow,
+ const Color* pForceColor = 0 ) const;
+
+ /** Draws the part of the specified range, that is inside the clipping range.
+ @param pForceColor
+ If not NULL, only this color will be used to draw all frame borders. */
+ void DrawRange( OutputDevice& rDev,
+ size_t nFirstCol, size_t nFirstRow,
+ size_t nLastCol, size_t nLastRow,
+ const Color* pForceColor = 0 ) const;
+
+ /** Draws the part of the array, that is inside the clipping range.
+ @param pForceColor
+ If not NULL, only this color will be used to draw all frame borders. */
+ void DrawArray( OutputDevice& rDev, const Color* pForceColor = 0 ) const;
+
+ // ------------------------------------------------------------------------
+
+private:
+ typedef std::auto_ptr< ArrayImpl > ArrayImplPtr;
+
+ ArrayImplPtr mxImpl;
+};
+
+// ============================================================================
+
+} // namespace frame
+} // namespace svx
+
+#endif
+
diff --git a/svx/inc/svx/frmdirlbox.hxx b/svx/inc/svx/frmdirlbox.hxx
new file mode 100644
index 000000000000..24eb27362e45
--- /dev/null
+++ b/svx/inc/svx/frmdirlbox.hxx
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_FRMDIRLBOX_HXX
+#define _SVX_FRMDIRLBOX_HXX
+
+#ifndef _LSTBOX_HXX
+#include <vcl/lstbox.hxx>
+#endif
+#include <sfx2/itemconnect.hxx>
+#include <editeng/frmdir.hxx>
+#include "svx/svxdllapi.h"
+
+class SvxFrameDirectionItem;
+
+namespace svx {
+
+// ============================================================================
+
+/** This listbox contains entries to select horizontal text direction.
+
+ The control works on the SvxFrameDirection enumeration (i.e. left-to-right,
+ right-to-left), used i.e. in conjunction with the SvxFrameDirectionItem.
+ */
+class SVX_DLLPUBLIC FrameDirectionListBox : public ListBox
+{
+public:
+ explicit FrameDirectionListBox( Window* pParent, WinBits nStyle = WB_BORDER );
+ explicit FrameDirectionListBox( Window* pParent, const ResId& rResId );
+ virtual ~FrameDirectionListBox();
+
+ /** Inserts a string with corresponding direction enum into the listbox. */
+ void InsertEntryValue(
+ const String& rString,
+ SvxFrameDirection eDirection,
+ sal_uInt16 nPos = LISTBOX_APPEND );
+ /** Removes the entry, that represents the specified frame direction. */
+ void RemoveEntryValue( SvxFrameDirection eDirection );
+
+ /** Selects the specified frame direction. */
+ void SelectEntryValue( SvxFrameDirection eDirection );
+ /** Returns the currently selected frame direction. */
+ SvxFrameDirection GetSelectEntryValue() const;
+
+ /** Saves the currently selected frame direction. */
+ inline void SaveValue() { meSaveValue = GetSelectEntryValue(); }
+ /** Returns the frame direction saved with SaveValue(). */
+ inline SvxFrameDirection GetSavedValue() const { return meSaveValue; }
+
+private:
+ SvxFrameDirection meSaveValue; /// Saved value for later comparison.
+};
+
+typedef FrameDirectionListBox FrameDirListBox;
+
+// ============================================================================
+
+/** Wrapper for usage of a FrameDirectionListBox in item connections. */
+class SVX_DLLPUBLIC FrameDirListBoxWrapper : public sfx::SingleControlWrapper< FrameDirListBox, SvxFrameDirection >
+{
+public:
+ explicit FrameDirListBoxWrapper( FrameDirListBox& rListBox );
+
+ virtual bool IsControlDontKnow() const;
+ virtual void SetControlDontKnow( bool bSet );
+
+ virtual SvxFrameDirection GetControlValue() const;
+ virtual void SetControlValue( SvxFrameDirection eValue );
+};
+
+/** Wrapper for usage of a SvxFrameDirectionItem in item connections. */
+typedef sfx::ValueItemWrapper< SvxFrameDirectionItem, SvxFrameDirection, sal_uInt16 > FrameDirItemWrapper;
+
+/** An item<->control connection for a FrameDirectionListBox. */
+typedef sfx::ItemControlConnection< FrameDirItemWrapper, FrameDirListBoxWrapper > FrameDirListBoxConnection;
+
+// ============================================================================
+
+} // namespace svx
+
+#endif
+
diff --git a/svx/inc/svx/frmsel.hxx b/svx/inc/svx/frmsel.hxx
new file mode 100644
index 000000000000..2b2613226b85
--- /dev/null
+++ b/svx/inc/svx/frmsel.hxx
@@ -0,0 +1,204 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_FRMSEL_HXX
+#define SVX_FRMSEL_HXX
+
+#include <memory>
+#include <tools/color.hxx>
+#include <vcl/ctrl.hxx>
+#include <vcl/bitmap.hxx>
+#include <svx/framebordertype.hxx>
+#include "svx/svxdllapi.h"
+
+class SvxBorderLine;
+
+namespace svx {
+
+struct FrameSelectorImpl;
+
+// ============================================================================
+
+typedef int FrameSelFlags;
+
+const FrameSelFlags FRAMESEL_NONE = 0x0000;
+/** If set, the left frame border is enabled. */
+const FrameSelFlags FRAMESEL_LEFT = 0x0001;
+/** If set, the right frame border is enabled. */
+const FrameSelFlags FRAMESEL_RIGHT = 0x0002;
+/** If set, the top frame border is enabled. */
+const FrameSelFlags FRAMESEL_TOP = 0x0004;
+/** If set, the bottom frame border is enabled. */
+const FrameSelFlags FRAMESEL_BOTTOM = 0x0008;
+/** If set, the inner horizontal frame border is enabled. */
+const FrameSelFlags FRAMESEL_INNER_HOR = 0x0010;
+/** If set, the inner vertical frame border is enabled. */
+const FrameSelFlags FRAMESEL_INNER_VER = 0x0020;
+/** If set, the top-left to bottom-right diagonal frame border is enabled. */
+const FrameSelFlags FRAMESEL_DIAG_TLBR = 0x0040;
+/** If set, the bottom-left to top-right diagonal frame border is enabled. */
+const FrameSelFlags FRAMESEL_DIAG_BLTR = 0x0080;
+
+/** If set, all four outer frame borders are enabled. */
+const FrameSelFlags FRAMESEL_OUTER = FRAMESEL_LEFT|FRAMESEL_RIGHT|FRAMESEL_TOP|FRAMESEL_BOTTOM;
+/** If set, both inner frame borders are enabled. */
+const FrameSelFlags FRAMESEL_INNER = FRAMESEL_INNER_HOR|FRAMESEL_INNER_VER;
+/** If set, both diagonal frame borders are enabled. */
+const FrameSelFlags FRAMESEL_DIAGONAL = FRAMESEL_DIAG_TLBR|FRAMESEL_DIAG_BLTR;
+
+/** If set, all frame borders will support the don't care state. */
+const FrameSelFlags FRAMESEL_DONTCARE = 0x0100;
+
+// ----------------------------------------------------------------------------
+
+/** All possible states of a frame border. */
+enum FrameBorderState
+{
+ FRAMESTATE_SHOW, /// Frame border has a visible style.
+ FRAMESTATE_HIDE, /// Frame border is hidden (off).
+ FRAMESTATE_DONTCARE /// Frame border is in don't care state (if enabled).
+};
+
+// ============================================================================
+
+class SVX_DLLPUBLIC FrameSelector : public Control
+{
+public:
+ explicit FrameSelector( Window* pParent, const ResId& rResId );
+ virtual ~FrameSelector();
+
+ /** Initializes the control, enables/disables frame borders according to flags. */
+ void Initialize( FrameSelFlags nFlags );
+
+ // enabled frame borders --------------------------------------------------
+
+ /** Returns true, if the specified frame border is enabled. */
+ bool IsBorderEnabled( FrameBorderType eBorder ) const;
+ /** Returns the number of enabled frame borders. */
+ sal_Int32 GetEnabledBorderCount() const;
+ /** Returns the border type from the passed index (counts only enabled frame borders). */
+ FrameBorderType GetEnabledBorderType( sal_Int32 nIndex ) const;
+ /** Returns the index of a frame border (counts only enabled borders) from passed type. */
+ sal_Int32 GetEnabledBorderIndex( FrameBorderType eBorder ) const;
+
+ // frame border state and style -------------------------------------------
+
+ /** Returns true, if the control supports the "don't care" frame border state. */
+ bool SupportsDontCareState() const;
+
+ /** Returns the state (visible/hidden/don't care) of the specified frame border. */
+ FrameBorderState GetFrameBorderState( FrameBorderType eBorder ) const;
+ /** Returns the style of the specified frame border, if it is visible. */
+ const SvxBorderLine* GetFrameBorderStyle( FrameBorderType eBorder ) const;
+
+ /** Shows the specified frame border using the passed style, or hides it, if pStyle is 0. */
+ void ShowBorder( FrameBorderType eBorder, const SvxBorderLine* pStyle );
+ /** Sets the specified frame border to "don't care" state. */
+ void SetBorderDontCare( FrameBorderType eBorder );
+
+ /** Returns true, if any enabled frame border has a visible style (not "don't care"). */
+ bool IsAnyBorderVisible() const;
+ /** Hides all enabled frame borders. */
+ void HideAllBorders();
+
+ /** Returns true, if all visible frame borders have equal widths.
+ @descr Ignores hidden and "don't care" frame borders. On success,
+ returns the widths in the passed parameters. */
+ bool GetVisibleWidth( sal_uInt16& rnPrim, sal_uInt16& rnDist, sal_uInt16& rnSec ) const;
+ /** Returns true, if all visible frame borders have equal color.
+ @descr Ignores hidden and "don't care" frame borders. On success,
+ returns the color in the passed parameter. */
+ bool GetVisibleColor( Color& rColor ) const;
+
+ // frame border selection -------------------------------------------------
+
+ /** Returns the current selection handler. */
+ const Link& GetSelectHdl() const;
+ /** Sets the passed handler that is called if the selection of the control changes. */
+ void SetSelectHdl( const Link& rHdl );
+
+ /** Returns true, if the specified frame border is selected. */
+ bool IsBorderSelected( FrameBorderType eBorder ) const;
+ /** Selects or deselects the specified frame border. */
+ void SelectBorder( FrameBorderType eBorder, bool bSelect = true );
+ /** Deselects the specified frame border. */
+ inline void DeselectBorder( FrameBorderType eBorder ) { SelectBorder( eBorder, false ); }
+
+ /** Returns true, if any of the enabled frame borders is selected. */
+ bool IsAnyBorderSelected() const;
+ /** Selects or deselects all frame borders. */
+ void SelectAllBorders( bool bSelect = true );
+ /** Deselects all frame borders. */
+ inline void DeselectAllBorders() { SelectAllBorders( false ); }
+
+ /** Selects or deselects all visible frame borders (ignores hidden and "don't care" borders). */
+ void SelectAllVisibleBorders( bool bSelect = true );
+
+ /** Sets the passed line widths to all selected frame borders (in twips). */
+ void SetStyleToSelection( sal_uInt16 nPrim, sal_uInt16 nDist, sal_uInt16 nSec );
+ /** Sets the passed color to all selected frame borders. */
+ void SetColorToSelection( const Color& rColor );
+
+ // accessibility ----------------------------------------------------------
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ CreateAccessible();
+
+ /** Returns the accessibility child object of the specified frame border (if enabled). */
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ GetChildAccessible( FrameBorderType eBorder );
+ /** Returns the accessibility child object with specified index (counts enabled frame borders only). */
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ GetChildAccessible( sal_Int32 nIndex );
+ /** Returns the accessibility child object at the specified position (relative to control). */
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ GetChildAccessible( const Point& rPos );
+
+ /** Returns true, if the passed point is inside the click area of any enabled frame border. */
+ bool ContainsClickPoint( const Point& rPos ) const;
+ /** Returns the bounding rectangle of the specified frame border (if enabled). */
+ Rectangle GetClickBoundRect( FrameBorderType eBorder ) const;
+
+ // ------------------------------------------------------------------------
+protected:
+ virtual void Paint( const Rectangle& rRect );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void GetFocus();
+ virtual void LoseFocus();
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+private:
+ std::auto_ptr< FrameSelectorImpl > mxImpl;
+};
+
+// ============================================================================
+
+} // namespace svx
+
+#endif
+
diff --git a/svx/inc/svx/galbrws.hxx b/svx/inc/svx/galbrws.hxx
new file mode 100644
index 000000000000..1a19e773baa9
--- /dev/null
+++ b/svx/inc/svx/galbrws.hxx
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_GALBRWS_HXX_
+#define _SVX_GALBRWS_HXX_
+
+#include <sfx2/ctrlitem.hxx>
+#include <sfx2/dockwin.hxx>
+#include <vcl/graph.hxx>
+#include <tools/urlobj.hxx>
+#include "svx/svxdllapi.h"
+
+// -----------
+// - Defines -
+// -----------
+
+#define GALLERYBROWSER() ((GalleryBrowser*)( SfxViewFrame::Current()->GetChildWindow(GalleryChildWindow::GetChildWindowId())->GetWindow()))
+
+// -------------------------
+// - SvxGalleryChildWindow -
+// -------------------------
+
+class SVX_DLLPUBLIC GalleryChildWindow : public SfxChildWindow
+{
+public:
+ GalleryChildWindow( Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo* );
+ ~GalleryChildWindow();
+
+ SFX_DECL_CHILDWINDOW( GalleryChildWindow );
+};
+
+// ------------------
+// - FormModel -
+// ------------------
+
+class FmFormModel;
+
+// ------------------
+// - GalleryBrowser -
+// ------------------
+
+class GalleryBrowser1;
+class GalleryBrowser2;
+class GallerySplitter;
+class Gallery;
+
+class GalleryBrowser : public SfxDockingWindow
+{
+ friend class GalleryBrowser1;
+ friend class GalleryBrowser2;
+ friend class GallerySplitter;
+ using Window::KeyInput;
+
+private:
+
+ Size maLastSize;
+ GallerySplitter* mpSplitter;
+ GalleryBrowser1* mpBrowser1;
+ GalleryBrowser2* mpBrowser2;
+ Gallery* mpGallery;
+ long mnDummy1;
+ long mnDummy2;
+ long mnDummy3;
+
+ void InitSettings();
+
+ virtual sal_Bool Close();
+ virtual void Resize();
+ virtual void GetFocus();
+
+ DECL_LINK( SplitHdl, void* );
+
+protected:
+
+ void ThemeSelectionHasChanged();
+
+public:
+
+ GalleryBrowser( SfxBindings* pBindings, SfxChildWindow* pCW,
+ Window* pParent, const ResId& rResId );
+ ~GalleryBrowser();
+
+ INetURLObject GetURL() const;
+ String GetFilterName() const;
+ Graphic GetGraphic() const;
+ sal_Bool GetVCDrawModel( FmFormModel& rModel ) const;
+ sal_Bool IsLinkage() const;
+
+ sal_Bool KeyInput( const KeyEvent& rKEvt, Window* pWindow );
+};
+
+#endif // _SVX_GALBRWS_HXX_
diff --git a/svx/inc/svx/galctrl.hxx b/svx/inc/svx/galctrl.hxx
new file mode 100644
index 000000000000..53fce03cd6c9
--- /dev/null
+++ b/svx/inc/svx/galctrl.hxx
@@ -0,0 +1,191 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_GALCTRL_HXX_
+#define _SVX_GALCTRL_HXX_
+
+#include <vcl/dialog.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/group.hxx>
+#include <vcl/button.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/menu.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/combobox.hxx>
+#include <vcl/sound.hxx>
+#include <svl/slstitm.hxx>
+#include <svtools/transfer.hxx>
+#include <svtools/valueset.hxx>
+#include <svtools/brwbox.hxx>
+#include <svtools/grfmgr.hxx>
+#include "svx/galmisc.hxx"
+#include "svx/svxdllapi.h"
+
+// ------------
+// - Forwards -
+// ------------
+
+class GalleryTheme;
+class GalleryBrowser2;
+
+// ------------------
+// - GalleryPreview -
+// ------------------
+
+class SVX_DLLPUBLIC GalleryPreview : public Window, public DropTargetHelper, public DragSourceHelper
+{
+private:
+
+ GraphicObject aGraphicObj;
+ Rectangle aPreviewRect;
+ GalleryTheme* mpTheme;
+
+ SVX_DLLPRIVATE sal_Bool ImplGetGraphicCenterRect( const Graphic& rGraphic, Rectangle& rResultRect ) const;
+ SVX_DLLPRIVATE void InitSettings();
+
+ // Window
+ SVX_DLLPRIVATE virtual void Paint(const Rectangle& rRect);
+ SVX_DLLPRIVATE virtual void MouseButtonDown(const MouseEvent& rMEvt);
+ SVX_DLLPRIVATE virtual void Command(const CommandEvent& rCEvt);
+ SVX_DLLPRIVATE virtual void KeyInput( const KeyEvent& rKEvt );
+ SVX_DLLPRIVATE virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+
+ // DropTargetHelper
+ SVX_DLLPRIVATE virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ SVX_DLLPRIVATE virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+
+ // DragSourceHelper
+ SVX_DLLPRIVATE virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+
+ DECL_LINK( MenuSelectHdl, Menu* );
+
+public:
+
+ GalleryPreview( GalleryBrowser2* pParent, GalleryTheme* pTheme );
+ GalleryPreview( Window* pParent, const ResId& rResId );
+ ~GalleryPreview();
+
+ void SetGraphic( const Graphic& rGraphic ) { aGraphicObj.SetGraphic( rGraphic ); }
+ bool SetGraphic( const INetURLObject& );
+ void PreviewMedia( const INetURLObject& rURL );
+};
+
+// -------------------
+// - GalleryIconView -
+// -------------------
+
+class GalleryIconView : public ValueSet, public DropTargetHelper, public DragSourceHelper
+{
+ using ValueSet::StartDrag;
+
+private:
+
+ GalleryTheme* mpTheme;
+
+ void InitSettings();
+
+ // ValueSet
+ virtual void UserDraw( const UserDrawEvent& rUDEvt );
+
+ // Window
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ // DropTargetHelper
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+
+ // DragSourceHelper
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+
+public:
+
+ GalleryIconView( GalleryBrowser2* pParent, GalleryTheme* pTheme );
+ ~GalleryIconView();
+};
+
+// -------------------
+// - GalleryListView -
+// -------------------
+
+class GalleryListView : public BrowseBox
+{
+ using BrowseBox::AcceptDrop;
+ using BrowseBox::ExecuteDrop;
+
+private:
+
+ Link maSelectHdl;
+ GalleryTheme* mpTheme;
+ sal_uIntPtr mnCurRow;
+ sal_Bool mbInit;
+
+ void InitSettings();
+
+ // BrowseBox
+ virtual sal_Bool SeekRow( long nRow );
+ virtual void PaintField( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId ) const;
+ virtual void DoubleClick( const BrowserMouseEvent& rEvt );
+ virtual void Select();
+ virtual sal_Int8 AcceptDrop( const BrowserAcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const BrowserExecuteDropEvent& rEvt );
+ virtual void KeyInput( const KeyEvent& rKEvt );
+
+ // Window
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ // DragSourceHelper
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+
+public:
+
+ GalleryListView( GalleryBrowser2* pParent, GalleryTheme* pTheme );
+ ~GalleryListView();
+
+ void SetSelectHdl( const Link& rSelectHdl ) { maSelectHdl = rSelectHdl; }
+
+ /** GetCellText returns the text at the given position
+ @param _nRow
+ the number of the row
+ @param _nColId
+ the ID of the column
+ @return
+ the text out of the cell
+ */
+ virtual String GetCellText(long _nRow, sal_uInt16 _nColId) const;
+
+ // from IAccessibleTableProvider
+ virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex);
+ virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint);
+};
+
+#endif // _SVX_GALCTRL_HXX_
diff --git a/svx/inc/svx/gallery.hxx b/svx/inc/svx/gallery.hxx
new file mode 100644
index 000000000000..d87d93f8cc22
--- /dev/null
+++ b/svx/inc/svx/gallery.hxx
@@ -0,0 +1,174 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _GALLERY_HXX_
+#define _GALLERY_HXX_
+
+#include <tools/solar.h>
+#include <tools/string.hxx>
+#include <tools/urlobj.hxx>
+#include <vector>
+#include "svx/svxdllapi.h"
+
+// -----------
+// - Defines -
+// -----------
+
+#define SGA_FORMAT_NONE 0x00000000L
+#define SGA_FORMAT_STRING 0x00000001L
+#define SGA_FORMAT_GRAPHIC 0x00000010L
+#define SGA_FORMAT_SOUND 0x00000100L
+#define SGA_FORMAT_OLE 0x00001000L
+#define SGA_FORMAT_SVDRAW 0x00010000L
+#define SGA_FORMAT_ALL 0xFFFFFFFFL
+
+#define SVX_GALLERY() (GalleryExplorer::GetGallery())
+
+// Defines for preinstalled themes
+#define GALLERY_THEME_3D 1
+#define GALLERY_THEME_ANIMATIONS 2
+#define GALLERY_THEME_BULLETS 3
+#define GALLERY_THEME_OFFICE 4
+#define GALLERY_THEME_FLAGS 5
+#define GALLERY_THEME_FLOWCHARTS 6
+#define GALLERY_THEME_EMOTICONS 7
+#define GALLERY_THEME_PHOTOS 8
+#define GALLERY_THEME_BACKGROUNDS 9
+#define GALLERY_THEME_HOMEPAGE 10
+#define GALLERY_THEME_INTERACTION 11
+#define GALLERY_THEME_MAPS 12
+#define GALLERY_THEME_PEOPLE 13
+#define GALLERY_THEME_SURFACES 14
+#define GALLERY_THEME_HTMLBUTTONS 15
+#define GALLERY_THEME_POWERPOINT 16
+#define GALLERY_THEME_RULERS 17
+#define GALLERY_THEME_SOUNDS 18
+#define GALLERY_THEME_SYMBOLS 19
+#define GALLERY_THEME_MYTHEME 20
+#define GALLERY_THEME_USERSOUNDS 21
+#define GALLERY_THEME_ARROWS 22
+#define GALLERY_THEME_BALLOONS 23
+#define GALLERY_THEME_KEYBOARD 24
+#define GALLERY_THEME_TIME 25
+#define GALLERY_THEME_PRESENTATION 26
+#define GALLERY_THEME_CALENDAR 27
+#define GALLERY_THEME_NAVIGATION 28
+#define GALLERY_THEME_COMMUNICATION 29
+#define GALLERY_THEME_FINANCES 30
+#define GALLERY_THEME_COMPUTER 31
+#define GALLERY_THEME_CLIMA 32
+#define GALLERY_THEME_EDUCATION 33
+#define GALLERY_THEME_TROUBLE 34
+#define GALLERY_THEME_SCREENBEANS 35
+#define GALLERY_THEME_FONTWORK 36
+#define GALLERY_THEME_FONTWORK_VERTICAL 37
+
+#define GALLERY_THEME_DUMMY5 38
+
+// -------------------
+// - GalleryExplorer -
+// -------------------
+
+class List;
+class Gallery;
+class VCDrawModel;
+class FmFormModel;
+class SdrModel;
+class Graphic;
+class FmFormModel;
+class Bitmap;
+class OutputDevice;
+
+class SVX_DLLPUBLIC GalleryExplorer
+{
+private:
+
+ SVX_DLLPRIVATE static Gallery* ImplGetGallery();
+
+public:
+
+ static GalleryExplorer* GetGallery();
+
+public:
+
+ INetURLObject GetURL() const;
+ String GetFilterName() const;
+ Graphic GetGraphic() const;
+ sal_Bool GetVCDrawModel( FmFormModel& rModel ) const;
+ sal_Bool IsLinkage() const;
+
+ static sal_Bool FillThemeList( List& rThemeList );
+
+ // FillObjList is filling rObjList with Strings of the internal Gallery Object URL
+ static sal_Bool FillObjList( const String& rThemeName, List& rObjList );
+ static sal_Bool FillObjList( sal_uIntPtr nThemeId, List& rObjList );
+
+ // FillObjTitleList is filling the rList with the title for each gallery object
+ static sal_Bool FillObjListTitle( const sal_uInt32 nThemeId, std::vector< rtl::OUString >& rList );
+
+ static sal_Bool InsertURL( const String& rThemeName, const String& rURL );
+ static sal_Bool InsertURL( sal_uIntPtr nThemeId, const String& rURL );
+
+ static sal_Bool InsertURL( const String& rThemeName, const String& rURL,
+ const sal_uIntPtr nSgaFormat /* = SGA_FORMAT_ALL */ );
+ static sal_Bool InsertURL( sal_uIntPtr nThemeId, const String& rURL,
+ const sal_uIntPtr nSgaFormat /* = SGA_FORMAT_ALL */ );
+
+ static sal_uIntPtr GetObjCount( const String& rThemeName );
+ static sal_uIntPtr GetObjCount( sal_uIntPtr nThemeId );
+
+ static sal_Bool GetGraphicObj( const String& rThemeName, sal_uIntPtr nPos,
+ Graphic* pGraphic = NULL, Bitmap* pThumb = NULL,
+ sal_Bool bProgess = sal_False );
+ static sal_Bool GetGraphicObj( sal_uIntPtr nThemeId, sal_uIntPtr nPos,
+ Graphic* pGraphic = NULL, Bitmap* pThumb = NULL,
+ sal_Bool bProgess = sal_False );
+
+ static sal_Bool InsertGraphicObj( const String& rThemeName, const Graphic& rGraphic );
+ static sal_Bool InsertGraphicObj( sal_uIntPtr nThemeId, const Graphic& rGraphic );
+
+ static sal_uIntPtr GetSdrObjCount( const String& rThemeName );
+ static sal_uIntPtr GetSdrObjCount( sal_uIntPtr nThemeId );
+
+ static sal_Bool GetSdrObj( const String& rThemeName, sal_uIntPtr nSdrModelPos,
+ SdrModel* pModel = NULL, Bitmap* pThumb = NULL );
+ static sal_Bool GetSdrObj( sal_uIntPtr nThemeId, sal_uIntPtr nSdrModelPos,
+ SdrModel* pModel = NULL, Bitmap* pThumb = NULL );
+
+ static sal_Bool InsertSdrObj( const String& rThemeName, FmFormModel& rModel );
+ static sal_Bool InsertSdrObj( sal_uIntPtr nThemeId, FmFormModel& rModel );
+
+ static sal_Bool BeginLocking( const String& rThemeName );
+ static sal_Bool BeginLocking( sal_uIntPtr nThemeId );
+
+ static sal_Bool EndLocking( const String& rThemeName );
+ static sal_Bool EndLocking( sal_uIntPtr nThemeId );
+
+ static sal_Bool DrawCentered( OutputDevice* pOut, const FmFormModel& rModel );
+};
+
+#endif // _GALLERY_HXX_
diff --git a/svx/inc/svx/gallery1.hxx b/svx/inc/svx/gallery1.hxx
new file mode 100644
index 000000000000..40888a095536
--- /dev/null
+++ b/svx/inc/svx/gallery1.hxx
@@ -0,0 +1,183 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_GALLERY1_HXX_
+#define _SVX_GALLERY1_HXX_
+
+#include <tools/string.hxx>
+#include <tools/list.hxx>
+#include <tools/urlobj.hxx>
+#include <svl/brdcst.hxx>
+#include "svx/svxdllapi.h"
+//#include "gallery.hrc"
+
+#include <cstdio>
+#include <list>
+
+// ---------------------
+// - GalleryThemeEntry -
+// ---------------------
+
+class SvStream;
+
+class GalleryThemeEntry
+{
+private:
+
+ String aName;
+ INetURLObject aThmURL;
+ INetURLObject aSdgURL;
+ INetURLObject aSdvURL;
+ sal_uInt32 nFileNumber;
+ sal_uInt32 nId;
+ sal_Bool bReadOnly;
+ sal_Bool bImported;
+ sal_Bool bModified;
+ sal_Bool bThemeNameFromResource;
+
+ GalleryThemeEntry();
+ INetURLObject ImplGetURLIgnoreCase( const INetURLObject& rURL ) const;
+
+public:
+
+ GalleryThemeEntry( const INetURLObject& rBaseURL, const String& rName,
+ sal_uInt32 nFileNumber, sal_Bool bReadOnly, sal_Bool bImported,
+ sal_Bool bNewFile, sal_uInt32 nId, sal_Bool bThemeNameFromResource );
+ ~GalleryThemeEntry() {};
+
+ const String& GetThemeName() const { return aName; }
+ sal_uInt32 GetFileNumber() const { return nFileNumber; }
+
+ const INetURLObject& GetThmURL() const { return aThmURL; }
+ const INetURLObject& GetSdgURL() const { return aSdgURL; }
+ const INetURLObject& GetSdvURL() const { return aSdvURL; }
+
+ sal_Bool IsImported() const { return bImported; }
+ sal_Bool IsReadOnly() const { return bReadOnly; }
+ sal_Bool IsDefault() const;
+
+ sal_Bool IsHidden() const { return aName.SearchAscii( "private://gallery/hidden/" ) == 0; }
+
+ sal_Bool IsModified() const { return bModified; }
+ void SetModified( sal_Bool bSet ) { bModified = ( bSet && !IsImported() && !IsReadOnly() ); }
+
+ void SetName( const String& rNewName );
+ sal_Bool IsNameFromResource() const { return bThemeNameFromResource; }
+
+ sal_uInt32 GetId() const { return nId; }
+ void SetId( sal_uInt32 nNewId, sal_Bool bResetThemeName );
+};
+
+DECLARE_LIST( GalleryThemeList, GalleryThemeEntry* )
+
+// ---------------------------
+// - GalleryImportThemeEntry -
+// ---------------------------
+
+struct GalleryImportThemeEntry
+{
+ String aThemeName;
+ String aUIName;
+ INetURLObject aURL;
+ String aImportName;
+};
+DECLARE_LIST( GalleryImportThemeList, GalleryImportThemeEntry* )
+
+// -----------------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOut, const GalleryImportThemeEntry& rEntry );
+SvStream& operator>>( SvStream& rIn, GalleryImportThemeEntry& rEntry );
+
+// -----------
+// - Gallery -
+// -----------
+
+class SfxListener;
+class GalleryTheme;
+
+class Gallery : public SfxBroadcaster
+{
+ // only for gengal utility!
+ friend Gallery* createGallery( const rtl::OUString& );
+ friend void disposeGallery( Gallery* );
+
+private:
+
+ GalleryThemeList aThemeList;
+ GalleryImportThemeList aImportList;
+ List aThemeCache;
+ INetURLObject aRelURL;
+ INetURLObject aUserURL;
+ rtl_TextEncoding nReadTextEncoding;
+ sal_uIntPtr nLastFileNumber;
+ sal_Bool bMultiPath;
+
+ void ImplLoad( const String& rMultiPath );
+ void ImplLoadSubDirs( const INetURLObject& rBaseURL, sal_Bool& rbIsReadOnly );
+ void ImplLoadImports();
+ void ImplWriteImportList();
+
+ SVX_DLLPUBLIC GalleryThemeEntry* ImplGetThemeEntry( const String& rThemeName );
+ GalleryThemeEntry* ImplGetThemeEntry( sal_uIntPtr nThemeId );
+ GalleryImportThemeEntry* ImplGetImportThemeEntry( const String& rImportName );
+
+ GalleryTheme* ImplGetCachedTheme( const GalleryThemeEntry* pThemeEntry );
+ void ImplDeleteCachedTheme( GalleryTheme* pTheme );
+
+ SVX_DLLPUBLIC Gallery( const String& rMultiPath );
+ SVX_DLLPUBLIC ~Gallery();
+
+public:
+
+ SVX_DLLPUBLIC static Gallery* GetGalleryInstance();
+
+ sal_uIntPtr GetThemeCount() const { return aThemeList.Count(); }
+ const GalleryThemeEntry* GetThemeInfo( sal_uIntPtr nPos ) { return aThemeList.GetObject( nPos ); }
+ const GalleryThemeEntry* GetThemeInfo( const String& rThemeName ) { return ImplGetThemeEntry( rThemeName ); }
+
+ SVX_DLLPUBLIC sal_Bool HasTheme( const String& rThemeName );
+ String GetThemeName( sal_uIntPtr nThemeId ) const;
+
+ SVX_DLLPUBLIC sal_Bool CreateTheme( const String& rThemeName, sal_uInt32 nNumFrom = 0 );
+ sal_Bool CreateImportTheme( const INetURLObject& rURL, const String& rFileName );
+ sal_Bool RenameTheme( const String& rOldName, const String& rNewName );
+ SVX_DLLPUBLIC sal_Bool RemoveTheme( const String& rThemeName );
+
+ SVX_DLLPUBLIC GalleryTheme* AcquireTheme( const String& rThemeName, SfxListener& rListener );
+ SVX_DLLPUBLIC void ReleaseTheme( GalleryTheme* pTheme, SfxListener& rListener );
+
+public:
+
+ INetURLObject GetImportURL( const String& rThemeName );
+
+ const INetURLObject& GetUserURL() const { return aUserURL; }
+ const INetURLObject& GetRelativeURL() const { return aRelURL; }
+
+ sal_Bool IsMultiPath() const { return bMultiPath; }
+};
+
+#endif // _SVX_GALLERY1_HXX_
diff --git a/svx/inc/svx/galmisc.hxx b/svx/inc/svx/galmisc.hxx
new file mode 100644
index 000000000000..f807ca6908de
--- /dev/null
+++ b/svx/inc/svx/galmisc.hxx
@@ -0,0 +1,262 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_GALMISC_HXX_
+#define _SVX_GALMISC_HXX_
+
+#include <sot/storage.hxx>
+#include <tools/urlobj.hxx>
+#include <svtools/imap.hxx>
+#include <svl/hint.hxx>
+#include <svtools/transfer.hxx>
+#include <svx/svdobj.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/awt/XProgressMonitor.hpp>
+#include "svx/svxdllapi.h"
+#include <tools/date.hxx>
+#include <tools/time.hxx>
+
+// ------------
+// - Forwards -
+// ------------
+
+class GalleryTheme;
+
+// ----------------
+// - ExchangeData -
+// ----------------
+
+struct ExchangeData
+{
+ GalleryTheme* pTheme;
+ String aEditedTitle;
+ Date aThemeChangeDate;
+ Time aThemeChangeTime;
+};
+
+enum SgaObjKind
+{
+ SGA_OBJ_NONE = 0, // Abstraktes Objekt
+ SGA_OBJ_BMP = 1, // Bitmap-Objekt
+ SGA_OBJ_SOUND = 2, // Sound-Objekt
+ SGA_OBJ_VIDEO = 3, // Video-Objekt
+ SGA_OBJ_ANIM = 4, // Animations-Objekt
+ SGA_OBJ_SVDRAW = 5, // Svdraw-Objekt
+ SGA_OBJ_INET = 6 // Grafik aus dem Internet
+};
+
+// -----------
+// - Defines -
+// -----------
+
+#define IV_IMAPINFO (sal_uInt32('S')*0x00000001+sal_uInt32('D')*0x00000100+sal_uInt32('U')*0x00010000+sal_uInt32('D')*0x01000000)
+#define ID_IMAPINFO 2
+
+#define USERDATA_HDL() (LINK(this,SgaUserDataFactory,MakeUserData))
+
+#define GAL_RESID( nId ) ResId( nId, *GetGalleryResMgr() )
+#define STREAMBUF_SIZE 16384L
+
+#define SGA_IMPORT_NONE 0x0000
+#define SGA_IMPORT_FILE 0x0001
+#define SGA_IMPORT_INET 0x0002
+
+#define GALLERY_PROGRESS_RANGE 10000
+
+#define GALLERY_FG_COLOR Application::GetSettings().GetStyleSettings().GetWindowTextColor()
+#define GALLERY_BG_COLOR Application::GetSettings().GetStyleSettings().GetWindowColor()
+#define GALLERY_DLG_COLOR Application::GetSettings().GetStyleSettings().GetDialogColor()
+
+// -------------
+// - Functions -
+// -------------
+
+class ResMgr;
+class String;
+class SvStream;
+class Graphic;
+class FmFormModel;
+class ImageMap;
+class Gallery;
+
+SVX_DLLPUBLIC ResMgr* GetGalleryResMgr();
+sal_uInt16 GalleryGraphicImport( const INetURLObject& rURL, Graphic& rGraphic, String& rFilterName, sal_Bool bShowProgress = sal_False );
+sal_Bool GallerySvDrawImport( SvStream& rIStm, SdrModel& rModel );
+sal_Bool CreateIMapGraphic( const FmFormModel& rModel, Graphic& rGraphic, ImageMap& rImageMap );
+SVX_DLLPUBLIC String GetReducedString( const INetURLObject& rURL, sal_uIntPtr nMaxLen );
+String GetSvDrawStreamNameFromURL( const INetURLObject& rSvDrawObjURL );
+
+sal_Bool FileExists( const INetURLObject& rURL );
+sal_Bool CreateDir( const INetURLObject& rURL );
+sal_Bool CopyFile( const INetURLObject& rSrcURL, const INetURLObject& rDstURL );
+sal_Bool KillFile( const INetURLObject& rURL );
+BitmapEx GalleryResGetBitmapEx( sal_uInt32 nId );
+
+
+// ---------------
+// - SgaIMapInfo -
+// ---------------
+
+class SgaIMapInfo : public SdrObjUserData, public SfxListener
+{
+ ImageMap aImageMap;
+
+public:
+ SgaIMapInfo() : SdrObjUserData( IV_IMAPINFO, ID_IMAPINFO, 0 ) {};
+
+ SgaIMapInfo( const ImageMap& rImageMap) :
+ SdrObjUserData( IV_IMAPINFO, ID_IMAPINFO, 0 ),
+ aImageMap( rImageMap ) {};
+
+ virtual ~SgaIMapInfo() {};
+
+ virtual SdrObjUserData* Clone( SdrObject* ) const
+ {
+ SgaIMapInfo* pInfo = new SgaIMapInfo;
+ pInfo->aImageMap = aImageMap;
+ return pInfo;
+ }
+
+ const ImageMap& GetImageMap() const { return aImageMap; }
+};
+
+// ----------------------
+// - SgaUserDataFactory -
+// ----------------------
+
+class SgaUserDataFactory
+{
+public:
+ SgaUserDataFactory() { SdrObjFactory::InsertMakeUserDataHdl( USERDATA_HDL() ); }
+ ~SgaUserDataFactory() { SdrObjFactory::RemoveMakeUserDataHdl( USERDATA_HDL() ); }
+
+ DECL_LINK( MakeUserData, SdrObjFactory* );
+};
+
+// -------------------
+// - GalleryProgress -
+// -------------------
+
+class GraphicFilter;
+
+class SVX_DLLPUBLIC GalleryProgress
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XProgressBar > mxProgressBar;
+ GraphicFilter* mpFilter;
+
+ public:
+
+ GalleryProgress( GraphicFilter* pFilter = NULL );
+ ~GalleryProgress();
+
+ void Update( sal_uIntPtr nVal, sal_uIntPtr nMaxVal );
+};
+
+// -----------------------
+// - GalleryTransferable -
+// -----------------------
+
+class Gallery;
+class GalleryTheme;
+class GraphicObject;
+
+class GalleryTransferable : public TransferableHelper
+{
+friend class GalleryTheme;
+using TransferableHelper::CopyToClipboard;
+
+private:
+
+ GalleryTheme* mpTheme;
+ SgaObjKind meObjectKind;
+ sal_uInt32 mnObjectPos;
+ SotStorageStreamRef mxModelStream;
+ GraphicObject* mpGraphicObject;
+ ImageMap* mpImageMap;
+ INetURLObject* mpURL;
+
+protected:
+
+ GalleryTransferable( GalleryTheme* pTheme, sal_uIntPtr nObjectPos, bool bLazy );
+ ~GalleryTransferable();
+
+ void InitData( bool bLazy );
+
+ // TransferableHelper
+ virtual void AddSupportedFormats();
+ virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ virtual sal_Bool WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ virtual void DragFinished( sal_Int8 nDropAction );
+ virtual void ObjectReleased();
+
+ void CopyToClipboard( Window* pWindow );
+ void StartDrag( Window* pWindow, sal_Int8 nDragSourceActions,
+ sal_Int32 nDragPointer = DND_POINTER_NONE,
+ sal_Int32 nDragImage = DND_IMAGE_NONE );
+};
+
+// ---------------
+// - GalleryHint -
+// ---------------
+
+#define GALLERY_HINT_NONE 0x00000000
+#define GALLERY_HINT_CLOSE_THEME 0x00000001
+#define GALLERY_HINT_THEME_REMOVED 0x00000002
+#define GALLERY_HINT_THEME_RENAMED 0x00000004
+#define GALLERY_HINT_THEME_CREATED 0x00000008
+#define GALLERY_HINT_THEME_UPDATEVIEW 0x00000010
+#define GALLERY_HINT_CLOSE_OBJECT 0x00000020
+#define GALLERY_HINT_OBJECT_REMOVED 0x00000040
+
+// -----------------------------------------------------------------------------
+
+class GalleryHint : public SfxHint
+{
+private:
+
+ sal_uIntPtr mnType;
+ String maThemeName;
+ String maStringData;
+ sal_uIntPtr mnData1;
+ sal_uIntPtr mnData2;
+
+public:
+
+ GalleryHint( sal_uIntPtr nType, const String& rThemeName, sal_uIntPtr nData1 = 0UL, sal_uIntPtr nData2 = 0UL ) :
+ mnType( nType ), maThemeName( rThemeName ), mnData1( nData1 ), mnData2( nData2 ) {}
+
+ GalleryHint( sal_uIntPtr nType, const String& rThemeName, const String& rStringData, sal_uIntPtr nData1 = 0UL, sal_uIntPtr nData2 = 0UL ) :
+ mnType( nType ), maThemeName( rThemeName ), maStringData( rStringData ), mnData1( nData1 ), mnData2( nData2 ) {}
+
+ sal_uIntPtr GetType() const { return mnType; }
+ const String& GetThemeName() const { return maThemeName; }
+ const String& GetStringData() const { return maStringData; }
+ sal_uIntPtr GetData1() const { return mnData1; }
+ sal_uIntPtr GetData2() const { return mnData2; }
+};
+
+ #endif
diff --git a/svx/inc/svx/galtheme.hxx b/svx/inc/svx/galtheme.hxx
new file mode 100644
index 000000000000..566372ddb41b
--- /dev/null
+++ b/svx/inc/svx/galtheme.hxx
@@ -0,0 +1,231 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_GALTHEME_HXX_
+#define _SVX_GALTHEME_HXX_
+
+#include "svx/svxdllapi.h"
+
+#define ENABLE_BYTESTRING_STREAM_OPERATORS
+
+#include <tools/debug.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/salctype.hxx>
+#include <svl/brdcst.hxx>
+#include <svl/lstner.hxx>
+#include <svtools/transfer.hxx>
+#include <sot/storage.hxx>
+#include <svx/svdmodel.hxx>
+//#include <svx/galobj.hxx>
+#include <svx/galmisc.hxx>
+//#include <svx/gallery1.hxx>
+
+// -----------------
+// - GalleryObject -
+// -----------------
+// --------------
+// - SgaObjKind -
+// --------------
+
+struct GalleryObject
+{
+ INetURLObject aURL;
+ sal_uInt32 nOffset;
+ SgaObjKind eObjKind;
+ sal_Bool bDummy;
+};
+
+DECLARE_LIST( GalleryObjectList, GalleryObject* )
+
+class GalleryThemeEntry;
+class SgaObject;
+class FmFormModel;
+class ListBox;
+
+// -----------------
+// - GalDragParams -
+// -----------------
+
+struct GalDragParams
+{
+ Region aDragRegion;
+ sal_uIntPtr nDragObjPos;
+ String aThemeName;
+ String aFileName;
+ SgaObjKind eObjKind;
+};
+
+// ----------------
+// - GalleryTheme -
+// ----------------
+
+class Gallery;
+class GalleryProgress;
+namespace unogallery
+{
+ class GalleryTheme;
+ class GalleryItem;
+}
+
+class GalleryTheme : public SfxBroadcaster
+{
+ friend class Gallery;
+ friend class GalleryThemeCacheEntry;
+ friend class ::unogallery::GalleryTheme;
+ friend class ::unogallery::GalleryItem;
+
+private:
+
+ GalleryObjectList aObjectList;
+ String aImportName;
+ String m_aDestDir;
+ SotStorageRef aSvDrawStorageRef;
+ Gallery* pParent;
+ GalleryThemeEntry* pThm;
+ sal_uIntPtr mnThemeLockCount;
+ sal_uIntPtr mnBroadcasterLockCount;
+ sal_uIntPtr nDragPos;
+ sal_Bool bDragging;
+ sal_Bool bAbortActualize;
+
+ void ImplCreateSvDrawStorage();
+ SVX_DLLPUBLIC SgaObject* ImplReadSgaObject( GalleryObject* pEntry );
+ sal_Bool ImplWriteSgaObject( const SgaObject& rObj, sal_uIntPtr nPos, GalleryObject* pExistentEntry );
+ void ImplRead();
+ void ImplWrite();
+ const GalleryObject* ImplGetGalleryObject( sal_uIntPtr nPos ) const { return aObjectList.GetObject( nPos ); }
+ SVX_DLLPUBLIC const GalleryObject* ImplGetGalleryObject( const INetURLObject& rURL );
+ sal_uIntPtr ImplGetGalleryObjectPos( const GalleryObject* pObj ) const { return aObjectList.GetPos( pObj ); }
+ INetURLObject ImplGetURL( const GalleryObject* pObject ) const;
+ INetURLObject ImplCreateUniqueURL( SgaObjKind eObjKind, sal_uIntPtr nFormat = CVT_UNKNOWN );
+ void ImplSetModified( sal_Bool bModified );
+ void ImplBroadcast( sal_uIntPtr nUpdatePos );
+
+ GalleryTheme();
+ GalleryTheme( Gallery* pGallery, GalleryThemeEntry* pThemeEntry );
+ ~GalleryTheme();
+
+public:
+
+ static GalleryThemeEntry* CreateThemeEntry( const INetURLObject& rURL, sal_Bool bReadOnly );
+
+ sal_uIntPtr GetObjectCount() const { return aObjectList.Count(); }
+
+ SVX_DLLPUBLIC SgaObject* AcquireObject( sal_uIntPtr nPos );
+ SVX_DLLPUBLIC void ReleaseObject( SgaObject* pObj );
+
+ SVX_DLLPUBLIC sal_Bool InsertObject( const SgaObject& rObj, sal_uIntPtr nPos = LIST_APPEND );
+ SVX_DLLPUBLIC sal_Bool RemoveObject( sal_uIntPtr nPos );
+ sal_Bool ChangeObjectPos( sal_uIntPtr nOldPos, sal_uIntPtr nNewPos );
+
+ SVX_DLLPUBLIC const String& GetName() const;
+ const String& GetRealName() const;
+ const String& GetImportName() const { return aImportName; }
+ void SetImportName(const String& rImportName) { aImportName = rImportName; }
+
+ const String& GetDestDir() const { return m_aDestDir; }
+ void SetDestDir(const String& rDestDir) { m_aDestDir = rDestDir; }
+
+ const INetURLObject& GetThmURL() const;
+ SVX_DLLPUBLIC const INetURLObject& GetSdgURL() const;
+ const INetURLObject& GetSdvURL() const;
+
+ SVX_DLLPUBLIC sal_uInt32 GetId() const;
+ void SetId( sal_uInt32 nNewId, sal_Bool bResetThemeName );
+
+ void SetDragging( sal_Bool bSet ) { bDragging = bSet; }
+ sal_Bool IsDragging() const { return bDragging; }
+
+ void LockTheme() { ++mnThemeLockCount; }
+ sal_Bool UnlockTheme();
+
+ void LockBroadcaster() { mnBroadcasterLockCount++; }
+ SVX_DLLPUBLIC void UnlockBroadcaster( sal_uIntPtr nUpdatePos = 0 );
+ sal_Bool IsBroadcasterLocked() const { return mnBroadcasterLockCount > 0; }
+
+ void SetDragPos( sal_uIntPtr nPos ) { nDragPos = nPos; }
+ sal_uIntPtr GetDragPos() const { return nDragPos; }
+
+ sal_Bool IsThemeNameFromResource() const;
+
+ SVX_DLLPUBLIC sal_Bool IsImported() const;
+ SVX_DLLPUBLIC sal_Bool IsReadOnly() const;
+ SVX_DLLPUBLIC sal_Bool IsDefault() const;
+ sal_Bool IsModified() const;
+
+ SVX_DLLPUBLIC void Actualize( const Link& rActualizeLink, GalleryProgress* pProgress = NULL );
+ void AbortActualize() { bAbortActualize = sal_True; }
+
+ Gallery* GetParent() const { return pParent; }
+ SotStorageRef GetSvDrawStorage() const { return aSvDrawStorageRef; }
+
+public:
+
+ SgaObjKind GetObjectKind( sal_uIntPtr nPos ) const
+ {
+ DBG_ASSERT( nPos < GetObjectCount(), "Position out of range" );
+ return ImplGetGalleryObject( nPos )->eObjKind;
+ }
+
+
+ const INetURLObject& GetObjectURL( sal_uIntPtr nPos ) const
+ {
+ DBG_ASSERT( nPos < GetObjectCount(), "Position out of range" );
+ return ImplGetGalleryObject( nPos )->aURL;
+ }
+
+ sal_Bool GetThumb( sal_uIntPtr nPos, Bitmap& rBmp, sal_Bool bProgress = sal_False );
+
+ SVX_DLLPUBLIC sal_Bool GetGraphic( sal_uIntPtr nPos, Graphic& rGraphic, sal_Bool bProgress = sal_False );
+ SVX_DLLPUBLIC sal_Bool InsertGraphic( const Graphic& rGraphic, sal_uIntPtr nInsertPos = LIST_APPEND );
+
+ SVX_DLLPUBLIC sal_Bool GetModel( sal_uIntPtr nPos, SdrModel& rModel, sal_Bool bProgress = sal_False );
+ SVX_DLLPUBLIC sal_Bool InsertModel( const FmFormModel& rModel, sal_uIntPtr nInsertPos = LIST_APPEND );
+
+ sal_Bool GetModelStream( sal_uIntPtr nPos, SotStorageStreamRef& rModelStreamRef, sal_Bool bProgress = sal_False );
+ sal_Bool InsertModelStream( const SotStorageStreamRef& rModelStream, sal_uIntPtr nInsertPos = LIST_APPEND );
+
+ sal_Bool GetURL( sal_uIntPtr nPos, INetURLObject& rURL, sal_Bool bProgress = sal_False );
+ SVX_DLLPUBLIC sal_Bool InsertURL( const INetURLObject& rURL, sal_uIntPtr nInsertPos = LIST_APPEND );
+ sal_Bool InsertFileOrDirURL( const INetURLObject& rFileOrDirURL, sal_uIntPtr nInsertPos = LIST_APPEND );
+
+ sal_Bool InsertTransferable( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rxTransferable, sal_uIntPtr nInsertPos );
+
+ void CopyToClipboard( Window* pWindow, sal_uIntPtr nPos );
+ void StartDrag( Window* pWindow, sal_uIntPtr nPos );
+
+public:
+
+ SvStream& WriteData( SvStream& rOut ) const;
+ SvStream& ReadData( SvStream& rIn );
+ static SVX_DLLPUBLIC void InsertAllThemes( ListBox& rListBox );
+};
+
+SvStream& operator<<( SvStream& rOut, const GalleryTheme& rTheme );
+SvStream& operator>>( SvStream& rIn, GalleryTheme& rTheme );
+
+#endif
diff --git a/svx/inc/svx/globl3d.hxx b/svx/inc/svx/globl3d.hxx
new file mode 100644
index 000000000000..7445259d9989
--- /dev/null
+++ b/svx/inc/svx/globl3d.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _E3D_GLOBL3D_HXX
+#define _E3D_GLOBL3D_HXX
+
+#include <tools/solar.h>
+
+//#define ESODEBUG
+#define E3D_STREAMING
+
+const double PrecisionLimit = 1.0e-14;
+
+const sal_uInt32 E3dInventor = sal_uInt32('E')*0x00000001+
+ sal_uInt32('3')*0x00000100+
+ sal_uInt32('D')*0x00010000+
+ sal_uInt32('1')*0x01000000;
+
+const sal_uInt16 E3D_SCENE_ID = 1;
+const sal_uInt16 E3D_POLYSCENE_ID = 2;
+const sal_uInt16 E3D_OBJECT_ID = 3; // should not be used, it's only a helper class for E3DScene and E3DCompoundObject
+const sal_uInt16 E3D_CUBEOBJ_ID = 4;
+const sal_uInt16 E3D_SPHEREOBJ_ID = 5;
+const sal_uInt16 E3D_EXTRUDEOBJ_ID = 6;
+const sal_uInt16 E3D_LATHEOBJ_ID = 7;
+const sal_uInt16 E3D_COMPOUNDOBJ_ID = 8;
+const sal_uInt16 E3D_POLYGONOBJ_ID = 9;
+
+#endif // _E3D_GLOBL3D_HXX
diff --git a/svx/inc/svx/grafctrl.hxx b/svx/inc/svx/grafctrl.hxx
new file mode 100644
index 000000000000..bd63bae43cf4
--- /dev/null
+++ b/svx/inc/svx/grafctrl.hxx
@@ -0,0 +1,191 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_GRAFCTRL_HXX
+#define _SVX_GRAFCTRL_HXX
+
+#include <svl/lstner.hxx>
+#include <svl/intitem.hxx>
+#include <sfx2/tbxctrl.hxx>
+#include "svx/svxdllapi.h"
+
+// ----------------
+// - TbxImageItem -
+// ----------------
+
+class SVX_DLLPUBLIC TbxImageItem : public SfxUInt16Item
+{
+public:
+ TYPEINFO();
+ TbxImageItem( sal_uInt16 nWhich = 0, sal_uInt16 nImage = 0 );
+
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+};
+
+// -------------------------------
+// - SvxGrafFilterToolBoxControl -
+// -------------------------------
+
+class SVX_DLLPUBLIC SvxGrafFilterToolBoxControl : public SfxToolBoxControl
+{
+public:
+
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SvxGrafFilterToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxGrafFilterToolBoxControl();
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+ virtual SfxPopupWindowType GetPopupWindowType() const;
+ virtual SfxPopupWindow* CreatePopupWindow();
+};
+
+// -------------------------
+// - SvxGrafToolBoxControl -
+// -------------------------
+
+class SvxGrafToolBoxControl : public SfxToolBoxControl
+{
+public:
+
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxGrafToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxGrafToolBoxControl();
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+ virtual Window* CreateItemWindow( Window *pParent );
+};
+
+// ----------------------------
+// - SvxGrafRedToolBoxControl -
+// ----------------------------
+
+class SVX_DLLPUBLIC SvxGrafRedToolBoxControl : public SvxGrafToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxGrafRedToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+};
+
+// ------------------------------
+// - SvxGrafGreenToolBoxControl -
+// ------------------------------
+
+class SVX_DLLPUBLIC SvxGrafGreenToolBoxControl : public SvxGrafToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxGrafGreenToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+};
+
+// -----------------------------
+// - SvxGrafBlueToolBoxControl -
+// -----------------------------
+
+class SVX_DLLPUBLIC SvxGrafBlueToolBoxControl : public SvxGrafToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxGrafBlueToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+};
+
+// ----------------------------------
+// - SvxGrafLuminanceToolBoxControl -
+// ----------------------------------
+
+class SVX_DLLPUBLIC SvxGrafLuminanceToolBoxControl : public SvxGrafToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxGrafLuminanceToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+};
+
+// ---------------------------------
+// - SvxGrafContrastToolBoxControl -
+// ---------------------------------
+
+class SVX_DLLPUBLIC SvxGrafContrastToolBoxControl : public SvxGrafToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxGrafContrastToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+};
+
+// ------------------------------
+// - SvxGrafGammaToolBoxControl -
+// ------------------------------
+
+class SVX_DLLPUBLIC SvxGrafGammaToolBoxControl : public SvxGrafToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxGrafGammaToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+};
+
+// -------------------------------------
+// - SvxGrafTransparenceToolBoxControl -
+// -------------------------------------
+
+class SVX_DLLPUBLIC SvxGrafTransparenceToolBoxControl : public SvxGrafToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxGrafTransparenceToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+};
+
+// -----------------------------
+// - SvxGrafModeToolBoxControl -
+// -----------------------------
+
+class SVX_DLLPUBLIC SvxGrafModeToolBoxControl : public SfxToolBoxControl, public SfxListener
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxGrafModeToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxGrafModeToolBoxControl();
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+ virtual Window* CreateItemWindow( Window *pParent );
+};
+
+// ---------------------
+// - SvxGrafAttrHelper -
+// ---------------------
+
+class SdrView;
+class SfxRequest;
+
+class SVX_DLLPUBLIC SvxGrafAttrHelper
+{
+public:
+
+ static void ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView );
+ static void GetGrafAttrState( SfxItemSet& rSet, SdrView& rView );
+};
+
+#endif // _SVX_GRAFCTRL_HXX
diff --git a/svx/inc/svx/graphctl.hxx b/svx/inc/svx/graphctl.hxx
new file mode 100644
index 000000000000..a06cbbab8aa6
--- /dev/null
+++ b/svx/inc/svx/graphctl.hxx
@@ -0,0 +1,193 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _GRAPHCTL_HXX
+#define _GRAPHCTL_HXX
+
+// include ---------------------------------------------------------------
+
+#include <vcl/ctrl.hxx>
+#include <vcl/graph.hxx>
+#include "svx/svxdllapi.h"
+
+#include <svx/svdview.hxx>
+#include <svx/svdobj.hxx>
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+class GraphCtrlUserCall;
+class SvxGraphCtrlAccessibleContext;
+
+#define WB_SDRMODE ((WinBits)0x0080)
+#define WB_ANIMATION ((WinBits)0x0100)
+
+class SVX_DLLPUBLIC GraphCtrl : public Control
+{
+ friend class GraphCtrlView;
+ friend class GraphCtrlUserCall;
+
+ Graphic aGraphic;
+ Timer aUpdateTimer;
+ Link aMousePosLink;
+ Link aGraphSizeLink;
+ Link aMarkObjLink;
+ Link aUpdateLink;
+ MapMode aMap100;
+ Size aGraphSize;
+ Point aMousePos;
+ GraphCtrlUserCall* pUserCall;
+ WinBits nWinStyle;
+ SdrObjKind eObjKind;
+ sal_uInt16 nPolyEdit;
+ sal_Bool bEditMode;
+ sal_Bool bSdrMode;
+ sal_Bool bAnim;
+
+ DECL_LINK( UpdateHdl, Timer* );
+
+ SvxGraphCtrlAccessibleContext* mpAccContext;
+
+protected:
+
+ SdrModel* pModel;
+ SdrView* pView;
+
+ virtual void Paint( const Rectangle& rRect );
+ virtual void Resize();
+ virtual void KeyInput(const KeyEvent& rKEvt);
+ virtual void MouseButtonDown(const MouseEvent& rMEvt);
+ virtual void MouseButtonUp(const MouseEvent& rMEvt);
+ virtual void MouseMove(const MouseEvent& rMEvt);
+
+ virtual void InitSdrModel();
+
+ virtual void SdrObjCreated( const SdrObject& rObj );
+ virtual void SdrObjChanged( const SdrObject& rObj );
+ virtual void MarkListHasChanged();
+
+ SdrObjUserCall* GetSdrUserCall() { return (SdrObjUserCall*) pUserCall; }
+
+public:
+
+ GraphCtrl( Window* pParent, const WinBits nWinBits = 0 );
+ GraphCtrl( Window* pParent, const ResId& rResId );
+ ~GraphCtrl();
+
+ void SetWinStyle( WinBits nWinBits );
+ WinBits GetWinStyle() const { return nWinStyle; }
+
+ void SetGraphic( const Graphic& rGraphic, sal_Bool bNewModel = sal_True );
+ const Graphic& GetGraphic() const { return aGraphic; }
+ const Size& GetGraphicSize() const { return aGraphSize; }
+
+ const Point& GetMousePos() const { return aMousePos; }
+
+ void SetEditMode( const sal_Bool bEditMode );
+ sal_Bool IsEditMode() const { return bEditMode; }
+
+ void SetPolyEditMode( const sal_uInt16 nPolyEdit );
+ sal_uInt16 GetPolyEditMode() const { return nPolyEdit; }
+
+ void SetObjKind( const SdrObjKind eObjKind );
+ SdrObjKind GetObjKind() const { return eObjKind; }
+
+ SdrModel* GetSdrModel() const { return pModel; }
+ SdrView* GetSdrView() const { return pView; }
+ SdrObject* GetSelectedSdrObject() const;
+ sal_Bool IsChanged() const { return bSdrMode ? pModel->IsChanged() : sal_False; }
+
+ void SetMousePosLink( const Link& rLink ) { aMousePosLink = rLink; }
+ const Link& GetMousePosLink() const { return aMousePosLink; }
+
+ void SetGraphSizeLink( const Link& rLink ) { aGraphSizeLink = rLink; }
+ const Link& GetGraphSizeLink() const { return aGraphSizeLink; }
+
+ void SetMarkObjLink( const Link& rLink ) { aMarkObjLink = rLink; }
+ const Link& GetMarkObjLink() const { return aMarkObjLink; }
+
+ void SetUpdateLink( const Link& rLink ) { aUpdateLink = rLink; }
+ const Link& GetUpdateLink() const { return aUpdateLink; }
+
+ static String GetStringFromDouble( const double& rDouble );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+};
+
+//#if 0 // _SOLAR__PRIVATE
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+class GraphCtrlUserCall : public SdrObjUserCall
+{
+ GraphCtrl& rWin;
+
+public:
+
+ GraphCtrlUserCall( GraphCtrl& rGraphWin ) : rWin( rGraphWin ) {};
+ virtual ~GraphCtrlUserCall() {};
+
+ virtual void Changed( const SdrObject& rObj, SdrUserCallType eType, const Rectangle& rOldBoundRect );
+};
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+class GraphCtrlView : public SdrView
+{
+ GraphCtrl& rGraphCtrl;
+
+protected:
+
+ virtual void MarkListHasChanged()
+ {
+ SdrView::MarkListHasChanged();
+ rGraphCtrl.MarkListHasChanged();
+ }
+
+public:
+
+ GraphCtrlView( SdrModel* pModel, GraphCtrl* pWindow) :
+ SdrView ( pModel, pWindow ),
+ rGraphCtrl ( *pWindow ) {};
+
+ virtual ~GraphCtrlView() {};
+};
+
+//#endif // __PRIVATE
+
+#endif // _GRAPHCTL_HXX
+
diff --git a/svx/inc/svx/grfcrop.hxx b/svx/inc/svx/grfcrop.hxx
new file mode 100644
index 000000000000..c382ca01e6eb
--- /dev/null
+++ b/svx/inc/svx/grfcrop.hxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_GRFCROP_HXX
+#define _SVX_GRFCROP_HXX
+
+#include <svl/poolitem.hxx>
+#include "svx/svxdllapi.h"
+
+
+#define GRFCROP_VERSION_SWDEFAULT 0
+#define GRFCROP_VERSION_MOVETOSVX 1
+
+class SVX_DLLPUBLIC SvxGrfCrop : public SfxPoolItem
+{
+ sal_Int32 nLeft, nRight, nTop, nBottom;
+public:
+ SvxGrfCrop( sal_uInt16 );
+ SvxGrfCrop( sal_Int32 nLeft, sal_Int32 nRight,
+ sal_Int32 nTop, sal_Int32 nBottom,
+ sal_uInt16 );
+ virtual ~SvxGrfCrop();
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16 nVer) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nIVer) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal,
+ sal_uInt8 nMemberId = 0 );
+
+ void SetLeft( sal_Int32 nVal ) { nLeft = nVal; }
+ void SetRight( sal_Int32 nVal ) { nRight = nVal; }
+ void SetTop( sal_Int32 nVal ) { nTop = nVal; }
+ void SetBottom( sal_Int32 nVal ) { nBottom = nVal; }
+
+ sal_Int32 GetLeft() const { return nLeft; }
+ sal_Int32 GetRight() const { return nRight; }
+ sal_Int32 GetTop() const { return nTop; }
+ sal_Int32 GetBottom() const { return nBottom; }
+
+ inline SvxGrfCrop& operator=( const SvxGrfCrop& rCrop )
+ {
+ nLeft = rCrop.GetLeft(); nTop = rCrop.GetTop();
+ nRight = rCrop.GetRight(); nBottom = rCrop.GetBottom();
+ return *this;
+ }
+};
+
+
+#endif // _GRFATR_HXX
diff --git a/svx/inc/svx/grfflt.hxx b/svx/inc/svx/grfflt.hxx
new file mode 100644
index 000000000000..584245a78cf2
--- /dev/null
+++ b/svx/inc/svx/grfflt.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_GRFFLT_HXX
+#define _SVX_GRFFLT_HXX
+
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/timer.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/group.hxx>
+#include <vcl/salbtype.hxx>
+#include <svtools/grfmgr.hxx>
+#include <svx/graphctl.hxx>
+#include <svx/dlgctrl.hxx>
+#include <svx/rectenum.hxx>
+#include "svx/svxdllapi.h"
+
+// ---------------
+// - Error codes -
+// ---------------
+
+#define SVX_GRAPHICFILTER_ERRCODE_NONE 0x00000000
+#define SVX_GRAPHICFILTER_UNSUPPORTED_GRAPHICTYPE 0x00000001
+#define SVX_GRAPHICFILTER_UNSUPPORTED_SLOT 0x00000002
+
+// --------------------
+// - SvxGraphicFilter -
+// --------------------
+
+class SfxRequest;
+class SfxItemSet;
+
+class SVX_DLLPUBLIC SvxGraphicFilter
+{
+public:
+
+ static sal_uLong ExecuteGrfFilterSlot( SfxRequest& rReq, GraphicObject& rFilterObject );
+ static void DisableGraphicFilterSlots( SfxItemSet& rSet );
+};
+
+#endif
diff --git a/svx/inc/svx/gridctrl.hxx b/svx/inc/svx/gridctrl.hxx
new file mode 100644
index 000000000000..4efb5d2c86ad
--- /dev/null
+++ b/svx/inc/svx/gridctrl.hxx
@@ -0,0 +1,623 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_GRIDCTRL_HXX
+#define _SVX_GRIDCTRL_HXX
+
+#include <tools/list.hxx>
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#include <com/sun/star/sdbc/XRowSetListener.hpp>
+#include <com/sun/star/sdb/XRowsChangeListener.hpp>
+#include <com/sun/star/beans/PropertyChangeEvent.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <tools/date.hxx>
+#include <tools/ref.hxx>
+#include <svtools/editbrowsebox.hxx>
+#include <vos/mutex.hxx>
+#include <comphelper/propmultiplex.hxx>
+#include <svtools/transfer.hxx>
+#include "svx/svxdllapi.h"
+
+class DbGridControl;
+class CursorWrapper;
+
+sal_Bool CompareBookmark(const ::com::sun::star::uno::Any& aLeft, const ::com::sun::star::uno::Any& aRight);
+
+namespace svxform
+{
+ class DataColumn;
+}
+DECLARE_LIST(DbDataColumns, ::svxform::DataColumn*)
+
+enum GridRowStatus
+{
+ GRS_CLEAN,
+ GRS_MODIFIED,
+ GRS_DELETED,
+ GRS_INVALID
+};
+
+//==================================================================
+// DbGridRow, Zeilenbeschreibung
+//==================================================================
+
+class DbGridRow : public SvRefBase
+{
+ ::com::sun::star::uno::Any m_aBookmark; // ::com::sun::star::text::Bookmark der Zeile, kann gesetzt sein
+ DbDataColumns m_aVariants;
+ GridRowStatus m_eStatus;
+ sal_Bool m_bIsNew;
+ // Zeile ist nicht mehr gueltig,
+ // wird bei der naechsten positionierung entfernt
+public:
+ DbGridRow():m_eStatus(GRS_CLEAN), m_bIsNew(sal_True) { }
+ DbGridRow(CursorWrapper* pCur, sal_Bool bPaintCursor);
+ void SetState(CursorWrapper* pCur, sal_Bool bPaintCursor);
+
+ ~DbGridRow();
+
+ // da GetField auf Geschwindigkeit getuned ist vorher immer noch hasField verwenden
+ sal_Bool HasField(sal_uInt32 nPos) const {return nPos < m_aVariants.Count();}
+ const ::svxform::DataColumn& GetField(sal_uInt32 nPos) const { return *m_aVariants.GetObject(nPos); }
+
+ void SetStatus(GridRowStatus _eStat) { m_eStatus = _eStat; }
+ GridRowStatus GetStatus() const { return m_eStatus; }
+ void SetNew(sal_Bool _bNew) { m_bIsNew = _bNew; }
+ sal_Bool IsNew() const { return m_bIsNew; }
+
+ const ::com::sun::star::uno::Any& GetBookmark() const { return m_aBookmark; }
+
+ sal_Bool IsValid() const { return m_eStatus == GRS_CLEAN || m_eStatus == GRS_MODIFIED; }
+ sal_Bool IsModified() const { return m_eStatus == GRS_MODIFIED; }
+};
+
+SV_DECL_REF(DbGridRow)
+
+//==================================================================
+// DbGridControl
+//==================================================================
+class DbGridColumn;
+DECLARE_LIST(DbGridColumns, DbGridColumn*)
+
+//==================================================================
+class FmGridListener
+{
+public:
+ virtual void selectionChanged() = 0;
+ virtual void columnChanged() = 0;
+};
+
+#define GRID_COLUMN_NOT_FOUND ((sal_uInt16)-1)
+
+//==================================================================
+// InitWindowFacet, describing which aspect of a column's Window to (re-)initialize
+//==================================================================
+enum InitWindowFacet
+{
+ InitFont = 0x01,
+ InitForeground = 0x02,
+ InitBackground = 0x04,
+ InitWritingMode = 0x08,
+ InitAll = 0xFF
+};
+
+//==================================================================
+class FmXGridSourcePropListener;
+class DisposeListenerGridBridge;
+typedef ::svt::EditBrowseBox DbGridControl_Base;
+class SVX_DLLPUBLIC DbGridControl : public DbGridControl_Base
+{
+ friend class FmXGridSourcePropListener;
+ friend class GridFieldValueListener;
+ friend class DisposeListenerGridBridge;
+
+public:
+ //==================================================================
+ // NavigationBar
+ //==================================================================
+ class NavigationBar: public Control
+ {
+ class AbsolutePos : public NumericField
+ {
+ public:
+ AbsolutePos(Window* pParent, WinBits nStyle = 0);
+
+ virtual void KeyInput(const KeyEvent& rEvt);
+ virtual void LoseFocus();
+ };
+
+ friend class NavigationBar::AbsolutePos;
+
+ // zusaetzliche Controls
+ FixedText m_aRecordText;
+ AbsolutePos m_aAbsolute; // AbsolutePositionierung
+ FixedText m_aRecordOf;
+ FixedText m_aRecordCount;
+
+ ImageButton m_aFirstBtn; // ImageButton fuer 'gehe zum ersten Datensatz'
+ ImageButton m_aPrevBtn; // ImageButton fuer 'gehe zum vorhergehenden Datensatz'
+ ImageButton m_aNextBtn; // ImageButton fuer 'gehe zum naechsten Datensatz'
+ ImageButton m_aLastBtn; // ImageButton fuer 'gehe zum letzten Datensatz'
+ ImageButton m_aNewBtn; // ImageButton fuer 'gehe zum neuen Datensatz'
+ sal_uInt16 m_nDefaultWidth;
+ sal_Int32 m_nCurrentPos;
+
+ sal_Bool m_bPositioning; // protect PositionDataSource against recursion
+
+ public:
+ // StatusIds fuer Controls der Bar
+ // wichtig fuers Invalidieren
+ enum State
+ {
+ RECORD_TEXT = 1,
+ RECORD_ABSOLUTE,
+ RECORD_OF,
+ RECORD_COUNT,
+ RECORD_FIRST,
+ RECORD_NEXT,
+ RECORD_PREV,
+ RECORD_LAST,
+ RECORD_NEW
+ };
+
+ NavigationBar(Window* pParent, WinBits nStyle = 0);
+
+ // Status Methoden fuer Controls
+ void InvalidateAll(sal_Int32 nCurrentPos = -1, sal_Bool bAll = sal_False);
+ void InvalidateState(sal_uInt16 nWhich) {SetState(nWhich);}
+ void SetState(sal_uInt16 nWhich);
+ sal_Bool GetState(sal_uInt16 nWhich) const;
+ sal_uInt16 GetDefaultWidth() const {return m_nDefaultWidth;}
+
+ protected:
+ virtual void Resize();
+ virtual void Paint(const Rectangle& rRect);
+ virtual void StateChanged( StateChangedType nType );
+
+ private:
+ DECL_LINK(OnClick, Button*);
+ sal_uInt16 ArrangeControls();
+
+ void PositionDataSource(sal_Int32 nRecord);
+ };
+
+ friend class DbGridControl::NavigationBar;
+
+public:
+ // diese Optionen werden verodert und geben an, welche der einzelnen feature
+ // freigegeben werden koennen, default ist readonly also 0
+ enum Option
+ {
+ OPT_READONLY = 0x00,
+ OPT_INSERT = 0x01,
+ OPT_UPDATE = 0x02,
+ OPT_DELETE = 0x04
+ };
+
+private:
+ Font m_aDefaultFont;
+ Link m_aMasterStateProvider;
+ Link m_aMasterSlotExecutor;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xFormatter;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory;
+
+ DbGridColumns m_aColumns; // Spaltenbeschreibung
+ NavigationBar m_aBar;
+ DbGridRowRef m_xDataRow; // Zeile die modifiziert werden kann
+ // kommt vom DatenCursor
+ DbGridRowRef m_xSeekRow, // Zeile die von Iterator gesetzt wird
+ // kommt vom DatenCursor
+
+ m_xEmptyRow; // Datensatz zum einfuegen
+
+ sal_uInt32 m_nAsynAdjustEvent;
+
+ // if we modify the row for the new record, we automatically insert a "new new row".
+ // But if somebody else inserts a new record into the data source, we have to do the same.
+ // For that reason we have to listen to some properties of our data source.
+ ::comphelper::OPropertyChangeMultiplexer* m_pDataSourcePropMultiplexer;
+ FmXGridSourcePropListener* m_pDataSourcePropListener;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowsChangeListener>
+ m_xRowSetListener; // get notification when rows were changed
+
+ void* m_pFieldListeners;
+ // property listeners for field values
+
+ DisposeListenerGridBridge* m_pCursorDisposeListener;
+ // need to know about the diposing of the seek cursor
+ // construct analogous to the data source proplistener/multiplexer above :
+ // DisposeListenerGridBridge is a bridge from FmXDisposeListener which I don't want to be derived from
+
+ FmGridListener* m_pGridListener;
+
+protected:
+ CursorWrapper* m_pDataCursor; // Cursor fuer Updates
+ CursorWrapper* m_pSeekCursor; // Cursor zum Seeken
+
+private:
+ // dieses sind Laufvariablen
+ DbGridRowRef m_xCurrentRow; // Row an der aktuellen Zeile
+ DbGridRowRef m_xPaintRow; // Row die gerade drgestellt werden soll
+ sal_Int32 m_nSeekPos; // Position des SeekCursors
+ sal_Int32 m_nTotalCount; // wird gesetzt, wenn der DatenCursor mit dem Zählen der
+ // Datensätze fertig ist
+ // initial Wert ist -1
+ osl::Mutex m_aDestructionSafety;
+ osl::Mutex m_aAdjustSafety;
+
+ com::sun::star::util::Date
+ m_aNullDate; // NullDate of the Numberformatter;
+
+ BrowserMode m_nMode;
+ sal_Int32 m_nCurrentPos; // Aktuelle Position;
+ sal_uInt32 m_nDeleteEvent; // EventId fuer asychrone Loeschen von Zeilen
+ sal_uInt16 m_nOptions; // Was kann das Control (Insert, Update, Delete)
+ // default readonly
+ sal_uInt16 m_nOptionMask; // the mask of options to be enabled in setDataSource
+ // (with respect to the data source capabilities)
+ // defaults to (insert | update | delete)
+ sal_uInt16 m_nLastColId;
+ long m_nLastRowId;
+
+ sal_Bool m_bDesignMode : 1; // default = sal_False
+ sal_Bool m_bRecordCountFinal : 1;
+ sal_Bool m_bMultiSelection : 1;
+ sal_Bool m_bNavigationBar : 1;
+
+ sal_Bool m_bSynchDisplay : 1;
+ sal_Bool m_bForceROController : 1;
+ sal_Bool m_bHandle : 1;
+ sal_Bool m_bFilterMode : 1;
+ sal_Bool m_bWantDestruction : 1;
+ sal_Bool m_bInAdjustDataSource : 1;
+ sal_Bool m_bPendingAdjustRows : 1; // if an async adjust is pending, is it for AdjustRows or AdjustDataSource ?
+ sal_Bool m_bHideScrollbars : 1;
+
+protected:
+ sal_Bool m_bUpdating : 1; // werden gerade updates durchgefuehrt
+
+protected:
+ virtual sal_Bool SeekRow(long nRow);
+ virtual void VisibleRowsChanged( long nNewTopRow, sal_uInt16 nNumRows);
+ virtual void PaintStatusCell(OutputDevice& rDev, const Rectangle& rRect) const;
+ virtual void PaintCell(OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColId) const;
+ virtual RowStatus GetRowStatus(long nRow) const;
+ virtual sal_Bool CursorMoving(long nNewRow, sal_uInt16 nNewCol);
+ virtual void CursorMoved();
+ virtual void ArrangeControls(sal_uInt16& nX, sal_uInt16 nY);
+ virtual sal_uInt32 GetTotalCellWidth(long nRow, sal_uInt16 nColId);
+ virtual void Command(const CommandEvent& rEvt);
+ virtual long PreNotify(NotifyEvent& rEvt);
+ virtual void KeyInput(const KeyEvent& rEvt);
+ virtual void StateChanged( StateChangedType nType );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ virtual void Select();
+
+ virtual ::svt::CellController* GetController(long nRow, sal_uInt16 nCol);
+
+ virtual void CellModified();
+ virtual sal_Bool SaveModified();
+ virtual sal_Bool IsModified() const;
+
+ virtual sal_uInt16 AppendColumn(const String& rName, sal_uInt16 nWidth = 0, sal_uInt16 nPos = HEADERBAR_APPEND, sal_uInt16 nId = (sal_uInt16)-1);
+ virtual void RemoveColumn(sal_uInt16 nId);
+ virtual DbGridColumn* CreateColumn(sal_uInt16 nId) const;
+ virtual void ColumnMoved(sal_uInt16 nId);
+ virtual sal_Bool SaveRow();
+ virtual sal_Bool IsTabAllowed(sal_Bool bForward) const;
+
+ /// hide a column
+ virtual void HideColumn(sal_uInt16 nId);
+ /// show a column
+ virtual void ShowColumn(sal_uInt16 nId);
+
+ /** This is called before executing a context menu for a row. rMenu contains the initial entries
+ handled by this base class' method (which always has to be called).
+ Derived classes may alter the menu in any way and handle any additional entries in
+ PostExecuteColumnContextMenu.
+ All disabled entries will be removed before executing the menu, so be careful with separators
+ near entries you probably wish to disable ...
+ */
+ virtual void PreExecuteRowContextMenu(sal_uInt16 nRow, PopupMenu& rMenu);
+ /** After executing the context menu for a row this method is called.
+ */
+ virtual void PostExecuteRowContextMenu(sal_uInt16 nRow, const PopupMenu& rMenu, sal_uInt16 nExecutionResult);
+
+ virtual void DataSourcePropertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException);
+
+ virtual void FieldValueChanged(sal_uInt16 _nId, const ::com::sun::star::beans::PropertyChangeEvent& _evt);
+ virtual void FieldListenerDisposing(sal_uInt16 _nId);
+
+ virtual void disposing(sal_uInt16 _nId, const ::com::sun::star::lang::EventObject& _rEvt);
+
+ // own overridables
+ /// called when the current row changed
+ virtual void onRowChange();
+ /// called when the current column changed
+ virtual void onColumnChange();
+
+ // DragSourceHelper overridables
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+
+ void executeRowContextMenu( long _nRow, const Point& _rPreferredPos );
+
+public:
+ DbGridControl(
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >,
+ Window* pParent,
+ WinBits nBits = WB_BORDER);
+
+ virtual ~DbGridControl();
+
+ virtual void Init();
+ virtual void InitColumnsByFields(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xFields) = 0;
+ virtual void RemoveRows();
+
+ /** GetCellText returns the text at the given position
+ @param _nRow
+ the number of the row
+ @param _nColId
+ the ID of the column
+ @return
+ the text out of the cell
+ */
+ virtual String GetCellText(long _nRow, sal_uInt16 _nColId) const;
+
+ void RemoveRows(sal_Bool bNewCursor);
+
+ void InvalidateStatus();
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& getNumberFormatter() const {return m_xFormatter;}
+
+ // die Datenquelle
+ // die Optionen koennen die Updatefaehigkeiten noch einschraenken, nicht erweitern
+ virtual void setDataSource(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& rCursor,
+ sal_uInt16 nOpts = OPT_INSERT | OPT_UPDATE | OPT_DELETE);
+ virtual void Dispatch(sal_uInt16 nId);
+
+ CursorWrapper* getDataSource() const {return m_pDataCursor;}
+ const DbGridColumns& GetColumns() const {return m_aColumns;}
+
+ void EnableHandle(sal_Bool bEnable);
+ sal_Bool HasHandle() const {return m_bHandle;}
+ void InsertHandleColumn();
+
+ /// welche Position hat die Spalte mit der Id in der ::com::sun::star::sdbcx::View, die Handle-Column zahelt nicht mit
+ sal_uInt16 GetViewColumnPos( sal_uInt16 nId ) const { sal_uInt16 nPos = GetColumnPos(nId); return (nPos==(sal_uInt16)-1) ? GRID_COLUMN_NOT_FOUND : nPos-1; }
+
+ /** welche Position hat die Spalte mit der Id in m_aColumns, also dem von GetColumns gelieferten ::com::sun::star::sdbcx::Container ?
+ (unterscheidet sich u.U. von der von GetViewColumnPos gelieferten, wenn es versteckt Spalten gibt)
+ */
+ sal_uInt16 GetModelColumnPos( sal_uInt16 nId ) const;
+
+ /// Anzahl der Spalten im Model
+ sal_uInt16 GetViewColCount() const { return ColCount() - 1; }
+ sal_uInt16 GetModelColCount() const { return (sal_uInt16)m_aColumns.Count(); }
+ /// umgekehrt zu GetViewColumnPos : Id zu Position, die erste Nicht-Handle-Column hat die Position 0
+ sal_uInt16 GetColumnIdFromViewPos( sal_uInt16 nPos ) const { return GetColumnId(nPos + 1); }
+ sal_uInt16 GetColumnIdFromModelPos( sal_uInt16 nPos ) const;
+
+ virtual void SetDesignMode(sal_Bool bMode);
+ sal_Bool IsDesignMode() const {return m_bDesignMode;}
+ sal_Bool IsOpen() const {return m_pSeekCursor != NULL;}
+
+ virtual void SetFilterMode(sal_Bool bMode);
+ sal_Bool IsFilterMode() const {return m_bFilterMode;}
+ sal_Bool IsFilterRow(long nRow) const {return m_bFilterMode && nRow == 0;}
+
+ void EnableNavigationBar(sal_Bool bEnable);
+ sal_Bool HasNavigationBar() const {return m_bNavigationBar;}
+
+ sal_uInt16 GetOptions() const {return m_nOptions;}
+ NavigationBar& GetNavigationBar() {return m_aBar;}
+ sal_uInt16 SetOptions(sal_uInt16 nOpt);
+ // The new options are interpreted with respect to the current data source. If it is unable
+ // to update, to insert or to restore, the according options are ignored. If the grid isn't
+ // connected to a data source, all options except OPT_READONLY are ignored.
+
+ void SetMultiSelection(sal_Bool bMulti);
+ sal_Bool GetMultiSelection() const {return m_bMultiSelection;}
+
+ const com::sun::star::util::Date& getNullDate() const {return m_aNullDate;}
+
+ // Positionierung
+ void MoveToPosition(sal_uInt32 nPos);
+ void MoveToFirst();
+ void MoveToNext();
+ void MoveToPrev();
+ void MoveToLast();
+ void AppendNew();
+
+ // Abgleich der Cursor falls von außen der DatenCursor verschoben wurde
+ // Flag bedeutet ob ein Abgleich es Rowcounts vorgenommen werden soll
+ void AdjustDataSource(sal_Bool bFull = sal_False);
+ void Undo();
+
+ virtual void BeginCursorAction();
+ virtual void EndCursorAction();
+
+ // wird die aktuelle Zeile neu gesetzt
+ sal_Bool IsUpdating() const {return m_bUpdating;}
+
+ virtual void RowRemoved( long nRow, long nNumRows = 1, sal_Bool bDoPaint = sal_True );
+ virtual void RowInserted( long nRow, long nNumRows = 1, sal_Bool bDoPaint = sal_True, sal_Bool bKeepSelection = sal_False );
+ virtual void RowModified( long nRow, sal_uInt16 nColId = USHRT_MAX );
+
+ void resetCurrentRow();
+
+ sal_Bool getDisplaySynchron() const { return m_bSynchDisplay; }
+ void setDisplaySynchron(sal_Bool bSync);
+ void forceSyncDisplay();
+ // wenn das auf sal_False gesetzt wird, laeuft die Anzeige nicht mehr mit der aktuellen Cursor-Position synchron
+ // (soll heissen, in AdjustDataSource wird nicht in die zur CursorPosition gehoerenden Zeile gesprungen)
+ // wer das benutzt, sollte bitte wissen, was er tut, da zum Beispiel die Eingabe von Daten in einer Zeile auf der Anzeige,
+ // die gar nicht mit der Position des Cursors synchron ist, ziemlich kritisch sein koennte
+
+ sal_Bool isForcedROController() const { return m_bForceROController; }
+ void forceROController(sal_Bool bForce);
+ // Setzt man das auf sal_True, hat das GridControl immer einen ::com::sun::star::frame::Controller, der allerdings read-only ist. Ausserdem
+ // wird die Edit-Zeile des Controllers so eingestellt, dass sie ihre Selektion bei Fokus-Verlust weiterhin anzeigt.
+
+ const DbGridRowRef& GetCurrentRow() const {return m_xCurrentRow;}
+
+ void SetStateProvider(const Link& rProvider) { m_aMasterStateProvider = rProvider; }
+ // if this link is set the given provider will be asked for the state of my items.
+ // the return values are interpreted as follows :
+ // <0 -> not specified (use default mechanism to determine the state)
+ // ==0 -> the item is disabled
+ // >0 -> the item is enabled
+ void SetSlotExecutor(const Link& rExecutor) { m_aMasterSlotExecutor = rExecutor; }
+ // analogous : if this link is set, all nav-bar slots will be routed through it when executed
+ // if the handler returns nonzero, no further handling of the slot occurs
+
+ void EnablePermanentCursor(sal_Bool bEnable);
+ sal_Bool IsPermanentCursorEnabled() const;
+
+ /** forces both scrollbars to be hidden
+
+ For the horizontal srollbar, this is overruled by enabling the navigation bar: A navigation
+ bar <b>always</b> implies a horizontal scroll bar
+ @seealso EnableNavigationBar
+ */
+ void ForceHideScrollbars( sal_Bool _bForce );
+ sal_Bool IsForceHideScrollbars() const;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ getServiceManager() const { return m_xServiceFactory; }
+
+ /// returns <TRUE/> if the text of the given cell can be copied into the clipboard
+ sal_Bool canCopyCellText(sal_Int32 _nRow, sal_Int16 _nColId);
+ /// copies the text of the given cell into the clipboard
+ void copyCellText(sal_Int32 _nRow, sal_Int16 _nColId);
+
+ // selectin listener handling
+ FmGridListener* getGridListener() const { return m_pGridListener; }
+ void setGridListener( FmGridListener* _pListener ) { m_pGridListener = _pListener; }
+
+ // helper class to grant access to selected methods from within the DbCellControl class
+ struct GrantControlAccess
+ {
+ friend class DbCellControl;
+ friend class RowSetEventListener;
+ protected:
+ GrantControlAccess() { }
+ };
+
+ /// called when a controller needs to be re-initialized
+ void refreshController(sal_uInt16 _nColId, GrantControlAccess _aAccess);
+
+ CursorWrapper* GetSeekCursor(GrantControlAccess /*_aAccess*/) const { return m_pSeekCursor; }
+ const DbGridRowRef& GetSeekRow(GrantControlAccess /*_aAccess*/) const { return m_xSeekRow; }
+ void SetSeekPos(sal_Int32 nPos,GrantControlAccess /*_aAccess*/) {m_nSeekPos = nPos;}
+
+ /**
+ @return
+ The count of additional controls of the control area.
+ */
+ virtual sal_Int32 GetAccessibleControlCount() const;
+
+ /** Creates the accessible object of an additional control.
+ @param _nIndex
+ The 0-based index of the control.
+ @return
+ The XAccessible interface of the specified control.
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >
+ CreateAccessibleControl( sal_Int32 _nIndex );
+
+ // IAccessibleTableProvider
+ /** Creates the accessible object of a data table cell.
+ @param nRow The row index of the cell.
+ @param nColumnId The column ID of the cell.
+ @return The XAccessible interface of the specified cell. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >
+ CreateAccessibleCell( sal_Int32 nRow, sal_uInt16 nColumnId );
+
+protected:
+ void RecalcRows(long nNewTopRow, sal_uInt16 nLinesOnScreen, sal_Bool bUpdateCursor);
+ sal_Bool SeekCursor(long nRow, sal_Bool bAbsolute = sal_False);
+ void RemoveColumns(); // aufraeumen eigener strukturen
+ void AdjustRows();
+ sal_Int32 AlignSeekCursor();
+ sal_Bool SetCurrent(long nNewRow);
+
+ String GetCurrentRowCellText(DbGridColumn* pCol,const DbGridRowRef& _rRow) const;
+ virtual void DeleteSelectedRows();
+ sal_Bool IsValid(const DbGridRowRef& _xRow) const {return _xRow && _xRow->IsValid();}
+
+ // Zeile an der gerade eingefuegt wird
+ sal_Bool IsCurrentAppending() const;
+
+ // Leerzeile zum Einfuegen
+ sal_Bool IsInsertionRow(long nRow) const;
+
+ void SetSeekPos(sal_Int32 nPos) {m_nSeekPos = nPos;}
+ sal_Int32 GetCurrentPos() const {return m_nCurrentPos;}
+ sal_Int32 GetSeekPos() const {return m_nSeekPos;}
+ sal_Int32 GetTotalCount() const {return m_nTotalCount;}
+
+ const DbGridRowRef& GetEmptyRow() const { return m_xEmptyRow; }
+ const DbGridRowRef& GetSeekRow() const { return m_xSeekRow; }
+ const DbGridRowRef& GetPaintRow() const { return m_xPaintRow; }
+ CursorWrapper* GetSeekCursor() const { return m_pSeekCursor; }
+
+
+ void ConnectToFields();
+ void DisconnectFromFields();
+
+ void implAdjustInSolarThread(sal_Bool _bRows);
+ // calls AdjustRows or AdjustDataSource, synchron if the caller is running in the solar thread, else asynchron
+
+protected:
+ virtual void InitController(::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol);
+ void Construct();
+ void ImplInitWindow( const InitWindowFacet _eInitWhat );
+ DECL_LINK(OnDelete, void*);
+
+ DECL_LINK(OnAsyncAdjust, void*);
+ // if the param is != NULL, AdjustRows will be called, else AdjustDataSource
+
+private:
+ using BrowseBox::InsertHandleColumn;
+};
+
+
+SV_IMPL_REF(DbGridRow);
+
+
+#endif // _SVX_GRIDCTRL_HXX
+
diff --git a/svx/inc/svx/hdft.hxx b/svx/inc/svx/hdft.hxx
new file mode 100644
index 000000000000..adc4745ace83
--- /dev/null
+++ b/svx/inc/svx/hdft.hxx
@@ -0,0 +1,136 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_HDFT_HXX
+#define _SVX_HDFT_HXX
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/tabdlg.hxx>
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+
+#ifndef _GROUP_HXX //autogen
+#include <vcl/group.hxx>
+#endif
+#include <svx/pagectrl.hxx>
+#include "svx/svxdllapi.h"
+
+// class SvxHFPage ------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxHFPage: public SfxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+public:
+
+ virtual sal_Bool FillItemSet( SfxItemSet& rOutSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ virtual ~SvxHFPage();
+
+ void DisableDeleteQueryBox() { bDisableQueryBox = sal_True; }
+ void EnableBackgroundSelector( sal_Bool bNew ) { bEnableBackgroundSelector = bNew; }
+ void EnableDynamicSpacing();
+
+protected:
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+
+ SvxHFPage( Window* pParent, sal_uInt16 nResId, const SfxItemSet& rSet,
+ sal_uInt16 nSetId );
+
+ CheckBox aTurnOnBox;
+ CheckBox aCntSharedBox;
+ FixedText aLMLbl;
+ MetricField aLMEdit;
+ FixedText aRMLbl;
+ MetricField aRMEdit;
+ FixedText aDistFT;
+ MetricField aDistEdit;
+ CheckBox aDynSpacingCB;
+ FixedText aHeightFT;
+ MetricField aHeightEdit;
+ CheckBox aHeightDynBtn;
+ FixedLine aFrm;
+ SvxPageWindow aBspWin;
+ PushButton aBackgroundBtn;
+
+ sal_uInt16 nId;
+ SfxItemSet* pBBSet;
+ sal_Bool bDisableQueryBox;
+ sal_Bool bEnableBackgroundSelector;
+ FASTBOOL bInReset;
+
+ void InitHandler();
+ DECL_LINK( TurnOnHdl, CheckBox*);
+ DECL_LINK( DistModify, MetricField*);
+ DECL_LINK( HeightModify, MetricField*);
+ DECL_LINK( BorderModify, MetricField*);
+ DECL_LINK( BackgroundHdl, Button*);
+
+ void UpdateExample();
+ DECL_LINK( RangeHdl, Edit*);
+
+private:
+#ifdef _SVX_HDFT_CXX
+ SVX_DLLPRIVATE void ResetBackground_Impl( const SfxItemSet& rSet );
+#endif
+};
+
+// class SvxHeaderPage ---------------------------------------------------
+
+class SVX_DLLPUBLIC SvxHeaderPage : public SvxHFPage
+{
+public:
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
+ static sal_uInt16* GetRanges();
+
+private:
+ SvxHeaderPage( Window* pParent, const SfxItemSet& rSet );
+};
+
+// class SvxFooterPage ---------------------------------------------------
+
+class SVX_DLLPUBLIC SvxFooterPage : public SvxHFPage
+{
+public:
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
+ static sal_uInt16* GetRanges();
+
+private:
+ SVX_DLLPRIVATE SvxFooterPage( Window* pParent, const SfxItemSet& rSet );
+};
+
+#endif
+
diff --git a/svx/inc/svx/helperhittest3d.hxx b/svx/inc/svx/helperhittest3d.hxx
new file mode 100644
index 000000000000..eae61aa253c5
--- /dev/null
+++ b/svx/inc/svx/helperhittest3d.hxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SVX_HELPERHITTEST_HXX
+#define INCLUDED_SVX_HELPERHITTEST_HXX
+
+#include "svx/svxdllapi.h"
+#include <sal/types.h>
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class B2DPoint;
+}
+
+namespace drawinglayer { namespace geometry {
+ class ViewInformation3D;
+}}
+
+class E3dCompoundObject;
+class E3dScene;
+
+//////////////////////////////////////////////////////////////////////////////
+
+/** support for getting a ViewInformation3D for a given CompoudObject3D
+ with correct ObjectTransformation filled out
+
+ @param o_rViewInformation3D
+ The ViewInformation3D created which will be overwritten
+
+ @param rCandidate
+ The E3dCompoundObject for which the ViewInformation3D shall be
+ prepared
+
+ @return
+ A pointer to the found and used root scene. This is also a hint
+ if the operation succeeded or not, since when object has no root
+ scene (is not inserted to a model), an empty ViewInformation3D
+ will be used
+*/
+E3dScene* fillViewInformation3DForCompoundObject(
+ drawinglayer::geometry::ViewInformation3D& o_rViewInformation3D,
+ const E3dCompoundObject& rCandidate);
+
+/** support for getting all from a 2d position hit objects in a 3d scene
+ in a depth sorted array
+
+ @param rPoint
+ 2D Point in view coordinates
+
+ @param rScene
+ The 3D Scene for HitTest
+
+ @param o_rResult
+ Output parameter which contains all hit 3D objects inside rScene. This
+ vector will be changed in any case. If it's empty, no hit exists. If it's
+ not empty, the first object is the object closest to the viewer
+
+*/
+SVX_DLLPUBLIC void getAllHit3DObjectsSortedFrontToBack(
+ const basegfx::B2DPoint& rPoint,
+ const E3dScene& rScene,
+ ::std::vector< const E3dCompoundObject* >& o_rResult);
+
+/** support for checking if the single given 3d object is hit at position
+
+ @param rPoint
+ 2D Point in view coordinates
+
+ @param rCandidate
+ The 3D Object which needs checking
+
+ @return
+ true if hit, false if not
+*/
+bool checkHitSingle3DObject(
+ const basegfx::B2DPoint& rPoint,
+ const E3dCompoundObject& rCandidate);
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_SVX_HELPERHITTEST_HXX
+
+// eof
diff --git a/svx/inc/svx/hlnkitem.hxx b/svx/inc/svx/hlnkitem.hxx
new file mode 100644
index 000000000000..bdc0e1ff0e05
--- /dev/null
+++ b/svx/inc/svx/hlnkitem.hxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_HLNKITEM_HXX
+#define _SVX_HLNKITEM_HXX
+
+#include <tools/string.hxx>
+#include <svl/poolitem.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <svl/macitem.hxx>
+#include "svx/svxdllapi.h"
+
+#define HYPERDLG_EVENT_MOUSEOVER_OBJECT 0x0001
+#define HYPERDLG_EVENT_MOUSECLICK_OBJECT 0x0002
+#define HYPERDLG_EVENT_MOUSEOUT_OBJECT 0x0004
+
+enum SvxLinkInsertMode
+{
+ HLINK_DEFAULT,
+ HLINK_FIELD,
+ HLINK_BUTTON,
+ HLINK_HTMLMODE = 0x0080
+};
+
+class SVX_DLLPUBLIC SvxHyperlinkItem : public SfxPoolItem
+{
+ String sName;
+ String sURL;
+ String sTarget;
+ SvxLinkInsertMode eType;
+
+ String sIntName;
+ SvxMacroTableDtor* pMacroTable;
+
+ sal_uInt16 nMacroEvents;
+
+public:
+ TYPEINFO();
+
+ SvxHyperlinkItem( sal_uInt16 _nWhich = SID_HYPERLINK_GETLINK ):
+ SfxPoolItem(_nWhich), pMacroTable(NULL) { eType = HLINK_DEFAULT; nMacroEvents=0; };
+ SvxHyperlinkItem( const SvxHyperlinkItem& rHyperlinkItem );
+ SvxHyperlinkItem( sal_uInt16 nWhich, String& rName, String& rURL,
+ String& rTarget, String& rIntName,
+ SvxLinkInsertMode eTyp = HLINK_FIELD,
+ sal_uInt16 nEvents = 0,
+ SvxMacroTableDtor *pMacroTbl =NULL );
+ virtual ~SvxHyperlinkItem () { delete pMacroTable; }
+
+ inline SvxHyperlinkItem& operator=( const SvxHyperlinkItem &rItem );
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ const String& GetName() const { return sName; }
+ void SetName(const String& rName) { sName = rName; }
+
+ const String& GetURL() const { return sURL; }
+ void SetURL(const String& rURL) { sURL = rURL; }
+
+ const String& GetIntName () const { return sIntName; }
+ void SetIntName(const String& rIntName) { sIntName = rIntName; }
+
+ const String& GetTargetFrame() const { return sTarget; }
+ void SetTargetFrame(const String& rTarget) { sTarget = rTarget; }
+
+ SvxLinkInsertMode GetInsertMode() const { return eType; }
+ void SetInsertMode( SvxLinkInsertMode eNew ) { eType = eNew; }
+
+ void SetMacro( sal_uInt16 nEvent, const SvxMacro& rMacro );
+
+ void SetMacroTable( const SvxMacroTableDtor& rTbl );
+ const SvxMacroTableDtor* GetMacroTbl() const { return pMacroTable; }
+
+ void SetMacroEvents (const sal_uInt16 nEvents) { nMacroEvents = nEvents; }
+ sal_uInt16 GetMacroEvents() const { return nMacroEvents; }
+
+ virtual SvStream& Store( SvStream &, sal_uInt16 nItemVersion ) const;
+ virtual SfxPoolItem* Create( SvStream &, sal_uInt16 nVer ) const;
+
+};
+
+#endif
+
+
diff --git a/svx/inc/svx/htmlmode.hxx b/svx/inc/svx/htmlmode.hxx
new file mode 100644
index 000000000000..dab1b5b1db70
--- /dev/null
+++ b/svx/inc/svx/htmlmode.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_HTMLMODE_HXX
+#define _SVX_HTMLMODE_HXX
+
+#include <sfx2/htmlmode.hxx>
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/inc/svx/hyperdlg.hxx b/svx/inc/svx/hyperdlg.hxx
new file mode 100644
index 000000000000..f35df8dc73a8
--- /dev/null
+++ b/svx/inc/svx/hyperdlg.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_TAB_HYPERLINK_HXX
+#define _SVX_TAB_HYPERLINK_HXX
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/childwin.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* Hyperlink-Dialog
+|*
+\************************************************************************/
+
+class AbstractSvxHpLinkDlg;
+
+class SVX_DLLPUBLIC SvxHlinkDlgWrapper : public SfxChildWindow
+{
+private:
+ AbstractSvxHpLinkDlg* mpDlg;
+
+public:
+ SvxHlinkDlgWrapper( Window*pParent, sal_uInt16 nId,
+ SfxBindings* pBindings, SfxChildWinInfo* pInfo );
+
+ SFX_DECL_CHILDWINDOW(SvxHlinkDlgWrapper);
+ virtual sal_Bool QueryClose();
+};
+
+#endif // _SVX_TAB_HYPERLINK_HXX
+
diff --git a/svx/inc/svx/hyprlink.hxx b/svx/inc/svx/hyprlink.hxx
new file mode 100644
index 000000000000..bb869f5e5cb5
--- /dev/null
+++ b/svx/inc/svx/hyprlink.hxx
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_DLG_HYPERLINK_HXX
+#define _SVX_DLG_HYPERLINK_HXX
+
+#include <sfx2/childwin.hxx>
+#include "svx/svxdllapi.h"
+
+// class SvxHyperlinkDialogWrapper ---------------------------------------
+class SVX_DLLPUBLIC SvxHyperlinkDlgWrapper : public SfxChildWindow
+{
+public:
+ SvxHyperlinkDlgWrapper( Window*pParent, sal_uInt16 nId,
+ SfxBindings* pBindings, SfxChildWinInfo* pInfo );
+ SFX_DECL_CHILDWINDOW(SvxHyperlinkDlgWrapper);
+};
+#endif // _SVX_DLG_HYPERLINK_HXX
+
+
diff --git a/svx/inc/svx/ifaceids.hxx b/svx/inc/svx/ifaceids.hxx
new file mode 100644
index 000000000000..a2be904d89a3
--- /dev/null
+++ b/svx/inc/svx/ifaceids.hxx
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_IFACEIDS_HXX
+#define _SVX_IFACEIDS_HXX
+
+// -----------------------------------------------------------------------
+
+#include <sfx2/shell.hxx>
+
+#define SVX_INTERFACE_BASIDE_DOCSH (SFX_INTERFACE_IDE_START+ 0)
+#define SVX_INTERFACE_BASIDE_VIEWSH (SFX_INTERFACE_IDE_START+ 1)
+#define SVX_INTERFACE_EXTRUSION_BAR (SFX_INTERFACE_IDE_START+ 2)
+#define SVX_INTERFACE_FONTWORK_BAR (SFX_INTERFACE_IDE_START+ 3)
+
+#define HID_INTERFACE_BASIDE_VIEWSH SVX_INTERFACE_BASIDE_VIEWSH
+
+#define SVX_INTERFACE_FORM_SH (SFX_INTERFACE_IDE_END+ 1)
+
+#endif
+
+
diff --git a/svx/inc/svx/imapdlg.hxx b/svx/inc/svx/imapdlg.hxx
new file mode 100644
index 000000000000..7e82f0bc36e2
--- /dev/null
+++ b/svx/inc/svx/imapdlg.hxx
@@ -0,0 +1,211 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _IMAPDLG_HXX_
+#define _IMAPDLG_HXX_
+
+#include <svtools/inettbc.hxx>
+#include <sfx2/childwin.hxx>
+#include <sfx2/ctrlitem.hxx>
+#include <sfx2/basedlgs.hxx>
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _COMBOBOX_HXX //autogen
+#include <vcl/combobox.hxx>
+#endif
+
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+
+#ifndef _TOOLBOX_HXX //autogen
+#include <vcl/toolbox.hxx>
+#endif
+
+#ifndef _STATUS_HXX //autogen
+#include <vcl/status.hxx>
+#endif
+#include "svx/svxdllapi.h"
+
+
+#ifndef _GOMISC_HXX
+class ImageMap;
+#endif
+
+
+/*************************************************************************
+|*
+|* Ableitung vom SfxChildWindow als "Behaelter" fuer Float
+|*
+\************************************************************************/
+
+class Graphic;
+class TargetList;
+
+class SVX_DLLPUBLIC SvxIMapDlgChildWindow : public SfxChildWindow
+{
+ public:
+
+ SvxIMapDlgChildWindow( Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo* );
+
+ SFX_DECL_CHILDWINDOW( SvxIMapDlgChildWindow );
+
+ static void UpdateIMapDlg( const Graphic& rGraphic, const ImageMap* pImageMap = NULL,
+ const TargetList* pTargetList = NULL, void* pEditingObj = NULL );
+};
+
+
+#ifndef _REDUCED_IMAPDLG_HXX_
+#define _REDUCED_IMAPDLG_HXX_
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+class SvxIMapDlg;
+
+class SvxIMapDlgItem : public SfxControllerItem
+{
+ SvxIMapDlg& rIMap;
+
+
+protected:
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+
+
+public:
+
+ SvxIMapDlgItem( sal_uInt16 nId, SvxIMapDlg& rIMapDlg, SfxBindings& rBindings );
+};
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+class IMapOwnData;
+class IMapWindow;
+
+class SVX_DLLPUBLIC SvxIMapDlg : public SfxModelessDialog // SfxFloatingWindow
+{
+ friend class IMapOwnData;
+ friend class IMapWindow;
+ using Window::Update;
+
+ ToolBox aTbxIMapDlg1;
+ FixedText aFtURL;
+ SvtURLBox maURLBox;
+ FixedText aFtText;
+ Edit aEdtText;
+ FixedText maFtTarget;
+ ComboBox maCbbTarget;
+ StatusBar aStbStatus;
+ ImageList maImageList;
+ ImageList maImageListH;
+
+ Size aLastSize;
+ IMapWindow* pIMapWnd;
+ IMapOwnData* pOwnData;
+ void* pCheckObj;
+ SvxIMapDlgItem aIMapItem;
+
+ virtual void Resize();
+ virtual sal_Bool Close();
+
+#ifdef _IMAPDLG_PRIVATE
+
+ DECL_LINK( TbxClickHdl, ToolBox* );
+ DECL_LINK( InfoHdl, IMapWindow* );
+ DECL_LINK( MousePosHdl, IMapWindow* );
+ DECL_LINK( GraphSizeHdl, IMapWindow* );
+ DECL_LINK( URLModifyHdl, void* );
+ DECL_LINK( URLLoseFocusHdl, void* );
+ DECL_LINK( UpdateHdl, Timer* );
+ DECL_LINK( TbxUpdateHdl, Timer* );
+ DECL_LINK( StateHdl, IMapWindow* );
+ DECL_LINK( MiscHdl, void* );
+
+ void DoOpen();
+ sal_Bool DoSave();
+
+#endif
+
+
+public:
+
+ SvxIMapDlg( SfxBindings *pBindings, SfxChildWindow *pCW,
+ Window* pParent, const ResId& rResId );
+ ~SvxIMapDlg();
+
+ void SetExecState( sal_Bool bEnable );
+
+ void SetGraphic( const Graphic& rGraphic );
+
+ void SetEditingObject( void* pObj ) { pCheckObj = pObj; }
+ const void* GetEditingObject() const { return pCheckObj; }
+
+ void SetImageMap( const ImageMap& rImageMap );
+ const ImageMap& GetImageMap() const;
+
+ void SetTargetList( const TargetList& rTargetList );
+ const TargetList& GetTargetList() const;
+
+ void Update( const Graphic& rGraphic, const ImageMap* pImageMap = NULL,
+ const TargetList* pTargetList = NULL, void* pEditingObj = NULL );
+
+ virtual void KeyInput( const KeyEvent& rKEvt );
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ void ApplyImageList();
+};
+
+
+/*************************************************************************
+|*
+|* Defines
+|*
+\************************************************************************/
+
+#define SVXIMAPDLG() ( (SvxIMapDlg*) ( SfxViewFrame::Current()->GetChildWindow( \
+ SvxIMapDlgChildWindow::GetChildWindowId() )-> \
+ GetWindow() ) )
+
+
+#endif // _REDUCED_IMAPDLG_HXX_
+#endif // _IMAPDLG_HXX_
+
+
diff --git a/svx/inc/svx/insctrl.hxx b/svx/inc/svx/insctrl.hxx
new file mode 100644
index 000000000000..dd5baa6bcc74
--- /dev/null
+++ b/svx/inc/svx/insctrl.hxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_INSCTRL_HXX
+#define _SVX_INSCTRL_HXX
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/stbitem.hxx>
+#include "svx/svxdllapi.h"
+
+// class SvxInsertToolBoxControl -----------------------------------------
+
+class SVX_DLLPUBLIC SvxInsertStatusBarControl : public SfxStatusBarControl
+{
+public:
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ virtual void Click();
+ virtual void Paint( const UserDrawEvent& rEvt );
+
+ SFX_DECL_STATUSBAR_CONTROL();
+
+ SvxInsertStatusBarControl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar& rStb );
+ ~SvxInsertStatusBarControl();
+
+ static sal_uIntPtr GetDefItemWidth(const StatusBar& rStb);
+
+private:
+ sal_Bool bInsert;
+
+#ifdef _SVX_INSCTRL_CXX
+ SVX_DLLPRIVATE void DrawItemText_Impl();
+#endif
+};
+
+
+#endif
+
diff --git a/svx/inc/svx/ipolypolygoneditorcontroller.hxx b/svx/inc/svx/ipolypolygoneditorcontroller.hxx
new file mode 100644
index 000000000000..205f8f7e7254
--- /dev/null
+++ b/svx/inc/svx/ipolypolygoneditorcontroller.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_IPOLYPOLYGONEDITORCONTROLLER_HXX
+#define _SDR_IPOLYPOLYGONEDITORCONTROLLER_HXX
+
+#include "svx/svxdllapi.h"
+#include <svx/svdedtv.hxx>
+
+//************************************************************
+// Defines
+//************************************************************
+
+enum SdrPathSmoothKind {SDRPATHSMOOTH_DONTCARE, // nur fuer Statusabfrage
+ SDRPATHSMOOTH_ANGULAR, // Eckig
+ SDRPATHSMOOTH_ASYMMETRIC, // unsymmetrisch, normales Smooth
+ SDRPATHSMOOTH_SYMMETRIC}; // symmetrisch
+
+enum SdrPathSegmentKind {SDRPATHSEGMENT_DONTCARE, // nur fuer Statusabfrage
+ SDRPATHSEGMENT_LINE, // gerader Streckenabschnitt
+ SDRPATHSEGMENT_CURVE, // Kurvenabschnitt (Bezier)
+ SDRPATHSEGMENT_TOGGLE}; // nur fuer Set: Toggle
+
+enum SdrObjClosedKind {SDROBJCLOSED_DONTCARE, // nur fuer Statusabfrage
+ SDROBJCLOSED_OPEN, // Objekte geoeffnet (Linie, Polyline, ...)
+ SDROBJCLOSED_CLOSED, // Objekte geschlossen (Polygon, ...)
+ SDROBJCLOSED_TOGGLE}; // nur fuer Set: Toggle (not implemented yet)
+
+class IPolyPolygonEditorController
+{
+public:
+ virtual void DeleteMarkedPoints() = 0;
+ virtual sal_Bool IsDeleteMarkedPointsPossible() const = 0;
+
+ virtual void RipUpAtMarkedPoints() = 0;
+ virtual bool IsRipUpAtMarkedPointsPossible() const = 0;
+
+ virtual sal_Bool IsSetMarkedSegmentsKindPossible() const = 0;
+ virtual SdrPathSegmentKind GetMarkedSegmentsKind() const = 0;
+ virtual void SetMarkedSegmentsKind(SdrPathSegmentKind eKind) = 0;
+
+ virtual sal_Bool IsSetMarkedPointsSmoothPossible() const = 0;
+ virtual SdrPathSmoothKind GetMarkedPointsSmooth() const = 0;
+ virtual void SetMarkedPointsSmooth(SdrPathSmoothKind eKind) = 0;
+
+ virtual void CloseMarkedObjects(sal_Bool bToggle, sal_Bool bOpen ) = 0;
+ virtual bool IsOpenCloseMarkedObjectsPossible() const = 0;
+ virtual SdrObjClosedKind GetMarkedObjectsClosedState() const = 0;
+};
+
+#endif //_SDR_IPOLYPOLYGONEDITORCONTROLLER_HXX
+
diff --git a/svx/inc/svx/itemwin.hxx b/svx/inc/svx/itemwin.hxx
new file mode 100644
index 000000000000..8f02fdc2ef3e
--- /dev/null
+++ b/svx/inc/svx/itemwin.hxx
@@ -0,0 +1,197 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_ITEMWIN_HXX
+#define _SVX_ITEMWIN_HXX
+
+#include <vcl/bitmap.hxx>
+
+#include <svx/dlgctrl.hxx>
+#include "svx/svxdllapi.h"
+
+// forward ---------------------------------------------------------------
+
+class XLineColorItem;
+class XLineWidthItem;
+class SfxObjectShell;
+
+// class SvxLineBox ------------------------------------------------------
+
+class SvxLineBox : public LineLB
+{
+ BmpColorMode meBmpMode;
+ sal_uInt16 nCurPos;
+ Timer aDelayTimer;
+ Size aLogicalSize;
+ sal_Bool bRelease;
+ SfxObjectShell* mpSh;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame;
+
+#ifdef _SVX_ITEMWIN_CXX
+ DECL_LINK( DelayHdl_Impl, Timer * );
+
+ void ReleaseFocus_Impl();
+#endif
+public:
+ SvxLineBox( Window* pParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ WinBits nBits = WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL );
+ ~SvxLineBox();
+
+ void FillControl();
+
+protected:
+ virtual void Select();
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ virtual long Notify( NotifyEvent& rNEvt );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+};
+
+// class SvxColorBox -----------------------------------------------------
+
+class SvxColorBox : public ColorLB
+{
+ using Window::Update;
+
+ sal_uInt16 nCurPos;
+ sal_uInt16 nId;
+ Timer aDelayTimer;
+ Size aLogicalSize;
+ sal_Bool bRelease;
+ ::rtl::OUString maCommand;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame;
+
+#ifdef _SVX_ITEMWIN_CXX
+ DECL_LINK( DelayHdl_Impl, Timer * );
+
+ void ReleaseFocus_Impl();
+#endif
+
+public:
+ SvxColorBox( Window* pParent,
+ const rtl::OUString& rCommand,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ WinBits nBits = WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL );
+ ~SvxColorBox();
+
+ void Update( const XLineColorItem* pItem );
+
+protected:
+ virtual void Select();
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ virtual long Notify( NotifyEvent& rNEvt );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+};
+
+// class SvxMetricField --------------------------------------------------
+
+class SVX_DLLPUBLIC SvxMetricField : public MetricField
+{
+ using Window::Update;
+
+ String aCurTxt;
+ SfxMapUnit ePoolUnit;
+ FieldUnit eDlgUnit;
+ Size aLogicalSize;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame;
+
+#ifdef _SVX_ITEMWIN_CXX
+ void ReleaseFocus_Impl();
+#endif
+
+protected:
+ virtual void Modify();
+ virtual void Down();
+ virtual void Up(); // Nur zur Sicherheit
+
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ virtual long Notify( NotifyEvent& rNEvt );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+public:
+ SvxMetricField( Window* pParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ WinBits nBits = WB_BORDER | WB_SPIN | WB_REPEAT );
+ ~SvxMetricField();
+
+ void Update( const XLineWidthItem* pItem );
+ void SetCoreUnit( SfxMapUnit eUnit );
+ void RefreshDlgUnit();
+};
+
+// class SvxFillTypeBox --------------------------------------------------
+
+class SvxFillTypeBox : public FillTypeLB
+{
+public:
+ SvxFillTypeBox( Window* pParent, WinBits nBits = WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL );
+ ~SvxFillTypeBox();
+
+ void Selected() { bSelect = sal_True; }
+ sal_Bool IsRelease() { return bRelease;}
+
+protected:
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ virtual long Notify( NotifyEvent& rNEvt );
+
+private:
+ sal_uInt16 nCurPos;
+ sal_Bool bSelect;
+ sal_Bool bRelease;
+
+#ifdef _SVX_ITEMWIN_CXX
+ void ReleaseFocus_Impl();
+#endif
+};
+
+// class SvxFillAttrBox --------------------------------------------------
+
+class SvxFillAttrBox : public FillAttrLB
+{
+public:
+ SvxFillAttrBox( Window* pParent, WinBits nBits = WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL );
+ ~SvxFillAttrBox();
+
+ sal_Bool IsRelease() { return bRelease;}
+
+protected:
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ virtual long Notify( NotifyEvent& rNEvt );
+ virtual void Select();
+
+private:
+ sal_uInt16 nCurPos;
+ sal_Bool bRelease;
+
+#ifdef _SVX_ITEMWIN_CXX
+ void ReleaseFocus_Impl();
+#endif
+};
+
+#endif // #ifndef _SVX_ITEMWIN_HXX
+
diff --git a/svx/inc/svx/langbox.hxx b/svx/inc/svx/langbox.hxx
new file mode 100644
index 000000000000..862a442517e7
--- /dev/null
+++ b/svx/inc/svx/langbox.hxx
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_LANGBOX_HXX
+#define _SVX_LANGBOX_HXX
+
+// include ---------------------------------------------------------------
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <vcl/lstbox.hxx>
+#include "svx/svxdllapi.h"
+#include <vcl/image.hxx>
+#include <tools/solar.h>
+#include <layout/layout.hxx>
+
+class SvtLanguageTable;
+
+#define LANG_LIST_EMPTY 0x0000
+#define LANG_LIST_ALL 0x0001
+#define LANG_LIST_WESTERN 0x0002
+#define LANG_LIST_CTL 0x0004
+#define LANG_LIST_CJK 0x0008
+#define LANG_LIST_FBD_CHARS 0x0010
+#define LANG_LIST_SPELL_AVAIL 0x0020
+#define LANG_LIST_HYPH_AVAIL 0x0040
+#define LANG_LIST_THES_AVAIL 0x0080
+#define LANG_LIST_ONLY_KNOWN 0x0100 // list only locales provided by I18N
+#define LANG_LIST_SPELL_USED 0x0200
+#define LANG_LIST_HYPH_USED 0x0400
+#define LANG_LIST_THES_USED 0x0800
+#define LANG_LIST_ALSO_PRIMARY_ONLY 0x1000 // Do not exclude primary-only
+ // languages that do not form a
+ // locale, such as Arabic as
+ // opposed to Arabic-Egypt.
+
+
+// load language strings from resource
+SVX_DLLPUBLIC String GetDicInfoStr( const String& rName, const sal_uInt16 nLang, sal_Bool bNeg );
+
+class SVX_DLLPUBLIC SvxLanguageBox : public ListBox
+{
+public:
+
+private:
+ Image m_aNotCheckedImage;
+ Image m_aCheckedImage;
+ Image m_aCheckedImageHC;
+ String m_aAllString;
+ com::sun::star::uno::Sequence< sal_Int16 > *m_pSpellUsedLang;
+ SvtLanguageTable* m_pLangTable;
+ sal_Int16 m_nLangList;
+ sal_Bool m_bHasLangNone;
+ sal_Bool m_bLangNoneIsLangAll;
+ sal_Bool m_bWithCheckmark;
+
+ SVX_DLLPRIVATE void Init();
+ SVX_DLLPRIVATE sal_uInt16 ImplInsertImgEntry( const String& rEntry, sal_uInt16 nPos, bool bChecked );
+ SVX_DLLPRIVATE sal_uInt16 ImplInsertLanguage(LanguageType, sal_uInt16, sal_Int16 );
+
+public:
+ SvxLanguageBox( Window* pParent, WinBits nWinStyle, sal_Bool bCheck = sal_False);
+ SvxLanguageBox( Window* pParent, const ResId& rResId, sal_Bool bCheck = sal_False);
+ ~SvxLanguageBox();
+
+ void SetLanguageList( sal_Int16 nLangList,
+ sal_Bool bHasLangNone, sal_Bool bLangNoneIsLangAll = sal_False,
+ sal_Bool bCheckSpellAvail = sal_False );
+
+ sal_uInt16 InsertLanguage( const LanguageType eLangType, sal_uInt16 nPos = LISTBOX_APPEND );
+ sal_uInt16 InsertDefaultLanguage( sal_Int16 nType, sal_uInt16 nPos = LISTBOX_APPEND );
+ sal_uInt16 InsertLanguage( const LanguageType eLangType,
+ sal_Bool bCheckEntry, sal_uInt16 nPos = LISTBOX_APPEND );
+ void RemoveLanguage( const LanguageType eLangType );
+ void SelectLanguage( const LanguageType eLangType, sal_Bool bSelect = sal_True );
+ LanguageType GetSelectLanguage() const;
+ sal_Bool IsLanguageSelected( const LanguageType eLangType ) const;
+};
+
+#if ENABLE_LAYOUT
+namespace layout
+{
+class SvxLanguageBoxImpl;
+class SVX_DLLPUBLIC SvxLanguageBox : public ListBox
+{
+ /*DECL_GET_IMPL( SvxLanguageBox );
+ DECL_CONSTRUCTORS( SvxLanguageBox, ListBox, WB_BORDER );
+ DECL_GET_WINDOW (SvxLanguageBox);*/
+
+public:
+ SvxLanguageBox( Context*, const char*, sal_Bool bCheck = sal_False );
+ ~SvxLanguageBox ();
+ void SetLanguageList (sal_Int16 list, bool hasLangNone, bool langNoneIsLangAll=false, bool checkSpellAvailable=false);
+
+ sal_uInt16 InsertLanguage (LanguageType const type, sal_uInt16 pos=LISTBOX_APPEND);
+ sal_uInt16 InsertLanguage (LanguageType const type, bool checkEntry, sal_uInt16 pos=LISTBOX_APPEND);
+ void RemoveLanguage (LanguageType const type);
+ void SelectLanguage (LanguageType const type, bool select=true);
+ LanguageType GetSelectLanguage () const;
+ bool IsLanguageSelected( LanguageType const type) const;
+};
+};
+#endif
+
+#endif
+
diff --git a/svx/inc/svx/lathe3d.hxx b/svx/inc/svx/lathe3d.hxx
new file mode 100644
index 000000000000..714475038fd0
--- /dev/null
+++ b/svx/inc/svx/lathe3d.hxx
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _E3D_LATHE3D_HXX
+#define _E3D_LATHE3D_HXX
+
+#include <svx/obj3d.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* 3D-Rotationsobjekt aus uebergebenem 2D-Polygon erzeugen
+|*
+|* Das aPolyPoly3D wird in nHSegments-Schritten um die Achse rotiert.
+|* nVSegments gibt die Anzahl der Linien von aPolyPoly3D an und stellt damit
+|* quasi eine vertikale Segmentierung dar.
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC E3dLatheObj : public E3dCompoundObject
+{
+private:
+ // Partcodes fuer Wireframe-Generierung: Standard oder Deckelflaeche
+ enum { LATHE_PART_STD = 1, LATHE_PART_COVER = 2 };
+ basegfx::B2DPolyPolygon maPolyPoly2D;
+
+ protected:
+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+ virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
+ void SetDefaultAttributes(E3dDefaultAttributes& rDefault);
+
+ public:
+ TYPEINFO();
+ E3dLatheObj(E3dDefaultAttributes& rDefault, const basegfx::B2DPolyPolygon rPoly2D);
+ E3dLatheObj();
+
+ // HorizontalSegments:
+ sal_uInt32 GetHorizontalSegments() const
+ { return ((const Svx3DHorizontalSegmentsItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_HORZ_SEGS)).GetValue(); }
+
+ // VerticalSegments:
+ sal_uInt32 GetVerticalSegments() const
+ { return ((const Svx3DVerticalSegmentsItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_VERT_SEGS)).GetValue(); }
+
+ // PercentDiagonal: 0..100, before 0.0..0.5
+ sal_uInt16 GetPercentDiagonal() const
+ { return ((const Svx3DPercentDiagonalItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_PERCENT_DIAGONAL)).GetValue(); }
+
+ // BackScale: 0..100, before 0.0..1.0
+ sal_uInt16 GetBackScale() const
+ { return ((const Svx3DBackscaleItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_BACKSCALE)).GetValue(); }
+
+ // EndAngle: 0..10000
+ sal_uInt32 GetEndAngle() const
+ { return ((const Svx3DEndAngleItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_END_ANGLE)).GetValue(); }
+
+ // #107245# GetSmoothNormals() for bLatheSmoothed
+ sal_Bool GetSmoothNormals() const
+ { return ((const Svx3DSmoothNormalsItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_SMOOTH_NORMALS)).GetValue(); }
+
+ // #107245# GetSmoothLids() for bLatheSmoothFrontBack
+ sal_Bool GetSmoothLids() const
+ { return ((const Svx3DSmoothLidsItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_SMOOTH_LIDS)).GetValue(); }
+
+ // #107245# GetCharacterMode() for bLatheCharacterMode
+ sal_Bool GetCharacterMode() const
+ { return ((const Svx3DCharacterModeItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_CHARACTER_MODE)).GetValue(); }
+
+ // #107245# GetCloseFront() for bLatheCloseFront
+ sal_Bool GetCloseFront() const
+ { return ((const Svx3DCloseFrontItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_CLOSE_FRONT)).GetValue(); }
+
+ // #107245# GetCloseBack() for bLatheCloseBack
+ sal_Bool GetCloseBack() const
+ { return ((const Svx3DCloseBackItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_CLOSE_BACK)).GetValue(); }
+
+ virtual sal_uInt16 GetObjIdentifier() const;
+ void ReSegment(sal_uInt32 nHSegs, sal_uInt32 nVSegs);
+
+ virtual void operator=(const SdrObject&);
+
+ virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const;
+
+ // TakeObjName...() ist fuer die Anzeige in der UI, z.B. "3 Rahmen selektiert".
+ virtual void TakeObjNameSingul(String& rName) const;
+ virtual void TakeObjNamePlural(String& rName) const;
+
+ // Lokale Parameter setzen/lesen mit Geometrieneuerzeugung
+ void SetPolyPoly2D(const basegfx::B2DPolyPolygon& rNew);
+ const basegfx::B2DPolyPolygon& GetPolyPoly2D() { return maPolyPoly2D; }
+
+ // Aufbrechen
+ virtual sal_Bool IsBreakObjPossible();
+ virtual SdrAttrObj* GetBreakObj();
+};
+
+#endif // _E3D_LATHE3D_HXX
+
diff --git a/svx/inc/svx/layctrl.hxx b/svx/inc/svx/layctrl.hxx
new file mode 100644
index 000000000000..6137c33a0eb2
--- /dev/null
+++ b/svx/inc/svx/layctrl.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_LAYCTRL_HXX
+#define _SVX_LAYCTRL_HXX
+
+// include ---------------------------------------------------------------
+
+
+#include <sfx2/tbxctrl.hxx>
+#include "svx/svxdllapi.h"
+
+// class SvxTableToolBoxControl ------------------------------------------
+
+class SVX_DLLPUBLIC SvxTableToolBoxControl : public SfxToolBoxControl
+{
+private:
+ FASTBOOL bEnabled;
+
+public:
+ virtual SfxPopupWindowType GetPopupWindowType() const;
+ virtual SfxPopupWindow* CreatePopupWindow();
+ virtual SfxPopupWindow* CreatePopupWindowCascading();
+ virtual void StateChanged( sal_uInt16 nSID,
+ SfxItemState eState,
+ const SfxPoolItem* pState );
+
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SvxTableToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxTableToolBoxControl();
+};
+
+// class SvxColumnsToolBoxControl ----------------------------------------
+
+class SVX_DLLPUBLIC SvxColumnsToolBoxControl : public SfxToolBoxControl
+{
+ FASTBOOL bEnabled;
+public:
+ virtual SfxPopupWindowType GetPopupWindowType() const;
+ virtual SfxPopupWindow* CreatePopupWindow();
+ virtual SfxPopupWindow* CreatePopupWindowCascading();
+
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SvxColumnsToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxColumnsToolBoxControl();
+
+ virtual void StateChanged( sal_uInt16 nSID,
+ SfxItemState eState,
+ const SfxPoolItem* pState );
+};
+
+
+#endif
+
diff --git a/svx/inc/svx/lboxctrl.hxx b/svx/inc/svx/lboxctrl.hxx
new file mode 100644
index 000000000000..6129a17d9c28
--- /dev/null
+++ b/svx/inc/svx/lboxctrl.hxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_LBOXCTRL_HXX_
+#define _SVX_LBOXCTRL_HXX_
+
+#include <sfx2/tbxctrl.hxx>
+#include <rtl/ustring.hxx>
+#include <vector>
+#include "svx/svxdllapi.h"
+
+class ToolBox;
+class SvxPopupWindowListBox;
+
+/////////////////////////////////////////////////////////////////
+
+class SvxListBoxControl : public SfxToolBoxControl
+{
+protected:
+ String aActionStr;
+ SvxPopupWindowListBox * pPopupWin;
+
+ void Impl_SetInfo( sal_uInt16 nCount );
+
+ DECL_LINK( PopupModeEndHdl, void * );
+ DECL_LINK( SelectHdl, void * );
+
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SvxListBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ virtual ~SvxListBoxControl();
+
+ virtual SfxPopupWindowType GetPopupWindowType() const;
+ virtual SfxPopupWindow* CreatePopupWindow();
+ virtual void StateChanged( sal_uInt16 nSID,
+ SfxItemState eState,
+ const SfxPoolItem* pState );
+};
+
+/////////////////////////////////////////////////////////////////
+
+class SVX_DLLPUBLIC SvxUndoRedoControl : public SvxListBoxControl
+{
+ std::vector< ::rtl::OUString > aUndoRedoList;
+ ::rtl::OUString aDefaultText;
+
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SvxUndoRedoControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+
+ virtual ~SvxUndoRedoControl();
+ virtual void StateChanged( sal_uInt16 nSID,
+ SfxItemState eState,
+ const SfxPoolItem* pState );
+
+ virtual SfxPopupWindow* CreatePopupWindow();
+};
+
+#endif
+
diff --git a/svx/inc/svx/linectrl.hxx b/svx/inc/svx/linectrl.hxx
new file mode 100644
index 000000000000..ea553d20aef5
--- /dev/null
+++ b/svx/inc/svx/linectrl.hxx
@@ -0,0 +1,175 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_LINECTRL_HXX
+#define _SVX_LINECTRL_HXX
+
+
+#include <svtools/valueset.hxx>
+#include <svl/lstner.hxx>
+#include <sfx2/tbxctrl.hxx>
+#include "svx/svxdllapi.h"
+
+class XLineStyleItem;
+class XLineDashItem;
+class SvxLineBox;
+class SvxMetricField;
+class SvxColorBox;
+class XLineEndList;
+
+//========================================================================
+// SvxLineStyleController:
+//========================================================================
+
+class SVX_DLLPUBLIC SvxLineStyleToolBoxControl : public SfxToolBoxControl
+{
+private:
+ XLineStyleItem* pStyleItem;
+ XLineDashItem* pDashItem;
+
+ sal_Bool bUpdate;
+
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SvxLineStyleToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxLineStyleToolBoxControl();
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ void Update( const SfxPoolItem* pState );
+ virtual Window* CreateItemWindow( Window *pParent );
+};
+
+//========================================================================
+// SvxLineWidthController:
+//========================================================================
+
+class SVX_DLLPUBLIC SvxLineWidthToolBoxControl : public SfxToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SvxLineWidthToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxLineWidthToolBoxControl();
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ virtual Window* CreateItemWindow( Window *pParent );
+};
+
+//========================================================================
+// SvxLineColorController:
+//========================================================================
+
+class SVX_DLLPUBLIC SvxLineColorToolBoxControl : public SfxToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SvxLineColorToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxLineColorToolBoxControl();
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ void Update( const SfxPoolItem* pState );
+ virtual Window* CreateItemWindow( Window *pParent );
+};
+
+//========================================================================
+// class SvxLineEndWindow
+//========================================================================
+class SvxLineEndWindow : public SfxPopupWindow
+{
+ using FloatingWindow::StateChanged;
+
+private:
+ XLineEndList* pLineEndList;
+ ValueSet aLineEndSet;
+ sal_uInt16 nCols;
+ sal_uInt16 nLines;
+ sal_uIntPtr nLineEndWidth;
+ Size aBmpSize;
+ sal_Bool bPopupMode;
+ bool mbInResize;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame;
+
+
+ DECL_LINK( SelectHdl, void * );
+ void FillValueSet();
+ void SetSize();
+ void implInit();
+
+protected:
+ virtual void Resizing( Size& rSize );
+ virtual void Resize();
+ virtual sal_Bool Close();
+ virtual void PopupModeEnd();
+
+ /** This function is called when the window gets the focus. It grabs
+ the focus to the line ends value set so that it can be controlled with
+ the keyboard.
+ */
+ virtual void GetFocus (void);
+
+public:
+ SvxLineEndWindow( sal_uInt16 nId,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ const String& rWndTitle );
+ SvxLineEndWindow( sal_uInt16 nId,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ Window* pParentWindow,
+ const String& rWndTitle );
+ ~SvxLineEndWindow();
+
+ void StartSelection();
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ virtual SfxPopupWindow* Clone() const;
+};
+
+//========================================================================
+// class SvxColorToolBoxControl
+//========================================================================
+
+class SVX_DLLPUBLIC SvxLineEndToolBoxControl : public SfxToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxLineEndToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxLineEndToolBoxControl();
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ virtual SfxPopupWindowType GetPopupWindowType() const;
+ virtual SfxPopupWindow* CreatePopupWindow();
+};
+
+
+
+#endif
+
diff --git a/svx/inc/svx/measctrl.hxx b/svx/inc/svx/measctrl.hxx
new file mode 100644
index 000000000000..d45dc134cf19
--- /dev/null
+++ b/svx/inc/svx/measctrl.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_MEASCTRL_HXX
+#define _SVX_MEASCTRL_HXX
+
+// include ---------------------------------------------------------------
+
+#ifndef _CTRL_HXX //autogen
+#include <vcl/ctrl.hxx>
+#endif
+#include "svx/svxdllapi.h"
+
+
+class SfxItemSet;
+class SdrMeasureObj;
+class SdrModel;
+
+/*************************************************************************
+|*
+|* SvxXMeasurePreview
+|*
+\************************************************************************/
+class SVX_DLLPUBLIC SvxXMeasurePreview : public Control
+{
+ friend class SvxMeasurePage;
+
+private:
+ const SfxItemSet& rAttrs;
+ SdrMeasureObj* pMeasureObj;
+ SdrModel* pModel;
+
+public:
+ SvxXMeasurePreview( Window* pParent, const ResId& rResId,
+ const SfxItemSet& rInAttrs );
+ ~SvxXMeasurePreview();
+
+ virtual void Paint( const Rectangle& rRect );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+
+ void SetAttributes( const SfxItemSet& rInAttrs );
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+};
+
+#endif
+
diff --git a/svx/inc/svx/modctrl.hxx b/svx/inc/svx/modctrl.hxx
new file mode 100644
index 000000000000..8b7702341dbc
--- /dev/null
+++ b/svx/inc/svx/modctrl.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_MODCTRL_HXX
+#define _SVX_MODCTRL_HXX
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/stbitem.hxx>
+#include "svx/svxdllapi.h"
+
+// class SvxModifyControl ------------------------------------------------
+
+class SVX_DLLPUBLIC SvxModifyControl : public SfxStatusBarControl
+{
+public:
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ virtual void Paint( const UserDrawEvent& rEvt );
+
+ SFX_DECL_STATUSBAR_CONTROL();
+
+ SvxModifyControl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar& rStb );
+
+ static sal_uIntPtr GetDefItemWidth(const StatusBar& rStb);
+
+private:
+ sal_Bool bState;
+
+#ifdef _SVX_MODCTRL_CXX
+ SVX_DLLPRIVATE void DrawItemText_Impl();
+#endif
+};
+
+
+#endif
+
diff --git a/svx/inc/svx/msdffdef.hxx b/svx/inc/svx/msdffdef.hxx
new file mode 100644
index 000000000000..92f00114edf4
--- /dev/null
+++ b/svx/inc/svx/msdffdef.hxx
@@ -0,0 +1,1223 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _MSDFFDEF_HXX
+#define _MSDFFDEF_HXX
+
+
+#include <tools/solar.h>
+#include <tools/stream.hxx>
+#ifndef _TABLE_HXX
+#include <tools/table.hxx>
+#endif
+#include <tools/string.hxx>
+#include <tools/gen.hxx>
+#include "svx/svxdllapi.h"
+
+#define DFF_COMMON_RECORD_HEADER_SIZE 8
+
+#define DFF_PSFLAG_CONTAINER 0x0F // If the version field of a record
+ // header takes on this value, the
+ // record header marks the start of
+ // a container.
+
+#define DFF_PST_Unknown 0
+#define DFF_PST_SubContainerCompleted 1
+#define DFF_PST_IRRAtom 2
+#define DFF_PST_PSS 3
+#define DFF_PST_SubContainerException 4
+#define DFF_PST_ClientSignal1 6
+#define DFF_PST_ClientSignal2 7
+#define DFF_PST_PowerPointStateInfoAtom 10
+#define DFF_PST_Document 1000
+#define DFF_PST_DocumentAtom 1001
+#define DFF_PST_EndDocument 1002
+#define DFF_PST_SlidePersist 1003
+#define DFF_PST_SlideBase 1004
+#define DFF_PST_SlideBaseAtom 1005
+#define DFF_PST_Slide 1006
+#define DFF_PST_SlideAtom 1007
+#define DFF_PST_Notes 1008
+#define DFF_PST_NotesAtom 1009
+#define DFF_PST_Environment 1010
+#define DFF_PST_SlidePersistAtom 1011
+#define DFF_PST_Scheme 1012
+#define DFF_PST_SchemeAtom 1013
+#define DFF_PST_DocViewInfo 1014
+#define DFF_PST_SslideLayoutAtom 1015
+#define DFF_PST_MainMaster 1016
+#define DFF_PST_SSSlideInfoAtom 1017
+#define DFF_PST_SlideViewInfo 1018
+#define DFF_PST_GuideAtom 1019
+#define DFF_PST_ViewInfo 1020
+#define DFF_PST_ViewInfoAtom 1021
+#define DFF_PST_SlideViewInfoAtom 1022
+#define DFF_PST_VBAInfo 1023
+#define DFF_PST_VBAInfoAtom 1024
+#define DFF_PST_SSDocInfoAtom 1025
+#define DFF_PST_Summary 1026
+#define DFF_PST_Texture 1027
+#define DFF_PST_VBASlideInfo 1028
+#define DFF_PST_VBASlideInfoAtom 1029
+#define DFF_PST_DocRoutingSlip 1030
+#define DFF_PST_OutlineViewInfo 1031
+#define DFF_PST_SorterViewInfo 1032
+#define DFF_PST_ExObjList 1033
+#define DFF_PST_ExObjListAtom 1034
+#define DFF_PST_PPDrawingGroup 1035
+#define DFF_PST_PPDrawing 1036
+#define DFF_PST_NamedShows 1040
+#define DFF_PST_NamedShow 1041
+#define DFF_PST_NamedShowSlides 1042
+#define DFF_PST_List 2000
+#define DFF_PST_FontCollection 2005
+#define DFF_PST_ListPlaceholder 2017
+#define DFF_PST_BookmarkCollection 2019
+#define DFF_PST_SoundCollection 2020
+#define DFF_PST_SoundCollAtom 2021
+#define DFF_PST_Sound 2022
+#define DFF_PST_SoundData 2023
+#define DFF_PST_BookmarkSeedAtom 2025
+#define DFF_PST_GuideList 2026
+#define DFF_PST_RunArray 2028
+#define DFF_PST_RunArrayAtom 2029
+#define DFF_PST_ArrayElementAtom 2030
+#define DFF_PST_Int4ArrayAtom 2031
+#define DFF_PST_ColorSchemeAtom 2032
+#define DFF_PST_OEShape 3008
+#define DFF_PST_ExObjRefAtom 3009
+#define DFF_PST_OEPlaceholderAtom 3011
+#define DFF_PST_GrColor 3020
+#define DFF_PST_GrectAtom 3025
+#define DFF_PST_GratioAtom 3031
+#define DFF_PST_Gscaling 3032
+#define DFF_PST_GpointAtom 3034
+#define DFF_PST_OEShapeAtom 3035
+#define DFF_PST_OutlineTextRefAtom 3998
+#define DFF_PST_TextHeaderAtom 3999
+#define DFF_PST_TextCharsAtom 4000
+#define DFF_PST_StyleTextPropAtom 4001
+#define DFF_PST_BaseTextPropAtom 4002
+#define DFF_PST_TxMasterStyleAtom 4003
+#define DFF_PST_TxCFStyleAtom 4004
+#define DFF_PST_TxPFStyleAtom 4005
+#define DFF_PST_TextRulerAtom 4006
+#define DFF_PST_TextBookmarkAtom 4007
+#define DFF_PST_TextBytesAtom 4008
+#define DFF_PST_TxSIStyleAtom 4009
+#define DFF_PST_TextSpecInfoAtom 4010
+#define DFF_PST_DefaultRulerAtom 4011
+#define DFF_PST_FontEntityAtom 4023
+#define DFF_PST_FontEmbedData 4024
+#define DFF_PST_TypeFace 4025
+#define DFF_PST_CString 4026
+#define DFF_PST_ExternalObject 4027
+#define DFF_PST_MetaFile 4033
+#define DFF_PST_ExOleObj 4034
+#define DFF_PST_ExOleObjAtom 4035
+#define DFF_PST_ExPlainLinkAtom 4036
+#define DFF_PST_CorePict 4037
+#define DFF_PST_CorePictAtom 4038
+#define DFF_PST_ExPlainAtom 4039
+#define DFF_PST_SrKinsoku 4040
+#define DFF_PST_Handout 4041
+#define DFF_PST_ExEmbed 4044
+#define DFF_PST_ExEmbedAtom 4045
+#define DFF_PST_ExLink 4046
+#define DFF_PST_ExLinkAtom_old 4047
+#define DFF_PST_BookmarkEntityAtom 4048
+#define DFF_PST_ExLinkAtom 4049
+#define DFF_PST_SrKinsokuAtom 4050
+#define DFF_PST_ExHyperlinkAtom 4051
+#define DFF_PST_ExPlain 4053
+#define DFF_PST_ExPlainLink 4054
+#define DFF_PST_ExHyperlink 4055
+#define DFF_PST_SlideNumberMCAtom 4056
+#define DFF_PST_HeadersFooters 4057
+#define DFF_PST_HeadersFootersAtom 4058
+#define DFF_PST_RecolorEntryAtom 4062
+#define DFF_PST_TxInteractiveInfoAtom 4063
+#define DFF_PST_EmFormatAtom 4065
+#define DFF_PST_CharFormatAtom 4066
+#define DFF_PST_ParaFormatAtom 4067
+#define DFF_PST_MasterText 4068
+#define DFF_PST_RecolorInfoAtom 4071
+#define DFF_PST_ExQuickTime 4073
+#define DFF_PST_ExQuickTimeMovie 4074
+#define DFF_PST_ExQuickTimeMovieData 4075
+#define DFF_PST_ExSubscription 4076
+#define DFF_PST_ExSubscriptionSection 4077
+#define DFF_PST_ExControl 4078
+#define DFF_PST_ExControlAtom 4091
+#define DFF_PST_SlideListWithText 4080
+#define DFF_PST_AnimationInfoAtom 4081
+#define DFF_PST_InteractiveInfo 4082
+#define DFF_PST_InteractiveInfoAtom 4083
+#define DFF_PST_SlideList 4084
+#define DFF_PST_UserEditAtom 4085
+#define DFF_PST_CurrentUserAtom 4086
+#define DFF_PST_DateTimeMCAtom 4087
+#define DFF_PST_GenericDateMCAtom 4088
+#define DFF_PST_HeaderMCAtom 4089
+#define DFF_PST_FooterMCAtom 4090
+#define DFF_PST_ExMediaAtom 4100
+#define DFF_PST_ExVideo 4101
+#define DFF_PST_ExAviMovie 4102
+#define DFF_PST_ExMCIMovie 4103
+#define DFF_PST_ExMIDIAudio 4109
+#define DFF_PST_ExCDAudio 4110
+#define DFF_PST_ExWAVAudioEmbedded 4111
+#define DFF_PST_ExWAVAudioLink 4112
+#define DFF_PST_ExOleObjStg 4113
+#define DFF_PST_ExCDAudioAtom 4114
+#define DFF_PST_ExWAVAudioEmbeddedAtom 4115
+#define DFF_PST_AnimationInfo 4116
+#define DFF_PST_RTFDateTimeMCAtom 4117
+#define DFF_PST_ProgTags 5000
+#define DFF_PST_ProgStringTag 5001
+#define DFF_PST_ProgBinaryTag 5002
+#define DFF_PST_BinaryTagData 5003
+#define DFF_PST_PrintOptions 6000
+#define DFF_PST_PersistPtrFullBlock 6001
+#define DFF_PST_PersistPtrIncrementalBlock 6002
+#define DFF_PST_RulerIndentAtom 10000
+#define DFF_PST_GscalingAtom 10001
+#define DFF_PST_GrColorAtom 10002
+#define DFF_PST_GLPointAtom 10003
+#define DFF_PST_GlineAtom 10004
+
+// Record Name FBT-Value Instance Contents Wrd Exl Ppt Ver
+
+#define DFF_msofbtDggContainer 0xF000 // per-document data X X X
+#define DFF_msofbtDgg 0xF006 // an FDGG and several FIDCLs X X X 0
+#define DFF_msofbtCLSID 0xF016 // the CLSID of the application that put the data on the clipboard C C C 0
+#define DFF_msofbtOPT 0xF00B // count of properties the document-wide default shape properties X X X 3
+#define DFF_msofbtColorMRU 0xF11A // count of colors the colors in the MRU swatch X X X 0
+#define DFF_msofbtSplitMenuColors 0xF11E // count of colors the colors in the top-level split menus X X X 0
+#define DFF_msofbtBstoreContainer 0xF001 // count of BLIPs all images in the document (JPEGs, metafiles, etc.) X X X
+#define DFF_msofbtBSE 0xF007 // BLIP type an FBSE (one per BLIP) X X X 2
+#define DFF_msofbtBlipFirst 0xF018 // range of fbts reserved for various kinds of BLIPs X X X
+#define DFF_msofbtBlipLast 0xF117 // range of fbts reserved for various kinds of BLIPs X X X
+
+#define DFF_msofbtDgContainer 0xF002 // per-sheet/page/slide data X X X
+#define DFF_msofbtDg 0xF008 // drawing ID an FDG X X X 0
+#define DFF_msofbtRegroupItems 0xF118 // count of regroup entries several FRITs X X X 0
+#define DFF_msofbtColorScheme 0xF120 // count of colors the colors of the source host's color scheme C C 0
+#define DFF_msofbtSpgrContainer 0xF003 // several SpContainers, the first of which is the group shape itself X X X
+#define DFF_msofbtSpContainer 0xF004 // a shape X X X
+#define DFF_msofbtSpgr 0xF009 // an FSPGR; only present if the shape is a group shape X X X 1
+#define DFF_msofbtSp 0xF00A // shape type an FSP X X X 2
+#define DFF_msofbtTextbox 0xF00C // RTF text C C C 0
+#define DFF_msofbtClientTextbox 0xF00D // host-defined the text in the textbox, in host-defined format X X X
+#define DFF_msofbtAnchor 0xF00E // a RECT, in 100000ths of an inch C C C 0
+#define DFF_msofbtChildAnchor 0xF00F // a RECT, in units relative to the parent group X X X 0
+#define DFF_msofbtClientAnchor 0xF010 // host-defined the location of the shape, in a host-defined format X X X
+#define DFF_msofbtClientData 0xF011 // host-defined host-specific data X X X
+#define DFF_msofbtOleObject 0xF11F // a serialized IStorage for an OLE object C C C 0
+#define DFF_msofbtDeletedPspl 0xF11D // an FPSPL; only present in top-level deleted shapes X 0
+#define DFF_msofbtUDefProp 0xF122 // range of fbts reserved for various kinds of BLIPs X X X
+#define DFF_msofbtSolverContainer 0xF005 // count of rules the rules governing shapes X X X
+#define DFF_msofbtConnectorRule 0xF012 // an FConnectorRule X X 1
+#define DFF_msofbtAlignRule 0xF013 // an FAlignRule X X X 0
+#define DFF_msofbtArcRule 0xF014 // an FARCRU X X X 0
+#define DFF_msofbtClientRule 0xF015 // host-defined host-defined
+#define DFF_msofbtCalloutRule 0xF017 // an FCORU X X X 0
+
+#define DFF_msofbtSelection 0xF119 // an FDGSL followed by the SPIDs of the shapes in the selection X 0
+
+// Werte fuer den sal_uIntPtr im DFF_PST_TextHeaderAtom
+enum DFF_TextHeader {
+ DFFTH_TITLE,
+ DFFTH_BODY,
+ DFFTH_NOTES,
+ DFFTH_NOTUSED,
+ DFFTH_OTHER, // Text in a Shape
+ DFFTH_CENTERBODY, // Subtitle in Title-Slide
+ DFFTH_CENTERTITLE, // Title in Title-Slide
+ DFFTH_HALFBODY, // Body in two-column slide
+ DFFTH_QUARTERBODY // Body in four-body slide
+};
+
+
+// Shape Properties
+// 1pt = 12700 EMU (English Metric Units)
+// 1pt = 20 Twip = 20/1440" = 1/72"
+// 1twip=635 EMU
+// 1" = 12700*72 = 914400 EMU
+// 1" = 25.4mm
+// 1mm = 36000 EMU
+// Transform
+#define DFF_Prop_Rotation 4 // Fixed Point 16.16 degrees
+// Protection
+#define DFF_Prop_LockRotation 119 // sal_Bool No rotation
+#define DFF_Prop_LockAspectRatio 120 // sal_Bool Don't allow changes in aspect ratio
+#define DFF_Prop_LockPosition 121 // sal_Bool Don't allow the shape to be moved
+#define DFF_Prop_LockAgainstSelect 122 // sal_Bool Shape may not be selected
+#define DFF_Prop_LockCropping 123 // sal_Bool No cropping this shape
+#define DFF_Prop_LockVertices 124 // sal_Bool Edit Points not allowed
+#define DFF_Prop_LockText 125 // sal_Bool Do not edit text
+#define DFF_Prop_LockAdjustHandles 126 // sal_Bool Do not adjust
+#define DFF_Prop_LockAgainstGrouping 127 // sal_Bool Do not group this shape
+// Text
+#define DFF_Prop_lTxid 128 // LONG id for the text, value determined by the host
+#define DFF_Prop_dxTextLeft 129 // LONG margins relative to shape's inscribed text rectangle (in EMUs)
+#define DFF_Prop_dyTextTop 130 // LONG
+#define DFF_Prop_dxTextRight 131 // LONG
+#define DFF_Prop_dyTextBottom 132 // LONG
+#define DFF_Prop_WrapText 133 // MSO_WRAPMODE Wrap text at shape margins
+#define DFF_Prop_scaleText 134 // LONG Text zoom/scale (used if fFitTextToShape)
+#define DFF_Prop_anchorText 135 // MSO_ANCHOR How to anchor the text
+#define DFF_Prop_txflTextFlow 136 // MSO_TXFL Text flow
+#define DFF_Prop_cdirFont 137 // MSO_CDIR Font rotation
+#define DFF_Prop_hspNext 138 // MSO_HSP ID of the next shape (used by Word for linked textboxes)
+#define DFF_Prop_txdir 139 // MSO_TXDIR Bi-Di Text direction
+#define DFF_Prop_SelectText 187 // sal_Bool sal_True if single click selects text, sal_False if two clicks
+#define DFF_Prop_AutoTextMargin 188 // sal_Bool use host's margin calculations
+#define DFF_Prop_RotateText 189 // sal_Bool Rotate text with shape
+#define DFF_Prop_FitShapeToText 190 // sal_Bool Size shape to fit text size
+#define DFF_Prop_FitTextToShape 191 // sal_Bool Size text to fit shape size
+// GeoText
+#define DFF_Prop_gtextUNICODE 192 // WCHAR* UNICODE text string
+#define DFF_Prop_gtextRTF 193 // char* RTF text string
+#define DFF_Prop_gtextAlign 194 // MSO_GEOTEXTALIGN alignment on curve
+#define DFF_Prop_gtextSize 195 // LONG default point size
+#define DFF_Prop_gtextSpacing 196 // LONG fixed point 16.16
+#define DFF_Prop_gtextFont 197 // WCHAR* font family name
+#define DFF_Prop_gtextFReverseRows 240 // sal_Bool 8000 Reverse row order
+#define DFF_Prop_fGtext 241 // sal_Bool 4000 Has text effect
+#define DFF_Prop_gtextFVertical 242 // sal_Bool 2000 Rotate characters
+#define DFF_Prop_gtextFKern 243 // sal_Bool 1000 Kern characters
+#define DFF_Prop_gtextFTight 244 // sal_Bool 800 Tightening or tracking
+#define DFF_Prop_gtextFStretch 245 // sal_Bool 400 Stretch to fit shape
+#define DFF_Prop_gtextFShrinkFit 246 // sal_Bool 200 Char bounding box
+#define DFF_Prop_gtextFBestFit 247 // sal_Bool 100 Scale text-on-path
+#define DFF_Prop_gtextFNormalize 248 // sal_Bool 80 Stretch char height
+#define DFF_Prop_gtextFDxMeasure 249 // sal_Bool 40 Do not measure along path
+#define DFF_Prop_gtextFBold 250 // sal_Bool 20 Bold font
+#define DFF_Prop_gtextFItalic 251 // sal_Bool 10 Italic font
+#define DFF_Prop_gtextFUnderline 252 // sal_Bool 8 Underline font
+#define DFF_Prop_gtextFShadow 253 // sal_Bool 4 Shadow font
+#define DFF_Prop_gtextFSmallcaps 254 // sal_Bool 2 Small caps font
+#define DFF_Prop_gtextFStrikethrough 255 // sal_Bool 1 Strike through font
+// Blip
+#define DFF_Prop_cropFromTop 256 // LONG 16.16 fraction times total image width or height, as appropriate.
+#define DFF_Prop_cropFromBottom 257 // LONG
+#define DFF_Prop_cropFromLeft 258 // LONG
+#define DFF_Prop_cropFromRight 259 // LONG
+#define DFF_Prop_pib 260 // IMsoBlip* Blip to display
+#define DFF_Prop_pibName 261 // WCHAR* Blip file name
+#define DFF_Prop_pibFlags 262 // MSO_BLIPFLAGS Blip flags
+#define DFF_Prop_pictureTransparent 263 // LONG transparent color (none if ~0UL)
+#define DFF_Prop_pictureContrast 264 // LONG contrast setting
+#define DFF_Prop_pictureBrightness 265 // LONG brightness setting
+#define DFF_Prop_pictureGamma 266 // LONG 16.16 gamma
+#define DFF_Prop_pictureId 267 // LONG Host-defined ID for OLE objects (usually a pointer)
+#define DFF_Prop_pictureDblCrMod 268 // MSO_CLR Modification used if shape has double shadow
+#define DFF_Prop_pictureFillCrMod 269 // MSO_CLR
+#define DFF_Prop_pictureLineCrMod 270 // MSO_CLR
+#define DFF_Prop_pibPrint 271 // IMsoBlip* Blip to display when printing
+#define DFF_Prop_pibPrintName 272 // WCHAR* Blip file name
+#define DFF_Prop_pibPrintFlags 273 // MSO_BLIPFLAGS Blip flags
+#define DFF_Prop_fNoHitTestPicture 316 // sal_Bool Do not hit test the picture
+#define DFF_Prop_pictureGray 317 // sal_Bool grayscale display
+#define DFF_Prop_pictureBiLevel 318 // sal_Bool bi-level display
+#define DFF_Prop_pictureActive 319 // sal_Bool Server is active (OLE objects only)
+// Geometry
+#define DFF_Prop_geoLeft 320 // LONG Defines the G (geometry) coordinate space.
+#define DFF_Prop_geoTop 321 // LONG
+#define DFF_Prop_geoRight 322 // LONG
+#define DFF_Prop_geoBottom 323 // LONG
+#define DFF_Prop_shapePath 324 // MSO_SHAPEPATH
+#define DFF_Prop_pVertices 325 // IMsoArray An array of points, in G units.
+#define DFF_Prop_pSegmentInfo 326 // IMsoArray
+#define DFF_Prop_adjustValue 327 // LONG Adjustment values corresponding to the positions of the
+#define DFF_Prop_adjust2Value 328 // LONG adjust handles of the shape. The number of values used
+#define DFF_Prop_adjust3Value 329 // LONG and their allowable ranges vary from shape type to shape type.
+#define DFF_Prop_adjust4Value 330 // LONG
+#define DFF_Prop_adjust5Value 331 // LONG
+#define DFF_Prop_adjust6Value 332 // LONG
+#define DFF_Prop_adjust7Value 333 // LONG
+#define DFF_Prop_adjust8Value 334 // LONG
+#define DFF_Prop_adjust9Value 335 // LONG
+#define DFF_Prop_adjust10Value 336 // LONG
+#define DFF_Prop_connectorPoints 337 // IMsoArray
+#define DFF_Prop_stretchPointX 339 // LONG
+#define DFF_Prop_stretchPointY 340 // LONG
+#define DFF_Prop_Handles 341 // H*
+#define DFF_Prop_pFormulas 342 // LONG
+#define DFF_Prop_textRectangles 343 // LONG
+#define DFF_Prop_connectorType 344 // LONG ->0=none, 1=segments, 2=custom, 3=rect
+#define DFF_Prop_fShadowOK 378 // sal_Bool Shadow may be set
+#define DFF_Prop_f3DOK 379 // sal_Bool 3D may be set
+#define DFF_Prop_fLineOK 380 // sal_Bool Line style may be set
+#define DFF_Prop_fGtextOK 381 // sal_Bool Text effect (FontWork) supported
+#define DFF_Prop_fFillShadeShapeOK 382 // BOOL
+#define DFF_Prop_fFillOK 383 // sal_Bool OK to fill the shape through the UI or VBA?
+// FillStyle
+#define DFF_Prop_fillType 384 // MSO_FILLTYPE Type of fill
+#define DFF_Prop_fillColor 385 // MSO_CLR Foreground color
+#define DFF_Prop_fillOpacity 386 // LONG Fixed 16.16
+#define DFF_Prop_fillBackColor 387 // MSO_CLR Background color
+#define DFF_Prop_fillBackOpacity 388 // LONG Shades only
+#define DFF_Prop_fillCrMod 389 // MSO_CLR Modification for BW views
+#define DFF_Prop_fillBlip 390 // IMsoBlip* Pattern/texture
+#define DFF_Prop_fillBlipName 391 // WCHAR* Blip file name
+#define DFF_Prop_fillBlipFlags 392 // MSO_BLIPFLAGS Blip flags
+#define DFF_Prop_fillWidth 393 // LONG How big (A units) to make a metafile texture.
+#define DFF_Prop_fillHeight 394 // LONG
+#define DFF_Prop_fillAngle 395 // LONG Fade angle - degrees in 16.16
+#define DFF_Prop_fillFocus 396 // LONG Linear shaded fill focus percent
+#define DFF_Prop_fillToLeft 397 // LONG Fraction 16.16
+#define DFF_Prop_fillToTop 398 // LONG Fraction 16.16
+#define DFF_Prop_fillToRight 399 // LONG Fraction 16.16
+#define DFF_Prop_fillToBottom 400 // LONG Fraction 16.16
+#define DFF_Prop_fillRectLeft 401 // LONG For shaded fills, use the specified rectangle instead of the shape's bounding rect to define how large the fade is going to be.
+#define DFF_Prop_fillRectTop 402 // LONG
+#define DFF_Prop_fillRectRight 403 // LONG
+#define DFF_Prop_fillRectBottom 404 // LONG
+#define DFF_Prop_fillDztype 405 // MSO_DZTYPE
+#define DFF_Prop_fillShadePreset 406 // LONG Special shades
+#define DFF_Prop_fillShadeColors 407 // IMsoArray a preset array of colors
+#define DFF_Prop_fillOriginX 408 // LONG
+#define DFF_Prop_fillOriginY 409 // LONG
+#define DFF_Prop_fillShapeOriginX 410 // LONG
+#define DFF_Prop_fillShapeOriginY 411 // LONG
+#define DFF_Prop_fillShadeType 412 // MSO_SHADETYPE Type of shading, if a shaded (gradient) fill.
+#define DFF_Prop_fFilled 443 // sal_Bool Is shape filled?
+#define DFF_Prop_fHitTestFill 444 // sal_Bool Should we hit test fill?
+#define DFF_Prop_fillShape 445 // sal_Bool Register pattern on shape
+#define DFF_Prop_fillUseRect 446 // sal_Bool Use the large rect?
+#define DFF_Prop_fNoFillHitTest 447 // sal_Bool Hit test a shape as though filled
+// LineStyle
+#define DFF_Prop_lineColor 448 // MSO_CLR Color of line
+#define DFF_Prop_lineOpacity 449 // LONG Not implemented
+#define DFF_Prop_lineBackColor 450 // MSO_CLR Background color
+#define DFF_Prop_lineCrMod 451 // MSO_CLR Modification for BW views
+#define DFF_Prop_lineType 452 // MSO_LINETYPE Type of line
+#define DFF_Prop_lineFillBlip 453 // IMsoBlip* Pattern/texture
+#define DFF_Prop_lineFillBlipName 454 // WCHAR* Blip file name
+#define DFF_Prop_lineFillBlipFlags 455 // MSO_BLIPFLAGS Blip flags
+#define DFF_Prop_lineFillWidth 456 // LONG How big (A units) to make a metafile texture.
+#define DFF_Prop_lineFillHeight 457 // LONG
+#define DFF_Prop_lineFillDztype 458 // MSO_DZTYPE How to interpret fillWidth/Height numbers.
+#define DFF_Prop_lineWidth 459 // LONG A units; 1pt == 12700 EMUs
+#define DFF_Prop_lineMiterLimit 460 // LONG ratio (16.16) of width
+#define DFF_Prop_lineStyle 461 // MSO_LINESTYLE Draw parallel lines?
+#define DFF_Prop_lineDashing 462 // MSO_LINEDASHING Can be overridden by:
+#define DFF_Prop_lineDashStyle 463 // IMsoArray As Win32 ExtCreatePen
+#define DFF_Prop_lineStartArrowhead 464 // MSO_LINEEND Arrow at start
+#define DFF_Prop_lineEndArrowhead 465 // MSO_LINEEND Arrow at end
+#define DFF_Prop_lineStartArrowWidth 466 // MSO_LINEENDWIDTH Arrow at start
+#define DFF_Prop_lineStartArrowLength 467 // MSO_LINEENDLENGTH Arrow at end
+#define DFF_Prop_lineEndArrowWidth 468 // MSO_LINEENDWIDTH Arrow at start
+#define DFF_Prop_lineEndArrowLength 469 // MSO_LINEENDLENGTH Arrow at end
+#define DFF_Prop_lineJoinStyle 470 // MSO_LINEJOIN How to join lines
+#define DFF_Prop_lineEndCapStyle 471 // MSO_LINECAP How to end lines
+#define DFF_Prop_fArrowheadsOK 507 // sal_Bool Allow arrowheads if prop. is set
+#define DFF_Prop_fLine 508 // sal_Bool Any line?
+#define DFF_Prop_fHitTestLine 509 // sal_Bool Should we hit test lines?
+#define DFF_Prop_lineFillShape 510 // sal_Bool Register pattern on shape
+#define DFF_Prop_fNoLineDrawDash 511 // sal_Bool Draw a dashed line if no line
+// ShadowStyle
+#define DFF_Prop_shadowType 512 // MSO_SHADOWTYPE Type of effect
+#define DFF_Prop_shadowColor 513 // MSO_CLR Foreground color
+#define DFF_Prop_shadowHighlight 514 // MSO_CLR Embossed color
+#define DFF_Prop_shadowCrMod 515 // MSO_CLR Modification for BW views
+#define DFF_Prop_shadowOpacity 516 // LONG Fixed 16.16
+#define DFF_Prop_shadowOffsetX 517 // LONG Offset shadow
+#define DFF_Prop_shadowOffsetY 518 // LONG Offset shadow
+#define DFF_Prop_shadowSecondOffsetX 519 // LONG Double offset shadow
+#define DFF_Prop_shadowSecondOffsetY 520 // LONG Double offset shadow
+#define DFF_Prop_shadowScaleXToX 521 // LONG 16.16
+#define DFF_Prop_shadowScaleYToX 522 // LONG 16.16
+#define DFF_Prop_shadowScaleXToY 523 // LONG 16.16
+#define DFF_Prop_shadowScaleYToY 524 // LONG 16.16
+#define DFF_Prop_shadowPerspectiveX 525 // LONG 16.16 / weight
+#define DFF_Prop_shadowPerspectiveY 526 // LONG 16.16 / weight
+#define DFF_Prop_shadowWeight 527 // LONG scaling factor
+#define DFF_Prop_shadowOriginX 528 // LONG
+#define DFF_Prop_shadowOriginY 529 // LONG
+#define DFF_Prop_fShadow 574 // sal_Bool Any shadow?
+#define DFF_Prop_fshadowObscured 575 // sal_Bool Excel5-style shadow
+// PerspectiveStyle
+#define DFF_Prop_perspectiveType 576 // MSO_XFORMTYPE Where transform applies
+#define DFF_Prop_perspectiveOffsetX 577 // LONG The LONG values define a transformation matrix, effectively, each value is scaled by the perspectiveWeight parameter.
+#define DFF_Prop_perspectiveOffsetY 578 // LONG
+#define DFF_Prop_perspectiveScaleXToX 579 // LONG
+#define DFF_Prop_perspectiveScaleYToX 580 // LONG
+#define DFF_Prop_perspectiveScaleXToY 581 // LONG
+#define DFF_Prop_perspectiveScaleYToY 582 // LONG
+#define DFF_Prop_perspectivePerspectiveX 583 // LONG
+#define DFF_Prop_perspectivePerspectiveY 584 // LONG
+#define DFF_Prop_perspectiveWeight 585 // LONG Scaling factor
+#define DFF_Prop_perspectiveOriginX 586 // LONG
+#define DFF_Prop_perspectiveOriginY 587 // LONG
+#define DFF_Prop_fPerspective 639 // sal_Bool On/off
+// 3D Object
+#define DFF_Prop_c3DSpecularAmt 640 // LONG Fixed-point 16.16
+#define DFF_Prop_c3DDiffuseAmt 641 // LONG Fixed-point 16.16
+#define DFF_Prop_c3DShininess 642 // LONG Default gives OK results
+#define DFF_Prop_c3DEdgeThickness 643 // LONG Specular edge thickness
+#define DFF_Prop_c3DExtrudeForward 644 // LONG Distance of extrusion in EMUs
+#define DFF_Prop_c3DExtrudeBackward 645 // LONG
+#define DFF_Prop_c3DExtrudePlane 646 // LONG Extrusion direction
+#define DFF_Prop_c3DExtrusionColor 647 // MSO_CLR Basic color of extruded part of shape; the lighting model used will determine the exact shades used when rendering.
+#define DFF_Prop_c3DCrMod 648 // MSO_CLR Modification for BW views
+#define DFF_Prop_f3D 700 // sal_Bool Does this shape have a 3D effect?
+#define DFF_Prop_fc3DMetallic 701 // sal_Bool Use metallic specularity?
+#define DFF_Prop_fc3DUseExtrusionColor 702 // BOOL
+#define DFF_Prop_fc3DLightFace 703 // BOOL
+// 3D Style
+#define DFF_Prop_c3DYRotationAngle 704 // LONG degrees (16.16) about y axis
+#define DFF_Prop_c3DXRotationAngle 705 // LONG degrees (16.16) about x axis
+#define DFF_Prop_c3DRotationAxisX 706 // LONG These specify the rotation axis; only their relative magnitudes matter.
+#define DFF_Prop_c3DRotationAxisY 707 // LONG
+#define DFF_Prop_c3DRotationAxisZ 708 // LONG
+#define DFF_Prop_c3DRotationAngle 709 // LONG degrees (16.16) about axis
+#define DFF_Prop_c3DRotationCenterX 710 // LONG rotation center x (16.16 or g-units)
+#define DFF_Prop_c3DRotationCenterY 711 // LONG rotation center y (16.16 or g-units)
+#define DFF_Prop_c3DRotationCenterZ 712 // LONG rotation center z (absolute (emus))
+#define DFF_Prop_c3DRenderMode 713 // MSO_3DRENDERMODE Full,wireframe, or bcube
+#define DFF_Prop_c3DTolerance 714 // LONG pixels (16.16)
+#define DFF_Prop_c3DXViewpoint 715 // LONG X view point (emus)
+#define DFF_Prop_c3DYViewpoint 716 // LONG Y view point (emus)
+#define DFF_Prop_c3DZViewpoint 717 // LONG Z view distance (emus)
+#define DFF_Prop_c3DOriginX 718 // LONG
+#define DFF_Prop_c3DOriginY 719 // LONG
+#define DFF_Prop_c3DSkewAngle 720 // LONG degree (16.16) skew angle
+#define DFF_Prop_c3DSkewAmount 721 // LONG Percentage skew amount
+#define DFF_Prop_c3DAmbientIntensity 722 // LONG Fixed point intensity
+#define DFF_Prop_c3DKeyX 723 // LONG Key light source direc-
+#define DFF_Prop_c3DKeyY 724 // LONG tion; only their relative
+#define DFF_Prop_c3DKeyZ 725 // LONG magnitudes matter
+#define DFF_Prop_c3DKeyIntensity 726 // LONG Fixed point intensity
+#define DFF_Prop_c3DFillX 727 // LONG Fill light source direc-
+#define DFF_Prop_c3DFillY 728 // LONG tion; only their relative
+#define DFF_Prop_c3DFillZ 729 // LONG magnitudes matter
+#define DFF_Prop_c3DFillIntensity 730 // LONG Fixed point intensity
+#define DFF_Prop_fc3DConstrainRotation 763 // BOOL
+#define DFF_Prop_fc3DRotationCenterAuto 764 // BOOL
+#define DFF_Prop_fc3DParallel 765 // sal_Bool Parallel projection?
+#define DFF_Prop_fc3DKeyHarsh 766 // sal_Bool Is key lighting harsh?
+#define DFF_Prop_fc3DFillHarsh 767 // sal_Bool Is fill lighting harsh?
+// Shape
+#define DFF_Prop_hspMaster 769 // MSO_HSP master shape
+#define DFF_Prop_cxstyle 771 // MSO_CXSTYLE Type of connector
+#define DFF_Prop_bWMode 772 // MSO_BWMODE Settings for modifications to be made when in different forms of black-and-white mode.
+#define DFF_Prop_bWModePureBW 773 // MSO_BWMODE
+#define DFF_Prop_bWModeBW 774 // MSO_BWMODE
+#define DFF_Prop_fOleIcon 826 // sal_Bool For OLE objects, whether the object is in icon form
+#define DFF_Prop_fPreferRelativeResize 827 // sal_Bool For UI only. Prefer relative resizing.
+#define DFF_Prop_fLockShapeType 828 // sal_Bool Lock the shape type (don't allow Change Shape)
+#define DFF_Prop_fDeleteAttachedObject 830 // BOOL
+#define DFF_Prop_fBackground 831 // sal_Bool If sal_True, this is the background shape.
+
+// Callout
+#define DFF_Prop_spcot 832 // MSO_SPCOT Callout type
+#define DFF_Prop_dxyCalloutGap 833 // LONG Distance from box to first point.(EMUs)
+#define DFF_Prop_spcoa 834 // MSO_SPCOA Callout angle
+#define DFF_Prop_spcod 835 // MSO_SPCOD Callout drop type
+#define DFF_Prop_dxyCalloutDropSpecified 836 // LONG if mso_spcodSpecified, the actual drop distance
+#define DFF_Prop_dxyCalloutLengthSpecified 837 // LONG if fCalloutLengthSpecified, the actual distance
+#define DFF_Prop_fCallout 889 // sal_Bool Is the shape a callout?
+#define DFF_Prop_fCalloutAccentBar 890 // sal_Bool does callout have accent bar
+#define DFF_Prop_fCalloutTextBorder 891 // sal_Bool does callout have a text border
+#define DFF_Prop_fCalloutMinusX 892 // BOOL
+#define DFF_Prop_fCalloutMinusY 893 // BOOL
+#define DFF_Prop_fCalloutDropAuto 894 // sal_Bool If true, then we occasionally invert the drop distance
+#define DFF_Prop_fCalloutLengthSpecified 895 // sal_Bool if true, we look at dxyCalloutLengthSpecified
+
+// GroupShape
+#define DFF_Prop_wzName 896 // WCHAR* Shape Name (present only if explicitly set)
+#define DFF_Prop_wzDescription 897 // WCHAR* alternate text
+#define DFF_Prop_pihlShape 898 // IHlink* The hyperlink in the shape.
+#define DFF_Prop_pWrapPolygonVertices 899 // IMsoArray The polygon that text will be wrapped around (Word)
+#define DFF_Prop_dxWrapDistLeft 900 // LONG Left wrapping distance from text (Word)
+#define DFF_Prop_dyWrapDistTop 901 // LONG Top wrapping distance from text (Word)
+#define DFF_Prop_dxWrapDistRight 902 // LONG Right wrapping distance from text (Word)
+#define DFF_Prop_dyWrapDistBottom 903 // LONG Bottom wrapping distance from text (Word)
+#define DFF_Prop_lidRegroup 904 // LONG Regroup ID
+#define DFF_Prop_tableProperties 927 // LONG
+#define DFF_Prop_tableRowProperties 928 // LONG*
+#define DFF_Prop_fEditedWrap 953 // sal_Bool Has the wrap polygon been edited?
+#define DFF_Prop_fBehindDocument 954 // sal_Bool Word-only (shape is behind text)
+#define DFF_Prop_fOnDblClickNotify 955 // sal_Bool Notify client on a double click
+#define DFF_Prop_fIsButton 956 // sal_Bool A button shape (i.e., clicking performs an action). Set for shapes with attached hyperlinks or macros.
+#define DFF_Prop_fOneD 957 // sal_Bool 1D adjustment
+#define DFF_Prop_fHidden 958 // sal_Bool Do not display
+#define DFF_Prop_fPrint 959 // sal_Bool Print this shape
+// entsprechende BitFlags
+#define DFF_PBit_EditedWrap 0x00000040
+#define DFF_PBit_BehindDocument 0x00000020
+#define DFF_PBit_OnDblClickNotify 0x00000010
+#define DFF_PBit_IsButton 0x00000008
+#define DFF_PBit_OneD 0x00000004
+#define DFF_PBit_Hidden 0x00000002
+#define DFF_PBit_Print 0x00000001
+
+//---------------------------------------------------------------------------
+// Dreh- und Angelpunkt: der Shape-Typ
+//---------------------------------------------------------------------------
+typedef enum
+ {
+ mso_sptMin = 0,
+ mso_sptNotPrimitive = mso_sptMin,
+ mso_sptRectangle = 1,
+ mso_sptRoundRectangle = 2,
+ mso_sptEllipse = 3,
+ mso_sptDiamond = 4,
+ mso_sptIsocelesTriangle = 5,
+ mso_sptRightTriangle = 6,
+ mso_sptParallelogram = 7,
+ mso_sptTrapezoid = 8,
+ mso_sptHexagon = 9,
+ mso_sptOctagon = 10,
+ mso_sptPlus = 11,
+ mso_sptStar = 12,
+ mso_sptArrow = 13,
+ mso_sptThickArrow = 14,
+ mso_sptHomePlate = 15,
+ mso_sptCube = 16,
+ mso_sptBalloon = 17,
+ mso_sptSeal = 18,
+ mso_sptArc = 19,
+ mso_sptLine = 20,
+ mso_sptPlaque = 21,
+ mso_sptCan = 22,
+ mso_sptDonut = 23,
+ mso_sptTextSimple = 24,
+ mso_sptTextOctagon = 25,
+ mso_sptTextHexagon = 26,
+ mso_sptTextCurve = 27,
+ mso_sptTextWave = 28,
+ mso_sptTextRing = 29,
+ mso_sptTextOnCurve = 30,
+ mso_sptTextOnRing = 31,
+ mso_sptStraightConnector1 = 32,
+ mso_sptBentConnector2 = 33,
+ mso_sptBentConnector3 = 34,
+ mso_sptBentConnector4 = 35,
+ mso_sptBentConnector5 = 36,
+ mso_sptCurvedConnector2 = 37,
+ mso_sptCurvedConnector3 = 38,
+ mso_sptCurvedConnector4 = 39,
+ mso_sptCurvedConnector5 = 40,
+ mso_sptCallout1 = 41,
+ mso_sptCallout2 = 42,
+ mso_sptCallout3 = 43,
+ mso_sptAccentCallout1 = 44,
+ mso_sptAccentCallout2 = 45,
+ mso_sptAccentCallout3 = 46,
+ mso_sptBorderCallout1 = 47,
+ mso_sptBorderCallout2 = 48,
+ mso_sptBorderCallout3 = 49,
+ mso_sptAccentBorderCallout1 = 50,
+ mso_sptAccentBorderCallout2 = 51,
+ mso_sptAccentBorderCallout3 = 52,
+ mso_sptRibbon = 53,
+ mso_sptRibbon2 = 54,
+ mso_sptChevron = 55,
+ mso_sptPentagon = 56,
+ mso_sptNoSmoking = 57,
+ mso_sptSeal8 = 58,
+ mso_sptSeal16 = 59,
+ mso_sptSeal32 = 60,
+ mso_sptWedgeRectCallout = 61,
+ mso_sptWedgeRRectCallout = 62,
+ mso_sptWedgeEllipseCallout = 63,
+ mso_sptWave = 64,
+ mso_sptFoldedCorner = 65,
+ mso_sptLeftArrow = 66,
+ mso_sptDownArrow = 67,
+ mso_sptUpArrow = 68,
+ mso_sptLeftRightArrow = 69,
+ mso_sptUpDownArrow = 70,
+ mso_sptIrregularSeal1 = 71,
+ mso_sptIrregularSeal2 = 72,
+ mso_sptLightningBolt = 73,
+ mso_sptHeart = 74,
+ mso_sptPictureFrame = 75,
+ mso_sptQuadArrow = 76,
+ mso_sptLeftArrowCallout = 77,
+ mso_sptRightArrowCallout = 78,
+ mso_sptUpArrowCallout = 79,
+ mso_sptDownArrowCallout = 80,
+ mso_sptLeftRightArrowCallout = 81,
+ mso_sptUpDownArrowCallout = 82,
+ mso_sptQuadArrowCallout = 83,
+ mso_sptBevel = 84,
+ mso_sptLeftBracket = 85,
+ mso_sptRightBracket = 86,
+ mso_sptLeftBrace = 87,
+ mso_sptRightBrace = 88,
+ mso_sptLeftUpArrow = 89,
+ mso_sptBentUpArrow = 90,
+ mso_sptBentArrow = 91,
+ mso_sptSeal24 = 92,
+ mso_sptStripedRightArrow = 93,
+ mso_sptNotchedRightArrow = 94,
+ mso_sptBlockArc = 95,
+ mso_sptSmileyFace = 96,
+ mso_sptVerticalScroll = 97,
+ mso_sptHorizontalScroll = 98,
+ mso_sptCircularArrow = 99,
+ mso_sptNotchedCircularArrow = 100,
+ mso_sptUturnArrow = 101,
+ mso_sptCurvedRightArrow = 102,
+ mso_sptCurvedLeftArrow = 103,
+ mso_sptCurvedUpArrow = 104,
+ mso_sptCurvedDownArrow = 105,
+ mso_sptCloudCallout = 106,
+ mso_sptEllipseRibbon = 107,
+ mso_sptEllipseRibbon2 = 108,
+ mso_sptFlowChartProcess = 109,
+ mso_sptFlowChartDecision = 110,
+ mso_sptFlowChartInputOutput = 111,
+ mso_sptFlowChartPredefinedProcess = 112,
+ mso_sptFlowChartInternalStorage = 113,
+ mso_sptFlowChartDocument = 114,
+ mso_sptFlowChartMultidocument = 115,
+ mso_sptFlowChartTerminator = 116,
+ mso_sptFlowChartPreparation = 117,
+ mso_sptFlowChartManualInput = 118,
+ mso_sptFlowChartManualOperation = 119,
+ mso_sptFlowChartConnector = 120,
+ mso_sptFlowChartPunchedCard = 121,
+ mso_sptFlowChartPunchedTape = 122,
+ mso_sptFlowChartSummingJunction = 123,
+ mso_sptFlowChartOr = 124,
+ mso_sptFlowChartCollate = 125,
+ mso_sptFlowChartSort = 126,
+ mso_sptFlowChartExtract = 127,
+ mso_sptFlowChartMerge = 128,
+ mso_sptFlowChartOfflineStorage = 129,
+ mso_sptFlowChartOnlineStorage = 130,
+ mso_sptFlowChartMagneticTape = 131,
+ mso_sptFlowChartMagneticDisk = 132,
+ mso_sptFlowChartMagneticDrum = 133,
+ mso_sptFlowChartDisplay = 134,
+ mso_sptFlowChartDelay = 135,
+ mso_sptTextPlainText = 136,
+ mso_sptTextStop = 137,
+ mso_sptTextTriangle = 138,
+ mso_sptTextTriangleInverted = 139,
+ mso_sptTextChevron = 140,
+ mso_sptTextChevronInverted = 141,
+ mso_sptTextRingInside = 142,
+ mso_sptTextRingOutside = 143,
+ mso_sptTextArchUpCurve = 144,
+ mso_sptTextArchDownCurve = 145,
+ mso_sptTextCircleCurve = 146,
+ mso_sptTextButtonCurve = 147,
+ mso_sptTextArchUpPour = 148,
+ mso_sptTextArchDownPour = 149,
+ mso_sptTextCirclePour = 150,
+ mso_sptTextButtonPour = 151,
+ mso_sptTextCurveUp = 152,
+ mso_sptTextCurveDown = 153,
+ mso_sptTextCascadeUp = 154,
+ mso_sptTextCascadeDown = 155,
+ mso_sptTextWave1 = 156,
+ mso_sptTextWave2 = 157,
+ mso_sptTextWave3 = 158,
+ mso_sptTextWave4 = 159,
+ mso_sptTextInflate = 160,
+ mso_sptTextDeflate = 161,
+ mso_sptTextInflateBottom = 162,
+ mso_sptTextDeflateBottom = 163,
+ mso_sptTextInflateTop = 164,
+ mso_sptTextDeflateTop = 165,
+ mso_sptTextDeflateInflate = 166,
+ mso_sptTextDeflateInflateDeflate = 167,
+ mso_sptTextFadeRight = 168,
+ mso_sptTextFadeLeft = 169,
+ mso_sptTextFadeUp = 170,
+ mso_sptTextFadeDown = 171,
+ mso_sptTextSlantUp = 172,
+ mso_sptTextSlantDown = 173,
+ mso_sptTextCanUp = 174,
+ mso_sptTextCanDown = 175,
+ mso_sptFlowChartAlternateProcess = 176,
+ mso_sptFlowChartOffpageConnector = 177,
+ mso_sptCallout90 = 178,
+ mso_sptAccentCallout90 = 179,
+ mso_sptBorderCallout90 = 180,
+ mso_sptAccentBorderCallout90 = 181,
+ mso_sptLeftRightUpArrow = 182,
+ mso_sptSun = 183,
+ mso_sptMoon = 184,
+ mso_sptBracketPair = 185,
+ mso_sptBracePair = 186,
+ mso_sptSeal4 = 187,
+ mso_sptDoubleWave = 188,
+ mso_sptActionButtonBlank = 189,
+ mso_sptActionButtonHome = 190,
+ mso_sptActionButtonHelp = 191,
+ mso_sptActionButtonInformation = 192,
+ mso_sptActionButtonForwardNext = 193,
+ mso_sptActionButtonBackPrevious = 194,
+ mso_sptActionButtonEnd = 195,
+ mso_sptActionButtonBeginning = 196,
+ mso_sptActionButtonReturn = 197,
+ mso_sptActionButtonDocument = 198,
+ mso_sptActionButtonSound = 199,
+ mso_sptActionButtonMovie = 200,
+ mso_sptHostControl = 201,
+ mso_sptTextBox = 202,
+ mso_sptMax = 0x0FFF,
+ mso_sptNil = mso_sptMax
+ } MSO_SPT;
+
+// verschiedene enums aus der OfficeDraw-Doku, Appendix D - Anfang
+//
+// beachte: in Abweichung von der MS-Doku beginnen alle
+// mit "mso_" statt mit "mso"
+//
+enum MSO_ShapePath {
+ mso_shapeLines, // A line of straight segments
+ mso_shapeLinesClosed, // A closed polygonal object
+ mso_shapeCurves, // A line of Bezier curve segments
+ mso_shapeCurvesClosed, // A closed shape with curved edges
+ mso_shapeComplex // pSegmentInfo must be non-empty
+};
+
+enum MSO_WrapMode {
+ mso_wrapSquare,
+ mso_wrapByPoints,
+ mso_wrapNone,
+ mso_wrapTopBottom,
+ mso_wrapThrough
+};
+
+enum MSO_BWMode {
+ mso_bwColor, // only used for predefined shades
+ mso_bwAutomatic, // depends on object type
+ mso_bwGrayScale, // shades of gray only
+ mso_bwLightGrayScale, // shades of light gray only
+ mso_bwInverseGray, // dark gray mapped to light gray, etc.
+ mso_bwGrayOutline, // pure gray and white
+ mso_bwBlackTextLine, // black text and lines, all else grayscale
+ mso_bwHighContrast, // pure black and white mode (no grays)
+ mso_bwBlack, // solid black
+ mso_bwWhite, // solid white
+ mso_bwDontShow, // object not drawn
+ mso_bwNumModes // number of Black and white modes
+};
+
+enum MSO_Anchor {
+ mso_anchorTop,
+ mso_anchorMiddle,
+ mso_anchorBottom,
+ mso_anchorTopCentered,
+ mso_anchorMiddleCentered,
+ mso_anchorBottomCentered,
+ mso_anchorTopBaseline,
+ mso_anchorBottomBaseline,
+ mso_anchorTopCenteredBaseline,
+ mso_anchorBottomCenteredBaseline
+};
+
+enum MSO_CDir {
+ mso_cdir0, // Right
+ mso_cdir90, // Down
+ mso_cdir180, // Left
+ mso_cdir270 // Up
+};
+
+// connector style
+enum MSO_ConnectorStyle {
+ mso_cxstyleStraight = 0,
+ mso_cxstyleBent,
+ mso_cxstyleCurved,
+ mso_cxstyleNone
+};
+
+// MSO_TXFL -- text flow
+enum MSO_TextFlow {
+ mso_txflHorzN, // Horizontal non-@
+ mso_txflTtoBA, // Top to Bottom @-font
+ mso_txflBtoT, // Bottom to Top non-@
+ mso_txflTtoBN, // Top to Bottom non-@
+ mso_txflHorzA, // Horizontal @-font
+ mso_txflVertN // Vertical, non-@
+};
+
+// MSO_TXDIR - text direction (needed for Bi-Di support)
+enum MSO_TextDir {
+ mso_txdirLTR, // left-to-right text direction
+ mso_txdirRTL, // right-to-left text direction
+ mso_txdirContext // context text direction
+};
+
+// MSO_SPCOT -- Callout Type
+enum MSO_SPCalloutType {
+ mso_spcotRightAngle = 1,
+ mso_spcotOneSegment = 2,
+ mso_spcotTwoSegment = 3,
+ mso_spcotThreeSegment = 4
+};
+
+// MSO_SPCOA -- Callout Angle
+enum MSO_SPCalloutAngle {
+ mso_spcoaAny,
+ mso_spcoa30,
+ mso_spcoa45,
+ mso_spcoa60,
+ mso_spcoa90,
+ mso_spcoa0
+};
+
+// MSO_SPCOD -- Callout Drop
+enum MSO_SPCalloutDrop {
+ mso_spcodTop,
+ mso_spcodCenter,
+ mso_spcodBottom,
+ mso_spcodSpecified
+};
+
+// MSO_GEOTEXTALIGN - FontWork alignment
+enum MSO_GeoTextAlign {
+ mso_alignTextStretch, /* Stretch each line of text to fit width. */
+ mso_alignTextCenter, /* Center text on width. */
+ mso_alignTextLeft, /* Left justify. */
+ mso_alignTextRight, /* Right justify. */
+ mso_alignTextLetterJust, /* Spread letters out to fit width. */
+ mso_alignTextWordJust, /* Spread words out to fit width. */
+ mso_alignTextInvalid /* Invalid */
+};
+
+// MSO_BLIPFLAGS - flags for pictures
+enum MSO_BlipFlags {
+ mso_blipflagDefault = 0,
+ mso_blipflagComment = 0, // Blip name is a comment
+ mso_blipflagFile, // Blip name is a file name
+ mso_blipflagURL, // Blip name is a full URL
+ mso_blipflagType = 3, // Mask to extract type
+ /* Or the following flags with any of the above. */
+ mso_blipflagDontSave = 4, // A "dont" is the depression in the metal
+ // body work of an automobile caused when a
+ // cyclist violently thrusts his or her nose
+ // at it, thus a DontSave is another name for
+ // a cycle lane.
+ mso_blipflagDoNotSave = 4, // For those who prefer English
+ mso_blipflagLinkToFile = 8
+};
+
+enum MSO_3DRenderMode {
+ mso_FullRender, // Generate a full rendering
+ mso_Wireframe, // Generate a wireframe
+ mso_BoundingCube // Generate a bounding cube
+};
+
+enum MSO_XFormType {
+ mso_xformAbsolute, // Apply transform in absolute space centered on shape
+ mso_xformShape, // Apply transform to shape geometry
+ mso_xformDrawing // Apply transform in drawing space
+};
+
+enum MSO_ShadowType {
+ mso_shadowOffset, // N pixel offset shadow
+ mso_shadowDouble, // Use second offset too
+ mso_shadowRich, // Rich perspective shadow (cast relative to shape)
+ mso_shadowShape, // Rich perspective shadow (cast in shape space)
+ mso_shadowDrawing, // Perspective shadow cast in drawing space
+ mso_shadowEmbossOrEngrave
+};
+
+// MSO_DZTYPE - the type of a (length) measurement
+enum MSO_DZType {
+ mso_dztypeMin = 0,
+ mso_dztypeDefault = 0, // Default size, ignore the values
+ mso_dztypeA = 1, // Values are in EMUs
+ mso_dztypeV = 2, // Values are in pixels
+ mso_dztypeShape = 3, // Values are 16.16 fractions of shape size
+ mso_dztypeFixedAspect = 4, // Aspect ratio is fixed
+ mso_dztypeAFixed = 5, // EMUs, fixed aspect ratio
+ mso_dztypeVFixed = 6, // Pixels, fixed aspect ratio
+ mso_dztypeShapeFixed = 7, // Proportion of shape, fixed aspect ratio
+ mso_dztypeFixedAspectEnlarge
+ = 8, // Aspect ratio is fixed, favor larger size
+ mso_dztypeAFixedBig = 9, // EMUs, fixed aspect ratio
+ mso_dztypeVFixedBig = 10, // Pixels, fixed aspect ratio
+ mso_dztypeShapeFixedBig= 11, // Proportion of shape, fixed aspect ratio
+ mso_dztypeMax = 11
+};
+
+enum MSO_FillType {
+ mso_fillSolid, // Fill with a solid color
+ mso_fillPattern, // Fill with a pattern (bitmap)
+ mso_fillTexture, // A texture (pattern with its own color map)
+ mso_fillPicture, // Center a picture in the shape
+ mso_fillShade, // Shade from start to end points
+ mso_fillShadeCenter, // Shade from bounding rectangle to end point
+ mso_fillShadeShape, // Shade from shape outline to end point
+ mso_fillShadeScale, // Similar to mso_fillShade, but the fillAngle
+ // is additionally scaled by the aspect ratio of
+ // the shape. If shape is square, it is the
+ // same as mso_fillShade.
+ mso_fillShadeTitle, // special type - shade to title --- for PP
+ mso_fillBackground // Use the background fill color/pattern
+};
+
+// MSO_SHADETYPE - how to interpret the colors in a shaded fill.
+enum MSO_ShadeType {
+ mso_shadeNone = 0, // Interpolate without correction between RGBs
+ mso_shadeGamma = 1, // Apply gamma correction to colors
+ mso_shadeSigma = 2, // Apply a sigma transfer function to position
+ mso_shadeBand = 4, // Add a flat band at the start of the shade
+ mso_shadeOneColor = 8, // This is a one color shade
+
+ /* A parameter for the band or sigma function can be stored in the top
+ 16 bits of the value - this is a proportion of *each* band of the
+ shade to make flat (or the approximate equal value for a sigma
+ function). NOTE: the parameter is not used for the sigma function,
+ instead a built in value is used. This value should not be changed
+ from the default! */
+ mso_shadeParameterShift = 16,
+ mso_shadeParameterMask = 0xffff0000,
+
+ mso_shadeDefault = (mso_shadeGamma|mso_shadeSigma|
+ (16384<<mso_shadeParameterShift))
+};
+
+// MSOLINESTYLE - compound line style
+enum MSO_LineStyle {
+ mso_lineSimple, // Single line (of width lineWidth)
+ mso_lineDouble, // Double lines of equal width
+ mso_lineThickThin, // Double lines, one thick, one thin
+ mso_lineThinThick, // Double lines, reverse order
+ mso_lineTriple // Three lines, thin, thick, thin
+};
+
+// MSO_LINETYPE - how to "fill" the line contour
+enum MSO_LineType {
+ mso_lineSolidType, // Fill with a solid color
+ mso_linePattern, // Fill with a pattern (bitmap)
+ mso_lineTexture, // A texture (pattern with its own color map)
+ mso_linePicture // Center a picture in the shape
+};
+
+// MSO_LINEDASHING - dashed line style
+enum MSO_LineDashing {
+ mso_lineSolid, // Solid (continuous) pen
+ mso_lineDashSys, // PS_DASH system dash style
+ mso_lineDotSys, // PS_DOT system dash style
+ mso_lineDashDotSys, // PS_DASHDOT system dash style
+ mso_lineDashDotDotSys, // PS_DASHDOTDOT system dash style
+ mso_lineDotGEL, // square dot style
+ mso_lineDashGEL, // dash style
+ mso_lineLongDashGEL, // long dash style
+ mso_lineDashDotGEL, // dash short dash
+ mso_lineLongDashDotGEL, // long dash short dash
+ mso_lineLongDashDotDotGEL // long dash short dash short dash
+};
+
+// MSO_LINEEND - line end effect
+enum MSO_LineEnd {
+ mso_lineNoEnd,
+ mso_lineArrowEnd,
+ mso_lineArrowStealthEnd,
+ mso_lineArrowDiamondEnd,
+ mso_lineArrowOvalEnd,
+ mso_lineArrowOpenEnd
+};
+
+// MSO_LINEENDWIDTH - size of arrowhead
+enum MSO_LineEndWidth {
+ mso_lineNarrowArrow,
+ mso_lineMediumWidthArrow,
+ mso_lineWideArrow
+};
+
+// MSO_LINEENDLENGTH - size of arrowhead
+enum MSO_LineEndLength {
+ mso_lineShortArrow,
+ mso_lineMediumLenArrow,
+ mso_lineLongArrow
+};
+
+// MSO_LINEJOIN - line join style.
+enum MSO_LineJoin {
+ mso_lineJoinBevel, // Join edges by a straight line
+ mso_lineJoinMiter, // Extend edges until they join
+ mso_lineJoinRound // Draw an arc between the two edges
+};
+
+// MSO_LINECAP - line cap style (applies to ends of dash segments too).
+enum MSO_LineCap {
+ mso_lineEndCapRound, // Rounded ends - the default
+ mso_lineEndCapSquare, // Square protrudes by half line width
+ mso_lineEndCapFlat // Line ends at end point
+};
+// verschiedene enums aus der OfficeDraw-Doku, Appendix D - Ende
+
+// BStore-Container
+// FBSE - File Blip Store Entry
+typedef struct _MSOF_BSE {
+ sal_uInt8 btWin32; // Required type on Win32
+ sal_uInt8 btMacOS; // Required type on Mac
+ sal_uInt8 rgbUid[16]; // Identifier of blip
+ sal_uInt16 tag; // currently unused
+ sal_uIntPtr size; // Blip size in stream
+ sal_uIntPtr cRef; // Reference count on the blip
+ sal_uIntPtr /*MSOFO*/ foDelay; // File offset in the delay stream
+ sal_uInt8 usage; // How this blip is used (MSOBLIPUSAGE)
+ sal_uInt8 cbName; // length of the blip name
+ sal_uInt8 unused2; // for the future
+ sal_uInt8 unused3; // for the future
+} MSO_FBSE;
+
+typedef enum {
+ mso_blipUsageDefault, // All non-texture fill blips get this.
+ mso_blipUsageTexture,
+ mso_blipUsageMax = 255 // Since this is stored in a byte
+} MSO_BLIPUSAGE;
+
+typedef enum { // GEL provided types...
+ mso_blipERROR = 0, // An error occured during loading
+ mso_blipUNKNOWN, // An unknown blip type
+ mso_blipEMF, // Windows Enhanced Metafile
+ mso_blipWMF, // Windows Metafile
+ mso_blipPICT, // Macintosh PICT
+ mso_blipJPEG, // JFIF
+ mso_blipPNG, // PNG
+ mso_blipDIB, // Windows DIB
+ mso_blipFirstClient = 32, // First client defined blip type
+ mso_blipLastClient = 255 // Last client defined blip type
+} MSO_BLIPTYPE;
+
+typedef enum {
+ mso_biUNKNOWN = 0,
+ mso_biWMF = 0x216, // Metafile header then compressed WMF
+ mso_biEMF = 0x3D4, // Metafile header then compressed EMF
+ mso_biPICT = 0x542, // Metafile header then compressed PICT
+ mso_biPNG = 0x6E0, // One byte tag then PNG data
+ mso_biJFIF = 0x46A, // One byte tag then JFIF data
+ mso_biJPEG = mso_biJFIF,
+ mso_biDIB = 0x7A8, // One byte tag then DIB data
+ mso_biClient=0x800 // Clients should set this bit
+} MSO_BI; // Blip signature as encoded in the MSO_FBH.inst
+
+typedef enum {
+ mso_compressionDeflate = 0,
+ mso_compressionNone = 254, // Used only if compression fails
+ mso_compressionTest = 255 // For testing only
+} MSO_BLIPCOMPRESSION;
+
+typedef enum {
+ mso_filterAdaptive = 0, // PNG type - not used/supported for metafile
+ mso_filterNone = 254,
+ mso_filterTest = 255 // For testing only
+} MSO_BLIPFILTER;
+
+typedef enum {
+ mso_syscolorButtonFace, // COLOR_BTNFACE
+ mso_syscolorWindowText, // COLOR_WINDOWTEXT
+ mso_syscolorMenu, // COLOR_MENU
+ mso_syscolorHighlight, // COLOR_HIGHLIGHT
+ mso_syscolorHighlightText, // COLOR_HIGHLIGHTTEXT
+ mso_syscolorCaptionText, // COLOR_CAPTIONTEXT
+ mso_syscolorActiveCaption, // COLOR_ACTIVECAPTION
+ mso_syscolorButtonHighlight, // COLOR_BTNHIGHLIGHT
+ mso_syscolorButtonShadow, // COLOR_BTNSHADOW
+ mso_syscolorButtonText, // COLOR_BTNTEXT
+ mso_syscolorGrayText, // COLOR_GRAYTEXT
+ mso_syscolorInactiveCaption, // COLOR_INACTIVECAPTION
+ mso_syscolorInactiveCaptionText, // COLOR_INACTIVECAPTIONTEXT
+ mso_syscolorInfoBackground, // COLOR_INFOBK
+ mso_syscolorInfoText, // COLOR_INFOTEXT
+ mso_syscolorMenuText, // COLOR_MENUTEXT
+ mso_syscolorScrollbar, // COLOR_SCROLLBAR
+ mso_syscolorWindow, // COLOR_WINDOW
+ mso_syscolorWindowFrame, // COLOR_WINDOWFRAME
+ mso_syscolor3DLight, // COLOR_3DLIGHT
+ mso_syscolorMax, // Count of system colors
+
+ mso_colorFillColor = 0xF0, // Use the fillColor property
+ mso_colorLineOrFillColor, // Use the line color only if there is a line
+ mso_colorLineColor, // Use the lineColor property
+ mso_colorShadowColor, // Use the shadow color
+ mso_colorThis, // Use this color (only valid as described below)
+ mso_colorFillBackColor, // Use the fillBackColor property
+ mso_colorLineBackColor, // Use the lineBackColor property
+ mso_colorFillThenLine, // Use the fillColor unless no fill and line
+ mso_colorIndexMask = 0xFF, // Extract the color index
+
+ mso_colorProcessMask =0xFFFF00,// All the processing bits
+ mso_colorModificationMask =0x0F00, // Just the function
+ mso_colorModFlagMask =0xF000, // Just the additional flags
+ mso_colorDarken =0x0100, // Darken color by parameter/255
+ mso_colorLighten =0x0200, // Lighten color by parameter/255
+ mso_colorAdd =0x0300, // Add grey level RGB(param,param,param)
+ mso_colorSubtract =0x0400, // Subtract grey level RGB(p,p,p)
+ mso_colorReverseSubtract =0x0500, // Subtract from grey level RGB(p,p,p)
+ /* In the following "black" means maximum component value, white minimum.
+ The operation is per component, to guarantee white combine with
+ mso_colorGray */
+ mso_colorBlackWhite =0x0600, // Black if < uParam, else white (>=)
+ mso_colorInvert =0x2000, // Invert color (at the *end*)
+ mso_colorInvert128 =0x4000, // Invert by toggling the top bit
+ mso_colorGray =0x8000, // Make the color gray (before the above!)
+ mso_colorBParamMask =0xFF0000,// Parameter used as above
+ mso_colorBParamShift = 16 // To extract the parameter value
+} MSO_SYSCOLORINDEX;
+
+#ifdef Hier_noch_was_aus_der_Doku
+/* The secondary, or data, UID - should always be set. */
+sal_uInt8 m_rgbUid[16];
+/* The primary UID - this defaults to 0, in which case the primary ID is
+ that of the internal data. NOTE!: The primary UID is only saved to disk
+ if (blip_instance ^ blip_signature == 1). Blip_instance is MSO_FBH.inst and
+ blip_signature is one of the values defined in MSO_BI */
+sal_uInt8 m_rgbUidPrimary[16]; // optional based on the above check
+
+/* Metafile Blip overhead = 34 bytes. m_cb gives the number of
+ bytes required to store an uncompressed version of the file, m_cbSave
+ is the compressed size. m_mfBounds gives the boundary of all the
+ drawing calls within the metafile (this may just be the bounding box
+ or it may allow some whitespace, for a WMF this comes from the
+ SetWindowOrg and SetWindowExt records of the metafile). */
+int m_cb; // Cache of the metafile size
+RECT m_rcBounds; // Boundary of metafile drawing commands
+POINT m_ptSize; // Size of metafile in EMUs
+int m_cbSave; // Cache of saved size (size of m_pvBits)
+sal_uInt8 m_fCompression; // MSO_BLIPCOMPRESSION
+sal_uInt8 m_fFilter; // always mso_filterNone
+void *m_pvBits; // Compressed bits of metafile.
+
+/* The secondary, or data, UID - should always be set. */
+sal_uInt8 m_rgbUid[16];
+/* The primary UID - this defaults to 0, in which case the primary ID is
+ that of the internal data. NOTE!: The primary UID is only saved to disk
+ if (blip_instance ^ blip_signature == 1). Blip_instance is MSO_FBH.finst and
+ blip_signature is one of the values defined in MSO_BI*/
+sal_uInt8 m_rgbUidPrimary[16]; // optional based on the above check
+sal_uInt8 m_bTag;
+void *m_pvBits; // raster bits of the blip.
+#endif
+
+#endif
diff --git a/svx/inc/svx/numfmtsh.hxx b/svx/inc/svx/numfmtsh.hxx
new file mode 100644
index 000000000000..00a423d8b46c
--- /dev/null
+++ b/svx/inc/svx/numfmtsh.hxx
@@ -0,0 +1,267 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_NUMFMTSH_HXX
+#define _SVX_NUMFMTSH_HXX
+
+// include ---------------------------------------------------------------
+
+#include <tools/string.hxx>
+#include <i18npool/lang.h>
+
+#ifndef _SVSTDARR_ULONGS
+#define _SVSTDARR_ULONGS
+#endif
+#ifndef _SVSTDARR_USHORTS
+#define _SVSTDARR_USHORTS
+#endif
+#ifndef _SVSTDARR_STRINGS
+#define _SVSTDARR_STRINGS
+#endif
+#include "svx/svxdllapi.h"
+
+#include <svl/svstdarr.hxx>
+
+// forward ---------------------------------------------------------------
+
+class Color;
+class SvNumberFormatter;
+class SvNumberFormatTable;
+class SvStrings;
+class SvStringsDtor;
+class NfCurrencyEntry;
+// enum ------------------------------------------------------------------
+
+enum SvxNumberValueType
+{
+ SVX_VALUE_TYPE_UNDEFINED = 0,
+ SVX_VALUE_TYPE_NUMBER,
+ SVX_VALUE_TYPE_STRING
+};
+
+// define ----------------------------------------------------------------
+
+#define CAT_ALL 0 // Reihenfolge der Kategorie-
+#define CAT_USERDEFINED 1 // ListBox-Eintraege in der TabPage
+#define CAT_NUMBER 2
+#define CAT_PERCENT 3
+#define CAT_CURRENCY 4
+#define CAT_DATE 5
+#define CAT_TIME 6
+#define CAT_SCIENTIFIC 7
+#define CAT_FRACTION 8
+#define CAT_BOOLEAN 9
+#define CAT_TEXT 10
+
+#define SELPOS_NONE -1
+
+#define NUMBERFORMAT_ENTRY_NEW_CURRENCY NUMBERFORMAT_ENTRY_NOT_FOUND-1
+
+typedef NfCurrencyEntry* NfShCurrencyEntryPtr;
+SV_DECL_PTRARR( NfShCurrencyEntries, NfShCurrencyEntryPtr, 8, 1 )
+
+
+class SvxDelStrgs: public SvStrings
+{
+
+public:
+ ~SvxDelStrgs() { DeleteAndDestroy(0,Count());}
+
+};
+
+// class SvxNumberFormatShell --------------------------------------------
+
+class SVX_DLLPUBLIC SvxNumberFormatShell
+{
+public:
+ SvxNumberFormatShell( SvNumberFormatter* pNumFormatter,
+ sal_uInt32 nFormatKey,
+ SvxNumberValueType eNumValType,
+ const String& rNumStr );
+
+ SvxNumberFormatShell( SvNumberFormatter* pNumFormatter,
+ sal_uInt32 nFormatKey,
+ SvxNumberValueType eNumValType,
+ double nNumVal,
+ const String* pNumStr = NULL );
+
+ ~SvxNumberFormatShell();
+
+
+ static SvxNumberFormatShell* Create( SvNumberFormatter* pNumFormatter,
+ sal_uInt32 nFormatKey,
+ SvxNumberValueType eNumValType,
+ const String& rNumStr );
+
+ static SvxNumberFormatShell* Create( SvNumberFormatter* pNumFormatter,
+ sal_uInt32 nFormatKey,
+ SvxNumberValueType eNumValType,
+ double nNumVal,
+ const String* pNumStr = NULL );
+
+
+ void GetInitSettings( sal_uInt16& nCatLbPos,
+ LanguageType& rLangType,
+ sal_uInt16& nFmtLbSelPos,
+ SvStrings& rFmtEntries,
+ String& rPrevString,
+ Color*& rpPrevColor );
+
+ void CategoryChanged( sal_uInt16 nCatLbPos,
+ short& rFmtSelPos,
+ SvStrings& rFmtEntries );
+
+ void LanguageChanged( LanguageType eLangType,
+ short& rFmtSelPos,
+ SvStrings& rFmtEntries );
+
+ void FormatChanged( sal_uInt16 nFmtLbPos,
+ String& rPreviewStr,
+ Color*& rpFontColor );
+
+ sal_Bool AddFormat( String& rFormat,
+ xub_StrLen& rErrPos,
+ sal_uInt16& rCatLbSelPos,
+ short& rFmtSelPos,
+ SvStrings& rFmtEntries );
+
+ sal_Bool RemoveFormat( const String& rFormat,
+ sal_uInt16& rCatLbSelPos,
+ short& rFmtSelPos,
+ SvStrings& rFmtEntries );
+
+ void MakeFormat( String& rFormat,
+ sal_Bool bThousand,
+ sal_Bool bNegRed,
+ sal_uInt16 nPrecision,
+ sal_uInt16 nLeadingZeroes,
+ sal_uInt16 nCurrencyEntryPos);
+
+ void GetOptions( const String& rFormat,
+ sal_Bool& rThousand,
+ sal_Bool& rNegRed,
+ sal_uInt16& rPrecision,
+ sal_uInt16& rLeadingZeroes,
+ sal_uInt16& rCatLbPos );
+
+ void MakePreviewString( const String& rFormatStr,
+ String& rPreviewStr,
+ Color*& rpFontColor );
+
+ void MakePrevStringFromVal( const String& rFormatStr, //@ 19.09.97
+ String& rPreviewStr,
+ Color*& rpFontColor,
+ double nValue);
+
+ sal_Bool IsUserDefined( const String& rFmtString );
+ sal_Bool IsTmpCurrencyFormat( const String& rFmtString );
+ sal_Bool FindEntry( const String& rFmtString, sal_uInt32* pAt = NULL );
+
+ void ValidateNewEntries( sal_Bool bValidate = sal_True ) { bUndoAddList = !bValidate; }
+ sal_uInt32 GetUpdateDataCount() const;
+ void GetUpdateData( sal_uInt32* pDelArray, const sal_uInt32 nSize );
+
+ void SetCurNumFmtKey( sal_uInt32 nNew ) { nCurFormatKey = nNew; }
+ void SetCurLanguage( LanguageType eNew ) { eCurLanguage = eNew; }
+ sal_uInt32 GetCurNumFmtKey() const { return nCurFormatKey; }
+ LanguageType GetCurLanguage() const { return eCurLanguage; }
+
+ /** Returns the name of Standard, General, ... for the
+ current language. */
+ String GetStandardName() const;
+
+ String GetComment4Entry(short nEntry);
+ short GetCategory4Entry(short nEntry);
+ sal_Bool GetUserDefined4Entry(short nEntry);
+ String GetFormat4Entry(short nEntry);
+ void SetComment4Entry(short nEntry,String aCommentString);
+
+ sal_Bool IsBankingSymbol(sal_uInt16 nPos);
+ void SetCurrencySymbol(sal_uInt16 nPos);
+ sal_uInt32 GetCurrencySymbol();
+ sal_uInt16 FindCurrencyFormat( const String& rFmtString );
+ sal_uInt16 FindCurrencyFormat(const NfCurrencyEntry* pTmpCurrencyEntry,sal_Bool bTmpBanking);
+ NfCurrencyEntry* GetCurCurrencyEntry();
+ void SetCurCurrencyEntry(NfCurrencyEntry*);
+ short GetListPos4Entry(sal_uInt32 nIdx);
+ short GetListPos4Entry( const String& rFmtString );
+
+ void GetCurrencySymbols( SvStringsDtor& rList, sal_uInt16* pPos );
+ void GetCurrencySymbols( SvStringsDtor& rList, sal_Bool bFlag );
+
+ sal_uInt16 FindCurrencyTableEntry( const String& rFmtString, sal_Bool &bTestBanking );
+ sal_Bool IsInTable(sal_uInt16 nPos,sal_Bool bTmpBanking,const String &rFmtString);
+
+ void GetCurrencyFormats(SvStrings& rList);
+
+private:
+ static const double DEFAULT_NUMVALUE; // 123456789
+
+ SvNumberFormatter* pFormatter;
+ SvNumberFormatTable* pCurFmtTable;
+ SvxNumberValueType eValType;
+ String aValStr;
+ double nValNum;
+ sal_Bool bUndoAddList;
+ SvULongs aAddList;
+ SvULongs aDelList;
+ SvULongs aCurEntryList;
+ sal_uInt32 nInitFormatKey;
+ sal_uInt32 nCurFormatKey;
+ short nCurCategory;
+ LanguageType eCurLanguage;
+ SvUShorts aCurCurrencyList;
+ NfCurrencyEntry* pCurCurrencyEntry;
+ sal_Bool bBankingSymbol;
+ sal_uInt16 nCurCurrencyEntryPos;
+ SvStrings aCurrencyFormatList;
+
+#ifdef _SVX_NUMFMTSH_CXX
+ SVX_DLLPRIVATE short FillEntryList_Impl( SvStrings& rList );
+ SVX_DLLPRIVATE void FillEListWithStd_Impl( SvStrings& rList,sal_uInt16 aPrivCat, short &Pos);
+ SVX_DLLPRIVATE short FillEListWithFormats_Impl( SvStrings& rList,short nSelPos,
+ NfIndexTableOffset eOffsetStart,
+ NfIndexTableOffset eOffsetEnd);
+
+ SVX_DLLPRIVATE short FillEListWithDateTime_Impl( SvStrings& rList,short nSelPos);
+
+ SVX_DLLPRIVATE short FillEListWithCurrency_Impl( SvStrings& rList,short nSelPos);
+ SVX_DLLPRIVATE short FillEListWithSysCurrencys( SvStrings& rList,short nSelPos);
+ SVX_DLLPRIVATE short FillEListWithUserCurrencys( SvStrings& rList,short nSelPos);
+
+ SVX_DLLPRIVATE short FillEListWithUsD_Impl( SvStrings& rList, sal_uInt16 nPrivCat, short Pos );
+ SVX_DLLPRIVATE sal_Bool IsRemoved_Impl( sal_uInt32 nKey );
+ SVX_DLLPRIVATE sal_Bool IsAdded_Impl( sal_uInt32 nKey );
+ SVX_DLLPRIVATE void GetPreviewString_Impl( String& rString,
+ Color*& rpColor );
+ SVX_DLLPRIVATE void PosToCategory_Impl( sal_uInt16 nPos, short& rCategory );
+ SVX_DLLPRIVATE void CategoryToPos_Impl( short nCategory, sal_uInt16& rPos );
+#endif
+};
+
+
+#endif
+
diff --git a/svx/inc/svx/numinf.hxx b/svx/inc/svx/numinf.hxx
new file mode 100644
index 000000000000..6b3793d2aea9
--- /dev/null
+++ b/svx/inc/svx/numinf.hxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_NUMINF_HXX
+#define _SVX_NUMINF_HXX
+
+// include ---------------------------------------------------------------
+
+#include <svl/itempool.hxx>
+#include <svx/numfmtsh.hxx>
+#include "svx/svxdllapi.h"
+
+// class SvxNumberInfoItem -----------------------------------------------
+
+
+
+/*
+[Beschreibung]
+Dieses Item dient als Transport-Medium fuer einen Number-Formatter.
+*/
+
+class SVX_DLLPUBLIC SvxNumberInfoItem : public SfxPoolItem
+{
+public:
+ TYPEINFO();
+
+ SvxNumberInfoItem( const sal_uInt16 nId );
+ SvxNumberInfoItem( SvNumberFormatter* pNumFormatter,
+ const sal_uInt16 nId );
+ SvxNumberInfoItem( SvNumberFormatter* pNumFormatter, const String& rVal,
+ const sal_uInt16 nId );
+ SvxNumberInfoItem( SvNumberFormatter* pNumFormatter, const double& rVal,
+ const sal_uInt16 nId );
+ // if both double and String are supplied, String is used for text formats
+ SvxNumberInfoItem( SvNumberFormatter* pNumFormatter, const double& rVal,
+ const String& rValueStr, const sal_uInt16 nId );
+ SvxNumberInfoItem( const SvxNumberInfoItem& );
+ ~SvxNumberInfoItem();
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const;
+ virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ SvNumberFormatter* GetNumberFormatter() const { return pFormatter; }
+ void SetNumberFormatter( SvNumberFormatter* pNumFrmt );
+ const String& GetValueString() const { return aStringVal; }
+ void SetStringValue( const String& rNewVal );
+ double GetValueDouble() const { return nDoubleVal; }
+ void SetDoubleValue( const double& rNewVal );
+
+ const sal_uInt32* GetDelArray() const { return pDelFormatArr; }
+ void SetDelFormatArray( const sal_uInt32* pData,
+ const sal_uInt32 nCount );
+
+ SvxNumberValueType GetValueType() const { return eValueType; }
+ sal_uInt32 GetDelCount() const { return nDelCount; }
+
+private:
+ SvNumberFormatter* pFormatter;
+ SvxNumberValueType eValueType;
+ String aStringVal;
+ double nDoubleVal;
+
+ sal_uInt32* pDelFormatArr;
+ sal_uInt32 nDelCount;
+};
+
+
+
+#endif
+
diff --git a/svx/inc/svx/numvset.hxx b/svx/inc/svx/numvset.hxx
new file mode 100644
index 000000000000..6118460a8356
--- /dev/null
+++ b/svx/inc/svx/numvset.hxx
@@ -0,0 +1,165 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_NUMVSET_HXX
+#define _SVX_NUMVSET_HXX
+
+
+// include ---------------------------------------------------------------
+
+
+#include <svtools/valueset.hxx>
+#include <limits.h>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/lang/Locale.hpp>
+#include "svx/svxdllapi.h"
+
+namespace com{namespace sun{ namespace star{
+ namespace container{
+ class XIndexAccess;
+ }
+ namespace beans{
+ struct PropertyValue;
+ }
+ namespace text{
+ class XNumberingFormatter;
+ }
+}}}
+
+class SvxBrushItem;
+class SvxNumRule;
+struct SvxBmpItemInfo
+{
+ SvxBrushItem* pBrushItem;
+ sal_uInt16 nItemId;
+};
+
+/*-----------------09/09/97 01:05pm-----------------
+
+--------------------------------------------------*/
+class SVX_DLLPUBLIC SvxNumValueSet : public ValueSet
+{
+ Color aLineColor;
+ sal_uInt16 nPageType;
+ sal_Bool bHTMLMode;
+ Rectangle aOrgRect;
+ VirtualDevice* pVDev;
+
+ com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter> xFormatter;
+ com::sun::star::lang::Locale aLocale;
+
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Sequence<
+ com::sun::star::beans::PropertyValue> > aNumSettings;
+
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::container::XIndexAccess> > aOutlineSettings;
+ public:
+ SvxNumValueSet( Window* pParent, const ResId& rResId, sal_uInt16 nType );
+ ~SvxNumValueSet();
+
+ virtual void UserDraw( const UserDrawEvent& rUDEvt );
+
+ void SetHTMLMode(sal_Bool bSet) {bHTMLMode = bSet;}
+ void SetNumberingSettings(
+ const com::sun::star::uno::Sequence<
+ com::sun::star::uno::Sequence<
+ com::sun::star::beans::PropertyValue> >& aNum,
+ com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter>& xFormatter,
+ const com::sun::star::lang::Locale& rLocale );
+
+ void SetOutlineNumberingSettings(
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::container::XIndexAccess> >& rOutline,
+ com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter>& xFormatter,
+ const com::sun::star::lang::Locale& rLocale);
+};
+
+/*-----------------13.02.97 09.32-------------------
+
+--------------------------------------------------*/
+
+class SVX_DLLPUBLIC SvxBmpNumValueSet : public SvxNumValueSet
+{
+ String sBullets;
+ Timer aFormatTimer;
+ sal_Bool bGrfNotFound;
+
+ protected:
+ DECL_LINK(FormatHdl_Impl, Timer*);
+
+ void SetGrfNotFound(sal_Bool bSet) {bGrfNotFound = bSet;}
+ sal_Bool IsGrfNotFound()const {return bGrfNotFound;}
+
+ Timer& GetFormatTimer() {return aFormatTimer;}
+
+ public:
+ SvxBmpNumValueSet( Window* pParent, const ResId& rResId/*, const List& rStrNames*/);
+ ~SvxBmpNumValueSet();
+
+ virtual void UserDraw( const UserDrawEvent& rUDEvt );
+
+};
+/*-----------------02.12.97 10:31-------------------
+
+--------------------------------------------------*/
+
+class SvxNumberingPreview : public Window
+{
+ const SvxNumRule* pActNum;
+ Font aStdFont;
+ long nPageWidth;
+ const String* pOutlineNames;
+ sal_Bool bPosition;
+ sal_uInt16 nActLevel;
+
+ protected:
+ virtual void Paint( const Rectangle& rRect );
+
+ public:
+ SvxNumberingPreview(Window* pParent, const ResId& rResId ) :
+ Window(pParent, rResId),
+ pActNum(0),nPageWidth(0), pOutlineNames(0), bPosition(sal_False), nActLevel(USHRT_MAX)
+ { SetBorderStyle( WINDOW_BORDER_MONO ); }
+
+ void SetNumRule(const SvxNumRule* pNum)
+ {pActNum = pNum; Invalidate();};
+ void SetPageWidth(long nPgWidth)
+ {nPageWidth = nPgWidth;}
+ void SetOutlineNames(const String* pNames)
+ {pOutlineNames = pNames;}
+ void SetPositionMode()
+ { bPosition = sal_True;}
+ void SetLevel(sal_uInt16 nSet) {nActLevel = nSet;}
+
+};
+
+
+#endif
+
diff --git a/svx/inc/svx/obj3d.hxx b/svx/inc/svx/obj3d.hxx
new file mode 100644
index 000000000000..5c25582a1c7b
--- /dev/null
+++ b/svx/inc/svx/obj3d.hxx
@@ -0,0 +1,328 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _E3D_OBJ3D_HXX
+#define _E3D_OBJ3D_HXX
+
+#include <svx/svdoattr.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/volume3d.hxx>
+#include <svx/def3d.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/deflt3d.hxx>
+#include <vcl/bitmap.hxx>
+#include <svx/svx3ditems.hxx>
+#include <svx/xflclit.hxx>
+#include <svl/itemset.hxx>
+#include <basegfx/polygon/b3dpolypolygon.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/vector/b2enums.hxx>
+#include "svx/svxdllapi.h"
+
+//************************************************************
+// Vorausdeklarationen
+//************************************************************
+
+class SfxPoolItem;
+class Viewport3D;
+class E3dScene;
+class E3dPolyScene;
+
+namespace basegfx { class B3DPolyPolygon; }
+namespace sdr { namespace properties {
+ class BaseProperties;
+ class E3dProperties;
+ class E3dCompoundProperties;
+ class E3dExtrudeProperties;
+ class E3dLatheProperties;
+ class E3dSphereProperties;
+}}
+
+/*************************************************************************
+|*
+|* GeoData relevant fuer Undo-Actions
+|*
+\************************************************************************/
+
+class E3DObjGeoData : public SdrObjGeoData
+{
+public:
+ basegfx::B3DRange maLocalBoundVol; // umschliessendes Volumen des Objekts
+ basegfx::B3DHomMatrix maTransformation; // lokale Transformation
+
+ E3DObjGeoData() {}
+};
+
+/*************************************************************************
+|*
+|* Liste fuer 3D-Objekte
+|*
+\************************************************************************/
+
+class E3dObjList : public SdrObjList
+{
+public:
+ TYPEINFO();
+ E3dObjList(SdrModel* pNewModel = 0, SdrPage* pNewPage = 0, E3dObjList* pNewUpList = 0);
+ SVX_DLLPUBLIC E3dObjList(const E3dObjList& rSrcList);
+ SVX_DLLPUBLIC virtual ~E3dObjList();
+
+ virtual void NbcInsertObject(SdrObject* pObj, sal_uIntPtr nPos=CONTAINER_APPEND, const SdrInsertReason* pReason=NULL);
+ virtual void InsertObject(SdrObject* pObj, sal_uIntPtr nPos=CONTAINER_APPEND, const SdrInsertReason* pReason=NULL);
+ virtual SdrObject* NbcRemoveObject(sal_uIntPtr nObjNum);
+ virtual SdrObject* RemoveObject(sal_uIntPtr nObjNum);
+};
+
+/*************************************************************************
+|*
+|* Basisklasse fuer 3D-Objekte
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC E3dObject : public SdrAttrObj
+{
+private:
+ // to allow sdr::properties::E3dProperties access to StructureChanged()
+ friend class sdr::properties::E3dProperties;
+
+ // Aus der E3dObjList und E3dDragMethod alles erlauben
+ friend class E3dObjList;
+ friend class E3dDragMethod;
+
+ protected:
+ virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
+
+ E3dObjList maSubList; // Subliste (Childobjekte)
+
+ basegfx::B3DRange maLocalBoundVol; // umschliessendes Volumen des Objekts (aus geometrieerzeugung)
+ basegfx::B3DHomMatrix maTransformation; // lokale Transformation
+ basegfx::B3DHomMatrix maFullTransform; // globale Transformation (inkl. Parents)
+
+ // Flags
+ unsigned mbTfHasChanged : 1;
+ unsigned mbIsSelected : 1;
+
+ public:
+ void SetBoundVolInvalid();
+
+ protected:
+ void SetTransformChanged();
+ virtual void NewObjectInserted(const E3dObject* p3DObj);
+ virtual void StructureChanged();
+ basegfx::B3DRange RecalcBoundVolume() const;
+
+protected:
+ // E3dObject is only a helper class (for E3DScene and E3DCompoundObject)
+ // and no instances should be created from anyone, so i move the constructors
+ // to protected area
+ E3dObject();
+ E3dObject(sal_Bool bIsFromChart);
+
+public:
+ TYPEINFO();
+ virtual void RecalcSnapRect();
+ virtual void SetRectsDirty(sal_Bool bNotMyself = sal_False);
+
+ virtual ~E3dObject();
+
+ virtual sal_uInt32 GetObjInventor() const;
+ virtual sal_uInt16 GetObjIdentifier() const;
+
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
+
+ virtual void NbcSetLayer(SdrLayerID nLayer);
+
+ virtual void SetObjList(SdrObjList* pNewObjList);
+ virtual void SetPage(SdrPage* pNewPage);
+ virtual void SetModel(SdrModel* pNewModel);
+ virtual void NbcMove(const Size& rSize);
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+ virtual SdrObjList* GetSubList() const;
+
+ // 3D-Objekt in die Gruppe einfuegen; Eigentumsuebergang!
+ virtual void Insert3DObj(E3dObject* p3DObj);
+ void Remove3DObj(E3dObject* p3DObj);
+
+ E3dObject* GetParentObj() const;
+ virtual E3dScene* GetScene() const;
+
+ const basegfx::B3DRange& GetBoundVolume() const;
+ void InvalidateBoundVolume();
+
+ // komplette Transformation inklusive aller Parents berechnen
+ const basegfx::B3DHomMatrix& GetFullTransform() const;
+
+ // Transformationsmatrix abfragen bzw. (zurueck)setzen
+ const basegfx::B3DHomMatrix& GetTransform() const;
+ virtual void NbcSetTransform(const basegfx::B3DHomMatrix& rMatrix);
+ virtual void SetTransform(const basegfx::B3DHomMatrix& rMatrix);
+
+ // [FG] 2D-Rotationen, werden hier als Rotationen um die Z-Achse, die in den Bildschirm zeigt,
+ // implementiert plus eine Verschiebung der Scene. Dies bedeutet auch die Scene (E3dScene)
+ // muss diese Routine in der Klasse als virtual definieren.
+ virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs);
+
+ // get wireframe polygon for local object. No transform is applied.
+ basegfx::B3DPolyPolygon CreateWireframe() const;
+
+ // TakeObjName...() ist fuer die Anzeige in der UI, z.B. "3 Rahmen selektiert".
+ virtual void TakeObjNameSingul(String& rName) const;
+ virtual void TakeObjNamePlural(String& rName) const;
+ sal_uInt16 GetLogicalGroup() { return 0; }
+ virtual void operator=(const SdrObject&);
+
+ virtual SdrObjGeoData *NewGeoData() const;
+ virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
+ virtual void RestGeoData(const SdrObjGeoData& rGeo);
+
+ // Selektion Setzen/Lesen
+ bool GetSelected() const { return mbIsSelected; }
+ void SetSelected(bool bNew);
+
+ // Aufbrechen
+ virtual sal_Bool IsBreakObjPossible();
+ virtual SdrAttrObj* GetBreakObj();
+};
+
+/*************************************************************************
+|*
+|* Klasse fuer alle zusammengesetzen Objekte (Cube, Lathe, Scene, Extrude)
+|* Diese Klasse erspart ein paar ISA-Abfragen und sie beschleunigt das
+|* Verhalten ungemein, da alle Attribute usw. fuer die untergeordneten
+|* Polygone hierueber gehalten werden. Die Polygone duerfen nur Attribute
+|* halten, wenn sie direkt einer Szene untergeordnet sind.
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC E3dCompoundObject : public E3dObject
+{
+private:
+ // to allow sdr::properties::E3dCompoundProperties access to SetGeometryValid()
+ friend class sdr::properties::E3dCompoundProperties;
+ friend class sdr::properties::E3dExtrudeProperties;
+ friend class sdr::properties::E3dLatheProperties;
+ friend class sdr::properties::E3dSphereProperties;
+
+protected:
+ virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
+
+ // Material des Objektes
+ Color aMaterialAmbientColor;
+
+ // Attribute zur Geometrieerzeugung
+ unsigned bCreateNormals : 1;
+ unsigned bCreateTexture : 1;
+
+protected:
+ void SetDefaultAttributes(E3dDefaultAttributes& rDefault);
+
+ // convert given basegfx::B3DPolyPolygon to screen coor
+ basegfx::B2DPolyPolygon TransformToScreenCoor(const basegfx::B3DPolyPolygon& rCandidate);
+
+public :
+ TYPEINFO();
+
+ E3dCompoundObject();
+ E3dCompoundObject(E3dDefaultAttributes& rDefault);
+ virtual ~E3dCompoundObject();
+
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
+ virtual sal_uInt32 GetHdlCount() const;
+ virtual void AddToHdlList(SdrHdlList& rHdlList) const;
+
+ // DoubleSided: sal_True/FALSE
+ sal_Bool GetDoubleSided() const
+ { return ((const Svx3DDoubleSidedItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_DOUBLE_SIDED)).GetValue(); }
+
+ // NormalsKind: 0 == sal_False/sal_False, 1 == sal_True/sal_False, else == sal_True/TRUE
+ sal_uInt16 GetNormalsKind() const
+ { return ((const Svx3DNormalsKindItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_NORMALS_KIND)).GetValue(); }
+
+ // NormalsInvert: sal_True/FALSE
+ sal_Bool GetNormalsInvert() const
+ { return ((const Svx3DNormalsInvertItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_NORMALS_INVERT)).GetValue(); }
+
+ // TextureProjX: 0 == sal_False/sal_False, 1 == sal_True/sal_False, else == sal_True/TRUE
+ sal_uInt16 GetTextureProjectionX() const
+ { return ((const Svx3DTextureProjectionXItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_TEXTURE_PROJ_X)).GetValue(); }
+
+ // TextureProjY: 0 == sal_False/sal_False, 1 == sal_True/sal_False, else == sal_True/TRUE
+ sal_uInt16 GetTextureProjectionY() const
+ { return ((const Svx3DTextureProjectionYItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_TEXTURE_PROJ_Y)).GetValue(); }
+
+ // Shadow3D: sal_True/FALSE
+ sal_Bool GetShadow3D() const
+ { return ((const Svx3DShadow3DItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_SHADOW_3D)).GetValue(); }
+
+ // MaterialColor: Color
+ Color GetMaterialColor() const
+ { return ((const Svx3DMaterialColorItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_MAT_COLOR)).GetValue(); }
+
+ // MaterialEmission: Color
+ Color GetMaterialEmission() const
+ { return ((const Svx3DMaterialEmissionItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_MAT_EMISSION)).GetValue(); }
+
+ // MaterialSpecular: Color
+ Color GetMaterialSpecular() const
+ { return ((const Svx3DMaterialSpecularItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_MAT_SPECULAR)).GetValue(); }
+
+ // MaterialSpecularIntensity:
+ sal_uInt16 GetMaterialSpecularIntensity() const
+ { return ((const Svx3DMaterialSpecularIntensityItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY)).GetValue(); }
+
+ // TextureFilter: sal_True/FALSE
+ sal_Bool GetTextureFilter() const
+ { return ((const Svx3DTextureFilterItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_TEXTURE_FILTER)).GetValue(); }
+
+ // #i28528#
+ // Added extra Item (Bool) for chart2 to be able to show reduced line geometry
+ sal_Bool GetReducedLineGeometry() const
+ { return ((const Svx3DReducedLineGeometryItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY)).GetValue(); }
+
+ virtual sal_uInt16 GetObjIdentifier() const;
+ virtual void RecalcSnapRect();
+
+ // Parameter Geometrieerzeugung setzen/lesen
+ sal_Bool GetCreateNormals() const { return bCreateNormals; }
+ void SetCreateNormals(sal_Bool bNew);
+
+ sal_Bool GetCreateTexture() const { return bCreateTexture; }
+ void SetCreateTexture(sal_Bool bNew);
+
+ // Copy-Operator
+ virtual void operator=(const SdrObject&);
+
+ // Material des Objektes
+ const Color& GetMaterialAmbientColor() const { return aMaterialAmbientColor; }
+ void SetMaterialAmbientColor(const Color& rColor);
+
+ // #110988#
+ sal_Bool IsAOrdNumRemapCandidate(E3dScene*& prScene) const;
+};
+
+#endif // _E3D_OBJ3D_HXX
diff --git a/svx/inc/svx/objfac3d.hxx b/svx/inc/svx/objfac3d.hxx
new file mode 100644
index 000000000000..6ce30853f441
--- /dev/null
+++ b/svx/inc/svx/objfac3d.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _OBJFAC3D_HXX
+#define _OBJFAC3D_HXX
+
+#include "svx/svxdllapi.h"
+
+
+/*************************************************************************
+|*
+|* Factory fuer Chart-spezifische Objekte
+|*
+\************************************************************************/
+
+class SdrObjFactory;
+
+
+#include <tools/link.hxx>
+
+class SVX_DLLPUBLIC E3dObjFactory
+{
+public:
+ E3dObjFactory();
+ ~E3dObjFactory();
+
+ DECL_LINK(MakeObject, SdrObjFactory*);
+};
+
+
+
+#endif // _OBJFAC3D_HXX
diff --git a/svx/inc/svx/ofaitem.hxx b/svx/inc/svx/ofaitem.hxx
new file mode 100644
index 000000000000..8e58cb5ef742
--- /dev/null
+++ b/svx/inc/svx/ofaitem.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _OFF_OFAITEM_HXX
+#define _OFF_OFAITEM_HXX
+
+// include ----------------------------------------------------------------
+
+#include <svl/poolitem.hxx>
+#include "svx/svxdllapi.h"
+
+// class OfaPtrItem ------------------------------------------------------
+
+class SVX_DLLPUBLIC OfaPtrItem : public SfxPoolItem
+{
+private:
+ void* pPtr;
+
+public:
+ OfaPtrItem( sal_uInt16 nWhich, void *pPtr );
+ OfaPtrItem( const OfaPtrItem& );
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+ void* GetValue() const { return pPtr; }
+ void SetValue( void* pNewPtr ) { pPtr = pNewPtr; }
+};
+
+#endif
diff --git a/svx/inc/svx/optgenrl.hxx b/svx/inc/svx/optgenrl.hxx
new file mode 100644
index 000000000000..bea7ae38def5
--- /dev/null
+++ b/svx/inc/svx/optgenrl.hxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTGENRL_HXX
+#define _SVX_OPTGENRL_HXX
+
+// Defines for setting the fokus of a Edit via a slot from external.
+#define UNKNOWN_EDIT ((sal_uInt16)0)
+#define COMPANY_EDIT ((sal_uInt16)1)
+#define FIRSTNAME_EDIT ((sal_uInt16)2)
+#define LASTNAME_EDIT ((sal_uInt16)3)
+#define STREET_EDIT ((sal_uInt16)4)
+#define COUNTRY_EDIT ((sal_uInt16)5)
+#define PLZ_EDIT ((sal_uInt16)6)
+#define CITY_EDIT ((sal_uInt16)7)
+#define STATE_EDIT ((sal_uInt16)8)
+#define TITLE_EDIT ((sal_uInt16)9)
+#define POSITION_EDIT ((sal_uInt16)10)
+#define SHORTNAME_EDIT ((sal_uInt16)11)
+#define TELPRIV_EDIT ((sal_uInt16)12)
+#define TELCOMPANY_EDIT ((sal_uInt16)13)
+#define FAX_EDIT ((sal_uInt16)14)
+#define EMAIL_EDIT ((sal_uInt16)15)
+
+#endif // #ifndef _SVX_OPTGENRL_HXX
+
+
diff --git a/svx/inc/svx/optgrid.hxx b/svx/inc/svx/optgrid.hxx
new file mode 100644
index 000000000000..dda6afae6104
--- /dev/null
+++ b/svx/inc/svx/optgrid.hxx
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTGRID_HXX
+#define _SVX_OPTGRID_HXX
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/tabdlg.hxx>
+#include <svl/eitem.hxx>
+#include <vcl/group.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include "svx/svxdllapi.h"
+
+class SvxGridTabPage;
+
+// class SvxOptionsGrid --------------------------------------------------
+
+class SVX_DLLPUBLIC SvxOptionsGrid
+{
+protected:
+ sal_uInt32 nFldDrawX;
+ sal_uInt32 nFldDivisionX;
+ sal_uInt32 nFldDrawY;
+ sal_uInt32 nFldDivisionY;
+ sal_uInt32 nFldSnapX;
+ sal_uInt32 nFldSnapY;
+ sal_Bool bUseGridsnap:1;
+ sal_Bool bSynchronize:1;
+ sal_Bool bGridVisible:1;
+ sal_Bool bEqualGrid: 1;
+
+public:
+ SvxOptionsGrid();
+ ~SvxOptionsGrid();
+
+ void SetFldDrawX( sal_uInt32 nSet){nFldDrawX = nSet;}
+ void SetFldDivisionX(sal_uInt32 nSet){nFldDivisionX = nSet;}
+ void SetFldDrawY ( sal_uInt32 nSet){nFldDrawY = nSet;}
+ void SetFldDivisionY(sal_uInt32 nSet){nFldDivisionY = nSet;}
+ void SetFldSnapX( sal_uInt32 nSet){nFldSnapX = nSet;}
+ void SetFldSnapY ( sal_uInt32 nSet){nFldSnapY = nSet;}
+ void SetUseGridSnap( sal_Bool bSet ) {bUseGridsnap = bSet;}
+ void SetSynchronize( sal_Bool bSet ) {bSynchronize = bSet;}
+ void SetGridVisible( sal_Bool bSet ) {bGridVisible = bSet;}
+ void SetEqualGrid( sal_Bool bSet ) {bEqualGrid = bSet;}
+
+ sal_uInt32 GetFldDrawX( ) const { return nFldDrawX; }
+ sal_uInt32 GetFldDivisionX() const { return nFldDivisionX;}
+ sal_uInt32 GetFldDrawY ( ) const { return nFldDrawY; }
+ sal_uInt32 GetFldDivisionY() const { return nFldDivisionY;}
+ sal_uInt32 GetFldSnapX( ) const { return nFldSnapX; }
+ sal_uInt32 GetFldSnapY ( ) const { return nFldSnapY; }
+ sal_Bool GetUseGridSnap( ) const { return bUseGridsnap; }
+ sal_Bool GetSynchronize( ) const { return bSynchronize; }
+ sal_Bool GetGridVisible( ) const { return bGridVisible; }
+ sal_Bool GetEqualGrid() const { return bEqualGrid; }
+};
+
+// class SvxGridItem -----------------------------------------------------
+
+class SVX_DLLPUBLIC SvxGridItem : public SvxOptionsGrid, public SfxPoolItem
+{
+ // #i9076#
+ friend class SvxGridTabPage;
+
+public:
+ SvxGridItem( sal_uInt16 _nWhich) : SfxPoolItem(_nWhich){};
+ SvxGridItem( const SvxGridItem& pTestItem );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+};
+
+// class SvxGridTabPage --------------------------------------------------
+
+class SVX_DLLPUBLIC SvxGridTabPage : public SfxTabPage
+{
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+public:
+ SvxGridTabPage( Window* pParent, const SfxItemSet& rSet );
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+
+ virtual sal_Bool FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet );
+
+private:
+ CheckBox aCbxUseGridsnap;
+ CheckBox aCbxGridVisible;
+
+ FixedLine aFlResolution;
+ FixedText aFtDrawX;
+ MetricField aMtrFldDrawX;
+ FixedText aFtDrawY;
+ MetricField aMtrFldDrawY;
+
+ FixedLine aFlDivision;
+ FixedText aFtDivisionX;
+ NumericField aNumFldDivisionX;
+ FixedText aDivisionPointX;
+
+ FixedText aFtDivisionY;
+ NumericField aNumFldDivisionY;
+ FixedText aDivisionPointY;
+
+ CheckBox aCbxSynchronize;
+ FixedLine aGrpDrawGrid; // Neu
+
+protected:
+ //these controls are used in draw and impress
+ FixedLine aGrpSnap;
+ CheckBox aCbxSnapHelplines;
+ CheckBox aCbxSnapBorder;
+ CheckBox aCbxSnapFrame;
+ CheckBox aCbxSnapPoints;
+ FixedText aFtSnapArea;
+ MetricField aMtrFldSnapArea;
+
+ FixedLine aSeparatorFL;
+
+ FixedLine aGrpOrtho;
+ CheckBox aCbxOrtho;
+ CheckBox aCbxBigOrtho;
+ CheckBox aCbxRotate;
+ MetricField aMtrFldAngle;
+ FixedText aFtBezAngle;
+ MetricField aMtrFldBezAngle;
+
+private:
+ sal_Bool bAttrModified;
+// sal_Bool bEqualGrid; // Neu
+
+#ifdef _SVX_OPTGRID_CXX
+ DECL_LINK( ClickRotateHdl_Impl, void * );
+ DECL_LINK( ChangeDrawHdl_Impl, MetricField * );
+ DECL_LINK( ChangeGridsnapHdl_Impl, void * );
+ DECL_LINK( ChangeDivisionHdl_Impl, NumericField * );
+
+#endif
+};
+
+
+#endif
+
diff --git a/svx/inc/svx/orienthelper.hxx b/svx/inc/svx/orienthelper.hxx
new file mode 100644
index 000000000000..7508740b62d6
--- /dev/null
+++ b/svx/inc/svx/orienthelper.hxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_ORIENTHELPER_HXX
+#define SVX_ORIENTHELPER_HXX
+
+#include <memory>
+#include <vcl/window.hxx>
+#include <sfx2/itemconnect.hxx>
+#include "svx/svxdllapi.h"
+
+class NumericField;
+class CheckBox;
+
+namespace svx {
+
+class DialControl;
+
+// ============================================================================
+
+struct OrientationHelper_Impl;
+
+/** A helper class that manages a DialControl and a "Stacked text" check box.
+
+ This helper remembers a DialControl for entering a rotation angle, and a
+ check box for stacked text, that enables/disables other controls dependent
+ on its state.
+
+ It is possible to register more controls that have to be enabled/disabled
+ together with this helper object (optionally dependent on the stacked text
+ check box), using the function AddDependentWindow(). All registered windows
+ are handled on a call of Enable(), or Show(), or on changing the state of
+ the "Stacked text" check box.
+
+ Note: The member function SetStackedState() should be used instead of
+ direct modifications of the "Stacked text" check box. Otherwise the update
+ mechanism of registered controls will not work.
+ */
+class SVX_DLLPUBLIC OrientationHelper
+{
+public:
+ explicit OrientationHelper(
+ DialControl& rCtrlDial,
+ CheckBox& rCbStacked );
+
+ /** @param rNfRotation A numeric field that will be connected to the DialControl. */
+ explicit OrientationHelper(
+ DialControl& rCtrlDial,
+ NumericField& rNfRotation,
+ CheckBox& rCbStacked );
+
+ virtual ~OrientationHelper();
+
+ /** Registers the passed window to be enabled/disabled on call of Enable().
+ @param eDisableIfStacked
+ STATE_CHECK: Window always disabled, if stacked text is turned on.
+ STATE_NOCHECK: Window always disabled, if stacked text is turned off.
+ STATE_DONTKNOW: Window will be enabled/disabled independent from stacked text. */
+ void AddDependentWindow( Window& rWindow, TriState eDisableIfStacked = STATE_DONTKNOW );
+
+ /** Enables or disables the dial control and all dependent windows. */
+ void Enable( bool bEnable = true );
+ /** Disables the dial control and all dependent windows. */
+ inline void Disable() { Enable( false ); }
+
+ /** Shows or hides the dial control and all dependent windows. */
+ void Show( bool bShow = true );
+ /** Hides the dial control and all dependent windows. */
+ inline void Hide() { Show( false ); }
+
+ /** Sets the "stacked" check box to the passed state and updates dependent controls. */
+ void SetStackedState( TriState eState );
+ /** Returns the state of the "stacked" check box. */
+ TriState GetStackedState() const;
+
+ /** Enables/disables the "don't know" state of the "Stacked text" check box. */
+ void EnableStackedTriState( bool bEnable = true );
+
+private:
+ std::auto_ptr< OrientationHelper_Impl > mpImpl;
+};
+
+// ============================================================================
+
+/** Wrapper for usage of the stacked attribute of an OrientationHelper in item connections. */
+class SVX_DLLPUBLIC OrientStackedWrapper : public sfx::SingleControlWrapper< OrientationHelper, bool >
+{
+public:
+ explicit OrientStackedWrapper( OrientationHelper& rOrientHlp );
+
+ virtual bool IsControlDontKnow() const;
+ virtual void SetControlDontKnow( bool bSet );
+
+ virtual bool GetControlValue() const;
+ virtual void SetControlValue( bool bValue );
+};
+
+// ----------------------------------------------------------------------------
+
+/** An item<->control connection for the stacked attribute of an OrientationHelper. */
+typedef sfx::ItemControlConnection< sfx::BoolItemWrapper, OrientStackedWrapper > OrientStackedConnection;
+
+// ============================================================================
+
+} // namespace
+
+#endif
+
diff --git a/svx/inc/svx/pagectrl.hxx b/svx/inc/svx/pagectrl.hxx
new file mode 100644
index 000000000000..c7554b4a445a
--- /dev/null
+++ b/svx/inc/svx/pagectrl.hxx
@@ -0,0 +1,170 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_PAGECTRL_HXX
+#define _SVX_PAGECTRL_HXX
+
+// include ---------------------------------------------------------------
+
+#include <vcl/window.hxx>
+#include "svx/svxdllapi.h"
+
+// forward ---------------------------------------------------------------
+
+class SvxBoxItem;
+struct PageWindow_Impl;
+
+// class SvxPageWindow ---------------------------------------------------
+
+class SVX_DLLPUBLIC SvxPageWindow : public Window
+{
+ using Window::GetBorder;
+
+private:
+ Size aWinSize;
+ Size aSize;
+
+ long nTop;
+ long nBottom;
+ long nLeft;
+ long nRight;
+ Color aColor;
+
+ PageWindow_Impl* pImpl;
+
+ long nHdLeft;
+ long nHdRight;
+ long nHdDist;
+ long nHdHeight;
+ Color aHdColor;
+ SvxBoxItem* pHdBorder;
+
+ long nFtLeft;
+ long nFtRight;
+ long nFtDist;
+ long nFtHeight;
+ Color aFtColor;
+ SvxBoxItem* pFtBorder;
+
+ sal_Bool bFooter :1;
+ sal_Bool bHeader :1;
+ sal_Bool bTable :1;
+ sal_Bool bHorz :1;
+ sal_Bool bVert :1;
+
+ sal_uInt16 eUsage;
+
+ String aLeftText;
+ String aRightText;
+
+protected:
+ virtual void Paint( const Rectangle& rRect );
+
+ virtual void DrawPage( const Point& rPoint,
+ const sal_Bool bSecond,
+ const sal_Bool bEnabled );
+
+public:
+ SvxPageWindow( Window* pParent, const ResId& rId );
+ ~SvxPageWindow();
+
+ void SetWidth( long nW ) { aSize.Width() = nW; }
+ void SetHeight( long nH ) { aSize.Height() = nH; }
+
+ void SetSize( const Size& rSz ) { aSize = rSz; }
+ const Size& GetSize() const { return aSize; }
+
+ void SetTop( long nNew ) { nTop = nNew; }
+ void SetBottom( long nNew ) { nBottom = nNew; }
+ void SetLeft( long nNew ) { nLeft = nNew; }
+ void SetRight( long nNew ) { nRight = nNew; }
+ void SetColor( const Color& rNew ) { aColor = rNew; }
+ void SetBorder( const SvxBoxItem& rNew );
+ void SetBitmap( Bitmap* pBmp );
+
+ long GetTop() const { return nTop; }
+ long GetBottom() const { return nBottom;}
+ long GetLeft() const { return nLeft; }
+ long GetRight() const { return nRight; }
+
+ const Color& GetColor() const { return aColor; }
+ const SvxBoxItem& GetBorder() const;
+
+ void SetHdLeft( long nNew ) { nHdLeft = nNew; }
+ void SetHdRight( long nNew ) { nHdRight = nNew; }
+ void SetHdDist( long nNew ) { nHdDist = nNew; }
+ void SetHdHeight( long nNew ) { nHdHeight = nNew; }
+ void SetHdColor( const Color& aNew ) { aHdColor = aNew; }
+ void SetHdBorder( const SvxBoxItem& rNew );
+
+ long GetHdLeft() const { return nHdLeft; }
+ long GetHdRight() const { return nHdRight; }
+ long GetHdDist() const { return nHdDist; }
+ long GetHdHeight() const { return nHdHeight;}
+
+ const Color& GetHdColor() const { return aHdColor; }
+ const SvxBoxItem& GetHdBorder() const { return *pHdBorder; }
+
+ void SetFtLeft( long nNew ) { nFtLeft = nNew; }
+ void SetFtRight( long nNew ) { nFtRight = nNew; }
+ void SetFtDist( long nNew ) { nFtDist = nNew; }
+ void SetFtHeight( long nNew ) { nFtHeight = nNew; }
+ void SetFtColor( const Color& aNew ) { aFtColor = aNew; }
+ void SetFtBorder( const SvxBoxItem& rNew );
+
+ long GetFtLeft() const { return nFtLeft; }
+ long GetFtRight() const { return nFtRight; }
+ long GetFtDist() const { return nFtDist; }
+ long GetFtHeight() const { return nFtHeight;}
+
+ const Color& GetFtColor() const { return aFtColor; }
+ const SvxBoxItem& GetFtBorder() const { return *pFtBorder; }
+
+ void SetUsage( sal_uInt16 eU ) { eUsage = eU; }
+ sal_uInt16 GetUsage() const { return eUsage;}
+
+ void SetHeader( sal_Bool bNew ) { bHeader = bNew; }
+ sal_Bool GetHeader() const { return bHeader;}
+ void SetFooter( sal_Bool bNew ) { bFooter = bNew; }
+ sal_Bool GetFooter() const { return bFooter;}
+
+ void SetTable( sal_Bool bNew ) { bTable = bNew; }
+ sal_Bool GetTable() const { return bTable;}
+ void SetHorz( sal_Bool bNew ) { bHorz = bNew; }
+ sal_Bool GetHorz() const { return bHorz;}
+ void SetVert( sal_Bool bNew ) { bVert = bNew; }
+ sal_Bool GetVert() const { return bVert;}
+
+ void EnableFrameDirection(sal_Bool bEnable);
+ //uses enum SvxFrameDirection
+ void SetFrameDirection(sal_Int32 nFrameDirection);
+
+ void ResetBackground();
+};
+
+#endif // #ifndef _SVX_PAGECTRL_HXX
+
+
diff --git a/svx/inc/svx/pageitem.hxx b/svx/inc/svx/pageitem.hxx
new file mode 100644
index 000000000000..50c7c8f86b59
--- /dev/null
+++ b/svx/inc/svx/pageitem.hxx
@@ -0,0 +1,157 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_PAGEITEM_HXX
+#define _SVX_PAGEITEM_HXX
+
+// include ---------------------------------------------------------------
+
+#include <svl/poolitem.hxx>
+#include <tools/string.hxx>
+#include "svx/svxdllapi.h"
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: SvxNumType
+ --------------------------------------------------------------------*/
+
+enum SvxNumType
+{
+ SVX_CHARS_UPPER_LETTER,
+ SVX_CHARS_LOWER_LETTER,
+ SVX_ROMAN_UPPER,
+ SVX_ROMAN_LOWER,
+ SVX_ARABIC,
+ SVX_NUMBER_NONE,
+ SVX_CHAR_SPECIAL,
+ SVX_PAGEDESC
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Benutzung der Seite
+ --------------------------------------------------------------------*/
+
+enum SvxPageUsage
+{
+ SVX_PAGE_LEFT = 0x0001,
+ SVX_PAGE_RIGHT = 0x0002,
+ SVX_PAGE_ALL = 0x0003,
+ SVX_PAGE_MIRROR = 0x0007,
+ SVX_PAGE_HEADERSHARE = 0x0040,
+ SVX_PAGE_FOOTERSHARE = 0x0080
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Teile der Seitenbeschreibung
+ --------------------------------------------------------------------*/
+
+
+
+/*
+[Beschreibung]
+Dieses Item beschreibt ein Seiten-Attribut (Name der Vorlage, Numerierung,
+Portrait oder Landscape, Layout).
+*/
+
+class SVX_DLLPUBLIC SvxPageItem: public SfxPoolItem
+{
+private:
+ String aDescName; // Name der Vorlage
+ SvxNumType eNumType; // Numerierung
+ sal_Bool bLandscape; // Portrait / Landscape
+ sal_uInt16 eUse; // Layout
+
+public:
+
+ TYPEINFO();
+ SvxPageItem( const sal_uInt16 nId );
+ SvxPageItem( const SvxPageItem& rItem );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+ virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const;
+ virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const;
+
+ // Ausrichtung
+ sal_uInt16 GetPageUsage() const { return eUse; }
+ void SetPageUsage(sal_uInt16 eU) { eUse= eU; }
+
+ sal_Bool IsLandscape() const { return bLandscape; }
+ void SetLandscape(sal_Bool bL) { bLandscape = bL; }
+
+ // Numerierung
+ SvxNumType GetNumType() const { return eNumType; }
+ void SetNumType(SvxNumType eNum) { eNumType = eNum; }
+
+ // Name des Descriptors
+ const String& GetDescName() const { return aDescName; }
+ void SetDescName(const String& rStr) { aDescName = rStr; }
+};
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Container fuer Header/Footer-Attribute
+ --------------------------------------------------------------------*/
+
+
+
+/*
+[Beschreibung]
+Dieses Item dient als Container fuer Header- und Footer-Attribute.
+*/
+
+class SVX_DLLPUBLIC SvxSetItem: public SfxSetItem
+{
+public:
+ SvxSetItem( const sal_uInt16 nId, const SfxItemSet& rSet );
+ SvxSetItem( const SvxSetItem& rItem );
+ SvxSetItem( const sal_uInt16 nId, SfxItemSet* pSet );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nVersion ) const;
+ virtual SvStream& Store( SvStream&, sal_uInt16 nItemVersion ) const;
+};
+
+
+
+
+#endif
+
diff --git a/svx/inc/svx/paraprev.hxx b/svx/inc/svx/paraprev.hxx
new file mode 100644
index 000000000000..f01c9f4948b5
--- /dev/null
+++ b/svx/inc/svx/paraprev.hxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_PARAPREV_HXX
+#define _SVX_PARAPREV_HXX
+
+// include ---------------------------------------------------------------
+
+#include <vcl/window.hxx>
+#include <editeng/svxenum.hxx>
+#include "svx/svxdllapi.h"
+
+// enum ------------------------------------------------------------------
+
+enum SvxPrevLineSpace
+{
+ SVX_PREV_LINESPACE_1 = 0,
+ SVX_PREV_LINESPACE_15,
+ SVX_PREV_LINESPACE_2,
+ SVX_PREV_LINESPACE_PROP,
+ SVX_PREV_LINESPACE_MIN,
+ SVX_PREV_LINESPACE_DURCH
+};
+
+// class SvxParaPrevWindow -----------------------------------------------
+
+class SVX_DLLPUBLIC SvxParaPrevWindow : public Window
+{
+ using Window::Draw;
+private:
+ Size aWinSize;
+ Size aSize;
+
+ // Einzuege
+ long nLeftMargin;
+ long nRightMargin;
+ short nFirstLineOfst;
+ // Abstaende
+ sal_uInt16 nUpper;
+ sal_uInt16 nLower;
+ // Ausrichtung
+ SvxAdjust eAdjust;
+ // Letzte Zeile im Blocksatz
+ SvxAdjust eLastLine;
+ // Zeilenabstand
+ SvxPrevLineSpace eLine;
+ sal_uInt16 nLineVal;
+
+ String aText;
+ Rectangle Lines[9];
+
+protected:
+ virtual void Paint( const Rectangle& rRect );
+
+ void DrawParagraph( sal_Bool bAll );
+
+public:
+ SvxParaPrevWindow( Window* pParent, const ResId& rId );
+
+ void SetFirstLineOfst( short nNew ) { nFirstLineOfst = nNew; }
+ void SetLeftMargin( long nNew ) { nLeftMargin = nNew; }
+ void SetRightMargin( long nNew ) { nRightMargin = nNew; }
+ void SetUpper( sal_uInt16 nNew ) { nUpper = nNew; }
+ void SetLower( sal_uInt16 nNew ) { nLower = nNew; }
+ void SetAdjust( SvxAdjust eNew ) { eAdjust = eNew; }
+ void SetLastLine( SvxAdjust eNew ) { eLastLine = eNew; }
+ void SetLineSpace( SvxPrevLineSpace eNew, sal_uInt16 nNew = 0 )
+ { eLine = eNew; nLineVal = nNew; }
+ void SetText( const String& rStr ) { aText = rStr; }
+ void SetSize( Size aNew ) { aSize = aNew; }
+
+ short GetFirstLineOfst() const { return nFirstLineOfst; }
+ long GetLeftMargin() const { return nLeftMargin; }
+ long GetRightMargin() const { return nRightMargin; }
+ sal_uInt16 GetUpper() const { return nUpper; }
+ sal_uInt16 GetLower() const { return nLower; }
+ SvxAdjust GetAdjust() const { return eAdjust; }
+
+ SvxPrevLineSpace GetLineEnum() const { return eLine; }
+ sal_uInt16 GetLineValue() const { return nLineVal; }
+ String GetText() const { return aText; }
+ Size GetSize() const { return aSize; }
+
+ void OutputSizeChanged();
+
+ void Draw( sal_Bool bAll ) { DrawParagraph( bAll ); }
+};
+
+#endif
+
diff --git a/svx/inc/svx/passwd.hxx b/svx/inc/svx/passwd.hxx
new file mode 100644
index 000000000000..a52caa23335e
--- /dev/null
+++ b/svx/inc/svx/passwd.hxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_PASSWD_HXX
+#define _SVX_PASSWD_HXX
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/basedlgs.hxx>
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include "svx/svxdllapi.h"
+
+// class SvxPasswordDialog -----------------------------------------------
+
+class SVX_DLLPUBLIC SvxPasswordDialog : public SfxModalDialog
+{
+private:
+ FixedLine aOldFL;
+ FixedText aOldPasswdFT;
+ Edit aOldPasswdED;
+ FixedLine aNewFL;
+ FixedText aNewPasswdFT;
+ Edit aNewPasswdED;
+ FixedText aRepeatPasswdFT;
+ Edit aRepeatPasswdED;
+ OKButton aOKBtn;
+ CancelButton aEscBtn;
+ HelpButton aHelpBtn;
+
+ String aOldPasswdErrStr;
+ String aRepeatPasswdErrStr;
+
+ Link aCheckPasswordHdl;
+
+ sal_Bool bEmpty;
+
+ DECL_LINK( ButtonHdl, OKButton * );
+ DECL_LINK( EditModifyHdl, Edit * );
+
+public:
+ SvxPasswordDialog( Window* pParent, sal_Bool bAllowEmptyPasswords = sal_False, sal_Bool bDisableOldPassword = sal_False );
+ ~SvxPasswordDialog();
+
+ String GetOldPassword() const { return aOldPasswdED.GetText(); }
+ String GetNewPassword() const { return aNewPasswdED.GetText(); }
+
+ void SetCheckPasswordHdl( const Link& rLink ) { aCheckPasswordHdl = rLink; }
+};
+
+
+#endif
+
diff --git a/svx/inc/svx/pfiledlg.hxx b/svx/inc/svx/pfiledlg.hxx
new file mode 100644
index 000000000000..a3ed8bf6b050
--- /dev/null
+++ b/svx/inc/svx/pfiledlg.hxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_PFILEDLG_HXX
+#define _SVX_PFILEDLG_HXX
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/filedlghelper.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* Filedialog to insert Plugin-Fileformats
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC SvxPluginFileDlg
+{
+private:
+ sfx2::FileDialogHelper maFileDlg;
+
+public:
+ // with nKind = SID_INSERT_SOUND or
+ // nKind = SID_INSERT_VIDEO
+ SvxPluginFileDlg (Window *pParent, sal_uInt16 nKind );
+ ~SvxPluginFileDlg ();
+
+ ErrCode Execute();
+ String GetPath() const;
+
+ static bool IsAvailable (sal_uInt16 nKind);
+
+ void SetContext( sfx2::FileDialogHelper::Context eNewContext );
+};
+
+#endif // _SVX_PFILEDLG_HXX
+
+
diff --git a/svx/inc/svx/polygn3d.hxx b/svx/inc/svx/polygn3d.hxx
new file mode 100644
index 000000000000..9b2b469d3dac
--- /dev/null
+++ b/svx/inc/svx/polygn3d.hxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _E3D_POLYGON3D_HXX
+#define _E3D_POLYGON3D_HXX
+
+#include <svx/obj3d.hxx>
+#include "svx/svxdllapi.h"
+
+class SVX_DLLPUBLIC E3dPolygonObj : public E3dCompoundObject
+{
+private:
+ // Parameter
+ basegfx::B3DPolyPolygon aPolyPoly3D;
+ basegfx::B3DPolyPolygon aPolyNormals3D;
+ basegfx::B2DPolyPolygon aPolyTexture2D;
+ sal_Bool bLineOnly;
+
+ SVX_DLLPRIVATE void CreateDefaultNormals();
+ SVX_DLLPRIVATE void CreateDefaultTexture();
+
+protected:
+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+
+public:
+ void SetPolyPolygon3D(const basegfx::B3DPolyPolygon& rNewPolyPoly3D);
+ void SetPolyNormals3D(const basegfx::B3DPolyPolygon& rNewPolyPoly3D);
+ void SetPolyTexture2D(const basegfx::B2DPolyPolygon& rNewPolyPoly2D);
+
+ TYPEINFO();
+
+ E3dPolygonObj(
+ E3dDefaultAttributes& rDefault,
+ const basegfx::B3DPolyPolygon& rPolyPoly3D,
+ sal_Bool bLinOnly=sal_False);
+ E3dPolygonObj(
+ E3dDefaultAttributes& rDefault,
+ const basegfx::B3DPolyPolygon& rPolyPoly3D,
+ const basegfx::B3DPolyPolygon& rPolyNormals3D,
+ sal_Bool bLinOnly=sal_False);
+ E3dPolygonObj(
+ E3dDefaultAttributes& rDefault,
+ const basegfx::B3DPolyPolygon& rPolyPoly3D,
+ const basegfx::B3DPolyPolygon& rPolyNormals3D,
+ const basegfx::B2DPolyPolygon& rPolyTexture2D,
+ sal_Bool bLinOnly=sal_False);
+
+ E3dPolygonObj();
+ virtual ~E3dPolygonObj();
+
+ const basegfx::B3DPolyPolygon& GetPolyPolygon3D() const { return aPolyPoly3D; }
+ const basegfx::B3DPolyPolygon& GetPolyNormals3D() const { return aPolyNormals3D; }
+ const basegfx::B2DPolyPolygon& GetPolyTexture2D() const { return aPolyTexture2D; }
+
+ virtual sal_uInt16 GetObjIdentifier() const;
+ virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const;
+
+ virtual void operator=(const SdrObject&);
+
+ // LineOnly?
+ sal_Bool GetLineOnly() { return bLineOnly; }
+ void SetLineOnly(sal_Bool bNew);
+};
+
+#endif // _E3D_POLYGON3D_HXX
diff --git a/svx/inc/svx/polypolygoneditor.hxx b/svx/inc/svx/polypolygoneditor.hxx
new file mode 100644
index 000000000000..adc8eb0cbeaf
--- /dev/null
+++ b/svx/inc/svx/polypolygoneditor.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_POLYPOLYGONEDITOR_HXX_
+#define _SDR_POLYPOLYGONEDITOR_HXX_
+
+#include "svx/svxdllapi.h"
+
+#include "svx/ipolypolygoneditorcontroller.hxx"
+
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <set>
+
+class SdrUShortCont;
+
+namespace sdr
+{
+
+/** this class implements some helper functions to edit a B2DPolyPolygon */
+class SVX_DLLPUBLIC PolyPolygonEditor
+{
+public:
+ PolyPolygonEditor( const basegfx::B2DPolyPolygon& rPolyPolygon, bool bClosed );
+
+ const basegfx::B2DPolyPolygon& GetPolyPolygon() const { return maPolyPolygon; }
+
+ /** returns true if the B2DPolyPolygon was changed.
+ Warning: B2DPolyPolygon can be empty after this operation!
+ */
+ bool DeletePoints( const std::set< sal_uInt16 >& rAbsPoints );
+
+ /** returns true if the B2DPolyPolygon was changed.
+ */
+ bool SetSegmentsKind(SdrPathSegmentKind eKind, const std::set< sal_uInt16 >& rAbsPoints);
+
+ /** returns true if the B2DPolyPolygon was changed.
+ */
+ bool SetPointsSmooth( basegfx::B2VectorContinuity eFlags, const std::set< sal_uInt16 >& rAbsPoints);
+
+ /** Outputs the realative position ( polygon number and point number in that polygon ) from the absolut point number.
+ False is returned if the given absolute point is greater not inside this B2DPolyPolygon
+ */
+ static bool GetRelativePolyPoint( const basegfx::B2DPolyPolygon& rPoly, sal_uInt32 nAbsPnt, sal_uInt32& rPolyNum, sal_uInt32& rPointNum );
+
+private:
+ basegfx::B2DPolyPolygon maPolyPolygon;
+ bool mbIsClosed;
+};
+
+}
+
+#endif
diff --git a/svx/inc/svx/polysc3d.hxx b/svx/inc/svx/polysc3d.hxx
new file mode 100644
index 000000000000..2375a85ecb9b
--- /dev/null
+++ b/svx/inc/svx/polysc3d.hxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _E3D_POLYSC3D_HXX
+#define _E3D_POLYSC3D_HXX
+
+#include <svx/svdpage.hxx>
+#include <svx/scene3d.hxx>
+
+/*************************************************************************
+|*
+|* 3D-Szene mit Darstellung durch 2D-Polygone
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC E3dPolyScene : public E3dScene
+{
+public:
+ TYPEINFO();
+ E3dPolyScene();
+ E3dPolyScene(E3dDefaultAttributes& rDefault);
+
+ virtual sal_uInt16 GetObjIdentifier() const;
+};
+
+#endif // _E3D_POLYSC3D_HXX
diff --git a/svx/inc/svx/postattr.hxx b/svx/inc/svx/postattr.hxx
new file mode 100644
index 000000000000..5d75187b58b5
--- /dev/null
+++ b/svx/inc/svx/postattr.hxx
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_POSTATTR_HXX
+#define _SVX_POSTATTR_HXX
+
+// include ---------------------------------------------------------------
+
+#include <svl/stritem.hxx>
+#include "svx/svxdllapi.h"
+
+// class SvxPostItAuthorItem ---------------------------------------------
+
+
+
+/*
+[Beschreibung]
+Dieses Item beschreibt das Autoren-Kuerzel eines Notizzettels.
+*/
+
+class SVX_DLLPUBLIC SvxPostItAuthorItem: public SfxStringItem
+{
+public:
+ TYPEINFO();
+
+ SvxPostItAuthorItem( sal_uInt16 nWhich );
+
+ SvxPostItAuthorItem( const String& rAuthor, sal_uInt16 nWhich );
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+ inline SvxPostItAuthorItem& operator=( const SvxPostItAuthorItem& rAuthor )
+ {
+ SetValue( rAuthor.GetValue() );
+ return *this;
+ }
+};
+
+
+// class SvxPostItDateItem -----------------------------------------------
+
+
+
+/*
+[Beschreibung]
+Dieses Item beschreibt das Datum eines Notizzettels.
+*/
+
+class SVX_DLLPUBLIC SvxPostItDateItem: public SfxStringItem
+{
+public:
+ TYPEINFO();
+
+ SvxPostItDateItem( sal_uInt16 nWhich );
+
+ SvxPostItDateItem( const String& rDate, sal_uInt16 nWhich );
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+ inline SvxPostItDateItem& operator=( const SvxPostItDateItem& rDate )
+ {
+ SetValue( rDate.GetValue() );
+ return *this;
+ }
+};
+
+
+// class SvxPostItTextItem -----------------------------------------------
+
+
+
+/*
+[Beschreibung]
+Dieses Item beschreibt den Text eines Notizzettels.
+*/
+
+class SVX_DLLPUBLIC SvxPostItTextItem: public SfxStringItem
+{
+public:
+ TYPEINFO();
+
+ SvxPostItTextItem( sal_uInt16 nWhich );
+
+ SvxPostItTextItem( const String& rText, sal_uInt16 nWhich );
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+ inline SvxPostItTextItem& operator=( const SvxPostItTextItem& rText )
+ {
+ SetValue( rText.GetValue() );
+ return *this;
+ }
+};
+
+
+
+#endif
+
diff --git a/svx/inc/svx/prtqry.hxx b/svx/inc/svx/prtqry.hxx
new file mode 100644
index 000000000000..ce7ae239215f
--- /dev/null
+++ b/svx/inc/svx/prtqry.hxx
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_PRTQRY_HXX
+#define _SVX_PRTQRY_HXX
+
+#include <vcl/msgbox.hxx>
+#include "svx/svxdllapi.h"
+
+class SVX_DLLPUBLIC SvxPrtQryBox : public MessBox
+{
+public:
+ SvxPrtQryBox(Window* pParent);
+ ~SvxPrtQryBox();
+};
+
+#endif
diff --git a/svx/inc/svx/pszctrl.hxx b/svx/inc/svx/pszctrl.hxx
new file mode 100644
index 000000000000..4d6e8d29d49d
--- /dev/null
+++ b/svx/inc/svx/pszctrl.hxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_PSZCTRL_HXX
+#define _SVX_PSZCTRL_HXX
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/stbitem.hxx>
+#include "svx/svxdllapi.h"
+
+// forward ---------------------------------------------------------------
+
+class SvxSizeItem;
+struct SvxPosSizeStatusBarControl_Impl;
+
+// class SvxPosSizeToolBoxControl ----------------------------------------
+
+class SVX_DLLPUBLIC SvxPosSizeStatusBarControl : public SfxStatusBarControl
+{
+private:
+ SvxPosSizeStatusBarControl_Impl* pImp;
+ SVX_DLLPRIVATE String GetMetricStr_Impl( long nVal );
+public:
+ SFX_DECL_STATUSBAR_CONTROL();
+
+ SvxPosSizeStatusBarControl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar& rStb );
+ ~SvxPosSizeStatusBarControl();
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+ virtual void Paint( const UserDrawEvent& rEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+
+ static sal_uIntPtr GetDefItemWidth( const StatusBar& rStb );
+};
+
+
+#endif
+
diff --git a/svx/inc/svx/rectenum.hxx b/svx/inc/svx/rectenum.hxx
new file mode 100644
index 000000000000..98a00c3a1154
--- /dev/null
+++ b/svx/inc/svx/rectenum.hxx
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_RECTENUM_HXX
+#define _SVX_RECTENUM_HXX
+
+// enum ------------------------------------------------------------------
+
+enum RECT_POINT
+{
+ RP_LT, RP_MT, RP_RT, RP_LM, RP_MM, RP_RM, RP_LB, RP_MB, RP_RB
+};
+
+enum CTL_STYLE
+{
+ CS_RECT,
+ CS_LINE,
+ CS_ANGLE,
+ CS_SHADOW
+};
+
+
+#endif
diff --git a/svx/inc/svx/relfld.hxx b/svx/inc/svx/relfld.hxx
new file mode 100644
index 000000000000..192870b1d1b9
--- /dev/null
+++ b/svx/inc/svx/relfld.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_RELFLD_HXX
+#define _SVX_RELFLD_HXX
+
+// include ---------------------------------------------------------------
+
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+#include "svx/svxdllapi.h"
+
+
+// class SvxRelativeField ------------------------------------------------
+/*
+ [Beschreibung]
+
+ "Ahnlich der Klasse FontSizeBox. Abgeleitet von der Klasse MetricField.
+ Zus"atzliche Funktionalit"at: relative Angaben.
+*/
+
+class SVX_DLLPUBLIC SvxRelativeField : public MetricField
+{
+private:
+ sal_uInt16 nRelMin;
+ sal_uInt16 nRelMax;
+ sal_uInt16 nRelStep;
+ sal_Bool bRelativeMode;
+ sal_Bool bRelative;
+ sal_Bool bNegativeEnabled;
+
+protected:
+ void Modify();
+
+public:
+ SvxRelativeField( Window* pParent, WinBits nWinStyle = 0 );
+ SvxRelativeField( Window* pParent, const ResId& rResId );
+
+ void EnableRelativeMode( sal_uInt16 nMin = 50, sal_uInt16 nMax = 150,
+ sal_uInt16 nStep = 5 );
+ sal_Bool IsRelativeMode() const { return bRelativeMode; }
+ void SetRelative( sal_Bool bRelative = sal_False );
+ sal_Bool IsRelative() const { return bRelative; }
+ void EnableNegativeMode() {bNegativeEnabled = sal_True;}
+};
+
+
+#endif
+
diff --git a/svx/inc/svx/rotmodit.hxx b/svx/inc/svx/rotmodit.hxx
new file mode 100644
index 000000000000..d379713e9a37
--- /dev/null
+++ b/svx/inc/svx/rotmodit.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_ROTMODIT_HXX
+#define _SVX_ROTMODIT_HXX
+
+#include <svl/eitem.hxx>
+#include "svx/svxdllapi.h"
+
+//----------------------------------------------------------------------------
+// Ausrichtung bei gedrehtem Text
+
+enum SvxRotateMode
+{
+ SVX_ROTATE_MODE_STANDARD,
+ SVX_ROTATE_MODE_TOP,
+ SVX_ROTATE_MODE_CENTER,
+ SVX_ROTATE_MODE_BOTTOM
+};
+
+class SVX_DLLPUBLIC SvxRotateModeItem: public SfxEnumItem
+{
+public:
+ TYPEINFO();
+
+ SvxRotateModeItem( SvxRotateMode eMode=SVX_ROTATE_MODE_STANDARD, sal_uInt16 nWhich=0);
+ SvxRotateModeItem( const SvxRotateModeItem& rItem );
+ ~SvxRotateModeItem();
+
+ virtual sal_uInt16 GetValueCount() const;
+ virtual String GetValueText( sal_uInt16 nVal ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String& rText, const IntlWrapper * = 0 ) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+
+#endif
+
diff --git a/svx/inc/svx/rubydialog.hxx b/svx/inc/svx/rubydialog.hxx
new file mode 100644
index 000000000000..6b37b0cb85b0
--- /dev/null
+++ b/svx/inc/svx/rubydialog.hxx
@@ -0,0 +1,204 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _SVX_RUBYDLG_HXX_
+#define _SVX_RUBYDLG_HXX_
+
+#include <sfx2/childwin.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <vcl/lstbox.hxx>
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/edit.hxx>
+#include <vcl/scrbar.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include "svx/svxdllapi.h"
+
+namespace com{namespace sun{namespace star{
+ namespace view{
+ class XSelectionChangeListener;
+ }
+}}}
+
+
+class SvxRubyDialog;
+class RubyPreview : public Window
+{
+protected:
+ virtual void Paint( const Rectangle& rRect );
+ SvxRubyDialog& rParentDlg;
+
+public:
+ RubyPreview(SvxRubyDialog& rParent, const ResId& rResId);
+};
+
+class SVX_DLLPUBLIC SvxRubyChildWindow : public SfxChildWindow
+{
+ public:
+
+ SvxRubyChildWindow( Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo* );
+
+ SFX_DECL_CHILDWINDOW( SvxRubyChildWindow );
+
+};
+class SvxRubyData_Impl;
+class RubyEdit : public Edit
+{
+ Link aScrollHdl;
+ Link aJumpHdl;
+ virtual void GetFocus();
+ virtual long PreNotify( NotifyEvent& rNEvt );
+public:
+ RubyEdit(Window* pParent, const ResId& rResId) :
+ Edit(pParent, rResId){}
+ void SetScrollHdl(Link& rLink) {aScrollHdl = rLink;}
+ void SetJumpHdl(Link& rLink) {aJumpHdl = rLink;}
+};
+
+
+class SvxRubyDialog : public SfxModelessDialog
+{
+ using Window::SetText;
+ using Window::GetText;
+
+ friend class RubyPreview;
+
+ FixedText aLeftFT;
+ RubyEdit aLeft1ED;
+ FixedText aRightFT;
+ RubyEdit aRight1ED;
+ RubyEdit aLeft2ED;
+ RubyEdit aRight2ED;
+ RubyEdit aLeft3ED;
+ RubyEdit aRight3ED;
+ RubyEdit aLeft4ED;
+ RubyEdit aRight4ED;
+
+ RubyEdit* aEditArr[8];
+ ScrollBar aScrollSB;
+
+ CheckBox aAutoDetectionCB;
+
+ FixedText aAdjustFT;
+ ListBox aAdjustLB;
+
+ FixedText aPositionFT;
+ ListBox aPositionLB;
+
+ FixedText aCharStyleFT;
+ ListBox aCharStyleLB;
+ PushButton aStylistPB;
+
+ FixedText aPreviewFT;
+ RubyPreview aPreviewWin;
+
+ OKButton aApplyPB;
+ PushButton aClosePB;
+ HelpButton aHelpPB;
+
+ long nLastPos;
+ long nCurrentEdit;
+
+ sal_Bool bModified;
+
+ com::sun::star::uno::Reference<com::sun::star::view::XSelectionChangeListener> xImpl;
+ SfxBindings* pBindings;
+ SvxRubyData_Impl* pImpl;
+
+ DECL_LINK(ApplyHdl_Impl, PushButton*);
+ DECL_LINK(CloseHdl_Impl, PushButton*);
+ DECL_LINK(StylistHdl_Impl, PushButton*);
+ DECL_LINK(AutomaticHdl_Impl, CheckBox*);
+ DECL_LINK(ScrollHdl_Impl, ScrollBar*);
+ DECL_LINK(PositionHdl_Impl, ListBox*);
+ DECL_LINK(AdjustHdl_Impl, ListBox*);
+ DECL_LINK(CharStyleHdl_Impl, ListBox*);
+ DECL_LINK(EditModifyHdl_Impl, Edit*);
+ DECL_LINK(EditScrollHdl_Impl, sal_Int32*);
+ DECL_LINK(EditJumpHdl_Impl, sal_Int32*);
+
+ void SetText(sal_Int32 nPos, Edit& rLeft, Edit& rRight);
+ void GetText();
+ void ClearCharStyleList();
+ void AssertOneEntry();
+
+ void Update();
+ virtual sal_Bool Close();
+
+ long GetLastPos() const {return nLastPos;}
+ void SetLastPos(long nSet) {nLastPos = nSet;}
+
+ sal_Bool IsModified() const {return bModified;}
+ void SetModified(sal_Bool bSet) {bModified = bSet;}
+
+ void EnableControls(sal_Bool bEnable)
+ {
+ aLeftFT.Enable(bEnable);
+ aRightFT.Enable(bEnable);
+ aLeft1ED.Enable(bEnable);
+ aRight1ED.Enable(bEnable);
+ aLeft2ED.Enable(bEnable);
+ aRight2ED.Enable(bEnable);
+ aLeft3ED.Enable(bEnable);
+ aRight3ED.Enable(bEnable);
+ aLeft4ED.Enable(bEnable);
+ aRight4ED.Enable(bEnable);
+ aScrollSB.Enable(bEnable);
+ aAutoDetectionCB.Enable(bEnable);
+ aAdjustFT.Enable(bEnable);
+ aAdjustLB.Enable(bEnable);
+ aCharStyleFT.Enable(bEnable);
+ aCharStyleLB.Enable(bEnable);
+ aStylistPB.Enable(bEnable);
+ aPreviewFT.Enable(bEnable);
+ aPreviewWin.Enable(bEnable);
+ aApplyPB.Enable(bEnable);
+ }
+
+ void GetCurrentText(String& rBase, String& rRuby);
+
+ void UpdateColors( void );
+protected:
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+public:
+
+ SvxRubyDialog( SfxBindings *pBindings, SfxChildWindow *pCW,
+ Window* pParent, const ResId& rResId );
+ virtual ~SvxRubyDialog();
+
+ virtual void Activate();
+ virtual void Deactivate();
+};
+
+#endif // _SVX_RUBYDLG_HXX_
+
+
diff --git a/svx/inc/svx/ruler.hxx b/svx/inc/svx/ruler.hxx
new file mode 100644
index 000000000000..8031dbbd3112
--- /dev/null
+++ b/svx/inc/svx/ruler.hxx
@@ -0,0 +1,270 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_RULER_HXX
+#define _SVX_RULER_HXX
+
+#include <vcl/menu.hxx>
+#include <svtools/ruler.hxx>
+#include <svl/lstner.hxx>
+#include "svx/svxdllapi.h"
+
+class SvxProtectItem;
+class SvxRulerItem;
+class SfxBindings;
+class SvxLongLRSpaceItem;
+class SvxLongULSpaceItem;
+class SvxTabStopItem;
+class SvxLRSpaceItem;
+class SvxPagePosSizeItem;
+class SvxColumnItem;
+class SfxRectangleItem;
+class SvxObjectItem;
+class SfxBoolItem;
+struct SvxRuler_Impl;
+
+class SVX_DLLPUBLIC SvxRuler: public Ruler, public SfxListener
+{
+ friend class SvxRulerItem;
+ using Window::Notify;
+
+ SvxRulerItem **pCtrlItem;
+ SvxLongLRSpaceItem *pLRSpaceItem; //Linker und Rechter Rand
+ SfxRectangleItem *pMinMaxItem; //Maxima fuers Draggen
+ SvxLongULSpaceItem *pULSpaceItem; //Oberer und Unterer Rand
+ SvxTabStopItem *pTabStopItem; //Tabstops
+ SvxLRSpaceItem *pParaItem; //Absaetze
+ SvxLRSpaceItem *pParaBorderItem; //Border distance
+ SvxPagePosSizeItem *pPagePosItem; //Seitenabstaende zum Lineal
+ SvxColumnItem *pColumnItem; //Spalten
+ SvxObjectItem *pObjectItem; //Objekt
+ Window *pEditWin;
+ SvxRuler_Impl *pRuler_Imp;
+ sal_Bool bAppSetNullOffset :1;
+ sal_Bool bHorz :1;
+ long lLogicNullOffset; // in logischen Koordinaten
+ long lAppNullOffset; // in logischen Koordinaten
+ long lMinFrame; // minimale Framebreite in Pixel
+ long lInitialDragPos;
+ sal_uInt16 nFlags;
+ enum {
+ NONE = 0x0000,
+ DRAG_OBJECT = 0x0001,
+ // letzte Spalte verkleinern, Shift
+ DRAG_OBJECT_SIZE_LINEAR = 0x0002,
+ DRAG_OBJECT_SIZE_PROPORTIONAL = 0x0004, // proportional, Ctrl
+ // nur aktuelle Zeile (Tabelle; Shift-Ctrl)
+ DRAG_OBJECT_ACTLINE_ONLY = 0x0008,
+ // aktuell gleiche Tastenbelegung
+ DRAG_OBJECT_LEFT_INDENT_ONLY = DRAG_OBJECT_SIZE_PROPORTIONAL
+ }
+ nDragType;
+ sal_uInt16 nDefTabType;
+ sal_uInt16 nTabCount;
+ sal_uInt16 nTabBufSize;
+ long lDefTabDist;
+ long lTabPos;
+ RulerTab *pTabs; // Tabpositionen in Pixel
+ RulerIndent *pIndents; // Absatzraender in Pixel
+ RulerBorder *pBorders;
+ sal_uInt16 nBorderCount;
+ RulerBorder *pObjectBorders;
+ SfxBindings *pBindings;
+ long nDragOffset;
+ long nMaxLeft;
+ long nMaxRight;
+ sal_Bool bValid;
+ sal_Bool bListening;
+ sal_Bool bActive;
+//#if 0 // _SOLAR__PRIVATE
+ void StartListening_Impl();
+ long GetCorrectedDragPos( sal_Bool bLeft = sal_True, sal_Bool bRight = sal_True );
+ void DrawLine_Impl(long &lTabPos, int, sal_Bool Hori=sal_True);
+ sal_uInt16 GetObjectBordersOff(sal_uInt16 nIdx) const;
+
+ // Seitenr"ander oder umgebender Rahmen
+ void UpdateFrame(const SvxLongLRSpaceItem *);
+ void UpdateFrame(const SvxLongULSpaceItem *);
+ void UpdateFrameMinMax(const SfxRectangleItem *);
+ // Absatzeinzuege
+ void UpdatePara(const SvxLRSpaceItem *);
+ // Border distance
+ void UpdateParaBorder(const SvxLRSpaceItem *);
+ // Tabs
+ void Update(const SvxTabStopItem *);
+ // Seitenposition und -breite
+ void Update(const SvxPagePosSizeItem *);
+ // Spalten
+ void Update(const SvxColumnItem *, sal_uInt16 nSID);
+ // Object Selektion
+ void Update(const SvxObjectItem *);
+ // Protect
+ void Update( const SvxProtectItem* );
+ // left-to-right text
+ void UpdateTextRTL( const SfxBoolItem* );
+ // Absatzeinzuege
+ void UpdatePara();
+ void UpdateTabs();
+ void UpdatePage();
+ void UpdateFrame();
+ void UpdateColumns();
+ void UpdateObject();
+
+ long PixelHAdjust(long lPos, long lPos2) const;
+ long PixelVAdjust(long lPos, long lPos2) const;
+ long PixelAdjust(long lPos, long lPos2) const;
+
+ long ConvertHPosPixel(long lPos) const;
+ long ConvertVPosPixel(long lPos) const;
+ long ConvertHSizePixel(long lSize) const;
+ long ConvertVSizePixel(long lSize) const;
+
+ long ConvertPosPixel(long lPos) const;
+ long ConvertSizePixel(long lSize) const;
+
+ long ConvertHPosLogic(long lPos) const;
+ long ConvertVPosLogic(long lPos) const;
+ long ConvertHSizeLogic(long lSize) const;
+ long ConvertVSizeLogic(long lSize) const;
+
+ long ConvertPosLogic(long lPos) const;
+ long ConvertSizeLogic(long lSize) const;
+
+ long GetFirstLineIndent() const;
+// long GetLogicFirstLineIndent() const;
+ long GetLeftIndent() const;
+// long GetLogicLeftIndent() const;
+ long GetRightIndent() const;
+ long GetLogicRightIndent() const;
+ long GetPageWidth() const;
+
+ inline long GetLeftFrameMargin() const;
+ long GetRightFrameMargin() const;
+
+ void CalcMinMax();
+
+ void EvalModifier();
+ void DragMargin1();
+ //adjust the left margin either after DragMargin1() or after DragBorders()
+ void AdjustMargin1(long lDiff);
+ void DragMargin2();
+ void DragIndents();
+ void DragTabs();
+ void DragBorders();
+ void DragObjectBorder();
+
+ void ApplyMargins();
+ void ApplyIndents();
+ void ApplyTabs();
+ void ApplyBorders();
+ void ApplyObject();
+
+ long GetFrameLeft() const;
+ void SetFrameLeft(long);
+
+ long GetLeftMin() const;
+ long GetRightMax() const;
+
+ DECL_LINK( TabMenuSelect, Menu * );
+ DECL_LINK( MenuSelect, Menu * );
+ void PrepareProportional_Impl(RulerType);
+
+ sal_uInt16 GetNextVisible(sal_uInt16 nColumn);
+ sal_uInt16 GetPrevVisible(sal_uInt16 nColumn);
+//#endif
+
+ void Update();
+
+enum UpdateType {
+ MOVE_ALL,
+ MOVE_LEFT,
+ MOVE_RIGHT
+ };
+ void UpdateParaContents_Impl(long lDiff, UpdateType = MOVE_ALL);
+protected:
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void Click();
+ virtual long StartDrag();
+ virtual void Drag();
+ virtual void EndDrag();
+ virtual void ExtraDown();
+ virtual void MouseMove( const MouseEvent& rMEvt );
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ // Berechnung der Grenzwerte fuer Objectgrenzen
+ // Werte sind bezogen auf die Seite
+ virtual sal_Bool CalcLimits(long &nMax1, long &nMax2, sal_Bool bFirst) const;
+ sal_Bool IsActLastColumn(
+ sal_Bool bForceDontConsiderHidden = sal_False, sal_uInt16 nAct=USHRT_MAX) const ;
+ sal_Bool IsActFirstColumn(
+ sal_Bool bForceDontConsiderHidden = sal_False, sal_uInt16 nAct=USHRT_MAX) const;
+ sal_uInt16 GetActLeftColumn(
+ sal_Bool bForceDontConsiderHidden = sal_False, sal_uInt16 nAct=USHRT_MAX ) const;
+ sal_uInt16 GetActRightColumn (
+ sal_Bool bForceDontConsiderHidden = sal_False, sal_uInt16 nAct=USHRT_MAX ) const;
+ long CalcPropMaxRight(sal_uInt16 nCol=USHRT_MAX) const;
+
+public:
+#define SVXRULER_SUPPORT_TABS 0x0001
+#define SVXRULER_SUPPORT_PARAGRAPH_MARGINS 0x0002
+#define SVXRULER_SUPPORT_BORDERS 0x0004
+#define SVXRULER_SUPPORT_OBJECT 0x0008
+#define SVXRULER_SUPPORT_SET_NULLOFFSET 0x0010
+#define SVXRULER_SUPPORT_NEGATIVE_MARGINS 0x0020
+#define SVXRULER_SUPPORT_PARAGRAPH_MARGINS_VERTICAL 0x0040
+#define SVXRULER_SUPPORT_REDUCED_METRIC 0x0080 //shorten the context menu to select metric
+
+ SvxRuler(Window* pParent,
+ Window *pEditWin,
+ sal_uInt16 nRulerFlags,
+ SfxBindings &rBindings,
+ WinBits nWinStyle = WB_STDRULER);
+ ~SvxRuler();
+
+ void SetMinFrameSize(long lSize);
+ long GetMinFrameSize() const ;
+
+ sal_uInt16 GetRulerFlags() const { return nFlags; }
+
+ void SetDefTabDist(long);
+ long GetDefTabDist() const;
+
+ // Setzen / Erfragen NullOffset in logischen Einheiten
+ void SetNullOffsetLogic(long lOff = 0);
+ long GetNullOffsetLogic() const { return lAppNullOffset; }
+
+ void SetActive(sal_Bool bOn = sal_True);
+ sal_Bool IsActive() const { return bActive; }
+
+ void ForceUpdate() { Update(); }
+
+ //#i24363# tab stops relative to indent
+ void SetTabsRelativeToIndent( sal_Bool bRel = sal_True );
+};
+
+#endif
+
diff --git a/svx/inc/svx/rulritem.hxx b/svx/inc/svx/rulritem.hxx
new file mode 100644
index 000000000000..753422f609c2
--- /dev/null
+++ b/svx/inc/svx/rulritem.hxx
@@ -0,0 +1,303 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_RULRITEM_HXX
+#define _SVX_RULRITEM_HXX
+
+// include ---------------------------------------------------------------
+
+
+#include <tools/gen.hxx>
+#include <svl/poolitem.hxx>
+#include "svx/svxdllapi.h"
+
+// class SvxLongLRSpaceItem ----------------------------------------------
+
+class SVX_DLLPUBLIC SvxLongLRSpaceItem : public SfxPoolItem
+{
+ long lLeft; // nLeft oder der neg. Erstzeileneinzug
+ long lRight; // der unproblematische rechte Rand
+
+ protected:
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual String GetValueText() const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+private:
+ SVX_DLLPRIVATE const SvxLongLRSpaceItem& operator=(const SvxLongLRSpaceItem &); // n.i.
+
+public:
+ TYPEINFO();
+ SvxLongLRSpaceItem(long lLeft, long lRight, sal_uInt16 nId);
+ SvxLongLRSpaceItem(const SvxLongLRSpaceItem &);
+ SvxLongLRSpaceItem();
+
+ long GetLeft() const { return lLeft; }
+ long GetRight() const { return lRight; }
+ void SetLeft(long lArgLeft) {lLeft=lArgLeft;}
+ void SetRight(long lArgRight) {lRight=lArgRight;}
+};
+
+// class SvxLongULSpaceItem ----------------------------------------------
+
+class SVX_DLLPUBLIC SvxLongULSpaceItem : public SfxPoolItem
+{
+ long lLeft; // nLeft oder der neg. Erstzeileneinzug
+ long lRight; // der unproblematische rechte Rand
+
+ protected:
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual String GetValueText() const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+private:
+ SVX_DLLPRIVATE const SvxLongULSpaceItem& operator=(const SvxLongULSpaceItem &); // n.i.
+
+public:
+ TYPEINFO();
+ SvxLongULSpaceItem(long lUpper, long lLower, sal_uInt16 nId);
+ SvxLongULSpaceItem(const SvxLongULSpaceItem &);
+ SvxLongULSpaceItem();
+
+ long GetUpper() const { return lLeft; }
+ long GetLower() const { return lRight; }
+ void SetUpper(long lArgLeft) {lLeft=lArgLeft;}
+ void SetLower(long lArgRight) {lRight=lArgRight;}
+};
+
+// class SvxPagePosSizeItem ----------------------------------------------
+
+class SVX_DLLPUBLIC SvxPagePosSizeItem : public SfxPoolItem
+{
+ Point aPos;
+ long lWidth;
+ long lHeight;
+protected:
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual String GetValueText() const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+private:
+ SVX_DLLPRIVATE const SvxPagePosSizeItem& operator=(const SvxPagePosSizeItem &); // n.i.
+public:
+ TYPEINFO();
+ SvxPagePosSizeItem(const Point &rPos, long lWidth, long lHeight);
+ SvxPagePosSizeItem(const SvxPagePosSizeItem &);
+ SvxPagePosSizeItem();
+
+ const Point &GetPos() const { return aPos; }
+ long GetWidth() const { return lWidth; }
+ long GetHeight() const { return lHeight; }
+};
+
+// struct SvxColumnDescription -------------------------------------------
+
+struct SvxColumnDescription
+{
+ long nStart; /* Spaltenbeginn */
+ long nEnd; /* Spaltenende */
+ sal_Bool bVisible; /* Sichtbarkeit */
+
+ long nEndMin; //min. possible position of end
+ long nEndMax; //max. possible position of end
+
+ SvxColumnDescription():
+ nStart(0), nEnd(0), bVisible(sal_True), nEndMin(0), nEndMax(0) {}
+
+ SvxColumnDescription(const SvxColumnDescription &rCopy) :
+ nStart(rCopy.nStart), nEnd(rCopy.nEnd),
+ bVisible(rCopy.bVisible),
+ nEndMin(rCopy.nEndMin), nEndMax(rCopy.nEndMax)
+ {}
+
+ SvxColumnDescription(long start, long end, sal_Bool bVis = sal_True):
+ nStart(start), nEnd(end),
+ bVisible(bVis),
+ nEndMin(0), nEndMax(0) {}
+
+ SvxColumnDescription(long start, long end,
+ long endMin, long endMax, sal_Bool bVis = sal_True):
+ nStart(start), nEnd(end),
+ bVisible(bVis),
+ nEndMin(endMin), nEndMax(endMax)
+ {}
+
+ int operator==(const SvxColumnDescription &rCmp) const {
+ return nStart == rCmp.nStart &&
+ bVisible == rCmp.bVisible &&
+ nEnd == rCmp.nEnd &&
+ nEndMin == rCmp.nEndMin &&
+ nEndMax == rCmp.nEndMax;
+ }
+ int operator!=(const SvxColumnDescription &rCmp) const {
+ return !operator==(rCmp);
+ }
+ long GetWidth() const { return nEnd - nStart; }
+};
+
+// class SvxColumnItem ---------------------------------------------------
+
+typedef SvPtrarr SvxColumns;
+
+class SVX_DLLPUBLIC SvxColumnItem : public SfxPoolItem
+{
+ SvxColumns aColumns;// Spaltenarray
+ long nLeft, // Linker Rand bei Tabelle
+ nRight; // Rechter Rand bei Tabelle; bei Spalten immer gleich
+ // zum umgebenden Rahmen
+ sal_uInt16 nActColumn; // die aktuelle Spalte
+ sal_Bool bTable; // Tabelle?
+ sal_Bool bOrtho; // Gleichverteilte Spalten
+
+ void DeleteAndDestroyColumns();
+
+protected:
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ virtual String GetValueText() const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+public:
+ TYPEINFO();
+ // rechter Rand des umgebenden Rahmens
+ // nLeft, nRight jeweils der Abstand zum umgebenden Rahmen
+ SvxColumnItem(sal_uInt16 nAct = 0); // Spalten
+ SvxColumnItem(sal_uInt16 nActCol,
+ sal_uInt16 nLeft, sal_uInt16 nRight = 0); // Tabelle mit Raendern
+ SvxColumnItem(const SvxColumnItem &);
+ ~SvxColumnItem();
+
+ const SvxColumnItem &operator=(const SvxColumnItem &);
+
+ sal_uInt16 Count() const { return aColumns.Count(); }
+ SvxColumnDescription &operator[](sal_uInt16 i)
+ { return *(SvxColumnDescription*)aColumns[i]; }
+ const SvxColumnDescription &operator[](sal_uInt16 i) const
+ { return *(SvxColumnDescription*)aColumns[i]; }
+ void Insert(const SvxColumnDescription &rDesc, sal_uInt16 nPos) {
+ SvxColumnDescription* pDesc = new SvxColumnDescription(rDesc);
+ aColumns.Insert(pDesc, nPos);
+ }
+ void Append(const SvxColumnDescription &rDesc) { Insert(rDesc, Count()); }
+ void SetLeft(long left) { nLeft = left; }
+ void SetRight(long right) { nRight = right; }
+ void SetActColumn(sal_uInt16 nCol) { nActColumn = nCol; }
+
+ sal_uInt16 GetActColumn() const { return nActColumn; }
+ sal_Bool IsFirstAct() const { return nActColumn == 0; }
+ sal_Bool IsLastAct() const { return nActColumn == Count()-1; }
+ long GetLeft() { return nLeft; }
+ long GetRight() { return nRight; }
+
+ sal_Bool IsTable() const { return bTable; }
+
+ sal_Bool CalcOrtho() const;
+ void SetOrtho(sal_Bool bVal) { bOrtho = bVal; }
+ sal_Bool IsOrtho () const { return sal_False ; }
+
+ sal_Bool IsConsistent() const { return nActColumn < aColumns.Count(); }
+ long GetVisibleRight() const;// rechter sichtbare Rand der aktuellen Spalte
+};
+
+// class SvxObjectItem ---------------------------------------------------
+
+class SVX_DLLPUBLIC SvxObjectItem : public SfxPoolItem
+{
+private:
+ long nStartX; /* Beginn in X-Richtung */
+ long nEndX; /* Ende in X-Richtung */
+ long nStartY; /* Beginn in Y-Richtung */
+ long nEndY; /* Ende in Y-Richtung */
+ sal_Bool bLimits; /* Grenzwertkontrolle durch die Applikation */
+protected:
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ virtual String GetValueText() const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+private:
+ SVX_DLLPRIVATE const SvxObjectItem &operator=(const SvxObjectItem &); // n.i.
+public:
+ TYPEINFO();
+ SvxObjectItem(long nStartX, long nEndX,
+ long nStartY, long nEndY,
+ sal_Bool bLimits = sal_False);
+ SvxObjectItem(const SvxObjectItem &);
+
+ sal_Bool HasLimits() const { return bLimits; }
+
+ long GetStartX() const { return nStartX; }
+ long GetEndX() const { return nEndX; }
+ long GetStartY() const { return nStartY; }
+ long GetEndY() const { return nEndY; }
+
+ void SetStartX(long l) { nStartX = l; }
+ void SetEndX(long l) { nEndX = l; }
+ void SetStartY(long l) { nStartY = l; }
+ void SetEndY(long l) { nEndY = l; }
+};
+
+
+#endif
+
diff --git a/svx/inc/svx/scene3d.hxx b/svx/inc/svx/scene3d.hxx
new file mode 100644
index 000000000000..a55eac577419
--- /dev/null
+++ b/svx/inc/svx/scene3d.hxx
@@ -0,0 +1,252 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _E3D_SCENE3D_HXX
+#define _E3D_SCENE3D_HXX
+
+#include <svx/camera3d.hxx>
+#include <tools/b3dtrans.hxx>
+#include <tools/time.hxx>
+#include <svx/svxdllapi.h>
+#include <svx/obj3d.hxx>
+
+namespace sdr { namespace properties {
+ class BaseProperties;
+ class E3dSceneProperties;
+}}
+
+namespace drawinglayer { namespace geometry {
+ class ViewInformation3D;
+}}
+
+/*************************************************************************
+|*
+|* GeoData relevant fuer Undo-Actions
+|*
+\************************************************************************/
+
+class E3DSceneGeoData : public E3DObjGeoData
+{
+public:
+ Camera3D aCamera;
+
+ E3DSceneGeoData() {}
+};
+
+// #110988#
+class Imp3DDepthRemapper;
+
+/*************************************************************************
+|*
+|* Basisklasse fuer 3D-Szenen
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC E3dScene : public E3dObject
+{
+private:
+ // to allow sdr::properties::E3dSceneProperties access to StructureChanged()
+ friend class sdr::properties::E3dSceneProperties;
+
+protected:
+ virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+
+ // Transformationen
+ B3dCamera aCameraSet;
+ Camera3D aCamera;
+
+ // #110988#
+ Imp3DDepthRemapper* mp3DDepthRemapper;
+
+ // Flag to determine if only selected objects should be drawn
+ unsigned bDrawOnlySelected : 1;
+
+ virtual void NewObjectInserted(const E3dObject* p3DObj);
+ virtual void StructureChanged();
+
+ void RebuildLists();
+
+ virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint);
+
+protected:
+ void SetDefaultAttributes(E3dDefaultAttributes& rDefault);
+
+ // #110988#
+ void ImpCleanup3DDepthMapper();
+
+public:
+ TYPEINFO();
+ E3dScene();
+ E3dScene(E3dDefaultAttributes& rDefault);
+ virtual ~E3dScene();
+
+ virtual void SetBoundRectDirty();
+
+ // access to cleanup of depth mapper
+ void Cleanup3DDepthMapper() { ImpCleanup3DDepthMapper(); }
+
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
+
+ // #110988#
+ sal_uInt32 RemapOrdNum(sal_uInt32 nOrdNum) const;
+
+ // Perspective: enum ProjectionType { PR_PARALLEL, PR_PERSPECTIVE }
+ ProjectionType GetPerspective() const
+ { return (ProjectionType)((const Svx3DPerspectiveItem&)GetObjectItemSet().Get(SDRATTR_3DSCENE_PERSPECTIVE)).GetValue(); }
+
+ // Distance:
+ double GetDistance() const
+ { return (double)((const Svx3DDistanceItem&)GetObjectItemSet().Get(SDRATTR_3DSCENE_DISTANCE)).GetValue(); }
+
+ // Focal length: before cm, now 1/10th mm (*100)
+ double GetFocalLength() const
+ { return ((const Svx3DFocalLengthItem&)GetObjectItemSet().Get(SDRATTR_3DSCENE_FOCAL_LENGTH)).GetValue(); }
+
+ // Two sided lighting:
+ sal_Bool GetTwoSidedLighting() const
+ { return ((const Svx3DTwoSidedLightingItem&)GetObjectItemSet().Get(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING)).GetValue(); }
+
+ // Lightcolor:
+ Color GetLightColor1() const
+ { return ((const Svx3DLightcolor1Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTCOLOR_1)).GetValue(); }
+ Color GetLightColor2() const
+ { return ((const Svx3DLightcolor2Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTCOLOR_2)).GetValue(); }
+ Color GetLightColor3() const
+ { return ((const Svx3DLightcolor3Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTCOLOR_3)).GetValue(); }
+ Color GetLightColor4() const
+ { return ((const Svx3DLightcolor4Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTCOLOR_4)).GetValue(); }
+ Color GetLightColor5() const
+ { return ((const Svx3DLightcolor5Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTCOLOR_5)).GetValue(); }
+ Color GetLightColor6() const
+ { return ((const Svx3DLightcolor6Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTCOLOR_6)).GetValue(); }
+ Color GetLightColor7() const
+ { return ((const Svx3DLightcolor7Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTCOLOR_7)).GetValue(); }
+ Color GetLightColor8() const
+ { return ((const Svx3DLightcolor8Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTCOLOR_8)).GetValue(); }
+
+ // Ambient color:
+ Color GetGlobalAmbientColor() const
+ { return ((const Svx3DAmbientcolorItem&)GetObjectItemSet().Get(SDRATTR_3DSCENE_AMBIENTCOLOR)).GetValue(); }
+
+ // Light on/off:
+ sal_Bool GetLightOnOff1() const
+ { return ((const Svx3DLightOnOff1Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTON_1)).GetValue(); }
+ sal_Bool GetLightOnOff2() const
+ { return ((const Svx3DLightOnOff2Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTON_2)).GetValue(); }
+ sal_Bool GetLightOnOff3() const
+ { return ((const Svx3DLightOnOff3Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTON_3)).GetValue(); }
+ sal_Bool GetLightOnOff4() const
+ { return ((const Svx3DLightOnOff4Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTON_4)).GetValue(); }
+ sal_Bool GetLightOnOff5() const
+ { return ((const Svx3DLightOnOff5Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTON_5)).GetValue(); }
+ sal_Bool GetLightOnOff6() const
+ { return ((const Svx3DLightOnOff6Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTON_6)).GetValue(); }
+ sal_Bool GetLightOnOff7() const
+ { return ((const Svx3DLightOnOff7Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTON_7)).GetValue(); }
+ sal_Bool GetLightOnOff8() const
+ { return ((const Svx3DLightOnOff8Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTON_8)).GetValue(); }
+
+ // Light direction:
+ basegfx::B3DVector GetLightDirection1() const
+ { return ((const Svx3DLightDirection1Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1)).GetValue(); }
+ basegfx::B3DVector GetLightDirection2() const
+ { return ((const Svx3DLightDirection2Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2)).GetValue(); }
+ basegfx::B3DVector GetLightDirection3() const
+ { return ((const Svx3DLightDirection3Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3)).GetValue(); }
+ basegfx::B3DVector GetLightDirection4() const
+ { return ((const Svx3DLightDirection4Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4)).GetValue(); }
+ basegfx::B3DVector GetLightDirection5() const
+ { return ((const Svx3DLightDirection5Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5)).GetValue(); }
+ basegfx::B3DVector GetLightDirection6() const
+ { return ((const Svx3DLightDirection6Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6)).GetValue(); }
+ basegfx::B3DVector GetLightDirection7() const
+ { return ((const Svx3DLightDirection7Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7)).GetValue(); }
+ basegfx::B3DVector GetLightDirection8() const
+ { return ((const Svx3DLightDirection8Item&)GetObjectItemSet().Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8)).GetValue(); }
+
+ // ShadowSlant:
+ sal_uInt16 GetShadowSlant() const
+ { return ((const Svx3DShadowSlantItem&)GetObjectItemSet().Get(SDRATTR_3DSCENE_SHADOW_SLANT)).GetValue(); }
+
+ // ShadeMode: 0 == FLAT, 1 == PHONG, 2 == SMOOTH, 3 == ForceDraft
+ sal_uInt16 GetShadeMode() const
+ { return ((const Svx3DShadeModeItem&)GetObjectItemSet().Get(SDRATTR_3DSCENE_SHADE_MODE)).GetValue(); }
+
+ // set flag to draw only selected
+ void SetDrawOnlySelected(sal_Bool bNew) { bDrawOnlySelected = bNew; }
+ bool GetDrawOnlySelected() const { return bDrawOnlySelected; }
+ virtual sal_uInt16 GetObjIdentifier() const;
+
+ virtual void NbcSetSnapRect(const Rectangle& rRect);
+ virtual void NbcMove(const Size& rSize);
+ virtual void NbcResize(const Point& rRef, const Fraction& rXFact,
+ const Fraction& rYFact);
+ virtual void RecalcSnapRect();
+
+ virtual E3dScene* GetScene() const;
+ void SetCamera(const Camera3D& rNewCamera);
+ const Camera3D& GetCamera() const { return aCamera; }
+ void removeAllNonSelectedObjects();
+
+ virtual void operator=(const SdrObject&);
+
+ virtual SdrObjGeoData *NewGeoData() const;
+ virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
+ virtual void RestGeoData(const SdrObjGeoData& rGeo);
+
+ virtual void NbcSetTransform(const basegfx::B3DHomMatrix& rMatrix);
+ virtual void SetTransform(const basegfx::B3DHomMatrix& rMatrix);
+
+ virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs);
+ void RotateScene(const Point& rRef, long nWink, double sn, double cs);
+
+ // TakeObjName...() ist fuer die Anzeige in der UI, z.B. "3 Rahmen selektiert".
+ virtual void TakeObjNameSingul(String& rName) const;
+ virtual void TakeObjNamePlural(String& rName) const;
+
+ // Transformationen rausgeben
+ B3dCamera& GetCameraSet() { return aCameraSet; }
+
+ // Aufbrechen
+ virtual sal_Bool IsBreakObjPossible();
+
+ basegfx::B3DVector GetShadowPlaneDirection() const;
+ void SetShadowPlaneDirection(const basegfx::B3DVector& rVec);
+
+ // Polygon das waehrend des Erzeugens aufgezogen wird
+ virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const;
+
+ // create moves
+ virtual FASTBOOL BegCreate(SdrDragStat& rStat);
+ virtual FASTBOOL MovCreate(SdrDragStat& rStat); // sal_True=Xor muss repainted werden
+ virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
+ virtual FASTBOOL BckCreate(SdrDragStat& rStat);
+ virtual void BrkCreate(SdrDragStat& rStat);
+};
+
+#endif // _E3D_SCENE3D_HXX
diff --git a/svx/inc/svx/sdangitm.hxx b/svx/inc/svx/sdangitm.hxx
new file mode 100644
index 000000000000..381221354397
--- /dev/null
+++ b/svx/inc/svx/sdangitm.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SDANGITM_HXX
+#define _SDANGITM_HXX
+
+#include <svl/intitem.hxx>
+#include "svx/svxdllapi.h"
+
+
+//------------------------------------------------------------
+// class SdrAngleItem
+//------------------------------------------------------------
+class SVX_DLLPUBLIC SdrAngleItem: public SfxInt32Item {
+public:
+ TYPEINFO();
+ SdrAngleItem(): SfxInt32Item() {}
+ SdrAngleItem(sal_uInt16 nId, sal_Int32 nAngle=0): SfxInt32Item(nId,nAngle) {}
+ SdrAngleItem(sal_uInt16 nId, SvStream& rIn): SfxInt32Item(nId,rIn) {}
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool=NULL) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String& rText,
+ const IntlWrapper *
+ pIntlWrapper = 0) const;
+
+#ifdef SDR_ISPOOLABLE
+ virtual int IsPoolable() const;
+#endif
+};
+
+
+#endif
diff --git a/svx/inc/svx/sdasaitm.hxx b/svx/inc/svx/sdasaitm.hxx
new file mode 100644
index 000000000000..889207e22d5e
--- /dev/null
+++ b/svx/inc/svx/sdasaitm.hxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDASAITM_HXX
+#define _SDASAITM_HXX
+
+#include <svl/poolitem.hxx>
+#include <tools/list.hxx>
+
+class SdrCustomShapeAdjustmentValue
+{
+ sal_uInt32 nValue;
+
+ friend class SdrCustomShapeAdjustmentItem;
+
+ public :
+
+ void SetValue( sal_Int32 nVal ) { nValue = nVal; };
+ sal_Int32 GetValue() const { return nValue; };
+
+};
+
+class SdrCustomShapeAdjustmentItem : public SfxPoolItem
+{
+ List aAdjustmentValueList;
+
+ public :
+
+ TYPEINFO();
+ SVX_DLLPUBLIC SdrCustomShapeAdjustmentItem();
+ SdrCustomShapeAdjustmentItem( SvStream& rIn, sal_uInt16 nVersion );
+ SVX_DLLPUBLIC ~SdrCustomShapeAdjustmentItem();
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePresentation,
+ SfxMapUnit eCoreMetric, SfxMapUnit ePresentationMetric,
+ String &rText, const IntlWrapper * = 0) const;
+ virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nItem ) const;
+ virtual SvStream& Store( SvStream&, sal_uInt16 nVersion ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+
+#ifdef SDR_ISPOOLABLE
+ virtual int IsPoolable() const;
+#endif
+
+ sal_uInt32 GetCount() const { return aAdjustmentValueList.Count(); };
+ SVX_DLLPUBLIC const SdrCustomShapeAdjustmentValue& GetValue( sal_uInt32 nIndex ) const;
+ SVX_DLLPUBLIC void SetValue( sal_uInt32 nIndex,
+ const SdrCustomShapeAdjustmentValue& rVal );
+};
+
+#endif
+
diff --git a/svx/inc/svx/sdasitm.hxx b/svx/inc/svx/sdasitm.hxx
new file mode 100644
index 000000000000..41218bd401f7
--- /dev/null
+++ b/svx/inc/svx/sdasitm.hxx
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDASITM_HXX
+#define _SDASITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdooitm.hxx>
+#include <svl/stritem.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <rtl/ustring.hxx>
+#include <hash_map>
+#include <map>
+#include "svx/svxdllapi.h"
+
+class SdrCustomShapeEngineItem : public SfxStringItem
+{
+ public :
+ SdrCustomShapeEngineItem();
+ SdrCustomShapeEngineItem( const String& rCustomShapeEngine );
+};
+
+class SdrCustomShapeDataItem : public SfxStringItem
+{
+ public :
+ SdrCustomShapeDataItem();
+ SdrCustomShapeDataItem( const String& rCustomShapeData );
+};
+
+class SVX_DLLPUBLIC SdrCustomShapeGeometryItem : public SfxPoolItem
+{
+public:
+ typedef std::pair < const ::rtl::OUString, const ::rtl::OUString > PropertyPair;
+
+private:
+ struct SVX_DLLPRIVATE PropertyEq
+ {
+ bool operator()( const rtl::OUString&, const rtl::OUString& ) const;
+ };
+ struct SVX_DLLPRIVATE PropertyPairEq
+ {
+ bool operator()( const SdrCustomShapeGeometryItem::PropertyPair&, const SdrCustomShapeGeometryItem::PropertyPair& ) const;
+ };
+ struct SVX_DLLPRIVATE PropertyPairHash
+ {
+ size_t operator()( const SdrCustomShapeGeometryItem::PropertyPair &r1 ) const;
+ };
+ typedef std::hash_map < PropertyPair, sal_Int32, PropertyPairHash, PropertyPairEq > PropertyPairHashMap;
+ typedef std::hash_map< rtl::OUString, sal_Int32, rtl::OUStringHash, PropertyEq > PropertyHashMap;
+
+ PropertyHashMap aPropHashMap;
+ PropertyPairHashMap aPropPairHashMap;
+
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > aPropSeq;
+
+ public :
+
+ TYPEINFO();
+
+ SdrCustomShapeGeometryItem();
+ SdrCustomShapeGeometryItem( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& );
+ SdrCustomShapeGeometryItem( SvStream& rIn, sal_uInt16 nVersion );
+ ~SdrCustomShapeGeometryItem();
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePresentation,
+ SfxMapUnit eCoreMetric, SfxMapUnit ePresentationMetric,
+ String &rText, const IntlWrapper * = 0) const;
+
+ virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nItem ) const;
+ virtual SvStream& Store( SvStream&, sal_uInt16 nVersion ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& GetGeometry() const;
+
+#ifdef SDR_ISPOOLABLE
+ virtual int IsPoolable() const;
+#endif
+ com::sun::star::uno::Any* GetPropertyValueByName( const rtl::OUString& rPropName );
+ com::sun::star::uno::Any* GetPropertyValueByName( const rtl::OUString& rPropName, const rtl::OUString& rPropName2 );
+
+ void SetPropertyValue( const com::sun::star::beans::PropertyValue& rPropVal );
+ void SetPropertyValue( const rtl::OUString& rSequenceName, const com::sun::star::beans::PropertyValue& rPropVal );
+
+ void ClearPropertyValue( const rtl::OUString& rPropertyName );
+ void ClearPropertyValue( const rtl::OUString& rSequenceName, const rtl::OUString& rPropertyName );
+};
+
+class SdrCustomShapeReplacementURLItem : public SfxStringItem
+{
+ public :
+ SdrCustomShapeReplacementURLItem();
+ SdrCustomShapeReplacementURLItem( const String& rCustomShapeReplacementURL );
+};
+
+//---------------------------
+// class SdrTextWordWrapItem
+//---------------------------
+class SdrTextWordWrapItem : public SdrOnOffItem {
+public:
+ SdrTextWordWrapItem( sal_Bool bAuto = sal_False ): SdrOnOffItem( SDRATTR_TEXT_WORDWRAP, bAuto ) {}
+ SdrTextWordWrapItem( SvStream& rIn ) : SdrOnOffItem( SDRATTR_TEXT_WORDWRAP, rIn ) {}
+};
+
+//-------------------------------
+// class SdrTextAutoGrowSizeItem
+//-------------------------------
+class SdrTextAutoGrowSizeItem : public SdrOnOffItem {
+public:
+ SdrTextAutoGrowSizeItem( sal_Bool bAuto = sal_False ): SdrOnOffItem( SDRATTR_TEXT_AUTOGROWSIZE, bAuto ) {}
+ SdrTextAutoGrowSizeItem( SvStream& rIn ) : SdrOnOffItem( SDRATTR_TEXT_AUTOGROWSIZE, rIn ) {}
+};
+
+#endif
+
diff --git a/svx/inc/svx/sderitm.hxx b/svx/inc/svx/sderitm.hxx
new file mode 100644
index 000000000000..37c63a2cbc35
--- /dev/null
+++ b/svx/inc/svx/sderitm.hxx
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SDERITM_HXX
+#define _SDERITM_HXX
+
+#include <svx/sdmetitm.hxx>
+#include <svx/svddef.hxx>
+
+//------------------------------
+// class SdrEckenradiusItem
+//------------------------------
+class SdrEckenradiusItem: public SdrMetricItem {
+public:
+ SdrEckenradiusItem(long nRadius=0): SdrMetricItem(SDRATTR_ECKENRADIUS,nRadius) {}
+ SdrEckenradiusItem(SvStream& rIn) : SdrMetricItem(SDRATTR_ECKENRADIUS,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sdgcoitm.hxx b/svx/inc/svx/sdgcoitm.hxx
new file mode 100644
index 000000000000..83a0f7806db1
--- /dev/null
+++ b/svx/inc/svx/sdgcoitm.hxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDGCOITM_HXX
+#define _SDGCOITM_HXX
+
+#include <svx/sdprcitm.hxx>
+#include <svx/svddef.hxx>
+#include "svx/svxdllapi.h"
+
+//-----------------
+// SdrGrafRedItem -
+//-----------------
+
+class SVX_DLLPUBLIC SdrGrafRedItem : public SdrSignedPercentItem
+{
+public:
+
+ TYPEINFO();
+
+ SdrGrafRedItem( short nRedPercent = 0 ) : SdrSignedPercentItem( SDRATTR_GRAFRED, nRedPercent ) {}
+ SdrGrafRedItem( SvStream& rIn ) : SdrSignedPercentItem( SDRATTR_GRAFRED, rIn ) {}
+
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const;
+ virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+};
+
+//-------------------
+// SdrGrafGreenItem -
+//-------------------
+
+class SVX_DLLPUBLIC SdrGrafGreenItem : public SdrSignedPercentItem
+{
+public:
+
+ TYPEINFO();
+
+ SdrGrafGreenItem( short nGreenPercent = 0 ) : SdrSignedPercentItem( SDRATTR_GRAFGREEN, nGreenPercent ) {}
+ SdrGrafGreenItem( SvStream& rIn ) : SdrSignedPercentItem( SDRATTR_GRAFGREEN, rIn ) {}
+
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const;
+ virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+};
+
+//-------------------
+// SdrGrafBlueItem -
+//-------------------
+
+class SVX_DLLPUBLIC SdrGrafBlueItem : public SdrSignedPercentItem
+{
+public:
+
+ TYPEINFO();
+
+ SdrGrafBlueItem( short nBluePercent = 0 ) : SdrSignedPercentItem( SDRATTR_GRAFBLUE, nBluePercent ) {}
+ SdrGrafBlueItem( SvStream& rIn ) : SdrSignedPercentItem( SDRATTR_GRAFBLUE, rIn ) {}
+
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const;
+ virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+};
+
+#endif // _SDGCOITM_HXX
diff --git a/svx/inc/svx/sdgcpitm.hxx b/svx/inc/svx/sdgcpitm.hxx
new file mode 100644
index 000000000000..0a14d64a9c53
--- /dev/null
+++ b/svx/inc/svx/sdgcpitm.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDGCPITM_HXX
+#define _SDGCPITM_HXX
+
+#include <svx/grfcrop.hxx>
+#include <svx/svddef.hxx>
+
+//------------------
+// SdrGrafCropItem -
+//------------------
+
+class SVX_DLLPUBLIC SdrGrafCropItem : public SvxGrfCrop
+{
+public:
+
+ TYPEINFO();
+
+ SdrGrafCropItem( sal_Int32 nLeftCrop = 0, sal_Int32 nTopCrop = 0,
+ sal_Int32 nRightCrop = 0, sal_Int32 nBottomCrop = 0,
+ sal_uInt16 nWhichId = SDRATTR_GRAFCROP ) :
+ SvxGrfCrop( nLeftCrop, nRightCrop, nTopCrop, nBottomCrop, nWhichId ) {}
+
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const;
+ virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+};
+
+#endif // _SDGCPITM_HXX
diff --git a/svx/inc/svx/sdggaitm.hxx b/svx/inc/svx/sdggaitm.hxx
new file mode 100644
index 000000000000..8a3a17bdad4e
--- /dev/null
+++ b/svx/inc/svx/sdggaitm.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDGGAITM_HXX
+#define _SDGGAITM_HXX
+
+#include <svl/intitem.hxx>
+#include <svx/svddef.hxx>
+#include "svx/svxdllapi.h"
+
+//----------------------
+// SdrGrafGamma100Item -
+//----------------------
+
+class SVX_DLLPUBLIC SdrGrafGamma100Item : public SfxUInt32Item
+{
+public:
+
+ TYPEINFO();
+
+ SdrGrafGamma100Item( sal_uIntPtr nGamma100 = 100 ) : SfxUInt32Item( SDRATTR_GRAFGAMMA, nGamma100 ) {}
+ SdrGrafGamma100Item( SvStream& rIn ) : SfxUInt32Item( SDRATTR_GRAFGAMMA, rIn ) {}
+
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const;
+ virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+#endif // _SDGGAITM_HXX
diff --git a/svx/inc/svx/sdginitm.hxx b/svx/inc/svx/sdginitm.hxx
new file mode 100644
index 000000000000..41d37fbe5642
--- /dev/null
+++ b/svx/inc/svx/sdginitm.hxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDGINITM_HXX
+#define _SDGINITM_HXX
+
+#include <svx/sdooitm.hxx>
+#include <svx/svddef.hxx>
+#include "svx/svxdllapi.h"
+
+//--------------------
+// SdrGrafInvertItem -
+//--------------------
+
+class SVX_DLLPUBLIC SdrGrafInvertItem : public SdrOnOffItem
+{
+public:
+
+ TYPEINFO();
+
+ SdrGrafInvertItem( sal_Bool bInvert = sal_False ) : SdrOnOffItem( SDRATTR_GRAFINVERT, bInvert ) {}
+ SdrGrafInvertItem( SvStream& rIn ) : SdrOnOffItem( SDRATTR_GRAFINVERT, rIn ) {}
+
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const;
+ virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+};
+
+#endif // _SDGINITM_HXX
diff --git a/svx/inc/svx/sdgluitm.hxx b/svx/inc/svx/sdgluitm.hxx
new file mode 100644
index 000000000000..afa5eea3fd19
--- /dev/null
+++ b/svx/inc/svx/sdgluitm.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDGLUITM_HXX
+#define _SDGLUITM_HXX
+
+#include <svx/sdprcitm.hxx>
+#include <svx/svddef.hxx>
+#include "svx/svxdllapi.h"
+
+//-----------------------
+// SdrGrafLuminanceItem -
+//-----------------------
+
+class SVX_DLLPUBLIC SdrGrafLuminanceItem : public SdrSignedPercentItem
+{
+public:
+
+ TYPEINFO();
+
+ SdrGrafLuminanceItem( short nLuminancePercent = 0 ) : SdrSignedPercentItem( SDRATTR_GRAFLUMINANCE, nLuminancePercent ) {}
+ SdrGrafLuminanceItem( SvStream& rIn ) : SdrSignedPercentItem( SDRATTR_GRAFLUMINANCE, rIn ) {}
+
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const;
+ virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+};
+
+//----------------------
+// SdrGrafContrastItem -
+//----------------------
+
+class SVX_DLLPUBLIC SdrGrafContrastItem : public SdrSignedPercentItem
+{
+public:
+
+ TYPEINFO();
+
+ SdrGrafContrastItem( short nContrastPercent = 0 ) : SdrSignedPercentItem( SDRATTR_GRAFCONTRAST, nContrastPercent ) {}
+ SdrGrafContrastItem( SvStream& rIn ) : SdrSignedPercentItem( SDRATTR_GRAFCONTRAST, rIn ) {}
+
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const;
+ virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+};
+
+#endif // _SDGLUITM_HXX
diff --git a/svx/inc/svx/sdgmoitm.hxx b/svx/inc/svx/sdgmoitm.hxx
new file mode 100644
index 000000000000..7e79d6020ab1
--- /dev/null
+++ b/svx/inc/svx/sdgmoitm.hxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDGMOITM_HXX
+#define _SDGMOITM_HXX
+
+#include <svtools/grfmgr.hxx>
+#include <svl/eitem.hxx>
+#include <svx/svddef.hxx>
+#include "svx/svxdllapi.h"
+
+//------------------
+// SdrGrafModeItem -
+//------------------
+
+class SVX_DLLPUBLIC SdrGrafModeItem : public SfxEnumItem
+{
+public:
+
+ TYPEINFO();
+
+ SdrGrafModeItem( GraphicDrawMode eMode = GRAPHICDRAWMODE_STANDARD ) : SfxEnumItem( SDRATTR_GRAFMODE, (sal_uInt16)eMode ) {}
+ SdrGrafModeItem( SvStream& rIn ) : SfxEnumItem( SDRATTR_GRAFMODE, rIn ) {}
+
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const;
+ virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+ virtual sal_uInt16 GetValueCount() const;
+ GraphicDrawMode GetValue() const { return (GraphicDrawMode) SfxEnumItem::GetValue(); }
+
+ virtual String GetValueTextByPos( sal_uInt16 nPos ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String& rText, const IntlWrapper * = 0) const;
+
+};
+
+#endif // _SDGMOITM_HXX
diff --git a/svx/inc/svx/sdgtritm.hxx b/svx/inc/svx/sdgtritm.hxx
new file mode 100644
index 000000000000..af80263dba00
--- /dev/null
+++ b/svx/inc/svx/sdgtritm.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDGTRITM_HXX
+#define _SDGTRITM_HXX
+
+#include <svx/sdprcitm.hxx>
+#include <svx/svddef.hxx>
+#include "svx/svxdllapi.h"
+
+//--------------------------
+// SdrGrafTransparenceItem -
+//--------------------------
+
+class SVX_DLLPUBLIC SdrGrafTransparenceItem : public SdrPercentItem
+{
+public:
+
+ TYPEINFO();
+ SdrGrafTransparenceItem( sal_uInt16 nTransparencePercent = 0 ) : SdrPercentItem( SDRATTR_GRAFTRANSPARENCE, nTransparencePercent ) {}
+ SdrGrafTransparenceItem( SvStream& rIn ) : SdrPercentItem( SDRATTR_GRAFTRANSPARENCE, rIn ) {}
+
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const;
+ virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+};
+
+#endif // _SDGTRITM_HXX
diff --git a/svx/inc/svx/sdmetitm.hxx b/svx/inc/svx/sdmetitm.hxx
new file mode 100644
index 000000000000..a92e9f0944b8
--- /dev/null
+++ b/svx/inc/svx/sdmetitm.hxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SDMETITM_HXX
+#define _SDMETITM_HXX
+
+#include <svl/intitem.hxx>
+#include "svx/svxdllapi.h"
+
+
+//------------------------------------------------------------
+// class SdrAngleItem
+// Fuer alle Metriken. GetPresentation liefert dann bei
+// Value=2500 z.B. ein "25mm".
+//------------------------------------------------------------
+class SVX_DLLPUBLIC SdrMetricItem: public SfxInt32Item {
+public:
+ TYPEINFO();
+ SdrMetricItem(): SfxInt32Item() {}
+ SdrMetricItem(sal_uInt16 nId, sal_Int32 nVal=0): SfxInt32Item(nId,nVal) {}
+ SdrMetricItem(sal_uInt16 nId, SvStream& rIn): SfxInt32Item(nId,rIn) {}
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool=NULL) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual FASTBOOL HasMetrics() const;
+ virtual FASTBOOL ScaleMetrics(long nMul, long nDiv);
+
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String& rText, const IntlWrapper * = 0) const;
+
+#ifdef SDR_ISPOOLABLE
+ virtual int IsPoolable() const;
+#endif
+};
+
+
+#endif
diff --git a/svx/inc/svx/sdooitm.hxx b/svx/inc/svx/sdooitm.hxx
new file mode 100644
index 000000000000..b5bb0b877189
--- /dev/null
+++ b/svx/inc/svx/sdooitm.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SDOOITM_HXX
+#define _SDOOITM_HXX
+
+#include <svl/eitem.hxx>
+#include "svx/svxdllapi.h"
+
+
+//------------------------------------------------------------
+// class SdrOnOffItem
+// hier liefert GetValueTextByVal() "an" oder "aus"
+// anstelle von "TRUE" und "FALSE"
+//------------------------------------------------------------
+class SVX_DLLPUBLIC SdrOnOffItem: public SfxBoolItem {
+public:
+ TYPEINFO();
+ SdrOnOffItem(): SfxBoolItem() {}
+ SdrOnOffItem(sal_uInt16 nId, sal_Bool bOn=sal_False): SfxBoolItem(nId,bOn) {}
+ SdrOnOffItem(sal_uInt16 nId, SvStream& rIn): SfxBoolItem(nId,rIn) {}
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool=NULL) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ virtual String GetValueTextByVal(sal_Bool bVal) const;
+
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String& rText, const IntlWrapper * = 0) const;
+
+#ifdef SDR_ISPOOLABLE
+ virtual int IsPoolable() const;
+#endif
+};
+
+
+#endif
diff --git a/svx/inc/svx/sdprcitm.hxx b/svx/inc/svx/sdprcitm.hxx
new file mode 100644
index 000000000000..39b102f0b4ac
--- /dev/null
+++ b/svx/inc/svx/sdprcitm.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SDPRCITM_HXX
+#define _SDPRCITM_HXX
+
+#include <svl/intitem.hxx>
+#include "svx/svxdllapi.h"
+
+
+//------------------------------------------------------------
+// class SdrPercentItem
+// Ganze Prozente von 0
+//------------------------------------------------------------
+
+class SVX_DLLPUBLIC SdrPercentItem : public SfxUInt16Item
+{
+public:
+ TYPEINFO();
+ SdrPercentItem(): SfxUInt16Item() {}
+ SdrPercentItem(sal_uInt16 nId, sal_uInt16 nVal=0): SfxUInt16Item(nId,nVal) {}
+ SdrPercentItem(sal_uInt16 nId, SvStream& rIn): SfxUInt16Item(nId,rIn) {}
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool=NULL) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String& rText, const IntlWrapper * = 0) const;
+
+#ifdef SDR_ISPOOLABLE
+ virtual int IsPoolable() const;
+#endif
+};
+
+//------------------------------------------------------------
+// class SdrSignedPercentItem
+// Ganze Prozente von +/-
+//------------------------------------------------------------
+
+class SVX_DLLPUBLIC SdrSignedPercentItem : public SfxInt16Item
+{
+public:
+ TYPEINFO();
+ SdrSignedPercentItem(): SfxInt16Item() {}
+ SdrSignedPercentItem( sal_uInt16 nId, sal_Int16 nVal = 0 ) : SfxInt16Item( nId,nVal ) {}
+ SdrSignedPercentItem( sal_uInt16 nId, SvStream& rIn ) : SfxInt16Item( nId,rIn ) {}
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const;
+ virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String& rText, const IntlWrapper * = 0 ) const;
+
+#ifdef SDR_ISPOOLABLE
+ virtual int IsPoolable() const;
+#endif
+};
+
+
+#endif
diff --git a/svx/inc/svx/sdr/animation/animationstate.hxx b/svx/inc/svx/sdr/animation/animationstate.hxx
new file mode 100644
index 000000000000..3728d1724cd2
--- /dev/null
+++ b/svx/inc/svx/sdr/animation/animationstate.hxx
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_ANIMATION_ANIMATIONSTATE_HXX
+#define _SDR_ANIMATION_ANIMATIONSTATE_HXX
+
+#include <sal/types.h>
+#include <vector>
+#include <svx/sdr/animation/scheduler.hxx>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewObjectContact;
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace animation
+ {
+ class PrimitiveAnimation : public Event
+ {
+ protected:
+ // the animated VOC
+ sdr::contact::ViewObjectContact& mrVOContact;
+
+ // the vetor of animated primitives
+ drawinglayer::primitive2d::Primitive2DSequence maAnimatedPrimitives;
+
+ // local helpers
+ double getSmallestNextTime(double fCurrentTime);
+ void prepareNextEvent();
+
+ public:
+ // basic constructor.
+ PrimitiveAnimation(sdr::contact::ViewObjectContact& rVOContact, const drawinglayer::primitive2d::Primitive2DSequence& rAnimatedPrimitives);
+
+ // destructor
+ virtual ~PrimitiveAnimation();
+
+ // execute event, from base class Event
+ virtual void Trigger(sal_uInt32 nTime);
+ };
+ } // end of namespace animation
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_ANIMATION_ANIMATIONSTATE_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/animation/objectanimator.hxx b/svx/inc/svx/sdr/animation/objectanimator.hxx
new file mode 100644
index 000000000000..adc7f8ffebaf
--- /dev/null
+++ b/svx/inc/svx/sdr/animation/objectanimator.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_ANIMATION_OBJECTANIMATOR_HXX
+#define _SDR_ANIMATION_OBJECTANIMATOR_HXX
+
+#include <sal/types.h>
+#include <vector>
+#include <vcl/timer.hxx>
+#include <svx/sdr/animation/scheduler.hxx>
+#include <svx/sdr/animation/animationstate.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace animation
+ {
+ class primitiveAnimator : public Scheduler
+ {
+ public:
+ // basic constructor and destructor
+ primitiveAnimator();
+ SVX_DLLPUBLIC virtual ~primitiveAnimator();
+ };
+ } // end of namespace animation
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_ANIMATION_OBJECTANIMATOR_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/animation/scheduler.hxx b/svx/inc/svx/sdr/animation/scheduler.hxx
new file mode 100644
index 000000000000..21547ed51da0
--- /dev/null
+++ b/svx/inc/svx/sdr/animation/scheduler.hxx
@@ -0,0 +1,159 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_ANIMATION_SCHEDULER_HXX
+#define _SDR_ANIMATION_SCHEDULER_HXX
+
+#include <sal/types.h>
+#include <vcl/timer.hxx>
+#include <svx/svxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// event class
+
+namespace sdr
+{
+ namespace animation
+ {
+ class Event
+ {
+ // time of event in ms
+ sal_uInt32 mnTime;
+
+ // pointer for simply linked list
+ Event* mpNext;
+
+ public:
+ // constructor/destructor
+ Event(sal_uInt32 nTime);
+ SVX_DLLPUBLIC virtual ~Event();
+
+ // access to mpNext
+ Event* GetNext() const;
+ void SetNext(Event* pNew);
+
+ // get/set time
+ sal_uInt32 GetTime() const;
+ void SetTime(sal_uInt32 nNew);
+
+ // execute event
+ virtual void Trigger(sal_uInt32 nTime) = 0;
+ };
+ } // end of namespace animation
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eventlist class
+
+namespace sdr
+{
+ namespace animation
+ {
+ class EventList
+ {
+ // pointer to first entry
+ Event* mpHead;
+
+ public:
+ // constructor/destructor
+ EventList();
+ SVX_DLLPUBLIC virtual ~EventList();
+
+ // insert/remove time dependent
+ void Insert(Event* pNew);
+ void Remove(Event* pOld);
+
+ // clear list
+ void Clear();
+
+ // get first
+ Event* GetFirst();
+ };
+ } // end of namespace animation
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// scheduler class
+
+namespace sdr
+{
+ namespace animation
+ {
+ class Scheduler : public Timer
+ {
+ // time in ms
+ sal_uInt32 mnTime;
+
+ // next delta time
+ sal_uInt32 mnDeltaTime;
+
+ // list of events
+ EventList maList;
+
+ // Flag which remembers if this timer is paused. Default
+ // is false.
+ bool mbIsPaused;
+
+ public:
+ // constructor/destructor
+ Scheduler();
+ SVX_DLLPUBLIC virtual ~Scheduler();
+
+ // From baseclass Timer, the timeout call
+ SVX_DLLPUBLIC virtual void Timeout();
+
+ // get time
+ sal_uInt32 GetTime();
+
+ // #i38135#
+ void SetTime(sal_uInt32 nTime);
+
+ // reset
+ void Reset(sal_uInt32 nTime);
+
+ // execute all ripe events, removes executed ones from the scheduler
+ void triggerEvents();
+
+ // re-start or stop timer according to event list
+ void checkTimeout();
+
+ // insert/remove events, wrapper to EventList methods
+ void InsertEvent(Event* pNew);
+ void RemoveEvent(Event* pOld);
+
+ // get/set pause
+ bool IsPaused() const { return mbIsPaused; }
+ void SetPaused(bool bNew);
+ };
+ } // end of namespace animation
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_ANIMATION_SCHEDULER_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/attribute/sdrfilltextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrfilltextattribute.hxx
new file mode 100644
index 000000000000..df8ee7c666a9
--- /dev/null
+++ b/svx/inc/svx/sdr/attribute/sdrfilltextattribute.hxx
@@ -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: sdrallattribute.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_SDRFILLTEXTATTRIBUTE_HXX
+#define _SDR_ATTRIBUTE_SDRFILLTEXTATTRIBUTE_HXX
+
+#include <sal/types.h>
+#include <drawinglayer/attribute/sdrfillattribute.hxx>
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
+#include <svx/sdr/attribute/sdrtextattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class SdrFillTextAttribute
+ {
+ // shadow and text attributes
+ SdrFillAttribute maFill; // fill attributes (if used)
+ FillGradientAttribute maFillFloatTransGradient; // fill float transparence gradient (if used)
+ SdrTextAttribute maTextAttribute; // text and text attributes (if used)
+
+ public:
+ SdrFillTextAttribute(
+ const SdrFillAttribute& rFill,
+ const FillGradientAttribute& rFillFloatTransGradient,
+ const SdrTextAttribute& rTextAttribute);
+ SdrFillTextAttribute();
+ SdrFillTextAttribute(const SdrFillTextAttribute& rCandidate);
+ SdrFillTextAttribute& operator=(const SdrFillTextAttribute& rCandidate);
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrFillTextAttribute& rCandidate) const;
+
+ // data access
+ const SdrFillAttribute& getFill() const { return maFill; }
+ const FillGradientAttribute& getFillFloatTransGradient() const { return maFillFloatTransGradient; }
+ const SdrTextAttribute& getText() const { return maTextAttribute; }
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // _SDR_ATTRIBUTE_SDRFILLTEXTATTRIBUTE_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx
new file mode 100644
index 000000000000..03b86ff33a0f
--- /dev/null
+++ b/svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _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 ImpSdrFormTextAttribute;
+ class SdrFormTextOutlineAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class SdrFormTextAttribute
+ {
+ private:
+ ImpSdrFormTextAttribute* mpSdrFormTextAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrFormTextAttribute(const SfxItemSet& rSet);
+ SdrFormTextAttribute();
+ SdrFormTextAttribute(const SdrFormTextAttribute& rCandidate);
+ SdrFormTextAttribute& operator=(const SdrFormTextAttribute& rCandidate);
+ ~SdrFormTextAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrFormTextAttribute& rCandidate) const;
+
+ // data read access
+ sal_Int32 getFormTextDistance() const;
+ sal_Int32 getFormTextStart() const;
+ sal_Int32 getFormTextShdwXVal() const;
+ sal_Int32 getFormTextShdwYVal() const;
+ sal_uInt16 getFormTextShdwTransp() const;
+ XFormTextStyle getFormTextStyle() const;
+ XFormTextAdjust getFormTextAdjust() const;
+ XFormTextShadow getFormTextShadow() const;
+ Color getFormTextShdwColor() const;
+ const SdrFormTextOutlineAttribute& getOutline() const;
+ const SdrFormTextOutlineAttribute& getShadowOutline() const;
+ bool getFormTextMirror() const;
+ bool getFormTextOutline() const;
+ };
+ } // 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..fd72607b2f08
--- /dev/null
+++ b/svx/inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_ATTRIBUTE_SDRFORMTEXTOUTLINEATTRIBUTE_HXX
+#define _SDR_ATTRIBUTE_SDRFORMTEXTOUTLINEATTRIBUTE_HXX
+
+#include <sal/types.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace drawinglayer { namespace attribute {
+ class ImpSdrFormTextOutlineAttribute;
+ class LineAttribute;
+ class StrokeAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class SdrFormTextOutlineAttribute
+ {
+ private:
+ ImpSdrFormTextOutlineAttribute* mpSdrFormTextOutlineAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrFormTextOutlineAttribute(
+ const LineAttribute& rLineAttribute,
+ const StrokeAttribute& rStrokeAttribute,
+ sal_uInt8 nTransparence);
+ SdrFormTextOutlineAttribute();
+ SdrFormTextOutlineAttribute(const SdrFormTextOutlineAttribute& rCandidate);
+ SdrFormTextOutlineAttribute& operator=(const SdrFormTextOutlineAttribute& rCandidate);
+ ~SdrFormTextOutlineAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrFormTextOutlineAttribute& rCandidate) const;
+
+ // data read access
+ const LineAttribute& getLineAttribute() const;
+ const StrokeAttribute& getStrokeAttribute() const;
+ sal_uInt8 getTransparence() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // _SDR_ATTRIBUTE_SDRFORMTEXTOUTLINEATTRIBUTE_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx
new file mode 100644
index 000000000000..c2fa9200dfe8
--- /dev/null
+++ b/svx/inc/svx/sdr/attribute/sdrlinefillshadowtextattribute.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: sdrallattribute.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_SDRLINEFILLSHADOWTEXTATTRIBUTE_HXX
+#define _SDR_ATTRIBUTE_SDRLINEFILLSHADOWTEXTATTRIBUTE_HXX
+
+#include <sal/types.h>
+#include <svx/sdr/attribute/sdrlineshadowtextattribute.hxx>
+#include <drawinglayer/attribute/sdrfillattribute.hxx>
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class SdrLineFillShadowTextAttribute : public SdrLineShadowTextAttribute
+ {
+ // add fill and transGradient attributes
+ SdrFillAttribute maFill; // fill attributes (if used)
+ FillGradientAttribute maFillFloatTransGradient; // fill float transparence gradient (if used)
+
+ public:
+ SdrLineFillShadowTextAttribute(
+ const SdrLineAttribute& rLine,
+ const SdrFillAttribute& rFill,
+ const SdrLineStartEndAttribute& rLineStartEnd,
+ const SdrShadowAttribute& rShadow,
+ const FillGradientAttribute& rFillFloatTransGradient,
+ const SdrTextAttribute& rTextAttribute);
+ SdrLineFillShadowTextAttribute();
+ SdrLineFillShadowTextAttribute(const SdrLineFillShadowTextAttribute& rCandidate);
+ SdrLineFillShadowTextAttribute& operator=(const SdrLineFillShadowTextAttribute& rCandidate);
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrLineFillShadowTextAttribute& rCandidate) const;
+
+ // data access
+ const SdrFillAttribute& getFill() const { return maFill; }
+ const FillGradientAttribute& getFillFloatTransGradient() const { return maFillFloatTransGradient; }
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // _SDR_ATTRIBUTE_SDRLINEFILLSHADOWTEXTATTRIBUTE_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/attribute/sdrlineshadowtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrlineshadowtextattribute.hxx
new file mode 100644
index 000000000000..e5d19cef5f4e
--- /dev/null
+++ b/svx/inc/svx/sdr/attribute/sdrlineshadowtextattribute.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * 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: sdrallattribute.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_SDRLINESHADOWTEXTATTRIBUTE_HXX
+#define _SDR_ATTRIBUTE_SDRLINESHADOWTEXTATTRIBUTE_HXX
+
+#include <sal/types.h>
+#include <svx/sdr/attribute/sdrshadowtextattribute.hxx>
+#include <drawinglayer/attribute/sdrlineattribute.hxx>
+#include <drawinglayer/attribute/sdrlinestartendattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class SdrLineShadowTextAttribute : public SdrShadowTextAttribute
+ {
+ // line, shadow, lineStartEnd and text attributes
+ SdrLineAttribute maLine; // line attributes (if used)
+ SdrLineStartEndAttribute maLineStartEnd; // line start end (if used)
+
+ public:
+ SdrLineShadowTextAttribute(
+ const SdrLineAttribute& rLine,
+ const SdrLineStartEndAttribute& rLineStartEnd,
+ const SdrShadowAttribute& rShadow,
+ const SdrTextAttribute& rTextAttribute);
+ SdrLineShadowTextAttribute();
+ SdrLineShadowTextAttribute(const SdrLineShadowTextAttribute& rCandidate);
+ SdrLineShadowTextAttribute& operator=(const SdrLineShadowTextAttribute& rCandidate);
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrLineShadowTextAttribute& rCandidate) const;
+
+ // data access
+ const SdrLineAttribute& getLine() const { return maLine; }
+ const SdrLineStartEndAttribute& getLineStartEnd() const { return maLineStartEnd; }
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // _SDR_ATTRIBUTE_SDRLINESHADOWTEXTATTRIBUTE_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/attribute/sdrshadowtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrshadowtextattribute.hxx
new file mode 100644
index 000000000000..f71a74d6a580
--- /dev/null
+++ b/svx/inc/svx/sdr/attribute/sdrshadowtextattribute.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * 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: sdrallattribute.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_SDRSHADOWTEXTATTRIBUTE_HXX
+#define _SDR_ATTRIBUTE_SDRSHADOWTEXTATTRIBUTE_HXX
+
+#include <sal/types.h>
+#include <drawinglayer/attribute/sdrshadowattribute.hxx>
+#include <svx/sdr/attribute/sdrtextattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class SdrShadowTextAttribute
+ {
+ // shadow and text attributes
+ SdrShadowAttribute maShadow; // shadow attributes (if used)
+ SdrTextAttribute maTextAttribute; // text and text attributes (if used)
+
+ public:
+ SdrShadowTextAttribute(
+ const SdrShadowAttribute& rShadow,
+ const SdrTextAttribute& rTextAttribute);
+ SdrShadowTextAttribute();
+ SdrShadowTextAttribute(const SdrShadowTextAttribute& rCandidate);
+ SdrShadowTextAttribute& operator=(const SdrShadowTextAttribute& rCandidate);
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrShadowTextAttribute& rCandidate) const;
+
+ // data access
+ const SdrShadowAttribute& getShadow() const { return maShadow; }
+ const SdrTextAttribute& getText() const { return maTextAttribute; }
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // _SDR_ATTRIBUTE_SDRSHADOWTEXTATTRIBUTE_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx
new file mode 100644
index 000000000000..f202eabbfbff
--- /dev/null
+++ b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx
@@ -0,0 +1,130 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_ATTRIBUTE_SDRTEXTATTRIBUTE_HXX
+#define _SDR_ATTRIBUTE_SDRTEXTATTRIBUTE_HXX
+
+#include <sal/types.h>
+#include <svx/xenum.hxx>
+#include <editeng/outlobj.hxx>
+#include <svx/sdtaitm.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+class SdrText;
+
+namespace drawinglayer { namespace animation {
+ class AnimationEntryList;
+}}
+
+namespace drawinglayer { namespace attribute {
+ class SdrFormTextAttribute;
+}}
+
+namespace drawinglayer { namespace attribute {
+ class ImpSdrTextAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class SdrTextAttribute
+ {
+ private:
+ ImpSdrTextAttribute* mpSdrTextAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrTextAttribute(
+ const SdrText& rSdrText,
+ const OutlinerParaObject& rOutlinerParaObject,
+ XFormTextStyle eFormTextStyle,
+ sal_Int32 aTextLeftDistance,
+ sal_Int32 aTextUpperDistance,
+ sal_Int32 aTextRightDistance,
+ sal_Int32 aTextLowerDistance,
+ SdrTextHorzAdjust aSdrTextHorzAdjust,
+ SdrTextVertAdjust aSdrTextVertAdjust,
+ bool bContour,
+ bool bFitToSize,
+ bool bHideContour,
+ bool bBlink,
+ bool bScroll,
+ bool bInEditMode,
+ bool bFixedCellHeight,
+ bool bWrongSpell);
+ SdrTextAttribute();
+ SdrTextAttribute(const SdrTextAttribute& rCandidate);
+ SdrTextAttribute& operator=(const SdrTextAttribute& rCandidate);
+ ~SdrTextAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrTextAttribute& rCandidate) const;
+
+ // data read access
+ const SdrText& getSdrText() const;
+ const OutlinerParaObject& getOutlinerParaObject() const;
+ bool isContour() const;
+ bool isFitToSize() const;
+ bool isHideContour() const;
+ bool isBlink() const;
+ bool isScroll() const;
+ bool isInEditMode() const;
+ bool isFixedCellHeight() const;
+ bool isWrongSpell() const;
+ const SdrFormTextAttribute& getSdrFormTextAttribute() const;
+ sal_Int32 getTextLeftDistance() const;
+ sal_Int32 getTextUpperDistance() const;
+ sal_Int32 getTextRightDistance() const;
+ sal_Int32 getTextLowerDistance() const;
+ sal_uInt32 getPropertiesVersion() const;
+ SdrTextHorzAdjust getSdrTextHorzAdjust() const;
+ SdrTextVertAdjust getSdrTextVertAdjust() const;
+
+ // helpers: animation timing generators
+ void getBlinkTextTiming(
+ drawinglayer::animation::AnimationEntryList& rAnimList) const;
+ void getScrollTextTiming(
+ drawinglayer::animation::AnimationEntryList& rAnimList,
+ double fFrameLength,
+ double fTextLength) const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // _SDR_ATTRIBUTE_SDRTEXTATTRIBUTE_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/displayinfo.hxx b/svx/inc/svx/sdr/contact/displayinfo.hxx
new file mode 100644
index 000000000000..777e0abdd09b
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/displayinfo.hxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_DISPLAYINFO_HXX
+#define _SDR_CONTACT_DISPLAYINFO_HXX
+
+#include <sal/types.h>
+#include <svx/svdsob.hxx>
+#include <svtools/colorcfg.hxx>
+#include <vcl/region.hxx>
+#include <vector>
+#include "svx/svxdllapi.h"
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SdrPage;
+
+namespace sdr { namespace contact {
+ class ViewObjectContact;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class SVX_DLLPUBLIC DisplayInfo
+ {
+ protected:
+ // The Layers which shall be processed (visible)
+ SetOfByte maProcessLayers;
+
+ // The redraw area, in logical coordinates of OutputDevice. If Region
+ // is empty, everything needs to be redrawn
+ Region maRedrawArea;
+
+ // bitfield
+
+ // Internal flag to know when the control layer is painted. Default is
+ // false. If set to true, painting of the page, page borders and
+ // the rasters will be suppressed as if mbPageProcessingActive is set (see there).
+ // This flag is set internally from the processing mechanism to avoid double page
+ // painting when the control layer needs to be painted as last layer
+ unsigned mbControlLayerProcessingActive : 1;
+
+ // Internal flag to decide if page stuff (background, border, MasterPage, grid, etc...)
+ // will be processed at all. This flag is user-defined and will not be changed from the
+ // processing mechanism. Default is true, thus set to false if PagePainting should be suppressed.
+ // For more granular switching page stuff painting on and off, use the according flags at the
+ // view (->Is*Visible())
+ unsigned mbPageProcessingActive : 1;
+
+ // Internal flag to remember if EnteredGroupDrawMode is active. Default is true
+ // since this mode starts activated and gets switched off when reacing
+ // the current group level. Should only be changed by instances which do
+ // primitive processing
+ unsigned mbGhostedDrawModeActive : 1;
+
+ // Internal flag to know if a MasterPage is processed as SubContent of another
+ // page. Initialized to false, this should only be changed from the instance which
+ // is processing the MasterPage asSubContent and knows what it does
+ unsigned mbSubContentActive : 1;
+
+ public:
+ // basic constructor.
+ DisplayInfo();
+
+ // destructor
+ virtual ~DisplayInfo();
+
+ // access to ProcessLayers
+ void SetProcessLayers(const SetOfByte& rSet);
+ const SetOfByte& GetProcessLayers() const { return maProcessLayers; }
+
+ // access to RedrawArea
+ void SetRedrawArea(const Region& rRegion);
+ const Region& GetRedrawArea() const { return maRedrawArea; }
+
+ // Access to ControlLayerProcessingActive flag
+ void SetControlLayerProcessingActive(bool bDoPaint);
+ bool GetControlLayerProcessingActive() const { return mbControlLayerProcessingActive; }
+
+ // Access to PageProcessingActive flag
+ void SetPageProcessingActive(bool bDoPaint);
+ bool GetPageProcessingActive() const { return mbPageProcessingActive; }
+
+ // Save the original DrawMode from outdev
+ void ClearGhostedDrawMode();
+ void SetGhostedDrawMode();
+ bool IsGhostedDrawModeActive() const { return mbGhostedDrawModeActive; }
+
+ // access to master page painting flag
+ bool GetSubContentActive() const { return mbSubContentActive; }
+ void SetSubContentActive(bool bNew);
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_DISPLAYINFO_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/objectcontact.hxx b/svx/inc/svx/sdr/contact/objectcontact.hxx
new file mode 100644
index 000000000000..d88ea3dc2a12
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/objectcontact.hxx
@@ -0,0 +1,229 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_OBJECTCONTACT_HXX
+#define _SDR_CONTACT_OBJECTCONTACT_HXX
+
+#include <svx/sdr/animation/objectanimator.hxx>
+#include "svx/svxdllapi.h"
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SetOfByte;
+class Rectangle;
+class SdrPageView;
+class OutputDevice;
+
+namespace sdr { namespace contact {
+ class DisplayInfo;
+ class ViewContact;
+ class ViewObjectContactRedirector;
+}}
+
+namespace sdr { namespace event {
+ class TimerEventHandler;
+}}
+
+namespace basegfx {
+ class B2DRange;
+ class B2DHomMatrix;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class SVX_DLLPUBLIC ObjectContact
+ {
+ private:
+ // make ViewObjectContact a friend to exclusively allow it to use
+ // AddViewObjectContact/RemoveViewObjectContact
+ friend class ViewObjectContact;
+
+ // All VOCs which are created using this OC, thus remembering this OC
+ // as a reference. All those VOCs need to be deleted when the OC goes down.
+ // Registering and de-registering is done in the VOC constructors/destructors.
+ std::vector< ViewObjectContact* > maViewObjectContactVector;
+
+ // A new ViewObjectContact was created and shall be remembered.
+ void AddViewObjectContact(ViewObjectContact& rVOContact);
+
+ // A ViewObjectContact was deleted and shall be forgotten.
+ virtual void RemoveViewObjectContact(ViewObjectContact& rVOContact);
+
+ // the primitiveAnimator which is used if this View and/or the contained primitives
+ // support animatedSwitchPrimitives
+ sdr::animation::primitiveAnimator maPrimitiveAnimator;
+
+ // the EventHandler for e.g. asynchronious loading of graphics
+ sdr::event::TimerEventHandler* mpEventHandler;
+
+ // The redirector. If set it is used to pipe all supported calls
+ // to the redirector
+ ViewObjectContactRedirector* mpViewObjectContactRedirector;
+
+ // the Primitive2DParameters containing view information
+ drawinglayer::geometry::ViewInformation2D maViewInformation2D;
+
+ // bitfield
+ // flag for preview renderer
+ unsigned mbIsPreviewRenderer : 1;
+
+ // method to create a EventHandler. Needs to give a result.
+ sdr::event::TimerEventHandler* CreateEventHandler();
+
+ protected:
+ // Interface to allow derivates to travel over the registered VOC's
+ sal_uInt32 getViewObjectContactCount() const { return maViewObjectContactVector.size(); }
+ ViewObjectContact* getViewObjectContact(sal_uInt32 a) const { return maViewObjectContactVector[a]; }
+
+ // interface to allow derivates to set PreviewRenderer flag
+ void setPreviewRenderer(bool bNew) { mbIsPreviewRenderer = bNew; }
+
+ // interface to allow derivates to set ViewInformation2D
+ void updateViewInformation2D(const drawinglayer::geometry::ViewInformation2D& rViewInformation2D) { maViewInformation2D = rViewInformation2D; }
+
+ public:
+ // basic constructor
+ ObjectContact();
+ virtual ~ObjectContact();
+
+ // LazyInvalidate request. This is used from the VOCs to mark that they
+ // got invalidated by an ActionCanged() call. An active view needs to remember
+ // this and take action on it. Default implementation directly calls back
+ // triggerLazyInvalidate() wich promptly handles the request
+ virtual void setLazyInvalidate(ViewObjectContact& rVOC);
+
+ // call this to support evtl. preparations for repaint. Default does nothing
+ virtual void PrepareProcessDisplay();
+
+ // Process the whole displaying
+ virtual void ProcessDisplay(DisplayInfo& rDisplayInfo);
+
+ // test if visualizing of entered groups is switched on at all. Default
+ // implementation returns sal_False.
+ virtual bool DoVisualizeEnteredGroup() const;
+
+ // get active group's (the entered group) ViewContact
+ virtual const ViewContact* getActiveViewContact() const;
+
+ // Invalidate given rectangle at the window/output which is represented by
+ // this ObjectContact. Default does nothing.
+ virtual void InvalidatePartOfView(const basegfx::B2DRange& rRange) const;
+
+ // Get info if given Rectangle is visible in this view
+ virtual bool IsAreaVisible(const basegfx::B2DRange& rRange) const;
+
+ // Get info about the need to visualize GluePoints. The default
+ // is that it is not necessary.
+ virtual bool AreGluePointsVisible() const;
+
+ // method to get the primitiveAnimator
+ sdr::animation::primitiveAnimator& getPrimitiveAnimator();
+
+ // method to get the EventHandler. It will
+ // return a existing one or create a new one using CreateEventHandler().
+ sdr::event::TimerEventHandler& GetEventHandler() const;
+
+ // delete the EventHandler
+ void DeleteEventHandler();
+
+ // test if there is an EventHandler without creating one on demand
+ bool HasEventHandler() const;
+
+ // check if text animation is allowed. Default is sal_true.
+ virtual bool IsTextAnimationAllowed() const;
+
+ // check if graphic animation is allowed. Default is sal_true.
+ virtual bool IsGraphicAnimationAllowed() const;
+
+ // check if asynchronious graphis loading is allowed. Default is sal_False.
+ virtual bool IsAsynchronGraphicsLoadingAllowed() const;
+
+ // access to ViewObjectContactRedirector
+ ViewObjectContactRedirector* GetViewObjectContactRedirector() const;
+ void SetViewObjectContactRedirector(ViewObjectContactRedirector* pNew);
+
+ // check if buffering of MasterPages is allowed. Default is sal_False.
+ virtual bool IsMasterPageBufferingAllowed() const;
+
+ // print? Default is false
+ virtual bool isOutputToPrinter() const;
+
+ // window? Default is true
+ virtual bool isOutputToWindow() const;
+
+ // VirtualDevice? Default is false
+ virtual bool isOutputToVirtualDevice() const;
+
+ // recording MetaFile? Default is false
+ virtual bool isOutputToRecordingMetaFile() const;
+
+ // pdf export? Default is false
+ virtual bool isOutputToPDFFile() const;
+
+ // gray display mode
+ virtual bool isDrawModeGray() const;
+
+ // gray display mode
+ virtual bool isDrawModeBlackWhite() const;
+
+ // high contrast display mode
+ virtual bool isDrawModeHighContrast() const;
+
+ // check if this is a preview renderer. Default is sal_False.
+ bool IsPreviewRenderer() const { return mbIsPreviewRenderer; }
+
+ // get Primitive2DParameters for this view
+ const drawinglayer::geometry::ViewInformation2D& getViewInformation2D() const { return maViewInformation2D; }
+
+ // access to SdrPageView. May return 0L like the default implementations do. Needs to be overloaded as needed.
+ virtual SdrPageView* TryToGetSdrPageView() const;
+
+ // access to OutputDevice. May return 0L like the default implementations do. Needs to be overloaded as needed.
+ virtual OutputDevice* TryToGetOutputDevice() const;
+
+ // reset ViewPort at internal ViewInformation2D. This is needed when the OC is used
+ // not for ProcessDisplay() but to get a VOC associated with it. When trying to get
+ // a sequence of primitives from the VOC then, the last initialized ViewPort from
+ // the last ProcessDisplay() is used for geometric visibility testing. If this is not
+ // wanted (like in such cases) this method is used. It will reuse the current
+ // ViewInformation2D, but clear the ViewPort (no ViewPort means all is visible)
+ void resetViewPort();
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_OBJECTCONTACT_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/objectcontactofobjlistpainter.hxx b/svx/inc/svx/sdr/contact/objectcontactofobjlistpainter.hxx
new file mode 100644
index 000000000000..870192c9b151
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/objectcontactofobjlistpainter.hxx
@@ -0,0 +1,153 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_OBJECTCONTACTOFOBJLISTPAINTER_HXX
+#define _SDR_CONTACT_OBJECTCONTACTOFOBJLISTPAINTER_HXX
+
+#include <svx/sdr/contact/objectcontact.hxx>
+#include "svx/svxdllapi.h"
+#include <svx/svdpage.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SdrPage;
+class SdrObject;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class SVX_DLLPUBLIC ObjectContactPainter : public ObjectContact
+ {
+ protected:
+ // Hierarchy access methods
+ virtual sal_uInt32 GetPaintObjectCount() const = 0;
+ virtual ViewContact& GetPaintObjectViewContact(sal_uInt32 nIndex) const = 0;
+
+ public:
+ // basic constructor/destructor
+ ObjectContactPainter();
+ virtual ~ObjectContactPainter();
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ // typedef for transferring SdrObject
+ typedef ::std::vector< SdrObject* > SdrObjectVector;
+
+ class SVX_DLLPUBLIC ObjectContactOfObjListPainter : public ObjectContactPainter
+ {
+ protected:
+ // Target OutputDevice
+ OutputDevice& mrTargetOutputDevice;
+
+ // Set StartPoint for next run, also given in constructor
+ SdrObjectVector maStartObjects;
+
+ // the processed page which is the base e.g. for PageNumberFields
+ const SdrPage* mpProcessedPage;
+
+ // Hierarchy access methods
+ virtual sal_uInt32 GetPaintObjectCount() const;
+ virtual ViewContact& GetPaintObjectViewContact(sal_uInt32 nIndex) const;
+
+ public:
+ // basic constructor/destructor
+ ObjectContactOfObjListPainter(
+ OutputDevice& rTargetDevice,
+ const SdrObjectVector& rObjects,
+ const SdrPage* pProcessedPage);
+ virtual ~ObjectContactOfObjListPainter();
+
+ // Process the whole displaying
+ virtual void ProcessDisplay(DisplayInfo& rDisplayInfo);
+
+ // VirtualDevice? Default is false
+ virtual bool isOutputToVirtualDevice() const;
+
+ // recording MetaFile? Default is false
+ virtual bool isOutputToRecordingMetaFile() const;
+
+ // pdf export? Default is false
+ virtual bool isOutputToPDFFile() const;
+
+ // access to OutputDevice. May return 0L like the default implementations do. Needs to be overloaded as needed.
+ virtual OutputDevice* TryToGetOutputDevice() const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ObjectContactOfPagePainter : public ObjectContactPainter
+ {
+ protected:
+ // the original ObjectContact this painter is working on
+ ObjectContact& mrOriginalObjectContact;
+
+ // Set StartPoint for next run, also given in constructor
+ SdrPageWeakRef mxStartPage;
+
+ // Hierarchy access methods
+ virtual sal_uInt32 GetPaintObjectCount() const;
+ virtual ViewContact& GetPaintObjectViewContact(sal_uInt32 nIndex) const;
+
+ public:
+ // basic constructor
+ ObjectContactOfPagePainter(
+ const SdrPage* pPage,
+ ObjectContact& rOriginalObjectContact);
+ virtual ~ObjectContactOfPagePainter();
+
+ // set another page
+ void SetStartPage(const SdrPage* pPage);
+ const SdrPage* GetStartPage() const { return mxStartPage.get(); }
+
+ // access to OutputDevice. May return 0L like the default implementations do. Needs to be overloaded as needed.
+ virtual OutputDevice* TryToGetOutputDevice() const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_OBJECTCONTACTOFOBJLISTPAINTER_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/objectcontactofpageview.hxx b/svx/inc/svx/sdr/contact/objectcontactofpageview.hxx
new file mode 100644
index 000000000000..fc0a51c9eea8
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/objectcontactofpageview.hxx
@@ -0,0 +1,153 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_OBJECTCONTACTOFPAGEVIEW_HXX
+#define _SDR_CONTACT_OBJECTCONTACTOFPAGEVIEW_HXX
+
+#include <svx/sdr/contact/objectcontact.hxx>
+#include <tools/gen.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SdrPageWindow;
+class SdrPage;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ObjectContactOfPageView : public ObjectContact, public Timer
+ {
+ protected:
+ // the owner of this ObjectContactOfPageView. Set from constructor and not
+ // to be changed in any way.
+ SdrPageWindow& mrPageWindow;
+
+ // Process the whole displaying, the real version
+ void DoProcessDisplay(DisplayInfo& rDisplayInfo);
+
+ public:
+ // access to SdrPageWindow
+ SdrPageWindow& GetPageWindow() const { return mrPageWindow; }
+
+ // access to SdrPage of PageView
+ SdrPage* GetSdrPage() const;
+
+ // basic constructor, used from SdrPageView.
+ ObjectContactOfPageView(SdrPageWindow& rPageWindow);
+ virtual ~ObjectContactOfPageView();
+
+ // LazyInvalidate request. This is used from the VOCs to mark that they
+ // got invalidated by an ActionCanged() call. An active view needs to remember
+ // this and take action on it. Default implementation directly calls back
+ // triggerLazyInvalidate() wich promptly handles the request
+ virtual void setLazyInvalidate(ViewObjectContact& rVOC);
+
+ // call this to support evtl. preparations for repaint
+ virtual void PrepareProcessDisplay();
+
+ // From baseclass Timer, the timeout call triggered by te LazyInvalidate mechanism
+ virtual void Timeout();
+
+ // Process the whole displaying
+ virtual void ProcessDisplay(DisplayInfo& rDisplayInfo);
+
+ // test if visualizing of entered groups is switched on at all
+ virtual bool DoVisualizeEnteredGroup() const;
+
+ // get active group's (the entered group) ViewContact
+ virtual const ViewContact* getActiveViewContact() const;
+
+ // Invalidate given rectangle at the window/output which is represented by
+ // this ObjectContact.
+ virtual void InvalidatePartOfView(const basegfx::B2DRange& rRange) const;
+
+ // Get info if given Rectangle is visible in this view
+ virtual bool IsAreaVisible(const basegfx::B2DRange& rRange) const;
+
+ // Get info about the need to visualize GluePoints. The default
+ // is that it is not necessary.
+ virtual bool AreGluePointsVisible() const;
+
+ // check if text animation is allowed.
+ virtual bool IsTextAnimationAllowed() const;
+
+ // check if graphic animation is allowed.
+ virtual bool IsGraphicAnimationAllowed() const;
+
+ // check if asynchronious graphis loading is allowed. Default is sal_False.
+ virtual bool IsAsynchronGraphicsLoadingAllowed() const;
+
+ // check if buffering of MasterPages is allowed. Default is sal_False.
+ virtual bool IsMasterPageBufferingAllowed() const;
+
+ // print? Default is false
+ virtual bool isOutputToPrinter() const;
+
+ // window? Default is true
+ virtual bool isOutputToWindow() const;
+
+ // VirtualDevice? Default is false
+ virtual bool isOutputToVirtualDevice() const;
+
+ // recording MetaFile? Default is false
+ virtual bool isOutputToRecordingMetaFile() const;
+
+ // pdf export? Default is false
+ virtual bool isOutputToPDFFile() const;
+
+ // gray display mode
+ virtual bool isDrawModeGray() const;
+
+ // gray display mode
+ virtual bool isDrawModeBlackWhite() const;
+
+ // high contrast display mode
+ virtual bool isDrawModeHighContrast() const;
+
+ // overloaded access to SdrPageView
+ virtual SdrPageView* TryToGetSdrPageView() const;
+
+ // access to OutputDevice. May return 0L like the default implementations do. Needs to be overloaded as needed.
+ virtual OutputDevice* TryToGetOutputDevice() const;
+
+ /** sets all UNO controls which are associated with this ObjectContact to
+ design or alive mode.
+ */
+ void SetUNOControlsDesignMode( bool _bDesignMode ) const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_OBJECTCONTACTOFPAGEVIEW_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/objectcontacttools.hxx b/svx/inc/svx/sdr/contact/objectcontacttools.hxx
new file mode 100644
index 000000000000..b7f22868ec57
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/objectcontacttools.hxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_OBJECTCONTACTTOOLS_HXX
+#define _SDR_CONTACT_OBJECTCONTACTTOOLS_HXX
+
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class OutputDevice;
+
+namespace drawinglayer { namespace processor2d {
+ class BaseProcessor2D;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ // create a mating VCL-Provessor for given OutputDevice. This includes
+ // looking for MetaFile-recording. The returned renderer changes owner,
+ // deletion is duty of the caller
+ drawinglayer::processor2d::BaseProcessor2D* createBaseProcessor2DFromOutputDevice(
+ OutputDevice& rTargetOutDev,
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation2D);
+
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_OBJECTCONTACTTOOLS_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewcontact.hxx b/svx/inc/svx/sdr/contact/viewcontact.hxx
new file mode 100644
index 000000000000..f4675f2728fc
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewcontact.hxx
@@ -0,0 +1,172 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWCONTACT_HXX
+#define _SDR_CONTACT_VIEWCONTACT_HXX
+
+#include <sal/types.h>
+#include <tools/gen.hxx>
+#include "svx/svxdllapi.h"
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SetOfByte;
+class SdrPage;
+class SdrObject;
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ObjectContact;
+ class ViewObjectContact;
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class SVX_DLLPUBLIC ViewContact
+ {
+ private:
+ // make ViewObjectContact a friend to exclusively allow it to use
+ // AddViewObjectContact/RemoveViewObjectContact
+ friend class ViewObjectContact;
+
+ // List of ViewObjectContacts. This contains all VOCs which were constructed
+ // with this VC. Since the VOCs remember a reference to this VC, this list needs
+ // to be kept and is used e.g. at destructor to destroy all VOCs.
+ // Registering and de-registering is done in the VOC constructors/destructors.
+ std::vector< ViewObjectContact* > maViewObjectContactVector;
+
+ // Primitive2DSequence of the ViewContact. This contains all necessary information
+ // for the graphical visualisation and needs to be supported by all VCs which
+ // can be visualized.
+ drawinglayer::primitive2d::Primitive2DSequence mxViewIndependentPrimitive2DSequence;
+
+ // A new ViewObjectContact was created and shall be remembered.
+ void AddViewObjectContact(ViewObjectContact& rVOContact);
+
+ // A ViewObjectContact was deleted and shall be forgotten.
+ void RemoveViewObjectContact(ViewObjectContact& rVOContact);
+
+ // internal tooling to delete VOCs
+ void deleteAllVOCs();
+
+ protected:
+ // Interface to allow derivates to travel over the registered VOC's
+ sal_uInt32 getViewObjectContactCount() const { return maViewObjectContactVector.size(); }
+ ViewObjectContact* getViewObjectContact(sal_uInt32 a) const { return maViewObjectContactVector[a]; }
+
+ // Create a Object-Specific ViewObjectContact, set ViewContact and
+ // ObjectContact. Always needs to return something. Default is to create
+ // a standard ViewObjectContact containing the given ObjectContact and *this
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
+
+ // This method is responsible for creating the graphical visualisation data derived ONLY from
+ // the model data. It will be stored/buffered in mxViewIndependentPrimitive2DSequence. The default implementation
+ // creates a yellow replacement rectangle (1000, 1000, 5000, 3000) to visualize missing
+ // implementations. All implementations have to provide basic geometry here, this is the central
+ // visualisation method and will also be used for BoundRect computations in the long run.
+ // This means it's always an error when the default implementation is called and thus gets
+ // asserted there
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+
+ // method for flushing View Independent Primitive2DSequence for VOC implementations
+ void flushViewIndependentPrimitive2DSequence() { mxViewIndependentPrimitive2DSequence.realloc(0); }
+
+ // basic constructor. Since this is a base class only, it shall
+ // never be called directly
+ ViewContact();
+
+ // Methods to react on start getting viewed or stop getting
+ // viewed. This info is derived from the count of members of
+ // registered ViewObjectContacts. Default does nothing.
+ virtual void StartGettingViewed();
+ virtual void StopGettingViewed();
+
+ public:
+ // basic destructor with needed cleanups
+ virtual ~ViewContact();
+
+ // get a Object-specific ViewObjectContact for a specific
+ // ObjectContact (->View). Always needs to return something.
+ ViewObjectContact& GetViewObjectContact(ObjectContact& rObjectContact);
+
+ // Test if this ViewContact has ViewObjectContacts at all. This can
+ // be used to test if this ViewContact is visualized ATM or not
+ bool HasViewObjectContacts(bool bExcludePreviews = false) const;
+
+ // Check if this primitive is animated in any OC (View) which means it has
+ // generated a PrimitiveAnimation in it's VOC
+ bool isAnimatedInAnyViewObjectContact() const;
+
+ // Access to possible sub-hierarchy and parent. GetObjectCount() default is 0L
+ // and GetViewContact default pops up an assert since it's an error if
+ // GetObjectCount has a result != 0 and it's not overloaded.
+ virtual sal_uInt32 GetObjectCount() const;
+ virtual ViewContact& GetViewContact(sal_uInt32 nIndex) const;
+ virtual ViewContact* GetParentContact() const;
+
+ // React on insertion of a child into DRawHierarchy starting
+ // from this object
+ void ActionChildInserted(ViewContact& rChild);
+
+ // React on changes of the object of this ViewContact
+ virtual void ActionChanged();
+
+ // access to SdrObject and/or SdrPage. May return 0L like the default
+ // implementations do. Needs to be overloaded as needed.
+ virtual SdrObject* TryToGetSdrObject() const;
+ virtual SdrPage* TryToGetSdrPage() const;
+
+ // access to the local primitive. This will ensure that the primitive is
+ // current in comparing the local one with a fresh created incarnation
+ drawinglayer::primitive2d::Primitive2DSequence getViewIndependentPrimitive2DSequence() const;
+
+ // add Gluepoints (if available)
+ virtual drawinglayer::primitive2d::Primitive2DSequence createGluePointPrimitive2DSequence() const;
+
+ // delete all existing VOCs including DrawHierarchy which will invalidate all
+ // visualisations, too. Used mostly at object removal from DrawHierarchy to
+ // delete all existing VOCs by purpose, but can also be used for other purposes.
+ // It is always possible to delete the VOCs, these are re-created on demand
+ void flushViewObjectContacts(bool bWithHierarchy = true);
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWCONTACT_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewcontactofe3d.hxx b/svx/inc/svx/sdr/contact/viewcontactofe3d.hxx
new file mode 100644
index 000000000000..b8e30b320a79
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewcontactofe3d.hxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFE3D_HXX
+#define _SDR_CONTACT_VIEWCONTACTOFE3D_HXX
+
+#include <svx/sdr/contact/viewcontactofsdrobj.hxx>
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+namespace sdr { namespace contact {
+ class ViewContactOfE3dScene;
+}}
+
+namespace drawinglayer { namespace attribute {
+ class SdrLineAttribute;
+}}
+
+namespace basegfx {
+ class BColor;
+ class B3DHomMatrix;
+}
+
+class E3dObject;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfE3d : public ViewContactOfSdrObj
+ {
+ protected:
+ // Create a Object-Specific ViewObjectContact, set ViewContact and
+ // ObjectContact. Always needs to return something.
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
+
+ public:
+ // basic constructor, used from E3dObject.
+ ViewContactOfE3d(E3dObject& rObj);
+ virtual ~ViewContactOfE3d();
+
+ // access to E3dObject
+ E3dObject& GetE3dObject() const
+ {
+ return (E3dObject&)GetSdrObject();
+ }
+
+ // public helpers
+ drawinglayer::primitive2d::Primitive2DSequence impCreateWithGivenPrimitive3DSequence(
+ const drawinglayer::primitive3d::Primitive3DSequence& rxContent3D) const;
+
+ //////////////////////////////////////////////////////////////////////////////
+ // primitive stuff
+
+ protected:
+ // Primitive3DSequence of the ViewContact. This contains all necessary information
+ // for the graphical visualisation and needs to be supported by all 3D VCs which
+ // can be visualized. It does NOT contain the object transformation to be able to
+ // buffer for all possible usages
+ drawinglayer::primitive3d::Primitive3DSequence mxViewIndependentPrimitive3DSequence;
+
+ // This method is responsible for creating the graphical visualisation data which is
+ // stored in mxViewIndependentPrimitive3DSequence, but without object transformation
+ virtual drawinglayer::primitive3d::Primitive3DSequence createViewIndependentPrimitive3DSequence() const = 0;
+
+ // This method is responsible for creating the graphical visualisation data derived ONLY from
+ // the model data. The default implementation will try to create a 3D to 2D embedding (will work
+ // when scene is known) which can then be used for 2D processing concerning ranges
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+
+ // helper to enable test-visualisation of invisible 3D obects
+ drawinglayer::attribute::SdrLineAttribute* impCreateFallbackLineAttribute(const basegfx::BColor& rBColor) const;
+
+ public:
+ // access to the local primitive without the object's local 3D transform. This is e.g. needed
+ // to get the not-yet transformed BoundVolume for e.g. interactions
+ drawinglayer::primitive3d::Primitive3DSequence getVIP3DSWithoutObjectTransform() const;
+
+ // access to the local primitive. This will ensure that the list is
+ // current in comparing the local list content with a fresh created incarnation. It will
+ // use getVIP3DSWithoutObjectTransform and embed to 3d transform primitive when object's
+ // local 3d transform is used
+ drawinglayer::primitive3d::Primitive3DSequence getViewIndependentPrimitive3DSequence() const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWCONTACTOFE3D_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewcontactofe3dcube.hxx b/svx/inc/svx/sdr/contact/viewcontactofe3dcube.hxx
new file mode 100644
index 000000000000..cccb51a4b8cc
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewcontactofe3dcube.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFE3DCUBE_HXX
+#define _SDR_CONTACT_VIEWCONTACTOFE3DCUBE_HXX
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFE3D_HXX
+#include <svx/sdr/contact/viewcontactofe3d.hxx>
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class E3dCubeObj;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfE3dCube : public ViewContactOfE3d
+ {
+ public:
+ // basic constructor, used from SdrObject.
+ ViewContactOfE3dCube(E3dCubeObj& rCubeObj);
+ virtual ~ViewContactOfE3dCube();
+
+ // access to SdrObject
+ E3dCubeObj& GetE3dCubeObj() const
+ {
+ return (E3dCubeObj&)GetE3dObject();
+ }
+
+ protected:
+ // This method is responsible for creating the graphical visualisation data which is
+ // stored in the local primitive list. Default creates a yellow replacement rectangle.
+ virtual drawinglayer::primitive3d::Primitive3DSequence createViewIndependentPrimitive3DSequence() const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWCONTACTOFE3DCUBE_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewcontactofe3dextrude.hxx b/svx/inc/svx/sdr/contact/viewcontactofe3dextrude.hxx
new file mode 100644
index 000000000000..4fa152af362d
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewcontactofe3dextrude.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFE3DEXTRUDE_HXX
+#define _SDR_CONTACT_VIEWCONTACTOFE3DEXTRUDE_HXX
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFE3D_HXX
+#include <svx/sdr/contact/viewcontactofe3d.hxx>
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class E3dExtrudeObj;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfE3dExtrude : public ViewContactOfE3d
+ {
+ public:
+ // basic constructor, used from SdrObject.
+ ViewContactOfE3dExtrude(E3dExtrudeObj& rExtrude);
+ virtual ~ViewContactOfE3dExtrude();
+
+ // access to SdrObject
+ E3dExtrudeObj& GetE3dExtrudeObj() const
+ {
+ return (E3dExtrudeObj&)GetE3dObject();
+ }
+
+ protected:
+ // This method is responsible for creating the graphical visualisation data which is
+ // stored in the local primitive list. Default creates a yellow replacement rectangle.
+ virtual drawinglayer::primitive3d::Primitive3DSequence createViewIndependentPrimitive3DSequence() const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWCONTACTOFE3DEXTRUDE_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewcontactofe3dlathe.hxx b/svx/inc/svx/sdr/contact/viewcontactofe3dlathe.hxx
new file mode 100644
index 000000000000..5c8502348b00
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewcontactofe3dlathe.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFE3DLATHE_HXX
+#define _SDR_CONTACT_VIEWCONTACTOFE3DLATHE_HXX
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFE3D_HXX
+#include <svx/sdr/contact/viewcontactofe3d.hxx>
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class E3dLatheObj;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfE3dLathe : public ViewContactOfE3d
+ {
+ public:
+ // basic constructor, used from SdrObject.
+ ViewContactOfE3dLathe(E3dLatheObj& rLathe);
+ virtual ~ViewContactOfE3dLathe();
+
+ // access to SdrObject
+ E3dLatheObj& GetE3dLatheObj() const
+ {
+ return (E3dLatheObj&)GetE3dObject();
+ }
+
+ protected:
+ // This method is responsible for creating the graphical visualisation data which is
+ // stored in the local primitive list. Default creates a yellow replacement rectangle.
+ virtual drawinglayer::primitive3d::Primitive3DSequence createViewIndependentPrimitive3DSequence() const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWCONTACTOFE3DLATHE_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewcontactofe3dpolygon.hxx b/svx/inc/svx/sdr/contact/viewcontactofe3dpolygon.hxx
new file mode 100644
index 000000000000..f681655888aa
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewcontactofe3dpolygon.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFE3DPOLYGON_HXX
+#define _SDR_CONTACT_VIEWCONTACTOFE3DPOLYGON_HXX
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFE3D_HXX
+#include <svx/sdr/contact/viewcontactofe3d.hxx>
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class E3dPolygonObj;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfE3dPolygon : public ViewContactOfE3d
+ {
+ public:
+ // basic constructor, used from SdrObject.
+ ViewContactOfE3dPolygon(E3dPolygonObj& rPolygon);
+ virtual ~ViewContactOfE3dPolygon();
+
+ // access to SdrObject
+ E3dPolygonObj& GetE3dPolygonObj() const
+ {
+ return (E3dPolygonObj&)GetE3dObject();
+ }
+
+ protected:
+ // This method is responsible for creating the graphical visualisation data which is
+ // stored in the local primitive list. Default creates a yellow replacement rectangle.
+ virtual drawinglayer::primitive3d::Primitive3DSequence createViewIndependentPrimitive3DSequence() const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWCONTACTOFE3DPOLYGON_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx b/svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx
new file mode 100644
index 000000000000..0b2efdc3d313
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFE3DSCENE_HXX
+#define _SDR_CONTACT_VIEWCONTACTOFE3DSCENE_HXX
+
+#include <svx/sdr/contact/viewcontactofsdrobj.hxx>
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+#include <drawinglayer/attribute/sdrsceneattribute3d.hxx>
+#include <drawinglayer/attribute/sdrlightingattribute3d.hxx>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class E3dScene;
+
+namespace basegfx {
+ class B3DRange;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class SVX_DLLPUBLIC ViewContactOfE3dScene : public ViewContactOfSdrObj
+ {
+ protected:
+ // Create a Object-Specific ViewObjectContact, set ViewContact and
+ // ObjectContact. Always needs to return something. Default is to create
+ // a standard ViewObjectContact containing the given ObjectContact and *this
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
+
+ public:
+ // basic constructor, used from SdrObject.
+ ViewContactOfE3dScene(E3dScene& rScene);
+
+ // access to SdrObject
+ E3dScene& GetE3dScene() const
+ {
+ return (E3dScene&)GetSdrObject();
+ }
+
+ // React on changes of the object of this ViewContact
+ virtual void ActionChanged();
+
+ // access to ViewInformation3D and ObjectTransformation
+ const drawinglayer::geometry::ViewInformation3D& getViewInformation3D(const ::basegfx::B3DRange& rContentRange) const;
+ const drawinglayer::geometry::ViewInformation3D& getViewInformation3D() const;
+ const basegfx::B2DHomMatrix& getObjectTransformation() const;
+
+ // attribute providers
+ const drawinglayer::attribute::SdrSceneAttribute& getSdrSceneAttribute() const;
+ const drawinglayer::attribute::SdrLightingAttribute& getSdrLightingAttribute() const;
+
+ // scene primitive creators. If pLayerVisibility is given, a visibility test with the LayerID and the
+ // given SetOfByte is done.
+ drawinglayer::primitive2d::Primitive2DSequence createScenePrimitive2DSequence(const SetOfByte* pLayerVisibility) const;
+
+ // helpers to get the sequence of all contained 3D primitives and it's range,
+ // regardless of layer or visibility constraints and using a neutral ViewInformation3D
+ drawinglayer::primitive3d::Primitive3DSequence getAllPrimitive3DSequence() const;
+ basegfx::B3DRange getAllContentRange3D() const;
+
+ protected:
+ // the 3d transformation stack
+ drawinglayer::geometry::ViewInformation3D maViewInformation3D;
+
+ // the object transformation
+ basegfx::B2DHomMatrix maObjectTransformation;
+
+ // attributes
+ drawinglayer::attribute::SdrSceneAttribute maSdrSceneAttribute;
+ drawinglayer::attribute::SdrLightingAttribute maSdrLightingAttribute;
+
+ // create methods for ViewInformation3D and ObjectTransformation
+ void createViewInformation3D(const ::basegfx::B3DRange& rContentRange);
+ void createObjectTransformation();
+
+ // attribute creators
+ void createSdrSceneAttribute();
+ void createSdrLightingAttribute();
+
+ // This method is responsible for creating the graphical visualisation data
+ // ONLY based on model data
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWCONTACTOFE3DSCENE_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewcontactofe3dsphere.hxx b/svx/inc/svx/sdr/contact/viewcontactofe3dsphere.hxx
new file mode 100644
index 000000000000..68a64e888d91
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewcontactofe3dsphere.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFE3DSPHERE_HXX
+#define _SDR_CONTACT_VIEWCONTACTOFE3DSPHERE_HXX
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFE3D_HXX
+#include <svx/sdr/contact/viewcontactofe3d.hxx>
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class E3dSphereObj;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfE3dSphere : public ViewContactOfE3d
+ {
+ public:
+ // basic constructor, used from SdrObject.
+ ViewContactOfE3dSphere(E3dSphereObj& rSphere);
+ virtual ~ViewContactOfE3dSphere();
+
+ // access to SdrObject
+ E3dSphereObj& GetE3dSphereObj() const
+ {
+ return (E3dSphereObj&)GetE3dObject();
+ }
+
+ protected:
+ // This method is responsible for creating the graphical visualisation data which is
+ // stored in the local primitive list. Default creates a yellow replacement rectangle.
+ virtual drawinglayer::primitive3d::Primitive3DSequence createViewIndependentPrimitive3DSequence() const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWCONTACTOFE3DSPHERE_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewcontactofgraphic.hxx b/svx/inc/svx/sdr/contact/viewcontactofgraphic.hxx
new file mode 100644
index 000000000000..b207c3e7fbde
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewcontactofgraphic.hxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFGRAPHIC_HXX
+#define _SDR_CONTACT_VIEWCONTACTOFGRAPHIC_HXX
+
+#include <sal/types.h>
+#include <svx/sdr/contact/viewcontactoftextobj.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SdrGrafObj;
+namespace drawinglayer { namespace attribute { class SdrLineFillShadowTextAttribute; }}
+class GraphicAttr;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ 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.
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
+
+ public:
+ // access to SdrObject
+ SdrGrafObj& GetGrafObject() const
+ {
+ return ((SdrGrafObj&)GetSdrObject());
+ }
+
+ // basic constructor, destructor
+ 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
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWCONTACTOFGRAPHIC_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewcontactofgroup.hxx b/svx/inc/svx/sdr/contact/viewcontactofgroup.hxx
new file mode 100644
index 000000000000..189f69a7311b
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewcontactofgroup.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFGROUP_HXX
+#define _SDR_CONTACT_VIEWCONTACTOFGROUP_HXX
+
+#include <svx/sdr/contact/viewcontactofsdrobj.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SdrObjGroup;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfGroup : public ViewContactOfSdrObj
+ {
+ protected:
+ // Create a Object-Specific ViewObjectContact, set ViewContact and
+ // ObjectContact. Always needs to return something. Default is to create
+ // a standard ViewObjectContact containing the given ObjectContact and *this
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
+
+ // internal access to SdrObject
+ SdrObjGroup& GetSdrObjGroup() const
+ {
+ return (SdrObjGroup&)GetSdrObject();
+ }
+
+ public:
+ // basic constructor, used from SdrObject.
+ ViewContactOfGroup(SdrObjGroup& rGroup);
+ virtual ~ViewContactOfGroup();
+
+ protected:
+ // This method is responsible for creating the graphical visualisation data
+ // ONLY based on model data
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWCONTACTOFGROUP_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewcontactofmasterpagedescriptor.hxx b/svx/inc/svx/sdr/contact/viewcontactofmasterpagedescriptor.hxx
new file mode 100644
index 000000000000..c408f1373e4c
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewcontactofmasterpagedescriptor.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFMASTERPAGEDESCRIPTOR_HXX
+#define _SDR_CONTACT_VIEWCONTACTOFMASTERPAGEDESCRIPTOR_HXX
+
+#include <sal/types.h>
+#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/sdrmasterpagedescriptor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+class SfxItemSet;
+class Bitmap;
+class MapMode;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfMasterPageDescriptor : public ViewContact
+ {
+ protected:
+ // the owner of this ViewContact. Set from constructor and not
+ // to be changed in any way.
+ sdr::MasterPageDescriptor& mrMasterPageDescriptor;
+
+ // Create a Object-Specific ViewObjectContact
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
+
+ // This method is responsible for creating the graphical visualisation data
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+
+ public:
+ // basic constructor
+ ViewContactOfMasterPageDescriptor(sdr::MasterPageDescriptor& rDescriptor);
+
+ // The destructor.
+ virtual ~ViewContactOfMasterPageDescriptor();
+
+ // access to MasterPageDescriptor
+ sdr::MasterPageDescriptor& GetMasterPageDescriptor() const
+ {
+ return mrMasterPageDescriptor;
+ }
+
+ // Access to possible sub-hierarchy and parent
+ virtual sal_uInt32 GetObjectCount() const;
+ virtual ViewContact& GetViewContact(sal_uInt32 nIndex) const;
+ virtual ViewContact* GetParentContact() const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWCONTACTOFMASTERPAGEDESCRIPTOR_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewcontactofpageobj.hxx b/svx/inc/svx/sdr/contact/viewcontactofpageobj.hxx
new file mode 100644
index 000000000000..54d188d198cc
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewcontactofpageobj.hxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFPAGEOBJ_HXX
+#define _SDR_CONTACT_VIEWCONTACTOFPAGEOBJ_HXX
+
+#include <svx/sdr/contact/viewcontactofsdrobj.hxx>
+#include "svx/svxdllapi.h"
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SdrPageObj;
+class SdrPage;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class SVX_DLLPUBLIC ViewContactOfPageObj : public ViewContactOfSdrObj
+ {
+ protected:
+ // Create a Object-Specific ViewObjectContact, set ViewContact and
+ // ObjectContact. Always needs to return something.
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
+
+ // create graphical visualisation data
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+
+ // Access to referenced page
+ const SdrPage* GetReferencedPage() const;
+
+ public:
+ // basic constructor, used from SdrObject.
+ ViewContactOfPageObj(SdrPageObj& rPageObj);
+ virtual ~ViewContactOfPageObj();
+
+ // #WIP# React on changes of the object of this ViewContact
+ virtual void ActionChanged();
+
+ // access to SdrObject
+ SdrPageObj& GetPageObj() const
+ {
+ return (SdrPageObj&)GetSdrObject();
+ }
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWCONTACTOFPAGEOBJ_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewcontactofsdrcaptionobj.hxx b/svx/inc/svx/sdr/contact/viewcontactofsdrcaptionobj.hxx
new file mode 100644
index 000000000000..5171ce75204f
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewcontactofsdrcaptionobj.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFSDRCAPTIONOBJ_HXX
+#define _SDR_CONTACT_VIEWCONTACTOFSDRCAPTIONOBJ_HXX
+
+#include <svx/sdr/contact/viewcontactofsdrrectobj.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SdrCaptionObj;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfSdrCaptionObj : public ViewContactOfSdrRectObj
+ {
+ protected:
+ // internal access to SdrCaptionObj
+ SdrCaptionObj& GetCaptionObj() const
+ {
+ return (SdrCaptionObj&)GetSdrObject();
+ }
+
+ public:
+ // basic constructor, used from SdrObject.
+ ViewContactOfSdrCaptionObj(SdrCaptionObj& rCaptionObj);
+ virtual ~ViewContactOfSdrCaptionObj();
+
+ protected:
+ // This method is responsible for creating the graphical visualisation data
+ // ONLY based on model data
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWCONTACTOFSDRCAPTIONOBJ_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewcontactofsdrcircobj.hxx b/svx/inc/svx/sdr/contact/viewcontactofsdrcircobj.hxx
new file mode 100644
index 000000000000..3d0ed6b56a59
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewcontactofsdrcircobj.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFSDRCIRCOBJ_HXX
+#define _SDR_CONTACT_VIEWCONTACTOFSDRCIRCOBJ_HXX
+
+#include <svx/sdr/contact/viewcontactofsdrrectobj.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SdrCircObj;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfSdrCircObj : public ViewContactOfSdrRectObj
+ {
+ protected:
+ // internal access to SdrCircObj
+ SdrCircObj& GetCircObj() const
+ {
+ return (SdrCircObj&)GetSdrObject();
+ }
+
+ public:
+ // basic constructor, used from SdrObject.
+ ViewContactOfSdrCircObj(SdrCircObj& rCircObj);
+ virtual ~ViewContactOfSdrCircObj();
+
+ protected:
+ // This method is responsible for creating the graphical visualisation data
+ // ONLY based on model data
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWCONTACTOFSDRCIRCOBJ_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewcontactofsdredgeobj.hxx b/svx/inc/svx/sdr/contact/viewcontactofsdredgeobj.hxx
new file mode 100644
index 000000000000..97ccf16c8c0a
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewcontactofsdredgeobj.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFSDREDGEOBJ_HXX
+#define _SDR_CONTACT_VIEWCONTACTOFSDREDGEOBJ_HXX
+
+#include <svx/sdr/contact/viewcontactoftextobj.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SdrEdgeObj;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfSdrEdgeObj : public ViewContactOfTextObj
+ {
+ protected:
+ // internal access to SdrEdgeObj
+ SdrEdgeObj& GetEdgeObj() const
+ {
+ return (SdrEdgeObj&)GetSdrObject();
+ }
+
+ public:
+ // basic constructor, used from SdrObject.
+ ViewContactOfSdrEdgeObj(SdrEdgeObj& rEdgeObj);
+ virtual ~ViewContactOfSdrEdgeObj();
+
+ protected:
+ // This method is responsible for creating the graphical visualisation data
+ // ONLY based on model data
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWCONTACTOFSDREDGEOBJ_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewcontactofsdrmeasureobj.hxx b/svx/inc/svx/sdr/contact/viewcontactofsdrmeasureobj.hxx
new file mode 100644
index 000000000000..97f258b2cda5
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewcontactofsdrmeasureobj.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFSDRMEASUREOBJ_HXX
+#define _SDR_CONTACT_VIEWCONTACTOFSDRMEASUREOBJ_HXX
+
+#include <svx/sdr/contact/viewcontactoftextobj.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SdrMeasureObj;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfSdrMeasureObj : public ViewContactOfTextObj
+ {
+ protected:
+ // internal access to SdrMeasureObj
+ SdrMeasureObj& GetMeasureObj() const
+ {
+ return (SdrMeasureObj&)GetSdrObject();
+ }
+
+ public:
+ // basic constructor, used from SdrObject.
+ ViewContactOfSdrMeasureObj(SdrMeasureObj& rMeasureObj);
+ virtual ~ViewContactOfSdrMeasureObj();
+
+ protected:
+ // This method is responsible for creating the graphical visualisation data
+ // ONLY based on model data
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWCONTACTOFSDRMEASUREOBJ_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewcontactofsdrmediaobj.hxx b/svx/inc/svx/sdr/contact/viewcontactofsdrmediaobj.hxx
new file mode 100644
index 000000000000..975ce214f3e8
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewcontactofsdrmediaobj.hxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFSDRMEDIAOBJ_HXX
+#define _SDR_CONTACT_VIEWCONTACTOFSDRMEDIAOBJ_HXX
+
+#include <svx/sdr/contact/viewcontactofsdrobj.hxx>
+#include "svx/svxdllapi.h"
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SdrMediaObj;
+namespace avmedia { class MediaItem; }
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class SVX_DLLPUBLIC ViewContactOfSdrMediaObj : public ViewContactOfSdrObj
+ {
+ friend class ViewObjectContactOfSdrMediaObj;
+
+ public:
+
+ // basic constructor, used from SdrObject.
+ ViewContactOfSdrMediaObj( SdrMediaObj& rMediaObj );
+ virtual ~ViewContactOfSdrMediaObj();
+
+ public:
+
+ // access to SdrMediaObj
+ SdrMediaObj& GetSdrMediaObj() const
+ {
+ return (SdrMediaObj&)GetSdrObject();
+ }
+
+ bool hasPreferredSize() const;
+ Size getPreferredSize() const;
+
+ void updateMediaItem( ::avmedia::MediaItem& rItem ) const;
+ void executeMediaItem( const ::avmedia::MediaItem& rItem );
+
+ protected:
+
+ // Create a Object-Specific ViewObjectContact, set ViewContact and
+ // ObjectContact. Always needs to return something.
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
+
+ // get notified if some properties have changed
+ virtual void mediaPropertiesChanged( const ::avmedia::MediaItem& rNewState );
+
+ protected:
+ // This method is responsible for creating the graphical visualisation data
+ // ONLY based on model data
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWCONTACTOFSDRMEDIAOBJ_HXX
diff --git a/svx/inc/svx/sdr/contact/viewcontactofsdrobj.hxx b/svx/inc/svx/sdr/contact/viewcontactofsdrobj.hxx
new file mode 100644
index 000000000000..c9ac57389799
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewcontactofsdrobj.hxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFSDROBJ_HXX
+#define _SDR_CONTACT_VIEWCONTACTOFSDROBJ_HXX
+
+#include <sal/types.h>
+#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/sdtakitm.hxx>
+#include "svx/svxdllapi.h"
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SdrObject;
+class GeoStat;
+class Bitmap;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class SVX_DLLPUBLIC ViewContactOfSdrObj : public ViewContact
+ {
+ protected:
+ // the owner of this ViewContact. Set from constructor and not
+ // to be changed in any way.
+ SdrObject& mrObject;
+
+ // Remember AnimationKind of object. Used to find out if that kind
+ // has changed in ActionChanged()
+ SdrTextAniKind meRememberedAnimationKind;
+
+ // Create a Object-Specific ViewObjectContact, set ViewContact and
+ // ObjectContact. Always needs to return something.
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
+
+ public:
+ // access to SdrObject
+ SdrObject& GetSdrObject() const
+ {
+ return mrObject;
+ }
+
+ // basic constructor, used from SdrObject.
+ ViewContactOfSdrObj(SdrObject& rObj);
+ virtual ~ViewContactOfSdrObj();
+
+ // Access to possible sub-hierarchy
+ virtual sal_uInt32 GetObjectCount() const;
+ virtual ViewContact& GetViewContact(sal_uInt32 nIndex) const;
+ virtual ViewContact* GetParentContact() const;
+
+ // React on changes of the object of this ViewContact
+ virtual void ActionChanged();
+
+ // overload for acessing the SdrObject
+ virtual SdrObject* TryToGetSdrObject() const;
+
+ //////////////////////////////////////////////////////////////////////////////
+ // primitive stuff
+
+ // add Gluepoints (if available)
+ virtual drawinglayer::primitive2d::Primitive2DSequence createGluePointPrimitive2DSequence() const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWCONTACTOFSDROBJ_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewcontactofsdrobjcustomshape.hxx b/svx/inc/svx/sdr/contact/viewcontactofsdrobjcustomshape.hxx
new file mode 100644
index 000000000000..b58356283e57
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewcontactofsdrobjcustomshape.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFSDROBJCUSTOMSHAPE_HXX
+#define _SDR_CONTACT_VIEWCONTACTOFSDROBJCUSTOMSHAPE_HXX
+
+#include <svx/sdr/contact/viewcontactoftextobj.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SdrObjCustomShape;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfSdrObjCustomShape : public ViewContactOfTextObj
+ {
+ protected:
+ // internal access to SdrObjCustomShape
+ SdrObjCustomShape& GetCustomShapeObj() const
+ {
+ return (SdrObjCustomShape&)GetSdrObject();
+ }
+
+ // #i101684# internal tooling
+ basegfx::B2DRange getCorrectedTextBoundRect() const;
+
+ public:
+ // basic constructor, used from SdrObject.
+ ViewContactOfSdrObjCustomShape(SdrObjCustomShape& rCustomShape);
+ virtual ~ViewContactOfSdrObjCustomShape();
+
+ protected:
+ // This method is responsible for creating the graphical visualisation data
+ // ONLY based on model data
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWCONTACTOFSDROBJCUSTOMSHAPE_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewcontactofsdrole2obj.hxx b/svx/inc/svx/sdr/contact/viewcontactofsdrole2obj.hxx
new file mode 100644
index 000000000000..76ff4f8e5632
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewcontactofsdrole2obj.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFSDROLE2OBJ_HXX
+#define _SDR_CONTACT_VIEWCONTACTOFSDROLE2OBJ_HXX
+
+#include <svx/sdr/contact/viewcontactofsdrrectobj.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SdrOle2Obj;
+class Graphic;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfSdrOle2Obj : public ViewContactOfSdrRectObj
+ {
+ protected:
+ // Create a Object-Specific ViewObjectContact, set ViewContact and
+ // ObjectContact. Always needs to return something.
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
+
+ public:
+ // access to SdrOle2Obj
+ SdrOle2Obj& GetOle2Obj() const
+ {
+ return (SdrOle2Obj&)GetSdrObject();
+ }
+
+ // basic constructor, used from SdrObject.
+ ViewContactOfSdrOle2Obj(SdrOle2Obj& rOle2Obj);
+ virtual ~ViewContactOfSdrOle2Obj();
+
+ // helper for creating a OLE sequence for this object. It takes care od attributes, needed
+ // scaling (e.g. for EmptyPresObj's), the correct graphic and other stuff. It is used from
+ // createViewIndependentPrimitive2DSequence with false, and with evtl. HighContrast true
+ // from the VOC which knows that
+ drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequenceWithParameters(bool bHighContrast) const;
+
+ protected:
+ // This method is responsible for creating the graphical visualisation data
+ // ONLY based on model data, just wraps to call createPrimitive2DSequenceWithParameters(false)
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWCONTACTOFSDROLE2OBJ_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewcontactofsdrpage.hxx b/svx/inc/svx/sdr/contact/viewcontactofsdrpage.hxx
new file mode 100644
index 000000000000..54ddb9c299b3
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewcontactofsdrpage.hxx
@@ -0,0 +1,311 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFSDRPAGE_HXX
+#define _SDR_CONTACT_VIEWCONTACTOFSDRPAGE_HXX
+
+#include <sal/types.h>
+#include <svx/sdr/contact/viewcontact.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+class SdrPage;
+
+namespace sdr { namespace contact {
+ class ViewContactOfSdrPage;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfPageSubObject : public ViewContact
+ {
+ protected:
+ ViewContactOfSdrPage& mrParentViewContactOfSdrPage;
+
+ public:
+ ViewContactOfPageSubObject(ViewContactOfSdrPage& rParentViewContactOfSdrPage);
+ virtual ~ViewContactOfPageSubObject();
+
+ virtual ViewContact* GetParentContact() const;
+ const SdrPage& getPage() const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfPageBackground : public ViewContactOfPageSubObject
+ {
+ protected:
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+
+ public:
+ ViewContactOfPageBackground(ViewContactOfSdrPage& rParentViewContactOfSdrPage);
+ virtual ~ViewContactOfPageBackground();
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfPageShadow : public ViewContactOfPageSubObject
+ {
+ protected:
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+
+ public:
+ ViewContactOfPageShadow(ViewContactOfSdrPage& rParentViewContactOfSdrPage);
+ virtual ~ViewContactOfPageShadow();
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfPageFill : public ViewContactOfPageSubObject
+ {
+ protected:
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+
+ public:
+ ViewContactOfPageFill(ViewContactOfSdrPage& rParentViewContactOfSdrPage);
+ virtual ~ViewContactOfPageFill();
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfMasterPage : public ViewContactOfPageSubObject
+ {
+ protected:
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+
+ public:
+ ViewContactOfMasterPage(ViewContactOfSdrPage& rParentViewContactOfSdrPage);
+ virtual ~ViewContactOfMasterPage();
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfOuterPageBorder : public ViewContactOfPageSubObject
+ {
+ protected:
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+
+ public:
+ ViewContactOfOuterPageBorder(ViewContactOfSdrPage& rParentViewContactOfSdrPage);
+ virtual ~ViewContactOfOuterPageBorder();
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfInnerPageBorder : public ViewContactOfPageSubObject
+ {
+ protected:
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+
+ public:
+ ViewContactOfInnerPageBorder(ViewContactOfSdrPage& rParentViewContactOfSdrPage);
+ virtual ~ViewContactOfInnerPageBorder();
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfPageHierarchy : public ViewContactOfPageSubObject
+ {
+ protected:
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+
+ public:
+ ViewContactOfPageHierarchy(ViewContactOfSdrPage& rParentViewContactOfSdrPage);
+ virtual ~ViewContactOfPageHierarchy();
+
+ virtual sal_uInt32 GetObjectCount() const;
+ virtual ViewContact& GetViewContact(sal_uInt32 nIndex) const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfGrid : public ViewContactOfPageSubObject
+ {
+ protected:
+ // bitfield
+ unsigned mbFront : 1;
+
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+
+ public:
+ ViewContactOfGrid(ViewContactOfSdrPage& rParentViewContactOfSdrPage, bool bFront);
+ virtual ~ViewContactOfGrid();
+
+ bool getFront() const { return mbFront; }
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfHelplines : public ViewContactOfPageSubObject
+ {
+ protected:
+ // bitfield
+ unsigned mbFront : 1;
+
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+
+ public:
+ ViewContactOfHelplines(ViewContactOfSdrPage& rParentViewContactOfSdrPage, bool bFront);
+ virtual ~ViewContactOfHelplines();
+
+ bool getFront() const { return mbFront; }
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfSdrPage : public ViewContact
+ {
+ protected:
+ // the owner of this ViewContact. Set from constructor and not
+ // to be changed in any way.
+ SdrPage& mrPage;
+
+ // helper viewContacts to build a clear paint hierarchy
+ ViewContactOfPageBackground maViewContactOfPageBackground;
+ ViewContactOfPageShadow maViewContactOfPageShadow;
+ ViewContactOfPageFill maViewContactOfPageFill;
+ ViewContactOfMasterPage maViewContactOfMasterPage;
+ ViewContactOfOuterPageBorder maViewContactOfOuterPageBorder;
+ ViewContactOfInnerPageBorder maViewContactOfInnerPageBorder;
+ ViewContactOfGrid maViewContactOfGridBack;
+ ViewContactOfHelplines maViewContactOfHelplinesBack;
+ ViewContactOfPageHierarchy maViewContactOfPageHierarchy;
+ ViewContactOfGrid maViewContactOfGridFront;
+ ViewContactOfHelplines maViewContactOfHelplinesFront;
+
+ // Create a Object-Specific ViewObjectContact, set ViewContact and
+ // ObjectContact. Always needs to return something. Default is to create
+ // a standard ViewObjectContact containing the given ObjectContact and *this
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
+
+ public:
+ // access to SdrObject
+ SdrPage& GetSdrPage() const
+ {
+ return mrPage;
+ }
+
+ // basic constructor, used from SdrPage.
+ ViewContactOfSdrPage(SdrPage& rObj);
+ virtual ~ViewContactOfSdrPage();
+
+ // Access to possible sub-hierarchy
+ virtual sal_uInt32 GetObjectCount() const;
+ virtual ViewContact& GetViewContact(sal_uInt32 nIndex) const;
+
+ // React on changes of the object of this ViewContact
+ virtual void ActionChanged();
+
+ // overload for acessing the SdrPage
+ virtual SdrPage* TryToGetSdrPage() const;
+
+ protected:
+ // This method is responsible for creating the graphical visualisation data
+ // ONLY based on model data
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWCONTACTOFSDRPAGE_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewcontactofsdrpathobj.hxx b/svx/inc/svx/sdr/contact/viewcontactofsdrpathobj.hxx
new file mode 100644
index 000000000000..1d2127a3ab80
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewcontactofsdrpathobj.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFSDRPATHOBJ_HXX
+#define _SDR_CONTACT_VIEWCONTACTOFSDRPATHOBJ_HXX
+
+#include <svx/sdr/contact/viewcontactoftextobj.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SdrPathObj;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfSdrPathObj : public ViewContactOfTextObj
+ {
+ protected:
+ // internal access to SdrPathObj
+ SdrPathObj& GetPathObj() const
+ {
+ return (SdrPathObj&)GetSdrObject();
+ }
+
+ public:
+ // basic constructor, used from SdrObject.
+ ViewContactOfSdrPathObj(SdrPathObj& rTextObj);
+ virtual ~ViewContactOfSdrPathObj();
+
+ protected:
+ // This method is responsible for creating the graphical visualisation data
+ // ONLY based on model data
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWCONTACTOFSDRPATHOBJ_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewcontactofsdrrectobj.hxx b/svx/inc/svx/sdr/contact/viewcontactofsdrrectobj.hxx
new file mode 100644
index 000000000000..dddedd4e9f5b
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewcontactofsdrrectobj.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFSDRRECTOBJ_HXX
+#define _SDR_CONTACT_VIEWCONTACTOFSDRRECTOBJ_HXX
+
+#include <svx/sdr/contact/viewcontactoftextobj.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SdrRectObj;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfSdrRectObj : public ViewContactOfTextObj
+ {
+ protected:
+ // internal access to SdrRectObj
+ SdrRectObj& GetRectObj() const
+ {
+ return (SdrRectObj&)GetSdrObject();
+ }
+
+ public:
+ // basic constructor, used from SdrObject.
+ ViewContactOfSdrRectObj(SdrRectObj& rTextObj);
+ virtual ~ViewContactOfSdrRectObj();
+
+ protected:
+ // This method is responsible for creating the graphical visualisation data
+ // ONLY based on model data
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWCONTACTOFSDRRECTOBJ_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewcontactoftextobj.hxx b/svx/inc/svx/sdr/contact/viewcontactoftextobj.hxx
new file mode 100644
index 000000000000..933199761f5a
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewcontactoftextobj.hxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFTEXTOBJ_HXX
+#define _SDR_CONTACT_VIEWCONTACTOFTEXTOBJ_HXX
+
+#include <svx/sdr/contact/viewcontactofsdrobj.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SdrTextObj;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContactOfTextObj : public ViewContactOfSdrObj
+ {
+ protected:
+ // internal access to SdrTextObj
+ SdrTextObj& GetTextObj() const
+ {
+ return (SdrTextObj&)GetSdrObject();
+ }
+
+ public:
+ // basic constructor, used from SdrObject.
+ ViewContactOfTextObj(SdrTextObj& rTextObj);
+ virtual ~ViewContactOfTextObj();
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWCONTACTOFTEXTOBJ_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewcontactofunocontrol.hxx b/svx/inc/svx/sdr/contact/viewcontactofunocontrol.hxx
new file mode 100644
index 000000000000..d0263ce60506
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewcontactofunocontrol.hxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_SDR_CONTACT_VIEWCONTACTOFUNOCONTROL_HXX
+#define SVX_SDR_CONTACT_VIEWCONTACTOFUNOCONTROL_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/uno/Reference.hxx>
+/** === end UNO includes === **/
+#include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx>
+#include <svx/svxdllapi.h>
+
+#include <memory>
+
+class OutputDevice;
+class Window;
+class SdrUnoObj;
+namespace com { namespace sun { namespace star {
+ namespace awt {
+ class XControl;
+ class XControlContainer;
+ }
+} } }
+
+//........................................................................
+namespace sdr { namespace contact {
+//........................................................................
+
+ //====================================================================
+ //= ViewContactOfUnoControl
+ //====================================================================
+ class ViewContactOfUnoControl_Impl;
+ class SVX_DLLPRIVATE ViewContactOfUnoControl : public ViewContactOfSdrObj
+ {
+ private:
+ ::std::auto_ptr< ViewContactOfUnoControl_Impl > m_pImpl;
+
+ public:
+ // access to SdrObject
+ SdrUnoObj& GetSdrUnoObj() const
+ {
+ return ((SdrUnoObj&)GetSdrObject());
+ }
+
+ ViewContactOfUnoControl( SdrUnoObj& _rUnoObject );
+ virtual ~ViewContactOfUnoControl();
+
+ /** access control to selected members
+ */
+ struct SdrUnoObjAccessControl { friend class ::SdrUnoObj; private: SdrUnoObjAccessControl() { } };
+
+ /** retrieves a temporary XControl instance, whose parent is the given window
+ @seealso SdrUnoObj::GetTemporaryControlForWindow
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >
+ getTemporaryControlForWindow( const Window& _rWindow, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& _inout_ControlContainer ) const;
+
+ protected:
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact( ObjectContact& _rObjectContact );
+
+ private:
+ ViewContactOfUnoControl(); // never implemented
+ ViewContactOfUnoControl( const ViewContactOfUnoControl& ); // never implemented
+ ViewContactOfUnoControl& operator=( const ViewContactOfUnoControl& ); // never implemented
+
+ protected:
+ // This method is responsible for creating the graphical visualisation data
+ // ONLY based on model data
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+ };
+
+//........................................................................
+} } // namespace sdr::contact
+//........................................................................
+
+#endif // SVX_SDR_CONTACT_VIEWCONTACTOFUNOCONTROL_HXX
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewcontactofvirtobj.hxx b/svx/inc/svx/sdr/contact/viewcontactofvirtobj.hxx
new file mode 100644
index 000000000000..7aef09535149
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewcontactofvirtobj.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFVIRTOBJ_HXX
+#define _SDR_CONTACT_VIEWCONTACTOFVIRTOBJ_HXX
+
+#include <svx/sdr/contact/viewcontactofsdrobj.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+class SdrVirtObj;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class SVX_DLLPUBLIC ViewContactOfVirtObj : public ViewContactOfSdrObj
+ {
+ protected:
+ // internal access to SdrObject. Iplementation in *.cxx to avoid
+ // including SdrVirtObj here.
+ SdrVirtObj& GetVirtObj() const;
+
+ public:
+ // basic constructor, used from SdrObject.
+ ViewContactOfVirtObj(SdrVirtObj& rObj);
+ virtual ~ViewContactOfVirtObj();
+
+ // Access to possible sub-hierarchy
+ virtual sal_uInt32 GetObjectCount() const;
+
+ protected:
+ // This method is responsible for creating the graphical visualisation data
+ // ONLY based on model data
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWCONTACTOFVIRTOBJ_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewobjectcontact.hxx b/svx/inc/svx/sdr/contact/viewobjectcontact.hxx
new file mode 100644
index 000000000000..3917caebef0e
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewobjectcontact.hxx
@@ -0,0 +1,157 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWOBJECTCONTACT_HXX
+#define _SDR_CONTACT_VIEWOBJECTCONTACT_HXX
+
+#include <sal/types.h>
+
+#include <vector>
+#include <tools/debug.hxx>
+#include <tools/gen.hxx>
+#include "svx/svxdllapi.h"
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class Region;
+
+namespace sdr { namespace contact {
+ class DisplayInfo;
+ class ObjectContact;
+ class ViewContact;
+ class ViewObjectContactRedirector;
+}}
+
+namespace sdr { namespace animation {
+ class PrimitiveAnimation;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class SVX_DLLPUBLIC ViewObjectContact
+ {
+ private:
+ // must-exist and constant contacts
+ ObjectContact& mrObjectContact;
+ ViewContact& mrViewContact;
+
+ // This range defines the object's BoundRect
+ basegfx::B2DRange maObjectRange;
+
+ // PrimitiveSequence of the ViewContact. This contains all necessary information
+ // for the graphical visualisation and needs to be supported by all VCs which
+ // can be visualized.
+ drawinglayer::primitive2d::Primitive2DSequence mxPrimitive2DSequence;
+
+ // the PrimitiveAnimation if Primitive2DSequence contains animations
+ sdr::animation::PrimitiveAnimation* mpPrimitiveAnimation;
+
+ // bitfield
+ // This bool gets set when the object gets invalidated by ActionChanged() and
+ // can be used from the OC to late-invalidates
+ unsigned mbLazyInvalidate : 1;
+
+ protected:
+ // make redirector a protected friend, it needs to call createPrimitives as default action
+ friend class ViewObjectContactRedirector;
+
+ // Called from getPrimitive2DSequence() when vector has changed. Evaluate object animation
+ // and setup accordingly
+ void checkForPrimitive2DAnimations();
+
+ // This method is responsible for creating the graphical visualisation data which is
+ // stored/cached in the local primitive. Default gets view-independent Primitive
+ // from the ViewContact using ViewContact::getViewIndependentPrimitive2DSequence(), takes care of
+ // visibility, handles glue and ghosted.
+ // This method will not handle included hierarchies and not check geometric visibility.
+ virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const;
+
+ // method for flushing Primitive2DSequence for VOC implementations
+ void flushPrimitive2DSequence() { mxPrimitive2DSequence.realloc(0); }
+
+ public:
+ // basic constructor.
+ ViewObjectContact(ObjectContact& rObjectContact, ViewContact& rViewContact);
+ virtual ~ViewObjectContact();
+
+ // access to ObjectContact
+ ObjectContact& GetObjectContact() const { return mrObjectContact; }
+
+ // access to ViewContact
+ ViewContact& GetViewContact() const { return mrViewContact; }
+
+ // get the oebject's size range
+ const basegfx::B2DRange& getObjectRange() const;
+
+ // A ViewObjectContact was deleted and shall be forgotten.
+ void RemoveViewObjectContact(ViewObjectContact& rVOContact);
+
+ // React on changes of the object of this ViewContact
+ virtual void ActionChanged();
+
+ // LazyInvalidate handling
+ void triggerLazyInvalidate();
+
+ // Check if this primitive is animated in any OC (View) which means it has
+ // generated a PrimitiveAnimation
+ bool isAnimated() const { return (0 != mpPrimitiveAnimation); }
+
+ // Take some action when new objects are inserted
+ virtual void ActionChildInserted(ViewContact& rChild);
+
+ // access to the local primitive. This will ensure that the local primitive is
+ // current in comparing the local one with a fresh created incarnation
+ // This method will not handle included hierarchies and not check visibility.
+ drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const;
+
+ // test this VOC for visibility concerning model-view stuff like e.g. Layer
+ virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const;
+
+ // test this VOC for ghosted mode
+ virtual bool isPrimitiveGhosted(const DisplayInfo& rDisplayInfo) const;
+
+ // process this primitive: Eventually also recursively travel an existing hierarchy,
+ // e.g. for group objects, scenes or pages. This method will test geometrical visibility.
+ virtual drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const;
+
+ // just process the sub-hierarchy, used as tooling from getPrimitive2DSequenceHierarchy
+ drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequenceSubHierarchy(DisplayInfo& rDisplayInfo) const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWOBJECTCONTACT_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofe3d.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofe3d.hxx
new file mode 100644
index 000000000000..9306f76a5371
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewobjectcontactofe3d.hxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWOBJECTCONTACTOFE3D_HXX
+#define _SDR_CONTACT_VIEWOBJECTCONTACTOFE3D_HXX
+
+#include <svx/sdr/contact/viewobjectcontactofsdrobj.hxx>
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+namespace sdr { namespace contact {
+ class ViewObjectContactOfE3dScene;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewObjectContactOfE3d : public ViewObjectContactOfSdrObj
+ {
+ protected:
+ // Primitive3D sequence of the ViewContact. This contains all necessary information
+ // for the graphical visualisation and needs to be supported by all VCs which
+ // can be visualized.
+ drawinglayer::primitive3d::Primitive3DSequence mxPrimitive3DSequence;
+
+ // This method is responsible for creating the graphical visualisation data which is
+ // stored/cached in the local primitive. Default gets view-independent Primitive3D
+ // from the ViewContact using ViewContact::getViewIndependentPrimitive3DSequence(), takes care of
+ // visibility and ghosted.
+ // This method will not handle included hierarchies and not check geometric visibility.
+ drawinglayer::primitive3d::Primitive3DSequence createPrimitive3DSequence(const DisplayInfo& rDisplayInfo) const;
+
+ // also overload the 2d method to deliver a 2d object with embedd3d 3d and the 3d transformation which is able to
+ // answer the get2DRange question accordingly
+ virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const;
+
+ public:
+ ViewObjectContactOfE3d(ObjectContact& rObjectContact, ViewContact& rViewContact);
+ virtual ~ViewObjectContactOfE3d();
+
+ // access to the local primitive sequence. This will ensure that the list is
+ // current in comparing the local list content with a fresh created incarnation
+ // This method will not handle included hierarchies or visibility.
+ drawinglayer::primitive3d::Primitive3DSequence getPrimitive3DSequence(const DisplayInfo& rDisplayInfo) const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWOBJECTCONTACTOFE3D_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofe3dscene.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofe3dscene.hxx
new file mode 100644
index 000000000000..49d35b90d03f
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewobjectcontactofe3dscene.hxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWOBJECTCONTACTOFE3DSCENE_HXX
+#define _SDR_CONTACT_VIEWOBJECTCONTACTOFE3DSCENE_HXX
+
+#include <svx/sdr/contact/viewobjectcontactofsdrobj.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class SVX_DLLPUBLIC ViewObjectContactOfE3dScene : public ViewObjectContactOfSdrObj
+ {
+ protected:
+ // 2d primitive creator
+ virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const;
+
+ public:
+ // basic constructor.
+ ViewObjectContactOfE3dScene(ObjectContact& rObjectContact, ViewContact& rViewContact);
+ virtual ~ViewObjectContactOfE3dScene();
+
+ // process this primitive: Eventually also recursively travel an existing hierarchy,
+ // e.g. for group objects, scenes or pages. This method will test geometrical visibility.
+ virtual drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWOBJECTCONTACTOFE3DSCENE_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofgraphic.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofgraphic.hxx
new file mode 100644
index 000000000000..ee0620353765
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewobjectcontactofgraphic.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWOBJECTCONTACTOFGRAPHIC_HXX
+#define _SDR_CONTACT_VIEWOBJECTCONTACTOFGRAPHIC_HXX
+
+#include <svx/sdr/contact/viewobjectcontactofsdrobj.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+class SdrGrafObj;
+
+namespace sdr { namespace event {
+ class AsynchGraphicLoadingEvent;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewObjectContactOfGraphic : public ViewObjectContactOfSdrObj
+ {
+ private:
+ // allow async loading event helper to call tooling methods
+ friend class sdr::event::AsynchGraphicLoadingEvent;
+
+ // Member which takes care for the asynch loading events which may be necessary
+ // for asynch graphics loading.
+ sdr::event::AsynchGraphicLoadingEvent* mpAsynchLoadEvent;
+
+ // async graphics loading helpers. Only to be used internally or from the
+ // event helper class (in .cxx file)
+ bool impPrepareGraphicWithAsynchroniousLoading();
+ bool impPrepareGraphicWithSynchroniousLoading();
+ void doAsynchGraphicLoading();
+ void forgetAsynchGraphicLoadingEvent(sdr::event::AsynchGraphicLoadingEvent* pEvent);
+
+ protected:
+ SdrGrafObj& getSdrGrafObj();
+
+ // This method is responsible for creating the graphical visualisation data
+ virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const;
+
+ public:
+ ViewObjectContactOfGraphic(ObjectContact& rObjectContact, ViewContact& rViewContact);
+ virtual ~ViewObjectContactOfGraphic();
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWOBJECTCONTACTOFGRAPHIC_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx
new file mode 100644
index 000000000000..da92072fef18
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWOBJECTCONTACTOFGROUP_HXX
+#define _SDR_CONTACT_VIEWOBJECTCONTACTOFGROUP_HXX
+
+#include <svx/sdr/contact/viewobjectcontactofsdrobj.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class SVX_DLLPUBLIC ViewObjectContactOfGroup : public ViewObjectContactOfSdrObj
+ {
+ public:
+ // basic constructor.
+ ViewObjectContactOfGroup(ObjectContact& rObjectContact, ViewContact& rViewContact);
+ virtual ~ViewObjectContactOfGroup();
+
+ // This method recursively paints the draw hierarchy.
+ virtual drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWOBJECTCONTACTOFGROUP_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofmasterpagedescriptor.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofmasterpagedescriptor.hxx
new file mode 100644
index 000000000000..3cb7ba2a7f84
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewobjectcontactofmasterpagedescriptor.hxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWOBJECTCONTACTOFMASTERPAGEDESCRIPTOR_HXX
+#define _SDR_CONTACT_VIEWOBJECTCONTACTOFMASTERPAGEDESCRIPTOR_HXX
+
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+namespace sdr {
+ class MasterPageDescriptor;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewObjectContactOfMasterPageDescriptor : public ViewObjectContact
+ {
+ public:
+ ViewObjectContactOfMasterPageDescriptor(ObjectContact& rObjectContact, ViewContact& rViewContact);
+ virtual ~ViewObjectContactOfMasterPageDescriptor();
+
+ // access to MasterPageDescriptor
+ sdr::MasterPageDescriptor& GetMasterPageDescriptor() const;
+
+ virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const;
+ virtual drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWOBJECTCONTACTOFSDRPAGE_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofpageobj.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofpageobj.hxx
new file mode 100644
index 000000000000..747f25cba3b6
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewobjectcontactofpageobj.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWOBJECTCONTACTOFPAGEOBJ_HXX
+#define _SDR_CONTACT_VIEWOBJECTCONTACTOFPAGEOBJ_HXX
+
+#include <svx/sdr/contact/viewobjectcontactofsdrobj.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+namespace sdr { namespace contact {
+ class PagePrimitiveExtractor;
+}}
+
+class SdrPage;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class SVX_DLLPUBLIC ViewObjectContactOfPageObj : public ViewObjectContactOfSdrObj
+ {
+ private:
+ // the page painter helper
+ PagePrimitiveExtractor* mpExtractor;
+
+ protected:
+ // This method is responsible for creating the graphical visualisation data which is
+ // stored/cached in the local primitive.
+ // This method will not handle included hierarchies and not check geometric visibility.
+ virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const;
+
+ public:
+ ViewObjectContactOfPageObj(ObjectContact& rObjectContact, ViewContact& rViewContact);
+ virtual ~ViewObjectContactOfPageObj();
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWOBJECTCONTACTOFPAGEOBJ_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofsdrmediaobj.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofsdrmediaobj.hxx
new file mode 100644
index 000000000000..d0fcfd6698f9
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewobjectcontactofsdrmediaobj.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWOBJECTCONTACTOFSDRMEDIAOBJ_HXX
+#define _SDR_CONTACT_VIEWOBJECTCONTACTOFSDRMEDIAOBJ_HXX
+
+#include <svx/sdr/contact/viewobjectcontactofsdrobj.hxx>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+
+namespace avmedia { class MediaItem; }
+class Window;
+
+namespace sdr
+{
+ namespace contact
+ {
+ class SdrMediaWindow;
+
+ class ViewObjectContactOfSdrMediaObj : public ViewObjectContactOfSdrObj
+ {
+ public:
+
+ ViewObjectContactOfSdrMediaObj( ObjectContact& rObjectContact,
+ ViewContact& rViewContact,
+ const ::avmedia::MediaItem& rMediaItem );
+ virtual ~ViewObjectContactOfSdrMediaObj();
+
+ public:
+
+ Window* getWindow() const;
+
+ bool hasPreferredSize() const;
+ Size getPreferredSize() const;
+
+ void updateMediaItem( ::avmedia::MediaItem& rItem ) const;
+ void executeMediaItem( const ::avmedia::MediaItem& rItem );
+
+ private:
+
+ ::sdr::contact::SdrMediaWindow* mpMediaWindow;
+
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // _SDR_CONTACT_VIEWOBJECTCONTACTOFSDRMEDIAOBJ_HXX
diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofsdrobj.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofsdrobj.hxx
new file mode 100644
index 000000000000..88245c46399e
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewobjectcontactofsdrobj.hxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWOBJECTCONTACTOFSDROBJ_HXX
+#define _SDR_CONTACT_VIEWOBJECTCONTACTOFSDROBJ_HXX
+
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+class SdrObject;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class SVX_DLLPUBLIC ViewObjectContactOfSdrObj : public ViewObjectContact
+ {
+ protected:
+ const SdrObject& getSdrObject() const;
+
+ public:
+ ViewObjectContactOfSdrObj(ObjectContact& rObjectContact, ViewContact& rViewContact);
+ virtual ~ViewObjectContactOfSdrObj();
+
+ virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWOBJECTCONTACTOFSDROBJ_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofsdrole2obj.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofsdrole2obj.hxx
new file mode 100644
index 000000000000..db3020023198
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewobjectcontactofsdrole2obj.hxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWOBJECTCONTACTOFSDROLE2OBJ_HXX
+#define _SDR_CONTACT_VIEWOBJECTCONTACTOFSDROLE2OBJ_HXX
+
+#include <svx/sdr/contact/viewobjectcontactofsdrobj.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+class SdrOle2Obj;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewObjectContactOfSdrOle2Obj : public ViewObjectContactOfSdrObj
+ {
+ protected:
+ const SdrOle2Obj& getSdrOle2Object() const;
+
+ // This method is responsible for creating the graphical visualisation data
+ virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const;
+
+ public:
+ ViewObjectContactOfSdrOle2Obj(ObjectContact& rObjectContact, ViewContact& rViewContact);
+ virtual ~ViewObjectContactOfSdrOle2Obj();
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWOBJECTCONTACTOFSDROLE2OBJ_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofsdrpage.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofsdrpage.hxx
new file mode 100644
index 000000000000..379112a35d30
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewobjectcontactofsdrpage.hxx
@@ -0,0 +1,246 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWOBJECTCONTACTOFSDRPAGE_HXX
+#define _SDR_CONTACT_VIEWOBJECTCONTACTOFSDRPAGE_HXX
+
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SdrPage;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class SVX_DLLPUBLIC ViewObjectContactOfPageSubObject : public ViewObjectContact
+ {
+ protected:
+ const SdrPage& getPage() const;
+
+ public:
+ ViewObjectContactOfPageSubObject(ObjectContact& rObjectContact, ViewContact& rViewContact);
+ virtual ~ViewObjectContactOfPageSubObject();
+
+ virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const;
+ virtual bool isPrimitiveGhosted(const DisplayInfo& rDisplayInfo) const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class SVX_DLLPUBLIC ViewObjectContactOfPageBackground : public ViewObjectContactOfPageSubObject
+ {
+ protected:
+ virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const;
+
+ public:
+ ViewObjectContactOfPageBackground(ObjectContact& rObjectContact, ViewContact& rViewContact);
+ virtual ~ViewObjectContactOfPageBackground();
+
+ virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class SVX_DLLPUBLIC ViewObjectContactOfMasterPage : public ViewObjectContactOfPageSubObject
+ {
+ protected:
+ public:
+ ViewObjectContactOfMasterPage(ObjectContact& rObjectContact, ViewContact& rViewContact);
+ virtual ~ViewObjectContactOfMasterPage();
+
+ virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class SVX_DLLPUBLIC ViewObjectContactOfPageFill : public ViewObjectContactOfPageSubObject
+ {
+ protected:
+ virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const;
+
+ public:
+ ViewObjectContactOfPageFill(ObjectContact& rObjectContact, ViewContact& rViewContact);
+ virtual ~ViewObjectContactOfPageFill();
+
+ virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class SVX_DLLPUBLIC ViewObjectContactOfPageShadow : public ViewObjectContactOfPageSubObject
+ {
+ public:
+ ViewObjectContactOfPageShadow(ObjectContact& rObjectContact, ViewContact& rViewContact);
+ virtual ~ViewObjectContactOfPageShadow();
+
+ virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class SVX_DLLPUBLIC ViewObjectContactOfOuterPageBorder : public ViewObjectContactOfPageSubObject
+ {
+ public:
+ ViewObjectContactOfOuterPageBorder(ObjectContact& rObjectContact, ViewContact& rViewContact);
+ virtual ~ViewObjectContactOfOuterPageBorder();
+
+ virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class SVX_DLLPUBLIC ViewObjectContactOfInnerPageBorder : public ViewObjectContactOfPageSubObject
+ {
+ public:
+ ViewObjectContactOfInnerPageBorder(ObjectContact& rObjectContact, ViewContact& rViewContact);
+ virtual ~ViewObjectContactOfInnerPageBorder();
+
+ virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class SVX_DLLPUBLIC ViewObjectContactOfPageHierarchy : public ViewObjectContactOfPageSubObject
+ {
+ public:
+ ViewObjectContactOfPageHierarchy(ObjectContact& rObjectContact, ViewContact& rViewContact);
+ virtual ~ViewObjectContactOfPageHierarchy();
+
+ virtual drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class SVX_DLLPUBLIC ViewObjectContactOfPageGrid : public ViewObjectContactOfPageSubObject
+ {
+ protected:
+ virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const;
+
+ public:
+ ViewObjectContactOfPageGrid(ObjectContact& rObjectContact, ViewContact& rViewContact);
+ virtual ~ViewObjectContactOfPageGrid();
+
+ virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class SVX_DLLPUBLIC ViewObjectContactOfPageHelplines : public ViewObjectContactOfPageSubObject
+ {
+ protected:
+ virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const;
+
+ public:
+ ViewObjectContactOfPageHelplines(ObjectContact& rObjectContact, ViewContact& rViewContact);
+ virtual ~ViewObjectContactOfPageHelplines();
+
+ virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class SVX_DLLPUBLIC ViewObjectContactOfSdrPage : public ViewObjectContact
+ {
+ public:
+ ViewObjectContactOfSdrPage(ObjectContact& rObjectContact, ViewContact& rViewContact);
+ virtual ~ViewObjectContactOfSdrPage();
+
+ virtual drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const;
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWOBJECTCONTACTOFSDRPAGE_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx
new file mode 100644
index 000000000000..9e70771e5844
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx
@@ -0,0 +1,142 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_SDR_CONTACT_VIEWOBJECTCONTACTOFUNOCONTROL_HXX
+#define SVX_SDR_CONTACT_VIEWOBJECTCONTACTOFUNOCONTROL_HXX
+
+#include <svx/sdr/contact/viewobjectcontactofsdrobj.hxx>
+
+/** === begin UNO includes === **/
+#include <com/sun/star/uno/Reference.hxx>
+/** === end UNO includes === **/
+#include <rtl/ref.hxx>
+#include <svx/svxdllapi.h>
+
+class OutputDevice;
+class Window;
+class SdrUnoObj;
+namespace com { namespace sun { namespace star {
+ namespace awt {
+ class XControl;
+ class XControlContainer;
+ }
+} } }
+
+//........................................................................
+namespace sdr { namespace contact {
+//........................................................................
+
+ class ViewContactOfUnoControl;
+ class ObjectContactOfPageView;
+ //====================================================================
+ //= ViewObjectContactOfUnoControl
+ //====================================================================
+ class ViewObjectContactOfUnoControl_Impl;
+ class SVX_DLLPRIVATE ViewObjectContactOfUnoControl : public ViewObjectContactOfSdrObj
+ {
+ protected:
+ ::rtl::Reference< ViewObjectContactOfUnoControl_Impl > m_pImpl;
+
+ public:
+ ViewObjectContactOfUnoControl( ObjectContact& _rObjectContact, ViewContactOfUnoControl& _rViewContact );
+ /// determines whether an XControl already exists, and is currently visible
+ bool isControlVisible() const;
+
+ /// returns the ->XControl instance belonging to the instance, creates it if necessary
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >
+ getControl();
+
+ /** retrieves a temporary XControl instance, whose parent is the given device
+ @seealso SdrUnoObj::GetTemporaryControlForWindow
+ */
+ static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >
+ getTemporaryControlForWindow(
+ const Window& _rWindow,
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& _inout_ControlContainer,
+ const SdrUnoObj& _rUnoObject
+ );
+
+ /// ensures that the control belonging to this instances has a given visibility
+ void ensureControlVisibility( bool _bVisible ) const;
+
+ /** sets the design/alive mode of the control
+ */
+ void setControlDesignMode( bool _bDesignMode ) const;
+
+ /** callback from impl class to react on changes of properties form the XControlModel
+ */
+ void propertyChange();
+
+ /** React on changes of the object of this ViewContact
+ */
+ virtual void ActionChanged();
+
+ /** to be called when any aspect of the control which requires view updates changed
+ */
+ struct ImplAccess { friend class ViewObjectContactOfUnoControl_Impl; friend class ViewObjectContactOfUnoControl; private: ImplAccess() { } };
+ void onControlChangedOrModified( ImplAccess ) { impl_onControlChangedOrModified(); }
+
+ protected:
+ ~ViewObjectContactOfUnoControl();
+
+ // support for Primitive2D
+ virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const;
+
+ // visibility check
+ virtual bool isPrimitiveVisible( const DisplayInfo& _rDisplayInfo ) const;
+ /// to be called when any aspect of the control which requires view updates changed
+ void impl_onControlChangedOrModified();
+
+ private:
+ ViewObjectContactOfUnoControl(); // never implemented
+ ViewObjectContactOfUnoControl( const ViewObjectContactOfUnoControl& ); // never implemented
+ ViewObjectContactOfUnoControl& operator=( const ViewObjectContactOfUnoControl& ); // never implemented
+ };
+
+ //====================================================================
+ //= UnoControlPrintOrPreviewContact
+ //====================================================================
+ class SVX_DLLPRIVATE UnoControlPrintOrPreviewContact : public ViewObjectContactOfUnoControl
+ {
+ public:
+ UnoControlPrintOrPreviewContact( ObjectContactOfPageView& _rObjectContact, ViewContactOfUnoControl& _rViewContact );
+ ~UnoControlPrintOrPreviewContact();
+
+ private:
+ UnoControlPrintOrPreviewContact(); // never implemented
+ UnoControlPrintOrPreviewContact( const UnoControlPrintOrPreviewContact& ); // never implemented
+ UnoControlPrintOrPreviewContact& operator=( const UnoControlPrintOrPreviewContact& ); // never implemented
+
+ virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequence(const DisplayInfo& rDisplayInfo ) const;
+ };
+
+//........................................................................
+} } // namespace sdr::contact
+//........................................................................
+
+#endif // SVX_SDR_CONTACT_VIEWOBJECTCONTACTOFUNOCONTROL_HXX
+
diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactredirector.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactredirector.hxx
new file mode 100644
index 000000000000..00f18751fb81
--- /dev/null
+++ b/svx/inc/svx/sdr/contact/viewobjectcontactredirector.hxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWOBJECTCONTACTREDIRECTOR_HXX
+#define _SDR_CONTACT_VIEWOBJECTCONTACTREDIRECTOR_HXX
+
+#include "svx/svxdllapi.h"
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+namespace sdr { namespace contact {
+ class DisplayInfo;
+ class ViewObjectContact;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ // This class provides a mechanism to redirect the paint mechanism for all or
+ // single ViewObjectContacts. An own derivation may be set at single ViewContacts
+ // or at the ObjectContact for redirecting all. If both is used, the one at single
+ // objects will have priority.
+ class SVX_DLLPUBLIC ViewObjectContactRedirector
+ {
+ public:
+ // basic constructor.
+ ViewObjectContactRedirector();
+
+ // The destructor.
+ virtual ~ViewObjectContactRedirector();
+
+ // all default implementations just call the same methods at the original. To do something
+ // different, overload the method and at least do what the method does.
+ virtual drawinglayer::primitive2d::Primitive2DSequence createRedirectedPrimitive2DSequence(
+ const sdr::contact::ViewObjectContact& rOriginal,
+ const sdr::contact::DisplayInfo& rDisplayInfo);
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_CONTACT_VIEWOBJECTCONTACTREDIRECTOR_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/event/eventhandler.hxx b/svx/inc/svx/sdr/event/eventhandler.hxx
new file mode 100644
index 000000000000..f8c07c2d84e5
--- /dev/null
+++ b/svx/inc/svx/sdr/event/eventhandler.hxx
@@ -0,0 +1,140 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_EVENT_EVENTHANDLER_HXX
+#define _SDR_EVENT_EVENTHANDLER_HXX
+
+#include <sal/types.h>
+
+#include <vector>
+#include <vcl/timer.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+namespace sdr
+{
+ namespace event
+ {
+ class BaseEvent;
+ class EventHandler;
+
+ // typedefs for a list of BaseEvents
+ typedef ::std::vector< BaseEvent* > BaseEventVector;
+ } // end of namespace event
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace event
+ {
+ class BaseEvent
+ {
+ // the EventHandler this event is registered at
+ EventHandler& mrEventHandler;
+
+ public:
+ // basic constructor.
+ BaseEvent(EventHandler& rEventHandler);
+
+ // destructor
+ virtual ~BaseEvent();
+
+ // the called method if the event is triggered
+ virtual void ExecuteEvent() = 0;
+ };
+ } // end of namespace event
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace event
+ {
+ class EventHandler
+ {
+ BaseEventVector maVector;
+
+ // to allow BaseEvents to use the add/remove functionality
+ friend class BaseEvent;
+
+ // methods to add/remove events. These are private since
+ // they are used from BaseEvent only.
+ void AddEvent(BaseEvent& rBaseEvent);
+ void RemoveEvent(BaseEvent& rBaseEvent);
+
+ // access to a event, 0L when no more events
+ BaseEvent* GetEvent();
+
+ public:
+ // basic constructor.
+ EventHandler();
+
+ // destructor
+ virtual ~EventHandler();
+
+ // Trigger and consume the events
+ virtual void ExecuteEvents();
+
+ // for control
+ sal_Bool IsEmpty() const;
+ };
+ } // end of namespace event
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace event
+ {
+ class TimerEventHandler : public EventHandler, public Timer
+ {
+ public:
+ // basic constructor.
+ TimerEventHandler(sal_uInt32 nTimeout = 1L);
+
+ // destructor
+ virtual ~TimerEventHandler();
+
+ // The timer when it is triggered; from class Timer
+ virtual void Timeout();
+
+ // reset the timer
+ void Restart();
+ };
+ } // end of namespace event
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_EVENT_EVENTHANDLER_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/overlay/overlayanimatedbitmapex.hxx b/svx/inc/svx/sdr/overlay/overlayanimatedbitmapex.hxx
new file mode 100644
index 000000000000..dd22a50480de
--- /dev/null
+++ b/svx/inc/svx/sdr/overlay/overlayanimatedbitmapex.hxx
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_OVERLAY_OVERLAYANIMATEDBITMAPEX_HXX
+#define _SDR_OVERLAY_OVERLAYANIMATEDBITMAPEX_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+#include <vcl/bitmapex.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ class SVX_DLLPUBLIC OverlayAnimatedBitmapEx : public OverlayObjectWithBasePosition
+ {
+ protected:
+ // the Bitmaps
+ BitmapEx maBitmapEx1;
+ BitmapEx maBitmapEx2;
+
+ // position of the basePosition inside the Bitmaps, in pixels
+ sal_uInt16 mnCenterX1;
+ sal_uInt16 mnCenterY1;
+ sal_uInt16 mnCenterX2;
+ sal_uInt16 mnCenterY2;
+
+ // #i53216# added CursorBlinkTime (in ms)
+ sal_uInt32 mnBlinkTime;
+
+ // bitfield
+ // Flag to remember which state to draw. Inited with sal_False (0)
+ unsigned mbOverlayState : 1;
+
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
+
+ // #i53216# check blink time value range (currently 25 < mnBlinkTime < 10000)
+ void impCheckBlinkTimeValueRange();
+
+ public:
+ OverlayAnimatedBitmapEx(
+ const basegfx::B2DPoint& rBasePos,
+ const BitmapEx& rBitmapEx1,
+ const BitmapEx& rBitmapEx2,
+ sal_uInt32 nBlinkTime = 500,
+ sal_uInt16 nCenX1 = 0,
+ sal_uInt16 nCenY1 = 0,
+ sal_uInt16 nCenX2 = 0,
+ sal_uInt16 nCenY2 = 0);
+ virtual ~OverlayAnimatedBitmapEx();
+
+ const BitmapEx& getBitmapEx1() const { return maBitmapEx1; }
+ const BitmapEx& getBitmapEx2() const { return maBitmapEx2; }
+ void setBitmapEx1(const BitmapEx& rNew);
+ void setBitmapEx2(const BitmapEx& rNew);
+
+ sal_uInt16 getCenterX1() const { return mnCenterX1; }
+ sal_uInt16 getCenterY1() const { return mnCenterY1; }
+ sal_uInt16 getCenterX2() const { return mnCenterX2; }
+ sal_uInt16 getCenterY2() const { return mnCenterY2; }
+ void setCenterXY1(sal_uInt16 nNewX, sal_uInt16 nNewY);
+ void setCenterXY2(sal_uInt16 nNewX, sal_uInt16 nNewY);
+
+ // #i53216# added CursorBlinkTime (in ms)
+ sal_uInt32 getBlinkTime() const { return mnBlinkTime; }
+ void setBlinkTime(sal_uInt32 nNew);
+
+ // 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);
+ };
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_OVERLAY_OVERLAYANIMATEDBITMAPEX_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/overlay/overlaybitmapex.hxx b/svx/inc/svx/sdr/overlay/overlaybitmapex.hxx
new file mode 100644
index 000000000000..1fbf0b6add3d
--- /dev/null
+++ b/svx/inc/svx/sdr/overlay/overlaybitmapex.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_OVERLAY_OVERLAYBITMAPEX_HXX
+#define _SDR_OVERLAY_OVERLAYBITMAPEX_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+#include <vcl/bitmapex.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ class SVX_DLLPUBLIC OverlayBitmapEx : public OverlayObjectWithBasePosition
+ {
+ protected:
+ // the Bitmap itself
+ BitmapEx maBitmapEx;
+
+ // position of the basePosition inside the Bitmap, in pixels
+ sal_uInt16 mnCenterX;
+ sal_uInt16 mnCenterY;
+
+ // optional transparency
+ double mfAlpha;
+
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
+
+ public:
+ OverlayBitmapEx(
+ const basegfx::B2DPoint& rBasePos,
+ const BitmapEx& rBitmapEx,
+ sal_uInt16 nCenX = 0, sal_uInt16 nCenY = 0, double fAlpha = 0.0 );
+ virtual ~OverlayBitmapEx();
+
+ const BitmapEx& getBitmapEx() const { return maBitmapEx; }
+ void setBitmapEx(const BitmapEx& rNew);
+
+ sal_uInt16 getCenterX() const { return mnCenterX; }
+ sal_uInt16 getCenterY() const { return mnCenterY; }
+ void setCenterXY(sal_uInt16 nNewX, sal_uInt16 nNewY);
+ };
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_OVERLAY_OVERLAYBITMAPEX_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/overlay/overlaycrosshair.hxx b/svx/inc/svx/sdr/overlay/overlaycrosshair.hxx
new file mode 100644
index 000000000000..13e45fa47baf
--- /dev/null
+++ b/svx/inc/svx/sdr/overlay/overlaycrosshair.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_OVERLAY_OVERLAYCROSSHAIR_HXX
+#define _SDR_OVERLAY_OVERLAYCROSSHAIR_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ class OverlayCrosshairStriped : public OverlayObjectWithBasePosition
+ {
+ protected:
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
+
+ public:
+ OverlayCrosshairStriped(const basegfx::B2DPoint& rBasePos);
+ virtual ~OverlayCrosshairStriped();
+
+ // react on stripe definition change
+ virtual void stripeDefinitionHasChanged();
+ };
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_OVERLAY_OVERLAYCROSSHAIR_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/overlay/overlayhatchrect.hxx b/svx/inc/svx/sdr/overlay/overlayhatchrect.hxx
new file mode 100644
index 000000000000..ce17ef86d881
--- /dev/null
+++ b/svx/inc/svx/sdr/overlay/overlayhatchrect.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_OVERLAY_OVERLAYHATCHRECT_HXX
+#define _SDR_OVERLAY_OVERLAYHATCHRECT_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+#include <vcl/hatch.hxx>
+#include <tools/gen.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+class PolyPolygon;
+
+namespace sdr
+{
+ namespace overlay
+ {
+ class OverlayHatchRect : public OverlayObjectWithBasePosition
+ {
+ // geometric definitions
+ basegfx::B2DPoint maSecondPosition;
+ const double mfDiscreteGrow;
+ const double mfDiscreteShrink;
+ const double mfHatchRotation;
+ const double mfRotation;
+
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
+
+ public:
+ OverlayHatchRect(
+ const basegfx::B2DPoint& rBasePosition,
+ const basegfx::B2DPoint& rSecondPosition,
+ const Color& rHatchColor,
+ double fDiscreteGrow,
+ double fDiscreteShrink,
+ double fHatchRotation,
+ double fRotation);
+
+ const basegfx::B2DPoint& getSecondPosition() const { return maSecondPosition; }
+ void setSecondPosition(const basegfx::B2DPoint&);
+
+ // data read access
+ double getDiscreteGrow() const { return mfDiscreteGrow; }
+ double getDiscreteShrink() const { return mfDiscreteShrink; }
+ double getHatchRotation() const { return mfHatchRotation; }
+ double getRotation() const { return mfRotation; }
+ };
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_OVERLAY_OVERLAYHATCHRECT_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/overlay/overlayhelpline.hxx b/svx/inc/svx/sdr/overlay/overlayhelpline.hxx
new file mode 100644
index 000000000000..c8f26639f032
--- /dev/null
+++ b/svx/inc/svx/sdr/overlay/overlayhelpline.hxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_OVERLAY_OVERLAYHELPLINE_HXX
+#define _SDR_OVERLAY_OVERLAYHELPLINE_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+#include <svx/svdhlpln.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ class OverlayHelplineStriped : public OverlayObjectWithBasePosition
+ {
+ protected:
+ // remember HelpLineKind
+ SdrHelpLineKind meKind;
+
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
+
+ public:
+ OverlayHelplineStriped(
+ const basegfx::B2DPoint& rBasePos,
+ SdrHelpLineKind eNewKind = SDRHELPLINE_POINT);
+ virtual ~OverlayHelplineStriped();
+
+ // dat read access
+ SdrHelpLineKind getKind() const { return meKind; }
+
+ // react on stripe definition change
+ virtual void stripeDefinitionHasChanged();
+ };
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_OVERLAY_OVERLAYHELPLINE_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/overlay/overlayline.hxx b/svx/inc/svx/sdr/overlay/overlayline.hxx
new file mode 100644
index 000000000000..3df8dc0f4f05
--- /dev/null
+++ b/svx/inc/svx/sdr/overlay/overlayline.hxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_OVERLAY_OVERLAYLINE_HXX
+#define _SDR_OVERLAY_OVERLAYLINE_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ class OverlayLineStriped : public OverlayObjectWithBasePosition
+ {
+ protected:
+ // second position in pixel
+ basegfx::B2DPoint maSecondPosition;
+
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
+
+ public:
+ OverlayLineStriped(
+ const basegfx::B2DPoint& rBasePos,
+ const basegfx::B2DPoint& rSecondPos);
+ virtual ~OverlayLineStriped();
+
+ // change second position
+ const basegfx::B2DPoint& getSecondPosition() const { return maSecondPosition; }
+ void setSecondPosition(const basegfx::B2DPoint& rNew);
+
+ // react on stripe definition change
+ virtual void stripeDefinitionHasChanged();
+ };
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_OVERLAY_OVERLAYLINE_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/overlay/overlaymanager.hxx b/svx/inc/svx/sdr/overlay/overlaymanager.hxx
new file mode 100644
index 000000000000..379086211cbf
--- /dev/null
+++ b/svx/inc/svx/sdr/overlay/overlaymanager.hxx
@@ -0,0 +1,150 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_OVERLAY_OVERLAYMANAGER_HXX
+#define _SDR_OVERLAY_OVERLAYMANAGER_HXX
+
+#include <svx/sdr/animation/scheduler.hxx>
+#include <svx/sdr/overlay/overlayobject.hxx>
+#include <vcl/mapmod.hxx>
+#include <tools/color.hxx>
+#include "svx/svxdllapi.h"
+#include <svtools/optionsdrawinglayer.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class OutputDevice;
+class Region;
+
+namespace sdr { namespace overlay {
+ class OverlayObject;
+}}
+
+namespace basegfx {
+ class B2DRange;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ class SVX_DLLPUBLIC OverlayManager : public ::sdr::animation::Scheduler
+ {
+ protected:
+ // the OutputDevice to work on, set on construction and not to be changed
+ OutputDevice& rmOutputDevice;
+
+ // the vector of registered OverlayObjects
+ OverlayObjectVector maOverlayObjects;
+
+ // Stripe support. All striped OverlayObjects use these stripe
+ // values. Changes change all those objects.
+ Color maStripeColorA; // defaults to Color(COL_BLACK)
+ Color maStripeColorB; // defaults to Color(COL_WHITE)
+ sal_uInt32 mnStripeLengthPixel; // defaults to 4L
+
+ // hold an incarnation of Drawinglayer configuration options
+ SvtOptionsDrawinglayer maDrawinglayerOpt;
+
+ // 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 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:
+ // 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 = 0) const;
+
+ // flush. Do buffered updates.
+ virtual void flush();
+
+ // #i68597# part of content gets copied, react on it
+ virtual void copyArea(const Point& rDestPt, const Point& rSrcPt, const Size& rSrcSize);
+
+ // restore part of background. Implemented form buffered versions only.
+ virtual void restoreBackground(const Region& rRegion) const;
+
+ // get the OutputDevice
+ OutputDevice& getOutputDevice() const { return rmOutputDevice; }
+
+ // add and remove OverlayObjects
+ void add(OverlayObject& rOverlayObject);
+ void remove(OverlayObject& rOverlayObject);
+
+ // invalidate the given range at local OutputDevice
+ virtual void invalidateRange(const basegfx::B2DRange& rRange);
+
+ // stripe support ColA
+ Color getStripeColorA() const { return maStripeColorA; }
+ void setStripeColorA(Color aNew= Color(COL_BLACK));
+
+ // stripe support ColB
+ Color getStripeColorB() const { return maStripeColorB; }
+ void setStripeColorB(Color aNew = Color(COL_WHITE));
+
+ // stripe support StripeLengthPixel
+ sal_uInt32 getStripeLengthPixel() const { return mnStripeLengthPixel; }
+ void setStripeLengthPixel(sal_uInt32 nNew = 5L);
+
+ // access to maDrawinglayerOpt
+ const SvtOptionsDrawinglayer& getDrawinglayerOpt() const { return maDrawinglayerOpt; }
+ };
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_OVERLAY_OVERLAYMANAGER_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/overlay/overlaymanagerbuffered.hxx b/svx/inc/svx/sdr/overlay/overlaymanagerbuffered.hxx
new file mode 100644
index 000000000000..fb21fa328232
--- /dev/null
+++ b/svx/inc/svx/sdr/overlay/overlaymanagerbuffered.hxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_OVERLAY_OVERLAYMANAGERBUFFERED_HXX
+#define _SDR_OVERLAY_OVERLAYMANAGERBUFFERED_HXX
+
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <basegfx/range/b2irange.hxx>
+#include <vcl/virdev.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class VirtualDevice;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ class OverlayManagerBuffered : public OverlayManager
+ {
+ protected:
+ // The VirtualDevice for draw window content buffering, this
+ // is the view content without overlay
+ VirtualDevice maBufferDevice;
+
+ // #i73602# The VirtualDevice for OverlayPaint buffering. This
+ // is an extra device to avoid flickering of overlay paints
+ VirtualDevice maOutputBufferDevice;
+
+ // Timer for buffering
+ Timer maBufferTimer;
+
+ // Range for buffering (in pixel to be independent from mapMode)
+ basegfx::B2IRange maBufferRememberedRangePixel;
+
+ // bitfield
+ // Flag to decide if PreRendering shall be used for overlay refreshes.
+ // Default is false.
+ unsigned mbRefreshWithPreRendering : 1;
+
+ // link for timer
+ DECL_LINK(ImpBufferTimerHandler, AutoTimer*);
+
+ // Internal methods for buffering
+ void ImpPrepareBufferDevice();
+ void ImpRestoreBackground() const ;
+ void ImpRestoreBackground(const Region& rRegionPixel) const;
+ void ImpSaveBackground(const Region& rRegion, OutputDevice* pPreRenderDevice = 0L);
+
+ public:
+ // 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
+ virtual void completeRedraw(const Region& rRegion, OutputDevice* pPreRenderDevice = 0L) const;
+
+ // flush. Do buffered updates.
+ virtual void flush();
+
+ // #i68597# part of content gets copied, react on it
+ virtual void copyArea(const Point& rDestPt, const Point& rSrcPt, const Size& rSrcSize);
+
+ // restore part of background. Implemented form buffered versions only.
+ virtual void restoreBackground(const Region& rRegion) const;
+
+ // invalidate the given range at local OutputDevice
+ virtual void invalidateRange(const basegfx::B2DRange& rRange);
+
+ // access to RefreshWithPreRendering Flag
+ bool DoRefreshWithPreRendering() const { return mbRefreshWithPreRendering; }
+ void SetRefreshWithPreRendering(bool bNew);
+ };
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_OVERLAY_OVERLAYMANAGERBUFFERED_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/overlay/overlayobject.hxx b/svx/inc/svx/sdr/overlay/overlayobject.hxx
new file mode 100644
index 000000000000..0200e859d370
--- /dev/null
+++ b/svx/inc/svx/sdr/overlay/overlayobject.hxx
@@ -0,0 +1,203 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_OVERLAY_OVERLAYOBJECT_HXX
+#define _SDR_OVERLAY_OVERLAYOBJECT_HXX
+
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <tools/color.hxx>
+#include <svx/sdr/animation/scheduler.hxx>
+#include "svx/svxdllapi.h"
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class OutputDevice;
+
+namespace sdr
+{
+ namespace overlay
+ {
+ class OverlayManager;
+ } // end of namespace overlay
+} // end of namespace sdr
+
+namespace basegfx
+{
+ class B2DPolygon;
+ class B2DPolyPolygon;
+ class B2DRange;
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ class SVX_DLLPUBLIC OverlayObject : private ::boost::noncopyable, public ::sdr::animation::Event
+ {
+ 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;
+
+ // 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;
+
+ // base color of this OverlayObject
+ Color maBaseColor;
+
+ // bitfield
+ // Flag for visibility
+ unsigned mbIsVisible : 1;
+
+ // Flag to control hittability
+ unsigned mbIsHittable : 1;
+
+ // Flag to hold info if this objects supports animation. Default is
+ // false. If true, the Trigger() method should be overloaded
+ // to implement the animation effect and to re-initiate the event.
+ unsigned mbAllowsAnimation : 1;
+
+ // 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.
+ virtual void objectChange();
+
+ // 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);
+ virtual ~OverlayObject();
+
+ // get OverlayManager
+ OverlayManager* getOverlayManager() const { return mpOverlayManager; }
+
+ // the access method for Primitive2DSequence. Will use createPrimitive2DSequence and
+ // setPrimitive2DSequence if needed. Overloading may be used to allow disposal of last
+ // created primitives to react on changed circumstances and to re-create primitives
+ virtual drawinglayer::primitive2d::Primitive2DSequence getOverlayObjectPrimitive2DSequence() const;
+
+ // access to visibility state
+ bool isVisible() const { return mbIsVisible; }
+ void setVisible(bool bNew);
+
+ // access to hittable flag
+ 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.
+ const basegfx::B2DRange& getBaseRange() const;
+
+ // access to baseColor
+ Color getBaseColor() const { return maBaseColor; }
+ void setBaseColor(Color aNew);
+
+ // 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);
+
+ // acces to AllowsAnimation flag
+ bool allowsAnimation() const { return mbAllowsAnimation; }
+
+ // stripe definition has changed. The OverlayManager does have
+ // support data to draw graphics in two colors striped. This
+ // method notifies the OverlayObject if that change takes place.
+ // Default implementation does nothing.
+ virtual void stripeDefinitionHasChanged();
+ };
+
+ // typedefs for a vector of OverlayObjects
+ typedef ::std::vector< OverlayObject* > OverlayObjectVector;
+
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ class SVX_DLLPUBLIC OverlayObjectWithBasePosition : public OverlayObject
+ {
+ protected:
+ // base position in logical coordinates
+ basegfx::B2DPoint maBasePosition;
+
+ public:
+ OverlayObjectWithBasePosition(const basegfx::B2DPoint& rBasePos, Color aBaseColor);
+ virtual ~OverlayObjectWithBasePosition();
+
+ // access to basePosition
+ const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; }
+ void setBasePosition(const basegfx::B2DPoint& rNew);
+ };
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_OVERLAY_OVERLAYOBJECT_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/overlay/overlayobjectcell.hxx b/svx/inc/svx/sdr/overlay/overlayobjectcell.hxx
new file mode 100644
index 000000000000..5d43983a57b0
--- /dev/null
+++ b/svx/inc/svx/sdr/overlay/overlayobjectcell.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_OVERLAY_OVERLAYOBJECTCELL_HXX
+#define _SDR_OVERLAY_OVERLAYOBJECTCELL_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+
+// #114409#
+namespace sdr
+{
+ namespace overlay
+ {
+ enum CellOverlayType { CELL_OVERLAY_INVERT, CELL_OVERLAY_TRANSPARENT };
+
+ // OverlayObjectCell - used for cell cursor, selection and AutoFill handle
+
+ class SVX_DLLPUBLIC OverlayObjectCell : public OverlayObject
+ {
+ public:
+ typedef ::std::vector< basegfx::B2DRange > RangeVector;
+
+ private:
+ CellOverlayType mePaintType;
+ RangeVector maRectangles;
+
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
+
+ public:
+ OverlayObjectCell( CellOverlayType eType, const Color& rColor, const RangeVector& rRects);
+ virtual ~OverlayObjectCell();
+ };
+
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_OVERLAY_OVERLAYLINE_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/overlay/overlayobjectlist.hxx b/svx/inc/svx/sdr/overlay/overlayobjectlist.hxx
new file mode 100644
index 000000000000..181ccdfb7831
--- /dev/null
+++ b/svx/inc/svx/sdr/overlay/overlayobjectlist.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_OVERLAY_OVERLAYOBJECTLIST_HXX
+#define _SDR_OVERLAY_OVERLAYOBJECTLIST_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+#include <tools/gen.hxx>
+#include "svx/svxdllapi.h"
+
+//////////////////////////////////////////////////////////////////////////////
+
+#define DEFAULT_VALUE_FOR_HITTEST_PIXEL (2L)
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ class SVX_DLLPUBLIC OverlayObjectList
+ {
+ protected:
+ // the vector of OverlayObjects
+ OverlayObjectVector maVector;
+
+ // default value for HiTestPixel
+ sal_uInt32 getDefaultValueForHitTestPixel() const { return 4L; }
+
+ public:
+ OverlayObjectList() {}
+ ~OverlayObjectList();
+
+ // clear list, this includes deletion of all contained objects
+ void clear();
+
+ // append/remove objects
+ void append(OverlayObject& rOverlayObject) { maVector.push_back(&rOverlayObject); }
+ void remove(OverlayObject& rOverlayObject);
+
+ // access to objects
+ sal_uInt32 count() const { return maVector.size(); }
+ OverlayObject& getOverlayObject(sal_uInt32 nIndex) const { return *(maVector[nIndex]); }
+
+ // Hittest with logical coordinates
+ bool isHitLogic(const basegfx::B2DPoint& rLogicPosition, double fLogicTolerance = 0.0) const;
+
+ // Hittest with pixel coordinates and pixel tolerance
+ 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;
+ };
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_OVERLAY_OVERLAYOBJECTLIST_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/overlay/overlaypolypolygon.hxx b/svx/inc/svx/sdr/overlay/overlaypolypolygon.hxx
new file mode 100644
index 000000000000..7107a92c286c
--- /dev/null
+++ b/svx/inc/svx/sdr/overlay/overlaypolypolygon.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_OVERLAY_OVERLAYPOLYPOLYGON_HXX
+#define _SDR_OVERLAY_OVERLAYPOLYPOLYGON_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ class SVX_DLLPUBLIC OverlayPolyPolygonStriped : public OverlayObject
+ {
+ protected:
+ // geometry
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
+
+ public:
+ OverlayPolyPolygonStriped(const basegfx::B2DPolyPolygon& rPolyPolygon);
+ virtual ~OverlayPolyPolygonStriped();
+
+ // change geometry
+ basegfx::B2DPolyPolygon getPolyPolygon() const { return maPolyPolygon; }
+ void setPolyPolygon(const basegfx::B2DPolyPolygon& rNew);
+
+ // react on stripe definition change
+ virtual void stripeDefinitionHasChanged();
+ };
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_OVERLAY_OVERLAYPOLYPOLYGON_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx b/svx/inc/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx
new file mode 100644
index 000000000000..049dfefe585d
--- /dev/null
+++ b/svx/inc/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_OVERLAY_OVERLAYPRIMITIVE2DSEQUENCEOBJECT_HXX
+#define _SDR_OVERLAY_OVERLAYPRIMITIVE2DSEQUENCEOBJECT_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ class SVX_DLLPUBLIC OverlayPrimitive2DSequenceObject : public OverlayObjectWithBasePosition
+ {
+ protected:
+ // the sequence of primitives to show
+ const drawinglayer::primitive2d::Primitive2DSequence maSequence;
+
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
+
+ private:
+ // internal helper to create a drawinglayer::geometry::ViewInformation2D
+ // using a OutputDevice and local knowledge
+ drawinglayer::geometry::ViewInformation2D impCreateViewInformation2D(OutputDevice& rOutputDevice) const;
+
+ public:
+ OverlayPrimitive2DSequenceObject(const drawinglayer::primitive2d::Primitive2DSequence& rSequence);
+
+ virtual ~OverlayPrimitive2DSequenceObject();
+
+ // data read access
+ const drawinglayer::primitive2d::Primitive2DSequence& getSequence() const { return maSequence; }
+ };
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_OVERLAY_OVERLAYPRIMITIVE2DSEQUENCEOBJECT_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/overlay/overlayrollingrectangle.hxx b/svx/inc/svx/sdr/overlay/overlayrollingrectangle.hxx
new file mode 100644
index 000000000000..0dec8ac62fd9
--- /dev/null
+++ b/svx/inc/svx/sdr/overlay/overlayrollingrectangle.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_OVERLAY_OVERLAYROOLINGRECTANGLE_HXX
+#define _SDR_OVERLAY_OVERLAYROOLINGRECTANGLE_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ class OverlayRollingRectangleStriped : public OverlayObjectWithBasePosition
+ {
+ protected:
+ // second position in pixel
+ basegfx::B2DPoint maSecondPosition;
+
+ // bitfield
+ // Flag to switch on/off long lines to the OutputDevice bounds
+ unsigned mbExtendedLines : 1;
+
+ // Flag to switch on/off the bounds itself
+ unsigned mbShowBounds : 1;
+
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
+
+ public:
+ OverlayRollingRectangleStriped(
+ const basegfx::B2DPoint& rBasePos,
+ const basegfx::B2DPoint& rSecondPos,
+ bool bExtendedLines = false,
+ bool bShowBounds = true);
+ virtual ~OverlayRollingRectangleStriped();
+
+ // change second position
+ const basegfx::B2DPoint& getSecondPosition() const { return maSecondPosition; }
+ void setSecondPosition(const basegfx::B2DPoint& rNew);
+
+ // change extended lines
+ bool getExtendedLines() const { return mbExtendedLines; }
+ void setExtendedLines(bool bNew);
+
+ // change show bounds
+ bool getShowBounds() const { return mbShowBounds; }
+ void setShowBounds(bool bNew);
+
+ // react on stripe definition change
+ virtual void stripeDefinitionHasChanged();
+ };
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_OVERLAY_OVERLAYROOLINGRECTANGLE_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/overlay/overlayselection.hxx b/svx/inc/svx/sdr/overlay/overlayselection.hxx
new file mode 100644
index 000000000000..4372929d4317
--- /dev/null
+++ b/svx/inc/svx/sdr/overlay/overlayselection.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_OVERLAY_OVERLAYSELECTION_HXX
+#define _SDR_OVERLAY_OVERLAYSELECTION_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+#include <vcl/region.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ // overlay type definition
+ enum OverlayType
+ {
+ OVERLAY_INVERT,
+ OVERLAY_SOLID,
+ OVERLAY_TRANSPARENT
+ };
+
+ class SVX_DLLPUBLIC OverlaySelection : public OverlayObject
+ {
+ protected:
+ // type of overlay
+ OverlayType meOverlayType;
+
+ // geometry of overlay
+ std::vector< basegfx::B2DRange > maRanges;
+
+ // Values of last primitive creation. These are checked in getOverlayObjectPrimitive2DSequence
+ // to evtl. get rid of last Primitive2DSequence. This ensures that these values are up-to-date
+ // and are usable when creating primitives
+ OverlayType maLastOverlayType;
+ sal_uInt16 mnLastTransparence;
+
+ // bitfield
+ unsigned mbBorder : 1;
+
+ // geometry creation for OverlayObject, can use local *Last* values
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
+
+ public:
+ OverlaySelection(
+ OverlayType eType,
+ const Color& rColor,
+ const std::vector< basegfx::B2DRange >& rRanges,
+ bool bBorder);
+ virtual ~OverlaySelection();
+
+ // data read access
+ OverlayType getOverlayType() const { return meOverlayType; }
+ const std::vector< basegfx::B2DRange >& getRanges() const { return maRanges; }
+ bool getBorder() const { return mbBorder; }
+
+ // overloaded to check conditions for last createOverlayObjectPrimitive2DSequence
+ virtual drawinglayer::primitive2d::Primitive2DSequence getOverlayObjectPrimitive2DSequence() const;
+
+ // data write access
+ void setRanges(const std::vector< basegfx::B2DRange >& rNew);
+ };
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_OVERLAY_OVERLAYSELECTION_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/overlay/overlaytools.hxx b/svx/inc/svx/sdr/overlay/overlaytools.hxx
new file mode 100644
index 000000000000..4142e326a910
--- /dev/null
+++ b/svx/inc/svx/sdr/overlay/overlaytools.hxx
@@ -0,0 +1,278 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _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 create2DDecomposition(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 create2DDecomposition(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 create2DDecomposition(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 create2DDecomposition(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 create2DDecomposition(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
new file mode 100644
index 000000000000..5479f65984ea
--- /dev/null
+++ b/svx/inc/svx/sdr/overlay/overlaytriangle.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_OVERLAY_OVERLAYTRIANGLE_HXX
+#define _SDR_OVERLAY_OVERLAYTRIANGLE_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ class OverlayTriangle : public OverlayObjectWithBasePosition
+ {
+ protected:
+ // second and third position in pixel
+ basegfx::B2DPoint maSecondPosition;
+ basegfx::B2DPoint maThirdPosition;
+
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
+
+ public:
+ OverlayTriangle(
+ const basegfx::B2DPoint& rBasePos,
+ const basegfx::B2DPoint& rSecondPos,
+ const basegfx::B2DPoint& rThirdPos,
+ Color aTriangleColor);
+ virtual ~OverlayTriangle();
+
+ // change second position
+ const basegfx::B2DPoint& getSecondPosition() const { return maSecondPosition; }
+ void setSecondPosition(const basegfx::B2DPoint& rNew);
+
+ // change third position
+ const basegfx::B2DPoint& getThirdPosition() const { return maThirdPosition; }
+ void setThirdPosition(const basegfx::B2DPoint& rNew);
+ };
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_OVERLAY_OVERLAYTRIANGLE_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/primitive2d/primitiveFactory2d.hxx b/svx/inc/svx/sdr/primitive2d/primitiveFactory2d.hxx
new file mode 100644
index 000000000000..09ba09a12f04
--- /dev/null
+++ b/svx/inc/svx/sdr/primitive2d/primitiveFactory2d.hxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SDR_PRIMITIVE2D_PRIMITIVEFACTORY2D_HXX
+#define INCLUDED_SDR_PRIMITIVE2D_PRIMITIVEFACTORY2D_HXX
+
+#include <com/sun/star/graphic/XPrimitiveFactory2D.hpp>
+#include <cppuhelper/compbase1.hxx>
+#include <comphelper/broadcasthelper.hxx>
+
+#include <svx/svxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// UNO API helper methods
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL XPrimitiveFactory2DProvider_createInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr) throw( ::com::sun::star::uno::Exception );
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// PrimitiveFactory2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ // typedef for PrimitiveFactory2DImplBase
+ typedef cppu::WeakComponentImplHelper1< ::com::sun::star::graphic::XPrimitiveFactory2D > PrimitiveFactory2DImplBase;
+
+ // base class for C++ implementation of com::sun::star::graphic::XPrimitiveFactory2D
+ class PrimitiveFactory2D
+ : protected comphelper::OBaseMutex,
+ public PrimitiveFactory2DImplBase
+ {
+ private:
+ protected:
+ public:
+ // constructor
+ PrimitiveFactory2D();
+
+ // Methods from XPrimitiveFactory2D
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XPrimitive2D > > SAL_CALL createPrimitivesFromXShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aParms ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XPrimitive2D > > SAL_CALL createPrimitivesFromXDrawPage( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aParms ) throw (::com::sun::star::uno::RuntimeException);
+
+ // UNO API helpers
+ SVX_DLLPUBLIC static rtl::OUString getImplementationName_Static();
+ SVX_DLLPUBLIC static com::sun::star::uno::Sequence< rtl::OUString > getSupportedServiceNames_Static();
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SDR_PRIMITIVE2D_PRIMITIVEFACTORY2D_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx b/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx
new file mode 100644
index 000000000000..9ea424217757
--- /dev/null
+++ b/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx
@@ -0,0 +1,140 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SDR_PRIMITIVE2D_SDRATTRIBUTECREATOR_HXX
+#define INCLUDED_SDR_PRIMITIVE2D_SDRATTRIBUTECREATOR_HXX
+
+#include <sal/types.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+class SfxItemSet;
+class SdrText;
+
+namespace drawinglayer { namespace attribute {
+ class SdrLineAttribute;
+ class SdrLineStartEndAttribute;
+ class SdrShadowAttribute;
+ class SdrFillAttribute;
+ class SdrTextAttribute;
+ class FillGradientAttribute;
+ class SdrFillBitmapAttribute;
+ class SdrShadowTextAttribute;
+ class SdrLineShadowTextAttribute;
+ class SdrLineFillShadowTextAttribute;
+ class SdrLineFillShadowAttribute3D;
+ class SdrSceneAttribute;
+ class SdrLightingAttribute;
+ class SdrFillTextAttribute;
+}}
+
+namespace basegfx {
+ class B2DRange;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ // SdrAttribute creators
+ attribute::SdrLineAttribute createNewSdrLineAttribute(
+ const SfxItemSet& rSet);
+
+ attribute::SdrLineStartEndAttribute createNewSdrLineStartEndAttribute(
+ const SfxItemSet& rSet,
+ double fWidth);
+
+ attribute::SdrShadowAttribute createNewSdrShadowAttribute(
+ const SfxItemSet& rSet);
+
+ attribute::SdrFillAttribute createNewSdrFillAttribute(
+ const SfxItemSet& rSet);
+
+ // #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(
+ const SfxItemSet& rSet,
+ const SdrText* pText,
+ bool bSuppressText); // #i98072# added option to suppress text on demand
+
+ attribute::SdrLineShadowTextAttribute createNewSdrLineShadowTextAttribute(
+ const SfxItemSet& rSet,
+ const SdrText* pText);
+
+ attribute::SdrLineFillShadowTextAttribute createNewSdrLineFillShadowTextAttribute(
+ const SfxItemSet& rSet,
+ const SdrText* pText);
+
+ attribute::SdrLineFillShadowAttribute3D createNewSdrLineFillShadowAttribute(
+ const SfxItemSet& rSet,
+ bool bSuppressFill);
+
+ attribute::SdrSceneAttribute createNewSdrSceneAttribute(
+ const SfxItemSet& rSet);
+
+ attribute::SdrLightingAttribute createNewSdrLightingAttribute(
+ const SfxItemSet& rSet);
+
+ // #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);
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SDR_PRIMITIVE2D_SDRATTRIBUTECREATOR_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx
new file mode 100644
index 000000000000..b8039fd33c61
--- /dev/null
+++ b/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SDR_PRIMITIVE2D_SDRCAPTIONPRIMITIVE2D_HXX
+#define INCLUDED_SDR_PRIMITIVE2D_SDRCAPTIONPRIMITIVE2D_HXX
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class SdrCaptionPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ ::basegfx::B2DHomMatrix maTransform;
+ attribute::SdrLineFillShadowTextAttribute maSdrLFSTAttribute;
+ ::basegfx::B2DPolygon maTail;
+ double mfCornerRadiusX; // [0.0..1.0] relative to 1/2 width
+ double mfCornerRadiusY; // [0.0..1.0] relative to 1/2 height
+
+ protected:
+ // local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
+
+ public:
+ SdrCaptionPrimitive2D(
+ const ::basegfx::B2DHomMatrix& rTransform,
+ const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute,
+ const ::basegfx::B2DPolygon& rTail,
+ double fCornerRadiusX = 0.0,
+ double fCornerRadiusY = 0.0);
+
+ // compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ // data access
+ const ::basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ const attribute::SdrLineFillShadowTextAttribute& getSdrLFSTAttribute() const { return maSdrLFSTAttribute; }
+ const ::basegfx::B2DPolygon& getTail() const { return maTail; }
+ double getCornerRadiusX() const { return mfCornerRadiusX; }
+ double getCornerRadiusY() const { return mfCornerRadiusY; }
+ bool isCornerRadiusUsed() const { return (0.0 != mfCornerRadiusX || 0.0 != mfCornerRadiusY); }
+
+ // provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SDR_PRIMITIVE2D_SDRCAPTIONPRIMITIVE2D_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx
new file mode 100644
index 000000000000..d532d733e60e
--- /dev/null
+++ b/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SDR_PRIMITIVE2D_SDRCONNECTORPRIMITIVE2D_HXX
+#define INCLUDED_SDR_PRIMITIVE2D_SDRCONNECTORPRIMITIVE2D_HXX
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <svx/sdr/attribute/sdrlineshadowtextattribute.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class SdrConnectorPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ attribute::SdrLineShadowTextAttribute maSdrLSTAttribute;
+ ::basegfx::B2DPolygon maUnitPolygon;
+
+ protected:
+ // local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
+
+ public:
+ SdrConnectorPrimitive2D(
+ const attribute::SdrLineShadowTextAttribute& rSdrLSTAttribute,
+ const ::basegfx::B2DPolygon& rUnitPolygon);
+
+ // data access
+ const attribute::SdrLineShadowTextAttribute& getSdrLSTAttribute() const { return maSdrLSTAttribute; }
+ const ::basegfx::B2DPolygon& getUnitPolygon() const { return maUnitPolygon; }
+
+ // compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ // provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SDR_PRIMITIVE2D_SDRCONNECTORPRIMITIVE2D_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx
new file mode 100644
index 000000000000..9b2a12e5d386
--- /dev/null
+++ b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SDR_PRIMITIVE2D_SDCUSTOMSHAPEPRIMITIVE2D_HXX
+#define INCLUDED_SDR_PRIMITIVE2D_SDCUSTOMSHAPEPRIMITIVE2D_HXX
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/attribute/sdrshadowtextattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class SdrCustomShapePrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ attribute::SdrShadowTextAttribute maSdrSTAttribute;
+ Primitive2DSequence maSubPrimitives;
+ basegfx::B2DHomMatrix maTextBox;
+
+ // bitfield
+ // defines if SdrTextWordWrapItem was set at SdrObjCustomShape which means
+ // that the text needs to be block formatted
+ unsigned mbWordWrap : 1;
+
+ // defines that the object contains/is a 3D AutoShape. Needed for
+ // making exceptions with shadow generation
+ unsigned mb3DShape : 1;
+
+ // #SJ# Allow text clipping against TextBox in special cases (used for SC)
+ unsigned mbForceTextClipToTextRange : 1;
+
+ protected:
+ // local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
+
+ public:
+ SdrCustomShapePrimitive2D(
+ const attribute::SdrShadowTextAttribute& rSdrSTAttribute,
+ const Primitive2DSequence& rSubPrimitives,
+ const basegfx::B2DHomMatrix& rTextBox,
+ bool bWordWrap,
+ bool b3DShape,
+ bool bForceTextClipToTextRange);
+
+ // data access
+ const attribute::SdrShadowTextAttribute& getSdrSTAttribute() const { return maSdrSTAttribute; }
+ const Primitive2DSequence& getSubPrimitives() const { return maSubPrimitives; }
+ const basegfx::B2DHomMatrix& getTextBox() const { return maTextBox; }
+ bool getWordWrap() const { return mbWordWrap; }
+ bool get3DShape() const { return mb3DShape; }
+ bool isForceTextClipToTextRange() const { return mbForceTextClipToTextRange; }
+
+ // compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ // provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SDR_PRIMITIVE2D_SDCUSTOMSHAPEPRIMITIVE2D_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx b/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx
new file mode 100644
index 000000000000..7ef8f3a3f476
--- /dev/null
+++ b/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SDR_PRIMITIVE2D_SDRDECOMPOSITIONTOOLS_HXX
+#define INCLUDED_SDR_PRIMITIVE2D_SDRDECOMPOSITIONTOOLS_HXX
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+namespace basegfx {
+ class B2DPolygon;
+ class B2DPolyPolygon;
+ class B2DHomMatrix;
+}
+
+namespace drawinglayer { namespace attribute {
+ class SdrFillAttribute;
+ class SdrLineAttribute;
+ class FillGradientAttribute;
+ class SdrShadowAttribute;
+ class SdrLineStartEndAttribute;
+ class SdrTextAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DReference createPolyPolygonFillPrimitive(
+ const basegfx::B2DPolyPolygon& rUnitPolyPolygon,
+ const basegfx::B2DHomMatrix& rObjectTransform,
+ const attribute::SdrFillAttribute& rFill,
+ const attribute::FillGradientAttribute& rFillGradient);
+
+ Primitive2DReference createPolygonLinePrimitive(
+ const basegfx::B2DPolygon& rUnitPolygon,
+ const basegfx::B2DHomMatrix& rObjectTransform,
+ const attribute::SdrLineAttribute& rLine,
+ const attribute::SdrLineStartEndAttribute& rStroke);
+
+ Primitive2DReference createTextPrimitive(
+ const basegfx::B2DPolyPolygon& rUnitPolyPolygon,
+ const basegfx::B2DHomMatrix& rObjectTransform,
+ const attribute::SdrTextAttribute& rText,
+ const attribute::SdrLineAttribute& rStroke,
+ bool bCellText,
+ bool bWordWrap,
+ bool bClipOnBounds);
+
+ Primitive2DSequence createEmbeddedShadowPrimitive(
+ const Primitive2DSequence& rContent,
+ const attribute::SdrShadowAttribute& rShadow);
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SDR_PRIMITIVE2D_SDRDECOMPOSITIONTOOLS_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx
new file mode 100644
index 000000000000..84f1dfad9b00
--- /dev/null
+++ b/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SDR_PRIMITIVE2D_SDRELLIPSEPRIMITIVE2D_HXX
+#define INCLUDED_SDR_PRIMITIVE2D_SDRELLIPSEPRIMITIVE2D_HXX
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class SdrEllipsePrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ ::basegfx::B2DHomMatrix maTransform;
+ attribute::SdrLineFillShadowTextAttribute maSdrLFSTAttribute;
+
+ protected:
+ // local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
+
+ public:
+ SdrEllipsePrimitive2D(
+ const ::basegfx::B2DHomMatrix& rTransform,
+ const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute);
+
+ // data access
+ const ::basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ const attribute::SdrLineFillShadowTextAttribute& getSdrLFSTAttribute() const { return maSdrLFSTAttribute; }
+
+ // compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ // provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class SdrEllipseSegmentPrimitive2D : public SdrEllipsePrimitive2D
+ {
+ private:
+ double mfStartAngle;
+ double mfEndAngle;
+
+ // bitfield
+ unsigned mbCloseSegment : 1;
+ unsigned mbCloseUsingCenter : 1;
+
+ protected:
+ // local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
+
+ public:
+ SdrEllipseSegmentPrimitive2D(
+ const ::basegfx::B2DHomMatrix& rTransform,
+ const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute,
+ double fStartAngle,
+ double fEndAngle,
+ bool bCloseSegment,
+ bool bCloseUsingCenter);
+
+ // data access
+ double getStartAngle() const { return mfStartAngle; }
+ double getEndAngle() const { return mfEndAngle; }
+ bool getCloseSegment() const { return mbCloseSegment; }
+ bool getCloseUsingCenter() const { return mbCloseUsingCenter; }
+
+ // compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ // provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SDR_PRIMITIVE2D_SDRELLIPSEPRIMITIVE2D_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx
new file mode 100644
index 000000000000..f488dfaa2ee4
--- /dev/null
+++ b/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SDR_PRIMITIVE2D_SDRGRAFPRIMITIVE2D_HXX
+#define INCLUDED_SDR_PRIMITIVE2D_SDRGRAFPRIMITIVE2D_HXX
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svtools/grfmgr.hxx>
+#include <svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class SdrGrafPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ ::basegfx::B2DHomMatrix maTransform;
+ attribute::SdrLineFillShadowTextAttribute maSdrLFSTAttribute;
+ GraphicObject maGraphicObject;
+ GraphicAttr maGraphicAttr;
+
+ protected:
+ // local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
+
+ public:
+ SdrGrafPrimitive2D(
+ const ::basegfx::B2DHomMatrix& rTransform,
+ const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute,
+ const GraphicObject& rGraphicObject,
+ const GraphicAttr& rGraphicAttr);
+
+ // data access
+ const ::basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ const attribute::SdrLineFillShadowTextAttribute& getSdrLFSTAttribute() const { return maSdrLFSTAttribute; }
+ const GraphicObject& getGraphicObject() const { return maGraphicObject; }
+ const GraphicAttr& getGraphicAttr() const { return maGraphicAttr; }
+ bool isTransparent() const;
+
+ // compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ // provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SDR_PRIMITIVE2D_SDRGRAFPRIMITIVE2D_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx
new file mode 100644
index 000000000000..943cbbf65940
--- /dev/null
+++ b/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SDR_PRIMITIVE2D_SDRMEASUREPRIMITIVE2D_HXX
+#define INCLUDED_SDR_PRIMITIVE2D_SDRMEASUREPRIMITIVE2D_HXX
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <svx/sdr/attribute/sdrlineshadowtextattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace drawinglayer { namespace primitive2d {
+ enum MeasureTextPosition
+ {
+ MEASURETEXTPOSITION_AUTOMATIC,
+ MEASURETEXTPOSITION_NEGATIVE,
+ MEASURETEXTPOSITION_CENTERED,
+ MEASURETEXTPOSITION_POSITIVE
+ };
+}}
+
+namespace drawinglayer { namespace attribute {
+ class SdrLineAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class SdrMeasurePrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ attribute::SdrLineShadowTextAttribute maSdrLSTAttribute;
+ basegfx::B2DPoint maStart;
+ basegfx::B2DPoint maEnd;
+ MeasureTextPosition meHorizontal;
+ MeasureTextPosition meVertical;
+ double mfDistance;
+ double mfUpper;
+ double mfLower;
+ double mfLeftDelta;
+ double mfRightDelta;
+
+ // bitfield
+ unsigned mbBelow : 1;
+ unsigned mbTextRotation : 1;
+ unsigned mbTextAutoAngle : 1;
+
+ // internal decomposition helper
+ Primitive2DReference impCreatePart(
+ const attribute::SdrLineAttribute& rLineAttribute,
+ const basegfx::B2DHomMatrix& rObjectMatrix,
+ const basegfx::B2DPoint& rStart,
+ const basegfx::B2DPoint& rEnd,
+ bool bLeftActive,
+ bool bRightActive) const;
+
+ protected:
+ // local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
+
+ public:
+ SdrMeasurePrimitive2D(
+ const attribute::SdrLineShadowTextAttribute& rSdrLSTAttribute,
+ const basegfx::B2DPoint& rStart,
+ const basegfx::B2DPoint& rEnd,
+ MeasureTextPosition eHorizontal,
+ MeasureTextPosition eVertical,
+ double fDistance,
+ double fUpper,
+ double fLower,
+ double fLeftDelta,
+ double fRightDelta,
+ bool bBelow,
+ bool bTextRotation,
+ bool bTextAutoAngle);
+
+ // data access
+ const attribute::SdrLineShadowTextAttribute& getSdrLSTAttribute() const { return maSdrLSTAttribute; }
+ const basegfx::B2DPoint& getStart() const { return maStart; }
+ const basegfx::B2DPoint& getEnd() const { return maEnd; }
+ MeasureTextPosition getHorizontal() const { return meHorizontal; }
+ MeasureTextPosition getVertical() const { return meVertical; }
+ double getDistance() const { return mfDistance; }
+ double getUpper() const { return mfUpper; }
+ double getLower() const { return mfLower; }
+ double getLeftDelta() const { return mfLeftDelta; }
+ double getRightDelta() const { return mfRightDelta; }
+ bool getBelow() const { return mbBelow; }
+ bool getTextRotation() const { return mbTextRotation; }
+ bool getTextAutoAngle() const { return mbTextAutoAngle; }
+
+ // compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ // provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SDR_PRIMITIVE2D_SDRMEASUREPRIMITIVE2D_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx
new file mode 100644
index 000000000000..45702d3300e3
--- /dev/null
+++ b/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SDR_PRIMITIVE2D_SDROLE2PRIMITIVE2D_HXX
+#define INCLUDED_SDR_PRIMITIVE2D_SDROLE2PRIMITIVE2D_HXX
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class SdrOle2Primitive2D : public BasePrimitive2D
+ {
+ private:
+ Primitive2DSequence maOLEContent;
+ basegfx::B2DHomMatrix maTransform;
+ attribute::SdrLineFillShadowTextAttribute maSdrLFSTAttribute;
+
+ public:
+ SdrOle2Primitive2D(
+ const Primitive2DSequence& rOLEContent,
+ const basegfx::B2DHomMatrix& rTransform,
+ const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute);
+
+ // data access
+ const Primitive2DSequence& getOLEContent() const { return maOLEContent; }
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ const attribute::SdrLineFillShadowTextAttribute& getSdrLFSTAttribute() const { return maSdrLFSTAttribute; }
+
+ // compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ // local decomposition.
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
+
+ // provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SDR_PRIMITIVE2D_SDROLE2PRIMITIVE2D_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx
new file mode 100644
index 000000000000..9aa5c854abfd
--- /dev/null
+++ b/svx/inc/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SDR_PRIMITIVE2D_SDROLECONTENTPRIMITIVE2D_HXX
+#define INCLUDED_SDR_PRIMITIVE2D_SDROLECONTENTPRIMITIVE2D_HXX
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/svdobj.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefinitions
+
+class SdrOle2Obj;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class SdrOleContentPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ SdrObjectWeakRef mpSdrOle2Obj;
+ basegfx::B2DHomMatrix maObjectTransform;
+
+ // #i104867# The GraphicVersion number to identify in operator== if
+ // the graphic has changed, but without fetching it (which may
+ // be expensive, e.g. triggering chart creation)
+ sal_uInt32 mnGraphicVersion;
+
+ // bitfield
+ unsigned mbHighContrast : 1;
+
+ protected:
+ // local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
+
+ public:
+ SdrOleContentPrimitive2D(
+ const SdrOle2Obj& rSdrOle2Obj,
+ const basegfx::B2DHomMatrix& rObjectTransform,
+ sal_uInt32 nGraphicVersion,
+ bool bHighContrast);
+
+ // compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ // The default implementation will use getDecomposition results to create the range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ // data access
+ const basegfx::B2DHomMatrix& getObjectTransform() const { return maObjectTransform; }
+ sal_uInt32 getGraphicVersion() const { return mnGraphicVersion; }
+ bool getHighContrast() const { return mbHighContrast; }
+
+ // provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SDR_PRIMITIVE2D_SDROLECONTENTPRIMITIVE2D_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx
new file mode 100644
index 000000000000..0601a0696c49
--- /dev/null
+++ b/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SDR_PRIMITIVE2D_SDRPATHPRIMITIVE2D_HXX
+#define INCLUDED_SDR_PRIMITIVE2D_SDRPATHPRIMITIVE2D_HXX
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class SdrPathPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ basegfx::B2DHomMatrix maTransform;
+ attribute::SdrLineFillShadowTextAttribute maSdrLFSTAttribute;
+ basegfx::B2DPolyPolygon maUnitPolyPolygon;
+
+ protected:
+ // local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
+
+ public:
+ SdrPathPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute,
+ const basegfx::B2DPolyPolygon& rUnitPolyPolygon);
+
+ // data access
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ const attribute::SdrLineFillShadowTextAttribute& getSdrLFSTAttribute() const { return maSdrLFSTAttribute; }
+ const basegfx::B2DPolyPolygon& getUnitPolyPolygon() const { return maUnitPolyPolygon; }
+
+ // compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ // provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SDR_PRIMITIVE2D_SDRPATHPRIMITIVE2D_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx b/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx
new file mode 100644
index 000000000000..b3472b4f13ba
--- /dev/null
+++ b/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SDR_PRIMITIVE2D_PRIMITIVETOOLS_HXX
+#define INCLUDED_SDR_PRIMITIVE2D_PRIMITIVETOOLS_HXX
+
+#include <vcl/bitmapex.hxx>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class BColor;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// helper methods
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ // create a 3x3 cross in given color as BitmapEx
+ BitmapEx createDefaultCross_3x3(const basegfx::BColor& rBColor);
+
+ // create a 7x7 gluepoint symbol in given colors as BitmapEx
+ BitmapEx createDefaultGluepoint_7x7(const basegfx::BColor& rBColorA, const basegfx::BColor& rBColorB);
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SDR_PRIMITIVE2D_PRIMITIVETOOLS_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx
new file mode 100644
index 000000000000..b5c42d850be0
--- /dev/null
+++ b/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SDR_PRIMITIVE2D_SDRRECTANGLEPRIMITIVE2D_HXX
+#define INCLUDED_SDR_PRIMITIVE2D_SDRRECTANGLEPRIMITIVE2D_HXX
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx>
+#include <svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class SdrRectanglePrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ basegfx::B2DHomMatrix maTransform;
+ attribute::SdrLineFillShadowTextAttribute maSdrLFSTAttribute;
+ double mfCornerRadiusX; // [0.0..1.0] relative to 1/2 width
+ double mfCornerRadiusY; // [0.0..1.0] relative to 1/2 height
+
+ // bitfield
+ // flag which decides if the HitArea should be the filled geometry
+ bool mbForceFillForHitTest : 1;
+
+ protected:
+ // local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
+
+ public:
+ SdrRectanglePrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute,
+ double fCornerRadiusX,
+ double fCornerRadiusY,
+ bool bForceFillForHitTest);
+
+ // data access
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ const attribute::SdrLineFillShadowTextAttribute& getSdrLFSTAttribute() const { return maSdrLFSTAttribute; }
+ double getCornerRadiusX() const { return mfCornerRadiusX; }
+ double getCornerRadiusY() const { return mfCornerRadiusY; }
+ bool isCornerRadiusUsed() const { return (0.0 != mfCornerRadiusX || 0.0 != mfCornerRadiusY); }
+ bool getForceFillForHitTest() const { return mbForceFillForHitTest; }
+
+ // compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ // provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SDR_PRIMITIVE2D_SDRRECTANGLEPRIMITIVE2D_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx
new file mode 100644
index 000000000000..a6e963c7ef13
--- /dev/null
+++ b/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx
@@ -0,0 +1,305 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SDR_PRIMITIVE2D_SDRTEXTPRIMITIVE2D_HXX
+#define INCLUDED_SDR_PRIMITIVE2D_SDRTEXTPRIMITIVE2D_HXX
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <editeng/outlobj.hxx>
+#include <tools/color.hxx>
+#include <svx/sdr/attribute/sdrformtextattribute.hxx>
+#include <tools/weakbase.hxx>
+#include <svx/sdtaitm.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+class SdrText;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class SdrTextPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ // The text model data; this sould later just be the OutlinerParaObject or
+ // something equal
+ ::tools::WeakReference< SdrText > mrSdrText;
+
+ // #i97628#
+ // 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
+ // is not given or different, the decomposition needs to be potentially removed
+ // for supporting e.g. page number change on MasterPage objects or the different
+ // 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
+ // 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
+ Primitive2DSequence encapsulateWithTextHierarchyBlockPrimitive2D(const Primitive2DSequence& rCandidate) const;
+
+ public:
+ SdrTextPrimitive2D(
+ const SdrText* pSdrText,
+ const OutlinerParaObject& rOutlinerParaObjectPtr);
+
+ // get data
+ const SdrText* getSdrText() const { return mrSdrText.get(); }
+ const OutlinerParaObject& getOutlinerParaObject() const { return maOutlinerParaObject; }
+
+ // compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ // own get2DDecomposition to take aspect of decomposition with or without spell checker
+ // into account
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ // transformed clone operator
+ virtual SdrTextPrimitive2D* createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const = 0;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class SdrContourTextPrimitive2D : public SdrTextPrimitive2D
+ {
+ private:
+ // 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.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
+
+ public:
+ SdrContourTextPrimitive2D(
+ const SdrText* pSdrText,
+ const OutlinerParaObject& rOutlinerParaObjectPtr,
+ const basegfx::B2DPolyPolygon& rUnitPolyPolygon,
+ const basegfx::B2DHomMatrix& rObjectTransform);
+
+ // get data
+ 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;
+
+ // provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class SdrPathTextPrimitive2D : public SdrTextPrimitive2D
+ {
+ private:
+ // the path to use. Each paragraph will use one Polygon.
+ basegfx::B2DPolyPolygon maPathPolyPolygon;
+
+ // the Fontwork parameters
+ attribute::SdrFormTextAttribute maSdrFormTextAttribute;
+
+ protected:
+ // local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
+
+ public:
+ SdrPathTextPrimitive2D(
+ const SdrText* pSdrText,
+ const OutlinerParaObject& rOutlinerParaObjectPtr,
+ const basegfx::B2DPolyPolygon& rPathPolyPolygon,
+ const attribute::SdrFormTextAttribute& rSdrFormTextAttribute);
+
+ // get data
+ 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;
+
+ // provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class SdrBlockTextPrimitive2D : public SdrTextPrimitive2D
+ {
+ private:
+ // text range transformation from unit range ([0.0 .. 1.0]) to text range
+ basegfx::B2DHomMatrix maTextRangeTransform;
+
+ // text alignments
+ SdrTextHorzAdjust maSdrTextHorzAdjust;
+ SdrTextVertAdjust maSdrTextVertAdjust;
+
+ // bitfield
+ unsigned mbFixedCellHeight : 1;
+ unsigned mbUnlimitedPage : 1; // force layout with no text break
+ unsigned mbCellText : 1; // this is a cell text as block text
+ unsigned mbWordWrap : 1; // for CustomShapes text layout
+ unsigned mbClipOnBounds : 1; // for CustomShapes text layout
+
+ protected:
+ // local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
+
+ public:
+ SdrBlockTextPrimitive2D(
+ const SdrText* pSdrText,
+ const OutlinerParaObject& rOutlinerParaObjectPtr,
+ const basegfx::B2DHomMatrix& rTextRangeTransform,
+ SdrTextHorzAdjust aSdrTextHorzAdjust,
+ SdrTextVertAdjust aSdrTextVertAdjust,
+ bool bFixedCellHeight,
+ bool bUnlimitedPage,
+ bool bCellText,
+ bool bWordWrap,
+ bool bClipOnBounds);
+
+ // get data
+ const basegfx::B2DHomMatrix& getTextRangeTransform() const { return maTextRangeTransform; }
+ SdrTextHorzAdjust getSdrTextHorzAdjust() const { return maSdrTextHorzAdjust; }
+ SdrTextVertAdjust getSdrTextVertAdjust() const { return maSdrTextVertAdjust; }
+ bool isFixedCellHeight() const { return mbFixedCellHeight; }
+ bool getUnlimitedPage() const { return mbUnlimitedPage; }
+ bool getCellText() const { return mbCellText; }
+ bool getWordWrap() const { return mbWordWrap; }
+ bool getClipOnBounds() const { return mbClipOnBounds; }
+
+ // compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ // transformed clone operator
+ virtual SdrTextPrimitive2D* createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const;
+
+ // provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class SdrStretchTextPrimitive2D : public SdrTextPrimitive2D
+ {
+ private:
+ // text range transformation from unit range ([0.0 .. 1.0]) to text range
+ basegfx::B2DHomMatrix maTextRangeTransform;
+
+ // bitfield
+ unsigned mbFixedCellHeight : 1;
+
+ protected:
+ // local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
+
+ public:
+ SdrStretchTextPrimitive2D(
+ const SdrText* pSdrText,
+ const OutlinerParaObject& rOutlinerParaObjectPtr,
+ const basegfx::B2DHomMatrix& rTextRangeTransform,
+ bool bFixedCellHeight);
+
+ // get data
+ const basegfx::B2DHomMatrix& getTextRangeTransform() const { return maTextRangeTransform; }
+ bool isFixedCellHeight() const { return mbFixedCellHeight; }
+
+ // compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ // transformed clone operator
+ virtual SdrTextPrimitive2D* createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const;
+
+ // provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SDR_PRIMITIVE2D_SDRTEXTPRIMITIVE2D_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx b/svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx
new file mode 100644
index 000000000000..53707f18fa4b
--- /dev/null
+++ b/svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SVX_PRIMITIVE2D_PRIMITIVETYPES2D_HXX
+#define INCLUDED_SVX_PRIMITIVE2D_PRIMITIVETYPES2D_HXX
+
+#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+#define PRIMITIVE2D_ID_SDRCAPTIONPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 0)
+#define PRIMITIVE2D_ID_SDRCONNECTORPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 1)
+#define PRIMITIVE2D_ID_SDRCUSTOMSHAPEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 2)
+#define PRIMITIVE2D_ID_SDRELLIPSEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 3)
+#define PRIMITIVE2D_ID_SDRELLIPSESEGMENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 4)
+#define PRIMITIVE2D_ID_SDRGRAFPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 5)
+#define PRIMITIVE2D_ID_SDRMEASUREPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 6)
+#define PRIMITIVE2D_ID_SDROLE2PRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 7)
+#define PRIMITIVE2D_ID_SDRPATHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 8)
+#define PRIMITIVE2D_ID_SDRRECTANGLEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 9)
+#define PRIMITIVE2D_ID_SDRCONTOURTEXTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 10)
+#define PRIMITIVE2D_ID_SDRPATHTEXTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 11)
+#define PRIMITIVE2D_ID_SDRBLOCKTEXTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 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)
+#define PRIMITIVE2D_ID_SDROLECONTENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 22)
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_SVX_PRIMITIVE2D_PRIMITIVETYPES2D_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/inc/svx/sdr/primitive3d/sdrattributecreator3d.hxx b/svx/inc/svx/sdr/primitive3d/sdrattributecreator3d.hxx
new file mode 100644
index 000000000000..809d3f71b11c
--- /dev/null
+++ b/svx/inc/svx/sdr/primitive3d/sdrattributecreator3d.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_PRIMITIVE3D_SDRATTRIBUTECREATOR3D_HXX
+#define _SDR_PRIMITIVE3D_SDRATTRIBUTECREATOR3D_HXX
+
+#include <sal/types.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+class SfxItemSet;
+
+namespace drawinglayer { namespace attribute {
+ class Sdr3DObjectAttribute;
+}}
+
+namespace basegfx {
+ class B2DRange;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ // SdrAttribute creators
+ attribute::Sdr3DObjectAttribute* createNewSdr3DObjectAttribute(const SfxItemSet& rSet);
+
+ // helpers
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_PRIMITIVE3D_SDRATTRIBUTECREATOR3D_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/properties/attributeproperties.hxx b/svx/inc/svx/sdr/properties/attributeproperties.hxx
new file mode 100644
index 000000000000..a8df62b52a67
--- /dev/null
+++ b/svx/inc/svx/sdr/properties/attributeproperties.hxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_PROPERTIES_ATTRIBUTEPROPERTIES_HXX
+#define _SDR_PROPERTIES_ATTRIBUTEPROPERTIES_HXX
+
+#include <svl/lstner.hxx>
+#include <svx/sdr/properties/defaultproperties.hxx>
+#include "svx/svxdllapi.h"
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ class SVX_DLLPUBLIC AttributeProperties : public DefaultProperties, public SfxListener
+ {
+ // add style sheet, do all the necessary handling
+ void ImpAddStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr);
+
+ // remove StyleSheet, do all the necessary handling
+ void ImpRemoveStyleSheet();
+
+ protected:
+ // the SytleSheet of this object
+ SfxStyleSheet* mpStyleSheet;
+
+ // create a new itemset
+ virtual SfxItemSet& CreateObjectSpecificItemSet(SfxItemPool& pPool);
+
+ // Do the ItemChange, may do special handling
+ virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = 0);
+
+ // react on ItemSet changes
+ virtual void ItemSetChanged(const SfxItemSet& rSet);
+
+ public:
+ // basic constructor
+ AttributeProperties(SdrObject& rObj);
+
+ // constructor for copying, but using new object
+ AttributeProperties(const AttributeProperties& rProps, SdrObject& rObj);
+
+ // Clone() operator, normally just calls the local copy constructor
+ virtual BaseProperties& Clone(SdrObject& rObj) const;
+
+ // destructor
+ virtual ~AttributeProperties();
+
+ // set a new StyleSheet and broadcast
+ virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr);
+
+ // get the installed StyleSheet
+ virtual SfxStyleSheet* GetStyleSheet() const;
+
+ // Move properties to a new ItemPool.
+ virtual void MoveToItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel = 0L);
+
+ // Set new model.
+ virtual void SetModel(SdrModel* pOldModel, SdrModel* pNewModel);
+
+ // force all attributes which come from styles to hard attributes
+ // to be able to live without the style.
+ virtual void ForceStyleToHardAttributes();
+
+ // This is the Notify(...) from 2nd base class SfxListener
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
+ };
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_PROPERTIES_ATTRIBUTEPROPERTIES_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/properties/captionproperties.hxx b/svx/inc/svx/sdr/properties/captionproperties.hxx
new file mode 100644
index 000000000000..124bc19b67f1
--- /dev/null
+++ b/svx/inc/svx/sdr/properties/captionproperties.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_PROPERTIES_CAPTIONPROPERTIES_HXX
+#define _SDR_PROPERTIES_CAPTIONPROPERTIES_HXX
+
+#include <svx/sdr/properties/rectangleproperties.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ class CaptionProperties : public RectangleProperties
+ {
+ protected:
+ // create a new itemset
+ virtual SfxItemSet& CreateObjectSpecificItemSet(SfxItemPool& rPool);
+
+ // react on ItemSet changes
+ virtual void ItemSetChanged(const SfxItemSet& rSet);
+
+ public:
+ // basic constructor
+ CaptionProperties(SdrObject& rObj);
+
+ // constructor for copying, but using new object
+ CaptionProperties(const CaptionProperties& rProps, SdrObject& rObj);
+
+ // destructor
+ virtual ~CaptionProperties();
+
+ // Clone() operator, normally just calls the local copy constructor
+ virtual BaseProperties& Clone(SdrObject& rObj) const;
+
+ // set a new StyleSheet and broadcast
+ virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr);
+
+ // force default attributes for a specific object type, called from
+ // DefaultProperties::GetObjectItemSet() if a new ItemSet is created
+ virtual void ForceDefaultAttributes();
+ };
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // _SDR_PROPERTIES_CAPTIONPROPERTIES_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/properties/circleproperties.hxx b/svx/inc/svx/sdr/properties/circleproperties.hxx
new file mode 100644
index 000000000000..57efd50b0e01
--- /dev/null
+++ b/svx/inc/svx/sdr/properties/circleproperties.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_PROPERTIES_CIRCLEPROPERTIES_HXX
+#define _SDR_PROPERTIES_CIRCLEPROPERTIES_HXX
+
+#include <svx/sdr/properties/rectangleproperties.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ class CircleProperties : public RectangleProperties
+ {
+ protected:
+ // create a new itemset
+ virtual SfxItemSet& CreateObjectSpecificItemSet(SfxItemPool& rPool);
+
+ // react on ItemSet changes
+ virtual void ItemSetChanged(const SfxItemSet& rSet);
+
+ public:
+ // basic constructor
+ CircleProperties(SdrObject& rObj);
+
+ // constructor for copying, but using new object
+ CircleProperties(const CircleProperties& rProps, SdrObject& rObj);
+
+ // destructor
+ virtual ~CircleProperties();
+
+ // Clone() operator, normally just calls the local copy constructor
+ virtual BaseProperties& Clone(SdrObject& rObj) const;
+
+ // set a new StyleSheet and broadcast
+ virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr);
+
+ // force default attributes for a specific object type, called from
+ // DefaultProperties::GetObjectItemSet() if a new ItemSet is created
+ virtual void ForceDefaultAttributes();
+ };
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_PROPERTIES_CIRCLEPROPERTIES_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/properties/connectorproperties.hxx b/svx/inc/svx/sdr/properties/connectorproperties.hxx
new file mode 100644
index 000000000000..30752f149200
--- /dev/null
+++ b/svx/inc/svx/sdr/properties/connectorproperties.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_PROPERTIES_CONNECTORPROPERTIES_HXX
+#define _SDR_PROPERTIES_CONNECTORPROPERTIES_HXX
+
+#include <svx/sdr/properties/textproperties.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ class ConnectorProperties : public TextProperties
+ {
+ protected:
+ // create a new itemset
+ virtual SfxItemSet& CreateObjectSpecificItemSet(SfxItemPool& rPool);
+
+ // react on ItemSet changes
+ virtual void ItemSetChanged(const SfxItemSet& rSet);
+
+ public:
+ // basic constructor
+ ConnectorProperties(SdrObject& rObj);
+
+ // constructor for copying, but using new object
+ ConnectorProperties(const ConnectorProperties& rProps, SdrObject& rObj);
+
+ // destructor
+ virtual ~ConnectorProperties();
+
+ // Clone() operator, normally just calls the local copy constructor
+ virtual BaseProperties& Clone(SdrObject& rObj) const;
+
+ // set a new StyleSheet and broadcast
+ virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr);
+ };
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_PROPERTIES_CONNECTORPROPERTIES_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/properties/customshapeproperties.hxx b/svx/inc/svx/sdr/properties/customshapeproperties.hxx
new file mode 100644
index 000000000000..8adbf10107d9
--- /dev/null
+++ b/svx/inc/svx/sdr/properties/customshapeproperties.hxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_PROPERTIES_CUSTOMSHAPEPROPERTIES_HXX
+#define _SDR_PROPERTIES_CUSTOMSHAPEPROPERTIES_HXX
+
+#include <svx/sdr/properties/textproperties.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ class CustomShapeProperties : public TextProperties
+ {
+ void UpdateTextFrameStatus();
+
+ protected:
+ // create a new itemset
+ virtual SfxItemSet& CreateObjectSpecificItemSet(SfxItemPool& rPool);
+
+ // test changeability for a single item
+ virtual sal_Bool AllowItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = 0) const;
+
+ // react on ItemSet changes
+ virtual void ItemSetChanged(const SfxItemSet& rSet);
+
+ // react on Item change
+ virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem);
+
+ // clear single item
+ virtual void ClearObjectItem(const sal_uInt16 nWhich = 0);
+
+ // clear single item direct, do not do any notifies or things like that.
+ // Also supports complete deleteion of items when default parameter 0 is used.
+ virtual void ClearObjectItemDirect(const sal_uInt16 nWhich = 0);
+
+ public:
+
+ // set a new StyleSheet and broadcast
+ virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr);
+
+ // force default attributes for a specific object type, called from
+ // DefaultProperties::GetObjectItemSet() if a new ItemSet is created
+ virtual void ForceDefaultAttributes();
+
+ // basic constructor
+ CustomShapeProperties(SdrObject& rObj);
+
+ // constructor for copying, but using new object
+ CustomShapeProperties(const CustomShapeProperties& rProps, SdrObject& rObj);
+
+ // destructor
+ virtual ~CustomShapeProperties();
+
+ // Clone() operator, normally just calls the local copy constructor
+ virtual BaseProperties& Clone(SdrObject& rObj) const;
+
+ // This is the notifyer from SfxListener
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
+ };
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_PROPERTIES_CUSTOMSHAPEPROPERTIES_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/properties/defaultproperties.hxx b/svx/inc/svx/sdr/properties/defaultproperties.hxx
new file mode 100644
index 000000000000..58aceccadf1a
--- /dev/null
+++ b/svx/inc/svx/sdr/properties/defaultproperties.hxx
@@ -0,0 +1,112 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_PROPERTIES_DEFAULTPROPERTIES_HXX
+#define _SDR_PROPERTIES_DEFAULTPROPERTIES_HXX
+
+#include <svx/sdr/properties/properties.hxx>
+#include "svx/svxdllapi.h"
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ class SVX_DLLPUBLIC DefaultProperties : public BaseProperties
+ {
+ protected:
+ // the to be used ItemSet
+ SfxItemSet* mpItemSet;
+
+ // create a new itemset
+ virtual SfxItemSet& CreateObjectSpecificItemSet(SfxItemPool& rPool);
+
+ // test changeability for a single item
+ virtual sal_Bool AllowItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = 0) const;
+
+ // Do the ItemChange, may do special handling
+ virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = 0);
+
+ // Called after ItemChange() is done for all items.
+ virtual void PostItemChange(const sal_uInt16 nWhich);
+
+ // react on ItemSet changes
+ virtual void ItemSetChanged(const SfxItemSet& rSet);
+
+ public:
+ // basic constructor
+ DefaultProperties(SdrObject& rObj);
+
+ // constructor for copying, but using new object
+ DefaultProperties(const DefaultProperties& rProps, SdrObject& rObj);
+
+ // destructor
+ virtual ~DefaultProperties();
+
+ // Clone() operator, normally just calls the local copy constructor
+ virtual BaseProperties& Clone(SdrObject& rObj) const;
+
+ // get itemset
+ virtual const SfxItemSet& GetObjectItemSet() const;
+
+ // set single item
+ virtual void SetObjectItem(const SfxPoolItem& rItem);
+
+ // set single item direct, do not do any notifies or things like that
+ virtual void SetObjectItemDirect(const SfxPoolItem& rItem);
+
+ // clear single item
+ virtual void ClearObjectItem(const sal_uInt16 nWhich = 0);
+
+ // clear single item direct, do not do any notifies or things like that.
+ // Also supports complete deleteion of items when default parameter 0 is used.
+ virtual void ClearObjectItemDirect(const sal_uInt16 nWhich = 0);
+
+ // set complete item set
+ virtual void SetObjectItemSet(const SfxItemSet& rSet);
+
+ // set a new StyleSheet and broadcast
+ virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr);
+
+ // get the installed StyleSheet
+ virtual SfxStyleSheet* GetStyleSheet() const;
+
+ // force default attributes for a specific object type, called from
+ // DefaultProperties::GetObjectItemSet() if a new ItemSet is created.
+ // Default implementation does nothing.
+ virtual void ForceDefaultAttributes();
+
+ // Scale the included ItemSet.
+ virtual void Scale(const Fraction& rScale);
+ };
+ } // end of namespace properties
+} // end of namespace sdr
+
+#endif //_SDR_PROPERTIES_DEFAULTPROPERTIES_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/properties/e3dcompoundproperties.hxx b/svx/inc/svx/sdr/properties/e3dcompoundproperties.hxx
new file mode 100644
index 000000000000..085da6720382
--- /dev/null
+++ b/svx/inc/svx/sdr/properties/e3dcompoundproperties.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_PROPERTIES_E3DCOMPOUNDPROPERTIES_HXX
+#define _SDR_PROPERTIES_E3DCOMPOUNDPROPERTIES_HXX
+
+#include <svx/sdr/properties/e3dproperties.hxx>
+#include "svx/svxdllapi.h"
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ class SVX_DLLPUBLIC E3dCompoundProperties : public E3dProperties
+ {
+ protected:
+ // Called after ItemChange() is done for all items.
+ virtual void PostItemChange(const sal_uInt16 nWhich);
+
+ public:
+ // basic constructor
+ E3dCompoundProperties(SdrObject& rObj);
+
+ // constructor for copying, but using new object
+ E3dCompoundProperties(const E3dCompoundProperties& rProps, SdrObject& rObj);
+
+ // destructor
+ virtual ~E3dCompoundProperties();
+
+ // Clone() operator, normally just calls the local copy constructor
+ virtual BaseProperties& Clone(SdrObject& rObj) const;
+
+ // get itemset
+ virtual const SfxItemSet& GetObjectItemSet() const;
+
+ // Get merged ItemSet. Normally, this maps directly to GetObjectItemSet(), but may
+ // be overloaded e.g for group objects to return a merged ItemSet of the object.
+ // When using this method the returned ItemSet may contain items in the state
+ // SFX_ITEM_DONTCARE which means there were several such items with different
+ // values.
+ virtual const SfxItemSet& GetMergedItemSet() const;
+
+ // Set merged ItemSet. Normally, this maps to SetObjectItemSet().
+ virtual void SetMergedItemSet(const SfxItemSet& rSet, sal_Bool bClearAllItems = sal_False);
+ };
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // _SDR_PROPERTIES_E3DCOMPOUNDPROPERTIES_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/properties/e3dextrudeproperties.hxx b/svx/inc/svx/sdr/properties/e3dextrudeproperties.hxx
new file mode 100644
index 000000000000..f6baf589d642
--- /dev/null
+++ b/svx/inc/svx/sdr/properties/e3dextrudeproperties.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_PROPERTIES_E3DEXTRUDEPROPERTIES_HXX
+#define _SDR_PROPERTIES_E3DEXTRUDEPROPERTIES_HXX
+
+#include <svx/sdr/properties/e3dcompoundproperties.hxx>
+#include "svx/svxdllapi.h"
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ class SVX_DLLPUBLIC E3dExtrudeProperties : public E3dCompoundProperties
+ {
+ protected:
+ // Called after ItemChange() is done for all items.
+ virtual void PostItemChange(const sal_uInt16 nWhich);
+
+ public:
+ // basic constructor
+ E3dExtrudeProperties(SdrObject& rObj);
+
+ // constructor for copying, but using new object
+ E3dExtrudeProperties(const E3dExtrudeProperties& rProps, SdrObject& rObj);
+
+ // destructor
+ virtual ~E3dExtrudeProperties();
+
+ // Clone() operator, normally just calls the local copy constructor
+ virtual BaseProperties& Clone(SdrObject& rObj) const;
+ };
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // _SDR_PROPERTIES_E3DEXTRUDEPROPERTIES_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/properties/e3dlatheproperties.hxx b/svx/inc/svx/sdr/properties/e3dlatheproperties.hxx
new file mode 100644
index 000000000000..37810b36de0e
--- /dev/null
+++ b/svx/inc/svx/sdr/properties/e3dlatheproperties.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_PROPERTIES_E3DLATHEPROPERTIES_HXX
+#define _SDR_PROPERTIES_E3DLATHEPROPERTIES_HXX
+
+#include <svx/sdr/properties/e3dcompoundproperties.hxx>
+#include "svx/svxdllapi.h"
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ class SVX_DLLPUBLIC E3dLatheProperties : public E3dCompoundProperties
+ {
+ protected:
+ // Called after ItemChange() is done for all items.
+ virtual void PostItemChange(const sal_uInt16 nWhich);
+
+ public:
+ // basic constructor
+ E3dLatheProperties(SdrObject& rObj);
+
+ // constructor for copying, but using new object
+ E3dLatheProperties(const E3dLatheProperties& rProps, SdrObject& rObj);
+
+ // destructor
+ virtual ~E3dLatheProperties();
+
+ // Clone() operator, normally just calls the local copy constructor
+ virtual BaseProperties& Clone(SdrObject& rObj) const;
+ };
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // _SDR_PROPERTIES_E3DLATHEPROPERTIES_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/properties/e3dproperties.hxx b/svx/inc/svx/sdr/properties/e3dproperties.hxx
new file mode 100644
index 000000000000..957e37cac0b6
--- /dev/null
+++ b/svx/inc/svx/sdr/properties/e3dproperties.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_PROPERTIES_E3DPROPERTIES_HXX
+#define _SDR_PROPERTIES_E3DPROPERTIES_HXX
+
+#include <svx/sdr/properties/attributeproperties.hxx>
+#include "svx/svxdllapi.h"
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ class SVX_DLLPUBLIC E3dProperties : public AttributeProperties
+ {
+ protected:
+ // create a new itemset
+ virtual SfxItemSet& CreateObjectSpecificItemSet(SfxItemPool& rPool);
+
+ // react on ItemSet changes
+ virtual void ItemSetChanged(const SfxItemSet& rSet);
+
+ public:
+ // basic constructor
+ E3dProperties(SdrObject& rObj);
+
+ // constructor for copying, but using new object
+ E3dProperties(const E3dProperties& rProps, SdrObject& rObj);
+
+ // destructor
+ virtual ~E3dProperties();
+
+ // Clone() operator, normally just calls the local copy constructor
+ virtual BaseProperties& Clone(SdrObject& rObj) const;
+
+ // set a new StyleSheet and broadcast
+ virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr);
+ };
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // _SDR_PROPERTIES_E3DPROPERTIES_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/properties/e3dsceneproperties.hxx b/svx/inc/svx/sdr/properties/e3dsceneproperties.hxx
new file mode 100644
index 000000000000..0ef471999fb6
--- /dev/null
+++ b/svx/inc/svx/sdr/properties/e3dsceneproperties.hxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_PROPERTIES_E3DSCENEPROPERTIES_HXX
+#define _SDR_PROPERTIES_E3DSCENEPROPERTIES_HXX
+
+#include <svx/sdr/properties/e3dproperties.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ class E3dSceneProperties : public E3dProperties
+ {
+ protected:
+ // Called after ItemChange() is done for all items.
+ virtual void PostItemChange(const sal_uInt16 nWhich);
+
+ public:
+ // basic constructor
+ E3dSceneProperties(SdrObject& rObj);
+
+ // constructor for copying, but using new object
+ E3dSceneProperties(const E3dSceneProperties& rProps, SdrObject& rObj);
+
+ // destructor
+ virtual ~E3dSceneProperties();
+
+ // Clone() operator, normally just calls the local copy constructor
+ virtual BaseProperties& Clone(SdrObject& rObj) const;
+
+ // get itemset
+ virtual const SfxItemSet& GetObjectItemSet() const;
+
+ // get merged ItemSet. Normappl, this maps directly to GetObjectItemSet(), but may
+ // be overloaded e.g for group objects to return a merged ItemSet of the object.
+ // When using this method the returned ItemSet may contain items in the state
+ // SFX_ITEM_DONTCARE which means there were several such items with different
+ // values.
+ virtual const SfxItemSet& GetMergedItemSet() const;
+
+ // Set merged ItemSet. Normally, this maps to SetObjectItemSet().
+ virtual void SetMergedItemSet(const SfxItemSet& rSet, sal_Bool bClearAllItems = sal_False);
+
+ // Set a single item, iterate over hierarchies if necessary.
+ virtual void SetMergedItem(const SfxPoolItem& rItem);
+
+ // Clear a single item, iterate over hierarchies if necessary.
+ virtual void ClearMergedItem(const sal_uInt16 nWhich = 0);
+
+ // set a new StyleSheet and broadcast
+ virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr);
+
+ // get the installed StyleSheet
+ virtual SfxStyleSheet* GetStyleSheet() const;
+
+ // Move properties to a new ItemPool. Default implementation does nothing.
+ virtual void MoveToItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel = 0L);
+
+ // Special for scene:
+ void SetSceneItemsFromCamera();
+ };
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // _SDR_PROPERTIES_E3DSCENEPROPERTIES_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/properties/e3dsphereproperties.hxx b/svx/inc/svx/sdr/properties/e3dsphereproperties.hxx
new file mode 100644
index 000000000000..73b68b04e418
--- /dev/null
+++ b/svx/inc/svx/sdr/properties/e3dsphereproperties.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_PROPERTIES_E3DSPHEREPROPERTIES_HXX
+#define _SDR_PROPERTIES_E3DSPHEREPROPERTIES_HXX
+
+#include <svx/sdr/properties/e3dcompoundproperties.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ class E3dSphereProperties : public E3dCompoundProperties
+ {
+ protected:
+ // Called after ItemChange() is done for all items.
+ virtual void PostItemChange(const sal_uInt16 nWhich);
+
+ public:
+ // basic constructor
+ E3dSphereProperties(SdrObject& rObj);
+
+ // constructor for copying, but using new object
+ E3dSphereProperties(const E3dSphereProperties& rProps, SdrObject& rObj);
+
+ // destructor
+ virtual ~E3dSphereProperties();
+
+ // Clone() operator, normally just calls the local copy constructor
+ virtual BaseProperties& Clone(SdrObject& rObj) const;
+ };
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // _SDR_PROPERTIES_E3DSPHEREPROPERTIES_HXX
+
+// eof
+
diff --git a/svx/inc/svx/sdr/properties/emptyproperties.hxx b/svx/inc/svx/sdr/properties/emptyproperties.hxx
new file mode 100644
index 000000000000..8cab0b03ca41
--- /dev/null
+++ b/svx/inc/svx/sdr/properties/emptyproperties.hxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_PROPERTIES_EMPTYPROPERTIES_HXX
+#define _SDR_PROPERTIES_EMPTYPROPERTIES_HXX
+
+#include <svx/sdr/properties/properties.hxx>
+#include "svx/svxdllapi.h"
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ class SVX_DLLPUBLIC EmptyProperties : public BaseProperties
+ {
+ protected:
+ // the to be used ItemSet
+ SfxItemSet* mpEmptyItemSet;
+
+ // create a new itemset
+ virtual SfxItemSet& CreateObjectSpecificItemSet(SfxItemPool& rPool);
+
+ // test changeability for a single item
+ virtual sal_Bool AllowItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = 0) const;
+
+ // Do the ItemChange, may do special handling
+ virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = 0);
+
+ // Called after ItemChange() is done for all items.
+ virtual void PostItemChange(const sal_uInt16 nWhich);
+
+ // react on ItemSet changes
+ virtual void ItemSetChanged(const SfxItemSet& rSet);
+
+ public:
+ // basic constructor
+ EmptyProperties(SdrObject& rObj);
+
+ // constructor for copying, but using new object
+ EmptyProperties(const EmptyProperties& rProps, SdrObject& rObj);
+
+ // destructor
+ virtual ~EmptyProperties();
+
+ // Clone() operator, normally just calls the local copy constructor
+ virtual BaseProperties& Clone(SdrObject& rObj) const;
+
+ // get itemset
+ virtual const SfxItemSet& GetObjectItemSet() const;
+
+ // set single item
+ virtual void SetObjectItem(const SfxPoolItem& rItem);
+
+ // set single item direct, do not do any notifies or things like that
+ virtual void SetObjectItemDirect(const SfxPoolItem& rItem);
+
+ // clear single item
+ virtual void ClearObjectItem(const sal_uInt16 nWhich = 0);
+
+ // clear single item direct, do not do any notifies or things like that.
+ // Also supports complete deleteion of items when default parameter 0 is used.
+ virtual void ClearObjectItemDirect(const sal_uInt16 nWhich = 0);
+
+ // set complete item set
+ virtual void SetObjectItemSet(const SfxItemSet& rSet);
+
+ // set a new StyleSheet and broadcast
+ virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr);
+
+ // get the installed StyleSheet
+ virtual SfxStyleSheet* GetStyleSheet() const;
+ };
+ } // end of namespace properties
+} // end of namespace sdr
+
+#endif //_SDR_PROPERTIES_EMPTYPROPERTIES_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/properties/graphicproperties.hxx b/svx/inc/svx/sdr/properties/graphicproperties.hxx
new file mode 100644
index 000000000000..b3e04a67da55
--- /dev/null
+++ b/svx/inc/svx/sdr/properties/graphicproperties.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_PROPERTIES_GRAPHICPROPERTIES_HXX
+#define _SDR_PROPERTIES_GRAPHICPROPERTIES_HXX
+
+#include <svx/sdr/properties/rectangleproperties.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ class GraphicProperties : public RectangleProperties
+ {
+ protected:
+ // create a new itemset
+ virtual SfxItemSet& CreateObjectSpecificItemSet(SfxItemPool& rPool);
+
+ // react on ItemSet changes
+ virtual void ItemSetChanged(const SfxItemSet& rSet);
+
+ public:
+ // basic constructor
+ GraphicProperties(SdrObject& rObj);
+
+ // constructor for copying, but using new object
+ GraphicProperties(const GraphicProperties& rProps, SdrObject& rObj);
+
+ // destructor
+ virtual ~GraphicProperties();
+
+ // Clone() operator, normally just calls the local copy constructor
+ virtual BaseProperties& Clone(SdrObject& rObj) const;
+
+ // set a new StyleSheet and broadcast
+ virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr);
+
+ // force default attributes for a specific object type, called from
+ // DefaultProperties::GetObjectItemSet() if a new ItemSet is created
+ virtual void ForceDefaultAttributes();
+ };
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_PROPERTIES_GRAPHICPROPERTIES_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/properties/groupproperties.hxx b/svx/inc/svx/sdr/properties/groupproperties.hxx
new file mode 100644
index 000000000000..f91f91db42d4
--- /dev/null
+++ b/svx/inc/svx/sdr/properties/groupproperties.hxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_PROPERTIES_GROUPPROPERTIES_HXX
+#define _SDR_PROPERTIES_GROUPPROPERTIES_HXX
+
+#include <svx/sdr/properties/defaultproperties.hxx>
+
+/////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ class GroupProperties : public DefaultProperties
+ {
+ protected:
+ // create a new itemset
+ virtual SfxItemSet& CreateObjectSpecificItemSet(SfxItemPool& rPool);
+
+ // test changeability for a single item
+ virtual sal_Bool AllowItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = 0) const;
+
+ // Do the ItemChange, may do special handling
+ virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = 0);
+
+ // Called after ItemChange() is done for all items.
+ virtual void PostItemChange(const sal_uInt16 nWhich);
+
+ // react on ItemSet changes
+ virtual void ItemSetChanged(const SfxItemSet& rSet);
+
+ public:
+ // basic constructor
+ GroupProperties(SdrObject& rObj);
+
+ // copy constructor
+ GroupProperties(const GroupProperties& rProps, SdrObject& rObj);
+
+ // destructor
+ virtual ~GroupProperties();
+
+ // Clone() operator, normally just calls the local copy constructor
+ virtual BaseProperties& Clone(SdrObject& rObj) const;
+
+ // get itemset
+ virtual const SfxItemSet& GetObjectItemSet() const;
+
+ // get merged ItemSet. Normally, this maps directly to GetObjectItemSet(), but may
+ // be overloaded e.g for group objects to return a merged ItemSet of the object.
+ // When using this method the returned ItemSet may contain items in the state
+ // SFX_ITEM_DONTCARE which means there were several such items with different
+ // values.
+ virtual const SfxItemSet& GetMergedItemSet() const;
+
+ // Set merged ItemSet. Normally, this maps to SetObjectItemSet().
+ virtual void SetMergedItemSet(const SfxItemSet& rSet, sal_Bool bClearAllItems = sal_False);
+
+ // set single item
+ virtual void SetObjectItem(const SfxPoolItem& rItem);
+
+ // set single item direct, do not do any notifies or things like that
+ virtual void SetObjectItemDirect(const SfxPoolItem& rItem);
+
+ // clear single item
+ virtual void ClearObjectItem(const sal_uInt16 nWhich = 0);
+
+ // clear single item direct, do not do any notifies or things like that.
+ // Also supports complete deleteion of items when default parameter 0 is used.
+ virtual void ClearObjectItemDirect(const sal_uInt16 nWhich = 0);
+
+ // Set a single item, iterate over hierarchies if necessary.
+ virtual void SetMergedItem(const SfxPoolItem& rItem);
+
+ // Clear a single item, iterate over hierarchies if necessary.
+ virtual void ClearMergedItem(const sal_uInt16 nWhich = 0);
+
+ // set complete item set
+ virtual void SetObjectItemSet(const SfxItemSet& rSet);
+
+ // set a new StyleSheet
+ virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr);
+
+ // get the local StyleSheet
+ virtual SfxStyleSheet* GetStyleSheet() const;
+
+ // force default attributes for a specific object type, called from
+ // DefaultProperties::GetObjectItemSet() if a new ItemSet is created
+ virtual void ForceDefaultAttributes();
+
+ // Move properties to a new ItemPool.
+ virtual void MoveToItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel = 0L);
+
+ // force all attributes which come from styles to hard attributes
+ // to be able to live without the style.
+ virtual void ForceStyleToHardAttributes();
+ };
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_PROPERTIES_GROUPPROPERTIES_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/properties/itemsettools.hxx b/svx/inc/svx/sdr/properties/itemsettools.hxx
new file mode 100644
index 000000000000..d52189ae93cc
--- /dev/null
+++ b/svx/inc/svx/sdr/properties/itemsettools.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_PROPERTIES_ITEMSETTOOLS_HXX
+#define _SDR_PROPERTIES_ITEMSETTOOLS_HXX
+
+#include <sal/types.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SdrObject;
+class SfxItemSet;
+class Rectangle;
+class Fraction;
+
+//////////////////////////////////////////////////////////////////////////////
+// class to remember broadcast start positions
+namespace sdr
+{
+ namespace properties
+ {
+ class ItemChangeBroadcaster
+ {
+ sal_uInt32 mnCount;
+ void* mpData;
+
+ public:
+ ItemChangeBroadcaster(const SdrObject& rObj);
+ ~ItemChangeBroadcaster();
+
+ sal_uInt32 GetRectangleCount() const;
+ const Rectangle& GetRectangle(sal_uInt32 nIndex) const;
+ };
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ void ScaleItemSet(SfxItemSet& rSet, const Fraction& rScale);
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_PROPERTIES_ITEMSETTOOLS_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/properties/measureproperties.hxx b/svx/inc/svx/sdr/properties/measureproperties.hxx
new file mode 100644
index 000000000000..a204ebfe9949
--- /dev/null
+++ b/svx/inc/svx/sdr/properties/measureproperties.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_PROPERTIES_MEASUREPROPERTIES_HXX
+#define _SDR_PROPERTIES_MEASUREPROPERTIES_HXX
+
+#include <svx/sdr/properties/textproperties.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ class MeasureProperties : public TextProperties
+ {
+ protected:
+ // create a new itemset
+ virtual SfxItemSet& CreateObjectSpecificItemSet(SfxItemPool& rPool);
+
+ // react on ItemSet changes
+ virtual void ItemSetChanged(const SfxItemSet& rSet);
+
+ public:
+ // basic constructor
+ MeasureProperties(SdrObject& rObj);
+
+ // constructor for copying, but using new object
+ MeasureProperties(const MeasureProperties& rProps, SdrObject& rObj);
+
+ // destructor
+ virtual ~MeasureProperties();
+
+ // Clone() operator, normally just calls the local copy constructor
+ virtual BaseProperties& Clone(SdrObject& rObj) const;
+
+ // set a new StyleSheet and broadcast
+ virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr);
+
+ // force default attributes for a specific object type, called from
+ // DefaultProperties::GetObjectItemSet() if a new ItemSet is created
+ virtual void ForceDefaultAttributes();
+ };
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_PROPERTIES_MEASUREPROPERTIES_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/properties/oleproperties.hxx b/svx/inc/svx/sdr/properties/oleproperties.hxx
new file mode 100644
index 000000000000..009c375dff99
--- /dev/null
+++ b/svx/inc/svx/sdr/properties/oleproperties.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * 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: graphicproperties.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 _SDR_PROPERTIES_OLEPROPERTIES_HXX
+#define _SDR_PROPERTIES_OLEPROPERTIES_HXX
+
+#include <svx/sdr/properties/rectangleproperties.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ class OleProperties : public RectangleProperties
+ {
+ protected:
+ public:
+ // basic constructor
+ OleProperties(SdrObject& rObj);
+
+ // constructor for copying, but using new object
+ OleProperties(const OleProperties& rProps, SdrObject& rObj);
+
+ // destructor
+ virtual ~OleProperties();
+
+ // Clone() operator, normally just calls the local copy constructor
+ virtual BaseProperties& Clone(SdrObject& rObj) const;
+
+ // force default attributes for a specific object type, called from
+ // DefaultProperties::GetObjectItemSet() if a new ItemSet is created
+ virtual void ForceDefaultAttributes();
+ };
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_PROPERTIES_OLEPROPERTIES_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/properties/pageproperties.hxx b/svx/inc/svx/sdr/properties/pageproperties.hxx
new file mode 100644
index 000000000000..d85686b3bc5b
--- /dev/null
+++ b/svx/inc/svx/sdr/properties/pageproperties.hxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_PROPERTIES_PAGEPROPERTIES_HXX
+#define _SDR_PROPERTIES_PAGEPROPERTIES_HXX
+
+#include <svx/sdr/properties/emptyproperties.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ class PageProperties : public EmptyProperties
+ {
+ protected:
+ // create a new object specific itemset with object specific ranges.
+ virtual SfxItemSet& CreateObjectSpecificItemSet(SfxItemPool& pPool);
+
+ // Do the ItemChange, may do special handling
+ virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = 0);
+
+ public:
+ // basic constructor
+ PageProperties(SdrObject& rObj);
+
+ // constructor for copying, but using new object
+ PageProperties(const PageProperties& rProps, SdrObject& rObj);
+
+ // destructor
+ virtual ~PageProperties();
+
+ // Clone() operator, normally just calls the local copy constructor
+ virtual BaseProperties& Clone(SdrObject& rObj) const;
+
+ // get itemset. Overloaded here to allow creating the empty itemset
+ // without asserting
+ virtual const SfxItemSet& GetObjectItemSet() const;
+
+ // get the installed StyleSheet
+ virtual SfxStyleSheet* GetStyleSheet() const;
+
+ // clear single item
+ virtual void ClearObjectItem(const sal_uInt16 nWhich = 0);
+ };
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_PROPERTIES_PAGEPROPERTIES_HXX
+
+// eof
+
+
diff --git a/svx/inc/svx/sdr/properties/properties.hxx b/svx/inc/svx/sdr/properties/properties.hxx
new file mode 100644
index 000000000000..311c2ccfd1a5
--- /dev/null
+++ b/svx/inc/svx/sdr/properties/properties.hxx
@@ -0,0 +1,197 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_PROPERTIES_PROPERTIES_HXX
+#define _SDR_PROPERTIES_PROPERTIES_HXX
+
+#include <sal/types.h>
+#include "svx/svxdllapi.h"
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SdrObject;
+class SfxItemSet;
+class SfxPoolItem;
+class SfxStyleSheet;
+class Fraction;
+class SfxItemPool;
+class SdrModel;
+
+namespace sdr
+{
+ namespace properties
+ {
+ class ItemChangeBroadcaster;
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ class SVX_DLLPUBLIC BaseProperties
+ {
+ protected:
+ // the owner of this Properties. Set from constructor and not
+ // to be changed in any way.
+ SdrObject& mrObject;
+
+ // create a new object specific itemset with object specific ranges.
+ virtual SfxItemSet& CreateObjectSpecificItemSet(SfxItemPool& pPool) = 0;
+
+ // internal access to SdrObject
+ SdrObject& GetSdrObject() const
+ {
+ return mrObject;
+ }
+
+ // Test changeability for a single item. If a implementation wants to prevent
+ // changing an item this method may be overloaded.
+ virtual sal_Bool AllowItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = 0) const = 0;
+
+ // Do the internal ItemChange. If only nWhich is given, the item needs to be cleared.
+ // Also needs to handle if nWhich and pNewItem is 0, which means to clear all items.
+ virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = 0) = 0;
+
+ // Called after ItemChange() is done for all items. Allows local reactions on
+ // specific item changes
+ virtual void PostItemChange(const sal_uInt16 nWhich) = 0;
+
+ // Internally react on ItemSet changes. The given ItemSet contains all changed items, the new ones.
+ virtual void ItemSetChanged(const SfxItemSet& rSet) = 0;
+
+ public:
+ // basic constructor, used from SdrObject.
+ BaseProperties(SdrObject& rObj);
+
+ // constructor for copying, but using new object. Used from the Clone()
+ // method.
+ BaseProperties(const BaseProperties& rProps, SdrObject& rObj);
+
+ // destructor
+ virtual ~BaseProperties();
+
+ // Clone() operator, normally just calls the local copy constructor,
+ // see above.
+ virtual BaseProperties& Clone(SdrObject& rObj) const = 0;
+
+ // Get the local ItemSet. This directly returns the local ItemSet of the object. No
+ // merging of ItemSets is done for e.g. Group objects.
+ virtual const SfxItemSet& GetObjectItemSet() const = 0;
+
+ // get merged ItemSet. Normappl, this maps directly to GetObjectItemSet(), but may
+ // be overloaded e.g for group objects to return a merged ItemSet of the object.
+ // When using this method the returned ItemSet may contain items in the state
+ // SFX_ITEM_DONTCARE which means there were several such items with different
+ // values.
+ virtual const SfxItemSet& GetMergedItemSet() const;
+
+ // Sets all items which are on state SFX_ITEM_SET in rSet at the local ItemSet.
+ // Uses AllowItemChange(), ItemChange(), PostItemChange() and ItemSetChanged() calls.
+ virtual void SetObjectItemSet(const SfxItemSet& rSet) = 0;
+
+ // Set merged ItemSet. Normally, this maps to SetObjectItemSet().
+ virtual void SetMergedItemSet(const SfxItemSet& rSet, sal_Bool bClearAllItems = sal_False);
+
+ // Set single item at the local ItemSet. Uses AllowItemChange(),
+ // ItemChange(), PostItemChange() and ItemSetChanged() calls.
+ virtual void SetObjectItem(const SfxPoolItem& rItem) = 0;
+
+ // Set a single item direct. Only uses AllowItemChange() and ItemChange(),
+ // but not PostItemChange() and ItemSetChanged() calls.
+ virtual void SetObjectItemDirect(const SfxPoolItem& rItem) = 0;
+
+ // Clear a single local item. Uses AllowItemChange(),
+ // ItemChange(), PostItemChange() and ItemSetChanged() calls.
+ virtual void ClearObjectItem(const sal_uInt16 nWhich = 0) = 0;
+
+ // Set a single item, iterate over hierarchies if necessary. Default
+ // Implementation falls back to ClearObjectItem().
+ virtual void SetMergedItem(const SfxPoolItem& rItem);
+
+ // Clear a single item, iterate over hierarchies if necessary. Default
+ // Implementation falls back to ClearObjectItem().
+ virtual void ClearMergedItem(const sal_uInt16 nWhich = 0);
+
+ // Clear single item direct. Only uses AllowItemChange() and ItemChange(),
+ // but not PostItemChange() and ItemSetChanged() calls.
+ // Also supports complete deletion of items when default parameter 0 is used.
+ virtual void ClearObjectItemDirect(const sal_uInt16 nWhich = 0) = 0;
+
+ // Set a new StyleSheet. Registers as listener at the StyleSheet to get knowledge
+ // of StyleSheet changes.
+ virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr) = 0;
+
+ // Get the installed StyleSheet.
+ virtual SfxStyleSheet* GetStyleSheet() const = 0;
+
+ // Scale the local ItemSet as far as it contains metric items. This needs to be
+ // overloaded to do it for hierarchical objects like e.g. groups.
+ virtual void Scale(const Fraction& rScale);
+
+ // Move local items to a new ItemPool. This needs to be
+ // overloaded to do it for hierarchical objects like e.g. groups.
+ virtual void MoveToItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel = 0L);
+
+ // Set new model.
+ virtual void SetModel(SdrModel* pOldModel, SdrModel* pNewModel);
+
+ // force all attributes which come from styles to hard attributes
+ // to be able to live without the style.
+ virtual void ForceStyleToHardAttributes();
+
+ // syntactical sugar for ItemSet accesses. Broadcasts before and after the changes
+ // to invalidate views in old and new BoundRects. As soon as the repaint mechanism
+ // will be changed these broadcasts will no longer be needed.
+ //void SetItemAndBroadcast(const SfxPoolItem& rItem);
+ //void ClearItemAndBroadcast(const sal_uInt16 nWhich = 0);
+ void SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, sal_Bool bClearAllItems = sal_False);
+
+ // Just a convenient shortcut for GetObjectItemSet().Get(nWhich).
+ const SfxPoolItem& GetItem(const sal_uInt16 nWhich) const;
+
+ // support for convenient broadcasting. Used from SetMergedItemAndBroadcast(),
+ // 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
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_PROPERTIES_PROPERTIES_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/properties/rectangleproperties.hxx b/svx/inc/svx/sdr/properties/rectangleproperties.hxx
new file mode 100644
index 000000000000..ea61a3bdf1b2
--- /dev/null
+++ b/svx/inc/svx/sdr/properties/rectangleproperties.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_PROPERTIES_RECTANGLEPROPERTIES_HXX
+#define _SDR_PROPERTIES_RECTANGLEPROPERTIES_HXX
+
+#include <svx/sdr/properties/textproperties.hxx>
+#include "svx/svxdllapi.h"
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ class SVX_DLLPUBLIC RectangleProperties : public TextProperties
+ {
+ protected:
+ // react on ItemSet changes
+ virtual void ItemSetChanged(const SfxItemSet& rSet);
+
+ public:
+ // basic constructor
+ RectangleProperties(SdrObject& rObj);
+
+ // constructor for copying, but using new object
+ RectangleProperties(const RectangleProperties& rProps, SdrObject& rObj);
+
+ // destructor
+ virtual ~RectangleProperties();
+
+ // Clone() operator, normally just calls the local copy constructor
+ virtual BaseProperties& Clone(SdrObject& rObj) const;
+
+ // set a new StyleSheet and broadcast
+ virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr);
+ };
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_PROPERTIES_RECTANGLEPROPERTIES_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/properties/textproperties.hxx b/svx/inc/svx/sdr/properties/textproperties.hxx
new file mode 100644
index 000000000000..9a891f424461
--- /dev/null
+++ b/svx/inc/svx/sdr/properties/textproperties.hxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_PROPERTIES_TEXTPROPERTIES_HXX
+#define _SDR_PROPERTIES_TEXTPROPERTIES_HXX
+
+#include <svx/sdr/properties/attributeproperties.hxx>
+#include "svx/svxdllapi.h"
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ class SVX_DLLPUBLIC TextProperties : public AttributeProperties
+ {
+ private:
+ // #i101556# versioning support
+ sal_uInt32 maVersion;
+
+ protected:
+ // create a new itemset
+ virtual SfxItemSet& CreateObjectSpecificItemSet(SfxItemPool& rPool);
+
+ // Do the ItemChange, may do special handling
+ virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = 0);
+
+ // react on ItemSet changes
+ virtual void ItemSetChanged(const SfxItemSet& rSet);
+
+ public:
+ // basic constructor
+ TextProperties(SdrObject& rObj);
+
+ // constructor for copying, but using new object
+ TextProperties(const TextProperties& rProps, SdrObject& rObj);
+
+ // destructor
+ virtual ~TextProperties();
+
+ // Clone() operator, normally just calls the local copy constructor
+ virtual BaseProperties& Clone(SdrObject& rObj) const;
+
+ // set a new StyleSheet and broadcast
+ virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr);
+
+ // force default attributes for a specific object type, called from
+ // DefaultProperties::GetObjectItemSet() if a new ItemSet is created
+ virtual void ForceDefaultAttributes();
+
+ // force all attributes which come from styles to hard attributes
+ // to be able to live without the style.
+ virtual void ForceStyleToHardAttributes();
+
+ // This is the notifyer from SfxListener
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
+
+ // 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
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_PROPERTIES_TEXTPROPERTIES_HXX
+
+// eof
diff --git a/svx/inc/svx/sdr/table/tabledesign.hxx b/svx/inc/svx/sdr/table/tabledesign.hxx
new file mode 100644
index 000000000000..a062ec5210fb
--- /dev/null
+++ b/svx/inc/svx/sdr/table/tabledesign.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_TABLE_DESIGN_HXX
+#define _SDR_TABLE_DESIGN_HXX
+
+#include "svx/svxdllapi.h"
+
+#include <com/sun/star/container/XNameAccess.hpp>
+
+namespace sdr { namespace table {
+
+const sal_Int32 first_row_style = 0;
+const sal_Int32 last_row_style = 1;
+const sal_Int32 first_column_style = 2;
+const sal_Int32 last_column_style = 3;
+const sal_Int32 even_rows_style = 4;
+const sal_Int32 odd_rows_style = 5;
+const sal_Int32 even_columns_style = 6;
+const sal_Int32 odd_columns_style = 7;
+const sal_Int32 body_style = 8;
+const sal_Int32 background_style = 9;
+const sal_Int32 style_count = 10;
+
+extern SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > CreateTableDesignFamily();
+
+} }
+
+
+#endif
diff --git a/svx/inc/svx/sdrcomment.hxx b/svx/inc/svx/sdrcomment.hxx
new file mode 100644
index 000000000000..1c087d3f445d
--- /dev/null
+++ b/svx/inc/svx/sdrcomment.hxx
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_COMMENT_HXX
+#define _SDR_COMMENT_HXX
+
+#include <sal/types.h>
+#include <tools/date.hxx>
+#include <rtl/ustring.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ class Comment
+ {
+ // counting ID
+ sal_uInt32 mnID;
+
+ // creation date
+ Date maCreationDate;
+
+ // name of creator
+ ::rtl::OUString maUserName;
+
+ // text content
+ ::rtl::OUString maText;
+
+ // position
+ basegfx::B2DPoint maPosition;
+
+ public:
+ Comment(
+ sal_uInt32 nID,
+ Date aCreationDate,
+ const ::rtl::OUString& rUserName,
+ const ::rtl::OUString& rText,
+ const basegfx::B2DPoint& rPosition);
+ ~Comment();
+
+ // operator for sorting the vector by mnID
+ sal_Bool operator<(const Comment& rCandidate) const { return (mnID < rCandidate.mnID); }
+
+ // comparison operators
+ sal_Bool operator==(const Comment& rCandidate) const;
+ sal_Bool operator!=(const Comment& rCandidate) const { return !(operator==(rCandidate)); }
+
+ // access to ID, read only
+ sal_uInt32 GetID() const { return mnID; }
+
+ // access to CreationDate
+ Date GetCreationDate() const { return maCreationDate; }
+ void SetCreationDate(Date aNewDate);
+
+ // access to UserName
+ const ::rtl::OUString& GetUserName() const { return maUserName; }
+ void SetUserName(const ::rtl::OUString& rNewName);
+
+ // access to text
+ const ::rtl::OUString& GetText() const { return maText; }
+ void SetText(const ::rtl::OUString& rNewText);
+
+ // access to position
+ const basegfx::B2DPoint& GetPosition() const { return maPosition; }
+ void SetPosition(const basegfx::B2DPoint& rNewPos);
+ };
+
+ // typedef for list of sdr::Comment
+ typedef ::std::vector< Comment > CommentVector;
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_COMMENT_HXX
+// eof
diff --git a/svx/inc/svx/sdrhittesthelper.hxx b/svx/inc/svx/sdrhittesthelper.hxx
new file mode 100644
index 000000000000..cc57aec9cfb6
--- /dev/null
+++ b/svx/inc/svx/sdrhittesthelper.hxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _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/sdrmasterpagedescriptor.hxx b/svx/inc/svx/sdrmasterpagedescriptor.hxx
new file mode 100644
index 000000000000..3a31c3d11206
--- /dev/null
+++ b/svx/inc/svx/sdrmasterpagedescriptor.hxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_MASTERPAGEDESCRIPTOR_HXX
+#define _SDR_MASTERPAGEDESCRIPTOR_HXX
+
+#include <svx/sdrpageuser.hxx>
+#include <svx/svdsob.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+class SdrObject;
+class SfxItemSet;
+class SdrPageProperties;
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContact;
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ class MasterPageDescriptor : public sdr::PageUser
+ {
+ private:
+ SdrPage& maOwnerPage;
+ SdrPage& maUsedPage;
+ SetOfByte maVisibleLayers;
+
+ // ViewContact part
+ sdr::contact::ViewContact* mpViewContact;
+
+ // assignment operator defined, but not implemented
+ void operator=(const MasterPageDescriptor& rCandidate);
+
+ protected:
+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+
+ public:
+ MasterPageDescriptor(SdrPage& aOwnerPage, SdrPage& aUsedPage);
+ virtual ~MasterPageDescriptor();
+
+ // ViewContact part
+ sdr::contact::ViewContact& GetViewContact() const;
+
+ // this method is called form the destructor of the referenced page.
+ // do all necessary action to forget the page. It is not necessary to call
+ // RemovePageUser(), that is done form the destructor.
+ virtual void PageInDestruction(const SdrPage& rPage);
+
+ // member access to UsedPage
+ SdrPage& GetUsedPage() const { return maUsedPage; }
+
+ // member access to OwnerPage
+ SdrPage& GetOwnerPage() const { return maOwnerPage; }
+
+ // member access to VisibleLayers
+ const SetOfByte& GetVisibleLayers() const { return maVisibleLayers; }
+ void SetVisibleLayers(const SetOfByte& rNew);
+
+ // operators
+ sal_Bool operator==(const MasterPageDescriptor& rCandidate) const;
+ sal_Bool operator!=(const MasterPageDescriptor& rCandidate) const;
+
+ const SdrPageProperties* getCorrectSdrPageProperties() const;
+ };
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_MASTERPAGEDESCRIPTOR_HXX
+// eof
diff --git a/svx/inc/svx/sdrobjectfilter.hxx b/svx/inc/svx/sdrobjectfilter.hxx
new file mode 100644
index 000000000000..55eda09c99af
--- /dev/null
+++ b/svx/inc/svx/sdrobjectfilter.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+* 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.
+************************************************************************/
+
+#ifndef SDROBJECTFILTER_HXX
+#define SDROBJECTFILTER_HXX
+
+#include "svx/svxdllapi.h"
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+class SdrObject;
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ //====================================================================
+ //= SdrObjectFilter
+ //====================================================================
+ /** specifies a boolean predicate on the set of all SdrObjects - vulgo a filter.
+ */
+ class SVX_DLLPUBLIC SAL_NO_VTABLE ISdrObjectFilter
+ {
+ public:
+ virtual bool includeObject( const SdrObject& i_rObject ) const = 0;
+
+ virtual ~ISdrObjectFilter() = 0;
+ };
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+#endif // SDROBJECTFILTER_HXX
diff --git a/svx/inc/svx/sdrobjectuser.hxx b/svx/inc/svx/sdrobjectuser.hxx
new file mode 100644
index 000000000000..6d3112d15484
--- /dev/null
+++ b/svx/inc/svx/sdrobjectuser.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_OBJECTUSER_HXX
+#define _SDR_OBJECTUSER_HXX
+
+#include <vector>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// predeclarations
+class SdrObject;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// To make things more safe, allow users of the page to register at it. The users need to be derived
+// from sdr::PageUser to get a call. The users do not need to call RemovePageUser() at the page
+// when they get called from PageInDestruction().
+
+namespace sdr
+{
+ class ObjectUser
+ {
+ public:
+ // this method is called form the destructor of the referenced page.
+ // do all necessary action to forget the page. It is not necessary to call
+ // RemovePageUser(), that is done form the destructor.
+ virtual void ObjectInDestruction(const SdrObject& rObject) = 0;
+ };
+
+ // typedef for ObjectUserVector
+ typedef ::std::vector< ObjectUser* > ObjectUserVector;
+} // end of namespace sdr
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_OBJECTUSER_HXX
+// eof
diff --git a/svx/inc/svx/sdrpageuser.hxx b/svx/inc/svx/sdrpageuser.hxx
new file mode 100644
index 000000000000..d3f35e059fbd
--- /dev/null
+++ b/svx/inc/svx/sdrpageuser.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_PAGEUSER_HXX
+#define _SDR_PAGEUSER_HXX
+
+#include <vector>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// predeclarations
+class SdrPage;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// To make things more safe, allow users of the page to register at it. The users need to be derived
+// from sdr::PageUser to get a call. The users do not need to call RemovePageUser() at the page
+// when they get called from PageInDestruction().
+
+namespace sdr
+{
+ class PageUser
+ {
+ public:
+ // this method is called form the destructor of the referenced page.
+ // do all necessary action to forget the page. It is not necessary to call
+ // RemovePageUser(), that is done form the destructor.
+ virtual void PageInDestruction(const SdrPage& rPage) = 0;
+ };
+
+ // typedef for PageUserVector
+ typedef ::std::vector< PageUser* > PageUserVector;
+} // end of namespace sdr
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDR_PAGEUSER_HXX
+// eof
diff --git a/svx/inc/svx/sdrpagewindow.hxx b/svx/inc/svx/sdrpagewindow.hxx
new file mode 100644
index 000000000000..29c08d6335e3
--- /dev/null
+++ b/svx/inc/svx/sdrpagewindow.hxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDRPAGEWINDOW_HXX
+#define _SDRPAGEWINDOW_HXX
+
+#include <tools/debug.hxx>
+#include <com/sun/star/awt/XWindowListener.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include <com/sun/star/util/XModeChangeListener.hpp>
+#include <cppuhelper/implbase4.hxx>
+#include <svx/svdtypes.hxx> // fuer SdrLayerID
+#include <svl/svarray.hxx>
+#include <tools/contnr.hxx>
+#include <svx/sdrpagewindow.hxx>
+#include "svx/svxdllapi.h"
+
+#include <vector>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class Region;
+class SdrUnoObj;
+class SdrPageView;
+
+// #110094#
+namespace sdr
+{
+ namespace contact
+ {
+ class ObjectContact;
+ class ViewObjectContactRedirector;
+ } // end of namespace contact
+
+ namespace overlay
+ {
+ class OverlayManager;
+ } // end of namespace overlay
+} // end of namespace sdr
+
+namespace basegfx
+{
+ class B2DRange;
+} // end of namespace basegfx
+
+class SdrUnoControlList;
+class SdrPaintWindow;
+class Link;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class SVX_DLLPUBLIC SdrPageWindow
+{
+ // #110094# ObjectContact section
+ sdr::contact::ObjectContact* mpObjectContact;
+
+ // the SdrPageView this window belongs to
+ SdrPageView& mrPageView;
+
+ // the PaintWindow to paint on. Here is access to OutDev etc.
+ // #i72752# change to pointer to allow patcing it in DrawLayer() if necessary
+ SdrPaintWindow* mpPaintWindow;
+ SdrPaintWindow* mpOriginalPaintWindow;
+
+ // UNO stuff for xControls
+ void* mpDummy;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > mxControlContainer;
+
+ // #110094# ObjectContact section
+ sdr::contact::ObjectContact* CreateViewSpecificObjectContact();
+
+public:
+ SdrPageWindow(SdrPageView& rNewPageView, SdrPaintWindow& rPaintWindow);
+ ~SdrPageWindow();
+
+ // data read accesses
+ SdrPageView& GetPageView() const { return mrPageView; }
+ SdrPaintWindow& GetPaintWindow() const { return *mpPaintWindow; }
+ const SdrPaintWindow* GetOriginalPaintWindow() const { return mpOriginalPaintWindow; }
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > GetControlContainer( bool _bCreateIfNecessary = true ) const;
+
+ // OVERLAYMANAGER
+ ::sdr::overlay::OverlayManager* GetOverlayManager() const;
+
+ // #i72752# allow patcing SdrPaintWindow from SdrPageView::DrawLayer if needed
+ void patchPaintWindow(SdrPaintWindow& rPaintWindow);
+ void unpatchPaintWindow();
+
+ // the repaint method. For migration from pPaintProc, use one more parameter
+ void PrePaint();
+ void PrepareRedraw(const Region& rReg);
+ void RedrawAll(sdr::contact::ViewObjectContactRedirector* pRedirector) const;
+ void RedrawLayer(const SdrLayerID* pId, sdr::contact::ViewObjectContactRedirector* pRedirector) const;
+ void PostPaint();
+
+ // Invalidate call, used from ObjectContact(OfPageView) in InvalidatePartOfView(...)
+ void InvalidatePageWindow(const basegfx::B2DRange& rRange);
+
+ // #110094# ObjectContact section
+ sdr::contact::ObjectContact& GetObjectContact() const;
+ /// determines whether there already exists an ObjectContact
+ bool HasObjectContact() const;
+
+ // #i26631#
+ void ResetObjectContact();
+
+ /** sets all elements in the view which support a design and a alive mode into the given mode
+ */
+ void SetDesignMode( bool _bDesignMode ) const;
+};
+
+// typedefs for a list of SdrPageWindow
+typedef ::std::vector< SdrPageWindow* > SdrPageWindowVector;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDRPAGEWINDOW_HXX
diff --git a/svx/inc/svx/sdrpaintwindow.hxx b/svx/inc/svx/sdrpaintwindow.hxx
new file mode 100644
index 000000000000..fef8c2e604d0
--- /dev/null
+++ b/svx/inc/svx/sdrpaintwindow.hxx
@@ -0,0 +1,167 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDRPAINTWINDOW_HXX
+#define _SDRPAINTWINDOW_HXX
+
+#ifndef _VIRDEV_HXX //autogen
+#include <vcl/virdev.hxx>
+#endif
+#include "svx/svxdllapi.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// predeclarations
+class SdrPaintView;
+
+namespace sdr
+{
+ namespace overlay
+ {
+ class OverlayManager;
+ } // end of namespace overlay
+} // end of namespace sdr
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class SdrPreRenderDevice
+{
+ // The original OutputDevice
+ OutputDevice& mrOutputDevice;
+
+ // The VirtualDevice for PreRendering
+ VirtualDevice maPreRenderDevice;
+
+public:
+ SdrPreRenderDevice(OutputDevice& rOriginal);
+ ~SdrPreRenderDevice();
+
+ void PreparePreRenderDevice();
+ void OutputPreRenderDevice(const Region& rExpandedRegion);
+
+ OutputDevice& GetOriginalOutputDevice() const { return mrOutputDevice; }
+ OutputDevice& GetPreRenderDevice() { return maPreRenderDevice; }
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class SVX_DLLPUBLIC SdrPaintWindow
+{
+private:
+ // the OutputDevice this window represents
+ OutputDevice& mrOutputDevice;
+
+ // the SdrPaintView this window belongs to
+ SdrPaintView& mrPaintView;
+
+ // the new OverlayManager for the new OverlayObjects. Test add here, will
+ // replace the IAOManager as soon as it works.
+ ::sdr::overlay::OverlayManager* mpOverlayManager;
+
+ // The PreRenderDevice for PreRendering
+ SdrPreRenderDevice* mpPreRenderDevice;
+
+ // The RedrawRegion used for rendering
+ Region maRedrawRegion;
+
+ // bitfield
+ // #i72889# flag if this is only a temporary target for repaint, default is false
+ unsigned mbTemporaryTarget : 1;
+
+ /** Remember whether the mpOverlayManager supports buffering. Using
+ this flags expensive dynamic_casts on mpOverlayManager in order to
+ detect this.
+ */
+ bool mbUseBuffer;
+
+ // helpers
+ /** Create mpOverlayManager member on demand.
+ @param bUseBuffer
+ Specifies whether to use the buffered (OverlayManagerBuffered)
+ or the unbuffered (OverlayManager) version of the overlay
+ manager. When this values is different from that of the
+ previous call then the overlay manager is replaced by the
+ specified one.
+
+ The bUseBuffer flag will typically change its value when text
+ editing is started or stopped.
+ */
+ void impCreateOverlayManager(const bool bUseBuffer);
+
+public:
+ SdrPaintWindow(SdrPaintView& rNewPaintView, OutputDevice& rOut);
+ ~SdrPaintWindow();
+
+ // data read accesses
+ SdrPaintView& GetPaintView() const { return mrPaintView; }
+ OutputDevice& GetOutputDevice() const { return mrOutputDevice; }
+
+ // OVERLAYMANAGER
+ ::sdr::overlay::OverlayManager* GetOverlayManager() const;
+ // #i73602# add flag if buffer shall be used
+ void DrawOverlay(const Region& rRegion, bool bUseBuffer);
+ void HideOverlay(const Region& rRegion);
+
+ // calculate visible area and return
+ Rectangle GetVisibleArea() const;
+
+ // Is OutDev a printer?
+ sal_Bool OutputToPrinter() const { return (OUTDEV_PRINTER == mrOutputDevice.GetOutDevType()); }
+
+ // Is OutDev a window?
+ sal_Bool OutputToWindow() const { return (OUTDEV_WINDOW == mrOutputDevice.GetOutDevType()); }
+
+ // Is OutDev a VirtualDevice?
+ sal_Bool OutputToVirtualDevice() const { return (OUTDEV_VIRDEV == mrOutputDevice.GetOutDevType()); }
+
+ // Is OutDev a recording MetaFile?
+ sal_Bool OutputToRecordingMetaFile() const;
+
+ // prepare PreRendering (evtl.)
+ void PreparePreRenderDevice();
+ void DestroyPreRenderDevice();
+ void OutputPreRenderDevice(const Region& rExpandedRegion);
+ SdrPreRenderDevice* GetPreRenderDevice() const { return mpPreRenderDevice; }
+
+ // RedrawRegion
+ const Region& GetRedrawRegion() const;
+ void SetRedrawRegion(const Region& rNew);
+
+ // #i72889# read/write access to TempoparyTarget
+ bool getTemporaryTarget() const { return (bool)mbTemporaryTarget; }
+ void setTemporaryTarget(bool bNew) { if(bNew != (bool)mbTemporaryTarget) mbTemporaryTarget = bNew; }
+
+ // #i72889# get target output device, take into account output buffering
+ OutputDevice& GetTargetOutputDevice() { if(mpPreRenderDevice) return mpPreRenderDevice->GetPreRenderDevice(); else return mrOutputDevice; }
+};
+
+// typedefs for a list of SdrPaintWindows
+typedef ::std::vector< SdrPaintWindow* > SdrPaintWindowVector;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SDRPAINTWINDOW_HXX
+
diff --git a/svx/inc/svx/sdshcitm.hxx b/svx/inc/svx/sdshcitm.hxx
new file mode 100644
index 000000000000..0c8812c96575
--- /dev/null
+++ b/svx/inc/svx/sdshcitm.hxx
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SDSHCITM_HXX
+#define _SDSHCITM_HXX
+
+#include <svx/xcolit.hxx>
+#include <svx/svddef.hxx>
+
+//---------------------
+// class SdrShadowColorItem
+//---------------------
+class SdrShadowColorItem: public XColorItem {
+public:
+ SdrShadowColorItem() {}
+ SdrShadowColorItem(long nIndex, const Color& rTheColor): XColorItem(SDRATTR_SHADOWCOLOR,nIndex,rTheColor) {}
+
+ SdrShadowColorItem(const String& rName, const Color& rTheColor): XColorItem(SDRATTR_SHADOWCOLOR,rName,rTheColor) {}
+
+// SdrShadowColorItem(SvStream& rIn): XColorItem(SDRATTR_SHADOWCOLOR,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sdshitm.hxx b/svx/inc/svx/sdshitm.hxx
new file mode 100644
index 000000000000..6201fbeb833c
--- /dev/null
+++ b/svx/inc/svx/sdshitm.hxx
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SDSHITM_HXX
+#define _SDSHITM_HXX
+
+#ifndef _SDOOITEM_HXX
+#include <svx/sdooitm.hxx>
+#endif
+#include <svx/svddef.hxx>
+
+//------------------------------
+// class SdrShadowItem
+//------------------------------
+class SdrShadowItem: public SdrOnOffItem {
+public:
+ SdrShadowItem(sal_Bool bShadow=sal_False): SdrOnOffItem(SDRATTR_SHADOW, bShadow) {}
+ SdrShadowItem(SvStream& rIn): SdrOnOffItem(SDRATTR_SHADOW, rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sdshtitm.hxx b/svx/inc/svx/sdshtitm.hxx
new file mode 100644
index 000000000000..787ed8b3c355
--- /dev/null
+++ b/svx/inc/svx/sdshtitm.hxx
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SDSHTITM_HXX
+#define _SDSHTITM_HXX
+
+#include <svx/sdprcitm.hxx>
+#include <svx/svddef.hxx>
+
+//---------------------
+// class SdrShadowTransparenceItem
+//---------------------
+class SdrShadowTransparenceItem: public SdrPercentItem {
+public:
+ SdrShadowTransparenceItem(sal_uInt16 nTransp=0): SdrPercentItem(SDRATTR_SHADOWTRANSPARENCE,nTransp) {}
+ SdrShadowTransparenceItem(SvStream& rIn) : SdrPercentItem(SDRATTR_SHADOWTRANSPARENCE,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sdsxyitm.hxx b/svx/inc/svx/sdsxyitm.hxx
new file mode 100644
index 000000000000..3afc487b3a26
--- /dev/null
+++ b/svx/inc/svx/sdsxyitm.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SDSXYITM_HXX
+#define _SDSXYITM_HXX
+
+#include <svx/sdmetitm.hxx>
+#include <svx/svddef.hxx>
+
+//---------------------
+// class SdrShadowXDistItem
+//---------------------
+class SdrShadowXDistItem: public SdrMetricItem {
+public:
+ SdrShadowXDistItem(long nDist=0) : SdrMetricItem(SDRATTR_SHADOWXDIST,nDist) {}
+ SdrShadowXDistItem(SvStream& rIn): SdrMetricItem(SDRATTR_SHADOWXDIST,rIn) {}
+};
+
+//---------------------
+// class SdrShadowYDistItem
+//---------------------
+class SdrShadowYDistItem: public SdrMetricItem {
+public:
+ SdrShadowYDistItem(long nDist=0) : SdrMetricItem(SDRATTR_SHADOWYDIST,nDist) {}
+ SdrShadowYDistItem(SvStream& rIn): SdrMetricItem(SDRATTR_SHADOWYDIST,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sdtaaitm.hxx b/svx/inc/svx/sdtaaitm.hxx
new file mode 100644
index 000000000000..d60e83859eaf
--- /dev/null
+++ b/svx/inc/svx/sdtaaitm.hxx
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SDTAAITM_HXX
+#define _SDTAAITM_HXX
+
+#include <svl/intitem.hxx>
+#include <svx/svddef.hxx>
+#include "svx/svxdllapi.h"
+
+class SVX_DLLPUBLIC SdrTextAniAmountItem: public SfxInt16Item {
+public:
+ TYPEINFO();
+ SdrTextAniAmountItem(sal_Int16 nVal=0): SfxInt16Item(SDRATTR_TEXT_ANIAMOUNT,nVal) {}
+ SdrTextAniAmountItem(SvStream& rIn): SfxInt16Item(SDRATTR_TEXT_ANIAMOUNT,rIn) {}
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool=NULL) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual FASTBOOL HasMetrics() const;
+ virtual FASTBOOL ScaleMetrics(long nMul, long nDiv);
+
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String& rText, const IntlWrapper * = 0) const;
+};
+
+#endif
diff --git a/svx/inc/svx/sdtacitm.hxx b/svx/inc/svx/sdtacitm.hxx
new file mode 100644
index 000000000000..05f58b6abd20
--- /dev/null
+++ b/svx/inc/svx/sdtacitm.hxx
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef sdtacitm_hxx
+#define sdtacitm_hxx
+
+#include <svl/intitem.hxx>
+#include <svx/svddef.hxx>
+
+// Anzahl der Durchlaeufe. 0=Endlos.
+class SdrTextAniCountItem: public SfxUInt16Item {
+public:
+ SdrTextAniCountItem(sal_uInt16 nVal=0): SfxUInt16Item(SDRATTR_TEXT_ANICOUNT,nVal) {}
+ SdrTextAniCountItem(SvStream& rIn): SfxUInt16Item(SDRATTR_TEXT_ANICOUNT,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sdtaditm.hxx b/svx/inc/svx/sdtaditm.hxx
new file mode 100644
index 000000000000..f7d92cf97d14
--- /dev/null
+++ b/svx/inc/svx/sdtaditm.hxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SDTADITM_HXX
+#define _SDTADITM_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/svddef.hxx>
+#include "svx/svxdllapi.h"
+
+//------------------------------
+// class SdrTextAniDirectionItem
+//------------------------------
+
+enum SdrTextAniDirection {SDRTEXTANI_LEFT,
+ SDRTEXTANI_RIGHT,
+ SDRTEXTANI_UP,
+ SDRTEXTANI_DOWN};
+
+class SVX_DLLPUBLIC SdrTextAniDirectionItem: public SfxEnumItem {
+public:
+ TYPEINFO();
+ SdrTextAniDirectionItem(SdrTextAniDirection eDir=SDRTEXTANI_LEFT): SfxEnumItem(SDRATTR_TEXT_ANIDIRECTION,(sal_uInt16)eDir) {}
+ SdrTextAniDirectionItem(SvStream& rIn) : SfxEnumItem(SDRATTR_TEXT_ANIDIRECTION,rIn) {}
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool=NULL) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual sal_uInt16 GetValueCount() const; // { return 4; }
+ SdrTextAniDirection GetValue() const { return (SdrTextAniDirection)SfxEnumItem::GetValue(); }
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual String GetValueTextByPos(sal_uInt16 nPos) const;
+
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String& rText, const IntlWrapper * = 0) const;
+};
+
+#endif
diff --git a/svx/inc/svx/sdtagitm.hxx b/svx/inc/svx/sdtagitm.hxx
new file mode 100644
index 000000000000..77168575ff14
--- /dev/null
+++ b/svx/inc/svx/sdtagitm.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SDTAGITM_HXX
+#define _SDTAGITM_HXX
+
+#include <svx/sdooitm.hxx>
+#include <svx/svddef.hxx>
+
+//------------------------------------
+// class SdrTextAutoGrowHeightItem
+//------------------------------------
+class SdrTextAutoGrowHeightItem: public SdrOnOffItem {
+public:
+ SdrTextAutoGrowHeightItem(sal_Bool bAuto=sal_True): SdrOnOffItem(SDRATTR_TEXT_AUTOGROWHEIGHT,bAuto) {}
+ SdrTextAutoGrowHeightItem(SvStream& rIn) : SdrOnOffItem(SDRATTR_TEXT_AUTOGROWHEIGHT,rIn) {}
+};
+
+//------------------------------------
+// class SdrTextAutoGrowWidthItem
+//------------------------------------
+class SdrTextAutoGrowWidthItem: public SdrOnOffItem {
+public:
+ SdrTextAutoGrowWidthItem(sal_Bool bAuto=sal_False): SdrOnOffItem(SDRATTR_TEXT_AUTOGROWWIDTH,bAuto) {}
+ SdrTextAutoGrowWidthItem(SvStream& rIn) : SdrOnOffItem(SDRATTR_TEXT_AUTOGROWWIDTH,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sdtaiitm.hxx b/svx/inc/svx/sdtaiitm.hxx
new file mode 100644
index 000000000000..7e59841c92c4
--- /dev/null
+++ b/svx/inc/svx/sdtaiitm.hxx
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SDTAIITM_HXX
+#define _SDTAIITM_HXX
+
+#include <svx/sdynitm.hxx>
+#include <svx/svddef.hxx>
+
+class SdrTextAniStartInsideItem: public SdrYesNoItem {
+public:
+ SdrTextAniStartInsideItem(sal_Bool bOn=sal_False): SdrYesNoItem(SDRATTR_TEXT_ANISTARTINSIDE,bOn) {}
+ SdrTextAniStartInsideItem(SvStream& rIn) : SdrYesNoItem(SDRATTR_TEXT_ANISTARTINSIDE,rIn) {}
+};
+
+class SdrTextAniStopInsideItem: public SdrYesNoItem {
+public:
+ SdrTextAniStopInsideItem(sal_Bool bOn=sal_False): SdrYesNoItem(SDRATTR_TEXT_ANISTOPINSIDE,bOn) {}
+ SdrTextAniStopInsideItem(SvStream& rIn) : SdrYesNoItem(SDRATTR_TEXT_ANISTOPINSIDE,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sdtaitm.hxx b/svx/inc/svx/sdtaitm.hxx
new file mode 100644
index 000000000000..e1ca695d2169
--- /dev/null
+++ b/svx/inc/svx/sdtaitm.hxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SDTAITM_HXX
+#define _SDTAITM_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/svddef.hxx>
+#include "svx/svxdllapi.h"
+
+//------------------------------
+// class SdrTextVertAdjustItem
+//------------------------------
+
+// Implementiert werden zunaechst nur TOP und CENTER, neustens auch BOTTOM
+enum SdrTextVertAdjust {SDRTEXTVERTADJUST_TOP, // Kopfbuendig (so wie man es normalerweise kennt)
+ SDRTEXTVERTADJUST_CENTER, // Zentriert (z.B. fuer die Titeltexte im Draw)
+ SDRTEXTVERTADJUST_BOTTOM, // Fussbuendig
+ SDRTEXTVERTADJUST_BLOCK // #103516# support vertical full with supported now
+ /*,SDRTEXTVERTADJUST_STRETCH*/}; // Auch die Buchstaben in der Hoehe verzerren (ni)
+
+class SVX_DLLPUBLIC SdrTextVertAdjustItem: public SfxEnumItem {
+public:
+ TYPEINFO();
+ SdrTextVertAdjustItem(SdrTextVertAdjust eAdj=SDRTEXTVERTADJUST_TOP): SfxEnumItem(SDRATTR_TEXT_VERTADJUST,(sal_uInt16)eAdj) {}
+ SdrTextVertAdjustItem(SvStream& rIn) : SfxEnumItem(SDRATTR_TEXT_VERTADJUST,rIn) {}
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool=NULL) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual sal_uInt16 GetValueCount() const; // { return 5; }
+ SdrTextVertAdjust GetValue() const { return (SdrTextVertAdjust)SfxEnumItem::GetValue(); }
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual String GetValueTextByPos(sal_uInt16 nPos) const;
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String& rText, const IntlWrapper * = 0) const;
+};
+
+//------------------------------
+// class SdrTextHorzAdjustItem
+//------------------------------
+
+enum SdrTextHorzAdjust {SDRTEXTHORZADJUST_LEFT, // Linksbuendig verankert
+ SDRTEXTHORZADJUST_CENTER, // Zentriert (z.B. fuer die Titeltexte im Draw)
+ SDRTEXTHORZADJUST_RIGHT, // Rechtsbuendig verankert
+ SDRTEXTHORZADJUST_BLOCK // So wie es frueher war: Gesamte Textrahmenbreite verwenden, Absatzformatierung macht wieder Sinn
+ /*,SDRTEXTHORZADJUST_STRETCH*/}; // FitToSize in X-Richtung (ni).
+
+class SVX_DLLPUBLIC SdrTextHorzAdjustItem: public SfxEnumItem {
+public:
+ TYPEINFO();
+ SdrTextHorzAdjustItem(SdrTextHorzAdjust eAdj=SDRTEXTHORZADJUST_BLOCK): SfxEnumItem(SDRATTR_TEXT_HORZADJUST,(sal_uInt16)eAdj) {}
+ SdrTextHorzAdjustItem(SvStream& rIn) : SfxEnumItem(SDRATTR_TEXT_HORZADJUST,rIn) {}
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool=NULL) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual sal_uInt16 GetValueCount() const; // { return 5; }
+ SdrTextHorzAdjust GetValue() const { return (SdrTextHorzAdjust)SfxEnumItem::GetValue(); }
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual String GetValueTextByPos(sal_uInt16 nPos) const;
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String& rText, const IntlWrapper * = 0) const;
+};
+
+#endif
diff --git a/svx/inc/svx/sdtakitm.hxx b/svx/inc/svx/sdtakitm.hxx
new file mode 100644
index 000000000000..90a163d426b5
--- /dev/null
+++ b/svx/inc/svx/sdtakitm.hxx
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SDTAKITM_HXX
+#define SDTAKITM_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/svddef.hxx>
+#include "svx/svxdllapi.h"
+
+//------------------------------
+// class SdrTextAniKindItem
+//------------------------------
+
+enum SdrTextAniKind {SDRTEXTANI_NONE,
+ SDRTEXTANI_BLINK,
+ SDRTEXTANI_SCROLL,
+ SDRTEXTANI_ALTERNATE,
+ SDRTEXTANI_SLIDE};
+
+// - SDRTEXTANI_BLINK:
+// Einfach nur Blinken. Direction und Amount ohne Wirkung.
+// Frequenz siehe Delay, 0=0.5Hz (Delay=250).
+// Count=Anzahl der blinker. 0=Endlos.
+// StartInside: sal_False=beginnend mit Pause, sal_True=Beginnend mit Puls
+// StopInside: sal_False=Nach Count blinkern nicht sichtbar, sal_True=sichtbar
+// (nur wenn Count!=0)
+// - SDRTEXTANI_SCROLL:
+// Schrift laeuft rein, laeuft vollstaendig durch. Wenn ganz verschwunden
+// geht's wieder von vorne los.
+// Delay in ms, Sonderfall Delay=0 wird auf 50ms defaulted (20Hz)
+// Count=Durchlaufanzahl (0=Endlos)
+// Direction: ist eben die Richtung in die gescrollt wird.
+// StartInside: sal_False=Schrift wird auch beim ersten Durchlauf reingescrollt
+// sal_True=Der linke Teil der Schrift steht beim ersten Durchlauf
+// bereits da (im sichtbaren "Scrollbereich")
+// StopInside: sal_False=Schrift wird auch beim letzten Durchlauf vollstaendig
+// rausgescrollt
+// sal_True=Schrift wird beim letzten Durchlauf nicht rausgescrollt
+// (nur wenn Count!=0)
+// Amount: Schrittweite in logischen Einheiten. Negative Werte bedeuten
+// Pixel statt log. Einheiten. Wenn Amount=0, dann wird auf
+// 1 Pixel defaulted.
+// - SDRTEXTANI_ALTERNATE:
+// Wie SDRTEXTANI_SCROLL, nur wird nicht gescrollt bis Schrift ganz
+// verschwunden, sondern bis der letzte Teil vollstaendig sichtbar ist. Dann
+// wird die Richtung umgekehrt und zuruekgescrollt.
+// Count=Anzahl der Durchlaeufe=Anzahl der Richtungswechsel-1
+// Bei Count=1 ist SDRTEXTANI_ALTERNATE also identisch mit SDRTEXTANI_SCROLL
+// Direction ist die Startrichtung
+// Alle andern Parameter wie SDRTEXTANI_SCROLL
+// - SDRTEXTANI_SLIDE:
+// Schrift wird nur reingeschoben bis zur Originalposition.
+// -> also wie SCROLL mit StartInside=sal_False, StopInside=TRUE
+// und Count=1. Count=0 wird als Count=1 interpretiert.
+// Fuer jeden Count>1 wird der Text jedoch ruekwaerts wieder vollstaendig
+// rausgeschoben (aehnlich wie ALTERNATE) und dann wieder reingeschoben.
+// StopInside wird nicht ausgewertet, weil immer Inside gestoppt wird.
+// StartInside wird nicht ausgewertet, weil immer Outside gestartet wird.
+// Alle andern Parameter wie SDRTEXTANI_SCROLL
+// StartInside,StopInside: Bei sal_True ist die anfaengliche/entgueltige
+// Textposition abhaengig von der Textverankerung am Zeichenobjekt. Sie
+// entspricht der Textposition bei normalem Paint (ohne Laufschrift).
+
+class SVX_DLLPUBLIC SdrTextAniKindItem: public SfxEnumItem {
+public:
+ TYPEINFO();
+ SdrTextAniKindItem(SdrTextAniKind eKind=SDRTEXTANI_NONE): SfxEnumItem(SDRATTR_TEXT_ANIKIND,(sal_uInt16)eKind) {}
+ SdrTextAniKindItem(SvStream& rIn) : SfxEnumItem(SDRATTR_TEXT_ANIKIND,rIn) {}
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool=NULL) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual sal_uInt16 GetValueCount() const; // { return 5; }
+ SdrTextAniKind GetValue() const { return (SdrTextAniKind)SfxEnumItem::GetValue(); }
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual String GetValueTextByPos(sal_uInt16 nPos) const;
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String& rText, const IntlWrapper * = 0) const;
+};
+
+#endif
diff --git a/svx/inc/svx/sdtayitm.hxx b/svx/inc/svx/sdtayitm.hxx
new file mode 100644
index 000000000000..eeb1ca587ffb
--- /dev/null
+++ b/svx/inc/svx/sdtayitm.hxx
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SDTAYITM_HXX
+#define _SDTAYITM_HXX
+
+#include <svl/intitem.hxx>
+#include <svx/svddef.hxx>
+#include "svx/svxdllapi.h"
+
+class SVX_DLLPUBLIC SdrTextAniDelayItem: public SfxUInt16Item {
+public:
+ TYPEINFO();
+ SdrTextAniDelayItem(sal_uInt16 nVal=0): SfxUInt16Item(SDRATTR_TEXT_ANIDELAY,nVal) {}
+ SdrTextAniDelayItem(SvStream& rIn): SfxUInt16Item(SDRATTR_TEXT_ANIDELAY,rIn) {}
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool=NULL) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String& rText, const IntlWrapper * = 0) const;
+};
+
+#endif
diff --git a/svx/inc/svx/sdtcfitm.hxx b/svx/inc/svx/sdtcfitm.hxx
new file mode 100644
index 000000000000..17d2e49a8499
--- /dev/null
+++ b/svx/inc/svx/sdtcfitm.hxx
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SDTCFITM_HXX
+#define _SDTCFITM_HXX
+
+#include <svx/sdooitm.hxx>
+#include <svx/svddef.hxx>
+
+//------------------------------------
+// class SdrTextContourFrameItem
+//------------------------------------
+class SdrTextContourFrameItem: public SdrOnOffItem {
+public:
+ SdrTextContourFrameItem(sal_Bool bOn=sal_False): SdrOnOffItem(SDRATTR_TEXT_CONTOURFRAME,bOn) {}
+ SdrTextContourFrameItem(SvStream& rIn) : SdrOnOffItem(SDRATTR_TEXT_CONTOURFRAME,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sdtditm.hxx b/svx/inc/svx/sdtditm.hxx
new file mode 100644
index 000000000000..5bd53138bd85
--- /dev/null
+++ b/svx/inc/svx/sdtditm.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SDTMITM_HXX
+#define SDTMITM_HXX
+
+#include <svx/sdmetitm.hxx>
+#include <svx/svddef.hxx>
+
+//----------------------------------------------
+// class SdrTextLeft/Right/Upper/LowerDistItem
+//----------------------------------------------
+class SdrTextLeftDistItem: public SdrMetricItem {
+public:
+ SdrTextLeftDistItem(long nHgt=0): SdrMetricItem(SDRATTR_TEXT_LEFTDIST,nHgt) {}
+ SdrTextLeftDistItem(SvStream& rIn): SdrMetricItem(SDRATTR_TEXT_LEFTDIST,rIn) {}
+};
+
+class SdrTextRightDistItem: public SdrMetricItem {
+public:
+ SdrTextRightDistItem(long nHgt=0): SdrMetricItem(SDRATTR_TEXT_RIGHTDIST,nHgt) {}
+ SdrTextRightDistItem(SvStream& rIn): SdrMetricItem(SDRATTR_TEXT_RIGHTDIST,rIn) {}
+};
+
+class SdrTextUpperDistItem: public SdrMetricItem {
+public:
+ SdrTextUpperDistItem(long nHgt=0): SdrMetricItem(SDRATTR_TEXT_UPPERDIST,nHgt) {}
+ SdrTextUpperDistItem(SvStream& rIn): SdrMetricItem(SDRATTR_TEXT_UPPERDIST,rIn) {}
+};
+
+class SdrTextLowerDistItem: public SdrMetricItem {
+public:
+ SdrTextLowerDistItem(long nHgt=0): SdrMetricItem(SDRATTR_TEXT_LOWERDIST,nHgt) {}
+ SdrTextLowerDistItem(SvStream& rIn): SdrMetricItem(SDRATTR_TEXT_LOWERDIST,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sdtfchim.hxx b/svx/inc/svx/sdtfchim.hxx
new file mode 100644
index 000000000000..a47daa354b76
--- /dev/null
+++ b/svx/inc/svx/sdtfchim.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SDTFCHIM_HXX
+#define _SDTFCHIM_HXX
+
+#include <svx/svddef.hxx>
+
+class SVX_DLLPUBLIC SdrTextFixedCellHeightItem : public SfxBoolItem
+{
+public:
+
+ TYPEINFO();
+ SdrTextFixedCellHeightItem( sal_Bool bUseFixedCellHeight = sal_False );
+ SVX_DLLPRIVATE SdrTextFixedCellHeightItem( SvStream & rStream, sal_uInt16 nVersion );
+
+ SVX_DLLPRIVATE virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePresentation,
+ SfxMapUnit eCoreMetric, SfxMapUnit ePresentationMetric,
+ String &rText, const IntlWrapper * = 0) const;
+
+ SVX_DLLPRIVATE virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nItem ) const;
+ SVX_DLLPRIVATE virtual SvStream& Store( SvStream&, sal_uInt16 nVersion ) const;
+ SVX_DLLPRIVATE virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const;
+ SVX_DLLPRIVATE virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const;
+
+ SVX_DLLPRIVATE virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ SVX_DLLPRIVATE virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+#ifdef SDR_ISPOOLABLE
+ SVX_DLLPRIVATE virtual int IsPoolable() const;
+#endif
+};
+
+#endif
diff --git a/svx/inc/svx/sdtfsitm.hxx b/svx/inc/svx/sdtfsitm.hxx
new file mode 100644
index 000000000000..f3f18ed8acac
--- /dev/null
+++ b/svx/inc/svx/sdtfsitm.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SDTFSITM_HXX
+#define _SDTFSITM_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/svddef.hxx>
+#include "svx/svxdllapi.h"
+
+enum SdrFitToSizeType {SDRTEXTFIT_NONE, // - kein FitToSize
+ SDRTEXTFIT_PROPORTIONAL, // - Alle Buchstaben proportional umgroessern
+ SDRTEXTFIT_ALLLINES, // - Zus. jede Zeile separat in der Breite stretchen
+ SDRTEXTFIT_RESIZEATTR}; // - Bei Rahmenumgroesserung (ausser Autogrow) wird
+ // die Schriftgroesse umattributiert (hart)
+
+// Bei SDRTEXTFIT_PROPORTIONAL und SDRTEXTFIT_ALLLINES gibt es kein AutoGrow und
+// keine automatischen Umbrueche.
+// Ist SDRTEXTFIT_RESIZEATTR gesetzt, so wird beim umgroessern des Textrahmens
+// (ausser bei AutoGrow) die Schrift durch harte Attributierung ebenfalls
+// umgegroessert.
+// Bei AutoGrowingWidth gibt es ebenfalls keine automatischen Umbrueche (erst bei
+// TextMaxFrameWidth).
+
+//--------------------------------
+// class SdrTextFitToSizeTypeItem
+//--------------------------------
+class SVX_DLLPUBLIC SdrTextFitToSizeTypeItem: public SfxEnumItem {
+public:
+ TYPEINFO();
+ SdrTextFitToSizeTypeItem(SdrFitToSizeType eFit=SDRTEXTFIT_NONE): SfxEnumItem(SDRATTR_TEXT_FITTOSIZE,(sal_uInt16)eFit) {}
+ SdrTextFitToSizeTypeItem(SvStream& rIn) : SfxEnumItem(SDRATTR_TEXT_FITTOSIZE,rIn) {}
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool=NULL) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual sal_uInt16 GetValueCount() const; // { return 4; }
+ SdrFitToSizeType GetValue() const { return (SdrFitToSizeType)SfxEnumItem::GetValue(); }
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual String GetValueTextByPos(sal_uInt16 nPos) const;
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String& rText, const IntlWrapper * = 0) const;
+ virtual int HasBoolValue() const;
+ virtual sal_Bool GetBoolValue() const;
+ virtual void SetBoolValue(sal_Bool bVal);
+};
+
+#endif
diff --git a/svx/inc/svx/sdtmfitm.hxx b/svx/inc/svx/sdtmfitm.hxx
new file mode 100644
index 000000000000..9cd82fc5870c
--- /dev/null
+++ b/svx/inc/svx/sdtmfitm.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SDTMFITM_HXX
+#define _SDTMFITM_HXX
+
+#include <svx/sdmetitm.hxx>
+#include <svx/svddef.hxx>
+
+//------------------------------
+// class SdrTextMinFrameHeighItem
+//------------------------------
+class SdrTextMinFrameHeightItem: public SdrMetricItem {
+public:
+ SdrTextMinFrameHeightItem(long nHgt=0): SdrMetricItem(SDRATTR_TEXT_MINFRAMEHEIGHT,nHgt) {}
+ SdrTextMinFrameHeightItem(SvStream& rIn): SdrMetricItem(SDRATTR_TEXT_MINFRAMEHEIGHT,rIn) {}
+};
+
+//------------------------------
+// class SdrTextMaxFrameHeightItem
+//------------------------------
+class SdrTextMaxFrameHeightItem: public SdrMetricItem {
+public:
+ SdrTextMaxFrameHeightItem(long nHgt=0): SdrMetricItem(SDRATTR_TEXT_MAXFRAMEHEIGHT,nHgt) {}
+ SdrTextMaxFrameHeightItem(SvStream& rIn): SdrMetricItem(SDRATTR_TEXT_MAXFRAMEHEIGHT,rIn) {}
+};
+
+//------------------------------
+// class SdrTextMinFrameWidthItem
+//------------------------------
+class SdrTextMinFrameWidthItem: public SdrMetricItem {
+public:
+ SdrTextMinFrameWidthItem(long nWdt=0): SdrMetricItem(SDRATTR_TEXT_MINFRAMEWIDTH,nWdt) {}
+ SdrTextMinFrameWidthItem(SvStream& rIn): SdrMetricItem(SDRATTR_TEXT_MINFRAMEWIDTH,rIn) {}
+};
+
+//------------------------------
+// class SdrTextMaxFrameWidthItem
+//------------------------------
+class SdrTextMaxFrameWidthItem: public SdrMetricItem {
+public:
+ SdrTextMaxFrameWidthItem(long nWdt=0): SdrMetricItem(SDRATTR_TEXT_MAXFRAMEWIDTH,nWdt) {}
+ SdrTextMaxFrameWidthItem(SvStream& rIn): SdrMetricItem(SDRATTR_TEXT_MAXFRAMEWIDTH,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sdynitm.hxx b/svx/inc/svx/sdynitm.hxx
new file mode 100644
index 000000000000..29e13913df06
--- /dev/null
+++ b/svx/inc/svx/sdynitm.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SDYNITM_HXX
+#define _SDYNITM_HXX
+
+#include <svl/eitem.hxx>
+#include "svx/svxdllapi.h"
+
+
+//------------------------------------------------------------
+// class SdrYesNoItem
+// hier liefert GetValueTextByVal() "ja" oder "nein"
+// anstelle von "TRUE" und "FALSE"
+//------------------------------------------------------------
+class SVX_DLLPUBLIC SdrYesNoItem: public SfxBoolItem {
+public:
+ TYPEINFO();
+ SdrYesNoItem(): SfxBoolItem() {}
+ SdrYesNoItem(sal_uInt16 nId, sal_Bool bOn=sal_False): SfxBoolItem(nId,bOn) {}
+ SdrYesNoItem(sal_uInt16 nId, SvStream& rIn): SfxBoolItem(nId,rIn) {}
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool=NULL) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual String GetValueTextByVal(sal_Bool bVal) const;
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String& rText, const IntlWrapper * = 0) const;
+#ifdef SDR_ISPOOLABLE
+ virtual int IsPoolable() const;
+#endif
+};
+
+
+#endif
diff --git a/svx/inc/svx/selctrl.hxx b/svx/inc/svx/selctrl.hxx
new file mode 100644
index 000000000000..792b4862bf04
--- /dev/null
+++ b/svx/inc/svx/selctrl.hxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_SELCTRL_HXX
+#define _SVX_SELCTRL_HXX
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/stbitem.hxx>
+#include "svx/svxdllapi.h"
+
+// class SvxSelModeControl -----------------------------------------------
+
+class SVX_DLLPUBLIC SvxSelectionModeControl : public SfxStatusBarControl
+{
+public:
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ virtual void Click();
+ virtual void Paint( const UserDrawEvent& rEvt );
+
+ SFX_DECL_STATUSBAR_CONTROL();
+
+ SvxSelectionModeControl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar& rStb );
+
+ static sal_uIntPtr GetDefItemWidth(const StatusBar& rStb);
+
+private:
+ sal_uInt16 nState;
+
+#ifdef _SVX_SELCTRL_CXX
+ SVX_DLLPRIVATE void DrawItemText_Impl();
+#endif
+};
+
+
+#endif
+
diff --git a/svx/inc/svx/selectioncontroller.hxx b/svx/inc/svx/selectioncontroller.hxx
new file mode 100644
index 000000000000..bd26f9f2df42
--- /dev/null
+++ b/svx/inc/svx/selectioncontroller.hxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SELECTIONCONTROLLER_HXX
+#define _SELECTIONCONTROLLER_HXX
+
+#include "svx/svxdllapi.h"
+
+#include <boost/shared_ptr.hpp>
+
+#include <cppuhelper/weak.hxx>
+
+class KeyEvent;
+class MouseEvent;
+class Window;
+class SfxItemSet;
+class SfxRequest;
+class SfxStyleSheet;
+class SdrPage;
+class SdrModel;
+
+namespace sdr
+{
+
+class SVX_DLLPUBLIC SelectionController: public cppu::OWeakObject
+{
+public:
+ virtual bool onKeyInput(const KeyEvent& rKEvt, Window* pWin);
+ virtual bool onMouseButtonDown(const MouseEvent& rMEvt, Window* pWin);
+ virtual bool onMouseButtonUp(const MouseEvent& rMEvt, Window* pWin);
+ virtual bool onMouseMove(const MouseEvent& rMEvt, Window* pWin);
+
+ virtual void onSelectionHasChanged();
+
+ virtual void GetState( SfxItemSet& rSet );
+ virtual void Execute( SfxRequest& rReq );
+
+ virtual bool DeleteMarked();
+
+ virtual bool GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const;
+ virtual bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll);
+
+ virtual bool GetStyleSheet( SfxStyleSheet* &rpStyleSheet ) const;
+ virtual bool SetStyleSheet( SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr );
+
+ virtual bool GetMarkedObjModel( SdrPage* pNewPage );
+ virtual bool PasteObjModel( const SdrModel& rModel );
+
+ /** returns a format paint brush set from the current selection */
+ virtual bool TakeFormatPaintBrush( boost::shared_ptr< SfxItemSet >& rFormatSet );
+
+ /** applies a format paint brush set from the current selection.
+ if bNoCharacterFormats is true, no character attributes are changed.
+ if bNoParagraphFormats is true, no paragraph attributes are changed.
+ */
+ virtual bool ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats );
+};
+
+}
+
+#endif //_SELECTIONCONTROLLER_HXX
+
diff --git a/svx/inc/svx/shapeproperty.hxx b/svx/inc/svx/shapeproperty.hxx
new file mode 100755
index 000000000000..9b08d9c741b4
--- /dev/null
+++ b/svx/inc/svx/shapeproperty.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef SVX_SHAPEPROPERTY_HXX
+#define SVX_SHAPEPROPERTY_HXX
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ //====================================================================
+ //= ShapeProperty
+ //====================================================================
+ enum ShapeProperty
+ {
+ // generic (UNO) shape properties
+ eShapePosition,
+ eShapeSize,
+ // text doc shape properties
+ eTextShapeAnchorType,
+ // spreadsheet doc shape properties
+ eSpreadsheetAnchor,
+
+ // invalid, not to be used
+ eInvalidShapeProperty
+ };
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+#endif // SVX_SHAPEPROPERTY_HXX
diff --git a/svx/inc/svx/shapepropertynotifier.hxx b/svx/inc/svx/shapepropertynotifier.hxx
new file mode 100644
index 000000000000..573af71bdc2a
--- /dev/null
+++ b/svx/inc/svx/shapepropertynotifier.hxx
@@ -0,0 +1,148 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef SVX_PROPERTYCHANGENOTIFIER_HXX
+#define SVX_PROPERTYCHANGENOTIFIER_HXX
+
+#include "svx/svxdllapi.h"
+#include "svx/shapeproperty.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/beans/PropertyChangeEvent.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+/** === end UNO includes === **/
+
+#include <boost/noncopyable.hpp>
+#include <boost/shared_ptr.hpp>
+#include <memory>
+
+namespace cppu
+{
+ class OWeakObject;
+}
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ //====================================================================
+ //= IPropertyValueProvider
+ //====================================================================
+ /** a provider for a property value
+ */
+ class SVX_DLLPUBLIC IPropertyValueProvider
+ {
+ public:
+ /** returns the name of the property which this provider is responsible for
+ */
+ virtual ::rtl::OUString getPropertyName() const = 0;
+
+ /** returns the current value of the property which the provider is responsible for
+ */
+ virtual void getCurrentValue( ::com::sun::star::uno::Any& _out_rValue ) const = 0;
+
+ virtual ~IPropertyValueProvider();
+ };
+ typedef ::boost::shared_ptr< IPropertyValueProvider > PPropertyValueProvider;
+
+ //====================================================================
+ //= PropertyValueProvider
+ //====================================================================
+ /** default implementation of a IPropertyValueProvider
+
+ This default implementation queries the object which it is constructed with for the XPropertySet interface,
+ and calls the getPropertyValue method.
+ */
+ class SVX_DLLPUBLIC PropertyValueProvider :public IPropertyValueProvider
+ ,public ::boost::noncopyable
+ {
+ public:
+ PropertyValueProvider( ::cppu::OWeakObject& _rContext, const sal_Char* _pAsciiPropertyName )
+ :m_rContext( _rContext )
+ ,m_sPropertyName( ::rtl::OUString::createFromAscii( _pAsciiPropertyName ) )
+ {
+ }
+
+ virtual ::rtl::OUString getPropertyName() const;
+ virtual void getCurrentValue( ::com::sun::star::uno::Any& _out_rValue ) const;
+
+ protected:
+ ::cppu::OWeakObject& getContext() const { return m_rContext; }
+ private:
+ ::cppu::OWeakObject& m_rContext;
+ const ::rtl::OUString m_sPropertyName;
+ };
+
+ //====================================================================
+ //= PropertyChangeNotifier
+ //====================================================================
+ struct PropertyChangeNotifier_Data;
+
+ /** helper class for notifying XPropertyChangeListeners
+
+ The class is intended to be held as member of the class which does the property change broadcasting.
+ */
+ class SVX_DLLPUBLIC PropertyChangeNotifier : public ::boost::noncopyable
+ {
+ public:
+ /** constructs a notifier instance
+
+ @param _rOwner
+ the owner instance of the notifier. Will be used as css.lang.EventObject.Source when
+ notifying events.
+ */
+ PropertyChangeNotifier( ::cppu::OWeakObject& _rOwner, ::osl::Mutex& _rMutex );
+ ~PropertyChangeNotifier();
+
+ // listener maintanance
+ void addPropertyChangeListener( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener );
+ void removePropertyChangeListener( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener );
+
+ /** registers a IPropertyValueProvider
+ */
+ void registerProvider( const ShapeProperty _eProperty, const PPropertyValueProvider _pProvider );
+
+ /** notifies changes in the given property to all registered listeners
+
+ If no property value provider for the given property ID is registered, this is worth an assertion in a
+ non-product build, and otherwise ignored.
+ */
+ void notifyPropertyChange( const ShapeProperty _eProperty ) const;
+
+ /** is called to dispose the instance
+ */
+ void disposing();
+
+ private:
+ ::std::auto_ptr< PropertyChangeNotifier_Data > m_pData;
+ };
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+#endif // SVX_PROPERTYCHANGENOTIFIER_HXX
diff --git a/svx/inc/svx/simptabl.hxx b/svx/inc/svx/simptabl.hxx
new file mode 100644
index 000000000000..c9c59c64f6c3
--- /dev/null
+++ b/svx/inc/svx/simptabl.hxx
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_SIMPTABL_HXX
+#define _SVX_SIMPTABL_HXX
+
+#ifndef _MOREBTN_HXX //autogen
+#include <vcl/morebtn.hxx>
+#endif
+
+#ifndef _COMBOBOX_HXX //autogen
+#include <vcl/combobox.hxx>
+#endif
+
+#ifndef _GROUP_HXX //autogen
+#include <vcl/group.hxx>
+#endif
+#include <svtools/headbar.hxx>
+#include <svtools/svtabbx.hxx>
+#include <vcl/lstbox.hxx>
+#include "svx/svxdllapi.h"
+
+class SvxSimpleTable;
+class SvxSimpTblContainer : public Control
+{
+private:
+ SvxSimpleTable* m_pTable;
+
+protected:
+ virtual long PreNotify( NotifyEvent& rNEvt );
+
+public:
+ SvxSimpTblContainer( Window* pParent, WinBits nWinStyle = 0 );
+ SvxSimpTblContainer( Window* pParent, const ResId& rResId );
+
+ inline void SetTable( SvxSimpleTable* _pTable ) { m_pTable = _pTable; }
+};
+
+class SVX_DLLPUBLIC SvxSimpleTable : public SvHeaderTabListBox
+{
+ using Window::SetPosSizePixel;
+private:
+
+ Link aHeaderBarClickLink;
+ Link aHeaderBarDblClickLink;
+ Link aCommandLink;
+ CommandEvent aCEvt;
+ SvxSimpTblContainer aPrivContainer;
+ HeaderBar aHeaderBar;
+ long nOldPos;
+ sal_uInt16 nHeaderItemId;
+ sal_Bool bResizeFlag;
+ sal_Bool bPaintFlag;
+ sal_Bool bSortDirection;
+ sal_uInt16 nSortCol;
+ Window* pMyParentWin;
+
+ DECL_LINK( StartDragHdl, HeaderBar* );
+ DECL_LINK( DragHdl, HeaderBar* );
+ DECL_LINK( EndDragHdl, HeaderBar* );
+ DECL_LINK( HeaderBarClick, HeaderBar* );
+ DECL_LINK( HeaderBarDblClick, HeaderBar* );
+ DECL_LINK( CompareHdl, SvSortData* );
+
+protected:
+
+ virtual void NotifyScrolled();
+
+ virtual void SetTabs();
+ virtual void Paint( const Rectangle& rRect );
+ virtual void UpdateViewSize();
+
+ virtual void HBarClick();
+ virtual void HBarDblClick();
+ virtual void HBarStartDrag();
+ virtual void HBarDrag();
+ virtual void HBarEndDrag();
+
+ virtual void Command( const CommandEvent& rCEvt );
+
+ virtual StringCompare ColCompare(SvLBoxEntry*,SvLBoxEntry*);
+ HeaderBar* GetTheHeaderBar(){return &aHeaderBar;}
+
+public:
+
+ SvxSimpleTable( Window* pParent,WinBits nBits =WB_BORDER );
+ SvxSimpleTable( Window* pParent,const ResId& );
+ ~SvxSimpleTable();
+
+ void InsertHeaderEntry(const XubString& rText,
+ sal_uInt16 nCol=HEADERBAR_APPEND,
+ HeaderBarItemBits nBits = HIB_STDSTYLE);
+
+ void SetTabs( long* pTabs, MapUnit = MAP_APPFONT );
+
+ void ClearAll();
+ void ClearHeader();
+
+ // to be removed all calls of the related methods are redirected to *Table() methods
+ using Window::Show;
+ using Window::Hide;
+ using Window::Enable;
+ using Window::Disable;
+ using Window::ToTop;
+
+ void Show();
+ void Hide();
+ void Enable();
+ void Disable();
+ void ToTop();
+
+ // remove until this line
+
+ void ShowTable();
+ void HideTable();
+ sal_Bool IsVisible() const;
+
+ void EnableTable();
+ void DisableTable();
+ sal_Bool IsEnabled() const;
+
+ void TableToTop();
+ void SetPosPixel( const Point& rNewPos );
+ Point GetPosPixel() const ;
+ virtual void SetPosSizePixel( const Point& rNewPos, Size& rNewSize );
+ void SetPosSize( const Point& rNewPos, const Size& rNewSize );
+ void SetSizePixel(const Size& rNewSize );
+ void SetOutputSizePixel(const Size& rNewSize );
+
+ Size GetSizePixel() const;
+ Size GetOutputSizePixel() const;
+
+ sal_uInt16 GetSelectedCol();
+ void SortByCol(sal_uInt16,sal_Bool bDir=sal_True);
+ sal_Bool GetSortDirection(){ return bSortDirection;}
+ sal_uInt16 GetSortedCol(){ return nSortCol;}
+ SvLBoxItem* GetEntryAtPos( SvLBoxEntry* pEntry, sal_uInt16 nPos ) const;
+
+ CommandEvent GetCommandEvent()const;
+ inline sal_Bool IsFocusOnCellEnabled() const { return IsCellFocusEnabled(); }
+
+ void SetCommandHdl( const Link& rLink ) { aCommandLink = rLink; }
+ const Link& GetCommandHdl() const { return aCommandLink; }
+
+ void SetHeaderBarClickHdl( const Link& rLink ) { aHeaderBarClickLink = rLink; }
+ const Link& GetHeaderBarClickHdl() const { return aHeaderBarClickLink; }
+
+ void SetHeaderBarDblClickHdl( const Link& rLink ) { aHeaderBarDblClickLink = rLink; }
+ const Link& GetHeaderBarDblClickHdl() const { return aHeaderBarDblClickLink; }
+
+ void SetHeaderBarHelpId(const rtl::OString& rHelpId) {aHeaderBar.SetHelpId(rHelpId);}
+};
+
+
+#endif // _SVX_SIMPTABL_HXX
+
diff --git a/svx/inc/svx/sphere3d.hxx b/svx/inc/svx/sphere3d.hxx
new file mode 100644
index 000000000000..08c5c4eff7f1
--- /dev/null
+++ b/svx/inc/svx/sphere3d.hxx
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _E3D_SPHERE3D_HXX
+#define _E3D_SPHERE3D_HXX
+
+#include <svx/obj3d.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* Kugelobjekt mit Durchmesser r3DSize; Anzahl der Flaechen wird durch
+|* die horizontale und vertikale Segmentanzahl vorgegeben
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC E3dSphereObj : public E3dCompoundObject
+{
+private:
+ basegfx::B3DPoint aCenter;
+ basegfx::B3DVector aSize;
+
+protected:
+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+ virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
+ void SetDefaultAttributes(E3dDefaultAttributes& rDefault);
+
+public:
+ TYPEINFO();
+ E3dSphereObj(E3dDefaultAttributes& rDefault, const basegfx::B3DPoint& rCenter, const basegfx::B3DVector& r3DSize);
+ E3dSphereObj();
+
+ // FG: Dieser Konstruktor wird nur von MakeObject aus der 3d-Objectfactory beim
+ // Laden von Dokumenten mit Kugeln aufgerufen. Dieser Konstruktor ruft kein
+ // CreateSphere auf, er erzeugt also keine Kugel.
+ E3dSphereObj(int dummy);
+
+ // HorizontalSegments:
+ sal_uInt32 GetHorizontalSegments() const
+ { return ((const Svx3DHorizontalSegmentsItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_HORZ_SEGS)).GetValue(); }
+
+ // VerticalSegments:
+ sal_uInt32 GetVerticalSegments() const
+ { return ((const Svx3DVerticalSegmentsItem&)GetObjectItemSet().Get(SDRATTR_3DOBJ_VERT_SEGS)).GetValue(); }
+
+ virtual sal_uInt16 GetObjIdentifier() const;
+ virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const;
+
+ virtual void operator=(const SdrObject&);
+
+ void ReSegment(sal_uInt32 nHorzSegments, sal_uInt32 nVertSegments);
+ const basegfx::B3DPoint& Center() const { return aCenter; }
+ const basegfx::B3DVector& Size() const { return aSize; }
+
+ // Lokale Parameter setzen mit Geometrieneuerzeugung
+ void SetCenter(const basegfx::B3DPoint& rNew);
+ void SetSize(const basegfx::B3DVector& rNew);
+
+ // TakeObjName...() ist fuer die Anzeige in der UI, z.B. "3 Rahmen selektiert".
+ virtual void TakeObjNameSingul(String& rName) const;
+ virtual void TakeObjNamePlural(String& rName) const;
+};
+
+#endif // _E3D_SPHERE3D_HXX
diff --git a/svx/inc/svx/splitcelldlg.hxx b/svx/inc/svx/splitcelldlg.hxx
new file mode 100644
index 000000000000..85ba02eb0e41
--- /dev/null
+++ b/svx/inc/svx/splitcelldlg.hxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_SPLITCELLDLG_HXX
+#define _SVX_SPLITCELLDLG_HXX
+
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <vcl/button.hxx>
+#include <vcl/button.hxx>
+
+#include <svx/stddlg.hxx>
+
+class SvxSplitTableDlg : public SvxStandardDialog
+{
+ FixedText maCountLbl;
+ NumericField maCountEdit;
+ FixedLine maCountFL;
+ ImageRadioButton maHorzBox;
+ ImageRadioButton maVertBox;
+ CheckBox maPropCB;
+ FixedLine maDirFL;
+ OKButton maOKBtn;
+ CancelButton maCancelBtn;
+ HelpButton maHelpBtn;
+
+protected:
+ virtual void Apply();
+
+public:
+ SvxSplitTableDlg(Window *pParent );
+ DECL_LINK( ClickHdl, Button * );
+
+ bool IsHorizontal() const;
+ bool IsProportional() const;
+ long GetCount() const;
+};
+
+#endif
diff --git a/svx/inc/svx/srchdlg.hxx b/svx/inc/svx/srchdlg.hxx
new file mode 100644
index 000000000000..c2a7893be044
--- /dev/null
+++ b/svx/inc/svx/srchdlg.hxx
@@ -0,0 +1,302 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_SRCHDLG_HXX
+#define _SVX_SRCHDLG_HXX
+
+// include ---------------------------------------------------------------
+
+
+#include <svtools/stdctrl.hxx>
+#include <vcl/combobox.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/button.hxx>
+#include <vcl/group.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/dialog.hxx>
+#include <sfx2/childwin.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <svl/svarray.hxx>
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+#include <svtools/svmedit.hxx>
+#include <svl/srchdefs.hxx>
+#include "svx/svxdllapi.h"
+
+
+// forward ---------------------------------------------------------------
+
+class SvxSearchItem;
+class MoreButton;
+class SfxStyleSheetBasePool;
+class SvxJSearchOptionsPage;
+class SvxSearchController;
+
+struct SearchDlg_Impl;
+
+#ifndef NO_SVX_SEARCH
+
+// struct SearchAttrItem -------------------------------------------------
+
+struct SearchAttrItem
+{
+ sal_uInt16 nSlot;
+ SfxPoolItem* pItem;
+};
+
+// class SearchAttrItemList ----------------------------------------------
+
+SV_DECL_VARARR_VISIBILITY(SrchAttrItemList, SearchAttrItem, 8, 8, SVX_DLLPUBLIC)
+
+class SVX_DLLPUBLIC SearchAttrItemList : private SrchAttrItemList
+{
+public:
+ SearchAttrItemList() {}
+ SearchAttrItemList( const SearchAttrItemList& rList );
+ ~SearchAttrItemList();
+
+ void Put( const SfxItemSet& rSet );
+ SfxItemSet& Get( SfxItemSet& rSet );
+ void Clear();
+ sal_uInt16 Count() const { return SrchAttrItemList::Count(); }
+ SearchAttrItem& operator[](sal_uInt16 nPos) const
+ { return SrchAttrItemList::operator[]( nPos ); }
+ SearchAttrItem& GetObject( sal_uInt16 nPos ) const
+ { return SrchAttrItemList::GetObject( nPos ); }
+
+ // der Pointer auf das Item wird nicht kopiert!!! (also nicht l"oschen)
+ void Insert( const SearchAttrItem& rItem )
+ { SrchAttrItemList::Insert( rItem, SrchAttrItemList::Count() ); }
+ // l"oscht die Pointer auf die Items
+ void Remove( sal_uInt16 nPos, sal_uInt16 nLen = 1 );
+};
+
+#ifndef SV_NODIALOG
+
+// class SvxSearchDialogWrapper ------------------------------------------
+
+#include <sfx2/layout.hxx>
+#include <sfx2/layout-pre.hxx>
+
+class SvxSearchDialog;
+class SVX_DLLPUBLIC SvxSearchDialogWrapper : public SfxChildWindow
+{
+ SvxSearchDialog *dialog;
+public:
+ SvxSearchDialogWrapper( Window*pParent, sal_uInt16 nId,
+ SfxBindings* pBindings, SfxChildWinInfo* pInfo );
+
+ ~SvxSearchDialogWrapper ();
+ SvxSearchDialog *getDialog ();
+ SFX_DECL_CHILDWINDOW(SvxSearchDialogWrapper);
+};
+
+// class SvxSearchDialog -------------------------------------------------
+
+/*
+ {k:\svx\prototyp\dialog\svx/srchdlg.hxx}
+
+ [Beschreibung]
+ In diesem Modeless-Dialog werden die Attribute einer Suche eingestellt
+ und damit eine Suche gestartet. Es sind mehrere Sucharten
+ ( Suchen, Alle suchen, Ersetzen, Alle ersetzen ) m"oglich.
+
+ [Items]
+ <SvxSearchItem><SID_ATTR_SEARCH>
+*/
+
+class SvxSearchDialog : public SfxModelessDialog
+{
+friend class SvxSearchController;
+friend class SvxSearchDialogWrapper;
+friend class SvxJSearchOptionsDialog;
+
+public:
+ SvxSearchDialog( Window* pParent, SfxBindings& rBind );
+ SvxSearchDialog( Window* pParent, SfxChildWindow* pChildWin, SfxBindings& rBind );
+ ~SvxSearchDialog();
+
+ virtual sal_Bool Close();
+
+ // Window
+ virtual void Activate();
+
+ void GetSearchItems( SfxItemSet& rSet );
+ void GetReplaceItems( SfxItemSet& rSet );
+
+ const SearchAttrItemList* GetSearchItemList() const
+ { return pSearchList; }
+ const SearchAttrItemList* GetReplaceItemList() const
+ { return pReplaceList; }
+
+ inline sal_Bool HasSearchAttributes() const;
+ inline sal_Bool HasReplaceAttributes() const;
+
+ PushButton& GetReplaceBtn() { return aReplaceBtn; }
+
+ sal_Int32 GetTransliterationFlags() const;
+
+private:
+ FixedText aSearchText;
+ ComboBox aSearchLB;
+ ListBox aSearchTmplLB;
+ FixedInfo aSearchAttrText;
+
+ FixedText aReplaceText;
+ ComboBox aReplaceLB;
+ ListBox aReplaceTmplLB;
+ FixedInfo aReplaceAttrText;
+
+ PushButton aSearchBtn;
+ PushButton aSearchAllBtn;
+ FixedLine aSearchCmdLine;
+ PushButton aReplaceBtn;
+ PushButton aReplaceAllBtn;
+
+ FixedLine aSearchComponentFL;
+ PushButton aSearchComponent1PB;
+ PushButton aSearchComponent2PB;
+
+ CheckBox aMatchCaseCB;
+ CheckBox aWordBtn;
+
+ FixedLine aButtonsFL;
+ MoreButton* pMoreBtn;
+ HelpButton aHelpBtn;
+ CancelButton aCloseBtn;
+
+ FixedLine aOptionsFL;
+ CheckBox aSelectionBtn;
+ CheckBox aBackwardsBtn;
+ CheckBox aRegExpBtn;
+ CheckBox aSimilarityBox;
+ PushButton aSimilarityBtn;
+ CheckBox aLayoutBtn;
+ CheckBox aNotesBtn;
+ CheckBox aJapMatchFullHalfWidthCB;
+ CheckBox aJapOptionsCB;
+ PushButton aJapOptionsBtn;
+
+ PushButton aAttributeBtn;
+ PushButton aFormatBtn;
+ PushButton aNoFormatBtn;
+
+ FixedLine aCalcFL;
+ FixedText aCalcSearchInFT;
+ ListBox aCalcSearchInLB;
+ FixedText aCalcSearchDirFT;
+ RadioButton aRowsBtn;
+ RadioButton aColumnsBtn;
+ CheckBox aAllSheetsCB;
+
+ SfxBindings& rBindings;
+ sal_Bool bWriter;
+ sal_Bool bSearch;
+ sal_Bool bFormat;
+ sal_uInt16 nOptions;
+ FASTBOOL bSet;
+ FASTBOOL bReadOnly;
+ FASTBOOL bConstruct;
+ sal_uIntPtr nModifyFlag;
+ String aStylesStr;
+ String aLayoutStr;
+ LocalizedString aCalcStr;
+
+ SvStringsDtor aSearchStrings;
+ SvStringsDtor aReplaceStrings;
+
+ SearchDlg_Impl* pImpl;
+ SearchAttrItemList* pSearchList;
+ SearchAttrItemList* pReplaceList;
+ SvxSearchItem* pSearchItem;
+
+ SvxSearchController* pSearchController;
+ SvxSearchController* pOptionsController;
+ SvxSearchController* pFamilyController;
+ SvxSearchController* pSearchSetController;
+ SvxSearchController* pReplaceSetController;
+
+ mutable sal_Int32 nTransliterationFlags;
+
+#ifdef _SVX_SRCHDLG_CXX
+ DECL_LINK( ModifyHdl_Impl, ComboBox* pEdit );
+ DECL_LINK( FlagHdl_Impl, Control* pCtrl );
+ DECL_LINK( CommandHdl_Impl, Button* pBtn );
+ DECL_LINK( TemplateHdl_Impl, Button* );
+ DECL_LINK( FocusHdl_Impl, Control* );
+ DECL_LINK( LoseFocusHdl_Impl, Control* );
+ DECL_LINK( FormatHdl_Impl, Button* );
+ DECL_LINK( NoFormatHdl_Impl, Button* );
+ DECL_LINK( AttributeHdl_Impl, Button* );
+ DECL_LINK( TimeoutHdl_Impl, Timer* );
+
+ void Construct_Impl();
+ void InitControls_Impl();
+ void CalculateDelta_Impl();
+ void Init_Impl( int bHasItemSet );
+ void InitAttrList_Impl( const SfxItemSet* pSSet,
+ const SfxItemSet* pRSet );
+ void Remember_Impl( const String &rStr,sal_Bool bSearch );
+ void PaintAttrText_Impl();
+ String& BuildAttrText_Impl( String& rStr, sal_Bool bSrchFlag ) const;
+
+ void TemplatesChanged_Impl( SfxStyleSheetBasePool& rPool );
+ void EnableControls_Impl( const sal_uInt16 nFlags );
+ void EnableControl_Impl( Control* pCtrl );
+ void SetItem_Impl( const SvxSearchItem* pItem );
+
+ void SetModifyFlag_Impl( const Control* pCtrl );
+ void SaveToModule_Impl();
+
+ void ApplyTransliterationFlags_Impl( sal_Int32 nSettings );
+#endif
+};
+
+#include <sfx2/layout-post.hxx>
+
+inline sal_Bool SvxSearchDialog::HasSearchAttributes() const
+{
+ int bLen = aSearchAttrText.GetText().Len();
+ return ( aSearchAttrText.IsEnabled() && bLen );
+}
+
+inline sal_Bool SvxSearchDialog::HasReplaceAttributes() const
+{
+ int bLen = aReplaceAttrText.GetText().Len();
+ return ( aReplaceAttrText.IsEnabled() && bLen );
+}
+
+
+//////////////////////////////////////////////////////////////////////
+
+
+#endif // SV_NODIALOG
+#endif // NO_SVX_SEARCH
+
+
+#endif
+
diff --git a/svx/inc/svx/stddlg.hxx b/svx/inc/svx/stddlg.hxx
new file mode 100644
index 000000000000..c56cac58f4ae
--- /dev/null
+++ b/svx/inc/svx/stddlg.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_STDDLG_HXX
+#define _SVX_STDDLG_HXX
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/basedlgs.hxx>
+#include "svx/svxdllapi.h"
+
+// class SvxStandardDialog -----------------------------------------------
+
+class SVX_DLLPUBLIC SvxStandardDialog: public SfxModalDialog
+{
+public:
+ SvxStandardDialog( Window* pParent, const ResId& rResId );
+ ~SvxStandardDialog();
+
+ short Execute();
+
+protected:
+ virtual void Apply() = 0; // pure virtual!!!
+};
+
+
+#endif
+
diff --git a/svx/inc/svx/strarray.hxx b/svx/inc/svx/strarray.hxx
new file mode 100644
index 000000000000..08f4975f1e35
--- /dev/null
+++ b/svx/inc/svx/strarray.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_STRARRAY_HXX
+#define _SVX_STRARRAY_HXX
+
+// include ---------------------------------------------------------------
+
+#ifndef _RESARY_HXX //autogen
+#include <tools/resary.hxx>
+#endif
+#include "svx/svxdllapi.h"
+
+// class SvxStringArray -------------------------------------------------
+
+class SVX_DLLPUBLIC SvxStringArray : public ResStringArray
+{
+public:
+ SvxStringArray( sal_uInt32 nResId );
+ SvxStringArray( const ResId& rResId );
+ ~SvxStringArray();
+
+ const String& GetStringByPos( sal_uInt32 nPos ) const;
+ const String& GetStringByType( long nType ) const;
+ long GetValueByStr( const String& rStr ) const;
+};
+
+
+#endif
+
diff --git a/svx/inc/svx/subtoolboxcontrol.hxx b/svx/inc/svx/subtoolboxcontrol.hxx
new file mode 100644
index 000000000000..f96562661703
--- /dev/null
+++ b/svx/inc/svx/subtoolboxcontrol.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_SUBTOOLBOXCONTROL_HXX
+#define _SVX_SUBTOOLBOXCONTROL_HXX
+
+#include "svx/svxdllapi.h"
+#include <sfx2/tbxctrl.hxx>
+
+//----------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxSubToolBoxControl : public SfxToolBoxControl
+{
+
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SvxSubToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxSubToolBoxControl();
+
+ virtual SfxPopupWindowType GetPopupWindowType() const;
+ virtual SfxPopupWindow* CreatePopupWindow();
+};
+
+//
+//----------------------------------------------------------------------------
+
+#endif
+
+
diff --git a/svx/inc/svx/svdattr.hxx b/svx/inc/svx/svdattr.hxx
new file mode 100644
index 000000000000..4c4ddde2912d
--- /dev/null
+++ b/svx/inc/svx/svdattr.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDATTR_HXX
+#define _SVDATTR_HXX
+
+#ifndef _SOLAR_HRC
+#include <svl/solar.hrc>
+#endif
+#include <tools/solar.h>
+#include <svx/sdangitm.hxx>
+#include <svx/sderitm.hxx>
+#include <svx/sdmetitm.hxx>
+#include <svx/sdooitm.hxx>
+#include <svx/sdprcitm.hxx>
+#include <svx/sdshcitm.hxx>
+#include <svx/sdshitm.hxx>
+#include <svx/sdshtitm.hxx>
+#include <svx/sdsxyitm.hxx>
+#include <svx/sdtaaitm.hxx>
+#ifndef _SDTACITM_HXX
+#include <svx/sdtacitm.hxx>
+#endif
+#ifndef _SDTACITM_HXX
+#include <svx/sdtaditm.hxx>
+#endif
+#include <svx/sdtagitm.hxx>
+#include <svx/sdtaiitm.hxx>
+#include <svx/sdtaitm.hxx>
+#ifndef _SDTAKITM_HXX
+#include <svx/sdtakitm.hxx>
+#endif
+#include <svx/sdtayitm.hxx>
+#ifndef SDTCFITM_HXX
+#include <svx/sdtcfitm.hxx>
+#endif
+#ifndef _SDTDITM_HXX
+#include <svx/sdtditm.hxx>
+#endif
+#include <svx/sdtfsitm.hxx>
+#include <svx/sdtmfitm.hxx>
+#include <svx/sdynitm.hxx>
+#include <svx/sdgluitm.hxx>
+#include <svx/sdginitm.hxx>
+#include <svx/sdgtritm.hxx>
+#include <svx/sdgcoitm.hxx>
+#include <svx/sdggaitm.hxx>
+#include <svx/sdasitm.hxx>
+#include <svx/sdgmoitm.hxx>
+#include <svx/sdasaitm.hxx>
+#endif
+
diff --git a/svx/inc/svx/svdattrx.hxx b/svx/inc/svx/svdattrx.hxx
new file mode 100644
index 000000000000..7fba70ed1ed2
--- /dev/null
+++ b/svx/inc/svx/svdattrx.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDATTRX_HXX
+#define _SVDATTRX_HXX
+
+#include <svx/sxmlhitm.hxx>
+#include <svx/sxallitm.hxx>
+#include <svx/sxcaitm.hxx>
+#include <svx/sxcecitm.hxx>
+
+#ifndef _SXCGIITM_HXX
+#include <svx/sxcgitm.hxx>
+#endif
+#include <svx/sxciaitm.hxx>
+#include <svx/sxcikitm.hxx>
+#include <svx/sxcllitm.hxx>
+#include <svx/sxctitm.hxx>
+#include <svx/sxekitm.hxx>
+#include <svx/sxelditm.hxx>
+#include <svx/sxenditm.hxx>
+
+#ifndef _SXFIITM_HXX
+#include <svx/sxfiitm.hxx>
+#endif
+
+#ifndef _SXLAYITM_HXX
+#include <svx/sxlayitm.hxx>
+#endif
+#include <svx/sxlogitm.hxx>
+#include <svx/sxmbritm.hxx>
+#include <svx/sxmfsitm.hxx>
+#include <svx/sxmkitm.hxx>
+#include <svx/sxmoitm.hxx>
+#include <svx/sxmovitm.hxx>
+
+#ifndef _SXMSIITM_HXX
+#include <svx/sxmsitm.hxx>
+#endif
+#include <svx/sxmspitm.hxx>
+#include <svx/sxmsuitm.hxx>
+#include <svx/sxmtaitm.hxx>
+#include <svx/sxmtfitm.hxx>
+#include <svx/sxmtpitm.hxx>
+#include <svx/sxmtritm.hxx>
+#include <svx/sxmuitm.hxx>
+#include <svx/sxoneitm.hxx>
+#include <svx/sxonitm.hxx>
+#include <svx/sxopitm.hxx>
+#include <svx/sxraitm.hxx>
+#include <svx/sxreaitm.hxx>
+#include <svx/sxreoitm.hxx>
+#include <svx/sxroaitm.hxx>
+#include <svx/sxrooitm.hxx>
+#include <svx/sxsaitm.hxx>
+#include <svx/sxsalitm.hxx>
+#include <svx/sxsiitm.hxx>
+#include <svx/sxsoitm.hxx>
+#include <svx/sxtraitm.hxx>
+
+#endif //_SVDATTRX_HXX
diff --git a/svx/inc/svx/svdcrtv.hxx b/svx/inc/svx/svdcrtv.hxx
new file mode 100644
index 000000000000..a197fded69c9
--- /dev/null
+++ b/svx/inc/svx/svdcrtv.hxx
@@ -0,0 +1,209 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDCRTV_HXX
+#define _SVDCRTV_HXX
+
+#include <svx/svddrgv.hxx>
+#include "svx/svxdllapi.h"
+
+//************************************************************
+// Vorausdeklarationen
+//************************************************************
+
+class XLineAttrSetItem;
+class XFillAttrSetItem;
+class SdrEdgeObj;
+class SdrObjConnection;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@ @@@@@ @@@@@ @@@@ @@@@@@ @@@@@ @@ @@ @@ @@@@@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@
+// @@ @@@@@ @@@@ @@@@@@ @@ @@@@ @@@@@ @@ @@@@ @@@@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@
+// @@@@ @@ @@ @@@@@ @@ @@ @@ @@@@@ @ @@ @@@@@ @@ @@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+class ImplConnectMarkerOverlay;
+class ImpSdrCreateViewExtraData;
+
+class SVX_DLLPUBLIC SdrCreateView: public SdrDragView
+{
+ friend class SdrPageView;
+
+protected:
+ SdrObject* pAktCreate; // Aktuell in Erzeugung befindliches Objekt
+ SdrPageView* pCreatePV; // Hier wurde die Erzeugung gestartet
+ ImplConnectMarkerOverlay* mpCoMaOverlay;
+
+ // for migrating stuff from XOR, use ImpSdrCreateViewExtraData ATM to not need to
+ // compile the apps all the time
+ ImpSdrCreateViewExtraData* mpCreateViewExtraData;
+
+ Pointer aAktCreatePointer;
+
+ sal_Int32 nAutoCloseDistPix;
+ sal_Int32 nFreeHandMinDistPix;
+ sal_uInt32 nAktInvent; // Aktuell eingestelltes
+ sal_uInt16 nAktIdent; // Obj fuer Neuerzeugung
+
+ unsigned bAutoTextEdit : 1; // Textedit nach dem erzeugen eines Textrahmens starten
+ unsigned b1stPointAsCenter : 1;
+ unsigned bUseIncompatiblePathCreateInterface : 1;
+ unsigned bAutoClosePolys : 1;
+
+ void ImpClearConnectMarker();
+
+private:
+ SVX_DLLPRIVATE void ImpClearVars();
+ SVX_DLLPRIVATE void ImpMakeCreateAttr();
+ SVX_DLLPRIVATE void ImpDelCreateAttr();
+
+protected:
+ sal_Bool ImpBegCreateObj(sal_uInt32 nInvent, sal_uInt16 nIdent, const Point& rPnt, OutputDevice* pOut,
+ sal_Int16 nMinMov, SdrPageView* pPV, const Rectangle& rLogRect, SdrObject* pPreparedFactoryObject);
+
+ void ShowCreateObj(/*OutputDevice* pOut, sal_Bool bFull*/);
+ void HideCreateObj(/*OutputDevice* pOut, sal_Bool bFull*/);
+ sal_Bool CheckEdgeMode();
+
+protected:
+ // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
+ SdrCreateView(SdrModel* pModel1, OutputDevice* pOut = 0L);
+ virtual ~SdrCreateView();
+
+public:
+ virtual sal_Bool IsAction() const;
+ virtual void MovAction(const Point& rPnt);
+ virtual void EndAction();
+ virtual void BckAction();
+ virtual void BrkAction();
+ virtual void TakeActionRect(Rectangle& rRect) const;
+
+ virtual sal_Bool MouseMove(const MouseEvent& rMEvt, Window* pWin);
+
+ void SetActiveLayer(const String& rName) { aAktLayer=rName; }
+ const String& GetActiveLayer() const { return aAktLayer; }
+ void SetMeasureLayer(const String& rName) { aMeasureLayer=rName; }
+ const String& GetMeasureLayer() const { return aMeasureLayer; }
+
+ // Ist der MeasureLayer nicht gesetzt (Leerstring), so
+ // wird der ActiveLayer auch fuer Bemassung verwendet.
+ void SetEditMode(SdrViewEditMode eMode) { SdrDragView::SetEditMode(eMode); CheckEdgeMode(); }
+ void SetEditMode(sal_Bool bOn=sal_True) { SdrDragView::SetEditMode(bOn); CheckEdgeMode(); }
+ void SetCreateMode(sal_Bool bOn=sal_True) { SdrDragView::SetCreateMode(bOn); CheckEdgeMode(); }
+ void SetGluePointEditMode(sal_Bool bOn=sal_True) { SdrDragView::SetGluePointEditMode(bOn); CheckEdgeMode(); }
+
+ // Feststellen, ob Textwerkzeug aktiviert
+ sal_Bool IsTextTool() const;
+
+ // Feststellen, ob Objektverbinderwerkzeug aktiviert
+ sal_Bool IsEdgeTool() const;
+
+ // Feststellen, ob Bemassungswerkzeug aktiviert
+ sal_Bool IsMeasureTool() const;
+
+ void SetCurrentObj(sal_uInt16 nIdent, sal_uInt32 nInvent=SdrInventor);
+ void TakeCurrentObj(sal_uInt16& nIdent, sal_uInt32& nInvent) const { nInvent=nAktInvent; nIdent=nAktIdent; }
+ sal_uInt32 GetCurrentObjInventor() const { return nAktInvent; }
+ sal_uInt16 GetCurrentObjIdentifier() const { return nAktIdent; }
+
+ // Starten des normalen Create
+ sal_Bool BegCreateObj(const Point& rPnt, OutputDevice* pOut=NULL, short nMinMov=-3, SdrPageView* pPV=NULL);
+ sal_Bool BegCreatePreparedObject(const Point& rPnt, sal_Int16 nMinMov, SdrObject* pPreparedFactoryObject);
+ void MovCreateObj(const Point& rPnt);
+ sal_Bool EndCreateObj(SdrCreateCmd eCmd);
+ void BckCreateObj(); // z.B. wieder 1 Polygonpunkt zurueck.
+ void BrkCreateObj();
+ sal_Bool IsCreateObj() const { return pAktCreate!=NULL; }
+ SdrObject* GetCreateObj() const { return pAktCreate; }
+
+ // BegCreateCaptionObj() erzeugt ein SdrCaptionObj (Legendenobjekt).
+ // rObjSiz ist die anfaengliche Groesse des Legenden-Textrahmens.
+ // gedraggd wird lediglich die Laenge des Zipfel.
+ sal_Bool BegCreateCaptionObj(const Point& rPnt, const Size& rObjSiz, OutputDevice* pOut=NULL, short nMinMov=-3, SdrPageView* pPV=NULL);
+
+ // Wenn TextEditAfterCreate auf sal_True steht (das ist der Default),
+ // dann wird nach dem erzeugen eines Textrahmenobjekts (OBJ_TEXT,
+ // OBJ_TEXTEXT, OBJ_OUTLINERTEXT, OBJ_TITLETEXT, OBJ_CAPTION)
+ // automatisch ein TextEdit (SdrObjEditView::SdrBeginTextEdit) gestartet.
+ sal_Bool IsTextEditAfterCreate() const { return bAutoTextEdit; }
+ void SetTextEditAfterCreate(sal_Bool bOn) { bAutoTextEdit = bOn; }
+
+ // Erzeugen eines Kreises/Rechtecks/Textrahmens wobei der 1. Punkt
+ // nicht die linke obere Ecke, sondern das Zentrum des Objekts vorgibt.
+ // Persistentes Flag. Default=FALSE.
+ sal_Bool IsCreate1stPointAsCenter() const { return b1stPointAsCenter; }
+ void SetCreate1stPointAsCenter(sal_Bool bOn) { b1stPointAsCenter = bOn; }
+
+ // Fuer Polylines (OBJ_PLIN) und Freihandlinien (OBJ_FREELINE). Ist dieses
+ // Flag sal_True, werden diese beiden Objekttypen implizit geschlossen und in
+ // Polygon (OBJ_POLY) bzw. Freihandflaeche (OBJ_FREEFILL) gewandelt falls
+ // zum Ende des Create die Distanz zwischen Startpunkt und Endpunkt des
+ // Objekts <=n Pixel ist, wobei SetAutoCloseDistPix vorgegeben wird.
+ // Default=TRUE.
+ sal_Bool IsAutoClosePolys() const { return bAutoClosePolys; }
+ void SetAutoClosePolys(sal_Bool bOn) { bAutoClosePolys=bOn; }
+
+ // Default=5 Pixel.
+ sal_uInt16 GetAutoCloseDistPix() const { return sal_uInt16(nAutoCloseDistPix); }
+ void SetAutoCloseDistPix(sal_uInt16 nVal) { nAutoCloseDistPix=nVal; }
+
+ // Vorgabe des minimalen Pixelabstands zwischen 2 Bezierpunkten bei der
+ // Erzeugung einer Freihandlinie.
+ // Default=10 Pixel.
+ sal_uInt16 GetFreeHandMinDistPix() const { return sal_uInt16(nFreeHandMinDistPix); }
+ void SetFreeHandMinDistPix(sal_uInt16 nVal) { nFreeHandMinDistPix=nVal; }
+
+ // Wer das (zur restlichen Create-Funktionalitaet von SvDraw) inkompatible
+ // Create-Interface am PathObj beibehalten moechte muss das nachfolgende
+ // Flag setzen. Dieses wirkt sich aus bei den Objekttypen:
+ // OBJ_POLY, OBJ_PLIN, OBJ_PATHLINE, OBJ_PATHFILL
+ // Dieses Flag hat nur voruebergehenden Character. Die betroffenen
+ // Applikationen sollten alsbald umgestellt werden.
+ // Default=sal_False;
+ sal_Bool IsUseIncompatiblePathCreateInterface() const { return bUseIncompatiblePathCreateInterface; }
+ void SetUseIncompatiblePathCreateInterface(sal_Bool bOn) { bUseIncompatiblePathCreateInterface = bOn; }
+ void SetConnectMarker(const SdrObjConnection& rCon, const SdrPageView& rPV);
+ void HideConnectMarker();
+
+ // Attribute des ggf. gerade in der Erzeugung befindlichen Objekts
+ /* new interface src537 */
+ sal_Bool GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False) const;
+
+ sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll);
+ SfxStyleSheet* GetStyleSheet() const; // SfxStyleSheet* GetStyleSheet(sal_Bool& rOk) const;
+ sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr);
+};
+
+#endif //_SVDCRTV_HXX
+
diff --git a/svx/inc/svx/svddef.hxx b/svx/inc/svx/svddef.hxx
new file mode 100644
index 000000000000..d702a6eac5ab
--- /dev/null
+++ b/svx/inc/svx/svddef.hxx
@@ -0,0 +1,313 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDDEF_HXX
+#define _SVDDEF_HXX
+
+#include <svx/xdef.hxx>
+
+/*************************************************************************/
+// SdrItemPool V2, 09-11-1995:
+// 7 neue Items fuer XLineAttrSetItem
+// 7 neue Items fuer XFillAttrSetItem
+// 8 neue Items fuer SdrShadowSetItem
+// 5 neue Items fuer SdrCaptionSetItem
+// 25 neue Items fuer SdrMiscSetItem
+// 6 neue Items fuer SdrNotPersist
+// SdrItemPool V3, 29-02-1996
+// 17 neue Items fuer XFillAttrSetItem (Bitmapfuellungen) (von KA)
+// SdrItemPool V4, 10-08-1996
+// 45 neue Items fuer Edge und Measure (Verbinder und Bemassungsobjekt) (von Joe)
+// SdrItemPool V4+, 18-10-1996
+// 8 neue Items fuer CircItems
+// 18 neue Items fuer NotPersist+Umbau dort
+// SdrItemPool V4++, 13-11-1996
+// 2 neue Items fuer NotPersist+(MoveX/Y)
+// SdrItemPool V4+++, 07-06-1999
+// 15 neue Items fuer NotPersist (Reserve)
+// 15 neue Items fuer GrafItems
+//
+// WhichMapping:
+// V1 Range = 1000..1065 (66)
+// V2 Range = 1000..1123 (124) (58 neue Whiches)
+// V3 Range = 1000..1140 (141) (17 neue Whiches)
+// V4 Range = 1000..1185 (186) (45 neue Whiches)
+// Map V2: 10 6 20 4 11 6 9
+// V1: 1000..1009, 1010..1015, 1016..1035, 1036..1039, 1040..1050, 1051..1056 1057..1065
+// V2: 1000..1009, 1017..1022, 1030..1049, 1050..1053, 1062..1072, 1078..1083, 1109..1117, und hinten noch 6 neue dran
+// |<------------ XOut ------------>| |<----------- SvDraw ----------->
+// Map V3:
+// V2: 1000..1029, 1030..1123
+// V3: 1000..1029, 1047..1140
+// Map V4:
+// V3: 1000..1126, 1127..1140
+// V4: 1000..1126, 1172..1185
+
+#define SDRATTR_START XATTR_START /* 1000 */
+ /* Pool V4*/ /* Pool V3*/ /* Pool V2*/
+#define SDRATTR_SHADOW_FIRST (XATTR_END + 1) /* 1067 */ /* 1067 */ /* 1050 */ /* Pool V1: 1036 */
+#define SDRATTR_SHADOW (SDRATTR_SHADOW_FIRST+ 0) /* 1067 */ /* 1067 */ /* 1050 */
+#define SDRATTR_SHADOWCOLOR (SDRATTR_SHADOW_FIRST+ 1) /* 1068 */ /* 1068 */ /* 1051 */
+#define SDRATTR_SHADOWXDIST (SDRATTR_SHADOW_FIRST+ 2) /* 1069 */ /* 1069 */ /* 1052 */
+#define SDRATTR_SHADOWYDIST (SDRATTR_SHADOW_FIRST+ 3) /* 1070 */ /* 1070 */ /* 1053 */
+#define SDRATTR_SHADOWTRANSPARENCE (SDRATTR_SHADOW_FIRST+ 4) /* 1071 */ /* 1071 */ /* 1054 */ /* Pool V2 */
+#define SDRATTR_SHADOW3D (SDRATTR_SHADOW_FIRST+ 5) /* 1072 */ /* 1072 */ /* 1055 */ /* Pool V2 */
+#define SDRATTR_SHADOWPERSP (SDRATTR_SHADOW_FIRST+ 6) /* 1073 */ /* 1073 */ /* 1056 */ /* Pool V2 */
+#define SDRATTR_SHADOW_LAST (SDRATTR_SHADOWPERSP) /* 1078 */ /* 1078 */ /* 1061 */ /* Pool V1: 1039 */
+
+#define SDRATTR_CAPTION_FIRST (SDRATTR_SHADOW_LAST + 1) /* 1080 */ /* 1080 */ /* 1063 */ /* Pool V1: 1041 */
+#define SDRATTR_CAPTIONTYPE (SDRATTR_CAPTION_FIRST+ 0) /* 1080 */ /* 1080 */ /* 1063 */
+#define SDRATTR_CAPTIONFIXEDANGLE (SDRATTR_CAPTION_FIRST+ 1) /* 1081 */ /* 1081 */ /* 1064 */
+#define SDRATTR_CAPTIONANGLE (SDRATTR_CAPTION_FIRST+ 2) /* 1082 */ /* 1082 */ /* 1065 */
+#define SDRATTR_CAPTIONGAP (SDRATTR_CAPTION_FIRST+ 3) /* 1083 */ /* 1083 */ /* 1066 */
+#define SDRATTR_CAPTIONESCDIR (SDRATTR_CAPTION_FIRST+ 4) /* 1084 */ /* 1084 */ /* 1067 */
+#define SDRATTR_CAPTIONESCISREL (SDRATTR_CAPTION_FIRST+ 5) /* 1085 */ /* 1085 */ /* 1068 */
+#define SDRATTR_CAPTIONESCREL (SDRATTR_CAPTION_FIRST+ 6) /* 1086 */ /* 1086 */ /* 1069 */
+#define SDRATTR_CAPTIONESCABS (SDRATTR_CAPTION_FIRST+ 7) /* 1087 */ /* 1087 */ /* 1070 */
+#define SDRATTR_CAPTIONLINELEN (SDRATTR_CAPTION_FIRST+ 8) /* 1088 */ /* 1088 */ /* 1071 */
+#define SDRATTR_CAPTIONFITLINELEN (SDRATTR_CAPTION_FIRST+ 9) /* 1089 */ /* 1089 */ /* 1072 */
+#define SDRATTR_CAPTION_LAST (SDRATTR_CAPTIONFITLINELEN) /* 1094 */ /* 1094 */ /* 1077 */ /* Pool V1: 1050 */
+
+#define SDRATTR_MISC_FIRST (SDRATTR_CAPTION_LAST + 1) /* 1097 */ /* 1097 */ /* 1080 */ /* Pool V1: 1053 */
+#define SDRATTR_ECKENRADIUS (SDRATTR_MISC_FIRST + 0) /* 1097 */ /* 1097 */ /* 1080 long, def=0 */
+#define SDRATTR_TEXT_MINFRAMEHEIGHT (SDRATTR_MISC_FIRST + 1) /* 1098 */ /* 1098 */ /* 1081 long, def=0 */
+#define SDRATTR_TEXT_AUTOGROWHEIGHT (SDRATTR_MISC_FIRST + 2) /* 1099 */ /* 1099 */ /* 1082 sal_Bool, def=sal_True */
+#define SDRATTR_TEXT_FITTOSIZE (SDRATTR_MISC_FIRST + 3) /* 1100 */ /* 1100 */ /* 1083 enum, def=SDRTEXTFIT_NONE */
+#define SDRATTR_TEXT_LEFTDIST (SDRATTR_MISC_FIRST + 4) /* 1101 */ /* 1101 */ /* 1084 long, def=0 */ /* Pool V2 */
+#define SDRATTR_TEXT_RIGHTDIST (SDRATTR_MISC_FIRST + 5) /* 1102 */ /* 1102 */ /* 1085 long, def=0 */ /* Pool V2 */
+#define SDRATTR_TEXT_UPPERDIST (SDRATTR_MISC_FIRST + 6) /* 1103 */ /* 1103 */ /* 1086 long, def=0 */ /* Pool V2 */
+#define SDRATTR_TEXT_LOWERDIST (SDRATTR_MISC_FIRST + 7) /* 1104 */ /* 1104 */ /* 1087 long, def=0 */ /* Pool V2 */
+#define SDRATTR_TEXT_VERTADJUST (SDRATTR_MISC_FIRST + 8) /* 1105 */ /* 1105 */ /* 1088 enum, def=SDRTEXTVERTADJUST_TOP */ /* Pool V2 */
+#define SDRATTR_TEXT_MAXFRAMEHEIGHT (SDRATTR_MISC_FIRST + 9) /* 1106 */ /* 1106 */ /* 1089 long, def=0 - Pool V2 */
+#define SDRATTR_TEXT_MINFRAMEWIDTH (SDRATTR_MISC_FIRST +10) /* 1107 */ /* 1107 */ /* 1090 long, def=0 - Pool V2 */
+#define SDRATTR_TEXT_MAXFRAMEWIDTH (SDRATTR_MISC_FIRST +11) /* 1108 */ /* 1108 */ /* 1091 long, def=0 - Pool V2 */
+#define SDRATTR_TEXT_AUTOGROWWIDTH (SDRATTR_MISC_FIRST +12) /* 1109 */ /* 1109 */ /* 1092 sal_Bool, def=sal_False - Pool V2 */
+#define SDRATTR_TEXT_HORZADJUST (SDRATTR_MISC_FIRST +13) /* 1110 */ /* 1110 */ /* 1093 enum, def=SDRTEXTHORZADJUST_LEFT */ /* Pool V2+ (04-12-1995) */
+#define SDRATTR_TEXT_ANIKIND (SDRATTR_MISC_FIRST +14) /* 1111 */ /* 1111 */ /* 1094 enum, def=SDRTEXTANI_NONE - Pool V2/V4 */
+#define SDRATTR_TEXT_ANIDIRECTION (SDRATTR_MISC_FIRST +15) /* 1112 */ /* 1112 */ /* 1095 enum, def=SDRTEXTANI_LEFT - Pool V2/V4 */
+#define SDRATTR_TEXT_ANISTARTINSIDE (SDRATTR_MISC_FIRST +16) /* 1113 */ /* 1113 */ /* 1096 sal_Bool, def=sal_False - Pool V2/V4 */
+#define SDRATTR_TEXT_ANISTOPINSIDE (SDRATTR_MISC_FIRST +17) /* 1114 */ /* 1114 */ /* 1097 sal_Bool, def=sal_False - Pool V2/V4 */
+#define SDRATTR_TEXT_ANICOUNT (SDRATTR_MISC_FIRST +18) /* 1115 */ /* 1115 */ /* 1098 sal_uInt16, def=0 - Pool V2/V4 */
+#define SDRATTR_TEXT_ANIDELAY (SDRATTR_MISC_FIRST +19) /* 1116 */ /* 1116 */ /* 1099 sal_uInt16, def=0 - Pool V2/V4 */
+#define SDRATTR_TEXT_ANIAMOUNT (SDRATTR_MISC_FIRST +20) /* 1117 */ /* 1117 */ /* 1100 sal_uInt16, def=0 - Pool V2/V4 */
+#define SDRATTR_TEXT_CONTOURFRAME (SDRATTR_MISC_FIRST +21) /* 1118 */ /* 1118 */ /* 1101 */ /* Pool V2 */
+#define SDRATTR_CUSTOMSHAPE_ADJUSTMENT (SDRATTR_MISC_FIRST +22) /* 1119 */ /* 1119 */ /* 1102 */ /* Pool V2 */
+#define SDRATTR_XMLATTRIBUTES (SDRATTR_MISC_FIRST +23) /* 1120 */ /* 1120 */ /* 1103 */ /* Pool V2 */
+#define SDRATTR_TEXT_USEFIXEDCELLHEIGHT (SDRATTR_MISC_FIRST +24) /* 1121 */ /* 1121 */ /* 1104 */ /* Pool V2 */
+#define SDRATTR_TEXT_WORDWRAP (SDRATTR_MISC_FIRST +25) /* 1122 */ /* 1122 */ /* 1105 */ /* Pool V2 */
+#define SDRATTR_TEXT_AUTOGROWSIZE (SDRATTR_MISC_FIRST +26) /* 1123 */ /* 1123 */ /* 1106 */ /* Pool V2 */
+#define SDRATTR_MISC_LAST (SDRATTR_TEXT_AUTOGROWSIZE) /* 1125 */ /* 1125 */ /* 1108 */ /* Pool V1: 1056 */
+
+#define SDRATTR_EDGE_FIRST (SDRATTR_MISC_LAST + 1) /* 1127 */ /* Pool V4 */
+#define SDRATTR_EDGEKIND (SDRATTR_EDGE_FIRST + 0) /* 1127 */ /* Pool V4 */
+#define SDRATTR_EDGENODE1HORZDIST (SDRATTR_EDGE_FIRST + 1) /* 1128 */ /* Pool V4 */
+#define SDRATTR_EDGENODE1VERTDIST (SDRATTR_EDGE_FIRST + 2) /* 1129 */ /* Pool V4 */
+#define SDRATTR_EDGENODE2HORZDIST (SDRATTR_EDGE_FIRST + 3) /* 1130 */ /* Pool V4 */
+#define SDRATTR_EDGENODE2VERTDIST (SDRATTR_EDGE_FIRST + 4) /* 1131 */ /* Pool V4 */
+#define SDRATTR_EDGENODE1GLUEDIST (SDRATTR_EDGE_FIRST + 5) /* 1132 */ /* Pool V4 */
+#define SDRATTR_EDGENODE2GLUEDIST (SDRATTR_EDGE_FIRST + 6) /* 1133 */ /* Pool V4 */
+#define SDRATTR_EDGELINEDELTAANZ (SDRATTR_EDGE_FIRST + 7) /* 1134 */ /* Pool V4 */
+#define SDRATTR_EDGELINE1DELTA (SDRATTR_EDGE_FIRST + 8) /* 1135 */ /* Pool V4 */
+#define SDRATTR_EDGELINE2DELTA (SDRATTR_EDGE_FIRST + 9) /* 1136 */ /* Pool V4 */
+#define SDRATTR_EDGELINE3DELTA (SDRATTR_EDGE_FIRST +10) /* 1137 */ /* Pool V4 */
+#define SDRATTR_EDGE_LAST (SDRATTR_EDGELINE3DELTA) /* 1145 */ /* Pool V4 */
+
+#define SDRATTR_MEASURE_FIRST (SDRATTR_EDGE_LAST + 1) /* 1147 */ /* Pool V4 */
+#define SDRATTR_MEASUREKIND (SDRATTR_MEASURE_FIRST+ 0) /* 1147 */ /* Pool V4 */
+#define SDRATTR_MEASURETEXTHPOS (SDRATTR_MEASURE_FIRST+ 1) /* 1148 */ /* Pool V4 */
+#define SDRATTR_MEASURETEXTVPOS (SDRATTR_MEASURE_FIRST+ 2) /* 1149 */ /* Pool V4 */
+#define SDRATTR_MEASURELINEDIST (SDRATTR_MEASURE_FIRST+ 3) /* 1150 */ /* Pool V4 */
+#define SDRATTR_MEASUREHELPLINEOVERHANG (SDRATTR_MEASURE_FIRST+ 4) /* 1151 */ /* Pool V4 */
+#define SDRATTR_MEASUREHELPLINEDIST (SDRATTR_MEASURE_FIRST+ 5) /* 1152 */ /* Pool V4 */
+#define SDRATTR_MEASUREHELPLINE1LEN (SDRATTR_MEASURE_FIRST+ 6) /* 1153 */ /* Pool V4 */
+#define SDRATTR_MEASUREHELPLINE2LEN (SDRATTR_MEASURE_FIRST+ 7) /* 1154 */ /* Pool V4 */
+#define SDRATTR_MEASUREBELOWREFEDGE (SDRATTR_MEASURE_FIRST+ 8) /* 1155 */ /* Pool V4 */
+#define SDRATTR_MEASURETEXTROTA90 (SDRATTR_MEASURE_FIRST+ 9) /* 1156 */ /* Pool V4 */
+#define SDRATTR_MEASURETEXTUPSIDEDOWN (SDRATTR_MEASURE_FIRST+10) /* 1157 */ /* Pool V4 */
+#define SDRATTR_MEASUREOVERHANG (SDRATTR_MEASURE_FIRST+11) /* 1158 */ /* Pool V4 */
+#define SDRATTR_MEASUREUNIT (SDRATTR_MEASURE_FIRST+12) /* 1159 */ /* Pool V4 */
+#define SDRATTR_MEASURESCALE (SDRATTR_MEASURE_FIRST+13) /* 1160 */ /* Pool V4 */
+#define SDRATTR_MEASURESHOWUNIT (SDRATTR_MEASURE_FIRST+14) /* 1161 */ /* Pool V4 */
+#define SDRATTR_MEASUREFORMATSTRING (SDRATTR_MEASURE_FIRST+15) /* 1162 */ /* Pool V4 */
+#define SDRATTR_MEASURETEXTAUTOANGLE (SDRATTR_MEASURE_FIRST+16) /* 1163 */ /* Pool V4, Nachtrag 25-9-1996 */
+#define SDRATTR_MEASURETEXTAUTOANGLEVIEW (SDRATTR_MEASURE_FIRST+17) /* 1164 */ /* Pool V4, Nachtrag 25-9-1996 */
+#define SDRATTR_MEASURETEXTISFIXEDANGLE (SDRATTR_MEASURE_FIRST+18) /* 1165 */ /* Pool V4, Nachtrag 25-9-1996 */
+#define SDRATTR_MEASURETEXTFIXEDANGLE (SDRATTR_MEASURE_FIRST+19) /* 1166 */ /* Pool V4, Nachtrag 25-9-1996 */
+#define SDRATTR_MEASUREDECIMALPLACES (SDRATTR_MEASURE_FIRST+20) /* 1167 */ /* Pool V4 */
+#define SDRATTR_MEASURE_LAST (SDRATTR_MEASUREDECIMALPLACES) /* 1170 */ /* Pool V4 */
+
+#define SDRATTR_CIRC_FIRST (SDRATTR_MEASURE_LAST+ 1) /* 1172 */ /* Pool V4+ */
+#define SDRATTR_CIRCKIND (SDRATTR_CIRC_FIRST+ 0) /* 1172 */ /* Pool V4+ */
+#define SDRATTR_CIRCSTARTANGLE (SDRATTR_CIRC_FIRST+ 1) /* 1173 */ /* Pool V4+ */
+#define SDRATTR_CIRCENDANGLE (SDRATTR_CIRC_FIRST+ 2) /* 1174 */ /* Pool V4+ */
+#define SDRATTR_CIRC_LAST (SDRATTR_CIRCENDANGLE) /* 1178 */ /* Pool V4+ */
+
+// Nur fuer Interfaceing, not implemented yet. /* V4+ */
+#define SDRATTR_NOTPERSIST_FIRST (SDRATTR_CIRC_LAST + 1) /* 1180 */ /* 1172 */ /* 1127 */ /* 1110 */ /* Pool V1: 1058 */
+#define SDRATTR_OBJMOVEPROTECT (SDRATTR_NOTPERSIST_FIRST+ 0) /* 1180 sal_Bool, def=sal_False */
+#define SDRATTR_OBJSIZEPROTECT (SDRATTR_NOTPERSIST_FIRST+ 1) /* 1181 sal_Bool, def=sal_False */
+#define SDRATTR_OBJPRINTABLE (SDRATTR_NOTPERSIST_FIRST+ 2) /* 1182 sal_Bool, def=sal_True */
+#define SDRATTR_LAYERID (SDRATTR_NOTPERSIST_FIRST+ 3) /* 1183 sal_uInt16, def=0 */
+#define SDRATTR_LAYERNAME (SDRATTR_NOTPERSIST_FIRST+ 4) /* 1184 String, def="" */
+#define SDRATTR_OBJECTNAME (SDRATTR_NOTPERSIST_FIRST+ 5) /* 1185 String, def="" */
+#define SDRATTR_ALLPOSITIONX (SDRATTR_NOTPERSIST_FIRST+ 6) /* 1186 long, def=0 */
+#define SDRATTR_ALLPOSITIONY (SDRATTR_NOTPERSIST_FIRST+ 7) /* 1187 long, def=0 */
+#define SDRATTR_ALLSIZEWIDTH (SDRATTR_NOTPERSIST_FIRST+ 8) /* 1188 long, def=0 */
+#define SDRATTR_ALLSIZEHEIGHT (SDRATTR_NOTPERSIST_FIRST+ 9) /* 1189 long, def=0 */
+#define SDRATTR_ONEPOSITIONX (SDRATTR_NOTPERSIST_FIRST+10) /* 1190 long, def=0 */
+#define SDRATTR_ONEPOSITIONY (SDRATTR_NOTPERSIST_FIRST+11) /* 1191 long, def=0 */
+#define SDRATTR_ONESIZEWIDTH (SDRATTR_NOTPERSIST_FIRST+12) /* 1192 long, def=0 */
+#define SDRATTR_ONESIZEHEIGHT (SDRATTR_NOTPERSIST_FIRST+13) /* 1193 long, def=0 */
+#define SDRATTR_LOGICSIZEWIDTH (SDRATTR_NOTPERSIST_FIRST+14) /* 1194 long, def=0 */
+#define SDRATTR_LOGICSIZEHEIGHT (SDRATTR_NOTPERSIST_FIRST+15) /* 1195 long, def=0 */
+#define SDRATTR_ROTATEANGLE (SDRATTR_NOTPERSIST_FIRST+16) /* 1196 long, def=0 */
+#define SDRATTR_SHEARANGLE (SDRATTR_NOTPERSIST_FIRST+17) /* 1197 long, def=0 */
+#define SDRATTR_MOVEX (SDRATTR_NOTPERSIST_FIRST+18) /* 1198 long, def=0 */
+#define SDRATTR_MOVEY (SDRATTR_NOTPERSIST_FIRST+19) /* 1199 long, def=0 */
+#define SDRATTR_RESIZEXONE (SDRATTR_NOTPERSIST_FIRST+20) /* 1200 long, def=0 */
+#define SDRATTR_RESIZEYONE (SDRATTR_NOTPERSIST_FIRST+21) /* 1201 long, def=0 */
+#define SDRATTR_ROTATEONE (SDRATTR_NOTPERSIST_FIRST+22) /* 1202 long, def=0 */
+#define SDRATTR_HORZSHEARONE (SDRATTR_NOTPERSIST_FIRST+23) /* 1203 long, def=0 */
+#define SDRATTR_VERTSHEARONE (SDRATTR_NOTPERSIST_FIRST+24) /* 1204 long, def=0 */
+#define SDRATTR_RESIZEXALL (SDRATTR_NOTPERSIST_FIRST+25) /* 1205 long, def=0 */
+#define SDRATTR_RESIZEYALL (SDRATTR_NOTPERSIST_FIRST+26) /* 1206 long, def=0 */
+#define SDRATTR_ROTATEALL (SDRATTR_NOTPERSIST_FIRST+27) /* 1207 long, def=0 */
+#define SDRATTR_HORZSHEARALL (SDRATTR_NOTPERSIST_FIRST+28) /* 1208 long, def=0 */
+#define SDRATTR_VERTSHEARALL (SDRATTR_NOTPERSIST_FIRST+29) /* 1209 long, def=0 */
+#define SDRATTR_TRANSFORMREF1X (SDRATTR_NOTPERSIST_FIRST+30) /* 1210 long, def=0 */
+#define SDRATTR_TRANSFORMREF1Y (SDRATTR_NOTPERSIST_FIRST+31) /* 1211 long, def=0 */
+#define SDRATTR_TRANSFORMREF2X (SDRATTR_NOTPERSIST_FIRST+32) /* 1212 long, def=0 */
+#define SDRATTR_TRANSFORMREF2Y (SDRATTR_NOTPERSIST_FIRST+33) /* 1213 long, def=0 */
+#define SDRATTR_TEXTDIRECTION (SDRATTR_NOTPERSIST_FIRST+34) /* 1214 V4+++ long, def=0 */
+#define SDRATTR_OBJVISIBLE (SDRATTR_NOTPERSIST_FIRST+35)
+#define SDRATTR_NOTPERSIST_LAST (SDRATTR_OBJVISIBLE) /* 1228 V4+++*/ /* 1213*/ /* 1085 */ /* 1040 */ /* 1123 */ /* Pool V1: 1065 */
+// kein SetItem hierfuer
+
+#define SDRATTR_GRAF_FIRST (SDRATTR_NOTPERSIST_LAST+1) /* 1229 V4+++*/
+#define SDRATTR_GRAFRED (SDRATTR_GRAF_FIRST+0) /* 1229 V4+++*/
+#define SDRATTR_GRAFGREEN (SDRATTR_GRAF_FIRST+1) /* 1230 V4+++*/
+#define SDRATTR_GRAFBLUE (SDRATTR_GRAF_FIRST+2) /* 1231 V4+++*/
+#define SDRATTR_GRAFLUMINANCE (SDRATTR_GRAF_FIRST+3) /* 1232 V4+++*/
+#define SDRATTR_GRAFCONTRAST (SDRATTR_GRAF_FIRST+4) /* 1233 V4+++*/
+#define SDRATTR_GRAFGAMMA (SDRATTR_GRAF_FIRST+5) /* 1234 V4+++*/
+#define SDRATTR_GRAFTRANSPARENCE (SDRATTR_GRAF_FIRST+6) /* 1235 V4+++*/
+#define SDRATTR_GRAFINVERT (SDRATTR_GRAF_FIRST+7) /* 1236 V4+++*/
+#define SDRATTR_GRAFMODE (SDRATTR_GRAF_FIRST+8) /* 1237 V4+++*/
+#define SDRATTR_GRAFCROP (SDRATTR_GRAF_FIRST+9) /* 1238 V4+++*/
+#define SDRATTR_GRAF_LAST (SDRATTR_GRAFCROP) /* 1242 V4+++*/
+
+#define SDRATTR_3D_FIRST (SDRATTR_GRAF_LAST + 1) /* 1244 V4+++*/
+
+#define SDRATTR_3DOBJ_FIRST (SDRATTR_3D_FIRST) /* 1244 V4+++*/
+#define SDRATTR_3DOBJ_PERCENT_DIAGONAL (SDRATTR_3DOBJ_FIRST + 0) /* 1244 V4+++*/
+#define SDRATTR_3DOBJ_BACKSCALE (SDRATTR_3DOBJ_FIRST + 1) /* 1245 V4+++*/
+#define SDRATTR_3DOBJ_DEPTH (SDRATTR_3DOBJ_FIRST + 2) /* 1246 V4+++*/
+#define SDRATTR_3DOBJ_HORZ_SEGS (SDRATTR_3DOBJ_FIRST + 3) /* 1247 V4+++*/
+#define SDRATTR_3DOBJ_VERT_SEGS (SDRATTR_3DOBJ_FIRST + 4) /* 1248 V4+++*/
+#define SDRATTR_3DOBJ_END_ANGLE (SDRATTR_3DOBJ_FIRST + 5) /* 1249 V4+++*/
+#define SDRATTR_3DOBJ_DOUBLE_SIDED (SDRATTR_3DOBJ_FIRST + 6) /* 1250 V4+++*/
+#define SDRATTR_3DOBJ_NORMALS_KIND (SDRATTR_3DOBJ_FIRST + 7) /* 1251 V4+++*/
+#define SDRATTR_3DOBJ_NORMALS_INVERT (SDRATTR_3DOBJ_FIRST + 8) /* 1252 V4+++*/
+#define SDRATTR_3DOBJ_TEXTURE_PROJ_X (SDRATTR_3DOBJ_FIRST + 9) /* 1253 V4+++*/
+#define SDRATTR_3DOBJ_TEXTURE_PROJ_Y (SDRATTR_3DOBJ_FIRST + 10) /* 1254 V4+++*/
+#define SDRATTR_3DOBJ_SHADOW_3D (SDRATTR_3DOBJ_FIRST + 11) /* 1255 V4+++*/
+#define SDRATTR_3DOBJ_MAT_COLOR (SDRATTR_3DOBJ_FIRST + 12) /* 1256 V4+++*/
+#define SDRATTR_3DOBJ_MAT_EMISSION (SDRATTR_3DOBJ_FIRST + 13) /* 1257 V4+++*/
+#define SDRATTR_3DOBJ_MAT_SPECULAR (SDRATTR_3DOBJ_FIRST + 14) /* 1258 V4+++*/
+#define SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY (SDRATTR_3DOBJ_FIRST + 15) /* 1259 V4+++*/
+#define SDRATTR_3DOBJ_TEXTURE_KIND (SDRATTR_3DOBJ_FIRST + 16) /* 1260 V4+++*/
+#define SDRATTR_3DOBJ_TEXTURE_MODE (SDRATTR_3DOBJ_FIRST + 17) /* 1261 V4+++*/
+#define SDRATTR_3DOBJ_TEXTURE_FILTER (SDRATTR_3DOBJ_FIRST + 18) /* 1262 V4+++*/
+
+// #107245# New items for 3d objects use former range SDRATTR_3DOBJ_RESERVED_01
+// up to SDRATTR_3DOBJ_RESERVED_05
+#define SDRATTR_3DOBJ_SMOOTH_NORMALS (SDRATTR_3DOBJ_FIRST + 19) /* 1263 V4+++*/
+#define SDRATTR_3DOBJ_SMOOTH_LIDS (SDRATTR_3DOBJ_FIRST + 20) /* 1264 V4+++*/
+#define SDRATTR_3DOBJ_CHARACTER_MODE (SDRATTR_3DOBJ_FIRST + 21) /* 1265 V4+++*/
+#define SDRATTR_3DOBJ_CLOSE_FRONT (SDRATTR_3DOBJ_FIRST + 22) /* 1266 V4+++*/
+#define SDRATTR_3DOBJ_CLOSE_BACK (SDRATTR_3DOBJ_FIRST + 23) /* 1267 V4+++*/
+
+// #i28528#
+// Added extra Item (Bool) for chart2 to be able to show reduced line geometry
+#define SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY (SDRATTR_3DOBJ_FIRST + 24) /* 1268 V4+++*/
+
+#define SDRATTR_3DOBJ_LAST (SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY) /* 1282 V4+++*/
+
+#define SDRATTR_3DSCENE_FIRST (SDRATTR_3DOBJ_LAST + 1) /* 1283 V4+++*/
+#define SDRATTR_3DSCENE_PERSPECTIVE (SDRATTR_3DSCENE_FIRST + 0) /* 1283 V4+++*/
+#define SDRATTR_3DSCENE_DISTANCE (SDRATTR_3DSCENE_FIRST + 1) /* 1284 V4+++*/
+#define SDRATTR_3DSCENE_FOCAL_LENGTH (SDRATTR_3DSCENE_FIRST + 2) /* 1285 V4+++*/
+#define SDRATTR_3DSCENE_TWO_SIDED_LIGHTING (SDRATTR_3DSCENE_FIRST + 3) /* 1286 V4+++*/
+#define SDRATTR_3DSCENE_LIGHTCOLOR_1 (SDRATTR_3DSCENE_FIRST + 4) /* 1287 V4+++*/
+#define SDRATTR_3DSCENE_LIGHTCOLOR_2 (SDRATTR_3DSCENE_FIRST + 5) /* 1288 V4+++*/
+#define SDRATTR_3DSCENE_LIGHTCOLOR_3 (SDRATTR_3DSCENE_FIRST + 6) /* 1289 V4+++*/
+#define SDRATTR_3DSCENE_LIGHTCOLOR_4 (SDRATTR_3DSCENE_FIRST + 7) /* 1290 V4+++*/
+#define SDRATTR_3DSCENE_LIGHTCOLOR_5 (SDRATTR_3DSCENE_FIRST + 8) /* 1291 V4+++*/
+#define SDRATTR_3DSCENE_LIGHTCOLOR_6 (SDRATTR_3DSCENE_FIRST + 9) /* 1292 V4+++*/
+#define SDRATTR_3DSCENE_LIGHTCOLOR_7 (SDRATTR_3DSCENE_FIRST + 10) /* 1293 V4+++*/
+#define SDRATTR_3DSCENE_LIGHTCOLOR_8 (SDRATTR_3DSCENE_FIRST + 11) /* 1294 V4+++*/
+#define SDRATTR_3DSCENE_AMBIENTCOLOR (SDRATTR_3DSCENE_FIRST + 12) /* 1295 V4+++*/
+#define SDRATTR_3DSCENE_LIGHTON_1 (SDRATTR_3DSCENE_FIRST + 13) /* 1296 V4+++*/
+#define SDRATTR_3DSCENE_LIGHTON_2 (SDRATTR_3DSCENE_FIRST + 14) /* 1297 V4+++*/
+#define SDRATTR_3DSCENE_LIGHTON_3 (SDRATTR_3DSCENE_FIRST + 15) /* 1298 V4+++*/
+#define SDRATTR_3DSCENE_LIGHTON_4 (SDRATTR_3DSCENE_FIRST + 16) /* 1299 V4+++*/
+#define SDRATTR_3DSCENE_LIGHTON_5 (SDRATTR_3DSCENE_FIRST + 17) /* 1300 V4+++*/
+#define SDRATTR_3DSCENE_LIGHTON_6 (SDRATTR_3DSCENE_FIRST + 18) /* 1301 V4+++*/
+#define SDRATTR_3DSCENE_LIGHTON_7 (SDRATTR_3DSCENE_FIRST + 19) /* 1302 V4+++*/
+#define SDRATTR_3DSCENE_LIGHTON_8 (SDRATTR_3DSCENE_FIRST + 20) /* 1303 V4+++*/
+#define SDRATTR_3DSCENE_LIGHTDIRECTION_1 (SDRATTR_3DSCENE_FIRST + 21) /* 1304 V4+++*/
+#define SDRATTR_3DSCENE_LIGHTDIRECTION_2 (SDRATTR_3DSCENE_FIRST + 22) /* 1305 V4+++*/
+#define SDRATTR_3DSCENE_LIGHTDIRECTION_3 (SDRATTR_3DSCENE_FIRST + 23) /* 1306 V4+++*/
+#define SDRATTR_3DSCENE_LIGHTDIRECTION_4 (SDRATTR_3DSCENE_FIRST + 24) /* 1307 V4+++*/
+#define SDRATTR_3DSCENE_LIGHTDIRECTION_5 (SDRATTR_3DSCENE_FIRST + 25) /* 1308 V4+++*/
+#define SDRATTR_3DSCENE_LIGHTDIRECTION_6 (SDRATTR_3DSCENE_FIRST + 26) /* 1309 V4+++*/
+#define SDRATTR_3DSCENE_LIGHTDIRECTION_7 (SDRATTR_3DSCENE_FIRST + 27) /* 1310 V4+++*/
+#define SDRATTR_3DSCENE_LIGHTDIRECTION_8 (SDRATTR_3DSCENE_FIRST + 28) /* 1311 V4+++*/
+#define SDRATTR_3DSCENE_SHADOW_SLANT (SDRATTR_3DSCENE_FIRST + 29) /* 1312 V4+++*/
+#define SDRATTR_3DSCENE_SHADE_MODE (SDRATTR_3DSCENE_FIRST + 30) /* 1313 V4+++*/
+#define SDRATTR_3DSCENE_LAST (SDRATTR_3DSCENE_SHADE_MODE) /* 1333 V4+++*/
+#define SDRATTR_3D_LAST (SDRATTR_3DSCENE_LAST) /* 1333 V4+++*/
+
+#define SDRATTR_CUSTOMSHAPE_FIRST (SDRATTR_3D_LAST + 1) /* 1334 V4+++*/
+#define SDRATTR_CUSTOMSHAPE_ENGINE (SDRATTR_CUSTOMSHAPE_FIRST + 0) /* 1334 V4+++*/
+#define SDRATTR_CUSTOMSHAPE_DATA (SDRATTR_CUSTOMSHAPE_FIRST + 1) /* 1335 V4+++*/
+#define SDRATTR_CUSTOMSHAPE_GEOMETRY (SDRATTR_CUSTOMSHAPE_FIRST + 2) /* 1336 V4+++*/
+#define SDRATTR_CUSTOMSHAPE_REPLACEMENT_URL (SDRATTR_CUSTOMSHAPE_FIRST + 3) /* 1337 V4+++*/
+#define SDRATTR_CUSTOMSHAPE_LAST (SDRATTR_CUSTOMSHAPE_REPLACEMENT_URL) /* 1357 V4+++*/
+
+#define SDRATTR_TABLE_FIRST (SDRATTR_CUSTOMSHAPE_LAST+1)
+#define SDRATTR_TABLE_BORDER (SDRATTR_TABLE_FIRST+0)
+#define SDRATTR_TABLE_BORDER_INNER (SDRATTR_TABLE_FIRST+1)
+#define SDRATTR_TABLE_BORDER_TLBR (SDRATTR_TABLE_FIRST+2)
+#define SDRATTR_TABLE_BORDER_BLTR (SDRATTR_TABLE_FIRST+3)
+
+#define SDRATTR_TABLE_LAST (SDRATTR_TABLE_BORDER_BLTR)
+
+#define SDRATTR_END SDRATTR_TABLE_LAST /* 1357 */ /* 1333 V4+++*/ /* 1243 V4+++*/ /*1213*/ /*1085*/ /*1040*/ /*Pool V2: 1123,V1: 1065 */
+
+#endif // _SVDDEF_HXX
+
diff --git a/svx/inc/svx/svddrag.hxx b/svx/inc/svx/svddrag.hxx
new file mode 100644
index 000000000000..00355132fab2
--- /dev/null
+++ b/svx/inc/svx/svddrag.hxx
@@ -0,0 +1,192 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDDRAG_HXX
+#define _SVDDRAG_HXX
+
+
+#include <tools/contnr.hxx>
+#include <tools/gen.hxx>
+#include <tools/fract.hxx>
+#include "svx/svxdllapi.h"
+
+// Statushalter fuer objektspeziefisches Draggen. Damit das Model
+// Statusfrei bleibt werden die Statusdaten an der View gehalten
+// und dem Objekt zu gegebener Zeit als Parameter uebergeben.
+// Ausserdem auch Statushalter fuer den Vorgang der Interaktiven
+// Objekterzeugung. pHdl ist in diesem Fall NULL.
+class SdrHdl;
+class SdrView;
+class SdrPageView;
+class SdrDragMethod;
+
+struct SVX_DLLPUBLIC SdrDragStatUserData
+{
+};
+
+class SVX_DLLPUBLIC SdrDragStat {
+protected:
+ SdrHdl* pHdl; // Der Handle an dem der User zottelt
+ SdrView* pView;
+ SdrPageView* pPageView;
+ Container aPnts; // Alle bisherigen Punkte: [0]=Start, [Count()-2]=Prev
+ Point aRef1; // Referenzpunkt: Resize-Fixpunkt, (Drehachse,
+ Point aRef2; // Spiegelachse, ...)
+ Point aPos0; // Position beim letzten Event
+ Point aRealPos0; // Position beim letzten Event
+ Point aRealNow; // Aktuelle Dragposition ohne Snap, Ortho und Limit
+ Point aRealLast; // RealPos des letzten Punkts (fuer MinMoved)
+ Rectangle aActionRect;
+
+ // Reserve fuer kompatible Erweiterungen, die sonst inkompatibel wuerden.
+ Point aReservePoint1;
+ Point aReservePoint2;
+ Point aReservePoint3;
+ Point aReservePoint4;
+ Rectangle aReserveRect1;
+ Rectangle aReserveRect2;
+ FASTBOOL bEndDragChangesAttributes;
+ FASTBOOL bEndDragChangesGeoAndAttributes;
+ FASTBOOL bMouseIsUp;
+ FASTBOOL aReserveBool3;
+ FASTBOOL aReserveBool4;
+ long aReserveLong1;
+ long aReserveLong2;
+ long aReserveLong3;
+ long aReserveLong4;
+ void* aReservePtr1;
+ void* aReservePtr2;
+ void* aReservePtr3;
+ void* aReservePtr4;
+
+ FASTBOOL bShown; // Xor sichrbar?
+ sal_uInt16 nMinMov; // Soviel muss erstmal minimal bewegt werden
+ FASTBOOL bMinMoved; // MinMove durchbrochen?
+
+ FASTBOOL bHorFixed; // nur Vertikal draggen
+ FASTBOOL bVerFixed; // nur Horizontal draggen
+ FASTBOOL bWantNoSnap; // sal_True=Fuer die Entscheidung ob fuer pObj->MovCreate() NoSnapPos verwendet
+ // werden soll. Entsprechend wird auch NoSnapPos in den Buffer geschrieben.
+ FASTBOOL bOrtho4;
+ FASTBOOL bOrtho8;
+
+ SdrDragMethod* pDragMethod;
+
+protected:
+ void Clear(FASTBOOL bLeaveOne);
+ Point& Pnt(sal_uIntPtr nNum) { return *((Point*)aPnts.GetObject(nNum)); }
+//public:
+ SdrDragStatUserData* pUser; // Userdata
+public:
+ SdrDragStat(): aPnts(1024,16,16) { pUser=NULL; Reset(); }
+ ~SdrDragStat() { Clear(sal_False); }
+ void Reset();
+ SdrView* GetView() const { return pView; }
+ void SetView(SdrView* pV) { pView=pV; }
+ SdrPageView* GetPageView() const { return pPageView; }
+ void SetPageView(SdrPageView* pPV) { pPageView=pPV; }
+ const Point& GetPoint(sal_uIntPtr nNum) const { return *((Point*)aPnts.GetObject(nNum)); }
+ sal_uIntPtr GetPointAnz() const { return aPnts.Count(); }
+ const Point& GetStart() const { return GetPoint(0); }
+ Point& Start() { return Pnt(0); }
+ const Point& GetPrev() const { return GetPoint(GetPointAnz()-(GetPointAnz()>=2 ? 2:1)); }
+ Point& Prev() { return Pnt(GetPointAnz()-(GetPointAnz()>=2 ? 2:1)); }
+ const Point& GetPos0() const { return aPos0; }
+ Point& Pos0() { return aPos0; }
+ const Point& GetNow() const { return GetPoint(GetPointAnz()-1); }
+ Point& Now() { return Pnt(GetPointAnz()-1); }
+ const Point& GetRealNow() const { return aRealNow; }
+ Point& RealNow() { return aRealNow; }
+ const Point& GetRef1() const { return aRef1; }
+ Point& Ref1() { return aRef1; }
+ const Point& GetRef2() const { return aRef2; }
+ Point& Ref2() { return aRef2; }
+ const SdrHdl* GetHdl() const { return pHdl; }
+ void SetHdl(SdrHdl* pH) { pHdl=pH; }
+ SdrDragStatUserData* GetUser() const { return pUser; }
+ void SetUser(SdrDragStatUserData* pU) { pUser=pU; }
+ FASTBOOL IsShown() const { return bShown; }
+ void SetShown(FASTBOOL bOn) { bShown=bOn; }
+
+ FASTBOOL IsMinMoved() const { return bMinMoved; }
+ void SetMinMoved() { bMinMoved=sal_True; }
+ void ResetMinMoved() { bMinMoved=sal_False; }
+ void SetMinMove(sal_uInt16 nDist) { nMinMov=nDist; if (nMinMov<1) nMinMov=1; }
+ sal_uInt16 GetMinMove() const { return nMinMov; }
+
+ FASTBOOL IsHorFixed() const { return bHorFixed; }
+ void SetHorFixed(FASTBOOL bOn) { bHorFixed=bOn; }
+ FASTBOOL IsVerFixed() const { return bVerFixed; }
+ void SetVerFixed(FASTBOOL bOn) { bVerFixed=bOn; }
+
+ // Hier kann das Obj sagen: "Ich will keinen Koordinatenfang!"
+ // z.B. fuer den Winkel des Kreisbogen...
+ FASTBOOL IsNoSnap() const { return bWantNoSnap; }
+ void SetNoSnap(FASTBOOL bOn=sal_True) { bWantNoSnap=bOn; }
+
+ // Und hier kann das Obj sagen welches Ortho (wenn ueberhaupt eins)
+ // sinnvoll auf ihm angewendet werden kann.
+ // Ortho4 bedeutet Ortho in 4 Richtungen (fuer Rect und Cirt)
+ FASTBOOL IsOrtho4Possible() const { return bOrtho4; }
+ void SetOrtho4Possible(FASTBOOL bOn=sal_True) { bOrtho4=bOn; }
+ // Ortho8 bedeutet Ortho in 8 Richtungen (fuer Linien)
+ FASTBOOL IsOrtho8Possible() const { return bOrtho8; }
+ void SetOrtho8Possible(FASTBOOL bOn=sal_True) { bOrtho8=bOn; }
+
+ // Wird vom gedraggten Objekt gesetzt
+ FASTBOOL IsEndDragChangesAttributes() const { return bEndDragChangesAttributes; }
+ void SetEndDragChangesAttributes(FASTBOOL bOn) { bEndDragChangesAttributes=bOn; }
+ FASTBOOL IsEndDragChangesGeoAndAttributes() const { return bEndDragChangesGeoAndAttributes; }
+ void SetEndDragChangesGeoAndAttributes(FASTBOOL bOn) { bEndDragChangesGeoAndAttributes=bOn; }
+
+ // Wird von der View gesetzt und kann vom Obj ausgewertet werden
+ FASTBOOL IsMouseDown() const { return !bMouseIsUp; }
+ void SetMouseDown(FASTBOOL bDown) { bMouseIsUp=!bDown; }
+
+ Point KorregPos(const Point& rNow, const Point& rPrev) const;
+ void Reset(const Point& rPnt);
+ void NextMove(const Point& rPnt);
+ void NextPoint(FASTBOOL bSaveReal=sal_False);
+ void PrevPoint();
+ FASTBOOL CheckMinMoved(const Point& rPnt);
+ long GetDX() const { return GetNow().X()-GetPrev().X(); }
+ long GetDY() const { return GetNow().Y()-GetPrev().Y(); }
+ Fraction GetXFact() const;
+ Fraction GetYFact() const;
+
+ SdrDragMethod* GetDragMethod() const { return pDragMethod; }
+ void SetDragMethod(SdrDragMethod* pMth) { pDragMethod=pMth; }
+
+ const Rectangle& GetActionRect() const { return aActionRect; }
+ void SetActionRect(const Rectangle& rR) { aActionRect=rR; }
+
+ // Unter Beruecksichtigung von 1stPointAsCenter
+ void TakeCreateRect(Rectangle& rRect) const;
+};
+
+#endif //_SVDDRAG_HXX
+
diff --git a/svx/inc/svx/svddrgmt.hxx b/svx/inc/svx/svddrgmt.hxx
new file mode 100644
index 000000000000..9a32905bf37c
--- /dev/null
+++ b/svx/inc/svx/svddrgmt.hxx
@@ -0,0 +1,324 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDDRGMT_HXX
+#define _SVDDRGMT_HXX
+
+#include <svx/svddrgv.hxx>
+#include "svx/svxdllapi.h"
+#include <svx/sdr/contact/objectcontact.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@@ @@@@@ @@@@ @@@@ @@ @@ @@@@@ @@@@@@ @@ @@ @@@@ @@@@@ @@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@@@@@@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@@@@ @@@@@@ @@ @@@ @@@@@@@ @@@@ @@ @@@@@@ @@ @@ @@ @@ @@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@@@@ @@ @@ @@ @@ @@@@@ @@ @@ @@@@@ @@ @@ @@ @@@@ @@@@@ @@@@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class SdrDragView;
+class SdrDragStat;
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SdrDragEntry
+{
+private:
+ // bitfield
+ unsigned mbAddToTransparent : 1;
+
+protected:
+ // access for derived classes
+ void setAddToTransparent(bool bNew) { mbAddToTransparent = bNew; }
+
+public:
+ SdrDragEntry();
+ virtual ~SdrDragEntry();
+
+ virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod) = 0;
+
+ // data read access
+ bool getAddToTransparent() const { return mbAddToTransparent; }
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SVX_DLLPUBLIC SdrDragEntryPolyPolygon : public SdrDragEntry
+{
+private:
+ basegfx::B2DPolyPolygon maOriginalPolyPolygon;
+
+public:
+ SdrDragEntryPolyPolygon(const basegfx::B2DPolyPolygon& rOriginalPolyPolygon);
+ virtual ~SdrDragEntryPolyPolygon();
+
+ virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod);
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SdrDragEntrySdrObject : public SdrDragEntry
+{
+private:
+ const SdrObject& maOriginal;
+ SdrObject* mpClone;
+ sdr::contact::ObjectContact& mrObjectContact;
+ bool mbModify;
+
+public:
+ SdrDragEntrySdrObject(const SdrObject& rOriginal, sdr::contact::ObjectContact& rObjectContact, bool bModify);
+ virtual ~SdrDragEntrySdrObject();
+
+ virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod);
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SdrDragEntryPrimitive2DSequence : public SdrDragEntry
+{
+private:
+ drawinglayer::primitive2d::Primitive2DSequence maPrimitive2DSequence;
+
+public:
+ SdrDragEntryPrimitive2DSequence(
+ const drawinglayer::primitive2d::Primitive2DSequence& rSequence,
+ bool bAddToTransparent);
+ virtual ~SdrDragEntryPrimitive2DSequence();
+
+ virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod);
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SdrDragEntryPointGlueDrag : public SdrDragEntry
+{
+private:
+ std::vector< basegfx::B2DPoint > maPositions;
+ bool mbIsPointDrag;
+
+public:
+ SdrDragEntryPointGlueDrag(const std::vector< basegfx::B2DPoint >& rPositions, bool bIsPointDrag);
+ virtual ~SdrDragEntryPointGlueDrag();
+
+ virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod);
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+class SVX_DLLPUBLIC SdrDragMethod
+{
+private:
+ std::vector< SdrDragEntry* > maSdrDragEntries;
+ sdr::overlay::OverlayObjectList maOverlayObjectList;
+ SdrDragView& mrSdrDragView;
+
+ // bitfield
+ unsigned mbMoveOnly : 1;
+ unsigned mbSolidDraggingActive : 1;
+
+protected:
+ // access for derivated classes to maSdrDragEntries
+ void clearSdrDragEntries() { for(sal_uInt32 a(0); a < maSdrDragEntries.size(); a++) { delete maSdrDragEntries[a]; } maSdrDragEntries.clear(); }
+ void addSdrDragEntry(SdrDragEntry* pNew) { if(pNew) { maSdrDragEntries.push_back(pNew); }}
+ virtual void createSdrDragEntries();
+ virtual void createSdrDragEntryForSdrObject(const SdrObject& rOriginal, sdr::contact::ObjectContact& rObjectContact, bool bModify);
+
+ // access for derivated classes to maOverlayObjectList
+ void clearOverlayObjectList() { maOverlayObjectList.clear(); }
+ void addToOverlayObjectList(sdr::overlay::OverlayObject& rNew) { maOverlayObjectList.append(rNew); }
+ basegfx::B2DRange getB2DRangeFromOverlayObjectList() const { return maOverlayObjectList.getBaseRange(); }
+
+ // access for derivated classes to mrSdrDragView
+ SdrDragView& getSdrDragView() { return mrSdrDragView; }
+ const SdrDragView& getSdrDragView() const { return mrSdrDragView; }
+
+ // access for derivated classes for bools
+ void setMoveOnly(bool bNew) { mbMoveOnly = bNew; }
+ void setSolidDraggingActive(bool bNew) { mbSolidDraggingActive = bNew; }
+
+ // internal helpers for creation of standard drag entries
+ void createSdrDragEntries_SolidDrag();
+ void createSdrDragEntries_PolygonDrag();
+ void createSdrDragEntries_PointDrag();
+ void createSdrDragEntries_GlueDrag();
+
+ // old call forwarders to the SdrDragView
+ void ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, String& rStr, sal_uInt16 nVal=0) const;
+ SdrHdl* GetDragHdl() const { return getSdrDragView().pDragHdl; }
+ SdrHdlKind GetDragHdlKind() const { return getSdrDragView().eDragHdl; }
+ SdrDragStat& DragStat() { return getSdrDragView().aDragStat; }
+ const SdrDragStat& DragStat() const { return getSdrDragView().aDragStat; }
+ Point& Ref1() const { return mrSdrDragView.aRef1; }
+ Point& Ref2() const { return mrSdrDragView.aRef2; }
+ const SdrHdlList& GetHdlList() const { return getSdrDragView().aHdl; }
+ void AddUndo(SdrUndoAction* pUndo) { getSdrDragView().AddUndo(pUndo); }
+ bool IsDragLimit() { return getSdrDragView().bDragLimit; }
+ const Rectangle& GetDragLimitRect() { return getSdrDragView().aDragLimit; }
+ const SdrMarkList& GetMarkedObjectList() { return getSdrDragView().GetMarkedObjectList(); }
+ Point GetSnapPos(const Point& rPt) const { return getSdrDragView().GetSnapPos(rPt,getSdrDragView().pMarkedPV); }
+ sal_uInt16 SnapPos(Point& rPt) const { return getSdrDragView().SnapPos(rPt,getSdrDragView().pMarkedPV); }
+ inline const Rectangle& GetMarkedRect() const;
+ SdrPageView* GetDragPV() const;
+ SdrObject* GetDragObj() const;
+ OutputDevice* GetDragWin() const { return getSdrDragView().pDragWin; }
+ bool IsDraggingPoints() const { return getSdrDragView().IsDraggingPoints(); }
+ bool IsDraggingGluePoints() const { return getSdrDragView().IsDraggingGluePoints(); }
+
+ bool DoAddConnectorOverlays();
+ drawinglayer::primitive2d::Primitive2DSequence AddConnectorOverlays();
+
+public:
+ TYPEINFO();
+
+ void resetSdrDragEntries();
+ basegfx::B2DRange getCurrentRange() const;
+
+ // #i58950# also moved constructor implementation to cxx
+ SdrDragMethod(SdrDragView& rNewView);
+
+ // #i58950# virtual destructor was missing
+ virtual ~SdrDragMethod();
+
+ void Show();
+ void Hide();
+ virtual void TakeSdrDragComment(String& rStr) const=0;
+ virtual bool BeginSdrDrag()=0;
+ virtual void MoveSdrDrag(const Point& rPnt)=0;
+ virtual bool EndSdrDrag(bool bCopy)=0;
+ virtual void CancelSdrDrag();
+ virtual Pointer GetSdrDragPointer() const=0;
+
+ virtual void CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlayManager);
+ void destroyOverlayGeometry();
+
+ virtual basegfx::B2DHomMatrix getCurrentTransformation();
+ virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget);
+ virtual void applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget);
+
+ // data read access
+ bool getMoveOnly() const { return mbMoveOnly; }
+ bool getSolidDraggingActive() const { return mbSolidDraggingActive; }
+};
+
+inline const Rectangle& SdrDragMethod::GetMarkedRect() const
+{
+ return getSdrDragView().eDragHdl==HDL_POLY ? getSdrDragView().GetMarkedPointsRect() :
+ getSdrDragView().eDragHdl==HDL_GLUE ? getSdrDragView().GetMarkedGluePointsRect() :
+ getSdrDragView().GetMarkedObjRect();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// SdrDragMove
+
+class SVX_DLLPUBLIC SdrDragMove : public SdrDragMethod
+{
+private:
+ long nBestXSnap;
+ long nBestYSnap;
+ bool bXSnapped;
+ bool bYSnapped;
+
+ void ImpCheckSnap(const Point& rPt);
+
+protected:
+ virtual void createSdrDragEntryForSdrObject(const SdrObject& rOriginal, sdr::contact::ObjectContact& rObjectContact, bool bModify);
+
+public:
+ TYPEINFO();
+ SdrDragMove(SdrDragView& rNewView);
+
+ virtual void TakeSdrDragComment(String& rStr) const;
+ virtual bool BeginSdrDrag();
+ virtual void MoveSdrDrag(const Point& rPnt);
+ virtual bool EndSdrDrag(bool bCopy);
+ virtual Pointer GetSdrDragPointer() const;
+
+ virtual basegfx::B2DHomMatrix getCurrentTransformation();
+ virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget);
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// SdrDragResize
+
+class SVX_DLLPUBLIC SdrDragResize : public SdrDragMethod
+{
+protected:
+ Fraction aXFact;
+ Fraction aYFact;
+
+public:
+ TYPEINFO();
+ SdrDragResize(SdrDragView& rNewView);
+
+ virtual void TakeSdrDragComment(String& rStr) const;
+ virtual bool BeginSdrDrag();
+ virtual void MoveSdrDrag(const Point& rPnt);
+ virtual bool EndSdrDrag(bool bCopy);
+ virtual Pointer GetSdrDragPointer() const;
+
+ virtual basegfx::B2DHomMatrix getCurrentTransformation();
+ virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget);
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// SdrDragObjOwn
+
+class SVX_DLLPUBLIC SdrDragObjOwn : public SdrDragMethod
+{
+private:
+ // SdrDragObjOwn always works on a clone since it has no transformation
+ // mechanism to modify wireframe visualisations, but uses the
+ // SdrObject::applySpecialDrag() method to change a clone of the
+ // SdrObject
+ SdrObject* mpClone;
+
+protected:
+ virtual void createSdrDragEntries();
+
+public:
+ TYPEINFO();
+ SdrDragObjOwn(SdrDragView& rNewView);
+ virtual ~SdrDragObjOwn();
+
+ virtual void TakeSdrDragComment(String& rStr) const;
+ virtual bool BeginSdrDrag();
+ virtual void MoveSdrDrag(const Point& rPnt);
+ virtual bool EndSdrDrag(bool bCopy);
+ virtual Pointer GetSdrDragPointer() const;
+};
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#endif //_SVDDRGMT_HXX
+
+// eof
diff --git a/svx/inc/svx/svddrgv.hxx b/svx/inc/svx/svddrgv.hxx
new file mode 100644
index 000000000000..66b2c8643717
--- /dev/null
+++ b/svx/inc/svx/svddrgv.hxx
@@ -0,0 +1,321 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDDRGV_HXX
+#define _SVDDRGV_HXX
+
+#include "svx/svxdllapi.h"
+#include <svx/svdxcgv.hxx>
+
+//************************************************************
+// Vorausdeklarationen
+//************************************************************
+
+class SdrUndoGeoObj;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@@ @@@@@ @@@@ @@@@ @@ @@ @@ @@@@@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@
+// @@ @@ @@@@@ @@@@@@ @@ @@@ @@@@@ @@ @@@@ @@@@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@
+// @@@@@ @@ @@ @@ @@ @@@@@ @ @@ @@@@@ @@ @@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class ImpSdrDragViewExtraData;
+
+class SVX_DLLPUBLIC SdrDragView: public SdrExchangeView
+{
+ friend class SdrPageView;
+ friend class SdrDragMethod;
+
+protected:
+ SdrHdl* pDragHdl;
+ SdrDragMethod* mpCurrentSdrDragMethod;
+ SdrUndoGeoObj* pInsPointUndo;
+ Rectangle aDragLimit;
+ XubString aInsPointUndoStr;
+ SdrMarkList aFollowingEdges; // Wenn Knoten gedraggd werden, sollen alle Kanten als Xor folgen
+ SdrHdlKind eDragHdl;
+
+ sal_uIntPtr nDragXorPolyLimit;
+ sal_uIntPtr nDragXorPointLimit;
+ sal_uInt16 nRubberEdgeDraggingLimit;
+ sal_uInt16 nDetailedEdgeDraggingLimit;
+
+ unsigned bFramDrag : 1; // z.Zt. FrameDrag
+ unsigned bDragSpecial : 1; // z.Zt. Special Obj-Dragging
+ unsigned bMarkedHitMovesAlways : 1; // Persistent
+ unsigned bDragLimit : 1; // Limit auf SnapRect statt BoundRect
+ unsigned bDragHdl : 1; // TRUE: RefPt wird verschoben
+ unsigned bDragStripes : 1; // Persistent
+ unsigned bMirrRefDragObj : 1; // Persistent - Waehrend des Draggens der Spiegelachse die gespiegelten Objekte als Xor zeigen
+ unsigned mbSolidDragging : 1; // allow solid create/drag of objects
+ unsigned bMouseHideWhileDraggingPoints : 1;
+ unsigned bResizeAtCenter : 1;
+ unsigned bCrookAtCenter : 1;
+ unsigned bDragWithCopy : 1;
+ unsigned bInsGluePoint : 1;
+ unsigned bInsObjPointMode : 1;
+ unsigned bInsGluePointMode : 1;
+ unsigned bNoDragXorPolys : 1;
+ unsigned bAutoVertexCon : 1; // Automatische Konnektorgenerierung an den Scheitelpunkten
+ unsigned bAutoCornerCon : 1; // Automatische Konnektorgenerierung an den Eckpunkten
+ unsigned bRubberEdgeDragging : 1;
+ unsigned bDetailedEdgeDragging : 1;
+
+private:
+ SVX_DLLPRIVATE void ImpClearVars();
+ SVX_DLLPRIVATE void ImpMakeDragAttr();
+ SVX_DLLPRIVATE void ImpDelDragAttr();
+
+protected:
+ virtual void SetMarkHandles();
+ void ShowDragObj();
+ void HideDragObj();
+ sal_Bool ImpBegInsObjPoint(sal_Bool bIdxZwang, sal_uInt32 nIdx, const Point& rPnt, sal_Bool bNewObj, OutputDevice* pOut);
+
+protected:
+ // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
+ SdrDragView(SdrModel* pModel1, OutputDevice* pOut = 0L);
+ virtual ~SdrDragView();
+
+public:
+ virtual sal_Bool IsAction() const;
+ virtual void MovAction(const Point& rPnt);
+ virtual void EndAction();
+ virtual void BckAction();
+ virtual void BrkAction();
+ virtual void TakeActionRect(Rectangle& rRect) const;
+
+ // Spezialimplementation fuer den Writer:
+ // TakeDragObjAnchorPos() liefert die Position an der ein Objekt
+ // beim Draggen einer Einfachselektion ungefaehr landet wenn es
+ // "losgelassen" wird (EndDrag).
+ // In der Regel ist das die linke obere Ecke des zu erwartenden neuen
+ // SnapRects. Ausnahme: CaptionObj. Dort ist es die Position des
+ // "Schwanzendes".
+ // Bei Returncode sal_False konnte ich die Position nicht bestimmen
+ // (z.B. Punktverschiebung, Mehrfachselektion, Schieben der
+ // Spiegelschse, ...)
+ sal_Bool TakeDragObjAnchorPos(Point& rPos, sal_Bool bTopRight = sal_False ) const;
+
+ // Wird pForcedMeth uebergeben, so wird pHdl, ... nicht ausgewerten, sondern diese
+ // Drag-Methode verwendet. Die Instanz geht dabei ins Eigentum der View ueber und
+ // wird zum Ende des Draggings destruiert.
+ virtual sal_Bool BegDragObj(const Point& rPnt, OutputDevice* pOut=NULL, SdrHdl* pHdl=NULL, short nMinMov=-3, SdrDragMethod* pForcedMeth=NULL);
+ void MovDragObj(const Point& rPnt);
+ sal_Bool EndDragObj(sal_Bool bCopy=sal_False);
+ void BrkDragObj();
+ sal_Bool IsDragObj() const { return mpCurrentSdrDragMethod && !bInsPolyPoint && !bInsGluePoint; }
+ SdrHdl* GetDragHdl() const { return pDragHdl; }
+ SdrDragMethod* GetDragMethod() const { return mpCurrentSdrDragMethod; }
+ sal_Bool IsDraggingPoints() const { return eDragHdl==HDL_POLY; }
+ sal_Bool IsDraggingGluePoints() const { return eDragHdl==HDL_GLUE; }
+
+ // Wer das beim BegDrag oder mittendrin schon festlegen will.
+ // (Wird bei jedem BegDrag auf sal_False zurueckgesetzt, also nach
+ // BegDrag setzen.)
+ void SetDragWithCopy(sal_Bool bOn) { bDragWithCopy = bOn; }
+ sal_Bool IsDragWithCopy() const { return bDragWithCopy; }
+
+ void SetInsertGluePoint(sal_Bool bOn) { bInsGluePoint = bOn; }
+ sal_Bool IsInsertGluePoint() const { return bInsGluePoint; }
+
+ // Interaktives einfuegen eines neuen Punktes. nIdx=0 => vor dem ersten Punkt.
+ sal_Bool IsInsObjPointPossible() const;
+ sal_Bool IsInsPointPossible() const { return IsInsObjPointPossible(); }
+ sal_Bool BegInsObjPoint(const Point& rPnt, sal_Bool bNewObj) { return ImpBegInsObjPoint(sal_False, 0L, rPnt, bNewObj, 0L); }
+ void MovInsObjPoint(const Point& rPnt) { MovDragObj(rPnt); }
+ sal_Bool EndInsObjPoint(SdrCreateCmd eCmd);
+ void BrkInsObjPoint() { BrkDragObj(); }
+ sal_Bool IsInsObjPoint() const { return mpCurrentSdrDragMethod && bInsPolyPoint; }
+
+ // Fuer die App zum Verwalten des Status. GetPreferedPointer() wird
+ // spaeter vielleicht einen passenden Pointer dafuer liefern
+ void SetInsObjPointMode(sal_Bool bOn) { bInsObjPointMode = bOn; }
+ sal_Bool IsInsObjPointMode() const { return bInsObjPointMode; }
+
+ sal_Bool IsInsGluePointPossible() const;
+ sal_Bool BegInsGluePoint(const Point& rPnt);
+ void MovInsGluePoint(const Point& rPnt) { MovDragObj(rPnt); }
+ sal_Bool EndInsGluePoint() { return EndDragObj(); }
+ void BrkInsGluePoint() { BrkDragObj(); }
+ sal_Bool IsInsGluePoint() const { return mpCurrentSdrDragMethod && bInsGluePoint; }
+
+ // Fuer die App zum Verwalten des Status. GetPreferedPointer() wird
+ // spaeter vielleicht einen passenden Pointer dafuer liefern
+ void SetInsGluePointMode(sal_Bool bOn) { bInsGluePointMode = bOn; }
+ sal_Bool IsInsGluePointMode() const { return bInsGluePointMode; }
+
+ // Begrenzungslinien ueber's gesamte Win waehrend des Draggens
+ // Persistent. Default=FALSE.
+ void SetDragStripes(sal_Bool bOn);
+ sal_Bool IsDragStripes() const { return bDragStripes; }
+
+ // Handles waehrend des Draggens verstecken
+ //HMHvoid SetDragHdlHide(sal_Bool bOn);
+ //HMHBOOL IsDragHdlHide() const { return bNoDragHdl; }
+
+ // Beim Draggen von Polygonpunkten und Klebepunkten
+ // die Maus verstecken. Default=FALSE
+ void SetMouseHideWhileDraggingPoints(sal_Bool bOn) { bMouseHideWhileDraggingPoints = bOn; }
+ sal_Bool IsMouseHideWhileDraggingPoints() const { return bMouseHideWhileDraggingPoints; }
+
+ // Beim Draggen werden i.d.R. die Konturen der markierten Objekte
+ // als Xor-Polygone dargestellt. Wird dieses Flag hier gesetzt,
+ // wird (z.B. bei Mehrfachselektion) nur ein Xor-Frame gezeichnet.
+ // Bei objektspeziefischem Dragging (Polygonpunkte,Eckenradius,...
+ // hat diese Einstellung keine Auswirkung.
+ // Auch waerend des Draggens umschaltbar.
+ // Default=Off
+ void SetNoDragXorPolys(sal_Bool bOn);
+ sal_Bool IsNoDragXorPolys() const { return bNoDragXorPolys; }
+
+ // Uebersteigt die Anzahl der markierten Objekte den hier eingestellten
+ // Wert, wird implizit (temporaer) auf NoDragPolys geschaltet.
+ // PolyPolygone etc werden entsprechend als mehrere Objekte gewertet.
+ // Default=100
+ void SetDragXorPolyLimit(sal_uIntPtr nObjAnz) { nDragXorPolyLimit=nObjAnz; }
+ sal_uIntPtr GetDragXorPolyLimit() const { return nDragXorPolyLimit; }
+
+ // Wie DragXorPolyLimit, jedoch bezogen auf die Gesamtpunktanzahl
+ // aller Polygone. Default=500.
+ // Auf NoDragPolys wird (temporaer) geschaltet, wenn eins der Limits
+ // ueberstiegen wird.
+ void SetDragXorPointLimit(sal_uIntPtr nPntAnz) { nDragXorPointLimit=nPntAnz; }
+ sal_uIntPtr GetDragXorPointLimit() const { return nDragXorPointLimit; }
+
+ void SetSolidDragging(bool bOn);
+ bool IsSolidDragging() const;
+
+ // Dragging/Creating von Verbindern:
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ // Verbinder an Objektscheitelpunkte ankleben
+ // Default=sal_True=Ja
+ void SetAutoVertexConnectors(sal_Bool bOn) { bAutoVertexCon = bOn; }
+ sal_Bool IsAutoVertexConnectors() const { return bAutoVertexCon; }
+
+ // Verbinder an Objektecken ankleben
+ // Default=sal_False=Nein
+ void SetAutoCornerConnectors(sal_Bool bOn) { bAutoCornerCon = bOn; }
+ sal_Bool IsAutoCornerConnectors() const { return bAutoCornerCon; }
+
+ // Dragging von verbundenen Objekten (Nodes):
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ // DetailedEdgeDraggingLimit: Wie RubberEdgeDraggingLimit, jedoch bezieht
+ // sich dieses Limit auf die detalierte Darstellung, d.h. nicht nur
+ // Gummibaender sondern komplette Neuberechnunen sind beim Draggen sichtbar.
+ // Diese detalierte Darstellung ist eh nur beim MoveDrag moeglich.
+ // Defaultwert ist 10
+ void SetDetailedEdgeDragging(sal_Bool bOn); // Default an
+ sal_Bool IsDetailedEdgeDragging() const { return bDetailedEdgeDragging; }
+
+ void SetDetailedEdgeDraggingLimit(sal_uInt16 nEdgeObjAnz);
+ sal_uInt16 GetDetailedEdgeDraggingLimit() const { return nDetailedEdgeDraggingLimit; }
+
+ // EdgeDraggingLimit: Sind mehr als nEdgeObjAnz Kanten betroffen, werden
+ // diese beim interaktiven Draggen nicht mit angezeigt.
+ // Gemeint sind hier die "Gummibaender", die weniger Rechenzeit benoetigen
+ // als die kompletten Neuberechnungen beim DetailedEdgeDragging.
+ // Defaultwert ist 100
+ void SetRubberEdgeDragging(sal_Bool bOn); // Default an
+ sal_Bool IsRubberEdgeDragging() const { return bRubberEdgeDragging; }
+
+ void SetRubberEdgeDraggingLimit(sal_uInt16 nEdgeObjAnz);
+ sal_uInt16 GetRubberEdgeDraggingLimit() const { return nRubberEdgeDraggingLimit; }
+
+ // Verbinderhandling also zu deutsch wie folgt (bei Defaulteinstellungen):
+ // - Sind bis max 10 Verbinder betroffen werden diese bei jedem
+ // MouseMove neu berechnet
+ // - Sind zwischen 11 und 100 Verbinder betroffen werden die
+ // Verbindungen beim Draggen als gerade Linien dargestellt.
+ // - Bei mehr als 100 betroffenen Verbindern wird beim Draggen nichts
+ // mehr gezeichnet was auf Verbinder hinweist.
+
+ // Ist ein spezieller Dragmode eingeschaltet, wie Rotate, Mirror oder Crook,
+ // dann leitet ein Hit auf das markierte Objekt genau dieses Dragging ein.
+ // Setzt man MarkedHitMovesAlways auf sal_True, so leitet ein Hit auf das
+ // markierte Objekt immer ein Moven ein, unabhaengig vom gesetzten DragMode.
+ // Dieses Flag ist persistent und sollte von der App fuer den Anwender
+ // konfigurierbar sein!
+ void SetMarkedHitMovesAlways(sal_Bool bOn) { bMarkedHitMovesAlways = bOn; }
+ sal_Bool IsMarkedHitMovesAlways() const { return bMarkedHitMovesAlways; }
+
+ // Beim Draggen der Spiegelachse das Spiegelbild der markierten Objekte
+ // als Xor darstellen? Persistent. Noch nicht implementiert. Default TRUE.
+ void SetMirrRefDragObj(sal_Bool bOn) { bMirrRefDragObj = bOn; }
+ sal_Bool IsMirrRefDragObj() const { return bMirrRefDragObj; }
+
+ sal_Bool IsOrthoDesired() const;
+
+ // Beim Resize die Mitte als Referenz
+ // Default=FALSE.
+ sal_Bool IsResizeAtCenter() const { return bResizeAtCenter; }
+ void SetResizeAtCenter(sal_Bool bOn) { bResizeAtCenter = bOn; }
+
+ // Symmetrisches Crook
+ // Default=FALSE.
+ sal_Bool IsCrookAtCenter() const { return bCrookAtCenter; }
+ void SetCrookAtCenter(sal_Bool bOn) { bCrookAtCenter = bOn; }
+
+ // Begrenzung des Arbeitsbereichs. Die Begrenzung bezieht sich auf die
+ // View, nicht auf die einzelnen PageViews. Von der View wird diese
+ // Begrenzung nur bei Interaktionen wie Dragging und Create ausgewertet.
+ // Bei von der App algorithmisch oder UI-gesteuerte Aktionen (SetGeoAttr,
+ // MoveMarkedObj, ...) muss die App dieses Limit selbst beruecksichtigen.
+ // Ferner ist dieses Limit als Grob-Limit zu sehen. U.U. koennen Objekte
+ // (z.B. beim Drehen) nicht exakt bis an dieses Limit herangedraggt werden,
+ // koennen Objekte durch Rundungsfehler doch etwas ueberstehen, ... .
+ // Default=EmptyRect=keine Begrenzung.
+ // erst z.T. impl.
+ // (besser in die DragView?)
+ void SetWorkArea(const Rectangle& rRect) { aMaxWorkArea=rRect; }
+ const Rectangle& GetWorkArea() const { return aMaxWorkArea; }
+
+
+ // Das DragLimit ist bezogen auf die Page des Objekts.
+ // (Oder auf die View??? Muss ich mal^^^^recherchieren. Joe.)
+ // sal_False=Kein Limit.
+ // Das Rueckgabe-Rect muss absolute Koordinaten enthalten. Der Maximale
+ // Dragbereich wird von der View dann so gewaehlt, dass das SnapRect des
+ // Objekts bis Maximal auf die Kante des LimitRects gemoved bzw. gesized
+ // wird. Bei Objekten wie Bezierkurven, gedrehten Rechtecken ist zu beachten
+ // das durch anschliessende Neuberechnung des SnapRects (bei Resize)
+ // Rundungsfehler auftreten koennen, wodurch das LimitRect minnimal
+ // ueberschritten werden koennte...
+ // Implementiert fuer Move und Resize.
+ virtual sal_Bool TakeDragLimit(SdrDragMode eMode, Rectangle& rRect) const;
+};
+
+#endif //_SVDDRGV_HXX
+
diff --git a/svx/inc/svx/svdedtv.hxx b/svx/inc/svx/svdedtv.hxx
new file mode 100644
index 000000000000..a9ad00e3c6d7
--- /dev/null
+++ b/svx/inc/svx/svdedtv.hxx
@@ -0,0 +1,461 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDEDTV_HXX
+#define _SVDEDTV_HXX
+
+#include <svx/svdmrkv.hxx>
+#include <svx/xpoly.hxx>
+#include <svx/svdmodel.hxx>
+#include "svx/svxdllapi.h"
+
+//************************************************************
+// Vorausdeklarationen
+//************************************************************
+
+class SfxUndoAction;
+class SdrUndoAction;
+class SdrUndoGroup;
+class SfxStyleSheet;
+class SdrLayer;
+class SvdProgressInfo;
+
+//************************************************************
+// Defines
+//************************************************************
+
+enum SdrHorAlign {
+ SDRHALIGN_NONE,
+ SDRHALIGN_LEFT,
+ SDRHALIGN_RIGHT,
+ SDRHALIGN_CENTER
+};
+
+enum SdrVertAlign {
+ SDRVALIGN_NONE,
+ SDRVALIGN_TOP,
+ SDRVALIGN_BOTTOM,
+ SDRVALIGN_CENTER
+};
+
+enum SdrMergeMode {
+ SDR_MERGE_MERGE,
+ SDR_MERGE_SUBSTRACT,
+ SDR_MERGE_INTERSECT
+};
+
+// Optionen fuer InsertObject()
+#define SDRINSERT_DONTMARK 0x0001 /* Obj wird nicht markiert (aktuelle Markierung bleibt bestehen) */
+#define SDRINSERT_ADDMARK 0x0002 /* Das Obj wird zu einer ggf. bereits bestehenden Selektion hinzumarkiert */
+#define SDRINSERT_SETDEFATTR 0x0004 /* Die aktuellen Attribute (+StyleSheet) werden dem Obj zugewiesen */
+#define SDRINSERT_SETDEFLAYER 0x0008 /* Der aktuelle Layer wird dem Obj zugewiesen */
+#define SDRINSERT_NOBROADCAST 0x0010 /* Einfuegen mit NbcInsertObject() fuer SolidDragging */
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@@ @@@@@ @@ @@@@@@ @@ @@ @@ @@@@@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@
+// @@@@ @@ @@ @@ @@ @@@@@ @@ @@@@ @@@@@@@
+// @@ @@ @@ @@ @@ @@@ @@ @@ @@@@@@@
+// @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@
+// @@@@@ @@@@@ @@ @@ @ @@ @@@@@ @@ @@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class SVX_DLLPUBLIC SdrEditView: public SdrMarkView
+{
+ friend class SdrPageView;
+ friend class SdrDragDistort;
+ friend class SdrDragCrook;
+
+protected:
+
+ // Die Transformationsnachfragen, etc. etwas cachen
+ unsigned bPossibilitiesDirty : 1;
+ unsigned bReadOnly : 1;
+ unsigned bGroupPossible : 1;
+ unsigned bUnGroupPossible : 1;
+ unsigned bGrpEnterPossible : 1;
+ unsigned bDeletePossible : 1;
+ unsigned bToTopPossible : 1;
+ unsigned bToBtmPossible : 1;
+ unsigned bReverseOrderPossible : 1;
+ unsigned bImportMtfPossible : 1;
+ unsigned bCombinePossible : 1;
+ unsigned bDismantlePossible : 1;
+ unsigned bCombineNoPolyPolyPossible : 1;
+ unsigned bDismantleMakeLinesPossible : 1;
+ unsigned bOrthoDesiredOnMarked : 1;
+ unsigned bMoreThanOneNotMovable : 1; // Es ist mehr als ein Objekt nicht verschiebbar
+ unsigned bOneOrMoreMovable : 1; // Wenigstens 1 Obj verschiebbar
+ unsigned bMoreThanOneNoMovRot : 1; // Es ist mehr als ein Objekt nicht verschieb- und drehbar (Crook)
+ unsigned bContortionPossible : 1; // Alles Polygone (ggf. gruppiert)
+ unsigned bAllPolys : 1; // Alles Polygone (nicht gruppiert)
+ unsigned bOneOrMorePolys : 1; // Mindestens 1 Polygon (nicht gruppiert)
+ unsigned bMoveAllowed : 1;
+ unsigned bResizeFreeAllowed : 1;
+ unsigned bResizePropAllowed : 1;
+ unsigned bRotateFreeAllowed : 1;
+ unsigned bRotate90Allowed : 1;
+ unsigned bMirrorFreeAllowed : 1;
+ unsigned bMirror45Allowed : 1;
+ unsigned bMirror90Allowed : 1;
+ unsigned bShearAllowed : 1;
+ unsigned bEdgeRadiusAllowed : 1;
+ unsigned bTransparenceAllowed : 1;
+ unsigned bGradientAllowed : 1;
+ unsigned bCanConvToPath : 1;
+ unsigned bCanConvToPoly : 1;
+ unsigned bCanConvToContour : 1;
+ unsigned bCanConvToPathLineToArea : 1;
+ unsigned bCanConvToPolyLineToArea : 1;
+ unsigned bMoveProtect : 1;
+ unsigned bResizeProtect : 1;
+ // Z-Order von virtuellen Objekten zusammenhalten (Writer)
+ unsigned bBundleVirtObj : 1;
+
+private:
+ SVX_DLLPRIVATE void ImpClearVars();
+ SVX_DLLPRIVATE void ImpResetPossibilityFlags();
+
+protected:
+ void ImpBroadcastEdgesOfMarkedNodes();
+
+ // Konvertierung der markierten Objekte in Poly bzw. Bezier.
+ void ImpConvertTo(sal_Bool bPath, sal_Bool bLineToArea);
+
+ // Konvertiert ein Obj, wirft bei Erfolg das alte as seiner Liste und
+ // fuegt das neue an dessen Position ein. Inkl Undo. Es wird weder ein
+ // MarkEntry noch ein ModelChgBroadcast generiert.
+ SdrObject* ImpConvertOneObj(SdrObject* pObj, sal_Bool bPath, sal_Bool bLineToArea);
+
+ // Setzen der beiden Flags bToTopPossible und bToBtmPossible.
+ // bToTopPossibleDirty und bToBtmPossibleDirty werden dabei gleichzeitig
+ // zurueckgesetzt.
+ void ImpCheckToTopBtmPossible();
+
+ // fuer den Writer werden virtuelle Objekte buendig zusammengehalten (Z-Order)
+ void ImpBundleVirtObjOfMarkList();
+
+ // fuer CombineMarkedObjects und DismantleMarkedObjects
+ void ImpCopyAttributes(const SdrObject* pSource, SdrObject* pDest) const;
+
+ // fuer CombineMarkedObjects
+ sal_Bool ImpCanConvertForCombine1(const SdrObject* pObj) const;
+ sal_Bool ImpCanConvertForCombine(const SdrObject* pObj) const;
+ basegfx::B2DPolyPolygon ImpGetPolyPolygon1(const SdrObject* pObj, sal_Bool bCombine) const;
+ basegfx::B2DPolyPolygon ImpGetPolyPolygon(const SdrObject* pObj, sal_Bool bCombine) const;
+ basegfx::B2DPolygon ImpCombineToSinglePolygon(const basegfx::B2DPolyPolygon& rPolyPolygon) const;
+
+ // fuer DismantleMarkedObjects
+ sal_Bool ImpCanDismantle(const basegfx::B2DPolyPolygon& rPpolyPpolygon, sal_Bool bMakeLines) const;
+ sal_Bool ImpCanDismantle(const SdrObject* pObj, sal_Bool bMakeLines) const;
+ void ImpDismantleOneObject(const SdrObject* pObj, SdrObjList& rOL, sal_uIntPtr& rPos, SdrPageView* pPV, sal_Bool bMakeLines);
+ void ImpCrookObj(SdrObject* pO, const Point& rRef, const Point& rRad, SdrCrookMode eMode,
+ sal_Bool bVertical, sal_Bool bNoContortion, sal_Bool bRotate, const Rectangle& rMarkRect);
+ void ImpDistortObj(SdrObject* pO, const Rectangle& rRef, const XPolygon& rDistortedRect, sal_Bool bNoContortion);
+ sal_Bool ImpDelLayerCheck(SdrObjList* pOL, SdrLayerID nDelID) const;
+ void ImpDelLayerDelObjs(SdrObjList* pOL, SdrLayerID nDelID);
+
+ // Entfernt alle Obj der MarkList aus ihren ObjLists inkl Undo.
+ // Die Eintraege in rMark bleiben erhalten.
+ void DeleteMarkedList(const SdrMarkList& rMark); // DeleteMarked -> DeleteMarkedList
+
+ // Die Transformationsnachfragen etwas cachen
+ //void ImpCheckMarkTransform() const; veraltet
+ // Checken, was man so mit den markierten Objekten alles machen kann
+ virtual void CheckPossibilities();
+ void ForcePossibilities() const { if (bPossibilitiesDirty || bSomeObjChgdFlag) ((SdrEditView*)this)->CheckPossibilities(); }
+
+protected:
+ // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
+ SdrEditView(SdrModel* pModel1, OutputDevice* pOut = 0L);
+ virtual ~SdrEditView();
+
+public:
+ // Jeder Aufruf einer undofaehigen Methode an der View generiert eine
+ // UndoAction. Moechte man mehrere
+ // Methodenaufrufe zu einer UndoAction zusammenfassen, so kann man diese
+ // mit BegUndo() / EndUndo() klammern (beliebig tief). Als Kommentar der
+ // UndoAction wird der des ersten BegUndo(String) aller Klammerungen
+ // verwendet. NotifyNewUndoAction() wird in diesem Fall erst beim letzten
+ // EndUndo() gerufen. NotifyNewUndoAction() wird nicht gerufen bei einer
+ // leeren Klammerung.
+ void BegUndo() { pMod->BegUndo(); } // Undo-Klammerung auf
+ void BegUndo(const String& rComment) { pMod->BegUndo(rComment); } // Undo-Klammerung auf
+ void BegUndo(const String& rComment, const String& rObjDescr, SdrRepeatFunc eFunc=SDRREPFUNC_OBJ_NONE) { pMod->BegUndo(rComment,rObjDescr,eFunc); } // Undo-Klammerung auf
+ void BegUndo(SdrUndoGroup* pUndoGrp) { pMod->BegUndo(pUndoGrp); } // Undo-Klammerung auf
+ void EndUndo(); // Undo-Klammerung zu (inkl BroadcastEdges)
+ void AddUndo(SdrUndoAction* pUndo) { pMod->AddUndo(pUndo); } // Action hinzufuegen
+ // nur nach dem 1. BegUndo oder vor dem letzten EndUndo:
+ void SetUndoComment(const String& rComment) { pMod->SetUndoComment(rComment); }
+ void SetUndoComment(const String& rComment, const String& rObjDescr) { pMod->SetUndoComment(rComment,rObjDescr); }
+ bool IsUndoEnabled() const;
+
+ std::vector< SdrUndoAction* > CreateConnectorUndo( SdrObject& rO );
+ void AddUndoActions( std::vector< SdrUndoAction* >& );
+
+ // Layerverwaltung. Mit Undo.
+ SdrLayer* InsertNewLayer(const String& rName, sal_uInt16 nPos=0xFFFF);
+ // Loeschen eines Layer inkl. aller darauf befindlichen Objekte
+ void DeleteLayer(const String& rName);
+ // Verschieben eines Layer (Layerreihenfolge aendern)
+ void MoveLayer(const String& rName, sal_uInt16 nNewPos);
+
+ // Markierte Objekte die ausserhalb ihrer Page liegen
+ // werden ggf. einer anderen Page zugewiesen
+ // z.Zt. noch ohne Undo!!!
+ void ForceMarkedObjToAnotherPage();
+ void ForceMarkedToAnotherPage() { ForceMarkedObjToAnotherPage(); }
+
+ sal_Bool IsReadOnly() const { ForcePossibilities(); return bReadOnly; }
+
+ // Loeschen aller markierten Objekte
+ void DeleteMarkedObj();
+ sal_Bool IsDeleteMarkedObjPossible() const { ForcePossibilities(); return bDeletePossible; }
+
+ // Logisch- umschliessendes Rect aller markierten Objekte setzen.
+ // Das das wirklich geschieht ist nicht garantiert, denn eine
+ // waagerechte Linie hat z.B. immer eine Hoehe von 0.
+ void SetMarkedObjRect(const Rectangle& rRect, sal_Bool bCopy=sal_False);
+ void MoveMarkedObj(const Size& rSiz, bool bCopy=false);
+ void ResizeMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy=false);
+ long GetMarkedObjRotate() const;
+ void RotateMarkedObj(const Point& rRef, long nWink, bool bCopy=false);
+ void MirrorMarkedObj(const Point& rRef1, const Point& rRef2, bool bCopy=false);
+ void MirrorMarkedObjHorizontal(sal_Bool bCopy=sal_False);
+ void MirrorMarkedObjVertical(sal_Bool bCopy=sal_False);
+ long GetMarkedObjShear() const;
+ void ShearMarkedObj(const Point& rRef, long nWink, bool bVShear=false, bool bCopy=false);
+ void CrookMarkedObj(const Point& rRef, const Point& rRad, SdrCrookMode eMode, bool bVertical=false, bool bNoContortion=false, bool bCopy=false);
+ void DistortMarkedObj(const Rectangle& rRef, const XPolygon& rDistortedRect, bool bNoContortion=false, bool bCopy=false);
+
+ // Markierte Objekte kopieren und anstelle der alten markieren
+ void CopyMarkedObj();
+ void SetAllMarkedRect(const Rectangle& rRect, sal_Bool bCopy=sal_False) { SetMarkedObjRect(rRect,bCopy); }
+ void MoveAllMarked(const Size& rSiz, sal_Bool bCopy=sal_False) { MoveMarkedObj (rSiz,bCopy); }
+ void ResizeAllMarked(const Point& rRef, const Fraction& xFact, const Fraction& yFact, sal_Bool bCopy=sal_False) { ResizeMarkedObj (rRef,xFact,yFact,bCopy); }
+ long GetAllMarkedRotate() const { return GetMarkedObjRotate(); }
+ void RotateAllMarked(const Point& rRef, long nWink, sal_Bool bCopy=sal_False) { RotateMarkedObj(rRef,nWink,bCopy); }
+ void MirrorAllMarked(const Point& rRef1, const Point& rRef2, sal_Bool bCopy=sal_False) { MirrorMarkedObj(rRef1,rRef2,bCopy); }
+ void MirrorAllMarkedHorizontal(sal_Bool bCopy=sal_False) { MirrorMarkedObjHorizontal(bCopy); }
+ void MirrorAllMarkedVertical(sal_Bool bCopy=sal_False) { MirrorMarkedObjVertical(bCopy); }
+ long GetAllMarkedShear() const { return GetMarkedObjShear(); }
+ void ShearAllMarked(const Point& rRef, long nWink, sal_Bool bVShear=sal_False, sal_Bool bCopy=sal_False) { ShearMarkedObj(rRef,nWink,bVShear,bCopy); }
+ void CrookAllMarked(const Point& rRef, const Point& rRad, SdrCrookMode eMode, sal_Bool bVertical=sal_False, sal_Bool bNoContortion=sal_False, sal_Bool bCopy=sal_False) { CrookMarkedObj(rRef,rRad,eMode,bVertical,bNoContortion,bCopy); }
+ void CopyMarked() { CopyMarkedObj(); }
+ sal_Bool IsMoveAllowed() const { ForcePossibilities(); return bMoveAllowed && !bMoveProtect; }
+ sal_Bool IsResizeAllowed(sal_Bool bProp=sal_False) const;
+ sal_Bool IsRotateAllowed(sal_Bool b90Deg=sal_False) const;
+ sal_Bool IsMirrorAllowed(sal_Bool b45Deg=sal_False, sal_Bool b90Deg=sal_False) const;
+ sal_Bool IsTransparenceAllowed() const;
+ sal_Bool IsGradientAllowed() const;
+ sal_Bool IsShearAllowed() const;
+ sal_Bool IsEdgeRadiusAllowed() const;
+ sal_Bool IsCrookAllowed(sal_Bool bNoContortion=sal_False) const;
+ sal_Bool IsDistortAllowed(sal_Bool bNoContortion=sal_False) const;
+
+ // Vereinigen mehrerer Objekte zu einem PolyPolygon:
+ // - Rechtecke/Kreise/Text... werden implizit gewandelt.
+ // - Polylines werden automatisch geschlossen.
+ // - Die Attribute und der Layer werden vom Ersten der markierten Objekte
+ // uebernommen (also vom untersten der Z-Order).
+ // - Gruppenobjekte werden miteinbezogen, wenn alle! Memberobjekte der
+ // Gruppe wandelbar sind. Beinhaltet eine Gruppe also beispielsweise
+ // eine Bitmap oder ein OLE-Objekt, wird die gesamte Gruppe nicht
+ // beruecksichtigt.
+ // bNoPolyPoly=TRUE: Alles wird zu einem einzigen Polygon zusammengefasst
+ void CombineMarkedObjects(sal_Bool bNoPolyPoly = sal_True);
+
+ // for combining multiple polygons, with direct support of the modes
+ // SID_POLY_MERGE, SID_POLY_SUBSTRACT, SID_POLY_INTERSECT
+ void MergeMarkedObjects(SdrMergeMode eMode);
+
+ // for distribution dialog function
+ void DistributeMarkedObjects();
+
+ // Markierte Polypolygonobjekte in Polygone zerlegen
+ // Gruppenobjekte werden durchsucht und zerlegt, wenn es sich bei allen
+ // Memberobjekten um PathObjs handelt.
+ // bMakeLines=TRUE: alle Polygone werden in einzelne Linien bzw.
+ // Beziersegmente zerlegt
+ void DismantleMarkedObjects(sal_Bool bMakeLines=sal_False);
+ sal_Bool IsCombinePossible(sal_Bool bNoPolyPoly=sal_False) const;
+ sal_Bool IsDismantlePossible(sal_Bool bMakeLines=sal_False) const;
+
+ // Ein neues bereits fertig konstruiertes Obj einfuegen. Das Obj gehoert
+ // anschliessend dem Model. Nach dem Einfuegen wird das neue Objekt
+ // markiert (wenn dies nicht via nOptions unterbunden wird).
+ // U.U. wird das Obj jedoch nicht eingefuegt, sondern deleted, naemlich
+ // wenn der Ziel-Layer gesperrt oder nicht sichtbar ist. In diesem Fall
+ // returniert die Methode mit FALSE.
+ // Die Methode generiert u.a. auch eine Undo-Action.
+ sal_Bool InsertObjectAtView(SdrObject* pObj, SdrPageView& rPV, sal_uIntPtr nOptions=0);
+
+ // Ein Zeichenobjekt durch ein neues ersetzen. *pNewObj gehoert
+ // anschliessend mir, *pOldObj wandert ins Undo.
+ // Sollte in jedem Fall mit einer Undo-Klammerung versehen werden, z.B.:
+ // aStr+=" ersetzen";
+ // BegUndo(aStr);
+ // ReplaceObject(...);
+ // ...
+ // EndUndo();
+ void ReplaceObjectAtView(SdrObject* pOldObj, SdrPageView& rPV, SdrObject* pNewObj, sal_Bool bMark=sal_True);
+
+ void SetNotPersistAttrToMarked(const SfxItemSet& rAttr, sal_Bool bReplaceAll);
+ void MergeNotPersistAttrFromMarked(SfxItemSet& rAttr, sal_Bool bOnlyHardAttr) const;
+ void MergeAttrFromMarked(SfxItemSet& rAttr, sal_Bool bOnlyHardAttr) const;
+ SfxItemSet GetAttrFromMarked(sal_Bool bOnlyHardAttr) const;
+ void SetAttrToMarked(const SfxItemSet& rAttr, sal_Bool bReplaceAll);
+
+ // Geometrische Attribute (Position, Groesse, Drehwinkel)
+ // Bei der Position wird ein evtl. gesetzter PageOrigin beruecksichtigt.
+ SfxItemSet GetGeoAttrFromMarked() const;
+ void SetGeoAttrToMarked(const SfxItemSet& rAttr);
+
+ // Returnt NULL wenn:
+ // - Nix markiert,
+ // - kein StyleSheet an den markierten Objekten gesetzt
+ // - Bei Mehrfachselektion die markierten Objekte auf unterschiedliche
+ // StyleSheets verweisen.
+ SfxStyleSheet* GetStyleSheetFromMarked() const;
+
+ // z.Zt. noch ohne Undo :(
+ void SetStyleSheetToMarked(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr);
+
+ /* new interface src537 */
+ sal_Bool GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr) const;
+
+ sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll);
+ SfxStyleSheet* GetStyleSheet() const; // SfxStyleSheet* GetStyleSheet(sal_Bool& rOk) const;
+ sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr);
+
+ // Alle markierten Objekte zu einer Gruppe zusammenfassen.
+ // Anschliessend wird die neue Gruppe markiert. Bei einer
+ // seitenuebergreifenden Markierung wird eine Gruppe je Seite erzeugt.
+ // Alle erzeugten Gruppen sind anschliessend markiert.
+ // Ueber pUserGrp kann ein eigenes Gruppenobjekt vorgegeben werden. Dieses
+ // wird jedoch nicht direkt verwendet, sondern via Clone kopiert.
+ // Wird NULL uebergeben, macht sich die Methode SdrObjGroup-Instanzen.
+ void GroupMarked(const SdrObject* pUserGrp=NULL);
+
+ // Alle markierten Objektgruppen werden aufgeloesst (1 Level).
+ // Anschliessend sind statt der Gruppenobjekte alle ehemaligen
+ // Memberobjekte der aufgeloesten Gruppen markiert. Waren zum auch Objekte
+ // markiert, die keine Gruppenobjekte sind, so bleiben diese weiterhin
+ // zusaetzlich markiert.
+ void UnGroupMarked();
+
+ sal_Bool IsGroupPossible() const { ForcePossibilities(); return bGroupPossible; }
+ sal_Bool IsUnGroupPossible() const { ForcePossibilities(); return bUnGroupPossible; }
+ sal_Bool IsGroupEnterPossible() const { ForcePossibilities(); return bGrpEnterPossible; }
+
+ // Markierte Objekte in Polygone/Bezierkurven verwandeln. Die sal_Bool-
+ // Funktionen returnen sal_True, wenn wenigstens eins der markierten
+ // Objekte gewandelt werden kann. Memberobjekte von Gruppenobjekten
+ // werden ebenfalls gewandelt. Naehere Beschreibung siehe SdrObj.HXX.
+ sal_Bool IsConvertToPathObjPossible(sal_Bool bLineToArea) const { ForcePossibilities(); return sal_Bool(bLineToArea ? bCanConvToPathLineToArea : bCanConvToPath); }
+ sal_Bool IsConvertToPolyObjPossible(sal_Bool bLineToArea) const { ForcePossibilities(); return sal_Bool(bLineToArea ? bCanConvToPolyLineToArea : bCanConvToPoly); }
+ sal_Bool IsConvertToContourPossible() const { ForcePossibilities(); return bCanConvToContour; }
+ void ConvertMarkedToPathObj(sal_Bool bLineToArea);
+ void ConvertMarkedToPolyObj(sal_Bool bLineToArea);
+
+ // Alle markierten Objekte untereinander ausrichten. Normalerweise werden
+ // das SnapRect der Obj verwendet. Ist bBoundRects=sal_True, werden stattdessen
+ // die BoundRects ausgerichtet.
+ void AlignMarkedObjects(SdrHorAlign eHor, SdrVertAlign eVert, sal_Bool bBoundRects=sal_False);
+ sal_Bool IsAlignPossible() const;
+
+ // Markierte Objekte etwas nach "oben" holen
+ void MovMarkedToTop();
+
+ // Markierte Objekte etwas nach "unten" holen
+ void MovMarkedToBtm();
+
+ // Markierte Objekte ganz nach "oben" stellen
+ void PutMarkedToTop();
+
+ // Markierte Objekte ganz nach "unten" stellen
+ void PutMarkedToBtm();
+
+ // Markierte direkt vor das uebergebene Objekt stellen
+ // NULL -> wie PutMarkedToTop();
+ void PutMarkedInFrontOfObj(const SdrObject* pRefObj);
+
+ // Markierte direkt hinter das uebergebene Objekt stellen
+ // NULL -> wie PutMarkedToBtm();
+ void PutMarkedBehindObj(const SdrObject* pRefObj);
+
+ // Z-Order der markierten Objekte vertauschen
+ void ReverseOrderOfMarked();
+
+ // Feststellen, ob nach vorn/hinten stellen moeglich ist
+ // GetMaxToTop/BtmObj() wird von diesen Methoden nur begrenzt
+ // beruecksichtigt, d.h. es kann vorkommen dass IsToTopPossible()
+ // sal_True liefert, MovMarkedToTop() jedoch nichts aendert (z.B. bei
+ // Mehrfachselektion), weil eine von der abgeleiteten View ueber
+ // GetMaxToTopObj() auferlegte Restriktion dies verhindert.
+ sal_Bool IsToTopPossible() const { ForcePossibilities(); return bToTopPossible; }
+ sal_Bool IsToBtmPossible() const { ForcePossibilities(); return bToBtmPossible; }
+ sal_Bool IsReverseOrderPossible() const { ForcePossibilities(); return bReverseOrderPossible; }
+
+ // Ueber diese Methoden stellt die View fest, wie weit ein Objekt
+ // nach vorn bzw. nach hinten gestellt werden darf (Z-Order). Das
+ // zurueckgegebene Objekt wird dann nicht "ueberholt". Bei Rueckgabe
+ // von NULL (Defaultverhalten) bestehen keine Restriktionen.
+ virtual SdrObject* GetMaxToTopObj(SdrObject* pObj) const;
+ virtual SdrObject* GetMaxToBtmObj(SdrObject* pObj) const;
+
+ // Folgende Methode wird gerufen, wenn z.B. durch ToTop, ToBtm, ... die
+ // Reihenfolgen der Objekte geaendert wurde. Der Aufruf erfolgt dann nach
+ // jedem SdrObjList::SetObjectOrdNum(nOldPos,nNewPos);
+ virtual void ObjOrderChanged(SdrObject* pObj, sal_uIntPtr nOldPos, sal_uIntPtr nNewPos);
+
+ // Falls ein oder mehrere Objekte des Types SdrGrafObj oder SdrOle2Obj
+ // markiert sind und diese in der Lage sind ein StarView-Metafile zu
+ // liefern, konvertiert diese Methode das Metafile in Drawingobjekte.
+ // Die SdrGrafObjs/SdrOle2Objs werden dann durch die neue Objekte ersetzt.
+ void DoImportMarkedMtf(SvdProgressInfo *pProgrInfo=NULL);
+ sal_Bool IsImportMtfPossible() const { ForcePossibilities(); return bImportMtfPossible; }
+
+ // Wird der Modus VirtualObjectBundling eingeschaltet, werden beim
+ // ToTop/ToBtm virtuelle Objekte die dasselbe Objekt referenzieren
+ // in ihrer Z-Order buendig zusammengehalten (Writer).
+ // Defaulteinstellung ist sal_False=ausgeschaltet.
+ void SetVirtualObjectBundling(sal_Bool bOn) { bBundleVirtObj=bOn; }
+ sal_Bool IsVirtualObjectBundling() const { return bBundleVirtObj; }
+
+ // von der SdrMarkView ueberladen fuer den internen gebrauch
+ virtual void MarkListHasChanged();
+ virtual void ModelHasChanged();
+};
+
+#endif //_SVDEDTV_HXX
+
diff --git a/svx/inc/svx/svdedxv.hxx b/svx/inc/svx/svdedxv.hxx
new file mode 100644
index 000000000000..aec7a656077e
--- /dev/null
+++ b/svx/inc/svx/svdedxv.hxx
@@ -0,0 +1,306 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDEDXV_HXX
+#define _SVDEDXV_HXX
+
+#include <rtl/ref.hxx>
+#include "svx/svxdllapi.h"
+#include <svx/svdglev.hxx>
+
+#include <svx/selectioncontroller.hxx>
+
+//************************************************************
+// Vorausdeklarationen
+//************************************************************
+
+#include <boost/shared_ptr.hpp>
+
+class SdrOutliner;
+class OutlinerView;
+class EditStatus;
+class EditFieldInfo;
+class ImpSdrEditPara;
+struct PasteOrDropInfos;
+
+namespace com { namespace sun { namespace star { namespace uno {
+ class Any;
+} } } }
+
+namespace sdr {
+ class SelectionController;
+}
+
+//************************************************************
+// Defines
+//************************************************************
+
+enum SdrEndTextEditKind {SDRENDTEXTEDIT_UNCHANGED, // Textobjekt unveraendert
+ SDRENDTEXTEDIT_CHANGED, // Textobjekt wurde geaendert
+ SDRENDTEXTEDIT_DELETED, // Textobjekt implizit geloescht
+ SDRENDTEXTEDIT_SHOULDBEDELETED}; // Fuer Writer: Textobjekt sollte geloescht werden
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@ @@@@@ @@@@@@ @@@@@ @@@@@ @@ @@@@@@ @@ @@ @@ @@@@@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@
+// @@ @@ @@@@@ @@ @@@@ @@ @@ @@ @@ @@@@@ @@ @@@@ @@@@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@
+// @@@@ @@@@@ @@@@ @@@@@ @@@@@ @@ @@ @ @@ @@@@@ @@ @@
+//
+// - Allgemeines Edit fuer objektspeziefische Eigenschaften
+// - Textedit fuer alle vom SdrTextObj abgeleiteten Zeichenobjekte
+// - Macromodus
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class SVX_DLLPUBLIC SdrObjEditView: public SdrGlueEditView
+{
+ friend class SdrPageView;
+ friend class ImpSdrEditPara;
+
+protected:
+ // TextEdit
+ SdrObjectWeakRef mxTextEditObj; // Aktuell im TextEdit befindliches Obj
+ SdrPageView* pTextEditPV;
+ SdrOutliner* pTextEditOutliner; // Na eben der Outliner fuers TextEdit
+ OutlinerView* pTextEditOutlinerView; // die aktuelle View des Outliners
+ Window* pTextEditWin; // passendes Win zu pTextEditOutlinerView
+ Cursor* pTextEditCursorMerker; // Zum Restaurieren des Cursors am jeweiligen Win
+ ImpSdrEditPara* pEditPara; // Da hau' ich erstmal alles rein um kompatibel zu bleiben...
+ SdrObject* pMacroObj;
+ SdrPageView* pMacroPV;
+ Window* pMacroWin;
+
+ Rectangle aTextEditArea;
+ Rectangle aMinTextEditArea;
+ Link aOldCalcFieldValueLink; // Zum rufen des alten Handlers
+ Point aMacroDownPos;
+
+ sal_uInt16 nMacroTol;
+
+ unsigned bTextEditDontDelete : 1; // Outliner und View bei SdrEndTextEdit nicht deleten (f. Rechtschreibpruefung)
+ unsigned bTextEditOnlyOneView : 1; // Nur eine OutlinerView (f. Rechtschreibpruefung)
+ unsigned bTextEditNewObj : 1; // Aktuell editiertes Objekt wurde gerade neu erzeugt
+ unsigned bQuickTextEditMode : 1; // persistent(->CrtV). Default=TRUE
+ unsigned bMacroMode : 1; // persistent(->CrtV). Default=TRUE
+ unsigned bMacroDown : 1;
+
+ rtl::Reference< sdr::SelectionController > mxSelectionController;
+ rtl::Reference< sdr::SelectionController > mxLastSelectionController;
+
+private:
+ SVX_DLLPRIVATE void ImpClearVars();
+
+protected:
+ OutlinerView* ImpFindOutlinerView(Window* pWin) const;
+
+ // Eine neue OutlinerView auf dem Heap anlegen und alle erforderlichen Parameter setzen.
+ // pTextEditObj, pTextEditPV und pTextEditOutliner muessen initiallisiert sein.
+ OutlinerView* ImpMakeOutlinerView(Window* pWin, sal_Bool bNoPaint, OutlinerView* pGivenView) const;
+ void ImpPaintOutlinerView(OutlinerView& rOutlView, const Rectangle& rRect) const;
+ void ImpInvalidateOutlinerView(OutlinerView& rOutlView) const;
+
+ // Feststellen, ob der gesamte Text markiert ist. Liefert auch sal_True wenn
+ // kein Text vorhanden ist.
+ sal_Bool ImpIsTextEditAllSelected() const;
+ void ImpMakeTextCursorAreaVisible();
+
+ // Handler fuer AutoGrowing Text bei aktivem Outliner
+ DECL_LINK(ImpOutlinerStatusEventHdl,EditStatus*);
+ DECL_LINK(ImpOutlinerCalcFieldValueHdl,EditFieldInfo*);
+
+ void ImpMacroUp(const Point& rUpPos);
+ void ImpMacroDown(const Point& rDownPos);
+
+ DECL_LINK( BeginPasteOrDropHdl, PasteOrDropInfos* );
+ DECL_LINK( EndPasteOrDropHdl, PasteOrDropInfos* );
+
+protected:
+ // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
+ SdrObjEditView(SdrModel* pModel1, OutputDevice* pOut = 0L);
+ virtual ~SdrObjEditView();
+
+public:
+ // Actionhandling fuer Macromodus
+ virtual sal_Bool IsAction() const;
+ virtual void MovAction(const Point& rPnt);
+ virtual void EndAction();
+ virtual void BrkAction();
+ virtual void BckAction();
+ virtual void TakeActionRect(Rectangle& rRect) const;
+
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
+ virtual void ModelHasChanged();
+
+ //************************************************************************
+ // TextEdit ueber einen Outliner
+ //************************************************************************
+ // QuickTextEditMode bedeutet, dass Objekte mit Text sofort beim Anklicken
+ // editiert werden sollen. Default=TRUE. Persistent.
+ void SetQuickTextEditMode(sal_Bool bOn) { bQuickTextEditMode=bOn; }
+ sal_Bool IsQuickTextEditMode() const { return bQuickTextEditMode; }
+
+ // Starten des TextEditMode. Ist pWin==NULL, wird das erste an der View
+ // angemeldete Win verwendet.
+ // Der Cursor des Fensters an dem Editiert wird wird bei
+ // SdrBeginTextEdit() gemerkt und bei SdrEndTextEdit() wieder restauriert.
+ // Die App muss sicherstellen, das die zum Zeitpunkt des BegEdit am
+ // Windows angemeldete Cursorinstanz beim SdrEndTextEdit noch gueltig ist.
+ // Ueber den Parameter pEditOutliner kann die Applikation einen eigenen
+ // Outliner vorgeben, der zum Editieren verwendet wird. Dieser gehoert
+ // nach Aufruf von SdrBeginTextEdit der SdrObjEditView und wird von dieser
+ // spaeter via delete zerstoert (falls bDontDeleteOutliner=sal_False). Die
+ // SdrObjEditView setzt dann das Modusflag (EditEngine/Outliner) an
+ // dieser Instanz und ausserdem auch den StatusEventHdl.
+ // Ebenso kann eine spezifische OutlinerView vorgegeben werden.
+
+ virtual sal_Bool SdrBeginTextEdit(SdrObject* pObj, SdrPageView* pPV = 0L, ::Window* pWin = 0L, sal_Bool bIsNewObj = sal_False,
+ SdrOutliner* pGivenOutliner = 0L, OutlinerView* pGivenOutlinerView = 0L,
+ sal_Bool bDontDeleteOutliner = sal_False, sal_Bool bOnlyOneView = sal_False, sal_Bool bGrabFocus = sal_True);
+ // bDontDeleteReally ist ein Spezialparameter fuer den Writer.
+ // Ist dieses Flag gesetzt, dann wird ein evtl. leeres Textobjekt
+ // nicht geloescht. Stattdessen gibt es dann einen Returncode
+ // SDRENDTEXTEDIT_SHOULDBEDELETED (anstelle von SDRENDTEXTEDIT_BEDELETED)
+ // der besagt, dass das Objekt geloescht werden sollte.
+ virtual SdrEndTextEditKind SdrEndTextEdit(sal_Bool bDontDeleteReally = sal_False);
+ virtual bool IsTextEdit() const;
+
+ // sal_True=Es wird ein Textrahmen (OBJ_TEXT,OBJ_OUTLINETEXT,...) editiert
+ // ansonsten handelt es sich um ein beschriftetes Zeichenobjekt, an dem
+ // der Text ja bekanntlich hor. und vert. zentriert wird.
+ sal_Bool IsTextEditFrame() const;
+
+ // Diese Methode liefert sal_True, wenn der Punkt rHit innerhalb der
+ // des Objektbereichs oder der OutlinerView liegt.
+ sal_Bool IsTextEditHit(const Point& rHit, short nTol) const;
+
+ // Diese Methode liefert sal_True, wenn der Punkt rHit innerhalb des
+ // Handle-dicken Rahmens liegt, der die OutlinerView bei TextFrames
+ // umschliesst.
+ sal_Bool IsTextEditFrameHit(const Point& rHit) const;
+
+ // Bei aktiver Selektion, also zwischen MouseButtonDown und
+ // MouseButtonUp liefert diese Methode immer TRUE.
+ sal_Bool IsTextEditInSelectionMode() const;
+
+ // Folgende Methode addiert einen passenden Offset zum MouseEvent
+ // um diesen an den Outliner weiterzureichen.
+ void AddTextEditOfs(MouseEvent& rMEvt) const;
+
+ // Wer das z.Zt. im TextEdit befindliche Objekt braucht:
+ SdrObject* GetTextEditObject() const { return mxTextEditObj.get(); }
+
+ // info about TextEditPageView. Default is 0L.
+ virtual SdrPageView* GetTextEditPageView() const;
+
+ // Das aktuelle Win des Outliners
+ Window* GetTextEditWin() const { return pTextEditWin; }
+ void SetTextEditWin(Window* pWin);
+
+ // An den hier abgeholten Outliner kann man schliesslich
+ // Events versenden, Attribute setzen, Cut/Copy/Paste rufen,
+ // Undo/Redo rufen, etc.
+ const SdrOutliner* GetTextEditOutliner() const { return pTextEditOutliner; }
+ SdrOutliner* GetTextEditOutliner() { return pTextEditOutliner; }
+ const OutlinerView* GetTextEditOutlinerView() const { return pTextEditOutlinerView; }
+ OutlinerView* GetTextEditOutlinerView() { return pTextEditOutlinerView; }
+
+ virtual sal_Bool KeyInput(const KeyEvent& rKEvt, Window* pWin);
+ virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt, Window* pWin);
+ virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt, Window* pWin);
+ virtual sal_Bool MouseMove(const MouseEvent& rMEvt, Window* pWin);
+ virtual sal_Bool Command(const CommandEvent& rCEvt, Window* pWin);
+ sal_Bool Cut(sal_uIntPtr nFormat=SDR_ANYFORMAT);
+ sal_Bool Yank(sal_uIntPtr nFormat=SDR_ANYFORMAT);
+ sal_Bool Paste(Window* pWin=NULL, sal_uIntPtr nFormat=SDR_ANYFORMAT);
+
+ // #97766# make virtual to change implementation e.g. for SdOutlineView
+ virtual sal_uInt16 GetScriptType() const;
+
+ /* new interface src537 */
+ sal_Bool GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False) const;
+
+ sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll);
+ SfxStyleSheet* GetStyleSheet() const; // SfxStyleSheet* GetStyleSheet(sal_Bool& rOk) const;
+ sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr);
+
+ // Intern: Beim Splitteraufziehen neue OutlinerView...
+ virtual void AddWindowToPaintView(OutputDevice* pNewWin);
+ virtual void DeleteWindowFromPaintView(OutputDevice* pOldWin);
+
+ //************************************************************************
+ // Object-MacroModus (z.B. Rect als Button oder sowas):
+ //************************************************************************
+ // Persistent. Default TRUE. SvDraw wertet das Flag u.a. bei
+ // SdrView::GetPreferedPointer() aus. Hat nur Wirkung, wenn das Dokument
+ // Draw-Objekte mit Macrofunktionalitaet hat (SdrObject::HasMacro()==sal_True).
+ void SetMacroMode(sal_Bool bOn) { bMacroMode=bOn; }
+ sal_Bool IsMacroMode() const { return bMacroMode; }
+ sal_Bool BegMacroObj(const Point& rPnt, short nTol, SdrObject* pObj, SdrPageView* pPV, Window* pWin);
+ sal_Bool BegMacroObj(const Point& rPnt, SdrObject* pObj, SdrPageView* pPV, Window* pWin) { return BegMacroObj(rPnt,-2,pObj,pPV,pWin); }
+ void MovMacroObj(const Point& rPnt);
+ void BrkMacroObj();
+ sal_Bool EndMacroObj();
+ sal_Bool IsMacroObj() const { return pMacroObj!=NULL; }
+ sal_Bool IsMacroObjDown() const { return bMacroDown; }
+
+ /** fills the given any with a XTextCursor for the current text selection.
+ Leaves the any untouched if there currently is no text selected */
+ void getTextSelection( ::com::sun::star::uno::Any& rSelection );
+
+ virtual void MarkListHasChanged();
+
+ rtl::Reference< sdr::SelectionController > getSelectionController() const { return mxSelectionController; }
+
+ /** returns true if the shape identified by its inventor and identifier supports format paint brush operation */
+ virtual bool SupportsFormatPaintbrush( sal_uInt32 nObjectInventor, sal_uInt16 nObjectIdentifier ) const;
+
+ /** returns a format paint brush set from the current selection */
+ virtual bool TakeFormatPaintBrush( boost::shared_ptr< SfxItemSet >& rFormatSet );
+
+ /** applies a format paint brush set from the current selection.
+ if bNoCharacterFormats is true, no character attributes are changed.
+ if bNoParagraphFormats is true, no paragraph attributes are changed.
+ */
+ virtual void ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats );
+
+ /** helper function for selections with multiple SdrText for one SdrTextObj (f.e. tables ) */
+ void ApplyFormatPaintBrushToText( SfxItemSet& rFormatSet, SdrTextObj& rTextObj, SdrText* pText, bool bNoCharacterFormats, bool bNoParagraphFormats );
+
+protected:
+ virtual void OnBeginPasteOrDrop( PasteOrDropInfos* pInfos );
+ virtual void OnEndPasteOrDrop( PasteOrDropInfos* pInfos );
+
+};
+
+#endif //_SVDEDXV_HXX
+
diff --git a/svx/inc/svx/svdetc.hxx b/svx/inc/svx/svdetc.hxx
new file mode 100644
index 000000000000..f1ba2d3cf93b
--- /dev/null
+++ b/svx/inc/svx/svdetc.hxx
@@ -0,0 +1,356 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDETC_HXX
+#define _SVDETC_HXX
+
+#include <tools/string.hxx>
+#include <tools/contnr.hxx>
+
+#ifndef _OUTDEV_HXX //autogen
+#include <vcl/outdev.hxx>
+#endif
+#include <tools/shl.hxx>
+#include <editeng/outliner.hxx>
+#include "svx/svxdllapi.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+// ExchangeFormat-Id der DrawingEngine holen. Daten koennen dann per
+// static sal_Bool CopyData(pData,nLen,nFormat);
+// bereitgestellt werden, wobei pData/nLen einen SvMemoryStream beschreiben in
+// dem ein SdrModel gestreamt wird an dem fuer die Zeitdauer des Streamens das
+// Flag SdrModel::SetStreamingSdrModel(sal_True) gesetzt wird.
+// sal_uIntPtr SdrGetExchangeFormat(); -- JP 18.01.99 - dafuer gibt es ein define
+
+class SdrOutliner;
+class SdrModel;
+class SvtSysLocale;
+class CharClass;
+class LocaleDataWrapper;
+
+namespace com { namespace sun { namespace star { namespace lang {
+ struct Locale;
+}}}}
+
+// Einen Outliner mit den engineglobalen
+// Defaulteinstellungen auf dem Heap erzeugen.
+// Ist pMod<>NULL, dann wird der MapMode des uebergebenen
+// Models verwendet. Die resultierende Default-Fonthoehe bleibt
+// jedoch dieselbe (die logische Fonthoehe wird umgerechnet).
+SVX_DLLPUBLIC SdrOutliner* SdrMakeOutliner( sal_uInt16 nOutlinerMode, SdrModel* pMod );
+
+// Globale Defaulteinstellungen fuer die DrawingEngine.
+// Diese Einstellungen sollte man direkt beim Applikationsstart
+// vornehmen, noch bevor andere Methoden der Engine gerufen werden.
+class SVX_DLLPUBLIC SdrEngineDefaults
+{
+friend class SdrAttrObj;
+ String aFontName;
+ FontFamily eFontFamily;
+ Color aFontColor;
+ sal_uIntPtr nFontHeight;
+ MapUnit eMapUnit;
+ Fraction aMapFraction;
+
+private:
+ static SdrEngineDefaults& GetDefaults();
+
+public:
+ SdrEngineDefaults();
+ // Default Fontname ist "Times New Roman"
+ static void SetFontName(const String& rFontName) { GetDefaults().aFontName=rFontName; }
+ static String GetFontName() { return GetDefaults().aFontName; }
+ // Default FontFamily ist FAMILY_ROMAN
+ static void SetFontFamily(FontFamily eFam) { GetDefaults().eFontFamily=eFam; }
+ static FontFamily GetFontFamily() { return GetDefaults().eFontFamily; }
+ // Default FontColor ist COL_BLACK
+ static void SetFontColor(const Color& rColor) { GetDefaults().aFontColor=rColor; }
+ static Color GetFontColor() { return GetDefaults().aFontColor; }
+ // Default FontHeight ist 847. Die Fonthoehe wird in logischen Einheiten
+ // (MapUnit/MapFraction (siehe unten)) angegeben. Die Defaulteinstellung
+ // 847/100mm entspricht also ca. 24 Point. Verwendet man stattdessen
+ // beispielsweise Twips (SetMapUnit(MAP_TWIP)) (20 Twip = 1 Point) muss
+ // man als Fonthoehe 480 angeben um 24 Point als default zu erhalten.
+ static void SetFontHeight(sal_uIntPtr nHeight) { GetDefaults().nFontHeight=nHeight; }
+ static sal_uIntPtr GetFontHeight() { return GetDefaults().nFontHeight; }
+ // Der MapMode wird fuer den globalen Outliner benoetigt.
+ // Gleichzeitig bekommt auch jedes neu instanziierte SdrModel
+ // diesen MapMode default zugewiesen.
+ // Default MapUnit ist MAP_100TH_MM
+ static void SetMapUnit(MapUnit eMap) { GetDefaults().eMapUnit=eMap; }
+ static MapUnit GetMapUnit() { return GetDefaults().eMapUnit; }
+ // Default MapFraction ist 1/1.
+ static void SetMapFraction(const Fraction& rMap) { GetDefaults().aMapFraction=rMap; }
+ static Fraction GetMapFraction() { return GetDefaults().aMapFraction; }
+ // Der Aufruf der folgenden Methode veranlasst die Engine
+ // ihre sprachabhaengigen Resourcen neu zu initiallisieren.
+ // Bereits bestehende Undotexte, etc. bleiben jedoch in der
+ // sprache erhalten, in der sie erzeugt wurden.
+ static void LanguageHasChanged();
+
+
+ // Einen Outliner mit den engineglobalen
+ // Defaulteinstellungen auf dem Heap erzeugen.
+ // Ist pMod<>NULL, dann wird der MapMode des uebergebenen
+ // Models verwendet. Die resultierende Default-Fonthoehe bleibt
+ // jedoch dieselbe (die logische Fonthoehe wird umgerechnet).
+ friend SVX_DLLPUBLIC SdrOutliner* SdrMakeOutliner( sal_uInt16 nOutlinerMode, SdrModel* pMod );
+};
+
+class SfxItemSet;
+// Liefert eine Ersatzdarstellung fuer einen XFillStyle
+// Bei XFILL_NONE gibt's sal_False und rCol bleibt unveraendert.
+SVX_DLLPUBLIC FASTBOOL GetDraftFillColor(const SfxItemSet& rSet, Color& rCol);
+
+// Ein Container fuer USHORTs (im Prinzip ein dynamisches Array)
+class UShortCont {
+ Container aArr;
+public:
+ UShortCont(sal_uInt16 nBlock, sal_uInt16 nInit, sal_uInt16 nResize): aArr(nBlock,nInit,nResize) {}
+ void Clear() { aArr.Clear(); }
+ void Insert(sal_uInt16 nElem, sal_uIntPtr nPos=CONTAINER_APPEND) { aArr.Insert((void*)sal_uIntPtr(nElem),nPos); }
+ void Remove(sal_uIntPtr nPos) { aArr.Remove(nPos); }
+ void Replace(sal_uInt16 nElem, sal_uIntPtr nPos) { aArr.Replace((void*)sal_uIntPtr(nElem),nPos); }
+ sal_uInt16 GetObject(sal_uIntPtr nPos) const { return sal_uInt16(sal_uIntPtr(aArr.GetObject(nPos))); }
+ sal_uIntPtr GetPos(sal_uInt16 nElem) const { return aArr.GetPos((void*)(sal_uIntPtr)nElem); }
+ sal_uIntPtr GetCount() const { return aArr.Count(); }
+ void Sort();
+};
+
+class ContainerSorter {
+protected:
+ Container& rCont;
+private:
+//#if 0 // _SOLAR__PRIVATE
+ void ImpSubSort(long nL, long nR) const;
+//#endif // __PRIVATE
+public:
+ ContainerSorter(Container& rNewCont): rCont(rNewCont) {}
+ void DoSort(sal_uIntPtr a=0, sal_uIntPtr b=0xFFFFFFFF) const;
+#ifdef This_Is_Just_For_A_Comment
+ Compare() muss returnieren:
+ -1 falls *pElem1<*pElem2
+ 0 falls *pElem1=*pElem2
+ +1 falls *pElem1>*pElem2
+#endif
+ virtual int Compare(const void* pElem1, const void* pElem2) const=0;
+private: // damit keiner vergessen wird
+virtual
+ void
+ Is1stLessThan2nd(const void* pElem1, const void* pElem2) const;
+// virtual FASTBOOL Is1stLessThan2nd(const void* pElem1, const void* pElem2) const=NULL;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+//#if 0 // _SOLAR__PRIVATE
+#define SDRHDC_SAVEPEN 1 /* Save Linecolor */
+#define SDRHDC_SAVEBRUSH 2 /* Save Fillcolorn */
+#define SDRHDC_SAVEFONT 4 /* Save Font */
+#define SDRHDC_SAVEPENANDBRUSH 3 /* Save Line- and FillColor */
+#define SDRHDC_SAVEPENANDBRUSHANDFONT 7 /* Save Font, Line- and fillcolor */
+#define SDRHDC_SAVECLIPPING 8 /* Save Clipping */
+#define SDRHDC_SAVEALL 15 /* Save Clipping, Font, fill- and linecolor */
+
+class ImpClipMerk;
+class ImpColorMerk;
+class ImpSdrHdcMerk
+{
+ ImpColorMerk* pFarbMerk;
+ ImpClipMerk* pClipMerk;
+ Color* pLineColorMerk;
+ sal_uInt16 nMode;
+public:
+ ImpSdrHdcMerk(const OutputDevice& rOut, sal_uInt16 nNewMode=SDRHDC_SAVEALL, FASTBOOL bAutoMerk=sal_True);
+ ~ImpSdrHdcMerk();
+ void Save(const OutputDevice& rOut);
+ FASTBOOL IsSaved() const { return pFarbMerk!=NULL || pClipMerk!=NULL || pLineColorMerk!=NULL; }
+ void Restore(OutputDevice& rOut, sal_uInt16 nMask=SDRHDC_SAVEALL) const;
+};
+//#endif // __PRIVATE
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+// Ein ItemSet auf Outliner- bzw. EditEngine-Items durchsuchen
+// Liefert sal_True, wenn der Set solchen Items enthaelt.
+sal_Bool SearchOutlinerItems(const SfxItemSet& rSet, sal_Bool bInklDefaults, sal_Bool* pbOnlyEE=NULL);
+
+// zurueck erhaelt man einen neuen WhichTable den
+// man dann irgendwann mit delete platthauen muss.
+sal_uInt16* RemoveWhichRange(const sal_uInt16* pOldWhichTable, sal_uInt16 nRangeBeg, sal_uInt16 nRangeEnd);
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class Link;
+
+// Hilfsklasse zur kommunikation zwischen dem Dialog
+// zum aufbrechen von Metafiles (sd/source/ui/dlg/brkdlg.cxx),
+// SdrEditView::DoImportMarkedMtf() und
+// ImpSdrGDIMetaFileImport::DoImport()
+class SVX_DLLPUBLIC SvdProgressInfo
+{
+private:
+ sal_uIntPtr nSumActionCount; // Summe aller Actions
+ sal_uIntPtr nSumCurAction; // Summe aller bearbeiteten Actions
+
+ sal_uIntPtr nActionCount; // Anzahl der Actions im akt. Obj.
+ sal_uIntPtr nCurAction; // Anzahl bearbeiteter Act. im akt. Obj.
+
+ sal_uIntPtr nInsertCount; // Anzahl einzufuegender Act. im akt. Obj.
+ sal_uIntPtr nCurInsert; // Anzahl bereits eingefuegter Actions
+
+ sal_uIntPtr nObjCount; // Anzahl der selektierten Objekte
+ sal_uIntPtr nCurObj; // Aktuelles Objekt
+
+ Link *pLink;
+
+public:
+ SvdProgressInfo( Link *_pLink );
+
+ void Init( sal_uIntPtr _nSumActionCount, sal_uIntPtr _nObjCount );
+
+ sal_Bool SetNextObject();
+
+ void SetActionCount( sal_uIntPtr _nActionCount );
+ void SetInsertCount( sal_uIntPtr _nInsertCount );
+
+ sal_Bool ReportActions( sal_uIntPtr nAnzActions );
+ sal_Bool ReportInserts( sal_uIntPtr nAnzInserts );
+
+ sal_uIntPtr GetSumActionCount() const { return nSumActionCount; };
+ sal_uIntPtr GetSumCurAction() const { return nSumCurAction; };
+ sal_uIntPtr GetObjCount() const { return nObjCount; };
+ sal_uIntPtr GetCurObj() const { return nCurObj; };
+
+ sal_uIntPtr GetActionCount() const { return nActionCount; };
+ sal_uIntPtr GetCurAction() const { return nCurAction; };
+
+ sal_uIntPtr GetInsertCount() const { return nInsertCount; };
+ sal_uIntPtr GetCurInsert() const { return nCurInsert; };
+
+ void ReportError();
+ sal_Bool ReportRescales( sal_uIntPtr nAnzRescales );
+};
+
+
+
+class SdrLinkList
+{
+ Container aList;
+protected:
+ unsigned FindEntry(const Link& rLink) const;
+public:
+ SdrLinkList(): aList(1024,4,4) {}
+ ~SdrLinkList() { Clear(); }
+ SVX_DLLPUBLIC void Clear();
+ unsigned GetLinkCount() const { return (unsigned)aList.Count(); }
+ Link& GetLink(unsigned nNum) { return *((Link*)(aList.GetObject(nNum))); }
+ const Link& GetLink(unsigned nNum) const { return *((Link*)(aList.GetObject(nNum))); }
+ void InsertLink(const Link& rLink, unsigned nPos=0xFFFF);
+ void RemoveLink(const Link& rLink);
+ FASTBOOL HasLink(const Link& rLink) const { return FindEntry(rLink)!=0xFFFF; }
+};
+
+// Fuer die Factory in SvdObj.CXX
+SdrLinkList& ImpGetUserMakeObjHdl();
+SdrLinkList& ImpGetUserMakeObjUserDataHdl();
+
+class SdrOle2Obj;
+class AutoTimer;
+
+class OLEObjCache : public Container
+{
+ sal_uIntPtr nSize;
+ AutoTimer* pTimer;
+
+ void UnloadOnDemand();
+ sal_Bool UnloadObj( SdrOle2Obj* pObj );
+ DECL_LINK( UnloadCheckHdl, AutoTimer* );
+
+public:
+ OLEObjCache();
+ SVX_DLLPUBLIC ~OLEObjCache();
+
+ void SetSize(sal_uIntPtr nNewSize);
+ void InsertObj(SdrOle2Obj* pObj);
+ void RemoveObj(SdrOle2Obj* pObj);
+};
+
+
+class SVX_DLLPUBLIC SdrGlobalData
+{
+ const SvtSysLocale* pSysLocale; // follows always locale settings
+ const CharClass* pCharClass; // follows always SysLocale
+ const LocaleDataWrapper* pLocaleData; // follows always SysLocale
+public:
+ SdrLinkList aUserMakeObjHdl;
+ SdrLinkList aUserMakeObjUserDataHdl;
+ SdrOutliner* pOutliner;
+ SdrEngineDefaults* pDefaults;
+ ResMgr* pResMgr;
+ sal_uIntPtr nExchangeFormat;
+ OLEObjCache aOLEObjCache;
+
+
+ const SvtSysLocale* GetSysLocale(); // follows always locale settings
+ const CharClass* GetCharClass(); // follows always SysLocale
+ const LocaleDataWrapper* GetLocaleData(); // follows always SysLocale
+public:
+ SdrGlobalData();
+ ~SdrGlobalData();
+
+ OLEObjCache& GetOLEObjCache() { return aOLEObjCache; }
+};
+
+inline SdrGlobalData& GetSdrGlobalData()
+{
+ void** ppAppData=GetAppData(SHL_SVD);
+ if (*ppAppData==NULL) {
+ *ppAppData=new SdrGlobalData;
+ }
+ return *((SdrGlobalData*)*ppAppData);
+}
+
+namespace sdr
+{
+
+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/svdfield.hxx b/svx/inc/svx/svdfield.hxx
new file mode 100644
index 000000000000..cf79131a72cd
--- /dev/null
+++ b/svx/inc/svx/svdfield.hxx
@@ -0,0 +1,36 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDFIELD_HXX
+#define _SVDFIELD_HXX
+
+#include "svx/svxdllapi.h"
+
+void SVX_DLLPUBLIC SdrRegisterFieldClasses();
+
+#endif //_SVDFIELD_HXX
+
diff --git a/svx/inc/svx/svdglev.hxx b/svx/inc/svx/svdglev.hxx
new file mode 100644
index 000000000000..efded3a48182
--- /dev/null
+++ b/svx/inc/svx/svdglev.hxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDGLEV_HXX
+#define _SVDGLEV_HXX
+
+#include "svx/svxdllapi.h"
+#include <svx/svdpoev.hxx>
+
+//************************************************************
+// Vorausdeklarationen
+//************************************************************
+
+class SdrGluePoint;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@ @@ @@ @@ @@@@@ @@@@@ @@@@@ @@ @@@@@@ @@ @@ @@ @@@@@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@
+// @@ @@@ @@ @@ @@ @@@@ @@@@ @@ @@ @@ @@ @@@@@ @@ @@@@ @@@@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@
+// @@@@@ @@@@@ @@@@ @@@@@ @@@@@ @@@@@ @@ @@ @ @@ @@@@@ @@ @@
+//
+// Editieren von Klebepunkten an den Objekten (Klebepunkte fuer Verbinder)
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class SVX_DLLPUBLIC SdrGlueEditView: public SdrPolyEditView
+{
+ void ImpClearVars();
+
+ // Markierte Klebepunkte kopieren und anstelle der alten markieren
+ void ImpCopyMarkedGluePoints();
+ typedef void (*PGlueDoFunc)(SdrGluePoint&, const SdrObject* pObj, const void*, const void*, const void*, const void*, const void*);
+ typedef void (*PGlueTrFunc)(Point&, const void*, const void*, const void*, const void*, const void*);
+ void ImpDoMarkedGluePoints(PGlueDoFunc pDoFunc, sal_Bool bConst, const void* p1=NULL, const void* p2=NULL, const void* p3=NULL, const void* p4=NULL, const void* p5=NULL);
+ void ImpTransformMarkedGluePoints(PGlueTrFunc pTrFunc, const void* p1=NULL, const void* p2=NULL, const void* p3=NULL, const void* p4=NULL, const void* p5=NULL);
+
+protected:
+ // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
+ SdrGlueEditView(SdrModel* pModel1, OutputDevice* pOut = 0L);
+ virtual ~SdrGlueEditView();
+
+public:
+ // Durch den Parameter nThisEsc uebergibt man die Richtung, die man
+ // checken bzw. setzen/loeschen will.
+ // Moegliche Werte fuer nThisEsc sind z.Zt.
+ // SDRESC_LEFT, SDRESC_RIGHT, SDRESC_TOP und SDRESC_BOTTOM
+ TRISTATE IsMarkedGluePointsEscDir(sal_uInt16 nThisEsc) const;
+ void SetMarkedGluePointsEscDir(sal_uInt16 nThisEsc, sal_Bool bOn);
+ sal_Bool IsSetMarkedGluePointsEscDirPossible() const { return !IsReadOnly() && HasMarkedGluePoints(); }
+
+ // Checken/setzen, ob die Klebepunktpositionen relativ zur
+ // Objektgroesse sind (Percent=sal_True) oder nicht (Percent=sal_False)
+ TRISTATE IsMarkedGluePointsPercent() const;
+ void SetMarkedGluePointsPercent(sal_Bool bOn);
+ sal_Bool IsSetMarkedGluePointsPercentPossible() const { return !IsReadOnly() && HasMarkedGluePoints(); }
+
+ // bVert=FALSE: Horizontales Alignment checken/setzen
+ // SDRHORZALIGN_CENTER
+ // SDRHORZALIGN_LEFT
+ // SDRHORZALIGN_RIGHT
+ // SDRHORZALIGN_DONTCARE (nur bei Get())
+ // bVert=TRUE: Vertikales Alignment checken/setzen
+ // SDRVERTALIGN_CENTER
+ // SDRVERTALIGN_TOP
+ // SDRVERTALIGN_BOTTOM
+ // SDRVERTALIGN_DONTCARE (nur bei Get())
+ sal_uInt16 GetMarkedGluePointsAlign(sal_Bool bVert) const;
+ void SetMarkedGluePointsAlign(sal_Bool bVert, sal_uInt16 nAlign);
+ sal_Bool IsSetMarkedGluePointsAlignPossible() const { return !IsReadOnly() && HasMarkedGluePoints(); }
+
+ // Alle merkierten Klebepunkte entfernen
+ void DeleteMarkedGluePoints();
+ sal_Bool IsDeleteMarkedGluePointsPossible() const;
+
+ void MoveMarkedGluePoints (const Size& rSiz, bool bCopy=false);
+ void ResizeMarkedGluePoints(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy=false);
+ void RotateMarkedGluePoints(const Point& rRef, long nWink, bool bCopy=false);
+ void MirrorMarkedGluePoints(const Point& rRef1, const Point& rRef2, sal_Bool bCopy=sal_False);
+ void MirrorMarkedGluePointsHorizontal(sal_Bool bCopy=sal_False);
+ void MirrorMarkedGluePointsVertical(sal_Bool bCopy=sal_False);
+ void ShearMarkedGluePoints(const Point& rRef, long nWink, sal_Bool bVShear=sal_False, sal_Bool bCopy=sal_False);
+ void CrookMarkedGluePoints(const Point& rRef, const Point& rRad, SdrCrookMode eMode, sal_Bool bVertical=sal_False, sal_Bool bNoContortion=sal_False, sal_Bool bCopy=sal_False);
+ void DistortMarkedGluePoints(const Rectangle& rRef, const XPolygon& rDistortedRect, sal_Bool bNoContortion=sal_False, sal_Bool bCopy=sal_False);
+
+ void AlignMarkedGluePoints(SdrHorAlign eHor, SdrVertAlign eVert);
+};
+
+#endif //_SVDGLEV_HXX
+
diff --git a/svx/inc/svx/svdglob.hxx b/svx/inc/svx/svdglob.hxx
new file mode 100644
index 000000000000..1065860621db
--- /dev/null
+++ b/svx/inc/svx/svdglob.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDGLOB_HXX
+#define _SVDGLOB_HXX
+
+#include <tools/contnr.hxx>
+
+#include <tools/resid.hxx>
+#include <tools/string.hxx>
+
+#include <svx/svxdllapi.h>
+
+//************************************************************
+// Vorausdeklarationen
+//************************************************************
+
+class Link;
+class ResMgr;
+class SdrEngineDefaults;
+class ImpSdrStrCache;
+
+//************************************************************
+// Defines
+//************************************************************
+
+// Den zur App passenden Resourcemanager holen
+ResMgr* ImpGetResMgr();
+
+class SdrResId: ResId {
+public:
+ SdrResId(sal_uInt16 nId): ResId(nId,*ImpGetResMgr()) {}
+};
+
+// ResourceCache fuer haeuffig benoetigte Strings
+// gecachet werden globale String-Resourcen mit den
+// IDs von SDR_StringCacheBegin (256) bis
+// SDR_StringCacheEnd (weiss ich grad' nicht).
+// Hierzu siehe auch SvdStr.Hrc
+SVX_DLLPUBLIC String ImpGetResStr(sal_uInt16 nResID);
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDGLOB_HXX
+
diff --git a/svx/inc/svx/svdglue.hxx b/svx/inc/svx/svdglue.hxx
new file mode 100644
index 000000000000..334b79229aa0
--- /dev/null
+++ b/svx/inc/svx/svdglue.hxx
@@ -0,0 +1,151 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDGLUE_HXX
+#define _SVDGLUE_HXX
+
+class Window;
+class OutputDevice;
+class SvStream;
+class SdrObject;
+
+#include <tools/contnr.hxx>
+#include <tools/gen.hxx>
+#include "svx/svxdllapi.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#define SDRESC_SMART 0x0000
+#define SDRESC_LEFT 0x0001
+#define SDRESC_RIGHT 0x0002
+#define SDRESC_TOP 0x0004
+#define SDRESC_BOTTOM 0x0008
+#define SDRESC_LO 0x0010 /* ni */
+#define SDRESC_LU 0x0020 /* ni */
+#define SDRESC_RO 0x0040 /* ni */
+#define SDRESC_RU 0x0080 /* ni */
+#define SDRESC_HORZ (SDRESC_LEFT|SDRESC_RIGHT)
+#define SDRESC_VERT (SDRESC_TOP|SDRESC_BOTTOM)
+#define SDRESC_ALL 0x00FF
+
+#define SDRHORZALIGN_CENTER 0x0000
+#define SDRHORZALIGN_LEFT 0x0001
+#define SDRHORZALIGN_RIGHT 0x0002
+#define SDRHORZALIGN_DONTCARE 0x0010
+#define SDRVERTALIGN_CENTER 0x0000
+#define SDRVERTALIGN_TOP 0x0100
+#define SDRVERTALIGN_BOTTOM 0x0200
+#define SDRVERTALIGN_DONTCARE 0x1000
+
+class SVX_DLLPUBLIC SdrGluePoint {
+ // Bezugspunkt ist SdrObject::GetSnapRect().Center()
+ // bNoPercent=FALSE: Position ist -5000..5000 (1/100)% bzw. 0..10000 (je nach Align)
+ // bNoPercent=sal_True : Position ist in log Einh, rel zum Bezugspunkt
+ Point aPos;
+ sal_uInt16 nEscDir;
+ sal_uInt16 nId;
+ sal_uInt16 nAlign;
+ FASTBOOL bNoPercent:1;
+ FASTBOOL bReallyAbsolute:1; // Temporaer zu setzen fuer Transformationen am Bezugsobjekt
+ FASTBOOL bUserDefined:1; // #i38892#
+public:
+ SdrGluePoint(): nEscDir(SDRESC_SMART),nId(0),nAlign(0) { bNoPercent=sal_False; bReallyAbsolute=sal_False; bUserDefined=sal_True; }
+ SdrGluePoint(const Point& rNewPos, FASTBOOL bNewPercent=sal_True, sal_uInt16 nNewAlign=0): aPos(rNewPos),nEscDir(SDRESC_SMART),nId(0),nAlign(nNewAlign) { bNoPercent=!bNewPercent; bReallyAbsolute=sal_False; bUserDefined=sal_True; }
+ bool operator==(const SdrGluePoint& rCmpGP) const { return aPos==rCmpGP.aPos && nEscDir==rCmpGP.nEscDir && nId==rCmpGP.nId && nAlign==rCmpGP.nAlign && bNoPercent==rCmpGP.bNoPercent && bReallyAbsolute==rCmpGP.bReallyAbsolute && bUserDefined==rCmpGP.bUserDefined; }
+ bool operator!=(const SdrGluePoint& rCmpGP) const { return !operator==(rCmpGP); }
+ const Point& GetPos() const { return aPos; }
+ void SetPos(const Point& rNewPos) { aPos=rNewPos; }
+ sal_uInt16 GetEscDir() const { return nEscDir; }
+ void SetEscDir(sal_uInt16 nNewEsc) { nEscDir=nNewEsc; }
+ sal_uInt16 GetId() const { return nId; }
+ void SetId(sal_uInt16 nNewId) { nId=nNewId; }
+ bool IsPercent() const { return !bNoPercent; }
+ void SetPercent(FASTBOOL bOn) { bNoPercent=!bOn; }
+ // Temporaer zu setzen fuer Transformationen am Bezugsobjekt
+ FASTBOOL IsReallyAbsolute() const { return bReallyAbsolute; }
+ void SetReallyAbsolute(FASTBOOL bOn, const SdrObject& rObj);
+
+ // #i38892#
+ FASTBOOL IsUserDefined() const { return bUserDefined; }
+ void SetUserDefined(FASTBOOL bNew) { bUserDefined = bNew; }
+
+ sal_uInt16 GetAlign() const { return nAlign; }
+ void SetAlign(sal_uInt16 nAlg) { nAlign=nAlg; }
+ sal_uInt16 GetHorzAlign() const { return nAlign&0x00FF; }
+ void SetHorzAlign(sal_uInt16 nAlg) { nAlign=(nAlign&0xFF00)|(nAlg&0x00FF); }
+ sal_uInt16 GetVertAlign() const { return nAlign&0xFF00; }
+ void SetVertAlign(sal_uInt16 nAlg) { nAlign=(nAlign&0x00FF)|(nAlg&0xFF00); }
+ void Draw(OutputDevice& rOut, const SdrObject* pObj) const;
+ FASTBOOL IsHit(const Point& rPnt, const OutputDevice& rOut, const SdrObject* pObj) const;
+ void Invalidate(Window& rWin, const SdrObject* pObj) const;
+ Point GetAbsolutePos(const SdrObject& rObj) const;
+ void SetAbsolutePos(const Point& rNewPos, const SdrObject& rObj);
+ long GetAlignAngle() const;
+ void SetAlignAngle(long nWink);
+ long EscDirToAngle(sal_uInt16 nEsc) const;
+ sal_uInt16 EscAngleToDir(long nWink) const;
+ void Rotate(const Point& rRef, long nWink, double sn, double cs, const SdrObject* pObj);
+ void Mirror(const Point& rRef1, const Point& rRef2, const SdrObject* pObj);
+ void Mirror(const Point& rRef1, const Point& rRef2, long nWink, const SdrObject* pObj);
+ void Shear (const Point& rRef, long nWink, double tn, FASTBOOL bVShear, const SdrObject* pObj);
+};
+
+#define SDRGLUEPOINT_NOTFOUND 0xFFFF
+
+class SVX_DLLPUBLIC SdrGluePointList {
+ Container aList;
+protected:
+ SdrGluePoint* GetObject(sal_uInt16 i) const { return (SdrGluePoint*)(aList.GetObject(i)); }
+public:
+ SdrGluePointList(): aList(1024,4,4) {}
+ SdrGluePointList(const SdrGluePointList& rSrcList): aList(1024,4,4) { *this=rSrcList; }
+ ~SdrGluePointList() { Clear(); }
+ void Clear();
+ void operator=(const SdrGluePointList& rSrcList);
+ sal_uInt16 GetCount() const { return sal_uInt16(aList.Count()); }
+ // Beim Insert wird dem Objekt (also dem GluePoint) automatisch eine Id zugewiesen.
+ // ReturnCode ist der Index des neuen GluePoints in der Liste
+ sal_uInt16 Insert(const SdrGluePoint& rGP);
+ void Delete(sal_uInt16 nPos) { delete (SdrGluePoint*)aList.Remove(nPos); }
+ SdrGluePoint& operator[](sal_uInt16 nPos) { return *GetObject(nPos); }
+ const SdrGluePoint& operator[](sal_uInt16 nPos) const { return *GetObject(nPos); }
+ sal_uInt16 FindGluePoint(sal_uInt16 nId) const;
+ sal_uInt16 HitTest(const Point& rPnt, const OutputDevice& rOut, const SdrObject* pObj, FASTBOOL bBack=sal_False, FASTBOOL bNext=sal_False, sal_uInt16 nId0=0) const;
+ void Invalidate(Window& rWin, const SdrObject* pObj) const;
+ // Temporaer zu setzen fuer Transformationen am Bezugsobjekt
+ void SetReallyAbsolute(FASTBOOL bOn, const SdrObject& rObj);
+ void Rotate(const Point& rRef, long nWink, double sn, double cs, const SdrObject* pObj);
+ void Mirror(const Point& rRef1, const Point& rRef2, const SdrObject* pObj);
+ void Mirror(const Point& rRef1, const Point& rRef2, long nWink, const SdrObject* pObj);
+ void Shear (const Point& rRef, long nWink, double tn, FASTBOOL bVShear, const SdrObject* pObj);
+};
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDGLUE_HXX
+
diff --git a/svx/inc/svx/svdhdl.hxx b/svx/inc/svx/svdhdl.hxx
new file mode 100644
index 000000000000..92a7071551a4
--- /dev/null
+++ b/svx/inc/svx/svdhdl.hxx
@@ -0,0 +1,534 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDHDL_HXX
+#define _SVDHDL_HXX
+
+#include <tools/gen.hxx>
+
+#ifndef _POINTR_HXX //autogen
+#include <vcl/pointr.hxx>
+#endif
+#include <tools/contnr.hxx>
+
+#ifndef _SOLAR_HRC
+#include <svl/solar.hrc>
+#endif
+
+#include <svx/xpoly.hxx>
+#include <svx/svdoedge.hxx>
+#include <svx/sdr/overlay/overlayobjectlist.hxx>
+#include "svx/svxdllapi.h"
+
+#include <svx/xpoly.hxx>
+#include <svx/svdoedge.hxx>
+
+class VirtualDevice;
+class OutputDevice;
+class Region;
+class Window;
+class SdrHdlList;
+class SdrMarkView;
+class SdrObject;
+class SdrPageView;
+class MouseEvent;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+// Jedes Objekt muss in der Lage seine Handles zu erzeugen. Diese werden dann
+// bei einer Selektion abgeholt, bei der View angemeldet und sichtbar gemacht.
+// Wird ein Handle von der Maus beruehrt (IsHit()), so wird von der View der
+// entsprechende Mauszeiger vom Handle abgeholt und der App auf Anfrage zum
+// reinschalten uebergeben.
+// Handles wie z.B. der Rotationsmittelpunkt oder die Spiegelachse werden von
+// der View generiert, wenn vom Controller der entsprechende Transformations-
+// Modus selektiert wird.
+// HDL_MOVE...HDL_LWRGT muessen im enum immer zusammen stehen bleiben!
+
+enum SdrHdlKind
+{
+ HDL_MOVE, // Handle zum Verschieben des Objekts
+ HDL_UPLFT, // Oben links
+ HDL_UPPER, // Oben
+ HDL_UPRGT, // Oben rechts
+ HDL_LEFT, // Links
+ HDL_RIGHT, // Rechts
+ HDL_LWLFT, // Unten links
+ HDL_LOWER, // Unten
+ HDL_LWRGT, // Unten rechts
+ HDL_POLY, // Punktselektion an Polygon oder Bezierkurve
+ HDL_BWGT, // Gewicht an einer Bezierkurve
+ HDL_CIRC, // Winkel an Kreissegmenten, Eckenradius am Rect
+ HDL_REF1, // Referenzpunkt 1, z.B. Rotationsmitte
+ HDL_REF2, // Referenzpunkt 2, z.B. Endpunkt der Spiegelachse
+ HDL_MIRX, // Die Spiegelachse selbst
+ HDL_GLUE, // GluePoint
+ HDL_ANCHOR, // anchor symbol (SD, SW)
+ HDL_TRNS, // interactive transparence
+ HDL_GRAD, // interactive gradient
+ HDL_COLR, // interactive color
+ HDL_USER,
+ HDL_ANCHOR_TR, // #101688# Anchor handle with (0,0) at top right for SW
+
+ // for SJ and the CustomShapeHandles:
+ HDL_CUSTOMSHAPE1,
+
+ HDL_SMARTTAG
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+enum BitmapColorIndex
+{
+ LightGreen,
+ Cyan,
+ LightCyan,
+ Red,
+ LightRed,
+ Yellow
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+enum BitmapMarkerKind
+{
+ Rect_7x7,
+ Rect_9x9,
+ Rect_11x11,
+ Rect_13x13,
+ Circ_7x7,
+ Circ_9x9,
+ Circ_11x11,
+ Elli_7x9,
+ Elli_9x11,
+ Elli_9x7,
+ Elli_11x9,
+ RectPlus_7x7,
+ RectPlus_9x9,
+ RectPlus_11x11,
+ Crosshair,
+ Glue,
+ Anchor,
+
+ // #98388# add AnchorPressed to be able to aninate anchor control, too.
+ AnchorPressed,
+
+ // #101688# AnchorTR for SW
+ AnchorTR,
+ AnchorPressedTR,
+
+ // for SJ and the CustomShapeHandles:
+ Customshape1
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class SVX_DLLPUBLIC SdrHdl
+{
+ friend class SdrMarkView; // fuer den Zugriff auf nObjHdlNum
+ friend class SdrHdlList;
+
+ // #101928#
+ BitmapEx ImpGetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd, sal_Bool bFine, sal_Bool bIsHighContrast);
+
+protected:
+ SdrObject* pObj; // Gehoert das Handle zu einem Objekt?
+ SdrPageView* pPV; // Gehoert das Handle zu einem Objekt in einer bestimmten PageView?
+ SdrHdlList* pHdlList; // Zum Feststelen der Handlegroesse
+
+ // OVERLAYMANAGER
+ ::sdr::overlay::OverlayObjectList maOverlayGroup;
+
+ Point aPos;
+
+ SdrHdlKind eKind;
+
+ long nDrehWink; // Handles bzw. Mauszeiger drehen
+ sal_uInt32 nObjHdlNum; // wird von der MarkView benoetigt
+ sal_uInt32 nPolyNum; // Polygonpunktes
+ sal_uInt32 nPPntNum; // Punktnummer des Polygons
+ sal_uInt32 nSourceHdlNum; // ist noch vollstaendig zu implementieren
+
+ unsigned bSelect : 1; // Ein selektierter Polygonpunkt?
+ unsigned b1PixMore : 1; // True=Handle wird 1 Pixel groesser dargestellt
+ unsigned bPlusHdl : 1; // u.a. fuer Hld-Paint Optimierung bei MarkPoint/UnmarkPoint, ...
+
+ bool mbMoveOutside; // forces this handle to be moved outside of the selection rectangle
+
+ // create marker for this kind
+ virtual void CreateB2dIAObject();
+
+ // cleanup marker if one exists
+ void GetRidOfIAObject();
+
+private:
+ bool mbMouseOver; // is true if the mouse is over this handle
+
+protected:
+ ::sdr::overlay::OverlayObject* CreateOverlayObject(
+ const basegfx::B2DPoint& rPos,
+ BitmapColorIndex eColIndex, BitmapMarkerKind eKindOfMarker, Point aMoveOutsideOffset = Point());
+ BitmapMarkerKind GetNextBigger(BitmapMarkerKind eKnd) const;
+
+public:
+ SdrHdl();
+ SdrHdl(const Point& rPnt, SdrHdlKind eNewKind=HDL_MOVE);
+ virtual ~SdrHdl();
+
+ const ::sdr::overlay::OverlayObjectList& getOverlayObjectList() const { return maOverlayGroup; }
+
+ void SetHdlList(SdrHdlList* pList);
+ SdrHdlKind GetKind() const { return eKind; }
+ void Touch();
+
+ const Point& GetPos() const { return aPos; }
+ void SetPos(const Point& rPnt);
+
+ SdrPageView* GetPageView() const { return pPV; }
+ void SetPageView(SdrPageView* pNewPV) { pPV=pNewPV; }
+
+ SdrObject* GetObj() const { return pObj; }
+ void SetObj(SdrObject* pNewObj);
+
+ sal_Bool IsSelected() const { return bSelect; }
+ void SetSelected(sal_Bool bJa=sal_True);
+
+ void Set1PixMore(sal_Bool bJa=sal_True);
+ void SetDrehWink(long n);
+
+ sal_Bool IsCornerHdl() const { return eKind==HDL_UPLFT || eKind==HDL_UPRGT || eKind==HDL_LWLFT || eKind==HDL_LWRGT; }
+ sal_Bool IsVertexHdl() const { return eKind==HDL_UPPER || eKind==HDL_LOWER || eKind==HDL_LEFT || eKind==HDL_RIGHT; }
+
+ void SetObjHdlNum(sal_uInt32 nNum) { nObjHdlNum=nNum; }
+ sal_uInt32 GetObjHdlNum() const { return nObjHdlNum; }
+
+ void SetPolyNum(sal_uInt32 nNum) { nPolyNum=nNum; }
+ sal_uInt32 GetPolyNum() const { return nPolyNum; }
+
+ void SetPointNum(sal_uInt32 nNum) { nPPntNum=nNum; }
+ sal_uInt32 GetPointNum() const { return nPPntNum; }
+
+ void SetPlusHdl(sal_Bool bOn) { bPlusHdl=bOn; }
+ sal_Bool IsPlusHdl() const { return bPlusHdl; }
+
+ void SetSourceHdlNum(sal_uInt32 nNum) { nSourceHdlNum=nNum; }
+ sal_uInt32 GetSourceHdlNum() const { return nSourceHdlNum; }
+
+ virtual Pointer GetPointer() const;
+ bool IsHdlHit(const Point& rPnt) const;
+
+ // #97016# II
+ virtual sal_Bool IsFocusHdl() const;
+
+ void SetMoveOutside( bool bMoveOutside );
+
+ /** is called when the mouse enters the area of this handle. If the handle changes his
+ visualisation during mouse over it must override this method and call Touch(). */
+ virtual void onMouseEnter(const MouseEvent& rMEvt);
+
+ /** is called when the mouse leaves the area of this handle. If the handle changes his
+ visualisation during mouse over it must override this method and call Touch(). */
+ virtual void onMouseLeave();
+
+ bool isMouseOver() const;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#define SDR_HANDLE_COLOR_SIZE_NORMAL Size(13, 13)
+#define SDR_HANDLE_COLOR_SIZE_SELECTED Size(17, 17)
+
+class SVX_DLLPUBLIC SdrHdlColor : public SdrHdl
+{
+private:
+ // size of colr markers
+ Size aMarkerSize;
+
+ // color
+ Color aMarkerColor;
+
+ // callback link when value changed
+ Link aColorChangeHdl;
+
+ // use luminance values only
+ unsigned bUseLuminance : 1;
+
+ // create marker for this kind
+ SVX_DLLPRIVATE virtual void CreateB2dIAObject();
+
+ // help functions
+ SVX_DLLPRIVATE Bitmap CreateColorDropper(Color aCol);
+ SVX_DLLPRIVATE Color GetLuminance(const Color& rCol);
+ SVX_DLLPRIVATE void CallColorChangeLink();
+
+public:
+ SdrHdlColor(const Point& rRef, Color aCol = Color(COL_BLACK), const Size& rSize = Size(11, 11), sal_Bool bLum = sal_False);
+ virtual ~SdrHdlColor();
+
+ sal_Bool IsUseLuminance() const { return bUseLuminance; }
+
+ Color GetColor() const { return aMarkerColor; }
+ void SetColor(Color aNew, sal_Bool bCallLink = sal_False);
+
+ const Size& GetSize() const { return aMarkerSize; }
+ void SetSize(const Size& rNew);
+
+ void SetColorChangeHdl(const Link& rLink) { aColorChangeHdl = rLink; }
+ const Link& GetColorChangeHdl() const { return aColorChangeHdl; }
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class SdrHdlGradient : public SdrHdl
+{
+private:
+ // pointer to used color handles
+ SdrHdlColor* pColHdl1;
+ SdrHdlColor* pColHdl2;
+
+ // 2nd position
+ Point a2ndPos;
+
+ // is this a gradient or a transparence
+ unsigned bGradient : 1;
+
+ // select which handle to move
+ unsigned bMoveSingleHandle : 1;
+ unsigned bMoveFirstHandle : 1;
+
+ // create marker for this kind
+ virtual void CreateB2dIAObject();
+
+public:
+ SdrHdlGradient(const Point& rRef1, const Point& rRef2, sal_Bool bGrad = sal_True);
+ virtual ~SdrHdlGradient();
+
+ sal_Bool IsGradient() const { return bGradient; }
+
+ // set the associated color handles
+ void SetColorHandles(SdrHdlColor* pL1, SdrHdlColor* pL2) { pColHdl1 = pL1; pColHdl2 = pL2; }
+ SdrHdlColor* GetColorHdl1() const { return pColHdl1; }
+ SdrHdlColor* GetColorHdl2() const { return pColHdl2; }
+
+ const Point& Get2ndPos() const { return a2ndPos; }
+ void Set2ndPos(const Point& rPnt);
+
+ // the link called by the color handles
+ DECL_LINK(ColorChangeHdl, SdrHdl*);
+
+ // transformation call, create gradient from this handle
+ void FromIAOToItem(SdrObject* pObj, sal_Bool bSetItemOnObject, sal_Bool bUndo);
+
+ // selection flags for interaction
+ sal_Bool IsMoveSingleHandle() const { return bMoveSingleHandle; }
+ void SetMoveSingleHandle(sal_Bool bNew) { bMoveSingleHandle = bNew; }
+ sal_Bool IsMoveFirstHandle() const { return bMoveFirstHandle; }
+ void SetMoveFirstHandle(sal_Bool bNew) { bMoveFirstHandle = bNew; }
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+// Spiegelachse
+class SdrHdlLine: public SdrHdl
+{
+ // create marker for this kind
+ virtual void CreateB2dIAObject();
+
+protected:
+ SdrHdl* pHdl1;
+ SdrHdl* pHdl2;
+
+public:
+ SdrHdlLine(SdrHdl& rHdl1, SdrHdl& rHdl2, SdrHdlKind eNewKind=HDL_MIRX) { eKind=eNewKind; pHdl1=&rHdl1; pHdl2=&rHdl2; }
+ virtual ~SdrHdlLine();
+
+ virtual Pointer GetPointer() const;
+};
+
+// Ein SdrHdlBezWgt hat Kenntnis von seinem "BasisHandle". Seine Draw-Methode
+// zeichnet zusaetzlich eine Linie von seiner Position zur Position dieses
+// BasisHandles.
+class SdrHdlBezWgt: public SdrHdl
+{
+ // create marker for this kind
+ virtual void CreateB2dIAObject();
+
+protected:
+ const SdrHdl* pHdl1;
+
+public:
+ // das ist kein Copy-Ctor!!!
+ SdrHdlBezWgt(const SdrHdl* pRefHdl1, SdrHdlKind eNewKind=HDL_BWGT) { eKind=eNewKind; pHdl1=pRefHdl1; }
+ virtual ~SdrHdlBezWgt();
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class E3dVolumeMarker : public SdrHdl
+{
+ basegfx::B2DPolyPolygon aWireframePoly;
+
+ // create marker for this kind
+ virtual void CreateB2dIAObject();
+
+public:
+ E3dVolumeMarker(const basegfx::B2DPolyPolygon& rWireframePoly);
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class ImpEdgeHdl: public SdrHdl
+{
+ SdrEdgeLineCode eLineCode;
+
+ // create marker for this kind
+ virtual void CreateB2dIAObject();
+
+public:
+ ImpEdgeHdl(const Point& rPnt, SdrHdlKind eNewKind): SdrHdl(rPnt,eNewKind),eLineCode(MIDDLELINE) {}
+ virtual ~ImpEdgeHdl();
+
+ void SetLineCode(SdrEdgeLineCode eCode);
+ SdrEdgeLineCode GetLineCode() const { return eLineCode; }
+ sal_Bool IsHorzDrag() const;
+ virtual Pointer GetPointer() const;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class ImpMeasureHdl: public SdrHdl
+{
+ // create marker for this kind
+ virtual void CreateB2dIAObject();
+
+public:
+ ImpMeasureHdl(const Point& rPnt, SdrHdlKind eNewKind): SdrHdl(rPnt,eNewKind) {}
+ virtual ~ImpMeasureHdl();
+
+ virtual Pointer GetPointer() const;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class ImpTextframeHdl: public SdrHdl
+{
+ const Rectangle maRect;
+
+ // create marker for this kind
+ virtual void CreateB2dIAObject();
+
+public:
+ explicit ImpTextframeHdl(const Rectangle& rRect);
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+// #97016# II
+class ImplHdlListData;
+
+class SVX_DLLPUBLIC SdrHdlList
+{
+protected:
+ sal_uIntPtr mnFocusIndex;
+ SdrMarkView* pView;
+ Container aList;
+ sal_uInt16 nHdlSize;
+
+ unsigned bRotateShear : 1;
+ unsigned bDistortShear : 1;
+ unsigned bMoveOutside : 1; // Handles nach aussen ruecken (fuer TextEdit)
+ unsigned bFineHandles : 1;
+
+private:
+ SVX_DLLPRIVATE SdrHdlList(const SdrHdlList&): aList(1024,64,64) {}
+ SVX_DLLPRIVATE void operator=(const SdrHdlList&) {}
+ SVX_DLLPRIVATE sal_Bool operator==(const SdrHdlList&) const { return sal_False; }
+ SVX_DLLPRIVATE sal_Bool operator!=(const SdrHdlList&) const { return sal_False; }
+
+public:
+ SdrHdlList(SdrMarkView* pV);
+ ~SdrHdlList();
+ void Clear();
+
+ // #97016# II
+ void TravelFocusHdl(sal_Bool bForward);
+ SdrHdl* GetFocusHdl() const;
+ void SetFocusHdl(SdrHdl* pNew);
+ void ResetFocusHdl();
+
+ // Access to View
+ SdrMarkView* GetView() const;
+
+ // Sortierung: 1.Level Erst Refpunkt-Handles, dann normale Handles, dann Glue, dann User, dann Plushandles
+ // 2.Level PageView (Pointer)
+ // 3.Level Position (x+y)
+ void Sort();
+ sal_uIntPtr GetHdlCount() const { return aList.Count(); }
+ SdrHdl* GetHdl(sal_uIntPtr nNum) const { return (SdrHdl*)(aList.GetObject(nNum)); }
+ sal_uIntPtr GetHdlNum(const SdrHdl* pHdl) const;
+ void SetHdlSize(sal_uInt16 nSiz);
+ sal_uInt16 GetHdlSize() const { return nHdlSize; }
+ void SetMoveOutside(sal_Bool bOn);
+ sal_Bool IsMoveOutside() const { return bMoveOutside; }
+ void SetRotateShear(sal_Bool bOn);
+ sal_Bool IsRotateShear() const { return bRotateShear; }
+ void SetDistortShear(sal_Bool bOn);
+ sal_Bool IsDistortShear() const { return bDistortShear; }
+ void SetFineHdl(sal_Bool bOn);
+ sal_Bool IsFineHdl() const { return bFineHandles; }
+
+ // AddHdl uebernimmt das Handle in sein Eigentum. Es muss
+ // also auf dem Heap stehen, da Clear() ein delete macht.
+ void AddHdl(SdrHdl* pHdl, sal_Bool bAtBegin=sal_False);
+ SdrHdl* RemoveHdl(sal_uIntPtr nNum);
+
+ // Zuletzt eingefuegte Handles werden am ehesten getroffen
+ // (wenn Handles uebereinander liegen).
+ SdrHdl* IsHdlListHit(const Point& rPnt, sal_Bool bBack=sal_False, sal_Bool bNext=sal_False, SdrHdl* pHdl0=NULL) const;
+ SdrHdl* GetHdl(SdrHdlKind eKind1) const;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class SVX_DLLPUBLIC SdrCropHdl : public SdrHdl
+{
+public:
+ SdrCropHdl(const Point& rPnt, SdrHdlKind eNewKind);
+
+protected:
+ // create marker for this kind
+ virtual void CreateB2dIAObject();
+
+ BitmapEx GetBitmapForHandle( const BitmapEx& rBitmap, int nSize );
+
+ static BitmapEx GetHandlesBitmap( bool bIsFineHdl, bool bIsHighContrast );
+};
+
+#endif //_SVDHDL_HXX
+
diff --git a/svx/inc/svx/svdhlpln.hxx b/svx/inc/svx/svdhlpln.hxx
new file mode 100644
index 000000000000..a41d69a38eff
--- /dev/null
+++ b/svx/inc/svx/svdhlpln.hxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDHLPLN_HXX
+#define _SVDHLPLN_HXX
+
+#include <sal/types.h>
+#include <tools/color.hxx>
+#include <tools/gen.hxx>
+
+#ifndef _POINTR_HXX //autogen
+#include <vcl/pointr.hxx>
+#endif
+#include <tools/contnr.hxx>
+#include "svx/svxdllapi.h"
+
+class OutputDevice;
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+enum SdrHelpLineKind {SDRHELPLINE_POINT,SDRHELPLINE_VERTICAL,SDRHELPLINE_HORIZONTAL};
+#define SDRHELPLINE_MIN SDRHELPLINE_POINT
+#define SDRHELPLINE_MAX SDRHELPLINE_HORIZONTAL
+
+#define SDRHELPLINE_POINT_PIXELSIZE 15 /* Tatsaechliche Groesse= PIXELSIZE*2+1 */
+
+class SdrHelpLine {
+ Point aPos; // je nach Wert von eKind ist X oder Y evtl. belanglos
+ SdrHelpLineKind eKind;
+
+ // #i27493#
+ // Helper method to draw a hor or ver two-colored dashed line
+ void ImpDrawDashedTwoColorLine(OutputDevice& rOut, sal_Int32 nStart, sal_Int32 nEnd, sal_Int32 nFixPos,
+ sal_Int32 nStepWidth, Color aColA, Color aColB, sal_Bool bHorizontal) const;
+
+public:
+ SdrHelpLine(SdrHelpLineKind eNewKind=SDRHELPLINE_POINT): eKind(eNewKind) {}
+ SdrHelpLine(SdrHelpLineKind eNewKind, const Point& rNewPos): aPos(rNewPos), eKind(eNewKind) {}
+ bool operator==(const SdrHelpLine& rCmp) const { return aPos==rCmp.aPos && eKind==rCmp.eKind; }
+ bool operator!=(const SdrHelpLine& rCmp) const { return !operator==(rCmp); }
+
+ void SetKind(SdrHelpLineKind eNewKind) { eKind=eNewKind; }
+ SdrHelpLineKind GetKind() const { return eKind; }
+ void SetPos(const Point& rPnt) { aPos=rPnt; }
+ const Point& GetPos() const { return aPos; }
+
+ Pointer GetPointer() const;
+ FASTBOOL IsHit(const Point& rPnt, sal_uInt16 nTolLog, const OutputDevice& rOut) const;
+ // OutputDevice wird benoetigt, da Fangpunkte eine feste Pixelgroesse haben
+ Rectangle GetBoundRect(const OutputDevice& rOut) const;
+
+ /* returns true if this and the given help line would be rendered at the same pixel position
+ of the given OutputDevice. This can be used to avoid drawing multiple help lines with xor
+ on same position which could render them invisible */
+ bool IsVisibleEqual( const SdrHelpLine& rHelpLine, const OutputDevice& rOut ) const;
+};
+
+#define SDRHELPLINE_NOTFOUND 0xFFFF
+
+class SVX_DLLPUBLIC SdrHelpLineList {
+ Container aList;
+protected:
+ SdrHelpLine* GetObject(sal_uInt16 i) const { return (SdrHelpLine*)(aList.GetObject(i)); }
+public:
+ SdrHelpLineList(): aList(1024,4,4) {}
+ SdrHelpLineList(const SdrHelpLineList& rSrcList): aList(1024,4,4) { *this=rSrcList; }
+ ~SdrHelpLineList() { Clear(); }
+ void Clear();
+ void operator=(const SdrHelpLineList& rSrcList);
+ bool operator==(const SdrHelpLineList& rCmp) const;
+ bool operator!=(const SdrHelpLineList& rCmp) const { return !operator==(rCmp); }
+ sal_uInt16 GetCount() const { return sal_uInt16(aList.Count()); }
+ void Insert(const SdrHelpLine& rHL, sal_uInt16 nPos=0xFFFF) { aList.Insert(new SdrHelpLine(rHL),nPos); }
+ void Delete(sal_uInt16 nPos) { delete (SdrHelpLine*)aList.Remove(nPos); } // #i24900#
+ void Move(sal_uInt16 nPos, sal_uInt16 nNewPos) { aList.Insert(aList.Remove(nPos),nNewPos); }
+ SdrHelpLine& operator[](sal_uInt16 nPos) { return *GetObject(nPos); }
+ const SdrHelpLine& operator[](sal_uInt16 nPos) const { return *GetObject(nPos); }
+ sal_uInt16 HitTest(const Point& rPnt, sal_uInt16 nTolLog, const OutputDevice& rOut) const;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDHLPLN_HXX
+
diff --git a/svx/inc/svx/svditer.hxx b/svx/inc/svx/svditer.hxx
new file mode 100644
index 000000000000..2c7b9cb4c9f8
--- /dev/null
+++ b/svx/inc/svx/svditer.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDITER_HXX
+#define _SVDITER_HXX
+
+#include <sal/types.h>
+#include <tools/list.hxx>
+#include "svx/svxdllapi.h"
+
+class SdrObjList;
+class SdrObject;
+class SdrMarkList;
+
+// SdrObjListIter methods:
+// IM_FLAT : Flach ueber die Liste
+// IM_DEEPWITHGROUPS : Mit rekursivem Abstieg, Next() liefert auch Gruppenobjekte
+// IM_DEEPNOGROUPS : Mit rekursivem Abstieg, Next() liefert keine Gruppenobjekte
+enum SdrIterMode { IM_FLAT, IM_DEEPWITHGROUPS, IM_DEEPNOGROUPS};
+
+class SVX_DLLPUBLIC SdrObjListIter
+{
+ List maObjList;
+ sal_uInt32 mnIndex;
+ sal_Bool mbReverse;
+
+ void ImpProcessObjectList(const SdrObjList& rObjList, SdrIterMode eMode, sal_Bool bUseZOrder);
+ void ImpProcessMarkList(const SdrMarkList& rMarkList, SdrIterMode eMode);
+ void ImpProcessObj(SdrObject* pObj, SdrIterMode eMode, sal_Bool bUseZOrder);
+
+public:
+ SdrObjListIter(const SdrObjList& rObjList, SdrIterMode eMode = IM_DEEPNOGROUPS, sal_Bool bReverse = sal_False);
+ /** This variant lets the user choose the order in which to travel over
+ the objects.
+ @param bUseZOrder
+ When <TRUE/> then the z-order defines the order of iteration.
+ Otherwise the navigation position as returned by
+ SdrObject::GetNavigationPosition() is used.
+ */
+ SdrObjListIter(const SdrObjList& rObjList, sal_Bool bUseZOrder, SdrIterMode eMode = IM_DEEPNOGROUPS, sal_Bool bReverse = sal_False);
+
+ /* SJ: the following function can now be used with every
+ SdrObject and is no longer limited to group objects */
+ SdrObjListIter(const SdrObject& rObj, SdrIterMode eMode = IM_DEEPNOGROUPS, sal_Bool bReverse = sal_False);
+
+ /** Iterates over a list of marked objects received from the SdrMarkView. */
+ SdrObjListIter(const SdrMarkList& rMarkList, SdrIterMode eMode = IM_DEEPNOGROUPS, sal_Bool bReverse = sal_False);
+
+ void Reset() { mnIndex = (mbReverse ? maObjList.Count() : 0L); }
+ sal_Bool IsMore() const { return (mbReverse ? mnIndex != 0 : ( mnIndex < maObjList.Count())); }
+ SdrObject* Next() { return (SdrObject*)maObjList.GetObject(mbReverse ? --mnIndex : mnIndex++); }
+
+ sal_uInt32 Count() { return maObjList.Count(); }
+};
+
+#endif //_SVDITER_HXX
+
diff --git a/svx/inc/svx/svditext.hxx b/svx/inc/svx/svditext.hxx
new file mode 100644
index 000000000000..b181b4046f9e
--- /dev/null
+++ b/svx/inc/svx/svditext.hxx
@@ -0,0 +1,37 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDITEXT_HXX
+#define _SVDITEXT_HXX
+
+// SvxItem-Mapping. Wird benoetigt um die SvxItem-Header erfolgreich zu includen
+
+#include <editeng/editdata.hxx>
+
+
+#endif // _SVDITEXT_HXX
+
diff --git a/svx/inc/svx/svdlayer.hxx b/svx/inc/svx/svdlayer.hxx
new file mode 100644
index 000000000000..b38ada9733d7
--- /dev/null
+++ b/svx/inc/svx/svdlayer.hxx
@@ -0,0 +1,160 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDLAYER_HXX
+#define _SVDLAYER_HXX
+
+#include <tools/string.hxx>
+#include <tools/stream.hxx>
+#include <svx/svdsob.hxx>
+#include <svx/svdtypes.hxx> // fuer typedef SdrLayerID
+#include "svx/svxdllapi.h"
+
+class SdrModel;
+
+class SVX_DLLPUBLIC SdrLayer
+{
+friend class SdrLayerAdmin;
+protected:
+ String aName;
+ String maTitle;
+ String maDescription;
+ SdrModel* pModel; // zum Broadcasten
+ sal_uInt16 nType; // 0=Userdefined,1=Standardlayer
+ SdrLayerID nID;
+protected:
+ SdrLayer(SdrLayerID nNewID, const String& rNewName) { nID=nNewID; aName=rNewName; nType=0; pModel=NULL; }
+ void SetID(SdrLayerID nNewID) { nID=nNewID; }
+public:
+ SdrLayer(): pModel(NULL),nType(0),nID(0) {}
+ bool operator==(const SdrLayer& rCmpLayer) const;
+ bool operator!=(const SdrLayer& rCmpLayer) const { return !operator==(rCmpLayer); }
+
+ void SetName(const String& rNewName);
+ const String& GetName() const { return aName; }
+
+ void SetTitle(const String& rTitle) { maTitle = rTitle; }
+ const String& GetTitle() const { return maTitle; }
+
+ void SetDescription(const String& rDesc) { maDescription = rDesc; }
+ const String& GetDescription() const { return maDescription; }
+
+ SdrLayerID GetID() const { return nID; }
+ void SetModel(SdrModel* pNewModel) { pModel=pNewModel; }
+ SdrModel* GetModel() const { return pModel; }
+ // Einem SdrLayer kann man sagen dass er ein (der) Standardlayer sein soll.
+ // Es wird dann laenderspeziefisch der passende Name gesetzt. SetName()
+ // setzt das Flag "StandardLayer" ggf. zurueck auf "Userdefined".
+ void SetStandardLayer(FASTBOOL bStd=sal_True);
+ FASTBOOL IsStandardLayer() const { return nType==1; }
+};
+
+// Beim Aendern von Layerdaten muss man derzeit
+// noch selbst das Modify-Flag am Model setzen.
+#define SDRLAYER_MAXCOUNT 255
+class SVX_DLLPUBLIC SdrLayerAdmin {
+friend class SdrView;
+friend class SdrModel;
+friend class SdrPage;
+
+protected:
+ Container aLayer;
+ Container aLSets;
+ SdrLayerAdmin* pParent; // Der Admin der Seite kennt den Admin des Docs
+ SdrModel* pModel; // zum Broadcasten
+ String aControlLayerName;
+protected:
+ // Eine noch nicht verwendete LayerID raussuchen. Sind bereits alle
+ // verbraucht, so gibt's 'ne 0. Wer sicher gehen will, muss vorher
+ // GetLayerCount()<SDRLAYER_MAXCOUNT abfragen, denn sonst sind alle
+ // vergeben.
+ SdrLayerID GetUniqueLayerID() const;
+ void Broadcast() const;
+public:
+ SdrLayerAdmin(SdrLayerAdmin* pNewParent=NULL);
+ SdrLayerAdmin(const SdrLayerAdmin& rSrcLayerAdmin);
+ ~SdrLayerAdmin();
+ const SdrLayerAdmin& operator=(const SdrLayerAdmin& rSrcLayerAdmin);
+ bool operator==(const SdrLayerAdmin& rCmpLayerAdmin) const;
+ bool operator!=(const SdrLayerAdmin& rCmpLayerAdmin) const { return !operator==(rCmpLayerAdmin); }
+ SdrLayerAdmin* GetParent() const { return pParent; }
+ void SetParent(SdrLayerAdmin* pNewParent) { pParent=pNewParent; }
+ void SetModel(SdrModel* pNewModel);
+ SdrModel* GetModel() const { return pModel; }
+ void InsertLayer(SdrLayer* pLayer, sal_uInt16 nPos=0xFFFF) { aLayer.Insert(pLayer,nPos); pLayer->SetModel(pModel); Broadcast(); }
+ SdrLayer* RemoveLayer(sal_uInt16 nPos);
+ // Alle Layer loeschen
+ void ClearLayer();
+ // Neuer Layer wird angelegt und eingefuegt
+ SdrLayer* NewLayer(const String& rName, sal_uInt16 nPos=0xFFFF);
+ void DeleteLayer(SdrLayer* pLayer) { aLayer.Remove(pLayer); delete pLayer; Broadcast(); }
+ void MoveLayer(SdrLayer* pLayer, sal_uInt16 nNewPos=0xFFFF);
+ SdrLayer* MoveLayer(sal_uInt16 nPos, sal_uInt16 nNewPos);
+ // Neuer Layer, Name wird aus der Resource geholt
+ SdrLayer* NewStandardLayer(sal_uInt16 nPos=0xFFFF);
+
+ // Iterieren ueber alle Layer
+ sal_uInt16 GetLayerCount() const { return sal_uInt16(aLayer.Count()); }
+ SdrLayer* GetLayer(sal_uInt16 i) { return (SdrLayer*)(aLayer.GetObject(i)); }
+ const SdrLayer* GetLayer(sal_uInt16 i) const { return (SdrLayer*)(aLayer.GetObject(i)); }
+
+ sal_uInt16 GetLayerPos(SdrLayer* pLayer) const;
+
+ SdrLayer* GetLayer(const String& rName, FASTBOOL bInherited) { return (SdrLayer*)(((const SdrLayerAdmin*)this)->GetLayer(rName,bInherited)); }
+ const SdrLayer* GetLayer(const String& rName, FASTBOOL bInherited) const;
+ SdrLayerID GetLayerID(const String& rName, FASTBOOL bInherited) const;
+ SdrLayer* GetLayerPerID(sal_uInt16 nID) { return (SdrLayer*)(((const SdrLayerAdmin*)this)->GetLayerPerID(nID)); }
+ const SdrLayer* GetLayerPerID(sal_uInt16 nID) const;
+
+ void SetControlLayerName(const String& rNewName) { aControlLayerName=rNewName; }
+ const String& GetControlLayerName() const { return aControlLayerName; }
+};
+
+/*
+Anmerkung zu den Layer - Gemischt symbolisch/ID-basierendes Interface
+ Einen neuen Layer macht man sich mit:
+ pLayerAdmin->NewLayer("Der neue Layer");
+ Der Layer wird dann automatisch an das Ende der Liste angehaengt.
+ Entsprechdes gilt fuer Layersets gleichermassen.
+ Das Interface am SdrLayerSet basiert auf LayerID's. Die App muss sich
+ dafuer am SdrLayerAdmin eine ID abholen:
+ SdrLayerID nLayerID=pLayerAdmin->GetLayerID("Der neue Layer");
+ Wird der Layer nicht gefunden, so liefert die Methode SDRLAYER_NOTFOUND
+ zurueck. Die Methoden mit ID-Interface fangen diesen Wert jedoch i.d.R
+ sinnvoll ab.
+ Hat man nicht nur den Namen, sondern gar einen SdrLayer*, so kann man
+ sich die ID natuerlich wesentlich schneller direkt vom Layer abholen.
+bInherited:
+ TRUE: Wird der Layer/LayerSet nicht gefunden, so wird im Parent-LayerAdmin
+ nachgesehen, ob es dort einen entsprechende Definition gibt.
+ FALSE: Es wird nur dieser LayerAdmin durchsucht.
+ Jeder LayerAdmin einer Seite hat einen Parent-LayerAdmin, nämlich den des
+ Model. Das Model selbst hat keinen Parent.
+*/
+
+#endif //_SVDLAYER_HXX
+
diff --git a/svx/inc/svx/svdmark.hxx b/svx/inc/svx/svdmark.hxx
new file mode 100644
index 000000000000..2a05e81e0007
--- /dev/null
+++ b/svx/inc/svx/svdmark.hxx
@@ -0,0 +1,412 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDMARK_HXX
+#define _SVDMARK_HXX
+
+#include <tools/contnr.hxx>
+#include <tools/string.hxx>
+#include <tools/list.hxx>
+#include "svx/svxdllapi.h"
+#include <svx/sdrobjectuser.hxx>
+
+#include <set>
+
+class Rectangle;
+class SdrPage;
+class SdrObjList;
+class SdrObject;
+class SdrPageView;
+
+// Ein Container fuer USHORTs (im Prinzip ein dynamisches Array)
+class SVX_DLLPUBLIC SdrUShortCont
+{
+ Container maArray;
+ sal_Bool mbSorted;
+
+private:
+ void CheckSort(sal_uLong nPos);
+
+public:
+ SdrUShortCont(sal_uInt16 nBlock, sal_uInt16 nInit, sal_uInt16 nResize)
+ : maArray(nBlock, nInit, nResize),
+ mbSorted(sal_True)
+ {}
+
+ SdrUShortCont(const SdrUShortCont& rCont)
+ : maArray(rCont.maArray),
+ mbSorted(rCont.mbSorted)
+ {}
+
+ /** helper to migrate to stl containers */
+ std::set< sal_uInt16 > getContainer();
+
+ SdrUShortCont& operator=(const SdrUShortCont& rCont)
+ {
+ maArray = rCont.maArray;
+ mbSorted = rCont.mbSorted;
+ return *this;
+ }
+
+ sal_Bool operator==(const SdrUShortCont& rCont) const
+ {
+ return maArray == rCont.maArray;
+ }
+
+ sal_Bool operator!=(const SdrUShortCont& rCont) const
+ {
+ return maArray != rCont.maArray;
+ }
+
+ void Clear()
+ {
+ maArray.Clear();
+ mbSorted = sal_True;
+ }
+
+ void Sort() const;
+
+ void ForceSort() const
+ {
+ if(!mbSorted)
+ {
+ Sort();
+ }
+ }
+
+ void Insert(sal_uInt16 nElem, sal_uLong nPos = CONTAINER_APPEND)
+ {
+ maArray.Insert((void*)sal_uLong(nElem),nPos);
+
+ if(mbSorted)
+ {
+ CheckSort(nPos);
+ }
+ }
+
+ void Remove(sal_uLong nPos)
+ {
+ maArray.Remove(nPos);
+ }
+
+ void Replace(sal_uInt16 nElem, sal_uLong nPos)
+ {
+ maArray.Replace((void*)sal_uLong(nElem), nPos);
+
+ if(mbSorted)
+ {
+ CheckSort(nPos);
+ }
+ }
+
+ sal_uInt16 GetObject(sal_uLong nPos) const
+ {
+ return sal_uInt16(sal_uIntPtr(maArray.GetObject(nPos)));
+ }
+
+ sal_uLong GetPos(sal_uInt16 nElem) const
+ {
+ return maArray.GetPos((void*)(sal_uLong)nElem);
+ }
+
+ sal_uLong GetCount() const
+ {
+ return maArray.Count();
+ }
+
+ sal_Bool Exist(sal_uInt16 nElem) const
+ {
+ return (CONTAINER_ENTRY_NOTFOUND != maArray.GetPos((void*)(sal_uLong)nElem));
+ }
+};
+
+// Alles was eine View ueber ein markiertes Objekt wissen muss
+class SVX_DLLPUBLIC SdrMark : public sdr::ObjectUser
+{
+protected:
+ SdrObject* mpSelectedSdrObject; // the seleceted object
+ SdrPageView* mpPageView;
+ SdrUShortCont* mpPoints; // Markierte Punkte
+ SdrUShortCont* mpLines; // Markierte Linienabschnitte
+ SdrUShortCont* mpGluePoints; // Markierte Klebepunkte (deren Id's)
+ sal_Bool mbCon1; // fuer Connectoren
+ sal_Bool mbCon2; // fuer Connectoren
+ sal_uInt16 mnUser; // z.B. fuer CopyObjects, mitkopieren von Edges
+
+public:
+ SdrMark(SdrObject* pNewObj = 0L, SdrPageView* pNewPageView = 0L);
+ SdrMark(const SdrMark& rMark);
+ virtual ~SdrMark();
+
+ // derived from ObjectUser
+ virtual void ObjectInDestruction(const SdrObject& rObject);
+
+ SdrMark& operator=(const SdrMark& rMark);
+ sal_Bool operator==(const SdrMark& rMark) const;
+ sal_Bool operator!=(const SdrMark& rMark) const
+ {
+ return !(operator==(rMark));
+ }
+
+ void SetMarkedSdrObj(SdrObject* pNewObj);
+ SdrObject* GetMarkedSdrObj() const;
+
+ SdrPage* GetPage() const;
+ SdrObjList* GetObjList() const;
+ SdrPageView* GetPageView() const
+ {
+ return mpPageView;
+ }
+
+ void SetPageView(SdrPageView* pNewPageView)
+ {
+ mpPageView = pNewPageView;
+ }
+
+ void SetCon1(sal_Bool bOn)
+ {
+ mbCon1 = bOn;
+ }
+
+ sal_Bool IsCon1() const
+ {
+ return mbCon1;
+ }
+
+ void SetCon2(sal_Bool bOn)
+ {
+ mbCon2 = bOn;
+ }
+
+ sal_Bool IsCon2() const
+ {
+ return mbCon2;
+ }
+
+ void SetUser(sal_uInt16 nVal)
+ {
+ mnUser = nVal;
+ }
+
+ sal_uInt16 GetUser() const
+ {
+ return mnUser;
+ }
+
+ const SdrUShortCont* GetMarkedPoints() const
+ {
+ return mpPoints;
+ }
+
+ const SdrUShortCont* GetMarkedLines() const
+ {
+ return mpLines;
+ }
+
+ const SdrUShortCont* GetMarkedGluePoints() const
+ {
+ return mpGluePoints;
+ }
+
+ SdrUShortCont* GetMarkedPoints()
+ {
+ return mpPoints;
+ }
+
+ SdrUShortCont* GetMarkedLines()
+ {
+ return mpLines;
+ }
+
+ SdrUShortCont* GetMarkedGluePoints()
+ {
+ return mpGluePoints;
+ }
+
+ SdrUShortCont* ForceMarkedPoints()
+ {
+ if(!mpPoints)
+ mpPoints = new SdrUShortCont(1024, 32, 32);
+
+ return mpPoints;
+ }
+
+ SdrUShortCont* ForceMarkedLines()
+ {
+ if(!mpLines)
+ mpLines = new SdrUShortCont(1024, 32, 32);
+
+ return mpLines;
+ }
+
+ SdrUShortCont* ForceMarkedGluePoints()
+ {
+ if(!mpGluePoints)
+ mpGluePoints = new SdrUShortCont(1024, 32, 32);
+
+ return mpGluePoints;
+ }
+};
+
+class SVX_DLLPUBLIC SdrMarkList
+{
+protected:
+ Container maList;
+
+ String maMarkName;
+ String maPointName;
+ String maGluePointName;
+
+ sal_Bool mbPointNameOk;
+ sal_Bool mbGluePointNameOk;
+ sal_Bool mbNameOk;
+ sal_Bool mbSorted;
+
+private:
+ SVX_DLLPRIVATE sal_Bool operator==(const SdrMarkList& rCmpMarkList) const;
+ SVX_DLLPRIVATE void ImpForceSort();
+
+private:
+ SVX_DLLPRIVATE const XubString& GetPointMarkDescription(sal_Bool bGlue) const;
+
+public:
+ SdrMarkList()
+ : maList(1024, 64, 64),
+ mbPointNameOk(sal_False),
+ mbGluePointNameOk(sal_False),
+ mbNameOk(sal_False),
+ mbSorted(sal_True)
+ {
+ }
+
+ SdrMarkList(const SdrMarkList& rLst)
+ : maList(1024, 64, 64)
+ {
+ *this = rLst;
+ }
+
+ ~SdrMarkList()
+ {
+ Clear();
+ }
+
+ void Clear();
+ void ForceSort() const;
+ void SetUnsorted()
+ {
+ mbSorted = sal_False;
+ }
+
+ sal_uLong GetMarkCount() const
+ {
+ return maList.Count();
+ }
+
+ SdrMark* GetMark(sal_uLong nNum) const
+ {
+ return (SdrMark*)(maList.GetObject(nNum));
+ }
+
+ sal_uLong FindObject(const SdrObject* pObj) const;
+ void InsertEntry(const SdrMark& rMark, sal_Bool bChkSort = sal_True);
+ void DeleteMark(sal_uLong nNum);
+ void ReplaceMark(const SdrMark& rNewMark, sal_uLong nNum);
+ void Merge(const SdrMarkList& rSrcList, sal_Bool bReverse = sal_False);
+ sal_Bool DeletePageView(const SdrPageView& rPV);
+ sal_Bool InsertPageView(const SdrPageView& rPV);
+
+ void SetNameDirty()
+ {
+ mbNameOk = sal_False;
+ mbPointNameOk = sal_False;
+ mbGluePointNameOk = sal_False;
+ }
+
+ // Eine verbale Beschreibung der markierten Objekte z.B.:
+ // "27 Linien", "12 Objekte", "Polygon" oder auch "Kein Objekt"
+ const String& GetMarkDescription() const;
+ const String& GetPointMarkDescription() const
+ {
+ return GetPointMarkDescription(sal_False);
+ }
+
+ const String& GetGluePointMarkDescription() const
+ {
+ return GetPointMarkDescription(sal_True);
+ }
+
+ // pPage=0L: Die Markierungen aller! Seiten beruecksichtigen
+ sal_Bool TakeBoundRect(SdrPageView* pPageView, Rectangle& rRect) const;
+ sal_Bool TakeSnapRect(SdrPageView* pPageView, Rectangle& rRect) const;
+
+ // Es werden saemtliche Entries kopiert!
+ void operator=(const SdrMarkList& rLst);
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// migrate selections
+
+namespace sdr
+{
+ class SVX_DLLPUBLIC ViewSelection
+ {
+ SdrMarkList maMarkedObjectList;
+ SdrMarkList maEdgesOfMarkedNodes;
+ SdrMarkList maMarkedEdgesOfMarkedNodes;
+ List maAllMarkedObjects;
+
+ // bitfield
+ unsigned mbEdgesOfMarkedNodesDirty : 1;
+
+ SVX_DLLPRIVATE void ImpForceEdgesOfMarkedNodes();
+ SVX_DLLPRIVATE void ImplCollectCompleteSelection(SdrObject* pObj);
+
+ public:
+ ViewSelection();
+
+ void SetEdgesOfMarkedNodesDirty();
+
+ const SdrMarkList& GetMarkedObjectList() const
+ {
+ return maMarkedObjectList;
+ }
+
+ const SdrMarkList& GetEdgesOfMarkedNodes() const;
+ const SdrMarkList& GetMarkedEdgesOfMarkedNodes() const;
+ const List& GetAllMarkedObjects() const;
+
+ SdrMarkList& GetMarkedObjectListWriteAccess()
+ {
+ return maMarkedObjectList;
+ }
+ };
+} // end of namespace sdr
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDMARK_HXX
+// eof
diff --git a/svx/inc/svx/svdmodel.hxx b/svx/inc/svx/svdmodel.hxx
new file mode 100644
index 000000000000..a32147a3032f
--- /dev/null
+++ b/svx/inc/svx/svdmodel.hxx
@@ -0,0 +1,772 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDMODEL_HXX
+#define _SVDMODEL_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <sot/storage.hxx>
+#include <tools/link.hxx>
+#include <tools/contnr.hxx>
+#include <tools/weakbase.hxx>
+#include <vcl/mapmod.hxx>
+#include <svl/brdcst.hxx>
+#include <tools/string.hxx>
+#include <tools/datetime.hxx>
+#include <svl/hint.hxx>
+
+#include <svl/style.hxx>
+#include <svx/pageitem.hxx>
+#include <vcl/field.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+class OutputDevice;
+#include <svx/svdtypes.hxx> // fuer enum RepeatFuncts
+#include <vcl/field.hxx>
+#include "svx/svxdllapi.h"
+
+#include <vos/ref.hxx>
+
+#if defined(UNX) || defined(WNT)
+#define DEGREE_CHAR ((sal_Unicode)176) /* 0xB0 = Ansi */
+#endif
+
+#if defined(OS2)
+#define DEGREE_CHAR ((sal_Unicode)248) /* 0xF8 = IBM PC (Erw. ASCII) */
+#endif
+
+#ifndef DEGREE_CHAR
+#error unbekannte Plattrorm
+#endif
+
+class SdrOutliner;
+class SdrLayerAdmin;
+class SdrObjList;
+class SdrObject;
+class SdrPage;
+class SdrPageView;
+class SdrTextObj;
+class SdrUndoAction;
+class SdrUndoGroup;
+class AutoTimer;
+class SfxItemPool;
+class SfxItemSet;
+class SfxRepeatTarget;
+class SfxStyleSheet;
+class SfxUndoAction;
+class SfxUndoManager;
+class XBitmapList;
+class XBitmapTable;
+class XColorTable;
+class XDashList;
+class XDashTable;
+class XGradientList;
+class XGradientTable;
+class XHatchList;
+class XHatchTable;
+class XLineEndList;
+class XLineEndTable;
+class SvxForbiddenCharactersTable;
+class SvNumberFormatter;
+class SotStorage;
+class SdrOutlinerCache;
+class SotStorageRef;
+class SdrUndoFactory;
+namespace comphelper{
+ class IEmbeddedHelper;
+}
+namespace sfx2{
+ class LinkManager;
+}
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#define SDR_SWAPGRAPHICSMODE_NONE 0x00000000
+#define SDR_SWAPGRAPHICSMODE_TEMP 0x00000001
+#define SDR_SWAPGRAPHICSMODE_DOC 0x00000002
+#define SDR_SWAPGRAPHICSMODE_PURGE 0x00000100
+#define SDR_SWAPGRAPHICSMODE_DEFAULT (SDR_SWAPGRAPHICSMODE_TEMP|SDR_SWAPGRAPHICSMODE_DOC|SDR_SWAPGRAPHICSMODE_PURGE)
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+enum SdrHintKind
+{
+ HINT_UNKNOWN, // Unbekannt
+ HINT_LAYERCHG, // Layerdefinition geaendert
+ HINT_LAYERORDERCHG, // Layerreihenfolge geaendert (Insert/Remove/ChangePos)
+ HINT_PAGEORDERCHG, // Reihenfolge der Seiten (Zeichenseiten oder Masterpages) geaendert (Insert/Remove/ChangePos)
+ HINT_OBJCHG, // Objekt geaendert
+ HINT_OBJINSERTED, // Neues Zeichenobjekt eingefuegt
+ HINT_OBJREMOVED, // Zeichenobjekt aus Liste entfernt
+ HINT_MODELCLEARED, // gesamtes Model geloescht (keine Pages mehr da). not impl.
+ HINT_REFDEVICECHG, // RefDevice geaendert
+ HINT_DEFAULTTABCHG, // Default Tabulatorweite geaendert
+ HINT_DEFFONTHGTCHG, // Default FontHeight geaendert
+ HINT_MODELSAVED, // Dokument wurde gesichert
+ HINT_SWITCHTOPAGE, // #94278# UNDO/REDO at an object evtl. on another page
+ HINT_BEGEDIT, // Is called after the object has entered text edit mode
+ HINT_ENDEDIT // Is called after the object has left text edit mode
+};
+
+class SVX_DLLPUBLIC SdrHint: public SfxHint
+{
+public:
+ Rectangle maRectangle;
+ const SdrPage* mpPage;
+ const SdrObject* mpObj;
+ const SdrObjList* mpObjList;
+ SdrHintKind meHint;
+
+public:
+ TYPEINFO();
+
+ SdrHint();
+ SdrHint(SdrHintKind eNewHint);
+ SdrHint(const SdrObject& rNewObj);
+ SdrHint(const SdrObject& rNewObj, const Rectangle& rRect);
+
+ void SetPage(const SdrPage* pNewPage);
+ void SetObjList(const SdrObjList* pNewOL);
+ void SetObject(const SdrObject* pNewObj);
+ void SetKind(SdrHintKind eNewKind);
+ void SetRect(const Rectangle& rNewRect);
+
+ const SdrPage* GetPage() const;
+ const SdrObjList* GetObjList() const;
+ const SdrObject* GetObject() const;
+ SdrHintKind GetKind() const;
+ const Rectangle& GetRect() const;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+// Flag um nach dem Laden des Pools Aufzuraeumen (d.h. die RefCounts
+// neu zu bestimmen und unbenutztes wegzuwerfen). sal_False == aktiv
+#define LOADREFCOUNTS (sal_False)
+
+struct SdrDocumentStreamInfo
+{
+ FASTBOOL mbDeleteAfterUse;
+ String maUserData;
+ com::sun::star::uno::Reference < com::sun::star::embed::XStorage > mxStorageRef;
+ sal_Bool mbDummy1 : 1;
+};
+
+struct SdrModelImpl;
+
+class SVX_DLLPUBLIC SdrModel : public SfxBroadcaster, public tools::WeakBase< SdrModel >
+{
+protected:
+ DateTime aReadDate; // Datum des Einstreamens
+ Container maMaPag; // StammSeiten (Masterpages)
+ Container maPages;
+ Link aUndoLink; // Link fuer einen NotifyUndo-Handler
+ Link aIOProgressLink;
+ String aTablePath;
+ Size aMaxObjSize; // z.B. fuer Autogrowing Text
+ Fraction aObjUnit; // Beschreibung der Koordinateneinheiten fuer ClipBoard, Drag&Drop, ...
+ MapUnit eObjUnit; // see above
+ FieldUnit eUIUnit; // Masseinheit, Masstab (z.B. 1/1000) fuer die UI (Statuszeile) wird von ImpSetUIUnit() gesetzt
+ Fraction aUIScale; // see above
+ String aUIUnitStr; // see above
+ Fraction aUIUnitFact; // see above
+ int nUIUnitKomma; // see above
+ FASTBOOL bUIOnlyKomma; // see above
+
+ SdrLayerAdmin* pLayerAdmin;
+ SfxItemPool* pItemPool;
+ FASTBOOL bMyPool; // zum Aufraeumen von pMyPool ab 303a
+ comphelper::IEmbeddedHelper*
+ m_pEmbeddedHelper; // helper for embedded objects to get rid of the SfxObjectShell
+ SdrOutliner* pDrawOutliner; // ein Outliner zur Textausgabe
+ SdrOutliner* pHitTestOutliner;// ein Outliner fuer den HitTest
+ sal_uIntPtr nDefTextHgt; // Default Texthoehe in logischen Einheiten
+ OutputDevice* pRefOutDev; // ReferenzDevice fuer die EditEngine
+ sal_uIntPtr nProgressAkt; // fuer den
+ sal_uIntPtr nProgressMax; // ProgressBar-
+ sal_uIntPtr nProgressOfs; // -Handler
+ rtl::Reference< SfxStyleSheetBasePool > mxStyleSheetPool;
+ SfxStyleSheet* pDefaultStyleSheet;
+ sfx2::LinkManager* pLinkManager; // LinkManager
+ Container* pUndoStack;
+ Container* pRedoStack;
+ SdrUndoGroup* pAktUndoGroup; // Fuer mehrstufige
+ sal_uInt16 nUndoLevel; // Undo-Klammerung
+ bool mbUndoEnabled; // If false no undo is recorded or we are during the execution of an undo action
+ sal_uInt16 nProgressPercent; // fuer den ProgressBar-Handler
+ sal_uInt16 nLoadVersion; // Versionsnummer der geladenen Datei
+ FASTBOOL bExtColorTable; // Keinen eigenen ColorTable
+ sal_Bool mbChanged;
+ FASTBOOL bInfoChanged;
+ FASTBOOL bPagNumsDirty;
+ FASTBOOL bMPgNumsDirty;
+ FASTBOOL bPageNotValid; // sal_True=Doc ist nur ObjektTraeger. Page ist nicht gueltig.
+ FASTBOOL bSavePortable; // Metafiles portabel speichern
+ FASTBOOL bNoBitmapCaching; // Bitmaps fuer Screenoutput cachen
+ FASTBOOL bReadOnly;
+ FASTBOOL bTransparentTextFrames;
+ FASTBOOL bSaveCompressed;
+ FASTBOOL bSwapGraphics;
+ FASTBOOL bPasteResize; // Objekte werden gerade resized wegen Paste mit anderem MapMode
+ FASTBOOL bSaveOLEPreview; // save preview metafile of OLE objects
+ sal_uInt16 nStreamCompressMode; // Komprimiert schreiben?
+ sal_uInt16 nStreamNumberFormat;
+ sal_uInt16 nDefaultTabulator;
+ sal_uInt32 nMaxUndoCount;
+ FASTBOOL bSaveNative;
+ sal_Bool bStarDrawPreviewMode;
+
+
+//////////////////////////////////////////////////////////////////////////////
+// sdr::Comment interface
+private:
+ // the next unique comment ID, used for counting added comments. Initialized
+ // to 0. UI shows one more due to the fact that 0 is a no-no for users.
+ sal_uInt32 mnUniqueCommentID;
+
+public:
+ // create a new, unique comment ID
+ sal_uInt32 GetNextUniqueCommentID();
+
+ // get the author name
+ ::rtl::OUString GetDocumentAuthorName() const;
+
+ // for export
+ sal_uInt32 GetUniqueCommentID() const { return mnUniqueCommentID; }
+
+ // for import
+ void SetUniqueCommentID(sal_uInt32 nNewID) { if(nNewID != mnUniqueCommentID) { mnUniqueCommentID = nNewID; } }
+ /** cl: added this for OJ to complete his reporting engine, does not work
+ correctly so only enable it for his model */
+ bool IsAllowShapePropertyChangeListener() const;
+ void SetAllowShapePropertyChangeListener( bool bAllow );
+
+ sal_uInt16 nStarDrawPreviewMasterPageNum;
+ // Reserven fuer kompatible Erweiterungen
+//-/ SfxItemPool* pUndoItemPool;
+ SotStorage* pModelStorage;
+ SvxForbiddenCharactersTable* mpForbiddenCharactersTable;
+ sal_uIntPtr nSwapGraphicsMode;
+
+ SdrOutlinerCache* mpOutlinerCache;
+ SdrModelImpl* mpImpl;
+ sal_uInt16 mnCharCompressType;
+ sal_uInt16 mnHandoutPageCount;
+ sal_uInt16 nReserveUInt6;
+ sal_uInt16 nReserveUInt7;
+ FASTBOOL mbModelLocked;
+ FASTBOOL mbKernAsianPunctuation;
+ FASTBOOL mbAddExtLeading;
+ FASTBOOL mbInDestruction;
+
+ // Zeiger auf Paletten, Listen und Tabellen
+ XColorTable* pColorTable;
+ XDashList* pDashList;
+ XLineEndList* pLineEndList;
+ XHatchList* pHatchList;
+ XGradientList* pGradientList;
+ XBitmapList* pBitmapList;
+
+ // New src638: NumberFormatter for drawing layer and
+ // method for getting it. It is constructed on demand
+ // and destroyed when destroying the SdrModel.
+ SvNumberFormatter* mpNumberFormatter;
+public:
+ const SvNumberFormatter& GetNumberFormatter() const;
+
+ sal_uInt16 getHandoutPageCount() const { return mnHandoutPageCount; }
+ void setHandoutPageCount( sal_uInt16 nHandoutPageCount ) { mnHandoutPageCount = nHandoutPageCount; }
+
+protected:
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoModel();
+
+private:
+ // Nicht implementiert:
+ SVX_DLLPRIVATE SdrModel(const SdrModel& rSrcModel);
+ SVX_DLLPRIVATE void operator=(const SdrModel& rSrcModel);
+ SVX_DLLPRIVATE FASTBOOL operator==(const SdrModel& rCmpModel) const;
+//#if 0 // _SOLAR__PRIVATE
+ SVX_DLLPRIVATE void ImpPostUndoAction(SdrUndoAction* pUndo);
+ SVX_DLLPRIVATE void ImpSetUIUnit();
+ SVX_DLLPRIVATE void ImpSetOutlinerDefaults( SdrOutliner* pOutliner, sal_Bool bInit = sal_False );
+ SVX_DLLPRIVATE void ImpReformatAllTextObjects();
+ SVX_DLLPRIVATE void ImpReformatAllEdgeObjects(); // #103122#
+ SVX_DLLPRIVATE void ImpCreateTables();
+ SVX_DLLPRIVATE void ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, bool bUseExtColorTable,
+ bool bLoadRefCounts = true);
+
+//#endif // __PRIVATE
+
+ // this is a weak reference to a possible living api wrapper for this model
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxUnoModel;
+
+public:
+//#if 0 // _SOLAR__PRIVATE
+ FASTBOOL IsPasteResize() const { return bPasteResize; }
+ void SetPasteResize(FASTBOOL bOn) { bPasteResize=bOn; }
+//#endif // __PRIVATE
+ TYPEINFO();
+ // Steckt man hier seinen eigenen Pool rein, so wird die Klasse auch
+ // Aktionen an ihm vornehmen (Put(),Remove()). Bei Zerstoerung von
+ // SdrModel wird dieser Pool ver delete geloescht!
+ // Gibt man den Konstruktor stattdessen eine NULL mit, so macht sich
+ // die Klasse einen eigenen Pool (SdrItemPool), den sie dann auch im
+ // Destruktor zerstoert.
+ // Bei Verwendung eines eigenen Pools ist darauf zu achten, dass dieser
+ // von SdrItemPool abgeleitet ist, falls man von SdrAttrObj abgeleitete
+ // Zeichenobjekte verwenden moechte. Setzt man degegen nur vom abstrakten
+ // Basisobjekt SdrObject abgeleitete Objekte ein, so ist man frei in der
+ // Wahl des Pools.
+ SdrModel(SfxItemPool* pPool=NULL, ::comphelper::IEmbeddedHelper* pPers=NULL, sal_Bool bLoadRefCounts = LOADREFCOUNTS);
+ SdrModel(const String& rPath, SfxItemPool* pPool=NULL, ::comphelper::IEmbeddedHelper* pPers=NULL, sal_Bool bLoadRefCounts = LOADREFCOUNTS);
+ SdrModel(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, FASTBOOL bUseExtColorTable, sal_Bool bLoadRefCounts = LOADREFCOUNTS);
+ SdrModel(const String& rPath, SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, FASTBOOL bUseExtColorTable, sal_Bool bLoadRefCounts = LOADREFCOUNTS);
+ virtual ~SdrModel();
+ void ClearModel(sal_Bool bCalledFromDestructor);
+
+ // Hier kann man erfragen, ob das Model gerade eingrstreamt wird
+ FASTBOOL IsLoading() const { return sal_False /*BFS01 bLoading */; }
+ // Muss z.B. ueberladen werden, um das Swappen/LoadOnDemand von Grafiken
+ // zu ermoeglichen. Wird rbDeleteAfterUse auf sal_True gesetzt, so wird
+ // die SvStream-Instanz vom Aufrufer nach Gebrauch destruiert.
+ // Wenn diese Methode NULL liefert, wird zum Swappen eine temporaere
+ // Datei angelegt.
+ // Geliefert werden muss der Stream, aus dem das Model geladen wurde
+ // bzw. in den es zuletzt gespeichert wurde.
+ virtual SvStream* GetDocumentStream( SdrDocumentStreamInfo& rStreamInfo ) const;
+ // Die Vorlagenattribute der Zeichenobjekte in harte Attribute verwandeln.
+ void BurnInStyleSheetAttributes();
+ // Wer sich von SdrPage ableitet muss sich auch von SdrModel ableiten
+ // und diese beiden VM AllocPage() und AllocModel() ueberladen...
+ virtual SdrPage* AllocPage(FASTBOOL bMasterPage);
+ virtual SdrModel* AllocModel() const;
+
+ // Aenderungen an den Layern setzen das Modified-Flag und broadcasten am Model!
+ const SdrLayerAdmin& GetLayerAdmin() const { return *pLayerAdmin; }
+ SdrLayerAdmin& GetLayerAdmin() { return *pLayerAdmin; }
+
+ const SfxItemPool& GetItemPool() const { return *pItemPool; }
+ SfxItemPool& GetItemPool() { return *pItemPool; }
+
+ SdrOutliner& GetDrawOutliner(const SdrTextObj* pObj=NULL) const;
+
+ /** returns a new created and non shared outliner.
+ The outliner will not get updated when the SdrModel is changed.
+ */
+ boost::shared_ptr< SdrOutliner > CreateDrawOutliner(const SdrTextObj* pObj=NULL);
+
+ SdrOutliner& GetHitTestOutliner() const { return *pHitTestOutliner; }
+ const SdrTextObj* GetFormattingTextObj() const;
+ // Die TextDefaults (Font,Hoehe,Farbe) in ein Set putten
+ void SetTextDefaults() const;
+ static void SetTextDefaults( SfxItemPool* pItemPool, sal_uIntPtr nDefTextHgt );
+
+ // ReferenzDevice fuer die EditEngine
+ void SetRefDevice(OutputDevice* pDev);
+ OutputDevice* GetRefDevice() const { return pRefOutDev; }
+ // Wenn ein neuer MapMode am RefDevice gesetzt wird o.ae.
+ void RefDeviceChanged(); // noch nicht implementiert
+ // Default-Schrifthoehe in logischen Einheiten
+ void SetDefaultFontHeight(sal_uIntPtr nVal);
+ sal_uIntPtr GetDefaultFontHeight() const { return nDefTextHgt; }
+ // Default-Tabulatorweite fuer die EditEngine
+ void SetDefaultTabulator(sal_uInt16 nVal);
+ sal_uInt16 GetDefaultTabulator() const { return nDefaultTabulator; }
+
+ // Der DefaultStyleSheet wird jedem Zeichenobjekt verbraten das in diesem
+ // Model eingefuegt wird und kein StyleSheet gesetzt hat.
+ SfxStyleSheet* GetDefaultStyleSheet() const { return pDefaultStyleSheet; }
+ void SetDefaultStyleSheet(SfxStyleSheet* pDefSS) { pDefaultStyleSheet = pDefSS; }
+
+ sfx2::LinkManager* GetLinkManager() { return pLinkManager; }
+ void SetLinkManager( sfx2::LinkManager* pLinkMgr ) { pLinkManager = pLinkMgr; }
+
+ ::comphelper::IEmbeddedHelper* GetPersist() const { return m_pEmbeddedHelper; }
+ void ClearPersist() { m_pEmbeddedHelper = 0; }
+ void SetPersist( ::comphelper::IEmbeddedHelper *p ) { m_pEmbeddedHelper = p; }
+
+ // Masseinheit fuer die Zeichenkoordinaten.
+ // Default ist 1 logische Einheit = 1/100mm (Unit=MAP_100TH_MM, Fract=(1,1)).
+ // Beispiele:
+ // MAP_POINT, Fraction(72,1) : 1 log Einh = 72 Point = 1 Inch
+ // MAP_POINT, Fraction(1,20) : 1 log Einh = 1/20 Point = 1 Twip
+ // MAP_TWIP, Fraction(1,1) : 1 log Einh = 1 Twip
+ // MAP_100TH_MM, Fraction(1,10) : 1 log Einh = 1/1000mm
+ // MAP_MM, Fraction(1000,1) : 1 log Einh = 1000mm = 1m
+ // MAP_CM, Fraction(100,1) : 1 log Einh = 100cm = 1m
+ // MAP_CM, Fraction(100,1) : 1 log Einh = 100cm = 1m
+ // MAP_CM, Fraction(100000,1): 1 log Einh = 100000cm = 1km
+ // (PS: Lichtjahre sind somit also nicht darstellbar).
+ // Die Skalierungseinheit wird benoetigt, damit die Engine das Clipboard
+ // mit den richtigen Groessen beliefern kann.
+ MapUnit GetScaleUnit() const { return eObjUnit; }
+ void SetScaleUnit(MapUnit eMap);
+ const Fraction& GetScaleFraction() const { return aObjUnit; }
+ void SetScaleFraction(const Fraction& rFrac);
+ // Beides gleichzeitig setzen ist etwas performanter
+ void SetScaleUnit(MapUnit eMap, const Fraction& rFrac);
+
+ // Maximale Groesse z.B. fuer Autogrowing-Texte
+ const Size& GetMaxObjSize() const { return aMaxObjSize; }
+ void SetMaxObjSize(const Size& rSiz) { aMaxObjSize=rSiz; }
+
+ // Damit die View! in der Statuszeile vernuenftige Zahlen anzeigen kann:
+ // Default ist mm.
+ void SetUIUnit(FieldUnit eUnit);
+ FieldUnit GetUIUnit() const { return eUIUnit; }
+ // Der Masstab der Zeichnung. Default 1/1.
+ void SetUIScale(const Fraction& rScale);
+ const Fraction& GetUIScale() const { return aUIScale; }
+ // Beides gleichzeitig setzen ist etwas performanter
+ void SetUIUnit(FieldUnit eUnit, const Fraction& rScale);
+
+ const Fraction& GetUIUnitFact() const { return aUIUnitFact; }
+ const String& GetUIUnitStr() const { return aUIUnitStr; }
+ int GetUIUnitKomma() const { return nUIUnitKomma; }
+ FASTBOOL IsUIOnlyKomma() const { return bUIOnlyKomma; }
+
+ static void TakeUnitStr(FieldUnit eUnit, String& rStr);
+ void TakeMetricStr(long nVal, String& rStr, FASTBOOL bNoUnitChars=sal_False, sal_Int32 nNumDigits = -1) const;
+ void TakeWinkStr(long nWink, String& rStr, FASTBOOL bNoDegChar=sal_False) const;
+ void TakePercentStr(const Fraction& rVal, String& rStr, FASTBOOL bNoPercentChar=sal_False) const;
+
+ // RecalcPageNums wird idR. nur von der Page gerufen.
+ FASTBOOL IsPagNumsDirty() const { return bPagNumsDirty; };
+ FASTBOOL IsMPgNumsDirty() const { return bMPgNumsDirty; };
+ void RecalcPageNums(FASTBOOL bMaster);
+ // Nach dem Insert gehoert die Page dem SdrModel.
+ virtual void InsertPage(SdrPage* pPage, sal_uInt16 nPos=0xFFFF);
+ virtual void DeletePage(sal_uInt16 nPgNum);
+ // Remove bedeutet Eigentumsuebereignung an den Aufrufer (Gegenteil von Insert)
+ virtual SdrPage* RemovePage(sal_uInt16 nPgNum);
+ virtual void MovePage(sal_uInt16 nPgNum, sal_uInt16 nNewPos);
+ const SdrPage* GetPage(sal_uInt16 nPgNum) const;
+ SdrPage* GetPage(sal_uInt16 nPgNum);
+ sal_uInt16 GetPageCount() const;
+ // #109538#
+ virtual void PageListChanged();
+
+ // Masterpages
+ virtual void InsertMasterPage(SdrPage* pPage, sal_uInt16 nPos=0xFFFF);
+ virtual void DeleteMasterPage(sal_uInt16 nPgNum);
+ // Remove bedeutet Eigentumsuebereignung an den Aufrufer (Gegenteil von Insert)
+ virtual SdrPage* RemoveMasterPage(sal_uInt16 nPgNum);
+ virtual void MoveMasterPage(sal_uInt16 nPgNum, sal_uInt16 nNewPos);
+ const SdrPage* GetMasterPage(sal_uInt16 nPgNum) const;
+ SdrPage* GetMasterPage(sal_uInt16 nPgNum);
+ sal_uInt16 GetMasterPageCount() const;
+ // #109538#
+ virtual void MasterPageListChanged();
+
+ // Modified-Flag. Wird automatisch gesetzt, wenn an den Pages oder
+ // Zeichenobjekten was geaendert wird. Zuruecksetzen muss man es
+ // jedoch selbst (z.B. bei Save() ...).
+ sal_Bool IsChanged() const { return mbChanged; }
+ virtual void SetChanged(sal_Bool bFlg = sal_True);
+
+ // PageNotValid bedeutet, dass das Model lediglich Objekte traegt die zwar
+ // auf einer Page verankert sind, die Page aber nicht gueltig ist. Diese
+ // Kennzeichnung wird fuers Clipboard/Drag&Drop benoetigt.
+ FASTBOOL IsPageNotValid() const { return bPageNotValid; }
+ void SetPageNotValid(FASTBOOL bJa=sal_True) { bPageNotValid=bJa; }
+
+ // Schaltet man dieses Flag auf sal_True, so werden Grafikobjekte
+ // portabel gespeichert. Es findet dann beim Speichern ggf.
+ // eine implizite Wandlung von Metafiles statt.
+ // Default=FALSE. Flag ist nicht persistent.
+ FASTBOOL IsSavePortable() const { return bSavePortable; }
+ void SetSavePortable(FASTBOOL bJa=sal_True) { bSavePortable=bJa; }
+
+ // Schaltet man dieses Flag auf sal_True, so werden
+ // Pixelobjekte (stark) komprimiert gespeichert.
+ // Default=FALSE. Flag ist nicht persistent.
+ FASTBOOL IsSaveCompressed() const { return bSaveCompressed; }
+ void SetSaveCompressed(FASTBOOL bJa=sal_True) { bSaveCompressed=bJa; }
+
+ // Schaltet man dieses Flag auf sal_True, so werden
+ // Grafikobjekte mit gesetztem Native-Link
+ // native gespeichert.
+ // Default=FALSE. Flag ist nicht persistent.
+ FASTBOOL IsSaveNative() const { return bSaveNative; }
+ void SetSaveNative(FASTBOOL bJa=sal_True) { bSaveNative=bJa; }
+
+ // Schaltet man dieses Flag auf sal_True, so werden die Grafiken
+ // von Grafikobjekten:
+ // - beim Laden eines Dokuments nicht sofort mitgeladen,
+ // sondern erst wenn sie gebraucht (z.B. angezeigt) werden.
+ // - ggf. wieder aus dem Speicher geworfen, falls Sie gerade
+ // nicht benoetigt werden.
+ // Damit das funktioniert, muss die virtuelle Methode
+ // GetDocumentStream() ueberladen werden.
+ // Default=FALSE. Flag ist nicht persistent.
+ FASTBOOL IsSwapGraphics() const { return bSwapGraphics; }
+ void SetSwapGraphics(FASTBOOL bJa=sal_True);
+ void SetSwapGraphicsMode(sal_uIntPtr nMode) { nSwapGraphicsMode = nMode; }
+ sal_uIntPtr GetSwapGraphicsMode() const { return nSwapGraphicsMode; }
+
+ FASTBOOL IsSaveOLEPreview() const { return bSaveOLEPreview; }
+ void SetSaveOLEPreview( FASTBOOL bSet) { bSaveOLEPreview = bSet; }
+
+ // Damit die Bildschirmausgabe von Bitmaps (insbesondere bei gedrehten)
+ // etwas schneller wird, werden sie gecachet. Diesen Cache kann man mit
+ // diesem Flag ein-/ausschalten. Beim naechsten Paint wird an den Objekten
+ // dann ggf. ein Image gemerkt bzw. freigegeben. Wandert ein Bitmapobjekt
+ // in's Undo, so wird der Cache fuer dieses Objekt sofort ausgeschaltet
+ // (Speicher sparen).
+ // Default=Cache eingeschaltet. Flag ist nicht persistent.
+ FASTBOOL IsBitmapCaching() const { return !bNoBitmapCaching; }
+ void SetBitmapCaching(FASTBOOL bJa=sal_True) { bNoBitmapCaching=!bJa; }
+
+ // Defaultmaessig (sal_False) kann man Textrahmen ohne Fuellung durch
+ // Mausklick selektieren. Nach Aktivierung dieses Flags trifft man sie
+ // nur noch in dem Bereich, wo sich auch tatsaechlich Text befindet.
+ FASTBOOL IsPickThroughTransparentTextFrames() const { return bTransparentTextFrames; }
+ void SetPickThroughTransparentTextFrames(FASTBOOL bOn) { bTransparentTextFrames=bOn; }
+
+ // Darf denn das Model ueberhaupt veraendert werden?
+ // Wird nur von den Possibility-Methoden der View ausgewerdet.
+ // Direkte Manipulationen am Model, ... berueksichtigen dieses Flag nicht.
+ // Sollte ueberladen werden und entsprechend des ReadOnly-Status des Files
+ // sal_True oder sal_False liefern (Methode wird oeffters gerufen, also ein Flag
+ // verwenden!).
+ virtual FASTBOOL IsReadOnly() const;
+ virtual void SetReadOnly(FASTBOOL bYes);
+
+ // Vermischen zweier SdrModel. Zu beachten sei, dass rSourceModel nicht
+ // const ist. Die Pages werden beim einfuegen nicht kopiert, sondern gemoved.
+ // rSourceModel ist anschliessend u.U. weitgehend leer.
+ // nFirstPageNum,nLastPageNum: Die aus rSourceModel zu uebernehmenden Seiten
+ // nDestPos..................: Einfuegeposition
+ // bMergeMasterPages.........: sal_True =benoetigte MasterPages werden aus
+ // rSourceModel ebenfalls uebernommen
+ // sal_False=Die MasterPageDescriptoren der Seiten
+ // aus rSourceModel werden auf die
+ // vorhandenen MasterPages gemappt.
+ // bUndo.....................: Fuer das Merging wird eine UndoAction generiert.
+ // Undo ist nur fuer das ZielModel, nicht fuer
+ // rSourceModel.
+ // bTreadSourceAsConst.......: sal_True=Das SourceModel wird nicht veraendert,.
+ // d.h die Seiten werden kopiert.
+ virtual void Merge(SdrModel& rSourceModel,
+ sal_uInt16 nFirstPageNum=0, sal_uInt16 nLastPageNum=0xFFFF,
+ sal_uInt16 nDestPos=0xFFFF,
+ FASTBOOL bMergeMasterPages=sal_False, FASTBOOL bAllMasterPages=sal_False,
+ FASTBOOL bUndo=sal_True, FASTBOOL bTreadSourceAsConst=sal_False);
+
+ // Ist wie Merge(SourceModel=DestModel,nFirst,nLast,nDest,sal_False,sal_False,bUndo,!bMoveNoCopy);
+ void CopyPages(sal_uInt16 nFirstPageNum, sal_uInt16 nLastPageNum,
+ sal_uInt16 nDestPos,
+ FASTBOOL bUndo=sal_True, FASTBOOL bMoveNoCopy=sal_False);
+
+ // Mit BegUndo() / EndUndo() ist es moeglich beliebig viele UndoActions
+ // beliebig tief zu klammern. Als Kommentar der
+ // UndoAction wird der des ersten BegUndo(String) aller Klammerungen
+ // verwendet. Der NotifyUndoActionHdl wird in diesem Fall erst beim letzten
+ // EndUndo() gerufen. Bei einer leeren Klammerung wird keine UndoAction
+ // generiert.
+ // Alle direkten Aktionen am SdrModel erzeugen keine UndoActions, die
+ // Aktionen an der SdrView dagegen generieren solche.
+ void BegUndo(); // Undo-Klammerung auf
+ void BegUndo(const String& rComment); // Undo-Klammerung auf
+ void BegUndo(const String& rComment, const String& rObjDescr, SdrRepeatFunc eFunc=SDRREPFUNC_OBJ_NONE); // Undo-Klammerung auf
+ void BegUndo(SdrUndoGroup* pUndoGrp); // Undo-Klammerung auf
+ void EndUndo(); // Undo-Klammerung zu
+ void AddUndo(SdrUndoAction* pUndo);
+ sal_uInt16 GetUndoBracketLevel() const { return nUndoLevel; }
+ const SdrUndoGroup* GetAktUndoGroup() const { return pAktUndoGroup; }
+ // nur nach dem 1. BegUndo oder vor dem letzten EndUndo:
+ void SetUndoComment(const String& rComment);
+ void SetUndoComment(const String& rComment, const String& rObjDescr);
+
+ // Das Undo-Managment findet nur statt, wenn kein NotifyUndoAction-Handler
+ // gesetzt ist.
+ // Default ist 16. Minimaler MaxUndoActionCount ist 1!
+ void SetMaxUndoActionCount(sal_uIntPtr nAnz);
+ sal_uIntPtr GetMaxUndoActionCount() const { return nMaxUndoCount; }
+ void ClearUndoBuffer();
+ // UndoAction(0) ist die aktuelle (also die zuletzt eingegangene)
+ sal_uIntPtr GetUndoActionCount() const { return pUndoStack!=NULL ? pUndoStack->Count() : 0; }
+ const SfxUndoAction* GetUndoAction(sal_uIntPtr nNum) const { return (SfxUndoAction*)(pUndoStack!=NULL ? pUndoStack->GetObject(nNum) : NULL); }
+ // RedoAction(0) ist die aktuelle (also die des letzten Undo)
+ sal_uIntPtr GetRedoActionCount() const { return pRedoStack!=NULL ? pRedoStack->Count() : 0; }
+ const SfxUndoAction* GetRedoAction(sal_uIntPtr nNum) const { return (SfxUndoAction*)(pRedoStack!=NULL ? pRedoStack->GetObject(nNum) : NULL); }
+
+ FASTBOOL Undo();
+ FASTBOOL Redo();
+ FASTBOOL Repeat(SfxRepeatTarget&);
+
+ // Hier kann die Applikation einen Handler setzen, der die auflaufenden
+ // UndoActions einsammelt. Der Handler hat folgendes Aussehen:
+ // void __EXPORT NotifyUndoActionHdl(SfxUndoAction* pUndoAction);
+ // Beim Aufruf des Handlers findet eine Eigentumsuebereignung statt; die
+ // UndoAction gehoert somit dem Handler, nicht mehr dem SdrModel.
+ void SetNotifyUndoActionHdl(const Link& rLink) { aUndoLink=rLink; }
+ const Link& GetNotifyUndoActionHdl() const { return aUndoLink; }
+
+ /** application can set it's own undo manager, BegUndo, EndUndo and AddUndoAction
+ calls are routet to this interface if given */
+ void SetSdrUndoManager( SfxUndoManager* pUndoManager );
+ SfxUndoManager* GetSdrUndoManager() const;
+
+ /** applications can set their own undo factory to overide creation of
+ undo actions. The SdrModel will become owner of the given SdrUndoFactory
+ and delete it upon its destruction. */
+ void SetSdrUndoFactory( SdrUndoFactory* pUndoFactory );
+
+ /** returns the models undo factory. This must be used to create
+ undo actions for this model. */
+ SdrUndoFactory& GetSdrUndoFactory() const;
+
+ // Hier kann man einen Handler setzen der beim Streamen mehrfach gerufen
+ // wird und ungefaehre Auskunft ueber den Fortschreitungszustand der
+ // Funktion gibt. Der Handler muss folgendes Aussehen haben:
+ // void __EXPORT class::IOProgressHdl(const sal_uInt16& nPercent);
+ // Der erste Aufruf des Handlers erfolgt grundsaetzlich mit 0, der letzte
+ // mit 100. Dazwischen erfolgen maximal 99 Aufrufe mit Werten 1...99.
+ // Man kann also durchaus bei 0 den Progressbar Initiallisieren und bei
+ // 100 wieder schliessen. Zu beachten sei, dass der Handler auch gerufen
+ // wird, wenn die App Draw-Daten im officeweiten Draw-Exchange-Format
+ // bereitstellt, denn dies geschieht durch streamen in einen MemoryStream.
+ void SetIOProgressHdl(const Link& rLink) { aIOProgressLink=rLink; }
+ const Link& GetIOProgressHdl() const { return aIOProgressLink; }
+
+ // Zugriffsmethoden fuer Paletten, Listen und Tabellen
+ void SetColorTable(XColorTable* pTable) { pColorTable=pTable; }
+ XColorTable* GetColorTable() const { return pColorTable; }
+ void SetDashList(XDashList* pList) { pDashList=pList; }
+ XDashList* GetDashList() const { return pDashList; }
+ void SetLineEndList(XLineEndList* pList) { pLineEndList=pList; }
+ XLineEndList* GetLineEndList() const { return pLineEndList; }
+ void SetHatchList(XHatchList* pList) { pHatchList=pList; }
+ XHatchList* GetHatchList() const { return pHatchList; }
+ void SetGradientList(XGradientList* pList) { pGradientList=pList; }
+ XGradientList* GetGradientList() const { return pGradientList; }
+ void SetBitmapList(XBitmapList* pList) { pBitmapList=pList; }
+ XBitmapList* GetBitmapList() const { return pBitmapList; }
+
+ // Der StyleSheetPool wird der DrawingEngine nur bekanntgemacht.
+ // Zu loeschen hat ihn schliesslich der, der ihn auch konstruiert hat.
+ SfxStyleSheetBasePool* GetStyleSheetPool() const { return mxStyleSheetPool.get(); }
+ void SetStyleSheetPool(SfxStyleSheetBasePool* pPool) { mxStyleSheetPool=pPool; }
+
+ // Diese Methode fuert einen Konsistenzcheck auf die Struktur des Models
+ // durch. Geprueft wird insbesondere die Verkettung von Verschachtelten
+ // Gruppenobjekten, aber auch Stati wie bInserted sowie Model* und Page*
+ // der Objects, SubLists und Pages. Bei korrekter Struktur liefert die
+ // Methode sal_True, andernfalls FALSE.
+ // Dieser Check steht nur zur Verfuegung, wenn die Engine mit DBG_UTIL
+ // uebersetzt wurde. Andernfalls liefert die Methode immer TRUE. (ni)
+ FASTBOOL CheckConsistence() const;
+
+ void SetStarDrawPreviewMode(sal_Bool bPreview);
+ sal_Bool IsStarDrawPreviewMode() { return bStarDrawPreviewMode; }
+
+ SotStorage* GetModelStorage() const { return pModelStorage; }
+ void SetModelStorage( SotStorage* pStor ) { pModelStorage = pStor; }
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getUnoModel();
+ void setUnoModel( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xModel );
+
+ // these functions are used by the api to disable repaints during a
+ // set of api calls.
+ sal_Bool isLocked() const { return (sal_Bool)mbModelLocked; }
+ void setLock( sal_Bool bLock );
+
+ void SetForbiddenCharsTable( vos::ORef<SvxForbiddenCharactersTable> xForbiddenChars );
+ vos::ORef<SvxForbiddenCharactersTable> GetForbiddenCharsTable() const;
+
+ void SetCharCompressType( sal_uInt16 nType );
+ sal_uInt16 GetCharCompressType() const { return mnCharCompressType; }
+
+ void SetKernAsianPunctuation( sal_Bool bEnabled );
+ sal_Bool IsKernAsianPunctuation() const { return (sal_Bool)mbKernAsianPunctuation; }
+
+ void SetAddExtLeading( sal_Bool bEnabled );
+ sal_Bool IsAddExtLeading() const { return (sal_Bool)mbAddExtLeading; }
+
+ void ReformatAllTextObjects();
+
+ FASTBOOL HasTransparentObjects( sal_Bool bCheckForAlphaChannel = sal_False ) const;
+
+ SdrOutliner* createOutliner( sal_uInt16 nOutlinerMode );
+ void disposeOutliner( SdrOutliner* pOutliner );
+
+ sal_Bool IsWriter() const { return !bMyPool; }
+
+ /** returns the numbering type that is used to format page fields in drawing shapes */
+ virtual SvxNumType GetPageNumType() const;
+
+ /** copies the items from the source set to the destination set. Both sets must have
+ same ranges but can have different pools. If pNewModel is optional. If it is null,
+ this model is used. */
+
+ void MigrateItemSet( const SfxItemSet* pSourceSet, SfxItemSet* pDestSet, SdrModel* pNewModel );
+
+ bool IsInDestruction() const;
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelImplementationId();
+
+ /** enables (true) or disables (false) recording of undo actions
+ If undo actions are added while undo is disabled, they are deleted.
+ Disabling undo does not clear the current undo buffer! */
+ void EnableUndo( bool bEnable );
+
+ /** returns true if undo is currently enabled
+ This returns false if undo was disabled using EnableUndo( false ) and
+ also during the runtime of the Undo() and Redo() methods. */
+ bool IsUndoEnabled() const;
+
+};
+
+typedef tools::WeakReference< SdrModel > SdrModelWeakRef;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDMODEL_HXX
+
+/* /////////////////////////////////////////////////////////////////////////////////////////////////
+ +-----------+
+ | SdrModel |
+ +--+------+-+
+ | +-----------+
+ +----+-----+ |
+ | ... | |
+ +----+---+ +----+---+ +-----+--------+
+ |SdrPage | |SdrPage | |SdrLayerAdmin |
+ +---+----+ +-+--+--++ +---+-------+--+
+ | | | | | +-------------------+
+ +----+----+ +-----+-----+ +-------+-------+
+ | ... | | ... | | ... |
++---+---+ +---+---+ +----+----+ +----+----+ +-----+------+ +------+-----+
+|SdrObj | |SdrObj | |SdrLayer | |SdrLayer | |SdrLayerSet | |SdrLayerSet |
++-------+ +-------+ +---------+ +---------+ +------------+ +------------+
+Die Klasse SdrModel ist der Kopf des Datenmodells der StarView Drawing-Engine.
+
+///////////////////////////////////////////////////////////////////////////////////////////////// */
+
diff --git a/svx/inc/svx/svdmrkv.hxx b/svx/inc/svx/svdmrkv.hxx
new file mode 100644
index 000000000000..26845f0ff68d
--- /dev/null
+++ b/svx/inc/svx/svdmrkv.hxx
@@ -0,0 +1,539 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDMRKV_HXX
+#define _SVDMRKV_HXX
+
+#include <svx/svdmark.hxx>
+#include <svx/svdhdl.hxx>
+#include <svx/svdsnpv.hxx>
+#include <svx/svdtypes.hxx>
+#include "svx/svxdllapi.h"
+
+//************************************************************
+// Defines
+//************************************************************
+
+// folgendes ist noch nicht bzw. erst zum Teil implementiert:
+#define SDRSEARCH_DEEP 0x0001 /* rekursiv in Gruppenobjekte hinein */
+#define SDRSEARCH_ALSOONMASTER 0x0002 /* MasterPages werden auch durchsucht */
+#define SDRSEARCH_WHOLEPAGE 0x0004 /* Nicht nur die ObjList der PageView */
+#define SDRSEARCH_TESTMARKABLE 0x0008 /* nur markierbare Objekte/Punkte/Handles/... */
+#define SDRSEARCH_TESTMACRO 0x0010 /* Nur Objekte mit Macro */
+#define SDRSEARCH_TESTTEXTEDIT 0x0020 /* Nur TextEdit-faehige Objekte */
+#define SDRSEARCH_WITHTEXT 0x0040 /* Nur Objekte mit Text */
+#define SDRSEARCH_TESTTEXTAREA 0x0080 /* Den Textbereich von Objekten mit Text (TextEditHit) */
+#define SDRSEARCH_BACKWARD 0x0100 /* Rueckwaertssuche */
+#define SDRSEARCH_NEXT 0x0200 /* Suche startet hinter dem uebergebenen Objekt/Punkt/... */
+#define SDRSEARCH_MARKED 0x0400 /* Nur markierte Objekte/Punkte/... */
+#define SDRSEARCH_PASS2BOUND 0x0800 /* Wenn nix gefunden, dann neuer 2. Versuch mit BoundRectHit */
+#define SDRSEARCH_PASS3NEAREST 0x1000 /* Wenn nix gefunden, dann neuer 3. Versuch mit NearestBoundRectHit */
+
+#define SDRSEARCH_PICKMARKABLE (SDRSEARCH_TESTMARKABLE)
+#define SDRSEARCH_PICKTEXTEDIT (SDRSEARCH_DEEP|SDRSEARCH_TESTMARKABLE|SDRSEARCH_TESTTEXTEDIT)
+#define SDRSEARCH_PICKMACRO (SDRSEARCH_DEEP|SDRSEARCH_ALSOONMASTER|SDRSEARCH_WHOLEPAGE|SDRSEARCH_TESTMACRO)
+
+// SDRSEARCHPASS_... ist Rueckgabeparameterwert bei PickObj().
+#define SDRSEARCHPASS_DIRECT 0x0000 /* Objekt durch direkten Hit getroffen */
+#define SDRSEARCHPASS_INACTIVELIST 0x0001 /* Obj auf der Page, nicht jedoch in der AktGroup (bei WHOLEPAGE) */
+#define SDRSEARCHPASS_MASTERPAGE 0x0002 /* Objekt auf der MasterPage gefunden */
+#define SDRSEARCHPASS_BOUND 0x0010 /* Objekt erst beim Bound-Check gefunden */
+#define SDRSEARCHPASS_NEAREST 0x0020 /* Objekt erst beim Nearest-Check gefunden */
+
+enum SdrHitKind {SDRHIT_NONE, // Nicht getroffen, Schnaps gesoffen
+ SDRHIT_OBJECT, // Treffer versenkt
+ SDRHIT_BOUNDRECT, // Treffer am BoundRect
+ SDRHIT_BOUNDTL, // Treffer am BoundRect TopLeft
+ SDRHIT_BOUNDTC, // Treffer am BoundRect TopCenter
+ SDRHIT_BOUNDTR, // Treffer am BoundRect TopRight
+ SDRHIT_BOUNDCL, // Treffer am BoundRect CenterLeft
+ SDRHIT_BOUNDCR, // Treffer am BoundRect CenterRight
+ SDRHIT_BOUNDBL, // Treffer am BoundRect BottomLeft
+ SDRHIT_BOUNDBC, // Treffer am BoundRect BottomCenter
+ SDRHIT_BOUNDBR,/*,*/ // Treffer am BoundRect BottomRight
+ /*SDRHIT_REFPOINT*/ // Referenzpunkt (Rotationsachse,Spiegelachse) getroffen
+ // ab hier neu am 01-07-1996:
+ SDRHIT_HANDLE, // Markierungshandle
+ SDRHIT_HELPLINE, // Hilfslinie
+ SDRHIT_GLUEPOINT, // Klebepunkt
+ SDRHIT_TEXTEDIT, // Offene OutlinerView getroffen
+ SDRHIT_TEXTEDITOBJ, // Objekt fuer SdrBeginTextEdit (Textbereich)
+ SDRHIT_URLFIELD, // Feld im TextObj getroffen (wird gerade nicht editiert)
+ SDRHIT_MACRO, // Objekt fuer BegMacroObj
+ SDRHIT_MARKEDOBJECT, // Markiertes Objekt (z.B. zum Draggen)
+ SDRHIT_UNMARKEDOBJECT, // nichtmarkiertes Objekt (z.B. zum markieren)
+ SDRHIT_CELL}; // hit on a cell inside a table shape (outside of the cells text area)
+
+enum SdrViewEditMode {SDREDITMODE_EDIT, // Auch bekannt aus Pfeil- oder Zeigermodus
+ SDREDITMODE_CREATE, // Objekterzeugungswerkzeug
+ SDREDITMODE_GLUEPOINTEDIT}; // Klebepunkteditiermodus
+
+#define IMPSDR_MARKOBJDESCRIPTION 0x0000
+#define IMPSDR_POINTSDESCRIPTION 0x0001
+#define IMPSDR_GLUEPOINTSDESCRIPTION 0x0002
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@ @@ @@@@ @@@@@ @@ @@ @@ @@ @@ @@@@@ @@ @@
+// @@@ @@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@@@@@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@
+// @@@@@@@ @@@@@@ @@@@@ @@@@ @@@@@ @@ @@@@ @@@@@@@
+// @@ @ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @ @@ @@@@@ @@ @@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+class ImplMarkingOverlay;
+
+class SVX_DLLPUBLIC SdrMarkView : public SdrSnapView
+{
+ friend class SdrPageView;
+
+ // #114409#-3 Migrate selections
+ ImplMarkingOverlay* mpMarkObjOverlay;
+ ImplMarkingOverlay* mpMarkPointsOverlay;
+ ImplMarkingOverlay* mpMarkGluePointsOverlay;
+
+protected:
+ SdrObject* pMarkedObj; // Wenn nur ein Objekt markiert ist.
+ SdrPageView* pMarkedPV; // Wenn alle markierten Objekt auf derselben PageView liegen.
+
+ Point aRef1; // Persistent - Drehmittelpunkt/Spiegelachse
+ Point aRef2; // Persistent
+ Point aLastCrookCenter; // Persistent
+ SdrHdlList aHdl;
+ sdr::ViewSelection* mpSdrViewSelection;
+
+ Rectangle aMarkedObjRect;
+ Rectangle aMarkedPointsRect;
+ Rectangle aMarkedGluePointsRect;
+
+ sal_uInt16 nFrameHandlesLimit;
+ sal_uIntPtr mnInsPointNum; // Nummer des InsPoint
+ sal_uIntPtr nMarkableObjCount;
+
+ SdrDragMode eDragMode; // Persistent
+ SdrViewEditMode eEditMode; // Persistent
+ SdrViewEditMode eEditMode0; // Persistent
+
+ //HMHunsigned bHdlShown : 1;
+ unsigned bRefHdlShownOnly : 1; // Spiegelachse waerend Dragging (ni)
+ unsigned bDesignMode : 1; // DesignMode fuer SdrUnoObj
+ unsigned bForceFrameHandles : 1; // Persistent - FrameDrag auch bei Einzelobjekten
+ unsigned bPlusHdlAlways : 1; // Persistent
+ unsigned bMarkHdlWhenTextEdit : 1; // Persistent, default=FALSE
+ unsigned bInsPolyPoint : 1; // z.Zt InsPolyPointDragging
+ unsigned bMarkedObjRectDirty : 1;
+ unsigned bMrkPntDirty : 1;
+ unsigned bMarkedPointsRectsDirty : 1;
+ unsigned bMarkableObjCountDirty : 1;
+
+ // flag to completely disable handles at the view
+ unsigned mbMarkHandlesHidden : 1;
+
+private:
+ SVX_DLLPRIVATE void ImpClearVars();
+ SVX_DLLPRIVATE void ImpSetPointsRects() const;
+ void UndirtyMrkPnt() const;
+
+protected:
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
+ virtual void ModelHasChanged(); // Wird von der PaintView gerufen
+ virtual void SetMarkHandles(); // aHdl (Liste der Handles) fuellen
+ virtual void SetMarkRects(); // Rects an den PageViews
+ virtual void CheckMarked(); // MarkList nach Del und Lock Layer durchsuchen...
+ virtual void AddDragModeHdl(SdrDragMode eMode);
+ virtual sal_Bool MouseMove(const MouseEvent& rMEvt, Window* pWin);
+
+ // add custom handles (used by other apps, e.g. AnchorPos)
+ virtual void AddCustomHdl();
+
+ void ForceRefToMarked();
+ void ForceUndirtyMrkPnt() const { if (bMrkPntDirty) UndirtyMrkPnt(); }
+
+ //HMHvoid ImpShowMarkHdl(bool bNoRefHdl);
+ virtual SdrObject* CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObject* pObj, SdrPageView* pPV, sal_uIntPtr nOptions, const SetOfByte* pMVisLay) const;
+ virtual SdrObject* CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObjList* pOL, SdrPageView* pPV, sal_uIntPtr nOptions, const SetOfByte* pMVisLay, SdrObject*& rpRootObj) const;
+ sal_Bool ImpIsFrameHandles() const;
+ void ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, String& rStr, sal_uInt16 nVal=0, sal_uInt16 nOpt=0) const;
+
+ // Macht aus einer Winkelangabe in 1/100deg einen String inkl. Grad-Zeichen
+ sal_Bool ImpMarkPoint(SdrHdl* pHdl, SdrMark* pMark, sal_Bool bUnmark);
+ virtual sal_Bool MarkPoints(const Rectangle* pRect, sal_Bool bUnmark);
+ sal_Bool MarkGluePoints(const Rectangle* pRect, sal_Bool bUnmark);
+
+ void SetMoveOutside(sal_Bool bOn);
+ sal_Bool IsMoveOutside() const;
+
+protected:
+ // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
+ SdrMarkView(SdrModel* pModel1, OutputDevice* pOut = 0L);
+ virtual ~SdrMarkView();
+
+public:
+ virtual sal_Bool IsAction() const;
+ virtual void MovAction(const Point& rPnt);
+ virtual void EndAction();
+ virtual void BckAction();
+ virtual void BrkAction();
+ virtual void TakeActionRect(Rectangle& rRect) const;
+
+ virtual void ClearPageView();
+ virtual void HideSdrPage();
+ virtual sal_Bool IsObjMarkable(SdrObject* pObj, SdrPageView* pPV) const;
+
+ // Liefert sal_True wenn Objekte, Punkte oder Klebepunkte durch Rahmenaufziehen
+ // selektiert werden (solange wie der Rahmen aufgezogen wird).
+ sal_Bool IsMarking() const { return IsMarkObj() || IsMarkPoints() || IsMarkGluePoints(); }
+
+ // Objekte durch Aufziehen eines Selektionsrahmens markieren
+ sal_Bool BegMarkObj(const Point& rPnt, sal_Bool bUnmark = sal_False);
+ void MovMarkObj(const Point& rPnt);
+ sal_Bool EndMarkObj();
+ void BrkMarkObj();
+ sal_Bool IsMarkObj() const { return (0L != mpMarkObjOverlay); }
+
+ // DragModes: SDRDRAG_CREATE,SDRDRAG_MOVE,SDRDRAG_RESIZE,SDRDRAG_ROTATE,SDRDRAG_MIRROR,SDRDRAG_SHEAR,SDRDRAG_CROOK
+ // Move==Resize
+ // Das Interface wird hier evtl noch geaendert wg. Ortho-Drag
+ void SetDragMode(SdrDragMode eMode);
+ SdrDragMode GetDragMode() const { return eDragMode; }
+ sal_Bool ChkDragMode(SdrDragMode eMode) const;
+ void SetFrameHandles(sal_Bool bOn);
+ sal_Bool IsFrameHandles() const { return bForceFrameHandles; }
+
+ // Limit, ab wann implizit auf FrameHandles umgeschaltet wird. default=50.
+ void SetFrameHandlesLimit(sal_uInt16 nAnz) { nFrameHandlesLimit=nAnz; }
+ sal_uInt16 GetFrameHandlesLimit() const { return nFrameHandlesLimit; }
+
+ void SetEditMode(SdrViewEditMode eMode);
+ SdrViewEditMode GetEditMode() const { return eEditMode; }
+
+ void SetEditMode(sal_Bool bOn=sal_True) { SetEditMode(bOn?SDREDITMODE_EDIT:SDREDITMODE_CREATE); }
+ sal_Bool IsEditMode() const { return eEditMode==SDREDITMODE_EDIT; }
+ void SetCreateMode(sal_Bool bOn=sal_True) { SetEditMode(bOn?SDREDITMODE_CREATE:SDREDITMODE_EDIT); }
+ sal_Bool IsCreateMode() const { return eEditMode==SDREDITMODE_CREATE; }
+ void SetGluePointEditMode(sal_Bool bOn=sal_True) { SetEditMode(bOn?SDREDITMODE_GLUEPOINTEDIT:eEditMode0); }
+ sal_Bool IsGluePointEditMode() const { return eEditMode==SDREDITMODE_GLUEPOINTEDIT;; }
+
+ void SetDesignMode(sal_Bool bOn=sal_True);
+ sal_Bool IsDesignMode() const { return bDesignMode; }
+
+ void SetFrameDragSingles(sal_Bool bOn=sal_True) { SetFrameHandles(bOn); }
+ sal_Bool IsFrameDragSingles() const { return IsFrameHandles(); }
+
+ // Feststellen, ob und wo ein Objekt bzw. ob ein Referenzpunkt
+ // (Rotationsmittelpunkt,Spiegelachse) getroffen wird (SW special).
+ SdrHitKind PickSomething(const Point& rPnt, short nTol=-2) const;
+ sal_Bool HasMarkableObj() const;
+ sal_uIntPtr GetMarkableObjCount() const;
+ //HMHvoid ShowMarkHdl(bool bNoRefHdl = false);
+ //HMHvoid HideMarkHdl(bool bNoRefHdl = false);
+ //HMHBOOL IsMarkHdlShown() const { return bHdlShown; }
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// migrate selections
+
+protected:
+ // all available changing methods
+ SdrMarkList& GetMarkedObjectListWriteAccess() { return mpSdrViewSelection->GetMarkedObjectListWriteAccess(); }
+ void SetEdgesOfMarkedNodesDirty() { mpSdrViewSelection->SetEdgesOfMarkedNodesDirty(); }
+
+public:
+ // all available const methods for read access to selection
+ const SdrMarkList& GetMarkedObjectList() const { return mpSdrViewSelection->GetMarkedObjectList(); }
+ sal_uIntPtr TryToFindMarkedObject(const SdrObject* pObj) const { return GetMarkedObjectList().FindObject(pObj); }
+ SdrPageView* GetSdrPageViewOfMarkedByIndex(sal_uIntPtr nNum) const { return GetMarkedObjectList().GetMark(nNum)->GetPageView(); }
+ SdrMark* GetSdrMarkByIndex(sal_uIntPtr nNum) const { return GetMarkedObjectList().GetMark(nNum); }
+ SdrObject* GetMarkedObjectByIndex(sal_uIntPtr nNum) const { return (GetMarkedObjectList().GetMark(nNum))->GetMarkedSdrObj(); }
+ sal_uIntPtr GetMarkedObjectCount() const { return GetMarkedObjectList().GetMarkCount(); }
+ void SortMarkedObjects() const { GetMarkedObjectList().ForceSort(); }
+ sal_Bool AreObjectsMarked() const { return (0L != GetMarkedObjectList().GetMarkCount()); }
+ String GetDescriptionOfMarkedObjects() const { return GetMarkedObjectList().GetMarkDescription(); }
+ String GetDescriptionOfMarkedPoints() const { return GetMarkedObjectList().GetPointMarkDescription(); }
+ String GetDescriptionOfMarkedGluePoints() const { return GetMarkedObjectList().GetGluePointMarkDescription(); }
+ sal_Bool GetBoundRectFromMarkedObjects(SdrPageView* pPageView, Rectangle& rRect) const { return GetMarkedObjectList().TakeBoundRect(pPageView, rRect); }
+ sal_Bool GetSnapRectFromMarkedObjects(SdrPageView* pPageView, Rectangle& rRect) const { return GetMarkedObjectList().TakeSnapRect(pPageView, rRect); }
+
+ // Eine Liste aller an markierten Knoten gebundenen Kanten holen,
+ // die selbst jedoch nicht markiert sind.
+ const SdrMarkList& GetEdgesOfMarkedNodes() const { return mpSdrViewSelection->GetEdgesOfMarkedNodes(); }
+ const SdrMarkList& GetMarkedEdgesOfMarkedNodes() const { return mpSdrViewSelection->GetMarkedEdgesOfMarkedNodes(); }
+ const List& GetTransitiveHullOfMarkedObjects() const { return mpSdrViewSelection->GetAllMarkedObjects(); }
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ // mechanism to complete disable handles at the view. Handles will be hidden and deleted
+ // when set, no new ones created, no interaction allowed. Handles will be recreated and shown
+ // when reset. Default is false.
+ void hideMarkHandles();
+ void showMarkHandles();
+ bool areMarkHandlesHidden() const { return mbMarkHandlesHidden; }
+
+ sal_Bool IsMarkedHit(const Point& rPnt, short nTol=-2) const { return IsMarkedObjHit(rPnt,nTol); }
+ sal_Bool IsMarkedObjHit(const Point& rPnt, short nTol=-2) const;
+
+ // Pick: Unterstuetzte Optionen fuer nOptions sind SEARCH_NEXT, SEARCH_BACKWARD (ni)
+ SdrHdl* PickHandle(const Point& rPnt, sal_uIntPtr nOptions=0, SdrHdl* pHdl0=NULL) const;
+
+ // Pick: Unterstuetzte Optionen fuer nOptions sind:
+ // SDRSEARCH_DEEP SDRSEARCH_ALSOONMASTER SDRSEARCH_TESTMARKABLE SDRSEARCH_TESTTEXTEDIT
+ // SDRSEARCH_WITHTEXT SDRSEARCH_TESTTEXTAREA SDRSEARCH_BACKWARD SDRSEARCH_MARKED
+ // SDRSEARCH_WHOLEPAGE
+ virtual sal_Bool PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uIntPtr nOptions, SdrObject** ppRootObj, sal_uIntPtr* pnMarkNum=NULL, sal_uInt16* pnPassNum=NULL) const;
+ virtual sal_Bool PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uIntPtr nOptions=0) const;
+ // sal_Bool PickObj(const Point& rPnt, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uIntPtr nOptions=0) const { return PickObj(rPnt,nHitTolLog,rpObj,rpPV,nOptions); }
+ sal_Bool MarkObj(const Point& rPnt, short nTol=-2, sal_Bool bToggle=sal_False, sal_Bool bDeep=sal_False);
+
+ // Pick: Unterstuetzte Optionen fuer nOptions sind SDRSEARCH_PASS2BOUND und SDRSEARCH_PASS3NEAREST
+ sal_Bool PickMarkedObj(const Point& rPnt, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uIntPtr* pnMarkNum=NULL, sal_uIntPtr nOptions=0) const;
+
+ // Sucht sich das Oberste der markierten Objekte (O1) und sucht von dort
+ // aus in Richtung nach Unten dann das erste nichtmarkierte Objekt (O2).
+ // Bei Erfolg wird die Markierung von O1 entfernt, an O2 gesetzt und TRUE
+ // returniert. Mit dem Parameter bPrev=sal_True geht die Suche genau in die
+ // andere Richtung.
+ sal_Bool MarkNextObj(sal_Bool bPrev=sal_False);
+
+ // Sucht sich das Oberste der markierten Objekte (O1) das von rPnt/nTol
+ // getroffen wird und sucht von dort aus in Richtung nach Unten dann das
+ // erste nichtmarkierte Objekt (O2). Bei Erfolg wird die Markierung von
+ // O1 entfernt, an O2 gesetzt und sal_True returniert.
+ // Mit dem Parameter bPrev=sal_True geht die Suche genau in die andere Richtung.
+ sal_Bool MarkNextObj(const Point& rPnt, short nTol=-2, sal_Bool bPrev=sal_False);
+
+ // Alle Objekte innerhalb eines rechteckigen Bereichs markieren
+ // Markiert werden nur Objekte, die vollstaendig eingeschlossen sind.
+ sal_Bool MarkObj(const Rectangle& rRect, sal_Bool bUnmark=sal_False);
+ void MarkObj(SdrObject* pObj, SdrPageView* pPV, sal_Bool bUnmark=sal_False, sal_Bool bImpNoSetMarkHdl=sal_False);
+ void MarkAllObj(SdrPageView* pPV=NULL); // pPage=NULL => alle angezeigten Seiten
+ void UnmarkAllObj(SdrPageView* pPV=NULL); // pPage=NULL => alle angezeigten Seiten
+
+ // Diese Funktion kostet etwas Zeit, da die MarkList durchsucht werden muss.
+ sal_Bool IsObjMarked(SdrObject* pObj) const;
+ // void MarkAll(SdrPageView* pPV=NULL) { MarkAllObj(pPV); } -> replace with inline
+ void UnMarkAll(SdrPageView* pPV=NULL) { UnmarkAllObj(pPV); }
+
+ // Groesse der Markierungs-Handles abfragen/setzen. Angabe in Pixel.
+ // Der Wert ist als Kantenlaenge zu betrachten. Gerade Werte werden
+ // auf Ungerade aufgerundet: 3->3, 4->5, 5->5, 6->7, 7->7, ...
+ // Defaultwert ist 7, Mindestwert 3 Pixel.
+ sal_uInt16 GetMarkHdlSizePixel() const;
+ void SetMarkHdlSizePixel(sal_uInt16 nSiz);
+
+ // Die Groesse der Markierungs-Handles wird ueber die jeweilige Aufloesung
+ // und die Groesse des Bereichs der markierten Objekte so angepasst, dass
+ // sie sich bei einer Frame-Selektion moeglichst nicht ueberschneiden.
+ // Dazu muessen die Handles ggf. verkleinert dargestellt werden. Mit der
+ // MinMarkHdlSize kann man hierfuer eine Mindestgroesse angeben.
+ // Defaultwert ist 3, Mindestwert 3 Pixel.
+ sal_Bool IsSolidMarkHdl() const { return aHdl.IsFineHdl(); }
+ void SetSolidMarkHdl(sal_Bool bOn);
+
+ virtual sal_Bool HasMarkablePoints() const;
+ virtual sal_uIntPtr GetMarkablePointCount() const;
+ virtual sal_Bool HasMarkedPoints() const;
+ virtual sal_uIntPtr GetMarkedPointCount() const;
+
+ // Nicht alle Punkte lassen sich markieren:
+ virtual sal_Bool IsPointMarkable(const SdrHdl& rHdl) const;
+ virtual sal_Bool MarkPoint(SdrHdl& rHdl, sal_Bool bUnmark=sal_False);
+
+ /** should only be used from outside svx for special ui elements */
+ sal_Bool MarkPointHelper(SdrHdl* pHdl, SdrMark* pMark, sal_Bool bUnmark);
+
+ // alle Punkte innerhalb dieses Rechtecks markieren (Viewkoordinaten)
+ sal_Bool MarkPoints(const Rectangle& rRect, sal_Bool bUnmark=sal_False) { return MarkPoints(&rRect,bUnmark); }
+ sal_Bool UnmarkPoint(SdrHdl& rHdl) { return MarkPoint(rHdl,sal_True); }
+ sal_Bool UnMarkPoint(SdrHdl& rHdl) { return MarkPoint(rHdl,sal_True); }
+ sal_Bool IsPointMarked(const SdrHdl& rHdl) const { ForceUndirtyMrkPnt(); return &rHdl!=NULL && rHdl.IsSelected(); }
+ sal_Bool MarkAllPoints() { return MarkPoints(NULL,sal_False); }
+ sal_Bool UnmarkAllPoints() { return MarkPoints(NULL,sal_True); }
+ sal_Bool UnMarkAllPoints() { return MarkPoints(NULL,sal_True); }
+
+ // Sucht sich den ersten markierten Punkt (P1) und sucht von dort
+ // aus in den ersten nichtmarkierte Punkt (P2).
+ // Bei Erfolg wird die Markierung von P1 entfernt, an P2 gesetzt und TRUE
+ // returniert. Mit dem Parameter bPrev=sal_True geht die Suche genau in die
+ // andere Richtung.
+ sal_Bool MarkNextPoint(sal_Bool bPrev=sal_False);
+
+ // Sucht sich den ersten markierten Punkt (P1) das von rPnt
+ // getroffen wird und sucht von dort aus den
+ // ersten nichtmarkierten Punkt (P2). Bei Erfolg wird die Markierung von
+ // P1 entfernt, an P2 gesetzt und sal_True returniert.
+ // Mit dem Parameter bPrev=sal_True geht die Suche genau in die andere Richtung.
+ sal_Bool MarkNextPoint(const Point& rPnt, sal_Bool bPrev=sal_False);
+
+ // Die Nummer des passenden Handles raussuchen. Nicht gefunden
+ // liefert CONTAINER_ENTRY_NOTFOUND.
+ sal_uIntPtr GetHdlNum(SdrHdl* pHdl) const { return aHdl.GetHdlNum(pHdl); }
+ SdrHdl* GetHdl(sal_uIntPtr nHdlNum) const { return aHdl.GetHdl(nHdlNum); }
+ const SdrHdlList& GetHdlList() const { return aHdl; }
+
+ // Selektionsrahmen fuer Punktmarkierung aufziehen.
+ // Wird nur gestartet, wenn HasMarkablePoints() sal_True liefert.
+ // sal_Bool BegMarkPoints(const Point& rPnt, OutputDevice* pOut);
+ sal_Bool BegMarkPoints(const Point& rPnt, sal_Bool bUnmark = sal_False);
+ void MovMarkPoints(const Point& rPnt);
+ sal_Bool EndMarkPoints();
+ void BrkMarkPoints();
+ sal_Bool IsMarkPoints() const { return (0L != mpMarkPointsOverlay); }
+
+ // Zusatzhandles dauerhaft sichtbar schalten
+ void SetPlusHandlesAlwaysVisible(sal_Bool bOn);
+ sal_Bool IsPlusHandlesAlwaysVisible() const { return bPlusHdlAlways; }
+
+ // Handles sichrbar waerend TextEdit (in doppelter Groesse)?
+ // Persistent, default=FALSE
+ void SetMarkHdlWhenTextEdit(sal_Bool bOn) { bMarkHdlWhenTextEdit=bOn; }
+ sal_Bool IsMarkHdlWhenTextEdit() const { return bMarkHdlWhenTextEdit; }
+
+ sal_Bool HasMarkableGluePoints() const;
+ sal_uIntPtr GetMarkableGluePointCount() const;
+ sal_Bool HasMarkedGluePoints() const;
+ sal_uIntPtr GetMarkedGluePointCount() const;
+
+ // Ein Klebepunkt wird eindeutig identifiziert durch das SdrObject
+ // (dem er zugehoert) sowie einem sal_uInt16 nId (da jedes SdrObject je
+ // mehrere Klebepunkte haben kann. Hier an der View kommt zudem noch
+ // eine SdrPageView, die stets korrekt gesetzt sein sollte.
+ // Alternativ kann ein Klebepunkt durch ein SdrHdl bezeichnet werden.
+ // Die SdrHdl-Instanz beinhaltet dann aller erforderlichen Informationen.
+ // Der Klebepunkt ist in diesem Fall dann zwangslaeufig markiert (nur auf
+ // markierten Klebepunkten sitzen Anfasser).
+ // Achtung: Bei jeder Aenderung des Klebepunktmarkierungsstatus wird die
+ // Handleliste erneut berechnet. Alle vorher gemerkten SdrHdl* sind
+ // damit ungueltig, ebenso die Punkt-Id's!
+ // Pick: Unterstuetzte Optionen fuer nOptions sind SEARCH_NEXT, SEARCH_BACKWARD
+ sal_Bool PickGluePoint(const Point& rPnt, SdrObject*& rpObj, sal_uInt16& rnId, SdrPageView*& rpPV, sal_uIntPtr nOptions=0) const;
+ sal_Bool MarkGluePoint(const SdrObject* pObj, sal_uInt16 nId, const SdrPageView* pPV, sal_Bool bUnmark=sal_False);
+ sal_Bool UnmarkGluePoint(const SdrObject* pObj, sal_uInt16 nId, const SdrPageView* pPV) { return MarkGluePoint(pObj,nId,pPV,sal_True); }
+ sal_Bool IsGluePointMarked(const SdrObject* pObj, sal_uInt16 nId) const;
+ sal_Bool UnmarkGluePoint(const SdrHdl& rHdl);
+
+ // Hdl eines markierten GluePoints holen. Nicht markierte
+ // GluePoints haben keine Handles
+ SdrHdl* GetGluePointHdl(const SdrObject* pObj, sal_uInt16 nId) const;
+ sal_Bool IsGluePoint(const SdrHdl& rHdl) const { return &rHdl!=NULL && rHdl.GetKind()==HDL_GLUE; }
+
+ // alle Punkte innerhalb dieses Rechtecks markieren (Viewkoordinaten)
+ sal_Bool MarkGluePoints(const Rectangle& rRect) { return MarkGluePoints(&rRect,sal_False); }
+ sal_Bool UnmarkGluePoints(const Rectangle& rRect) { return MarkGluePoints(&rRect,sal_True); }
+ sal_Bool MarkAllGluePoints() { return MarkGluePoints(NULL,sal_False); }
+ sal_Bool UnmarkAllGluePoints() { return MarkGluePoints(NULL,sal_True); }
+
+ // Sucht sich den ersten markierten Klebepunkt (P1) und sucht von dort
+ // aus in den ersten nichtmarkierte Klebepunkt (P2).
+ // Bei Erfolg wird die Markierung von P1 entfernt, an P2 gesetzt und TRUE
+ // returniert. Mit dem Parameter bPrev=sal_True geht die Suche genau in die
+ // andere Richtung.
+ sal_Bool MarkNextGluePoint(sal_Bool bPrev=sal_False);
+
+ // Sucht sich den ersten markierten Klebepunkt (P1) das von rPnt
+ // getroffen wird und sucht von dort aus den
+ // ersten nichtmarkierten Klebepunkt (P2). Bei Erfolg wird die Markierung
+ // von P1 entfernt, an P2 gesetzt und sal_True returniert.
+ // Mit dem Parameter bPrev=sal_True geht die Suche genau in die andere Richtung.
+ sal_Bool MarkNextGluePoint(const Point& rPnt, sal_Bool bPrev=sal_False);
+
+ // Selektionsrahmen fuer Klebepunktmarkierung aufziehen.
+ // Wird nur gestartet, wenn HasMarkableGluePoints() sal_True liefert.
+ // Der GlueEditMode sal_True wird nicht abgefragt.
+ // sal_Bool BegMarkGluePoints(const Point& rPnt, OutputDevice* pOut);
+ sal_Bool BegMarkGluePoints(const Point& rPnt, sal_Bool bUnmark = sal_False);
+ void MovMarkGluePoints(const Point& rPnt);
+ sal_Bool EndMarkGluePoints();
+ void BrkMarkGluePoints();
+ sal_Bool IsMarkGluePoints() const { return (0L != mpMarkGluePointsOverlay); }
+
+ // bRestraintPaint=sal_False bewirkt, dass die Handles nicht sofort wieder gemalt werden.
+ // AdjustMarkHdl wird eh' nur gerufen, wenn was geaendert wurde; was idR ein Invalidate
+ // zur Folge hat. Am Ende von des Redraw werden die Handles automatisch gezeichnet.
+ // Der Zweck ist, unnoetiges Flackern zu vermeiden. -> Funkt noch nich, deshalb sal_True!
+ void AdjustMarkHdl(); //HMHBOOL bRestraintPaint=sal_True);
+
+ const Rectangle& GetMarkedObjRect() const; // SnapRects der Objekte, ohne Strichstaerke
+ Rectangle GetMarkedObjBoundRect() const; // inkl. Strichstaerke, ueberstehende Fetzen, ...
+ const Rectangle& GetMarkedPointsRect() const; // Umschliessendes Rechteck aller markierten Punkte
+ const Rectangle& GetMarkedGluePointsRect() const; // Umschliessendes Rechteck aller markierten Klebepunkte
+ const Rectangle& GetAllMarkedRect() const { return GetMarkedObjRect(); }
+ Rectangle GetAllMarkedBoundRect() const { return GetMarkedObjBoundRect(); }
+ const Rectangle& GetAllMarkedPointsRect() const { return GetMarkedPointsRect(); }
+
+ // Wird immer dann gerufen, wenn sich die Liste der markierten Objekte
+ // moeglicherweise geaendert hat. Wer ueberlaed muss unbedingt auch die
+ // Methode der Basisklasse rufen!
+ virtual void MarkListHasChanged();
+
+ // Betreten (Editieren) einer evtl markierten Objektgruppe. Sind mehrere
+ // Objektgruppen markiert, so wird die Oberste genommen. Anschliessend
+ // liegen alle Memberobjekte der Gruppe im direkten Zugriff. Alle anderen
+ // Objekte koennen waerendessen nicht bearbeitet werden (bis zum naechsten
+ // LeaveGroup()). Bei einer seitenuebergreifenden Markierung wird jede Page
+ // separat abgearbeitet. Die Methode liefert sal_True, wenn wenigstens eine
+ // Gruppe betreten wurde.
+ sal_Bool EnterMarkedGroup();
+
+ // Den Mittelpunkt des letzten Crook-Dragging abholen. Den kann man
+ // bei einem anschliessenden Rotate sinnvoll als Drehmittelpunkt setzen.
+ const Point& GetLastCrookCenter() const { return aLastCrookCenter; }
+
+ // Wird automatisch von der DragView beim beenden eines Crook-Drag gesetzt.
+ void SetLastCrookCenter(const Point& rPt) { aLastCrookCenter=rPt; }
+
+ // Rotationsmittelpunkt bzw. Startpunkt der Spiegelachse
+ const Point& GetRef1() const { return aRef1; }
+ void SetRef1(const Point& rPt);
+
+ // Endpunkt der Spiegelachse
+ const Point& GetRef2() const { return aRef1; }
+ void SetRef2(const Point& rPt);
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// - Hit-Toleranzen:
+// Die muessen natuerlich immer in logischen Koordinaten angegeben werden. Also
+// immer brav den gewuenschten Pixelwert mit PixelToLogic in Logischen umrechnen.
+// Angenommen ein Wert 100 (logisch)
+// - Bei einer waagerechten Haarlinie (Objekt mit Hoehe 0) waere dann +/-100,
+// also ein vertikaler Bereich von 200 logischen Einheiten sensitiv.
+// - Bei Polygonen wird ein Rect mit der Groesse (200,200) generiert und ein
+// Touch-Test zwischen Poly und diesem Rect durchgefuehrt.
+// - Eine Sonderbehandlung erfahren Objekte, die bei SdrObject::HasEdit()==TRUE
+// liefern (z.B. Textrahmen). Hierbei wird ein weiterer sensitiver Bereich mit
+// einer Breite von 2*Tol (in diesem Beispiel also 200 Einheiten) um das Objekt
+// herumgelegt. Waerend ein Hit direkt ins Objekt die Edit-Methode ruft,
+// ermoeglicht ein Hit in den umliegenden sensitiven Bereich ein Dragging.
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDMRKV_HXX
+
diff --git a/svx/inc/svx/svdoashp.hxx b/svx/inc/svx/svdoashp.hxx
new file mode 100644
index 000000000000..db0477648599
--- /dev/null
+++ b/svx/inc/svx/svdoashp.hxx
@@ -0,0 +1,265 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDOASHP_HXX
+#define _SVDOASHP_HXX
+
+#include <svx/svdobj.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/svdhdl.hxx>
+#include <vector>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/drawing/XCustomShapeEngine.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
+#include "svx/svxdllapi.h"
+
+//************************************************************
+// Vorausdeklarationen
+//************************************************************
+
+class SdrObjList;
+class SdrObjListIter;
+class SfxItemSet;
+
+namespace sdr
+{
+ namespace properties
+ {
+ class CustomShapeProperties;
+ } // end of namespace properties
+} // end of namespace sdr
+
+class SdrAShapeObjGeoData : public SdrTextObjGeoData
+{
+ public:
+
+ sal_Bool bMirroredX;
+ sal_Bool bMirroredY;
+ double fObjectRotation;
+
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue >
+ aAdjustmentSeq;
+};
+
+#define CUSTOMSHAPE_HANDLE_RESIZE_FIXED 1
+#define CUSTOMSHAPE_HANDLE_CREATE_FIXED 2
+#define CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_X 4
+#define CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_Y 8
+#define CUSTOMSHAPE_HANDLE_MOVE_SHAPE 16
+#define CUSTOMSHAPE_HANDLE_ORTHO4 32
+
+struct SdrCustomShapeInteraction
+{
+ com::sun::star::uno::Reference< com::sun::star::drawing::XCustomShapeHandle > xInteraction;
+ com::sun::star::awt::Point aPosition;
+ sal_Int32 nMode;
+};
+
+//************************************************************
+// SdrObjCustomShape
+//************************************************************
+
+class SVX_DLLPUBLIC SdrObjCustomShape : public SdrTextObj
+{
+private:
+ // fObjectRotation is containing the object rotation in degrees.
+ double fObjectRotation;
+
+protected:
+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+
+public:
+ virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
+
+ // to allow sdr::properties::CustomShapeProperties access
+ friend class sdr::properties::CustomShapeProperties;
+
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mXRenderedCustomShape;
+
+ // #i37011# render geometry shadow
+ SdrObject* mpLastShadowGeometry;
+
+ static com::sun::star::uno::Reference< com::sun::star::drawing::XCustomShapeEngine > GetCustomShapeEngine( const SdrObjCustomShape* pCustomShape );
+
+// SVX_DLLPRIVATE com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::drawing::XCustomShapeHandle > >
+// SdrObjCustomShape::GetInteraction( const SdrObjCustomShape* pCustomShape ) const;
+// #i47293#
+// SVX_DLLPRIVATE std::vector< com::sun::star::uno::Reference< com::sun::star::drawing::XCustomShapeHandle > > GetFixedInteractionHandle() const;
+
+ SVX_DLLPRIVATE std::vector< SdrCustomShapeInteraction > GetInteractionHandles( const SdrObjCustomShape* pCustomShape ) const;
+
+ SVX_DLLPRIVATE void DragCreateObject( SdrDragStat& rDrag );
+
+ SVX_DLLPRIVATE void DragResizeCustomShape( const Rectangle& rNewRect, SdrObjCustomShape* pObj ) const;
+ SVX_DLLPRIVATE void DragMoveCustomShapeHdl( const Point aDestination, const sal_uInt16 nCustomShapeHdlNum, SdrObjCustomShape* pObj ) const;
+
+ // #i37011# centralize throw-away of render geometry
+ void InvalidateRenderGeometry();
+
+ // #i38892#
+ void ImpCheckCustomGluePointsAreAdded();
+
+ // returns the new text rect that corresponds to the current logic rect, the return value can be empty if nothing changed.
+ Rectangle ImpCalculateTextFrame( const FASTBOOL bHgt, const FASTBOOL bWdt );
+
+public:
+ // #i37011#
+ const SdrObject* GetSdrObjectFromCustomShape() const;
+ const SdrObject* GetSdrObjectShadowFromCustomShape() const;
+ sal_Bool GetTextBounds( Rectangle& rTextBound ) const;
+ sal_Bool IsTextPath() const;
+ static basegfx::B2DPolyPolygon GetLineGeometry( const SdrObjCustomShape* pCustomShape, const sal_Bool bBezierAllowed );
+
+protected:
+
+ String aName;
+
+public:
+
+ sal_Bool UseNoFillStyle() const;
+
+ sal_Bool IsMirroredX() const;
+ sal_Bool IsMirroredY() const;
+ void SetMirroredX( const sal_Bool bMirroredX );
+ void SetMirroredY( const sal_Bool bMirroredY );
+
+ double GetObjectRotation() const;
+ double GetExtraTextRotation() const;
+
+ TYPEINFO();
+ SdrObjCustomShape();
+ virtual ~SdrObjCustomShape();
+
+ /* is merging default attributes from type-shype into the SdrCustomShapeGeometryItem. If pType
+ is NULL then the type is being taken from the "Type" property of the SdrCustomShapeGeometryItem.
+ MergeDefaultAttributes is called when creating CustomShapes via UI and after importing */
+ void MergeDefaultAttributes( const rtl::OUString* pType = NULL );
+
+ /* the method is checking if the geometry data is unchanged/default, in this case the data might not be stored */
+ enum DefaultType
+ {
+ DEFAULT_PATH,
+ DEFAULT_VIEWBOX,
+ DEFAULT_SEGMENTS,
+ DEFAULT_GLUEPOINTS,
+ DEFAULT_STRETCHX,
+ DEFAULT_STRETCHY,
+ DEFAULT_EQUATIONS,
+ DEFAULT_HANDLES,
+ DEFAULT_TEXTFRAMES
+ };
+ sal_Bool IsDefaultGeometry( const DefaultType eDefaultType ) const;
+
+ virtual sal_uInt16 GetObjIdentifier() const;
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
+
+ virtual void SetModel(SdrModel* pNewModel);
+
+ virtual void RecalcSnapRect();
+
+ virtual const Rectangle& GetSnapRect() const;
+ virtual const Rectangle& GetCurrentBoundRect() const;
+ virtual const Rectangle& GetLogicRect() const;
+
+ virtual void Move(const Size& rSiz);
+ virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+ virtual void Shear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear);
+ virtual void SetSnapRect(const Rectangle& rRect);
+ virtual void SetLogicRect(const Rectangle& rRect);
+
+ virtual void NbcMove(const Size& rSiz);
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+ virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs);
+ virtual void NbcMirror(const Point& rRef1, const Point& rRef2);
+ virtual void NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear);
+ virtual void NbcSetSnapRect(const Rectangle& rRect);
+ virtual void NbcSetLogicRect(const Rectangle& rRect);
+
+ virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const;
+
+ virtual void NbcSetStyleSheet( SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr );
+
+ // special drag methods
+ virtual bool hasSpecialDrag() const;
+ virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
+ virtual bool applySpecialDrag(SdrDragStat& rDrag);
+
+ virtual FASTBOOL BegCreate( SdrDragStat& rStat );
+ virtual FASTBOOL MovCreate(SdrDragStat& rStat); // #i37448#
+ virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
+
+ virtual FASTBOOL AdjustTextFrameWidthAndHeight(Rectangle& rR, FASTBOOL bHgt=sal_True, FASTBOOL bWdt=sal_True) const;
+ virtual FASTBOOL NbcAdjustTextFrameWidthAndHeight(FASTBOOL bHgt=sal_True, FASTBOOL bWdt=sal_True);
+ virtual FASTBOOL AdjustTextFrameWidthAndHeight(FASTBOOL bHgt=sal_True, FASTBOOL bWdt=sal_True);
+ virtual FASTBOOL IsAutoGrowHeight() const;
+ virtual FASTBOOL IsAutoGrowWidth() const;
+ virtual void SetVerticalWriting( sal_Bool bVertical );
+ virtual sal_Bool BegTextEdit( SdrOutliner& rOutl );
+ virtual void TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle* pViewInit, Rectangle* pViewMin) const;
+ virtual void EndTextEdit( SdrOutliner& rOutl );
+ virtual void TakeTextAnchorRect( Rectangle& rAnchorRect ) const;
+ virtual void TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, FASTBOOL bNoEditText=sal_False,
+ Rectangle* pAnchorRect=NULL, sal_Bool bLineWidth=sal_True ) const;
+ virtual void operator=(const SdrObject& rObj);
+
+ virtual void TakeObjNameSingul(String& rName) const;
+ virtual void TakeObjNamePlural(String& rName) const;
+
+ virtual basegfx::B2DPolyPolygon TakeCreatePoly( const SdrDragStat& rDrag) const;
+
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
+ virtual basegfx::B2DPolyPolygon TakeContour() const;
+
+ virtual void NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject);
+
+ virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const;
+
+ virtual void SetPage( SdrPage* pNewPage );
+
+ virtual SdrObjGeoData *NewGeoData() const;
+ virtual void SaveGeoData(SdrObjGeoData &rGeo) const;
+ virtual void RestGeoData(const SdrObjGeoData &rGeo);
+
+ // need to take fObjectRotation instead of aGeo.nWink, replace it temporary
+ virtual sal_Bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const;
+ virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon);
+
+ virtual const SdrGluePointList* GetGluePointList() const;
+ //virtual SdrGluePointList* GetGluePointList();
+ virtual SdrGluePointList* ForceGluePointList();
+
+ virtual sal_uInt32 GetHdlCount() const;
+ virtual SdrHdl* GetHdl( sal_uInt32 nHdlNum ) const;
+
+ // #i33136#
+ static bool doConstructOrthogonal(const ::rtl::OUString& rName);
+
+ using SdrTextObj::NbcSetOutlinerParaObject;
+};
+
+#endif //_SVDOASHP_HXX
+
diff --git a/svx/inc/svx/svdoattr.hxx b/svx/inc/svx/svdoattr.hxx
new file mode 100644
index 000000000000..002a838284cb
--- /dev/null
+++ b/svx/inc/svx/svdoattr.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDOATTR_HXX
+#define _SVDOATTR_HXX
+
+#include <svx/xfillit0.hxx>
+#include <svx/xflasit.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/xlnasit.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdattr.hxx>
+#include "svx/svxdllapi.h"
+
+//************************************************************
+// Vorausdeklarationen
+//************************************************************
+
+class SfxPoolItem;
+class SfxSetItem;
+class SdrOutliner;
+class SfxItemSet;
+class SfxItemPool;
+
+//************************************************************
+// SdrAttrObj
+//************************************************************
+
+class SVX_DLLPUBLIC SdrAttrObj : public SdrObject
+{
+private:
+ friend class SdrOutliner;
+
+protected:
+ virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
+
+ Rectangle maSnapRect;
+
+protected:
+ // Strichstaerke ermitteln. Keine Linie -> 0.
+ sal_Int32 ImpGetLineWdt() const;
+
+ // Zuhoeren, ob sich ein StyleSheet aendert
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
+
+ SdrAttrObj();
+ virtual ~SdrAttrObj();
+
+public:
+ TYPEINFO();
+
+ // Feststellen, ob bFilledObj && Fuellung!=FillNone
+ sal_Bool HasFill() const;
+
+ // Feststellen, ob Linie!=LineNone
+ sal_Bool HasLine() const;
+
+ virtual const Rectangle& GetSnapRect() const;
+
+ virtual void SetModel(SdrModel* pNewModel);
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDOATTR_HXX
+
diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx
new file mode 100644
index 000000000000..86d6f0717bb7
--- /dev/null
+++ b/svx/inc/svx/svdobj.hxx
@@ -0,0 +1,1186 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDOBJ_HXX
+#define _SVDOBJ_HXX
+
+#include <memory>
+#include <cppuhelper/weakref.hxx>
+#include <vcl/mapmod.hxx>
+#include <tools/weakbase.hxx>
+#include <svl/lstner.hxx>
+#include <vcl/timer.hxx>
+#include <svx/svdsob.hxx>
+#include <svx/svdtypes.hxx> // fuer SdrLayerID
+#include <svx/svdglue.hxx> // Klebepunkte
+#include <svx/xdash.hxx>
+#include <svx/xpoly.hxx>
+#include <svx/xenum.hxx>
+#include <vcl/bitmapex.hxx>
+#include <svx/sdrobjectuser.hxx>
+#include "svx/svxdllapi.h"
+#include "svx/shapeproperty.hxx"
+
+//************************************************************
+// Vorausdeklarationen
+//************************************************************
+
+class SfxBroadcaster;
+class Pointer;
+class AutoTimer;
+class OutlinerParaObject;
+class SdrOutliner;
+class SdrDragStat;
+class SdrHdl;
+class SdrHdlList;
+class SdrItemPool;
+class SdrModel;
+class SdrObjList;
+class SdrObject;
+class SdrPage;
+class SdrPageView;
+class SdrView;
+class SfxItemSet;
+class SfxSetItem;
+class SfxStyleSheet;
+class SfxUndoAction;
+class XFillAttrSetItem;
+class XLineAttrSetItem;
+class SfxItemPool;
+class PolyPolygon;
+class SfxPoolItem;
+class SdrVirtObj;
+class SdrDragView;
+
+namespace sdr
+{
+ namespace properties
+ {
+ class BaseProperties;
+ } // end of namespace properties
+} // end of namespace sdr
+
+// #110094#
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewContact;
+ } // end of namespace contact
+} // end of namespace sdr
+
+namespace svx
+{
+ class PropertyChangeNotifier;
+}
+
+//************************************************************
+// Defines
+//************************************************************
+
+enum SdrObjKind {OBJ_NONE = 0, // Abstraktes Objekt (SdrObject)
+ OBJ_GRUP = 1, // Objektgruppe
+ OBJ_LINE = 2, // Strecke
+ OBJ_RECT = 3, // Rechteck ww. mit runden Ecken
+ OBJ_CIRC = 4, // Kreis, Ellipse
+ OBJ_SECT = 5, // Kreissektor
+ OBJ_CARC = 6, // Kreisbogen
+ OBJ_CCUT = 7, // Kreisabschnitt
+ OBJ_POLY = 8, // Polygon, PolyPolygon
+ OBJ_PLIN = 9, // PolyLine
+ OBJ_PATHLINE =10, // Offene Bezierkurve
+ OBJ_PATHFILL =11, // Geschlossene Bezierkurve
+ OBJ_FREELINE =12, // Offene Freihandlinie
+ OBJ_FREEFILL =13, // Geschlossene Freihandlinie
+ OBJ_SPLNLINE =14, // Natuerlicher kubischer Spline (ni)
+ OBJ_SPLNFILL =15, // Periodischer kubischer Spline (ni)
+ OBJ_TEXT =16, // Textobjekt
+ OBJ_TEXTEXT =17, // Texterweiterungsrahmen (ni)
+ OBJ_wegFITTEXT, // FitToSize-Text (alle Zeilen gleich)
+ OBJ_wegFITALLTEXT, // FitToSize-Text (Zeilenweise) (ni)
+ OBJ_TITLETEXT =20, // Titeltext. Spezial-Textobjekt fuer StarDraw
+ OBJ_OUTLINETEXT=21, // OutlineText. Spezial-Textobjekt fuer StarDraw
+ OBJ_GRAF =22, // Fremdgrafik - (StarView Graphic)
+ OBJ_OLE2 =23, // OLE-Objekt
+ OBJ_EDGE =24, // Verbindungsobjekt fuer Konnektoren
+ OBJ_CAPTION =25, // Legendenobjekt
+ OBJ_PATHPOLY =26, // Polygon/PolyPolygon dargestellt durch SdrPathObj
+ OBJ_PATHPLIN =27, // Polyline dargestellt durch SdrPathObj
+ OBJ_PAGE =28, // Objekt, das eine SdrPage darstellt
+ OBJ_MEASURE =29, // Bemassungsobjekt
+ OBJ_DUMMY =30, // Dummyobjekt zum speichern von Luecken (zur anschliessenden Wiederherstellung der Surrogate)
+ OBJ_FRAME =31, // staendig aktives OLE (PlugIn-Frame oder sowas)
+ OBJ_UNO =32, // Universal Network Object im SvDraw-Obj eingepackt
+ OBJ_CUSTOMSHAPE=33, // CustomShape
+ OBJ_MEDIA =34, // Media shape
+ OBJ_TABLE =35, // Table
+ OBJ_MAXI};
+
+enum SdrUserCallType {SDRUSERCALL_MOVEONLY, // Nur verschoben, Groesse unveraendert
+ SDRUSERCALL_RESIZE, // Groesse und evtl. auch Pos veraendert
+ SDRUSERCALL_CHGATTR, // Attribute veraendert. Moeglicherweise neue Groesse wg. Linienbreite
+ SDRUSERCALL_DELETE, // Obj gibt es gleich nicht mehr. Schon keine Attr mehr.
+ SDRUSERCALL_COPY, // Zuweisungsoperator gerufen. Kann alles geaendert sein
+ SDRUSERCALL_INSERTED, // In eine Objektliste (z.B. Page) eingefuegt
+ SDRUSERCALL_REMOVED, // Aus der Objektliste entfernt
+ SDRUSERCALL_CHILD_MOVEONLY, // Ein Child einer Gruppe hat sich veraendert
+ SDRUSERCALL_CHILD_RESIZE, // Ein Child einer Gruppe hat sich veraendert
+ SDRUSERCALL_CHILD_CHGATTR, // Ein Child einer Gruppe hat sich veraendert
+ SDRUSERCALL_CHILD_DELETE, // Ein Child einer Gruppe hat sich veraendert
+ SDRUSERCALL_CHILD_COPY, // Ein Child einer Gruppe hat sich veraendert
+ SDRUSERCALL_CHILD_INSERTED, // Ein Child einer Gruppe hat sich veraendert
+ SDRUSERCALL_CHILD_REMOVED}; // Ein Child einer Gruppe hat sich veraendert
+
+/* nur voruebergehend, weil sonst MUSS-Aenderung */
+// #define nLayerID nLayerId
+
+//************************************************************
+// Hilfsklasse SdrObjUserCall
+//************************************************************
+
+class SVX_DLLPUBLIC SdrObjUserCall
+{
+public:
+ TYPEINFO();
+ virtual ~SdrObjUserCall();
+ virtual void Changed(const SdrObject& rObj, SdrUserCallType eType, const Rectangle& rOldBoundRect);
+};
+
+//************************************************************
+// Hilfsklasse SdrObjMacroHitRec
+//************************************************************
+
+class SdrObjMacroHitRec
+{
+public:
+ Point aPos;
+ Point aDownPos;
+ OutputDevice* pOut;
+ const SetOfByte* pVisiLayer;
+ const SdrPageView* pPageView;
+ sal_uInt16 nTol;
+ FASTBOOL bDown;
+
+public:
+ SdrObjMacroHitRec()
+ : pOut(NULL),
+ pVisiLayer(NULL),
+ pPageView(NULL),
+ nTol(0),
+ bDown(sal_False)
+ {}
+};
+
+//************************************************************
+// Hilfsklasse SdrObjUserData
+//
+// Anwenderdaten an einem Zeichenobjekt, z.B. applikationsspezifische Daten.
+// Jedes Zeichenobjekt kann beliebig viele dieser Records haben (SV-Liste).
+// Wer hier Daten halten will, muss sich ableiten und auch an der Factory
+// einen entsprechenden Link setzen.
+//
+//************************************************************
+
+class SVX_DLLPUBLIC SdrObjUserData
+{
+protected:
+ sal_uInt32 nInventor;
+ sal_uInt16 nIdentifier;
+ sal_uInt16 nVersion;
+
+private:
+ SVX_DLLPRIVATE void operator=(const SdrObjUserData& rData); // nicht implementiert
+ SVX_DLLPRIVATE sal_Bool operator==(const SdrObjUserData& rData) const; // nicht implementiert
+ SVX_DLLPRIVATE sal_Bool operator!=(const SdrObjUserData& rData) const; // nicht implementiert
+
+public:
+ TYPEINFO();
+
+ SdrObjUserData(sal_uInt32 nInv, sal_uInt16 nId, sal_uInt16 nVer)
+ : nInventor(nInv),
+ nIdentifier(nId),
+ nVersion(nVer)
+ {}
+ SdrObjUserData(const SdrObjUserData& rData)
+ : nInventor(rData.nInventor),
+ nIdentifier(rData.nIdentifier),
+ nVersion(rData.nVersion)
+ {}
+ virtual ~SdrObjUserData();
+
+ virtual SdrObjUserData* Clone(SdrObject* pObj1) const = 0; // #i71039# NULL -> 0
+ sal_uInt32 GetInventor() const { return nInventor; }
+ sal_uInt16 GetId() const { return nIdentifier; }
+
+ virtual FASTBOOL HasMacro (const SdrObject* pObj) const;
+ virtual SdrObject* CheckMacroHit (const SdrObjMacroHitRec& rRec, const SdrObject* pObj) const;
+ virtual Pointer GetMacroPointer (const SdrObjMacroHitRec& rRec, const SdrObject* pObj) const;
+ virtual void PaintMacro (OutputDevice& rOut, const Rectangle& rDirtyRect, const SdrObjMacroHitRec& rRec, const SdrObject* pObj) const;
+ virtual FASTBOOL DoMacro (const SdrObjMacroHitRec& rRec, SdrObject* pObj);
+ virtual XubString GetMacroPopupComment(const SdrObjMacroHitRec& rRec, const SdrObject* pObj) const;
+};
+
+//************************************************************
+// Hilfsklasse SdrObjUserDataList
+//************************************************************
+
+class SdrObjUserDataList
+{
+ Container aList;
+
+public:
+ SdrObjUserDataList()
+ : aList(1024,4,4)
+ {}
+ ~SdrObjUserDataList() { Clear(); }
+
+ void Clear();
+ sal_uInt16 GetUserDataCount() const { return sal_uInt16(aList.Count()); }
+ SdrObjUserData* GetUserData(sal_uInt16 nNum) const { return (SdrObjUserData*)aList.GetObject(nNum); }
+ void InsertUserData(SdrObjUserData* pData, sal_uInt16 nPos=0xFFFF) { aList.Insert(pData,nPos); }
+ SdrObjUserData* RemoveUserData(sal_uInt16 nNum) { return (SdrObjUserData*)aList.Remove(nNum);}
+ void DeleteUserData(sal_uInt16 nNum) { delete RemoveUserData(nNum); }
+};
+
+//************************************************************
+// Hilfsklasse SdrObjGeoData
+//
+// Alle geometrischen Daten eines beliebigen Objektes zur Übergabe an's Undo/Redo
+//
+//************************************************************
+
+class SVX_DLLPUBLIC SdrObjGeoData
+{
+public:
+ Rectangle aBoundRect;
+ Point aAnchor;
+ SdrGluePointList* pGPL;
+ sal_Bool bMovProt;
+ sal_Bool bSizProt;
+ sal_Bool bNoPrint;
+ sal_Bool bClosedObj;
+ bool mbVisible;
+ SdrLayerID mnLayerID;
+
+public:
+ SdrObjGeoData();
+ virtual ~SdrObjGeoData();
+};
+
+//************************************************************
+// Hilfsklasse SdrObjPlusData
+//
+// Bitsack fuer DrawObjekte
+//
+//************************************************************
+
+class SdrObjPlusData
+{
+ friend class SdrObject;
+
+public:
+ SfxBroadcaster* pBroadcast; // Broadcaster, falls dieses Obj referenziert wird (bVirtObj=sal_True). Auch fuer Konnektoren etc.
+ SdrObjUserDataList* pUserDataList; // applikationsspeziefische Daten
+ SdrGluePointList* pGluePoints; // Klebepunkte zum Ankleben von Objektverbindern
+ AutoTimer* pAutoTimer;
+
+ // #i68101#
+ // object name, title and description
+ String aObjName;
+ String aObjTitle;
+ String aObjDescription;
+
+ // Name to be used by applications
+ XubString aHTMLName;
+
+public:
+ TYPEINFO();
+ SdrObjPlusData();
+ virtual ~SdrObjPlusData();
+ virtual SdrObjPlusData* Clone(SdrObject* pObj1) const;
+};
+
+//************************************************************
+// Hilfsklasse SdrObjTransformInfoRec
+//
+// gibt Auskunft ueber verschiedene Eigenschaften eines ZObjects
+//
+//************************************************************
+
+class SdrObjTransformInfoRec
+{
+public:
+ unsigned bSelectAllowed : 1; // sal_False=Obj kann nicht selektiert werden
+ unsigned bMoveAllowed : 1; // sal_False=Obj kann nicht verschoben werden
+ unsigned bResizeFreeAllowed : 1; // sal_False=Obj kann nicht frei resized werden
+ unsigned bResizePropAllowed : 1; // sal_False=Obj kann nichtmal proportional resized werden
+ unsigned bRotateFreeAllowed : 1; // sal_False=Obj kann nicht frei gedreht werden
+ unsigned bRotate90Allowed : 1; // sal_False=Obj kann nichtmal im 90deg Raster gedreht werden
+ unsigned bMirrorFreeAllowed : 1; // sal_False=Obj kann nicht frei gespiegelt werden
+ unsigned bMirror45Allowed : 1; // sal_False=Obj kann nichtmal ueber Achse im 45deg Raster gespiegelt werden
+ unsigned bMirror90Allowed : 1; // sal_False=Obj kann ebenfalls nicht ueber Achse im 90deg Raster gespiegelt werden
+ unsigned bTransparenceAllowed : 1; // sal_False=Obj does not have an interactive transparence control
+ unsigned bGradientAllowed : 1; // sal_False=Obj dooes not have an interactive gradient control
+ unsigned bShearAllowed : 1; // sal_False=Obj kann nicht verzerrt werden
+ unsigned bEdgeRadiusAllowed : 1;
+ unsigned bNoOrthoDesired : 1; // sal_True bei Rect; ... sal_False bei BMP,MTF;
+ unsigned bNoContortion : 1; // sal_False=Kein verzerren (bei Crook) moeglich (nur sal_True bei PathObj und Gruppierten PathObjs)
+ unsigned bCanConvToPath : 1; // sal_False=Keine Konvertierung in PathObj moeglich
+ unsigned bCanConvToPoly : 1; // sal_False=Keine Konvertierung in PolyObj moeglich
+ unsigned bCanConvToContour : 1; // sal_False=no conversion down to whole contour possible
+ unsigned bCanConvToPathLineToArea : 1; // sal_False=Keine Konvertierung in PathObj moeglich mit Wandlung von LineToArea
+ unsigned bCanConvToPolyLineToArea : 1; // sal_False=Keine Konvertierung in PolyObj moeglich mit Wandlung von LineToArea
+
+public:
+ SdrObjTransformInfoRec()
+ : bSelectAllowed(sal_True),
+ bMoveAllowed(sal_True),
+ bResizeFreeAllowed(sal_True),
+ bResizePropAllowed(sal_True),
+ bRotateFreeAllowed(sal_True),
+ bRotate90Allowed(sal_True),
+ bMirrorFreeAllowed(sal_True),
+ bMirror45Allowed(sal_True),
+ bMirror90Allowed(sal_True),
+ bTransparenceAllowed(sal_True),
+ bGradientAllowed(sal_True),
+ bShearAllowed(sal_True),
+ bEdgeRadiusAllowed(sal_True),
+ bNoOrthoDesired(sal_True),
+ bNoContortion(sal_True),
+ bCanConvToPath(sal_True),
+ bCanConvToPoly(sal_True),
+ bCanConvToContour(sal_False),
+ bCanConvToPathLineToArea(sal_True),
+ bCanConvToPolyLineToArea(sal_True)
+ {}
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// To make things more safe, allow users of the object to register at it. The users need to be derived
+// from SdrObjectUser to get a call. The users do not need to call RemoveObjectUser() at the object
+// when they get called from PageInDestruction().
+class SdrObject;
+
+class SdrObjectUser
+{
+public:
+ virtual void ObjectInDestruction(const SdrObject& rObject) = 0;
+};
+
+// typedef for GetParentContacts()
+typedef ::std::vector< SdrObjectUser* > ObjectUserVector;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@ @@@@@ @@@@@@ @@@@@ @@@@ @@@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@@@@ @@ @@@@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@@@ @@@@@ @@@@ @@@@@ @@@@ @@
+//
+// Abstraktes DrawObject
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class SvxShape;
+class SVX_DLLPUBLIC SdrObject: public SfxListener, public tools::WeakBase< SdrObject >
+{
+private:
+ // ObjectUser section
+ sdr::ObjectUserVector maObjectUsers;
+
+public:
+ void AddObjectUser(sdr::ObjectUser& rNewUser);
+ void RemoveObjectUser(sdr::ObjectUser& rOldUser);
+
+ // BaseProperties section
+private:
+ sdr::properties::BaseProperties* mpProperties;
+protected:
+ virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
+public:
+ virtual sdr::properties::BaseProperties& GetProperties() const;
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // #110094# DrawContact section
+private:
+ sdr::contact::ViewContact* mpViewContact;
+protected:
+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+public:
+ sdr::contact::ViewContact& GetViewContact() const;
+
+ // DrawContact support: Methods for handling Object changes
+ void ActionChanged() const;
+
+private:
+ friend class SdrObjListIter;
+ friend class SdrVirtObj;
+ friend class SdrRectObj;
+
+protected:
+ Rectangle aOutRect; // umschliessendes Rechteck fuer Paint (inkl. LineWdt, ...)
+ Point aAnchor; // Ankerposition (Writer)
+ SdrObjList* pObjList; // Liste, in dem das Obj eingefuegt ist.
+ SdrPage* pPage;
+ SdrModel* pModel;
+ SdrObjUserCall* pUserCall;
+ SdrObjPlusData* pPlusData; // Broadcaster, UserData, Konnektoren, ... (Das ist der Bitsack)
+
+ sal_uInt32 nOrdNum; // Rangnummer des Obj in der Liste
+
+ /** Position in the navigation order. SAL_MAX_UINT32 when not used.
+ */
+ sal_uInt32 mnNavigationPosition;
+ SdrLayerID mnLayerID;
+
+ // Objekt zeigt nur auf ein Anderes
+ unsigned bVirtObj : 1;
+ unsigned bSnapRectDirty : 1;
+ unsigned bNetLock : 1; // ni
+ unsigned bInserted : 1; // nur wenn sal_True gibt's RepaintBroadcast & SetModify
+ unsigned bGrouped : 1; // Member eines GroupObjektes?
+
+ // Die folgende Flags werden gestreamt
+ unsigned bMovProt : 1; // If true, the position is protected
+ unsigned bSizProt : 1; // If true, the size is protected
+ unsigned bNoPrint : 1; // If true, the object is not printed.
+ unsigned mbVisible : 1; // If false, the object is not visible on screen (but maybe on printer, depending on bNoprint
+ // Wenn bEmptyPresObj sal_True ist, handelt es sich um ein
+ // Praesentationsobjekt, dem noch kein Inhalt zugewiesen
+ // wurde. Default ist das Flag auf FALSE. Die Verwaltung
+ // uebernimmt die Applikation. Im Zuweisungsoperator sowie
+ // beim Clone wird das Flag nicht mitkopiert!
+ // Das Flag ist persistent.
+ unsigned bEmptyPresObj : 1; // Leeres Praesentationsobjekt (Draw)
+
+ // sal_True=Objekt ist als Objekt der MasterPage nicht sichtbar
+ unsigned bNotVisibleAsMaster : 1;
+
+ // sal_True=Es handelt sich hierbei um ein geschlossenes Objekt, also nicht Linie oder Kreisbogen ...
+ unsigned bClosedObj : 1;
+
+ unsigned bIsEdge : 1;
+ unsigned bIs3DObj : 1;
+ unsigned bMarkProt : 1; // Markieren verboten. Persistent
+ unsigned bIsUnoObj : 1;
+ unsigned bNotMasterCachable : 1;
+
+ // #i25616#
+ unsigned mbLineIsOutsideGeometry : 1;
+
+ // #i25616#
+ unsigned mbSupportTextIndentingOnLineWidthChange : 1;
+
+ // on import of OLE object from MS documents the BLIP size might be retrieved,
+ // in this case the following member is initialized as nonempty rectangle
+ Rectangle maBLIPSizeRectangle;
+
+ // global static ItemPool for not-yet-insetred items
+private:
+ static SdrItemPool* mpGlobalItemPool;
+public:
+ static SdrItemPool& GetGlobalDrawObjectItemPool();
+private:
+ SVX_DLLPRIVATE static void FreeGlobalDrawObjectItemPool();
+
+protected:
+ void ImpDeleteUserData();
+ SdrObjUserData* ImpGetMacroUserData() const;
+ Rectangle ImpDragCalcRect(const SdrDragStat& rDrag) const;
+
+ // Fuer GetDragComment
+ void ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, String& rStr, sal_uInt16 nVal=0) const;
+
+ void ImpForcePlusData() { if (pPlusData==NULL) pPlusData=NewPlusData(); }
+
+ String GetWinkStr(long nWink, FASTBOOL bNoDegChar=sal_False) const;
+ String GetMetrStr(long nVal, MapUnit eWantMap=MAP_MM, FASTBOOL bNoUnitChars=sal_False) const;
+
+ // bNotMyself=sal_True bedeutet: Nur die ObjList auf Dirty setzen, nicht mich.
+ // Wird z.B. benoetigt fuer NbcMove, denn da movt man SnapRect und aOutRect
+ // i.d.R. gleich mit um die Neuberechnung zu sparen.
+public:
+ virtual void SetRectsDirty(sal_Bool bNotMyself = sal_False);
+protected:
+
+ // ueberladen, wenn man sich von SdrObjPlusData abgeleitet hat:
+ virtual SdrObjPlusData* NewPlusData() const;
+
+protected:
+ // Diese 3 Methoden muss ein abgeleitetes Objekt ueberladen, wenn es eigene
+ // geometrische Daten besitzt, die fuer den Undo-Fall gesichert werden
+ // sollen. NewGeoData() erzeugt lediglich eine leere Instanz auf eine von
+ // SdrObjGeoData abgeleitete Klasse.
+ virtual SdrObjGeoData* NewGeoData() const;
+ virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
+ virtual void RestGeoData(const SdrObjGeoData& rGeo);
+
+protected:
+ virtual ~SdrObject();
+
+public:
+ TYPEINFO();
+ SdrObject();
+
+ /** fres the SdrObject pointed to by the argument
+
+ In case the object has an SvxShape, which has the ownership of the object, it
+ is actually *not* deleted.
+ */
+ static void Free( SdrObject*& _rpObject );
+
+ // This method is only for access from Property objects
+ virtual void SetBoundRectDirty();
+
+ virtual void SetObjList(SdrObjList* pNewObjList);
+ SdrObjList* GetObjList() const { return pObjList; }
+
+ virtual void SetPage(SdrPage* pNewPage);
+ SdrPage* GetPage() const { return pPage; }
+
+ virtual void SetModel(SdrModel* pNewModel);
+ SdrModel* GetModel() const { return pModel; }
+ SdrItemPool* GetObjectItemPool() const;
+
+ void AddListener(SfxListener& rListener);
+ void RemoveListener(SfxListener& rListener);
+ const SfxBroadcaster* GetBroadcaster() const { return pPlusData!=NULL ? pPlusData->pBroadcast : NULL; }
+
+ virtual void AddReference(SdrVirtObj& rVrtObj);
+ virtual void DelReference(SdrVirtObj& rVrtObj);
+ virtual sal_uInt32 GetObjInventor() const;
+ virtual sal_uInt16 GetObjIdentifier() const;
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
+
+ // Layer interface
+ virtual SdrLayerID GetLayer() const;
+ virtual void NbcSetLayer(SdrLayerID nLayer);
+ virtual void SetLayer(SdrLayerID nLayer);
+ // renaming GetLayerSet -> getMergedHierarchyLayerSet to make clear what happens here. rSet needs to be empty.
+ virtual void getMergedHierarchyLayerSet(SetOfByte& rSet) const;
+
+ // UserCall interface
+ void SetUserCall(SdrObjUserCall* pUser) { pUserCall=pUser; }
+ SdrObjUserCall* GetUserCall() const { return pUserCall; }
+ void SendUserCall(SdrUserCallType eUserCall, const Rectangle& rBoundRect) const;
+
+ // Ein solcher Referenzpunkt ist z.B. der Punkt eines Symbols, der
+ // der beim Einfuegen des Symbols auf das Raster gefangen werden soll
+ // oder der Fixpunkt eines Bildes innerhalb eines Animationsobjektes.
+ virtual FASTBOOL HasRefPoint() const;
+ virtual Point GetRefPoint() const;
+ virtual void SetRefPoint(const Point& rPnt);
+
+ // #i68101#
+ // An object may have a user-set Name (Get/SetName()), e.g SdrGrafObj, SdrObjGroup
+ // or SdrOle2Obj.
+ // It may also have a Title and a Description for accessibility purposes.
+ void SetName(const String& rStr);
+ String GetName() const;
+ void SetTitle(const String& rStr);
+ String GetTitle() const;
+ void SetDescription(const String& rStr);
+ String GetDescription() const;
+
+ // support for HTMLName
+ void SetHTMLName(const String& rStr);
+ String GetHTMLName() const;
+
+ // Fuer Gruppenobjekte
+ sal_Bool IsGroupObject() const { return GetSubList()!=NULL; }
+ virtual SdrObjList* GetSubList() const;
+ SdrObject* GetUpGroup() const;
+
+ // Ueber die Objekt-Ordnungsnummer kann man feststellen, ob ein Objekt vor
+ // oder hinter einem anderen liegt. Objekte mit kleinen Ordnungsnummern werden
+ // zuerst gezeichnet, Objekte mit grossen Ordnungsnummern zuletzt.
+ // Wird die Reihenfolge der Objekte in der Liste veraendert, so wird ein
+ // Dirty-Flag gesetzt (an der Page). Beim naechsten SdrObject::GetOrdNum()
+ // werden die Ordnungsnummer aller Objekte der Liste neu bestimmt.
+ sal_uInt32 GetOrdNum() const;
+
+ // Diese Methode sollte nur verwendet werden, wenn man ganz genau weiss,
+ // was man macht:
+ sal_uInt32 GetOrdNumDirect() const { return nOrdNum; }
+
+ // Das Setzen der Ordnungsnummer sollte nur vom Model bzw. von der Page
+ // geschehen.
+ void SetOrdNum(sal_uInt32 nNum) { nOrdNum=nNum; }
+
+ /** Return the position in the navigation order for the called object.
+ Note that this method may update the navigation position of the
+ called and of other SdrObjects. Therefore this method can not be
+ const.
+ @return
+ If no navigation position has been explicitly defined then the
+ result of GetOrdNum() is returned.
+ */
+ sal_uInt32 GetNavigationPosition (void);
+
+ /** Set the position in the navigation position to the given value.
+ This method is typically used only by the model after a change to
+ the navigation order.
+ This method does not change the navigation position of other
+ objects.
+ Use SdrObjList::SetObjectNavigationPosition() instead.
+ */
+ void SetNavigationPosition (const sal_uInt32 nPosition);
+
+ const AutoTimer* GetAutoTimer() const { return pPlusData!=NULL ? pPlusData->pAutoTimer : NULL; }
+ AutoTimer* GetAutoTimer() { return pPlusData!=NULL ? pPlusData->pAutoTimer : NULL; }
+ AutoTimer* ForceAutoTimer();
+
+ // #111111#
+ // To make clearer that this method may trigger RecalcBoundRect and thus may be
+ // expensive and somtimes problematic (inside a bigger object change You will get
+ // non-useful BoundRects sometimes) i rename that method from GetBoundRect() to
+ // GetCurrentBoundRect().
+ virtual const Rectangle& GetCurrentBoundRect() const;
+
+ // #111111#
+ // To have a possibility to get the last calculated BoundRect e.g for producing
+ // the first rectangle for repaints (old and new need to be used) without forcing
+ // a RecalcBoundRect (which may be problematical and expensive sometimes) i add here
+ // a new method for accessing the last BoundRect.
+ virtual const Rectangle& GetLastBoundRect() const;
+
+ virtual void RecalcBoundRect();
+
+ void BroadcastObjectChange() const;
+
+ // Modified-Flag am Model setzen
+ virtual void SetChanged();
+
+ // 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;
+ sal_Bool LineGeometryUsageIsNecessary() const;
+
+ // Clone() soll eine komplette Kopie des Objektes erzeugen.
+ virtual SdrObject* Clone() const;
+ virtual void operator=(const SdrObject& rObj);
+
+ // TakeObjName...() ist fuer die Anzeige in der UI, z.B. "3 Rahmen selektiert".
+ virtual void TakeObjNameSingul(String& rName) const;
+ virtual void TakeObjNamePlural(String& rName) const;
+
+ // Das Xor-Polygon wird von der View zu Draggen des Objektes benoetigt.
+ // Alle Polygone innerhalb des PolyPolygon werden als PolyLine interpretiert.
+ // Moechte man ein geschlossenes Polygon, so muss man es explizit schliessen.
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
+
+ // Die Kontur fuer TextToContour
+ virtual basegfx::B2DPolyPolygon TakeContour() const;
+
+ // Ueber GetHdlCount gibt ein Objekt die Anzahl seiner Handles preis.
+ // Im Normalfall werden dies 8 sein, bei einer Strecke 2. Bei Polygonobjekten
+ // (Polygon,Spline,Bezier) kann die Handleanzahl wesentlich groesser werden.
+ // Polygonobjekten wird ausserdem die Moeglichkeit eingeraeumt einen Punkt
+ // eines selektierten Objekts zu selektieren. Das Handle dieses Punktes wird
+ // dann durch einen Satz neuer Handles ausgetauscht (PlusHdl). Bei einem
+ // Polygon wird das wohl ein einfacher Selektionshandle sein, bei einer
+ // Bezierkurve dagegen koennen das schon bis zu 3 Handles werden (inkl Gewichte).
+ // GetHdl() und GetPlusHdl() muessen Handleinstanzen mit new erzeugen!
+ // Ein Objekt, das bei HasSpacialDrag() sal_True liefert muss diese Methoden
+ // zur Verfuegung stellen (inkl. FillHdlList).
+ virtual sal_uInt32 GetHdlCount() const;
+ virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
+ virtual sal_uInt32 GetPlusHdlCount(const SdrHdl& rHdl) const;
+ virtual SdrHdl* GetPlusHdl(const SdrHdl& rHdl, sal_uInt32 nPlNum) const;
+ virtual void AddToHdlList(SdrHdlList& rHdlList) const;
+
+ // Die Standardtransformationen (Move,Resize,Rotate,Mirror,Shear) werden von der
+ // View uebernommen (TakeXorPoly(),...).
+ // Objektspeziefisches draggen wie z.B. Eckenradius bei Rechtecken,
+ // Stuetzstellen bei Splines, Gewichte bei Bezierkurven und Pointer von
+ // Labelobjekten muss vom Objekt selbst gehandled werden. Um das Model
+ // Statusfrei zu halten werden die Statusdaten an der View gehalten und dem
+ // Objekt dann uebergeben. EndDrag liefrt im Normalfall sal_True fuer Erfolg.
+ // sal_False kann zurueckgegeben werden, wenn das Dragging das Objekt nicht
+ // veraendert hat, wobei dir evtl. Tatsache das die Maus nicht bewegt wurde
+ // bereits von der View abgefangen wird.
+ virtual bool hasSpecialDrag() const;
+ virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
+ virtual bool applySpecialDrag(SdrDragStat& rDrag);
+ virtual String getSpecialDragComment(const SdrDragStat& rDrag) const;
+ virtual basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat& rDrag) const;
+
+ // FullDrag support. This is for standard interactions and for SdrObjOwn
+ // support. If supportsFullDrag() returns true, getFullDragClone has to
+ // return a cloned SdrObject (who's ownership it loses) at which modifications
+ // like Move(), Scale(), etc or applySpecialDrag() will be executed. That
+ // object will be visualized on overlay for full drag, but should not be
+ // part of the model, thus not changing anything since it's only a temporary
+ // helper object for interaction
+ virtual bool supportsFullDrag() const;
+ virtual SdrObject* getFullDragClone() const;
+
+ // Jedes Objekt muss in der Lage sein sich selbst interaktiv zu erzeugen.
+ // Beim MausDown wird zunaechst ein neues Objekt erzeugt und dann seine
+ // BegCreate()-Methode gerufen. Bei jedem MausMode wird dann MovCreate
+ // gerufen. BrkCreate() bedeutet, dass der User die interaktive Objekt-
+ // erzeugung abgebrochen hat. EndCreate() wird gerufen beim MouseUp-Event.
+ // Liefert EndCreate() ein sal_True, so ist die Objekterzeugung abgeschlossen;
+ // das Objekt wird in die entsprechende Liste eingefuegt. Andernfalls
+ // (EndCreate()==sal_False) gehe ich davon aus, dass weitere Punkte zur
+ // Objekterzeugung notwendig sind (Polygon,...). Der Parameter eCmd
+ // enthaelt die Anzahl der Mausklicks (so die App diese durchreicht).
+ // BckCreate() -> Letztes EndCreate() rueckgaengig machen (z.B. letzten
+ // Polygonpunkt wieder loeschen).
+ // RetrunCode: sal_True=Weiter gehts, sal_False=Create dadurch abgebrochen.
+ virtual FASTBOOL BegCreate(SdrDragStat& rStat);
+ virtual FASTBOOL MovCreate(SdrDragStat& rStat); // sal_True=Xor muss repainted werden
+ virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
+ virtual FASTBOOL BckCreate(SdrDragStat& rStat);
+ virtual void BrkCreate(SdrDragStat& rStat);
+
+ // damit holt man sich den Pointer, der das Createn dieses Objekts symbolisiert
+ virtual Pointer GetCreatePointer() const;
+
+ // Polygon das waehrend des Erzeugens aufgezogen wird
+ virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const;
+
+ // Die Methoden Move, Resize, Rotate, Mirror, Shear, SetSnapRect und
+ // SetLogicRect rufen jeweils die entsprechenden Nbc-Methoden, versenden einen
+ // Repaint-Broadcast und setzen den Modified-Status am Model. Abgeleitete
+ // Objekte sollten i.d.R. nur die Nbc-Methoden ueberladen.
+ // Nbc bedeutet: 'NoBroadcast'.
+ virtual void NbcMove (const Size& rSiz);
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+ virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs);
+ virtual void NbcMirror(const Point& rRef1, const Point& rRef2);
+ virtual void NbcShear (const Point& rRef, long nWink, double tn, FASTBOOL bVShear);
+
+ virtual void Move (const Size& rSiz);
+ virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+ virtual void Rotate(const Point& rRef, long nWink, double sn, double cs);
+ virtual void Mirror(const Point& rRef1, const Point& rRef2);
+ virtual void Shear (const Point& rRef, long nWink, double tn, FASTBOOL bVShear);
+
+ // Die relative Position eines Zeichenobjektes ist die Entfernung der
+ // linken oberen Eche des logisch umschliessenden Rechtecks (SnapRect)
+ // zum Anker.
+ virtual void NbcSetRelativePos(const Point& rPnt);
+ virtual void SetRelativePos(const Point& rPnt);
+ virtual Point GetRelativePos() const;
+ void ImpSetAnchorPos(const Point& rPnt) { aAnchor=rPnt; }
+ virtual void NbcSetAnchorPos(const Point& rPnt);
+ virtual void SetAnchorPos(const Point& rPnt);
+ virtual const Point& GetAnchorPos() const;
+
+ // Snap wird nicht auf dem BoundRect ausgefuehrt, sondern nach Moeglichkeit auf
+ // logischen Koordinaten (also ohne Beruecksichtigung von Strichstaerke, ... ).
+ // SetSnapRect() versucht das Objekt so hinzusizen, dass es in das uebergebene
+ // Rect passt (ohne Strichstaerke, ...)
+ virtual void RecalcSnapRect();
+ virtual const Rectangle& GetSnapRect() const;
+ virtual void SetSnapRect(const Rectangle& rRect);
+ virtual void NbcSetSnapRect(const Rectangle& rRect);
+
+ // Logic Rect: Beim Rect z.B. ohne Beruecksichtigung des Drehwinkels, Shear, ...
+ virtual const Rectangle& GetLogicRect() const;
+ virtual void SetLogicRect(const Rectangle& rRect);
+ virtual void NbcSetLogicRect(const Rectangle& rRect);
+
+ /** the defaul is to set the logic rect to the given rectangle rMaxRect. If the shape
+ has an intrinsic aspect ratio it may set the logic rect so the aspect
+ ratio is kept but still inside the rectangle rMaxRect.
+
+ If bShrinkOnly is set to true, the size of the current logic rect will not
+ be changed if it is smaller than the given rectangle rMaxRect. */
+ virtual void AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly = false );
+
+ // Drehwinkel und Shear
+ virtual long GetRotateAngle() const;
+ virtual long GetShearAngle(FASTBOOL bVertical=sal_False) const;
+
+ // Zum Fangen von/auf ausgezeichneten Punkten eines Obj (Polygonpunkte,
+ // Kreismittelpunkt, ...)
+ virtual sal_uInt32 GetSnapPointCount() const;
+ virtual Point GetSnapPoint(sal_uInt32 i) const;
+
+ // Fuer Objekte, bei denen jeder einzelne Punkt verschoben werden kann,
+ // z.B. Polygone, Polylines, Linien, ... . Bei diesen Objekten werden
+ // Punkte selektiert (ggf. Mehrfachselektion), geloescht, eingefuegt,
+ // als Mehrfachselektion verschoben und gedreht, ...
+ // Nur solche Objekte koennen PlusHandles haben (z.B. die Gewichte an den
+ // Bezierkurven.
+ virtual sal_Bool IsPolyObj() const;
+ virtual sal_uInt32 GetPointCount() const;
+ virtual Point GetPoint(sal_uInt32 i) const;
+ void SetPoint(const Point& rPnt, sal_uInt32 i);
+ virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 i);
+
+ // Alle geometrischen Daten holen fuer's Undo/Redo
+ virtual SdrObjGeoData* GetGeoData() const;
+ virtual void SetGeoData(const SdrObjGeoData& rGeo);
+
+ // ItemSet access
+ const SfxItemSet& GetMergedItemSet() const;
+ void SetMergedItem(const SfxPoolItem& rItem);
+ void ClearMergedItem(const sal_uInt16 nWhich = 0);
+ void SetMergedItemSet(const SfxItemSet& rSet, sal_Bool bClearAllItems = sal_False);
+ const SfxPoolItem& GetMergedItem(const sal_uInt16 nWhich) const;
+
+ // internal versions
+protected:
+ const SfxItemSet& GetObjectItemSet() const;
+ void SetObjectItem(const SfxPoolItem& rItem);
+ void ClearObjectItem(const sal_uInt16 nWhich = 0);
+ void SetObjectItemSet(const SfxItemSet& rSet);
+ const SfxPoolItem& GetObjectItem(const sal_uInt16 nWhich) const;
+
+public:
+ // syntactical sugar for ItemSet accesses
+ void SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, sal_Bool bClearAllItems = sal_False);
+
+ // NotPersistAttr fuer Layer, ObjName, geometrische Transformationen, ...
+ void TakeNotPersistAttr(SfxItemSet& rAttr, FASTBOOL bMerge) const;
+ void ApplyNotPersistAttr(const SfxItemSet& rAttr);
+ void NbcApplyNotPersistAttr(const SfxItemSet& rAttr);
+
+ // bDontRemoveHardAttr=FALSE: alle in der Vorlage gesetzten Attribute werden am
+ // Zeichenobjekt auf Default gesetzt; TRUE: alle harten Attribute bleiben erhalten.
+ void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr);
+ virtual void NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr);
+ SfxStyleSheet* GetStyleSheet() const;
+
+ // TextEdit
+ virtual FASTBOOL HasTextEdit() const;
+
+ // Return==TRUE: TextEditMode gestartet
+ virtual sal_Bool BegTextEdit(SdrOutliner& rOutl);
+ virtual void EndTextEdit(SdrOutliner& rOutl);
+
+ // Text wird im Format des Outliners gehalten
+ // SetOutlinerParaObject: Eigentumsuebereignung von *pTextObject!
+ virtual void SetOutlinerParaObject(OutlinerParaObject* pTextObject);
+ virtual void NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject);
+ virtual OutlinerParaObject* GetOutlinerParaObject() const;
+ virtual void NbcReformatText();
+ virtual void ReformatText();
+
+ void BurnInStyleSheetAttributes();
+
+ // Macrofaehigkeit, z.B. ein Rechteck als PushButton.
+ virtual FASTBOOL HasMacro() const;
+ virtual SdrObject* CheckMacroHit (const SdrObjMacroHitRec& rRec) const;
+ virtual Pointer GetMacroPointer (const SdrObjMacroHitRec& rRec) const;
+ virtual void PaintMacro (OutputDevice& rOut, const Rectangle& rDirtyRect, const SdrObjMacroHitRec& rRec) const;
+ virtual FASTBOOL DoMacro (const SdrObjMacroHitRec& rRec);
+ virtual XubString GetMacroPopupComment(const SdrObjMacroHitRec& rRec) const;
+ sal_Bool IsMacroHit(const SdrObjMacroHitRec& rRec) const { return CheckMacroHit(rRec)!=NULL; }
+
+ // Konnektoren. (siehe auch Dokumentation in SvdoEdge.HXX, SdrEdgeObj
+ // sowie SvdGlue.HXX und SvdGlEV.HXX)
+ // Es gibt Knoten und Kanten. Eine Kante kann theoretisch auch Knoten
+ // sein, das ist jedoch in dieser Version noch nicht implementiert.
+ // Ein Knoten hat eine Anzahl von Klebepunkten, wo Kanten angeklebt
+ // werden koennen.
+ // Eine Kante kann
+ // - ohne Verbindungen sein
+ // - an einem Ende auf der Wiese stehen und am anderen Ende an
+ // genau einem Knoten gebunden sein
+ // - an beiden Enden mit jeweils genau einem Knoten verbunden sein.
+ // Die Kante ist Listener bei seinen bis zu 2 Knoten.
+ // Wird der Knoten verschoben oder Resized, folgen alle angebundenen
+ // Kanten. Ebenso bei SetGluePoint()... am Knoten.
+ // Beim Verschieben/Resizen der Kante wird dagegen die Verbindung
+ // geloesst.
+ // Objekt ist ein Knoten?
+ virtual FASTBOOL IsNode() const;
+
+ // Automatische Klebepunkte:
+ // je 4 Scheitelpunkt- und Eckpositionen muss ein Knotenobjekt liefern
+ // i.d.R. 0=oben, 1=rechts, 2=unten, 3=links
+ virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const;
+
+ // i.d.R. 0=linksoben, 1=rechtsoben, 2=rechtsunten, 3=linksunten
+ virtual SdrGluePoint GetCornerGluePoint(sal_uInt16 nNum) const;
+
+ // Liste aller Klebepunkte. Kann NULL sein.
+ virtual const SdrGluePointList* GetGluePointList() const;
+ //virtual SdrGluePointList* GetGluePointList();
+
+ // Nach veraendern der GluePointList muss man am Obj SendRepaintBroadcast rufen!
+ virtual SdrGluePointList* ForceGluePointList();
+
+ // Temporaer zu setzen fuer Transformationen am Bezugsobjekt
+ void SetGlueReallyAbsolute(FASTBOOL bOn);
+ void NbcRotateGluePoints(const Point& rRef, long nWink, double sn, double cs);
+ void NbcMirrorGluePoints(const Point& rRef1, const Point& rRef2);
+ void NbcShearGluePoints (const Point& rRef, long nWink, double tn, FASTBOOL bVShear);
+
+ // Objekt ist eine Kante?
+ virtual FASTBOOL IsEdge() const;
+
+ // bTail1=TRUE: Linienanfang, sonst LinienEnde
+ // pObj=NULL: Disconnect
+ virtual void ConnectToNode(FASTBOOL bTail1, SdrObject* pObj);
+ virtual void DisconnectFromNode(FASTBOOL bTail1);
+ virtual SdrObject* GetConnectedNode(FASTBOOL bTail1) const;
+
+ /** sets the writing mode of the object's context
+
+ Objects which itself do not support different writing modes will ignore this call.
+
+ Objects which support different writing modes, but have an own, explicit writing mode set,
+ will also ignore this call.
+
+ Objects which support different writing modes, and whose own mode is set to css.text.WritingMode2.CONTEXT,
+ will use the given writing mode to calculate their "effective writing mode".
+
+ The behaviour of this method is undefined if you pass css.text.WritingMode2.CONTEXT.
+
+ @param _nContextWritingMode
+ the effective writing mode of the context of the object
+ */
+ virtual void SetContextWritingMode( const sal_Int16 _nContextWritingMode );
+
+ // Wenn ein Objekt in der Lage ist, sich in ein Polygon oder in eine
+ // Bezierkurve (oder beides) zu verwandeln, dann sollten die folgenden
+ // Methoden ueberladen werden.
+ // Z.B. Ein RectObj mit Strichstaerke 10, SOLID_PEN in Polygon wandeln:
+ // Im Modus bLineToArea=sal_False soll ein PolyObj mit 4 Stuetzstellen,
+ // Strichstaerke 10 und SOLiD_PEN erzeugt werden.
+ // Im Modus bLineToArea=sal_True dagegen soll das generierte Obj immer ein
+ // LinienAttribut NULL_PEN haben, und die Linie (auch Linienmuster) selbst
+ // durch Polygonflaechen emuliert werden, die dadurch anschliessend vom
+ // Anwender manipuliert werden koennen. Das RectObj kann sich somit also
+ // nur korrekt konvertieren, wenn es als Flaechenattribut NULL_BRUSH
+ // besitzt. Es muesste in diesem Fall dann:
+ // - SOLID_BRUSH mit der Farbe des gesetzten Pen setzen
+ // - NULL_PEN setzen
+ // - PolyPolygon mit 2 Polygonen zu je 4 Stuetzstellen generieren.
+ // Der Returnwert ist jeweils ein SdrObject*, da als Rueckgabe zur Not
+ // auch Gruppenobjekte erlaubt sind (z.B. fuer SdrTextObj).
+ // Bei der Konvertierung von TextObj nach PathObj wird es wohl so sein,
+ // dass beide Modi (bLineToArea=sal_True/sal_False) identisch sind.
+ // Defaulted sind diese Methoden auf "Ich kann das nicht" (FALSE/NULL).
+ virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const;
+ SdrObject* ConvertToPolyObj(sal_Bool bBezier, sal_Bool bLineToArea) const;
+
+ // convert this path object to contour object; bForceLineDash converts even
+ // when there is no filled new polygon created from line-to-polygon conversion,
+ // specially used for XLINE_DASH and 3D conversion
+ SdrObject* ConvertToContourObj(SdrObject* pRet, sal_Bool bForceLineDash = sal_False) const;
+ SdrObject* ImpConvertToContourObj(SdrObject* pRet, sal_Bool bForceLineDash = sal_False) const;
+
+ // TRUE: Referenz auf ein Obj
+ sal_Bool IsVirtualObj() const { return bVirtObj; }
+
+ // sal_True=Obj kann warsch. gefuellt werden; sal_False=Obj kann warsch. Linienenden haben.
+ // ungueltig, wenn es sich um ein GroupObj handelt.
+ sal_Bool IsClosedObj() const { return bClosedObj; }
+
+ sal_Bool IsEdgeObj() const { return bIsEdge; }
+ sal_Bool Is3DObj() const { return bIs3DObj; }
+ sal_Bool IsUnoObj() const { return bIsUnoObj; }
+ sal_Bool IsMasterCachable() const { return !bNotMasterCachable; }
+ sal_Bool ShareLock() { sal_Bool r=!bNetLock; bNetLock=sal_True; return r; }
+ void ShareUnlock() { bNetLock=sal_False; }
+ sal_Bool IsShareLock() const { return bNetLock; }
+ void SetMarkProtect(sal_Bool bProt) { bMarkProt=bProt; }
+ sal_Bool IsMarkProtect() const { return bMarkProt; }
+ void SetInserted(sal_Bool bIns);
+ sal_Bool IsInserted() const { return bInserted; }
+ void SetGrouped(sal_Bool bGrp) { bGrouped=bGrp; }
+ sal_Bool IsGrouped() const { return bGrouped; }
+ void SetMoveProtect(sal_Bool bProt);
+ sal_Bool IsMoveProtect() const { return bMovProt; }
+ void SetResizeProtect(sal_Bool bProt);
+ sal_Bool IsResizeProtect() const { return bSizProt; }
+ void SetPrintable(sal_Bool bPrn);
+ sal_Bool IsPrintable() const { return !bNoPrint; }
+ void SetVisible(sal_Bool bVisible);
+ sal_Bool IsVisible() const { return mbVisible; }
+ void SetEmptyPresObj(sal_Bool bEpt) { bEmptyPresObj=bEpt; }
+ sal_Bool IsEmptyPresObj() const { return bEmptyPresObj; }
+ void SetNotVisibleAsMaster(sal_Bool bFlg) { bNotVisibleAsMaster=bFlg; }
+ sal_Bool IsNotVisibleAsMaster() const { return bNotVisibleAsMaster; }
+
+ // #i25616#
+ sal_Bool LineIsOutsideGeometry() const { return mbLineIsOutsideGeometry; }
+
+ // #i25616#
+ sal_Bool DoesSupportTextIndentingOnLineWidthChange() const { return mbSupportTextIndentingOnLineWidthChange; }
+
+ // applikationsspeziefische Daten
+ sal_uInt16 GetUserDataCount() const;
+ SdrObjUserData* GetUserData(sal_uInt16 nNum) const;
+
+ // Insert uebernimmt den auf dem Heap angelegten Record in den Besitz
+ // des Zeichenobjekts
+ void InsertUserData(SdrObjUserData* pData, sal_uInt16 nPos=0xFFFF);
+
+ // Delete entfernt den Record aus der Liste und ruft
+ // ein delete (FreeMem+Dtor).
+ void DeleteUserData(sal_uInt16 nNum);
+
+ // ItemPool fuer dieses Objekt wechseln
+ void MigrateItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel = 0L);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ // access to the UNO representation of the shape
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getUnoShape();
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface > getWeakUnoShape() const { return maWeakUnoShape; }
+
+ static SdrObject* getSdrObjectFromXShape( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xInt );
+
+ // helper struct for granting access exclusive to SvxShape
+ struct GrantXShapeAccess
+ {
+ friend class SvxShape;
+ private:
+ GrantXShapeAccess() { }
+ };
+
+ // setting the UNO representation is allowed for the UNO representation itself only!
+ void setUnoShape(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxUnoShape,
+ GrantXShapeAccess /*aGrant*/
+ )
+ {
+ impl_setUnoShape( _rxUnoShape );
+ }
+
+ /** retrieves the instance responsible for notifying changes in the properties of the shape associated with
+ the SdrObject
+
+ @precond
+ There already exists an SvxShape instance associated with the SdrObject
+ @throws ::com::sun::star::uno::RuntimeException
+ if there does nt yet exists an SvxShape instance associated with the SdrObject.
+ */
+ ::svx::PropertyChangeNotifier&
+ getShapePropertyChangeNotifier();
+
+ /** notifies a change in the given property, to all applicable listeners registered at the associated SvxShape
+
+ This method is equivalent to calling getShapePropertyChangeNotifier().notifyPropertyChange( _eProperty ),
+ exception that it is allowed to be called when there does not yet exist an associated SvxShape - in which
+ case the method will silently return without doing anything.
+ */
+ void notifyShapePropertyChange( const ::svx::ShapeProperty _eProperty ) const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ //
+ // transformation interface for StarOfficeAPI. This implements support for
+ // homogen 3x3 matrices containing the transformation of the SdrObject. At the
+ // moment it contains a shearX, rotation and translation, but for setting all linear
+ // transforms like Scale, ShearX, ShearY, Rotate and Translate are supported.
+ //
+ // gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon
+ // with the base geometry and returns TRUE. Otherwise it returns FALSE.
+ virtual sal_Bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const;
+
+ // sets the base geometry of the object using infos contained in the homogen 3x3 matrix.
+ // If it's an SdrPathObj it will use the provided geometry information. The Polygon has
+ // to use (0,0) as upper left and will be scaled to the given size in the matrix.
+ virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon);
+
+ sal_Bool IsTransparent( sal_Bool bCheckForAlphaChannel = sal_False ) const;
+
+ // #116168#
+ // Give info if object is in destruction
+ sal_Bool IsInDestruction() const;
+
+ // return if fill is != XFILL_NONE
+ bool HasFillStyle() const;
+ bool HasLineStyle() const;
+
+ // on import of OLE object from MS documents the BLIP size might be retrieved,
+ // the following methods are used to control it;
+ // usually this data makes no sence after the import is finished, since the object
+ // might be resized
+ Rectangle GetBLIPSizeRectangle() const;
+ void SetBLIPSizeRectangle( const Rectangle& aRect );
+
+protected:
+ void impl_setUnoShape( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxUnoShape );
+
+private:
+ /** only for internal use!
+ */
+ SvxShape* getSvxShape() const;
+
+ /** do not use directly, always use getSvxShape() if you have to! */
+ SvxShape* mpSvxShape;
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface >
+ maWeakUnoShape;
+};
+
+//************************************************************
+// SdrDummyObj
+//
+// Wer sich eigene Objekte schafft muss einen Link in der Klasse
+// SdrObjFactory setzen. Der Handler hat folgendes aussehen:
+// void Hdl(SdrObjFactory*)
+// Er muss sich aus der uebergebenen Instanz die Werte nInventor und
+// nIdentifier ansehen und entsprechend mit new eine Zeichenobjektinstanz
+// erzeugen. Einen Zeiger auf diese Instanz hat er in der Membervariablen
+// pNewObj zu hinterlassen.
+//
+//************************************************************
+
+class SVX_DLLPUBLIC SdrObjFactory
+{
+public:
+ sal_uInt32 nInventor;
+ sal_uInt16 nIdentifier;
+
+ // fuer MakeNewObj():
+ SdrPage* pPage;
+ SdrModel* pModel;
+ SdrObject* pNewObj;
+
+ // fuer MakeNewObjUserData():
+ SdrObject* pObj;
+ SdrObjUserData* pNewData;
+
+private:
+ SVX_DLLPRIVATE SdrObjFactory(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrPage* pNewPage, SdrModel* pNewModel);
+ SVX_DLLPRIVATE SdrObjFactory(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrObject* pObj1);
+
+public:
+ static SdrObject* MakeNewObject(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrPage* pPage, SdrModel* pModel=NULL);
+ static void InsertMakeObjectHdl(const Link& rLink);
+ static void RemoveMakeObjectHdl(const Link& rLink);
+ static SdrObjUserData* MakeNewObjUserData(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrObject* pObj);
+ static void InsertMakeUserDataHdl(const Link& rLink);
+ static void RemoveMakeUserDataHdl(const Link& rLink);
+};
+
+typedef tools::WeakReference< SdrObject > SdrObjectWeakRef;
+
+#endif //_SVDOBJ_HXX
+
diff --git a/svx/inc/svx/svdocapt.hxx b/svx/inc/svx/svdocapt.hxx
new file mode 100644
index 000000000000..7bac32cb9c1e
--- /dev/null
+++ b/svx/inc/svx/svdocapt.hxx
@@ -0,0 +1,171 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDCAPT_HXX
+#define _SVDCAPT_HXX
+
+#include <svx/svdorect.hxx>
+#include "svx/svxdllapi.h"
+
+//************************************************************
+// Vorausdeklarationen
+//************************************************************
+
+class ImpCaptParams;
+
+namespace sdr { namespace properties {
+ class CaptionProperties;
+}}
+
+#define SDRSETITEM_CAPTION_ATTR SDRSETITEM_ATTR_COUNT
+
+//************************************************************
+// Hilfsklasse SdrCaptObjGeoData
+//************************************************************
+
+// #109872#
+class SdrCaptObjGeoData : public SdrTextObjGeoData
+{
+public:
+ Polygon aTailPoly;
+};
+
+//************************************************************
+// SdrCaptionObj
+//************************************************************
+
+class SVX_DLLPUBLIC SdrCaptionObj : public SdrRectObj
+{
+private:
+ // to allow sdr::properties::CaptionProperties access to ImpRecalcTail()
+ friend class sdr::properties::CaptionProperties;
+ friend class SdrTextObj; // fuer ImpRecalcTail() bei AutoGrow
+
+protected:
+ virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+
+private:
+ Polygon aTailPoly; // das ganze Polygon des Schwanzes
+ sal_Bool mbSpecialTextBoxShadow; // for calc special shadow, default FALSE
+ sal_Bool mbFixedTail; // for calc note box fixed tail, default FALSE
+ Point maFixedTailPos; // for calc note box fixed tail position.
+
+private:
+ SVX_DLLPRIVATE void ImpGetCaptParams(ImpCaptParams& rPara) const;
+ SVX_DLLPRIVATE void ImpCalcTail1(const ImpCaptParams& rPara, Polygon& rPoly, Rectangle& rRect) const;
+ SVX_DLLPRIVATE void ImpCalcTail2(const ImpCaptParams& rPara, Polygon& rPoly, Rectangle& rRect) const;
+ SVX_DLLPRIVATE void ImpCalcTail3(const ImpCaptParams& rPara, Polygon& rPoly, Rectangle& rRect) const;
+ SVX_DLLPRIVATE void ImpCalcTail4(const ImpCaptParams& rPara, Polygon& rPoly, Rectangle& rRect) const;
+ SVX_DLLPRIVATE void ImpCalcTail (const ImpCaptParams& rPara, Polygon& rPoly, Rectangle& rRect) const;
+ SVX_DLLPRIVATE void ImpRecalcTail();
+
+public:
+ TYPEINFO();
+ SdrCaptionObj();
+ SdrCaptionObj(const Rectangle& rRect);
+ SdrCaptionObj(const Rectangle& rRect, const Point& rTail);
+ virtual ~SdrCaptionObj();
+
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
+ virtual sal_uInt16 GetObjIdentifier() const;
+ virtual void operator=(const SdrObject& rObj);
+
+ // for calc: special shadow only for text box
+ void SetSpecialTextBoxShadow() { mbSpecialTextBoxShadow = sal_True; }
+ sal_Bool GetSpecialTextBoxShadow() const { return mbSpecialTextBoxShadow; }
+
+ // for calc: fixed note tail position.
+ void SetFixedTail() { mbFixedTail = sal_True; }
+
+ virtual void TakeObjNameSingul(String& rName) const;
+ virtual void TakeObjNamePlural(String& rName) const;
+
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
+ virtual void SetModel(SdrModel* pNewModel);
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
+
+ virtual sal_uInt32 GetHdlCount() const;
+ virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
+
+ // special drag methods
+ virtual bool hasSpecialDrag() const;
+ virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
+ virtual bool applySpecialDrag(SdrDragStat& rDrag);
+ virtual String getSpecialDragComment(const SdrDragStat& rDrag) const;
+
+ virtual FASTBOOL BegCreate(SdrDragStat& rStat);
+ virtual FASTBOOL MovCreate(SdrDragStat& rStat);
+ virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
+ virtual FASTBOOL BckCreate(SdrDragStat& rStat);
+ virtual void BrkCreate(SdrDragStat& rStat);
+ virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const;
+ virtual Pointer GetCreatePointer() const;
+
+ virtual void NbcMove(const Size& rSiz);
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+
+ virtual void NbcSetRelativePos(const Point& rPnt);
+ virtual Point GetRelativePos() const;
+ virtual void NbcSetAnchorPos(const Point& rPnt);
+ virtual const Point& GetAnchorPos() const;
+
+ virtual void RecalcSnapRect();
+ virtual const Rectangle& GetSnapRect() const;
+ virtual void NbcSetSnapRect(const Rectangle& rRect);
+ virtual const Rectangle& GetLogicRect() const;
+ virtual void NbcSetLogicRect(const Rectangle& rRect);
+
+ virtual sal_uInt32 GetSnapPointCount() const;
+ virtual Point GetSnapPoint(sal_uInt32 i) const;
+
+protected:
+ virtual SdrObjGeoData* NewGeoData() const;
+ virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
+ virtual void RestGeoData(const SdrObjGeoData& rGeo);
+
+public:
+ virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const;
+
+ const Point& GetTailPos() const;
+ void SetTailPos(const Point& rPos);
+ void NbcSetTailPos(const Point& rPos);
+
+ // #i32599#
+ // Add own implementation for TRSetBaseGeometry to handle TailPos over changes
+ virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon);
+
+ inline const Point& GetFixedTailPos() const {return maFixedTailPos;}
+
+ // geometry access
+ ::basegfx::B2DPolygon getTailPolygon() const;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDOCAPT_HXX
+
diff --git a/svx/inc/svx/svdocirc.hxx b/svx/inc/svx/svdocirc.hxx
new file mode 100644
index 000000000000..969920906dce
--- /dev/null
+++ b/svx/inc/svx/svdocirc.hxx
@@ -0,0 +1,153 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDOCIRC_HXX
+#define _SVDOCIRC_HXX
+
+#include <svx/svdorect.hxx>
+#include "svx/svxdllapi.h"
+
+//************************************************************
+// Vorausdeklarationen
+//************************************************************
+
+namespace sdr { namespace properties {
+ class CircleProperties;
+}}
+
+//************************************************************
+// Hilfsklasse SdrCircObjGeoData
+//************************************************************
+
+// #109872#
+class SdrCircObjGeoData : public SdrTextObjGeoData
+{
+public:
+ long nStartWink;
+ long nEndWink;
+};
+
+//************************************************************
+// SdrCircObj
+//************************************************************
+
+class SVX_DLLPUBLIC SdrCircObj : public SdrRectObj
+{
+private:
+ // to allow sdr::properties::CircleProperties access to ImpSetAttrToCircInfo()
+ friend class sdr::properties::CircleProperties;
+
+ // only for SdrCircleAttributes
+ SdrObjKind GetCircleKind() const { return meCircleKind; }
+
+protected:
+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+ virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
+
+ SdrObjKind meCircleKind;
+ long nStartWink;
+ long nEndWink;
+
+ // bitfield
+ unsigned mbPolygonIsLine : 1;
+
+private:
+ SVX_DLLPRIVATE basegfx::B2DPolygon ImpCalcXPolyCirc(const SdrObjKind eKind, const Rectangle& rRect1, long nStart, long nEnd) const;
+ SVX_DLLPRIVATE void ImpSetCreateParams(SdrDragStat& rStat) const;
+ SVX_DLLPRIVATE void ImpSetAttrToCircInfo(); // Werte vom Pool kopieren
+ SVX_DLLPRIVATE void ImpSetCircInfoToAttr(); // Werte in den Pool kopieren
+
+ // Liefert sal_True, wenn das Painten ein XPolygon erfordert.
+ SVX_DLLPRIVATE FASTBOOL PaintNeedsXPolyCirc() const; // PaintNeedsXPoly-> PaintNeedsXPolyCirc
+ SVX_DLLPRIVATE virtual void RecalcXPoly();
+
+protected:
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
+
+public:
+ TYPEINFO();
+ SdrCircObj(SdrObjKind eNewKind); // Circ, CArc, Sect oder CCut
+ SdrCircObj(SdrObjKind eNewKind, const Rectangle& rRect);
+
+ // 0=0.00Deg=3h 9000=90.00Deg=12h 18000=180.00Deg=9h 27000=270.00Deg=6h
+ // Der Verlauf des Kreises von StartWink nach EndWink ist immer entgegen
+ // dem Uhrzeigersinn.
+ // Wenn nNewStartWink==nNewEndWink hat der Kreisbogen einen Verlaufswinkel
+ // von 0 Grad. Bei nNewStartWink+36000==nNewEndWink ist der Verlaufswinkel
+ // 360.00 Grad.
+ SdrCircObj(SdrObjKind eNewKind, const Rectangle& rRect, long nNewStartWink, long nNewEndWink);
+ virtual ~SdrCircObj();
+
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
+ virtual sal_uInt16 GetObjIdentifier() const;
+ virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const;
+
+ virtual void TakeObjNameSingul(String& rName) const;
+ virtual void TakeObjNamePlural(String& rName) const;
+
+ virtual void operator=(const SdrObject& rObj);
+ virtual void RecalcSnapRect();
+ virtual void NbcSetSnapRect(const Rectangle& rRect);
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
+
+ virtual sal_uInt32 GetSnapPointCount() const;
+ virtual Point GetSnapPoint(sal_uInt32 i) const;
+
+ virtual sal_uInt32 GetHdlCount() const;
+ virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
+
+ // special drag methods
+ virtual bool hasSpecialDrag() const;
+ virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
+ virtual bool applySpecialDrag(SdrDragStat& rDrag);
+ virtual String getSpecialDragComment(const SdrDragStat& rDrag) const;
+
+ virtual FASTBOOL BegCreate(SdrDragStat& rStat);
+ virtual FASTBOOL MovCreate(SdrDragStat& rStat);
+ virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
+ virtual FASTBOOL BckCreate(SdrDragStat& rStat);
+ virtual void BrkCreate(SdrDragStat& rStat);
+ virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const;
+ virtual Pointer GetCreatePointer() const;
+ virtual void NbcMove(const Size& aSiz);
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+ virtual void NbcMirror(const Point& rRef1, const Point& rRef2);
+ virtual void NbcShear (const Point& rRef, long nWink, double tn, FASTBOOL bVShear);
+ virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const;
+
+protected:
+ virtual SdrObjGeoData* NewGeoData() const;
+ virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
+ virtual void RestGeoData(const SdrObjGeoData& rGeo);
+public:
+ long GetStartWink() const { return nStartWink; }
+ long GetEndWink() const { return nEndWink; }
+
+};
+
+#endif //_SVDOCIRC_HXX
+
diff --git a/svx/inc/svx/svdoedge.hxx b/svx/inc/svx/svdoedge.hxx
new file mode 100644
index 000000000000..77f3861898a3
--- /dev/null
+++ b/svx/inc/svx/svdoedge.hxx
@@ -0,0 +1,436 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDOEDGE_HXX
+#define _SVDOEDGE_HXX
+
+#include <svx/svdotext.hxx>
+#include <svx/svdglue.hxx>
+#include "svx/svxdllapi.h"
+
+//************************************************************
+// Vorausdeklarationen
+//************************************************************
+
+class SdrDragMethod;
+class SdrPageView;
+
+namespace sdr { namespace properties {
+ class ConnectorProperties;
+}}
+
+//************************************************************
+// Hilfsklasse SdrObjConnection
+//************************************************************
+
+class SdrObjConnection
+{
+ friend class SdrEdgeObj;
+ friend class ImpEdgeHdl;
+ friend class SdrCreateView;
+
+protected:
+ Point aObjOfs; // Wird beim Draggen eines Knotens gesetzt
+ SdrObject* pObj; // Referenziertes Objekt
+ long nXDist; // Hor. Objektabstand wenn bXDistOvr=TRUE
+ long nYDist; // Vert. Objektabstand wenn bYDistOvr=TRUE
+ sal_uInt16 nConId; // Konnektornummer
+
+ // bitfield
+ unsigned bBestConn : 1; // sal_True= es wird der guenstigste Konnektor gesucht
+ unsigned bBestVertex : 1; // sal_True= es wird der guenstigste Scheitelpunkt zum konnekten gesucht
+ unsigned bXDistOvr : 1; // sal_True= Hor. Objektabstand wurde gedragt (Overwrite)
+ unsigned bYDistOvr : 1; // sal_True= Vert. Objektabstand wurde gedragt (Overwrite)
+ unsigned bAutoVertex : 1; // AutoConnector am Scheitelpunkt nCon
+ unsigned bAutoCorner : 1; // AutoConnector am Eckpunkt nCon
+
+public:
+ SdrObjConnection() { ResetVars(); }
+ SVX_DLLPUBLIC ~SdrObjConnection();
+
+ void ResetVars();
+ FASTBOOL TakeGluePoint(SdrGluePoint& rGP, FASTBOOL bSetAbsolutePos) const;
+
+ inline void SetBestConnection( sal_Bool rB ) { bBestConn = rB; };
+ inline void SetBestVertex( sal_Bool rB ) { bBestVertex = rB; };
+ inline void SetAutoVertex( sal_Bool rB ) { bAutoVertex = rB; };
+ inline void SetConnectorId( sal_uInt16 nId ) { nConId = nId; };
+
+ inline sal_Bool IsBestConnection() const { return bBestConn; };
+ inline sal_Bool IsBestVertex() const { return bBestVertex; };
+ inline sal_Bool IsAutoVertex() const { return bAutoVertex; };
+ inline sal_uInt16 GetConnectorId() const { return nConId; };
+ inline SdrObject* GetObject() const { return pObj; }
+};
+
+//************************************************************
+// Hilfsklasse SdrEdgeInfoRec
+//************************************************************
+
+enum SdrEdgeLineCode {OBJ1LINE2,OBJ1LINE3,OBJ2LINE2,OBJ2LINE3,MIDDLELINE};
+
+class SdrEdgeInfoRec
+{
+public:
+ // Die 5 Distanzen werden beim draggen bzw. per SetAttr gesetzt und von
+ // ImpCalcEdgeTrack ausgewertet. Per Get/SetAttr/Get/SetStyleSh werden
+ // jedoch nur 0-3 longs transportiert.
+ Point aObj1Line2;
+ Point aObj1Line3;
+ Point aObj2Line2;
+ Point aObj2Line3;
+ Point aMiddleLine;
+
+ // Nachfolgende Werte werden von ImpCalcEdgeTrack gesetzt
+ long nAngle1; // Austrittswinkel am Obj1
+ long nAngle2; // Austrittswinkel am Obj2
+ sal_uInt16 nObj1Lines; // 1..3
+ sal_uInt16 nObj2Lines; // 1..3
+ sal_uInt16 nMiddleLine; // 0xFFFF=keine, sonst Punktnummer des Linienbeginns
+ char cOrthoForm; // Form des Ortho-Verbindes, z.B. 'Z','U',I','L','S',...
+
+public:
+ SdrEdgeInfoRec()
+ : nAngle1(0),
+ nAngle2(0),
+ nObj1Lines(0),
+ nObj2Lines(0),
+ nMiddleLine(0xFFFF),
+ cOrthoForm(0)
+ {}
+
+ Point& ImpGetLineVersatzPoint(SdrEdgeLineCode eLineCode);
+ const Point& ImpGetLineVersatzPoint(SdrEdgeLineCode eLineCode) const { return ((SdrEdgeInfoRec*)this)->ImpGetLineVersatzPoint(eLineCode); }
+ sal_uInt16 ImpGetPolyIdx(SdrEdgeLineCode eLineCode, const XPolygon& rXP) const;
+ FASTBOOL ImpIsHorzLine(SdrEdgeLineCode eLineCode, const XPolygon& rXP) const;
+ void ImpSetLineVersatz(SdrEdgeLineCode eLineCode, const XPolygon& rXP, long nVal);
+ long ImpGetLineVersatz(SdrEdgeLineCode eLineCode, const XPolygon& rXP) const;
+};
+
+//************************************************************
+// Hilfsklasse SdrEdgeObjGeoData
+//************************************************************
+
+class SdrEdgeObjGeoData : public SdrTextObjGeoData
+{
+public:
+ SdrObjConnection aCon1; // Verbindungszustand des Linienanfangs
+ SdrObjConnection aCon2; // Verbindungszustand des Linienendes
+ XPolygon* pEdgeTrack;
+ sal_Bool bEdgeTrackDirty;// sal_True=Verbindungsverlauf muss neu berechnet werden.
+ sal_Bool bEdgeTrackUserDefined;
+ SdrEdgeInfoRec aEdgeInfo;
+
+public:
+ SdrEdgeObjGeoData();
+ virtual ~SdrEdgeObjGeoData();
+};
+
+//************************************************************
+// Hilfsklasse SdrEdgeObj
+//************************************************************
+
+class SVX_DLLPUBLIC SdrEdgeObj : public SdrTextObj
+{
+private:
+ // to allow sdr::properties::ConnectorProperties access to ImpSetAttrToEdgeInfo()
+ friend class sdr::properties::ConnectorProperties;
+
+ friend class SdrCreateView;
+ friend class ImpEdgeHdl;
+
+protected:
+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+ virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
+
+ SdrObjConnection aCon1; // Verbindungszustand des Linienanfangs
+ SdrObjConnection aCon2; // Verbindungszustand des Linienendes
+
+ XPolygon* pEdgeTrack;
+ sal_uInt16 nNotifyingCount; // Verrieglung
+ SdrEdgeInfoRec aEdgeInfo;
+
+ // bitfield
+ unsigned bEdgeTrackDirty : 1; // sal_True=Verbindungsverlauf muss neu berechnet werden.
+ unsigned bEdgeTrackUserDefined : 1;
+
+ // #109007#
+ // Bool to allow supporession of default connects at object
+ // inside test (HitTest) and object center test (see ImpFindConnector())
+ unsigned mbSuppressDefaultConnect : 1;
+
+ // #110649#
+ // Flag value for avoiding death loops when calculating BoundRects
+ // from circularly connected connectors. A coloring algorythm is used
+ // here. When the GetCurrentBoundRect() calculation of a SdrEdgeObj
+ // is running, the flag is set, else it is always sal_False.
+ unsigned mbBoundRectCalculationRunning : 1;
+
+public:
+ // #109007#
+ // Interface to default connect suppression
+ void SetSuppressDefaultConnect(sal_Bool bNew) { mbSuppressDefaultConnect = bNew; }
+ sal_Bool GetSuppressDefaultConnect() const { return mbSuppressDefaultConnect; }
+
+ // #110649#
+ sal_Bool IsBoundRectCalculationRunning() const { return mbBoundRectCalculationRunning; }
+
+protected:
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
+
+ XPolygon ImpCalcObjToCenter(const Point& rStPt, long nEscAngle, const Rectangle& rRect, const Point& rCenter) const;
+ void ImpRecalcEdgeTrack(); // Neuberechnung des Verbindungsverlaufs
+ XPolygon ImpCalcEdgeTrack(const XPolygon& rTrack0, SdrObjConnection& rCon1, SdrObjConnection& rCon2, SdrEdgeInfoRec* pInfo) const;
+ XPolygon ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rectangle& rBoundRect1, const Rectangle& rBewareRect1,
+ const Point& rPt2, long nAngle2, const Rectangle& rBoundRect2, const Rectangle& rBewareRect2,
+ sal_uIntPtr* pnQuality, SdrEdgeInfoRec* pInfo) const;
+ static FASTBOOL ImpFindConnector(const Point& rPt, const SdrPageView& rPV, SdrObjConnection& rCon, const SdrEdgeObj* pThis, OutputDevice* pOut=NULL);
+ sal_uInt16 ImpCalcEscAngle(SdrObject* pObj, const Point& aPt2) const;
+ FASTBOOL ImpStripPolyPoints(XPolygon& rXP) const; // entfernen ueberfluessiger Punkte
+ void ImpSetTailPoint(FASTBOOL bTail1, const Point& rPt);
+ void ImpUndirtyEdgeTrack(); // eventuelle Neuberechnung des Verbindungsverlaufs
+ void ImpDirtyEdgeTrack(); // invalidate connector path, so it will be recalculated next time
+ void ImpSetAttrToEdgeInfo(); // Werte vom Pool nach aEdgeInfo kopieren
+ void ImpSetEdgeInfoToAttr(); // Werte vom aEdgeInfo in den Pool kopieren
+
+public:
+ TYPEINFO();
+
+ SdrEdgeObj();
+ virtual ~SdrEdgeObj();
+
+ SdrObjConnection& GetConnection(FASTBOOL bTail1) { return *(bTail1 ? &aCon1 : &aCon2); }
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
+ virtual sal_uInt16 GetObjIdentifier() const;
+ virtual const Rectangle& GetCurrentBoundRect() const;
+ virtual const Rectangle& GetSnapRect() const;
+ virtual FASTBOOL IsNode() const;
+ virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const;
+ virtual SdrGluePoint GetCornerGluePoint(sal_uInt16 nNum) const;
+ virtual const SdrGluePointList* GetGluePointList() const;
+ virtual SdrGluePointList* ForceGluePointList();
+ virtual FASTBOOL IsEdge() const;
+
+ // bTail1=TRUE: Linienanfang, sonst LinienEnde
+ // pObj=NULL: Disconnect
+ void SetEdgeTrackDirty() { bEdgeTrackDirty=sal_True; }
+ void ConnectToNode(FASTBOOL bTail1, SdrObject* pObj);
+ void DisconnectFromNode(FASTBOOL bTail1);
+ SdrObject* GetConnectedNode(FASTBOOL bTail1) const;
+ const SdrObjConnection& GetConnection(FASTBOOL bTail1) const { return *(bTail1 ? &aCon1 : &aCon2); }
+ FASTBOOL CheckNodeConnection(FASTBOOL bTail1) const;
+
+ virtual void RecalcSnapRect();
+ virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const;
+ virtual void operator=(const SdrObject& rObj);
+ virtual void TakeObjNameSingul(String& rName) const;
+ virtual void TakeObjNamePlural(String& rName) const;
+
+ void SetEdgeTrackPath( const basegfx::B2DPolyPolygon& rPoly );
+ basegfx::B2DPolyPolygon GetEdgeTrackPath() const;
+
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
+ virtual sal_uInt32 GetHdlCount() const;
+ virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
+
+ // special drag methods
+ virtual bool hasSpecialDrag() const;
+ virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
+ virtual bool applySpecialDrag(SdrDragStat& rDrag);
+ virtual String getSpecialDragComment(const SdrDragStat& rDrag) const;
+
+ // FullDrag support
+ virtual SdrObject* getFullDragClone() const;
+
+ virtual void NbcSetSnapRect(const Rectangle& rRect);
+ virtual void NbcMove(const Size& aSize);
+ virtual void NbcResize(const Point& rRefPnt, const Fraction& aXFact, const Fraction& aYFact);
+
+ // #102344# Added missing implementation
+ virtual void NbcSetAnchorPos(const Point& rPnt);
+
+ virtual FASTBOOL BegCreate(SdrDragStat& rStat);
+ virtual FASTBOOL MovCreate(SdrDragStat& rStat);
+ virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
+ virtual FASTBOOL BckCreate(SdrDragStat& rStat);
+ virtual void BrkCreate(SdrDragStat& rStat);
+ virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const;
+ virtual Pointer GetCreatePointer() const;
+ virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const;
+
+ virtual sal_uInt32 GetSnapPointCount() const;
+ virtual Point GetSnapPoint(sal_uInt32 i) const;
+ virtual sal_Bool IsPolyObj() const;
+ virtual sal_uInt32 GetPointCount() const;
+ virtual Point GetPoint(sal_uInt32 i) const;
+ virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 i);
+
+ virtual SdrObjGeoData* NewGeoData() const;
+ virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
+ virtual void RestGeoData(const SdrObjGeoData& rGeo);
+
+ /** updates edges that are connected to the edges of this object
+ as if the connected objects send a repaint broadcast
+ #103122#
+ */
+ void Reformat();
+
+ // helper methods for the StarOffice api
+ Point GetTailPoint( sal_Bool bTail ) const;
+ void SetTailPoint( sal_Bool bTail, const Point& rPt );
+ void setGluePointIndex( sal_Bool bTail, sal_Int32 nId = -1 );
+ sal_Int32 getGluePointIndex( sal_Bool bTail );
+
+ virtual sal_Bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const;
+ virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon);
+
+ // for geometry access
+ ::basegfx::B2DPolygon getEdgeTrack() const;
+
+ // helper method for SdrDragMethod::AddConnectorOverlays. Adds a overlay polygon for
+ // this connector to rResult.
+ basegfx::B2DPolygon ImplAddConnectorOverlay(SdrDragMethod& rDragMethod, bool bTail1, bool bTail2, bool bDetail) const;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// Zur Bestimmung der Verlaufslinie werden folgende Item-Parameter des SdrItemPool verwendet:
+//
+// sal_uInt16 EdgeFlowAngle Default 9000 (=90.00 Deg), min 0, max 9000
+// Verlauffreiheitswinkel.
+// Der Winkel, in dem die Verbindungslinie verlaufen darf.
+//
+// sal_uInt16 EdgeEscAngle Default 9000 (=90.00 Deg), min 0, max 9000
+// Objektaustrittswinkel.
+// Der Winkel, in dem die Verbindungslinie aus dem Objekt austreten darf.
+//
+// sal_Bool EdgeEscAsRay Default FALSE
+// sal_True= die Verbindungslinie tritt aus dem Obj Strahlenfoermig aus.
+// Also Winkelvorgabe durch die Strecke ObjMitte/Konnektor.
+//
+// sal_Bool EdgeEscUseObjAngle Default FALSE
+// Objektdrehwinkelberuecksichtigung.
+// sal_True= Bei der Bestimmung des Objektaustrittswinkels wird der
+// Drehwinkel des Objekts als Offset beruecksichtigt.
+//
+// sal_uIntPtr EdgeFlowDefDist Default 0, min 0, max ?
+// Das ist der Default-Mindestabstand der bei der Berechnung der
+// Verbindungslinie zu den angedockten Objekten in logischen Einheiten.
+// Dieser Abstand wird innerhalb des Objektes "ueberschrieben", sobald
+// der User an den Linien draggd. Beim Andocken an ein neues Objekt wird
+// dann jedoch wieder dieser Default verwendet.
+//
+//
+// Allgemeines zu Konnektoren:
+//
+// Es gibt Knoten und Kantenobjekte. Zwei Knoten koennen durch eine Kante
+// miteinander verbunden werden. Ist eine Kante nur an einem Ende an einen
+// Knoten geklebt, ist das andere Ende auf einer absoluten Position im Doc
+// fixiert. Ebenso ist es natuerlich auch moeglich, dass eine Kante an beiden
+// Enden "frei", also nicht mit einem Knotenobjekt verbunden ist.
+//
+// Ein Kantenobjekt kann theoretisch auch gleichzeitig Knotenobjekt sein. In
+// der ersten Version wird das jedoch noch nicht realisiert werden.
+//
+// Eine Verbindung zwischen Knoten und Kante kann hergestellt werden durch:
+// - Interaktives erzeugen eines neuen Kantenobjekts an der SdrView wobei
+// Anfangs- bzw. Endpunkt der Kante auf ein Konnektor (Klebestelle) eines
+// bereits vorhandenen Knotenobjekts gelegt wird.
+// - Interaktives draggen des Anfangs- bzw. Endpunkts eines bestehenden
+// Kantenobjekts an der SdrView auf ein Konnektor (Klebestelle) eines
+// bereits vorhandenen Knotenobjekts.
+// - Undo/Redo
+// Verschieben von Knotenobjekten stellt keine Verbindungen her. Ebenso auch
+// nicht das direkte Verschieben von Kantenendpunkten am SdrModel...
+// Verbindungen koennen auch hergestellt werden, wenn die Konnektoren an der
+// View nicht sichtbar geschaltet sind.
+//
+// Eine vorhandene Verbindung zwischen Knoten und Kante bleibt erhalten bei:
+// - Draggen (Move/Resize/Rotate/...) des Knotenobjekts
+// - Verschieben einer Konnektorposition im Knotemobjekt
+// - gleichzeitiges Draggen (Move/Resize/Rotate/...) von Knoten und Kante
+//
+// Eine Verbindung zwischen Knoten und Kante kann geloesst werden durch:
+// - Loeschen eines der Objekte
+// - Draggen des Kantenobjekts ohne gleichzeitiges Draggen des Knotens
+// - Loeschen des Konnektors am Knotenobjekt
+// - Undo/Redo/Repeat
+// Beim Draggen muss die Aufforderung zum loesen der Verbindung von ausserhalb
+// des Models befohlen werden (z.B. von der SdrView). SdrEdgeObj::Move() loesst
+// die Verbindung nicht selbsttaetig.
+//
+// Jedes Knotenobjekt kann Konnektoren, sog. Klebestellen besitzen. Das sind die
+// geometrischen Punkte, an denen das verbindende Kantenobjekt bei hergestellter
+// Verbindung endet. Defaultmaessig hat jedes Objekt keine Konnektoren. Trotzdem
+// kann man bei bestimmten View-Einstellungen eine Kante andocken, da dann z.B.
+// an den 4 Scheitelpunkten des Knotenobjekts bei Bedarf automatisch Konnektoren
+// generiert werden. Jedes Objekt liefert dafuer 2x4 sog. Default-Konnektorposi-
+// tionen, 4 an den Scheitelpunkten und 4 an den Eckpositionen. Im Normalfall
+// liegen diese an den 8 Handlepositionen; Ausnahmen bilden hier Ellipsen,
+// Parallelogramme, ... . Darueberhinaus koennen auch an jedem Knotenobjekt
+// anwenderspeziefische Konnektoren gesetzt werden.
+//
+// Dann gibt es noch die Moeglichkeit, ein Kante an einem Objekt mit dem
+// Attribut "bUseBestConnector" anzudocken. Es wird dann aus dem Angebot der
+// Konnektoren des Objekts oder/und der Scheitelpunkte, jeweils die fuer den
+// Verlauf der Verbindungslinie guenstigste Konnektorposition verwendet. Der
+// Anwender vergibt dieses Attribut, indem er den Knoten in seiner Mitte
+// andockt (siehe z.B. Visio).
+// 09-06-1996: bUseBestConnector verwendet nur Scheitelpunktklebepunkte.
+//
+// Und hier noch etwas Begriffsdefinition:
+// Verbinder : Eben das Verbinderobjekt (Kantenobjekt)
+// Knoten : Ein beliebiges Objekt, an dem ein Verbinder drangeklebt
+// werden kann, z.B. ein Rechteck, ...
+// Klebepunkt: Der Punkt, an dem der Verbinder an das Knotenobjekt
+// geklebt wird. Hierbei gibt es:
+// Scheitelpunktklebepunkte: Jedes Knotenobjekt hat diese
+// Klebepunkte von Natur aus. Moeglicherweise gibt es
+// im Draw bereits die Option "Automatisch ankleben an
+// Objektscheitelpunkte" (default an)
+// Eckpunktklebepunkte: Auch diese Klebepunkte sind den
+// Objekten von mir bereits mitgegeben. Wie die oben
+// erwaehnten gibt es fuer diese moeglicherweise
+// bereits auch eine Option im Draw. (default aus)
+// Scheitelpunktklebepunkte und Eckpunktklebepunkte sind
+// im Gegensatz zu Visio nicht optisch sichtbar; sie
+// sind eben einfach da (wenn Option eingeschaltet).
+// Benutzerdefinierte Klebepunkte: Gibt es an jedem
+// Knotenobjekt beliebig viele. Per Option koennen sie
+// sichtbar geschaltet werden (beim editieren immer
+// sichtbar). Zur Zeit sind die jedoch noch nicht ganz
+// fertigimplementiert.
+// Automatische Klebepunktwahl: Wird der Verbinder so an
+// das Knotenobjekt gedockt, dass der schwarke Rahmen
+// das gesamte Objekt umfasst, so versucht der
+// Verbinder von den 4 Scheitelpunktklebepunkten (und
+// zwar nur von denen) den guenstigsten herauszufinden.
+//
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDOEDGE_HXX
+
diff --git a/svx/inc/svx/svdograf.hxx b/svx/inc/svx/svdograf.hxx
new file mode 100644
index 000000000000..fa5b56e403e5
--- /dev/null
+++ b/svx/inc/svx/svdograf.hxx
@@ -0,0 +1,228 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDOGRAF_HXX
+#define _SVDOGRAF_HXX
+
+#include <com/sun/star/io/XInputStream.hpp>
+#include <vcl/graph.hxx>
+#include <svx/svdorect.hxx>
+#include <svtools/grfmgr.hxx>
+#include "svx/svxdllapi.h"
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+namespace sdr
+{
+ namespace properties
+ {
+ class GraphicProperties;
+ } // end of namespace properties
+ namespace contact
+ {
+ class ViewObjectContactOfGraphic;
+ } // end of namespace contact
+} // end of namespace sdr
+
+// -----------
+// - Defines -
+// -----------
+
+#define SDRGRAFOBJ_TRANSFORMATTR_NONE 0x00000000UL
+#define SDRGRAFOBJ_TRANSFORMATTR_COLOR 0x00000001UL
+#define SDRGRAFOBJ_TRANSFORMATTR_MIRROR 0x00000002UL
+#define SDRGRAFOBJ_TRANSFORMATTR_ROTATE 0x00000004UL
+#define SDRGRAFOBJ_TRANSFORMATTR_ALL 0xffffffffUL
+
+// ---------------------
+// - SdrGrafObjGeoData -
+// ---------------------
+
+// #109872#
+class SdrGrafObjGeoData : public SdrTextObjGeoData
+{
+public:
+ sal_Bool bMirrored;
+
+ SdrGrafObjGeoData()
+ : bMirrored(sal_False)
+ {
+ }
+};
+
+// --------------
+// - SdrGrafObj -
+// --------------
+
+class GraphicObject;
+class SdrGraphicLink;
+
+class SVX_DLLPUBLIC SdrGrafObj : public SdrRectObj
+{
+private:
+ // to allow sdr::properties::GraphicProperties access to SetXPolyDirty()
+ friend class sdr::properties::GraphicProperties;
+
+ // to allow sdr::contact::ViewObjectContactOfGraphic access to ImpUpdateGraphicLink()
+ friend class sdr::contact::ViewObjectContactOfGraphic;
+ friend class SdrGraphicLink;
+
+protected:
+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+ virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
+
+ void ImpSetAttrToGrafInfo(); // Werte vom Pool kopieren
+ void ImpSetGrafInfoToAttr(); // Werte in den Pool kopieren
+ GraphicAttr aGrafInfo;
+
+ Rectangle aCropRect; // Wenn aCropRect nicht Empty ist, dann enthaelt es den sichtbaren
+ // Ausschnitt der Grafik in logischen Eingeiten der Grafik! Also Bitmap->=Pixel
+ String aFileName; // Wenn es sich um einen Link handelt, steht hier der Dateiname drin.
+ String aFilterName;
+ GraphicObject* pGraphic; // Zur Beschleunigung von Bitmapausgaben, besonders von gedrehten.
+ SdrGraphicLink* pGraphicLink; // Und hier noch ein Pointer fuer gelinkte Grafiken
+ bool bMirrored; // True bedeutet, die Grafik ist horizontal, d.h. ueber die Y-Achse gespiegelt auszugeben.
+
+ // #111096#
+ // Flag for allowing text animation. Default is sal_true.
+ unsigned mbGrafAnimationAllowed : 1;
+
+ // #i25616#
+ unsigned mbInsidePaint : 1;
+ unsigned mbIsPreview : 1;
+
+protected:
+
+ void ImpLinkAnmeldung();
+ void ImpLinkAbmeldung();
+ sal_Bool ImpUpdateGraphicLink( sal_Bool bAsynchron = sal_True ) const;
+ void ImpSetLinkedGraphic( const Graphic& rGraphic );
+ DECL_LINK( ImpSwapHdl, GraphicObject* );
+
+public:
+
+ TYPEINFO();
+
+ SdrGrafObj();
+ SdrGrafObj(const Graphic& rGrf);
+ SdrGrafObj(const Graphic& rGrf, const Rectangle& rRect);
+ virtual ~SdrGrafObj();
+
+ void SetGraphicObject( const GraphicObject& rGrfObj );
+ const GraphicObject& GetGraphicObject( bool bForceSwapIn = false) const;
+
+ void NbcSetGraphic(const Graphic& rGrf);
+ void SetGraphic(const Graphic& rGrf);
+ const Graphic& GetGraphic() const;
+
+ Graphic GetTransformedGraphic( sal_uIntPtr nTransformFlags = SDRGRAFOBJ_TRANSFORMATTR_ALL ) const;
+
+ GraphicType GetGraphicType() const;
+
+ // #111096#
+ // Keep ATM for SD.
+ sal_Bool IsAnimated() const;
+ sal_Bool IsEPS() const;
+ sal_Bool IsSwappedOut() const;
+
+ const MapMode& GetGrafPrefMapMode() const;
+ const Size& GetGrafPrefSize() const;
+
+ void SetGrafStreamURL( const String& rGraphicStreamURL );
+ String GetGrafStreamURL() const;
+
+ void ForceSwapIn() const;
+ void ForceSwapOut() const;
+
+ void SetGraphicLink(const String& rFileName, const String& rFilterName);
+ void ReleaseGraphicLink();
+ sal_Bool IsLinkedGraphic() const { return (sal_Bool)aFileName.Len(); }
+
+ void SetFileName(const String& rFileName);
+ const String& GetFileName() const { return aFileName; }
+ void SetFilterName(const String& rFilterName);
+ const String& GetFilterName() const { return aFilterName; }
+
+ void StartAnimation(OutputDevice* pOutDev, const Point& rPoint, const Size& rSize, long nExtraData=0L);
+ void StopAnimation(OutputDevice* pOutDev=NULL, long nExtraData=0L);
+
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
+ virtual sal_uInt16 GetObjIdentifier() const;
+
+ virtual void TakeObjNameSingul(String& rName) const;
+ virtual void TakeObjNamePlural(String& rName) const;
+
+ // #i25616#
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
+
+ virtual void operator=(const SdrObject& rObj);
+
+ virtual sal_uInt32 GetHdlCount() const;
+ virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
+
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+ virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs);
+ virtual void NbcMirror(const Point& rRef1, const Point& rRef2);
+ virtual void NbcShear (const Point& rRef, long nWink, double tn, FASTBOOL bVShear);
+ virtual void NbcSetSnapRect(const Rectangle& rRect);
+ virtual void NbcSetLogicRect(const Rectangle& rRect);
+ virtual SdrObjGeoData* NewGeoData() const;
+ virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
+ virtual void RestGeoData(const SdrObjGeoData& rGeo);
+
+ FASTBOOL HasGDIMetaFile() const;
+ const GDIMetaFile* GetGDIMetaFile() const;
+
+ virtual void SetPage(SdrPage* pNewPage);
+ virtual void SetModel(SdrModel* pNewModel);
+
+ virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const;
+
+ virtual void AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly = false );
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ bool IsMirrored() { return bMirrored; }
+ void SetMirrored( bool _bMirrored ) { bMirrored = _bMirrored; }
+
+ // #111096#
+ // Access to GrafAnimationAllowed flag
+ sal_Bool IsGrafAnimationAllowed() const;
+ void SetGrafAnimationAllowed(sal_Bool bNew);
+
+ // #i25616#
+ 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
new file mode 100644
index 000000000000..9cf0ad056047
--- /dev/null
+++ b/svx/inc/svx/svdogrp.hxx
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDOGRP_HXX
+#define _SVDOGRP_HXX
+
+#include <tools/datetime.hxx>
+#include <svx/svdobj.hxx>
+#include "svx/svxdllapi.h"
+
+//************************************************************
+// Vorausdeklarationen
+//************************************************************
+
+class SdrObjList;
+class SdrObjListIter;
+class SfxItemSet;
+
+//************************************************************
+// SdrObjGroup
+//************************************************************
+
+class SVX_DLLPUBLIC SdrObjGroup : public SdrObject
+{
+private:
+protected:
+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+ virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
+
+ SdrObjList* pSub; // Subliste (Kinder)
+ long nDrehWink;
+ long nShearWink;
+
+ Point aRefPoint; // Referenzpunkt innerhalb der Objektgruppe
+ FASTBOOL bRefPoint; // Ist ein RefPoint gesetzt?
+
+public:
+ TYPEINFO();
+ SdrObjGroup();
+ virtual ~SdrObjGroup();
+
+ virtual void SetBoundRectDirty();
+ virtual sal_uInt16 GetObjIdentifier() const;
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
+ virtual SdrLayerID GetLayer() const;
+ virtual void NbcSetLayer(SdrLayerID nLayer);
+ virtual void SetObjList(SdrObjList* pNewObjList);
+ virtual void SetPage(SdrPage* pNewPage);
+ virtual void SetModel(SdrModel* pNewModel);
+ virtual FASTBOOL HasRefPoint() const;
+ virtual Point GetRefPoint() const;
+ virtual void SetRefPoint(const Point& rPnt);
+ virtual SdrObjList* GetSubList() const;
+
+ virtual const Rectangle& GetCurrentBoundRect() const;
+ virtual const Rectangle& GetSnapRect() const;
+
+ virtual void operator=(const SdrObject& rObj);
+
+ virtual void TakeObjNameSingul(String& rName) const;
+ virtual void TakeObjNamePlural(String& rName) const;
+
+ virtual void RecalcSnapRect();
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
+
+ // special drag methods
+ virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
+
+ virtual FASTBOOL BegCreate(SdrDragStat& rStat);
+
+ virtual long GetRotateAngle() const;
+ virtual long GetShearAngle(FASTBOOL bVertical=sal_False) const;
+
+ virtual void Move(const Size& rSiz);
+ virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+ virtual void Rotate(const Point& rRef, long nWink, double sn, double cs);
+ virtual void Mirror(const Point& rRef1, const Point& rRef2);
+ virtual void Shear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear);
+ virtual void SetAnchorPos(const Point& rPnt);
+ virtual void SetRelativePos(const Point& rPnt);
+ virtual void SetSnapRect(const Rectangle& rRect);
+ virtual void SetLogicRect(const Rectangle& rRect);
+
+ virtual void NbcMove(const Size& rSiz);
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+ virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs);
+ virtual void NbcMirror(const Point& rRef1, const Point& rRef2);
+ virtual void NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear);
+ virtual void NbcSetAnchorPos(const Point& rPnt);
+ virtual void NbcSetRelativePos(const Point& rPnt);
+ virtual void NbcSetSnapRect(const Rectangle& rRect);
+ virtual void NbcSetLogicRect(const Rectangle& rRect);
+
+ virtual void NbcReformatText();
+ virtual void ReformatText();
+
+ virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const;
+};
+
+#endif //_SVDOGRP_HXX
+
diff --git a/svx/inc/svx/svdomeas.hxx b/svx/inc/svx/svdomeas.hxx
new file mode 100644
index 000000000000..9be5e7e2e73b
--- /dev/null
+++ b/svx/inc/svx/svdomeas.hxx
@@ -0,0 +1,217 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDOMEAS_HXX
+#define _SVDOMEAS_HXX
+
+#include <svx/svdotext.hxx>
+#include "svx/svxdllapi.h"
+#include <editeng/measfld.hxx>
+
+//************************************************************
+// Vorausdeklarationen
+//************************************************************
+
+class SdrOutliner;
+struct ImpMeasureRec;
+struct ImpMeasurePoly;
+
+namespace sdr { namespace properties {
+ class MeasureProperties;
+}}
+
+//************************************************************
+// Hilfsklasse SdrMeasureObjGeoData
+//************************************************************
+
+class SdrMeasureObjGeoData : public SdrTextObjGeoData
+{
+public:
+ Point aPt1;
+ Point aPt2;
+
+public:
+ SdrMeasureObjGeoData();
+ virtual ~SdrMeasureObjGeoData();
+};
+
+//************************************************************
+// SdrMeasureObj
+//************************************************************
+
+class SVX_DLLPUBLIC SdrMeasureObj : public SdrTextObj
+{
+private:
+ // to allow sdr::properties::MeasureProperties access to SetTextDirty()
+ friend class sdr::properties::MeasureProperties;
+
+ friend class SdrMeasureField;
+
+protected:
+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+ virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
+
+ Point aPt1;
+ Point aPt2;
+ FASTBOOL bTextDirty;
+
+protected:
+ void ImpTakeAttr(ImpMeasureRec& rRec) const;
+ void TakeRepresentation( XubString& rStr, SdrMeasureFieldKind eMeasureFieldKind ) const;
+ void ImpCalcGeometrics(const ImpMeasureRec& rRec, ImpMeasurePoly& rPol) const;
+ basegfx::B2DPolyPolygon ImpCalcXPoly(const ImpMeasurePoly& rPol) const;
+ void ImpEvalDrag(ImpMeasureRec& rRec, const SdrDragStat& rDrag) const;
+ void SetTextDirty() { bTextDirty=sal_True; SetTextSizeDirty(); if (!aOutRect.IsEmpty()) { SetBoundRectDirty(); SetRectsDirty(sal_True); } }
+ void UndirtyText() const;
+
+ virtual SdrObjGeoData* NewGeoData() const;
+ virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
+ virtual void RestGeoData(const SdrObjGeoData& rGeo);
+
+public:
+ TYPEINFO();
+ SdrMeasureObj();
+ SdrMeasureObj(const Point& rPt1, const Point& rPt2);
+ virtual ~SdrMeasureObj();
+
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
+ virtual sal_uInt16 GetObjIdentifier() const;
+ virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const;
+ virtual void operator=(const SdrObject& rObj);
+
+ virtual void TakeObjNameSingul(String& rName) const;
+ virtual void TakeObjNamePlural(String& rName) const;
+
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
+ virtual sal_uInt32 GetHdlCount() const;
+ virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
+
+ // special drag methods
+ virtual bool hasSpecialDrag() const;
+ virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
+ virtual bool applySpecialDrag(SdrDragStat& rDrag);
+ virtual String getSpecialDragComment(const SdrDragStat& rDrag) const;
+
+ virtual FASTBOOL BegCreate(SdrDragStat& rStat);
+ virtual FASTBOOL MovCreate(SdrDragStat& rStat);
+ virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
+ virtual FASTBOOL BckCreate(SdrDragStat& rStat);
+ virtual void BrkCreate(SdrDragStat& rStat);
+ virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const;
+ virtual Pointer GetCreatePointer() const;
+
+ virtual void NbcMove(const Size& rSiz);
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+ virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs);
+ virtual void NbcMirror(const Point& rRef1, const Point& rRef2);
+ virtual void NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear);
+ virtual long GetRotateAngle() const;
+ virtual void RecalcSnapRect();
+
+ virtual sal_uInt32 GetSnapPointCount() const;
+ virtual Point GetSnapPoint(sal_uInt32 i) const;
+
+ virtual sal_Bool IsPolyObj() const;
+ virtual sal_uInt32 GetPointCount() const;
+ virtual Point GetPoint(sal_uInt32 i) const;
+ virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 i);
+
+ virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const;
+
+ virtual sal_Bool BegTextEdit(SdrOutliner& rOutl);
+ virtual const Size& GetTextSize() const;
+ virtual void TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, FASTBOOL bNoEditText=sal_False,
+ Rectangle* pAnchorRect=NULL, sal_Bool bLineWidth=sal_True ) const;
+ virtual void TakeTextAnchorRect(Rectangle& rAnchorRect) const;
+ virtual void TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle* pViewInit, Rectangle* pViewMin) const;
+ virtual sal_uInt16 GetOutlinerViewAnchorMode() const;
+ virtual void NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject);
+ virtual OutlinerParaObject* GetOutlinerParaObject() const;
+
+ virtual FASTBOOL CalcFieldValue(const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos,
+ FASTBOOL bEdit, Color*& rpTxtColor, Color*& rpFldColor, String& rRet) const;
+
+ // #i97878#
+ virtual sal_Bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const;
+ virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon);
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// Creating:
+// ~~~~~~~~~
+// Dragging von Bezugspunkt 1 zu Bezugspunkt 2 -> Bezugskante
+//
+// Die Defaults:
+// ~~~~~~~~~~~~~
+// Masslinie und Masshilfslinien: Haarlinien solid schwarz
+// Pfeile: 2mm x 4mm
+// Textgroesse
+// ___
+// | Masszahl | 2mm
+// |<--------------------->|---
+// | | 8mm
+// | |
+// Pt1============# Pt2-- <----Bezugskante (von Pt1 nach Pt2)
+// # # |___ <- Ueberstand der Masshilfslinie(n)
+// # #=========#
+// # Zu bemassendes Objekt #
+// #=======================#
+//
+// Attribute:
+// ~~~~~~~~~~
+// 1. Wo steht der Text: mitte, rechts oder links (def=automatik)
+// 2. Text oberhalb der Linie oder unterhalb oder Linie unterbrochen durch Text (def=automatik)
+// 3. Den Abstand der Masslinie zur Bezugskante (=zum bemassten Objekt).
+// Default=8mm
+// 4. Masslinie unterhalb der Bezugskante (default=nein)
+// 5. Die Ueberlaenge(n) der Masshilfslinien ueber die Bezugskante (2x, default=0)
+// 6. Den Ueberhang der Masshilfslinien ueber die Masslinie (default=2mm)
+// 7. Den Abstand der Masshilfslinien zur Bezugskante
+//
+// Dragging: Handle Shift
+// ~~~~~~~~~
+// - Die Bezugspunkte SolidQuadHdl nur die Laenge
+// 1.+2. Anpacken des Textes
+// 3.+4. Hdl am Pfeil (2x) SolidQuadHdl nur den Bool
+// 5. Hdl am Endpunkt CircHdl beide Laengen?
+// 6.+7. Kein Dragging
+//
+// Offen:
+// ~~~~~~
+// - Radien (gleich als Typ verankern
+//
+// Special:
+// ~~~~~~~~
+// Connecting an max. 2 Objekte
+// -> Bei Copy, etc. den entspr. Code der Verbinder verwenden?!?
+// wird wohl recht kompliziert werden ...
+//
+/////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDOMEAS_HXX
+
diff --git a/svx/inc/svx/svdomedia.hxx b/svx/inc/svx/svdomedia.hxx
new file mode 100644
index 000000000000..46991a66c526
--- /dev/null
+++ b/svx/inc/svx/svdomedia.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDOMEDIA_HXX
+#define _SVDOMEDIA_HXX
+
+#include <svx/svdorect.hxx>
+#include <avmedia/mediaitem.hxx>
+#include "svx/svxdllapi.h"
+
+class Graphic;
+
+namespace sdr { namespace contact { class ViewContactOfSdrMediaObj; } }
+
+// ---------------
+// - SdrMediaObj -
+// ---------------
+
+class SVX_DLLPUBLIC SdrMediaObj : public SdrRectObj
+{
+ friend class ::sdr::contact::ViewContactOfSdrMediaObj;
+
+public:
+
+ TYPEINFO();
+
+ SdrMediaObj();
+ SdrMediaObj( const Rectangle& rRect );
+
+ virtual ~SdrMediaObj();
+
+ virtual FASTBOOL HasTextEdit() const;
+
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
+ virtual sal_uInt16 GetObjIdentifier() const;
+
+ virtual void TakeObjNameSingul(String& rName) const;
+ virtual void TakeObjNamePlural(String& rName) const;
+
+ virtual void operator=(const SdrObject& rObj);
+
+ virtual void AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly = false );
+
+public:
+
+ void setURL( const ::rtl::OUString& rURL );
+ const ::rtl::OUString& getURL() const;
+
+ void setMediaProperties( const ::avmedia::MediaItem& rState );
+ const ::avmedia::MediaItem& getMediaProperties() const;
+
+ bool hasPreferredSize() const;
+ Size getPreferredSize() const;
+
+ const Graphic& getGraphic() const;
+ void setGraphic( const Graphic* pGraphic = NULL );
+
+protected:
+
+ virtual void mediaPropertiesChanged( const ::avmedia::MediaItem& rNewState );
+ virtual ::sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+
+private:
+
+ ::avmedia::MediaItem maMediaProperties;
+ ::std::auto_ptr< Graphic > mapGraphic;
+};
+
+#endif //_SVDOMEDIA_HXX
diff --git a/svx/inc/svx/svdoole2.hxx b/svx/inc/svx/svdoole2.hxx
new file mode 100644
index 000000000000..59327e85868d
--- /dev/null
+++ b/svx/inc/svx/svdoole2.hxx
@@ -0,0 +1,190 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDOOLE2_HXX
+#define _SVDOOLE2_HXX
+
+#include <svtools/embedhlp.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/datatransfer/XTransferable.hpp>
+#include "com/sun/star/awt/XWindow.hpp"
+#include <svx/svdorect.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/gdimtf.hxx>
+#include <sot/storage.hxx>
+#include "svx/svxdllapi.h"
+
+//************************************************************
+// SdrOle2Obj
+//************************************************************
+
+class SvxUnoShapeModifyListener;
+class SdrOle2ObjImpl;
+
+class SVX_DLLPUBLIC SdrOle2Obj : public SdrRectObj
+{
+private:
+
+ SVX_DLLPRIVATE void Connect_Impl();
+ SVX_DLLPRIVATE void Disconnect_Impl();
+ SVX_DLLPRIVATE void Reconnect_Impl();
+ SVX_DLLPRIVATE void AddListeners_Impl();
+ SVX_DLLPRIVATE void RemoveListeners_Impl();
+ SVX_DLLPRIVATE ::com::sun::star::uno::Reference < ::com::sun::star::datatransfer::XTransferable > GetTransferable_Impl() const;
+ SVX_DLLPRIVATE void GetObjRef_Impl();
+ SVX_DLLPRIVATE void SetGraphic_Impl(const Graphic* pGrf);
+
+protected:
+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+ virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
+
+ svt::EmbeddedObjectRef xObjRef;
+ Graphic* pGraphic;
+ String aProgName;
+
+ // wg. Kompatibilitaet erstmal am SdrTextObj
+ sal_Bool bFrame : 1;
+ sal_Bool bInDestruction : 1;
+ mutable bool m_bTypeAsked;
+ mutable bool m_bChart;
+
+ SdrOle2ObjImpl* mpImpl;
+
+ SvxUnoShapeModifyListener* pModifyListener;
+
+protected:
+
+ void ImpSetVisAreaSize();
+ void Init();
+
+public:
+ TYPEINFO();
+
+ SdrOle2Obj(FASTBOOL bFrame_=sal_False);
+ SdrOle2Obj(const svt::EmbeddedObjectRef& rNewObjRef, FASTBOOL bFrame_=sal_False);
+ SdrOle2Obj(const svt::EmbeddedObjectRef& rNewObjRef, const String& rNewObjName, FASTBOOL bFrame_=sal_False);
+ SdrOle2Obj(const svt::EmbeddedObjectRef& rNewObjRef, const String& rNewObjName, const Rectangle& rNewRect, FASTBOOL bFrame_=sal_False);
+ virtual ~SdrOle2Obj();
+
+ // access to svt::EmbeddedObjectRef
+ const svt::EmbeddedObjectRef& getEmbeddedObjectRef() const { return xObjRef; }
+
+ sal_Int64 GetAspect() const { return xObjRef.GetViewAspect(); }
+ void SetAspect( sal_Int64 nAspect );
+
+ // Ein OLE-Zeichenobjekt kann eine StarView-Grafik beinhalten.
+ // Diese wird angezeigt, wenn das OLE-Objekt leer ist.
+ void SetGraphic(const Graphic* pGrf);
+ Graphic* GetGraphic() const;
+ void GetNewReplacement();
+
+ // the original size of the object ( size of the icon for iconified object )
+ // no conversion is done if no target mode is provided
+ Size GetOrigObjSize( MapMode* pTargetMapMode = NULL ) const;
+
+
+ // OLE object has got a separate PersistName member now;
+ // !!! use ::SetPersistName( ... ) only, if you know what you do !!!
+ String GetPersistName() const;
+ void SetPersistName( const String& rPersistName );
+
+ // Einem SdrOle2Obj kann man ein Applikationsnamen verpassen, den man
+ // spaeter wieder abfragen kann (SD braucht das fuer Praesentationsobjekte).
+ void SetProgName(const String& rNam) { aProgName=rNam; }
+ const String& GetProgName() const { return aProgName; }
+ FASTBOOL IsEmpty() const;
+
+ void SetObjRef(const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >& rNewObjRef);
+ com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetObjRef() const;
+
+ SVX_DLLPRIVATE com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetObjRef_NoInit() const;
+
+ void AbandonObject();
+
+ virtual void SetPage(SdrPage* pNewPage);
+ virtual void SetModel(SdrModel* pModel);
+
+ /** Change the IsClosedObj attribute
+
+ @param bIsClosed
+ Whether the OLE object is closed, i.e. has opaque background
+ */
+ void SetClosedObj( bool bIsClosed );
+
+ // FullDrag support
+ virtual SdrObject* getFullDragClone() const;
+
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
+ virtual sal_uInt16 GetObjIdentifier() const;
+ virtual void TakeObjNameSingul(String& rName) const;
+ virtual void TakeObjNamePlural(String& rName) const;
+
+ virtual void operator=(const SdrObject& rObj);
+
+ virtual void NbcMove(const Size& rSize);
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+ virtual void NbcSetSnapRect(const Rectangle& rRect);
+ 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 );
+ sal_Bool Unload();
+ void Connect();
+ void Disconnect();
+ void ObjectLoaded();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getXModel() const;
+
+ // #109985#
+ sal_Bool IsChart() const;
+ sal_Bool IsCalc() const;
+
+ sal_Bool UpdateLinkURL_Impl();
+ void BreakFileLink_Impl();
+ void DisconnectFileLink_Impl();
+ void CheckFileLink_Impl();
+
+ // allows to transfer the graphics to the object helper
+ void SetGraphicToObj( const Graphic& aGraphic, const ::rtl::OUString& aMediaType );
+ void SetGraphicToObj( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xGrStream,
+ const ::rtl::OUString& aMediaType );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetParentXModel() const;
+ sal_Bool CalculateNewScaling( Fraction& aScaleWidth, Fraction& aScaleHeight, Size& aObjAreaSize );
+ sal_Bool AddOwnLightClient();
+
+ // handy to get the empty replacement bitmap without accessing all the old stuff
+ static Bitmap GetEmtyOLEReplacementBitmap();
+
+ void SetWindow(const com::sun::star::uno::Reference < com::sun::star::awt::XWindow >& _xWindow);
+};
+
+#endif //_SVDOOLE2_HXX
+
diff --git a/svx/inc/svx/svdopage.hxx b/svx/inc/svx/svdopage.hxx
new file mode 100644
index 000000000000..7307bc7275bb
--- /dev/null
+++ b/svx/inc/svx/svdopage.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDOPAGE_HXX
+#define _SVDOPAGE_HXX
+
+#include <svx/svdobj.hxx>
+#include <svx/sdrpageuser.hxx>
+#include "svx/svxdllapi.h"
+
+class SVX_DLLPUBLIC SdrPageObj : public SdrObject, public sdr::PageUser
+{
+public:
+ // this method is called form the destructor of the referenced page.
+ // do all necessary action to forget the page. It is not necessary to call
+ // RemovePageUser(), that is done form the destructor.
+ virtual void PageInDestruction(const SdrPage& rPage);
+
+private:
+ // #111111#
+ // To make things more safe, remember the page, not a number
+ SdrPage* mpShownPage;
+
+protected:
+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+ virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
+
+public:
+ TYPEINFO();
+ SdrPageObj(SdrPage* pNewPage = 0L);
+ SdrPageObj(const Rectangle& rRect, SdrPage* pNewPage = 0L);
+ ~SdrPageObj();
+
+ // #111111#
+ SdrPage* GetReferencedPage() const;
+ void SetReferencedPage(SdrPage* pNewPage);
+
+ // #i96598#
+ virtual void SetBoundRectDirty();
+
+ virtual sal_uInt16 GetObjIdentifier() const;
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
+ virtual void operator=(const SdrObject& rObj);
+
+ virtual void TakeObjNameSingul(String& rName) const;
+ virtual void TakeObjNamePlural(String& rName) const;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDOPAGE_HXX
+
diff --git a/svx/inc/svx/svdopath.hxx b/svx/inc/svx/svdopath.hxx
new file mode 100644
index 000000000000..0030d48d6d6c
--- /dev/null
+++ b/svx/inc/svx/svdopath.hxx
@@ -0,0 +1,195 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDOPATH_HXX
+#define _SVDOPATH_HXX
+
+#include <svx/svdotext.hxx>
+#include <svx/xpoly.hxx>
+#include "svx/svxdllapi.h"
+#include <basegfx/vector/b2enums.hxx>
+
+//************************************************************
+// Vorausdeklarationen
+//************************************************************
+
+class ImpPathForDragAndCreate;
+
+//************************************************************
+// Hilfsklasse SdrPathObjGeoData
+//
+// fuer Undo/Redo
+//
+//************************************************************
+
+class SdrPathObjGeoData : public SdrTextObjGeoData
+{
+public:
+ basegfx::B2DPolyPolygon maPathPolygon;
+ SdrObjKind meKind;
+
+ SdrPathObjGeoData();
+ virtual ~SdrPathObjGeoData();
+};
+
+//************************************************************
+// SdrPathObj
+//************************************************************
+
+class SVX_DLLPUBLIC SdrPathObj : public SdrTextObj
+{
+private:
+ friend class ImpPathForDragAndCreate;
+
+protected:
+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+
+ basegfx::B2DPolyPolygon maPathPolygon;
+ SdrObjKind meKind;
+
+ // for isolation of old Drag/Create code
+ ImpPathForDragAndCreate* mpDAC;
+
+protected:
+ // Hilfsfunktion fuer GET/SET/INS/etc. PNT
+ void ImpSetClosed(sal_Bool bClose);
+ void ImpForceKind();
+ void ImpForceLineWink();
+ ImpPathForDragAndCreate& impGetDAC() const;
+ void impDeleteDAC() const;
+
+public:
+ static sal_Bool ImpFindPolyPnt(const basegfx::B2DPolyPolygon& rPoly, sal_uInt32 nAbsPnt, sal_uInt32& rPolyNum, sal_uInt32& rPointNum);
+ virtual void SetRectsDirty(sal_Bool bNotMyself = sal_False);
+
+public:
+ TYPEINFO();
+ SdrPathObj(SdrObjKind eNewKind);
+ SdrPathObj(SdrObjKind eNewKind, const basegfx::B2DPolyPolygon& rPathPoly);
+ virtual ~SdrPathObj();
+
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
+ virtual sal_uInt16 GetObjIdentifier() const;
+ virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const;
+ virtual void operator=(const SdrObject& rObj);
+
+ virtual void TakeObjNameSingul(String& rName) const;
+ virtual void TakeObjNamePlural(String& rName) const;
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
+ virtual void RecalcSnapRect();
+ virtual void NbcSetSnapRect(const Rectangle& rRect);
+ virtual sal_uInt32 GetHdlCount() const;
+ virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
+ virtual sal_uInt32 GetPlusHdlCount(const SdrHdl& rHdl) const;
+ virtual SdrHdl* GetPlusHdl(const SdrHdl& rHdl, sal_uInt32 nPlNum) const;
+ virtual void AddToHdlList(SdrHdlList& rHdlList) const;
+
+ // special drag methods
+ virtual bool hasSpecialDrag() const;
+ virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
+ virtual bool applySpecialDrag(SdrDragStat& rDrag);
+ virtual String getSpecialDragComment(const SdrDragStat& rDrag) const;
+ virtual basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat& rDrag) const;
+
+ virtual FASTBOOL BegCreate(SdrDragStat& rStat);
+ virtual FASTBOOL MovCreate(SdrDragStat& rStat);
+ virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
+ virtual FASTBOOL BckCreate(SdrDragStat& rStat);
+ virtual void BrkCreate(SdrDragStat& rStat);
+ virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const;
+ Pointer GetCreatePointer() const;
+
+ // during drag or create, allow accessing the so-far created/modified polyPolygon
+ basegfx::B2DPolyPolygon getObjectPolyPolygon(const SdrDragStat& rDrag) const;
+ basegfx::B2DPolyPolygon getDragPolyPolygon(const SdrDragStat& rDrag) const;
+
+ virtual void NbcMove(const Size& aSize);
+ virtual void NbcResize(const Point& rRefPnt, const Fraction& aXFact, const Fraction& aYFact);
+ virtual void NbcRotate(const Point& rRefPnt, long nAngle, double fSin, double fCos);
+ virtual void NbcMirror(const Point& rRefPnt1, const Point& rRefPnt2);
+ virtual void NbcShear(const Point& rRefPnt, long nAngle, double fTan, FASTBOOL bVShear);
+
+ virtual sal_uInt32 GetSnapPointCount() const;
+ virtual Point GetSnapPoint(sal_uInt32 i) const;
+
+ virtual sal_Bool IsPolyObj() const;
+ virtual sal_uInt32 GetPointCount() const;
+ virtual Point GetPoint(sal_uInt32 nHdlNum) const;
+ virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 nHdlNum);
+
+ // Punkt einfuegen
+ sal_uInt32 NbcInsPointOld(const Point& rPos, sal_Bool bNewObj, sal_Bool bHideHim);
+ sal_uInt32 NbcInsPoint(sal_uInt32 i, const Point& rPos, sal_Bool bNewObj, sal_Bool bHideHim);
+
+ // An diesem Punkt auftrennen
+ SdrObject* RipPoint(sal_uInt32 nHdlNum, sal_uInt32& rNewPt0Index);
+
+protected:
+ virtual SdrObjGeoData* NewGeoData() const;
+ virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
+ virtual void RestGeoData(const SdrObjGeoData& rGeo);
+
+public:
+ virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const;
+
+ // Bezierpolygon holen/setzen
+ const basegfx::B2DPolyPolygon& GetPathPoly() const { return maPathPolygon; }
+ void SetPathPoly(const basegfx::B2DPolyPolygon& rPathPoly);
+ void NbcSetPathPoly(const basegfx::B2DPolyPolygon& rPathPoly);
+
+ // Spezialfunktionen fuer Bezierpolygon-Bearbeitung
+ sal_Bool IsClosed() const { return meKind==OBJ_POLY || meKind==OBJ_PATHPOLY || meKind==OBJ_PATHFILL || meKind==OBJ_FREEFILL || meKind==OBJ_SPLNFILL; }
+ sal_Bool IsLine() const { return meKind==OBJ_PLIN || meKind==OBJ_PATHPLIN || meKind==OBJ_PATHLINE || meKind==OBJ_FREELINE || meKind==OBJ_SPLNLINE || meKind==OBJ_LINE; }
+ sal_Bool IsFreeHand() const { return meKind==OBJ_FREELINE || meKind==OBJ_FREEFILL; }
+ sal_Bool IsBezier() const { return meKind==OBJ_PATHLINE || meKind==OBJ_PATHFILL; }
+ sal_Bool IsSpline() const { return meKind==OBJ_SPLNLINE || meKind==OBJ_SPLNFILL; }
+
+ // Pfad schliessen bzw. oeffnen; im letzteren Fall den Endpunkt um
+ // "nOpenDistance" verschieben
+ void ToggleClosed(); // long nOpenDistance);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ //
+ // transformation interface for StarOfficeAPI. This implements support for
+ // homogen 3x3 matrices containing the transformation of the SdrObject. At the
+ // moment it contains a shearX, rotation and translation, but for setting all linear
+ // transforms like Scale, ShearX, ShearY, Rotate and Translate are supported.
+ //
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ // gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon
+ // with the base geometry and returns TRUE. Otherwise it returns FALSE.
+ virtual sal_Bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const;
+ // sets the base geometry of the object using infos contained in the homogen 3x3 matrix.
+ // If it's an SdrPathObj it will use the provided geometry information. The Polygon has
+ // to use (0,0) as upper left and will be scaled to the given size in the matrix.
+ virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon);
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDOPATH_HXX
+
diff --git a/svx/inc/svx/svdorect.hxx b/svx/inc/svx/svdorect.hxx
new file mode 100644
index 000000000000..20fe1c3adc76
--- /dev/null
+++ b/svx/inc/svx/svdorect.hxx
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDORECT_HXX
+#define _SVDORECT_HXX
+
+#include <svx/svdotext.hxx>
+#include "svx/svxdllapi.h"
+
+//************************************************************
+// Vorausdeklarationen
+//************************************************************
+
+class XPolygon;
+
+namespace sdr { namespace properties {
+ class RectangleProperties;
+}}
+
+//************************************************************
+// SdrRectObj
+//
+// Rechteck-Objekte (Rechteck,Kreis,...)
+//
+//************************************************************
+
+class SVX_DLLPUBLIC SdrRectObj : public SdrTextObj
+{
+private:
+ // to allow sdr::properties::RectangleProperties access to SetXPolyDirty()
+ friend class sdr::properties::RectangleProperties;
+ friend class SdrTextObj; // wg SetXPolyDirty bei GrowAdjust
+
+protected:
+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+ virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
+
+ XPolygon* mpXPoly;
+
+protected:
+ // Liefert sal_True, wenn das Painten ein Polygon erfordert.
+ FASTBOOL PaintNeedsXPoly(long nEckRad) const;
+
+protected:
+ XPolygon ImpCalcXPoly(const Rectangle& rRect1, long nRad1) const;
+ void SetXPolyDirty();
+
+ // RecalcXPoly sollte ueberladen werden. Dabei muss dann eine XPolygon
+ // Instanz generiert (new) und an mpXPoly zugewiesen werden.
+ virtual void RecalcXPoly();
+ const XPolygon& GetXPoly() const;
+ virtual void RestGeoData(const SdrObjGeoData& rGeo);
+
+public:
+ TYPEINFO();
+ // Der Eckenradius-Parameter fliegt irgendwann raus. Der Eckenradius
+ // ist dann (spaeter) ueber SfxItems einzustellen (SetAttributes()).
+ // Konstruktion eines Rechteck-Zeichenobjekts
+
+ SdrRectObj();
+ SdrRectObj(const Rectangle& rRect);
+
+ // Konstruktion eines Textrahmens
+ SdrRectObj(SdrObjKind eNewTextKind);
+ SdrRectObj(SdrObjKind eNewTextKind, const Rectangle& rRect);
+ // der sal_uInt16 eFormat nimmt Werte des enum EETextFormat entgegen
+ SdrRectObj(SdrObjKind eNewTextKind, const Rectangle& rNewRect, SvStream& rInput, const String& rBaseURL, sal_uInt16 eFormat);
+ virtual ~SdrRectObj();
+
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
+ virtual sal_uInt16 GetObjIdentifier() const;
+ virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const;
+
+ virtual void TakeObjNameSingul(String& rName) const;
+ virtual void TakeObjNamePlural(String& rName) const;
+
+ virtual void operator=(const SdrObject& rObj);
+ virtual void RecalcSnapRect();
+ virtual void NbcSetSnapRect(const Rectangle& rRect);
+ virtual void NbcSetLogicRect(const Rectangle& rRect);
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
+
+ virtual sal_uInt32 GetHdlCount() const;
+ virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
+
+ // special drag methods
+ virtual bool hasSpecialDrag() const;
+ virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
+ virtual bool applySpecialDrag(SdrDragStat& rDrag);
+ virtual String getSpecialDragComment(const SdrDragStat& rDrag) const;
+
+ virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const;
+ virtual Pointer GetCreatePointer() const;
+
+ virtual void NbcMove(const Size& rSiz);
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+ virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs);
+ virtual void NbcMirror(const Point& rRef1, const Point& rRef2);
+ virtual void NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear);
+
+ virtual FASTBOOL DoMacro(const SdrObjMacroHitRec& rRec);
+ virtual XubString GetMacroPopupComment(const SdrObjMacroHitRec& rRec) const;
+
+ virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const;
+ virtual SdrGluePoint GetCornerGluePoint(sal_uInt16 nNum) const;
+
+ virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const;
+
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
+};
+
+#endif //_SVDORECT_HXX
+
diff --git a/svx/inc/svx/svdotable.hxx b/svx/inc/svx/svdotable.hxx
new file mode 100644
index 000000000000..a9039c55d486
--- /dev/null
+++ b/svx/inc/svx/svdotable.hxx
@@ -0,0 +1,342 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_SVDOTABLE_HXX
+#define _SVX_SVDOTABLE_HXX
+
+#include <com/sun/star/text/WritingMode.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/table/XTable.hpp>
+#include <rtl/ref.hxx>
+#include "svdotext.hxx"
+#include "svx/svxdllapi.h"
+
+//------------------------------------------------------------------------
+
+class SvStream;
+class SfxStyleSheet;
+
+namespace sdr { namespace contact {
+ class ViewContactOfTableObj;
+}}
+
+namespace sdr { namespace table {
+
+class TableLayouter;
+struct ImplTableShadowPaintInfo;
+
+#ifndef CellRef
+ class Cell;
+ typedef rtl::Reference< Cell > CellRef;
+#endif
+
+//------------------------------------------------------------------------
+// SdrTableHitKind
+//------------------------------------------------------------------------
+
+enum TableHitKind
+{
+ SDRTABLEHIT_NONE,
+ SDRTABLEHIT_CELL,
+ SDRTABLEHIT_CELLTEXTAREA,
+ SDRTABLEHIT_HORIZONTAL_BORDER,
+ SDRTABLEHIT_VERTICAL_BORDER
+};
+
+//------------------------------------------------------------------------
+
+struct CellPos
+{
+ sal_Int32 mnCol;
+ sal_Int32 mnRow;
+
+ CellPos() : mnCol( 0 ), mnRow( 0 ) {}
+ CellPos( sal_Int32 nCol, sal_Int32 nRow ) { mnCol = nCol; mnRow = nRow; }
+
+ bool operator==( const CellPos& r ) const { return (r.mnCol == mnCol) && (r.mnRow == mnRow); }
+ bool operator!=( const CellPos& r ) const { return (r.mnCol != mnCol) || (r.mnRow != mnRow); }
+};
+
+//------------------------------------------------------------------------
+// TableStyleSettings
+//------------------------------------------------------------------------
+
+struct SVX_DLLPUBLIC TableStyleSettings
+{
+ bool mbUseFirstRow;
+ bool mbUseLastRow;
+ bool mbUseFirstColumn;
+ bool mbUseLastColumn;
+ bool mbUseRowBanding;
+ bool mbUseColumnBanding;
+
+ TableStyleSettings();
+ TableStyleSettings( const TableStyleSettings& rStyle );
+ TableStyleSettings& operator=(const TableStyleSettings& rStyle);
+
+ bool operator==( const TableStyleSettings& r ) const;
+};
+
+//------------------------------------------------------------------------
+// SdrTableObj
+//------------------------------------------------------------------------
+
+class SdrTableObjImpl;
+
+class SVX_DLLPUBLIC SdrTableObj : public ::SdrTextObj
+{
+ friend class Cell;
+ friend class SdrTableObjImpl;
+ friend class SdrTableModifyGuard;
+
+public:
+ SdrTableObj(SdrModel* _pModel);
+ SdrTableObj(SdrModel* _pModel, const ::Rectangle& rNewRect, sal_Int32 nColumns, sal_Int32 nRows);
+ virtual ~SdrTableObj();
+
+ TYPEINFO();
+
+ // table stuff
+
+ SdrTableObj* CloneRange( const CellPos& rStartPos, const CellPos& rEndPos );
+ void DistributeColumns( sal_Int32 nFirstColumn, sal_Int32 nLastColumn );
+ void DistributeRows( sal_Int32 nFirstRow, sal_Int32 nLastRow );
+
+ com::sun::star::uno::Reference< com::sun::star::table::XTable > getTable() const;
+
+ bool isValid( const sdr::table::CellPos& rPos ) const;
+ CellPos getFirstCell() const;
+ CellPos getLastCell() const;
+ CellPos getLeftCell( const CellPos& rPos, bool bEdgeTravel ) const;
+ CellPos getRightCell( const CellPos& rPos, bool bEdgeTravel ) const;
+ CellPos getUpCell( const CellPos& rPos, bool bEdgeTravel ) const;
+ CellPos getDownCell( const CellPos& rPos, bool bEdgeTravel ) const;
+ CellPos getPreviousCell( const CellPos& rPos, bool bEdgeTravel ) const;
+ CellPos getNextCell( const CellPos& rPos, bool bEdgeTravel ) const;
+ CellPos getPreviousRow( const CellPos& rPos, bool bEdgeTravel ) const;
+ CellPos getNextRow( const CellPos& rPos, bool bEdgeTravel ) const;
+
+ void createCell( ::sdr::table::CellRef& xCell );
+
+ const ::sdr::table::TableStyleSettings& getTableStyleSettings() const;
+ void setTableStyleSettings( const ::sdr::table::TableStyleSettings& rStyle );
+
+ TableHitKind CheckTableHit( const Point& rPos, sal_Int32& rnX, sal_Int32& rnY, int nTol ) const;
+
+ void uno_lock();
+ void uno_unlock();
+
+ /** the active table has the focus or is currently edited */
+ const ::sdr::table::CellRef& getActiveCell() const;
+
+ void setActiveCell( const sdr::table::CellPos& rPos );
+ void getActiveCellPos( sdr::table::CellPos& rPos ) const;
+
+ sal_Int32 getRowCount() const;
+ sal_Int32 getColumnCount() const;
+
+ void getCellBounds( const sdr::table::CellPos& rPos, ::Rectangle& rCellRect );
+
+ const SfxItemSet& GetActiveCellItemSet() const;
+
+ void InsertRows( sal_Int32 nIndex, sal_Int32 nCount = 1 );
+ void InsertColumns( sal_Int32 nIndex, sal_Int32 nCount = 1 );
+ void DeleteRows( sal_Int32 nIndex, sal_Int32 nCount = 1 );
+ void DeleteColumns( sal_Int32 nIndex, sal_Int32 nCount = 1 );
+
+ void setTableStyle( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xAutoFormatStyle );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& getTableStyle() const;
+
+ // text stuff
+
+ /** returns the currently active text. */
+ virtual SdrText* getActiveText() const;
+
+ /** returns the nth available text. */
+ virtual SdrText* getText( sal_Int32 nIndex ) const;
+
+ /** returns the number of texts available for this object. */
+ virtual sal_Int32 getTextCount() const;
+
+ /** changes the current active text */
+ virtual void setActiveText( sal_Int32 nIndex );
+
+ /** returns the index of the text that contains the given point or -1 */
+ virtual sal_Int32 CheckTextHit(const Point& rPnt) const;
+
+ virtual bool HasText() const;
+ sal_Bool IsTextEditActive() const { return (pEdtOutl != 0L); }
+ bool IsTextEditActive( const sdr::table::CellPos& rPos );
+
+ /** returns true only if we are in edit mode and the user actually changed anything */
+ virtual bool IsRealyEdited() const;
+
+ void FitFrameToTextSize();
+
+ SdrOutliner* GetCellTextEditOutliner( const sdr::table::CellPos& rPos ) const;
+
+ // Gleichzeitig wird der Text in den Outliner gesetzt (ggf.
+ // der des EditOutliners) und die PaperSize gesetzt.
+ virtual void TakeTextRect( const sdr::table::CellPos& rPos, SdrOutliner& rOutliner, ::Rectangle& rTextRect, FASTBOOL bNoEditText=sal_False, ::Rectangle* pAnchorRect=NULL, sal_Bool bLineWidth=sal_True ) const;
+ virtual void TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, FASTBOOL bNoEditText=sal_False, Rectangle* pAnchorRect=NULL, sal_Bool bLineWidth=sal_True ) const;
+ virtual void TakeTextAnchorRect(const sdr::table::CellPos& rPos, ::Rectangle& rAnchorRect ) const;
+ virtual void TakeTextAnchorRect(::Rectangle& rAnchorRect) const;
+
+ virtual FASTBOOL IsAutoGrowHeight() const;
+ long GetMinTextFrameHeight() const;
+ long GetMaxTextFrameHeight() const;
+ virtual FASTBOOL IsAutoGrowWidth() const;
+ long GetMinTextFrameWidth() const;
+ long GetMaxTextFrameWidth() const;
+
+ virtual FASTBOOL IsFontwork() const;
+
+ virtual void SetPage(SdrPage* pNewPage);
+ virtual void SetModel(SdrModel* pNewModel);
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
+ virtual sal_uInt16 GetObjIdentifier() const;
+ virtual void SetChanged();
+
+ virtual FASTBOOL AdjustTextFrameWidthAndHeight(Rectangle& rR, FASTBOOL bHgt=sal_True, FASTBOOL bWdt=sal_True) const;
+ virtual FASTBOOL AdjustTextFrameWidthAndHeight(FASTBOOL bHgt=sal_True, FASTBOOL bWdt=sal_True);
+ virtual void TakeObjNameSingul(String& rName) const;
+ virtual void TakeObjNamePlural(String& rName) const;
+ virtual void operator=(const SdrObject& rObj);
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
+ virtual basegfx::B2DPolyPolygon TakeContour() const;
+ virtual void RecalcSnapRect();
+ virtual const Rectangle& GetSnapRect() const;
+ virtual void NbcSetSnapRect(const Rectangle& rRect);
+
+ virtual const Rectangle& GetLogicRect() const;
+ virtual void NbcSetLogicRect(const Rectangle& rRect);
+ virtual void AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly = false );
+
+ virtual sal_uInt32 GetSnapPointCount() const;
+ virtual Point GetSnapPoint(sal_uInt32 i) const;
+
+ virtual sal_uInt32 GetHdlCount() const;
+ virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
+ virtual void AddToHdlList(SdrHdlList& rHdlList) const;
+
+ // special drag methods
+ virtual bool hasSpecialDrag() const;
+ virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
+ virtual bool applySpecialDrag(SdrDragStat& rDrag);
+ virtual String getSpecialDragComment(const SdrDragStat& rDrag) const;
+ virtual basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat& rDrag) const;
+
+ virtual FASTBOOL BegCreate(SdrDragStat& rStat);
+ virtual FASTBOOL MovCreate(SdrDragStat& rStat);
+ virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
+ virtual FASTBOOL BckCreate(SdrDragStat& rStat);
+ virtual void BrkCreate(SdrDragStat& rStat);
+ virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const;
+ virtual Pointer GetCreatePointer() const;
+
+ virtual void NbcMove(const Size& rSiz);
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+
+ virtual sal_Bool BegTextEdit(SdrOutliner& rOutl);
+ virtual void EndTextEdit(SdrOutliner& rOutl);
+ virtual void TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle* pViewInit, Rectangle* pViewMin) const;
+ virtual void TakeTextEditArea(const sdr::table::CellPos& rPos, Size* pPaperMin, Size* pPaperMax, Rectangle* pViewInit, Rectangle* pViewMin) const;
+ virtual sal_uInt16 GetOutlinerViewAnchorMode() const;
+
+ virtual void NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject);
+
+ virtual OutlinerParaObject* GetOutlinerParaObject() const;
+ virtual OutlinerParaObject* GetEditOutlinerParaObject() const;
+
+ virtual void NbcReformatText();
+ virtual void ReformatText();
+
+ void SetTextEditOutliner(SdrOutliner* pOutl) { pEdtOutl=pOutl; }
+
+ virtual sal_Bool IsVerticalWriting() const;
+ virtual void SetVerticalWriting(sal_Bool bVertical);
+
+ com::sun::star::text::WritingMode GetWritingMode() const;
+
+ virtual void onEditOutlinerStatusEvent( EditStatus* pEditStatus );
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ //
+ // transformation interface for StarOfficeAPI. This implements support for
+ // homogen 3x3 matrices containing the transformation of the SdrObject. At the
+ // moment it contains a shearX, rotation and translation, but for setting all linear
+ // transforms like Scale, ShearX, ShearY, Rotate and Translate are supported.
+ //
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ // gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon
+ // with the base geometry and returns TRUE. Otherwise it returns FALSE.
+ virtual sal_Bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const;
+
+ // sets the base geometry of the object using infos contained in the homogen 3x3 matrix.
+ // If it's an SdrPathObj it will use the provided geometry information. The Polygon has
+ // to use (0,0) as upper left and will be scaled to the given size in the matrix.
+ virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon);
+
+ // #103836# iterates over the paragraphs of a given SdrObject and removes all
+ // hard set character attributes with the which ids contained in the
+ // given vector
+// virtual void RemoveOutlinerCharacterAttribs( const std::vector<sal_uInt16>& rCharWhichIds );
+
+ /** hack for clipboard with calc and writer, export and import table content as rtf table */
+ static void ExportAsRTF( SvStream& rStrm, SdrTableObj& rObj );
+ static void ImportAsRTF( SvStream& rStrm, SdrTableObj& rObj );
+
+private:
+ void init( sal_Int32 nColumns, sal_Int32 nRows );
+
+protected:
+ virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+
+ virtual SdrObjGeoData* NewGeoData() const;
+ virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
+ virtual void RestGeoData(const SdrObjGeoData& rGeo);
+
+private:
+ SdrOutliner* GetCellTextEditOutliner( const ::sdr::table::Cell& rCell ) const;
+
+private:
+ // for the ViewContactOfTableObj to build the primitive representation, it is necessary to access the
+ // TableLayouter for position and attribute informations
+ friend class sdr::contact::ViewContactOfTableObj;
+ const TableLayouter& getTableLayouter() const;
+
+ Rectangle maLogicRect;
+private:
+ SdrTableObjImpl* mpImpl;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+} }
+
+#endif
diff --git a/svx/inc/svx/svdotext.hxx b/svx/inc/svx/svdotext.hxx
new file mode 100644
index 000000000000..fe6d298af405
--- /dev/null
+++ b/svx/inc/svx/svdotext.hxx
@@ -0,0 +1,610 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDOTEXT_HXX
+#define _SVDOTEXT_HXX
+
+#include <vcl/field.hxx>
+#include <svx/svdoattr.hxx>
+#include <svx/svdtrans.hxx> // GeoStat
+#include <tools/datetime.hxx>
+#include <svx/xtextit0.hxx>
+#include "svdtext.hxx"
+#include <vector>
+#include <boost/shared_ptr.hpp>
+#include "svx/svxdllapi.h"
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <svx/svdpagv.hxx>
+
+//************************************************************
+// Vorausdeklarationen
+//************************************************************
+
+class OutlinerParaObject;
+class SdrOutliner;
+class SdrTextObj;
+class SvxFieldItem;
+class ImpSdrObjTextLink;
+class EditStatus;
+
+namespace sdr { namespace properties {
+ class TextProperties;
+}}
+
+namespace drawinglayer { namespace primitive2d {
+ class SdrContourTextPrimitive2D;
+ class SdrPathTextPrimitive2D;
+ class SdrBlockTextPrimitive2D;
+ class SdrStretchTextPrimitive2D;
+}}
+
+namespace drawinglayer { namespace animation {
+ class AnimationEntryList;
+}}
+
+namespace drawinglayer { namespace geometry {
+ class ViewInformation2D;
+}}
+
+namespace sdr { namespace table {
+ class Cell;
+ class SdrTableRtfExporter;
+ class SdrTableRTFParser;
+}}
+
+//************************************************************
+// Defines
+//************************************************************
+
+#define SDRUSERDATA_OBJTEXTLINK (1)
+
+//************************************************************
+// Hilfsklasse SdrTextObjGeoData
+//************************************************************
+
+class SdrTextObjGeoData : public SdrObjGeoData
+{
+public:
+ Rectangle aRect;
+ GeoStat aGeo;
+};
+
+//************************************************************
+// Hilfsklasse ImpSdrObjTextLinkUserData
+//************************************************************
+
+class ImpSdrObjTextLinkUserData : public SdrObjUserData
+{
+ friend class SdrTextObj;
+ friend class ImpSdrObjTextLink;
+
+ SdrTextObj* pObj;
+ String aFileName; // Name des referenzierten Dokuments
+ String aFilterName; // ggf. ein Filter
+ DateTime aFileDate0; // Unnoetiges neuladen vermeiden
+ ImpSdrObjTextLink* pLink;
+ rtl_TextEncoding eCharSet;
+
+public:
+ TYPEINFO();
+ ImpSdrObjTextLinkUserData(SdrTextObj* pObj1);
+ virtual ~ImpSdrObjTextLinkUserData();
+
+ virtual SdrObjUserData* Clone(SdrObject* pObj1) const;
+};
+
+namespace sdr
+{
+ namespace properties
+ {
+ class CustomShapeProperties;
+ class CellProperties;
+ } // end of namespace properties
+} // end of namespace sdr
+
+//************************************************************
+// SdrTextObj
+//************************************************************
+
+class SVX_DLLPUBLIC SdrTextObj : public SdrAttrObj
+{
+private:
+ // Cell needs access to ImpGetDrawOutliner();
+
+ friend class sdr::table::Cell;
+ friend class sdr::table::SdrTableRtfExporter;
+ friend class sdr::table::SdrTableRTFParser;
+
+ // CustomShapeproperties need to access the "bTextFrame" member:
+ friend class sdr::properties::CustomShapeProperties;
+
+protected:
+ virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+
+private:
+ // This method is only allowed for sdr::properties::TextProperties
+ SVX_DLLPRIVATE SdrOutliner* GetTextEditOutliner() const
+ {
+ return pEdtOutl;
+ }
+
+ // This method is only allowed for sdr::properties::TextProperties
+ SVX_DLLPRIVATE void SetPortionInfoChecked(sal_Bool bNew)
+ {
+ bPortionInfoChecked = bNew;
+ }
+
+ // to allow sdr::properties::TextProperties access to SetPortionInfoChecked()
+ // and GetTextEditOutliner()
+ friend class sdr::properties::TextProperties;
+ friend class sdr::properties::CellProperties;
+
+ friend class ImpTextPortionHandler;
+ friend class ImpSdrObjTextLink;
+ friend class ImpSdrObjTextLinkUserData;
+ friend class SdrPowerPointImport; // fuer PowerPointImport
+ friend class SdrExchangeView; // fuer ImpGetDrawOutliner
+ friend class SdrView; // fuer ImpGetDrawOutliner
+ friend class SdrObjEditView; // fuer TextEdit
+ friend class SdrMeasureObj; // fuer ImpGetDrawOutliner
+ friend class SvxMSDffManager; // fuer ImpGetDrawOutliner
+ friend class SdrObjCustomShape;// fuer ImpGetDrawOutliner
+ friend class SdrText; // fuer ImpGetDrawOutliner
+
+protected:
+ // Das aRect ist gleichzeig auch das Rect vom RectObj und CircObj.
+ // Bei bTextFrame=sal_True wird der Text in dieses Rect hineinformatiert.
+ // Bei bTextFrame=sal_False wird der Text am Mittelpunkt des Rect zentriert.
+ Rectangle aRect;
+
+ // Der GeoStat enthaelt den Drehwinkel und einen Shearwinkel
+ GeoStat aGeo;
+
+ // this is the active text
+ SdrText* mpText;
+
+ // Hier merke ich mir die Ausmasse des Textes (n.i.)
+ Size aTextSize;
+
+ // Ein Outliner*, damit
+ // 1. das TextObj nicht von mehreren Views gleichzeitig editiert und
+ // 2. beim Streamen waerend des Editierens ein Flush() ausgefuehrt
+ // werden kann
+ SdrOutliner* pEdtOutl;
+
+ // Bei Fontwork muss soviel auf's BoundRect draufgerechnet werden
+ // damit es ausreichend gross ist.
+ Rectangle* pFormTextBoundRect;
+
+ // Moegliche Werte fuer eTextKind sind:
+ // OBJ_TEXT normaler Textrahmen
+ // OBJ_TEXTEXT Textfortsetzungsrahmen
+ // OBJ_TITLETEXT TitleText fuer StarDraw-Praesentation
+ // OBJ_OUTLINETEXT OutlineText fuer StarDraw-Praesentation
+ // eTextKind hat nur Bedeutung, wenn bTextFrame=sal_True, da es sich sonst
+ // um ein beschriftetes Grafikobjekt handelt.
+ SdrObjKind eTextKind;
+
+ // #108784#
+ // For text editing in SW Haeder/Footer it is necessary to be
+ // able to set an offset for the text edit to allow text editing at the
+ // position of the virtual object. This offset is used when setting up
+ // and maintaining the OutlinerView.
+ Point maTextEditOffset;
+public:
+ const Point& GetTextEditOffset() const { return maTextEditOffset; }
+ void SetTextEditOffset(const Point& rNew) { maTextEditOffset = rNew; }
+
+protected:
+ // Fuer beschriftete Zeichenobjekte ist bTextFrame=FALSE. Der Textblock
+ // wird dann hoizontal und vertikal an aRect zentriert. Bei bTextFrame=
+ // sal_True wird der Text in aRect hineinformatiert. Der eigentliche Textrahmen
+ // ist durch ein SdrRectObj mit bTextFrame=sal_True realisiert.
+ sal_Bool bTextFrame : 1;
+ sal_Bool bPortionInfoChecked : 1; // Fuer Optimierung von Textobjekten
+ sal_Bool bNoShear : 1; // Obj darf nicht gesheart werden (->Graf+Ole+TextFrame)
+ sal_Bool bNoRotate : 1; // Obj darf nicht gedreht werden (->Ole)
+ sal_Bool bNoMirror : 1; // Obj darf nicht gespiegelt werden (->Ole,TextFrame)
+ sal_Bool bTextSizeDirty : 1;
+
+ // #101684#
+ sal_Bool mbInEditMode : 1; // Is this text obejct in edit mode?
+
+ // Fuer Objekt mit freier Groesse im Draw (Mengentext). Das Flag wird vom
+ // der App beim Create gesetzt.
+ // Wenn das Objekt dann spaeter in der Breite resized wird, wird
+ // AutoGrowWidth abgeschaltet (Hart auf sal_False attributiert). Das Flag wird
+ // dann ebenfalls auf sal_False gesetzt, sodass sich das Objekt anschliessend
+ // wie ein normales Textobjekt verhaelt.
+ // Resize in der Breite kann sein:
+ // - Interaktives Resize in Einfach- oder Mehrfachselektion
+ // - Positions+Groesse Dialog
+ sal_Bool bDisableAutoWidthOnDragging : 1;
+
+ // #111096#
+ // Allow text suppression
+ sal_Bool mbTextHidden : 1;
+
+ // #111096#
+ // Flag for allowing text animation. Default is sal_true.
+ sal_Bool mbTextAnimationAllowed : 1;
+
+ SdrOutliner& ImpGetDrawOutliner() const;
+
+private:
+ SVX_DLLPRIVATE void ImpCheckMasterCachable();
+ // #101029#: Extracted from ImpGetDrawOutliner()
+ SVX_DLLPRIVATE void ImpInitDrawOutliner( SdrOutliner& rOutl ) const;
+ // #101029#: Extracted from Paint()
+ SVX_DLLPRIVATE void ImpSetupDrawOutlinerForPaint( FASTBOOL bContourFrame,
+ SdrOutliner& rOutliner,
+ Rectangle& rTextRect,
+ Rectangle& rAnchorRect,
+ Rectangle& rPaintRect,
+ Fraction& aFitXKorreg ) 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:
+ 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();
+ void ImpSetCharStretching(SdrOutliner& rOutliner, const Rectangle& rTextRect, const Rectangle& rAnchorRect, Fraction& rFitXKorreg) const;
+ void ImpJustifyRect(Rectangle& rRect) const;
+ void ImpCheckShear();
+ Rectangle ImpDragCalcRect(const SdrDragStat& rDrag) const;
+ void ImpSetTextEditParams() const;
+ void SetTextSizeDirty() { bTextSizeDirty=sal_True; }
+
+ // rAnchorRect ist InOut-Parameter!
+ void ImpSetContourPolygon( SdrOutliner& rOutliner, Rectangle& rAnchorRect, sal_Bool bLineWidth ) const;
+
+ virtual SdrObjGeoData* NewGeoData() const;
+ virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
+ virtual void RestGeoData(const SdrObjGeoData& rGeo);
+ FASTBOOL NbcSetEckenradius(long nRad);
+ FASTBOOL NbcSetAutoGrowHeight(bool bAuto);
+ FASTBOOL NbcSetMinTextFrameHeight(long nHgt);
+ FASTBOOL NbcSetMaxTextFrameHeight(long nHgt);
+ FASTBOOL NbcSetAutoGrowWidth(bool bAuto);
+ FASTBOOL NbcSetMinTextFrameWidth(long nWdt);
+ FASTBOOL NbcSetMaxTextFrameWidth(long nWdt);
+ FASTBOOL NbcSetFitToSize(SdrFitToSizeType eFit);
+
+ // Konstruktoren fuer beschriftete Zeichenobjekte
+ SdrTextObj();
+ SdrTextObj(const Rectangle& rNewRect);
+
+ // Konstruktoren fuer Textrahmen
+ SdrTextObj(SdrObjKind eNewTextKind);
+ SdrTextObj(SdrObjKind eNewTextKind, const Rectangle& rNewRect);
+
+ // der sal_uInt16 eFormat nimmt Werte des enum EETextFormat entgegen
+ SdrTextObj(SdrObjKind eNewTextKind, const Rectangle& rNewRect, SvStream& rInput, const String& rBaseURL, sal_uInt16 eFormat);
+ virtual ~SdrTextObj();
+
+public:
+ TYPEINFO();
+
+ // #101684#
+ sal_Bool IsInEditMode() const { return mbInEditMode; }
+
+ // via eCharSet kann der CharSet der vorliegenden Datei uebergeben werden.
+ // Bei RTL_TEXTENCODING_DONTKNOW wird der CharSet der aktuellen Plattform verwendet.
+ // Derzeit unterstuetzt wird ASCII und RTF wobei ich die Unterscheidung
+ // selbst treffe. rFilterName ist noch ohne Bedeutung und muss leer gelassen
+ // werden.
+ // I.d.R. muss die App nur SetTextLink() rufen - der Rest geschieht von
+ // selbst (SfxLinkManager). Die Methode LoadText() kann ausserdem verwendet
+ // werden, um eine Datei in ein Textobjekt zu laden (ohne Verknuepfung).
+ // TextLinks koennen nicht editiert werden (allenfalls spaeter mal ReadOnly).
+ // Eine Attributierung kann nur am Textrahmen vollzogen werden.
+ void SetTextLink(const String& rFileName, const String& rFilterName, rtl_TextEncoding eCharSet);
+ void ReleaseTextLink();
+ FASTBOOL IsLinkedText() const { return pPlusData!=NULL && GetLinkUserData()!=NULL; }
+ FASTBOOL ReloadLinkedText(FASTBOOL bForceLoad=sal_False);
+ FASTBOOL LoadText(const String& rFileName, const String& rFilterName, rtl_TextEncoding eCharSet);
+
+ virtual FASTBOOL AdjustTextFrameWidthAndHeight(Rectangle& rR, FASTBOOL bHgt=sal_True, FASTBOOL bWdt=sal_True) const;
+ virtual FASTBOOL NbcAdjustTextFrameWidthAndHeight(FASTBOOL bHgt=sal_True, FASTBOOL bWdt=sal_True);
+ virtual FASTBOOL AdjustTextFrameWidthAndHeight(FASTBOOL bHgt=sal_True, FASTBOOL bWdt=sal_True);
+ void NbcResizeTextAttributes(const Fraction& xFact, const Fraction& yFact);
+ FASTBOOL IsTextFrame() const { return bTextFrame; }
+ FASTBOOL IsOutlText() const { return bTextFrame && (eTextKind==OBJ_OUTLINETEXT || eTextKind==OBJ_TITLETEXT); }
+ SdrObjKind GetTextKind() const { return eTextKind; }
+
+ virtual bool HasText() const;
+ FASTBOOL HasEditText() const;
+ sal_Bool IsTextEditActive() const { return (pEdtOutl != 0L); }
+
+ /** returns the currently active text. */
+ virtual SdrText* getActiveText() const;
+
+ /** returns the nth available text. */
+ virtual SdrText* getText( sal_Int32 nIndex ) const;
+
+ /** returns the number of texts available for this object. */
+ virtual sal_Int32 getTextCount() const;
+
+ /** returns true only if we are in edit mode and the user actually changed anything */
+ virtual bool IsRealyEdited() const;
+
+ /** changes the current active text */
+ virtual void setActiveText( sal_Int32 nIndex );
+
+ /** returns the index of the text that contains the given point or -1 */
+ virtual sal_Int32 CheckTextHit(const Point& rPnt) const;
+
+ void SetDisableAutoWidthOnDragging(FASTBOOL bOn) { bDisableAutoWidthOnDragging=bOn; }
+ FASTBOOL IsDisableAutoWidthOnDragging() { return bDisableAutoWidthOnDragging; }
+ void NbcSetText(const String& rStr);
+ void SetText(const String& rStr);
+ void NbcSetText(SvStream& rInput, const String& rBaseURL, sal_uInt16 eFormat);
+ void SetText(SvStream& rInput, const String& rBaseURL, sal_uInt16 eFormat);
+
+ // FitToSize und Fontwork wird bei GetTextSize() nicht berueksichtigt!
+ virtual const Size& GetTextSize() const;
+ void FitFrameToTextSize();
+
+ // Gleichzeitig wird der Text in den Outliner gesetzt (ggf.
+ // der des EditOutliners) und die PaperSize gesetzt.
+ virtual void TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, FASTBOOL bNoEditText=sal_False,
+ Rectangle* pAnchorRect=NULL, sal_Bool bLineWidth=sal_True ) const;
+ virtual void TakeTextAnchorRect(::Rectangle& rAnchorRect) const;
+ const GeoStat& GetGeoStat() const { return aGeo; }
+
+ long GetEckenradius() const;
+ virtual FASTBOOL IsAutoGrowHeight() const;
+ long GetMinTextFrameHeight() const;
+ long GetMaxTextFrameHeight() const;
+ virtual FASTBOOL IsAutoGrowWidth() const;
+ long GetMinTextFrameWidth() const;
+ long GetMaxTextFrameWidth() const;
+
+ SdrFitToSizeType GetFitToSize() const;
+ const Rectangle &GetGeoRect() const { return aRect; }
+
+ // Feststellen, ob TextFontwork
+ virtual FASTBOOL IsFontwork() const;
+
+ // Soll die Fontwork-Kontour versteckt werden?
+ FASTBOOL IsHideContour() const;
+
+ // Textfluss innerhalb Kontur
+ FASTBOOL IsContourTextFrame() const;
+
+ // Horizontale Textausrichtung
+ SdrTextHorzAdjust GetTextHorizontalAdjust(const SfxItemSet& rSet) const;
+ SdrTextHorzAdjust GetTextHorizontalAdjust() const;
+
+ // Vertikale Textausrichtung
+ SdrTextVertAdjust GetTextVerticalAdjust(const SfxItemSet& rSet) const;
+ SdrTextVertAdjust GetTextVerticalAdjust() const;
+
+ // Textrahmenabstaende
+ long GetTextLeftDistance() const;
+ long GetTextRightDistance() const;
+ long GetTextUpperDistance() const;
+ long GetTextLowerDistance() const;
+ SdrTextAniKind GetTextAniKind() const;
+ SdrTextAniDirection GetTextAniDirection() const;
+
+ virtual void SetPage(SdrPage* pNewPage);
+ virtual void SetModel(SdrModel* pNewModel);
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
+ virtual sal_uInt16 GetObjIdentifier() const;
+
+ // Wird zur Bestimmung des Textankerbereichs benoetigt
+ virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const;
+ virtual void TakeObjNameSingul(String& rName) const;
+ virtual void TakeObjNamePlural(String& rName) const;
+ virtual void operator=(const SdrObject& rObj);
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
+ virtual basegfx::B2DPolyPolygon TakeContour() const;
+ virtual void RecalcSnapRect();
+ virtual void NbcSetSnapRect(const Rectangle& rRect);
+ virtual void NbcSetLogicRect(const Rectangle& rRect);
+ virtual const Rectangle& GetLogicRect() const;
+ virtual long GetRotateAngle() const;
+ virtual long GetShearAngle(FASTBOOL bVertical=sal_False) const;
+
+ virtual sal_uInt32 GetSnapPointCount() const;
+ virtual Point GetSnapPoint(sal_uInt32 i) const;
+
+ virtual sal_uInt32 GetHdlCount() const;
+ virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
+
+ // special drag methods
+ virtual bool hasSpecialDrag() const;
+ virtual bool applySpecialDrag(SdrDragStat& rDrag);
+ virtual String getSpecialDragComment(const SdrDragStat& rDrag) const;
+
+ virtual FASTBOOL BegCreate(SdrDragStat& rStat);
+ virtual FASTBOOL MovCreate(SdrDragStat& rStat);
+ virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
+ virtual FASTBOOL BckCreate(SdrDragStat& rStat);
+ virtual void BrkCreate(SdrDragStat& rStat);
+ virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const;
+ virtual Pointer GetCreatePointer() const;
+
+ virtual void NbcMove(const Size& rSiz);
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+ virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs);
+ virtual void NbcMirror(const Point& rRef1, const Point& rRef2);
+ virtual void NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear);
+
+ virtual FASTBOOL HasTextEdit() const;
+ virtual sal_Bool BegTextEdit(SdrOutliner& rOutl);
+ virtual void TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle* pViewInit, Rectangle* pViewMin) const;
+ virtual void EndTextEdit(SdrOutliner& rOutl);
+ virtual sal_uInt16 GetOutlinerViewAnchorMode() const;
+
+ void StartTextAnimation(OutputDevice* pOutDev, const Point& rOffset, long nExtraData=0L);
+ void StopTextAnimation(OutputDevice* pOutDev=NULL, long nExtraData=0L);
+
+ virtual void NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject);
+ void NbcSetOutlinerParaObjectForText( OutlinerParaObject* pTextObject, SdrText* pText );
+ virtual OutlinerParaObject* GetOutlinerParaObject() const;
+ virtual OutlinerParaObject* GetEditOutlinerParaObject() const;
+ virtual bool HasOutlinerParaObject() const;
+
+ virtual void NbcReformatText();
+ virtual void ReformatText();
+
+ virtual FASTBOOL CalcFieldValue(const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos,
+ FASTBOOL bEdit, Color*& rpTxtColor, Color*& rpFldColor, String& rRet) const;
+
+ virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const;
+
+ void SetTextEditOutliner(SdrOutliner* pOutl) { pEdtOutl=pOutl; }
+
+ /** Setup given Outliner equivalently to SdrTextObj::Paint()
+
+ To setup an arbitrary Outliner in the same way as the draw
+ outliner on SdrTextObj::Paint(). Among others, the paper size,
+ control word and character stretching are initialized, such
+ that the formatting should match the screen representation.
+ The textual content of the outliner is not touched, i.e. no
+ Init() or Clear() is called on the Outliner.
+
+ @param rOutl
+ The Outliner to setup.
+
+ @param rPaintRect
+ The region to paint the outliner content into. This is useful
+ to e.g. determine the top, left position of text in shapes.
+ */
+ void SetupOutlinerFormatting( SdrOutliner& rOutl, Rectangle& rPaintRect ) const;
+
+ /** Update given Outliner equivalently to SdrTextObj::Paint()
+
+ Same functionality as in SetupOutlinerFormatting(), except
+ that the outliner content is not cleared.
+
+ @param rOutl
+ The Outliner to update.
+
+ @param rPaintRect
+ The region to paint the outliner content into. This is useful
+ to e.g. determine the top, left position of text in shapes.
+ */
+ void UpdateOutlinerFormatting( SdrOutliner& rOutl, Rectangle& rPaintRect ) const;
+ void ForceOutlinerParaObject();
+ virtual sal_Bool IsVerticalWriting() const;
+ virtual void SetVerticalWriting(sal_Bool bVertical);
+
+ /** called from the SdrObjEditView during text edit when the status of the edit outliner changes */
+ virtual void onEditOutlinerStatusEvent( EditStatus* pEditStatus );
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ //
+ // transformation interface for StarOfficeAPI. This implements support for
+ // homogen 3x3 matrices containing the transformation of the SdrObject. At the
+ // moment it contains a shearX, rotation and translation, but for setting all linear
+ // transforms like Scale, ShearX, ShearY, Rotate and Translate are supported.
+ //
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ // gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon
+ // with the base geometry and returns TRUE. Otherwise it returns FALSE.
+ virtual sal_Bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const;
+
+ // sets the base geometry of the object using infos contained in the homogen 3x3 matrix.
+ // If it's an SdrPathObj it will use the provided geometry information. The Polygon has
+ // to use (0,0) as upper left and will be scaled to the given size in the matrix.
+ virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon);
+
+ // #103836# iterates over the paragraphs of a given SdrObject and removes all
+ // hard set character attributes with the which ids contained in the
+ // given vector
+ virtual void RemoveOutlinerCharacterAttribs( const std::vector<sal_uInt16>& rCharWhichIds );
+
+ // #111096#
+ // Access to thext hidden flag
+ sal_Bool GetTextHidden() const;
+ void NbcSetTextHidden(sal_Bool bNew);
+
+ // #111096#
+ // Get necessary data for text scroll animation. ATM base it on a Text-Metafile and a
+ // painting rectangle. Rotation is taken from the object.
+ GDIMetaFile* GetTextScrollMetaFileAndRectangle(Rectangle& rScrollRectangle, Rectangle& rPaintRectangle);
+
+ // #111096#
+ // Access to TextAnimationAllowed flag
+ bool IsTextAnimationAllowed() const;
+ void SetTextAnimationAllowed(sal_Bool bNew);
+
+ // #i8824#
+ // Set single item at the local ItemSet. *Does not use* AllowItemChange(),
+ // ItemChange(), PostItemChange() and ItemSetChanged() calls.
+ void SetObjectItemNoBroadcast(const SfxPoolItem& rItem);
+
+public:
+ //////////////////////////////////////////////////////////////////////////////
+ // text primitive decomposition helpers
+ void impDecomposeContourTextPrimitive(
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+ const drawinglayer::primitive2d::SdrContourTextPrimitive2D& rSdrContourTextPrimitive,
+ const drawinglayer::geometry::ViewInformation2D& aViewInformation) const;
+ void impDecomposePathTextPrimitive(
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+ const drawinglayer::primitive2d::SdrPathTextPrimitive2D& rSdrPathTextPrimitive,
+ const drawinglayer::geometry::ViewInformation2D& aViewInformation) const;
+ void impDecomposeBlockTextPrimitive(
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+ const drawinglayer::primitive2d::SdrBlockTextPrimitive2D& rSdrBlockTextPrimitive,
+ const drawinglayer::geometry::ViewInformation2D& aViewInformation) const;
+ void impDecomposeStretchTextPrimitive(
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+ const drawinglayer::primitive2d::SdrStretchTextPrimitive2D& rSdrStretchTextPrimitive,
+ const drawinglayer::geometry::ViewInformation2D& aViewInformation) const;
+
+ //////////////////////////////////////////////////////////////////////////////
+ // timing generators
+ void impGetBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const;
+ void impGetScrollTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList, double fFrameLength, double fTextLength) const;
+
+ /** returns false if the given pointer is NULL
+ or if the given SdrOutliner contains no text.
+ Also checks for one empty paragraph.
+ */
+ static bool HasTextImpl( SdrOutliner* pOutliner );
+
+ /** returns a new created and non shared outliner.
+ The outliner will not get updated when the SdrModel is changed.
+ */
+ boost::shared_ptr< SdrOutliner > CreateDrawOutliner();
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDOTEXT_HXX
+
diff --git a/svx/inc/svx/svdouno.hxx b/svx/inc/svx/svdouno.hxx
new file mode 100644
index 000000000000..db8d5058ed67
--- /dev/null
+++ b/svx/inc/svx/svdouno.hxx
@@ -0,0 +1,163 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDOUNO_HXX
+#define _SVDOUNO_HXX
+
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#ifndef _COM_SUN_STAR_AWT_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include "svx/svxdllapi.h"
+#include <svx/svdorect.hxx>
+
+//************************************************************
+// Vorausdeklarationen
+//************************************************************
+
+class SdrView;
+class SdrPageWindow;
+class SdrControlEventListenerImpl;
+
+namespace sdr { namespace contact {
+ class ViewContactOfUnoControl;
+}}
+
+//************************************************************
+// SdrUnoObj
+//************************************************************
+
+struct SdrUnoObjDataHolder;
+class SVX_DLLPUBLIC SdrUnoObj : public SdrRectObj
+{
+ friend class SdrPageView;
+ friend class SdrControlEventListenerImpl;
+
+ SdrUnoObjDataHolder* m_pImpl;
+
+ String aUnoControlModelTypeName;
+ String aUnoControlTypeName;
+ sal_Bool bOwnUnoControlModel;
+
+protected:
+ ::com::sun::star::uno::Reference< com::sun::star::awt::XControlModel > xUnoControlModel; // kann auch von aussen gesetzt werden
+
+private:
+ SVX_DLLPRIVATE void CreateUnoControlModel(const String& rModelName);
+ SVX_DLLPRIVATE void CreateUnoControlModel(const String& rModelName,
+ const ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxSFac );
+
+public:
+ TYPEINFO();
+
+ SdrUnoObj(const String& rModelName, sal_Bool bOwnsModel = sal_True);
+ SdrUnoObj(const String& rModelName,
+ const ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxSFac,
+ sal_Bool bOwnsModel = sal_True);
+ virtual ~SdrUnoObj();
+
+ virtual void SetPage(SdrPage* pNewPage);
+ virtual void SetModel(SdrModel* pModel);
+
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
+ virtual sal_uInt16 GetObjIdentifier() const;
+
+ virtual void operator = (const SdrObject& rObj);
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+ virtual void NbcSetLayer(SdrLayerID nLayer);
+
+ // SpecialDrag support
+ virtual bool hasSpecialDrag() const;
+
+ // FullDrag support
+ virtual bool supportsFullDrag() const;
+ virtual SdrObject* getFullDragClone() const;
+
+ virtual void TakeObjNameSingul(XubString& rName) const;
+ virtual void TakeObjNamePlural(XubString& rName) const;
+
+ virtual void SetContextWritingMode( const sal_Int16 _nContextWritingMode );
+
+ ::com::sun::star::uno::Reference< com::sun::star::awt::XControlModel > GetUnoControlModel() const {return xUnoControlModel;}
+ ::com::sun::star::uno::Reference< com::sun::star::awt::XControl > GetUnoControl(const SdrView& _rView, const OutputDevice& _rOut) const;
+
+ /** retrieves a temporary XControl instance for a given output device
+
+ The method GetUnoControl, used to retrieve the XControl whose parent is a given device, only works
+ if the SdrUnoObj has already been painted at least once onto this device. However, there are valid
+ scenarios where you need certain information on how a control is painted onto a window, without
+ actually painting it. For example, you might be interested in the DeviceInfo of an UNO control.
+
+ For those cases, you can ontain an XControl which behaves as the control which *would* be used to
+ paint onto a window.
+
+ @param _rWindow
+ the window for which should act as parent for the temporary control
+ @param _inout_ControlContainer
+ the control container belonging to the window, necessary as context
+ for the newly created control. A control container is usually created by calling
+ VCLUnoHelper::CreateControlContainer.
+ If _inout_ControlContainer is <NULL/>, it will be created internally, and passed to the caller.
+ In this case, the caller also takes ownership of the control container, and is responsible for
+ disposing it when not needed anymore.
+ @return
+ The requested control. This control is temporary only, and the caller is responsible for it.
+ In particular, the caller is required to dispose it when it's not needed anymore.
+
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >
+ GetTemporaryControlForWindow(
+ const Window& _rWindow,
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& _inout_ControlContainer
+ ) const;
+
+ const String& GetUnoControlModelTypeName() const { return aUnoControlTypeName; }
+ const String& GetUnoControlTypeName() const { return aUnoControlTypeName; }
+
+ virtual void SetUnoControlModel( const ::com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >& xModel );
+
+protected:
+ // SdrObject overridables
+ virtual ::sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+
+private:
+ /** retrieves the typed ViewContact for the object
+ @param _out_rpContact
+ Upon successfull return, ->_out_rpContact contains the ViewContact.
+ @return
+ <TRUE/> if and only if the contact was successfully retrieved. In this case,
+ ->_out_rpContact contains a pointer to this contact.
+ A failure to retrieve the contact object fires an assertion in non-product builds.
+ */
+ SVX_DLLPRIVATE bool impl_getViewContact( ::sdr::contact::ViewContactOfUnoControl*& _out_rpContact ) const;
+};
+
+
+#endif // _SVDOUNO_HXX
+
diff --git a/svx/inc/svx/svdoutl.hxx b/svx/inc/svx/svdoutl.hxx
new file mode 100644
index 000000000000..f06ded64e8b6
--- /dev/null
+++ b/svx/inc/svx/svdoutl.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDOUTL_HXX
+#define _SVDOUTL_HXX
+
+#include <editeng/outliner.hxx>
+#include "svx/svxdllapi.h"
+#include <svx/svdobj.hxx>
+
+class SdrTextObj;
+class SdrPaintInfoRec;
+class SdrPage;
+
+class SVX_DLLPUBLIC SdrOutliner : public Outliner
+{
+protected:
+ SdrObjectWeakRef mpTextObj;
+ const SdrPage* mpVisualizedPage;
+
+public:
+ SdrOutliner( SfxItemPool* pItemPool, sal_uInt16 nMode );
+ virtual ~SdrOutliner() ;
+
+ void SetTextObj( const SdrTextObj* pObj );
+ void SetTextObjNoInit( const SdrTextObj* pObj );
+ const SdrTextObj* GetTextObj() const;
+
+ void setVisualizedPage(const SdrPage* pPage) { if(pPage != mpVisualizedPage) mpVisualizedPage = pPage; }
+ const SdrPage* getVisualizedPage() const { return mpVisualizedPage; }
+
+ virtual String CalcFieldValue(const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor);
+};
+
+#endif //_SVDOUTL_HXX
+
diff --git a/svx/inc/svx/svdovirt.hxx b/svx/inc/svx/svdovirt.hxx
new file mode 100644
index 000000000000..dba62f84730e
--- /dev/null
+++ b/svx/inc/svx/svdovirt.hxx
@@ -0,0 +1,165 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDOVIRT_HXX
+#define _SVDOVIRT_HXX
+
+#include <svx/svdobj.hxx>
+#include "svx/svxdllapi.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// SdrVirtObj
+//
+// Achtung! Das virtuelle Objekt ist noch nicht bis in alle Feinheiten
+// durchprogrammiert und getestet. Z.Zt. kommt es nur in abgeleiteter
+// beim Writer zum Einsatz.
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class SVX_DLLPUBLIC SdrVirtObj : public SdrObject
+{
+public:
+ virtual sdr::properties::BaseProperties& GetProperties() const;
+
+protected:
+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+
+ SdrObject& rRefObj; // Referenziertes Zeichenobjekt
+ Rectangle aSnapRect;
+
+protected:
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
+
+ virtual SdrObjGeoData* NewGeoData() const;
+ virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
+ virtual void RestGeoData(const SdrObjGeoData& rGeo);
+
+public:
+ TYPEINFO();
+ SdrVirtObj(SdrObject& rNewObj);
+ SdrVirtObj(SdrObject& rNewObj, const Point& rAnchorPos);
+ virtual ~SdrVirtObj();
+ virtual SdrObject& ReferencedObj();
+ virtual const SdrObject& GetReferencedObj() const;
+ virtual void NbcSetAnchorPos(const Point& rAnchorPos);
+ virtual void SetModel(SdrModel* pNewModel);
+
+ virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
+ virtual sal_uInt32 GetObjInventor() const;
+ virtual sal_uInt16 GetObjIdentifier() const;
+ virtual SdrObjList* GetSubList() const;
+
+ virtual const Rectangle& GetCurrentBoundRect() const;
+ virtual const Rectangle& GetLastBoundRect() const;
+ virtual void RecalcBoundRect();
+ virtual void SetChanged();
+ virtual SdrObject* Clone() const;
+ virtual void operator=(const SdrObject& rObj);
+
+ virtual void TakeObjNameSingul(String& rName) const;
+ virtual void TakeObjNamePlural(String& rName) const;
+
+ virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
+ virtual sal_uInt32 GetHdlCount() const;
+ virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
+ virtual sal_uInt32 GetPlusHdlCount(const SdrHdl& rHdl) const;
+ virtual SdrHdl* GetPlusHdl(const SdrHdl& rHdl, sal_uInt32 nPlNum) const;
+ virtual void AddToHdlList(SdrHdlList& rHdlList) const;
+
+ // special drag methods
+ virtual bool hasSpecialDrag() const;
+ virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
+ virtual bool applySpecialDrag(SdrDragStat& rDrag);
+ virtual String getSpecialDragComment(const SdrDragStat& rDrag) const;
+ virtual basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat& rDrag) const;
+
+ // FullDrag support
+ virtual bool supportsFullDrag() const;
+ virtual SdrObject* getFullDragClone() const;
+
+ virtual FASTBOOL BegCreate(SdrDragStat& rStat);
+ virtual FASTBOOL MovCreate(SdrDragStat& rStat);
+ virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
+ virtual FASTBOOL BckCreate(SdrDragStat& rStat);
+ virtual void BrkCreate(SdrDragStat& rStat);
+ virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const;
+
+ virtual void NbcMove(const Size& rSiz);
+ virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+ virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs);
+ virtual void NbcMirror(const Point& rRef1, const Point& rRef2);
+ virtual void NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear);
+
+ virtual void Move(const Size& rSiz);
+ virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+ virtual void Rotate(const Point& rRef, long nWink, double sn, double cs);
+ virtual void Mirror(const Point& rRef1, const Point& rRef2);
+ virtual void Shear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear);
+
+ virtual void RecalcSnapRect();
+ virtual const Rectangle& GetSnapRect() const;
+ virtual void SetSnapRect(const Rectangle& rRect);
+ virtual void NbcSetSnapRect(const Rectangle& rRect);
+
+ virtual const Rectangle& GetLogicRect() const;
+ virtual void SetLogicRect(const Rectangle& rRect);
+ virtual void NbcSetLogicRect(const Rectangle& rRect);
+
+ virtual long GetRotateAngle() const;
+ virtual long GetShearAngle(FASTBOOL bVertical=sal_False) const;
+
+ virtual sal_uInt32 GetSnapPointCount() const;
+ virtual Point GetSnapPoint(sal_uInt32 i) const;
+
+ virtual sal_Bool IsPolyObj() const;
+ virtual sal_uInt32 GetPointCount() const;
+ virtual Point GetPoint(sal_uInt32 i) const;
+ virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 i);
+
+ virtual SdrObjGeoData* GetGeoData() const;
+ virtual void SetGeoData(const SdrObjGeoData& rGeo);
+
+ virtual void NbcReformatText();
+ virtual void ReformatText();
+
+ virtual FASTBOOL HasMacro() const;
+ virtual SdrObject* CheckMacroHit (const SdrObjMacroHitRec& rRec) const;
+ virtual Pointer GetMacroPointer (const SdrObjMacroHitRec& rRec) const;
+ virtual void PaintMacro (OutputDevice& rOut, const Rectangle& rDirtyRect, const SdrObjMacroHitRec& rRec) const;
+ virtual FASTBOOL DoMacro (const SdrObjMacroHitRec& rRec);
+ virtual XubString GetMacroPopupComment(const SdrObjMacroHitRec& rRec) const;
+
+ // OD 30.06.2003 #108784# - virtual <GetOffset()> returns Point(0,0)
+ // #i73248# for default SdrVirtObj, offset is aAnchor, not (0,0)
+ virtual const Point GetOffset() const;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDOVIRT_HXX
+
diff --git a/svx/inc/svx/svdpage.hxx b/svx/inc/svx/svdpage.hxx
new file mode 100644
index 000000000000..75eb5b331ab6
--- /dev/null
+++ b/svx/inc/svx/svdpage.hxx
@@ -0,0 +1,618 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDPAGE_HXX
+#define _SVDPAGE_HXX
+
+#include <vcl/bitmap.hxx>
+#include <vcl/print.hxx>
+#include <vcl/gdimtf.hxx>
+#include <tools/weakbase.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <svx/svdtypes.hxx>
+#include <svx/svdlayer.hxx>
+#include <svx/sdrcomment.hxx>
+#include <vector>
+#include <svx/sdrpageuser.hxx>
+#include <svx/sdr/contact/viewobjectcontactredirector.hxx>
+#include <svx/sdrmasterpagedescriptor.hxx>
+#include "svx/svxdllapi.h"
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <svx/svdobj.hxx>
+#include <boost/scoped_ptr.hpp>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace sdr { namespace contact { class ViewContact; }}
+class SdrPage;
+class SdrModel;
+class SfxItemPool;
+class SdrPageView;
+class SdrLayerAdmin;
+class SetOfByte;
+class Color;
+class SfxStyleSheet;
+class SvxUnoDrawPagesAccess;
+
+enum SdrInsertReasonKind {SDRREASON_UNKNOWN, // unbekannt
+ SDRREASON_STREAMING, // einlesen eines Doks
+ SDRREASON_UNDO, // kommt aus dem Undo
+ SDRREASON_COPY, // irgendjemand kopiert...
+ SDRREASON_VIEWCREATE, // vom Anwender interaktiv erzeugt
+ SDRREASON_VIEWCALL}; // Durch SdrView::Group(), ...
+
+class SdrInsertReason {
+ const SdrObject* pRefObj;
+ SdrInsertReasonKind eReason;
+public:
+ SdrInsertReason(): pRefObj(NULL),eReason(SDRREASON_UNKNOWN) {}
+ SdrInsertReason(SdrInsertReasonKind eR,const SdrObject* pO=NULL): pRefObj(pO),eReason(eR) {}
+ void SetReferenceObject(const SdrObject* pO) { pRefObj=pO; }
+ const SdrObject* GetReferenceObject() const { return pRefObj; }
+ void SetReason(SdrInsertReasonKind eR) { eReason=eR; }
+ SdrInsertReasonKind GetReason() const { return eReason; }
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// class SdrObjList
+
+class SVX_DLLPUBLIC SdrObjList
+{
+private:
+ typedef ::std::vector<SdrObject*> SdrObjectContainerType;
+ SdrObjectContainerType maList;
+
+protected:
+friend class SdrObjListIter;
+friend class SdrEditView;
+ SdrObjList* pUpList; // Vaterliste
+ SdrModel* pModel; // Diese Liste gehoert zu diesem Model (Layer,ItemPool,Storage).
+ SdrPage* pPage; // Page, in die Liste haengt. Kann auch this sein.
+ SdrObject* pOwnerObj; // OwnerObject, falls Liste eines GruppenObjekts.
+ Rectangle aOutRect;
+ Rectangle aSnapRect;
+ SdrObjListKind eListKind;
+ FASTBOOL bObjOrdNumsDirty;
+ FASTBOOL bRectsDirty;
+protected:
+ virtual void RecalcRects();
+
+private:
+ /// simple ActionChildInserted forwarder to have it on a central place
+ void impChildInserted(SdrObject& rChild) const;
+public:
+ TYPEINFO();
+ SdrObjList(SdrModel* pNewModel, SdrPage* pNewPage, SdrObjList* pNewUpList=NULL);
+ SdrObjList(const SdrObjList& rSrcList);
+ virtual ~SdrObjList();
+ // !!! Diese Methode nur fuer Leute, die ganz genau wissen was sie tun !!!
+
+ // #110094# This should not be needed (!)
+ void SetObjOrdNumsDirty() { bObjOrdNumsDirty=sal_True; }
+ // pModel, pPage, pUpList und pOwnerObj werden Zuweisungeoperator nicht veraendert!
+ void operator=(const SdrObjList& rSrcList);
+ void CopyObjects(const SdrObjList& rSrcList);
+ // alles Aufraeumen (ohne Undo)
+ void Clear();
+ SdrObjListKind GetListKind() const { return eListKind; }
+ void SetListKind(SdrObjListKind eNewKind) { eListKind=eNewKind; }
+ SdrObjList* GetUpList() const { return pUpList; }
+ void SetUpList(SdrObjList* pNewUpList) { pUpList=pNewUpList; }
+ SdrObject* GetOwnerObj() const { return pOwnerObj; }
+ void SetOwnerObj(SdrObject* pNewOwner) { pOwnerObj=pNewOwner; }
+ virtual SdrPage* GetPage() const;
+ virtual void SetPage(SdrPage* pNewPage);
+ virtual SdrModel* GetModel() const;
+ virtual void SetModel(SdrModel* pNewModel);
+ // Neuberechnung der Objekt-Ordnungsnummern
+ void RecalcObjOrdNums();
+ FASTBOOL IsObjOrdNumsDirty() const { return bObjOrdNumsDirty; }
+ virtual void NbcInsertObject(SdrObject* pObj, sal_uIntPtr nPos=CONTAINER_APPEND
+ , const SdrInsertReason* pReason=NULL
+ );
+ virtual void InsertObject(SdrObject* pObj, sal_uIntPtr nPos=CONTAINER_APPEND
+ , const SdrInsertReason* pReason=NULL
+ );
+ // aus Liste entfernen ohne delete
+ virtual SdrObject* NbcRemoveObject(sal_uIntPtr nObjNum);
+ virtual SdrObject* RemoveObject(sal_uIntPtr nObjNum);
+ // Vorhandenes Objekt durch ein anderes ersetzen.
+ // Wie Remove&Insert jedoch performanter, da die Ordnungsnummern
+ // nicht Dirty gesetzt werden muessen.
+ virtual SdrObject* NbcReplaceObject(SdrObject* pNewObj, sal_uIntPtr nObjNum);
+ virtual SdrObject* ReplaceObject(SdrObject* pNewObj, sal_uIntPtr nObjNum);
+ // Die Z-Order eines Objekts veraendern
+ virtual SdrObject* NbcSetObjectOrdNum(sal_uIntPtr nOldObjNum, sal_uIntPtr nNewObjNum);
+ virtual SdrObject* SetObjectOrdNum(sal_uIntPtr nOldObjNum, sal_uIntPtr nNewObjNum);
+
+ virtual void SetRectsDirty();
+
+ const Rectangle& GetAllObjSnapRect() const;
+ const Rectangle& GetAllObjBoundRect() const;
+
+ // Alle Textobjekte neu formatieren, z.B. bei Druckerwechsel
+ void NbcReformatAllTextObjects();
+ void ReformatAllTextObjects();
+
+ /** #103122# reformats all edge objects that are connected to other objects */
+ void ReformatAllEdgeObjects();
+
+ // Die Vorlagenattribute der Zeichenobjekte in harte Attribute verwandeln.
+ void BurnInStyleSheetAttributes();
+
+ sal_uIntPtr GetObjCount() const;
+ SdrObject* GetObj(sal_uIntPtr nNum) const;
+
+ // Gelinkte Seite oder gelinktes Gruppenobjekt
+ virtual FASTBOOL IsReadOnly() const;
+
+ // Zaehlt alle Objekte inkl. Objekte in Objektgruppen, ...
+ sal_uIntPtr CountAllObjects() const;
+
+ // Alle aufgelagerten Teile (z.B. Grafiken) der Liste in den
+ // Speicher laden.
+ void ForceSwapInObjects() const;
+ void ForceSwapOutObjects() const;
+
+ void SwapInAll() const { ForceSwapInObjects(); }
+ void SwapOutAll() const { ForceSwapOutObjects(); }
+
+ /** Makes the object list flat, i.e. the object list content are
+ then tree leaves
+
+ This method travels recursively over all group objects in this
+ list, extracts the content, inserts it flat to the list and
+ removes the group object afterwards.
+ */
+ virtual void FlattenGroups();
+ /** Ungroup the object at the given index
+
+ This method ungroups the content of the group object at the
+ given index, i.e. the content is put flat into the object list
+ (if the object at the given index is no group, this method is
+ a no-op). If the group itself contains group objects, the
+ operation is performed recursively, such that the content of
+ the given object contains no groups afterwards.
+ */
+ virtual void UnGroupObj( sal_uIntPtr nObjNum );
+
+ /** Return whether there is an explicit, user defined, object navigation
+ order. When there is one this method returns <TRUE/> and the
+ GetObjectForNavigationPosition() and
+ SdrObject::GetNavigationPosition() methods will return values
+ different from those returne by SdrObject::GetOrdNum() and
+ GetObj().
+ */
+ bool HasObjectNavigationOrder (void) const;
+
+ /** Set the navigation position of the given object to the specified
+ value. Note that this changes the navigation position for all
+ objects on or following the old or new position.
+ */
+ void SetObjectNavigationPosition (
+ SdrObject& rObject,
+ const sal_uInt32 nNewNavigationPosition);
+
+ /** Return the object for the given navigation position. When there is
+ a user defined navigation order, i.e. mpNavigationOrder is not NULL,
+ then that is used to look up the object. Otherwise the z-order is
+ used by looking up the object in maList.
+ @param nNavigationPosition
+ Valid values include 0 and are smaller than the number of
+ objects as returned by GetObjCount().
+ @return
+ The returned pointer is NULL for invalid positions.
+ */
+ SdrObject* GetObjectForNavigationPosition (const sal_uInt32 nNavigationPosition) const;
+
+ /** Restore the navigation order to that defined by the z-order.
+ */
+ void ClearObjectNavigationOrder (void);
+
+ /** Set the navigation position of all SdrObjects to their position in
+ the mpNavigationOrder list. This method returns immediately when no
+ update is necessary.
+ @return
+ This method returns <TRUE/> when the navigation positions stored
+ in SdrObjects are up to date.
+ It returns <FALSE/> when teh navigation positions are not valid,
+ for example because no explicit navigation order has been
+ defined, i.e. HasObjectNavigationOrder() would return <FALSE/>.
+ */
+ bool RecalcNavigationPositions (void);
+
+ /** Set the navigation order to the one defined by the given list of
+ XShape objects.
+ @param rxOrder
+ When this is an empty reference then the navigation order is
+ reset to the z-order. The preferred way to do this, however, is
+ to call ClearObjectNavigationOrder().
+ Otherwise this list is expected to contain all the shapes in the
+ called SdrObjList.
+ */
+ void SetNavigationOrder (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XIndexAccess>& rxOrder);
+
+private:
+ class WeakSdrObjectContainerType;
+ /// This list, if it exists, defines the navigation order. It it does
+ /// not exist then maList defines the navigation order.
+ ::boost::scoped_ptr<WeakSdrObjectContainerType> mpNavigationOrder;
+
+ /// This flag is <TRUE/> when the mpNavigation list has been changed but
+ /// the indices of the referenced SdrObjects still have their old values.
+ bool mbIsNavigationOrderDirty;
+
+ /** Insert an SdrObject into maList. Do not modify the maList member
+ directly.
+ @param rObject
+ The object to insert into the object list.
+ @param nInsertPosition
+ The given object is inserted before the object at this
+ position. Valid values include 0 (the object is inserted at the
+ head of the list) and the number of objects in the list as
+ returned by GetObjCount() (the object is inserted at the end of
+ the list.)
+ */
+ void InsertObjectIntoContainer (
+ SdrObject& rObject,
+ const sal_uInt32 nInsertPosition);
+
+ /** Replace an object in the object list.
+ @param rObject
+ The new object that replaces the one in the list at the
+ specified position.
+ @param nObjectPosition
+ The object at this position in the object list is replaced by
+ the given object. Valid values include 0 and are smaller than
+ the number of objects in the list.
+ */
+ void ReplaceObjectInContainer (
+ SdrObject& rObject,
+ const sal_uInt32 nObjectPosition);
+
+ /** Remove an object from the object list.
+ The object list has to contain at least one element.
+ @param nObjectPosition
+ The object at this position is removed from the object list.
+ Valid values include 0 and are smaller than the number of
+ objects in the list.
+ */
+ void RemoveObjectFromContainer (
+ const sal_uInt32 nObjectPosition);
+};
+
+/*
+Eine Sdraw-Seite enthaelt genau eine Objektliste sowie eine Beschreibung
+der physikalischen Seitendimensionen (Groesse/Raender). Letzteres wird
+lediglich zum Fangen von Objekten beim Draggen benoetigt.
+An der Seite lassen sich (ueber SdrObjList) Objekte einfuegen und loeschen,
+nach vorn und nach hinten stellen. Ausserdem kann die Ordnungszahl eines
+Objektes abgefragt sowie direkt gesetzt werden.
+*/
+
+// Used for all methods which return a page number
+#define SDRPAGE_NOTFOUND 0xFFFF
+
+//////////////////////////////////////////////////////////////////////////////
+// class SdrPageGridFrame
+
+// Fuer das Fangraster/Punkgitter im Writer
+class SdrPageGridFrame
+{
+ Rectangle aPaper;
+ Rectangle aUserArea;
+public:
+ SdrPageGridFrame(const Rectangle& rPaper): aPaper(rPaper), aUserArea(rPaper) {}
+ SdrPageGridFrame(const Rectangle& rPaper, const Rectangle& rUser): aPaper(rPaper), aUserArea(rUser) {}
+ void SetPaperRect(const Rectangle& rPaper) { aPaper=rPaper; }
+ void SetUserArea(const Rectangle& rUser) { aUserArea=rUser; }
+ const Rectangle& GetPaperRect() const { return aPaper; }
+ const Rectangle& GetUserArea() const { return aUserArea; }
+};
+
+class SVX_DLLPUBLIC SdrPageGridFrameList {
+ Container aList;
+private:
+ SVX_DLLPRIVATE SdrPageGridFrameList(const SdrPageGridFrameList& rSrcList); // never implemented
+ SVX_DLLPRIVATE void operator=(const SdrPageGridFrameList& rSrcList); // never implemented
+protected:
+ SdrPageGridFrame* GetObject(sal_uInt16 i) const { return (SdrPageGridFrame*)(aList.GetObject(i)); }
+public:
+ SdrPageGridFrameList(): aList(1024,4,4) {}
+ ~SdrPageGridFrameList() { Clear(); }
+ void Clear();
+ sal_uInt16 GetCount() const { return sal_uInt16(aList.Count()); }
+ void Insert(const SdrPageGridFrame& rGF, sal_uInt16 nPos=0xFFFF) { aList.Insert(new SdrPageGridFrame(rGF),nPos); }
+ void Delete(sal_uInt16 nPos) { delete (SdrPageGridFrame*)aList.Remove(nPos); }
+ void Move(sal_uInt16 nPos, sal_uInt16 nNewPos) { aList.Insert(aList.Remove(nPos),nNewPos); }
+ SdrPageGridFrame& operator[](sal_uInt16 nPos) { return *GetObject(nPos); }
+ const SdrPageGridFrame& operator[](sal_uInt16 nPos) const { return *GetObject(nPos); }
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// class SdrPageProperties
+
+class SVX_DLLPUBLIC SdrPageProperties : public SfxListener
+{
+private:
+ // data
+ SdrPage* mpSdrPage;
+ SfxStyleSheet* mpStyleSheet;
+ SfxItemSet* mpProperties;
+
+ // internal helpers
+ void ImpRemoveStyleSheet();
+ void ImpAddStyleSheet(SfxStyleSheet& rNewStyleSheet);
+
+ // not implemented
+ SdrPageProperties& operator=(const SdrPageProperties& rCandidate);
+
+public:
+ // construct/destruct
+ SdrPageProperties(SdrPage& rSdrPage);
+ virtual ~SdrPageProperties();
+
+ // Notify(...) from baseclass SfxListener
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
+
+ // data read/write
+ const SfxItemSet& GetItemSet() const;
+ void PutItemSet(const SfxItemSet& rSet);
+ void PutItem(const SfxPoolItem& rItem);
+ void ClearItem(const sal_uInt16 nWhich = 0);
+
+ // StyleSheet access
+ void SetStyleSheet(SfxStyleSheet* pStyleSheet);
+ SfxStyleSheet* GetStyleSheet() const;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// class SdrPage
+
+class SVX_DLLPUBLIC SdrPage : public SdrObjList, public tools::WeakBase< SdrPage >
+{
+ ///////////////////////////////////////////////////////////////////////////////
+ // start PageUser section
+private:
+ // #111111# PageUser section
+ sdr::PageUserVector maPageUsers;
+
+public:
+ void AddPageUser(sdr::PageUser& rNewUser);
+ void RemovePageUser(sdr::PageUser& rOldUser);
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // end PageUser section
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // #110094# DrawContact section
+private:
+ sdr::contact::ViewContact* mpViewContact;
+protected:
+ virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
+public:
+ sdr::contact::ViewContact& GetViewContact() const;
+
+ // #110094# DrawContact support: Methods for handling Page changes
+ void ActionChanged() const;
+
+ // #i9076#
+ friend class SdrModel;
+ friend class SvxUnoDrawPagesAccess;
+
+// this class uses its own UNO wrapper
+// and thus has to set mxUnoPage
+friend class ChXChartDocument;
+
+ sal_Int32 nWdt; // Seitengroesse
+ sal_Int32 nHgt; // Seitengroesse
+ sal_Int32 nBordLft; // Seitenrand links
+ sal_Int32 nBordUpp; // Seitenrand oben
+ sal_Int32 nBordRgt; // Seitenrand rechts
+ sal_Int32 nBordLwr; // Seitenrand unten
+
+ // 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;
+
+protected:
+ SdrLayerAdmin* pLayerAdmin;
+private:
+ SdrPageProperties* mpSdrPageProperties;
+
+public:
+ SdrPageProperties& getSdrPageProperties() { return *mpSdrPageProperties; }
+ const SdrPageProperties& getSdrPageProperties() const { return *mpSdrPageProperties; }
+ const SdrPageProperties* getCorrectSdrPageProperties() const;
+
+protected:
+ // new MasterPageDescriptorVector
+ ::sdr::MasterPageDescriptor* mpMasterPageDescriptor;
+
+ SetOfByte aPrefVisiLayers;
+ sal_uInt16 nPageNum;
+
+ // bitfield
+ unsigned mbMaster : 1; // flag if this is a MasterPage
+ unsigned mbInserted : 1;
+ unsigned mbObjectsNotPersistent : 1;
+ unsigned mbSwappingLocked : 1;
+
+ // #i93597#
+ unsigned mbPageBorderOnlyLeftRight : 1;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoPage();
+
+public:
+ TYPEINFO();
+ SdrPage(SdrModel& rNewModel, bool bMasterPage=false);
+ // Copy-Ctor und Zuweisungeoperator sind nicht getestet!
+ SdrPage(const SdrPage& rSrcPage);
+ virtual ~SdrPage();
+ // pModel, pPage, pUpList, pOwnerObj und mbInserted werden Zuweisungeoperator nicht veraendert!
+ virtual void operator=(const SdrPage& rSrcPage);
+ virtual SdrPage* Clone() const;
+ virtual SdrPage* Clone(SdrModel* pNewModel) const;
+ bool IsMasterPage() const { return mbMaster; }
+ void SetInserted(bool bNew = true);
+ FASTBOOL IsInserted() const { return mbInserted; }
+ virtual void SetChanged();
+
+ // #i68775# React on PageNum changes (from Model in most cases)
+ void SetPageNum(sal_uInt16 nNew);
+ sal_uInt16 GetPageNum() const;
+
+ // #i93597# Allow page border definition to not be the full rectangle but to
+ // use only the left and right vertical edges (reportdesigner)
+ void setPageBorderOnlyLeftRight(bool bNew) { mbPageBorderOnlyLeftRight = bNew; }
+ bool getPageBorderOnlyLeftRight() const { return mbPageBorderOnlyLeftRight; }
+
+ virtual void SetSize(const Size& aSiz);
+ virtual Size GetSize() const;
+ virtual void SetOrientation(Orientation eOri);
+ virtual Orientation GetOrientation() const;
+ virtual sal_Int32 GetWdt() const;
+ virtual sal_Int32 GetHgt() const;
+ virtual void SetBorder(sal_Int32 nLft, sal_Int32 nUpp, sal_Int32 nRgt, sal_Int32 Lwr);
+ virtual void SetLftBorder(sal_Int32 nBorder);
+ virtual void SetUppBorder(sal_Int32 nBorder);
+ virtual void SetRgtBorder(sal_Int32 nBorder);
+ virtual void SetLwrBorder(sal_Int32 nBorder);
+ virtual sal_Int32 GetLftBorder() const;
+ virtual sal_Int32 GetUppBorder() const;
+ virtual sal_Int32 GetRgtBorder() const;
+ virtual sal_Int32 GetLwrBorder() const;
+
+ virtual void SetModel(SdrModel* pNewModel);
+
+ // New MasterPage interface
+ sal_Bool TRG_HasMasterPage() const { return (0L != mpMasterPageDescriptor); }
+ void TRG_SetMasterPage(SdrPage& rNew);
+ void TRG_ClearMasterPage();
+ SdrPage& TRG_GetMasterPage() const;
+ const SetOfByte& TRG_GetMasterPageVisibleLayers() const;
+ void TRG_SetMasterPageVisibleLayers(const SetOfByte& rNew);
+ sdr::contact::ViewContact& TRG_GetMasterPageDescriptorViewContact() const;
+
+//#if 0 // _SOLAR__PRIVATE
+protected:
+ void TRG_ImpMasterPageRemoved(const SdrPage& rRemovedPage);
+//#endif // __PRIVATE
+public:
+
+ // Aenderungen an den Layern setzen nicht das Modified-Flag !
+ const SdrLayerAdmin& GetLayerAdmin() const { return *pLayerAdmin; }
+ SdrLayerAdmin& GetLayerAdmin() { return *pLayerAdmin; }
+
+ // GetBitmap und GetMetafile sind noch nicht implementiert.
+ // Bitmap in Bildschirmaufloesung und -farbtiefe aus den Objekten der
+ // Page erzeugen.
+ Bitmap GetBitmap(FASTBOOL bTrimBorders=sal_True) const { return GetBitmap(aPrefVisiLayers,bTrimBorders); }
+ Bitmap GetBitmap(const SetOfByte& rVisibleLayers, FASTBOOL bTrimBorders=sal_True) const;
+ // Metafile aus den Objekten der Page erzeugen
+ GDIMetaFile GetMetaFile(FASTBOOL bTrimBorders=sal_True) { return GetMetaFile(aPrefVisiLayers,bTrimBorders); }
+ GDIMetaFile GetMetaFile(const SetOfByte& rVisibleLayers, FASTBOOL bTrimBorders=sal_True);
+
+ virtual String GetLayoutName() const;
+
+ // fuer's Raster im Writer, auch fuer AlignObjects wenn 1 Objekt markiert ist
+ // wenn pRect!=NULL, dann die Seiten, die von diesem Rect intersected werden
+ // ansonsten die sichtbaren Seiten.
+ virtual const SdrPageGridFrameList* GetGridFrameList(const SdrPageView* pPV, const Rectangle* pRect) const;
+ bool IsObjectsNotPersistent() const { return mbObjectsNotPersistent; }
+ void SetObjectsNotPersistent(bool b) { mbObjectsNotPersistent = b; }
+ // Durch Setzen dieses Flags, kann das Auslagern (Swappen) von
+ // Teilen der Page (z.B. Grafiken) unterbunden werden.
+ // Es werden hierdurch jedoch nicht automatisch alle ausgelagerten
+ // Teile nachgeladen, dies geschieht erst bei konkretem Bedarf oder
+ // durch Aufruf von SwapInAll().
+ // Fuer die MasterPage(s) der Page muss dies ggf. separat gemacht werden.
+ bool IsSwappingLocked() const { return mbSwappingLocked; }
+ void SetSwappingLocked(bool bLock) { mbSwappingLocked = bLock; }
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getUnoPage();
+
+ virtual SfxStyleSheet* GetTextStyleSheetForObject( SdrObject* pObj ) const;
+
+ FASTBOOL HasTransparentObjects( sal_Bool bCheckForAlphaChannel = sal_False ) const;
+
+ /** *deprecated* returns an averaged background color of this page */
+ // #i75566# GetBackgroundColor -> GetPageBackgroundColor
+ Color GetPageBackgroundColor() const;
+
+ /** *deprecated* returns an averaged background color of this page */
+ // #i75566# GetBackgroundColor -> GetPageBackgroundColor and bScreenDisplay hint value
+ Color GetPageBackgroundColor( SdrPageView* pView, bool bScreenDisplay = true) const;
+
+ /** this method returns true if the object from the ViewObjectContact should
+ be visible on this page while rendering.
+ bEdit selects if visibility test is for an editing view or a final render,
+ like printing.
+ */
+ virtual bool checkVisibility(
+ const sdr::contact::ViewObjectContact& rOriginal,
+ const sdr::contact::DisplayInfo& rDisplayInfo,
+ bool bEdit );
+
+ /** Check if page is the HandoutMasterPage (in SVX, no PK_HANDOUT available) */
+ bool isHandoutMasterPage() const;
+
+ //////////////////////////////////////////////////////////////////////////////
+ // sdr::Comment interface
+private:
+ sdr::CommentVector maComments;
+
+public:
+ sal_uInt32 GetCommentCount() const { return maComments.size(); }
+ const sdr::Comment& GetCommentByIndex(sal_uInt32 nIndex);
+ void AddComment(const sdr::Comment& rNew);
+ void ReplaceCommentByIndex(sal_uInt32 nIndex, const sdr::Comment& rNew);
+};
+
+typedef tools::WeakReference< SdrPage > SdrPageWeakRef;
+
+//////////////////////////////////////////////////////////////////////////////
+// use new redirector instead of pPaintProc
+
+class SVX_DLLPUBLIC StandardCheckVisisbilityRedirector : public ::sdr::contact::ViewObjectContactRedirector
+{
+public:
+ StandardCheckVisisbilityRedirector();
+ virtual ~StandardCheckVisisbilityRedirector();
+
+ // all default implementations just call the same methods at the original. To do something
+ // different, overload the method and at least do what the method does.
+ virtual drawinglayer::primitive2d::Primitive2DSequence createRedirectedPrimitive2DSequence(
+ const sdr::contact::ViewObjectContact& rOriginal,
+ const sdr::contact::DisplayInfo& rDisplayInfo);
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDPAGE_HXX
+
diff --git a/svx/inc/svx/svdpagv.hxx b/svx/inc/svx/svdpagv.hxx
new file mode 100644
index 000000000000..e085ccd212dc
--- /dev/null
+++ b/svx/inc/svx/svdpagv.hxx
@@ -0,0 +1,297 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDPAGV_HXX
+#define _SVDPAGV_HXX
+
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include <svl/lstner.hxx>
+#include <svx/svdhlpln.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <svx/svdsob.hxx>
+#include <svx/svdtypes.hxx>
+#include "svx/svxdllapi.h"
+
+#include <cppuhelper/implbase3.hxx>
+#include <vector>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class Region;
+class SdrObjList;
+class SdrObject;
+class SdrPage;
+class SdrUnoObj;
+class SdrPaintWindow;
+class SdrView;
+class SdrPageObj;
+class B2dIAOManager;
+class SdrPageView;
+
+// #110094#
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewObjectContactRedirector;
+ class DisplayInfo;
+ class ViewObjectContactRedirector;
+ } // end of namespace contact
+} // end of namespace sdr
+
+// typedefs for a list of SdrPageWindow
+class SdrPageWindow;
+typedef ::std::vector< SdrPageWindow* > SdrPageWindowVector;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class SVX_DLLPUBLIC SdrPageView : public SfxListener
+{
+protected:
+ SdrView& mrView;
+ SdrPage* mpPage;
+ Point aPgOrg; // Nullpunkt der Page
+
+ Rectangle aMarkBound; // wird
+ Rectangle aMarkSnap; // von
+ sal_Bool mbHasMarked;
+ sal_Bool mbVisible;
+
+ SetOfByte aLayerVisi; // Menge der sichtbaren Layer
+ SetOfByte aLayerLock; // Menge der nicht editierbaren Layer
+ SetOfByte aLayerPrn; // Menge der druckbaren Layer
+
+ SdrObjList* pAktList; // Aktuelle Liste, in der Regel die Page.
+ SdrObject* pAktGroup; // Aktuelle Gruppe. NULL=Keine.
+
+ SdrHelpLineList aHelpLines; // Hilfslinien und -punkte
+
+ // #103911# Use one reserved slot (bReserveBool2) for the document color
+ Color maDocumentColor;
+
+ // #103834# Use one reserved slot (bReserveBool1) for the background color
+ Color maBackgroundColor;
+
+ SdrPageWindowVector maPageWindows;
+
+ // #i72752# member to remember with which SdrPageWindow the BeginDrawLayer
+ // was done
+ SdrPageWindow* mpPreparedPageWindow;
+
+ // interface to SdrPageWindow
+protected:
+ void ClearPageWindows();
+ void AppendPageWindow(SdrPageWindow& rNew);
+ SdrPageWindow* RemovePageWindow(sal_uInt32 nPos);
+ SdrPageWindow* RemovePageWindow(SdrPageWindow& rOld);
+public:
+ sal_uInt32 PageWindowCount() const { return maPageWindows.size(); }
+ SdrPageWindow* FindPageWindow( SdrPaintWindow& rPaintWindow ) const;
+ SdrPageWindow* FindPageWindow( const OutputDevice& rOutDev ) const;
+ SdrPageWindow* GetPageWindow(sal_uInt32 nIndex) const;
+
+ /** finds the page window whose PaintWindow belongs to the given output device
+
+ In opposite to FindPageWindow, this method also cares possibly patched PaintWindow instances.
+ That is, a SdrPageWindow might have an original, and a patched SdrPaintWindow instance - if
+ this is the case, then the original SdrPaintWindow is examined before the patched one.
+ */
+ const SdrPageWindow* FindPatchedPageWindow( const OutputDevice& rOutDev ) const;
+
+ void PaintOutlinerView(OutputDevice* pOut, const Rectangle& rRect) const;
+private:
+ SVX_DLLPRIVATE SdrPageWindow& CreateNewPageWindowEntry(SdrPaintWindow& rPaintWindow);
+
+protected:
+ void ImpInvalidateHelpLineArea(sal_uInt16 nNum) const;
+
+protected:
+ void SetLayer(const String& rName, SetOfByte& rBS, sal_Bool bJa);
+ sal_Bool IsLayer(const String& rName, const SetOfByte& rBS) const;
+ void SetAllLayers(SetOfByte& rB, sal_Bool bJa);
+
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
+
+ // Nachsehen, ob AktGroup noch Inserted ist.
+ void CheckAktGroup();
+
+ void AdjHdl();
+
+public:
+ TYPEINFO();
+ SdrPageView(SdrPage* pPage1, SdrView& rNewView);
+ ~SdrPageView();
+
+ // Wird von der PaintView gerufen, wenn Modelaenderungen abgeschlossen sind
+ void ModelHasChanged();
+
+ void Show();
+ void Hide();
+
+ void AddPaintWindowToPageView(SdrPaintWindow& rPaintWindow);
+ void RemovePaintWindowFromPageView(SdrPaintWindow& rPaintWindow);
+
+ SdrView& GetView() { return mrView; }
+ const SdrView& GetView() const { return mrView; }
+
+ /** looks up the control container belonging to given output device
+
+ @return
+ If the given output device belongs to one of the SdrPageViewWinRecs associated with this
+ SdrPageView instance, the XControlContainer for this output device is returned, <NULL/>
+ otherwise.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >
+ GetControlContainer( const OutputDevice& _rDevice ) const;
+
+ /** sets all elements in the view which support a design and a alive mode into the given mode
+ */
+ void SetDesignMode( bool _bDesignMode ) const;
+
+ sal_Bool IsVisible() const { return mbVisible; }
+
+ // Invalidiert den gesamten Bereich der Page
+ void InvalidateAllWin();
+
+ // rRect bezieht sich auf die Page
+ void InvalidateAllWin(const Rectangle& rRect, sal_Bool bPlus1Pix=sal_False);
+
+ // PrePaint call forwarded from app windows
+ void PrePaint();
+
+ // PostPaint call forwarded from app windows
+ void PostPaint();
+
+ // rReg bezieht sich auf's OutDev, nicht auf die Page
+ void CompleteRedraw(SdrPaintWindow& rPaintWindow, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector = 0L) const;
+
+ // write access to mpPreparedPageWindow
+ void setPreparedPageWindow(SdrPageWindow* pKnownTarget);
+
+ void DrawLayer(SdrLayerID nID, OutputDevice* pGivenTarget = 0, sdr::contact::ViewObjectContactRedirector* pRedirector = 0L) const;
+ void DrawPageViewGrid(OutputDevice& rOut, const Rectangle& rRect, Color aColor = Color( COL_BLACK ) );
+
+ Rectangle GetPageRect() const;
+ SdrPage* GetPage() const { return mpPage; }
+
+ // Betretene Liste rausreichen
+ SdrObjList* GetObjList() const { return pAktList; }
+
+ // Betretene Gruppe rausreichen
+ SdrObject* GetAktGroup() const { return pAktGroup; }
+
+ // Betretene Gruppe und Liste setzen
+ void SetAktGroupAndList(SdrObject* pNewGroup, SdrObjList* pNewList);
+
+ sal_Bool HasMarkedObjPageView() const { return mbHasMarked; }
+ void SetHasMarkedObj(sal_Bool bOn) { mbHasMarked = bOn; }
+
+ const Rectangle& MarkBound() const { return aMarkBound; }
+ const Rectangle& MarkSnap() const { return aMarkSnap; }
+ Rectangle& MarkBound() { return aMarkBound; }
+ Rectangle& MarkSnap() { return aMarkSnap; }
+
+ void SetLayerVisible(const String& rName, sal_Bool bShow = sal_True) { SetLayer(rName, aLayerVisi, bShow); if(!bShow) AdjHdl(); InvalidateAllWin(); }
+ sal_Bool IsLayerVisible(const String& rName) const { return IsLayer(rName, aLayerVisi); }
+ void SetAllLayersVisible(sal_Bool bShow = sal_True) { SetAllLayers(aLayerVisi, bShow); if(!bShow) AdjHdl(); InvalidateAllWin(); }
+
+ void SetLayerLocked(const String& rName, sal_Bool bLock = sal_True) { SetLayer(rName, aLayerLock, bLock); if(bLock) AdjHdl(); }
+ sal_Bool IsLayerLocked(const String& rName) const { return IsLayer(rName,aLayerLock); }
+ void SetAllLayersLocked(sal_Bool bLock = sal_True) { SetAllLayers(aLayerLock, bLock); if(bLock) AdjHdl(); }
+
+ void SetLayerPrintable(const String& rName, sal_Bool bPrn = sal_True) { SetLayer(rName, aLayerPrn, bPrn); }
+ sal_Bool IsLayerPrintable(const String& rName) const { return IsLayer(rName, aLayerPrn); }
+ void SetAllLayersPrintable(sal_Bool bPrn = sal_True) { SetAllLayers(aLayerPrn, bPrn); }
+
+ // PV stellt eine RefPage oder eine SubList eines RefObj dar oder Model ist ReadOnly
+ sal_Bool IsReadOnly() const;
+
+ // der Origin bezieht sich immer auf die obere linke Ecke der Page
+ const Point& GetPageOrigin() const { return aPgOrg; }
+ void SetPageOrigin(const Point& rOrg);
+
+ void LogicToPagePos(Point& rPnt) const { rPnt-=aPgOrg; }
+ void LogicToPagePos(Rectangle& rRect) const { rRect.Move(-aPgOrg.X(),-aPgOrg.Y()); }
+ void PagePosToLogic(Point& rPnt) const { rPnt+=aPgOrg; }
+ void PagePosToLogic(Rectangle& rRect) const { rRect.Move(aPgOrg.X(),aPgOrg.Y()); }
+
+ void SetVisibleLayers(const SetOfByte& rSet) { aLayerVisi=rSet; InvalidateAllWin(); }
+ const SetOfByte& GetVisibleLayers() const { return aLayerVisi; }
+ void SetPrintableLayers(const SetOfByte& rSet) { aLayerPrn=rSet; }
+ const SetOfByte& GetPrintableLayers() const { return aLayerPrn; }
+ void SetLockedLayers(const SetOfByte& rSet) { aLayerLock=rSet; }
+ const SetOfByte& GetLockedLayers() const { return aLayerLock; }
+
+ const SdrHelpLineList& GetHelpLines() const { return aHelpLines; }
+ void SetHelpLines(const SdrHelpLineList& rHLL);
+ //void SetHelpLinePos(sal_uInt16 nNum, const Point& rNewPos);
+ void SetHelpLine(sal_uInt16 nNum, const SdrHelpLine& rNewHelpLine);
+ void DeleteHelpLine(sal_uInt16 nNum);
+ void InsertHelpLine(const SdrHelpLine& rHL, sal_uInt16 nNum=0xFFFF);
+ void MoveHelpLine(sal_uInt16 nNum, sal_uInt16 nNewNum) { aHelpLines.Move(nNum,nNewNum); }
+
+ // Liefert sal_True, wenn Layer des Obj sichtbar und nicht gesperrt.
+ // Beim Gruppenobjekt muss wenigstens ein Member sichtbar sein,
+ // gesperrt sein darf keiner.
+ sal_Bool IsObjMarkable(SdrObject* pObj) const;
+
+ // Betreten (Editieren) einer Objektgruppe. Anschliessend liegen alle
+ // Memberobjekte der Gruppe im direkten Zugriff. Alle anderen Objekte
+ // koennen waerendessen nicht bearbeitet werden (bis zum naechsten
+ // LeaveGroup()). (wie MsDos chdir bla).
+ sal_Bool EnterGroup(SdrObject* pObj);
+
+ // Verlassen einer betretenen Objektgruppe. (wie MsDos chdir ..)
+ void LeaveOneGroup();
+
+ // Verlassen aller betretenen Objektgruppen. (wie MsDos chdir \)
+ void LeaveAllGroup();
+
+ // Feststellen, wie weit hinabgestiegen wurde (0=Root(Page))
+ sal_uInt16 GetEnteredLevel() const;
+
+ // Name der aktuellen Objektgruppe
+ String GetActualGroupName() const;
+
+ // Die Namen aller z.Zt. betretenen Gruppen
+ String GetActualPathName(sal_Unicode cSep = sal_Unicode('|')) const;
+
+ // #103834# Set background color for svx at SdrPageViews
+ void SetApplicationBackgroundColor(Color aBackgroundColor);
+
+ // #109585#
+ Color GetApplicationBackgroundColor() const;
+
+ // #103911# Set/Get document color for svx at SdrPageViews
+ void SetApplicationDocumentColor(Color aDocumentColor);
+ Color GetApplicationDocumentColor() const;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDPAGV_HXX
diff --git a/svx/inc/svx/svdpntv.hxx b/svx/inc/svx/svdpntv.hxx
new file mode 100644
index 000000000000..32475e51b7b8
--- /dev/null
+++ b/svx/inc/svx/svdpntv.hxx
@@ -0,0 +1,580 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDPNTV_HXX
+#define _SVDPNTV_HXX
+
+#include <svl/brdcst.hxx>
+#include <svl/lstner.hxx>
+#include <svl/smplhint.hxx>
+#include <svl/undo.hxx>
+#include <svx/svddrag.hxx>
+#include <svx/svdlayer.hxx> // fuer SetOfByte
+#include <vcl/window.hxx>
+#include <svtools/colorcfg.hxx>
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include <svl/itemset.hxx>
+#include <vcl/timer.hxx>
+#include "svx/svxdllapi.h"
+#include <svtools/optionsdrawinglayer.hxx>
+#include <unotools/options.hxx>
+
+//************************************************************
+// Pre-Defines
+//************************************************************
+
+class SdrPageWindow;
+
+namespace com { namespace sun { namespace star { namespace awt {
+ class XControlContainer;
+}}}}
+
+class SdrPage;
+class SdrView;
+class SfxItemSet;
+class SfxStyleSheet;
+class SdrOle2Obj;
+class SdrModel;
+class SdrObject;
+class SdrViewUserMarker;
+class B2dIAOManager;
+
+#ifdef DBG_UTIL
+class SdrItemBrowser;
+#endif
+
+namespace sdr { namespace contact {
+ class ViewObjectContactRedirector;
+}}
+
+//************************************************************
+// Defines for AnimationMode
+//************************************************************
+
+enum SdrAnimationMode
+{
+ SDR_ANIMATION_ANIMATE,
+ SDR_ANIMATION_DONT_ANIMATE,
+ SDR_ANIMATION_DISABLE
+};
+
+//************************************************************
+// Typedef's und defines
+//************************************************************
+
+typedef unsigned char TRISTATE;
+#define FUZZY (2)
+#define SDR_ANYFORMAT (0xFFFFFFFF)
+#define SDR_ANYITEM (0xFFFF)
+#define SDRVIEWWIN_NOTFOUND (0xFFFF)
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+class SdrPaintView;
+
+namespace sdr
+{
+ namespace contact
+ {
+ class ViewObjectContactRedirector;
+ } // end of namespace contact
+} // end of namespace sdr
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+class SVX_DLLPUBLIC SvxViewHint : public SfxHint
+{
+public:
+ enum HintType { SVX_HINT_VIEWCHANGED };
+ TYPEINFO();
+ SvxViewHint (HintType eType);
+ HintType GetHintType (void) const;
+
+private:
+ HintType meHintType;
+};
+
+// typedefs for a list of SdrPaintWindows
+class SdrPaintWindow;
+typedef ::std::vector< SdrPaintWindow* > SdrPaintWindowVector;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class SVX_DLLPUBLIC SdrPaintView : public SfxListener, public SfxRepeatTarget, public SfxBroadcaster, public ::utl::ConfigurationListener
+{
+ friend class SdrPageView;
+ friend class FrameAnimator;
+ friend class SdrGrafObj;
+
+protected:
+ // #114409#-2 Migrate Encirclement
+ class ImplEncirclementOverlay* mpEncirclementOverlay;
+
+ SdrModel* pMod;
+#ifdef DBG_UTIL
+ SdrItemBrowser* pItemBrowser;
+#endif
+ const OutputDevice* pActualOutDev; // Nur zum vergleichen
+ OutputDevice* pDragWin;
+ SfxStyleSheet* pDefaultStyleSheet;
+
+ String aAktLayer; // Aktueller Zeichenlayer
+ String aMeasureLayer; // Aktueller Layer fuer Bemassung
+
+// Container aPagV; // Liste von SdrPageViews
+ SdrPageView* mpPageView;
+
+ // All windows this view is displayed on
+ SdrPaintWindowVector maPaintWindows;
+
+ MapMode aActualMapMode;
+ Size aGridBig; // muss dann mal raus
+ Size aGridFin; // muss dann mal raus
+ SdrDragStat aDragStat;
+ Rectangle aMaxWorkArea;
+ SfxItemSet aDefaultAttr;
+ Timer aComeBackTimer;
+
+ SdrAnimationMode eAnimationMode;
+
+ sal_uInt16 nHitTolPix;
+ sal_uInt16 nMinMovPix;
+ sal_uInt16 nHitTolLog;
+ sal_uInt16 nMinMovLog;
+ sal_uIntPtr nMasterCacheMode;
+ sal_uIntPtr nGraphicManagerDrawMode;
+
+ // hold an incarnation of Drawinglayer configuration options
+ SvtOptionsDrawinglayer maDrawinglayerOpt;
+
+ unsigned bPageVisible : 1;
+ unsigned bPageBorderVisible : 1;
+ unsigned bBordVisible : 1;
+ unsigned bGridVisible : 1;
+ unsigned bGridFront : 1;
+ unsigned bHlplVisible : 1;
+ unsigned bHlplFront : 1;
+ unsigned bGlueVisible : 1; // Persistent. Klebepunkte anzeigen
+ unsigned bGlueVisible2 : 1; // Klebepunkte auch bei GluePointEdit anzeigen
+ unsigned bGlueVisible3 : 1; // Klebepunkte auch bei EdgeTool anzeigen
+ unsigned bGlueVisible4 : 1; // Klebepunkte anzeigen, wenn 1 Edge markiert
+ unsigned bRestoreColors : 1; // Pens und Brushes werden zurueckgesetzt.
+ unsigned bSomeObjChgdFlag : 1;
+ unsigned bSwapAsynchron : 1;
+ unsigned bPrintPreview : 1;
+
+ // sal_Bool fuer die Verwaltung des anzuzeigenden Status
+ // Gruppe Betreten/Verlassen. Default ist sal_True, wird aber
+ // beispielsweise beim Chart auf sal_False gesetzt, da dort
+ // die Ghosted-Effekte zur Darstellug unerwuenscht sind.
+ unsigned bVisualizeEnteredGroup : 1;
+ unsigned bAnimationPause : 1;
+
+ // #114898#
+ // Flag which decides if buffered output for this view is allowed. When
+ // set, PreRendering for PageView rendering will be used. Default is sal_False
+ unsigned mbBufferedOutputAllowed : 1;
+
+ // #114898#
+ // Flag which decides if buffered overlay for this view is allowed. When
+ // set, the output will be buffered in an overlay vdev. When not, overlay is
+ // directly painted to OutDev. Default is sal_False.
+ unsigned mbBufferedOverlayAllowed : 1;
+
+ // allow page painting at all?
+ unsigned mbPagePaintingAllowed : 1;
+
+ // is this a preview renderer?
+ unsigned mbPreviewRenderer : 1;
+
+ // flags for calc and sw for suppressing OLE, CHART or DRAW objects
+ unsigned mbHideOle : 1;
+ unsigned mbHideChart : 1;
+ unsigned mbHideDraw : 1; // hide draw objects other than form controls
+ unsigned mbHideFormControl : 1; // hide form controls only
+
+public:
+ // #114898#
+ // interface for PagePaintingAllowed flag
+ bool IsBufferedOutputAllowed() const;
+ void SetBufferedOutputAllowed(bool bNew);
+
+ // interface for BufferedOverlayAllowed flag
+ bool IsBufferedOverlayAllowed() const;
+ void SetBufferedOverlayAllowed(bool bNew);
+
+ // allow page painting at all?
+ sal_Bool IsPagePaintingAllowed() const;
+ void SetPagePaintingAllowed(bool bNew);
+
+protected:
+ svtools::ColorConfig maColorConfig;
+ Color maGridColor;
+
+ // interface to SdrPaintWindow
+protected:
+ void AppendPaintWindow(SdrPaintWindow& rNew);
+ SdrPaintWindow* RemovePaintWindow(SdrPaintWindow& rOld);
+ void ConfigurationChanged( ::utl::ConfigurationBroadcaster*, sal_uInt32 );
+
+public:
+ sal_uInt32 PaintWindowCount() const { return maPaintWindows.size(); }
+ SdrPaintWindow* FindPaintWindow(const OutputDevice& rOut) const;
+ SdrPaintWindow* GetPaintWindow(sal_uInt32 nIndex) const;
+ // replacement for GetWin(0), may return 0L (!)
+ OutputDevice* GetFirstOutputDevice() const;
+
+private:
+ SVX_DLLPRIVATE void ImpClearVars();
+ DECL_LINK(ImpComeBackHdl,Timer*);
+
+protected:
+ sal_uInt16 ImpGetMinMovLogic(short nMinMov, const OutputDevice* pOut) const;
+ sal_uInt16 ImpGetHitTolLogic(short nHitTol, const OutputDevice* pOut) const;
+
+ // Wenn man den IdleStatus des Systems nicht abwarten will (auf const geschummelt):
+ void FlushComeBackTimer() const;
+ void TheresNewMapMode();
+ void ImpSetGlueVisible2(bool bOn) { if (bGlueVisible2!=(unsigned)bOn) { bGlueVisible2=bOn; if (!bGlueVisible && !bGlueVisible3 && !bGlueVisible4) GlueInvalidate(); } }
+ void ImpSetGlueVisible3(bool bOn) { if (bGlueVisible3!=(unsigned)bOn) { bGlueVisible3=bOn; if (!bGlueVisible && !bGlueVisible2 && !bGlueVisible4) GlueInvalidate(); } }
+ void ImpSetGlueVisible4(bool bOn) { if (bGlueVisible4!=(unsigned)bOn) { bGlueVisible4=bOn; if (!bGlueVisible && !bGlueVisible2 && !bGlueVisible3) GlueInvalidate(); } }
+ sal_Bool ImpIsGlueVisible2() const { return bGlueVisible2; }
+ sal_Bool ImpIsGlueVisible3() const { return bGlueVisible3; }
+ sal_Bool ImpIsGlueVisible4() const { return bGlueVisible4; }
+
+public:
+ sal_Bool ImpIsGlueVisible() { return bGlueVisible || bGlueVisible2 || bGlueVisible3 || bGlueVisible4; }
+protected:
+
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
+ void GlueInvalidate() const;
+
+ void ShowEncirclement(OutputDevice* pOut);
+ void HideEncirclement(OutputDevice* pOut);
+ void DrawEncirclement(OutputDevice* pOut) const;
+
+ // ModelHasChanged wird gerufen, sobald nach beliebig vielen HINT_OBJCHG
+ // das System wieder idle ist (StarView-Timer). Wer diese Methode ueberlaed,
+ // muss unbedingt ModelHasChanged() der Basisklasse rufen.
+ virtual void ModelHasChanged();
+
+protected:
+ // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
+ SdrPaintView(SdrModel* pModel1, OutputDevice* pOut = 0L);
+ virtual ~SdrPaintView();
+
+public:
+ TYPEINFO();
+
+ virtual void ClearPageView();
+// virtual void ClearAll();
+// virtual void Clear(); // PageViews loeschen, Markierungen weg, ...
+ SdrModel* GetModel() const { return pMod; }
+
+ virtual sal_Bool IsAction() const;
+ virtual void MovAction(const Point& rPnt);
+ virtual void EndAction();
+ virtual void BckAction();
+ virtual void BrkAction(); // Alle Actions z.B. Draggen abbrechen.
+ virtual void TakeActionRect(Rectangle& rRect) const;
+
+ // info about TextEdit. Default is sal_False.
+ virtual bool IsTextEdit() const;
+
+ // info about TextEditPageView. Default is 0L.
+ virtual SdrPageView* GetTextEditPageView() const;
+
+ // Muss dann bei jedem Fensterwechsel (wenn die SdrView in mehreren
+ // Fenstern gleichzeitig dargestellt wird (->z.B. Splitter)) und bei
+ // jedem MapMode(Scaling)-wechsel gerufen werden, damit ich aus meinen
+ // Pixelwerten logische Werte berechnen kann.
+ void SetActualWin(const OutputDevice* pWin);
+ void SetMinMoveDistancePixel(sal_uInt16 nVal) { nMinMovPix=nVal; TheresNewMapMode(); }
+ sal_uInt16 GetMinMoveDistancePixel() const { return (sal_uInt16)nMinMovPix; }
+ void SetHitTolerancePixel(sal_uInt16 nVal) { nHitTolPix=nVal; TheresNewMapMode(); }
+ sal_uInt16 GetHitTolerancePixel() const { return (sal_uInt16)nHitTolPix; }
+
+ // data read access on logic HitTolerance and MinMoveTolerance
+ sal_uInt16 getHitTolLog() const { return nHitTolLog; }
+ sal_uInt16 getMinMovLog() const { return nMinMovLog; }
+
+ // Flag zur Visualisierung von Gruppen abfragen/testen
+ sal_Bool DoVisualizeEnteredGroup() const { return bVisualizeEnteredGroup; }
+ void SetVisualizeEnteredGroup(sal_Bool bNew) { bVisualizeEnteredGroup = bNew; }
+
+ // Am DragStatus laesst sich beispielsweise erfragen, welche
+ // entfernung bereits gedraggd wurde, etc.
+ const SdrDragStat& GetDragStat() const { return aDragStat; }
+
+ // Anmelden/Abmelden einer PageView an der View.
+ // Dieselbe // Seite kann nicht mehrfach angemeldet werden.
+ // Methoden mit dem Suffix PgNum erwarten als numerischen Parameter
+ // eine Seitennummer (0...). Methoden mit dem Suffix PvNum erwarten
+ // degagen als numerischen Parameter die Nummer der PageView an der
+ // SdrView (Iterieren ueber alle angemeldeten Pages).
+ virtual SdrPageView* ShowSdrPage(SdrPage* pPage);
+ virtual void HideSdrPage();
+
+ // Iterieren ueber alle angemeldeten PageViews
+// sal_uInt16 GetPageViewCount() const { return sal_uInt16(aPagV.Count()); }
+// SdrPageView* GetPageViewByIndex(sal_uInt16 nPvNum) const { return ((SdrPageView*)aPagV.GetObject(nPvNum)); }
+ SdrPageView* GetSdrPageView() const { return mpPageView; }
+
+ // Pageview einer bestimmten Seite ermitteln
+// SdrPageView* GetPageViewByPage(const SdrPage* pPage) const;
+// sal_uInt16 GetIndexByPageView(const SdrPageView* pPV) const;
+
+ // Test, ob eine Seite getroffen
+// SdrPageView* HitPage(const Point& rPnt) const;
+
+ // Die Seite, die dem Punkt am naechsten ist. Liefert nur NULL,
+ // wenn absolut keine Seite angemeldet ist.
+// SdrPageView* GetPageViewByPosition(const Point& rPnt) const;
+
+ // Eine SdrView kann auf mehreren Fenstern gleichzeitig abgebiltet sein:
+ virtual void AddWindowToPaintView(OutputDevice* pNewWin);
+ virtual void DeleteWindowFromPaintView(OutputDevice* pOldWin);
+
+ void SetLayerVisible(const String& rName, sal_Bool bShow=sal_True);
+ bool IsLayerVisible(const String& rName) const;
+ void SetAllLayersVisible(sal_Bool bShow=sal_True);
+
+ void SetLayerLocked(const String& rName, sal_Bool bLock=sal_True);
+ bool IsLayerLocked(const String& rName) const;
+ void SetAllLayersLocked(sal_Bool bLock=sal_True);
+
+ void SetLayerPrintable(const String& rName, sal_Bool bPrn=sal_True);
+ bool IsLayerPrintable(const String& rName) const;
+ void SetAllLayersPrintable(sal_Bool bPrn=sal_True);
+
+ // PrePaint call forwarded from app windows
+ void PrePaint();
+
+ // PostPaint call forwarded from app windows
+ void PostPaint();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ // used internally for Draw/Impress/sch/chart2
+ virtual void CompleteRedraw(OutputDevice* pOut, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector = 0);
+
+ // #i72889# used from CompleteRedraw() implementation internally, added to be able to do a complete redraw in single steps
+ //
+ // BeginCompleteRedraw returns (or even creates) a SdrPaintWindow whcih shall then be used as
+ // target for paints. Since paints may be buffered, use it's GetTargetOutputDevice() method which will
+ // return the buffer in case of bufered.
+ // DoCompleteRedraw draws the DrawingLayer hierarchy then.
+ // EndCompleteRedraw does the necessary refreshes, evtl. paints text edit and overlay and evtl destroys the
+ // SdrPaintWindow again. This means: the SdrPaintWindow is no longer safe after this closing call.
+ virtual SdrPaintWindow* BeginCompleteRedraw(OutputDevice* pOut);
+ virtual void DoCompleteRedraw(SdrPaintWindow& rPaintWindow, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector = 0);
+ virtual void EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ // used for the other applications basctl/sc/sw which call DrawLayer at PageViews
+ // #i74769# Interface change to use common BeginCompleteRedraw/EndCompleteRedraw
+ // #i76114# bDisableIntersect disables intersecting rReg with the Window's paint region
+ SdrPaintWindow* BeginDrawLayers(OutputDevice* pOut, const Region& rReg, bool bDisableIntersect = false);
+ void EndDrawLayers(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer);
+
+protected:
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ // used to call the old PaintOutlinerView at the single PageViews. Will be replaced when the
+ // outliner will be displayed on the overlay in edit mode.
+ void ImpTextEditDrawing(SdrPaintWindow& rPaintWindow) const;
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ // used to paint the form layer after the PreRender device is flushed (painted) to the window.
+ void ImpFormLayerDrawing(SdrPaintWindow& rPaintWindow) const;
+
+public:
+ sal_Bool IsPageVisible() const { return bPageVisible; } // Seite (weisse Flaeche) malen oder nicht
+ sal_Bool IsPageBorderVisible() const { return bPageBorderVisible; } // Seite (weisse Flaeche) malen oder nicht
+ sal_Bool IsBordVisible() const { return bBordVisible; } // Seitenrandlinie malen oder nicht
+ sal_Bool IsGridVisible() const { return bGridVisible; } // Rastergitter malen oder nicht
+ sal_Bool IsGridFront() const { return bGridFront ; } // Rastergitter ueber die Objekte druebermalen oder dahinter
+ sal_Bool IsHlplVisible() const { return bHlplVisible; } // Hilfslinien der Seiten malen oder nicht
+ sal_Bool IsHlplFront() const { return bHlplFront ; } // Hilfslinie ueber die Objekte druebermalen oder dahinter
+ sal_Bool IsGlueVisible() const { return bGlueVisible; } // Konnektoren der objekte sichtbar oder nicht
+ Color GetGridColor() const;
+ void SetPageVisible(bool bOn = true) { bPageVisible=bOn; InvalidateAllWin(); }
+ void SetPageBorderVisible(bool bOn = true) { bPageBorderVisible=bOn; InvalidateAllWin(); }
+ void SetBordVisible(bool bOn = true) { bBordVisible=bOn; InvalidateAllWin(); }
+ void SetGridVisible(bool bOn = true) { bGridVisible=bOn; InvalidateAllWin(); }
+ void SetGridFront(bool bOn = true) { bGridFront =bOn; InvalidateAllWin(); }
+ void SetHlplVisible(bool bOn = true) { bHlplVisible=bOn; InvalidateAllWin(); }
+ void SetHlplFront(bool bOn = true) { bHlplFront =bOn; InvalidateAllWin(); }
+ void SetGlueVisible(bool bOn = true) { if (bGlueVisible!=(unsigned)bOn) { bGlueVisible=bOn; if (!bGlueVisible2 && !bGlueVisible3 && !bGlueVisible4) GlueInvalidate(); } }
+ void SetGridColor( Color aColor );
+
+ sal_Bool IsPreviewRenderer() const { return (sal_Bool )mbPreviewRenderer; }
+ void SetPreviewRenderer(bool bOn) { if((unsigned)bOn != mbPreviewRenderer) { mbPreviewRenderer=bOn; }}
+
+ // access methods for calc and sw hide object modes
+ bool getHideOle() const { return mbHideOle; }
+ bool getHideChart() const { return mbHideChart; }
+ bool getHideDraw() const { return mbHideDraw; }
+ bool getHideFormControl() const { return mbHideFormControl; }
+ void setHideOle(bool bNew) { if(bNew != (bool)mbHideOle) mbHideOle = bNew; }
+ void setHideChart(bool bNew) { if(bNew != (bool)mbHideChart) mbHideChart = bNew; }
+ void setHideDraw(bool bNew) { if(bNew != (bool)mbHideDraw) mbHideDraw = bNew; }
+ void setHideFormControl(bool bNew) { if(bNew != (bool)mbHideFormControl) mbHideFormControl = bNew; }
+
+ void SetGridCoarse(const Size& rSiz) { aGridBig=rSiz; }
+ void SetGridFine(const Size& rSiz) { aGridFin=rSiz; if (aGridFin.Height()==0) aGridFin.Height()=aGridFin.Width(); if (bGridVisible) InvalidateAllWin(); } // #40479#
+ const Size& GetGridCoarse() const { return aGridBig; }
+ const Size& GetGridFine() const { return aGridFin; }
+
+ void InvalidateAllWin();
+ void InvalidateAllWin(const Rectangle& rRect, sal_Bool bPlus1Pix=sal_False);
+
+ // Wenn die View kein Invalidate() an den Fenstern durchfuehren soll, muss
+ // man diese beiden folgenden Methoden ueberladen und entsprechend anders
+ // reagieren.
+ virtual void InvalidateOneWin(Window& rWin);
+ virtual void InvalidateOneWin(Window& rWin, const Rectangle& rRect);
+
+ void SetActiveLayer(const String& rName) { aAktLayer=rName; }
+ const String& GetActiveLayer() const { return aAktLayer; }
+
+ // Verlassen einer betretenen Objektgruppe aller sichtbaren Seiten.
+ // (wie MsDos chdir ..)
+ void LeaveOneGroup();
+
+ // Verlassen aller betretenen Objektgruppen aller sichtbaren Seiten.
+ // (wie MsDos chdir \)
+ void LeaveAllGroup();
+
+ // Feststellen, ob Leave sinnvoll ist.
+ bool IsGroupEntered() const;
+
+ // DefaultAttribute an der View: Neu erzeugte Objekte bekommen diese
+ // Attribute direkt nach dem Erzeugen erstmal zugewiesen.
+ void SetDefaultAttr(const SfxItemSet& rAttr, sal_Bool bReplaceAll);
+ const SfxItemSet& GetDefaultAttr() const { return aDefaultAttr; }
+ void SetDefaultStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr);
+ SfxStyleSheet* GetDefaultStyleSheet() const { return pDefaultStyleSheet; }
+
+ void SetNotPersistDefaultAttr(const SfxItemSet& rAttr, sal_Bool bReplaceAll);
+ void MergeNotPersistDefaultAttr(SfxItemSet& rAttr, sal_Bool bOnlyHardAttr) const;
+
+ // Aufziehen eines animierten Rechtecks fuer Applikationsspeziefische
+ // Verwendung. Alle Positionsangaben in logischen View-Koordinaten.
+ // pOut bezeichnet das OutputDevice, in das animierte Rechteck dargestellt
+ // werden soll. Wird NULL uebergeben, wird es in allen an der View
+ // angemeldeten OutputDevices gleichzeitig dargestellt.
+ void BegEncirclement(const Point& rPnt);
+ void MovEncirclement(const Point& rPnt);
+ Rectangle EndEncirclement(sal_Bool bNoJustify = sal_False);
+ void BrkEncirclement();
+ sal_Bool IsEncirclement() const { return (0L != mpEncirclementOverlay); }
+
+ // use this mode as mode to draw all internal GraphicManager objects with
+ sal_uIntPtr GetGraphicManagerDrawMode() const { return nGraphicManagerDrawMode; }
+ void SetGraphicManagerDrawMode( sal_uIntPtr nMode ) { nGraphicManagerDrawMode = nMode; }
+
+ // SwapIn (z.B. von Grafiken) asynchron durchfuehren. Also nicht
+ // beim Paint sofort nachladen, sondern dort das Nachladen anstossen.
+ // Nach Abschluss des Nachladens wird das Objekt dann angezeigt.
+ // Hat nur z.Zt. Wirkung, wenn SwapGraphics am Model eingeschaltet ist.
+ // Default=FALSE. Flag ist nicht persistent.
+ sal_Bool IsSwapAsynchron() const { return bSwapAsynchron; }
+ void SetSwapAsynchron(sal_Bool bJa=sal_True) { bSwapAsynchron=bJa; }
+ virtual sal_Bool KeyInput(const KeyEvent& rKEvt, Window* pWin);
+
+ virtual sal_Bool MouseButtonDown(const MouseEvent& /*rMEvt*/, Window* /*pWin*/) { return sal_False; }
+ virtual sal_Bool MouseButtonUp(const MouseEvent& /*rMEvt*/, Window* /*pWin*/) { return sal_False; }
+ virtual sal_Bool MouseMove(const MouseEvent& /*rMEvt*/, Window* /*pWin*/) { return sal_False; }
+ virtual sal_Bool Command(const CommandEvent& /*rCEvt*/, Window* /*pWin*/) { return sal_False; }
+ sal_Bool Cut(sal_uIntPtr /*nFormat*/=SDR_ANYFORMAT) { return sal_False; }
+ sal_Bool Yank(sal_uIntPtr /*nFormat*/=SDR_ANYFORMAT) { return sal_False; }
+ sal_Bool Paste(Window* /*pWin*/=NULL, sal_uIntPtr /*nFormat*/=SDR_ANYFORMAT) { return sal_False; }
+
+ /* new interface src537 */
+ sal_Bool GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False) const;
+
+ sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll);
+ SfxStyleSheet* GetStyleSheet() const; // SfxStyleSheet* GetStyleSheet(sal_Bool& rOk) const;
+ sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr);
+
+ virtual void MakeVisible(const Rectangle& rRect, Window& rWin);
+
+ // Fuer PlugIn. Wird vom Paint des OLE-Obj gerufen.
+ virtual void DoConnect(SdrOle2Obj* pOleObj);
+
+ // Animation aktivieren/deaktivieren fuer ::Paint
+ // wird z.Zt. ausgewertet von SdrGrafObj, wenn in dem eine Animation steckt
+ // Das Unterbinden der automatischen Animation wird z.B. fuer die Dia-Show benoetigt
+ sal_Bool IsAnimationEnabled() const { return ( SDR_ANIMATION_ANIMATE == eAnimationMode ); }
+ void SetAnimationEnabled( sal_Bool bEnable=sal_True );
+
+ // set/unset pause state for animations
+ bool IsAnimationPause() const { return bAnimationPause; }
+ void SetAnimationPause( bool bSet );
+
+ // Verhalten beim Starten von Animation im Paint-Handler:
+ // 1. Animation normal starten( SDR_ANIMATION_ANIMATE ) => DEFAULT
+ // 2. Nur die Ersatzdarstellung der Animation zeichnen ( SDR_ANIMATION_DONT_ANIMATE )
+ // 3. Nicht starten und nichts ersatzweise ausgeben ( SDR_ANIMATION_DISABLE )
+ void SetAnimationMode( const SdrAnimationMode eMode );
+ SdrAnimationMode GetAnimationMode() const { return eAnimationMode; }
+
+ // bei bShow=sal_False wird der Browser destruiert
+#ifdef DBG_UTIL
+ void ShowItemBrowser(sal_Bool bShow=sal_True);
+ sal_Bool IsItemBrowserVisible() const { return pItemBrowser!=NULL && ((Window*)pItemBrowser)->IsVisible(); }
+ Window* GetItemBrowser() const { return (Window*)pItemBrowser; }
+#endif
+
+ // Muss von App beim Scrollen usw. gerufen werden, damit ein u.U.
+ // aktives FormularControl mitverschoben werden kann
+ void VisAreaChanged(const OutputDevice* pOut=NULL);
+ void VisAreaChanged(const SdrPageWindow& rWindow);
+
+ sal_Bool IsPrintPreview() const { return bPrintPreview; }
+ void SetPrintPreview(bool bOn = true) { bPrintPreview=bOn; }
+
+ const svtools::ColorConfig& getColorConfig() const;
+
+ virtual void onChangeColorConfig();
+
+ // #103834# Set background color for svx at SdrPageViews
+ void SetApplicationBackgroundColor(Color aBackgroundColor);
+
+ // #103911# Set document color for svx at SdrPageViews
+ void SetApplicationDocumentColor(Color aDocumentColor);
+
+ // #i38135#
+ // Sets the timer for Object animations and restarts.
+ void SetAnimationTimer(sal_uInt32 nTime);
+
+ // access to Drawinglayer configuration options
+ const SvtOptionsDrawinglayer& getOptionsDrawinglayer() const { return maDrawinglayerOpt; }
+};
+
+#endif //_SVDPNTV_HXX
+
diff --git a/svx/inc/svx/svdpoev.hxx b/svx/inc/svx/svdpoev.hxx
new file mode 100644
index 000000000000..c187a2ddb3eb
--- /dev/null
+++ b/svx/inc/svx/svdpoev.hxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDPOEV_HXX
+#define _SVDPOEV_HXX
+
+#include "svx/svxdllapi.h"
+#include <svx/svdedtv.hxx>
+
+#include "svx/ipolypolygoneditorcontroller.hxx"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@@ @@@@ @@ @@ @@ @@@@@ @@@@@ @@ @@@@@@ @@ @@ @@ @@@@@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@
+// @@@@@ @@ @@ @@ @@@@ @@@@ @@ @@ @@ @@ @@@@@ @@ @@@@ @@@@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@
+// @@ @@@@ @@@@@ @@ @@@@@ @@@@@ @@ @@ @ @@ @@@@@ @@ @@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class SVX_DLLPUBLIC SdrPolyEditView: public SdrEditView, public IPolyPolygonEditorController
+{
+ friend class SdrEditView;
+
+protected:
+ sal_Bool bSetMarkedPointsSmoothPossible : 1;
+ sal_Bool bSetMarkedSegmentsKindPossible : 1;
+
+ SdrPathSmoothKind eMarkedPointsSmooth;
+ SdrPathSegmentKind eMarkedSegmentsKind;
+
+private:
+ SVX_DLLPRIVATE void ImpClearVars();
+ SVX_DLLPRIVATE void ImpResetPolyPossibilityFlags();
+ SVX_DLLPRIVATE void ImpCheckPolyPossibilities();
+
+ // Markierte Punkte kopieren und anstelle der alten markieren
+ // ist noch nicht implementiert!
+ SVX_DLLPRIVATE void ImpCopyMarkedPoints();
+ typedef void (*PPolyTrFunc)(Point&, Point*, Point*, const void*, const void*, const void*, const void*, const void*);
+ SVX_DLLPRIVATE void ImpTransformMarkedPoints(PPolyTrFunc pTrFunc, const void* p1=NULL, const void* p2=NULL, const void* p3=NULL, const void* p4=NULL, const void* p5=NULL);
+
+protected:
+ // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
+ SdrPolyEditView(SdrModel* pModel1, OutputDevice* pOut = 0L);
+ virtual ~SdrPolyEditView();
+
+public:
+ sal_Bool IsSetMarkedPointsSmoothPossible() const;
+ SdrPathSmoothKind GetMarkedPointsSmooth() const;
+ void SetMarkedPointsSmooth(SdrPathSmoothKind eKind);
+
+ // Ein PolySegment kann eine Strecke oder eine Bezierkurve sein.
+ sal_Bool IsSetMarkedSegmentsKindPossible() const;
+ SdrPathSegmentKind GetMarkedSegmentsKind() const;
+ void SetMarkedSegmentsKind(SdrPathSegmentKind eKind);
+
+ // Moeglicherweise ist das Obj hinterher geloescht:
+ void DeleteMarkedPoints();
+ sal_Bool IsDeleteMarkedPointsPossible() const;
+
+ void MoveMarkedPoints(const Size& rSiz, bool bCopy=false);
+ void ResizeMarkedPoints(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy=false);
+ void RotateMarkedPoints(const Point& rRef, long nWink, bool bCopy=false);
+
+ // Hierbei entstehen eventuell beliebig viele neue Objekte:
+ void RipUpAtMarkedPoints();
+ bool IsRipUpAtMarkedPointsPossible() const;
+
+ // Alle markierten Polylines werden zu Polygonen, alle offenen
+ // Bezierkurven zu geschlossenen.
+ void ShutMarkedObjects();
+ void CloseMarkedObjects(sal_Bool bToggle=sal_False, sal_Bool bOpen=sal_False); // , long nOpenDistance=0);
+ bool IsOpenCloseMarkedObjectsPossible() const;
+ SdrObjClosedKind GetMarkedObjectsClosedState() const;
+
+ void CheckPolyPossibilitiesHelper( SdrMark* pM, bool& b1stSmooth, bool& b1stSegm, bool& bCurve, bool& bSmoothFuz, bool& bSegmFuz, basegfx::B2VectorContinuity& eSmooth );
+};
+
+#endif //_SVDPOEV_HXX
+
diff --git a/svx/inc/svx/svdpool.hxx b/svx/inc/svx/svdpool.hxx
new file mode 100644
index 000000000000..6c764262c5b0
--- /dev/null
+++ b/svx/inc/svx/svdpool.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDPOOL_HXX
+#define _SVDPOOL_HXX
+
+#include <svx/xpool.hxx>
+#include <svx/svddef.hxx>
+#include "svx/svxdllapi.h"
+
+class XLineAttrSetItem;
+class XFillAttrSetItem;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class SVX_DLLPUBLIC SdrItemPool : public XOutdevItemPool
+{
+public:
+ SdrItemPool(SfxItemPool* pMaster = 0L, sal_Bool bLoadRefCounts = sal_True);
+ SdrItemPool(const SdrItemPool& rPool);
+protected:
+ virtual ~SdrItemPool();
+public:
+
+ virtual SfxItemPool* Clone() const;
+ virtual SfxItemPresentation GetPresentation(const SfxPoolItem& rItem,
+ SfxItemPresentation ePresentation,
+ SfxMapUnit ePresentationMetric,
+ String& rText,
+ const IntlWrapper * pIntlWrapper
+ = 0) const;
+
+ static void TakeItemName(sal_uInt16 nWhich, String& rItemName);
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif // _SVDPOOL_HXX
+// eof
diff --git a/svx/inc/svx/svdsnpv.hxx b/svx/inc/svx/svdsnpv.hxx
new file mode 100644
index 000000000000..4ad6d42a013c
--- /dev/null
+++ b/svx/inc/svx/svdsnpv.hxx
@@ -0,0 +1,338 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDSNPV_HXX
+#define _SVDSNPV_HXX
+
+#include <svx/svdpntv.hxx>
+#include <svx/svdhlpln.hxx>
+#include "svx/svxdllapi.h"
+
+//************************************************************
+// Defines
+//************************************************************
+
+#define SDRSNAP_NOTSNAPPED 0x0000
+#define SDRSNAP_XSNAPPED 0x0001
+#define SDRSNAP_YSNAPPED 0x0002
+#define SDRSNAP_XYSNAPPED 0x0003
+
+// SDRCROOK_STRETCH ist noch nicht implementiert!
+enum SdrCrookMode {
+ SDRCROOK_ROTATE,
+ SDRCROOK_SLANT,
+ SDRCROOK_STRETCH
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@ @@ @@ @@@@ @@@@@ @@ @@ @@ @@@@@ @@ @@
+// @@ @@ @@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@@@@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@
+// @@@@ @@@@@@ @@@@@@ @@@@@ @@@@@ @@ @@@@ @@@@@@@
+// @@ @@ @@@ @@ @@ @@ @@@ @@ @@ @@@@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@
+// @@@@ @@ @@ @@ @@ @@ @ @@ @@@@@ @@ @@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+// #114409#-1 Migrate PageOrigin
+class ImplPageOriginOverlay;
+
+class SVX_DLLPUBLIC SdrSnapView: public SdrPaintView
+{
+protected:
+ // #114409#-1 Migrate PageOrigin
+ class ImplPageOriginOverlay* mpPageOriginOverlay;
+
+ // #114409#-2 Migrate HelpLine
+ class ImplHelpLineOverlay* mpHelpLineOverlay;
+
+ Size aMagnSiz;
+ Fraction aSnapWdtX;
+ Fraction aSnapWdtY;
+
+ sal_uInt16 nMagnSizPix;
+ long nSnapAngle;
+ long nEliminatePolyPointLimitAngle;
+
+ SdrCrookMode eCrookMode;
+
+ unsigned bSnapEnab : 1;
+ unsigned bGridSnap : 1;
+ unsigned bSnapTo1Pix : 1; // Wenn GridSnap aus, auf ein Pixel fangen um Werte wie 10.01 zu vermeiden
+ unsigned bBordSnap : 1;
+ unsigned bHlplSnap : 1;
+ unsigned bOFrmSnap : 1;
+ unsigned bOPntSnap : 1;
+ unsigned bOConSnap : 1;
+ unsigned bMoveMFrmSnap : 1;
+ unsigned bMoveOFrmSnap : 1;
+ unsigned bMoveOPntSnap : 1;
+ unsigned bMoveOConSnap : 1;
+ unsigned bMoveSnapOnlyTopLeft : 1; // Speacial fuer den Dialogeditor
+ unsigned bOrtho : 1;
+ unsigned bBigOrtho : 1;
+ unsigned bAngleSnapEnab : 1;
+ unsigned bMoveOnlyDragging : 1; // Objekte nur verschieben bei Resize/Rotate/...
+ unsigned bSlantButShear : 1; // Slant anstelle von Shear anwenden
+ unsigned bCrookNoContortion : 1; // Objekte bei Crook nicht verzerren
+ unsigned bHlplFixed : 1; // sal_True=Hilfslinien fixiert, also nicht verschiebbar
+ unsigned bEliminatePolyPoints : 1;
+
+private:
+ SVX_DLLPRIVATE void ClearVars();
+
+protected:
+ // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
+ SdrSnapView(SdrModel* pModel1, OutputDevice* pOut = 0L);
+ virtual ~SdrSnapView();
+
+public:
+ virtual sal_Bool IsAction() const;
+ virtual void MovAction(const Point& rPnt);
+ virtual void EndAction();
+ virtual void BckAction();
+ virtual void BrkAction(); // f.abg.Klassen Actions z,B, Draggen abbrechen.
+ virtual void TakeActionRect(Rectangle& rRect) const;
+
+ void SetSnapGridWidth(const Fraction& rX, const Fraction& rY) { aSnapWdtX=rX; aSnapWdtY=rY; }
+ const Fraction& GetSnapGridWidthX() const { return aSnapWdtX; }
+ const Fraction& GetSnapGridWidthY() const { return aSnapWdtY; }
+
+ void SetSnapMagnetic(const Size& rSiz) { if (rSiz!=aMagnSiz) { aMagnSiz=rSiz; } }
+ const Size& GetSnapMagnetic() const { return aMagnSiz; }
+ void SetSnapMagneticPixel(sal_uInt16 nPix) { nMagnSizPix=nPix; }
+ sal_uInt16 GetSnapMagneticPixel() const { return nMagnSizPix; }
+
+ // RecalcLogicSnapMagnetic muss bei jedem Wechsel des OutputDevices
+ // sowie bei jedem Wechsel des MapModes gerufen werden!
+ void RecalcLogicSnapMagnetic(const OutputDevice& rOut) { SetSnapMagnetic(rOut.PixelToLogic(Size(nMagnSizPix,nMagnSizPix))); }
+ void SetActualWin(const OutputDevice* pWin) { SdrPaintView::SetActualWin(pWin); if (pWin!=NULL) RecalcLogicSnapMagnetic(*pWin); }
+
+ // Auf die View bezogene Koordinaten!
+ // Rueckgabewerte sind SDRSNAP_NOTSNAPPED,SDRSNAP_XSNAPPED,
+ // SDRSNAP_YSNAPPED oder SDRSNAP_XYSNAPPED
+ sal_uInt16 SnapPos(Point& rPnt, const SdrPageView* pPV) const;
+ Point GetSnapPos(const Point& rPnt, const SdrPageView* pPV) const;
+ sal_uInt16 SnapRect(const Rectangle& rRect, const SdrPageView* pPV, long& rDX, long& rDY) const;
+ void CheckSnap(const Point& rPt, const SdrPageView* pPV, long& nBestXSnap, long& nBestYSnap, bool& bXSnapped, bool& bYSnapped) const;
+
+ // Alle Fangeinstellungen sind Persistent.
+ sal_Bool IsSnapEnabled() const { return bSnapEnab; }
+ sal_Bool IsGridSnap() const { return bGridSnap; } // Fang auf Rastergitter
+ sal_Bool IsBordSnap() const { return bBordSnap; } // Fang auf Seitenraender
+ sal_Bool IsHlplSnap() const { return bHlplSnap; } // Fang auf Hilfslinien
+ sal_Bool IsOFrmSnap() const { return bOFrmSnap; } // Fang auf LogFram von umgebenden Zeichenobjekten
+ sal_Bool IsOPntSnap() const { return bOPntSnap; } // Fang auf ausgepraegte Punkte von umgebenden Zeichenobjekten
+ sal_Bool IsOConSnap() const { return bOConSnap; } // Fang auf Konnektoren der Zeichenobjekte
+ void SetSnapEnabled(sal_Bool bOn) { bSnapEnab=bOn; }
+ void SetGridSnap(sal_Bool bOn) { bGridSnap=bOn; }
+ void SetBordSnap(sal_Bool bOn) { bBordSnap=bOn; }
+ void SetHlplSnap(sal_Bool bOn) { bHlplSnap=bOn; }
+ void SetOFrmSnap(sal_Bool bOn) { bOFrmSnap=bOn; }
+ void SetOPntSnap(sal_Bool bOn) { bOPntSnap=bOn; }
+ void SetOConSnap(sal_Bool bOn) { bOConSnap=bOn; }
+
+ // Normalerweise werden beim Move-Dragging von Zeichenobjekten alle
+ // 4 Ecken des Object-SnapRects gefangen. Folgende Einstellmoeglichkeit,
+ // wenn man nur auf die linke obere Ecke fangen will (z.B. DialogEditor):
+ // Persistent, Default=FALSE.
+ void SetMoveSnapOnlyTopLeft(sal_Bool bOn) { bMoveSnapOnlyTopLeft=bOn; }
+ sal_Bool IsMoveSnapOnlyTopLeft() const { return bMoveSnapOnlyTopLeft; }
+
+ // Hilfslinien fixiert (nicht verschiebbar)
+ // Persistent, Default=FALSE.
+ sal_Bool IsHlplFixed() const { return bHlplFixed; }
+ void SetHlplFixed(sal_Bool bOn) { bHlplFixed=bOn; }
+
+ sal_Bool IsMoveMFrmSnap() const { return bMoveMFrmSnap; } // Fang des LogFram aller markierten Objekte
+ sal_Bool IsMoveOFrmSnap() const { return bMoveOFrmSnap; } // Fang aller LogFram der markierten Objekte
+ sal_Bool IsMoveOPntSnap() const { return bMoveOPntSnap; } // Fang ausgepraegter Punkte der markierten Objekte
+ sal_Bool IsMoveOConSnap() const { return bMoveOConSnap; } // Fang der Konnektoren der markierten Objekte
+
+ void SetMoveMFrmSnap(sal_Bool bOn) { bMoveMFrmSnap=bOn; }
+ void SetMoveOFrmSnap(sal_Bool bOn) { bMoveOFrmSnap=bOn; }
+ void SetMoveOPntSnap(sal_Bool bOn) { bMoveOPntSnap=bOn; }
+ void SetMoveOConSnap(sal_Bool bOn) { bMoveOConSnap=bOn; }
+
+ // #114409#-1 Migrate PageOrigin
+ sal_Bool BegSetPageOrg(const Point& rPnt);
+ void MovSetPageOrg(const Point& rPnt);
+ sal_Bool EndSetPageOrg();
+ void BrkSetPageOrg();
+ sal_Bool IsSetPageOrg() const { return (0L != mpPageOriginOverlay); }
+
+ // HitTest. Bei sal_True steht in rnHelpLineNum die Nummer der Hilfslinie und in rpPV
+ // die zugehoerige PageView.
+ sal_Bool PickHelpLine(const Point& rPnt, short nTol, const OutputDevice& rOut, sal_uInt16& rnHelpLineNum, SdrPageView*& rpPV) const;
+
+ // Verschieben einer vorhandenen Hilfslinie. nHelpLineNum und pPV von PickHelpLine verwenden.
+ sal_Bool BegDragHelpLine(sal_uInt16 nHelpLineNum, SdrPageView* pPV);
+ // Interaktives einfuegen einer neuen Hilfslinie
+ sal_Bool BegDragHelpLine(const Point& rPnt, SdrHelpLineKind eNewKind);
+ Pointer GetDraggedHelpLinePointer() const;
+
+ // Aendern des Hilfslinientyps waerend des draggens
+ // void SetDraggedHelpLineKind(SdrHelpLineKind eNewKind);
+ void MovDragHelpLine(const Point& rPnt);
+ sal_Bool EndDragHelpLine();
+ void BrkDragHelpLine();
+ sal_Bool IsDragHelpLine() const { return (0L != mpHelpLineOverlay); }
+
+ // SnapAngle ist fuer Winkel im Kreis, RotateDragging, ...
+ // Der Winkelfang wird unterdrueckt, wenn er mit
+ // durch SetAngleSnapEnabled(sal_False) ausgeschaltet ist.
+ // Der Winkelfang ist unabhaengig vom Koordinatenfang
+ // und somit von der Einstellung IsSnapEnabled()
+ // Es sollten nur Werte angegeben werden fuer die gilt:
+ // 36000 modulu nWink = 0
+ // Implementiert fuer:
+ // - Rotate (Dragging)
+ // - Shear (Dragging)
+ // - Kreisbogen/-sektor/-abschnitt Winkel (Create und Dragging)
+ // Persistent.
+ void SetAngleSnapEnabled(sal_Bool bOn) { bAngleSnapEnab=bOn; }
+ sal_Bool IsAngleSnapEnabled() const { return bAngleSnapEnab; }
+ void SetSnapAngle(long nWink) { nSnapAngle=nWink; }
+ long GetSnapAngle() const { return nSnapAngle; }
+
+ // Ortho hat je nach Kontext verschiedene Effekte:
+ // - Create
+ // - Linien werden nur im 45deg Raster zugelassen
+ // - Statt Rechtecke werden Quadrate erzeugt
+ // - Statt Ellipsen werden Kreise erzeugt
+ // - Dragging
+ // - allgemeines Dragging
+ // - Move nur Hor, Vert oder 45deg
+ // - Resize proportional
+ // - Mirror: nichts
+ // - Shear ohne Resize
+ // - Crook ohne Resize
+ // - verschieben der Handles
+ // - Spiegelachse nur 45deg Raster
+ // - Objekteigenes Dragging
+ // - Rechteck Eckenradius: nichts
+ // - Kreisobjekt Winkel: nichts
+ // - Linie behaelt beim Draggen ihren Winkel bei und wird nur (ni)
+ // verlaengert bzw. verkuerzt.
+ // Defaultmaessig ist Ortho ausgeschaltet. Persistent.
+ void SetOrtho(sal_Bool bOn) { bOrtho=bOn; } // unvollstaendig
+ sal_Bool IsOrtho() const { return bOrtho; }
+
+ // BigOrtho hat nur Relevanz wenn Ortho eingeschaltet ist.
+ // Beispiel: Ein Rechteck wird mit eingeschaltetem Ortho (also ein Quadrat)
+ // erzeugt und die Maus wurde dabei vom Nullpunkt zu den Koordinaten
+ // (80,30) gedraggt. Dann stuenden nun 2 Alternativen zur Bestimmung der
+ // Kantenlaenge des Quadrats zur Wahl: 30 und 80.
+ // Die normale Ortho-Funktuionalitaet brachte hierbei ein Quadrat mit
+ // Kantenlaenge 30 (also immer die kleinere Groesse). Bei hinzugeschal-
+ // tetem BigOrtho bekaeme man dagegen ein Quadrat der Kantenlaenge 80.
+ // Gleiches gilt auch fuer Resize.
+ // Defaultmaessig ist BigOrtho eingeschaltet. Persistent.
+ void SetBigOrtho(sal_Bool bOn) { bBigOrtho=bOn; }
+ sal_Bool IsBigOrtho() const { return bBigOrtho; }
+
+ // bei MoveOnlyDragging=sal_True wird bei Resize/Rotate/Shear/Mirror/Crook
+ // nur das Zentrum der markierten Objekte transformiert. Groesse, Form
+ // und Drehwinkel der Objekte bleiben erhalten, nur ihre Positionen
+ // aendern sich. Persistent. Default=FALSE. (ni)
+ void SetMoveOnlyDragging(sal_Bool bOn) { bMoveOnlyDragging=bOn; }
+ sal_Bool IsMoveOnlyDragging() const { return bMoveOnlyDragging; }
+
+ // Slant anstelle von Shear anwenden. Persistent. Default=FALSE.
+ void SetSlantButShear(sal_Bool bOn) { bSlantButShear=bOn; }
+ sal_Bool IsSlantButShear() const { return bSlantButShear; }
+
+ // Objekte bei Crook nicht verzerren. Persistent. Default=FALSE. (ni)
+ void SetCrookNoContortion(sal_Bool bOn) { bCrookNoContortion=bOn; }
+ sal_Bool IsCrookNoContortion() const { return bCrookNoContortion; }
+
+ // Crook-Modus. Persistent. Default=SDRCROOK_ROTATE. (ni)
+ void SetCrookMode(SdrCrookMode eMode) { eCrookMode=eMode; }
+ SdrCrookMode GetCrookMode() const { return eCrookMode; }
+
+ // Special fuer IBM: Beim Draggen eines Polygonpunkts wird dieser
+ // geloescht, wenn seine beiden angrenzenden Linien eh' fast eine
+ // durchgehende Linie sind.
+ void SetEliminatePolyPoints(sal_Bool bOn) { bEliminatePolyPoints=bOn; }
+ sal_Bool IsEliminatePolyPoints() const { return bEliminatePolyPoints; }
+ void SetEliminatePolyPointLimitAngle(long nAngle) { nEliminatePolyPointLimitAngle=nAngle; }
+ long GetEliminatePolyPointLimitAngle() const { return nEliminatePolyPointLimitAngle; }
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// Begriffsdefinition:
+// - Etwas fangen=Gefangen werden kann z.B. der Mauszeiger oder die z.Zt. im
+// Drag befindlichen markierten Objekte.
+// - Auf etwas fangen=Man kann z.B. auf das Grid oder auf Hilfslinien fangen.
+//
+// Grundsaetzlich wird nur gefangen auf sichtbare Elemente (-> Border,
+// Hilfslinien, Konnektoren; Ausnahme: Grid). Ebenso koennen nur sichtbare
+// Elemente gefangen werden (->Konnektoren).
+//
+// Auf's Grid wird immer erst dann gefangen, wenn nix Anderes in der Naehe
+// (->Magnetic) ist.
+//
+// Der "Cursor" (also der Mauszeiger) beim Erzeugen von Objekten, beim Draggen
+// von Polygonpunkten, ... wird immer auf allen eingeschalteten Fangalternativen
+// gefangen (max 6).
+//
+// Beim Verschieben markierter Objekte ist das etwas anders. Statt des einen
+// Mauscursors gibt es hier 4 Alternativen an den markierten Objekten, die
+// gefangen werden koennen:
+// 1. die logisch-umschliessenden Rahmen der einzelnen Objekte
+// 2. der logisch-umschliessende Rahmen aller markierten Objekte
+// 3. ausgezeichnete Punkte der markierten Objekte (Polygonpunkte, ...)
+// 4. die Konnektoren der markierten Objekte
+// Da 1. und 2. einander ausschliessen (2. ist eine Verfeinerung von 1.)
+// bleiben 3 voneinander unabhaengige Alternativen. Bei 6. Moeglichkeiten auf
+// die gefangen werden kann kaeme man auf max. 18 Kombinationsmoeglichkeiten!
+// Deshalb werden folgende Vereinfachungen festgelegt:
+// 1. Konnektoren fangen sich nur auf Konnektoren.
+// Verbleiben also nun noch max. 2x5+1=11 Fangkombinationen beim MoveDrag:
+// 1-3. umschliessende(r) Rahmen auf Grid/Border/Hilfslinien
+// 4. umschliessende(r) Rahmen auf ausgezeichnete Objektpunkte
+// 5. umschliessende(r) Rahmen auf umschliessenden Rahmen
+// 6-8. ausgezeichnete Punkte auf Grid/Border/Hilfslinien
+// 7. ausgezeichnete Punkte auf ausgezeichnete Objektpunkte
+// 8-10. ausgezeichnete Punkte auf umschliessenden Rahmen
+// 11. Konnektoren auf Konnektoren
+// Beim MouseMove-Event im DragMove werden also diese bis zu max. 11 moeglichen
+// Alternativen durchgetestet und die mit dem gerigsten Korrekturaufwand
+// vollzogen.
+//
+// Beim Resize, ... wird immer nur der logisch-umschliessende Rahmen der
+// markierten Objekte gefangen.
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDSNPV_HXX
+
diff --git a/svx/inc/svx/svdsob.hxx b/svx/inc/svx/svdsob.hxx
new file mode 100644
index 000000000000..64d437d4c608
--- /dev/null
+++ b/svx/inc/svx/svdsob.hxx
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDSOB_HXX
+#define _SVDSOB_HXX
+
+#include <com/sun/star/uno/Any.hxx>
+#include <tools/stream.hxx>
+
+#ifndef _STRING_H
+#include <tools/string.hxx> //wg. memset
+#define _STRING_H
+#endif
+#include "svx/svxdllapi.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/*
+ Deklaration eines statischen Mengentyps. Die Menge kann die Elemente
+ 0..255 aufnehmen und verbraucht stets 32 Bytes.
+*/
+
+class SVX_DLLPUBLIC SetOfByte
+{
+protected:
+ sal_uInt8 aData[32];
+
+public:
+ SetOfByte(sal_Bool bInitVal = sal_False)
+ {
+ memset(aData, bInitVal ? 0xFF : 0x00, sizeof(aData));
+ }
+
+ sal_Bool operator==(const SetOfByte& rCmpSet) const
+ {
+ return (memcmp(aData, rCmpSet.aData, sizeof(aData)) == 0);
+ }
+
+ sal_Bool operator!=(const SetOfByte& rCmpSet) const
+ {
+ return (memcmp(aData, rCmpSet.aData, sizeof(aData))!=0);
+ }
+
+ void Set(sal_uInt8 a)
+ {
+ aData[a/8] |= 1<<a%8;
+ }
+
+ void Clear(sal_uInt8 a)
+ {
+ aData[a/8] &= ~(1<<a%8);
+ }
+
+ void Set(sal_uInt8 a, sal_Bool b)
+ {
+ if(b)
+ Set(a);
+ else
+ Clear(a);
+ }
+
+ sal_Bool IsSet(sal_uInt8 a) const
+ {
+ return (aData[a/8] & 1<<a%8) != 0;
+ }
+
+ void SetAll()
+ {
+ memset(aData, 0xFF, sizeof(aData));
+ }
+
+ void ClearAll()
+ {
+ memset(aData, 0x00, sizeof(aData));
+ }
+
+ sal_Bool IsEmpty() const;
+ sal_Bool IsFull() const;
+
+ sal_uInt16 GetSetCount() const;
+ sal_uInt8 GetSetBit(sal_uInt16 nNum) const;
+ sal_uInt16 GetClearCount() const;
+ sal_uInt8 GetClearBit(sal_uInt16 nNum) const;
+ void operator&=(const SetOfByte& r2ndSet);
+ void operator|=(const SetOfByte& r2ndSet);
+
+ friend inline SvStream& operator<<(SvStream& rOut, const SetOfByte& rSet);
+ friend inline SvStream& operator>>(SvStream& rIn, SetOfByte& rSet);
+
+ // initialize this set with a uno sequence of sal_Int8
+ void PutValue(const com::sun::star::uno::Any & rAny);
+
+ // returns a uno sequence of sal_Int8
+ void QueryValue(com::sun::star::uno::Any & rAny) const;
+};
+
+inline SvStream& operator<<(SvStream& rOut, const SetOfByte& rSet)
+{
+ rOut.Write((char*)rSet.aData,32);
+ return rOut;
+}
+
+inline SvStream& operator>>(SvStream& rIn, SetOfByte& rSet)
+{
+ rIn.Read((char*)rSet.aData,32);
+ return rIn;
+}
+
+#endif // _SVDSOB_HXX
+
diff --git a/svx/inc/svx/svdstr.hrc b/svx/inc/svx/svdstr.hrc
new file mode 100644
index 000000000000..d778bf40326b
--- /dev/null
+++ b/svx/inc/svx/svdstr.hrc
@@ -0,0 +1,790 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define SDR_ResourceBegin 2560
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Achtung: Alle Strings zwischen SDR_StringCacheBegin und
+// SDR_StringCacheEnd muessen buendig aneinander liegen.
+//BFS06#define SDR_StringCacheBegin (SDR_ResourceBegin)
+
+#define STR_ObjNameBegin (SDR_ResourceBegin)
+#define STR_ObjNameSingulNONE (STR_ObjNameBegin + 0)
+#define STR_ObjNamePluralNONE (STR_ObjNameBegin + 1)
+#define STR_ObjNameSingulGRUP (STR_ObjNameBegin + 2)
+#define STR_ObjNamePluralGRUP (STR_ObjNameBegin + 3)
+#define STR_ObjNameSingulGRUPEMPTY (STR_ObjNameBegin + 4)
+#define STR_ObjNamePluralGRUPEMPTY (STR_ObjNameBegin + 5)
+#define STR_ObjNameSingulTable (STR_ObjNameBegin + 6)
+#define STR_ObjNamePluralTable (STR_ObjNameBegin + 7)
+#define STR_ObjNameSingulLINE (STR_ObjNameBegin + 8)
+#define STR_ObjNameSingulLINE_Hori (STR_ObjNameBegin + 9)
+#define STR_ObjNameSingulLINE_Vert (STR_ObjNameBegin + 10)
+#define STR_ObjNameSingulLINE_Diag (STR_ObjNameBegin + 11)
+#define STR_ObjNamePluralLINE (STR_ObjNameBegin + 12)
+#define STR_ObjNameSingulRECT (STR_ObjNameBegin + 13)
+#define STR_ObjNamePluralRECT (STR_ObjNameBegin + 14)
+#define STR_ObjNameSingulQUAD (STR_ObjNameBegin + 15)
+#define STR_ObjNamePluralQUAD (STR_ObjNameBegin + 16)
+#define STR_ObjNameSingulPARAL (STR_ObjNameBegin + 17)
+#define STR_ObjNamePluralPARAL (STR_ObjNameBegin + 18)
+#define STR_ObjNameSingulRAUTE (STR_ObjNameBegin + 19)
+#define STR_ObjNamePluralRAUTE (STR_ObjNameBegin + 20)
+#define STR_ObjNameSingulRECTRND (STR_ObjNameBegin + 21)
+#define STR_ObjNamePluralRECTRND (STR_ObjNameBegin + 22)
+#define STR_ObjNameSingulQUADRND (STR_ObjNameBegin + 23)
+#define STR_ObjNamePluralQUADRND (STR_ObjNameBegin + 24)
+#define STR_ObjNameSingulPARALRND (STR_ObjNameBegin + 25)
+#define STR_ObjNamePluralPARALRND (STR_ObjNameBegin + 26)
+#define STR_ObjNameSingulRAUTERND (STR_ObjNameBegin + 27)
+#define STR_ObjNamePluralRAUTERND (STR_ObjNameBegin + 28)
+#define STR_ObjNameSingulCIRC (STR_ObjNameBegin + 29)
+#define STR_ObjNamePluralCIRC (STR_ObjNameBegin + 30)
+#define STR_ObjNameSingulSECT (STR_ObjNameBegin + 31)
+#define STR_ObjNamePluralSECT (STR_ObjNameBegin + 32)
+#define STR_ObjNameSingulCARC (STR_ObjNameBegin + 33)
+#define STR_ObjNamePluralCARC (STR_ObjNameBegin + 34)
+#define STR_ObjNameSingulCCUT (STR_ObjNameBegin + 35)
+#define STR_ObjNamePluralCCUT (STR_ObjNameBegin + 36)
+#define STR_ObjNameSingulCIRCE (STR_ObjNameBegin + 37)
+#define STR_ObjNamePluralCIRCE (STR_ObjNameBegin + 38)
+#define STR_ObjNameSingulSECTE (STR_ObjNameBegin + 39)
+#define STR_ObjNamePluralSECTE (STR_ObjNameBegin + 40)
+#define STR_ObjNameSingulCARCE (STR_ObjNameBegin + 41)
+#define STR_ObjNamePluralCARCE (STR_ObjNameBegin + 42)
+#define STR_ObjNameSingulCCUTE (STR_ObjNameBegin + 43)
+#define STR_ObjNamePluralCCUTE (STR_ObjNameBegin + 44)
+#define STR_ObjNameSingulPOLY (STR_ObjNameBegin + 45)
+#define STR_ObjNameSingulPOLY_PntAnz (STR_ObjNameBegin + 46)
+#define STR_ObjNamePluralPOLY (STR_ObjNameBegin + 47)
+#define STR_ObjNameSingulPLIN (STR_ObjNameBegin + 48)
+#define STR_ObjNameSingulPLIN_PntAnz (STR_ObjNameBegin + 49)
+#define STR_ObjNamePluralPLIN (STR_ObjNameBegin + 50)
+#define STR_ObjNameSingulPATHLINE (STR_ObjNameBegin + 51)
+#define STR_ObjNamePluralPATHLINE (STR_ObjNameBegin + 52)
+#define STR_ObjNameSingulPATHFILL (STR_ObjNameBegin + 53)
+#define STR_ObjNamePluralPATHFILL (STR_ObjNameBegin + 54)
+#define STR_ObjNameSingulFREELINE (STR_ObjNameBegin + 55)
+#define STR_ObjNamePluralFREELINE (STR_ObjNameBegin + 56)
+#define STR_ObjNameSingulFREEFILL (STR_ObjNameBegin + 57)
+#define STR_ObjNamePluralFREEFILL (STR_ObjNameBegin + 58)
+#define STR_ObjNameSingulCOMBLINE (STR_ObjNameBegin + 59)
+#define STR_ObjNamePluralCOMBLINE (STR_ObjNameBegin + 60)
+#define STR_ObjNameSingulCOMBFILL (STR_ObjNameBegin + 61)
+#define STR_ObjNamePluralCOMBFILL (STR_ObjNameBegin + 62)
+#define STR_ObjNameSingulNATSPLN (STR_ObjNameBegin + 63)
+#define STR_ObjNamePluralNATSPLN (STR_ObjNameBegin + 64)
+#define STR_ObjNameSingulPERSPLN (STR_ObjNameBegin + 65)
+#define STR_ObjNamePluralPERSPLN (STR_ObjNameBegin + 66)
+#define STR_ObjNameSingulTEXT (STR_ObjNameBegin + 67)
+#define STR_ObjNamePluralTEXT (STR_ObjNameBegin + 68)
+#define STR_ObjNameSingulTEXTLNK (STR_ObjNameBegin + 69)
+#define STR_ObjNamePluralTEXTLNK (STR_ObjNameBegin + 70)
+#define STR_ObjNameSingulFITTEXT (STR_ObjNameBegin + 71)
+#define STR_ObjNamePluralFITTEXT (STR_ObjNameBegin + 72)
+#define STR_ObjNameSingulFITALLTEXT (STR_ObjNameBegin + 73)
+#define STR_ObjNamePluralFITALLTEXT (STR_ObjNameBegin + 74)
+#define STR_ObjNameSingulTITLETEXT (STR_ObjNameBegin + 75)
+#define STR_ObjNamePluralTITLETEXT (STR_ObjNameBegin + 76)
+#define STR_ObjNameSingulOUTLINETEXT (STR_ObjNameBegin + 77)
+#define STR_ObjNamePluralOUTLINETEXT (STR_ObjNameBegin + 78)
+#define STR_ObjNameSingulGRAF (STR_ObjNameBegin + 79)
+#define STR_ObjNamePluralGRAF (STR_ObjNameBegin + 80)
+#define STR_ObjNameSingulGRAFLNK (STR_ObjNameBegin + 81)
+#define STR_ObjNamePluralGRAFLNK (STR_ObjNameBegin + 82)
+#define STR_ObjNameSingulGRAFNONE (STR_ObjNameBegin + 83)
+#define STR_ObjNamePluralGRAFNONE (STR_ObjNameBegin + 84)
+#define STR_ObjNameSingulGRAFNONELNK (STR_ObjNameBegin + 85)
+#define STR_ObjNamePluralGRAFNONELNK (STR_ObjNameBegin + 86)
+#define STR_ObjNameSingulGRAFMTF (STR_ObjNameBegin + 87)
+#define STR_ObjNamePluralGRAFMTF (STR_ObjNameBegin + 88)
+#define STR_ObjNameSingulGRAFMTFLNK (STR_ObjNameBegin + 89)
+#define STR_ObjNamePluralGRAFMTFLNK (STR_ObjNameBegin + 90)
+#define STR_ObjNameSingulGRAFBMP (STR_ObjNameBegin + 91)
+#define STR_ObjNamePluralGRAFBMP (STR_ObjNameBegin + 92)
+#define STR_ObjNameSingulGRAFBMPLNK (STR_ObjNameBegin + 93)
+#define STR_ObjNamePluralGRAFBMPLNK (STR_ObjNameBegin + 94)
+#define STR_ObjNameSingulGRAFMAC (STR_ObjNameBegin + 95)
+#define STR_ObjNamePluralGRAFMAC (STR_ObjNameBegin + 96)
+#define STR_ObjNameSingulGRAFMACLNK (STR_ObjNameBegin + 97)
+#define STR_ObjNamePluralGRAFMACLNK (STR_ObjNameBegin + 98)
+#define STR_ObjNameSingulOLE2 (STR_ObjNameBegin + 99)
+#define STR_ObjNamePluralOLE2 (STR_ObjNameBegin +100)
+#define STR_ObjNameSingulOLE2LNK (STR_ObjNameBegin +101)
+#define STR_ObjNamePluralOLE2LNK (STR_ObjNameBegin +102)
+#define STR_ObjOLE2NamePrefix (STR_ObjNameBegin +103)
+#define STR_ObjNameSingulFrame (STR_ObjNameBegin +104)
+#define STR_ObjNamePluralFrame (STR_ObjNameBegin +105)
+#define STR_ObjFrameNamePrefix (STR_ObjNameBegin +106)
+#define STR_ObjNameSingulEDGE (STR_ObjNameBegin +107)
+#define STR_ObjNamePluralEDGE (STR_ObjNameBegin +108)
+#define STR_ObjNameSingulCAPTION (STR_ObjNameBegin +109)
+#define STR_ObjNamePluralCAPTION (STR_ObjNameBegin +110)
+#define STR_ObjNameSingulPAGE (STR_ObjNameBegin +111)
+#define STR_ObjNamePluralPAGE (STR_ObjNameBegin +112)
+#define STR_ObjNameSingulMEASURE (STR_ObjNameBegin +113)
+#define STR_ObjNamePluralMEASURE (STR_ObjNameBegin +114)
+#define STR_ObjNamePlural (STR_ObjNameBegin +115)
+#define STR_ObjNameNoObj (STR_ObjNameBegin +116)
+#define STR_ObjNameAnd (STR_ObjNameBegin +117)
+#define STR_ObjNameSingulPlural (STR_ObjNameBegin +118)
+#define STR_ObjNameSingulUno (STR_ObjNameBegin +119)
+#define STR_ObjNamePluralUno (STR_ObjNameBegin +120)
+
+// Neu ab 537: Namen fuer 3D-Objekte
+#define STR_ObjNameSingulCube3d (STR_ObjNameBegin + 121)
+#define STR_ObjNamePluralCube3d (STR_ObjNameBegin + 122)
+#define STR_ObjNameSingulExtrude3d (STR_ObjNameBegin + 123)
+#define STR_ObjNamePluralExtrude3d (STR_ObjNameBegin + 124)
+#define STR_ObjNameSingulLabel3d (STR_ObjNameBegin + 125)
+#define STR_ObjNamePluralLabel3d (STR_ObjNameBegin + 126)
+#define STR_ObjNameSingulLathe3d (STR_ObjNameBegin + 127)
+#define STR_ObjNamePluralLathe3d (STR_ObjNameBegin + 128)
+#define STR_ObjNameSingulObj3d (STR_ObjNameBegin + 129)
+#define STR_ObjNamePluralObj3d (STR_ObjNameBegin + 130)
+//BFS01#define STR_ObjNameSingulPoly3d (STR_ObjNameBegin + 131)
+#define STR_ObjNamePluralPoly3d (STR_ObjNameBegin + 132)
+#define STR_ObjNameSingulScene3d (STR_ObjNameBegin + 133)
+#define STR_ObjNamePluralScene3d (STR_ObjNameBegin + 134)
+#define STR_ObjNameSingulSphere3d (STR_ObjNameBegin + 135)
+#define STR_ObjNamePluralSphere3d (STR_ObjNameBegin + 136)
+
+#define STR_ObjNameSingulGRAFBMPTRANS (STR_ObjNameBegin + 137)
+#define STR_ObjNameSingulGRAFBMPTRANSLNK (STR_ObjNameBegin + 138)
+
+#define STR_ObjNamePluralGRAFBMPTRANS (STR_ObjNameBegin + 139)
+#define STR_ObjNamePluralGRAFBMPTRANSLNK (STR_ObjNameBegin + 140)
+
+#define STR_ObjNameSingulCUSTOMSHAPE (STR_ObjNameBegin + 141)
+#define STR_ObjNamePluralCUSTOMSHAPE (STR_ObjNameBegin + 142)
+
+#define STR_ObjNameSingulMEDIA (STR_ObjNameBegin + 143)
+#define STR_ObjNamePluralMEDIA (STR_ObjNameBegin + 144)
+
+#define STR_ObjNameEnd (STR_ObjNamePluralMEDIA)
+
+#define STR_EditBegin (STR_ObjNameEnd+1)
+#define STR_EditWithCopy (STR_EditBegin + 0)
+#define STR_EditPosSize (STR_EditBegin + 1)
+#define STR_EditDelete (STR_EditBegin + 2)
+#define STR_EditMovToTop (STR_EditBegin + 3)
+#define STR_EditMovToBtm (STR_EditBegin + 4)
+#define STR_EditPutToTop (STR_EditBegin + 5)
+#define STR_EditPutToBtm (STR_EditBegin + 6)
+#define STR_EditRevOrder (STR_EditBegin + 7)
+#define STR_EditMove (STR_EditBegin + 8)
+#define STR_EditResize (STR_EditBegin + 9)
+#define STR_EditRotate (STR_EditBegin + 10)
+#define STR_EditMirrorHori (STR_EditBegin + 11)
+#define STR_EditMirrorVert (STR_EditBegin + 12)
+#define STR_EditMirrorDiag (STR_EditBegin + 13)
+#define STR_EditMirrorFree (STR_EditBegin + 14)
+#define STR_EditShear (STR_EditBegin + 15)
+#define STR_EditCrook (STR_EditBegin + 16)
+#define STR_EditCrookContortion (STR_EditBegin + 17)
+#define STR_EditDistort (STR_EditBegin + 18)
+#define STR_EditRipUp (STR_EditBegin + 19)
+#define STR_EditSetPointsSmooth (STR_EditBegin + 20)
+#define STR_EditSetSegmentsKind (STR_EditBegin + 21)
+#define STR_EditShut (STR_EditBegin + 22)
+#define STR_EditSetGlueEscDir (STR_EditBegin + 23)
+#define STR_EditSetGluePercent (STR_EditBegin + 24)
+#define STR_EditSetGlueAlign (STR_EditBegin + 25)
+#define STR_EditGroup (STR_EditBegin + 26)
+#define STR_EditUngroup (STR_EditBegin + 27)
+#define STR_EditSetAttributes (STR_EditBegin + 28)
+#define STR_EditSetStylesheet (STR_EditBegin + 29)
+#define STR_EditDelStylesheet (STR_EditBegin + 30)
+#define STR_EditConvToPoly (STR_EditBegin + 31)
+#define STR_EditConvToPolys (STR_EditBegin + 32)
+#define STR_EditConvToCurve (STR_EditBegin + 33)
+#define STR_EditConvToCurves (STR_EditBegin + 34)
+#define STR_EditAlign (STR_EditBegin + 35)
+#define STR_EditAlignVTop (STR_EditBegin + 36)
+#define STR_EditAlignVBottom (STR_EditBegin + 37)
+#define STR_EditAlignVCenter (STR_EditBegin + 38)
+#define STR_EditAlignHLeft (STR_EditBegin + 39)
+#define STR_EditAlignHRight (STR_EditBegin + 40)
+#define STR_EditAlignHCenter (STR_EditBegin + 41)
+#define STR_EditAlignCenter (STR_EditBegin + 42)
+#define STR_EditTransform (STR_EditBegin + 43)
+#define STR_EditCombine_PolyPoly (STR_EditBegin + 44)
+#define STR_EditCombine_OnePoly (STR_EditBegin + 45)
+#define STR_EditDismantle_Polys (STR_EditBegin + 46)
+#define STR_EditDismantle_Lines (STR_EditBegin + 47)
+#define STR_EditImportMtf (STR_EditBegin + 48)
+#define STR_EditImportSGV (STR_EditBegin + 49)
+#define STR_EditImportHPGL (STR_EditBegin + 50)
+#define STR_EditImportDXF (STR_EditBegin + 51)
+#define STR_EditConvToContour (STR_EditBegin + 52)
+#define STR_EditConvToContours (STR_EditBegin + 53)
+#define STR_EditMergeMergePoly (STR_EditBegin + 54)
+#define STR_EditMergeSubstractPoly (STR_EditBegin + 55)
+#define STR_EditMergeIntersectPoly (STR_EditBegin + 56)
+#define STR_DistributeMarkedObjects (STR_EditBegin + 57)
+#define STR_EditEnd (STR_DistributeMarkedObjects)
+
+#define STR_ExchangeBegin (STR_EditEnd+1)
+#define STR_ExchangePaste (STR_ExchangeBegin +0)
+#define STR_ExchangeClpCut (STR_ExchangeBegin +1)
+#define STR_ExchangeClpPaste (STR_ExchangeBegin +2)
+#define STR_ExchangeDD (STR_ExchangeBegin +3)
+#define STR_ExchangeDDPaste (STR_ExchangeBegin +4)
+#define STR_ExchangeEnd (STR_ExchangeDDPaste)
+
+#define STR_DragBegin (STR_ExchangeEnd+1)
+#define STR_DragInsertPoint (STR_DragBegin + 0)
+#define STR_DragInsertGluePoint (STR_DragBegin + 1)
+#define STR_DragMethMovHdl (STR_DragBegin + 2)
+#define STR_DragMethObjOwn (STR_DragBegin + 3)
+#define STR_DragMethMove (STR_DragBegin + 4)
+#define STR_DragMethResize (STR_DragBegin + 5)
+#define STR_DragMethRotate (STR_DragBegin + 6)
+#define STR_DragMethMirrorHori (STR_DragBegin + 7)
+#define STR_DragMethMirrorVert (STR_DragBegin + 8)
+#define STR_DragMethMirrorDiag (STR_DragBegin + 9)
+#define STR_DragMethMirrorFree (STR_DragBegin +10)
+#define STR_DragMethShear (STR_DragBegin +11)
+#define STR_DragMethCrook (STR_DragBegin +12)
+#define STR_DragMethCrookContortion (STR_DragBegin +13)
+#define STR_DragMethDistort (STR_DragBegin +14)
+#define STR_DragRectEckRad (STR_DragBegin +15)
+#define STR_DragPathObj (STR_DragBegin +16)
+#define STR_DragRectResize (STR_DragBegin +17)
+#define STR_DragCaptFram (STR_DragBegin +18)
+#define STR_DragCaptTail (STR_DragBegin +19)
+#define STR_DragCircAngle (STR_DragBegin +20)
+#define STR_DragEdgeTail (STR_DragBegin +21)
+#define STR_DragMethGradient (STR_DragBegin +22)
+#define STR_DragMethTransparence (STR_DragBegin +23)
+#define STR_DragMethCrop (STR_DragBegin +24)
+#define STR_DragEnd (STR_DragMethCrop)
+
+#define STR_ViewBegin (STR_DragEnd+1)
+#define STR_ViewTextEdit (STR_ViewBegin + 0)
+#define STR_ViewMarked (STR_ViewBegin + 1)
+#define STR_ViewMarkedPoint (STR_ViewBegin + 2)
+#define STR_ViewMarkedPoints (STR_ViewBegin + 3)
+#define STR_ViewMarkedGluePoint (STR_ViewBegin + 4)
+#define STR_ViewMarkedGluePoints (STR_ViewBegin + 5)
+#define STR_ViewMarkObjs (STR_ViewBegin + 6)
+#define STR_ViewMarkMoreObjs (STR_ViewBegin + 7)
+#define STR_ViewMarkPoints (STR_ViewBegin + 8)
+#define STR_ViewMarkMorePoints (STR_ViewBegin + 9)
+#define STR_ViewMarkGluePoints (STR_ViewBegin +10)
+#define STR_ViewMarkMoreGluePoints (STR_ViewBegin +11)
+#define STR_ViewCreateObj (STR_ViewBegin +12)
+#define STR_ViewEnd (STR_ViewCreateObj)
+
+#define STR_UndoBegin (STR_ViewEnd+1)
+#define STR_UndoInsertObj (STR_UndoBegin + 0)
+#define STR_UndoCopyObj (STR_UndoBegin + 1)
+#define STR_UndoObjOrdNum (STR_UndoBegin + 2)
+#define STR_UndoObjSetText (STR_UndoBegin + 3)
+
+#define STR_UndoNewPage (STR_UndoBegin + 4)
+#define STR_UndoDelPage (STR_UndoBegin + 5)
+#define STR_UndoCopPage (STR_UndoBegin + 6)
+#define STR_UndoMovPage (STR_UndoBegin + 7)
+
+#define STR_UndoNewPageMasterDscr (STR_UndoBegin + 8)
+#define STR_UndoDelPageMasterDscr (STR_UndoBegin + 9)
+#define STR_UndoMovPageMasterDscr (STR_UndoBegin +10)
+#define STR_UndoChgPageMasterDscr (STR_UndoBegin +11)
+
+#define STR_UndoMergeModel (STR_UndoBegin +12)
+
+#define STR_UndoNewLayer (STR_UndoBegin +13)
+#define STR_UndoDelLayer (STR_UndoBegin +14)
+#define STR_UndoMovLayer (STR_UndoBegin +15)
+
+// --> OD 2009-07-09 #i73249#
+#define STR_UndoObjName (STR_UndoBegin +16)
+#define STR_UndoObjTitle (STR_UndoBegin +17)
+#define STR_UndoObjDescription (STR_UndoBegin +18)
+// <--
+#define STR_UndoEnd (STR_UndoObjDescription)
+
+
+#define STR_LayerBegin (STR_UndoEnd+1)
+#define STR_StandardLayerName (STR_LayerBegin +0)
+#define STR_LayerEnd (STR_StandardLayerName)
+
+
+#define STR_ItemBegin (STR_LayerEnd+1)
+#define STR_ItemValBegin (STR_ItemBegin)
+#define STR_ItemValON (STR_ItemValBegin + 0)
+#define STR_ItemValOFF (STR_ItemValBegin + 1)
+#define STR_ItemValYES (STR_ItemValBegin + 2)
+#define STR_ItemValNO (STR_ItemValBegin + 3)
+#define STR_ItemValCAPTIONTYPE1 (STR_ItemValBegin + 4)
+#define STR_ItemValCAPTIONTYPE2 (STR_ItemValBegin + 5)
+#define STR_ItemValCAPTIONTYPE3 (STR_ItemValBegin + 6)
+#define STR_ItemValCAPTIONTYPE4 (STR_ItemValBegin + 7)
+#define STR_ItemValCAPTIONESCHORI (STR_ItemValBegin + 8)
+#define STR_ItemValCAPTIONESCVERT (STR_ItemValBegin + 9)
+#define STR_ItemValCAPTIONESCBESTFIT (STR_ItemValBegin + 10)
+#define STR_ItemValFITTOSIZENONE (STR_ItemValBegin + 11)
+#define STR_ItemValFITTOSIZEPROP (STR_ItemValBegin + 12)
+#define STR_ItemValFITTOSIZEALLLINES (STR_ItemValBegin + 13)
+#define STR_ItemValFITTOSIZERESIZEAT (STR_ItemValBegin + 14)
+#define STR_ItemValTEXTVADJTOP (STR_ItemValBegin + 15)
+#define STR_ItemValTEXTVADJCENTER (STR_ItemValBegin + 16)
+#define STR_ItemValTEXTVADJBOTTOM (STR_ItemValBegin + 17)
+#define STR_ItemValTEXTVADJBLOCK (STR_ItemValBegin + 18)
+#define STR_ItemValTEXTVADJSTRETCH (STR_ItemValBegin + 19)
+#define STR_ItemValTEXTHADJLEFT (STR_ItemValBegin + 20)
+#define STR_ItemValTEXTHADJCENTER (STR_ItemValBegin + 21)
+#define STR_ItemValTEXTHADJRIGHT (STR_ItemValBegin + 22)
+#define STR_ItemValTEXTHADJBLOCK (STR_ItemValBegin + 23)
+#define STR_ItemValTEXTHADJSTRETCH (STR_ItemValBegin + 24)
+#define STR_ItemValTEXTANI_NONE (STR_ItemValBegin + 25)
+#define STR_ItemValTEXTANI_BLINK (STR_ItemValBegin + 26)
+#define STR_ItemValTEXTANI_SCROLL (STR_ItemValBegin + 27)
+#define STR_ItemValTEXTANI_ALTERNATE (STR_ItemValBegin + 28)
+#define STR_ItemValTEXTANI_SLIDE (STR_ItemValBegin + 29)
+#define STR_ItemValTEXTANI_LEFT (STR_ItemValBegin + 30)
+#define STR_ItemValTEXTANI_RIGHT (STR_ItemValBegin + 31)
+#define STR_ItemValTEXTANI_UP (STR_ItemValBegin + 32)
+#define STR_ItemValTEXTANI_DOWN (STR_ItemValBegin + 33)
+#define STR_ItemValEDGE_ORTHOLINES (STR_ItemValBegin + 34)
+#define STR_ItemValEDGE_THREELINES (STR_ItemValBegin + 35)
+#define STR_ItemValEDGE_ONELINE (STR_ItemValBegin + 36)
+#define STR_ItemValEDGE_BEZIER (STR_ItemValBegin + 37)
+#define STR_ItemValMEASURE_STD (STR_ItemValBegin + 38)
+#define STR_ItemValMEASURE_RADIUS (STR_ItemValBegin + 39)
+#define STR_ItemValMEASURE_TEXTHAUTO (STR_ItemValBegin + 40)
+#define STR_ItemValMEASURE_TEXTLEFTOUTSIDE (STR_ItemValBegin + 41)
+#define STR_ItemValMEASURE_TEXTINSIDE (STR_ItemValBegin + 42)
+#define STR_ItemValMEASURE_TEXTRIGHTOUTSID (STR_ItemValBegin + 43)
+#define STR_ItemValMEASURE_TEXTVAUTO (STR_ItemValBegin + 44)
+#define STR_ItemValMEASURE_ABOVE (STR_ItemValBegin + 45)
+#define STR_ItemValMEASURETEXT_BREAKEDLINE (STR_ItemValBegin + 46)
+#define STR_ItemValMEASURE_BELOW (STR_ItemValBegin + 47)
+#define STR_ItemValMEASURETEXT_VERTICALCEN (STR_ItemValBegin + 48)
+#define STR_ItemValCIRC_FULL (STR_ItemValBegin + 49)
+#define STR_ItemValCIRC_SECT (STR_ItemValBegin + 50)
+#define STR_ItemValCIRC_CUT (STR_ItemValBegin + 51)
+#define STR_ItemValCIRC_ARC (STR_ItemValBegin + 52)
+#define STR_ItemValEnd (STR_ItemValCIRC_ARC)
+
+#define STR_ItemNamBegin (STR_ItemValEnd+1)
+#define STR_ItemNam_SHADOW (STR_ItemNamBegin + 0)
+#define STR_ItemNam_SHADOWCOLOR (STR_ItemNamBegin + 1)
+#define STR_ItemNam_SHADOWXDIST (STR_ItemNamBegin + 2)
+#define STR_ItemNam_SHADOWYDIST (STR_ItemNamBegin + 3)
+#define STR_ItemNam_SHADOWTRANSPARENCE (STR_ItemNamBegin + 4)
+#define STR_ItemNam_SHADOW3D (STR_ItemNamBegin + 5)
+#define STR_ItemNam_SHADOWPERSP (STR_ItemNamBegin + 6)
+//BFS01#define STR_ItemNam_SHADOWRESERVE1 (STR_ItemNamBegin + 7)
+//BFS01#define STR_ItemNam_SHADOWRESERVE2 (STR_ItemNamBegin + 8)
+//BFS01#define STR_ItemNam_SHADOWRESERVE3 (STR_ItemNamBegin + 9)
+//BFS01#define STR_ItemNam_SHADOWRESERVE4 (STR_ItemNamBegin + 10)
+//BFS01#define STR_ItemNam_SHADOWRESERVE5 (STR_ItemNamBegin + 11)
+//BFS01#define STR_ItemNamSET_SHADOW (STR_ItemNamBegin + 12)
+#define STR_ItemNam_CAPTIONTYPE (STR_ItemNamBegin + 13)
+#define STR_ItemNam_CAPTIONFIXEDANGLE (STR_ItemNamBegin + 14)
+#define STR_ItemNam_CAPTIONANGLE (STR_ItemNamBegin + 15)
+#define STR_ItemNam_CAPTIONGAP (STR_ItemNamBegin + 16)
+#define STR_ItemNam_CAPTIONESCDIR (STR_ItemNamBegin + 17)
+#define STR_ItemNam_CAPTIONESCISREL (STR_ItemNamBegin + 18)
+#define STR_ItemNam_CAPTIONESCREL (STR_ItemNamBegin + 19)
+#define STR_ItemNam_CAPTIONESCABS (STR_ItemNamBegin + 20)
+#define STR_ItemNam_CAPTIONLINELEN (STR_ItemNamBegin + 21)
+#define STR_ItemNam_CAPTIONFITLINELEN (STR_ItemNamBegin + 22)
+//BFS01#define STR_ItemNam_CAPTIONRESERVE1 (STR_ItemNamBegin + 23)
+//BFS01#define STR_ItemNam_CAPTIONRESERVE2 (STR_ItemNamBegin + 24)
+//BFS01#define STR_ItemNam_CAPTIONRESERVE3 (STR_ItemNamBegin + 25)
+//BFS01#define STR_ItemNam_CAPTIONRESERVE4 (STR_ItemNamBegin + 26)
+//BFS01#define STR_ItemNam_CAPTIONRESERVE5 (STR_ItemNamBegin + 27)
+//BFS01#define STR_ItemNamSET_CAPTION (STR_ItemNamBegin + 28)
+//BFS01#define STR_ItemNamSET_OUTLINER (STR_ItemNamBegin + 29)
+
+#define STR_ItemNam_ECKENRADIUS (STR_ItemNamBegin + 30)
+#define STR_ItemNam_TEXT_LEFTDIST (STR_ItemNamBegin + 31)
+#define STR_ItemNam_TEXT_RIGHTDIST (STR_ItemNamBegin + 32)
+#define STR_ItemNam_TEXT_UPPERDIST (STR_ItemNamBegin + 33)
+#define STR_ItemNam_TEXT_LOWERDIST (STR_ItemNamBegin + 34)
+#define STR_ItemNam_TEXT_AUTOGROWHEIGHT (STR_ItemNamBegin + 35)
+#define STR_ItemNam_TEXT_MINFRAMEHEIGHT (STR_ItemNamBegin + 36)
+#define STR_ItemNam_TEXT_MAXFRAMEHEIGHT (STR_ItemNamBegin + 37)
+#define STR_ItemNam_TEXT_AUTOGROWWIDTH (STR_ItemNamBegin + 38)
+#define STR_ItemNam_TEXT_MINFRAMEWIDTH (STR_ItemNamBegin + 39)
+#define STR_ItemNam_TEXT_MAXFRAMEWIDTH (STR_ItemNamBegin + 40)
+#define STR_ItemNam_TEXT_VERTADJUST (STR_ItemNamBegin + 41)
+#define STR_ItemNam_TEXT_HORZADJUST (STR_ItemNamBegin + 42)
+#define STR_ItemNam_TEXT_FITTOSIZE (STR_ItemNamBegin + 43)
+#define STR_ItemNam_GRAFRED (STR_ItemNamBegin + 44)
+#define STR_ItemNam_GRAFGREEN (STR_ItemNamBegin + 45)
+#define STR_ItemNam_GRAFBLUE (STR_ItemNamBegin + 46)
+#define STR_ItemNam_GRAFLUMINANCE (STR_ItemNamBegin + 47)
+#define STR_ItemNam_GRAFCONTRAST (STR_ItemNamBegin + 48)
+#define STR_ItemNam_GRAFGAMMA (STR_ItemNamBegin + 49)
+#define STR_ItemNam_GRAFTRANSPARENCE (STR_ItemNamBegin + 50)
+#define STR_ItemNam_GRAFINVERT (STR_ItemNamBegin + 51)
+#define STR_ItemNam_GRAFMODE (STR_ItemNamBegin + 52)
+#define STR_ItemNam_GRAFRESERVE2 (STR_ItemNamBegin + 53)
+#define STR_ItemNam_GRAFRESERVE3 (STR_ItemNamBegin + 54)
+#define STR_ItemNam_GRAFRESERVE4 (STR_ItemNamBegin + 55)
+#define STR_ItemNam_GRAFRESERVE5 (STR_ItemNamBegin + 56)
+#define STR_ItemNam_GRAFRESERVE6 (STR_ItemNamBegin + 57)
+#define STR_ItemNam_RESERVE19 (STR_ItemNamBegin + 58)
+#define STR_ItemNamSET_MISC (STR_ItemNamBegin + 59)
+#define STR_ItemNam_OBJMOVEPROTECT (STR_ItemNamBegin + 60)
+#define STR_ItemNam_OBJSIZEPROTECT (STR_ItemNamBegin + 61)
+#define STR_ItemNam_OBJPRINTABLE (STR_ItemNamBegin + 62)
+#define STR_ItemNam_LAYERID (STR_ItemNamBegin + 63)
+#define STR_ItemNam_LAYERNAME (STR_ItemNamBegin + 64)
+#define STR_ItemNam_OBJECTNAME (STR_ItemNamBegin + 65)
+#define STR_ItemNam_STARTANGLE (STR_ItemNamBegin + 66)
+#define STR_ItemNam_ENDANGLE (STR_ItemNamBegin + 67)
+#define STR_ItemNam_POSITIONX (STR_ItemNamBegin + 68)
+#define STR_ItemNam_POSITIONY (STR_ItemNamBegin + 69)
+#define STR_ItemNam_SIZEWIDTH (STR_ItemNamBegin + 70)
+#define STR_ItemNam_SIZEHEIGHT (STR_ItemNamBegin + 71)
+#define STR_ItemNam_ROTATEANGLE (STR_ItemNamBegin + 72)
+#define STR_ItemNam_SHEARANGLE (STR_ItemNamBegin + 73)
+#define STR_ItemNamEnd (STR_ItemNam_SHEARANGLE)
+#define STR_ItemEnd STR_ItemNamEnd
+
+// 64 Resource-Id's reserviert fuer kompatible Erweiterungen
+//BFS06#define STR_SvDraw_CacheReserve_Begin (STR_ItemEnd+1)
+//BFS06#define STR_SvDraw_CacheReserve_End (STR_SvDraw_CacheReserve_Begin+63)
+//BFS06#define SDR_StringCacheEnd (STR_SvDraw_CacheReserve_Begin-1)
+
+//BFS06#define STR_ErrorBegin (STR_SvDraw_CacheReserve_End+1)
+//BFS06#define STR_ErrorBegin (STR_ItemEnd+1)
+//BFS06#define STR_SvDraw_ErrorReserve_Begin (STR_ErrorBegin + 2)
+// hier ist Platz fuer 30 Eintraege
+//BFS06#define STR_SvDraw_ErrorReserve_End (STR_SvDraw_ErrorReserve_Begin + 29)
+//BFS06#define STR_ErrorEnd STR_SvDraw_ErrorReserve_End
+//BFS06#define STR_ErrorEnd (STR_ErrorBegin + 2)
+
+// 22-05-98: 2 Eintraege fuer die Bitmaps von der StrErrorReserve abgeknapst
+//BFS06#define BMAP_Begin (STR_ErrorEnd+1)
+#define BMAP_Begin (STR_ItemEnd+1)
+#define BMAP_GrafikEi (BMAP_Begin +0)
+#define BMAP_GrafikDe (BMAP_Begin +1)
+#define BMAP_End (BMAP_GrafikDe)
+
+// Strings fuer den Vorlagen-Dialog
+#define SIP_Begin (BMAP_End)
+
+#define SIP_UNKNOWN_ATTR (SIP_Begin + 0)
+#define SIP_XA_LINESTYLE (SIP_Begin + 1)
+#define SIP_XA_LINEDASH (SIP_Begin + 2)
+#define SIP_XA_LINEWIDTH (SIP_Begin + 3)
+#define SIP_XA_LINECOLOR (SIP_Begin + 4)
+#define SIP_XA_LINESTART (SIP_Begin + 5)
+#define SIP_XA_LINEEND (SIP_Begin + 6)
+#define SIP_XA_LINESTARTWIDTH (SIP_Begin + 7)
+#define SIP_XA_LINEENDWIDTH (SIP_Begin + 8)
+#define SIP_XA_LINESTARTCENTER (SIP_Begin + 9)
+#define SIP_XA_LINEENDCENTER (SIP_Begin + 10)
+#define SIP_XA_LINETRANSPARENCE (SIP_Begin + 11)
+#define SIP_XA_LINEJOINT (SIP_Begin + 12)
+#define SIP_XA_LINERESERVED2 (SIP_Begin + 13)
+#define SIP_XA_LINERESERVED3 (SIP_Begin + 14)
+#define SIP_XA_LINERESERVED4 (SIP_Begin + 15)
+#define SIP_XA_LINERESERVED5 (SIP_Begin + 16)
+#define SIP_XA_LINERESERVED_LAST (SIP_Begin + 17)
+#define SIP_XATTRSET_LINE (SIP_Begin + 18)
+#define SIP_XA_FILLSTYLE (SIP_Begin + 19)
+#define SIP_XA_FILLCOLOR (SIP_Begin + 20)
+#define SIP_XA_FILLGRADIENT (SIP_Begin + 21)
+#define SIP_XA_FILLHATCH (SIP_Begin + 22)
+#define SIP_XA_FILLBITMAP (SIP_Begin + 23)
+#define SIP_XA_FILLTRANSPARENCE (SIP_Begin + 24)
+#define SIP_XA_GRADIENTSTEPCOUNT (SIP_Begin + 25)
+#define SIP_XA_FILLBMP_TILE (SIP_Begin + 26)
+#define SIP_XA_FILLBMP_POS (SIP_Begin + 27)
+#define SIP_XA_FILLBMP_SIZEX (SIP_Begin + 28)
+#define SIP_XA_FILLBMP_SIZEY (SIP_Begin + 29)
+#define SIP_XA_FILLFLOATTRANSPARENCE (SIP_Begin + 30)
+#define SIP_XA_SECONDARYFILLCOLOR (SIP_Begin + 31)
+#define SIP_XA_FILLBMP_SIZELOG (SIP_Begin + 32)
+#define SIP_XA_FILLBMP_TILEOFFSETX (SIP_Begin + 33)
+#define SIP_XA_FILLBMP_TILEOFFSETY (SIP_Begin + 34)
+#define SIP_XA_FILLBMP_STRETCH (SIP_Begin + 35)
+#define SIP_XA_FILLRESERVED3 (SIP_Begin + 36)
+#define SIP_XA_FILLRESERVED4 (SIP_Begin + 37)
+#define SIP_XA_FILLRESERVED5 (SIP_Begin + 38)
+#define SIP_XA_FILLRESERVED6 (SIP_Begin + 39)
+#define SIP_XA_FILLRESERVED7 (SIP_Begin + 40)
+#define SIP_XA_FILLRESERVED8 (SIP_Begin + 41)
+#define SIP_XA_FILLBMP_POSOFFSETX (SIP_Begin + 42)
+#define SIP_XA_FILLBMP_POSOFFSETY (SIP_Begin + 43)
+#define SIP_XA_FILLBACKGROUND (SIP_Begin + 44)
+#define SIP_XA_FILLRESERVED10 (SIP_Begin + 45)
+#define SIP_XA_FILLRESERVED11 (SIP_Begin + 46)
+#define SIP_XA_FILLRESERVED_LAST (SIP_Begin + 47)
+#define SIP_XATTRSET_FILL (SIP_Begin + 48)
+#define SIP_XA_FORMTXTSTYLE (SIP_Begin + 49)
+#define SIP_XA_FORMTXTADJUST (SIP_Begin + 50)
+#define SIP_XA_FORMTXTDISTANCE (SIP_Begin + 51)
+#define SIP_XA_FORMTXTSTART (SIP_Begin + 52)
+#define SIP_XA_FORMTXTMIRROR (SIP_Begin + 53)
+#define SIP_XA_FORMTXTOUTLINE (SIP_Begin + 54)
+#define SIP_XA_FORMTXTSHADOW (SIP_Begin + 55)
+#define SIP_XA_FORMTXTSHDWCOLOR (SIP_Begin + 56)
+#define SIP_XA_FORMTXTSHDWXVAL (SIP_Begin + 57)
+#define SIP_XA_FORMTXTSHDWYVAL (SIP_Begin + 58)
+#define SIP_XA_FORMTXTSTDFORM (SIP_Begin + 59)
+#define SIP_XA_FORMTXTHIDEFORM (SIP_Begin + 60)
+#define SIP_XA_FORMTXTSHDWTRANSP (SIP_Begin + 61)
+#define SIP_XA_FTRESERVED2 (SIP_Begin + 62)
+#define SIP_XA_FTRESERVED3 (SIP_Begin + 63)
+#define SIP_XA_FTRESERVED4 (SIP_Begin + 64)
+#define SIP_XA_FTRESERVED5 (SIP_Begin + 65)
+#define SIP_XA_FTRESERVED_LAST (SIP_Begin + 66)
+//BFS01#define SIP_XATTRSET_TEXT (SIP_Begin + 67)
+#define SIP_SA_SHADOW (SIP_Begin + 68)
+#define SIP_SA_SHADOWCOLOR (SIP_Begin + 69)
+#define SIP_SA_SHADOWXDIST (SIP_Begin + 70)
+#define SIP_SA_SHADOWYDIST (SIP_Begin + 71)
+#define SIP_SA_SHADOWTRANSPARENCE (SIP_Begin + 72)
+#define SIP_SA_SHADOW3D (SIP_Begin + 73)
+#define SIP_SA_SHADOWPERSP (SIP_Begin + 74)
+//BFS01#define SIP_SA_SHADOWRESERVE1 (SIP_Begin + 75)
+//BFS01#define SIP_SA_SHADOWRESERVE2 (SIP_Begin + 76)
+//BFS01#define SIP_SA_SHADOWRESERVE3 (SIP_Begin + 77)
+//BFS01#define SIP_SA_SHADOWRESERVE4 (SIP_Begin + 78)
+//BFS01#define SIP_SA_SHADOWRESERVE5 (SIP_Begin + 79)
+//BFS01#define SIP_SDRATTRSET_SHADOW (SIP_Begin + 80)
+#define SIP_SA_CAPTIONTYPE (SIP_Begin + 81)
+#define SIP_SA_CAPTIONFIXEDANGLE (SIP_Begin + 82)
+#define SIP_SA_CAPTIONANGLE (SIP_Begin + 83)
+#define SIP_SA_CAPTIONGAP (SIP_Begin + 84)
+#define SIP_SA_CAPTIONESCDIR (SIP_Begin + 85)
+#define SIP_SA_CAPTIONESCISREL (SIP_Begin + 86)
+#define SIP_SA_CAPTIONESCREL (SIP_Begin + 87)
+#define SIP_SA_CAPTIONESCABS (SIP_Begin + 88)
+#define SIP_SA_CAPTIONLINELEN (SIP_Begin + 89)
+#define SIP_SA_CAPTIONFITLINELEN (SIP_Begin + 90)
+//BFS01#define SIP_SA_CAPTIONRESERVE1 (SIP_Begin + 91)
+//BFS01#define SIP_SA_CAPTIONRESERVE2 (SIP_Begin + 92)
+//BFS01#define SIP_SA_CAPTIONRESERVE3 (SIP_Begin + 93)
+//BFS01#define SIP_SA_CAPTIONRESERVE4 (SIP_Begin + 94)
+//BFS01#define SIP_SA_CAPTIONRESERVE5 (SIP_Begin + 95)
+//BFS01#define SIP_SDRATTRSET_CAPTION (SIP_Begin + 96)
+//BFS01#define SIP_SDRATTRSET_OUTLINER (SIP_Begin + 97)
+#define SIP_SA_ECKENRADIUS (SIP_Begin + 98)
+#define SIP_SA_TEXT_MINFRAMEHEIGHT (SIP_Begin + 99)
+#define SIP_SA_TEXT_AUTOGROWHEIGHT (SIP_Begin + 100)
+#define SIP_SA_TEXT_FITTOSIZE (SIP_Begin + 101)
+#define SIP_SA_TEXT_LEFTDIST (SIP_Begin + 102)
+#define SIP_SA_TEXT_RIGHTDIST (SIP_Begin + 103)
+#define SIP_SA_TEXT_UPPERDIST (SIP_Begin + 104)
+#define SIP_SA_TEXT_LOWERDIST (SIP_Begin + 105)
+#define SIP_SA_TEXT_VERTADJUST (SIP_Begin + 106)
+#define SIP_SA_TEXT_MAXFRAMEHEIGHT (SIP_Begin + 107)
+#define SIP_SA_TEXT_MINFRAMEWIDTH (SIP_Begin + 108)
+#define SIP_SA_TEXT_MAXFRAMEWIDTH (SIP_Begin + 109)
+#define SIP_SA_TEXT_AUTOGROWWIDTH (SIP_Begin + 110)
+#define SIP_SA_TEXT_HORZADJUST (SIP_Begin + 111)
+#define SIP_SA_TEXT_ANIKIND (SIP_Begin + 112)
+#define SIP_SA_TEXT_ANIDIRECTION (SIP_Begin + 113)
+#define SIP_SA_TEXT_ANISTARTINSIDE (SIP_Begin + 114)
+#define SIP_SA_TEXT_ANISTOPINSIDE (SIP_Begin + 115)
+#define SIP_SA_TEXT_ANICOUNT (SIP_Begin + 116)
+#define SIP_SA_TEXT_ANIDELAY (SIP_Begin + 117)
+#define SIP_SA_TEXT_ANIAMOUNT (SIP_Begin + 118)
+#define SIP_SA_TEXT_CONTOURFRAME (SIP_Begin + 119)
+#define SIP_SA_CUSTOMSHAPE_ADJUSTMENT (SIP_Begin + 120)
+#define SIP_SA_XMLATTRIBUTES (SIP_Begin + 121)
+#define SIP_SA_TEXT_USEFIXEDCELLHEIGHT (SIP_Begin + 122)
+#define SIP_SA_WORDWRAP (SIP_Begin + 123)
+#define SIP_SA_AUTOGROWSIZE (SIP_Begin + 124)
+#define SIP_SA_RESERVE18 (SIP_Begin + 125)
+#define SIP_SA_RESERVE19 (SIP_Begin + 126)
+//BFS01#define SIP_SDRATTRSET_MISC (SIP_Begin + 127)
+#define SIP_SA_EDGEKIND (SIP_Begin + 128)
+#define SIP_SA_EDGENODE1HORZDIST (SIP_Begin + 129)
+#define SIP_SA_EDGENODE1VERTDIST (SIP_Begin + 130)
+#define SIP_SA_EDGENODE2HORZDIST (SIP_Begin + 131)
+#define SIP_SA_EDGENODE2VERTDIST (SIP_Begin + 132)
+#define SIP_SA_EDGENODE1GLUEDIST (SIP_Begin + 133)
+#define SIP_SA_EDGENODE2GLUEDIST (SIP_Begin + 134)
+#define SIP_SA_EDGELINEDELTAANZ (SIP_Begin + 135)
+#define SIP_SA_EDGELINE1DELTA (SIP_Begin + 136)
+#define SIP_SA_EDGELINE2DELTA (SIP_Begin + 137)
+#define SIP_SA_EDGELINE3DELTA (SIP_Begin + 138)
+//BFS01#define SIP_SA_EDGERESERVE02 (SIP_Begin + 139)
+//BFS01#define SIP_SA_EDGERESERVE03 (SIP_Begin + 140)
+//BFS01#define SIP_SA_EDGERESERVE04 (SIP_Begin + 141)
+//BFS01#define SIP_SA_EDGERESERVE05 (SIP_Begin + 142)
+//BFS01#define SIP_SA_EDGERESERVE06 (SIP_Begin + 143)
+//BFS01#define SIP_SA_EDGERESERVE07 (SIP_Begin + 144)
+//BFS01#define SIP_SA_EDGERESERVE08 (SIP_Begin + 145)
+//BFS01#define SIP_SA_EDGERESERVE09 (SIP_Begin + 146)
+//BFS01#define SIP_SDRATTRSET_EDGE (SIP_Begin + 147)
+#define SIP_SA_MEASUREKIND (SIP_Begin + 148)
+#define SIP_SA_MEASURETEXTHPOS (SIP_Begin + 149)
+#define SIP_SA_MEASURETEXTVPOS (SIP_Begin + 150)
+#define SIP_SA_MEASURELINEDIST (SIP_Begin + 151)
+#define SIP_SA_MEASUREHELPLINEOVERHANG (SIP_Begin + 152)
+#define SIP_SA_MEASUREHELPLINEDIST (SIP_Begin + 153)
+#define SIP_SA_MEASUREHELPLINE1LEN (SIP_Begin + 154)
+#define SIP_SA_MEASUREHELPLINE2LEN (SIP_Begin + 155)
+#define SIP_SA_MEASUREBELOWREFEDGE (SIP_Begin + 156)
+#define SIP_SA_MEASURETEXTROTA90 (SIP_Begin + 157)
+#define SIP_SA_MEASURETEXTUPSIDEDOWN (SIP_Begin + 158)
+#define SIP_SA_MEASUREOVERHANG (SIP_Begin + 159)
+#define SIP_SA_MEASUREUNIT (SIP_Begin + 160)
+#define SIP_SA_MEASURESCALE (SIP_Begin + 161)
+#define SIP_SA_MEASURESHOWUNIT (SIP_Begin + 162)
+#define SIP_SA_MEASUREFORMATSTRING (SIP_Begin + 163)
+#define SIP_SA_MEASURETEXTAUTOANGLE (SIP_Begin + 164)
+#define SIP_SA_MEASURETEXTAUTOANGLEVIEW (SIP_Begin + 165)
+#define SIP_SA_MEASURETEXTISFIXEDANGLE (SIP_Begin + 166)
+#define SIP_SA_MEASURETEXTFIXEDANGLE (SIP_Begin + 167)
+#define SIP_SA_MEASUREDECIMALPLACES (SIP_Begin + 168)
+#define SIP_SA_MEASURERESERVE05 (SIP_Begin + 169)
+#define SIP_SA_MEASURERESERVE06 (SIP_Begin + 170)
+#define SIP_SA_MEASURERESERVE07 (SIP_Begin + 171)
+//BFS01#define SIP_SDRATTRSET_MEASURE (SIP_Begin + 172)
+#define SIP_SA_CIRCKIND (SIP_Begin + 173)
+#define SIP_SA_CIRCSTARTANGLE (SIP_Begin + 174)
+#define SIP_SA_CIRCENDANGLE (SIP_Begin + 175)
+#define SIP_SA_CIRCRESERVE0 (SIP_Begin + 176)
+#define SIP_SA_CIRCRESERVE1 (SIP_Begin + 177)
+#define SIP_SA_CIRCRESERVE2 (SIP_Begin + 178)
+#define SIP_SA_CIRCRESERVE3 (SIP_Begin + 179)
+#define SIP_SA_OBJVISIBLE (SIP_Begin + 180)
+#define SIP_SA_OBJMOVEPROTECT (SIP_Begin + 181)
+#define SIP_SA_OBJSIZEPROTECT (SIP_Begin + 182)
+#define SIP_SA_OBJPRINTABLE (SIP_Begin + 183)
+#define SIP_SA_LAYERID (SIP_Begin + 184)
+#define SIP_SA_LAYERNAME (SIP_Begin + 185)
+#define SIP_SA_OBJECTNAME (SIP_Begin + 186)
+#define SIP_SA_ALLPOSITIONX (SIP_Begin + 187)
+#define SIP_SA_ALLPOSITIONY (SIP_Begin + 188)
+#define SIP_SA_ALLSIZEWIDTH (SIP_Begin + 189)
+#define SIP_SA_ALLSIZEHEIGHT (SIP_Begin + 190)
+#define SIP_SA_ONEPOSITIONX (SIP_Begin + 191)
+#define SIP_SA_ONEPOSITIONY (SIP_Begin + 192)
+#define SIP_SA_ONESIZEWIDTH (SIP_Begin + 193)
+#define SIP_SA_ONESIZEHEIGHT (SIP_Begin + 194)
+#define SIP_SA_LOGICSIZEWIDTH (SIP_Begin + 195)
+#define SIP_SA_LOGICSIZEHEIGHT (SIP_Begin + 196)
+#define SIP_SA_ROTATEANGLE (SIP_Begin + 197)
+#define SIP_SA_SHEARANGLE (SIP_Begin + 198)
+#define SIP_SA_MOVEX (SIP_Begin + 199)
+#define SIP_SA_MOVEY (SIP_Begin + 200)
+#define SIP_SA_RESIZEXONE (SIP_Begin + 201)
+#define SIP_SA_RESIZEYONE (SIP_Begin + 202)
+#define SIP_SA_ROTATEONE (SIP_Begin + 203)
+#define SIP_SA_HORZSHEARONE (SIP_Begin + 204)
+#define SIP_SA_VERTSHEARONE (SIP_Begin + 205)
+#define SIP_SA_RESIZEXALL (SIP_Begin + 206)
+#define SIP_SA_RESIZEYALL (SIP_Begin + 207)
+#define SIP_SA_ROTATEALL (SIP_Begin + 208)
+#define SIP_SA_HORZSHEARALL (SIP_Begin + 209)
+#define SIP_SA_VERTSHEARALL (SIP_Begin + 210)
+#define SIP_SA_TRANSFORMREF1X (SIP_Begin + 211)
+#define SIP_SA_TRANSFORMREF1Y (SIP_Begin + 212)
+#define SIP_SA_TRANSFORMREF2X (SIP_Begin + 213)
+#define SIP_SA_TRANSFORMREF2Y (SIP_Begin + 214)
+#define SIP_EE_PARA_HYPHENATE (SIP_Begin + 215)
+#define SIP_EE_PARA_BULLETSTATE (SIP_Begin + 216)
+#define SIP_EE_PARA_OUTLLRSPACE (SIP_Begin + 217)
+#define SIP_EE_PARA_OUTLLEVEL (SIP_Begin + 218)
+#define SIP_EE_PARA_BULLET (SIP_Begin + 219)
+#define SIP_EE_PARA_LRSPACE (SIP_Begin + 220)
+#define SIP_EE_PARA_ULSPACE (SIP_Begin + 221)
+#define SIP_EE_PARA_SBL (SIP_Begin + 222)
+#define SIP_EE_PARA_JUST (SIP_Begin + 223)
+#define SIP_EE_PARA_TABS (SIP_Begin + 224)
+#define SIP_EE_CHAR_COLOR (SIP_Begin + 225)
+#define SIP_EE_CHAR_FONTINFO (SIP_Begin + 226)
+#define SIP_EE_CHAR_FONTHEIGHT (SIP_Begin + 227)
+#define SIP_EE_CHAR_FONTWIDTH (SIP_Begin + 228)
+#define SIP_EE_CHAR_WEIGHT (SIP_Begin + 229)
+#define SIP_EE_CHAR_UNDERLINE (SIP_Begin + 230)
+#define SIP_EE_CHAR_OVERLINE (SIP_Begin + 231)
+#define SIP_EE_CHAR_STRIKEOUT (SIP_Begin + 232)
+#define SIP_EE_CHAR_ITALIC (SIP_Begin + 233)
+#define SIP_EE_CHAR_OUTLINE (SIP_Begin + 234)
+#define SIP_EE_CHAR_SHADOW (SIP_Begin + 235)
+#define SIP_EE_CHAR_ESCAPEMENT (SIP_Begin + 236)
+#define SIP_EE_CHAR_PAIRKERNING (SIP_Begin + 237)
+#define SIP_EE_CHAR_KERNING (SIP_Begin + 238)
+#define SIP_EE_CHAR_WLM (SIP_Begin + 239)
+#define SIP_EE_FEATURE_TAB (SIP_Begin + 240)
+#define SIP_EE_FEATURE_LINEBR (SIP_Begin + 241)
+#define SIP_EE_FEATURE_NOTCONV (SIP_Begin + 242)
+#define SIP_EE_FEATURE_FIELD (SIP_Begin + 243)
+
+#define SIP_SA_GRAFRED (SIP_Begin + 244)
+#define SIP_SA_GRAFGREEN (SIP_Begin + 245)
+#define SIP_SA_GRAFBLUE (SIP_Begin + 246)
+#define SIP_SA_GRAFLUMINANCE (SIP_Begin + 247)
+#define SIP_SA_GRAFCONTRAST (SIP_Begin + 248)
+#define SIP_SA_GRAFGAMMA (SIP_Begin + 249)
+#define SIP_SA_GRAFTRANSPARENCE (SIP_Begin + 250)
+#define SIP_SA_GRAFINVERT (SIP_Begin + 251)
+#define SIP_SA_GRAFMODE (SIP_Begin + 252)
+#define SIP_SA_GRAFCROP (SIP_Begin + 253)
+#define SIP_SA_GRAFRESERVE3 (SIP_Begin + 254)
+#define SIP_SA_GRAFRESERVE4 (SIP_Begin + 255)
+#define SIP_SA_GRAFRESERVE5 (SIP_Begin + 256)
+#define SIP_SA_GRAFRESERVE6 (SIP_Begin + 257)
+//BFS01#define SIP_SDRATTRSET_GRAF (SIP_Begin + 258)
+
+#define SIP_SA_MARKERS (SIP_Begin + 258)
+#define SIP_SA_PAGESHADOW35X35 (SIP_Begin + 259)
+#define SIP_SA_FINE_MARKERS (SIP_Begin + 260)
+
+// #100499#
+#define BMP_SVXOLEOBJ (SIP_Begin + 261)
+
+// #101928#
+#define SIP_SA_ACCESSIBILITY_MARKERS (SIP_Begin + 262)
+
+#define STR_TABLE_ATTR (SIP_Begin + 263)
+#define STR_TABLE_AUTOFMT (SIP_Begin + 264)
+#define STR_TABLE_INSCOL (SIP_Begin + 265)
+#define STR_TABLE_INSROW (SIP_Begin + 266)
+#define STR_UNDO_COL_DELETE (SIP_Begin + 267)
+#define STR_UNDO_ROW_DELETE (SIP_Begin + 268)
+#define STR_TABLE_SPLIT (SIP_Begin + 269)
+#define STR_TABLE_MERGE (SIP_Begin + 270)
+#define STR_TABLE_NUMFORMAT (SIP_Begin + 271)
+#define STR_TABLE_DISTRIBUTE_ROWS (SIP_Begin + 272)
+#define STR_TABLE_DISTRIBUTE_COLUMNS (SIP_Begin + 273)
+#define STR_TABLE_STYLE (SIP_Begin + 274)
+#define STR_TABLE_STYLE_SETTINGS (SIP_Begin + 275)
+#define SIP_SA_CROP_MARKERS (SIP_Begin + 276)
+#define SIP_SA_CROP_FINE_MARKERS (SIP_Begin + 277)
+#define SIP_SA_ACCESSIBILITY_CROP_MARKERS (SIP_Begin + 278)
+
+#define SIP_End (SIP_SA_ACCESSIBILITY_CROP_MARKERS)
+
+#define SDR_ResourceEnd (SIP_End)
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
diff --git a/svx/inc/svx/svdtext.hxx b/svx/inc/svx/svdtext.hxx
new file mode 100644
index 000000000000..f7bc7c72fcbc
--- /dev/null
+++ b/svx/inc/svx/svdtext.hxx
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDTEXT_HXX
+#define _SVDTEXT_HXX
+
+#include <sal/types.h>
+#include "svx/svxdllapi.h"
+#include <tools/weakbase.hxx>
+
+// --------------------------------------------------------------------
+
+class OutlinerParaObject;
+class SdrOutliner;
+class SdrTextObj;
+class SdrModel;
+class SfxItemSet;
+
+namespace sdr { namespace properties {
+ class TextProperties;
+}}
+
+/** This class stores information about one text inside a shape.
+*/
+
+class SVX_DLLPUBLIC SdrText : public tools::WeakBase< SdrText >
+{
+public:
+ SdrText( SdrTextObj& rObject, OutlinerParaObject* pOutlinerParaObject = 0 );
+ virtual ~SdrText();
+
+ virtual void SetModel(SdrModel* pNewModel);
+ virtual void ForceOutlinerParaObject( sal_uInt16 nOutlMode );
+
+ virtual void SetOutlinerParaObject( OutlinerParaObject* pTextObject );
+ virtual OutlinerParaObject* GetOutlinerParaObject() const;
+
+ virtual void CheckPortionInfo( SdrOutliner& rOutliner );
+ virtual void ReformatText();
+
+ // default uses GetObjectItemSet, but may be overloaded to
+ // return a text-specific ItemSet
+ virtual const SfxItemSet& GetItemSet() const;
+
+ SdrModel* GetModel() const { return mpModel; }
+ SdrTextObj& GetObject() const { return mrObject; }
+
+ /** returns the current OutlinerParaObject and removes it from this instance */
+ OutlinerParaObject* RemoveOutlinerParaObject();
+
+protected:
+ virtual const SfxItemSet& GetObjectItemSet();
+ virtual void SetObjectItem(const SfxPoolItem& rItem);
+ virtual SfxStyleSheet* GetStyleSheet() const;
+
+private:
+ OutlinerParaObject* mpOutlinerParaObject;
+ SdrTextObj& mrObject;
+ SdrModel* mpModel;
+ bool mbPortionInfoChecked;
+};
+
+#endif //_SVDTEXT_HXX
+
diff --git a/svx/inc/svx/svdtrans.hxx b/svx/inc/svx/svdtrans.hxx
new file mode 100644
index 000000000000..d1cc076fe824
--- /dev/null
+++ b/svx/inc/svx/svdtrans.hxx
@@ -0,0 +1,326 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDTRANS_HXX
+#define _SVDTRANS_HXX
+
+#include <tools/gen.hxx>
+#include <tools/poly.hxx>
+#include <tools/fract.hxx>
+
+#ifndef _MAPMOD_HXX //autogen
+#include <vcl/mapmod.hxx>
+#endif
+#include <tools/string.hxx>
+#include "svx/svxdllapi.h"
+
+#include <vcl/field.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+// Winkelangaben der DrawingEngine sind 1/100 Degree
+// #i19054# nowhere used, removed // const int nWinkDiv=100;
+// Um Winkel der DrawingEngine mit den Trigonometrischen Funktionen
+// verarbeiten zu koennen, muessen sie zunaest ins Bogenmass umgerechnet
+// werden. Dies gestaltet sich recht einfach mit der folgenden Konstanten
+// nPi180. Sei nWink ein Winkel in 1/100 Deg so schreibt man z.B.:
+// double nSin=sin(nWink*nPi180);
+// Rueckwandlung entsprechend durch Teilen.
+const double nPi=3.14159265358979323846;
+const double nPi180=0.000174532925199432957692222; // Bei zuweing Stellen ist tan(4500*nPi180)!=1.0
+
+// Der maximale Shearwinkel
+#define SDRMAXSHEAR 8900
+
+class XPolygon;
+class XPolyPolygon;
+
+inline long Round(double a) { return a>0.0 ? (long)(a+0.5) : -(long)((-a)+0.5); }
+
+inline void MoveRect(Rectangle& rRect, const Size& S) { rRect.Move(S.Width(),S.Height()); }
+inline void MovePoint(Point& rPnt, const Size& S) { rPnt.X()+=S.Width(); rPnt.Y()+=S.Height(); }
+inline void MovePoly(Polygon& rPoly, const Size& S) { rPoly.Move(S.Width(),S.Height()); }
+inline void MovePoly(PolyPolygon& rPoly, const Size& S) { rPoly.Move(S.Width(),S.Height()); }
+void MoveXPoly(XPolygon& rPoly, const Size& S);
+void MoveXPoly(XPolyPolygon& rPoly, const Size& S);
+
+SVX_DLLPUBLIC void ResizeRect(Rectangle& rRect, const Point& rRef, const Fraction& xFact, const Fraction& yFact, FASTBOOL bNoJustify=sal_False);
+inline void ResizePoint(Point& rPnt, const Point& rRef, Fraction xFact, Fraction yFact);
+void ResizePoly(Polygon& rPoly, const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+void ResizeXPoly(XPolygon& rPoly, const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+void ResizePoly(PolyPolygon& rPoly, const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+void ResizeXPoly(XPolyPolygon& rPoly, const Point& rRef, const Fraction& xFact, const Fraction& yFact);
+
+inline void RotatePoint(Point& rPnt, const Point& rRef, double sn, double cs);
+SVX_DLLPUBLIC void RotatePoly(Polygon& rPoly, const Point& rRef, double sn, double cs);
+void RotateXPoly(XPolygon& rPoly, const Point& rRef, double sn, double cs);
+void RotatePoly(PolyPolygon& rPoly, const Point& rRef, double sn, double cs);
+void RotateXPoly(XPolyPolygon& rPoly, const Point& rRef, double sn, double cs);
+
+// MirrorRect macht nur Sinn bei Spiegelachsen
+// mit einem durch 45 Degree teilbaren Winkel!
+void MirrorRect(Rectangle& rRect, const Point& rRef1, const Point& rRef2, FASTBOOL bNoJustify); // ni.
+void MirrorPoint(Point& rPnt, const Point& rRef1, const Point& rRef2);
+void MirrorPoly(Polygon& rPoly, const Point& rRef1, const Point& rRef2);
+void MirrorXPoly(XPolygon& rPoly, const Point& rRef1, const Point& rRef2);
+void MirrorPoly(PolyPolygon& rPoly, const Point& rRef1, const Point& rRef2);
+void MirrorXPoly(XPolyPolygon& rPoly, const Point& rRef1, const Point& rRef2);
+
+inline void ShearPoint(Point& rPnt, const Point& rRef, double tn, FASTBOOL bVShear=sal_False);
+SVX_DLLPUBLIC void ShearPoly(Polygon& rPoly, const Point& rRef, double tn, FASTBOOL bVShear=sal_False);
+void ShearXPoly(XPolygon& rPoly, const Point& rRef, double tn, FASTBOOL bVShear=sal_False);
+void ShearPoly(PolyPolygon& rPoly, const Point& rRef, double tn, FASTBOOL bVShear=sal_False);
+void ShearXPoly(XPolyPolygon& rPoly, const Point& rRef, double tn, FASTBOOL bVShear=sal_False);
+
+// rPnt.X bzw rPnt.Y wird auf rCenter.X bzw. rCenter.Y gesetzt!
+// anschliessend muss rPnt nur noch um rCenter gedreht werden.
+// Der Rueckgabewinkel ist ausnahmsweise in Rad.
+inline double GetCrookAngle(Point& rPnt, const Point& rCenter, const Point& rRad, FASTBOOL bVertical);
+// Die folgenden Methoden behandeln einen Punkt eines XPolygons, wobei die
+// benachbarten Kontrollpunkte des eigentlichen Punktes ggf. in pC1/pC2
+// uebergeben werden. Ueber rSin/rCos wird gleichzeitig sin(nWink) und cos(nWink)
+// zurueckgegeben.
+// Der Rueckgabewinkel ist hier ebenfalls in Rad.
+double CrookRotateXPoint(Point& rPnt, Point* pC1, Point* pC2, const Point& rCenter,
+ const Point& rRad, double& rSin, double& rCos, FASTBOOL bVert);
+double CrookSlantXPoint(Point& rPnt, Point* pC1, Point* pC2, const Point& rCenter,
+ const Point& rRad, double& rSin, double& rCos, FASTBOOL bVert);
+double CrookStretchXPoint(Point& rPnt, Point* pC1, Point* pC2, const Point& rCenter,
+ const Point& rRad, double& rSin, double& rCos, FASTBOOL bVert,
+ const Rectangle rRefRect);
+
+void CrookRotatePoly(XPolygon& rPoly, const Point& rCenter, const Point& rRad, FASTBOOL bVert);
+void CrookSlantPoly(XPolygon& rPoly, const Point& rCenter, const Point& rRad, FASTBOOL bVert);
+void CrookStretchPoly(XPolygon& rPoly, const Point& rCenter, const Point& rRad, FASTBOOL bVert, const Rectangle rRefRect);
+
+void CrookRotatePoly(XPolyPolygon& rPoly, const Point& rCenter, const Point& rRad, FASTBOOL bVert);
+void CrookSlantPoly(XPolyPolygon& rPoly, const Point& rCenter, const Point& rRad, FASTBOOL bVert);
+void CrookStretchPoly(XPolyPolygon& rPoly, const Point& rCenter, const Point& rRad, FASTBOOL bVert, const Rectangle rRefRect);
+
+/**************************************************************************************************/
+/* Inline */
+/**************************************************************************************************/
+
+inline void ResizePoint(Point& rPnt, const Point& rRef, Fraction xFact, Fraction yFact)
+{
+ if (xFact.GetDenominator()==0) xFact=Fraction(xFact.GetNumerator(),1); // DivZero abfangen
+ if (yFact.GetDenominator()==0) yFact=Fraction(yFact.GetNumerator(),1); // DivZero abfangen
+ rPnt.X()=rRef.X()+ Round(((double)(rPnt.X()-rRef.X())*xFact.GetNumerator())/xFact.GetDenominator());
+ rPnt.Y()=rRef.Y()+ Round(((double)(rPnt.Y()-rRef.Y())*yFact.GetNumerator())/yFact.GetDenominator());
+}
+
+inline void RotatePoint(Point& rPnt, const Point& rRef, double sn, double cs)
+{
+ long dx=rPnt.X()-rRef.X();
+ long dy=rPnt.Y()-rRef.Y();
+ rPnt.X()=Round(rRef.X()+dx*cs+dy*sn);
+ rPnt.Y()=Round(rRef.Y()+dy*cs-dx*sn);
+}
+
+inline void ShearPoint(Point& rPnt, const Point& rRef, double tn, FASTBOOL bVShear)
+{
+ if (!bVShear) { // Horizontal
+ if (rPnt.Y()!=rRef.Y()) { // sonst nicht noetig
+ rPnt.X()-=Round((rPnt.Y()-rRef.Y())*tn);
+ }
+ } else { // ansonsten vertikal
+ if (rPnt.X()!=rRef.X()) { // sonst nicht noetig
+ rPnt.Y()-=Round((rPnt.X()-rRef.X())*tn);
+ }
+ }
+}
+
+inline double GetCrookAngle(Point& rPnt, const Point& rCenter, const Point& rRad, FASTBOOL bVertical)
+{
+ double nWink;
+ if (bVertical) {
+ long dy=rPnt.Y()-rCenter.Y();
+ nWink=(double)dy/(double)rRad.Y();
+ rPnt.Y()=rCenter.Y();
+ } else {
+ long dx=rCenter.X()-rPnt.X();
+ nWink=(double)dx/(double)rRad.X();
+ rPnt.X()=rCenter.X();
+ }
+ return nWink;
+}
+
+/**************************************************************************************************/
+/**************************************************************************************************/
+
+// Y-Achse zeigt nach unten! Die Funktion negiert bei der
+// Winkelberechnung die Y-Achse, sodass GetAngle(Point(0,-1))=90.00deg.
+// GetAngle(Point(0,0)) liefert 0.
+// Der Rueckgabewert liegt im Bereich -180.00..179.99 Degree und
+// ist in 1/100 Degree angegeben.
+SVX_DLLPUBLIC long GetAngle(const Point& rPnt);
+long NormAngle180(long a); // Winkel normalisieren auf -180.00..179.99
+SVX_DLLPUBLIC long NormAngle360(long a); // Winkel normalisieren auf 0.00..359.99
+sal_uInt16 GetAngleSector(long nWink); // Sektor im kartesischen Koordinatensystem bestimmen
+// Berechnet die Laenge von (0,0) via a^2 + b^2 = c^2
+// Zur Vermeidung von Ueberlaeufen werden ggf. einige Stellen ignoriert.
+long GetLen(const Point& rPnt);
+
+/*
+ Transformation eines Rechtecks in ein Polygon unter ------------
+ Anwendung der Winkelparameter aus GeoStat. /1 2/
+ Referenzpunkt ist stets der Punkt 0, also die linke / /
+ obere Ecke des Ausgangsrects. / /
+ Bei der Berechnung des Polygons ist die Reihenfolge / /
+ (erst Shear, dann Rotation vorgegeben). / / \
+ / / |
+ A) Ausgangsrechteck aRect B) Nach Anwendung von Shear /0 3/ Rot|
+ +------------------+ -------------------- ------------ ------
+ |0 1| \0 1\ C) Nach Anwendung
+ | | \ \ von Rotate
+ | | | \ \
+ |3 2| | \3 2\
+ +------------------+ | --------------------
+ |Shr |
+ Bei Rueckkonvertierung des Polygons in ein Rect ist die Reihenfolge
+ zwangslaeufig umgekehrt:
+ - Berechnung des Drehwinkels: Winkel der Strecke 0-1 aus Abb. C) zum Horizont
+ - Rueckdrehung des geshearten Rects (man erhaelt Abb B))
+ - Bestimmung der Breite des Rects=Laenge der Strecke 0-1 aus Abb. B)
+ - Bestimmung der Hoehe des Rects=vertikaler Abstand zwischen den Punkten
+ 0 und 3 aus Abb. B)
+ - Bestimmung des Shear-Winkels aus der Strecke 0-3 zur Senkrechten.
+ Es ist darauf zu achten, dass das Polygon bei einer zwischenzeitlichen
+ Transformation evtl. gespiegelt wurde (Mirror oder Resize mit neg. Faktor).
+ In diesem Fall muss zunaecht eine Normalisierung durch Vertauschung der
+ Punkte (z.B. 0 mit 3 und 1 mit 2) durchgefuehrt werden, damit der
+ Richtungssinn im Polygon wieder stimmig ist.
+ Hinweis: Positiver Shear-Winkel bedeutet Shear mit auf dem Bildschirm
+ sichtbarer positiver Kursivierung. Mathematisch waere dass eine negative
+ Kursivierung, da die Y-Achse auf dem Bildschirm von oben nach unten verlaeuft.
+ Drehwinkel: Positiv bedeutet auf dem Bildschirm sichtbare Linksdrehung.
+*/
+
+class GeoStat { // Geometrischer Status fuer ein Rect
+public:
+ long nDrehWink;
+ long nShearWink;
+ double nTan; // tan(nShearWink)
+ double nSin; // sin(nDrehWink)
+ double nCos; // cos(nDrehWink)
+ bool bMirrored; // Horizontal gespiegelt? (ni)
+public:
+ GeoStat(): nDrehWink(0),nShearWink(0),nTan(0.0),nSin(0.0),nCos(1.0),bMirrored(false) {}
+ void RecalcSinCos();
+ void RecalcTan();
+};
+
+Polygon Rect2Poly(const Rectangle& rRect, const GeoStat& rGeo);
+void Poly2Rect(const Polygon& rPol, Rectangle& rRect, GeoStat& rGeo);
+
+SVX_DLLPUBLIC void OrthoDistance8(const Point& rPt0, Point& rPt, FASTBOOL bBigOrtho);
+SVX_DLLPUBLIC void OrthoDistance4(const Point& rPt0, Point& rPt, FASTBOOL bBigOrtho);
+
+// Multiplikation und anschliessende Division.
+// Rechnung und Zwischenergebnis sind BigInt.
+SVX_DLLPUBLIC long BigMulDiv(long nVal, long nMul, long nDiv);
+
+// Fehlerbehaftetes Kuerzen einer Fraction.
+// nDigits gibt an, wieviele signifikante Stellen in
+// Zaehler/Nenner mindestens erhalten bleiben sollen.
+void Kuerzen(Fraction& rF, unsigned nDigits);
+
+
+class FrPair {
+ Fraction aX;
+ Fraction aY;
+public:
+ FrPair() : aX(0,1),aY(0,1) {}
+ FrPair(const Fraction& rBoth) : aX(rBoth),aY(rBoth) {}
+ FrPair(const Fraction& rX, const Fraction& rY) : aX(rX),aY(rY) {}
+ FrPair(long nMul, long nDiv) : aX(nMul,nDiv),aY(nMul,nDiv) {}
+ FrPair(long xMul, long xDiv, long yMul, long yDiv): aX(xMul,xDiv),aY(yMul,yDiv) {}
+ const Fraction& X() const { return aX; }
+ const Fraction& Y() const { return aY; }
+ Fraction& X() { return aX; }
+ Fraction& Y() { return aY; }
+};
+
+// Fuer die Umrechnung von Masseinheiten
+SVX_DLLPUBLIC FrPair GetMapFactor(MapUnit eS, MapUnit eD);
+FrPair GetMapFactor(MapUnit eS, FieldUnit eD);
+FrPair GetMapFactor(FieldUnit eS, MapUnit eD);
+FrPair GetMapFactor(FieldUnit eS, FieldUnit eD);
+
+inline FASTBOOL IsMetric(MapUnit eU) {
+ return (eU==MAP_100TH_MM || eU==MAP_10TH_MM || eU==MAP_MM || eU==MAP_CM);
+}
+
+inline FASTBOOL IsInch(MapUnit eU) {
+ return (eU==MAP_1000TH_INCH || eU==MAP_100TH_INCH || eU==MAP_10TH_INCH || eU==MAP_INCH ||
+ eU==MAP_POINT || eU==MAP_TWIP);
+}
+
+inline FASTBOOL IsMetric(FieldUnit eU) {
+ return (eU==FUNIT_MM || eU==FUNIT_CM || eU==FUNIT_M || eU==FUNIT_KM || eU==FUNIT_100TH_MM);
+}
+
+inline FASTBOOL IsInch(FieldUnit eU) {
+ return (eU==FUNIT_TWIP || eU==FUNIT_POINT || eU==FUNIT_PICA ||
+ eU==FUNIT_INCH || eU==FUNIT_FOOT || eU==FUNIT_MILE);
+}
+
+class SVX_DLLPUBLIC SdrFormatter {
+ Fraction aScale;
+ long nMul_;
+ long nDiv_;
+ short nKomma_;
+ FASTBOOL bSrcFU;
+ FASTBOOL bDstFU;
+ FASTBOOL bDirty;
+ MapUnit eSrcMU;
+ MapUnit eDstMU;
+ FieldUnit eSrcFU;
+ FieldUnit eDstFU;
+private:
+ SVX_DLLPRIVATE void Undirty();
+ SVX_DLLPRIVATE void ForceUndirty() const { if (bDirty) ((SdrFormatter*)this)->Undirty(); }
+public:
+ SdrFormatter(MapUnit eSrc, MapUnit eDst) { eSrcMU=eSrc; bSrcFU=sal_False; eDstMU=eDst; bDstFU=sal_False; bDirty=sal_True; }
+ SdrFormatter(MapUnit eSrc, FieldUnit eDst) { eSrcMU=eSrc; bSrcFU=sal_False; eDstFU=eDst; bDstFU=sal_True; bDirty=sal_True; }
+ SdrFormatter(FieldUnit eSrc, MapUnit eDst) { eSrcFU=eSrc; bSrcFU=sal_True; eDstMU=eDst; bDstFU=sal_False; bDirty=sal_True; }
+ SdrFormatter(FieldUnit eSrc, FieldUnit eDst) { eSrcFU=eSrc; bSrcFU=sal_True; eDstFU=eDst; bDstFU=sal_True; bDirty=sal_True; }
+ void SetSourceUnit(MapUnit eSrc) { eSrcMU=eSrc; bSrcFU=sal_False; bDirty=sal_True; }
+ void SetSourceUnit(FieldUnit eSrc) { eSrcFU=eSrc; bSrcFU=sal_True; bDirty=sal_True; }
+ void SetDestinationUnit(MapUnit eDst) { eDstMU=eDst; bDstFU=sal_False; bDirty=sal_True; }
+ void SetDestinationUnit(FieldUnit eDst) { eDstFU=eDst; bDstFU=sal_True; bDirty=sal_True; }
+ void TakeStr(long nVal, XubString& rStr) const;
+ static void TakeUnitStr(MapUnit eUnit, XubString& rStr);
+ static void TakeUnitStr(FieldUnit eUnit, XubString& rStr);
+ static XubString GetUnitStr(MapUnit eUnit) { XubString aStr; TakeUnitStr(eUnit,aStr); return aStr; }
+ static XubString GetUnitStr(FieldUnit eUnit) { XubString aStr; TakeUnitStr(eUnit,aStr); return aStr; }
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDTRANS_HXX
+
diff --git a/svx/inc/svx/svdtypes.hxx b/svx/inc/svx/svdtypes.hxx
new file mode 100644
index 000000000000..67161e8eb748
--- /dev/null
+++ b/svx/inc/svx/svdtypes.hxx
@@ -0,0 +1,169 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDTYPES_HXX
+#define _SVDTYPES_HXX
+
+#include <tools/solar.h>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// @@@@ @@@@@ @@@@@ @@@@ @@@@@ @@@@@@ @@@@@ @@@@ @@@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@@@ @@ @@ @@@@@ @@ @@ @@@@@ @@ @@@@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@@@ @@@@@ @@ @@ @@@@ @@@@@ @@@@ @@@@@ @@@@ @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+const sal_uInt32 SdrInventor=sal_uInt32('S')*0x00000001+
+ sal_uInt32('V')*0x00000100+
+ sal_uInt32('D')*0x00010000+
+ sal_uInt32('r')*0x01000000;
+
+// Kommandos fuer EndCreate()
+enum SdrCreateCmd {SDRCREATE_NEXTPOINT, // Naechster Polygonpunkt, Kreissegment: Naechste Koordinate
+ SDRCREATE_NEXTOBJECT, // Naechstes Polygon im PolyPolygon
+ SDRCREATE_FORCEEND}; // Ende erzwungen
+
+enum SdrDragMode
+{
+ SDRDRAG_MOVE, // Verschieben
+ SDRDRAG_RESIZE, // Groesse aendern
+ SDRDRAG_ROTATE, // Drehen
+ SDRDRAG_MIRROR, // Spiegeln
+ SDRDRAG_SHEAR, // Schraegstellen
+ SDRDRAG_CROOK, // Kreisfoermig verbiegen
+ SDRDRAG_DISTORT, // Freies verzerren (Rect in beliebiges Viereck transformieren)
+
+ // new modes for interactive transparence and gradient tools
+ SDRDRAG_TRANSPARENCE,
+ SDRDRAG_GRADIENT,
+
+ // new mode for interactive cropping of graphics
+ SDRDRAG_CROP
+};
+
+
+// fuer SdrObject::ConvertToPoly()
+enum SdrConvertType {SDRCONVERT_POLY, // reines Polygon erzeugen
+ SDRCONVERT_BEZIER, // alles Beziersegmente
+ SDRCONVERT_MIXED}; // Gemischtes Objekt (optimal)
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// @@ @@@@ @@ @@ @@@@@ @@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@@@@@ @@@@ @@@@ @@@@@
+// @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@
+// @@@@@ @@ @@ @@ @@@@@ @@ @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Bei der Identifikation eines Layer kann es vorkommen, das dieser nicht
+// vorhanden ist. SdrLayerAdmin::GetLayerID(const String&) liefert
+// dann diesen Wert:
+#define SDRLAYER_NOTFOUND 0xFF
+// Man kann diesen Wert jodoch ohne Bedenken den Methoden des SdrLayerSet
+// zuwerfen, bekommt dann jedoch immer sal_False, bzw. tut die Methode nix.
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Typdeklaration fuer Layer-IDs
+typedef sal_uInt8 SdrLayerID;
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// @@@@@ @@@@ @@@@ @@@@@ @@@@ @@@@@ @@@@@@ @@ @@ @@@@ @@@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@@@@ @@@@@@ @@ @@@ @@@@ @@@@ @@ @@ @@@@@ @@ @@ @@ @@@@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@@@@ @@@@@ @@@@ @@@@@ @@@@ @@@@@ @@ @@@@ @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+enum SdrObjListKind {SDROBJLIST_UNKNOWN =0x00, // Unbekannt
+ // reine Objektlisten:
+ SDROBJLIST_GROUPOBJ =0x01, // Objektliste eines Gruppenobjekts
+ SDROBJLIST_VIRTOBJECTS=0x02, // Liste ist die Liste der virtuellen Objekte
+ SDROBJLIST_SYMBOLTABLE=0x03, // Liste ist die Symboltabelle
+ // Hier haben zur Not noch 12 weitere Listentypen Platz
+ // Pages:
+ SDROBJLIST_DRAWPAGE =0x10, // Liste ist eine Zeichenseite
+ SDROBJLIST_MASTERPAGE =0x11 // Liste ist eine Masterpage
+ // Hier haben zur Not noch 8 weitere Pagetypen Platz
+}; // fuer die Surrogate reserviert
+
+inline FASTBOOL SdrIsPageKind(SdrObjListKind eK) { return eK>=SDROBJLIST_DRAWPAGE && eK<=0x1A; }
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// @@@@@ @@@@@ @@@@@ @@@@@ @@@@ @@@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@@@@ @@@@ @@@@@ @@@@ @@@@@@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@@@@ @@ @@@@@ @@ @@ @@
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+enum SdrRepeatFunc {SDRREPFUNC_OBJ_NONE,
+ // Mit Parameter
+ SDRREPFUNC_OBJ_MOVE, // Distanz
+ SDRREPFUNC_OBJ_RESIZE, // Faktor, Referenz(%) bezogen auf MarkRect
+ SDRREPFUNC_OBJ_SETSNAPRECT, // Rectangle
+ SDRREPFUNC_OBJ_SETLOGICRECT, // Rectangle
+ SDRREPFUNC_OBJ_ROTATE, // Drehwinkel, Referenz(%) bezogen auf MarkRect
+ SDRREPFUNC_OBJ_SHEAR, // Winkel,Faktor, Referenz(%) bezogen auf MarkRect
+ SDRREPFUNC_OBJ_CROOKROTATE,
+ SDRREPFUNC_OBJ_CROOKSLANT,
+ SDRREPFUNC_OBJ_CROOKSTRETCH,
+ SDRREPFUNC_OBJ_ALIGN, // Hor/Vert/bBound
+ SDRREPFUNC_OBJ_SETATTRIBUTES,// ItemSet
+ SDRREPFUNC_OBJ_SETSTYLESHEET,// StyleSheet*
+ // Ohne Parameter
+ SDRREPFUNC_OBJ_DELETE,
+ SDRREPFUNC_OBJ_COMBINE_POLYPOLY,
+ SDRREPFUNC_OBJ_COMBINE_ONEPOLY,
+ SDRREPFUNC_OBJ_DISMANTLE_POLYS,
+ SDRREPFUNC_OBJ_DISMANTLE_LINES,
+ SDRREPFUNC_OBJ_CONVERTTOPOLY,
+ SDRREPFUNC_OBJ_CONVERTTOPATH,
+ SDRREPFUNC_OBJ_GROUP,
+ SDRREPFUNC_OBJ_UNGROUP,
+ SDRREPFUNC_OBJ_PUTTOTOP,
+ SDRREPFUNC_OBJ_PUTTOBTM,
+ SDRREPFUNC_OBJ_MOVTOTOP,
+ SDRREPFUNC_OBJ_MOVTOBTM,
+ SDRREPFUNC_OBJ_REVORDER,
+ SDRREPFUNC_OBJ_IMPORTMTF,
+ SDRREPFUNC_PAGE_DELETE,
+ SDRREPFUNC_LAST};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDTYPES_HXX
+
diff --git a/svx/inc/svx/svdundo.hxx b/svx/inc/svx/svdundo.hxx
new file mode 100644
index 000000000000..5329be5973eb
--- /dev/null
+++ b/svx/inc/svx/svdundo.hxx
@@ -0,0 +1,882 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDUNDO_HXX
+#define _SVDUNDO_HXX
+
+#ifndef _SOLAR_HRC
+#include <svl/solar.hrc>
+#endif
+#include <svl/undo.hxx>
+#include <tools/contnr.hxx>
+#include <tools/gen.hxx>
+#include <svx/svdtypes.hxx> // fuer enum RepeatFuncts
+#include <svx/svdsob.hxx>
+#include "svx/svxdllapi.h"
+
+//************************************************************
+// Vorausdeklarationen
+//************************************************************
+
+class SfxItemSet;
+class SfxStyleSheet;
+class SdrView;
+class SdrPageView;
+class SdrModel;
+class SdrObject;
+class SdrPage;
+class SdrObjList;
+class SdrLayer;
+class SdrLayerAdmin;
+class SdrObjGeoData;
+class OutlinerParaObject;
+
+//************************************************************
+// SdrUndoAction
+//
+// Abstrakte Basisklasse fuer alle UndoActions der DrawingEngine
+//
+//************************************************************
+
+class SVX_DLLPUBLIC SdrUndoAction : public SfxUndoAction
+{
+protected:
+ SdrModel& rMod;
+
+protected:
+ SdrUndoAction(SdrModel& rNewMod)
+ : rMod(rNewMod)
+ {}
+
+public:
+ TYPEINFO();
+ virtual sal_Bool CanRepeat(SfxRepeatTarget& rView) const;
+ virtual void Repeat(SfxRepeatTarget& rView);
+
+ virtual String GetRepeatComment(SfxRepeatTarget& rView) const;
+ virtual String GetSdrRepeatComment(SdrView& rView) const;
+
+ virtual bool CanSdrRepeat(SdrView& rView) const;
+ virtual void SdrRepeat(SdrView& rView);
+};
+
+//************************************************************
+// SdrUndoGroup
+//
+// Zusammenfassung beliebig vieler einzelner UndoActions zu einer einzigen
+// UndoAction. Beim Undo() werden die Einzelactions rueckwaets aufgerufen
+// (die zuletzt angehaengte zuerst...), beim Redo() dagegen entspricht die
+// Aufrufreihenfolge der Einfuegereihenfolge.
+//
+//************************************************************
+
+class SVX_DLLPUBLIC SdrUndoGroup : public SdrUndoAction
+{
+protected:
+ Container aBuf;
+
+ // Beschreibung der Action, nicht expandiert (beinhaltet %O)
+ String aComment;
+ String aObjDescription;
+
+ SdrRepeatFunc eFunction;
+
+public:
+ SdrUndoGroup(SdrModel& rNewMod);
+ SdrUndoGroup(SdrModel& rNewMod,const String& rStr);
+ virtual ~SdrUndoGroup();
+
+ void Clear();
+ sal_uIntPtr GetActionCount() const { return aBuf.Count(); }
+ SdrUndoAction* GetAction(sal_uIntPtr nNum) const { return (SdrUndoAction*)(aBuf.GetObject(nNum)); }
+ void AddAction(SdrUndoAction* pAct);
+ void push_front( SdrUndoAction* pAct );
+
+ void SetComment(const String& rStr) { aComment=rStr; }
+ void SetObjDescription(const String& rStr) { aObjDescription=rStr; }
+ virtual String GetComment() const;
+ virtual String GetSdrRepeatComment(SdrView& rView) const;
+
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual bool CanSdrRepeat(SdrView& rView) const;
+ virtual void SdrRepeat(SdrView& rView);
+ void SetRepeatFunction(SdrRepeatFunc eFunc) { eFunction=eFunc; }
+ SdrRepeatFunc GetRepeatFunction() const { return eFunction; }
+};
+
+//************************************************************
+// SdrUndoObj
+//
+// Abstrakte Basisklasse fuer alle UndoActions die mit Objekten zu tun haben.
+//
+//************************************************************
+
+class SVX_DLLPUBLIC SdrUndoObj : public SdrUndoAction
+{
+protected:
+ SdrObject* pObj;
+
+protected:
+ SdrUndoObj(SdrObject& rNewObj);
+
+ void ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, String& rStr, FASTBOOL bRepeat=sal_False) const;
+
+ static void GetDescriptionStringForObject( const SdrObject& _rForObject, sal_uInt16 nStrCacheID, String& rStr, FASTBOOL bRepeat = sal_False );
+
+ // #94278# new method for evtl. PageChange at UNDO/REDO
+ void ImpShowPageOfThisObject();
+};
+
+//************************************************************
+// SdrUndoAttrObj
+//
+// Aenderung der Objektattribute.
+// Action direkt vor dem Setzen der neuen Attribute konstruieren.
+// Auch fuer StyleSheets
+//
+//************************************************************
+
+class SVX_DLLPUBLIC SdrUndoAttrObj : public SdrUndoObj
+{
+protected:
+ SfxItemSet* pUndoSet;
+ SfxItemSet* pRedoSet;
+ SfxItemSet* pRepeatSet;
+
+ // oder besser den StyleSheetNamen merken?
+ SfxStyleSheet* pUndoStyleSheet;
+ SfxStyleSheet* pRedoStyleSheet;
+ SfxStyleSheet* pRepeatStyleSheet;
+ FASTBOOL bStyleSheet;
+ FASTBOOL bHaveToTakeRedoSet;
+
+ // Bei Zuweisung von TextItems auf ein Zeichenobjekt mit Text:
+ OutlinerParaObject* pTextUndo;
+ // #i8508#
+ // The text rescue mechanism needs also to be implemented for redo actions.
+ OutlinerParaObject* pTextRedo;
+
+ // Wenn sich um ein Gruppenobjekt handelt:
+ SdrUndoGroup* pUndoGroup;
+
+public:
+ SdrUndoAttrObj(SdrObject& rNewObj, FASTBOOL bStyleSheet1=sal_False, FASTBOOL bSaveText=sal_False);
+ virtual ~SdrUndoAttrObj();
+ void SetRepeatAttr(const SfxItemSet& rSet);
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual String GetComment() const;
+ virtual String GetSdrRepeatComment(SdrView& rView) const;
+
+ virtual void SdrRepeat(SdrView& rView);
+ virtual bool CanSdrRepeat(SdrView& rView) const;
+};
+
+//************************************************************
+// SdrUndoMoveObj
+//
+// Blosses verschieben eines Objektes.
+// Action direkt vor dem Verschieben konstruieren.
+//
+//************************************************************
+
+class SVX_DLLPUBLIC SdrUndoMoveObj : public SdrUndoObj
+{
+protected:
+ Size aDistance; // Entfernung, um die verschoben wird
+
+public:
+ SdrUndoMoveObj(SdrObject& rNewObj): SdrUndoObj(rNewObj) {}
+ SdrUndoMoveObj(SdrObject& rNewObj, const Size& rDist): SdrUndoObj(rNewObj),aDistance(rDist) {}
+
+ void SetDistance(const Size& rDist) { aDistance=rDist; }
+ const Size& GetDistance() const { return aDistance; }
+
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual String GetComment() const;
+ virtual String GetSdrRepeatComment(SdrView& rView) const;
+
+ virtual void SdrRepeat(SdrView& rView);
+ virtual bool CanSdrRepeat(SdrView& rView) const;
+};
+
+//************************************************************
+// SdrUndoGeoObj
+//
+// Aenderung der Geometrie eines Objektes.
+// Action direkt vor der geometrischen Transformation konstruieren.
+//
+//************************************************************
+
+class SVX_DLLPUBLIC SdrUndoGeoObj : public SdrUndoObj
+{
+protected:
+ SdrObjGeoData* pUndoGeo;
+ SdrObjGeoData* pRedoGeo;
+ // Wenn sich um ein Gruppenobjekt handelt:
+ SdrUndoGroup* pUndoGroup;
+
+public:
+ SdrUndoGeoObj(SdrObject& rNewObj);
+ virtual ~SdrUndoGeoObj();
+
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual String GetComment() const;
+};
+
+//************************************************************
+// SdrUndoObjList
+//
+// Manipulationen an einer ObjList: Neues Obj, DeleteObj, SetObjZLevel, Grouping, ...
+// Abstrakte Basisklasse.
+//
+//************************************************************
+
+class SVX_DLLPUBLIC SdrUndoObjList : public SdrUndoObj {
+ bool bOwner;
+
+protected:
+ SdrObjList* pObjList;
+ SdrView* pView; // um bei ObjDel, Undo die
+ SdrPageView* pPageView; // Selektion widerherstellen zu koennen
+ sal_uInt32 nOrdNum;
+ // Bei einem Undo/Redo findet moeglicherweise Uebereignung des Objektes
+ // statt. Im Dtor wird das Obj deleted, wenn bOwner==TRUE
+
+protected:
+ SdrUndoObjList(SdrObject& rNewObj, bool bOrdNumDirect = false);
+ virtual ~SdrUndoObjList();
+
+ void SetView(SdrView* pView1, SdrPageView* pPageView1) { pView=pView1; pPageView=pPageView1; }
+ bool IsOwner() { return bOwner; }
+ void SetOwner(bool bNew);
+};
+
+//************************************************************
+// SdrUndoRemoveObj
+//
+// Entfernen Objekts aus einer Objektliste. Innerhalb einer UndoGroup
+// mit korrospondierenden Inserts zu verwenden.
+// Action vor dem entfernen aus der ObjList konstruieren.
+//
+//************************************************************
+
+class SVX_DLLPUBLIC SdrUndoRemoveObj : public SdrUndoObjList
+{
+public:
+ SdrUndoRemoveObj(SdrObject& rNewObj, FASTBOOL bOrdNumDirect=sal_False)
+ : SdrUndoObjList(rNewObj,bOrdNumDirect) {}
+
+ virtual void Undo();
+ virtual void Redo();
+};
+
+//************************************************************
+// SdrUndoInsertObj
+//
+// Einfuegen Objekts in eine Objektliste. Innerhalb einer UndoGroup
+// mit korrospondierenden Removes zu verwenden.
+// Action vor dem entfernen aus der ObjList konstruieren.
+//
+//************************************************************
+
+class SVX_DLLPUBLIC SdrUndoInsertObj : public SdrUndoObjList
+{
+public:
+ SdrUndoInsertObj(SdrObject& rNewObj, FASTBOOL bOrdNumDirect=sal_False)
+ : SdrUndoObjList(rNewObj,bOrdNumDirect) {}
+
+ virtual void Undo();
+ virtual void Redo();
+};
+
+//************************************************************
+// SdrUndoDelObj
+//
+// Loeschen eines Objekts.
+// Action vor dem entfernen aus der ObjList konstruieren.
+//
+//************************************************************
+
+class SVX_DLLPUBLIC SdrUndoDelObj : public SdrUndoRemoveObj
+{
+public:
+ SdrUndoDelObj(SdrObject& rNewObj, FASTBOOL bOrdNumDirect=sal_False)
+ : SdrUndoRemoveObj(rNewObj,bOrdNumDirect) { SetOwner(sal_True); }
+
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual String GetComment() const;
+ virtual String GetSdrRepeatComment(SdrView& rView) const;
+
+ virtual void SdrRepeat(SdrView& rView);
+ virtual bool CanSdrRepeat(SdrView& rView) const;
+};
+
+//************************************************************
+// SdrUndoNewObj
+//
+// Einfuegen eines neuen Objektes.
+// Action nach dem einfuegen in die ObjList konstruieren.
+//
+//************************************************************
+
+class SVX_DLLPUBLIC SdrUndoNewObj : public SdrUndoInsertObj
+{
+public:
+ SdrUndoNewObj(SdrObject& rNewObj, FASTBOOL bOrdNumDirect=sal_False)
+ : SdrUndoInsertObj(rNewObj,bOrdNumDirect) {}
+
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual String GetComment() const;
+
+ static String GetComment( const SdrObject& _rForObject );
+};
+
+//************************************************************
+// SdrUndoReplaceObj
+//
+// Austausch eines Objektes.
+// Action vor dem Replace an der ObjList konstruieren.
+//
+//************************************************************
+
+class SVX_DLLPUBLIC SdrUndoReplaceObj : public SdrUndoObj
+{
+ bool bOldOwner;
+ bool bNewOwner;
+
+protected:
+ SdrObjList* pObjList;
+ sal_uInt32 nOrdNum;
+ SdrObject* pNewObj;
+
+public:
+ SdrUndoReplaceObj(SdrObject& rOldObj1, SdrObject& rNewObj1, bool bOrdNumDirect = false);
+ virtual ~SdrUndoReplaceObj();
+
+ virtual void Undo();
+ virtual void Redo();
+
+ bool IsNewOwner() { return bNewOwner; }
+ void SetNewOwner(bool bNew);
+
+ bool IsOldOwner() { return bOldOwner; }
+ void SetOldOwner(bool bNew);
+};
+
+//************************************************************
+// SdrUndoCopyObj
+//
+// Kopieren eines Objekts
+// Action nach dem einfuegen in die ObjList konstruieren.
+//
+//************************************************************
+
+class SdrUndoCopyObj : public SdrUndoNewObj
+{
+public:
+ SdrUndoCopyObj(SdrObject& rNewObj, FASTBOOL bOrdNumDirect=sal_False)
+ : SdrUndoNewObj(rNewObj,bOrdNumDirect) {}
+
+ virtual String GetComment() const;
+};
+
+//************************************************************
+// SdrUndoObjOrdNum
+//************************************************************
+
+class SdrUndoObjOrdNum : public SdrUndoObj
+{
+protected:
+ sal_uInt32 nOldOrdNum;
+ sal_uInt32 nNewOrdNum;
+
+public:
+ SdrUndoObjOrdNum(SdrObject& rNewObj, sal_uInt32 nOldOrdNum1, sal_uInt32 nNewOrdNum1);
+
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual String GetComment() const;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// #i11702#
+
+class SVX_DLLPUBLIC SdrUndoObjectLayerChange : public SdrUndoObj
+{
+protected:
+ SdrLayerID maOldLayer;
+ SdrLayerID maNewLayer;
+
+public:
+ SdrUndoObjectLayerChange(SdrObject& rObj, SdrLayerID aOldLayer, SdrLayerID aNewLayer);
+
+ virtual void Undo();
+ virtual void Redo();
+};
+
+//************************************************************
+// SdrUndoObjSetText
+//************************************************************
+
+class SVX_DLLPUBLIC SdrUndoObjSetText : public SdrUndoObj
+{
+protected:
+ OutlinerParaObject* pOldText;
+ OutlinerParaObject* pNewText;
+ FASTBOOL bNewTextAvailable;
+ sal_Bool bEmptyPresObj;
+ sal_Int32 mnText;
+
+public:
+ SdrUndoObjSetText(SdrObject& rNewObj, sal_Int32 nText );
+ virtual ~SdrUndoObjSetText();
+
+ FASTBOOL IsDifferent() const { return pOldText!=pNewText; }
+ void AfterSetText();
+
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual String GetComment() const;
+ virtual String GetSdrRepeatComment(SdrView& rView) const;
+
+ virtual void SdrRepeat(SdrView& rView);
+ virtual bool CanSdrRepeat(SdrView& rView) const;
+};
+
+// --> OD 2009-07-09 #i73249#
+class SdrUndoObjStrAttr : public SdrUndoObj
+{
+public:
+ enum ObjStrAttrType
+ {
+ OBJ_NAME,
+ OBJ_TITLE,
+ OBJ_DESCRIPTION
+ };
+
+protected:
+ const ObjStrAttrType meObjStrAttr;
+ const String msOldStr;
+ const String msNewStr;
+
+public:
+ SdrUndoObjStrAttr( SdrObject& rNewObj,
+ const ObjStrAttrType eObjStrAttr,
+ const String& sOldStr,
+ const String& sNewStr);
+
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual String GetComment() const;
+};
+// <--
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@ @@@@ @@ @@ @@@@@ @@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@@@@@ @@@@ @@@@ @@@@@
+// @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@
+// @@@@@ @@ @@ @@ @@@@@ @@ @@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+//************************************************************
+// SdrUndoLayer
+//
+// Abstrakte Basisklasse fuer alle UndoActions die mit SdrLayer zu tun haben.
+//
+//************************************************************
+
+class SdrUndoLayer : public SdrUndoAction
+{
+protected:
+ SdrLayer* pLayer;
+ SdrLayerAdmin* pLayerAdmin;
+ sal_uInt16 nNum;
+ FASTBOOL bItsMine;
+
+protected:
+ SdrUndoLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel);
+ virtual ~SdrUndoLayer();
+};
+
+//************************************************************
+// SdrUndoNewLayer
+//
+// Einfuegen eines neuen Layer. Action nach dem Einfuegen konstruieren.
+//
+//************************************************************
+
+class SdrUndoNewLayer : public SdrUndoLayer
+{
+public:
+ SdrUndoNewLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel)
+ : SdrUndoLayer(nLayerNum,rNewLayerAdmin,rNewModel) {}
+
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual String GetComment() const;
+};
+
+//************************************************************
+// SdrUndoDelLayer
+//
+// Loeschen eines Layer. Action vor dem Remove konstruieren
+//
+//************************************************************
+
+class SdrUndoDelLayer : public SdrUndoLayer
+{
+public:
+ SdrUndoDelLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel)
+ : SdrUndoLayer(nLayerNum,rNewLayerAdmin,rNewModel) { bItsMine=sal_True; }
+
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual String GetComment() const;
+};
+
+//************************************************************
+// SdrUndoMoveLayer
+//
+// Verschieben eines Layer. Action vor dem Verschieben konstruieren.
+//
+//************************************************************
+
+class SdrUndoMoveLayer : public SdrUndoLayer
+{
+ sal_uInt16 nNeuPos;
+
+public:
+ SdrUndoMoveLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel, sal_uInt16 nNeuPos1)
+ : SdrUndoLayer(nLayerNum,rNewLayerAdmin,rNewModel), nNeuPos(nNeuPos1) {}
+
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual String GetComment() const;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@@ @@@@ @@@@ @@@@@ @@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@
+// @@@@@ @@@@@@ @@ @@@ @@@@ @@@@
+// @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@@@@ @@@@@ @@@@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+//************************************************************
+// SdrUndoPage
+//
+// Abstrakte Basisklasse fuer alle UndoActions die mit SdrPages zu tun haben.
+//
+//************************************************************
+
+class SVX_DLLPUBLIC SdrUndoPage : public SdrUndoAction
+{
+protected:
+ SdrPage& mrPage;
+
+protected:
+ void ImpInsertPage(sal_uInt16 nNum);
+ void ImpRemovePage(sal_uInt16 nNum);
+ void ImpMovePage(sal_uInt16 nOldNum, sal_uInt16 nNewNum);
+
+protected:
+ SdrUndoPage(SdrPage& rNewPg);
+
+ void ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, String& rStr, sal_uInt16 n=0, FASTBOOL bRepeat=sal_False) const;
+};
+
+//************************************************************
+// SdrUndoPageList
+//
+// Manipulationen an einer PageList: Neue Page, DeletePage, MovePage(ChangePageNum)
+// Abstrakte Basisklasse.
+//
+//************************************************************
+
+class SVX_DLLPUBLIC SdrUndoPageList : public SdrUndoPage
+{
+protected:
+ sal_uInt16 nPageNum;
+
+ // Bei einem Undo/Redo findet moeglicherweise Uebereignung der Page
+ // statt. Im Dtor wird die Page deleted, wenn bItsMine==TRUE
+ FASTBOOL bItsMine;
+
+protected:
+ SdrUndoPageList(SdrPage& rNewPg);
+ virtual ~SdrUndoPageList();
+};
+
+//************************************************************
+// SdrUndoDelPage
+//
+// Loeschen einer Page.
+// Action vor dem entfernen aus der List konstruieren.
+//
+//************************************************************
+
+class SVX_DLLPUBLIC SdrUndoDelPage : public SdrUndoPageList
+{
+ // Beim loeschen einer MasterPage merke ich mir in dieser UndoGroup
+ // alle Beziehungen der Zeichenseiten zu der geloeschten MasterPage
+ SdrUndoGroup* pUndoGroup;
+
+public:
+ SdrUndoDelPage(SdrPage& rNewPg);
+ virtual ~SdrUndoDelPage();
+
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual String GetComment() const;
+ virtual String GetSdrRepeatComment(SdrView& rView) const;
+
+ virtual void SdrRepeat(SdrView& rView);
+ virtual bool CanSdrRepeat(SdrView& rView) const;
+};
+
+//************************************************************
+// SdrUndoNewPage
+//
+// Einfuegen einer neuen Page.
+// Action nach dem einfuegen in die Liste konstruieren.
+//
+//************************************************************
+
+class SVX_DLLPUBLIC SdrUndoNewPage : public SdrUndoPageList
+{
+public:
+ SdrUndoNewPage(SdrPage& rNewPg): SdrUndoPageList(rNewPg) {}
+
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual String GetComment() const;
+};
+
+//************************************************************
+// SdrUndoCopyPage
+//
+// Kopieren einer Page
+// Action nach dem einfuegen in die Liste konstruieren.
+//
+//************************************************************
+
+class SdrUndoCopyPage : public SdrUndoNewPage
+{
+public:
+ SdrUndoCopyPage(SdrPage& rNewPg): SdrUndoNewPage(rNewPg) {}
+
+ virtual String GetComment() const;
+ virtual String GetSdrRepeatComment(SdrView& rView) const;
+
+ virtual void SdrRepeat(SdrView& rView);
+ virtual bool CanSdrRepeat(SdrView& rView) const;
+};
+
+//************************************************************
+// SdrUndoSetPageNum
+//
+// Verschieben der Page innerhalb der Liste
+// Action vor dem Verschieben der Page konstruieren.
+//
+//************************************************************
+
+class SVX_DLLPUBLIC SdrUndoSetPageNum : public SdrUndoPage
+{
+protected:
+ sal_uInt16 nOldPageNum;
+ sal_uInt16 nNewPageNum;
+
+public:
+ SdrUndoSetPageNum(SdrPage& rNewPg, sal_uInt16 nOldPageNum1, sal_uInt16 nNewPageNum1)
+ : SdrUndoPage(rNewPg),nOldPageNum(nOldPageNum1),nNewPageNum(nNewPageNum1) {}
+
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual String GetComment() const;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@ @@ @@@@ @@@@ @@@@@@ @@@@@ @@@@@ @@@@@ @@@@ @@@@ @@@@@ @@@@
+// @@@ @@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@@@@@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@@@@@@ @@@@@@ @@@@ @@ @@@@ @@@@@ @@@@@ @@@@@@ @@ @@@ @@@@ @@@@
+// @@ @ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@@@ @@ @@@@@ @@ @@ @@ @@ @@ @@@@@ @@@@@ @@@@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+//************************************************************
+// SdrUndoPageMasterPage
+//
+// Abstrakte Basisklasse fuer alle UndoActions die mit
+// MasterPage-Beziehungen zu tun haben.
+//
+//************************************************************
+
+class SdrUndoPageMasterPage : public SdrUndoPage
+{
+protected:
+ sal_Bool mbOldHadMasterPage;
+ SetOfByte maOldSet;
+ sal_uInt16 maOldMasterPageNumber;
+
+protected:
+ SdrUndoPageMasterPage(SdrPage& rChangedPage);
+
+public:
+ SVX_DLLPUBLIC virtual ~SdrUndoPageMasterPage();
+};
+
+//************************************************************
+// SdrUndoPageRemoveMasterPage
+//
+// Entfernen einer MasterPage von einer Zeichenseite.
+// Action vor dem Entfernen des MasterPageDescriptors erzeugen.
+//
+//************************************************************
+
+class SdrUndoPageRemoveMasterPage : public SdrUndoPageMasterPage
+{
+public:
+ SdrUndoPageRemoveMasterPage(SdrPage& rChangedPage);
+
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual String GetComment() const;
+};
+
+//************************************************************
+// SdrUndoPageChangeMasterPage
+//
+// Aenderung des MasterPageDescriptors (z.B. Aendern der VisibleLayer).
+// Action vor der Aenderung am MasterPageDescriptor erzeugen.
+//
+//************************************************************
+
+class SVX_DLLPUBLIC SdrUndoPageChangeMasterPage : public SdrUndoPageMasterPage
+{
+protected:
+ sal_Bool mbNewHadMasterPage;
+ SetOfByte maNewSet;
+ sal_uInt16 maNewMasterPageNumber;
+
+public:
+ SdrUndoPageChangeMasterPage(SdrPage& rChangedPage);
+
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual String GetComment() const;
+};
+
+///////////////////////////////////////////////////////////////////////
+
+/** the SdrUndoFactory can be set and retrieved from the SdrModel.
+ It is used by the drawing layer implementations to create undo actions.
+ It can be used by applications to create application specific undo actions.
+*/
+class SVX_DLLPUBLIC SdrUndoFactory
+{
+public:
+ // shapes
+ virtual ~SdrUndoFactory();
+ virtual SdrUndoAction* CreateUndoMoveObject( SdrObject& rObject );
+ virtual SdrUndoAction* CreateUndoMoveObject( SdrObject& rObject, const Size& rDist );
+ virtual SdrUndoAction* CreateUndoGeoObject( SdrObject& rObject );
+ virtual SdrUndoAction* CreateUndoAttrObject( SdrObject& rObject, bool bStyleSheet1 = false, bool bSaveText = false );
+ virtual SdrUndoAction* CreateUndoRemoveObject( SdrObject& rObject, bool bOrdNumDirect = false);
+ virtual SdrUndoAction* CreateUndoInsertObject( SdrObject& rObject, bool bOrdNumDirect = false);
+ virtual SdrUndoAction* CreateUndoDeleteObject( SdrObject& rObject, bool bOrdNumDirect = false);
+ virtual SdrUndoAction* CreateUndoNewObject( SdrObject& rObject, bool bOrdNumDirect = false);
+ virtual SdrUndoAction* CreateUndoCopyObject( SdrObject& rObject, bool bOrdNumDirect = false);
+
+ virtual SdrUndoAction* CreateUndoObjectOrdNum( SdrObject& rObject, sal_uInt32 nOldOrdNum1, sal_uInt32 nNewOrdNum1);
+
+ virtual SdrUndoAction* CreateUndoReplaceObject( SdrObject& rOldObject, SdrObject& rNewObject, bool bOrdNumDirect = false );
+ virtual SdrUndoAction* CreateUndoObjectLayerChange( SdrObject& rObject, SdrLayerID aOldLayer, SdrLayerID aNewLayer );
+ virtual SdrUndoAction* CreateUndoObjectSetText( SdrObject& rNewObj, sal_Int32 nText );
+
+ // --> OD 2009-07-09 #i73249#
+ virtual SdrUndoAction* CreateUndoObjectStrAttr( SdrObject& rObject,
+ SdrUndoObjStrAttr::ObjStrAttrType eObjStrAttrType,
+ String sOldStr,
+ String sNewStr );
+ // <--
+
+ // layer
+ virtual SdrUndoAction* CreateUndoNewLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel);
+ virtual SdrUndoAction* CreateUndoDeleteLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel);
+ virtual SdrUndoAction* CreateUndoMoveLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel, sal_uInt16 nNeuPos1);
+
+ // page
+ virtual SdrUndoAction* CreateUndoDeletePage(SdrPage& rPage);
+ virtual SdrUndoAction* CreateUndoNewPage(SdrPage& rPage);
+ virtual SdrUndoAction* CreateUndoCopyPage(SdrPage& rPage);
+ virtual SdrUndoAction* CreateUndoSetPageNum(SdrPage& rNewPg, sal_uInt16 nOldPageNum1, sal_uInt16 nNewPageNum1);
+
+ // master page
+ virtual SdrUndoAction* CreateUndoPageRemoveMasterPage(SdrPage& rChangedPage);
+ virtual SdrUndoAction* CreateUndoPageChangeMasterPage(SdrPage& rChangedPage);
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDUNDO_HXX
+
diff --git a/svx/inc/svx/svdview.hxx b/svx/inc/svx/svdview.hxx
new file mode 100644
index 000000000000..c189c8daf9a2
--- /dev/null
+++ b/svx/inc/svx/svdview.hxx
@@ -0,0 +1,339 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDVIEW_HXX
+#define _SVDVIEW_HXX
+
+// HACK to avoid too deep includes and to have some
+// levels free in svdmark itself (MS compiler include depth limit)
+#include <svx/svdhdl.hxx>
+#include <tools/weakbase.hxx>
+#include <svtools/accessibilityoptions.hxx>
+#include "svx/svxdllapi.h"
+#include <svx/svdcrtv.hxx>
+#include <unotools/options.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// Klassenhierarchie der View:
+// SfxListener
+// SdrPaintView PntV Action ModChg Attr Notify
+// SdrSnapView SnpV Action
+//
+// SdrMarkView MrkV Action MrkChg ModChg Notify
+//
+// SdrEditView EdtV MrkChg ModChg Attr
+// SdrPolyEditView PoEV
+// SdrGlueEditView GlEV
+// SdrObjEditView EdxV Action ModChg Attr Notify
+//
+// SdrExchangeView XcgV
+// SdrDragView DrgV Action
+//
+// SdrCreateView CrtV Action
+// SdrView View
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+//************************************************************
+// Vorausdeklarationen
+//************************************************************
+
+class SvxURLField;
+
+//************************************************************
+// Defines
+//************************************************************
+
+enum SdrViewContext {SDRCONTEXT_STANDARD,
+ SDRCONTEXT_POINTEDIT,
+ SDRCONTEXT_GLUEPOINTEDIT,
+ SDRCONTEXT_GRAPHIC,
+ SDRCONTEXT_MEDIA,
+ SDRCONTEXT_TABLE};
+
+enum SdrEventKind {SDREVENT_NONE,
+ SDREVENT_TEXTEDIT,
+ SDREVENT_MOVACTION,
+ SDREVENT_ENDACTION,
+ SDREVENT_BCKACTION,
+ SDREVENT_BRKACTION,
+ SDREVENT_ENDCREATE,
+ SDREVENT_ENDDRAG,
+ SDREVENT_MARKOBJ,
+ SDREVENT_MARKPOINT,
+ SDREVENT_MARKGLUEPOINT,
+ SDREVENT_BEGMARK,
+ SDREVENT_BEGINSOBJPOINT,
+ SDREVENT_ENDINSOBJPOINT,
+ SDREVENT_BEGINSGLUEPOINT,
+ SDREVENT_BEGDRAGHELPLINE,
+ SDREVENT_BEGDRAGOBJ,
+ SDREVENT_BEGCREATEOBJ,
+ SDREVENT_BEGMACROOBJ,
+ SDREVENT_BEGTEXTEDIT,
+ SDREVENT_ENDMARK,
+ SDREVENT_BRKMARK,
+ SDREVENT_EXECUTEURL};
+
+#define SDRMOUSEBUTTONDOWN 1
+#define SDRMOUSEMOVE 2
+#define SDRMOUSEBUTTONUP 3
+
+//************************************************************
+// Hilfsklasse SdrViewEvent
+//************************************************************
+
+struct SVX_DLLPUBLIC SdrViewEvent
+{
+ SdrHdl* pHdl;
+ SdrObject* pObj;
+ SdrObject* pRootObj; // Dieses Markieren bei SdrBeginTextEdit
+ SdrPageView* pPV;
+ const SvxURLField* pURLField;
+
+ Point aLogicPos;
+ SdrHitKind eHit;
+ SdrEventKind eEvent;
+ SdrHdlKind eHdlKind;
+ SdrCreateCmd eEndCreateCmd; // auch fuer EndInsPoint
+
+ sal_uInt16 nMouseClicks;
+ sal_uInt16 nMouseMode;
+ sal_uInt16 nMouseCode;
+ sal_uInt16 nHlplIdx;
+ sal_uInt16 nGlueId;
+
+ unsigned bMouseDown : 1;
+ unsigned bMouseUp : 1;
+ unsigned bDoubleHdlSize : 1; // Doppelte Handlegroesse wg. TextEdit
+ unsigned bIsAction : 1; // Action ist aktiv
+ unsigned bIsTextEdit : 1; // TextEdit laeuft zur Zeit
+ unsigned bTextEditHit : 1; // offene OutlinerView getroffen
+ unsigned bAddMark : 1;
+ unsigned bUnmark : 1;
+ unsigned bPrevNextMark : 1;
+ unsigned bMarkPrev : 1;
+ unsigned bInsPointNewObj : 1;
+ unsigned bDragWithCopy : 1;
+ unsigned bCaptureMouse : 1;
+ unsigned bReleaseMouse : 1;
+
+public:
+ SdrViewEvent();
+ ~SdrViewEvent();
+
+ // nEventKind ist SDRMOUSEBUTTONDOWN, SDRMOUSEMOVE oder SDRMOUSEBUTTONUP
+ void SetMouseEvent(const MouseEvent& rMEvt, sal_uInt16 nEventKind);
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// helper class for all D&D overlays
+
+class SVX_DLLPUBLIC SdrDropMarkerOverlay
+{
+ // The OverlayObjects
+ ::sdr::overlay::OverlayObjectList maObjects;
+
+ void ImplCreateOverlays(const SdrView& rView, const basegfx::B2DPolyPolygon& rPolyPolygon);
+
+public:
+ SdrDropMarkerOverlay(const SdrView& rView, const SdrObject& rObject);
+ SdrDropMarkerOverlay(const SdrView& rView, const Rectangle& rRectangle);
+ SdrDropMarkerOverlay(const SdrView& rView, const Point& rStart, const Point& rEnd);
+ ~SdrDropMarkerOverlay();
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@ @@ @@ @@@@@ @@ @@
+// @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @ @@
+// @@@@@ @@ @@@@ @@@@@@@
+// @@@ @@ @@ @@@@@@@
+// @@@ @@ @@ @@@ @@@
+// @ @@ @@@@@ @@ @@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class SVX_DLLPUBLIC SdrView: public SdrCreateView, public tools::WeakBase< SdrView >
+{
+ friend class SdrPageView;
+
+ unsigned bNoExtendedMouseDispatcher : 1;
+ unsigned bNoExtendedKeyDispatcher : 1;
+ unsigned bNoExtendedCommandDispatcher : 1;
+ unsigned bTextEditOnObjectsWithoutTextIfTextTool : 1;
+ unsigned mbMasterPagePaintCaching : 1;
+
+protected:
+ SvtAccessibilityOptions maAccessibilityOptions;
+
+public:
+ TYPEINFO();
+ SdrView(SdrModel* pModel1, OutputDevice* pOut = 0L);
+ virtual ~SdrView();
+
+ // Default sind alle Dispatcher aktiviert. Will die App z.B. fuer
+ // Sonderbehandlungen im MouseDispatcher eingreifen, so muss sie
+ // den erweiterten MouseDispather mit unten stehender Methode deaktivieren
+ // und selbst nachimplementieren. Beispiel fuer MouseButtonDown:
+ // SdrViewEvent aVEvt;
+ // SdrHitKind eHit=pSdrView->PickAnything(rMEvt,SDRMOUSEBUTTONDOWN,aVEvt);
+ // ... hier Applikationsspezifischer Eingriff ...
+ // pSdrView->DoMouseEvent(aVEvt);
+ // SetPointer(GetPreferedPointer(...))
+ // CaptureMouse(...)
+ void EnableExtendedMouseEventDispatcher(sal_Bool bOn) { bNoExtendedMouseDispatcher = !bOn; }
+ sal_Bool IsExtendedMouseEventDispatcherEnabled() const { return bNoExtendedMouseDispatcher; }
+
+ void EnableExtendedKeyInputDispatcher(sal_Bool bOn) { bNoExtendedKeyDispatcher=!bOn; }
+ sal_Bool IsExtendedKeyInputDispatcherEnabled() const { return bNoExtendedKeyDispatcher; }
+
+ void EnableExtendedCommandEventDispatcher(sal_Bool bOn) { bNoExtendedCommandDispatcher=!bOn; }
+ sal_Bool IsExtendedCommandEventDispatcherEnabled() const { return bNoExtendedCommandDispatcher; }
+
+ void EnableTextEditOnObjectsWithoutTextIfTextTool(sal_Bool bOn) { bTextEditOnObjectsWithoutTextIfTextTool=bOn; }
+ sal_Bool IsEnableTextEditOnObjectsWithoutTextIfTextToolEnabled() const { return bTextEditOnObjectsWithoutTextIfTextTool; }
+
+ void SetMasterPagePaintCaching(sal_Bool bOn);
+ sal_Bool IsMasterPagePaintCaching() const { return mbMasterPagePaintCaching; }
+
+ sal_Bool KeyInput(const KeyEvent& rKEvt, Window* pWin);
+ virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt, Window* pWin);
+ virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt, Window* pWin);
+ virtual sal_Bool MouseMove(const MouseEvent& rMEvt, Window* pWin);
+ virtual sal_Bool Command(const CommandEvent& rCEvt, Window* pWin);
+
+ virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 );
+
+ sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll=sal_False) { return SdrCreateView::SetAttributes(rSet,bReplaceAll); }
+ sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr=sal_False) { return SdrCreateView::SetStyleSheet(pStyleSheet,bDontRemoveHardAttr); }
+
+ /* new interface src537 */
+ sal_Bool GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False) const;
+
+ SfxStyleSheet* GetStyleSheet() const;
+
+ // unvollstaendige Implementation:
+ // Das OutputDevice ist notwendig, damit ich die HandleSize ermitteln kann.
+ // Bei NULL wird das 1. angemeldete Win verwendet.
+ Pointer GetPreferedPointer(const Point& rMousePos, const OutputDevice* pOut, sal_uInt16 nModifier=0, sal_Bool bLeftDown=sal_False) const;
+ SdrHitKind PickAnything(const MouseEvent& rMEvt, sal_uInt16 nMouseDownOrMoveOrUp, SdrViewEvent& rVEvt) const;
+ SdrHitKind PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) const;
+ sal_Bool DoMouseEvent(const SdrViewEvent& rVEvt);
+ virtual SdrViewContext GetContext() const;
+
+ // Die Methoden beruecksichtigen den jeweiligen Kontex:
+ // - Einfaches Zeichnen
+ // - Punktbearbeitungs-Mode
+ // - Klebepunkt-Editmode
+ // - TextEdit
+ // - ... to be continued
+ sal_Bool IsMarkPossible() const;
+ void MarkAll();
+ void UnmarkAll();
+ sal_Bool IsAllMarked() const;
+ sal_Bool IsAllMarkPrevNextPossible() const; // das geht naemlich nicht bei TextEdit!
+ sal_Bool MarkNext(sal_Bool bPrev=sal_False);
+ sal_Bool MarkNext(const Point& rPnt, sal_Bool bPrev=sal_False);
+
+ const Rectangle& GetMarkedRect() const;
+ void SetMarkedRect(const Rectangle& rRect);
+
+ virtual void DeleteMarked();
+ sal_Bool IsDeleteMarkedPossible() const;
+ sal_Bool IsDeletePossible() const { return IsDeleteMarkedPossible(); }
+
+ // Markieren von Objekten, Polygonpunkten oder Klebepunkten (je nach View-
+ // Kontext) durch Aufziehen eines Selektionsrahmens.
+ // bAddMark=TRUE: zur bestehenden Selektion hinzumarkieren (->Shift)
+ // bUnmark=TRUE: Bereits selektierte Objekte/Punkte/Klebepunkte die innerhalb
+ // des aufgezogenen Rahmens liegen werden deselektiert.
+ sal_Bool BegMark(const Point& rPnt, sal_Bool bAddMark=sal_False, sal_Bool bUnmark=sal_False);
+
+ // Folgende Actions sind moeglich:
+ // - ObjectCreating
+ // - ObjectMarking
+ // - Object-specific dragging
+ // - General dragging
+ // und mehr...
+ String GetStatusText();
+
+ SvtAccessibilityOptions& getAccessibilityOptions();
+
+ virtual void onAccessibilityOptionsChanged();
+};
+
+#endif //_SVDVIEW_HXX
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// Die App macht sich zunaechst ein SdrModel.
+// Anschliessend oeffnet sie ein Win und erzeugt dann eine SdrView.
+// An der SdrView meldet sie dann mit der Methode ShowSdrPage() eine Seite an.
+// Eine SdrView kann in beliebig vielen Fenstern gleichzeitig angezeigt werden.
+// Intern:
+// Eine SdrView kann beliebig viele Seiten gleichzeitig anzeigen. Seiten
+// werden an- und abgemeldet mit ShowSdrPage()/HideSdrPage(). Fuer jede angemeldete
+// Seite wird eine SdrPageView-Instanz im Container aPages angelegt. Bei
+// gleichzeitiger Anzeige mehrerer Seiten ist darauf zu achten, dass der Offset-
+// Parameter von ShowSdrPage() der Seitengroesse angepasst ist, da sich sonst die
+// Seiten ueberlappen koennten.
+//
+// Elementare Methoden:
+// ~~~~~~~~~~~~~~~~~~~~
+// Einfache Events:
+// ~~~~~~~~~~~~~~~~
+// sal_Bool KeyInput(const KeyEvent& rKEvt, Window* pWin);
+// sal_Bool MouseButtonDown(const MouseEvent& rMEvt, Window* pWin);
+// sal_Bool MouseButtonUp(const MouseEvent& rMEvt, Window* pWin);
+// sal_Bool MouseMove(const MouseEvent& rMEvt, Window* pWin);
+// sal_Bool Command(const CommandEvent& rCEvt, Window* pWin);
+//
+// Exchange (Clipboard derzeit noch ohne SdrPrivateData):
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// sal_Bool Cut(sal_uIntPtr nFormat=SDR_ANYFORMAT);
+// sal_Bool Yank(sal_uIntPtr nFormat=SDR_ANYFORMAT);
+// sal_Bool Paste(Window* pWin=NULL, sal_uIntPtr nFormat=SDR_ANYFORMAT);
+//
+// SfxItems:
+// ~~~~~~~~~
+// sal_Bool GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False) const;
+// sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll);
+// SfxStyleSheet* GetStyleSheet() const;
+// sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr);
+//
+// Sonstiges:
+// ~~~~~~~~~~
+// Pointer GetPreferedPointer(const Point& rMousePos, const OutputDevice* pOut, sal_uInt16 nTol=0) const;
+// String GetStatusText();
+//
+///////////////////////////////////////////////////////////////////////////////////////////////// */
+
diff --git a/svx/inc/svx/svdviter.hxx b/svx/inc/svx/svdviter.hxx
new file mode 100644
index 000000000000..884733bc2d84
--- /dev/null
+++ b/svx/inc/svx/svdviter.hxx
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDVITER_HXX
+#define _SVDVITER_HXX
+
+#include <tools/solar.h>
+#include <sal/types.h>
+#include "svx/svxdllapi.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class OutputDevice;
+class Window;
+class SdrView;
+class SdrPageView;
+class SdrModel;
+class SdrPage;
+class SdrObject;
+class SetOfByte;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class SVX_DLLPUBLIC SdrViewIter
+{
+ const SdrModel* mpModel;
+ const SdrPage* mpPage;
+ const SdrObject* mpObject;
+ SdrView* mpAktView;
+
+ sal_uInt32 mnListenerNum;
+ sal_uInt32 mnPageViewNum;
+ sal_uInt32 mnOutDevNum;
+
+ // bitfield
+ unsigned mbNoMasterPage : 1;
+
+private:
+ SVX_DLLPRIVATE void ImpInitVars();
+ SVX_DLLPRIVATE SdrView* ImpFindView();
+ SVX_DLLPRIVATE SdrPageView* ImpFindPageView();
+ SVX_DLLPRIVATE OutputDevice* ImpFindOutDev();
+ SVX_DLLPRIVATE Window* ImpFindWindow();
+ SVX_DLLPRIVATE sal_Bool ImpCheckPageView(SdrPageView* pPV) const;
+
+public:
+ SdrViewIter(const SdrModel* pModel);
+ SdrViewIter(const SdrPage* pPage, sal_Bool bNoMasterPage = sal_False);
+ SdrViewIter(const SdrObject* pObject, sal_Bool bNoMasterPage = sal_False);
+
+ SdrView* FirstView();
+ SdrView* NextView();
+
+ SdrPageView* FirstPageView();
+ SdrPageView* NextPageView();
+
+ OutputDevice* FirstOutDev();
+ OutputDevice* NextOutDev();
+
+ Window* FirstWindow();
+ Window* NextWindow();
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifdef _JUST_DESCRIPTION
+
+Mit dieser Klasse kann man rausbekommen:
+- SdrView* First/NextView()
+ - Alle Views in denen ein Models dargestellt wird
+ - Alle Views in denen eine bestimme Page sichtbar ist (ww. auch als MasterPage)
+ - Alle Views in denen ein bestimmes Objekt sichtbar ist (ww. auch auf MasterPage)
+- SdrPageView* First/NextPageView()
+ - Alle PageViews in denen ein Models dargestellt wird
+ - Alle PageViews in denen eine bestimme Page sichtbar ist (ww. auch als MasterPage)
+ - Alle PageViews in denen ein bestimmes Objekt sichtbar ist (ww. auch auf MasterPage)
+- OutputDevice* First/NextOutDev()
+ - Alle OutputDevices in denen ein Models dargestellt wird
+ - Alle OutputDevices in denen eine bestimme Page sichtbar ist (ww. auch als MasterPage)
+ - Alle OutputDevices in denen ein bestimmes Objekt sichtbar ist (ww. auch auf MasterPage)
+- Window* First/NextWindow()
+ - Alle Windows in denen ein Models dargestellt wird
+ - Alle Windows in denen eine bestimme Page sichtbar ist (auch als MasterPage)
+ - Alle Windows in denen ein bestimmes Objekt sichtbar ist (auch auf MasterPage)
+Ob die Auswahl auf ein(e) bestimmte(s) Page/Objekt beschraenkt wird, bestimmt man
+durch die Wahl des Konstruktors.
+
+Es werden u.a. auch berueksichtigt:
+- Layer Sichtbarkeitsstatus
+- Visible Layer von MasterPages
+- Mehrfachlayer bei Gruppenobjekten
+
+Es wird nicht berueksichtigt:
+- Ob die Pages/Objekte wirklich schon gepaintet wurden oder noch ein Invalidate ansteht, ...
+- Ob die Pages/Objekte in einem Window im sichtbaren Bereich liegen
+
+#endif // _JUST_DESCRIPTION
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDVITER_HXX
+
diff --git a/svx/inc/svx/svdxcgv.hxx b/svx/inc/svx/svdxcgv.hxx
new file mode 100644
index 000000000000..f600ec5d7bc6
--- /dev/null
+++ b/svx/inc/svx/svdxcgv.hxx
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDXCGV_HXX
+#define _SVDXCGV_HXX
+
+#include <svx/svdedxv.hxx>
+
+#ifndef _GDIMTF_HXX //autogen
+#include <vcl/gdimtf.hxx>
+#endif
+#include "svx/svxdllapi.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@@ @@ @@ @@@@ @@ @@ @@@@ @@ @@ @@@@ @@@@@ @@ @@ @@ @@@@@ @@ @@
+// @@ @@@ @@@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@@@@ @@ @@ @@ @@ @@ @@@@@@ @@ @@ @@ @@ @@ @@ @@ @ @@
+// @@@@ @@@ @@ @@@@@@ @@@@@@ @@@@@@ @@ @@@ @@@@ @@@@@ @@ @@@@ @@@@@@@
+// @@ @@@@@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@ @@@ @@ @@ @@@@@@@
+// @@ @@@ @@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@
+// @@@@@ @@ @@ @@@@ @@ @@ @@ @@ @@ @@ @@@@@ @@@@@ @ @@ @@@@@ @@ @@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class SVX_DLLPUBLIC SdrExchangeView: public SdrObjEditView
+{
+ friend class SdrPageView;
+
+protected:
+
+ void ImpGetPasteObjList(Point& rPos, SdrObjList*& rpLst);
+ void ImpPasteObject(SdrObject* pObj, SdrObjList& rLst, const Point& rCenter, const Size& rSiz, const MapMode& rMap, sal_uInt32 nOptions);
+ sal_Bool ImpGetPasteLayer(const SdrObjList* pObjList, SdrLayerID& rLayer) const;
+ Point GetPastePos(SdrObjList* pLst, OutputDevice* pOut=NULL);
+
+ // liefert True, wenn rPt geaendert wurde
+ sal_Bool ImpLimitToWorkArea(Point& rPt) const;
+
+protected:
+ // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
+ SdrExchangeView(SdrModel* pModel1, OutputDevice* pOut = 0L);
+
+public:
+ // Alle markierten Objekte auf dem angegebenen OutputDevice ausgeben.
+ virtual void DrawMarkedObj(OutputDevice& rOut) const;
+
+ // Z.B. fuer's Clipboard, Drag&Drop, ...
+ // Alle markierten Objekte in ein Metafile stecken. Z.Zt. noch etwas
+ // buggee (Offset..., Fremdgrafikobjekte (SdrGrafObj), Virtuelle
+ // Objektkopien (SdrVirtObj) mit Ankerpos<>(0,0)).
+ virtual GDIMetaFile GetMarkedObjMetaFile(sal_Bool bNoVDevIfOneMtfMarked=sal_False) const;
+
+ // Alle markierten Objekte auf eine Bitmap malen. Diese hat die Farbtiefe
+ // und Aufloesung des Bildschirms.
+ virtual Bitmap GetMarkedObjBitmap(sal_Bool bNoVDevIfOneBmpMarked=sal_False) const;
+
+ // Alle markierten Objekte in ein neues Model kopieren. Dieses neue Model
+ // hat dann genau eine Page. Das Flag PageNotValid an diesem Model ist
+ // gesetzt. Daran ist zu erkennen, dass nur die Objekte der Page Gueltikeit
+ // haben, die Page sebst jedoch nicht (Seitengroesse, Raender). Das neue
+ // Model wird auf dem Heap erzeugt und wird an den Aufrufer dieser Methode
+ // uebergeben. Dieser hat es dann spaeter zu entsorgen.
+ // Beim einfuegen der markierten Objekte in die eine Page des neuen Model
+ // findet ein Merging der seitenlokalen Layer statt. Sollte kein Platz mehr
+ // fuer weitere seitenlokale Layer sein, wird den entsprechenden Objekten
+ // der Default-Layer zugewiesen (Layer 0, (dokumentglobaler Standardlayer).
+ virtual SdrModel* GetMarkedObjModel() const;
+
+ GDIMetaFile GetAllMarkedMetaFile(sal_Bool bNoVDevIfOneMtfMarked=sal_False) const { return GetMarkedObjMetaFile(bNoVDevIfOneMtfMarked); }
+ Bitmap GetAllMarkedBitmap(sal_Bool bNoVDevIfOneBmpMarked=sal_False) const { return GetMarkedObjBitmap(bNoVDevIfOneBmpMarked); }
+ Graphic GetAllMarkedGraphic() const;
+ SdrModel* GetAllMarkedModel() const { return GetMarkedObjModel(); }
+
+ /** Generate a Graphic for the given draw object in the given model
+
+ @param pModel
+ Must not be NULL. Denotes the draw model the object is a part
+ of.
+
+ @param pObj
+ The object (can also be a group object) to retrieve a Graphic
+ for. Must not be NULL.
+
+ @return a graphical representation of the given object, as it
+ appears on screen (e.g. with rotation, if any, applied).
+ */
+ static Graphic GetObjGraphic( const SdrModel* pModel, const SdrObject* pObj );
+
+ // Bestimmung des View-Mittelpunktes, z.B. zum Pasten
+ Point GetViewCenter(const OutputDevice* pOut=NULL) const;
+
+ // Bei allen Paste-Methoden werden die neuen Draw-Objekte markiert.
+ // Wird der Parameter bAddMark auf sal_True gesetzt, so werden die neuen
+ // DrawObjekte zu einer bereits bestehenden Selektion "hinzumarkiert".
+ // Dieser Fall ist fuer Drag&Drop mit mehreren Items gedacht.
+ // Die Methoden mit Point-Parameter fuegen neue Objekte zentriert an
+ // dieser Position ein, die anderen zentriert am 1.OutputDevice der View.
+ // Ist der Parameter pPg gesetzt, werden die Objekte and dieser Seite
+ // eingefuegt. Die Positionierung (rPos bzw. Zentrierung) bezieht sich
+ // dann nichtmehr auf die View sondern auf die Page.
+ // Hinweis: SdrObjList ist Basisklasse von SdrPage.
+ // Die Methoden liefern sal_True, wenn die Objekte erfolgreich erzeugt und
+ // eingefuegt wurden. Bei pLst=sal_False und kein TextEdit aktiv kann man
+ // sich dann auch darauf verlassen, dass diese an der View markiert sind.
+ // Andernfalls erfolgt die Markierung nur, wenn pLst z.Zt. auch an der
+ // View angezeigt wird.
+ // Gueltige Werte fuer nOptions sind SDRINSERT_DONTMARK und
+ // SDRINSERT_ADDMARK (siehe svdedtv.hxx).
+ sal_Bool Paste(const GDIMetaFile& rMtf, SdrObjList* pLst=NULL, OutputDevice* pOut=NULL, sal_uInt32 nOptions=0) { return Paste(rMtf,GetPastePos(pLst,pOut),pLst,nOptions); }
+ sal_Bool Paste(const GDIMetaFile& rMtf, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
+ sal_Bool Paste(const Bitmap& rBmp, SdrObjList* pLst=NULL, OutputDevice* pOut=NULL, sal_uInt32 nOptions=0) { return Paste(rBmp,GetPastePos(pLst,pOut),pLst,nOptions); }
+ sal_Bool Paste(const Bitmap& rBmp, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
+ sal_Bool Paste(const SdrModel& rMod, SdrObjList* pLst=NULL, OutputDevice* pOut=NULL, sal_uInt32 nOptions=0) { return Paste(rMod,GetPastePos(pLst,pOut),pLst,nOptions); }
+ virtual sal_Bool Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
+ sal_Bool Paste(const String& rStr, SdrObjList* pLst=NULL, OutputDevice* pOut=NULL, sal_uInt32 nOptions=0) { return Paste(rStr,GetPastePos(pLst,pOut),pLst,nOptions); }
+ sal_Bool Paste(const String& rStr, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
+ // der sal_uInt16 eFormat nimmt Werte des enum EETextFormat entgegen
+ sal_Bool Paste(SvStream& rInput, const String& rBaseURL, sal_uInt16 eFormat, SdrObjList* pLst=NULL, OutputDevice* pOut=NULL, sal_uInt32 nOptions=0) { return Paste(rInput,rBaseURL,eFormat,GetPastePos(pLst,pOut),pLst,nOptions); }
+ sal_Bool Paste(SvStream& rInput, const String& rBaseURL, sal_uInt16 eFormat, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
+
+ // Feststellen, ob ein bestimmtes Format ueber Drag&Drop bzw. ueber's
+ // Clipboard angenommen werden kann.
+ sal_Bool IsExchangeFormatSupported(sal_uIntPtr nFormat) const;
+
+ sal_Bool Cut( sal_uIntPtr nFormat = SDR_ANYFORMAT );
+ void CutMarked( sal_uIntPtr nFormat=SDR_ANYFORMAT );
+
+ sal_Bool Yank( sal_uIntPtr nFormat = SDR_ANYFORMAT );
+ void YankMarked( sal_uIntPtr nFormat=SDR_ANYFORMAT );
+
+ sal_Bool Paste( Window* pWin = NULL, sal_uIntPtr nFormat = SDR_ANYFORMAT );
+ sal_Bool PasteClipboard( OutputDevice* pOut = NULL, sal_uIntPtr nFormat = SDR_ANYFORMAT, sal_uInt32 nOptions = 0 );
+};
+
+#endif //_SVDXCGV_HXX
diff --git a/svx/inc/svx/svimbase.hxx b/svx/inc/svx/svimbase.hxx
new file mode 100644
index 000000000000..4ed98e229a32
--- /dev/null
+++ b/svx/inc/svx/svimbase.hxx
@@ -0,0 +1,212 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVIMBASE_HXX
+#define _SVIMBASE_HXX
+
+#include <vcl/bitmap.hxx>
+#include <vcl/salbtype.hxx>
+
+
+// -----------
+// - Defines -
+// -----------
+
+#define _SVHUGE
+
+// ----------------
+// - SimDepthType -
+// ----------------
+
+enum SimDepthType
+{
+ SIM_DEPTH_1,
+ SIM_DEPTH_4,
+ SIM_DEPTH_8,
+ SIM_DEPTH_24
+};
+
+// ------------
+// - SimColor -
+// ------------
+
+struct SimColor
+{
+ sal_uInt8 cBlue;
+ sal_uInt8 cGreen;
+ sal_uInt8 cRed;
+};
+
+// ------------------------------------------------------------------------
+
+inline sal_Bool operator==( const SimColor& rCol1, const SimColor& rCol2 )
+{
+ return ( ( rCol1.cRed == rCol2.cRed ) &&
+ ( rCol1.cGreen == rCol2.cGreen ) &&
+ ( rCol1.cBlue == rCol2.cBlue ) );
+}
+
+// --------------
+// - SimPalette -
+// --------------
+
+struct SimPalette
+{
+ sal_uIntPtr nColors;
+ SimColor aColorArray[ 256 ];
+};
+
+// ---------------
+// - SvImageBase -
+// ---------------
+
+class SfxViewFrame;
+class SfxProgress;
+
+class SvImageBase
+{
+private:
+
+ Bitmap aOutBitmap;
+ HPBYTE pArray1;
+ HPBYTE pArray2;
+ HPBYTE pArray3;
+ HPBYTE pArray4;
+ HPBYTE pOrgArray;
+ HPBYTE pDestArray;
+ SimPalette* pPal1;
+ SimPalette* pPal2;
+ SimPalette* pPal3;
+ SimPalette* pPal4;
+ sal_uIntPtr nWidth1;
+ sal_uIntPtr nWidth2;
+ sal_uIntPtr nWidth3;
+ sal_uIntPtr nWidth4;
+ sal_uIntPtr nHeight1;
+ sal_uIntPtr nHeight2;
+ sal_uIntPtr nHeight3;
+ sal_uIntPtr nHeight4;
+ sal_uIntPtr nAlignedWidth1;
+ sal_uIntPtr nAlignedWidth2;
+ sal_uIntPtr nAlignedWidth3;
+ sal_uIntPtr nAlignedWidth4;
+ sal_uIntPtr nWhichOrg;
+ SimDepthType eOrgDepth;
+ SimDepthType eUndoDepth;
+ SimDepthType eRedoDepth;
+ sal_Bool bIsUndo;
+ sal_Bool bIsRedo;
+ sal_Bool bCreateUndo;
+ sal_Bool bValid;
+ sal_Bool bDitherAll;
+
+ HPBYTE BitmapToArray24( const Bitmap& rBitmap, sal_uIntPtr* pWidth,
+ sal_uIntPtr* pHeight, sal_uIntPtr* pAlignedWidth,
+ SfxViewFrame *pFrame = NULL );
+ sal_Bool Array24ToBitmap( HPBYTE pArray, Bitmap &rBitmap,
+ const sal_uIntPtr nWidth, const sal_uIntPtr nHeight,
+ const sal_uIntPtr nColorCount = 256,
+ sal_uIntPtr nLast = 0, SfxProgress* pProgress = NULL );
+
+ Bitmap CreateSaveBitmap( const SimDepthType eDepth, SfxViewFrame *pFrame = NULL );
+
+ HPBYTE CreateArray24( sal_uIntPtr nWidth, sal_uIntPtr nHeight );
+ void DeleteArray( HPBYTE pArray );
+
+ SvImageBase(const SvImageBase& rSvImageBase);
+ const SvImageBase& operator=(const SvImageBase& rSvImageBase);
+
+public:
+
+ SvImageBase();
+ SvImageBase( const Bitmap& rBitmap,
+ const sal_uIntPtr nColorCount = 256,
+ sal_uIntPtr nLast = 0, SfxProgress* pProgress = NULL );
+ ~SvImageBase();
+
+ sal_Bool IsValid() { return bValid; }
+
+ sal_uIntPtr GetOrgWidth() const { return nWhichOrg == 1 ? nWidth1 : nWidth2; }
+ sal_uIntPtr GetDestWidth() const { return nWhichOrg == 1 ? nWidth2 : nWidth1; }
+
+ sal_uIntPtr GetOrgHeight() const { return nWhichOrg == 1 ? nHeight1 : nHeight2; }
+ sal_uIntPtr GetDestHeight() const { return nWhichOrg == 1 ? nHeight2 : nHeight1; }
+
+ sal_uIntPtr GetOrgAlignedWidth() const { return nWhichOrg == 1 ? nAlignedWidth1 : nAlignedWidth2; }
+ sal_uIntPtr GetDestAlignedWidth() const { return nWhichOrg == 1 ? nAlignedWidth2 : nAlignedWidth1; }
+
+ sal_uIntPtr GetOrgAlignedSize() const { return GetOrgAlignedWidth() * GetOrgHeight(); }
+ sal_uIntPtr GetDestAlignedSize() const { return GetDestAlignedWidth() * GetDestHeight(); }
+
+ // Farbtiefe des Ausgangsbildes ermitteln und setzen
+ SimDepthType GetDepth() const { return eOrgDepth; }
+ void SetDepth( const SimDepthType eDepth ) { eOrgDepth = eDepth; }
+
+ // Farbtiefen nach Undo und Redo ermitteln und setzen
+ SimDepthType GetUndoDepth() const { return eUndoDepth; }
+ void SetUndoDepth(const SimDepthType eDepth) { eUndoDepth = eDepth; }
+
+ SimDepthType GetRedoDepth() const { return eRedoDepth; }
+ void SetRedoDepth(const SimDepthType eDepth) { eRedoDepth = eDepth; }
+
+ // Vor- und Ruecklauf der Bildverarbeitung
+ sal_Bool BeginProcessing( sal_Bool bUndo = sal_True );
+ void EndProcessing();
+
+ sal_Bool BeginProcessingExt(sal_uIntPtr nWidth, sal_uIntPtr nHeight, sal_Bool bUndo = sal_True);
+ void EndProcessingExt() { EndProcessing(); }
+
+ // Zeiger auf Arrays zur Verfuegung stellen
+ HPBYTE GetOrgPointer() { return pOrgArray; }
+ HPBYTE GetDestPointer() { return pDestArray; }
+
+ // DIB-Erzeugung fuer Anzeige
+ sal_Bool CreateOutBitmap( const sal_uIntPtr nColorCount = 256, sal_uIntPtr nLast = 0,
+ SfxProgress* pProgress = NULL );
+
+ // Undo-Verwaltung
+ sal_Bool DoUndo( SfxProgress* pProgress = NULL );
+ sal_Bool DoRedo( SfxProgress* pProgress = NULL );
+
+ // DIB-Rueckgabe fuer Anzeige
+ const Bitmap& GetOutBitmap() const;
+
+ // DIB-Rueckgabe fuer Speicherung
+ Bitmap GetSaveBitmap();
+
+ // Palette besorgen
+ SimPalette* GetOrgPalette() const { return nWhichOrg == 1 ? pPal1 : pPal2; }
+ SimPalette* GetDestPalette() const { return nWhichOrg == 1 ? pPal2 : pPal1; }
+};
+
+// ----------------
+// - DitherBitmap -
+// ----------------
+
+sal_Bool DitherBitmap( Bitmap& rBitmap, sal_Bool bDitherAlways = sal_False );
+
+#endif // _SVIMBASE_HXX
diff --git a/svx/inc/svx/svx3ditems.hxx b/svx/inc/svx/svx3ditems.hxx
new file mode 100644
index 000000000000..16a56f84b864
--- /dev/null
+++ b/svx/inc/svx/svx3ditems.hxx
@@ -0,0 +1,377 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX3DITEMS_HXX
+#define _SVX3DITEMS_HXX
+
+#include <svl/intitem.hxx>
+#include <svl/eitem.hxx>
+
+
+#include <editeng/colritem.hxx>
+#include <svx/e3ditem.hxx>
+#include <svx/viewpt3d.hxx>
+#include <svx/svddef.hxx>
+#include "svx/svxdllapi.h"
+
+// Svx3D _3DOBJ_ Items
+class SVX_DLLPUBLIC Svx3DPercentDiagonalItem : public SfxUInt16Item {
+public:
+ Svx3DPercentDiagonalItem(sal_uInt16 nVal = 10);
+};
+
+class Svx3DBackscaleItem : public SfxUInt16Item {
+public:
+ SVX_DLLPUBLIC Svx3DBackscaleItem(sal_uInt16 nVal = 100);
+};
+
+class Svx3DDepthItem : public SfxUInt32Item {
+public:
+ SVX_DLLPUBLIC Svx3DDepthItem(sal_uInt32 nVal = 1000);
+};
+
+class SVX_DLLPUBLIC Svx3DHorizontalSegmentsItem : public SfxUInt32Item {
+public:
+ Svx3DHorizontalSegmentsItem(sal_uInt32 nVal = 24);
+};
+
+class Svx3DVerticalSegmentsItem : public SfxUInt32Item {
+public:
+ SVX_DLLPUBLIC Svx3DVerticalSegmentsItem(sal_uInt32 nVal = 24);
+};
+
+class Svx3DEndAngleItem : public SfxUInt32Item {
+public:
+ SVX_DLLPUBLIC Svx3DEndAngleItem(sal_uInt32 nVal = 3600);
+};
+
+class SVX_DLLPUBLIC Svx3DDoubleSidedItem : public SfxBoolItem {
+public:
+ Svx3DDoubleSidedItem(sal_Bool bVal = 0);
+};
+
+// #i28528#
+// Added extra Item (Bool) for chart2 to be able to show reduced line geometry
+class Svx3DReducedLineGeometryItem : public SfxBoolItem {
+public:
+ Svx3DReducedLineGeometryItem(sal_Bool bVal = 0);
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nItemVersion) const;
+ virtual sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion) const;
+};
+
+class SVX_DLLPUBLIC Svx3DNormalsKindItem : public SfxUInt16Item {
+public:
+ Svx3DNormalsKindItem(sal_uInt16 nVal = 0);
+
+ // use drawing::NormalsKind
+ SVX_DLLPRIVATE virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ SVX_DLLPRIVATE virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+ SVX_DLLPRIVATE virtual SfxPoolItem* Clone(SfxItemPool* pPool = NULL) const;
+};
+
+class Svx3DNormalsInvertItem : public SfxBoolItem {
+public:
+ SVX_DLLPUBLIC Svx3DNormalsInvertItem(sal_Bool bVal = 0);
+};
+
+class SVX_DLLPUBLIC Svx3DTextureProjectionXItem : public SfxUInt16Item {
+public:
+ Svx3DTextureProjectionXItem(sal_uInt16 nVal = 0);
+
+ // use drawing::TextureProjectionMode
+ SVX_DLLPRIVATE virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ SVX_DLLPRIVATE virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+ SVX_DLLPRIVATE virtual SfxPoolItem* Clone(SfxItemPool* pPool = NULL) const;
+};
+
+class SVX_DLLPUBLIC Svx3DTextureProjectionYItem : public SfxUInt16Item {
+public:
+ Svx3DTextureProjectionYItem(sal_uInt16 nVal = 0);
+
+ // use drawing::TextureProjectionMode
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = NULL) const;
+};
+
+class Svx3DShadow3DItem : public SfxBoolItem {
+public:
+ SVX_DLLPUBLIC Svx3DShadow3DItem(sal_Bool bVal = 0);
+};
+
+class Svx3DMaterialColorItem : public SvxColorItem {
+public:
+ Svx3DMaterialColorItem(const Color& rCol = Color(0x0000b8ff));
+};
+
+class Svx3DMaterialEmissionItem : public SvxColorItem {
+public:
+ SVX_DLLPUBLIC Svx3DMaterialEmissionItem(const Color& rCol = Color(0x00000000));
+};
+
+class Svx3DMaterialSpecularItem : public SvxColorItem {
+public:
+ SVX_DLLPUBLIC Svx3DMaterialSpecularItem(const Color& rCol = Color(0x00ffffff));
+};
+
+class Svx3DMaterialSpecularIntensityItem : public SfxUInt16Item {
+public:
+ SVX_DLLPUBLIC Svx3DMaterialSpecularIntensityItem(sal_uInt16 nVal = 15);
+};
+
+class SVX_DLLPUBLIC Svx3DTextureKindItem : public SfxUInt16Item {
+public:
+ Svx3DTextureKindItem(sal_uInt16 nVal = 3);
+
+ // use drawing::TextureKind
+ SVX_DLLPRIVATE virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ SVX_DLLPRIVATE virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+ SVX_DLLPRIVATE virtual SfxPoolItem* Clone(SfxItemPool* pPool = NULL) const;
+};
+
+class SVX_DLLPUBLIC Svx3DTextureModeItem : public SfxUInt16Item {
+public:
+ Svx3DTextureModeItem(sal_uInt16 nVal = 2);
+
+ // use drawing:TextureMode
+ SVX_DLLPRIVATE virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ SVX_DLLPRIVATE virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+ SVX_DLLPRIVATE virtual SfxPoolItem* Clone(SfxItemPool* pPool = NULL) const;
+};
+
+class Svx3DTextureFilterItem : public SfxBoolItem {
+public:
+ SVX_DLLPUBLIC Svx3DTextureFilterItem(sal_Bool bVal = 0);
+};
+
+// Svx3D _3DSCENE_ Items
+class SVX_DLLPUBLIC Svx3DPerspectiveItem : public SfxUInt16Item {
+public:
+ Svx3DPerspectiveItem(sal_uInt16 nVal = (sal_uInt16)PR_PERSPECTIVE);
+
+ // use drawing::ProjectionMode
+ SVX_DLLPRIVATE virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ SVX_DLLPRIVATE virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+ SVX_DLLPRIVATE virtual SfxPoolItem* Clone(SfxItemPool* pPool = NULL) const;
+};
+
+class Svx3DDistanceItem : public SfxUInt32Item {
+public:
+ SVX_DLLPUBLIC Svx3DDistanceItem(sal_uInt32 nVal = 100);
+};
+
+class Svx3DFocalLengthItem : public SfxUInt32Item {
+public:
+ SVX_DLLPUBLIC Svx3DFocalLengthItem(sal_uInt32 nVal = 100);
+};
+
+class Svx3DTwoSidedLightingItem : public SfxBoolItem {
+public:
+ SVX_DLLPUBLIC Svx3DTwoSidedLightingItem(sal_Bool bVal = 0);
+};
+
+class SVX_DLLPUBLIC Svx3DLightcolor1Item : public SvxColorItem {
+public:
+ Svx3DLightcolor1Item(const Color& rCol = Color(0xffcccccc));
+};
+
+class SVX_DLLPUBLIC Svx3DLightcolor2Item : public SvxColorItem {
+public:
+ Svx3DLightcolor2Item(const Color& rCol = Color(0x00000000));
+};
+
+class SVX_DLLPUBLIC Svx3DLightcolor3Item : public SvxColorItem {
+public:
+ Svx3DLightcolor3Item(const Color& rCol = Color(0x00000000));
+};
+
+class SVX_DLLPUBLIC Svx3DLightcolor4Item : public SvxColorItem {
+public:
+ Svx3DLightcolor4Item(const Color& rCol = Color(0x00000000));
+};
+
+class SVX_DLLPUBLIC Svx3DLightcolor5Item : public SvxColorItem {
+public:
+ Svx3DLightcolor5Item(const Color& rCol = Color(0x00000000));
+};
+
+class SVX_DLLPUBLIC Svx3DLightcolor6Item : public SvxColorItem {
+public:
+ Svx3DLightcolor6Item(const Color& rCol = Color(0x00000000));
+};
+
+class SVX_DLLPUBLIC Svx3DLightcolor7Item : public SvxColorItem {
+public:
+ Svx3DLightcolor7Item(const Color& rCol = Color(0x00000000));
+};
+
+class SVX_DLLPUBLIC Svx3DLightcolor8Item : public SvxColorItem {
+public:
+ Svx3DLightcolor8Item(const Color& rCol = Color(0x00000000));
+};
+
+class SVX_DLLPUBLIC Svx3DAmbientcolorItem : public SvxColorItem {
+public:
+ Svx3DAmbientcolorItem(const Color& rCol = Color(0x00666666));
+};
+
+class SVX_DLLPUBLIC Svx3DLightOnOff1Item : public SfxBoolItem {
+public:
+ Svx3DLightOnOff1Item(sal_Bool bVal = 1);
+};
+
+class SVX_DLLPUBLIC Svx3DLightOnOff2Item : public SfxBoolItem {
+public:
+ Svx3DLightOnOff2Item(sal_Bool bVal = 0);
+};
+
+class SVX_DLLPUBLIC Svx3DLightOnOff3Item : public SfxBoolItem {
+public:
+ Svx3DLightOnOff3Item(sal_Bool bVal = 0);
+};
+
+class SVX_DLLPUBLIC Svx3DLightOnOff4Item : public SfxBoolItem {
+public:
+ Svx3DLightOnOff4Item(sal_Bool bVal = 0);
+};
+
+class SVX_DLLPUBLIC Svx3DLightOnOff5Item : public SfxBoolItem {
+public:
+ Svx3DLightOnOff5Item(sal_Bool bVal = 0);
+};
+
+class SVX_DLLPUBLIC Svx3DLightOnOff6Item : public SfxBoolItem {
+public:
+ Svx3DLightOnOff6Item(sal_Bool bVal = 0);
+};
+
+class SVX_DLLPUBLIC Svx3DLightOnOff7Item : public SfxBoolItem {
+public:
+ Svx3DLightOnOff7Item(sal_Bool bVal = 0);
+};
+
+class SVX_DLLPUBLIC Svx3DLightOnOff8Item : public SfxBoolItem {
+public:
+ Svx3DLightOnOff8Item(sal_Bool bVal = 0);
+};
+
+class SVX_DLLPUBLIC Svx3DLightDirection1Item : public SvxB3DVectorItem {
+public:
+ Svx3DLightDirection1Item(const basegfx::B3DVector& rVec = basegfx::B3DVector(0.57735026918963, 0.57735026918963, 0.57735026918963));
+};
+
+class SVX_DLLPUBLIC Svx3DLightDirection2Item : public SvxB3DVectorItem {
+public:
+ Svx3DLightDirection2Item(const basegfx::B3DVector& rVec = basegfx::B3DVector(0.0,0.0,1.0));
+};
+
+class SVX_DLLPUBLIC Svx3DLightDirection3Item : public SvxB3DVectorItem {
+public:
+ Svx3DLightDirection3Item(const basegfx::B3DVector& rVec = basegfx::B3DVector(0.0,0.0,1.0));
+};
+
+class SVX_DLLPUBLIC Svx3DLightDirection4Item : public SvxB3DVectorItem {
+public:
+ Svx3DLightDirection4Item(const basegfx::B3DVector& rVec = basegfx::B3DVector(0.0,0.0,1.0));
+};
+
+class SVX_DLLPUBLIC Svx3DLightDirection5Item : public SvxB3DVectorItem {
+public:
+ Svx3DLightDirection5Item(const basegfx::B3DVector& rVec = basegfx::B3DVector(0.0,0.0,1.0));
+};
+
+class SVX_DLLPUBLIC Svx3DLightDirection6Item : public SvxB3DVectorItem {
+public:
+ Svx3DLightDirection6Item(const basegfx::B3DVector& rVec = basegfx::B3DVector(0.0,0.0,1.0));
+};
+
+class SVX_DLLPUBLIC Svx3DLightDirection7Item : public SvxB3DVectorItem {
+public:
+ Svx3DLightDirection7Item(const basegfx::B3DVector& rVec = basegfx::B3DVector(0.0,0.0,1.0));
+};
+
+class SVX_DLLPUBLIC Svx3DLightDirection8Item : public SvxB3DVectorItem {
+public:
+ Svx3DLightDirection8Item(const basegfx::B3DVector& rVec = basegfx::B3DVector(0.0,0.0,1.0));
+};
+
+class Svx3DShadowSlantItem : public SfxUInt16Item {
+public:
+ SVX_DLLPUBLIC Svx3DShadowSlantItem(sal_uInt16 nVal = 0);
+};
+
+class SVX_DLLPUBLIC Svx3DShadeModeItem : public SfxUInt16Item {
+public:
+ Svx3DShadeModeItem(sal_uInt16 nVal = 2);
+
+ // use drawing::ShadeMode
+ SVX_DLLPRIVATE virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ SVX_DLLPRIVATE virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+ SVX_DLLPRIVATE virtual SfxPoolItem* Clone(SfxItemPool* pPool = NULL) const;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// #107245# Item to replace bExtrudeSmoothed and bLatheSmoothed
+class Svx3DSmoothNormalsItem : public SfxBoolItem {
+public:
+ Svx3DSmoothNormalsItem(sal_Bool bVal = 1);
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nItemVersion) const;
+ virtual sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion) const;
+};
+
+// #107245# Item to replace bExtrudeSmoothFrontBack and bLatheSmoothFrontBack
+class Svx3DSmoothLidsItem : public SfxBoolItem {
+public:
+ Svx3DSmoothLidsItem(sal_Bool bVal = 0);
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nItemVersion) const;
+ virtual sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion) const;
+};
+
+// #107245# Item to replace bExtrudeCharacterMode and bLatheCharacterMode
+class Svx3DCharacterModeItem : public SfxBoolItem {
+public:
+ Svx3DCharacterModeItem(sal_Bool bVal = 0);
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nItemVersion) const;
+ virtual sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion) const;
+};
+
+// #107245# Item to replace bExtrudeCloseFront and bLatheCloseFront
+class SVX_DLLPUBLIC Svx3DCloseFrontItem : public SfxBoolItem {
+public:
+ Svx3DCloseFrontItem(sal_Bool bVal = 1);
+ SVX_DLLPRIVATE virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nItemVersion) const;
+ SVX_DLLPRIVATE virtual sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion) const;
+};
+
+// #107245# Item to replace bExtrudeCloseBack and bLatheCloseBack
+class SVX_DLLPUBLIC Svx3DCloseBackItem : public SfxBoolItem {
+public:
+ Svx3DCloseBackItem(sal_Bool bVal = 1);
+ SVX_DLLPRIVATE virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nItemVersion) const;
+ SVX_DLLPRIVATE virtual sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion) const;
+};
+
+#endif // _SVX3DITEMS_HXX
diff --git a/svx/inc/svx/svxcommands.h b/svx/inc/svx/svxcommands.h
new file mode 100644
index 000000000000..01ff0bcd95b2
--- /dev/null
+++ b/svx/inc/svx/svxcommands.h
@@ -0,0 +1,604 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SVX_SVXCOMMANDS_HRC
+#define SVX_SVXCOMMANDS_HRC
+
+#define CMD_SID_INET_DLG ".uno:InternetDialog"
+#define CMD_SID_FM_RECORD_ABSOLUTE ".uno:AbsoluteRecord"
+#define CMD_SID_FM_ADD_FIELD ".uno:AddField"
+#define CMD_SID_FM_ADDTABLE ".uno:AddTable"
+#define CMD_SID_OBJECT_ALIGN_CENTER ".uno:AlignCenter"
+#define CMD_SID_OBJECT_ALIGN_DOWN ".uno:AlignDown"
+#define CMD_SID_OBJECT_ALIGN_LEFT ".uno:ObjectAlignLeft"
+#define CMD_SID_ATTR_PARA_ADJUST ".uno:Alignment"
+#define CMD_SID_OBJECT_ALIGN_MIDDLE ".uno:AlignMiddle"
+#define CMD_SID_OBJECT_ALIGN_RIGHT ".uno:ObjectAlignRight"
+#define CMD_SID_OBJECT_ALIGN_UP ".uno:AlignUp"
+#define CMD_SID_DRAW_ARC ".uno:Arc"
+#define CMD_SID_3D_ASSIGN ".uno:Assign3D"
+#define CMD_SID_FM_AUTOCONTROLFOCUS ".uno:AutoControlFocus"
+#define CMD_SID_FM_AUTOFILTER ".uno:AutoFilter"
+#define CMD_SID_AUTOFORMAT ".uno:AutoFormat"
+#define CMD_SID_TABLE_STYLE ".uno:TableStyle"
+#define CMD_SID_TABLE_STYLE_SETTINGS ".uno:TableStyleSettings"
+#define CMD_SID_TABLEDESIGN ".uno:TableDesign"
+#define CMD_SID_BACKGROUND_COLOR ".uno:BackgroundColor"
+#define CMD_SID_ATTR_BRUSH ".uno:BackgroundPattern"
+#define CMD_SID_BACKGROUND_PATTERN ".uno:BackgroundPatternController"
+#define CMD_SID_DRAW_BEZIER_NOFILL ".uno:Bezier_Unfilled"
+#define CMD_SID_BEZIER_APPEND ".uno:BezierAppend"
+#define CMD_SID_BEZIER_CLOSE ".uno:BezierClose"
+#define CMD_SID_BEZIER_CONVERT ".uno:BezierConvert"
+#define CMD_SID_BEZIER_CUTLINE ".uno:BezierCutLine"
+#define CMD_SID_BEZIER_DELETE ".uno:BezierDelete"
+#define CMD_SID_BEZIER_EDGE ".uno:BezierEdge"
+#define CMD_SID_BEZIER_ELIMINATE_POINTS ".uno:BezierEliminatePoints"
+#define CMD_SID_DRAW_BEZIER_FILL ".uno:BezierFill"
+#define CMD_SID_BEZIER_INSERT ".uno:BezierInsert"
+#define CMD_SID_BEZIER_MOVE ".uno:BezierMove"
+#define CMD_SID_BEZIER_SMOOTH ".uno:BezierSmooth"
+#define CMD_SID_BEZIER_SYMMTR ".uno:BezierSymmetric"
+#define CMD_SID_BEZIERTO ".uno:BezierTo"
+#define CMD_SID_BMPMASK ".uno:BmpMask"
+#define CMD_SID_BMPMASK_EXEC ".uno:BmpMaskExec"
+#define CMD_SID_BMPMASK_PIPETTE ".uno:BmpMaskPipette"
+#define CMD_SID_ATTR_CHAR_WEIGHT ".uno:Bold"
+#define CMD_SID_ATTR_CHAR_LATIN_WEIGHT ".uno:BoldLatin"
+#define CMD_SID_ATTR_CHAR_CJK_WEIGHT ".uno:BoldCJK"
+#define CMD_SID_ATTR_CHAR_CTL_WEIGHT ".uno:BoldCTL"
+#define CMD_SID_BORDER_OBJECT ".uno:Border"
+#define CMD_SID_ATTR_BORDER_INNER ".uno:BorderInner"
+#define CMD_SID_ATTR_BORDER_OUTER ".uno:BorderOuter"
+#define CMD_SID_ATTR_BORDER ".uno:SetBorderStyle"
+#define CMD_SID_FRAME_TO_TOP ".uno:BringToFront"
+#define CMD_SID_DRAW_CAPTION ".uno:DrawCaption"
+#define CMD_SID_ATTR_CHAR_CASEMAP ".uno:CaseMap"
+#define CMD_SID_ATTR_PARA_ADJUST_CENTER ".uno:CenterPara"
+#define CMD_SID_TRANSLITERATE_FULLWIDTH ".uno:ChangeCaseToFullWidth"
+#define CMD_SID_TRANSLITERATE_HALFWIDTH ".uno:ChangeCaseToHalfWidth"
+#define CMD_SID_TRANSLITERATE_HIRAGANA ".uno:ChangeCaseToHiragana"
+#define CMD_SID_TRANSLITERATE_KATAGANA ".uno:ChangeCaseToKatakana"
+#define CMD_SID_TRANSLITERATE_LOWER ".uno:ChangeCaseToLower"
+#define CMD_SID_TRANSLITERATE_UPPER ".uno:ChangeCaseToUpper"
+#define CMD_SID_FM_CHANGECONTROLTYPE ".uno:ChangeControlType"
+#define CMD_SID_ATTR_CHAR_FONT ".uno:CharFontName"
+#define CMD_SID_ATTR_CHAR_LATIN_FONT ".uno:CharFontNameLatin"
+#define CMD_SID_ATTR_CHAR_CJK_FONT ".uno:CharFontNameCJK"
+#define CMD_SID_ATTR_CHAR_CTL_FONT ".uno:CharFontNameCTL"
+#define CMD_SID_INSERT_CHECKBOX ".uno:Checkbox"
+#define CMD_SID_FM_CHECKBOX ".uno:CheckBox"
+#define CMD_SID_CHOOSE_CONTROLS ".uno:ChooseControls"
+#define CMD_SID_CHOOSE_POLYGON ".uno:ChoosePolygon"
+#define CMD_SID_DRAW_CIRCLE ".uno:Circle"
+#define CMD_SID_DRAW_CIRCLE_NOFILL ".uno:Circle_Unfilled"
+#define CMD_SID_DRAW_CIRCLEARC ".uno:CircleArc"
+#define CMD_SID_DRAW_CIRCLECUT ".uno:CircleCut"
+#define CMD_SID_DRAW_CIRCLECUT_NOFILL ".uno:CircleCut_Unfilled"
+#define CMD_SID_DRAW_CIRCLEPIE ".uno:CirclePie"
+#define CMD_SID_DRAW_CIRCLEPIE_NOFILL ".uno:CirclePie_Unfilled"
+#define CMD_SID_OUTLINE_DELETEALL ".uno:ClearOutline"
+#define CMD_SID_ATTR_CHAR_COLOR ".uno:Color"
+#define CMD_SID_COLOR_CONTROL ".uno:ColorControl"
+#define CMD_SID_FM_COMBOBOX ".uno:ComboBox"
+#define CMD_SID_FM_NAVIGATIONBAR ".uno:NavigationBar"
+#define CMD_SID_INSERT_COMBOBOX ".uno:Combobox"
+#define CMD_SID_FM_CONFIG ".uno:Config"
+#define CMD_SID_FM_MORE_CONTROLS ".uno:MoreControls"
+#define CMD_SID_FM_FORM_DESIGN_TOOLS ".uno:FormDesignTools"
+#define CMD_SID_CONTOUR_DLG ".uno:ContourDialog"
+#define CMD_SID_CONTOUR_EXEC ".uno:ContourExecute"
+#define CMD_SID_FM_CTL_PROPERTIES ".uno:ControlProperties"
+#define CMD_SID_FM_CONVERTTO_BUTTON ".uno:ConvertToButton"
+#define CMD_SID_FM_CONVERTTO_CHECKBOX ".uno:ConvertToCheckBox"
+#define CMD_SID_FM_CONVERTTO_COMBOBOX ".uno:ConvertToCombo"
+#define CMD_SID_FM_CONVERTTO_CURRENCY ".uno:ConvertToCurrency"
+#define CMD_SID_FM_CONVERTTO_DATE ".uno:ConvertToDate"
+#define CMD_SID_FM_CONVERTTO_EDIT ".uno:ConvertToEdit"
+#define CMD_SID_FM_CONVERTTO_FILECONTROL ".uno:ConvertToFileControl"
+#define CMD_SID_FM_CONVERTTO_FIXEDTEXT ".uno:ConvertToFixed"
+#define CMD_SID_FM_CONVERTTO_FORMATTED ".uno:ConvertToFormatted"
+#define CMD_SID_FM_CONVERTTO_SCROLLBAR ".uno:ConvertToScrollBar"
+#define CMD_SID_FM_CONVERTTO_SPINBUTTON ".uno:ConvertToSpinButton"
+#define CMD_SID_FM_CONVERTTO_GROUPBOX ".uno:ConvertToGroup"
+#define CMD_SID_FM_CONVERTTO_IMAGEBUTTON ".uno:ConvertToImageBtn"
+#define CMD_SID_FM_CONVERTTO_IMAGECONTROL ".uno:ConvertToImageControl"
+#define CMD_SID_FM_CONVERTTO_LISTBOX ".uno:ConvertToList"
+#define CMD_SID_FM_CONVERTTO_NUMERIC ".uno:ConvertToNumeric"
+#define CMD_SID_FM_CONVERTTO_PATTERN ".uno:ConvertToPattern"
+#define CMD_SID_FM_CONVERTTO_RADIOBUTTON ".uno:ConvertToRadio"
+#define CMD_SID_FM_CONVERTTO_TIME ".uno:ConvertToTime"
+#define CMD_SID_FM_CONVERTTO_NAVIGATIONBAR ".uno:ConvertToNavigationBar"
+#define CMD_SID_FM_COUNTALL ".uno:CountAll"
+#define CMD_SID_FM_CREATE_CONTROL ".uno:CreateControl"
+#define CMD_SID_INSERT_CURRENCYFIELD ".uno:InsertCurrencyField"
+#define CMD_SID_FM_CURRENCYFIELD ".uno:CurrencyField"
+#define CMD_SID_DASH ".uno:Dash"
+#define CMD_SID_INSERT_DATEFIELD ".uno:AddDateField"
+#define CMD_SID_FM_DATEFIELD ".uno:DateField"
+#define CMD_FN_NUM_BULLET_ON ".uno:DefaultBullet"
+#define CMD_SID_FM_RECORD_DELETE ".uno:DeleteRecord"
+#define CMD_SID_FM_DESIGN_MODE ".uno:SwitchControlDesignMode"
+#define CMD_SID_DISTRIBUTE_DLG ".uno:DistributeSelection"
+#define CMD_SID_DRAW_SELECT ".uno:DrawSelect"
+#define CMD_SID_INSERT_DRAW ".uno:InsertDraw"
+#define CMD_SID_DSBROWSER_EXPLORER ".uno:DSBrowserExplorer"
+#define CMD_SID_FM_EDIT ".uno:Edit"
+#define CMD_SID_INSERT_EDIT ".uno:InsertEdit"
+#define CMD_SID_DRAW_ELLIPSE ".uno:Ellipse"
+#define CMD_SID_DRAW_ELLIPSE_NOFILL ".uno:Ellipse_Unfilled"
+#define CMD_SID_DRAW_ELLIPSECUT ".uno:EllipseCut"
+#define CMD_SID_DRAW_ELLIPSECUT_NOFILL ".uno:EllipseCut_Unfilled"
+#define CMD_SID_ENTER_GROUP ".uno:EnterGroup"
+#define CMD_SID_ATTR_CHAR_ESCAPEMENT ".uno:Escapement"
+#define CMD_SID_FM_FIELDS_CONTROL ".uno:FieldController"
+#define CMD_SID_FM_FILECONTROL ".uno:FileControl"
+#define CMD_SID_INSERT_FILECONTROL ".uno:InsertFileControl"
+#define CMD_SID_INSERT_TREECONTROL ".uno:InsertTreeControl"
+#define CMD_SID_ATTR_FILL_BITMAP ".uno:FillBitmap"
+#define CMD_SID_ATTR_FILL_COLOR ".uno:FillColor"
+#define CMD_SID_ATTR_FILL_GRADIENT ".uno:FillGradient"
+#define CMD_SID_ATTR_FILL_HATCH ".uno:FillHatch"
+#define CMD_SID_ATTR_FILL_STYLE ".uno:FillStyle"
+#define CMD_SID_FM_FILTERCRIT ".uno:FilterCrit"
+#define CMD_SID_FM_RECORD_FIRST ".uno:FirstRecord"
+#define CMD_SID_ATTR_FLASH ".uno:Flash"
+#define CMD_SID_FM_FMEXPLORER_CONTROL ".uno:FmExplorerController"
+#define CMD_SID_FM_FILTER_NAVIGATOR_CONTROL ".uno:FmFilterNavigatorController"
+#define CMD_SID_CHAR_DLG ".uno:FontDialog"
+#define CMD_SID_ATTR_CHAR_FONTHEIGHT ".uno:FontHeight"
+#define CMD_SID_ATTR_CHAR_LATIN_FONTHEIGHT ".uno:FontHeighLatin"
+#define CMD_SID_ATTR_CHAR_CJK_FONTHEIGHT ".uno:FontHeightCJK"
+#define CMD_SID_ATTR_CHAR_CTL_FONTHEIGHT ".uno:FontHeightCTL"
+#define CMD_SID_FONTWORK ".uno:FontWork"
+#define CMD_SID_FORMTEXT_ADJUST ".uno:FontWorkTextAdjust"
+#define CMD_SID_FORMTEXT_STDFORM ".uno:FontWorkTextClearAttributes"
+#define CMD_SID_FORMTEXT_DISTANCE ".uno:FontWorkTextDistance"
+#define CMD_SID_FORMTEXT_MIRROR ".uno:FontWorkTextMirror"
+#define CMD_SID_FORMTEXT_OUTLINE ".uno:FontWorkTextOutline"
+#define CMD_SID_FORMTEXT_SHADOW ".uno:FontWorkTextShadow"
+#define CMD_SID_FORMTEXT_SHDWCOLOR ".uno:FontWorkTextShadowColor"
+#define CMD_SID_FORMTEXT_SHDWXVAL ".uno:FontWorkTextShadowXVal"
+#define CMD_SID_FORMTEXT_SHDWYVAL ".uno:FontWorkTextShadowYVal"
+#define CMD_SID_FORMTEXT_START ".uno:FontWorkTextStart"
+#define CMD_SID_FORMTEXT_STYLE ".uno:FontWorkTextStyle"
+#define CMD_SID_ATTRIBUTES_AREA ".uno:FormatArea"
+#define CMD_SID_FORMTEXT_HIDEFORM ".uno:FormatFontWorkClose"
+#define CMD_SID_GROUP ".uno:FormatGroup"
+#define CMD_SID_ATTRIBUTES_LINE ".uno:FormatLine"
+#define CMD_SID_FM_FORMATTEDFIELD ".uno:FormattedField"
+#define CMD_SID_FM_SCROLLBAR ".uno:ScrollBar"
+#define CMD_SID_FM_SPINBUTTON ".uno:SpinButton"
+#define CMD_SID_INSERT_FORMATTEDFIELD ".uno:InsertFormattedField"
+#define CMD_SID_UNGROUP ".uno:FormatUngroup"
+#define CMD_SID_FM_FILTER_START ".uno:FormFilter"
+#define CMD_SID_FM_FORM_FILTERED ".uno:FormFiltered"
+#define CMD_SID_FM_FILTER_EXECUTE ".uno:FormFilterExecute"
+#define CMD_SID_FM_FILTER_EXIT ".uno:FormFilterExit"
+#define CMD_SID_FM_FILTER_NAVIGATOR ".uno:FormFilterNavigator"
+#define CMD_SID_FM_PROPERTIES ".uno:FormProperties"
+#define CMD_SID_DRAW_FREELINE ".uno:Freeline"
+#define CMD_SID_DRAW_FREELINE_NOFILL ".uno:Freeline_Unfilled"
+#define CMD_SID_ATTR_AUTO_COLOR_INVALID ".uno:AutoColorInvalid"
+#define CMD_SID_GALLERY ".uno:Gallery"
+#define CMD_SID_GALLERY_ENABLE_ADDCOPY ".uno:GalleryEnableAddCopy"
+#define CMD_SID_GETREDOSTRINGS ".uno:GetRedoStrings"
+#define CMD_SID_GETUNDOSTRINGS ".uno:GetUndoStrings"
+#define CMD_SID_ATTR_GRAF_CROP ".uno:GrafAttrCrop"
+#define CMD_SID_ATTR_GRAF_BLUE ".uno:GrafBlue"
+#define CMD_SID_ATTR_GRAF_CONTRAST ".uno:GrafContrast"
+#define CMD_SID_ATTR_GRAF_GAMMA ".uno:GrafGamma"
+#define CMD_SID_ATTR_GRAF_GREEN ".uno:GrafGreen"
+#define CMD_SID_ATTR_GRAF_INVERT ".uno:GrafInvert"
+#define CMD_SID_ATTR_GRAF_LUMINANCE ".uno:GrafLuminance"
+#define CMD_SID_ATTR_GRAF_MODE ".uno:GrafMode"
+#define CMD_SID_ATTR_GRAF_RED ".uno:GrafRed"
+#define CMD_SID_ATTR_GRAF_TRANSPARENCE ".uno:GrafTransparence"
+#define CMD_SID_GRFFILTER_INVERT ".uno:GraphicFilterInvert"
+#define CMD_SID_GRFFILTER_MOSAIC ".uno:GraphicFilterMosaic"
+#define CMD_SID_GRFFILTER_POPART ".uno:GraphicFilterPopart"
+#define CMD_SID_GRFFILTER_POSTER ".uno:GraphicFilterPoster"
+#define CMD_SID_GRFFILTER_EMBOSS ".uno:GraphicFilterRelief"
+#define CMD_SID_GRFFILTER_REMOVENOISE ".uno:GraphicFilterRemoveNoise"
+#define CMD_SID_GRFFILTER_SEPIA ".uno:GraphicFilterSepia"
+#define CMD_SID_GRFFILTER_SHARPEN ".uno:GraphicFilterSharpen"
+#define CMD_SID_GRFFILTER_SMOOTH ".uno:GraphicFilterSmooth"
+#define CMD_SID_GRFFILTER_SOBEL ".uno:GraphicFilterSobel"
+#define CMD_SID_GRFFILTER_SOLARIZE ".uno:GraphicFilterSolarize"
+#define CMD_SID_GRFFILTER ".uno:GraphicFilterToolbox"
+#define CMD_SID_FM_DBGRID ".uno:Grid"
+#define CMD_SID_GRID_USE ".uno:GridUse"
+#define CMD_SID_GRID_VISIBLE ".uno:GridVisible"
+#define CMD_SID_OUTLINE_MAKE ".uno:Group"
+#define CMD_SID_FM_GROUPBOX ".uno:GroupBox"
+#define CMD_SID_INSERT_GROUPBOX ".uno:Groupbox"
+#define CMD_SID_RULER_LR_MIN_MAX ".uno:HeaderFooterBorder"
+#define CMD_SID_HELPLINES_MOVE ".uno:HelplinesMove"
+#define CMD_SID_INSERT_HFIXEDLINE ".uno:HFixedLine"
+#define CMD_SID_OUTLINE_HIDE ".uno:HideDetail"
+#define CMD_SID_INSERT_HSCROLLBAR ".uno:HScrollbar"
+#define CMD_SID_HYPERLINK_GETLINK ".uno:Hyperlink"
+#define CMD_SID_FM_IMAGEBUTTON ".uno:Imagebutton"
+#define CMD_SID_FM_IMAGECONTROL ".uno:ImageControl"
+#define CMD_SID_INSERT_IMAGECONTROL ".uno:InsertImageControl"
+#define CMD_SID_IMAP ".uno:ImageMapDialog"
+#define CMD_SID_IMAP_EXEC ".uno:ImageMapExecute"
+#define CMD_SID_3D_INIT ".uno:Init3D"
+#define CMD_SID_OBJECTRESIZE ".uno:InPlaceObjectResize"
+#define CMD_SID_ENTER_STRING ".uno:EnterString"
+#define CMD_SID_INSERT_POSTIT ".uno:InsertAnnotation"
+#define CMD_SID_SHOW_POSTIT ".uno:ShowAnnotations"
+#define CMD_SID_REPLYTO_POSTIT ".uno:ReplyToAnnotation"
+#define CMD_SID_DELETE_POSTIT ".uno:DeleteAnnotation"
+#define CMD_SID_DELETEALL_POSTIT ".uno:DeleteAllAnnotation"
+#define CMD_SID_DELETEALLBYAUTHOR_POSTIT ".uno:DeleteAllAnnotationByAuthor"
+#define CMD_SID_NEXT_POSTIT ".uno:NextAnnotation"
+#define CMD_SID_PREVIOUS_POSTIT ".uno:PreviousAnnotation"
+#define CMD_SID_INSERT_APPLET ".uno:InsertApplet"
+#define CMD_SID_GALLERY_FORMATS ".uno:InsertGalleryPic"
+#define CMD_SID_INSERT_GRAPHIC ".uno:InsertGraphic"
+#define CMD_SID_INSERT_IMAGE ".uno:InsertImage"
+#define CMD_SID_INSERT_MATH ".uno:InsertMath"
+#define CMD_SID_ATTR_INSERT ".uno:InsertMode"
+#define CMD_FN_NUM_NUMBERING_ON ".uno:DefaultNumbering"
+#define CMD_SID_INSERT_OBJECT ".uno:InsertObject"
+#define CMD_SID_INSERT_DIAGRAM ".uno:InsertObjectChart"
+#define CMD_SID_INSERT_PLUGIN ".uno:InsertPlugin"
+#define CMD_SID_INSERT_SOUND ".uno:InsertSound"
+#define CMD_SID_CHARMAP ".uno:InsertSymbol"
+#define CMD_SID_ATTR_TABLE ".uno:InsertSpreadsheet"
+#define CMD_SID_INSERT_TABLE ".uno:InsertTable"
+#define CMD_SID_INSERT_FRAME ".uno:InsertTextFrame"
+#define CMD_SID_INSERT_VIDEO ".uno:InsertVideo"
+#define CMD_SID_POLY_INTERSECT ".uno:Intersect"
+#define CMD_SID_ATTR_CHAR_POSTURE ".uno:Italic"
+#define CMD_SID_ATTR_CHAR_LATIN_POSTURE ".uno:ItalicLatin"
+#define CMD_SID_ATTR_CHAR_CJK_POSTURE ".uno:ItalicCJK"
+#define CMD_SID_ATTR_CHAR_CTL_POSTURE ".uno:ItalicCTL"
+#define CMD_SID_ATTR_PARA_ADJUST_BLOCK ".uno:JustifyPara"
+#define CMD_SID_INSERT_FIXEDTEXT ".uno:InsertFixedText"
+#define CMD_SID_FM_FIXEDTEXT ".uno:Label"
+#define CMD_SID_ATTR_CHAR_LANGUAGE ".uno:Language"
+#define CMD_SID_ATTR_CHAR_LATIN_LANGUAGE ".uno:LanguageLatin"
+#define CMD_SID_FM_RECORD_LAST ".uno:LastRecord"
+#define CMD_SID_FM_LEAVE_CREATE ".uno:LeaveFMCreateMode"
+#define CMD_SID_LEAVE_GROUP ".uno:LeaveGroup"
+#define CMD_SID_ATTR_PARA_ADJUST_LEFT ".uno:LeftPara"
+#define CMD_SID_ATTR_LRSPACE ".uno:LeftRightMargin"
+#define CMD_SID_ATTR_PARA_LRSPACE ".uno:LeftRightParaMargin"
+#define CMD_SID_ATTR_PARA_LRSPACE_VERTICAL ".uno:LeftRightParaMargin_Vertical"
+#define CMD_SID_DRAW_LINE ".uno:Line"
+#define CMD_SID_DRAW_XLINE ".uno:Line_Diagonal"
+#define CMD_SID_FRAME_LINECOLOR ".uno:FrameLineColor"
+#define CMD_SID_ATTR_LINE_DASH ".uno:LineDash"
+#define CMD_SID_ATTR_LINEEND_STYLE ".uno:LineEndStyle"
+#define CMD_SID_ATTR_PARA_LINESPACE ".uno:LineSpacing"
+#define CMD_SID_FRAME_LINESTYLE ".uno:LineStyle"
+#define CMD_SID_ATTR_LINE_WIDTH ".uno:LineWidth"
+#define CMD_SID_FM_LISTBOX ".uno:ListBox"
+#define CMD_SID_INSERT_LISTBOX ".uno:InsertListbox"
+#define CMD_SID_POLY_MERGE ".uno:Merge"
+#define CMD_SID_BASICIDE_NEWJAVAMODULE ".uno:NewJavaModule"
+#define CMD_SID_FM_RECORD_NEW ".uno:NewRecord"
+#define CMD_SID_FM_RECORD_NEXT ".uno:NextRecord"
+#define CMD_SID_FM_NUMERICFIELD ".uno:NumericField"
+#define CMD_SID_INSERT_NUMERICFIELD ".uno:InsertNumericField"
+#define CMD_SID_OBJECT_ALIGN ".uno:ObjectAlign"
+#define CMD_SID_FRAME_DOWN ".uno:ObjectBackOne"
+#define CMD_SID_FRAME_UP ".uno:ObjectForwardOne"
+#define CMD_SID_FM_OPEN_READONLY ".uno:OpenReadOnly"
+#define CMD_SID_FM_ORDERCRIT ".uno:OrderCrit"
+#define CMD_SID_ATTR_PARA_ORPHANS ".uno:Orphan"
+#define CMD_SID_OUTLINE_BULLET ".uno:OutlineBullet"
+#define CMD_SID_OUTLINE_COLLAPSE ".uno:OutlineCollapse"
+#define CMD_SID_OUTLINE_COLLAPSE_ALL ".uno:OutlineCollapseAll"
+#define CMD_SID_OUTLINE_DOWN ".uno:OutlineDown"
+#define CMD_SID_OUTLINE_EXPAND ".uno:OutlineExpand"
+#define CMD_SID_OUTLINE_EXPAND_ALL ".uno:OutlineExpandAll"
+#define CMD_SID_ATTR_CHAR_CONTOUR ".uno:OutlineFont"
+#define CMD_SID_OUTLINE_FORMAT ".uno:OutlineFormat"
+#define CMD_SID_OUTLINE_LEFT ".uno:OutlineLeft"
+#define CMD_SID_OUTLINE_RIGHT ".uno:OutlineRight"
+#define CMD_SID_OUTLINE_UP ".uno:OutlineUp"
+#define CMD_SID_ATTR_PARA_PAGEBREAK ".uno:Pagebreak"
+#define CMD_SID_ATTR_PAGE_PAPERBIN ".uno:PagePaperBin"
+#define CMD_SID_ATTR_PAGE_SIZE ".uno:AttributePageSize"
+#define CMD_SID_ATTR_PARA_MODEL ".uno:AttributeParaModel"
+#define CMD_SID_ATTR_PAGE ".uno:AttributePage"
+#define CMD_SID_ATTR_CHAR_AUTOKERN ".uno:PairKerning"
+#define CMD_SID_PARA_DLG ".uno:ParagraphDialog"
+#define CMD_SID_ATTR_PARA_KEEP ".uno:ParaKeepTogether"
+#define CMD_SID_ATTR_PARA_SPLIT ".uno:ParaSplit"
+#define CMD_SID_INSERT_PATTERNFIELD ".uno:InsertPatternField"
+#define CMD_SID_FM_PATTERNFIELD ".uno:PatternField"
+#define CMD_SID_DRAW_PIE ".uno:Pie"
+#define CMD_SID_DRAW_PIE_NOFILL ".uno:Pie_Unfilled"
+#define CMD_SID_POLY_FORMEN ".uno:PolyFormen"
+#define CMD_SID_DRAW_XPOLYGON ".uno:Polygon_Diagonal"
+#define CMD_SID_DRAW_XPOLYGON_NOFILL ".uno:Polygon_Diagonal_Unfilled"
+#define CMD_SID_DRAW_POLYGON_NOFILL ".uno:Polygon_Unfilled"
+#define CMD_SID_ATTR_POSITION ".uno:Position"
+#define CMD_SID_INSERT_PREVIEW ".uno:Preview"
+#define CMD_SID_FM_RECORD_PREV ".uno:PrevRecord"
+#define CMD_SID_INSERT_PROGRESSBAR ".uno:ProgressBar"
+#define CMD_SID_FM_PROPERTY_CONTROL ".uno:PropertyController"
+#define CMD_SID_FM_PUSHBUTTON ".uno:Pushbutton"
+#define CMD_SID_INSERT_PUSHBUTTON ".uno:InsertPushbutton"
+#define CMD_SID_INSERT_RADIOBUTTON ".uno:Radiobutton"
+#define CMD_SID_FM_RADIOBUTTON ".uno:RadioButton"
+#define CMD_SID_READONLY_MODE ".uno:ReadOnlyMode"
+#define CMD_SID_FM_RECORD_FROM_TEXT ".uno:RecFromText"
+#define CMD_SID_FM_RECORD_SAVE ".uno:RecSave"
+#define CMD_SID_FM_SEARCH ".uno:RecSearch"
+#define CMD_SID_DRAW_RECT ".uno:Rect"
+#define CMD_SID_DRAW_RECT_ROUND ".uno:Rect_Rounded"
+#define CMD_SID_DRAW_RECT_ROUND_NOFILL ".uno:Rect_Rounded_Unfilled"
+#define CMD_SID_DRAW_RECT_NOFILL ".uno:Rect_Unfilled"
+#define CMD_SID_FM_RECORD_TEXT ".uno:RecText"
+#define CMD_SID_FM_RECORD_TOTAL ".uno:RecTotal"
+#define CMD_SID_FM_RECORD_UNDO ".uno:RecUndo"
+#define CMD_SID_FM_REFRESH ".uno:Refresh"
+#define CMD_SID_FM_REFRESH_FORM_CONTROL ".uno:RefreshFormControl"
+#define CMD_SID_FM_FILTER_REMOVE ".uno:RemoveFilter"
+#define CMD_SID_FM_REMOVE_FILTER_SORT ".uno:RemoveFilterSort"
+#define CMD_FID_SEARCH_REPLACESET ".uno:ReplaceSet"
+#define CMD_SID_ATTR_PARA_ADJUST_RIGHT ".uno:RightPara"
+#define CMD_SID_RULER_BORDER_DISTANCE ".uno:RulerBorderDistance"
+#define CMD_SID_RULER_BORDERS ".uno:RulerBorders"
+#define CMD_SID_RULER_BORDERS_VERTICAL ".uno:RulerBordersVertical"
+#define CMD_SID_RULER_NULL_OFFSET ".uno:RulerNullOffset"
+#define CMD_SID_RULER_PAGE_POS ".uno:RulerPagePos"
+#define CMD_SID_RULER_PROTECT ".uno:RulerProtect"
+#define CMD_SID_FM_EXECUTE ".uno:SbaExecuteSql"
+#define CMD_SID_FM_NATIVESQL ".uno:SbaNativeSql"
+#define CMD_SID_SCAN ".uno:Scan"
+#define CMD_SID_SC_EDITOPTIONS ".uno:ScEditOptions"
+#define CMD_SID_SCH_EDITOPTIONS ".uno:SchEditOptions"
+#define CMD_SID_SD_EDITOPTIONS ".uno:SdEditOptions"
+#define CMD_SID_SD_GRAPHIC_OPTIONS ".uno:SdGraphicOptions"
+#define CMD_FID_SEARCH_OFF ".uno:SearchOff"
+#define CMD_FID_SEARCH_ON ".uno:SearchOn"
+#define CMD_FID_SEARCH_SEARCHSET ".uno:SearchSet"
+#define CMD_SID_SELECT ".uno:Select"
+#define CMD_SID_FRAME_TO_BOTTOM ".uno:SendToBack"
+#define CMD_SID_SET_DEFAULT ".uno:SetDefault"
+#define CMD_SID_HYPERLINK_SETLINK ".uno:SetHyperlink"
+#define CMD_SID_ATTR_PARA_HYPHENZONE ".uno:SetHyphenZone"
+#define CMD_SID_ATTR_LONG_LRSPACE ".uno:SetLongLeftRightMargin"
+#define CMD_SID_ATTR_LONG_ULSPACE ".uno:SetLongTopBottomMargin"
+#define CMD_SID_OBJECT_HELL ".uno:SetObjectToBackground"
+#define CMD_SID_OBJECT_HEAVEN ".uno:SetObjectToForeground"
+#define CMD_SID_ATTR_PAGE_MAXSIZE ".uno:SetPageMaxSize"
+#define CMD_SID_ATTR_BORDER_SHADOW ".uno:BorderShadow"
+#define CMD_SID_ATTR_FILL_SHADOW ".uno:FillShadow"
+#define CMD_SID_ATTR_CHAR_SHADOWED ".uno:Shadowed"
+#define CMD_SID_OUTLINE_SHOW ".uno:ShowDetail"
+#define CMD_SID_FM_SHOW_FMEXPLORER ".uno:ShowFmExplorer"
+#define CMD_SID_SHOW_ITEMBROWSER ".uno:ShowItemBrowser"
+#define CMD_SID_SHOW_PROPERTYBROWSER ".uno:ShowPropBrowser"
+#define CMD_SID_FM_SHOW_PROPERTIES ".uno:ShowProperties"
+#define CMD_SID_FM_SHOW_PROPERTY_BROWSER ".uno:ShowPropertyBrowser"
+#define CMD_SID_RULER ".uno:ShowRuler"
+#define CMD_SID_SIM_EDITOPTIONS ".uno:SimEditOptions"
+#define CMD_SID_ATTR_SIZE ".uno:Size"
+#define CMD_SID_SM_EDITOPTIONS ".uno:SmEditOptions"
+#define CMD_SID_FM_SORTDOWN ".uno:SortDown"
+#define CMD_SID_FM_SORTUP ".uno:Sortup"
+#define CMD_SID_ATTR_PARA_LINESPACE_10 ".uno:SpacePara1"
+#define CMD_SID_ATTR_PARA_LINESPACE_15 ".uno:SpacePara15"
+#define CMD_SID_ATTR_PARA_LINESPACE_20 ".uno:SpacePara2"
+#define CMD_SID_ATTR_CHAR_KERNING ".uno:Spacing"
+#define CMD_SID_AUTOSPELL_CHECK ".uno:SpellOnline"
+#define CMD_SID_INSERT_SPINBUTTON ".uno:Spinbutton"
+#define CMD_SID_DRAW_SQUARE ".uno:Square"
+#define CMD_SID_DRAW_SQUARE_ROUND ".uno:Square_Rounded"
+#define CMD_SID_DRAW_SQUARE_ROUND_NOFILL ".uno:Square_Rounded_Unfilled"
+#define CMD_SID_DRAW_SQUARE_NOFILL ".uno:Square_Unfilled"
+#define CMD_SID_3D_STATE ".uno:State3D"
+#define CMD_SID_ATTR_CHAR_STRIKEOUT ".uno:Strikeout"
+#define CMD_SID_SET_SUB_SCRIPT ".uno:SubScript"
+#define CMD_SID_POLY_SUBSTRACT ".uno:Substract"
+#define CMD_SID_SET_SUPER_SCRIPT ".uno:SuperScript"
+#define CMD_SID_SW_EDITOPTIONS ".uno:SwEditOptions"
+#define CMD_SID_FM_TAB_DIALOG ".uno:TabDialog"
+#define CMD_SID_ATTR_TABSTOP ".uno:Tabstops"
+#define CMD_SID_ATTR_TABSTOP_VERTICAL ".uno:TabstopsVertical"
+#define CMD_SID_DIALOG_TESTMODE ".uno:TestMode"
+#define CMD_SID_ATTR_CHAR ".uno:Text"
+#define CMD_SID_DRAW_TEXT ".uno:DrawText"
+#define CMD_SID_DRAW_TEXT_MARQUEE ".uno:Text_Marquee"
+#define CMD_SID_TEXTDIRECTION_LEFT_TO_RIGHT ".uno:TextdirectionLeftToRight"
+#define CMD_SID_TEXTDIRECTION_TOP_TO_BOTTOM ".uno:TextdirectionTopToBottom"
+#define CMD_SID_ATTR_TEXT_FITTOSIZE ".uno:TextFitToSize"
+#define CMD_SID_THESAURUS ".uno:ThesaurusDialog"
+#define CMD_SID_INSERT_TIMEFIELD ".uno:InsertTimeField"
+#define CMD_SID_FM_TIMEFIELD ".uno:TimeField"
+#define CMD_SID_BEZIER_EDIT ".uno:ToggleObjectBezierMode"
+#define CMD_SID_OBJECT_ROTATE ".uno:ToggleObjectRotateMode"
+#define CMD_SID_TEXTEDIT ".uno:ToolEdit"
+#define CMD_SID_OBJECT_SELECT ".uno:SelectObject"
+#define CMD_SID_ATTR_ULSPACE ".uno:TopBottomMargin"
+#define CMD_SID_ATTR_TRANSFORM ".uno:TransformDialog"
+#define CMD_SID_TWAIN_SELECT ".uno:TwainSelect"
+#define CMD_SID_TWAIN_TRANSFER ".uno:TwainTransfer"
+#define CMD_SID_ATTR_CHAR_UNDERLINE ".uno:Underline"
+#define CMD_SID_ATTR_CHAR_OVERLINE ".uno:Overline"
+#define CMD_SID_OUTLINE_REMOVE ".uno:Ungroup"
+#define CMD_SID_INSERT_URLBUTTON ".uno:URLButton"
+#define CMD_SID_FM_USE_WIZARDS ".uno:UseWizards"
+#define CMD_SID_DRAW_CAPTION_VERTICAL ".uno:VerticalCaption"
+#define CMD_SID_DRAW_TEXT_VERTICAL ".uno:VerticalText"
+#define CMD_SID_INSERT_VFIXEDLINE ".uno:VFixedLine"
+#define CMD_SID_FM_VIEW_AS_GRID ".uno:ViewFormAsGrid"
+#define CMD_SID_INSERT_VSCROLLBAR ".uno:VScrollbar"
+#define CMD_SID_ATTR_PARA_WIDOWS ".uno:Widow"
+#define CMD_SID_3D_WIN ".uno:Window3D"
+#define CMD_SID_ATTR_CHAR_WORDLINEMODE ".uno:WordMode"
+#define CMD_SID_ATTR_LINE_COLOR ".uno:XLineColor"
+#define CMD_SID_ATTR_LINE_STYLE ".uno:XLineStyle"
+#define CMD_SID_ATTR_ZOOM ".uno:Zoom"
+#define CMD_SID_SIZE_REAL ".uno:Zoom100Percent"
+#define CMD_SID_SIZE_OPTIMAL ".uno:ZoomObjects"
+#define CMD_SID_SIZE_ALL ".uno:ZoomOptimal"
+#define CMD_SID_SIZE_PAGE ".uno:ZoomPage"
+#define CMD_SID_SIZE_PAGE_WIDTH ".uno:ZoomPageWidth"
+#define CMD_SID_SIZE_VISAREA ".uno:ZoomVisArea"
+#define CMD_SID_FM_GRABCONTROLFOCUS ".uno:GrabControlFocus"
+#define CMD_SID_FM_CREATE_FIELDCONTROL ".uno:CreateFieldControl"
+#define CMD_SID_INSERT_SELECT ".uno:SelectMode"
+#define CMD_SID_PARA_VERTALIGN ".uno:VerticalParagraphAlignment"
+#define CMD_SID_ATTR_CHAR_RELIEF ".uno:CharacterRelief"
+#define CMD_SID_ATTR_BRUSH_CHAR ".uno:CharacterBackgroundPattern"
+#define CMD_SID_ATTR_CHAR_ROTATED ".uno:CharacterRotation"
+#define CMD_SID_ATTR_CHAR_SCALEWIDTH ".uno:CharacterWidthScalingFactor"
+#define CMD_SID_ATTR_NUMBERFORMAT_VALUE ".uno:NumberFormatValue"
+#define CMD_SID_ATTR_ALIGN_HOR_JUSTIFY ".uno:HorizontalJustification"
+#define CMD_SID_ATTR_ALIGN_VER_JUSTIFY ".uno:VerticalJustification"
+#define CMD_SID_ATTR_ALIGN_INDENT ".uno:AlignmentIndent"
+#define CMD_SID_ATTR_ALIGN_HYPHENATION ".uno:AlignmentHyphenation"
+#define CMD_SID_ATTR_ALIGN_DEGREES ".uno:AlignmentRotation"
+#define CMD_SID_ATTR_ALIGN_LOCKPOS ".uno:AlignmentRotationMode"
+#define CMD_SID_ATTR_ALIGN_MARGIN ".uno:AlignmentMargin"
+#define CMD_SID_ATTR_ALIGN_STACKED ".uno:AlignmentStacked"
+#define CMD_SID_ATTR_PARA_LEFT_TO_RIGHT ".uno:ParaLeftToRight"
+#define CMD_SID_ATTR_PARA_RIGHT_TO_LEFT ".uno:ParaRightToLeft"
+#define CMD_SID_RULER_TEXT_RIGHT_TO_LEFT ".uno:TextRTL"
+#define CMD_SID_OPEN_HYPERLINK ".uno:OpenHyperlinkOnCursor"
+#define CMD_SID_CTLFONT_STATE ".uno:CTLFontState"
+#define CMD_SID_VERTICALTEXT_STATE ".uno:VerticalTextState"
+#define CMD_SID_OPEN_XML_FILTERSETTINGS ".uno:OpenXMLFilterSettings"
+#define CMD_SID_HANGUL_HANJA_CONVERSION ".uno:HangulHanjaConversion"
+#define CMD_SID_CHINESE_CONVERSION ".uno:ChineseConversion"
+#define CMD_SID_SPELL_DIALOG ".uno:SpellDialog"
+#define CMD_SID_RULER_ROWS ".uno:RulerRows"
+#define CMD_SID_RULER_ROWS_VERTICAL ".uno:RulerRowsVertical"
+#define CMD_SID_ATTR_CHAR_FONTLIST ".uno:FontNameList"
+#define CMD_SID_EXTRUSION_TOOGLE ".uno:ExtrusionToggle"
+#define CMD_SID_EXTRUSION_TILT_DOWN ".uno:ExtrusionTiltDown"
+#define CMD_SID_EXTRUSION_TILT_UP ".uno:ExtrusionTiltUp"
+#define CMD_SID_EXTRUSION_TILT_LEFT ".uno:ExtrusionTiltLeft"
+#define CMD_SID_EXTRUSION_TILT_RIGHT ".uno:ExtrusionTiltRight"
+#define CMD_SID_EXTRUSION_DEPTH_FLOATER ".uno:ExtrusionDepthFloater"
+#define CMD_SID_EXTRUSION_DEPTH_DIALOG ".uno:ExtrusionDepthDialog"
+#define CMD_SID_EXTRUSION_DIRECTION_FLOATER ".uno:ExtrusionDirectionFloater"
+#define CMD_SID_EXTRUSION_LIGHTING_FLOATER ".uno:ExtrusionLightingFloater"
+#define CMD_SID_EXTRUSION_SURFACE_FLOATER ".uno:ExtrusionSurfaceFloater"
+#define CMD_SID_EXTRUSION_3D_COLOR ".uno:Extrusion3DColor"
+#define CMD_SID_EXTRUSION_DEPTH ".uno:ExtrusionDepth"
+#define CMD_SID_EXTRUSION_DIRECTION ".uno:ExtrusionDirection"
+#define CMD_SID_EXTRUSION_PROJECTION ".uno:ExtrusionProjection"
+#define CMD_SID_EXTRUSION_LIGHTING_DIRECTION ".uno:ExtrusionLightingDirection"
+#define CMD_SID_EXTRUSION_LIGHTING_INTENSITY ".uno:ExtrusionLightingIntensity"
+#define CMD_SID_EXTRUSION_SURFACE ".uno:ExtrusionSurface"
+#define CMD_SID_FONTWORK_GALLERY_FLOATER ".uno:FontworkGalleryFloater"
+#define CMD_SID_FONTWORK_SHAPE_TYPE ".uno:FontworkShapeType"
+#define CMD_SID_FONTWORK_SAME_LETTER_HEIGHTS ".uno:FontworkSameLetterHeights"
+#define CMD_SID_FONTWORK_ALIGNMENT_FLOATER ".uno:FontworkAlignmentFloater"
+#define CMD_SID_FONTWORK_CHARACTER_SPACING_FLOATER ".uno:FontworkCharacterSpacingFloater"
+#define CMD_SID_FONTWORK_SHAPE ".uno:FontworkShape"
+#define CMD_SID_FONTWORK_ALIGNMENT ".uno:FontworkAlignment"
+#define CMD_SID_FONTWORK_CHARACTER_SPACING ".uno:FontworkCharacterSpacing"
+#define CMD_SID_FONTWORK_CHARACTER_SPACING_DIALOG ".uno:FontworkCharacterSpacingDialog"
+#define CMD_SID_FONTWORK_KERN_CHARACTER_PAIRS ".uno:FontworkKernCharacterPairs"
+#define CMD_SID_GET_COLORTABLE ".uno:GetColorTable"
+#define CMD_SID_SPELLCHECKER_CHANGED ".uno:SpellCheckerChanged"
+#define CMD_SID_ATTR_YEAR2000 ".uno:Year2000"
+#define CMD_SID_INC_INDENT ".uno:IncrementIndent"
+#define CMD_SID_DEC_INDENT ".uno:DecrementIndent"
+#define CMD_SID_TABLE_CELL ".uno:StateTableCell"
+#define CMD_SID_OUTLINE_TO_IMPRESS ".uno:SendOutlineToImpress"
+#define CMD_SID_ATTR_DEFTABSTOP ".uno:DefTabStop"
+#define CMD_SID_ATTR_LANGUAGE ".uno:DocumentLanguage"
+#define CMD_SID_ATTR_CHAR_CJK_LANGUAGE ".uno:DocumentLanguageCJK"
+#define CMD_SID_ATTR_CHAR_CTL_LANGUAGE ".uno:DocumentLanguageCTL"
+#define CMD_SID_OPT_LOCALE_CHANGED ".uno:OptionsLocaleChanged"
+#define CMD_SID_SBA_BRW_INSERT ".uno:SbaBrwInsert"
+#define CMD_SID_DRAWTBX_CS_BASIC ".uno:BasicShapes"
+#define CMD_SID_DRAWTBX_CS_SYMBOL ".uno:SymbolShapes"
+#define CMD_SID_DRAWTBX_CS_ARROW ".uno:ArrowShapes"
+#define CMD_SID_DRAWTBX_CS_FLOWCHART ".uno:FlowChartShapes"
+#define CMD_SID_DRAWTBX_CS_CALLOUT ".uno:CalloutShapes"
+#define CMD_SID_DRAWTBX_CS_STAR ".uno:StarShapes"
+#define CMD_SID_DRAW_CS_ID ".uno:CustomShape"
+#define CMD_SID_DASH_LIST ".uno:DashListState"
+#define CMD_SID_LINEEND_LIST ".uno:LineEndListState"
+#define CMD_SID_COLOR_TABLE ".uno:ColorTableState"
+#define CMD_SID_GRADIENT_LIST ".uno:GradientListState"
+#define CMD_SID_HATCH_LIST ".uno:HatchListState"
+#define CMD_SID_BITMAP_LIST ".uno:BitmapListState"
+#define CMD_SID_ATTR_CHAR_EMPHASISMARK ".uno:EmphasisMark"
+#define CMD_SID_FM_SHOW_DATANAVIGATOR ".uno:ShowDataNavigator"
+#define CMD_SID_FM_DATANAVIGATOR_CONTROL ".uno:FmDataNavigatorController"
+#define CMD_SID_ALIGN_ANY_LEFT ".uno:CommonAlignLeft"
+#define CMD_SID_ALIGN_ANY_HCENTER ".uno:CommonAlignHorizontalCenter"
+#define CMD_SID_ALIGN_ANY_RIGHT ".uno:CommonAlignRight"
+#define CMD_SID_ALIGN_ANY_JUSTIFIED ".uno:CommonAlignJustified"
+#define CMD_SID_ALIGN_ANY_TOP ".uno:CommonAlignTop"
+#define CMD_SID_ALIGN_ANY_VCENTER ".uno:CommonAlignVerticalCenter"
+#define CMD_SID_ALIGN_ANY_BOTTOM ".uno:CommonAlignBottom"
+#define CMD_SID_ALIGN_ANY_HDEFAULT ".uno:CommonAlignHorizontalDefault"
+#define CMD_SID_ALIGN_ANY_VDEFAULT ".uno:CommonAlignVerticalDefault"
+#define CMD_SID_AVMEDIA_TOOLBOX ".uno:AVMediaToolBox"
+#define CMD_SID_BORDER_REDUCED_MODE ".uno:BorderReducedMode"
+#define CMD_SID_COLOR_SETTINGS ".uno:ColorSettings"
+#define CMD_SID_MAIL_EXPORT_FINISHED ".uno:MailExportFinished"
+#define CMD_SID_INSERT_ZWSP ".uno:InsertZWSP"
+#define CMD_SID_INSERT_ZWNBSP ".uno:InsertZWNBSP"
+#define CMD_SID_INSERT_LRM ".uno:InsertLRM"
+#define CMD_SID_INSERT_RLM ".uno:InsertRLM"
+#define CMD_FN_INSERT_SOFT_HYPHEN ".uno:InsertSoftHyphen"
+#define CMD_FN_INSERT_HARDHYPHEN ".uno:InsertHardHyphen"
+#define CMD_FN_INSERT_HARD_SPACE ".uno:InsertNonBreakingSpace"
+#define CMD_SID_BASICIDE_MANAGE_LANG ".uno:ManageLanguage"
+#define CMD_SID_BASICIDE_CURRENT_LANG ".uno:CurrentLanguage"
+#define CMD_SID_TABLE_MERGE_CELLS ".uno:MergeCells"
+#define CMD_SID_TABLE_SPLIT_CELLS ".uno:SplitCell"
+#define CMD_SID_OPTIMIZE_TABLE ".uno:OptimizeTable"
+#define CMD_SID_TABLE_VERT_BOTTOM ".uno:CellVertBottom"
+#define CMD_SID_TABLE_VERT_CENTER ".uno:CellVertCenter"
+#define CMD_SID_TABLE_VERT_NONE ".uno:CellVertTop"
+#define CMD_SID_TABLE_INSERT_ROW ".uno:InsertRows"
+#define CMD_SID_TABLE_INSERT_COL ".uno:InsertColumns"
+#define CMD_SID_TABLE_DELETE_ROW ".uno:DeleteRows"
+#define CMD_SID_TABLE_DELETE_COL ".uno:DeleteColumns"
+#define CMD_SID_TABLE_SELECT_ALL ".uno:SelectTable"
+#define CMD_SID_TABLE_SELECT_COL ".uno:EntireColumn"
+#define CMD_SID_TABLE_SELECT_ROW ".uno:EntireRow"
+#define CMD_SID_FORMAT_TABLE_DLG ".uno:TableDialog"
+#define CMD_SID_TABLE_AUTOSUM ".uno:AutoSum"
+#define CMD_SID_TABLE_SORT_DIALOG ".uno:TableSort"
+#define CMD_SID_OPEN_SMARTTAGMENU ".uno:OpenSmartTagMenuOnCursor"
+#define CMD_SID_ATTR_ZOOMSLIDER ".uno:ZoomSlider"
+#define CMD_SID_FONTNAMELIST ".uno:FontNameStringList"
+#define CMD_SID_LANGUAGE_STATUS ".uno:LanguageStatus"
+#define CMD_SID_CHAR_DLG_FOR_PARAGRAPH ".uno:FontDialogForParagraph"
+#define CMD_SID_GROW_FONT_SIZE ".uno:Grow"
+#define CMD_SID_SHRINK_FONT_SIZE ".uno:Shrink"
+#define CMD_SID_RECHECK_DOCUMENT ".uno:RecheckDocument"
+#define CMD_SID_TABLE_INSERT_COL_DLG ".uno:InsertColumnDialog"
+#define CMD_SID_TABLE_INSERT_ROW_DLG ".uno:InsertRowDialog"
+
+#endif
diff --git a/svx/inc/svx/svxdlg.hxx b/svx/inc/svx/svxdlg.hxx
new file mode 100644
index 000000000000..56a4985db54d
--- /dev/null
+++ b/svx/inc/svx/svxdlg.hxx
@@ -0,0 +1,507 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_DIALOG_HXX
+#define _SVX_DIALOG_HXX
+// include ---------------------------------------------------------------
+
+#include <sfx2/sfxdlg.hxx>
+#include <editeng/edtdlg.hxx>
+
+class SdrModel;
+class SdrView;
+
+#include <svx/dstribut_enum.hxx>
+#include <svx/rectenum.hxx> //add for enum RECT_POINT
+#include <com/sun/star/container/XIndexContainer.hpp> //add for FmShowColsDialog
+#include <com/sun/star/container/XNameReplace.hpp> //add for SvxMacroAssignDlg
+#include "svx/svxdllapi.h"
+
+namespace com{namespace sun{namespace star{
+namespace linguistic2{
+ class XDictionary;
+ class XSpellChecker1;
+ class XSpellChecker;
+ class XThesaurus;
+ class XHyphenator;
+}}}}
+class SvxSpellWrapper; //add for SvxSpellCheckDialog
+typedef SfxTabPage* (*CreateSvxDistributePage)(Window *pParent, const SfxItemSet &rAttrSet, SvxDistributeHorizontal eHor, SvxDistributeVertical eVer);
+typedef sal_uInt16* (*DialogGetRanges)();
+
+struct ExchangeData;
+class INetURLObject;
+class GalleryTheme;
+class TargetList;
+class SvxHyperlinkTabPageBase;
+class SearchAttrItemList;
+class FmFormShell;
+class Graphic;
+class SdrObject;
+class SvxSpellWrapper;
+
+namespace svx{ class SpellDialogChildWindow;}
+
+#define EMPTY_FRAME_REF com::sun::star::uno::Reference < com::sun::star::frame::XFrame >()
+
+//#define SVX_DIALOGFACTORY_CLASSID 0xf8e5fd97, 0x49e2, 0x4ae5, 0xac, 0x31, 0x4, 0xcb, 0xf7, 0xf3, 0xcf, 0x69
+class AbstractSvxDistributeDialog :public VclAbstractDialog //add for SvxDistributeDialog
+{
+public:
+ virtual SvxDistributeHorizontal GetDistributeHor() const = 0;
+ virtual SvxDistributeVertical GetDistributeVer() const = 0;
+};
+
+class AbstractFmShowColsDialog : public VclAbstractDialog //add for FmShowColsDialog
+{
+ public:
+ virtual void SetColumns(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer>& xCols)= 0;
+};
+
+class AbstractSvxZoomDialog : public VclAbstractDialog //add for SvxZoomDialog
+{
+ public:
+ virtual void SetLimits( sal_uInt16 nMin, sal_uInt16 nMax ) = 0;
+ virtual void HideButton( sal_uInt16 nBtnId )= 0;
+ virtual const SfxItemSet* GetOutputItemSet() const = 0 ;
+};
+
+class AbstractSpellDialog : public VclAbstractDialog //
+{
+ public:
+ virtual void SetLanguage( sal_uInt16 nLang ) = 0;
+ virtual sal_Bool Close() = 0;
+ virtual void Invalidate() = 0;
+ virtual Window* GetWindow() = 0;
+ virtual SfxBindings& GetBindings() = 0;
+};
+
+typedef long (*PLinkStub)( void*, void* );
+
+class AbstractSearchProgress :public VclAbstractRefreshableDialog //add for SearchProgress
+{
+public:
+ virtual void SetFileType( const String& rType ) = 0;
+ virtual void SetDirectory( const INetURLObject& rURL ) = 0;
+ virtual PLinkStub GetLinkStubCleanUpHdl() = 0;
+};
+
+class AbstractTakeProgress :public VclAbstractRefreshableDialog //add for TakeProgress
+{
+public:
+ virtual void SetFile( const INetURLObject& rURL ) = 0;
+ virtual PLinkStub GetLinkStubCleanUpHdl() = 0;
+};
+
+class AbstractTitleDialog :public VclAbstractDialog //add for TitleDialog
+{
+public:
+ virtual String GetTitle() const =0;
+};
+
+class AbstractGalleryIdDialog :public VclAbstractDialog //add for GalleryIdDialog
+{
+public:
+ virtual sal_uIntPtr GetId() const =0;
+};
+
+class AbstractURLDlg :public VclAbstractDialog //add for URLDlg
+{
+public:
+ virtual String GetURL() const = 0;
+ virtual String GetAltText() const = 0;
+ virtual String GetDesc() const = 0;
+ virtual String GetTarget() const = 0;
+ virtual String GetName() const = 0;
+};
+
+class AbstractSvxHlinkDlgMarkWnd :public VclAbstractDialog //add for SvxHlinkDlgMarkWnd
+{
+public:
+ virtual sal_Bool MoveTo ( Point aNewPos )const = 0;
+ virtual sal_Bool ConnectToDialog( sal_Bool bDoit = sal_True )const = 0;
+ virtual void RefreshTree ( String aStrURL ) = 0;
+ virtual void SelectEntry ( String aStrMark ) = 0;
+ virtual sal_uInt16 SetError( sal_uInt16 nError) = 0;
+ // in class Window
+ virtual void SetSizePixel( const Size& rNewSize ) = 0;
+ virtual Size GetSizePixel() const = 0;
+ virtual void Hide( sal_uInt16 nFlags = 0 ) = 0;
+ virtual sal_Bool IsVisible() const = 0;
+ virtual void Invalidate( sal_uInt16 nFlags = 0 ) = 0;
+};
+
+class AbstractSvxSearchFormatDialog : public SfxAbstractTabDialog //for SvxSearchFormatDialog
+{
+public:
+ //From class Window.
+ virtual void SetText( const XubString& rStr ) =0 ;
+ virtual String GetText() const =0 ;
+};
+
+class AbstractSvxSearchSimilarityDialog :public VclAbstractDialog //add for SvxSearchSimilarityDialog
+{
+public:
+ virtual sal_uInt16 GetOther() =0 ;
+ virtual sal_uInt16 GetShorter() =0 ;
+ virtual sal_uInt16 GetLonger() =0 ;
+ virtual sal_Bool IsRelaxed() =0 ;
+};
+
+class AbstractSvxJSearchOptionsDialog :public VclAbstractDialog //add for SvxJSearchOptionsDialog
+{
+public:
+ virtual sal_Int32 GetTransliterationFlags() const = 0;
+};
+
+class AbstractFmInputRecordNoDialog :public VclAbstractDialog //add for FmInputRecordNoDialog
+{
+public:
+ virtual void SetValue(long dNew) = 0;
+ virtual long GetValue() const = 0;
+};
+
+class AbstractSvxNewDictionaryDialog :public VclAbstractDialog //add for SvxNewDictionaryDialog
+{
+public:
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > GetNewDictionary() = 0;
+};
+
+class AbstractSvxNameDialog :public VclAbstractDialog //add for SvxNameDialog
+{
+public:
+ virtual void GetName( String& rName ) = 0;
+ virtual void SetCheckNameHdl( const Link& rLink, bool bCheckImmediately = false ) = 0;
+ virtual void SetEditHelpId(const rtl::OString&) = 0;
+ //from class Window
+ virtual void SetHelpId( const rtl::OString& ) = 0;
+ virtual void SetText( const XubString& rStr ) = 0;
+};
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+// #i68101#
+
+class AbstractSvxObjectNameDialog :public VclAbstractDialog
+{
+public:
+ virtual void GetName(String& rName) = 0;
+ virtual void SetCheckNameHdl(const Link& rLink, bool bCheckImmediately = false) = 0;
+};
+
+class AbstractSvxObjectTitleDescDialog :public VclAbstractDialog
+{
+public:
+ virtual void GetTitle(String& rTitle) = 0;
+ virtual void GetDescription(String& rDescription) = 0;
+};
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+class AbstractSvxMessDialog :public VclAbstractDialog //add for SvxMessDialog
+{
+public:
+ virtual void SetButtonText( sal_uInt16 nBtnId, const String& rNewTxt ) = 0;
+};
+
+class AbstractSvxMultiPathDialog :public VclAbstractDialog //add for SvxMultiPathDialog
+{
+public:
+ virtual String GetPath() const = 0;
+ virtual void SetPath( const String& rPath ) = 0;
+ virtual void EnableRadioButtonMode() = 0;
+ virtual void SetTitle( const String& rNewTitle ) = 0;
+};
+
+class AbstractSvxMultiFileDialog :public AbstractSvxMultiPathDialog //add for SvxMultiFileDialog
+{
+public:
+ virtual String GetFiles() const = 0;
+ virtual void SetFiles( const String& rPath ) = 0;
+ //from SvxMultiPathDialog
+ virtual void SetClassPathMode() = 0;
+ //From Class Window
+ virtual void SetHelpId( const rtl::OString& ) = 0;
+};
+
+class AbstractSvxHpLinkDlg : public VclAbstractDialog //add for SvxHpLinkDlg
+{
+public:
+ virtual Window* GetWindow() = 0;
+ virtual sal_Bool QueryClose() = 0;
+};
+
+class AbstractFmSearchDialog :public VclAbstractDialog //add for FmSearchDialog
+{
+public:
+ virtual void SetFoundHandler(const Link& lnk) = 0;
+ virtual void SetCanceledNotFoundHdl(const Link& lnk)=0;
+ virtual void SetActiveField(const String& strField)=0;
+};
+class AbstractGraphicFilterDialog :public VclAbstractDialog //add for GraphicFilterDialog
+{
+public:
+ virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) = 0;
+};
+
+class AbstractSvxAreaTabDialog :public SfxAbstractTabDialog //add for SvxAreaTabDialog
+{
+public:
+ virtual void DontDeleteColorTable() = 0;
+};
+
+class AbstractSvxTransformTabDialog : public SfxAbstractTabDialog
+{
+public:
+ virtual void SetValidateFramePosLink( const Link& rLink ) = 0;
+};
+class AbstractSvxCaptionDialog : public SfxAbstractTabDialog
+{
+public:
+ virtual void SetValidateFramePosLink( const Link& rLink ) = 0;
+};
+
+//-------------------------------------------------------------
+
+class AbstractSvxPostItDialog :public VclAbstractDialog //add for SvxPostItDialog
+{
+public:
+ virtual void SetText( const XubString& rStr ) = 0; //From class Window
+ virtual const SfxItemSet* GetOutputItemSet() const = 0;
+ virtual void SetPrevHdl( const Link& rLink ) = 0;
+ virtual void SetNextHdl( const Link& rLink ) = 0;
+ virtual void EnableTravel(sal_Bool bNext, sal_Bool bPrev) = 0;
+ virtual String GetNote() = 0;
+ virtual void SetNote(const String& rTxt) = 0;
+ virtual void ShowLastAuthor(const String& rAuthor, const String& rDate) = 0;
+ virtual void DontChangeAuthor() = 0;
+ virtual void HideAuthor() = 0;
+ virtual void SetReadonlyPostIt(sal_Bool bDisable) = 0;
+ virtual sal_Bool IsOkEnabled() const = 0;
+ virtual Window * GetWindow() = 0;
+};
+
+//-------------------------------------------------------------
+
+class SvxAbstractSplittTableDialog : public VclAbstractDialog
+{
+public:
+ virtual bool IsHorizontal() const = 0;
+ virtual bool IsProportional() const = 0;
+ virtual long GetCount() const = 0;
+};
+
+//-------------------------------------------------------------
+
+class SvxAbstractNewTableDialog : public VclAbstractDialog
+{
+public:
+ virtual sal_Int32 getRows() const = 0;
+ 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, public EditAbstractDialogFactory
+{
+public:
+ static SvxAbstractDialogFactory* Create();
+
+ // define dtor as this will create typeinfo and in svx library and export vtable
+ virtual ~SvxAbstractDialogFactory();
+
+ virtual SfxAbstractTabDialog* CreateTextTabDialog( Window* pParent,
+ const SfxItemSet* pAttrSet,
+ SdrView* pView,
+ SdrModel* pModel=0 ) = 0 ; //add for SvxTextTabDialog
+
+ virtual AbstractSvxCaptionDialog* CreateCaptionDialog( Window* pParent,
+ const SdrView* pView,
+ sal_uInt16 nAnchorTypes = 0 ) = 0; //add for SvxCaptionTabDialog CHINA001
+
+ virtual AbstractSvxDistributeDialog* CreateSvxDistributeDialog(Window* pParent,
+ const SfxItemSet& rAttr,
+ SvxDistributeHorizontal eHor = SvxDistributeHorizontalNone,
+ SvxDistributeVertical eVer = SvxDistributeVerticalNone)= 0;
+
+ virtual AbstractFmShowColsDialog * CreateFmShowColsDialog( Window* pParent ) = 0;
+
+ virtual AbstractSvxZoomDialog * CreateSvxZoomDialog( Window* pParent, //add for SvxZoomDialog
+ const SfxItemSet& rCoreSet )=0;
+
+ virtual AbstractSpellDialog * CreateSvxSpellDialog(Window* pParent,
+ SfxBindings* pBindings,
+ svx::SpellDialogChildWindow* pSpellChildWindow )=0;
+
+ virtual VclAbstractRefreshableDialog * CreateActualizeProgressDialog( Window* pParent, //add for ActualizeProgress
+ GalleryTheme* pThm ) = 0;
+ virtual AbstractSearchProgress * CreateSearchProgressDialog( Window* pParent, //add for SearchProgress
+ const INetURLObject& rStartURL ) = 0;
+ virtual AbstractTakeProgress * CreateTakeProgressDialog( Window* pParent ) = 0;
+ virtual AbstractTitleDialog * CreateTitleDialog( Window* pParent, //add for TitleDialog
+ const String& rOldText ) = 0;
+ virtual AbstractGalleryIdDialog * CreateGalleryIdDialog( Window* pParent, //add for SvxZoomDialog
+ GalleryTheme* pThm ) = 0;
+ virtual VclAbstractDialog2 * CreateGalleryThemePropertiesDialog( Window* pParent, //add for GalleryThemeProperties
+ ExchangeData* pData,
+ SfxItemSet* pItemSet ) = 0;
+ virtual AbstractURLDlg * CreateURLDialog( Window* pParent,
+ const String& rURL, const String& rAltText, const String& rDescription,
+ const String& rTarget, const String& rName,
+ TargetList& rTargetList ) = 0;
+ virtual AbstractSvxHlinkDlgMarkWnd* CreateSvxHlinkDlgMarkWndDialog( SvxHyperlinkTabPageBase* pParent, sal_uInt32 nResId ) =0; //add for SvxHlinkDlgMarkWnd
+
+ virtual SfxAbstractTabDialog* CreateTabItemDialog( Window* pParent, //add for SvxSearchFormatDialog
+ const SfxItemSet& rSet,
+ sal_uInt32 nResId) = 0;
+ virtual VclAbstractDialog* CreateSvxSearchAttributeDialog( Window* pParent, //add for SvxSearchAttributeDialog
+ SearchAttrItemList& rLst,
+ const sal_uInt16* pWhRanges)=0;
+ virtual AbstractSvxSearchSimilarityDialog * CreateSvxSearchSimilarityDialog( Window* pParent, //add for SvxSearchSimilarityDialog
+ sal_Bool bRelax,
+ sal_uInt16 nOther,
+ sal_uInt16 nShorter,
+ sal_uInt16 nLonger ) = 0;
+ virtual SfxAbstractTabDialog* CreateSvxBorderBackgroundDlg( Window* pParent, //add for SvxBorderBackgroundDlg
+ const SfxItemSet& rCoreSet,
+ sal_Bool bEnableSelector = sal_False) = 0;
+ virtual AbstractSvxTransformTabDialog* CreateSvxTransformTabDialog( Window* pParent, //add for SvxTransformTabDialog
+ const SfxItemSet* pAttr,
+ const SdrView* pView,
+ sal_uInt16 nAnchorTypes = 0) = 0;
+ virtual SfxAbstractTabDialog* CreateSchTransformTabDialog( Window* pParent, //add for SchTransformTabDialog
+ const SfxItemSet* pAttr,
+ const SdrView* pSdrView,
+ sal_uInt32 nResId,
+ bool bSizeTabPage = false
+ )=0;
+ virtual AbstractSvxJSearchOptionsDialog * CreateSvxJSearchOptionsDialog( Window* pParent,
+ const SfxItemSet& rOptionsSet,
+ sal_Int32 nInitialFlags )=0;
+ virtual AbstractFmInputRecordNoDialog * CreateFmInputRecordNoDialog( Window* pParent ) = 0;
+ virtual AbstractSvxNewDictionaryDialog* CreateSvxNewDictionaryDialog( Window* pParent,
+ ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellChecker1 > &xSpl,
+ sal_uInt32 nResId ) = 0; //add for SvxNewDictionaryDialog
+ virtual VclAbstractDialog * CreateSvxEditDictionaryDialog( Window* pParent,
+ const String& rName,
+ ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellChecker1> &xSpl,
+ sal_uInt32 nResId) = 0;//add for SvxEditDictionaryDialog
+ virtual AbstractSvxNameDialog * CreateSvxNameDialog( Window* pParent,
+ const String& rName, const String& rDesc ) = 0; //add for SvxNameDialog
+
+ // #i68101#
+ virtual AbstractSvxObjectNameDialog* CreateSvxObjectNameDialog(Window* pParent, const String& rName ) = 0;
+ virtual AbstractSvxObjectTitleDescDialog* CreateSvxObjectTitleDescDialog(Window* pParent, const String& rTitle, const String& rDescription) = 0;
+
+ virtual AbstractSvxMessDialog * CreateSvxMessDialog( Window* pParent, sal_uInt32 nResId,
+ const String& rText, const String& rDesc,
+ Image* pImg = NULL ) = 0; //add for SvxMessDialog
+
+ virtual AbstractSvxMultiPathDialog * CreateSvxMultiPathDialog( Window* pParent, sal_Bool bEmptyAllowed = sal_False ) = 0 ; //add for SvxMultiPathDialog
+ virtual AbstractSvxMultiFileDialog * CreateSvxMultiFileDialog( Window* pParent, sal_Bool bEmptyAllowed = sal_False ) = 0 ; //add for SvxMultiFileDialog
+ virtual AbstractSvxHpLinkDlg * CreateSvxHpLinkDlg (Window* pParent, //add for SvxMultiFileDialog
+ SfxBindings* pBindings,
+ sal_uInt32 nResId)=0;
+ virtual AbstractFmSearchDialog* CreateFmSearchDialog(Window* pParent, //add for FmSearchDialog
+ const String& strInitialText,
+ const ::std::vector< String >& _rContexts,
+ sal_Int16 nInitialContext,
+ const Link& lnkContextSupplier)=0;
+ virtual AbstractGraphicFilterDialog * CreateGraphicFilterEmboss (Window* pParent, //add for GraphicFilterEmboss
+ const Graphic& rGraphic,
+ RECT_POINT eLightSource, sal_uInt32 nResId )=0;
+ virtual AbstractGraphicFilterDialog * CreateGraphicFilterPosterSepia (Window* pParent, //add for GraphicFilterPoster & GraphicFilterSepia
+ const Graphic& rGraphic,
+ sal_uInt16 nCount,
+ sal_uInt32 nResId)=0;
+ virtual AbstractGraphicFilterDialog * CreateGraphicFilterSolarize (Window* pParent, //add for GraphicFilterSolarize
+ const Graphic& rGraphic,
+ sal_uInt8 nGreyThreshold, sal_Bool bInvert, sal_uInt32 nResId)=0;
+ virtual AbstractGraphicFilterDialog * CreateGraphicFilterMosaic (Window* pParent, //add for GraphicFilterMosaic
+ const Graphic& rGraphic,
+ sal_uInt16 nTileWidth, sal_uInt16 nTileHeight, sal_Bool bEnhanceEdges, sal_uInt32 nResId)=0;
+ virtual AbstractSvxAreaTabDialog* CreateSvxAreaTabDialog( Window* pParent,//add for SvxAreaTabDialog
+ const SfxItemSet* pAttr,
+ SdrModel* pModel,
+ const SdrView* pSdrView = NULL ) = 0 ;
+ virtual SfxAbstractTabDialog* CreateSvxLineTabDialog( Window* pParent, const SfxItemSet* pAttr, //add forSvxLineTabDialog
+ SdrModel* pModel,
+ const SdrObject* pObj = NULL,
+ sal_Bool bHasObj = sal_True )=0;
+ virtual VclAbstractDialog* CreateSfxDialog( Window* pParent, const SfxBindings& rBindings, sal_uInt32 nResId ) = 0;
+ virtual SfxAbstractDialog* CreateSfxDialog( Window* pParent, //add for SvxMeasureDialog & SvxConnectionDialog
+ const SfxItemSet& rAttr,
+ const SdrView* pView,
+ sal_uInt32 nResId
+ )=0;
+ virtual SfxAbstractDialog* CreateSfxDialog( Window* pParent, //add for SvxMeasureDialog & SvxConnectionDialog
+ const SfxItemSet& rAttr,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame,
+ sal_uInt32 nResId
+ )=0;
+ virtual AbstractSvxPostItDialog* CreateSvxPostItDialog( Window* pParent, //add for SvxPostItDialog
+ const SfxItemSet& rCoreSet,
+ sal_Bool bPrevNext = sal_False, sal_Bool bRedline = sal_False )=0;
+ virtual VclAbstractDialog* CreateSvxScriptOrgDialog( Window* pParent, const String& rLanguage ) = 0;
+
+ virtual CreateSvxDistributePage GetSvxDistributePageCreatorFunc() = 0; // add for SvxDistributePage
+ virtual DialogGetRanges GetDialogGetRangesFunc( sal_uInt16 nId ) = 0; //add for SvxPostItDialog
+
+ virtual AbstractScriptSelectorDialog*
+ CreateScriptSelectorDialog(
+ Window* pParent,
+ sal_Bool bShowSlots,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame
+ ) = 0;
+
+ virtual VclAbstractDialog* CreateScriptErrorDialog(
+ Window* pParent, com::sun::star::uno::Any aException) = 0;
+
+ virtual VclAbstractDialog* CreateSvxMacroAssignDlg(
+ Window* _pParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxDocumentFrame,
+ const bool _bUnoDialogMode,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace >& _rxEvents,
+ const sal_uInt16 _nInitiallySelectedEvent
+ ) = 0;
+
+ virtual SfxAbstractTabDialog* CreateSvxFormatCellsDialog( Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel, const SdrObject* pObj = NULL )=0;
+
+ 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, const rtl::OString& sHelpId ) = 0;
+};
+
+#endif
+
diff --git a/svx/inc/svx/svxdllapi.h b/svx/inc/svx/svxdllapi.h
new file mode 100644
index 000000000000..65670e9344f5
--- /dev/null
+++ b/svx/inc/svx/svxdllapi.h
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SVXDLLAPI_H
+#define INCLUDED_SVXDLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(SVX_DLLIMPLEMENTATION)
+#define SVX_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define SVX_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define SVX_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_SVXDLLAPI_H */
diff --git a/svx/inc/svx/svxerr.hxx b/svx/inc/svx/svxerr.hxx
new file mode 100644
index 000000000000..0fd197f1a5f5
--- /dev/null
+++ b/svx/inc/svx/svxerr.hxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVXERR_HXX
+#define _SVXERR_HXX
+
+// include ---------------------------------------------------------------
+
+#include <tools/errcode.hxx>
+
+// define ----------------------------------------------------------------
+
+#define ERRCODE_SVX_LINGU_THESAURUSNOTEXISTS (1UL | ERRCODE_AREA_SVX | \
+ ERRCODE_CLASS_NOTEXISTS)
+
+// moved to editeng lib
+//#define ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS (2UL | ERRCODE_AREA_SVX)
+
+#define ERRCODE_SVX_LINGU_LINGUNOTEXISTS (3UL | ERRCODE_AREA_SVX | \
+ ERRCODE_CLASS_NOTEXISTS )
+#define ERRCODE_SVX_LINGU_HYPHENNOTEXISTS (4UL | ERRCODE_AREA_SVX | \
+ ERRCODE_CLASS_NOTEXISTS )
+#define ERRCODE_SVX_LINGU_DICT_NOTREADABLE (5UL | ERRCODE_AREA_SVX | \
+ ERRCODE_CLASS_READ )
+#define ERRCODE_SVX_LINGU_DICT_NOTWRITEABLE (6UL | ERRCODE_AREA_SVX | \
+ ERRCODE_CLASS_WRITE )
+
+#define ERRCODE_SVX_GRAPHIC_NOTREADABLE (7UL | ERRCODE_AREA_SVX | \
+ ERRCODE_CLASS_READ )
+// moved to editeng lib
+//#define ERRCODE_SVX_GRAPHIC_WRONG_FILEFORMAT (8UL | ERRCODE_AREA_SVX | ERRCODE_CLASS_READ )
+
+#define ERRCODE_SVX_LINGU_NOLANGUAGE (9UL | ERRCODE_AREA_SVX | \
+ ERRCODE_CLASS_NOTEXISTS )
+#define ERRCODE_SVX_FORMS_NOIOSERVICES (10UL | ERRCODE_AREA_SVX )
+#define ERRCODE_SVX_FORMS_READWRITEFAILED (11UL | ERRCODE_AREA_SVX )
+
+#define ERRCODE_SVX_BULLETITEM_NOBULLET (12UL | ERRCODE_AREA_SVX )
+
+#define ERRCODE_SVX_MODIFIED_VBASIC_STORAGE (13UL | ERRCODE_AREA_SVX \
+ | ERRCODE_WARNING_MASK \
+ | ERRCODE_CLASS_WRITE )
+
+#define ERRCODE_SVX_VBASIC_STORAGE_EXIST (14UL | ERRCODE_AREA_SVX \
+ | ERRCODE_WARNING_MASK \
+ | ERRCODE_CLASS_WRITE )
+
+/** Error message: "Wrong password." */
+#define ERRCODE_SVX_WRONGPASS (15UL | ERRCODE_AREA_SVX | ERRCODE_CLASS_NONE)
+
+/** Error message: "Read error. Unsupported encryption method." */
+#define ERRCODE_SVX_READ_FILTER_CRYPT (16UL | ERRCODE_AREA_SVX | ERRCODE_CLASS_READ)
+
+/** Error message: "Read error. Passwort encrypted Powerpoint documents..." */
+#define ERRCODE_SVX_READ_FILTER_PPOINT (17UL | ERRCODE_AREA_SVX | ERRCODE_CLASS_READ)
+
+/** Error message: "Warning. Passwort protection is not suppported when ..." */
+#define ERRCODE_SVX_EXPORT_FILTER_CRYPT (18UL | ERRCODE_AREA_SVX | ERRCODE_CLASS_EXPORT | ERRCODE_WARNING_MASK)
+
+
+// both codes will be used twice : with ERRCODE_CLASS_READ- and ERRCODE_CLASS_WRITE-bits
+#define ERRCTX_SVX_LINGU_THESAURUS 1
+#define ERRCTX_SVX_LINGU_SPELLING 2
+#define ERRCTX_SVX_LINGU_HYPHENATION 3
+#define ERRCTX_SVX_LINGU_DICTIONARY 4
+#define ERRCTX_SVX_BACKGROUND 5
+#define ERRCTX_SVX_IMPORT_GRAPHIC 6
+
+// class SvxErrorHandler -------------------------------------------------
+
+#ifndef __RSC
+
+#include <svtools/ehdl.hxx>
+#include "svx/svxdllapi.h"
+
+class SVX_DLLPUBLIC SvxErrorHandler : private SfxErrorHandler
+{
+ public:
+ SvxErrorHandler();
+ static void Get();
+};
+
+#endif
+
+
+#endif
+
diff --git a/svx/inc/svx/svxgrahicitem.hxx b/svx/inc/svx/svxgrahicitem.hxx
new file mode 100644
index 000000000000..70064c21c4fe
--- /dev/null
+++ b/svx/inc/svx/svxgrahicitem.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_GRAPHICITEM_HXX
+#define _SVX_GRAPHICITEM_HXX
+
+
+#include <svl/poolitem.hxx>
+#include "svx/svxdllapi.h"
+
+#include <vcl/graph.hxx>
+
+class SVX_DLLPUBLIC SvxGraphicItem: public SfxPoolItem
+{
+ Graphic aGraphic;
+
+public:
+ TYPEINFO();
+ SvxGraphicItem();
+ SvxGraphicItem( sal_uInt16 nWhich ,const Graphic& rGraphic);
+ SvxGraphicItem( const SvxGraphicItem& );
+
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+ Graphic GetGraphic() const { return aGraphic; }
+
+};
+
+#endif
diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc
new file mode 100755
index 000000000000..1cdfc9fb2b9e
--- /dev/null
+++ b/svx/inc/svx/svxids.hrc
@@ -0,0 +1,1328 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_SVXIDS_HRC
+#define _SVX_SVXIDS_HRC
+// include ------------------------------------------------------------------
+
+#include <svl/memberid.hrc>
+#include <svl/solar.hrc>
+#include <sfx2/sfx.hrc>
+#include <sfx2/sfxsids.hrc>
+#include <editeng/editids.hrc>
+#include <svx/unomid.hxx>
+
+// solange noch im sfxids.hrc definiert -------------------------------------
+
+#ifdef SID_INSERT_FRAME
+#undef SID_INSERT_FRAME
+#endif
+
+// --------------------------------------------------------------------------
+// Member-Id's
+// --------------------------------------------------------------------------
+
+#define MID_APPFLAG 0x20
+#define MID_AUTOBREAK 0x21
+#define MID_BREAKxxx 0x22
+#define MID_BRUSHSTYLE 0x23
+#define MID_CELLTYPE 0x24
+#define MID_CHARSET 0x25
+#define MID_COMMAND 0x26
+#define MID_CONTENT 0x27
+#define MID_DESCNAMExxx 0x28
+
+#define MID_ESCAPEMENT 0x2a
+#define MID_FAMILY 0x2b
+#define MID_FIRSTLINE_OFFSET 0x2d
+#define MID_FONTFAMILY 0x2f
+#define MID_FONTFAMILYNAME 0x30
+#define MID_FONTPITCH 0x31
+#define MID_FONTSTYLE 0x32
+#define MID_PERCENT 0x33
+#define MID_HYPHEN 0x34
+#define MID_INTER_LINESPACE 0x36
+#define MID_INTER_SPACE 0x37
+#define MID_LANDSCAPE 0x38
+
+#define MID_LEFT_MARGIN 0x3a
+#define MID_LOWER 0x3d
+#define MID_MAXHYPHENS 0x3e
+#define MID_MINLEAD 0x3f
+#define MID_MINTRAIL 0x40
+#define MID_NUMTYPExxx 0x41
+#define MID_PAGEEND 0x42
+#define MID_POS 0x43
+#define MID_PROPORTIONAL 0x44
+#define MID_REPLACE_STRING 0x45
+#define MID_RIGHT 0x46
+#define MID_RIGHT_MARGIN 0x47
+#define MID_ROW_DIRECTION 0x48
+#define MID_SIZE 0x4a
+#define MID_TYPE 0x4c
+#define MID_UPPER 0x4d
+#define MID_USExxx 0x4e
+#define MID_VALUESET 0x4f
+
+#define MID_ADR_CITY 0x50
+#define MID_ADR_COMPANY 0x51
+#define MID_ADR_COUNTRY 0x52
+#define MID_ADR_EMAIL 0x53
+#define MID_ADR_FAX 0x54
+#define MID_ADR_FIRSTNAME 0x55
+#define MID_ADR_ID 0x56
+#define MID_ADR_LASTNAME 0x57
+#define MID_ADR_PHONE 0x58
+#define MID_ADR_PHONEPRIVATE 0x59
+#define MID_ADR_POSITION 0x5a
+#define MID_ADR_STREET 0x5b
+#define MID_ADR_TITLE 0x5c
+#define MID_ADR_ZIPCODE 0x5d
+#define MID_ADR_STATE 0x5e
+
+#define MID_FILENAME 0x6c
+#define MID_FILTERNAME 0x6d
+#define MID_POSITION 0x6e
+
+#define MID_HLINK_NAME 0x6f
+#define MID_HLINK_URL 0x70
+#define MID_HLINK_TARGET 0x71
+#define MID_HLINK_TYPE 0x72
+#define MID_HLINK_TEXT 0x73
+
+#define MID_COUNT 0x74
+#define MID_READONLY 0x76
+
+#define MID_VIEWLAYOUT_COLUMNS 0x77
+#define MID_VIEWLAYOUT_BOOKMODE 0x78
+
+#define MID_ZOOMSLIDER_CURRENTZOOM 0x79
+#define MID_ZOOMSLIDER_SNAPPINGPOINTS 0x7a
+#define MID_ZOOMSLIDER_MINZOOM 0x7b
+#define MID_ZOOMSLIDER_MAXZOOM 0x7c
+
+#define MID_ADR_FATHERSNAME 0x80
+#define MID_ADR_APARTMENT 0x81
+
+
+// --------------------------------------------------------------------------
+// Resource-Id's ? (obsolete??? at least the one beginning with SID???)
+// --------------------------------------------------------------------------
+/*
+#define RID_SW_TP_OPTCOMPATIBILITY_PAGE (RID_OFA_START + 255)
+#define RID_SW_TP_CONTENT_OPT (RID_OFA_START + 206)
+#define RID_SW_TP_LAYOUT_OPT (RID_OFA_START + 207)
+#define RID_SW_TP_STD_FONT (RID_OFA_START + 208)
+#define RID_SW_TP_OPTPRINT_PAGE (RID_OFA_START + 209)
+#define RID_SW_TP_OPTTABLE_PAGE (RID_OFA_START + 210)
+#define RID_SW_TP_OPTSHDWCRSR (RID_OFA_START + 211)
+#define RID_SW_TP_REDLINE_OPT (RID_OFA_START + 212)
+#define RID_SW_TP_OPTINSERT_PAGE (RID_OFA_START + 213)
+#define RID_SW_TP_OPTLOAD_PAGE (RID_OFA_START + 214)
+#define RID_SW_TP_OPTTEST_PAGE (RID_OFA_START + 215)
+#define RID_SW_TP_OPTSRCVIEW (RID_OFA_START + 216)
+#define RID_SW_TP_BACKGROUND (RID_OFA_START + 217)
+#define SID_SC_TP_LAYOUT (RID_OFA_START + 218)
+#define SID_SC_TP_CONTENT (RID_OFA_START + 219)
+#define SID_SC_TP_INPUT (RID_OFA_START + 220)
+#define SID_SC_TP_GRID (RID_OFA_START + 221)
+#define SID_SC_TP_USERLISTS (RID_OFA_START + 222)
+#define SID_SC_TP_CALC (RID_OFA_START + 223)
+#define SID_SC_TP_CHANGES (RID_OFA_START + 224)
+#define SID_SC_TP_CHANGES (RID_OFA_START + 224)
+#define SID_SD_TP_CONTENTS (RID_OFA_START + 225)
+#define SID_SD_TP_LAYOUT (RID_OFA_START + 226)
+#define SID_SD_TP_SNAP (RID_OFA_START + 227)
+#define SID_SD_TP_SCALE (RID_OFA_START + 228)
+#define SID_SD_TP_GRID (RID_OFA_START + 229)
+#define SID_SD_TP_PRINT (RID_OFA_START + 220)
+#define SID_SD_TP_MISC (RID_OFA_START + 231)
+#define SID_SI_TP_CONTENTS (RID_OFA_START + 232)
+#define SID_SI_TP_LAYOUT (RID_OFA_START + 233)
+#define SID_SI_TP_SNAP (RID_OFA_START + 234)
+#define SID_SI_TP_GRID (RID_OFA_START + 235)
+#define SID_SI_TP_PRINT (RID_OFA_START + 236)
+#define SID_SI_TP_MISC (RID_OFA_START + 237)
+#define RID_SW_TP_OPTINSERT_HTML_PAGE (RID_OFA_START + 238)
+#define SID_SC_TP_MISC (RID_OFA_START + 239)
+#define RID_SW_TP_HTML_CONTENT_OPT (RID_OFA_START + 240)
+#define RID_SW_TP_HTML_LAYOUT_OPT (RID_OFA_START + 241)
+#define RID_SW_TP_HTML_OPTPRINT_PAGE (RID_OFA_START + 242)
+#define RID_SW_TP_HTML_OPTTABLE_PAGE (RID_OFA_START + 243)
+#define RID_SW_TP_HTML_OPTGRID_PAGE (RID_OFA_START + 244)
+#define RID_SW_TP_HTML_OPTSHDWCRSR (RID_OFA_START + 246)
+#define RID_SW_TP_STD_FONT_CJK (RID_OFA_START + 247)
+#define RID_SC_TP_PRINT (RID_OFA_START + 248)
+#define RID_SW_TP_STD_FONT_CTL (RID_OFA_START + 251)
+#define RID_OFA_TP_INTERNATIONAL (RID_OFA_START + 252) // 4 SC & ID 4 resource
+#define RID_OFA_TP_INTERNATIONAL_SD (RID_OFA_START + 253) // 4 SD
+#define RID_OFA_TP_INTERNATIONAL_IMPR (RID_OFA_START + 254) // 4 impress
+*/
+
+#define SID_ATTR_PARENTWINDOW (RID_OFA_START + 255)
+
+// --------------------------------------------------------------------------
+// Event-Id's Block 1
+// --------------------------------------------------------------------------
+
+#define SVX_EVENT_COLUM_WINDOW_EXECUTE (EVENT_SVX_START)
+
+// --------------------------------------------------------------------------
+// Event-Id's Block 2
+// --------------------------------------------------------------------------
+
+#define SVX_EVENT_IMAGE_LOAD (SID_LIB_START)
+#define SVX_EVENT_IMAGE_ABORT (SID_LIB_START + 1)
+#define SVX_EVENT_IMAGE_ERROR (SID_LIB_START + 2)
+
+// --------------------------------------------------------------------------
+// Function-Id's
+// --------------------------------------------------------------------------
+
+// Function-Id's
+#define FID_SVX_START (SID_LIB_START + 500)
+#define FID_SVX_END (SID_LIB_START + 509)
+
+#define FID_SEARCH_ON (FID_SVX_START + 0)
+#define FID_SEARCH_OFF (FID_SVX_START + 1)
+#define FID_SEARCH_NOW (FID_SVX_START + 2)
+
+#define SID_CHARMAP (FID_SVX_START + 3)
+
+#define FID_SEARCH_SEARCHSET (FID_SVX_START + 4)
+#define FID_SEARCH_REPLACESET (FID_SVX_START + 5)
+
+// --------------------------------------------------------------------------
+// SFX-Id's
+// --------------------------------------------------------------------------
+
+#define SID_POLY_MERGE (SID_SFX_START + 679)
+#define SID_POLY_SUBSTRACT (SID_SFX_START + 680)
+#define SID_POLY_INTERSECT (SID_SFX_START + 681)
+#define SID_POLY_FORMEN (SID_SFX_START + 682)
+#define SID_DISTRIBUTE_DLG (SID_SFX_START + 683)
+
+// --------------------------------------------------------------------------
+// Basic IDE-Id's
+// --------------------------------------------------------------------------
+
+#define SID_BASICIDE_TOGGLEBRKPNT ( SID_BASICIDE_START + 0 )
+#define SID_BASICIDE_ADDWATCH ( SID_BASICIDE_START + 1 )
+#define SID_BASICIDE_CHOOSEMACRO ( SID_BASICIDE_START + 2 )
+#define SID_BASICIDE_EDITMACRO ( SID_BASICIDE_START + 3 )
+#define SID_BASICIDE_CREATEMACRO ( SID_BASICIDE_START + 4 )
+#define SID_BASICIDE_MODULEDLG ( SID_BASICIDE_START + 5 )
+#define SID_BASICIDE_OBJCAT ( SID_BASICIDE_START + 6 )
+#define SID_BASICIDE_REMOVEWATCH ( SID_BASICIDE_START + 7 )
+#define SID_BASICIDE_GOTOCALL ( SID_BASICIDE_START + 8 )
+#define SID_BASICIDE_SHOWSBX ( SID_BASICIDE_START + 9 )
+#define SID_BASICIDE_HIDECURPAGE ( SID_BASICIDE_START + 10 )
+#define SID_BASICIDE_NAMECHANGEDONTAB ( SID_BASICIDE_START + 11 )
+#define SID_BASICIDE_UPDATEMODULESOURCE ( SID_BASICIDE_START + 12 )
+#define SID_BASICIDE_STOREMODULESOURCE ( SID_BASICIDE_START + 13 )
+#define SID_BASICIDE_MATCHGROUP ( SID_BASICIDE_START + 14 )
+#define SID_BASICIDE_APPEAR ( SID_BASICIDE_START + 15 )
+#define SID_BASICIDE_STOREALLMODULESOURCES ( SID_BASICIDE_START + 16 )
+#define SID_BASICIDE_UPDATEALLMODULESOURCES ( SID_BASICIDE_START + 17 )
+#define SID_BASICIDE_LIBSELECTED ( SID_BASICIDE_START + 18 )
+#define SID_BASICIDE_LIBSELECTOR ( SID_BASICIDE_START + 19 )
+#define SID_BASICIDE_NEWDIALOG ( SID_BASICIDE_START + 20 )
+#define SID_BASICIDE_NEWMODULE ( SID_BASICIDE_START + 21 )
+#define SID_BASICIDE_DELETECURRENT ( SID_BASICIDE_START + 22 )
+#define SID_BASICIDE_RENAMECURRENT ( SID_BASICIDE_START + 23 )
+#define SID_BASICIDE_SBXDELETED ( SID_BASICIDE_START + 24 )
+#define SID_BASICIDE_SBXINSERTED ( SID_BASICIDE_START + 25 )
+#define SID_BASICIDE_SBXRENAMED ( SID_BASICIDE_START + 26 )
+#define SID_BASICIDE_LIBLOADED ( SID_BASICIDE_START + 27 )
+#define SID_BASICIDE_LIBREMOVED ( SID_BASICIDE_START + 28 )
+#define SID_BASICIDE_ARG_TABID ( SID_BASICIDE_START + 30 )
+#define SID_BASICIDE_ARG_SBX ( SID_BASICIDE_START + 31 )
+#define SID_BASICIDE_ARG_MACROINFO ( SID_BASICIDE_START + 32 )
+#define SID_BASICIDE_ARG_SEARCHOPTIONS ( SID_BASICIDE_START + 33 )
+#define SID_BASICIDE_ARG_LIBNAME ( SID_BASICIDE_START + 34 )
+#define SID_BASICIDE_ARG_MODULENAME ( SID_BASICIDE_START + 35 )
+#define SID_BASICIDE_BRKPNTSCHANGED ( SID_BASICIDE_START + 36 )
+#define SID_BASICIDE_STATUSBAR ( SID_BASICIDE_START + 37 )
+#define SID_BASICIDE_STAT_POS ( SID_BASICIDE_START + 38 )
+#define SID_BASICIDE_STAT_DATE ( SID_BASICIDE_START + 39 )
+#define SID_BASICIDE_STAT_TITLE ( SID_BASICIDE_START + 40 )
+#define SID_BASICIDE_NEWJAVAMODULE ( SID_BASICIDE_START + 41 )
+#define SID_BASICIDE_IMAGESTART ( SID_BASICIDE_START + 50 )
+#define SID_OPTIONS_TREEDIALOG ( SID_BASICIDE_START + 862)
+
+// --------------------------------------------------------------------------
+// StarBase-Id's
+// --------------------------------------------------------------------------
+
+#define SID_SBA_BRW_UPDATE (SID_SBA_START+100) // Daten in Felder
+#define SID_SBA_BRW_INSERT (SID_SBA_START+101) // Daten in Text
+#define SID_SBA_BRW_MERGE (SID_SBA_START+102) // Serienbrief
+#define SID_SBA_CLEAR_QUERY (SID_SBA_START+130)
+#define SID_SBA_ADD_RELATION (SID_SBA_START+131) // im Relationenentwurf neue Relation
+#define SID_SBA_QUERY_VIEW_FUNCTIONS (SID_SBA_START+134)
+#define SID_SBA_QUERY_VIEW_TABLES (SID_SBA_START+135)
+#define SID_SBA_QUERY_VIEW_ALIASES (SID_SBA_START+136)
+#define SID_SBA_QUERY_DISTINCT_VALUES (SID_SBA_START+137)
+#define SID_SBA_QRY_DESIGN (SID_SBA_START+120)
+
+// --------------------------------------------------------------------------
+// SD-Id's
+// --------------------------------------------------------------------------
+
+#define SID_RULER (SID_SD_START+40)
+#define SID_BEZIER_CONVERT (SID_SD_START+65)
+#define SID_BEZIER_ELIMINATE_POINTS (SID_SD_START+30)
+#define SID_BEZIER_EDGE (SID_SD_START+66)
+#define SID_BEZIER_SYMMTR (SID_SD_START+67)
+#define SID_TEXTEDIT (SID_SD_START+76)
+#define SID_ENTER_GROUP (SID_SD_START+96)
+#define SID_LEAVE_GROUP (SID_SD_START+97)
+#define SID_SIZE_PAGE_WIDTH (SID_SD_START+98)
+#define SID_INSERT_IMAGE (SID_SD_START+105)
+#define SID_INSERT_MATH (SID_SD_START+106)
+#define SID_SIZE_VISAREA (SID_SD_START+114)
+#define SID_ATTR_SYMBOLTYPE (SID_SD_START+115) //wird vom Chart und von SvxLineTabPage genutzt
+#define SID_ATTR_SYMBOLSIZE (SID_SD_START+116)
+#define SID_HELPLINES_MOVE (SID_SD_START+153)
+#define SID_GRID_USE (SID_SD_START+154)
+#define ID_VAL_MOUSESTART_X (SID_SD_START+200)
+#define ID_VAL_MOUSESTART_Y (SID_SD_START+201)
+#define ID_VAL_LENGTH_X (SID_SD_START+202)
+#define ID_VAL_LENGTH_Y (SID_SD_START+203)
+#define ID_VAL_MOUSEEND_X (SID_SD_START+204)
+#define ID_VAL_MOUSEEND_Y (SID_SD_START+205)
+#define ID_VAL_AXIS_X (SID_SD_START+206)
+#define ID_VAL_AXIS_Y (SID_SD_START+207)
+#define ID_VAL_ANGLESTART (SID_SD_START+208)
+#define ID_VAL_ANGLEEND (SID_SD_START+209)
+#define ID_VAL_CENTER_X (SID_SD_START+210)
+#define ID_VAL_CENTER_Y (SID_SD_START+211)
+#define ID_VAL_STYLE (SID_SD_START+240)
+#define ID_VAL_DOTS (SID_SD_START+241)
+#define ID_VAL_DOTLEN (SID_SD_START+242)
+#define ID_VAL_DASHES (SID_SD_START+243)
+#define ID_VAL_DASHLEN (SID_SD_START+244)
+#define ID_VAL_DISTANCE (SID_SD_START+245)
+#define ID_VAL_INDEX (SID_SD_START+246)
+#define SID_BEZIERTO (SID_SD_START+252)
+#define SID_DASH (SID_SD_START+267)
+#define SID_TEXT_FITTOSIZE_VERTICAL (SID_SD_START+286)
+#define SID_GRID_VISIBLE (SID_SD_START+322)
+#define ID_VAL_USEFIRSTROWSTYLE (SID_SD_START+323)
+#define ID_VAL_USELASTROWSTYLE (SID_SD_START+324)
+#define ID_VAL_USEBANDINGROWSTYLE (SID_SD_START+325)
+#define ID_VAL_USEFIRSTCOLUMNSTYLE (SID_SD_START+326)
+#define ID_VAL_USELASTCOLUMNSTYLE (SID_SD_START+327)
+#define ID_VAL_USEBANDINGCOLUMNSTYLE (SID_SD_START+328)
+
+// --------------------------------------------------------------------------
+// Calc-Id's
+// --------------------------------------------------------------------------
+
+//! moved to sfx2, still in use:
+//#ifndef SC_FUNCTION_START
+//#define SC_FUNCTION_START (SID_SC_START + 200)
+//#endif
+//#ifndef FILE_MENU_END
+//#define FILE_MENU_END (SC_FUNCTION_START + 20)
+//#endif
+//#ifndef EDIT_MENU_START
+//#define EDIT_MENU_START (FILE_MENU_END)
+//#endif
+//#ifndef SC_VIEW_START
+//#define SC_VIEW_START (SID_SC_START)
+//#endif
+
+#define SID_OUTLINE_HIDE (SID_SC_START + 329)
+#define SID_OUTLINE_SHOW (SID_SC_START + 330)
+#define SID_OUTLINE_MAKE (SID_SC_START + 331)
+#define SID_OUTLINE_REMOVE (SID_SC_START + 332)
+#define SID_FRAME_UP (SID_SC_START + 407)
+#define SID_FRAME_DOWN (SID_SC_START + 408)
+#define SID_ENTER_STRING (SID_SC_START + 476)
+#define SID_ATTR_SECIALCHAR (SID_SC_START + 581)
+#define SID_ATTR_SPECIALCHAR (SID_SC_START + 581)
+
+//! moved to sfx2, still in use:
+//#define FID_CHG_RECORD (EDIT_MENU_START + 18)
+//#define SID_CHG_PROTECT (SC_VIEW_START + 84)
+
+// --------------------------------------------------------------------------
+// Writer-Id's
+// --------------------------------------------------------------------------
+#define FN_EDIT (SID_SW_START + 100)
+#define FN_NUM_BULLET_OFF (FN_EDIT + 37) /* Numerierung aus */
+#define FN_NUM_BULLET_ON (FN_EDIT + 38) /* Numerierung mit Bullets an */
+#define FN_NUM_NUMBERING_ON (FN_EDIT + 44) /* Numerierung an */
+
+#define FN_INSERT (SID_SW_START + 300)
+#define FN_DELETE_BOOKMARK (FN_INSERT + 1)
+#define FN_INSERT_BREAK (FN_INSERT + 3)
+#define FN_INSERT_SOFT_HYPHEN (FN_INSERT + 43) /* optional hyphen */
+#define FN_INSERT_HARD_SPACE (FN_INSERT + 44) /* hard space */
+#define FN_INSERT_HARDHYPHEN (FN_INSERT + 85) /* hyphen withou break*/
+
+//!! be aware to not overwrite something that is used in sw/inc/cmdid.h already !!
+#define FN_FORMAT (SID_SW_START + 400)
+#define FN_SET_JUSTIFY_PARA (FN_FORMAT + 21)
+#define FN_FORMAT_RESET (FN_FORMAT + 69)
+
+#define FN_EXTRA (SID_SW_START + 600)
+
+#define FN_SELECTION (SID_SW_START + 900)
+#define FN_END_OF_DOCUMENT (FN_SELECTION + 8)
+#define FN_START_DOC_DIRECT (FN_SELECTION + 78)
+#define FN_END_DOC_DIRECT (FN_SELECTION + 79)
+
+#define FN_PARAM (SID_SW_START + 1100)
+#define FN_PARAM_FILTER (FN_PARAM + 30)
+#define FN_PARAM_FIELD_CONTENT (FN_PARAM + 55)
+
+#define FN_PGPREVIEW (SID_SW_START + 1250)
+#define FN_SHOW_MULTIPLE_PAGES (FN_PGPREVIEW + 2)
+
+//! moved to sfx2, still in use:
+//#define FN_EDIT2 (SID_SW_START + 1800)
+//#define FN_REDLINE_PROTECT (FN_EDIT2 + 23)
+//#define FN_REDLINE_ON (FN_EDIT2 + 25)
+
+// --------------------------------------------------------------------------
+// Svx-Id's
+// --------------------------------------------------------------------------
+
+#define SID_ATTR_ZOOM ( SID_SVX_START + 0 )
+
+#define SID_ATTR_BORDER_INNER ( SID_SVX_START + 23 )
+
+
+#define SID_ATTR_POSTIT_AUTHOR ( SID_SVX_START + 44 )
+#define SID_ATTR_POSTIT_DATE ( SID_SVX_START + 45 )
+#define SID_ATTR_POSTIT_TEXT ( SID_SVX_START + 46 )
+#define SID_ATTR_SEARCH ( SID_SVX_START + 47 )
+#define SID_ATTR_PAGE ( SID_SVX_START + 50 )
+#define SID_ATTR_PAGE_SIZE ( SID_SVX_START + 51 )
+#define SID_ATTR_PAGE_MAXSIZE ( SID_SVX_START + 52 )
+#define SID_ATTR_PAGE_PAPERBIN ( SID_SVX_START + 54 )
+#define SID_ATTR_PAGE_APP ( SID_SVX_START + 55 )
+#define SID_ATTR_PAGE_EXT1 ( SID_SVX_START + 56 )
+#define SID_ATTR_PAGE_EXT2 ( SID_SVX_START + 57 )
+#define SID_ATTR_PAGE_HEADERSET ( SID_SVX_START + 58 )
+#define SID_ATTR_PAGE_FOOTERSET ( SID_SVX_START + 59 )
+#define SID_ATTR_PAGE_ON ( SID_SVX_START + 60 )
+#define SID_ATTR_PAGE_DYNAMIC ( SID_SVX_START + 61 )
+#define SID_ATTR_PAGE_SHARED ( SID_SVX_START + 62 )
+#define SID_ATTR_PAGE_BSP ( SID_SVX_START + 63 )
+#define SID_ATTR_DBSESS_SERVERTYPE ( SID_SVX_START + 70 )
+#define SID_ATTR_DBSESS_SERVEROPTS ( SID_SVX_START + 71 )
+#define SID_ATTR_DBSESS_USERNAME ( SID_SVX_START + 72 )
+#define SID_ATTR_DBSESS_PASSWORD ( SID_SVX_START + 73 )
+#define SID_ATTR_DBSESS_SAVESESS ( SID_SVX_START + 74 )
+#define SID_ATTR_DBSESS_SAVEUSER ( SID_SVX_START + 75 )
+#define SID_ATTR_DBSESS_SERVERNAME ( SID_SVX_START + 76 )
+#define SID_ATTR_DBSESS_ENABLETYPE ( SID_SVX_START + 77 )
+#define SID_ATTR_NUMBERFORMAT_VALUE ( SID_SVX_START + 85 )
+#define SID_ATTR_NUMBERFORMAT_INFO ( SID_SVX_START + 86 )
+#define SID_ATTR_TRANSFORM ( SID_SVX_START + 87 )
+#define SID_ATTR_TRANSFORM_POS_X ( SID_SVX_START + 88 )
+#define SID_ATTR_TRANSFORM_POS_Y ( SID_SVX_START + 89 )
+#define SID_ATTR_TRANSFORM_WIDTH ( SID_SVX_START + 90 )
+#define SID_ATTR_TRANSFORM_HEIGHT ( SID_SVX_START + 91 )
+#define SID_ATTR_TRANSFORM_SIZE_POINT ( SID_SVX_START + 92 )
+#define SID_ATTR_TRANSFORM_ROT_X ( SID_SVX_START + 93 )
+#define SID_ATTR_TRANSFORM_ROT_Y ( SID_SVX_START + 94 )
+#define SID_ATTR_TRANSFORM_ANGLE ( SID_SVX_START + 95 )
+#define SID_RULER_NULL_OFFSET ( SID_SVX_START + 79 )
+#define SID_RULER_BORDERS ( SID_SVX_START + 80 )
+#define SID_RULER_OBJECT ( SID_SVX_START + 81 )
+#define SID_RULER_PAGE_POS ( SID_SVX_START + 82 )
+#define SID_RULER_ACT_LINE_ONLY ( SID_SVX_START + 83 )
+#define SID_RULER_LR_MIN_MAX ( SID_SVX_START + 84 )
+//#define SID_ZOOM_TOOLBOX ( SID_SVX_START + 96 ) -> sfxsids.hrc
+//#define SID_ZOOM_OUT ( SID_SVX_START + 97 ) -> sfxsids.hrc
+//#define SID_ZOOM_IN ( SID_SVX_START + 98 ) -> sfxsids.hrc
+//#define SID_SIZE_REAL ( SID_SVX_START + 99 ) -> sfxsids.hrc
+//#define SID_SIZE_PAGE ( SID_SVX_START + 100 ) -> sfxsids.hrc
+#define SID_SIZE_ALL ( SID_SVX_START + 101 )
+#define SID_DRAW_LINE ( SID_SVX_START + 102 )
+#define SID_DRAW_XLINE ( SID_SVX_START + 103 )
+#define SID_DRAW_RECT ( SID_SVX_START + 104 )
+#define SID_DRAW_RECT_ROUND ( SID_SVX_START + 105 )
+#define SID_DRAW_RECT_MOREROUND ( SID_SVX_START + 106 )
+#define SID_DRAW_FULLRECT ( SID_SVX_START + 107 )
+#define SID_DRAW_FULLRECT_ROUND ( SID_SVX_START + 108 )
+#define SID_DRAW_FULLRECT_MOREROUND ( SID_SVX_START + 109 )
+#define SID_DRAW_ELLIPSE ( SID_SVX_START + 110 )
+#define SID_DRAW_FULLELLIPSE ( SID_SVX_START + 111 )
+#define SID_DRAW_PIE ( SID_SVX_START + 112 )
+#define SID_DRAW_FULLPIE ( SID_SVX_START + 113 )
+#define SID_DRAW_ARC ( SID_SVX_START + 114 )
+#define SID_DRAW_CIRCLECUT ( SID_SVX_START + 115 )
+#define SID_DRAW_FULLCIRCLECUT ( SID_SVX_START + 116 )
+#define SID_DRAW_POLYGON ( SID_SVX_START + 117 )
+#define SID_DRAW_BEZIER_FILL ( SID_SVX_START + 118 )
+#define SID_BEZIER_INSERT ( SID_SVX_START + 119 )
+#define SID_BEZIER_DELETE ( SID_SVX_START + 120 )
+#define SID_BEZIER_MOVE ( SID_SVX_START + 121 )
+#define SID_BEZIER_CLOSE ( SID_SVX_START + 122 )
+#define SID_BEZIER_SMOOTH ( SID_SVX_START + 123 )
+#define SID_BEZIER_APPEND ( SID_SVX_START + 124 )
+#define SID_BEZIER_OPEN ( SID_SVX_START + 125 )
+#define SID_BEZIER_EDIT ( SID_SVX_START + 126 )
+#define SID_BEZIER_CUTLINE ( SID_SVX_START + 127 )
+#define SID_OBJECT_SELECT ( SID_SVX_START + 128 )
+#define SID_OBJECT_ROTATE ( SID_SVX_START + 129 )
+#define SID_OBJECT_ALIGN ( SID_SVX_START + 130 )
+#define SID_OBJECT_ALIGN_LEFT ( SID_SVX_START + 131 )
+#define SID_OBJECT_ALIGN_CENTER ( SID_SVX_START + 132 )
+#define SID_OBJECT_ALIGN_RIGHT ( SID_SVX_START + 133 )
+#define SID_OBJECT_ALIGN_UP ( SID_SVX_START + 134 )
+#define SID_OBJECT_ALIGN_MIDDLE ( SID_SVX_START + 135 )
+#define SID_OBJECT_ALIGN_DOWN ( SID_SVX_START + 136 )
+#define SID_COPY_FORMAT ( SID_SVX_START + 137 )
+#define SID_PASTE_FORMAT ( SID_SVX_START + 138 )
+#define SID_INSERT_ORGANIGRAM ( SID_SVX_START + 139 )
+#define SID_INSERT_DIAGRAM ( SID_SVX_START + 140 )
+#define SID_DRAW_CHART SID_INSERT_DIAGRAM
+#define SID_INSERT_TABLE ( SID_SVX_START + 141 )
+#define SID_ATTRIBUTES_AREA ( SID_SVX_START + 142 )
+#define SID_ATTRIBUTES_LINE ( SID_SVX_START + 143 )
+#define SID_CHOOSE_CONTROLS ( SID_SVX_START + 144 )
+#define SID_ACTIVATE_CONTROLS ( SID_SVX_START + 145 )
+#define SID_INSERT_PUSHBUTTON ( SID_SVX_START + 146 )
+#define SID_INSERT_RADIOBUTTON ( SID_SVX_START + 147 )
+#define SID_INSERT_CHECKBOX ( SID_SVX_START + 148 )
+#define SID_OUTLINE ( SID_SVX_START + 149 )
+#define SID_OUTLINE_UP ( SID_SVX_START + 150 )
+#define SID_OUTLINE_DOWN ( SID_SVX_START + 151 )
+#define SID_OUTLINE_LEFT ( SID_SVX_START + 152 )
+#define SID_OUTLINE_RIGHT ( SID_SVX_START + 153 )
+#define SID_OUTLINE_FORMAT ( SID_SVX_START + 154 )
+#define SID_OUTLINE_COLLAPSE_ALL ( SID_SVX_START + 155 )
+#define SID_OUTLINE_BULLET ( SID_SVX_START + 156 )
+#define SID_PRESENTATION ( SID_SVX_START + 157 )
+#define SID_TIMER ( SID_SVX_START + 158 )
+#define SID_REHEARSE_TIMINGS ( SID_SVX_START + 159 )
+#define SID_DIA ( SID_SVX_START + 160 )
+#define SID_HIDE_SLIDE ( SID_SVX_START + 161 )
+#define SID_CHOOSE_POLYGON ( SID_SVX_START + 162 )
+//#define SID_SHOW_BROWSER ( SID_SVX_START + 163 ) -> sfxsids.hrc
+#define SID_ATTR_FILL_STYLE ( SID_SVX_START + 164 )
+#define SID_ATTR_FILL_COLOR ( SID_SVX_START + 165 )
+#define SID_ATTR_FILL_GRADIENT ( SID_SVX_START + 166 )
+#define SID_ATTR_FILL_HATCH ( SID_SVX_START + 167 )
+#define SID_ATTR_FILL_BITMAP ( SID_SVX_START + 168 )
+#define SID_ATTR_LINE_STYLE ( SID_SVX_START + 169 )
+#define SID_ATTR_LINE_DASH ( SID_SVX_START + 170 )
+#define SID_ATTR_LINE_WIDTH ( SID_SVX_START + 171 )
+#define SID_ATTR_LINE_COLOR ( SID_SVX_START + 172 )
+#define SID_ATTR_LINE_START ( SID_SVX_START + 173 )
+#define SID_ATTR_LINE_END ( SID_SVX_START + 174 )
+#define SID_ATTR_LINE_STARTWIDTH ( SID_SVX_START + 175 )
+#define SID_ATTR_LINE_ENDWIDTH ( SID_SVX_START + 176 )
+#define SID_ATTR_LINE_STARTCENTER ( SID_SVX_START + 177 )
+#define SID_ATTR_LINE_ENDCENTER ( SID_SVX_START + 178 )
+#define SID_COLOR_TABLE ( SID_SVX_START + 179 )
+#define SID_GRADIENT_LIST ( SID_SVX_START + 180 )
+#define SID_HATCH_LIST ( SID_SVX_START + 181 )
+#define SID_BITMAP_LIST ( SID_SVX_START + 182 )
+#define SID_DASH_LIST ( SID_SVX_START + 183 )
+#define SID_LINEEND_LIST ( SID_SVX_START + 184 )
+#define SID_BACKGROUND_COLOR ( SID_SVX_START + 185 )
+#define SID_BACKGROUND_PATTERN ( SID_SVX_START + 186 )
+#define SID_ATTR_BORDER ( SID_SVX_START + 187 )
+#define SID_INSERT_FIXEDTEXT ( SID_SVX_START + 188 )
+#define SID_INSERT_GROUPBOX ( SID_SVX_START + 189 )
+#define SID_INSERT_EDIT ( SID_SVX_START + 190 )
+#define SID_INSERT_LISTBOX ( SID_SVX_START + 191 )
+#define SID_INSERT_COMBOBOX ( SID_SVX_START + 192 )
+#define SID_INSERT_SPINBUTTON ( SID_SVX_START + 193 )
+#define SID_INSERT_HSCROLLBAR ( SID_SVX_START + 194 )
+#define SID_INSERT_VSCROLLBAR ( SID_SVX_START + 195 )
+#define SID_INSERT_PREVIEW ( SID_SVX_START + 196 )
+#define SID_INSERT_URLBUTTON ( SID_SVX_START + 197 )
+#define SID_INSERT_SELECT ( SID_SVX_START + 198 )
+#define SID_DIALOG_TESTMODE ( SID_SVX_START + 199 )
+#define SID_FRAME_LINESTYLE ( SID_SVX_START + 200 )
+#define SID_FRAME_LINECOLOR ( SID_SVX_START + 201 )
+#define SID_ATTR_GRID_USE ( SID_SVX_START + 202 )
+#define SID_ATTR_GRID_VISIBLE ( SID_SVX_START + 203 )
+#define SID_ATTR_GRID_DRAW_X ( SID_SVX_START + 204 )
+#define SID_ATTR_GRID_DRAW_Y ( SID_SVX_START + 205 )
+#define SID_ATTR_GRID_DIVISION_X ( SID_SVX_START + 206 )
+#define SID_ATTR_GRID_DIVISION_Y ( SID_SVX_START + 207 )
+#define SID_ATTR_GRID_SNAP_X ( SID_SVX_START + 208 )
+#define SID_ATTR_GRID_SNAP_Y ( SID_SVX_START + 209 )
+#define SID_ATTR_GRID_ORIGIN_X ( SID_SVX_START + 210 )
+#define SID_ATTR_GRID_ORIGIN_Y ( SID_SVX_START + 211 )
+#define SID_IMPORT_GRAPH_PREVIEW ( SID_SVX_START + 212 )
+#define SID_IMPORT_GRAPH_LASTPATH ( SID_SVX_START + 213 )
+#define SID_IMPORT_GRAPH_LASTFILTER ( SID_SVX_START + 214 )
+#define SID_SEARCHDLG_SEARCHSTRINGS ( SID_SVX_START + 215 )
+#define SID_SEARCHDLG_REPLACESTRINGS ( SID_SVX_START + 216 )
+#define SID_ATTR_TABLE ( SID_SVX_START + 217 )
+#define SID_ATTR_TABLE_COLUMN ( SID_SVX_START + 218 )
+#define SID_ATTR_TABLE_ROW ( SID_SVX_START + 219 )
+#define SID_ATTR_COLUMNS ( SID_SVX_START + 220 )
+#define SID_ATTR_INSERT ( SID_SVX_START + 221 )
+#define SID_ATTR_ZOOM_USER ( SID_SVX_START + 222 )
+#define SID_ATTR_POSITION ( SID_SVX_START + 223 )
+#define SID_ATTR_SIZE ( SID_SVX_START + 224 )
+#define SID_TABLE_CELL ( SID_SVX_START + 225 )
+#define SID_ATTR_ALIGN_HOR_JUSTIFY ( SID_SVX_START + 226 )
+#define SID_ATTR_ALIGN_VER_JUSTIFY ( SID_SVX_START + 227 )
+#define SID_ATTR_ALIGN_MARGIN ( SID_SVX_START + 228 )
+#define SID_ATTR_ALIGN_STACKED ( SID_SVX_START + 229 )
+#define SID_ATTR_ALIGN_LINEBREAK ( SID_SVX_START + 230 )
+#define SID_OUTLINE_COLLAPSE ( SID_SVX_START + 231 )
+#define SID_OUTLINE_EXPAND_ALL ( SID_SVX_START + 232 )
+#define SID_OUTLINE_EXPAND ( SID_SVX_START + 233 )
+#define SID_OUTLINE_DELETEALL ( SID_SVX_START + 234 )
+#define SID_ATTR_TRANSFORM_PROTECT_POS ( SID_SVX_START + 236 )
+#define SID_ATTR_TRANSFORM_PROTECT_SIZE ( SID_SVX_START + 237 )
+#define SID_ATTR_TRANSFORM_AUTOSIZE ( SID_SVX_START + 238 ) // !!!
+#define SID_ATTR_TRANSFORM_INTERN ( SID_SVX_START + 239 )
+#define SID_INSERT_FRAME ( SID_SVX_START + 240 )
+#define SID_INSERT_GRAPHIC ( SID_SVX_START + 241 )
+#define SID_AUTOFORMAT ( SID_SVX_START + 242 )
+#define SID_SPELL_DIALOG ( SID_SVX_START + 243 )
+#define SID_INSERT_DRAW ( SID_SVX_START + 244 )
+#define SID_THESAURUS ( SID_SVX_START + 245 )
+#define SID_AUTOCOMPLETEWORD ( SID_SVX_START + 251 )
+#define SID_DRAW_TEXT ( SID_SVX_START + 253 )
+#define SID_DRAW_CAPTION ( SID_SVX_START + 254 )
+#define SID_INSERT_LEGEND SID_DRAW_CAPTION
+#define SID_DRAW_SELECT ( SID_SVX_START + 255 )
+#define SID_FONTWORK ( SID_SVX_START + 256 )
+#define SID_FORMTEXT_STYLE ( SID_SVX_START + 257 )
+#define SID_FORMTEXT_ADJUST ( SID_SVX_START + 258 )
+#define SID_FORMTEXT_DISTANCE ( SID_SVX_START + 259 )
+#define SID_FORMTEXT_START ( SID_SVX_START + 260 )
+#define SID_FORMTEXT_MIRROR ( SID_SVX_START + 261 )
+#define SID_FORMTEXT_OUTLINE ( SID_SVX_START + 262 )
+#define SID_FORMTEXT_SHADOW ( SID_SVX_START + 263 )
+#define SID_FORMTEXT_SHDWCOLOR ( SID_SVX_START + 264 )
+#define SID_FORMTEXT_SHDWXVAL ( SID_SVX_START + 265 )
+#define SID_FORMTEXT_SHDWYVAL ( SID_SVX_START + 266 )
+#define SID_FORMTEXT_STDFORM ( SID_SVX_START + 267 )
+#define SID_FORMTEXT_HIDEFORM ( SID_SVX_START + 268 )
+#define SID_FORMTEXT_RESERVED1 ( SID_SVX_START + 269 )
+#define SID_FORMTEXT_RESERVED2 ( SID_SVX_START + 270 )
+#define SID_FORMTEXT_RESERVED3 ( SID_SVX_START + 271 )
+#define SID_FORMTEXT_RESERVED4 ( SID_SVX_START + 272 )
+#define SID_FORMTEXT_RESERVED5 ( SID_SVX_START + 273 )
+#define SID_FORMTEXT_RESERVED_LAST ( SID_SVX_START + 274 )
+#define SID_GALLERY_ENABLE_ADDCOPY ( SID_SVX_START + 276 )
+#define SID_GALLERY_IMPORTTHEME ( SID_SVX_START + 277 )
+#define SID_GALLERY_BG_POS ( SID_SVX_START + 278 )
+//#define SID_GALLERY_BG_BRUSH ( SID_SVX_START + 279 ) -> sfxsids.hrc
+#define SID_GALLERY_FORMATS ( SID_SVX_START + 280 )
+//#define SID_SEARCH_OPTIONS ( SID_SVX_START + 281 ) -> sfxsids.hrc
+#define SID_OBJECT_HELL ( SID_SVX_START + 282 )
+#define SID_OBJECT_HEAVEN ( SID_SVX_START + 283 )
+#define SID_ATTR_LONG_ULSPACE ( SID_SVX_START + 284 )
+#define SID_ATTR_LONG_LRSPACE ( SID_SVX_START + 285 )
+#define SID_FRAME_TO_TOP ( SID_SVX_START + 286 )
+#define SID_FRAME_TO_BOTTOM ( SID_SVX_START + 287 )
+#define SID_POSTIT ( SID_SVX_START + 288 )
+//#define SID_ZOOM ( SID_SVX_START + 289 ) -> sfxsids.hrc
+#define SID_GRID ( SID_SVX_START + 290 )
+//#define SID_SEARCH_ITEM ( SID_SVX_START + 291 ) -> sfxsids.hrc
+#define SID_SEARCH_SEARCHSET ( SID_SVX_START + 292 )
+#define SID_SEARCH_REPLACESET ( SID_SVX_START + 293 )
+#define SID_SET_SUPER_SCRIPT ( SID_SVX_START + 294 )
+#define SID_SET_SUB_SCRIPT ( SID_SVX_START + 295 )
+#define SID_CHAR_DLG ( SID_SVX_START + 296 )
+#define SID_PARA_DLG ( SID_SVX_START + 297 )
+#define SID_ATTR_GRID_OPTIONS ( SID_SVX_START + 298 )
+#define SID_ATTR_FILL_SHADOW ( SID_SVX_START + 299 )
+#define SID_ATTR_LINEEND_STYLE ( SID_SVX_START + 301 )
+#define SID_ATTR_TRANSFORM_SLANT ( SID_SVX_START + 302 ) // !!!
+#define SID_ATTR_TRANSFORM_SHEAR ( SID_SVX_START + 304 )
+#define SID_ATTR_TRANSFORM_SHEAR_X ( SID_SVX_START + 305 )
+#define SID_ATTR_TRANSFORM_SHEAR_Y ( SID_SVX_START + 306 )
+#define SID_ATTR_TRANSFORM_SHEAR_VERTICAL ( SID_SVX_START + 307 )
+#define SID_ATTR_TRANSFORM_RESIZE_REF_X ( SID_SVX_START + 308 )
+#define SID_ATTR_TRANSFORM_RESIZE_REF_Y ( SID_SVX_START + 309 )
+#define SID_ATTR_TRANSFORM_AUTOWIDTH ( SID_SVX_START + 310 )
+#define SID_ATTR_TRANSFORM_AUTOHEIGHT ( SID_SVX_START + 311 )
+#define SID_ATTR_TRANSFORM_HORI_RELATION ( SID_SVX_START + 312 )
+#define SID_ATTR_TRANSFORM_VERT_RELATION ( SID_SVX_START + 313 )
+#define SID_ATTR_TRANSFORM_HORI_ORIENT ( SID_SVX_START + 314 )
+#define SID_ATTR_TRANSFORM_IN_VERTICAL_TEXT ( SID_SVX_START + 315 )
+#define SID_ATTR_TRANSFORM_IN_RTL_TEXT ( SID_SVX_START + 316 )
+#define SID_ATTR_TRANSFORM_HORI_MIRROR ( SID_SVX_START + 317 )
+#define SID_ATTR_TRANSFORM_ANCHOR ( SID_SVX_START + 318 )
+#define SID_ATTR_TRANSFORM_VERT_ORIENT ( SID_SVX_START + 319 )
+#define SID_TAB_INSERT ( SID_SVX_START + 320 )
+#define SID_TAB_COUNT ( SID_SVX_START + 321 )
+#define SID_TAB_POSITION ( SID_SVX_START + 322 )
+#define SID_TAB_ADJUST ( SID_SVX_START + 323 )
+#define SID_TAB_DECIMAL ( SID_SVX_START + 324 )
+#define SID_TAB_FILLCHAR ( SID_SVX_START + 325 )
+#define SID_SCAN ( SID_SVX_START + 330 )
+#define SID_TWAIN_SELECT ( SID_SVX_START + 331 )
+#define SID_TWAIN_TRANSFER ( SID_SVX_START + 332 )
+#define SID_CONTOUR_DLG ( SID_SVX_START + 334 )
+#define SID_CONTOUR_EXEC ( SID_SVX_START + 335 )
+#define SID_BORDER_OBJECT ( SID_SVX_START + 340 )
+#define SID_BORDER_LEFTLINE ( SID_SVX_START + 341 )
+#define SID_BORDER_RIGHTLINE ( SID_SVX_START + 342 )
+#define SID_BORDER_TOPLINE ( SID_SVX_START + 343 )
+#define SID_BORDER_BOTTOMLINE ( SID_SVX_START + 344 )
+#define SID_BORDER_HORIZONTALLINE ( SID_SVX_START + 345 )
+#define SID_BORDER_VERTICALLINE ( SID_SVX_START + 346 )
+#define SID_BORDER_DISTANCE ( SID_SVX_START + 347 )
+#define SID_SB_CONNECTIONPOOLING ( SID_SVX_START + 348 )
+#define SID_SB_DBREGISTEROPTIONS ( SID_SVX_START + 349 )
+#define SID_BMPMASK ( SID_SVX_START + 350 )
+#define SID_BMPMASK_PIPETTE ( SID_SVX_START + 351 )
+#define SID_BMPMASK_BMPSELECT ( SID_SVX_START + 352 )
+#define SID_BMPMASK_EXEC ( SID_SVX_START + 353 )
+//#define SID_HYPERLINK_INSERT ( SID_SVX_START + 360 ) -> sfxsids.hrc
+//#define SID_HYPERLINK_GETLINK ( SID_SVX_START + 361 ) -> sfxsids.hrc
+//#define SID_HYPERLINK_SETLINK ( SID_SVX_START + 362 ) -> sfxsids.hrc
+#define SID_NO_GRAPHICS ( SID_SVX_START + 364 )
+#define SID_IMPORT_GRAPH_LASTURL ( SID_SVX_START + 365 )
+//#define SID_NAVIGATOR ( SID_SVX_START + 366 ) -> sfxsids.hrc
+#define SID_ATTR_TEXT_FITTOSIZE ( SID_SVX_START + 367 )
+#define SID_ATTR_BRUSH_ROW ( SID_SVX_START + 368 )
+#define SID_OPTFILTER_MSOFFICE ( SID_SVX_START + 369 )
+//#define SID_TASKPANE ( SID_SVX_START + 370 ) -> sfxsids.hrc
+#define SID_IMAP ( SID_SVX_START + 371 )
+#define SID_IMAP_DLG ( SID_SVX_START + 372 )
+#define SID_IMAP_SELECT ( SID_SVX_START + 373 )
+#define SID_IMAP_EXEC ( SID_SVX_START + 374 )
+#define SID_SHOW_HIDDEN ( SID_SVX_START + 375 )
+#define SID_SHOW_FORMS ( SID_SVX_START + 376 )
+#define SID_DRAW_RECT_NOFILL ( SID_SVX_START + 378 )
+#define SID_DRAW_RECT_ROUND_NOFILL ( SID_SVX_START + 379 )
+#define SID_DRAW_SQUARE ( SID_SVX_START + 380 )
+#define SID_DRAW_SQUARE_ROUND ( SID_SVX_START + 381 )
+#define SID_DRAW_SQUARE_NOFILL ( SID_SVX_START + 382 )
+#define SID_DRAW_SQUARE_ROUND_NOFILL ( SID_SVX_START + 383 )
+#define SID_DRAW_ELLIPSE_NOFILL ( SID_SVX_START + 384 )
+#define SID_DRAW_CIRCLE ( SID_SVX_START + 385 )
+#define SID_DRAW_CIRCLE_NOFILL ( SID_SVX_START + 386 )
+#define SID_DRAW_PIE_NOFILL ( SID_SVX_START + 387 )
+#define SID_DRAW_CIRCLEPIE ( SID_SVX_START + 388 )
+#define SID_DRAW_CIRCLEPIE_NOFILL ( SID_SVX_START + 389 )
+#define SID_DRAW_CIRCLEARC ( SID_SVX_START + 390 )
+#define SID_DRAW_CIRCLECUT_NOFILL ( SID_SVX_START + 391 )
+#define SID_DRAW_ELLIPSECUT ( SID_SVX_START + 392 )
+#define SID_DRAW_ELLIPSECUT_NOFILL ( SID_SVX_START + 393 )
+#define SID_DRAW_XPOLYGON ( SID_SVX_START + 394 )
+#define SID_DRAW_POLYGON_NOFILL ( SID_SVX_START + 395 )
+#define SID_DRAW_XPOLYGON_NOFILL ( SID_SVX_START + 396 )
+#define SID_DRAW_BEZIER_NOFILL ( SID_SVX_START + 397 )
+#define SID_DRAWTBX_TEXT ( SID_SVX_START + 398 )
+#define SID_DRAWTBX_RECTANGLES ( SID_SVX_START + 399 )
+#define SID_DRAWTBX_ELLIPSES ( SID_SVX_START + 400 )
+#define SID_DRAWTBX_LINES ( SID_SVX_START + 401 )
+//#define SID_ZOOM_NEXT ( SID_SVX_START + 402 ) -> sfxsids.hrc
+//#define SID_ZOOM_PREV ( SID_SVX_START + 403 ) -> sfxsids.hrc
+#define SID_BACKGRND_DESTINATION ( SID_SVX_START + 404 )
+#define SID_ATTR_FLASH ( SID_SVX_START + 406 )
+#define SID_ATTR_3D_LIGHT ( SID_SVX_START + 407 ) /* --> Slots mit --> koennen demnaechst entfallen ( heute 12.03.1998 ) */
+#define SID_ATTR_3D_START SID_ATTR_3D_LIGHT
+#define SID_ATTR_3D_LIGHTINTENSITY ( SID_SVX_START + 408 ) /* --> Slots mit --> koennen demnaechst entfallen ( heute 12.03.1998 ) */
+#define SID_ATTR_3D_LIGHTCOLOR ( SID_SVX_START + 409 ) /* --> Slots mit --> koennen demnaechst entfallen ( heute 12.03.1998 ) */
+#define SID_ATTR_3D_AMBIENTINTENSITY ( SID_SVX_START + 410 ) /* --> Slots mit --> koennen demnaechst entfallen ( heute 12.03.1998 ) */
+#define SID_ATTR_3D_AMBIENTCOLOR ( SID_SVX_START + 411 )
+#define SID_IMPORT_GRAPH_LINK ( SID_SVX_START + 412 )
+
+//! moved to sfx2, still in use:
+//#define SID_HTML_MODE ( SID_SVX_START + 414 )
+
+#define SID_RULER_PROTECT ( SID_SVX_START + 415 )
+//#define SID_INET_DLG ( SID_SVX_START + 416 ) -> sfxsids.hrc
+#define SID_COLOR_CONTROL ( SID_SVX_START + 417 )
+#define SID_ATTR_3D_PERSPECTIVE ( SID_SVX_START + 418 )
+#define SID_ATTR_3D_DEPTH ( SID_SVX_START + 419 )
+#define SID_ATTR_3D_DISTANCE ( SID_SVX_START + 420 )
+#define SID_ATTR_3D_FOCAL_LENGTH ( SID_SVX_START + 421 )
+#define SID_ATTR_3D_INTERN ( SID_SVX_START + 422 )
+#define SID_PSZ_FUNCTION ( SID_SVX_START + 423 )
+//#define SID_AUTO_CORRECT_DLG ( SID_SVX_START + 424 ) -> sfxsids.hrc
+#define SID_OFASLOTS_START ( SID_SVX_START + 425 )
+//#define SID_SD_AUTOPILOT ( SID_SVX_START + 425 ) -> sfxsids.hrc
+#define SID_AUTOPILOT SID_SD_AUTOPILOT
+
+#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 )
+#define SID_SW_EDITOPTIONS ( SID_SVX_START + 433 )
+#define SID_SD_EDITOPTIONS ( SID_SVX_START + 434 )
+#define SID_SC_EDITOPTIONS ( SID_SVX_START + 435 )
+#define SID_SM_EDITOPTIONS ( SID_SVX_START + 436 )
+#define SID_SCH_EDITOPTIONS ( SID_SVX_START + 437 )
+#define SID_SIM_EDITOPTIONS ( SID_SVX_START + 438 )
+#define SID_SW_ONLINEOPTIONS ( SID_SVX_START + 439 )
+#define SID_MN_OPTIONS ( SID_SVX_START + 440 )
+#define SID_GET_COLORTABLE ( SID_SVX_START + 441 )
+#define SID_MN_INSERT_OBJECT_DLGS ( SID_SVX_START + 442 )
+#define SID_OUTLINE_TO_IMPRESS ( SID_SVX_START + 443 )
+#define SID_SIM_TP_COLOR ( SID_SVX_START + 444 )
+#define SID_SIM_TP_EFFECTS ( SID_SVX_START + 445 )
+#define SID_SPELLCHECKER_CHANGED ( SID_SVX_START + 446 )
+#define SID_SD_GRAPHIC_OPTIONS ( SID_SVX_START + 447 )
+#define SID_SM_TP_PRINTOPTIONS ( SID_SVX_START + 448 )
+#define SID_OFASLOTS_END ( SID_SVX_START + 449 )
+#define SID_SB_STARBASEOPTIONS ( SID_SVX_START + 450 )
+#define SID_SWREGISTER_COLLECTION ( SID_SVX_START + 451 )
+#define SID_FILTER_DLG ( SID_SVX_START + 452 )
+#define SID_ATTR_BRUSH_TABLE ( SID_SVX_START + 453 )
+#define SID_GROUP ( SID_SVX_START + 454 )
+#define SID_UNGROUP ( SID_SVX_START + 455 )
+#define SID_SET_DEFAULT ( SID_SVX_START + 456 )
+#define SID_BEZIER ( SID_SVX_START + 458 )
+#define SID_ATTR_3D_DOUBLE_SIDED ( SID_SVX_START + 459 )
+#define SID_ATTR_ALIGN_INDENT ( SID_SVX_START + 460 )
+#define SID_DEC_INDENT ( SID_SVX_START + 461 )
+#define SID_INC_INDENT ( SID_SVX_START + 462 )
+#define SID_DRAW_FREELINE ( SID_SVX_START + 463 )
+#define SID_DRAW_FREELINE_NOFILL ( SID_SVX_START + 464 )
+#define SID_DRAW_TEXT_MARQUEE ( SID_SVX_START + 465 )
+#define SID_SCH_TP_DEFCOLORS ( SID_SVX_START + 466 )
+#define SID_SWREGISTER_MODE ( SID_SVX_START + 467 )
+#define SID_OPTBASE_DATABASENAMES ( SID_SVX_START + 468 )
+#define SID_GRFFILTER ( SID_SVX_START + 469 )
+#define SID_GRFFILTER_INVERT ( SID_SVX_START + 470 )
+#define SID_GRFFILTER_SMOOTH ( SID_SVX_START + 471 )
+#define SID_GRFFILTER_SHARPEN ( SID_SVX_START + 472 )
+#define SID_GRFFILTER_REMOVENOISE ( SID_SVX_START + 473 )
+#define SID_GRFFILTER_SOBEL ( SID_SVX_START + 474 )
+#define SID_GRFFILTER_MOSAIC ( SID_SVX_START + 475 )
+#define SID_GRFFILTER_EMBOSS ( SID_SVX_START + 476 )
+#define SID_GRFFILTER_POSTER ( SID_SVX_START + 477 )
+#define SID_GRFFILTER_POPART ( SID_SVX_START + 478 )
+#define SID_GRFFILTER_SEPIA ( SID_SVX_START + 479 )
+#define SID_GRFFILTER_SOLARIZE ( SID_SVX_START + 480 )
+#define SID_COLL_CLEAR ( SID_SVX_START + 536 )
+#define SID_SHOW_ADDRESS ( SID_SVX_START + 538 )
+#define SID_APP_ENTERWAIT ( SID_SVX_START + 550 )
+#define SID_APP_LEAVEWAIT ( SID_SVX_START + 551 )
+#define SID_APP_ISWAIT ( SID_SVX_START + 552 )
+#define SID_OFA_TBL_DESIGNVIEW ( SID_SVX_START + 554 )
+#define SID_OFA_TBL_ADRESSBOOK ( SID_SVX_START + 555 )
+#define SID_OFA_QRY_DESIGNVIEW ( SID_SVX_START + 556 )
+#define SID_OFA_QRY_SQLVIEW ( SID_SVX_START + 557 )
+#define SID_OFA_FRM_DESIGNVIEW ( SID_SVX_START + 558 )
+#define SID_OFA_RPT_DESIGNVIEW ( SID_SVX_START + 559 )
+#define SID_OFA_TBL_CREATE ( SID_SVX_START + 560 )
+#define SID_OFA_QRY_CREATE ( SID_SVX_START + 561 )
+#define SID_OFA_FRM_CREATE ( SID_SVX_START + 562 )
+#define SID_OFA_RPT_CREATE ( SID_SVX_START + 563 )
+#define SID_FIELD_GRABFOCUS ( SID_SVX_START + 567 )
+#define SID_ATTR_3D_HORZ_SEGS ( SID_SVX_START + 568 )
+#define SID_ATTR_3D_VERT_SEGS ( SID_SVX_START + 569 )
+#define SID_ATTR_3D_DUMMY_1 ( SID_SVX_START + 570 )
+#define SID_ATTR_3D_DUMMY_2 ( SID_SVX_START + 571 )
+#define SID_BROWSER_DLG ( SID_SVX_START + 572 )
+#define SID_OFA_TBL_COMPRESS ( SID_SVX_START + 576 )
+#define SID_ATTR_ALIGN_DEGREES ( SID_SVX_START + 577 )
+#define SID_ATTR_ALIGN_LOCKPOS ( SID_SVX_START + 578 )
+#define SID_ATTR_LINEEND_WIDTH_DEFAULT ( SID_SVX_START + 579 )
+#define SID_ATTR_NUMBERFORMAT_ONE_AREA ( SID_SVX_START + 580 )
+#define SID_FUNCTION_CONTROL ( SID_SVX_START + 581 )
+#define SID_TAB_REMOVE ( SID_SVX_START + 582 )
+#define SID_TAB_REMOVE_ALL ( SID_SVX_START + 583 )
+#define SID_TAB_REMOVE_BY_INDEX ( SID_SVX_START + 584 )
+#define SID_OFA_VW_CREATE ( SID_SVX_START + 585 )
+#define SID_OFA_REL_DESIGNVIEW ( SID_SVX_START + 588 )
+#define SID_OFA_MANUAL_SQL ( SID_SVX_START + 589 )
+#define SID_PARA_BACKGRND_DESTINATION ( SID_SVX_START + 590 )
+
+#define SID_FMSLOTS_START ( SID_SVX_START + 592 )
+#define SID_FM_CONFIG ( SID_SVX_START + 593 )
+#define SID_FM_PUSHBUTTON ( SID_SVX_START + 594 )
+#define SID_FM_RADIOBUTTON ( SID_SVX_START + 595 )
+#define SID_FM_CHECKBOX ( SID_SVX_START + 596 )
+#define SID_FM_FIXEDTEXT ( SID_SVX_START + 597 )
+#define SID_FM_GROUPBOX ( SID_SVX_START + 598 )
+#define SID_FM_EDIT ( SID_SVX_START + 599 )
+#define SID_FM_LISTBOX ( SID_SVX_START + 600 )
+#define SID_FM_COMBOBOX ( SID_SVX_START + 601 )
+#define SID_FM_DBGRID ( SID_SVX_START + 603 )
+#define SID_FM_IMAGEBUTTON ( SID_SVX_START + 604 )
+#define SID_FM_FILECONTROL ( SID_SVX_START + 605 )
+#define SID_FM_CHANGECOL ( SID_SVX_START + 606 )
+#define SID_FM_NAVIGATIONBAR ( SID_SVX_START + 607 )
+#define SID_FM_NEW_HIDDEN ( SID_SVX_START + 608 )
+#define SID_FM_RENAME_OBJECT ( SID_SVX_START + 609 )
+#define SID_FM_DELETEROWS ( SID_SVX_START + 610 )
+#define SID_FM_INSERTCOL ( SID_SVX_START + 611 )
+#define SID_FM_DELETECOL ( SID_SVX_START + 612 )
+#define SID_FM_CTL_PROPERTIES ( SID_SVX_START + 613 )
+#define SID_FM_PROPERTIES ( SID_SVX_START + 614 )
+#define SID_FM_TAB_DIALOG ( SID_SVX_START + 615 )
+#define SID_FM_RECORD_FIRST ( SID_SVX_START + 616 )
+#define SID_FM_RECORD_NEXT ( SID_SVX_START + 617 )
+#define SID_FM_RECORD_PREV ( SID_SVX_START + 618 )
+#define SID_FM_RECORD_LAST ( SID_SVX_START + 619 )
+#define SID_FM_RECORD_NEW ( SID_SVX_START + 620 )
+#define SID_FM_RECORD_DELETE ( SID_SVX_START + 621 )
+#define SID_FM_RECORD_ABSOLUTE ( SID_SVX_START + 622 )
+#define SID_FM_ADD_FIELD ( SID_SVX_START + 623 )
+#define SID_FM_RECORD_TEXT ( SID_SVX_START + 624 )
+#define SID_FM_RECORD_FROM_TEXT ( SID_SVX_START + 625 )
+#define SID_FM_RECORD_TOTAL ( SID_SVX_START + 626 )
+#define SID_FM_RECORD_SAVE ( SID_SVX_START + 627 )
+#define SID_FM_CREATE_CONTROL ( SID_SVX_START + 628 )
+#define SID_FM_DESIGN_MODE ( SID_SVX_START + 629 )
+#define SID_FM_RECORD_UNDO ( SID_SVX_START + 630 )
+#define SID_FM_CONTROL_IDENTIFIER ( SID_SVX_START + 631 )
+#define SID_FM_CONTROL_INVENTOR ( SID_SVX_START + 632 )
+#define SID_FM_SHOW_FMEXPLORER ( SID_SVX_START + 633 )
+#define SID_FM_FIELDS_CONTROL ( SID_SVX_START + 634 )
+#define SID_FM_SHOW_PROPERTIES ( SID_SVX_START + 635 )
+#define SID_FM_PROPERTY_CONTROL ( SID_SVX_START + 636 )
+#define SID_FM_FMEXPLORER_CONTROL ( SID_SVX_START + 637 )
+#define SID_FM_NEW ( SID_SVX_START + 638 )
+#define SID_FM_DELETE ( SID_SVX_START + 639 )
+#define SID_FM_NEW_FORM ( SID_SVX_START + 640 )
+#define SID_FMSLOTS_END ( SID_SVX_START + 641 )
+#define SID_REDLIN_FILTER_PAGE ( SID_SVX_START + 642 )
+#define SID_REDLIN_VIEW_PAGE ( SID_SVX_START + 643 )
+#define SID_3D_WIN ( SID_SVX_START + 644 )
+#define SID_3D_STATE ( SID_SVX_START + 645 )
+#define SID_3D_INIT ( SID_SVX_START + 646 )
+#define SID_3D_ASSIGN ( SID_SVX_START + 647 )
+#define SID_CONVERT_TO_3D ( SID_SVX_START + 648 )
+#define SID_CONVERT_TO_3D_LATHE_FAST ( SID_SVX_START + 649 )
+#define SID_ATTR_3D_PERCENT_DIAGONAL ( SID_SVX_START + 650 )
+#define SID_ATTR_3D_BACKSCALE ( SID_SVX_START + 651 )
+#define SID_ATTR_3D_END_ANGLE ( SID_SVX_START + 652 )
+#define SID_ATTR_3D_NORMALS_KIND ( SID_SVX_START + 653 )
+#define SID_ATTR_3D_NORMALS_INVERT ( SID_SVX_START + 654 )
+#define SID_ATTR_3D_TWO_SIDED_LIGHTING ( SID_SVX_START + 655 )
+#define SID_ATTR_3D_TEXTURE_KIND ( SID_SVX_START + 656 )
+#define SID_ATTR_3D_TEXTURE_MODE ( SID_SVX_START + 657 )
+#define SID_ATTR_3D_TEXTURE_PROJ_X ( SID_SVX_START + 658 )
+#define SID_ATTR_3D_TEXTURE_PROJ_Y ( SID_SVX_START + 659 )
+#define SID_ATTR_3D_TEXTURE_FILTER ( SID_SVX_START + 660 )
+#define SID_ATTR_3D_MAT_COLOR ( SID_SVX_START + 661 )
+#define SID_ATTR_3D_MAT_EMISSION ( SID_SVX_START + 662 )
+#define SID_ATTR_3D_MAT_SPECULAR ( SID_SVX_START + 663 )
+#define SID_ATTR_3D_MAT_SPECULAR_INTENSITY ( SID_SVX_START + 664 )
+#define SID_ATTR_3D_SHADE_MODE ( SID_SVX_START + 665 )
+#define SID_ATTR_3D_SHADOW_3D ( SID_SVX_START + 666 )
+#define SID_ATTR_3D_SHADOW_SLANT ( SID_SVX_START + 667 )
+#define SID_ATTR_3D_LIGHTCOLOR_1 ( SID_SVX_START + 668 )
+#define SID_ATTR_3D_LIGHTCOLOR_2 ( SID_SVX_START + 669 )
+#define SID_ATTR_3D_LIGHTCOLOR_3 ( SID_SVX_START + 670 )
+#define SID_ATTR_3D_LIGHTCOLOR_4 ( SID_SVX_START + 671 )
+#define SID_ATTR_3D_LIGHTCOLOR_5 ( SID_SVX_START + 672 )
+#define SID_ATTR_3D_LIGHTCOLOR_6 ( SID_SVX_START + 673 )
+#define SID_ATTR_3D_LIGHTCOLOR_7 ( SID_SVX_START + 674 )
+#define SID_ATTR_3D_LIGHTCOLOR_8 ( SID_SVX_START + 675 )
+#define SID_ATTR_3D_LIGHTON_1 ( SID_SVX_START + 676 )
+#define SID_ATTR_3D_LIGHTON_2 ( SID_SVX_START + 677 )
+#define SID_ATTR_3D_LIGHTON_3 ( SID_SVX_START + 678 )
+#define SID_ATTR_3D_LIGHTON_4 ( SID_SVX_START + 679 )
+#define SID_ATTR_3D_LIGHTON_5 ( SID_SVX_START + 680 )
+#define SID_ATTR_3D_LIGHTON_6 ( SID_SVX_START + 681 )
+#define SID_ATTR_3D_LIGHTON_7 ( SID_SVX_START + 682 )
+#define SID_ATTR_3D_LIGHTON_8 ( SID_SVX_START + 683 )
+#define SID_ATTR_3D_LIGHTDIRECTION_1 ( SID_SVX_START + 684 )
+#define SID_ATTR_3D_LIGHTDIRECTION_2 ( SID_SVX_START + 685 )
+#define SID_ATTR_3D_LIGHTDIRECTION_3 ( SID_SVX_START + 686 )
+#define SID_ATTR_3D_LIGHTDIRECTION_4 ( SID_SVX_START + 687 )
+#define SID_ATTR_3D_LIGHTDIRECTION_5 ( SID_SVX_START + 688 )
+#define SID_ATTR_3D_LIGHTDIRECTION_6 ( SID_SVX_START + 689 )
+#define SID_ATTR_3D_LIGHTDIRECTION_7 ( SID_SVX_START + 690 )
+#define SID_ATTR_3D_LIGHTDIRECTION_8 ( SID_SVX_START + 691 )
+#define SID_ATTR_3D_END SID_ATTR_3D_LIGHTDIRECTION_8
+#define SID_ATTR_3D_DUMMY_3 ( SID_SVX_START + 692 )
+#define SID_ATTR_3D_DUMMY_4 ( SID_SVX_START + 693 )
+#define SID_ATTR_3D_DUMMY_5 ( SID_SVX_START + 694 )
+#define SID_ATTR_3D_DUMMY_6 ( SID_SVX_START + 695 )
+#define SID_ATTR_3D_DUMMY_7 ( SID_SVX_START + 696 )
+#define SID_ATTR_3D_DUMMY_8 ( SID_SVX_START + 697 )
+#define SID_ATTR_3D_DUMMY_9 ( SID_SVX_START + 698 )
+#define SID_ATTR_3D_DUMMY_10 ( SID_SVX_START + 699 )
+#define SID_ATTR_NUMBERFORMAT_NOLANGUAGE ( SID_SVX_START + 700 )
+#define SID_MN_GROUP ( SID_SVX_START + 701 )
+#define SID_FM_AUTO_ORDER ( SID_SVX_START + 702 )
+
+#define SID_MORE_FMSLOTS_START ( SID_SVX_START + 702 )
+#define SID_FM_SHOW_PROPERTY_BROWSER ( SID_SVX_START + 703 )
+#define SID_FM_DATEFIELD ( SID_SVX_START + 704 )
+#define SID_FM_TIMEFIELD ( SID_SVX_START + 705 )
+#define SID_FM_NUMERICFIELD ( SID_SVX_START + 706 )
+#define SID_FM_CURRENCYFIELD ( SID_SVX_START + 707 )
+#define SID_FM_PATTERNFIELD ( SID_SVX_START + 708 )
+#define SID_FM_OPEN_READONLY ( SID_SVX_START + 709 )
+#define SID_FM_IMAGECONTROL ( SID_SVX_START + 710 )
+#define SID_FM_REMOVE_FILTER_SORT ( SID_SVX_START + 711 )
+#define SID_FM_SORTUP ( SID_SVX_START + 712 )
+#define SID_FM_SORTDOWN ( SID_SVX_START + 713 )
+#define SID_FM_ORDERCRIT ( SID_SVX_START + 714 )
+#define SID_FM_FILTERCRIT ( SID_SVX_START + 715 )
+#define SID_FM_AUTOFILTER ( SID_SVX_START + 716 )
+#define SID_FM_COUNTALL ( SID_SVX_START + 717 )
+#define SID_FM_NATIVESQL ( SID_SVX_START + 720 )
+#define SID_FM_EXECUTE ( SID_SVX_START + 721 )
+#define SID_SBA_QRY_EXECUTE SID_FM_EXECUTE
+#define SID_FM_ADDTABLE ( SID_SVX_START + 722 )
+#define SID_FM_FORM_FILTERED ( SID_SVX_START + 723 )
+#define SID_FM_REFRESH ( SID_SVX_START + 724 )
+#define SID_FM_SEARCH ( SID_SVX_START + 725 )
+#define SID_FM_LEAVE_CREATE ( SID_SVX_START + 726 ) // Formcontroller-Button rauspoppen
+#define SID_FM_USE_WIZARDS ( SID_SVX_START + 727 )
+#define SID_FM_FORMATTEDFIELD ( SID_SVX_START + 728 )
+#define SID_FM_FILTER_START ( SID_SVX_START + 729 )
+#define SID_FM_FILTER_EXIT ( SID_SVX_START + 730 )
+#define SID_FM_FILTER_EXECUTE ( SID_SVX_START + 731 )
+#define SID_FM_FILTER_NAVIGATOR ( SID_SVX_START + 732 )
+#define SID_FM_CHANGECONTROLTYPE ( SID_SVX_START + 733 )
+#define SID_FM_CONVERTTO_EDIT ( SID_SVX_START + 734 )
+#define SID_FM_CONVERTTO_BUTTON ( SID_SVX_START + 735 )
+#define SID_FM_CONVERTTO_FIXEDTEXT ( SID_SVX_START + 736 )
+#define SID_FM_CONVERTTO_LISTBOX ( SID_SVX_START + 737 )
+#define SID_FM_CONVERTTO_CHECKBOX ( SID_SVX_START + 738 )
+#define SID_FM_CONVERTTO_RADIOBUTTON ( SID_SVX_START + 739 )
+#define SID_FM_CONVERTTO_GROUPBOX ( SID_SVX_START + 740 )
+#define SID_FM_CONVERTTO_COMBOBOX ( SID_SVX_START + 741 )
+#define SID_FM_CONVERTTO_IMAGEBUTTON ( SID_SVX_START + 743 )
+#define SID_FM_CONVERTTO_FILECONTROL ( SID_SVX_START + 744 )
+#define SID_FM_CONVERTTO_DATE ( SID_SVX_START + 745 )
+#define SID_FM_CONVERTTO_TIME ( SID_SVX_START + 746 )
+#define SID_FM_CONVERTTO_NUMERIC ( SID_SVX_START + 747 )
+#define SID_FM_CONVERTTO_CURRENCY ( SID_SVX_START + 748 )
+#define SID_FM_CONVERTTO_PATTERN ( SID_SVX_START + 749 )
+#define SID_FM_CONVERTTO_IMAGECONTROL ( SID_SVX_START + 750 )
+#define SID_FM_CONVERTTO_FORMATTED ( SID_SVX_START + 751 )
+#define SID_FM_FILTER_NAVIGATOR_CONTROL ( SID_SVX_START + 752 )
+#define SID_FM_HIDECOL ( SID_SVX_START + 753 )
+#define SID_FM_SHOWCOLS ( SID_SVX_START + 754 )
+#define SID_FM_SHOWCOLS_MORE ( SID_SVX_START + 755 )
+#define SID_FM_SHOWALLCOLS ( SID_SVX_START + 756 )
+#define SID_FM_TWOFIELDS_DATE_N_TIME ( SID_SVX_START + 757 )
+#define SID_FM_FILTER_EDIT ( SID_SVX_START + 758 )
+#define SID_FM_FILTER_IS_NULL ( SID_SVX_START + 759 )
+#define SID_FM_FILTER_IS_NOT_NULL ( SID_SVX_START + 760 )
+#define SID_FM_VIEW_AS_GRID ( SID_SVX_START + 761 )
+#define SID_FM_FILTER_REMOVE ( SID_SVX_START + 762 )
+#define SID_FM_AUTOCONTROLFOCUS ( SID_SVX_START + 763 )
+#define SID_DSBROWSER_EXPLORER ( SID_SVX_START + 764 )
+#define SID_FM_CREATE_FIELDCONTROL ( SID_SVX_START + 765 )
+#define SID_FM_DATACCESS_DESCRIPTOR ( SID_SVX_START + 766 )
+#define SID_FM_TOGGLECONTROLFOCUS ( SID_SVX_START + 767 )
+#define SID_FM_SCROLLBAR ( SID_SVX_START + 768 )
+#define SID_FM_SPINBUTTON ( SID_SVX_START + 769 )
+#define SID_FM_CONVERTTO_SCROLLBAR ( SID_SVX_START + 770 )
+#define SID_FM_CONVERTTO_SPINBUTTON ( SID_SVX_START + 771 )
+#define SID_FM_CONVERTTO_NAVIGATIONBAR ( SID_SVX_START + 772 )
+#define SID_FM_SHOW_DATANAVIGATOR ( SID_SVX_START + 773 )
+#define SID_FM_DATANAVIGATOR_CONTROL ( SID_SVX_START + 774 )
+#define SID_FM_REFRESH_FORM_CONTROL ( SID_SVX_START + 775 )
+#define SID_MORE_FMSLOTS_END ( SID_SVX_START + 850 )
+
+#define SID_HLINKBAR_LINK ( SID_SVX_START + 851 )
+#define SID_HLINKBAR_BOOKMARK ( SID_SVX_START + 852 )
+#define SID_HLINKBAR_SEARCH ( SID_SVX_START + 853 )
+#define SID_HLINKBAR_TARGET ( SID_SVX_START + 854 )
+#define SID_PARAM_NUM_PRESET ( SID_SVX_START + 856 )
+#define SID_PARAM_CUR_NUMBER ( SID_SVX_START + 857 )
+#define SID_PARAM_CHILD_LEVELS ( SID_SVX_START + 858 )
+#define SID_PARAM_CUR_NUM_LEVEL ( SID_SVX_START + 859 )
+#define SID_CREATE_SW_DRAWVIEW ( SID_SVX_START + 860 )
+#define SID_ATTR_GRAF_LUMINANCE ( SID_SVX_START + 863 )
+#define SID_ATTR_GRAF_CONTRAST ( SID_SVX_START + 864 )
+#define SID_ATTR_GRAF_RED ( SID_SVX_START + 865 )
+#define SID_ATTR_GRAF_GREEN ( SID_SVX_START + 866 )
+#define SID_ATTR_GRAF_BLUE ( SID_SVX_START + 867 )
+#define SID_ATTR_GRAF_GAMMA ( SID_SVX_START + 868 )
+#define SID_ATTR_GRAF_TRANSPARENCE ( SID_SVX_START + 869 )
+#define SID_ATTR_GRAF_INVERT ( SID_SVX_START + 870 )
+#define SID_ATTR_GRAF_MODE ( SID_SVX_START + 871 )
+#define SID_ATTR_GRAF_RESERVE2 ( SID_SVX_START + 872 )
+#define SID_ATTR_GRAF_RESERVE3 ( SID_SVX_START + 873 )
+#define SID_ATTR_GRAF_RESERVE4 ( SID_SVX_START + 874 )
+#define SID_ATTR_GRAF_RESERVE5 ( SID_SVX_START + 875 )
+//#define SID_COMP_BIBLIOGRAPHY ( SID_SVX_START + 880 ) -> sfxsids.hrc
+#define SID_ATTR_GRAF_KEEP_ZOOM ( SID_SVX_START + 882 )
+#define SID_ATTR_GRAF_CROP ( SID_SVX_START + 883 )
+#define SID_ATTR_GRAF_FRMSIZE ( SID_SVX_START + 884 )
+#define SID_ATTR_GRAF_FRMSIZE_PERCENT ( SID_SVX_START + 885 )
+#define SID_ATTR_GRAF_GRAPHIC ( SID_SVX_START + 886 )
+#define SID_ASIAN_DLG ( SID_SVX_START + 904 )
+#define SID_DRAW_TEXT_VERTICAL SID_ATTR_CHAR_VERTICAL
+#define SID_DRAW_CAPTION_VERTICAL ( SID_SVX_START + 906 )
+#define SID_TEXTDIRECTION_LEFT_TO_RIGHT ( SID_SVX_START + 907 )
+#define SID_TEXTDIRECTION_TOP_TO_BOTTOM ( SID_SVX_START + 908 )
+#define SID_TRANSLITERATE_UPPER ( SID_SVX_START + 912 )
+#define SID_TRANSLITERATE_LOWER ( SID_SVX_START + 913 )
+#define SID_TRANSLITERATE_HALFWIDTH ( SID_SVX_START + 914 )
+#define SID_TRANSLITERATE_FULLWIDTH ( SID_SVX_START + 915 )
+#define SID_TRANSLITERATE_HIRAGANA ( SID_SVX_START + 916 )
+#define SID_TRANSLITERATE_KATAGANA ( SID_SVX_START + 917 )
+#define SID_MN_SUB_TRANSLITERATE ( SID_SVX_START + 918 )
+#define SID_LANGUAGE_OPTIONS ( SID_SVX_START + 921 )
+#define SID_GETUNDOSTRINGS ( SID_SVX_START + 923 )
+#define SID_GETREDOSTRINGS ( SID_SVX_START + 924 )
+
+#define SID_INSERT_IMAGECONTROL ( SID_SVX_START + 926 )
+#define SID_INSERT_PROGRESSBAR ( SID_SVX_START + 927 )
+#define SID_INSERT_HFIXEDLINE ( SID_SVX_START + 928 )
+#define SID_INSERT_VFIXEDLINE ( SID_SVX_START + 929 )
+#define SID_READONLY_MODE ( SID_SVX_START + 930 )
+#define SID_ATTR_ALIGN_HYPHENATION ( SID_SVX_START + 931 )
+#define SID_ATTR_NUMBERFORMAT_SOURCE ( SID_SVX_START + 932 )
+#define SID_ATTR_AUTO_COLOR_INVALID ( SID_SVX_START + 933 )
+//#define SID_ADDRESS_DATA_SOURCE ( SID_SVX_START + 934 ) -> sfxsids.hrc
+#define SID_RULER_BORDER_DISTANCE ( SID_SVX_START + 935 )
+#define SID_INSERT_DATEFIELD ( SID_SVX_START + 936 )
+#define SID_INSERT_TIMEFIELD ( SID_SVX_START + 937 )
+#define SID_INSERT_NUMERICFIELD ( SID_SVX_START + 938 )
+#define SID_INSERT_CURRENCYFIELD ( SID_SVX_START + 939 )
+#define SID_INSERT_FORMATTEDFIELD ( SID_SVX_START + 940 )
+#define SID_INSERT_PATTERNFIELD ( SID_SVX_START + 941 )
+#define SID_INSERT_FILECONTROL ( SID_SVX_START + 942 )
+#define SID_SHOW_PROPERTYBROWSER ( SID_SVX_START + 943 )
+#define SID_ATTR_TABSTOP_VERTICAL ( SID_SVX_START + 946 )
+#define SID_RULER_BORDERS_VERTICAL ( SID_SVX_START + 948 )
+#define SID_ATTR_ALIGN_ASIANVERTICAL ( SID_SVX_START + 949 )
+#define SID_RULER_TEXT_RIGHT_TO_LEFT ( SID_SVX_START + 952 )
+#define SID_ATTR_HDFT_DYNAMIC_SPACING ( SID_SVX_START + 953 )
+#define SID_ATTR_NUMBERFORMAT_ADD_AUTO ( SID_SVX_START + 954 )
+#define SID_OPEN_HYPERLINK ( SID_SVX_START + 955 )
+#define SID_CTLFONT_STATE ( SID_SVX_START + 956 )
+#define SID_VERTICALTEXT_STATE ( SID_SVX_START + 957 )
+#define SID_OPEN_XML_FILTERSETTINGS ( SID_SVX_START + 958 )
+#define SID_HANGUL_HANJA_CONVERSION ( SID_SVX_START + 959 )
+#define SID_EXTRUSION_TOOGLE ( SID_SVX_START + 960 )
+#define SID_EXTRUSION_TILT_DOWN ( SID_SVX_START + 961 )
+#define SID_EXTRUSION_TILT_UP ( SID_SVX_START + 962 )
+#define SID_EXTRUSION_TILT_LEFT ( SID_SVX_START + 963 )
+#define SID_EXTRUSION_TILT_RIGHT ( SID_SVX_START + 964 )
+#define SID_EXTRUSION_DEPTH_FLOATER ( SID_SVX_START + 965 )
+#define SID_EXTRUSION_DIRECTION_FLOATER ( SID_SVX_START + 966 )
+#define SID_EXTRUSION_LIGHTING_FLOATER ( SID_SVX_START + 967 )
+#define SID_EXTRUSION_SURFACE_FLOATER ( SID_SVX_START + 968 )
+#define SID_EXTRUSION_3D_COLOR ( SID_SVX_START + 969 )
+#define SID_EXTRUSION_DEPTH ( SID_SVX_START + 970 )
+#define SID_EXTRUSION_DIRECTION ( SID_SVX_START + 971 )
+#define SID_EXTRUSION_PROJECTION ( SID_SVX_START + 972 )
+#define SID_EXTRUSION_LIGHTING_DIRECTION ( SID_SVX_START + 973 )
+#define SID_EXTRUSION_LIGHTING_INTENSITY ( SID_SVX_START + 974 )
+#define SID_EXTRUSION_SURFACE ( SID_SVX_START + 975 )
+#define SID_EXTRUSION_DEPTH_DIALOG ( SID_SVX_START + 976 )
+#define SID_FONTWORK_GALLERY_FLOATER ( SID_SVX_START + 977 )
+// free ( SID_SVX_START + 978 )
+#define SID_FONTWORK_SHAPE_TYPE ( SID_SVX_START + 979 )
+#define SID_FONTWORK_SAME_LETTER_HEIGHTS ( SID_SVX_START + 980 )
+#define SID_FONTWORK_ALIGNMENT_FLOATER ( SID_SVX_START + 981 )
+#define SID_FONTWORK_CHARACTER_SPACING_FLOATER ( SID_SVX_START + 982 )
+#define SID_FONTWORK_SHAPE ( SID_SVX_START + 983 )
+#define SID_FONTWORK_ALIGNMENT ( SID_SVX_START + 984 )
+#define SID_FONTWORK_CHARACTER_SPACING ( SID_SVX_START + 985 )
+#define SID_FONTWORK_KERN_CHARACTER_PAIRS ( SID_SVX_START + 986 )
+#define SID_DRAW_FONTWORK ( SID_SVX_START + 987 )
+#define SID_DRAW_FONTWORK_VERTICAL ( SID_SVX_START + 988 )
+#define SID_ATTR_BORDER_CONNECT ( SID_SVX_START + 990 )
+#define SID_SW_FOLLOW_TEXT_FLOW ( SID_SVX_START + 991 ) /* #i18732# - slot-id for new option IsFollowingTextFlow' */
+#define SID_RULER_ROWS ( SID_SVX_START + 992 )
+#define SID_RULER_ROWS_VERTICAL ( SID_SVX_START + 993 )
+#define SID_ATTR_TRANSFORM_HORI_POSITION ( SID_SVX_START + 999 )
+#define SID_ATTR_TRANSFORM_VERT_POSITION ( SID_SVX_START + 1000 )
+#define SID_SHOW_ITEMBROWSER ( SID_SVX_START + 1001 )
+#define SID_ALIGN_ANY_LEFT ( SID_SVX_START + 1002 )
+#define SID_ALIGN_ANY_HCENTER ( SID_SVX_START + 1003 )
+#define SID_ALIGN_ANY_RIGHT ( SID_SVX_START + 1004 )
+#define SID_ALIGN_ANY_JUSTIFIED ( SID_SVX_START + 1005 )
+#define SID_ALIGN_ANY_TOP ( SID_SVX_START + 1006 )
+#define SID_ALIGN_ANY_VCENTER ( SID_SVX_START + 1007 )
+#define SID_ALIGN_ANY_BOTTOM ( SID_SVX_START + 1008 )
+#define SID_ALIGN_ANY_HDEFAULT ( SID_SVX_START + 1009 )
+#define SID_ALIGN_ANY_VDEFAULT ( SID_SVX_START + 1010 )
+#define SID_SW_COLLAPSING_BORDERS ( SID_SVX_START + 1011 )
+#define SID_SW_WRAP_INFLUENCE_ON_OBJPOS ( SID_SVX_START + 1012 ) /* #i28701# - slot-id for new attribute WrapInfluenceOnObjPos' */
+#define SID_ATTR_BORDER_DIAG_TLBR ( SID_SVX_START + 1013 )
+#define SID_ATTR_BORDER_DIAG_BLTR ( SID_SVX_START + 1014 )
+#define SID_ATTR_ALIGN_SHRINKTOFIT ( SID_SVX_START + 1015 )
+#define SID_CHINESE_CONVERSION ( SID_SVX_START + 1016 )
+#define SID_PAGE_TYPE ( SID_SVX_START + 1017 )
+#define SID_DLG_TYPE ( SID_SVX_START + 1018 )
+#define SID_TABPAGE_POS ( SID_SVX_START + 1019 )
+#define SID_GRAPHIC ( SID_SVX_START + 1020 )
+#define SID_OBJECT_LIST ( SID_SVX_START + 1021 )
+#define SID_ATTR_SET ( SID_SVX_START + 1022 )
+#define SID_CHAR_FMT_LIST_BOX ( SID_SVX_START + 1023 )
+#define SID_METRIC_ITEM ( SID_SVX_START + 1024 )
+#define SID_NUM_CHAR_FMT ( SID_SVX_START + 1025 )
+#define SID_BULLET_CHAR_FMT ( SID_SVX_START + 1026 )
+#define SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK ( SID_SVX_START + 1027 )
+#define SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT ( SID_SVX_START + 1028 )
+#define SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH ( SID_SVX_START + 1029 )
+#define SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET ( SID_SVX_START + 1030 )
+#define SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST ( SID_SVX_START + 1031 )
+#define SID_SVXTABULATORTABPAGE_CONTROLFLAGS ( SID_SVX_START + 1032 )
+#define SID_SVXTEXTATTRPAGE_VIEW ( SID_SVX_START + 1033 )
+#define SID_FLAG_TYPE ( SID_SVX_START + 1034 )
+#define SID_SWMODE_TYPE ( SID_SVX_START + 1035 )
+#define SID_DISABLE_CTL ( SID_SVX_START + 1036 )
+#define SID_LINK_TYPE ( SID_SVX_START + 1037 )
+#define SID_ENUM_PAGE_MODE ( SID_SVX_START + 1038 )
+#define SID_PAPER_START ( SID_SVX_START + 1039 )
+#define SID_PAPER_END ( SID_SVX_START + 1040 )
+#define SID_COLLECT_LIST ( SID_SVX_START + 1041 )
+#define SID_GROW_FONT_SIZE ( SID_SVX_START + 1042 )
+#define SID_SHRINK_FONT_SIZE ( SID_SVX_START + 1043 )
+// color subtoolbar on graphictoolbar
+#define SID_COLOR_SETTINGS ( SID_SVX_START + 1044 )
+#define SID_FM_MORE_CONTROLS ( SID_SVX_START + 1045 )
+#define SID_FM_FORM_DESIGN_TOOLS ( SID_SVX_START + 1046 )
+#define SID_DRAWTBX_CS_BASIC ( SID_SVX_START + 1047 )
+#define SID_DRAWTBX_CS_SYMBOL ( SID_SVX_START + 1048 )
+#define SID_DRAWTBX_CS_ARROW ( SID_SVX_START + 1049 )
+#define SID_DRAWTBX_CS_FLOWCHART ( SID_SVX_START + 1050 )
+#define SID_DRAWTBX_CS_CALLOUT ( SID_SVX_START + 1051 )
+#define SID_DRAWTBX_CS_STAR ( SID_SVX_START + 1052 )
+#define SID_DRAW_CS_ID ( SID_SVX_START + 1053 )
+#define SID_FONTWORK_CHARACTER_SPACING_DIALOG ( SID_SVX_START + 1054 )
+#define SID_BORDER_REDUCED_MODE ( SID_SVX_START + 1055 )
+#define SID_INSERT_RLM ( SID_SVX_START + 1056 ) /* insert RLM - right to left mark */
+#define SID_INSERT_LRM ( SID_SVX_START + 1057 ) /* insert LRM - left to right mark */
+#define SID_INSERT_ZWSP ( SID_SVX_START + 1058 ) /* insert ZWJ - invisible space, keep words together*/
+#define SID_INSERT_ZWNBSP ( SID_SVX_START + 1059 ) /* insert ZWNJ - invisible space, forces linebreak*/
+#define SID_OPTIONS_DATABASES ( SID_SVX_START + 1060 )
+#define SID_OPEN_SMARTTAGMENU ( SID_SVX_START + 1061 )
+#define SID_OPEN_SMARTTAGOPTIONS ( SID_SVX_START + 1062 )
+#define SID_INSERT_TREECONTROL ( SID_SVX_START + 1063 )
+#define SID_ATTR_VIEWLAYOUT ( SID_SVX_START + 1064 )
+#define SID_ATTR_ZOOMSLIDER ( SID_SVX_START + 1065 )
+#define SID_FONTNAMELIST ( SID_SVX_START + 1066 )
+#define SID_LANGUAGE_STATUS ( SID_SVX_START + 1067 )
+#define SID_CHAR_DLG_FOR_PARAGRAPH ( SID_SVX_START + 1068 )
+#define SID_SET_DOCUMENT_LANGUAGE ( SID_SVX_START + 1069 )
+
+#define SID_TABLE_MERGE_CELLS (SID_SVX_START+1070)
+#define SID_TABLE_SPLIT_CELLS (SID_SVX_START+1071)
+#define SID_OPTIMIZE_TABLE (SID_SVX_START+1072)
+#define SID_TABLE_VERT_BOTTOM (SID_SVX_START+1073)
+#define SID_TABLE_VERT_CENTER (SID_SVX_START+1074)
+#define SID_TABLE_VERT_NONE (SID_SVX_START+1075)
+#define SID_TABLE_INSERT_ROW (SID_SVX_START+1076)
+#define SID_TABLE_INSERT_COL (SID_SVX_START+1077)
+#define SID_TABLE_DELETE_ROW (SID_SVX_START+1078)
+#define SID_TABLE_DELETE_COL (SID_SVX_START+1079)
+#define SID_TABLE_SELECT_ALL (SID_SVX_START+1080)
+#define SID_TABLE_SELECT_COL (SID_SVX_START+1081)
+#define SID_TABLE_SELECT_ROW (SID_SVX_START+1082)
+#define SID_FORMAT_TABLE_DLG (SID_SVX_START+1083)
+#define SID_TABLE_SORT_DIALOG (SID_SVX_START+1084)
+#define SID_TABLE_AUTOSUM (SID_SVX_START+1085)
+#define SID_TABLE_DISTRIBUTE_COLUMNS (SID_SVX_START+1086)
+#define SID_TABLE_DISTRIBUTE_ROWS (SID_SVX_START+1087)
+#define SID_TABLE_STYLE (SID_SVX_START+1088)
+#define SID_TABLE_STYLE_SETTINGS (SID_SVX_START+1089)
+#define SID_CHAR_DLG_PREVIEW_STRING (SID_SVX_START+1090)
+#define SID_RECHECK_DOCUMENT (SID_SVX_START+1091)
+
+#define SID_OBJECT_MIRROR (SID_SVX_START+1093)
+
+#define SID_DELETE_POSTIT (SID_SVX_START+1094)
+#define SID_NEXT_POSTIT (SID_SVX_START+1095)
+#define SID_PREVIOUS_POSTIT (SID_SVX_START+1096)
+#define SID_DELETEALL_POSTIT (SID_SVX_START+1097)
+#define SID_SHOW_POSTIT (SID_SVX_START+1098)
+#define SID_REPLYTO_POSTIT (SID_SVX_START+1099)
+#define SID_DELETEALLBYAUTHOR_POSTIT (SID_SVX_START+1100)
+#define SID_INSERT_POSTIT (SID_SVX_START+1101)
+
+#define SID_TRANSLITERATE_SENTENCE_CASE (SID_SVX_START+1102)
+#define SID_TRANSLITERATE_TITLE_CASE (SID_SVX_START+1103)
+#define SID_TRANSLITERATE_TOGGLE_CASE (SID_SVX_START+1104)
+
+// IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id
+#define SID_SVX_FIRSTFREE (SID_TRANSLITERATE_TOGGLE_CASE + 1)
+
+// --------------------------------------------------------------------------
+// Overflow check for slot IDs
+// --------------------------------------------------------------------------
+
+#if SID_SVX_FIRSTFREE > SID_SVX_END
+#error Resource-Ueberlauf in #line, #file
+#endif
+
+// --------------------------------------------------------------------------
+// Ranges, um ItemSets fuer bestimmte 3D-Objekte erstellen zu koennen
+// --------------------------------------------------------------------------
+
+//
+// SceneObject:
+#define SID_ATTR_3D_RANGE_SCENE \
+SID_ATTR_3D_AMBIENTCOLOR, SID_ATTR_3D_PERSPECTIVE, \
+SID_ATTR_3D_DISTANCE, SID_ATTR_3D_FOCAL_LENGTH, \
+SID_ATTR_3D_TWO_SIDED_LIGHTING, SID_ATTR_3D_TWO_SIDED_LIGHTING, \
+SID_ATTR_3D_SHADE_MODE, SID_ATTR_3D_SHADE_MODE, \
+SID_ATTR_3D_SHADOW_SLANT, SID_ATTR_3D_LIGHTDIRECTION_8 \
+
+//
+// CompoundObject:
+#define SID_ATTR_3D_RANGE_COMPOUND \
+SID_ATTR_3D_DOUBLE_SIDED, SID_ATTR_3D_DOUBLE_SIDED, \
+SID_ATTR_3D_NORMALS_KIND, SID_ATTR_3D_NORMALS_INVERT, \
+SID_ATTR_3D_TEXTURE_KIND, SID_ATTR_3D_MAT_SPECULAR_INTENSITY, \
+SID_ATTR_3D_SHADOW_3D, SID_ATTR_3D_SHADOW_3D \
+
+//
+// ExtrudeObject:
+#define SID_ATTR_3D_RANGE_EXTRUDE \
+SID_ATTR_3D_RANGE_COMPOUND, \
+SID_ATTR_3D_DEPTH, SID_ATTR_3D_DEPTH, \
+SID_ATTR_3D_PERCENT_DIAGONAL, SID_ATTR_3D_BACKSCALE \
+
+//
+// LatheObject:
+#define SID_ATTR_3D_RANGE_LATHE \
+SID_ATTR_3D_RANGE_COMPOUND, \
+SID_ATTR_3D_HORZ_SEGS, SID_ATTR_3D_VERT_SEGS, \
+SID_ATTR_3D_PERCENT_DIAGONAL, SID_ATTR_3D_END_ANGLE \
+
+//
+// SphereObject:
+#define SID_ATTR_3D_RANGE_SPHERE \
+SID_ATTR_3D_RANGE_COMPOUND, \
+SID_ATTR_3D_HORZ_SEGS, SID_ATTR_3D_VERT_SEGS \
+
+//
+// Spezieller Range fuer alle 3D-Objekte
+#define SID_ATTR_3D_RANGE_OBJECT \
+SID_ATTR_3D_RANGE_COMPOUND, \
+SID_ATTR_3D_DEPTH, SID_ATTR_3D_DEPTH, \
+SID_ATTR_3D_HORZ_SEGS, SID_ATTR_3D_VERT_SEGS, \
+SID_ATTR_3D_PERCENT_DIAGONAL, SID_ATTR_3D_END_ANGLE \
+
+#endif // #ifndef _SVX_SVXIDS_HRC
+
+// ******************************************************************* EOF
+
diff --git a/svx/inc/svx/svxitems.hrc b/svx/inc/svx/svxitems.hrc
new file mode 100644
index 000000000000..3f3e4aaa8613
--- /dev/null
+++ b/svx/inc/svx/svxitems.hrc
@@ -0,0 +1,174 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVXITEMS_HRC
+#define _SVXITEMS_HRC
+
+// include ------------------------------------------------------------------
+
+#include <svl/solar.hrc>
+
+// Extras -------------------------------------------------------------------
+#define RID_SVXITEMS_EXTRAS_CHARCOLOR (RID_SVXITEMS_START + 2)
+
+// SvxSearchItem ------------------------------------------------------------
+// Kommando
+#define RID_SVXITEMS_SEARCHCMD_BEGIN (RID_SVXITEMS_START + 10)
+#define RID_SVXITEMS_SEARCHCMD_FIND (RID_SVXITEMS_START + 10)
+#define RID_SVXITEMS_SEARCHCMD_FIND_ALL (RID_SVXITEMS_START + 11)
+#define RID_SVXITEMS_SEARCHCMD_REPLACE (RID_SVXITEMS_START + 12)
+#define RID_SVXITEMS_SEARCHCMD_REPLACE_ALL (RID_SVXITEMS_START + 13)
+// Vorlagen
+#define RID_SVXITEMS_SEARCHSTYLE_BEGIN (RID_SVXITEMS_START + 14)
+#define RID_SVXITEMS_SEARCHSTYL_CHAR (RID_SVXITEMS_START + 14)
+#define RID_SVXITEMS_SEARCHSTYL_PARA (RID_SVXITEMS_START + 15)
+#define RID_SVXITEMS_SEARCHSTYL_FRAME (RID_SVXITEMS_START + 16)
+#define RID_SVXITEMS_SEARCHSTYL_PAGE (RID_SVXITEMS_START + 17)
+// Zellen-Typ
+#define RID_SVXITEMS_SEARCHIN_BEGIN (RID_SVXITEMS_START + 20)
+#define RID_SVXITEMS_SEARCHIN_FORMULA (RID_SVXITEMS_START + 20)
+#define RID_SVXITEMS_SEARCHIN_VALUE (RID_SVXITEMS_START + 21)
+#define RID_SVXITEMS_SEARCHIN_NOTE (RID_SVXITEMS_START + 22)
+// Applikation
+#define RID_SVXITEMS_SEARCHAPP_BEGIN (RID_SVXITEMS_START + 25)
+#define RID_SVXITEMS_SEARCHAPP_WRITER (RID_SVXITEMS_START + 25)
+#define RID_SVXITEMS_SEARCHAPP_CALC (RID_SVXITEMS_START + 26)
+#define RID_SVXITEMS_SEARCHAPP_DRAW (RID_SVXITEMS_START + 27)
+#define RID_SVXITEMS_SEARCHAPP_BASE (RID_SVXITEMS_START + 28)
+
+// enum BrushStyle ----------------------------------------------------------
+#define RID_SVXITEMS_BRUSHSTYLE_BEGIN (RID_SVXITEMS_START + 45)
+#define RID_SVXITEMS_BRUSHSTYLE_NULL (RID_SVXITEMS_START + 45)
+#define RID_SVXITEMS_BRUSHSTYLE_SOLID (RID_SVXITEMS_START + 46)
+#define RID_SVXITEMS_BRUSHSTYLE_HORZ (RID_SVXITEMS_START + 47)
+#define RID_SVXITEMS_BRUSHSTYLE_VERT (RID_SVXITEMS_START + 48)
+#define RID_SVXITEMS_BRUSHSTYLE_CROSS (RID_SVXITEMS_START + 49)
+#define RID_SVXITEMS_BRUSHSTYLE_DIAGCROSS (RID_SVXITEMS_START + 50)
+#define RID_SVXITEMS_BRUSHSTYLE_UPDIAG (RID_SVXITEMS_START + 51)
+#define RID_SVXITEMS_BRUSHSTYLE_DOWNDIAG (RID_SVXITEMS_START + 52)
+#define RID_SVXITEMS_BRUSHSTYLE_25 (RID_SVXITEMS_START + 53)
+#define RID_SVXITEMS_BRUSHSTYLE_50 (RID_SVXITEMS_START + 54)
+#define RID_SVXITEMS_BRUSHSTYLE_75 (RID_SVXITEMS_START + 55)
+#define RID_SVXITEMS_BRUSHSTYLE_BITMAP (RID_SVXITEMS_START + 56)
+
+// enum FontFamily -------------------------------------------------------
+#define RID_SVXITEMS_FONTFAMILY_BEGIN (RID_SVXITEMS_START + 100)
+#define RID_SVXITEMS_FONTFAMILY_DONTKNOW (RID_SVXITEMS_START + 100)
+#define RID_SVXITEMS_FONTFAMILY_DECORATIVE (RID_SVXITEMS_START + 101)
+#define RID_SVXITEMS_FONTFAMILY_MODERN (RID_SVXITEMS_START + 102)
+#define RID_SVXITEMS_FONTFAMILY_ROMAN (RID_SVXITEMS_START + 103)
+#define RID_SVXITEMS_FONTFAMILY_SCRIPT (RID_SVXITEMS_START + 104)
+#define RID_SVXITEMS_FONTFAMILY_SWISS (RID_SVXITEMS_START + 105)
+#define RID_SVXITEMS_FONTFAMILY_SYSTEM (RID_SVXITEMS_START + 106)
+
+// enum FontPitch --------------------------------------------------------
+#define RID_SVXITEMS_FONTPITCH_BEGIN (RID_SVXITEMS_START + 110)
+#define RID_SVXITEMS_FONTPITCH_DONTKNOW (RID_SVXITEMS_START + 110)
+#define RID_SVXITEMS_FONTPITCH_FIXED (RID_SVXITEMS_START + 111)
+#define RID_SVXITEMS_FONTPITCH_VARIABLE (RID_SVXITEMS_START + 112)
+
+// enum CharSet ----------------------------------------------------------
+#define RID_SVXITEMS_CHARSET_BEGIN (RID_SVXITEMS_START + 145)
+#define RID_SVXITEMS_CHARSET_DONTKNOW (RID_SVXITEMS_START + 145)
+#define RID_SVXITEMS_CHARSET_ANSI (RID_SVXITEMS_START + 146)
+#define RID_SVXITEMS_CHARSET_MAC (RID_SVXITEMS_START + 147)
+#define RID_SVXITEMS_CHARSET_IBMPC_437 (RID_SVXITEMS_START + 148)
+#define RID_SVXITEMS_CHARSET_IBMPC_850 (RID_SVXITEMS_START + 149)
+#define RID_SVXITEMS_CHARSET_IBMPC_860 (RID_SVXITEMS_START + 150)
+#define RID_SVXITEMS_CHARSET_IBMPC_861 (RID_SVXITEMS_START + 151)
+#define RID_SVXITEMS_CHARSET_IBMPC_863 (RID_SVXITEMS_START + 152)
+#define RID_SVXITEMS_CHARSET_IBMPC_865 (RID_SVXITEMS_START + 153)
+#define RID_SVXITEMS_CHARSET_SYSTEM (RID_SVXITEMS_START + 154)
+#define RID_SVXITEMS_CHARSET_SYMBOL (RID_SVXITEMS_START + 155)
+
+// enum SvxCellHorJustify
+#define RID_SVXITEMS_HORJUST_STANDARD (RID_SVXITEMS_START + 400)
+#define RID_SVXITEMS_HORJUST_LEFT (RID_SVXITEMS_START + 401)
+#define RID_SVXITEMS_HORJUST_CENTER (RID_SVXITEMS_START + 402)
+#define RID_SVXITEMS_HORJUST_RIGHT (RID_SVXITEMS_START + 403)
+#define RID_SVXITEMS_HORJUST_BLOCK (RID_SVXITEMS_START + 404)
+#define RID_SVXITEMS_HORJUST_REPEAT (RID_SVXITEMS_START + 405)
+
+// enum SvxCellVerJustify
+#define RID_SVXITEMS_VERJUST_STANDARD (RID_SVXITEMS_START + 406)
+#define RID_SVXITEMS_VERJUST_TOP (RID_SVXITEMS_START + 407)
+#define RID_SVXITEMS_VERJUST_CENTER (RID_SVXITEMS_START + 408)
+#define RID_SVXITEMS_VERJUST_BOTTOM (RID_SVXITEMS_START + 409)
+
+// enum SvxCellOrientation
+#define RID_SVXITEMS_ORI_STANDARD (RID_SVXITEMS_START + 410)
+#define RID_SVXITEMS_ORI_TOPBOTTOM (RID_SVXITEMS_START + 411)
+#define RID_SVXITEMS_ORI_BOTTOMTOP (RID_SVXITEMS_START + 412)
+#define RID_SVXITEMS_ORI_STACKED (RID_SVXITEMS_START + 413)
+
+// Id's fuer BoolItems
+#define RID_SVXITEMS_BOXINF_TABLE_TRUE (RID_SVXITEMS_START + 443)
+#define RID_SVXITEMS_BOXINF_TABLE_FALSE (RID_SVXITEMS_START + 444)
+#define RID_SVXITEMS_BOXINF_DIST_TRUE (RID_SVXITEMS_START + 445)
+#define RID_SVXITEMS_BOXINF_DIST_FALSE (RID_SVXITEMS_START + 446)
+#define RID_SVXITEMS_BOXINF_MDIST_TRUE (RID_SVXITEMS_START + 447)
+#define RID_SVXITEMS_BOXINF_MDIST_FALSE (RID_SVXITEMS_START + 448)
+
+// Complete-Texte -----------------------------------------------------------
+
+#define RID_SVXITEMS_MARGIN_LEFT (RID_SVXITEMS_START + 480)
+#define RID_SVXITEMS_MARGIN_TOP (RID_SVXITEMS_START + 481)
+#define RID_SVXITEMS_MARGIN_RIGHT (RID_SVXITEMS_START + 482)
+#define RID_SVXITEMS_MARGIN_BOTTOM (RID_SVXITEMS_START + 483)
+#define RID_SVXITEMS_PAGE_COMPLETE (RID_SVXITEMS_START + 498)
+#define RID_SVXITEMS_PAGE_NUM_BEGIN (RID_SVXITEMS_START + 499)
+#define RID_SVXITEMS_PAGE_NUM_CHR_UPPER (RID_SVXITEMS_START + 499)
+#define RID_SVXITEMS_PAGE_NUM_CHR_LOWER (RID_SVXITEMS_START + 500)
+#define RID_SVXITEMS_PAGE_NUM_ROM_UPPER (RID_SVXITEMS_START + 501)
+#define RID_SVXITEMS_PAGE_NUM_ROM_LOWER (RID_SVXITEMS_START + 502)
+#define RID_SVXITEMS_PAGE_NUM_ARABIC (RID_SVXITEMS_START + 503)
+#define RID_SVXITEMS_PAGE_NUM_NONE (RID_SVXITEMS_START + 504)
+#define RID_SVXITEMS_PAGE_LAND_TRUE (RID_SVXITEMS_START + 505)
+#define RID_SVXITEMS_PAGE_LAND_FALSE (RID_SVXITEMS_START + 506)
+#define RID_SVXITEMS_PAGE_USAGE_LEFT (RID_SVXITEMS_START + 507)
+#define RID_SVXITEMS_PAGE_USAGE_RIGHT (RID_SVXITEMS_START + 508)
+#define RID_SVXITEMS_PAGE_USAGE_ALL (RID_SVXITEMS_START + 509)
+#define RID_SVXITEMS_PAGE_USAGE_MIRROR (RID_SVXITEMS_START + 510)
+#define RID_SVXITEMS_AUTHOR_COMPLETE (RID_SVXITEMS_START + 521)
+#define RID_SVXITEMS_DATE_COMPLETE (RID_SVXITEMS_START + 522)
+#define RID_SVXITEMS_TEXT_COMPLETE (RID_SVXITEMS_START + 523)
+#define RID_SVXITEMS_BACKGROUND_COLOR (RID_SVXITEMS_START + 524)
+#define RID_SVXITEMS_PATTERN_COLOR (RID_SVXITEMS_START + 525)
+
+#define RID_SVXITEMS_BRUSH_CHAR (RID_SVXITEMS_START + 527)
+#define RID_ATTR_NAMES (RID_SVXITEMS_START + 528)
+
+// Ueberlaufpruefung --------------------------------------------------------
+
+// Resource-Id's
+#define ACT_RID_SVXITEMS_END RID_ATTR_NAMES
+#if ACT_RID_SVXITEMS_END > RID_SVXITEMS_END
+#error Resource-Ueberlauf in #line, #file
+#endif
+
+
+#endif
+
diff --git a/svx/inc/svx/swframeexample.hxx b/svx/inc/svx/swframeexample.hxx
new file mode 100644
index 000000000000..4068980b05b5
--- /dev/null
+++ b/svx/inc/svx/swframeexample.hxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVXSWFRAMEEXAMPLE_HXX
+#define _SVXSWFRAMEEXAMPLE_HXX
+
+#include <vcl/window.hxx>
+#include <tools/color.hxx>
+#include <tools/gen.hxx>
+#include "svx/svxdllapi.h"
+
+// class SwFrmPagePreview -------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxSwFrameExample : public Window
+{
+ Color m_aTransColor; // transparency
+ Color m_aBgCol; // background
+ Color m_aFrameColor; // graphic frame
+ Color m_aAlignColor; // align anchor
+ Color m_aBorderCol; // frame of doc
+ Color m_aPrintAreaCol; // frame of printable area of doc
+ Color m_aTxtCol; // symbolised text
+ Color m_aBlankCol; // area of symbol for blank
+ Color m_aBlankFrameCol; // frame of symbol for blank
+
+ Rectangle aPage;
+ Rectangle aPagePrtArea;
+ Rectangle aTextLine;
+ Rectangle aPara;
+ Rectangle aParaPrtArea;
+ Rectangle aFrameAtFrame;
+ Rectangle aDrawObj;
+ Rectangle aAutoCharFrame;
+ Size aFrmSize;
+
+ short nHAlign;
+ short nHRel;
+
+ short nVAlign;
+ short nVRel;
+
+ short nWrap;
+ short nAnchor;
+ sal_Bool bTrans;
+
+ Point aRelPos;
+
+ void InitColors_Impl( void );
+ void InitAllRects_Impl();
+ void CalcBoundRect_Impl(Rectangle &rRect);
+ Rectangle DrawInnerFrame_Impl(const Rectangle &rRect, const Color &rFillColor, const Color &rBorderColor);
+
+ void DrawRect_Impl(const Rectangle &rRect, const Color &rFillColor, const Color &rLineColor);
+ virtual void Paint(const Rectangle&);
+protected:
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+public:
+
+ SvxSwFrameExample(Window* pParent, const ResId& rResID);
+ ~SvxSwFrameExample();
+
+ inline void SetWrap(sal_uInt16 nW) { nWrap = nW; }
+
+ inline void SetHAlign(short nH) { nHAlign = nH; }
+ inline void SetHoriRel(short nR) { nHRel = nR; }
+
+ inline void SetVAlign(short nV) { nVAlign = nV; }
+ inline void SetVertRel(short nR) { nVRel = nR; }
+
+ inline void SetTransparent(sal_Bool bT) { bTrans = bT; }
+ inline void SetAnchor(short nA) { nAnchor = nA; }
+
+ void SetRelPos(const Point& rP);
+};
+
+
+#endif // _SVXSWFRAMEEXAMPLE_HXX
diff --git a/svx/inc/svx/swframeposstrings.hxx b/svx/inc/svx/swframeposstrings.hxx
new file mode 100644
index 000000000000..7ba005dc1e76
--- /dev/null
+++ b/svx/inc/svx/swframeposstrings.hxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVXSWFRAMEPOSSTRINGS_HXX
+#define _SVXSWFRAMEPOSSTRINGS_HXX
+
+#include <tools/string.hxx>
+#include "svx/svxdllapi.h"
+
+/* -----------------04.03.2004 12:58-----------------
+ contains strings needed for positioning dialogs
+ of frames and drawing in Writer
+ --------------------------------------------------*/
+class SvxSwFramePosString_Impl;
+class SVX_DLLPUBLIC SvxSwFramePosString
+{
+ SvxSwFramePosString_Impl* pImpl;
+public:
+ SvxSwFramePosString();
+ ~SvxSwFramePosString();
+ enum StringId
+ {
+ LEFT ,
+ RIGHT ,
+ FROMLEFT ,
+ MIR_LEFT ,
+ MIR_RIGHT ,
+ MIR_FROMLEFT ,
+ FRAME ,
+ PRTAREA ,
+ REL_PG_LEFT ,
+ REL_PG_RIGHT ,
+ REL_FRM_LEFT ,
+ REL_FRM_RIGHT ,
+ MIR_REL_PG_LEFT ,
+ MIR_REL_PG_RIGHT ,
+ MIR_REL_FRM_LEFT ,
+ MIR_REL_FRM_RIGHT ,
+ REL_PG_FRAME ,
+ REL_PG_PRTAREA ,
+ REL_BASE ,
+ REL_CHAR ,
+ REL_ROW ,
+ REL_BORDER ,
+ REL_PRTAREA ,
+ FLY_REL_PG_LEFT ,
+ FLY_REL_PG_RIGHT ,
+ FLY_REL_PG_FRAME ,
+ FLY_REL_PG_PRTAREA ,
+ FLY_MIR_REL_PG_LEFT ,
+ FLY_MIR_REL_PG_RIGHT ,
+ TOP,
+ BOTTOM,
+ CENTER_HORI,
+ CENTER_VERT,
+ FROMTOP,
+ FROMBOTTOM,
+ BELOW,
+ FROMRIGHT,
+ REL_PG_TOP,
+ REL_PG_BOTTOM,
+ REL_FRM_TOP,
+ REL_FRM_BOTTOM,
+ REL_LINE,
+
+ STR_MAX
+ };
+ const String& GetString(StringId eId);
+};
+#endif
+
diff --git a/svx/inc/svx/swframevalidation.hxx b/svx/inc/svx/swframevalidation.hxx
new file mode 100644
index 000000000000..600479718050
--- /dev/null
+++ b/svx/inc/svx/swframevalidation.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVXSWFRAMEVALIDATION_HXX
+#define _SVXSWFRAMEVALIDATION_HXX
+#include <sal/types.h>
+#include <tools/gen.hxx>
+#include <limits.h>
+
+/* -----------------03.03.2004 16:31-----------------
+ struct to determine min/max values for fly frame positioning in Writer
+ --------------------------------------------------*/
+struct SvxSwFrameValidation
+{
+ sal_Int16 nAnchorType; //com::sun::star::text::TextContentAnchorType
+ sal_Int16 nHoriOrient; //com::sun::star::text::HoriOrientation
+ sal_Int16 nVertOrient; //com::sun::star::text::VertOrientation
+ sal_Int16 nHRelOrient; //com::sun::star::text::RelOrientation
+ sal_Int16 nVRelOrient; //com::sun::star::text::RelOrientation
+ bool bAutoHeight;
+ bool bAutoWidth;
+ bool bMirror;
+ bool bFollowTextFlow;
+
+ sal_Int32 nHPos;
+ sal_Int32 nMaxHPos;
+ sal_Int32 nMinHPos;
+
+ sal_Int32 nVPos;
+ sal_Int32 nMaxVPos;
+ sal_Int32 nMinVPos;
+
+ sal_Int32 nWidth;
+ sal_Int32 nMinWidth;
+ sal_Int32 nMaxWidth;
+
+ sal_Int32 nHeight;
+ sal_Int32 nMinHeight;
+ sal_Int32 nMaxHeight;
+
+ Size aPercentSize; // Size fuer 100%-Wert
+
+ SvxSwFrameValidation() :
+ bAutoHeight(false),
+ bAutoWidth(false),
+ bMirror(false),
+ bFollowTextFlow( false ),
+ nHPos(0),
+ nMaxHPos(SAL_MAX_INT32),
+ nMinHPos(0),
+ nVPos(0),
+ nMaxVPos(SAL_MAX_INT32),
+ nMinVPos(0),
+ nWidth( 283 * 4 ), //2.0 cm
+ nMinWidth(0),
+ nMaxWidth(SAL_MAX_INT32),
+ nHeight( 283 ), //0.5 cm
+ nMaxHeight(SAL_MAX_INT32)
+ {
+ }
+};
+
+#endif
+
diff --git a/svx/inc/svx/sxallitm.hxx b/svx/inc/svx/sxallitm.hxx
new file mode 100644
index 000000000000..590e0b114d4c
--- /dev/null
+++ b/svx/inc/svx/sxallitm.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXALLITM_HXX
+#define _SXALLITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdmetitm.hxx>
+
+//------------------------------
+// class SdrAllPositionXItem
+//------------------------------
+class SdrAllPositionXItem: public SdrMetricItem {
+public:
+ SdrAllPositionXItem(long nPosX=0): SdrMetricItem(SDRATTR_ALLPOSITIONX,nPosX) {}
+ SdrAllPositionXItem(SvStream& rIn): SdrMetricItem(SDRATTR_ALLPOSITIONX,rIn) {}
+};
+
+//------------------------------
+// class SdrAllPositionYItem
+//------------------------------
+class SdrAllPositionYItem: public SdrMetricItem {
+public:
+ SdrAllPositionYItem(long nPosY=0): SdrMetricItem(SDRATTR_ALLPOSITIONY,nPosY) {}
+ SdrAllPositionYItem(SvStream& rIn): SdrMetricItem(SDRATTR_ALLPOSITIONY,rIn) {}
+};
+
+//------------------------------
+// class SdrAllSizeWidthItem
+//------------------------------
+class SdrAllSizeWidthItem: public SdrMetricItem {
+public:
+ SdrAllSizeWidthItem(long nWdt=0): SdrMetricItem(SDRATTR_ALLSIZEWIDTH,nWdt) {}
+ SdrAllSizeWidthItem(SvStream& rIn): SdrMetricItem(SDRATTR_ALLSIZEWIDTH,rIn) {}
+};
+
+//------------------------------
+// class SdrAllSizeWidthItem
+//------------------------------
+class SdrAllSizeHeightItem: public SdrMetricItem {
+public:
+ SdrAllSizeHeightItem(long nHgt=0): SdrMetricItem(SDRATTR_ALLSIZEHEIGHT,nHgt) {}
+ SdrAllSizeHeightItem(SvStream& rIn): SdrMetricItem(SDRATTR_ALLSIZEHEIGHT,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxcaitm.hxx b/svx/inc/svx/sxcaitm.hxx
new file mode 100644
index 000000000000..1cf8f2cd1802
--- /dev/null
+++ b/svx/inc/svx/sxcaitm.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXCAITM_HXX
+#define _SXCAITM_HXX
+
+#include <svx/svddef.hxx>
+
+#ifndef _SDRANGITM_HXX
+#include <svx/sdangitm.hxx>
+#endif
+#include <svx/sdooitm.hxx>
+
+//------------------------------------
+// class SdrCaptionFixedAngleItem
+// sal_True=Winkel durch SdrCaptionAngleItem vorgegeben
+// sal_False=Freier Winkel
+//------------------------------------
+class SdrCaptionFixedAngleItem: public SdrOnOffItem {
+public:
+ SdrCaptionFixedAngleItem(sal_Bool bFix=sal_True): SdrOnOffItem(SDRATTR_CAPTIONFIXEDANGLE,bFix) {}
+ SdrCaptionFixedAngleItem(SvStream& rIn) : SdrOnOffItem(SDRATTR_CAPTIONFIXEDANGLE,rIn) {}
+};
+
+//------------------------------
+// class SdrCaptionAngleItem
+// Winkelangabe in 1/100 Degree
+// Nur bei Type2, Type3 und Type4
+// und nur wenn SdrCaptionIsFixedAngleItem=TRUE
+//------------------------------
+class SdrCaptionAngleItem: public SdrAngleItem {
+public:
+ SdrCaptionAngleItem(long nAngle=0): SdrAngleItem(SDRATTR_CAPTIONANGLE,nAngle) {}
+ SdrCaptionAngleItem(SvStream& rIn): SdrAngleItem(SDRATTR_CAPTIONANGLE,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxcecitm.hxx b/svx/inc/svx/sxcecitm.hxx
new file mode 100644
index 000000000000..13379ab9fcbb
--- /dev/null
+++ b/svx/inc/svx/sxcecitm.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXCECITM_HXX
+#define _SXCECITM_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/svddef.hxx>
+#include <svx/sdynitm.hxx>
+#include <svx/sdmetitm.hxx>
+#include "svx/svxdllapi.h"
+
+enum SdrCaptionEscDir {SDRCAPT_ESCHORIZONTAL,SDRCAPT_ESCVERTICAL,SDRCAPT_ESCBESTFIT};
+
+//------------------------------
+// class SdrCaptionEscDirItem
+//------------------------------
+class SVX_DLLPUBLIC SdrCaptionEscDirItem: public SfxEnumItem {
+public:
+ TYPEINFO();
+ SdrCaptionEscDirItem(SdrCaptionEscDir eDir=SDRCAPT_ESCHORIZONTAL): SfxEnumItem(SDRATTR_CAPTIONESCDIR,sal::static_int_cast< sal_uInt16 >(eDir)) {}
+ SdrCaptionEscDirItem(SvStream& rIn) : SfxEnumItem(SDRATTR_CAPTIONESCDIR,rIn) {}
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool=NULL) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual sal_uInt16 GetValueCount() const; // { return 3; }
+ SdrCaptionEscDir GetValue() const { return (SdrCaptionEscDir)SfxEnumItem::GetValue(); }
+
+ virtual String GetValueTextByPos(sal_uInt16 nPos) const;
+
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String& rText, const IntlWrapper * = 0) const;
+};
+
+//------------------------------------
+// class SdrCaptionEscIsRelItem
+// sal_True=Linienaustrittsposition relativ
+// sal_False=Linienaustrittsposition absolut
+//------------------------------------
+class SdrCaptionEscIsRelItem: public SdrYesNoItem {
+public:
+ SdrCaptionEscIsRelItem(sal_Bool bRel=sal_True): SdrYesNoItem(SDRATTR_CAPTIONESCISREL,bRel) {}
+ SdrCaptionEscIsRelItem(SvStream& rIn) : SdrYesNoItem(SDRATTR_CAPTIONESCISREL,rIn) {}
+};
+
+//------------------------------------
+// class SdrCaptionEscRelItem
+// Relativer Linienaustritt
+// 0 = 0.00% = oben bzw. links,
+// 10000 = 100.00% = rechts bzw. unten
+// nur wenn SdrCaptionEscIsRelItem=TRUE
+//------------------------------------
+class SdrCaptionEscRelItem: public SfxInt32Item {
+public:
+ SdrCaptionEscRelItem(long nEscRel=5000): SfxInt32Item(SDRATTR_CAPTIONESCREL,nEscRel) {}
+ SdrCaptionEscRelItem(SvStream& rIn) : SfxInt32Item(SDRATTR_CAPTIONESCREL,rIn) {}
+};
+
+//------------------------------------
+// class SdrCaptionEscAbsItem
+// Absoluter Linienaustritt
+// 0 = oben bzw. links,
+// >0 = in Richtung rechts bzw. unten
+// nur wenn SdrCaptionEscIsRelItem=FALSE
+//------------------------------------
+class SdrCaptionEscAbsItem: public SdrMetricItem {
+public:
+ SdrCaptionEscAbsItem(long nEscAbs=0): SdrMetricItem(SDRATTR_CAPTIONESCABS,nEscAbs) {}
+ SdrCaptionEscAbsItem(SvStream& rIn) : SdrMetricItem(SDRATTR_CAPTIONESCABS,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxcgitm.hxx b/svx/inc/svx/sxcgitm.hxx
new file mode 100644
index 000000000000..e4daddc12974
--- /dev/null
+++ b/svx/inc/svx/sxcgitm.hxx
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXCGITM_HXX
+#define _SXCGITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdmetitm.hxx>
+
+//------------------------------------
+// class SdrCaptionGapItem
+// Abstand des Linienanfangs vom Rect
+//------------------------------------
+class SdrCaptionGapItem: public SdrMetricItem {
+public:
+ SdrCaptionGapItem(long nGap=0) : SdrMetricItem(SDRATTR_CAPTIONGAP,nGap) {}
+ SdrCaptionGapItem(SvStream& rIn): SdrMetricItem(SDRATTR_CAPTIONGAP,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxciaitm.hxx b/svx/inc/svx/sxciaitm.hxx
new file mode 100644
index 000000000000..f04a672a791b
--- /dev/null
+++ b/svx/inc/svx/sxciaitm.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXCIAITM_HXX
+#define _SXCIAITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdangitm.hxx>
+
+//------------------------------
+// class SdrCircStartAngleItem
+//------------------------------
+class SdrCircStartAngleItem: public SdrAngleItem {
+public:
+ SdrCircStartAngleItem(long nAngle=0): SdrAngleItem(SDRATTR_CIRCSTARTANGLE,nAngle) {}
+ SdrCircStartAngleItem(SvStream& rIn): SdrAngleItem(SDRATTR_CIRCSTARTANGLE,rIn) {}
+};
+
+//------------------------------
+// class SdrCircEndAngleItem
+//------------------------------
+class SdrCircEndAngleItem: public SdrAngleItem {
+public:
+ SdrCircEndAngleItem(long nAngle=36000): SdrAngleItem(SDRATTR_CIRCENDANGLE,nAngle) {}
+ SdrCircEndAngleItem(SvStream& rIn): SdrAngleItem(SDRATTR_CIRCENDANGLE,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxcikitm.hxx b/svx/inc/svx/sxcikitm.hxx
new file mode 100644
index 000000000000..6134fe6ad5d4
--- /dev/null
+++ b/svx/inc/svx/sxcikitm.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXCIKITM_HXX
+#define _SXCIKITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svl/eitem.hxx>
+
+enum SdrCircKind {SDRCIRC_FULL,
+ SDRCIRC_SECT,
+ SDRCIRC_CUT,
+ SDRCIRC_ARC};
+
+class SdrCircKindItem: public SfxEnumItem {
+public:
+ TYPEINFO();
+ SdrCircKindItem(SdrCircKind eKind=SDRCIRC_FULL): SfxEnumItem(SDRATTR_CIRCKIND,sal::static_int_cast< sal_uInt16 >(eKind)) {}
+ SdrCircKindItem(SvStream& rIn) : SfxEnumItem(SDRATTR_CIRCKIND,rIn) {}
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool=NULL) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual sal_uInt16 GetValueCount() const; // { return 4; }
+ SdrCircKind GetValue() const { return (SdrCircKind)SfxEnumItem::GetValue(); }
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual String GetValueTextByPos(sal_uInt16 nPos) const;
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String& rText, const IntlWrapper * = 0) const;
+};
+
+#endif
diff --git a/svx/inc/svx/sxcllitm.hxx b/svx/inc/svx/sxcllitm.hxx
new file mode 100644
index 000000000000..2563897b4ae1
--- /dev/null
+++ b/svx/inc/svx/sxcllitm.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXCLLITM_HXX
+#define _SXCLLITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdynitm.hxx>
+#include <svx/sdmetitm.hxx>
+
+//------------------------------------
+// class SdrCaptionLineLenItem
+// Laenge der ersten Austrittslinie
+// Nur bei Type3 und Type4
+// Nur relevant, wenn SdrCaptionFitLineLenItem=FALSE
+//------------------------------------
+class SdrCaptionLineLenItem: public SdrMetricItem {
+public:
+ SdrCaptionLineLenItem(long nLineLen=0): SdrMetricItem(SDRATTR_CAPTIONLINELEN,nLineLen) {}
+ SdrCaptionLineLenItem(SvStream& rIn) : SdrMetricItem(SDRATTR_CAPTIONLINELEN,rIn) {}
+};
+
+//------------------------------------
+// class SdrCaptionFitLineLenItem
+// Laenge der ersten Austrittslinie automatisch berechnen oder
+// Vorgabe (SdrCaptionLineLenItem) verwenden.
+// Nur bei Type3 und Type4
+//------------------------------------
+class SdrCaptionFitLineLenItem: public SdrYesNoItem {
+public:
+ SdrCaptionFitLineLenItem(sal_Bool bBestFit=sal_True): SdrYesNoItem(SDRATTR_CAPTIONFITLINELEN,bBestFit) {}
+ SdrCaptionFitLineLenItem(SvStream& rIn) : SdrYesNoItem(SDRATTR_CAPTIONFITLINELEN,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxctitm.hxx b/svx/inc/svx/sxctitm.hxx
new file mode 100644
index 000000000000..bf2f049a976b
--- /dev/null
+++ b/svx/inc/svx/sxctitm.hxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXCTITM_HXX
+#define _SXCTITM_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/svddef.hxx>
+#include "svx/svxdllapi.h"
+
+enum SdrCaptionType {SDRCAPT_TYPE1,SDRCAPT_TYPE2,SDRCAPT_TYPE3,SDRCAPT_TYPE4};
+
+//------------------------------
+// class SdrCaptionTypeItem
+//------------------------------
+class SVX_DLLPUBLIC SdrCaptionTypeItem: public SfxEnumItem {
+public:
+ TYPEINFO();
+ SdrCaptionTypeItem(SdrCaptionType eStyle=SDRCAPT_TYPE3): SfxEnumItem(SDRATTR_CAPTIONTYPE,sal::static_int_cast< sal_uInt16 >(eStyle)) {}
+ SdrCaptionTypeItem(SvStream& rIn) : SfxEnumItem(SDRATTR_CAPTIONTYPE,rIn) {}
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool=NULL) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual sal_uInt16 GetValueCount() const; // { return 4; }
+ SdrCaptionType GetValue() const { return (SdrCaptionType)SfxEnumItem::GetValue(); }
+ virtual String GetValueTextByPos(sal_uInt16 nPos) const;
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String& rText, const IntlWrapper * = 0) const;
+};
+
+#endif
diff --git a/svx/inc/svx/sxekitm.hxx b/svx/inc/svx/sxekitm.hxx
new file mode 100644
index 000000000000..936a7c75f888
--- /dev/null
+++ b/svx/inc/svx/sxekitm.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXEKITM_HXX
+#define _SXEKITM_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/svddef.hxx>
+#include "svx/svxdllapi.h"
+
+enum SdrEdgeKind {SDREDGE_ORTHOLINES,
+ SDREDGE_THREELINES,
+ SDREDGE_ONELINE,
+ SDREDGE_BEZIER,
+ SDREDGE_ARC};
+
+//------------------------------
+// class SdrEdgeKindItem
+//------------------------------
+class SVX_DLLPUBLIC SdrEdgeKindItem: public SfxEnumItem {
+public:
+ TYPEINFO();
+ SdrEdgeKindItem(SdrEdgeKind eStyle=SDREDGE_ORTHOLINES): SfxEnumItem(SDRATTR_EDGEKIND,sal::static_int_cast< sal_uInt16 >(eStyle)) {}
+ SdrEdgeKindItem(SvStream& rIn) : SfxEnumItem(SDRATTR_EDGEKIND,rIn) {}
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool=NULL) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual sal_uInt16 GetValueCount() const; // { return 5; }
+ SdrEdgeKind GetValue() const { return (SdrEdgeKind)SfxEnumItem::GetValue(); }
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+ virtual String GetValueTextByPos(sal_uInt16 nPos) const;
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String& rText, const IntlWrapper * = 0) const;
+};
+
+#endif
diff --git a/svx/inc/svx/sxelditm.hxx b/svx/inc/svx/sxelditm.hxx
new file mode 100644
index 000000000000..5057f9d05f85
--- /dev/null
+++ b/svx/inc/svx/sxelditm.hxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXELDITM_HXX
+#define _SXELDITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdmetitm.hxx>
+#include "svx/svxdllapi.h"
+
+class SdrEdgeLineDeltaAnzItem: public SfxUInt16Item {
+public:
+ SdrEdgeLineDeltaAnzItem(sal_uInt16 nVal=0): SfxUInt16Item(SDRATTR_EDGELINEDELTAANZ,nVal) {}
+ SdrEdgeLineDeltaAnzItem(SvStream& rIn): SfxUInt16Item(SDRATTR_EDGELINEDELTAANZ,rIn) {}
+};
+
+class SVX_DLLPUBLIC SdrEdgeLine1DeltaItem: public SdrMetricItem {
+public:
+ SdrEdgeLine1DeltaItem(long nVal=0): SdrMetricItem(SDRATTR_EDGELINE1DELTA,nVal) {}
+ SdrEdgeLine1DeltaItem(SvStream& rIn): SdrMetricItem(SDRATTR_EDGELINE1DELTA,rIn) {}
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+class SVX_DLLPUBLIC SdrEdgeLine2DeltaItem: public SdrMetricItem {
+public:
+ SdrEdgeLine2DeltaItem(long nVal=0): SdrMetricItem(SDRATTR_EDGELINE2DELTA,nVal) {}
+ SdrEdgeLine2DeltaItem(SvStream& rIn): SdrMetricItem(SDRATTR_EDGELINE2DELTA,rIn) {}
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+class SVX_DLLPUBLIC SdrEdgeLine3DeltaItem: public SdrMetricItem {
+public:
+ SdrEdgeLine3DeltaItem(long nVal=0): SdrMetricItem(SDRATTR_EDGELINE3DELTA,nVal) {}
+ SdrEdgeLine3DeltaItem(SvStream& rIn): SdrMetricItem(SDRATTR_EDGELINE3DELTA,rIn) {}
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+#endif
diff --git a/svx/inc/svx/sxenditm.hxx b/svx/inc/svx/sxenditm.hxx
new file mode 100644
index 000000000000..fab72e1bea9d
--- /dev/null
+++ b/svx/inc/svx/sxenditm.hxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXENDITM_HXX
+#define _SXENDITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdmetitm.hxx>
+#include "svx/svxdllapi.h"
+
+class SVX_DLLPUBLIC SdrEdgeNode1HorzDistItem: public SdrMetricItem {
+public:
+ SdrEdgeNode1HorzDistItem(long nVal=0): SdrMetricItem(SDRATTR_EDGENODE1HORZDIST,nVal) {}
+ SdrEdgeNode1HorzDistItem(SvStream& rIn): SdrMetricItem(SDRATTR_EDGENODE1HORZDIST,rIn) {}
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+class SVX_DLLPUBLIC SdrEdgeNode1VertDistItem: public SdrMetricItem {
+public:
+ SdrEdgeNode1VertDistItem(long nVal=0): SdrMetricItem(SDRATTR_EDGENODE1VERTDIST,nVal) {}
+ SdrEdgeNode1VertDistItem(SvStream& rIn): SdrMetricItem(SDRATTR_EDGENODE1VERTDIST,rIn) {}
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+class SVX_DLLPUBLIC SdrEdgeNode2HorzDistItem: public SdrMetricItem {
+public:
+ SdrEdgeNode2HorzDistItem(long nVal=0): SdrMetricItem(SDRATTR_EDGENODE2HORZDIST,nVal) {}
+ SdrEdgeNode2HorzDistItem(SvStream& rIn): SdrMetricItem(SDRATTR_EDGENODE2HORZDIST,rIn) {}
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+class SVX_DLLPUBLIC SdrEdgeNode2VertDistItem: public SdrMetricItem {
+public:
+ SdrEdgeNode2VertDistItem(long nVal=0): SdrMetricItem(SDRATTR_EDGENODE2VERTDIST,nVal) {}
+ SdrEdgeNode2VertDistItem(SvStream& rIn): SdrMetricItem(SDRATTR_EDGENODE2VERTDIST,rIn) {}
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+class SdrEdgeNode1GlueDistItem: public SdrMetricItem {
+public:
+ SdrEdgeNode1GlueDistItem(long nVal=0): SdrMetricItem(SDRATTR_EDGENODE1GLUEDIST,nVal) {}
+ SdrEdgeNode1GlueDistItem(SvStream& rIn): SdrMetricItem(SDRATTR_EDGENODE1GLUEDIST,rIn) {}
+};
+
+class SdrEdgeNode2GlueDistItem: public SdrMetricItem {
+public:
+ SdrEdgeNode2GlueDistItem(long nVal=0): SdrMetricItem(SDRATTR_EDGENODE2GLUEDIST,nVal) {}
+ SdrEdgeNode2GlueDistItem(SvStream& rIn): SdrMetricItem(SDRATTR_EDGENODE2GLUEDIST,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxfiitm.hxx b/svx/inc/svx/sxfiitm.hxx
new file mode 100644
index 000000000000..e40010bb1ad4
--- /dev/null
+++ b/svx/inc/svx/sxfiitm.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SFXIITM_HXX
+#define _SFXIITM_HXX
+
+#include <svl/poolitem.hxx>
+#include <tools/fract.hxx>
+
+/*************************************************************************/
+/* FractionItem */
+/*************************************************************************/
+
+class SdrFractionItem: public SfxPoolItem {
+ Fraction nValue;
+public:
+ TYPEINFO_VISIBILITY( SVX_DLLPUBLIC );
+ SdrFractionItem(sal_uInt16 nId=0): SfxPoolItem(nId) {}
+ SdrFractionItem(sal_uInt16 nId, const Fraction& rVal): SfxPoolItem(nId), nValue(rVal) {}
+ SdrFractionItem(sal_uInt16 nId, SvStream& rIn);
+ virtual int operator==(const SfxPoolItem&) const;
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePresentation, SfxMapUnit eCoreMetric, SfxMapUnit ePresentationMetric, String &rText, const IntlWrapper * = 0) const;
+ virtual SfxPoolItem* Create(SvStream&, sal_uInt16 nVer) const;
+ virtual SvStream& Store(SvStream&, sal_uInt16 nItemVers) const;
+ virtual SfxPoolItem* Clone(SfxItemPool *pPool=NULL) const;
+ const Fraction& GetValue() const { return nValue; }
+ void SetValue(const Fraction& rVal) { nValue = rVal; }
+#ifdef SDR_ISPOOLABLE
+ virtual int IsPoolable() const;
+#endif
+};
+
+
+#endif
diff --git a/svx/inc/svx/sxlayitm.hxx b/svx/inc/svx/sxlayitm.hxx
new file mode 100644
index 000000000000..fa346dee0e9c
--- /dev/null
+++ b/svx/inc/svx/sxlayitm.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SYLAYITM_HXX
+#define _SYLAYITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svl/stritem.hxx>
+#include <svl/intitem.hxx>
+#include <svx/svdtypes.hxx>
+
+//------------------------------
+// class SdrLayerIdItem
+//------------------------------
+class SdrLayerIdItem: public SfxUInt16Item {
+public:
+ SdrLayerIdItem(sal_uInt16 nId=0): SfxUInt16Item(SDRATTR_LAYERID,nId) {}
+ SdrLayerIdItem(SvStream& rIn): SfxUInt16Item(SDRATTR_LAYERID,rIn) {}
+ SdrLayerID GetValue() const { return (SdrLayerID)SfxUInt16Item::GetValue(); }
+};
+
+//------------------------------
+// class SdrLayerNameItem
+//------------------------------
+
+class SdrLayerNameItem: public SfxStringItem {
+public:
+ SdrLayerNameItem() : SfxStringItem() { SetWhich(SDRATTR_LAYERNAME); }
+ SdrLayerNameItem(const String& rStr) : SfxStringItem(SDRATTR_LAYERNAME,rStr) {}
+ SdrLayerNameItem(SvStream& rIn) : SfxStringItem(SDRATTR_LAYERNAME,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxlogitm.hxx b/svx/inc/svx/sxlogitm.hxx
new file mode 100644
index 000000000000..9ef4903329c7
--- /dev/null
+++ b/svx/inc/svx/sxlogitm.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXLOGITM_HXX
+#define _SXLOGITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdmetitm.hxx>
+
+//------------------------------
+// class SdrLogicSizeWidthItem
+//------------------------------
+class SdrLogicSizeWidthItem: public SdrMetricItem {
+public:
+ SdrLogicSizeWidthItem(long nWdt=0): SdrMetricItem(SDRATTR_LOGICSIZEWIDTH,nWdt) {}
+ SdrLogicSizeWidthItem(SvStream& rIn): SdrMetricItem(SDRATTR_LOGICSIZEWIDTH,rIn) {}
+};
+
+//------------------------------
+// class SdrLogicSizeWidthItem
+//------------------------------
+class SdrLogicSizeHeightItem: public SdrMetricItem {
+public:
+ SdrLogicSizeHeightItem(long nHgt=0): SdrMetricItem(SDRATTR_LOGICSIZEHEIGHT,nHgt) {}
+ SdrLogicSizeHeightItem(SvStream& rIn): SdrMetricItem(SDRATTR_LOGICSIZEHEIGHT,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxmbritm.hxx b/svx/inc/svx/sxmbritm.hxx
new file mode 100644
index 000000000000..1f28844a0910
--- /dev/null
+++ b/svx/inc/svx/sxmbritm.hxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXMBRITM_HXX
+#define _SXMBRITM_HXX
+
+#include <svx/svddef.hxx>
+
+#ifndef SXMBRITM_HXX
+#include <svx/sdynitm.hxx>
+#endif
+
+// Die Masslinie unterhalb der Bezugskante
+// Zur Bemassung einer Objektunterkante
+// (Redundant zum drehen der Bezugskante um 180deg +
+// TextUpsideDown, jedoch besser bedienbar)
+// laesst sich auch draggen, indem man den Masslinienabstand
+// (SdrMeasureLineDistItem) ueber die Bezugskante hinwegdraggt
+class SdrMeasureBelowRefEdgeItem: public SdrYesNoItem {
+public:
+ SdrMeasureBelowRefEdgeItem(bool bOn=false): SdrYesNoItem(SDRATTR_MEASUREBELOWREFEDGE,bOn) {}
+ SdrMeasureBelowRefEdgeItem(SvStream& rIn): SdrYesNoItem(SDRATTR_MEASUREBELOWREFEDGE,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxmfsitm.hxx b/svx/inc/svx/sxmfsitm.hxx
new file mode 100644
index 000000000000..2e50d05aabf2
--- /dev/null
+++ b/svx/inc/svx/sxmfsitm.hxx
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXMFSITM_HXX
+#define _SXMFSITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svl/stritem.hxx>
+
+// Formatstring (aehnl. Calc), z.B. "#.###,00km"
+// ueberschreibt SdrMeasureUnitItem und SdrMeasureShowUnitItem (n.i.)
+class SdrMeasureFormatStringItem: public SfxStringItem {
+public:
+ SdrMeasureFormatStringItem() : SfxStringItem() { SetWhich(SDRATTR_MEASUREFORMATSTRING); }
+ SdrMeasureFormatStringItem(const String& rStr) : SfxStringItem(SDRATTR_MEASUREFORMATSTRING,rStr) {}
+ SdrMeasureFormatStringItem(SvStream& rIn) : SfxStringItem(SDRATTR_MEASUREFORMATSTRING,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxmkitm.hxx b/svx/inc/svx/sxmkitm.hxx
new file mode 100644
index 000000000000..3cf0dcbe9351
--- /dev/null
+++ b/svx/inc/svx/sxmkitm.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXMKITM_HXX
+#define _SXMKITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svl/eitem.hxx>
+
+enum SdrMeasureKind {SDRMEASURE_STD,SDRMEASURE_RADIUS}; // n.i.
+
+//------------------------------
+// class SdrMeasureKindItem (n.i.)
+//------------------------------
+class SdrMeasureKindItem: public SfxEnumItem {
+public:
+ TYPEINFO();
+ SdrMeasureKindItem(SdrMeasureKind eKind=SDRMEASURE_STD): SfxEnumItem(SDRATTR_MEASUREKIND,sal::static_int_cast< sal_uInt16 >(eKind)) {}
+ SdrMeasureKindItem(SvStream& rIn) : SfxEnumItem(SDRATTR_MEASUREKIND,rIn) {}
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool=NULL) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual sal_uInt16 GetValueCount() const; // { return 2; }
+ SdrMeasureKind GetValue() const { return (SdrMeasureKind)SfxEnumItem::GetValue(); }
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual String GetValueTextByPos(sal_uInt16 nPos) const;
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String& rText, const IntlWrapper * = 0) const;
+};
+
+#endif
diff --git a/svx/inc/svx/sxmlhitm.hxx b/svx/inc/svx/sxmlhitm.hxx
new file mode 100644
index 000000000000..1d4ffb5cfb05
--- /dev/null
+++ b/svx/inc/svx/sxmlhitm.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXMLHITM_HXX
+#define _SXMLHITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdmetitm.hxx>
+
+/*************************************************************************/
+/* Measure */
+/*************************************************************************/
+// ___
+// | 100,00km | 2mm = SdrMeasureHelplineOverhangItem
+// |<--------------------->|---
+// | | 8mm = SdrMeasureLineDistItem
+// | |
+// #=============# |---
+// # # | SdrMeasureHelpline1/2LenItem
+// # #=========#---
+// # Zu bemassendes Objekt #
+// #=======================#
+
+// Abstand der Masslinie zur Bezugskante (Norm=8mm)
+// laesst sich auch draggen an den beiden Handles
+// die auf den Pfeilspitzen liegen
+class SdrMeasureLineDistItem: public SdrMetricItem {
+public:
+ SdrMeasureLineDistItem(long nVal=0): SdrMetricItem(SDRATTR_MEASURELINEDIST,nVal) {}
+ SdrMeasureLineDistItem(SvStream& rIn): SdrMetricItem(SDRATTR_MEASURELINEDIST,rIn) {}
+};
+
+// Ueberhang der Masshilfslinien an der Masslinie (Norm=2mm)
+class SdrMeasureHelplineOverhangItem: public SdrMetricItem {
+public:
+ SdrMeasureHelplineOverhangItem(long nVal=0): SdrMetricItem(SDRATTR_MEASUREHELPLINEOVERHANG,nVal) {}
+ SdrMeasureHelplineOverhangItem(SvStream& rIn): SdrMetricItem(SDRATTR_MEASUREHELPLINEOVERHANG,rIn) {}
+};
+
+// Abstand der der Masshilfslinienenden zur Bezugskante
+// Damit die Masshilfslinien nicht das Objekt beruehren
+class SdrMeasureHelplineDistItem: public SdrMetricItem {
+public:
+ SdrMeasureHelplineDistItem(long nVal=0): SdrMetricItem(SDRATTR_MEASUREHELPLINEDIST,nVal) {}
+ SdrMeasureHelplineDistItem(SvStream& rIn): SdrMetricItem(SDRATTR_MEASUREHELPLINEDIST,rIn) {}
+};
+
+// Ueberlaenge der Hilfslinien ueber die Bezugskante
+// laesst sich auch draggen an den beiden runden Handles,
+// die sich default unter den beiden Referenzpunkten befinden
+class SdrMeasureHelpline1LenItem: public SdrMetricItem {
+public:
+ SdrMeasureHelpline1LenItem(long nVal=0): SdrMetricItem(SDRATTR_MEASUREHELPLINE1LEN,nVal) {}
+ SdrMeasureHelpline1LenItem(SvStream& rIn): SdrMetricItem(SDRATTR_MEASUREHELPLINE1LEN,rIn) {}
+};
+class SdrMeasureHelpline2LenItem: public SdrMetricItem {
+public:
+ SdrMeasureHelpline2LenItem(long nVal=0): SdrMetricItem(SDRATTR_MEASUREHELPLINE2LEN,nVal) {}
+ SdrMeasureHelpline2LenItem(SvStream& rIn): SdrMetricItem(SDRATTR_MEASUREHELPLINE2LEN,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxmoitm.hxx b/svx/inc/svx/sxmoitm.hxx
new file mode 100644
index 000000000000..091c66ec49ac
--- /dev/null
+++ b/svx/inc/svx/sxmoitm.hxx
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXMOITM_HXX
+#define _SXMOITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdmetitm.hxx>
+
+// Ueberstand der Masslinie ueber die Masshilfslinien
+// Nur wenn die Masspfeile aussen sind (n.i.)
+class SdrMeasureOverhangItem: public SdrMetricItem {
+public:
+ SdrMeasureOverhangItem(long nVal=0): SdrMetricItem(SDRATTR_MEASUREOVERHANG,nVal) {}
+ SdrMeasureOverhangItem(SvStream& rIn): SdrMetricItem(SDRATTR_MEASUREOVERHANG,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxmovitm.hxx b/svx/inc/svx/sxmovitm.hxx
new file mode 100644
index 000000000000..360adfc52e1a
--- /dev/null
+++ b/svx/inc/svx/sxmovitm.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXMOVITM_HXX
+#define _SXMOVITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdmetitm.hxx>
+
+//------------------------------
+// class SdrMoveXItem
+//------------------------------
+class SdrMoveXItem: public SdrMetricItem {
+public:
+ SdrMoveXItem(long n=0): SdrMetricItem(SDRATTR_MOVEX,n) {}
+ SdrMoveXItem(SvStream& rIn): SdrMetricItem(SDRATTR_MOVEX,rIn) {}
+};
+
+//------------------------------
+// class SdrMoveYItem
+//------------------------------
+class SdrMoveYItem: public SdrMetricItem {
+public:
+ SdrMoveYItem(long n=0): SdrMetricItem(SDRATTR_MOVEY,n) {}
+ SdrMoveYItem(SvStream& rIn): SdrMetricItem(SDRATTR_MOVEY,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxmsitm.hxx b/svx/inc/svx/sxmsitm.hxx
new file mode 100644
index 000000000000..b58b30091569
--- /dev/null
+++ b/svx/inc/svx/sxmsitm.hxx
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXMSITM_HXX
+#define _SXMSITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sxsiitm.hxx>
+
+// Massstabsvorgabe. Wenn bereits am Model ein Massstab (UIScale) gesetzt
+// ist wird dieser nicht ueberschrieben. Stattdessen werden beide Massstaebe
+// miteinander multipliziert.
+class SdrMeasureScaleItem: public SdrScaleItem {
+public:
+ SdrMeasureScaleItem() : SdrScaleItem(SDRATTR_MEASURESCALE,Fraction(1,1)) {}
+ SdrMeasureScaleItem(const Fraction& rFr): SdrScaleItem(SDRATTR_MEASURESCALE,rFr) {}
+ SdrMeasureScaleItem(SvStream& rIn) : SdrScaleItem(SDRATTR_MEASURESCALE,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxmspitm.hxx b/svx/inc/svx/sxmspitm.hxx
new file mode 100644
index 000000000000..3af212ffbad1
--- /dev/null
+++ b/svx/inc/svx/sxmspitm.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXMSPITM_HXX
+#define _SXMSPITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdynitm.hxx>
+
+//------------------------------
+// class SdrMoveProtectItem
+//------------------------------
+class SdrObjMoveProtectItem: public SdrYesNoItem {
+public:
+ SdrObjMoveProtectItem(bool bOn=false): SdrYesNoItem(SDRATTR_OBJMOVEPROTECT,bOn) {}
+ SdrObjMoveProtectItem(SvStream& rIn): SdrYesNoItem(SDRATTR_OBJMOVEPROTECT,rIn) {}
+};
+
+//------------------------------
+// class SdrSizeProtectItem
+//------------------------------
+class SdrObjSizeProtectItem: public SdrYesNoItem {
+public:
+ SdrObjSizeProtectItem(bool bOn=false): SdrYesNoItem(SDRATTR_OBJSIZEPROTECT,bOn) {}
+ SdrObjSizeProtectItem(SvStream& rIn): SdrYesNoItem(SDRATTR_OBJSIZEPROTECT,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxmsuitm.hxx b/svx/inc/svx/sxmsuitm.hxx
new file mode 100644
index 000000000000..bc572a8319ff
--- /dev/null
+++ b/svx/inc/svx/sxmsuitm.hxx
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXMSUITM_HXX
+#define _SXMSUITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdynitm.hxx>
+
+// Die Masseinheit mit anzeigen
+class SdrMeasureShowUnitItem: public SdrYesNoItem {
+public:
+ SdrMeasureShowUnitItem(bool bOn=false): SdrYesNoItem(SDRATTR_MEASURESHOWUNIT,bOn) {}
+ SdrMeasureShowUnitItem(SvStream& rIn): SdrYesNoItem(SDRATTR_MEASURESHOWUNIT,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxmtaitm.hxx b/svx/inc/svx/sxmtaitm.hxx
new file mode 100644
index 000000000000..0d7f3d1fb777
--- /dev/null
+++ b/svx/inc/svx/sxmtaitm.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXMTAITM_HXX
+#define _SXMTAITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdynitm.hxx>
+#include <svx/sdangitm.hxx>
+
+// Den Text automatisch zurechtdrehen (Automatisches UpsideDown).
+// TextUpsideDown bleibt trotzdem weiterhin wirksam und dreht
+// den Text bei sal_True nochmal.
+class SdrMeasureTextAutoAngleItem: public SdrYesNoItem {
+public:
+ SdrMeasureTextAutoAngleItem(bool bOn=true): SdrYesNoItem(SDRATTR_MEASURETEXTAUTOANGLE,bOn) {}
+ SdrMeasureTextAutoAngleItem(SvStream& rIn): SdrYesNoItem(SDRATTR_MEASURETEXTAUTOANGLE,rIn) {}
+};
+
+// Der bevorzugte Blickwinkel zum lesen des Textes. Wird nur ausgewertet, wenn
+// TextAutoAngle=TRUE. Winkel in 1/100deg aus der Zeichnung zum Betrachter.
+class SdrMeasureTextAutoAngleViewItem: public SdrAngleItem {
+public:
+ SdrMeasureTextAutoAngleViewItem(long nVal=31500): SdrAngleItem(SDRATTR_MEASURETEXTAUTOANGLEVIEW,nVal) {}
+ SdrMeasureTextAutoAngleViewItem(SvStream& rIn): SdrAngleItem(SDRATTR_MEASURETEXTAUTOANGLEVIEW,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxmtfitm.hxx b/svx/inc/svx/sxmtfitm.hxx
new file mode 100644
index 000000000000..f43943bcc8d0
--- /dev/null
+++ b/svx/inc/svx/sxmtfitm.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXMTFITM_HXX
+#define _SXMTFITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdynitm.hxx>
+#include <svx/sdangitm.hxx>
+
+// die 2 folgenden sind noch nicht implementiert!
+// Text auf einen wirklich fixen Winkel festnageln.
+// Der Textwinkel ist dann auch unabhaengig vom Winkel der Masslinie.
+// Setzt TextUpsideDown, TextRota90 sowie TextAutoAngle ausser Kraft. (n.i.)
+class SdrMeasureTextIsFixedAngleItem: public SdrYesNoItem {
+public:
+ SdrMeasureTextIsFixedAngleItem(bool bOn=false): SdrYesNoItem(SDRATTR_MEASURETEXTISFIXEDANGLE,bOn) {}
+ SdrMeasureTextIsFixedAngleItem(SvStream& rIn): SdrYesNoItem(SDRATTR_MEASURETEXTISFIXEDANGLE,rIn) {}
+};
+
+// Der Winkel des Textes in 1/100deg. 0=Horizontal von links nach rechts zu lesen. (n.i.)
+class SdrMeasureTextFixedAngleItem: public SdrAngleItem {
+public:
+ SdrMeasureTextFixedAngleItem(long nVal=0): SdrAngleItem(SDRATTR_MEASURETEXTFIXEDANGLE,nVal) {}
+ SdrMeasureTextFixedAngleItem(SvStream& rIn): SdrAngleItem(SDRATTR_MEASURETEXTFIXEDANGLE,rIn) {}
+};
+
+// The decimal places used for the measure value
+class SdrMeasureDecimalPlacesItem: public SfxInt16Item {
+public:
+ SdrMeasureDecimalPlacesItem(sal_Int16 nVal=2): SfxInt16Item(SDRATTR_MEASUREDECIMALPLACES,nVal) {}
+ SdrMeasureDecimalPlacesItem(SvStream& rIn): SfxInt16Item(SDRATTR_MEASUREDECIMALPLACES,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxmtpitm.hxx b/svx/inc/svx/sxmtpitm.hxx
new file mode 100644
index 000000000000..383ee89a23ba
--- /dev/null
+++ b/svx/inc/svx/sxmtpitm.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXMTPITM_HXX
+#define _SXMTPITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svl/eitem.hxx>
+#include "svx/svxdllapi.h"
+
+enum SdrMeasureTextHPos {SDRMEASURE_TEXTHAUTO,SDRMEASURE_TEXTLEFTOUTSIDE,SDRMEASURE_TEXTINSIDE,SDRMEASURE_TEXTRIGHTOUTSIDE};
+enum SdrMeasureTextVPos {SDRMEASURE_TEXTVAUTO,SDRMEASURE_ABOVE,SDRMEASURETEXT_BREAKEDLINE,SDRMEASURE_BELOW,SDRMEASURETEXT_VERTICALCENTERED};
+
+//------------------------------
+// class SdrMeasureTextHPosItem
+//------------------------------
+class SVX_DLLPUBLIC SdrMeasureTextHPosItem: public SfxEnumItem {
+public:
+ TYPEINFO();
+ SdrMeasureTextHPosItem(SdrMeasureTextHPos ePos=SDRMEASURE_TEXTHAUTO): SfxEnumItem(SDRATTR_MEASURETEXTHPOS,sal::static_int_cast< sal_uInt16 >(ePos)) {}
+ SdrMeasureTextHPosItem(SvStream& rIn) : SfxEnumItem(SDRATTR_MEASURETEXTHPOS,rIn) {}
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool=NULL) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual sal_uInt16 GetValueCount() const; // { return 4; }
+ SdrMeasureTextHPos GetValue() const { return (SdrMeasureTextHPos)SfxEnumItem::GetValue(); }
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual String GetValueTextByPos(sal_uInt16 nPos) const;
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String& rText, const IntlWrapper * = 0) const;
+};
+
+//------------------------------
+// class SdrMeasureTextVPosItem
+//------------------------------
+class SVX_DLLPUBLIC SdrMeasureTextVPosItem: public SfxEnumItem {
+public:
+ TYPEINFO();
+ SdrMeasureTextVPosItem(SdrMeasureTextVPos ePos=SDRMEASURE_TEXTVAUTO): SfxEnumItem(SDRATTR_MEASURETEXTVPOS,sal::static_int_cast< sal_uInt16 >(ePos)) {}
+ SdrMeasureTextVPosItem(SvStream& rIn) : SfxEnumItem(SDRATTR_MEASURETEXTVPOS,rIn) {}
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool=NULL) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual sal_uInt16 GetValueCount() const; // { return 5; }
+ SdrMeasureTextVPos GetValue() const { return (SdrMeasureTextVPos)SfxEnumItem::GetValue(); }
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual String GetValueTextByPos(sal_uInt16 nPos) const;
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String& rText, const IntlWrapper * = 0) const;
+};
+
+#endif
diff --git a/svx/inc/svx/sxmtritm.hxx b/svx/inc/svx/sxmtritm.hxx
new file mode 100644
index 000000000000..c74c26f66535
--- /dev/null
+++ b/svx/inc/svx/sxmtritm.hxx
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXMTRITM_HXX
+#define _SXMTRITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdynitm.hxx>
+
+// Den Text quer zur Masslinie (90deg Drehung nach links)
+class SdrMeasureTextRota90Item: public SdrYesNoItem {
+public:
+ SdrMeasureTextRota90Item(bool bOn=false): SdrYesNoItem(SDRATTR_MEASURETEXTROTA90,bOn) {}
+ SdrMeasureTextRota90Item(SvStream& rIn): SdrYesNoItem(SDRATTR_MEASURETEXTROTA90,rIn) {}
+};
+
+// Das von mir berechnete TextRect um 180 deg drehen
+// Der Text wird dann aber auch auf die andere Seite der
+// Masslinie gebracht (wenn nicht Rota90)
+class SdrMeasureTextUpsideDownItem: public SdrYesNoItem {
+public:
+ SdrMeasureTextUpsideDownItem(bool bOn=false): SdrYesNoItem(SDRATTR_MEASURETEXTUPSIDEDOWN,bOn) {}
+ SdrMeasureTextUpsideDownItem(SvStream& rIn): SdrYesNoItem(SDRATTR_MEASURETEXTUPSIDEDOWN,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxmuitm.hxx b/svx/inc/svx/sxmuitm.hxx
new file mode 100644
index 000000000000..aeb9dfeec955
--- /dev/null
+++ b/svx/inc/svx/sxmuitm.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXMUITM_HXX
+#define _SXMUITM_HXX
+
+#include <vcl/field.hxx>
+#include <svx/svddef.hxx>
+#include <svl/eitem.hxx>
+#include "svx/svxdllapi.h"
+
+// Vorgabe einer Masseinheit. Der Zahlenwert wird in diese Einheit umgerechnet
+// (ausgehend von der MapUnit des Models). Diese Einheit wird dann ggf. auch angezeigt.
+class SVX_DLLPUBLIC SdrMeasureUnitItem: public SfxEnumItem {
+public:
+ TYPEINFO();
+ SdrMeasureUnitItem(FieldUnit eUnit=FUNIT_NONE): SfxEnumItem(SDRATTR_MEASUREUNIT,sal::static_int_cast< sal_uInt16 >(eUnit)) {}
+ SdrMeasureUnitItem(SvStream& rIn) : SfxEnumItem(SDRATTR_MEASUREUNIT,rIn) {}
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool=NULL) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual sal_uInt16 GetValueCount() const; // { return 14; }
+ FieldUnit GetValue() const { return (FieldUnit)SfxEnumItem::GetValue(); }
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual String GetValueTextByPos(sal_uInt16 nPos) const;
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String& rText, const IntlWrapper * = 0) const;
+};
+
+#endif
diff --git a/svx/inc/svx/sxoneitm.hxx b/svx/inc/svx/sxoneitm.hxx
new file mode 100644
index 000000000000..00285b23265a
--- /dev/null
+++ b/svx/inc/svx/sxoneitm.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXONEITM_HXX
+#define _SXONEITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdmetitm.hxx>
+
+//------------------------------
+// class SdrOnePositionXItem
+//------------------------------
+class SdrOnePositionXItem: public SdrMetricItem {
+public:
+ SdrOnePositionXItem(long nPosX=0): SdrMetricItem(SDRATTR_ONEPOSITIONX,nPosX) {}
+ SdrOnePositionXItem(SvStream& rIn): SdrMetricItem(SDRATTR_ONEPOSITIONX,rIn) {}
+};
+
+//------------------------------
+// class SdrOnePositionYItem
+//------------------------------
+class SdrOnePositionYItem: public SdrMetricItem {
+public:
+ SdrOnePositionYItem(long nPosY=0): SdrMetricItem(SDRATTR_ONEPOSITIONY,nPosY) {}
+ SdrOnePositionYItem(SvStream& rIn): SdrMetricItem(SDRATTR_ONEPOSITIONY,rIn) {}
+};
+
+//------------------------------
+// class SdrOneSizeWidthItem
+//------------------------------
+class SdrOneSizeWidthItem: public SdrMetricItem {
+public:
+ SdrOneSizeWidthItem(long nWdt=0): SdrMetricItem(SDRATTR_ONESIZEWIDTH,nWdt) {}
+ SdrOneSizeWidthItem(SvStream& rIn): SdrMetricItem(SDRATTR_ONESIZEWIDTH,rIn) {}
+};
+
+//------------------------------
+// class SdrOneSizeWidthItem
+//------------------------------
+class SdrOneSizeHeightItem: public SdrMetricItem {
+public:
+ SdrOneSizeHeightItem(long nHgt=0): SdrMetricItem(SDRATTR_ONESIZEHEIGHT,nHgt) {}
+ SdrOneSizeHeightItem(SvStream& rIn): SdrMetricItem(SDRATTR_ONESIZEHEIGHT,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxonitm.hxx b/svx/inc/svx/sxonitm.hxx
new file mode 100644
index 000000000000..35fa8b54dc28
--- /dev/null
+++ b/svx/inc/svx/sxonitm.hxx
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXONITM_HXX
+#define _SXONITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svl/stritem.hxx>
+
+//------------------------------
+// class SdrObjectNameItem
+//------------------------------
+
+class SdrObjectNameItem: public SfxStringItem {
+public:
+ SdrObjectNameItem() : SfxStringItem() { SetWhich(SDRATTR_OBJECTNAME); }
+ SdrObjectNameItem(const String& rStr) : SfxStringItem(SDRATTR_OBJECTNAME,rStr) {}
+ SdrObjectNameItem(SvStream& rIn) : SfxStringItem(SDRATTR_OBJECTNAME,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxopitm.hxx b/svx/inc/svx/sxopitm.hxx
new file mode 100644
index 000000000000..dd402c3a0915
--- /dev/null
+++ b/svx/inc/svx/sxopitm.hxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXOPITM_HXX
+#define _SXOPITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdynitm.hxx>
+
+//------------------------------
+// class SdrObjPrintableItem
+//------------------------------
+class SdrObjPrintableItem: public SdrYesNoItem {
+public:
+ SdrObjPrintableItem(bool bOn=false): SdrYesNoItem(SDRATTR_OBJPRINTABLE,bOn) {}
+ SdrObjPrintableItem(SvStream& rIn): SdrYesNoItem(SDRATTR_OBJPRINTABLE,rIn) {}
+};
+
+class SdrObjVisibleItem: public SdrYesNoItem {
+public:
+ SdrObjVisibleItem(bool bOn=true): SdrYesNoItem(SDRATTR_OBJVISIBLE,bOn) {}
+ SdrObjVisibleItem(SvStream& rIn): SdrYesNoItem(SDRATTR_OBJVISIBLE,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxraitm.hxx b/svx/inc/svx/sxraitm.hxx
new file mode 100644
index 000000000000..d0c48d8109ea
--- /dev/null
+++ b/svx/inc/svx/sxraitm.hxx
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXRAITM_HXX
+#define _SXRAITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdangitm.hxx>
+
+//------------------------------
+// class SdrRotateAngleItem
+//------------------------------
+class SdrRotateAngleItem: public SdrAngleItem {
+public:
+ SdrRotateAngleItem(long nAngle=0): SdrAngleItem(SDRATTR_ROTATEANGLE,nAngle) {}
+ SdrRotateAngleItem(SvStream& rIn): SdrAngleItem(SDRATTR_ROTATEANGLE,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxreaitm.hxx b/svx/inc/svx/sxreaitm.hxx
new file mode 100644
index 000000000000..ea539f63d12b
--- /dev/null
+++ b/svx/inc/svx/sxreaitm.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXREAITM_HXX
+#define _SXREAITM_HXX
+
+#include <svx/svddef.hxx>
+
+#ifndef _SXFIITM_HXX
+#include <svx/sxfiitm.hxx>
+#endif
+
+//------------------------------
+// class SdrResizeXAllItem
+//------------------------------
+class SdrResizeXAllItem: public SdrFractionItem {
+public:
+ SdrResizeXAllItem(): SdrFractionItem(SDRATTR_RESIZEXALL,Fraction(1,1)) {}
+ SdrResizeXAllItem(const Fraction& rFact): SdrFractionItem(SDRATTR_RESIZEXALL,rFact) {}
+ SdrResizeXAllItem(SvStream& rIn): SdrFractionItem(SDRATTR_RESIZEXALL,rIn) {}
+};
+
+//------------------------------
+// class SdrResizeYAllItem
+//------------------------------
+class SdrResizeYAllItem: public SdrFractionItem {
+public:
+ SdrResizeYAllItem(): SdrFractionItem(SDRATTR_RESIZEYALL,Fraction(1,1)) {}
+ SdrResizeYAllItem(const Fraction& rFact): SdrFractionItem(SDRATTR_RESIZEYALL,rFact) {}
+ SdrResizeYAllItem(SvStream& rIn): SdrFractionItem(SDRATTR_RESIZEYALL,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxreoitm.hxx b/svx/inc/svx/sxreoitm.hxx
new file mode 100644
index 000000000000..1d090c4b7277
--- /dev/null
+++ b/svx/inc/svx/sxreoitm.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXREOITM_HXX
+#define _SXREOITM_HXX
+
+#include <svx/svddef.hxx>
+
+#ifndef _SXFIITM_HXX
+#include <svx/sxfiitm.hxx>
+#endif
+
+//------------------------------
+// class SdrResizeXOneItem
+//------------------------------
+class SdrResizeXOneItem: public SdrFractionItem {
+public:
+ SdrResizeXOneItem(): SdrFractionItem(SDRATTR_RESIZEXONE,Fraction(1,1)) {}
+ SdrResizeXOneItem(const Fraction& rFact): SdrFractionItem(SDRATTR_RESIZEXONE,rFact) {}
+ SdrResizeXOneItem(SvStream& rIn): SdrFractionItem(SDRATTR_RESIZEXONE,rIn) {}
+};
+
+//------------------------------
+// class SdrResizeYOneItem
+//------------------------------
+class SdrResizeYOneItem: public SdrFractionItem {
+public:
+ SdrResizeYOneItem(): SdrFractionItem(SDRATTR_RESIZEYONE,Fraction(1,1)) {}
+ SdrResizeYOneItem(const Fraction& rFact): SdrFractionItem(SDRATTR_RESIZEYONE,rFact) {}
+ SdrResizeYOneItem(SvStream& rIn): SdrFractionItem(SDRATTR_RESIZEYONE,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxroaitm.hxx b/svx/inc/svx/sxroaitm.hxx
new file mode 100644
index 000000000000..739e3d653f24
--- /dev/null
+++ b/svx/inc/svx/sxroaitm.hxx
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXROAITM_HXX
+#define _SXROAITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdangitm.hxx>
+
+//------------------------------
+// class SdrRotateAllItem
+//------------------------------
+class SdrRotateAllItem: public SdrAngleItem {
+public:
+ SdrRotateAllItem(long nAngle=0): SdrAngleItem(SDRATTR_ROTATEALL,nAngle) {}
+ SdrRotateAllItem(SvStream& rIn): SdrAngleItem(SDRATTR_ROTATEALL,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxrooitm.hxx b/svx/inc/svx/sxrooitm.hxx
new file mode 100644
index 000000000000..955ce2bdf6d4
--- /dev/null
+++ b/svx/inc/svx/sxrooitm.hxx
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXROOITM_HXX
+#define _SXROOITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdangitm.hxx>
+
+//------------------------------
+// class SdrRotateOneItem
+//------------------------------
+class SdrRotateOneItem: public SdrAngleItem {
+public:
+ SdrRotateOneItem(long nAngle=0): SdrAngleItem(SDRATTR_ROTATEONE,nAngle) {}
+ SdrRotateOneItem(SvStream& rIn): SdrAngleItem(SDRATTR_ROTATEONE,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxsaitm.hxx b/svx/inc/svx/sxsaitm.hxx
new file mode 100644
index 000000000000..095e017d22e7
--- /dev/null
+++ b/svx/inc/svx/sxsaitm.hxx
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXSAITM_HXX
+#define _SXSAITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdangitm.hxx>
+
+//------------------------------
+// class SdrShearAngleItem
+//------------------------------
+class SdrShearAngleItem: public SdrAngleItem {
+public:
+ SdrShearAngleItem(long nAngle=0): SdrAngleItem(SDRATTR_SHEARANGLE,nAngle) {}
+ SdrShearAngleItem(SvStream& rIn): SdrAngleItem(SDRATTR_SHEARANGLE,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxsalitm.hxx b/svx/inc/svx/sxsalitm.hxx
new file mode 100644
index 000000000000..c189934afbb3
--- /dev/null
+++ b/svx/inc/svx/sxsalitm.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXSALITM_HXX
+#define _SXSALITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdangitm.hxx>
+
+//------------------------------
+// class SdrHorzShearAllItem
+//------------------------------
+class SdrHorzShearAllItem: public SdrAngleItem {
+public:
+ SdrHorzShearAllItem(long nAngle=0): SdrAngleItem(SDRATTR_HORZSHEARALL,nAngle) {}
+ SdrHorzShearAllItem(SvStream& rIn): SdrAngleItem(SDRATTR_HORZSHEARALL,rIn) {}
+};
+
+//------------------------------
+// class SdrVertShearAllItem
+//------------------------------
+class SdrVertShearAllItem: public SdrAngleItem {
+public:
+ SdrVertShearAllItem(long nAngle=0): SdrAngleItem(SDRATTR_VERTSHEARALL,nAngle) {}
+ SdrVertShearAllItem(SvStream& rIn): SdrAngleItem(SDRATTR_VERTSHEARALL,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxsiitm.hxx b/svx/inc/svx/sxsiitm.hxx
new file mode 100644
index 000000000000..ccc284f3ecbe
--- /dev/null
+++ b/svx/inc/svx/sxsiitm.hxx
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXSIITM_HXX
+#define _SXSIITM_HXX
+
+#ifndef _SXFIITM_HXX
+#include <svx/sxfiitm.hxx>
+#endif
+
+class SdrScaleItem: public SdrFractionItem {
+public:
+ TYPEINFO();
+ SdrScaleItem(sal_uInt16 nId=0): SdrFractionItem(nId,Fraction(1,1)) {}
+ SdrScaleItem(sal_uInt16 nId, const Fraction& rVal): SdrFractionItem(nId,rVal) {}
+ SdrScaleItem(sal_uInt16 nId, SvStream& rIn): SdrFractionItem(nId,rIn) {}
+ virtual SfxItemPresentation GetPresentation(SfxItemPresentation ePresentation, SfxMapUnit eCoreMetric, SfxMapUnit ePresentationMetric, String &rText, const IntlWrapper * = 0) const;
+ virtual SfxPoolItem* Create(SvStream&, sal_uInt16 nVer) const;
+ virtual SfxPoolItem* Clone(SfxItemPool *pPool=NULL) const;
+};
+
+#endif
diff --git a/svx/inc/svx/sxsoitm.hxx b/svx/inc/svx/sxsoitm.hxx
new file mode 100644
index 000000000000..2a0139f9372a
--- /dev/null
+++ b/svx/inc/svx/sxsoitm.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXSOITM_HXX
+#define _SXSOITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdangitm.hxx>
+
+//------------------------------
+// class SdrHorzShearOneItem
+//------------------------------
+class SdrHorzShearOneItem: public SdrAngleItem {
+public:
+ SdrHorzShearOneItem(long nAngle=0): SdrAngleItem(SDRATTR_HORZSHEARONE,nAngle) {}
+ SdrHorzShearOneItem(SvStream& rIn): SdrAngleItem(SDRATTR_HORZSHEARONE,rIn) {}
+};
+
+//------------------------------
+// class SdrVertShearOneItem
+//------------------------------
+class SdrVertShearOneItem: public SdrAngleItem {
+public:
+ SdrVertShearOneItem(long nAngle=0): SdrAngleItem(SDRATTR_VERTSHEARONE,nAngle) {}
+ SdrVertShearOneItem(SvStream& rIn): SdrAngleItem(SDRATTR_VERTSHEARONE,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/sxtraitm.hxx b/svx/inc/svx/sxtraitm.hxx
new file mode 100644
index 000000000000..bbea7b712c06
--- /dev/null
+++ b/svx/inc/svx/sxtraitm.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SXTRAITM_HXX
+#define _SXTRAITM_HXX
+
+#include <svx/svddef.hxx>
+#include <svx/sdmetitm.hxx>
+
+//------------------------------
+// class SdrTransformRef1XItem
+//------------------------------
+class SdrTransformRef1XItem: public SdrMetricItem {
+public:
+ SdrTransformRef1XItem(long nHgt=0): SdrMetricItem(SDRATTR_TRANSFORMREF1X,nHgt) {}
+ SdrTransformRef1XItem(SvStream& rIn): SdrMetricItem(SDRATTR_TRANSFORMREF1X,rIn) {}
+};
+
+//------------------------------
+// class SdrTransformRef1YItem
+//------------------------------
+class SdrTransformRef1YItem: public SdrMetricItem {
+public:
+ SdrTransformRef1YItem(long nHgt=0): SdrMetricItem(SDRATTR_TRANSFORMREF1Y,nHgt) {}
+ SdrTransformRef1YItem(SvStream& rIn): SdrMetricItem(SDRATTR_TRANSFORMREF1Y,rIn) {}
+};
+
+//------------------------------
+// class SdrTransformRef2XItem
+//------------------------------
+class SdrTransformRef2XItem: public SdrMetricItem {
+public:
+ SdrTransformRef2XItem(long nHgt=0): SdrMetricItem(SDRATTR_TRANSFORMREF2X,nHgt) {}
+ SdrTransformRef2XItem(SvStream& rIn): SdrMetricItem(SDRATTR_TRANSFORMREF2X,rIn) {}
+};
+
+//------------------------------
+// class SdrTransformRef2YItem
+//------------------------------
+class SdrTransformRef2YItem: public SdrMetricItem {
+public:
+ SdrTransformRef2YItem(long nHgt=0): SdrMetricItem(SDRATTR_TRANSFORMREF2Y,nHgt) {}
+ SdrTransformRef2YItem(SvStream& rIn): SdrMetricItem(SDRATTR_TRANSFORMREF2Y,rIn) {}
+};
+
+#endif
diff --git a/svx/inc/svx/tabarea.hxx b/svx/inc/svx/tabarea.hxx
new file mode 100644
index 000000000000..dc22f238b97e
--- /dev/null
+++ b/svx/inc/svx/tabarea.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_TAB_AREA_HXX
+#define _SVX_TAB_AREA_HXX
+
+// include ---------------------------------------------------------------
+
+#include <svtools/valueset.hxx>
+#ifndef _IMAGEBTN_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#include <svx/dlgctrl.hxx>
+#include <svx/xsetit.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xfillit.hxx>
+
+// enum ------------------------------------------------------------------
+
+enum ColorModel
+{
+ CM_RGB,
+ CM_CMYK // kann um weitere Modelle, z.B. HSV erweitert werden
+};
+
+enum PageType
+{
+ PT_AREA,
+ PT_GRADIENT,
+ PT_HATCH,
+ PT_BITMAP,
+ PT_COLOR,
+ PT_SHADOW,
+ PT_TRANSPARENCE
+};
+
+// define ----------------------------------------------------------------
+
+typedef sal_uInt16 ChangeType; // auch in tab_line.hxx (mitpflegen !!!)
+
+#define CT_NONE ( (ChangeType) 0x0000 )
+#define CT_MODIFIED ( (ChangeType) 0x0001 )
+#define CT_CHANGED ( (ChangeType) 0x0002 )
+#define CT_SAVED ( (ChangeType) 0x0004 )
+
+class SdrModel;
+class SdrView;
+
+#endif // _SVX_TAB_AREA_HXX
+
diff --git a/svx/inc/svx/tabline.hxx b/svx/inc/svx/tabline.hxx
new file mode 100644
index 000000000000..86febb53f9f4
--- /dev/null
+++ b/svx/inc/svx/tabline.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_TAB_LINE_HXX
+#define _SVX_TAB_LINE_HXX
+
+// include ---------------------------------------------------------------
+
+#ifndef _IMAGEBTN_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#ifndef _GROUP_HXX //autogen
+#include <vcl/group.hxx>
+#endif
+#include <svtools/stdctrl.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/xlineit.hxx>
+#include <svx/xsetit.hxx>
+#include <svx/dlgctrl.hxx>
+#include <vcl/menubtn.hxx>
+class SvxBrushItem;
+// define ----------------------------------------------------------------
+
+typedef sal_uInt16 ChangeType; // auch in tab_area.hxx (mitpflegen !!!)
+
+#define CT_NONE ( (ChangeType) 0x0000 )
+#define CT_MODIFIED ( (ChangeType) 0x0001 )
+#define CT_CHANGED ( (ChangeType) 0x0002 )
+#define CT_SAVED ( (ChangeType) 0x0004 )
+
+class SdrModel;
+class SdrObject;
+
+//defines fuer die Symbolauswahl auf der Page
+//Positive Werte (0,...n) gibt den Indes in pSymbollist an, sonst :
+#define SVX_SYMBOLTYPE_NONE (-3) //Symbol unsichtbar
+#define SVX_SYMBOLTYPE_AUTO (-2) //Symbol automatisch erzeugen
+#define SVX_SYMBOLTYPE_BRUSHITEM (-1) //Symbol ist als Graphic im Item enthalten:
+#define SVX_SYMBOLTYPE_UNKNOWN (-100) //unbekannt/nicht initialisiert
+
+#endif // _SVX_TAB_LINE_HXX
+
diff --git a/svx/inc/svx/tbcontrl.hxx b/svx/inc/svx/tbcontrl.hxx
new file mode 100644
index 000000000000..813fa08e0374
--- /dev/null
+++ b/svx/inc/svx/tbcontrl.hxx
@@ -0,0 +1,447 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_TBCONTRL_HXX
+#define _SVX_TBCONTRL_HXX
+
+/*--------------------------------------------------------------*\
+
+ Beschreibung:
+ -------------
+ ToolBox-Controler fuer:
+ Font-Name, Font-Hoehe, Font-Farbe
+ Vorder-/Hintergrundfarbe /-Muster
+ Rahmen, Linien
+ (Absatz-)Vorlagen
+
+ Bedienung:
+ ----------
+ SvxFontNameToolBoxControl
+ -------------------------
+ Item-Typ: SvxFontItem
+ Execute-Id: SID_ATTR_CHAR_FONT
+ -> SvxFontItem
+ Zusatzdaten
+ aus DocShell: SvxFontListItem (SID_ATTR_CHAR_FONTLIST)
+
+ SvxFontHeightToolBoxControl
+ ---------------------------
+ Item-Typ: SvxFontHeightItem
+ Execute-Id: SID_ATTR_CHAR_FONTHEIGHT
+ -> SvxFontHeightItem
+ Zusatzdaten
+ aus DocShell: SvxFontListItem (SID_ATTR_CHAR_FONTLIST)
+
+ SvxFontColorToolBoxControl
+ --------------------------
+ Item-Typ: SvxFontColorItem
+ Execute-Id: SID_ATTR_CHAR_COLOR
+ -> SvxFontColorItem
+ Zusatzdaten
+ aus DocShell: z.Zt. keine
+ in Zukunft: Farbpalette
+
+ class SvxFontColorExtToolBoxControl
+ -----------------------------------
+ fuer die Zeichenfarbe
+ Item-Typ SvxColorItem
+ und SfxBoolItem
+ Execute-Id SID_ATTR_CHAR_COLOR
+ und SID_ATTR_CHAR_COLOR_EXT
+
+ fuer den Zeichenhintergrund
+ Item-Typ SvxColorItem
+ und SfxBoolItem
+ Execute-Id SID_ATTR_CHAR_COLOR_BACKGROUND
+ und SID_ATTR_CHAR_COLOR_BACKGROUND_EXT
+
+ SvxColorToolBoxControl
+ --------------------------------
+ Item-Typ: SvxBrushItem
+ Execute-Id: SID_BACKGROUND_COLOR
+ -> SvxColorItem
+ Zusatzdaten
+ aus DocShell: z.Zt. keine
+ in Zukunft: Farbpalette
+
+ SvxPatternToolBoxControl
+ ------------------------
+ Item-Typ: SvxBrushItem
+ Execute-Id: SID_BACKGROUND_PATTERN
+ -> SvxBrushItem
+ Zusatzdaten
+ aus DocShell: z.Zt. keine
+ in Zukunft: Farbpalette
+ Bemerkung: Auswertung des BrushItems:
+ Die Brush-FillColor() wird als Schalter
+ missbraucht, um zu unterscheiden, ob ein
+ neuer Style oder eine neue Farbe
+ gesetzt wurde:
+
+ GetFillColor() == COL_BLACK -> GetStyle() auswerten,
+ GetFillColor() == COL_WHITE -> GetColor() auswerten
+
+ SvxFrameToolBoxControl
+ ----------------------
+ Item-Typ: SvxBoxItem
+ Execute-Id: SID_ATTR_BORDER
+ -> SvxBoxItem & SvxBoxInfoItem
+ Zusatzdaten
+ aus DocShell: keine
+ Bemerkung: liefert je nach gewaehltem ValueSet-Item
+ nur SvxBoxItem oder zusaetzlich SvxBoxInfoItem
+ Wird dem Controller ein SfxUInt16Item mit einem
+ Wert != 0 geschickt, so wird der Paragraph-Mode
+ eingeschaltet, d.h. die letzte Zeile wird
+ ausgeblendet. Ein Wert == 0 schaltet wieder in
+ den Tabellenmodus.
+
+ SvxFrameLineStyleToolBoxControl
+ -------------------------------
+ Item-Typ: SvxLineItem
+ Execute-Id: SID_FRAME_LINESTYLE
+ -> SvxLineItem
+ Zusatzdaten
+ aus DocShell: keine
+ Bemerkung: liefert ein SvxLineItem, welches eine SvxBorderLine
+ ohne Farbinformation liefert.
+
+ SvxFrameLineColorToolBoxControl
+ -------------------------------
+ Item-Typ: SvxColorItem
+ Execute-Id: SID_FRAME_LINECOLOR
+ -> SvxColorItem
+ Zusatzdaten
+ aus DocShell: keine
+
+ SvxStyleToolBoxControl
+ ----------------------
+ Item-Typ: SfxTemplateItem
+ Execute-Id: SID_TEMPLATE_APPLY
+ -> StyleName (SfxStringItem)
+ -> eStyleFamily (SfxUInt16Item)
+ Zusatzdaten
+ aus DocShell: keine
+ Bemerkung: Umschalten der Familie ueber Invalidate
+ an den Bindings (->SfxStyleControllerItem)
+
+\*--------------------------------------------------------------*/
+
+// include ---------------------------------------------------------------
+
+// ITEMID_...-Defines im *.cxx
+
+#include <rsc/rscsfx.hxx>
+#include <svl/lstner.hxx>
+#include <sfx2/tbxctrl.hxx>
+#include <svx/strarray.hxx>
+#include "svx/svxdllapi.h"
+
+#include <com/sun/star/awt/FontDescriptor.hpp>
+
+// wichtig im mit HeDaBu erzeugtem tbxctrls.hxx!!!
+class SvxLineItem;
+class SvxBoxInfoItem;
+class SvxFontItem;
+class SvxFontHeightItem;
+class SfxStyleControllerItem_Impl;
+class SfxStyleSheetBasePool;
+class SfxTemplateItem;
+
+namespace svx
+{
+ class ToolboxButtonColorUpdater;
+}
+//########################################################################
+
+//========================================================================
+// class SvxStyleToolBoxControl ------------------------------------------
+//========================================================================
+class SVX_DLLPUBLIC SvxStyleToolBoxControl : public SfxToolBoxControl
+{
+ struct Impl;
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SvxStyleToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxStyleToolBoxControl();
+
+ virtual Window* CreateItemWindow( Window *pParent );
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+
+ DECL_LINK( VisibilityNotification, void* );
+protected:
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // XUpdatable
+ virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
+
+private:
+
+#define MAX_FAMILIES 5
+
+ SfxStyleSheetBasePool* pStyleSheetPool;
+ SfxStyleControllerItem_Impl* pBoundItems [MAX_FAMILIES];
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xBoundItems[MAX_FAMILIES];
+ SfxTemplateItem* pFamilyState[MAX_FAMILIES];
+ sal_uInt16 nActFamily; // Id in der ToolBox = Position - 1
+ sal_uInt16 nActFilter; // FilterIdx
+ sal_uInt16 nAppFilter; // Filter, den die App gesetzt hat
+ String aCurSel;
+ sal_Bool bListening;
+ Impl* pImpl;
+
+ SVX_DLLPRIVATE void Update();
+ SVX_DLLPRIVATE void FillStyleBox();
+ SVX_DLLPRIVATE void SelectStyle( const String& rStyleName );
+
+friend class SfxStyleControllerItem_Impl;
+
+ SVX_DLLPRIVATE void SetFamilyState ( sal_uInt16 nIdx, const SfxTemplateItem* pItem );
+ SVX_DLLPRIVATE SfxStyleFamily GetActFamily ();
+};
+
+//========================================================================
+// class SvxFontNameToolBoxControl ---------------------------------------
+//========================================================================
+
+
+class SVX_DLLPUBLIC SvxFontNameToolBoxControl : public SfxToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxFontNameToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+
+ virtual void StateChanged ( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ virtual Window* CreateItemWindow ( Window *pParent );
+};
+
+
+
+//========================================================================
+// class SvxFontHeightToolBoxControl -------------------------------------
+//========================================================================
+
+/*
+class SvxFontSizeItem;
+class SvxFontItem;
+class SvxFontSizeBox_Impl;
+
+class SVX_DLLPUBLIC SvxFontHeightToolBoxControl : public SfxToolBoxControl
+{
+ SvxFontSizeBox_Impl* pBox; // ItemWindow f"ur quick-access
+ ::com::sun::star::awt::FontDescriptor aCurrentFont; // Kopie des aktuellen Fonts
+
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxFontHeightToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxFontHeightToolBoxControl();
+
+ // new controller API
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ virtual Window* CreateItemWindow( Window *pParent );
+};
+*/
+
+
+//========================================================================
+// class SvxFontColorToolBoxControl --------------------------------------
+//========================================================================
+
+
+
+class SVX_DLLPUBLIC SvxFontColorToolBoxControl : public SfxToolBoxControl
+{
+ ::svx::ToolboxButtonColorUpdater* pBtnUpdater;
+
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxFontColorToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxFontColorToolBoxControl();
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ virtual SfxPopupWindowType GetPopupWindowType() const;
+ virtual SfxPopupWindow* CreatePopupWindow();
+};
+
+
+
+//========================================================================
+// class SvxFontColorExtToolBoxControl --------------------------------------
+//========================================================================
+
+
+
+class SVX_DLLPUBLIC SvxFontColorExtToolBoxControl : public SfxToolBoxControl
+{
+ using SfxToolBoxControl::StateChanged;
+ using SfxToolBoxControl::Select;
+
+ // SfxStatusForwarder aForward;
+ ::svx::ToolboxButtonColorUpdater* pBtnUpdater;
+
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxFontColorExtToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxFontColorExtToolBoxControl();
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ virtual SfxPopupWindowType GetPopupWindowType() const;
+ virtual SfxPopupWindow* CreatePopupWindow();
+ virtual void Select( sal_Bool bMod1 = sal_False );
+
+};
+
+
+
+//========================================================================
+// class SvxColorToolBoxControl ------------------------------------------
+//========================================================================
+
+
+class SVX_DLLPUBLIC SvxColorToolBoxControl : public SfxToolBoxControl
+{
+ ::svx::ToolboxButtonColorUpdater* pBtnUpdater;
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxColorToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxColorToolBoxControl();
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ virtual SfxPopupWindowType GetPopupWindowType() const;
+ virtual SfxPopupWindow* CreatePopupWindow();
+};
+
+
+
+//========================================================================
+// class SvxFrameToolBoxControl ------------------------------------------
+//========================================================================
+
+
+class SVX_DLLPUBLIC SvxFrameToolBoxControl : public SfxToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxFrameToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+
+ virtual SfxPopupWindowType GetPopupWindowType() const;
+ virtual SfxPopupWindow* CreatePopupWindow();
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+
+};
+
+
+
+//========================================================================
+// class SvxLineStyleToolBoxControl --------------------------------------
+//========================================================================
+
+
+class SVX_DLLPUBLIC SvxFrameLineStyleToolBoxControl : public SfxToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxFrameLineStyleToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+
+ virtual SfxPopupWindowType GetPopupWindowType() const;
+ virtual SfxPopupWindow* CreatePopupWindow();
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+};
+
+
+
+//========================================================================
+// class SvxFrameLineColorToolBoxControl ---------------------------------
+//========================================================================
+
+
+class SVX_DLLPUBLIC SvxFrameLineColorToolBoxControl : public SfxToolBoxControl
+{
+ ::svx::ToolboxButtonColorUpdater* pBtnUpdater;
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxFrameLineColorToolBoxControl( sal_uInt16 nSlotId,
+ sal_uInt16 nId,
+ ToolBox& rTbx );
+ ~SvxFrameLineColorToolBoxControl();
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ virtual SfxPopupWindowType GetPopupWindowType() const;
+ virtual SfxPopupWindow* CreatePopupWindow();
+};
+
+
+
+class SvxReloadControllerItem_Impl;
+class SvxReloadControllerItem : public SfxToolBoxControl
+{
+private:
+ SvxReloadControllerItem_Impl* pImpl;
+
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxReloadControllerItem( sal_uInt16 nSlotId,
+ sal_uInt16 nId,
+ ToolBox& rTbx );
+ ~SvxReloadControllerItem();
+
+protected:
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+};
+
+class SVX_DLLPUBLIC SvxSimpleUndoRedoController : public SfxToolBoxControl
+{
+private:
+ ::rtl::OUString aDefaultText;
+
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxSimpleUndoRedoController( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxSimpleUndoRedoController();
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+};
+
+#endif // #ifndef _SVX_TBCONTRL_HXX
diff --git a/svx/inc/svx/tbxalign.hxx b/svx/inc/svx/tbxalign.hxx
new file mode 100644
index 000000000000..85504738eafa
--- /dev/null
+++ b/svx/inc/svx/tbxalign.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TBXALIGN_HXX
+#define _TBXALIGN_HXX
+
+#include <sfx2/tbxctrl.hxx>
+#include "svx/svxdllapi.h"
+
+
+class SVX_DLLPUBLIC SvxTbxCtlAlign: public SfxToolBoxControl
+{
+public:
+ virtual ::sal_Bool SAL_CALL opensSubToolbar() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSubToolbarName() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL functionSelected( const ::rtl::OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateImage() throw (::com::sun::star::uno::RuntimeException);
+
+ virtual SfxPopupWindowType GetPopupWindowType() const;
+ virtual SfxPopupWindow* CreatePopupWindow();
+
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SvxTbxCtlAlign( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxTbxCtlAlign() {}
+private:
+ rtl::OUString m_aSubTbName;
+ rtl::OUString m_aSubTbResName;
+ rtl::OUString m_aCommand;
+};
+#endif
diff --git a/svx/inc/svx/tbxcolor.hxx b/svx/inc/svx/tbxcolor.hxx
new file mode 100644
index 000000000000..848c015c2995
--- /dev/null
+++ b/svx/inc/svx/tbxcolor.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_TBXCOLOR_HXX
+#define _SVX_TBXCOLOR_HXX
+
+#include <com/sun/star/frame/XLayoutManager.hpp>
+#include "svx/svxdllapi.h"
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ //====================================================================
+ //= ToolboxAccess
+ //====================================================================
+ class SVX_DLLPUBLIC ToolboxAccess
+ {
+ private:
+ bool m_bDocking;
+ ::rtl::OUString m_sToolboxResName;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XLayoutManager > m_xLayouter;
+
+ public:
+ ToolboxAccess( const ::rtl::OUString& rToolboxName );
+
+ public:
+ /** toggles the toolbox
+ */
+ void toggleToolbox() const;
+
+ /** determines whether the toolbox is currently visible
+ */
+ bool isToolboxVisible() const;
+
+ /** forces that the toolbox is docked
+ */
+ inline void forceDocking() { m_bDocking = true; }
+ };
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+#endif // #ifndef _SVX_TBXCOLOR_HXX
+
diff --git a/svx/inc/svx/tbxcolorupdate.hxx b/svx/inc/svx/tbxcolorupdate.hxx
new file mode 100644
index 000000000000..fbeeb1899105
--- /dev/null
+++ b/svx/inc/svx/tbxcolorupdate.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_TBXCOLORUPDATE_HXX
+#define SVX_TBXCOLORUPDATE_HXX
+
+#include <svx/svxdllapi.h>
+
+#include <tools/gen.hxx>
+#include <tools/color.hxx>
+
+class ToolBox;
+class VirtualDevice;
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+#define TBX_UPDATER_MODE_NONE 0x00
+#define TBX_UPDATER_MODE_CHAR_COLOR 0x01
+#define TBX_UPDATER_MODE_CHAR_BACKGROUND 0x02
+#define TBX_UPDATER_MODE_CHAR_COLOR_NEW 0x03
+
+ //====================================================================
+ //= ToolboxButtonColorUpdater
+ //====================================================================
+ /** helper class to update a color in a toolbox button image
+
+ formerly known as SvxTbxButtonColorUpdater_Impl, residing in svx/source/tbxctrls/colorwindow.hxx.
+ */
+ class SVX_DLLPUBLIC ToolboxButtonColorUpdater
+ {
+ public:
+ ToolboxButtonColorUpdater( sal_uInt16 nSlotId,
+ sal_uInt16 nTbxBtnId,
+ ToolBox* ptrTbx,
+ sal_uInt16 nMode = 0 );
+ ~ToolboxButtonColorUpdater();
+
+ void Update( const Color& rColor );
+
+ protected:
+ void DrawChar(VirtualDevice&, const Color&);
+
+ private:
+ sal_uInt16 mnDrawMode;
+ sal_uInt16 mnBtnId;
+ sal_uInt16 mnSlotId;
+ ToolBox* mpTbx;
+ Color maCurColor;
+ Rectangle maUpdRect;
+ Size maBmpSize;
+ sal_Bool mbWasHiContrastMode;
+ };
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+#endif // SVX_TBXCOLORUPDATE_HXX
diff --git a/svx/inc/svx/tbxctl.hxx b/svx/inc/svx/tbxctl.hxx
new file mode 100644
index 000000000000..301fb401a789
--- /dev/null
+++ b/svx/inc/svx/tbxctl.hxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TBXCTL_HXX
+#define _TBXCTL_HXX
+
+#include <sfx2/tbxctrl.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* Klasse f"ur SwToolbox
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC SvxTbxCtlDraw : public SfxToolBoxControl
+{
+private:
+ ::rtl::OUString m_sToolboxName;
+
+ void toggleToolbox();
+
+protected:
+ using SfxToolBoxControl::Select;
+
+public:
+ SvxTbxCtlDraw( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxTbxCtlDraw() {}
+
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ virtual void Select( sal_Bool bMod1 = sal_False );
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ virtual SfxPopupWindowType GetPopupWindowType() const;
+};
+
+#endif
+
diff --git a/svx/inc/svx/tbxcustomshapes.hxx b/svx/inc/svx/tbxcustomshapes.hxx
new file mode 100644
index 000000000000..114ccf4814b1
--- /dev/null
+++ b/svx/inc/svx/tbxcustomshapes.hxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_TBXCUSTOMSHAPES_HXX
+#define _SVX_TBXCUSTOMSHAPES_HXX
+
+#include <sfx2/tbxctrl.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* SvxTbxCtlCustomShapes
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC SvxTbxCtlCustomShapes : public SfxToolBoxControl
+{
+public:
+ using SfxToolBoxControl::Select;
+ virtual void Select( sal_Bool bMod1 = sal_False );
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ virtual SfxPopupWindowType GetPopupWindowType() const;
+ virtual SfxPopupWindow* CreatePopupWindow();
+
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SvxTbxCtlCustomShapes( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxTbxCtlCustomShapes() {}
+
+ //interface XSubToolbarController:
+ virtual ::sal_Bool SAL_CALL opensSubToolbar() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSubToolbarName() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL functionSelected( const ::rtl::OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateImage() throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ rtl::OUString m_aSubTbName;
+ rtl::OUString m_aSubTbxResName;
+ rtl::OUString m_aCommand;
+};
+
+
+#endif
+
diff --git a/svx/inc/svx/tbxdraw.hxx b/svx/inc/svx/tbxdraw.hxx
new file mode 100644
index 000000000000..295f9e4539d4
--- /dev/null
+++ b/svx/inc/svx/tbxdraw.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TBXDRAW_HXX
+#define _TBXDRAW_HXX
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/tbxctrl.hxx>
+
+// class SvxPopupWindowTbxMgr --------------------------------------------
+
+class SvxPopupWindowTbxMgr : public SfxPopupWindow
+{
+ void* pNiemalsDenPointerAufDieErzeugendeToolBoxMerken; // MI!
+ ResId aRIdWinTemp;
+ ResId aRIdTbxTemp;
+
+ Link aTbxClickHdl;
+
+
+ DECL_LINK( TbxSelectHdl, ToolBox*);
+ DECL_LINK( TbxClickHdl, ToolBox*);
+
+protected:
+ using SfxPopupWindow::StateChanged;
+
+public:
+ SvxPopupWindowTbxMgr( sal_uInt16 nId,
+ SfxToolBoxControl* pTbxCtl,
+ ResId aRIdWin,
+ ResId aRIdTbx );
+ SvxPopupWindowTbxMgr( sal_uInt16 nId,
+ WindowAlign eAlign,
+ ResId aRIdWin,
+ ResId aRIdTbx );
+ ~SvxPopupWindowTbxMgr();
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState);
+ virtual SfxPopupWindow* Clone() const;
+ virtual void PopupModeEnd();
+
+ void StartSelection();
+
+ // toolbox click or execute may chage the default selection in the tools toolbox
+ virtual void UserEvent( sal_uIntPtr nEvent, void* pEventData );
+};
+
+
+#endif // _TBX_DRAW_HXX
+
diff --git a/svx/inc/svx/txencbox.hxx b/svx/inc/svx/txencbox.hxx
new file mode 100644
index 000000000000..ede3461d2b43
--- /dev/null
+++ b/svx/inc/svx/txencbox.hxx
@@ -0,0 +1,121 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_TXENCBOX_HXX
+#define _SVX_TXENCBOX_HXX
+
+// include ---------------------------------------------------------------
+
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+#include <rtl/textenc.h>
+#include "svx/svxdllapi.h"
+
+class SvxTextEncodingTable;
+
+class SVX_DLLPUBLIC SvxTextEncodingBox : public ListBox
+{
+private:
+ const SvxTextEncodingTable* m_pEncTable;
+
+ SVX_DLLPRIVATE sal_uInt16 EncodingToPos_Impl( rtl_TextEncoding nEnc ) const;
+
+public:
+ SvxTextEncodingBox( Window* pParent, const ResId& rResId );
+ ~SvxTextEncodingBox();
+
+ /** Fill with all known encodings but exclude those matching one or more
+ given flags as defined in rtl/tencinfo.h
+
+ <p> If nButIncludeInfoFlags is given, encodings are included even if they
+ match nExcludeInfoFlags. Thus it is possible to exclude 16/32-bit
+ Unicode with RTL_TEXTENCODING_INFO_UNICODE but to include UTF7 and UTF8
+ with RTL_TEXTENCODING_INFO_MIME </p>
+
+ @param bExcludeImportSubsets
+ If <TRUE/>, some specific encodings are not listed, as they are a
+ subset of another encoding. This is the case for
+ RTL_TEXTENCODING_GB_2312, RTL_TEXTENCODING_GBK,
+ RTL_TEXTENCODING_MS_936, which are covered by
+ RTL_TEXTENCODING_GB_18030. Normally, this flag should be set to
+ <TRUE/> whenever the box is used in import dialogs. */
+ void FillFromTextEncodingTable(
+ sal_Bool bExcludeImportSubsets = sal_False,
+ sal_uInt32 nExcludeInfoFlags = 0,
+ sal_uInt32 nButIncludeInfoFlags = 0
+ );
+
+ /** Fill with all encodings known to the dbtools::OCharsetMap but exclude
+ those matching one or more given flags as defined in rtl/tencinfo.h
+
+ <p> If nButIncludeInfoFlags is given, encodings are included even if they
+ match nExcludeInfoFlags. Thus it is possible to exclude 16/32-bit
+ Unicode with RTL_TEXTENCODING_INFO_UNICODE but to include UTF7 and UTF8
+ with RTL_TEXTENCODING_INFO_MIME </p>
+
+ @param bExcludeImportSubsets
+ If <TRUE/>, some specific encodings are not listed, as they are a
+ subset of another encoding. This is the case for
+ RTL_TEXTENCODING_GB_2312, RTL_TEXTENCODING_GBK,
+ RTL_TEXTENCODING_MS_936, which are covered by
+ RTL_TEXTENCODING_GB_18030. Normally, this flag should be set to
+ <TRUE/> whenever the box is used in import dialogs. */
+ void FillFromDbTextEncodingMap(
+ sal_Bool bExcludeImportSubsets = sal_False,
+ sal_uInt32 nExcludeInfoFlags = 0,
+ sal_uInt32 nButIncludeInfoFlags = 0
+ );
+
+ /** Fill with all known MIME encodings and select the best according to
+ <method>GetBestMimeEncoding</method>
+ */
+ void FillWithMimeAndSelectBest();
+
+ const SvxTextEncodingTable* GetTextEncodingTable() const
+ { return m_pEncTable; }
+
+ void InsertTextEncoding( const rtl_TextEncoding nEnc,
+ sal_uInt16 nPos = LISTBOX_APPEND );
+
+ void InsertTextEncoding( const rtl_TextEncoding nEnc,
+ const String& rEntry,
+ sal_uInt16 nPos = LISTBOX_APPEND );
+
+ void RemoveTextEncoding( const rtl_TextEncoding nEnc );
+
+ void SelectTextEncoding( const rtl_TextEncoding nEnc,
+ sal_Bool bSelect = sal_True );
+
+ rtl_TextEncoding GetSelectTextEncoding() const;
+
+ const String& GetSelectTextString() const;
+
+ sal_Bool IsTextEncodingSelected( const rtl_TextEncoding nEnc ) const;
+};
+
+#endif
+
diff --git a/svx/inc/svx/txenctab.hxx b/svx/inc/svx/txenctab.hxx
new file mode 100644
index 000000000000..e04428717c53
--- /dev/null
+++ b/svx/inc/svx/txenctab.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_TXENCTAB_HXX
+#define _SVX_TXENCTAB_HXX
+
+// include ---------------------------------------------------------------
+
+#ifndef _RESARY_HXX //autogen
+#include <tools/resary.hxx>
+#endif
+#include <rtl/textenc.h>
+#include "svx/svxdllapi.h"
+
+
+//========================================================================
+// class SvxTextEncodingTable
+//========================================================================
+
+class SVX_DLLPUBLIC SvxTextEncodingTable : public ResStringArray
+{
+public:
+ SvxTextEncodingTable();
+ ~SvxTextEncodingTable();
+
+ const String& GetTextString( const rtl_TextEncoding nEnc ) const;
+ rtl_TextEncoding GetTextEncoding( const String& rStr ) const;
+};
+
+
+#endif
+
diff --git a/svx/inc/svx/ucsubset.hrc b/svx/inc/svx/ucsubset.hrc
new file mode 100644
index 000000000000..50f7e62162e6
--- /dev/null
+++ b/svx/inc/svx/ucsubset.hrc
@@ -0,0 +1,155 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svx/dialogs.hrc>
+
+// strings for unicode range descriptions (used e.g. by Charmap dialog)
+// (see the Unicode spec and TrueType::OS2.ulUnicodeRange description)
+#define RID_SUBSETMAP 1243
+#define RID_SUBSET_START (RID_SVX_START + 901)
+#define RID_SUBSET_COUNT 95
+
+#define RID_SUBSETSTR_BASIC_LATIN (RID_SUBSET_START + 0)
+#define RID_SUBSETSTR_LATIN_1 (RID_SUBSET_START + 1)
+#define RID_SUBSETSTR_LATIN_EXTENDED_A (RID_SUBSET_START + 2)
+#define RID_SUBSETSTR_LATIN_EXTENDED_B (RID_SUBSET_START + 3)
+#define RID_SUBSETSTR_IPA_EXTENSIONS (RID_SUBSET_START + 4)
+#define RID_SUBSETSTR_SPACING_MODIFIERS (RID_SUBSET_START + 5)
+#define RID_SUBSETSTR_COMB_DIACRITICAL (RID_SUBSET_START + 6)
+#define RID_SUBSETSTR_BASIC_GREEK (RID_SUBSET_START + 7)
+#define RID_SUBSETSTR_GREEK_SYMS_COPTIC (RID_SUBSET_START + 8)
+#define RID_SUBSETSTR_CYRILLIC (RID_SUBSET_START + 9)
+#define RID_SUBSETSTR_CYRILLIC_SUPPL (RID_SUBSET_START + 200)
+#define RID_SUBSETSTR_ARMENIAN (RID_SUBSET_START + 10)
+#define RID_SUBSETSTR_HEBREW_EXTENDED (RID_SUBSET_START + 11)
+#define RID_SUBSETSTR_BASIC_HEBREW (RID_SUBSET_START + 12)
+#define RID_SUBSETSTR_BASIC_ARABIC (RID_SUBSET_START + 13)
+#define RID_SUBSETSTR_ARABIC_EXTENDED (RID_SUBSET_START + 14)
+#define RID_SUBSETSTR_DEVANAGARI (RID_SUBSET_START + 15)
+#define RID_SUBSETSTR_BENGALI (RID_SUBSET_START + 16)
+#define RID_SUBSETSTR_GURMUKHI (RID_SUBSET_START + 17)
+#define RID_SUBSETSTR_GUJARATI (RID_SUBSET_START + 18)
+#define RID_SUBSETSTR_ORIYA (RID_SUBSET_START + 19)
+#define RID_SUBSETSTR_TAMIL (RID_SUBSET_START + 20)
+#define RID_SUBSETSTR_TELUGU (RID_SUBSET_START + 21)
+#define RID_SUBSETSTR_KANNADA (RID_SUBSET_START + 22)
+#define RID_SUBSETSTR_MALAYALAM (RID_SUBSET_START + 23)
+#define RID_SUBSETSTR_THAI (RID_SUBSET_START + 24)
+#define RID_SUBSETSTR_LAO (RID_SUBSET_START + 25)
+#define RID_SUBSETSTR_BASIC_GEORGIAN (RID_SUBSET_START + 26)
+#define RID_SUBSETSTR_GEORGIAN_EXTENDED (RID_SUBSET_START + 27)
+#define RID_SUBSETSTR_HANGUL_JAMO (RID_SUBSET_START + 28)
+#define RID_SUBSETSTR_LATIN_EXTENDED_ADDS (RID_SUBSET_START + 29)
+#define RID_SUBSETSTR_GREEK_EXTENDED (RID_SUBSET_START + 30)
+#define RID_SUBSETSTR_GENERAL_PUNCTUATION (RID_SUBSET_START + 31)
+#define RID_SUBSETSTR_SUB_SUPER_SCRIPTS (RID_SUBSET_START + 32)
+#define RID_SUBSETSTR_CURRENCY_SYMBOLS (RID_SUBSET_START + 33)
+#define RID_SUBSETSTR_COMB_DIACRITIC_SYMS (RID_SUBSET_START + 34)
+#define RID_SUBSETSTR_LETTERLIKE_SYMBOLS (RID_SUBSET_START + 35)
+#define RID_SUBSETSTR_NUMBER_FORMS (RID_SUBSET_START + 36)
+#define RID_SUBSETSTR_ARROWS (RID_SUBSET_START + 37)
+#define RID_SUBSETSTR_MATH_OPERATORS (RID_SUBSET_START + 38)
+#define RID_SUBSETSTR_MISC_TECHNICAL (RID_SUBSET_START + 39)
+#define RID_SUBSETSTR_CONTROL_PICTURES (RID_SUBSET_START + 40)
+#define RID_SUBSETSTR_OPTICAL_CHAR_REC (RID_SUBSET_START + 41)
+#define RID_SUBSETSTR_ENCLOSED_ALPHANUM (RID_SUBSET_START + 42)
+#define RID_SUBSETSTR_BOX_DRAWING (RID_SUBSET_START + 43)
+#define RID_SUBSETSTR_BLOCK_ELEMENTS (RID_SUBSET_START + 44)
+#define RID_SUBSETSTR_GEOMETRIC_SHAPES (RID_SUBSET_START + 45)
+#define RID_SUBSETSTR_MISC_DINGBATS (RID_SUBSET_START + 46)
+#define RID_SUBSETSTR_DINGBATS (RID_SUBSET_START + 47)
+#define RID_SUBSETSTR_CJK_SYMS_PUNCTUATION (RID_SUBSET_START + 48)
+#define RID_SUBSETSTR_HIRAGANA (RID_SUBSET_START + 49)
+#define RID_SUBSETSTR_KATAKANA (RID_SUBSET_START + 50)
+#define RID_SUBSETSTR_BOPOMOFO (RID_SUBSET_START + 51)
+#define RID_SUBSETSTR_HANGUL_COMPAT_JAMO (RID_SUBSET_START + 52)
+#define RID_SUBSETSTR_CJK_MISC (RID_SUBSET_START + 53)
+#define RID_SUBSETSTR_ENCLOSED_CJK_LETTERS (RID_SUBSET_START + 54)
+#define RID_SUBSETSTR_CJK_COMPATIBILITY (RID_SUBSET_START + 55)
+#define RID_SUBSETSTR_HANGUL (RID_SUBSET_START + 56)
+
+#define RID_SUBSETSTR_CJK_UNIFIED_IDGRAPH (RID_SUBSET_START + 59)
+#define RID_SUBSETSTR_PRIVATE_USE_AREA (RID_SUBSET_START + 60)
+#define RID_SUBSETSTR_CJK_COMPAT_IDGRAPHS (RID_SUBSET_START + 61)
+#define RID_SUBSETSTR_ALPHA_PRESENTATION (RID_SUBSET_START + 62)
+#define RID_SUBSETSTR_ARABIC_PRESENT_A (RID_SUBSET_START + 63)
+#define RID_SUBSETSTR_COMBINING_HALF_MARKS (RID_SUBSET_START + 64)
+#define RID_SUBSETSTR_CJK_COMPAT_FORMS (RID_SUBSET_START + 65)
+#define RID_SUBSETSTR_SMALL_FORM_VARIANTS (RID_SUBSET_START + 66)
+#define RID_SUBSETSTR_ARABIC_PRESENT_B (RID_SUBSET_START + 67)
+#define RID_SUBSETSTR_HALFW_FULLW_FORMS (RID_SUBSET_START + 68)
+#define RID_SUBSETSTR_SPECIALS (RID_SUBSET_START + 69)
+
+#define RID_SUBSETSTR_HANGUL_GA (RID_SUBSET_START + 150)
+#define RID_SUBSETSTR_HANGUL_NA (RID_SUBSET_START + 151)
+#define RID_SUBSETSTR_HANGUL_DA (RID_SUBSET_START + 152)
+#define RID_SUBSETSTR_HANGUL_RA (RID_SUBSET_START + 153)
+#define RID_SUBSETSTR_HANGUL_MA (RID_SUBSET_START + 154)
+#define RID_SUBSETSTR_HANGUL_BA (RID_SUBSET_START + 155)
+#define RID_SUBSETSTR_HANGUL_SA (RID_SUBSET_START + 156)
+#define RID_SUBSETSTR_HANGUL_AH (RID_SUBSET_START + 157)
+#define RID_SUBSETSTR_HANGUL_JA (RID_SUBSET_START + 158)
+#define RID_SUBSETSTR_HANGUL_CHA (RID_SUBSET_START + 159)
+#define RID_SUBSETSTR_HANGUL_KA (RID_SUBSET_START + 160)
+#define RID_SUBSETSTR_HANGUL_TA (RID_SUBSET_START + 161)
+#define RID_SUBSETSTR_HANGUL_PA (RID_SUBSET_START + 162)
+#define RID_SUBSETSTR_HANGUL_HA (RID_SUBSET_START + 163)
+#define RID_SUBSETSTR_YI (RID_SUBSET_START + 164)
+
+#define RID_SUBSETSTR_SINHALA (RID_SUBSET_START + 165)
+#define RID_SUBSETSTR_TIBETAN (RID_SUBSET_START + 166)
+#define RID_SUBSETSTR_MYANMAR (RID_SUBSET_START + 167)
+#define RID_SUBSETSTR_KHMER (RID_SUBSET_START + 168)
+
+#define RID_SUBSETSTR_OGHAM (RID_SUBSET_START + 170)
+#define RID_SUBSETSTR_RUNIC (RID_SUBSET_START + 171)
+#define RID_SUBSETSTR_SYRIAC (RID_SUBSET_START + 172)
+#define RID_SUBSETSTR_THAANA (RID_SUBSET_START + 173)
+#define RID_SUBSETSTR_ETHIOPIC (RID_SUBSET_START + 174)
+#define RID_SUBSETSTR_CHEROKEE (RID_SUBSET_START + 175)
+#define RID_SUBSETSTR_CANADIAN_ABORIGINAL (RID_SUBSET_START + 176)
+#define RID_SUBSETSTR_MONGOLIAN (RID_SUBSET_START + 177)
+#define RID_SUBSETSTR_CJK_EXT_A_UNIFIED_IDGRAPH (RID_SUBSET_START + 178)
+
+#define RID_SUBSETSTR_MISC_MATH_SYMS_A (RID_SUBSET_START + 210)
+#define RID_SUBSETSTR_SUPPL_ARROWS_A (RID_SUBSET_START + 211)
+#define RID_SUBSETSTR_BRAILLE_PATTERNS (RID_SUBSET_START + 212)
+#define RID_SUBSETSTR_SUPPL_ARROWS_B (RID_SUBSET_START + 213)
+#define RID_SUBSETSTR_MISC_MATH_SYMS_B (RID_SUBSET_START + 214)
+#define RID_SUBSETSTR_CJK_RADICAL_SUPPL (RID_SUBSET_START + 215)
+#define RID_SUBSETSTR_KANXI_RADICALS (RID_SUBSET_START + 216)
+#define RID_SUBSETSTR_IDEO_DESC_CHARS (RID_SUBSET_START + 217)
+
+#define RID_SUBSETSTR_TAGALOG (RID_SUBSET_START + 220)
+#define RID_SUBSETSTR_HANUNOO (RID_SUBSET_START + 221)
+#define RID_SUBSETSTR_TAGBANWA (RID_SUBSET_START + 222)
+#define RID_SUBSETSTR_BUHID (RID_SUBSET_START + 223)
+#define RID_SUBSETSTR_KANBUN (RID_SUBSET_START + 224)
+#define RID_SUBSETSTR_BOPOMOFO_EXTENDED (RID_SUBSET_START + 225)
+#define RID_SUBSETSTR_KATAKANA_PHONETIC (RID_SUBSET_START + 226)
+
+#define RID_SUBSET_END (RID_SUBSET_START + 299)
diff --git a/svx/inc/svx/ucsubset.hxx b/svx/inc/svx/ucsubset.hxx
new file mode 100644
index 000000000000..0d6e35bcaf38
--- /dev/null
+++ b/svx/inc/svx/ucsubset.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_SUBSETMAP_HXX
+#define _SVX_SUBSETMAP_HXX
+
+#include "svx/svxdllapi.h"
+
+#include <svx/ucsubset.hrc>
+#include <vcl/metric.hxx>
+
+#include <list>
+
+class FontCharMap;
+
+// classes Subset & SubsetMap --------------------------------------------
+// TODO: should be moved into Font Attributes territory,
+// we let them mature here though because this is currently the only use
+
+class Subset
+{
+public:
+ Subset( sal_UCS4 nMin, sal_UCS4 nMax, const String& aName )
+ : mnRangeMin(nMin), mnRangeMax(nMax), maRangeName(aName)
+ {}
+
+ Subset( sal_UCS4 nMin, sal_UCS4 nMax, int resId );
+
+ sal_UCS4 GetRangeMin() const { return mnRangeMin;}
+ sal_UCS4 GetRangeMax() const { return mnRangeMax;}
+ const String GetName() const { return maRangeName;}
+
+private:
+ sal_UCS4 mnRangeMin;
+ sal_UCS4 mnRangeMax;
+ String maRangeName;
+};
+
+typedef ::std::list<Subset> SubsetList;
+
+class SVX_DLLPUBLIC SubsetMap : private Resource
+{
+public:
+ SubsetMap( const FontCharMap* );
+
+ const Subset* GetSubsetByUnicode( sal_UCS4 ) const;
+ const Subset* GetNextSubset( bool bFirst ) const;
+
+private:
+ SubsetList maSubsets;
+ mutable SubsetList::const_iterator maSubsetIterator;
+
+ SVX_DLLPRIVATE void InitList();
+ SVX_DLLPRIVATE void ApplyCharMap( const FontCharMap* );
+};
+
+#endif
diff --git a/svx/inc/svx/unoapi.hxx b/svx/inc/svx/unoapi.hxx
new file mode 100644
index 000000000000..6a990a8d1c70
--- /dev/null
+++ b/svx/inc/svx/unoapi.hxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_UNOAPI_HXX_
+#define _SVX_UNOAPI_HXX_
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <sal/types.h>
+#include <svtools/grfmgr.hxx>
+#include <svl/poolitem.hxx>
+#include "svx/svxdllapi.h"
+
+class SvxShape;
+class SdrObject;
+class SdrPage;
+class SvxNumBulletItem;
+class SfxItemPool;
+class String;
+
+/** creates a StarOffice API wrapper with the given type and inventor
+ Deprecated: This will be replaced with a function returning XShape.
+*/
+SVX_DLLPUBLIC SvxShape* CreateSvxShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt32 nInventor ) throw();
+
+/** returns a StarOffice API wrapper for the given SdrObject */
+SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > GetXShapeForSdrObject( SdrObject* pObj ) throw ();
+
+/** returns the SdrObject from the given StarOffice API wrapper */
+SVX_DLLPUBLIC SdrObject* GetSdrObjectFromXShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ) throw() ;
+
+/** returns a StarOffice API wrapper for the given SdrPage */
+SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > GetXDrawPageForSdrPage( SdrPage* pPage ) throw ();
+
+/** returns the SdrPage from the given StarOffice API wrapper */
+SVX_DLLPUBLIC SdrPage* GetSdrPageFromXDrawPage( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > xDrawPage ) throw() ;
+
+/** returns the SvxNumBulletItem with the given name from the pool or a null if there is no item
+ with that name
+*/
+SvxNumBulletItem* SvxGetNumBulletItemByName( SfxItemPool* pPool, const ::rtl::OUString& aName ) throw();
+
+/** maps the API constant MeasureUnit to a vcl MapUnit enum.
+ Returns false if conversion is not supported.
+
+ @cl: for warnings01 I found out that this method never worked so I thin
+ it is not used at all
+sal_Bool SvxMeasureUnitToMapUnit( const short eApi, short& nVcl ) throw();
+*/
+
+/** maps the vcl MapUnit enum to a API constant MeasureUnit.
+ Returns false if conversion is not supported.
+*/
+SVX_DLLPUBLIC sal_Bool SvxMapUnitToMeasureUnit( const short nVcl, short& eApi ) throw();
+
+/** maps the API constant MeasureUnit to a vcl MapUnit enum.
+ Returns false if conversion is not supported.
+*/
+SVX_DLLPUBLIC sal_Bool SvxMeasureUnitToFieldUnit( const short eApi, short& nVcl ) throw();
+
+/** maps the vcl MapUnit enum to a API constant MeasureUnit.
+ Returns false if conversion is not supported.
+*/
+SVX_DLLPUBLIC sal_Bool SvxFieldUnitToMeasureUnit( const short nVcl, short& eApi ) throw();
+
+/** if the given name is a predefined name for the current language it is replaced by
+ the corresponding api name.
+*/
+SVX_DLLPUBLIC void SvxUnogetApiNameForItem( const sal_Int16 nWhich, const String& rInternalName, rtl::OUString& rApiName ) throw();
+
+/** if the given name is a predefined api name it is replaced by the predefined name
+ for the current language.
+*/
+SVX_DLLPUBLIC void SvxUnogetInternalNameForItem( const sal_Int16 nWhich, const rtl::OUString& rApiName, String& rInternalName ) throw();
+
+#endif // _SVX_UNOAPI_HXX_
+
diff --git a/svx/inc/svx/unofill.hxx b/svx/inc/svx/unofill.hxx
new file mode 100644
index 000000000000..8c1a196b00d7
--- /dev/null
+++ b/svx/inc/svx/unofill.hxx
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_UNOFILL_HXX_
+#define _SVX_UNOFILL_HXX_
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include "svx/svxdllapi.h"
+
+class SdrModel;
+
+SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvxUnoGradientTable_createInstance( SdrModel* pModel );
+SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvxUnoHatchTable_createInstance( SdrModel* pModel );
+SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvxUnoBitmapTable_createInstance( SdrModel* pModel );
+SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvxUnoTransGradientTable_createInstance( SdrModel* pModel );
+SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvxUnoMarkerTable_createInstance( SdrModel* pModel );
+SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvxUnoDashTable_createInstance( SdrModel* pModel );
+
+#endif // _SVX_UNOFILL_HXX_
+
diff --git a/svx/inc/svx/unomaster.hxx b/svx/inc/svx/unomaster.hxx
new file mode 100644
index 000000000000..06f716705233
--- /dev/null
+++ b/svx/inc/svx/unomaster.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_UNOMASTER_HXX
+#define _SVX_UNOMASTER_HXX
+
+#include <com/sun/star/uno/Type.h>
+#include <com/sun/star/uno/Any.h>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+
+/** this abstract class is the interface for an instance that likes to enhance
+ the functionality of components implemented with derivations from SvxShape
+
+ @see SvxShape::setMaster
+*/
+class SvxShapeMaster
+{
+public:
+ virtual sal_Bool queryAggregation( const com::sun::star::uno::Type & rType, com::sun::star::uno::Any& aAny ) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) = 0;
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) = 0;
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) = 0;
+
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException) = 0;
+ virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException) = 0;
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) = 0;
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException) = 0;
+
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) = 0;
+
+ virtual void dispose() = 0;
+
+ virtual void modelChanged( SdrModel* pNewModel ) = 0;
+ virtual void pageChanged( SdrPage* pNewPage ) = 0;
+ virtual void objectChanged( SdrObject* pNewObj ) = 0;
+};
+
+#endif
+
diff --git a/svx/inc/svx/unomid.hxx b/svx/inc/svx/unomid.hxx
new file mode 100644
index 000000000000..283a38d15bbe
--- /dev/null
+++ b/svx/inc/svx/unomid.hxx
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_UNOMID_HXX
+#define _SVX_UNOMID_HXX
+
+//AdjustItem
+#define MID_PARA_ADJUST 0
+#define MID_LAST_LINE_ADJUST 1
+#define MID_EXPAND_SINGLE 2
+
+//SvxPageItem
+#define MID_PAGE_NUMTYPE 0
+#define MID_PAGE_ORIENTATION 1
+#define MID_PAGE_LAYOUT 2
+
+//SvxMarginItem
+#define MID_MARGIN_LR_MARGIN 0
+#define MID_MARGIN_UL_MARGIN 1
+#define MID_MARGIN_L_MARGIN 2
+#define MID_MARGIN_R_MARGIN 3
+#define MID_MARGIN_UP_MARGIN 4
+#define MID_MARGIN_LO_MARGIN 5
+
+#define ALL_BORDER 10
+#define ALL_BORDER_PADDING 11
+#define LEFT_BORDER_PADDING 12
+#define RIGHT_BORDER_PADDING 13
+#define TOP_BORDER_PADDING 14
+#define BOTTOM_BORDER_PADDING 15
+#define ALL_BORDER_LINE_WIDTH 16
+#define LEFT_BORDER_LINE_WIDTH 17
+#define RIGHT_BORDER_LINE_WIDTH 18
+#define TOP_BORDER_LINE_WIDTH 19
+#define BOTTOM_BORDER_LINE_WIDTH 20
+
+// XFillBitmapItem (is also a NameOrIndex)
+#define MID_BITMAP 8
+
+// SvxHorJustifyItem
+#define MID_HORJUST_HORJUST 0
+#define MID_HORJUST_ADJUST 1
+
+// SvxZoomItem
+#define MID_VALUE 2
+
+// SvxObjectItem
+#define MID_START_X 1
+#define MID_START_Y 2
+#define MID_END_X 3
+#define MID_END_Y 4
+#define MID_LIMIT 5
+
+// SvxColumnItem
+#define MID_COLUMNARRAY 7
+#define MID_ACTUAL 4
+#define MID_TABLE 5
+#define MID_ORTHO 6
+
+// XFillGradientItem
+// Don't use 0 as it used for the whole struct
+#define MID_FILLGRADIENT 1
+#define MID_GRADIENT_STYLE 2
+#define MID_GRADIENT_STARTCOLOR 3
+#define MID_GRADIENT_ENDCOLOR 4
+#define MID_GRADIENT_ANGLE 5
+#define MID_GRADIENT_BORDER 6
+#define MID_GRADIENT_XOFFSET 7
+#define MID_GRADIENT_YOFFSET 8
+#define MID_GRADIENT_STARTINTENSITY 9
+#define MID_GRADIENT_ENDINTENSITY 10
+#define MID_GRADIENT_STEPCOUNT 11
+
+// XFillHatchItem
+// Don't use 0 as it used for the whole struct
+#define MID_FILLHATCH 1
+#define MID_HATCH_STYLE 2
+#define MID_HATCH_COLOR 3
+#define MID_HATCH_DISTANCE 4
+#define MID_HATCH_ANGLE 5
+
+// XLineDashItem
+// Don't use 0 as it used for the whole struct
+#define MID_LINEDASH 1
+#define MID_LINEDASH_STYLE 2
+#define MID_LINEDASH_DOTS 3
+#define MID_LINEDASH_DOTLEN 4
+#define MID_LINEDASH_DASHES 5
+#define MID_LINEDASH_DASHLEN 6
+#define MID_LINEDASH_DISTANCE 7
+
+#define MID_LEFT 3
+
+#endif
diff --git a/svx/inc/svx/unomod.hxx b/svx/inc/svx/unomod.hxx
new file mode 100644
index 000000000000..9b55428aa76f
--- /dev/null
+++ b/svx/inc/svx/unomod.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_UNOMOD_HXX
+#define SVX_UNOMOD_HXX
+
+#include <com/sun/star/document/EventObject.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include "svx/svxdllapi.h"
+
+class SdrHint;
+class SdrModel;
+class SdrModel;
+
+SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace > SvxCreateNumRule( SdrModel* pModel ) throw();
+
+class SVX_DLLPUBLIC SvxUnoDrawMSFactory : public ::com::sun::star::lang::XMultiServiceFactory
+{
+public:
+ SvxUnoDrawMSFactory() throw() {};
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createTextField( const ::rtl::OUString& aServiceSpecifier ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ // internal
+ ::com::sun::star::uno::Sequence< ::rtl::OUString >
+ concatServiceNames( ::com::sun::star::uno::Sequence< ::rtl::OUString >& rServices1,
+ ::com::sun::star::uno::Sequence< ::rtl::OUString >& rServices2 ) throw();
+
+ /** fills the given EventObject from the given SdrHint.
+ @returns
+ true if the SdrHint could be translated to an EventObject<br>
+ false if not
+ */
+ static sal_Bool createEvent( const SdrModel* pDoc, const SdrHint* pSdrHint, ::com::sun::star::document::EventObject& aEvent );
+};
+
+#endif
+
diff --git a/svx/inc/svx/unomodel.hxx b/svx/inc/svx/unomodel.hxx
new file mode 100644
index 000000000000..35d53a655a86
--- /dev/null
+++ b/svx/inc/svx/unomodel.hxx
@@ -0,0 +1,112 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_UNOMODEL_HXX
+#define SVX_UNOMODEL_HXX
+
+#ifndef SVX_LIGHT
+
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/ucb/XAnyCompareFactory.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <sfx2/sfxbasemodel.hxx>
+#include <svx/fmdmod.hxx>
+#include "svx/svxdllapi.h"
+
+class SdrModel;
+
+class SVX_DLLPUBLIC SvxUnoDrawingModel : public SfxBaseModel, // implements SfxListener, OWEAKOBJECT & other
+ public SvxFmMSFactory,
+ public ::com::sun::star::drawing::XDrawPagesSupplier,
+ public ::com::sun::star::lang::XServiceInfo,
+ public ::com::sun::star::ucb::XAnyCompareFactory
+{
+ friend class SvxUnoDrawPagesAccess;
+
+private:
+ SdrModel* mpDoc;
+
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::drawing::XDrawPages > mxDrawPagesAccess;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxDashTable;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxGradientTable;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxHatchTable;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxBitmapTable;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxTransGradientTable;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxMarkerTable;
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence;
+
+public:
+ SvxUnoDrawingModel( SdrModel* pDoc ) throw();
+ virtual ~SvxUnoDrawingModel() throw();
+
+ SdrModel* GetDoc() const { return mpDoc; }
+
+ // 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();
+
+ // XModel
+ virtual void SAL_CALL lockControllers( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL unlockControllers( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasControllersLocked( ) 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 ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XDrawPagesSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPages > SAL_CALL getDrawPages( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XMultiServiceFactory ( SvxFmMSFactory )
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ // XAnyCompareFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompare > SAL_CALL createAnyCompareByName( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const com::sun::star::uno::Reference<com::sun::star::io::XOutputStream>& xOut );
+SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const com::sun::star::uno::Reference<com::sun::star::io::XOutputStream>& xOut, const com::sun::star::uno::Reference< com::sun::star::lang::XComponent >& xComponent );
+SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const com::sun::star::uno::Reference<com::sun::star::io::XOutputStream>& xOut, const com::sun::star::uno::Reference< com::sun::star::lang::XComponent >& xComponent, const char* pExportService );
+SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream );
+SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream, const com::sun::star::uno::Reference< com::sun::star::lang::XComponent >& xComponent );
+SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xInputStream, const com::sun::star::uno::Reference< com::sun::star::lang::XComponent >& xComponent, const char* pImportService );
+
+#endif
+
+#endif
+
diff --git a/svx/inc/svx/unopage.hxx b/svx/inc/svx/unopage.hxx
new file mode 100644
index 000000000000..5c227112342b
--- /dev/null
+++ b/svx/inc/svx/unopage.hxx
@@ -0,0 +1,160 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_UNOWPAGE_HXX
+#define _SVX_UNOWPAGE_HXX
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/drawing/XShapeGrouper.hpp>
+#include <com/sun/star/drawing/XShapeCombiner.hpp>
+#include <com/sun/star/drawing/XShapeBinder.hpp>
+#ifndef _COM_SUN_STAR_UNO_XUNOTUNNEL_HPP_
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#endif
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/weakagg.hxx>
+#include <svl/lstner.hxx>
+#include <editeng/mutxhelp.hxx>
+#include "svx/svxdllapi.h"
+
+#include <cppuhelper/implbase5.hxx>
+#include <comphelper/servicehelper.hxx>
+
+#include <svx/unoprov.hxx>
+
+class SdrPage;
+class SdrModel;
+class SdrView;
+class SdrPageView;
+class SdrObject;
+class List;
+class SvxShapeDescriptor;
+class SvxShape;
+class SvxShapeGroup;
+class SvxShapeConnector;
+class SvxShapeList;
+class SvxDrawPageList;
+
+/***********************************************************************
+* Macros fuer Umrechnung Twips<->100tel mm *
+***********************************************************************/
+#define TWIPS_TO_MM(val) ((val * 127 + 36) / 72)
+#define MM_TO_TWIPS(val) ((val * 72 + 63) / 127)
+
+/***********************************************************************
+* *
+***********************************************************************/
+class SVX_DLLPUBLIC SvxDrawPage : public ::cppu::WeakAggImplHelper5< ::com::sun::star::drawing::XDrawPage,
+ ::com::sun::star::drawing::XShapeGrouper,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XUnoTunnel,
+ ::com::sun::star::lang::XComponent>,
+ public SfxListener,
+ protected SvxMutexHelper
+{
+ protected:
+ cppu::OBroadcastHelper mrBHelper;
+
+ SdrPage* mpPage;
+ SdrModel* mpModel;
+ SdrView* mpView;
+
+ void _SelectObjectsInView( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& aShapes, SdrPageView* pPageView ) throw ();
+ void _SelectObjectInView( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, SdrPageView* pPageView ) throw();
+
+ virtual void disposing() throw();
+
+ public:
+ SvxDrawPage( SdrPage* pPage ) throw();
+ SvxDrawPage() throw();
+ virtual ~SvxDrawPage() throw();
+
+ // Internals
+ SdrPage* GetSdrPage() const { return mpPage; }
+ void ChangeModel( SdrModel* pNewModel );
+
+ // Erzeugen eines SdrObjects und Einfugen in die SdrPage
+ SdrObject *CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw();
+
+ // Typ und Inventor bestimmen
+ void GetTypeAndInventor( sal_uInt16& rType, sal_uInt32& rInventor, const ::rtl::OUString& aName ) const throw();
+
+ // Erzeugen eines SdrObjects anhand einer Description. Kann von
+ // abgeleiteten Klassen dazu benutzt werden, eigene Shapes zu
+ // unterstuetzen (z.B. Controls)
+ virtual SdrObject *_CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw();
+
+ static SvxShape* CreateShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt32 nInventor, SdrObject *pObj = NULL, SvxDrawPage *pPage = NULL ) throw();
+
+ // Die folgende Methode wird gerufen, wenn ein SvxShape-Objekt angelegt
+ // werden soll. abgeleitete Klassen koennen hier eine Ableitung oder
+ // ein ein SvxShape aggregierenden Objekt anlegen.
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > _CreateShape( SdrObject *pObj ) const throw();
+
+ static SvxDrawPage* GetPageForSdrPage( SdrPage* pPage ) throw();
+
+ UNO3_GETIMPLEMENTATION_DECL( SvxDrawPage )
+
+ // SfxListener
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ // XInterface
+ virtual void SAL_CALL release() throw();
+
+ // XShapes
+ virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ;
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XShapeGrouper
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGroup > SAL_CALL group( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL ungroup( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGroup >& aGroup ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+#endif
+
diff --git a/svx/inc/svx/unopool.hxx b/svx/inc/svx/unopool.hxx
new file mode 100644
index 000000000000..c34105efb448
--- /dev/null
+++ b/svx/inc/svx/unopool.hxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_UNOPOOL_HXX_
+#define _SVX_UNOPOOL_HXX_
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <comphelper/propertysethelper.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include "svx/svxdllapi.h"
+
+class SdrModel;
+class SfxItemPool;
+
+/** This class implements the service com.sun.star.drawing.Defaults.
+ It works on the SfxItemPool from the given model and the global
+ draw object item pool.
+ The class can work in a read only mode without a model. Derivated
+ classes can set a model on demand by overiding getModelPool().
+*/
+class SVX_DLLPUBLIC SvxUnoDrawPool : public ::cppu::OWeakAggObject,
+ public ::com::sun::star::lang::XServiceInfo,
+ public ::com::sun::star::lang::XTypeProvider,
+ public comphelper::PropertySetHelper
+{
+public:
+ SvxUnoDrawPool( SdrModel* pModel, sal_Int32 nServiceId ) throw();
+
+ /** deprecated */
+ SvxUnoDrawPool( SdrModel* pModel ) throw();
+ virtual ~SvxUnoDrawPool() throw();
+
+ /** This returns the item pool from the given model, or the default pool if there is no model and bReadOnly is true.
+ If bReadOnly is false and there is no model the default implementation returns NULL.
+ */
+ virtual SfxItemPool* getModelPool( sal_Bool bReadOnly ) throw();
+
+ // overiden helpers from comphelper::PropertySetHelper
+ virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
+ virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::uno::Any* pValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException );
+
+ virtual void _getPropertyStates( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::beans::PropertyState* pStates ) throw(::com::sun::star::beans::UnknownPropertyException );
+ virtual void _setPropertyToDefault( const comphelper::PropertyMapEntry* pEntry ) throw(::com::sun::star::beans::UnknownPropertyException );
+ virtual ::com::sun::star::uno::Any _getPropertyDefault( const comphelper::PropertyMapEntry* pEntry ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException );
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ 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);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
+
+protected:
+ void init();
+
+ virtual void getAny( SfxItemPool* pPool, const comphelper::PropertyMapEntry* pEntry, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException);
+ virtual void putAny( SfxItemPool* pPool, const comphelper::PropertyMapEntry* pEntry, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::IllegalArgumentException);
+
+protected:
+ SdrModel* mpModel;
+ SfxItemPool* mpDefaultsPool;
+};
+
+#endif
diff --git a/svx/inc/svx/unoprov.hxx b/svx/inc/svx/unoprov.hxx
new file mode 100644
index 000000000000..92b04c659f19
--- /dev/null
+++ b/svx/inc/svx/unoprov.hxx
@@ -0,0 +1,149 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_UNOPROV_HXX
+#define SVX_UNOPROV_HXX
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <svl/itemprop.hxx>
+#include <tools/list.hxx>
+#include "svx/svxdllapi.h"
+
+class SvxItemPropertySet;
+class SfxItemPool;
+
+/***********************************************************************
+* class UHashMap *
+***********************************************************************/
+
+struct UHashMapEntry
+{
+ ::rtl::OUString aIdentifier;
+ sal_uInt32 nId;
+
+ UHashMapEntry(const sal_Char * value, sal_Int32 length, sal_uInt32 _nId) : aIdentifier(value,length,RTL_TEXTENCODING_ASCII_US), nId(_nId) { }
+};
+
+DECLARE_LIST( UHashMapEntryList, UHashMapEntry* )
+
+#define HASHARRAYSIZE 0x10
+#define UHASHMAP_NOTFOUND sal::static_int_cast< sal_uInt32 >(~0)
+
+class UHashMap
+{
+private:
+ UHashMapEntryList m_aHashList[HASHARRAYSIZE];
+
+public:
+ UHashMap( UHashMapEntry* pMap );
+ ~UHashMap() {};
+
+ sal_uInt32 getId( const ::rtl::OUString& rCompareString );
+};
+
+/***********************************************************************
+* Soriterer *
+***********************************************************************/
+
+#define SVXMAP_SHAPE 0
+#define SVXMAP_CONNECTOR 1
+#define SVXMAP_DIMENSIONING 2
+#define SVXMAP_CIRCLE 3
+#define SVXMAP_POLYPOLYGON 4
+#define SVXMAP_POLYPOLYGONBEZIER 5
+#define SVXMAP_GRAPHICOBJECT 6
+#define SVXMAP_3DSCENEOBJECT 7
+#define SVXMAP_3DCUBEOBJEKT 8
+#define SVXMAP_3DSPHEREOBJECT 9
+#define SVXMAP_3DLATHEOBJECT 10
+#define SVXMAP_3DEXTRUDEOBJECT 11
+#define SVXMAP_3DPOLYGONOBJECT 12
+#define SVXMAP_ALL 13
+#define SVXMAP_GROUP 14
+#define SVXMAP_CAPTION 15
+#define SVXMAP_OLE2 16
+#define SVXMAP_PLUGIN 17
+#define SVXMAP_FRAME 18
+#define SVXMAP_APPLET 19
+#define SVXMAP_CONTROL 20
+#define SVXMAP_TEXT 21
+#define SVXMAP_CUSTOMSHAPE 22
+#define SVXMAP_MEDIA 23
+#define SVXMAP_TABLE 24
+#define SVXMAP_PAGE 25
+#define SVXMAP_END 26 // last+1 !
+/***********************************************************************
+* SvxUnoPropertyMapProvider *
+***********************************************************************/
+class SVX_DLLPUBLIC SvxUnoPropertyMapProvider
+{
+ SfxItemPropertyMapEntry* aMapArr[SVXMAP_END];
+ SvxItemPropertySet* aSetArr[SVXMAP_END];
+// void Sort(sal_uInt16 nId);
+public:
+ SvxUnoPropertyMapProvider();
+ ~SvxUnoPropertyMapProvider();
+ const SfxItemPropertyMapEntry* GetMap(sal_uInt16 nPropertyId);
+ const SvxItemPropertySet* GetPropertySet(sal_uInt16 nPropertyId, SfxItemPool& rPool);
+};
+
+/***********************************************************************
+* Globals *
+***********************************************************************/
+
+const sal_Int16 OBJ_OLE2_APPLET = 100;
+const sal_Int16 OBJ_OLE2_PLUGIN = 101;
+
+extern SvxUnoPropertyMapProvider aSvxMapProvider;
+extern UHashMapEntry pSdrShapeIdentifierMap[];
+extern UHashMap aSdrShapeIdentifierMap;
+
+#define E3D_INVENTOR_FLAG (0x80000000)
+
+#include <editeng/unoipset.hxx>
+
+/***********************************************************************
+* class SvxPropertySetInfoPool *
+***********************************************************************/
+
+const sal_Int32 SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS = 0;
+const sal_Int32 SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS_WRITER = 1;
+const sal_Int32 SVXUNO_SERVICEID_LASTID = 1;
+
+namespace comphelper { class PropertySetInfo; }
+
+class SvxPropertySetInfoPool
+{
+public:
+ SVX_DLLPUBLIC static comphelper::PropertySetInfo* getOrCreate( sal_Int32 nServiceId ) throw();
+
+private:
+ static comphelper::PropertySetInfo* mpInfos[SVXUNO_SERVICEID_LASTID+1];
+};
+
+#endif
+
diff --git a/svx/inc/svx/unoshape.hxx b/svx/inc/svx/unoshape.hxx
new file mode 100644
index 000000000000..13154829eb4a
--- /dev/null
+++ b/svx/inc/svx/unoshape.hxx
@@ -0,0 +1,892 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_UNOSHAPE_HXX
+#define _SVX_UNOSHAPE_HXX
+
+#include <com/sun/star/document/XActionLockable.hpp>
+#include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
+#include <com/sun/star/drawing/XGluePointsSupplier.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XAggregation.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/drawing/PolygonKind.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XMultiPropertyStates.hpp>
+#include <tools/gen.hxx>
+#include <tools/weakbase.hxx>
+#include <svl/lstner.hxx>
+#include <editeng/unoipset.hxx>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/weakagg.hxx>
+#include <cppuhelper/interfacecontainer.h>
+#include <osl/mutex.hxx>
+#include "svx/svxdllapi.h"
+#include <rtl/ref.hxx>
+#include <com/sun/star/uno/Any.hxx>
+
+#include <svx/svdouno.hxx>
+
+#include <comphelper/servicehelper.hxx>
+
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase12.hxx>
+
+#include <svx/unoprov.hxx>
+
+class SfxItemSet;
+class SdrModel;
+class SvxDrawPage;
+class SvGlobalName;
+// --> OD 2009-01-16 #i59051#
+namespace basegfx
+ {
+ class B2DPolyPolygon;
+ } // end of namespace basegfx
+// <--
+
+class SvxShapeMutex
+{
+protected:
+ ::osl::Mutex maMutex;
+};
+
+struct SvxShapeImpl;
+class SvxShapeMaster;
+class SvxItemPropertySet;
+class SvxItemPropertySimpleEntry;
+class SfxItemSet;
+
+void SVX_DLLPUBLIC SvxItemPropertySet_setPropertyValue( const SvxItemPropertySet& rPropSet, const SfxItemPropertySimpleEntry* pMap,
+ const com::sun::star::uno::Any& rVal, SfxItemSet& rSet );
+
+com::sun::star::uno::Any SVX_DLLPUBLIC SvxItemPropertySet_getPropertyValue( const SvxItemPropertySet& rPropSet, const SfxItemPropertySimpleEntry* pMap, const SfxItemSet& rSet );
+
+
+// WARNING: if you update the supported interfaces,
+// also update SvxShape::_getTypes()
+typedef ::cppu::WeakAggImplHelper12<
+ ::com::sun::star::drawing::XShape,
+ ::com::sun::star::lang::XComponent,
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::beans::XMultiPropertySet,
+ ::com::sun::star::beans::XPropertyState,
+ ::com::sun::star::lang::XUnoTunnel,
+ ::com::sun::star::container::XNamed,
+ ::com::sun::star::drawing::XGluePointsSupplier,
+ ::com::sun::star::container::XChild,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::document::XActionLockable,
+ ::com::sun::star::beans::XMultiPropertyStates> SvxShape_UnoImplHelper;
+
+class SVX_DLLPUBLIC SvxShape : public SvxShape_UnoImplHelper,
+ public SfxListener,
+ public SvxShapeMutex
+{
+private:
+ ::com::sun::star::awt::Size maSize;
+ ::com::sun::star::awt::Point maPosition;
+ ::rtl::OUString maShapeType;
+ ::rtl::OUString maShapeName;
+
+ /** these members are used to optimize XMultiProperty calls */
+ SvxShapeImpl* mpImpl;
+ bool mbIsMultiPropertyCall;
+
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::container::XIndexContainer > mxGluePoints;
+
+protected:
+ friend class SvxDrawPage;
+ friend class SvxShapeConnector;
+ friend class SdXShape;
+
+ const SvxItemPropertySet* mpPropSet;
+ const SfxItemPropertyMapEntry* maPropMapEntries;
+
+ ::tools::WeakReference< SdrObject > mpObj;
+ SdrModel* mpModel;
+ // Umrechnungen fuer den Writer, der in TWIPS arbeitet
+ void ForceMetricToItemPoolMetric(Pair& rPoint) const throw();
+ void ForceMetricTo100th_mm(Pair& rPoint) const throw();
+ // --> OD 2009-01-16 #i59051#
+ void ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon) const throw();
+ void ForceMetricTo100th_mm(basegfx::B2DPolyPolygon& rPolyPolygon) const throw();
+ // <--
+
+ ::com::sun::star::uno::Any GetAnyForItem( SfxItemSet& aSet, const SfxItemPropertySimpleEntry* pMap ) const;
+
+ sal_Bool tryQueryAggregation( const com::sun::star::uno::Type & rType, com::sun::star::uno::Any& rAny );
+
+ sal_Bool SAL_CALL SetFillAttribute( sal_Int32 nWID, const ::rtl::OUString& rName );
+
+ /** called from the XActionLockable interface methods on initial locking */
+ virtual void lock();
+
+ /** called from the XActionLockable interface methods on final unlock */
+ virtual void unlock();
+
+ /** used from the XActionLockable interface */
+ sal_uInt16 mnLockCount;
+
+ const SfxItemPropertyMapEntry* getPropertyMapEntries() const { return maPropMapEntries; }
+
+ void updateShapeKind();
+ void endSetPropertyValues();
+
+ // overide these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual bool getPropertyStateImpl( const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::beans::PropertyState& rState ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual bool setPropertyToDefaultImpl( const SfxItemPropertySimpleEntry* pProperty ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
+public:
+ SvxShape( SdrObject* pObj ) throw ();
+ SvxShape( SdrObject* pObject, const SfxItemPropertyMapEntry* pEntries, const SvxItemPropertySet* pPropertySet ) throw ();
+ SvxShape() throw ();
+ virtual ~SvxShape() throw ();
+
+ // Internals
+ void ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet);
+ virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage = NULL );
+ /** takes the ownership of the SdrObject.
+
+ When the shape is disposed, and it has the ownership of its associated SdrObject, then
+ it will delete this object.
+ */
+ void TakeSdrObjectOwnership();
+ bool HasSdrObjectOwnership() const;
+
+ void ChangeModel( SdrModel* pNewModel );
+
+ void InvalidateSdrObject() { mpObj.reset( NULL ); };
+ const SvxItemPropertySet& GetPropertySet() { return *mpPropSet; }
+ SdrObject* GetSdrObject() const {return mpObj.get();}
+ void SetShapeType( const ::rtl::OUString& ShapeType ) { maShapeType = ShapeType; }
+ ::com::sun::star::uno::Any GetBitmap( sal_Bool bMetaFile = sal_False ) const throw ();
+ static SvxShape* GetShapeForSdrObj( SdrObject* pObj ) throw ();
+
+ ::svx::PropertyChangeNotifier& getShapePropertyChangeNotifier();
+
+ void setShapeKind( sal_uInt32 nKind );
+ sal_uInt32 getShapeKind() const;
+
+ // styles need this
+ static sal_Bool SAL_CALL SetFillAttribute( sal_Int32 nWID, const ::rtl::OUString& rName, SfxItemSet& rSet, SdrModel* pModel );
+ static sal_Bool SAL_CALL SetFillAttribute( sal_Int32 nWID, const ::rtl::OUString& rName, SfxItemSet& rSet );
+
+ /** same as SetFillAttribute but for property names instead of which ids,
+ and the property found is returned instead of set at the object
+ directly.
+ */
+// os: unused function
+// static ::com::sun::star::uno::Any SAL_CALL GetFillAttributeByName(
+// const ::rtl::OUString& rPropertyName, const ::rtl::OUString& rName, SdrModel* pModel );
+
+ UNO3_GETIMPLEMENTATION_DECL( SvxShape )
+
+ // access methods for master objects
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL _getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL _setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL _getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ ::com::sun::star::beans::PropertyState SAL_CALL _getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL _setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL _getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL _getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+
+ void setMaster( SvxShapeMaster* pMaster );
+ const SvxShapeMaster* getMaster() const;
+ SvxShapeMaster* getMaster();
+
+ // SfxListener
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) throw ();
+
+
+ /** @obsolete
+ not used anymore
+ */
+ virtual void onUserCall(SdrUserCallType eUserCall, const Rectangle& rBoundRect);
+
+ // XAggregation
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XNamed
+ virtual ::rtl::OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XShapeDescriptor
+ virtual ::rtl::OUString SAL_CALL getShapeType() throw(::com::sun::star::uno::RuntimeException);
+
+ // XShape
+ virtual ::com::sun::star::awt::Point SAL_CALL getPosition() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) 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);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XMultiPropertySet
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XMultiPropertyStates
+ virtual void SAL_CALL setAllPropertiesToDefault()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertiesToDefault(
+ const ::com::sun::star::uno::Sequence<
+ ::rtl::OUString >& aPropertyNames )
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+ SAL_CALL getPropertyDefaults(
+ const ::com::sun::star::uno::Sequence<
+ ::rtl::OUString >& aPropertyNames )
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XGluePointsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > SAL_CALL getGluePoints( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XChild
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw(::com::sun::star::lang::NoSupportException, ::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 ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XActionLockable
+ virtual sal_Bool SAL_CALL isActionLocked( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addActionLock( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeActionLock( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setActionLocks( sal_Int16 nLock ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL resetActionLocks( ) throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ /** initializes SdrObj-dependent members. Only to be called when GetSdrObject() != NULL
+ */
+ SVX_DLLPRIVATE void impl_initFromSdrObject();
+ /// CTOR-Impl
+ SVX_DLLPRIVATE void impl_construct();
+};
+
+#include <editeng/unotext.hxx>
+
+class SVX_DLLPUBLIC SvxShapeText : public SvxShape, public SvxUnoTextBase
+{
+protected:
+ /** called from the XActionLockable interface methods on initial locking */
+ virtual void lock();
+
+ /** called from the XActionLockable interface methods on final unlock */
+ virtual void unlock();
+
+protected:
+ using SvxUnoTextRangeBase::setPropertyValue;
+ using SvxUnoTextRangeBase::getPropertyValue;
+
+ // overide these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual bool getPropertyStateImpl( const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::beans::PropertyState& rState ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual bool setPropertyToDefaultImpl( const SfxItemPropertySimpleEntry* pProperty ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
+public:
+ SvxShapeText() throw ();
+ SvxShapeText( SdrObject* pObj ) throw ();
+ SvxShapeText( SdrObject* pObject, const SfxItemPropertyMapEntry* pPropertyMap, const SvxItemPropertySet* pPropertySet ) throw ();
+ virtual ~SvxShapeText() throw ();
+
+ virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage = NULL );
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ 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();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::text::XTextRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getStart() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setString( const ::rtl::OUString& aString ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) 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 ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+class SvxShapeRect : public SvxShapeText
+{
+public:
+ SvxShapeRect( SdrObject* pObj ) throw ();
+ virtual ~SvxShapeRect() throw ();
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ 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();
+
+ // XServiceInfo
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+};
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/drawing/XShapeGroup.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+
+/***********************************************************************
+* *
+***********************************************************************/
+class SvxShapeGroup : public SvxShape,
+ public ::com::sun::star::drawing::XShapeGroup,
+ public ::com::sun::star::drawing::XShapes
+{
+private:
+ rtl::Reference< SvxDrawPage> mxPage;
+
+public:
+ SvxShapeGroup( SdrObject* pObj,SvxDrawPage* pDrawPage ) throw ();
+ virtual ~SvxShapeGroup() throw ();
+
+ virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage = NULL );
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ 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();
+
+ // XShapes
+ virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ;
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XShapeDescriptor
+ virtual ::rtl::OUString SAL_CALL getShapeType() throw(::com::sun::star::uno::RuntimeException);
+
+ // XShape
+ virtual ::com::sun::star::awt::Point SAL_CALL getPosition() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
+
+ // XShapeGroup
+ virtual void SAL_CALL enterGroup( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL leaveGroup( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() 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 ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+};
+#include <com/sun/star/drawing/XConnectorShape.hpp>
+
+/***********************************************************************
+* *
+***********************************************************************/
+class SvxShapeConnector : public ::com::sun::star::drawing::XConnectorShape,
+ public SvxShapeText
+{
+public:
+ SvxShapeConnector( SdrObject* pObj ) throw();
+ virtual ~SvxShapeConnector() throw();
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ 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();
+
+ // XShapeDescriptor
+ virtual ::rtl::OUString SAL_CALL getShapeType() throw(::com::sun::star::uno::RuntimeException);
+
+ // XShape
+ virtual ::com::sun::star::awt::Point SAL_CALL getPosition() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
+
+ // XConnectorShape
+ virtual void SAL_CALL connectStart( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XConnectableShape >& xShape, ::com::sun::star::drawing::ConnectionType nPos ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL connectEnd( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XConnectableShape >& xShape, ::com::sun::star::drawing::ConnectionType nPos ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL disconnectBegin( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XConnectableShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL disconnectEnd( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XConnectableShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() 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 ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+};
+#include <com/sun/star/drawing/XControlShape.hpp>
+
+/***********************************************************************
+* *
+***********************************************************************/
+class SVX_DLLPUBLIC SvxShapeControl : public ::com::sun::star::drawing::XControlShape, public SvxShapeText
+{
+protected:
+ using SvxUnoTextRangeBase::setPropertyValue;
+ using SvxUnoTextRangeBase::getPropertyValue;
+
+public:
+ SvxShapeControl( SdrObject* pObj ) throw();
+ virtual ~SvxShapeControl() throw();
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ 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();
+
+ // XPropertySet
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XShapeDescriptor
+ virtual ::rtl::OUString SAL_CALL getShapeType() throw(::com::sun::star::uno::RuntimeException);
+
+ // XShape
+ virtual ::com::sun::star::awt::Point SAL_CALL getPosition() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
+
+ // XControlShape
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > SAL_CALL getControl() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& xControl ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() 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 ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+class SvxShapeDimensioning : public SvxShapeText
+{
+public:
+ SvxShapeDimensioning( SdrObject* pObj ) throw();
+ virtual ~SvxShapeDimensioning() throw();
+
+ // XServiceInfo
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+class SvxShapeCircle : public SvxShapeText
+{
+public:
+ SvxShapeCircle( SdrObject* pObj ) throw ();
+ virtual ~SvxShapeCircle() throw ();
+
+ // XServiceInfo
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+class SVX_DLLPUBLIC SvxOle2Shape : public SvxShape
+{
+protected:
+// overide these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ void resetModifiedState();
+
+ const SvGlobalName GetClassName_Impl(rtl::OUString& rHexCLSID);
+public:
+ SvxOle2Shape( SdrObject* pObj ) throw();
+ SvxOle2Shape( SdrObject* pObject, const SfxItemPropertyMapEntry* pPropertyMap, const SvxItemPropertySet* pPropertySet ) throw ();
+ virtual ~SvxOle2Shape() throw();
+
+ sal_Bool createObject( const SvGlobalName &aClassName );
+
+ sal_Bool createLink( const ::rtl::OUString& aLinkURL );
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+/***********************************************************************
+* *
+***********************************************************************/
+class SvxShapePolyPolygon : public SvxShapeText
+{
+private:
+ ::com::sun::star::drawing::PolygonKind mePolygonKind;
+
+protected:
+ using SvxUnoTextRangeBase::setPropertyValue;
+ using SvxUnoTextRangeBase::getPropertyValue;
+
+ // overide these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+public:
+ SvxShapePolyPolygon( SdrObject* pObj , ::com::sun::star::drawing::PolygonKind eNew = com::sun::star::drawing::PolygonKind_LINE ) throw(com::sun::star::lang::IllegalArgumentException, com::sun::star::beans::PropertyVetoException);
+ virtual ~SvxShapePolyPolygon() throw();
+
+ // Local support functions
+ ::com::sun::star::drawing::PolygonKind GetPolygonKind() const throw();
+ void SetPolygon(const basegfx::B2DPolyPolygon& rNew) throw();
+ basegfx::B2DPolyPolygon GetPolygon() const throw();
+
+ // XServiceInfo
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+class SvxShapePolyPolygonBezier : public SvxShapeText
+{
+private:
+ ::com::sun::star::drawing::PolygonKind mePolygonKind;
+
+protected:
+ using SvxUnoTextRangeBase::setPropertyValue;
+ using SvxUnoTextRangeBase::getPropertyValue;
+
+public:
+ // overide these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ SvxShapePolyPolygonBezier( SdrObject* pObj , ::com::sun::star::drawing::PolygonKind eNew = com::sun::star::drawing::PolygonKind_PATHLINE) throw();
+ virtual ~SvxShapePolyPolygonBezier() throw();
+
+ // Local support functions
+ ::com::sun::star::drawing::PolygonKind GetPolygonKind() const throw();
+ void SetPolygon(const basegfx::B2DPolyPolygon & rNew) throw();
+ basegfx::B2DPolyPolygon GetPolygon() const throw();
+
+ // XServiceInfo
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+class SvxGraphicObject : public SvxShapeText
+{
+protected:
+ using SvxUnoTextRangeBase::setPropertyValue;
+ using SvxUnoTextRangeBase::getPropertyValue;
+
+ // overide these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+public:
+ SvxGraphicObject( SdrObject* pObj ) throw();
+ virtual ~SvxGraphicObject() throw();
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+class Svx3DSceneObject : public ::com::sun::star::drawing::XShapes, public SvxShape
+{
+private:
+ rtl::Reference< SvxDrawPage > mxPage;
+
+protected:
+ using SvxShape::setPropertyValue;
+ using SvxShape::getPropertyValue;
+
+public:
+ Svx3DSceneObject( SdrObject* pObj, SvxDrawPage* pDrawPage ) throw();
+ // overide these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ~Svx3DSceneObject() throw();
+
+ virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage = NULL );
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ 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();
+
+ // XShapes
+ virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount( ) throw(::com::sun::star::uno::RuntimeException) ;
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() 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 ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+class Svx3DCubeObject : public SvxShape
+{
+protected:
+ // overide these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+public:
+ Svx3DCubeObject( SdrObject* pObj ) throw();
+ virtual ~Svx3DCubeObject() throw();
+
+ // XServiceInfo
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+class Svx3DSphereObject : public SvxShape
+{
+public:
+ Svx3DSphereObject( SdrObject* pObj ) throw();
+protected:
+ // overide these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ~Svx3DSphereObject() throw();
+
+ // XServiceInfo
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+class Svx3DLatheObject : public SvxShape
+{
+protected:
+ // overide these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+public:
+ Svx3DLatheObject( SdrObject* pObj ) throw();
+ virtual ~Svx3DLatheObject() throw();
+
+ // XServiceInfo
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+class Svx3DExtrudeObject : public SvxShape
+{
+public:
+ Svx3DExtrudeObject( SdrObject* pObj ) throw();
+protected:
+ // overide these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ~Svx3DExtrudeObject() throw();
+
+ // XServiceInfo
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+class Svx3DPolygonObject : public SvxShape
+{
+protected:
+ // overide these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+public:
+ Svx3DPolygonObject( SdrObject* pObj ) throw();
+ virtual ~Svx3DPolygonObject() throw();
+
+ // XServiceInfo
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+typedef ::cppu::WeakAggImplHelper1<
+ ::com::sun::star::drawing::XEnhancedCustomShapeDefaulter
+ > SvxShape_UnoImplHelper1;
+
+class SVX_DLLPUBLIC SvxCustomShape : public SvxShapeText, public SvxShape_UnoImplHelper1
+{
+private:
+ rtl::Reference< SvxDrawPage > mxPage;
+
+protected:
+ using SvxUnoTextRangeBase::setPropertyValue;
+ using SvxUnoTextRangeBase::getPropertyValue;
+
+public:
+ SvxCustomShape( SdrObject* pObj ) throw ();
+ // overide these for special property handling in subcasses. Return true if property is handled
+ //virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertyMapEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+
+ virtual ~SvxCustomShape() throw ();
+
+ virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage = NULL );
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ 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();
+
+ // XShapeDescriptor
+ virtual ::rtl::OUString SAL_CALL getShapeType() throw(::com::sun::star::uno::RuntimeException);
+
+ // XShape
+ virtual ::com::sun::star::awt::Point SAL_CALL getPosition() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
+ void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, com::sun::star::beans::PropertyVetoException, com::sun::star::lang::IllegalArgumentException);
+
+ // XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XEnhancedCustomShapeDefaulter
+ virtual void SAL_CALL createCustomShapeDefaults( const rtl::OUString& rShapeType ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+class SvxMediaShape : public SvxShape
+{
+public:
+ SvxMediaShape( SdrObject* pObj ) throw();
+ virtual ~SvxMediaShape() throw();
+
+protected:
+ // overide these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+};
+
+#endif
diff --git a/svx/inc/svx/unoshcol.hxx b/svx/inc/svx/unoshcol.hxx
new file mode 100644
index 000000000000..422f6fc24029
--- /dev/null
+++ b/svx/inc/svx/unoshcol.hxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_UNOSHGRP_HXX
+#define _SVX_UNOSHGRP_HXX
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <osl/mutex.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+
+#include <cppuhelper/implbase3.hxx>
+#include "svx/svxdllapi.h"
+
+class XShapeList;
+
+class SvxShapeCollectionMutex
+{
+public:
+ ::osl::Mutex maMutex;
+};
+
+SVX_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SvxShapeCollection_NewInstance() throw();
+
+/***********************************************************************
+* *
+***********************************************************************/
+class SVX_DLLPUBLIC SvxShapeCollection : public ::cppu::WeakAggImplHelper3<
+ ::com::sun::star::drawing::XShapes,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XComponent
+ >,
+ public SvxShapeCollectionMutex
+{
+private:
+ cppu::OInterfaceContainerHelper maShapeContainer;
+
+ cppu::OBroadcastHelper mrBHelper;
+
+ SVX_DLLPRIVATE virtual void disposing() throw();
+
+public:
+ SvxShapeCollection() throw();
+ virtual ~SvxShapeCollection() throw();
+
+ // XInterface
+ virtual void SAL_CALL release() throw();
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ;
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
+
+ // XShapes
+ virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+ static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static();
+ static ::rtl::OUString getImplementationName_Static();
+};
+
+::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SvxShapeCollection_createInstance( const com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSMgr );
+#endif
+
+
diff --git a/svx/inc/svx/unoshprp.hxx b/svx/inc/svx/unoshprp.hxx
new file mode 100644
index 000000000000..232708d9a14a
--- /dev/null
+++ b/svx/inc/svx/unoshprp.hxx
@@ -0,0 +1,534 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_UNOSHPRP_HXX
+#define _SVX_UNOSHPRP_HXX
+
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/drawing/PointSequence.hpp>
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/drawing/RectanglePoint.hpp>
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/awt/Gradient.hpp>
+#include <com/sun/star/drawing/Hatch.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/LineDash.hpp>
+#include <com/sun/star/drawing/LineJoint.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/drawing/TextAnimationDirection.hpp>
+#include <com/sun/star/drawing/TextAnimationKind.hpp>
+#include <com/sun/star/drawing/TextFitToSizeType.hpp>
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
+#include <com/sun/star/drawing/ConnectorType.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/MeasureKind.hpp>
+#include <com/sun/star/drawing/MeasureTextHorzPos.hpp>
+#include <com/sun/star/drawing/MeasureTextVertPos.hpp>
+#include <com/sun/star/drawing/HomogenMatrix3.hpp>
+#include <com/sun/star/drawing/CircleKind.hpp>
+#include <com/sun/star/drawing/PolygonKind.hpp>
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/drawing/ColorMode.hpp>
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <com/sun/star/drawing/Position3D.hpp>
+#include <com/sun/star/drawing/NormalsKind.hpp>
+#include <com/sun/star/drawing/TextureKind.hpp>
+#include <com/sun/star/drawing/TextureMode.hpp>
+#include <com/sun/star/drawing/TextureProjectionMode.hpp>
+#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
+#include <com/sun/star/text/GraphicCrop.hpp>
+#include <com/sun/star/drawing/BitmapMode.hpp>
+#include <com/sun/star/drawing/CameraGeometry.hpp>
+#include <com/sun/star/text/WritingMode.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+
+#define _SVX_USE_UNOGLOBALS_
+#include <svx/unoprov.hxx>
+#include <editeng/unoprnms.hxx>
+#include <svx/unomid.hxx>
+#include <editeng/unotext.hxx>
+#include <svl/itemprop.hxx>
+
+#include <svx/svxids.hrc>
+
+#ifndef SEQTYPE
+ #if defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)
+ #define SEQTYPE(x) (new ::com::sun::star::uno::Type( x ))
+ #else
+ #define SEQTYPE(x) &(x)
+ #endif
+#endif
+
+#define OWN_ATTR_VALUE_START_TEXT (OWN_ATTR_VALUE_START+0) // the next 10 entries are reserved for text
+#define OWN_ATTR_VALUE_POLYGONKIND (OWN_ATTR_VALUE_START+10)
+#define OWN_ATTR_VALUE_POLYPOLYGON (OWN_ATTR_VALUE_START+11)
+#define OWN_ATTR_VALUE_POLYPOLYGONBEZIER (OWN_ATTR_VALUE_START+12)
+#define OWN_ATTR_VALUE_FILLBITMAP (OWN_ATTR_VALUE_START+13)
+#define OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX (OWN_ATTR_VALUE_START+14)
+#define OWN_ATTR_3D_VALUE_POSITION (OWN_ATTR_VALUE_START+15)
+#define OWN_ATTR_3D_VALUE_SIZE (OWN_ATTR_VALUE_START+16)
+#define OWN_ATTR_3D_VALUE_POS_IS_CENTER (OWN_ATTR_VALUE_START+17)
+#define OWN_ATTR_3D_VALUE_POLYPOLYGON3D (OWN_ATTR_VALUE_START+18)
+#define OWN_ATTR_3D_VALUE_LINEONLY (OWN_ATTR_VALUE_START+19)
+#define OWN_ATTR_BITMAP (OWN_ATTR_VALUE_START+20)
+#define OWN_ATTR_EDGE_START_OBJ (OWN_ATTR_VALUE_START+21)
+#define OWN_ATTR_EDGE_START_POS (OWN_ATTR_VALUE_START+22)
+#define OWN_ATTR_EDGE_END_OBJ (OWN_ATTR_VALUE_START+23)
+#define OWN_ATTR_EDGE_END_POS (OWN_ATTR_VALUE_START+24)
+#define OWN_ATTR_FRAMERECT (OWN_ATTR_VALUE_START+25)
+#define OWN_ATTR_VALUE_POLYGON (OWN_ATTR_VALUE_START+26)
+#define OWN_ATTR_METAFILE (OWN_ATTR_VALUE_START+27)
+#define OWN_ATTR_ISFONTWORK (OWN_ATTR_VALUE_START+28)
+#define OWN_ATTR_BOUNDRECT (OWN_ATTR_VALUE_START+29)
+#define OWN_ATTR_LDNAME (OWN_ATTR_VALUE_START+30)
+#define OWN_ATTR_LDBITMAP (OWN_ATTR_VALUE_START+31)
+#define OWN_ATTR_OLESIZE (OWN_ATTR_VALUE_START+32)
+#define OWN_ATTR_GRAFURL (OWN_ATTR_VALUE_START+33)
+#define OWN_ATTR_OLEMODEL (OWN_ATTR_VALUE_START+34)
+#define OWN_ATTR_MIRRORED (OWN_ATTR_VALUE_START+35)
+#define OWN_ATTR_CLSID (OWN_ATTR_VALUE_START+36)
+#define OWN_ATTR_GLUEID_TAIL (OWN_ATTR_VALUE_START+37)
+#define OWN_ATTR_GLUEID_HEAD (OWN_ATTR_VALUE_START+38)
+#define OWN_ATTR_ZORDER (OWN_ATTR_VALUE_START+39)
+#define OWN_ATTR_MEASURE_START_POS (OWN_ATTR_VALUE_START+40)
+#define OWN_ATTR_MEASURE_END_POS (OWN_ATTR_VALUE_START+41)
+#define OWN_ATTR_3D_VALUE_CAMERA_GEOMETRY (OWN_ATTR_VALUE_START+42)
+#define OWN_ATTR_WRITINGMODE (OWN_ATTR_VALUE_START+43)
+#define OWN_ATTR_GRAFSTREAMURL (OWN_ATTR_VALUE_START+44)
+#define OWN_ATTR_FILLBMP_MODE (OWN_ATTR_VALUE_START+45)
+#define OWN_ATTR_TRANSFORMATION (OWN_ATTR_VALUE_START+46)
+#define OWN_ATTR_BASE_GEOMETRY (OWN_ATTR_VALUE_START+47)
+
+#define OWN_ATTR_APPLET_DOCBASE (OWN_ATTR_VALUE_START+48)
+#define OWN_ATTR_APPLET_CODEBASE (OWN_ATTR_VALUE_START+49)
+#define OWN_ATTR_APPLET_NAME (OWN_ATTR_VALUE_START+50)
+#define OWN_ATTR_APPLET_CODE (OWN_ATTR_VALUE_START+51)
+#define OWN_ATTR_APPLET_COMMANDS (OWN_ATTR_VALUE_START+52)
+#define OWN_ATTR_APPLET_ISSCRIPT (OWN_ATTR_VALUE_START+53)
+#define OWN_ATTR_PLUGIN_MIMETYPE (OWN_ATTR_VALUE_START+54)
+#define OWN_ATTR_PLUGIN_URL (OWN_ATTR_VALUE_START+55)
+#define OWN_ATTR_PLUGIN_COMMANDS (OWN_ATTR_VALUE_START+56)
+#define OWN_ATTR_FRAME_URL (OWN_ATTR_VALUE_START+57)
+#define OWN_ATTR_FRAME_NAME (OWN_ATTR_VALUE_START+58)
+#define OWN_ATTR_FRAME_ISAUTOSCROLL (OWN_ATTR_VALUE_START+59)
+#define OWN_ATTR_FRAME_ISBORDER (OWN_ATTR_VALUE_START+60)
+#define OWN_ATTR_FRAME_MARGIN_WIDTH (OWN_ATTR_VALUE_START+61)
+#define OWN_ATTR_FRAME_MARGIN_HEIGHT (OWN_ATTR_VALUE_START+62)
+
+// reuse own attr from ole shapes for tables
+#define OWN_ATTR_TABLETEMPLATE (OWN_ATTR_VALUE_START+48)
+#define OWN_ATTR_TABLETEMPLATE_FIRSTROW (OWN_ATTR_VALUE_START+49)
+#define OWN_ATTR_TABLETEMPLATE_LASTROW (OWN_ATTR_VALUE_START+50)
+#define OWN_ATTR_TABLETEMPLATE_FIRSTCOLUMN (OWN_ATTR_VALUE_START+51)
+#define OWN_ATTR_TABLETEMPLATE_LASTCOLUMN (OWN_ATTR_VALUE_START+52)
+#define OWN_ATTR_TABLETEMPLATE_BANDINGROWS (OWN_ATTR_VALUE_START+53)
+#define OWN_ATTR_TABLETEMPLATE_BANDINGCOULUMNS (OWN_ATTR_VALUE_START+54)
+#define OWN_ATTR_TABLEBORDER (OWN_ATTR_VALUE_START+55)
+
+#define OWN_ATTR_OLE_VISAREA (OWN_ATTR_VALUE_START+63)
+#define OWN_ATTR_CAPTION_POINT (OWN_ATTR_VALUE_START+64)
+#define OWN_ATTR_PAGE_NUMBER (OWN_ATTR_VALUE_START+65)
+#define OWN_ATTR_THUMBNAIL (OWN_ATTR_VALUE_START+66)
+#define OWN_ATTR_PERSISTNAME (OWN_ATTR_VALUE_START+67)
+#define OWN_ATTR_OLE_EMBEDDED_OBJECT_NONEWCLIENT (OWN_ATTR_VALUE_START+68)
+#define OWN_ATTR_MEDIA_URL (OWN_ATTR_VALUE_START+69)
+#define OWN_ATTR_MEDIA_PREFERREDSIZE (OWN_ATTR_VALUE_START+70)
+#define OWN_ATTR_MEDIA_LOOP (OWN_ATTR_VALUE_START+71)
+#define OWN_ATTR_MEDIA_MUTE (OWN_ATTR_VALUE_START+72)
+#define OWN_ATTR_MEDIA_VOLUMEDB (OWN_ATTR_VALUE_START+73)
+#define OWN_ATTR_MEDIA_ZOOM (OWN_ATTR_VALUE_START+74)
+#define OWN_ATTR_UINAME_SINGULAR (OWN_ATTR_VALUE_START+75)
+#define OWN_ATTR_UINAME_PLURAL (OWN_ATTR_VALUE_START+76)
+#define OWN_ATTR_VALUE_GRAPHIC (OWN_ATTR_VALUE_START+77)
+#define OWN_ATTR_INTERNAL_OLE (OWN_ATTR_VALUE_START+78)
+#define OWN_ATTR_OLE_EMBEDDED_OBJECT (OWN_ATTR_VALUE_START+79)
+#define OWN_ATTR_OLE_ASPECT (OWN_ATTR_VALUE_START+80)
+
+// #i68101#
+#define OWN_ATTR_MISC_OBJ_TITLE (OWN_ATTR_VALUE_START+81)
+#define OWN_ATTR_MISC_OBJ_DESCRIPTION (OWN_ATTR_VALUE_START+82)
+
+#define OWN_ATTR_GRAPHIC_STREAM (OWN_ATTR_VALUE_START+83)
+#define OWN_ATTR_3D_VALUE_NORMALSPOLYGON3D (OWN_ATTR_VALUE_START+84)
+#define OWN_ATTR_3D_VALUE_TEXTUREPOLYGON3D (OWN_ATTR_VALUE_START+85)
+
+#define OWN_ATTR_OLE_LINKURL (OWN_ATTR_VALUE_START+86)
+
+#define OWN_ATTR_STYLE (OWN_ATTR_VALUE_START+87)
+
+#define OWN_ATTR_EDGE_POLYPOLYGONBEZIER (OWN_ATTR_VALUE_START+88) // maximum is OWN_ATTR_VALUE_START+88, see svl/inc/svl/solar.hrc
+
+// #FontWork#
+#define FONTWORK_PROPERTIES \
+ { MAP_CHAR_LEN("FontWorkStyle"), XATTR_FORMTXTSTYLE, /*ENUM*/&::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN("FontWorkAdjust"), XATTR_FORMTXTADJUST, /*ENUM*/&::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN("FontWorkDistance"), XATTR_FORMTXTDISTANCE, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN("FontWorkStart"), XATTR_FORMTXTSTART, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN("FontWorkMirror"), XATTR_FORMTXTMIRROR, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN("FontWorkOutline"), XATTR_FORMTXTOUTLINE, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN("FontWorkShadow"), XATTR_FORMTXTSHADOW, /*ENUM*/&::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN("FontWorkShadowColor"), XATTR_FORMTXTSHDWCOLOR, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN("FontWorkShadowOffsetX"), XATTR_FORMTXTSHDWXVAL, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN("FontWorkShadowOffsetY"), XATTR_FORMTXTSHDWYVAL, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN("FontWorkForm"), XATTR_FORMTXTSTDFORM, /*ENUM*/&::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN("FontWorkHideForm"), XATTR_FORMTXTHIDEFORM, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN("FontWorkShadowTransparence"),XATTR_FORMTXTSHDWTRANSP, &::getCppuType((const sal_Int16*)0), 0, 0},
+
+#define SHADOW_PROPERTIES \
+ { MAP_CHAR_LEN(UNO_NAME_SHADOW), SDRATTR_SHADOW, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_SHADOWCOLOR), SDRATTR_SHADOWCOLOR, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_SHADOWTRANSPARENCE),SDRATTR_SHADOWTRANSPARENCE, &::getCppuType((const sal_Int16*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_SHADOWXDIST), SDRATTR_SHADOWXDIST, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_SHADOWYDIST), SDRATTR_SHADOWYDIST, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM},
+
+#define LINE_PROPERTIES_DEFAULTS\
+ { MAP_CHAR_LEN(UNO_NAME_LINECOLOR), XATTR_LINECOLOR, &::getCppuType((const sal_Int32*)0) , 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_LINEENDCENTER), XATTR_LINEENDCENTER, &::getBooleanCppuType() , 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_LINEENDWIDTH), XATTR_LINEENDWIDTH, &::getCppuType((const sal_Int32*)0) , 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_LINEJOINT), XATTR_LINEJOINT, &::getCppuType((const ::com::sun::star::drawing::LineJoint*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_LINESTARTCENTER), XATTR_LINESTARTCENTER, &::getBooleanCppuType() , 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_LINESTARTWIDTH), XATTR_LINESTARTWIDTH, &::getCppuType((const sal_Int32*)0) , 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_LINESTYLE), XATTR_LINESTYLE, &::getCppuType((const ::com::sun::star::drawing::LineStyle*)0) , 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_LINETRANSPARENCE), XATTR_LINETRANSPARENCE, &::getCppuType((const sal_Int16*)0) , 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_LINEWIDTH), XATTR_LINEWIDTH, &::getCppuType((const sal_Int32*)0) , 0, SFX_METRIC_ITEM},
+
+#define LINE_PROPERTIES \
+ { MAP_CHAR_LEN(UNO_NAME_LINEDASH), XATTR_LINEDASH, &::getCppuType((const ::com::sun::star::drawing::LineDash*)0) , 0, MID_LINEDASH}, \
+ { MAP_CHAR_LEN("LineDashName"), XATTR_LINEDASH, &::getCppuType((const ::rtl::OUString*)0) , 0, MID_NAME}, \
+ LINE_PROPERTIES_DEFAULTS
+
+#define LINE_PROPERTIES_START_END \
+ { MAP_CHAR_LEN(UNO_NAME_LINEEND), XATTR_LINEEND, SEQTYPE(::getCppuType((const ::com::sun::star::drawing::PolyPolygonBezierCoords*)0)), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0}, \
+ { MAP_CHAR_LEN("LineEndName"), XATTR_LINEEND, &::getCppuType((const ::rtl::OUString*)0), 0, MID_NAME }, \
+ { MAP_CHAR_LEN(UNO_NAME_LINESTART), XATTR_LINESTART, SEQTYPE(::getCppuType((const ::com::sun::star::drawing::PolyPolygonBezierCoords*)0)), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0}, \
+ { MAP_CHAR_LEN("LineStartName"), XATTR_LINESTART, &::getCppuType((const ::rtl::OUString*)0), 0, MID_NAME },
+
+#define FILL_PROPERTIES_BMP \
+ { MAP_CHAR_LEN(UNO_NAME_FILLBMP_LOGICAL_SIZE), XATTR_FILLBMP_SIZELOG, &::getBooleanCppuType() , 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_FILLBMP_OFFSET_X), XATTR_FILLBMP_TILEOFFSETX, &::getCppuType((const sal_Int32*)0) , 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_FILLBMP_OFFSET_Y), XATTR_FILLBMP_TILEOFFSETY, &::getCppuType((const sal_Int32*)0) , 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_FILLBMP_POSITION_OFFSET_X), XATTR_FILLBMP_POSOFFSETX, &::getCppuType((const sal_Int32*)0) , 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_FILLBMP_POSITION_OFFSET_Y), XATTR_FILLBMP_POSOFFSETY, &::getCppuType((const sal_Int32*)0) , 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_FILLBMP_RECTANGLE_POINT), XATTR_FILLBMP_POS, &::getCppuType((const ::com::sun::star::drawing::RectanglePoint*)0) , 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_FILLBMP_SIZE_X), XATTR_FILLBMP_SIZEX, &::getCppuType((const sal_Int32*)0) , 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_FILLBMP_SIZE_Y), XATTR_FILLBMP_SIZEY, &::getCppuType((const sal_Int32*)0) , 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_FILLBMP_STRETCH), XATTR_FILLBMP_STRETCH, &::getBooleanCppuType() , 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_FILLBMP_TILE), XATTR_FILLBMP_TILE, &::getBooleanCppuType() , 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_FILLBMP_MODE), OWN_ATTR_FILLBMP_MODE, &::getCppuType((const ::com::sun::star::drawing::BitmapMode*)0), 0, 0},
+
+#define FILL_PROPERTIES_DEFAULTS \
+ { MAP_CHAR_LEN(UNO_NAME_FILLCOLOR), XATTR_FILLCOLOR , &::getCppuType((const sal_Int32*)0), 0, 0}, \
+
+#define FILL_PROPERTIES \
+ FILL_PROPERTIES_BMP \
+ FILL_PROPERTIES_DEFAULTS \
+ { MAP_CHAR_LEN(UNO_NAME_FILLBACKGROUND), XATTR_FILLBACKGROUND , &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_FILLBITMAP), XATTR_FILLBITMAP , &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >*)0) , 0, MID_BITMAP}, \
+ { MAP_CHAR_LEN("FillBitmapName"), XATTR_FILLBITMAP , &::getCppuType((const ::rtl::OUString*)0), 0, MID_NAME }, \
+ { MAP_CHAR_LEN("FillBitmapURL"), XATTR_FILLBITMAP , &::getCppuType((const ::rtl::OUString*)0), 0, MID_GRAFURL }, \
+ { MAP_CHAR_LEN("FillGradientStepCount"), XATTR_GRADIENTSTEPCOUNT , &::getCppuType((const sal_Int16*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_FILLGRADIENT), XATTR_FILLGRADIENT , &::getCppuType((const ::com::sun::star::awt::Gradient*)0), 0, MID_FILLGRADIENT}, \
+ { MAP_CHAR_LEN("FillGradientName"), XATTR_FILLGRADIENT , &::getCppuType((const ::rtl::OUString*)0), 0, MID_NAME }, \
+ { MAP_CHAR_LEN(UNO_NAME_FILLHATCH), XATTR_FILLHATCH , &::getCppuType((const ::com::sun::star::drawing::Hatch*)0), 0, MID_FILLHATCH}, \
+ { MAP_CHAR_LEN("FillHatchName"), XATTR_FILLHATCH , &::getCppuType((const ::rtl::OUString*)0), 0, MID_NAME }, \
+ { MAP_CHAR_LEN(UNO_NAME_FILLSTYLE), XATTR_FILLSTYLE , &::getCppuType((const ::com::sun::star::drawing::FillStyle*)0) , 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_FILL_TRANSPARENCE), XATTR_FILLTRANSPARENCE, &::getCppuType((const sal_Int16*)0) , 0, 0}, \
+ { MAP_CHAR_LEN("FillTransparenceGradient"), XATTR_FILLFLOATTRANSPARENCE, &::getCppuType((const ::com::sun::star::awt::Gradient*)0), 0, MID_FILLGRADIENT}, \
+ { MAP_CHAR_LEN("FillTransparenceGradientName"), XATTR_FILLFLOATTRANSPARENCE, &::getCppuType((const ::rtl::OUString*)0), 0, MID_NAME }, \
+ { MAP_CHAR_LEN(UNO_NAME_FILLCOLOR_2), XATTR_SECONDARYFILLCOLOR, &::getCppuType((const sal_Int32*)0), 0, 0},
+
+#define EDGERADIUS_PROPERTIES \
+ { MAP_CHAR_LEN(UNO_NAME_EDGERADIUS), SDRATTR_ECKENRADIUS , &::getCppuType((const sal_Int32*)0) , 0, SFX_METRIC_ITEM},
+
+#define TEXT_PROPERTIES_DEFAULTS\
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_WRITINGMODE), SDRATTR_TEXTDIRECTION, &::getCppuType((const ::com::sun::star::text::WritingMode*)0), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_ANIAMOUNT), SDRATTR_TEXT_ANIAMOUNT, &::getCppuType((const sal_Int16*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_ANICOUNT), SDRATTR_TEXT_ANICOUNT, &::getCppuType((const sal_Int16*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_ANIDELAY), SDRATTR_TEXT_ANIDELAY, &::getCppuType((const sal_Int16*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_ANIDIRECTION), SDRATTR_TEXT_ANIDIRECTION, &::getCppuType((const ::com::sun::star::drawing::TextAnimationDirection*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_ANIKIND), SDRATTR_TEXT_ANIKIND, &::getCppuType((const ::com::sun::star::drawing::TextAnimationKind*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_ANISTARTINSIDE), SDRATTR_TEXT_ANISTARTINSIDE, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_ANISTOPINSIDE), SDRATTR_TEXT_ANISTOPINSIDE, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_AUTOGROWHEIGHT), SDRATTR_TEXT_AUTOGROWHEIGHT, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_AUTOGROWWIDTH), SDRATTR_TEXT_AUTOGROWWIDTH, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_CONTOURFRAME), SDRATTR_TEXT_CONTOURFRAME, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_FITTOSIZE), SDRATTR_TEXT_FITTOSIZE, &::getCppuType((const ::com::sun::star::drawing::TextFitToSizeType*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_HORZADJUST), SDRATTR_TEXT_HORZADJUST, &::getCppuType((const ::com::sun::star::drawing::TextHorizontalAdjust*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_LEFTDIST), SDRATTR_TEXT_LEFTDIST, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_LOWERDIST), SDRATTR_TEXT_LOWERDIST, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_MAXFRAMEHEIGHT), SDRATTR_TEXT_MAXFRAMEHEIGHT, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_MAXFRAMEWIDTH), SDRATTR_TEXT_MAXFRAMEWIDTH, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_MINFRAMEHEIGHT), SDRATTR_TEXT_MINFRAMEHEIGHT, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_MINFRAMEWIDTH), SDRATTR_TEXT_MINFRAMEWIDTH, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_RIGHTDIST), SDRATTR_TEXT_RIGHTDIST, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_UPPERDIST), SDRATTR_TEXT_UPPERDIST, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_FONTINDEPENDENTLINESPACING),SDRATTR_TEXT_USEFIXEDCELLHEIGHT,&::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_VERTADJUST), SDRATTR_TEXT_VERTADJUST, &::getCppuType((const ::com::sun::star::drawing::TextVerticalAdjust*)0), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_WORDWRAP), SDRATTR_TEXT_WORDWRAP, &::getBooleanCppuType(), 0, 0}, \
+ SVX_UNOEDIT_CHAR_PROPERTIES, \
+ SVX_UNOEDIT_PARA_PROPERTIES,
+
+#define TEXT_PROPERTIES \
+ SVX_UNOEDIT_NUMBERING_PROPERTIE, \
+ TEXT_PROPERTIES_DEFAULTS
+
+// { MAP_CHAR_LEN("HasLevels"), OWN_ATTR_HASLEVELS, &::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+
+#define MISC_OBJ_PROPERTIES_NO_SHEAR \
+ { MAP_CHAR_LEN("Transformation"), OWN_ATTR_TRANSFORMATION, &::getCppuType((const struct com::sun::star::drawing::HomogenMatrix3*)0), 0, 0 }, \
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_ZORDER), OWN_ATTR_ZORDER, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_FRAMERECT), OWN_ATTR_FRAMERECT, &::getCppuType((const ::com::sun::star::awt::Rectangle*)0), 0, 0 }, \
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_ROTATEANGLE), SDRATTR_ROTATEANGLE, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_BITMAP), OWN_ATTR_BITMAP, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_OLE2_METAFILE), OWN_ATTR_METAFILE, SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int8>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, \
+ { MAP_CHAR_LEN("IsFontwork"), OWN_ATTR_ISFONTWORK, &::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_BOUNDRECT), OWN_ATTR_BOUNDRECT, &::getCppuType((const ::com::sun::star::awt::Rectangle*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+
+#define MISC_OBJ_PROPERTIES \
+ MISC_OBJ_PROPERTIES_NO_SHEAR \
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_SHEARANGLE), SDRATTR_SHEARANGLE, &::getCppuType((const sal_Int32*)0), 0, 0},
+
+
+#define SHAPE_DESCRIPTOR_PROPERTIES \
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_LAYERID), SDRATTR_LAYERID , &::getCppuType((const sal_Int16*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_LAYERNAME), SDRATTR_LAYERNAME , &::getCppuType((const ::rtl::OUString*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_MOVEPROTECT), SDRATTR_OBJMOVEPROTECT , &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_NAME), SDRATTR_OBJECTNAME , &::getCppuType((const ::rtl::OUString*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_PRINTABLE), SDRATTR_OBJPRINTABLE , &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN("Visible"), SDRATTR_OBJVISIBLE , &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_SIZEPROTECT), SDRATTR_OBJSIZEPROTECT , &::getBooleanCppuType(), 0, 0},\
+ { MAP_CHAR_LEN("UINameSingular"), OWN_ATTR_UINAME_SINGULAR , &::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, \
+ { MAP_CHAR_LEN("UINamePlural"), OWN_ATTR_UINAME_PLURAL , &::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, \
+ /* #i68101# */ \
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_TITLE), OWN_ATTR_MISC_OBJ_TITLE , &::getCppuType((const ::rtl::OUString*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_DESCRIPTION), OWN_ATTR_MISC_OBJ_DESCRIPTION , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+
+#define LINKTARGET_PROPERTIES \
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), OWN_ATTR_LDNAME , &::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), OWN_ATTR_LDBITMAP , &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+
+
+#define CONNECTOR_PROPERTIES \
+ { MAP_CHAR_LEN(UNO_NAME_EDGEKIND), SDRATTR_EDGEKIND, &::getCppuType((const ::com::sun::star::drawing::ConnectorType*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_EDGENODE1HORZDIST), SDRATTR_EDGENODE1HORZDIST, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_EDGENODE1VERTDIST), SDRATTR_EDGENODE1VERTDIST, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_EDGENODE2HORZDIST), SDRATTR_EDGENODE2HORZDIST, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_EDGENODE2VERTDIST), SDRATTR_EDGENODE2VERTDIST, &::getCppuType((const sal_Int32*)0), 0, 0},
+
+#define SPECIAL_CONNECTOR_PROPERTIES \
+ CONNECTOR_PROPERTIES \
+ { MAP_CHAR_LEN(UNO_NAME_EDGELINE1DELTA), SDRATTR_EDGELINE1DELTA, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_EDGELINE2DELTA), SDRATTR_EDGELINE2DELTA, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_EDGELINE3DELTA), SDRATTR_EDGELINE3DELTA, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN("StartShape"), OWN_ATTR_EDGE_START_OBJ, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0}, \
+ { MAP_CHAR_LEN("StartGluePointIndex"), OWN_ATTR_GLUEID_HEAD, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN("StartPosition"), OWN_ATTR_EDGE_START_POS, &::getCppuType((const ::com::sun::star::awt::Point*)0), 0, 0}, \
+ { MAP_CHAR_LEN("EndShape"), OWN_ATTR_EDGE_END_OBJ, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0}, \
+ { MAP_CHAR_LEN("EndPosition"), OWN_ATTR_EDGE_END_POS, &::getCppuType((const ::com::sun::star::awt::Point*)0), 0, 0},\
+ { MAP_CHAR_LEN("EndGluePointIndex"), OWN_ATTR_GLUEID_TAIL, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+\
+ { MAP_CHAR_LEN("EdgeStartConnection"), OWN_ATTR_EDGE_START_OBJ, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0}, \
+ { MAP_CHAR_LEN("EdgeStartPoint"), OWN_ATTR_EDGE_START_POS, &::getCppuType((const ::com::sun::star::awt::Point*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, \
+ { MAP_CHAR_LEN("EdgeEndConnection"), OWN_ATTR_EDGE_END_OBJ, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0}, \
+ { MAP_CHAR_LEN("EdgeEndPoint"), OWN_ATTR_EDGE_END_POS, &::getCppuType((const ::com::sun::star::awt::Point*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, \
+\
+ { MAP_CHAR_LEN(UNO_NAME_POLYPOLYGONBEZIER), OWN_ATTR_EDGE_POLYPOLYGONBEZIER, &::getCppuType((const ::com::sun::star::drawing::PolyPolygonBezierCoords*)0), 0, 0},
+
+#define SPECIAL_DIMENSIONING_PROPERTIES_DEFAULTS \
+ { MAP_CHAR_LEN(UNO_NAME_MEASUREBELOWREFEDGE), SDRATTR_MEASUREBELOWREFEDGE, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_MEASUREFORMATSTRING), SDRATTR_MEASUREFORMATSTRING, &::getCppuType((const ::rtl::OUString*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_MEASUREHELPLINE1LEN), SDRATTR_MEASUREHELPLINE1LEN, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_MEASUREHELPLINE2LEN), SDRATTR_MEASUREHELPLINE2LEN, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_MEASUREHELPLINEDIST), SDRATTR_MEASUREHELPLINEDIST, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_MEASUREHELPLINEOVERHANG), SDRATTR_MEASUREHELPLINEOVERHANG, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_MEASUREKIND), SDRATTR_MEASUREKIND, &::getCppuType((const ::com::sun::star::drawing::MeasureKind*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_MEASURELINEDIST), SDRATTR_MEASURELINEDIST, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_MEASUREOVERHANG), SDRATTR_MEASUREOVERHANG, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_MEASUREUNIT), SDRATTR_MEASUREUNIT, &::getCppuType((const sal_Int32*)0), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_MEASURESHOWUNIT), SDRATTR_MEASURESHOWUNIT, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_MEASURETEXTAUTOANGLE), SDRATTR_MEASURETEXTAUTOANGLE, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_MEASURETEXTAUTOANGLEVIEW), SDRATTR_MEASURETEXTAUTOANGLEVIEW, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_MEASURETEXTFIXEDANGLE), SDRATTR_MEASURETEXTFIXEDANGLE, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_MEASURETEXTHPOS), SDRATTR_MEASURETEXTHPOS, &::getCppuType((const ::com::sun::star::drawing::MeasureTextHorzPos*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_MEASURETEXTISFIXEDANGLE), SDRATTR_MEASURETEXTISFIXEDANGLE, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_MEASURETEXTROTA90), SDRATTR_MEASURETEXTROTA90, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_MEASURETEXTUPSIDEDOWN), SDRATTR_MEASURETEXTUPSIDEDOWN, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_MEASURETEXTVPOS), SDRATTR_MEASURETEXTVPOS, &::getCppuType((const ::com::sun::star::drawing::MeasureTextVertPos*)0), 0, 0}, \
+ { MAP_CHAR_LEN("MeasureDecimalPlaces"), SDRATTR_MEASUREDECIMALPLACES, &::getCppuType((const sal_Int16*)0), 0, 0},
+
+
+#define SPECIAL_DIMENSIONING_PROPERTIES \
+ SPECIAL_DIMENSIONING_PROPERTIES_DEFAULTS \
+ { MAP_CHAR_LEN("StartPosition"), OWN_ATTR_MEASURE_START_POS, &::getCppuType((const ::com::sun::star::awt::Point*)0), 0, 0},\
+ { MAP_CHAR_LEN("EndPosition"), OWN_ATTR_MEASURE_END_POS, &::getCppuType((const ::com::sun::star::awt::Point*)0), 0, 0},
+
+#define SPECIAL_CIRCLE_PROPERTIES \
+ { MAP_CHAR_LEN(UNO_NAME_CIRCENDANGLE), SDRATTR_CIRCENDANGLE, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_CIRCKIND), SDRATTR_CIRCKIND, &::getCppuType((const ::com::sun::star::drawing::CircleKind*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_CIRCSTARTANGLE),SDRATTR_CIRCSTARTANGLE, &::getCppuType((const sal_Int32*)0), 0, 0},
+
+#define SPECIAL_POLYGON_PROPERTIES \
+ { MAP_CHAR_LEN(UNO_NAME_POLYGONKIND), OWN_ATTR_VALUE_POLYGONKIND, &::getCppuType((const ::com::sun::star::drawing::PolygonKind*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+
+#define SPECIAL_POLYPOLYGON_PROPERTIES \
+ { MAP_CHAR_LEN(UNO_NAME_POLYPOLYGON), OWN_ATTR_VALUE_POLYPOLYGON, SEQTYPE(::getCppuType((const ::com::sun::star::drawing::PointSequenceSequence*)0)), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_POLYGON), OWN_ATTR_VALUE_POLYGON, SEQTYPE(::getCppuType((const ::com::sun::star::drawing::PointSequence*)0)), 0, 0},
+
+#define SPECIAL_POLYPOLYGONBEZIER_PROPERTIES \
+ { MAP_CHAR_LEN(UNO_NAME_POLYPOLYGONBEZIER), OWN_ATTR_VALUE_POLYPOLYGONBEZIER, &::getCppuType((const ::com::sun::star::drawing::PolyPolygonBezierCoords*)0), 0, 0},
+
+#define SPECIAL_GRAPHOBJ_PROPERTIES_DEFAULTS \
+ { MAP_CHAR_LEN(UNO_NAME_GRAPHIC_LUMINANCE), SDRATTR_GRAFLUMINANCE , &::getCppuType((const sal_Int16*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_GRAPHIC_CONTRAST), SDRATTR_GRAFCONTRAST , &::getCppuType((const sal_Int16*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_GRAPHIC_RED), SDRATTR_GRAFRED , &::getCppuType((const sal_Int16*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_GRAPHIC_GREEN), SDRATTR_GRAFGREEN , &::getCppuType((const sal_Int16*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_GRAPHIC_BLUE), SDRATTR_GRAFBLUE , &::getCppuType((const sal_Int16*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_GRAPHIC_GAMMA), SDRATTR_GRAFGAMMA , &::getCppuType((const double*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_GRAPHIC_TRANSPARENCY), SDRATTR_GRAFTRANSPARENCE , &::getCppuType((const sal_Int16*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_GRAPHIC_COLOR_MODE), SDRATTR_GRAFMODE , &::getCppuType((const ::com::sun::star::drawing::ColorMode*)0), 0, 0},
+
+#define SPECIAL_GRAPHOBJ_PROPERTIES \
+ SPECIAL_GRAPHOBJ_PROPERTIES_DEFAULTS \
+ { MAP_CHAR_LEN(UNO_NAME_GRAPHIC_GRAPHICCROP), SDRATTR_GRAFCROP , &::getCppuType((const ::com::sun::star::text::GraphicCrop*)0), 0, 0 }, \
+ { MAP_CHAR_LEN(UNO_NAME_GRAPHOBJ_GRAFURL), OWN_ATTR_GRAFURL , &::getCppuType((const ::rtl::OUString*)0), 0, 0 }, \
+ { MAP_CHAR_LEN(UNO_NAME_GRAPHOBJ_GRAFSTREAMURL),OWN_ATTR_GRAFSTREAMURL , &::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 }, \
+ { MAP_CHAR_LEN(UNO_NAME_GRAPHOBJ_FILLBITMAP), OWN_ATTR_VALUE_FILLBITMAP , &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap>*)0) , 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_GRAPHOBJ_GRAPHIC), OWN_ATTR_VALUE_GRAPHIC , &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic>*)0) , 0, 0},
+
+
+#define SPECIAL_3DSCENEOBJECT_PROPERTIES_DEFAULTS \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_AMBIENTCOLOR), SDRATTR_3DSCENE_AMBIENTCOLOR , &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_DISTANCE), SDRATTR_3DSCENE_DISTANCE , &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_FOCAL_LENGTH), SDRATTR_3DSCENE_FOCAL_LENGTH , &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_LIGHTCOLOR_1), SDRATTR_3DSCENE_LIGHTCOLOR_1 , &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_LIGHTCOLOR_2), SDRATTR_3DSCENE_LIGHTCOLOR_2 , &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_LIGHTCOLOR_3), SDRATTR_3DSCENE_LIGHTCOLOR_3 , &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_LIGHTCOLOR_4), SDRATTR_3DSCENE_LIGHTCOLOR_4 , &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_LIGHTCOLOR_5), SDRATTR_3DSCENE_LIGHTCOLOR_5 , &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_LIGHTCOLOR_6), SDRATTR_3DSCENE_LIGHTCOLOR_6 , &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_LIGHTCOLOR_7), SDRATTR_3DSCENE_LIGHTCOLOR_7 , &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_LIGHTCOLOR_8), SDRATTR_3DSCENE_LIGHTCOLOR_8 , &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_LIGHTDIRECTION_1), SDRATTR_3DSCENE_LIGHTDIRECTION_1 , &::getCppuType((const ::com::sun::star::drawing::Direction3D*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_LIGHTDIRECTION_2), SDRATTR_3DSCENE_LIGHTDIRECTION_2 , &::getCppuType((const ::com::sun::star::drawing::Direction3D*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_LIGHTDIRECTION_3), SDRATTR_3DSCENE_LIGHTDIRECTION_3 , &::getCppuType((const ::com::sun::star::drawing::Direction3D*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_LIGHTDIRECTION_4), SDRATTR_3DSCENE_LIGHTDIRECTION_4 , &::getCppuType((const ::com::sun::star::drawing::Direction3D*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_LIGHTDIRECTION_5), SDRATTR_3DSCENE_LIGHTDIRECTION_5 , &::getCppuType((const ::com::sun::star::drawing::Direction3D*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_LIGHTDIRECTION_6), SDRATTR_3DSCENE_LIGHTDIRECTION_6 , &::getCppuType((const ::com::sun::star::drawing::Direction3D*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_LIGHTDIRECTION_7), SDRATTR_3DSCENE_LIGHTDIRECTION_7 , &::getCppuType((const ::com::sun::star::drawing::Direction3D*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_LIGHTDIRECTION_8), SDRATTR_3DSCENE_LIGHTDIRECTION_8 , &::getCppuType((const ::com::sun::star::drawing::Direction3D*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_LIGHTON_1), SDRATTR_3DSCENE_LIGHTON_1 , &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_LIGHTON_2), SDRATTR_3DSCENE_LIGHTON_2 , &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_LIGHTON_3), SDRATTR_3DSCENE_LIGHTON_3 , &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_LIGHTON_4), SDRATTR_3DSCENE_LIGHTON_4 , &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_LIGHTON_5), SDRATTR_3DSCENE_LIGHTON_5 , &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_LIGHTON_6), SDRATTR_3DSCENE_LIGHTON_6 , &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_LIGHTON_7), SDRATTR_3DSCENE_LIGHTON_7 , &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_LIGHTON_8), SDRATTR_3DSCENE_LIGHTON_8 , &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_PERSPECTIVE), SDRATTR_3DSCENE_PERSPECTIVE , &::getCppuType((const ::com::sun::star::drawing::ProjectionMode*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_SHADOW_SLANT), SDRATTR_3DSCENE_SHADOW_SLANT , &::getCppuType((const sal_Int16*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_SHADE_MODE), SDRATTR_3DSCENE_SHADE_MODE , &::getCppuType((const ::com::sun::star::drawing::ShadeMode*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SCENE_TWO_SIDED_LIGHTING),SDRATTR_3DSCENE_TWO_SIDED_LIGHTING, &::getBooleanCppuType(), 0, 0},
+
+#define SPECIAL_3DSCENEOBJECT_PROPERTIES \
+ SPECIAL_3DSCENEOBJECT_PROPERTIES_DEFAULTS \
+ { MAP_CHAR_LEN(UNO_NAME_3D_TRANSFORM_MATRIX), OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX , &::getCppuType((const ::com::sun::star::drawing::HomogenMatrix*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_CAMERA_GEOMETRY), OWN_ATTR_3D_VALUE_CAMERA_GEOMETRY , &::getCppuType((const ::com::sun::star::drawing::CameraGeometry*)0), 0, 0},
+
+// #i28528#
+// Added extra Item (Bool) for chart2 to be able to show reduced line geometry (SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY)
+#define MISC_3D_OBJ_PROPERTIES \
+ { MAP_CHAR_LEN(UNO_NAME_3D_DOUBLE_SIDED ),SDRATTR_3DOBJ_DOUBLE_SIDED , &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_MAT_COLOR ),SDRATTR_3DOBJ_MAT_COLOR , &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_MAT_EMISSION ),SDRATTR_3DOBJ_MAT_EMISSION , &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_MAT_SPECULAR ),SDRATTR_3DOBJ_MAT_SPECULAR , &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_MAT_SPECULAR_INTENSITY ),SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY , &::getCppuType((const sal_Int16*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_NORMALS_INVERT ),SDRATTR_3DOBJ_NORMALS_INVERT , &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_NORMALS_KIND ),SDRATTR_3DOBJ_NORMALS_KIND , &::getCppuType((const ::com::sun::star::drawing::NormalsKind*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SHADOW_3D ),SDRATTR_3DOBJ_SHADOW_3D , &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_TEXTURE_FILTER ),SDRATTR_3DOBJ_TEXTURE_FILTER , &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_TEXTURE_KIND ),SDRATTR_3DOBJ_TEXTURE_KIND , &::getCppuType((const ::com::sun::star::drawing::TextureKind*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_TEXTURE_MODE ),SDRATTR_3DOBJ_TEXTURE_MODE , &::getCppuType((const ::com::sun::star::drawing::TextureMode*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_TEXTURE_PROJ_X ),SDRATTR_3DOBJ_TEXTURE_PROJ_X , &::getCppuType((const ::com::sun::star::drawing::TextureProjectionMode*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_TEXTURE_PROJ_Y ),SDRATTR_3DOBJ_TEXTURE_PROJ_Y , &::getCppuType((const ::com::sun::star::drawing::TextureProjectionMode*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_REDUCED_LINE_GEOMETRY ),SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY , &::getBooleanCppuType(), 0, 0},
+
+#define SPECIAL_3DCUBEOBJECT_PROPERTIES \
+ { MAP_CHAR_LEN(UNO_NAME_3D_TRANSFORM_MATRIX ),OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX , &::getCppuType((const ::com::sun::star::drawing::HomogenMatrix*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_POS ),OWN_ATTR_3D_VALUE_POSITION , &::getCppuType((const ::com::sun::star::drawing::Position3D*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SIZE ),OWN_ATTR_3D_VALUE_SIZE , &::getCppuType((const ::com::sun::star::drawing::Direction3D*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_POS_IS_CENTER ),OWN_ATTR_3D_VALUE_POS_IS_CENTER , &::getBooleanCppuType(), 0, 0},
+
+#define SPECIAL_3DSPHEREOBJECT_PROPERTIES \
+ { MAP_CHAR_LEN(UNO_NAME_3D_TRANSFORM_MATRIX ),OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX , &::getCppuType((const ::com::sun::star::drawing::HomogenMatrix*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_POS ),OWN_ATTR_3D_VALUE_POSITION , &::getCppuType((const ::com::sun::star::drawing::Position3D*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SIZE ),OWN_ATTR_3D_VALUE_SIZE , &::getCppuType((const ::com::sun::star::drawing::Direction3D*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_HORZ_SEGS ),SDRATTR_3DOBJ_HORZ_SEGS, &::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_VERT_SEGS ),SDRATTR_3DOBJ_VERT_SEGS, &::getCppuType((const sal_Int32*)0), 0, 0},
+
+// #107245# New 3D properties which are possible for lathe and extrude 3d objects
+#define SPECIAL_3DLATHEANDEXTRUDEOBJ_PROPERTIES \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SMOOTH_NORMALS ), SDRATTR_3DOBJ_SMOOTH_NORMALS, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_SMOOTH_LIDS ), SDRATTR_3DOBJ_SMOOTH_LIDS, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_CHARACTER_MODE ), SDRATTR_3DOBJ_CHARACTER_MODE, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_CLOSE_FRONT ), SDRATTR_3DOBJ_CLOSE_FRONT, &::getBooleanCppuType(), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_CLOSE_BACK ), SDRATTR_3DOBJ_CLOSE_BACK, &::getBooleanCppuType(), 0, 0},
+
+#define SPECIAL_3DLATHEOBJECT_PROPERTIES \
+ { MAP_CHAR_LEN(UNO_NAME_3D_TRANSFORM_MATRIX ),OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX ,&::getCppuType((const ::com::sun::star::drawing::HomogenMatrix*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_POLYPOLYGON3D ),OWN_ATTR_3D_VALUE_POLYPOLYGON3D ,&::getCppuType((const ::com::sun::star::drawing::PolyPolygonShape3D*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_LATHE_END_ANGLE ),SDRATTR_3DOBJ_END_ANGLE ,&::getCppuType((const sal_Int16*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_HORZ_SEGS ),SDRATTR_3DOBJ_HORZ_SEGS ,&::getCppuType((const sal_Int32*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_PERCENT_DIAGONAL ),SDRATTR_3DOBJ_PERCENT_DIAGONAL ,&::getCppuType((const sal_Int16*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_VERT_SEGS ),SDRATTR_3DOBJ_VERT_SEGS ,&::getCppuType((const sal_Int32*)0), 0, 0},
+
+#define SPECIAL_3DEXTRUDEOBJECT_PROPERTIES \
+ { MAP_CHAR_LEN(UNO_NAME_3D_TRANSFORM_MATRIX ),OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX ,&::getCppuType((const ::com::sun::star::drawing::HomogenMatrix*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_POLYPOLYGON3D ),OWN_ATTR_3D_VALUE_POLYPOLYGON3D ,&::getCppuType((const ::com::sun::star::drawing::PolyPolygonShape3D*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_EXTRUDE_DEPTH ),SDRATTR_3DOBJ_DEPTH ,&::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_PERCENT_DIAGONAL ),SDRATTR_3DOBJ_PERCENT_DIAGONAL ,&::getCppuType((const sal_Int16*)0), 0, 0},
+
+#define SPECIAL_3DPOLYGONOBJECT_PROPERTIES \
+ { MAP_CHAR_LEN(UNO_NAME_3D_TRANSFORM_MATRIX ),OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX , &::getCppuType((const ::com::sun::star::drawing::HomogenMatrix*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_POLYPOLYGON3D ),OWN_ATTR_3D_VALUE_POLYPOLYGON3D , &::getCppuType((const ::com::sun::star::drawing::PolyPolygonShape3D*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_NORMALSPOLYGON3D ),OWN_ATTR_3D_VALUE_NORMALSPOLYGON3D, &::getCppuType((const ::com::sun::star::drawing::PolyPolygonShape3D*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_TEXTUREPOLYGON3D ),OWN_ATTR_3D_VALUE_TEXTUREPOLYGON3D, &::getCppuType((const ::com::sun::star::drawing::PolyPolygonShape3D*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_3D_LINEONLY ),OWN_ATTR_3D_VALUE_LINEONLY , &::getBooleanCppuType(), 0, 0},
+
+#define SPECIAL_3DBACKSCALE_PROPERTIES \
+ { MAP_CHAR_LEN(UNO_NAME_3D_BACKSCALE ),SDRATTR_3DOBJ_BACKSCALE ,&::getCppuType((const sal_Int16*)0), 0, 0}, \
+
+#define CUSTOMSHAPE_PROPERTIES \
+ { MAP_CHAR_LEN(UNO_NAME_CUSTOMSHAPE_ADJUSTMENT),SDRATTR_CUSTOMSHAPE_ADJUSTMENT, SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int32>*)0)), 0, 0}, \
+
+#endif
+
diff --git a/svx/inc/svx/unoshtxt.hxx b/svx/inc/svx/unoshtxt.hxx
new file mode 100644
index 000000000000..e7c678a8a358
--- /dev/null
+++ b/svx/inc/svx/unoshtxt.hxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_UNOSHTXT_HXX
+#define SVX_UNOSHTXT_HXX
+
+#include <memory>
+#include <editeng/unoedsrc.hxx>
+#include "svx/svxdllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace uno {
+ class XInterface;
+ }
+ namespace accessibility {
+ struct TextSegment;
+ }
+} } }
+
+class SvxTextForwarder;
+class SdrObject;
+class SdrModel;
+class SdrView;
+class Window;
+class SvxTextEditSourceImpl;
+class SdrText;
+
+class SVX_DLLPUBLIC SvxTextEditSource : public SvxEditSource, public SvxViewForwarder
+{
+public:
+ SvxTextEditSource( SdrObject* pObj, SdrText* pText, ::com::sun::star::uno::XInterface* pOwner);
+
+ /** Since the views don't broadcast their dying, make sure that
+ this object gets destroyed if the view becomes invalid
+
+ The window is necessary, since our views can display on multiple windows
+ */
+ SvxTextEditSource( SdrObject& rObj, SdrText* pText, SdrView& rView, const Window& rViewWindow );
+
+ virtual ~SvxTextEditSource();
+
+ virtual SvxEditSource* Clone() const;
+ virtual SvxTextForwarder* GetTextForwarder();
+ virtual SvxViewForwarder* GetViewForwarder();
+ virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate = sal_False );
+ virtual void UpdateData();
+
+ virtual void addRange( SvxUnoTextRangeBase* pNewRange );
+ virtual void removeRange( SvxUnoTextRangeBase* pOldRange );
+ virtual const SvxUnoTextRangeBaseList& getRanges() const;
+
+ virtual SfxBroadcaster& GetBroadcaster() const;
+
+ SdrObject* GetSdrObject() const;
+
+ void lock();
+ void unlock();
+
+// static sal_Bool hasLevels( const SdrObject* pObject );
+
+ // the SvxViewForwarder interface
+ virtual sal_Bool IsValid() const;
+ virtual Rectangle GetVisArea() const;
+ virtual Point LogicToPixel( const Point&, const MapMode& ) const;
+ virtual Point PixelToLogic( const Point&, const MapMode& ) const;
+
+ void ChangeModel( SdrModel* pNewModel );
+
+ void UpdateOutliner();
+
+private:
+ SVX_DLLPRIVATE SvxTextEditSource( SvxTextEditSourceImpl* pImpl );
+
+ SvxTextEditSourceImpl* mpImpl;
+};
+
+#endif
diff --git a/svx/inc/svx/verttexttbxctrl.hxx b/svx/inc/svx/verttexttbxctrl.hxx
new file mode 100644
index 000000000000..175704f83749
--- /dev/null
+++ b/svx/inc/svx/verttexttbxctrl.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_VERT_TEXT_TBXCTRL_HXX
+#define _SVX_VERT_TEXT_TBXCTRL_HXX
+
+#include <sfx2/tbxctrl.hxx>
+#include "svx/svxdllapi.h"
+
+/* -----------------------------27.04.01 15:38--------------------------------
+ control to remove/insert cjk settings dependent vertical text toolbox item
+ ---------------------------------------------------------------------------*/
+class SvxVertCTLTextTbxCtrl : public SfxToolBoxControl
+{
+ sal_Bool bCheckVertical; //determines whether vertical mode or CTL mode has to be checked
+public:
+ SvxVertCTLTextTbxCtrl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxVertCTLTextTbxCtrl();
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ void SetVert(sal_Bool bSet) {bCheckVertical = bSet;}
+
+};
+/* -----------------------------12.09.2002 11:50------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SVX_DLLPUBLIC SvxCTLTextTbxCtrl : public SvxVertCTLTextTbxCtrl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxCTLTextTbxCtrl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+};
+/* -----------------------------12.09.2002 11:50------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SVX_DLLPUBLIC SvxVertTextTbxCtrl : public SvxVertCTLTextTbxCtrl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxVertTextTbxCtrl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+};
+
+#endif
diff --git a/svx/inc/svx/view3d.hxx b/svx/inc/svx/view3d.hxx
new file mode 100644
index 000000000000..776d6d672da7
--- /dev/null
+++ b/svx/inc/svx/view3d.hxx
@@ -0,0 +1,277 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _E3D_VIEW3D_HXX
+#define _E3D_VIEW3D_HXX
+
+#include <svx/svdview.hxx>
+#include <svx/def3d.hxx>
+#include <svx/deflt3d.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include "svx/svxdllapi.h"
+
+//************************************************************
+// Vorausdeklarationen
+//************************************************************
+
+class E3dObject;
+class E3dScene;
+class SceneList;
+class Impl3DMirrorConstructOverlay;
+
+/*************************************************************************
+|*
+|* Ableitung von SdrView zur Bearbeitung von 3D-Objekten
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC E3dView : public SdrView
+{
+protected:
+ E3dDefaultAttributes a3DDefaultAttr;
+ MouseEvent aMouseEvent; // Die Parameter der letzten Events (Mouse, Keyboard)
+ Color aDefaultLightColor; // dito mit den Farben
+ Color aDefaultAmbientColor;
+
+ double fDefaultScaleX; // Verzerrungen
+ double fDefaultScaleY;
+ double fDefaultScaleZ;
+ double fDefaultRotateX; // und Drehungen
+ double fDefaultRotateY;
+ double fDefaultRotateZ;
+ double fDefaultExtrusionDeepth; // Extrusionstiefe
+ double fDefaultLightIntensity; // Intensitaeten der beiden (notwendigen) Licht-
+ double fDefaultAmbientIntensity; // quellen
+ long nHDefaultSegments; // wieviele HSegmente braucht mein Lathe-Ojekt
+ long nVDefaultSegments; // wieviele VSegmente braucht mein Lathe-Ojekt
+
+ E3dDragConstraint eDragConstraint;
+
+ // Migrate selections
+ Impl3DMirrorConstructOverlay* mpMirrorOverlay;
+
+ sal_Bool bDoubleSided;
+
+ void InitView();
+
+ void ImpCreate3DObject(E3dScene* pScene, SdrObject* pObj, sal_Bool bExtrude, double fDepth, basegfx::B2DHomMatrix& rLatheMat);
+ void ImpCreateSingle3DObjectFlat(E3dScene* pScene, SdrObject* pObj, sal_Bool bExtrude, double fDepth, basegfx::B2DHomMatrix& rLatheMat);
+ void ImpChangeSomeAttributesFor3DConversion(SdrObject* pObj);
+ void ImpChangeSomeAttributesFor3DConversion2(SdrObject* pObj);
+
+ void InitScene(E3dScene* pScene, double fW, double fH, double fCamZ);
+ void ImpIsConvertTo3DPossible(SdrObject* pObj, sal_Bool& rAny3D, sal_Bool& rGroupSelected) const;
+ void BreakSingle3DObj(E3dObject* pObj);
+
+public:
+ TYPEINFO();
+ E3dView(SdrModel* pModel, OutputDevice* pOut = 0L);
+ virtual ~E3dView();
+
+ // Alle markierten Objekte auf dem angegebenen OutputDevice ausgeben.
+ virtual void DrawMarkedObj(OutputDevice& rOut) const;
+
+ // Zugriff auf die Default-Attribute
+ E3dDefaultAttributes& Get3DDefaultAttributes() { return a3DDefaultAttr; }
+ virtual sal_Bool BegDragObj(const Point& rPnt, OutputDevice* pOut = NULL, SdrHdl* pHdl = NULL, short nMinMov = -3, SdrDragMethod* pForcedMeth = NULL);
+ virtual void CheckPossibilities();
+
+ // Event setzen/rausruecken
+ void SetMouseEvent(const MouseEvent& rNew) { aMouseEvent = rNew; }
+ const MouseEvent& GetMouseEvent() { return aMouseEvent; }
+
+ // Model holen ueberladen, da bei einzelnen 3D Objekten noch eine Szene
+ // untergeschoben werden muss
+ virtual SdrModel* GetMarkedObjModel() const;
+
+ // Bei Paste muss - falls in eine Scene eingefuegt wird - die
+ // Objekte der Szene eingefuegt werden, die Szene selbst aber nicht
+ using SdrView::Paste;
+ virtual sal_Bool Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
+
+ // #83403# Service routine used from local Clone() and from SdrCreateView::EndCreateObj(...)
+ sal_Bool ImpCloneAll3DObjectsToDestScene(E3dScene* pSrcScene, E3dScene* pDstScene, Point aOffset);
+
+ sal_Bool HasMarkedScene();
+ E3dScene* GetMarkedScene();
+
+ sal_Bool IsConvertTo3DObjPossible() const;
+ void ConvertMarkedObjTo3D(sal_Bool bExtrude=sal_True, basegfx::B2DPoint aPnt1 = basegfx::B2DPoint(0.0, 0.0), basegfx::B2DPoint aPnt2 = basegfx::B2DPoint(0.0, 1.0));
+
+ // Nachtraeglichhe Korrekturmoeglichkeit um alle Extrudes in einer
+ // bestimmten Tiefensortierung anzulegen
+ void DoDepthArrange(E3dScene* pScene, double fDepth);
+ void ConvertMarkedToPolyObj(sal_Bool bLineToArea);
+ E3dScene* SetCurrent3DObj(E3dObject* p3DObj);
+ void Start3DCreation();
+
+ // migration of overlay
+ sal_Bool Is3DRotationCreationActive() const { return (0L != mpMirrorOverlay); }
+
+ virtual void MovAction(const Point& rPnt);
+ void End3DCreation(sal_Bool bUseDefaultValuesForMirrorAxes=sal_False);
+ void ResetCreationActive();
+
+ double GetDefaultCamPosZ();
+
+ double &DefaultScaleX ()
+ {
+ return fDefaultScaleX;
+ }
+
+ double DefaultScaleX () const
+ {
+ return fDefaultScaleX;
+ }
+
+ double &DefaultScaleY ()
+ {
+ return fDefaultScaleY;
+ }
+
+ double DefaultScaleY () const
+ {
+ return fDefaultScaleY;
+ }
+
+ double &DefaultScaleZ ()
+ {
+ return fDefaultScaleZ;
+ }
+
+ double DefaultScaleZ () const
+ {
+ return fDefaultScaleZ;
+ }
+
+ double &DefaultRotateX ()
+ {
+ return fDefaultRotateX;
+ }
+
+ double DefaultRotateX () const
+ {
+ return fDefaultRotateX;
+ }
+
+ double &DefaultRotateY ()
+ {
+ return fDefaultRotateY;
+ }
+
+ double DefaultRotateY () const
+ {
+ return fDefaultRotateY;
+ }
+
+ double &DefaultRotateZ ()
+ {
+ return fDefaultRotateZ;
+ }
+
+ double DefaultRotateZ () const
+ {
+ return fDefaultRotateZ;
+ }
+
+ double &DefaultExtrusionDeepth ()
+ {
+ return fDefaultExtrusionDeepth;
+ }
+
+ double DefaultExtrusionDeepth () const
+ {
+ return fDefaultExtrusionDeepth;
+ }
+
+ double GetDefaultCamFocal();
+
+ double &DefaultLightIntensity ()
+ {
+ return fDefaultLightIntensity;
+ }
+
+ double DefaultLightIntensity () const
+ {
+ return fDefaultLightIntensity;
+ }
+
+ double &DefaultAmbientIntensity ()
+ {
+ return fDefaultAmbientIntensity;
+ }
+
+ double DefaultAmbientIntensity () const
+ {
+ return fDefaultAmbientIntensity;
+ }
+
+ const Color &DefaultLightColor () const
+ {
+ return aDefaultLightColor;
+ }
+
+ Color DefaultLightColor ()
+ {
+ return aDefaultLightColor;
+ }
+
+ const Color &DefaultAmbientColor () const
+ {
+ return aDefaultAmbientColor;
+ }
+
+ Color DefaultAmbientColor ()
+ {
+ return aDefaultAmbientColor;
+ }
+
+ long GetHDefaultSegments() const { return nHDefaultSegments; }
+ void SetHDefaultSegments(long nSegs) { nHDefaultSegments = nSegs; }
+
+ long GetVDefaultSegments() const { return nVDefaultSegments; }
+ void SetVDefaultSegments(long nSegs) { nVDefaultSegments = nSegs; }
+
+ sal_Bool IsBreak3DObjPossible() const;
+ void Break3DObj();
+
+ sal_Bool DoubleSided () const
+ {
+ return bDoubleSided;
+ }
+
+ sal_Bool &DoubleSided ()
+ {
+ return bDoubleSided;
+ }
+
+ void MergeScenes();
+ SfxItemSet Get3DAttributes(E3dScene* pInScene = NULL, sal_Bool bOnly3DAttr=sal_False) const;
+ void Set3DAttributes(const SfxItemSet& rAttr, E3dScene* pInScene = NULL, sal_Bool bOnly3DAttr=sal_False);
+};
+
+#endif // _E3D_VIEW3D_HXX
diff --git a/svx/inc/svx/viewlayoutitem.hxx b/svx/inc/svx/viewlayoutitem.hxx
new file mode 100644
index 000000000000..febb15fe28ca
--- /dev/null
+++ b/svx/inc/svx/viewlayoutitem.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_VIEWLAYOUTITEM_HXX
+#define _SVX_VIEWLAYOUTITEM_HXX
+
+#include <svl/intitem.hxx>
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+#include "svx/svxdllapi.h"
+
+//-------------------------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxViewLayoutItem: public SfxUInt16Item
+{
+ bool mbBookMode;
+
+public:
+ TYPEINFO();
+
+ SvxViewLayoutItem( sal_uInt16 nColumns = 0, bool bBookMode = false, sal_uInt16 nWhich = SID_ATTR_VIEWLAYOUT );
+ SvxViewLayoutItem( const SvxViewLayoutItem& );
+ ~SvxViewLayoutItem();
+
+ void SetBookMode( bool bNew ) {mbBookMode = bNew; }
+ bool IsBookMode() const {return mbBookMode; }
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rStrm, sal_uInt16 nVersion ) const; // leer
+ virtual SvStream& Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const; // leer
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; // leer
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); // leer
+};
+
+//------------------------------------------------------------------------
+
+#endif
diff --git a/svx/inc/svx/viewpt3d.hxx b/svx/inc/svx/viewpt3d.hxx
new file mode 100644
index 000000000000..2a766e81e1a9
--- /dev/null
+++ b/svx/inc/svx/viewpt3d.hxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _VIEWPT3D_HXX
+#define _VIEWPT3D_HXX
+
+#include "svx/svxdllapi.h"
+#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <basegfx/point/b3dpoint.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+#include <tools/gen.hxx>
+
+// predefines
+namespace basegfx { class B3DRange; } // end of namespace basegfx
+
+/*************************************************************************
+|*
+|* enums fuer Projektion und Seitenverhaeltnis
+|*
+\************************************************************************/
+
+enum ProjectionType { PR_PARALLEL, PR_PERSPECTIVE };
+enum AspectMapType { AS_NO_MAPPING, AS_HOLD_SIZE, AS_HOLD_X, AS_HOLD_Y };
+
+
+/*************************************************************************
+|*
+|* 3D-Viewport nach PHIGS
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC Viewport3D
+{
+ protected:
+ basegfx::B3DHomMatrix aViewTf; // die eigentliche Transformationsmatrix
+ basegfx::B3DPoint aVRP; // View Reference Point
+ basegfx::B3DVector aVPN; // View Plane Normal
+ basegfx::B3DVector aVUV; // View Up Vector
+ basegfx::B3DPoint aPRP; // Projection Reference Point(View-Koordinaten)
+ // bisher wird nur die Z-Koordinate beachtet
+ double fVPD; // View Plane Distance
+ double fNearClipDist; // Abstand der vorderen Clippingebene
+ double fFarClipDist; // Abstand der hinteren Clippingebene
+
+ ProjectionType eProjection; // Art der Projektion
+ AspectMapType eAspectMapping; // Flag fuer Seitenverhaeltnis-Anpassung
+ // bei Ausgabe auf das Geraet
+ Rectangle aDeviceRect; // Position und Groesse des Ausgabebereichs
+
+ struct
+ {
+ double X, Y, W, H; // Position und Groesse des View-Windows
+ } aViewWin; // in View-Koordinaten
+
+ basegfx::B3DPoint aViewPoint; // Beobachterstandpunkt in Weltkoordinaten;
+ // wird mit der Transformation berechnet
+ sal_Bool bTfValid; // Flag, ob Transformation gueltig ist
+
+ double fWRatio; // Device/View-Seitenverhaeltnisse
+ double fHRatio;
+
+ void MakeTransform(void);
+
+ public:
+ Viewport3D();
+
+ void SetVRP(const basegfx::B3DPoint& rNewVRP);
+ void SetVPN(const basegfx::B3DVector& rNewVPN);
+ void SetVUV(const basegfx::B3DVector& rNewVUV);
+ void SetPRP(const basegfx::B3DPoint& rNewPRP);
+ void SetVPD(double fNewVPD);
+ void SetNearClipDist(double fNewNCD);
+ void SetFarClipDist(double fNewFCD);
+
+ const basegfx::B3DPoint& GetVRP() const { return aVRP; }
+ const basegfx::B3DVector& GetVPN() const { return aVPN; }
+ const basegfx::B3DVector& GetVUV() const { return aVUV; }
+ const basegfx::B3DPoint& GetPRP() const { return aPRP; }
+ double GetVPD() const { return fVPD; }
+ double GetNearClipDist() const { return fNearClipDist; }
+ double GetFarClipDist() const { return fFarClipDist; }
+
+ void SetProjection(ProjectionType ePrj)
+ { eProjection = ePrj; bTfValid = sal_False; }
+ ProjectionType GetProjection() const { return(eProjection); }
+
+ void SetAspectMapping(AspectMapType eAsp)
+ { eAspectMapping = eAsp; bTfValid = sal_False; }
+ AspectMapType GetAspectMapping() { return eAspectMapping; }
+
+ void SetViewWindow(double fX, double fY, double fW, double fH);
+ void GetViewWindow(double& rX, double& rY, double& rW, double& rH) const;
+
+ void SetDeviceWindow(const Rectangle& rRect);
+ const Rectangle& GetDeviceWindow() const { return aDeviceRect; }
+
+ // Beobachterstandpunkt in Weltkoordinaten zurueckgeben
+ const basegfx::B3DPoint& GetViewPoint();
+
+ // View-Transformationen
+ const basegfx::B3DHomMatrix& GetViewTransform();
+
+ // Projektion und Mapping
+ basegfx::B3DPoint DoProjection(const basegfx::B3DPoint& rVec) const;
+ basegfx::B3DPoint MapToDevice(const basegfx::B3DPoint& rVec) const;
+};
+
+#endif // _VIEWPT3D_HXX
diff --git a/svx/inc/svx/volume3d.hxx b/svx/inc/svx/volume3d.hxx
new file mode 100644
index 000000000000..42e90a9955a6
--- /dev/null
+++ b/svx/inc/svx/volume3d.hxx
@@ -0,0 +1,33 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _VOLUME3D_HXX
+#define _VOLUME3D_HXX
+
+#include <basegfx/range/b3drange.hxx>
+
+#endif // _VOLUME3D_HXX
diff --git a/svx/inc/svx/wrapfield.hxx b/svx/inc/svx/wrapfield.hxx
new file mode 100644
index 000000000000..1b4d745c55f8
--- /dev/null
+++ b/svx/inc/svx/wrapfield.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_WRAPFIELD_HXX
+#define SVX_WRAPFIELD_HXX
+
+#include <vcl/field.hxx>
+#include "svx/svxdllapi.h"
+
+namespace svx {
+
+// ============================================================================
+
+/** A numeric spin field that wraps around the value on limits.
+ @descr Note: Use type "NumericField" in resources. */
+class SVX_DLLPUBLIC WrapField : public NumericField
+{
+public:
+ explicit WrapField( Window* pParent, WinBits nWinStyle );
+ explicit WrapField( Window* pParent, const ResId& rResId );
+
+protected:
+ /** Up event with wrap-around functionality. */
+ virtual void Up();
+ /** Down event with wrap-around functionality. */
+ virtual void Down();
+};
+
+// ============================================================================
+
+} // namespace svx
+
+#endif
+
diff --git a/svx/inc/svx/xattr.hxx b/svx/inc/svx/xattr.hxx
new file mode 100644
index 000000000000..20035f7743e7
--- /dev/null
+++ b/svx/inc/svx/xattr.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _XATTR_HXX
+#define _XATTR_HXX
+
+// include ---------------------------------------------------------------
+
+#ifndef _XDEF_HXX
+//#include <svx/xdef.hxx>
+#endif
+#ifndef _XENUM_HXX
+//#include <svx/xenum.hxx>
+#endif
+#ifndef _XPOLY_HXX
+//#include <svx/xpoly.hxx>
+#endif
+#ifndef _SVX_RECTENUM_HXX
+//#include <svx/rectenum.hxx>
+#endif
+
+class XColorTable;
+class XDashTable;
+class XLineEndTable;
+class XHatchTable;
+class XBitmapTable;
+class XGradientTable;
+
+#include <svx/xit.hxx>
+#include <svx/xcolit.hxx>
+#include <svx/xgrad.hxx>
+#include <svx/xhatch.hxx>
+#include <svx/xlineit.hxx>
+#include <svx/xfillit.hxx>
+#include <svx/xtextit.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xtextit0.hxx>
+#include <svx/xsetit.hxx>
+#include <svx/xlinjoit.hxx>
+
+
+#endif // _XATTR_HXX
+
diff --git a/svx/inc/svx/xbitmap.hxx b/svx/inc/svx/xbitmap.hxx
new file mode 100644
index 000000000000..89104131a16a
--- /dev/null
+++ b/svx/inc/svx/xbitmap.hxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XBITMAP_HXX
+#define _SVX_XBITMAP_HXX
+
+#include <tools/color.hxx>
+#ifndef _BITMAP_HXX //autogen
+#include <vcl/bitmap.hxx>
+#endif
+#include <svtools/grfmgr.hxx>
+#include <svx/xenum.hxx>
+#include "svx/svxdllapi.h"
+
+//---------------
+// class XOBitmap
+//---------------
+
+#if defined HP9000 || defined SINIX
+static Size aXOBitmapDefaultSize( 8, 8 );
+#endif
+
+class SVX_DLLPUBLIC XOBitmap
+{
+protected:
+ XBitmapType eType;
+ XBitmapStyle eStyle;
+ GraphicObject aGraphicObject;
+ sal_uInt16* pPixelArray;
+ Size aArraySize;
+ Color aPixelColor;
+ Color aBckgrColor;
+ sal_Bool bGraphicDirty;
+
+public:
+ XOBitmap();
+ XOBitmap( const GraphicObject& rGraphicObject, XBitmapStyle eStyle = XBITMAP_TILE );
+ XOBitmap( const Bitmap& rBitmap, XBitmapStyle eStyle = XBITMAP_TILE );
+#if defined HP9000 || defined SINIX
+ XOBitmap( const sal_uInt16* pArray, const Color& aPixelColor,
+ const Color& aBckgrColor, const Size& rSize = aXOBitmapDefaultSize,
+ XBitmapStyle eStyle = XBITMAP_TILE );
+#else
+ XOBitmap( const sal_uInt16* pArray, const Color& aPixelColor,
+ const Color& aBckgrColor, const Size& rSize = Size( 8, 8 ),
+ XBitmapStyle eStyle = XBITMAP_TILE );
+#endif
+ XOBitmap( const XOBitmap& rXBmp );
+ ~XOBitmap();
+
+ XOBitmap& operator=( const XOBitmap& rXOBitmap );
+ int operator==( const XOBitmap& rXOBitmap ) const;
+
+ void Bitmap2Array();
+ void Array2Bitmap();
+
+ void SetGraphicObject( const GraphicObject& rObj ) { aGraphicObject = rObj; bGraphicDirty = sal_False; }
+ void SetBitmap( const Bitmap& rBmp ) { aGraphicObject = GraphicObject( Graphic( rBmp ) ); bGraphicDirty = sal_False; }
+ void SetBitmapType( XBitmapType eNewType ) { eType = eNewType; }
+ void SetBitmapStyle( XBitmapStyle eNewStyle ) { eStyle = eNewStyle; }
+ void SetPixelArray( const sal_uInt16* pArray );
+ void SetPixelSize( const Size& rSize ) { aArraySize = rSize; bGraphicDirty = sal_True; }
+ void SetPixelColor( const Color& rColor ) { aPixelColor = rColor; bGraphicDirty = sal_True; }
+ void SetBackgroundColor( const Color& rColor ) { aBckgrColor = rColor; bGraphicDirty = sal_True; }
+
+ XBitmapType GetBitmapType() const { return eType; }
+ XBitmapStyle GetBitmapStyle() const { return eStyle; }
+ const GraphicObject& GetGraphicObject() const;
+ Bitmap GetBitmap() const;
+ sal_uInt16* GetPixelArray() const { return pPixelArray; }
+ Color GetPixelColor() const { return aPixelColor; }
+ Color GetBackgroundColor() const { return aBckgrColor; }
+};
+
+#endif
+
diff --git a/svx/inc/svx/xbtmpit.hxx b/svx/inc/svx/xbtmpit.hxx
new file mode 100644
index 000000000000..f835507c3a4c
--- /dev/null
+++ b/svx/inc/svx/xbtmpit.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XBTMPIT_HXX
+#define _SVX_XBTMPIT_HXX
+
+#include "svx/svxdllapi.h"
+
+#include <svx/xbitmap.hxx>
+#include <svx/xit.hxx>
+
+class SdrModel;
+
+//----------------------
+// class XFillBitmapItem
+//----------------------
+class SVX_DLLPUBLIC XFillBitmapItem : public NameOrIndex
+{
+ XOBitmap aXOBitmap;
+
+public:
+ TYPEINFO();
+ XFillBitmapItem() : NameOrIndex(XATTR_FILLBITMAP, -1 ) {}
+ XFillBitmapItem( long nIndex, const XOBitmap& rTheBitmap );
+ XFillBitmapItem( const String& rName, const XOBitmap& rTheBitmap );
+ XFillBitmapItem( SfxItemPool* pPool, const XOBitmap& rTheBitmap );
+ XFillBitmapItem( SfxItemPool* pPool );
+ XFillBitmapItem( const XFillBitmapItem& rItem );
+ XFillBitmapItem( SvStream& rIn, sal_uInt16 nVer = 0 );
+
+ virtual int operator==( const SfxPoolItem& rItem ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+ virtual SvStream& Store( SvStream& rOut, sal_uInt16 nItemVersion ) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ const XOBitmap& GetBitmapValue( const XBitmapTable* pTable = 0 ) const; // GetValue -> GetBitmapValue
+ void SetBitmapValue( const XOBitmap& rNew ) { aXOBitmap = rNew; Detach(); } // SetValue -> SetBitmapValue
+
+ static sal_Bool CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 );
+ XFillBitmapItem* checkForUniqueItem( SdrModel* pModel ) const;
+};
+
+#endif
diff --git a/svx/inc/svx/xcolit.hxx b/svx/inc/svx/xcolit.hxx
new file mode 100644
index 000000000000..d2bc3f410a97
--- /dev/null
+++ b/svx/inc/svx/xcolit.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XCOLORITEM_HXX
+#define _SVX_XCOLORITEM_HXX
+
+#include <tools/color.hxx>
+#include "svx/svxdllapi.h"
+
+#include <svx/xit.hxx>
+
+class XColorTable;
+
+//-----------------
+// class XColorItem
+//-----------------
+class SVX_DLLPUBLIC XColorItem : public NameOrIndex
+{
+ Color aColor;
+
+public:
+ TYPEINFO();
+ XColorItem() {}
+ XColorItem(sal_uInt16 nWhich, sal_Int32 nIndex, const Color& rTheColor);
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ XColorItem(sal_uInt16 nWhich, const String& rName, const Color& rTheColor);
+ XColorItem(sal_uInt16 nWhich, SvStream& rIn);
+ XColorItem(const XColorItem& rItem);
+
+ virtual int operator==(const SfxPoolItem& rItem) const;
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual SvStream& Store(SvStream& rOut, sal_uInt16 nItemVersion ) const;
+
+ const Color& GetColorValue(const XColorTable* pTable = 0) const;
+ void SetColorValue(const Color& rNew) { aColor = rNew; Detach(); }
+};
+
+#endif
+
diff --git a/svx/inc/svx/xdash.hxx b/svx/inc/svx/xdash.hxx
new file mode 100644
index 000000000000..79621f11b628
--- /dev/null
+++ b/svx/inc/svx/xdash.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XDASH_HXX
+#define _SVX_XDASH_HXX
+
+//-------------
+// class XDash
+//-------------
+
+#include <svx/xenum.hxx>
+#include "svx/svxdllapi.h"
+
+#include <vector>
+
+class SVX_DLLPUBLIC XDash
+{
+protected:
+ XDashStyle eDash;
+ sal_uInt16 nDots;
+ sal_uIntPtr nDotLen;
+ sal_uInt16 nDashes;
+ sal_uIntPtr nDashLen;
+ sal_uIntPtr nDistance;
+
+public:
+ XDash(XDashStyle eDash = XDASH_RECT,
+ sal_uInt16 nDots = 1, sal_uIntPtr nDotLen = 20,
+ sal_uInt16 nDashes = 1, sal_uIntPtr nDashLen = 20, sal_uIntPtr nDistance = 20);
+
+ bool operator==(const XDash& rDash) const;
+
+ void SetDashStyle(XDashStyle eNewStyle) { eDash = eNewStyle; }
+ void SetDots(sal_uInt16 nNewDots) { nDots = nNewDots; }
+ void SetDotLen(sal_uIntPtr nNewDotLen) { nDotLen = nNewDotLen; }
+ void SetDashes(sal_uInt16 nNewDashes) { nDashes = nNewDashes; }
+ void SetDashLen(sal_uIntPtr nNewDashLen) { nDashLen = nNewDashLen; }
+ void SetDistance(sal_uIntPtr nNewDistance) { nDistance = nNewDistance; }
+
+ XDashStyle GetDashStyle() const { return eDash; }
+ sal_uInt16 GetDots() const { return nDots; }
+ sal_uIntPtr GetDotLen() const { return nDotLen; }
+ sal_uInt16 GetDashes() const { return nDashes; }
+ sal_uIntPtr GetDashLen() const { return nDashLen; }
+ sal_uIntPtr GetDistance() const { return nDistance; }
+
+ // XDash is translated into an array of doubles which describe the lengths of the
+ // dashes, dots and empty passages. It returns the complete length of the full DashDot
+ // sequence and fills the given vetor of doubles accordingly (also resizing, so deleting it).
+ double CreateDotDashArray(::std::vector< double >& rDotDashArray, double fLineWidth) const;
+};
+
+#endif
diff --git a/svx/inc/svx/xdef.hxx b/svx/inc/svx/xdef.hxx
new file mode 100644
index 000000000000..dd0fbd802291
--- /dev/null
+++ b/svx/inc/svx/xdef.hxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XDEF_HXX
+#define _XDEF_HXX
+
+/*************************************************************************
+|*
+|* Attribut einfuegen: Zeile kopieren, VOR welcher eingefuegt werden
+|* soll, Bezeichnung aendern und diese auch am Ende der darauffolgenden
+|* Zeile eintragen
+|*
+\************************************************************************/
+
+#define COL_DEFAULT_SHAPE_FILLING RGB_COLORDATA( 0xCF, 0xE7, 0xE5 )
+#define COL_DEFAULT_SHAPE_STROKE RGB_COLORDATA( 128, 128, 128 )
+
+#define XATTR_START 1000
+
+#define XATTR_LINE_FIRST XATTR_START /* V3: 1000 V2: 1000 */
+#define XATTR_LINESTYLE XATTR_LINE_FIRST
+#define XATTR_LINEDASH (XATTR_LINE_FIRST + 1) /* V3: 1001 V2: 1001 */
+#define XATTR_LINEWIDTH (XATTR_LINE_FIRST + 2) /* V3: 1002 V2: 1002 */
+#define XATTR_LINECOLOR (XATTR_LINE_FIRST + 3) /* V3: 1003 V2: 1003 */
+#define XATTR_LINESTART (XATTR_LINE_FIRST + 4) /* V3: 1004 V2: 1004 */
+#define XATTR_LINEEND (XATTR_LINE_FIRST + 5) /* V3: 1005 V2: 1005 */
+#define XATTR_LINESTARTWIDTH (XATTR_LINE_FIRST + 6) /* V3: 1006 V2: 1006 */
+#define XATTR_LINEENDWIDTH (XATTR_LINE_FIRST + 7) /* V3: 1007 V2: 1007 */
+#define XATTR_LINESTARTCENTER (XATTR_LINE_FIRST + 8) /* V3: 1008 V2: 1008 */
+#define XATTR_LINEENDCENTER (XATTR_LINE_FIRST + 9) /* V3: 1009 V2: 1009 */
+#define XATTR_LINETRANSPARENCE (XATTR_LINE_FIRST + 10) /* V3: 1010 V2: 1010 */
+#define XATTR_LINEJOINT (XATTR_LINE_FIRST + 11) /* V3: 1011 V2: 1011 */
+#define XATTR_LINE_LAST XATTR_LINEJOINT
+#define XATTRSET_LINE (XATTR_LINE_LAST + 1) /* V3: 1017 V2: 1017 */
+
+#define XATTR_FILL_FIRST (XATTRSET_LINE + 1) /* V3: 1018 V2: 1018 */
+#define XATTR_FILLSTYLE XATTR_FILL_FIRST
+#define XATTR_FILLCOLOR (XATTR_FILL_FIRST + 1) /* V3: 1019 V2: 1019 */
+#define XATTR_FILLGRADIENT (XATTR_FILL_FIRST + 2) /* V3: 1020 V2: 1020 */
+#define XATTR_FILLHATCH (XATTR_FILL_FIRST + 3) /* V3: 1021 V2: 1021 */
+#define XATTR_FILLBITMAP (XATTR_FILL_FIRST + 4) /* V3: 1022 V2: 1022 */
+#define XATTR_FILLTRANSPARENCE (XATTR_FILL_FIRST + 5) /* V3: 1023 V2: 1023 */
+#define XATTR_GRADIENTSTEPCOUNT (XATTR_FILL_FIRST + 6) /* V3: 1024 V2: 1024 */
+#define XATTR_FILLBMP_TILE (XATTR_FILL_FIRST + 7) /* V3: 1025 V2: 1025 */
+#define XATTR_FILLBMP_POS (XATTR_FILL_FIRST + 8) /* V3: 1026 V2: 1026 */
+#define XATTR_FILLBMP_SIZEX (XATTR_FILL_FIRST + 9) /* V3: 1027 V2: 1027 */
+#define XATTR_FILLBMP_SIZEY (XATTR_FILL_FIRST + 10) /* V3: 1028 V2: 1028 */
+#define XATTR_FILLFLOATTRANSPARENCE (XATTR_FILL_FIRST + 11) /* V3: 1029 V2: 1029 */
+#define XATTR_SECONDARYFILLCOLOR (XATTR_FILL_FIRST + 12) /* V3: 1030 */
+#define XATTR_FILLBMP_SIZELOG (XATTR_FILL_FIRST + 13) /* V3: 1031 */
+#define XATTR_FILLBMP_TILEOFFSETX (XATTR_FILL_FIRST + 14) /* V3: 1032 */
+#define XATTR_FILLBMP_TILEOFFSETY (XATTR_FILL_FIRST + 15) /* V3: 1033 */
+#define XATTR_FILLBMP_STRETCH (XATTR_FILL_FIRST + 16) /* V3: 1034 */
+#define XATTR_FILLBMP_POSOFFSETX (XATTR_FILL_FIRST + 17) /* V3: 1041 */
+#define XATTR_FILLBMP_POSOFFSETY (XATTR_FILL_FIRST + 18) /* V3: 1042 */
+#define XATTR_FILLBACKGROUND (XATTR_FILL_FIRST + 19) /* V3: 1043 */
+#define XATTR_FILL_LAST XATTR_FILLBACKGROUND
+#define XATTRSET_FILL (XATTR_FILL_LAST + 1) /* V3: 1047 V2: 1030 */
+
+#define XATTR_TEXT_FIRST (XATTRSET_FILL + 1)
+#define XATTR_FORMTXTSTYLE XATTR_TEXT_FIRST /* V3: 1048 V2: 1031 */
+#define XATTR_FORMTXTADJUST (XATTR_TEXT_FIRST + 1) /* V3: 1049 V2: 1032 */
+#define XATTR_FORMTXTDISTANCE (XATTR_TEXT_FIRST + 2) /* V3: 1050 V2: 1033 */
+#define XATTR_FORMTXTSTART (XATTR_TEXT_FIRST + 3) /* V3: 1051 V2: 1034 */
+#define XATTR_FORMTXTMIRROR (XATTR_TEXT_FIRST + 4) /* V3: 1052 V2: 1035 */
+#define XATTR_FORMTXTOUTLINE (XATTR_TEXT_FIRST + 5) /* V3: 1053 V2: 1036 */
+#define XATTR_FORMTXTSHADOW (XATTR_TEXT_FIRST + 6) /* V3: 1054 V2: 1037 */
+#define XATTR_FORMTXTSHDWCOLOR (XATTR_TEXT_FIRST + 7) /* V3: 1055 V2: 1038 */
+#define XATTR_FORMTXTSHDWXVAL (XATTR_TEXT_FIRST + 8) /* V3: 1056 V2: 1039 */
+#define XATTR_FORMTXTSHDWYVAL (XATTR_TEXT_FIRST + 9) /* V3: 1057 V2: 1040 */
+#define XATTR_FORMTXTSTDFORM (XATTR_TEXT_FIRST + 10) /* V3: 1058 V2: 1041 */
+#define XATTR_FORMTXTHIDEFORM (XATTR_TEXT_FIRST + 11) /* V3: 1059 V2: 1042 */
+#define XATTR_FORMTXTSHDWTRANSP (XATTR_TEXT_FIRST + 12) /* V3: 1060 V2: 1043 */
+#define XATTR_TEXT_LAST XATTR_FORMTXTSHDWTRANSP
+
+#define XATTR_END XATTR_TEXT_LAST
+
+#endif
diff --git a/svx/inc/svx/xenum.hxx b/svx/inc/svx/xenum.hxx
new file mode 100644
index 000000000000..e5b5d8adc5a8
--- /dev/null
+++ b/svx/inc/svx/xenum.hxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XENUM_HXX
+#define _XENUM_HXX
+
+enum XLineStyle { XLINE_NONE, XLINE_SOLID, XLINE_DASH };
+enum XLineJoint
+{
+ XLINEJOINT_NONE, // no rounding
+ XLINEJOINT_MIDDLE, // calc middle value between joints
+ XLINEJOINT_BEVEL, // join edges with line
+ XLINEJOINT_MITER, // extend till cut
+ XLINEJOINT_ROUND // create arc
+};
+enum XDashStyle { XDASH_RECT, XDASH_ROUND, XDASH_RECTRELATIVE,
+ XDASH_ROUNDRELATIVE };
+enum XFillStyle { XFILL_NONE, XFILL_SOLID, XFILL_GRADIENT, XFILL_HATCH,
+ XFILL_BITMAP };
+enum XGradientStyle { XGRAD_LINEAR, XGRAD_AXIAL, XGRAD_RADIAL,
+ XGRAD_ELLIPTICAL, XGRAD_SQUARE, XGRAD_RECT };
+enum XHatchStyle { XHATCH_SINGLE, XHATCH_DOUBLE, XHATCH_TRIPLE };
+enum XFormTextStyle { XFT_ROTATE, XFT_UPRIGHT, XFT_SLANTX, XFT_SLANTY,
+ XFT_NONE };
+enum XFormTextAdjust { XFT_LEFT, XFT_RIGHT, XFT_AUTOSIZE, XFT_CENTER };
+enum XFormTextShadow { XFTSHADOW_NONE, XFTSHADOW_NORMAL, XFTSHADOW_SLANT};
+enum XFormTextStdForm { XFTFORM_NONE = 0, XFTFORM_TOPCIRC, XFTFORM_BOTCIRC,
+ XFTFORM_LFTCIRC, XFTFORM_RGTCIRC, XFTFORM_TOPARC,
+ XFTFORM_BOTARC, XFTFORM_LFTARC, XFTFORM_RGTARC,
+ XFTFORM_BUTTON1, XFTFORM_BUTTON2,
+ XFTFORM_BUTTON3, XFTFORM_BUTTON4};
+enum XBitmapStyle { XBITMAP_TILE, XBITMAP_STRETCH };
+enum XBitmapType { XBITMAP_IMPORT, XBITMAP_8X8, XBITMAP_NONE,
+ XBITMAP_16X16 };
+
+
+#endif // _XENUM_HXX
+
diff --git a/svx/inc/svx/xexch.hxx b/svx/inc/svx/xexch.hxx
new file mode 100644
index 000000000000..a3b1f10c6d1c
--- /dev/null
+++ b/svx/inc/svx/xexch.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XEXCH_HXX
+#define _SVX_XEXCH_HXX
+
+
+#include <tools/stream.hxx>
+#include "svx/svxdllapi.h"
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// Clipboard-Format fuer XOutDev-Fuellattribute
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+class XFillAttrSetItem;
+class SfxItemPool;
+
+
+
+class SVX_DLLPUBLIC XFillExchangeData
+{
+private:
+ XFillAttrSetItem* pXFillAttrSetItem;
+ SfxItemPool* pPool;
+
+public:
+ TYPEINFO();
+
+ XFillExchangeData();
+ XFillExchangeData(const XFillAttrSetItem rXFillAttrSetItem);
+ virtual ~XFillExchangeData();
+
+ // Zuweisungsoperator
+ XFillExchangeData& operator=( const XFillExchangeData& rXFillExchangeData );
+
+ SVX_DLLPUBLIC friend SvStream& operator<<( SvStream& rOStm, const XFillExchangeData& rXFillExchangeData );
+ SVX_DLLPUBLIC friend SvStream& operator>>( SvStream& rIStm, XFillExchangeData& rXFillExchangeData );
+
+ static sal_uLong RegisterClipboardFormatName();
+ XFillAttrSetItem* GetXFillAttrSetItem() { return pXFillAttrSetItem; }
+};
+
+#endif // _SVX_XEXCH_HXX
diff --git a/svx/inc/svx/xfillit.hxx b/svx/inc/svx/xfillit.hxx
new file mode 100644
index 000000000000..7556140bbbf6
--- /dev/null
+++ b/svx/inc/svx/xfillit.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_FILLITEM_HXX
+#define _SVX_FILLITEM_HXX
+
+#ifndef _BITMAP_HXX //autogen
+#include <vcl/bitmap.hxx>
+#endif
+#include <svx/xcolit.hxx>
+#include <svx/xgrad.hxx>
+#include <svx/xhatch.hxx>
+#include <svx/xenum.hxx>
+#include <svl/eitem.hxx>
+
+#include <svx/xflclit.hxx>
+#include <svx/xsflclit.hxx>
+#include <svx/xflgrit.hxx>
+#include <svx/xflhtit.hxx>
+#include <svx/xbitmap.hxx>
+#include <svx/xbtmpit.hxx>
+#include <svx/xflftrit.hxx>
+
+class XGradient;
+class XOBitmap;
+
+#endif
diff --git a/svx/inc/svx/xfillit0.hxx b/svx/inc/svx/xfillit0.hxx
new file mode 100644
index 000000000000..df954983f3d2
--- /dev/null
+++ b/svx/inc/svx/xfillit0.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_XFILLIT0_HXX
+#define SVX_XFILLIT0_HXX
+
+#include <svl/eitem.hxx>
+
+#include <svx/xdef.hxx>
+#include <svx/xenum.hxx>
+#include "svx/svxdllapi.h"
+
+//---------------------
+// class XFillStyleItem
+//---------------------
+
+class SVX_DLLPUBLIC XFillStyleItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+ XFillStyleItem(XFillStyle = XFILL_SOLID);
+ XFillStyleItem(SvStream& rIn);
+
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+ virtual sal_uInt16 GetValueCount() const;
+ XFillStyle GetValue() const { return (XFillStyle) SfxEnumItem::GetValue(); }
+};
+
+#endif
+
diff --git a/svx/inc/svx/xflasit.hxx b/svx/inc/svx/xflasit.hxx
new file mode 100644
index 000000000000..f13308b613b6
--- /dev/null
+++ b/svx/inc/svx/xflasit.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XFLASIT_HXX
+#define _SVX_XFLASIT_HXX
+
+#include <svl/poolitem.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* SetItem mit dem ItemSet aller Fuellattribute
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XFillAttrSetItem : public SfxSetItem
+{
+public:
+ TYPEINFO();
+ XFillAttrSetItem(SfxItemSet* pItemSet );
+ XFillAttrSetItem(SfxItemPool* pItemPool);
+ XFillAttrSetItem(const XFillAttrSetItem& rAttr);
+ XFillAttrSetItem(const XFillAttrSetItem& rAttr,
+ SfxItemPool* pItemPool);
+ virtual SfxPoolItem* Clone( SfxItemPool* pToPool ) const;
+ virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVersion ) const;
+ virtual SvStream& Store( SvStream& rStream, sal_uInt16 nItemVersion ) const;
+};
+
+#endif
diff --git a/svx/inc/svx/xflbckit.hxx b/svx/inc/svx/xflbckit.hxx
new file mode 100644
index 000000000000..265443a8c9ac
--- /dev/null
+++ b/svx/inc/svx/xflbckit.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XFLBCKIT_HXX
+#define _SVX_XFLBCKIT_HXX
+
+#include <svl/eitem.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* Item to enable background for filled objects
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XFillBackgroundItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ XFillBackgroundItem( sal_Bool bFill = sal_False );
+ SVX_DLLPRIVATE XFillBackgroundItem( SvStream& rIn );
+
+
+ SVX_DLLPRIVATE virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const;
+ SVX_DLLPRIVATE virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+
+ SVX_DLLPRIVATE virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+};
+
+#endif
diff --git a/svx/inc/svx/xflbmpit.hxx b/svx/inc/svx/xflbmpit.hxx
new file mode 100644
index 000000000000..bb49400742b8
--- /dev/null
+++ b/svx/inc/svx/xflbmpit.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XFLBMPIT_HXX
+#define _SVX_XFLBMPIT_HXX
+
+#include <svl/eitem.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XFillBmpPosItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+ XFillBmpPosItem( RECT_POINT eRP = RP_MM );
+ SVX_DLLPRIVATE XFillBmpPosItem( SvStream& rIn );
+
+ SVX_DLLPRIVATE virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ SVX_DLLPRIVATE virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+
+ SVX_DLLPRIVATE virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ SVX_DLLPRIVATE virtual sal_uInt16 GetValueCount() const;
+ SVX_DLLPRIVATE RECT_POINT GetValue() const { return (RECT_POINT) SfxEnumItem::GetValue(); }
+};
+
+
+#endif
diff --git a/svx/inc/svx/xflbmsli.hxx b/svx/inc/svx/xflbmsli.hxx
new file mode 100644
index 000000000000..4779a76522b3
--- /dev/null
+++ b/svx/inc/svx/xflbmsli.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XFLBMSLI_HXX
+#define _SVX_XFLBMSLI_HXX
+
+#include <svl/eitem.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XFillBmpSizeLogItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+ XFillBmpSizeLogItem( sal_Bool bLog = sal_True );
+ SVX_DLLPRIVATE XFillBmpSizeLogItem( SvStream& rIn );
+
+ SVX_DLLPRIVATE virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ SVX_DLLPRIVATE virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+
+ SVX_DLLPRIVATE virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+};
+
+#endif
diff --git a/svx/inc/svx/xflbmsxy.hxx b/svx/inc/svx/xflbmsxy.hxx
new file mode 100644
index 000000000000..5d8a4cf3e9a6
--- /dev/null
+++ b/svx/inc/svx/xflbmsxy.hxx
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XFLBMSXY_HXX
+#define _SVX_XFLBMSXY_HXX
+
+#include <svl/metitem.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XFillBmpSizeXItem : public SfxMetricItem
+{
+public:
+ TYPEINFO();
+ XFillBmpSizeXItem( long nSizeX = 0 );
+ SVX_DLLPRIVATE XFillBmpSizeXItem( SvStream& rIn );
+
+ SVX_DLLPRIVATE virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ SVX_DLLPRIVATE virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+
+ SVX_DLLPRIVATE virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ // Dieses Item nimmt sowohl metrische als auch
+ // Prozentwerte ( sind negativ ) auf; das muessen
+ // wir hier beruecksichtigen
+ SVX_DLLPRIVATE virtual FASTBOOL HasMetrics() const;
+};
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XFillBmpSizeYItem : public SfxMetricItem
+{
+public:
+ TYPEINFO();
+ XFillBmpSizeYItem( long nSizeY = 0 );
+ SVX_DLLPRIVATE XFillBmpSizeYItem( SvStream& rIn );
+
+ SVX_DLLPRIVATE virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ SVX_DLLPRIVATE virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+
+ SVX_DLLPRIVATE virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ // Dieses Item nimmt sowohl metrische als auch
+ // Prozentwerte ( sind negativ ) auf; das muessen
+ // wir hier beruecksichtigen
+ SVX_DLLPRIVATE virtual FASTBOOL HasMetrics() const;
+};
+
+#endif
diff --git a/svx/inc/svx/xflbmtit.hxx b/svx/inc/svx/xflbmtit.hxx
new file mode 100644
index 000000000000..9625bab80d96
--- /dev/null
+++ b/svx/inc/svx/xflbmtit.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XFLBMTIT_HXX
+#define _SVX_XFLBMTIT_HXX
+
+#include <svl/eitem.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XFillBmpTileItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+ XFillBmpTileItem( sal_Bool bTile = sal_True );
+ XFillBmpTileItem( SvStream& rIn );
+
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const;
+ virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+};
+
+#endif
diff --git a/svx/inc/svx/xflboxy.hxx b/svx/inc/svx/xflboxy.hxx
new file mode 100644
index 000000000000..19d04ea79e9f
--- /dev/null
+++ b/svx/inc/svx/xflboxy.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XFLBOXY_HXX
+#define _SVX_XFLBOXY_HXX
+
+#include <svl/intitem.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XFillBmpPosOffsetXItem : public SfxUInt16Item
+{
+public:
+ TYPEINFO();
+ XFillBmpPosOffsetXItem( sal_uInt16 nOffPosX = 0 );
+ SVX_DLLPRIVATE XFillBmpPosOffsetXItem( SvStream& rIn );
+
+ SVX_DLLPRIVATE virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ SVX_DLLPRIVATE virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+
+ SVX_DLLPRIVATE virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+};
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XFillBmpPosOffsetYItem : public SfxUInt16Item
+{
+public:
+ TYPEINFO();
+ XFillBmpPosOffsetYItem( sal_uInt16 nOffPosY = 0 );
+ SVX_DLLPRIVATE XFillBmpPosOffsetYItem( SvStream& rIn );
+
+ SVX_DLLPRIVATE virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ SVX_DLLPRIVATE virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+
+ SVX_DLLPRIVATE virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+};
+
+#endif
diff --git a/svx/inc/svx/xflbstit.hxx b/svx/inc/svx/xflbstit.hxx
new file mode 100644
index 000000000000..b5cc2ead7d27
--- /dev/null
+++ b/svx/inc/svx/xflbstit.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XFLBSTIT_HXX
+#define _SVX_XFLBSTIT_HXX
+
+#include <svl/eitem.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XFillBmpStretchItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+ XFillBmpStretchItem( sal_Bool bStretch = sal_True );
+ XFillBmpStretchItem( SvStream& rIn );
+
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const;
+ virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+};
+
+#endif
diff --git a/svx/inc/svx/xflbtoxy.hxx b/svx/inc/svx/xflbtoxy.hxx
new file mode 100644
index 000000000000..2ca52a3e5e75
--- /dev/null
+++ b/svx/inc/svx/xflbtoxy.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XFLBTOXY_HXX
+#define _SVX_XFLBTOXY_HXX
+
+#include <svl/intitem.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XFillBmpTileOffsetXItem : public SfxUInt16Item
+{
+public:
+ TYPEINFO();
+ XFillBmpTileOffsetXItem( sal_uInt16 nOffX = 0 );
+ SVX_DLLPRIVATE XFillBmpTileOffsetXItem( SvStream& rIn );
+
+ SVX_DLLPRIVATE virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ SVX_DLLPRIVATE virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+
+ SVX_DLLPRIVATE virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+};
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XFillBmpTileOffsetYItem : public SfxUInt16Item
+{
+public:
+ TYPEINFO();
+ XFillBmpTileOffsetYItem( sal_uInt16 nOffX = 0 );
+ SVX_DLLPRIVATE XFillBmpTileOffsetYItem( SvStream& rIn );
+
+ SVX_DLLPRIVATE virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ SVX_DLLPRIVATE virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+
+ SVX_DLLPRIVATE virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+};
+
+#endif
diff --git a/svx/inc/svx/xflclit.hxx b/svx/inc/svx/xflclit.hxx
new file mode 100644
index 000000000000..367814bb4f0c
--- /dev/null
+++ b/svx/inc/svx/xflclit.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XFLCLIT_HXX
+#define _SVX_XFLCLIT_HXX
+
+#include <svx/xcolit.hxx>
+#include "svx/svxdllapi.h"
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// Fuellattribute
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------
+// class XFillColorItem
+//---------------------
+class SVX_DLLPUBLIC XFillColorItem : public XColorItem
+{
+public:
+ TYPEINFO();
+ XFillColorItem() {}
+ XFillColorItem(sal_Int32 nIndex, const Color& rTheColor);
+ XFillColorItem(const String& rName, const Color& rTheColor);
+ XFillColorItem(SvStream& rIn);
+
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+};
+
+#endif
+
diff --git a/svx/inc/svx/xflftrit.hxx b/svx/inc/svx/xflftrit.hxx
new file mode 100644
index 000000000000..9862cf7fa92e
--- /dev/null
+++ b/svx/inc/svx/xflftrit.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XFLFTRIT_HXX
+#define _SVX_XFLFTRIT_HXX
+
+#include <svx/xflgrit.hxx>
+#include "svx/svxdllapi.h"
+
+//-----------------------------------
+// class XFillFloatTransparenceItem -
+//-----------------------------------
+
+class SVX_DLLPUBLIC XFillFloatTransparenceItem : public XFillGradientItem
+{
+private:
+
+ long nDummy1;
+ long nDummy2;
+ sal_Bool bEnabled;
+
+public:
+ TYPEINFO();
+
+ XFillFloatTransparenceItem();
+ XFillFloatTransparenceItem( sal_Int32 nIndex, const XGradient& rGradient, sal_Bool bEnable = sal_True );
+ XFillFloatTransparenceItem(const String& rName, const XGradient& rGradient, sal_Bool bEnable = sal_True );
+ XFillFloatTransparenceItem(SfxItemPool* pPool, const XGradient& rTheGradient, sal_Bool bEnable = sal_True );
+ XFillFloatTransparenceItem(SfxItemPool* pPool );
+ XFillFloatTransparenceItem( const XFillFloatTransparenceItem& rItem );
+
+ virtual int operator==( const SfxPoolItem& rItem ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric, String &rText, const IntlWrapper * pIntlWrapper = 0 ) const;
+
+ sal_Bool IsEnabled() const { return bEnabled; }
+ void SetEnabled( sal_Bool bEnable ) { bEnabled = bEnable; }
+
+ static sal_Bool CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 );
+ XFillFloatTransparenceItem* checkForUniqueItem( SdrModel* pModel ) const;
+};
+
+#endif
diff --git a/svx/inc/svx/xflgrit.hxx b/svx/inc/svx/xflgrit.hxx
new file mode 100644
index 000000000000..30c918d59e21
--- /dev/null
+++ b/svx/inc/svx/xflgrit.hxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XFLGRIT_HXX
+#define _SVX_XFLGRIT_HXX
+
+#include <svx/xit.hxx>
+#include <svx/xgrad.hxx>
+#include "svx/svxdllapi.h"
+
+class SdrModel;
+
+//------------------------
+// class XFillGradientItem
+//------------------------
+class SVX_DLLPUBLIC XFillGradientItem : public NameOrIndex
+{
+ XGradient aGradient;
+
+public:
+ TYPEINFO();
+ XFillGradientItem() : NameOrIndex(XATTR_FILLGRADIENT, -1) {}
+ XFillGradientItem(sal_Int32 nIndex, const XGradient& rTheGradient);
+ XFillGradientItem(const UniString& rName, const XGradient& rTheGradient);
+ XFillGradientItem(SfxItemPool* pPool, const XGradient& rTheGradient);
+ XFillGradientItem(SfxItemPool* pPool );
+ XFillGradientItem(const XFillGradientItem& rItem);
+ XFillGradientItem(SvStream& rIn, sal_uInt16 nVer = 0);
+
+ virtual int operator==(const SfxPoolItem& rItem) const;
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual SvStream& Store(SvStream& rOut, sal_uInt16 nItemVersion ) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+ const XGradient& GetGradientValue(const XGradientTable* pTable = 0) const; // GetValue -> GetGradientValue
+ void SetGradientValue(const XGradient& rNew) { aGradient = rNew; Detach(); } // SetValue -> SetGradientValue
+
+ static sal_Bool CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 );
+ XFillGradientItem* checkForUniqueItem( SdrModel* pModel ) const;
+};
+
+#endif
+
diff --git a/svx/inc/svx/xflhtit.hxx b/svx/inc/svx/xflhtit.hxx
new file mode 100644
index 000000000000..a666381dd4e3
--- /dev/null
+++ b/svx/inc/svx/xflhtit.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XFLHTIT_HXX
+#define _SVX_XFLHTIT_HXX
+
+#include <svx/xit.hxx>
+#include <svx/xhatch.hxx>
+#include "svx/svxdllapi.h"
+
+class SdrModel;
+
+//---------------------
+// class XFillHatchItem
+//---------------------
+class SVX_DLLPUBLIC XFillHatchItem : public NameOrIndex
+{
+ XHatch aHatch;
+
+public:
+ TYPEINFO();
+ XFillHatchItem() : NameOrIndex(XATTR_FILLHATCH, -1) {}
+ XFillHatchItem(sal_Int32 nIndex, const XHatch& rTheHatch);
+ XFillHatchItem(const String& rName, const XHatch& rTheHatch);
+ XFillHatchItem(SfxItemPool* pPool, const XHatch& rTheHatch);
+ XFillHatchItem(SfxItemPool* pPool );
+ XFillHatchItem(const XFillHatchItem& rItem);
+ XFillHatchItem(SvStream& rIn);
+
+ virtual int operator==(const SfxPoolItem& rItem) const;
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual SvStream& Store(SvStream& rOut, sal_uInt16 nItemVersion ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+ virtual FASTBOOL HasMetrics() const;
+ virtual FASTBOOL ScaleMetrics(long nMul, long nDiv);
+
+ const XHatch& GetHatchValue(const XHatchTable* pTable = 0) const; // GetValue -> GetHatchValue
+ void SetHatchValue(const XHatch& rNew) { aHatch = rNew; Detach(); } // SetValue -> SetHatchValue
+
+ static sal_Bool CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 );
+ XFillHatchItem* checkForUniqueItem( SdrModel* pModel ) const;
+};
+
+#endif
+
diff --git a/svx/inc/svx/xfltrit.hxx b/svx/inc/svx/xfltrit.hxx
new file mode 100644
index 000000000000..9f2bab545579
--- /dev/null
+++ b/svx/inc/svx/xfltrit.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XFLTRIT_HXX
+#define _SVX_XFLTRIT_HXX
+
+#include <svl/intitem.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* Transparenz-Item fuer Fuellungen (Solid)
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XFillTransparenceItem: public SfxUInt16Item
+{
+public:
+ TYPEINFO();
+ XFillTransparenceItem(sal_uInt16 nFillTransparence = 0);
+ XFillTransparenceItem(SvStream& rIn);
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = NULL) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+};
+
+#endif
diff --git a/svx/inc/svx/xftadit.hxx b/svx/inc/svx/xftadit.hxx
new file mode 100644
index 000000000000..e73033dee160
--- /dev/null
+++ b/svx/inc/svx/xftadit.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XFTADIT_HXX
+#define _SVX_XFTADIT_HXX
+
+#include <svl/eitem.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* FormText-AdjustItem
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XFormTextAdjustItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+ XFormTextAdjustItem(XFormTextAdjust = XFT_CENTER);
+ XFormTextAdjustItem(SvStream& rIn);
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual sal_uInt16 GetValueCount() const;
+ XFormTextAdjust GetValue() const { return (XFormTextAdjust) SfxEnumItem::GetValue(); }
+ // #FontWork#
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+#endif
diff --git a/svx/inc/svx/xftdiit.hxx b/svx/inc/svx/xftdiit.hxx
new file mode 100644
index 000000000000..d0ba783761ea
--- /dev/null
+++ b/svx/inc/svx/xftdiit.hxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XFTDIIT_HXX
+#define _SVX_XFTDIIT_HXX
+
+#include <svl/metitem.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* FormText-DistanceItem
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XFormTextDistanceItem : public SfxMetricItem
+{
+public:
+ TYPEINFO();
+ XFormTextDistanceItem(long nDist = 0);
+ XFormTextDistanceItem(SvStream& rIn);
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+};
+
+#endif
diff --git a/svx/inc/svx/xftmrit.hxx b/svx/inc/svx/xftmrit.hxx
new file mode 100644
index 000000000000..742268f5e333
--- /dev/null
+++ b/svx/inc/svx/xftmrit.hxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XFTMRIT_HXX
+#define _SVX_XFTMRIT_HXX
+
+#include <svl/eitem.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* FormText-MirrorItem
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XFormTextMirrorItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+ XFormTextMirrorItem(sal_Bool bMirror = sal_False);
+ XFormTextMirrorItem(SvStream& rIn);
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+};
+
+#endif
diff --git a/svx/inc/svx/xftouit.hxx b/svx/inc/svx/xftouit.hxx
new file mode 100644
index 000000000000..11382718f5d9
--- /dev/null
+++ b/svx/inc/svx/xftouit.hxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XFTOUIT_HXX
+#define _SVX_XFTOUIT_HXX
+
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* FormText-OutlineItem
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XFormTextOutlineItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+ XFormTextOutlineItem(sal_Bool bOutline = sal_False);
+ XFormTextOutlineItem(SvStream& rIn);
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+};
+
+#endif
+
diff --git a/svx/inc/svx/xftsfit.hxx b/svx/inc/svx/xftsfit.hxx
new file mode 100644
index 000000000000..22feb75be0f7
--- /dev/null
+++ b/svx/inc/svx/xftsfit.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XFTSFIT_HXX
+#define _SVX_XFTSFIT_HXX
+
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* FormText-StdFormItem
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XFormTextStdFormItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+ XFormTextStdFormItem(XFormTextStdForm = XFTFORM_NONE);
+ XFormTextStdFormItem(SvStream& rIn);
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual sal_uInt16 GetValueCount() const;
+ XFormTextStdForm GetValue() const { return (XFormTextStdForm) SfxEnumItem::GetValue(); }
+ // #FontWork#
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+#endif
+
diff --git a/svx/inc/svx/xftshcit.hxx b/svx/inc/svx/xftshcit.hxx
new file mode 100644
index 000000000000..fc473db4bb47
--- /dev/null
+++ b/svx/inc/svx/xftshcit.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XFTSHCLIT_HXX
+#define _SVX_XFTSHCLIT_HXX
+
+#include <svx/xcolit.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* FormText-ShadowColorItem
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XFormTextShadowColorItem : public XColorItem
+{
+public:
+ TYPEINFO();
+ XFormTextShadowColorItem() {}
+ XFormTextShadowColorItem(sal_Int32 nIndex, const Color& rTheColor);
+ XFormTextShadowColorItem(const String& rName, const Color& rTheColor);
+ XFormTextShadowColorItem(SvStream& rIn);
+
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+};
+
+#endif
diff --git a/svx/inc/svx/xftshit.hxx b/svx/inc/svx/xftshit.hxx
new file mode 100644
index 000000000000..6bd8c12c02cf
--- /dev/null
+++ b/svx/inc/svx/xftshit.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XFTSHIT_HXX
+#define _SVX_XFTSHIT_HXX
+
+#include <svl/eitem.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* FormText-ShadowItem
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XFormTextShadowItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+ XFormTextShadowItem(XFormTextShadow = XFTSHADOW_NONE);
+ XFormTextShadowItem(SvStream& rIn);
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual sal_uInt16 GetValueCount() const;
+ XFormTextShadow GetValue() const { return (XFormTextShadow) SfxEnumItem::GetValue(); }
+ // #FontWork#
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+#endif
+
diff --git a/svx/inc/svx/xftshtit.hxx b/svx/inc/svx/xftshtit.hxx
new file mode 100644
index 000000000000..9a959c246e0e
--- /dev/null
+++ b/svx/inc/svx/xftshtit.hxx
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XFTSHTIT_HXX
+#define _SVX_XFTSHTIT_HXX
+
+#include <svl/intitem.hxx>
+
+/*************************************************************************
+|*
+|* FormText-Item fuer transparents Schatten
+|*
+\************************************************************************/
+
+class XFormTextShadowTranspItem: public SfxUInt16Item
+{
+public:
+ TYPEINFO();
+ XFormTextShadowTranspItem(sal_uInt16 nShdwTransparence = 0);
+ XFormTextShadowTranspItem(SvStream& rIn);
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = NULL) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+};
+
+#endif
diff --git a/svx/inc/svx/xftshxy.hxx b/svx/inc/svx/xftshxy.hxx
new file mode 100644
index 000000000000..cc43565834b3
--- /dev/null
+++ b/svx/inc/svx/xftshxy.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XFTSHXY_HXX
+#define _SVX_XFTSHXY_HXX
+
+#include <svl/metitem.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* FormText-ShadowXValItem
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XFormTextShadowXValItem : public SfxMetricItem
+{
+public:
+ TYPEINFO();
+ XFormTextShadowXValItem(long nVal = 0);
+ XFormTextShadowXValItem(SvStream& rIn);
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+};
+
+/*************************************************************************
+|*
+|* FormText-ShadowYValItem
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XFormTextShadowYValItem : public SfxMetricItem
+{
+public:
+ TYPEINFO();
+ XFormTextShadowYValItem(long nVal = 0);
+ XFormTextShadowYValItem(SvStream& rIn);
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+};
+
+#endif
+
diff --git a/svx/inc/svx/xftstit.hxx b/svx/inc/svx/xftstit.hxx
new file mode 100644
index 000000000000..e55a8f8ccaa4
--- /dev/null
+++ b/svx/inc/svx/xftstit.hxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XFTSTIT_HXX
+#define _SVX_XFTSTIT_HXX
+
+#include <svl/metitem.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* FormText-StartPositionItem
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XFormTextStartItem : public SfxMetricItem
+{
+public:
+ TYPEINFO();
+ XFormTextStartItem(long nStart = 0);
+ XFormTextStartItem(SvStream& rIn);
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+};
+
+#endif
diff --git a/svx/inc/svx/xgrad.hxx b/svx/inc/svx/xgrad.hxx
new file mode 100644
index 000000000000..313c2c2dd6c1
--- /dev/null
+++ b/svx/inc/svx/xgrad.hxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX__XGRADIENT_HXX
+#define _SVX__XGRADIENT_HXX
+
+#include <svx/xenum.hxx>
+#include <tools/color.hxx>
+#include "svx/svxdllapi.h"
+
+//-----------------
+// class XGradient
+//-----------------
+
+class SVX_DLLPUBLIC XGradient
+{
+protected:
+ XGradientStyle eStyle;
+ Color aStartColor;
+ Color aEndColor;
+ long nAngle;
+ sal_uInt16 nBorder;
+ sal_uInt16 nOfsX;
+ sal_uInt16 nOfsY;
+ sal_uInt16 nIntensStart;
+ sal_uInt16 nIntensEnd;
+ sal_uInt16 nStepCount;
+
+public:
+ XGradient();
+ XGradient( const Color& rStart, const Color& rEnd,
+ XGradientStyle eStyle = XGRAD_LINEAR, long nAngle = 0,
+ sal_uInt16 nXOfs = 50, sal_uInt16 nYOfs = 50, sal_uInt16 nBorder = 0,
+ sal_uInt16 nStartIntens = 100, sal_uInt16 nEndIntens = 100,
+ sal_uInt16 nSteps = 0 );
+
+ bool operator==(const XGradient& rGradient) const;
+
+ void SetGradientStyle(XGradientStyle eNewStyle) { eStyle = eNewStyle; }
+ void SetStartColor(const Color& rColor) { aStartColor = rColor; }
+ void SetEndColor(const Color& rColor) { aEndColor = rColor; }
+ void SetAngle(long nNewAngle) { nAngle = nNewAngle; }
+ void SetBorder(sal_uInt16 nNewBorder) { nBorder = nNewBorder; }
+ void SetXOffset(sal_uInt16 nNewOffset) { nOfsX = nNewOffset; }
+ void SetYOffset(sal_uInt16 nNewOffset) { nOfsY = nNewOffset; }
+ void SetStartIntens(sal_uInt16 nNewIntens) { nIntensStart = nNewIntens; }
+ void SetEndIntens(sal_uInt16 nNewIntens) { nIntensEnd = nNewIntens; }
+ void SetSteps(sal_uInt16 nSteps) { nStepCount = nSteps; }
+
+ XGradientStyle GetGradientStyle() const { return eStyle; }
+ Color GetStartColor() const { return aStartColor; }
+ Color GetEndColor() const { return aEndColor; }
+ long GetAngle() const { return nAngle; }
+ sal_uInt16 GetBorder() const { return nBorder; }
+ sal_uInt16 GetXOffset() const { return nOfsX; }
+ sal_uInt16 GetYOffset() const { return nOfsY; }
+ sal_uInt16 GetStartIntens() const { return nIntensStart; }
+ sal_uInt16 GetEndIntens() const { return nIntensEnd; }
+ sal_uInt16 GetSteps() const { return nStepCount; }
+};
+
+#endif
diff --git a/svx/inc/svx/xgrscit.hxx b/svx/inc/svx/xgrscit.hxx
new file mode 100644
index 000000000000..69f0941b3972
--- /dev/null
+++ b/svx/inc/svx/xgrscit.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XGRSCIT_HXX
+#define _SVX_XGRSCIT_HXX
+
+#include <svl/intitem.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* GradientenSchritte-Item fuer Gradienten-Fuellungen
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XGradientStepCountItem: public SfxUInt16Item
+{
+public:
+ TYPEINFO();
+ XGradientStepCountItem( sal_uInt16 nStepCount = 0 );
+ XGradientStepCountItem( SvStream& rIn );
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const;
+ virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+};
+
+#endif
diff --git a/svx/inc/svx/xhatch.hxx b/svx/inc/svx/xhatch.hxx
new file mode 100644
index 000000000000..731f8084f8a0
--- /dev/null
+++ b/svx/inc/svx/xhatch.hxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XHATCH_HXX
+#define _SVX_XHATCH_HXX
+
+#include <svx/xenum.hxx>
+#include <tools/color.hxx>
+#include "svx/svxdllapi.h"
+
+//--------------
+// class XHatch
+//--------------
+
+class SVX_DLLPUBLIC XHatch
+{
+protected:
+ XHatchStyle eStyle;
+ Color aColor;
+ long nDistance;
+ long nAngle;
+
+public:
+ XHatch() : eStyle(XHATCH_SINGLE), nDistance(0), nAngle(0) {}
+ XHatch(const Color& rCol, XHatchStyle eStyle = XHATCH_SINGLE,
+ long nDistance = 20, long nAngle = 0);
+
+ bool operator==(const XHatch& rHatch) const;
+
+ void SetHatchStyle(XHatchStyle eNewStyle) { eStyle = eNewStyle; }
+ void SetColor(const Color& rColor) { aColor = rColor; }
+ void SetDistance(long nNewDistance) { nDistance = nNewDistance; }
+ void SetAngle(long nNewAngle) { nAngle = nNewAngle; }
+
+ XHatchStyle GetHatchStyle() const { return eStyle; }
+ Color GetColor() const { return aColor; }
+ long GetDistance() const { return nDistance; }
+ long GetAngle() const { return nAngle; }
+};
+
+#endif
diff --git a/svx/inc/svx/xit.hxx b/svx/inc/svx/xit.hxx
new file mode 100644
index 000000000000..aa68537d2173
--- /dev/null
+++ b/svx/inc/svx/xit.hxx
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XIT_HXX
+#define _SVX_XIT_HXX
+
+#include <svl/stritem.hxx>
+#include <svx/xdef.hxx>
+#include "svx/svxdllapi.h"
+
+/************************************************************************/
+
+class XColorTable;
+class XDashTable;
+class XLineEndTable;
+class XHatchTable;
+class XBitmapTable;
+class XGradientTable;
+class SfxItemPool;
+class NameOrIndex;
+class XPropertyList;
+
+typedef sal_Bool (*SvxCompareValueFunc)( const NameOrIndex* p1, const NameOrIndex* p2 );
+
+//-------------------
+// class NameOrIndex
+//-------------------
+class SVX_DLLPUBLIC NameOrIndex : public SfxStringItem
+{
+ sal_Int32 nPalIndex;
+
+protected:
+ void Detach() { nPalIndex = -1; }
+
+public:
+ TYPEINFO();
+ NameOrIndex() { nPalIndex = -1; }
+ NameOrIndex(sal_uInt16 nWhich, sal_Int32 nIndex);
+ NameOrIndex(sal_uInt16 nWhich,
+ const String& rName= String());
+ NameOrIndex(sal_uInt16 nWhich, SvStream& rIn);
+ NameOrIndex(const NameOrIndex& rNameOrIndex);
+ ~NameOrIndex() {};
+
+ virtual int operator==(const SfxPoolItem& rItem) const;
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual SvStream& Store(SvStream& rOut, sal_uInt16 nItemVersion ) const;
+
+ String GetName() const { return GetValue(); }
+ void SetName(const String& rName) { SetValue(rName); }
+ sal_Int32 GetIndex() const { return nPalIndex; }
+ void SetIndex(sal_Int32 nIndex) { nPalIndex = nIndex; }
+ sal_Bool IsIndex() const { return (nPalIndex >= 0); }
+
+ /** this static checks if the given NameOrIndex item has a unique name for its value.
+ The returned String is a unique name for an item with this value in both given pools.
+ Argument pPool2 can be null.
+ If returned string equals NameOrIndex->GetName(), the name was already unique.
+ */
+ static String CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uInt16 nWhich, const SfxItemPool* pPool1, const SfxItemPool* pPool2, SvxCompareValueFunc pCompareValueFunc, sal_uInt16 nPrefixResId, XPropertyList* pDefaults = NULL );
+};
+
+#endif
diff --git a/svx/inc/svx/xlineit.hxx b/svx/inc/svx/xlineit.hxx
new file mode 100644
index 000000000000..ac70a901d4fb
--- /dev/null
+++ b/svx/inc/svx/xlineit.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XLINIIT_HXX
+#define _SVX_XLINIIT_HXX
+
+#include <svx/xit.hxx>
+#include <svx/xcolit.hxx>
+#include <svx/xpoly.hxx>
+#include <svx/xenum.hxx>
+#include <svl/metitem.hxx>
+#include <svl/eitem.hxx>
+
+class XDash;
+class XDashTable;
+class SvStream;
+
+#include <svx/xdash.hxx>
+#include <svx/xlndsit.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/xlnedit.hxx>
+#include <svx/xlnstwit.hxx>
+#include <svx/xlnedwit.hxx>
+#include <svx/xlnstcit.hxx>
+#include <svx/xlnedcit.hxx>
+
+#endif
+
diff --git a/svx/inc/svx/xlineit0.hxx b/svx/inc/svx/xlineit0.hxx
new file mode 100644
index 000000000000..a30af2c1a86a
--- /dev/null
+++ b/svx/inc/svx/xlineit0.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XLINEIT0_HXX
+#define _SVX_XLINEIT0_HXX
+
+#include <svx/xenum.hxx>
+#include <svl/eitem.hxx>
+//---------------------
+// class LineStyleItem
+//---------------------
+#include "svx/svxdllapi.h"
+
+class SVX_DLLPUBLIC XLineStyleItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+ XLineStyleItem(XLineStyle = XLINE_SOLID);
+ XLineStyleItem(SvStream& rIn);
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+ virtual sal_uInt16 GetValueCount() const;
+ XLineStyle GetValue() const { return (XLineStyle) SfxEnumItem::GetValue(); }
+};
+
+#endif
+
diff --git a/svx/inc/svx/xlinjoit.hxx b/svx/inc/svx/xlinjoit.hxx
new file mode 100644
index 000000000000..97a8d4142bd6
--- /dev/null
+++ b/svx/inc/svx/xlinjoit.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XLINJOIT_HXX
+#define _SVX_XLINJOIT_HXX
+
+#include <svl/eitem.hxx>
+#include <svx/xenum.hxx>
+#include "svx/svxdllapi.h"
+
+//---------------------
+// class LineStyleItem
+//---------------------
+
+class SVX_DLLPUBLIC XLineJointItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+ XLineJointItem( XLineJoint eLineJoint = XLINEJOINT_ROUND );
+ XLineJointItem( SvStream& rIn );
+
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ virtual sal_uInt16 GetValueCount() const;
+ XLineJoint GetValue() const { return (XLineJoint) SfxEnumItem::GetValue(); }
+};
+
+#endif // _SVX_XLINJOIT_HXX
diff --git a/svx/inc/svx/xlnasit.hxx b/svx/inc/svx/xlnasit.hxx
new file mode 100644
index 000000000000..2b1da62d6d88
--- /dev/null
+++ b/svx/inc/svx/xlnasit.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XLNASIT_HXX
+#define _SVX_XLNASIT_HXX
+
+
+#include <svl/poolitem.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* SetItem mit dem ItemSet aller Linienattribute
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XLineAttrSetItem : public SfxSetItem
+{
+public:
+ TYPEINFO();
+ XLineAttrSetItem(SfxItemSet* pItemSet );
+ XLineAttrSetItem(SfxItemPool* pItemPool);
+ XLineAttrSetItem(const XLineAttrSetItem& rAttr);
+ XLineAttrSetItem(const XLineAttrSetItem& rAttr,
+ SfxItemPool* pItemPool);
+ virtual SfxPoolItem* Clone( SfxItemPool* pToPool ) const;
+ virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVersion ) const;
+ virtual SvStream& Store( SvStream& rStream, sal_uInt16 nItemVersion ) const;
+};
+
+#endif
diff --git a/svx/inc/svx/xlnclit.hxx b/svx/inc/svx/xlnclit.hxx
new file mode 100644
index 000000000000..ba34121c756b
--- /dev/null
+++ b/svx/inc/svx/xlnclit.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XLNCLIT_HXX
+#define _SVX_XLNCLIT_HXX
+
+#include <svx/xcolit.hxx>
+#include "svx/svxdllapi.h"
+
+//---------------------
+// class XLineColorItem
+//---------------------
+class SVX_DLLPUBLIC XLineColorItem : public XColorItem
+{
+public:
+ TYPEINFO();
+ XLineColorItem() {}
+ XLineColorItem(sal_Int32 nIndex, const Color& rTheColor);
+ XLineColorItem(const String& rName, const Color& rTheColor);
+ XLineColorItem(SvStream& rIn);
+
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+};
+
+#endif
diff --git a/svx/inc/svx/xlndsit.hxx b/svx/inc/svx/xlndsit.hxx
new file mode 100644
index 000000000000..0cfefadb550c
--- /dev/null
+++ b/svx/inc/svx/xlndsit.hxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XLNDSIT_HXX
+#define _SVX_XLNDSIT_HXX
+
+#include <svx/xit.hxx>
+
+#ifndef _SVX_XLINIIT_HXX //autogen
+#include <svx/xdash.hxx>
+#endif
+#include "svx/svxdllapi.h"
+
+class SdrModel;
+
+//--------------------
+// class XLineDashItem
+//--------------------
+class SVX_DLLPUBLIC XLineDashItem : public NameOrIndex
+{
+ XDash aDash;
+
+public:
+ TYPEINFO();
+ XLineDashItem() : NameOrIndex(XATTR_LINEDASH, -1) {}
+ XLineDashItem(sal_Int32 nIndex, const XDash& rTheDash);
+ XLineDashItem(const String& rName, const XDash& rTheDash);
+ XLineDashItem(SfxItemPool* pPool, const XDash& rTheDash);
+ XLineDashItem(SfxItemPool* pPool );
+ XLineDashItem(const XLineDashItem& rItem);
+ XLineDashItem(SvStream& rIn);
+
+ virtual int operator==(const SfxPoolItem& rItem) const;
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual SvStream& Store(SvStream& rOut, sal_uInt16 nItemVersion ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+ virtual FASTBOOL HasMetrics() const;
+ virtual FASTBOOL ScaleMetrics(long nMul, long nDiv);
+
+ const XDash& GetDashValue(const XDashTable* pTable = 0) const; // GetValue -> GetDashValue
+ void SetDashValue(const XDash& rNew) { aDash = rNew; Detach(); } // SetValue -> SetDashValue
+
+ static sal_Bool CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 );
+ XLineDashItem* checkForUniqueItem( SdrModel* pModel ) const;
+};
+
+#endif
+
diff --git a/svx/inc/svx/xlnedcit.hxx b/svx/inc/svx/xlnedcit.hxx
new file mode 100644
index 000000000000..43dafb8e08f5
--- /dev/null
+++ b/svx/inc/svx/xlnedcit.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XLNEDCIT_HXX
+#define _SVX_XLNEDCIT_HXX
+
+#include <svl/eitem.hxx>
+#include "svx/svxdllapi.h"
+
+//----------------------------
+// class XLineEndCenterItem
+//----------------------------
+class SVX_DLLPUBLIC XLineEndCenterItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+ XLineEndCenterItem(sal_Bool bEndCenter = sal_False);
+ XLineEndCenterItem(SvStream& rIn);
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+};
+
+#endif
diff --git a/svx/inc/svx/xlnedit.hxx b/svx/inc/svx/xlnedit.hxx
new file mode 100644
index 000000000000..1a999f903794
--- /dev/null
+++ b/svx/inc/svx/xlnedit.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XLNEDIT_HXX
+#define _SVX_XLNEDIT_HXX
+
+#include <svx/xit.hxx>
+#include "svx/svxdllapi.h"
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+class SdrModel;
+
+//----------------------
+// class XLineEndItem
+//----------------------
+class SVX_DLLPUBLIC XLineEndItem : public NameOrIndex
+{
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+public:
+ TYPEINFO();
+ XLineEndItem(sal_Int32 nIndex = -1);
+ XLineEndItem(const String& rName, const basegfx::B2DPolyPolygon& rPolyPolygon);
+ XLineEndItem(SfxItemPool* pPool, const basegfx::B2DPolyPolygon& rPolyPolygon);
+ XLineEndItem(SfxItemPool* pPool );
+ XLineEndItem(const XLineEndItem& rItem);
+ XLineEndItem(SvStream& rIn);
+
+ virtual int operator==(const SfxPoolItem& rItem) const;
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual SvStream& Store(SvStream& rOut, sal_uInt16 nItemVersion ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ basegfx::B2DPolyPolygon GetLineEndValue(const XLineEndTable* pTable = 0) const;
+ void SetLineEndValue(const basegfx::B2DPolyPolygon& rPolyPolygon) { maPolyPolygon = rPolyPolygon; Detach(); }
+
+ XLineEndItem* checkForUniqueItem( SdrModel* pModel ) const;
+};
+
+#endif
diff --git a/svx/inc/svx/xlnedwit.hxx b/svx/inc/svx/xlnedwit.hxx
new file mode 100644
index 000000000000..dcfebeaa997f
--- /dev/null
+++ b/svx/inc/svx/xlnedwit.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XLNEDWIT_HXX
+#define _SVX_XLNEDWIT_HXX
+
+#include <svl/metitem.hxx>
+#include "svx/svxdllapi.h"
+
+#define LINE_END_WIDTH_DEFAULT (200)
+
+//---------------------------
+// class XLineEndWidthItem
+//---------------------------
+
+class SVX_DLLPUBLIC XLineEndWidthItem : public SfxMetricItem
+{
+public:
+ TYPEINFO();
+ XLineEndWidthItem(long nWidth = LINE_END_WIDTH_DEFAULT);
+ XLineEndWidthItem(SvStream& rIn);
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+};
+
+#endif
+
diff --git a/svx/inc/svx/xlnstcit.hxx b/svx/inc/svx/xlnstcit.hxx
new file mode 100644
index 000000000000..e3f5ddaf97ed
--- /dev/null
+++ b/svx/inc/svx/xlnstcit.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XLNSTCIT_HXX
+#define _SVX_XLNSTCIT_HXX
+
+#include <svl/eitem.hxx>
+#include "svx/svxdllapi.h"
+
+//------------------------------
+// class XLineStartCenterItem
+//------------------------------
+class SVX_DLLPUBLIC XLineStartCenterItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+ XLineStartCenterItem(sal_Bool bStartCenter = sal_False);
+ XLineStartCenterItem(SvStream& rIn);
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+};
+
+#endif
+
diff --git a/svx/inc/svx/xlnstit.hxx b/svx/inc/svx/xlnstit.hxx
new file mode 100644
index 000000000000..26f8d092e0ab
--- /dev/null
+++ b/svx/inc/svx/xlnstit.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XLNSTIT_HXX
+#define _SVX_XLNSTIT_HXX
+
+#include <svx/xit.hxx>
+#include "svx/svxdllapi.h"
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+class SdrModel;
+
+//------------------------
+// class XLineStartItem
+//------------------------
+class SVX_DLLPUBLIC XLineStartItem : public NameOrIndex
+{
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+public:
+ TYPEINFO();
+ XLineStartItem(sal_Int32 nIndex = -1);
+ XLineStartItem(const String& rName, const basegfx::B2DPolyPolygon& rPolyPolygon);
+ XLineStartItem(SfxItemPool* pPool, const basegfx::B2DPolyPolygon& rPolyPolygon);
+ XLineStartItem(SfxItemPool* pPool );
+ XLineStartItem(const XLineStartItem& rItem);
+ XLineStartItem(SvStream& rIn);
+
+ virtual int operator==(const SfxPoolItem& rItem) const;
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual SvStream& Store(SvStream& rOut, sal_uInt16 nItemVersion ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ basegfx::B2DPolyPolygon GetLineStartValue(const XLineEndTable* pTable = 0) const;
+ void SetLineStartValue(const basegfx::B2DPolyPolygon& rPolyPolygon) { maPolyPolygon = rPolyPolygon; Detach(); }
+
+ XLineStartItem* checkForUniqueItem( SdrModel* pModel ) const;
+};
+
+#endif
diff --git a/svx/inc/svx/xlnstwit.hxx b/svx/inc/svx/xlnstwit.hxx
new file mode 100644
index 000000000000..7675ac4ce821
--- /dev/null
+++ b/svx/inc/svx/xlnstwit.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XLNSTWIT_HXX
+#define _SVX_XLNSTWIT_HXX
+
+#include <svl/metitem.hxx>
+#include "svx/svxdllapi.h"
+
+#define LINE_START_WIDTH_DEFAULT (200)
+
+//-----------------------------
+// class XLineStartWidthItem
+//-----------------------------
+class SVX_DLLPUBLIC XLineStartWidthItem : public SfxMetricItem
+{
+public:
+ TYPEINFO();
+ XLineStartWidthItem(long nWidth = LINE_START_WIDTH_DEFAULT);
+ XLineStartWidthItem(SvStream& rIn);
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+};
+
+#endif
diff --git a/svx/inc/svx/xlntrit.hxx b/svx/inc/svx/xlntrit.hxx
new file mode 100644
index 000000000000..91c8e8d87bb9
--- /dev/null
+++ b/svx/inc/svx/xlntrit.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XLNTRIT_HXX
+#define _SVX_XLNTRIT_HXX
+
+#include <svl/intitem.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* Transparenz-Item fuer Linien
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XLineTransparenceItem: public SfxUInt16Item
+{
+public:
+ TYPEINFO();
+ XLineTransparenceItem(sal_uInt16 nLineTransparence = 0);
+ XLineTransparenceItem(SvStream& rIn);
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = NULL) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+};
+
+#endif
diff --git a/svx/inc/svx/xlnwtit.hxx b/svx/inc/svx/xlnwtit.hxx
new file mode 100644
index 000000000000..143b786923ff
--- /dev/null
+++ b/svx/inc/svx/xlnwtit.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XLNWTIT_HXX
+#define _SVX_XLNWTIT_HXX
+
+#include <svl/metitem.hxx>
+#include "svx/svxdllapi.h"
+
+//---------------------
+// class XLineWidthItem
+//---------------------
+class SVX_DLLPUBLIC XLineWidthItem : public SfxMetricItem
+{
+public:
+ TYPEINFO();
+ XLineWidthItem(long nWidth = 0);
+ XLineWidthItem(SvStream& rIn);
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+};
+
+#endif
diff --git a/svx/inc/svx/xmleohlp.hxx b/svx/inc/svx/xmleohlp.hxx
new file mode 100644
index 000000000000..211e17ca1801
--- /dev/null
+++ b/svx/inc/svx/xmleohlp.hxx
@@ -0,0 +1,149 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XMLEOHLP_HXX
+#define _XMLEOHLP_HXX
+
+#include <cppuhelper/compbase2.hxx>
+#include <osl/mutex.hxx>
+#include <sot/storage.hxx>
+#include <map>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/document/XEmbeddedObjectResolver.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include "svx/svxdllapi.h"
+
+// -----------------------------
+// - SvXMLEmbeddedObjectHelper -
+// -----------------------------
+
+enum SvXMLEmbeddedObjectHelperMode
+{
+ EMBEDDEDOBJECTHELPER_MODE_READ = 0,
+ EMBEDDEDOBJECTHELPER_MODE_WRITE = 1
+};
+
+// -----------------------------
+// - SvXMLEmbeddedObjectHelper -
+// -----------------------------
+
+namespace comphelper {
+class IEmbeddedHelper;
+}
+class SvGlobalName;
+struct OUStringLess;
+class OutputStorageWrapper_Impl;
+
+class SVX_DLLPUBLIC SvXMLEmbeddedObjectHelper : public ::cppu::WeakComponentImplHelper2<
+ ::com::sun::star::document::XEmbeddedObjectResolver,
+ ::com::sun::star::container::XNameAccess >
+{
+ typedef ::std::map< ::rtl::OUString, OutputStorageWrapper_Impl*,
+ OUStringLess > SvXMLEmbeddedObjectHelper_Impl;
+private:
+
+ ::osl::Mutex maMutex;
+
+ const ::rtl::OUString maReplacementGraphicsContainerStorageName;
+ const ::rtl::OUString maReplacementGraphicsContainerStorageName60;
+ ::rtl::OUString maCurContainerStorageName;
+
+
+ com::sun::star::uno::Reference < com::sun::star::embed::XStorage > mxRootStorage; // package
+ ::comphelper::IEmbeddedHelper* mpDocPersist;
+ com::sun::star::uno::Reference < com::sun::star::embed::XStorage > mxContainerStorage; // container sub package for
+ com::sun::star::uno::Reference < com::sun::star::embed::XStorage > mxTempStorage; // package
+ // objects
+ SvXMLEmbeddedObjectHelperMode meCreateMode;
+ SvXMLEmbeddedObjectHelper_Impl *mpStreamMap;
+
+ SVX_DLLPRIVATE sal_Bool ImplGetStorageNames(
+ const ::rtl::OUString& rURLStr,
+ ::rtl::OUString& rContainerStorageName,
+ ::rtl::OUString& rObjectStorageName,
+ sal_Bool bInternalToExternal,
+ sal_Bool *pGraphicRepl=0,
+ sal_Bool *pOasisFormat=0 ) const;
+
+ SVX_DLLPRIVATE com::sun::star::uno::Reference < com::sun::star::embed::XStorage > ImplGetContainerStorage(
+ const ::rtl::OUString& rStorageName );
+
+ SVX_DLLPRIVATE String ImplGetUniqueName( ::comphelper::IEmbeddedHelper*, const sal_Char* p ) const;
+ SVX_DLLPRIVATE sal_Bool ImplReadObject(
+ const ::rtl::OUString& rContainerStorageName,
+ ::rtl::OUString& rObjName,
+ const SvGlobalName *pClassId,
+ SvStream* pTemp );
+
+ SVX_DLLPRIVATE ::rtl::OUString ImplInsertEmbeddedObjectURL(
+ const ::rtl::OUString& rURLStr );
+
+ SVX_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > ImplGetReplacementImage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >& xObj );
+
+protected:
+
+ SvXMLEmbeddedObjectHelper();
+ ~SvXMLEmbeddedObjectHelper();
+ void Init( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&,
+ ::comphelper::IEmbeddedHelper& rDocPersist,
+ SvXMLEmbeddedObjectHelperMode eCreateMode );
+
+ virtual void SAL_CALL disposing();
+
+public:
+ SvXMLEmbeddedObjectHelper(
+ ::comphelper::IEmbeddedHelper& rDocPersist,
+ SvXMLEmbeddedObjectHelperMode eCreateMode );
+
+ static SvXMLEmbeddedObjectHelper* Create(
+ const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&,
+ ::comphelper::IEmbeddedHelper& rDocPersist,
+ SvXMLEmbeddedObjectHelperMode eCreateMode,
+ sal_Bool bDirect = sal_True );
+ static SvXMLEmbeddedObjectHelper* Create(
+ ::comphelper::IEmbeddedHelper& rDocPersist,
+ SvXMLEmbeddedObjectHelperMode eCreateMode );
+ static void Destroy( SvXMLEmbeddedObjectHelper* pSvXMLEmbeddedObjectHelper );
+
+ void Flush();
+
+ // XEmbeddedObjectResolver
+ virtual ::rtl::OUString SAL_CALL resolveEmbeddedObjectURL( const ::rtl::OUString& aURL ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XNameAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+#endif
diff --git a/svx/inc/svx/xmlexchg.hxx b/svx/inc/svx/xmlexchg.hxx
new file mode 100644
index 000000000000..f4820e0eb6fe
--- /dev/null
+++ b/svx/inc/svx/xmlexchg.hxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XMLEXCHG_HXX_
+#define _SVX_XMLEXCHG_HXX_
+
+#include <svtools/transfer.hxx>
+#include "svx/svxdllapi.h"
+
+namespace com {
+ namespace sun {
+ namespace star {
+ namespace beans {
+ class SAL_NO_VTABLE XPropertySet;
+ }
+ }
+ }
+}
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+
+ //====================================================================
+ //= OXFormsDescriptor
+ //====================================================================
+
+ struct SVX_DLLPUBLIC OXFormsDescriptor {
+
+ String szName;
+ String szServiceName;
+ ::com::sun::star::uno::Reference
+ < ::com::sun::star::beans::XPropertySet >
+ xPropSet;
+
+ inline OXFormsDescriptor( void ) {}
+ inline OXFormsDescriptor( const OXFormsDescriptor &rhs ) { *this=rhs; }
+ inline OXFormsDescriptor &operator = ( const OXFormsDescriptor &rhs ) {
+ szName = rhs.szName;
+ szServiceName = rhs.szServiceName;
+ xPropSet = rhs.xPropSet;
+ return (*this);
+ }
+ };
+
+ //====================================================================
+ //= OXFormsTransferable
+ //====================================================================
+ class SVX_DLLPUBLIC OXFormsTransferable : public TransferableHelper {
+
+ protected:
+
+ // TransferableHelper overridables
+ virtual void AddSupportedFormats();
+ virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+
+ static sal_uInt32 getDescriptorFormatId();
+
+ OXFormsDescriptor m_aDescriptor;
+
+ public:
+
+ /** construct the transferable
+ */
+ OXFormsTransferable( const OXFormsDescriptor &rhs );
+
+ /** extracts an xform descriptor from the transferable given
+ */
+ static const OXFormsDescriptor &extractDescriptor( const TransferableDataHelper& _rData );
+ };
+
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+#endif // _SVX_XMLEXCHG_HXX_
+
diff --git a/svx/inc/svx/xmlgrhlp.hxx b/svx/inc/svx/xmlgrhlp.hxx
new file mode 100644
index 000000000000..5c7812775afa
--- /dev/null
+++ b/svx/inc/svx/xmlgrhlp.hxx
@@ -0,0 +1,163 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XMLGRHLP_HXX
+#define _XMLGRHLP_HXX
+
+#include <cppuhelper/compbase2.hxx>
+#include <osl/mutex.hxx>
+#include <svtools/grfmgr.hxx>
+#include <vector>
+#include <set>
+#include <utility>
+#include <com/sun/star/document/XGraphicObjectResolver.hpp>
+#include <com/sun/star/document/XBinaryStreamResolver.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include "svx/svxdllapi.h"
+
+// ----------------------
+// - SvXMLGraphicHelper -
+// ----------------------
+
+enum SvXMLGraphicHelperMode
+{
+ GRAPHICHELPER_MODE_READ = 0,
+ GRAPHICHELPER_MODE_WRITE = 1
+};
+
+// ----------------------
+// - SvXMLGraphicHelper -
+// ----------------------
+struct SvxGraphicHelperStream_Impl
+{
+ ::com::sun::star::uno::Reference < ::com::sun::star::embed::XStorage > xStorage;
+ ::com::sun::star::uno::Reference < ::com::sun::star::io::XStream > xStream;
+};
+
+class SVX_DLLPUBLIC SvXMLGraphicHelper : public ::cppu::WeakComponentImplHelper2< ::com::sun::star::document::XGraphicObjectResolver,
+ ::com::sun::star::document::XBinaryStreamResolver >
+{
+private:
+
+ typedef ::std::pair< ::rtl::OUString, ::rtl::OUString > URLPair;
+ typedef ::std::vector< URLPair > URLPairVector;
+ typedef ::std::vector< GraphicObject > GraphicObjectVector;
+ typedef ::std::set< ::rtl::OUString > URLSet;
+ typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > > GraphicOutputStreamVector;
+
+ ::osl::Mutex maMutex;
+ ::com::sun::star::uno::Reference < ::com::sun::star::embed::XStorage > mxRootStorage;
+ ::rtl::OUString maCurStorageName;
+ URLPairVector maGrfURLs;
+ GraphicObjectVector maGrfObjs;
+ GraphicOutputStreamVector maGrfStms;
+ URLSet maURLSet;
+ SvXMLGraphicHelperMode meCreateMode;
+ sal_Bool mbDirect;
+
+ SVX_DLLPRIVATE sal_Bool ImplGetStreamNames( const ::rtl::OUString& rURLStr,
+ ::rtl::OUString& rPictureStorageName,
+ ::rtl::OUString& rPictureStreamName );
+ SVX_DLLPRIVATE ::com::sun::star::uno::Reference < ::com::sun::star::embed::XStorage > ImplGetGraphicStorage( const ::rtl::OUString& rPictureStorageName );
+ SVX_DLLPRIVATE SvxGraphicHelperStream_Impl ImplGetGraphicStream( const ::rtl::OUString& rPictureStorageName,
+ const ::rtl::OUString& rPictureStreamName,
+ sal_Bool bTruncate );
+ SVX_DLLPRIVATE String ImplGetGraphicMimeType( const String& rFileName ) const;
+ SVX_DLLPRIVATE Graphic ImplReadGraphic( const ::rtl::OUString& rPictureStorageName,
+ const ::rtl::OUString& rPictureStreamName );
+ 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, rtl::OUString& rRequestedFileName );
+
+protected:
+ SvXMLGraphicHelper();
+ ~SvXMLGraphicHelper();
+ void Init( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XStorage >& xXMLStorage,
+ SvXMLGraphicHelperMode eCreateMode,
+ sal_Bool bDirect );
+
+ virtual void SAL_CALL disposing();
+
+public:
+ SvXMLGraphicHelper( SvXMLGraphicHelperMode eCreateMode );
+
+ static SvXMLGraphicHelper* Create( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XStorage >& rXMLStorage,
+ SvXMLGraphicHelperMode eCreateMode,
+ sal_Bool bDirect = sal_True );
+ static SvXMLGraphicHelper* Create( SvXMLGraphicHelperMode eCreateMode );
+
+ static void Destroy( SvXMLGraphicHelper* pSvXMLGraphicHelper );
+
+public:
+
+ // XGraphicObjectResolver
+ virtual ::rtl::OUString SAL_CALL resolveGraphicObjectURL( const ::rtl::OUString& aURL ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XBinaryStreamResolver
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getInputStream( const ::rtl::OUString& rURL ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > SAL_CALL createOutputStream( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL resolveOutputStream( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rxBinaryStream ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+
+// for instantiation via service manager
+namespace svx
+{
+/** Create this with createInstanceWithArguments. service name
+ "com.sun.star.comp.Svx.GraphicImportHelper", one argument which is the
+ XStorage. Without arguments no helper class is created. With an empty
+ argument the helper class is created and initialized like in the CTOR to
+ SvXMLGraphicHelper that only gets the create mode.
+
+ You should call dispose after you no longer need this component.
+
+ uses eCreateMode == GRAPHICHELPER_MODE_READ, bDirect == sal_True in
+ SvXMLGraphicHelper
+ */
+SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvXMLGraphicImportHelper_createInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr) throw( ::com::sun::star::uno::Exception );
+SVX_DLLPUBLIC ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL SvXMLGraphicImportHelper_getSupportedServiceNames() throw();
+SVX_DLLPUBLIC ::rtl::OUString SAL_CALL SvXMLGraphicImportHelper_getImplementationName() throw();
+
+/** Create this with createInstanceWithArguments. service name
+ "com.sun.star.comp.Svx.GraphicExportHelper", one argument which is the
+ XStorage. Without arguments no helper class is created. With an empty
+ argument the helper class is created and initialized like in the CTOR to
+ SvXMLGraphicHelper that only gets the create mode
+
+ To write the Pictures stream, you have to call dispose at this component.
+ Make sure you call dipose before you commit the parent storage.
+
+ uses eCreateMode == GRAPHICHELPER_MODE_WRITE, bDirect == sal_True in
+ SvXMLGraphicHelper
+ */
+SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvXMLGraphicExportHelper_createInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr) throw( ::com::sun::star::uno::Exception );
+SVX_DLLPUBLIC ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL SvXMLGraphicExportHelper_getSupportedServiceNames() throw();
+SVX_DLLPUBLIC ::rtl::OUString SAL_CALL SvXMLGraphicExportHelper_getImplementationName() throw();
+}
+
+#endif
diff --git a/svx/inc/svx/xmlsecctrl.hxx b/svx/inc/svx/xmlsecctrl.hxx
new file mode 100644
index 000000000000..47ee75e6bac1
--- /dev/null
+++ b/svx/inc/svx/xmlsecctrl.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XMLSECURITY_STBCONTRL_HXX
+#define _XMLSECURITY_STBCONTRL_HXX
+
+#include <sfx2/stbitem.hxx>
+#include "svx/svxdllapi.h"
+
+
+class SvxSizeItem;
+
+// class SvxPosSizeToolBoxControl ----------------------------------------
+
+class SVX_DLLPUBLIC XmlSecStatusBarControl : public SfxStatusBarControl
+{
+private:
+ struct XmlSecStatusBarControl_Impl;
+
+ XmlSecStatusBarControl_Impl* mpImpl;
+
+public:
+ SFX_DECL_STATUSBAR_CONTROL();
+
+ XmlSecStatusBarControl( sal_uInt16 _nSlotId, sal_uInt16 _nId, StatusBar& _rStb );
+ ~XmlSecStatusBarControl();
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+ virtual void Paint( const UserDrawEvent& rEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+ static long GetDefItemWidth( StatusBar& _rStatusBar );
+};
+
+#endif
+
diff --git a/svx/inc/svx/xoutbmp.hxx b/svx/inc/svx/xoutbmp.hxx
new file mode 100644
index 000000000000..1d0fca8de220
--- /dev/null
+++ b/svx/inc/svx/xoutbmp.hxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XOUTBMP_HXX
+#define _XOUTBMP_HXX
+
+#include <vcl/graph.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include "svx/svxdllapi.h"
+
+// -----------
+// - Defines -
+// -----------
+
+#define XOUTBMP_MIRROR_HORZ 0x00000001L
+#define XOUTBMP_MIRROR_VERT 0x00000010L
+
+#define XOUTBMP_CONTOUR_HORZ 0x00000001L
+#define XOUTBMP_CONTOUR_VERT 0x00000002L
+#define XOUTBMP_CONTOUR_EDGEDETECT 0x00000004L
+
+#define XOUTBMP_DONT_EXPAND_FILENAME 0x10000000L
+#define XOUTBMP_USE_GIF_IF_POSSIBLE 0x20000000L
+#define XOUTBMP_USE_GIF_IF_SENSIBLE 0x40000000L
+#define XOUTBMP_USE_NATIVE_IF_POSSIBLE 0x80000000L
+
+// --------------
+// - XOutBitmap -
+// --------------
+
+class GraphicFilter;
+class VirtualDevice;
+class INetURLObject;
+class Polygon;
+
+class SVX_DLLPUBLIC XOutBitmap
+{
+public:
+
+ static GraphicFilter* pGrfFilter;
+
+ static BitmapEx CreateQuickDrawBitmapEx( const Graphic& rGraphic, const OutputDevice& rCompDev,
+ const MapMode& rMapMode, const Size& rLogSize,
+ const Point& rPoint, const Size& rSize );
+ static Graphic MirrorGraphic( const Graphic& rGraphic, const sal_uIntPtr nMirrorFlags );
+ static Animation MirrorAnimation( const Animation& rAnimation, sal_Bool bHMirr, sal_Bool bVMirr );
+ static sal_uInt16 WriteGraphic( const Graphic& rGraphic, String& rFileName,
+ const String& rFilterName, const sal_uIntPtr nFlags = 0L,
+ const Size* pMtfSize_100TH_MM = NULL );
+ static void DrawQuickDrawBitmapEx( OutputDevice* pOutDev, const Point& rPt,
+ const Size& rSize, const BitmapEx& rBmpEx );
+ static void DrawTiledBitmapEx( OutputDevice* pOutDev, const Point& rStartPt, const Size& rGrfSize,
+ const Rectangle& rTileRect, const BitmapEx& rBmpEx );
+
+ static sal_uInt16 ExportGraphic( const Graphic& rGraphic, const INetURLObject& rURL,
+ GraphicFilter& rFilter, const sal_uInt16 nFormat,
+ const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >* pFilterData = NULL );
+
+ static Bitmap DetectEdges( const Bitmap& rBmp, const sal_uInt8 cThreshold );
+
+ static Polygon GetCountour( const Bitmap& rBmp, const sal_uIntPtr nContourFlags,
+ const sal_uInt8 cEdgeDetectThreshold = 50,
+ const Rectangle* pWorkRect = NULL );
+};
+
+// ----------------
+// - DitherBitmap -
+// ----------------
+
+SVX_DLLPUBLIC sal_Bool DitherBitmap( Bitmap& rBitmap );
+
+#endif // _XOUTBMP_HXX
diff --git a/svx/inc/svx/xpoly.hxx b/svx/inc/svx/xpoly.hxx
new file mode 100644
index 000000000000..a645494f8ae4
--- /dev/null
+++ b/svx/inc/svx/xpoly.hxx
@@ -0,0 +1,212 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _XPOLY_HXX
+#define _XPOLY_HXX
+
+// include ---------------------------------------------------------------
+
+#include <tools/solar.h>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include "svx/svxdllapi.h"
+
+class Point;
+class Rectangle;
+class SvStream;
+class Polygon;
+class PolyPolygon;
+class OutputDevice;
+
+/************************************************************************/
+
+#define XPOLYPOLY_APPEND 0xFFFF
+#define XPOLY_APPEND 0xFFFF
+
+#define XPOLY_MAXPOINTS 0xFFF0 /* Auch fuer die 32-Bitter etwas Luft lassen */
+
+/************************************************************************/
+// Punktstile im XPolygon:
+// NORMAL : Anfangs- oder Endpunkt einer Kurve oder Linie
+// SMOOTH : Glatter Uebergang zwischen Kurven
+// SYMMTR : glatter und symmetrischer Uebergang zwischen Kurven
+// CONTROL: Kontrollpunkt einer Bezierkurve
+
+enum XPolyFlags { XPOLY_NORMAL, XPOLY_SMOOTH, XPOLY_CONTROL, XPOLY_SYMMTR };
+
+
+/*************************************************************************
+|*
+|* Klasse XPolygon; hat neben dem Point-Array noch ein Array mit Flags,
+|* die Informationen ueber den jeweiligen Punkt enthalten
+|*
+\************************************************************************/
+
+class ImpXPolygon;
+
+class SVX_DLLPUBLIC XPolygon
+{
+protected:
+ ImpXPolygon* pImpXPolygon;
+
+ // ImpXPolygon-ReferenceCount pruefen und ggf. abkoppeln
+ void CheckReference();
+
+ // Hilfsfunktionen fuer Bezierkonvertierung
+ void SubdivideBezier(sal_uInt16 nPos, sal_Bool bCalcFirst, double fT);
+ void GenBezArc(const Point& rCenter, long nRx, long nRy,
+ long nXHdl, long nYHdl, sal_uInt16 nStart, sal_uInt16 nEnd,
+ sal_uInt16 nQuad, sal_uInt16 nFirst);
+ sal_Bool CheckAngles(sal_uInt16& nStart, sal_uInt16 nEnd, sal_uInt16& nA1, sal_uInt16& nA2);
+
+public:
+ XPolygon( sal_uInt16 nSize=16, sal_uInt16 nResize=16 );
+ XPolygon( const XPolygon& rXPoly );
+ XPolygon( const Polygon& rPoly );
+ XPolygon( const Rectangle& rRect, long nRx = 0, long nRy = 0 );
+ XPolygon( const Point& rCenter, long nRx, long nRy,
+ sal_uInt16 nStartAngle = 0, sal_uInt16 nEndAngle = 3600,
+ sal_Bool bClose = sal_True );
+
+ ~XPolygon();
+
+ void SetSize( sal_uInt16 nSize );
+ sal_uInt16 GetSize() const;
+
+ void SetPointCount( sal_uInt16 nPoints );
+ sal_uInt16 GetPointCount() const;
+
+ void Insert( sal_uInt16 nPos, const Point& rPt, XPolyFlags eFlags );
+ void Insert( sal_uInt16 nPos, const XPolygon& rXPoly );
+ void Insert( sal_uInt16 nPos, const Polygon& rPoly );
+ void Remove( sal_uInt16 nPos, sal_uInt16 nCount );
+ void Move( long nHorzMove, long nVertMove );
+ Rectangle GetBoundRect() const;
+
+ const Point& operator[]( sal_uInt16 nPos ) const;
+ Point& operator[]( sal_uInt16 nPos );
+ XPolygon& operator=( const XPolygon& rXPoly );
+ sal_Bool operator==( const XPolygon& rXPoly ) const;
+ sal_Bool operator!=( const XPolygon& rXPoly ) const;
+
+ XPolyFlags GetFlags( sal_uInt16 nPos ) const;
+ void SetFlags( sal_uInt16 nPos, XPolyFlags eFlags );
+ sal_Bool IsControl(sal_uInt16 nPos) const;
+ sal_Bool IsSmooth(sal_uInt16 nPos) const;
+
+ // Abstand zwischen zwei Punkten
+ double CalcDistance(sal_uInt16 nP1, sal_uInt16 nP2);
+
+ // Bezierkonvertierungen
+ void CalcSmoothJoin(sal_uInt16 nCenter, sal_uInt16 nDrag, sal_uInt16 nPnt);
+ void CalcTangent(sal_uInt16 nCenter, sal_uInt16 nPrev, sal_uInt16 nNext);
+ void PointsToBezier(sal_uInt16 nFirst);
+
+ // Transformationen
+ void Translate(const Point& rTrans);
+ void Rotate(const Point& rCenter, double fSin, double fCos);
+ void Rotate(const Point& rCenter, sal_uInt16 nAngle);
+ void Scale(double fSx, double fSy);
+ void SlantX(long nYRef, double fSin, double fCos);
+ void SlantY(long nXRef, double fSin, double fCos);
+ void Distort(const Rectangle& rRefRect, const XPolygon& rDistortedRect);
+ void Rotate20 ();
+
+ // #116512# convert to basegfx::B2DPolygon and return
+ basegfx::B2DPolygon getB2DPolygon() const;
+
+ // #116512# constructor to convert from basegfx::B2DPolygon
+ // #i76339# made explicit
+ explicit XPolygon(const basegfx::B2DPolygon& rPolygon);
+};
+
+/*************************************************************************
+|*
+|* Klasse XPolyPolygon; wie PolyPolygon, nur statt aus Polygonen aus
+|* XPolygonen bestehend
+|*
+\************************************************************************/
+
+class ImpXPolyPolygon;
+
+class SVX_DLLPUBLIC XPolyPolygon
+{
+protected:
+ ImpXPolyPolygon* pImpXPolyPolygon;
+
+ // ImpXPolyPolygon-ReferenceCount pruefen und ggf. abkoppeln
+ void CheckReference();
+
+public:
+ XPolyPolygon( sal_uInt16 nInitSize = 16, sal_uInt16 nResize = 16 );
+ XPolyPolygon( const XPolygon& rXPoly );
+ XPolyPolygon( const XPolyPolygon& rXPolyPoly );
+ XPolyPolygon( const PolyPolygon& rPolyPoly);
+
+ ~XPolyPolygon();
+
+ void Insert( const XPolygon& rXPoly,
+ sal_uInt16 nPos = XPOLYPOLY_APPEND );
+ void Insert( const XPolyPolygon& rXPoly,
+ sal_uInt16 nPos=XPOLYPOLY_APPEND );
+ XPolygon Remove( sal_uInt16 nPos );
+ XPolygon Replace( const XPolygon& rXPoly, sal_uInt16 nPos );
+ const XPolygon& GetObject( sal_uInt16 nPos ) const;
+
+ void Clear();
+ sal_uInt16 Count() const;
+
+ void Move( long nHorzMove, long nVertMove );
+ Rectangle GetBoundRect() const;
+
+ const XPolygon& operator[]( sal_uInt16 nPos ) const
+ { return GetObject( nPos ); }
+ XPolygon& operator[]( sal_uInt16 nPos );
+
+ XPolyPolygon& operator=( const XPolyPolygon& rXPolyPoly );
+ sal_Bool operator==( const XPolyPolygon& rXPolyPoly ) const;
+ sal_Bool operator!=( const XPolyPolygon& rXPolyPoly ) const;
+
+ // Transformationen
+ void Translate(const Point& rTrans);
+ void Rotate(const Point& rCenter, double fSin, double fCos);
+ void Rotate(const Point& rCenter, sal_uInt16 nAngle);
+ void Scale(double fSx, double fSy);
+ void SlantX(long nYRef, double fSin, double fCos);
+ void SlantY(long nXRef, double fSin, double fCos);
+ void Distort(const Rectangle& rRefRect, const XPolygon& rDistortedRect);
+ void Rotate20 ();
+
+ // #116512# convert to basegfx::B2DPolyPolygon and return
+ basegfx::B2DPolyPolygon getB2DPolyPolygon() const;
+
+ // #116512# constructor to convert from basegfx::B2DPolyPolygon
+ // #i76339# made explicit
+ explicit XPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon);
+};
+
+#endif // _XPOLY_HXX
+
+// eof
diff --git a/svx/inc/svx/xpool.hxx b/svx/inc/svx/xpool.hxx
new file mode 100644
index 000000000000..1834eff0d5bb
--- /dev/null
+++ b/svx/inc/svx/xpool.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XPOOL_HXX
+#define _XPOOL_HXX
+
+#include <svl/itempool.hxx>
+#include <svx/xdef.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* Klassendeklaration
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XOutdevItemPool : public SfxItemPool
+{
+protected:
+ SfxPoolItem** mppLocalPoolDefaults;
+ SfxItemInfo* mpLocalItemInfos;
+
+public:
+ XOutdevItemPool(
+ SfxItemPool* pMaster = 0L,
+ sal_uInt16 nAttrStart = XATTR_START,
+ sal_uInt16 nAttrEnd = XATTR_END,
+ sal_Bool bLoadRefCounts = sal_True);
+ XOutdevItemPool(const XOutdevItemPool& rPool);
+
+ virtual SfxItemPool* Clone() const;
+protected:
+ virtual ~XOutdevItemPool();
+};
+
+#endif // _XPOOL_HXX
diff --git a/svx/inc/svx/xsetit.hxx b/svx/inc/svx/xsetit.hxx
new file mode 100644
index 000000000000..f8405490bac9
--- /dev/null
+++ b/svx/inc/svx/xsetit.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XSETITEM_HXX
+#define _SVX_XSETITEM_HXX
+
+#ifndef _XATTR_HXX
+#include <svx/xit.hxx>
+#endif
+#include <svl/metitem.hxx>
+#include <svl/eitem.hxx>
+#include <svx/rectenum.hxx>
+
+#include <svx/xlnasit.hxx>
+#include <svx/xflasit.hxx>
+#include <svx/xlntrit.hxx>
+#include <svx/xfltrit.hxx>
+#include <svx/xftshtit.hxx>
+#include <svx/xgrscit.hxx>
+#include <svx/xflbmtit.hxx>
+#include <svx/xflbmpit.hxx>
+#include <svx/xflbmsxy.hxx>
+#include <svx/xflbmsli.hxx>
+#include <svx/xflbtoxy.hxx>
+#include <svx/xflbstit.hxx>
+#include <svx/xflboxy.hxx>
+#include <svx/xflbckit.hxx>
+
+#endif
diff --git a/svx/inc/svx/xsflclit.hxx b/svx/inc/svx/xsflclit.hxx
new file mode 100644
index 000000000000..d9379ced1e68
--- /dev/null
+++ b/svx/inc/svx/xsflclit.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XSFLCLIT_HXX
+#define _SVX_XSFLCLIT_HXX
+
+#include <svx/xcolit.hxx>
+
+//------------------------------
+// class XSecondaryFillColorItem
+//------------------------------
+class SVX_DLLPUBLIC XSecondaryFillColorItem : public XColorItem
+{
+public:
+ TYPEINFO();
+ SVX_DLLPRIVATE XSecondaryFillColorItem() {}
+ SVX_DLLPRIVATE XSecondaryFillColorItem(sal_Int32 nIndex, const Color& rTheColor);
+ XSecondaryFillColorItem(const String& rName, const Color& rTheColor);
+ SVX_DLLPRIVATE XSecondaryFillColorItem(SvStream& rIn);
+
+ SVX_DLLPRIVATE virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ SVX_DLLPRIVATE virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+
+ SVX_DLLPRIVATE virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ SVX_DLLPRIVATE virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const;
+
+};
+
+#endif
+
diff --git a/svx/inc/svx/xtable.hxx b/svx/inc/svx/xtable.hxx
new file mode 100644
index 000000000000..721b84a19955
--- /dev/null
+++ b/svx/inc/svx/xtable.hxx
@@ -0,0 +1,653 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _XTABLE_HXX
+#define _XTABLE_HXX
+
+// include ---------------------------------------------------------------
+
+#include <svx/xpoly.hxx>
+#include <svx/xdash.hxx>
+#include <svx/xhatch.hxx>
+#include <svx/xgrad.hxx>
+#include <svx/xbitmap.hxx>
+#include <svx/xflasit.hxx>
+#include <svx/xlnasit.hxx>
+
+#ifndef _SV_COLOR_HXX
+#include <tools/color.hxx>
+#endif
+#include <tools/string.hxx>
+
+#ifndef _TABLE_HXX //autogen
+#include <tools/table.hxx>
+#endif
+#include "svx/svxdllapi.h"
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+class Color;
+class Bitmap;
+class VirtualDevice;
+class XOutdevItemPool;
+
+// Breite und Hoehe der LB-Bitmaps
+#define BITMAP_WIDTH 32
+#define BITMAP_HEIGHT 12
+
+// Standard-Vergleichsstring
+extern sal_Unicode __FAR_DATA pszStandard[]; // "standard"
+
+// Funktion zum Konvertieren in echte RGB-Farben, da mit
+// enum COL_NAME nicht verglichen werden kann.
+SVX_DLLPUBLIC Color RGB_Color( ColorData nColorName );
+
+// ---------------------
+// class XPropertyEntry
+// ---------------------
+
+class XPropertyEntry
+{
+protected:
+ String aName;
+
+ XPropertyEntry(const String& rName) : aName(rName) {}
+ XPropertyEntry(const XPropertyEntry& rOther): aName(rOther.aName) {}
+public:
+
+ virtual ~XPropertyEntry() {}
+ void SetName(const String& rName) { aName = rName; }
+ String& GetName() { return aName; }
+};
+
+// ------------------
+// class XColorEntry
+// ------------------
+
+class XColorEntry : public XPropertyEntry
+{
+ Color aColor;
+
+public:
+ XColorEntry(const Color& rColor, const String& rName) :
+ XPropertyEntry(rName), aColor(rColor) {}
+ XColorEntry(const XColorEntry& rOther) :
+ XPropertyEntry(rOther), aColor(rOther.aColor) {}
+
+ void SetColor(const Color& rColor) { aColor = rColor; }
+ Color& GetColor() { return aColor; }
+};
+
+// --------------------
+// class XLineEndEntry
+// --------------------
+
+class XLineEndEntry : public XPropertyEntry
+{
+ basegfx::B2DPolyPolygon aB2DPolyPolygon;
+
+public:
+ XLineEndEntry(const basegfx::B2DPolyPolygon& rB2DPolyPolygon, const String& rName)
+ : XPropertyEntry(rName),
+ aB2DPolyPolygon(rB2DPolyPolygon)
+ {}
+
+ XLineEndEntry(const XLineEndEntry& rOther)
+ : XPropertyEntry(rOther),
+ aB2DPolyPolygon(rOther.aB2DPolyPolygon)
+ {}
+
+ void SetLineEnd(const basegfx::B2DPolyPolygon& rB2DPolyPolygon)
+ {
+ aB2DPolyPolygon = rB2DPolyPolygon;
+ }
+
+ basegfx::B2DPolyPolygon& GetLineEnd()
+ {
+ return aB2DPolyPolygon;
+ }
+};
+
+// ------------------
+// class XDashEntry
+// ------------------
+
+class XDashEntry : public XPropertyEntry
+{
+ XDash aDash;
+
+public:
+ XDashEntry(const XDash& rDash, const String& rName) :
+ XPropertyEntry(rName), aDash(rDash) {}
+ XDashEntry(const XDashEntry& rOther) :
+ XPropertyEntry(rOther), aDash(rOther.aDash) {}
+
+ void SetDash(const XDash& rDash) { aDash = rDash; }
+ XDash& GetDash() { return aDash; }
+};
+
+// ------------------
+// class XHatchEntry
+// ------------------
+
+class XHatchEntry : public XPropertyEntry
+{
+ XHatch aHatch;
+
+public:
+ XHatchEntry(const XHatch& rHatch, const String& rName) :
+ XPropertyEntry(rName), aHatch(rHatch) {}
+ XHatchEntry(const XHatchEntry& rOther) :
+ XPropertyEntry(rOther), aHatch(rOther.aHatch) {}
+
+ void SetHatch(const XHatch& rHatch) { aHatch = rHatch; }
+ XHatch& GetHatch() { return aHatch; }
+};
+
+// ---------------------
+// class XGradientEntry
+// ---------------------
+
+class XGradientEntry : public XPropertyEntry
+{
+ XGradient aGradient;
+
+public:
+ XGradientEntry(const XGradient& rGradient, const String& rName):
+ XPropertyEntry(rName), aGradient(rGradient) {}
+ XGradientEntry(const XGradientEntry& rOther) :
+ XPropertyEntry(rOther), aGradient(rOther.aGradient) {}
+
+ void SetGradient(const XGradient& rGrad) { aGradient = rGrad; }
+ XGradient& GetGradient() { return aGradient; }
+};
+
+// ---------------------
+// class XBitmapEntry
+// ---------------------
+
+class XBitmapEntry : public XPropertyEntry
+{
+ XOBitmap aXOBitmap;
+
+public:
+ XBitmapEntry( const XOBitmap& rXOBitmap, const String& rName ):
+ XPropertyEntry( rName ), aXOBitmap( rXOBitmap ) {}
+ XBitmapEntry( const XBitmapEntry& rOther ) :
+ XPropertyEntry( rOther ), aXOBitmap( rOther.aXOBitmap ) {}
+
+ void SetXBitmap(const XOBitmap& rXOBitmap) { aXOBitmap = rXOBitmap; }
+ XOBitmap& GetXBitmap() { return aXOBitmap; }
+};
+
+// ---------------------
+// class XPropertyTable
+// ---------------------
+
+class SVX_DLLPUBLIC XPropertyTable
+{
+protected:
+ String aName; // nicht persistent !
+ String aPath;
+ XOutdevItemPool* pXPool;
+
+ Table aTable;
+ Table* pBmpTable;
+
+ sal_Bool bTableDirty;
+ sal_Bool bBitmapsDirty;
+ sal_Bool bOwnPool;
+
+ XPropertyTable( const String& rPath,
+ XOutdevItemPool* pXPool = NULL,
+ sal_uInt16 nInitSize = 16,
+ sal_uInt16 nReSize = 16 );
+ XPropertyTable( SvStream& rIn );
+ void Clear();
+
+public:
+ virtual ~XPropertyTable();
+
+ long Count() const;
+
+ sal_Bool Insert(long nIndex, XPropertyEntry* pEntry);
+ XPropertyEntry* Replace(long nIndex, XPropertyEntry* pEntry);
+ XPropertyEntry* Remove(long nIndex, sal_uInt16 nDummy);
+ XPropertyEntry* Get( long nIndex, sal_uInt16 nDummy ) const;
+
+ long Get(const String& rName);
+ Bitmap* GetBitmap( long nIndex ) const;
+
+ const String& GetName() const { return aName; }
+ void SetName( const String& rString );
+ const String& GetPath() const { return aPath; }
+ void SetPath( const String& rString ) { aPath = rString; }
+ sal_Bool IsDirty() const { return bTableDirty && bBitmapsDirty; }
+ void SetDirty( sal_Bool bDirty = sal_True )
+ { bTableDirty = bDirty; bBitmapsDirty = bDirty; }
+
+ virtual sal_Bool Load() = 0;
+ virtual sal_Bool Save() = 0;
+ virtual sal_Bool Create() = 0;
+ virtual sal_Bool CreateBitmapsForUI() = 0;
+ virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ) = 0;
+};
+
+// --------------------
+// class XPropertyList
+// --------------------
+
+class SVX_DLLPUBLIC XPropertyList
+{
+protected:
+ String aName; // nicht persistent !
+ String aPath;
+ XOutdevItemPool* pXPool;
+
+ List aList;
+ List* pBmpList;
+
+ sal_Bool bListDirty;
+ sal_Bool bBitmapsDirty;
+ sal_Bool bOwnPool;
+
+ XPropertyList( const String& rPath,
+ XOutdevItemPool* pXPool = NULL,
+ sal_uInt16 nInitSize = 16,
+ sal_uInt16 nReSize = 16 );
+ XPropertyList( SvStream& rIn );
+ void Clear();
+
+public:
+ virtual ~XPropertyList();
+
+ long Count() const;
+
+ void Insert( XPropertyEntry* pEntry, long nIndex = LIST_APPEND );
+ XPropertyEntry* Replace( XPropertyEntry* pEntry, long nIndex );
+ XPropertyEntry* Remove( long nIndex, sal_uInt16 nDummy );
+ XPropertyEntry* Get( long nIndex, sal_uInt16 nDummy ) const;
+
+ long Get(const String& rName);
+ Bitmap* GetBitmap( long nIndex ) const;
+
+ const String& GetName() const { return aName; }
+ void SetName( const String& rString );
+ const String& GetPath() const { return aPath; }
+ void SetPath( const String& rString ) { aPath = rString; }
+ sal_Bool IsDirty() const { return bListDirty && bBitmapsDirty; }
+ void SetDirty( sal_Bool bDirty = sal_True )
+ { bListDirty = bDirty; bBitmapsDirty = bDirty; }
+
+ virtual sal_Bool Load() = 0;
+ virtual sal_Bool Save() = 0;
+ virtual sal_Bool Create() = 0;
+ virtual sal_Bool CreateBitmapsForUI() = 0;
+ virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True ) = 0;
+};
+
+// ------------------
+// class XColorTable
+// ------------------
+
+class SVX_DLLPUBLIC XColorTable : public XPropertyTable
+{
+public:
+ XColorTable( const String& rPath,
+ XOutdevItemPool* pXPool = NULL,
+ sal_uInt16 nInitSize = 16,
+ sal_uInt16 nReSize = 16 );
+ virtual ~XColorTable();
+
+ using XPropertyTable::Replace;
+ XColorEntry* Replace(long nIndex, XColorEntry* pEntry );
+ using XPropertyTable::Remove;
+ XColorEntry* Remove(long nIndex);
+ using XPropertyTable::Get;
+ XColorEntry* GetColor(long nIndex) const;
+
+ virtual sal_Bool Load();
+ virtual sal_Bool Save();
+ virtual sal_Bool Create();
+ virtual sal_Bool CreateBitmapsForUI();
+ virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True );
+
+ static XColorTable* GetStdColorTable();
+};
+
+// -------------------
+// class XColorList
+// -------------------
+
+class XColorList : public XPropertyList
+{
+public:
+ XColorList( const String& rPath,
+ XOutdevItemPool* pXPool = NULL,
+ sal_uInt16 nInitSize = 16,
+ sal_uInt16 nReSize = 16 );
+ virtual ~XColorList();
+
+ using XPropertyList::Replace;
+ XColorEntry* Replace(XColorEntry* pEntry, long nIndex );
+ using XPropertyList::Remove;
+ XColorEntry* Remove(long nIndex);
+ using XPropertyList::Get;
+ XColorEntry* GetColor(long nIndex) const;
+
+ virtual sal_Bool Load();
+ virtual sal_Bool Save();
+ virtual sal_Bool Create();
+ virtual sal_Bool CreateBitmapsForUI();
+ virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True );
+};
+
+// --------------------
+// class XLineEndTable
+// --------------------
+
+class XLineEndTable : public XPropertyTable
+{
+public:
+ XLineEndTable( const String& rPath,
+ XOutdevItemPool* pXPool = NULL,
+ sal_uInt16 nInitSize = 16,
+ sal_uInt16 nReSize = 16 );
+ virtual ~XLineEndTable();
+
+ using XPropertyTable::Replace;
+ XLineEndEntry* Replace(long nIndex, XLineEndEntry* pEntry );
+ using XPropertyTable::Remove;
+ XLineEndEntry* Remove(long nIndex);
+ using XPropertyTable::Get;
+ XLineEndEntry* GetLineEnd(long nIndex) const;
+
+ virtual sal_Bool Load();
+ virtual sal_Bool Save();
+ virtual sal_Bool Create();
+ virtual sal_Bool CreateBitmapsForUI();
+ virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True );
+};
+
+// -------------------
+// class XLineEndList
+// -------------------
+class impXLineEndList;
+
+class SVX_DLLPUBLIC XLineEndList : public XPropertyList
+{
+private:
+ impXLineEndList* mpData;
+
+ void impCreate();
+ void impDestroy();
+
+public:
+ XLineEndList(const String& rPath, XOutdevItemPool* pXPool = 0, sal_uInt16 nInitSize = 16, sal_uInt16 nReSize = 16);
+ virtual ~XLineEndList();
+
+ using XPropertyList::Replace;
+ XLineEndEntry* Replace(XLineEndEntry* pEntry, long nIndex);
+ using XPropertyList::Remove;
+ XLineEndEntry* Remove(long nIndex);
+ using XPropertyList::Get;
+ XLineEndEntry* GetLineEnd(long nIndex) const;
+
+ virtual sal_Bool Load();
+ virtual sal_Bool Save();
+ virtual sal_Bool Create();
+ virtual sal_Bool CreateBitmapsForUI();
+ virtual Bitmap* CreateBitmapForUI(long nIndex, sal_Bool bDelete = sal_True);
+};
+
+// --------------------
+// class XDashTable
+// --------------------
+
+class XDashTable : public XPropertyTable
+{
+public:
+ XDashTable( const String& rPath,
+ XOutdevItemPool* pXPool = NULL,
+ sal_uInt16 nInitSize = 16,
+ sal_uInt16 nReSize = 16 );
+ virtual ~XDashTable();
+
+ using XPropertyTable::Replace;
+ XDashEntry* Replace(long nIndex, XDashEntry* pEntry );
+ using XPropertyTable::Remove;
+ XDashEntry* Remove(long nIndex);
+ using XPropertyTable::Get;
+ XDashEntry* GetDash(long nIndex) const;
+
+ virtual sal_Bool Load();
+ virtual sal_Bool Save();
+ virtual sal_Bool Create();
+ virtual sal_Bool CreateBitmapsForUI();
+ virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True );
+};
+
+// -------------------
+// class XDashList
+// -------------------
+class impXDashList;
+
+class SVX_DLLPUBLIC XDashList : public XPropertyList
+{
+private:
+ impXDashList* mpData;
+
+ void impCreate();
+ void impDestroy();
+
+public:
+ XDashList(const String& rPath, XOutdevItemPool* pXPool = 0, sal_uInt16 nInitSize = 16, sal_uInt16 nReSize = 16);
+ virtual ~XDashList();
+
+ using XPropertyList::Replace;
+ XDashEntry* Replace(XDashEntry* pEntry, long nIndex);
+ using XPropertyList::Remove;
+ XDashEntry* Remove(long nIndex);
+ using XPropertyList::Get;
+ XDashEntry* GetDash(long nIndex) const;
+
+ virtual sal_Bool Load();
+ virtual sal_Bool Save();
+ virtual sal_Bool Create();
+ virtual sal_Bool CreateBitmapsForUI();
+ virtual Bitmap* CreateBitmapForUI(long nIndex, sal_Bool bDelete = sal_True);
+};
+
+// --------------------
+// class XHatchTable
+// --------------------
+
+class XHatchTable : public XPropertyTable
+{
+public:
+ XHatchTable( const String& rPath,
+ XOutdevItemPool* pXPool = NULL,
+ sal_uInt16 nInitSize = 16,
+ sal_uInt16 nReSize = 16 );
+ virtual ~XHatchTable();
+
+ using XPropertyTable::Replace;
+ XHatchEntry* Replace(long nIndex, XHatchEntry* pEntry );
+ using XPropertyTable::Remove;
+ XHatchEntry* Remove(long nIndex);
+ using XPropertyTable::Get;
+ XHatchEntry* GetHatch(long nIndex) const;
+
+ virtual sal_Bool Load();
+ virtual sal_Bool Save();
+ virtual sal_Bool Create();
+ virtual sal_Bool CreateBitmapsForUI();
+ virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True );
+};
+
+// -------------------
+// class XHatchList
+// -------------------
+class impXHatchList;
+
+class SVX_DLLPUBLIC XHatchList : public XPropertyList
+{
+private:
+ impXHatchList* mpData;
+
+ void impCreate();
+ void impDestroy();
+
+public:
+ XHatchList(const String& rPath, XOutdevItemPool* pXPool = 0, sal_uInt16 nInitSize = 16, sal_uInt16 nReSize = 16);
+ ~XHatchList();
+
+ using XPropertyList::Replace;
+ XHatchEntry* Replace(XHatchEntry* pEntry, long nIndex);
+ using XPropertyList::Remove;
+ XHatchEntry* Remove(long nIndex);
+ using XPropertyList::Get;
+ XHatchEntry* GetHatch(long nIndex) const;
+
+ virtual sal_Bool Load();
+ virtual sal_Bool Save();
+ virtual sal_Bool Create();
+ virtual sal_Bool CreateBitmapsForUI();
+ virtual Bitmap* CreateBitmapForUI(long nIndex, sal_Bool bDelete = sal_True);
+};
+
+// ---------------------
+// class XGradientTable
+// ---------------------
+
+class XGradientTable : public XPropertyTable
+{
+public:
+ XGradientTable( const String& rPath,
+ XOutdevItemPool* pXPool = NULL,
+ sal_uInt16 nInitSize = 16,
+ sal_uInt16 nReSize = 16 );
+ virtual ~XGradientTable();
+
+ using XPropertyTable::Replace;
+ XGradientEntry* Replace(long nIndex, XGradientEntry* pEntry );
+ using XPropertyTable::Remove;
+ XGradientEntry* Remove(long nIndex);
+ using XPropertyTable::Get;
+ XGradientEntry* GetGradient(long nIndex) const;
+
+ virtual sal_Bool Load();
+ virtual sal_Bool Save();
+ virtual sal_Bool Create();
+ virtual sal_Bool CreateBitmapsForUI();
+ virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True );
+};
+
+// -------------------
+// class XGradientList
+// -------------------
+class impXGradientList;
+
+class SVX_DLLPUBLIC XGradientList : public XPropertyList
+{
+private:
+ impXGradientList* mpData;
+
+ void impCreate();
+ void impDestroy();
+
+public:
+ XGradientList(const String& rPath, XOutdevItemPool* pXPool = 0, sal_uInt16 nInitSize = 16, sal_uInt16 nReSize = 16);
+ virtual ~XGradientList();
+
+ using XPropertyList::Replace;
+ XGradientEntry* Replace(XGradientEntry* pEntry, long nIndex);
+ using XPropertyList::Remove;
+ XGradientEntry* Remove(long nIndex);
+ using XPropertyList::Get;
+ XGradientEntry* GetGradient(long nIndex) const;
+
+ virtual sal_Bool Load();
+ virtual sal_Bool Save();
+ virtual sal_Bool Create();
+ virtual sal_Bool CreateBitmapsForUI();
+ virtual Bitmap* CreateBitmapForUI(long nIndex, sal_Bool bDelete = sal_True);
+};
+
+// ---------------------
+// class XBitmapTable
+// ---------------------
+
+class XBitmapTable : public XPropertyTable
+{
+public:
+ XBitmapTable( const String& rPath,
+ XOutdevItemPool* pXPool = NULL,
+ sal_uInt16 nInitSize = 16,
+ sal_uInt16 nReSize = 16 );
+ virtual ~XBitmapTable();
+
+ using XPropertyTable::Replace;
+ XBitmapEntry* Replace(long nIndex, XBitmapEntry* pEntry );
+ using XPropertyTable::Remove;
+ XBitmapEntry* Remove(long nIndex);
+ using XPropertyTable::Get;
+ XBitmapEntry* GetBitmap(long nIndex) const;
+
+ virtual sal_Bool Load();
+ virtual sal_Bool Save();
+ virtual sal_Bool Create();
+ virtual sal_Bool CreateBitmapsForUI();
+ virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True );
+};
+
+// -------------------
+// class XBitmapList
+// -------------------
+
+class SVX_DLLPUBLIC XBitmapList : public XPropertyList
+{
+public:
+ XBitmapList( const String& rPath,
+ XOutdevItemPool* pXPool = NULL,
+ sal_uInt16 nInitSize = 16,
+ sal_uInt16 nReSize = 16 );
+ virtual ~XBitmapList();
+
+ using XPropertyList::Replace;
+ XBitmapEntry* Replace(XBitmapEntry* pEntry, long nIndex );
+ using XPropertyList::Remove;
+ XBitmapEntry* Remove(long nIndex);
+ using XPropertyList::Get;
+ XBitmapEntry* GetBitmap(long nIndex) const;
+
+ virtual sal_Bool Load();
+ virtual sal_Bool Save();
+ virtual sal_Bool Create();
+ virtual sal_Bool CreateBitmapsForUI();
+ virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True );
+};
+
+#endif // _XTABLE_HXX
diff --git a/svx/inc/svx/xtextit.hxx b/svx/inc/svx/xtextit.hxx
new file mode 100644
index 000000000000..0d4630b2a0a2
--- /dev/null
+++ b/svx/inc/svx/xtextit.hxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XTEXTITEM_HXX
+#define _SVX_XTEXTITEM_HXX
+
+#include <svx/xenum.hxx>
+#include <svl/metitem.hxx>
+#include <svl/eitem.hxx>
+#include <svx/xit.hxx>
+#include <svx/xcolit.hxx>
+
+#include <svx/xftadit.hxx>
+#include <svx/xftdiit.hxx>
+#include <svx/xftstit.hxx>
+#include <svx/xftmrit.hxx>
+#include <svx/xftouit.hxx>
+#include <svx/xftshit.hxx>
+#include <svx/xftshcit.hxx>
+#include <svx/xftshxy.hxx>
+#include <svx/xftsfit.hxx>
+
+#endif
+
diff --git a/svx/inc/svx/xtextit0.hxx b/svx/inc/svx/xtextit0.hxx
new file mode 100644
index 000000000000..73ed4878cee7
--- /dev/null
+++ b/svx/inc/svx/xtextit0.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_TEXTIT0_HXX
+#define _SVX_TEXTIT0_HXX
+
+#include <svx/xenum.hxx>
+#include <svl/eitem.hxx>
+#include "svx/svxdllapi.h"
+
+/*************************************************************************
+|*
+|* FormText-StyleItem
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XFormTextStyleItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+ XFormTextStyleItem(XFormTextStyle = XFT_NONE);
+ XFormTextStyleItem(SvStream& rIn);
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+ virtual sal_uInt16 GetValueCount() const;
+ XFormTextStyle GetValue() const { return (XFormTextStyle) SfxEnumItem::GetValue(); }
+ // #FontWork#
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+/*************************************************************************
+|*
+|* FormText-HideFormItem
+|*
+\************************************************************************/
+
+class SVX_DLLPUBLIC XFormTextHideFormItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+ XFormTextHideFormItem(sal_Bool bHide = sal_False);
+ XFormTextHideFormItem(SvStream& rIn);
+ virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const;
+ virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
+};
+
+#endif
diff --git a/svx/inc/svx/zoom_def.hxx b/svx/inc/svx/zoom_def.hxx
new file mode 100644
index 000000000000..24b1c8607dab
--- /dev/null
+++ b/svx/inc/svx/zoom_def.hxx
@@ -0,0 +1,8 @@
+#ifndef _SVX_ZOOM_DEF_HXX
+#define _SVX_ZOOM_DEF_HXX
+
+#define ZOOMBTN_OPTIMAL ((sal_uInt16)0x0001)
+#define ZOOMBTN_PAGEWIDTH ((sal_uInt16)0x0002)
+#define ZOOMBTN_WHOLEPAGE ((sal_uInt16)0x0004)
+
+#endif
diff --git a/svx/inc/svx/zoomctrl.hxx b/svx/inc/svx/zoomctrl.hxx
new file mode 100644
index 000000000000..0d790b23f155
--- /dev/null
+++ b/svx/inc/svx/zoomctrl.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_ZOOMCTRL_HXX
+#define _SVX_ZOOMCTRL_HXX
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/stbitem.hxx>
+#include "svx/svxdllapi.h"
+
+// class SvxZoomToolBoxControl -------------------------------------------
+
+class SVX_DLLPUBLIC SvxZoomStatusBarControl : public SfxStatusBarControl
+{
+private:
+ sal_uInt16 nZoom;
+ sal_uInt16 nValueSet;
+
+public:
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ virtual void Paint( const UserDrawEvent& rEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+
+ SFX_DECL_STATUSBAR_CONTROL();
+
+ SvxZoomStatusBarControl( sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar& rStb );
+
+ static sal_uIntPtr GetDefItemWidth(const StatusBar& rStb);
+
+};
+
+
+#endif
+
diff --git a/svx/inc/svx/zoomitem.hxx b/svx/inc/svx/zoomitem.hxx
new file mode 100644
index 000000000000..348e9ebe869a
--- /dev/null
+++ b/svx/inc/svx/zoomitem.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_ZOOMITEM_HXX
+#define _SVX_ZOOMITEM_HXX
+
+#include <svl/intitem.hxx>
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+#include "svx/svxdllapi.h"
+
+//-------------------------------------------------------------------------
+
+enum SvxZoomType
+{
+ SVX_ZOOM_PERCENT, // GetValue() ist kein besonderer prozentualer Wert
+ SVX_ZOOM_OPTIMAL, // GetValue() entspricht der optimalen Gr"o\se
+ SVX_ZOOM_WHOLEPAGE, // GetValue() entspricht der ganzen Seite
+ SVX_ZOOM_PAGEWIDTH, // GetValue() entspricht der Seitenbreite
+ SVX_ZOOM_PAGEWIDTH_NOBORDER // GetValue() pagewidth without border
+};
+
+//-------------------------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxZoomItem: public SfxUInt16Item
+{
+ sal_uInt16 nValueSet; // erlaubte Werte (siehe #defines unten)
+ SvxZoomType eType;
+
+public:
+ TYPEINFO();
+
+ SvxZoomItem( SvxZoomType eZoomType = SVX_ZOOM_PERCENT,
+ sal_uInt16 nVal = 0, sal_uInt16 nWhich = SID_ATTR_ZOOM );
+ SvxZoomItem( const SvxZoomItem& );
+ ~SvxZoomItem();
+
+ void SetValueSet( sal_uInt16 nValues ) { nValueSet = nValues; }
+ sal_uInt16 GetValueSet() const { return nValueSet; }
+ FASTBOOL IsValueAllowed( sal_uInt16 nValue ) const
+ { return nValue == ( nValue & nValueSet ); }
+
+ SvxZoomType GetType() const { return eType; }
+ void SetType( SvxZoomType eNewType )
+ { eType = eNewType; }
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rStrm, sal_uInt16 nVersion ) const;
+ virtual SvStream& Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+//------------------------------------------------------------------------
+
+#define SVX_ZOOM_ENABLE_50 0x0001
+#define SVX_ZOOM_ENABLE_75 0x0002
+#define SVX_ZOOM_ENABLE_100 0x0004
+#define SVX_ZOOM_ENABLE_150 0x0008
+#define SVX_ZOOM_ENABLE_200 0x0010
+#define SVX_ZOOM_ENABLE_OPTIMAL 0x1000
+#define SVX_ZOOM_ENABLE_WHOLEPAGE 0x2000
+#define SVX_ZOOM_ENABLE_PAGEWIDTH 0x4000
+#define SVX_ZOOM_ENABLE_ALL 0x701F
+
+#endif
diff --git a/svx/inc/svx/zoomsliderctrl.hxx b/svx/inc/svx/zoomsliderctrl.hxx
new file mode 100644
index 000000000000..46032056fc30
--- /dev/null
+++ b/svx/inc/svx/zoomsliderctrl.hxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ZOOMSLIDER_STBCONTRL_HXX
+#define _ZOOMSLIDER_STBCONTRL_HXX
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/stbitem.hxx>
+#include "svx/svxdllapi.h"
+
+// class SvxZoomSliderControl ----------------------------------------
+
+class SVX_DLLPUBLIC SvxZoomSliderControl : public SfxStatusBarControl
+{
+private:
+
+ struct SvxZoomSliderControl_Impl;
+ SvxZoomSliderControl_Impl* mpImpl;
+
+ sal_uInt16 Offset2Zoom( long nOffset ) const;
+ long Zoom2Offset( sal_uInt16 nZoom ) const;
+
+public:
+
+ SFX_DECL_STATUSBAR_CONTROL();
+
+ SvxZoomSliderControl( sal_uInt16 _nSlotId, sal_uInt16 _nId, StatusBar& _rStb );
+ ~SvxZoomSliderControl();
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+ virtual void Paint( const UserDrawEvent& rEvt );
+ virtual sal_Bool MouseButtonDown( const MouseEvent & );
+ virtual sal_Bool MouseMove( const MouseEvent & rEvt );
+};
+
+#endif
+
diff --git a/svx/inc/svx/zoomslideritem.hxx b/svx/inc/svx/zoomslideritem.hxx
new file mode 100644
index 000000000000..93b1dedb1170
--- /dev/null
+++ b/svx/inc/svx/zoomslideritem.hxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_ZOOMSLIDERITEM_HXX
+#define _SVX_ZOOMSLIDERITEM_HXX
+
+#include <svl/intitem.hxx>
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+#include <com/sun/star/uno/Sequence.hxx>
+#include "svx/svxdllapi.h"
+
+//-------------------------------------------------------------------------
+
+class SVX_DLLPUBLIC SvxZoomSliderItem: public SfxUInt16Item
+{
+ com::sun::star::uno::Sequence < sal_Int32 > maValues;
+ sal_uInt16 mnMinZoom;
+ sal_uInt16 mnMaxZoom;
+
+public:
+ TYPEINFO();
+
+ SvxZoomSliderItem( sal_uInt16 nCurrentZoom = 100, sal_uInt16 nMinZoom = 20, sal_uInt16 nMaxZoom = 600, sal_uInt16 nWhich = SID_ATTR_ZOOMSLIDER );
+ SvxZoomSliderItem( const SvxZoomSliderItem& );
+ ~SvxZoomSliderItem();
+
+ void AddSnappingPoint( sal_Int32 nNew );
+ const com::sun::star::uno::Sequence < sal_Int32 >& GetSnappingPoints() const;
+ sal_uInt16 GetMinZoom() const {return mnMinZoom;}
+ sal_uInt16 GetMaxZoom() const {return mnMaxZoom;}
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rStrm, sal_uInt16 nVersion ) const; // leer
+ virtual SvStream& Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const; // leer
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; // leer
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); // leer
+};
+
+//------------------------------------------------------------------------
+
+#endif
diff --git a/svx/inc/svxempty.hxx b/svx/inc/svxempty.hxx
new file mode 100644
index 000000000000..2e8d34d39071
--- /dev/null
+++ b/svx/inc/svxempty.hxx
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVXEMPTY_HXX
+#define _SVXEMPTY_HXX
+
+
+#include <tools/string.hxx>
+
+#ifndef ICC
+extern XubString& rImplEmptyStr;
+inline const XubString& GetEmptyStr() { return rImplEmptyStr; }
+#define GetEmptySStr GetEmptyStr
+#else
+// CSET stellt rImplEmptyStr nicht in items.lib (?)
+const XubString& GetEmptyStr();
+#define GetEmptySStr GetEmptyStr
+#endif
+
+
+#endif
+
diff --git a/svx/inc/tbunocontroller.hxx b/svx/inc/tbunocontroller.hxx
new file mode 100644
index 000000000000..266dc917f33e
--- /dev/null
+++ b/svx/inc/tbunocontroller.hxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __TBUNOCONTROLLER_HXX_
+#define __TBUNOCONTROLLER_HXX_
+
+#include <svtools/toolboxcontroller.hxx>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+namespace svx
+{
+
+class SvxFontSizeBox_Impl;
+class FontHeightToolBoxControl : public svt::ToolboxController,
+ public ::com::sun::star::lang::XServiceInfo
+{
+ public:
+ FontHeightToolBoxControl(
+ const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
+ ~FontHeightToolBoxControl();
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
+
+ static ::rtl::OUString getImplementationName_Static() throw()
+ {
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.svx.FontHeightToolBoxController" ));
+ }
+
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw();
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XToolbarController
+ virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException);
+
+ void dispatchCommand( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs );
+ using svt::ToolboxController::dispatchCommand;
+
+ private:
+ SvxFontSizeBox_Impl* m_pBox;
+ ::com::sun::star::awt::FontDescriptor m_aCurrentFont;
+};
+
+::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL FontHeightToolBoxControl_createInstance( const com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSMgr );
+
+}
+
+#endif // __TBUNOCONTROLLER_HXX_
diff --git a/svx/inc/tbunosearchcontrollers.hxx b/svx/inc/tbunosearchcontrollers.hxx
new file mode 100644
index 000000000000..21c47230df48
--- /dev/null
+++ b/svx/inc/tbunosearchcontrollers.hxx
@@ -0,0 +1,282 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __TBUNOSEARCHCONTROLLERS_HXX_
+#define __TBUNOSEARCHCONTROLLERS_HXX_
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/frame/DispatchDescriptor.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XDispatchHelper.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+
+#include <comphelper/sequenceasvector.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/weak.hxx>
+#include <svtools/toolboxcontroller.hxx>
+#include <vcl/combobox.hxx>
+#include <vcl/window.hxx>
+
+#include <map>
+
+namespace css = ::com::sun::star ;
+namespace svx
+{
+
+class FindTextFieldControl : public ComboBox
+{
+public:
+ FindTextFieldControl( Window* pParent, WinBits nStyle,
+ css::uno::Reference< css::frame::XFrame >& xFrame,
+ css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager );
+ virtual ~FindTextFieldControl();
+
+ virtual void Modify();
+ virtual long PreNotify( NotifyEvent& rNEvt );
+
+ void InitControls_Impl();
+ void Remember_Impl(const String& rStr);
+
+private:
+
+ css::uno::Reference< css::frame::XFrame > m_xFrame;
+ css::uno::Reference< css::lang::XMultiServiceFactory > m_xServiceManager;
+ sal_Bool m_bToClearTextField;
+
+};
+
+class SearchToolbarControllersManager
+{
+public:
+
+ SearchToolbarControllersManager();
+ ~SearchToolbarControllersManager();
+
+ static SearchToolbarControllersManager* createControllersManager();
+
+ void registryController( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& xStatusListener, const ::rtl::OUString& sCommandURL );
+ void freeController ( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& xStatusListener, const ::rtl::OUString& sCommandURL );
+ css::uno::Reference< css::frame::XStatusListener > findController( const css::uno::Reference< css::frame::XFrame >& xFrame, const ::rtl::OUString& sCommandURL );
+
+private:
+
+ static SearchToolbarControllersManager* m_pInstance;
+
+ typedef ::comphelper::SequenceAsVector< css::beans::PropertyValue > SearchToolbarControllersVec;
+ typedef ::std::map< css::uno::Reference< css::frame::XFrame >, SearchToolbarControllersVec > SearchToolbarControllersMap;
+ SearchToolbarControllersMap aSearchToolbarControllersMap;
+
+};
+
+class FindTextToolbarController : public svt::ToolboxController,
+ public css::lang::XServiceInfo
+{
+public:
+
+ FindTextToolbarController( const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager );
+ ~FindTextToolbarController();
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException );
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException );
+ virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException );
+
+ static ::rtl::OUString getImplementationName_Static() throw()
+ {
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.svx.FindTextToolboxController" ));
+ }
+
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw();
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException );
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException );
+
+ // XToolbarController
+ virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw ( css::uno::RuntimeException);
+ virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) throw ( css::uno::RuntimeException );
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) throw ( css::uno::RuntimeException );
+
+ DECL_LINK(EditModifyHdl, void*);
+
+private:
+
+ FindTextFieldControl* m_pFindTextFieldControl;
+
+ sal_uInt16 m_nDownSearchId; // item position of findbar
+ sal_uInt16 m_nUpSearchId; // item position of findbar
+
+};
+
+class DownSearchToolboxController : public svt::ToolboxController,
+ public css::lang::XServiceInfo
+{
+public:
+
+ DownSearchToolboxController( const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager );
+ ~DownSearchToolboxController();
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException );
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException );
+ virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException );
+
+ static ::rtl::OUString getImplementationName_Static() throw()
+ {
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.svx.DownSearchToolboxController" ));
+ }
+
+ static css::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw();
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException );
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException );
+
+ // XToolbarController
+ virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw ( css::uno::RuntimeException);
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException );
+
+};
+
+class UpSearchToolboxController : public svt::ToolboxController,
+ public css::lang::XServiceInfo
+{
+public:
+
+ UpSearchToolboxController( const css::uno::Reference< css::lang::XMultiServiceFactory >& rServiceManager );
+ ~UpSearchToolboxController();
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException );
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException );
+ virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException );
+
+ static ::rtl::OUString getImplementationName_Static() throw()
+ {
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.svx.UpSearchToolboxController" ));
+ }
+
+ static css::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw();
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException );
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException);
+
+ // XToolbarController
+ virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw ( css::uno::RuntimeException );
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException );
+
+};
+
+// protocol handler for "vnd.sun.star.findbar:*" URLs
+// The dispatch object will be used for shortcut commands for findbar
+class FindbarDispatcher : public css::lang::XServiceInfo,
+ public css::lang::XInitialization,
+ public css::frame::XDispatchProvider,
+ public css::frame::XDispatch,
+ public ::cppu::OWeakObject
+{
+public:
+
+ FindbarDispatcher( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory );
+ virtual ~FindbarDispatcher();
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException );
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException );
+ virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException );
+
+ static ::rtl::OUString getImplementationName_Static() throw()
+ {
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.Impl.FindbarDispatcher" ));
+ }
+
+ static css::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw();
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException );
+
+ // XDispatchProvider
+ virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( const css::util::URL& aURL, const ::rtl::OUString& sTargetFrameName , sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException );
+ virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptions ) throw( css::uno::RuntimeException );
+
+ // XDispatch
+ virtual void SAL_CALL dispatch( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException );
+ virtual void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener, const css::util::URL& aURL ) throw( css::uno::RuntimeException );
+ virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener, const css::util::URL& aURL ) throw( css::uno::RuntimeException );
+
+private:
+
+ css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory;
+ css::uno::Reference< css::frame::XFrame > m_xFrame;
+
+};
+
+// createInstance
+css::uno::Reference< css::uno::XInterface > SAL_CALL FindTextToolbarController_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr );
+css::uno::Reference< css::uno::XInterface > SAL_CALL DownSearchToolboxController_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr );
+css::uno::Reference< css::uno::XInterface > SAL_CALL UpSearchToolboxController_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr );
+css::uno::Reference< css::uno::XInterface > SAL_CALL FindbarDispatcher_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr );
+
+}
+
+#endif // __TBUNOSEARCHCONTROLLERS_HXX_
diff --git a/svx/inc/uiks.hxx b/svx/inc/uiks.hxx
new file mode 100644
index 000000000000..a143d6537f65
--- /dev/null
+++ b/svx/inc/uiks.hxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_UIKS_HXX
+#define _SVX_UIKS_HXX
+
+#ifndef _USR_UIKS_HXX
+#include <usr/uiks.hxx>
+#endif
+
+// DBENGINE
+
+#define UIK_XDATABASEENGINE UIK_DATABASE(00)
+#define UIK_XDATABASEFAVORITES UIK_DATABASE(01)
+#define UIK_XDATABASE UIK_DATABASE(02)
+#define UIK_XDATABASECONNECTION UIK_DATABASE(03)
+#define UIK_XTRANSACTIONSUPPORT UIK_DATABASE(04)
+#define UIK_XDATABASECURSOR UIK_DATABASE(05)
+#define UIK_XDATABASETABLE UIK_DATABASE(06)
+#define UIK_XDATABASETABLES UIK_DATABASE(07)
+#define UIK_XDATABASEQUERY UIK_DATABASE(08)
+#define UIK_XDATABASEQUERIES UIK_DATABASE(09)
+#define UIK_XDATABASERELATION UIK_DATABASE(0a)
+#define UIK_XDATABASERELATIONS UIK_DATABASE(0b)
+#define UIK_XDATABASEFIELD UIK_DATABASE(0c)
+#define UIK_XDATABASEFIELDS UIK_DATABASE(0d)
+#define UIK_XDATABASEINDEX UIK_DATABASE(0e)
+#define UIK_XDATABASEINDEXES UIK_DATABASE(0f)
+#define UIK_XDATABASEDOCUMENT UIK_DATABASE(10)
+#define UIK_XDATABASEDOCUMENTS UIK_DATABASE(11)
+#define UIK_XDATABASEWORKSPACE UIK_DATABASE(12)
+#define UIK_XDATABASEWORKSPACES UIK_DATABASE(13)
+#define UIK_XDATABASEITERATOR UIK_DATABASE(14)
+#define UIK_XPREPAREDDATABASECURSOR UIK_DATABASE(15)
+
+
+// DBENGINE
+
+// FORMS
+
+#define UIK_XFORM UIK_FORMS(01)
+#define UIK_XFORMS UIK_FORMS(02)
+#define UIK_XFORMCONTROL UIK_FORMS(03)
+
+#define UIK_XHTMLFORM UIK_FORMS(05)
+#define UIK_XHTMLFORMLISTENER UIK_FORMS(06)
+#define UIK_XDATABASEFORM UIK_FORMS(07)
+#define UIK_XBOUNDCONTROL UIK_FORMS(08)
+#define UIK_XINSERTRECORDLISTENER UIK_FORMS(09)
+#define UIK_XUPDATERECORDLISTENER UIK_FORMS(0a)
+#define UIK_XDESTROYRECORDLISTENER UIK_FORMS(0b)
+#define UIK_XCURRENTRECORDLISTENER UIK_FORMS(0c)
+#define UIK_XBOUNDCONTROLLISTENER UIK_FORMS(0d)
+#define UIK_XLOADLISTENER UIK_FORMS(0e)
+#define UIK_XERRORLISTENER UIK_FORMS(0f)
+
+#define UIK_XFORMCONTROLFACTORY UIK_FORMS(10)
+#define UIK_XFORMCONTROLLER UIK_FORMS(11)
+#define UIK_XFORMCONTROLLERLISTENER UIK_FORMS(12)
+
+// FORMS
+
+
+
+#endif
+
diff --git a/svx/inc/unomlstr.hxx b/svx/inc/unomlstr.hxx
new file mode 100644
index 000000000000..eb91531e7f11
--- /dev/null
+++ b/svx/inc/unomlstr.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_UNOMLSTR_HXX
+#define _SVX_UNOMLSTR_HXX
+
+#include <com/sun/star/util/XModifyListener.hpp>
+
+#include <cppuhelper/implbase1.hxx>
+
+class SdrObject;
+
+class SvxUnoShapeModifyListener : public ::cppu::WeakAggImplHelper1< ::com::sun::star::util::XModifyListener >
+{
+ SdrObject* mpObj;
+
+public:
+ SvxUnoShapeModifyListener( SdrObject* pObj ) throw();
+ virtual ~SvxUnoShapeModifyListener() throw();
+
+ // ::com::sun::star::util::XModifyListener
+ virtual void SAL_CALL modified(const ::com::sun::star::lang::EventObject& aEvent) throw( ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XEventListener
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException);
+
+ // internal
+ void invalidate() throw();
+};
+
+
+#endif
+
+
diff --git a/svx/inc/xpolyimp.hxx b/svx/inc/xpolyimp.hxx
new file mode 100644
index 000000000000..7b7f85110558
--- /dev/null
+++ b/svx/inc/xpolyimp.hxx
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _XPOLYIMP_HXX
+#define _XPOLYIMP_HXX
+
+#include <tools/gen.hxx>
+#include <svx/xpoly.hxx>
+
+/*************************************************************************
+|*
+|* class ImpXPolygon
+|*
+|* Beschreibung
+|* Ersterstellung 08.11.94
+|* Letzte Aenderung Joe 26.09.95
+|*
+*************************************************************************/
+class ImpXPolygon
+{
+public:
+ Point* pPointAry;
+ sal_uInt8* pFlagAry;
+ Point* pOldPointAry;
+ sal_Bool bDeleteOldPoints;
+ sal_uInt16 nSize;
+ sal_uInt16 nResize;
+ sal_uInt16 nPoints;
+ sal_uInt16 nRefCount;
+
+ ImpXPolygon( sal_uInt16 nInitSize = 16, sal_uInt16 nResize=16 );
+ ImpXPolygon( const ImpXPolygon& rImpXPoly );
+ ~ImpXPolygon();
+
+ bool operator==(const ImpXPolygon& rImpXPoly) const;
+ bool operator!=(const ImpXPolygon& rImpXPoly) const { return !operator==(rImpXPoly); }
+
+ void CheckPointDelete()
+ {
+ if ( bDeleteOldPoints )
+ {
+ delete[] (char*)pOldPointAry;
+ bDeleteOldPoints = sal_False;
+ }
+ }
+
+ void Resize( sal_uInt16 nNewSize, sal_Bool bDeletePoints = sal_True );
+ void InsertSpace( sal_uInt16 nPos, sal_uInt16 nCount );
+ void Remove( sal_uInt16 nPos, sal_uInt16 nCount );
+};
+
+
+/*************************************************************************
+|*
+|* class ImpXPolyPolygon
+|*
+|* Beschreibung
+|* Ersterstellung 08.11.94
+|* Letzte Aenderung Joe 26-09-1995
+|*
+*************************************************************************/
+DECLARE_LIST( XPolygonList, XPolygon* )
+
+class ImpXPolyPolygon
+{
+public:
+ XPolygonList aXPolyList;
+ sal_uInt16 nRefCount;
+
+ ImpXPolyPolygon( sal_uInt16 nInitSize = 16, sal_uInt16 nResize = 16 ) :
+ aXPolyList( 1024, nInitSize, nResize )
+ { nRefCount = 1; }
+ ImpXPolyPolygon( const ImpXPolyPolygon& rImpXPolyPoly );
+ ~ImpXPolyPolygon();
+
+ bool operator==(const ImpXPolyPolygon& rImpXPolyPoly) const;
+ bool operator!=(const ImpXPolyPolygon& rImpXPolyPoly) const { return !operator==(rImpXPolyPoly); }
+};
+
+
+
+#endif // _XPOLYIMP_HXX
diff --git a/svx/prj/build.lst b/svx/prj/build.lst
new file mode 100644
index 000000000000..7b541b2d77c4
--- /dev/null
+++ b/svx/prj/build.lst
@@ -0,0 +1,2 @@
+sx svx : sfx2 l10n oovbaapi connectivity xmloff linguistic jvmfwk avmedia drawinglayer editeng LIBXSLT:libxslt NULL
+sx svx\prj nmake - all sx_prj NULL
diff --git a/svx/prj/d.lst b/svx/prj/d.lst
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/svx/prj/d.lst
diff --git a/svx/prj/makefile.mk b/svx/prj/makefile.mk
new file mode 100755
index 000000000000..e312a7ccab65
--- /dev/null
+++ b/svx/prj/makefile.mk
@@ -0,0 +1,40 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..
+TARGET=prj
+
+.INCLUDE : settings.mk
+
+.IF "$(VERBOSE)"!=""
+VERBOSEFLAG :=
+.ELSE
+VERBOSEFLAG := -s
+.ENDIF
+
+all:
+ cd $(PRJ) && $(GNUMAKE) $(VERBOSEFLAG) -r -j$(MAXPROCESS) $(gb_MAKETARGET) && $(GNUMAKE) $(VERBOSEFLAG) -r deliverlog
diff --git a/svx/qa/unoapi/Test.java b/svx/qa/unoapi/Test.java
new file mode 100644
index 000000000000..2f7581e22efa
--- /dev/null
+++ b/svx/qa/unoapi/Test.java
@@ -0,0 +1,52 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+package org.openoffice.svx.qa.unoapi;
+
+import org.openoffice.Runner;
+import org.openoffice.test.OfficeConnection;
+import org.openoffice.test.Argument;
+import static org.junit.Assert.*;
+
+public final class Test {
+ @org.junit.Before public void setUp() throws Exception {
+ connection.setUp();
+ }
+
+ @org.junit.After public void tearDown()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ connection.tearDown();
+ }
+
+ @org.junit.Test public void test() {
+ assertTrue(
+ Runner.run(
+ "-sce", Argument.get("sce"), "-xcl", Argument.get("xcl"), "-tdoc",
+ Argument.get("tdoc"), "-cs", connection.getDescription()));
+ }
+
+ private final OfficeConnection connection = new OfficeConnection();
+}
diff --git a/svx/qa/unoapi/knownissues.xcl b/svx/qa/unoapi/knownissues.xcl
new file mode 100644
index 000000000000..b26db6b7f99e
--- /dev/null
+++ b/svx/qa/unoapi/knownissues.xcl
@@ -0,0 +1,90 @@
+### i85263 ###
+svx.SvxShape::com::sun::star::drawing::TextProperties::TextWritingMode
+svx.SvxShapeConnector::com::sun::star::drawing::TextProperties::TextWritingMode
+# -> disbaled in svx.sce
+
+### i46736 ###
+svx.AccessibleImageBullet
+# -> disbaled in svx.sce
+
+### i85501 ###
+svx.SvxGraphCtrlAccessibleContext
+# -> disbaled in svx.sce
+
+### i85539 ###
+svx.AccessiblePresentationShape
+# -> disbaled in svx.sce
+
+### i85476 ###
+svx.SvxUnoText::com::sun::star::text::XTextRangeMover
+
+### i85478 ###
+svx.SvxUnoTextRange::com::sun::star::text::XTextRange
+
+### i35965 ###
+svx.SvxGraphCtrlAccessibleContext::com::sun::star::accessibility::XAccessibleEventBroadcaster
+
+### i85479 ###
+svx.AccessiblePageShape::com::sun::star::accessibility::XAccessibleEventBroadcaster
+
+### i85481 ###
+svx.SvxUnoTextCursor::com::sun::star::beans::XMultiPropertyStates
+
+### i58108 ###
+svx.SvxUnoText::com::sun::star::text::XTextRangeCompare
+
+### i38623 ###
+svx.SvxUnoTextCursor::com::sun::star::text::XTextRange
+
+### i73993 ###
+svx.SvxUnoTextContent::com::sun::star::style::ParagraphProperties
+svx.SvxUnoTextCursor::com::sun::star::style::ParagraphProperties
+svx.SvxUnoTextRange::com::sun::star::style::ParagraphProperties
+svx.SvxGraphicObject::com::sun::star::style::ParagraphProperties
+svx.SvxShape::com::sun::star::style::ParagraphProperties
+svx.SvxShapeCircle::com::sun::star::style::ParagraphProperties
+svx.SvxShapeConnector::com::sun::star::style::ParagraphProperties
+svx.SvxShapeDimensioning::com::sun::star::style::ParagraphProperties
+svx.SvxShapePolyPolygon::com::sun::star::style::ParagraphProperties
+svx.SvxShapePolyPolygonBezier::com::sun::star::style::ParagraphProperties
+
+### i23461 ###
+svx.SvxDrawPage::com::sun::star::drawing::XMasterPageTarget
+
+### i85485 ###
+svx.SvxShapeDimensioning::com::sun::star::drawing::XShape
+
+### i58125 ###
+svx.SvxGraphicObject::com::sun::star::drawing::GraphicObjectShape
+
+### i87698 ###
+svx.SvxShapeDimensioning::com::sun::star::drawing::TextProperties
+
+### i87746 ###
+svx.SvxGraphicObject
+svx.SvxShapeCircle
+svx.SvxShapeControl
+svx.SvxShapeDimensioning
+svx.SvxShapeGroup
+svx.SvxShapePolyPolygon
+svx.SvxShapePolyPolygonBezier
+
+### i88543 ###
+svx.SvxUnoTextRange::com::sun::star::beans::XPropertySet
+
+### i90294 ###
+svx.GraphicExporter
+# -> disbaled in svx.sce
+
+### i98339 ###
+svx.AccessibleControlShape
+# -> disbaled in svx.sce
+
+### i111114 ###
+svx.AccessiblePresentationOLEShape::com::sun::star::accessibility::XAccessibleComponent
+
+### i111169 ###
+svx.AccessiblePageShape::com::sun::star::accessibility::XAccessibleComponent
+
+### i114642 ###
+svx.SvxUnoTextContent::com::sun::star::style::CharacterProperties
diff --git a/svx/qa/unoapi/svx.sce b/svx/qa/unoapi/svx.sce
new file mode 100644
index 000000000000..82ee2ea6b193
--- /dev/null
+++ b/svx/qa/unoapi/svx.sce
@@ -0,0 +1,31 @@
+#i98339 -o svx.AccessibleControlShape
+#i111278 -o svx.AccessibleEditableTextPara
+#i111252 -o svx.AccessibleGraphicShape
+#i46736 -o svx.AccessibleImageBullet
+#i111252 -o svx.AccessibleOLEShape
+#i111252 -o svx.AccessiblePageShape
+#i111216 -o svx.AccessiblePresentationGraphicShape
+#i111216 -o svx.AccessiblePresentationOLEShape
+#i85539 -o svx.AccessiblePresentationShape
+-o svx.AccessibleShape
+#i90294 -o svx.GraphicExporter
+-o svx.SvxDrawPage
+#i85501 -o svx.SvxGraphCtrlAccessibleContext
+#i87746 -o svx.SvxGraphicObject
+#i85263 -o svx.SvxShape
+#i87746 -o svx.SvxShapeCircle
+-o svx.SvxShapeCollection
+#i85263 -o svx.SvxShapeConnector
+#i87746 -o svx.SvxShapeControl
+#i87746 -o svx.SvxShapeDimensioning
+#i87746 -o svx.SvxShapeGroup
+#i87746 -o svx.SvxShapePolyPolygon
+#i87746 -o svx.SvxShapePolyPolygonBezier
+-o svx.SvxUnoNumberingRules
+-o svx.SvxUnoText
+-o svx.SvxUnoTextContent
+-o svx.SvxUnoTextContentEnum
+-o svx.SvxUnoTextCursor
+-o svx.SvxUnoTextField
+-o svx.SvxUnoTextRange
+-o svx.SvxUnoTextRangeEnumeration
diff --git a/svx/qa/unoapi/testdocuments/SvxShape.sxd b/svx/qa/unoapi/testdocuments/SvxShape.sxd
new file mode 100644
index 000000000000..27f06d54166d
--- /dev/null
+++ b/svx/qa/unoapi/testdocuments/SvxShape.sxd
Binary files differ
diff --git a/svx/qa/unoapi/testdocuments/crazy-blue.jpg b/svx/qa/unoapi/testdocuments/crazy-blue.jpg
new file mode 100644
index 000000000000..001c88b63d88
--- /dev/null
+++ b/svx/qa/unoapi/testdocuments/crazy-blue.jpg
Binary files differ
diff --git a/svx/qa/unoapi/testdocuments/space-metal.jpg b/svx/qa/unoapi/testdocuments/space-metal.jpg
new file mode 100644
index 000000000000..d23344389073
--- /dev/null
+++ b/svx/qa/unoapi/testdocuments/space-metal.jpg
Binary files differ
diff --git a/svx/sdi/fmslots.sdi b/svx/sdi/fmslots.sdi
new file mode 100644
index 000000000000..1a368920ab9a
--- /dev/null
+++ b/svx/sdi/fmslots.sdi
@@ -0,0 +1,770 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+interface Form
+[
+ uuid = "F38D29A3-9EDA-11d1-AAF5-00A0248A7FBC"
+]
+{
+ SID_FM_CONFIG // ole : no, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_PUSHBUTTON
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_RADIOBUTTON
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_CHECKBOX
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_FIXEDTEXT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_GROUPBOX
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_LISTBOX
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_COMBOBOX
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_NAVIGATIONBAR
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_EDIT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_DBGRID
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_IMAGEBUTTON
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_IMAGECONTROL
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_FILECONTROL
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_DATEFIELD
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_TIMEFIELD
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_NUMERICFIELD
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_CURRENCYFIELD
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_PATTERNFIELD
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_FORMATTEDFIELD
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_SCROLLBAR
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_SPINBUTTON
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_CTL_PROPERTIES
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_PROPERTIES
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_TAB_DIALOG
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_ADD_FIELD
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_DESIGN_MODE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_OPEN_READONLY
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_USE_WIZARDS
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_AUTOCONTROLFOCUS
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_SHOW_FMEXPLORER
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_SHOW_PROPERTY_BROWSER
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_SHOW_DATANAVIGATOR
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_RECORD_FIRST
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_RECORD_NEXT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_RECORD_PREV
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_RECORD_LAST
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_RECORD_NEW
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_RECORD_DELETE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_RECORD_ABSOLUTE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_RECORD_TEXT
+ [
+ ]
+ SID_FM_RECORD_FROM_TEXT
+ [
+ ]
+ SID_FM_RECORD_TOTAL
+ [
+ StateMethod = GetState ;
+ ]
+ SID_FM_RECORD_SAVE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_RECORD_UNDO
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_FORM_FILTERED
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_REMOVE_FILTER_SORT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_SORTUP
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_SORTDOWN
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_ORDERCRIT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_FILTER_START
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_AUTOFILTER
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_REFRESH
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_REFRESH_FORM_CONTROL
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_SEARCH
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_FILTER_NAVIGATOR
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_FILTER_EXIT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_FILTER_EXECUTE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ //--------------------------------------------------------------------------
+ SID_FM_FMEXPLORER_CONTROL
+ [
+ StateMethod = GetState ;
+ ]
+ //--------------------------------------------------------------------------
+ SID_FM_DATANAVIGATOR_CONTROL
+ [
+ StateMethod = GetState ;
+ ]
+ //--------------------------------------------------------------------------
+ SID_FM_FIELDS_CONTROL
+ [
+ StateMethod = GetState ;
+ ]
+ //--------------------------------------------------------------------------
+ SID_FM_PROPERTY_CONTROL
+ [
+ StateMethod = GetState ;
+ ]
+ //--------------------------------------------------------------------------
+ SID_FM_FILTER_NAVIGATOR_CONTROL
+ [
+ StateMethod = GetState ;
+ ]
+ //--------------------------------------------------------------------------
+ SID_FM_SHOW_PROPERTIES
+ [
+ StateMethod = GetState ;
+ ExecMethod = Execute ;
+ ]
+
+ SID_FM_VIEW_AS_GRID
+ [
+ StateMethod = GetState ;
+ ExecMethod = Execute ;
+ ]
+}
+
+interface FormTextAttributeShell
+{
+ SID_CUT
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_COPY
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_PASTE
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_SELECTALL
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+
+ SID_ATTR_PARA_ADJUST
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_PARA_ADJUST_LEFT
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_PARA_ADJUST_CENTER
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_PARA_ADJUST_RIGHT
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_PARA_ADJUST_BLOCK
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_SET_SUPER_SCRIPT
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_SET_SUB_SCRIPT
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_UNDERLINE
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_OVERLINE
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_WEIGHT
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_POSTURE
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_STRIKEOUT
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_SHADOWED
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_CHAR_DLG
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_PARA_DLG
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_FONT
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_FONTHEIGHT
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_PARA_LINESPACE_10
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_PARA_LINESPACE_15
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_PARA_LINESPACE_20
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_CONTOUR
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_CLIPBOARD_FORMAT_ITEMS
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_WORDLINEMODE
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_COLOR
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_RELIEF
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_ESCAPEMENT
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_SCALEWIDTH
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_KERNING
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_AUTOKERN
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_LANGUAGE
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_PARA_LINESPACE
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_ULSPACE
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_LRSPACE
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_PARA_LEFT_TO_RIGHT
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_PARA_RIGHT_TO_LEFT
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+
+ /**** <HACK> ****/
+ // the following is a slight hack. Problem is that the form shell needs to translate
+ // slot names/args into URL dispatch names/args. For this, the SfxSlotPool is used
+ // - it provides convinient methods for this. However, the "pool" is not really a
+ // "pool" - it only knows slots, if there is a shell on the dispatcher stack which
+ // which is responsible for this slot.
+ // So, we declare the form shell as responsible for the following slots.
+ SID_ATTR_CHAR_CJK_FONT
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_CTL_FONT
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_CJK_FONTHEIGHT
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_CTL_FONTHEIGHT
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_CJK_WEIGHT
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_CTL_WEIGHT
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_CJK_POSTURE
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_CTL_POSTURE
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_EMPHASISMARK
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_LATIN_FONT
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_LATIN_FONTHEIGHT
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_LATIN_LANGUAGE
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_LATIN_POSTURE
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ SID_ATTR_CHAR_LATIN_WEIGHT
+ [
+ ExecMethod = ExecuteTextAttribute;
+ StateMethod = GetTextAttributeState;
+ ]
+ /**** </HACK> ****/
+}
+
+shell FmFormShell
+{
+ import FormTextAttributeShell;
+ import Form [Automation];
+
+ SID_FM_CONFIG // ole : no, status : ?
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_MORE_CONTROLS
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_FORM_DESIGN_TOOLS
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_LEAVE_CREATE
+ [
+ ExecMethod = Execute ;
+ ]
+ SID_FM_TOGGLECONTROLFOCUS
+ [
+ ExecMethod = Execute ;
+ ]
+ SID_FM_CHANGECONTROLTYPE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_CONVERTTO_EDIT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_CONVERTTO_BUTTON
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_CONVERTTO_FIXEDTEXT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_CONVERTTO_LISTBOX
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_CONVERTTO_CHECKBOX
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_CONVERTTO_RADIOBUTTON
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_CONVERTTO_GROUPBOX
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_CONVERTTO_COMBOBOX
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_CONVERTTO_IMAGEBUTTON
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_CONVERTTO_FILECONTROL
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_CONVERTTO_DATE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_CONVERTTO_TIME
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_CONVERTTO_NUMERIC
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_CONVERTTO_CURRENCY
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_CONVERTTO_PATTERN
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_CONVERTTO_IMAGECONTROL
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_CONVERTTO_FORMATTED
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_CONVERTTO_SCROLLBAR
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_CONVERTTO_SPINBUTTON
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_FM_CONVERTTO_NAVIGATIONBAR
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+}
+
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
new file mode 100644
index 000000000000..a3b4c9a9ca21
--- /dev/null
+++ b/svx/sdi/svx.sdi
@@ -0,0 +1,15138 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+SfxBoolItem AbsoluteRecord SID_FM_RECORD_ABSOLUTE
+(SfxInt32Item Position FN_PARAM_1)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxInt32Item
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem AddField SID_FM_ADD_FIELD
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem AddTable SID_FM_ADDTABLE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem AlignCenter SID_OBJECT_ALIGN_CENTER
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem AlignDown SID_OBJECT_ALIGN_DOWN
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ObjectAlignLeft SID_OBJECT_ALIGN_LEFT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxAdjustItem Alignment SID_ATTR_PARA_ADJUST
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem AlignMiddle SID_OBJECT_ALIGN_MIDDLE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ObjectAlignRight SID_OBJECT_ALIGN_RIGHT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem AlignUp SID_OBJECT_ALIGN_UP
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Arc SID_DRAW_ARC
+(SfxUInt32Item CenterX ID_VAL_CENTER_X,SfxUInt32Item CenterY ID_VAL_CENTER_Y,SfxUInt32Item AxisX ID_VAL_AXIS_X,SfxUInt32Item AxisY ID_VAL_AXIS_Y,SfxUInt32Item StartAngle ID_VAL_ANGLESTART,SfxUInt32Item EndAngle ID_VAL_ANGLEEND)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Assign3D SID_3D_ASSIGN
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem AutoControlFocus SID_FM_AUTOCONTROLFOCUS
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem AutoFilter SID_FM_AUTOFILTER
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem AutoFormat SID_AUTOFORMAT
+(SfxStringItem aFormatName SID_AUTOFORMAT)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+
+SfxStringItem TableStyle SID_TABLE_STYLE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ 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 TableStyleSettings SID_TABLE_STYLE_SETTINGS
+(SfxBoolItem UseFirstRowStyle ID_VAL_USEFIRSTROWSTYLE,
+ SfxBoolItem UseLastRowStyle ID_VAL_USELASTROWSTYLE,
+ SfxBoolItem UseBandingRowStyle ID_VAL_USEBANDINGROWSTYLE,
+ SfxBoolItem UseFirstColumnStyle ID_VAL_USEFIRSTCOLUMNSTYLE,
+ SfxBoolItem UseLastColumnStyle ID_VAL_USELASTCOLUMNSTYLE,
+ SfxBoolItem UseBandingColumnStyle ID_VAL_USEBANDINGCOLUMNSTYLE)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem TableDesign SID_TABLEDESIGN
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+//--------------------------------------------------------------------------
+SvxColorItem BackgroundColor SID_BACKGROUND_COLOR
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxBrushItem BackgroundPattern SID_ATTR_BRUSH
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxBrushItem BackgroundPatternController SID_BACKGROUND_PATTERN
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Bezier_Unfilled SID_DRAW_BEZIER_NOFILL
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordManual;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem BezierAppend SID_BEZIER_APPEND
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxStringItem BezierClose SID_BEZIER_CLOSE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxStringItem BezierConvert SID_BEZIER_CONVERT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem BezierCutLine SID_BEZIER_CUTLINE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem BezierDelete SID_BEZIER_DELETE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem BezierEdge SID_BEZIER_EDGE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem BezierEliminatePoints SID_BEZIER_ELIMINATE_POINTS
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem BezierFill SID_DRAW_BEZIER_FILL
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordManual;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem BezierInsert SID_BEZIER_INSERT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem BezierMove SID_BEZIER_MOVE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem BezierSmooth SID_BEZIER_SMOOTH
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem BezierSymmetric SID_BEZIER_SYMMTR
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem BezierTo SID_BEZIERTO
+(SfxUInt32Item MouseEndX ID_VAL_MOUSEEND_X,SfxUInt32Item MouseEndY ID_VAL_MOUSEEND_Y)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = ;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem BmpMask SID_BMPMASK
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DOCUMENT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem BmpMaskExec SID_BMPMASK_EXEC
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DOCUMENT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem BmpMaskPipette SID_BMPMASK_PIPETTE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DOCUMENT;
+]
+
+//--------------------------------------------------------------------------
+SvxWeightItem Bold SID_ATTR_CHAR_WEIGHT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxWeightItem BoldLatin SID_ATTR_CHAR_LATIN_WEIGHT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxWeightItem BoldCJK SID_ATTR_CHAR_CJK_WEIGHT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxWeightItem BoldCTL SID_ATTR_CHAR_CTL_WEIGHT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxObjectItem Border SID_BORDER_OBJECT
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = TRUE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = ;
+]
+
+//--------------------------------------------------------------------------
+SvxBoxInfoItem BorderInner SID_ATTR_BORDER_INNER
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxBoxItem BorderOuter SID_ATTR_BORDER_OUTER
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SetBorderStyle SID_ATTR_BORDER
+(SvxBoxItem OuterBorder SID_ATTR_BORDER_OUTER,SvxBoxInfoItem InnerBorder SID_ATTR_BORDER_INNER)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SvxBoxItem
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem BringToFront SID_FRAME_TO_TOP
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem DrawCaption SID_DRAW_CAPTION
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SvxCaseMapItem CaseMap SID_ATTR_CHAR_CASEMAP
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem CenterPara SID_ATTR_PARA_ADJUST_CENTER
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ChangeCaseToFullWidth SID_TRANSLITERATE_FULLWIDTH
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ChangeCaseToHalfWidth SID_TRANSLITERATE_HALFWIDTH
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ChangeCaseToHiragana SID_TRANSLITERATE_HIRAGANA
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ChangeCaseToKatakana SID_TRANSLITERATE_KATAGANA
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ChangeCaseToSentenceCase SID_TRANSLITERATE_SENTENCE_CASE
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ChangeCaseToTitleCase SID_TRANSLITERATE_TITLE_CASE
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ChangeCaseToToggleCase SID_TRANSLITERATE_TOGGLE_CASE
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ChangeCaseToLower SID_TRANSLITERATE_LOWER
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ChangeCaseToUpper SID_TRANSLITERATE_UPPER
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ChangeControlType SID_FM_CHANGECONTROLTYPE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = ;
+]
+
+//--------------------------------------------------------------------------
+SvxFontItem CharFontName SID_ATTR_CHAR_FONT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxFontItem CharFontNameLatin SID_ATTR_CHAR_LATIN_FONT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxFontItem CharFontNameCJK SID_ATTR_CHAR_CJK_FONT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxFontItem CharFontNameCTL SID_ATTR_CHAR_CTL_FONT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Checkbox SID_INSERT_CHECKBOX
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem CheckBox SID_FM_CHECKBOX
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SvxChooseControlItem ChooseControls SID_CHOOSE_CONTROLS
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+ PseudoSlots = TRUE;
+ PseudoPrefix = SID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ChoosePolygon SID_CHOOSE_POLYGON
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Circle SID_DRAW_CIRCLE
+(SfxUInt32Item CenterX ID_VAL_CENTER_X,SfxUInt32Item CenterY ID_VAL_CENTER_Y,SfxUInt32Item AxisX ID_VAL_AXIS_X,SfxUInt32Item AxisY ID_VAL_AXIS_Y)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordManual;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Circle_Unfilled SID_DRAW_CIRCLE_NOFILL
+(SfxUInt32Item CenterX ID_VAL_CENTER_X,SfxUInt32Item CenterY ID_VAL_CENTER_Y,SfxUInt32Item AxisX ID_VAL_AXIS_X,SfxUInt32Item AxisY ID_VAL_AXIS_Y)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordManual;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem CircleArc SID_DRAW_CIRCLEARC
+(SfxUInt32Item CenterX ID_VAL_CENTER_X,SfxUInt32Item CenterY ID_VAL_CENTER_Y,SfxUInt32Item AxisX ID_VAL_AXIS_X,SfxUInt32Item AxisY ID_VAL_AXIS_Y,SfxUInt32Item StartAngle ID_VAL_ANGLESTART,SfxUInt32Item EndAngle ID_VAL_ANGLEEND)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordManual;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem CircleCut SID_DRAW_CIRCLECUT
+(SfxUInt32Item CenterX ID_VAL_CENTER_X,SfxUInt32Item CenterY ID_VAL_CENTER_Y,SfxUInt32Item AxisX ID_VAL_AXIS_X,SfxUInt32Item AxisY ID_VAL_AXIS_Y,SfxUInt32Item StartAngle ID_VAL_ANGLESTART,SfxUInt32Item EndAngle ID_VAL_ANGLEEND)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem CircleCut_Unfilled SID_DRAW_CIRCLECUT_NOFILL
+(SfxUInt32Item CenterX ID_VAL_CENTER_X,SfxUInt32Item CenterY ID_VAL_CENTER_Y,SfxUInt32Item AxisX ID_VAL_AXIS_X,SfxUInt32Item AxisY ID_VAL_AXIS_Y,SfxUInt32Item StartAngle ID_VAL_ANGLESTART,SfxUInt32Item EndAngle ID_VAL_ANGLEEND)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordManual;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem CirclePie SID_DRAW_CIRCLEPIE
+(SfxUInt32Item CenterX ID_VAL_CENTER_X,SfxUInt32Item CenterY ID_VAL_CENTER_Y,SfxUInt32Item AxisX ID_VAL_AXIS_X,SfxUInt32Item AxisY ID_VAL_AXIS_Y,SfxUInt32Item StartAngle ID_VAL_ANGLESTART,SfxUInt32Item EndAngle ID_VAL_ANGLEEND)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordManual;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem CirclePie_Unfilled SID_DRAW_CIRCLEPIE_NOFILL
+(SfxUInt32Item CenterX ID_VAL_CENTER_X,SfxUInt32Item CenterY ID_VAL_CENTER_Y,SfxUInt32Item AxisX ID_VAL_AXIS_X,SfxUInt32Item AxisY ID_VAL_AXIS_Y,SfxUInt32Item StartAngle ID_VAL_ANGLESTART,SfxUInt32Item EndAngle ID_VAL_ANGLEEND)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordManual;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ClearOutline SID_OUTLINE_DELETEALL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DATA;
+]
+
+//--------------------------------------------------------------------------
+SvxColorItem Color SID_ATTR_CHAR_COLOR
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ColorControl SID_COLOR_CONTROL
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ComboBox SID_FM_COMBOBOX
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem NavigationBar SID_FM_NAVIGATIONBAR
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Combobox SID_INSERT_COMBOBOX
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt16Item Config SID_FM_CONFIG
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+ PseudoSlots = TRUE;
+ PseudoPrefix = SID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem MoreControls SID_FM_MORE_CONTROLS
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+ PseudoSlots = TRUE;
+ PseudoPrefix = SID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem FormDesignTools SID_FM_FORM_DESIGN_TOOLS
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+ PseudoSlots = TRUE;
+ PseudoPrefix = SID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ContourDialog SID_CONTOUR_DLG
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_GRAPHIC;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ContourExecute SID_CONTOUR_EXEC
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ControlProperties SID_FM_CTL_PROPERTIES
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConvertToButton SID_FM_CONVERTTO_BUTTON
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConvertToCheckBox SID_FM_CONVERTTO_CHECKBOX
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConvertToCombo SID_FM_CONVERTTO_COMBOBOX
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConvertToCurrency SID_FM_CONVERTTO_CURRENCY
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConvertToDate SID_FM_CONVERTTO_DATE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConvertToEdit SID_FM_CONVERTTO_EDIT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConvertToFileControl SID_FM_CONVERTTO_FILECONTROL
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConvertToFixed SID_FM_CONVERTTO_FIXEDTEXT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConvertToFormatted SID_FM_CONVERTTO_FORMATTED
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConvertToScrollBar SID_FM_CONVERTTO_SCROLLBAR
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConvertToSpinButton SID_FM_CONVERTTO_SPINBUTTON
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConvertToGroup SID_FM_CONVERTTO_GROUPBOX
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConvertToImageBtn SID_FM_CONVERTTO_IMAGEBUTTON
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConvertToImageControl SID_FM_CONVERTTO_IMAGECONTROL
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConvertToList SID_FM_CONVERTTO_LISTBOX
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConvertToNumeric SID_FM_CONVERTTO_NUMERIC
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConvertToPattern SID_FM_CONVERTTO_PATTERN
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConvertToRadio SID_FM_CONVERTTO_RADIOBUTTON
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConvertToTime SID_FM_CONVERTTO_TIME
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ConvertToNavigationBar SID_FM_CONVERTTO_NAVIGATIONBAR
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem CountAll SID_FM_COUNTALL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem CreateControl SID_FM_CREATE_CONTROL
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem InsertCurrencyField SID_INSERT_CURRENCYFIELD
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem CurrencyField SID_FM_CURRENCYFIELD
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Dash SID_DASH
+(SfxStringItem Name ID_VAL_INDEX,SfxUInt32Item Style ID_VAL_STYLE,SfxUInt32Item Dots ID_VAL_DOTS,SfxUInt32Item DotLen ID_VAL_DOTLEN,SfxUInt32Item Dashes ID_VAL_DASHES,SfxUInt32Item DashLen ID_VAL_DASHLEN,SfxUInt32Item Distance ID_VAL_DISTANCE)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DOCUMENT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem AddDateField SID_INSERT_DATEFIELD
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem DateField SID_FM_DATEFIELD
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DefaultBullet FN_NUM_BULLET_ON
+(SfxBoolItem On FN_PARAM_1)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_ENUMERATION;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem DeleteRecord SID_FM_RECORD_DELETE
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem SwitchControlDesignMode SID_FM_DESIGN_MODE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = TRUE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DistributeSelection SID_DISTRIBUTE_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem DrawSelect SID_DRAW_SELECT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SvxDrawToolItem InsertDraw SID_INSERT_DRAW
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+ PseudoSlots = TRUE;
+ PseudoPrefix = SID_DRAW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem DSBrowserExplorer SID_DSBROWSER_EXPLORER
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Edit SID_FM_EDIT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem InsertEdit SID_INSERT_EDIT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Ellipse SID_DRAW_ELLIPSE
+(SfxUInt32Item CenterX ID_VAL_CENTER_X,SfxUInt32Item CenterY ID_VAL_CENTER_Y,SfxUInt32Item AxisX ID_VAL_AXIS_X,SfxUInt32Item AxisY ID_VAL_AXIS_Y)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Ellipse_Unfilled SID_DRAW_ELLIPSE_NOFILL
+(SfxUInt32Item CenterX ID_VAL_CENTER_X,SfxUInt32Item CenterY ID_VAL_CENTER_Y,SfxUInt32Item AxisX ID_VAL_AXIS_X,SfxUInt32Item AxisY ID_VAL_AXIS_Y)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordManual;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem EllipseCut SID_DRAW_ELLIPSECUT
+(SfxUInt32Item CenterX ID_VAL_CENTER_X,SfxUInt32Item CenterY ID_VAL_CENTER_Y,SfxUInt32Item AxisX ID_VAL_AXIS_X,SfxUInt32Item AxisY ID_VAL_AXIS_Y,SfxUInt32Item StartAngle ID_VAL_ANGLESTART,SfxUInt32Item EndAngle ID_VAL_ANGLEEND)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordManual;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem EllipseCut_Unfilled SID_DRAW_ELLIPSECUT_NOFILL
+(SfxUInt32Item CenterX ID_VAL_CENTER_X,SfxUInt32Item CenterY ID_VAL_CENTER_Y,SfxUInt32Item AxisX ID_VAL_AXIS_X,SfxUInt32Item AxisY ID_VAL_AXIS_Y,SfxUInt32Item StartAngle ID_VAL_ANGLESTART,SfxUInt32Item EndAngle ID_VAL_ANGLEEND)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordManual;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem EnterGroup SID_ENTER_GROUP
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxEscapementItem Escapement SID_ATTR_CHAR_ESCAPEMENT
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxObjectItem FieldController SID_FM_FIELDS_CONTROL
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = ;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem FileControl SID_FM_FILECONTROL
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem InsertFileControl SID_INSERT_FILECONTROL
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem InsertTreeControl SID_INSERT_TREECONTROL
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+
+//--------------------------------------------------------------------------
+XFillBitmapItem FillBitmap SID_ATTR_FILL_BITMAP
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_SPECIAL;
+]
+
+//--------------------------------------------------------------------------
+XFillColorItem FillColor SID_ATTR_FILL_COLOR
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+XFillGradientItem FillGradient SID_ATTR_FILL_GRADIENT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+XFillHatchItem FillHatch SID_ATTR_FILL_HATCH
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_SPECIAL;
+]
+
+//--------------------------------------------------------------------------
+XFillStyleItem FillStyle SID_ATTR_FILL_STYLE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem FilterCrit SID_FM_FILTERCRIT
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem FirstRecord SID_FM_RECORD_FIRST
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SvxBlinkItem Flash SID_ATTR_FLASH
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxObjectItem FmExplorerController SID_FM_FMEXPLORER_CONTROL
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = ;
+]
+
+//--------------------------------------------------------------------------
+SfxObjectItem FmFilterNavigatorController SID_FM_FILTER_NAVIGATOR_CONTROL
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = ;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem FontDialog SID_CHAR_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxFontHeightItem FontHeight SID_ATTR_CHAR_FONTHEIGHT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxFontHeightItem FontHeighLatin SID_ATTR_CHAR_LATIN_FONTHEIGHT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxFontHeightItem FontHeightCJK SID_ATTR_CHAR_CJK_FONTHEIGHT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxFontHeightItem FontHeightCTL SID_ATTR_CHAR_CTL_FONTHEIGHT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem FontWork SID_FONTWORK
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+XFormTextAdjustItem FontWorkTextAdjust SID_FORMTEXT_ADJUST
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_SPECIAL;
+]
+
+//--------------------------------------------------------------------------
+XFormTextStdFormItem FontWorkTextClearAttributes SID_FORMTEXT_STDFORM
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_SPECIAL;
+]
+
+//--------------------------------------------------------------------------
+XFormTextDistanceItem FontWorkTextDistance SID_FORMTEXT_DISTANCE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_SPECIAL;
+]
+
+//--------------------------------------------------------------------------
+XFormTextMirrorItem FontWorkTextMirror SID_FORMTEXT_MIRROR
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_SPECIAL;
+]
+
+//--------------------------------------------------------------------------
+XFormTextOutlineItem FontWorkTextOutline SID_FORMTEXT_OUTLINE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_SPECIAL;
+]
+
+//--------------------------------------------------------------------------
+XFormTextShadowItem FontWorkTextShadow SID_FORMTEXT_SHADOW
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_SPECIAL;
+]
+
+//--------------------------------------------------------------------------
+XFormTextShadowColorItem FontWorkTextShadowColor SID_FORMTEXT_SHDWCOLOR
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_SPECIAL;
+]
+
+//--------------------------------------------------------------------------
+XFormTextShadowXValItem FontWorkTextShadowXVal SID_FORMTEXT_SHDWXVAL
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_SPECIAL;
+]
+
+//--------------------------------------------------------------------------
+XFormTextShadowYValItem FontWorkTextShadowYVal SID_FORMTEXT_SHDWYVAL
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_SPECIAL;
+]
+
+//--------------------------------------------------------------------------
+XFormTextStartItem FontWorkTextStart SID_FORMTEXT_START
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_SPECIAL;
+]
+
+//--------------------------------------------------------------------------
+XFormTextStyleItem FontWorkTextStyle SID_FORMTEXT_STYLE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_SPECIAL;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem FormatArea SID_ATTRIBUTES_AREA
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+XFormTextHideFormItem FormatFontWorkClose SID_FORMTEXT_HIDEFORM
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_SPECIAL;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem FormatGroup SID_GROUP
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem FormatLine SID_ATTRIBUTES_LINE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem FormattedField SID_FM_FORMATTEDFIELD
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ScrollBar SID_FM_SCROLLBAR
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem SpinButton SID_FM_SPINBUTTON
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem InsertFormattedField SID_INSERT_FORMATTEDFIELD
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem FormatUngroup SID_UNGROUP
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem FormFilter SID_FM_FILTER_START
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem FormFiltered SID_FM_FORM_FILTERED
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem FormFilterExecute SID_FM_FILTER_EXECUTE
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem FormFilterExit SID_FM_FILTER_EXIT
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem FormFilterNavigator SID_FM_FILTER_NAVIGATOR
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem FormProperties SID_FM_PROPERTIES
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Freeline SID_DRAW_FREELINE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Freeline_Unfilled SID_DRAW_FREELINE_NOFILL
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem AutoColorInvalid SID_ATTR_AUTO_COLOR_INVALID
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = TRUE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Gallery SID_GALLERY
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = TRUE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GalleryEnableAddCopy SID_GALLERY_ENABLE_ADDCOPY
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxStringListItem GetRedoStrings SID_GETREDOSTRINGS
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxStringListItem GetUndoStrings SID_GETUNDOSTRINGS
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GrafAttrCrop SID_ATTR_GRAF_CROP
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxInt16Item GrafBlue SID_ATTR_GRAF_BLUE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxInt16Item GrafContrast SID_ATTR_GRAF_CONTRAST
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt32Item GrafGamma SID_ATTR_GRAF_GAMMA
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxInt16Item GrafGreen SID_ATTR_GRAF_GREEN
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GrafInvert SID_ATTR_GRAF_INVERT
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxInt16Item GrafLuminance SID_ATTR_GRAF_LUMINANCE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt16Item GrafMode SID_ATTR_GRAF_MODE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxInt16Item GrafRed SID_ATTR_GRAF_RED
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt16Item GrafTransparence SID_ATTR_GRAF_TRANSPARENCE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GraphicFilterInvert SID_GRFFILTER_INVERT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GraphicFilterMosaic SID_GRFFILTER_MOSAIC
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GraphicFilterPopart SID_GRFFILTER_POPART
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GraphicFilterPoster SID_GRFFILTER_POSTER
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GraphicFilterRelief SID_GRFFILTER_EMBOSS
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GraphicFilterRemoveNoise SID_GRFFILTER_REMOVENOISE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GraphicFilterSepia SID_GRFFILTER_SEPIA
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GraphicFilterSharpen SID_GRFFILTER_SHARPEN
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GraphicFilterSmooth SID_GRFFILTER_SMOOTH
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GraphicFilterSobel SID_GRFFILTER_SOBEL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem GraphicFilterSolarize SID_GRFFILTER_SOLARIZE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+TbxImageItem GraphicFilterToolbox SID_GRFFILTER
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Grid SID_FM_DBGRID
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GridUse SID_GRID_USE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GridVisible SID_GRID_VISIBLE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Group SID_OUTLINE_MAKE
+(SfxStringItem RowOrCol SID_OUTLINE_MAKE)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DATA;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem GroupBox SID_FM_GROUPBOX
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Groupbox SID_INSERT_GROUPBOX
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxRectangleItem HeaderFooterBorder SID_RULER_LR_MIN_MAX
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = ;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem HelplinesMove SID_HELPLINES_MOVE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem HFixedLine SID_INSERT_HFIXEDLINE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem HideDetail SID_OUTLINE_HIDE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DATA;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem HScrollbar SID_INSERT_HSCROLLBAR
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SvxHyperlinkItem Hyperlink SID_HYPERLINK_GETLINK
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = TRUE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Imagebutton SID_FM_IMAGEBUTTON
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ImageControl SID_FM_IMAGECONTROL
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem InsertImageControl SID_INSERT_IMAGECONTROL
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ImageMapDialog SID_IMAP
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_GRAPHIC;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ImageMapExecute SID_IMAP_EXEC
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Init3D SID_3D_INIT
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InPlaceObjectResize SID_OBJECTRESIZE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DOCUMENT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem EnterString SID_ENTER_STRING
+(SfxStringItem StringName SID_ENTER_STRING)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_INTERN;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertAnnotation SID_INSERT_POSTIT
+(SvxPostItAuthorItem Author SID_ATTR_POSTIT_AUTHOR,SvxPostItDateItem Date SID_ATTR_POSTIT_DATE,SvxPostItTextItem Text SID_ATTR_POSTIT_TEXT)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ShowAnnotations SID_SHOW_POSTIT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+
+SfxVoidItem ReplyToAnnotation SID_REPLYTO_POSTIT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DOCUMENT;
+]
+
+//--------------------------------------------------------------------------
+
+SfxVoidItem DeleteAnnotation SID_DELETE_POSTIT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DOCUMENT;
+]
+
+//--------------------------------------------------------------------------
+
+SfxVoidItem DeleteAllAnnotation SID_DELETEALL_POSTIT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DOCUMENT;
+]
+
+SfxVoidItem DeleteAllAnnotationByAuthor SID_DELETEALLBYAUTHOR_POSTIT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DOCUMENT;
+]
+
+//--------------------------------------------------------------------------
+
+SfxVoidItem NextAnnotation SID_NEXT_POSTIT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+
+SfxVoidItem PreviousAnnotation SID_PREVIOUS_POSTIT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt32Item InsertGalleryPic SID_GALLERY_FORMATS
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem InsertGraphic SID_INSERT_GRAPHIC
+(SfxStringItem FileName SID_INSERT_GRAPHIC,SfxStringItem FilterName FN_PARAM_FILTER,SfxBoolItem AsLink FN_PARAM_1,SfxStringItem Style FN_PARAM_2)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertImage SID_INSERT_IMAGE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertMath SID_INSERT_MATH
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem InsertMode SID_ATTR_INSERT
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = TRUE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DefaultNumbering FN_NUM_NUMBERING_ON
+(SfxBoolItem On FN_PARAM_1)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_ENUMERATION;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertObject SID_INSERT_OBJECT
+( SfxGlobalNameItem ClassId SID_INSERT_OBJECT )
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertObjectChart SID_INSERT_DIAGRAM
+(SfxBoolItem ColHeaders FN_PARAM_1,SfxBoolItem RowHeaders FN_PARAM_2,SfxBoolItem InNewTable FN_PARAM_4,SfxStringItem RangeList FN_PARAM_5)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertPlugin SID_INSERT_PLUGIN
+(SfxStringItem ClassLocation FN_PARAM_2,
+ SfxStringItem Commands FN_PARAM_3)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertSound SID_INSERT_SOUND
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertSymbol SID_CHARMAP
+(SfxStringItem Symbols SID_CHARMAP, SfxStringItem FontName SID_ATTR_SPECIALCHAR)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertSpreadsheet SID_ATTR_TABLE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+
+SfxVoidItem InsertTable SID_INSERT_TABLE
+(SfxUInt16Item Columns SID_ATTR_TABLE_COLUMN,SfxUInt16Item Rows SID_ATTR_TABLE_ROW )
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* status: */
+ SlotType = SfxUInt16Item
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertTextFrame SID_INSERT_FRAME
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InsertVideo SID_INSERT_VIDEO
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem InternetDialog SID_INET_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Intersect SID_POLY_INTERSECT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SvxPostureItem Italic SID_ATTR_CHAR_POSTURE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxPostureItem ItalicLatin SID_ATTR_CHAR_LATIN_POSTURE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxPostureItem ItalicCJK SID_ATTR_CHAR_CJK_POSTURE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxPostureItem ItalicCTL SID_ATTR_CHAR_CTL_POSTURE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem JustifyPara SID_ATTR_PARA_ADJUST_BLOCK
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem InsertFixedText SID_INSERT_FIXEDTEXT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Label SID_FM_FIXEDTEXT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SvxLanguageItem Language SID_ATTR_CHAR_LANGUAGE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxLanguageItem LanguageLatin SID_ATTR_CHAR_LATIN_LANGUAGE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem LastRecord SID_FM_RECORD_LAST
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem LeaveFMCreateMode SID_FM_LEAVE_CREATE
+(SfxBoolItem Leave SID_FM_LEAVE_CREATE)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem LeaveGroup SID_LEAVE_GROUP
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem LeftPara SID_ATTR_PARA_ADJUST_LEFT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxLRSpaceItem LeftRightMargin SID_ATTR_LRSPACE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem LeftRightParaMargin SID_ATTR_PARA_LRSPACE
+(SvxLRSpaceItem LRSpace SID_ATTR_PARA_LRSPACE)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem LeftRightParaMargin_Vertical SID_ATTR_PARA_LRSPACE_VERTICAL
+(SvxLRSpaceItem LRSpace SID_ATTR_PARA_LRSPACE_VERTICAL)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Line SID_DRAW_LINE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Line_Diagonal SID_DRAW_XLINE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordManual;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SvxColorItem FrameLineColor SID_FRAME_LINECOLOR
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+XLineDashItem LineDash SID_ATTR_LINE_DASH
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem LineEndStyle SID_ATTR_LINEEND_STYLE
+(XLineStartItem LineStart SID_ATTR_LINE_START,XLineEndItem LineEnd SID_ATTR_LINE_END,SfxUInt32Item StartWidth SID_ATTR_LINE_STARTWIDTH,SfxUInt32Item EndWidth SID_ATTR_LINE_ENDWIDTH)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxLineSpacingItem LineSpacing SID_ATTR_PARA_LINESPACE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxLineItem LineStyle SID_FRAME_LINESTYLE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FRAME;
+]
+
+//--------------------------------------------------------------------------
+XLineWidthItem LineWidth SID_ATTR_LINE_WIDTH
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ListBox SID_FM_LISTBOX
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem InsertListbox SID_INSERT_LISTBOX
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Merge SID_POLY_MERGE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem NewJavaModule SID_BASICIDE_NEWJAVAMODULE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_MACRO;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem NewRecord SID_FM_RECORD_NEW
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem NextRecord SID_FM_RECORD_NEXT
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem NumericField SID_FM_NUMERICFIELD
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem InsertNumericField SID_INSERT_NUMERICFIELD
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SvxDrawAlignItem ObjectAlign SID_OBJECT_ALIGN
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+ PseudoSlots = TRUE;
+ PseudoPrefix = SID_OBJECT_ALIGN;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ObjectBackOne SID_FRAME_DOWN
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ObjectForwardOne SID_FRAME_UP
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem OpenReadOnly SID_FM_OPEN_READONLY
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem OrderCrit SID_FM_ORDERCRIT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SvxOrphansItem Orphan SID_ATTR_PARA_ORPHANS
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem OutlineBullet SID_OUTLINE_BULLET
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem OutlineCollapse SID_OUTLINE_COLLAPSE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem OutlineCollapseAll SID_OUTLINE_COLLAPSE_ALL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem OutlineDown SID_OUTLINE_DOWN
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem OutlineExpand SID_OUTLINE_EXPAND
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem OutlineExpandAll SID_OUTLINE_EXPAND_ALL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SvxContourItem OutlineFont SID_ATTR_CHAR_CONTOUR
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem OutlineFormat SID_OUTLINE_FORMAT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem OutlineLeft SID_OUTLINE_LEFT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem OutlineRight SID_OUTLINE_RIGHT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem OutlineUp SID_OUTLINE_UP
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SvxFmtBreakItem Pagebreak SID_ATTR_PARA_PAGEBREAK
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxPaperBinItem PagePaperBin SID_ATTR_PAGE_PAPERBIN
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxSizeItem AttributePageSize SID_ATTR_PAGE_SIZE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxPageModelItem AttributeParaModel SID_ATTR_PARA_MODEL
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxPageItem AttributePage SID_ATTR_PAGE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = TRUE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxAutoKernItem PairKerning SID_ATTR_CHAR_AUTOKERN
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ParagraphDialog SID_PARA_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxFmtKeepItem ParaKeepTogether SID_ATTR_PARA_KEEP
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxFmtSplitItem ParaSplit SID_ATTR_PARA_SPLIT
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem InsertPatternField SID_INSERT_PATTERNFIELD
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem PatternField SID_FM_PATTERNFIELD
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Pie SID_DRAW_PIE
+(SfxUInt32Item CenterX ID_VAL_CENTER_X,SfxUInt32Item CenterY ID_VAL_CENTER_Y,SfxUInt32Item AxisX ID_VAL_AXIS_X,SfxUInt32Item AxisY ID_VAL_AXIS_Y,SfxUInt32Item StartAngle ID_VAL_ANGLESTART,SfxUInt32Item EndAngle ID_VAL_ANGLEEND)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Pie_Unfilled SID_DRAW_PIE_NOFILL
+(SfxUInt32Item CenterX ID_VAL_CENTER_X,SfxUInt32Item CenterY ID_VAL_CENTER_Y,SfxUInt32Item AxisX ID_VAL_AXIS_X,SfxUInt32Item AxisY ID_VAL_AXIS_Y,SfxUInt32Item StartAngle ID_VAL_ANGLESTART,SfxUInt32Item EndAngle ID_VAL_ANGLEEND)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordManual;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem PolyFormen SID_POLY_FORMEN
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Polygon_Diagonal SID_DRAW_XPOLYGON
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordManual;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Polygon_Diagonal_Unfilled SID_DRAW_XPOLYGON_NOFILL
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordManual;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Polygon_Unfilled SID_DRAW_POLYGON_NOFILL
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordManual;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxPointItem Position SID_ATTR_POSITION
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Preview SID_INSERT_PREVIEW
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem PrevRecord SID_FM_RECORD_PREV
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ProgressBar SID_INSERT_PROGRESSBAR
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxObjectItem PropertyController SID_FM_PROPERTY_CONTROL
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = ;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Pushbutton SID_FM_PUSHBUTTON
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem InsertPushbutton SID_INSERT_PUSHBUTTON
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Radiobutton SID_INSERT_RADIOBUTTON
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem RadioButton SID_FM_RADIOBUTTON
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ReadOnlyMode SID_READONLY_MODE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = TRUE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem RecFromText SID_FM_RECORD_FROM_TEXT
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem RecSave SID_FM_RECORD_SAVE
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem RecSearch SID_FM_SEARCH
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxVoidItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Rect SID_DRAW_RECT
+(SfxUInt32Item MouseStartX ID_VAL_MOUSESTART_X,SfxUInt32Item MouseStartY ID_VAL_MOUSESTART_Y,SfxUInt32Item MouseEndX ID_VAL_MOUSEEND_X,SfxUInt32Item MouseEndY ID_VAL_MOUSEEND_Y)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Rect_Rounded SID_DRAW_RECT_ROUND
+(SfxUInt32Item MouseStartX ID_VAL_MOUSESTART_X,SfxUInt32Item MouseStartY ID_VAL_MOUSESTART_Y,SfxUInt32Item MouseEndX ID_VAL_MOUSEEND_X,SfxUInt32Item MouseEndY ID_VAL_MOUSEEND_Y)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordManual;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Rect_Rounded_Unfilled SID_DRAW_RECT_ROUND_NOFILL
+(SfxUInt32Item MouseStartX ID_VAL_MOUSESTART_X,SfxUInt32Item MouseStartY ID_VAL_MOUSESTART_Y,SfxUInt32Item MouseEndX ID_VAL_MOUSEEND_X,SfxUInt32Item MouseEndY ID_VAL_MOUSEEND_Y)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordManual;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Rect_Unfilled SID_DRAW_RECT_NOFILL
+(SfxUInt32Item MouseStartX ID_VAL_MOUSESTART_X,SfxUInt32Item MouseStartY ID_VAL_MOUSESTART_Y,SfxUInt32Item MouseEndX ID_VAL_MOUSEEND_X,SfxUInt32Item MouseEndY ID_VAL_MOUSEEND_Y)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordManual;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem RecText SID_FM_RECORD_TEXT
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxStringItem RecTotal SID_FM_RECORD_TOTAL
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxStringItem
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem RecUndo SID_FM_RECORD_UNDO
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Refresh SID_FM_REFRESH
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem RefreshFormControl SID_FM_REFRESH_FORM_CONTROL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem RemoveFilter SID_FM_FILTER_REMOVE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem RemoveFilterSort SID_FM_REMOVE_FILTER_SORT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxSetItem ReplaceSet FID_SEARCH_REPLACESET
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem RightPara SID_ATTR_PARA_ADJUST_RIGHT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxLRSpaceItem RulerBorderDistance SID_RULER_BORDER_DISTANCE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SvxColumnItem RulerBorders SID_RULER_BORDERS
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SvxColumnItem RulerBordersVertical SID_RULER_BORDERS_VERTICAL
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxPointItem RulerNullOffset SID_RULER_NULL_OFFSET
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = ;
+]
+
+//--------------------------------------------------------------------------
+SvxPagePosSizeItem RulerPagePos SID_RULER_PAGE_POS
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = ;
+]
+
+//--------------------------------------------------------------------------
+SvxProtectItem RulerProtect SID_RULER_PROTECT
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SbaExecuteSql SID_FM_EXECUTE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem SbaNativeSql SID_FM_NATIVESQL
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Scan SID_SCAN
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ScEditOptions SID_SC_EDITOPTIONS
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = TRUE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SchEditOptions SID_SCH_EDITOPTIONS
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = TRUE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SdEditOptions SID_SD_EDITOPTIONS
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = TRUE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SdGraphicOptions SID_SD_GRAPHIC_OPTIONS
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = TRUE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SearchOff FID_SEARCH_OFF
+(SvxSearchItem SearchItem SID_SEARCH_ITEM)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SearchOn FID_SEARCH_ON
+(SvxSearchItem SearchItem SID_SEARCH_ITEM)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxSetItem SearchSet FID_SEARCH_SEARCHSET
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Select SID_SELECT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SendToBack SID_FRAME_TO_BOTTOM
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SetDefault SID_SET_DEFAULT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SetHyperlink SID_HYPERLINK_SETLINK
+(SvxHyperlinkItem Hyperlink SID_HYPERLINK_SETLINK)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SvxHyphenZoneItem SetHyphenZone SID_ATTR_PARA_HYPHENZONE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxLongLRSpaceItem SetLongLeftRightMargin SID_ATTR_LONG_LRSPACE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = ;
+]
+
+//--------------------------------------------------------------------------
+SvxLongULSpaceItem SetLongTopBottomMargin SID_ATTR_LONG_ULSPACE
+(SvxLongULSpaceItem Space SID_ATTR_LONG_ULSPACE)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SvxLongULSpaceItem
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SetObjectToBackground SID_OBJECT_HELL
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SetObjectToForeground SID_OBJECT_HEAVEN
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SetPageMaxSize SID_ATTR_PAGE_MAXSIZE
+(SvxSizeItem Size SID_ATTR_PAGE_MAXSIZE)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxShadowItem BorderShadow SID_ATTR_BORDER_SHADOW
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SdrShadowItem FillShadow SID_ATTR_FILL_SHADOW
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DOCUMENT;
+]
+
+//--------------------------------------------------------------------------
+SvxShadowedItem Shadowed SID_ATTR_CHAR_SHADOWED
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ShowDetail SID_OUTLINE_SHOW
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DATA;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ShowFmExplorer SID_FM_SHOW_FMEXPLORER
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+
+//--------------------------------------------------------------------------
+SfxBoolItem ShowItemBrowser SID_SHOW_ITEMBROWSER
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ShowPropBrowser SID_SHOW_PROPERTYBROWSER
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ShowProperties SID_FM_SHOW_PROPERTIES
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ShowPropertyBrowser SID_FM_SHOW_PROPERTY_BROWSER
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ShowRuler SID_RULER
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SimEditOptions SID_SIM_EDITOPTIONS
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = TRUE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SvxSizeItem Size SID_ATTR_SIZE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = TRUE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SmEditOptions SID_SM_EDITOPTIONS
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = TRUE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SortDown SID_FM_SORTDOWN
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Sortup SID_FM_SORTUP
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem SpacePara1 SID_ATTR_PARA_LINESPACE_10
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem SpacePara15 SID_ATTR_PARA_LINESPACE_15
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem SpacePara2 SID_ATTR_PARA_LINESPACE_20
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxKerningItem Spacing SID_ATTR_CHAR_KERNING
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem SpellOnline SID_AUTOSPELL_CHECK
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Spinbutton SID_INSERT_SPINBUTTON
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Square SID_DRAW_SQUARE
+(SfxUInt32Item MouseStartX ID_VAL_MOUSESTART_X,SfxUInt32Item MouseStartY ID_VAL_MOUSESTART_Y,SfxUInt32Item MouseEndX ID_VAL_MOUSEEND_X,SfxUInt32Item MouseEndY ID_VAL_MOUSEEND_Y)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordManual;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Square_Rounded SID_DRAW_SQUARE_ROUND
+(SfxUInt32Item MouseStartX ID_VAL_MOUSESTART_X,SfxUInt32Item MouseStartY ID_VAL_MOUSESTART_Y,SfxUInt32Item MouseEndX ID_VAL_MOUSEEND_X,SfxUInt32Item MouseEndY ID_VAL_MOUSEEND_Y)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordManual;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Square_Rounded_Unfilled SID_DRAW_SQUARE_ROUND_NOFILL
+(SfxUInt32Item MouseStartX ID_VAL_MOUSESTART_X,SfxUInt32Item MouseStartY ID_VAL_MOUSESTART_Y,SfxUInt32Item MouseEndX ID_VAL_MOUSEEND_X,SfxUInt32Item MouseEndY ID_VAL_MOUSEEND_Y)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordManual;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Square_Unfilled SID_DRAW_SQUARE_NOFILL
+(SfxUInt32Item MouseStartX ID_VAL_MOUSESTART_X,SfxUInt32Item MouseStartY ID_VAL_MOUSESTART_Y,SfxUInt32Item MouseEndX ID_VAL_MOUSEEND_X,SfxUInt32Item MouseEndY ID_VAL_MOUSEEND_Y)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordManual;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt32Item State3D SID_3D_STATE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SvxCrossedOutItem Strikeout SID_ATTR_CHAR_STRIKEOUT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem SubScript SID_SET_SUB_SCRIPT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Substract SID_POLY_SUBSTRACT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem SuperScript SID_SET_SUPER_SCRIPT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SwEditOptions SID_SW_EDITOPTIONS
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = TRUE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem TabDialog SID_FM_TAB_DIALOG
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SvxTabStopItem Tabstops SID_ATTR_TABSTOP
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxTabStopItem TabstopsVertical SID_ATTR_TABSTOP_VERTICAL
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem TestMode SID_DIALOG_TESTMODE
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Text SID_ATTR_CHAR
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem DrawText SID_DRAW_TEXT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Text_Marquee SID_DRAW_TEXT_MARQUEE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem TextdirectionLeftToRight SID_TEXTDIRECTION_LEFT_TO_RIGHT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem TextdirectionTopToBottom SID_TEXTDIRECTION_TOP_TO_BOTTOM
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SdrTextFitToSizeTypeItem TextFitToSize SID_ATTR_TEXT_FITTOSIZE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ThesaurusDialog SID_THESAURUS
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem InsertTimeField SID_INSERT_TIMEFIELD
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem TimeField SID_FM_TIMEFIELD
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ToggleObjectBezierMode SID_BEZIER_EDIT
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ToggleObjectRotateMode SID_OBJECT_ROTATE
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ToolEdit SID_TEXTEDIT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DOCUMENT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem SelectObject SID_OBJECT_SELECT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SvxULSpaceItem TopBottomMargin SID_ATTR_ULSPACE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem TransformDialog SID_ATTR_TRANSFORM
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem TwainSelect SID_TWAIN_SELECT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem TwainTransfer SID_TWAIN_TRANSFER
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SvxTextLineItem Underline SID_ATTR_CHAR_UNDERLINE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxTextLineItem Overline SID_ATTR_CHAR_OVERLINE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Ungroup SID_OUTLINE_REMOVE
+(SfxStringItem RowOrCol SID_OUTLINE_REMOVE)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DATA;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem URLButton SID_INSERT_URLBUTTON
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem UseWizards SID_FM_USE_WIZARDS
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem VerticalCaption SID_DRAW_CAPTION_VERTICAL
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem VerticalText SID_DRAW_TEXT_VERTICAL
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem VFixedLine SID_INSERT_VFIXEDLINE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ViewFormAsGrid SID_FM_VIEW_AS_GRID
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem VScrollbar SID_INSERT_VSCROLLBAR
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SvxWidowsItem Widow SID_ATTR_PARA_WIDOWS
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem Window3D SID_3D_WIN
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SvxWordLineModeItem WordMode SID_ATTR_CHAR_WORDLINEMODE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+XLineColorItem XLineColor SID_ATTR_LINE_COLOR
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+XLineStyleItem XLineStyle SID_ATTR_LINE_STYLE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxZoomItem Zoom SID_ATTR_ZOOM
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = TRUE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem Zoom100Percent SID_SIZE_REAL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ZoomObjects SID_SIZE_OPTIMAL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ZoomOptimal SID_SIZE_ALL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ZoomPage SID_SIZE_PAGE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ZoomPageWidth SID_SIZE_PAGE_WIDTH
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ZoomVisArea SID_SIZE_VISAREA
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DOCUMENT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ToggleControlFocus SID_FM_TOGGLECONTROLFOCUS
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxVoidItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem CreateFieldControl SID_FM_CREATE_FIELDCONTROL
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxVoidItem
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem SelectMode SID_INSERT_SELECT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SvxParaVertAlignItem VerticalParagraphAlignment SID_PARA_VERTALIGN
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SvxCharReliefItem CharacterRelief SID_ATTR_CHAR_RELIEF
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SvxBrushItem CharacterBackgroundPattern SID_ATTR_BRUSH_CHAR
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxCharRotateItem CharacterRotation SID_ATTR_CHAR_ROTATED
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxCharScaleWidthItem CharacterWidthScalingFactor SID_ATTR_CHAR_SCALEWIDTH
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt32Item NumberFormatValue SID_ATTR_NUMBERFORMAT_VALUE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxHorJustifyItem HorizontalJustification SID_ATTR_ALIGN_HOR_JUSTIFY
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxVerJustifyItem VerticalJustification SID_ATTR_ALIGN_VER_JUSTIFY
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt16Item AlignmentIndent SID_ATTR_ALIGN_INDENT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem AlignmentHyphenation SID_ATTR_ALIGN_HYPHENATION
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxInt32Item AlignmentRotation SID_ATTR_ALIGN_DEGREES
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxRotateModeItem AlignmentRotationMode SID_ATTR_ALIGN_LOCKPOS
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SvxMarginItem AlignmentMargin SID_ATTR_ALIGN_MARGIN
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem AlignmentStacked SID_ATTR_ALIGN_STACKED
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ParaLeftToRight SID_ATTR_PARA_LEFT_TO_RIGHT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ParaRightToLeft SID_ATTR_PARA_RIGHT_TO_LEFT
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem TextRTL SID_RULER_TEXT_RIGHT_TO_LEFT
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem OpenHyperlinkOnCursor SID_OPEN_HYPERLINK
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+SfxBoolItem CTLFontState SID_CTLFONT_STATE
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_APPLICATION;
+]
+
+SfxBoolItem VerticalTextState SID_VERTICALTEXT_STATE
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_APPLICATION;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem OpenXMLFilterSettings SID_OPEN_XML_FILTERSETTINGS
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem HangulHanjaConversion SID_HANGUL_HANJA_CONVERSION
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem ChineseConversion SID_CHINESE_CONVERSION
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+//--------------------------------------------------------------------------
+
+SfxBoolItem SpellDialog SID_SPELL_DIALOG
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+//--------------------------------------------------------------------------
+SvxColumnItem RulerRows SID_RULER_ROWS
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_VIEW;
+]
+//--------------------------------------------------------------------------
+SvxColumnItem RulerRowsVertical SID_RULER_ROWS_VERTICAL
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_VIEW;
+]
+
+
+//--------------------------------------------------------------------------
+SvxFontListItem FontNameList SID_ATTR_CHAR_FONTLIST
+()
+[
+ // flags:
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ // config:
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DOCUMENT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ExtrusionToggle SID_EXTRUSION_TOOGLE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Readonly = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ExtrusionTiltDown SID_EXTRUSION_TILT_DOWN
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ExtrusionTiltUp SID_EXTRUSION_TILT_UP
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ExtrusionTiltLeft SID_EXTRUSION_TILT_LEFT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ExtrusionTiltRight SID_EXTRUSION_TILT_RIGHT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ExtrusionDepthFloater SID_EXTRUSION_DEPTH_FLOATER
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ExtrusionDepthDialog SID_EXTRUSION_DEPTH_DIALOG
+(SvxDoubleItem Depth SID_EXTRUSION_DEPTH,SfxUInt16Item Metric SID_ATTR_METRIC)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Synchron;
+
+ /* status: */
+ SlotType = SvxDoubleItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ExtrusionDirectionFloater SID_EXTRUSION_DIRECTION_FLOATER
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ExtrusionLightingFloater SID_EXTRUSION_LIGHTING_FLOATER
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Asynchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ExtrusionSurfaceFloater SID_EXTRUSION_SURFACE_FLOATER
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Asynchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SvxColorItem Extrusion3DColor SID_EXTRUSION_3D_COLOR
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SvxDoubleItem ExtrusionDepth SID_EXTRUSION_DEPTH
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxInt32Item ExtrusionDirection SID_EXTRUSION_DIRECTION
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Asynchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxInt32Item ExtrusionProjection SID_EXTRUSION_PROJECTION
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Asynchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxInt32Item ExtrusionLightingDirection SID_EXTRUSION_LIGHTING_DIRECTION
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Asynchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxInt32Item ExtrusionLightingIntensity SID_EXTRUSION_LIGHTING_INTENSITY
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Asynchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxInt32Item ExtrusionSurface SID_EXTRUSION_SURFACE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Asynchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem FontworkGalleryFloater SID_FONTWORK_GALLERY_FLOATER
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Asynchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem FontworkShapeType SID_FONTWORK_SHAPE_TYPE
+(SfxStringItem FontworkShapeType SID_FONTWORK_SHAPE_TYPE)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxStringItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem FontworkSameLetterHeights SID_FONTWORK_SAME_LETTER_HEIGHTS
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem FontworkAlignmentFloater SID_FONTWORK_ALIGNMENT_FLOATER
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Asynchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem FontworkCharacterSpacingFloater SID_FONTWORK_CHARACTER_SPACING_FLOATER
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Asynchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxInt32Item FontworkShape SID_FONTWORK_SHAPE
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Asynchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxInt32Item FontworkAlignment SID_FONTWORK_ALIGNMENT
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Asynchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxInt32Item FontworkCharacterSpacing SID_FONTWORK_CHARACTER_SPACING
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Asynchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem FontworkCharacterSpacingDialog SID_FONTWORK_CHARACTER_SPACING_DIALOG
+(SfxInt32Item FontworkCharacterSpacing SID_FONTWORK_CHARACTER_SPACING)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Synchron;
+
+ /* status: */
+ SlotType = SfxInt32Item
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem FontworkKernCharacterPairs SID_FONTWORK_KERN_CHARACTER_PAIRS
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Asynchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DRAWING;
+]
+
+//--------------------------------------------------------------------------
+OfaPtrItem GetColorTable SID_GET_COLORTABLE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SpellCheckerChanged SID_SPELLCHECKER_CHANGED
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = TRUE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_SPECIAL;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt16Item Year2000 SID_ATTR_YEAR2000
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_INTERN;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem IncrementIndent SID_INC_INDENT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem DecrementIndent SID_DEC_INDENT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ ImageRotation = TRUE;
+ ImageReflection = TRUE;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxStringItem StateTableCell SID_TABLE_CELL
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = TRUE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_VIEW;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SendOutlineToImpress SID_OUTLINE_TO_IMPRESS
+(SfxLockBytesItem RtfOutline SID_OUTLINE_TO_IMPRESS)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_SPECIAL;
+]
+
+//--------------------------------------------------------------------------
+SfxUInt16Item DefTabStop SID_ATTR_DEFTABSTOP
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SvxLanguageItem DocumentLanguage SID_ATTR_LANGUAGE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SvxLanguageItem DocumentLanguageCJK SID_ATTR_CHAR_CJK_LANGUAGE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SvxLanguageItem DocumentLanguageCTL SID_ATTR_CHAR_CTL_LANGUAGE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem OptionsLocaleChanged SID_OPT_LOCALE_CHANGED
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = TRUE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_SPECIAL;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem SbaBrwInsert SID_SBA_BRW_INSERT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DATA;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem BasicShapes SID_DRAWTBX_CS_BASIC
+(SfxStringItem BasicShapes SID_DRAWTBX_CS_BASIC)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem SymbolShapes SID_DRAWTBX_CS_SYMBOL
+(SfxStringItem SymbolShapes SID_DRAWTBX_CS_SYMBOL)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ArrowShapes SID_DRAWTBX_CS_ARROW
+(SfxStringItem ArrowShapes SID_DRAWTBX_CS_ARROW)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem FlowChartShapes SID_DRAWTBX_CS_FLOWCHART
+(SfxStringItem FlowChartShapes SID_DRAWTBX_CS_FLOWCHART)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem CalloutShapes SID_DRAWTBX_CS_CALLOUT
+(SfxStringItem CalloutShapes SID_DRAWTBX_CS_CALLOUT)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem StarShapes SID_DRAWTBX_CS_STAR
+(SfxStringItem StarShapes SID_DRAWTBX_CS_STAR)
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_OPTIONS;
+]
+
+//--------------------------------------------------------------------------
+SfxStringItem CustomShape SID_DRAW_CS_ID
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Asynchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DRAWING;
+]
+
+SvxDashListItem DashListState SID_DASH_LIST
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SvxLineEndListItem LineEndListState SID_LINEEND_LIST
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+SvxColorTableItem ColorTableState SID_COLOR_TABLE
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+SvxGradientListItem GradientListState SID_GRADIENT_LIST
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+SvxHatchListItem HatchListState SID_HATCH_LIST
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+SvxBitmapListItem BitmapListState SID_BITMAP_LIST
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+SvxEmphasisMarkItem EmphasisMark SID_ATTR_CHAR_EMPHASISMARK
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ShowDataNavigator SID_FM_SHOW_DATANAVIGATOR
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxObjectItem FmDataNavigatorController SID_FM_DATANAVIGATOR_CONTROL
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = ;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem CommonAlignLeft SID_ALIGN_ANY_LEFT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem CommonAlignHorizontalCenter SID_ALIGN_ANY_HCENTER
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem CommonAlignRight SID_ALIGN_ANY_RIGHT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem CommonAlignJustified SID_ALIGN_ANY_JUSTIFIED
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem CommonAlignTop SID_ALIGN_ANY_TOP
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem CommonAlignVerticalCenter SID_ALIGN_ANY_VCENTER
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem CommonAlignBottom SID_ALIGN_ANY_BOTTOM
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem CommonAlignHorizontalDefault SID_ALIGN_ANY_HDEFAULT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem CommonAlignVerticalDefault SID_ALIGN_ANY_VDEFAULT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+SfxVoidItem AVMediaToolBox SID_AVMEDIA_TOOLBOX
+( avmedia_MediaItem AVMediaToolBox SID_AVMEDIA_TOOLBOX )
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+ SlotType = avmedia_MediaItem;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_APPLICATION;
+]
+
+//--------------------------------------------------------------------------
+
+SfxBoolItem BorderReducedMode SID_BORDER_REDUCED_MODE
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem ColorSettings SID_COLOR_SETTINGS
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = TRUE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+ PseudoSlots = TRUE;
+ PseudoPrefix = SID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem MailExportFinished SID_MAIL_EXPORT_FINISHED
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EXPLORER;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem InsertZWSP SID_INSERT_ZWSP
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem InsertZWNBSP SID_INSERT_ZWNBSP
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem InsertLRM SID_INSERT_LRM
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem InsertRLM SID_INSERT_RLM
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem InsertSoftHyphen FN_INSERT_SOFT_HYPHEN
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem InsertHardHyphen FN_INSERT_HARDHYPHEN
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem InsertNonBreakingSpace FN_INSERT_HARD_SPACE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_INSERT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem ManageLanguage SID_BASICIDE_MANAGE_LANG
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+//--------------------------------------------------------------------------
+SfxStringItem CurrentLanguage SID_BASICIDE_CURRENT_LANG
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_CONTROLS;
+]
+
+SfxVoidItem MergeCells SID_TABLE_MERGE_CELLS
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+SfxVoidItem SplitCell SID_TABLE_SPLIT_CELLS
+(SfxInt32Item Amount SID_TABLE_SPLIT_CELLS,SfxBoolItem Horizontal FN_PARAM_1, SfxBoolItem Proportional FN_PARAM_2)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+SfxUInt16Item OptimizeTable SID_OPTIMIZE_TABLE
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+SfxBoolItem CellVertBottom SID_TABLE_VERT_BOTTOM
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem CellVertCenter SID_TABLE_VERT_CENTER
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxBoolItem CellVertTop SID_TABLE_VERT_NONE
+
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ Readonly = FALSE,
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+SfxVoidItem InsertRows SID_TABLE_INSERT_ROW
+()
+[
+ /* 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 = TRUE,
+ GroupId = GID_TABLE;
+]
+
+SfxVoidItem InsertColumns SID_TABLE_INSERT_COL
+()
+[
+ /* 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 = TRUE,
+ GroupId = GID_TABLE;
+]
+
+SfxVoidItem DeleteRows SID_TABLE_DELETE_ROW
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+SfxVoidItem DeleteColumns SID_TABLE_DELETE_COL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+SfxVoidItem SelectTable SID_TABLE_SELECT_ALL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+SfxVoidItem EntireColumn SID_TABLE_SELECT_COL
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem EntireRow SID_TABLE_SELECT_ROW
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+SfxVoidItem TableDialog SID_FORMAT_TABLE_DLG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+SfxVoidItem AutoSum SID_TABLE_AUTOSUM
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+
+SfxVoidItem TableSort SID_TABLE_SORT_DIALOG
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_TABLE;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem OpenSmartTagMenuOnCursor SID_OPEN_SMARTTAGMENU
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+ SlotType = SvxSmartTagItem;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
+SvxZoomSliderItem ZoomSlider SID_ATTR_ZOOMSLIDER
+
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = TRUE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_VIEW;
+]
+
+ //--------------------------------------------------------------------------
+ SfxStringListItem FontNameStringList SID_FONTNAMELIST
+ [
+ // flags:
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ // config:
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_DOCUMENT;
+]
+
+//--------------------------------------------------------------------------
+SfxVoidItem LanguageStatus SID_LANGUAGE_STATUS
+(SfxStringItem Language SID_LANGUAGE_STATUS)
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = TRUE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxStringListItem
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = TRUE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+
+SfxVoidItem FontDialogForParagraph SID_CHAR_DLG_FOR_PARAGRAPH
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+
+SfxVoidItem Grow SID_GROW_FONT_SIZE
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
+
+SfxVoidItem Shrink SID_SHRINK_FONT_SIZE
+()
+[
+ /* flags: */
+ AutoUpdate = TRUE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_FORMAT;
+]
+//--------------------------------------------------------------------------
+
+SfxVoidItem RecheckDocument SID_RECHECK_DOCUMENT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerItem;
+ Asynchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ 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;
+]
+//--------------------------------------------------------------------------
+SfxVoidItem PrepareMailExport SID_MAIL_PREPAREEXPORT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* status: */
+ SlotType = SfxBoolItem
+
+ /* config: */
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = GID_EXPLORER;
+]
+
diff --git a/svx/sdi/svxitems.sdi b/svx/sdi/svxitems.sdi
new file mode 100644
index 000000000000..3cd78dd5f09a
--- /dev/null
+++ b/svx/sdi/svxitems.sdi
@@ -0,0 +1,698 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+//-------------------------------------------------------------------------
+enum SvxCellHorJustifyEnum
+{
+ SVX_HOR_JUSTIFY_STANDARD,
+ SVX_HOR_JUSTIFY_LEFT,
+ SVX_HOR_JUSTIFY_CENTER,
+ SVX_HOR_JUSTIFY_RIGHT,
+ SVX_HOR_JUSTIFY_BLOCK,
+ SVX_HOR_JUSTIFY_REPEAT
+};
+item SvxCellHorJustifyEnum SvxCellHorJustifyEnumItem;
+
+enum SvxCellVerJustifyEnum
+{
+ SVX_VER_JUSTIFY_STANDARD,
+ SVX_VER_JUSTIFY_TOP,
+ SVX_VER_JUSTIFY_CENTER,
+ SVX_VER_JUSTIFY_BOTTOM
+};
+item SvxCellVerJustifyEnum SvxCellVerJustifyEnumItem;
+
+//-------------------------------------------------------------------------
+
+enum SvxCellOrientationEnum
+{
+ SVX_ORIENTATION_STANDARD,
+ SVX_ORIENTATION_TOPBOTTOM,
+ SVX_ORIENTATION_BOTTOMTOP,
+ SVX_ORIENTATION_STACKED
+};
+item SvxCellOrientationEnum SvxCellOrientationEnumItem;
+
+enum SvxChooseControlEnum
+{
+ SVX_SNAP_PUSHBUTTON,
+ SVX_SNAP_CHECKBOX,
+ SVX_SNAP_RADIOBUTTON,
+ SVX_SNAP_SPINBUTTON,
+ SVX_SNAP_FIXEDTEXT,
+ SVX_SNAP_GROUPBOX,
+ SVX_SNAP_LISTBOX,
+ SVX_SNAP_COMBOBOX,
+ SVX_SNAP_EDIT,
+ SVX_SNAP_HSCROLLBAR,
+ SVX_SNAP_VSCROLLBAR,
+ SVX_SNAP_PREVIEW,
+ SVX_SNAP_SELECT,
+ SVX_SNAP_URLBUTTON,
+ SVX_SNAP_IMAGECONTROL,
+ SVX_SNAP_PROGRESSBAR,
+ SVX_SNAP_HFIXEDLINE,
+ SVX_SNAP_VFIXEDLINE,
+ SVX_SNAP_DATEFIELD,
+ SVX_SNAP_TIMEFIELD,
+ SVX_SNAP_NUMERICFIELD,
+ SVX_SNAP_CURRENCYFIELD,
+ SVX_SNAP_FORMATTEDFIELD,
+ SVX_SNAP_PATTERNFIELD,
+ SVX_SNAP_FILECONTROL,
+ SVX_SNAP_TREECONTROL
+}
+item SvxChooseControlEnum SvxChooseControlItem;
+
+//-------------------------------------------------------------------------
+
+enum SvxDrawToolEnum
+{
+ SVX_SNAP_DRAW_SELECT,
+ //
+ SVX_SNAP_DRAW_LINE,
+ SVX_SNAP_DRAW_RECT,
+ SVX_SNAP_DRAW_ELLIPSE,
+ SVX_SNAP_DRAW_POLYGON_NOFILL,
+ SVX_SNAP_DRAW_BEZIER_NOFILL,
+ SVX_SNAP_DRAW_FREELINE_NOFILL,
+ SVX_SNAP_DRAW_ARC,
+ SVX_SNAP_DRAW_PIE,
+ SVX_SNAP_DRAW_CIRCLECUT,
+ SVX_SNAP_DRAW_TEXT,
+ SVX_SNAP_DRAW_TEXT_VERTICAL,
+ SVX_SNAP_DRAW_TEXT_MARQUEE,
+ SVX_SNAP_DRAW_CAPTION,
+ SVX_SNAP_DRAW_CAPTION_VERTICAL
+}
+item SvxDrawToolEnum SvxDrawToolEnumItem;
+
+//-------------------------------------------------------------------------
+
+enum SvxDrawAlignEnum
+{
+ SVX_OBJECT_ALIGN_LEFT,
+ SVX_OBJECT_ALIGN_CENTER,
+ SVX_OBJECT_ALIGN_RIGHT,
+ SVX_OBJECT_ALIGN_UP,
+ SVX_OBJECT_ALIGN_MIDDLE,
+ SVX_OBJECT_ALIGN_DOWN
+}
+item SvxDrawAlignEnum SvxDrawAlignEnumItem;
+
+//-------------------------------------------------------------------------
+
+enum SvxDrawBezierEnum
+{
+ SVX_BEZIER_MOVE,
+ SVX_BEZIER_INSERT,
+ SVX_BEZIER_DELETE,
+ SVX_BEZIER_CUTLINE,
+ SVX_BEZIER_CONVERT,
+ SVX_BEZIER_EDGE,
+ SVX_BEZIER_SMOOTH,
+ SVX_BEZIER_SYMMTR,
+ SVX_BEZIER_CLOSE,
+ SVX_BEZIER_ELIMINATE_POINTS
+}
+item SvxDrawBezierEnum SvxDrawBezierEnumItem;
+
+enum SvxAdjust
+{
+ SVX_ADJUST_LEFT,
+ SVX_ADJUST_RIGHT,
+ SVX_ADJUST_BLOCK,
+ SVX_ADJUST_CENTER,
+ SVX_ADJUST_BLOCKLINE,
+ SVX_ADJUST_END
+};
+
+struct SvxAdjustStruct
+{
+ SvxAdjust ParagraphAdjustment MID_PARA_ADJUST;
+ SvxAdjust LastLineAdjustment MID_LAST_LINE_ADJUST;
+ BOOL ExpandSingleWord MID_EXPAND_SINGLE;
+};
+item SvxAdjustStruct SvxAdjustItem;
+
+//-------------------------------------------------------------------------
+
+enum SvxCaseMap
+{
+ SVX_CASEMAP_NOT_MAPPED,
+ SVX_CASEMAP_VERSALIEN,
+ SVX_CASEMAP_GEMEINE,
+ SVX_CASEMAP_TITEL,
+ SVX_CASEMAP_KAPITAELCHEN,
+ SVX_CASEMAP_END
+};
+item SvxCaseMap SvxCaseMapItem;
+
+//-------------------------------------------------------------------------
+
+enum CharSet
+{
+ CHARSET_DONTKNOW,
+ CHARSET_ANSI,
+ CHARSET_MAC,
+ CHARSET_IBMPC_437,
+ CHARSET_IBMPC_850,
+ CHARSET_IBMPC_860,
+ CHARSET_IBMPC_861,
+ CHARSET_IBMPC_863,
+ CHARSET_IBMPC_865,
+ CHARSET_SYSTEM,
+ CHARSET_SYMBOL
+};
+
+//-------------------------------------------------------------------------
+
+enum FontFamily
+{
+ FAMILY_DONTKNOW,
+ FAMILY_DECORATIVE,
+ FAMILY_MODERN,
+ FAMILY_ROMAN,
+ FAMILY_SCRIPT,
+ FAMILY_SWISS,
+ FAMILY_SYSTEM
+};
+
+//-------------------------------------------------------------------------
+
+enum FontPitch
+{
+ PITCH_DONTKNOW,
+ PITCH_FIXED,
+ PITCH_VARIABLE
+};
+
+//-------------------------------------------------------------------------
+
+struct SvxFont
+{
+ String StyleName MID_FONT_STYLE_NAME;
+ FontPitch Pitch MID_FONT_PITCH; // INT16
+ CharSet CharSet MID_FONT_CHAR_SET; // INT16
+ FontFamily Family MID_FONT_FAMILY; // INT16
+ String FamilyName MID_FONT_FAMILY_NAME;
+};
+item SvxFont SvxFontItem;
+
+//-------------------------------------------------------------------------
+
+enum FontWeight
+{
+ WEIGHT_DONTKNOW,
+ WEIGHT_THIN,
+ WEIGHT_ULTRALIGHT,
+ WEIGHT_LIGHT,
+ WEIGHT_SEMILIGHT,
+ WEIGHT_NORMAL,
+ WEIGHT_MEDIUM,
+ WEIGHT_SEMIBOLD,
+ WEIGHT_BOLD,
+ WEIGHT_ULTRABOLD,
+ WEIGHT_BLACK
+};
+item FontWeight SvxWeightItem;
+
+//-------------------------------------------------------------------------
+
+enum FontUnderline
+{
+ UNDERLINE_NONE,
+ UNDERLINE_SINGLE,
+ UNDERLINE_DOUBLE,
+ UNDERLINE_DOTTED
+};
+
+//-------------------------------------------------------------------------
+
+enum FontStrikeout
+{
+ STRIKEOUT_NONE,
+ STRIKEOUT_SINGLE,
+ STRIKEOUT_DOUBLE
+};
+
+//-------------------------------------------------------------------------
+
+enum FontItalic
+{
+ ITALIC_NONE,
+ ITALIC_OBLIQUE,
+ ITALIC_NORMAL
+};
+item FontItalic SvxPostureItem;
+
+//-------------------------------------------------------------------------
+
+enum SvxDbType
+{
+ DBTYPE_STARBASE,
+ DBTYPE_ODBC,
+ DBTYPE_WATCOM
+};
+item SvxDbType SvxDbTypeItem;
+
+//-------------------------------------------------------------------------
+
+enum SvxLineSpace
+{
+ SVX_LINE_SPACE_AUTO,
+ SVX_LINE_SPACE_MAX,
+ SVX_LINE_SPACE_MIN,
+ SVX_LINE_SPACE_END
+};
+item SvxLineSpace SvxLineSpaceItem;
+
+//-------------------------------------------------------------------------
+
+enum SvxInterLineSpace
+{
+ SVX_INTER_LINE_SPACE_OFF,
+ SVX_INTER_LINE_SPACE_PROP,
+ SVX_INTER_LINE_SPACE_FIX,
+ SVX_INTER_LINE_SPACE_END
+};
+item SvxInterLineSpace SvxInterLineSpaceItem;
+
+//-------------------------------------------------------------------------
+
+enum SvxBreak
+{
+ SVX_BREAK_NONE,
+ SVX_BREAK_COLUMN_BEFORE,
+ SVX_BREAK_COLUMN_AFTER,
+ SVX_BREAK_COLUMN_BOTH,
+ SVX_BREAK_PAGE_BEFORE,
+ SVX_BREAK_PAGE_AFTER,
+ SVX_BREAK_PAGE_BOTH,
+ SVX_BREAK_END
+};
+item SvxBreak SvxBreakItem;
+
+//-------------------------------------------------------------------------
+
+enum BrushStyle
+{
+ BRUSH_NULL,
+ BRUSH_SOLID,
+ BRUSH_HORZ,
+ BRUSH_VERT,
+ BRUSH_CROSS,
+ BRUSH_DIAGCROSS,
+ BRUSH_UPDIAG,
+ BRUSH_DOWNDIAG,
+ BRUSH_25,
+ BRUSH_50,
+ BRUSH_75,
+ BRUSH_BITMAP
+};
+item BrushStyle BrushStyleItem;
+
+//-------------------------------------------------------------------------
+
+enum SvxNumType
+{
+ SVX_CHARS_UPPER_LETTER,
+ SVX_CHARS_LOWER_LETTER,
+ SVX_ROMAN_UPPER,
+ SVX_ROMAN_LOWER,
+ SVX_ARABIC,
+ SVX_NUMBER_NONE,
+ SVX_CHAR_SPECIAL,
+ SVX_PAGEDESC
+};
+item SvxNumType SvxNumTypeItem;
+
+//-------------------------------------------------------------------------
+
+enum SvxShadowLocation
+{
+ SVX_SHADOW_NONE,
+ SVX_SHADOW_TOPLEFT,
+ SVX_SHADOW_TOPRIGHT,
+ SVX_SHADOW_BOTTOMLEFT,
+ SVX_SHADOW_BOTTOMRIGHT,
+ SVX_SHADOW_END
+};
+item SvxShadowLocation SvxShadowLocationItem;
+
+//-------------------------------------------------------------------------
+
+item INT16 SvxCharScaleWidthItem;
+item INT16 SvxParaVertAlignItem;
+item INT16 SvxCharReliefItem;
+item BOOL SvxBlinkItem;
+item BOOL SvxAutoKernItem;
+item INT32 SvxColorItem;
+item BOOL SvxContourItem;
+item INT16 SvxFmtBreakItem; // enum
+item BOOL SvxFmtKeepItem;
+item BOOL SvxFmtSplitItem;
+item INT16 SvxKerningItem;
+item INT16 SvxLanguageItem;
+item BOOL SvxNoHyphenItem;
+item BOOL SvxNoLinebreakItem;
+item BOOL SvxOpaqueItem;
+item BYTE SvxOrphansItem;
+item BYTE SvxPaperBinItem;
+item String SvxPostItAuthorItem;
+item String SvxPostItDateItem;
+item String SvxPostItTextItem;
+item FontItalic SvxPostureItem; // enum
+item BOOL SvxPrintItem;
+item UINT16 SvxPropSizeItem; // derived from UInt16Item
+item BOOL SvxShadowedItem;
+item SvxDrawBezierEnum SvxDrawBezierItem;
+item SvxDrawAlignEnum SvxDrawAlignItem;
+item SvxDrawToolEnum SvxDrawToolItem;
+item BYTE SvxWidowsItem;
+item BOOL SvxWordLineModeItem;
+item SvxCellHorJustifyEnum SvxHorJustifyItem;
+item SvxCellVerJustifyEnum SvxVerJustifyItem;
+item SvxCellOrientationEnum SvxOrientationItem;
+item BOOL SdrShadowItem;
+item INT16 SdrTextFitToSizeTypeItem; // enum
+item String SfxStringListItem; // serialized into one concatenated string
+item double SvxDoubleItem;
+item String OfaPtrItem; // serialized into one concatenated string
+item String SvxDashListItem;
+item String SvxLineEndListItem;
+item String SvxColorTableItem;
+item String SvxGradientListItem;
+item String SvxHatchListItem;
+item String SvxBitmapListItem;
+item String SfxLockBytesItem;
+item String SvxFontListItem;
+item String avmedia_MediaItem;
+
+item BYTE SfxGlobalNameItem;
+
+//-------------------------------------------------------------------------
+
+struct SvxCrossedOut
+{
+ FontStrikeout Kind MID_CROSS_OUT;
+};
+item SvxCrossedOut SvxCrossedOutItem;
+
+struct SvxTextLine
+{
+ FontUnderline LineStyle MID_TL_STYLE;
+ BOOL HasColor MID_TL_HASCOLOR;
+ INT32 Color MID_TL_COLOR;
+};
+item SvxTextLine SvxTextLineItem;
+
+struct SvxBrush
+{
+ BOOL Transparent MID_GRAPHIC_TRANSPARENT;
+ INT32 BackColor MID_BACK_COLOR;
+ String URL MID_GRAPHIC_URL;
+ String Filtername MID_GRAPHIC_FILTER;
+ INT16 Position MID_GRAPHIC_POSITION;
+};
+item SvxBrush SvxBrushItem;
+
+//-------------------------------------------------------------------------
+
+struct SvxEscapement
+{
+ INT16 Escapement MID_ESC;
+ BYTE Height MID_ESC_HEIGHT;
+ BOOL Auto MID_AUTO_ESC;
+};
+item SvxEscapement SvxEscapementItem;
+
+//-------------------------------------------------------------------------
+
+struct SvxFontHeight
+{
+ float Height MID_FONTHEIGHT; // may be converted to INT32
+ INT16 Prop MID_FONTHEIGHT_PROP;
+ float Diff MID_FONTHEIGHT_DIFF; // may be converted to INT32
+};
+item SvxFontHeight SvxFontHeightItem;
+
+//-------------------------------------------------------------------------
+
+struct SvxHyphenZone
+{
+ BOOL Hyphen MID_IS_HYPHEN;
+ INT16 MinLead MID_HYPHEN_MIN_LEAD;
+ INT16 MinTrail MID_HYPHEN_MIN_TRAIL;
+ INT16 MaxHyphens MID_HYPHEN_MAX_HYPHENS;
+};
+item SvxHyphenZone SvxHyphenZoneItem;
+
+//-------------------------------------------------------------------------
+struct SvxLine
+{
+ INT32 LineFGColor MID_FG_COLOR;
+ INT32 LineOutWidth MID_OUTER_WIDTH;
+ INT32 LineInWidth MID_INNER_WIDTH;
+ INT32 LineDistance MID_DISTANCE;
+};
+item SvxLine SvxLineItem;
+
+//-------------------------------------------------------------------------
+
+struct SvxLRSpace
+{
+ INT32 LeftMargin MID_L_MARGIN; // % or direct
+ INT32 TextLeftMargin MID_TXT_LMARGIN
+ INT32 RightMargin MID_R_MARGIN; // % or direct
+ INT16 LeftRelMargin MID_L_REL_MARGIN;
+ INT16 RightRelMargin MID_R_REL_MARGIN;
+ INT32 FirstLineIndent MID_FIRST_LINE_INDENT; // % or direct
+ INT32 FirstLineRelIdent MID_FIRST_LINE_REL_INDENT;
+ BOOL AutoFirst MID_FIRST_AUTO;
+};
+item SvxLRSpace SvxLRSpaceItem;
+
+//-------------------------------------------------------------------------
+
+struct SvxLineSpacing
+{
+ INT16 Mode MID_LINESPACE;
+ INT16 Height MID_HEIGHT;
+};
+item SvxLineSpacing SvxLineSpacingItem;
+
+//-------------------------------------------------------------------------
+
+struct SvxPage
+{
+ BOOL Landscape MID_PAGE_ORIENTATION;
+ INT16 Layout MID_PAGE_LAYOUT;
+ INT16 NumType MID_PAGE_NUMTYPE;
+};
+item SvxPage SvxPageItem;
+
+//-------------------------------------------------------------------------
+
+struct SvxPagePosSize
+{
+ INT32 XPos MID_X; // ???
+ INT32 YPos MID_Y; // ???
+ INT32 Width MID_WIDTH; // ???
+ INT32 Height MID_HEIGHT; // ???
+};
+item SvxPagePosSize SvxPagePosSizeItem;
+
+
+//-------------------------------------------------------------------------
+struct SvxShadow
+{
+ SvxShadowLocation Location MID_LOCATION;
+ INT16 Width MID_WIDTH;
+ BOOL IsTransparent MID_TRANSPARENT;
+ INT32 Color MID_BG_COLOR;
+};
+item SvxShadow SvxShadowItem;
+
+
+//-------------------------------------------------------------------------
+
+struct SvxULSpace
+{
+ INT32 TopMargin MID_UP_MARGIN; // % or direct
+ INT32 BottomMargin MID_LO_MARGIN; // % or direct
+ INT16 TopRelMargin MID_UP_REL_MARGIN;
+ INT16 BottomRelMargin MID_LO_REL_MARGIN;
+};
+item SvxULSpace SvxULSpaceItem
+
+//-------------------------------------------------------------------------
+
+struct SvxLongLRSpace
+{
+ INT32 Left MID_LEFT; // ???
+ INT32 Right MID_RIGHT; // ???
+};
+item SvxLongLRSpace SvxLongLRSpaceItem;
+
+//-------------------------------------------------------------------------
+
+struct SvxLongULSpace
+{
+ INT32 Upper MID_UPPER; // ???
+ INT32 Lower MID_LOWER; // ???
+};
+item SvxLongULSpace SvxLongULSpaceItem;
+
+//-------------------------------------------------------------------------
+
+struct SvxHyperlink
+{
+ String Text MID_HLINK_TEXT;
+ String URL MID_HLINK_URL;
+ String Target MID_HLINK_TARGET;
+ String Name MID_HLINK_NAME;
+ INT32 Type MID_HLINK_TYPE;
+};
+item SvxHyperlink SvxHyperlinkItem;
+
+//-------------------------------------------------------------------------
+
+struct PageModel
+{
+ BOOL Auto MID_AUTO;
+ String Name MID_NAME;
+};
+item PageModel SvxPageModelItem;
+
+struct SvxProtect
+{
+ BOOL Content MID_PROTECT_CONTENT;
+ BOOL Size MID_PROTECT_SIZE;
+ BOOL Position MID_PROTECT_POSITION;
+};
+item SvxProtect SvxProtectItem;
+
+struct SvxZoom
+{
+ UINT16 Value MID_VALUE;
+ INT16 ValueSet MID_VALUESET;
+ INT16 Type MID_TYPE;
+};
+item SvxZoom SvxZoomItem;
+
+struct SvxRulerObject
+{
+ INT32 StartX MID_START_X;
+ INT32 StartY MID_START_Y;
+ INT32 EndX MID_END_X;
+ INT32 EndY MID_END_Y;
+ BOOL Limited MID_LIMIT;
+};
+item SvxRulerObject SvxObjectItem;
+
+item String LineBorder; // dummy for sequence
+struct SvxBox
+{
+ LineBorder LeftBorder MID_LEFT_BORDER;
+ INT32 LeftDistance LEFT_BORDER_DISTANCE;
+ LineBorder RightBorder MID_RIGHT_BORDER;
+ INT32 RightDistance RIGHT_BORDER_DISTANCE;
+ LineBorder TopBorder MID_TOP_BORDER;
+ INT32 TopDistance TOP_BORDER_DISTANCE;
+ LineBorder BottomBorder MID_BOTTOM_BORDER;
+ INT32 BottomDistance BOTTOM_BORDER_DISTANCE;
+};
+item SvxBox SvxBoxItem;
+
+struct SvxBoxInfo
+{
+ LineBorder Horizontal MID_HORIZONTAL;
+ LineBorder Vertical MID_VERTICAL;
+ INT16 Flags MID_FLAGS;
+ INT16 ValidFlags MID_VALIDFLAGS;
+ INT32 DefaultDistance MID_DISTANCE;
+};
+item SvxBoxInfo SvxBoxInfoItem;
+
+item String SvxColumns; // dummy for sequence
+struct SvxColumnDescription
+{
+ SvxColumns Columns MID_COLUMNARRAY; // currently not implemented
+ INT32 Left MID_LEFT;
+ INT32 Right MID_RIGHT;
+ INT32 Actual MID_ACTUAL;
+ BOOL Orthogonal MID_ORTHO;
+ BOOL Table MID_TABLE;
+};
+item SvxColumnDescription SvxColumnItem;
+
+struct SvxTabStop
+{
+ String TabStops MID_TABSTOPS; // dummy, will be represented by array of structs
+ //INT32 StandardTabStop MID_STD_TAB;
+};
+item SvxTabStop SvxTabStopItem;
+
+struct SvxCharRotate
+{
+ INT16 Rotation MID_ROTATE;
+ BOOL FitToLine MID_FITTOLINE;
+};
+item SvxCharRotate SvxCharRotateItem;
+
+item String SfxSetItem; // dummy
+item INT16 SvxRotateModeItem; // enum
+item INT16 SvxOrientationItem; // enum
+
+struct SvxMargin
+{
+ INT32 LeftMargin MID_MARGIN_L_MARGIN;
+ INT32 RightMargin MID_MARGIN_R_MARGIN;
+ INT32 UpperMargin MID_MARGIN_UP_MARGIN;
+ INT32 LowerMargin MID_MARGIN_LO_MARGIN;
+};
+item SvxMargin SvxMarginItem;
+
+struct SvxEmphasisMark
+{
+ INT32 Emphasis MID_EMPHASIS;
+};
+item SvxEmphasisMark SvxEmphasisMarkItem;
+
+item String SvxSmartTagItem; // dummy for sequence
+
+
+item String Points; // dummy for sequence
+struct ZoomSlider
+{
+ INT16 CurrentZoom MID_ZOOMSLIDER_CURRENTZOOM;
+ Points SnappingPoints MID_ZOOMSLIDER_SNAPPINGPOINTS;
+ INT16 SvxMinZoom MID_ZOOMSLIDER_MINZOOM;
+ INT16 SvxMaxZoom MID_ZOOMSLIDER_MAXZOOM;
+};
+item ZoomSlider SvxZoomSliderItem;
diff --git a/svx/sdi/svxslots.hrc b/svx/sdi/svxslots.hrc
new file mode 100644
index 000000000000..83ccbd763f38
--- /dev/null
+++ b/svx/sdi/svxslots.hrc
@@ -0,0 +1,33 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <sfx2/sfx.hrc>
+#include <sfx2/sfxsids.hrc>
+#include <editeng/memberids.hrc>
+#include <editeng/editids.hrc>
+#include <svx/svxids.hrc>
+#include <svx/unomid.hxx>
+
diff --git a/svx/sdi/svxslots.sdi b/svx/sdi/svxslots.sdi
new file mode 100644
index 000000000000..2ea6f7fef874
--- /dev/null
+++ b/svx/sdi/svxslots.sdi
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+module
+"BD25A480-30AB-101C-A17D-000024021828"
+"C049C7E0-30AB-101C-A17D-000024021828"
+SvxItems
+[
+HelpText( "Svx-Items" )
+SlotIdFile( "svxslots.hrc" )
+]
+{
+ //=========================================================================
+
+ include "sfx2/sfxitems.sdi"
+ include "sfx2/sfx.sdi"
+ include "svxitems.sdi"
+ include "xoitems.sdi"
+ include "svx.sdi"
+ include "fmslots.sdi"
+
+/* interface SearchSettings: Object
+ [
+ uuid = "19B54420-184C-101D-B8ED-3273768855A7";
+ ]
+ {
+ SID_SEARCH_ITEM
+ [
+ ExecMethod = _ExecSearch;
+ StateMethod = _StateSearch;
+ ]
+ }
+
+ interface Interior : Object
+ [
+ uuid ( "6CFA4FC0-608E-11cf-89CB-008029E4B0B1" )
+ ]
+ {
+ SID_ATTR_BRUSH // status(final|play)
+ [
+ ExecMethod = ExecBckCol ;
+ StateMethod = GetBckColState ;
+ ]
+ }
+ //============================================================================
+ interface OLEObjects : Collection
+ [
+ uuid = "BA338A43-064E-11d0-89CB-008029E4B0B1" ;
+ ]
+ {
+ }
+*/
+}
+
diff --git a/svx/sdi/xoitems.sdi b/svx/sdi/xoitems.sdi
new file mode 100644
index 000000000000..0fcfd6d317e6
--- /dev/null
+++ b/svx/sdi/xoitems.sdi
@@ -0,0 +1,163 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+//item String XFillAttrSetItem; SfxSetItem!
+struct XFillBitmap
+{
+ String Name MID_NAME;
+ String GraphicsURL MID_GRAFURL;
+// com::sun::star::awt::XBitmap
+};
+item XFillBitmap XFillBitmapItem;
+
+item INT32 XFillColorItem; // XColorItem
+
+enum SvxGradientStyle
+{
+ SVX_GRADIENTSTYLE_LINEAR,
+ SVX_GRADIENTSTYLE_AXIAL,
+ SVX_GRADIENTSTYLE_RADIAL,
+ SVX_GRADIENTSTYLE_ELLIPTICAL,
+ SVX_GRADIENTSTYLE_SQUARE,
+ SVX_GRADIENTSTYLE_RECT
+};
+
+struct XFillGradient
+{
+ String Name MID_NAME;
+ // com::sun::star::awt::Gradient
+ SvxGradientStyle Style MID_GRADIENT_STYLE;
+ INT32 StartColor MID_GRADIENT_STARTCOLOR;
+ INT32 EndColor MID_GRADIENT_ENDCOLOR;
+ INT16 Angle MID_GRADIENT_ANGLE;
+ INT16 Border MID_GRADIENT_BORDER;
+ INT16 XOffset MID_GRADIENT_XOFFSET;
+ INT16 YOffset MID_GRADIENT_YOFFSET;
+ INT16 StartIntensity MID_GRADIENT_STARTINTENSITY;
+ INT16 EndIntensity MID_GRADIENT_ENDINTENSITY;
+ INT16 StepCount MID_GRADIENT_STEPCOUNT;
+};
+item XFillGradient XFillGradientItem;
+
+enum SvxHatchStyle
+{
+ SVX_HATCHSTYLE_SINGLE,
+ SVX_HATCHSTYLE_DOUBLE,
+ SVX_HATCHSTYLE_TRIPLE
+};
+
+struct XFillHatch
+{
+ String Name MID_NAME;
+ // com::sun::star::drawing::Hatch
+ SvxHatchStyle Style MID_HATCH_STYLE;
+ INT32 Color MID_HATCH_COLOR;
+ INT32 Distance MID_HATCH_DISTANCE;
+ INT32 Angle MID_HATCH_ANGLE;
+};
+item XFillHatch XFillHatchItem;
+
+enum SvxFillStyle
+{
+ SVX_FILLSTYLE_NONE,
+ SVX_FILLSTYLE_SOLID,
+ SVX_FILLSTYLE_GRADIENT,
+ SVX_FILLSTYLE_HATCH,
+ SVX_FILLSTYLE_BITMAP
+};
+
+item SvxFillStyle XFillStyleItem;
+
+//item String XLineAttrSetItem; SfxSetItem!
+
+item INT32 XLineColorItem;
+
+enum SvxDashStyle
+{
+ SVX_DASHSTYLE_RECT,
+ SVX_DASHSTYLE_ROUND,
+ SVX_DASHSTYLE_RECTRELATIVE,
+ SVX_DASHSTYLE_ROUNDRELATIVE
+};
+
+struct XLineDash
+{
+ String Name MID_NAME;
+ // com::sun::star::drawing::LineDash
+ SvxDashStyle Style MID_LINEDASH_STYLE;
+ INT16 Dots MID_LINEDASH_DOTS;
+ INT32 DotLen MID_LINEDASH_DOTLEN;
+ INT16 Dashes MID_LINEDASH_DASHES;
+ INT32 DashLen MID_LINEDASH_DASHLEN;
+ INT32 Distance MID_LINEDASH_DISTANCE;
+};
+item XLineDash XLineDashItem;
+
+struct XLineEnd
+{
+ String Name MID_NAME;
+// com::sun::star::drawing::PolyPolygonBezierCoords
+};
+item XLineEnd XLineEndItem;
+
+item INT32 XLineEndWidthItem;
+item BOOL XLineEndCenterItem;
+
+struct XLineStart
+{
+ String Name MID_NAME;
+// com::sun::star::drawing::PolyPolygonBezierCoords
+};
+item XLineStart XLineStartItem;
+
+item INT32 XLineStartWidthItem;
+item BOOL XLineStartCenterItem;
+
+enum SvxLineStyle
+{
+ SVX_LINESTYLE_NONE,
+ SVX_LINESTYLE_SOLID,
+ SVX_LINESTYLE_DASH
+};
+
+item SvxLineStyle XLineStyleItem;
+
+item INT32 XLineWidthItem;
+item INT32 XFormTextStyleItem;
+item INT32 XFormTextAdjustItem;
+
+item INT32 XFormTextDistanceItem; // SfxInt32Item
+item INT32 XFormTextStartItem; // SfxInt32Item
+item BOOL XFormTextMirrorItem; // SfxBoolItem
+
+item INT32 XFormTextStdFormItem; // SfxEnumItem
+item BOOL XFormTextHideFormItem; // SfxBoolItem
+item BOOL XFormTextOutlineItem; // SfxBoolItem
+item INT32 XFormTextShadowItem; // SfxEnumItem
+item INT32 XFormTextShadowColorItem; // XColorItem
+item INT32 XFormTextShadowXValItem; // SfxMetricItem/SfxInt32Item
+item INT32 XFormTextShadowYValItem; // SfxMetricItem/SfxInt32Item
diff --git a/svx/source/accessibility/AccessibleControlShape.cxx b/svx/source/accessibility/AccessibleControlShape.cxx
new file mode 100644
index 000000000000..2bca7593f423
--- /dev/null
+++ b/svx/source/accessibility/AccessibleControlShape.cxx
@@ -0,0 +1,920 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/AccessibleControlShape.hxx>
+#include <svx/AccessibleShapeInfo.hxx>
+#include "svx/DescriptionGenerator.hxx"
+#include <com/sun/star/drawing/XControlShape.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/form/FormComponentType.hpp>
+#include <com/sun/star/reflection/XProxyFactory.hpp>
+#include <com/sun/star/container/XContainer.hpp>
+#include <comphelper/processfactory.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <svx/svdouno.hxx>
+#include "svx/unoapi.hxx"
+#include <svx/ShapeTypeHandler.hxx>
+#include <svx/SvxShapeTypes.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <comphelper/accessiblewrapper.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdpagv.hxx>
+#include "svx/svdstr.hrc"
+#include <algorithm>
+
+using namespace ::comphelper;
+using namespace ::accessibility;
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::reflection;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::container;
+
+//--------------------------------------------------------------------
+namespace
+{
+ //................................................................
+ const ::rtl::OUString& lcl_getNamePropertyName( )
+ {
+ static ::rtl::OUString s_sNamePropertyName( RTL_CONSTASCII_USTRINGPARAM( "Name" ) );
+ return s_sNamePropertyName;
+ }
+ //................................................................
+ const ::rtl::OUString& lcl_getDescPropertyName( )
+ {
+ static ::rtl::OUString s_sDescPropertyDesc( RTL_CONSTASCII_USTRINGPARAM( "HelpText" ) );
+ return s_sDescPropertyDesc;
+ }
+ //................................................................
+ const ::rtl::OUString& lcl_getLabelPropertyName( )
+ {
+ static ::rtl::OUString s_sLabelPropertyLabel( RTL_CONSTASCII_USTRINGPARAM( "Label" ) );
+ return s_sLabelPropertyLabel;
+ }
+ //................................................................
+ // return the property which should be used as AccessibleName
+ const ::rtl::OUString& lcl_getPreferredAccNameProperty( const Reference< XPropertySetInfo >& _rxPSI )
+ {
+ if ( _rxPSI.is() && _rxPSI->hasPropertyByName( lcl_getLabelPropertyName() ) )
+ return lcl_getLabelPropertyName();
+ else
+ return lcl_getNamePropertyName();
+ }
+
+ //................................................................
+ // determines whether or not a state which belongs to the inner context needs to be forwarded to the "composed"
+ // context
+ sal_Bool isComposedState( const sal_Int16 _nState )
+ {
+ return ( ( AccessibleStateType::INVALID != _nState )
+ && ( AccessibleStateType::DEFUNC != _nState )
+ && ( AccessibleStateType::ICONIFIED != _nState )
+ && ( AccessibleStateType::RESIZABLE != _nState )
+ && ( AccessibleStateType::SELECTABLE != _nState )
+ && ( AccessibleStateType::SHOWING != _nState )
+ && ( AccessibleStateType::MANAGES_DESCENDANTS != _nState )
+ && ( AccessibleStateType::VISIBLE != _nState )
+ );
+ }
+
+ //................................................................
+ /** determines whether the given control is in alive mode
+ */
+ inline sal_Bool isAliveMode( const Reference< XControl >& _rxControl )
+ {
+ OSL_PRECOND( _rxControl.is(), "AccessibleControlShape::isAliveMode: invalid control" );
+ return _rxControl.is() && !_rxControl->isDesignMode();
+ }
+}
+
+//=============================================================================
+//= AccessibleControlShape
+//=============================================================================
+
+//-----------------------------------------------------------------------------
+AccessibleControlShape::AccessibleControlShape (
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo)
+ : AccessibleShape (rShapeInfo, rShapeTreeInfo)
+ , m_bListeningForName( sal_False )
+ , m_bListeningForDesc( sal_False )
+ , m_bMultiplexingStates( sal_False )
+ , m_bDisposeNativeContext( sal_False )
+ , m_bWaitingForControl( sal_False )
+{
+ m_pChildManager = new OWrappedAccessibleChildrenManager( getProcessServiceFactory() );
+ m_pChildManager->acquire();
+
+ osl_incrementInterlockedCount( &m_refCount );
+ {
+ m_pChildManager->setOwningAccessible( this );
+ }
+ osl_decrementInterlockedCount( &m_refCount );
+}
+
+//-----------------------------------------------------------------------------
+AccessibleControlShape::~AccessibleControlShape (void)
+{
+ m_pChildManager->release();
+ m_pChildManager = NULL;
+
+ if ( m_xControlContextProxy.is() )
+ m_xControlContextProxy->setDelegator( NULL );
+ m_xControlContextProxy.clear();
+ m_xControlContextTypeAccess.clear();
+ m_xControlContextComponent.clear();
+ // this should remove the _only_ three "real" reference (means not delegated to
+ // ourself) to this proxy, and thus delete it
+}
+
+//-----------------------------------------------------------------------------
+SdrObject* AccessibleControlShape::getSdrObject() const
+{
+ return GetSdrObjectFromXShape (mxShape);
+}
+
+namespace {
+ Reference< XContainer > lcl_getControlContainer( const Window* _pWin, const SdrView* _pView )
+ {
+ Reference< XContainer > xReturn;
+ DBG_ASSERT( _pView, "lcl_getControlContainer: invalid view!" );
+ if ( _pView && _pView->GetSdrPageView())
+ {
+ xReturn = xReturn.query( _pView->GetSdrPageView()->GetControlContainer( *_pWin ) );
+ }
+ return xReturn;
+ }
+}
+
+//-----------------------------------------------------------------------------
+void AccessibleControlShape::Init()
+{
+ AccessibleShape::Init();
+
+ OSL_ENSURE( !m_xControlContextProxy.is(), "AccessibleControlShape::Init: already initialized!" );
+ try
+ {
+ // What we need to do here is merge the functionality of the AccessibleContext of our UNO control
+ // with our own AccessibleContext-related functionality.
+ //
+ // The problem is that we do not know the interfaces our "inner" context supports - this may be any
+ // XAccessibleXXX interface (or even any other) which makes sense for it.
+ //
+ // In theory, we could implement all possible interfaces ourself, and re-route all functionality to
+ // the inner context (except those we implement ourself, like XAccessibleComponent). But this is in no
+ // way future-proof - as soon as an inner context appears which implements an additional interface,
+ // we would need to adjust our implementation to support this new interface, too. Bad idea.
+ //
+ // The usual solution for such a problem is aggregation. Aggregation means using UNO's own meachnisms
+ // for merging an inner with an outer component, and get a component which behaves as it is exactly one.
+ // This is what XAggregation is for. Unfortunately, aggregation requires _exact_ control over the ref count
+ // of the inner object, which we do not have at all.
+ // Bad, too.
+ //
+ // But there is a solution: com.sun.star.reflection.ProxyFactory. This service is able to create a proxy
+ // for any component, which supports _exactly_ the same interfaces as the component. In addition, it can
+ // be aggregated, as by definition the proxy's ref count is exactly 1 when returned from the factory.
+ // Sounds better. Though this yields the problem of slightly degraded performance, it's the only solution
+ // I'm aware of at the moment .....
+ //
+ // 98750 - 30.04.2002 - fs@openoffice.org
+ //
+
+ // get the control which belongs to our model (relative to our view)
+ const Window* pViewWindow = maShapeTreeInfo.GetWindow();
+ SdrUnoObj* pUnoObjectImpl = PTR_CAST( SdrUnoObj, getSdrObject() );
+ SdrView* pView = maShapeTreeInfo.GetSdrView();
+ OSL_ENSURE( pView && pViewWindow && pUnoObjectImpl, "AccessibleControlShape::Init: no view, or no view window, no SdrUnoObj!" );
+
+ if ( pView && pViewWindow && pUnoObjectImpl )
+ {
+ // .................................................................
+ // get the context of the control - it will be our "inner" context
+ m_xUnoControl = pUnoObjectImpl->GetUnoControl( *pView, *pViewWindow );
+
+ if ( !m_xUnoControl.is() )
+ {
+ // the control has not yet been created. Though speaking strictly, it is a bug that
+ // our instance here is created without an existing control (because an AccessibleControlShape
+ // is a representation of a view object, and can only live if the view it should represent
+ // is complete, which implies a living control), it's by far the easiest and most riskless way
+ // to fix this here in this class.
+ // Okay, we will add as listener to the control container where we expect our control to appear.
+ OSL_ENSURE( !m_bWaitingForControl, "AccessibleControlShape::Init: already waiting for the control!" );
+
+ Reference< XContainer > xControlContainer = lcl_getControlContainer( pViewWindow, maShapeTreeInfo.GetSdrView() );
+ OSL_ENSURE( xControlContainer.is(), "AccessibleControlShape::Init: unable to find my ControlContainer!" );
+ if ( xControlContainer.is() )
+ {
+ xControlContainer->addContainerListener( this );
+ m_bWaitingForControl = sal_True;
+ }
+ }
+ else
+ {
+ Reference< XModeChangeBroadcaster > xControlModes( m_xUnoControl, UNO_QUERY );
+ Reference< XAccessible > xControlAccessible( xControlModes, UNO_QUERY );
+ Reference< XAccessibleContext > xNativeControlContext;
+ if ( xControlAccessible.is() )
+ xNativeControlContext = xControlAccessible->getAccessibleContext();
+ OSL_ENSURE( xNativeControlContext.is(), "AccessibleControlShape::Init: no AccessibleContext for the control!" );
+ m_aControlContext = WeakReference< XAccessibleContext >( xNativeControlContext );
+
+ // .................................................................
+ // add as listener to the context - we want to multiplex some states
+ if ( isAliveMode( m_xUnoControl ) && xNativeControlContext.is() )
+ { // (but only in alive mode)
+ startStateMultiplexing( );
+ }
+
+ // now that we have all information about our control, do some adjustments
+ adjustAccessibleRole();
+ initializeComposedState();
+
+ // some initialization for our child manager, which is used in alive mode only
+ if ( isAliveMode( m_xUnoControl ) )
+ {
+ Reference< XAccessibleStateSet > xStates( getAccessibleStateSet( ) );
+ OSL_ENSURE( xStates.is(), "AccessibleControlShape::AccessibleControlShape: no inner state set!" );
+ m_pChildManager->setTransientChildren( !xStates.is() || xStates->contains( AccessibleStateType::MANAGES_DESCENDANTS ) );
+ }
+
+ // .................................................................
+ // finally, aggregate a proxy for the control context
+ // first a factory for the proxy
+ Reference< XProxyFactory > xFactory;
+ xFactory = xFactory.query( createProcessComponent( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.reflection.ProxyFactory" ) ) ) );
+ OSL_ENSURE( xFactory.is(), "AccessibleControlShape::Init: could not create a proxy factory!" );
+ // then the proxy itself
+ if ( xFactory.is() && xNativeControlContext.is() )
+ {
+ m_xControlContextProxy = xFactory->createProxy( xNativeControlContext );
+ OSL_VERIFY( xNativeControlContext->queryInterface( ::getCppuType( &m_xControlContextTypeAccess ) ) >>= m_xControlContextTypeAccess );
+ OSL_VERIFY( xNativeControlContext->queryInterface( ::getCppuType( &m_xControlContextComponent ) ) >>= m_xControlContextComponent );
+
+ // aggregate the proxy
+ osl_incrementInterlockedCount( &m_refCount );
+ if ( m_xControlContextProxy.is() )
+ {
+ // At this point in time, the proxy has a ref count of exactly one - in m_xControlContextProxy.
+ // Remember to _not_ reset this member unles the delegator of the proxy has been reset, too!
+ m_xControlContextProxy->setDelegator( *this );
+ }
+ osl_decrementInterlockedCount( &m_refCount );
+
+ m_bDisposeNativeContext = sal_True;
+
+ // Finally, we need to add ourself as mode listener to the control. In case the mode switches,
+ // we need to dispose ourself.
+ xControlModes->addModeChangeListener( this );
+ }
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "AccessibleControlShape::Init: could not \"aggregate\" the controls XAccessibleContext!" );
+ }
+}
+
+//-----------------------------------------------------------------------------
+Reference< XAccessibleContext > SAL_CALL AccessibleControlShape::getAccessibleContext(void) throw (RuntimeException)
+{
+ return AccessibleShape::getAccessibleContext ();
+}
+
+
+//-----------------------------------------------------------------------------
+void SAL_CALL AccessibleControlShape::grabFocus(void) throw (RuntimeException)
+{
+ if ( !m_xUnoControl.is() || !isAliveMode( m_xUnoControl ) )
+ {
+ // in design mode, we simply forward the request to the base class
+ AccessibleShape::grabFocus();
+ }
+ else
+ {
+ Reference< XWindow > xWindow( m_xUnoControl, UNO_QUERY );
+ OSL_ENSURE( xWindow.is(), "AccessibleControlShape::grabFocus: invalid control!" );
+ if ( xWindow.is() )
+ xWindow->setFocus();
+ }
+}
+
+//-----------------------------------------------------------------------------
+::rtl::OUString SAL_CALL AccessibleControlShape::getImplementationName(void) throw (RuntimeException)
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.accessibility.AccessibleControlShape" ) );
+}
+
+//-----------------------------------------------------------------------------
+::rtl::OUString AccessibleControlShape::CreateAccessibleBaseName(void) throw (RuntimeException)
+{
+ ::rtl::OUString sName;
+
+ ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
+ switch (nShapeType)
+ {
+ case DRAWING_CONTROL:
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ControlShape"));
+ break;
+ default:
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("UnknownAccessibleControlShape"));
+ Reference< XShapeDescriptor > xDescriptor (mxShape, UNO_QUERY);
+ if (xDescriptor.is())
+ sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": "))
+ + xDescriptor->getShapeType();
+ }
+
+ return sName;
+}
+
+
+
+
+//--------------------------------------------------------------------
+::rtl::OUString
+ AccessibleControlShape::CreateAccessibleDescription (void)
+ throw (RuntimeException)
+{
+ DescriptionGenerator aDG (mxShape);
+ ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
+ switch (nShapeType)
+ {
+ case DRAWING_CONTROL:
+ {
+ // check if we can obtain the "Desc" property from the model
+ ::rtl::OUString sDesc( getControlModelStringProperty( lcl_getDescPropertyName() ) );
+ if ( !sDesc.getLength() )
+ { // no -> use the default
+ aDG.Initialize (STR_ObjNameSingulUno);
+ aDG.AddProperty (::rtl::OUString::createFromAscii ("ControlBackground"),
+ DescriptionGenerator::COLOR,
+ ::rtl::OUString());
+ aDG.AddProperty (::rtl::OUString::createFromAscii ("ControlBorder"),
+ DescriptionGenerator::INTEGER,
+ ::rtl::OUString());
+ }
+ // ensure that we are listening to the Name property
+ m_bListeningForDesc = ensureListeningState( m_bListeningForDesc, sal_True, lcl_getDescPropertyName() );
+ }
+ break;
+
+ default:
+ aDG.Initialize (::rtl::OUString::createFromAscii (
+ "Unknown accessible control shape"));
+ Reference< XShapeDescriptor > xDescriptor (mxShape, UNO_QUERY);
+ if (xDescriptor.is())
+ {
+ aDG.AppendString (::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("service name=")));
+ aDG.AppendString (xDescriptor->getShapeType());
+ }
+ }
+
+ return aDG();
+}
+
+//--------------------------------------------------------------------
+IMPLEMENT_FORWARD_REFCOUNT( AccessibleControlShape, AccessibleShape )
+IMPLEMENT_GET_IMPLEMENTATION_ID( AccessibleControlShape )
+
+//--------------------------------------------------------------------
+void SAL_CALL AccessibleControlShape::propertyChange( const PropertyChangeEvent& _rEvent ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( maMutex );
+
+ // check if it is the name or the description
+ if ( _rEvent.PropertyName.equals( lcl_getNamePropertyName() )
+ || _rEvent.PropertyName.equals( lcl_getLabelPropertyName( ) )
+ )
+ {
+ SetAccessibleName(
+ CreateAccessibleName(),
+ AccessibleContextBase::AutomaticallyCreated);
+ }
+ else if ( _rEvent.PropertyName.equals( lcl_getDescPropertyName() ) )
+ {
+ SetAccessibleDescription(
+ CreateAccessibleDescription(),
+ AccessibleContextBase::AutomaticallyCreated);
+ }
+#if OSL_DEBUG_LEVEL > 0
+ else
+ {
+ OSL_ENSURE( sal_False, "AccessibleControlShape::propertyChange: where did this come from?" );
+ }
+#endif
+}
+
+//--------------------------------------------------------------------
+Any SAL_CALL AccessibleControlShape::queryInterface( const Type& _rType ) throw (RuntimeException)
+{
+ Any aReturn = AccessibleShape::queryInterface( _rType );
+ if ( !aReturn.hasValue() )
+ {
+ aReturn = AccessibleControlShape_Base::queryInterface( _rType );
+ if ( !aReturn.hasValue() && m_xControlContextProxy.is() )
+ aReturn = m_xControlContextProxy->queryAggregation( _rType );
+ }
+ return aReturn;
+}
+
+//--------------------------------------------------------------------
+Sequence< Type > SAL_CALL AccessibleControlShape::getTypes() throw (RuntimeException)
+{
+ Sequence< Type > aShapeTypes = AccessibleShape::getTypes();
+ Sequence< Type > aOwnTypes = AccessibleControlShape_Base::getTypes();
+
+ Sequence< Type > aAggregateTypes;
+ if ( m_xControlContextTypeAccess.is() )
+ aAggregateTypes = m_xControlContextTypeAccess->getTypes();
+
+ Sequence< Type > aAllTypes = concatSequences( aShapeTypes, aOwnTypes, aAggregateTypes );
+
+ // remove duplicates
+ Type* pBegin = aAllTypes.getArray();
+ Type* pEnd = pBegin + aAllTypes.getLength();
+ while ( pBegin != pEnd )
+ {
+ Type aThisRoundType = *pBegin;
+ if ( ++pBegin != pEnd )
+ {
+ pEnd = ::std::remove( pBegin, pEnd, aThisRoundType );
+ // now all types between begin and (the old) end which equal aThisRoundType
+ // are moved behind the new end
+ }
+ }
+ aAllTypes.realloc( pEnd - aAllTypes.getArray() );
+
+ return aAllTypes;
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL AccessibleControlShape::notifyEvent( const AccessibleEventObject& _rEvent ) throw (RuntimeException)
+{
+ if ( AccessibleEventId::STATE_CHANGED == _rEvent.EventId )
+ {
+ // multiplex this change
+ sal_Int16 nLostState( 0 ), nGainedState( 0 );
+ _rEvent.OldValue >>= nLostState;
+ _rEvent.NewValue >>= nGainedState;
+
+ // don't multiplex states which the inner context is not resposible for
+ if ( isComposedState( nLostState ) )
+ AccessibleShape::ResetState( nLostState );
+
+ if ( isComposedState( nGainedState ) )
+ AccessibleShape::SetState( nGainedState );
+ }
+ else
+ {
+ AccessibleEventObject aTranslatedEvent( _rEvent );
+
+ {
+ ::osl::MutexGuard aGuard( maMutex );
+
+ // let the child manager translate the event
+ aTranslatedEvent.Source = *this;
+ m_pChildManager->translateAccessibleEvent( _rEvent, aTranslatedEvent );
+
+ // see if any of these notifications affect our child manager
+ m_pChildManager->handleChildNotification( _rEvent );
+ }
+
+ FireEvent( aTranslatedEvent );
+ }
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL AccessibleControlShape::modeChanged( const ModeChangeEvent& _rSource ) throw (RuntimeException)
+{
+ // did it come from our inner context (the real one, not it's proxy!)?
+ OSL_TRACE ("AccessibleControlShape::modeChanged");
+ Reference< XControl > xSource( _rSource.Source, UNO_QUERY ); // for faster compare
+ if ( xSource.get() == m_xUnoControl.get() )
+ {
+ // If our "pseudo-aggregated" inner context does not live anymore,
+ // we don't want to live, too. This is accomplished by asking our
+ // parent to replace this object with a new one. Disposing this
+ // object and sending notifications about the replacement are in
+ // the responsibility of our parent.
+ OSL_VERIFY( mpParent->ReplaceChild ( this, mxShape, mnIndex, maShapeTreeInfo ) );
+ }
+#if OSL_DEBUG_LEVEL > 0
+ else
+ OSL_ENSURE( sal_False, "AccessibleControlShape::modeChanged: where did this come from?" );
+#endif
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL AccessibleControlShape::disposing (const EventObject& _rSource) throw (RuntimeException)
+{
+ AccessibleShape::disposing( _rSource );
+}
+
+//--------------------------------------------------------------------
+sal_Bool AccessibleControlShape::ensureListeningState(
+ const sal_Bool _bCurrentlyListening, const sal_Bool _bNeedNewListening,
+ const ::rtl::OUString& _rPropertyName )
+{
+ if ( ( _bCurrentlyListening == _bNeedNewListening ) || !ensureControlModelAccess() )
+ // nothing to do
+ return _bCurrentlyListening;
+
+ try
+ {
+ if ( !m_xModelPropsMeta.is() || m_xModelPropsMeta->hasPropertyByName( _rPropertyName ) )
+ {
+ // add or revoke as listener
+ if ( _bNeedNewListening )
+ m_xControlModel->addPropertyChangeListener( _rPropertyName, static_cast< XPropertyChangeListener* >( this ) );
+ else
+ m_xControlModel->removePropertyChangeListener( _rPropertyName, static_cast< XPropertyChangeListener* >( this ) );
+ }
+ else
+ OSL_ENSURE( sal_False, "AccessibleControlShape::ensureListeningState: this property does not exist at this model!" );
+ }
+ catch( const Exception& e )
+ {
+ (void)e; // make compiler happy
+ OSL_ENSURE( sal_False, "AccessibleControlShape::ensureListeningState: could not change the listening state!" );
+ }
+
+ return _bNeedNewListening;
+}
+
+//--------------------------------------------------------------------
+sal_Int32 SAL_CALL AccessibleControlShape::getAccessibleChildCount( ) throw(RuntimeException)
+{
+ if ( !m_xUnoControl.is() )
+ return 0;
+ else if ( !isAliveMode( m_xUnoControl ) )
+ // no special action required when in design mode
+ return AccessibleShape::getAccessibleChildCount( );
+ else
+ {
+ // in alive mode, we have the full control over our children - they are determined by the children
+ // of the context of our UNO control
+ Reference< XAccessibleContext > xControlContext( m_aControlContext );
+ OSL_ENSURE( xControlContext.is(), "AccessibleControlShape::getAccessibleChildCount: control context already dead! How this!" );
+ return xControlContext.is() ? xControlContext->getAccessibleChildCount() : 0;
+ }
+}
+
+//--------------------------------------------------------------------
+Reference< XAccessible > SAL_CALL AccessibleControlShape::getAccessibleChild( sal_Int32 i ) throw(IndexOutOfBoundsException, RuntimeException)
+{
+ Reference< XAccessible > xChild;
+ if ( !m_xUnoControl.is() )
+ {
+ throw IndexOutOfBoundsException();
+ }
+ if ( !isAliveMode( m_xUnoControl ) )
+ {
+ // no special action required when in design mode - let the base class handle this
+ xChild = AccessibleShape::getAccessibleChild( i );
+ }
+ else
+ {
+ // in alive mode, we have the full control over our children - they are determined by the children
+ // of the context of our UNO control
+
+ Reference< XAccessibleContext > xControlContext( m_aControlContext );
+ OSL_ENSURE( xControlContext.is(), "AccessibleControlShape::getAccessibleChildCount: control context already dead! How this!" );
+ if ( xControlContext.is() )
+ {
+ Reference< XAccessible > xInnerChild( xControlContext->getAccessibleChild( i ) );
+ OSL_ENSURE( xInnerChild.is(), "AccessibleControlShape::getAccessibleChild: control context returned nonsense!" );
+ if ( xInnerChild.is() )
+ {
+ // we need to wrap this inner child into an own implementation
+ xChild = m_pChildManager->getAccessibleWrapperFor( xInnerChild );
+ }
+ }
+ }
+
+#if OSL_DEBUG_LEVEL > 0
+ sal_Int32 nChildIndex = -1;
+ Reference< XAccessibleContext > xContext;
+ if ( xChild.is() )
+ xContext = xChild->getAccessibleContext( );
+ if ( xContext.is() )
+ nChildIndex = xContext->getAccessibleIndexInParent( );
+ OSL_ENSURE( nChildIndex == i, "AccessibleControlShape::getAccessibleChild: index mismatch!" );
+#endif
+ return xChild;
+}
+
+//--------------------------------------------------------------------
+Reference< XAccessibleRelationSet > SAL_CALL AccessibleControlShape::getAccessibleRelationSet( ) throw (RuntimeException)
+{
+ // TODO
+ return AccessibleShape::getAccessibleRelationSet( );
+}
+
+//--------------------------------------------------------------------
+::rtl::OUString AccessibleControlShape::CreateAccessibleName (void) throw (RuntimeException)
+{
+ ensureControlModelAccess();
+
+ // check if we can obtain the "Name" resp. "Label" property from the model
+ const ::rtl::OUString& rAccNameProperty = lcl_getPreferredAccNameProperty( m_xModelPropsMeta );
+
+ ::rtl::OUString sName( getControlModelStringProperty( rAccNameProperty ) );
+ if ( !sName.getLength() )
+ { // no -> use the default
+ sName = AccessibleShape::CreateAccessibleName();
+ }
+
+ // now that somebody first asked us for our name, ensure that we are listening to name changes on the model
+ m_bListeningForName = ensureListeningState( m_bListeningForName, sal_True, lcl_getPreferredAccNameProperty( m_xModelPropsMeta ) );
+
+ return sName;
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL AccessibleControlShape::disposing (void)
+{
+ // ensure we're not listening
+ m_bListeningForName = ensureListeningState( m_bListeningForName, sal_False, lcl_getPreferredAccNameProperty( m_xModelPropsMeta ) );
+ m_bListeningForDesc = ensureListeningState( m_bListeningForDesc, sal_False, lcl_getDescPropertyName() );
+
+ if ( m_bMultiplexingStates )
+ stopStateMultiplexing( );
+
+ // dispose the child cache/map
+ m_pChildManager->dispose();
+
+ // release the model
+ m_xControlModel.clear();
+ m_xModelPropsMeta.clear();
+ m_aControlContext = WeakReference< XAccessibleContext >();
+
+ // stop listening at the control container (should never be necessary here, but who knows ....)
+ if ( m_bWaitingForControl )
+ {
+ OSL_ENSURE( sal_False, "AccessibleControlShape::disposing: this should never happen!" );
+ Reference< XContainer > xContainer = lcl_getControlContainer( maShapeTreeInfo.GetWindow(), maShapeTreeInfo.GetSdrView() );
+ if ( xContainer.is() )
+ {
+ m_bWaitingForControl = sal_False;
+ xContainer->removeContainerListener( this );
+ }
+ }
+
+ // forward the disposel to our inner context
+ if ( m_bDisposeNativeContext )
+ {
+ // don't listen for mode changes anymore
+ Reference< XModeChangeBroadcaster > xControlModes( m_xUnoControl, UNO_QUERY );
+ OSL_ENSURE( xControlModes.is(), "AccessibleControlShape::disposing: don't have an mode broadcaster anymore!" );
+ if ( xControlModes.is() )
+ xControlModes->removeModeChangeListener( this );
+
+ if ( m_xControlContextComponent.is() )
+ m_xControlContextComponent->dispose();
+ // do _not_ clear m_xControlContextProxy! This has to be done in the dtor for correct ref-count handling
+
+ // no need to dispose the proxy/inner context anymore
+ m_bDisposeNativeContext = sal_False;
+ }
+
+ m_xUnoControl.clear();
+
+ // let the base do it's stuff
+ AccessibleShape::disposing();
+}
+
+//--------------------------------------------------------------------
+sal_Bool AccessibleControlShape::ensureControlModelAccess() SAL_THROW(())
+{
+ if ( m_xControlModel.is() )
+ return sal_True;
+
+ try
+ {
+ Reference< XControlShape > xShape( mxShape, UNO_QUERY );
+ if ( xShape.is() )
+ m_xControlModel = m_xControlModel.query( xShape->getControl() );
+
+ if ( m_xControlModel.is() )
+ m_xModelPropsMeta = m_xControlModel->getPropertySetInfo();
+ }
+ catch( const Exception& e )
+ {
+ (void)e; // make compiler happy
+ OSL_ENSURE( sal_False, "AccessibleControlShape::ensureControlModelAccess: caught an exception!" );
+ }
+
+ return m_xControlModel.is();
+}
+
+//--------------------------------------------------------------------
+void AccessibleControlShape::startStateMultiplexing()
+{
+ OSL_PRECOND( !m_bMultiplexingStates, "AccessibleControlShape::startStateMultiplexing: already multiplexing!" );
+
+#if OSL_DEBUG_LEVEL > 0
+ // we should have a control, and it should be in alive mode
+ OSL_PRECOND( isAliveMode( m_xUnoControl ),
+ "AccessibleControlShape::startStateMultiplexing: should be done in alive mode only!" );
+#endif
+ // we should have the native context of the control
+ Reference< XAccessibleEventBroadcaster > xBroadcaster( m_aControlContext.get(), UNO_QUERY );
+ OSL_ENSURE( xBroadcaster.is(), "AccessibleControlShape::startStateMultiplexing: no AccessibleEventBroadcaster on the native context!" );
+
+ if ( xBroadcaster.is() )
+ {
+ xBroadcaster->addEventListener( this );
+ m_bMultiplexingStates = sal_True;
+ }
+}
+
+//--------------------------------------------------------------------
+void AccessibleControlShape::stopStateMultiplexing()
+{
+ OSL_PRECOND( m_bMultiplexingStates, "AccessibleControlShape::stopStateMultiplexing: not multiplexing!" );
+
+ // we should have the native context of the control
+ Reference< XAccessibleEventBroadcaster > xBroadcaster( m_aControlContext.get(), UNO_QUERY );
+ OSL_ENSURE( xBroadcaster.is(), "AccessibleControlShape::stopStateMultiplexing: no AccessibleEventBroadcaster on the native context!" );
+
+ if ( xBroadcaster.is() )
+ {
+ xBroadcaster->removeEventListener( this );
+ m_bMultiplexingStates = sal_False;
+ }
+}
+
+//--------------------------------------------------------------------
+::rtl::OUString AccessibleControlShape::getControlModelStringProperty( const ::rtl::OUString& _rPropertyName ) const SAL_THROW(())
+{
+ ::rtl::OUString sReturn;
+ try
+ {
+ if ( const_cast< AccessibleControlShape* >( this )->ensureControlModelAccess() )
+ {
+ if ( !m_xModelPropsMeta.is() || m_xModelPropsMeta->hasPropertyByName( _rPropertyName ) )
+ // ask only if a) the control does not have a PropertySetInfo object or b) it has, and the
+ // property in question is available
+ m_xControlModel->getPropertyValue( _rPropertyName ) >>= sReturn;
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "OAccessibleControlContext::getModelStringProperty: caught an exception!" );
+ }
+ return sReturn;
+}
+
+//--------------------------------------------------------------------
+void AccessibleControlShape::adjustAccessibleRole( )
+{
+ // if we're in design mode, we are a simple SHAPE, in alive mode, we use the role of our inner context
+ if ( !isAliveMode( m_xUnoControl ) )
+ return;
+
+ // we're in alive mode -> determine the role of the inner context
+ Reference< XAccessibleContext > xNativeContext( m_aControlContext );
+ OSL_PRECOND( xNativeContext.is(), "AccessibleControlShape::adjustAccessibleRole: no inner context!" );
+ if ( xNativeContext.is() )
+ SetAccessibleRole( xNativeContext->getAccessibleRole( ) );
+}
+
+#ifdef DBG_UTIL
+//--------------------------------------------------------------------
+sal_Bool AccessibleControlShape::SetState( sal_Int16 _nState )
+{
+ OSL_ENSURE( !isAliveMode( m_xUnoControl ) || !isComposedState( _nState ),
+ "AccessibleControlShape::SetState: a state which should be determined by the control context is set from outside!" );
+ return AccessibleShape::SetState( _nState );
+}
+#endif // DBG_UTIL
+
+//--------------------------------------------------------------------
+void AccessibleControlShape::initializeComposedState()
+{
+ if ( !isAliveMode( m_xUnoControl ) )
+ // no action necessary for design mode
+ return;
+
+ // get our own state set implementation
+ ::utl::AccessibleStateSetHelper* pComposedStates =
+ static_cast< ::utl::AccessibleStateSetHelper* >( mxStateSet.get() );
+ OSL_PRECOND( pComposedStates,
+ "AccessibleControlShape::initializeComposedState: no composed set!" );
+
+ // we need to reset some states of the composed set, because they either do not apply
+ // for controls in alive mode, or are in the responsibility of the UNO-control, anyway
+ pComposedStates->RemoveState( AccessibleStateType::ENABLED ); // this is controlled by the UNO-control
+ pComposedStates->RemoveState( AccessibleStateType::SENSITIVE ); // this is controlled by the UNO-control
+ pComposedStates->RemoveState( AccessibleStateType::FOCUSABLE ); // this is controlled by the UNO-control
+ pComposedStates->RemoveState( AccessibleStateType::SELECTABLE ); // this does not hold for an alive UNO-control
+#if OSL_DEBUG_LEVEL > 0
+ // now, only states which are not in the responsibility of the UNO control should be part of this state set
+ {
+ Sequence< sal_Int16 > aInitStates = pComposedStates->getStates();
+ for ( sal_Int32 i=0; i<aInitStates.getLength(); ++i )
+ OSL_ENSURE( !isComposedState( aInitStates.getConstArray()[i] ),
+ "AccessibleControlShape::initializeComposedState: invalid initial composed state (should be controlled by the UNO-control)!" );
+ }
+#endif
+
+ // get my inner context
+ Reference< XAccessibleContext > xInnerContext( m_aControlContext );
+ OSL_PRECOND( xInnerContext.is(), "AccessibleControlShape::initializeComposedState: no inner context!" );
+ if ( xInnerContext.is() )
+ {
+ // get all states of the inner context
+ Reference< XAccessibleStateSet > xInnerStates( xInnerContext->getAccessibleStateSet() );
+ OSL_ENSURE( xInnerStates.is(), "AccessibleControlShape::initializeComposedState: no inner states!" );
+ Sequence< sal_Int16 > aInnerStates;
+ if ( xInnerStates.is() )
+ aInnerStates = xInnerStates->getStates();
+
+ // look which one are to be propagated to the composed context
+ const sal_Int16* pStates = aInnerStates.getConstArray();
+ const sal_Int16* pStatesEnd = pStates + aInnerStates.getLength();
+ for ( ; pStates != pStatesEnd; ++pStates )
+ {
+ if ( isComposedState( *pStates ) && !pComposedStates->contains( *pStates ) )
+ {
+ pComposedStates->AddState( *pStates );
+ }
+ }
+ }
+}
+
+void SAL_CALL AccessibleControlShape::elementInserted( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XContainer > xContainer( _rEvent.Source, UNO_QUERY );
+ Reference< XControl > xControl( _rEvent.Element, UNO_QUERY );
+
+ OSL_ENSURE( xContainer.is() && xControl.is(),
+ "AccessibleControlShape::elementInserted: invalid event description!" );
+
+ if ( !xControl.is() )
+ return;
+
+ ensureControlModelAccess();
+
+ Reference< XInterface > xNewNormalized( xControl->getModel(), UNO_QUERY );
+ Reference< XInterface > xMyModelNormalized( m_xControlModel, UNO_QUERY );
+ if ( xNewNormalized.get() && xMyModelNormalized.get() )
+ {
+ // now finally the control for the model we're responsible for has been inserted into the container
+ Reference< XInterface > xKeepAlive( *this );
+
+ // first, we're not interested in any more container events
+ if ( xContainer.is() )
+ {
+ xContainer->removeContainerListener( this );
+ m_bWaitingForControl = sal_False;
+ }
+
+ // second, we need to replace ourself with a new version, which now can be based on the
+ // control
+ OSL_VERIFY( mpParent->ReplaceChild ( this, mxShape, mnIndex, maShapeTreeInfo ) );
+ }
+}
+
+void SAL_CALL AccessibleControlShape::elementRemoved( const ::com::sun::star::container::ContainerEvent& ) throw (::com::sun::star::uno::RuntimeException)
+{
+ // not interested in
+}
+
+void SAL_CALL AccessibleControlShape::elementReplaced( const ::com::sun::star::container::ContainerEvent& ) throw (::com::sun::star::uno::RuntimeException)
+{
+ // not interested in
+}
diff --git a/svx/source/accessibility/AccessibleEmptyEditSource.cxx b/svx/source/accessibility/AccessibleEmptyEditSource.cxx
new file mode 100644
index 000000000000..92633a105323
--- /dev/null
+++ b/svx/source/accessibility/AccessibleEmptyEditSource.cxx
@@ -0,0 +1,356 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+//------------------------------------------------------------------------
+//
+// Global header
+//
+//------------------------------------------------------------------------
+#include <svl/itemset.hxx>
+#include <editeng/editdata.hxx>
+#include <editeng/outliner.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdpool.hxx>
+
+//------------------------------------------------------------------------
+//
+// Project-local header
+//
+//------------------------------------------------------------------------
+
+#include "AccessibleEmptyEditSource.hxx"
+#include <svx/unoshtxt.hxx>
+
+namespace accessibility
+{
+
+ /** This class simply wraps a SvxTextEditSource, forwarding all
+ methods except the GetBroadcaster() call
+ */
+ class AccessibleProxyEditSource_Impl : public SvxEditSource
+ {
+ public:
+ /** Construct AccessibleEmptyEditSource_Impl
+
+ @param rBrdCast
+
+ Proxy broadcaster to allow seamless flipping of edit source implementations. ProxyEditSource and EmptyEditSource
+ */
+ AccessibleProxyEditSource_Impl( SdrObject& rObj,
+ SdrView& rView,
+ const Window& rViewWindow );
+ ~AccessibleProxyEditSource_Impl();
+
+ // from the SvxEditSource interface
+ SvxTextForwarder* GetTextForwarder();
+ SvxViewForwarder* GetViewForwarder();
+ SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate = sal_False );
+
+ SvxEditSource* Clone() const;
+
+ void UpdateData();
+
+ SfxBroadcaster& GetBroadcaster() const;
+
+ private:
+ SvxTextEditSource maEditSource;
+
+ };
+
+ /** Dummy class, faking exactly one empty paragraph for EditEngine accessibility
+ */
+ class AccessibleEmptyEditSource_Impl : public SvxEditSource, public SvxViewForwarder, public SvxTextForwarder, public SfxBroadcaster
+ {
+ public:
+
+ AccessibleEmptyEditSource_Impl() {}
+ ~AccessibleEmptyEditSource_Impl() {}
+
+ // from the SfxListener interface
+ void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ // SvxEditSource
+ SvxTextForwarder* GetTextForwarder() { return this; }
+ SvxViewForwarder* GetViewForwarder() { return this; }
+ SvxEditSource* Clone() const { return NULL; }
+ void UpdateData() {}
+ SfxBroadcaster& GetBroadcaster() const { return *(const_cast<AccessibleEmptyEditSource_Impl*>(this)); }
+
+ // SvxTextForwarder
+ sal_uInt16 GetParagraphCount() const { return 1; }
+ sal_uInt16 GetTextLen( sal_uInt16 /*nParagraph*/ ) const { return 0; }
+ String GetText( const ESelection& /*rSel*/ ) const { return String(); }
+ SfxItemSet GetAttribs( const ESelection& /*rSel*/, sal_Bool /*bOnlyHardAttrib*/ = 0 ) const
+ {
+ // AW: Very dangerous: The former implementation used a SfxItemPool created on the
+ // fly which of course was deleted again ASAP. Thus, the returned SfxItemSet was using
+ // a deleted Pool by design.
+ return SfxItemSet(SdrObject::GetGlobalDrawObjectItemPool());
+ }
+ SfxItemSet GetParaAttribs( sal_uInt16 /*nPara*/ ) const { return GetAttribs(ESelection()); }
+ void SetParaAttribs( sal_uInt16 /*nPara*/, const SfxItemSet& /*rSet*/ ) {}
+ void RemoveAttribs( const ESelection& /*rSelection*/, sal_Bool /*bRemoveParaAttribs*/, sal_uInt16 /*nWhich*/ ){}
+ void GetPortions( sal_uInt16 /*nPara*/, SvUShorts& /*rList*/ ) const {}
+
+ sal_uInt16 GetItemState( const ESelection& /*rSel*/, sal_uInt16 /*nWhich*/ ) const { return 0; }
+ sal_uInt16 GetItemState( sal_uInt16 /*nPara*/, sal_uInt16 /*nWhich*/ ) const { return 0; }
+
+ SfxItemPool* GetPool() const { return NULL; }
+
+ void QuickInsertText( const String& /*rText*/, const ESelection& /*rSel*/ ) {}
+ void QuickInsertField( const SvxFieldItem& /*rFld*/, const ESelection& /*rSel*/ ) {}
+ void QuickSetAttribs( const SfxItemSet& /*rSet*/, const ESelection& /*rSel*/ ) {}
+ void QuickInsertLineBreak( const ESelection& /*rSel*/ ) {}
+
+ const SfxItemSet * GetEmptyItemSetPtr() { return 0; }
+
+ void AppendParagraph() {}
+ xub_StrLen AppendTextPortion( sal_uInt16 /*nPara*/, const String & /*rText*/, const SfxItemSet & /*rSet*/ ) { return 0; }
+
+ //XTextCopy
+ void CopyText(const SvxTextForwarder& ){}
+
+ XubString CalcFieldValue( const SvxFieldItem& /*rField*/, sal_uInt16 /*nPara*/, sal_uInt16 /*nPos*/, Color*& /*rpTxtColor*/, Color*& /*rpFldColor*/ )
+ {
+ return XubString();
+ }
+ void FieldClicked( const SvxFieldItem&, sal_uInt16, xub_StrLen ) {;}
+
+ sal_Bool IsValid() const { return sal_True; }
+
+ void SetNotifyHdl( const Link& ) {}
+ LanguageType GetLanguage( sal_uInt16, sal_uInt16 ) const { return LANGUAGE_DONTKNOW; }
+ sal_uInt16 GetFieldCount( sal_uInt16 ) const { return 0; }
+ EFieldInfo GetFieldInfo( sal_uInt16, sal_uInt16 ) const { return EFieldInfo(); }
+ EBulletInfo GetBulletInfo( sal_uInt16 ) const { return EBulletInfo(); }
+ Rectangle GetCharBounds( sal_uInt16, sal_uInt16 ) const { return Rectangle(); }
+ Rectangle GetParaBounds( sal_uInt16 ) const { return Rectangle(); }
+ MapMode GetMapMode() const { return MapMode(); }
+ OutputDevice* GetRefDevice() const { return NULL; }
+ sal_Bool GetIndexAtPoint( const Point&, sal_uInt16&, sal_uInt16& ) const { return sal_False; }
+ sal_Bool GetWordIndices( sal_uInt16, sal_uInt16, sal_uInt16&, sal_uInt16& ) const { return sal_False; }
+ sal_Bool GetAttributeRun( sal_uInt16&, sal_uInt16&, sal_uInt16, sal_uInt16 ) const { return sal_False; }
+ sal_uInt16 GetLineCount( sal_uInt16 nPara ) const { return nPara == 0 ? 1 : 0; }
+ sal_uInt16 GetLineLen( sal_uInt16, sal_uInt16 ) const { return 0; }
+ void GetLineBoundaries( /*out*/sal_uInt16 & rStart, /*out*/sal_uInt16 & rEnd, sal_uInt16 /*nParagraph*/, sal_uInt16 /*nLine*/ ) const { rStart = rEnd = 0; }
+ sal_uInt16 GetLineNumberAtIndex( sal_uInt16 /*nPara*/, sal_uInt16 /*nIndex*/ ) const { return 0; }
+
+ // the following two methods would, strictly speaking, require
+ // a switch to a real EditSource, too. Fortunately, the
+ // AccessibleEditableTextPara implementation currently always
+ // calls GetEditViewForwarder(true) before doing
+ // changes. Thus, we rely on this behabviour here (problem
+ // when that changes: via accessibility API, it would no
+ // longer be possible to enter text in previously empty
+ // shapes).
+ sal_Bool Delete( const ESelection& ) { return sal_False; }
+ sal_Bool InsertText( const String&, const ESelection& ) { return sal_False; }
+ sal_Bool QuickFormatDoc( sal_Bool ) { return sal_True; }
+ sal_Int16 GetDepth( sal_uInt16 ) const { return -1; }
+ sal_Bool SetDepth( sal_uInt16, sal_Int16 ) { return sal_True; }
+
+ Rectangle GetVisArea() const { return Rectangle(); }
+ Point LogicToPixel( const Point& rPoint, const MapMode& /*rMapMode*/ ) const { return rPoint; }
+ Point PixelToLogic( const Point& rPoint, const MapMode& /*rMapMode*/ ) const { return rPoint; }
+
+ };
+
+ // -------------------------------------------------------------------------
+ // Implementing AccessibleProxyEditSource_Impl
+ // -------------------------------------------------------------------------
+
+ AccessibleProxyEditSource_Impl::AccessibleProxyEditSource_Impl( SdrObject& rObj,
+ SdrView& rView,
+ const Window& rViewWindow ) :
+ maEditSource( rObj, 0, rView, rViewWindow )
+ {
+ }
+
+ AccessibleProxyEditSource_Impl::~AccessibleProxyEditSource_Impl()
+ {
+ }
+
+ SvxTextForwarder* AccessibleProxyEditSource_Impl::GetTextForwarder()
+ {
+ return maEditSource.GetTextForwarder();
+ }
+
+ SvxViewForwarder* AccessibleProxyEditSource_Impl::GetViewForwarder()
+ {
+ return maEditSource.GetViewForwarder();
+ }
+
+ SvxEditViewForwarder* AccessibleProxyEditSource_Impl::GetEditViewForwarder( sal_Bool bCreate )
+ {
+ return maEditSource.GetEditViewForwarder( bCreate );
+ }
+
+ SvxEditSource* AccessibleProxyEditSource_Impl::Clone() const
+ {
+ return maEditSource.Clone();
+ }
+
+ void AccessibleProxyEditSource_Impl::UpdateData()
+ {
+ maEditSource.UpdateData();
+ }
+
+ SfxBroadcaster& AccessibleProxyEditSource_Impl::GetBroadcaster() const
+ {
+ return maEditSource.GetBroadcaster();
+ }
+
+
+ // -------------------------------------------------------------------------
+ // Implementing AccessibleEmptyEditSource
+ // -------------------------------------------------------------------------
+
+ AccessibleEmptyEditSource::AccessibleEmptyEditSource( SdrObject& rObj,
+ SdrView& rView,
+ const Window& rViewWindow ) :
+ mpEditSource( new AccessibleEmptyEditSource_Impl() ),
+ mrObj(rObj),
+ mrView(rView),
+ mrViewWindow(rViewWindow),
+ mbEditSourceEmpty( true )
+ {
+ if( mrObj.GetModel() )
+ StartListening( *mrObj.GetModel() );
+ }
+
+ AccessibleEmptyEditSource::~AccessibleEmptyEditSource()
+ {
+ if( !mbEditSourceEmpty )
+ {
+ // deregister as listener
+ if( mpEditSource.get() )
+ EndListening( mpEditSource->GetBroadcaster() );
+ }
+ else
+ {
+ if( mrObj.GetModel() )
+ EndListening( *mrObj.GetModel() );
+ }
+ }
+
+ SvxTextForwarder* AccessibleEmptyEditSource::GetTextForwarder()
+ {
+ if( !mpEditSource.get() )
+ return NULL;
+
+ return mpEditSource->GetTextForwarder();
+ }
+
+ SvxViewForwarder* AccessibleEmptyEditSource::GetViewForwarder()
+ {
+ if( !mpEditSource.get() )
+ return NULL;
+
+ return mpEditSource->GetViewForwarder();
+ }
+
+ void AccessibleEmptyEditSource::Switch2ProxyEditSource()
+ {
+ // deregister EmptyEditSource model listener
+ if( mrObj.GetModel() )
+ EndListening( *mrObj.GetModel() );
+
+ ::std::auto_ptr< SvxEditSource > pProxySource( new AccessibleProxyEditSource_Impl(mrObj, mrView, mrViewWindow) );
+ ::std::auto_ptr< SvxEditSource > tmp = mpEditSource;
+ mpEditSource = pProxySource;
+ pProxySource = tmp;
+
+ // register as listener
+ StartListening( mpEditSource->GetBroadcaster() );
+
+ // we've irrevocably a full EditSource now.
+ mbEditSourceEmpty = false;
+ }
+
+ SvxEditViewForwarder* AccessibleEmptyEditSource::GetEditViewForwarder( sal_Bool bCreate )
+ {
+ if( !mpEditSource.get() )
+ return NULL;
+
+ // switch edit source, if not yet done
+ if( mbEditSourceEmpty && bCreate )
+ Switch2ProxyEditSource();
+
+ return mpEditSource->GetEditViewForwarder( bCreate );
+ }
+
+ SvxEditSource* AccessibleEmptyEditSource::Clone() const
+ {
+ if( !mpEditSource.get() )
+ return NULL;
+
+ return mpEditSource->Clone();
+ }
+
+ void AccessibleEmptyEditSource::UpdateData()
+ {
+ if( mpEditSource.get() )
+ mpEditSource->UpdateData();
+ }
+
+ SfxBroadcaster& AccessibleEmptyEditSource::GetBroadcaster() const
+ {
+ return *(const_cast<AccessibleEmptyEditSource*>(this));
+ }
+
+ void AccessibleEmptyEditSource::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
+ {
+ const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
+
+ if( pSdrHint && pSdrHint->GetKind() == HINT_BEGEDIT &&
+ &mrObj == pSdrHint->GetObject() && mpEditSource.get() )
+ {
+ // switch edit source, if not yet done. This is necessary
+ // to become a full-fledged EditSource the first time a
+ // user start entering text in a previously empty object.
+ if( mbEditSourceEmpty )
+ Switch2ProxyEditSource();
+ }
+ else if (pSdrHint && pSdrHint->GetObject()!=NULL)
+ {
+ // When the SdrObject just got a para outliner object then
+ // switch the edit source.
+ if (pSdrHint->GetObject()->GetOutlinerParaObject() != NULL)
+ Switch2ProxyEditSource();
+ }
+
+ // forward messages
+ Broadcast( rHint );
+ }
+
+} // end of namespace accessibility
+
+//------------------------------------------------------------------------
diff --git a/svx/source/accessibility/AccessibleEmptyEditSource.hxx b/svx/source/accessibility/AccessibleEmptyEditSource.hxx
new file mode 100644
index 000000000000..93ff0383eab1
--- /dev/null
+++ b/svx/source/accessibility/AccessibleEmptyEditSource.hxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_ACCESSIBLEEMPTYEDITSOURCE_HXX
+#define _SVX_ACCESSIBLEEMPTYEDITSOURCE_HXX
+
+#include <svl/brdcst.hxx>
+#include <svl/lstner.hxx>
+
+#include <memory>
+#include <editeng/unoedsrc.hxx>
+
+class SdrObject;
+class SdrView;
+class Window;
+
+namespace accessibility
+{
+ /** Proxy edit source for shapes without text
+
+ Extracted from old SvxDummyEditSource
+ */
+ class AccessibleEmptyEditSource : public SvxEditSource, public SfxListener, public SfxBroadcaster
+ {
+ public:
+ /** Create proxy edit source for shapes without text
+
+ Since the views don't broadcast their dying, make sure that
+ this object gets destroyed if the view becomes invalid
+
+ The window is necessary, since our views can display on multiple windows
+
+ Make sure you only create such an object if the shape _really_
+ does not contain text.
+ */
+ AccessibleEmptyEditSource( SdrObject& rObj, SdrView& rView, const Window& rViewWindow );
+ ~AccessibleEmptyEditSource();
+
+ // from the SvxEditSource interface
+ SvxTextForwarder* GetTextForwarder();
+ SvxViewForwarder* GetViewForwarder();
+
+ SvxEditSource* Clone() const;
+
+ // this method internally switches from empty to proxy mode,
+ // creating an SvxTextEditSource for the functionality.
+ SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate = sal_False );
+
+ void UpdateData();
+ SfxBroadcaster& GetBroadcaster() const;
+
+ // from the SfxListener interface
+ void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ private:
+ void Switch2ProxyEditSource();
+
+ /** Pointer to edit source implementation. This is switched on
+ a GetEditViewForwarder( true ) call, to actually create a
+ SvxTextEditSource.
+
+ @dyn
+ */
+ std::auto_ptr< SvxEditSource > mpEditSource;
+
+ SdrObject& mrObj;
+ SdrView& mrView;
+ const Window& mrViewWindow;
+
+ bool mbEditSourceEmpty;
+ };
+
+} // namespace accessibility
+
+#endif
+
diff --git a/svx/source/accessibility/AccessibleFrameSelector.cxx b/svx/source/accessibility/AccessibleFrameSelector.cxx
new file mode 100644
index 000000000000..76d9ae56dfba
--- /dev/null
+++ b/svx/source/accessibility/AccessibleFrameSelector.cxx
@@ -0,0 +1,740 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "AccessibleFrameSelector.hxx"
+#include <com/sun/star/awt/KeyEvent.hpp>
+#include <com/sun/star/awt/KeyModifier.hpp>
+#include <com/sun/star/awt/Key.hpp>
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLESTATETYPE_HDL_
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLERELATIONTYPE_HDL_
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEROLE_HDL_
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#endif
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/awt/FocusChangeReason.hpp>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <svx/frmsel.hxx>
+#include <svx/dialmgr.hxx>
+#include "editeng/unolingu.hxx"
+
+#ifndef _SVX_DIALOGS_HRC
+#include <svx/dialogs.hrc>
+#endif
+#ifndef SVX_FRMSEL_HRC
+#include "frmsel.hrc"
+#endif
+
+#ifndef MNEMONIC_CHAR
+#define MNEMONIC_CHAR ((sal_Unicode)'~')
+#endif
+
+namespace svx {
+namespace a11y {
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::XInterface;
+using ::com::sun::star::lang::Locale;
+using ::com::sun::star::lang::EventObject;
+using ::com::sun::star::beans::XPropertyChangeListener;
+using ::com::sun::star::awt::XFocusListener;
+
+using namespace ::com::sun::star::accessibility;
+
+namespace AwtKey = ::com::sun::star::awt::Key;
+namespace AwtKeyModifier = ::com::sun::star::awt::KeyModifier;
+namespace AwtFocusChangeReason = ::com::sun::star::awt::FocusChangeReason;
+
+typedef ::com::sun::star::awt::Point AwtPoint;
+typedef ::com::sun::star::awt::Size AwtSize;
+typedef ::com::sun::star::awt::Rectangle AwtRectangle;
+typedef ::com::sun::star::awt::KeyEvent AwtKeyEvent;
+typedef ::com::sun::star::awt::FocusEvent AwtFocusEvent;
+
+// ============================================================================
+
+AccFrameSelector::AccFrameSelector( FrameSelector& rFrameSel, FrameBorderType eBorder ) :
+ Resource( SVX_RES( RID_SVXSTR_BORDER_CONTROL ) ),
+ mpFrameSel( &rFrameSel ),
+ meBorder( eBorder ),
+ maFocusListeners( maFocusMutex ),
+ maPropertyListeners( maPropertyMutex ),
+ maNames( SVX_RES( ARR_TEXTS ) ),
+ maDescriptions( SVX_RES(ARR_DESCRIPTIONS ) ),
+ mnClientId( 0 )
+{
+ FreeResource();
+
+ if ( mpFrameSel )
+ {
+ mpFrameSel->AddEventListener( LINK( this, AccFrameSelector, WindowEventListener ) );
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+AccFrameSelector::~AccFrameSelector()
+{
+ if ( mpFrameSel )
+ {
+ mpFrameSel->RemoveEventListener( LINK( this, AccFrameSelector, WindowEventListener ) );
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+Reference< XAccessibleContext > AccFrameSelector::getAccessibleContext( )
+ throw (RuntimeException)
+{
+ return this;
+}
+
+// ----------------------------------------------------------------------------
+
+sal_Int32 AccFrameSelector::getAccessibleChildCount( ) throw (RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IsValid();
+ return (meBorder == FRAMEBORDER_NONE) ? mpFrameSel->GetEnabledBorderCount() : 0;
+}
+
+// ----------------------------------------------------------------------------
+
+Reference< XAccessible > AccFrameSelector::getAccessibleChild( sal_Int32 i )
+ throw (RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IsValid();
+ Reference< XAccessible > xRet;
+ if( meBorder == FRAMEBORDER_NONE )
+ xRet = mpFrameSel->GetChildAccessible( i );
+ if( !xRet.is() )
+ throw RuntimeException();
+ return xRet;
+}
+
+// ----------------------------------------------------------------------------
+
+Reference< XAccessible > AccFrameSelector::getAccessibleParent( )
+ throw (RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IsValid();
+ Reference< XAccessible > xRet;
+ if(meBorder == FRAMEBORDER_NONE)
+ xRet = mpFrameSel->GetParent()->GetAccessible( sal_True );
+ else
+ xRet = mpFrameSel->CreateAccessible();
+ return xRet;
+}
+
+// ----------------------------------------------------------------------------
+
+sal_Int32 AccFrameSelector::getAccessibleIndexInParent( )
+ throw (RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IsValid();
+
+ sal_Int32 nIdx = 0;
+ if( meBorder == FRAMEBORDER_NONE )
+ {
+ Window* pTabPage = mpFrameSel->GetParent();
+ sal_Int32 nChildren = pTabPage->GetChildCount();
+ for( nIdx = 0; nIdx < nChildren; ++nIdx )
+ if( pTabPage->GetChild( static_cast< sal_uInt16 >( nIdx ) ) == mpFrameSel )
+ break;
+ }
+ else
+ nIdx = mpFrameSel->GetEnabledBorderIndex( meBorder );
+
+ if( nIdx < 0 )
+ throw RuntimeException();
+ return nIdx;
+}
+
+// ----------------------------------------------------------------------------
+
+sal_Int16 AccFrameSelector::getAccessibleRole( ) throw (RuntimeException)
+{
+ return AccessibleRole::OPTION_PANE;
+}
+
+// ----------------------------------------------------------------------------
+
+OUString AccFrameSelector::getAccessibleDescription( )
+ throw (RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IsValid();
+ return maDescriptions.GetString(meBorder);
+}
+
+// ----------------------------------------------------------------------------
+
+OUString AccFrameSelector::getAccessibleName( )
+ throw (RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IsValid();
+ return maNames.GetString(meBorder);
+}
+
+// ----------------------------------------------------------------------------
+
+Reference< XAccessibleRelationSet > AccFrameSelector::getAccessibleRelationSet( )
+ throw (RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IsValid();
+ utl::AccessibleRelationSetHelper* pHelper;
+ Reference< XAccessibleRelationSet > xRet = pHelper = new utl::AccessibleRelationSetHelper;
+ if(meBorder == FRAMEBORDER_NONE)
+ {
+ //add the label relation
+ Window* pPrev = mpFrameSel->GetWindow( WINDOW_PREV );
+ if(pPrev && WINDOW_FIXEDTEXT == pPrev->GetType())
+ {
+ AccessibleRelation aLabelRelation;
+ aLabelRelation.RelationType = AccessibleRelationType::LABELED_BY;
+ aLabelRelation.TargetSet.realloc(1);
+ aLabelRelation.TargetSet.getArray()[0] = pPrev->GetAccessible();
+ pHelper->AddRelation(aLabelRelation);
+ }
+ }
+ return xRet;
+}
+
+// ----------------------------------------------------------------------------
+
+Reference< XAccessibleStateSet > AccFrameSelector::getAccessibleStateSet( )
+ throw (RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
+ Reference< XAccessibleStateSet > xRet = pStateSetHelper;
+
+ if(!mpFrameSel)
+ pStateSetHelper->AddState(AccessibleStateType::DEFUNC);
+ else
+ {
+ const sal_Int16 aStandardStates[] =
+ {
+ AccessibleStateType::EDITABLE,
+ AccessibleStateType::FOCUSABLE,
+ AccessibleStateType::MULTI_SELECTABLE,
+ AccessibleStateType::SELECTABLE,
+ AccessibleStateType::SHOWING,
+ AccessibleStateType::VISIBLE,
+ AccessibleStateType::OPAQUE,
+ 0};
+ sal_Int16 nState = 0;
+ while(aStandardStates[nState])
+ {
+ pStateSetHelper->AddState(aStandardStates[nState++]);
+ }
+ if(mpFrameSel->IsEnabled())
+ {
+ pStateSetHelper->AddState(AccessibleStateType::ENABLED);
+ pStateSetHelper->AddState(AccessibleStateType::SENSITIVE);
+ }
+
+ sal_Bool bIsParent = meBorder == FRAMEBORDER_NONE;
+ if(mpFrameSel->HasFocus() &&
+ (bIsParent || mpFrameSel->IsBorderSelected(meBorder)))
+ {
+ pStateSetHelper->AddState(AccessibleStateType::ACTIVE);
+ pStateSetHelper->AddState(AccessibleStateType::FOCUSED);
+ pStateSetHelper->AddState(AccessibleStateType::SELECTED);
+ }
+ }
+ return xRet;
+}
+
+// ----------------------------------------------------------------------------
+
+Locale AccFrameSelector::getLocale( )
+ throw (IllegalAccessibleComponentStateException, RuntimeException)
+{
+ Locale aRet;
+ SvxLanguageToLocale( aRet, Application::GetSettings().GetUILanguage() );
+ return aRet;
+}
+
+// ----------------------------------------------------------------------------
+
+void AccFrameSelector::addPropertyChangeListener(
+ const Reference< XPropertyChangeListener >& xListener )
+ throw (RuntimeException)
+{
+ maPropertyListeners.addInterface( xListener );
+}
+
+// ----------------------------------------------------------------------------
+
+void AccFrameSelector::removePropertyChangeListener( const Reference< XPropertyChangeListener >& xListener )
+ throw (RuntimeException)
+{
+ maPropertyListeners.removeInterface( xListener );
+}
+
+// ----------------------------------------------------------------------------
+
+sal_Bool AccFrameSelector::containsPoint( const AwtPoint& aPt )
+ throw (RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IsValid();
+ //aPt is relative to the frame selector
+ return mpFrameSel->ContainsClickPoint( Point( aPt.X, aPt.Y ) );
+}
+
+// ----------------------------------------------------------------------------
+
+Reference< XAccessible > AccFrameSelector::getAccessibleAtPoint(
+ const AwtPoint& aPt )
+ throw (RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IsValid();
+ //aPt is relative to the frame selector
+ return mpFrameSel->GetChildAccessible( Point( aPt.X, aPt.Y ) );
+}
+
+AwtRectangle AccFrameSelector::getBounds( ) throw (RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IsValid();
+ Size aSz;
+ Point aPos;
+ switch(meBorder)
+ {
+ case FRAMEBORDER_NONE:
+ aSz = mpFrameSel->GetSizePixel();
+ aPos = mpFrameSel->GetPosPixel();
+ break;
+ default:
+ const Rectangle aSpot = mpFrameSel->GetClickBoundRect( meBorder );
+ aPos = aSpot.TopLeft();
+ aSz = aSpot.GetSize();
+ }
+ AwtRectangle aRet;
+ aRet.X = aPos.X();
+ aRet.Y = aPos.Y();
+ aRet.Width = aSz.Width();
+ aRet.Height = aSz.Height();
+ return aRet;
+}
+
+// ----------------------------------------------------------------------------
+
+AwtPoint AccFrameSelector::getLocation( ) throw (RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IsValid();
+ Point aPos;
+ switch(meBorder)
+ {
+ case FRAMEBORDER_NONE:
+ aPos = mpFrameSel->GetPosPixel();
+ break;
+ default:
+ const Rectangle aSpot = mpFrameSel->GetClickBoundRect( meBorder );
+ aPos = aSpot.TopLeft();
+ }
+ AwtPoint aRet(aPos.X(), aPos.Y());
+ return aRet;
+}
+
+// ----------------------------------------------------------------------------
+
+AwtPoint AccFrameSelector::getLocationOnScreen( ) throw (RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IsValid();
+ Point aPos;
+ switch(meBorder)
+ {
+ case FRAMEBORDER_NONE:
+ aPos = mpFrameSel->GetPosPixel();
+ break;
+ default:
+ const Rectangle aSpot = mpFrameSel->GetClickBoundRect( meBorder );
+ aPos = aSpot.TopLeft();
+ }
+ aPos = mpFrameSel->OutputToAbsoluteScreenPixel( aPos );
+ AwtPoint aRet(aPos.X(), aPos.Y());
+ return aRet;
+}
+
+// ----------------------------------------------------------------------------
+
+AwtSize AccFrameSelector::getSize( ) throw (RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IsValid();
+ Size aSz;
+ switch(meBorder)
+ {
+ case FRAMEBORDER_NONE:
+ aSz = mpFrameSel->GetSizePixel();
+ break;
+ default:
+ const Rectangle aSpot = mpFrameSel->GetClickBoundRect( meBorder );
+ aSz = aSpot.GetSize();
+ }
+ AwtSize aRet(aSz.Width(), aSz.Height());
+ return aRet;
+}
+
+// ----------------------------------------------------------------------------
+
+sal_Bool AccFrameSelector::isShowing( ) throw (RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IsValid();
+ return sal_True;
+}
+
+// ----------------------------------------------------------------------------
+
+sal_Bool AccFrameSelector::isVisible( ) throw (RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IsValid();
+ return sal_True;
+}
+
+// ----------------------------------------------------------------------------
+
+sal_Bool AccFrameSelector::isFocusTraversable( ) throw (RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IsValid();
+ return sal_True;
+}
+
+// ----------------------------------------------------------------------------
+
+void AccFrameSelector::addFocusListener( const Reference< XFocusListener >& xListener ) throw (RuntimeException)
+{
+ maFocusListeners.addInterface( xListener );
+}
+
+// ----------------------------------------------------------------------------
+
+void AccFrameSelector::removeFocusListener( const Reference< XFocusListener >& xListener ) throw (RuntimeException)
+{
+ maFocusListeners.removeInterface( xListener );
+}
+
+// ----------------------------------------------------------------------------
+
+void AccFrameSelector::grabFocus( ) throw (RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IsValid();
+ mpFrameSel->GrabFocus();
+}
+
+// ----------------------------------------------------------------------------
+
+Any AccFrameSelector::getAccessibleKeyBinding( ) throw (RuntimeException)
+{
+ Any aRet;
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IsValid();
+ utl::AccessibleRelationSetHelper* pHelper;
+ Reference< XAccessibleRelationSet > xRet = pHelper = new utl::AccessibleRelationSetHelper;
+ if(meBorder == FRAMEBORDER_NONE)
+ {
+ Window* pPrev = mpFrameSel->GetWindow( WINDOW_PREV );
+ if(pPrev && WINDOW_FIXEDTEXT == pPrev->GetType())
+ {
+ String sText = pPrev->GetText();
+ xub_StrLen nFound = sText.Search( MNEMONIC_CHAR );
+ if(STRING_NOTFOUND != nFound && ++nFound < sText.Len())
+ {
+ sText.ToUpperAscii();
+ sal_Unicode cChar = sText.GetChar(nFound);
+ AwtKeyEvent aEvent;
+
+ aEvent.KeyCode = 0;
+ aEvent.KeyChar = cChar;
+ aEvent.KeyFunc = 0;
+ if(cChar >= 'A' && cChar <= 'Z')
+ {
+ aEvent.KeyCode = AwtKey::A + cChar - 'A';
+ }
+ aEvent.Modifiers = AwtKeyModifier::MOD2;
+ aRet <<= aEvent;
+ }
+ }
+ }
+ return aRet;
+}
+
+// ----------------------------------------------------------------------------
+
+sal_Int32 AccFrameSelector::getForeground( )
+ throw (RuntimeException)
+{
+ Any aRet;
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IsValid();
+ return mpFrameSel->GetControlForeground().GetColor();
+}
+
+// ----------------------------------------------------------------------------
+
+sal_Int32 AccFrameSelector::getBackground( )
+ throw (RuntimeException)
+{
+ Any aRet;
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ IsValid();
+ return mpFrameSel->GetControlBackground().GetColor();
+}
+
+// ----------------------------------------------------------------------------
+
+void AccFrameSelector::addEventListener( const Reference< XAccessibleEventListener >& xListener ) throw (RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ if ( xListener.is() )
+ {
+ if ( !mnClientId )
+ {
+ mnClientId = ::comphelper::AccessibleEventNotifier::registerClient();
+ }
+ ::comphelper::AccessibleEventNotifier::addEventListener( mnClientId, xListener );
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+void AccFrameSelector::removeEventListener( const Reference< XAccessibleEventListener >& xListener ) throw (RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ if ( xListener.is() && mnClientId != 0 &&
+ ::comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener ) == 0 )
+ {
+ // no listeners anymore
+ // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
+ // and at least to us not firing any events anymore, in case somebody calls
+ // NotifyAccessibleEvent, again
+ ::comphelper::AccessibleEventNotifier::TClientId nId( mnClientId );
+ mnClientId = 0;
+ ::comphelper::AccessibleEventNotifier::revokeClient( nId );
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+OUString AccFrameSelector::getImplementationName( ) throw (RuntimeException)
+{
+ return OUString::createFromAscii("AccFrameSelector");
+}
+
+// ----------------------------------------------------------------------------
+
+const sal_Char sAccessible[] = "Accessible";
+const sal_Char sAccessibleContext[] = "AccessibleContext";
+const sal_Char sAccessibleComponent[] = "AccessibleComponent";
+
+sal_Bool AccFrameSelector::supportsService( const OUString& rServiceName )
+ throw (RuntimeException)
+{
+ return rServiceName.equalsAsciiL( sAccessible , sizeof(sAccessible )-1 ) ||
+ rServiceName.equalsAsciiL( sAccessibleContext , sizeof(sAccessibleContext )-1 ) ||
+ rServiceName.equalsAsciiL( sAccessibleComponent, sizeof(sAccessibleComponent)-1 );
+}
+
+// ----------------------------------------------------------------------------
+
+Sequence< OUString > AccFrameSelector::getSupportedServiceNames( )
+ throw (RuntimeException)
+{
+ Sequence< OUString > aRet(3);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessible ) );
+ pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleContext ) );
+ pArray[2] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleComponent) );
+ return aRet;
+}
+
+// ----------------------------------------------------------------------------
+
+void AccFrameSelector::IsValid() throw (RuntimeException)
+{
+ if(!mpFrameSel)
+ throw RuntimeException();
+}
+
+// ----------------------------------------------------------------------------
+
+void AccFrameSelector::NotifyFocusListeners(sal_Bool bGetFocus)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ AwtFocusEvent aEvent;
+ aEvent.FocusFlags = 0;
+ if(bGetFocus)
+ {
+ sal_uInt16 nFocusFlags = mpFrameSel->GetGetFocusFlags();
+ if(nFocusFlags&GETFOCUS_TAB)
+ aEvent.FocusFlags |= AwtFocusChangeReason::TAB;
+ if(nFocusFlags&GETFOCUS_CURSOR)
+ aEvent.FocusFlags |= AwtFocusChangeReason::CURSOR;
+ if(nFocusFlags&GETFOCUS_MNEMONIC)
+ aEvent.FocusFlags |= AwtFocusChangeReason::MNEMONIC;
+ if(nFocusFlags&GETFOCUS_FORWARD)
+ aEvent.FocusFlags |= AwtFocusChangeReason::FORWARD;
+ if(nFocusFlags&GETFOCUS_BACKWARD)
+ aEvent.FocusFlags |= AwtFocusChangeReason::BACKWARD;
+ if(nFocusFlags&GETFOCUS_AROUND)
+ aEvent.FocusFlags |= AwtFocusChangeReason::AROUND;
+ if(nFocusFlags&GETFOCUS_UNIQUEMNEMONIC)
+ aEvent.FocusFlags |= AwtFocusChangeReason::UNIQUEMNEMONIC;
+ // if(nFocusFlags&GETFOCUS_INIT)
+ // aEvent.FocusFlags |= AwtFocusChangeReason::
+ }
+// else
+ //how can I find the current focus window?
+// aEvent.NextFocus = ;
+ aEvent.Temporary = sal_False;
+
+ Reference < XAccessibleContext > xThis( this );
+ aEvent.Source = xThis;
+
+ ::cppu::OInterfaceIteratorHelper aIter( maFocusListeners );
+ while( aIter.hasMoreElements() )
+ {
+ Reference < XFocusListener > xListener( aIter.next(), UNO_QUERY );
+ if(bGetFocus)
+ xListener->focusGained( aEvent );
+ else
+ xListener->focusLost( aEvent );
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+IMPL_LINK( AccFrameSelector, WindowEventListener, VclSimpleEvent*, pEvent )
+{
+ VclWindowEvent* pWinEvent = dynamic_cast< VclWindowEvent* >( pEvent );
+ DBG_ASSERT( pWinEvent, "AccFrameSelector::WindowEventListener - unknown window event" );
+ if ( pWinEvent )
+ {
+ Window* pWindow = pWinEvent->GetWindow();
+ DBG_ASSERT( pWindow, "AccFrameSelector::WindowEventListener: no window!" );
+ if ( !pWindow->IsAccessibilityEventsSuppressed() || ( pWinEvent->GetId() == VCLEVENT_OBJECT_DYING ) )
+ {
+ ProcessWindowEvent( *pWinEvent );
+ }
+ }
+
+ return 0;
+}
+
+// ----------------------------------------------------------------------------
+
+void AccFrameSelector::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_WINDOW_GETFOCUS:
+ {
+ if ( meBorder == FRAMEBORDER_NONE )
+ {
+ Any aOldValue, aNewValue;
+ aNewValue <<= AccessibleStateType::FOCUSED;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_LOSEFOCUS:
+ {
+ if ( meBorder == FRAMEBORDER_NONE )
+ {
+ Any aOldValue, aNewValue;
+ aOldValue <<= AccessibleStateType::FOCUSED;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+ }
+ break;
+ default:
+ {
+ }
+ break;
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+void AccFrameSelector::NotifyAccessibleEvent( const sal_Int16 _nEventId,
+ const Any& _rOldValue, const Any& _rNewValue )
+{
+ if ( mnClientId )
+ {
+ Reference< XInterface > xSource( *this );
+ AccessibleEventObject aEvent( xSource, _nEventId, _rNewValue, _rOldValue );
+ ::comphelper::AccessibleEventNotifier::addEvent( mnClientId, aEvent );
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+void AccFrameSelector::Invalidate()
+{
+ mpFrameSel = 0;
+ EventObject aEvent;
+ Reference < XAccessibleContext > xThis( this );
+ aEvent.Source = xThis;
+ maFocusListeners.disposeAndClear( aEvent );
+ maPropertyListeners.disposeAndClear( aEvent );
+}
+
+// ============================================================================
+
+} // namespace a11y
+} // namespace svx
+
diff --git a/svx/source/accessibility/AccessibleGraphicShape.cxx b/svx/source/accessibility/AccessibleGraphicShape.cxx
new file mode 100644
index 000000000000..f4e7f7747dda
--- /dev/null
+++ b/svx/source/accessibility/AccessibleGraphicShape.cxx
@@ -0,0 +1,212 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+
+#include <svx/AccessibleGraphicShape.hxx>
+
+#include <svx/ShapeTypeHandler.hxx>
+#include <svx/SvxShapeTypes.hxx>
+
+using namespace ::accessibility;
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+//===== internal ============================================================
+
+AccessibleGraphicShape::AccessibleGraphicShape (
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo)
+ : AccessibleShape (rShapeInfo, rShapeTreeInfo)
+{
+}
+
+
+
+
+AccessibleGraphicShape::~AccessibleGraphicShape (void)
+{
+}
+
+
+
+
+//===== XAccessibleImage ====================================================
+
+::rtl::OUString SAL_CALL AccessibleGraphicShape::getAccessibleImageDescription (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return AccessibleShape::getAccessibleDescription ();
+}
+
+
+
+
+sal_Int32 SAL_CALL AccessibleGraphicShape::getAccessibleImageHeight (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return AccessibleShape::getSize().Height;
+}
+
+
+
+
+sal_Int32 SAL_CALL AccessibleGraphicShape::getAccessibleImageWidth (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return AccessibleShape::getSize().Width;
+}
+
+
+
+
+//===== XInterface ==========================================================
+
+com::sun::star::uno::Any SAL_CALL
+ AccessibleGraphicShape::queryInterface (const com::sun::star::uno::Type & rType)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aReturn = AccessibleShape::queryInterface (rType);
+ if ( ! aReturn.hasValue())
+ aReturn = ::cppu::queryInterface (rType,
+ static_cast<XAccessibleImage*>(this));
+ return aReturn;
+}
+
+
+
+void SAL_CALL
+ AccessibleGraphicShape::acquire (void)
+ throw ()
+{
+ AccessibleShape::acquire ();
+}
+
+
+
+void SAL_CALL
+ AccessibleGraphicShape::release (void)
+ throw ()
+{
+ AccessibleShape::release ();
+}
+
+
+
+
+//===== XServiceInfo ========================================================
+
+::rtl::OUString SAL_CALL
+ AccessibleGraphicShape::getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("AccessibleGraphicShape"));
+}
+
+
+
+
+::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ AccessibleGraphicShape::getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ // Get list of supported service names from base class...
+ uno::Sequence<OUString> aServiceNames =
+ AccessibleShape::getSupportedServiceNames();
+ sal_Int32 nCount (aServiceNames.getLength());
+
+ // ...and add additional names.
+ aServiceNames.realloc (nCount + 1);
+ static const OUString sAdditionalServiceName (RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.drawing.AccessibleGraphicShape"));
+ aServiceNames[nCount] = sAdditionalServiceName;
+
+ return aServiceNames;
+}
+
+
+
+
+//===== XTypeProvider ===================================================
+
+uno::Sequence<uno::Type> SAL_CALL
+ AccessibleGraphicShape::getTypes (void)
+ throw (uno::RuntimeException)
+{
+ // Get list of types from the context base implementation...
+ uno::Sequence<uno::Type> aTypeList (AccessibleShape::getTypes());
+ // ...and add the additional type for the component.
+ long nTypeCount = aTypeList.getLength();
+ aTypeList.realloc (nTypeCount + 1);
+ const uno::Type aImageType =
+ ::getCppuType((const uno::Reference<XAccessibleImage>*)0);
+ aTypeList[nTypeCount] = aImageType;
+
+ return aTypeList;
+}
+
+
+
+
+/// Create the base name of this object, i.e. the name without appended number.
+::rtl::OUString
+ AccessibleGraphicShape::CreateAccessibleBaseName (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ::rtl::OUString sName;
+
+ ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
+ switch (nShapeType)
+ {
+ case DRAWING_GRAPHIC_OBJECT:
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("GraphicObjectShape"));
+ break;
+
+ default:
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("UnknownAccessibleGraphicShape"));
+ uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
+ if (xDescriptor.is())
+ sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": "))
+ + xDescriptor->getShapeType();
+ }
+
+ return sName;
+}
+
+
+
+::rtl::OUString
+ AccessibleGraphicShape::CreateAccessibleDescription (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return CreateAccessibleName ();
+}
diff --git a/svx/source/accessibility/AccessibleOLEShape.cxx b/svx/source/accessibility/AccessibleOLEShape.cxx
new file mode 100644
index 000000000000..8f7effb4d2b8
--- /dev/null
+++ b/svx/source/accessibility/AccessibleOLEShape.cxx
@@ -0,0 +1,232 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+
+#include <svx/AccessibleOLEShape.hxx>
+
+#include <svx/ShapeTypeHandler.hxx>
+#include <svx/SvxShapeTypes.hxx>
+
+using namespace accessibility;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::accessibility;
+
+//===== internal ============================================================
+
+AccessibleOLEShape::AccessibleOLEShape (
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo)
+ : AccessibleShape (rShapeInfo, rShapeTreeInfo)
+{
+}
+
+
+
+
+AccessibleOLEShape::~AccessibleOLEShape (void)
+{
+}
+
+
+
+
+//===== XAccessibleAction ===================================================
+
+sal_Int32 SAL_CALL AccessibleOLEShape::getAccessibleActionCount (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return 0;
+}
+
+
+
+
+sal_Bool SAL_CALL AccessibleOLEShape::doAccessibleAction (sal_Int32 /*nIndex*/)
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ throw lang::IndexOutOfBoundsException();
+}
+
+
+
+
+::rtl::OUString SAL_CALL AccessibleOLEShape::getAccessibleActionDescription (sal_Int32 /*nIndex*/)
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ throw lang::IndexOutOfBoundsException();
+}
+
+
+
+
+Reference<XAccessibleKeyBinding> SAL_CALL AccessibleOLEShape::getAccessibleActionKeyBinding (sal_Int32 /*nIndex*/)
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ throw lang::IndexOutOfBoundsException();
+}
+
+
+
+
+//===== XInterface ==========================================================
+
+com::sun::star::uno::Any SAL_CALL
+ AccessibleOLEShape::queryInterface (const com::sun::star::uno::Type & rType)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aReturn = AccessibleShape::queryInterface (rType);
+ if ( ! aReturn.hasValue())
+ aReturn = ::cppu::queryInterface (rType,
+ static_cast<XAccessibleAction*>(this));
+ return aReturn;
+}
+
+
+
+void SAL_CALL
+ AccessibleOLEShape::acquire (void)
+ throw ()
+{
+ AccessibleShape::acquire ();
+}
+
+
+
+void SAL_CALL
+ AccessibleOLEShape::release (void)
+ throw ()
+{
+ AccessibleShape::release ();
+}
+
+
+
+
+//===== XServiceInfo ========================================================
+
+::rtl::OUString SAL_CALL
+ AccessibleOLEShape::getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleOLEShape"));
+}
+
+
+
+
+::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ AccessibleOLEShape::getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed();
+ // Get list of supported service names from base class...
+ uno::Sequence< ::rtl::OUString > aServiceNames =
+ AccessibleShape::getSupportedServiceNames();
+ sal_Int32 nCount (aServiceNames.getLength());
+
+ // ...and add additional names.
+ aServiceNames.realloc (nCount + 1);
+ static const ::rtl::OUString sAdditionalServiceName (RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.drawing.AccessibleOLEShape"));
+ aServiceNames[nCount] = sAdditionalServiceName;
+
+ return aServiceNames;
+}
+
+
+
+
+//===== XTypeProvider ===================================================
+
+uno::Sequence<uno::Type> SAL_CALL
+ AccessibleOLEShape::getTypes (void)
+ throw (uno::RuntimeException)
+{
+ // Get list of types from the context base implementation...
+ uno::Sequence<uno::Type> aTypeList (AccessibleShape::getTypes());
+ // ...and add the additional type for the component.
+ long nTypeCount = aTypeList.getLength();
+ aTypeList.realloc (nTypeCount + 1);
+ const uno::Type aActionType =
+ ::getCppuType((const uno::Reference<XAccessibleAction>*)0);
+ aTypeList[nTypeCount] = aActionType;
+
+ return aTypeList;
+}
+
+
+
+
+/// Set this object's name if is different to the current name.
+::rtl::OUString
+ AccessibleOLEShape::CreateAccessibleBaseName (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ::rtl::OUString sName;
+
+ ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
+ switch (nShapeType)
+ {
+ case DRAWING_APPLET:
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("AppletOLEShape"));
+ break;
+ case DRAWING_FRAME:
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("FrameOLEShape"));
+ break;
+ case DRAWING_OLE:
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("OLEShape"));
+ break;
+ case DRAWING_PLUGIN:
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("PluginOLEShape"));
+ break;
+
+ default:
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("UnknownAccessibleOLEShape"));
+ uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
+ if (xDescriptor.is())
+ sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": "))
+ + xDescriptor->getShapeType();
+ }
+
+ return sName;
+}
+
+
+
+::rtl::OUString
+ AccessibleOLEShape::CreateAccessibleDescription (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return CreateAccessibleName ();
+}
+
diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx
new file mode 100755
index 000000000000..0d255ed5933f
--- /dev/null
+++ b/svx/source/accessibility/AccessibleShape.cxx
@@ -0,0 +1,1244 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/AccessibleShape.hxx>
+#include "svx/DescriptionGenerator.hxx"
+#include <svx/AccessibleShapeInfo.hxx>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <rtl/uuid.h>
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLE_ROLE_HPP_
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLE_STATE_TYPE_HPP_
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#endif
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/drawing/XShapeDescriptor.hpp>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <editeng/outlobj.hxx>
+#include <rtl/ref.hxx>
+#include <editeng/unoedsrc.hxx>
+#include <svx/unoshtxt.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdmodel.hxx>
+#include "svx/unoapi.hxx"
+#include <com/sun/star/uno/Exception.hpp>
+#include <svx/ShapeTypeHandler.hxx>
+#include <svx/SvxShapeTypes.hxx>
+
+#ifndef _SVX_ACCESSIBILITY_HRC
+#include "accessibility.hrc"
+#endif
+#include "svx/svdstr.hrc"
+#include <svx/dialmgr.hxx>
+#include <vcl/svapp.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <svx/svdview.hxx>
+#include "AccessibleEmptyEditSource.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using ::com::sun::star::uno::Reference;
+using ::rtl::OUString;
+
+namespace accessibility {
+
+namespace {
+
+OUString GetOptionalProperty (
+ const Reference<beans::XPropertySet>& rxSet,
+ const OUString& rsPropertyName)
+{
+ OUString sValue;
+
+ if (rxSet.is())
+ {
+ const Reference<beans::XPropertySetInfo> xInfo (rxSet->getPropertySetInfo());
+ if ( ! xInfo.is() || xInfo->hasPropertyByName(rsPropertyName))
+ {
+ try
+ {
+ rxSet->getPropertyValue(rsPropertyName) >>= sValue;
+ }
+ catch (beans::UnknownPropertyException&)
+ {
+ // This exception should only be thrown when the property
+ // does not exits (of course) and the XPropertySetInfo is
+ // not available.
+ }
+ }
+ }
+ return sValue;
+}
+
+} // end of anonymous namespace
+
+
+
+
+//===== internal ============================================================
+
+AccessibleShape::AccessibleShape (
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo)
+ : AccessibleContextBase (rShapeInfo.mxParent,AccessibleRole::LIST_ITEM),
+ mpChildrenManager(NULL),
+ mxShape (rShapeInfo.mxShape),
+ maShapeTreeInfo (rShapeTreeInfo),
+ mnIndex (rShapeInfo.mnIndex),
+ m_nIndexInParent(-1),
+ mpText (NULL),
+ mpParent (rShapeInfo.mpChildrenManager)
+{
+ m_pShape = GetSdrObjectFromXShape(mxShape);
+ UpdateNameAndDescription();
+}
+
+
+
+
+AccessibleShape::~AccessibleShape (void)
+{
+ if (mpChildrenManager != NULL)
+ delete mpChildrenManager;
+ if (mpText != NULL)
+ delete mpText;
+ OSL_TRACE ("~AccessibleShape");
+
+ // Unregistering from the various broadcasters should be unnecessary
+ // since this destructor would not have been called if one of the
+ // broadcasters would still hold a strong reference to this object.
+}
+
+
+
+
+void AccessibleShape::Init (void)
+{
+ // Update the OPAQUE and SELECTED shape.
+ UpdateStates ();
+
+ // Create a children manager when this shape has children of its own.
+ Reference<drawing::XShapes> xShapes (mxShape, uno::UNO_QUERY);
+ if (xShapes.is() && xShapes->getCount() > 0)
+ mpChildrenManager = new ChildrenManager (
+ this, xShapes, maShapeTreeInfo, *this);
+ if (mpChildrenManager != NULL)
+ mpChildrenManager->Update();
+
+ // Register at model as document::XEventListener.
+ if (maShapeTreeInfo.GetModelBroadcaster().is())
+ maShapeTreeInfo.GetModelBroadcaster()->addEventListener (
+ static_cast<document::XEventListener*>(this));
+
+ // Beware! Here we leave the paths of the UNO API and descend into the
+ // depths of the core. Necessary for makeing the edit engine
+ // accessible.
+ Reference<text::XText> xText (mxShape, uno::UNO_QUERY);
+ if (xText.is())
+ {
+ SdrView* pView = maShapeTreeInfo.GetSdrView ();
+ const Window* pWindow = maShapeTreeInfo.GetWindow ();
+ if (pView != NULL && pWindow != NULL && mxShape.is())
+ {
+ // #107948# Determine whether shape text is empty
+ SdrObject* pSdrObject = GetSdrObjectFromXShape(mxShape);
+ if( pSdrObject )
+ {
+ SdrTextObj* pTextObj = PTR_CAST( SdrTextObj, pSdrObject );
+ OutlinerParaObject* pOutlinerParaObject = NULL;
+
+ if( pTextObj )
+ pOutlinerParaObject = pTextObj->GetEditOutlinerParaObject(); // Get the OutlinerParaObject if text edit is active
+
+ bool bOwnParaObj = pOutlinerParaObject != NULL;
+
+ if( !pOutlinerParaObject && pSdrObject )
+ pOutlinerParaObject = pSdrObject->GetOutlinerParaObject();
+
+ // create AccessibleTextHelper to handle this shape's text
+ if( !pOutlinerParaObject )
+ {
+ // empty text -> use proxy edit source to delay creation of EditEngine
+ ::std::auto_ptr<SvxEditSource> pEditSource( new AccessibleEmptyEditSource ( *pSdrObject, *pView, *pWindow) );
+ mpText = new AccessibleTextHelper( pEditSource );
+ }
+ else
+ {
+ // non-empty text -> use full-fledged edit source right away
+ ::std::auto_ptr<SvxEditSource> pEditSource( new SvxTextEditSource ( *pSdrObject, 0, *pView, *pWindow) );
+ mpText = new AccessibleTextHelper( pEditSource );
+ }
+
+ if( bOwnParaObj )
+ delete pOutlinerParaObject;
+
+ mpText->SetEventSource(this);
+ }
+ }
+ }
+}
+
+
+
+
+void AccessibleShape::UpdateStates (void)
+{
+ ::utl::AccessibleStateSetHelper* pStateSet =
+ static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
+ if (pStateSet == NULL)
+ return;
+
+ // Set the opaque state for certain shape types when their fill style is
+ // solid.
+ bool bShapeIsOpaque = false;
+ switch (ShapeTypeHandler::Instance().GetTypeId (mxShape))
+ {
+ case DRAWING_PAGE:
+ case DRAWING_RECTANGLE:
+ case DRAWING_TEXT:
+ {
+ uno::Reference<beans::XPropertySet> xSet (mxShape, uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ try
+ {
+ drawing::FillStyle aFillStyle;
+ bShapeIsOpaque = ( xSet->getPropertyValue (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillStyle"))) >>= aFillStyle)
+ && aFillStyle == drawing::FillStyle_SOLID;
+ }
+ catch (::com::sun::star::beans::UnknownPropertyException&)
+ {
+ // Ignore.
+ }
+ }
+ }
+ }
+ if (bShapeIsOpaque)
+ pStateSet->AddState (AccessibleStateType::OPAQUE);
+ else
+ pStateSet->RemoveState (AccessibleStateType::OPAQUE);
+
+ // Set the selected state.
+ bool bShapeIsSelected = false;
+ // XXX fix_me this has to be done with an extra interface later on
+ if ( m_pShape && maShapeTreeInfo.GetSdrView() )
+ {
+ bShapeIsSelected = maShapeTreeInfo.GetSdrView()->IsObjMarked(m_pShape) == sal_True;
+ }
+
+ if (bShapeIsSelected)
+ pStateSet->AddState (AccessibleStateType::SELECTED);
+ else
+ pStateSet->RemoveState (AccessibleStateType::SELECTED);
+}
+
+
+
+
+bool AccessibleShape::operator== (const AccessibleShape& rShape)
+{
+ return this==&rShape;
+}
+
+
+
+
+sal_Bool AccessibleShape::SetState (sal_Int16 aState)
+{
+ sal_Bool bStateHasChanged = sal_False;
+
+ if (aState == AccessibleStateType::FOCUSED && mpText != NULL)
+ {
+ // Offer FOCUSED state to edit engine and detect whether the state
+ // changes.
+ sal_Bool bIsFocused = mpText->HaveFocus ();
+ mpText->SetFocus (sal_True);
+ bStateHasChanged = (bIsFocused != mpText->HaveFocus ());
+ }
+ else
+ bStateHasChanged = AccessibleContextBase::SetState (aState);
+
+ return bStateHasChanged;
+}
+
+
+
+
+sal_Bool AccessibleShape::ResetState (sal_Int16 aState)
+{
+ sal_Bool bStateHasChanged = sal_False;
+
+ if (aState == AccessibleStateType::FOCUSED && mpText != NULL)
+ {
+ // Try to remove FOCUSED state from the edit engine and detect
+ // whether the state changes.
+ sal_Bool bIsFocused = mpText->HaveFocus ();
+ mpText->SetFocus (sal_False);
+ bStateHasChanged = (bIsFocused != mpText->HaveFocus ());
+ }
+ else
+ bStateHasChanged = AccessibleContextBase::ResetState (aState);
+
+ return bStateHasChanged;
+}
+
+
+
+
+sal_Bool AccessibleShape::GetState (sal_Int16 aState)
+{
+ if (aState == AccessibleStateType::FOCUSED && mpText != NULL)
+ {
+ // Just delegate the call to the edit engine. The state is not
+ // merged into the state set.
+ return mpText->HaveFocus();
+ }
+ else
+ return AccessibleContextBase::GetState (aState);
+}
+
+
+
+
+//===== XAccessibleContext ==================================================
+
+/** The children of this shape come from two sources: The children from
+ group or scene shapes and the paragraphs of text.
+*/
+sal_Int32 SAL_CALL
+ AccessibleShape::getAccessibleChildCount ()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ sal_Int32 nChildCount = 0;
+
+ // Add the number of shapes that are children of this shape.
+ if (mpChildrenManager != NULL)
+ nChildCount += mpChildrenManager->GetChildCount ();
+ // Add the number text paragraphs.
+ if (mpText != NULL)
+ nChildCount += mpText->GetChildCount ();
+
+ return nChildCount;
+}
+
+
+
+
+/** Forward the request to the shape. Return the requested shape or throw
+ an exception for a wrong index.
+*/
+uno::Reference<XAccessible> SAL_CALL
+ AccessibleShape::getAccessibleChild (sal_Int32 nIndex)
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+
+ uno::Reference<XAccessible> xChild;
+
+ // Depending on the index decide whether to delegate this call to the
+ // children manager or the edit engine.
+ if ((mpChildrenManager != NULL)
+ && (nIndex < mpChildrenManager->GetChildCount()))
+ {
+ xChild = mpChildrenManager->GetChild (nIndex);
+ }
+ else if (mpText != NULL)
+ {
+ sal_Int32 nI = nIndex;
+ if (mpChildrenManager != NULL)
+ nI -= mpChildrenManager->GetChildCount();
+ xChild = mpText->GetChild (nI);
+ }
+ else
+ throw lang::IndexOutOfBoundsException (
+ ::rtl::OUString::createFromAscii ("shape has no child with index ")
+ + rtl::OUString::valueOf(nIndex),
+ static_cast<uno::XWeak*>(this));
+
+ return xChild;
+}
+
+
+
+
+/** Return a copy of the state set.
+ Possible states are:
+ ENABLED
+ SHOWING
+ VISIBLE
+*/
+uno::Reference<XAccessibleStateSet> SAL_CALL
+ AccessibleShape::getAccessibleStateSet (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ Reference<XAccessibleStateSet> xStateSet;
+
+ if (rBHelper.bDisposed || mpText == NULL)
+ // Return a minimal state set that only contains the DEFUNC state.
+ xStateSet = AccessibleContextBase::getAccessibleStateSet ();
+ else
+ {
+ ::utl::AccessibleStateSetHelper* pStateSet =
+ static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
+
+ if (pStateSet != NULL)
+ {
+ // Merge current FOCUSED state from edit engine.
+ if (mpText != NULL)
+ {
+ if (mpText->HaveFocus())
+ pStateSet->AddState (AccessibleStateType::FOCUSED);
+ else
+ pStateSet->RemoveState (AccessibleStateType::FOCUSED);
+ }
+
+ // Create a copy of the state set that may be modified by the
+ // caller without affecting the current state set.
+ xStateSet = Reference<XAccessibleStateSet>(
+ new ::utl::AccessibleStateSetHelper (*pStateSet));
+ }
+ }
+
+ return xStateSet;
+}
+
+
+
+
+//===== XAccessibleComponent ================================================
+
+/** The implementation below is at the moment straightforward. It iterates
+ over all children (and thereby instances all children which have not
+ been already instatiated) until a child covering the specifed point is
+ found.
+ This leaves room for improvement. For instance, first iterate only over
+ the already instantiated children and only if no match is found
+ instantiate the remaining ones.
+*/
+uno::Reference<XAccessible > SAL_CALL
+ AccessibleShape::getAccessibleAtPoint (
+ const awt::Point& aPoint)
+ throw (uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ sal_Int32 nChildCount = getAccessibleChildCount ();
+ for (sal_Int32 i=0; i<nChildCount; ++i)
+ {
+ Reference<XAccessible> xChild (getAccessibleChild (i));
+ if (xChild.is())
+ {
+ Reference<XAccessibleComponent> xChildComponent (
+ xChild->getAccessibleContext(), uno::UNO_QUERY);
+ if (xChildComponent.is())
+ {
+ awt::Rectangle aBBox (xChildComponent->getBounds());
+ if ( (aPoint.X >= aBBox.X)
+ && (aPoint.Y >= aBBox.Y)
+ && (aPoint.X < aBBox.X+aBBox.Width)
+ && (aPoint.Y < aBBox.Y+aBBox.Height) )
+ return xChild;
+ }
+ }
+ }
+
+ // Have not found a child under the given point. Returning empty
+ // reference to indicate this.
+ return uno::Reference<XAccessible>();
+}
+
+
+
+
+awt::Rectangle SAL_CALL AccessibleShape::getBounds (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ ::osl::MutexGuard aGuard (maMutex);
+
+ ThrowIfDisposed ();
+ awt::Rectangle aBoundingBox;
+ if ( mxShape.is() )
+ {
+
+ static const OUString sBoundRectName (
+ RTL_CONSTASCII_USTRINGPARAM("BoundRect"));
+ static const OUString sAnchorPositionName (
+ RTL_CONSTASCII_USTRINGPARAM("AnchorPosition"));
+
+ // Get the shape's bounding box in internal coordinates (in 100th of
+ // mm). Use the property BoundRect. Only if that is not supported ask
+ // the shape for its position and size directly.
+ Reference<beans::XPropertySet> xSet (mxShape, uno::UNO_QUERY);
+ Reference<beans::XPropertySetInfo> xSetInfo;
+ bool bFoundBoundRect = false;
+ if (xSet.is())
+ {
+ xSetInfo = xSet->getPropertySetInfo ();
+ if (xSetInfo.is())
+ {
+ if (xSetInfo->hasPropertyByName (sBoundRectName))
+ {
+ try
+ {
+ uno::Any aValue = xSet->getPropertyValue (sBoundRectName);
+ aValue >>= aBoundingBox;
+ bFoundBoundRect = true;
+ }
+ catch (beans::UnknownPropertyException e)
+ {
+ // Handled below (bFoundBoundRect stays false).
+ }
+ }
+ else
+ OSL_TRACE (" no property BoundRect");
+ }
+ }
+
+ // Fallback when there is no BoundRect Property.
+ if ( ! bFoundBoundRect )
+ {
+ awt::Point aPosition (mxShape->getPosition());
+ awt::Size aSize (mxShape->getSize());
+ aBoundingBox = awt::Rectangle (
+ aPosition.X, aPosition.Y,
+ aSize.Width, aSize.Height);
+
+ // While BoundRects have absolute positions, the position returned
+ // by XPosition::getPosition is relative. Get the anchor position
+ // (usually not (0,0) for Writer shapes).
+ if (xSetInfo.is())
+ {
+ if (xSetInfo->hasPropertyByName (sAnchorPositionName))
+ {
+ uno::Any aPos = xSet->getPropertyValue (sAnchorPositionName);
+ awt::Point aAnchorPosition;
+ aPos >>= aAnchorPosition;
+ aBoundingBox.X += aAnchorPosition.X;
+ aBoundingBox.Y += aAnchorPosition.Y;
+ }
+ }
+ }
+
+ // Transform coordinates from internal to pixel.
+ if (maShapeTreeInfo.GetViewForwarder() == NULL)
+ throw uno::RuntimeException (::rtl::OUString (
+ RTL_CONSTASCII_USTRINGPARAM(
+ "AccessibleShape has no valid view forwarder")),
+ static_cast<uno::XWeak*>(this));
+ ::Size aPixelSize = maShapeTreeInfo.GetViewForwarder()->LogicToPixel (
+ ::Size (aBoundingBox.Width, aBoundingBox.Height));
+ ::Point aPixelPosition = maShapeTreeInfo.GetViewForwarder()->LogicToPixel (
+ ::Point (aBoundingBox.X, aBoundingBox.Y));
+
+ // Clip the shape's bounding box with the bounding box of its parent.
+ Reference<XAccessibleComponent> xParentComponent (
+ getAccessibleParent(), uno::UNO_QUERY);
+ if (xParentComponent.is())
+ {
+ // Make the coordinates relative to the parent.
+ awt::Point aParentLocation (xParentComponent->getLocationOnScreen());
+ int x = aPixelPosition.getX() - aParentLocation.X;
+ int y = aPixelPosition.getY() - aParentLocation.Y;
+
+ /* // The following block is a workarround for bug #99889# (property
+ // BoundRect returnes coordinates relative to document window
+ // instead of absolute coordinates for shapes in Writer). Has to
+ // be removed as soon as bug is fixed.
+
+ // Use a non-null anchor position as flag that the shape is in a
+ // Writer document.
+ if (xSetInfo.is())
+ if (xSetInfo->hasPropertyByName (sAnchorPositionName))
+ {
+ uno::Any aPos = xSet->getPropertyValue (sAnchorPositionName);
+ awt::Point aAnchorPosition;
+ aPos >>= aAnchorPosition;
+ if (aAnchorPosition.X > 0)
+ {
+ x = aPixelPosition.getX();
+ y = aPixelPosition.getY();
+ }
+ }
+ // End of workarround.
+ */
+ // Clip with parent (with coordinates relative to itself).
+ ::Rectangle aBBox (
+ x, y, x + aPixelSize.getWidth(), y + aPixelSize.getHeight());
+ awt::Size aParentSize (xParentComponent->getSize());
+ ::Rectangle aParentBBox (0,0, aParentSize.Width, aParentSize.Height);
+ aBBox = aBBox.GetIntersection (aParentBBox);
+ aBoundingBox = awt::Rectangle (
+ aBBox.getX(),
+ aBBox.getY(),
+ aBBox.getWidth(),
+ aBBox.getHeight());
+ }
+ else
+ {
+ OSL_TRACE ("parent does not support component");
+ aBoundingBox = awt::Rectangle (
+ aPixelPosition.getX(), aPixelPosition.getY(),
+ aPixelSize.getWidth(), aPixelSize.getHeight());
+ }
+ }
+
+ return aBoundingBox;
+}
+
+
+
+
+awt::Point SAL_CALL AccessibleShape::getLocation (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ awt::Rectangle aBoundingBox (getBounds());
+ return awt::Point (aBoundingBox.X, aBoundingBox.Y);
+}
+
+
+
+
+awt::Point SAL_CALL AccessibleShape::getLocationOnScreen (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+
+ // Get relative position...
+ awt::Point aLocation (getLocation ());
+
+ // ... and add absolute position of the parent.
+ uno::Reference<XAccessibleComponent> xParentComponent (
+ getAccessibleParent(), uno::UNO_QUERY);
+ if (xParentComponent.is())
+ {
+ awt::Point aParentLocation (xParentComponent->getLocationOnScreen());
+ aLocation.X += aParentLocation.X;
+ aLocation.Y += aParentLocation.Y;
+ }
+ else
+ OSL_TRACE ("getLocation: parent does not support XAccessibleComponent");
+ return aLocation;
+}
+
+
+
+
+awt::Size SAL_CALL AccessibleShape::getSize (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ awt::Rectangle aBoundingBox (getBounds());
+ return awt::Size (aBoundingBox.Width, aBoundingBox.Height);
+}
+
+
+
+
+sal_Int32 SAL_CALL AccessibleShape::getForeground (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ sal_Int32 nColor (0x0ffffffL);
+
+ try
+ {
+ uno::Reference<beans::XPropertySet> aSet (mxShape, uno::UNO_QUERY);
+ if (aSet.is())
+ {
+ uno::Any aColor;
+ aColor = aSet->getPropertyValue (OUString::createFromAscii ("LineColor"));
+ aColor >>= nColor;
+ }
+ }
+ catch (::com::sun::star::beans::UnknownPropertyException)
+ {
+ // Ignore exception and return default color.
+ }
+ return nColor;
+}
+
+
+
+
+sal_Int32 SAL_CALL AccessibleShape::getBackground (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ sal_Int32 nColor (0L);
+
+ try
+ {
+ uno::Reference<beans::XPropertySet> aSet (mxShape, uno::UNO_QUERY);
+ if (aSet.is())
+ {
+ uno::Any aColor;
+ aColor = aSet->getPropertyValue (OUString::createFromAscii ("FillColor"));
+ aColor >>= nColor;
+ }
+ }
+ catch (::com::sun::star::beans::UnknownPropertyException)
+ {
+ // Ignore exception and return default color.
+ }
+ return nColor;
+}
+
+
+
+
+//===== XAccessibleEventBroadcaster =========================================
+
+void SAL_CALL AccessibleShape::addEventListener (
+ const Reference<XAccessibleEventListener >& rxListener)
+ throw (uno::RuntimeException)
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ {
+ uno::Reference<uno::XInterface> xThis (
+ (lang::XComponent *)this, uno::UNO_QUERY);
+ rxListener->disposing (lang::EventObject (xThis));
+ }
+ else
+ {
+ AccessibleContextBase::addEventListener (rxListener);
+ if (mpText != NULL)
+ mpText->AddEventListener (rxListener);
+ }
+}
+
+
+
+
+void SAL_CALL AccessibleShape::removeEventListener (
+ const Reference<XAccessibleEventListener >& rxListener)
+ throw (uno::RuntimeException)
+{
+ AccessibleContextBase::removeEventListener (rxListener);
+ if (mpText != NULL)
+ mpText->RemoveEventListener (rxListener);
+}
+
+
+
+
+//===== XInterface ==========================================================
+
+com::sun::star::uno::Any SAL_CALL
+ AccessibleShape::queryInterface (const com::sun::star::uno::Type & rType)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aReturn = AccessibleContextBase::queryInterface (rType);
+ if ( ! aReturn.hasValue())
+ aReturn = ::cppu::queryInterface (rType,
+ static_cast<XAccessibleComponent*>(this),
+ static_cast<XAccessibleExtendedComponent*>(this),
+ static_cast<lang::XEventListener*>(this),
+ static_cast<document::XEventListener*>(this),
+ static_cast<lang::XUnoTunnel*>(this)
+ );
+ return aReturn;
+}
+
+
+
+
+void SAL_CALL
+ AccessibleShape::acquire (void)
+ throw ()
+{
+ AccessibleContextBase::acquire ();
+}
+
+
+
+
+void SAL_CALL
+ AccessibleShape::release (void)
+ throw ()
+{
+ AccessibleContextBase::release ();
+}
+
+
+
+
+//===== XServiceInfo ========================================================
+
+::rtl::OUString SAL_CALL
+ AccessibleShape::getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleShape"));
+}
+
+
+
+
+uno::Sequence<OUString> SAL_CALL
+ AccessibleShape::getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ // Get list of supported service names from base class...
+ uno::Sequence<OUString> aServiceNames =
+ AccessibleContextBase::getSupportedServiceNames();
+ sal_Int32 nCount (aServiceNames.getLength());
+
+ // ...and add additional names.
+ aServiceNames.realloc (nCount + 1);
+ static const OUString sAdditionalServiceName (RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.drawing.AccessibleShape"));
+ aServiceNames[nCount] = sAdditionalServiceName;
+
+ return aServiceNames;
+}
+
+
+
+
+
+//===== XTypeProvider ===================================================
+
+uno::Sequence<uno::Type> SAL_CALL
+ AccessibleShape::getTypes (void)
+ throw (uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ // Get list of types from the context base implementation, ...
+ uno::Sequence<uno::Type> aTypeList (AccessibleContextBase::getTypes());
+ // ... get list of types from component base implementation, ...
+ uno::Sequence<uno::Type> aComponentTypeList (AccessibleComponentBase::getTypes());
+ // ... define local types, ...
+ const uno::Type aLangEventListenerType =
+ ::getCppuType((const uno::Reference<lang::XEventListener>*)0);
+ const uno::Type aDocumentEventListenerType =
+ ::getCppuType((const uno::Reference<document::XEventListener>*)0);
+ const uno::Type aUnoTunnelType =
+ ::getCppuType((const uno::Reference<lang::XUnoTunnel>*)0);
+ // const uno::Type aStateSetType =
+ // ::getCppuType((const uno::Reference<XAccessibleStateSet>*)0);
+
+ // ... and merge them all into one list.
+ sal_Int32 nTypeCount (aTypeList.getLength()),
+ nComponentTypeCount (aComponentTypeList.getLength());
+ int i;
+
+ aTypeList.realloc (nTypeCount + nComponentTypeCount + 3);
+
+ for (i=0; i<nComponentTypeCount; i++)
+ aTypeList[nTypeCount + i] = aComponentTypeList[i];
+
+ aTypeList[nTypeCount + i++ ] = aLangEventListenerType;
+ aTypeList[nTypeCount + i++ ] = aDocumentEventListenerType;
+ aTypeList[nTypeCount + i ] = aUnoTunnelType;
+
+ return aTypeList;
+}
+
+
+
+
+//===== lang::XEventListener ================================================
+
+/** Disposing calls are accepted only from the model: Just reset the
+ reference to the model in the shape tree info. Otherwise this object
+ remains functional.
+*/
+void SAL_CALL
+ AccessibleShape::disposing (const lang::EventObject& aEvent)
+ throw (uno::RuntimeException)
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ ::osl::MutexGuard aGuard (maMutex);
+
+ try
+ {
+ if (aEvent.Source == maShapeTreeInfo.GetModelBroadcaster())
+ {
+ // Remove reference to model broadcaster to allow it to pass
+ // away.
+ maShapeTreeInfo.SetModelBroadcaster(NULL);
+ }
+
+ }
+ catch (uno::RuntimeException e)
+ {
+ OSL_TRACE ("caught exception while disposing");
+ }
+}
+
+
+
+
+//===== document::XEventListener ============================================
+
+void SAL_CALL
+ AccessibleShape::notifyEvent (const document::EventObject& rEventObject)
+ throw (uno::RuntimeException)
+{
+ static const OUString sShapeModified (
+ RTL_CONSTASCII_USTRINGPARAM("ShapeModified"));
+
+ // First check if the event is for us.
+ uno::Reference<drawing::XShape> xShape (
+ rEventObject.Source, uno::UNO_QUERY);
+ if ( xShape.get() == mxShape.get() )
+ {
+ if (rEventObject.EventName.equals (sShapeModified))
+ {
+ // Some property of a shape has been modified. Send an event
+ // that indicates a change of the visible data to all listeners.
+ CommitChange (
+ AccessibleEventId::VISIBLE_DATA_CHANGED,
+ uno::Any(),
+ uno::Any());
+
+ // Name and Description may have changed. Update the local
+ // values accordingly.
+ UpdateNameAndDescription();
+ }
+ }
+}
+
+
+
+
+//===== lang::XUnoTunnel ================================================
+
+const uno::Sequence< sal_Int8 >&
+ AccessibleShape::getUnoTunnelImplementationId()
+ throw()
+{
+ static uno::Sequence< sal_Int8 >* pSeq = 0;
+
+ if( !pSeq )
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+
+ if( !pSeq )
+ {
+ static uno::Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*) aSeq.getArray(), 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+
+ return( *pSeq );
+}
+
+//------------------------------------------------------------------------------
+AccessibleShape*
+ AccessibleShape::getImplementation( const uno::Reference< uno::XInterface >& rxIFace )
+ throw()
+{
+ uno::Reference< lang::XUnoTunnel > xTunnel( rxIFace, uno::UNO_QUERY );
+ AccessibleShape* pReturn = NULL;
+
+ if( xTunnel.is() )
+ pReturn = reinterpret_cast< AccessibleShape* >( xTunnel->getSomething( getUnoTunnelImplementationId() ) );
+
+ return( pReturn );
+}
+
+//------------------------------------------------------------------------------
+sal_Int64 SAL_CALL
+ AccessibleShape::getSomething( const uno::Sequence< sal_Int8 >& rIdentifier )
+ throw(uno::RuntimeException)
+{
+ sal_Int64 nReturn( 0 );
+
+ if( ( rIdentifier.getLength() == 16 ) && ( 0 == rtl_compareMemory( getUnoTunnelImplementationId().getConstArray(), rIdentifier.getConstArray(), 16 ) ) )
+ nReturn = reinterpret_cast< sal_Int64 >( this );
+
+ return( nReturn );
+}
+
+//===== IAccessibleViewForwarderListener ====================================
+
+void AccessibleShape::ViewForwarderChanged (ChangeType aChangeType,
+ const IAccessibleViewForwarder* pViewForwarder)
+{
+ // Inform all listeners that the graphical representation (i.e. size
+ // and/or position) of the shape has changed.
+ CommitChange (AccessibleEventId::VISIBLE_DATA_CHANGED,
+ uno::Any(),
+ uno::Any());
+
+ // Tell children manager of the modified view forwarder.
+ if (mpChildrenManager != NULL)
+ mpChildrenManager->ViewForwarderChanged (aChangeType, pViewForwarder);
+
+ // update our children that our screen position might have changed
+ if( mpText )
+ mpText->UpdateChildren();
+}
+
+
+
+
+//===== protected internal ==================================================
+/// Set this object's name if is different to the current name.
+::rtl::OUString
+ AccessibleShape::CreateAccessibleBaseName (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return ShapeTypeHandler::CreateAccessibleBaseName( mxShape );
+}
+
+
+::rtl::OUString
+ AccessibleShape::CreateAccessibleName (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ OUString sName (CreateAccessibleBaseName());
+
+ // Append the shape's index to the name to disambiguate between shapes
+ // of the same type. If such an index where not given to the
+ // constructor then use the z-order instead. If even that does not exist
+ // we throw an exception.
+ long nIndex = mnIndex;
+ if (nIndex == -1)
+ {
+ try
+ {
+ uno::Reference<beans::XPropertySet> xSet (mxShape, uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ uno::Any aZOrder (xSet->getPropertyValue (::rtl::OUString::createFromAscii ("ZOrder")));
+ aZOrder >>= nIndex;
+
+ // Add one to be not zero based.
+ nIndex += 1;
+ }
+ }
+ catch (beans::UnknownPropertyException)
+ {
+ // We throw our own exception that is a bit more informative.
+ throw uno::RuntimeException (::rtl::OUString (
+ RTL_CONSTASCII_USTRINGPARAM("AccessibleShape has invalid index and no ZOrder property")),
+ static_cast<uno::XWeak*>(this));
+ }
+
+ }
+
+ // Put a space between name and index because of Gnopernicus othewise
+ // spells the name.
+ sName += OUString (RTL_CONSTASCII_USTRINGPARAM(" ")) + OUString::valueOf (nIndex);
+
+ return sName;
+}
+
+
+
+
+::rtl::OUString
+ AccessibleShape::CreateAccessibleDescription (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ DescriptionGenerator aDG (mxShape);
+ aDG.Initialize (CreateAccessibleBaseName());
+ switch (ShapeTypeHandler::Instance().GetTypeId (mxShape))
+ {
+ case DRAWING_3D_CUBE:
+ case DRAWING_3D_EXTRUDE:
+ case DRAWING_3D_LATHE:
+ case DRAWING_3D_SPHERE:
+ aDG.Add3DProperties ();
+ break;
+
+ case DRAWING_3D_SCENE:
+ case DRAWING_GROUP:
+ case DRAWING_PAGE:
+ // No further information is appended.
+ break;
+
+ case DRAWING_CAPTION:
+ case DRAWING_CLOSED_BEZIER:
+ case DRAWING_CLOSED_FREEHAND:
+ case DRAWING_ELLIPSE:
+ case DRAWING_POLY_POLYGON:
+ case DRAWING_POLY_POLYGON_PATH:
+ case DRAWING_RECTANGLE:
+ aDG.AddLineProperties ();
+ aDG.AddFillProperties ();
+ break;
+
+ case DRAWING_CONNECTOR:
+ case DRAWING_LINE:
+ case DRAWING_MEASURE:
+ case DRAWING_OPEN_BEZIER:
+ case DRAWING_OPEN_FREEHAND:
+ case DRAWING_POLY_LINE:
+ case DRAWING_POLY_LINE_PATH:
+ aDG.AddLineProperties ();
+ break;
+
+ case DRAWING_CONTROL:
+ aDG.AddProperty (OUString::createFromAscii ("ControlBackground"),
+ DescriptionGenerator::COLOR,
+ OUString());
+ aDG.AddProperty (OUString::createFromAscii ("ControlBorder"),
+ DescriptionGenerator::INTEGER,
+ OUString());
+ break;
+
+ case DRAWING_TEXT:
+ aDG.AddTextProperties ();
+ break;
+
+ default:
+ aDG.Initialize (::rtl::OUString (
+ RTL_CONSTASCII_USTRINGPARAM("Unknown accessible shape")));
+ uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
+ if (xDescriptor.is())
+ {
+ aDG.AppendString (::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("service name=")));
+ aDG.AppendString (xDescriptor->getShapeType());
+ }
+ }
+
+ return aDG();
+}
+
+
+
+
+uno::Reference< drawing::XShape > AccessibleShape::GetXShape()
+{
+ return( mxShape );
+}
+
+
+
+// protected
+void AccessibleShape::disposing (void)
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ ::osl::MutexGuard aGuard (maMutex);
+
+ // Make sure to send an event that this object looses the focus in the
+ // case that it has the focus.
+ ::utl::AccessibleStateSetHelper* pStateSet =
+ static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
+ if (pStateSet != NULL)
+ pStateSet->RemoveState (AccessibleStateType::FOCUSED);
+
+ // Unregister from broadcasters.
+ Reference<lang::XComponent> xComponent (mxShape, uno::UNO_QUERY);
+ if (xComponent.is())
+ xComponent->removeEventListener (this);
+
+ // Unregister from model.
+ if (maShapeTreeInfo.GetModelBroadcaster().is())
+ maShapeTreeInfo.GetModelBroadcaster()->removeEventListener (
+ static_cast<document::XEventListener*>(this));
+
+ // Release the child containers.
+ if (mpChildrenManager != NULL)
+ {
+ delete mpChildrenManager;
+ mpChildrenManager = NULL;
+ }
+ if (mpText != NULL)
+ {
+ mpText->Dispose();
+ delete mpText;
+ mpText = NULL;
+ }
+
+ // Cleanup. Remove references to objects to allow them to be
+ // destroyed.
+ mxShape = NULL;
+ maShapeTreeInfo = AccessibleShapeTreeInfo();
+
+ // Call base classes.
+ AccessibleContextBase::dispose ();
+}
+
+sal_Int32 SAL_CALL
+ AccessibleShape::getAccessibleIndexInParent (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ // Use a simple but slow solution for now. Optimize later.
+
+ sal_Int32 nIndex = m_nIndexInParent;
+ if ( -1 == nIndex )
+ nIndex = AccessibleContextBase::getAccessibleIndexInParent();
+ return nIndex;
+}
+
+
+
+
+void AccessibleShape::UpdateNameAndDescription (void)
+{
+ // Ignore missing title, name, or description. There are fallbacks for
+ // them.
+ try
+ {
+ Reference<beans::XPropertySet> xSet (mxShape, uno::UNO_QUERY_THROW);
+ OUString sString;
+
+ // Get the accessible name.
+ sString = GetOptionalProperty(xSet, OUString(RTL_CONSTASCII_USTRINGPARAM("Title")));
+ if (sString.getLength() > 0)
+ {
+ SetAccessibleName(sString, AccessibleContextBase::FromShape);
+ }
+ else
+ {
+ sString = GetOptionalProperty(xSet, OUString(RTL_CONSTASCII_USTRINGPARAM("Name")));
+ if (sString.getLength() > 0)
+ SetAccessibleName(sString, AccessibleContextBase::FromShape);
+ }
+
+ // Get the accessible description.
+ sString = GetOptionalProperty(xSet, OUString(RTL_CONSTASCII_USTRINGPARAM("Description")));
+ if (sString.getLength() > 0)
+ SetAccessibleDescription(sString, AccessibleContextBase::FromShape);
+ }
+ catch (uno::RuntimeException&)
+ {
+ }
+}
+
+
+
+
+} // end of namespace accessibility
diff --git a/svx/source/accessibility/AccessibleShapeInfo.cxx b/svx/source/accessibility/AccessibleShapeInfo.cxx
new file mode 100644
index 000000000000..7d6eb8f4c50f
--- /dev/null
+++ b/svx/source/accessibility/AccessibleShapeInfo.cxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+
+#include <svx/AccessibleShapeInfo.hxx>
+
+
+namespace accessibility {
+
+AccessibleShapeInfo::AccessibleShapeInfo (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape>& rxShape,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent,
+ IAccessibleParent* pChildrenManager,
+ sal_Int32 nIndex)
+ : mxShape (rxShape),
+ mxParent (rxParent),
+ mpChildrenManager (pChildrenManager),
+ mnIndex (nIndex)
+{
+ // empty.
+}
+
+
+
+
+AccessibleShapeInfo::AccessibleShapeInfo (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape>& rxShape,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent,
+ sal_Int32 nIndex)
+ : mxShape (rxShape),
+ mxParent (rxParent),
+ mpChildrenManager (NULL),
+ mnIndex (nIndex)
+{
+ // empty.
+}
+
+AccessibleShapeInfo::AccessibleShapeInfo (const AccessibleShapeInfo &rOther)
+ : mxShape (rOther.mxShape),
+ mxParent (rOther.mxParent),
+ mpChildrenManager (rOther.mpChildrenManager),
+ mnIndex (rOther.mnIndex)
+{
+ // empty.
+}
+
+
+AccessibleShapeInfo::~AccessibleShapeInfo (void)
+{
+ // empty.
+}
+
+} // end of namespace accessibility.
diff --git a/svx/source/accessibility/AccessibleShapeTreeInfo.cxx b/svx/source/accessibility/AccessibleShapeTreeInfo.cxx
new file mode 100644
index 000000000000..5241fa5abbf1
--- /dev/null
+++ b/svx/source/accessibility/AccessibleShapeTreeInfo.cxx
@@ -0,0 +1,223 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/AccessibleShapeTreeInfo.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using ::com::sun::star::uno::Reference;
+
+namespace accessibility {
+
+AccessibleShapeTreeInfo::AccessibleShapeTreeInfo (
+ const Reference<XAccessibleComponent>& rxDocumentWindow,
+ const Reference<document::XEventBroadcaster>& rxModelBroadcaster)
+ : mxDocumentWindow (rxDocumentWindow),
+ mxModelBroadcaster (rxModelBroadcaster),
+ mpView (NULL),
+ mpWindow (NULL),
+ mpViewForwarder (NULL)
+{
+ // Empty.
+}
+
+
+
+
+AccessibleShapeTreeInfo::AccessibleShapeTreeInfo (void)
+ : mpView (NULL),
+ mpWindow (NULL),
+ mpViewForwarder (NULL)
+{
+ // Empty.
+}
+
+
+
+
+AccessibleShapeTreeInfo::AccessibleShapeTreeInfo (const AccessibleShapeTreeInfo& rInfo)
+ : mxDocumentWindow (rInfo.mxDocumentWindow),
+ mxModelBroadcaster (rInfo.mxModelBroadcaster),
+ mpView (rInfo.mpView),
+ mxController (rInfo.mxController),
+ mpWindow (rInfo.mpWindow),
+ mpViewForwarder (rInfo.mpViewForwarder)
+{
+ // Empty.
+}
+
+
+
+
+AccessibleShapeTreeInfo& AccessibleShapeTreeInfo::operator= (const AccessibleShapeTreeInfo& rInfo)
+{
+ if ( this != &rInfo )
+ {
+ mxDocumentWindow = rInfo.mxDocumentWindow;
+ mxModelBroadcaster = rInfo.mxModelBroadcaster;
+ mpView = rInfo.mpView;
+ mxController = rInfo.mxController,
+ mpWindow = rInfo.mpWindow;
+ mpViewForwarder = rInfo.mpViewForwarder;
+ }
+ return *this;
+}
+
+
+
+
+AccessibleShapeTreeInfo::~AccessibleShapeTreeInfo (void)
+{
+ //empty
+}
+
+
+
+
+void AccessibleShapeTreeInfo::SetDocumentWindow (
+ const Reference<XAccessibleComponent>& rxDocumentWindow)
+{
+ if (mxDocumentWindow != rxDocumentWindow)
+ mxDocumentWindow = rxDocumentWindow;
+}
+
+
+
+
+uno::Reference<XAccessibleComponent>
+ AccessibleShapeTreeInfo::GetDocumentWindow (void) const
+{
+ return mxDocumentWindow;
+}
+
+
+
+
+void AccessibleShapeTreeInfo::SetControllerBroadcaster (
+ const uno::Reference<document::XEventBroadcaster>& rxControllerBroadcaster)
+{
+ mxModelBroadcaster = rxControllerBroadcaster;
+}
+
+
+
+
+uno::Reference<document::XEventBroadcaster>
+ AccessibleShapeTreeInfo::GetControllerBroadcaster (void) const
+{
+ return mxModelBroadcaster;
+}
+
+
+
+
+void AccessibleShapeTreeInfo::SetModelBroadcaster (
+ const Reference<document::XEventBroadcaster>& rxModelBroadcaster)
+{
+ mxModelBroadcaster = rxModelBroadcaster;
+}
+
+
+
+
+Reference<document::XEventBroadcaster>
+ AccessibleShapeTreeInfo::GetModelBroadcaster (void) const
+{
+ return mxModelBroadcaster;
+}
+
+
+
+
+void AccessibleShapeTreeInfo::SetSdrView (SdrView* pView)
+{
+ mpView = pView;
+}
+
+
+
+
+SdrView* AccessibleShapeTreeInfo::GetSdrView (void) const
+{
+ return mpView;
+}
+
+
+
+
+void AccessibleShapeTreeInfo::SetController (
+ const Reference<frame::XController>& rxController)
+{
+ mxController = rxController;
+}
+
+
+
+
+Reference<frame::XController>
+ AccessibleShapeTreeInfo::GetController (void) const
+{
+ return mxController;
+}
+
+
+
+
+void AccessibleShapeTreeInfo::SetWindow (Window* pWindow)
+{
+ mpWindow = pWindow;
+}
+
+
+
+
+Window* AccessibleShapeTreeInfo::GetWindow (void) const
+{
+ return mpWindow;
+}
+
+
+
+
+void AccessibleShapeTreeInfo::SetViewForwarder (const IAccessibleViewForwarder* pViewForwarder)
+{
+ mpViewForwarder = pViewForwarder;
+}
+
+
+
+
+const IAccessibleViewForwarder* AccessibleShapeTreeInfo::GetViewForwarder (void) const
+{
+ return mpViewForwarder;
+}
+
+
+} // end of namespace accessibility
diff --git a/svx/source/accessibility/AccessibleTextEventQueue.cxx b/svx/source/accessibility/AccessibleTextEventQueue.cxx
new file mode 100644
index 000000000000..fa34e6d0cc17
--- /dev/null
+++ b/svx/source/accessibility/AccessibleTextEventQueue.cxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "AccessibleTextEventQueue.hxx"
+#include <svx/unoshape.hxx>
+#include "editeng/unolingu.hxx"
+#include <editeng/unotext.hxx>
+
+#include "editeng/unoedhlp.hxx"
+#include "editeng/unopracc.hxx"
+#include <svx/svdmodel.hxx>
+#include <svx/svdpntv.hxx>
+#include <editeng/editdata.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/editview.hxx>
+
+namespace accessibility
+{
+ //------------------------------------------------------------------------
+ //
+ // EventQueue implementation
+ //
+ //------------------------------------------------------------------------
+
+ AccessibleTextEventQueue::AccessibleTextEventQueue()
+ {
+ }
+
+ AccessibleTextEventQueue::~AccessibleTextEventQueue()
+ {
+ Clear();
+ }
+
+ void AccessibleTextEventQueue::Append( const SfxHint& rHint )
+ {
+ maEventQueue.push_back( new SfxHint( rHint ) );
+ }
+
+ void AccessibleTextEventQueue::Append( const SdrHint& rHint )
+ {
+ maEventQueue.push_back( new SdrHint( rHint ) );
+ }
+
+ void AccessibleTextEventQueue::Append( const SfxSimpleHint& rHint )
+ {
+ maEventQueue.push_back( new SfxSimpleHint( rHint ) );
+ }
+
+ void AccessibleTextEventQueue::Append( const TextHint& rHint )
+ {
+ maEventQueue.push_back( new TextHint( rHint ) );
+ }
+
+ void AccessibleTextEventQueue::Append( const SvxViewHint& rHint )
+ {
+ maEventQueue.push_back( new SvxViewHint( rHint ) );
+ }
+
+ void AccessibleTextEventQueue::Append( const SvxEditSourceHint& rHint )
+ {
+ maEventQueue.push_back( new SvxEditSourceHint( rHint ) );
+ }
+
+ ::std::auto_ptr< SfxHint > AccessibleTextEventQueue::PopFront()
+ {
+ ::std::auto_ptr< SfxHint > aRes( *(maEventQueue.begin()) );
+ maEventQueue.pop_front();
+ return aRes;
+ }
+
+ bool AccessibleTextEventQueue::IsEmpty() const
+ {
+ return maEventQueue.empty();
+ }
+
+ void AccessibleTextEventQueue::Clear()
+ {
+ // clear queue
+ while( !IsEmpty() )
+ PopFront();
+ }
+
+} // end of namespace accessibility
+
+//------------------------------------------------------------------------
diff --git a/svx/source/accessibility/AccessibleTextEventQueue.hxx b/svx/source/accessibility/AccessibleTextEventQueue.hxx
new file mode 100644
index 000000000000..8f508858108a
--- /dev/null
+++ b/svx/source/accessibility/AccessibleTextEventQueue.hxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_TEXT_CHANGED_QUEUE_HXX
+#define _SVX_TEXT_CHANGED_QUEUE_HXX
+
+#include <memory>
+#include <list>
+#include <algorithm>
+#include <tools/solar.h>
+#include <tools/rtti.hxx>
+
+class SfxHint;
+class SdrHint;
+class SfxSimpleHint;
+class TextHint;
+class SvxViewHint;
+class SvxEditSourceHint;
+
+namespace accessibility
+{
+ /** This class handles the notification events for the
+ AccessibleTextHelper class.
+
+ For various reasons, we cannot process EditEngine events as
+ they arrive, but have to queue and handle them in a batch.
+ */
+ class AccessibleTextEventQueue
+ {
+ public:
+ typedef ::std::list< SfxHint* > EventQueue;
+
+ AccessibleTextEventQueue();
+ ~AccessibleTextEventQueue();
+
+ /// Append event to end of queue
+ void Append( const SfxHint& rHint );
+ /// Append event to end of queue
+ void Append( const SdrHint& rHint );
+ /// Append event to end of queue
+ void Append( const SfxSimpleHint& rHint );
+ /// Append event to end of queue
+ void Append( const TextHint& rHint );
+ /// Append event to end of queue
+ void Append( const SvxViewHint& rHint );
+ /// Append event to end of queue
+ void Append( const SvxEditSourceHint& rHint );
+
+ /** Pop first queue element
+
+ return first queue element, ownership transfers to caller
+ */
+ ::std::auto_ptr< SfxHint > PopFront();
+
+ /** Apply functor to every queue member
+
+ @param rFunctor
+ Functor to apply. Functor receives queue element as
+ parameter: void func( const SfxHint* );
+ */
+ template < typename Functor > void ForEach( Functor& rFunctor ) const
+ {
+ // #109864# Make sure results are put back into rFunctor
+ rFunctor = ::std::for_each( maEventQueue.begin(), maEventQueue.end(), rFunctor );
+ }
+
+ /// Query whether queue is empty
+ bool IsEmpty() const;
+
+ /// Clear event queue
+ void Clear();
+
+ private:
+ EventQueue maEventQueue;
+ };
+
+} // end of namespace accessibility
+
+#endif /* _SVX_TEXT_CHANGED_QUEUE_HXX */
diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx b/svx/source/accessibility/AccessibleTextHelper.cxx
new file mode 100644
index 000000000000..4b3d2eab45fd
--- /dev/null
+++ b/svx/source/accessibility/AccessibleTextHelper.cxx
@@ -0,0 +1,2077 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+//------------------------------------------------------------------------
+//
+// Global header
+//
+//------------------------------------------------------------------------
+
+#include <limits.h>
+#include <memory>
+#include <algorithm>
+#include <deque>
+#include <vos/mutex.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <comphelper/accessibleeventnotifier.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <vcl/unohelp.hxx>
+#include <vcl/svapp.hxx>
+
+//------------------------------------------------------------------------
+//
+// Project-local header
+//
+//------------------------------------------------------------------------
+#include "AccessibleTextEventQueue.hxx"
+#include <svx/AccessibleTextHelper.hxx>
+#include <svx/unoshape.hxx>
+#include "editeng/unolingu.hxx"
+#include <editeng/unotext.hxx>
+
+#include "editeng/unoedhlp.hxx"
+#include "editeng/unopracc.hxx"
+#include "editeng/AccessibleParaManager.hxx"
+#include "editeng/AccessibleEditableTextPara.hxx"
+#include <svx/svdmodel.hxx>
+#include <svx/svdpntv.hxx>
+#include <editeng/editdata.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/editview.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+namespace accessibility
+{
+
+//------------------------------------------------------------------------
+//
+// AccessibleTextHelper_Impl declaration
+//
+//------------------------------------------------------------------------
+
+ DBG_NAME( AccessibleTextHelper_Impl )
+
+ template < typename first_type, typename second_type >
+ ::std::pair< first_type, second_type > makeSortedPair( first_type first,
+ second_type second )
+ {
+ if( first > second )
+ return ::std::make_pair( second, first );
+ else
+ return ::std::make_pair( first, second );
+ }
+
+ class AccessibleTextHelper_Impl : public SfxListener
+ {
+
+ public:
+ typedef ::std::vector< sal_Int16 > VectorOfStates;
+
+ // receive pointer to our frontend class and view window
+ AccessibleTextHelper_Impl();
+ ~AccessibleTextHelper_Impl();
+
+ // XAccessibleContext child handling methods
+ sal_Int32 SAL_CALL getAccessibleChildCount() SAL_THROW((uno::RuntimeException));
+ uno::Reference< XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) SAL_THROW((lang::IndexOutOfBoundsException, uno::RuntimeException));
+
+ // XAccessibleEventBroadcaster child related methods
+ void SAL_CALL addEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) SAL_THROW((uno::RuntimeException));
+ void SAL_CALL removeEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) SAL_THROW((uno::RuntimeException));
+
+ // XAccessibleComponent child related methods
+ uno::Reference< XAccessible > SAL_CALL getAccessibleAtPoint( const awt::Point& aPoint ) SAL_THROW((uno::RuntimeException));
+
+ SvxEditSourceAdapter& GetEditSource() const SAL_THROW((uno::RuntimeException));
+ void SetEditSource( ::std::auto_ptr< SvxEditSource > pEditSource ) SAL_THROW((uno::RuntimeException));
+
+ void SetEventSource( const uno::Reference< XAccessible >& rInterface )
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+ mxFrontEnd = rInterface;
+ }
+ uno::Reference< XAccessible > GetEventSource() const
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+ return mxFrontEnd;
+ }
+
+ void SetOffset( const Point& );
+ Point GetOffset() const
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+ ::osl::MutexGuard aGuard( maMutex ); Point aPoint( maOffset );
+ return aPoint;
+ }
+
+ void SetStartIndex( sal_Int32 nOffset );
+ sal_Int32 GetStartIndex() const
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+ // Strictly correct only with locked solar mutex, // but
+ // here we rely on the fact that sal_Int32 access is
+ // atomic
+ return mnStartIndex;
+ }
+
+ void SetAdditionalChildStates( const VectorOfStates& rChildStates );
+ const VectorOfStates& GetAdditionalChildStates() const;
+
+ sal_Bool IsSelected() const;
+
+ void Dispose();
+
+ // do NOT hold object mutex when calling this! Danger of deadlock
+ void FireEvent( const sal_Int16 nEventId, const uno::Any& rNewValue = uno::Any(), const uno::Any& rOldValue = uno::Any() ) const;
+ void FireEvent( const AccessibleEventObject& rEvent ) const;
+
+ void SetFocus( sal_Bool bHaveFocus ) SAL_THROW((::com::sun::star::uno::RuntimeException));
+ sal_Bool HaveFocus() SAL_THROW((::com::sun::star::uno::RuntimeException));
+ void SetChildFocus( sal_Int32 nChild, sal_Bool bHaveFocus ) SAL_THROW((::com::sun::star::uno::RuntimeException));
+ void SetShapeFocus( sal_Bool bHaveFocus ) SAL_THROW((::com::sun::star::uno::RuntimeException));
+ void ChangeChildFocus( sal_Int32 nNewChild ) SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+#ifdef DBG_UTIL
+ void CheckInvariants() const;
+#endif
+
+ // checks all children for visibility, throws away invisible ones
+ void UpdateVisibleChildren( bool bBroadcastEvents=true );
+
+ // check all children for changes in positíon and size
+ void UpdateBoundRect();
+
+ // calls SetSelection on the forwarder and updates maLastSelection
+ // cache.
+ void UpdateSelection();
+
+ private:
+
+ // Process event queue
+ void ProcessQueue();
+
+ // syntactic sugar for FireEvent
+ void GotPropertyEvent( const uno::Any& rNewValue, const sal_Int16 nEventId ) const { FireEvent( nEventId, rNewValue ); }
+ void LostPropertyEvent( const uno::Any& rOldValue, const sal_Int16 nEventId ) const { FireEvent( nEventId, uno::Any(), rOldValue ); }
+
+ // shutdown usage of current edit source on myself and the children.
+ void ShutdownEditSource() SAL_THROW((uno::RuntimeException));
+
+ void ParagraphsMoved( sal_Int32 nFirst, sal_Int32 nMiddle, sal_Int32 nLast );
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ int getNotifierClientId() const { return mnNotifierClientId; }
+
+ // lock solar mutex before
+ SvxTextForwarder& GetTextForwarder() const SAL_THROW((uno::RuntimeException));
+ // lock solar mutex before
+ SvxViewForwarder& GetViewForwarder() const SAL_THROW((uno::RuntimeException));
+ // lock solar mutex before
+ SvxEditViewForwarder& GetEditViewForwarder( sal_Bool bCreate = sal_False ) const SAL_THROW((uno::RuntimeException));
+
+ // are we in edit mode?
+ sal_Bool IsActive() const SAL_THROW((uno::RuntimeException));
+
+ // our frontend class (the one implementing the actual
+ // interface). That's not necessarily the one containing the impl
+ // pointer!
+ uno::Reference< XAccessible > mxFrontEnd;
+
+ // a wrapper for the text forwarders (guarded by solar mutex)
+ mutable SvxEditSourceAdapter maEditSource;
+
+ // store last selection (to correctly report selection changes, guarded by solar mutex)
+ ESelection maLastSelection;
+
+ // cache range of visible children (guarded by solar mutex)
+ sal_Int32 mnFirstVisibleChild;
+ sal_Int32 mnLastVisibleChild;
+
+ // offset to add to all our children (unguarded, relying on
+ // the fact that sal_Int32 access is atomic)
+ sal_Int32 mnStartIndex;
+
+ // the object handling our children (guarded by solar mutex)
+ ::accessibility::AccessibleParaManager maParaManager;
+
+ // number of not-yet-closed event frames (BEGIN/END sequences) (guarded by solar mutex)
+ sal_Int32 maEventOpenFrames;
+
+ // Queued events from Notify() (guarded by solar mutex)
+ AccessibleTextEventQueue maEventQueue;
+
+ // spin lock to prevent notify in notify (guarded by solar mutex)
+ sal_Bool mbInNotify;
+
+ // whether the object or it's children has the focus set (guarded by solar mutex)
+ sal_Bool mbGroupHasFocus;
+
+ // whether we (this object) has the focus set (guarded by solar mutex)
+ sal_Bool mbThisHasFocus;
+
+ mutable ::osl::Mutex maMutex;
+
+ /// our current offset to the containing shape/cell (guarded by maMutex)
+ Point maOffset;
+
+ /// client Id from AccessibleEventNotifier
+ int mnNotifierClientId;
+ };
+
+ //------------------------------------------------------------------------
+ //
+ // AccessibleTextHelper_Impl implementation
+ //
+ //------------------------------------------------------------------------
+
+ AccessibleTextHelper_Impl::AccessibleTextHelper_Impl() :
+ mxFrontEnd( NULL ),
+ maLastSelection( EE_PARA_NOT_FOUND,EE_PARA_NOT_FOUND,EE_PARA_NOT_FOUND,EE_PARA_NOT_FOUND ),
+ mnFirstVisibleChild( -1 ),
+ mnLastVisibleChild( -2 ),
+ mnStartIndex( 0 ),
+ maEventOpenFrames( 0 ),
+ mbInNotify( sal_False ),
+ mbGroupHasFocus( sal_False ),
+ mbThisHasFocus( sal_False ),
+ maOffset(0,0),
+ // well, that's strictly exception safe, though not really
+ // robust. We rely on the fact that this member is constructed
+ // last, and that the constructor body is empty, thus no
+ // chance for exceptions once the Id is fetched. Nevertheless,
+ // normally should employ RAII here...
+ mnNotifierClientId(::comphelper::AccessibleEventNotifier::registerClient())
+ {
+ DBG_CTOR( AccessibleTextHelper_Impl, NULL );
+
+#ifdef DBG_UTIL
+ OSL_TRACE( "AccessibleTextHelper_Impl received ID: %d", mnNotifierClientId );
+#endif
+ }
+
+ AccessibleTextHelper_Impl::~AccessibleTextHelper_Impl()
+ {
+ DBG_DTOR( AccessibleTextHelper_Impl, NULL );
+
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ try
+ {
+ // call Dispose here, too, since we've some resources not
+ // automatically freed otherwise
+ Dispose();
+ }
+ catch( const uno::Exception& ) {}
+ }
+
+ SvxTextForwarder& AccessibleTextHelper_Impl::GetTextForwarder() const SAL_THROW((uno::RuntimeException))
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ if( !maEditSource.IsValid() )
+ throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown edit source")), mxFrontEnd);
+
+ SvxTextForwarder* pTextForwarder = maEditSource.GetTextForwarder();
+
+ if( !pTextForwarder )
+ throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unable to fetch text forwarder, model might be dead")), mxFrontEnd);
+
+ if( pTextForwarder->IsValid() )
+ return *pTextForwarder;
+ else
+ throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Text forwarder is invalid, model might be dead")), mxFrontEnd);
+ }
+
+ SvxViewForwarder& AccessibleTextHelper_Impl::GetViewForwarder() const SAL_THROW((uno::RuntimeException))
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ if( !maEditSource.IsValid() )
+ throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown edit source")), mxFrontEnd);
+
+ SvxViewForwarder* pViewForwarder = maEditSource.GetViewForwarder();
+
+ if( !pViewForwarder )
+ throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unable to fetch view forwarder, model might be dead")), mxFrontEnd);
+
+ if( pViewForwarder->IsValid() )
+ return *pViewForwarder;
+ else
+ throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("View forwarder is invalid, model might be dead")), mxFrontEnd);
+ }
+
+ SvxEditViewForwarder& AccessibleTextHelper_Impl::GetEditViewForwarder( sal_Bool bCreate ) const SAL_THROW((uno::RuntimeException))
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ if( !maEditSource.IsValid() )
+ throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown edit source")), mxFrontEnd);
+
+ SvxEditViewForwarder* pViewForwarder = maEditSource.GetEditViewForwarder( bCreate );
+
+ if( !pViewForwarder )
+ {
+ if( bCreate )
+ throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unable to fetch edit view forwarder, model might be dead")), mxFrontEnd);
+ else
+ throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No edit view forwarder, object not in edit mode")), mxFrontEnd);
+ }
+
+ if( pViewForwarder->IsValid() )
+ return *pViewForwarder;
+ else
+ {
+ if( bCreate )
+ throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("View forwarder is invalid, model might be dead")), mxFrontEnd);
+ else
+ throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("View forwarder is invalid, object not in edit mode")), mxFrontEnd);
+ }
+ }
+
+ SvxEditSourceAdapter& AccessibleTextHelper_Impl::GetEditSource() const SAL_THROW((uno::RuntimeException))
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ if( maEditSource.IsValid() )
+ return maEditSource;
+ else
+ throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleTextHelper_Impl::GetEditSource: no edit source")), mxFrontEnd );
+ }
+
+ sal_Bool AccessibleTextHelper_Impl::IsSelected() const
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ sal_Bool bRet = sal_False;
+
+ try
+ {
+ ESelection aSelection;
+ bRet = GetEditViewForwarder().GetSelection( aSelection );
+ }
+ catch( const uno::Exception& ) {}
+
+ return bRet;
+ }
+
+ // functor for sending child events (no stand-alone function, they are maybe not inlined)
+ class AccessibleTextHelper_OffsetChildIndex : public ::std::unary_function< ::accessibility::AccessibleEditableTextPara&, void >
+ {
+ public:
+ AccessibleTextHelper_OffsetChildIndex( sal_Int32 nDifference ) : mnDifference(nDifference) {}
+ void operator()( ::accessibility::AccessibleEditableTextPara& rPara )
+ {
+ rPara.SetIndexInParent( rPara.GetIndexInParent() + mnDifference );
+ }
+
+ private:
+ const sal_Int32 mnDifference;
+ };
+
+ void AccessibleTextHelper_Impl::SetStartIndex( sal_Int32 nOffset )
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ sal_Int32 nOldOffset( mnStartIndex );
+
+ mnStartIndex = nOffset;
+
+ if( nOldOffset != nOffset )
+ {
+ // update children
+ AccessibleTextHelper_OffsetChildIndex aFunctor( nOffset - nOldOffset );
+
+ ::std::for_each( maParaManager.begin(), maParaManager.end(),
+ AccessibleParaManager::WeakChildAdapter< AccessibleTextHelper_OffsetChildIndex > (aFunctor) );
+ }
+ }
+
+ void AccessibleTextHelper_Impl::SetAdditionalChildStates( const VectorOfStates& rChildStates )
+ {
+ maParaManager.SetAdditionalChildStates( rChildStates );
+ }
+
+ const AccessibleTextHelper_Impl::VectorOfStates& AccessibleTextHelper_Impl::GetAdditionalChildStates() const
+ {
+ return maParaManager.GetAdditionalChildStates();
+ }
+
+ void AccessibleTextHelper_Impl::SetChildFocus( sal_Int32 nChild, sal_Bool bHaveFocus ) SAL_THROW((::com::sun::star::uno::RuntimeException))
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ if( bHaveFocus )
+ {
+ if( mbThisHasFocus )
+ SetShapeFocus( sal_False );
+
+ maParaManager.SetFocus( nChild );
+
+ // we just received the focus, also send caret event then
+ UpdateSelection();
+
+ DBG_TRACE1("AccessibleTextHelper_Impl::SetChildFocus(): Paragraph %d received focus", nChild );
+ }
+ else
+ {
+ maParaManager.SetFocus( -1 );
+
+ DBG_TRACE1("AccessibleTextHelper_Impl::SetChildFocus(): Paragraph %d lost focus", nChild );
+
+ if( mbGroupHasFocus )
+ SetShapeFocus( sal_True );
+ }
+ }
+
+ void AccessibleTextHelper_Impl::ChangeChildFocus( sal_Int32 nNewChild ) SAL_THROW((::com::sun::star::uno::RuntimeException))
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ if( mbThisHasFocus )
+ SetShapeFocus( sal_False );
+
+ mbGroupHasFocus = sal_True;
+ maParaManager.SetFocus( nNewChild );
+
+ DBG_TRACE1("AccessibleTextHelper_Impl::ChangeChildFocus(): Paragraph %d received focus", nNewChild );
+ }
+
+ void AccessibleTextHelper_Impl::SetShapeFocus( sal_Bool bHaveFocus ) SAL_THROW((::com::sun::star::uno::RuntimeException))
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ sal_Bool bOldFocus( mbThisHasFocus );
+
+ mbThisHasFocus = bHaveFocus;
+
+ if( bOldFocus != bHaveFocus )
+ {
+ if( bHaveFocus )
+ {
+ GotPropertyEvent( uno::makeAny(AccessibleStateType::FOCUSED), AccessibleEventId::STATE_CHANGED );
+ DBG_TRACE("AccessibleTextHelper_Impl::SetShapeFocus(): Parent object received focus" );
+ }
+ else
+ {
+ LostPropertyEvent( uno::makeAny(AccessibleStateType::FOCUSED), AccessibleEventId::STATE_CHANGED );
+ DBG_TRACE("AccessibleTextHelper_Impl::SetShapeFocus(): Parent object lost focus" );
+ }
+ }
+ }
+
+ void AccessibleTextHelper_Impl::SetFocus( sal_Bool bHaveFocus ) SAL_THROW((::com::sun::star::uno::RuntimeException))
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ sal_Bool bOldFocus( mbGroupHasFocus );
+
+ mbGroupHasFocus = bHaveFocus;
+
+ if( IsActive() )
+ {
+ try
+ {
+ // find the one with the cursor and get/set focus accordingly
+ ESelection aSelection;
+ if( GetEditViewForwarder().GetSelection( aSelection ) )
+ SetChildFocus( aSelection.nEndPara, bHaveFocus );
+ }
+ catch( const uno::Exception& ) {}
+ }
+ else if( bOldFocus != bHaveFocus )
+ {
+ SetShapeFocus( bHaveFocus );
+ }
+
+ DBG_TRACE2("AccessibleTextHelper_Impl::SetFocus: focus changed, Object %d, state: %s", this, bHaveFocus ? "focused" : "not focused");
+ }
+
+ sal_Bool AccessibleTextHelper_Impl::HaveFocus() SAL_THROW((::com::sun::star::uno::RuntimeException))
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ // No locking of solar mutex here, since we rely on the fact
+ // that sal_Bool access is atomic
+ return mbThisHasFocus;
+ }
+
+ sal_Bool AccessibleTextHelper_Impl::IsActive() const SAL_THROW((uno::RuntimeException))
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ try
+ {
+ SvxEditSource& rEditSource = GetEditSource();
+ SvxEditViewForwarder* pViewForwarder = rEditSource.GetEditViewForwarder();
+
+ if( !pViewForwarder )
+ return sal_False;
+
+ if( pViewForwarder->IsValid() )
+ return sal_True;
+ else
+ return sal_False;
+ }
+ catch( const uno::RuntimeException& )
+ {
+ return sal_False;
+ }
+ }
+
+ void AccessibleTextHelper_Impl::UpdateSelection()
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ try
+ {
+ ESelection aSelection;
+ if( GetEditViewForwarder().GetSelection( aSelection ) )
+ {
+ if( !maLastSelection.IsEqual( aSelection ) &&
+ aSelection.nEndPara < maParaManager.GetNum() )
+ {
+ // #103998# Not that important, changed from assertion to trace
+ if( mbThisHasFocus )
+ {
+ DBG_TRACE("AccessibleTextHelper_Impl::UpdateSelection(): Parent has focus!");
+ }
+
+ sal_uInt16 nMaxValidParaIndex( static_cast< sal_uInt16 >( GetTextForwarder().GetParagraphCount() ) - 1 );
+
+ // notify all affected paragraphs (TODO: may be suboptimal,
+ // since some paragraphs might stay selected)
+ if( maLastSelection.nStartPara != EE_PARA_NOT_FOUND )
+ {
+ // Did the caret move from one paragraph to another?
+ // #100530# no caret events if not focused.
+ if( mbGroupHasFocus &&
+ maLastSelection.nEndPara != aSelection.nEndPara )
+ {
+ if( maLastSelection.nEndPara < maParaManager.GetNum() )
+ {
+ maParaManager.FireEvent( ::std::min( maLastSelection.nEndPara, nMaxValidParaIndex ),
+ ::std::min( maLastSelection.nEndPara, nMaxValidParaIndex )+1,
+ AccessibleEventId::CARET_CHANGED,
+ uno::makeAny(static_cast<sal_Int32>(-1)),
+ uno::makeAny(static_cast<sal_Int32>(maLastSelection.nEndPos)) );
+ }
+
+ ChangeChildFocus( aSelection.nEndPara );
+
+ DBG_TRACE3("AccessibleTextHelper_Impl::UpdateSelection(): focus changed, Object: %d, Paragraph: %d, Last paragraph: %d",
+ this, aSelection.nEndPara, maLastSelection.nEndPara);
+ }
+ }
+
+ // #100530# no caret events if not focused.
+ if( mbGroupHasFocus )
+ {
+ uno::Any aOldCursor;
+
+ // #i13705# The old cursor can only contain valid
+ // values if it's the same paragraph!
+ if( maLastSelection.nStartPara != EE_PARA_NOT_FOUND &&
+ maLastSelection.nEndPara == aSelection.nEndPara )
+ {
+ aOldCursor <<= static_cast<sal_Int32>(maLastSelection.nEndPos);
+ }
+ else
+ {
+ aOldCursor <<= static_cast<sal_Int32>(-1);
+ }
+
+ maParaManager.FireEvent( aSelection.nEndPara,
+ aSelection.nEndPara+1,
+ AccessibleEventId::CARET_CHANGED,
+ uno::makeAny(static_cast<sal_Int32>(aSelection.nEndPos)),
+ aOldCursor );
+ }
+
+ DBG_TRACE5("AccessibleTextHelper_Impl::UpdateSelection(): caret changed, Object: %d, New pos: %d, Old pos: %d, New para: %d, Old para: %d",
+ this, aSelection.nEndPos, maLastSelection.nEndPos, aSelection.nEndPara, maLastSelection.nEndPara);
+
+ // #108947# Sort new range before calling FireEvent
+ ::std::pair< xub_StrLen, xub_StrLen > sortedSelection(
+ makeSortedPair(::std::min( aSelection.nStartPara, nMaxValidParaIndex ),
+ ::std::min( aSelection.nEndPara, nMaxValidParaIndex ) ) );
+
+ // #108947# Sort last range before calling FireEvent
+ ::std::pair< xub_StrLen, xub_StrLen > sortedLastSelection(
+ makeSortedPair(::std::min( maLastSelection.nStartPara, nMaxValidParaIndex ),
+ ::std::min( maLastSelection.nEndPara, nMaxValidParaIndex ) ) );
+
+ // --> OD 2005-12-15 #i27299#
+ // event TEXT_SELECTION_CHANGED has to be submitted.
+ const sal_Int16 nTextSelChgEventId =
+ AccessibleEventId::TEXT_SELECTION_CHANGED;
+ // <--
+ // #107037# notify selection change
+ if( maLastSelection.nStartPara == EE_PARA_NOT_FOUND )
+ {
+ // last selection is undefined
+ // --> OD 2005-12-15 #i27299# - use method <ESelection::HasRange()>
+ if ( aSelection.HasRange() )
+ // <--
+ {
+ // selection was undefined, now is on
+ maParaManager.FireEvent( sortedSelection.first,
+ sortedSelection.second+1,
+ nTextSelChgEventId );
+ }
+ }
+ else
+ {
+ // last selection is valid
+ // --> OD 2005-12-15 #i27299# - use method <ESelection::HasRange()>
+ if ( maLastSelection.HasRange() &&
+ !aSelection.HasRange() )
+ // <--
+ {
+ // selection was on, now is empty
+ maParaManager.FireEvent( sortedLastSelection.first,
+ sortedLastSelection.second+1,
+ nTextSelChgEventId );
+ }
+ // --> OD 2005-12-15 #i27299# - use method <ESelection::HasRange()>
+ else if( !maLastSelection.HasRange() &&
+ aSelection.HasRange() )
+ // <--
+ {
+ // selection was empty, now is on
+ maParaManager.FireEvent( sortedSelection.first,
+ sortedSelection.second+1,
+ nTextSelChgEventId );
+ }
+ // --> OD 2005-12-15 #i27299#
+ // - no event TEXT_SELECTION_CHANGED event, if new and
+ // last selection are empty.
+ else if ( maLastSelection.HasRange() &&
+ aSelection.HasRange() )
+ // <--
+ {
+ // --> OD 2005-12-16 #i27299#
+ // - send event TEXT_SELECTION_CHANGED for difference
+ // between last and new selection.
+// // selection was on, now is different: take union of ranges
+// maParaManager.FireEvent( ::std::min(sortedSelection.first,
+// sortedLastSelection.second),
+// ::std::max(sortedSelection.first,
+// sortedLastSelection.second)+1,
+// nTextSelChgEventId );
+ // use sorted last and new selection
+ ESelection aTmpLastSel( maLastSelection );
+ aTmpLastSel.Adjust();
+ ESelection aTmpSel( aSelection );
+ aTmpSel.Adjust();
+ // first submit event for new and changed selection
+ sal_uInt32 nPara = aTmpSel.nStartPara;
+ for ( ; nPara <= aTmpSel.nEndPara; ++nPara )
+ {
+ if ( nPara < aTmpLastSel.nStartPara ||
+ nPara > aTmpLastSel.nEndPara )
+ {
+ // new selection on paragraph <nPara>
+ maParaManager.FireEvent( nPara,
+ nTextSelChgEventId );
+ }
+ else
+ {
+ // check for changed selection on paragraph <nPara>
+ const xub_StrLen nParaStartPos =
+ nPara == aTmpSel.nStartPara
+ ? aTmpSel.nStartPos : 0;
+ const xub_StrLen nParaEndPos =
+ nPara == aTmpSel.nEndPara
+ ? aTmpSel.nEndPos : STRING_LEN;
+ const xub_StrLen nLastParaStartPos =
+ nPara == aTmpLastSel.nStartPara
+ ? aTmpLastSel.nStartPos : 0;
+ const xub_StrLen nLastParaEndPos =
+ nPara == aTmpLastSel.nEndPara
+ ? aTmpLastSel.nEndPos : STRING_LEN;
+ if ( nParaStartPos != nLastParaStartPos ||
+ nParaEndPos != nLastParaEndPos )
+ {
+ maParaManager.FireEvent(
+ nPara, nTextSelChgEventId );
+ }
+ }
+ }
+ // second submit event for 'old' selections
+ nPara = aTmpLastSel.nStartPara;
+ for ( ; nPara <= aTmpLastSel.nEndPara; ++nPara )
+ {
+ if ( nPara < aTmpSel.nStartPara ||
+ nPara > aTmpSel.nEndPara )
+ {
+ maParaManager.FireEvent( nPara,
+ nTextSelChgEventId );
+ }
+ }
+ }
+ }
+
+ maLastSelection = aSelection;
+ }
+ }
+ }
+ // no selection? no update actions
+ catch( const uno::RuntimeException& ) {}
+ }
+
+ void AccessibleTextHelper_Impl::ShutdownEditSource() SAL_THROW((uno::RuntimeException))
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ // This should only be called with solar mutex locked, i.e. from the main office thread
+
+ // This here is somewhat clumsy: As soon as our children have
+ // a NULL EditSource (maParaManager.SetEditSource()), they
+ // enter the disposed state and cannot be reanimated. Thus, it
+ // is unavoidable and a hard requirement to let go and create
+ // from scratch each and every child.
+
+ // invalidate children
+ maParaManager.Dispose();
+ maParaManager.SetNum(0);
+
+ // lost all children
+ if( mxFrontEnd.is() )
+ FireEvent(AccessibleEventId::INVALIDATE_ALL_CHILDREN);
+
+ // quit listen on stale edit source
+ if( maEditSource.IsValid() )
+ EndListening( maEditSource.GetBroadcaster() );
+
+ maEditSource.SetEditSource( ::std::auto_ptr< SvxEditSource >(NULL) );
+ }
+
+ void AccessibleTextHelper_Impl::SetEditSource( ::std::auto_ptr< SvxEditSource > pEditSource ) SAL_THROW((uno::RuntimeException))
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ // This should only be called with solar mutex locked, i.e. from the main office thread
+
+ // shutdown old edit source
+ ShutdownEditSource();
+
+ // set new edit source
+ maEditSource.SetEditSource( pEditSource );
+
+ // init child vector to the current child count
+ if( maEditSource.IsValid() )
+ {
+ maParaManager.SetNum( GetTextForwarder().GetParagraphCount() );
+
+ // listen on new edit source
+ StartListening( maEditSource.GetBroadcaster() );
+
+ UpdateVisibleChildren();
+ }
+ }
+
+ void AccessibleTextHelper_Impl::SetOffset( const Point& rPoint )
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ // guard against non-atomic access to maOffset data structure
+ {
+ ::osl::MutexGuard aGuard( maMutex );
+ maOffset = rPoint;
+ }
+
+ maParaManager.SetEEOffset( rPoint );
+
+ // in all cases, check visibility afterwards.
+ UpdateVisibleChildren();
+ UpdateBoundRect();
+ }
+
+ void AccessibleTextHelper_Impl::UpdateVisibleChildren( bool bBroadcastEvents )
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ try
+ {
+ SvxTextForwarder& rCacheTF = GetTextForwarder();
+ SvxViewForwarder& rCacheVF = GetViewForwarder();
+
+ Rectangle aViewArea = rCacheVF.GetVisArea();
+
+ if( IsActive() )
+ {
+ // maybe the edit view scrolls, adapt aViewArea
+ Rectangle aEditViewArea = GetEditViewForwarder().GetVisArea();
+ aViewArea += aEditViewArea.TopLeft();
+
+ // now determine intersection
+ aViewArea.Intersection( aEditViewArea );
+ }
+
+ Rectangle aTmpBB, aParaBB;
+ sal_Bool bFirstChild = sal_True;
+ sal_Int32 nCurrPara;
+ sal_Int32 nParas=rCacheTF.GetParagraphCount();
+
+ mnFirstVisibleChild = -1;
+ mnLastVisibleChild = -2;
+
+ for( nCurrPara=0; nCurrPara<nParas; ++nCurrPara )
+ {
+ DBG_ASSERT(nCurrPara >= 0 && nCurrPara <= USHRT_MAX,
+ "AccessibleTextHelper_Impl::UpdateVisibleChildren: index value overflow");
+
+ aTmpBB = rCacheTF.GetParaBounds( static_cast< sal_uInt16 >( nCurrPara ) );
+
+ // convert to screen coordinates
+ aParaBB = ::accessibility::AccessibleEditableTextPara::LogicToPixel( aTmpBB, rCacheTF.GetMapMode(), rCacheVF );
+
+ if( aParaBB.IsOver( aViewArea ) )
+ {
+ // at least partially visible
+ if( bFirstChild )
+ {
+ bFirstChild = sal_False;
+ mnFirstVisibleChild = nCurrPara;
+ }
+
+ mnLastVisibleChild = nCurrPara;
+
+ // child not yet created?
+ ::accessibility::AccessibleParaManager::WeakChild aChild( maParaManager.GetChild(nCurrPara) );
+ if( aChild.second.Width == 0 &&
+ aChild.second.Height == 0 &&
+ mxFrontEnd.is() &&
+ bBroadcastEvents )
+ {
+ GotPropertyEvent( uno::makeAny( maParaManager.CreateChild( nCurrPara - mnFirstVisibleChild,
+ mxFrontEnd, GetEditSource(), nCurrPara ).first ),
+ AccessibleEventId::CHILD );
+ }
+ }
+ else
+ {
+ // not or no longer visible
+ if( maParaManager.IsReferencable( nCurrPara ) )
+ {
+ if( bBroadcastEvents )
+ LostPropertyEvent( uno::makeAny( maParaManager.GetChild( nCurrPara ).first.get().getRef() ),
+ AccessibleEventId::CHILD );
+
+ // clear reference
+ maParaManager.Release( nCurrPara );
+ }
+ }
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_ERROR("AccessibleTextHelper_Impl::UpdateVisibleChildren error while determining visible children");
+
+ // something failed - currently no children
+ mnFirstVisibleChild = -1;
+ mnLastVisibleChild = -2;
+ maParaManager.SetNum(0);
+
+ // lost all children
+ if( bBroadcastEvents )
+ FireEvent(AccessibleEventId::INVALIDATE_ALL_CHILDREN);
+ }
+ }
+
+ // functor for checking changes in paragraph bounding boxes (no stand-alone function, maybe not inlined)
+ class AccessibleTextHelper_UpdateChildBounds : public ::std::unary_function< const ::accessibility::AccessibleParaManager::WeakChild&,
+ ::accessibility::AccessibleParaManager::WeakChild >
+ {
+ public:
+ AccessibleTextHelper_UpdateChildBounds( AccessibleTextHelper_Impl& rImpl ) : mrImpl(rImpl) {}
+ ::accessibility::AccessibleParaManager::WeakChild operator()( const ::accessibility::AccessibleParaManager::WeakChild& rChild )
+ {
+ // retrieve hard reference from weak one
+ ::accessibility::AccessibleParaManager::WeakPara::HardRefType aHardRef( rChild.first.get() );
+
+ if( aHardRef.is() )
+ {
+ awt::Rectangle aNewRect = aHardRef->getBounds();
+ const awt::Rectangle& aOldRect = rChild.second;
+
+ if( aNewRect.X != aOldRect.X ||
+ aNewRect.Y != aOldRect.Y ||
+ aNewRect.Width != aOldRect.Width ||
+ aNewRect.Height != aOldRect.Height )
+ {
+ // visible data changed
+ aHardRef->FireEvent( AccessibleEventId::BOUNDRECT_CHANGED );
+
+ // update internal bounds
+ return ::accessibility::AccessibleParaManager::WeakChild( rChild.first, aNewRect );
+ }
+ }
+
+ // identity transform
+ return rChild;
+ }
+
+ private:
+ AccessibleTextHelper_Impl& mrImpl;
+ };
+
+ void AccessibleTextHelper_Impl::UpdateBoundRect()
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ // send BOUNDRECT_CHANGED to affected children
+ AccessibleTextHelper_UpdateChildBounds aFunctor( *this );
+ ::std::transform( maParaManager.begin(), maParaManager.end(), maParaManager.begin(), aFunctor );
+ }
+
+#ifdef DBG_UTIL
+ void AccessibleTextHelper_Impl::CheckInvariants() const
+ {
+ if( mnFirstVisibleChild >= 0 &&
+ mnFirstVisibleChild > mnLastVisibleChild )
+ {
+ DBG_ERROR( "AccessibleTextHelper: range invalid" );
+ }
+ }
+#endif
+
+ // functor for sending child events (no stand-alone function, they are maybe not inlined)
+ class AccessibleTextHelper_LostChildEvent : public ::std::unary_function< const ::accessibility::AccessibleParaManager::WeakChild&, void >
+ {
+ public:
+ AccessibleTextHelper_LostChildEvent( AccessibleTextHelper_Impl& rImpl ) : mrImpl(rImpl) {}
+ void operator()( const ::accessibility::AccessibleParaManager::WeakChild& rPara )
+ {
+ // retrieve hard reference from weak one
+ ::accessibility::AccessibleParaManager::WeakPara::HardRefType aHardRef( rPara.first.get() );
+
+ if( aHardRef.is() )
+ mrImpl.FireEvent(AccessibleEventId::CHILD, uno::Any(), uno::makeAny( aHardRef.getRef() ) );
+ }
+
+ private:
+ AccessibleTextHelper_Impl& mrImpl;
+ };
+
+ void AccessibleTextHelper_Impl::ParagraphsMoved( sal_Int32 nFirst, sal_Int32 nMiddle, sal_Int32 nLast )
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ const sal_Int32 nParas = GetTextForwarder().GetParagraphCount();
+
+ /* rotate paragraphs
+ * =================
+ *
+ * Three cases:
+ *
+ * 1.
+ * ... nParagraph ... nParam1 ... nParam2 ...
+ * |______________[xxxxxxxxxxx]
+ * becomes
+ * [xxxxxxxxxxx]|______________
+ *
+ * tail is 0
+ *
+ * 2.
+ * ... nParam1 ... nParagraph ... nParam2 ...
+ * [xxxxxxxxxxx|xxxxxxxxxxxxxx]____________
+ * becomes
+ * ____________[xxxxxxxxxxx|xxxxxxxxxxxxxx]
+ *
+ * tail is nParagraph - nParam1
+ *
+ * 3.
+ * ... nParam1 ... nParam2 ... nParagraph ...
+ * [xxxxxxxxxxx]___________|____________
+ * becomes
+ * ___________|____________[xxxxxxxxxxx]
+ *
+ * tail is nParam2 - nParam1
+ */
+
+ // sort nParagraph, nParam1 and nParam2 in ascending order, calc range
+ if( nMiddle < nFirst )
+ {
+ ::std::swap(nFirst, nMiddle);
+ }
+ else if( nMiddle < nLast )
+ {
+ nLast = nLast + nMiddle - nFirst;
+ }
+ else
+ {
+ ::std::swap(nMiddle, nLast);
+ nLast = nLast + nMiddle - nFirst;
+ }
+
+ if( nFirst < nParas && nMiddle < nParas && nLast < nParas )
+ {
+ // since we have no "paragraph index
+ // changed" event on UAA, remove
+ // [first,last] and insert again later (in
+ // UpdateVisibleChildren)
+
+ // maParaManager.Rotate( nFirst, nMiddle, nLast );
+
+ // send CHILD_EVENT to affected children
+ ::accessibility::AccessibleParaManager::VectorOfChildren::const_iterator begin = maParaManager.begin();
+ ::accessibility::AccessibleParaManager::VectorOfChildren::const_iterator end = begin;
+
+ ::std::advance( begin, nFirst );
+ ::std::advance( end, nLast+1 );
+
+ // TODO: maybe optimize here in the following way. If the
+ // number of removed children exceeds a certain threshold,
+ // use INVALIDATE_CHILDREN
+ AccessibleTextHelper_LostChildEvent aFunctor( *this );
+
+ ::std::for_each( begin, end, aFunctor );
+
+ maParaManager.Release(nFirst, nLast+1);
+ // should be no need for UpdateBoundRect, since all affected children are cleared.
+ }
+ }
+
+ // functor for sending child events (no stand-alone function, they are maybe not inlined)
+ class AccessibleTextHelper_ChildrenTextChanged : public ::std::unary_function< ::accessibility::AccessibleEditableTextPara&, void >
+ {
+ public:
+ void operator()( ::accessibility::AccessibleEditableTextPara& rPara )
+ {
+ rPara.TextChanged();
+ }
+ };
+
+ /** functor processing queue events
+
+ Reacts on TEXT_HINT_PARAINSERTED/REMOVED events and stores
+ their content
+ */
+ class AccessibleTextHelper_QueueFunctor : public ::std::unary_function< const SfxHint*, void >
+ {
+ public:
+ AccessibleTextHelper_QueueFunctor() :
+ mnParasChanged( 0 ),
+ mnParaIndex(-1),
+ mnHintId(-1)
+ {}
+ void operator()( const SfxHint* pEvent )
+ {
+ if( pEvent &&
+ mnParasChanged != -1 )
+ {
+ // determine hint type
+ const TextHint* pTextHint = PTR_CAST( TextHint, pEvent );
+ const SvxEditSourceHint* pEditSourceHint = PTR_CAST( SvxEditSourceHint, pEvent );
+
+ if( !pEditSourceHint && pTextHint &&
+ (pTextHint->GetId() == TEXT_HINT_PARAINSERTED ||
+ pTextHint->GetId() == TEXT_HINT_PARAREMOVED ) )
+ {
+ if( pTextHint->GetValue() == EE_PARA_ALL )
+ {
+ mnParasChanged = -1;
+ }
+ else
+ {
+ mnHintId = pTextHint->GetId();
+ mnParaIndex = pTextHint->GetValue();
+ ++mnParasChanged;
+ }
+ }
+ }
+ }
+
+ /** Query number of paragraphs changed during queue processing.
+
+ @return number of changed paragraphs, -1 for
+ "every paragraph changed"
+ */
+ int GetNumberOfParasChanged() { return mnParasChanged; }
+ /** Query index of last added/removed paragraph
+
+ @return index of lastly added paragraphs, -1 for none
+ added so far.
+ */
+ int GetParaIndex() { return mnParaIndex; }
+ /** Query hint id of last interesting event
+
+ @return hint id of last interesting event (REMOVED/INSERTED).
+ */
+ int GetHintId() { return mnHintId; }
+
+ private:
+ /** number of paragraphs changed during queue processing. -1 for
+ "every paragraph changed"
+ */
+ int mnParasChanged;
+ /// index of paragraph added/removed last
+ int mnParaIndex;
+ /// TextHint ID (removed/inserted) of last interesting event
+ int mnHintId;
+ };
+
+ void AccessibleTextHelper_Impl::ProcessQueue()
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ // inspect queue for paragraph insert/remove events. If there
+ // is exactly _one_ of those in the queue, and the number of
+ // paragraphs has changed by exactly one, use that event to
+ // determine a priori which paragraph was added/removed. This
+ // is necessary, since I must sync right here with the
+ // EditEngine state (number of paragraphs etc.), since I'm
+ // potentially sending listener events right away.
+ AccessibleTextHelper_QueueFunctor aFunctor;
+ maEventQueue.ForEach( aFunctor );
+
+ const sal_Int32 nNewParas( GetTextForwarder().GetParagraphCount() );
+ const sal_Int32 nCurrParas( maParaManager.GetNum() );
+
+ // whether every paragraph already is updated (no need to
+ // repeat that later on, e.g. for PARA_MOVED events)
+ bool bEverythingUpdated( false );
+
+ if( labs( nNewParas - nCurrParas ) == 1 &&
+ aFunctor.GetNumberOfParasChanged() == 1 )
+ {
+ // #103483# Exactly one paragraph added/removed. This is
+ // the normal case, optimize event handling here.
+
+ if( aFunctor.GetHintId() == TEXT_HINT_PARAINSERTED )
+ {
+ // update num of paras
+ maParaManager.SetNum( nNewParas );
+
+ // release everything from the insertion position until the end
+ maParaManager.Release(aFunctor.GetParaIndex(), nCurrParas);
+
+ // TODO: Clarify whether this behaviour _really_ saves
+ // anybody anything!
+ // update children, _don't_ broadcast
+ UpdateVisibleChildren( false );
+ UpdateBoundRect();
+
+ // send insert event
+ // #109864# Enforce creation of this paragraph
+ try
+ {
+ GotPropertyEvent( uno::makeAny( getAccessibleChild( aFunctor.GetParaIndex() -
+ mnFirstVisibleChild + GetStartIndex() ) ),
+ AccessibleEventId::CHILD );
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_ERROR("AccessibleTextHelper_Impl::ProcessQueue: could not create new paragraph");
+ }
+ }
+ else if( aFunctor.GetHintId() == TEXT_HINT_PARAREMOVED )
+ {
+ ::accessibility::AccessibleParaManager::VectorOfChildren::const_iterator begin = maParaManager.begin();
+ ::std::advance( begin, aFunctor.GetParaIndex() );
+ ::accessibility::AccessibleParaManager::VectorOfChildren::const_iterator end = begin;
+ ::std::advance( end, 1 );
+
+ // #i61812# remember para to be removed for later notification
+ // AFTER the new state is applied (that after the para got removed)
+ ::uno::Reference< XAccessible > xPara;
+ ::accessibility::AccessibleParaManager::WeakPara::HardRefType aHardRef( begin->first.get() );
+ if( aHardRef.is() )
+ xPara = ::uno::Reference< XAccessible >( aHardRef.getRef(), ::uno::UNO_QUERY );
+
+ // release everything from the remove position until the end
+ maParaManager.Release(aFunctor.GetParaIndex(), nCurrParas);
+
+ // update num of paras
+ maParaManager.SetNum( nNewParas );
+
+ // TODO: Clarify whether this behaviour _really_ saves
+ // anybody anything!
+ // update children, _don't_ broadcast
+ UpdateVisibleChildren( false );
+ UpdateBoundRect();
+
+ // #i61812# notification for removed para
+ if (xPara.is())
+ FireEvent(AccessibleEventId::CHILD, uno::Any(), uno::makeAny( xPara) );
+ }
+#ifdef DBG_UTIL
+ else
+ DBG_ERROR("AccessibleTextHelper_Impl::ProcessQueue() invalid hint id");
+#endif
+ }
+ else if( nNewParas != nCurrParas )
+ {
+ // release all paras
+ maParaManager.Release(0, nCurrParas);
+
+ // update num of paras
+ maParaManager.SetNum( nNewParas );
+
+ // #109864# create from scratch, don't broadcast
+ UpdateVisibleChildren( false );
+ UpdateBoundRect();
+
+ // number of paragraphs somehow changed - but we have no
+ // chance determining how. Thus, throw away everything and
+ // create from scratch.
+ // (child events should be broadcast after the changes are done...)
+ FireEvent(AccessibleEventId::INVALIDATE_ALL_CHILDREN);
+
+ // no need for further updates later on
+ bEverythingUpdated = true;
+ }
+
+ while( !maEventQueue.IsEmpty() )
+ {
+ ::std::auto_ptr< SfxHint > pHint( maEventQueue.PopFront() );
+ if( pHint.get() )
+ {
+ const SfxHint& rHint = *(pHint.get());
+
+ // determine hint type
+ const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
+ const SfxSimpleHint* pSimpleHint = PTR_CAST( SfxSimpleHint, &rHint );
+ const TextHint* pTextHint = PTR_CAST( TextHint, &rHint );
+ const SvxViewHint* pViewHint = PTR_CAST( SvxViewHint, &rHint );
+ const SvxEditSourceHint* pEditSourceHint = PTR_CAST( SvxEditSourceHint, &rHint );
+
+ try
+ {
+ const sal_Int32 nParas = GetTextForwarder().GetParagraphCount();
+
+ if( pEditSourceHint )
+ {
+ switch( pEditSourceHint->GetId() )
+ {
+ case EDITSOURCE_HINT_PARASMOVED:
+ {
+ DBG_ASSERT( pEditSourceHint->GetStartValue() < GetTextForwarder().GetParagraphCount() &&
+ pEditSourceHint->GetEndValue() < GetTextForwarder().GetParagraphCount(),
+ "AccessibleTextHelper_Impl::NotifyHdl: Invalid notification");
+
+ if( !bEverythingUpdated )
+ {
+ ParagraphsMoved(pEditSourceHint->GetStartValue(),
+ pEditSourceHint->GetValue(),
+ pEditSourceHint->GetEndValue());
+
+ // in all cases, check visibility afterwards.
+ UpdateVisibleChildren();
+ }
+ break;
+ }
+
+ case EDITSOURCE_HINT_SELECTIONCHANGED:
+ // notify listeners
+ try
+ {
+ UpdateSelection();
+ }
+ // maybe we're not in edit mode (this is not an error)
+ catch( const uno::Exception& ) {}
+ break;
+ }
+ }
+ else if( pTextHint )
+ {
+ switch( pTextHint->GetId() )
+ {
+ case TEXT_HINT_MODIFIED:
+ {
+ // notify listeners
+ sal_Int32 nPara( pTextHint->GetValue() );
+
+ // #108900# Delegate change event to children
+ AccessibleTextHelper_ChildrenTextChanged aNotifyChildrenFunctor;
+
+ if( nPara == static_cast<sal_Int32>(EE_PARA_ALL) )
+ {
+ // #108900# Call every child
+ ::std::for_each( maParaManager.begin(), maParaManager.end(),
+ AccessibleParaManager::WeakChildAdapter< AccessibleTextHelper_ChildrenTextChanged > (aNotifyChildrenFunctor) );
+ }
+ else
+ if( nPara < nParas )
+ {
+ // #108900# Call child at index nPara
+ ::std::for_each( maParaManager.begin()+nPara, maParaManager.begin()+nPara+1,
+ AccessibleParaManager::WeakChildAdapter< AccessibleTextHelper_ChildrenTextChanged > (aNotifyChildrenFunctor) );
+ }
+ break;
+ }
+
+ case TEXT_HINT_PARAINSERTED:
+ // already happened above
+ break;
+
+ case TEXT_HINT_PARAREMOVED:
+ // already happened above
+ break;
+
+ case TEXT_HINT_TEXTHEIGHTCHANGED:
+ // visibility changed, done below
+ break;
+
+ case TEXT_HINT_VIEWSCROLLED:
+ // visibility changed, done below
+ break;
+ }
+
+ // in all cases, check visibility afterwards.
+ UpdateVisibleChildren();
+ UpdateBoundRect();
+ }
+ else if( pViewHint )
+ {
+ switch( pViewHint->GetHintType() )
+ {
+ case SvxViewHint::SVX_HINT_VIEWCHANGED:
+ // just check visibility
+ UpdateVisibleChildren();
+ UpdateBoundRect();
+ break;
+ }
+ }
+ else if( pSdrHint )
+ {
+ switch( pSdrHint->GetKind() )
+ {
+ case HINT_BEGEDIT:
+ {
+ // change children state
+ maParaManager.SetActive();
+
+ // per definition, edit mode text has the focus
+ SetFocus( sal_True );
+ break;
+ }
+
+ case HINT_ENDEDIT:
+ {
+ // focused child now looses focus
+ ESelection aSelection;
+ if( GetEditViewForwarder().GetSelection( aSelection ) )
+ SetChildFocus( aSelection.nEndPara, sal_False );
+
+ // change children state
+ maParaManager.SetActive( sal_False );
+
+ maLastSelection = ESelection( EE_PARA_NOT_FOUND, EE_PARA_NOT_FOUND,
+ EE_PARA_NOT_FOUND, EE_PARA_NOT_FOUND);
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ // it's VITAL to keep the SfxSimpleHint last! It's the base of some classes above!
+ else if( pSimpleHint )
+ {
+ switch( pSimpleHint->GetId() )
+ {
+ case SFX_HINT_DYING:
+ // edit source is dying under us, become defunc then
+ try
+ {
+ // make edit source inaccessible
+ // Note: cannot destroy it here, since we're called from there!
+ ShutdownEditSource();
+ }
+ catch( const uno::Exception& ) {}
+
+ break;
+ }
+ }
+ }
+ catch( const uno::Exception& )
+ {
+#ifdef DBG_UTIL
+ OSL_TRACE("AccessibleTextHelper_Impl::ProcessQueue: Unhandled exception.");
+#endif
+ }
+ }
+ }
+ }
+
+ void AccessibleTextHelper_Impl::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ // precondition: solar mutex locked
+ DBG_TESTSOLARMUTEX();
+
+ // precondition: not in a recursion
+ if( mbInNotify )
+ return;
+
+ mbInNotify = sal_True;
+
+ // determine hint type
+ const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
+ const SfxSimpleHint* pSimpleHint = PTR_CAST( SfxSimpleHint, &rHint );
+ const TextHint* pTextHint = PTR_CAST( TextHint, &rHint );
+ const SvxViewHint* pViewHint = PTR_CAST( SvxViewHint, &rHint );
+ const SvxEditSourceHint* pEditSourceHint = PTR_CAST( SvxEditSourceHint, &rHint );
+
+ try
+ {
+ // Process notification event
+ if( pEditSourceHint )
+ {
+ maEventQueue.Append( *pEditSourceHint );
+ // --> OD 2005-12-19 #i27299#
+ if( maEventOpenFrames == 0 )
+ ProcessQueue();
+ // <--
+ }
+ else if( pTextHint )
+ {
+ switch( pTextHint->GetId() )
+ {
+ case TEXT_HINT_BLOCKNOTIFICATION_END:
+ case TEXT_HINT_INPUT_END:
+ --maEventOpenFrames;
+
+ if( maEventOpenFrames == 0 )
+ {
+ // #103483#
+ /* All information should have arrived
+ * now, process queue. As stated in the
+ * above bug, we can often avoid throwing
+ * away all paragraphs by looking forward
+ * in the event queue (searching for
+ * PARAINSERT/REMOVE events). Furthermore,
+ * processing the event queue only at the
+ * end of an interaction cycle, ensures
+ * that the EditEngine state and the
+ * AccessibleText state are the same
+ * (well, mostly. If there are _multiple_
+ * interaction cycles in the EE queues, it
+ * can still happen that EE state is
+ * different. That's so to say broken by
+ * design with that delayed EE event
+ * concept).
+ */
+ ProcessQueue();
+ }
+ break;
+
+ case TEXT_HINT_BLOCKNOTIFICATION_START:
+ case TEXT_HINT_INPUT_START:
+ ++maEventOpenFrames;
+ // --> OD 2005-12-19 #i27299# - no FALLTROUGH
+ // reason: event will not be processes, thus appending
+ // the event isn't necessary.
+ break;
+ // <--
+ default:
+ maEventQueue.Append( *pTextHint );
+ // --> OD 2005-12-19 #i27299#
+ if( maEventOpenFrames == 0 )
+ ProcessQueue();
+ // <--
+ break;
+ }
+ }
+ else if( pViewHint )
+ {
+ maEventQueue.Append( *pViewHint );
+
+ // process visibility right away, if not within an
+ // open EE notification frame. Otherwise, event
+ // processing would be delayed until next EE
+ // notification sequence.
+ if( maEventOpenFrames == 0 )
+ ProcessQueue();
+ }
+ else if( pSdrHint )
+ {
+ maEventQueue.Append( *pSdrHint );
+
+ // process drawing layer events right away, if not
+ // within an open EE notification frame. Otherwise,
+ // event processing would be delayed until next EE
+ // notification sequence.
+ if( maEventOpenFrames == 0 )
+ ProcessQueue();
+ }
+ // it's VITAL to keep the SfxSimpleHint last! It's the base of some classes above!
+ else if( pSimpleHint )
+ {
+ // handle this event _at once_, because after that, objects are invalid
+ switch( pSimpleHint->GetId() )
+ {
+ case SFX_HINT_DYING:
+ // edit source is dying under us, become defunc then
+ maEventQueue.Clear();
+ try
+ {
+ // make edit source inaccessible
+ // Note: cannot destroy it here, since we're called from there!
+ ShutdownEditSource();
+ }
+ catch( const uno::Exception& ) {}
+
+ break;
+ }
+ }
+ }
+ catch( const uno::Exception& )
+ {
+#ifdef DBG_UTIL
+ OSL_TRACE("AccessibleTextHelper_Impl::Notify: Unhandled exception.");
+#endif
+ mbInNotify = sal_False;
+ }
+
+ mbInNotify = sal_False;
+ }
+
+ void AccessibleTextHelper_Impl::Dispose()
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ if( getNotifierClientId() != -1 )
+ {
+ try
+ {
+ // #106234# Unregister from EventNotifier
+ ::comphelper::AccessibleEventNotifier::revokeClient( getNotifierClientId() );
+#ifdef DBG_UTIL
+ OSL_TRACE( "AccessibleTextHelper_Impl disposed ID: %d", mnNotifierClientId );
+#endif
+ }
+ catch( const uno::Exception& ) {}
+
+ mnNotifierClientId = -1;
+ }
+
+ try
+ {
+ // dispose children
+ maParaManager.Dispose();
+ }
+ catch( const uno::Exception& ) {}
+
+ // quit listen on stale edit source
+ if( maEditSource.IsValid() )
+ EndListening( maEditSource.GetBroadcaster() );
+
+ // clear references
+ maEditSource.SetEditSource( ::std::auto_ptr< SvxEditSource >(NULL) );
+ mxFrontEnd = NULL;
+ }
+
+ void AccessibleTextHelper_Impl::FireEvent( const sal_Int16 nEventId, const uno::Any& rNewValue, const uno::Any& rOldValue ) const
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ // -- object locked --
+ ::osl::ClearableMutexGuard aGuard( maMutex );
+
+ AccessibleEventObject aEvent;
+
+ DBG_ASSERT(mxFrontEnd.is(), "AccessibleTextHelper::FireEvent: no event source set" );
+
+ if( mxFrontEnd.is() )
+ aEvent = AccessibleEventObject(mxFrontEnd->getAccessibleContext(), nEventId, rNewValue, rOldValue);
+ else
+ aEvent = AccessibleEventObject(uno::Reference< uno::XInterface >(), nEventId, rNewValue, rOldValue);
+
+ // no locking necessary, FireEvent internally copies listeners
+ // if someone removes/adds in between Further locking,
+ // actually, might lead to deadlocks, since we're calling out
+ // of this object
+ aGuard.clear();
+ // -- until here --
+
+ FireEvent(aEvent);
+ }
+
+ void AccessibleTextHelper_Impl::FireEvent( const AccessibleEventObject& rEvent ) const
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ // #102261# Call global queue for focus events
+ if( rEvent.EventId == AccessibleStateType::FOCUSED )
+ vcl::unohelper::NotifyAccessibleStateEventGlobally( rEvent );
+
+ // #106234# Delegate to EventNotifier
+ ::comphelper::AccessibleEventNotifier::addEvent( getNotifierClientId(),
+ rEvent );
+ }
+
+ // XAccessibleContext
+ sal_Int32 SAL_CALL AccessibleTextHelper_Impl::getAccessibleChildCount() SAL_THROW((uno::RuntimeException))
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ return mnLastVisibleChild - mnFirstVisibleChild + 1;
+ }
+
+ uno::Reference< XAccessible > SAL_CALL AccessibleTextHelper_Impl::getAccessibleChild( sal_Int32 i ) SAL_THROW((lang::IndexOutOfBoundsException, uno::RuntimeException))
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ i -= GetStartIndex();
+
+ if( 0 > i || i >= getAccessibleChildCount() ||
+ GetTextForwarder().GetParagraphCount() <= i )
+ {
+ throw lang::IndexOutOfBoundsException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid child index")), mxFrontEnd);
+ }
+
+ DBG_ASSERT(mxFrontEnd.is(), "AccessibleTextHelper_Impl::UpdateVisibleChildren: no frontend set");
+
+ if( mxFrontEnd.is() )
+ return maParaManager.CreateChild( i, mxFrontEnd, GetEditSource(), mnFirstVisibleChild + i ).first;
+ else
+ return NULL;
+ }
+
+ void SAL_CALL AccessibleTextHelper_Impl::addEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) SAL_THROW((uno::RuntimeException))
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ if( getNotifierClientId() != -1 )
+ ::comphelper::AccessibleEventNotifier::addEventListener( getNotifierClientId(), xListener );
+ }
+
+ void SAL_CALL AccessibleTextHelper_Impl::removeEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) SAL_THROW((uno::RuntimeException))
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ if( getNotifierClientId() != -1 )
+ ::comphelper::AccessibleEventNotifier::removeEventListener( getNotifierClientId(), xListener );
+ }
+
+ uno::Reference< XAccessible > SAL_CALL AccessibleTextHelper_Impl::getAccessibleAtPoint( const awt::Point& _aPoint ) SAL_THROW((uno::RuntimeException))
+ {
+ DBG_CHKTHIS( AccessibleTextHelper_Impl, NULL );
+
+ // make given position relative
+ if( !mxFrontEnd.is() )
+ throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleTextHelper_Impl::getAccessibleAt: frontend invalid")), mxFrontEnd );
+
+ uno::Reference< XAccessibleContext > xFrontEndContext = mxFrontEnd->getAccessibleContext();
+
+ if( !xFrontEndContext.is() )
+ throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleTextHelper_Impl::getAccessibleAt: frontend invalid")), mxFrontEnd );
+
+ uno::Reference< XAccessibleComponent > xFrontEndComponent( xFrontEndContext, uno::UNO_QUERY );
+
+ if( !xFrontEndComponent.is() )
+ throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleTextHelper_Impl::getAccessibleAt: frontend is no XAccessibleComponent")),
+ mxFrontEnd );
+
+ // #103862# No longer need to make given position relative
+ Point aPoint( _aPoint.X, _aPoint.Y );
+
+ // respect EditEngine offset to surrounding shape/cell
+ aPoint -= GetOffset();
+
+ // convert to EditEngine coordinate system
+ SvxTextForwarder& rCacheTF = GetTextForwarder();
+ Point aLogPoint( GetViewForwarder().PixelToLogic( aPoint, rCacheTF.GetMapMode() ) );
+
+ // iterate over all visible children (including those not yet created)
+ sal_Int32 nChild;
+ for( nChild=mnFirstVisibleChild; nChild <= mnLastVisibleChild; ++nChild )
+ {
+ DBG_ASSERT(nChild >= 0 && nChild <= USHRT_MAX,
+ "AccessibleTextHelper_Impl::getAccessibleAt: index value overflow");
+
+ Rectangle aParaBounds( rCacheTF.GetParaBounds( static_cast< sal_uInt16 > (nChild) ) );
+
+ if( aParaBounds.IsInside( aLogPoint ) )
+ return getAccessibleChild( nChild - mnFirstVisibleChild + GetStartIndex() );
+ }
+
+ // found none
+ return NULL;
+ }
+
+ //------------------------------------------------------------------------
+ //
+ // AccessibleTextHelper implementation (simply forwards to impl)
+ //
+ //------------------------------------------------------------------------
+
+ AccessibleTextHelper::AccessibleTextHelper( ::std::auto_ptr< SvxEditSource > pEditSource ) :
+ mpImpl( new AccessibleTextHelper_Impl() )
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ SetEditSource( pEditSource );
+ }
+
+ AccessibleTextHelper::~AccessibleTextHelper()
+ {
+ }
+
+ const SvxEditSource& AccessibleTextHelper::GetEditSource() const SAL_THROW((uno::RuntimeException))
+ {
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+
+ const SvxEditSource& aEditSource = mpImpl->GetEditSource();
+
+ mpImpl->CheckInvariants();
+
+ return aEditSource;
+#else
+ return mpImpl->GetEditSource();
+#endif
+ }
+
+ void AccessibleTextHelper::SetEditSource( ::std::auto_ptr< SvxEditSource > pEditSource ) SAL_THROW((uno::RuntimeException))
+ {
+#ifdef DBG_UTIL
+ // precondition: solar mutex locked
+ DBG_TESTSOLARMUTEX();
+
+ mpImpl->CheckInvariants();
+#endif
+
+ mpImpl->SetEditSource( pEditSource );
+
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+#endif
+ }
+
+ void AccessibleTextHelper::SetEventSource( const uno::Reference< XAccessible >& rInterface )
+ {
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+#endif
+
+ mpImpl->SetEventSource( rInterface );
+
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+#endif
+ }
+
+ uno::Reference< XAccessible > AccessibleTextHelper::GetEventSource() const
+ {
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+
+ uno::Reference< XAccessible > xRet( mpImpl->GetEventSource() );
+
+ mpImpl->CheckInvariants();
+
+ return xRet;
+#else
+ return mpImpl->GetEventSource();
+#endif
+ }
+
+ void AccessibleTextHelper::SetFocus( sal_Bool bHaveFocus ) SAL_THROW((::com::sun::star::uno::RuntimeException))
+ {
+#ifdef DBG_UTIL
+ // precondition: solar mutex locked
+ DBG_TESTSOLARMUTEX();
+
+ mpImpl->CheckInvariants();
+#endif
+
+ mpImpl->SetFocus( bHaveFocus );
+
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+#endif
+ }
+
+ sal_Bool AccessibleTextHelper::HaveFocus() SAL_THROW((::com::sun::star::uno::RuntimeException))
+ {
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+
+ sal_Bool bRet( mpImpl->HaveFocus() );
+
+ mpImpl->CheckInvariants();
+
+ return bRet;
+#else
+ return mpImpl->HaveFocus();
+#endif
+ }
+
+ void AccessibleTextHelper::FireEvent( const sal_Int16 nEventId, const uno::Any& rNewValue, const uno::Any& rOldValue ) const
+ {
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+#endif
+
+ mpImpl->FireEvent( nEventId, rNewValue, rOldValue );
+
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+#endif
+ }
+
+ void AccessibleTextHelper::FireEvent( const AccessibleEventObject& rEvent ) const
+ {
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+#endif
+
+ mpImpl->FireEvent( rEvent );
+
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+#endif
+ }
+
+ void AccessibleTextHelper::SetOffset( const Point& rPoint )
+ {
+#ifdef DBG_UTIL
+ // precondition: solar mutex locked
+ DBG_TESTSOLARMUTEX();
+
+ mpImpl->CheckInvariants();
+#endif
+
+ mpImpl->SetOffset( rPoint );
+
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+#endif
+ }
+
+ Point AccessibleTextHelper::GetOffset() const
+ {
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+
+ Point aPoint( mpImpl->GetOffset() );
+
+ mpImpl->CheckInvariants();
+
+ return aPoint;
+#else
+ return mpImpl->GetOffset();
+#endif
+ }
+
+ void AccessibleTextHelper::SetStartIndex( sal_Int32 nOffset )
+ {
+#ifdef DBG_UTIL
+ // precondition: solar mutex locked
+ DBG_TESTSOLARMUTEX();
+
+ mpImpl->CheckInvariants();
+#endif
+
+ mpImpl->SetStartIndex( nOffset );
+
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+#endif
+ }
+
+ sal_Int32 AccessibleTextHelper::GetStartIndex() const
+ {
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+
+ sal_Int32 nOffset = mpImpl->GetStartIndex();
+
+ mpImpl->CheckInvariants();
+
+ return nOffset;
+#else
+ return mpImpl->GetStartIndex();
+#endif
+ }
+
+ void AccessibleTextHelper::SetAdditionalChildStates( const VectorOfStates& rChildStates )
+ {
+ mpImpl->SetAdditionalChildStates( rChildStates );
+ }
+
+ const AccessibleTextHelper::VectorOfStates& AccessibleTextHelper::GetAdditionalChildStates() const
+ {
+ return mpImpl->GetAdditionalChildStates();
+ }
+
+ void AccessibleTextHelper::UpdateChildren() SAL_THROW((::com::sun::star::uno::RuntimeException))
+ {
+#ifdef DBG_UTIL
+ // precondition: solar mutex locked
+ DBG_TESTSOLARMUTEX();
+
+ mpImpl->CheckInvariants();
+#endif
+
+ mpImpl->UpdateVisibleChildren();
+ mpImpl->UpdateBoundRect();
+
+ mpImpl->UpdateSelection();
+
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+#endif
+ }
+
+ void AccessibleTextHelper::Dispose()
+ {
+ // As Dispose calls ShutdownEditSource, which in turn
+ // deregisters as listener on the edit source, have to lock
+ // here
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+#endif
+
+ mpImpl->Dispose();
+
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+#endif
+ }
+
+ sal_Bool AccessibleTextHelper::IsSelected() const
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+
+ sal_Bool aRet = mpImpl->IsSelected();
+
+ mpImpl->CheckInvariants();
+
+ return aRet;
+#else
+ return mpImpl->IsSelected();
+#endif
+ }
+
+ // XAccessibleContext
+ sal_Int32 AccessibleTextHelper::GetChildCount() SAL_THROW((uno::RuntimeException))
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+
+ sal_Int32 nRet = mpImpl->getAccessibleChildCount();
+
+ mpImpl->CheckInvariants();
+
+ return nRet;
+#else
+ return mpImpl->getAccessibleChildCount();
+#endif
+ }
+
+ uno::Reference< XAccessible > AccessibleTextHelper::GetChild( sal_Int32 i ) SAL_THROW((lang::IndexOutOfBoundsException, uno::RuntimeException))
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+
+ uno::Reference< XAccessible > xRet = mpImpl->getAccessibleChild( i );
+
+ mpImpl->CheckInvariants();
+
+ return xRet;
+#else
+ return mpImpl->getAccessibleChild( i );
+#endif
+ }
+
+ void AccessibleTextHelper::AddEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) SAL_THROW((uno::RuntimeException))
+ {
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+
+ mpImpl->addEventListener( xListener );
+
+ mpImpl->CheckInvariants();
+#else
+ mpImpl->addEventListener( xListener );
+#endif
+ }
+
+ void AccessibleTextHelper::RemoveEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) SAL_THROW((uno::RuntimeException))
+ {
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+
+ mpImpl->removeEventListener( xListener );
+
+ mpImpl->CheckInvariants();
+#else
+ mpImpl->removeEventListener( xListener );
+#endif
+ }
+
+ // XAccessibleComponent
+ uno::Reference< XAccessible > AccessibleTextHelper::GetAt( const awt::Point& aPoint ) SAL_THROW((uno::RuntimeException))
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+#ifdef DBG_UTIL
+ mpImpl->CheckInvariants();
+
+ uno::Reference< XAccessible > xChild = mpImpl->getAccessibleAtPoint( aPoint );
+
+ mpImpl->CheckInvariants();
+
+ return xChild;
+#else
+ return mpImpl->getAccessibleAtPoint( aPoint );
+#endif
+ }
+
+} // end of namespace accessibility
+
+//------------------------------------------------------------------------
diff --git a/svx/source/accessibility/ChildrenManager.cxx b/svx/source/accessibility/ChildrenManager.cxx
new file mode 100644
index 000000000000..89afa1ae073f
--- /dev/null
+++ b/svx/source/accessibility/ChildrenManager.cxx
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/ChildrenManager.hxx>
+#ifndef _SVX_ACCESSIBILITY_CHILDREN_MANAGER_IMPL_HXX
+#include "ChildrenManagerImpl.hxx"
+#endif
+#include <svx/AccessibleShape.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using ::com::sun::star::uno::Reference;
+
+namespace accessibility {
+
+
+//===== AccessibleChildrenManager ===========================================
+
+ChildrenManager::ChildrenManager (
+ const ::com::sun::star::uno::Reference<XAccessible>& rxParent,
+ const ::com::sun::star::uno::Reference<drawing::XShapes>& rxShapeList,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo,
+ AccessibleContextBase& rContext)
+ : mpImpl (NULL)
+{
+ mpImpl = new ChildrenManagerImpl (rxParent, rxShapeList, rShapeTreeInfo, rContext);
+ if (mpImpl != NULL)
+ mpImpl->Init ();
+ else
+ throw uno::RuntimeException(
+ ::rtl::OUString::createFromAscii(
+ "ChildrenManager::ChildrenManager can't create implementation object"), NULL);
+}
+
+
+
+
+ChildrenManager::~ChildrenManager (void)
+{
+ if (mpImpl != NULL)
+ mpImpl->dispose();
+
+ // emtpy
+ OSL_TRACE ("~ChildrenManager");
+}
+
+
+
+
+long ChildrenManager::GetChildCount (void) const throw ()
+{
+ OSL_ASSERT (mpImpl != NULL);
+ return mpImpl->GetChildCount();
+}
+
+
+
+
+::com::sun::star::uno::Reference<XAccessible> ChildrenManager::GetChild (long nIndex)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IndexOutOfBoundsException)
+{
+ OSL_ASSERT (mpImpl != NULL);
+ return mpImpl->GetChild (nIndex);
+}
+
+
+
+
+void ChildrenManager::Update (bool bCreateNewObjectsOnDemand)
+{
+ OSL_ASSERT (mpImpl != NULL);
+ mpImpl->Update (bCreateNewObjectsOnDemand);
+}
+
+
+
+
+void ChildrenManager::SetShapeList (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes>& xShapeList)
+{
+ OSL_ASSERT (mpImpl != NULL);
+ mpImpl->SetShapeList (xShapeList);
+}
+
+
+
+
+void ChildrenManager::AddAccessibleShape (std::auto_ptr<AccessibleShape> pShape)
+{
+ OSL_ASSERT (mpImpl != NULL);
+ mpImpl->AddAccessibleShape (pShape);
+}
+
+
+
+
+void ChildrenManager::ClearAccessibleShapeList (void)
+{
+ OSL_ASSERT (mpImpl != NULL);
+ mpImpl->ClearAccessibleShapeList ();
+}
+
+
+
+
+void ChildrenManager::SetInfo (AccessibleShapeTreeInfo& rShapeTreeInfo)
+{
+ OSL_ASSERT (mpImpl != NULL);
+ mpImpl->SetInfo (rShapeTreeInfo);
+}
+
+
+
+
+void ChildrenManager::UpdateSelection (void)
+{
+ OSL_ASSERT (mpImpl != NULL);
+ mpImpl->UpdateSelection ();
+}
+
+
+
+
+bool ChildrenManager::HasFocus (void)
+{
+ OSL_ASSERT (mpImpl != NULL);
+ return mpImpl->HasFocus ();
+}
+
+
+
+
+void ChildrenManager::RemoveFocus (void)
+{
+ OSL_ASSERT (mpImpl != NULL);
+ mpImpl->RemoveFocus ();
+}
+
+
+
+
+//===== IAccessibleViewForwarderListener ====================================
+void ChildrenManager::ViewForwarderChanged (ChangeType aChangeType,
+ const IAccessibleViewForwarder* pViewForwarder)
+{
+ OSL_ASSERT (mpImpl != NULL);
+ mpImpl->ViewForwarderChanged (aChangeType, pViewForwarder);
+}
+
+
+
+} // end of namespace accessibility
+
diff --git a/svx/source/accessibility/ChildrenManagerImpl.cxx b/svx/source/accessibility/ChildrenManagerImpl.cxx
new file mode 100644
index 000000000000..803388414451
--- /dev/null
+++ b/svx/source/accessibility/ChildrenManagerImpl.cxx
@@ -0,0 +1,1098 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "ChildrenManagerImpl.hxx"
+#include <svx/ShapeTypeHandler.hxx>
+#include <svx/AccessibleShapeInfo.hxx>
+#ifndef _COM_SUN_STAR_ACCESSIBLE_ACCESSIBLESTATETYPE_HPP_
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#endif
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <comphelper/uno3.hxx>
+#include <com/sun/star/container/XChild.hpp>
+
+#include <rtl/ustring.hxx>
+#include <tools/debug.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using ::com::sun::star::uno::Reference;
+
+
+namespace accessibility {
+
+namespace
+{
+void adjustIndexInParentOfShapes(ChildDescriptorListType& _rList)
+{
+ ChildDescriptorListType::iterator aEnd = _rList.end();
+ sal_Int32 i=0;
+ for ( ChildDescriptorListType::iterator aIter = _rList.begin(); aIter != aEnd; ++aIter,++i)
+ aIter->setIndexAtAccessibleShape(i);
+}
+}
+
+//===== AccessibleChildrenManager ===========================================
+
+ChildrenManagerImpl::ChildrenManagerImpl (
+ const uno::Reference<XAccessible>& rxParent,
+ const uno::Reference<drawing::XShapes>& rxShapeList,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo,
+ AccessibleContextBase& rContext)
+ : ::cppu::WeakComponentImplHelper2<
+ ::com::sun::star::document::XEventListener,
+ ::com::sun::star::view::XSelectionChangeListener>(maMutex),
+ mxShapeList (rxShapeList),
+ mxParent (rxParent),
+ maShapeTreeInfo (rShapeTreeInfo),
+ mrContext (rContext),
+ mnNewNameIndex(1),
+ mpFocusedShape(NULL)
+{
+}
+
+
+
+
+ChildrenManagerImpl::~ChildrenManagerImpl (void)
+{
+ DBG_ASSERT (rBHelper.bDisposed || rBHelper.bInDispose,
+ "~AccessibleDrawDocumentView: object has not been disposed");
+}
+
+
+
+
+void ChildrenManagerImpl::Init (void)
+{
+ // Register as view::XSelectionChangeListener.
+ Reference<frame::XController> xController(maShapeTreeInfo.GetController());
+ Reference<view::XSelectionSupplier> xSelectionSupplier (
+ xController, uno::UNO_QUERY);
+ if (xSelectionSupplier.is())
+ {
+ xController->addEventListener(
+ static_cast<document::XEventListener*>(this));
+
+ xSelectionSupplier->addSelectionChangeListener (
+ static_cast<view::XSelectionChangeListener*>(this));
+ }
+
+ // Register at model as document::XEventListener.
+ if (maShapeTreeInfo.GetModelBroadcaster().is())
+ maShapeTreeInfo.GetModelBroadcaster()->addEventListener (
+ static_cast<document::XEventListener*>(this));
+}
+
+
+
+
+long ChildrenManagerImpl::GetChildCount (void) const throw ()
+{
+ return maVisibleChildren.size();
+}
+
+
+
+
+/** Return the requested accessible child object. Create it if it is not
+ yet in the cache.
+*/
+uno::Reference<XAccessible>
+ ChildrenManagerImpl::GetChild (long nIndex)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IndexOutOfBoundsException)
+{
+ // Check wether the given index is valid.
+ if (nIndex < 0 || (unsigned long)nIndex >= maVisibleChildren.size())
+ throw lang::IndexOutOfBoundsException (
+ ::rtl::OUString::createFromAscii(
+ "no accessible child with index ") + nIndex,
+ mxParent);
+
+ return GetChild (maVisibleChildren[nIndex],nIndex);
+}
+
+
+
+
+/** Return the requested accessible child object. Create it if it is not
+ yet in the cache.
+*/
+uno::Reference<XAccessible>
+ ChildrenManagerImpl::GetChild (ChildDescriptor& rChildDescriptor,sal_Int32 _nIndex)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ if ( ! rChildDescriptor.mxAccessibleShape.is())
+ {
+ ::osl::MutexGuard aGuard (maMutex);
+ // Make sure that the requested accessible object has not been
+ // created while locking the global mutex.
+ if ( ! rChildDescriptor.mxAccessibleShape.is())
+ {
+ AccessibleShapeInfo aShapeInfo(
+ rChildDescriptor.mxShape,
+ mxParent,
+ this,
+ mnNewNameIndex++);
+ // Create accessible object that corresponds to the descriptor's
+ // shape.
+ AccessibleShape* pShape =
+ ShapeTypeHandler::Instance().CreateAccessibleObject (
+ aShapeInfo,
+ maShapeTreeInfo);
+ rChildDescriptor.mxAccessibleShape = uno::Reference<XAccessible> (
+ static_cast<uno::XWeak*>(pShape),
+ uno::UNO_QUERY);
+ // Now that there is a reference to the new accessible shape we
+ // can safely call its Init() method.
+ if ( pShape != NULL )
+ {
+ pShape->Init();
+ pShape->setIndexInParent(_nIndex);
+ }
+ }
+ }
+
+ return rChildDescriptor.mxAccessibleShape;
+}
+
+
+
+
+uno::Reference<XAccessible>
+ ChildrenManagerImpl::GetChild (const uno::Reference<drawing::XShape>& xShape)
+ throw (uno::RuntimeException)
+{
+ ChildDescriptorListType::iterator I, aEnd = maVisibleChildren.end();
+ for (I = maVisibleChildren.begin(); I != aEnd; ++I)
+ {
+ if ( I->mxShape.get() == xShape.get() )
+ return I->mxAccessibleShape;
+ }
+ return uno::Reference<XAccessible> ();
+}
+
+
+
+
+/** Find all shapes among the specified shapes that lie fully or partially
+ inside the visible area. Put those shapes into the cleared cache. The
+ corresponding accessible objects will be created on demand.
+
+ At the moment, first all accessible objects are removed from the cache
+ and the appropriate listeners are informed of this. Next, the list is
+ created again. This should be optimized in the future to not remove and
+ create objects that will be in the list before and after the update
+ method.
+*/
+void ChildrenManagerImpl::Update (bool bCreateNewObjectsOnDemand)
+{
+ if (maShapeTreeInfo.GetViewForwarder() == NULL)
+ return;
+ Rectangle aVisibleArea = maShapeTreeInfo.GetViewForwarder()->GetVisibleArea();
+
+ // 1. Create a local list of visible shapes.
+ ChildDescriptorListType aChildList;
+ CreateListOfVisibleShapes (aChildList);
+
+ // 2. Merge the information that is already known about the visible
+ // shapes from the current list into the new list.
+ MergeAccessibilityInformation (aChildList);
+
+ // 3. Replace the current list of visible shapes with the new one. Do
+ // the same with the visible area.
+ {
+ ::osl::MutexGuard aGuard (maMutex);
+ adjustIndexInParentOfShapes(aChildList);
+
+ // Use swap to copy the contents of the new list in constant time.
+ maVisibleChildren.swap (aChildList);
+
+ // aChildList now contains all the old children, while maVisibleChildren
+ // contains all the current children
+
+ // 4. Find all shapes in the old list that are not in the current list,
+ // send appropriate events and remove the accessible shape.
+ //
+ // Do this *after* we have set our new list of children, because
+ // removing a child may cause
+ //
+ // ChildDescriptor::disposeAccessibleObject -->
+ // AccessibleContextBase::CommitChange -->
+ // AtkListener::notifyEvent ->
+ // AtkListener::handleChildRemoved ->
+ // AtkListener::updateChildList
+ // AccessibleDrawDocumentView::getAccessibleChildCount ->
+ // ChildrenManagerImpl::GetChildCount ->
+ // maVisibleChildren.size()
+ //
+ // to be fired, and so the operations will take place on
+ // the list we are trying to replace
+ //
+ RemoveNonVisibleChildren (maVisibleChildren, aChildList);
+
+ aChildList.clear();
+
+ maVisibleArea = aVisibleArea;
+ }
+
+ // 5. If the visible area has changed then send events that signal a
+ // change of their bounding boxes for all shapes that are members of
+ // both the current and the new list of visible shapes.
+ if (maVisibleArea != aVisibleArea)
+ SendVisibleAreaEvents (maVisibleChildren);
+
+ // 6. If children have to be created immediately and not on demand then
+ // create the missing accessible objects now.
+ if ( ! bCreateNewObjectsOnDemand)
+ CreateAccessibilityObjects (maVisibleChildren);
+}
+
+
+
+
+void ChildrenManagerImpl::CreateListOfVisibleShapes (
+ ChildDescriptorListType& raDescriptorList)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ OSL_ASSERT (maShapeTreeInfo.GetViewForwarder() != NULL);
+
+ Rectangle aVisibleArea = maShapeTreeInfo.GetViewForwarder()->GetVisibleArea();
+
+ // Add the visible shapes for wich the accessible objects already exist.
+ AccessibleShapeList::iterator I,aEnd = maAccessibleShapes.end();
+ for (I=maAccessibleShapes.begin(); I != aEnd; ++I)
+ {
+ if (I->is())
+ {
+ uno::Reference<XAccessibleComponent> xComponent (
+ (*I)->getAccessibleContext(), uno::UNO_QUERY);
+ if (xComponent.is())
+ {
+ // The bounding box of the object already is clipped to the
+ // visible area. The object is therefore visible if the
+ // bounding box has non-zero extensions.
+ awt::Rectangle aPixelBBox (xComponent->getBounds());
+ if ((aPixelBBox.Width > 0) && (aPixelBBox.Height > 0))
+ raDescriptorList.push_back (ChildDescriptor (*I));
+ }
+ }
+ }
+
+ // Add the visible shapes for which only the XShapes exist.
+ uno::Reference<container::XIndexAccess> xShapeAccess (mxShapeList, uno::UNO_QUERY);
+ if (xShapeAccess.is())
+ {
+ sal_Int32 nShapeCount = xShapeAccess->getCount();
+ raDescriptorList.reserve( nShapeCount );
+ awt::Point aPos;
+ awt::Size aSize;
+ Rectangle aBoundingBox;
+ uno::Reference<drawing::XShape> xShape;
+ for (sal_Int32 i=0; i<nShapeCount; ++i)
+ {
+ xShapeAccess->getByIndex(i) >>= xShape;
+ aPos = xShape->getPosition();
+ aSize = xShape->getSize();
+
+ aBoundingBox.nLeft = aPos.X;
+ aBoundingBox.nTop = aPos.Y;
+ aBoundingBox.nRight = aPos.X + aSize.Width;
+ aBoundingBox.nBottom = aPos.Y + aSize.Height;
+
+ // Insert shape if it is visible, i.e. its bounding box overlaps
+ // the visible area.
+ if ( aBoundingBox.IsOver (aVisibleArea) )
+ raDescriptorList.push_back (ChildDescriptor (xShape));
+ }
+ }
+}
+
+
+
+
+void ChildrenManagerImpl::RemoveNonVisibleChildren (
+ const ChildDescriptorListType& rNewChildList,
+ ChildDescriptorListType& rOldChildList)
+{
+ // Iterate over list of formerly visible children and remove those that
+ // are not visible anymore, i.e. member of the new list of visible
+ // children.
+ ChildDescriptorListType::iterator I, aEnd = rOldChildList.end();
+ for (I=rOldChildList.begin(); I != aEnd; ++I)
+ {
+ if (::std::find(rNewChildList.begin(), rNewChildList.end(), *I) == rNewChildList.end())
+ {
+ // The child is disposed when there is a UNO shape from which
+ // the accessible shape can be created when the shape becomes
+ // visible again. When there is no such UNO shape then simply
+ // reset the descriptor but keep the accessibility object.
+ if (I->mxShape.is())
+ {
+ UnregisterAsDisposeListener (I->mxShape);
+ I->disposeAccessibleObject (mrContext);
+ }
+ else
+ {
+ AccessibleShape* pAccessibleShape = I->GetAccessibleShape();
+ pAccessibleShape->ResetState (AccessibleStateType::VISIBLE);
+ I->mxAccessibleShape = NULL;
+ }
+ }
+ }
+}
+
+
+
+
+void ChildrenManagerImpl::MergeAccessibilityInformation (
+ ChildDescriptorListType& raNewChildList)
+{
+ ChildDescriptorListType::iterator aOldChildDescriptor;
+ ChildDescriptorListType::iterator I, aEnd = raNewChildList.end();
+ for (I=raNewChildList.begin(); I != aEnd; ++I)
+ {
+ aOldChildDescriptor = ::std::find (maVisibleChildren.begin(), maVisibleChildren.end(), *I);
+
+ // Copy accessible shape if that exists in the old descriptor.
+ bool bRegistrationIsNecessary = true;
+ if (aOldChildDescriptor != maVisibleChildren.end())
+ if (aOldChildDescriptor->mxAccessibleShape.is())
+ {
+ I->mxAccessibleShape = aOldChildDescriptor->mxAccessibleShape;
+ I->mbCreateEventPending = false;
+ bRegistrationIsNecessary = false;
+ }
+ if (bRegistrationIsNecessary)
+ RegisterAsDisposeListener (I->mxShape);
+ }
+}
+
+
+
+
+void ChildrenManagerImpl::SendVisibleAreaEvents (
+ ChildDescriptorListType& raNewChildList)
+{
+ ChildDescriptorListType::iterator I,aEnd = raNewChildList.end();
+ for (I=raNewChildList.begin(); I != aEnd; ++I)
+ {
+ // Tell shape of changed visible area. To do this, fake a
+ // change of the view forwarder. (Actually we usually get here
+ // as a result of a change of the view forwarder).
+ AccessibleShape* pShape = I->GetAccessibleShape ();
+ if (pShape != NULL)
+ pShape->ViewForwarderChanged (
+ IAccessibleViewForwarderListener::VISIBLE_AREA,
+ maShapeTreeInfo.GetViewForwarder());
+ }
+}
+
+
+
+
+void ChildrenManagerImpl::CreateAccessibilityObjects (
+ ChildDescriptorListType& raNewChildList)
+{
+ ChildDescriptorListType::iterator I, aEnd = raNewChildList.end();
+ sal_Int32 nPos = 0;
+ for ( I = raNewChildList.begin(); I != aEnd; ++I,++nPos)
+ {
+ // Create the associated accessible object when the flag says so and
+ // it does not yet exist.
+ if ( ! I->mxAccessibleShape.is() )
+ GetChild (*I,nPos);
+ if (I->mxAccessibleShape.is() && I->mbCreateEventPending)
+ {
+ I->mbCreateEventPending = false;
+ mrContext.CommitChange (
+ AccessibleEventId::CHILD,
+ uno::makeAny(I->mxAccessibleShape),
+ uno::Any());
+ }
+ }
+}
+
+
+
+
+void ChildrenManagerImpl::AddShape (const Reference<drawing::XShape>& rxShape)
+{
+ if (rxShape.is())
+ {
+ ::osl::ClearableMutexGuard aGuard (maMutex);
+
+ // Test visibility of the shape.
+ Rectangle aVisibleArea = maShapeTreeInfo.GetViewForwarder()->GetVisibleArea();
+ awt::Point aPos = rxShape->getPosition();
+ awt::Size aSize = rxShape->getSize();
+
+ Rectangle aBoundingBox (
+ aPos.X,
+ aPos.Y,
+ aPos.X + aSize.Width,
+ aPos.Y + aSize.Height);
+
+ // Add the shape only when it belongs to the list of shapes stored
+ // in mxShapeList (which is either a page or a group shape).
+ Reference<container::XChild> xChild (rxShape, uno::UNO_QUERY);
+ if (xChild.is())
+ {
+ Reference<drawing::XShapes> xParent (xChild->getParent(), uno::UNO_QUERY);
+ if (xParent == mxShapeList)
+ if (aBoundingBox.IsOver (aVisibleArea))
+ {
+ // Add shape to list of visible shapes.
+ maVisibleChildren.push_back (ChildDescriptor (rxShape));
+
+ // Create accessibility object.
+ ChildDescriptor& rDescriptor = maVisibleChildren.back();
+ GetChild (rDescriptor, maVisibleChildren.size()-1);
+
+ // Inform listeners about new child.
+ uno::Any aNewShape;
+ aNewShape <<= rDescriptor.mxAccessibleShape;
+ aGuard.clear();
+ mrContext.CommitChange (
+ AccessibleEventId::CHILD,
+ aNewShape,
+ uno::Any());
+ RegisterAsDisposeListener (rDescriptor.mxShape);
+ }
+ }
+ }
+}
+
+
+
+
+void ChildrenManagerImpl::RemoveShape (const Reference<drawing::XShape>& rxShape)
+{
+ if (rxShape.is())
+ {
+ ::osl::ClearableMutexGuard aGuard (maMutex);
+
+ // Search shape in list of visible children.
+ ChildDescriptorListType::iterator I (
+ ::std::find (maVisibleChildren.begin(), maVisibleChildren.end(),
+ ChildDescriptor (rxShape)));
+ if (I != maVisibleChildren.end())
+ {
+ // Remove descriptor from that list.
+ Reference<XAccessible> xAccessibleShape (I->mxAccessibleShape);
+
+ UnregisterAsDisposeListener (I->mxShape);
+ // Dispose the accessible object.
+ I->disposeAccessibleObject (mrContext);
+
+ // Now we can safely remove the child descriptor and thus
+ // invalidate the iterator.
+ maVisibleChildren.erase (I);
+
+ adjustIndexInParentOfShapes(maVisibleChildren);
+ }
+ }
+}
+
+
+
+
+void ChildrenManagerImpl::SetShapeList (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes>& xShapeList)
+{
+ mxShapeList = xShapeList;
+}
+
+
+
+
+void ChildrenManagerImpl::AddAccessibleShape (std::auto_ptr<AccessibleShape> pShape)
+{
+ if (pShape.get() != NULL)
+ maAccessibleShapes.push_back (pShape.release());
+}
+
+
+
+
+void ChildrenManagerImpl::ClearAccessibleShapeList (void)
+{
+ // Copy the list of (visible) shapes to local lists and clear the
+ // originals.
+ ChildDescriptorListType aLocalVisibleChildren;
+ aLocalVisibleChildren.swap(maVisibleChildren);
+ AccessibleShapeList aLocalAccessibleShapes;
+ aLocalAccessibleShapes.swap(maAccessibleShapes);
+
+ // Tell the listeners that all children are gone.
+ mrContext.CommitChange (
+ AccessibleEventId::INVALIDATE_ALL_CHILDREN,
+ uno::Any(),
+ uno::Any());
+
+ // There are no accessible shapes left so the index assigned to new
+ // accessible shapes can be reset.
+ mnNewNameIndex = 1;
+
+ // Now the objects in the local lists can be safely disposed without
+ // having problems with callers that want to update their child lists.
+
+ // Clear the list of visible accessible objects. Objects not created on
+ // demand for XShapes are treated below.
+ ChildDescriptorListType::iterator I,aEnd = aLocalVisibleChildren.end();
+ for (I=aLocalVisibleChildren.begin(); I != aEnd; ++I)
+ if ( I->mxAccessibleShape.is() && I->mxShape.is() )
+ {
+ ::comphelper::disposeComponent(I->mxAccessibleShape);
+ I->mxAccessibleShape = NULL;
+ }
+
+ // Dispose all objects in the accessible shape list.
+ AccessibleShapeList::iterator J,aEnd2 = aLocalAccessibleShapes.end();
+ for (J=aLocalAccessibleShapes.begin(); J != aEnd2; ++J)
+ if (J->is())
+ {
+ // Dispose the object.
+ ::comphelper::disposeComponent(*J);
+ *J = NULL;
+ }
+}
+
+
+
+
+/** If the broadcasters change at which this object is registered then
+ unregister at old and register at new broadcasters.
+*/
+void ChildrenManagerImpl::SetInfo (const AccessibleShapeTreeInfo& rShapeTreeInfo)
+{
+ // Remember the current broadcasters and exchange the shape tree info.
+ Reference<document::XEventBroadcaster> xCurrentBroadcaster;
+ Reference<frame::XController> xCurrentController;
+ Reference<view::XSelectionSupplier> xCurrentSelectionSupplier;
+ {
+ ::osl::MutexGuard aGuard (maMutex);
+ xCurrentBroadcaster = maShapeTreeInfo.GetModelBroadcaster();
+ xCurrentController = maShapeTreeInfo.GetController();
+ xCurrentSelectionSupplier = Reference<view::XSelectionSupplier> (
+ xCurrentController, uno::UNO_QUERY);
+ maShapeTreeInfo = rShapeTreeInfo;
+ }
+
+ // Move registration to new model.
+ if (maShapeTreeInfo.GetModelBroadcaster() != xCurrentBroadcaster)
+ {
+ // Register at new broadcaster.
+ if (maShapeTreeInfo.GetModelBroadcaster().is())
+ maShapeTreeInfo.GetModelBroadcaster()->addEventListener (
+ static_cast<document::XEventListener*>(this));
+
+ // Unregister at old broadcaster.
+ if (xCurrentBroadcaster.is())
+ xCurrentBroadcaster->removeEventListener (
+ static_cast<document::XEventListener*>(this));
+ }
+
+ // Move registration to new selection supplier.
+ Reference<frame::XController> xNewController(maShapeTreeInfo.GetController());
+ Reference<view::XSelectionSupplier> xNewSelectionSupplier (
+ xNewController, uno::UNO_QUERY);
+ if (xNewSelectionSupplier != xCurrentSelectionSupplier)
+ {
+ // Register at new broadcaster.
+ if (xNewSelectionSupplier.is())
+ {
+ xNewController->addEventListener(
+ static_cast<document::XEventListener*>(this));
+
+ xNewSelectionSupplier->addSelectionChangeListener (
+ static_cast<view::XSelectionChangeListener*>(this));
+ }
+
+ // Unregister at old broadcaster.
+ if (xCurrentSelectionSupplier.is())
+ {
+ xCurrentSelectionSupplier->removeSelectionChangeListener (
+ static_cast<view::XSelectionChangeListener*>(this));
+
+ xCurrentController->removeEventListener(
+ static_cast<document::XEventListener*>(this));
+ }
+ }
+}
+
+
+
+
+//===== lang::XEventListener ================================================
+
+void SAL_CALL
+ ChildrenManagerImpl::disposing (const lang::EventObject& rEventObject)
+ throw (uno::RuntimeException)
+{
+ if (rEventObject.Source == maShapeTreeInfo.GetModelBroadcaster()
+ || rEventObject.Source == maShapeTreeInfo.GetController())
+ {
+ impl_dispose();
+ }
+
+ // Handle disposing UNO shapes.
+ else
+ {
+ Reference<drawing::XShape> xShape (rEventObject.Source, uno::UNO_QUERY);
+
+ // Find the descriptor for the given shape.
+ ChildDescriptorListType::iterator I (
+ ::std::find (maVisibleChildren.begin(), maVisibleChildren.end(),
+ ChildDescriptor (xShape)));
+ if (I != maVisibleChildren.end())
+ {
+ // Clear the descriptor.
+ I->disposeAccessibleObject (mrContext);
+ I->mxShape = NULL;
+ }
+ }
+}
+
+
+
+
+//===== document::XEventListener ============================================
+
+/** Listen for new and removed shapes.
+*/
+void SAL_CALL
+ ChildrenManagerImpl::notifyEvent (
+ const document::EventObject& rEventObject)
+ throw (uno::RuntimeException)
+{
+ static const ::rtl::OUString sShapeInserted (
+ RTL_CONSTASCII_USTRINGPARAM("ShapeInserted"));
+ static const ::rtl::OUString sShapeRemoved (
+ RTL_CONSTASCII_USTRINGPARAM("ShapeRemoved"));
+
+
+ if (rEventObject.EventName.equals (sShapeInserted))
+ AddShape (Reference<drawing::XShape>(rEventObject.Source, uno::UNO_QUERY));
+ else if (rEventObject.EventName.equals (sShapeRemoved))
+ RemoveShape (Reference<drawing::XShape>(rEventObject.Source, uno::UNO_QUERY));
+ // else ignore unknown event.
+}
+
+
+
+
+//===== view::XSelectionChangeListener ======================================
+
+void SAL_CALL
+ ChildrenManagerImpl::selectionChanged (const lang::EventObject& /*rEvent*/)
+ throw (uno::RuntimeException)
+{
+ UpdateSelection ();
+}
+
+
+
+
+void ChildrenManagerImpl::impl_dispose (void)
+{
+ Reference<frame::XController> xController(maShapeTreeInfo.GetController());
+ // Remove from broadcasters.
+ try
+ {
+ Reference<view::XSelectionSupplier> xSelectionSupplier (
+ xController, uno::UNO_QUERY);
+ if (xSelectionSupplier.is())
+ {
+ xSelectionSupplier->removeSelectionChangeListener (
+ static_cast<view::XSelectionChangeListener*>(this));
+ }
+ }
+ catch( uno::RuntimeException&)
+ {}
+
+ try
+ {
+ if (xController.is())
+ xController->removeEventListener(
+ static_cast<document::XEventListener*>(this));
+ }
+ catch( uno::RuntimeException&)
+ {}
+
+ maShapeTreeInfo.SetController (NULL);
+
+ try
+ {
+ // Remove from broadcaster.
+ if (maShapeTreeInfo.GetModelBroadcaster().is())
+ maShapeTreeInfo.GetModelBroadcaster()->removeEventListener (
+ static_cast<document::XEventListener*>(this));
+ maShapeTreeInfo.SetModelBroadcaster (NULL);
+ }
+ catch( uno::RuntimeException& )
+ {}
+
+ ClearAccessibleShapeList ();
+ SetShapeList (NULL);
+}
+
+
+
+void SAL_CALL ChildrenManagerImpl::disposing (void)
+{
+ impl_dispose();
+}
+
+
+
+
+// This method is experimental. Use with care.
+long int ChildrenManagerImpl::GetChildIndex (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& xChild) const
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+ sal_Int32 nCount = maVisibleChildren.size();
+ for (sal_Int32 i=0; i < nCount; ++i)
+ {
+ // Is this equality comparison valid?
+ if (maVisibleChildren[i].mxAccessibleShape == xChild)
+ return i;
+ }
+
+ return -1;
+}
+
+
+
+
+//===== IAccessibleViewForwarderListener ====================================
+
+void ChildrenManagerImpl::ViewForwarderChanged (ChangeType aChangeType,
+ const IAccessibleViewForwarder* pViewForwarder)
+{
+ if (aChangeType == IAccessibleViewForwarderListener::VISIBLE_AREA)
+ Update (false);
+ else
+ {
+ ::osl::MutexGuard aGuard (maMutex);
+ ChildDescriptorListType::iterator I, aEnd = maVisibleChildren.end();
+ for (I=maVisibleChildren.begin(); I != aEnd; ++I)
+ {
+ AccessibleShape* pShape = I->GetAccessibleShape();
+ if (pShape != NULL)
+ pShape->ViewForwarderChanged (aChangeType, pViewForwarder);
+ }
+ }
+}
+
+
+
+
+//===== IAccessibleParent ===================================================
+
+sal_Bool ChildrenManagerImpl::ReplaceChild (
+ AccessibleShape* pCurrentChild,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& _rxShape,
+ const long _nIndex,
+ const AccessibleShapeTreeInfo& _rShapeTreeInfo)
+ throw (uno::RuntimeException)
+{
+ AccessibleShapeInfo aShapeInfo( _rxShape, pCurrentChild->getAccessibleParent(), this, _nIndex );
+ // create the new child
+ AccessibleShape* pNewChild = ShapeTypeHandler::Instance().CreateAccessibleObject (
+ aShapeInfo,
+ _rShapeTreeInfo
+ );
+ Reference< XAccessible > xNewChild( pNewChild ); // keep this alive (do this before calling Init!)
+ if ( pNewChild )
+ pNewChild->Init();
+
+ sal_Bool bResult = sal_False;
+
+ // Iterate over the visible children. If one of them has an already
+ // created accessible object that matches pCurrentChild then replace
+ // it. Otherwise the child to replace is either not in the list or has
+ // not ye been created (and is therefore not in the list, too) and a
+ // replacement is not necessary.
+ ChildDescriptorListType::iterator I,aEnd = maVisibleChildren.end();
+ for (I=maVisibleChildren.begin(); I != aEnd; ++I)
+ {
+ if (I->GetAccessibleShape() == pCurrentChild)
+ {
+ // Dispose the current child and send an event about its deletion.
+ pCurrentChild->dispose();
+ mrContext.CommitChange (
+ AccessibleEventId::CHILD,
+ uno::Any(),
+ uno::makeAny (I->mxAccessibleShape));
+
+ // Replace with replacement and send an event about existance
+ // of the new child.
+ I->mxAccessibleShape = pNewChild;
+ mrContext.CommitChange (
+ AccessibleEventId::CHILD,
+ uno::makeAny (I->mxAccessibleShape),
+ uno::Any());
+ bResult = sal_True;
+ break;
+ }
+ }
+
+ // When not found among the visible children we have to search the list
+ // of accessible shapes. This is not yet implemented.
+
+ return bResult;
+}
+
+
+
+
+/** Update the <const>SELECTED</const> and the <const>FOCUSED</const> state
+ of all visible children. Maybe this should be changed to all children.
+
+ Iterate over all descriptors of visible accessible shapes and look them
+ up in the selection.
+
+ If there is no valid controller then all shapes are deselected and
+ unfocused. If the controller's frame is not active then all shapes are
+ unfocused.
+*/
+void ChildrenManagerImpl::UpdateSelection (void)
+{
+ Reference<frame::XController> xController(maShapeTreeInfo.GetController());
+ Reference<view::XSelectionSupplier> xSelectionSupplier (
+ xController, uno::UNO_QUERY);
+
+ // Try to cast the selection both to a multi selection and to a single
+ // selection.
+ Reference<container::XIndexAccess> xSelectedShapeAccess;
+ Reference<drawing::XShape> xSelectedShape;
+ if (xSelectionSupplier.is())
+ {
+ xSelectedShapeAccess = Reference<container::XIndexAccess> (
+ xSelectionSupplier->getSelection(), uno::UNO_QUERY);
+ xSelectedShape = Reference<drawing::XShape> (
+ xSelectionSupplier->getSelection(), uno::UNO_QUERY);
+ }
+
+ // Remember the current and new focused shape.
+ AccessibleShape* pCurrentlyFocusedShape = NULL;
+ AccessibleShape* pNewFocusedShape = NULL;
+
+ ChildDescriptorListType::iterator I, aEnd = maVisibleChildren.end();
+ for (I=maVisibleChildren.begin(); I != aEnd; ++I)
+ {
+ AccessibleShape* pAccessibleShape = I->GetAccessibleShape();
+ if (I->mxAccessibleShape.is() && I->mxShape.is() && pAccessibleShape!=NULL)
+ {
+ bool bShapeIsSelected = false;
+
+ // Look up the shape in the (single or multi-) selection.
+ if (xSelectedShape.is())
+ {
+ if (I->mxShape == xSelectedShape)
+ {
+ bShapeIsSelected = true;
+ pNewFocusedShape = pAccessibleShape;
+ }
+ }
+ else if (xSelectedShapeAccess.is())
+ {
+ sal_Int32 nCount=xSelectedShapeAccess->getCount();
+ for (sal_Int32 i=0; i<nCount&&!bShapeIsSelected; i++)
+ if (xSelectedShapeAccess->getByIndex(i) == I->mxShape)
+ {
+ bShapeIsSelected = true;
+ // In a multi-selection no shape has the focus.
+ if (nCount == 1)
+ pNewFocusedShape = pAccessibleShape;
+ }
+ }
+
+ // Set or reset the SELECTED state.
+ if (bShapeIsSelected)
+ pAccessibleShape->SetState (AccessibleStateType::SELECTED);
+ else
+ pAccessibleShape->ResetState (AccessibleStateType::SELECTED);
+
+ // Does the shape have the current selection?
+ if (pAccessibleShape->GetState (AccessibleStateType::FOCUSED))
+ pCurrentlyFocusedShape = pAccessibleShape;
+ }
+ }
+
+ // Check if the frame we are in is currently active. If not then make
+ // sure to not send a FOCUSED state change.
+ if (xController.is())
+ {
+ Reference<frame::XFrame> xFrame (xController->getFrame());
+ if (xFrame.is())
+ if ( ! xFrame->isActive())
+ pNewFocusedShape = NULL;
+ }
+
+ // Move focus from current to newly focused shape.
+ if (pCurrentlyFocusedShape != pNewFocusedShape)
+ {
+ if (pCurrentlyFocusedShape != NULL)
+ pCurrentlyFocusedShape->ResetState (AccessibleStateType::FOCUSED);
+ if (pNewFocusedShape != NULL)
+ pNewFocusedShape->SetState (AccessibleStateType::FOCUSED);
+ }
+
+ // Remember whether there is a shape that now has the focus.
+ mpFocusedShape = pNewFocusedShape;
+}
+
+
+
+
+bool ChildrenManagerImpl::HasFocus (void)
+{
+ return mpFocusedShape != NULL;
+}
+
+
+
+
+void ChildrenManagerImpl::RemoveFocus (void)
+{
+ if (mpFocusedShape != NULL)
+ {
+ mpFocusedShape->ResetState (AccessibleStateType::FOCUSED);
+ mpFocusedShape = NULL;
+ }
+}
+
+
+
+void ChildrenManagerImpl::RegisterAsDisposeListener (
+ const Reference<drawing::XShape>& xShape)
+{
+ Reference<lang::XComponent> xComponent (xShape, uno::UNO_QUERY);
+ if (xComponent.is())
+ xComponent->addEventListener (
+ static_cast<document::XEventListener*>(this));
+}
+
+
+
+
+void ChildrenManagerImpl::UnregisterAsDisposeListener (
+ const Reference<drawing::XShape>& xShape)
+{
+ Reference<lang::XComponent> xComponent (xShape, uno::UNO_QUERY);
+ if (xComponent.is())
+ xComponent->removeEventListener (
+ static_cast<document::XEventListener*>(this));
+}
+
+
+
+
+//===== AccessibleChildDescriptor ===========================================
+
+ChildDescriptor::ChildDescriptor (const Reference<drawing::XShape>& xShape)
+ : mxShape (xShape),
+ mxAccessibleShape (NULL),
+ mbCreateEventPending (true)
+{
+ // Empty.
+}
+
+
+
+
+ChildDescriptor::ChildDescriptor (const Reference<XAccessible>& rxAccessibleShape)
+ : mxShape (NULL),
+ mxAccessibleShape (rxAccessibleShape),
+ mbCreateEventPending (true)
+{
+ // Make sure that the accessible object has the <const>VISIBLE</const>
+ // state set.
+ AccessibleShape* pAccessibleShape = GetAccessibleShape();
+ pAccessibleShape->SetState (AccessibleStateType::VISIBLE);
+}
+
+
+
+
+ChildDescriptor::~ChildDescriptor (void)
+{
+}
+
+
+
+
+AccessibleShape* ChildDescriptor::GetAccessibleShape (void) const
+{
+ return static_cast<AccessibleShape*> (mxAccessibleShape.get());
+}
+// -----------------------------------------------------------------------------
+void ChildDescriptor::setIndexAtAccessibleShape(sal_Int32 _nIndex)
+{
+ AccessibleShape* pShape = GetAccessibleShape();
+ if ( pShape )
+ pShape->setIndexInParent(_nIndex);
+}
+// -----------------------------------------------------------------------------
+
+
+
+
+void ChildDescriptor::disposeAccessibleObject (AccessibleContextBase& rParent)
+{
+ if (mxAccessibleShape.is())
+ {
+ // Send event that the shape has been removed.
+ uno::Any aOldValue;
+ aOldValue <<= mxAccessibleShape;
+ rParent.CommitChange (
+ AccessibleEventId::CHILD,
+ uno::Any(),
+ aOldValue);
+
+ // Dispose and remove the object.
+ Reference<lang::XComponent> xComponent (mxAccessibleShape, uno::UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose ();
+
+ mxAccessibleShape = NULL;
+ }
+}
+
+
+} // end of namespace accessibility
+
diff --git a/svx/source/accessibility/ChildrenManagerImpl.hxx b/svx/source/accessibility/ChildrenManagerImpl.hxx
new file mode 100644
index 000000000000..9e82a96434db
--- /dev/null
+++ b/svx/source/accessibility/ChildrenManagerImpl.hxx
@@ -0,0 +1,577 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_ACCESSIBILITY_CHILDREN_MANAGER_IMPL_HXX
+
+#include <svx/IAccessibleViewForwarderListener.hxx>
+#include <svx/IAccessibleParent.hxx>
+#include <svx/AccessibleShapeTreeInfo.hxx>
+#include <editeng/AccessibleContextBase.hxx>
+#include <cppuhelper/compbase2.hxx>
+#include <vos/mutex.hxx>
+#include <vector>
+#include <memory>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/document/XEventListener.hpp>
+#include <com/sun/star/view/XSelectionChangeListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star;
+
+namespace accessibility {
+
+class AccessibleShape;
+
+class ChildDescriptor; // See below for declaration.
+typedef ::std::vector<ChildDescriptor> ChildDescriptorListType;
+
+// Re-using MutexOwner class defined in AccessibleContextBase.hxx
+
+/** This class contains the actual implementation of the children manager.
+
+ <p>It maintains a set of visible accessible shapes in
+ <member>maVisibleChildren</member>. The objects in this list stem from
+ two sources. The first is a list of UNO shapes like the list of shapes
+ in a draw page. A reference to this list is held in
+ <member>maShapeList</member>. Accessible objects for these shapes are
+ created on demand. The list can be replaced by calls to the
+ <member>SetShapeList</member> method. The second source is a list of
+ already accessible objects. It can be modified by calls to the
+ <member>AddAccessibleShape</member> and
+ <member>ClearAccessibleShapeList</member> methods.</p>
+
+ <p>Each call of the <member>Update</member> method leads to a
+ re-calculation of the visible shapes which then can be queried with the
+ <member>GetChildCount</member> and <member>GetChild</member> methods.
+ Events are send informing all listeners about the removed shapes which are
+ not visible anymore and about the added shapes.</p>
+
+ <p> The visible area which is used to determine the visibility of the
+ shapes is taken from the view forwarder. Thus, to signal a change of
+ the visible area call <member>ViewForwarderChanged</member>.</p>
+
+ <p>The children manager adds itself as disposing() listener at every UNO
+ shape it creates an accessible object for so that when the UNO shape
+ passes away it can dispose() the associated accessible object.</p>
+
+ @see ChildrenManager
+*/
+class ChildrenManagerImpl
+ : public MutexOwner,
+ public cppu::WeakComponentImplHelper2<
+ ::com::sun::star::document::XEventListener,
+ ::com::sun::star::view::XSelectionChangeListener>,
+ public IAccessibleViewForwarderListener,
+ public IAccessibleParent
+{
+public:
+ /** Create a children manager, which manages the children of the given
+ parent. The parent is used for creating accessible objects. The
+ list of shapes for which to create those objects is not derived from
+ the parent and has to be provided seperately by calling one of the
+ update methods.
+ @param rxParent
+ The parent of the accessible objects which will be created
+ on demand at some point of time in the future.
+ @param rxShapeList
+ List of UNO shapes to manage.
+ @param rShapeTreeInfo
+ Bundel of information passed down the shape tree.
+ @param rContext
+ An accessible context object that is called for fireing events
+ for new and deleted children, i.e. that holds a list of
+ listeners to be informed.
+ */
+ ChildrenManagerImpl (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes>& rxShapeList,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo,
+ AccessibleContextBase& rContext);
+
+ /** If there still are managed children these are disposed and
+ released.
+ */
+ ~ChildrenManagerImpl (void);
+
+ /** Do that part of the initialization that you can not or should not do
+ in the constructor like registering at broadcasters.
+ */
+ void Init (void);
+
+ /** Return the number of currently visible accessible children.
+ @return
+ If there are no children a 0 is returned.
+ */
+ long GetChildCount (void) const throw ();
+
+ /** Return the requested accessible child or throw and
+ IndexOutOfBoundsException if the given index is invalid.
+ @param nIndex
+ Index of the requested child. Call getChildCount for obtaining
+ the number of children.
+ @return
+ In case of a valid index this method returns a reference to the
+ requested accessible child. This reference is empty if it has
+ not been possible to create the accessible object of the
+ corresponding shape.
+ @raises
+ Throws an IndexOutOfBoundsException if the index is not valid.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>
+ GetChild (long nIndex)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IndexOutOfBoundsException);
+
+ /** Return the requested accessible child.
+ @param aChildDescriptor
+ This object contains references to the original shape and its
+ associated accessible object.
+ @param _nIndex
+ The index which will be used in getAccessibleIndexInParent of the accessible shape.
+ @return
+ Returns a reference to the requested accessible child. This
+ reference is empty if it has not been possible to create the
+ accessible object of the corresponding shape.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>
+ GetChild (ChildDescriptor& aChildDescriptor,sal_Int32 _nIndex)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return the requested accessible child given a shape. This method
+ searches the list of descriptors for the one that holds the
+ association of the given shape to the requested accessible object
+ and returns that. If no such descriptor is found that is
+ interpreted so that the specified shape is not visible at the moment.
+ @param xShape
+ The shape for which to return the associated accessible object.
+ @return
+ Returns a reference to the requested accessible child. The
+ reference is empty if there is no shape descriptor that
+ associates the shape with an accessible object.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>
+ GetChild (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape>& xShape)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Update the child manager. Take care of a modified set of children
+ and modified visible area. This method can optimize the update
+ process with respect seperate updates of a modified children list
+ and visible area.
+ @param bCreateNewObjectsOnDemand
+ If </true> then accessible objects associated with the visible
+ shapes are created only when asked for. No event is sent on
+ creation. If </false> then the accessible objects are created
+ before this method returns and events are sent to inform the
+ listeners of the new object.
+ */
+ void Update (bool bCreateNewObjectsOnDemand = true);
+
+ /** Set the list of UNO shapes to the given list. This removes the old
+ list and does not add to it. The list of accessible shapes that is
+ build up by calls to <member>AddAccessibleShape</member> is not
+ modified. Neither is the list of visible children. Accessible
+ objects are created on demand.
+ @param xShapeList
+ The list of UNO shapes that replaces the old list.
+ */
+ void SetShapeList (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes>& xShapeList);
+
+ /** Add a accessible shape. This does not modify the list of UNO shapes
+ or the list of visible shapes. Accessible shapes are, at the
+ moment, not tested against the visible area but are always appended
+ to the list of visible children.
+ @param pShape
+ The new shape that is added to the list of accessible shapes.
+ */
+ void AddAccessibleShape (std::auto_ptr<AccessibleShape> pShape);
+
+ /** Clear the lists of accessible shapes and that of visible accessible
+ shapes. The list of UNO shapes is not modified.
+ */
+ void ClearAccessibleShapeList (void);
+
+ /** Set a new event shape tree info. Call this method to inform the
+ children manager of a change of the info bundle.
+ @param rShapeTreeInfo
+ The new info that replaces the current one.
+ */
+ void SetInfo (const AccessibleShapeTreeInfo& rShapeTreeInfo);
+
+ /** Update the SELECTED and FOCUSED states of all visible children
+ according to the given selection. This includes setting
+ <em>and</em> resetting the states.
+ */
+ void UpdateSelection (void);
+
+ /** Return whether one of the shapes managed by this object has
+ currently the focus.
+ @return
+ Returns <true/> when there is a shape that has the focus and
+ <false/> when there is no such shape.
+ */
+ bool HasFocus (void);
+
+ /** When there is a shape that currently has the focus,
+ i.e. <member>HasFocus()</member> returns <true/> then remove the
+ focus from that shape. Otherwise nothing changes.
+ */
+ void RemoveFocus (void);
+
+ //===== lang::XEventListener ============================================
+
+ virtual void SAL_CALL
+ disposing (const ::com::sun::star::lang::EventObject& rEventObject)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //===== document::XEventListener ========================================
+
+ virtual void SAL_CALL
+ notifyEvent (const ::com::sun::star::document::EventObject& rEventObject)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //===== view::XSelectionChangeListener ==================================
+
+ virtual void SAL_CALL
+ selectionChanged (const ::com::sun::star::lang::EventObject& rEvent)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //===== IAccessibleViewForwarderListener ================================
+
+ /** Informs this children manager and its children about a change of one
+ (or more) aspect of the view forwarder.
+ @param aChangeType
+ A change type of <const>VISIBLE_AREA</const> leads to a call to
+ the <member>Update</memeber> which creates accessible objects of
+ new shapes immediately. Other change types are passed to the
+ visible accessible children without calling
+ <member>Update</memeber>.
+ @param pViewForwarder
+ The modified view forwarder. Use this one from now on.
+ */
+ virtual void ViewForwarderChanged (ChangeType aChangeType,
+ const IAccessibleViewForwarder* pViewForwarder);
+
+ //===== IAccessibleParent ===============================================
+
+ /** Replace the specified child with a replacement.
+ @param pCurrentChild
+ This child is to be replaced.
+ @param pReplacement
+ The replacement for the current child.
+ @return
+ The returned value indicates wether the replacement has been
+ finished successfully.
+ */
+ virtual sal_Bool ReplaceChild (
+ AccessibleShape* pCurrentChild,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& _rxShape,
+ const long _nIndex,
+ const AccessibleShapeTreeInfo& _rShapeTreeInfo
+ ) throw (::com::sun::star::uno::RuntimeException);
+
+
+protected:
+ /** This list holds the descriptors of all currently visible shapes and
+ associated accessible object.
+
+ <p>With the descriptors it maintains a mapping of shapes to
+ accessible objects. It acts as a cache in that accessible objects
+ are only created on demand and released with every update (where the
+ latter may be optimized by the update methods).<p>
+
+ <p>The list is realized as a vector because it remains unchanged
+ between updates (i.e. complete rebuilds of the list) and allows a
+ fast (constant time) access to its elements for given indices.</p>
+ */
+ ChildDescriptorListType maVisibleChildren;
+
+ /** The original list of UNO shapes. The visible shapes are inserted
+ into the list of visible children
+ <member>maVisibleChildren</member>.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes> mxShapeList;
+
+ /** This list of additional accessible shapes that can or shall not be
+ created by the shape factory.
+ */
+ typedef std::vector< ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> > AccessibleShapeList;
+ AccessibleShapeList maAccessibleShapes;
+
+ /** Rectangle that describes the visible area in which a shape has to lie
+ at least partly, to be accessible through this class. Used to
+ detect changes of the visible area after changes of the view forwarder.
+ */
+ Rectangle maVisibleArea;
+
+ /** The parent of the shapes. It is used for creating accessible
+ objects for given shapes.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> mxParent;
+
+ /** Bundel of information passed down the shape tree.
+ */
+ AccessibleShapeTreeInfo maShapeTreeInfo;
+
+ /** Reference to an accessible context object that is used to inform its
+ listeners of new and remved children.
+ */
+ AccessibleContextBase& mrContext;
+
+ /** This method is called from the component helper base class while
+ disposing.
+ */
+ virtual void SAL_CALL disposing (void);
+
+ /** Experimental: Get the index of the specified accessible object with
+ respect to the list of children maintained by this object.
+
+ @return
+ Return the index of the given child or -1 to indicate that the
+ child is unknown.
+ */
+ long GetChildIndex (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& xChild) const
+ throw (::com::sun::star::uno::RuntimeException);
+
+ void impl_dispose (void);
+
+private:
+ /** Names of new accessible objects are disambiguated with this index.
+ It gets increased every time a new object is created and (at the
+ moment) never reset.
+ */
+ sal_Int32 mnNewNameIndex;
+
+ // Don't use the copy constructor or the assignment operator. They are
+ // not implemented (and are not intended to be).
+ ChildrenManagerImpl (const ChildrenManagerImpl&);
+ ChildrenManagerImpl& operator= (const ChildrenManagerImpl&);
+
+ /** This member points to the currently focused shape. It is NULL when
+ there is no focused shape.
+ */
+ AccessibleShape* mpFocusedShape;
+
+ /** Three helper functions for the <member>Update</member> method.
+ */
+
+ /** Create a list of visible shapes from the list of UNO shapes
+ <member>maShapeList</member> and the list of accessible objects.
+ @param raChildList
+ For every visible shape from the two sources mentioned above one
+ descriptor is added to this list.
+ */
+ void CreateListOfVisibleShapes (ChildDescriptorListType& raChildList);
+
+ /** From the old list of (former) visible shapes remove those that
+ are not member of the new list. Send appropriate events for every
+ such shape.
+ @param raNewChildList
+ The new list of visible children against which the old one
+ is compared.
+ @param raOldChildList
+ The old list of visible children against which the new one
+ is compared.
+ */
+ void RemoveNonVisibleChildren (
+ const ChildDescriptorListType& raNewChildList,
+ ChildDescriptorListType& raOldChildList);
+
+ /** Merge the information that is already known about the visible shapes
+ from the current list into the new list.
+ @param raChildList
+ Information is merged from the current list of visible children
+ to this list.
+ */
+ void MergeAccessibilityInformation (ChildDescriptorListType& raChildList);
+
+ /** If the visible area has changed then send events that signal a
+ change of their bounding boxes for all shapes that are members of
+ both the current and the new list of visible shapes.
+ @param raChildList
+ Events are sent to all entries of this list that already contain
+ an accessible object.
+ */
+ void SendVisibleAreaEvents (ChildDescriptorListType& raChildList);
+
+ /** If children have to be created immediately and not on demand the
+ create the missing accessible objects now.
+ @param raDescriptorList
+ Create an accessible object for every member of this list where
+ that obejct does not already exist.
+ */
+ void CreateAccessibilityObjects (ChildDescriptorListType& raChildList);
+
+ /** Add a single shape. Update all relevant data structures
+ accordingly. Use this method instead of <member>Update()</member>
+ when only a single shape has been added.
+ */
+ void AddShape (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape>& xShape);
+
+ /** Remove a single shape. Update all relevant data structures
+ accordingly. Use this method instead of <member>Update()</member>
+ when only a single shape has been removed.
+ */
+ void RemoveShape (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape>& xShape);
+
+ /** Add the children manager as dispose listener at the given shape so
+ that the associated accessible object can be disposed when the shape
+ is disposed.
+ @param xShape
+ Register at this shape as dispose listener.
+ */
+ void RegisterAsDisposeListener (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape>& xShape);
+
+ /** Remove the children manager as dispose listener at the given shape
+ @param xShape
+ Unregister at this shape as dispose listener.
+ */
+ void UnregisterAsDisposeListener (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape>& xShape);
+};
+
+
+
+
+/** A child descriptor holds a reference to a UNO shape and the
+ corresponding accessible object. There are two use cases:
+ <ol><li>The accessible object is only created on demand and is then
+ initially empty.</li>
+ <li>There is no UNO shape. The accessible object is given as argument
+ to the constructor.</li>
+ </ol>
+ In both cases the child descriptor assumes ownership over the accessible
+ object.
+*/
+class ChildDescriptor
+{
+public:
+ /** Reference to a (partially) visible shape.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape> mxShape;
+
+ /** The corresponding accessible object. This reference is initially
+ empty and only replaced by a reference to a new object when that is
+ requested from the outside.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> mxAccessibleShape;
+
+ /** Return a pointer to the implementation object of the accessible
+ shape of this descriptor.
+ @return
+ The result is NULL if either the UNO reference to the accessible
+ shape is empty or it can not be transformed into a pointer to
+ the desired class.
+ */
+ AccessibleShape* GetAccessibleShape (void) const;
+
+ /** set the index _nIndex at the accessible shape
+ @param _nIndex
+ The new index in parent.
+ */
+ void setIndexAtAccessibleShape(sal_Int32 _nIndex);
+
+ /** This flag is set during the visibility calculation and indicates
+ that at one time in this process an event is sent that informs the
+ listners of the creation of a new accessible object. This flags is
+ not reset afterwards. Don't use it unless you know exactly what you
+ are doing.
+ */
+ bool mbCreateEventPending;
+
+ /** Create a new descriptor for the specified shape with empty reference
+ to accessible object.
+ */
+ explicit ChildDescriptor (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape>& xShape);
+
+ /** Create a new descriptor for the specified shape with empty reference
+ to the original shape.
+ */
+ explicit ChildDescriptor (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxAccessibleShape);
+
+ ~ChildDescriptor (void);
+
+ /** Dispose the accessible object of this descriptor. If that object
+ does not exist then do nothing.
+ @param rParent
+ The parent of the accessible object to dispose. A child event
+ is sent in its name.
+ */
+ void disposeAccessibleObject (AccessibleContextBase& rParent);
+
+ /** Compare two child descriptors. Take into account that a child
+ descriptor may be based on a UNO shape or, already, on an accessible
+ shape.
+ */
+ inline bool operator == (const ChildDescriptor& aDescriptor) const
+ {
+ return (
+ this == &aDescriptor ||
+ (
+ (mxShape.get() == aDescriptor.mxShape.get() ) &&
+ (mxShape.is() || mxAccessibleShape.get() == aDescriptor.mxAccessibleShape.get())
+ )
+ );
+ }
+
+ /** The ordering defined by this operator is only used in order to be able
+ to put child descriptors in some STL containers. The ordering itself is
+ not so important, its 'features' are not used.
+ */
+ inline bool operator < (const ChildDescriptor& aDescriptor) const
+ {
+ return (mxShape.get() < aDescriptor.mxShape.get());
+ }
+
+};
+
+
+
+} // end of namespace accessibility
+
+#endif
+
diff --git a/svx/source/accessibility/DGColorNameLookUp.cxx b/svx/source/accessibility/DGColorNameLookUp.cxx
new file mode 100644
index 000000000000..8c8e0e403654
--- /dev/null
+++ b/svx/source/accessibility/DGColorNameLookUp.cxx
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "DGColorNameLookUp.hxx"
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <comphelper/processfactory.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+
+namespace accessibility {
+
+// Initialize the class instance with NULL. A true instance is created only
+// when the static <member>Instance</member> is called for the first time.
+DGColorNameLookUp* DGColorNameLookUp::mpInstance = NULL;
+
+DGColorNameLookUp& DGColorNameLookUp::Instance (void)
+{
+ // Using double check pattern to make sure that exactly one instance of
+ // the shape type handler is instantiated.
+ if (mpInstance == NULL)
+ {
+ ::vos::OGuard aGuard (::Application::GetSolarMutex());
+ if (mpInstance == NULL)
+ {
+ // Create the single instance of the color name look up.
+ mpInstance = new DGColorNameLookUp();
+ }
+ }
+
+ return *mpInstance;
+}
+
+
+
+
+OUString DGColorNameLookUp::LookUpColor (long int nColor) const
+{
+ OUString sColorName;
+ tColorValueToNameMap::const_iterator I;
+ I = maColorValueToNameMap.find (nColor);
+ if (I != maColorValueToNameMap.end())
+ // Found the color value. Return the associated name.
+ sColorName = I->second;
+ else
+ {
+ // Did not find the given color. Append its rgb tuple to the
+ // description.
+ ::rtl::OUStringBuffer sNameBuffer;
+ sNameBuffer.append (sal_Unicode('#'));
+ sNameBuffer.append (nColor, 16);
+ sColorName = sNameBuffer.makeStringAndClear();
+ }
+ return sColorName;
+}
+
+
+
+
+DGColorNameLookUp::DGColorNameLookUp (void)
+{
+ uno::Sequence<OUString> aNames;
+ uno::Reference<container::XNameAccess> xNA;
+
+ try
+ {
+ // Create color table in which to look up the given color.
+ uno::Reference<container::XNameContainer> xColorTable (
+ ::comphelper::getProcessServiceFactory()->createInstance(
+ OUString::createFromAscii("com.sun.star.drawing.ColorTable")),
+ uno::UNO_QUERY);
+
+ // Get list of color names in order to iterate over the color table.
+ xNA = uno::Reference<container::XNameAccess>(xColorTable, uno::UNO_QUERY);
+ if (xNA.is())
+ {
+ // Look the solar mutex here as workarround for missing lock in
+ // called function.
+ ::vos::OGuard aGuard (::Application::GetSolarMutex());
+ aNames = xNA->getElementNames();
+ }
+ }
+ catch (uno::RuntimeException e)
+ {
+ // When an excpetion occured then whe have an empty name sequence
+ // and the loop below is not entered.
+ }
+
+ // Fill the map to convert from numerical color values to names.
+ if (xNA.is())
+ for (long int i=0; i<aNames.getLength(); i++)
+ {
+ // Get the numerical value for the i-th color name.
+ try
+ {
+ uno::Any aColor (xNA->getByName (aNames[i]));
+ long nColor = 0;
+ aColor >>= nColor;
+ maColorValueToNameMap[nColor] = aNames[i];
+ }
+ catch (uno::RuntimeException e)
+ {
+ // Ignore the exception: the color who lead to the excpetion
+ // is not included into the map.
+ }
+ }
+}
+
+
+
+
+DGColorNameLookUp::~DGColorNameLookUp (void)
+{
+ maColorValueToNameMap.clear();
+}
+
+} // end of namespace accessibility
diff --git a/svx/source/accessibility/DescriptionGenerator.cxx b/svx/source/accessibility/DescriptionGenerator.cxx
new file mode 100644
index 000000000000..8587639fa1fa
--- /dev/null
+++ b/svx/source/accessibility/DescriptionGenerator.cxx
@@ -0,0 +1,484 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svx/DescriptionGenerator.hxx"
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/drawing/XShapeDescriptor.hpp>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <comphelper/processfactory.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include <com/sun/star/uno/Exception.hpp>
+
+// Includes for string resources.
+#ifndef _SVX_ACCESSIBILITY_HRC
+#include "accessibility.hrc"
+#endif
+#include "svx/svdstr.hrc"
+#include <svx/dialmgr.hxx>
+#include <tools/string.hxx>
+
+#include <svx/xdef.hxx>
+#include "svx/unoapi.hxx"
+#include "accessibility.hrc"
+#include "DGColorNameLookUp.hxx"
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+
+void SvxUnogetInternalNameForItem( const sal_Int16 nWhich, const rtl::OUString& rApiName, String& rInternalName ) throw();
+
+namespace accessibility {
+
+
+DescriptionGenerator::DescriptionGenerator (
+ const uno::Reference<drawing::XShape>& xShape)
+ : mxShape (xShape),
+ mxSet (mxShape, uno::UNO_QUERY),
+ mbIsFirstProperty (true)
+{
+}
+
+
+
+
+DescriptionGenerator::~DescriptionGenerator (void)
+{
+}
+
+
+
+
+void DescriptionGenerator::Initialize (sal_Int32 nResourceId)
+{
+ // Get the string from the resource for the specified id.
+ OUString sPrefix;
+ {
+ ::vos::OGuard aGuard (::Application::GetSolarMutex());
+ sPrefix = OUString (SVX_RESSTR (nResourceId));
+ }
+
+ // Forward the call with the resulting string.
+ Initialize (sPrefix);
+}
+
+
+
+
+void DescriptionGenerator::Initialize (::rtl::OUString sPrefix)
+{
+ msDescription = sPrefix;
+ if (mxSet.is())
+ {
+ {
+ ::vos::OGuard aGuard (::Application::GetSolarMutex());
+
+ msDescription.append (sal_Unicode (' '));
+ msDescription.append (OUString (SVX_RESSTR(RID_SVXSTR_A11Y_WITH)));
+ msDescription.append (sal_Unicode (' '));
+
+ msDescription.append (OUString (SVX_RESSTR (RID_SVXSTR_A11Y_STYLE)));
+ msDescription.append (sal_Unicode ('='));
+ }
+
+ try
+ {
+ if (mxSet.is())
+ {
+ uno::Any aValue = mxSet->getPropertyValue (OUString::createFromAscii ("Style"));
+ uno::Reference<container::XNamed> xStyle (aValue, uno::UNO_QUERY);
+ if (xStyle.is())
+ msDescription.append (xStyle->getName());
+ }
+ else
+ msDescription.append (
+ OUString::createFromAscii("<no style>"));
+ }
+ catch (::com::sun::star::beans::UnknownPropertyException)
+ {
+ msDescription.append (
+ OUString::createFromAscii("<unknown>"));
+ }
+ }
+}
+
+
+
+
+::rtl::OUString DescriptionGenerator::operator() (void)
+{
+ msDescription.append (sal_Unicode ('.'));
+ return msDescription.makeStringAndClear();
+}
+
+
+
+
+void DescriptionGenerator::AddProperty (
+ const OUString& sPropertyName,
+ PropertyType aType,
+ const sal_Int32 nLocalizedNameId,
+ long nWhichId)
+{
+ OUString sLocalizedName;
+ {
+ ::vos::OGuard aGuard (::Application::GetSolarMutex());
+ sLocalizedName = SVX_RESSTR (nLocalizedNameId);
+ }
+ AddProperty (sPropertyName, aType, sLocalizedName, nWhichId);
+}
+
+
+
+
+void DescriptionGenerator::AddProperty (const OUString& sPropertyName,
+ PropertyType aType, const OUString& sLocalizedName, long nWhichId)
+{
+ uno::Reference<beans::XPropertyState> xState (mxShape, uno::UNO_QUERY);
+ if (xState.is()
+ && xState->getPropertyState(sPropertyName)!=beans::PropertyState_DEFAULT_VALUE)
+ if (mxSet.is())
+ {
+ // Append a seperator from previous Properties.
+ if ( ! mbIsFirstProperty)
+ msDescription.append (sal_Unicode (','));
+ else
+ {
+ ::vos::OGuard aGuard (::Application::GetSolarMutex());
+
+ msDescription.append (sal_Unicode (' '));
+ msDescription.append (OUString (SVX_RESSTR(RID_SVXSTR_A11Y_AND)));
+ msDescription.append (sal_Unicode (' '));
+ mbIsFirstProperty = false;
+ }
+
+ // Delegate to type specific property handling.
+ switch (aType)
+ {
+ case COLOR:
+ AddColor (sPropertyName, sLocalizedName);
+ break;
+ case INTEGER:
+ AddInteger (sPropertyName, sLocalizedName);
+ break;
+ case STRING:
+ AddString (sPropertyName, sLocalizedName, nWhichId);
+ break;
+ case FILL_STYLE:
+ AddFillStyle (sPropertyName, sLocalizedName);
+ break;
+ }
+ }
+}
+
+
+
+
+void DescriptionGenerator::AppendString (const ::rtl::OUString& sString)
+{
+ msDescription.append (sString);
+}
+
+
+
+
+void DescriptionGenerator::AddLineProperties (void)
+{
+ AddProperty (OUString::createFromAscii ("LineColor"),
+ DescriptionGenerator::COLOR,
+ SIP_XA_LINECOLOR);
+ AddProperty (OUString::createFromAscii ("LineDashName"),
+ DescriptionGenerator::STRING,
+ SIP_XA_LINEDASH,
+ XATTR_LINEDASH);
+ AddProperty (OUString::createFromAscii ("LineWidth"),
+ DescriptionGenerator::INTEGER,
+ SIP_XA_LINEWIDTH);
+}
+
+
+
+
+/** The fill style is described by the property "FillStyle". Depending on
+ its value a hatch-, gradient-, or bitmap name is appended.
+*/
+void DescriptionGenerator::AddFillProperties (void)
+{
+ AddProperty (OUString::createFromAscii ("FillStyle"),
+ DescriptionGenerator::FILL_STYLE,
+ SIP_XA_FILLSTYLE);
+}
+
+
+
+
+void DescriptionGenerator::Add3DProperties (void)
+{
+ AddProperty (OUString::createFromAscii ("D3DMaterialColor"),
+ DescriptionGenerator::COLOR,
+ RID_SVXSTR_A11Y_3D_MATERIAL_COLOR);
+ AddLineProperties ();
+ AddFillProperties ();
+}
+
+
+
+
+void DescriptionGenerator::AddTextProperties (void)
+{
+ AddProperty (OUString::createFromAscii ("CharColor"),
+ DescriptionGenerator::COLOR);
+ AddFillProperties ();
+}
+
+
+
+
+/** Search for the given color in the global color table. If found append
+ its name to the description. Otherwise append its RGB tuple.
+*/
+void DescriptionGenerator::AddColor (const OUString& sPropertyName,
+ const OUString& sLocalizedName)
+{
+ msDescription.append (sLocalizedName);
+ msDescription.append (sal_Unicode('='));
+
+ try
+ {
+
+ long nValue(0);
+ if (mxSet.is())
+ {
+ uno::Any aValue = mxSet->getPropertyValue (sPropertyName);
+ aValue >>= nValue;
+ }
+
+ msDescription.append (DGColorNameLookUp::Instance().LookUpColor (nValue));
+ }
+ catch (::com::sun::star::beans::UnknownPropertyException)
+ {
+ msDescription.append (
+ OUString::createFromAscii("<unknown>"));
+ }
+}
+
+
+
+
+void DescriptionGenerator::AddUnknown (const OUString& /*sPropertyName*/,
+ const OUString& sLocalizedName)
+{
+ // uno::Any aValue = mxSet->getPropertyValue (sPropertyName);
+ msDescription.append (sLocalizedName);
+}
+
+
+
+
+void DescriptionGenerator::AddInteger (const OUString& sPropertyName,
+ const OUString& sLocalizedName)
+{
+ msDescription.append (sLocalizedName);
+ msDescription.append (sal_Unicode('='));
+
+ try
+ {
+ if (mxSet.is())
+ {
+ uno::Any aValue = mxSet->getPropertyValue (sPropertyName);
+ long nValue = 0;
+ aValue >>= nValue;
+ msDescription.append (nValue);
+ }
+ }
+ catch (::com::sun::star::beans::UnknownPropertyException)
+ {
+ msDescription.append (
+ OUString::createFromAscii("<unknown>"));
+ }
+}
+
+
+
+
+void DescriptionGenerator::AddString (const OUString& sPropertyName,
+ const OUString& sLocalizedName, long nWhichId)
+{
+ msDescription.append (sLocalizedName);
+ msDescription.append (sal_Unicode('='));
+
+ try
+ {
+ if (mxSet.is())
+ {
+ uno::Any aValue = mxSet->getPropertyValue (sPropertyName);
+ OUString sValue;
+ aValue >>= sValue;
+
+ if (nWhichId >= 0)
+ {
+ ::vos::OGuard aGuard (::Application::GetSolarMutex());
+ String sLocalizedValue;
+ SvxUnogetInternalNameForItem (sal::static_int_cast<sal_Int16>(nWhichId),
+ sValue, sLocalizedValue);
+ msDescription.append (sLocalizedValue);
+ }
+ else
+ msDescription.append (sValue);
+ }
+ }
+ catch (::com::sun::star::beans::UnknownPropertyException)
+ {
+ msDescription.append (
+ OUString::createFromAscii("<unknown>"));
+ }
+}
+
+
+
+
+void DescriptionGenerator::AddFillStyle (const OUString& sPropertyName,
+ const OUString& sLocalizedName)
+{
+ msDescription.append (sLocalizedName);
+ msDescription.append (sal_Unicode('='));
+
+ try
+ {
+ if (mxSet.is())
+ {
+ uno::Any aValue = mxSet->getPropertyValue (sPropertyName);
+ drawing::FillStyle aFillStyle;
+ aValue >>= aFillStyle;
+
+ // Get the fill style name from the resource.
+ OUString sFillStyleName;
+ {
+ ::vos::OGuard aGuard (::Application::GetSolarMutex());
+ switch (aFillStyle)
+ {
+ case drawing::FillStyle_NONE:
+ sFillStyleName = SVX_RESSTR(RID_SVXSTR_A11Y_FILLSTYLE_NONE);
+ break;
+ case drawing::FillStyle_SOLID:
+ sFillStyleName = SVX_RESSTR(RID_SVXSTR_A11Y_FILLSTYLE_SOLID);
+ break;
+ case drawing::FillStyle_GRADIENT:
+ sFillStyleName = SVX_RESSTR(RID_SVXSTR_A11Y_FILLSTYLE_GRADIENT);
+ break;
+ case drawing::FillStyle_HATCH:
+ sFillStyleName = SVX_RESSTR(RID_SVXSTR_A11Y_FILLSTYLE_HATCH);
+ break;
+ case drawing::FillStyle_BITMAP:
+ sFillStyleName = SVX_RESSTR(RID_SVXSTR_A11Y_FILLSTYLE_BITMAP);
+ break;
+ case drawing::FillStyle_MAKE_FIXED_SIZE:
+ break;
+ }
+ }
+ msDescription.append (sFillStyleName);
+
+ // Append the appropriate properties.
+ switch (aFillStyle)
+ {
+ case drawing::FillStyle_NONE:
+ break;
+ case drawing::FillStyle_SOLID:
+ AddProperty (OUString::createFromAscii ("FillColor"),
+ COLOR,
+ SIP_XA_FILLCOLOR);
+ break;
+ case drawing::FillStyle_GRADIENT:
+ AddProperty (OUString::createFromAscii ("FillGradientName"),
+ STRING,
+ SIP_XA_FILLGRADIENT,
+ XATTR_FILLGRADIENT);
+ break;
+ case drawing::FillStyle_HATCH:
+ AddProperty (OUString::createFromAscii ("FillColor"),
+ COLOR,
+ SIP_XA_FILLCOLOR);
+ AddProperty (OUString::createFromAscii ("FillHatchName"),
+ STRING,
+ SIP_XA_FILLHATCH,
+ XATTR_FILLHATCH);
+ break;
+ case drawing::FillStyle_BITMAP:
+ AddProperty (OUString::createFromAscii ("FillBitmapName"),
+ STRING,
+ SIP_XA_FILLBITMAP,
+ XATTR_FILLBITMAP);
+ break;
+ case drawing::FillStyle_MAKE_FIXED_SIZE:
+ break;
+ }
+ }
+ }
+ catch (::com::sun::star::beans::UnknownPropertyException)
+ {
+ msDescription.append (
+ OUString::createFromAscii("<unknown>"));
+ }
+}
+
+
+
+
+void DescriptionGenerator::AddPropertyNames (void)
+{
+ if (mxSet.is())
+ {
+ uno::Reference<beans::XPropertySetInfo> xInfo (mxSet->getPropertySetInfo());
+ if (xInfo.is())
+ {
+ uno::Sequence<beans::Property> aPropertyList (xInfo->getProperties ());
+ for (int i=0; i<aPropertyList.getLength(); i++)
+ {
+ msDescription.append (aPropertyList[i].Name);
+ msDescription.append (sal_Unicode(','));
+ }
+ }
+ }
+}
+
+
+} // end of namespace accessibility
diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
new file mode 100644
index 000000000000..5ffd4e9cd45a
--- /dev/null
+++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
@@ -0,0 +1,1027 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/beans/PropertyChangeEvent.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/svapp.hxx>
+#include <osl/mutex.hxx>
+#include <rtl/uuid.h>
+#include <tools/debug.hxx>
+#include <tools/gen.hxx>
+#include <svl/smplhint.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <svtools/colorcfg.hxx>
+#include <comphelper/accessibleeventnotifier.hxx>
+#include <svx/sdrpaintwindow.hxx>
+
+//===== local includes ========================================================
+#include <svx/ShapeTypeHandler.hxx>
+#include <svx/AccessibleShapeInfo.hxx>
+#include "GraphCtlAccessibleContext.hxx"
+#include <svx/graphctl.hxx>
+#ifndef _SVX_DIALOGS_HRC
+#include <svx/dialogs.hrc>
+#endif
+#ifndef _SVX_ACCESSIBILITY_HRC
+#include "accessibility.hrc"
+#endif
+#include <svx/svdpage.hxx>
+#include <svx/unomod.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/sdrhittesthelper.hxx>
+
+//===== namespaces ===========================================================
+
+using namespace ::vos;
+using namespace ::cppu;
+using namespace ::osl;
+using ::rtl::OUString;
+using namespace ::accessibility;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::accessibility;
+
+//===== internal ============================================================
+
+/** initialize this component and set default values */
+SvxGraphCtrlAccessibleContext::SvxGraphCtrlAccessibleContext(
+ const Reference< XAccessible >& rxParent,
+ GraphCtrl& rRepr,
+ const OUString* pName,
+ const OUString* pDesc ) :
+
+ SvxGraphCtrlAccessibleContext_Base( m_aMutex ),
+ mxParent( rxParent ),
+ mpControl( &rRepr ),
+ mpModel (NULL),
+ mpPage (NULL),
+ mpView (NULL),
+ mnClientId( 0 ),
+ mbDisposed( sal_False )
+{
+ if (mpControl != NULL)
+ {
+ mpModel = mpControl->GetSdrModel();
+ if (mpModel != NULL)
+ mpPage = (SdrPage*)mpModel->GetPage( 0 );
+ mpView = mpControl->GetSdrView();
+
+ if( mpModel == NULL || mpPage == NULL || mpView == NULL )
+ {
+ mbDisposed = true;
+ // Set all the pointers to NULL just in case they are used as
+ // a disposed flag.
+ mpModel = NULL;
+ mpPage = NULL;
+ mpView = NULL;
+ }
+ }
+
+ if( pName )
+ {
+ msName = *pName;
+ }
+ else
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ msName = SVX_RESSTR( RID_SVXSTR_GRAPHCTRL_ACC_NAME );
+ }
+
+ if( pDesc )
+ {
+ msDescription = *pDesc;
+ }
+ else
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ msDescription = SVX_RESSTR( RID_SVXSTR_GRAPHCTRL_ACC_DESCRIPTION );
+ }
+
+ maTreeInfo.SetSdrView( mpView );
+ maTreeInfo.SetWindow( mpControl );
+ maTreeInfo.SetViewForwarder( const_cast<SvxGraphCtrlAccessibleContext*>(this) );
+}
+
+//-----------------------------------------------------------------------------
+
+/** on destruction, this component is disposed and all dispose listeners
+ are called, except if this component was already disposed */
+SvxGraphCtrlAccessibleContext::~SvxGraphCtrlAccessibleContext()
+{
+ disposing();
+}
+
+//-----------------------------------------------------------------------------
+
+/** returns the XAccessible interface for a given SdrObject.
+ Multiple calls for the same SdrObject return the same XAccessible.
+*/
+Reference< XAccessible > SAL_CALL SvxGraphCtrlAccessibleContext::getAccessible( const SdrObject* pObj )
+{
+ Reference<XAccessible> xAccessibleShape;
+
+ if( pObj )
+ {
+ // see if we already created an XAccessible for the given SdrObject
+ ShapesMapType::iterator iter = mxShapes.find( pObj );
+
+ if( iter != mxShapes.end() )
+ {
+ // if we already have one, return it
+ xAccessibleShape = (*iter).second;
+ }
+ else
+ {
+ // create a new one and remember in our internal map
+ Reference< XShape > xShape( Reference< XShape >::query( (const_cast<SdrObject*>(pObj))->getUnoShape() ) );
+
+ AccessibleShapeInfo aShapeInfo (xShape,mxParent);
+ // Create accessible object that corresponds to the descriptor's shape.
+ AccessibleShape* pAcc = ShapeTypeHandler::Instance().CreateAccessibleObject(
+ aShapeInfo, maTreeInfo);
+ xAccessibleShape = pAcc;
+ if (pAcc != NULL)
+ {
+ pAcc->acquire();
+ // Now that we acquired the new accessible shape we can
+ // safely call its Init() method.
+ pAcc->Init ();
+ }
+ mxShapes[pObj] = pAcc;
+
+ // Create event and inform listeners of the object creation.
+ CommitChange( AccessibleEventId::CHILD, makeAny( xAccessibleShape ), makeAny( Reference<XAccessible>() ) );
+ }
+ }
+
+ return xAccessibleShape;
+}
+
+//===== XAccessible =========================================================
+
+Reference< XAccessibleContext > SAL_CALL SvxGraphCtrlAccessibleContext::getAccessibleContext( void ) throw( RuntimeException )
+{
+ return this;
+}
+
+//===== XAccessibleComponent ================================================
+
+sal_Bool SAL_CALL SvxGraphCtrlAccessibleContext::containsPoint( const awt::Point& rPoint ) throw( RuntimeException )
+{
+ // no guard -> done in getSize()
+ awt::Size aSize (getSize());
+ return (rPoint.X >= 0)
+ && (rPoint.X < aSize.Width)
+ && (rPoint.Y >= 0)
+ && (rPoint.Y < aSize.Height);
+}
+
+//-----------------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL SvxGraphCtrlAccessibleContext::getAccessibleAtPoint( const awt::Point& rPoint ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ Reference< XAccessible > xAccessible;
+
+ if( mpControl )
+ {
+ Point aPnt( rPoint.X, rPoint.Y );
+ mpControl->PixelToLogic( aPnt );
+
+ SdrObject* pObj = 0;
+
+ if(mpView && mpView->GetSdrPageView())
+ {
+ pObj = SdrObjListPrimitiveHit(*mpPage, aPnt, 1, *mpView->GetSdrPageView(), 0, false);
+ }
+
+ if( pObj )
+ xAccessible = getAccessible( pObj );
+ }
+ else
+ {
+ throw DisposedException();
+ }
+
+ return xAccessible;
+}
+
+//-----------------------------------------------------------------------------
+
+awt::Rectangle SAL_CALL SvxGraphCtrlAccessibleContext::getBounds() throw( RuntimeException )
+{
+ // no guard -> done in GetBoundingBox()
+ Rectangle aCoreBounds( GetBoundingBox() );
+ awt::Rectangle aBounds;
+ aBounds.X = aCoreBounds.getX();
+ aBounds.Y = aCoreBounds.getY();
+ aBounds.Width = aCoreBounds.getWidth();
+ aBounds.Height = aCoreBounds.getHeight();
+ return aBounds;
+}
+
+//-----------------------------------------------------------------------------
+
+awt::Point SAL_CALL SvxGraphCtrlAccessibleContext::getLocation() throw( RuntimeException )
+{
+ // no guard -> done in GetBoundingBox()
+ Rectangle aRect( GetBoundingBox() );
+ return awt::Point( aRect.getX(), aRect.getY() );
+}
+
+//-----------------------------------------------------------------------------
+
+awt::Point SAL_CALL SvxGraphCtrlAccessibleContext::getLocationOnScreen() throw( RuntimeException )
+{
+ // no guard -> done in GetBoundingBoxOnScreen()
+ Rectangle aRect( GetBoundingBoxOnScreen() );
+ return awt::Point( aRect.getX(), aRect.getY() );
+}
+
+//-----------------------------------------------------------------------------
+
+awt::Size SAL_CALL SvxGraphCtrlAccessibleContext::getSize() throw( RuntimeException )
+{
+ // no guard -> done in GetBoundingBox()
+ Rectangle aRect( GetBoundingBox() );
+ return awt::Size( aRect.getWidth(), aRect.getHeight() );
+}
+
+
+//===== XAccessibleContext ==================================================
+
+sal_Int32 SAL_CALL SvxGraphCtrlAccessibleContext::getAccessibleChildCount( void ) throw( RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpPage )
+ throw DisposedException();
+
+ return mpPage->GetObjCount();
+}
+
+//-----------------------------------------------------------------------------
+
+/** returns the SdrObject at index nIndex from the model of this graph */
+SdrObject* SvxGraphCtrlAccessibleContext::getSdrObject( sal_Int32 nIndex )
+ throw( RuntimeException, lang::IndexOutOfBoundsException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpPage )
+ throw DisposedException();
+
+ if( (nIndex < 0) || ( static_cast<sal_uInt32>(nIndex) >= mpPage->GetObjCount() ) )
+ throw lang::IndexOutOfBoundsException();
+
+ return mpPage->GetObj( nIndex );
+}
+
+//-----------------------------------------------------------------------------
+
+/** sends an AccessibleEventObject to all added XAccessibleEventListeners */
+void SvxGraphCtrlAccessibleContext::CommitChange (
+ sal_Int16 nEventId,
+ const uno::Any& rNewValue,
+ const uno::Any& rOldValue)
+{
+ AccessibleEventObject aEvent (
+ static_cast<uno::XWeak*>(this),
+ nEventId,
+ rNewValue,
+ rOldValue);
+
+ FireEvent (aEvent);
+}
+
+/** sends an AccessibleEventObject to all added XAccessibleEventListeners */
+void SvxGraphCtrlAccessibleContext::FireEvent (const AccessibleEventObject& aEvent)
+{
+ if (mnClientId)
+ comphelper::AccessibleEventNotifier::addEvent( mnClientId, aEvent );
+}
+
+//-----------------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL SvxGraphCtrlAccessibleContext::getAccessibleChild( sal_Int32 nIndex )
+ throw( RuntimeException, lang::IndexOutOfBoundsException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ return getAccessible( getSdrObject( nIndex ) );
+}
+
+//-----------------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL SvxGraphCtrlAccessibleContext::getAccessibleParent( void ) throw( RuntimeException )
+{
+ return mxParent;
+}
+
+//-----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL SvxGraphCtrlAccessibleContext::getAccessibleIndexInParent( void ) throw( RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ // Use a simple but slow solution for now. Optimize later.
+
+ // Iterate over all the parent's children and search for this object.
+ if( mxParent.is() )
+ {
+ Reference< XAccessibleContext > xParentContext( mxParent->getAccessibleContext() );
+ if( xParentContext.is() )
+ {
+ sal_Int32 nChildCount = xParentContext->getAccessibleChildCount();
+ for( sal_Int32 i = 0 ; i < nChildCount ; ++i )
+ {
+ Reference< XAccessible > xChild( xParentContext->getAccessibleChild( i ) );
+ if( xChild.is() )
+ {
+ Reference< XAccessibleContext > xChildContext = xChild->getAccessibleContext();
+ if( xChildContext == ( XAccessibleContext* ) this )
+ return i;
+ }
+ }
+ }
+ }
+
+ // Return -1 to indicate that this object's parent does not know about the
+ // object.
+ return -1;
+}
+
+//-----------------------------------------------------------------------------
+
+sal_Int16 SAL_CALL SvxGraphCtrlAccessibleContext::getAccessibleRole( void ) throw( RuntimeException )
+{
+ return AccessibleRole::PANEL;
+}
+
+//-----------------------------------------------------------------------------
+
+OUString SAL_CALL SvxGraphCtrlAccessibleContext::getAccessibleDescription( void ) throw( RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ return msDescription;
+}
+
+//-----------------------------------------------------------------------------
+
+OUString SAL_CALL SvxGraphCtrlAccessibleContext::getAccessibleName( void ) throw( RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ return msName;
+}
+
+//-----------------------------------------------------------------------------
+
+/** Return empty reference to indicate that the relation set is not
+ supported.
+*/
+Reference< XAccessibleRelationSet > SAL_CALL SvxGraphCtrlAccessibleContext::getAccessibleRelationSet( void ) throw( RuntimeException )
+{
+ return Reference< XAccessibleRelationSet >();
+}
+
+//-----------------------------------------------------------------------------
+
+Reference< XAccessibleStateSet > SAL_CALL SvxGraphCtrlAccessibleContext::getAccessibleStateSet( void ) throw( RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
+
+ if ( rBHelper.bDisposed || mbDisposed )
+ {
+ pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+ }
+ else
+ {
+ // pStateSetHelper->AddState( AccessibleStateType::ENABLED );
+ // pStateSetHelper->AddState( AccessibleStateType::SENSITIVE );
+ pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE );
+ if( mpControl->HasFocus() )
+ pStateSetHelper->AddState( AccessibleStateType::FOCUSED );
+ pStateSetHelper->AddState( AccessibleStateType::OPAQUE );
+ pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+ pStateSetHelper->AddState( AccessibleStateType::VISIBLE );
+ }
+
+ return pStateSetHelper;
+}
+
+//-----------------------------------------------------------------------------
+
+lang::Locale SAL_CALL SvxGraphCtrlAccessibleContext::getLocale( void ) throw( IllegalAccessibleComponentStateException, RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mxParent.is() )
+ {
+ Reference< XAccessibleContext > xParentContext( mxParent->getAccessibleContext() );
+ if( xParentContext.is() )
+ return xParentContext->getLocale();
+ }
+
+ // No parent. Therefore throw exception to indicate this cluelessness.
+ throw IllegalAccessibleComponentStateException();
+}
+
+//===== XAccessibleEventListener ============================================
+
+void SAL_CALL SvxGraphCtrlAccessibleContext::addEventListener( const Reference< XAccessibleEventListener >& xListener )
+ throw( RuntimeException )
+{
+ if (xListener.is())
+ {
+ OGuard aGuard( Application::GetSolarMutex() );
+ if (!mnClientId)
+ mnClientId = comphelper::AccessibleEventNotifier::registerClient( );
+ comphelper::AccessibleEventNotifier::addEventListener( mnClientId, xListener );
+ }
+}
+
+//-----------------------------------------------------------------------------
+
+void SAL_CALL SvxGraphCtrlAccessibleContext::removeEventListener( const Reference< XAccessibleEventListener >& xListener )
+ throw( RuntimeException )
+{
+ if (xListener.is())
+ {
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener );
+ if ( !nListenerCount )
+ {
+ // no listeners anymore
+ // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
+ // and at least to us not firing any events anymore, in case somebody calls
+ // NotifyAccessibleEvent, again
+ comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
+ mnClientId = 0;
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
+
+void SAL_CALL SvxGraphCtrlAccessibleContext::addFocusListener( const Reference< awt::XFocusListener >& xListener )
+ throw( RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( xListener.is() )
+ {
+ Reference< ::com::sun::star::awt::XWindow > xWindow( VCLUnoHelper::GetInterface( mpControl ) );
+ if( xWindow.is() )
+ xWindow->addFocusListener( xListener );
+ }
+}
+
+//-----------------------------------------------------------------------------
+
+void SAL_CALL SvxGraphCtrlAccessibleContext::removeFocusListener( const Reference< awt::XFocusListener >& xListener )
+ throw (RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( xListener.is() )
+ {
+ Reference< ::com::sun::star::awt::XWindow > xWindow = VCLUnoHelper::GetInterface( mpControl );
+ if( xWindow.is() )
+ xWindow->removeFocusListener( xListener );
+ }
+}
+
+//-----------------------------------------------------------------------------
+
+void SAL_CALL SvxGraphCtrlAccessibleContext::grabFocus() throw( RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpControl )
+ throw DisposedException();
+
+ mpControl->GrabFocus();
+}
+
+//-----------------------------------------------------------------------------
+
+Any SAL_CALL SvxGraphCtrlAccessibleContext::getAccessibleKeyBinding() throw( RuntimeException )
+{
+ // here is no implementation, because here are no KeyBindings for every object
+ return Any();
+}
+
+
+
+
+
+sal_Int32 SAL_CALL SvxGraphCtrlAccessibleContext::getForeground (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ svtools::ColorConfig aColorConfig;
+ sal_uInt32 nColor = aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor;
+ return static_cast<sal_Int32>(nColor);
+}
+
+
+
+
+sal_Int32 SAL_CALL SvxGraphCtrlAccessibleContext::getBackground (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ sal_uInt32 nColor = Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor();
+ return static_cast<sal_Int32>(nColor);
+}
+
+
+//===== XServiceInfo ========================================================
+
+OUString SAL_CALL SvxGraphCtrlAccessibleContext::getImplementationName( void ) throw( RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.ui.SvxGraphCtrlAccessibleContext" ) );
+}
+
+//-----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL SvxGraphCtrlAccessibleContext::supportsService( const OUString& sServiceName ) throw( RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ // Iterate over all supported service names and return true if on of them
+ // matches the given name.
+ Sequence< OUString > aSupportedServices( getSupportedServiceNames() );
+ int nLenght = aSupportedServices.getLength();
+
+ for( int i = 0 ; i < nLenght ; ++i )
+ {
+ if( sServiceName == aSupportedServices[ i ] )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+//-----------------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL SvxGraphCtrlAccessibleContext::getSupportedServiceNames( void ) throw( RuntimeException )
+{
+ Sequence< OUString > aSNs( 3 );
+
+ aSNs[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.Accessible" ) );
+ aSNs[1] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleContext" ) );
+ aSNs[2] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.AccessibleGraphControl" ) );
+
+ return aSNs;
+}
+
+//===== XTypeProvider =======================================================
+
+Sequence<sal_Int8> SAL_CALL SvxGraphCtrlAccessibleContext::getImplementationId( void ) throw( RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ return getUniqueId();
+}
+
+//===== XServiceName ========================================================
+
+OUString SvxGraphCtrlAccessibleContext::getServiceName( void ) throw( RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleContext" ) );
+}
+
+//===== XAccessibleSelection =============================================
+
+void SAL_CALL SvxGraphCtrlAccessibleContext::selectAccessibleChild( sal_Int32 nIndex ) throw( lang::IndexOutOfBoundsException, RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpView )
+ throw DisposedException();
+
+ SdrObject* pObj = getSdrObject( nIndex );
+
+ if( pObj )
+ mpView->MarkObj( pObj, mpView->GetSdrPageView());
+}
+
+//-----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL SvxGraphCtrlAccessibleContext::isAccessibleChildSelected( sal_Int32 nIndex ) throw( lang::IndexOutOfBoundsException, RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpView )
+ throw DisposedException();
+
+ return mpView->IsObjMarked( getSdrObject( nIndex ) );
+}
+
+//-----------------------------------------------------------------------------
+
+void SAL_CALL SvxGraphCtrlAccessibleContext::clearAccessibleSelection() throw( RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpView )
+ throw DisposedException();
+
+ mpView->UnmarkAllObj();
+}
+
+//-----------------------------------------------------------------------------
+
+void SAL_CALL SvxGraphCtrlAccessibleContext::selectAllAccessibleChildren() throw( RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpView )
+ throw DisposedException();
+
+ mpView->MarkAllObj();
+}
+
+//-----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL SvxGraphCtrlAccessibleContext::getSelectedAccessibleChildCount() throw( RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpView )
+ throw DisposedException();
+
+ const SdrMarkList& rList = mpView->GetMarkedObjectList();
+ return rList.GetMarkCount();
+}
+
+//-----------------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL SvxGraphCtrlAccessibleContext::getSelectedAccessibleChild( sal_Int32 nIndex )
+ throw( lang::IndexOutOfBoundsException, RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ checkChildIndexOnSelection( nIndex );
+
+ Reference< XAccessible > xAccessible;
+
+ const SdrMarkList& rList = mpView->GetMarkedObjectList();
+ SdrObject* pObj = rList.GetMark(nIndex)->GetMarkedSdrObj();
+ if( pObj )
+ xAccessible = getAccessible( pObj );
+
+ return xAccessible;
+}
+
+//-----------------------------------------------------------------------------
+
+void SAL_CALL SvxGraphCtrlAccessibleContext::deselectAccessibleChild( sal_Int32 nIndex ) throw( lang::IndexOutOfBoundsException, RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ checkChildIndexOnSelection( nIndex );
+
+ if( mpView )
+ {
+ const SdrMarkList& rList = mpView->GetMarkedObjectList();
+
+ SdrObject* pObj = getSdrObject( nIndex );
+ if( pObj )
+ {
+ SdrMarkList aRefList( rList );
+
+ SdrPageView* pPV = mpView->GetSdrPageView();
+ mpView->UnmarkAllObj( pPV );
+
+ sal_uInt32 nCount = aRefList.GetMarkCount();
+ sal_uInt32 nMark;
+ for( nMark = 0; nMark < nCount; nMark++ )
+ {
+ if( aRefList.GetMark(nMark)->GetMarkedSdrObj() != pObj )
+ mpView->MarkObj( aRefList.GetMark(nMark)->GetMarkedSdrObj(), pPV );
+ }
+ }
+ }
+}
+
+//===== internals ========================================================
+
+void SvxGraphCtrlAccessibleContext::checkChildIndex( long nIndex ) throw( lang::IndexOutOfBoundsException )
+{
+ if( nIndex < 0 || nIndex >= getAccessibleChildCount() )
+ throw lang::IndexOutOfBoundsException();
+}
+
+//-----------------------------------------------------------------------------
+
+void SvxGraphCtrlAccessibleContext::checkChildIndexOnSelection( long nIndex ) throw( lang::IndexOutOfBoundsException )
+{
+ if( nIndex < 0 || nIndex >= getSelectedAccessibleChildCount() )
+ throw lang::IndexOutOfBoundsException();
+}
+
+//-----------------------------------------------------------------------------
+
+void SvxGraphCtrlAccessibleContext::setName( const OUString& rName )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ msName = rName;
+}
+
+//-----------------------------------------------------------------------------
+
+void SvxGraphCtrlAccessibleContext::setDescription( const OUString& rDescr )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ msDescription = rDescr;
+}
+
+
+
+
+/** Replace the model, page, and view pointers by the ones provided
+ (explicitly and implicitly).
+*/
+void SvxGraphCtrlAccessibleContext::setModelAndView (
+ SdrModel* pModel,
+ SdrView* pView)
+{
+ OGuard aGuard (Application::GetSolarMutex());
+
+ mpModel = pModel;
+ if (mpModel != NULL)
+ mpPage = (SdrPage*)mpModel->GetPage( 0 );
+ mpView = pView;
+
+ if (mpModel == NULL || mpPage == NULL || mpView == NULL)
+ {
+ mbDisposed = true;
+
+ // Set all the pointers to NULL just in case they are used as
+ // a disposed flag.
+ mpModel = NULL;
+ mpPage = NULL;
+ mpView = NULL;
+ }
+
+ maTreeInfo.SetSdrView (mpView);
+}
+
+
+
+//-----------------------------------------------------------------------------
+
+void SAL_CALL SvxGraphCtrlAccessibleContext::disposing()
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mbDisposed )
+ return;
+
+ mbDisposed = sal_True;
+
+ mpControl = NULL; // object dies with representation
+ mpView = NULL;
+ mpPage = NULL;
+
+ {
+ ShapesMapType::iterator I;
+
+ for (I=mxShapes.begin(); I!=mxShapes.end(); I++)
+ {
+ XAccessible* pAcc = (*I).second;
+ Reference< XComponent > xComp( pAcc, UNO_QUERY );
+ if( xComp.is() )
+ xComp->dispose();
+
+ (*I).second->release();
+ }
+
+ mxShapes.clear();
+ }
+
+ // Send a disposing to all listeners.
+ if ( mnClientId )
+ {
+ comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this );
+ mnClientId = 0;
+ }
+}
+
+//-----------------------------------------------------------------------------
+
+Rectangle SvxGraphCtrlAccessibleContext::GetBoundingBoxOnScreen( void ) throw( RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpControl )
+ throw DisposedException();
+
+ return Rectangle(
+ mpControl->GetAccessibleParentWindow()->OutputToAbsoluteScreenPixel(
+ mpControl->GetPosPixel() ),
+ mpControl->GetSizePixel() );
+}
+
+//-----------------------------------------------------------------------------
+
+/** Calculate the relative coordinates of the bounding box as difference
+ between the absolute coordinates of the bounding boxes of this control
+ and its parent in the accessibility tree.
+*/
+Rectangle SvxGraphCtrlAccessibleContext::GetBoundingBox( void ) throw( RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ Rectangle aBounds ( 0, 0, 0, 0 );
+
+ Window* pWindow = mpControl;
+ if (pWindow != NULL)
+ {
+ aBounds = pWindow->GetWindowExtentsRelative (NULL);
+ Window* pParent = pWindow->GetAccessibleParentWindow();
+ if (pParent != NULL)
+ {
+ Rectangle aParentRect = pParent->GetWindowExtentsRelative (NULL);
+ aBounds -= aParentRect.TopLeft();
+ }
+ }
+ else
+ throw DisposedException();
+
+ return aBounds;
+}
+
+//-----------------------------------------------------------------------------
+
+Sequence< sal_Int8 > SvxGraphCtrlAccessibleContext::getUniqueId( void )
+{
+ // no guard because it's private -> has to guarded when using it!
+ static OImplementationId* pId = 0;
+ if( !pId )
+ {
+ OGuard aGuard( Application::GetSolarMutex() );
+ if( !pId)
+ {
+ static OImplementationId aId;
+ pId = &aId;
+ }
+ }
+ return pId->getImplementationId();
+}
+
+//-----------------------------------------------------------------------------
+
+void SvxGraphCtrlAccessibleContext::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
+{
+ const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
+
+ if( pSdrHint )
+ {
+ switch( pSdrHint->GetKind() )
+ {
+ case HINT_OBJCHG:
+ {
+ ShapesMapType::iterator iter = mxShapes.find( pSdrHint->GetObject() );
+
+ if( iter != mxShapes.end() )
+ {
+ // if we already have one, return it
+ AccessibleShape* pShape = (*iter).second;
+
+ if( NULL != pShape )
+ pShape->CommitChange( AccessibleEventId::VISIBLE_DATA_CHANGED, uno::Any(), uno::Any() );
+ }
+ }
+ break;
+
+ case HINT_OBJINSERTED:
+ CommitChange( AccessibleEventId::CHILD, makeAny( getAccessible( pSdrHint->GetObject() ) ) , uno::Any());
+ break;
+ case HINT_OBJREMOVED:
+ CommitChange( AccessibleEventId::CHILD, uno::Any(), makeAny( getAccessible( pSdrHint->GetObject() ) ) );
+ break;
+ case HINT_MODELCLEARED:
+ dispose();
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ const SfxSimpleHint* pSfxHint = PTR_CAST(SfxSimpleHint, &rHint );
+
+ // ist unser SdDrawDocument gerade gestorben?
+ if(pSfxHint && pSfxHint->GetId() == SFX_HINT_DYING)
+ {
+ dispose();
+ }
+ }
+}
+
+//===== IAccessibleViewforwarder ========================================
+
+sal_Bool SvxGraphCtrlAccessibleContext::IsValid (void) const
+{
+ return sal_True;
+}
+
+//-----------------------------------------------------------------------------
+
+Rectangle SvxGraphCtrlAccessibleContext::GetVisibleArea (void) const
+{
+ Rectangle aVisArea;
+
+ if( mpView && mpView->PaintWindowCount())
+ {
+ SdrPaintWindow* pPaintWindow = mpView->GetPaintWindow(0L);
+ aVisArea = pPaintWindow->GetVisibleArea();
+ }
+
+ return aVisArea;
+}
+
+//-----------------------------------------------------------------------------
+
+Point SvxGraphCtrlAccessibleContext::LogicToPixel (const Point& rPoint) const
+{
+ if( mpControl )
+ {
+ Rectangle aBBox(mpControl->GetWindowExtentsRelative(NULL));
+ return mpControl->LogicToPixel (rPoint) + aBBox.TopLeft();
+ }
+ else
+ {
+ return rPoint;
+ }
+}
+
+//-----------------------------------------------------------------------------
+
+Size SvxGraphCtrlAccessibleContext::LogicToPixel (const Size& rSize) const
+{
+ if( mpControl )
+ return mpControl->LogicToPixel (rSize);
+ else
+ return rSize;
+}
+
+//-----------------------------------------------------------------------------
+
+Point SvxGraphCtrlAccessibleContext::PixelToLogic (const Point& rPoint) const
+{
+ if( mpControl )
+ return mpControl->PixelToLogic (rPoint);
+ else
+ return rPoint;
+}
+
+//-----------------------------------------------------------------------------
+
+Size SvxGraphCtrlAccessibleContext::PixelToLogic (const Size& rSize) const
+{
+ if( mpControl )
+ return mpControl->PixelToLogic (rSize);
+ else
+ return rSize;
+}
diff --git a/svx/source/accessibility/ShapeTypeHandler.cxx b/svx/source/accessibility/ShapeTypeHandler.cxx
new file mode 100755
index 000000000000..4a4cad786b58
--- /dev/null
+++ b/svx/source/accessibility/ShapeTypeHandler.cxx
@@ -0,0 +1,338 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/ShapeTypeHandler.hxx>
+#include <svx/SvxShapeTypes.hxx>
+#include <svx/AccessibleShapeInfo.hxx>
+#include <com/sun/star/drawing/XShapeDescriptor.hpp>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <svx/dialmgr.hxx>
+#include "svx/svdstr.hrc"
+
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+namespace accessibility {
+
+// Pointer to the shape type handler singleton.
+ShapeTypeHandler* ShapeTypeHandler::instance = NULL;
+
+
+// Create an empty reference to an accessible object.
+AccessibleShape*
+ CreateEmptyShapeReference (
+ const AccessibleShapeInfo& /*rShapeInfo*/,
+ const AccessibleShapeTreeInfo& /*rShapeTreeInfo*/,
+ ShapeTypeId /*nId*/)
+{
+ return NULL;
+}
+
+
+
+
+ShapeTypeHandler& ShapeTypeHandler::Instance (void)
+{
+ // Using double check pattern to make sure that exactly one instance of
+ // the shape type handler is instantiated.
+ if (instance == NULL)
+ {
+ ::vos::OGuard aGuard (::Application::GetSolarMutex());
+ if (instance == NULL)
+ {
+ // Create the single instance of the shape type handler.
+ instance = new ShapeTypeHandler;
+
+ // Register the basic SVX shape types.
+ RegisterDrawShapeTypes ();
+ }
+ }
+
+ return *instance;
+}
+
+
+
+
+/** The given service name is first transformed into a slot id that
+ identifies the place of the type descriptor. From that descriptor the
+ shape type id is returned.
+*/
+ShapeTypeId ShapeTypeHandler::GetTypeId (const OUString& aServiceName) const
+{
+ tServiceNameToSlotId::iterator I (maServiceNameToSlotId.find (aServiceName));
+ if (I != maServiceNameToSlotId.end())
+ {
+ // long nSlotId = maServiceNameToSlotId[aServiceName];
+ return maShapeTypeDescriptorList[I->second].mnShapeTypeId;
+ }
+ else
+ return -1;
+}
+
+
+
+/** Extract the specified shape's service name and forward the request to
+ the appropriate method.
+*/
+ShapeTypeId ShapeTypeHandler::GetTypeId (const uno::Reference<drawing::XShape>& rxShape) const
+{
+ uno::Reference<drawing::XShapeDescriptor> xDescriptor (rxShape, uno::UNO_QUERY);
+ if (xDescriptor.is())
+ return GetTypeId (xDescriptor->getShapeType());
+ else
+ return -1;
+}
+
+
+
+
+const OUString& ShapeTypeHandler::GetServiceName (ShapeTypeId aTypeId) const
+{
+ return maShapeTypeDescriptorList[aTypeId].msServiceName;
+}
+
+
+
+
+/** This factory method determines the type descriptor for the type of the
+ given shape, then calls the descriptor's create function, and finally
+ initializes the new object.
+*/
+AccessibleShape*
+ ShapeTypeHandler::CreateAccessibleObject (
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo) const
+{
+ ShapeTypeId nSlotId (GetSlotId (rShapeInfo.mxShape));
+ AccessibleShape* pShape =
+ maShapeTypeDescriptorList[nSlotId].maCreateFunction (
+ rShapeInfo,
+ rShapeTreeInfo,
+ maShapeTypeDescriptorList[nSlotId].mnShapeTypeId);
+ return pShape;
+}
+
+
+
+
+/** Create the single instance of this class and initialize its list of
+ type descriptors with an entry of an unknown type.
+*/
+ShapeTypeHandler::ShapeTypeHandler (void)
+ : maShapeTypeDescriptorList (1)
+{
+ // Make sure that at least the UNKNOWN entry is present.
+ // Resize the list, if necessary, so that the new type can be inserted.
+ maShapeTypeDescriptorList[0].mnShapeTypeId = UNKNOWN_SHAPE_TYPE;
+ maShapeTypeDescriptorList[0].msServiceName =
+ OUString::createFromAscii ("UNKNOWN_SHAPE_TYPE");
+ maShapeTypeDescriptorList[0].maCreateFunction = CreateEmptyShapeReference;
+ maServiceNameToSlotId[maShapeTypeDescriptorList[0].msServiceName] = 0;
+}
+
+
+
+
+ShapeTypeHandler::~ShapeTypeHandler (void)
+{
+ // Because this class is a singleton and the only instance, whose
+ // destructor has just been called, is pointed to from instance,
+ // we reset the static variable instance, so that further calls to
+ // getInstance do not return an undefined object but create a new
+ // singleton.
+ instance = NULL;
+}
+
+
+
+
+bool ShapeTypeHandler::AddShapeTypeList (int nDescriptorCount,
+ ShapeTypeDescriptor aDescriptorList[])
+{
+ ::vos::OGuard aGuard (::Application::GetSolarMutex());
+
+ // Determine first id of new type descriptor(s).
+ int nFirstId = maShapeTypeDescriptorList.size();
+
+ // Resize the list, if necessary, so that the types can be inserted.
+ maShapeTypeDescriptorList.resize (nFirstId + nDescriptorCount);
+
+ for (int i=0; i<nDescriptorCount; i++)
+ {
+ #if OSL_DEBUG_LEVEL > 0
+ ShapeTypeId nId (aDescriptorList[i].mnShapeTypeId);
+ (void)nId;
+ #endif
+
+ // Fill Type descriptor.
+ maShapeTypeDescriptorList[nFirstId+i].mnShapeTypeId = aDescriptorList[i].mnShapeTypeId;
+ maShapeTypeDescriptorList[nFirstId+i].msServiceName = aDescriptorList[i].msServiceName;
+ maShapeTypeDescriptorList[nFirstId+i].maCreateFunction = aDescriptorList[i].maCreateFunction;
+
+ // Update inverse mapping from service name to the descriptor's position.
+ maServiceNameToSlotId[aDescriptorList[i].msServiceName] = nFirstId+i;
+ }
+
+ return true;
+}
+
+
+
+
+#include <tools/string.hxx>
+long ShapeTypeHandler::GetSlotId (const OUString& aServiceName) const
+{
+ tServiceNameToSlotId::iterator I (maServiceNameToSlotId.find (aServiceName));
+ if (I != maServiceNameToSlotId.end())
+ return I->second;
+ else
+ return 0;
+}
+
+
+
+
+// Extract the given shape's service name and forward request to appropriate
+// method.
+long ShapeTypeHandler::GetSlotId (const uno::Reference<drawing::XShape>& rxShape) const
+{
+ uno::Reference<drawing::XShapeDescriptor> xDescriptor (rxShape, uno::UNO_QUERY);
+ if (xDescriptor.is())
+ return GetSlotId (xDescriptor->getShapeType());
+ else
+ return 0;
+}
+
+/// get the accessible base name for an object
+::rtl::OUString
+ ShapeTypeHandler::CreateAccessibleBaseName (const uno::Reference<drawing::XShape>& rxShape)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ sal_Int32 nResourceId;
+ OUString sName;
+
+ switch (ShapeTypeHandler::Instance().GetTypeId (rxShape))
+ {
+ // case DRAWING_3D_POLYGON: was removed in original code in
+ // AccessibleShape::CreateAccessibleBaseName. See issue 11190 for details.
+ // Id can be removed from SvxShapeTypes.hxx as well.
+ case DRAWING_3D_CUBE:
+ nResourceId = STR_ObjNameSingulCube3d;
+ break;
+ case DRAWING_3D_EXTRUDE:
+ nResourceId = STR_ObjNameSingulExtrude3d;
+ break;
+ case DRAWING_3D_LATHE:
+ nResourceId = STR_ObjNameSingulLathe3d;
+ break;
+ case DRAWING_3D_SCENE:
+ nResourceId = STR_ObjNameSingulScene3d;
+ break;
+ case DRAWING_3D_SPHERE:
+ nResourceId = STR_ObjNameSingulSphere3d;
+ break;
+ case DRAWING_CAPTION:
+ nResourceId = STR_ObjNameSingulCAPTION;
+ break;
+ case DRAWING_CLOSED_BEZIER:
+ nResourceId = STR_ObjNameSingulPATHFILL;
+ break;
+ case DRAWING_CLOSED_FREEHAND:
+ nResourceId = STR_ObjNameSingulFREEFILL;
+ break;
+ case DRAWING_CONNECTOR:
+ nResourceId = STR_ObjNameSingulEDGE;
+ break;
+ case DRAWING_CONTROL:
+ nResourceId = STR_ObjNameSingulUno;
+ break;
+ case DRAWING_ELLIPSE:
+ nResourceId = STR_ObjNameSingulCIRCE;
+ break;
+ case DRAWING_GROUP:
+ nResourceId = STR_ObjNameSingulGRUP;
+ break;
+ case DRAWING_LINE:
+ nResourceId = STR_ObjNameSingulLINE;
+ break;
+ case DRAWING_MEASURE:
+ nResourceId = STR_ObjNameSingulMEASURE;
+ break;
+ case DRAWING_OPEN_BEZIER:
+ nResourceId = STR_ObjNameSingulPATHLINE;
+ break;
+ case DRAWING_OPEN_FREEHAND:
+ nResourceId = STR_ObjNameSingulFREELINE;
+ break;
+ case DRAWING_PAGE:
+ nResourceId = STR_ObjNameSingulPAGE;
+ break;
+ case DRAWING_POLY_LINE:
+ nResourceId = STR_ObjNameSingulPLIN;
+ break;
+ case DRAWING_POLY_LINE_PATH:
+ nResourceId = STR_ObjNameSingulPLIN;
+ break;
+ case DRAWING_POLY_POLYGON:
+ nResourceId = STR_ObjNameSingulPOLY;
+ break;
+ case DRAWING_POLY_POLYGON_PATH:
+ nResourceId = STR_ObjNameSingulPOLY;
+ break;
+ case DRAWING_RECTANGLE:
+ nResourceId = STR_ObjNameSingulRECT;
+ break;
+ case DRAWING_TEXT:
+ nResourceId = STR_ObjNameSingulTEXT;
+ break;
+ default:
+ nResourceId = -1;
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("UnknownAccessibleShape"));
+ uno::Reference<drawing::XShapeDescriptor> xDescriptor (rxShape, uno::UNO_QUERY);
+ if (xDescriptor.is())
+ sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": "))
+ + xDescriptor->getShapeType();
+ break;
+ }
+
+ if (nResourceId != -1)
+ {
+ ::vos::OGuard aGuard (::Application::GetSolarMutex());
+ sName = OUString (SVX_RESSTR((unsigned short)nResourceId));
+ }
+
+ return sName;
+}
+
+} // end of namespace accessibility
diff --git a/svx/source/accessibility/SvxShapeTypes.cxx b/svx/source/accessibility/SvxShapeTypes.cxx
new file mode 100644
index 000000000000..afdec80872b1
--- /dev/null
+++ b/svx/source/accessibility/SvxShapeTypes.cxx
@@ -0,0 +1,207 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/SvxShapeTypes.hxx>
+#include <svx/AccessibleShape.hxx>
+#include <svx/AccessibleGraphicShape.hxx>
+#include <svx/AccessibleOLEShape.hxx>
+#include <svx/AccessibleControlShape.hxx>
+#include <svx/AccessibleTableShape.hxx>
+
+namespace accessibility {
+
+AccessibleShape* CreateSvxAccessibleShape (
+ const AccessibleShapeInfo& rShapeInfo,
+ const AccessibleShapeTreeInfo& rShapeTreeInfo,
+ ShapeTypeId nId)
+{
+ switch (nId)
+ {
+ case DRAWING_3D_CUBE:
+ case DRAWING_3D_EXTRUDE:
+ case DRAWING_3D_LATHE:
+ case DRAWING_3D_SCENE:
+ case DRAWING_3D_SPHERE:
+ case DRAWING_CAPTION:
+ case DRAWING_CLOSED_BEZIER:
+ case DRAWING_CLOSED_FREEHAND:
+ case DRAWING_CONNECTOR:
+ case DRAWING_ELLIPSE:
+ case DRAWING_GROUP:
+ case DRAWING_LINE:
+ case DRAWING_MEASURE:
+ case DRAWING_OPEN_BEZIER:
+ case DRAWING_OPEN_FREEHAND:
+ case DRAWING_PAGE:
+ case DRAWING_POLY_POLYGON:
+ case DRAWING_POLY_LINE:
+ case DRAWING_POLY_POLYGON_PATH:
+ case DRAWING_POLY_LINE_PATH:
+ case DRAWING_RECTANGLE:
+ case DRAWING_TEXT:
+ // --> OD 2004-11-29 #i37790# - default accessiblility shape for
+ // com::sun::star::drawing::CustomShape
+ case DRAWING_CUSTOM:
+ // <--
+ // --> OD 2008-05-19 #i85429# - default accessiblility shape for
+ // com::sun::star::drawing::MediaShape
+ case DRAWING_MEDIA:
+ // <--
+ return new AccessibleShape (rShapeInfo, rShapeTreeInfo);
+
+ case DRAWING_CONTROL:
+ return new AccessibleControlShape (rShapeInfo, rShapeTreeInfo);
+
+ case DRAWING_GRAPHIC_OBJECT:
+ return new AccessibleGraphicShape (rShapeInfo, rShapeTreeInfo);
+
+ case DRAWING_APPLET:
+ case DRAWING_FRAME:
+ case DRAWING_OLE:
+ case DRAWING_PLUGIN:
+ return new AccessibleOLEShape (rShapeInfo, rShapeTreeInfo);
+
+ case DRAWING_TABLE:
+ return new AccessibleTableShape( rShapeInfo, rShapeTreeInfo );
+
+ default:
+ return NULL;
+ }
+}
+
+
+
+ShapeTypeDescriptor aSvxShapeTypeList[] = {
+ ShapeTypeDescriptor (DRAWING_TEXT,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.TextShape"),
+ CreateSvxAccessibleShape),
+ ShapeTypeDescriptor (DRAWING_RECTANGLE,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.RectangleShape"),
+ CreateSvxAccessibleShape),
+ ShapeTypeDescriptor ( DRAWING_ELLIPSE,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.EllipseShape"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_CONTROL,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.ControlShape"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_CONNECTOR,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.ConnectorShape"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_MEASURE,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.MeasureShape"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_LINE,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.LineShape"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_POLY_POLYGON,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.PolyPolygonShape"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_POLY_LINE,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.PolyLineShape"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_OPEN_BEZIER,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.OpenBezierShape"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_CLOSED_BEZIER,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.ClosedBezierShape"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_OPEN_FREEHAND,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.OpenFreeHandShape"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_CLOSED_FREEHAND,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.ClosedFreeHandShape"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_POLY_POLYGON_PATH,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.PolyPolygonPathShape"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_POLY_LINE_PATH,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.PolyLinePathShape"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_GRAPHIC_OBJECT,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.GraphicObjectShape"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_GROUP,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.GroupShape"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_OLE,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.OLE2Shape"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_PAGE,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.PageShape"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_CAPTION,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.CaptionShape"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_FRAME,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.FrameShape"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_PLUGIN,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.PluginShape"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_APPLET,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.AppletShape"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_3D_SCENE,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.Shape3DSceneObject"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_3D_CUBE,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.Shape3DCubeObject"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_3D_SPHERE,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.Shape3DSphereObject"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_3D_LATHE,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.Shape3DLatheObject"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_3D_EXTRUDE,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.Shape3DExtrudeObject"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_CUSTOM,
+ ::rtl::OUString::createFromAscii ("com.sun.star.drawing.CustomShape"),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_TABLE,
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.TableShape" ) ),
+ CreateSvxAccessibleShape ),
+ ShapeTypeDescriptor ( DRAWING_MEDIA,
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.MediaShape" ) ),
+ CreateSvxAccessibleShape ),
+
+};
+
+
+void RegisterDrawShapeTypes (void)
+{
+ // --> OD 2004-11-26 #i37790#
+ ShapeTypeHandler::Instance().AddShapeTypeList ( DRAWING_END, aSvxShapeTypeList);
+ // <--
+}
+
+
+} // end of namespace accessibility
diff --git a/svx/source/accessibility/accessibility.src b/svx/source/accessibility/accessibility.src
new file mode 100644
index 000000000000..f9784833cc3b
--- /dev/null
+++ b/svx/source/accessibility/accessibility.src
@@ -0,0 +1,262 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "accessibility.hrc"
+
+String RID_SVXSTR_A11Y_3D_MATERIAL_COLOR
+{
+ Text [ en-US ] = "3D material color" ;
+};
+String RID_SVXSTR_A11Y_TEXT_COLOR
+{
+ Text [ en-US ] = "Font color" ;
+};
+String RID_SVXSTR_A11Y_BACKGROUND_COLOR
+{
+ Text [ en-US ] = "Background color" ;
+};
+String RID_SVXSTR_A11Y_FILLSTYLE_NONE
+{
+ Text [ en-US ] = "None" ;
+};
+String RID_SVXSTR_A11Y_FILLSTYLE_SOLID
+{
+ Text [ en-US ] = "Solid" ;
+};
+String RID_SVXSTR_A11Y_FILLSTYLE_HATCH
+{
+ Text [ en-US ] = "With hatching" ;
+};
+String RID_SVXSTR_A11Y_FILLSTYLE_GRADIENT
+{
+ Text [ en-US ] = "Gradient" ;
+};
+String RID_SVXSTR_A11Y_FILLSTYLE_BITMAP
+{
+ Text [ en-US ] = "Bitmap" ;
+};
+String RID_SVXSTR_A11Y_WITH
+{
+ Text [ en-US ] = "with" ;
+};
+String RID_SVXSTR_A11Y_STYLE
+{
+ Text [ en-US ] = "Style" ;
+};
+String RID_SVXSTR_A11Y_AND
+{
+ Text [ en-US ] = "and" ;
+};
+
+
+// SvxRectCtl
+
+String RID_SVXSTR_RECTCTL_ACC_CORN_NAME
+{
+ Text [ en-US ] = "Corner control" ;
+};
+
+String RID_SVXSTR_RECTCTL_ACC_CORN_DESCR
+{
+ Text [ en-US ] = "Selection of a corner point." ;
+};
+
+String RID_SVXSTR_RECTCTL_ACC_ANGL_NAME
+{
+ Text [ en-US ] = "Angle control" ;
+};
+
+String RID_SVXSTR_RECTCTL_ACC_ANGL_DESCR
+{
+ Text [ en-US ] = "Selection of a major angle." ;
+};
+
+
+String RID_SVXSTR_RECTCTL_ACC_CHLD_LT
+{
+ Text [ en-US ] = "Top left" ;
+};
+
+String RID_SVXSTR_RECTCTL_ACC_CHLD_MT
+{
+ Text [ en-US ] = "Top middle" ;
+};
+
+String RID_SVXSTR_RECTCTL_ACC_CHLD_RT
+{
+ Text [ en-US ] = "Top right" ;
+};
+
+String RID_SVXSTR_RECTCTL_ACC_CHLD_LM
+{
+ Text [ en-US ] = "Left center" ;
+};
+
+String RID_SVXSTR_RECTCTL_ACC_CHLD_MM
+{
+ Text [ en-US ] = "Center" ;
+};
+
+String RID_SVXSTR_RECTCTL_ACC_CHLD_RM
+{
+ Text [ en-US ] = "Right center" ;
+};
+
+String RID_SVXSTR_RECTCTL_ACC_CHLD_LB
+{
+ Text [ en-US ] = "Bottom left" ;
+};
+
+String RID_SVXSTR_RECTCTL_ACC_CHLD_MB
+{
+ Text [ en-US ] = "Bottom middle" ;
+};
+
+String RID_SVXSTR_RECTCTL_ACC_CHLD_RB
+{
+ Text [ en-US ] = "Bottom right" ;
+};
+
+
+String RID_SVXSTR_RECTCTL_ACC_CHLD_A000
+{
+ Text [ en-US ] = "0 degrees" ;
+};
+
+String RID_SVXSTR_RECTCTL_ACC_CHLD_A045
+{
+ Text [ en-US ] = "45 degrees" ;
+};
+
+String RID_SVXSTR_RECTCTL_ACC_CHLD_A090
+{
+ Text [ en-US ] = "90 degrees" ;
+};
+
+String RID_SVXSTR_RECTCTL_ACC_CHLD_A135
+{
+ Text [ en-US ] = "135 degrees" ;
+};
+
+String RID_SVXSTR_RECTCTL_ACC_CHLD_A180
+{
+ Text [ en-US ] = "180 degrees" ;
+};
+
+String RID_SVXSTR_RECTCTL_ACC_CHLD_A225
+{
+ Text [ en-US ] = "225 degrees" ;
+};
+
+String RID_SVXSTR_RECTCTL_ACC_CHLD_A270
+{
+ Text [ en-US ] = "270 degrees" ;
+};
+
+String RID_SVXSTR_RECTCTL_ACC_CHLD_A315
+{
+ Text [ en-US ] = "315 degrees" ;
+};
+
+// SvxGraphCtrlAccessibleContext
+String RID_SVXSTR_GRAPHCTRL_ACC_NAME
+{
+ Text [ en-US ] = "Contour control" ;
+};
+
+String RID_SVXSTR_GRAPHCTRL_ACC_DESCRIPTION
+{
+ Text [ en-US ] = "This is where you can edit the contour." ;
+};
+
+String RID_SVXSTR_CHARACTER_SELECTION
+{
+ Text [ en-US ] = "Special character selection";
+};
+
+String RID_SVXSTR_CHAR_SEL_DESC
+{
+ Text [ en-US ] = "Select special characters in this area.";
+};
+
+String RID_SVXSTR_CHARACTER_CODE
+{
+ // The space behind is a must.
+ Text [ en-US ] = "Character code ";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/accessibility/charmapacc.cxx b/svx/source/accessibility/charmapacc.cxx
new file mode 100644
index 000000000000..c0e49e4f78b1
--- /dev/null
+++ b/svx/source/accessibility/charmapacc.cxx
@@ -0,0 +1,891 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#define _SVX_CHARMAP_CXX_
+#include <unotools/accessiblestatesethelper.hxx>
+#include <vcl/svapp.hxx>
+#include <stdio.h>
+#include <svx/charmap.hxx>
+#include "charmapacc.hxx"
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <toolkit/helper/externallock.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <osl/interlck.h>
+#include <svx/dialmgr.hxx>
+#include "accessibility.hrc"
+#include <comphelper/types.hxx>
+
+namespace svx
+{
+ using namespace comphelper;
+ using namespace ::com::sun::star;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::accessibility;
+
+// ----------------
+// - SvxShowCharSetVirtualAcc -
+// ----------------
+SvxShowCharSetVirtualAcc::SvxShowCharSetVirtualAcc( SvxShowCharSet* pParent ) : OAccessibleComponentHelper(new VCLExternalSolarLock())
+,mpParent( pParent )
+,m_pTable(NULL)
+{
+ osl_incrementInterlockedCount(&m_refCount);
+ { // #b6211265 #
+ lateInit(this);
+ }
+ osl_decrementInterlockedCount(&m_refCount);
+}
+
+// -----------------------------------------------------------------------------
+
+SvxShowCharSetVirtualAcc::~SvxShowCharSetVirtualAcc()
+{
+ ensureDisposed();
+ delete getExternalLock();
+}
+// -----------------------------------------------------------------------------
+IMPLEMENT_FORWARD_XINTERFACE2( SvxShowCharSetVirtualAcc, OAccessibleComponentHelper, OAccessibleHelper_Base_2 )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvxShowCharSetVirtualAcc, OAccessibleComponentHelper, OAccessibleHelper_Base_2 )
+
+void SAL_CALL SvxShowCharSetVirtualAcc::fireEvent(
+ const sal_Int16 _nEventId,
+ const ::com::sun::star::uno::Any& _rOldValue,
+ const ::com::sun::star::uno::Any& _rNewValue
+ )
+{
+ if ( m_pTable )
+ m_pTable->fireEvent(_nEventId,_rOldValue,_rNewValue);
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleChildCount( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ ensureAlive();
+ return ( mpParent->getScrollBar()->IsVisible() ) ? 2 : 1;
+}
+// -----------------------------------------------------------------------------
+uno::Reference< accessibility::XAccessible > SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleAtPoint( const awt::Point& aPoint )
+ throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ ensureAlive();
+
+ uno::Reference< accessibility::XAccessible > xRet;
+ const sal_uInt16 nItemId = sal::static_int_cast<sal_uInt16>(mpParent->PixelToMapIndex( Point( aPoint.X, aPoint.Y ) ));
+
+ if( sal_uInt16(-1) != nItemId )
+ {
+ if ( !m_pTable )
+ m_pTable = new SvxShowCharSetAcc(this);
+ xRet = m_pTable;
+ }
+ else if ( mpParent->getScrollBar()->IsVisible() )
+ {
+ const Point aOutPos( mpParent->getScrollBar()->GetPosPixel() );
+ const Size aScrollBar = mpParent->getScrollBar()->GetOutputSizePixel();
+ Rectangle aRect(aOutPos,aScrollBar);
+
+ if ( aRect.IsInside(VCLPoint(aPoint)) )
+ xRet = mpParent->getScrollBar()->GetAccessible();
+ }
+ return xRet;
+}
+// -----------------------------------------------------------------------------
+uno::Any SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleKeyBinding()
+ throw (uno::RuntimeException)
+{
+ return uno::Any();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL SvxShowCharSetVirtualAcc::grabFocus()
+ throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ ensureAlive();
+ mpParent->GrabFocus();
+}
+
+
+// -----------------------------------------------------------------------------
+Reference< XAccessible > SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ ensureAlive();
+ if ( mpParent->getScrollBar()->IsVisible() && i == 0 )
+ return mpParent->getScrollBar()->GetAccessible();
+ else if ( i == 1 )
+ {
+ if ( !m_xAcc.is() )
+ {
+ m_pTable = new SvxShowCharSetAcc(this);
+ m_xAcc = m_pTable;
+ }
+ }
+ else
+ throw IndexOutOfBoundsException();
+ return m_xAcc;
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessible > SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleParent( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ ensureAlive();
+ Window* pParent = mpParent->GetParent();
+ uno::Reference< accessibility::XAccessible > xRet;
+
+ if ( pParent )
+ xRet = pParent->GetAccessible();
+
+ return xRet;
+}
+// -----------------------------------------------------------------------------
+::com::sun::star::awt::Rectangle SAL_CALL SvxShowCharSetVirtualAcc::implGetBounds( ) throw (RuntimeException)
+{
+ const Point aOutPos( mpParent->GetPosPixel() );
+ Size aOutSize( mpParent->GetOutputSizePixel() );
+ if ( mpParent->getScrollBar()->IsVisible() )
+ {
+ const Size aScrollBar = mpParent->getScrollBar()->GetOutputSizePixel();
+ aOutSize.Width() -= aScrollBar.Width();
+ aOutSize.Height() -= aScrollBar.Height();
+ }
+
+ awt::Rectangle aRet;
+
+ aRet.X = aOutPos.X();
+ aRet.Y = aOutPos.Y();
+ aRet.Width = aOutSize.Width();
+ aRet.Height = aOutSize.Height();
+
+ return aRet;
+}
+// -----------------------------------------------------------------------------
+sal_Int16 SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleRole( ) throw (RuntimeException)
+{
+ return accessibility::AccessibleRole::SCROLL_PANE;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleDescription( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ return SVX_RESSTR( RID_SVXSTR_CHARACTER_SELECTION);
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleName( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ return SVX_RESSTR( RID_SVXSTR_CHAR_SEL_DESC);
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessibleRelationSet > SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleRelationSet( ) throw (RuntimeException)
+{
+ return Reference< XAccessibleRelationSet >();
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessibleStateSet > SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleStateSet( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper;
+
+ if( mpParent )
+ {
+ // SELECTABLE
+ pStateSet->AddState( AccessibleStateType::FOCUSABLE );
+ if ( mpParent->HasFocus() )
+ pStateSet->AddState( AccessibleStateType::FOCUSED );
+ if ( mpParent->IsActive() )
+ pStateSet->AddState( AccessibleStateType::ACTIVE );
+ if ( mpParent->IsEnabled() )
+ {
+ pStateSet->AddState( AccessibleStateType::ENABLED );
+ pStateSet->AddState( AccessibleStateType::SENSITIVE );
+ }
+ if ( mpParent->IsReallyVisible() )
+ pStateSet->AddState( AccessibleStateType::VISIBLE );
+ }
+
+ return pStateSet;
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL SvxShowCharSetVirtualAcc::disposing()
+{
+ OAccessibleContextHelper::disposing();
+ if ( m_pTable )
+ m_pTable->dispose();
+ m_pTable = NULL;
+}
+// -----------------------------------------------------------------------------
+// ----------------
+// - SvxShowCharSetItem -
+// ----------------
+
+SvxShowCharSetItem::SvxShowCharSetItem( SvxShowCharSet& rParent,SvxShowCharSetAcc* _pParent,sal_uInt16 _nPos ) :
+ mrParent( rParent )
+ ,mnId( _nPos )
+ ,m_pItem(NULL)
+ ,m_pParent(_pParent)
+{
+}
+// -----------------------------------------------------------------------
+
+SvxShowCharSetItem::~SvxShowCharSetItem()
+{
+ if ( m_xAcc.is() )
+ {
+ m_pItem->ParentDestroyed();
+ ClearAccessible();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+uno::Reference< accessibility::XAccessible > SvxShowCharSetItem::GetAccessible()
+{
+ if( !m_xAcc.is() )
+ {
+ m_pItem = new SvxShowCharSetItemAcc( this );
+ m_xAcc = m_pItem;
+ }
+
+ return m_xAcc;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSetItem::ClearAccessible()
+{
+ if ( m_xAcc.is() )
+ {
+ m_pItem = NULL;
+ m_xAcc = NULL;
+ }
+}
+
+
+// ---------------
+// - SvxShowCharSetAcc -
+// ---------------
+
+SvxShowCharSetAcc::SvxShowCharSetAcc( SvxShowCharSetVirtualAcc* _pParent ) : OAccessibleSelectionHelper(new VCLExternalSolarLock())
+ ,m_pParent( _pParent )
+{
+ osl_incrementInterlockedCount(&m_refCount);
+ { // #b6211265 #
+ lateInit(this);
+ }
+ osl_decrementInterlockedCount(&m_refCount);
+}
+
+// -----------------------------------------------------------------------------
+
+SvxShowCharSetAcc::~SvxShowCharSetAcc()
+{
+ ensureDisposed();
+ delete getExternalLock();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL SvxShowCharSetAcc::disposing()
+{
+ OAccessibleSelectionHelper::disposing();
+ ::std::vector< Reference< XAccessible > >::iterator aIter = m_aChildren.begin();
+ ::std::vector< Reference< XAccessible > >::iterator aEnd = m_aChildren.end();
+ for (;aIter != aEnd ; ++aIter)
+ ::comphelper::disposeComponent(*aIter);
+
+ m_aChildren.clear();
+ m_pParent = NULL;
+}
+
+// -----------------------------------------------------------------------------
+IMPLEMENT_FORWARD_XINTERFACE2( SvxShowCharSetAcc, OAccessibleSelectionHelper, OAccessibleHelper_Base )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvxShowCharSetAcc, OAccessibleSelectionHelper, OAccessibleHelper_Base )
+// -----------------------------------------------------------------------
+sal_Bool SvxShowCharSetAcc::implIsSelected( sal_Int32 nAccessibleChildIndex ) throw (RuntimeException)
+{
+ return m_pParent && m_pParent->getCharSetControl()->IsSelected(
+ sal::static_int_cast<sal_uInt16>(nAccessibleChildIndex));
+}
+// -----------------------------------------------------------------------------
+ // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
+void SvxShowCharSetAcc::implSelect( sal_Int32 nAccessibleChildIndex, sal_Bool bSelect ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ if ( m_pParent )
+ {
+ if ( bSelect )
+ m_pParent->getCharSetControl()->SelectIndex(nAccessibleChildIndex,sal_True);
+ else
+ m_pParent->getCharSetControl()->DeSelect();
+ }
+}
+// -----------------------------------------------------------------------------
+::com::sun::star::awt::Rectangle SAL_CALL SvxShowCharSetAcc::implGetBounds( ) throw (RuntimeException)
+{
+ const Point aOutPos( m_pParent->getCharSetControl()->GetPosPixel() );
+ Size aOutSize( m_pParent->getCharSetControl()->GetOutputSizePixel());
+ if ( m_pParent->getCharSetControl()->getScrollBar()->IsVisible() )
+ {
+ const Size aScrollBar = m_pParent->getCharSetControl()->getScrollBar()->GetOutputSizePixel();
+ aOutSize.Width() -= aScrollBar.Width();
+ aOutSize.Height() -= aScrollBar.Height();
+ }
+
+ awt::Rectangle aRet;
+
+ aRet.X = aOutPos.X();
+ aRet.Y = aOutPos.Y();
+ aRet.Width = aOutSize.Width();
+ aRet.Height = aOutSize.Height();
+
+ return aRet;
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleChildCount()
+ throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ ensureAlive();
+ return m_pParent->getCharSetControl()->getMaxCharCount();
+}
+
+// -----------------------------------------------------------------------------
+
+uno::Reference< accessibility::XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleChild( sal_Int32 i )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ ensureAlive();
+ uno::Reference< accessibility::XAccessible > xRet;
+ SvxShowCharSetItem* pItem = m_pParent->getCharSetControl()->ImplGetItem( static_cast< sal_uInt16 >( i ) );
+
+ if( pItem )
+ {
+ pItem->m_pParent = this;
+ xRet = pItem->GetAccessible();
+ m_aChildren.push_back(xRet);
+ }
+ else
+ throw lang::IndexOutOfBoundsException();
+
+ return xRet;
+}
+
+// -----------------------------------------------------------------------------
+
+uno::Reference< accessibility::XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleParent()
+ throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ ensureAlive();
+ return m_pParent;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int16 SAL_CALL SvxShowCharSetAcc::getAccessibleRole()
+ throw (uno::RuntimeException)
+{
+ return accessibility::AccessibleRole::TABLE;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL SvxShowCharSetAcc::getAccessibleDescription()
+ throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ return SVX_RESSTR( RID_SVXSTR_CHARACTER_SELECTION );
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL SvxShowCharSetAcc::getAccessibleName()
+ throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ ensureAlive();
+ return SVX_RESSTR( RID_SVXSTR_CHAR_SEL_DESC );
+}
+
+// -----------------------------------------------------------------------------
+
+uno::Reference< accessibility::XAccessibleRelationSet > SAL_CALL SvxShowCharSetAcc::getAccessibleRelationSet()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< accessibility::XAccessibleRelationSet >();
+}
+
+// -----------------------------------------------------------------------------
+
+uno::Reference< accessibility::XAccessibleStateSet > SAL_CALL SvxShowCharSetAcc::getAccessibleStateSet()
+ throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper;
+
+ if( m_pParent->getCharSetControl() )
+ {
+ // SELECTABLE
+ pStateSet->AddState( AccessibleStateType::FOCUSABLE );
+ if ( m_pParent->getCharSetControl()->HasFocus() )
+ pStateSet->AddState( AccessibleStateType::FOCUSED );
+ if ( m_pParent->getCharSetControl()->IsActive() )
+ pStateSet->AddState( AccessibleStateType::ACTIVE );
+ if ( m_pParent->getCharSetControl()->IsEnabled() )
+ {
+ pStateSet->AddState( AccessibleStateType::ENABLED );
+ pStateSet->AddState( AccessibleStateType::SENSITIVE );
+ }
+ if ( m_pParent->getCharSetControl()->IsReallyVisible() )
+ pStateSet->AddState( AccessibleStateType::VISIBLE );
+
+ pStateSet->AddState( AccessibleStateType::MANAGES_DESCENDANTS );
+ }
+
+ return pStateSet;
+}
+// -----------------------------------------------------------------------------
+
+uno::Reference< accessibility::XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleAtPoint( const awt::Point& aPoint )
+ throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ ensureAlive();
+
+ uno::Reference< accessibility::XAccessible > xRet;
+ const sal_uInt16 nItemId = sal::static_int_cast<sal_uInt16>(
+ m_pParent->getCharSetControl()->PixelToMapIndex( Point( aPoint.X, aPoint.Y ) ));
+
+ if( sal_uInt16(-1) != nItemId )
+ {
+ SvxShowCharSetItem* pItem = m_pParent->getCharSetControl()->ImplGetItem( nItemId );
+ xRet = pItem->GetAccessible();
+ }
+ return xRet;
+}
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SvxShowCharSetAcc::grabFocus()
+ throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ ensureAlive();
+ m_pParent->getCharSetControl()->GrabFocus();
+}
+
+// -----------------------------------------------------------------------------
+
+uno::Any SAL_CALL SvxShowCharSetAcc::getAccessibleKeyBinding()
+ throw (uno::RuntimeException)
+{
+ return uno::Any();
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleRowCount( ) throw (RuntimeException)
+{
+ return ((getAccessibleChildCount()-1) / COLUMN_COUNT) + 1;
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleColumnCount( ) throw (RuntimeException)
+{
+ return COLUMN_COUNT;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString SAL_CALL SvxShowCharSetAcc::getAccessibleRowDescription( sal_Int32 /*nRow*/ ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ return ::rtl::OUString();
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString SAL_CALL SvxShowCharSetAcc::getAccessibleColumnDescription( sal_Int32 /*nColumn*/ ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ return ::rtl::OUString();
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleRowExtentAt( sal_Int32 /*nRow*/, sal_Int32 /*nColumn*/ ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ return 1;
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleColumnExtentAt( sal_Int32 /*nRow*/, sal_Int32 /*nColumn*/ ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ return 1;
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessibleTable > SAL_CALL SvxShowCharSetAcc::getAccessibleRowHeaders( ) throw (RuntimeException)
+{
+ return Reference< XAccessibleTable >();
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessibleTable > SAL_CALL SvxShowCharSetAcc::getAccessibleColumnHeaders( ) throw (RuntimeException)
+{
+ return Reference< XAccessibleTable >();
+}
+// -----------------------------------------------------------------------------
+Sequence< sal_Int32 > SAL_CALL SvxShowCharSetAcc::getSelectedAccessibleRows( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ ensureAlive();
+ Sequence< sal_Int32 > aSel(1);
+ aSel[0] = m_pParent->getCharSetControl()->GetRowPos(m_pParent->getCharSetControl()->GetSelectIndexId());
+ return aSel;
+}
+// -----------------------------------------------------------------------------
+Sequence< sal_Int32 > SAL_CALL SvxShowCharSetAcc::getSelectedAccessibleColumns( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ ensureAlive();
+ Sequence< sal_Int32 > aSel(1);
+ aSel[0] = m_pParent->getCharSetControl()->GetColumnPos(m_pParent->getCharSetControl()->GetSelectIndexId());
+ return aSel;
+}
+// -----------------------------------------------------------------------------
+sal_Bool SAL_CALL SvxShowCharSetAcc::isAccessibleRowSelected( sal_Int32 nRow ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ ensureAlive();
+ return m_pParent->getCharSetControl()->GetRowPos(m_pParent->getCharSetControl()->GetSelectIndexId()) == nRow;
+}
+// -----------------------------------------------------------------------------
+sal_Bool SAL_CALL SvxShowCharSetAcc::isAccessibleColumnSelected( sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ ensureAlive();
+ return m_pParent->getCharSetControl()->GetColumnPos(m_pParent->getCharSetControl()->GetSelectIndexId()) == nColumn;
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ ensureAlive();
+ ::svx::SvxShowCharSetItem* pItem = m_pParent->getCharSetControl()->ImplGetItem(
+ sal::static_int_cast<sal_uInt16>(getAccessibleIndex(nRow,nColumn) ));
+ if ( !pItem )
+ throw IndexOutOfBoundsException();
+ return pItem->GetAccessible();
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleCaption( ) throw (RuntimeException)
+{
+ return Reference< XAccessible >();
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleSummary( ) throw (RuntimeException)
+{
+ return Reference< XAccessible >();
+}
+// -----------------------------------------------------------------------------
+sal_Bool SAL_CALL SvxShowCharSetAcc::isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ ensureAlive();
+ return m_pParent->getCharSetControl()->GetSelectIndexId() == getAccessibleIndex(nRow,nColumn);
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ return (nRow*COLUMN_COUNT) + nColumn;
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleRow( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ ensureAlive();
+ return m_pParent->getCharSetControl()->GetRowPos(sal::static_int_cast<sal_uInt16>(nChildIndex));
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleColumn( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ ensureAlive();
+ return m_pParent->getCharSetControl()->GetColumnPos(sal::static_int_cast<sal_uInt16>(nChildIndex));
+}
+// -----------------------------------------------------------------------------
+
+// -----------------------------------------------------------------------------
+// ----------------
+// - SvxShowCharSetItemAcc -
+// ----------------
+
+SvxShowCharSetItemAcc::SvxShowCharSetItemAcc( SvxShowCharSetItem* pParent ) : OAccessibleComponentHelper(new VCLExternalSolarLock())
+,mpParent( pParent )
+{
+ OSL_ENSURE(pParent,"NO parent supplied!");
+ osl_incrementInterlockedCount(&m_refCount);
+ { // #b6211265 #
+ lateInit(this);
+ }
+ osl_decrementInterlockedCount(&m_refCount);
+}
+
+// -----------------------------------------------------------------------------
+
+SvxShowCharSetItemAcc::~SvxShowCharSetItemAcc()
+{
+ ensureDisposed();
+ delete getExternalLock();
+}
+// -----------------------------------------------------------------------------
+IMPLEMENT_FORWARD_XINTERFACE2( SvxShowCharSetItemAcc, OAccessibleComponentHelper, OAccessibleHelper_Base_2 )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvxShowCharSetItemAcc, OAccessibleComponentHelper, OAccessibleHelper_Base_2 )
+// -----------------------------------------------------------------------------
+
+void SvxShowCharSetItemAcc::ParentDestroyed()
+{
+ const ::osl::MutexGuard aGuard( GetMutex() );
+ mpParent = NULL;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL SvxShowCharSetItemAcc::getAccessibleChildCount()
+ throw (uno::RuntimeException)
+{
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+uno::Reference< accessibility::XAccessible > SAL_CALL SvxShowCharSetItemAcc::getAccessibleChild( sal_Int32 /*i*/ )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ throw lang::IndexOutOfBoundsException();
+}
+
+// -----------------------------------------------------------------------------
+
+uno::Reference< accessibility::XAccessible > SAL_CALL SvxShowCharSetItemAcc::getAccessibleParent()
+ throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ ensureAlive();
+ return mpParent->m_pParent;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int16 SAL_CALL SvxShowCharSetItemAcc::getAccessibleRole()
+ throw (uno::RuntimeException)
+{
+ return accessibility::AccessibleRole::LABEL;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL SvxShowCharSetItemAcc::getAccessibleDescription()
+ throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ ensureAlive();
+ String sDescription = SVX_RESSTR( RID_SVXSTR_CHARACTER_CODE );
+
+ sal_Unicode c = mpParent->maText.GetChar(0);
+ char buf[16] = "0x0000";
+ sal_Unicode c_Shifted = c;
+ for( int i = 0; i < 4; ++i )
+ {
+ char h = (char)(c_Shifted & 0x0F);
+ buf[5-i] = (h > 9) ? (h - 10 + 'A') : (h + '0');
+ c_Shifted >>= 4;
+ }
+ if( c < 256 )
+ snprintf( buf+6, 10, " (%d)", c );
+ sDescription.AppendAscii(buf);
+
+ return sDescription;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL SvxShowCharSetItemAcc::getAccessibleName()
+ throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ ensureAlive();
+ String aRet;
+
+ if( mpParent )
+ {
+ aRet = mpParent->maText;
+
+ if( !aRet.Len() )
+ aRet = getAccessibleDescription();
+ }
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+uno::Reference< accessibility::XAccessibleRelationSet > SAL_CALL SvxShowCharSetItemAcc::getAccessibleRelationSet()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< accessibility::XAccessibleRelationSet >();
+}
+
+// -----------------------------------------------------------------------------
+
+uno::Reference< accessibility::XAccessibleStateSet > SAL_CALL SvxShowCharSetItemAcc::getAccessibleStateSet()
+ throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ ensureAlive();
+
+ ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper;
+
+ if( mpParent )
+ {
+ // SELECTABLE
+ pStateSet->AddState( accessibility::AccessibleStateType::SELECTABLE );
+ pStateSet->AddState( accessibility::AccessibleStateType::FOCUSABLE );
+
+ // SELECTED
+ if( mpParent->mrParent.GetSelectIndexId() == mpParent->mnId )
+ {
+ pStateSet->AddState( accessibility::AccessibleStateType::SELECTED );
+ pStateSet->AddState( accessibility::AccessibleStateType::FOCUSED );
+ }
+ if ( mpParent->mnId >= mpParent->mrParent.FirstInView() && mpParent->mnId <= mpParent->mrParent.LastInView() )
+ pStateSet->AddState( AccessibleStateType::VISIBLE );
+ pStateSet->AddState( AccessibleStateType::TRANSIENT );
+ }
+
+ return pStateSet;
+}
+
+// -----------------------------------------------------------------------------
+void SAL_CALL SvxShowCharSetItemAcc::grabFocus()
+ throw (uno::RuntimeException)
+{
+ // nothing to do
+}
+
+// -----------------------------------------------------------------------------
+
+uno::Any SAL_CALL SvxShowCharSetItemAcc::getAccessibleKeyBinding()
+ throw (uno::RuntimeException)
+{
+ return uno::Any();
+}
+// -----------------------------------------------------------------------------
+awt::Rectangle SAL_CALL SvxShowCharSetItemAcc::implGetBounds( ) throw (RuntimeException)
+{
+ awt::Rectangle aRet;
+
+ if( mpParent )
+ {
+ Rectangle aRect( mpParent->maRect );
+ Point aOrigin;
+ Rectangle aParentRect( aOrigin, mpParent->mrParent.GetOutputSizePixel() );
+
+ aRect.Intersection( aParentRect );
+
+ aRet.X = aRect.Left();
+ aRet.Y = aRect.Top();
+ aRet.Width = aRect.GetWidth();
+ aRet.Height = aRect.GetHeight();
+ }
+
+ return aRet;
+}
+// -----------------------------------------------------------------------------
+uno::Reference< accessibility::XAccessible > SAL_CALL SvxShowCharSetItemAcc::getAccessibleAtPoint( const awt::Point& /*aPoint*/ )
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< accessibility::XAccessible >();
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL SvxShowCharSetVirtualAcc::getForeground( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nColor = 0;
+ if ( mpParent )
+ {
+ if ( mpParent->IsControlForeground() )
+ nColor = mpParent->GetControlForeground().GetColor();
+ else
+ {
+ Font aFont;
+ if ( mpParent->IsControlFont() )
+ aFont = mpParent->GetControlFont();
+ else
+ aFont = mpParent->GetFont();
+ nColor = aFont.GetColor().GetColor();
+ }
+ }
+
+ return nColor;
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL SvxShowCharSetVirtualAcc::getBackground( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ sal_Int32 nColor = 0;
+ if ( mpParent )
+ {
+ if ( mpParent->IsControlBackground() )
+ nColor = mpParent->GetControlBackground().GetColor();
+ else
+ nColor = mpParent->GetBackground().GetColor().GetColor();
+ }
+
+ return nColor;
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL SvxShowCharSetAcc::getForeground( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nColor = 0;
+ if ( m_pParent )
+ nColor = m_pParent->getForeground();
+ return nColor;
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL SvxShowCharSetAcc::getBackground( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ sal_Int32 nColor = 0;
+ if ( m_pParent )
+ nColor = m_pParent->getBackground();
+ return nColor;
+}
+// -----------------------------------------------------------------------------
+
+// -----------------------------------------------------------------------------
+} // namespace svx
+// -----------------------------------------------------------------------------
+
+
diff --git a/svx/source/accessibility/svxrectctaccessiblecontext.cxx b/svx/source/accessibility/svxrectctaccessiblecontext.cxx
new file mode 100644
index 000000000000..9dfb97dff4ac
--- /dev/null
+++ b/svx/source/accessibility/svxrectctaccessiblecontext.cxx
@@ -0,0 +1,1206 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+
+#include "svxrectctaccessiblecontext.hxx"
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/beans/PropertyChangeEvent.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <cppuhelper/typeprovider.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <vcl/svapp.hxx>
+#include <osl/mutex.hxx>
+#include <rtl/uuid.h>
+#include <tools/debug.hxx>
+#include <tools/gen.hxx>
+
+#include <svx/dialogs.hrc>
+#include "accessibility.hrc"
+#include <svx/dlgctrl.hxx>
+#include <svx/dialmgr.hxx>
+#include <comphelper/accessibleeventnotifier.hxx>
+
+
+using namespace ::cppu;
+using namespace ::osl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::accessibility;
+
+
+#define MAX_NUM_OF_CHILDS 9
+#define NOCHILDSELECTED -1
+
+
+DBG_NAME( SvxRectCtlAccessibleContext )
+
+
+//===== internal ============================================================
+
+namespace
+{
+ struct ChildIndexToPointData
+ {
+ short nResIdName;
+ short nResIdDescr;
+ RECT_POINT ePoint;
+ };
+}
+
+
+static const ChildIndexToPointData* IndexToPoint( long nIndex, sal_Bool bAngleControl )
+{
+ DBG_ASSERT( nIndex < ( bAngleControl? 8 : 9 ) && nIndex >= 0, "-IndexToPoint(): invalid child index! You have been warned..." );
+
+ // angles are counted reverse counter clock wise
+ static const ChildIndexToPointData pAngleData[] =
+ { // index
+ { RID_SVXSTR_RECTCTL_ACC_CHLD_A000, RID_SVXSTR_RECTCTL_ACC_CHLD_A000, RP_RM }, // 0
+ { RID_SVXSTR_RECTCTL_ACC_CHLD_A045, RID_SVXSTR_RECTCTL_ACC_CHLD_A045, RP_RT }, // 1
+ { RID_SVXSTR_RECTCTL_ACC_CHLD_A090, RID_SVXSTR_RECTCTL_ACC_CHLD_A090, RP_MT }, // 2
+ { RID_SVXSTR_RECTCTL_ACC_CHLD_A135, RID_SVXSTR_RECTCTL_ACC_CHLD_A135, RP_LT }, // 3
+ { RID_SVXSTR_RECTCTL_ACC_CHLD_A180, RID_SVXSTR_RECTCTL_ACC_CHLD_A180, RP_LM }, // 4
+ { RID_SVXSTR_RECTCTL_ACC_CHLD_A225, RID_SVXSTR_RECTCTL_ACC_CHLD_A225, RP_LB }, // 5
+ { RID_SVXSTR_RECTCTL_ACC_CHLD_A270, RID_SVXSTR_RECTCTL_ACC_CHLD_A270, RP_MB }, // 6
+ { RID_SVXSTR_RECTCTL_ACC_CHLD_A315, RID_SVXSTR_RECTCTL_ACC_CHLD_A315, RP_RB } // 7
+ };
+
+ // corners are counted from left to right and top to bottom
+ static const ChildIndexToPointData pCornerData[] =
+ { // index
+ { RID_SVXSTR_RECTCTL_ACC_CHLD_LT, RID_SVXSTR_RECTCTL_ACC_CHLD_LT, RP_LT }, // 0
+ { RID_SVXSTR_RECTCTL_ACC_CHLD_MT, RID_SVXSTR_RECTCTL_ACC_CHLD_MT, RP_MT }, // 1
+ { RID_SVXSTR_RECTCTL_ACC_CHLD_RT, RID_SVXSTR_RECTCTL_ACC_CHLD_RT, RP_RT }, // 2
+ { RID_SVXSTR_RECTCTL_ACC_CHLD_LM, RID_SVXSTR_RECTCTL_ACC_CHLD_LM, RP_LM }, // 3
+ { RID_SVXSTR_RECTCTL_ACC_CHLD_MM, RID_SVXSTR_RECTCTL_ACC_CHLD_MM, RP_MM }, // 4
+ { RID_SVXSTR_RECTCTL_ACC_CHLD_RM, RID_SVXSTR_RECTCTL_ACC_CHLD_RM, RP_RM }, // 5
+ { RID_SVXSTR_RECTCTL_ACC_CHLD_LB, RID_SVXSTR_RECTCTL_ACC_CHLD_LB, RP_LB }, // 6
+ { RID_SVXSTR_RECTCTL_ACC_CHLD_MB, RID_SVXSTR_RECTCTL_ACC_CHLD_MB, RP_MB }, // 7
+ { RID_SVXSTR_RECTCTL_ACC_CHLD_RB, RID_SVXSTR_RECTCTL_ACC_CHLD_RB, RP_RB } // 8
+ };
+
+ return ( bAngleControl? pAngleData : pCornerData ) + nIndex;
+}
+
+
+static long PointToIndex( RECT_POINT ePoint, sal_Bool bAngleControl )
+{
+ long nRet( (long) ePoint );
+ if( bAngleControl )
+ { // angle control
+ // angles are counted reverse counter clock wise
+ switch( ePoint )
+ {
+ case RP_LT: nRet = 3; break;
+ case RP_MT: nRet = 2; break;
+ case RP_RT: nRet = 1; break;
+ case RP_LM: nRet = 4; break;
+ case RP_MM: nRet = NOCHILDSELECTED; break;
+ case RP_RM: nRet = 0; break;
+ case RP_LB: nRet = 5; break;
+ case RP_MB: nRet = 6; break;
+ case RP_RB: nRet = 7; break;
+ }
+ }
+ else
+ { // corner control
+ // corners are counted from left to right and top to bottom
+ DBG_ASSERT( RP_LT == 0 && RP_MT == 1 && RP_RT == 2 && RP_LM == 3 && RP_MM == 4 && RP_RM == 5 &&
+ RP_LB == 6 && RP_MB == 7 && RP_RB == 8, "*PointToIndex(): unexpected enum value!" );
+
+ nRet = ( long ) ePoint;
+ }
+
+ return nRet;
+}
+
+
+SvxRectCtlAccessibleContext::SvxRectCtlAccessibleContext(
+ const Reference< XAccessible >& rxParent,
+ SvxRectCtl& rRepr,
+ const ::rtl::OUString* pName,
+ const ::rtl::OUString* pDesc ) :
+
+ SvxRectCtlAccessibleContext_Base( m_aMutex ),
+ mxParent( rxParent ),
+ mpRepr( &rRepr ),
+ mpChilds( NULL ),
+ mnClientId( 0 ),
+ mnSelectedChild( NOCHILDSELECTED ),
+ mbAngleMode( rRepr.GetNumOfChilds() == 8 )
+{
+ DBG_CTOR( SvxRectCtlAccessibleContext, NULL );
+
+ if( pName )
+ msName = *pName;
+ else
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ msName = SVX_RESSTR( mbAngleMode? RID_SVXSTR_RECTCTL_ACC_ANGL_NAME : RID_SVXSTR_RECTCTL_ACC_CORN_NAME );
+ }
+
+ if( pDesc )
+ msDescription = *pDesc;
+ else
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ msDescription = SVX_RESSTR( mbAngleMode? RID_SVXSTR_RECTCTL_ACC_ANGL_DESCR : RID_SVXSTR_RECTCTL_ACC_CORN_DESCR );
+ }
+
+ mpChilds = new SvxRectCtlChildAccessibleContext*[ MAX_NUM_OF_CHILDS ];
+
+ SvxRectCtlChildAccessibleContext** p = mpChilds;
+ for( int i = MAX_NUM_OF_CHILDS ; i ; --i, ++p )
+ *p = NULL;
+}
+
+
+SvxRectCtlAccessibleContext::~SvxRectCtlAccessibleContext()
+{
+ DBG_DTOR( SvxRectCtlAccessibleContext, NULL );
+
+ if( IsAlive() )
+ {
+ osl_incrementInterlockedCount( &m_refCount );
+ dispose(); // set mpRepr = NULL & release all childs
+ }
+}
+
+//===== XAccessible =========================================================
+
+Reference< XAccessibleContext > SAL_CALL SvxRectCtlAccessibleContext::getAccessibleContext( void ) throw( RuntimeException )
+{
+ return this;
+}
+
+//===== XAccessibleComponent ================================================
+
+sal_Bool SAL_CALL SvxRectCtlAccessibleContext::containsPoint( const awt::Point& rPoint ) throw( RuntimeException )
+{
+ // no guard -> done in getBounds()
+// return GetBoundingBox().IsInside( VCLPoint( rPoint ) );
+ return Rectangle( Point( 0, 0 ), GetBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) );
+}
+
+Reference< XAccessible > SAL_CALL SvxRectCtlAccessibleContext::getAccessibleAtPoint( const awt::Point& rPoint ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ ThrowExceptionIfNotAlive();
+
+ Reference< XAccessible > xRet;
+
+ long nChild = PointToIndex( mpRepr->GetApproxRPFromPixPt( rPoint ), mbAngleMode );
+
+ if( nChild != NOCHILDSELECTED )
+ xRet = getAccessibleChild( nChild );
+
+ return xRet;
+}
+
+awt::Rectangle SAL_CALL SvxRectCtlAccessibleContext::getBounds() throw( RuntimeException )
+{
+ // no guard -> done in GetBoundingBox()
+ return AWTRectangle( GetBoundingBox() );
+}
+
+awt::Point SAL_CALL SvxRectCtlAccessibleContext::getLocation() throw( RuntimeException )
+{
+ // no guard -> done in GetBoundingBox()
+ return AWTPoint( GetBoundingBox().TopLeft() );
+}
+
+awt::Point SAL_CALL SvxRectCtlAccessibleContext::getLocationOnScreen() throw( RuntimeException )
+{
+ // no guard -> done in GetBoundingBoxOnScreen()
+ return AWTPoint( GetBoundingBoxOnScreen().TopLeft() );
+}
+
+awt::Size SAL_CALL SvxRectCtlAccessibleContext::getSize() throw( RuntimeException )
+{
+ // no guard -> done in GetBoundingBox()
+ return AWTSize( GetBoundingBox().GetSize() );
+}
+
+sal_Bool SAL_CALL SvxRectCtlAccessibleContext::isShowing() throw( RuntimeException )
+{
+ return sal_True;
+}
+
+sal_Bool SAL_CALL SvxRectCtlAccessibleContext::isVisible() throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ ThrowExceptionIfNotAlive();
+
+ return mpRepr->IsVisible();
+}
+
+sal_Bool SAL_CALL SvxRectCtlAccessibleContext::isFocusTraversable() throw( RuntimeException )
+{
+ return sal_True;
+}
+
+//===== XAccessibleContext ==================================================
+
+sal_Int32 SAL_CALL SvxRectCtlAccessibleContext::getAccessibleChildCount( void ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ ThrowExceptionIfNotAlive();
+
+ return mpRepr->GetNumOfChilds();
+}
+
+Reference< XAccessible > SAL_CALL SvxRectCtlAccessibleContext::getAccessibleChild( sal_Int32 nIndex )
+ throw( RuntimeException, lang::IndexOutOfBoundsException )
+{
+ checkChildIndex( nIndex );
+
+ Reference< XAccessible > xChild = mpChilds[ nIndex ];
+ if( !xChild.is() )
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ ThrowExceptionIfNotAlive();
+
+ xChild = mpChilds[ nIndex ];
+
+ if( !xChild.is() )
+ {
+ const ChildIndexToPointData* p = IndexToPoint( nIndex, mbAngleMode );
+ UniString tmp = SVX_RESSTR( p->nResIdName );
+ ::rtl::OUString aName( tmp );
+ tmp = SVX_RESSTR( p->nResIdDescr );
+ ::rtl::OUString aDescr( tmp );
+
+ Rectangle aFocusRect( mpRepr->CalculateFocusRectangle( p->ePoint ) );
+
+ Rectangle aBoundingBoxOnScreen( mpRepr->OutputToScreenPixel( aFocusRect.TopLeft() ), aFocusRect.GetSize() );
+
+ SvxRectCtlChildAccessibleContext* pChild = new SvxRectCtlChildAccessibleContext(
+ this, *mpRepr, aName, aDescr, aFocusRect, nIndex );
+ xChild = mpChilds[ nIndex ] = pChild;
+ pChild->acquire();
+
+ // set actual state
+ if( mnSelectedChild == nIndex )
+ pChild->setStateChecked( sal_True );
+ }
+ }
+
+ return xChild;
+}
+
+Reference< XAccessible > SAL_CALL SvxRectCtlAccessibleContext::getAccessibleParent( void ) throw( RuntimeException )
+{
+ return mxParent;
+}
+
+sal_Int32 SAL_CALL SvxRectCtlAccessibleContext::getAccessibleIndexInParent( void ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ // Use a simple but slow solution for now. Optimize later.
+
+ // Iterate over all the parent's children and search for this object.
+ if( mxParent.is() )
+ {
+ Reference< XAccessibleContext > xParentContext( mxParent->getAccessibleContext() );
+ if( xParentContext.is() )
+ {
+ sal_Int32 nChildCount = xParentContext->getAccessibleChildCount();
+ for( sal_Int32 i = 0 ; i < nChildCount ; ++i )
+ {
+ Reference< XAccessible > xChild( xParentContext->getAccessibleChild( i ) );
+ if( xChild.get() == ( XAccessible* ) this )
+ return i;
+ }
+ }
+ }
+
+ // Return -1 to indicate that this object's parent does not know about the
+ // object.
+ return -1;
+}
+
+sal_Int16 SAL_CALL SvxRectCtlAccessibleContext::getAccessibleRole( void ) throw( RuntimeException )
+{
+ return AccessibleRole::PANEL;
+}
+
+::rtl::OUString SAL_CALL SvxRectCtlAccessibleContext::getAccessibleDescription( void ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ return msDescription;
+}
+
+::rtl::OUString SAL_CALL SvxRectCtlAccessibleContext::getAccessibleName( void ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ return msName;
+}
+
+/** Return empty reference to indicate that the relation set is not
+ supported.
+*/
+Reference< XAccessibleRelationSet > SAL_CALL SvxRectCtlAccessibleContext::getAccessibleRelationSet( void ) throw( RuntimeException )
+{
+ return Reference< XAccessibleRelationSet >();
+}
+
+Reference< XAccessibleStateSet > SAL_CALL SvxRectCtlAccessibleContext::getAccessibleStateSet( void ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
+
+ if( IsAlive() )
+ {
+ // pStateSetHelper->AddState( AccessibleStateType::ENABLED );
+ // pStateSetHelper->AddState( AccessibleStateType::SENSITIVE );
+ pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE );
+ if( mpRepr->HasFocus() )
+ pStateSetHelper->AddState( AccessibleStateType::FOCUSED );
+ pStateSetHelper->AddState( AccessibleStateType::OPAQUE );
+
+ if( isShowing() )
+ pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+
+ if( isVisible() )
+ pStateSetHelper->AddState( AccessibleStateType::VISIBLE );
+ }
+ else
+ pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+
+ return pStateSetHelper;
+}
+
+lang::Locale SAL_CALL SvxRectCtlAccessibleContext::getLocale( void ) throw( IllegalAccessibleComponentStateException, RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if( mxParent.is() )
+ {
+ Reference< XAccessibleContext > xParentContext( mxParent->getAccessibleContext() );
+ if( xParentContext.is() )
+ return xParentContext->getLocale();
+ }
+
+ // No parent. Therefore throw exception to indicate this cluelessness.
+ throw IllegalAccessibleComponentStateException();
+}
+
+void SAL_CALL SvxRectCtlAccessibleContext::addEventListener( const Reference< XAccessibleEventListener >& xListener )
+ throw( RuntimeException )
+{
+ if (xListener.is())
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if (!mnClientId)
+ mnClientId = comphelper::AccessibleEventNotifier::registerClient( );
+ comphelper::AccessibleEventNotifier::addEventListener( mnClientId, xListener );
+ }
+}
+
+void SAL_CALL SvxRectCtlAccessibleContext::removeEventListener( const Reference< XAccessibleEventListener >& xListener )
+ throw( RuntimeException )
+{
+ if (xListener.is())
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener );
+ if ( !nListenerCount )
+ {
+ // no listeners anymore
+ // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
+ // and at least to us not firing any events anymore, in case somebody calls
+ // NotifyAccessibleEvent, again
+ comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
+ mnClientId = 0;
+ }
+ }
+}
+
+void SAL_CALL SvxRectCtlAccessibleContext::addFocusListener( const Reference< awt::XFocusListener >& xListener )
+ throw( RuntimeException )
+{
+ if( xListener.is() )
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ ThrowExceptionIfNotAlive();
+
+ Reference< awt::XWindow > xWindow = VCLUnoHelper::GetInterface( mpRepr );
+ if( xWindow.is() )
+ xWindow->addFocusListener( xListener );
+ }
+}
+
+void SAL_CALL SvxRectCtlAccessibleContext::removeFocusListener( const Reference< awt::XFocusListener >& xListener )
+ throw (RuntimeException)
+{
+ if( xListener.is() )
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ ThrowExceptionIfNotAlive();
+
+ Reference< awt::XWindow > xWindow = VCLUnoHelper::GetInterface( mpRepr );
+ if( xWindow.is() )
+ xWindow->removeFocusListener( xListener );
+ }
+}
+
+void SAL_CALL SvxRectCtlAccessibleContext::grabFocus() throw( RuntimeException )
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ ThrowExceptionIfNotAlive();
+
+ mpRepr->GrabFocus();
+}
+
+Any SAL_CALL SvxRectCtlAccessibleContext::getAccessibleKeyBinding() throw( RuntimeException )
+{
+ // here is no implementation, because here are no KeyBindings for every object
+ return Any();
+}
+
+sal_Int32 SvxRectCtlAccessibleContext::getForeground( )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+ ThrowExceptionIfNotAlive();
+
+ return mpRepr->GetControlForeground().GetColor();
+}
+sal_Int32 SvxRectCtlAccessibleContext::getBackground( )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+ ThrowExceptionIfNotAlive();
+
+ return mpRepr->GetControlBackground().GetColor();
+}
+
+//===== XServiceInfo ========================================================
+
+::rtl::OUString SAL_CALL SvxRectCtlAccessibleContext::getImplementationName( void ) throw( RuntimeException )
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.ui.SvxRectCtlAccessibleContext" ) );
+}
+
+sal_Bool SAL_CALL SvxRectCtlAccessibleContext::supportsService( const ::rtl::OUString& sServiceName ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ // Iterate over all supported service names and return true if on of them
+ // matches the given name.
+ Sequence< ::rtl::OUString > aSupportedServices( getSupportedServiceNames() );
+ int nLength = aSupportedServices.getLength();
+ const ::rtl::OUString* pStr = aSupportedServices.getConstArray();
+
+ for( int i = nLength ; i ; --i, ++pStr )
+ {
+ if( sServiceName == *pStr )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+Sequence< ::rtl::OUString > SAL_CALL SvxRectCtlAccessibleContext::getSupportedServiceNames( void ) throw( RuntimeException )
+{
+ const ::rtl::OUString sServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleContext" ) );
+ return Sequence< ::rtl::OUString >( &sServiceName, 1 );
+}
+
+//===== XTypeProvider =======================================================
+
+Sequence< sal_Int8 > SAL_CALL SvxRectCtlAccessibleContext::getImplementationId( void ) throw( RuntimeException )
+{
+ return getUniqueId();
+}
+
+//===== XAccessibleSelection =============================================
+
+void SAL_CALL SvxRectCtlAccessibleContext::selectAccessibleChild( sal_Int32 nIndex ) throw( lang::IndexOutOfBoundsException, RuntimeException )
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ checkChildIndex( nIndex );
+
+ ThrowExceptionIfNotAlive();
+
+ const ChildIndexToPointData* pData = IndexToPoint( nIndex, mbAngleMode );
+
+ DBG_ASSERT( pData,
+ "SvxRectCtlAccessibleContext::selectAccessibleChild(): this is an impossible state! Or at least should be..." );
+
+ // this does all wich is needed, including the change of the child's state!
+ mpRepr->SetActualRP( pData->ePoint );
+}
+
+sal_Bool SAL_CALL SvxRectCtlAccessibleContext::isAccessibleChildSelected( sal_Int32 nIndex ) throw( lang::IndexOutOfBoundsException, RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ checkChildIndex( nIndex );
+
+ return nIndex == mnSelectedChild;
+}
+
+void SAL_CALL SvxRectCtlAccessibleContext::clearAccessibleSelection() throw( RuntimeException )
+{
+ DBG_ASSERT( sal_False, "SvxRectCtlAccessibleContext::clearAccessibleSelection() is not possible!" );
+}
+
+void SAL_CALL SvxRectCtlAccessibleContext::selectAllAccessibleChildren() throw( RuntimeException )
+{
+ // guard in selectAccessibleChild()!
+
+ selectAccessibleChild( 0 ); // default per definition
+}
+
+sal_Int32 SAL_CALL SvxRectCtlAccessibleContext::getSelectedAccessibleChildCount() throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ return mnSelectedChild == NOCHILDSELECTED? 0 : 1;
+}
+
+Reference< XAccessible > SAL_CALL SvxRectCtlAccessibleContext::getSelectedAccessibleChild( sal_Int32 nIndex )
+ throw( lang::IndexOutOfBoundsException, RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ checkChildIndexOnSelection( nIndex );
+
+ return getAccessibleChild( mnSelectedChild );
+}
+
+void SAL_CALL SvxRectCtlAccessibleContext::deselectAccessibleChild( sal_Int32 /*nIndex*/ ) throw( lang::IndexOutOfBoundsException, RuntimeException )
+{
+ ::rtl::OUString aMessage( RTL_CONSTASCII_USTRINGPARAM( "deselectAccessibleChild is not possible in this context" ) );
+
+ DBG_ASSERT( sal_False, "SvxRectCtlAccessibleContext::deselectAccessibleChild() is not possible!" );
+
+ throw lang::IndexOutOfBoundsException( aMessage, *this ); // never possible
+}
+
+//===== internals ========================================================
+
+void SvxRectCtlAccessibleContext::checkChildIndex( long nIndex ) throw( lang::IndexOutOfBoundsException )
+{
+ if( nIndex < 0 || nIndex >= getAccessibleChildCount() )
+ throw lang::IndexOutOfBoundsException();
+}
+
+void SvxRectCtlAccessibleContext::checkChildIndexOnSelection( long nIndex ) throw( lang::IndexOutOfBoundsException )
+{
+ if( nIndex || mnSelectedChild == NOCHILDSELECTED )
+ // in our case only for the first (0) _selected_ child this is a valid request
+ throw lang::IndexOutOfBoundsException();
+}
+
+void SvxRectCtlAccessibleContext::selectChild( long nNew )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if( nNew != mnSelectedChild )
+ {
+ long nNumOfChilds = getAccessibleChildCount();
+ if( nNew < nNumOfChilds )
+ { // valid index
+ SvxRectCtlChildAccessibleContext* pChild;
+ if( mnSelectedChild != NOCHILDSELECTED )
+ { // deselect old selected child if one is selected
+ pChild = mpChilds[ mnSelectedChild ];
+ if( pChild )
+ pChild->setStateChecked( sal_False );
+ }
+
+ // select new child
+ mnSelectedChild = nNew;
+
+ if( nNew != NOCHILDSELECTED )
+ {
+ pChild = mpChilds[ nNew ];
+ if( pChild )
+ pChild->setStateChecked( sal_True );
+ }
+ }
+ else
+ mnSelectedChild = NOCHILDSELECTED;
+ }
+}
+
+void SvxRectCtlAccessibleContext::selectChild( RECT_POINT eButton )
+{
+ // no guard -> is done in next selectChild
+ selectChild( PointToIndex( eButton, mbAngleMode ) );
+}
+
+void SvxRectCtlAccessibleContext::setName( const ::rtl::OUString& rName )
+{
+ Any aPreVal, aPostVal;
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ aPreVal <<= msName;
+ aPostVal <<= rName;
+
+ msName = rName;
+ }
+
+ const Reference< XInterface > xSource( *this );
+ CommitChange( AccessibleEventObject( xSource, AccessibleEventId::NAME_CHANGED, aPreVal, aPostVal ) );
+}
+
+void SvxRectCtlAccessibleContext::setDescription( const ::rtl::OUString& rDescr )
+{
+ Any aPreVal, aPostVal;
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ aPreVal <<= msDescription;
+ aPostVal <<= rDescr;
+
+ msDescription = rDescr;
+ }
+
+ const Reference< XInterface > xSource( *this );
+ CommitChange( AccessibleEventObject( xSource, AccessibleEventId::DESCRIPTION_CHANGED, aPreVal, aPostVal ) );
+}
+
+void SvxRectCtlAccessibleContext::CommitChange( const AccessibleEventObject& rEvent )
+{
+ if (mnClientId)
+ comphelper::AccessibleEventNotifier::addEvent( mnClientId, rEvent );
+}
+
+void SAL_CALL SvxRectCtlAccessibleContext::disposing()
+{
+ if( !rBHelper.bDisposed )
+ {
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ mpRepr = NULL; // object dies with representation
+
+ SvxRectCtlChildAccessibleContext** p = mpChilds;
+ for( int i = MAX_NUM_OF_CHILDS ; i ; --i, ++p )
+ {
+ SvxRectCtlChildAccessibleContext* pChild = *p;
+ if( pChild )
+ {
+ pChild->dispose();
+ pChild->release();
+ *p = NULL;
+ }
+ }
+
+ delete[] mpChilds;
+ mpChilds = NULL;
+ }
+
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ // Send a disposing to all listeners.
+ if ( mnClientId )
+ {
+ comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this );
+ mnClientId = 0;
+ }
+
+ mxParent = Reference< XAccessible >();
+ }
+ }
+}
+
+Rectangle SvxRectCtlAccessibleContext::GetBoundingBoxOnScreen( void ) throw( RuntimeException )
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ ThrowExceptionIfNotAlive();
+
+ return Rectangle( mpRepr->GetParent()->OutputToScreenPixel( mpRepr->GetPosPixel() ), mpRepr->GetSizePixel() );
+}
+
+Rectangle SvxRectCtlAccessibleContext::GetBoundingBox( void ) throw( RuntimeException )
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ ThrowExceptionIfNotAlive();
+
+ return Rectangle( mpRepr->GetPosPixel(), mpRepr->GetSizePixel() );
+}
+
+Sequence< sal_Int8 > SvxRectCtlAccessibleContext::getUniqueId( void )
+{
+ static OImplementationId* pId = 0;
+ if( !pId )
+ {
+ MutexGuard aGuard( Mutex::getGlobalMutex() );
+ if( !pId)
+ {
+ static OImplementationId aId;
+ pId = &aId;
+ }
+ }
+ return pId->getImplementationId();
+}
+
+void SvxRectCtlAccessibleContext::ThrowExceptionIfNotAlive( void ) throw( lang::DisposedException )
+{
+ if( IsNotAlive() )
+ throw lang::DisposedException();
+}
+
+// -------------------------------------------------------------------------------------------------
+
+
+DBG_NAME( SvxRectCtlChildAccessibleContext )
+
+
+SvxRectCtlChildAccessibleContext::SvxRectCtlChildAccessibleContext(
+ const Reference<XAccessible>& rxParent,
+ const Window& rParentWindow,
+ const ::rtl::OUString& rName,
+ const ::rtl::OUString& rDescription,
+ const Rectangle& rBoundingBox,
+ long nIndexInParent ) :
+
+ SvxRectCtlChildAccessibleContext_Base( maMutex ),
+ msDescription( rDescription ),
+ msName( rName ),
+ mxParent(rxParent),
+ mpBoundingBox( new Rectangle( rBoundingBox ) ),
+ mrParentWindow( rParentWindow ),
+ mnClientId( 0 ),
+ mnIndexInParent( nIndexInParent ),
+ mbIsChecked( sal_False )
+{
+ DBG_CTOR( SvxRectCtlChildAccessibleContext, NULL );
+}
+
+
+SvxRectCtlChildAccessibleContext::~SvxRectCtlChildAccessibleContext()
+{
+ DBG_DTOR( SvxRectCtlChildAccessibleContext, NULL );
+
+ if( IsAlive() )
+ {
+ osl_incrementInterlockedCount( &m_refCount );
+ dispose(); // set mpRepr = NULL & release all childs
+ }
+}
+
+//===== XAccessible =========================================================
+
+Reference< XAccessibleContext> SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleContext( void ) throw( RuntimeException )
+{
+ return this;
+}
+
+//===== XAccessibleComponent ================================================
+
+sal_Bool SAL_CALL SvxRectCtlChildAccessibleContext::containsPoint( const awt::Point& rPoint ) throw( RuntimeException )
+{
+ // no guard -> done in getBounds()
+// return GetBoundingBox().IsInside( VCLPoint( rPoint ) );
+ return Rectangle( Point( 0, 0 ), GetBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) );
+}
+
+Reference< XAccessible > SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleAtPoint( const awt::Point& /*rPoint*/ ) throw( RuntimeException )
+{
+ return Reference< XAccessible >();
+}
+
+awt::Rectangle SAL_CALL SvxRectCtlChildAccessibleContext::getBounds() throw( RuntimeException )
+{
+ // no guard -> done in getBoundingBox()
+ return AWTRectangle( GetBoundingBox() );
+}
+
+awt::Point SAL_CALL SvxRectCtlChildAccessibleContext::getLocation() throw( RuntimeException )
+{
+ // no guard -> done in getBoundingBox()
+ return AWTPoint( GetBoundingBox().TopLeft() );
+}
+
+awt::Point SAL_CALL SvxRectCtlChildAccessibleContext::getLocationOnScreen() throw( RuntimeException )
+{
+ // no guard -> done in getBoundingBoxOnScreen()
+ return AWTPoint( GetBoundingBoxOnScreen().TopLeft() );
+}
+
+awt::Size SAL_CALL SvxRectCtlChildAccessibleContext::getSize() throw( RuntimeException )
+{
+ // no guard -> done in getBoundingBox()
+ return AWTSize( GetBoundingBox().GetSize() );
+}
+
+sal_Bool SAL_CALL SvxRectCtlChildAccessibleContext::isShowing() throw( RuntimeException )
+{
+ return sal_True;
+}
+
+sal_Bool SAL_CALL SvxRectCtlChildAccessibleContext::isVisible() throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( maMutex );
+
+ ThrowExceptionIfNotAlive();
+
+ return mxParent.is()? ( static_cast< SvxRectCtlAccessibleContext* >( mxParent.get() ) )->isVisible() : sal_False;
+}
+
+sal_Bool SAL_CALL SvxRectCtlChildAccessibleContext::isFocusTraversable() throw( RuntimeException )
+{
+ return sal_False;
+}
+
+void SAL_CALL SvxRectCtlChildAccessibleContext::addFocusListener( const Reference< awt::XFocusListener >& /*xListener*/ )
+ throw( RuntimeException )
+{
+ OSL_ENSURE( false, "SvxRectCtlChildAccessibleContext::addFocusListener: not implemented" );
+}
+
+void SAL_CALL SvxRectCtlChildAccessibleContext::removeFocusListener( const Reference< awt::XFocusListener >& /*xListener*/ )
+ throw (RuntimeException)
+{
+ OSL_ENSURE( false, "SvxRectCtlChildAccessibleContext::removeFocusListener: not implemented" );
+}
+
+void SAL_CALL SvxRectCtlChildAccessibleContext::grabFocus() throw( RuntimeException )
+{
+}
+
+Any SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleKeyBinding() throw( RuntimeException )
+{
+ // here is no implementation, because here are no KeyBindings for every object
+ return Any();
+}
+sal_Int32 SvxRectCtlChildAccessibleContext::getForeground( )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( maMutex );
+ ThrowExceptionIfNotAlive();
+ return mrParentWindow.GetControlForeground().GetColor();
+}
+sal_Int32 SvxRectCtlChildAccessibleContext::getBackground( )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( maMutex );
+
+ ThrowExceptionIfNotAlive();
+ return mrParentWindow.GetControlBackground().GetColor();
+}
+
+//===== XAccessibleContext ==================================================
+
+sal_Int32 SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleChildCount( void ) throw( RuntimeException )
+{
+ return 0;
+}
+
+Reference< XAccessible > SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleChild( sal_Int32 /*nIndex*/ ) throw ( RuntimeException, lang::IndexOutOfBoundsException )
+{
+ throw lang::IndexOutOfBoundsException();
+}
+
+Reference< XAccessible > SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleParent( void ) throw( RuntimeException )
+{
+ return mxParent;
+}
+
+sal_Int32 SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleIndexInParent( void ) throw( RuntimeException )
+{
+ return mnIndexInParent;
+}
+
+sal_Int16 SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleRole( void ) throw( RuntimeException )
+{
+ return AccessibleRole::RADIO_BUTTON;
+}
+
+::rtl::OUString SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleDescription( void ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( maMutex );
+ return msDescription;
+}
+
+::rtl::OUString SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleName( void ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( maMutex );
+ return msName;
+}
+
+/** Return empty reference to indicate that the relation set is not
+ supported.
+*/
+Reference<XAccessibleRelationSet> SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleRelationSet( void ) throw( RuntimeException )
+{
+ return Reference< XAccessibleRelationSet >();
+}
+
+Reference< XAccessibleStateSet > SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleStateSet( void ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( maMutex );
+ utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
+
+ if( IsAlive() )
+ {
+ if( mbIsChecked )
+ {
+ pStateSetHelper->AddState( AccessibleStateType::CHECKED );
+// pStateSetHelper->AddState( AccessibleStateType::SELECTED );
+ }
+
+ pStateSetHelper->AddState( AccessibleStateType::ENABLED );
+ pStateSetHelper->AddState( AccessibleStateType::SENSITIVE );
+ pStateSetHelper->AddState( AccessibleStateType::OPAQUE );
+ pStateSetHelper->AddState( AccessibleStateType::SELECTABLE );
+ pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+ pStateSetHelper->AddState( AccessibleStateType::VISIBLE );
+ }
+ else
+ pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+
+ return pStateSetHelper;
+}
+
+lang::Locale SAL_CALL SvxRectCtlChildAccessibleContext::getLocale( void ) throw( IllegalAccessibleComponentStateException, RuntimeException )
+{
+ ::osl::MutexGuard aGuard( maMutex );
+ if( mxParent.is() )
+ {
+ Reference< XAccessibleContext > xParentContext( mxParent->getAccessibleContext() );
+ if( xParentContext.is() )
+ return xParentContext->getLocale();
+ }
+
+ // No locale and no parent. Therefore throw exception to indicate this
+ // cluelessness.
+ throw IllegalAccessibleComponentStateException();
+}
+
+void SAL_CALL SvxRectCtlChildAccessibleContext::addEventListener( const Reference< XAccessibleEventListener >& xListener )
+ throw( RuntimeException )
+{
+ if (xListener.is())
+ {
+ ::osl::MutexGuard aGuard( maMutex );
+ if (!mnClientId)
+ mnClientId = comphelper::AccessibleEventNotifier::registerClient( );
+ comphelper::AccessibleEventNotifier::addEventListener( mnClientId, xListener );
+ }
+}
+
+
+
+
+void SAL_CALL SvxRectCtlChildAccessibleContext::removeEventListener( const Reference< XAccessibleEventListener >& xListener )
+ throw( RuntimeException )
+{
+ if (xListener.is())
+ {
+ ::osl::MutexGuard aGuard( maMutex );
+
+ sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener );
+ if ( !nListenerCount )
+ {
+ // no listeners anymore
+ // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
+ // and at least to us not firing any events anymore, in case somebody calls
+ // NotifyAccessibleEvent, again
+ comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
+ mnClientId = 0;
+ }
+ }
+}
+
+//===== XAccessibleValue ================================================
+
+Any SAL_CALL SvxRectCtlChildAccessibleContext::getCurrentValue() throw( RuntimeException )
+{
+ ThrowExceptionIfNotAlive();
+
+ Any aRet;
+ aRet <<= ( mbIsChecked? 1.0 : 0.0 );
+ return aRet;
+}
+
+sal_Bool SAL_CALL SvxRectCtlChildAccessibleContext::setCurrentValue( const Any& /*aNumber*/ ) throw( RuntimeException )
+{
+ return sal_False;
+}
+
+Any SAL_CALL SvxRectCtlChildAccessibleContext::getMaximumValue() throw( RuntimeException )
+{
+ Any aRet;
+ aRet <<= 1.0;
+ return aRet;
+}
+
+Any SAL_CALL SvxRectCtlChildAccessibleContext::getMinimumValue() throw( RuntimeException )
+{
+ Any aRet;
+ aRet <<= 0.0;
+ return aRet;
+}
+
+//===== XServiceInfo ========================================================
+
+::rtl::OUString SAL_CALL SvxRectCtlChildAccessibleContext::getImplementationName( void ) throw( RuntimeException )
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.ui.SvxRectCtlChildAccessibleContext" ) );
+}
+
+sal_Bool SAL_CALL SvxRectCtlChildAccessibleContext::supportsService( const ::rtl::OUString& sServiceName ) throw( RuntimeException )
+{
+ // Iterate over all supported service names and return true if on of them
+ // matches the given name.
+ ::osl::MutexGuard aGuard( maMutex );
+ Sequence< ::rtl::OUString > aSupportedServices ( getSupportedServiceNames() );
+ int nLength = aSupportedServices.getLength();
+ for( int i = 0 ; i < nLength; ++i )
+ {
+ if( sServiceName == aSupportedServices[ i ] )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+Sequence< ::rtl::OUString > SAL_CALL SvxRectCtlChildAccessibleContext::getSupportedServiceNames( void ) throw( RuntimeException )
+{
+ const ::rtl::OUString sServiceName (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.accessibility.AccessibleContext"));
+ return Sequence< ::rtl::OUString >( &sServiceName, 1 );
+}
+
+//===== XTypeProvider =======================================================
+
+Sequence< sal_Int8 > SAL_CALL SvxRectCtlChildAccessibleContext::getImplementationId( void ) throw( RuntimeException )
+{
+ static OImplementationId* pId = 0;
+ if( !pId )
+ {
+ MutexGuard aGuard( Mutex::getGlobalMutex() );
+ if( !pId)
+ {
+ static OImplementationId aId;
+ pId = &aId;
+ }
+ }
+ return pId->getImplementationId();
+}
+
+//===== internal ============================================================
+
+void SvxRectCtlChildAccessibleContext::CommitChange( const AccessibleEventObject& rEvent )
+{
+ if (mnClientId)
+ comphelper::AccessibleEventNotifier::addEvent( mnClientId, rEvent );
+}
+
+void SAL_CALL SvxRectCtlChildAccessibleContext::disposing()
+{
+ if( !rBHelper.bDisposed )
+ {
+ ::osl::MutexGuard aGuard( maMutex );
+
+ // Send a disposing to all listeners.
+ if ( mnClientId )
+ {
+ comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this );
+ mnClientId = 0;
+ }
+
+ mxParent = Reference< XAccessible >();
+
+ delete mpBoundingBox;
+ }
+}
+
+void SvxRectCtlChildAccessibleContext::ThrowExceptionIfNotAlive( void ) throw( lang::DisposedException )
+{
+ if( IsNotAlive() )
+ throw lang::DisposedException();
+}
+
+Rectangle SvxRectCtlChildAccessibleContext::GetBoundingBoxOnScreen( void ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( maMutex );
+
+ // no ThrowExceptionIfNotAlive() because its done in GetBoundingBox()
+ Rectangle aRect( GetBoundingBox() );
+
+ return Rectangle( mrParentWindow.OutputToScreenPixel( aRect.TopLeft() ), aRect.GetSize() );
+}
+
+Rectangle SvxRectCtlChildAccessibleContext::GetBoundingBox( void ) throw( RuntimeException )
+{
+ // no guard neccessary, because no one changes mpBoundingBox after creating it
+ ThrowExceptionIfNotAlive();
+
+ return *mpBoundingBox;
+}
+
+void SvxRectCtlChildAccessibleContext::setStateChecked( sal_Bool bChecked )
+{
+ if( mbIsChecked != bChecked )
+ {
+ mbIsChecked = bChecked;
+
+ const Reference< XInterface > xSource( *this );
+
+ Any aOld;
+ Any aNew;
+ Any& rMod = bChecked? aNew : aOld;
+
+ rMod <<= AccessibleStateType::CHECKED;
+
+ CommitChange( AccessibleEventObject( xSource, AccessibleEventId::STATE_CHANGED, aNew, aOld ) );
+ }
+}
+
diff --git a/svx/source/core/coreservices.cxx b/svx/source/core/coreservices.cxx
new file mode 100644
index 000000000000..588623dbb39a
--- /dev/null
+++ b/svx/source/core/coreservices.cxx
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+/** this file contains the uno service registrations for all services in the svxcore lib */
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "sal/types.h"
+#include "osl/diagnose.h"
+#include "cppuhelper/factory.hxx"
+#include "uno/lbnames.h"
+
+using rtl::OUString;
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::registry;
+
+namespace svx
+{
+extern OUString SAL_CALL ExtrusionDepthController_getImplementationName();
+extern Reference< XInterface > SAL_CALL ExtrusionDepthController_createInstance(const Reference< XMultiServiceFactory > &) throw( RuntimeException );
+extern Sequence< OUString > SAL_CALL ExtrusionDepthController_getSupportedServiceNames() throw( RuntimeException );
+
+extern OUString SAL_CALL ExtrusionDirectionControl_getImplementationName();
+extern Reference< XInterface > SAL_CALL ExtrusionDirectionControl_createInstance(const Reference< XMultiServiceFactory > &) throw( RuntimeException );
+extern Sequence< OUString > SAL_CALL ExtrusionDirectionControl_getSupportedServiceNames() throw( RuntimeException );
+
+extern OUString SAL_CALL ExtrusionLightingControl_getImplementationName();
+extern Reference< XInterface > SAL_CALL ExtrusionLightingControl_createInstance(const Reference< XMultiServiceFactory > &) throw( RuntimeException );
+extern Sequence< OUString > SAL_CALL ExtrusionLightingControl_getSupportedServiceNames() throw( RuntimeException );
+
+extern OUString SAL_CALL ExtrusionSurfaceControl_getImplementationName();
+extern Reference< XInterface > SAL_CALL ExtrusionSurfaceControl_createInstance(const Reference< XMultiServiceFactory > &) throw( RuntimeException );
+extern Sequence< OUString > SAL_CALL ExtrusionSurfaceControl_getSupportedServiceNames() throw( RuntimeException );
+
+extern OUString SAL_CALL FontWorkAlignmentControl_getImplementationName();
+extern Reference< XInterface > SAL_CALL FontWorkAlignmentControl_createInstance(const Reference< XMultiServiceFactory > &) throw( RuntimeException );
+extern Sequence< OUString > SAL_CALL FontWorkAlignmentControl_getSupportedServiceNames() throw( RuntimeException );
+
+extern OUString SAL_CALL FontWorkCharacterSpacingControl_getImplementationName();
+extern Reference< XInterface > SAL_CALL FontWorkCharacterSpacingControl_createInstance(const Reference< XMultiServiceFactory > &) throw( RuntimeException );
+extern Sequence< OUString > SAL_CALL FontWorkCharacterSpacingControl_getSupportedServiceNames() throw( RuntimeException );
+}
+
+extern "C"
+{
+
+SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment (
+ const sal_Char ** ppEnvTypeName, uno_Environment ** )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory (
+ const sal_Char * pImplName, void * pServiceManager, void * )
+{
+ void * pRet = 0;
+ if( pServiceManager )
+ {
+ Reference< XSingleServiceFactory > xFactory;
+
+ if( ::svx::ExtrusionDepthController_getImplementationName().equalsAscii( pImplName ) )
+ {
+ xFactory = ::cppu::createSingleFactory(
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+ ::svx::ExtrusionDepthController_getImplementationName(),
+ ::svx::ExtrusionDepthController_createInstance,
+ ::svx::ExtrusionDepthController_getSupportedServiceNames() );
+ }
+ else if( ::svx::ExtrusionDirectionControl_getImplementationName().equalsAscii( pImplName ) )
+ {
+ xFactory = ::cppu::createSingleFactory(
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+ ::svx::ExtrusionDirectionControl_getImplementationName(),
+ ::svx::ExtrusionDirectionControl_createInstance,
+ ::svx::ExtrusionDirectionControl_getSupportedServiceNames() );
+ }
+ else if( ::svx::ExtrusionLightingControl_getImplementationName().equalsAscii( pImplName ) )
+ {
+ xFactory = ::cppu::createSingleFactory(
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+ ::svx::ExtrusionLightingControl_getImplementationName(),
+ ::svx::ExtrusionLightingControl_createInstance,
+ ::svx::ExtrusionLightingControl_getSupportedServiceNames() );
+ }
+ else if( ::svx::ExtrusionSurfaceControl_getImplementationName().equalsAscii( pImplName ) )
+ {
+ xFactory = ::cppu::createSingleFactory(
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+ ::svx::ExtrusionSurfaceControl_getImplementationName(),
+ ::svx::ExtrusionSurfaceControl_createInstance,
+ ::svx::ExtrusionSurfaceControl_getSupportedServiceNames() );
+ }
+ else if( ::svx::FontWorkAlignmentControl_getImplementationName().equalsAscii( pImplName ) )
+ {
+ xFactory = ::cppu::createSingleFactory(
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+ ::svx::FontWorkAlignmentControl_getImplementationName(),
+ ::svx::FontWorkAlignmentControl_createInstance,
+ ::svx::FontWorkAlignmentControl_getSupportedServiceNames() );
+ }
+ else if( ::svx::FontWorkCharacterSpacingControl_getImplementationName().equalsAscii( pImplName ) )
+ {
+ xFactory = ::cppu::createSingleFactory(
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+ ::svx::FontWorkCharacterSpacingControl_getImplementationName(),
+ ::svx::FontWorkCharacterSpacingControl_createInstance,
+ ::svx::FontWorkCharacterSpacingControl_getSupportedServiceNames() );
+ } if( xFactory.is())
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+
+ return pRet;
+}
+
+}
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
new file mode 100644
index 000000000000..6224373f9a15
--- /dev/null
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -0,0 +1,2175 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "svx/EnhancedCustomShape2d.hxx"
+#include "svx/EnhancedCustomShapeGeometry.hxx"
+#include "svx/EnhancedCustomShapeTypeNames.hxx"
+#include <svx/svdoashp.hxx>
+#include <svx/svdtrans.hxx>
+#include <svx/svdocirc.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdopath.hxx>
+#ifndef _SVDOCAPT_HXX
+#include <svx/svdocapt.hxx>
+#endif
+#include <svx/svdpage.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/sdasaitm.hxx>
+#include <svx/svdmodel.hxx>
+#include <rtl/crc.h>
+#include <rtl/math.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/xlnedit.hxx>
+#include <svx/xlnstwit.hxx>
+#include <svx/xlnedwit.hxx>
+#include <svx/xlnstcit.hxx>
+#include <svx/xlnedcit.hxx>
+#include <svx/xflgrit.hxx>
+#include <svx/xflhtit.hxx>
+#include <svx/xbtmpit.hxx>
+#include <svx/xgrad.hxx>
+#include <svx/xbitmap.hxx>
+#include <svx/xhatch.hxx>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
+#ifndef __COM_SUN_STAR_DRAWING_ENHANCEDCUSTOMSHAPESEGMENTCOMMAND_HPP__
+#include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
+#endif
+#ifndef BOOST_SHARED_PTR_HPP_INCLUDED
+#include <boost/shared_ptr.hpp>
+#endif
+#include <basegfx/numeric/ftools.hxx>
+#include <basegfx/color/bcolortools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+// #i76201#
+#include <basegfx/polygon/b2dpolygontools.hxx>
+
+#include <math.h>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::drawing::EnhancedCustomShapeSegmentCommand;
+
+void EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( EnhancedCustomShapeParameter& rParameter, const sal_Int32 nValue )
+{
+ sal_uInt32 nDat = (sal_uInt32)nValue;
+ sal_Int32 nNewValue = nValue;
+
+ // check if this is a special point
+ if ( ( nDat >> 16 ) == 0x8000 )
+ {
+ nNewValue = (sal_uInt16)nDat;
+ rParameter.Type = EnhancedCustomShapeParameterType::EQUATION;
+ }
+ else
+ rParameter.Type = EnhancedCustomShapeParameterType::NORMAL;
+ rParameter.Value <<= nNewValue;
+}
+
+rtl::OUString EnhancedCustomShape2d::GetEquation( const sal_uInt16 nFlags, sal_Int16 nP1, sal_Int16 nP2, sal_Int16 nP3 )
+{
+ rtl::OUString aEquation;
+ sal_Bool b1Special = ( nFlags & 0x2000 ) != 0;
+ sal_Bool b2Special = ( nFlags & 0x4000 ) != 0;
+ sal_Bool b3Special = ( nFlags & 0x8000 ) != 0;
+ switch( nFlags & 0xff )
+ {
+ case 0 :
+ case 14 :
+ {
+ sal_Int32 nOptimize = 0;
+ if ( nP1 )
+ nOptimize |= 1;
+ if ( nP2 )
+ nOptimize |= 2;
+ if ( b1Special )
+ nOptimize |= 4;
+ if ( b2Special )
+ nOptimize |= 8;
+ switch( nOptimize )
+ {
+ case 0 :
+ break;
+ case 1 :
+ case 4 :
+ case 5 :
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP1, b1Special );
+ break;
+ case 2 :
+ case 8 :
+ case 10:
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP2, b2Special );
+ break;
+ default :
+ {
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP1, b1Special );
+ aEquation += rtl::OUString( (sal_Unicode)'+' );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP2, b2Special );
+ }
+ break;
+ }
+ if ( b3Special || nP3 )
+ {
+ aEquation += rtl::OUString( (sal_Unicode)'-' );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP3, b3Special );
+ }
+ }
+ break;
+ case 1 :
+ {
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP1, b1Special );
+ if ( b2Special || ( nP2 != 1 ) )
+ {
+ aEquation += rtl::OUString( (sal_Unicode)'*' );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP2, b2Special );
+ }
+ if ( b3Special || ( ( nP3 != 1 ) && ( nP3 != 0 ) ) )
+ {
+ aEquation += rtl::OUString( (sal_Unicode)'/' );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP3, b3Special );
+ }
+ }
+ break;
+ case 2 :
+ {
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "(" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP1, b1Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "+" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP2, b2Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( ")/2" ) );
+ }
+ break;
+ case 3 :
+ {
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "abs(" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP1, b1Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( ")" ) );
+ }
+ break;
+ case 4 :
+ {
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "min(" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP1, b1Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "," ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP2, b2Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( ")" ) );
+ }
+ break;
+ case 5 :
+ {
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "max(" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP1, b1Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "," ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP2, b2Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( ")" ) );
+ }
+ break;
+ case 6 :
+ {
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "if(" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP1, b1Special );
+ aEquation += rtl::OUString( (sal_Unicode)',' );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP2, b2Special );
+ aEquation += rtl::OUString( (sal_Unicode)',' );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP3, b3Special );
+ aEquation += rtl::OUString( (sal_Unicode)')' );
+ }
+ break;
+ case 7 :
+ {
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "sqrt(" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP1, b1Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "*" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP1, b1Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "+" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP2, b2Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "*" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP2, b2Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "+" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP3, b3Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "*" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP3, b3Special );
+ aEquation += rtl::OUString( (sal_Unicode)')' );
+ }
+ break;
+ case 8 :
+ {
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "atan2(" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP2, b2Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "," ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP1, b1Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( ")/(pi/180)" ) );
+ }
+ break;
+ case 9 :
+ {
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP1, b1Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "*sin(" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP2, b2Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "*(pi/180))" ) );
+ }
+ break;
+ case 10 :
+ {
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP1, b1Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "*cos(" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP2, b2Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "*(pi/180))" ) );
+ }
+ break;
+ case 11 :
+ {
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP1, b1Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "*" ) );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "cos(atan2(" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP3, b3Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "," ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP2, b2Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "))" ) );
+ }
+ break;
+ case 12 :
+ {
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP1, b1Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "*" ) );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "sin(atan2(" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP3, b3Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "," ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP2, b2Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "))" ) );
+ }
+ break;
+ case 13 :
+ {
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "sqrt(" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP1, b1Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( ")" ) );
+ }
+ break;
+ case 15 :
+ {
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP3, b3Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "*sqrt(1-(" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP1, b1Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "/" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP2, b2Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( ")" ) );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "*(" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP1, b1Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "/" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP2, b2Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "))" ) );
+ }
+ break;
+ case 16 :
+ {
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP1, b1Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "*tan(" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP2, b2Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( ")" ) );
+ }
+ break;
+ case 0x80 :
+ {
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "sqrt(" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP3, b3Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "*" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP3, b3Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "-" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP1, b1Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "*" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP1, b1Special );
+ aEquation += rtl::OUString( (sal_Unicode)')' );
+ }
+ break;
+ case 0x81 :
+ {
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "(cos(" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP3, b3Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "*(pi/180))*(" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP1, b1Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "-10800)+sin(" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP3, b3Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "*(pi/180))*(" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP2, b2Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "-10800))+10800" ) );
+ }
+ break;
+ case 0x82 :
+ {
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "-(sin(" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP3, b3Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "*(pi/180))*(" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP1, b1Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "-10800)-cos(" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP3, b3Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "*(pi/180))*(" ) );
+ EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( aEquation, nP2, b2Special );
+ aEquation += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "-10800))+10800" ) );
+ }
+ break;
+ }
+ return aEquation;
+}
+
+void EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( rtl::OUString& rParameter, const sal_Int16 nPara, const sal_Bool bIsSpecialValue )
+{
+ if ( bIsSpecialValue )
+ {
+ if ( nPara & 0x400 )
+ {
+ rParameter += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "?" ) );
+ rParameter += rtl::OUString::valueOf( (sal_Int32)( nPara & 0xff ) );
+ rParameter += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( " " ) );
+ }
+ else
+ {
+ switch( nPara )
+ {
+ case DFF_Prop_adjustValue :
+ case DFF_Prop_adjust2Value :
+ case DFF_Prop_adjust3Value :
+ case DFF_Prop_adjust4Value :
+ case DFF_Prop_adjust5Value :
+ case DFF_Prop_adjust6Value :
+ case DFF_Prop_adjust7Value :
+ case DFF_Prop_adjust8Value :
+ case DFF_Prop_adjust9Value :
+ case DFF_Prop_adjust10Value :
+ {
+ rParameter += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "$" ) );
+ rParameter += rtl::OUString::valueOf( (sal_Int32)( nPara - DFF_Prop_adjustValue ) );
+ rParameter += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( " " ) );
+ }
+ break;
+ case DFF_Prop_geoLeft :
+ {
+ rParameter += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "left" ) );
+ }
+ break;
+ case DFF_Prop_geoTop :
+ {
+ rParameter += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "top" ) );
+ }
+ break;
+ case DFF_Prop_geoRight :
+ {
+ rParameter += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "right" ) );
+ }
+ break;
+ case DFF_Prop_geoBottom :
+ {
+ rParameter += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "bottom" ) );
+ }
+ break;
+ }
+ }
+ }
+ else
+ {
+ rParameter += rtl::OUString::valueOf( (sal_Int32)( nPara ) );
+ }
+}
+
+void EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( EnhancedCustomShapeParameter& rParameter, const sal_Int32 nPara, const sal_Bool bIsSpecialValue, sal_Bool bHorz )
+{
+ sal_Int32 nValue = 0;
+ if ( bIsSpecialValue )
+ {
+ if ( ( nPara >= 0x100 ) && ( nPara <= 0x107 ) )
+ {
+ nValue = nPara & 0xff;
+ rParameter.Type = EnhancedCustomShapeParameterType::ADJUSTMENT;
+ }
+ else if ( ( nPara >= 3 ) && ( nPara <= 0x82 ) )
+ {
+ nValue = nPara - 3;
+ rParameter.Type = EnhancedCustomShapeParameterType::EQUATION;
+ }
+ else if ( nPara == 0 )
+ {
+ nValue = 0;
+ if ( bHorz )
+ rParameter.Type = EnhancedCustomShapeParameterType::LEFT;
+ else
+ rParameter.Type = EnhancedCustomShapeParameterType::TOP;
+ }
+ else if ( nPara == 1 )
+ {
+ nValue = 0;
+ if ( bHorz )
+ rParameter.Type = EnhancedCustomShapeParameterType::RIGHT;
+ else
+ rParameter.Type = EnhancedCustomShapeParameterType::BOTTOM;
+ }
+ else if ( nPara == 2 ) // means to be centered, but should not be
+ { // used in our implementation
+ nValue = 5600;
+ rParameter.Type = EnhancedCustomShapeParameterType::NORMAL;
+ }
+ else
+ {
+ nValue = nPara;
+ rParameter.Type = EnhancedCustomShapeParameterType::NORMAL;
+ }
+ }
+ else
+ {
+ nValue = nPara;
+ rParameter.Type = EnhancedCustomShapeParameterType::NORMAL;
+ }
+ rParameter.Value <<= nValue;
+}
+
+sal_Bool EnhancedCustomShape2d::ConvertSequenceToEnhancedCustomShape2dHandle(
+ const com::sun::star::beans::PropertyValues& rHandleProperties,
+ EnhancedCustomShape2d::Handle& rDestinationHandle )
+{
+ sal_Bool bRetValue = sal_False;
+ sal_uInt32 i, nProperties = rHandleProperties.getLength();
+ if ( nProperties )
+ {
+ rDestinationHandle.nFlags = 0;
+ for ( i = 0; i < nProperties; i++ )
+ {
+ const com::sun::star::beans::PropertyValue& rPropVal = rHandleProperties[ i ];
+
+ const rtl::OUString sPosition ( RTL_CONSTASCII_USTRINGPARAM( "Position" ) );
+ const rtl::OUString sMirroredX ( RTL_CONSTASCII_USTRINGPARAM( "MirroredX" ) );
+ const rtl::OUString sMirroredY ( RTL_CONSTASCII_USTRINGPARAM( "MirroredY" ) );
+ const rtl::OUString sSwitched ( RTL_CONSTASCII_USTRINGPARAM( "Switched" ) );
+ const rtl::OUString sPolar ( RTL_CONSTASCII_USTRINGPARAM( "Polar" ) );
+// const rtl::OUString sMap ( RTL_CONSTASCII_USTRINGPARAM( "Map" ) );
+ const rtl::OUString sRefX ( RTL_CONSTASCII_USTRINGPARAM( "RefX" ) );
+ const rtl::OUString sRefY ( RTL_CONSTASCII_USTRINGPARAM( "RefY" ) );
+ const rtl::OUString sRefAngle ( RTL_CONSTASCII_USTRINGPARAM( "RefAngle" ) );
+ const rtl::OUString sRefR ( RTL_CONSTASCII_USTRINGPARAM( "RefR" ) );
+ const rtl::OUString sRadiusRangeMinimum ( RTL_CONSTASCII_USTRINGPARAM( "RadiusRangeMinimum" ) );
+ const rtl::OUString sRadiusRangeMaximum ( RTL_CONSTASCII_USTRINGPARAM( "RadiusRangeMaximum" ) );
+ const rtl::OUString sRangeXMinimum ( RTL_CONSTASCII_USTRINGPARAM( "RangeXMinimum" ) );
+ const rtl::OUString sRangeXMaximum ( RTL_CONSTASCII_USTRINGPARAM( "RangeXMaximum" ) );
+ const rtl::OUString sRangeYMinimum ( RTL_CONSTASCII_USTRINGPARAM( "RangeYMinimum" ) );
+ const rtl::OUString sRangeYMaximum ( RTL_CONSTASCII_USTRINGPARAM( "RangeYMaximum" ) );
+
+ if ( rPropVal.Name.equals( sPosition ) )
+ {
+ if ( rPropVal.Value >>= rDestinationHandle.aPosition )
+ bRetValue = sal_True;
+ }
+ else if ( rPropVal.Name.equals( sMirroredX ) )
+ {
+ sal_Bool bMirroredX = sal_Bool();
+ if ( rPropVal.Value >>= bMirroredX )
+ {
+ if ( bMirroredX )
+ rDestinationHandle.nFlags |= HANDLE_FLAGS_MIRRORED_X;
+ }
+ }
+ else if ( rPropVal.Name.equals( sMirroredY ) )
+ {
+ sal_Bool bMirroredY = sal_Bool();
+ if ( rPropVal.Value >>= bMirroredY )
+ {
+ if ( bMirroredY )
+ rDestinationHandle.nFlags |= HANDLE_FLAGS_MIRRORED_Y;
+ }
+ }
+ else if ( rPropVal.Name.equals( sSwitched ) )
+ {
+ sal_Bool bSwitched = sal_Bool();
+ if ( rPropVal.Value >>= bSwitched )
+ {
+ if ( bSwitched )
+ rDestinationHandle.nFlags |= HANDLE_FLAGS_SWITCHED;
+ }
+ }
+ else if ( rPropVal.Name.equals( sPolar ) )
+ {
+ if ( rPropVal.Value >>= rDestinationHandle.aPolar )
+ rDestinationHandle.nFlags |= HANDLE_FLAGS_POLAR;
+ }
+/* seems not to be used.
+ else if ( rPropVal.Name.equals( sMap ) )
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair aMap;
+ if ( rPropVal.Value >>= aMap )
+ {
+ if ( GetValueForEnhancedCustomShapeHandleParameter( nXMap, aMap.First ) )
+ rDestinationHandle.Flags |= 0x800;
+ if ( GetValueForEnhancedCustomShapeHandleParameter( nYMap, aMap.Second ) )
+ rDestinationHandle.Flags |= 0x1000;
+ rDestinationHandle.Flags |= 0x10;
+ }
+ }
+*/
+ else if ( rPropVal.Name.equals( sRefX ) )
+ {
+ if ( rPropVal.Value >>= rDestinationHandle.nRefX )
+ rDestinationHandle.nFlags |= HANDLE_FLAGS_REFX;
+ }
+ else if ( rPropVal.Name.equals( sRefY ) )
+ {
+ if ( rPropVal.Value >>= rDestinationHandle.nRefY )
+ rDestinationHandle.nFlags |= HANDLE_FLAGS_REFY;
+ }
+ else if ( rPropVal.Name.equals( sRefAngle ) )
+ {
+ if ( rPropVal.Value >>= rDestinationHandle.nRefAngle )
+ rDestinationHandle.nFlags |= HANDLE_FLAGS_REFANGLE;
+ }
+ else if ( rPropVal.Name.equals( sRefR ) )
+ {
+ if ( rPropVal.Value >>= rDestinationHandle.nRefR )
+ rDestinationHandle.nFlags |= HANDLE_FLAGS_REFR;
+ }
+ else if ( rPropVal.Name.equals( sRadiusRangeMinimum ) )
+ {
+ if ( rPropVal.Value >>= rDestinationHandle.aRadiusRangeMinimum )
+ rDestinationHandle.nFlags |= HANDLE_FLAGS_RADIUS_RANGE_MINIMUM;
+ }
+ else if ( rPropVal.Name.equals( sRadiusRangeMaximum ) )
+ {
+ if ( rPropVal.Value >>= rDestinationHandle.aRadiusRangeMaximum )
+ rDestinationHandle.nFlags |= HANDLE_FLAGS_RADIUS_RANGE_MAXIMUM;
+ }
+ else if ( rPropVal.Name.equals( sRangeXMinimum ) )
+ {
+ if ( rPropVal.Value >>= rDestinationHandle.aXRangeMinimum )
+ rDestinationHandle.nFlags |= HANDLE_FLAGS_RANGE_X_MINIMUM;
+ }
+ else if ( rPropVal.Name.equals( sRangeXMaximum ) )
+ {
+ if ( rPropVal.Value >>= rDestinationHandle.aXRangeMaximum )
+ rDestinationHandle.nFlags |= HANDLE_FLAGS_RANGE_X_MAXIMUM;
+ }
+ else if ( rPropVal.Name.equals( sRangeYMinimum ) )
+ {
+ if ( rPropVal.Value >>= rDestinationHandle.aYRangeMinimum )
+ rDestinationHandle.nFlags |= HANDLE_FLAGS_RANGE_Y_MINIMUM;
+ }
+ else if ( rPropVal.Name.equals( sRangeYMaximum ) )
+ {
+ if ( rPropVal.Value >>= rDestinationHandle.aYRangeMaximum )
+ rDestinationHandle.nFlags |= HANDLE_FLAGS_RANGE_Y_MAXIMUM;
+ }
+ }
+ }
+ return bRetValue;
+}
+
+const sal_Int32* EnhancedCustomShape2d::ApplyShapeAttributes( const SdrCustomShapeGeometryItem& rGeometryItem )
+{
+ const sal_Int32* pDefData = NULL;
+ const mso_CustomShape* pDefCustomShape = GetCustomShapeContent( eSpType );
+ if ( pDefCustomShape )
+ pDefData = pDefCustomShape->pDefData;
+
+ //////////////////////
+ // AdjustmentValues //
+ //////////////////////
+ const rtl::OUString sAdjustmentValues( RTL_CONSTASCII_USTRINGPARAM ( "AdjustmentValues" ) );
+ const Any* pAny = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( sAdjustmentValues );
+ if ( pAny )
+ *pAny >>= seqAdjustmentValues;
+
+ ///////////////
+ // Coordsize //
+ ///////////////
+ const rtl::OUString sViewBox( RTL_CONSTASCII_USTRINGPARAM ( "ViewBox" ) );
+ const Any* pViewBox = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( sViewBox );
+ com::sun::star::awt::Rectangle aViewBox;
+ if ( pViewBox && (*pViewBox >>= aViewBox ) )
+ {
+ nCoordLeft = aViewBox.X;
+ nCoordTop = aViewBox.Y;
+ nCoordWidth = labs( aViewBox.Width );
+ nCoordHeight= labs( aViewBox.Height);
+ }
+ const rtl::OUString sPath( RTL_CONSTASCII_USTRINGPARAM ( "Path" ) );
+
+ //////////////////////
+ // Path/Coordinates //
+ //////////////////////
+ const rtl::OUString sCoordinates( RTL_CONSTASCII_USTRINGPARAM ( "Coordinates" ) );
+ pAny = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( sPath, sCoordinates );
+ if ( pAny )
+ *pAny >>= seqCoordinates;
+
+ /////////////////////
+ // Path/GluePoints //
+ /////////////////////
+ const rtl::OUString sGluePoints( RTL_CONSTASCII_USTRINGPARAM ( "GluePoints" ) );
+ pAny = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( sPath, sGluePoints );
+ if ( pAny )
+ *pAny >>= seqGluePoints;
+
+ ///////////////////
+ // Path/Segments //
+ ///////////////////
+ const rtl::OUString sSegments( RTL_CONSTASCII_USTRINGPARAM ( "Segments" ) );
+ pAny = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( sPath, sSegments );
+ if ( pAny )
+ *pAny >>= seqSegments;
+
+ ///////////////////
+ // Path/StretchX //
+ ///////////////////
+ const rtl::OUString sStretchX( RTL_CONSTASCII_USTRINGPARAM ( "StretchX" ) );
+ pAny = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( sPath, sStretchX );
+ if ( pAny )
+ {
+ sal_Int32 nStretchX = 0;
+ if ( *pAny >>= nStretchX )
+ nXRef = nStretchX;
+ }
+
+ ///////////////////
+ // Path/StretchY //
+ ///////////////////
+ const rtl::OUString sStretchY( RTL_CONSTASCII_USTRINGPARAM ( "StretchY" ) );
+ pAny = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( sPath, sStretchY );
+ if ( pAny )
+ {
+ sal_Int32 nStretchY = 0;
+ if ( *pAny >>= nStretchY )
+ nYRef = nStretchY;
+ }
+
+ /////////////////////
+ // Path/TextFrames //
+ /////////////////////
+ const rtl::OUString sTextFrames( RTL_CONSTASCII_USTRINGPARAM ( "TextFrames" ) );
+ pAny = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( sPath, sTextFrames );
+ if ( pAny )
+ *pAny >>= seqTextFrames;
+
+ ///////////////
+ // Equations //
+ ///////////////
+ const rtl::OUString sEquations( RTL_CONSTASCII_USTRINGPARAM( "Equations" ) );
+ pAny = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( sEquations );
+ if ( pAny )
+ *pAny >>= seqEquations;
+
+ /////////////
+ // Handles //
+ /////////////
+ const rtl::OUString sHandles( RTL_CONSTASCII_USTRINGPARAM( "Handles" ) );
+ pAny = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( sHandles );
+ if ( pAny )
+ *pAny >>= seqHandles;
+
+ return pDefData;
+}
+
+EnhancedCustomShape2d::~EnhancedCustomShape2d()
+{
+}
+
+EnhancedCustomShape2d::EnhancedCustomShape2d( SdrObject* pAObj ) :
+ SfxItemSet ( pAObj->GetMergedItemSet() ),
+ pCustomShapeObj ( pAObj ),
+ eSpType ( mso_sptNil ),
+ nCoordLeft ( 0 ),
+ nCoordTop ( 0 ),
+ nCoordWidth ( 21600 ),
+ nCoordHeight ( 21600 ),
+ nXRef ( 0x80000000 ),
+ nYRef ( 0x80000000 ),
+ nFlags ( 0 ),
+ nColorData ( 0 ),
+ bTextFlow ( sal_False ),
+ bFilled ( ((const XFillStyleItem&)pAObj->GetMergedItem( XATTR_FILLSTYLE )).GetValue() != XFILL_NONE ),
+ bStroked ( ((const XLineStyleItem&)pAObj->GetMergedItem( XATTR_LINESTYLE )).GetValue() != XLINE_NONE ),
+ bFlipH ( sal_False ),
+ bFlipV ( sal_False )
+{
+ // bTextFlow needs to be set before clearing the TextDirection Item
+
+ ClearItem( SDRATTR_TEXTDIRECTION ); //SJ: vertical writing is not required, by removing this item no outliner is created
+
+ // #i105323# For 2D AtoShapes, the shadow attirbute does not need to be applied to any
+ // of the constucted helper SdrObjects. This would lead to problems since the shadow
+ // of one helper object would fall on one helper object behind it (e.g. with the
+ // eyes of the smiley shape). This is not wanted; instead a single shadow 'behind'
+ // the AutoShape visualisation is wanted. This is done with primitive functionailty
+ // now in SdrCustomShapePrimitive2D::create2DDecomposition, but only for 2D objects
+ // (see there and in EnhancedCustomShape3d::Create3DObject to read more).
+ // This exception may be removed later when AutoShapes will create primitives directly.
+ // So, currently remove the ShadowAttribute from the ItemSet to not apply it to any
+ // 2D helper shape.
+ ClearItem(SDRATTR_SHADOW);
+
+ Point aP( pCustomShapeObj->GetSnapRect().Center() );
+ Size aS( pCustomShapeObj->GetLogicRect().GetSize() );
+ aP.X() -= aS.Width() / 2;
+ aP.Y() -= aS.Height() / 2;
+ aLogicRect = Rectangle( aP, aS );
+
+ const rtl::OUString sType( RTL_CONSTASCII_USTRINGPARAM ( "Type" ) );
+ const rtl::OUString sMirroredX( RTL_CONSTASCII_USTRINGPARAM ( "MirroredX" ) );
+ const rtl::OUString sMirroredY( RTL_CONSTASCII_USTRINGPARAM ( "MirroredY" ) );
+
+ rtl::OUString sShapeType;
+ SdrCustomShapeGeometryItem& rGeometryItem = (SdrCustomShapeGeometryItem&)(const SdrCustomShapeGeometryItem&)pCustomShapeObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
+ Any* pAny = rGeometryItem.GetPropertyValueByName( sType );
+ if ( pAny )
+ *pAny >>= sShapeType;
+ eSpType = EnhancedCustomShapeTypeNames::Get( sShapeType );
+
+ pAny = rGeometryItem.GetPropertyValueByName( sMirroredX );
+ if ( pAny )
+ *pAny >>= bFlipH;
+ pAny = rGeometryItem.GetPropertyValueByName( sMirroredY );
+ if ( pAny )
+ *pAny >>= bFlipV;
+
+ if ( pCustomShapeObj->ISA( SdrObjCustomShape ) ) // should always be a SdrObjCustomShape, but you don't know
+ nRotateAngle = (sal_Int32)(((SdrObjCustomShape*)pCustomShapeObj)->GetObjectRotation() * 100.0);
+ else
+ nRotateAngle = pCustomShapeObj->GetRotateAngle();
+
+ /*const sal_Int32* pDefData =*/ ApplyShapeAttributes( rGeometryItem );
+ switch( eSpType )
+ {
+ case mso_sptCan : nColorData = 0x20400000; break;
+ case mso_sptCube : nColorData = 0x302e0000; break;
+ case mso_sptActionButtonBlank : nColorData = 0x502ce400; break;
+ case mso_sptActionButtonHome : nColorData = 0x702ce4ce; break;
+ case mso_sptActionButtonHelp : nColorData = 0x602ce4c0; break;
+ case mso_sptActionButtonInformation : nColorData = 0x702ce4c5; break;
+ case mso_sptActionButtonBackPrevious : nColorData = 0x602ce4c0; break;
+ case mso_sptActionButtonForwardNext : nColorData = 0x602ce4c0; break;
+ case mso_sptActionButtonBeginning : nColorData = 0x602ce4c0; break;
+ case mso_sptActionButtonEnd : nColorData = 0x602ce4c0; break;
+ case mso_sptActionButtonReturn : nColorData = 0x602ce4c0; break;
+ case mso_sptActionButtonDocument : nColorData = 0x702ce4ec; break;
+ case mso_sptActionButtonSound : nColorData = 0x602ce4c0; break;
+ case mso_sptActionButtonMovie : nColorData = 0x602ce4c0; break;
+ case mso_sptBevel : nColorData = 0x502ce400; break;
+ case mso_sptFoldedCorner : nColorData = 0x20e00000; break;
+ case mso_sptSmileyFace : nColorData = 0x20e00000; break;
+ case mso_sptNil :
+ {
+ if( sShapeType.getLength() > 4 &&
+ sShapeType.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "col-" )))
+ {
+ nColorData = sShapeType.copy( 4 ).toInt32( 16 );
+ }
+ }
+ break;
+ case mso_sptCurvedLeftArrow :
+ case mso_sptCurvedRightArrow :
+ case mso_sptCurvedUpArrow :
+ case mso_sptCurvedDownArrow : nColorData = 0x2d000000; break;
+ case mso_sptRibbon2 : nColorData = 0x30ee0000; break;
+ case mso_sptRibbon : nColorData = 0x30ee0000; break;
+
+ case mso_sptEllipseRibbon2 : nColorData = 0x30ee0000; break;
+ case mso_sptEllipseRibbon : nColorData = 0x30ee0000; break;
+
+ case mso_sptVerticalScroll : nColorData = 0x30ee0000; break;
+ case mso_sptHorizontalScroll : nColorData = 0x30ee0000; break;
+ default:
+ break;
+ }
+ fXScale = nCoordWidth == 0 ? 0.0 : (double)aLogicRect.GetWidth() / (double)nCoordWidth;
+ fYScale = nCoordHeight == 0 ? 0.0 : (double)aLogicRect.GetHeight() / (double)nCoordHeight;
+ if ( (sal_uInt32)nXRef != 0x80000000 && aLogicRect.GetHeight() )
+ {
+ fXRatio = (double)aLogicRect.GetWidth() / (double)aLogicRect.GetHeight();
+ if ( fXRatio > 1 )
+ fXScale /= fXRatio;
+ else
+ fXRatio = 1.0;
+ }
+ else
+ fXRatio = 1.0;
+ if ( (sal_uInt32)nYRef != 0x80000000 && aLogicRect.GetWidth() )
+ {
+ fYRatio = (double)aLogicRect.GetHeight() / (double)aLogicRect.GetWidth();
+ if ( fYRatio > 1 )
+ fYScale /= fYRatio;
+ else
+ fYRatio = 1.0;
+ }
+ else
+ fYRatio = 1.0;
+
+ sal_Int32 i, nLength = seqEquations.getLength();
+
+
+ if ( nLength )
+ {
+ vNodesSharedPtr.resize( nLength );
+ for ( i = 0; i < seqEquations.getLength(); i++ )
+ {
+ try
+ {
+ vNodesSharedPtr[ i ] = EnhancedCustomShape::FunctionParser::parseFunction( seqEquations[ i ], *this );
+ }
+ catch ( EnhancedCustomShape::ParseError& )
+ {
+ }
+ }
+ }
+}
+double EnhancedCustomShape2d::GetEnumFunc( const EnumFunc eFunc ) const
+{
+ double fRet = 0.0;
+ switch( eFunc )
+ {
+ case ENUM_FUNC_PI : fRet = F_PI; break;
+ case ENUM_FUNC_LEFT : fRet = 0.0; break;
+ case ENUM_FUNC_TOP : fRet = 0.0; break;
+ case ENUM_FUNC_RIGHT : fRet = (double)nCoordWidth * fXRatio; break;
+ case ENUM_FUNC_BOTTOM : fRet = (double)nCoordHeight * fYRatio; break;
+ case ENUM_FUNC_XSTRETCH : fRet = nXRef; break;
+ case ENUM_FUNC_YSTRETCH : fRet = nYRef; break;
+ case ENUM_FUNC_HASSTROKE : fRet = bStroked ? 1.0 : 0.0; break;
+ case ENUM_FUNC_HASFILL : fRet = bFilled ? 1.0 : 0.0; break;
+ case ENUM_FUNC_WIDTH : fRet = nCoordWidth; break;
+ case ENUM_FUNC_HEIGHT : fRet = nCoordHeight; break;
+ case ENUM_FUNC_LOGWIDTH : fRet = aLogicRect.GetWidth(); break;
+ case ENUM_FUNC_LOGHEIGHT : fRet = aLogicRect.GetHeight(); break;
+ }
+ return fRet;
+}
+double EnhancedCustomShape2d::GetAdjustValueAsDouble( const sal_Int32 nIndex ) const
+{
+ double fNumber = 0.0;
+ if ( nIndex < seqAdjustmentValues.getLength() )
+ {
+ if ( seqAdjustmentValues[ nIndex ].Value.getValueTypeClass() == TypeClass_DOUBLE )
+ seqAdjustmentValues[ nIndex ].Value >>= fNumber;
+ else
+ {
+ sal_Int32 nNumber = 0;
+ seqAdjustmentValues[ nIndex ].Value >>= nNumber;
+ fNumber = (double)nNumber;
+ }
+ }
+ return fNumber;
+}
+double EnhancedCustomShape2d::GetEquationValueAsDouble( const sal_Int32 nIndex ) const
+{
+ double fNumber = 0.0;
+ if ( nIndex < (sal_Int32)vNodesSharedPtr.size() )
+ {
+ if ( vNodesSharedPtr[ nIndex ].get() )
+ try
+ {
+ fNumber = (*vNodesSharedPtr[ nIndex ])();
+ if ( !rtl::math::isFinite( fNumber ) )
+ fNumber = 0.0;
+ }
+ catch ( ... )
+ {
+ /* sal_Bool bUps = sal_True; */
+ }
+ }
+ return fNumber;
+}
+sal_Int32 EnhancedCustomShape2d::GetAdjustValueAsInteger( const sal_Int32 nIndex, const sal_Int32 nDefault ) const
+{
+ sal_Int32 nNumber = nDefault;
+ if ( nIndex < seqAdjustmentValues.getLength() )
+ {
+ if ( seqAdjustmentValues[ nIndex ].Value.getValueTypeClass() == TypeClass_DOUBLE )
+ {
+ double fNumber = 0;
+ seqAdjustmentValues[ nIndex ].Value >>= fNumber;
+ nNumber = (sal_Int32)fNumber;
+ }
+ else
+ seqAdjustmentValues[ nIndex ].Value >>= nNumber;
+ }
+ return nNumber;
+}
+sal_Bool EnhancedCustomShape2d::SetAdjustValueAsDouble( const double& rValue, const sal_Int32 nIndex )
+{
+ sal_Bool bRetValue = sal_False;
+ if ( nIndex < seqAdjustmentValues.getLength() )
+ {
+ // updating our local adjustment sequence
+ seqAdjustmentValues[ nIndex ].Value <<= rValue;
+ seqAdjustmentValues[ nIndex ].State = com::sun::star::beans::PropertyState_DIRECT_VALUE;
+ bRetValue = sal_True;
+ }
+ return bRetValue;
+}
+
+Point EnhancedCustomShape2d::GetPoint( const com::sun::star::drawing::EnhancedCustomShapeParameterPair& rPair,
+ const sal_Bool bScale, const sal_Bool bReplaceGeoSize ) const
+{
+ Point aRetValue;
+ sal_Bool bExchange = ( nFlags & DFF_CUSTOMSHAPE_EXCH ) != 0; // x <-> y
+ sal_uInt32 nPass = 0;
+ do
+ {
+ sal_uInt32 nIndex = nPass;
+
+ if ( bExchange )
+ nIndex ^= 1;
+
+ double fVal;
+ const EnhancedCustomShapeParameter& rParameter = nIndex ? rPair.Second : rPair.First;
+ if ( nPass ) // height
+ {
+ GetParameter( fVal, rParameter, sal_False, bReplaceGeoSize );
+ fVal -= nCoordTop;
+ if ( bScale )
+ {
+ fVal *= fYScale;
+
+ if ( nFlags & DFF_CUSTOMSHAPE_FLIP_V )
+ fVal = aLogicRect.GetHeight() - fVal;
+ }
+ aRetValue.Y() = (sal_Int32)fVal;
+ }
+ else // width
+ {
+ GetParameter( fVal, rParameter, bReplaceGeoSize, sal_False );
+ fVal -= nCoordLeft;
+ if ( bScale )
+ {
+ fVal *= fXScale;
+
+ if ( nFlags & DFF_CUSTOMSHAPE_FLIP_H )
+ fVal = aLogicRect.GetWidth() - fVal;
+ }
+ aRetValue.X() = (sal_Int32)fVal;
+ }
+ }
+ while ( ++nPass < 2 );
+ return aRetValue;
+}
+
+sal_Bool EnhancedCustomShape2d::GetParameter( double& rRetValue, const EnhancedCustomShapeParameter& rParameter,
+ const sal_Bool bReplaceGeoWidth, const sal_Bool bReplaceGeoHeight ) const
+{
+ rRetValue = 0.0;
+ sal_Bool bRetValue = sal_False;
+ switch ( rParameter.Type )
+ {
+ case EnhancedCustomShapeParameterType::ADJUSTMENT :
+ {
+ sal_Int32 nAdjustmentIndex = 0;
+ if ( rParameter.Value >>= nAdjustmentIndex )
+ {
+ rRetValue = GetAdjustValueAsDouble( nAdjustmentIndex );
+ bRetValue = sal_True;
+ }
+ }
+ break;
+ case EnhancedCustomShapeParameterType::EQUATION :
+ {
+ sal_Int32 nEquationIndex = 0;
+ if ( rParameter.Value >>= nEquationIndex )
+ {
+ rRetValue = GetEquationValueAsDouble( nEquationIndex );
+ bRetValue = sal_True;
+ }
+ }
+ break;
+ case EnhancedCustomShapeParameterType::NORMAL :
+ {
+ if ( rParameter.Value.getValueTypeClass() == TypeClass_DOUBLE )
+ {
+ double fValue;
+ if ( rParameter.Value >>= fValue )
+ {
+ rRetValue = fValue;
+ bRetValue = sal_True;
+ }
+ }
+ else
+ {
+ sal_Int32 nValue = 0;
+ if ( rParameter.Value >>= nValue )
+ {
+ rRetValue = nValue;
+ bRetValue = sal_True;
+ if ( bReplaceGeoWidth && ( nValue == nCoordWidth ) )
+ rRetValue *= fXRatio;
+ else if ( bReplaceGeoHeight && ( nValue == nCoordHeight ) )
+ rRetValue *= fYRatio;
+ }
+ }
+ }
+ break;
+ case EnhancedCustomShapeParameterType::LEFT :
+ {
+ rRetValue = 0.0;
+ bRetValue = sal_True;
+ }
+ break;
+ case EnhancedCustomShapeParameterType::TOP :
+ {
+ rRetValue = 0.0;
+ bRetValue = sal_True;
+ }
+ break;
+ case EnhancedCustomShapeParameterType::RIGHT :
+ {
+ rRetValue = nCoordWidth;
+ bRetValue = sal_True;
+ }
+ break;
+ case EnhancedCustomShapeParameterType::BOTTOM :
+ {
+ rRetValue = nCoordHeight;
+ bRetValue = sal_True;
+ }
+ break;
+ }
+ return bRetValue;
+}
+
+// nLumDat 28-31 = number of luminance entries in nLumDat
+// nLumDat 27-24 = nLumDatEntry 0
+// nLumDat 23-20 = nLumDatEntry 1 ...
+// each 4bit entry is to be interpreted as a 10 percent signed luminance changing
+sal_Int32 EnhancedCustomShape2d::GetLuminanceChange( sal_uInt32 nIndex ) const
+{
+ const sal_uInt32 nCount = nColorData >> 28;
+ if ( !nCount )
+ return 0;
+
+ if ( nIndex >= nCount )
+ nIndex = nCount - 1;
+
+ const sal_Int32 nLumDat = nColorData << ( ( 1 + nIndex ) << 2 );
+ return ( nLumDat >> 28 ) * 10;
+}
+
+Color EnhancedCustomShape2d::GetColorData( const Color& rFillColor, sal_uInt32 nIndex ) const
+{
+ const sal_Int32 nLuminance = GetLuminanceChange(nIndex);
+ if( !nLuminance )
+ return rFillColor;
+
+ basegfx::BColor aHSVColor=
+ basegfx::tools::rgb2hsv(
+ basegfx::BColor(rFillColor.GetRed()/255.0,
+ rFillColor.GetGreen()/255.0,
+ rFillColor.GetBlue()/255.0));
+ if( nLuminance > 0 )
+ {
+ aHSVColor.setGreen(
+ aHSVColor.getGreen() * (1.0-nLuminance/100.0));
+ aHSVColor.setBlue(
+ nLuminance/100.0 +
+ (1.0-nLuminance/100.0)*aHSVColor.getBlue());
+ }
+ else if( nLuminance < 0 )
+ {
+ aHSVColor.setBlue(
+ (1.0+nLuminance/100.0)*aHSVColor.getBlue());
+ }
+
+ aHSVColor = basegfx::tools::hsv2rgb(aHSVColor);
+ return Color( (sal_uInt8)static_cast< sal_Int32 >( basegfx::clamp(aHSVColor.getRed(),0.0,1.0) * 255.0 + 0.5 ),
+ (sal_uInt8)static_cast< sal_Int32 >( basegfx::clamp(aHSVColor.getGreen(),0.0,1.0) * 255.0 + 0.5 ),
+ (sal_uInt8)static_cast< sal_Int32 >( basegfx::clamp(aHSVColor.getBlue(),0.0,1.0) * 255.0 + 0.5 ) );
+}
+
+Rectangle EnhancedCustomShape2d::GetTextRect() const
+{
+ sal_Int32 nIndex, nSize = seqTextFrames.getLength();
+ if ( !nSize )
+ return aLogicRect;
+ nIndex = 0;
+ if ( bTextFlow && ( nSize > 1 ) )
+ nIndex++;
+ Point aTopLeft( GetPoint( seqTextFrames[ nIndex ].TopLeft, sal_True, sal_True ) );
+ Point aBottomRight( GetPoint( seqTextFrames[ nIndex ].BottomRight, sal_True, sal_True ) );
+ if ( bFlipH )
+ {
+ aTopLeft.X() = aLogicRect.GetWidth() - aTopLeft.X();
+ aBottomRight.X() = aLogicRect.GetWidth() - aBottomRight.X();
+ }
+ if ( bFlipV )
+ {
+ aTopLeft.Y() = aLogicRect.GetHeight() - aTopLeft.Y();
+ aBottomRight.Y() = aLogicRect.GetHeight() - aBottomRight.Y();
+ }
+ Rectangle aRect( aTopLeft, aBottomRight );
+ aRect.Move( aLogicRect.Left(), aLogicRect.Top() );
+ aRect.Justify();
+ return aRect;
+}
+
+sal_uInt32 EnhancedCustomShape2d::GetHdlCount() const
+{
+ return seqHandles.getLength();
+}
+
+sal_Bool EnhancedCustomShape2d::GetHandlePosition( const sal_uInt32 nIndex, Point& rReturnPosition ) const
+{
+ sal_Bool bRetValue = sal_False;
+ if ( nIndex < GetHdlCount() )
+ {
+ Handle aHandle;
+ if ( ConvertSequenceToEnhancedCustomShape2dHandle( seqHandles[ nIndex ], aHandle ) )
+ {
+ if ( aHandle.nFlags & HANDLE_FLAGS_POLAR )
+ {
+ Point aReferencePoint( GetPoint( aHandle.aPolar, sal_True, sal_False ) );
+
+ double fAngle;
+ double fRadius;
+ GetParameter( fRadius, aHandle.aPosition.First, sal_False, sal_False );
+ GetParameter( fAngle, aHandle.aPosition.Second, sal_False, sal_False );
+
+ double a = ( 360.0 - fAngle ) * F_PI180;
+ double dx = fRadius * fXScale;
+ double fX = dx * cos( a );
+ double fY =-dx * sin( a );
+ rReturnPosition =
+ Point(
+ Round( fX + aReferencePoint.X() ),
+ basegfx::fTools::equalZero(fXScale) ? aReferencePoint.Y() :
+ Round( ( fY * fYScale ) / fXScale + aReferencePoint.Y() ) );
+ }
+ else
+ {
+ if ( aHandle.nFlags & HANDLE_FLAGS_SWITCHED )
+ {
+ if ( aLogicRect.GetHeight() > aLogicRect.GetWidth() )
+ {
+ com::sun::star::drawing::EnhancedCustomShapeParameter aFirst = aHandle.aPosition.First;
+ com::sun::star::drawing::EnhancedCustomShapeParameter aSecond = aHandle.aPosition.Second;
+ aHandle.aPosition.First = aSecond;
+ aHandle.aPosition.Second = aFirst;
+ }
+ }
+ 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;
+ RotatePoint( rReturnPosition, Point( aLogicRect.GetWidth() / 2, aLogicRect.GetHeight() / 2 ), sin( a ), cos( a ) );
+ }
+ if ( bFlipH )
+ rReturnPosition.X() = aLogicRect.GetWidth() - rReturnPosition.X();
+ if ( bFlipV )
+ rReturnPosition.Y() = aLogicRect.GetHeight() - rReturnPosition.Y();
+ rReturnPosition.Move( aLogicRect.Left(), aLogicRect.Top() );
+ bRetValue = sal_True;
+ }
+ }
+ return bRetValue;
+}
+
+sal_Bool EnhancedCustomShape2d::SetHandleControllerPosition( const sal_uInt32 nIndex, const com::sun::star::awt::Point& rPosition )
+{
+ sal_Bool bRetValue = sal_False;
+ if ( nIndex < GetHdlCount() )
+ {
+ Handle aHandle;
+ if ( ConvertSequenceToEnhancedCustomShape2dHandle( seqHandles[ nIndex ], aHandle ) )
+ {
+ Point aP( rPosition.X, rPosition.Y );
+ // apply the negative object rotation to the controller position
+
+ aP.Move( -aLogicRect.Left(), -aLogicRect.Top() );
+ if ( bFlipH )
+ aP.X() = aLogicRect.GetWidth() - aP.X();
+ if ( bFlipV )
+ aP.Y() = aLogicRect.GetHeight() - aP.Y();
+ if ( nRotateAngle )
+ {
+ 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;
+ fPos2 /= fYScale;
+
+ if ( aHandle.nFlags & HANDLE_FLAGS_SWITCHED )
+ {
+ if ( aLogicRect.GetHeight() > aLogicRect.GetWidth() )
+ {
+ double fX = fPos1;
+ double fY = fPos2;
+ fPos1 = fY;
+ fPos2 = fX;
+ }
+ }
+
+ sal_Int32 nFirstAdjustmentValue = -1, nSecondAdjustmentValue = -1;
+
+ if ( aHandle.aPosition.First.Type == EnhancedCustomShapeParameterType::ADJUSTMENT )
+ aHandle.aPosition.First.Value >>= nFirstAdjustmentValue;
+ if ( aHandle.aPosition.Second.Type == EnhancedCustomShapeParameterType::ADJUSTMENT )
+ aHandle.aPosition.Second.Value>>= nSecondAdjustmentValue;
+
+ if ( aHandle.nFlags & HANDLE_FLAGS_POLAR )
+ {
+ double fXRef, fYRef, fAngle;
+ GetParameter( fXRef, aHandle.aPolar.First, sal_False, sal_False );
+ GetParameter( fYRef, aHandle.aPolar.Second, sal_False, sal_False );
+ const double fDX = fPos1 - fXRef;
+ fAngle = -( atan2( -fPos2 + fYRef, ( ( fDX == 0.0L ) ? 0.000000001 : fDX ) ) / F_PI180 );
+ double fX = ( fPos1 - fXRef );
+ double fY = ( fPos2 - fYRef );
+ double fRadius = sqrt( fX * fX + fY * fY );
+ if ( aHandle.nFlags & HANDLE_FLAGS_RADIUS_RANGE_MINIMUM )
+ {
+ double fMin;
+ GetParameter( fMin, aHandle.aRadiusRangeMinimum, sal_False, sal_False );
+ if ( fRadius < fMin )
+ fRadius = fMin;
+ }
+ if ( aHandle.nFlags & HANDLE_FLAGS_RADIUS_RANGE_MAXIMUM )
+ {
+ double fMax;
+ GetParameter( fMax, aHandle.aRadiusRangeMaximum, sal_False, sal_False );
+ if ( fRadius > fMax )
+ fRadius = fMax;
+ }
+ if ( nFirstAdjustmentValue >= 0 )
+ SetAdjustValueAsDouble( fRadius, nFirstAdjustmentValue );
+ if ( nSecondAdjustmentValue >= 0 )
+ SetAdjustValueAsDouble( fAngle, nSecondAdjustmentValue );
+ }
+ else
+ {
+ if ( aHandle.nFlags & HANDLE_FLAGS_REFX )
+ {
+ nFirstAdjustmentValue = aHandle.nRefX;
+ fPos1 *= 100000.0;
+ fPos1 /= nCoordWidth;
+ }
+ if ( aHandle.nFlags & HANDLE_FLAGS_REFY )
+ {
+ nSecondAdjustmentValue = aHandle.nRefY;
+ fPos2 *= 100000.0;
+ fPos2 /= nCoordHeight;
+ }
+ if ( nFirstAdjustmentValue >= 0 )
+ {
+ if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_X_MINIMUM ) // check if horizontal handle needs to be within a range
+ {
+ double fXMin;
+ GetParameter( fXMin, aHandle.aXRangeMinimum, sal_False, sal_False );
+ if ( fPos1 < fXMin )
+ fPos1 = fXMin;
+ }
+ if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_X_MAXIMUM ) // check if horizontal handle needs to be within a range
+ {
+ double fXMax;
+ GetParameter( fXMax, aHandle.aXRangeMaximum, sal_False, sal_False );
+ if ( fPos1 > fXMax )
+ fPos1 = fXMax;
+ }
+ SetAdjustValueAsDouble( fPos1, nFirstAdjustmentValue );
+ }
+ if ( nSecondAdjustmentValue >= 0 )
+ {
+ if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_Y_MINIMUM ) // check if vertical handle needs to be within a range
+ {
+ double fYMin;
+ GetParameter( fYMin, aHandle.aYRangeMinimum, sal_False, sal_False );
+ if ( fPos2 < fYMin )
+ fPos2 = fYMin;
+ }
+ if ( aHandle.nFlags & HANDLE_FLAGS_RANGE_Y_MAXIMUM ) // check if vertical handle needs to be within a range
+ {
+ double fYMax;
+ GetParameter( fYMax, aHandle.aYRangeMaximum, sal_False, sal_False );
+ if ( fPos2 > fYMax )
+ fPos2 = fYMax;
+ }
+ SetAdjustValueAsDouble( fPos2, nSecondAdjustmentValue );
+ }
+ }
+ // and writing them back into the GeometryItem
+ SdrCustomShapeGeometryItem aGeometryItem((SdrCustomShapeGeometryItem&)
+ (const SdrCustomShapeGeometryItem&)pCustomShapeObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ));
+ const rtl::OUString sAdjustmentValues( RTL_CONSTASCII_USTRINGPARAM ( "AdjustmentValues" ) );
+ com::sun::star::beans::PropertyValue aPropVal;
+ aPropVal.Name = sAdjustmentValues;
+ aPropVal.Value <<= seqAdjustmentValues;
+ aGeometryItem.SetPropertyValue( aPropVal );
+ pCustomShapeObj->SetMergedItem( aGeometryItem );
+ bRetValue = sal_True;
+ }
+ }
+ return bRetValue;
+}
+
+void EnhancedCustomShape2d::SwapStartAndEndArrow( SdrObject* pObj ) //#108274
+{
+ XLineStartItem aLineStart;
+ aLineStart.SetLineStartValue(((XLineStartItem&)pObj->GetMergedItem( XATTR_LINEEND )).GetLineStartValue());
+ XLineStartWidthItem aLineStartWidth(((XLineStartWidthItem&)pObj->GetMergedItem( XATTR_LINEENDWIDTH )).GetValue());
+ XLineStartCenterItem aLineStartCenter(((XLineStartCenterItem&)pObj->GetMergedItem( XATTR_LINEENDCENTER )).GetValue());
+
+ XLineEndItem aLineEnd;
+ aLineEnd.SetLineEndValue(((XLineEndItem&)pObj->GetMergedItem( XATTR_LINESTART )).GetLineEndValue());
+ XLineEndWidthItem aLineEndWidth(((XLineEndWidthItem&)pObj->GetMergedItem( XATTR_LINESTARTWIDTH )).GetValue());
+ XLineEndCenterItem aLineEndCenter(((XLineEndCenterItem&)pObj->GetMergedItem( XATTR_LINESTARTCENTER )).GetValue());
+
+ pObj->SetMergedItem( aLineStart );
+ pObj->SetMergedItem( aLineStartWidth );
+ pObj->SetMergedItem( aLineStartCenter );
+ pObj->SetMergedItem( aLineEnd );
+ pObj->SetMergedItem( aLineEndWidth );
+ pObj->SetMergedItem( aLineEndCenter );
+}
+
+basegfx::B2DPolygon CreateArc( const Rectangle& rRect, const Point& rStart, const Point& rEnd, const sal_Bool bClockwise )
+{
+ Rectangle aRect( rRect );
+ Point aStart( rStart );
+ Point aEnd( rEnd );
+
+ sal_Int32 bSwapStartEndAngle = 0;
+
+ if ( aRect.Left() > aRect.Right() )
+ bSwapStartEndAngle ^= 0x01;
+ if ( aRect.Top() > aRect.Bottom() )
+ bSwapStartEndAngle ^= 0x11;
+ if ( bSwapStartEndAngle )
+ {
+ aRect.Justify();
+ if ( bSwapStartEndAngle & 1 )
+ {
+ Point aTmp( aStart );
+ aStart = aEnd;
+ aEnd = aTmp;
+ }
+ }
+
+ Polygon aTempPoly( aRect, aStart, aEnd, POLY_ARC );
+ basegfx::B2DPolygon aRetval;
+
+ if ( bClockwise )
+ {
+ for ( sal_uInt16 j = aTempPoly.GetSize(); j--; )
+ {
+ aRetval.append(basegfx::B2DPoint(aTempPoly[ j ].X(), aTempPoly[ j ].Y()));
+ }
+ }
+ else
+ {
+ for ( sal_uInt16 j = 0; j < aTempPoly.GetSize(); j++ )
+ {
+ aRetval.append(basegfx::B2DPoint(aTempPoly[ j ].X(), aTempPoly[ j ].Y()));
+ }
+ }
+
+ return aRetval;
+}
+
+void EnhancedCustomShape2d::CreateSubPath( sal_uInt16& rSrcPt, sal_uInt16& rSegmentInd, std::vector< SdrPathObj* >& rObjectList,
+ const sal_Bool bLineGeometryNeededOnly,
+ const sal_Bool bSortFilledObjectsToBack )
+{
+ sal_Bool bNoFill = sal_False;
+ sal_Bool bNoStroke = sal_False;
+
+ basegfx::B2DPolyPolygon aNewB2DPolyPolygon;
+ basegfx::B2DPolygon aNewB2DPolygon;
+
+ sal_Int32 nCoordSize = seqCoordinates.getLength();
+ sal_Int32 nSegInfoSize = seqSegments.getLength();
+ if ( !nSegInfoSize )
+ {
+ const EnhancedCustomShapeParameterPair* pTmp = seqCoordinates.getArray();
+
+ for ( sal_Int32 nPtNum(0L); nPtNum < nCoordSize; nPtNum++ )
+ {
+ const Point aTempPoint(GetPoint( *pTmp++, sal_True, sal_True ));
+ aNewB2DPolygon.append(basegfx::B2DPoint(aTempPoint.X(), aTempPoint.Y()));
+ }
+
+ aNewB2DPolygon.setClosed(true);
+ }
+ else
+ {
+ for ( ;rSegmentInd < nSegInfoSize; )
+ {
+ sal_Int16 nCommand = seqSegments[ rSegmentInd ].Command;
+ sal_Int16 nPntCount= seqSegments[ rSegmentInd++ ].Count;
+
+ switch ( nCommand )
+ {
+ case NOFILL :
+ bNoFill = sal_True;
+ break;
+ case NOSTROKE :
+ bNoStroke = sal_True;
+ break;
+ case MOVETO :
+ {
+ if(aNewB2DPolygon.count() > 1L)
+ {
+ // #i76201# Add conversion to closed polygon when first and last points are equal
+ basegfx::tools::checkClosed(aNewB2DPolygon);
+ aNewB2DPolyPolygon.append(aNewB2DPolygon);
+ }
+
+ aNewB2DPolygon.clear();
+
+ if ( rSrcPt < nCoordSize )
+ {
+ const Point aTempPoint(GetPoint( seqCoordinates[ rSrcPt++ ], sal_True, sal_True ));
+ aNewB2DPolygon.append(basegfx::B2DPoint(aTempPoint.X(), aTempPoint.Y()));
+ }
+ }
+ break;
+ case ENDSUBPATH :
+ break;
+ case CLOSESUBPATH :
+ {
+ if(aNewB2DPolygon.count())
+ {
+ if(aNewB2DPolygon.count() > 1L)
+ {
+ aNewB2DPolygon.setClosed(true);
+ aNewB2DPolyPolygon.append(aNewB2DPolygon);
+ }
+
+ aNewB2DPolygon.clear();
+ }
+ }
+ break;
+ case CURVETO :
+ {
+ for ( sal_uInt16 i = 0; ( i < nPntCount ) && ( ( rSrcPt + 2 ) < nCoordSize ); i++ )
+ {
+ const Point aControlA(GetPoint( seqCoordinates[ rSrcPt++ ], sal_True, sal_True ));
+ const Point aControlB(GetPoint( seqCoordinates[ rSrcPt++ ], sal_True, sal_True ));
+ const Point aEnd(GetPoint( seqCoordinates[ rSrcPt++ ], sal_True, sal_True ));
+
+ DBG_ASSERT(aNewB2DPolygon.count(), "EnhancedCustomShape2d::CreateSubPath: Error in adding control point (!)");
+ aNewB2DPolygon.appendBezierSegment(
+ basegfx::B2DPoint(aControlA.X(), aControlA.Y()),
+ basegfx::B2DPoint(aControlB.X(), aControlB.Y()),
+ basegfx::B2DPoint(aEnd.X(), aEnd.Y()));
+ }
+ }
+ break;
+
+ case ANGLEELLIPSE :
+ {
+ if(aNewB2DPolygon.count() > 1L)
+ {
+ // #i76201# Add conversion to closed polygon when first and last points are equal
+ basegfx::tools::checkClosed(aNewB2DPolygon);
+ aNewB2DPolyPolygon.append(aNewB2DPolygon);
+ }
+
+ aNewB2DPolygon.clear();
+ }
+ case ANGLEELLIPSETO :
+ {
+ for ( sal_uInt16 i = 0; ( i < nPntCount ) && ( ( rSrcPt + 2 ) < nCoordSize ); i++ )
+ {
+ // create a circle
+ Point _aCenter( GetPoint( seqCoordinates[ rSrcPt ], sal_True, sal_True ) );
+ double fWidth, fHeight;
+ GetParameter( fWidth, seqCoordinates[ rSrcPt + 1 ].First, sal_True, sal_False );
+ GetParameter( fHeight, seqCoordinates[ rSrcPt + 1 ].Second, sal_False, sal_True );
+ fWidth *= fXScale;
+ fHeight*= fYScale;
+ Point aP( (sal_Int32)( _aCenter.X() - fWidth ), (sal_Int32)( _aCenter.Y() - fHeight ) );
+ Size aS( (sal_Int32)( fWidth * 2.0 ), (sal_Int32)( fHeight * 2.0 ) );
+ Rectangle aRect( aP, aS );
+ if ( aRect.GetWidth() && aRect.GetHeight() )
+ {
+ double fStartAngle, fEndAngle;
+ GetParameter( fStartAngle, seqCoordinates[ rSrcPt + 2 ].First, sal_False, sal_False );
+ GetParameter( fEndAngle , seqCoordinates[ rSrcPt + 2 ].Second, sal_False, sal_False );
+
+ if ( ((sal_Int32)fStartAngle % 360) != ((sal_Int32)fEndAngle % 360) )
+ {
+ if ( (sal_Int32)fStartAngle & 0x7fff0000 ) // SJ: if the angle was imported from our escher import, then the
+ fStartAngle /= 65536.0; // value is shifted by 16. TODO: already change the fixed float to a
+ if ( (sal_Int32)fEndAngle & 0x7fff0000 ) // double in the import filter
+ {
+ fEndAngle /= 65536.0;
+ fEndAngle = fEndAngle + fStartAngle;
+ if ( fEndAngle < 0 )
+ { // in the binary filter the endangle is the amount
+ double fTemp = fStartAngle;
+ fStartAngle = fEndAngle;
+ fEndAngle = fTemp;
+ }
+ }
+ double fCenterX = aRect.Center().X();
+ double fCenterY = aRect.Center().Y();
+ double fx1 = ( cos( fStartAngle * F_PI180 ) * 65536.0 * fXScale ) + fCenterX;
+ double fy1 = ( -sin( fStartAngle * F_PI180 ) * 65536.0 * fYScale ) + fCenterY;
+ double fx2 = ( cos( fEndAngle * F_PI180 ) * 65536.0 * fXScale ) + fCenterX;
+ double fy2 = ( -sin( fEndAngle * F_PI180 ) * 65536.0 * fYScale ) + fCenterY;
+ aNewB2DPolygon.append(CreateArc( aRect, Point( (sal_Int32)fx1, (sal_Int32)fy1 ), Point( (sal_Int32)fx2, (sal_Int32)fy2 ), sal_False));
+ }
+ else
+ { /* SJ: TODO: this block should be replaced sometimes, because the current point
+ is not set correct, it also does not use the correct moveto
+ point if ANGLEELLIPSETO was used, but the method CreateArc
+ is at the moment not able to draw full circles (if startangle is 0
+ and endangle 360 nothing is painted :-( */
+ sal_Int32 nXControl = (sal_Int32)((double)aRect.GetWidth() * 0.2835 );
+ sal_Int32 nYControl = (sal_Int32)((double)aRect.GetHeight() * 0.2835 );
+ Point aCenter( aRect.Center() );
+
+ // append start point
+ aNewB2DPolygon.append(basegfx::B2DPoint(aCenter.X(), aRect.Top()));
+
+ // append four bezier segments
+ aNewB2DPolygon.appendBezierSegment(
+ basegfx::B2DPoint(aCenter.X() + nXControl, aRect.Top()),
+ basegfx::B2DPoint(aRect.Right(), aCenter.Y() - nYControl),
+ basegfx::B2DPoint(aRect.Right(), aCenter.Y()));
+
+ aNewB2DPolygon.appendBezierSegment(
+ basegfx::B2DPoint(aRect.Right(), aCenter.Y() + nYControl),
+ basegfx::B2DPoint(aCenter.X() + nXControl, aRect.Bottom()),
+ basegfx::B2DPoint(aCenter.X(), aRect.Bottom()));
+
+ aNewB2DPolygon.appendBezierSegment(
+ basegfx::B2DPoint(aCenter.X() - nXControl, aRect.Bottom()),
+ basegfx::B2DPoint(aRect.Left(), aCenter.Y() + nYControl),
+ basegfx::B2DPoint(aRect.Left(), aCenter.Y()));
+
+ aNewB2DPolygon.appendBezierSegment(
+ basegfx::B2DPoint(aRect.Left(), aCenter.Y() - nYControl),
+ basegfx::B2DPoint(aCenter.X() - nXControl, aRect.Top()),
+ basegfx::B2DPoint(aCenter.X(), aRect.Top()));
+
+ // close, rescue last controlpoint, remove double last point
+ basegfx::tools::closeWithGeometryChange(aNewB2DPolygon);
+ }
+ }
+ rSrcPt += 3;
+ }
+ }
+ break;
+
+ case LINETO :
+ {
+ for ( sal_Int32 i(0L); ( i < nPntCount ) && ( rSrcPt < nCoordSize ); i++ )
+ {
+ const Point aTempPoint(GetPoint( seqCoordinates[ rSrcPt++ ], sal_True, sal_True ));
+ aNewB2DPolygon.append(basegfx::B2DPoint(aTempPoint.X(), aTempPoint.Y()));
+ }
+ }
+ break;
+
+ case ARC :
+ case CLOCKWISEARC :
+ {
+ if(aNewB2DPolygon.count() > 1L)
+ {
+ // #i76201# Add conversion to closed polygon when first and last points are equal
+ basegfx::tools::checkClosed(aNewB2DPolygon);
+ aNewB2DPolyPolygon.append(aNewB2DPolygon);
+ }
+
+ aNewB2DPolygon.clear();
+ }
+ case ARCTO :
+ case CLOCKWISEARCTO :
+ {
+ sal_Bool bClockwise = ( nCommand == CLOCKWISEARC ) || ( nCommand == CLOCKWISEARCTO );
+ sal_uInt32 nXor = bClockwise ? 3 : 2;
+ for ( sal_uInt16 i = 0; ( i < nPntCount ) && ( ( rSrcPt + 3 ) < nCoordSize ); i++ )
+ {
+ Rectangle aRect( GetPoint( seqCoordinates[ rSrcPt ], sal_True, sal_True ), GetPoint( seqCoordinates[ rSrcPt + 1 ], sal_True, sal_True ) );
+ if ( aRect.GetWidth() && aRect.GetHeight() )
+ {
+ Point aCenter( aRect.Center() );
+ Point aStart( GetPoint( seqCoordinates[ (sal_uInt16)( rSrcPt + nXor ) ], sal_True, sal_True ) );
+ Point aEnd( GetPoint( seqCoordinates[ (sal_uInt16)( rSrcPt + ( nXor ^ 1 ) ) ], sal_True, sal_True ) );
+ double fRatio = (double)aRect.GetHeight() / (double)aRect.GetWidth();
+ aStart.X() = (sal_Int32)( ( (double)( aStart.X() - aCenter.X() ) ) * fRatio ) + aCenter.X();
+ aStart.Y() = (sal_Int32)( ( (double)( aStart.Y() - aCenter.Y() ) ) ) + aCenter.Y();
+ aEnd.X() = (sal_Int32)( ( (double)( aEnd.X() - aCenter.X() ) ) * fRatio ) + aCenter.X();
+ aEnd.Y() = (sal_Int32)( ( (double)( aEnd.Y() - aCenter.Y() ) ) ) + aCenter.Y();
+ aNewB2DPolygon.append(CreateArc( aRect, aStart, aEnd, bClockwise));
+ }
+ rSrcPt += 4;
+ }
+ }
+ break;
+
+ case ELLIPTICALQUADRANTX :
+ case ELLIPTICALQUADRANTY :
+ {
+ bool bFirstDirection(true);
+ basegfx::B2DPoint aControlPointA;
+ basegfx::B2DPoint aControlPointB;
+
+ for ( sal_uInt16 i = 0; ( i < nPntCount ) && ( rSrcPt < nCoordSize ); i++ )
+ {
+ sal_uInt32 nModT = ( nCommand == ELLIPTICALQUADRANTX ) ? 1 : 0;
+ Point aCurrent( GetPoint( seqCoordinates[ rSrcPt ], sal_True, sal_True ) );
+
+ if ( rSrcPt ) // we need a previous point
+ {
+ Point aPrev( GetPoint( seqCoordinates[ rSrcPt - 1 ], sal_True, sal_True ) );
+ sal_Int32 nX, nY;
+ nX = aCurrent.X() - aPrev.X();
+ nY = aCurrent.Y() - aPrev.Y();
+ if ( ( nY ^ nX ) & 0x80000000 )
+ {
+ if ( !i )
+ bFirstDirection = true;
+ else if ( !bFirstDirection )
+ nModT ^= 1;
+ }
+ else
+ {
+ if ( !i )
+ bFirstDirection = false;
+ else if ( bFirstDirection )
+ nModT ^= 1;
+ }
+ if ( nModT ) // get the right corner
+ {
+ nX = aCurrent.X();
+ nY = aPrev.Y();
+ }
+ else
+ {
+ nX = aPrev.X();
+ nY = aCurrent.Y();
+ }
+ sal_Int32 nXVec = ( nX - aPrev.X() ) >> 1;
+ sal_Int32 nYVec = ( nY - aPrev.Y() ) >> 1;
+ Point aControl1( aPrev.X() + nXVec, aPrev.Y() + nYVec );
+
+ aControlPointA = basegfx::B2DPoint(aControl1.X(), aControl1.Y());
+
+ nXVec = ( nX - aCurrent.X() ) >> 1;
+ nYVec = ( nY - aCurrent.Y() ) >> 1;
+ Point aControl2( aCurrent.X() + nXVec, aCurrent.Y() + nYVec );
+
+ aControlPointB = basegfx::B2DPoint(aControl2.X(), aControl2.Y());
+
+ aNewB2DPolygon.appendBezierSegment(
+ aControlPointA,
+ aControlPointB,
+ basegfx::B2DPoint(aCurrent.X(), aCurrent.Y()));
+ }
+ else
+ {
+ aNewB2DPolygon.append(basegfx::B2DPoint(aCurrent.X(), aCurrent.Y()));
+ }
+
+ rSrcPt++;
+ }
+ }
+ break;
+
+#ifdef DBG_CUSTOMSHAPE
+ case UNKNOWN :
+ default :
+ {
+ ByteString aString( "CustomShapes::unknown PolyFlagValue :" );
+ aString.Append( ByteString::CreateFromInt32( nCommand ) );
+ DBG_ERROR( aString.GetBuffer() );
+ }
+ break;
+#endif
+ }
+ if ( nCommand == ENDSUBPATH )
+ break;
+ }
+ }
+ if ( rSegmentInd == nSegInfoSize )
+ rSegmentInd++;
+
+ if(aNewB2DPolygon.count() > 1L)
+ {
+ // #i76201# Add conversion to closed polygon when first and last points are equal
+ basegfx::tools::checkClosed(aNewB2DPolygon);
+ aNewB2DPolyPolygon.append(aNewB2DPolygon);
+ }
+
+ if(aNewB2DPolyPolygon.count())
+ {
+ // #i37011#
+ bool bForceCreateTwoObjects(false);
+
+ if(!bSortFilledObjectsToBack && !aNewB2DPolyPolygon.isClosed() && !bNoStroke)
+ {
+ bForceCreateTwoObjects = true;
+ }
+
+ if(bLineGeometryNeededOnly)
+ {
+ bForceCreateTwoObjects = true;
+ bNoFill = true;
+ bNoStroke = false;
+ }
+
+ if(bForceCreateTwoObjects || bSortFilledObjectsToBack)
+ {
+ if(bFilled && !bNoFill)
+ {
+ basegfx::B2DPolyPolygon aClosedPolyPolygon(aNewB2DPolyPolygon);
+ aClosedPolyPolygon.setClosed(true);
+ SdrPathObj* pFill = new SdrPathObj(OBJ_POLY, aClosedPolyPolygon);
+ SfxItemSet aTempSet(*this);
+ aTempSet.Put(SdrShadowItem(sal_False));
+ aTempSet.Put(XLineStyleItem(XLINE_NONE));
+ pFill->SetMergedItemSet(aTempSet);
+ rObjectList.push_back(pFill);
+ }
+
+ if(!bNoStroke)
+ {
+ // there is no reason to use OBJ_PLIN here when the polygon is actually closed,
+ // the non-fill is defined by XFILL_NONE. Since SdrPathObj::ImpForceKind() needs
+ // to correct the polygon (here: open it) using the type, the last edge may get lost.
+ // Thus, use a type that fits the polygon
+ SdrPathObj* pStroke = new SdrPathObj(
+ aNewB2DPolyPolygon.isClosed() ? OBJ_POLY : OBJ_PLIN,
+ aNewB2DPolyPolygon);
+ SfxItemSet aTempSet(*this);
+ aTempSet.Put(SdrShadowItem(sal_False));
+ aTempSet.Put(XFillStyleItem(XFILL_NONE));
+ pStroke->SetMergedItemSet(aTempSet);
+ rObjectList.push_back(pStroke);
+ }
+ }
+ else
+ {
+ SdrPathObj* pObj = 0;
+ SfxItemSet aTempSet(*this);
+ aTempSet.Put(SdrShadowItem(sal_False));
+
+ if(bNoFill)
+ {
+ // see comment above about OBJ_PLIN
+ pObj = new SdrPathObj(
+ aNewB2DPolyPolygon.isClosed() ? OBJ_POLY : OBJ_PLIN,
+ aNewB2DPolyPolygon);
+ aTempSet.Put(XFillStyleItem(XFILL_NONE));
+ }
+ else
+ {
+ aNewB2DPolyPolygon.setClosed(true);
+ pObj = new SdrPathObj(OBJ_POLY, aNewB2DPolyPolygon);
+ }
+
+ if(bNoStroke)
+ {
+ aTempSet.Put(XLineStyleItem(XLINE_NONE));
+ }
+
+ if(pObj)
+ {
+ pObj->SetMergedItemSet(aTempSet);
+ rObjectList.push_back(pObj);
+ }
+ }
+ }
+}
+
+void CorrectCalloutArrows( MSO_SPT eSpType, sal_uInt32 nLineObjectCount, std::vector< SdrPathObj* >& vObjectList )
+{
+ sal_Bool bAccent = sal_False;
+ switch( eSpType )
+ {
+ case mso_sptCallout1 :
+ case mso_sptBorderCallout1 :
+ case mso_sptCallout90 :
+ case mso_sptBorderCallout90 :
+ default:
+ break;
+
+ case mso_sptAccentCallout1 :
+ case mso_sptAccentBorderCallout1 :
+ case mso_sptAccentCallout90 :
+ case mso_sptAccentBorderCallout90 :
+ {
+ sal_uInt32 i, nLine = 0;
+ for ( i = 0; i < vObjectList.size(); i++ )
+ {
+ SdrPathObj* pObj( vObjectList[ i ] );
+ if(pObj->IsLine())
+ {
+ nLine++;
+ if ( nLine == nLineObjectCount )
+ {
+ pObj->ClearMergedItem( XATTR_LINESTART );
+ pObj->ClearMergedItem( XATTR_LINEEND );
+ }
+ }
+ }
+ }
+ break;
+
+ // switch start & end
+ case mso_sptAccentCallout2 :
+ case mso_sptAccentBorderCallout2 :
+ bAccent = sal_True;
+ case mso_sptCallout2 :
+ case mso_sptBorderCallout2 :
+ {
+ sal_uInt32 i, nLine = 0;
+ for ( i = 0; i < vObjectList.size(); i++ )
+ {
+ SdrPathObj* pObj( vObjectList[ i ] );
+ if(pObj->IsLine())
+ {
+ nLine++;
+ if ( nLine == 1 )
+ pObj->ClearMergedItem( XATTR_LINEEND );
+ else if ( ( bAccent && ( nLine == nLineObjectCount - 1 ) ) || ( !bAccent && ( nLine == nLineObjectCount ) ) )
+ pObj->ClearMergedItem( XATTR_LINESTART );
+ else
+ {
+ pObj->ClearMergedItem( XATTR_LINESTART );
+ pObj->ClearMergedItem( XATTR_LINEEND );
+ }
+ }
+ }
+ }
+ break;
+
+ case mso_sptAccentCallout3 :
+ case mso_sptAccentBorderCallout3 :
+ bAccent = sal_False;
+ case mso_sptCallout3 :
+ case mso_sptBorderCallout3 :
+ {
+ sal_uInt32 i, nLine = 0;
+ for ( i = 0; i < vObjectList.size(); i++ )
+ {
+ SdrPathObj* pObj( vObjectList[ i ] );
+ if(pObj->IsLine())
+ {
+ if ( nLine )
+ {
+ pObj->ClearMergedItem( XATTR_LINESTART );
+ pObj->ClearMergedItem( XATTR_LINEEND );
+ }
+ else
+ EnhancedCustomShape2d::SwapStartAndEndArrow( pObj );
+
+ nLine++;
+ }
+ }
+ }
+ break;
+ }
+}
+
+void EnhancedCustomShape2d::AdaptObjColor(SdrPathObj& rObj, const SfxItemSet& rCustomShapeSet,
+ sal_uInt32& nColorIndex, sal_uInt32 nColorCount)
+{
+ if ( !rObj.IsLine() )
+ {
+ const XFillStyle eFillStyle = ((const XFillStyleItem&)rObj.GetMergedItem(XATTR_FILLSTYLE)).GetValue();
+ switch( eFillStyle )
+ {
+ default:
+ case XFILL_SOLID:
+ {
+ Color aFillColor;
+ if ( nColorCount )
+ {
+ aFillColor = GetColorData(
+ ((XFillColorItem&)rCustomShapeSet.Get( XATTR_FILLCOLOR )).GetColorValue(),
+ std::min(nColorIndex, nColorCount-1) );
+ rObj.SetMergedItem( XFillColorItem( String(), aFillColor ) );
+ }
+ break;
+ }
+ case XFILL_GRADIENT:
+ {
+ XGradient aXGradient(((const XFillGradientItem&)rObj.GetMergedItem(XATTR_FILLGRADIENT)).GetGradientValue());
+ if ( nColorCount )
+ {
+ aXGradient.SetStartColor(
+ GetColorData(
+ aXGradient.GetStartColor(),
+ std::min(nColorIndex, nColorCount-1) ));
+ aXGradient.SetEndColor(
+ GetColorData(
+ aXGradient.GetEndColor(),
+ std::min(nColorIndex, nColorCount-1) ));
+ }
+
+ rObj.SetMergedItem( XFillGradientItem( String(), aXGradient ) );
+ break;
+ }
+ case XFILL_HATCH:
+ {
+ XHatch aXHatch(((const XFillHatchItem&)rObj.GetMergedItem(XATTR_FILLHATCH)).GetHatchValue());
+ if ( nColorCount )
+ {
+ aXHatch.SetColor(
+ GetColorData(
+ aXHatch.GetColor(),
+ std::min(nColorIndex, nColorCount-1) ));
+ }
+
+ rObj.SetMergedItem( XFillHatchItem( String(), aXHatch ) );
+ break;
+ }
+ case XFILL_BITMAP:
+ {
+ Bitmap aBitmap(((const XFillBitmapItem&)rObj.GetMergedItem(XATTR_FILLBITMAP)).GetBitmapValue().GetBitmap());
+ if ( nColorCount )
+ {
+ aBitmap.Adjust(
+ static_cast< short > ( GetLuminanceChange(
+ std::min(nColorIndex, nColorCount-1))));
+ }
+
+ rObj.SetMergedItem( XFillBitmapItem( String(), aBitmap ) );
+ break;
+ }
+ }
+
+ if ( nColorIndex < nColorCount )
+ nColorIndex++;
+ }
+}
+
+SdrObject* EnhancedCustomShape2d::CreatePathObj( sal_Bool bLineGeometryNeededOnly )
+{
+ sal_Int32 nCoordSize = seqCoordinates.getLength();
+ if ( !nCoordSize )
+ return NULL;
+
+ sal_uInt16 nSrcPt = 0;
+ sal_uInt16 nSegmentInd = 0;
+
+ std::vector< SdrPathObj* > vObjectList;
+ sal_Bool bSortFilledObjectsToBack = SortFilledObjectsToBackByDefault( eSpType );
+
+ while( nSegmentInd <= seqSegments.getLength() )
+ {
+ CreateSubPath( nSrcPt, nSegmentInd, vObjectList, bLineGeometryNeededOnly, bSortFilledObjectsToBack );
+ }
+
+ SdrObject* pRet = NULL;
+ sal_uInt32 i;
+
+ if ( vObjectList.size() )
+ {
+ const SfxItemSet& rCustomShapeSet = pCustomShapeObj->GetMergedItemSet();
+ Color aFillColor;
+ sal_uInt32 nColorCount = nColorData >> 28;
+ sal_uInt32 nColorIndex = 0;
+
+ // #i37011# remove invisible objects
+ if(vObjectList.size())
+ {
+ std::vector< SdrPathObj* > vTempList;
+
+ for(i = 0L; i < vObjectList.size(); i++)
+ {
+ SdrPathObj* pObj(vObjectList[i]);
+ const XLineStyle eLineStyle = ((const XLineStyleItem&)pObj->GetMergedItem(XATTR_LINESTYLE)).GetValue();
+ const XFillStyle eFillStyle = ((const XFillStyleItem&)pObj->GetMergedItem(XATTR_FILLSTYLE)).GetValue();
+
+ //SJ: #i40600# if bLineGeometryNeededOnly is set linystyle does not matter
+ if( !bLineGeometryNeededOnly && ( XLINE_NONE == eLineStyle ) && ( XFILL_NONE == eFillStyle ) )
+ delete pObj;
+ else
+ vTempList.push_back(pObj);
+ }
+
+ vObjectList = vTempList;
+ }
+
+ if(1L == vObjectList.size())
+ {
+ // a single object, correct some values
+ AdaptObjColor(*vObjectList[0L],rCustomShapeSet,nColorIndex,nColorCount);
+ }
+ else
+ {
+ sal_Int32 nLineObjectCount = 0;
+ sal_Int32 nAreaObjectCount = 0;
+
+ // correct some values and collect content data
+ for ( i = 0; i < vObjectList.size(); i++ )
+ {
+ SdrPathObj* pObj( vObjectList[ i ] );
+
+ if(pObj->IsLine())
+ {
+ nLineObjectCount++;
+ }
+ else
+ {
+ nAreaObjectCount++;
+ AdaptObjColor(*pObj,rCustomShapeSet,nColorIndex,nColorCount);
+ }
+ }
+
+ // #i88870# correct line arrows for callouts
+ if ( nLineObjectCount )
+ CorrectCalloutArrows( eSpType, nLineObjectCount, vObjectList );
+
+ // sort objects so that filled ones are in front. Necessary
+ // for some strange objects
+ if ( bSortFilledObjectsToBack )
+ {
+ std::vector< SdrPathObj* > vTempList;
+
+ for ( i = 0; i < vObjectList.size(); i++ )
+ {
+ SdrPathObj* pObj( vObjectList[ i ] );
+
+ if ( !pObj->IsLine() )
+ {
+ vTempList.push_back(pObj);
+ }
+ }
+
+ for ( i = 0; i < vObjectList.size(); i++ )
+ {
+ SdrPathObj* pObj( vObjectList[ i ] );
+
+ if ( pObj->IsLine() )
+ {
+ vTempList.push_back(pObj);
+ }
+ }
+
+ vObjectList = vTempList;
+ }
+ }
+ }
+
+ // #i37011#
+ if(vObjectList.size())
+ {
+ // copy remaining objects to pRet
+ if(vObjectList.size() > 1L)
+ {
+ pRet = new SdrObjGroup;
+
+ for (i = 0L; i < vObjectList.size(); i++)
+ {
+ SdrObject* pObj(vObjectList[i]);
+ pRet->GetSubList()->NbcInsertObject(pObj);
+ }
+ }
+ else if(1L == vObjectList.size())
+ {
+ pRet = vObjectList[0L];
+ }
+
+ if(pRet)
+ {
+ // move to target position
+ Rectangle aCurRect(pRet->GetSnapRect());
+ aCurRect.Move(aLogicRect.Left(), aLogicRect.Top());
+ pRet->NbcSetSnapRect(aCurRect);
+ }
+ }
+
+ return pRet;
+}
+
+SdrObject* EnhancedCustomShape2d::CreateObject( sal_Bool bLineGeometryNeededOnly )
+{
+ SdrObject* pRet = NULL;
+
+ if ( eSpType == mso_sptRectangle )
+ {
+ pRet = new SdrRectObj( aLogicRect );
+// SJ: not setting model, so we save a lot of broadcasting and the model is not modified any longer
+// pRet->SetModel( pCustomShapeObj->GetModel() );
+ pRet->SetMergedItemSet( *this );
+ }
+ if ( !pRet )
+ pRet = CreatePathObj( bLineGeometryNeededOnly );
+
+ return pRet;
+}
+
+void EnhancedCustomShape2d::ApplyGluePoints( SdrObject* pObj )
+{
+ if ( pObj && seqGluePoints.getLength() )
+ {
+ sal_uInt32 i, nCount = seqGluePoints.getLength();
+ for ( i = 0; i < nCount; i++ )
+ {
+ SdrGluePoint aGluePoint;
+
+ 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();
+ if( pList )
+ /* sal_uInt16 nId = */ pList->Insert( aGluePoint );
+ }
+ }
+}
+
+SdrObject* EnhancedCustomShape2d::CreateLineGeometry()
+{
+ return CreateObject( sal_True );
+}
+
+
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx
new file mode 100644
index 000000000000..0781ade6c97a
--- /dev/null
+++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx
@@ -0,0 +1,752 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "EnhancedCustomShape3d.hxx"
+#include <svx/svdetc.hxx>
+#include <svx/svdmodel.hxx>
+#include <tools/poly.hxx>
+#include <svx/svditer.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdoashp.hxx>
+#include <svl/poolitem.hxx>
+#include <svl/itemset.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xsflclit.hxx>
+#include <svx/xit.hxx>
+#include <svx/xbtmpit.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/polysc3d.hxx>
+#include <svx/svddef.hxx>
+#include <svx/svx3ditems.hxx>
+#include <svx/extrud3d.hxx>
+#include <svx/xflbmtit.hxx>
+#include <vcl/svapp.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/sdasitm.hxx>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/drawing/Position3D.hpp>
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <svx/sdr/properties/properties.hxx>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <basegfx/range/b2drange.hxx>
+
+#define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+const rtl::OUString sExtrusion( RTL_CONSTASCII_USTRINGPARAM ( "Extrusion" ) );
+
+void GetOrigin( SdrCustomShapeGeometryItem& rItem, double& rOriginX, double& rOriginY )
+{
+ ::com::sun::star::drawing::EnhancedCustomShapeParameterPair aOriginParaPair;
+ const rtl::OUString sOrigin( RTL_CONSTASCII_USTRINGPARAM ( "Origin" ) );
+ Any* pAny = rItem.GetPropertyValueByName( sExtrusion, sOrigin );
+ if ( ! ( pAny && ( *pAny >>= aOriginParaPair ) && ( aOriginParaPair.First.Value >>= rOriginX ) && ( aOriginParaPair.Second.Value >>= rOriginY ) ) )
+ {
+ rOriginX = 0.50;
+ rOriginY =-0.50;
+ }
+}
+
+void GetRotateAngle( SdrCustomShapeGeometryItem& rItem, double& rAngleX, double& rAngleY )
+{
+ ::com::sun::star::drawing::EnhancedCustomShapeParameterPair aRotateAngleParaPair;
+ const rtl::OUString sRotateAngle( RTL_CONSTASCII_USTRINGPARAM ( "RotateAngle" ) );
+ Any* pAny = rItem.GetPropertyValueByName( sExtrusion, sRotateAngle );
+ if ( ! ( pAny && ( *pAny >>= aRotateAngleParaPair ) && ( aRotateAngleParaPair.First.Value >>= rAngleX ) && ( aRotateAngleParaPair.Second.Value >>= rAngleY ) ) )
+ {
+ rAngleX = 0.0;
+ rAngleY = 0.0;
+ }
+ rAngleX *= F_PI180;
+ rAngleY *= F_PI180;
+}
+
+void GetSkew( SdrCustomShapeGeometryItem& rItem, double& rSkewAmount, double& rSkewAngle )
+{
+ ::com::sun::star::drawing::EnhancedCustomShapeParameterPair aSkewParaPair;
+ const rtl::OUString sSkew( RTL_CONSTASCII_USTRINGPARAM ( "Skew" ) );
+ Any* pAny = rItem.GetPropertyValueByName( sExtrusion, sSkew );
+ if ( ! ( pAny && ( *pAny >>= aSkewParaPair ) && ( aSkewParaPair.First.Value >>= rSkewAmount ) && ( aSkewParaPair.Second.Value >>= rSkewAngle ) ) )
+ {
+ rSkewAmount = 50;
+ rSkewAngle = -135;
+ }
+ rSkewAngle *= F_PI180;
+}
+
+void GetExtrusionDepth( SdrCustomShapeGeometryItem& rItem, const double* pMap, double& rBackwardDepth, double& rForwardDepth )
+{
+ ::com::sun::star::drawing::EnhancedCustomShapeParameterPair aDepthParaPair;
+ double fDepth = 0, fFraction = 0;
+ const rtl::OUString sDepth( RTL_CONSTASCII_USTRINGPARAM ( "Depth" ) );
+ Any* pAny = rItem.GetPropertyValueByName( sExtrusion, sDepth );
+ if ( pAny && ( *pAny >>= aDepthParaPair ) && ( aDepthParaPair.First.Value >>= fDepth ) && ( aDepthParaPair.Second.Value >>= fFraction ) )
+ {
+ rForwardDepth = fDepth * fFraction;
+ rBackwardDepth = fDepth - rForwardDepth;
+ }
+ else
+ {
+ rBackwardDepth = 1270;
+ rForwardDepth = 0;
+ }
+ if ( pMap )
+ {
+ double fMap = *pMap;
+ rBackwardDepth *= fMap;
+ rForwardDepth *= fMap;
+ }
+}
+
+double GetDouble( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPropertyName, double fDefault, const double* pMap )
+{
+ double fRetValue = fDefault;
+ Any* pAny = rItem.GetPropertyValueByName( sExtrusion, rPropertyName );
+ if ( pAny )
+ *pAny >>= fRetValue;
+ if ( pMap )
+ fRetValue *= *pMap;
+ return fRetValue;
+}
+
+drawing::ShadeMode GetShadeMode( SdrCustomShapeGeometryItem& rItem, const drawing::ShadeMode eDefault )
+{
+ drawing::ShadeMode eRet( eDefault );
+ const rtl::OUString sShadeMode( RTL_CONSTASCII_USTRINGPARAM ( "ShadeMode" ) );
+ Any* pAny = rItem.GetPropertyValueByName( sExtrusion, sShadeMode );
+ if ( pAny )
+ *pAny >>= eRet;
+ return eRet;
+}
+
+sal_Int32 GetInt32( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPropertyName, const sal_Int32 nDefault )
+{
+ sal_Int32 nRetValue = nDefault;
+ Any* pAny = rItem.GetPropertyValueByName( sExtrusion, rPropertyName );
+ if ( pAny )
+ *pAny >>= nRetValue;
+ return nRetValue;
+}
+
+sal_Bool GetBool( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPropertyName, const sal_Bool bDefault )
+{
+ sal_Bool bRetValue = bDefault;
+ const Any* pAny = rItem.GetPropertyValueByName( sExtrusion, rPropertyName );
+ if ( pAny )
+ *pAny >>= bRetValue;
+ return bRetValue;
+}
+
+awt::Point GetPoint( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPropertyName, const awt::Point& rDefault )
+{
+ awt::Point aRetValue( rDefault );
+ const Any* pAny = rItem.GetPropertyValueByName( sExtrusion, rPropertyName );
+ if ( pAny )
+ *pAny >>= aRetValue;
+ return aRetValue;
+}
+
+drawing::Position3D GetPosition3D( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPropertyName,
+ const drawing::Position3D& rDefault, const double* pMap )
+{
+ drawing::Position3D aRetValue( rDefault );
+ const Any* pAny = rItem.GetPropertyValueByName( sExtrusion, rPropertyName );
+ if ( pAny )
+ *pAny >>= aRetValue;
+ if ( pMap )
+ {
+ aRetValue.PositionX *= *pMap;
+ aRetValue.PositionY *= *pMap;
+ aRetValue.PositionZ *= *pMap;
+ }
+ return aRetValue;
+}
+
+drawing::Direction3D GetDirection3D( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPropertyName, const drawing::Direction3D& rDefault )
+{
+ drawing::Direction3D aRetValue( rDefault );
+ const Any* pAny = rItem.GetPropertyValueByName( sExtrusion, rPropertyName );
+ if ( pAny )
+ *pAny >>= aRetValue;
+ return aRetValue;
+}
+
+EnhancedCustomShape3d::Transformation2D::Transformation2D( const SdrObject* pCustomShape, const Rectangle& /*rBoundRect*/, const double *pM )
+: aCenter( pCustomShape->GetSnapRect().Center() )
+, eProjectionMode( drawing::ProjectionMode_PARALLEL )
+, pMap( pM )
+{
+ SdrCustomShapeGeometryItem& rGeometryItem = (SdrCustomShapeGeometryItem&)pCustomShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
+ const rtl::OUString sProjectionMode( RTL_CONSTASCII_USTRINGPARAM ( "ProjectionMode" ) );
+ Any* pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, sProjectionMode );
+ if ( pAny )
+ *pAny >>= eProjectionMode;
+
+ if ( eProjectionMode == drawing::ProjectionMode_PARALLEL )
+ GetSkew( rGeometryItem, fSkew, fSkewAngle );
+ else
+ {
+ fZScreen = 0.0;
+ GetOrigin( rGeometryItem, fOriginX, fOriginY );
+ fOriginX = fOriginX * pCustomShape->GetLogicRect().GetWidth();
+ fOriginY = fOriginY * pCustomShape->GetLogicRect().GetHeight();
+
+ const rtl::OUString sViewPoint( RTL_CONSTASCII_USTRINGPARAM ( "ViewPoint" ) );
+ drawing::Position3D aViewPointDefault( 3472, -3472, 25000 );
+ drawing::Position3D aViewPoint( GetPosition3D( rGeometryItem, sViewPoint, aViewPointDefault, pMap ) );
+ fViewPoint.setX(aViewPoint.PositionX);
+ fViewPoint.setY(aViewPoint.PositionY);
+ fViewPoint.setZ(-aViewPoint.PositionZ);
+ }
+}
+
+basegfx::B3DPolygon EnhancedCustomShape3d::Transformation2D::ApplySkewSettings( const basegfx::B3DPolygon& rPoly3D ) const
+{
+ basegfx::B3DPolygon aRetval;
+
+ sal_uInt32 j;
+ for ( j = 0L; j < rPoly3D.count(); j++ )
+ {
+ const basegfx::B3DPoint aPoint(rPoly3D.getB3DPoint(j));
+ double fDepth(-( aPoint.getZ() * fSkew ) / 100.0);
+ aRetval.append(basegfx::B3DPoint(
+ aPoint.getX() + (fDepth * cos( fSkewAngle )),
+ aPoint.getY() - (fDepth * sin( fSkewAngle )),
+ aPoint.getZ()));
+ }
+
+ return aRetval;
+}
+
+Point EnhancedCustomShape3d::Transformation2D::Transform2D( const basegfx::B3DPoint& rPoint3D ) const
+{
+ Point aPoint2D;
+ if ( eProjectionMode == drawing::ProjectionMode_PARALLEL )
+ {
+ aPoint2D.X() = (sal_Int32)rPoint3D.getX();
+ aPoint2D.Y() = (sal_Int32)rPoint3D.getY();
+ }
+ else
+ {
+ double fX = rPoint3D.getX() - fOriginX;
+ double fY = rPoint3D.getY() - fOriginY;
+ double f = ( fZScreen - fViewPoint.getZ() ) / ( rPoint3D.getZ() - fViewPoint.getZ() );
+ aPoint2D.X() = (sal_Int32)(( fX - fViewPoint.getX() ) * f + fViewPoint.getX() + fOriginX );
+ aPoint2D.Y() = (sal_Int32)(( fY - fViewPoint.getY() ) * f + fViewPoint.getY() + fOriginY );
+ }
+ aPoint2D.Move( aCenter.X(), aCenter.Y() );
+ return aPoint2D;
+}
+
+sal_Bool EnhancedCustomShape3d::Transformation2D::IsParallel() const
+{
+ return eProjectionMode == com::sun::star::drawing::ProjectionMode_PARALLEL;
+}
+
+SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, const SdrObject* pCustomShape )
+{
+ SdrObject* pRet = NULL;
+ SdrModel* pModel = pCustomShape->GetModel();
+ SdrCustomShapeGeometryItem& rGeometryItem = (SdrCustomShapeGeometryItem&)pCustomShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
+
+ double fMap, *pMap = NULL;
+ if ( pModel )
+ {
+ fMap = 1.0;
+ Fraction aFraction( pModel->GetScaleFraction() );
+ if ( ( aFraction.GetNumerator() ) != 1 || ( aFraction.GetDenominator() != 1 ) )
+ {
+ fMap *= aFraction.GetNumerator();
+ fMap /= aFraction.GetDenominator();
+ pMap = &fMap;
+ }
+ if ( pModel->GetScaleUnit() != MAP_100TH_MM )
+ {
+ DBG_ASSERT( pModel->GetScaleUnit() == MAP_TWIP, "EnhancedCustomShape3d::Current MapMode is Unsupported" );
+ fMap *= 1440.0 / 2540.0;
+ pMap = &fMap;
+ }
+ }
+ if ( GetBool( rGeometryItem, sExtrusion, sal_False ) )
+ {
+ sal_Bool bIsMirroredX = ((SdrObjCustomShape*)pCustomShape)->IsMirroredX();
+ sal_Bool bIsMirroredY = ((SdrObjCustomShape*)pCustomShape)->IsMirroredY();
+ Rectangle aSnapRect( pCustomShape->GetLogicRect() );
+ long nObjectRotation = pCustomShape->GetRotateAngle();
+ if ( nObjectRotation )
+ {
+ double a = ( 36000 - nObjectRotation ) * nPi180;
+ long dx = aSnapRect.Right() - aSnapRect.Left();
+ long dy = aSnapRect.Bottom()- aSnapRect.Top();
+ Point aP( aSnapRect.TopLeft() );
+ RotatePoint( aP, pCustomShape->GetSnapRect().Center(), sin( a ), cos( a ) );
+ aSnapRect.Left() = aP.X();
+ aSnapRect.Top() = aP.Y();
+ aSnapRect.Right() = aSnapRect.Left() + dx;
+ aSnapRect.Bottom() = aSnapRect.Top() + dy;
+ }
+ Point aCenter( aSnapRect.Center() );
+
+ SfxItemSet aSet( pCustomShape->GetMergedItemSet() );
+
+ //SJ: vertical writing is not required, by removing this item no outliner is created
+ aSet.ClearItem( SDRATTR_TEXTDIRECTION );
+
+ // #i105323# For 3D AutoShapes, the shadow attribute has to be applied to each
+ // created visualisation helper model shape individually. The shadow itself
+ // will then be rendered from the 3D renderer correctly for the whole 3D scene
+ // (and thus behind all objects of which the visualisation may be built). So,
+ // dio NOT remove it from the ItemSet here.
+ // aSet.ClearItem(SDRATTR_SHADOW);
+
+ std::vector< E3dCompoundObject* > aPlaceholderObjectList;
+
+ double fExtrusionBackward, fExtrusionForward;
+ GetExtrusionDepth( rGeometryItem, pMap, fExtrusionBackward, fExtrusionForward );
+ double fDepth = fExtrusionBackward - fExtrusionForward;
+ if ( fDepth < 1.0 )
+ fDepth = 1.0;
+
+ drawing::ProjectionMode eProjectionMode( drawing::ProjectionMode_PARALLEL );
+ const rtl::OUString sProjectionMode( RTL_CONSTASCII_USTRINGPARAM ( "ProjectionMode" ) );
+ Any* pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, sProjectionMode );
+ if ( pAny )
+ *pAny >>= eProjectionMode;
+ ProjectionType eProjectionType( eProjectionMode == drawing::ProjectionMode_PARALLEL ? PR_PARALLEL : PR_PERSPECTIVE );
+
+ // pShape2d Umwandeln in Szene mit 3D Objekt
+ E3dDefaultAttributes a3DDefaultAttr;
+ a3DDefaultAttr.SetDefaultLatheCharacterMode( sal_True );
+ a3DDefaultAttr.SetDefaultExtrudeCharacterMode( sal_True );
+
+ E3dScene* pScene = new E3dPolyScene( a3DDefaultAttr );
+
+ sal_Bool bSceneHasObjects ( sal_False );
+ sal_Bool bUseTwoFillStyles( sal_False );
+
+ drawing::ShadeMode eShadeMode( GetShadeMode( rGeometryItem, drawing::ShadeMode_FLAT ) );
+ const rtl::OUString sExtrusionColor( RTL_CONSTASCII_USTRINGPARAM ( "Color" ) );
+ sal_Bool bUseExtrusionColor = GetBool( rGeometryItem, sExtrusionColor, sal_False );
+
+ XFillStyle eFillStyle( ITEMVALUE( aSet, XATTR_FILLSTYLE, XFillStyleItem ) );
+ pScene->GetProperties().SetObjectItem( Svx3DShadeModeItem( 0 ) );
+ aSet.Put( Svx3DPercentDiagonalItem( 0 ) );
+ aSet.Put( Svx3DTextureModeItem( 1 ) );
+ aSet.Put( Svx3DNormalsKindItem( 1 ) );
+
+ if ( eShadeMode == drawing::ShadeMode_DRAFT )
+ {
+ aSet.Put( XLineStyleItem( XLINE_SOLID ) );
+ aSet.Put( XFillStyleItem ( XFILL_NONE ) );
+ aSet.Put( Svx3DDoubleSidedItem( sal_True ) );
+ }
+ else
+ {
+ aSet.Put( XLineStyleItem( XLINE_NONE ) );
+ if ( eFillStyle == XFILL_NONE )
+ aSet.Put( XFillStyleItem( XFILL_SOLID ) );
+ else if ( ( eFillStyle == XFILL_BITMAP ) || ( eFillStyle == XFILL_GRADIENT ) || bUseExtrusionColor )
+ bUseTwoFillStyles = sal_True;
+
+ // #116336#
+ // If shapes are mirrored once (mirroring two times correct geometry again)
+ // double-sided at the object and two-sided-lighting at the scene need to be set.
+ if((bIsMirroredX && !bIsMirroredY) || (!bIsMirroredX && bIsMirroredY))
+ {
+ aSet.Put( Svx3DDoubleSidedItem( sal_True ) );
+ pScene->GetProperties().SetObjectItem( Svx3DTwoSidedLightingItem( sal_True ) );
+ }
+ }
+
+ Rectangle aBoundRect2d;
+ SdrObjListIter aIter( *pShape2d, IM_DEEPWITHGROUPS );
+ while( aIter.IsMore() )
+ {
+ const SdrObject* pNext = aIter.Next();
+ sal_Bool bIsPlaceholderObject = (((XFillStyleItem&)pNext->GetMergedItem( XATTR_FILLSTYLE )).GetValue() == XFILL_NONE )
+ && (((XLineStyleItem&)pNext->GetMergedItem( XATTR_LINESTYLE )).GetValue() == XLINE_NONE );
+ basegfx::B2DPolyPolygon aPolyPoly;
+
+ if ( pNext->ISA( SdrPathObj ) )
+ {
+ aPolyPoly = ((SdrPathObj*)pNext)->GetPathPoly();
+
+ if(aPolyPoly.areControlPointsUsed())
+ {
+ aPolyPoly = basegfx::tools::adaptiveSubdivideByAngle(aPolyPoly);
+ }
+ }
+ else
+ {
+ SdrObject* pNewObj = pNext->ConvertToPolyObj( sal_False, sal_False );
+ SdrPathObj* pPath = PTR_CAST( SdrPathObj, pNewObj );
+ if ( pPath )
+ aPolyPoly = pPath->GetPathPoly();
+ SdrObject::Free( pNewObj );
+ }
+
+ if( aPolyPoly.count() )
+ {
+ const basegfx::B2DRange aTempRange(basegfx::tools::getRange(aPolyPoly));
+ const Rectangle aBoundRect(basegfx::fround(aTempRange.getMinX()), basegfx::fround(aTempRange.getMinY()), basegfx::fround(aTempRange.getMaxX()), basegfx::fround(aTempRange.getMaxY()));
+ aBoundRect2d.Union( aBoundRect );
+
+ E3dCompoundObject* p3DObj = new E3dExtrudeObj( a3DDefaultAttr, aPolyPoly, bUseTwoFillStyles ? 10 : fDepth );
+ p3DObj->NbcSetLayer( pShape2d->GetLayer() );
+ p3DObj->SetMergedItemSet( aSet );
+ if ( bIsPlaceholderObject )
+ aPlaceholderObjectList.push_back( p3DObj );
+ else if ( bUseTwoFillStyles )
+ {
+ Bitmap aFillBmp;
+ sal_Bool bFillBmpTile = ((XFillBmpTileItem&)p3DObj->GetMergedItem( XATTR_FILLBMP_TILE )).GetValue();
+ if ( bFillBmpTile )
+ {
+ const XFillBitmapItem& rBmpItm = (XFillBitmapItem&)p3DObj->GetMergedItem( XATTR_FILLBITMAP );
+ const XOBitmap& rXOBmp = rBmpItm.GetBitmapValue();
+ aFillBmp = rXOBmp.GetBitmap();
+ Size aLogicalSize = aFillBmp.GetPrefSize();
+ if ( aFillBmp.GetPrefMapMode() == MAP_PIXEL )
+ aLogicalSize = Application::GetDefaultDevice()->PixelToLogic( aLogicalSize, MAP_100TH_MM );
+ else
+ aLogicalSize = OutputDevice::LogicToLogic( aLogicalSize, aFillBmp.GetPrefMapMode(), MAP_100TH_MM );
+ aLogicalSize.Width() *= 5; ;// :-( nice scaling, look at engine3d/obj3d.cxx
+ aLogicalSize.Height() *= 5;
+ aFillBmp.SetPrefSize( aLogicalSize );
+ aFillBmp.SetPrefMapMode( MAP_100TH_MM );
+ p3DObj->SetMergedItem( XFillBitmapItem( String(), aFillBmp ) );
+ }
+ else
+ {
+ if ( aSnapRect != aBoundRect )
+ {
+ const XFillBitmapItem& rBmpItm = (XFillBitmapItem&)p3DObj->GetMergedItem( XATTR_FILLBITMAP );
+ const XOBitmap& rXOBmp = rBmpItm.GetBitmapValue();
+ aFillBmp = rXOBmp.GetBitmap();
+ Size aBmpSize( aFillBmp.GetSizePixel() );
+ double fXScale = (double)aBoundRect.GetWidth() / (double)aSnapRect.GetWidth();
+ double fYScale = (double)aBoundRect.GetHeight() / (double)aSnapRect.GetHeight();
+
+ Point aPt( (sal_Int32)( (double)( aBoundRect.Left() - aSnapRect.Left() )* (double)aBmpSize.Width() / (double)aSnapRect.GetWidth() ),
+ (sal_Int32)( (double)( aBoundRect.Top() - aSnapRect.Top() ) * (double)aBmpSize.Height() / (double)aSnapRect.GetHeight() ) );
+ Size aSize( (sal_Int32)( aBmpSize.Width() * fXScale ),
+ (sal_Int32)( aBmpSize.Height() * fYScale ) );
+ Rectangle aCropRect( aPt, aSize );
+ aFillBmp.Crop( aCropRect );
+ p3DObj->SetMergedItem( XFillBitmapItem( String(), aFillBmp ) );
+ }
+ }
+ pScene->Insert3DObj( p3DObj );
+ p3DObj = new E3dExtrudeObj( a3DDefaultAttr, aPolyPoly, fDepth );
+ p3DObj->NbcSetLayer( pShape2d->GetLayer() );
+ p3DObj->SetMergedItemSet( aSet );
+ if ( bUseExtrusionColor )
+ p3DObj->SetMergedItem( XFillColorItem( String(), ((XSecondaryFillColorItem&)pCustomShape->GetMergedItem( XATTR_SECONDARYFILLCOLOR )).GetColorValue() ) );
+ p3DObj->SetMergedItem( XFillStyleItem( XFILL_SOLID ) );
+ p3DObj->SetMergedItem( Svx3DCloseFrontItem( sal_False ) );
+ p3DObj->SetMergedItem( Svx3DCloseBackItem( sal_False ) );
+ pScene->Insert3DObj( p3DObj );
+ p3DObj = new E3dExtrudeObj( a3DDefaultAttr, aPolyPoly, 10 );
+ p3DObj->NbcSetLayer( pShape2d->GetLayer() );
+ p3DObj->SetMergedItemSet( aSet );
+
+ basegfx::B3DHomMatrix aFrontTransform( p3DObj->GetTransform() );
+ aFrontTransform.translate( 0.0, 0.0, fDepth );
+ p3DObj->NbcSetTransform( aFrontTransform );
+
+ if ( ( eFillStyle == XFILL_BITMAP ) && !aFillBmp.IsEmpty() )
+ p3DObj->SetMergedItem( XFillBitmapItem( String(), aFillBmp ) );
+ }
+ else if ( eFillStyle == XFILL_NONE )
+ {
+ XLineColorItem& rLineColor = (XLineColorItem&)p3DObj->GetMergedItem( XATTR_LINECOLOR );
+ p3DObj->SetMergedItem( XFillColorItem( String(), rLineColor.GetColorValue() ) );
+ p3DObj->SetMergedItem( Svx3DDoubleSidedItem( sal_True ) );
+ p3DObj->SetMergedItem( Svx3DCloseFrontItem( sal_False ) );
+ p3DObj->SetMergedItem( Svx3DCloseBackItem( sal_False ) );
+ }
+ pScene->Insert3DObj( p3DObj );
+ bSceneHasObjects = sal_True;
+ }
+ }
+
+ if ( bSceneHasObjects ) // is the SdrObject properly converted
+ {
+ // then we can change the return value
+ pRet = pScene;
+
+ // Kameraeinstellungen, Perspektive ...
+ Camera3D& rCamera = (Camera3D&)pScene->GetCamera();
+ const basegfx::B3DRange& rVolume = pScene->GetBoundVolume();
+ pScene->NbcSetSnapRect( aSnapRect );
+
+ // InitScene replacement
+ double fW = rVolume.getWidth();
+ double fH = rVolume.getHeight();
+
+ rCamera.SetAutoAdjustProjection( sal_False );
+ rCamera.SetViewWindow( -fW / 2, - fH / 2, fW, fH);
+ basegfx::B3DPoint aLookAt( 0.0, 0.0, 0.0 );
+ basegfx::B3DPoint aCamPos( 0.0, 0.0, 100.0 );
+ rCamera.SetDefaults( basegfx::B3DPoint( 0.0, 0.0, 100.0 ), aLookAt, 100.0 );
+ rCamera.SetPosAndLookAt( aCamPos, aLookAt );
+ rCamera.SetFocalLength( 1.0 );
+ rCamera.SetProjection( eProjectionType );
+ pScene->SetCamera( rCamera );
+ pScene->SetRectsDirty();
+
+ double fOriginX, fOriginY;
+ GetOrigin( rGeometryItem, fOriginX, fOriginY );
+ fOriginX = fOriginX * aSnapRect.GetWidth();
+ fOriginY = fOriginY * aSnapRect.GetHeight();
+
+ basegfx::B3DHomMatrix aNewTransform( pScene->GetTransform() );
+ aNewTransform.translate( -aCenter.X(), aCenter.Y(), -pScene->GetBoundVolume().getDepth() );
+
+ double fXRotate, fYRotate;
+ GetRotateAngle( rGeometryItem, fXRotate, fYRotate );
+ double fZRotate = ((SdrObjCustomShape*)pCustomShape)->GetObjectRotation() * F_PI180;
+ if ( fZRotate != 0.0 )
+ aNewTransform.rotate( 0.0, 0.0, fZRotate );
+ if ( bIsMirroredX )
+ aNewTransform.scale( -1.0, 1, 1 );
+ if ( bIsMirroredY )
+ aNewTransform.scale( 1, -1.0, 1 );
+ if( fYRotate != 0.0 )
+ aNewTransform.rotate( 0.0, -fYRotate, 0.0 );
+ if( fXRotate != 0.0 )
+ aNewTransform.rotate( -fXRotate, 0.0, 0.0 );
+ if ( eProjectionType == PR_PARALLEL )
+ {
+ double fSkew, fAlpha;
+ GetSkew( rGeometryItem, fSkew, fAlpha );
+ if ( fSkew != 0.0 )
+ {
+ double fInvTanBeta( fSkew / 100.0 );
+ if(fInvTanBeta)
+ {
+ aNewTransform.shearXY(
+ fInvTanBeta * cos(fAlpha),
+ fInvTanBeta * sin(fAlpha));
+ }
+ }
+ basegfx::B3DPoint _aLookAt( 0.0, 0.0, 0.0 );
+ basegfx::B3DPoint _aNewCamPos( 0.0, 0.0, 25000.0 );
+ rCamera.SetPosAndLookAt( _aNewCamPos, _aLookAt );
+ pScene->SetCamera( rCamera );
+ }
+ else
+ {
+ aNewTransform.translate( -fOriginX, fOriginY, 0.0 );
+ // now set correct camera position
+ const rtl::OUString sViewPoint( RTL_CONSTASCII_USTRINGPARAM ( "ViewPoint" ) );
+ drawing::Position3D aViewPointDefault( 3472, -3472, 25000 );
+ drawing::Position3D aViewPoint( GetPosition3D( rGeometryItem, sViewPoint, aViewPointDefault, pMap ) );
+ double fViewPointX = aViewPoint.PositionX;
+ double fViewPointY = aViewPoint.PositionY;
+ double fViewPointZ = aViewPoint.PositionZ;
+ basegfx::B3DPoint _aLookAt( fViewPointX, -fViewPointY, 0.0 );
+ basegfx::B3DPoint aNewCamPos( fViewPointX, -fViewPointY, fViewPointZ );
+ rCamera.SetPosAndLookAt( aNewCamPos, _aLookAt );
+ pScene->SetCamera( rCamera );
+ }
+
+ pScene->NbcSetTransform( aNewTransform );
+
+ ///////////
+ // light //
+ ///////////
+
+ const rtl::OUString sBrightness( RTL_CONSTASCII_USTRINGPARAM ( "Brightness" ) );
+ double fAmbientIntensity = GetDouble( rGeometryItem, sBrightness, 22178.0 / 655.36, NULL ) / 100.0;
+
+
+ const rtl::OUString sFirstLightDirection( RTL_CONSTASCII_USTRINGPARAM ( "FirstLightDirection" ) );
+ drawing::Direction3D aFirstLightDirectionDefault( 50000, 0, 10000 );
+ drawing::Direction3D aFirstLightDirection( GetDirection3D( rGeometryItem, sFirstLightDirection, aFirstLightDirectionDefault ) );
+ if ( aFirstLightDirection.DirectionZ == 0.0 )
+ aFirstLightDirection.DirectionZ = 1.0;
+
+ const rtl::OUString sFirstLightLevel( RTL_CONSTASCII_USTRINGPARAM ( "FirstLightLevel" ) );
+ double fLightIntensity = GetDouble( rGeometryItem, sFirstLightLevel, 43712.0 / 655.36, NULL ) / 100.0;
+
+ const rtl::OUString sFirstLightHarsh( RTL_CONSTASCII_USTRINGPARAM ( "FirstLightHarsh" ) );
+ /* sal_Bool bFirstLightHarsh = */ GetBool( rGeometryItem, sFirstLightHarsh, sal_False );
+
+ const rtl::OUString sSecondLightDirection( RTL_CONSTASCII_USTRINGPARAM ( "SecondLightDirection" ) );
+ drawing::Direction3D aSecondLightDirectionDefault( -50000, 0, 10000 );
+ drawing::Direction3D aSecondLightDirection( GetDirection3D( rGeometryItem, sSecondLightDirection, aSecondLightDirectionDefault ) );
+ if ( aSecondLightDirection.DirectionZ == 0.0 )
+ aSecondLightDirection.DirectionZ = -1;
+
+ const rtl::OUString sSecondLightLevel( RTL_CONSTASCII_USTRINGPARAM ( "SecondLightLevel" ) );
+ double fLight2Intensity = GetDouble( rGeometryItem, sSecondLightLevel, 43712.0 / 655.36, NULL ) / 100.0;
+
+ const rtl::OUString sSecondLightHarsh( RTL_CONSTASCII_USTRINGPARAM ( "SecondLightHarsh" ) );
+ const rtl::OUString sLightFace( RTL_CONSTASCII_USTRINGPARAM ( "LightFace" ) );
+ /* sal_Bool bLight2Harsh = */ GetBool( rGeometryItem, sSecondLightHarsh, sal_False );
+ /* sal_Bool bLightFace = */ GetBool( rGeometryItem, sLightFace, sal_False );
+
+ sal_uInt16 nAmbientColor = (sal_uInt16)( fAmbientIntensity * 255.0 );
+ if ( nAmbientColor > 255 )
+ nAmbientColor = 255;
+ Color aGlobalAmbientColor( (sal_uInt8)nAmbientColor, (sal_uInt8)nAmbientColor, (sal_uInt8)nAmbientColor );
+ pScene->GetProperties().SetObjectItem( Svx3DAmbientcolorItem( aGlobalAmbientColor ) );
+
+ sal_uInt8 nSpotLight1 = (sal_uInt8)( fLightIntensity * 255.0 );
+ basegfx::B3DVector aSpotLight1( aFirstLightDirection.DirectionX, - ( aFirstLightDirection.DirectionY ), -( aFirstLightDirection.DirectionZ ) );
+ aSpotLight1.normalize();
+ pScene->GetProperties().SetObjectItem( Svx3DLightOnOff1Item( sal_True ) );
+ Color aAmbientSpot1Color( nSpotLight1, nSpotLight1, nSpotLight1 );
+ pScene->GetProperties().SetObjectItem( Svx3DLightcolor1Item( aAmbientSpot1Color ) );
+ pScene->GetProperties().SetObjectItem( Svx3DLightDirection1Item( aSpotLight1 ) );
+
+ sal_uInt8 nSpotLight2 = (sal_uInt8)( fLight2Intensity * 255.0 );
+ basegfx::B3DVector aSpotLight2( aSecondLightDirection.DirectionX, -aSecondLightDirection.DirectionY, -aSecondLightDirection.DirectionZ );
+ aSpotLight2.normalize();
+ pScene->GetProperties().SetObjectItem( Svx3DLightOnOff2Item( sal_True ) );
+ Color aAmbientSpot2Color( nSpotLight2, nSpotLight2, nSpotLight2 );
+ pScene->GetProperties().SetObjectItem( Svx3DLightcolor2Item( aAmbientSpot2Color ) );
+ pScene->GetProperties().SetObjectItem( Svx3DLightDirection2Item( aSpotLight2 ) );
+
+ sal_uInt8 nSpotLight3 = 70;
+ basegfx::B3DVector aSpotLight3( 0.0, 0.0, 1.0 );
+ pScene->GetProperties().SetObjectItem( Svx3DLightOnOff3Item( sal_True ) );
+ Color aAmbientSpot3Color( nSpotLight3, nSpotLight3, nSpotLight3 );
+ pScene->GetProperties().SetObjectItem( Svx3DLightcolor3Item( aAmbientSpot3Color ) );
+ pScene->GetProperties().SetObjectItem( Svx3DLightDirection3Item( aSpotLight3 ) );
+
+ const rtl::OUString sSpecularity( RTL_CONSTASCII_USTRINGPARAM ( "Specularity" ) );
+ const rtl::OUString sDiffusion( RTL_CONSTASCII_USTRINGPARAM ( "Diffusion" ) );
+ const rtl::OUString sShininess( RTL_CONSTASCII_USTRINGPARAM ( "Shininess" ) );
+ const rtl::OUString sMetal( RTL_CONSTASCII_USTRINGPARAM ( "Metal" ) );
+ double fSpecular = GetDouble( rGeometryItem, sSpecularity, 0, NULL ) / 100;
+ sal_Bool bMetal = GetBool( rGeometryItem, sMetal, sal_False );
+
+ Color aSpecularCol( 225,225,225 );
+ if ( bMetal )
+ {
+ aSpecularCol = Color( 200, 200, 200 );
+ fSpecular += 0.15;
+ }
+ sal_Int32 nIntensity = (sal_Int32)fSpecular * 100;
+ if ( nIntensity > 100 )
+ nIntensity = 100;
+ else if ( nIntensity < 0 )
+ nIntensity = 0;
+ nIntensity = 100 - nIntensity;
+ pScene->GetProperties().SetObjectItem( Svx3DMaterialSpecularItem( aSpecularCol ) );
+ pScene->GetProperties().SetObjectItem( Svx3DMaterialSpecularIntensityItem( (sal_uInt16)nIntensity ) );
+
+ pScene->SetLogicRect( CalculateNewSnapRect( pCustomShape, aSnapRect, aBoundRect2d, pMap ) );
+
+ // removing placeholder objects
+ std::vector< E3dCompoundObject* >::iterator aObjectListIter( aPlaceholderObjectList.begin() );
+ while ( aObjectListIter != aPlaceholderObjectList.end() )
+ {
+ pScene->Remove3DObj( *aObjectListIter );
+ delete *aObjectListIter++;
+ }
+ }
+ else
+ delete pScene;
+ }
+ return pRet;
+}
+
+Rectangle EnhancedCustomShape3d::CalculateNewSnapRect( const SdrObject* pCustomShape, const Rectangle& rSnapRect, const Rectangle& rBoundRect, const double* pMap )
+{
+ SdrCustomShapeGeometryItem& rGeometryItem = (SdrCustomShapeGeometryItem&)pCustomShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
+ const Point aCenter( rSnapRect.Center() );
+ double fExtrusionBackward, fExtrusionForward;
+ GetExtrusionDepth( rGeometryItem, pMap, fExtrusionBackward, fExtrusionForward );
+ sal_uInt32 i;
+
+ // creating initial bound volume ( without rotation. skewing.and camera )
+ basegfx::B3DPolygon aBoundVolume;
+ const Polygon aPolygon( rBoundRect );
+
+ for ( i = 0L; i < 4L; i++ )
+ {
+ aBoundVolume.append(basegfx::B3DPoint(aPolygon[ (sal_uInt16)i ].X() - aCenter.X(), aPolygon[ (sal_uInt16)i ].Y() - aCenter.Y(), fExtrusionForward));
+ }
+
+ for ( i = 0L; i < 4L; i++ )
+ {
+ aBoundVolume.append(basegfx::B3DPoint(aPolygon[ (sal_uInt16)i ].X() - aCenter.X(), aPolygon[ (sal_uInt16)i ].Y() - aCenter.Y(), fExtrusionBackward));
+ }
+
+ const rtl::OUString sRotationCenter( RTL_CONSTASCII_USTRINGPARAM ( "RotationCenter" ) );
+ drawing::Direction3D aRotationCenterDefault( 0, 0, 0 ); // default seems to be wrong, a fractional size of shape has to be used!!
+ drawing::Direction3D aRotationCenter( GetDirection3D( rGeometryItem, sRotationCenter, aRotationCenterDefault ) );
+
+ // double XCenterInGUnits = rPropSet.GetPropertyValue( DFF_Prop_c3DRotationCenterX, 0 );
+ // double YCenterInGUnits = rPropSet.GetPropertyValue( DFF_Prop_c3DRotationCenterY, 0 );
+
+ // sal_Int32 nRotationXAxisInProz = rPropSet.GetPropertyValue( DFF_Prop_c3DRotationAxisX, 100 );
+ // sal_Int32 nRotationYAxisInProz = rPropSet.GetPropertyValue( DFF_Prop_c3DRotationAxisY, 0 );
+ // sal_Int32 nRotationZAxisInProz = rPropSet.GetPropertyValue( DFF_Prop_c3DRotationAxisZ, 0 );
+
+
+ double fXRotate, fYRotate;
+ GetRotateAngle( rGeometryItem, fXRotate, fYRotate );
+ double fZRotate = - ((SdrObjCustomShape*)pCustomShape)->GetObjectRotation() * F_PI180;
+
+ // rotating bound volume
+ basegfx::B3DHomMatrix aMatrix;
+ aMatrix.translate(-aRotationCenter.DirectionX, -aRotationCenter.DirectionY, -aRotationCenter.DirectionZ);
+ if ( fZRotate != 0.0 )
+ aMatrix.rotate( 0.0, 0.0, fZRotate );
+ if ( ((SdrObjCustomShape*)pCustomShape)->IsMirroredX() )
+ aMatrix.scale( -1.0, 1, 1 );
+ if ( ((SdrObjCustomShape*)pCustomShape)->IsMirroredY() )
+ aMatrix.scale( 1, -1.0, 1 );
+ if( fYRotate != 0.0 )
+ aMatrix.rotate( 0.0, fYRotate, 0.0 );
+ if( fXRotate != 0.0 )
+ aMatrix.rotate( -fXRotate, 0.0, 0.0 );
+ aMatrix.translate(aRotationCenter.DirectionX, aRotationCenter.DirectionY, aRotationCenter.DirectionZ);
+ aBoundVolume.transform(aMatrix);
+
+ Transformation2D aTransformation2D( pCustomShape, rSnapRect, pMap );
+ if ( aTransformation2D.IsParallel() )
+ aBoundVolume = aTransformation2D.ApplySkewSettings( aBoundVolume );
+
+ Polygon aTransformed( 8 );
+ for ( i = 0L; i < 8L; i++ )
+ aTransformed[ (sal_uInt16)i ] = aTransformation2D.Transform2D( aBoundVolume.getB3DPoint( i ) );
+
+ return aTransformed.GetBoundRect();
+}
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.hxx b/svx/source/customshapes/EnhancedCustomShape3d.hxx
new file mode 100644
index 000000000000..a9dbf8882340
--- /dev/null
+++ b/svx/source/customshapes/EnhancedCustomShape3d.hxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ENHANCEDCUSTOMSHAPE3D_HXX
+#define _ENHANCEDCUSTOMSHAPE3D_HXX
+
+#include <vector>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <basegfx/point/b3dpoint.hxx>
+#include <basegfx/polygon/b3dpolygon.hxx>
+
+#include <tools/gen.hxx>
+
+class SdrObject;
+
+class EnhancedCustomShape3d
+{
+ class Transformation2D
+ {
+ Point aCenter;
+ com::sun::star::drawing::ProjectionMode eProjectionMode;
+
+ // parallel projection
+ double fSkewAngle;
+ double fSkew; // in percent
+
+ // perspective projection
+ double fZScreen;
+ basegfx::B3DPoint fViewPoint;
+ double fOriginX;
+ double fOriginY;
+
+ const double* pMap;
+
+ public :
+
+ Transformation2D( const SdrObject* pCustomShape, const Rectangle& rBoundRect, const double* pMap );
+
+ basegfx::B3DPolygon ApplySkewSettings( const basegfx::B3DPolygon& rPolygon3D ) const;
+ Point Transform2D( const basegfx::B3DPoint& rPoint ) const;
+ sal_Bool IsParallel() const;
+ };
+
+ friend class Transformation2D;
+
+ protected :
+ static Rectangle CalculateNewSnapRect( const SdrObject* pCustomShape, const Rectangle& rSnapRect, const Rectangle& rBoundRect, const double* pMap );
+
+ public :
+ static SdrObject* Create3DObject( const SdrObject* pShape2d, const SdrObject* pCustomShape );
+};
+
+#endif
+
diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
new file mode 100644
index 000000000000..c20360db7c4b
--- /dev/null
+++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
@@ -0,0 +1,471 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "EnhancedCustomShapeEngine.hxx"
+#include "svx/EnhancedCustomShape2d.hxx"
+#include "EnhancedCustomShape3d.hxx"
+#include "EnhancedCustomShapeFontWork.hxx"
+#include "EnhancedCustomShapeHandle.hxx"
+#include "svx/EnhancedCustomShapeGeometry.hxx"
+#include <svx/unoshape.hxx>
+#ifndef _SVX_UNOPAGE_HXX
+#include "svx/unopage.hxx"
+#endif
+#include "svx/unoapi.hxx"
+#include <svx/svdobj.hxx>
+#include <svx/svdoashp.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdorect.hxx>
+#include <editeng/outlobj.hxx>
+#include <editeng/outliner.hxx>
+#include <svx/svdoutl.hxx>
+#include <svl/itemset.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdmodel.hxx>
+#include "svx/svditer.hxx"
+#include "unopolyhelper.hxx"
+#include <uno/mapping.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <com/sun/star/document/XActionLockable.hpp>
+
+// ---------------------------
+// - EnhancedCustomShapeEngine -
+// ---------------------------
+
+rtl::OUString EnhancedCustomShapeEngine_getImplementationName()
+ throw( NMSP_UNO::RuntimeException )
+{
+ return B2UCONST( "com.sun.star.drawing.EnhancedCustomShapeEngine" );
+}
+sal_Bool SAL_CALL EnhancedCustomShapeEngine_supportsService( const rtl::OUString& ServiceName )
+ throw( NMSP_UNO::RuntimeException )
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.CustomShapeEngine" ) );
+}
+SEQ( rtl::OUString ) SAL_CALL EnhancedCustomShapeEngine_getSupportedServiceNames()
+ throw( NMSP_UNO::RuntimeException )
+{
+ SEQ( rtl::OUString ) aRet(1);
+ rtl::OUString* pArray = aRet.getArray();
+ pArray[0] = B2UCONST( "com.sun.star.drawing.CustomShapeEngine" );
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+EnhancedCustomShapeEngine::EnhancedCustomShapeEngine( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr ) :
+ mxFact ( rxMgr ),
+ mbForceGroupWithText ( sal_False )
+{
+}
+EnhancedCustomShapeEngine::~EnhancedCustomShapeEngine()
+{
+}
+
+// XInterface -----------------------------------------------------------------
+
+void SAL_CALL EnhancedCustomShapeEngine::acquire() throw()
+{
+ OWeakObject::acquire();
+}
+void SAL_CALL EnhancedCustomShapeEngine::release() throw()
+{
+ OWeakObject::release();
+}
+
+// XInitialization ------------------------------------------------------------
+
+void SAL_CALL EnhancedCustomShapeEngine::initialize( const SEQ( NMSP_UNO::Any )& aArguments )
+ throw ( NMSP_UNO::Exception, NMSP_UNO::RuntimeException )
+{
+ sal_Int32 i;
+ SEQ( NMSP_BEANS::PropertyValue ) aParameter;
+ for ( i = 0; i < aArguments.getLength(); i++ )
+ {
+ if ( aArguments[ i ] >>= aParameter )
+ break;
+ }
+ for ( i = 0; i < aParameter.getLength(); i++ )
+ {
+ const NMSP_BEANS::PropertyValue& rProp = aParameter[ i ];
+ if ( rProp.Name.equalsAscii( "CustomShape" ) )
+ rProp.Value >>= mxShape;
+ else if ( rProp.Name.equalsAscii( "ForceGroupWithText" ) )
+ rProp.Value >>= mbForceGroupWithText;
+ }
+}
+
+// XServiceInfo ---------------------------------------------------------------
+
+rtl::OUString SAL_CALL EnhancedCustomShapeEngine::getImplementationName()
+ throw( NMSP_UNO::RuntimeException )
+{
+ return EnhancedCustomShapeEngine_getImplementationName();
+}
+sal_Bool SAL_CALL EnhancedCustomShapeEngine::supportsService( const rtl::OUString& rServiceName )
+ throw( NMSP_UNO::RuntimeException )
+{
+ return EnhancedCustomShapeEngine_supportsService( rServiceName );
+}
+SEQ( rtl::OUString ) SAL_CALL EnhancedCustomShapeEngine::getSupportedServiceNames()
+ throw ( NMSP_UNO::RuntimeException )
+{
+ return EnhancedCustomShapeEngine_getSupportedServiceNames();
+}
+
+// XCustomShapeEngine -----------------------------------------------------------
+
+SdrObject* EnhancedCustomShapeEngine::ImplForceGroupWithText( const SdrObjCustomShape* pCustoObj, SdrObject* pRenderedShape )
+{
+ bool bHasText = pCustoObj->HasText();
+ if ( pRenderedShape || bHasText )
+ {
+ // applying shadow
+ const SdrObject* pShadowGeometry = pCustoObj->GetSdrObjectShadowFromCustomShape();
+ if ( pShadowGeometry )
+ {
+ if ( pRenderedShape )
+ {
+ if ( !pRenderedShape->ISA( SdrObjGroup ) )
+ {
+ SdrObject* pTmp = pRenderedShape;
+ pRenderedShape = new SdrObjGroup();
+ ((SdrObjGroup*)pRenderedShape)->GetSubList()->NbcInsertObject( pTmp );
+ }
+ ((SdrObjGroup*)pRenderedShape)->GetSubList()->NbcInsertObject( pShadowGeometry->Clone(), 0 );
+ }
+ else
+ pRenderedShape = pShadowGeometry->Clone();
+ }
+
+ // apply text
+ if ( bHasText )
+ {
+ // #i37011# also create a text object and add at rPos + 1
+ SdrTextObj* pTextObj = (SdrTextObj*)SdrObjFactory::MakeNewObject(
+ pCustoObj->GetObjInventor(), OBJ_TEXT, 0L, pCustoObj->GetModel());
+
+ // Copy text content
+ OutlinerParaObject* pParaObj = pCustoObj->GetOutlinerParaObject();
+ if( pParaObj )
+ pTextObj->NbcSetOutlinerParaObject( new OutlinerParaObject(*pParaObj) );
+
+ // copy all attributes
+ SfxItemSet aTargetItemSet( pCustoObj->GetMergedItemSet() );
+
+ // clear fill and line style
+ aTargetItemSet.Put(XLineStyleItem(XLINE_NONE));
+ aTargetItemSet.Put(XFillStyleItem(XFILL_NONE));
+
+ // get the text bounds and set at text object
+ Rectangle aTextBounds = pCustoObj->GetSnapRect();
+ SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxShape ) );
+ if ( pSdrObjCustomShape )
+ {
+ EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
+ aTextBounds = aCustomShape2d.GetTextRect();
+ }
+ pTextObj->SetSnapRect( aTextBounds );
+
+ // if rotated, copy GeoStat, too.
+ const GeoStat& rSourceGeo = pCustoObj->GetGeoStat();
+ if ( rSourceGeo.nDrehWink )
+ {
+ pTextObj->NbcRotate(
+ pCustoObj->GetSnapRect().Center(), rSourceGeo.nDrehWink,
+ rSourceGeo.nSin, rSourceGeo.nCos);
+ }
+
+ // set modified ItemSet at text object
+ pTextObj->SetMergedItemSet(aTargetItemSet);
+
+ if ( pRenderedShape )
+ {
+ if ( !pRenderedShape->ISA( SdrObjGroup ) )
+ {
+ SdrObject* pTmp = pRenderedShape;
+ pRenderedShape = new SdrObjGroup();
+ ((SdrObjGroup*)pRenderedShape)->GetSubList()->NbcInsertObject( pTmp );
+ }
+ ((SdrObjGroup*)pRenderedShape)->GetSubList()->NbcInsertObject( pTextObj, LIST_APPEND );
+ }
+ else
+ pRenderedShape = pTextObj;
+ }
+
+ // force group
+ if ( pRenderedShape )
+ {
+ if ( !pRenderedShape->ISA( SdrObjGroup ) )
+ {
+ SdrObject* pTmp = pRenderedShape;
+ pRenderedShape = new SdrObjGroup();
+ ((SdrObjGroup*)pRenderedShape)->GetSubList()->NbcInsertObject( pTmp );
+ }
+ pRenderedShape->SetPage( pCustoObj->GetPage() );
+ pRenderedShape->SetModel( pCustoObj->GetModel() );
+ }
+ }
+ return pRenderedShape;
+}
+
+void SetTemporary( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape )
+{
+ if ( xShape.is() )
+ {
+ SvxShape* pShape = SvxShape::getImplementation( xShape );
+ if ( pShape )
+ pShape->TakeSdrObjectOwnership();
+/*
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes > xShapes( xShape, ::com::sun::star::uno::UNO_QUERY );
+ if ( xShapes.is() )
+ {
+ sal_Int32 i;
+ for ( i = 0; i < xShapes->getCount(); i++ )
+ {
+ ::com::sun::star::uno::Any aAny( xShapes->getByIndex( i ) );
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape;
+ if ( aAny >>= xShape )
+ SetTemporary( xShape );
+ }
+ }
+*/
+ }
+}
+
+REF( com::sun::star::drawing::XShape ) SAL_CALL EnhancedCustomShapeEngine::render()
+ throw ( NMSP_UNO::RuntimeException )
+{
+ REF( com::sun::star::drawing::XShape ) xShape;
+ SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxShape ) );
+ if ( pSdrObjCustomShape )
+ {
+ // retrieving the TextPath property to check if feature is enabled
+ SdrCustomShapeGeometryItem& rGeometryItem = (SdrCustomShapeGeometryItem&)
+ pSdrObjCustomShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
+ sal_Bool bTextPathOn = sal_False;
+ const rtl::OUString sTextPath( RTL_CONSTASCII_USTRINGPARAM ( "TextPath" ) );
+ com::sun::star::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( sTextPath, sTextPath );
+ if ( pAny )
+ *pAny >>= bTextPathOn;
+
+ EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
+ sal_Int32 nRotateAngle = aCustomShape2d.GetRotateAngle();
+
+ sal_Bool bFlipV = aCustomShape2d.IsFlipVert();
+ sal_Bool bFlipH = aCustomShape2d.IsFlipHorz();
+ sal_Bool bLineGeometryNeededOnly = bTextPathOn;
+
+ SdrObject* pRenderedShape = aCustomShape2d.CreateObject( bLineGeometryNeededOnly );
+ if ( pRenderedShape )
+ {
+ if ( bTextPathOn )
+ {
+ SdrObject* pRenderedFontWork = EnhancedCustomShapeFontWork::CreateFontWork( pRenderedShape, pSdrObjCustomShape );
+ if ( pRenderedFontWork )
+ {
+ SdrObject::Free( pRenderedShape );
+ pRenderedShape = pRenderedFontWork;
+ }
+ }
+ SdrObject* pRenderedShape3d = EnhancedCustomShape3d::Create3DObject( pRenderedShape, pSdrObjCustomShape );
+ if ( pRenderedShape3d )
+ {
+ bFlipV = bFlipH = sal_False;
+ nRotateAngle = 0;
+ SdrObject::Free( pRenderedShape );
+ 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, sal_False);
+ }
+ if( nRotateAngle )
+ {
+ double a = nRotateAngle * F_PI18000;
+ pRenderedShape->NbcRotate( pSdrObjCustomShape->GetSnapRect().Center(), nRotateAngle, sin( a ), cos( a ) );
+ }
+ if ( bFlipV )
+ {
+ Point aLeft( aRect.Left(), ( aRect.Top() + aRect.Bottom() ) >> 1 );
+ Point aRight( aLeft.X() + 1000, aLeft.Y() );
+ pRenderedShape->NbcMirror( aLeft, aRight );
+ }
+ if ( bFlipH )
+ {
+ Point aTop( ( aRect.Left() + aRect.Right() ) >> 1, aRect.Top() );
+ Point aBottom( aTop.X(), aTop.Y() + 1000 );
+ pRenderedShape->NbcMirror( aTop, aBottom );
+ }
+ pRenderedShape->NbcSetStyleSheet( pSdrObjCustomShape->GetStyleSheet(), sal_True );
+ pRenderedShape->RecalcSnapRect();
+ }
+
+ if ( mbForceGroupWithText )
+ pRenderedShape = ImplForceGroupWithText( (SdrObjCustomShape*)pSdrObjCustomShape, pRenderedShape );
+
+ if ( pRenderedShape )
+ {
+ aCustomShape2d.ApplyGluePoints( pRenderedShape );
+ xShape = SvxDrawPage::CreateShapeByTypeAndInventor( pRenderedShape->GetObjIdentifier(),
+ pRenderedShape->GetObjInventor(), pRenderedShape, NULL );
+ }
+ SetTemporary( xShape );
+ }
+ return xShape;
+}
+
+com::sun::star::awt::Rectangle SAL_CALL EnhancedCustomShapeEngine::getTextBounds()
+ throw ( NMSP_UNO::RuntimeException )
+{
+ com::sun::star::awt::Rectangle aTextRect;
+ SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxShape ) );
+ ::com::sun::star::uno::Reference< ::com::sun::star::document::XActionLockable > xLockable( mxShape, ::com::sun::star::uno::UNO_QUERY );
+ if ( pSdrObjCustomShape && pSdrObjCustomShape->GetModel() && xLockable.is() && !xLockable->isActionLocked() )
+ {
+ if ( pSdrObjCustomShape )
+ {
+ EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
+ Rectangle aRect( aCustomShape2d.GetTextRect() );
+ aTextRect.X = aRect.Left();
+ aTextRect.Y = aRect.Top();
+ aTextRect.Width = aRect.GetWidth();
+ aTextRect.Height = aRect.GetHeight();
+ }
+ }
+ return aTextRect;
+}
+
+com::sun::star::drawing::PolyPolygonBezierCoords SAL_CALL EnhancedCustomShapeEngine::getLineGeometry()
+ throw ( NMSP_UNO::RuntimeException )
+{
+ com::sun::star::drawing::PolyPolygonBezierCoords aPolyPolygonBezierCoords;
+ SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxShape ) );
+ if ( pSdrObjCustomShape )
+ {
+ EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
+ SdrObject* pObj = aCustomShape2d.CreateLineGeometry();
+ 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, sal_False);
+ }
+ sal_Int32 nRotateAngle = aCustomShape2d.GetRotateAngle();
+ if( nRotateAngle )
+ {
+ double a = nRotateAngle * F_PI18000;
+ pObj->NbcRotate( aRect.Center(), nRotateAngle, sin( a ), cos( a ) );
+ }
+ if ( bFlipH )
+ {
+ Point aTop( ( aRect.Left() + aRect.Right() ) >> 1, aRect.Top() );
+ Point aBottom( aTop.X(), aTop.Y() + 1000 );
+ pObj->NbcMirror( aTop, aBottom );
+ }
+ if ( bFlipV )
+ {
+ Point aLeft( aRect.Left(), ( aRect.Top() + aRect.Bottom() ) >> 1 );
+ Point aRight( aLeft.X() + 1000, aLeft.Y() );
+ pObj->NbcMirror( aLeft, aRight );
+ }
+
+ basegfx::B2DPolyPolygon aPolyPolygon;
+ SdrObjListIter aIter( *pObj, IM_DEEPWITHGROUPS );
+
+ while ( aIter.IsMore() )
+ {
+ SdrObject* pNewObj = NULL;
+ basegfx::B2DPolyPolygon aPP;
+ const SdrObject* pNext = aIter.Next();
+
+ if ( pNext->ISA( SdrPathObj ) )
+ {
+ aPP = ((SdrPathObj*)pNext)->GetPathPoly();
+ }
+ else
+ {
+ pNewObj = pNext->ConvertToPolyObj( sal_False, sal_False );
+ SdrPathObj* pPath = PTR_CAST( SdrPathObj, pNewObj );
+ if ( pPath )
+ aPP = pPath->GetPathPoly();
+ }
+
+ if ( aPP.count() )
+ aPolyPolygon.append(aPP);
+
+ SdrObject::Free( pNewObj );
+ }
+ SdrObject::Free( pObj );
+ SvxConvertB2DPolyPolygonToPolyPolygonBezier( aPolyPolygon, aPolyPolygonBezierCoords );
+ }
+ }
+
+ return aPolyPolygonBezierCoords;
+}
+
+SEQ( REF( com::sun::star::drawing::XCustomShapeHandle ) ) SAL_CALL EnhancedCustomShapeEngine::getInteraction()
+ throw ( NMSP_UNO::RuntimeException )
+{
+ sal_uInt32 i, nHdlCount = 0;
+ SdrObject* pSdrObjCustomShape = GetSdrObjectFromXShape( mxShape );
+ if ( pSdrObjCustomShape )
+ {
+ EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
+ nHdlCount = aCustomShape2d.GetHdlCount();
+ }
+ SEQ( REF( com::sun::star::drawing::XCustomShapeHandle ) ) aSeq( nHdlCount );
+ for ( i = 0; i < nHdlCount; i++ )
+ aSeq[ i ] = new EnhancedCustomShapeHandle( mxShape, i );
+ return aSeq;
+}
diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.hxx b/svx/source/customshapes/EnhancedCustomShapeEngine.hxx
new file mode 100644
index 000000000000..1ead04b5311e
--- /dev/null
+++ b/svx/source/customshapes/EnhancedCustomShapeEngine.hxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ENHANCED_CUSTOMSHAPE_ENGINE_HXX
+#define _ENHANCED_CUSTOMSHAPE_ENGINE_HXX
+
+#include <tools/debug.hxx>
+#include <tools/string.hxx>
+#include <tools/stack.hxx>
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <cppuhelper/implbase3.hxx>
+#ifndef __com_sun_star_awt_Rectangle_hpp_
+#include <com/sun/star/awt/Rectangle.hpp>
+#endif
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/drawing/XCustomShapeEngine.hpp>
+
+// -----------------------------------------------------------------------------
+
+#define NMSP_IO com::sun::star::io
+#define NMSP_UNO com::sun::star::uno
+#define NMSP_BEANS com::sun::star::beans
+#define NMSP_LANG com::sun::star::lang
+#define NMSP_UTIL com::sun::star::util
+#define NMSP_SAX com::sun::star::xml::sax
+#define NMSP_LOGGING NMSP_UTIL::logging
+
+
+#define REF( _def_Obj ) NMSP_UNO::Reference< _def_Obj >
+#define SEQ( _def_Obj ) NMSP_UNO::Sequence< _def_Obj >
+#define B2UCONST( _def_pChar ) (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(_def_pChar )))
+
+// ---------------------------
+// - EnhancedCustomShapeEngine -
+// ---------------------------
+//
+
+class SdrObject;
+class SdrObjCustomShape;
+class EnhancedCustomShapeEngine : public cppu::WeakImplHelper3
+<
+ com::sun::star::lang::XInitialization,
+ com::sun::star::lang::XServiceInfo,
+ com::sun::star::drawing::XCustomShapeEngine
+>
+{
+ REF( NMSP_LANG::XMultiServiceFactory ) mxFact;
+ REF( com::sun::star::drawing::XShape ) mxShape;
+ sal_Bool mbForceGroupWithText;
+
+ SdrObject* ImplForceGroupWithText( const SdrObjCustomShape* pCustoObj, SdrObject* pRenderedShape );
+
+public:
+ EnhancedCustomShapeEngine( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr );
+ virtual ~EnhancedCustomShapeEngine();
+
+ // XInterface
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const SEQ( NMSP_UNO::Any )& aArguments )
+ throw ( NMSP_UNO::Exception, NMSP_UNO::RuntimeException );
+
+ // XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName()
+ throw ( NMSP_UNO::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& rServiceName )
+ throw ( NMSP_UNO::RuntimeException );
+ virtual SEQ( rtl::OUString ) SAL_CALL getSupportedServiceNames()
+ throw ( NMSP_UNO::RuntimeException );
+
+ // XCustomShapeEngine
+ virtual REF( com::sun::star::drawing::XShape ) SAL_CALL render()
+ throw ( NMSP_UNO::RuntimeException );
+ virtual com::sun::star::awt::Rectangle SAL_CALL getTextBounds()
+ throw ( NMSP_UNO::RuntimeException );
+ virtual com::sun::star::drawing::PolyPolygonBezierCoords SAL_CALL getLineGeometry()
+ throw ( NMSP_UNO::RuntimeException );
+ virtual SEQ( REF( com::sun::star::drawing::XCustomShapeHandle ) ) SAL_CALL getInteraction()
+ throw ( NMSP_UNO::RuntimeException );
+};
+
+rtl::OUString EnhancedCustomShapeEngine_getImplementationName()
+ throw ( NMSP_UNO::RuntimeException );
+sal_Bool SAL_CALL EnhancedCustomShapeEngine_supportsService( const rtl::OUString& rServiceName )
+ throw( NMSP_UNO::RuntimeException );
+SEQ( rtl::OUString ) SAL_CALL EnhancedCustomShapeEngine_getSupportedServiceNames()
+ throw( NMSP_UNO::RuntimeException );
+
+#endif
diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
new file mode 100644
index 000000000000..0af22d94334b
--- /dev/null
+++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
@@ -0,0 +1,910 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "EnhancedCustomShapeFontWork.hxx"
+#include <tools/solar.h> // UINTXX
+#include <svx/svddef.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdopath.hxx>
+#include <vcl/metric.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/sdasitm.hxx>
+#include <svx/sdasaitm.hxx>
+#include <svx/sdtfsitm.hxx>
+#include <vcl/virdev.hxx>
+#include <svx/svditer.hxx>
+#include <vcl/metric.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/charscaleitem.hxx>
+#include "svx/EnhancedCustomShapeTypeNames.hxx"
+#include <svx/svdorect.hxx>
+#include <svx/svdoashp.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/outlobj.hxx>
+#include <editeng/editobj.hxx>
+#include <editeng/editeng.hxx>
+#include <svx/svdmodel.hxx>
+#include <vector>
+#include <numeric>
+#include <algorithm>
+#include <comphelper/processfactory.hxx>
+#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
+#include <com/sun/star/i18n/ScriptType.hdl>
+#endif
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#ifndef _COM_SUN_STAR_I18N_CHARACTERITERATORMODE_HDL_
+#include <com/sun/star/i18n/CharacterIteratorMode.hdl>
+#endif
+#include <basegfx/polygon/b2dpolygontools.hxx>
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+typedef std::vector< std::vector< double > > PolyPolygonDistances;
+
+struct FWCharacterData // representing a single character
+{
+ std::vector< PolyPolygon > vOutlines;
+ Rectangle aBoundRect;
+};
+struct FWParagraphData // representing a single paragraph
+{
+ rtl::OUString aString;
+ std::vector< FWCharacterData > vCharacters;
+ Rectangle aBoundRect;
+ sal_Int16 nFrameDirection;
+};
+struct FWTextArea // representing multiple concluding paragraphs
+{
+ std::vector< FWParagraphData > vParagraphs;
+ Rectangle aBoundRect;
+};
+struct FWData // representing the whole text
+{
+ std::vector< FWTextArea > vTextAreas;
+ double fHorizontalTextScaling;
+ sal_uInt32 nMaxParagraphsPerTextArea;
+ sal_Int32 nSingleLineHeight;
+ sal_Bool bSingleLineMode;
+};
+
+
+sal_Bool InitializeFontWorkData( const SdrObject* pCustomShape, const sal_uInt16 nOutlinesCount2d, FWData& rFWData )
+{
+ sal_Bool bNoErr = sal_False;
+ sal_Bool bSingleLineMode = sal_False;
+ sal_uInt16 nTextAreaCount = nOutlinesCount2d;
+ if ( nOutlinesCount2d & 1 )
+ bSingleLineMode = sal_True;
+ else
+ nTextAreaCount >>= 1;
+
+ if ( nTextAreaCount )
+ {
+ rFWData.bSingleLineMode = bSingleLineMode;
+
+ // setting the strings
+ OutlinerParaObject* pParaObj = ((SdrObjCustomShape*)pCustomShape)->GetOutlinerParaObject();
+ if ( pParaObj )
+ {
+ const EditTextObject& rTextObj = pParaObj->GetTextObject();
+ sal_Int32 nParagraphsLeft = rTextObj.GetParagraphCount();
+
+ rFWData.nMaxParagraphsPerTextArea = ( ( nParagraphsLeft - 1 ) / nTextAreaCount ) + 1;
+ sal_Int16 j = 0;
+ while( nParagraphsLeft && nTextAreaCount )
+ {
+ FWTextArea aTextArea;
+ sal_Int32 i, nParagraphs = ( ( nParagraphsLeft - 1 ) / nTextAreaCount ) + 1;
+ for ( i = 0; i < nParagraphs; i++, j++ )
+ {
+ FWParagraphData aParagraphData;
+ aParagraphData.aString = rTextObj.GetText( j );
+
+ const SfxItemSet& rParaSet = rTextObj.GetParaAttribs( j ); // retrieving some paragraph attributes
+ aParagraphData.nFrameDirection = ((SvxFrameDirectionItem&)rParaSet.Get( EE_PARA_WRITINGDIR )).GetValue();
+ aTextArea.vParagraphs.push_back( aParagraphData );
+ }
+ rFWData.vTextAreas.push_back( aTextArea );
+ nParagraphsLeft -= nParagraphs;
+ nTextAreaCount--;
+ }
+ bNoErr = sal_True;
+ }
+ }
+ return bNoErr;
+}
+
+double GetLength( const Polygon& rPolygon )
+{
+ double fLength = 0;
+ if ( rPolygon.GetSize() > 1 )
+ {
+ sal_uInt16 nCount = rPolygon.GetSize();
+ while( --nCount )
+ fLength += ((Polygon&)rPolygon).CalcDistance( nCount, nCount - 1 );
+ }
+ return fLength;
+}
+
+
+/* CalculateHorizontalScalingFactor returns the horizontal scaling factor for
+the whole text object, so that each text will match its corresponding 2d Outline */
+void CalculateHorizontalScalingFactor( const SdrObject* pCustomShape,
+ FWData& rFWData, const PolyPolygon& rOutline2d )
+{
+ double fScalingFactor = 1.0;
+ sal_Bool bScalingFactorDefined = sal_False;
+
+ sal_uInt16 i = 0;
+ sal_Bool bSingleLineMode = sal_False;
+ sal_uInt16 nOutlinesCount2d = rOutline2d.Count();
+
+ Font aFont;
+ SvxFontItem& rFontItem = (SvxFontItem&)pCustomShape->GetMergedItem( EE_CHAR_FONTINFO );
+ aFont.SetHeight( pCustomShape->GetLogicRect().GetHeight() / rFWData.nMaxParagraphsPerTextArea );
+ aFont.SetAlign( ALIGN_TOP );
+ aFont.SetName( rFontItem.GetFamilyName() );
+ aFont.SetFamily( rFontItem.GetFamily() );
+ aFont.SetStyleName( rFontItem.GetStyleName() );
+ aFont.SetOrientation( 0 );
+ // initializing virtual device
+
+ VirtualDevice aVirDev( 1 );
+ aVirDev.SetMapMode( MAP_100TH_MM );
+ aVirDev.SetFont( aFont );
+
+ if ( nOutlinesCount2d & 1 )
+ bSingleLineMode = sal_True;
+
+ std::vector< FWTextArea >::iterator aTextAreaIter = rFWData.vTextAreas.begin();
+ std::vector< FWTextArea >::iterator aTextAreaIEnd = rFWData.vTextAreas.end();
+ while( aTextAreaIter != aTextAreaIEnd )
+ {
+ // calculating the width of the corresponding 2d text area
+ double fWidth = GetLength( rOutline2d.GetObject( i++ ) );
+ if ( !bSingleLineMode )
+ {
+ fWidth += GetLength( rOutline2d.GetObject( i++ ) );
+ fWidth /= 2.0;
+ }
+ std::vector< FWParagraphData >::const_iterator aParagraphIter( aTextAreaIter->vParagraphs.begin() );
+ std::vector< FWParagraphData >::const_iterator aParagraphIEnd( aTextAreaIter->vParagraphs.end() );
+ while( aParagraphIter != aParagraphIEnd )
+ {
+ double fTextWidth = aVirDev.GetTextWidth( aParagraphIter->aString );
+ if ( fTextWidth > 0.0 )
+ {
+ double fScale = fWidth / fTextWidth;
+ if ( !bScalingFactorDefined )
+ {
+ fScalingFactor = fScale;
+ bScalingFactorDefined = sal_True;
+ }
+ else
+ {
+ if ( fScale < fScalingFactor )
+ fScalingFactor = fScale;
+ }
+ }
+ aParagraphIter++;
+ }
+ aTextAreaIter++;
+ }
+ rFWData.fHorizontalTextScaling = fScalingFactor;
+}
+
+void GetTextAreaOutline( const FWData& rFWData, const SdrObject* pCustomShape, FWTextArea& rTextArea, sal_Bool bSameLetterHeights )
+{
+ sal_Bool bIsVertical = ((SdrObjCustomShape*)pCustomShape)->IsVerticalWriting();
+ sal_Int32 nVerticalOffset = rFWData.nMaxParagraphsPerTextArea > rTextArea.vParagraphs.size()
+ ? rFWData.nSingleLineHeight / 2 : 0;
+
+ std::vector< FWParagraphData >::iterator aParagraphIter( rTextArea.vParagraphs.begin() );
+ std::vector< FWParagraphData >::iterator aParagraphIEnd( rTextArea.vParagraphs.end() );
+ while( aParagraphIter != aParagraphIEnd )
+ {
+ const rtl::OUString& rText = aParagraphIter->aString;
+ if ( rText.getLength() )
+ {
+ // generating vcl/font
+ sal_uInt16 nScriptType = i18n::ScriptType::LATIN;
+ Reference< i18n::XBreakIterator > xBI( EnhancedCustomShapeFontWork::GetBreakIterator() );
+ if ( xBI.is() )
+ {
+ nScriptType = xBI->getScriptType( rText, 0 );
+ sal_uInt16 nChg = 0;
+ if( i18n::ScriptType::WEAK == nScriptType )
+ {
+ nChg = (xub_StrLen)xBI->endOfScript( rText, nChg, nScriptType );
+ if( nChg < rText.getLength() )
+ nScriptType = xBI->getScriptType( rText, nChg );
+ else
+ nScriptType = i18n::ScriptType::LATIN;
+ }
+ }
+ sal_uInt16 nFntItm = EE_CHAR_FONTINFO;
+ if ( nScriptType == i18n::ScriptType::COMPLEX )
+ nFntItm = EE_CHAR_FONTINFO_CTL;
+ else if ( nScriptType == i18n::ScriptType::ASIAN )
+ nFntItm = EE_CHAR_FONTINFO_CJK;
+ SvxFontItem& rFontItem = (SvxFontItem&)pCustomShape->GetMergedItem( nFntItm );
+ Font aFont;
+ aFont.SetHeight( rFWData.nSingleLineHeight );
+ aFont.SetAlign( ALIGN_TOP );
+ // aFont.SetAlign( )
+
+ aFont.SetName( rFontItem.GetFamilyName() );
+ aFont.SetFamily( rFontItem.GetFamily() );
+ aFont.SetStyleName( rFontItem.GetStyleName() );
+ aFont.SetOrientation( 0 );
+
+ SvxPostureItem& rPostureItem = (SvxPostureItem&)pCustomShape->GetMergedItem( EE_CHAR_ITALIC );
+ aFont.SetItalic( rPostureItem.GetPosture() );
+
+ SvxWeightItem& rWeightItem = (SvxWeightItem&)pCustomShape->GetMergedItem( EE_CHAR_WEIGHT );
+ aFont.SetWeight( rWeightItem.GetWeight() );
+
+ // initializing virtual device
+ VirtualDevice aVirDev( 1 );
+ aVirDev.SetMapMode( MAP_100TH_MM );
+ aVirDev.SetFont( aFont );
+ aVirDev.EnableRTL( sal_True );
+ if ( aParagraphIter->nFrameDirection == FRMDIR_HORI_RIGHT_TOP )
+ aVirDev.SetLayoutMode( TEXT_LAYOUT_BIDI_RTL );
+
+ SvxCharScaleWidthItem& rCharScaleWidthItem = (SvxCharScaleWidthItem&)pCustomShape->GetMergedItem( EE_CHAR_FONTWIDTH );
+ sal_uInt16 nCharScaleWidth = rCharScaleWidthItem.GetValue();
+ sal_Int32* pDXArry = NULL;
+ sal_Int32 nWidth = 0;
+
+ // VERTICAL
+ if ( bIsVertical )
+ {
+ // vertical _> each single character needs to be rotated by 90
+ sal_Int32 i;
+ sal_Int32 nHeight = 0;
+ Rectangle aSingleCharacterUnion;
+ for ( i = 0; i < rText.getLength(); i++ )
+ {
+ FWCharacterData aCharacterData;
+ rtl::OUString aCharText( (sal_Unicode)rText[ i ] );
+ if ( aVirDev.GetTextOutlines( aCharacterData.vOutlines, aCharText, 0, 0, STRING_LEN, sal_True, nWidth, pDXArry ) )
+ {
+ sal_Int32 nTextWidth = aVirDev.GetTextWidth( aCharText, 0, STRING_LEN );
+ std::vector< PolyPolygon >::iterator aOutlineIter = aCharacterData.vOutlines.begin();
+ std::vector< PolyPolygon >::iterator aOutlineIEnd = aCharacterData.vOutlines.end();
+ if ( aOutlineIter == aOutlineIEnd )
+ {
+ nHeight += rFWData.nSingleLineHeight;
+ }
+ else
+ {
+ while ( aOutlineIter != aOutlineIEnd )
+ {
+ // rotating
+ aOutlineIter->Rotate( Point( nTextWidth / 2, rFWData.nSingleLineHeight / 2 ), 900 );
+ aCharacterData.aBoundRect.Union( aOutlineIter->GetBoundRect() );
+ aOutlineIter++;
+ }
+ aOutlineIter = aCharacterData.vOutlines.begin();
+ aOutlineIEnd = aCharacterData.vOutlines.end();
+ while ( aOutlineIter != aOutlineIEnd )
+ {
+ sal_Int32 nM = - aCharacterData.aBoundRect.Left() + nHeight;
+ aOutlineIter->Move( nM, 0 );
+ aCharacterData.aBoundRect.Move( nM, 0 );
+ aOutlineIter++;
+ }
+ nHeight += aCharacterData.aBoundRect.GetWidth() + ( rFWData.nSingleLineHeight / 5 );
+ aSingleCharacterUnion.Union( aCharacterData.aBoundRect );
+ }
+ }
+ aParagraphIter->vCharacters.push_back( aCharacterData );
+ }
+ std::vector< FWCharacterData >::iterator aCharacterIter( aParagraphIter->vCharacters.begin() );
+ std::vector< FWCharacterData >::iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
+ while ( aCharacterIter != aCharacterIEnd )
+ {
+ std::vector< PolyPolygon >::iterator aOutlineIter( aCharacterIter->vOutlines.begin() );
+ std::vector< PolyPolygon >::iterator aOutlineIEnd( aCharacterIter->vOutlines.end() );
+ while ( aOutlineIter != aOutlineIEnd )
+ {
+ aOutlineIter->Move( ( aSingleCharacterUnion.GetWidth() - aCharacterIter->aBoundRect.GetWidth() ) / 2, 0 );
+ aOutlineIter++;
+ }
+ aCharacterIter++;
+ }
+ }
+ else
+ {
+ if ( ( nCharScaleWidth != 100 ) && nCharScaleWidth )
+ { // applying character spacing
+ pDXArry = new sal_Int32[ rText.getLength() ];
+ aVirDev.GetTextArray( rText, pDXArry, 0, STRING_LEN );
+ FontMetric aFontMetric( aVirDev.GetFontMetric() );
+ aFont.SetWidth( (sal_Int32)( (double)aFontMetric.GetWidth() * ( (double)100 / (double)nCharScaleWidth ) ) );
+ aVirDev.SetFont( aFont );
+ }
+ FWCharacterData aCharacterData;
+ if ( aVirDev.GetTextOutlines( aCharacterData.vOutlines, rText, 0, 0, STRING_LEN, sal_True, nWidth, pDXArry ) )
+ {
+ aParagraphIter->vCharacters.push_back( aCharacterData );
+ }
+
+/* trying to retrieve each single character _> is not working well
+ sal_Int32 i;
+ for ( i = 0; i < rText.getLength(); i++ )
+ {
+ FWCharacterData aCharacterData;
+ if ( aVirDev.GetTextOutlines( aCharacterData.vOutlines, rText, 0, i, 1, sal_True, nWidth, pDXArry ) )
+ {
+ std::vector< PolyPolygon >::iterator aOutlineIter = aCharacterData.vOutlines.begin();
+ std::vector< PolyPolygon >::iterator aOutlineIEnd = aCharacterData.vOutlines.end();
+ while ( aOutlineIter != aOutlineIEnd )
+ {
+ aCharacterData.aBoundRect.Union( aOutlineIter->GetBoundRect() );
+ aOutlineIter++;
+ }
+ }
+ aParagraphIter->vCharacters.push_back( aCharacterData );
+ }
+*/
+ }
+ delete[] pDXArry;
+
+ // veritcal alignment
+ std::vector< FWCharacterData >::iterator aCharacterIter( aParagraphIter->vCharacters.begin() );
+ std::vector< FWCharacterData >::iterator aCharacterIEnd ( aParagraphIter->vCharacters.end() );
+ while ( aCharacterIter != aCharacterIEnd )
+ {
+ std::vector< PolyPolygon >::iterator aOutlineIter( aCharacterIter->vOutlines.begin() );
+ std::vector< PolyPolygon >::iterator aOutlineIEnd( aCharacterIter->vOutlines.end() );
+ while( aOutlineIter != aOutlineIEnd )
+ {
+
+ PolyPolygon& rPolyPoly = *aOutlineIter++;
+
+ if ( nVerticalOffset )
+ rPolyPoly.Move( 0, nVerticalOffset );
+
+ // retrieving the boundrect for the paragraph
+ Rectangle aBoundRect( rPolyPoly.GetBoundRect() );
+ aParagraphIter->aBoundRect.Union( aBoundRect );
+ }
+ aCharacterIter++;
+ }
+ }
+ // updating the boundrect for the text area by merging the current paragraph boundrect
+ if ( aParagraphIter->aBoundRect.IsEmpty() )
+ {
+ if ( rTextArea.aBoundRect.IsEmpty() )
+ rTextArea.aBoundRect = Rectangle( Point( 0, 0 ), Size( 1, rFWData.nSingleLineHeight ) );
+ else
+ rTextArea.aBoundRect.Bottom() += rFWData.nSingleLineHeight;
+ }
+ else
+ {
+ Rectangle& rParagraphBoundRect = aParagraphIter->aBoundRect;
+ rTextArea.aBoundRect.Union( rParagraphBoundRect );
+
+ if ( bSameLetterHeights )
+ {
+ std::vector< FWCharacterData >::iterator aCharacterIter( aParagraphIter->vCharacters.begin() );
+ std::vector< FWCharacterData >::iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
+ while ( aCharacterIter != aCharacterIEnd )
+ {
+ std::vector< PolyPolygon >::iterator aOutlineIter( aCharacterIter->vOutlines.begin() );
+ std::vector< PolyPolygon >::iterator aOutlineIEnd( aCharacterIter->vOutlines.end() );
+ while( aOutlineIter != aOutlineIEnd )
+ {
+ Rectangle aPolyPolyBoundRect( aOutlineIter->GetBoundRect() );
+ if ( aPolyPolyBoundRect.GetHeight() != rParagraphBoundRect.GetHeight() )
+ aOutlineIter->Scale( 1.0, (double)rParagraphBoundRect.GetHeight() / aPolyPolyBoundRect.GetHeight() );
+ aPolyPolyBoundRect = aOutlineIter->GetBoundRect();
+ sal_Int32 nMove = aPolyPolyBoundRect.Top() - rParagraphBoundRect.Top();
+ if ( nMove )
+ aOutlineIter->Move( 0, -nMove );
+ aOutlineIter++;
+ }
+ aCharacterIter++;
+ }
+ }
+ }
+ if ( bIsVertical )
+ nVerticalOffset -= rFWData.nSingleLineHeight;
+ else
+ nVerticalOffset += rFWData.nSingleLineHeight;
+ aParagraphIter++;
+ }
+}
+
+void GetFontWorkOutline( FWData& rFWData, const SdrObject* pCustomShape )
+{
+ SdrTextHorzAdjust eHorzAdjust( ((SdrTextHorzAdjustItem&)pCustomShape->GetMergedItem( SDRATTR_TEXT_HORZADJUST )).GetValue() );
+ SdrFitToSizeType eFTS( ((SdrTextFitToSizeTypeItem&)pCustomShape->GetMergedItem( SDRATTR_TEXT_FITTOSIZE )).GetValue() );
+
+ std::vector< FWTextArea >::iterator aTextAreaIter = rFWData.vTextAreas.begin();
+ std::vector< FWTextArea >::iterator aTextAreaIEnd = rFWData.vTextAreas.end();
+
+ rFWData.nSingleLineHeight = (sal_Int32)( ( (double)pCustomShape->GetLogicRect().GetHeight()
+ / rFWData.nMaxParagraphsPerTextArea ) * rFWData.fHorizontalTextScaling );
+
+ sal_Bool bSameLetterHeights = sal_False;
+ SdrCustomShapeGeometryItem& rGeometryItem = (SdrCustomShapeGeometryItem&)pCustomShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
+ const rtl::OUString sTextPath( RTL_CONSTASCII_USTRINGPARAM ( "TextPath" ) );
+ const rtl::OUString sSameLetterHeights( RTL_CONSTASCII_USTRINGPARAM ( "SameLetterHeights" ) );
+ com::sun::star::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( sTextPath, sSameLetterHeights );
+ if ( pAny )
+ *pAny >>= bSameLetterHeights;
+
+ while ( aTextAreaIter != aTextAreaIEnd )
+ {
+ GetTextAreaOutline( rFWData, pCustomShape, *aTextAreaIter, bSameLetterHeights );
+ if ( eFTS == SDRTEXTFIT_ALLLINES )
+ {
+ std::vector< FWParagraphData >::iterator aParagraphIter( aTextAreaIter->vParagraphs.begin() );
+ std::vector< FWParagraphData >::iterator aParagraphIEnd( aTextAreaIter->vParagraphs.end() );
+ while ( aParagraphIter != aParagraphIEnd )
+ {
+ sal_Int32 nParaWidth = aParagraphIter->aBoundRect.GetWidth();
+ if ( nParaWidth )
+ {
+ double fScale = (double)aTextAreaIter->aBoundRect.GetWidth() / nParaWidth;
+
+ std::vector< FWCharacterData >::iterator aCharacterIter( aParagraphIter->vCharacters.begin() );
+ std::vector< FWCharacterData >::iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
+ while ( aCharacterIter != aCharacterIEnd )
+ {
+ std::vector< PolyPolygon >::iterator aOutlineIter = aCharacterIter->vOutlines.begin();
+ std::vector< PolyPolygon >::iterator aOutlineIEnd = aCharacterIter->vOutlines.end();
+ while( aOutlineIter != aOutlineIEnd )
+ {
+ aOutlineIter->Scale( fScale, 1.0 );
+ aOutlineIter++;
+ }
+ aCharacterIter++;
+ }
+ }
+ aParagraphIter++;
+ }
+ }
+ else
+ {
+ switch( eHorzAdjust )
+ {
+ case SDRTEXTHORZADJUST_RIGHT :
+ case SDRTEXTHORZADJUST_CENTER:
+ {
+ std::vector< FWParagraphData >::iterator aParagraphIter( aTextAreaIter->vParagraphs.begin() );
+ std::vector< FWParagraphData >::iterator aParagraphIEnd( aTextAreaIter->vParagraphs.end() );
+ while ( aParagraphIter != aParagraphIEnd )
+ {
+ sal_Int32 nHorzDiff = 0;
+ if ( eHorzAdjust == SDRTEXTHORZADJUST_CENTER )
+ nHorzDiff = ( aTextAreaIter->aBoundRect.GetWidth() - aParagraphIter->aBoundRect.GetWidth() ) / 2;
+ else if ( eHorzAdjust == SDRTEXTHORZADJUST_RIGHT )
+ nHorzDiff = ( aTextAreaIter->aBoundRect.GetWidth() - aParagraphIter->aBoundRect.GetWidth() );
+ if ( nHorzDiff )
+ {
+ std::vector< FWCharacterData >::iterator aCharacterIter( aParagraphIter->vCharacters.begin() );
+ std::vector< FWCharacterData >::iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
+ while ( aCharacterIter != aCharacterIEnd )
+ {
+ std::vector< PolyPolygon >::iterator aOutlineIter = aCharacterIter->vOutlines.begin();
+ std::vector< PolyPolygon >::iterator aOutlineIEnd = aCharacterIter->vOutlines.end();
+ while( aOutlineIter != aOutlineIEnd )
+ {
+ aOutlineIter->Move( nHorzDiff, 0 );
+ aOutlineIter++;
+ }
+ aCharacterIter++;
+ }
+ }
+ aParagraphIter++;
+ }
+ }
+ break;
+ default:
+ case SDRTEXTHORZADJUST_BLOCK : break; // don't know
+ case SDRTEXTHORZADJUST_LEFT : break; // already left aligned -> nothing to do
+ }
+ }
+ aTextAreaIter++;
+ }
+}
+
+basegfx::B2DPolyPolygon GetOutlinesFromShape2d( const SdrObject* pShape2d )
+{
+ basegfx::B2DPolyPolygon aOutlines2d;
+
+ SdrObjListIter aObjListIter( *pShape2d, IM_DEEPWITHGROUPS );
+ while( aObjListIter.IsMore() )
+ {
+ SdrObject* pPartObj = aObjListIter.Next();
+ if ( pPartObj->ISA( SdrPathObj ) )
+ {
+ basegfx::B2DPolyPolygon aCandidate(((SdrPathObj*)pPartObj)->GetPathPoly());
+ if(aCandidate.areControlPointsUsed())
+ {
+ aCandidate = basegfx::tools::adaptiveSubdivideByAngle(aCandidate);
+ }
+ aOutlines2d.append(aCandidate);
+ }
+ }
+
+ return aOutlines2d;
+}
+
+void CalcDistances( const Polygon& rPoly, std::vector< double >& rDistances )
+{
+ sal_uInt16 i, nCount = rPoly.GetSize();
+ if ( nCount > 1 )
+ {
+ for ( i = 0; i < nCount; i++ )
+ {
+ double fDistance = i ? ((Polygon&)rPoly).CalcDistance( i, i - 1 ) : 0.0;
+ rDistances.push_back( fDistance );
+ }
+ std::partial_sum( rDistances.begin(), rDistances.end(), rDistances.begin() );
+ double fLength = rDistances[ rDistances.size() - 1 ];
+ if ( fLength > 0.0 )
+ {
+ std::vector< double >::iterator aIter = rDistances.begin();
+ std::vector< double >::iterator aEnd = rDistances.end();
+ while ( aIter != aEnd )
+ *aIter++ /= fLength;
+ }
+ }
+}
+
+void InsertMissingOutlinePoints( const Polygon& /*rOutlinePoly*/, const std::vector< double >& rDistances, const Rectangle& rTextAreaBoundRect, Polygon& rPoly )
+{
+ sal_uInt16 i = 0;
+ double fLastDistance = 0.0;
+ for ( i = 0; i < rPoly.GetSize(); i++ )
+ {
+ Point& rPoint = rPoly[ i ];
+ double fDistance = (double)( rPoint.X() - rTextAreaBoundRect.Left() ) / (double)rTextAreaBoundRect.GetWidth();
+ if ( i )
+ {
+ if ( fDistance > fLastDistance )
+ {
+ std::vector< double >::const_iterator aIter = std::upper_bound( rDistances.begin(), rDistances.end(), fLastDistance );
+ if ( aIter != rDistances.end() && ( *aIter > fLastDistance ) && ( *aIter < fDistance ) )
+ {
+ Point& rPt0 = rPoly[ i - 1 ];
+ sal_Int32 fX = rPoint.X() - rPt0.X();
+ sal_Int32 fY = rPoint.Y() - rPt0.Y();
+ double fd = ( 1.0 / ( fDistance - fLastDistance ) ) * ( *aIter - fLastDistance );
+ rPoly.Insert( i, Point( (sal_Int32)( rPt0.X() + fX * fd ), (sal_Int32)( rPt0.Y() + fY * fd ) ) );
+ fDistance = *aIter;
+ }
+ }
+ else if ( fDistance < fLastDistance )
+ {
+ std::vector< double >::const_iterator aIter = std::lower_bound( rDistances.begin(), rDistances.end(), fLastDistance );
+ if ( aIter-- != rDistances.begin() )
+ {
+ if ( ( *aIter > fDistance ) && ( *aIter < fLastDistance ) )
+ {
+ Point& rPt0 = rPoly[ i - 1 ];
+ sal_Int32 fX = rPoint.X() - rPt0.X();
+ sal_Int32 fY = rPoint.Y() - rPt0.Y();
+ double fd = ( 1.0 / ( fDistance - fLastDistance ) ) * ( *aIter - fLastDistance );
+ rPoly.Insert( i, Point( (sal_Int32)( rPt0.X() + fX * fd ), (sal_Int32)( rPt0.Y() + fY * fd ) ) );
+ fDistance = *aIter;
+ }
+ }
+ }
+ }
+ fLastDistance = fDistance;
+ }
+}
+
+void GetPoint( const Polygon& rPoly, const std::vector< double >& rDistances, const double& fX, double& fx1, double& fy1 )
+{
+ fy1 = fx1 = 0.0;
+ if ( rPoly.GetSize() )
+ {
+ std::vector< double >::const_iterator aIter = std::lower_bound( rDistances.begin(), rDistances.end(), fX );
+ sal_uInt16 nIdx = sal::static_int_cast<sal_uInt16>( std::distance( rDistances.begin(), aIter ) );
+ if ( aIter == rDistances.end() )
+ nIdx--;
+ const Point& rPt = rPoly[ nIdx ];
+ fx1 = rPt.X();
+ fy1 = rPt.Y();
+ if ( nIdx && ( aIter != rDistances.end() ) && ( *aIter != fX ) )
+ {
+ nIdx = sal::static_int_cast<sal_uInt16>( std::distance( rDistances.begin(), aIter ) );
+ double fDist0 = *( aIter - 1 );
+ double fd = ( 1.0 / ( *aIter - fDist0 ) ) * ( fX - fDist0 );
+ const Point& rPt2 = rPoly[ nIdx - 1 ];
+ double fWidth = rPt.X() - rPt2.X();
+ double fHeight= rPt.Y() - rPt2.Y();
+ fWidth *= fd;
+ fHeight*= fd;
+ fx1 = rPt2.X() + fWidth;
+ fy1 = rPt2.Y() + fHeight;
+ }
+ }
+}
+
+void FitTextOutlinesToShapeOutlines( const PolyPolygon& aOutlines2d, FWData& rFWData )
+{
+ std::vector< FWTextArea >::iterator aTextAreaIter = rFWData.vTextAreas.begin();
+ std::vector< FWTextArea >::iterator aTextAreaIEnd = rFWData.vTextAreas.end();
+
+ sal_uInt16 nOutline2dIdx = 0;
+ while( aTextAreaIter != aTextAreaIEnd )
+ {
+ Rectangle rTextAreaBoundRect = aTextAreaIter->aBoundRect;
+ sal_Int32 nLeft = rTextAreaBoundRect.Left();
+ sal_Int32 nTop = rTextAreaBoundRect.Top();
+ sal_Int32 nWidth = rTextAreaBoundRect.GetWidth();
+ sal_Int32 nHeight= rTextAreaBoundRect.GetHeight();
+ if ( rFWData.bSingleLineMode && nHeight && nWidth )
+ {
+ if ( nOutline2dIdx >= aOutlines2d.Count() )
+ break;
+ const Polygon& rOutlinePoly( aOutlines2d[ nOutline2dIdx++ ] );
+ const sal_uInt16 nPointCount = rOutlinePoly.GetSize();
+ if ( nPointCount > 1 )
+ {
+ std::vector< double > vDistances;
+ vDistances.reserve( nPointCount );
+ CalcDistances( rOutlinePoly, vDistances );
+ if ( vDistances.size() )
+ {
+ std::vector< FWParagraphData >::iterator aParagraphIter( aTextAreaIter->vParagraphs.begin() );
+ std::vector< FWParagraphData >::iterator aParagraphIEnd( aTextAreaIter->vParagraphs.end() );
+ while( aParagraphIter != aParagraphIEnd )
+ {
+ std::vector< FWCharacterData >::iterator aCharacterIter( aParagraphIter->vCharacters.begin() );
+ std::vector< FWCharacterData >::iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
+ while ( aCharacterIter != aCharacterIEnd )
+ {
+ std::vector< PolyPolygon >::iterator aOutlineIter = aCharacterIter->vOutlines.begin();
+ std::vector< PolyPolygon >::iterator aOutlineIEnd = aCharacterIter->vOutlines.end();
+ while( aOutlineIter != aOutlineIEnd )
+ {
+ PolyPolygon& rPolyPoly = *aOutlineIter;
+ Rectangle aBoundRect( rPolyPoly.GetBoundRect() );
+ double fx1 = aBoundRect.Left() - nLeft;
+ double fx2 = aBoundRect.Right() - nLeft;
+ double fy1, fy2;
+ double fM1 = fx1 / (double)nWidth;
+ double fM2 = fx2 / (double)nWidth;
+
+ GetPoint( rOutlinePoly, vDistances, fM1, fx1, fy1 );
+ GetPoint( rOutlinePoly, vDistances, fM2, fx2, fy2 );
+
+ double fvx = ( fy2 - fy1 );
+ double fvy = - ( fx2 - fx1 );
+ fx1 = fx1 + ( ( fx2 - fx1 ) * 0.5 );
+ fy1 = fy1 + ( ( fy2 - fy1 ) * 0.5 );
+
+ double fAngle = atan2( -fvx, -fvy );
+ double fL = hypot( fvx, fvy );
+ fvx = fvx / fL;
+ fvy = fvy / fL;
+ fL = (double)( aTextAreaIter->aBoundRect.GetHeight() / 2.0 + aTextAreaIter->aBoundRect.Top() ) - aParagraphIter->aBoundRect.Center().Y();
+ fvx *= fL;
+ fvy *= fL;
+ rPolyPoly.Rotate( Point( aBoundRect.Center().X(), aParagraphIter->aBoundRect.Center().Y() ), sin( fAngle ), cos( fAngle ) );
+ rPolyPoly.Move( (sal_Int32)( ( fx1 + fvx )- aBoundRect.Center().X() ), (sal_Int32)( ( fy1 + fvy ) - aParagraphIter->aBoundRect.Center().Y() ) );
+
+ aOutlineIter++;
+ }
+ aCharacterIter++;
+ }
+ aParagraphIter++;
+ }
+ }
+ }
+ }
+ else
+ {
+ if ( ( nOutline2dIdx + 1 ) >= aOutlines2d.Count() )
+ break;
+ const Polygon& rOutlinePoly( aOutlines2d[ nOutline2dIdx++ ] );
+ const Polygon& rOutlinePoly2( aOutlines2d[ nOutline2dIdx++ ] );
+ const sal_uInt16 nPointCount = rOutlinePoly.GetSize();
+ const sal_uInt16 nPointCount2 = rOutlinePoly2.GetSize();
+ if ( ( nPointCount > 1 ) && ( nPointCount2 > 1 ) )
+ {
+ std::vector< double > vDistances;
+ vDistances.reserve( nPointCount );
+ std::vector< double > vDistances2;
+ vDistances2.reserve( nPointCount2 );
+ CalcDistances( rOutlinePoly, vDistances );
+ CalcDistances( rOutlinePoly2, vDistances2 );
+ std::vector< FWParagraphData >::iterator aParagraphIter = aTextAreaIter->vParagraphs.begin();
+ std::vector< FWParagraphData >::iterator aParagraphIEnd = aTextAreaIter->vParagraphs.end();
+ while( aParagraphIter != aParagraphIEnd )
+ {
+ std::vector< FWCharacterData >::iterator aCharacterIter( aParagraphIter->vCharacters.begin() );
+ std::vector< FWCharacterData >::iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
+ while ( aCharacterIter != aCharacterIEnd )
+ {
+ std::vector< PolyPolygon >::iterator aOutlineIter = aCharacterIter->vOutlines.begin();
+ std::vector< PolyPolygon >::iterator aOutlineIEnd = aCharacterIter->vOutlines.end();
+ while( aOutlineIter != aOutlineIEnd )
+ {
+ PolyPolygon& rPolyPoly = *aOutlineIter;
+ sal_uInt16 i, nPolyCount = rPolyPoly.Count();
+ for ( i = 0; i < nPolyCount; i++ )
+ {
+ // #i35928#
+ basegfx::B2DPolygon aCandidate(rPolyPoly[ i ].getB2DPolygon());
+
+ if(aCandidate.areControlPointsUsed())
+ {
+ aCandidate = basegfx::tools::adaptiveSubdivideByAngle(aCandidate);
+ }
+
+ // create local polygon copy to work on
+ Polygon aLocalPoly(aCandidate);
+
+ InsertMissingOutlinePoints( rOutlinePoly, vDistances, rTextAreaBoundRect, aLocalPoly );
+ InsertMissingOutlinePoints( rOutlinePoly2, vDistances2, rTextAreaBoundRect, aLocalPoly );
+
+ sal_uInt16 j, _nPointCount = aLocalPoly.GetSize();
+ for ( j = 0; j < _nPointCount; j++ )
+ {
+ Point& rPoint = aLocalPoly[ j ];
+ rPoint.X() -= nLeft;
+ rPoint.Y() -= nTop;
+ double fX = (double)rPoint.X() / (double)nWidth;
+ double fY = (double)rPoint.Y() / (double)nHeight;
+
+ double fx1, fy1, fx2, fy2;
+ GetPoint( rOutlinePoly, vDistances, fX, fx1, fy1 );
+ GetPoint( rOutlinePoly2, vDistances2, fX, fx2, fy2 );
+ double fWidth = fx2 - fx1;
+ double fHeight= fy2 - fy1;
+ rPoint.X() = (sal_Int32)( fx1 + fWidth * fY );
+ rPoint.Y() = (sal_Int32)( fy1 + fHeight* fY );
+ }
+
+ // write back polygon
+ rPolyPoly[ i ] = aLocalPoly;
+ }
+ aOutlineIter++;
+ }
+ aCharacterIter++;
+ }
+ aParagraphIter++;
+ }
+ }
+ }
+ aTextAreaIter++;
+ }
+}
+
+SdrObject* CreateSdrObjectFromParagraphOutlines( const FWData& rFWData, const SdrObject* pCustomShape )
+{
+ SdrObject* pRet = NULL;
+ if ( rFWData.vTextAreas.size() )
+ {
+ pRet = new SdrObjGroup();
+// SJ: not setting model, so we save a lot of broadcasting and the model is not modified any longer
+// pRet->SetModel( pCustomShape->GetModel() );
+ std::vector< FWTextArea >::const_iterator aTextAreaIter = rFWData.vTextAreas.begin();
+ std::vector< FWTextArea >::const_iterator aTextAreaIEnd = rFWData.vTextAreas.end();
+ while ( aTextAreaIter != aTextAreaIEnd )
+ {
+ std::vector< FWParagraphData >::const_iterator aParagraphIter = aTextAreaIter->vParagraphs.begin();
+ std::vector< FWParagraphData >::const_iterator aParagraphIEnd = aTextAreaIter->vParagraphs.end();
+ while ( aParagraphIter != aParagraphIEnd )
+ {
+ std::vector< FWCharacterData >::const_iterator aCharacterIter( aParagraphIter->vCharacters.begin() );
+ std::vector< FWCharacterData >::const_iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
+ while ( aCharacterIter != aCharacterIEnd )
+ {
+ std::vector< PolyPolygon >::const_iterator aOutlineIter = aCharacterIter->vOutlines.begin();
+ std::vector< PolyPolygon >::const_iterator aOutlineIEnd = aCharacterIter->vOutlines.end();
+ while( aOutlineIter != aOutlineIEnd )
+ {
+ SdrObject* pPathObj = new SdrPathObj( OBJ_POLY, aOutlineIter->getB2DPolyPolygon() );
+ // SJ: not setting model, so we save a lot of broadcasting and the model is not modified any longer
+ // pPathObj->SetModel( pCustomShape->GetModel() );
+ ((SdrObjGroup*)pRet)->GetSubList()->NbcInsertObject( pPathObj );
+ aOutlineIter++;
+ }
+ aCharacterIter++;
+ }
+ aParagraphIter++;
+ }
+ aTextAreaIter++;
+ }
+
+ Point aP( pCustomShape->GetSnapRect().Center() );
+ Size aS( pCustomShape->GetLogicRect().GetSize() );
+ aP.X() -= aS.Width() / 2;
+ aP.Y() -= aS.Height() / 2;
+ Rectangle aLogicRect( aP, aS );
+
+ SfxItemSet aSet( pCustomShape->GetMergedItemSet() );
+ aSet.ClearItem( SDRATTR_TEXTDIRECTION ); //SJ: vertical writing is not required, by removing this item no outliner is created
+ aSet.Put(SdrShadowItem(sal_False)); // #i37011# NO shadow for FontWork geometry
+ pRet->SetMergedItemSet( aSet ); // * otherwise we would crash, because the outliner tries to create a Paraobject, but there is no model
+ }
+ return pRet;
+}
+
+::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > EnhancedCustomShapeFontWork::mxBreakIterator = 0;
+
+Reference < i18n::XBreakIterator > EnhancedCustomShapeFontWork::GetBreakIterator()
+{
+ if ( !mxBreakIterator.is() )
+ {
+ Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ Reference < XInterface > xI = xMSF->createInstance( rtl::OUString::createFromAscii( "com.sun.star.i18n.BreakIterator" ) );
+ if ( xI.is() )
+ {
+ Any x = xI->queryInterface( ::getCppuType((const Reference< i18n::XBreakIterator >*)0) );
+ x >>= mxBreakIterator;
+ }
+ }
+ return mxBreakIterator;
+}
+
+SdrObject* EnhancedCustomShapeFontWork::CreateFontWork( const SdrObject* pShape2d, const SdrObject* pCustomShape )
+{
+ SdrObject* pRet = NULL;
+
+ Rectangle aLogicRect( pCustomShape->GetLogicRect() );
+ PolyPolygon aOutlines2d( GetOutlinesFromShape2d( pShape2d ) );
+ sal_uInt16 nOutlinesCount2d = aOutlines2d.Count();
+ if ( nOutlinesCount2d )
+ {
+ FWData aFWData;
+ if ( InitializeFontWorkData( pCustomShape, nOutlinesCount2d, aFWData ) )
+ {
+ /* retrieves the horizontal scaling factor that has to be used
+ to fit each paragraph text into its corresponding 2d outline */
+ CalculateHorizontalScalingFactor( pCustomShape, aFWData, aOutlines2d );
+
+ /* retrieving the Outlines for the each Paragraph. */
+
+ GetFontWorkOutline( aFWData, pCustomShape );
+
+ FitTextOutlinesToShapeOutlines( aOutlines2d, aFWData );
+
+ pRet = CreateSdrObjectFromParagraphOutlines( aFWData, pCustomShape );
+ }
+ }
+ return pRet;
+}
diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.hxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.hxx
new file mode 100644
index 000000000000..8d96aceedd9d
--- /dev/null
+++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.hxx
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ENHANCEDCUSTOMSHAPEFONTWORK_HXX
+#define _ENHANCEDCUSTOMSHAPEFONTWORK_HXX
+
+#include <com/sun/star/i18n/XBreakIterator.hpp>
+
+class SdrObject;
+class EnhancedCustomShapeFontWork
+{
+ static ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > mxBreakIterator;
+
+ public :
+
+ static com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > GetBreakIterator();
+ static SdrObject* CreateFontWork( const SdrObject* pShape2d, const SdrObject* pCustomShape );
+};
+
+#endif
+
diff --git a/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx b/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx
new file mode 100644
index 000000000000..dafd0d868963
--- /dev/null
+++ b/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx
@@ -0,0 +1,1212 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "svx/EnhancedCustomShape2d.hxx"
+#include <rtl/ustring.hxx>
+#include <tools/fract.hxx>
+
+// Makes parser a static resource,
+// we're synchronized externally.
+// But watch out, the parser might have
+// state not visible to this code!
+
+#define BOOST_SPIRIT_SINGLE_GRAMMAR_INSTANCE
+#if defined(VERBOSE) && defined(DBG_UTIL)
+#include <typeinfo>
+#define BOOST_SPIRIT_DEBUG
+#endif
+#include <boost/spirit/include/classic_core.hpp>
+
+#if (OSL_DEBUG_LEVEL > 0)
+#include <iostream>
+#endif
+#include <functional>
+#include <algorithm>
+#include <stack>
+
+#include <math.h> // fabs, sqrt, sin, cos, tan, atan, atan2
+using namespace EnhancedCustomShape;
+using namespace com::sun::star;
+using namespace com::sun::star::drawing;
+
+void EnhancedCustomShape::FillEquationParameter( const EnhancedCustomShapeParameter& rSource, const sal_Int32 nDestPara, EnhancedCustomShapeEquation& rDest )
+{
+ sal_Int32 nValue = 0;
+ if ( rSource.Value.getValueTypeClass() == uno::TypeClass_DOUBLE )
+ {
+ double fValue;
+ if ( rSource.Value >>= fValue )
+ nValue = (sal_Int32)fValue;
+ }
+ else
+ rSource.Value >>= nValue;
+
+ switch( rSource.Type )
+ {
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::EQUATION :
+ {
+ if ( nValue & 0x40000000 )
+ {
+ nValue ^= 0x40000000;
+ rDest.nOperation |= 0x20000000 << nDestPara; // the bit is indicating that this value has to be adjusted later
+ }
+ nValue |= 0x400;
+ }
+ break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::ADJUSTMENT : nValue += DFF_Prop_adjustValue; break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::BOTTOM : nValue = DFF_Prop_geoBottom; break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::RIGHT : nValue = DFF_Prop_geoRight; break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::TOP : nValue = DFF_Prop_geoTop; break;
+ case com::sun::star::drawing::EnhancedCustomShapeParameterType::LEFT : nValue = DFF_Prop_geoLeft; break;
+ }
+ if ( rSource.Type != com::sun::star::drawing::EnhancedCustomShapeParameterType::NORMAL )
+ rDest.nOperation |= ( 0x2000 << nDestPara );
+ rDest.nPara[ nDestPara ] = nValue;
+}
+
+ExpressionNode::~ExpressionNode()
+{}
+
+namespace
+{
+
+//////////////////////
+//////////////////////
+// EXPRESSION NODES
+//////////////////////
+//////////////////////
+class ConstantValueExpression : public ExpressionNode
+{
+ double maValue;
+
+public:
+
+ ConstantValueExpression( double rValue ) :
+ maValue( rValue )
+ {
+ }
+ virtual double operator()() const
+ {
+ return maValue;
+ }
+ virtual bool isConstant() const
+ {
+ return true;
+ }
+ virtual ExpressionFunct getType() const
+ {
+ return FUNC_CONST;
+ }
+ virtual EnhancedCustomShapeParameter fillNode( std::vector< EnhancedCustomShapeEquation >& rEquations, ExpressionNode* /* pOptionalArg */, sal_uInt32 /* nFlags */ )
+ {
+ EnhancedCustomShapeParameter aRet;
+ Fraction aFract( maValue );
+ if ( aFract.GetDenominator() == 1 )
+ {
+ aRet.Type = EnhancedCustomShapeParameterType::NORMAL;
+ aRet.Value <<= (sal_Int32)aFract.GetNumerator();
+ }
+ else
+ {
+ EnhancedCustomShapeEquation aEquation;
+ aEquation.nOperation = 1;
+ aEquation.nPara[ 0 ] = 1;
+ aEquation.nPara[ 1 ] = (sal_Int16)aFract.GetNumerator();
+ aEquation.nPara[ 2 ] = (sal_Int16)aFract.GetDenominator();
+ aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
+ aRet.Value <<= (sal_Int32)rEquations.size();
+ rEquations.push_back( aEquation );
+ }
+ return aRet;
+ }
+};
+
+class AdjustmentExpression : public ExpressionNode
+{
+ sal_Int32 mnIndex;
+ const EnhancedCustomShape2d& mrCustoShape;
+
+public:
+
+ AdjustmentExpression( const EnhancedCustomShape2d& rCustoShape, sal_Int32 nIndex )
+ : mnIndex ( nIndex )
+ , mrCustoShape( rCustoShape )
+
+ {
+ }
+ virtual double operator()() const
+ {
+ return mrCustoShape.GetAdjustValueAsDouble( mnIndex );
+ }
+ virtual bool isConstant() const
+ {
+ return false;
+ }
+ virtual ExpressionFunct getType() const
+ {
+ return ENUM_FUNC_ADJUSTMENT;
+ }
+ virtual EnhancedCustomShapeParameter fillNode( std::vector< EnhancedCustomShapeEquation >& /*rEquations*/, ExpressionNode* /*pOptionalArg*/, sal_uInt32 /*nFlags*/ )
+ {
+ EnhancedCustomShapeParameter aRet;
+ aRet.Type = EnhancedCustomShapeParameterType::ADJUSTMENT;
+ aRet.Value <<= mnIndex;
+ return aRet;
+ }
+};
+
+class EquationExpression : public ExpressionNode
+{
+ sal_Int32 mnIndex;
+ const EnhancedCustomShape2d& mrCustoShape;
+
+public:
+
+ EquationExpression( const EnhancedCustomShape2d& rCustoShape, sal_Int32 nIndex )
+ : mnIndex ( nIndex )
+ , mrCustoShape( rCustoShape )
+ {
+ }
+ virtual double operator()() const
+ {
+ return mrCustoShape.GetEquationValueAsDouble( mnIndex );
+ }
+ virtual bool isConstant() const
+ {
+ return false;
+ }
+ virtual ExpressionFunct getType() const
+ {
+ return ENUM_FUNC_EQUATION;
+ }
+ virtual EnhancedCustomShapeParameter fillNode( std::vector< EnhancedCustomShapeEquation >& /*rEquations*/, ExpressionNode* /*pOptionalArg*/, sal_uInt32 /*nFlags*/ )
+ {
+ EnhancedCustomShapeParameter aRet;
+ aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
+ aRet.Value <<= mnIndex | 0x40000000; // the bit is indicating that this equation needs to be adjusted later
+ return aRet;
+ }
+};
+
+class EnumValueExpression : public ExpressionNode
+{
+ const ExpressionFunct meFunct;
+ const EnhancedCustomShape2d& mrCustoShape;
+
+public:
+
+ EnumValueExpression( const EnhancedCustomShape2d& rCustoShape, const ExpressionFunct eFunct )
+ : meFunct ( eFunct )
+ , mrCustoShape ( rCustoShape )
+ {
+ }
+ static double getValue( const EnhancedCustomShape2d& rCustoShape, const ExpressionFunct eFunc )
+ {
+ EnhancedCustomShape2d::EnumFunc eF;
+ switch( eFunc )
+ {
+ case ENUM_FUNC_PI : eF = EnhancedCustomShape2d::ENUM_FUNC_PI; break;
+ case ENUM_FUNC_LEFT : eF = EnhancedCustomShape2d::ENUM_FUNC_LEFT; break;
+ case ENUM_FUNC_TOP : eF = EnhancedCustomShape2d::ENUM_FUNC_TOP; break;
+ case ENUM_FUNC_RIGHT : eF = EnhancedCustomShape2d::ENUM_FUNC_RIGHT; break;
+ case ENUM_FUNC_BOTTOM : eF = EnhancedCustomShape2d::ENUM_FUNC_BOTTOM; break;
+ case ENUM_FUNC_XSTRETCH : eF = EnhancedCustomShape2d::ENUM_FUNC_XSTRETCH; break;
+ case ENUM_FUNC_YSTRETCH : eF = EnhancedCustomShape2d::ENUM_FUNC_YSTRETCH; break;
+ case ENUM_FUNC_HASSTROKE : eF = EnhancedCustomShape2d::ENUM_FUNC_HASSTROKE; break;
+ case ENUM_FUNC_HASFILL : eF = EnhancedCustomShape2d::ENUM_FUNC_HASFILL; break;
+ case ENUM_FUNC_WIDTH : eF = EnhancedCustomShape2d::ENUM_FUNC_WIDTH; break;
+ case ENUM_FUNC_HEIGHT : eF = EnhancedCustomShape2d::ENUM_FUNC_HEIGHT; break;
+ case ENUM_FUNC_LOGWIDTH : eF = EnhancedCustomShape2d::ENUM_FUNC_LOGWIDTH; break;
+ case ENUM_FUNC_LOGHEIGHT : eF = EnhancedCustomShape2d::ENUM_FUNC_LOGHEIGHT; break;
+
+ default :
+ return 0.0;
+ }
+ return rCustoShape.GetEnumFunc( eF );
+ }
+ virtual double operator()() const
+ {
+ return getValue( mrCustoShape, meFunct );
+ }
+ virtual bool isConstant() const
+ {
+ return false;
+ }
+ virtual ExpressionFunct getType() const
+ {
+ return meFunct;
+ }
+ virtual EnhancedCustomShapeParameter fillNode( std::vector< EnhancedCustomShapeEquation >& rEquations, ExpressionNode* /*pOptionalArg*/, sal_uInt32 nFlags )
+ {
+ EnhancedCustomShapeParameter aRet;
+
+ sal_Int32 nDummy = 1;
+ aRet.Value <<= nDummy;
+
+ switch( meFunct )
+ {
+ case ENUM_FUNC_WIDTH : // TODO: do not use this as constant value
+ case ENUM_FUNC_HEIGHT :
+ case ENUM_FUNC_LOGWIDTH :
+ case ENUM_FUNC_LOGHEIGHT :
+ case ENUM_FUNC_PI :
+ {
+ ConstantValueExpression aConstantValue( getValue( mrCustoShape, meFunct ) );
+ aRet = aConstantValue.fillNode( rEquations, NULL, nFlags );
+ }
+ break;
+ case ENUM_FUNC_LEFT : aRet.Type = EnhancedCustomShapeParameterType::LEFT; break;
+ case ENUM_FUNC_TOP : aRet.Type = EnhancedCustomShapeParameterType::TOP; break;
+ case ENUM_FUNC_RIGHT : aRet.Type = EnhancedCustomShapeParameterType::RIGHT; break;
+ case ENUM_FUNC_BOTTOM : aRet.Type = EnhancedCustomShapeParameterType::BOTTOM; break;
+
+ // not implemented so far
+ case ENUM_FUNC_XSTRETCH :
+ case ENUM_FUNC_YSTRETCH :
+ case ENUM_FUNC_HASSTROKE :
+ case ENUM_FUNC_HASFILL : aRet.Type = EnhancedCustomShapeParameterType::NORMAL; break;
+
+ default:
+ break;
+ }
+ return aRet;
+ }
+};
+
+/** ExpressionNode implementation for unary
+ function over one ExpressionNode
+ */
+class UnaryFunctionExpression : public ExpressionNode
+{
+ const ExpressionFunct meFunct;
+ ExpressionNodeSharedPtr mpArg;
+
+public:
+ UnaryFunctionExpression( const ExpressionFunct eFunct, const ExpressionNodeSharedPtr& rArg ) :
+ meFunct( eFunct ),
+ mpArg( rArg )
+ {
+ }
+ static double getValue( const ExpressionFunct eFunct, const ExpressionNodeSharedPtr& rArg )
+ {
+ double fRet = 0;
+ switch( eFunct )
+ {
+ case UNARY_FUNC_ABS : fRet = fabs( (*rArg)() ); break;
+ case UNARY_FUNC_SQRT: fRet = sqrt( (*rArg)() ); break;
+ case UNARY_FUNC_SIN : fRet = sin( (*rArg)() ); break;
+ case UNARY_FUNC_COS : fRet = cos( (*rArg)() ); break;
+ case UNARY_FUNC_TAN : fRet = tan( (*rArg)() ); break;
+ case UNARY_FUNC_ATAN: fRet = atan( (*rArg)() ); break;
+ case UNARY_FUNC_NEG : fRet = ::std::negate<double>()( (*rArg)() ); break;
+ default:
+ break;
+ }
+ return fRet;
+ }
+ virtual double operator()() const
+ {
+ return getValue( meFunct, mpArg );
+ }
+ virtual bool isConstant() const
+ {
+ return mpArg->isConstant();
+ }
+ virtual ExpressionFunct getType() const
+ {
+ return meFunct;
+ }
+ virtual EnhancedCustomShapeParameter fillNode( std::vector< EnhancedCustomShapeEquation >& rEquations, ExpressionNode* pOptionalArg, sal_uInt32 nFlags )
+ {
+ EnhancedCustomShapeParameter aRet;
+ switch( meFunct )
+ {
+ case UNARY_FUNC_ABS :
+ {
+ EnhancedCustomShapeEquation aEquation;
+ aEquation.nOperation |= 3;
+ FillEquationParameter( mpArg->fillNode( rEquations, NULL, nFlags ), 0, aEquation );
+ aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
+ aRet.Value <<= (sal_Int32)rEquations.size();
+ rEquations.push_back( aEquation );
+ }
+ break;
+ case UNARY_FUNC_SQRT:
+ {
+ EnhancedCustomShapeEquation aEquation;
+ aEquation.nOperation |= 13;
+ FillEquationParameter( mpArg->fillNode( rEquations, NULL, nFlags ), 0, aEquation );
+ aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
+ aRet.Value <<= (sal_Int32)rEquations.size();
+ rEquations.push_back( aEquation );
+ }
+ break;
+ case UNARY_FUNC_SIN :
+ {
+ EnhancedCustomShapeEquation aEquation;
+ aEquation.nOperation |= 9;
+ if ( pOptionalArg )
+ FillEquationParameter( pOptionalArg->fillNode( rEquations, NULL, nFlags ), 0, aEquation );
+ else
+ aEquation.nPara[ 0 ] = 1;
+
+ EnhancedCustomShapeParameter aSource( mpArg->fillNode( rEquations, NULL, nFlags | EXPRESSION_FLAG_SUMANGLE_MODE ) );
+ if ( aSource.Type == EnhancedCustomShapeParameterType::NORMAL )
+ { // sumangle needed :-(
+ EnhancedCustomShapeEquation _aEquation;
+ _aEquation.nOperation |= 0xe; // sumangle
+ FillEquationParameter( aSource, 1, _aEquation );
+ aSource.Type = EnhancedCustomShapeParameterType::EQUATION;
+ aSource.Value <<= (sal_Int32)rEquations.size();
+ rEquations.push_back( _aEquation );
+ }
+ FillEquationParameter( aSource, 1, aEquation );
+ aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
+ aRet.Value <<= (sal_Int32)rEquations.size();
+ rEquations.push_back( aEquation );
+ }
+ break;
+ case UNARY_FUNC_COS :
+ {
+ EnhancedCustomShapeEquation aEquation;
+ aEquation.nOperation |= 10;
+ if ( pOptionalArg )
+ FillEquationParameter( pOptionalArg->fillNode( rEquations, NULL, nFlags ), 0, aEquation );
+ else
+ aEquation.nPara[ 0 ] = 1;
+
+ EnhancedCustomShapeParameter aSource( mpArg->fillNode( rEquations, NULL, nFlags | EXPRESSION_FLAG_SUMANGLE_MODE ) );
+ if ( aSource.Type == EnhancedCustomShapeParameterType::NORMAL )
+ { // sumangle needed :-(
+ EnhancedCustomShapeEquation aTmpEquation;
+ aTmpEquation.nOperation |= 0xe; // sumangle
+ FillEquationParameter( aSource, 1, aTmpEquation );
+ aSource.Type = EnhancedCustomShapeParameterType::EQUATION;
+ aSource.Value <<= (sal_Int32)rEquations.size();
+ rEquations.push_back( aTmpEquation );
+ }
+ FillEquationParameter( aSource, 1, aEquation );
+ aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
+ aRet.Value <<= (sal_Int32)rEquations.size();
+ rEquations.push_back( aEquation );
+ }
+ break;
+ case UNARY_FUNC_TAN :
+ {
+ EnhancedCustomShapeEquation aEquation;
+ aEquation.nOperation |= 16;
+ if ( pOptionalArg )
+ FillEquationParameter( pOptionalArg->fillNode( rEquations, NULL, nFlags ), 0, aEquation );
+ else
+ aEquation.nPara[ 0 ] = 1;
+
+ EnhancedCustomShapeParameter aSource( mpArg->fillNode( rEquations, NULL, nFlags | EXPRESSION_FLAG_SUMANGLE_MODE ) );
+ if ( aSource.Type == EnhancedCustomShapeParameterType::NORMAL )
+ { // sumangle needed :-(
+ EnhancedCustomShapeEquation aTmpEquation;
+ aTmpEquation.nOperation |= 0xe; // sumangle
+ FillEquationParameter( aSource, 1, aTmpEquation );
+ aSource.Type = EnhancedCustomShapeParameterType::EQUATION;
+ aSource.Value <<= (sal_Int32)rEquations.size();
+ rEquations.push_back( aTmpEquation );
+ }
+ FillEquationParameter( aSource, 1, aEquation );
+ aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
+ aRet.Value <<= (sal_Int32)rEquations.size();
+ rEquations.push_back( aEquation );
+ }
+ break;
+ case UNARY_FUNC_ATAN:
+ {
+// TODO:
+ aRet.Type = EnhancedCustomShapeParameterType::NORMAL;
+ }
+ break;
+ case UNARY_FUNC_NEG:
+ {
+ EnhancedCustomShapeEquation aEquation;
+ aEquation.nOperation |= 1;
+ aEquation.nPara[ 1 ] = -1;
+ aEquation.nPara[ 2 ] = 1;
+ FillEquationParameter( mpArg->fillNode( rEquations, NULL, nFlags ), 0, aEquation );
+ aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
+ aRet.Value <<= (sal_Int32)rEquations.size();
+ rEquations.push_back( aEquation );
+ }
+ break;
+ default:
+ break;
+ }
+ return aRet;
+ }
+};
+
+/** ExpressionNode implementation for unary
+ function over two ExpressionNodes
+ */
+class BinaryFunctionExpression : public ExpressionNode
+{
+ const ExpressionFunct meFunct;
+ ExpressionNodeSharedPtr mpFirstArg;
+ ExpressionNodeSharedPtr mpSecondArg;
+
+public:
+
+ BinaryFunctionExpression( const ExpressionFunct eFunct, const ExpressionNodeSharedPtr& rFirstArg, const ExpressionNodeSharedPtr& rSecondArg ) :
+ meFunct( eFunct ),
+ mpFirstArg( rFirstArg ),
+ mpSecondArg( rSecondArg )
+ {
+ }
+ static double getValue( const ExpressionFunct eFunct, const ExpressionNodeSharedPtr& rFirstArg, const ExpressionNodeSharedPtr& rSecondArg )
+ {
+ double fRet = 0;
+ switch( eFunct )
+ {
+ case BINARY_FUNC_PLUS : fRet = (*rFirstArg)() + (*rSecondArg)(); break;
+ case BINARY_FUNC_MINUS: fRet = (*rFirstArg)() - (*rSecondArg)(); break;
+ case BINARY_FUNC_MUL : fRet = (*rFirstArg)() * (*rSecondArg)(); break;
+ case BINARY_FUNC_DIV : fRet = (*rFirstArg)() / (*rSecondArg)(); break;
+ case BINARY_FUNC_MIN : fRet = ::std::min( (*rFirstArg)(), (*rSecondArg)() ); break;
+ case BINARY_FUNC_MAX : fRet = ::std::max( (*rFirstArg)(), (*rSecondArg)() ); break;
+ case BINARY_FUNC_ATAN2: fRet = atan2( (*rFirstArg)(), (*rSecondArg)() ); break;
+ default:
+ break;
+ }
+ return fRet;
+ }
+ virtual double operator()() const
+ {
+ return getValue( meFunct, mpFirstArg, mpSecondArg );
+ }
+ virtual bool isConstant() const
+ {
+ return mpFirstArg->isConstant() && mpSecondArg->isConstant();
+ }
+ virtual ExpressionFunct getType() const
+ {
+ return meFunct;
+ }
+ virtual EnhancedCustomShapeParameter fillNode( std::vector< EnhancedCustomShapeEquation >& rEquations, ExpressionNode* /*pOptionalArg*/, sal_uInt32 nFlags )
+ {
+ EnhancedCustomShapeParameter aRet;
+ switch( meFunct )
+ {
+ case BINARY_FUNC_PLUS :
+ {
+ if ( nFlags & EXPRESSION_FLAG_SUMANGLE_MODE )
+ {
+ if ( mpFirstArg->getType() == ENUM_FUNC_ADJUSTMENT )
+ {
+ EnhancedCustomShapeEquation aEquation;
+ aEquation.nOperation |= 0xe; // sumangle
+ FillEquationParameter( mpFirstArg->fillNode( rEquations, NULL, nFlags ), 0, aEquation );
+ FillEquationParameter( mpSecondArg->fillNode( rEquations, NULL, nFlags ), 1, aEquation );
+ aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
+ aRet.Value <<= (sal_Int32)rEquations.size();
+ rEquations.push_back( aEquation );
+ }
+ else if ( mpSecondArg->getType() == ENUM_FUNC_ADJUSTMENT )
+ {
+ EnhancedCustomShapeEquation aEquation;
+ aEquation.nOperation |= 0xe; // sumangle
+ FillEquationParameter( mpSecondArg->fillNode( rEquations, NULL, nFlags ), 0, aEquation );
+ FillEquationParameter( mpFirstArg->fillNode( rEquations, NULL, nFlags ), 1, aEquation );
+ aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
+ aRet.Value <<= (sal_Int32)rEquations.size();
+ rEquations.push_back( aEquation );
+ }
+ else
+ {
+ EnhancedCustomShapeEquation aSumangle1;
+ aSumangle1.nOperation |= 0xe; // sumangle
+ FillEquationParameter( mpFirstArg->fillNode( rEquations, NULL, nFlags &~EXPRESSION_FLAG_SUMANGLE_MODE ), 1, aSumangle1 );
+ aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
+ aRet.Value <<= (sal_Int32)rEquations.size();
+ rEquations.push_back( aSumangle1 );
+
+ EnhancedCustomShapeEquation aSumangle2;
+ aSumangle2.nOperation |= 0xe; // sumangle
+ FillEquationParameter( mpSecondArg->fillNode( rEquations, NULL, nFlags &~EXPRESSION_FLAG_SUMANGLE_MODE ), 1, aSumangle2 );
+ aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
+ aRet.Value <<= (sal_Int32)rEquations.size();
+ rEquations.push_back( aSumangle2 );
+
+ EnhancedCustomShapeEquation aEquation;
+ aEquation.nOperation |= 0;
+ aEquation.nPara[ 0 ] = ( rEquations.size() - 2 ) | 0x400;
+ aEquation.nPara[ 1 ] = ( rEquations.size() - 1 ) | 0x400;
+ aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
+ aRet.Value <<= (sal_Int32)rEquations.size();
+ rEquations.push_back( aEquation );
+ }
+ }
+ else
+ {
+ sal_Bool bFirstIsEmpty = mpFirstArg->isConstant() && ( (*mpFirstArg)() == 0 );
+ sal_Bool bSecondIsEmpty = mpSecondArg->isConstant() && ( (*mpSecondArg)() == 0 );
+
+ if ( bFirstIsEmpty )
+ aRet = mpSecondArg->fillNode( rEquations, NULL, nFlags );
+ else if ( bSecondIsEmpty )
+ aRet = mpFirstArg->fillNode( rEquations, NULL, nFlags );
+ else
+ {
+ EnhancedCustomShapeEquation aEquation;
+ aEquation.nOperation |= 0;
+ FillEquationParameter( mpFirstArg->fillNode( rEquations, NULL, nFlags ), 0, aEquation );
+ FillEquationParameter( mpSecondArg->fillNode( rEquations, NULL, nFlags ), 1, aEquation );
+ aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
+ aRet.Value <<= (sal_Int32)rEquations.size();
+ rEquations.push_back( aEquation );
+ }
+ }
+ }
+ break;
+ case BINARY_FUNC_MINUS:
+ {
+ EnhancedCustomShapeEquation aEquation;
+ aEquation.nOperation |= 0;
+ FillEquationParameter( mpFirstArg->fillNode( rEquations, NULL, nFlags ), 0, aEquation );
+ FillEquationParameter( mpSecondArg->fillNode( rEquations, NULL, nFlags ), 2, aEquation );
+ aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
+ aRet.Value <<= (sal_Int32)rEquations.size();
+ rEquations.push_back( aEquation );
+ }
+ break;
+ case BINARY_FUNC_MUL :
+ {
+ // in the dest. format the cos function is using integer as result :-(
+ // so we can't use the generic algorithm
+ if ( ( mpFirstArg->getType() == UNARY_FUNC_SIN ) || ( mpFirstArg->getType() == UNARY_FUNC_COS ) || ( mpFirstArg->getType() == UNARY_FUNC_TAN ) )
+ aRet = mpFirstArg->fillNode( rEquations, mpSecondArg.get(), nFlags );
+ else if ( ( mpSecondArg->getType() == UNARY_FUNC_SIN ) || ( mpSecondArg->getType() == UNARY_FUNC_COS ) || ( mpSecondArg->getType() == UNARY_FUNC_TAN ) )
+ aRet = mpSecondArg->fillNode( rEquations, mpFirstArg.get(), nFlags );
+ else
+ {
+ if ( mpFirstArg->isConstant() && (*mpFirstArg)() == 1 )
+ aRet = mpSecondArg->fillNode( rEquations, NULL, nFlags );
+ else if ( mpSecondArg->isConstant() && (*mpSecondArg)() == 1 )
+ aRet = mpFirstArg->fillNode( rEquations, NULL, nFlags );
+ else if ( ( mpFirstArg->getType() == BINARY_FUNC_DIV ) // don't care of (pi/180)
+ && ( ((BinaryFunctionExpression*)((BinaryFunctionExpression*)mpFirstArg.get())->mpFirstArg.get())->getType() == ENUM_FUNC_PI )
+ && ( ((BinaryFunctionExpression*)((BinaryFunctionExpression*)mpFirstArg.get())->mpSecondArg.get())->getType() == FUNC_CONST ) )
+ {
+ aRet = mpSecondArg->fillNode( rEquations, NULL, nFlags );
+ }
+ else if ( ( mpSecondArg->getType() == BINARY_FUNC_DIV ) // don't care of (pi/180)
+ && ( ((BinaryFunctionExpression*)((BinaryFunctionExpression*)mpSecondArg.get())->mpFirstArg.get())->getType() == ENUM_FUNC_PI )
+ && ( ((BinaryFunctionExpression*)((BinaryFunctionExpression*)mpSecondArg.get())->mpSecondArg.get())->getType() == FUNC_CONST ) )
+ {
+ aRet = mpFirstArg->fillNode( rEquations, NULL, nFlags );
+ }
+ else
+ {
+ EnhancedCustomShapeEquation aEquation;
+ aEquation.nOperation |= 1;
+ FillEquationParameter( mpFirstArg->fillNode( rEquations, NULL, nFlags ), 0, aEquation );
+ FillEquationParameter( mpSecondArg->fillNode( rEquations, NULL, nFlags ), 1, aEquation );
+ aEquation.nPara[ 2 ] = 1;
+ aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
+ aRet.Value <<= (sal_Int32)rEquations.size();
+ rEquations.push_back( aEquation );
+ }
+ }
+ }
+ break;
+ case BINARY_FUNC_DIV :
+ {
+ EnhancedCustomShapeEquation aEquation;
+ aEquation.nOperation |= 1;
+ FillEquationParameter( mpFirstArg->fillNode( rEquations, NULL, nFlags ), 0, aEquation );
+ aEquation.nPara[ 1 ] = 1;
+ FillEquationParameter( mpSecondArg->fillNode( rEquations, NULL, nFlags ), 2, aEquation );
+ aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
+ aRet.Value <<= (sal_Int32)rEquations.size();
+ rEquations.push_back( aEquation );
+ }
+ break;
+ case BINARY_FUNC_MIN :
+ {
+ EnhancedCustomShapeEquation aEquation;
+ aEquation.nOperation |= 4;
+ FillEquationParameter( mpFirstArg->fillNode( rEquations, NULL, nFlags ), 0, aEquation );
+ FillEquationParameter( mpSecondArg->fillNode( rEquations, NULL, nFlags ), 1, aEquation );
+ aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
+ aRet.Value <<= (sal_Int32)rEquations.size();
+ rEquations.push_back( aEquation );
+ }
+ break;
+ case BINARY_FUNC_MAX :
+ {
+ EnhancedCustomShapeEquation aEquation;
+ aEquation.nOperation |= 5;
+ FillEquationParameter( mpFirstArg->fillNode( rEquations, NULL, nFlags ), 0, aEquation );
+ FillEquationParameter( mpSecondArg->fillNode( rEquations, NULL, nFlags ), 1, aEquation );
+ aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
+ aRet.Value <<= (sal_Int32)rEquations.size();
+ rEquations.push_back( aEquation );
+ }
+ break;
+ case BINARY_FUNC_ATAN2:
+ {
+ EnhancedCustomShapeEquation aEquation;
+ aEquation.nOperation |= 8;
+ FillEquationParameter( mpSecondArg->fillNode( rEquations, NULL, nFlags ), 0, aEquation );
+ FillEquationParameter( mpFirstArg->fillNode( rEquations, NULL, nFlags ), 1, aEquation );
+ aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
+ aRet.Value <<= (sal_Int32)rEquations.size();
+ rEquations.push_back( aEquation );
+ }
+ break;
+ default:
+ break;
+ }
+ return aRet;
+ }
+};
+
+class IfExpression : public ExpressionNode
+{
+ ExpressionNodeSharedPtr mpFirstArg;
+ ExpressionNodeSharedPtr mpSecondArg;
+ ExpressionNodeSharedPtr mpThirdArg;
+
+public:
+
+ IfExpression( const ExpressionNodeSharedPtr& rFirstArg,
+ const ExpressionNodeSharedPtr& rSecondArg,
+ const ExpressionNodeSharedPtr& rThirdArg ) :
+ mpFirstArg( rFirstArg ),
+ mpSecondArg( rSecondArg ),
+ mpThirdArg( rThirdArg )
+ {
+ }
+ virtual bool isConstant() const
+ {
+ return
+ mpFirstArg->isConstant() &&
+ mpSecondArg->isConstant() &&
+ mpThirdArg->isConstant();
+ }
+ virtual double operator()() const
+ {
+ return (*mpFirstArg)() > 0 ? (*mpSecondArg)() : (*mpThirdArg)();
+ }
+ virtual ExpressionFunct getType() const
+ {
+ return TERNARY_FUNC_IF;
+ }
+ virtual EnhancedCustomShapeParameter fillNode( std::vector< EnhancedCustomShapeEquation >& rEquations, ExpressionNode* /*pOptionalArg*/, sal_uInt32 nFlags )
+ {
+ EnhancedCustomShapeParameter aRet;
+ aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
+ aRet.Value <<= (sal_Int32)rEquations.size();
+ {
+ EnhancedCustomShapeEquation aEquation;
+ aEquation.nOperation |= 6;
+ FillEquationParameter( mpFirstArg->fillNode( rEquations, NULL, nFlags ), 0, aEquation );
+ FillEquationParameter( mpSecondArg->fillNode( rEquations, NULL, nFlags ), 1, aEquation );
+ FillEquationParameter( mpThirdArg->fillNode( rEquations, NULL, nFlags ), 2, aEquation );
+ rEquations.push_back( aEquation );
+ }
+ return aRet;
+ }
+};
+
+////////////////////////
+////////////////////////
+// FUNCTION PARSER
+////////////////////////
+////////////////////////
+
+typedef const sal_Char* StringIteratorT;
+
+struct ParserContext
+{
+ typedef ::std::stack< ExpressionNodeSharedPtr > OperandStack;
+
+ // stores a stack of not-yet-evaluated operands. This is used
+ // by the operators (i.e. '+', '*', 'sin' etc.) to pop their
+ // arguments from. If all arguments to an operator are constant,
+ // the operator pushes a precalculated result on the stack, and
+ // a composite ExpressionNode otherwise.
+ OperandStack maOperandStack;
+
+ const EnhancedCustomShape2d* mpCustoShape;
+
+};
+
+typedef ::boost::shared_ptr< ParserContext > ParserContextSharedPtr;
+
+/** Generate apriori constant value
+ */
+
+class ConstantFunctor
+{
+ const double mnValue;
+ ParserContextSharedPtr mpContext;
+
+public:
+
+ ConstantFunctor( double rValue, const ParserContextSharedPtr& rContext ) :
+ mnValue( rValue ),
+ mpContext( rContext )
+ {
+ }
+ void operator()( StringIteratorT /*rFirst*/, StringIteratorT /*rSecond*/ ) const
+ {
+ mpContext->maOperandStack.push( ExpressionNodeSharedPtr( new ConstantValueExpression( mnValue ) ) );
+ }
+};
+
+/** Generate parse-dependent-but-then-constant value
+ */
+class DoubleConstantFunctor
+{
+ ParserContextSharedPtr mpContext;
+
+public:
+ DoubleConstantFunctor( const ParserContextSharedPtr& rContext ) :
+ mpContext( rContext )
+ {
+ }
+ void operator()( double n ) const
+ {
+ mpContext->maOperandStack.push( ExpressionNodeSharedPtr( new ConstantValueExpression( n ) ) );
+ }
+};
+
+class EnumFunctor
+{
+ const ExpressionFunct meFunct;
+ double mnValue;
+ ParserContextSharedPtr mpContext;
+
+public:
+
+ EnumFunctor( const ExpressionFunct eFunct, const ParserContextSharedPtr& rContext )
+ : meFunct( eFunct )
+ , mnValue( 0 )
+ , mpContext( rContext )
+ {
+ }
+ void operator()( StringIteratorT rFirst, StringIteratorT rSecond ) const
+ {
+ /*double nVal = mnValue;*/
+ switch( meFunct )
+ {
+ case ENUM_FUNC_ADJUSTMENT :
+ {
+ rtl::OUString aVal( rFirst + 1, rSecond - rFirst, RTL_TEXTENCODING_UTF8 );
+ mpContext->maOperandStack.push( ExpressionNodeSharedPtr( new AdjustmentExpression( *mpContext->mpCustoShape, aVal.toInt32() ) ) );
+ }
+ break;
+ case ENUM_FUNC_EQUATION :
+ {
+ rtl::OUString aVal( rFirst + 1, rSecond - rFirst, RTL_TEXTENCODING_UTF8 );
+ mpContext->maOperandStack.push( ExpressionNodeSharedPtr( new EquationExpression( *mpContext->mpCustoShape, aVal.toInt32() ) ) );
+ }
+ break;
+ default:
+ mpContext->maOperandStack.push( ExpressionNodeSharedPtr( new EnumValueExpression( *mpContext->mpCustoShape, meFunct ) ) );
+ }
+ }
+};
+
+class UnaryFunctionFunctor
+{
+ const ExpressionFunct meFunct;
+ ParserContextSharedPtr mpContext;
+
+public :
+
+ UnaryFunctionFunctor( const ExpressionFunct eFunct, const ParserContextSharedPtr& rContext ) :
+ meFunct( eFunct ),
+ mpContext( rContext )
+ {
+ }
+ void operator()( StringIteratorT, StringIteratorT ) const
+ {
+ ParserContext::OperandStack& rNodeStack( mpContext->maOperandStack );
+
+ if( rNodeStack.size() < 1 )
+ throw ParseError( "Not enough arguments for unary operator" );
+
+ // retrieve arguments
+ ExpressionNodeSharedPtr pArg( rNodeStack.top() );
+ rNodeStack.pop();
+
+ if( pArg->isConstant() ) // check for constness
+ rNodeStack.push( ExpressionNodeSharedPtr( new ConstantValueExpression( UnaryFunctionExpression::getValue( meFunct, pArg ) ) ) );
+ else // push complex node, that calcs the value on demand
+ rNodeStack.push( ExpressionNodeSharedPtr( new UnaryFunctionExpression( meFunct, pArg ) ) );
+ }
+};
+
+/** Implements a binary function over two ExpressionNodes
+
+ @tpl Generator
+ Generator functor, to generate an ExpressionNode of
+ appropriate type
+
+ */
+class BinaryFunctionFunctor
+{
+ const ExpressionFunct meFunct;
+ ParserContextSharedPtr mpContext;
+
+public:
+
+ BinaryFunctionFunctor( const ExpressionFunct eFunct, const ParserContextSharedPtr& rContext ) :
+ meFunct( eFunct ),
+ mpContext( rContext )
+ {
+ }
+
+ void operator()( StringIteratorT, StringIteratorT ) const
+ {
+ ParserContext::OperandStack& rNodeStack( mpContext->maOperandStack );
+
+ if( rNodeStack.size() < 2 )
+ throw ParseError( "Not enough arguments for binary operator" );
+
+ // retrieve arguments
+ ExpressionNodeSharedPtr pSecondArg( rNodeStack.top() );
+ rNodeStack.pop();
+ ExpressionNodeSharedPtr pFirstArg( rNodeStack.top() );
+ rNodeStack.pop();
+
+ // create combined ExpressionNode
+ ExpressionNodeSharedPtr pNode = ExpressionNodeSharedPtr( new BinaryFunctionExpression( meFunct, pFirstArg, pSecondArg ) );
+ // check for constness
+ if( pFirstArg->isConstant() && pSecondArg->isConstant() ) // call the operator() at pNode, store result in constant value ExpressionNode.
+ rNodeStack.push( ExpressionNodeSharedPtr( new ConstantValueExpression( (*pNode)() ) ) );
+ else // push complex node, that calcs the value on demand
+ rNodeStack.push( pNode );
+ }
+};
+
+class IfFunctor
+{
+ ParserContextSharedPtr mpContext;
+
+public :
+
+ IfFunctor( const ParserContextSharedPtr& rContext ) :
+ mpContext( rContext )
+ {
+ }
+ void operator()( StringIteratorT, StringIteratorT ) const
+ {
+ ParserContext::OperandStack& rNodeStack( mpContext->maOperandStack );
+
+ if( rNodeStack.size() < 3 )
+ throw ParseError( "Not enough arguments for ternary operator" );
+
+ // retrieve arguments
+ ExpressionNodeSharedPtr pThirdArg( rNodeStack.top() );
+ rNodeStack.pop();
+ ExpressionNodeSharedPtr pSecondArg( rNodeStack.top() );
+ rNodeStack.pop();
+ ExpressionNodeSharedPtr pFirstArg( rNodeStack.top() );
+ rNodeStack.pop();
+
+ // create combined ExpressionNode
+ ExpressionNodeSharedPtr pNode( new IfExpression( pFirstArg, pSecondArg, pThirdArg ) );
+ // check for constness
+ if( pFirstArg->isConstant() && pSecondArg->isConstant() && pThirdArg->isConstant() )
+ rNodeStack.push( ExpressionNodeSharedPtr( new ConstantValueExpression( (*pNode)() ) ) ); // call the operator() at pNode, store result in constant value ExpressionNode.
+ else
+ rNodeStack.push( pNode ); // push complex node, that calcs the value on demand
+ }
+};
+
+// Workaround for MSVC compiler anomaly (stack trashing)
+//
+// The default ureal_parser_policies implementation of parse_exp
+// triggers a really weird error in MSVC7 (Version 13.00.9466), in
+// that the real_parser_impl::parse_main() call of parse_exp()
+// overwrites the frame pointer _on the stack_ (EBP of the calling
+// function gets overwritten while lying on the stack).
+//
+// For the time being, our parser thus can only read the 1.0E10
+// notation, not the 1.0e10 one.
+//
+// TODO(F1): Also handle the 1.0e10 case here.
+template< typename T > struct custom_real_parser_policies : public ::boost::spirit::ureal_parser_policies<T>
+{
+ template< typename ScannerT >
+ static typename ::boost::spirit::parser_result< ::boost::spirit::chlit<>, ScannerT >::type
+ parse_exp(ScannerT& scan)
+ {
+ // as_lower_d somehow breaks MSVC7
+ return ::boost::spirit::ch_p('E').parse(scan);
+ }
+};
+
+/* This class implements the following grammar (more or
+ less literally written down below, only slightly
+ obfuscated by the parser actions):
+
+ identifier = '$'|'pi'|'e'|'X'|'Y'|'Width'|'Height'
+
+ function = 'abs'|'sqrt'|'sin'|'cos'|'tan'|'atan'|'acos'|'asin'|'exp'|'log'
+
+ basic_expression =
+ number |
+ identifier |
+ function '(' additive_expression ')' |
+ '(' additive_expression ')'
+
+ unary_expression =
+ '-' basic_expression |
+ basic_expression
+
+ multiplicative_expression =
+ unary_expression ( ( '*' unary_expression )* |
+ ( '/' unary_expression )* )
+
+ additive_expression =
+ multiplicative_expression ( ( '+' multiplicative_expression )* |
+ ( '-' multiplicative_expression )* )
+
+ */
+
+class ExpressionGrammar : public ::boost::spirit::grammar< ExpressionGrammar >
+{
+public:
+ /** Create an arithmetic expression grammar
+
+ @param rParserContext
+ Contains context info for the parser
+ */
+ ExpressionGrammar( const ParserContextSharedPtr& rParserContext ) :
+ mpParserContext( rParserContext )
+ {
+ }
+
+ template< typename ScannerT > class definition
+ {
+ public:
+ // grammar definition
+ definition( const ExpressionGrammar& self )
+ {
+ using ::boost::spirit::str_p;
+ using ::boost::spirit::range_p;
+ using ::boost::spirit::lexeme_d;
+ using ::boost::spirit::real_parser;
+ using ::boost::spirit::chseq_p;
+
+ identifier =
+ str_p( "pi" )[ EnumFunctor(ENUM_FUNC_PI, self.getContext() ) ]
+ | str_p( "left" )[ EnumFunctor(ENUM_FUNC_LEFT, self.getContext() ) ]
+ | str_p( "top" )[ EnumFunctor(ENUM_FUNC_TOP, self.getContext() ) ]
+ | str_p( "right" )[ EnumFunctor(ENUM_FUNC_RIGHT, self.getContext() ) ]
+ | str_p( "bottom" )[ EnumFunctor(ENUM_FUNC_BOTTOM, self.getContext() ) ]
+ | str_p( "xstretch" )[ EnumFunctor(ENUM_FUNC_XSTRETCH, self.getContext() ) ]
+ | str_p( "ystretch" )[ EnumFunctor(ENUM_FUNC_YSTRETCH, self.getContext() ) ]
+ | str_p( "hasstroke" )[ EnumFunctor(ENUM_FUNC_HASSTROKE, self.getContext() ) ]
+ | str_p( "hasfill" )[ EnumFunctor(ENUM_FUNC_HASFILL, self.getContext() ) ]
+ | str_p( "width" )[ EnumFunctor(ENUM_FUNC_WIDTH, self.getContext() ) ]
+ | str_p( "height" )[ EnumFunctor(ENUM_FUNC_HEIGHT, self.getContext() ) ]
+ | str_p( "logwidth" )[ EnumFunctor(ENUM_FUNC_LOGWIDTH, self.getContext() ) ]
+ | str_p( "logheight" )[ EnumFunctor(ENUM_FUNC_LOGHEIGHT, self.getContext() ) ]
+ ;
+
+ unaryFunction =
+ (str_p( "abs" ) >> '(' >> additiveExpression >> ')' )[ UnaryFunctionFunctor( UNARY_FUNC_ABS, self.getContext()) ]
+ | (str_p( "sqrt" ) >> '(' >> additiveExpression >> ')' )[ UnaryFunctionFunctor( UNARY_FUNC_SQRT, self.getContext()) ]
+ | (str_p( "sin" ) >> '(' >> additiveExpression >> ')' )[ UnaryFunctionFunctor( UNARY_FUNC_SIN, self.getContext()) ]
+ | (str_p( "cos" ) >> '(' >> additiveExpression >> ')' )[ UnaryFunctionFunctor( UNARY_FUNC_COS, self.getContext()) ]
+ | (str_p( "tan" ) >> '(' >> additiveExpression >> ')' )[ UnaryFunctionFunctor( UNARY_FUNC_TAN, self.getContext()) ]
+ | (str_p( "atan" ) >> '(' >> additiveExpression >> ')' )[ UnaryFunctionFunctor( UNARY_FUNC_ATAN, self.getContext()) ]
+ ;
+
+ binaryFunction =
+ (str_p( "min" ) >> '(' >> additiveExpression >> ',' >> additiveExpression >> ')' )[ BinaryFunctionFunctor( BINARY_FUNC_MIN, self.getContext()) ]
+ | (str_p( "max" ) >> '(' >> additiveExpression >> ',' >> additiveExpression >> ')' )[ BinaryFunctionFunctor( BINARY_FUNC_MAX, self.getContext()) ]
+ | (str_p( "atan2") >> '(' >> additiveExpression >> ',' >> additiveExpression >> ')' )[ BinaryFunctionFunctor( BINARY_FUNC_ATAN2,self.getContext()) ]
+ ;
+
+ ternaryFunction =
+ (str_p( "if" ) >> '(' >> additiveExpression >> ',' >> additiveExpression >> ',' >> additiveExpression >> ')' )[ IfFunctor( self.getContext() ) ]
+ ;
+
+ funcRef_decl =
+ lexeme_d[ +( range_p('a','z') | range_p('A','Z') | range_p('0','9') ) ];
+
+ functionReference =
+ (str_p( "?" ) >> funcRef_decl )[ EnumFunctor( ENUM_FUNC_EQUATION, self.getContext() ) ];
+
+ modRef_decl =
+ lexeme_d[ +( range_p('0','9') ) ];
+
+ modifierReference =
+ (str_p( "$" ) >> modRef_decl )[ EnumFunctor( ENUM_FUNC_ADJUSTMENT, self.getContext() ) ];
+
+ basicExpression =
+ real_parser<double, custom_real_parser_policies<double> >()[ DoubleConstantFunctor(self.getContext()) ]
+ | identifier
+ | functionReference
+ | modifierReference
+ | unaryFunction
+ | binaryFunction
+ | ternaryFunction
+ | '(' >> additiveExpression >> ')'
+ ;
+
+ unaryExpression =
+ ('-' >> basicExpression)[ UnaryFunctionFunctor( UNARY_FUNC_NEG, self.getContext()) ]
+ | basicExpression
+ ;
+
+ multiplicativeExpression =
+ unaryExpression
+ >> *( ('*' >> unaryExpression)[ BinaryFunctionFunctor( BINARY_FUNC_MUL, self.getContext()) ]
+ | ('/' >> unaryExpression)[ BinaryFunctionFunctor( BINARY_FUNC_DIV, self.getContext()) ]
+ )
+ ;
+
+ additiveExpression =
+ multiplicativeExpression
+ >> *( ('+' >> multiplicativeExpression)[ BinaryFunctionFunctor( BINARY_FUNC_PLUS, self.getContext()) ]
+ | ('-' >> multiplicativeExpression)[ BinaryFunctionFunctor( BINARY_FUNC_MINUS, self.getContext()) ]
+ )
+ ;
+
+ BOOST_SPIRIT_DEBUG_RULE(additiveExpression);
+ BOOST_SPIRIT_DEBUG_RULE(multiplicativeExpression);
+ BOOST_SPIRIT_DEBUG_RULE(unaryExpression);
+ BOOST_SPIRIT_DEBUG_RULE(basicExpression);
+ BOOST_SPIRIT_DEBUG_RULE(unaryFunction);
+ BOOST_SPIRIT_DEBUG_RULE(binaryFunction);
+ BOOST_SPIRIT_DEBUG_RULE(ternaryFunction);
+ BOOST_SPIRIT_DEBUG_RULE(identifier);
+ }
+
+ const ::boost::spirit::rule< ScannerT >& start() const
+ {
+ return additiveExpression;
+ }
+
+ private:
+ // the constituents of the Spirit arithmetic expression grammar.
+ // For the sake of readability, without 'ma' prefix.
+ ::boost::spirit::rule< ScannerT > additiveExpression;
+ ::boost::spirit::rule< ScannerT > multiplicativeExpression;
+ ::boost::spirit::rule< ScannerT > unaryExpression;
+ ::boost::spirit::rule< ScannerT > basicExpression;
+ ::boost::spirit::rule< ScannerT > unaryFunction;
+ ::boost::spirit::rule< ScannerT > binaryFunction;
+ ::boost::spirit::rule< ScannerT > ternaryFunction;
+ ::boost::spirit::rule< ScannerT > funcRef_decl;
+ ::boost::spirit::rule< ScannerT > functionReference;
+ ::boost::spirit::rule< ScannerT > modRef_decl;
+ ::boost::spirit::rule< ScannerT > modifierReference;
+ ::boost::spirit::rule< ScannerT > identifier;
+ };
+
+ const ParserContextSharedPtr& getContext() const
+ {
+ return mpParserContext;
+ }
+
+private:
+ ParserContextSharedPtr mpParserContext; // might get modified during parsing
+};
+
+#ifdef BOOST_SPIRIT_SINGLE_GRAMMAR_INSTANCE
+const ParserContextSharedPtr& getParserContext()
+{
+ static ParserContextSharedPtr lcl_parserContext( new ParserContext() );
+
+ // clear node stack (since we reuse the static object, that's
+ // the whole point here)
+ while( !lcl_parserContext->maOperandStack.empty() )
+ lcl_parserContext->maOperandStack.pop();
+
+ return lcl_parserContext;
+}
+#endif
+
+}
+
+namespace EnhancedCustomShape {
+
+
+
+ExpressionNodeSharedPtr FunctionParser::parseFunction( const ::rtl::OUString& rFunction, const EnhancedCustomShape2d& rCustoShape )
+{
+ // TODO(Q1): Check if a combination of the RTL_UNICODETOTEXT_FLAGS_*
+ // gives better conversion robustness here (we might want to map space
+ // etc. to ASCII space here)
+ const ::rtl::OString& rAsciiFunction(
+ rtl::OUStringToOString( rFunction, RTL_TEXTENCODING_ASCII_US ) );
+
+ StringIteratorT aStart( rAsciiFunction.getStr() );
+ StringIteratorT aEnd( rAsciiFunction.getStr()+rAsciiFunction.getLength() );
+
+ ParserContextSharedPtr pContext;
+
+#ifdef BOOST_SPIRIT_SINGLE_GRAMMAR_INSTANCE
+ // static parser context, because the actual
+ // Spirit parser is also a static object
+ pContext = getParserContext();
+#else
+ pContext.reset( new ParserContext() );
+#endif
+ pContext->mpCustoShape = &rCustoShape;
+
+ ExpressionGrammar aExpressionGrammer( pContext );
+ const ::boost::spirit::parse_info<StringIteratorT> aParseInfo(
+ ::boost::spirit::parse( aStart,
+ aEnd,
+ aExpressionGrammer >> ::boost::spirit::end_p,
+ ::boost::spirit::space_p ) );
+ OSL_DEBUG_ONLY(::std::cout.flush()); // needed to keep stdout and cout in sync
+
+
+
+ // input fully congested by the parser?
+ if( !aParseInfo.full )
+ throw ParseError( "EnhancedCustomShapeFunctionParser::parseFunction(): string not fully parseable" );
+
+ // parser's state stack now must contain exactly _one_ ExpressionNode,
+ // which represents our formula.
+ if( pContext->maOperandStack.size() != 1 )
+ throw ParseError( "EnhancedCustomShapeFunctionParser::parseFunction(): incomplete or empty expression" );
+
+
+ return pContext->maOperandStack.top();
+}
+
+
+}
+
diff --git a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx
new file mode 100644
index 000000000000..2bf28c81ca18
--- /dev/null
+++ b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx
@@ -0,0 +1,8273 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "svx/EnhancedCustomShapeGeometry.hxx"
+#include <com/sun/star/drawing/EnhancedCustomShapeGluePointType.hpp>
+/*
+static const SvxMSDffVertPair Vert[] =
+{
+ { 0, 0, }
+};
+static const sal_uInt16 Segm[] =
+{
+ 0x4000,
+ 0x8000
+};
+static const SvxMSDffCalculationData Calc[] =
+{
+ { 0x0000, 0, 0, 0 }
+};
+static const sal_Int32 Default[] =
+{
+ 0
+};
+static const SvxMSDffTextRect TextRect[] =
+{
+ { { 0, 0 }, { 0, 0 } }
+};
+static const mso_CustomShape mso =
+{
+ (SvxMSDffVertPair*)mso_sptVert, sizeof( mso_sptVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptSegm, sizeof( mso_sptSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCalc, sizeof( mso_sptCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault,
+ (SvxMSDffTextRectangles*)mso_sptTextRect, sizeof( mso_sptTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptVert, sizeof( mso_sptVert ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandles*)mso_sptHandles, sizeof( mso_sptHandles ) / sizeof( SvxMSDffHandles )
+};
+*/
+
+static const sal_Int32 mso_sptDefault0[] =
+{
+ 1, 0
+};
+static const sal_Int32 mso_sptDefault1400[] =
+{
+ 1, 1400
+};
+static const sal_Int32 mso_sptDefault1800[] =
+{
+ 1, 1800
+};
+static const sal_Int32 mso_sptDefault2500[] =
+{
+ 1, 2500
+};
+static const sal_Int32 mso_sptDefault2700[] =
+{
+ 1, 2700
+};
+static const sal_Int32 mso_sptDefault3600[] =
+{
+ 1, 3600
+};
+static const sal_Int32 mso_sptDefault3700[] =
+{
+ 1, 3700
+};
+static const sal_Int32 mso_sptDefault5400[] =
+{
+ 1, 5400
+};
+static const sal_Int32 mso_sptDefault7200[] =
+{
+ 1, 7200
+};
+static const sal_Int32 mso_sptDefault8100[] =
+{
+ 1, 8100
+};
+static const sal_Int32 mso_sptDefault9600[] =
+{
+ 1, 9600
+};
+static const sal_Int32 mso_sptDefault10800[] =
+{
+ 1, 10800
+};
+static const sal_Int32 mso_sptDefault12000[] =
+{
+ 1, 12000
+};
+static const sal_Int32 mso_sptDefault13500[] =
+{
+ 1, 13500
+};
+static const sal_Int32 mso_sptDefault16200[] =
+{
+ 1, 16200
+};
+static const sal_Int32 mso_sptDefault16200and5400[] =
+{
+ 2, 16200, 5400
+};
+
+static const SvxMSDffVertPair mso_sptArcVert[] =
+{
+ { 0, 0 }, { 21600, 21600 }, { 3 MSO_I, 1 MSO_I }, { 7 MSO_I, 5 MSO_I }, { 10800, 10800 },
+ { 0, 0 }, { 21600, 21600 }, { 3 MSO_I, 1 MSO_I }, { 7 MSO_I, 5 MSO_I }
+};
+static const sal_uInt16 mso_sptArcSegm[] =
+{
+ 0xa504, 0xab00, 0x0001, 0x6001, 0x8000,
+ 0xa504, 0xaa00, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptArcCalc[] =
+{
+ { 0x4009, { 10800, DFF_Prop_adjustValue, 0 } },
+ { 0x2000, { 0x400, 10800, 0 } },
+ { 0x400a, { 10800, DFF_Prop_adjustValue, 0 } },
+ { 0x2000, { 0x402, 10800, 0 } },
+ { 0x4009, { 10800, DFF_Prop_adjust2Value, 0 } },
+ { 0x2000, { 0x404, 10800, 0 } },
+ { 0x400a, { 10800, DFF_Prop_adjust2Value, 0 } },
+ { 0x2000, { 0x406, 10800, 0 } }
+};
+static const sal_Int32 mso_sptArcDefault[] =
+{
+ 2, 270, 0
+};
+static const SvxMSDffVertPair mso_sptStandardGluePoints[] =
+{
+ { 10800, 0 }, { 0, 10800 }, { 10800, 21600 }, { 21600, 10800 }
+};
+static const SvxMSDffHandle mso_sptArcHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_POLAR | MSDFF_HANDLE_FLAGS_RADIUS_RANGE,
+ 10800, 0x100, 10800, 10800, 10800, 10800, 0x80000000, 0x7fffffff },
+ { MSDFF_HANDLE_FLAGS_POLAR | MSDFF_HANDLE_FLAGS_RADIUS_RANGE,
+ 10800, 0x101, 10800, 10800, 10800, 10800, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoArc =
+{
+ (SvxMSDffVertPair*)mso_sptArcVert, sizeof( mso_sptArcVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptArcSegm, sizeof( mso_sptArcSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptArcCalc, sizeof( mso_sptArcCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptArcDefault,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptArcHandle, sizeof( mso_sptArcHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptTextSimpleVert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 21600 }, { 0, 21600 }, { 0, 0 }
+};
+static const mso_CustomShape msoTextSimple =
+{
+ (SvxMSDffVertPair*)mso_sptTextSimpleVert, sizeof( mso_sptTextSimpleVert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ NULL, 0,
+ NULL,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptRectangleVert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 21600 }, { 0, 21600 }, { 0, 0 }
+};
+static const mso_CustomShape msoRectangle =
+{
+ (SvxMSDffVertPair*)mso_sptRectangleVert, sizeof( mso_sptRectangleVert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ NULL, 0,
+ NULL,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptRoundRectangleVert[] = // adj value 0 -> 10800
+{
+ { 7 MSO_I, 0 }, { 0, 8 MSO_I }, { 0, 9 MSO_I }, { 7 MSO_I, 21600 },
+ { 10 MSO_I, 21600 }, { 21600, 9 MSO_I }, { 21600, 8 MSO_I }, { 10 MSO_I, 0 }
+};
+static const sal_uInt16 mso_sptRoundRectangleSegm[] =
+{
+ 0x4000, 0xa701, 0x0001, 0xa801, 0x0001, 0xa701, 0x0001, 0xa801, 0x6000, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptRoundRectangleCalc[] =
+{
+ { 0x000e, { 0, 45, 0 } },
+ { 0x6009, { DFF_Prop_adjustValue, 0x400, 0 } },
+ { 0x2001, { 0x401, 3163, 7636 } },
+ { 0x6000, { DFF_Prop_geoLeft, 0x402, 0 } },
+ { 0x6000, { DFF_Prop_geoTop, 0x402, 0 } },
+ { 0xa000, { DFF_Prop_geoRight, 0, 0x402 } },
+ { 0xa000, { DFF_Prop_geoBottom, 0, 0x402 } },
+ { 0x6000, { DFF_Prop_geoLeft, DFF_Prop_adjustValue, 0 } },
+ { 0x6000, { DFF_Prop_geoTop, DFF_Prop_adjustValue, 0 } },
+ { 0xa000, { DFF_Prop_geoBottom, 0, DFF_Prop_adjustValue } },
+ { 0xa000, { DFF_Prop_geoRight, 0, DFF_Prop_adjustValue } }
+};
+static const SvxMSDffTextRectangles mso_sptRoundRectangleTextRect[] =
+{
+ { { 3 MSO_I, 4 MSO_I }, { 5 MSO_I, 6 MSO_I } }
+};
+static const SvxMSDffHandle mso_sptRoundRectangleHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_SWITCHED,
+ 0x100, 0, 10800, 10800, 0, 10800, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoRoundRectangle =
+{
+ (SvxMSDffVertPair*)mso_sptRoundRectangleVert, sizeof( mso_sptRoundRectangleVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptRoundRectangleSegm, sizeof( mso_sptRoundRectangleSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptRoundRectangleCalc, sizeof( mso_sptRoundRectangleCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault3600,
+ (SvxMSDffTextRectangles*)mso_sptRoundRectangleTextRect, sizeof( mso_sptRoundRectangleTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 10800, 10800,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptRoundRectangleHandle, sizeof( mso_sptRoundRectangleHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptRightTriangleVert[] =
+{
+ { 0, 0 }, { 21600, 21600 }, { 0, 21600 }, { 0, 0 }
+};
+static const SvxMSDffTextRectangles mso_sptRightTriangleTextRect[] =
+{
+ { { 1900, 12700 }, { 12700, 19700 } }
+};
+static const SvxMSDffVertPair mso_sptRightTriangleGluePoints[] =
+{
+ { 10800, 0 }, { 5400, 10800 }, { 0, 21600 }, { 10800, 21600 }, { 21600, 21600 }, { 16200, 10800 }
+};
+static const mso_CustomShape msoRightTriangle =
+{
+ (SvxMSDffVertPair*)mso_sptRightTriangleVert, sizeof( mso_sptRightTriangleVert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptRightTriangleTextRect, sizeof( mso_sptRightTriangleTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptRightTriangleGluePoints, sizeof( mso_sptRightTriangleGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptEllipseVert[] =
+{
+ { 10800, 10800 }, { 10800, 10800 }, { 0, 360 }
+};
+static const sal_uInt16 mso_sptEllipseSegm[] =
+{
+ 0xa203, 0x6000, 0x8000
+};
+static const SvxMSDffTextRectangles mso_sptEllipseTextRect[] =
+{
+ { { 3163, 3163 }, { 18437, 18437 } }
+};
+static const SvxMSDffVertPair mso_sptEllipseGluePoints[] =
+{
+ { 10800, 0 }, { 3163, 3163 }, { 0, 10800 }, { 3163, 18437 }, { 10800, 21600 }, { 18437, 18437 }, { 21600, 10800 }, { 18437, 3163 }
+};
+static const mso_CustomShape msoEllipse =
+{
+ (SvxMSDffVertPair*)mso_sptEllipseVert, sizeof( mso_sptEllipseVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptEllipseSegm, sizeof( mso_sptEllipseSegm ) >> 1,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptEllipseTextRect, sizeof( mso_sptEllipseTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptEllipseGluePoints, sizeof( mso_sptEllipseGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptParallelogramVert[] = // adjustment1 : 0 - 21600
+{
+ { 0 MSO_I, 0 }, { 21600, 0 }, { 1 MSO_I, 21600 }, { 0, 21600 }
+};
+static const sal_uInt16 mso_sptParallelogramSegm[] =
+{
+ 0x4000, 0x0003, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptParallelogramCalc[] =
+{
+ { 0x4000, { 0, DFF_Prop_adjustValue, 0 } },
+ { 0x8000, { 0, 21600, DFF_Prop_adjustValue } },
+ { 0x2001, { DFF_Prop_adjustValue, 10, 24 } },
+ { 0x2000, { 0x0402, 1750, 0 } },
+ { 0x8000, { 21600, 0, 0x0403 } },
+ { 0x2001, { 0x400, 1, 2 } },
+ { 0x4000, { 10800, 0x405, 0 } },
+ { 0x2000, { 0x400, 0, 10800 } },
+ { 0x6006, { 0x407, 0x40d, 0 } },
+ { 0x8000, { 10800, 0, 0x405 } },
+ { 0x6006, { 0x407, 0x40c, 21600 } },
+ { 0x8000, { 21600, 0, 0x405 } },
+ { 0x8001, { 21600, 10800, 0x400 } },
+ { 0x8000, { 21600, 0, 0x40c } }
+};
+static const SvxMSDffTextRectangles mso_sptParallelogramTextRect[] =
+{
+ { { 3 MSO_I, 3 MSO_I }, { 4 MSO_I, 4 MSO_I } }
+};
+static const SvxMSDffVertPair mso_sptParallelogramGluePoints[] =
+{
+ { 6 MSO_I, 0 }, { 10800, 8 MSO_I }, { 11 MSO_I, 10800 }, { 9 MSO_I, 21600 }, { 10800, 10 MSO_I }, { 5 MSO_I, 10800 }
+};
+static const SvxMSDffHandle mso_sptParallelogramHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 0, 10800, 10800, 0, 21600, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoParallelogram =
+{
+ (SvxMSDffVertPair*)mso_sptParallelogramVert, sizeof( mso_sptParallelogramVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptParallelogramSegm, sizeof( mso_sptParallelogramSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptParallelogramCalc, sizeof( mso_sptParallelogramCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault5400,
+ (SvxMSDffTextRectangles*)mso_sptParallelogramTextRect, sizeof( mso_sptParallelogramTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptParallelogramGluePoints, sizeof( mso_sptParallelogramGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptParallelogramHandle, sizeof( mso_sptParallelogramHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptDiamondVert[] =
+{
+ { 10800, 0 }, { 21600, 10800 }, { 10800, 21600 }, { 0, 10800 }, { 10800, 0 }
+};
+static const SvxMSDffTextRectangles mso_sptDiamondTextRect[] =
+{
+ { { 5400, 5400 }, { 16200, 16200 } }
+};
+static const mso_CustomShape msoDiamond =
+{
+ (SvxMSDffVertPair*)mso_sptDiamondVert, sizeof( mso_sptDiamondVert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptDiamondTextRect, sizeof( mso_sptDiamondTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptStandardGluePoints, sizeof( mso_sptStandardGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptTrapezoidVert[] = // adjustment1 : 0 - 10800
+{
+ { 0, 0 }, { 21600, 0 }, {0 MSO_I, 21600 }, { 1 MSO_I, 21600 }
+};
+static const sal_uInt16 mso_sptTrapezoidSegm[] =
+{
+ 0x4000, 0x0003, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptTrapezoidCalc[] =
+{
+ { 0x8000, { 21600, 0, DFF_Prop_adjustValue } },
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x2001, { DFF_Prop_adjustValue, 10, 18 } },
+ { 0x2000, { 0x0402, 1750, 0 } },
+ { 0x8000, { 21600, 0, 0x403 } },
+ { 0x2001, { DFF_Prop_adjustValue, 1, 2 } },
+ { 0x8000, { 21600, 0, 0x405 } }
+};
+static const SvxMSDffTextRectangles mso_sptTrapezoidTextRect[] =
+{
+ { { 3 MSO_I, 3 MSO_I }, { 4 MSO_I, 4 MSO_I } }
+};
+static const SvxMSDffVertPair mso_sptTrapezoidGluePoints[] =
+{
+ { 6 MSO_I, 10800 }, { 10800, 21600 }, { 5 MSO_I, 10800 }, { 10800, 0 }
+};
+static const SvxMSDffHandle mso_sptTrapezoidHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 1, 10800, 10800, 0, 10800, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoTrapezoid =
+{
+ (SvxMSDffVertPair*)mso_sptTrapezoidVert, sizeof( mso_sptTrapezoidVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTrapezoidSegm, sizeof( mso_sptTrapezoidSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTrapezoidCalc, sizeof( mso_sptTrapezoidCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault5400,
+ (SvxMSDffTextRectangles*)mso_sptTrapezoidTextRect, sizeof( mso_sptTrapezoidTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptTrapezoidGluePoints, sizeof( mso_sptTrapezoidGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptTrapezoidHandle, sizeof( mso_sptTrapezoidHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptOctagonVert[] = // adjustment1 : 0 - 10800
+{
+ { 0 MSO_I, 0 }, { 2 MSO_I, 0 }, { 21600, 1 MSO_I }, { 21600, 3 MSO_I },
+ { 2 MSO_I, 21600 }, { 0 MSO_I, 21600 }, { 0, 3 MSO_I }, { 0, 1 MSO_I }
+};
+static const sal_uInt16 mso_sptOctagonSegm[] =
+{
+ 0x4000, 0x0007, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptOctagonCalc[] =
+{
+ { 0x6000, { DFF_Prop_geoLeft, DFF_Prop_adjustValue, 0 } },
+ { 0x6000, { DFF_Prop_geoTop, DFF_Prop_adjustValue, 0 } },
+ { 0xa000, { DFF_Prop_geoRight, 0, DFF_Prop_adjustValue } },
+ { 0xa000, { DFF_Prop_geoBottom, 0, DFF_Prop_adjustValue } },
+ { 0x2001, { DFF_Prop_adjustValue, 1, 2 } },
+ { 0x6000, { DFF_Prop_geoLeft, 0x404, 0 } },
+ { 0x6000, { DFF_Prop_geoTop, 0x404, 0 } },
+ { 0xa000, { DFF_Prop_geoRight, 0, 0x404 } },
+ { 0xa000, { DFF_Prop_geoBottom, 0, 0x404 } }
+};
+static const sal_Int32 mso_sptOctagonDefault[] =
+{
+ 1, 5000
+};
+static const SvxMSDffTextRectangles mso_sptOctagonTextRect[] =
+{
+ { { 5 MSO_I, 6 MSO_I }, { 7 MSO_I, 8 MSO_I } }
+};
+static const SvxMSDffHandle mso_sptOctagonHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 0, 10800, 10800, 0, 10800, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoOctagon =
+{
+ (SvxMSDffVertPair*)mso_sptOctagonVert, sizeof( mso_sptOctagonVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptOctagonSegm, sizeof( mso_sptOctagonSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptOctagonCalc, sizeof( mso_sptOctagonCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptOctagonDefault,
+ (SvxMSDffTextRectangles*)mso_sptOctagonTextRect, sizeof( mso_sptOctagonTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 10800, 10800,
+ (SvxMSDffVertPair*)mso_sptStandardGluePoints, sizeof( mso_sptStandardGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptOctagonHandle, sizeof( mso_sptOctagonHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptIsocelesTriangleVert[] = // adjustment1 : 0 - 21600
+{
+ { 0 MSO_I, 0 }, { 21600, 21600 }, { 0, 21600 }
+};
+static const sal_uInt16 mso_sptIsocelesTriangleSegm[] =
+{
+ 0x4000, 0x0002, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptIsocelesTriangleCalc[] =
+{
+ { 0x4000, { 0, DFF_Prop_adjustValue, 0 } },
+ { 0x2001, { DFF_Prop_adjustValue, 1, 2 } },
+ { 0x2000, { 0x401, 10800, 0 } },
+ { 0x2001, { DFF_Prop_adjustValue, 2, 3 } },
+ { 0x2000, { 0x403, 7200, 0 } },
+ { 0x8000, { 21600, 0, 0x400 } },
+ { 0x2001, { 0x405, 1, 2 } },
+ { 0x8000, { 21600, 0, 0x406 } }
+};
+static const SvxMSDffTextRectangles mso_sptIsocelesTriangleTextRect[] =
+{
+ { { 1 MSO_I, 10800 }, { 2 MSO_I, 18000 } },
+ { { 3 MSO_I, 7200 }, { 4 MSO_I, 21600 } }
+};
+static const SvxMSDffVertPair mso_sptIsocelesTriangleGluePoints[] =
+{
+ { 10800, 0 }, { 1 MSO_I, 10800 }, { 0, 21600 }, { 10800, 21600 }, { 21600, 21600 }, { 7 MSO_I, 10800 }
+};
+static const SvxMSDffHandle mso_sptIsocelesTriangleHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 0, 10800, 10800, 0, 21600, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoIsocelesTriangle =
+{
+ (SvxMSDffVertPair*)mso_sptIsocelesTriangleVert, sizeof( mso_sptIsocelesTriangleVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptIsocelesTriangleSegm, sizeof( mso_sptIsocelesTriangleSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptIsocelesTriangleCalc, sizeof( mso_sptIsocelesTriangleCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault10800,
+ (SvxMSDffTextRectangles*)mso_sptIsocelesTriangleTextRect, sizeof( mso_sptIsocelesTriangleTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptIsocelesTriangleGluePoints, sizeof( mso_sptIsocelesTriangleGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptIsocelesTriangleHandle, sizeof( mso_sptIsocelesTriangleHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptHexagonVert[] = // adjustment1 : 0 - 10800
+{
+ { 0 MSO_I, 0 }, { 1 MSO_I, 0 }, { 21600, 10800 }, { 1 MSO_I, 21600 },
+ { 0 MSO_I, 21600 }, { 0, 10800 }
+};
+static const sal_uInt16 mso_sptHexagonSegm[] =
+{
+ 0x4000, 0x0005, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptHexagonCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x8000, { 21600, 0, DFF_Prop_adjustValue } },
+ { 0x2001, { DFF_Prop_adjustValue, 100, 234 } },
+ { 0x2000, { 0x402, 1700, 0 } },
+ { 0x8000, { 21600, 0, 0x403 } }
+};
+static const SvxMSDffTextRectangles mso_sptHexagonTextRect[] =
+{
+ { { 3 MSO_I, 3 MSO_I }, { 4 MSO_I, 4 MSO_I } }
+};
+static const SvxMSDffHandle mso_sptHexagonHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 0, 10800, 10800, 0, 10800, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoHexagon =
+{
+ (SvxMSDffVertPair*)mso_sptHexagonVert, sizeof( mso_sptHexagonVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptHexagonSegm, sizeof( mso_sptHexagonSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptHexagonCalc, sizeof( mso_sptHexagonCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault5400,
+ (SvxMSDffTextRectangles*)mso_sptHexagonTextRect, sizeof( mso_sptHexagonTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptStandardGluePoints, sizeof( mso_sptStandardGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptHexagonHandle, sizeof( mso_sptHexagonHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptPentagonVert[] =
+{
+ { 10800, 0 }, { 0, 8260 }, { 4230, 21600 }, { 17370, 21600 },
+ { 21600, 8260 }, { 10800, 0 }
+};
+static const SvxMSDffTextRectangles mso_sptPentagonTextRect[] =
+{
+ { { 4230, 5080 }, { 17370, 21600 } }
+};
+static const SvxMSDffVertPair mso_sptPentagonGluePoints[] =
+{
+ { 10800, 0 }, { 0, 8260 }, { 4230, 21600 }, { 10800, 21600 },
+ { 17370, 21600 }, { 21600, 8260 }
+};
+static const mso_CustomShape msoPentagon =
+{
+ (SvxMSDffVertPair*)mso_sptPentagonVert, sizeof( mso_sptPentagonVert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptPentagonTextRect, sizeof( mso_sptPentagonTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptPentagonGluePoints, sizeof( mso_sptPentagonGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptPlusVert[] = // adjustment1 : 0 - 10800
+{
+ { 1 MSO_I, 0 }, { 2 MSO_I, 0 }, { 2 MSO_I, 1 MSO_I }, { 21600, 1 MSO_I },
+ { 21600, 3 MSO_I }, { 2 MSO_I, 3 MSO_I }, { 2 MSO_I, 21600 }, { 1 MSO_I, 21600 },
+ { 1 MSO_I, 3 MSO_I }, { 0, 3 MSO_I }, { 0, 1 MSO_I }, { 1 MSO_I, 1 MSO_I }, { 1 MSO_I, 0 }
+};
+static const SvxMSDffCalculationData mso_sptPlusCalc[] =
+{
+ { 0x2001, { DFF_Prop_adjustValue, 10799, 10800 } },
+ { 0x2000, { 0x400, 0, 0 } },
+ { 0xa000, { DFF_Prop_geoRight, 0, 0x400 } },
+ { 0xa000, { DFF_Prop_geoBottom, 0, 0x400 } }
+};
+static const SvxMSDffTextRectangles mso_sptPlusTextRect[] =
+{
+ { { 1 MSO_I, 1 MSO_I }, { 2 MSO_I, 3 MSO_I } }
+};
+static const SvxMSDffHandle mso_sptPlusHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_SWITCHED,
+ 0x100, 0, 10800, 10800, 0, 10800, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoPlus =
+{
+ (SvxMSDffVertPair*)mso_sptPlusVert, sizeof( mso_sptPlusVert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ (SvxMSDffCalculationData*)mso_sptPlusCalc, sizeof( mso_sptPlusCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault5400,
+ (SvxMSDffTextRectangles*)mso_sptPlusTextRect, sizeof( mso_sptPlusTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 10800, 10800,
+ (SvxMSDffVertPair*)mso_sptStandardGluePoints, sizeof( mso_sptStandardGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptPlusHandle, sizeof( mso_sptPlusHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptCanVert[] = // adjustment1 : 0 - 10800
+{
+ { 44, 0 },
+ { 20, 0 }, { 0, 2 MSO_I }, { 0, 0 MSO_I }, // ccp
+ { 0, 3 MSO_I }, // p
+ { 0, 4 MSO_I }, { 20, 21600 }, { 44, 21600 }, // ccp
+ { 68, 21600 }, { 88, 4 MSO_I }, { 88, 3 MSO_I }, // ccp
+ { 88, 0 MSO_I }, // p
+ { 88, 2 MSO_I }, { 68, 0 }, { 44, 0 }, // ccp
+ { 44, 0 }, // p
+ { 20, 0 }, { 0, 2 MSO_I }, { 0, 0 MSO_I }, // ccp
+ { 0, 5 MSO_I }, { 20, 6 MSO_I }, { 44, 6 MSO_I }, // ccp
+ { 68, 6 MSO_I },{ 88, 5 MSO_I }, { 88, 0 MSO_I }, // ccp
+ { 88, 2 MSO_I },{ 68, 0 }, { 44, 0 } // ccp
+};
+static const sal_uInt16 mso_sptCanSegm[] =
+{
+ 0x4000, 0x2001, 0x0001, 0x2002, 0x0001, 0x2001, 0x6001, 0x8000,
+ 0x4000, 0x2004, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptCanCalc[] =
+{
+ { 0x2001, { DFF_Prop_adjustValue, 2, 4 } }, // 1/4
+ { 0x2001, { 0x0400, 6, 11 } },
+ { 0xa000, { 0x0400, 0, 0x0401 } },
+ { 0x8000, { 21600, 0, 0x0400 } },
+ { 0x6000, { 0x0403, 0x0401, 0 } },
+ { 0x6000, { 0x0400, 0x0401, 0 } },
+ { 0x2001, { DFF_Prop_adjustValue, 2, 2 } },
+ { 0x0000, { 44, 0, 0 } }
+};
+static const SvxMSDffTextRectangles mso_sptCanTextRect[] =
+{
+ { { 0, 6 MSO_I }, { 88, 3 MSO_I } }
+};
+static const SvxMSDffVertPair mso_sptCanGluePoints[] =
+{
+ { 44, 6 MSO_I }, { 44, 0 }, { 0, 10800 }, { 44, 21600 }, { 88, 10800 }
+};
+static const SvxMSDffHandle mso_sptCanHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 7 + 3, 0x100, 44, 10800, 0x80000000, 0x7fffffff, 0, 10800 }
+};
+static const mso_CustomShape msoCan =
+{
+ (SvxMSDffVertPair*)mso_sptCanVert, sizeof( mso_sptCanVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCanSegm, sizeof( mso_sptCanSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCanCalc, sizeof( mso_sptCanCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault5400,
+ (SvxMSDffTextRectangles*)mso_sptCanTextRect, sizeof( mso_sptCanTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 88, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptCanGluePoints, sizeof( mso_sptCanGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptCanHandle, sizeof( mso_sptCanHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptArrowVert[] = // adjustment1: x 0 - 21600
+{ // adjustment2: y 0 - 10800
+ { 0, 0 MSO_I }, { 1 MSO_I, 0 MSO_I }, { 1 MSO_I, 0 }, { 21600, 10800 },
+ { 1 MSO_I, 21600 }, { 1 MSO_I, 2 MSO_I }, { 0, 2 MSO_I }
+};
+static const sal_uInt16 mso_sptArrowSegm[] =
+{
+ 0x4000, 0x0006, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptArrowCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x8000, { 21600, 0, DFF_Prop_adjust2Value } },
+ { 0x8000, { 21600, 0, 0x401 } },
+ { 0x6001, { 0x403, 0x400, 10800 } },
+ { 0x6000, { 0x401, 0x404, 0 } },
+ { 0x6001, { 0x401, 0x400, 10800 } },
+ { 0xa000, { 0x401, 0, 0x406 } }
+};
+static const SvxMSDffTextRectangles mso_sptArrowTextRect[] =
+{
+ { { 0, 0 MSO_I }, { 5 MSO_I, 2 MSO_I } }
+};
+static const SvxMSDffHandle mso_sptArrowHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 0x101, 10800, 10800, 0, 21600, 0, 10800 }
+};
+static const mso_CustomShape msoArrow =
+{
+ (SvxMSDffVertPair*)mso_sptArrowVert, sizeof( mso_sptArrowVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptArrowSegm, sizeof( mso_sptArrowSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptArrowCalc, sizeof( mso_sptArrowCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault16200and5400,
+ (SvxMSDffTextRectangles*)mso_sptArrowTextRect, sizeof( mso_sptArrowTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptArrowHandle, sizeof( mso_sptArrowHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptLeftArrowVert[] = // adjustment1: x 0 - 21600
+{ // adjustment2: y 0 - 10800
+ { 21600, 0 MSO_I }, { 1 MSO_I, 0 MSO_I }, { 1 MSO_I, 0 }, { 0, 10800 },
+ { 1 MSO_I, 21600 }, { 1 MSO_I, 2 MSO_I }, { 21600, 2 MSO_I }
+};
+static const sal_uInt16 mso_sptLeftArrowSegm[] =
+{
+ 0x4000, 0x0006, 0x6001, 0x8000
+};
+static const sal_Int32 mso_sptLeftArrowDefault[] =
+{
+ 2, 5400, 5400
+};
+static const SvxMSDffTextRectangles mso_sptLeftArrowTextRect[] =
+{
+ { { 7 MSO_I, 0 MSO_I }, { 21600, 2 MSO_I } }
+};
+static const SvxMSDffHandle mso_sptLeftArrowHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 0x101, 10800, 10800, 0, 21600, 0, 10800 }
+};
+static const mso_CustomShape msoLeftArrow =
+{
+ (SvxMSDffVertPair*)mso_sptLeftArrowVert, sizeof( mso_sptLeftArrowVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptLeftArrowSegm, sizeof( mso_sptLeftArrowSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptArrowCalc, sizeof( mso_sptArrowCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptLeftArrowDefault,
+ (SvxMSDffTextRectangles*)mso_sptLeftArrowTextRect, sizeof( mso_sptLeftArrowTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptLeftArrowHandle, sizeof( mso_sptLeftArrowHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptDownArrowVert[] = // adjustment1: x 0 - 21600
+{ // adjustment2: y 0 - 10800
+ { 0 MSO_I, 0 }, { 0 MSO_I, 1 MSO_I }, { 0, 1 MSO_I }, { 10800, 21600 },
+ { 21600, 1 MSO_I }, { 2 MSO_I, 1 MSO_I }, { 2 MSO_I, 0 }
+};
+static const sal_uInt16 mso_sptDownArrowSegm[] =
+{
+ 0x4000, 0x0006, 0x6001, 0x8000
+};
+static const SvxMSDffTextRectangles mso_sptDownArrowTextRect[] =
+{
+ { { 0 MSO_I, 0 }, { 2 MSO_I, 5 MSO_I } }
+};
+static const SvxMSDffHandle mso_sptDownArrowHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x101, 0x100, 10800, 10800, 0, 10800, 0, 21600 }
+};
+static const mso_CustomShape msoDownArrow =
+{
+ (SvxMSDffVertPair*)mso_sptDownArrowVert, sizeof( mso_sptDownArrowVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptDownArrowSegm, sizeof( mso_sptDownArrowSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptArrowCalc, sizeof( mso_sptArrowCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault16200and5400,
+ (SvxMSDffTextRectangles*)mso_sptDownArrowTextRect, sizeof( mso_sptDownArrowTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptDownArrowHandle, sizeof( mso_sptDownArrowHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptUpArrowVert[] = // adjustment1: x 0 - 21600
+{ // adjustment2: y 0 - 10800
+ { 0 MSO_I, 21600 }, { 0 MSO_I, 1 MSO_I }, { 0, 1 MSO_I }, { 10800, 0 },
+ { 21600, 1 MSO_I }, { 2 MSO_I, 1 MSO_I }, { 2 MSO_I, 21600 }
+};
+static const sal_uInt16 mso_sptUpArrowSegm[] =
+{
+ 0x4000, 0x0006, 0x6001, 0x8000
+};
+static const sal_Int32 mso_sptUpArrowDefault[] =
+{
+ 2, 5400, 5400
+};
+static const SvxMSDffTextRectangles mso_sptUpArrowTextRect[] =
+{
+ { { 0 MSO_I, 7 MSO_I }, { 2 MSO_I, 21600 } }
+};
+static const SvxMSDffHandle mso_sptUpArrowHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x101, 0x100, 10800, 10800, 0, 10800, 0, 21600 }
+};
+static const mso_CustomShape msoUpArrow =
+{
+ (SvxMSDffVertPair*)mso_sptUpArrowVert, sizeof( mso_sptUpArrowVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptUpArrowSegm, sizeof( mso_sptUpArrowSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptArrowCalc, sizeof( mso_sptArrowCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptUpArrowDefault,
+ (SvxMSDffTextRectangles*)mso_sptUpArrowTextRect, sizeof( mso_sptUpArrowTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptUpArrowHandle, sizeof( mso_sptUpArrowHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptLeftRightArrowVert[] = // adjustment1: x 0 - 10800
+{ // adjustment2: y 0 - 10800
+ { 0, 10800 }, { 0 MSO_I, 0 }, { 0 MSO_I, 1 MSO_I }, { 2 MSO_I, 1 MSO_I },
+ { 2 MSO_I, 0 }, { 21600, 10800 }, { 2 MSO_I, 21600 }, { 2 MSO_I, 3 MSO_I },
+ { 0 MSO_I, 3 MSO_I }, { 0 MSO_I, 21600 }
+};
+static const sal_uInt16 mso_sptLeftRightArrowSegm[] =
+{
+ 0x4000, 0x0009, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptDoubleArrowCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } },
+ { 0x8000, { 21600, 0, DFF_Prop_adjustValue } },
+ { 0x8000, { 21600, 0, DFF_Prop_adjust2Value } },
+ { 0x8000, { 10800, 0, DFF_Prop_adjust2Value } },
+ { 0x6001, { DFF_Prop_adjustValue, 0x404, 10800 } },
+ { 0x8000, { 21600, 0, 0x405 } },
+ { 0x8000, { 10800, 0, DFF_Prop_adjustValue } },
+ { 0x6001, { DFF_Prop_adjust2Value, 0x407, 10800 } },
+ { 0x8000, { 21600, 0, 0x408 } }
+};
+static const sal_Int32 mso_sptLeftRightArrowDefault[] =
+{
+ 2, 4300, 5400
+};
+static const SvxMSDffTextRectangles mso_sptLeftRightArrowTextRect[] =
+{
+ { { 5 MSO_I, 1 MSO_I }, { 6 MSO_I, 3 MSO_I } }
+};
+static const SvxMSDffHandle mso_sptLeftRightArrowHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 0x101, 10800, 10800, 0, 10800, 0, 10800 }
+};
+static const mso_CustomShape msoLeftRightArrow =
+{
+ (SvxMSDffVertPair*)mso_sptLeftRightArrowVert, sizeof( mso_sptLeftRightArrowVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptLeftRightArrowSegm, sizeof( mso_sptLeftRightArrowSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptDoubleArrowCalc, sizeof( mso_sptDoubleArrowCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptLeftRightArrowDefault,
+ (SvxMSDffTextRectangles*)mso_sptLeftRightArrowTextRect, sizeof( mso_sptLeftRightArrowTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptLeftRightArrowHandle, sizeof( mso_sptLeftRightArrowHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptUpDownArrowVert[] = // adjustment1: x 0 - 10800
+{ // adjustment2: y 0 - 10800
+ { 0, 1 MSO_I }, { 10800, 0 }, { 21600, 1 MSO_I }, { 2 MSO_I, 1 MSO_I },
+ { 2 MSO_I, 3 MSO_I }, { 21600, 3 MSO_I }, { 10800, 21600 }, { 0, 3 MSO_I },
+ { 0 MSO_I, 3 MSO_I }, { 0 MSO_I, 1 MSO_I }
+};
+static const sal_uInt16 mso_sptUpDownArrowSegm[] =
+{
+ 0x4000, 0x0009, 0x6001, 0x8000
+};
+static const sal_Int32 mso_sptUpDownArrowDefault[] =
+{
+ 2, 5400, 4300
+};
+static const SvxMSDffTextRectangles mso_sptUpDownArrowTextRect[] =
+{
+ { { 0 MSO_I, 8 MSO_I }, { 2 MSO_I, 9 MSO_I } }
+};
+static const SvxMSDffHandle mso_sptUpDownArrowHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 0x101, 10800, 10800, 0, 10800, 0, 10800 }
+};
+static const mso_CustomShape msoUpDownArrow =
+{
+ (SvxMSDffVertPair*)mso_sptUpDownArrowVert, sizeof( mso_sptUpDownArrowVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptUpDownArrowSegm, sizeof( mso_sptUpDownArrowSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptDoubleArrowCalc, sizeof( mso_sptDoubleArrowCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptUpDownArrowDefault,
+ (SvxMSDffTextRectangles*)mso_sptUpDownArrowTextRect, sizeof( mso_sptUpDownArrowTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptUpDownArrowHandle, sizeof( mso_sptUpDownArrowHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptQuadArrowVert[] = // adjustment1: x 0 - 10800, adjustment2: x 0 - 10800
+{ // adjustment3: y 0 - 10800
+ { 0, 10800 }, { 0 MSO_I, 1 MSO_I }, { 0 MSO_I, 2 MSO_I }, { 2 MSO_I, 2 MSO_I },
+ { 2 MSO_I, 0 MSO_I }, { 1 MSO_I, 0 MSO_I }, { 10800, 0 }, { 3 MSO_I, 0 MSO_I },
+ { 4 MSO_I, 0 MSO_I }, { 4 MSO_I, 2 MSO_I }, { 5 MSO_I, 2 MSO_I }, { 5 MSO_I, 1 MSO_I },
+ { 21600, 10800 }, { 5 MSO_I, 3 MSO_I }, { 5 MSO_I, 4 MSO_I }, { 4 MSO_I, 4 MSO_I },
+ { 4 MSO_I, 5 MSO_I }, { 3 MSO_I, 5 MSO_I }, { 10800, 21600 }, { 1 MSO_I, 5 MSO_I },
+ { 2 MSO_I, 5 MSO_I }, { 2 MSO_I, 4 MSO_I }, { 0 MSO_I, 4 MSO_I }, { 0 MSO_I, 3 MSO_I }
+};
+static const sal_uInt16 mso_sptQuadArrowSegm[] =
+{
+ 0x4000, 0x0017, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptQuadArrowCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjust3Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } },
+ { 0x8000, { 21600, 0, DFF_Prop_adjustValue } },
+ { 0x8000, { 21600, 0, DFF_Prop_adjust2Value } },
+ { 0x8000, { 21600, 0, DFF_Prop_adjust3Value } }
+};
+static const sal_Int32 mso_sptQuadArrowDefault[] =
+{
+ 3, 6500, 8600, 4300
+};
+static const SvxMSDffTextRectangles mso_sptQuadArrowTextRect[] = // todo
+{
+ { { 0, 0 }, { 21600, 21600 } }
+};
+static const SvxMSDffHandle mso_sptQuadArrowHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL,
+ 0x101, 0x102, 10800, 10800, 0x100, 10800, 0, 0x100 },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL,
+ 0x100, 0, 10800, 10800, 0x102, 0x101, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoQuadArrow =
+{
+ (SvxMSDffVertPair*)mso_sptQuadArrowVert, sizeof( mso_sptQuadArrowVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptQuadArrowSegm, sizeof( mso_sptQuadArrowSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptQuadArrowCalc, sizeof( mso_sptQuadArrowCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptQuadArrowDefault,
+ (SvxMSDffTextRectangles*)mso_sptQuadArrowTextRect, sizeof( mso_sptQuadArrowTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptQuadArrowHandle, sizeof( mso_sptQuadArrowHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptLeftRightUpArrowVert[] = // adjustment1: x 0 - 10800, adjustment2: x 0 - 10800
+{ // adjustment3: y 0 - 21600
+ { 10800, 0 }, { 3 MSO_I, 2 MSO_I }, { 4 MSO_I, 2 MSO_I }, { 4 MSO_I, 1 MSO_I },
+ { 5 MSO_I, 1 MSO_I }, { 5 MSO_I, 0 MSO_I }, { 21600, 10800 }, { 5 MSO_I, 3 MSO_I },
+ { 5 MSO_I, 4 MSO_I }, { 2 MSO_I, 4 MSO_I }, { 2 MSO_I, 3 MSO_I }, { 0, 10800 },
+ { 2 MSO_I, 0 MSO_I }, { 2 MSO_I, 1 MSO_I }, { 1 MSO_I, 1 MSO_I }, { 1 MSO_I, 2 MSO_I },
+ { 0 MSO_I, 2 MSO_I }
+};
+static const sal_uInt16 mso_sptLeftRightUpArrowSegm[] =
+{
+ 0x4000, 0x0010, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptLeftRightUpArrowCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, // 0
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } }, // 1
+ { 0x6001, { 0x0403, DFF_Prop_adjust3Value, 21600 } }, // 2
+ { 0x8000, { 21600, 0, DFF_Prop_adjustValue } }, // 3
+ { 0x8000, { 21600, 0, DFF_Prop_adjust2Value } }, // 4
+ { 0x8000, { 21600, 0, 0x0402 } } // 5
+};
+static const sal_Int32 mso_sptLeftRightUpArrowDefault[] =
+{
+ 3, 6500, 8600, 6200
+};
+static const SvxMSDffTextRectangles mso_sptLeftRightUpArrowTextRect[] = // todo
+{
+ { { 0, 0 }, { 21600, 21600 } }
+};
+static const SvxMSDffHandle mso_sptLeftRightUpArrowHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL,
+ 0x101, 0x102, 10800, 10800, 0x100, 10800, 0, 0x100 },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL,
+ 0x100, 0, 10800, 10800, 0x102, 0x101, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoLeftRightUpArrow =
+{
+ (SvxMSDffVertPair*)mso_sptLeftRightUpArrowVert, sizeof( mso_sptLeftRightUpArrowVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptLeftRightUpArrowSegm, sizeof( mso_sptLeftRightUpArrowSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptLeftRightUpArrowCalc, sizeof( mso_sptLeftRightUpArrowCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptLeftRightUpArrowDefault,
+ (SvxMSDffTextRectangles*)mso_sptLeftRightUpArrowTextRect, sizeof( mso_sptLeftRightUpArrowTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptLeftRightUpArrowHandle, sizeof( mso_sptLeftRightUpArrowHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptBentArrowVert[] = // adjustment1 : x 12427 - 21600
+{ // adjustment2 : y 0 - 6079
+ { 0, 21600 }, { 0, 12160 }, { 12427, 1 MSO_I }, { 0 MSO_I, 1 MSO_I },
+ { 0 MSO_I, 0 }, { 21600, 6079 }, { 0 MSO_I, 12158 }, { 0 MSO_I, 2 MSO_I },
+ { 12427, 2 MSO_I }, { 4 MSO_I, 12160 }, { 4 MSO_I, 21600 }
+};
+static const sal_uInt16 mso_sptBentArrowSegm[] =
+{
+ 0x4000, 0x0001, 0xa801, 0x0006, 0xa701, 0x0001, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptBentArrowCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } },
+ { 0x8000, { 12158, 0, DFF_Prop_adjust2Value } },
+ { 0x8000, { 6079, 0, DFF_Prop_adjust2Value } },
+ { 0x2001, { 0x0403, 2, 1 } }
+};
+static const sal_Int32 mso_sptBentArrowDefault[] =
+{
+ 2, 15100, 2900
+};
+static const SvxMSDffTextRectangles mso_sptBentArrowTextRect[] = // todo
+{
+ { { 0, 0 }, { 21600, 21600 } }
+};
+static const SvxMSDffHandle mso_sptBentArrowHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 0x101, 10800, 10800, 12427, 21600, 0, 6079 }
+};
+static const mso_CustomShape msoBentArrow =
+{
+ (SvxMSDffVertPair*)mso_sptBentArrowVert, sizeof( mso_sptBentArrowVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptBentArrowSegm, sizeof( mso_sptBentArrowSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptBentArrowCalc, sizeof( mso_sptBentArrowCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptBentArrowDefault,
+ (SvxMSDffTextRectangles*)mso_sptBentArrowTextRect, sizeof( mso_sptBentArrowTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptBentArrowHandle, sizeof( mso_sptBentArrowHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptUturnArrowVert[] =
+{
+ { 0, 21600 }, { 0, 8550 }, // pp
+ { 0, 3540 }, { 4370, 0 }, { 9270, 0 }, // ccp
+ { 13890, 0 }, { 18570, 3230 }, { 18600, 8300 }, // ccp
+ { 21600, 8300 }, { 15680, 14260 }, { 9700, 8300 }, { 12500, 8300 }, // pppp
+ { 12320, 6380 }, { 10870, 5850 }, { 9320, 5850 }, // ccp
+ { 7770, 5850 }, { 6040, 6410 }, { 6110, 8520 }, // ccp
+ { 6110, 21600 }
+};
+static const sal_uInt16 mso_sptUturnArrowSegm[] =
+{
+ 0x4000, 0x0001, 0x2002, 0x0004, 0x2002, 0x0001, 0x6000, 0x8000
+};
+static const SvxMSDffTextRectangles mso_sptUturnArrowTextRect[] =
+{
+ { { 0, 8280 }, { 6110, 21600 } }
+};
+static const mso_CustomShape msoUturnArrow =
+{
+ (SvxMSDffVertPair*)mso_sptUturnArrowVert, sizeof( mso_sptUturnArrowVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptUturnArrowSegm, sizeof( mso_sptUturnArrowSegm ) >> 1,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptUturnArrowTextRect, sizeof( mso_sptUturnArrowTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptLeftUpArrowVert[] = // adjustment1 : x 0 - 21600, adjustment2 : x 0 - 21600
+{ // adjustment3 : y 0 - 21600
+ { 0, 5 MSO_I }, { 2 MSO_I, 0 MSO_I }, { 2 MSO_I, 7 MSO_I }, { 7 MSO_I, 7 MSO_I },
+ { 7 MSO_I, 2 MSO_I }, { 0 MSO_I, 2 MSO_I }, { 5 MSO_I, 0 }, { 21600, 2 MSO_I },
+ { 1 MSO_I, 2 MSO_I }, { 1 MSO_I, 1 MSO_I }, { 2 MSO_I, 1 MSO_I }, { 2 MSO_I, 21600 }
+};
+static const sal_uInt16 mso_sptLeftUpArrowSegm[] =
+{
+ 0x4000, 0x000b, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptLeftUpArrowCalc[] =
+{
+ { 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_adjustValue } }, // 3
+ { 0x2001, { 0x0403, 1, 2 } }, // 4
+ { 0x6000, { DFF_Prop_adjustValue, 0x0404, 0 } }, // 5
+ { 0x8000, { 21600, 0, DFF_Prop_adjust2Value } }, // 6
+ { 0x6000, { DFF_Prop_adjustValue, 0x0406, 0 } }, // 7
+ { 0x8000, { 21600, 0, 0x406 } }, // 8
+ { 0xa000, { 0x408, 0, 0x406 } } // 9
+};
+static const sal_Int32 mso_sptLeftUpArrowDefault[] =
+{
+ 3, 9340, 18500, 6200
+};
+static const SvxMSDffTextRectangles mso_sptLeftUpArrowTextRect[] =
+{
+ { { 2 MSO_I, 7 MSO_I }, { 1 MSO_I, 1 MSO_I } },
+ { { 7 MSO_I, 2 MSO_I }, { 1 MSO_I, 1 MSO_I } }
+};
+static const SvxMSDffHandle mso_sptLeftUpArrowHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL,
+ 0x101, 0x102, 10800, 10800, 3 + 5, 21600, 0, 0x100 },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL,
+ 0x100, 0, 10800, 10800, 0x102, 3 + 9, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoLeftUpArrow =
+{
+ (SvxMSDffVertPair*)mso_sptLeftUpArrowVert, sizeof( mso_sptLeftUpArrowVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptLeftUpArrowSegm, sizeof( mso_sptLeftUpArrowSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptLeftUpArrowCalc, sizeof( mso_sptLeftUpArrowCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptLeftUpArrowDefault,
+ (SvxMSDffTextRectangles*)mso_sptLeftUpArrowTextRect, sizeof( mso_sptLeftUpArrowTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptLeftUpArrowHandle, sizeof( mso_sptLeftUpArrowHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptBentUpArrowVert[] = // adjustment1 : x 0 - 21600, adjustment2 : x 0 - 21600
+{ // adjustment3 : y 0 - 21600
+ { 0, 8 MSO_I }, { 7 MSO_I, 8 MSO_I }, { 7 MSO_I, 2 MSO_I }, { 0 MSO_I, 2 MSO_I },
+ { 5 MSO_I, 0 }, { 21600, 2 MSO_I }, { 1 MSO_I, 2 MSO_I }, { 1 MSO_I, 21600 },
+ { 0, 21600 }
+};
+static const sal_uInt16 mso_sptBentUpArrowSegm[] =
+{
+ 0x4000, 0x0008, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptBentUpArrowCalc[] =
+{
+ { 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_adjustValue } }, // 3
+ { 0x2001, { 0x0403, 1, 2 } }, // 4
+ { 0x6000, { DFF_Prop_adjustValue, 0x0404, 0 } }, // 5
+ { 0x8000, { 21600, 0, DFF_Prop_adjust2Value } }, // 6
+ { 0x6000, { DFF_Prop_adjustValue, 0x0406, 0 } }, // 7
+ { 0x6000, { 0x0407, 0x0406, 0 } }, // 8
+ { 0x8000, { 21600, 0, 0x406 } }, // 9
+ { 0xa000, { 0x409, 0, 0x406 } } // a
+};
+static const sal_Int32 mso_sptBentUpArrowDefault[] =
+{
+ 3, 9340, 18500, 7200
+};
+static const SvxMSDffTextRectangles mso_sptBentUpArrowTextRect[] =
+{
+ { { 2 MSO_I, 7 MSO_I }, { 1 MSO_I, 1 MSO_I } },
+ { { 7 MSO_I, 2 MSO_I }, { 1 MSO_I, 1 MSO_I } }
+};
+static const SvxMSDffHandle mso_sptBentUpArrowHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL,
+ 0x101, 0x102, 10800, 10800, 3 + 5, 21600, 0, 0x100 },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL,
+ 0x100, 0, 10800, 10800, 0x102, 3 + 10, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoBentUpArrow =
+{
+ (SvxMSDffVertPair*)mso_sptBentUpArrowVert, sizeof( mso_sptBentUpArrowVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptBentUpArrowSegm, sizeof( mso_sptBentUpArrowSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptBentUpArrowCalc, sizeof( mso_sptBentUpArrowCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptBentUpArrowDefault,
+ (SvxMSDffTextRectangles*)mso_sptBentUpArrowTextRect, sizeof( mso_sptBentUpArrowTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptBentUpArrowHandle, sizeof( mso_sptBentUpArrowHandle ) / sizeof( SvxMSDffHandle )
+};
+
+
+static const SvxMSDffVertPair mso_sptCurvedDownVert[] =
+{
+ { 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 sal_Int32 mso_sptCurvedDownDefault[] =
+{
+ 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,
+ (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
+ { 3375, 0 MSO_I }, { 1 MSO_I, 0 MSO_I }, { 1 MSO_I, 0 }, { 21600, 10800 },
+ { 1 MSO_I, 21600 }, { 1 MSO_I, 2 MSO_I }, { 3375, 2 MSO_I }, { 0, 0 MSO_I },
+ { 675, 0 MSO_I }, { 675, 2 MSO_I }, { 0, 2 MSO_I }, { 1350, 0 MSO_I },
+ { 2700, 0 MSO_I }, { 2700, 2 MSO_I }, { 1350, 2 MSO_I }
+};
+static const sal_uInt16 mso_sptStripedRightArrowSegm[] =
+{
+ 0x4000, 0x0006, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptStripedRightArrowCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x8000, { 21600, 0, DFF_Prop_adjust2Value } },
+ { 0x8000, { 21600, 0, 0x401 } },
+ { 0x6001, { 0x403, 0x400, 10800 } },
+ { 0x6000, { 0x401, 0x404, 0 } }
+};
+static const SvxMSDffTextRectangles mso_sptStripedRightArrowTextRect[] =
+{
+ { { 3375, 0 MSO_I }, { 5 MSO_I, 2 MSO_I } }
+};
+static const SvxMSDffHandle mso_sptStripedRightArrowHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 0x101, 10800, 10800, 3375, 21600, 0, 10800 }
+};
+static const mso_CustomShape msoStripedRightArrow =
+{
+ (SvxMSDffVertPair*)mso_sptStripedRightArrowVert, sizeof( mso_sptStripedRightArrowVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptStripedRightArrowSegm, sizeof( mso_sptStripedRightArrowSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptStripedRightArrowCalc, sizeof( mso_sptStripedRightArrowCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault16200and5400,
+ (SvxMSDffTextRectangles*)mso_sptStripedRightArrowTextRect, sizeof( mso_sptStripedRightArrowTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptStripedRightArrowHandle, sizeof( mso_sptStripedRightArrowHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptNotchedRightArrowVert[] = // adjustment1 : x 0 - 21600 (default 16200)
+{ // adjustment2 : y 0 - 10800 (default 5400)
+ { 0, 1 MSO_I }, { 0 MSO_I, 1 MSO_I }, { 0 MSO_I, 0 }, { 21600, 10800 },
+ { 0 MSO_I, 21600 }, { 0 MSO_I, 2 MSO_I }, { 0, 2 MSO_I }, { 5 MSO_I, 10800 }, { 0, 1 MSO_I }
+};
+static const SvxMSDffCalculationData mso_sptNotchedRightArrowCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } },
+ { 0x8000, { 21600, 0, DFF_Prop_adjust2Value } },
+ { 0x8000, { 21600, 0, DFF_Prop_adjustValue } },
+ { 0x8000, { 10800, 0, DFF_Prop_adjust2Value } },
+ { 0x6001, { 0x403, 0x404, 10800 } }
+};
+static const SvxMSDffTextRectangles mso_sptNotchedRightArrowTextRect[] = // todo
+{
+ { { 0, 0 }, { 21600, 21600 } }
+};
+static const SvxMSDffHandle mso_sptNotchedRightArrowHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 0x101, 10800, 10800, 0, 21600, 0, 10800 }
+};
+static const mso_CustomShape msoNotchedRightArrow =
+{
+ (SvxMSDffVertPair*)mso_sptNotchedRightArrowVert, sizeof( mso_sptNotchedRightArrowVert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ (SvxMSDffCalculationData*)mso_sptNotchedRightArrowCalc, sizeof( mso_sptNotchedRightArrowCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault16200and5400,
+ (SvxMSDffTextRectangles*)mso_sptNotchedRightArrowTextRect, sizeof( mso_sptNotchedRightArrowTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptNotchedRightArrowHandle, sizeof( mso_sptNotchedRightArrowHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptHomePlateVert[] = // adjustment1 : x 0 - 21600
+{
+ { 0, 0 }, { 0 MSO_I, 0 }, { 21600, 10800 }, { 0 MSO_I, 21600 },
+ { 0, 21600 }
+};
+static const sal_uInt16 mso_sptHomePlateSegm[] =
+{
+ 0x4000, 0x0004, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptHomePlateCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }
+};
+static const sal_Int32 mso_sptHomePlateDefault[] =
+{
+ 1, 16200
+};
+static const SvxMSDffTextRectangles mso_sptHomePlateTextRect[] = // todo
+{
+ { { 0, 0 }, { 21600, 21600 } }
+};
+static const SvxMSDffHandle mso_sptHomePlateHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 0, 10800, 10800, 0, 21600, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoHomePlate =
+{
+ (SvxMSDffVertPair*)mso_sptHomePlateVert, sizeof( mso_sptHomePlateVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptHomePlateSegm, sizeof( mso_sptHomePlateSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptHomePlateCalc, sizeof( mso_sptHomePlateCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptHomePlateDefault,
+ (SvxMSDffTextRectangles*)mso_sptHomePlateTextRect, sizeof( mso_sptHomePlateTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptHomePlateHandle, sizeof( mso_sptHomePlateHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptChevronVert[] = // adjustment1 : x 0 - 21600
+{
+ { 0, 0 }, { 0 MSO_I, 0 }, { 21600, 10800 }, { 0 MSO_I, 21600 },
+ { 0, 21600 }, { 1 MSO_I, 10800 }
+};
+static const sal_uInt16 mso_sptChevronSegm[] =
+{
+ 0x4000, 0x0005, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptChevronCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x8000, { 21600, 0, 0x0400 } }
+};
+static const sal_Int32 mso_sptChevronDefault[] =
+{
+ 1, 16200
+};
+static const SvxMSDffTextRectangles mso_sptChevronTextRect[] = // todo
+{
+ { { 0, 0 }, { 21600, 21600 } }
+};
+static const SvxMSDffHandle mso_sptChevronHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 0, 10800, 10800, 0, 21600, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoChevron =
+{
+ (SvxMSDffVertPair*)mso_sptChevronVert, sizeof( mso_sptChevronVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptChevronSegm, sizeof( mso_sptChevronSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptChevronCalc, sizeof( mso_sptChevronCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptChevronDefault,
+ (SvxMSDffTextRectangles*)mso_sptChevronTextRect, sizeof( mso_sptChevronTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptChevronHandle, sizeof( mso_sptChevronHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptRightArrowCalloutVert[] = // adjustment1 : x 0 - 21000
+{ // adjustment2 : y 0 - 10800
+ { 0, 0 }, { 0 MSO_I, 0 }, { 0 MSO_I, 3 MSO_I }, { 2 MSO_I, 3 MSO_I },
+ { 2 MSO_I, 1 MSO_I }, { 21600, 10800 }, { 2 MSO_I, 4 MSO_I }, { 2 MSO_I, 5 MSO_I },
+ { 0 MSO_I, 5 MSO_I }, { 0 MSO_I, 21600 }, { 0, 21600 }
+};
+static const sal_uInt16 mso_sptRightArrowCalloutSegm[] =
+{
+ 0x4000, 0x000a, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptRightArrowCalloutCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust3Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust4Value, 0, 0 } },
+ { 0x8000, { 21600, 0, 0x0401 } },
+ { 0x8000, { 21600, 0, 0x0403 } }
+};
+static const sal_Int32 mso_sptRightArrowCalloutDefault[] =
+{
+ 4, 14400, 5400, 18000, 8100
+};
+static const SvxMSDffTextRectangles mso_sptRightArrowCalloutTextRect[] =
+{
+ { { 0, 0 }, { 0 MSO_I, 21600 } }
+};
+static const SvxMSDffHandle mso_sptRightArrowCalloutHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL,
+ 0x100, 0, 10800, 10800, 0, 0x102, 0x80000000, 0x7fffffff },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL,
+ 0x102, 0x103, 10800, 10800, 0x100, 21600, 0x101, 10800 },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL,
+ 1, 0x101, 10800, 10800, 0x80000000, 0x7fffffff, 0, 0x103 }
+};
+static const mso_CustomShape msoRightArrowCallout =
+{
+ (SvxMSDffVertPair*)mso_sptRightArrowCalloutVert, sizeof( mso_sptRightArrowCalloutVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptRightArrowCalloutSegm, sizeof( mso_sptRightArrowCalloutSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptRightArrowCalloutCalc, sizeof( mso_sptRightArrowCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptRightArrowCalloutDefault,
+ (SvxMSDffTextRectangles*)mso_sptRightArrowCalloutTextRect, sizeof( mso_sptRightArrowCalloutTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptRightArrowCalloutHandle, sizeof( mso_sptRightArrowCalloutHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptLeftArrowCalloutVert[] = // adjustment1 : x 0 - 21600, adjustment2 : y 0 - 10800
+{ // adjustment3 : x 0 - 21600, adjustment4 : y 0 - 10800
+ { 0 MSO_I, 0 }, { 21600, 0 }, { 21600, 21600 }, { 0 MSO_I, 21600 },
+ { 0 MSO_I, 5 MSO_I }, { 2 MSO_I, 5 MSO_I }, { 2 MSO_I, 4 MSO_I }, { 0, 10800 },
+ { 2 MSO_I, 1 MSO_I }, { 2 MSO_I, 3 MSO_I }, { 0 MSO_I, 3 MSO_I }
+};
+static const sal_uInt16 mso_sptLeftArrowCalloutSegm[] =
+{
+ 0x4000, 0x000a, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptLeftArrowCalloutCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust3Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust4Value, 0, 0 } },
+ { 0x8000, { 21600, 0, 0x0401 } },
+ { 0x8000, { 21600, 0, 0x0403 } }
+};
+static const sal_Int32 mso_sptLeftArrowCalloutDefault[] =
+{
+ 4, 7200, 5400, 3600, 8100
+};
+static const SvxMSDffTextRectangles mso_sptLeftArrowCalloutTextRect[] =
+{
+ { { 0 MSO_I, 0 }, { 21600, 21600 } }
+};
+static const SvxMSDffHandle mso_sptLeftArrowCalloutHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL,
+ 0x100, 0, 10800, 10800, 0x102, 21600, 0x80000000, 0x7fffffff },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL,
+ 0x102, 0x103, 10800, 10800, 0, 0x100, 0x101, 10800 },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL,
+ 0, 0x101, 10800, 10800, 0x80000000, 0x7fffffff, 0, 0x103 }
+};
+static const mso_CustomShape msoLeftArrowCallout =
+{
+ (SvxMSDffVertPair*)mso_sptLeftArrowCalloutVert, sizeof( mso_sptLeftArrowCalloutVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptLeftArrowCalloutSegm, sizeof( mso_sptLeftArrowCalloutSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptLeftArrowCalloutCalc, sizeof( mso_sptLeftArrowCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptLeftArrowCalloutDefault,
+ (SvxMSDffTextRectangles*)mso_sptLeftArrowCalloutTextRect, sizeof( mso_sptLeftArrowCalloutTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptLeftArrowCalloutHandle, sizeof( mso_sptLeftArrowCalloutHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptUpArrowCalloutVert[] =
+{
+ { 21600, 0 MSO_I }, { 21600, 21600 }, { 0, 21600 }, { 0, 0 MSO_I },
+ { 3 MSO_I, 0 MSO_I }, { 3 MSO_I, 2 MSO_I }, { 1 MSO_I, 2 MSO_I }, { 10800, 0 },
+ { 4 MSO_I, 2 MSO_I }, { 5 MSO_I, 2 MSO_I }, { 5 MSO_I, 0 MSO_I }
+};
+static const sal_uInt16 mso_sptUpArrowCalloutSegm[] =
+{
+ 0x4000, 0x000a, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptUpArrowCalloutCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust3Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust4Value, 0, 0 } },
+ { 0x8000, { 21600, 0, 0x0401 } },
+ { 0x8000, { 21600, 0, 0x0403 } }
+};
+static const sal_Int32 mso_sptUpArrowCalloutDefault[] =
+{
+ 4, 7200, 5400, 3600, 8100
+};
+static const SvxMSDffTextRectangles mso_sptUpArrowCalloutTextRect[] =
+{
+ { { 0, 0 MSO_I }, { 21600, 21600 } }
+};
+static const SvxMSDffHandle mso_sptUpArrowCalloutHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL,
+ 0, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 0x102, 21600 },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL,
+ 0x103, 0x102, 10800, 10800, 0x101, 10800, 0, 0x100 },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL,
+ 0x101, 0, 10800, 10800, 0, 0x103, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoUpArrowCallout =
+{
+ (SvxMSDffVertPair*)mso_sptUpArrowCalloutVert, sizeof( mso_sptUpArrowCalloutVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptUpArrowCalloutSegm, sizeof( mso_sptUpArrowCalloutSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptUpArrowCalloutCalc, sizeof( mso_sptUpArrowCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptUpArrowCalloutDefault,
+ (SvxMSDffTextRectangles*)mso_sptUpArrowCalloutTextRect, sizeof( mso_sptUpArrowCalloutTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptUpArrowCalloutHandle, sizeof( mso_sptUpArrowCalloutHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptDownArrowCalloutVert[] =
+{
+ { 0, 0 MSO_I }, { 0, 0 }, { 21600, 0 }, { 21600, 0 MSO_I },
+ { 5 MSO_I, 0 MSO_I }, { 5 MSO_I, 2 MSO_I }, { 4 MSO_I, 2 MSO_I }, { 10800, 21600 },
+ { 1 MSO_I, 2 MSO_I }, { 3 MSO_I, 2 MSO_I }, { 3 MSO_I, 0 MSO_I }
+};
+static const sal_uInt16 mso_sptDownArrowCalloutSegm[] =
+{
+ 0x4000, 0x000a, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptDownArrowCalloutCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust3Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust4Value, 0, 0 } },
+ { 0x8000, { 21600, 0, 0x0401 } },
+ { 0x8000, { 21600, 0, 0x0403 } }
+};
+static const sal_Int32 mso_sptDownArrowCalloutDefault[] =
+{
+ 4, 14400, 5400, 18000, 8100
+};
+static const SvxMSDffTextRectangles mso_sptDownArrowCalloutTextRect[] =
+{
+ { { 0, 0 }, { 21600, 0 MSO_I } }
+};
+static const SvxMSDffHandle mso_sptDownArrowCalloutHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL,
+ 0, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 0, 0x102 },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL,
+ 0x103, 0x102, 10800, 10800, 0x101, 10800, 0x100, 21600 },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL,
+ 0x101, 1, 10800, 10800, 0, 0x103, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoDownArrowCallout =
+{
+ (SvxMSDffVertPair*)mso_sptDownArrowCalloutVert, sizeof( mso_sptDownArrowCalloutVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptDownArrowCalloutSegm, sizeof( mso_sptDownArrowCalloutSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptDownArrowCalloutCalc, sizeof( mso_sptDownArrowCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDownArrowCalloutDefault,
+ (SvxMSDffTextRectangles*)mso_sptDownArrowCalloutTextRect, sizeof( mso_sptDownArrowCalloutTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptDownArrowCalloutHandle, sizeof( mso_sptDownArrowCalloutHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptLeftRightArrowCalloutVert[] =
+{
+ { 0 MSO_I, 0 }, { 4 MSO_I, 0 }, { 4 MSO_I, 3 MSO_I }, { 6 MSO_I, 3 MSO_I },
+ { 6 MSO_I, 1 MSO_I }, { 21600, 10800 }, { 6 MSO_I, 5 MSO_I }, { 6 MSO_I, 7 MSO_I },
+ { 4 MSO_I, 7 MSO_I }, { 4 MSO_I, 21600 }, { 0 MSO_I, 21600 }, { 0 MSO_I, 7 MSO_I },
+ { 2 MSO_I, 7 MSO_I }, { 2 MSO_I, 5 MSO_I }, { 0, 10800 }, { 2 MSO_I, 1 MSO_I },
+ { 2 MSO_I, 3 MSO_I }, { 0 MSO_I, 3 MSO_I }
+};
+static const sal_uInt16 mso_sptLeftRightArrowCalloutSegm[] =
+{
+ 0x4000, 0x0011, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptLeftRightArrowCalloutCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust3Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust4Value, 0, 0 } },
+ { 0x8000, { 21600, 0, 0x0400 } },
+ { 0x8000, { 21600, 0, 0x0401 } },
+ { 0x8000, { 21600, 0, 0x0402 } },
+ { 0x8000, { 21600, 0, 0x0403 } }
+};
+static const sal_Int32 mso_sptLeftRightArrowCalloutDefault[] =
+{
+ 4, 5400, 5500, 2700, 8100
+};
+static const SvxMSDffTextRectangles mso_sptLeftRightArrowCalloutTextRect[] =
+{
+ { { 0 MSO_I, 0 }, { 4 MSO_I, 21600 } }
+};
+static const SvxMSDffHandle mso_sptLeftRightArrowCalloutHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL,
+ 0x100, 0, 10800, 10800, 0x102, 10800, 0x80000000, 0x7fffffff },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL,
+ 0x102, 0x103, 10800, 10800, 0, 0x100, 0x101, 10800 },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL,
+ 0, 0x101, 10800, 10800, 0x80000000, 0x7fffffff, 0, 0x103 }
+};
+static const mso_CustomShape msoLeftRightArrowCallout =
+{
+ (SvxMSDffVertPair*)mso_sptLeftRightArrowCalloutVert, sizeof( mso_sptLeftRightArrowCalloutVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptLeftRightArrowCalloutSegm, sizeof( mso_sptLeftRightArrowCalloutSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptLeftRightArrowCalloutCalc, sizeof( mso_sptLeftRightArrowCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptLeftRightArrowCalloutDefault,
+ (SvxMSDffTextRectangles*)mso_sptLeftRightArrowCalloutTextRect, sizeof( mso_sptLeftRightArrowCalloutTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptLeftRightArrowCalloutHandle, sizeof( mso_sptLeftRightArrowCalloutHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptUpDownArrowCalloutVert[] =
+{
+ { 0, 0 MSO_I }, { 0, 4 MSO_I }, { 3 MSO_I, 4 MSO_I }, { 3 MSO_I, 6 MSO_I },
+ { 1 MSO_I, 6 MSO_I }, { 10800, 21600 }, { 5 MSO_I, 6 MSO_I }, { 7 MSO_I, 6 MSO_I },
+ { 7 MSO_I, 4 MSO_I }, { 21600, 4 MSO_I }, { 21600, 0 MSO_I }, { 7 MSO_I, 0 MSO_I },
+ { 7 MSO_I, 2 MSO_I }, { 5 MSO_I, 2 MSO_I }, { 10800, 0 }, { 1 MSO_I, 2 MSO_I },
+ { 3 MSO_I, 2 MSO_I }, { 3 MSO_I, 0 MSO_I }
+};
+static const sal_uInt16 mso_sptUpDownArrowCalloutSegm[] =
+{
+ 0x4000, 0x0011, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptUpDownArrowCalloutCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust3Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust4Value, 0, 0 } },
+ { 0x8000, { 21600, 0, 0x0400 } },
+ { 0x8000, { 21600, 0, 0x0401 } },
+ { 0x8000, { 21600, 0, 0x0402 } },
+ { 0x8000, { 21600, 0, 0x0403 } }
+};
+static const sal_Int32 mso_sptUpDownArrowCalloutDefault[] =
+{
+ 4, 5400, 5500, 2700, 8100
+};
+static const SvxMSDffTextRectangles mso_sptUpDownArrowCalloutTextRect[] =
+{
+ { { 0, 0 MSO_I }, { 21600, 4 MSO_I } }
+};
+static const SvxMSDffHandle mso_sptUpDownArrowCalloutHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL,
+ 0, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 0x102, 10800 },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL,
+ 0x103, 0x102, 10800, 10800, 0x101, 10800, 0, 0x100 },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL,
+ 0x101, 0, 10800, 10800, 0, 0x103, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoUpDownArrowCallout =
+{
+ (SvxMSDffVertPair*)mso_sptUpDownArrowCalloutVert, sizeof( mso_sptUpDownArrowCalloutVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptUpDownArrowCalloutSegm, sizeof( mso_sptUpDownArrowCalloutSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptUpDownArrowCalloutCalc, sizeof( mso_sptUpDownArrowCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptUpDownArrowCalloutDefault,
+ (SvxMSDffTextRectangles*)mso_sptUpDownArrowCalloutTextRect, sizeof( mso_sptUpDownArrowCalloutTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptUpDownArrowCalloutHandle, sizeof( mso_sptUpDownArrowCalloutHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptQuadArrowCalloutVert[] =
+{
+ { 0 MSO_I, 0 MSO_I }, { 3 MSO_I, 0 MSO_I }, { 3 MSO_I, 2 MSO_I }, { 1 MSO_I, 2 MSO_I },
+ { 10800, 0 }, { 5 MSO_I, 2 MSO_I }, { 7 MSO_I, 2 MSO_I }, { 7 MSO_I, 0 MSO_I },
+ { 4 MSO_I, 0 MSO_I }, { 4 MSO_I, 3 MSO_I }, { 6 MSO_I, 3 MSO_I }, { 6 MSO_I, 1 MSO_I },
+ { 21600, 10800 }, { 6 MSO_I, 5 MSO_I }, { 6 MSO_I, 7 MSO_I }, { 4 MSO_I, 7 MSO_I },
+ { 4 MSO_I, 4 MSO_I }, { 7 MSO_I, 4 MSO_I }, { 7 MSO_I, 6 MSO_I }, { 5 MSO_I, 6 MSO_I },
+ { 10800, 21600 }, { 1 MSO_I, 6 MSO_I }, { 3 MSO_I, 6 MSO_I }, { 3 MSO_I, 4 MSO_I },
+ { 0 MSO_I, 4 MSO_I }, { 0 MSO_I, 7 MSO_I }, { 2 MSO_I, 7 MSO_I }, { 2 MSO_I, 5 MSO_I },
+ { 0, 10800 }, { 2 MSO_I, 1 MSO_I }, { 2 MSO_I, 3 MSO_I }, { 0 MSO_I, 3 MSO_I }
+};
+static const sal_uInt16 mso_sptQuadArrowCalloutSegm[] =
+{
+ 0x4000, 0x001f, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptQuadArrowCalloutCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust3Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust4Value, 0, 0 } },
+ { 0x8000, { 21600, 0, 0x0400 } },
+ { 0x8000, { 21600, 0, 0x0401 } },
+ { 0x8000, { 21600, 0, 0x0402 } },
+ { 0x8000, { 21600, 0, 0x0403 } }
+};
+static const sal_Int32 mso_sptQuadArrowCalloutDefault[] =
+{
+ 4, 5400, 8100, 2700, 9400
+};
+static const SvxMSDffTextRectangles mso_sptQuadArrowCalloutTextRect[] =
+{
+ { { 0 MSO_I, 0 MSO_I }, { 4 MSO_I, 4 MSO_I } }
+};
+static const SvxMSDffHandle mso_sptQuadArrowCalloutHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL,
+ 0, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 0x102, 0x101 },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL,
+ 0x101, 0, 10800, 10800, 0x100, 10800, 0x80000000, 0x7fffffff },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL,
+ 0x103, 0x102, 10800, 10800, 0x101, 10800, 0, 0x100 }
+};
+static const mso_CustomShape msoQuadArrowCallout =
+{
+ (SvxMSDffVertPair*)mso_sptQuadArrowCalloutVert, sizeof( mso_sptQuadArrowCalloutVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptQuadArrowCalloutSegm, sizeof( mso_sptQuadArrowCalloutSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptQuadArrowCalloutCalc, sizeof( mso_sptQuadArrowCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptQuadArrowCalloutDefault,
+ (SvxMSDffTextRectangles*)mso_sptQuadArrowCalloutTextRect, sizeof( mso_sptQuadArrowCalloutTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptQuadArrowCalloutHandle, sizeof( mso_sptQuadArrowCalloutHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptCircularArrowVert[] =
+{
+ { 0x03 MSO_I, 0x03 MSO_I },
+ { 0x14 MSO_I, 0x14 MSO_I },
+ { 0x13 MSO_I, 0x12 MSO_I },
+ { 0x11 MSO_I, 0x10 MSO_I },
+ { 0, 0 }, { 21600, 21600 },
+ { 0x09 MSO_I, 0x08 MSO_I },
+ { 0x0B MSO_I, 0x0A MSO_I },
+ { 0x18 MSO_I, 0x17 MSO_I },
+ { 0x2F MSO_I, 0x2E MSO_I },
+ { 0x1D MSO_I, 0x1C MSO_I }
+};
+static const sal_uInt16 mso_sptCircularArrowSegm[] =
+{
+ 0xa404, 0xa504, 0x0003, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptCircularArrowCalc[] =
+{
+ { 0x2000, { 0x0147, 0x0000, 0x0000 } },
+ { 0x2000, { 0x0148, 0x0000, 0x0000 } },
+ { 0x2000, { 0x0149, 0x0000, 0x0000 } },
+ { 0x4000, { 0x2A30, 0x0149, 0x0000 } },
+ { 0x4009, { 0x2A30, 0x0147, 0x0000 } },
+ { 0x400A, { 0x2A30, 0x0147, 0x0000 } },
+ { 0x4009, { 0x2A30, 0x0148, 0x0000 } },
+ { 0x400A, { 0x2A30, 0x0148, 0x0000 } },
+ { 0x2000, { 0x0404, 0x2A30, 0x0000 } },
+ { 0x2000, { 0x0405, 0x2A30, 0x0000 } },
+ { 0x2000, { 0x0406, 0x2A30, 0x0000 } },
+ { 0x2000, { 0x0407, 0x2A30, 0x0000 } },
+ { 0x6009, { 0x0403, 0x0147, 0x0000 } },
+ { 0x600A, { 0x0403, 0x0147, 0x0000 } },
+ { 0x6009, { 0x0403, 0x0148, 0x0000 } },
+ { 0x600A, { 0x0403, 0x0148, 0x0000 } },
+ { 0x2000, { 0x040C, 0x2A30, 0x0000 } },
+ { 0x2000, { 0x040D, 0x2A30, 0x0000 } },
+ { 0x2000, { 0x040E, 0x2A30, 0x0000 } },
+ { 0x2000, { 0x040F, 0x2A30, 0x0000 } },
+ { 0x8000, { 0x5460, 0x0000, 0x0403 } },
+ { 0x4009, { 0x34BC, 0x0148, 0x0000 } },
+ { 0x400A, { 0x34BC, 0x0148, 0x0000 } },
+ { 0x2000, { 0x0415, 0x2A30, 0x0000 } },
+ { 0x2000, { 0x0416, 0x2A30, 0x0000 } },
+ { 0x2000, { 0x0149, 0x0000, 0x0A8C } },
+ { 0x6009, { 0x0419, 0x0148, 0x0000 } },
+ { 0x600A, { 0x0419, 0x0148, 0x0000 } },
+ { 0x2000, { 0x041A, 0x2A30, 0x0000 } },
+ { 0x2000, { 0x041B, 0x2A30, 0x0000 } },
+ { 0xA000, { 0x041D, 0x0000, 0x0418 } },
+ { 0xA000, { 0x041D, 0x0000, 0x0418 } },
+ { 0x6001, { 0x041E, 0x041F, 0x0001 } },
+ { 0xA000, { 0x041C, 0x0000, 0x0417 } },
+ { 0xA000, { 0x041C, 0x0000, 0x0417 } },
+ { 0x6001, { 0x0421, 0x0422, 0x0001 } },
+ { 0x6000, { 0x0420, 0x0423, 0x0000 } },
+ { 0x200D, { 0x0424, 0x0000, 0x0000 } },
+ { 0x200E, { 0x0148, 0x002D, 0x0000 } },
+ { 0x6009, { 0x0425, 0x0426, 0x0000 } },
+ { 0x200E, { 0x0148, 0x002D, 0x0000 } },
+ { 0x600A, { 0x0425, 0x0428, 0x0000 } },
+ { 0x000E, { 0x0000, 0x002D, 0x0000 } },
+ { 0x6009, { 0x0427, 0x042A, 0x0000 } },
+ { 0x000E, { 0x0000, 0x002D, 0x0000 } },
+ { 0x6009, { 0x0429, 0x042C, 0x0000 } },
+ { 0x6000, { 0x041C, 0x042B, 0x0000 } },
+ { 0x6000, { 0x041D, 0x042D, 0x0000 } }
+};
+static const sal_Int32 mso_sptCircularArrowDefault[] =
+{
+ 3, 180, 0, 5500
+};
+static const SvxMSDffTextRectangles mso_sptCircularArrowTextRect[] = // todo
+{
+ { { 0, 0 }, { 21600, 21600 } }
+};
+static const SvxMSDffHandle mso_sptCircularArrowHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_POLAR | MSDFF_HANDLE_FLAGS_RADIUS_RANGE,
+ 10800, 0x100, 10800, 10800, 10800, 10800, 0xff4c0000, 0x00b40000 },
+ { MSDFF_HANDLE_FLAGS_POLAR | MSDFF_HANDLE_FLAGS_RADIUS_RANGE,
+ 0x102, 0x101, 10800, 10800, 0, 10800, 0xff4c0000, 0x00b40000 }
+};
+static const mso_CustomShape msoCircularArrow =
+{
+ (SvxMSDffVertPair*)mso_sptCircularArrowVert, sizeof( mso_sptCircularArrowVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCircularArrowSegm, sizeof( mso_sptCircularArrowSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCircularArrowCalc, sizeof( mso_sptCircularArrowCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptCircularArrowDefault,
+ (SvxMSDffTextRectangles*)mso_sptCircularArrowTextRect, sizeof( mso_sptCircularArrowTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptCircularArrowHandle, sizeof( mso_sptCircularArrowHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptCubeVert[] =
+{
+ { 0, 12 MSO_I }, { 0, 1 MSO_I }, { 2 MSO_I, 0 }, { 11 MSO_I, 0 }, { 11 MSO_I, 3 MSO_I }, { 4 MSO_I, 12 MSO_I },
+ { 0, 1 MSO_I }, { 2 MSO_I, 0 }, { 11 MSO_I, 0 }, { 4 MSO_I, 1 MSO_I },
+ { 4 MSO_I, 12 MSO_I }, { 4 MSO_I, 1 MSO_I }, { 11 MSO_I, 0 }, { 11 MSO_I, 3 MSO_I }
+};
+static const sal_uInt16 mso_sptCubeSegm[] =
+{
+ 0x4000, 0x0005, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptCubeCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x6000, { DFF_Prop_geoTop, 0x400, 0 } },
+ { 0x6000, { DFF_Prop_geoLeft, 0x400, 0 } },
+ { 0xa000, { DFF_Prop_geoBottom, 0, 0x400 } },
+ { 0xa000, { DFF_Prop_geoRight, 0, 0x400 } },
+ { 0xa000, { DFF_Prop_geoRight, 0, 0x402 } }, // 5
+ { 0x2001, { 0x405, 1, 2 } }, // 6
+ { 0x6000, { 0x402, 0x406, 0 } }, // 7
+ { 0xa000, { DFF_Prop_geoBottom, 0, 0x401 } }, // 8
+ { 0x2001, { 0x408, 1, 2 } }, // 9
+ { 0x6000, { 0x401, 0x409, 0 } }, // 10
+ { 0x2000, { DFF_Prop_geoRight, 0, 0 } }, // 11
+ { 0x2000, { DFF_Prop_geoBottom, 0, 0 } } // 12
+};
+static const SvxMSDffTextRectangles mso_sptCubeTextRect[] =
+{
+ { { 0, 1 MSO_I }, { 4 MSO_I, 12 MSO_I } }
+};
+static const SvxMSDffHandle mso_sptCubeHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_SWITCHED,
+ 0, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 0, 21600 }
+};
+static const SvxMSDffVertPair mso_sptCubeGluePoints[] =
+{
+ { 7 MSO_I, 0 }, { 6 MSO_I, 1 MSO_I }, { 0, 10 MSO_I }, { 6 MSO_I, 21600 }, { 4 MSO_I, 10 MSO_I }, { 21600, 9 MSO_I }
+};
+static const mso_CustomShape msoCube =
+{
+ (SvxMSDffVertPair*)mso_sptCubeVert, sizeof( mso_sptCubeVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCubeSegm, sizeof( mso_sptCubeSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCubeCalc, sizeof( mso_sptCubeCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault5400,
+ (SvxMSDffTextRectangles*)mso_sptCubeTextRect, sizeof( mso_sptCubeTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 10800, 10800,
+ (SvxMSDffVertPair*)mso_sptCubeGluePoints, sizeof( mso_sptCubeGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptCubeHandle, sizeof( mso_sptCubeHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptBevelVert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 21600 }, { 0, 21600 },
+ { 0, 0 }, { 21600, 0 }, { 1 MSO_I, 0 MSO_I }, { 0 MSO_I, 0 MSO_I },
+ { 21600, 0 }, { 21600, 21600 }, { 1 MSO_I, 2 MSO_I }, { 1 MSO_I, 0 MSO_I },
+ { 21600, 21600 }, { 0, 21600 }, { 0 MSO_I, 2 MSO_I }, { 1 MSO_I, 2 MSO_I },
+ { 0, 21600 }, { 0, 0 }, { 0 MSO_I, 0 MSO_I }, { 0 MSO_I, 2 MSO_I }
+};
+static const sal_uInt16 mso_sptBevelSegm[] =
+{
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptBevelCalc[] =
+{
+ { 0x2001, { DFF_Prop_adjustValue, 21599, 21600 } },
+ { 0xa000, { DFF_Prop_geoRight, 0, 0x400 } },
+ { 0xa000, { DFF_Prop_geoBottom, 0, 0x400 } }
+};
+
+static const SvxMSDffTextRectangles mso_sptBevelTextRect[] =
+{
+ { { 0 MSO_I, 0 MSO_I }, { 1 MSO_I, 2 MSO_I } }
+};
+static const SvxMSDffHandle mso_sptBevelHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_SWITCHED,
+ 0x100, 0, 10800, 10800, 0, 10800, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoBevel =
+{
+ (SvxMSDffVertPair*)mso_sptBevelVert, sizeof( mso_sptBevelVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptBevelSegm, sizeof( mso_sptBevelSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptBevelCalc, sizeof( mso_sptBevelCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault2700,
+ (SvxMSDffTextRectangles*)mso_sptBevelTextRect, sizeof( mso_sptBevelTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 10800, 10800,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptBevelHandle, sizeof( mso_sptBevelHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptFoldedCornerVert[] = // adjustment1 : x 10800 - 21600
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 0 MSO_I }, { 0 MSO_I, 21600 },
+ { 0, 21600 }, { 0 MSO_I, 21600 }, { 3 MSO_I, 0 MSO_I }, { 8 MSO_I, 9 MSO_I },
+ { 10 MSO_I, 11 MSO_I }, { 21600, 0 MSO_I }
+};
+static const sal_uInt16 mso_sptFoldedCornerSegm[] =
+{
+ 0x4000, 0x0004, 0x6001, 0x8000,
+ 0x4000, 0x0001, 0x2001, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptFoldedCornerCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x8000, { 21600, 0, 0x400 } },
+ { 0x2001, { 0x0401, 8000, 10800 } },
+ { 0x8000, { 21600, 0, 0x0402 } },
+ { 0x2001, { 0x0401, 1, 2 } },
+ { 0x2001, { 0x0401, 1, 4 } },
+ { 0x2001, { 0x0401, 1, 7 } },
+ { 0x2001, { 0x0401, 1, 16 } },
+ { 0x6000, { 0x0403, 0x405, 0 } },
+ { 0x6000, { 0x0400, 0x406, 0 } },
+ { 0x8000, { 21600, 0, 0x404 } },
+ { 0x6000, { 0x400, 0x407, 0 } }
+};
+static const sal_Int32 mso_sptFoldedCornerDefault[] =
+{
+ 1, 18900
+};
+static const SvxMSDffTextRectangles mso_sptFoldedCornerTextRect[] =
+{
+ { { 0, 0 }, { 21600, 11 MSO_I } }
+};
+static const SvxMSDffHandle mso_sptFoldedCornerHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 1, 10800, 10800, 10800, 21600, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoFoldedCorner =
+{
+ (SvxMSDffVertPair*)mso_sptFoldedCornerVert, sizeof( mso_sptFoldedCornerVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptFoldedCornerSegm, sizeof( mso_sptFoldedCornerSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptFoldedCornerCalc, sizeof( mso_sptFoldedCornerCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptFoldedCornerDefault,
+ (SvxMSDffTextRectangles*)mso_sptFoldedCornerTextRect, sizeof( mso_sptFoldedCornerTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptStandardGluePoints, sizeof( mso_sptStandardGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptFoldedCornerHandle, sizeof( mso_sptFoldedCornerHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptActionButtonBlankVert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 21600 }, { 0, 21600 },
+ { 0, 0 }, { 21600, 0 }, { 1 MSO_I, 0 MSO_I }, { 0 MSO_I, 0 MSO_I },
+ { 21600, 0 }, { 21600, 21600 }, { 1 MSO_I, 2 MSO_I }, { 1 MSO_I, 0 MSO_I },
+ { 21600, 21600 }, { 0, 21600 }, { 0 MSO_I, 2 MSO_I }, { 1 MSO_I, 2 MSO_I },
+ { 0, 21600 }, { 0, 0 }, { 0 MSO_I, 0 MSO_I }, { 0 MSO_I, 2 MSO_I }
+};
+static const sal_uInt16 mso_sptActionButtonBlankSegm[] =
+{
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptActionButtonBlankCalc[] =
+{
+ { 0x2001, { DFF_Prop_adjustValue, 21599, 21600 } },
+ { 0xa000, { DFF_Prop_geoRight, 0, 0x400 } },
+ { 0xa000, { DFF_Prop_geoBottom, 0, 0x400 } }
+};
+static const SvxMSDffTextRectangles mso_sptActionButtonBlankTextRect[] =
+{
+ { { 0 MSO_I, 0 MSO_I }, { 1 MSO_I, 2 MSO_I } }
+};
+static const SvxMSDffHandle mso_sptButtonHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_SWITCHED,
+ 0x100, 0, 10800, 10800, 0, 5400, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoActionButtonBlank =
+{
+ (SvxMSDffVertPair*)mso_sptActionButtonBlankVert, sizeof( mso_sptActionButtonBlankVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptActionButtonBlankSegm, sizeof( mso_sptActionButtonBlankSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptActionButtonBlankCalc, sizeof( mso_sptActionButtonBlankCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault1400,
+ (SvxMSDffTextRectangles*)mso_sptActionButtonBlankTextRect, sizeof( mso_sptActionButtonBlankTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 10800, 10800,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptButtonHandle, sizeof( mso_sptButtonHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffTextRectangles mso_sptActionButtonTextRect[] =
+{
+ { { 1 MSO_I, 2 MSO_I }, { 3 MSO_I, 4 MSO_I } }
+};
+static const SvxMSDffVertPair mso_sptActionButtonHomeVert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 21600 }, { 0, 21600 },
+ { 0, 0 }, { 21600, 0 }, { 3 MSO_I, 2 MSO_I }, { 1 MSO_I, 2 MSO_I },
+ { 21600, 0 }, { 21600, 21600 }, { 3 MSO_I, 4 MSO_I }, { 3 MSO_I, 2 MSO_I },
+ { 21600, 21600 }, { 0, 21600 }, { 1 MSO_I, 4 MSO_I }, { 3 MSO_I, 4 MSO_I },
+ { 0, 21600 }, { 0, 0 }, { 1 MSO_I, 2 MSO_I }, { 1 MSO_I, 4 MSO_I },
+
+ { 7 MSO_I, 0xa MSO_I }, { 0xc MSO_I, 0xe MSO_I }, { 0xc MSO_I, 0x10 MSO_I }, { 0x12 MSO_I, 0x10 MSO_I },
+ { 0x12 MSO_I, 0x14 MSO_I }, { 0x16 MSO_I, 8 MSO_I }, { 0x18 MSO_I, 8 MSO_I }, { 0x18 MSO_I, 0x1a MSO_I },
+ { 0x1c MSO_I, 0x1a MSO_I }, { 0x1c MSO_I, 8 MSO_I }, { 0x1e MSO_I, 8 MSO_I },
+
+ { 0xc MSO_I, 0xe MSO_I }, { 0xc MSO_I, 0x10 MSO_I }, { 0x12 MSO_I, 0x10 MSO_I },{ 0x12 MSO_I, 0x14 MSO_I },
+
+ { 0x20 MSO_I, 0x24 MSO_I }, { 0x22 MSO_I, 0x24 MSO_I }, { 0x22 MSO_I, 0x1a MSO_I }, { 0x18 MSO_I, 0x1a MSO_I },
+ { 0x18 MSO_I, 8 MSO_I }, { 0x1c MSO_I, 8 MSO_I }, { 0x1c MSO_I, 0x1a MSO_I }, { 0x20 MSO_I, 0x1a MSO_I }
+
+};
+static const sal_uInt16 mso_sptActionButtonHomeSegm[] =
+{
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x000a, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0007, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptActionButtonHomeCalc[] = // adj value 0 - 5400
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x6000, { DFF_Prop_geoLeft, DFF_Prop_adjustValue, 0 } },
+ { 0x6000, { DFF_Prop_geoTop, DFF_Prop_adjustValue, 0 } },
+ { 0xa000, { DFF_Prop_geoRight, 0, DFF_Prop_adjustValue } },
+ { 0xa000, { DFF_Prop_geoBottom, 0, DFF_Prop_adjustValue } },
+ { 0x8000, { 10800, 0, DFF_Prop_adjustValue } },
+ { 0x2001, { 0x0405, 1, 10800 } }, // scaling 6
+ { 0x2001, { DFF_Prop_geoRight, 1, 2 } }, // lr center 7
+ { 0x2001, { DFF_Prop_geoBottom, 1, 2 } }, // ul center 8
+
+ { 0x4001, { -8000, 0x0406, 1 } }, // 9
+ { 0x6000, { 0x0409, 0x0408, 0 } }, // a
+ { 0x4001, { 2960, 0x0406, 1 } }, // b
+ { 0x6000, { 0x040b, 0x0407, 0 } }, // c
+ { 0x4001, { -5000, 0x0406, 1 } }, // d
+ { 0x6000, { 0x040d, 0x0408, 0 } }, // e
+ { 0x4001, { -7000, 0x0406, 1 } }, // f
+ { 0x6000, { 0x040f, 0x0408, 0 } }, // 10
+ { 0x4001, { 5000, 0x0406, 1 } }, // 11
+ { 0x6000, { 0x0411, 0x0407, 0 } }, // 12
+ { 0x4001, { -2960, 0x0406, 1 } }, // 13
+ { 0x6000, { 0x0413, 0x0408, 0 } }, // 14
+ { 0x4001, { 8000, 0x0406, 1 } }, // 15
+ { 0x6000, { 0x0415,0x0407, 0 } }, // 16
+ { 0x4001, { 6100, 0x0406, 1 } }, // 17
+ { 0x6000, { 0x0417,0x0407, 0 } }, // 18
+ { 0x4001, { 8260, 0x0406, 1 } }, // 19
+ { 0x6000, { 0x0419, 0x0408, 0 } }, // 1a
+ { 0x4001, { -6100, 0x0406, 1 } }, // 1b
+ { 0x6000, { 0x041b, 0x0407, 0 } }, // 1c
+ { 0x4001, { -8000, 0x0406, 1 } }, // 1d
+ { 0x6000, { 0x041d, 0x0407, 0 } }, // 1e
+ { 0x4001, { -1060, 0x0406, 1 } }, // 1f
+ { 0x6000, { 0x041f, 0x0407, 0 } }, // 20
+ { 0x4001, { 1060, 0x0406, 1 } }, // 21
+ { 0x6000, { 0x0421, 0x0407, 0 } }, // 22
+ { 0x4001, { 4020, 0x0406, 1 } }, // 23
+ { 0x6000, { 0x0423, 0x0408, 0 } } // 24
+
+};
+static const mso_CustomShape msoActionButtonHome =
+{
+ (SvxMSDffVertPair*)mso_sptActionButtonHomeVert, sizeof( mso_sptActionButtonHomeVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptActionButtonHomeSegm, sizeof( mso_sptActionButtonHomeSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptActionButtonHomeCalc, sizeof( mso_sptActionButtonHomeCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault1400,
+ (SvxMSDffTextRectangles*)mso_sptActionButtonTextRect, sizeof( mso_sptActionButtonTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 10800, 10800,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptButtonHandle, sizeof( mso_sptButtonHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptActionButtonHelpVert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 21600 }, { 0, 21600 },
+ { 0, 0 }, { 21600, 0 }, { 3 MSO_I, 2 MSO_I }, { 1 MSO_I, 2 MSO_I },
+ { 21600, 0 }, { 21600, 21600 }, { 3 MSO_I, 4 MSO_I }, { 3 MSO_I, 2 MSO_I },
+ { 21600, 21600 }, { 0, 21600 }, { 1 MSO_I, 4 MSO_I }, { 3 MSO_I, 4 MSO_I },
+ { 0, 21600 }, { 0, 0 }, { 1 MSO_I, 2 MSO_I }, { 1 MSO_I,4 MSO_I },
+ { 7 MSO_I, 0xc MSO_I }, { 0xa MSO_I, 0x3e MSO_I }, { 7 MSO_I, 0x10 MSO_I }, { 0xe MSO_I, 0x3e MSO_I }, { 7 MSO_I, 0xc MSO_I },
+ { 0x12 MSO_I, 0x14 MSO_I }, { 0x12 MSO_I, 0x16 MSO_I }, // pp
+ { 0x12 MSO_I, 0x18 MSO_I }, { 0x1a MSO_I, 8 MSO_I }, { 0x1c MSO_I, 8 MSO_I }, // ccp
+ { 0x1e MSO_I, 8 MSO_I }, { 0x20 MSO_I, 0x22 MSO_I }, { 0x20 MSO_I, 0x24 MSO_I }, // ccp
+ { 0x20 MSO_I, 0x26 MSO_I }, { 0x28 MSO_I, 0x2a MSO_I }, { 7 MSO_I, 0x2a MSO_I }, // ccp
+ { 0x2c MSO_I, 0x2a MSO_I }, { 0x2e MSO_I, 0x26 MSO_I }, { 0x2e MSO_I, 0x24 MSO_I }, // ccp
+ { 0x30 MSO_I, 0x24 MSO_I }, { 0x30 MSO_I, 0x32 MSO_I }, { 0x34 MSO_I, 0x36 MSO_I }, // ccp
+ { 7 MSO_I, 0x36 MSO_I }, // p
+ { 0x12 MSO_I, 0x36 MSO_I }, { 0x1c MSO_I, 0x32 MSO_I }, { 0x1c MSO_I, 0x24 MSO_I }, // ccp
+ { 0x1c MSO_I, 0x38 MSO_I }, { 0x3a MSO_I, 0x3c MSO_I }, { 0x12 MSO_I, 0x3c MSO_I }, // ccp
+ { 7 MSO_I, 0x3c MSO_I }, { 0x34 MSO_I, 8 MSO_I }, { 0x34 MSO_I, 0x16 MSO_I }, // ccp
+ { 0x34 MSO_I, 0x14 MSO_I }
+};
+static const sal_uInt16 mso_sptActionButtonHelpSegm[] =
+{
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0xa704, 0x6000, 0x8000,
+ 0x4000, 0x0001, 0x2004, 0x0001, 0x2004, 0x0001, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptActionButtonHelpCalc[] = // adj value 0 - 5400
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x6000, { DFF_Prop_geoLeft, DFF_Prop_adjustValue, 0 } },
+ { 0x6000, { DFF_Prop_geoTop, DFF_Prop_adjustValue, 0 } },
+ { 0xa000, { DFF_Prop_geoRight, 0, DFF_Prop_adjustValue } },
+ { 0xa000, { DFF_Prop_geoBottom, 0, DFF_Prop_adjustValue } },
+ { 0x8000, { 10800, 0, DFF_Prop_adjustValue } },
+ { 0x2001, { 0x0405, 1, 10800 } }, // scaling 6
+ { 0x2001, { DFF_Prop_geoRight, 1, 2 } }, // lr center 7
+ { 0x2001, { DFF_Prop_geoBottom, 1, 2 } }, // ul center 8
+
+ { 0x4001, { -1690, 0x0406, 1 } }, // 9
+ { 0x6000, { 0x0409, 0x0407, 0 } }, // a
+ { 0x4001, { 4600, 0x0406, 1 } }, // b
+ { 0x6000, { 0x040b, 0x0408, 0 } }, // c
+ { 0x4001, { 1690, 0x0406, 1 } }, // d
+ { 0x6000, { 0x040d, 0x0407, 0 } }, // e
+ { 0x4001, { 7980, 0x0406, 1 } }, // f
+ { 0x6000, { 0x040f, 0x0408, 0 } }, // 10
+ { 0x4001, { 1270, 0x0406, 1 } }, // 11
+ { 0x6000, { 0x0411, 0x0407, 0 } }, // 12
+ { 0x4001, { 4000, 0x0406, 1 } }, // 13
+ { 0x6000, { 0x0413, 0x0408, 0 } }, // 14
+ { 0x4001, { 1750, 0x0406, 1 } }, // 15
+ { 0x6000, { 0x0415, 0x0408, 0 } }, // 16
+ { 0x4001, { 800, 0x0406, 1 } }, // 17
+ { 0x6000, { 0x0417, 0x0408, 0 } }, // 18
+ { 0x4001, { 1650, 0x0406, 1 } }, // 19
+ { 0x6000, { 0x0419, 0x0407, 0 } }, // 1a
+ { 0x4001, { 2340, 0x0406, 1 } }, // 1b
+ { 0x6000, { 0x041b, 0x0407, 0 } }, // 1c
+ { 0x4001, { 3640, 0x0406, 1 } }, // 1d
+ { 0x6000, { 0x041d, 0x0407, 0 } }, // 1e
+ { 0x4001, { 4670, 0x0406, 1 } }, // 1f
+ { 0x6000, { 0x041f, 0x0407, 0 } }, // 20
+ { 0x4001, { -1570, 0x0406, 1 } }, // 21
+ { 0x6000, { 0x0421, 0x0408, 0 } }, // 22
+ { 0x4001, { -3390, 0x0406, 1 } }, // 23
+ { 0x6000, { 0x0423, 0x0408, 0 } }, // 24
+ { 0x4001, { -6050, 0x0406, 1 } }, // 25
+ { 0x6000, { 0x0425, 0x0408, 0 } }, // 26
+ { 0x4001, { 2540, 0x0406, 1 } }, // 27
+ { 0x6000, { 0x0427, 0x0407, 0 } }, // 28
+ { 0x4001, { -8050, 0x0406, 1 } }, // 29
+ { 0x6000, { 0x0429, 0x0408, 0 } }, // 2a
+ { 0x4001, { -2540, 0x0406, 1 } }, // 2b
+ { 0x6000, { 0x042b, 0x0407, 0 } }, // 2c
+ { 0x4001, { -4460, 0x0406, 1 } }, // 2d
+ { 0x6000, { 0x042d, 0x0407, 0 } }, // 2e
+ { 0x4001, { -2330, 0x0406, 1 } }, // 2f
+ { 0x6000, { 0x042f, 0x0407, 0 } }, // 30
+ { 0x4001, { -4700, 0x0406, 1 } }, // 31
+ { 0x6000, { 0x0431, 0x0408, 0 } }, // 32
+ { 0x4001, { -1270, 0x0406, 1 } }, // 33
+ { 0x6000, { 0x0433, 0x0407, 0 } }, // 34
+ { 0x4001, { -5720, 0x0406, 1 } }, // 35
+ { 0x6000, { 0x0435, 0x0408, 0 } }, // 36
+ { 0x4001, { -2540, 0x0406, 1 } }, // 37
+ { 0x6000, { 0x0437, 0x0408, 0 } }, // 38
+ { 0x4001, { 1800, 0x0406, 1 } }, // 39
+ { 0x6000, { 0x0439, 0x0407, 0 } }, // 3a
+ { 0x4001, { -1700, 0x0406, 1 } }, // 3b
+ { 0x6000, { 0x043b, 0x0408, 0 } }, // 3c
+ { 0x4001, { 6290, 0x0406, 1 } }, // 3d
+ { 0x6000, { 0x043d, 0x0408, 0 } } // 3e
+};
+static const mso_CustomShape msoActionButtonHelp =
+{
+ (SvxMSDffVertPair*)mso_sptActionButtonHelpVert, sizeof( mso_sptActionButtonHelpVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptActionButtonHelpSegm, sizeof( mso_sptActionButtonHelpSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptActionButtonHelpCalc, sizeof( mso_sptActionButtonHelpCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault1400,
+ (SvxMSDffTextRectangles*)mso_sptActionButtonTextRect, sizeof( mso_sptActionButtonTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 10800, 10800,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptButtonHandle, sizeof( mso_sptButtonHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptActionButtonInformationVert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 21600 }, { 0, 21600 },
+ { 0, 0 }, { 21600, 0 }, { 3 MSO_I, 2 MSO_I }, { 1 MSO_I, 2 MSO_I },
+ { 21600, 0 }, { 21600, 21600 }, { 3 MSO_I, 4 MSO_I }, { 3 MSO_I, 2 MSO_I },
+ { 21600, 21600 }, { 0, 21600 }, { 1 MSO_I, 4 MSO_I }, { 3 MSO_I, 4 MSO_I },
+ { 0, 21600 }, { 0, 0 }, { 1 MSO_I, 2 MSO_I }, { 1 MSO_I, 4 MSO_I },
+ { 0x7 MSO_I, 0xc MSO_I }, { 0xa MSO_I, 0x8 MSO_I }, { 0x7 MSO_I, 0x10 MSO_I }, { 0xe MSO_I, 8 MSO_I }, { 0x7 MSO_I, 0xc MSO_I },
+ { 0x7 MSO_I, 0x14 MSO_I }, { 0x12 MSO_I, 0x2a MSO_I }, { 0x7 MSO_I, 0x18 MSO_I }, { 0x16 MSO_I, 0x2a MSO_I }, { 0x7 MSO_I, 0x14 MSO_I },
+ { 0x1a MSO_I, 0x1c MSO_I }, { 0x1e MSO_I, 0x1c MSO_I }, { 0x1e MSO_I, 0x20 MSO_I }, { 0x22 MSO_I, 0x20 MSO_I },
+ { 0x22 MSO_I, 0x24 MSO_I }, { 0x1a MSO_I, 0x24 MSO_I }, { 0x1a MSO_I, 0x20 MSO_I }, { 0x26 MSO_I, 0x20 MSO_I },
+ { 0x26 MSO_I, 0x28 MSO_I }, { 0x1a MSO_I, 0x28 MSO_I }
+};
+static const sal_uInt16 mso_sptActionButtonInformationSegm[] =
+{
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0xa704, 0x6000, 0x8000,
+ 0x4000, 0xa704, 0x6000, 0x8000,
+ 0x4000, 0x0009, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptActionButtonInformationCalc[] = // adj value 0 - 5400
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x6000, { DFF_Prop_geoLeft, DFF_Prop_adjustValue, 0 } },
+ { 0x6000, { DFF_Prop_geoTop, DFF_Prop_adjustValue, 0 } },
+ { 0xa000, { DFF_Prop_geoRight, 0, DFF_Prop_adjustValue } },
+ { 0xa000, { DFF_Prop_geoBottom, 0, DFF_Prop_adjustValue } },
+ { 0x8000, { 10800, 0, DFF_Prop_adjustValue } },
+ { 0x2001, { 0x0405, 1, 10800 } }, // scaling 6
+ { 0x2001, { DFF_Prop_geoRight, 1, 2 } }, // lr center 7
+ { 0x2001, { DFF_Prop_geoBottom, 1, 2 } }, // ul center 8
+
+ { 0x4001, { -8050, 0x0406, 1 } }, // 9
+ { 0x6000, { 0x0409, 0x0407, 0 } }, // a
+ { 0x4001, { -8050, 0x0406, 1 } }, // b
+ { 0x6000, { 0x040b, 0x0408, 0 } }, // c
+ { 0x4001, { 8050, 0x0406, 1 } }, // d
+ { 0x6000, { 0x040d, 0x0407, 0 } }, // e
+ { 0x4001, { 8050, 0x0406, 1 } }, // f
+ { 0x6000, { 0x040f, 0x0408, 0 } }, // 10
+
+ { 0x4001, { -2060, 0x0406, 1 } }, // 11
+ { 0x6000, { 0x0411, 0x0407, 0 } }, // 12
+ { 0x4001, { -7620, 0x0406, 1 } }, // 13
+ { 0x6000, { 0x0413, 0x0408, 0 } }, // 14
+ { 0x4001, { 2060, 0x0406, 1 } }, // 15
+ { 0x6000, { 0x0415, 0x0407, 0 } }, // 16
+ { 0x4001, { -3500, 0x0406, 1 } }, // 17
+ { 0x6000, { 0x0417, 0x0408, 0 } }, // 18
+
+ { 0x4001, { -2960, 0x0406, 1 } }, // 19
+ { 0x6000, { 0x0419, 0x0407, 0 } }, // 1a
+ { 0x4001, { -2960, 0x0406, 1 } }, // 1b
+ { 0x6000, { 0x041b, 0x0408, 0 } }, // 1c
+ { 0x4001, { 1480, 0x0406, 1 } }, // 1d
+ { 0x6000, { 0x041d, 0x0407, 0 } }, // 1e
+ { 0x4001, { 5080, 0x0406, 1 } }, // 1f
+ { 0x6000, { 0x041f, 0x0408, 0 } }, // 20
+ { 0x4001, { 2960, 0x0406, 1 } }, // 21
+ { 0x6000, { 0x0421, 0x0407, 0 } }, // 22
+ { 0x4001, { 6140, 0x0406, 1 } }, // 23
+ { 0x6000, { 0x0423, 0x0408, 0 } }, // 24
+ { 0x4001, { -1480, 0x0406, 1 } }, // 25
+ { 0x6000, { 0x0425, 0x0407, 0 } }, // 26
+ { 0x4001, { -1920, 0x0406, 1 } }, // 27
+ { 0x6000, { 0x0427, 0x0408, 0 } }, // 28
+
+ { 0x4001, { -5560, 0x0406, 1 } }, // 29
+ { 0x6000, { 0x0429, 0x0408, 0 } }, // 2a
+
+};
+static const mso_CustomShape msoActionButtonInformation =
+{
+ (SvxMSDffVertPair*)mso_sptActionButtonInformationVert, sizeof( mso_sptActionButtonInformationVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptActionButtonInformationSegm, sizeof( mso_sptActionButtonInformationSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptActionButtonInformationCalc, sizeof( mso_sptActionButtonInformationCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault1400,
+ (SvxMSDffTextRectangles*)mso_sptActionButtonTextRect, sizeof( mso_sptActionButtonTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 10800, 10800,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptButtonHandle, sizeof( mso_sptButtonHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptActionButtonBackPreviousVert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 21600 }, { 0, 21600 },
+ { 0, 0 }, { 21600, 0 }, { 3 MSO_I, 2 MSO_I }, { 1 MSO_I, 2 MSO_I },
+ { 21600, 0 }, { 21600, 21600 }, { 3 MSO_I, 4 MSO_I }, { 3 MSO_I, 2 MSO_I },
+ { 21600, 21600 }, { 0, 21600 }, { 1 MSO_I, 4 MSO_I }, { 3 MSO_I,4 MSO_I },
+ { 0, 21600 }, { 0, 0 }, { 1 MSO_I, 2 MSO_I }, { 1 MSO_I, 4 MSO_I },
+
+ { 0xa MSO_I, 8 MSO_I }, { 0xe MSO_I, 0xc MSO_I }, { 0xe MSO_I, 0x10 MSO_I }
+};
+static const sal_uInt16 mso_sptActionButtonForwardBackSegm[] =
+{
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0002, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptActionButtonForwardBackCalc[] = // adj value 0 - 5400
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x6000, { DFF_Prop_geoLeft, DFF_Prop_adjustValue, 0 } },
+ { 0x6000, { DFF_Prop_geoTop, DFF_Prop_adjustValue, 0 } },
+ { 0xa000, { DFF_Prop_geoRight, 0, DFF_Prop_adjustValue } },
+ { 0xa000, { DFF_Prop_geoBottom, 0, DFF_Prop_adjustValue } },
+ { 0x8000, { 10800, 0, DFF_Prop_adjustValue } },
+ { 0x2001, { 0x0405, 1, 10800 } }, // scaling 6
+ { 0x2001, { DFF_Prop_geoRight, 1, 2 } }, // lr center 7
+ { 0x2001, { DFF_Prop_geoBottom, 1, 2 } }, // ul center 8
+
+ { 0x4001, { -8050, 0x0406, 1 } }, // 9
+ { 0x6000, { 0x0409, 0x0407, 0 } }, // a
+ { 0x4001, { -8050, 0x0406, 1 } }, // b
+ { 0x6000, { 0x040b, 0x0408, 0 } }, // c
+ { 0x4001, { 8050, 0x0406, 1 } }, // d
+ { 0x6000, { 0x040d, 0x0407, 0 } }, // e
+ { 0x4001, { 8050, 0x0406, 1 } }, // f
+ { 0x6000, { 0x040f, 0x0408, 0 } } // 10
+};
+static const mso_CustomShape msoActionButtonBackPrevious =
+{
+ (SvxMSDffVertPair*)mso_sptActionButtonBackPreviousVert, sizeof( mso_sptActionButtonBackPreviousVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptActionButtonForwardBackSegm, sizeof( mso_sptActionButtonForwardBackSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptActionButtonForwardBackCalc, sizeof( mso_sptActionButtonForwardBackCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault1400,
+ (SvxMSDffTextRectangles*)mso_sptActionButtonTextRect, sizeof( mso_sptActionButtonTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 10800, 10800,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptButtonHandle, sizeof( mso_sptButtonHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptActionButtonForwardNextVert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 21600 }, { 0, 21600 },
+ { 0, 0 }, { 21600, 0 }, { 3 MSO_I, 2 MSO_I }, { 1 MSO_I, 2 MSO_I },
+ { 21600, 0 }, { 21600, 21600 }, { 3 MSO_I, 4 MSO_I }, { 3 MSO_I, 2 MSO_I },
+ { 21600, 21600 }, { 0, 21600 }, { 1 MSO_I, 4 MSO_I }, { 3 MSO_I, 4 MSO_I },
+ { 0, 21600 }, { 0, 0 }, { 1 MSO_I, 2 MSO_I }, { 1 MSO_I, 4 MSO_I },
+
+ { 0xa MSO_I, 0xc MSO_I }, { 0xe MSO_I, 8 MSO_I }, { 0xa MSO_I, 0x10 MSO_I }
+};
+static const mso_CustomShape msoActionButtonForwardNext =
+{
+ (SvxMSDffVertPair*)mso_sptActionButtonForwardNextVert, sizeof( mso_sptActionButtonForwardNextVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptActionButtonForwardBackSegm, sizeof( mso_sptActionButtonForwardBackSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptActionButtonForwardBackCalc, sizeof( mso_sptActionButtonForwardBackCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault1400,
+ (SvxMSDffTextRectangles*)mso_sptActionButtonTextRect, sizeof( mso_sptActionButtonTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 10800, 10800,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptButtonHandle, sizeof( mso_sptButtonHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptActionButtonBeginningVert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 21600 }, { 0, 21600 },
+ { 0, 0 }, { 21600, 0 }, { 3 MSO_I, 2 MSO_I }, { 1 MSO_I, 2 MSO_I },
+ { 21600, 0 }, { 21600, 21600 }, { 3 MSO_I, 4 MSO_I }, { 3 MSO_I, 2 MSO_I },
+ { 21600, 21600 }, { 0, 21600 }, { 1 MSO_I, 4 MSO_I }, { 3 MSO_I, 4 MSO_I },
+ { 0, 21600 }, { 0, 0 }, { 1 MSO_I, 2 MSO_I }, { 1 MSO_I, 4 MSO_I },
+
+ { 0xa MSO_I, 8 MSO_I }, { 0xe MSO_I, 0xc MSO_I }, { 0xe MSO_I, 0x10 MSO_I }, { 0x12 MSO_I, 0xc MSO_I },
+ { 0x14 MSO_I, 0xc MSO_I }, { 0x14 MSO_I, 0x10 MSO_I }, { 0x12 MSO_I, 0x10 MSO_I }
+};
+static const sal_uInt16 mso_sptActionButtonBeginningEndSegm[] =
+{
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+
+ 0x4000, 0x0002, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptActionButtonBeginningEndCalc[] = // adj value 0 - 5400
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x6000, { DFF_Prop_geoLeft, DFF_Prop_adjustValue, 0 } },
+ { 0x6000, { DFF_Prop_geoTop, DFF_Prop_adjustValue, 0 } },
+ { 0xa000, { DFF_Prop_geoRight, 0, DFF_Prop_adjustValue } },
+ { 0xa000, { DFF_Prop_geoBottom, 0, DFF_Prop_adjustValue } },
+ { 0x8000, { 10800, 0, DFF_Prop_adjustValue } },
+ { 0x2001, { 0x0405, 1, 10800 } }, // scaling 6
+ { 0x2001, { DFF_Prop_geoRight, 1, 2 } }, // lr center 7
+ { 0x2001, { DFF_Prop_geoBottom, 1, 2 } }, // ul center 8
+
+ { 0x4001, { -4020, 0x0406, 1 } }, // 9
+ { 0x6000, { 0x0409, 0x0407, 0 } }, // a
+ { 0x4001, { -8050, 0x0406, 1 } }, // b
+ { 0x6000, { 0x040b, 0x0408, 0 } }, // c
+ { 0x4001, { 8050, 0x0406, 1 } }, // d
+ { 0x6000, { 0x040d, 0x0407, 0 } }, // e
+ { 0x4001, { 8050, 0x0406, 1 } }, // f
+ { 0x6000, { 0x040f, 0x0408, 0 } }, // 10
+
+ { 0x4001, { -8050, 0x0406, 1 } }, // 11
+ { 0x6000, { 0x0411, 0x0407, 0 } }, // 12
+ { 0x4001, { -6140, 0x0406, 1 } }, // 13
+ { 0x6000, { 0x0413, 0x0407, 0 } }, // 14
+
+
+ { 0x4001, { 4020, 0x0406, 1 } }, // 15
+ { 0x6000, { 0x0415, 0x0407, 0 } }, // 16
+ { 0x4001, { 6140, 0x0406, 1 } }, // 17
+ { 0x6000, { 0x0417, 0x0407, 0 } } // 18
+};
+static const mso_CustomShape msoActionButtonBeginning =
+{
+ (SvxMSDffVertPair*)mso_sptActionButtonBeginningVert, sizeof( mso_sptActionButtonBeginningVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptActionButtonBeginningEndSegm, sizeof( mso_sptActionButtonBeginningEndSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptActionButtonBeginningEndCalc, sizeof( mso_sptActionButtonBeginningEndCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault1400,
+ (SvxMSDffTextRectangles*)mso_sptActionButtonTextRect, sizeof( mso_sptActionButtonTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 10800, 10800,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptButtonHandle, sizeof( mso_sptButtonHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptActionButtonEndVert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 21600 }, { 0, 21600 },
+ { 0, 0 }, { 21600, 0 }, { 3 MSO_I, 2 MSO_I }, { 1 MSO_I, 2 MSO_I },
+ { 21600, 0 }, { 21600, 21600 }, { 3 MSO_I, 4 MSO_I }, { 3 MSO_I, 2 MSO_I },
+ { 21600, 21600 }, { 0, 21600 }, { 1 MSO_I, 4 MSO_I }, { 3 MSO_I, 4 MSO_I },
+ { 0, 21600 }, { 0, 0 }, { 1 MSO_I, 2 MSO_I }, { 1 MSO_I, 4 MSO_I },
+
+ { 0x16 MSO_I, 8 MSO_I }, { 0x12 MSO_I, 0x10 MSO_I }, { 0x12 MSO_I, 0xc MSO_I },
+
+ { 0x18 MSO_I, 0xc MSO_I }, { 0x18 MSO_I, 0x10 MSO_I }, { 0xe MSO_I, 0x10 MSO_I }, { 0xe MSO_I, 0xc MSO_I }
+};
+static const mso_CustomShape msoActionButtonEnd =
+{
+ (SvxMSDffVertPair*)mso_sptActionButtonEndVert, sizeof( mso_sptActionButtonEndVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptActionButtonBeginningEndSegm, sizeof( mso_sptActionButtonBeginningEndSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptActionButtonBeginningEndCalc, sizeof( mso_sptActionButtonBeginningEndCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault1400,
+ (SvxMSDffTextRectangles*)mso_sptActionButtonTextRect, sizeof( mso_sptActionButtonTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 10800, 10800,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptButtonHandle, sizeof( mso_sptButtonHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptActionButtonReturnVert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 21600 }, { 0, 21600 },
+ { 0, 0 }, { 21600, 0 }, { 3 MSO_I, 2 MSO_I }, { 1 MSO_I, 2 MSO_I },
+ { 21600, 0 }, { 21600, 21600 }, { 3 MSO_I, 4 MSO_I }, { 3 MSO_I, 2 MSO_I },
+ { 21600, 21600 }, { 0, 21600 }, { 1 MSO_I, 4 MSO_I }, { 3 MSO_I, 4 MSO_I },
+ { 0, 21600 }, { 0, 0 }, { 1 MSO_I, 2 MSO_I }, { 1 MSO_I, 4 MSO_I },
+
+ { 0xa MSO_I, 0xc MSO_I }, { 0xe MSO_I, 0xc MSO_I }, { 0xe MSO_I, 0x10 MSO_I }, // ppp
+ { 0xe MSO_I, 0x12 MSO_I }, { 0x14 MSO_I, 0x16 MSO_I }, { 0x18 MSO_I, 0x16 MSO_I }, // ccp
+ { 7 MSO_I, 0x16 MSO_I }, // p
+ { 0x1a MSO_I, 0x16 MSO_I }, { 0x1c MSO_I, 0x12 MSO_I }, { 0x1c MSO_I, 0x10 MSO_I }, // ccp
+ { 0x1c MSO_I, 0xc MSO_I }, { 7 MSO_I, 0xc MSO_I }, { 0x1e MSO_I, 0x20 MSO_I }, { 0x22 MSO_I, 0xc MSO_I },// pppp
+ { 0x24 MSO_I, 0xc MSO_I }, { 0x24 MSO_I, 0x10 MSO_I }, // pp
+ { 0x24 MSO_I, 0x26 MSO_I }, { 0x28 MSO_I, 0x2a MSO_I }, { 7 MSO_I, 0x2a MSO_I }, // ccp
+ { 0x18 MSO_I, 0x2a MSO_I }, // p
+ { 0x2c MSO_I, 0x2a MSO_I }, { 0xa MSO_I, 0x26 MSO_I }, { 0xa MSO_I, 0x10 MSO_I } // ccp
+};
+static const sal_uInt16 mso_sptActionButtonReturnSegm[] =
+{
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0002, 0x2001, 0x0001, 0x2001, 0x0006,0x2001, 0x0001, 0x2001, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptActionButtonReturnCalc[] = // adj value 0 - 5400
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x6000, { DFF_Prop_geoLeft, DFF_Prop_adjustValue, 0 } },
+ { 0x6000, { DFF_Prop_geoTop, DFF_Prop_adjustValue, 0 } },
+ { 0xa000, { DFF_Prop_geoRight, 0, DFF_Prop_adjustValue } },
+ { 0xa000, { DFF_Prop_geoBottom, 0, DFF_Prop_adjustValue } },
+ { 0x8000, { 10800, 0, DFF_Prop_adjustValue } },
+ { 0x2001, { 0x0405, 1, 10800 } }, // scaling 6
+ { 0x2001, { DFF_Prop_geoRight, 1, 2 } }, // lr center 7
+ { 0x2001, { DFF_Prop_geoBottom, 1, 2 } }, // ul center 8
+
+ { 0x4001, { -8050, 0x0406, 1 } }, // 9
+ { 0x6000, { 0x0409, 0x0407, 0 } }, // a
+ { 0x4001, { -3800, 0x0406, 1 } }, // b
+ { 0x6000, { 0x040b, 0x0408, 0 } }, // c
+ { 0x4001, { -4020, 0x0406, 1 } }, // d
+ { 0x6000, { 0x040d, 0x0407, 0 } }, // e
+ { 0x4001, { 2330, 0x0406, 1 } }, // f
+ { 0x6000, { 0x040f, 0x0408, 0 } }, // 10
+ { 0x4001, { 3390, 0x0406, 1 } }, // 11
+ { 0x6000, { 0x0411, 0x0408, 0 } }, // 12
+ { 0x4001, { -3100, 0x0406, 1 } }, // 13
+ { 0x6000, { 0x0413, 0x0407, 0 } }, // 14
+ { 0x4001, { 4230, 0x0406, 1 } }, // 15
+ { 0x6000, { 0x0415, 0x0408, 0 } }, // 16
+ { 0x4001, { -1910, 0x0406, 1 } }, // 17
+ { 0x6000, { 0x0417, 0x0407, 0 } }, // 18
+ { 0x4001, { 1190, 0x0406, 1 } }, // 19
+ { 0x6000, { 0x0419, 0x0407, 0 } }, // 1a
+ { 0x4001, { 2110, 0x0406, 1 } }, // 1b
+ { 0x6000, { 0x041b, 0x0407, 0 } }, // 1c
+ { 0x4001, { 4030, 0x0406, 1 } }, // 1d
+ { 0x6000, { 0x041d, 0x0407, 0 } }, // 1e
+ { 0x4001, { -7830, 0x0406, 1 } }, // 1f
+ { 0x6000, { 0x041f, 0x0408, 0 } }, // 20
+ { 0x4001, { 8250, 0x0406, 1 } }, // 21
+ { 0x6000, { 0x0421, 0x0407, 0 } }, // 22
+ { 0x4001, { 6140, 0x0406, 1 } }, // 23
+ { 0x6000, { 0x0423, 0x0407, 0 } }, // 24
+ { 0x4001, { 5510, 0x0406, 1 } }, // 25
+ { 0x6000, { 0x0425, 0x0408, 0 } }, // 26
+ { 0x4001, { 3180, 0x0406, 1 } }, // 27
+ { 0x6000, { 0x0427, 0x0407, 0 } }, // 28
+ { 0x4001, { 8450, 0x0406, 1 } }, // 29
+ { 0x6000, { 0x0429, 0x0408, 0 } }, // 2a
+ { 0x4001, { -5090, 0x0406, 1 } }, // 2b
+ { 0x6000, { 0x042b, 0x0407, 0 } } // 2c
+};
+static const mso_CustomShape msoActionButtonReturn =
+{
+ (SvxMSDffVertPair*)mso_sptActionButtonReturnVert, sizeof( mso_sptActionButtonReturnVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptActionButtonReturnSegm, sizeof( mso_sptActionButtonReturnSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptActionButtonReturnCalc, sizeof( mso_sptActionButtonReturnCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault1400,
+ (SvxMSDffTextRectangles*)mso_sptActionButtonTextRect, sizeof( mso_sptActionButtonTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 10800, 10800,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptButtonHandle, sizeof( mso_sptButtonHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptActionButtonDocumentVert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 21600 }, { 0, 21600 },
+ { 0, 0 }, { 21600, 0 }, { 3 MSO_I, 2 MSO_I }, { 1 MSO_I, 2 MSO_I },
+ { 21600, 0 }, { 21600, 21600 }, { 3 MSO_I, 4 MSO_I }, { 3 MSO_I, 2 MSO_I },
+ { 21600, 21600 }, { 0, 21600 }, { 1 MSO_I, 4 MSO_I }, { 3 MSO_I, 4 MSO_I },
+ { 0, 21600 }, { 0, 0 }, { 1 MSO_I, 2 MSO_I }, { 1 MSO_I, 4 MSO_I },
+
+ { 0xa MSO_I, 0xc MSO_I }, { 0xe MSO_I, 0xc MSO_I }, { 0x10 MSO_I, 0x12 MSO_I }, { 0x10 MSO_I, 0x14 MSO_I },
+ { 0xa MSO_I, 0x14 MSO_I }, { 0xe MSO_I, 0xc MSO_I }, { 0x10 MSO_I, 0x12 MSO_I }, { 0xe MSO_I, 0x12 MSO_I }
+};
+static const sal_uInt16 mso_sptActionButtonDocumentSegm[] =
+{
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+
+ 0x4000, 0x0004, 0x6001, 0x8000,
+ 0x4000, 0x0002, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptActionButtonDocumentCalc[] = // adj value 0 - 5400
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x6000, { DFF_Prop_geoLeft, DFF_Prop_adjustValue, 0 } },
+ { 0x6000, { DFF_Prop_geoTop, DFF_Prop_adjustValue, 0 } },
+ { 0xa000, { DFF_Prop_geoRight, 0, DFF_Prop_adjustValue } },
+ { 0xa000, { DFF_Prop_geoBottom, 0, DFF_Prop_adjustValue } },
+ { 0x8000, { 10800, 0, DFF_Prop_adjustValue } },
+ { 0x2001, { 0x0405, 1, 10800 } }, // scaling 6
+ { 0x2001, { DFF_Prop_geoRight, 1, 2 } }, // lr center 7
+ { 0x2001, { DFF_Prop_geoBottom, 1, 2 } }, // ul center 8
+
+ { 0x4001, { -6350, 0x0406, 1 } }, // 9
+ { 0x6000, { 0x0409, 0x0407, 0 } }, // a
+ { 0x4001, { -7830, 0x0406, 1 } }, // b
+ { 0x6000, { 0x040b, 0x0408, 0 } }, // c
+ { 0x4001, { 1690, 0x0406, 1 } }, // d
+ { 0x6000, { 0x040d, 0x0407, 0 } }, // e
+ { 0x4001, { 6350, 0x0406, 1 } }, // f
+ { 0x6000, { 0x040f, 0x0407, 0 } }, // 10
+ { 0x4001, { -3810, 0x0406, 1 } }, // 11
+ { 0x6000, { 0x0411, 0x0408, 0 } }, // 12
+ { 0x4001, { 7830, 0x0406, 1 } }, // 13
+ { 0x6000, { 0x0413, 0x0408, 0 } } // 14
+};
+static const mso_CustomShape msoActionButtonDocument =
+{
+ (SvxMSDffVertPair*)mso_sptActionButtonDocumentVert, sizeof( mso_sptActionButtonDocumentVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptActionButtonDocumentSegm, sizeof( mso_sptActionButtonDocumentSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptActionButtonDocumentCalc, sizeof( mso_sptActionButtonDocumentCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault1400,
+ (SvxMSDffTextRectangles*)mso_sptActionButtonTextRect, sizeof( mso_sptActionButtonTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 10800, 10800,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptButtonHandle, sizeof( mso_sptButtonHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptActionButtonSoundVert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 21600 }, { 0, 21600 },
+ { 0, 0 }, { 21600, 0 }, { 3 MSO_I, 2 MSO_I }, { 1 MSO_I, 2 MSO_I },
+ { 21600, 0 }, { 21600, 21600 }, { 3 MSO_I, 4 MSO_I }, { 3 MSO_I, 2 MSO_I },
+ { 21600, 21600 }, { 0, 21600 }, { 1 MSO_I, 4 MSO_I }, { 3 MSO_I, 4 MSO_I },
+ { 0, 21600 }, { 0, 0 }, { 1 MSO_I, 2 MSO_I }, { 1 MSO_I, 4 MSO_I },
+
+ { 0xa MSO_I, 0xc MSO_I }, { 0xe MSO_I, 0xc MSO_I }, { 0x10 MSO_I, 0x12 MSO_I }, { 0x10 MSO_I, 0x14 MSO_I },
+ { 0xe MSO_I, 0x16 MSO_I }, { 0xa MSO_I, 0x16 MSO_I }, { 0x18 MSO_I, 8 MSO_I }, { 0x1a MSO_I, 8 MSO_I },
+
+ { 0x18 MSO_I, 0xc MSO_I }, { 0x1a MSO_I, 0x1c MSO_I },
+
+ { 0x18 MSO_I, 0x16 MSO_I }, { 0x1a MSO_I, 0x1e MSO_I }
+};
+static const sal_uInt16 mso_sptActionButtonSoundSegm[] =
+{
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+
+ 0x4000, 0x0005, 0x6001, 0x8000,
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x0001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptActionButtonSoundCalc[] = // adj value 0 - 5400
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x6000, { DFF_Prop_geoLeft, DFF_Prop_adjustValue, 0 } },
+ { 0x6000, { DFF_Prop_geoTop, DFF_Prop_adjustValue, 0 } },
+ { 0xa000, { DFF_Prop_geoRight, 0, DFF_Prop_adjustValue } },
+ { 0xa000, { DFF_Prop_geoBottom, 0, DFF_Prop_adjustValue } },
+ { 0x8000, { 10800, 0, DFF_Prop_adjustValue } },
+ { 0x2001, { 0x0405, 1, 10800 } }, // scaling 6
+ { 0x2001, { DFF_Prop_geoRight, 1, 2 } }, // lr center 7
+ { 0x2001, { DFF_Prop_geoBottom, 1, 2 } }, // ul center 8
+
+ { 0x4001, { -8050, 0x0406, 1 } }, // 9
+ { 0x6000, { 0x0409, 0x0407, 0 } }, // a
+ { 0x4001, { -2750, 0x0406, 1 } }, // b
+ { 0x6000, { 0x040b, 0x0408, 0 } }, // c
+ { 0x4001, { -2960, 0x0406, 1 } }, // d
+ { 0x6000, { 0x040d, 0x0407, 0 } }, // e
+ { 0x4001, { 2120, 0x0406, 1 } }, // f
+ { 0x6000, { 0x040f, 0x0407, 0 } }, // 10
+ { 0x4001, { -8050, 0x0406, 1 } }, // 11
+ { 0x6000, { 0x0411, 0x0408, 0 } }, // 12
+ { 0x4001, { 8050, 0x0406, 1 } }, // 13
+ { 0x6000, { 0x0413, 0x0408, 0 } }, // 14
+ { 0x4001, { 2750, 0x0406, 1 } }, // 15
+ { 0x6000, { 0x0415, 0x0408, 0 } }, // 16
+ { 0x4001, { 4020, 0x0406, 1 } }, // 17
+ { 0x6000, { 0x0417, 0x0407, 0 } }, // 18
+ { 0x4001, { 8050, 0x0406, 1 } }, // 19
+ { 0x6000, { 0x0419, 0x0407, 0 } }, // 1a
+ { 0x4001, { -5930, 0x0406, 1 } }, // 1b
+ { 0x6000, { 0x041b, 0x0408, 0 } }, // 1c
+ { 0x4001, { 5930, 0x0406, 1 } }, // 1d
+ { 0x6000, { 0x041d, 0x0408, 0 } } // 1e
+};
+static const mso_CustomShape msoActionButtonSound =
+{
+ (SvxMSDffVertPair*)mso_sptActionButtonSoundVert, sizeof( mso_sptActionButtonSoundVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptActionButtonSoundSegm, sizeof( mso_sptActionButtonSoundSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptActionButtonSoundCalc, sizeof( mso_sptActionButtonSoundCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault1400,
+ (SvxMSDffTextRectangles*)mso_sptActionButtonTextRect, sizeof( mso_sptActionButtonTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 10800, 10800,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptButtonHandle, sizeof( mso_sptButtonHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptActionButtonMovieVert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 21600 }, { 0, 21600 },
+ { 0, 0 }, { 21600, 0 }, { 3 MSO_I, 2 MSO_I }, { 1 MSO_I, 2 MSO_I },
+ { 21600, 0 }, { 21600, 21600 }, { 3 MSO_I, 4 MSO_I }, { 3 MSO_I, 2 MSO_I },
+ { 21600, 21600 }, { 0, 21600 }, { 1 MSO_I, 4 MSO_I }, { 3 MSO_I, 4 MSO_I },
+ { 0, 21600 }, { 0, 0 }, { 1 MSO_I, 2 MSO_I }, { 1 MSO_I, 4 MSO_I },
+
+ { 0xa MSO_I, 0xc MSO_I }, { 0xe MSO_I, 0xc MSO_I }, { 0x10 MSO_I, 0x12 MSO_I }, { 0x14 MSO_I, 0x12 MSO_I },
+ { 0x16 MSO_I, 0x18 MSO_I }, { 0x16 MSO_I, 0x1a MSO_I }, { 0x1c MSO_I, 0x1a MSO_I }, { 0x1e MSO_I, 0x18 MSO_I },
+ { 0x20 MSO_I, 0x18 MSO_I }, { 0x20 MSO_I, 0x22 MSO_I }, { 0x1e MSO_I, 0x22 MSO_I }, { 0x1c MSO_I, 0x24 MSO_I },
+ { 0x16 MSO_I, 0x24 MSO_I }, { 0x16 MSO_I, 0x26 MSO_I }, { 0x2a MSO_I, 0x26 MSO_I }, { 0x2a MSO_I, 0x28 MSO_I },
+ { 0x10 MSO_I, 0x28 MSO_I }, { 0xe MSO_I, 0x2c MSO_I }, { 0xa MSO_I, 0x2c MSO_I }
+};
+static const sal_uInt16 mso_sptActionButtonMovieSegm[] =
+{
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0003, 0x6001, 0x8000,
+ 0x4000, 0x0012, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptActionButtonMovieCalc[] = // adj value 0 - 5400
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x6000, { DFF_Prop_geoLeft, DFF_Prop_adjustValue, 0 } },
+ { 0x6000, { DFF_Prop_geoTop, DFF_Prop_adjustValue, 0 } },
+ { 0xa000, { DFF_Prop_geoRight, 0, DFF_Prop_adjustValue } },
+ { 0xa000, { DFF_Prop_geoBottom, 0, DFF_Prop_adjustValue } },
+ { 0x8000, { 10800, 0, DFF_Prop_adjustValue } },
+ { 0x2001, { 0x0405, 1, 10800 } }, // scaling 6
+ { 0x2001, { DFF_Prop_geoRight, 1, 2 } }, // lr center 7
+ { 0x2001, { DFF_Prop_geoBottom, 1, 2 } }, // ul center 8
+
+ { 0x4001, { -8050, 0x0406, 1 } }, // 9
+ { 0x6000, { 0x0409, 0x0407, 0 } }, // a
+ { 0x4001, { -4020, 0x0406, 1 } }, // b
+ { 0x6000, { 0x040b, 0x0408, 0 } }, // c
+ { 0x4001, { -7000, 0x0406, 1 } }, // d
+ { 0x6000, { 0x040d, 0x0407, 0 } }, // e
+ { 0x4001, { -6560, 0x0406, 1 } }, // f
+ { 0x6000, { 0x040f, 0x0407, 0 } }, // 10
+ { 0x4001, { -3600, 0x0406, 1 } }, // 11
+ { 0x6000, { 0x0411, 0x0408, 0 } }, // 12
+ { 0x4001, { 4020, 0x0406, 1 } }, // 13
+ { 0x6000, { 0x0413, 0x0407, 0 } }, // 14
+ { 0x4001, { 4660, 0x0406, 1 } }, // 15
+ { 0x6000, { 0x0415, 0x0407, 0 } }, // 16
+ { 0x4001, { -2960, 0x0406, 1 } }, // 17
+ { 0x6000, { 0x0417, 0x0408, 0 } }, // 18
+ { 0x4001, { -2330, 0x0406, 1 } }, // 19
+ { 0x6000, { 0x0419, 0x0408, 0 } }, // 1a
+ { 0x4001, { 6780, 0x0406, 1 } }, // 1b
+ { 0x6000, { 0x041b, 0x0407, 0 } }, // 1c
+ { 0x4001, { 7200, 0x0406, 1 } }, // 1d
+ { 0x6000, { 0x041d, 0x0407, 0 } }, // 1e
+ { 0x4001, { 8050, 0x0406, 1 } }, // 1f
+ { 0x6000, { 0x041f, 0x0407, 0 } }, // 20
+ { 0x4001, { 2960, 0x0406, 1 } }, // 21
+ { 0x6000, { 0x0421, 0x0408, 0 } }, // 22
+ { 0x4001, { 2330, 0x0406, 1 } }, // 23
+ { 0x6000, { 0x0423, 0x0408, 0 } }, // 24
+ { 0x4001, { 3800, 0x0406, 1 } }, // 25
+ { 0x6000, { 0x0425, 0x0408, 0 } }, // 26
+ { 0x4001, { -1060, 0x0406, 1 } }, // 27
+ { 0x6000, { 0x0427, 0x0408, 0 } }, // 28
+ { 0x4001, { -6350, 0x0406, 1 } }, // 29
+ { 0x6000, { 0x0429, 0x0407, 0 } }, // 2a
+ { 0x4001, { -640, 0x0406, 1 } }, // 2b
+ { 0x6000, { 0x042b, 0x0408, 0 } } // 2c
+};
+static const mso_CustomShape msoActionButtonMovie =
+{
+ (SvxMSDffVertPair*)mso_sptActionButtonMovieVert, sizeof( mso_sptActionButtonMovieVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptActionButtonMovieSegm, sizeof( mso_sptActionButtonMovieSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptActionButtonMovieCalc, sizeof( mso_sptActionButtonMovieCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault1400,
+ (SvxMSDffTextRectangles*)mso_sptActionButtonTextRect, sizeof( mso_sptActionButtonTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 10800, 10800,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptButtonHandle, sizeof( mso_sptButtonHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptSmileyFaceVert[] = // adj value 15510 - 17520
+{
+ { 10800, 10800 }, { 10800, 10800 }, { 0, 360 },
+ { 7305, 7515 }, { 1165, 1165 }, { 0, 360 },
+ { 14295, 7515 }, { 1165, 1165 }, { 0, 360 },
+ { 4870, 1 MSO_I }, { 8680, 2 MSO_I }, { 12920, 2 MSO_I }, { 16730, 1 MSO_I }
+};
+static const sal_uInt16 mso_sptSmileyFaceSegm[] =
+{
+ 0xa203, 0x6000, 0x8000,
+ 0xa203, 0x6000, 0x8000,
+ 0xa203, 0x6000, 0x8000,
+ 0x4000, 0x2001, 0xaa00, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptSmileyFaceCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 15510 } },
+ { 0x8000, { 17520, 0, 0x400 } },
+ { 0x4000, { 15510, 0x400, 0 } }
+};
+
+static const SvxMSDffTextRectangles mso_sptSmileyFaceTextRect[] =
+{
+ { { 0, 1 MSO_I }, { 4 MSO_I, 21600 } }
+};
+static const sal_Int32 mso_sptSmileyFaceDefault[] =
+{
+ 1, 17520
+};
+static const SvxMSDffHandle mso_sptSmileyHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 10800, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 15510, 17520 }
+};
+static const mso_CustomShape msoSmileyFace =
+{
+ (SvxMSDffVertPair*)mso_sptSmileyFaceVert, sizeof( mso_sptSmileyFaceVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptSmileyFaceSegm, sizeof( mso_sptSmileyFaceSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptSmileyFaceCalc, sizeof( mso_sptSmileyFaceCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptSmileyFaceDefault,
+ (SvxMSDffTextRectangles*)mso_sptEllipseTextRect, sizeof( mso_sptEllipseTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptEllipseGluePoints, sizeof( mso_sptEllipseGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptSmileyHandle, sizeof( mso_sptSmileyHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptDonutVert[] = // adj value 0 - 10800
+{
+ { 10800, 10800 }, { 10800, 10800 }, { 0, 360 },
+ { 10800, 10800 }, { 1 MSO_I, 1 MSO_I }, { 0, 360 }
+};
+static const sal_uInt16 mso_sptDonutSegm[] =
+{
+ 0xa203, 0x6000, 0xa203, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptDonutCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x8000, { 10800, 0, DFF_Prop_adjustValue } }
+};
+static const SvxMSDffHandle mso_sptDonutHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 10800, 10800, 10800, 0, 10800, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoDonut =
+{
+ (SvxMSDffVertPair*)mso_sptDonutVert, sizeof( mso_sptDonutVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptDonutSegm, sizeof( mso_sptDonutSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptDonutCalc, sizeof( mso_sptDonutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault5400,
+ (SvxMSDffTextRectangles*)mso_sptEllipseTextRect, sizeof( mso_sptEllipseTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptEllipseGluePoints, sizeof( mso_sptEllipseGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptDonutHandle, sizeof( mso_sptDonutHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptNoSmokingVert[] = // adj value 0 - 7200
+{
+ { 10800, 10800 }, { 10800, 10800 }, { 0, 360 },
+ { 0 MSO_I, 0 MSO_I }, { 1 MSO_I, 1 MSO_I },
+ { 9 MSO_I, 0xa MSO_I }, { 0xb MSO_I, 0xc MSO_I }, { 0 MSO_I, 0 MSO_I }, { 1 MSO_I, 1 MSO_I },
+ { 0xd MSO_I, 0xe MSO_I }, { 0xf MSO_I, 0x10 MSO_I }
+};
+static const sal_uInt16 mso_sptNoSmokingSegm[] =
+{
+ 0xa203, 0x6000, 0xa404, 0x6000, 0xa404, 0x6000, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptNoSmokingCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, // 0
+ { 0x8000, { 21600, 0, DFF_Prop_adjustValue } }, // 1
+ { 0x8000, { 10800, 0, DFF_Prop_adjustValue } }, // 2
+ { 0x2001, { DFF_Prop_adjustValue, 1, 2 } }, // 3
+ { 0xa080, { 0x403, 0, 0x402 } }, // 4
+ { 0x8000, { 10800, 0, 0x403 } }, // 5 x1
+ { 0x4000, { 10800, 0x403, 0 } }, // 6 x2
+ { 0x8000, { 10800, 0, 0x404 } }, // 7 y1
+ { 0x4000, { 10800, 0x404, 0 } }, // 8 y2
+ { 0x6081, { 0x405, 0x407, 45 } }, // 9
+ { 0x6082, { 0x405, 0x407, 45 } }, // a
+ { 0x6081, { 0x405, 0x408, 45 } }, // b
+ { 0x6082, { 0x405, 0x408, 45 } }, // c
+ { 0x6081, { 0x406, 0x408, 45 } }, // d
+ { 0x6082, { 0x406, 0x408, 45 } }, // e
+ { 0x6081, { 0x406, 0x407, 45 } }, // f
+ { 0x6082, { 0x406, 0x407, 45 } } // 10
+};
+static const SvxMSDffHandle mso_sptNoSmokingHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 10800, 10800, 10800, 0, 7200, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoNoSmoking =
+{
+ (SvxMSDffVertPair*)mso_sptNoSmokingVert, sizeof( mso_sptNoSmokingVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptNoSmokingSegm, sizeof( mso_sptNoSmokingSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptNoSmokingCalc, sizeof( mso_sptNoSmokingCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault2700,
+ (SvxMSDffTextRectangles*)mso_sptEllipseTextRect, sizeof( mso_sptEllipseTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptEllipseGluePoints, sizeof( mso_sptEllipseGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptNoSmokingHandle, sizeof( mso_sptNoSmokingHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptBlockArcVert[] = // adj value 0 (degrees)
+{ // adj value 1: 0 -> 10800;
+ { 0, 0 }, { 21600, 21600 }, { 4 MSO_I, 3 MSO_I }, { 2 MSO_I, 3 MSO_I },
+ { 5 MSO_I, 5 MSO_I }, { 6 MSO_I, 6 MSO_I }, { 2 MSO_I, 3 MSO_I }, { 4 MSO_I, 3 MSO_I }
+};
+static const sal_uInt16 mso_sptBlockArcSegm[] =
+{
+ 0xA404, 0xa504, 0x6001, 0x8000
+};
+static const sal_Int32 mso_sptBlockArcDefault[] =
+{
+ 2, 180, 5400
+};
+static const SvxMSDffCalculationData mso_sptBlockArcCalc[] =
+{
+ { 0x400a, { 10800, DFF_Prop_adjustValue, 0 } },
+ { 0x4009, { 10800, DFF_Prop_adjustValue, 0 } },
+ { 0x2000, { 0x400, 10800, 0 } },
+ { 0x2000, { 0x401, 10800, 0 } },
+ { 0x8000, { 21600, 0, 0x402 } },
+ { 0x8000, { 10800, 0, DFF_Prop_adjust2Value } },
+ { 0x4000, { 10800, DFF_Prop_adjust2Value, 0 } },
+ { 0x600a, { 0x405, DFF_Prop_adjustValue, 0 } },
+ { 0x6009, { 0x405, DFF_Prop_adjustValue, 0 } }
+};
+static const SvxMSDffHandle mso_sptBlockArcHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_POLAR | MSDFF_HANDLE_FLAGS_RADIUS_RANGE,
+ 0x101, 0x100, 10800, 10800, 0, 10800, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoBlockArc =
+{
+ (SvxMSDffVertPair*)mso_sptBlockArcVert, sizeof( mso_sptBlockArcVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptBlockArcSegm, sizeof( mso_sptBlockArcSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptBlockArcCalc, sizeof( mso_sptBlockArcCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptBlockArcDefault,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptBlockArcHandle, sizeof( mso_sptBlockArcHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+// aware : control points are always part of the bounding box
+static const SvxMSDffVertPair mso_sptHeartVert[] =
+{
+ { 10800, 21599 }, { 321, 6886 }, { 70, 6036 }, // ppp
+ { -9, 5766 }, { -1, 5474 }, { 2, 5192 }, // ccp
+ { 6, 4918 }, { 43, 4641 }, { 101, 4370 }, // ccp
+ { 159, 4103 }, { 245, 3837 }, { 353, 3582 }, // ccp
+ { 460, 3326 }, { 591, 3077 }, { 741, 2839 }, // ccp
+ { 892, 2598 }, { 1066, 2369 }, { 1253, 2155 }, // ccp
+ { 1443, 1938 }, { 1651, 1732 }, { 1874, 1543 }, // ccp
+ { 2097, 1351 }, { 2337, 1174 }, { 2587, 1014 }, // ccp
+ { 2839, 854 }, { 3106, 708 }, { 3380, 584 }, // ccp
+ { 3656, 459 }, { 3945, 350 }, { 4237, 264 }, // ccp
+ { 4533, 176 }, { 4838, 108 }, { 5144, 66 }, // ccp
+ { 5454, 22 }, { 5771, 1 }, { 6086, 3 }, // ccp
+ { 6407, 7 }, { 6731, 35 }, { 7048, 89 }, // ccp
+ { 7374, 144 }, { 7700, 226 }, { 8015, 335 }, // ccp
+ { 8344, 447 }, { 8667, 590 }, { 8972, 756 }, // ccp
+ { 9297, 932 }, { 9613, 1135 }, { 9907, 1363 }, // ccp
+ { 10224, 1609 }, { 10504, 1900 }, { 10802, 2169 }, // ccp
+ { 11697, 1363 }, // p
+ { 11971, 1116 }, { 12304, 934 }, { 12630, 756 }, // ccp
+ { 12935, 590 }, { 13528, 450 }, { 13589, 335 }, // ccp
+ { 13901, 226 }, { 14227, 144 }, { 14556, 89 }, // ccp
+ { 14872, 35 }, { 15195, 7 }, { 15517, 3 }, // ccp
+ { 15830, 0 }, { 16147, 22 }, { 16458, 66 }, // ccp
+ { 16764, 109 }, { 17068, 177 }, { 17365, 264 }, // ccp
+ { 17658, 349 }, { 17946, 458 }, { 18222, 584 }, // ccp
+ { 18496, 708 }, { 18762, 854 }, { 19015, 1014 }, // ccp
+ { 19264, 1172 }, { 19504, 1349 }, { 19730, 1543 }, // ccp
+ { 19950, 1731 }, { 20158, 1937 }, { 20350, 2155 }, // ccp
+ { 20536, 2369 }, { 20710, 2598 }, { 20861, 2839 }, // ccp
+ { 21010, 3074 }, { 21143, 3323 }, { 21251, 3582 }, // ccp
+ { 21357, 3835 }, { 21443, 4099 }, { 21502, 4370 }, // ccp
+ { 21561, 4639 }, { 21595, 4916 }, { 21600, 5192 }, // ccp
+ { 21606, 5474 }, { 21584, 5760 }, { 21532, 6036 }, // ccp
+ { 21478, 6326 }, { 21366, 6603 }, { 21282, 6887 }, // ccp
+ { 10802, 21602 } // p
+};
+static const sal_uInt16 mso_sptHeartSegm[] =
+{
+ 0x4000, 0x0002, 0x2010, 0x0001, 0x2010, 0x0001, 0x6001, 0x8000
+};
+static const SvxMSDffTextRectangles mso_sptHeartTextRect[] =
+{
+ { { 5080, 2540 }, { 16520, 13550 } }
+};
+static const SvxMSDffVertPair mso_sptHeartGluePoints[] =
+{
+ { 10800, 2180 }, { 3090, 10800 }, { 10800, 21600 }, { 18490, 10800 }
+};
+static const mso_CustomShape msoHeart =
+{
+ (SvxMSDffVertPair*)mso_sptHeartVert, sizeof( mso_sptHeartVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptHeartSegm, sizeof( mso_sptHeartSegm ) >> 1,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptHeartTextRect, sizeof( mso_sptHeartTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21615, 21602,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptHeartGluePoints, sizeof( mso_sptHeartGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptLightningBoldVert[] =
+{
+ { 8458, 0 }, { 0, 3923 }, { 7564, 8416 }, { 4993, 9720 },
+ { 12197, 13904 }, { 9987, 14934 }, { 21600, 21600 }, { 14768, 12911 },
+ { 16558, 12016 }, { 11030, 6840 }, { 12831, 6120 }, { 8458, 0 }
+};
+static const SvxMSDffTextRectangles mso_sptLightningBoldTextRect[] =
+{
+ { { 8680, 7410 }, { 13970, 14190 } }
+};
+static const SvxMSDffVertPair mso_sptLightningBoldGluePoints[] =
+{
+ { 8458, 0 }, { 0, 3923 }, { 4993, 9720 }, { 9987, 14934 }, { 21600, 21600 },
+ { 16558, 12016 }, { 12831, 6120 }
+};
+static const mso_CustomShape msoLightningBold =
+{
+ (SvxMSDffVertPair*)mso_sptLightningBoldVert, sizeof( mso_sptLightningBoldVert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptLightningBoldTextRect, sizeof( mso_sptLightningBoldTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptLightningBoldGluePoints, sizeof( mso_sptLightningBoldGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptSunVert[] = // adj value 2700 -> 10125
+{
+ { 0, 10800 }, { 4 MSO_I, 8 MSO_I }, { 4 MSO_I, 9 MSO_I },
+ { 0x0a MSO_I, 0x0b MSO_I }, { 0x0c MSO_I, 0x0d MSO_I }, { 0x0e MSO_I, 0x0f MSO_I },
+ { 0x10 MSO_I, 0x11 MSO_I }, { 0x12 MSO_I, 0x13 MSO_I }, { 0x14 MSO_I, 0x15 MSO_I },
+ { 0x16 MSO_I, 0x17 MSO_I }, { 0x18 MSO_I, 0x19 MSO_I }, { 0x1a MSO_I, 0x1b MSO_I },
+ { 0x1c MSO_I, 0x1d MSO_I }, { 0x1e MSO_I, 0x1f MSO_I }, { 0x20 MSO_I, 0x21 MSO_I },
+ { 0x22 MSO_I, 0x23 MSO_I }, { 0x24 MSO_I, 0x25 MSO_I }, { 0x26 MSO_I, 0x27 MSO_I },
+ { 0x28 MSO_I, 0x29 MSO_I }, { 0x2a MSO_I, 0x2b MSO_I }, { 0x2c MSO_I, 0x2d MSO_I },
+ { 0x2e MSO_I, 0x2f MSO_I }, { 0x30 MSO_I, 0x31 MSO_I }, { 0x32 MSO_I, 0x33 MSO_I },
+ { 10800, 10800 }, { 0x36 MSO_I, 0x36 MSO_I }, { 0, 360 }
+};
+static const sal_uInt16 mso_sptSunSegm[] =
+{
+ 0x4000, 0x0002, 0x6001, 0x8000,
+ 0x4000, 0x0002, 0x6001, 0x8000,
+ 0x4000, 0x0002, 0x6001, 0x8000,
+ 0x4000, 0x0002, 0x6001, 0x8000,
+ 0x4000, 0x0002, 0x6001, 0x8000,
+ 0x4000, 0x0002, 0x6001, 0x8000,
+ 0x4000, 0x0002, 0x6001, 0x8000,
+ 0x4000, 0x0002, 0x6001, 0x8000,
+ 0xa203, 0x6000, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptSunCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x8000, { 21600, 0, DFF_Prop_adjustValue } },
+ { 0x2000, { DFF_Prop_adjustValue, 0, 2700 } },
+ { 0x2001, { 0x402, 5080, 7425 } },
+ { 0x2000, { 0x403, 2540, 0 } },
+ { 0x8000, { 10125, 0, DFF_Prop_adjustValue } },
+ { 0x2001, { 0x405, 2120, 7425 } },
+ { 0x2000, { 0x406, 210, 0 } },
+ { 0x4000, { 10800, 0x407, 0 } }, // y1 (0x8)
+ { 0x8000, { 10800, 0, 0x407 } }, // y2 (0x9)
+ { 0x0081, { 0, 10800, 45 } }, // 0xa
+ { 0x0082, { 0, 10800, 45 } }, // 0xb
+ { 0x6081, { 0x404, 0x408, 45 } }, // 0xc
+ { 0x6082, { 0x404, 0x408, 45 } }, // 0xd
+ { 0x6081, { 0x404, 0x409, 45 } }, // 0xe
+ { 0x6082, { 0x404, 0x409, 45 } }, // 0xf
+ { 0x0081, { 0, 10800, 90 } }, // 0x10
+ { 0x0082, { 0, 10800, 90 } }, // 0x11
+ { 0x6081, { 0x404, 0x408, 90 } }, // 0x12
+ { 0x6082, { 0x404, 0x408, 90 } }, // 0x13
+ { 0x6081, { 0x404, 0x409, 90 } }, // 0x14
+ { 0x6082, { 0x404, 0x409, 90 } }, // 0x15
+ { 0x0081, { 0, 10800, 135 } }, // 0x16
+ { 0x0082, { 0, 10800, 135 } }, // 0x17
+ { 0x6081, { 0x404, 0x408, 135 } }, // 0x18
+ { 0x6082, { 0x404, 0x408, 135 } }, // 0x19
+ { 0x6081, { 0x404, 0x409, 135 } }, // 0x1a
+ { 0x6082, { 0x404, 0x409, 135 } }, // 0x1b
+ { 0x0081, { 0, 10800, 180 } }, // 0x1c
+ { 0x0082, { 0, 10800, 180 } }, // 0x1d
+ { 0x6081, { 0x404, 0x408, 180 } }, // 0x1e
+ { 0x6082, { 0x404, 0x408, 180 } }, // 0x1f
+ { 0x6081, { 0x404, 0x409, 180 } }, // 0x20
+ { 0x6082, { 0x404, 0x409, 180 } }, // 0x21
+ { 0x0081, { 0, 10800, 225 } }, // 0x22
+ { 0x0082, { 0, 10800, 225 } }, // 0x23
+ { 0x6081, { 0x404, 0x408, 225 } }, // 0x24
+ { 0x6082, { 0x404, 0x408, 225 } }, // 0x25
+ { 0x6081, { 0x404, 0x409, 225 } }, // 0x26
+ { 0x6082, { 0x404, 0x409, 225 } }, // 0x27
+ { 0x0081, { 0, 10800, 270 } }, // 0x28
+ { 0x0082, { 0, 10800, 270 } }, // 0x29
+ { 0x6081, { 0x404, 0x408, 270 } }, // 0x2a
+ { 0x6082, { 0x404, 0x408, 270 } }, // 0x2b
+ { 0x6081, { 0x404, 0x409, 270 } }, // 0x2c
+ { 0x6082, { 0x404, 0x409, 270 } }, // 0x2d
+ { 0x0081, { 0, 10800, 315 } }, // 0x2e
+ { 0x0082, { 0, 10800, 315 } }, // 0x2f
+ { 0x6081, { 0x404, 0x408, 315 } }, // 0x30
+ { 0x6082, { 0x404, 0x408, 315 } }, // 0x31
+ { 0x6081, { 0x404, 0x409, 315 } }, // 0x32
+ { 0x6082, { 0x404, 0x409, 315 } }, // 0x33
+ { 0x2081, { DFF_Prop_adjustValue, 10800, 45 } }, // 0x34 ( textbox )
+ { 0x2081, { DFF_Prop_adjustValue, 10800, 225 } }, // 0x35
+ { 0x8000, { 10800, 0, DFF_Prop_adjustValue } }
+};
+static const SvxMSDffTextRectangles mso_sptSunTextRect[] =
+{
+ { { 0x34 MSO_I, 0x34 MSO_I }, { 0x35 MSO_I, 0x35 MSO_I } }
+};
+static const SvxMSDffHandle mso_sptSunHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 10800, 10800, 10800, 2700, 10125, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoSun =
+{
+ (SvxMSDffVertPair*)mso_sptSunVert, sizeof( mso_sptSunVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptSunSegm, sizeof( mso_sptSunSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptSunCalc, sizeof( mso_sptSunCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault5400,
+ (SvxMSDffTextRectangles*)mso_sptSunTextRect, sizeof( mso_sptSunTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptStandardGluePoints, sizeof( mso_sptStandardGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptSunHandle, sizeof( mso_sptSunHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptMoonVert[] = // adj value 0 -> 18900
+{
+ { 21600, 0 },
+ { 3 MSO_I, 4 MSO_I }, { 0 MSO_I, 5080 }, { 0 MSO_I, 10800 }, // ccp
+ { 0 MSO_I, 16520 }, { 3 MSO_I, 5 MSO_I }, { 21600, 21600 }, // ccp
+ { 9740, 21600 }, { 0, 16730 }, { 0, 10800 }, // ccp
+ { 0, 4870 }, { 9740, 0 }, { 21600, 0 } // ccp
+};
+static const sal_uInt16 mso_sptMoonSegm[] =
+{
+ 0x4000, 0x2004, 0x6000, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptMoonCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x8000, { 21600, 0, DFF_Prop_adjustValue } },
+ { 0x2001, { 0x401, 1, 2 } },
+ { 0x6000, { 0x402, DFF_Prop_adjustValue, 0 } },
+ { 0x2001, { DFF_Prop_adjustValue, 1794, 10000 } },
+ { 0x8000, { 21600, 0, 0x0404 } },
+ { 0x2001, { DFF_Prop_adjustValue, 400, 18900 } },
+ { 0x8081, { 0, 10800, 0x406 } },
+ { 0x8082, { 0, 10800, 0x406 } },
+ { 0x6000, { 0x407, 0x407, 0 } },
+ { 0x8000, { 21600, 0, 0x408 } }
+};
+static const SvxMSDffTextRectangles mso_sptMoonTextRect[] =
+{
+ { { 9 MSO_I, 8 MSO_I }, { 0 MSO_I, 0xa MSO_I } }
+};
+static const SvxMSDffVertPair mso_sptMoonGluePoints[] =
+{
+ { 21600, 0 }, { 0, 10800 }, { 21600, 21600 }, { 0 MSO_I, 10800 }
+};
+static const SvxMSDffHandle mso_sptMoonHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 10800, 10800, 10800, 0, 18900, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoMoon =
+{
+ (SvxMSDffVertPair*)mso_sptMoonVert, sizeof( mso_sptMoonVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptMoonSegm, sizeof( mso_sptMoonSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptMoonCalc, sizeof( mso_sptMoonCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault10800,
+ (SvxMSDffTextRectangles*)mso_sptMoonTextRect, sizeof( mso_sptMoonTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptMoonGluePoints, sizeof( mso_sptMoonGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptMoonHandle, sizeof( mso_sptMoonHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptBracketPairVert[] = // adj value 0 -> 10800
+{
+ { 0 MSO_I, 0 }, { 0, 1 MSO_I }, // left top alignment
+ { 0, 2 MSO_I }, { 0 MSO_I, 21600 }, // left bottom "
+ { 3 MSO_I, 21600 }, { 21600, 2 MSO_I }, // right bottom "
+ { 21600, 1 MSO_I }, { 3 MSO_I, 0 } // right top "
+};
+static const sal_uInt16 mso_sptBracketPairSegm[] =
+{
+ 0x4000, 0xa701, 0x0001, 0xa801, 0x8000,
+ 0x4000, 0xa701, 0x0001, 0xa801, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptBracketPairCalc[] =
+{
+ { 0x6000, { DFF_Prop_geoLeft, DFF_Prop_adjustValue, 0 } },
+ { 0x6000, { DFF_Prop_geoTop, DFF_Prop_adjustValue, 0 } },
+ { 0xa000, { DFF_Prop_geoBottom, 0, DFF_Prop_adjustValue } },
+ { 0xa000, { DFF_Prop_geoRight, 0, DFF_Prop_adjustValue } },
+ { 0x2082, { DFF_Prop_adjustValue, 0, 45 } },
+ { 0x2000, { 0x404, 0, 10800 } },
+ { 0x8000, { 0, 0, DFF_Prop_adjustValue } },
+ { 0xa000, { 0x406, 0, 0x405 } },
+ { 0xa000, { DFF_Prop_geoLeft, 0, 0x407 } },
+ { 0xa000, { DFF_Prop_geoTop, 0, 0x407 } },
+ { 0x6000, { DFF_Prop_geoRight, 0x407, 0 } },
+ { 0x6000, { DFF_Prop_geoBottom, 0x407, 0 } },
+ { 0xa000, { DFF_Prop_geoLeft, 0, 0x405 } },
+ { 0xa000, { DFF_Prop_geoTop, 0, 0x405 } },
+ { 0x6000, { DFF_Prop_geoRight, 0x405, 0 } },
+ { 0x6000, { DFF_Prop_geoBottom, 0x405, 0 } }
+};
+static const SvxMSDffTextRectangles mso_sptBracketPairTextRect[] =
+{
+ { { 8 MSO_I, 9 MSO_I }, { 0xa MSO_I, 0xb MSO_I } }
+};
+static const SvxMSDffHandle mso_sptBracketPairHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_SWITCHED,
+ 0x100, 0, 10800, 10800, 0, 10800, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoBracketPair =
+{
+ (SvxMSDffVertPair*)mso_sptBracketPairVert, sizeof( mso_sptBracketPairVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptBracketPairSegm, sizeof( mso_sptBracketPairSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptBracketPairCalc, sizeof( mso_sptBracketPairCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault3700,
+ (SvxMSDffTextRectangles*)mso_sptBracketPairTextRect, sizeof( mso_sptBracketPairTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 10800, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptStandardGluePoints, sizeof( mso_sptStandardGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptBracketPairHandle, sizeof( mso_sptBracketPairHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const sal_uInt16 mso_sptPlaqueSegm[] =
+{
+ 0x4000, 0xa801, 0x0001, 0xa701, 0x0001, 0xa801, 0x0001, 0xa701, 0x6000, 0x8000
+};
+static const SvxMSDffTextRectangles mso_sptPlaqueTextRect[] =
+{
+ { { 0xc MSO_I, 0xd MSO_I }, { 0xe MSO_I, 0xf MSO_I } }
+};
+static const SvxMSDffHandle mso_sptPlaqueHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_SWITCHED,
+ 0x100, 0, 10800, 10800, 0, 10800, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoPlaque =
+{
+ (SvxMSDffVertPair*)mso_sptBracketPairVert, sizeof( mso_sptBracketPairVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptPlaqueSegm, sizeof( mso_sptPlaqueSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptBracketPairCalc, sizeof( mso_sptBracketPairCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault3600,
+ (SvxMSDffTextRectangles*)mso_sptPlaqueTextRect, sizeof( mso_sptPlaqueTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 10800, 10800,
+ (SvxMSDffVertPair*)mso_sptStandardGluePoints, sizeof( mso_sptStandardGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptPlaqueHandle, sizeof( mso_sptPlaqueHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptBracePairVert[] = // adj value 0 -> 5400
+{
+ { 4 MSO_I, 0 }, { 0 MSO_I, 1 MSO_I }, { 0 MSO_I, 6 MSO_I }, { 0 ,10800 }, // left bracket
+ { 0 MSO_I, 7 MSO_I }, { 0 MSO_I, 2 MSO_I }, { 4 MSO_I, 21600 },
+ { 8 MSO_I, 21600 }, { 3 MSO_I, 2 MSO_I }, { 3 MSO_I, 7 MSO_I }, { 21600, 10800 }, // right bracket
+ { 3 MSO_I, 6 MSO_I }, { 3 MSO_I, 1 MSO_I }, { 8 MSO_I, 0 }
+};
+static const sal_uInt16 mso_sptBracePairSegm[] =
+{
+ 0x4000, 0xa701, 0x0001, 0xa801, 0xa701, 0x0001, 0xa801, 0x8000,
+ 0x4000, 0xa701, 0x0001, 0xa801, 0xa701, 0x0001, 0xa801, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptBracePairCalc[] =
+{
+ { 0x6000, { DFF_Prop_geoLeft, DFF_Prop_adjustValue, 0 } },
+ { 0x6000, { DFF_Prop_geoTop, DFF_Prop_adjustValue, 0 } },
+ { 0xa000, { DFF_Prop_geoBottom, 0, DFF_Prop_adjustValue } },
+ { 0xa000, { DFF_Prop_geoRight, 0, DFF_Prop_adjustValue } },
+ { 0x2001, { 0x400, 2, 1 } }, // 4
+ { 0x2001, { DFF_Prop_adjustValue, 2, 1 } }, // 5
+ { 0x8000, { 10800, 0, DFF_Prop_adjustValue } }, // 6
+ { 0x8000, { 21600, 0, 0x406 } }, // 7
+ { 0xa000, { DFF_Prop_geoRight, 0, 0x405 } }, // 8
+ { 0x2001, { DFF_Prop_adjustValue, 1, 3 } }, // 9
+ { 0x6000, { 0x409, DFF_Prop_adjustValue, 0 } }, // xa
+ { 0x6000, { DFF_Prop_geoLeft, 0x40a, 0 } }, // xb
+ { 0x6000, { DFF_Prop_geoTop, 0x409, 0 } }, // xc
+ { 0xa000, { DFF_Prop_geoRight, 0, 0x40a } }, // xd
+ { 0xa000, { DFF_Prop_geoBottom, 0, 0x409 } } // xe
+};
+static const SvxMSDffTextRectangles mso_sptBracePairTextRect[] =
+{
+ { { 0xb MSO_I, 0xc MSO_I }, { 0xd MSO_I, 0xe MSO_I } }
+};
+static const SvxMSDffHandle mso_sptBracePairHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_SWITCHED,
+ 0, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 0, 5400 }
+};
+static const mso_CustomShape msoBracePair =
+{
+ (SvxMSDffVertPair*)mso_sptBracePairVert, sizeof( mso_sptBracePairVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptBracePairSegm, sizeof( mso_sptBracePairSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptBracePairCalc, sizeof( mso_sptBracePairCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault1800,
+ (SvxMSDffTextRectangles*)mso_sptBracePairTextRect, sizeof( mso_sptBracePairTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 10800, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptStandardGluePoints, sizeof( mso_sptStandardGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptBracePairHandle, sizeof( mso_sptBracePairHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffCalculationData mso_sptBracketCalc[] =
+{
+ { 0x2001, { DFF_Prop_adjustValue, 1, 2 } },
+ { 0x6000, { DFF_Prop_geoTop, DFF_Prop_adjustValue, 0 } },
+ { 0xa000, { DFF_Prop_geoBottom, 0, DFF_Prop_adjustValue } },
+ { 0x6000, { DFF_Prop_geoTop, 0x400, 0 } },
+ { 0xa000, { DFF_Prop_geoBottom, 0, 0x400 } }
+};
+static const sal_uInt16 mso_sptBracketSegm[] =
+{
+ 0x4000, 0x2001, 0x0001, 0x2001, 0x8000
+};
+static const SvxMSDffVertPair mso_sptLeftBracketVert[] = // adj value 0 -> 10800
+{
+ { 21600, 0 }, { 10800, 0 }, { 0, 3 MSO_I }, { 0, 1 MSO_I },
+ { 0, 2 MSO_I }, { 0, 4 MSO_I }, { 10800, 21600 }, { 21600, 21600 }
+};
+static const SvxMSDffTextRectangles mso_sptLeftBracketTextRect[] =
+{
+ { { 6350, 3 MSO_I }, { 21600, 4 MSO_I } }
+};
+static const SvxMSDffVertPair mso_sptLeftBracketGluePoints[] =
+{
+ { 21600, 0 }, { 0, 10800 }, { 21600, 21600 }
+};
+static const SvxMSDffHandle mso_sptLeftBracketHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 0, 10800 }
+};
+static const mso_CustomShape msoLeftBracket =
+{
+ (SvxMSDffVertPair*)mso_sptLeftBracketVert, sizeof( mso_sptLeftBracketVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptBracketSegm, sizeof( mso_sptBracketSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptBracketCalc, sizeof( mso_sptBracketCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault1800,
+ (SvxMSDffTextRectangles*)mso_sptLeftBracketTextRect, sizeof( mso_sptLeftBracketTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptLeftBracketGluePoints, sizeof( mso_sptLeftBracketGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptLeftBracketHandle, sizeof( mso_sptLeftBracketHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+static const SvxMSDffVertPair mso_sptRightBracketVert[] = // adj value 0 -> 10800
+{
+ { 0, 0 }, { 10800, 0 }, { 21600, 3 MSO_I }, { 21600, 1 MSO_I },
+ { 21600, 2 MSO_I }, { 21600, 4 MSO_I }, { 10800, 21600 }, { 0, 21600 }
+};
+static const SvxMSDffTextRectangles mso_sptRightBracketTextRect[] =
+{
+ { { 0, 3 MSO_I }, { 15150, 4 MSO_I } }
+};
+static const SvxMSDffVertPair mso_sptRightBracketGluePoints[] =
+{
+ { 0, 0 }, { 0, 21600 }, { 21600, 10800 }
+};
+static const SvxMSDffHandle mso_sptRightBracketHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 1, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 0, 10800 }
+};
+static const mso_CustomShape msoRightBracket =
+{
+ (SvxMSDffVertPair*)mso_sptRightBracketVert, sizeof( mso_sptRightBracketVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptBracketSegm, sizeof( mso_sptBracketSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptBracketCalc, sizeof( mso_sptBracketCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault1800,
+ (SvxMSDffTextRectangles*)mso_sptRightBracketTextRect, sizeof( mso_sptRightBracketTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptRightBracketGluePoints, sizeof( mso_sptRightBracketGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptRightBracketHandle, sizeof( mso_sptRightBracketHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffCalculationData mso_sptBraceCalc[] =
+{
+ { 0x2001, { DFF_Prop_adjustValue, 1, 2 } },
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0xa000, { 0x404, 0, DFF_Prop_adjustValue } },
+ { 0xa000, { 0x404, 0, 0x400 } },
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } },
+ { 0x6000, { 0x404, 0x400, 0 } },
+ { 0x6000, { 0x404, DFF_Prop_adjustValue, 0 } },
+ { 0x8000, { 21600, 0, DFF_Prop_adjustValue } },
+ { 0x8000, { 21600, 0, 0x400 } },
+ { 0x2001, { DFF_Prop_adjustValue, 10000, 31953 } },
+ { 0x8000, { 21600, 0, 0x409 } }
+};
+static const sal_uInt16 mso_sptBraceSegm[] =
+{
+ 0x4000, 0x2001, 0x0001, 0x2002, 0x0001, 0x2001, 0x8000
+};
+static const sal_Int32 mso_sptBraceDefault[] =
+{
+ 2, 1800, 10800
+};
+static const SvxMSDffVertPair mso_sptLeftBraceVert[] =
+{
+ { 21600, 0 }, // p
+ { 16200, 0 }, { 10800, 0 MSO_I }, { 10800, 1 MSO_I }, // ccp
+ { 10800, 2 MSO_I }, // p
+ { 10800, 3 MSO_I }, { 5400, 4 MSO_I }, { 0, 4 MSO_I }, // ccp
+ { 5400, 4 MSO_I }, { 10800, 5 MSO_I }, { 10800, 6 MSO_I }, // ccp
+ { 10800, 7 MSO_I }, // p
+ { 10800, 8 MSO_I }, { 16200, 21600 }, { 21600, 21600 } // ccp
+};
+static const SvxMSDffTextRectangles mso_sptLeftBraceTextRect[] =
+{
+ { { 13800, 9 MSO_I }, { 21600, 10 MSO_I } }
+};
+static const SvxMSDffHandle mso_sptLeftBraceHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 10800, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 0, 5400 },
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0, 0x101, 10800, 10800, 0x80000000, 0x7fffffff, 0, 21600 }
+};
+static const mso_CustomShape msoLeftBrace = // adj value0 0 -> 5400
+{ // adj value1 0 -> 21600
+ (SvxMSDffVertPair*)mso_sptLeftBraceVert, sizeof( mso_sptLeftBraceVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptBraceSegm, sizeof( mso_sptBraceSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptBraceCalc, sizeof( mso_sptBraceCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptBraceDefault,
+ (SvxMSDffTextRectangles*)mso_sptLeftBraceTextRect, sizeof( mso_sptLeftBraceTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptLeftBracketGluePoints, sizeof( mso_sptLeftBracketGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptLeftBraceHandle, sizeof( mso_sptLeftBraceHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+static const SvxMSDffVertPair mso_sptRightBraceVert[] =
+{
+ { 0, 0 }, // p
+ { 5400, 0 }, { 10800, 0 MSO_I }, { 10800, 1 MSO_I }, // ccp
+ { 10800, 2 MSO_I }, // p
+ { 10800, 3 MSO_I }, { 16200, 4 MSO_I }, { 21600, 4 MSO_I }, // ccp
+ { 16200, 4 MSO_I }, { 10800, 5 MSO_I }, { 10800, 6 MSO_I }, // ccp
+ { 10800, 7 MSO_I }, // p
+ { 10800, 8 MSO_I }, { 5400, 21600 }, { 0, 21600 } // ccp
+};
+static const SvxMSDffTextRectangles mso_sptRightBraceTextRect[] =
+{
+ { { 0, 9 MSO_I }, { 7800, 10 MSO_I } }
+};
+static const SvxMSDffHandle mso_sptRightBraceHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 10800, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 0, 5400 },
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 1, 0x101, 10800, 10800, 0x80000000, 0x7fffffff, 0, 21600 }
+};
+static const mso_CustomShape msoRightBrace = // adj value0 0 -> 5400
+{ // adj value1 0 -> 21600
+ (SvxMSDffVertPair*)mso_sptRightBraceVert, sizeof( mso_sptRightBraceVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptBraceSegm, sizeof( mso_sptBraceSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptBraceCalc, sizeof( mso_sptBraceCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptBraceDefault,
+ (SvxMSDffTextRectangles*)mso_sptRightBraceTextRect, sizeof( mso_sptRightBraceTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptRightBracketGluePoints, sizeof( mso_sptRightBracketGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptRightBraceHandle, sizeof( mso_sptRightBraceHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptIrregularSeal1Vert[] =
+{
+ { 10901, 5905 }, { 8458, 2399 }, { 7417, 6425 }, { 476, 2399 },
+ { 4732, 7722 }, { 106, 8718 }, { 3828, 11880 }, { 243, 14689 },
+ { 5772, 14041 }, { 4868, 17719 }, { 7819, 15730 }, { 8590, 21600 },
+ { 10637, 15038 }, { 13349, 19840 }, { 14125, 14561 }, { 18248, 18195 },
+ { 16938, 13044 }, { 21600, 13393 }, { 17710, 10579 }, { 21198, 8242 },
+ { 16806, 7417 }, { 18482, 4560 }, { 14257, 5429 }, { 14623, 106 }, { 10901, 5905 }
+};
+static const SvxMSDffTextRectangles mso_sptIrregularSeal1TextRect[] =
+{
+ { { 4680, 6570 }, { 16140, 13280 } }
+};
+static const SvxMSDffVertPair mso_sptIrregularSeal1GluePoints[] =
+{
+ { 14623, 106 }, { 106, 8718 }, { 8590, 21600 }, { 21600, 13393 }
+};
+static const mso_CustomShape msoIrregularSeal1 =
+{
+ (SvxMSDffVertPair*)mso_sptIrregularSeal1Vert, sizeof( mso_sptIrregularSeal1Vert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptIrregularSeal1TextRect, sizeof( mso_sptIrregularSeal1TextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptIrregularSeal1GluePoints, sizeof( mso_sptIrregularSeal1GluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptIrregularSeal2Vert[] =
+{
+ { 11464, 4340 }, { 9722, 1887 }, { 8548, 6383 }, { 4503, 3626 },
+ { 5373, 7816 }, { 1174, 8270 }, { 3934, 11592 }, { 0, 12875 },
+ { 3329, 15372 }, { 1283, 17824 }, { 4804, 18239 }, { 4918, 21600 },
+ { 7525, 18125 }, { 8698, 19712 }, { 9871, 17371 }, { 11614, 18844 },
+ { 12178, 15937 }, { 14943, 17371 }, { 14640, 14348 }, { 18878, 15632 },
+ { 16382, 12311 }, { 18270, 11292 }, { 16986, 9404 }, { 21600, 6646 },
+ { 16382, 6533 }, { 18005, 3172 }, { 14524, 5778 }, { 14789, 0 },
+ { 11464, 4340 }
+};
+static const SvxMSDffTextRectangles mso_sptIrregularSeal2TextRect[] =
+{
+ { { 5400, 6570 }, { 14160, 15290 } }
+};
+static const SvxMSDffVertPair mso_sptIrregularSeal2GluePoints[] =
+{
+ { 9722, 1887 }, { 0, 12875 }, { 11614, 18844 }, { 21600, 6646 }
+};
+static const mso_CustomShape msoIrregularSeal2 =
+{
+ (SvxMSDffVertPair*)mso_sptIrregularSeal2Vert, sizeof( mso_sptIrregularSeal2Vert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptIrregularSeal2TextRect, sizeof( mso_sptIrregularSeal2TextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptIrregularSeal2GluePoints, sizeof( mso_sptIrregularSeal2GluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptSeal4Vert[] = // adjustment1 : 0 - 10800
+{
+ { 0, 10800 }, { 4 MSO_I, 4 MSO_I }, { 10800, 0 }, { 3 MSO_I, 4 MSO_I },
+ { 21600, 10800 }, { 3 MSO_I, 3 MSO_I }, { 10800, 21600 }, { 4 MSO_I, 3 MSO_I },
+ { 0, 10800 }
+};
+static const SvxMSDffCalculationData mso_sptSeal4Calc[] =
+{
+ { 0x0000, { 7600, 0, 0 } },
+ { 0x6001, { 0x400, DFF_Prop_adjustValue, 10800 } },
+ { 0xa000, { 0x400, 0, 0x401 } },
+ { 0x4000, { 10800, 0x402, 0 } },
+ { 0x8000, { 10800, 0, 0x402 } }
+};
+static const SvxMSDffTextRectangles mso_sptSeal4TextRect[] =
+{
+ { { 4 MSO_I, 4 MSO_I }, { 3 MSO_I, 3 MSO_I } }
+};
+static const SvxMSDffHandle mso_sptSealHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 10800, 10800, 10800, 0, 10800, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoSeal4 =
+{
+ (SvxMSDffVertPair*)mso_sptSeal4Vert, sizeof( mso_sptSeal4Vert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ (SvxMSDffCalculationData*)mso_sptSeal4Calc, sizeof( mso_sptSeal4Calc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault8100,
+ (SvxMSDffTextRectangles*)mso_sptSeal4TextRect, sizeof( mso_sptSeal4TextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptSealHandle, sizeof( mso_sptSealHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptStarVert[] =
+{
+ { 10797, 0 }, { 8278, 8256 }, { 0, 8256 }, { 6722, 13405 },
+ { 4198, 21600 }, { 10797, 16580 }, { 17401, 21600 }, { 14878, 13405 },
+ { 21600, 8256 }, { 13321, 8256 }, { 10797, 0 }
+};
+static const SvxMSDffTextRectangles mso_sptStarTextRect[] =
+{
+ { { 6722, 8256 }, { 14878, 15460 } }
+};
+static const mso_CustomShape msoStar =
+{
+ (SvxMSDffVertPair*)mso_sptStarVert, sizeof( mso_sptStarVert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptStarTextRect, sizeof( mso_sptStarTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ NULL, 0 // handles
+};
+
+static const SvxMSDffCalculationData mso_sptSeal24Calc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, // 0x00
+ { 0x2081, { 0x400, 10800, 315 } }, // 0x01 ( textframe )
+ { 0x2082, { 0x400, 10800, 315 } }, // 0x02
+ { 0x2081, { 0x400, 10800, 135 } }, // 0x03
+ { 0x2082, { 0x400, 10800, 135 } }, // 0x04
+ { 0x0081, { 0, 10800, 0 } },
+ { 0x0082, { 0, 10800, 0 } },
+ { 0x2081, { 0x400, 10800, 7 } },
+ { 0x2082, { 0x400, 10800, 7 } },
+ { 0x0081, { 0, 10800, 15 } },
+ { 0x0082, { 0, 10800, 15 } },
+ { 0x2081, { 0x400, 10800, 22 } },
+ { 0x2082, { 0x400, 10800, 22 } },
+ { 0x0081, { 0, 10800, 30 } },
+ { 0x0082, { 0, 10800, 30 } },
+ { 0x2081, { 0x400, 10800, 37 } },
+ { 0x2082, { 0x400, 10800, 37 } },
+ { 0x0081, { 0, 10800, 45 } },
+ { 0x0082, { 0, 10800, 45 } },
+ { 0x2081, { 0x400, 10800, 52 } },
+ { 0x2082, { 0x400, 10800, 52 } },
+ { 0x0081, { 0, 10800, 60 } },
+ { 0x0082, { 0, 10800, 60 } },
+ { 0x2081, { 0x400, 10800, 67 } },
+ { 0x2082, { 0x400, 10800, 67 } },
+ { 0x0081, { 0, 10800, 75 } },
+ { 0x0082, { 0, 10800, 75 } },
+ { 0x2081, { 0x400, 10800, 82 } },
+ { 0x2082, { 0x400, 10800, 82 } },
+ { 0x0081, { 0, 10800, 90 } },
+ { 0x0082, { 0, 10800, 90 } },
+ { 0x2081, { 0x400, 10800, 97 } },
+ { 0x2082, { 0x400, 10800, 97 } },
+ { 0x0081, { 0, 10800, 105 } },
+ { 0x0082, { 0, 10800, 105 } },
+ { 0x2081, { 0x400, 10800, 112 } },
+ { 0x2082, { 0x400, 10800, 112 } },
+ { 0x0081, { 0, 10800, 120 } },
+ { 0x0082, { 0, 10800, 120 } },
+ { 0x2081, { 0x400, 10800, 127 } },
+ { 0x2082, { 0x400, 10800, 127 } },
+ { 0x0081, { 0, 10800, 135 } },
+ { 0x0082, { 0, 10800, 135 } },
+ { 0x2081, { 0x400, 10800, 142 } },
+ { 0x2082, { 0x400, 10800, 142 } },
+ { 0x0081, { 0, 10800, 150 } },
+ { 0x0082, { 0, 10800, 150 } },
+ { 0x2081, { 0x400, 10800, 157 } },
+ { 0x2082, { 0x400, 10800, 157 } },
+ { 0x0081, { 0, 10800, 165 } },
+ { 0x0082, { 0, 10800, 165 } },
+ { 0x2081, { 0x400, 10800, 172 } },
+ { 0x2082, { 0x400, 10800, 172 } },
+ { 0x0081, { 0, 10800, 180 } },
+ { 0x0082, { 0, 10800, 180 } },
+ { 0x2081, { 0x400, 10800, 187 } },
+ { 0x2082, { 0x400, 10800, 187 } },
+ { 0x0081, { 0, 10800, 195 } },
+ { 0x0082, { 0, 10800, 195 } },
+ { 0x2081, { 0x400, 10800, 202 } },
+ { 0x2082, { 0x400, 10800, 202 } },
+ { 0x0081, { 0, 10800, 210 } },
+ { 0x0082, { 0, 10800, 210 } },
+ { 0x2081, { 0x400, 10800, 217 } },
+ { 0x2082, { 0x400, 10800, 217 } },
+ { 0x0081, { 0, 10800, 225 } },
+ { 0x0082, { 0, 10800, 225 } },
+ { 0x2081, { 0x400, 10800, 232 } },
+ { 0x2082, { 0x400, 10800, 232 } },
+ { 0x0081, { 0, 10800, 240 } },
+ { 0x0082, { 0, 10800, 240 } },
+ { 0x2081, { 0x400, 10800, 247 } },
+ { 0x2082, { 0x400, 10800, 247 } },
+ { 0x0081, { 0, 10800, 255 } },
+ { 0x0082, { 0, 10800, 255 } },
+ { 0x2081, { 0x400, 10800, 262 } },
+ { 0x2082, { 0x400, 10800, 262 } },
+ { 0x0081, { 0, 10800, 270 } },
+ { 0x0082, { 0, 10800, 270 } },
+ { 0x2081, { 0x400, 10800, 277 } },
+ { 0x2082, { 0x400, 10800, 277 } },
+ { 0x0081, { 0, 10800, 285 } },
+ { 0x0082, { 0, 10800, 285 } },
+ { 0x2081, { 0x400, 10800, 292 } },
+ { 0x2082, { 0x400, 10800, 292 } },
+ { 0x0081, { 0, 10800, 300 } },
+ { 0x0082, { 0, 10800, 300 } },
+ { 0x2081, { 0x400, 10800, 307 } },
+ { 0x2082, { 0x400, 10800, 307 } },
+ { 0x0081, { 0, 10800, 315 } },
+ { 0x0082, { 0, 10800, 315 } },
+ { 0x2081, { 0x400, 10800, 322 } },
+ { 0x2082, { 0x400, 10800, 322 } },
+ { 0x0081, { 0, 10800, 330 } },
+ { 0x0082, { 0, 10800, 330 } },
+ { 0x2081, { 0x400, 10800, 337 } },
+ { 0x2082, { 0x400, 10800, 337 } },
+ { 0x0081, { 0, 10800, 345 } },
+ { 0x0082, { 0, 10800, 345 } },
+ { 0x2081, { 0x400, 10800, 352 } },
+ { 0x2082, { 0x400, 10800, 352 } }
+};
+static const SvxMSDffVertPair mso_sptSeal8Vert[] = // adj value 0 -> 10800
+{
+ { 5 MSO_I, 6 MSO_I }, { 11 MSO_I, 12 MSO_I }, { 17 MSO_I, 18 MSO_I }, { 23 MSO_I, 24 MSO_I },
+ { 29 MSO_I, 30 MSO_I }, { 35 MSO_I, 36 MSO_I }, { 41 MSO_I, 42 MSO_I }, { 47 MSO_I, 48 MSO_I },
+ { 53 MSO_I, 54 MSO_I }, { 59 MSO_I, 60 MSO_I }, { 65 MSO_I, 66 MSO_I }, { 71 MSO_I, 72 MSO_I },
+ { 77 MSO_I, 78 MSO_I }, { 83 MSO_I, 84 MSO_I }, { 89 MSO_I, 90 MSO_I }, { 95 MSO_I, 96 MSO_I },
+ { 5 MSO_I, 6 MSO_I }
+};
+static const SvxMSDffTextRectangles mso_sptSealTextRect[] =
+{
+ { { 1 MSO_I, 2 MSO_I }, { 3 MSO_I, 4 MSO_I } }
+};
+static const mso_CustomShape msoSeal8 =
+{
+ (SvxMSDffVertPair*)mso_sptSeal8Vert, sizeof( mso_sptSeal8Vert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ (SvxMSDffCalculationData*)mso_sptSeal24Calc, sizeof( mso_sptSeal24Calc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault2500,
+ (SvxMSDffTextRectangles*)mso_sptSealTextRect, sizeof( mso_sptSealTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptSealHandle, sizeof( mso_sptSealHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+static const SvxMSDffVertPair mso_sptSeal16Vert[] = // adj value 0 -> 10800
+{
+ { 0x05 MSO_I, 0x06 MSO_I }, { 0x07 MSO_I, 0x08 MSO_I }, { 0x09 MSO_I, 0x0a MSO_I }, { 0x0b MSO_I, 0x0c MSO_I },
+ { 0x0d MSO_I, 0x0e MSO_I }, { 0x0f MSO_I, 0x10 MSO_I }, { 0x11 MSO_I, 0x12 MSO_I }, { 0x13 MSO_I, 0x14 MSO_I },
+ { 0x15 MSO_I, 0x16 MSO_I }, { 0x17 MSO_I, 0x18 MSO_I }, { 0x19 MSO_I, 0x1a MSO_I }, { 0x1b MSO_I, 0x1c MSO_I },
+ { 0x1d MSO_I, 0x1e MSO_I }, { 0x1f MSO_I, 0x20 MSO_I }, { 0x21 MSO_I, 0x22 MSO_I }, { 0x23 MSO_I, 0x24 MSO_I },
+ { 0x25 MSO_I, 0x26 MSO_I }, { 0x27 MSO_I, 0x28 MSO_I }, { 0x29 MSO_I, 0x2a MSO_I }, { 0x2b MSO_I, 0x2c MSO_I },
+ { 0x2d MSO_I, 0x2e MSO_I }, { 0x2f MSO_I, 0x30 MSO_I }, { 0x31 MSO_I, 0x32 MSO_I }, { 0x33 MSO_I, 0x34 MSO_I },
+ { 0x35 MSO_I, 0x36 MSO_I }, { 0x37 MSO_I, 0x38 MSO_I }, { 0x39 MSO_I, 0x3a MSO_I }, { 0x3b MSO_I, 0x3c MSO_I },
+ { 0x3d MSO_I, 0x3e MSO_I }, { 0x3f MSO_I, 0x40 MSO_I }, { 0x41 MSO_I, 0x42 MSO_I }, { 0x43 MSO_I, 0x44 MSO_I },
+ { 0x05 MSO_I, 0x06 MSO_I }
+};
+static const SvxMSDffCalculationData mso_sptSeal16Calc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, // 0x00
+ { 0x2081, { 0x400, 10800, 315 } }, // 0x01 ( textframe )
+ { 0x2082, { 0x400, 10800, 315 } }, // 0x02
+ { 0x2081, { 0x400, 10800, 135 } }, // 0x03
+ { 0x2082, { 0x400, 10800, 135 } }, // 0x04
+ { 0x0081, { 0, 10800, 0 } },
+ { 0x0082, { 0, 10800, 0 } },
+ { 0x2081, { 0x400, 10800, 11 } },
+ { 0x2082, { 0x400, 10800, 11 } },
+ { 0x0081, { 0, 10800, 22 } },
+ { 0x0082, { 0, 10800, 22 } },
+ { 0x2081, { 0x400, 10800, 33 } },
+ { 0x2082, { 0x400, 10800, 33 } },
+ { 0x0081, { 0, 10800, 45 } },
+ { 0x0082, { 0, 10800, 45 } },
+ { 0x2081, { 0x400, 10800, 56 } },
+ { 0x2082, { 0x400, 10800, 56 } },
+ { 0x0081, { 0, 10800, 67 } },
+ { 0x0082, { 0, 10800, 67 } },
+ { 0x2081, { 0x400, 10800, 78 } },
+ { 0x2082, { 0x400, 10800, 78 } },
+ { 0x0081, { 0, 10800, 90 } },
+ { 0x0082, { 0, 10800, 90 } },
+ { 0x2081, { 0x400, 10800, 101 } },
+ { 0x2082, { 0x400, 10800, 101 } },
+ { 0x0081, { 0, 10800, 112 } },
+ { 0x0082, { 0, 10800, 112 } },
+ { 0x2081, { 0x400, 10800, 123 } },
+ { 0x2082, { 0x400, 10800, 123 } },
+ { 0x0081, { 0, 10800, 135 } },
+ { 0x0082, { 0, 10800, 135 } },
+ { 0x2081, { 0x400, 10800, 146 } },
+ { 0x2082, { 0x400, 10800, 146 } },
+ { 0x0081, { 0, 10800, 157 } },
+ { 0x0082, { 0, 10800, 157 } },
+ { 0x2081, { 0x400, 10800, 168 } },
+ { 0x2082, { 0x400, 10800, 168 } },
+ { 0x0081, { 0, 10800, 180 } },
+ { 0x0082, { 0, 10800, 180 } },
+ { 0x2081, { 0x400, 10800, 191 } },
+ { 0x2082, { 0x400, 10800, 191 } },
+ { 0x0081, { 0, 10800, 202 } },
+ { 0x0082, { 0, 10800, 202 } },
+ { 0x2081, { 0x400, 10800, 213 } },
+ { 0x2082, { 0x400, 10800, 213 } },
+ { 0x0081, { 0, 10800, 225 } },
+ { 0x0082, { 0, 10800, 225 } },
+ { 0x2081, { 0x400, 10800, 236 } },
+ { 0x2082, { 0x400, 10800, 236 } },
+ { 0x0081, { 0, 10800, 247 } },
+ { 0x0082, { 0, 10800, 247 } },
+ { 0x2081, { 0x400, 10800, 258 } },
+ { 0x2082, { 0x400, 10800, 258 } },
+ { 0x0081, { 0, 10800, 270 } },
+ { 0x0082, { 0, 10800, 270 } },
+ { 0x2081, { 0x400, 10800, 281 } },
+ { 0x2082, { 0x400, 10800, 281 } },
+ { 0x0081, { 0, 10800, 292 } },
+ { 0x0082, { 0, 10800, 292 } },
+ { 0x2081, { 0x400, 10800, 303 } },
+ { 0x2082, { 0x400, 10800, 303 } },
+ { 0x0081, { 0, 10800, 315 } },
+ { 0x0082, { 0, 10800, 315 } },
+ { 0x2081, { 0x400, 10800, 326 } },
+ { 0x2082, { 0x400, 10800, 326 } },
+ { 0x0081, { 0, 10800, 337 } },
+ { 0x0082, { 0, 10800, 337 } },
+ { 0x2081, { 0x400, 10800, 348 } },
+ { 0x2082, { 0x400, 10800, 348 } }
+};
+static const mso_CustomShape msoSeal16 =
+{
+ (SvxMSDffVertPair*)mso_sptSeal16Vert, sizeof( mso_sptSeal16Vert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ (SvxMSDffCalculationData*)mso_sptSeal16Calc, sizeof( mso_sptSeal16Calc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault2500,
+ (SvxMSDffTextRectangles*)mso_sptSealTextRect, sizeof( mso_sptSealTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptSealHandle, sizeof( mso_sptSealHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+static const SvxMSDffVertPair mso_sptSeal24Vert[] =
+{
+ { 0x05 MSO_I, 0x06 MSO_I }, { 0x07 MSO_I, 0x08 MSO_I }, { 0x09 MSO_I, 0x0a MSO_I }, { 0x0b MSO_I, 0x0c MSO_I },
+ { 0x0d MSO_I, 0x0e MSO_I }, { 0x0f MSO_I, 0x10 MSO_I }, { 0x11 MSO_I, 0x12 MSO_I }, { 0x13 MSO_I, 0x14 MSO_I },
+ { 0x15 MSO_I, 0x16 MSO_I }, { 0x17 MSO_I, 0x18 MSO_I }, { 0x19 MSO_I, 0x1a MSO_I }, { 0x1b MSO_I, 0x1c MSO_I },
+ { 0x1d MSO_I, 0x1e MSO_I }, { 0x1f MSO_I, 0x20 MSO_I }, { 0x21 MSO_I, 0x22 MSO_I }, { 0x23 MSO_I, 0x24 MSO_I },
+ { 0x25 MSO_I, 0x26 MSO_I }, { 0x27 MSO_I, 0x28 MSO_I }, { 0x29 MSO_I, 0x2a MSO_I }, { 0x2b MSO_I, 0x2c MSO_I },
+ { 0x2d MSO_I, 0x2e MSO_I }, { 0x2f MSO_I, 0x30 MSO_I }, { 0x31 MSO_I, 0x32 MSO_I }, { 0x33 MSO_I, 0x34 MSO_I },
+ { 0x35 MSO_I, 0x36 MSO_I }, { 0x37 MSO_I, 0x38 MSO_I }, { 0x39 MSO_I, 0x3a MSO_I }, { 0x3b MSO_I, 0x3c MSO_I },
+ { 0x3d MSO_I, 0x3e MSO_I }, { 0x3f MSO_I, 0x40 MSO_I }, { 0x41 MSO_I, 0x42 MSO_I }, { 0x43 MSO_I, 0x44 MSO_I },
+ { 0x45 MSO_I, 0x46 MSO_I }, { 0x47 MSO_I, 0x48 MSO_I }, { 0x49 MSO_I, 0x4a MSO_I }, { 0x4b MSO_I, 0x4c MSO_I },
+ { 0x4d MSO_I, 0x4e MSO_I }, { 0x4f MSO_I, 0x50 MSO_I }, { 0x51 MSO_I, 0x52 MSO_I }, { 0x53 MSO_I, 0x54 MSO_I },
+ { 0x55 MSO_I, 0x56 MSO_I }, { 0x57 MSO_I, 0x58 MSO_I }, { 0x59 MSO_I, 0x5a MSO_I }, { 0x5b MSO_I, 0x5c MSO_I },
+ { 0x5d MSO_I, 0x5e MSO_I }, { 0x5f MSO_I, 0x60 MSO_I }, { 0x61 MSO_I, 0x62 MSO_I }, { 0x63 MSO_I, 0x64 MSO_I },
+ { 0x05 MSO_I, 0x06 MSO_I }
+};
+static const mso_CustomShape msoSeal24 =
+{
+ (SvxMSDffVertPair*)mso_sptSeal24Vert, sizeof( mso_sptSeal24Vert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ (SvxMSDffCalculationData*)mso_sptSeal24Calc, sizeof( mso_sptSeal24Calc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault2500,
+ (SvxMSDffTextRectangles*)mso_sptSealTextRect, sizeof( mso_sptSealTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptSealHandle, sizeof( mso_sptSealHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+static const SvxMSDffCalculationData mso_sptSeal32Calc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, // 0x00
+ { 0x2081, { 0x400, 10800, 315 } }, // 0x01 ( textframe )
+ { 0x2082, { 0x400, 10800, 315 } }, // 0x02
+ { 0x2081, { 0x400, 10800, 135 } }, // 0x03
+ { 0x2082, { 0x400, 10800, 135 } }, // 0x04
+ { 0x0081, { 0, 10800, 0 } },
+ { 0x0082, { 0, 10800, 0 } },
+ { 0x2081, { 0x400, 10800, 5 } },
+ { 0x2082, { 0x400, 10800, 5 } },
+ { 0x0081, { 0, 10800, 11 } },
+ { 0x0082, { 0, 10800, 11 } },
+ { 0x2081, { 0x400, 10800, 16 } },
+ { 0x2082, { 0x400, 10800, 16 } },
+ { 0x0081, { 0, 10800, 22 } },
+ { 0x0082, { 0, 10800, 22 } },
+ { 0x2081, { 0x400, 10800, 28 } },
+ { 0x2082, { 0x400, 10800, 28 } },
+ { 0x0081, { 0, 10800, 33 } },
+ { 0x0082, { 0, 10800, 33 } },
+ { 0x2081, { 0x400, 10800, 39 } },
+ { 0x2082, { 0x400, 10800, 39 } },
+ { 0x0081, { 0, 10800, 45 } },
+ { 0x0082, { 0, 10800, 45 } },
+ { 0x2081, { 0x400, 10800, 50 } },
+ { 0x2082, { 0x400, 10800, 50 } },
+ { 0x0081, { 0, 10800, 56 } },
+ { 0x0082, { 0, 10800, 56 } },
+ { 0x2081, { 0x400, 10800, 61 } },
+ { 0x2082, { 0x400, 10800, 61 } },
+ { 0x0081, { 0, 10800, 67 } },
+ { 0x0082, { 0, 10800, 67 } },
+ { 0x2081, { 0x400, 10800, 73 } },
+ { 0x2082, { 0x400, 10800, 73 } },
+ { 0x0081, { 0, 10800, 78 } },
+ { 0x0082, { 0, 10800, 78 } },
+ { 0x2081, { 0x400, 10800, 84 } },
+ { 0x2082, { 0x400, 10800, 84 } },
+ { 0x0081, { 0, 10800, 90 } },
+ { 0x0082, { 0, 10800, 90 } },
+ { 0x2081, { 0x400, 10800, 95 } },
+ { 0x2082, { 0x400, 10800, 95 } },
+ { 0x0081, { 0, 10800, 101 } },
+ { 0x0082, { 0, 10800, 101 } },
+ { 0x2081, { 0x400, 10800, 106 } },
+ { 0x2082, { 0x400, 10800, 106 } },
+ { 0x0081, { 0, 10800, 112 } },
+ { 0x0082, { 0, 10800, 112 } },
+ { 0x2081, { 0x400, 10800, 118 } },
+ { 0x2082, { 0x400, 10800, 118 } },
+ { 0x0081, { 0, 10800, 123 } },
+ { 0x0082, { 0, 10800, 123 } },
+ { 0x2081, { 0x400, 10800, 129 } },
+ { 0x2082, { 0x400, 10800, 129 } },
+ { 0x0081, { 0, 10800, 135 } },
+ { 0x0082, { 0, 10800, 135 } },
+ { 0x2081, { 0x400, 10800, 140 } },
+ { 0x2082, { 0x400, 10800, 140 } },
+ { 0x0081, { 0, 10800, 146 } },
+ { 0x0082, { 0, 10800, 146 } },
+ { 0x2081, { 0x400, 10800, 151 } },
+ { 0x2082, { 0x400, 10800, 151 } },
+ { 0x0081, { 0, 10800, 157 } },
+ { 0x0082, { 0, 10800, 157 } },
+ { 0x2081, { 0x400, 10800, 163 } },
+ { 0x2082, { 0x400, 10800, 163 } },
+ { 0x0081, { 0, 10800, 168 } },
+ { 0x0082, { 0, 10800, 168 } },
+ { 0x2081, { 0x400, 10800, 174 } },
+ { 0x2082, { 0x400, 10800, 174 } },
+ { 0x0081, { 0, 10800, 180 } },
+ { 0x0082, { 0, 10800, 180 } },
+ { 0x2081, { 0x400, 10800, 185 } },
+ { 0x2082, { 0x400, 10800, 185 } },
+ { 0x0081, { 0, 10800, 191 } },
+ { 0x0082, { 0, 10800, 191 } },
+ { 0x2081, { 0x400, 10800, 196 } },
+ { 0x2082, { 0x400, 10800, 196 } },
+ { 0x0081, { 0, 10800, 202 } },
+ { 0x0082, { 0, 10800, 202 } },
+ { 0x2081, { 0x400, 10800, 208 } },
+ { 0x2082, { 0x400, 10800, 208 } },
+ { 0x0081, { 0, 10800, 213 } },
+ { 0x0082, { 0, 10800, 213 } },
+ { 0x2081, { 0x400, 10800, 219 } },
+ { 0x2082, { 0x400, 10800, 219 } },
+ { 0x0081, { 0, 10800, 225 } },
+ { 0x0082, { 0, 10800, 225 } },
+ { 0x2081, { 0x400, 10800, 230 } },
+ { 0x2082, { 0x400, 10800, 230 } },
+ { 0x0081, { 0, 10800, 236 } },
+ { 0x0082, { 0, 10800, 236 } },
+ { 0x2081, { 0x400, 10800, 241 } },
+ { 0x2082, { 0x400, 10800, 241 } },
+ { 0x0081, { 0, 10800, 247 } },
+ { 0x0082, { 0, 10800, 247 } },
+ { 0x2081, { 0x400, 10800, 253 } },
+ { 0x2082, { 0x400, 10800, 253 } },
+ { 0x0081, { 0, 10800, 258 } },
+ { 0x0082, { 0, 10800, 258 } },
+ { 0x2081, { 0x400, 10800, 264 } },
+ { 0x2082, { 0x400, 10800, 264 } },
+ { 0x0081, { 0, 10800, 270 } },
+ { 0x0082, { 0, 10800, 270 } },
+ { 0x2081, { 0x400, 10800, 275 } },
+ { 0x2082, { 0x400, 10800, 275 } },
+ { 0x0081, { 0, 10800, 281 } },
+ { 0x0082, { 0, 10800, 281 } },
+ { 0x2081, { 0x400, 10800, 286 } },
+ { 0x2082, { 0x400, 10800, 286 } },
+ { 0x0081, { 0, 10800, 292 } },
+ { 0x0082, { 0, 10800, 292 } },
+ { 0x2081, { 0x400, 10800, 298 } },
+ { 0x2082, { 0x400, 10800, 298 } },
+ { 0x0081, { 0, 10800, 303 } },
+ { 0x0082, { 0, 10800, 303 } },
+ { 0x2081, { 0x400, 10800, 309 } },
+ { 0x2082, { 0x400, 10800, 309 } },
+ { 0x0081, { 0, 10800, 315 } },
+ { 0x0082, { 0, 10800, 315 } },
+ { 0x2081, { 0x400, 10800, 320 } },
+ { 0x2082, { 0x400, 10800, 320 } },
+ { 0x0081, { 0, 10800, 326 } },
+ { 0x0082, { 0, 10800, 326 } },
+ { 0x2081, { 0x400, 10800, 331 } },
+ { 0x2082, { 0x400, 10800, 331 } },
+ { 0x0081, { 0, 10800, 337 } },
+ { 0x0082, { 0, 10800, 337 } },
+ { 0x2081, { 0x400, 10800, 343 } },
+ { 0x2082, { 0x400, 10800, 343 } },
+ { 0x0081, { 0, 10800, 348 } },
+ { 0x0082, { 0, 10800, 348 } },
+ { 0x2081, { 0x400, 10800, 354 } },
+ { 0x2082, { 0x400, 10800, 354 } }
+};
+static const SvxMSDffVertPair mso_sptSeal32Vert[] =
+{
+ { 0x05 MSO_I, 0x06 MSO_I }, { 0x07 MSO_I, 0x08 MSO_I }, { 0x09 MSO_I, 0x0a MSO_I }, { 0x0b MSO_I, 0x0c MSO_I },
+ { 0x0d MSO_I, 0x0e MSO_I }, { 0x0f MSO_I, 0x10 MSO_I }, { 0x11 MSO_I, 0x12 MSO_I }, { 0x13 MSO_I, 0x14 MSO_I },
+ { 0x15 MSO_I, 0x16 MSO_I }, { 0x17 MSO_I, 0x18 MSO_I }, { 0x19 MSO_I, 0x1a MSO_I }, { 0x1b MSO_I, 0x1c MSO_I },
+ { 0x1d MSO_I, 0x1e MSO_I }, { 0x1f MSO_I, 0x20 MSO_I }, { 0x21 MSO_I, 0x22 MSO_I }, { 0x23 MSO_I, 0x24 MSO_I },
+ { 0x25 MSO_I, 0x26 MSO_I }, { 0x27 MSO_I, 0x28 MSO_I }, { 0x29 MSO_I, 0x2a MSO_I }, { 0x2b MSO_I, 0x2c MSO_I },
+ { 0x2d MSO_I, 0x2e MSO_I }, { 0x2f MSO_I, 0x30 MSO_I }, { 0x31 MSO_I, 0x32 MSO_I }, { 0x33 MSO_I, 0x34 MSO_I },
+ { 0x35 MSO_I, 0x36 MSO_I }, { 0x37 MSO_I, 0x38 MSO_I }, { 0x39 MSO_I, 0x3a MSO_I }, { 0x3b MSO_I, 0x3c MSO_I },
+ { 0x3d MSO_I, 0x3e MSO_I }, { 0x3f MSO_I, 0x40 MSO_I }, { 0x41 MSO_I, 0x42 MSO_I }, { 0x43 MSO_I, 0x44 MSO_I },
+ { 0x45 MSO_I, 0x46 MSO_I }, { 0x47 MSO_I, 0x48 MSO_I }, { 0x49 MSO_I, 0x4a MSO_I }, { 0x4b MSO_I, 0x4c MSO_I },
+ { 0x4d MSO_I, 0x4e MSO_I }, { 0x4f MSO_I, 0x50 MSO_I }, { 0x51 MSO_I, 0x52 MSO_I }, { 0x53 MSO_I, 0x54 MSO_I },
+ { 0x55 MSO_I, 0x56 MSO_I }, { 0x57 MSO_I, 0x58 MSO_I }, { 0x59 MSO_I, 0x5a MSO_I }, { 0x5b MSO_I, 0x5c MSO_I },
+ { 0x5d MSO_I, 0x5e MSO_I }, { 0x5f MSO_I, 0x60 MSO_I }, { 0x61 MSO_I, 0x62 MSO_I }, { 0x63 MSO_I, 0x64 MSO_I },
+ { 0x65 MSO_I, 0x66 MSO_I }, { 0x67 MSO_I, 0x68 MSO_I }, { 0x69 MSO_I, 0x6a MSO_I }, { 0x6b MSO_I, 0x6c MSO_I },
+ { 0x6d MSO_I, 0x6e MSO_I }, { 0x6f MSO_I, 0x70 MSO_I }, { 0x71 MSO_I, 0x72 MSO_I }, { 0x73 MSO_I, 0x74 MSO_I },
+ { 0x75 MSO_I, 0x76 MSO_I }, { 0x77 MSO_I, 0x78 MSO_I }, { 0x79 MSO_I, 0x7a MSO_I }, { 0x7b MSO_I, 0x7c MSO_I },
+ { 0x7d MSO_I, 0x7e MSO_I }, { 0x7f MSO_I, 0x80 MSO_I }, { 0x81 MSO_I, 0x82 MSO_I }, { 0x83 MSO_I, 0x84 MSO_I },
+ { 0x05 MSO_I, 0x06 MSO_I }
+};
+static const mso_CustomShape msoSeal32 =
+{
+ (SvxMSDffVertPair*)mso_sptSeal32Vert, sizeof( mso_sptSeal32Vert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ (SvxMSDffCalculationData*)mso_sptSeal32Calc, sizeof( mso_sptSeal32Calc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault2500,
+ (SvxMSDffTextRectangles*)mso_sptSealTextRect, sizeof( mso_sptSealTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptSealHandle, sizeof( mso_sptSealHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptRibbon2Vert[] = // adjustment1 : x 2700 - 8100 def 5400
+{ // adjustment2 : y 14400 - 21600 def 18900
+ { 12 MSO_I, 1 MSO_I }, { 12 MSO_I, 13 MSO_I }, // pp
+ { 12 MSO_I, 14 MSO_I }, { 15 MSO_I, 21600 }, { 16 MSO_I, 21600 }, // ccp
+ { 0, 21600 }, { 2750, 7 MSO_I }, { 0, 2 MSO_I }, { 0 MSO_I, 2 MSO_I }, // pppp
+ { 0 MSO_I, 4 MSO_I }, // p
+ { 0 MSO_I, 5 MSO_I }, { 10 MSO_I, 0 }, { 11 MSO_I, 0 }, // ccp
+ { 17 MSO_I, 0 }, // p
+ { 18 MSO_I, 0 }, { 19 MSO_I, 5 MSO_I }, { 19 MSO_I, 4 MSO_I }, // ccp
+ { 19 MSO_I, 2 MSO_I }, { 21600, 2 MSO_I }, { 18850, 7 MSO_I }, { 21600, 21600 }, // pppp
+ { 20 MSO_I, 21600 }, // p
+ { 21 MSO_I, 21600 }, { 22 MSO_I, 14 MSO_I }, { 22 MSO_I, 13 MSO_I }, // ccp
+ { 22 MSO_I, 1 MSO_I }, { 12 MSO_I, 1 MSO_I }, { 12 MSO_I, 13 MSO_I }, // ppp
+ { 12 MSO_I, 23 MSO_I }, { 15 MSO_I, 24 MSO_I }, { 16 MSO_I, 24 MSO_I }, // ccp
+ { 11 MSO_I, 24 MSO_I }, // p
+ { 10 MSO_I, 24 MSO_I }, { 0 MSO_I, 26 MSO_I }, { 0 MSO_I, 25 MSO_I }, // ccp
+ { 0 MSO_I, 27 MSO_I }, { 10 MSO_I, 1 MSO_I }, { 11 MSO_I, 1 MSO_I }, // ccp
+
+ { 22 MSO_I, 1 MSO_I }, { 22 MSO_I, 13 MSO_I }, // pp
+ { 22 MSO_I, 23 MSO_I }, { 21 MSO_I, 24 MSO_I }, { 20 MSO_I, 24 MSO_I }, // ccp
+ { 17 MSO_I, 24 MSO_I }, // p
+ { 18 MSO_I, 24 MSO_I }, { 19 MSO_I, 26 MSO_I }, { 19 MSO_I, 25 MSO_I }, // ccp
+ { 19 MSO_I, 27 MSO_I }, { 18 MSO_I, 1 MSO_I }, { 17 MSO_I, 1 MSO_I }, // ccp
+
+ { 0 MSO_I, 25 MSO_I }, { 0 MSO_I, 2 MSO_I }, // pp
+
+ { 19 MSO_I, 25 MSO_I }, { 19 MSO_I, 2 MSO_I } // pp
+};
+static const sal_uInt16 mso_sptRibbon2Segm[] =
+{
+ 0x4000, 0x0001, 0x2001, 0x0005, 0x2001, 0x0001, 0x2001, 0x0005, 0x2001, 0x0001, 0x6001, 0x8000,
+ 0x4000, 0x0001, 0x2001, 0x0001, 0x2002, 0x6001, 0x8000,
+ 0x4000, 0x0001, 0x2001, 0x0001, 0x2002, 0x6001, 0x8000,
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x0001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptRibbon2Calc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, // 00
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } }, // 01
+ { 0x8000, { 21600, 0, 0x401 } }, // 02
+ { 0x2001, { 0x402, 1, 2 } }, // 03
+ { 0x2001, { 0x403, 1, 2 } }, // 04
+ { 0x2001, { 0x404, 1, 2 } }, // 05
+ { 0x2001, { 0x401, 1, 2 } }, // 06
+ { 0x8000, { 21600, 0, 0x406 } }, // 07
+ { 0x0000, { 420, 0, 0 } }, // 08
+ { 0x2001, { 0x408, 2, 1 } }, // 09
+ { 0x6000, { 0x400, 0x408, 0 } }, // 10
+ { 0x6000, { 0x400, 0x409, 0 } }, // 11
+ { 0x2000, { 0x400, 2700, 0 } }, // 12
+ { 0x8000, { 21600, 0, 0x404 } }, // 13
+ { 0x8000, { 21600, 0, 0x405 } }, // 14
+ { 0xa000, { 0x40c, 0, 0x408 } }, // 15
+ { 0xa000, { 0x40c, 0, 0x409 } }, // 16
+
+ { 0x8000, { 21600, 0, 0x40b } }, // 17
+ { 0x8000, { 21600, 0, 0x40a } }, // 18
+ { 0x8000, { 21600, 0, 0x400 } }, // 19
+ { 0x8000, { 21600, 0, 0x410 } }, // 20
+ { 0x8000, { 21600, 0, 0x40f } }, // 21
+ { 0x8000, { 21600, 0, 0x40c } }, // 22
+
+ { 0xa000, { 0x40d, 0, 0x405 } }, // 23
+ { 0x6000, { 0x401, 0x403, 0 } }, // 24
+ { 0x6000, { 0x401, 0x404, 0 } }, // 25
+ { 0x6000, { 0x419, 0x405, 0 } }, // 26
+ { 0xa000, { 0x419, 0, 0x405 } } // 27
+};
+static const sal_Int32 mso_sptRibbon2Default[] =
+{
+ 2, 5400, 18900
+};
+static const SvxMSDffTextRectangles mso_sptRibbon2TextRect[] =
+{
+ { { 0 MSO_I, 0 }, { 19 MSO_I, 1 MSO_I } }
+};
+static const SvxMSDffHandle mso_sptRibbon2Handle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 0, 10800, 10800, 2700, 8100, 0x80000000, 0x7fffffff },
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 10800, 0x101, 10800, 10800, 0x80000000, 0x7fffffff, 14400, 21600 }
+};
+static const mso_CustomShape msoRibbon2 =
+{
+ (SvxMSDffVertPair*)mso_sptRibbon2Vert, sizeof( mso_sptRibbon2Vert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptRibbon2Segm, sizeof( mso_sptRibbon2Segm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptRibbon2Calc, sizeof( mso_sptRibbon2Calc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptRibbon2Default,
+ (SvxMSDffTextRectangles*)mso_sptRibbon2TextRect, sizeof( mso_sptRibbon2TextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptRibbon2Handle, sizeof( mso_sptRibbon2Handle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptRibbonVert[] =
+{
+ { 0, 0 }, { 3 MSO_I, 0 },
+ { 4 MSO_I, 11 MSO_I }, { 4 MSO_I, 10 MSO_I }, { 5 MSO_I, 10 MSO_I }, { 5 MSO_I, 11 MSO_I },
+ { 6 MSO_I, 0 }, { 21600, 0 }, { 18 MSO_I, 14 MSO_I }, { 21600, 15 MSO_I }, { 9 MSO_I, 15 MSO_I }, { 9 MSO_I, 16 MSO_I }, { 8 MSO_I, 21600 }, { 1 MSO_I, 21600 },
+ { 0 MSO_I, 16 MSO_I }, { 0 MSO_I, 15 MSO_I }, { 0, 15 MSO_I }, { 2700, 14 MSO_I },
+
+ { 4 MSO_I, 11 MSO_I },
+ { 3 MSO_I, 12 MSO_I }, { 1 MSO_I, 12 MSO_I },
+ { 0 MSO_I, 13 MSO_I }, { 1 MSO_I, 10 MSO_I }, { 4 MSO_I, 10 MSO_I },
+ { 5 MSO_I, 11 MSO_I },
+ { 6 MSO_I, 12 MSO_I }, { 8 MSO_I, 12 MSO_I },
+ { 9 MSO_I, 13 MSO_I }, { 8 MSO_I, 10 MSO_I }, { 5 MSO_I, 10 MSO_I },
+ { 0 MSO_I, 13 MSO_I },
+ { 0 MSO_I, 15 MSO_I },
+ { 9 MSO_I, 13 MSO_I },
+ { 9 MSO_I, 15 MSO_I }
+};
+static const sal_uInt16 mso_sptRibbonSegm[] =
+{
+ 0x4000, 0x0001, 0xa701, 0x0003, 0xa801, 0x0005, 0xa801, 0x0001, 0xa701, 0x0003, 0x6000, 0x8000,
+ 0x4000, 0xaa00, 0xa801, 0x0001, 0xa702, 0x0001, 0x8000,
+ 0x4000, 0xaa00, 0xa801, 0x0001, 0xa702, 0x0001, 0x8000,
+ 0x4000, 0xaa00, 0x0001, 0x8000,
+ 0x4000, 0xaa00, 0x0001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptRibbonCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, // 00
+ { 0x2000, { 0x400, 675, 0 } }, // 01
+ { 0x2000, { 0x401, 675, 0 } }, // 02
+ { 0x2000, { 0x402, 675, 0 } }, // 03
+ { 0x2000, { 0x403, 675, 0 } }, // 04
+ { 0x8000, { 21600, 0, 0x404 } }, // 05
+ { 0x8000, { 21600, 0, 0x403 } }, // 06
+ { 0x8000, { 21600, 0, 0x402 } }, // 07
+ { 0x8000, { 21600, 0, 0x401 } }, // 08
+ { 0x8000, { 21600, 0, 0x400 } }, // 09
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } }, // 10
+ { 0x2001, { 0x40a, 1, 4 } }, // 11
+ { 0x2001, { 0x40b, 2, 1 } }, // 12
+ { 0x2001, { 0x40b, 3, 1 } }, // 13
+ { 0x8000, { 10800, 0, 0x40c } }, // 14
+ { 0x8000, { 21600, 0, 0x40a } }, // 15
+ { 0x8000, { 21600, 0, 0x40b } }, // 16
+ { 0x0001, { 21600, 1, 2 } }, // 17
+ { 0x0000, { 21600, 0, 2700 } }, // 18
+ { 0x2000, { 0x411, 0, 2700 } } // 19
+};
+static const sal_Int32 mso_sptRibbonDefault[] =
+{
+ 2, 5400, 2700
+};
+static const SvxMSDffTextRectangles mso_sptRibbonTextRect[] =
+{
+ { { 0 MSO_I, 10 MSO_I }, { 9 MSO_I, 21600 } }
+};
+static const SvxMSDffVertPair mso_sptRibbonGluePoints[] =
+{
+ { 17 MSO_I, 10 MSO_I }, { 2700, 14 MSO_I }, { 17 MSO_I, 21600 }, { 18 MSO_I, 14 MSO_I }
+};
+static const SvxMSDffHandle mso_sptRibbonHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 0, 10800, 10800, 2700, 8100, 0x80000000, 0x7fffffff },
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 10800, 0x101, 10800, 10800, 0x80000000, 0x7fffffff, 0, 7200 }
+};
+static const mso_CustomShape msoRibbon =
+{
+ (SvxMSDffVertPair*)mso_sptRibbonVert, sizeof( mso_sptRibbonVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptRibbonSegm, sizeof( mso_sptRibbonSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptRibbonCalc, sizeof( mso_sptRibbonCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptRibbonDefault,
+ (SvxMSDffTextRectangles*)mso_sptRibbonTextRect, sizeof( mso_sptRibbonTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptRibbonGluePoints, sizeof( mso_sptRibbonGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptRibbonHandle, sizeof( mso_sptRibbonHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptVerticalScrollVert[] = // adjustment1 : 0 - 5400
+{
+ { 1 MSO_I, 21600 }, { 0, 11 MSO_I }, { 1 MSO_I, 12 MSO_I }, { 0 MSO_I, 12 MSO_I },
+ { 0 MSO_I, 1 MSO_I }, { 4 MSO_I, 0 }, { 2 MSO_I, 0 }, { 21600, 1 MSO_I },
+ { 2 MSO_I, 0 MSO_I }, { 3 MSO_I, 0 MSO_I }, { 3 MSO_I, 11 MSO_I }, { 5 MSO_I, 21600 },
+
+ { 6 MSO_I, 1 MSO_I }, { 4 MSO_I, 0 MSO_I }, { 8 MSO_I, 9 MSO_I }, { 4 MSO_I, 1 MSO_I },
+
+ { 0 MSO_I, 11 MSO_I }, { 1 MSO_I, 21600 }, { 0, 11 MSO_I }, { 1 MSO_I, 12 MSO_I },
+ { 9 MSO_I, 10 MSO_I }, { 1 MSO_I, 11 MSO_I },
+
+ { 4 MSO_I, 0 }, { 6 MSO_I, 1 MSO_I },
+
+ { 0 MSO_I, 12 MSO_I }, { 0 MSO_I, 11 MSO_I },
+
+ { 4 MSO_I, 0 MSO_I },
+ { 2 MSO_I, 0 MSO_I }
+};
+static const sal_uInt16 mso_sptVerticalScrollSegm[] =
+{
+ 0x4000, 0xa702, 0x0002, 0xa801, 0x0001, 0xa702, 0x0002, 0xa801, 0x6001, 0x8000,
+ 0x4000, 0xa801, 0xa702, 0x6000, 0x8000,
+ 0x4000, 0xa803, 0xa702, 0x6001, 0x8000,
+ 0x4000, 0xa701, 0x8000,
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x0001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptScrollCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x2001, { 0x400, 1, 2 } },
+ { 0xa000, { DFF_Prop_geoRight, 0, 0x401 } },
+ { 0xa000, { DFF_Prop_geoRight, 0, 0x400 } },
+ { 0x6000, { 0x400, 0x401, 0 } },
+ { 0xa000, { DFF_Prop_geoRight, 0, 0x404 } },
+ { 0x2001, { 0x400, 2, 1 } },
+ { 0x2001, { 0x401, 1, 2 } },
+ { 0x6000, { 0x400, 0x407, 0 } },
+ { 0x6000, { 0x401, 0x407, 0 } },
+ { 0xa000, { DFF_Prop_geoBottom, 0, 0x409 } },
+ { 0xa000, { DFF_Prop_geoBottom, 0, 0x401 } },
+ { 0xa000, { DFF_Prop_geoBottom, 0, 0x400 } },
+ { 0xa000, { DFF_Prop_geoBottom, 0, 0x404 } }
+};
+static const SvxMSDffTextRectangles mso_sptScrollTextRect[] =
+{
+ { { 0 MSO_I, 0 MSO_I }, { 3 MSO_I, 12 MSO_I } }
+};
+static const SvxMSDffHandle mso_sptVerticalScrollHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 0, 5400 }
+};
+static const mso_CustomShape msoVerticalScroll =
+{
+ (SvxMSDffVertPair*)mso_sptVerticalScrollVert, sizeof( mso_sptVerticalScrollVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptVerticalScrollSegm, sizeof( mso_sptVerticalScrollSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptScrollCalc, sizeof( mso_sptScrollCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault2700,
+ (SvxMSDffTextRectangles*)mso_sptScrollTextRect, sizeof( mso_sptScrollTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 11000, 10800,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptVerticalScrollHandle, sizeof( mso_sptVerticalScrollHandle ) / sizeof( SvxMSDffHandle )
+};
+static const SvxMSDffVertPair mso_sptHorizontalScrollVert[] = // adjustment1 : 0 - 5400
+{
+ { 0, 4 MSO_I }, { 1 MSO_I, 0 MSO_I }, { 3 MSO_I, 0 MSO_I }, { 3 MSO_I, 1 MSO_I },
+ { 2 MSO_I, 0 }, { 21600, 1 MSO_I }, { 21600, 13 MSO_I }, { 2 MSO_I, 12 MSO_I },
+ { 0 MSO_I, 12 MSO_I }, { 0 MSO_I, 11 MSO_I }, { 1 MSO_I, 21600 }, { 0, 11 MSO_I },
+
+ { 1 MSO_I, 4 MSO_I }, { 9 MSO_I, 8 MSO_I }, { 0 MSO_I, 4 MSO_I }, { 1 MSO_I, 6 MSO_I },
+
+ { 2 MSO_I, 1 MSO_I }, { 3 MSO_I, 9 MSO_I }, { 3 MSO_I, 1 MSO_I }, { 2 MSO_I, 0 },
+ { 21600, 1 MSO_I }, { 2 MSO_I, 0 MSO_I },
+
+ { 1 MSO_I, 6 MSO_I },
+ { 0, 4 MSO_I },
+
+ { 2 MSO_I, 0 MSO_I },
+ { 3 MSO_I, 0 MSO_I },
+
+ { 0 MSO_I, 4 MSO_I },
+ { 0 MSO_I, 11 MSO_I }
+};
+static const sal_uInt16 mso_sptHorizontalScrollSegm[] =
+{
+ 0x4000, 0xa801, 0x0002, 0xa802, 0x0001, 0xa801, 0x0002, 0xa802, 0x6001, 0x8000,
+ 0x4000, 0xa803, 0x6000, 0x8000,
+ 0x4000, 0xa803, 0xa702, 0x6000, 0x8000,
+ 0x4000, 0xa701, 0x8000,
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x0001, 0x8000
+};
+static const SvxMSDffHandle mso_sptHorizontalScrollHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 0, 10800, 10800, 0, 5400, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoHorizontalScroll =
+{
+ (SvxMSDffVertPair*)mso_sptHorizontalScrollVert, sizeof( mso_sptHorizontalScrollVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptHorizontalScrollSegm, sizeof( mso_sptHorizontalScrollSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptScrollCalc, sizeof( mso_sptScrollCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault2700,
+ (SvxMSDffTextRectangles*)mso_sptScrollTextRect, sizeof( mso_sptScrollTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 10800, 11000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptHorizontalScrollHandle, sizeof( mso_sptHorizontalScrollHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartProcessVert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 21600 }, { 0, 21600 }, { 0, 0 }
+};
+static const mso_CustomShape msoFlowChartProcess =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartProcessVert, sizeof( mso_sptFlowChartProcessVert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ NULL, 0,
+ NULL,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptStandardGluePoints, sizeof( mso_sptStandardGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartAlternateProcessVert[] =
+{
+ { 0, 2 MSO_I }, { 0 MSO_I, 0 }, { 1 MSO_I, 0 }, { 21600, 2 MSO_I },
+ { 21600, 3 MSO_I }, { 1 MSO_I, 21600 }, { 0 MSO_I, 21600 }, { 0, 3 MSO_I }
+};
+static const sal_uInt16 mso_sptFlowChartAlternateProcessSegm[] =
+{
+ 0x4000, 0xa801, 0x0001, 0xa701, 0x0001, 0xa801, 0x0001, 0xa701, 0x6000, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptFlowChartAlternateProcessCalc[] =
+{
+ { 0x2000, { DFF_Prop_geoLeft, 2540, 0 } },
+ { 0x2000, { DFF_Prop_geoRight, 0, 2540 } },
+ { 0x2000, { DFF_Prop_geoTop, 2540, 0 } },
+ { 0x2000, { DFF_Prop_geoBottom, 0, 2540 } },
+ { 0x2000, { DFF_Prop_geoLeft, 800, 0 } },
+ { 0x2000, { DFF_Prop_geoRight, 0, 800 } },
+ { 0x2000, { DFF_Prop_geoTop, 800, 0 } },
+ { 0x2000, { DFF_Prop_geoBottom,0, 800 } }
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartAlternateProcessTextRect[] =
+{
+ { { 4 MSO_I, 6 MSO_I }, { 5 MSO_I, 7 MSO_I } }
+};
+static const mso_CustomShape msoFlowChartAlternateProcess =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartAlternateProcessVert, sizeof( mso_sptFlowChartAlternateProcessVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptFlowChartAlternateProcessSegm, sizeof( mso_sptFlowChartAlternateProcessSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptFlowChartAlternateProcessCalc, sizeof( mso_sptFlowChartAlternateProcessCalc ) / sizeof( SvxMSDffCalculationData ),
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartAlternateProcessTextRect, sizeof( mso_sptFlowChartAlternateProcessTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptStandardGluePoints, sizeof( mso_sptStandardGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartDecisionVert[] =
+{
+ { 0, 10800 }, { 10800, 0 }, { 21600, 10800 }, { 10800, 21600 }, { 0, 10800 }
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartDecisionTextRect[] =
+{
+ { { 5400, 5400 }, { 16200, 16200 } }
+};
+static const mso_CustomShape msoFlowChartDecision =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartDecisionVert, sizeof( mso_sptFlowChartDecisionVert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartDecisionTextRect, sizeof( mso_sptFlowChartDecisionTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptStandardGluePoints, sizeof( mso_sptStandardGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartInputOutputVert[] =
+{
+ { 4230, 0 }, { 21600, 0 }, { 17370, 21600 }, { 0, 21600 }, { 4230, 0 }
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartInputOutputTextRect[] =
+{
+ { { 4230, 0 }, { 17370, 21600 } }
+};
+static const SvxMSDffVertPair mso_sptFlowChartInputOutputGluePoints[] =
+{
+ { 12960, 0 }, { 10800, 0 }, { 2160, 10800 }, { 8600, 21600 }, { 10800, 21600 }, { 19400, 10800 }
+};
+static const mso_CustomShape msoFlowChartInputOutput =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartInputOutputVert, sizeof( mso_sptFlowChartInputOutputVert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartInputOutputTextRect, sizeof( mso_sptFlowChartInputOutputTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptFlowChartInputOutputGluePoints, sizeof( mso_sptFlowChartInputOutputGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartPredefinedProcessVert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 21600 }, { 0, 21600 },
+
+ { 2540, 0 }, { 2540, 21600 },
+
+ { 21600 - 2540, 0 }, { 21600 - 2540, 21600 }
+};
+static const sal_uInt16 mso_sptFlowChartPredefinedProcessSegm[] =
+{
+ 0x4000, 0x0003, 0x6000, 0x8000,
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x0001, 0x8000
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartPredefinedProcessTextRect[] =
+{
+ { { 2540, 0 }, { 21600 - 2540, 21600 } }
+};
+static const mso_CustomShape msoFlowChartPredefinedProcess =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartPredefinedProcessVert, sizeof( mso_sptFlowChartPredefinedProcessVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptFlowChartPredefinedProcessSegm, sizeof( mso_sptFlowChartPredefinedProcessSegm ) >> 1,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartPredefinedProcessTextRect, sizeof( mso_sptFlowChartPredefinedProcessTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartInternalStorageVert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 21600 }, { 0, 21600 },
+
+ { 4230, 0 }, { 4230, 21600 },
+
+ { 0, 4230 }, { 21600, 4230 }
+};
+static const sal_uInt16 mso_sptFlowChartInternalStorageSegm[] =
+{
+ 0x4000, 0x0003, 0x6000, 0x8000,
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x0001, 0x8000
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartInternalStorageTextRect[] =
+{
+ { { 4230, 4230 }, { 21600, 21600 } }
+};
+static const mso_CustomShape msoFlowChartInternalStorage =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartInternalStorageVert, sizeof( mso_sptFlowChartInternalStorageVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptFlowChartInternalStorageSegm, sizeof( mso_sptFlowChartInternalStorageSegm ) >> 1,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartInternalStorageTextRect, sizeof( mso_sptFlowChartInternalStorageTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartDocumentVert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 17360 },
+ { 13050, 17220 }, { 13340, 20770 }, { 5620, 21600 }, // ccp
+ { 2860, 21100 }, { 1850, 20700 }, { 0, 20120 } // ccp
+};
+static const sal_uInt16 mso_sptFlowChartDocumentSegm[] =
+{
+ 0x4000, 0x0002, 0x2002, 0x6000, 0x8000
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartDocumentTextRect[] =
+{
+ { { 0, 0 }, { 21600, 17360 } }
+};
+static const SvxMSDffVertPair mso_sptFlowChartDocumentGluePoints[] =
+{
+ { 10800, 0 }, { 0, 10800 }, { 10800, 20320 }, { 21600, 10800 }
+};
+static const mso_CustomShape msoFlowChartDocument =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartDocumentVert, sizeof( mso_sptFlowChartDocumentVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptFlowChartDocumentSegm, sizeof( mso_sptFlowChartDocumentSegm ) >> 1,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartDocumentTextRect, sizeof( mso_sptFlowChartDocumentTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptFlowChartDocumentGluePoints, sizeof( mso_sptFlowChartDocumentGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartMultidocumentVert[] =
+{
+ { 0, 3600 }, { 1500, 3600 }, { 1500, 1800 }, { 3000, 1800 },
+ { 3000, 0 }, { 21600, 0 }, { 21600, 14409 }, { 21600 - 1500, 14409 },
+ { 21600 - 1500, 14409 + 1800 }, { 21600 - 3000, 14409 + 1800 }, { 21600 - 3000, 14409 + 3600 },
+ { 11610, 14293 + 3600 }, { 11472, 17239 + 3600 }, { 4833, 17928 + 3600 }, // ccp
+ { 2450, 17513 + 3600 }, { 1591, 17181 + 3600 }, { 0, 16700 + 3600 }, // ccp
+
+ { 1500, 3600 }, { 21600 - 3000, 3600 }, { 21600 - 3000, 14409 + 1800 },
+
+ { 3000, 1800 }, { 21600 - 1500, 1800 }, { 21600 - 1500, 14409 }
+};
+static const sal_uInt16 mso_sptFlowChartMultidocumentSegm[] =
+{
+ 0x4000, 0x000a, 0x2002, 0x6000, 0x8000,
+ 0x4000, 0xaa00, 0x0002, 0x8000, // NO FILL
+ 0x4000, 0xaa00, 0x0002, 0x8000 // NO FILL
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartMultidocumentTextRect[] =
+{
+ { { 0, 3600 }, { 21600 - 3000, 14409 + 3600 } }
+};
+static const SvxMSDffVertPair mso_sptFlowChartMultidocumentGluePoints[] =
+{
+ { 10800, 0 }, { 0, 10800 }, { 10800, 19890 }, { 21600, 10800 }
+};
+static const mso_CustomShape msoFlowChartMultidocument =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartMultidocumentVert, sizeof( mso_sptFlowChartMultidocumentVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptFlowChartMultidocumentSegm, sizeof( mso_sptFlowChartMultidocumentSegm ) >> 1,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartMultidocumentTextRect, sizeof( mso_sptFlowChartMultidocumentTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptFlowChartMultidocumentGluePoints, sizeof( mso_sptFlowChartMultidocumentGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartTerminatorVert[] =
+{
+ { 3470, 21600 }, { 0, 10800 }, { 3470, 0 }, { 18130, 0 },
+ { 21600, 10800 }, { 18130, 21600 }
+};
+static const sal_uInt16 mso_sptFlowChartTerminatorSegm[] =
+{
+ 0x4000, 0xa702, 0x0001, 0xa702, 0x6000, 0x8000
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartTerminatorTextRect[] =
+{
+ { { 1060, 3180 }, { 20540, 18420 } }
+};
+static const mso_CustomShape msoFlowChartTerminator =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartTerminatorVert, sizeof( mso_sptFlowChartTerminatorVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptFlowChartTerminatorSegm, sizeof( mso_sptFlowChartTerminatorSegm ) >> 1,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartTerminatorTextRect, sizeof( mso_sptFlowChartTerminatorTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptStandardGluePoints, sizeof( mso_sptStandardGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartPreparationVert[] =
+{
+ { 4350, 0 }, { 17250, 0 }, { 21600, 10800 }, { 17250, 21600 },
+ { 4350, 21600 }, { 0, 10800 }, { 4350, 0 }
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartPreparationTextRect[] =
+{
+ { { 4350, 0 }, { 17250, 21600 } }
+};
+static const mso_CustomShape msoFlowChartPreparation =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartPreparationVert, sizeof( mso_sptFlowChartPreparationVert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartPreparationTextRect, sizeof( mso_sptFlowChartPreparationTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptStandardGluePoints, sizeof( mso_sptStandardGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartManualInputVert[] =
+{
+ { 0, 4300 }, { 21600, 0 }, { 21600, 21600 }, { 0, 21600 }, { 0, 4300 }
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartManualInputTextRect[] =
+{
+ { { 0, 4300 }, { 21600, 21600 } }
+};
+static const SvxMSDffVertPair mso_sptFlowChartManualInputGluePoints[] =
+{
+ { 10800, 2150 }, { 0, 10800 }, { 10800, 19890 }, { 21600, 10800 }
+};
+static const mso_CustomShape msoFlowChartManualInput =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartManualInputVert, sizeof( mso_sptFlowChartManualInputVert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartManualInputTextRect, sizeof( mso_sptFlowChartManualInputTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptFlowChartManualInputGluePoints, sizeof( mso_sptFlowChartManualInputGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartManualOperationVert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 17250, 21600 }, { 4350, 21600 }, { 0, 0 }
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartManualOperationTextRect[] =
+{
+ { { 4350, 0 }, { 17250, 21600 } }
+};
+static const SvxMSDffVertPair mso_sptFlowChartManualOperationGluePoints[] =
+{
+ { 10800, 0 }, { 2160, 10800 }, { 10800, 21600 }, { 19440, 10800 }
+};
+static const mso_CustomShape msoFlowChartManualOperation =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartManualOperationVert, sizeof( mso_sptFlowChartManualOperationVert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartManualOperationTextRect, sizeof( mso_sptFlowChartManualOperationTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptFlowChartManualOperationGluePoints, sizeof( mso_sptFlowChartManualOperationGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartConnectorVert[] =
+{
+ { 10800, 10800 }, { 10800, 10800 }, { 0, 360 }
+};
+static const sal_uInt16 mso_sptFlowChartConnectorSegm[] =
+{
+ 0xa203, 0x6000, 0x8000
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartConnectorTextRect[] =
+{
+ { { 3180, 3180 }, { 18420, 18420 } }
+};
+static const mso_CustomShape msoFlowChartConnector =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartConnectorVert, sizeof( mso_sptFlowChartConnectorVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptFlowChartConnectorSegm, sizeof( mso_sptFlowChartConnectorSegm ) >> 1,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartConnectorTextRect, sizeof( mso_sptFlowChartConnectorTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptEllipseGluePoints, sizeof( mso_sptEllipseGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartOffpageConnectorVert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 17150 }, { 10800, 21600 },
+ { 0, 17150 }, { 0, 0 }
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartOffpageConnectorTextRect[] =
+{
+ { { 0, 0 }, { 21600, 17150 } }
+};
+static const mso_CustomShape msoFlowChartOffpageConnector =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartOffpageConnectorVert, sizeof( mso_sptFlowChartOffpageConnectorVert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartOffpageConnectorTextRect, sizeof( mso_sptFlowChartOffpageConnectorTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptStandardGluePoints, sizeof( mso_sptStandardGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartPunchedCardVert[] =
+{
+ { 4300, 0 }, { 21600, 0 }, { 21600, 21600 }, { 0, 21600 },
+ { 0, 4300 }, { 4300, 0 }
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartPunchedCardTextRect[] =
+{
+ { { 0, 4300 }, { 21600, 21600 } }
+};
+static const mso_CustomShape msoFlowChartPunchedCard =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartPunchedCardVert, sizeof( mso_sptFlowChartPunchedCardVert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartPunchedCardTextRect, sizeof( mso_sptFlowChartPunchedCardTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptStandardGluePoints, sizeof( mso_sptStandardGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartPunchedTapeVert[] =
+{
+ { 0, 2230 }, // p
+ { 820, 3990 }, { 3410, 3980 }, { 5370, 4360 }, // ccp
+ { 7430, 4030 }, { 10110, 3890 }, { 10690, 2270 }, // ccp
+ { 11440, 300 }, { 14200, 160 }, { 16150, 0 }, // ccp
+ { 18670, 170 }, { 20690, 390 }, { 21600, 2230 }, // ccp
+ { 21600, 19420 }, // p
+ { 20640, 17510 }, { 18320, 17490 }, { 16140, 17240 }, // ccp
+ { 14710, 17370 }, { 11310, 17510 }, { 10770, 19430 }, // ccp
+ { 10150, 21150 }, { 7380, 21290 }, { 5290, 21600 }, // ccp
+ { 3220, 21250 }, { 610, 21130 }, { 0, 19420 } // ccp
+};
+static const sal_uInt16 mso_sptFlowChartPunchedTapeSegm[] =
+{
+ 0x4000, 0x2004, 0x0001, 0x2004, 0x6000, 0x8000
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartPunchedTapeTextRect[] =
+{
+ { { 0, 4360 }, { 21600, 17240 } }
+};
+static const SvxMSDffVertPair mso_sptFlowChartPunchedTapeGluePoints[] =
+{
+ { 10800, 2020 }, { 0, 10800 }, { 10800, 19320 }, { 21600, 10800 }
+};
+static const mso_CustomShape msoFlowChartPunchedTape =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartPunchedTapeVert, sizeof( mso_sptFlowChartPunchedTapeVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptFlowChartPunchedTapeSegm, sizeof( mso_sptFlowChartPunchedTapeSegm ) >> 1,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartPunchedTapeTextRect, sizeof( mso_sptFlowChartPunchedTapeTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptFlowChartPunchedTapeGluePoints, sizeof( mso_sptFlowChartPunchedTapeGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartSummingJunctionVert[] =
+{
+ { 10800, 10800 }, { 10800, 10800 }, { 0, 360 },
+
+ { 3100, 3100 },
+ { 18500, 18500 },
+
+ { 3100, 18500 },
+ { 18500, 3100 }
+};
+static const sal_uInt16 mso_sptFlowChartSummingJunctionSegm[] =
+{
+ 0xa203, 0x6000, 0x8000,
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x0001, 0x8000
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartSummingJunctionTextRect[] =
+{
+ { { 3100, 3100 }, { 18500, 18500 } }
+};
+static const mso_CustomShape msoFlowChartSummingJunction =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartSummingJunctionVert, sizeof( mso_sptFlowChartSummingJunctionVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptFlowChartSummingJunctionSegm, sizeof( mso_sptFlowChartSummingJunctionSegm ) >> 1,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartSummingJunctionTextRect, sizeof( mso_sptFlowChartSummingJunctionTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptEllipseGluePoints, sizeof( mso_sptEllipseGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartOrVert[] =
+{
+ { 10800, 10800 }, { 10800, 10800 }, { 0, 360 },
+
+ { 0, 10800 }, { 21600, 10800 },
+
+ { 10800, 0 }, { 10800, 21600 }
+};
+static const sal_uInt16 mso_sptFlowChartOrSegm[] =
+{
+ 0xa203, 0x6000, 0x8000,
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x0001, 0x8000
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartOrTextRect[] =
+{
+ { { 3100, 3100 }, { 18500, 18500 } }
+};
+static const mso_CustomShape msoFlowChartOr =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartOrVert, sizeof( mso_sptFlowChartOrVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptFlowChartOrSegm, sizeof( mso_sptFlowChartOrSegm ) >> 1,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartOrTextRect, sizeof( mso_sptFlowChartOrTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptEllipseGluePoints, sizeof( mso_sptEllipseGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartCollateVert[] =
+{
+ { 0, 0 }, { 21600, 21600 }, { 0, 21600 }, { 21600, 0 }, { 0, 0 }
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartCollateTextRect[] =
+{
+ { { 5400, 5400 }, { 16200, 16200 } }
+};
+static const SvxMSDffVertPair mso_sptFlowChartCollateGluePoints[] =
+{
+ { 10800, 0 }, { 10800, 10800 }, { 10800, 21600 }
+};
+static const mso_CustomShape msoFlowChartCollate =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartCollateVert, sizeof( mso_sptFlowChartCollateVert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartCollateTextRect, sizeof( mso_sptFlowChartCollateTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptFlowChartCollateGluePoints, sizeof( mso_sptFlowChartCollateGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartSortVert[] =
+{
+ { 0, 10800 }, { 10800, 0 }, { 21600, 10800 }, { 10800, 21600 },
+
+ { 0, 10800 }, { 21600, 10800 }
+};
+static const sal_uInt16 mso_sptFlowChartSortSegm[] =
+{
+ 0x4000, 0x0003, 0x6000, 0x8000,
+ 0x4000, 0x0001, 0x8000
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartSortTextRect[] =
+{
+ { { 5400, 5400 }, { 16200, 16200 } }
+};
+static const mso_CustomShape msoFlowChartSort =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartSortVert, sizeof( mso_sptFlowChartSortVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptFlowChartSortSegm, sizeof( mso_sptFlowChartSortSegm ) >> 1,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartSortTextRect, sizeof( mso_sptFlowChartSortTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartExtractVert[] =
+{
+ { 10800, 0 }, { 21600, 21600 }, { 0, 21600 }, { 10800, 0 }
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartExtractTextRect[] =
+{
+ { { 5400, 10800 }, { 16200, 21600 } }
+};
+static const SvxMSDffVertPair mso_sptFlowChartExtractGluePoints[] =
+{
+ { 10800, 0 }, { 5400, 10800 }, { 10800, 21600 }, { 16200, 10800 }
+};
+static const mso_CustomShape msoFlowChartExtract =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartExtractVert, sizeof( mso_sptFlowChartExtractVert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartExtractTextRect, sizeof( mso_sptFlowChartExtractTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptFlowChartExtractGluePoints, sizeof( mso_sptFlowChartExtractGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartMergeVert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 10800, 21600 }, { 0, 0 }
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartMergeTextRect[] =
+{
+ { { 5400, 0 }, { 16200, 10800 } }
+};
+static const mso_CustomShape msoFlowChartMerge =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartMergeVert, sizeof( mso_sptFlowChartMergeVert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartMergeTextRect, sizeof( mso_sptFlowChartMergeTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptFlowChartExtractGluePoints, sizeof( mso_sptFlowChartExtractGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartOnlineStorageVert[] =
+{
+ { 3600, 21600 }, { 0, 10800 }, { 3600, 0 }, { 21600, 0 },
+ { 18000, 10800 }, { 21600, 21600 }
+};
+static const sal_uInt16 mso_sptFlowChartOnlineStorageSegm[] =
+{
+ 0x4000, 0xa702, 0x0001, 0xa702, 0x6000, 0x8000
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartOnlineStorageTextRect[] =
+{
+ { { 3600, 0 }, { 18000, 21600 } }
+};
+static const SvxMSDffVertPair mso_sptFlowChartOnlineStorageGluePoints[] =
+{
+ { 10800, 0 }, { 0, 10800 }, { 10800, 21600 }, { 18000, 10800 }
+};
+static const mso_CustomShape msoFlowChartOnlineStorage =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartOnlineStorageVert, sizeof( mso_sptFlowChartOnlineStorageVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptFlowChartOnlineStorageSegm, sizeof( mso_sptFlowChartOnlineStorageSegm ) >> 1,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartOnlineStorageTextRect, sizeof( mso_sptFlowChartOnlineStorageTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptFlowChartOnlineStorageGluePoints, sizeof( mso_sptFlowChartOnlineStorageGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartDelayVert[] =
+{
+ { 10800, 0 }, { 21600, 10800 }, { 10800, 21600 }, { 0, 21600 },
+ { 0, 0 }
+};
+static const sal_uInt16 mso_sptFlowChartDelaySegm[] =
+{
+ 0x4000, 0xa702, 0x0002, 0x6000, 0x8000
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartDelayTextRect[] =
+{
+ { { 0, 3100 }, { 18500, 18500 } }
+};
+static const mso_CustomShape msoFlowChartDelay =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartDelayVert, sizeof( mso_sptFlowChartDelayVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptFlowChartDelaySegm, sizeof( mso_sptFlowChartDelaySegm ) >> 1,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartDelayTextRect, sizeof( mso_sptFlowChartDelayTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptStandardGluePoints, sizeof( mso_sptStandardGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartMagneticTapeVert[] =
+{
+ { 20980, 18150 }, { 20980, 21600 }, { 10670, 21600 },
+ { 4770, 21540 }, { 0, 16720 }, { 0, 10800 }, // ccp
+ { 0, 4840 }, { 4840, 0 }, { 10800, 0 }, // ccp
+ { 16740, 0 }, { 21600, 4840 }, { 21600, 10800 }, // ccp
+ { 21600, 13520 }, { 20550, 16160 }, { 18670, 18170 } // ccp
+};
+static const sal_uInt16 mso_sptFlowChartMagneticTapeSegm[] =
+{
+ 0x4000, 0x0002, 0x2004, 0x6000, 0x8000
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartMagneticTapeTextRect[] =
+{
+ { { 3100, 3100 }, { 18500, 18500 } }
+};
+static const mso_CustomShape msoFlowChartMagneticTape =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartMagneticTapeVert, sizeof( mso_sptFlowChartMagneticTapeVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptFlowChartMagneticTapeSegm, sizeof( mso_sptFlowChartMagneticTapeSegm ) >> 1,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartMagneticTapeTextRect, sizeof( mso_sptFlowChartMagneticTapeTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptStandardGluePoints, sizeof( mso_sptStandardGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartMagneticDiskVert[] =
+{
+ { 0, 3400 }, { 10800, 0 }, { 21600, 3400 }, { 21600, 18200 },
+ { 10800, 21600 }, { 0, 18200 },
+
+ { 0, 3400 }, { 10800, 6800 }, { 21600, 3400 }
+};
+static const sal_uInt16 mso_sptFlowChartMagneticDiskSegm[] =
+{
+ 0x4000, 0xa802, 0x0001, 0xa802, 0x6000, 0x8000,
+ 0x4000, 0xa802, 0x8000
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartMagneticDiskTextRect[] =
+{
+ { { 0, 6800 }, { 21600, 18200 } }
+};
+static const SvxMSDffVertPair mso_sptFlowChartMagneticDiskGluePoints[] =
+{
+ { 10800, 6800 }, { 10800, 0 }, { 0, 10800 }, { 10800, 21600 }, { 21600, 10800 }
+};
+static const mso_CustomShape msoFlowChartMagneticDisk =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartMagneticDiskVert, sizeof( mso_sptFlowChartMagneticDiskVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptFlowChartMagneticDiskSegm, sizeof( mso_sptFlowChartMagneticDiskSegm ) >> 1,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartMagneticDiskTextRect, sizeof( mso_sptFlowChartMagneticDiskTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptFlowChartMagneticDiskGluePoints, sizeof( mso_sptFlowChartMagneticDiskGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartMagneticDrumVert[] =
+{
+ { 18200, 0 }, { 21600, 10800 }, { 18200, 21600 }, { 3400, 21600 },
+ { 0, 10800 }, { 3400, 0 },
+
+ { 18200, 0 }, { 14800, 10800 }, { 18200, 21600 }
+};
+static const sal_uInt16 mso_sptFlowChartMagneticDrumSegm[] =
+{
+ 0x4000, 0xa702, 0x0001, 0xa702, 0x6000, 0x8000,
+ 0x4000, 0xa702, 0x8000
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartMagneticDrumTextRect[] =
+{
+ { { 3400, 0 }, { 14800, 21600 } }
+};
+static const SvxMSDffVertPair mso_sptFlowChartMagneticDrumGluePoints[] =
+{
+ { 10800, 0 }, { 0, 10800 }, { 10800, 21600 }, { 14800, 10800 }, { 21600, 10800 }
+};
+static const mso_CustomShape msoFlowChartMagneticDrum =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartMagneticDrumVert, sizeof( mso_sptFlowChartMagneticDrumVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptFlowChartMagneticDrumSegm, sizeof( mso_sptFlowChartMagneticDrumSegm ) >> 1,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartMagneticDrumTextRect, sizeof( mso_sptFlowChartMagneticDrumTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptFlowChartMagneticDrumGluePoints, sizeof( mso_sptFlowChartMagneticDrumGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptFlowChartDisplayVert[] =
+{
+ { 3600, 0 }, { 17800, 0 }, { 21600, 10800 }, { 17800, 21600 },
+ { 3600, 21600 }, { 0, 10800 }
+};
+static const sal_uInt16 mso_sptFlowChartDisplaySegm[] =
+{
+ 0x4000, 0x0001, 0xa702, 0x0002, 0x6000, 0x8000
+};
+static const SvxMSDffTextRectangles mso_sptFlowChartDisplayTextRect[] =
+{
+ { { 3600, 0 }, { 17800, 21600 } }
+};
+static const mso_CustomShape msoFlowChartDisplay =
+{
+ (SvxMSDffVertPair*)mso_sptFlowChartDisplayVert, sizeof( mso_sptFlowChartDisplayVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptFlowChartDisplaySegm, sizeof( mso_sptFlowChartDisplaySegm ) >> 1,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFlowChartDisplayTextRect, sizeof( mso_sptFlowChartDisplayTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptStandardGluePoints, sizeof( mso_sptStandardGluePoints ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0 // handles
+};
+
+static const SvxMSDffVertPair mso_sptWedgeRectCalloutVert[] =
+{
+ { 0, 0 },
+ { 0, 3590 }, { 2 MSO_I, 3 MSO_I }, { 0, 8970 },
+ { 0, 12630 },{ 4 MSO_I, 5 MSO_I }, { 0, 18010 },
+ { 0, 21600 },
+ { 3590, 21600 }, { 6 MSO_I, 7 MSO_I }, { 8970, 21600 },
+ { 12630, 21600 }, { 8 MSO_I, 9 MSO_I }, { 18010, 21600 },
+ { 21600, 21600 },
+ { 21600, 18010 }, { 10 MSO_I, 11 MSO_I }, { 21600, 12630 },
+ { 21600, 8970 }, { 12 MSO_I, 13 MSO_I }, { 21600, 3590 },
+ { 21600, 0 },
+ { 18010, 0 }, { 14 MSO_I, 15 MSO_I }, { 12630, 0 },
+ { 8970, 0 }, { 16 MSO_I, 17 MSO_I }, { 3590, 0 },
+ { 0, 0 }
+};
+static const SvxMSDffCalculationData mso_sptWedgeRectCalloutCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 10800 } }, //0x400
+ { 0x2000, { DFF_Prop_adjust2Value, 0,10800 } },
+ { 0x6006, { 0x412, DFF_Prop_adjustValue, 0 } }, //0x402
+ { 0x6006, { 0x412, DFF_Prop_adjust2Value, 6280 } },
+ { 0x6006, { 0x417, DFF_Prop_adjustValue, 0 } }, //0x404
+ { 0x6006, { 0x417, DFF_Prop_adjust2Value, 15320 } },
+ { 0x6006, { 0x41a, DFF_Prop_adjustValue, 6280 } }, //0x406
+ { 0x6006, { 0x41a, DFF_Prop_adjust2Value, 21600 } },
+ { 0x6006, { 0x41d, DFF_Prop_adjustValue, 15320 } }, //0x408
+ { 0x6006, { 0x41d, DFF_Prop_adjust2Value, 21600 } },
+ { 0x6006, { 0x420, DFF_Prop_adjustValue, 21600 } }, //0x40a
+ { 0x6006, { 0x420, DFF_Prop_adjust2Value, 15320 } },
+ { 0x6006, { 0x422, DFF_Prop_adjustValue, 21600 } }, //0x40c
+ { 0x6006, { 0x422, DFF_Prop_adjust2Value, 6280 } },
+ { 0x6006, { 0x424, DFF_Prop_adjustValue, 15320 } }, //0x40e
+ { 0x6006, { 0x424, DFF_Prop_adjust2Value, 0 } },
+ { 0x6006, { 0x426, DFF_Prop_adjustValue, 6280 } }, //0x410
+ { 0x6006, { 0x426, DFF_Prop_adjust2Value, 0 } },
+ { 0xa006, { DFF_Prop_adjustValue, -1, 0x413 } }, //0x412
+ { 0xa006, { 0x401, -1, 0x416 } },
+ { 0x2003, { 0x400, 0, 0 } }, //0x414
+ { 0x2003, { 0x401, 0, 0 } },
+ { 0xa000, { 0x414, 0, 0x415 } }, //0x416
+ { 0xa006, { DFF_Prop_adjustValue, -1, 0x418 } },
+ { 0x6006, { 0x401, 0x416, -1 } }, //0x418
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 21600 } },
+ { 0x6006, { 0x419, 0x41b, -1 } }, //0x41a
+ { 0xa006, { 0x400, -1, 0x41c } },
+ { 0xa000, { 0x415, 0, 0x414 } }, //0x41c
+ { 0x6006, { 0x419, 0x41e, -1 } },
+ { 0x6006, { 0x400, 0x41c, -1 } }, //0x41e
+ { 0x2000, { DFF_Prop_adjustValue, 0, 21600 } },
+ { 0x6006, { 0x41f, 0x421, -1 } }, //0x420
+ { 0x6006, { 0x401, 0x416, -1 } },
+ { 0x6006, { 0x41f, 0x423, -1 } }, //0x422
+ { 0xa006, { 0x401, -1, 0x416 } },
+ { 0xa006, { DFF_Prop_adjust2Value, -1, 0x425 } }, //0x424
+ { 0x6006, { 0x400, 0x41c, -1 } },
+ { 0xa006, { DFF_Prop_adjust2Value, -1, 0x427 } }, //0x426
+ { 0xa006, { 0x400, -1, 0x41c } },
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, //0x428
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } }
+};
+static const sal_Int32 mso_sptWedgeRectCalloutDefault[] =
+{
+ 2, 1400, 25920
+};
+static const SvxMSDffTextRectangles mso_sptWedgeRectCalloutTextRect[] =
+{
+ { { 0, 0 }, { 21600, 21600 } }
+};
+static const SvxMSDffVertPair mso_sptWedgeRectCalloutGluePoints[] =
+{
+ { 10800, 0 }, { 0, 10800 }, { 10800, 21600 }, { 21600, 10800 }, { 40 MSO_I, 41 MSO_I }
+};
+static const SvxMSDffHandle mso_sptCalloutHandle[] =
+{
+ {
+ 0,
+ 0x100, 0x101, 10800, 10800, 0x80000000, 0x7fffffff, 0x80000000, 0x7fffffff
+ }
+};
+static const mso_CustomShape msoWedgeRectCallout =
+{
+ (SvxMSDffVertPair*)mso_sptWedgeRectCalloutVert, sizeof( mso_sptWedgeRectCalloutVert ) / sizeof( SvxMSDffVertPair ),
+ NULL, 0,
+ (SvxMSDffCalculationData*)mso_sptWedgeRectCalloutCalc, sizeof( mso_sptWedgeRectCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptWedgeRectCalloutDefault,
+ (SvxMSDffTextRectangles*)mso_sptWedgeRectCalloutTextRect, sizeof( mso_sptWedgeRectCalloutTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptWedgeRectCalloutGluePoints, sizeof( mso_sptWedgeRectCalloutGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptCalloutHandle, sizeof( mso_sptCalloutHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+static const SvxMSDffVertPair mso_sptWedgeRRectCalloutVert[] =
+{
+ { 3590, 0 },
+ { 0, 3590 },
+ { 2 MSO_I, 3 MSO_I }, { 0, 8970 },
+ { 0, 12630 },{ 4 MSO_I, 5 MSO_I }, { 0, 18010 },
+ { 3590, 21600 },
+ { 6 MSO_I, 7 MSO_I }, { 8970, 21600 },
+ { 12630, 21600 }, { 8 MSO_I, 9 MSO_I }, { 18010, 21600 },
+ { 21600, 18010 },
+ { 10 MSO_I, 11 MSO_I }, { 21600, 12630 },
+ { 21600, 8970 }, { 12 MSO_I, 13 MSO_I }, { 21600, 3590 },
+ { 18010, 0 },
+ { 14 MSO_I, 15 MSO_I }, { 12630, 0 },
+ { 8970, 0 }, { 16 MSO_I, 17 MSO_I }
+};
+static const sal_uInt16 mso_sptWedgeRRectCalloutSegm[] =
+{
+ 0x4000, 0xa701, 0x0005, 0xa801, 0x0005, 0xa701, 0x0005, 0xa801, 0x0004, 0x6001, 0x8000
+};
+static const SvxMSDffTextRectangles mso_sptWedgeRRectCalloutTextRect[] =
+{
+ { { 800, 800 }, { 20800, 20800 } }
+};
+static const mso_CustomShape msoWedgeRRectCallout =
+{
+ (SvxMSDffVertPair*)mso_sptWedgeRRectCalloutVert, sizeof( mso_sptWedgeRRectCalloutVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptWedgeRRectCalloutSegm, sizeof( mso_sptWedgeRRectCalloutSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptWedgeRectCalloutCalc, sizeof( mso_sptWedgeRectCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptWedgeRectCalloutDefault,
+ (SvxMSDffTextRectangles*)mso_sptWedgeRRectCalloutTextRect, sizeof( mso_sptWedgeRRectCalloutTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptCalloutHandle, sizeof( mso_sptCalloutHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+static const SvxMSDffVertPair mso_sptBalloonVert[] =
+{
+ { 3590, 0 },
+ { 0, 3590 },
+ { 0, 14460 },
+ { 3590, 18050 },
+ { 40 MSO_I, 21600 }, { 5420, 18050 },
+ { 18010, 18050 },
+ { 21600, 14460 },
+ { 21600, 3590 },
+ { 18010, 0 }
+};
+static const sal_uInt16 mso_sptBalloonSegm[] =
+{
+ 0x4000, 0xa701, 0x0001, 0xa801, 0x0003, 0xa701, 0x0001, 0xa801, 0x6001, 0x8000
+};
+static const SvxMSDffHandle mso_sptBalloonHandle[] =
+{
+ {
+ MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 1, 10800, 10800, 0, 8990, 0x80000000, 0x7fffffff
+ }
+};
+static const SvxMSDffTextRectangles mso_sptBalloonTextRect[] =
+{
+ { { 800, 800 }, { 20800, 17250 } }
+};
+static const mso_CustomShape msoBalloon =
+{
+ (SvxMSDffVertPair*)mso_sptBalloonVert, sizeof( mso_sptBalloonVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptBalloonSegm, sizeof( mso_sptBalloonSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptWedgeRectCalloutCalc, sizeof( mso_sptWedgeRectCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptWedgeRectCalloutDefault,
+ (SvxMSDffTextRectangles*)mso_sptBalloonTextRect, sizeof( mso_sptBalloonTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptBalloonHandle, sizeof( mso_sptBalloonHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+static const SvxMSDffVertPair mso_sptWedgeEllipseCalloutVert[] =
+{
+ { 0, 0 }, { 21600, 21600 }, { 0x16 MSO_I, 0x17 MSO_I }, { 0x12 MSO_I, 0x13 MSO_I }, { 0xe MSO_I, 0xf MSO_I }
+};
+static const sal_uInt16 mso_sptWedgeEllipseCalloutSegm[] =
+{
+ 0xa504, 0x0001, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptWedgeEllipseCalloutCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 10800 } }, // 00 rad x
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 10800 } }, // 01 rad y
+ { 0x6001, { 0x400, 0x400, 1 } }, // 02 rad x^2
+ { 0x6001, { 0x401, 0x401, 1 } }, // 03 rad y^2
+ { 0x6000, { 0x402, 0x403, 0 } }, // 04
+ { 0x200d, { 0x404, 0, 0 } }, // 05
+ { 0x2000, { 0x405, 0, 10800 } }, // 06 > 0 ? spur needs to be drawn : 10800
+ { 0x6008, { 0x400, 0x401, 0 } }, // 07 atan2 -> angle
+ { 0x2000, { 0x407, 0, 10 } }, // 08
+ { 0x2000, { 0x407, 10, 0 } }, // 09
+ { 0x400a, { 10800, 0x407, 0 } }, // 0a
+ { 0x4009, { 10800, 0x407, 0 } }, // 0b
+ { 0x2000, { 0x40a, 10800, 0 } }, // 0c
+ { 0x2000, { 0x40b, 10800, 0 } }, // 0d
+ { 0xe006, { 0x406, DFF_Prop_adjustValue, 0x40c } }, // 0e
+ { 0xe006, { 0x406, DFF_Prop_adjust2Value, 0x40d } },// 0f
+ { 0x400a, { 10800, 0x408, 0 } }, // 10
+ { 0x4009, { 10800, 0x408, 0 } }, // 11
+ { 0x2000, { 0x410, 10800, 0 } }, // 12
+ { 0x2000, { 0x411, 10800, 0 } }, // 13
+ { 0x400a, { 10800, 0x409, 0 } }, // 14
+ { 0x4009, { 10800, 0x409, 0 } }, // 15
+ { 0x2000, { 0x414, 10800, 0 } }, // 16
+ { 0x2000, { 0x415, 10800, 0 } } // 17
+};
+static const sal_Int32 mso_sptWedgeEllipseCalloutDefault[] =
+{
+ 2, 1350, 25920
+};
+static const SvxMSDffVertPair mso_sptWedgeEllipseCalloutGluePoints[] =
+{
+ { 10800, 0 }, { 3160, 3160 }, { 0, 10800 }, { 3160, 18440 }, { 10800, 21600 }, { 18440, 18440 }, { 21600, 10800 }, { 18440, 3160 }, { 0xe MSO_I, 0xf MSO_I }
+};
+static const SvxMSDffTextRectangles mso_sptWedgeEllipseCalloutTextRect[] =
+{
+ { { 3200, 3200 }, { 18400, 18400 } }
+};
+static const mso_CustomShape msoWedgeEllipseCallout =
+{
+ (SvxMSDffVertPair*)mso_sptWedgeEllipseCalloutVert, sizeof( mso_sptWedgeEllipseCalloutVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptWedgeEllipseCalloutSegm, sizeof( mso_sptWedgeEllipseCalloutSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptWedgeEllipseCalloutCalc, sizeof( mso_sptWedgeEllipseCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptWedgeEllipseCalloutDefault,
+ (SvxMSDffTextRectangles*)mso_sptWedgeEllipseCalloutTextRect, sizeof( mso_sptWedgeEllipseCalloutTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptWedgeEllipseCalloutGluePoints, sizeof( mso_sptWedgeEllipseCalloutGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptCalloutHandle, sizeof( mso_sptCalloutHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptCloudCalloutVert[] =
+{
+ { 1930,7160 }, // p
+ { 1530,4490 }, { 3400,1970 }, { 5270,1970 }, // ccp
+ { 5860,1950 }, { 6470,2210 }, { 6970,2600 }, // ccp
+ { 7450,1390 }, { 8340,650 }, { 9340,650 }, // ccp
+ { 10004,690 }, { 10710,1050 }, { 11210,1700 }, // ccp
+ { 11570,630 }, { 12330,0 }, { 13150,0 }, // ccp
+ { 13840,0 }, { 14470,460 }, { 14870,1160 }, // ccp
+ { 15330,440 }, { 16020,0 }, { 16740,0 }, // ccp
+ { 17910,0 }, { 18900,1130 }, { 19110,2710 }, // ccp
+ { 20240,3150 }, { 21060,4580 }, { 21060,6220 }, // ccp
+ { 21060,6720 }, { 21000,7200 }, { 20830,7660 }, // ccp
+ { 21310,8460 }, { 21600,9450 }, { 21600,10460 }, // ccp
+ { 21600,12750 }, { 20310,14680 }, { 18650,15010 }, // ccp
+ { 18650,17200 }, { 17370,18920 }, { 15770,18920 }, // ccp
+ { 15220,18920 }, { 14700,18710 }, { 14240,18310 }, // ccp
+ { 13820,20240 }, { 12490,21600 }, { 11000,21600 }, // ccp
+ { 9890,21600 }, { 8840,20790 }, { 8210,19510 }, // ccp
+ { 7620,20000 }, { 7930,20290 }, { 6240,20290 }, // ccp
+ { 4850,20290 }, { 3570,19280 }, { 2900,17640 }, // ccp
+ { 1300,17600 }, { 480,16300 }, { 480,14660 }, // ccp
+ { 480,13900 }, { 690,13210 }, { 1070,12640 }, // ccp
+ { 380,12160 }, { 0,11210 }, { 0,10120 }, // ccp
+ { 0,8590 }, { 840,7330 }, { 1930,7160 }, // ccp
+
+ { 1930, 7160 }, { 1950, 7410 }, { 2040, 7690 }, { 2090, 7920 }, // pccp
+ { 6970, 2600 }, { 7200, 2790 }, { 7480, 3050 }, { 7670, 3310 }, // pccp
+ { 11210, 1700 }, { 11130, 1910 }, { 11080, 2160 }, { 11030, 2400 }, // pccp
+ { 14870, 1160 }, { 14720, 1400 }, { 14640, 1720 }, { 14540, 2010 }, // pccp
+ { 19110, 2710 }, { 19130, 2890 }, { 19230, 3290 }, { 19190, 3380 }, // pccp
+ { 20830, 7660 }, { 20660, 8170 }, { 20430, 8620 }, { 20110, 8990 }, // pccp
+ { 18660, 15010 }, { 18740, 14200 }, { 18280, 12200 }, { 17000, 11450 }, // pccp
+ { 14240, 18310 }, { 14320, 17980 }, { 14350, 17680 }, { 14370, 17360 }, // pccp
+ { 8220, 19510 }, { 8060, 19250 }, { 7960, 18950 }, { 7860, 18640 }, // pccp
+ { 2900, 17640 }, { 3090, 17600 }, { 3280, 17540 }, { 3460, 17450 }, // pccp
+ { 1070, 12640 }, { 1400, 12900 }, { 1780, 13130 }, { 2330, 13040 }, // pccp
+
+ { 0x11 MSO_I, 0x12 MSO_I }, { 1800, 1800 }, { 0, 360 }, // circ1
+ { 0x13 MSO_I, 0x14 MSO_I }, { 1200, 1200 }, { 0, 360 }, // circ2
+ { 0xd MSO_I, 0xe MSO_I }, { 700, 700 }, { 0, 360 } // circ3
+};
+static const sal_uInt16 mso_sptCloudCalloutSegm[] =
+{
+ 0x4000, 0x2016, 0x6001, 0x8000,
+ 0x4000, 0x2001, 0xaa00, 0x8000,
+ 0x4000, 0x2001, 0xaa00, 0x8000,
+ 0x4000, 0x2001, 0xaa00, 0x8000,
+ 0x4000, 0x2001, 0xaa00, 0x8000,
+ 0x4000, 0x2001, 0xaa00, 0x8000,
+ 0x4000, 0x2001, 0xaa00, 0x8000,
+ 0x4000, 0x2001, 0xaa00, 0x8000,
+ 0x4000, 0x2001, 0xaa00, 0x8000,
+ 0x4000, 0x2001, 0xaa00, 0x8000,
+ 0x4000, 0x2001, 0xaa00, 0x8000,
+ 0x4000, 0x2001, 0xaa00, 0x8000,
+ 0xa203, 0x6001, 0x8000,
+ 0xa203, 0x6001, 0x8000,
+ 0xa203, 0x6001, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptCloudCalloutCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 10800 } },
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 10800 } },
+ { 0x6008, { 0x400, 0x401, 0 } },
+ { 0x400a, { 10800, 0x402, 0 } }, // 3
+ { 0x4009, { 10800, 0x402, 0 } }, // 4
+ { 0x2000, { 0x403, 10800, 0 } }, // 5
+ { 0x2000, { 0x404, 10800, 0 } }, // 6
+ { 0xa000, { DFF_Prop_adjustValue, 0, 0x405 } }, // 7
+ { 0xa000, { DFF_Prop_adjust2Value,0, 0x406 } }, // 8
+ { 0x2001, { 0x407, 1, 3 } }, // 9
+ { 0x2001, { 0x408, 1, 3 } }, // 0xa
+ { 0x2001, { 0x407, 2, 3 } }, // 0xb
+ { 0x2001, { 0x408, 2, 3 } }, // 0xc
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, // 0xd
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } }, // 0xe
+ { 0x2001, { 0x403, 1, 10800 / 900 } }, // 0xf taking half x distance of the radius from the first bobble
+ { 0x2001, { 0x404, 1, 10800 / 900 } }, // 0x10
+ { 0xe000, { 0x409, 0x405, 0x40f } }, // 0x11
+ { 0xe000, { 0x40a, 0x406, 0x410 } }, // 0x12
+ { 0x6000, { 0x40b, 0x405, 0 } }, // 0x13
+ { 0x6000, { 0x40c, 0x406, 0 } } // 0x14
+};
+static const sal_Int32 mso_sptCloudCalloutDefault[] =
+{
+ 2, 1350, 25920
+};
+static const SvxMSDffTextRectangles mso_sptCloudCalloutTextRect[] =
+{
+ { { 3000, 3320 }, { 17110, 17330 } }
+};
+static const mso_CustomShape msoCloudCallout =
+{
+ (SvxMSDffVertPair*)mso_sptCloudCalloutVert, sizeof( mso_sptCloudCalloutVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCloudCalloutSegm, sizeof( mso_sptCloudCalloutSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCloudCalloutCalc, sizeof( mso_sptCloudCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptCloudCalloutDefault,
+ (SvxMSDffTextRectangles*)mso_sptCloudCalloutTextRect, sizeof( mso_sptCloudCalloutTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptCalloutHandle, sizeof( mso_sptCalloutHandle ) / sizeof( SvxMSDffHandle ) // handles
+};
+
+static const SvxMSDffVertPair mso_sptWaveVert[] = // adjustment1 : 0 - 4460
+{ // adjustment2 : 8640 - 12960
+ { 7 MSO_I, 0 MSO_I }, { 15 MSO_I, 9 MSO_I }, { 16 MSO_I, 10 MSO_I }, { 12 MSO_I, 0 MSO_I },
+ { 24 MSO_I, 1 MSO_I }, { 25 MSO_I, 26 MSO_I }, { 27 MSO_I, 28 MSO_I }, { 29 MSO_I, 1 MSO_I }
+};
+static const SvxMSDffCalculationData mso_sptWaveCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, //400 (vert.adj)
+ { 0x8000, { 21600, 0, 0x400 } }, //401
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } },//402 (horz.adj)
+ { 0x2000, { 0x402, 0, 10800 } }, //403 -2160 -> 2160 (horz.adj)
+ { 0x2001, { 0x403, 2, 1 } }, //404 -4320 -> 4320 (horz.adj)
+ { 0x2003, { 0x404, 0, 0 } }, //405 abs( 0x404 ) (horz.adj)
+ { 0x8000, { 4320, 0, 0x405 } }, //406
+ { 0xa006, { 0x403, 0, 0x405 } }, //407
+ { 0x4001, { 15800, 0x400, 4460 } }, //408 0 -> 15800 (vert.adj)
+ { 0xa000, { 0x400, 0, 0x408 } }, //409
+ { 0x6000, { 0x400, 0x408, 0 } }, //40a
+ { 0x8000, { 21600, 0, 0x404 } }, //40b
+ { 0x6006, { 0x403, 0x40b, 21600 } }, //40c
+ { 0xa000, { 0x40c, 0, 0x407 } }, //40d width between p0 and p1
+ { 0x2001, { 0x405, 1, 2 } }, //40e
+ { 0xa000, { 0x407, 7200, 0x40e } }, //40f
+ { 0x6000, { 0x40c, 0x40e, 7200 } }, //410
+ { 0x2001, { 0x40d, 1, 2 } }, //411 1/2 width
+ { 0x6000, { 0x407, 0x411, 0 } }, //412 top center glue xpos
+ { 0x8000, { 21600, 0, 0x412 } }, //413 bottom center glue xpos
+ { 0x2001, { 0x405, 1, 2 } }, //414 left glue x pos
+ { 0x8000, { 21600, 0, 0x414 } }, //415 right glue x pos
+ { 0x2001, { 0x400, 2, 1 } }, //416 y1 (textbox)
+ { 0x8000, { 21600, 0, 0x416 } }, //417 y2 (textbox)
+
+ { 0x8000, { 21600, 0, 0x407 } }, //418 p2
+
+ { 0x8000, { 21600, 0, 0x40f } }, //419 c
+ { 0x6000, { 0x401, 0x408, 0 } }, //41a
+
+ { 0x8000, { 21600, 0, 0x410 } }, //41b c
+ { 0xa000, { 0x401, 0, 0x408 } }, //41c
+
+ { 0x8000, { 21600, 0, 0x40c } } //41d p3
+};
+static const SvxMSDffVertPair mso_sptWaveGluePoints[] =
+{
+ { 0x12 MSO_I, 0 MSO_I }, { 0x14 MSO_I, 10800 }, { 0x13 MSO_I, 1 MSO_I }, { 0x15 MSO_I, 10800 }
+};
+static const sal_uInt16 mso_sptWaveSegm[] =
+{
+ 0x4000, 0x2001, 0x0001, 0x2001, 0x6000, 0x8000
+};
+static const SvxMSDffHandle mso_sptWaveHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 0, 4460 },
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x101, 21600, 10800, 10800, 8640, 12960, 0x80000000, 0x7fffffff }
+};
+static const sal_Int32 mso_sptWaveDefault[] =
+{
+ 2, 1400, 10800
+};
+static const SvxMSDffTextRectangles mso_sptWaveTextRect[] =
+{
+ { { 5 MSO_I, 22 MSO_I }, { 11 MSO_I, 23 MSO_I } }
+};
+static const mso_CustomShape msoWave =
+{
+ (SvxMSDffVertPair*)mso_sptWaveVert, sizeof( mso_sptWaveVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptWaveSegm, sizeof( mso_sptWaveSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptWaveCalc, sizeof( mso_sptWaveCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptWaveDefault,
+ (SvxMSDffTextRectangles*)mso_sptWaveTextRect, sizeof( mso_sptWaveTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptWaveGluePoints, sizeof( mso_sptWaveGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptWaveHandle, sizeof( mso_sptWaveHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptDoubleWaveVert[] = // adjustment1 : 0 - 2230
+{ // adjustment2 : 8640 - 12960
+ { 7 MSO_I, 0 MSO_I }, { 15 MSO_I, 9 MSO_I }, { 0x1e MSO_I, 10 MSO_I }, { 0x12 MSO_I, 0 MSO_I }, { 0x1f MSO_I, 9 MSO_I }, { 16 MSO_I, 10 MSO_I }, { 12 MSO_I, 0 MSO_I },
+ { 24 MSO_I, 1 MSO_I }, { 25 MSO_I, 26 MSO_I }, { 0x21 MSO_I, 28 MSO_I }, { 0x13 MSO_I, 1 MSO_I }, { 0x20 MSO_I, 26 MSO_I }, { 27 MSO_I, 28 MSO_I }, { 29 MSO_I, 1 MSO_I }
+};
+static const SvxMSDffCalculationData mso_sptDoubleWaveCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, //400 (vert.adj)
+ { 0x8000, { 21600, 0, 0x400 } }, //401
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } },//402 (horz.adj)
+ { 0x2000, { 0x402, 0, 10800 } }, //403 -2160 -> 2160 (horz.adj)
+ { 0x2001, { 0x403, 2, 1 } }, //404 -4320 -> 4320 (horz.adj)
+ { 0x2003, { 0x404, 0, 0 } }, //405 abs( 0x404 ) (horz.adj)
+ { 0x8000, { 4320, 0, 0x405 } }, //406 -> not used
+ { 0xa006, { 0x403, 0, 0x405 } }, //407
+ { 0x4001, { 7900, 0x400, 2230 } }, //408 0 -> 7900 (vert.adj)
+ { 0xa000, { 0x400, 0, 0x408 } }, //409
+ { 0x6000, { 0x400, 0x408, 0 } }, //40a
+ { 0x8000, { 21600, 0, 0x404 } }, //40b
+ { 0x6006, { 0x403, 0x40b, 21600 } }, //40c
+ { 0xa000, { 0x40c, 0, 0x407 } }, //40d width between p0 and p1
+ { 0x2001, { 0x405, 1, 2 } }, //40e
+ { 0xa000, { 0x407, 3600, 0x40e } }, //40f
+ { 0x6000, { 0x40c, 0x40e, 3600 } }, //410
+ { 0x2001, { 0x40d, 1, 2 } }, //411 1/2 width
+ { 0x6000, { 0x407, 0x411, 0 } }, //412 top center glue xpos
+ { 0x8000, { 21600, 0, 0x412 } }, //413 bottom center glue xpos
+ { 0x2001, { 0x405, 1, 2 } }, //414 left glue x pos
+ { 0x8000, { 21600, 0, 0x414 } }, //415 right glue x pos
+ { 0x2001, { 0x400, 2, 1 } }, //416 y1 (textbox)
+ { 0x8000, { 21600, 0, 0x416 } }, //417 y2 (textbox)
+
+ { 0x8000, { 21600, 0, 0x407 } }, //418 p2
+
+ { 0x8000, { 21600, 0, 0x40f } }, //419 c
+ { 0x6000, { 0x401, 0x408, 0 } }, //41a
+
+ { 0x8000, { 21600, 0, 0x410 } }, //41b c
+ { 0xa000, { 0x401, 0, 0x408 } }, //41c
+
+ { 0x8000, { 21600, 0, 0x40c } }, //41d p3
+ { 0xa000, { 0x412, 0, 0x40e } }, //41e
+ { 0x6000, { 0x412, 0x40e, 0 } }, //41f
+ { 0xa000, { 0x413, 0, 0x40e } }, //420
+ { 0x6000, { 0x413, 0x40e, 0 } } //421
+};
+static const SvxMSDffVertPair mso_sptDoubleWaveGluePoints[] =
+{
+ { 0x12 MSO_I, 0 MSO_I }, { 0x14 MSO_I, 10800 }, { 0x13 MSO_I, 1 MSO_I }, { 0x15 MSO_I, 10800 }
+};
+static const sal_uInt16 mso_sptDoubleWaveSegm[] =
+{
+ 0x4000, 0x2002, 0x0001, 0x2002, 0x6000, 0x8000
+};
+static const SvxMSDffHandle mso_sptDoubleWaveHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 0, 2230 },
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x101, 21600, 10800, 10800, 8640, 12960, 0x80000000, 0x7fffffff }
+};
+static const sal_Int32 mso_sptDoubleWaveDefault[] =
+{
+ 2, 1400, 10800
+};
+static const SvxMSDffTextRectangles mso_sptDoubleWaveTextRect[] =
+{
+ { { 5 MSO_I, 22 MSO_I }, { 11 MSO_I, 23 MSO_I } }
+};
+static const mso_CustomShape msoDoubleWave =
+{
+ (SvxMSDffVertPair*)mso_sptDoubleWaveVert, sizeof( mso_sptDoubleWaveVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptDoubleWaveSegm, sizeof( mso_sptDoubleWaveSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptDoubleWaveCalc, sizeof( mso_sptDoubleWaveCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDoubleWaveDefault,
+ (SvxMSDffTextRectangles*)mso_sptDoubleWaveTextRect, sizeof( mso_sptDoubleWaveTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptDoubleWaveGluePoints, sizeof( mso_sptDoubleWaveGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptDoubleWaveHandle, sizeof( mso_sptDoubleWaveHandle ) / sizeof( SvxMSDffHandle )
+};
+
+// for each shapetype a bit of 1 is indicating that the shape is NOT filled by default
+static const sal_uInt16 mso_DefaultFillingTable[] =
+{
+ 0x0000, 0x0018, 0x01ff, 0x0000, 0x0c00, 0x01e0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0600, 0x0000, 0x0000, 0x0000, 0x0000
+};
+sal_Bool IsCustomShapeFilledByDefault( MSO_SPT eSpType )
+{
+ sal_Bool bIsFilledByDefault = sal_True;
+ sal_uInt32 i = (sal_uInt32)eSpType;
+ if ( i < 0x100 )
+ bIsFilledByDefault = ( mso_DefaultFillingTable[ i >> 4 ] & ( 1 << ( i & 0xf ) ) ) == 0;
+ return bIsFilledByDefault;
+}
+sal_Int16 GetCustomShapeConnectionTypeDefault( MSO_SPT eSpType )
+{
+ sal_Int16 nGluePointType = com::sun::star::drawing::EnhancedCustomShapeGluePointType::SEGMENTS;
+ const mso_CustomShape* pDefCustomShape = GetCustomShapeContent( eSpType );
+ if ( pDefCustomShape && pDefCustomShape->nGluePoints )
+ nGluePointType = com::sun::star::drawing::EnhancedCustomShapeGluePointType::CUSTOM;
+ else
+ {
+ switch( eSpType )
+ {
+ case mso_sptRectangle :
+ case mso_sptRoundRectangle :
+ case mso_sptPictureFrame :
+ case mso_sptFlowChartProcess :
+ case mso_sptFlowChartPredefinedProcess :
+ case mso_sptFlowChartInternalStorage :
+ case mso_sptTextPlainText :
+ case mso_sptTextBox :
+ case mso_sptVerticalScroll :
+ case mso_sptHorizontalScroll :
+ nGluePointType = com::sun::star::drawing::EnhancedCustomShapeGluePointType::RECT;
+ default: break;
+ }
+ }
+ return nGluePointType;
+}
+
+// for each shapetype a bit of 1 is indicating that the shape is NOT stroked by default
+// #i28269#
+static const sal_uInt16 mso_DefaultStrokingTable[] =
+{
+ 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0800, 0x0000, 0x0000, 0x0000, // #i28269# Added shape 75 (mso_sptPictureFrame)
+ 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000
+};
+// #i28269#
+sal_Bool IsCustomShapeStrokedByDefault( MSO_SPT eSpType )
+{
+ sal_Bool bIsStrokedByDefault = sal_True;
+ sal_uInt32 i = (sal_uInt32)eSpType;
+ if ( i < 0x100 )
+ bIsStrokedByDefault = ( mso_DefaultStrokingTable[ i >> 4 ] & ( 1 << ( i & 0xf ) ) ) == 0;
+ return bIsStrokedByDefault;
+}
+
+static const sal_uInt16 msoSortFilledObjectsToBackTable[] =
+{
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+};
+sal_Bool SortFilledObjectsToBackByDefault( MSO_SPT eSpType )
+{
+ sal_Bool bSortFilledObjectsToBackByDefault = sal_True;
+ sal_uInt32 i = (sal_uInt32)eSpType;
+ if ( i < 0x100 )
+ bSortFilledObjectsToBackByDefault = ( msoSortFilledObjectsToBackTable[ i >> 4 ] & ( 1 << ( i & 0xf ) ) ) != 0;
+ return bSortFilledObjectsToBackByDefault;
+}
+
+static const SvxMSDffVertPair mso_sptFontWorkVert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 0, 21600 }, { 21600, 21600 }
+};
+static const sal_uInt16 mso_sptFontWorkSegm[] =
+{
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x0001, 0x8000
+};
+static const SvxMSDffTextRectangles mso_sptFontWorkTextRect[] =
+{
+ { { 0, 0 }, { 21600, 21600 } }
+};
+static const mso_CustomShape msoFontWork =
+{
+ (SvxMSDffVertPair*)mso_sptFontWorkVert, sizeof( mso_sptFontWorkVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptFontWorkSegm, sizeof( mso_sptFontWorkSegm ) >> 1,
+ NULL, 0,
+ NULL,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ NULL, 0 // Handles
+};
+
+static const SvxMSDffVertPair mso_sptTextPlainTextVert[] =
+{
+ { 3 MSO_I, 0 }, { 5 MSO_I, 0 }, { 6 MSO_I, 21600 }, { 7 MSO_I, 21600 }
+};
+static const SvxMSDffCalculationData mso_sptTextPlainTextCalc[] = // adjustment1 : 6629 - 14971
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 10800 } },
+ { 0x2001, { 0x400, 2, 1 } },
+ { 0x2003, { 0x401, 0, 0 } },
+ { 0xa006, { 0x401, 0, 0x402 } }, // x1(3)
+ { 0x8000, { 21600, 0, 0x402 } },
+ { 0x6006, { 0x401, 0x404, 21600 } }, // x2(5)
+ { 0x6006, { 0x401, 0x402, 0 } }, // x2
+ { 0xa006, { 0x401, 21600, 0x404 } } // x3(7)
+};
+static const sal_uInt16 mso_sptTextPlainTextSegm[] =
+{
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x0001, 0x8000
+};
+static const SvxMSDffHandle mso_sptTextPlainTextHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 21600, 10800, 10800, 6629, 14971, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoTextPlainText =
+{
+ (SvxMSDffVertPair*)mso_sptTextPlainTextVert, sizeof( mso_sptTextPlainTextVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextPlainTextSegm, sizeof( mso_sptTextPlainTextSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextPlainTextCalc, sizeof( mso_sptTextPlainTextCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault10800,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextPlainTextHandle, sizeof( mso_sptTextPlainTextHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextStopVert[] =
+{
+ { 0, 0 MSO_I }, { 7200, 0 }, { 14400, 0 }, { 21600, 0 MSO_I },
+ { 0, 1 MSO_I }, { 7200, 21600 }, { 14400, 21600 }, { 21600, 1 MSO_I }
+};
+static const SvxMSDffCalculationData mso_sptTextStopCalc[] = // adjustment1 : 3080 - 10800
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x8000, { 21600, 0, DFF_Prop_adjustValue } }
+};
+static const sal_uInt16 mso_sptTextStopSegm[] =
+{
+ 0x4000, 0x0003, 0x8000,
+ 0x4000, 0x0003, 0x8000
+};
+static const sal_Int32 mso_sptTextStopDefault[] =
+{
+ 1, 2700
+};
+static const SvxMSDffHandle mso_sptTextStopHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 3080, 10800 }
+};
+static const mso_CustomShape msoTextStop =
+{
+ (SvxMSDffVertPair*)mso_sptTextStopVert, sizeof( mso_sptTextStopVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextStopSegm, sizeof( mso_sptTextStopSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextStopCalc, sizeof( mso_sptTextStopCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptTextStopDefault,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextStopHandle, sizeof( mso_sptTextStopHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextTriangleVert[] =
+{
+ { 0, 0 MSO_I }, { 10800, 0 }, { 21600, 0 MSO_I }, { 0, 21600 }, { 21600, 21600 }
+};
+static const SvxMSDffCalculationData mso_sptTextTriangleCalc[] = // adjustment1 : 6629 - 14971
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }
+};
+static const sal_uInt16 mso_sptTextTriangleSegm[] =
+{
+ 0x4000, 0x0002, 0x8000,
+ 0x4000, 0x0001, 0x8000
+};
+static const SvxMSDffHandle mso_sptTextTriangleHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 0, 21600 }
+};
+static const mso_CustomShape msoTextTriangle =
+{
+ (SvxMSDffVertPair*)mso_sptTextTriangleVert, sizeof( mso_sptTextTriangleVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextTriangleSegm, sizeof( mso_sptTextTriangleSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextTriangleCalc, sizeof( mso_sptTextTriangleCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault10800,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextTriangleHandle, sizeof( mso_sptTextTriangleHandle ) / sizeof( SvxMSDffHandle )
+};
+static const SvxMSDffVertPair mso_sptTextTriangleInvertedVert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 0, 0 MSO_I }, { 10800, 21600 }, { 21600, 0 MSO_I }
+};
+static const sal_uInt16 mso_sptTextTriangleInvertedSegm[] =
+{
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x0002, 0x8000
+};
+static const mso_CustomShape msoTextTriangleInverted =
+{
+ (SvxMSDffVertPair*)mso_sptTextTriangleInvertedVert, sizeof( mso_sptTextTriangleInvertedVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextTriangleInvertedSegm, sizeof( mso_sptTextTriangleInvertedSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextTriangleCalc, sizeof( mso_sptTextTriangleCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault10800,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextTriangleHandle, sizeof( mso_sptTextTriangleHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextChevronVert[] =
+{
+ { 0, 0 MSO_I }, { 10800, 0 }, { 21600, 0 MSO_I }, { 0, 21600 }, { 10800, 1 MSO_I }, { 21600, 21600 }
+};
+static const SvxMSDffCalculationData mso_sptTextChevronCalc[] = // adjustment1 : 6629 - 14971
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x8000, { 21600, 0, DFF_Prop_adjustValue } }
+};
+static const sal_uInt16 mso_sptTextChevronSegm[] =
+{
+ 0x4000, 0x0002, 0x8000,
+ 0x4000, 0x0002, 0x8000
+};
+static const SvxMSDffHandle mso_sptTextChevronHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 0, 10800 }
+};
+static const mso_CustomShape msoTextChevron =
+{
+ (SvxMSDffVertPair*)mso_sptTextChevronVert, sizeof( mso_sptTextChevronVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextChevronSegm, sizeof( mso_sptTextChevronSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextChevronCalc, sizeof( mso_sptTextChevronCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault5400,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextChevronHandle, sizeof( mso_sptTextChevronHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextChevronInvertedVert[] =
+{
+ { 0, 0 }, { 10800, 1 MSO_I }, { 21600, 0 }, { 0, 0 MSO_I }, { 10800, 21600 }, { 21600, 0 MSO_I }
+};
+static const SvxMSDffCalculationData mso_sptTextChevronInvertedCalc[] = // adjustment1 : 6629 - 14971
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x8000, { 21600, 0, DFF_Prop_adjustValue } }
+};
+static const sal_uInt16 mso_sptTextChevronInvertedSegm[] =
+{
+ 0x4000, 0x0002, 0x8000,
+ 0x4000, 0x0002, 0x8000
+};
+static const SvxMSDffHandle mso_sptTextChevronInvertedHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 10800, 21600 }
+};
+static const mso_CustomShape msoTextChevronInverted =
+{
+ (SvxMSDffVertPair*)mso_sptTextChevronInvertedVert, sizeof( mso_sptTextChevronInvertedVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextChevronInvertedSegm, sizeof( mso_sptTextChevronInvertedSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextChevronInvertedCalc, sizeof( mso_sptTextChevronInvertedCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault16200,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextChevronInvertedHandle, sizeof( mso_sptTextChevronInvertedHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextRingOutsideVert[] =
+{
+ { 10800, 0 MSO_I }, { 10800, 0 MSO_I }, { 180, 359 },
+ { 10800, 1 MSO_I }, { 10800, 0 MSO_I }, { 180, 359 }
+};
+static const SvxMSDffCalculationData mso_sptTextRingOutsideCalc[] = // adjustment1 : 6629 - 14971
+{
+ { 0x2001, { DFF_Prop_adjustValue, 1, 2 } },
+ { 0x8000, { 21600, 0, 0x400 } }
+};
+static const sal_uInt16 mso_sptTextRingOutsideSegm[] =
+{
+ 0xA203, 0x8000,
+ 0xA203, 0x8000
+};
+static const SvxMSDffHandle mso_sptTextRingOutsideHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 10800, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 10800, 21600 }
+};
+static const mso_CustomShape msoTextRingOutside =
+{
+ (SvxMSDffVertPair*)mso_sptTextRingOutsideVert, sizeof( mso_sptTextRingOutsideVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextRingOutsideSegm, sizeof( mso_sptTextRingOutsideSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextRingOutsideCalc, sizeof( mso_sptTextRingOutsideCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault16200,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextRingOutsideHandle, sizeof( mso_sptTextRingOutsideHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextFadeRightVert[] =
+{
+ { 0, 0 }, { 21600, 0 MSO_I }, { 0, 21600 }, { 21600, 1 MSO_I }
+};
+static const SvxMSDffCalculationData mso_sptTextFadeCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x8000, { 21600, 0, DFF_Prop_adjustValue } }
+};
+static const sal_uInt16 mso_sptTextFadeSegm[] =
+{
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x0001, 0x8000
+};
+static const SvxMSDffHandle mso_sptTextFadeRightHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 21600, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 0, 10800 }
+};
+static const mso_CustomShape msoTextFadeRight =
+{
+ (SvxMSDffVertPair*)mso_sptTextFadeRightVert, sizeof( mso_sptTextFadeRightVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextFadeSegm, sizeof( mso_sptTextFadeSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextFadeCalc, sizeof( mso_sptTextFadeCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault7200,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextFadeRightHandle, sizeof( mso_sptTextFadeRightHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextFadeLeftVert[] =
+{
+ { 0, 0 MSO_I }, { 21600, 0 }, { 0, 1 MSO_I }, { 21600, 21600 }
+};
+static const SvxMSDffHandle mso_sptTextFadeLeftHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 0, 10800 }
+};
+static const mso_CustomShape msoTextFadeLeft =
+{
+ (SvxMSDffVertPair*)mso_sptTextFadeLeftVert, sizeof( mso_sptTextFadeLeftVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextFadeSegm, sizeof( mso_sptTextFadeSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextFadeCalc, sizeof( mso_sptTextFadeCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault7200,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextFadeLeftHandle, sizeof( mso_sptTextFadeLeftHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextFadeUpVert[] =
+{
+ { 0 MSO_I, 0 }, { 1 MSO_I, 0 }, { 0, 21600 }, { 21600, 21600 }
+};
+static const SvxMSDffHandle mso_sptTextFadeUpHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 0, 10800, 10800, 0, 10800, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoTextFadeUp =
+{
+ (SvxMSDffVertPair*)mso_sptTextFadeUpVert, sizeof( mso_sptTextFadeUpVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextFadeSegm, sizeof( mso_sptTextFadeSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextFadeCalc, sizeof( mso_sptTextFadeCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault7200,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextFadeUpHandle, sizeof( mso_sptTextFadeUpHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextFadeDownVert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 0 MSO_I, 21600 }, { 1 MSO_I, 21600 }
+};
+static const SvxMSDffHandle mso_sptTextFadeDownHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 21600, 10800, 10800, 0, 10800, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoTextFadeDown =
+{
+ (SvxMSDffVertPair*)mso_sptTextFadeDownVert, sizeof( mso_sptTextFadeDownVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextFadeSegm, sizeof( mso_sptTextFadeSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextFadeCalc, sizeof( mso_sptTextFadeCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault7200,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextFadeDownHandle, sizeof( mso_sptTextFadeDownHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextSlantUpVert[] =
+{
+ { 0, 0 MSO_I }, { 21600, 0 }, { 0, 21600 }, { 21600, 1 MSO_I }
+};
+static const SvxMSDffHandle mso_sptTextSlantUpHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 0, 15400 }
+};
+static const mso_CustomShape msoTextSlantUp =
+{
+ (SvxMSDffVertPair*)mso_sptTextSlantUpVert, sizeof( mso_sptTextSlantUpVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextFadeSegm, sizeof( mso_sptTextFadeSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextFadeCalc, sizeof( mso_sptTextFadeCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault12000,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextSlantUpHandle, sizeof( mso_sptTextSlantUpHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextSlantDownVert[] =
+{
+ { 0, 0 }, { 21600, 1 MSO_I }, { 0, 0 MSO_I }, { 21600, 21600 }
+};
+static const SvxMSDffHandle mso_sptTextSlantDownHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 6200, 21600 }
+};
+static const mso_CustomShape msoTextSlantDown =
+{
+ (SvxMSDffVertPair*)mso_sptTextSlantDownVert, sizeof( mso_sptTextSlantDownVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextFadeSegm, sizeof( mso_sptTextFadeSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextFadeCalc, sizeof( mso_sptTextFadeCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault12000,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextSlantDownHandle, sizeof( mso_sptTextSlantDownHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextCascadeUpVert[] =
+{
+ { 0, 2 MSO_I }, { 21600, 0 }, { 0, 21600 }, { 21600, 0 MSO_I }
+};
+static const SvxMSDffCalculationData mso_sptTextCascadeCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x8000, { 21600, 0, DFF_Prop_adjustValue } },
+ { 0x2001, { 0x401, 1, 4 } }
+};
+static const SvxMSDffHandle mso_sptTextCascadeUpHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 21600, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 6200, 21600 }
+};
+static const mso_CustomShape msoTextCascadeUp =
+{
+ (SvxMSDffVertPair*)mso_sptTextCascadeUpVert, sizeof( mso_sptTextCascadeUpVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextFadeSegm, sizeof( mso_sptTextFadeSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextCascadeCalc, sizeof( mso_sptTextCascadeCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault9600,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextCascadeUpHandle, sizeof( mso_sptTextCascadeUpHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextCascadeDownVert[] =
+{
+ { 0, 0 }, { 21600, 2 MSO_I }, { 0, 0 MSO_I }, { 21600, 21600 }
+};
+static const SvxMSDffHandle mso_sptTextCascadeDownHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 6200, 21600 }
+};
+static const mso_CustomShape msoTextCascadeDown =
+{
+ (SvxMSDffVertPair*)mso_sptTextCascadeDownVert, sizeof( mso_sptTextCascadeDownVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextFadeSegm, sizeof( mso_sptTextFadeSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextCascadeCalc, sizeof( mso_sptTextCascadeCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault9600,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextCascadeDownHandle, sizeof( mso_sptTextCascadeDownHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextArchUpCurveVert[] =
+{
+ { 0, 0 }, { 21600, 21600 }, { 2 MSO_I, 3 MSO_I }, { 4 MSO_I, 3 MSO_I }
+};
+static const SvxMSDffCalculationData mso_sptTextArchCurveCalc[] =
+{
+ { 0x400a, { 10800, DFF_Prop_adjustValue, 0 } },
+ { 0x4009, { 10800, DFF_Prop_adjustValue, 0 } },
+ { 0x2000, { 0x400, 10800, 0 } },
+ { 0x2000, { 0x401, 10800, 0 } },
+ { 0x8000, { 21600, 0, 0x402 } }
+};
+static const sal_uInt16 mso_sptTextArchUpCurveSegm[] =
+{
+ 0xA504, 0x8000 // clockwíse arc
+};
+static const SvxMSDffHandle mso_sptTextArchUpCurveHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_POLAR,
+ 10800, 0x100, 10800, 10800, 0, 10800, 0x80000000, 0x7fffffff }
+};
+static const sal_Int32 mso_sptTextArchUpCurveDefault[] =
+{
+ 1, 180
+};
+static const mso_CustomShape msoTextArchUpCurve =
+{
+ (SvxMSDffVertPair*)mso_sptTextArchUpCurveVert, sizeof( mso_sptTextArchUpCurveVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextArchUpCurveSegm, sizeof( mso_sptTextArchUpCurveSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextArchCurveCalc, sizeof( mso_sptTextArchCurveCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptTextArchUpCurveDefault,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextArchUpCurveHandle, sizeof( mso_sptTextArchUpCurveHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextArchDownCurveVert[] =
+{
+ { 0, 0 }, { 21600, 21600 }, { 4 MSO_I, 3 MSO_I }, { 2 MSO_I, 3 MSO_I }
+};
+static const sal_uInt16 mso_sptTextArchDownCurveSegm[] =
+{
+ 0xA304, 0x8000 // counter clockwise arc to
+};
+static const SvxMSDffHandle mso_sptTextArchDownCurveHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_POLAR,
+ 10800, 0x100, 10800, 10800, 0, 10800, 0x80000000, 0x7fffffff }
+};
+static const sal_Int32 mso_sptTextArchDownCurveDefault[] =
+{
+ 1, 0
+};
+static const mso_CustomShape msoTextArchDownCurve =
+{
+ (SvxMSDffVertPair*)mso_sptTextArchDownCurveVert, sizeof( mso_sptTextArchDownCurveVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextArchDownCurveSegm, sizeof( mso_sptTextArchDownCurveSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextArchCurveCalc, sizeof( mso_sptTextArchCurveCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptTextArchDownCurveDefault,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextArchDownCurveHandle, sizeof( mso_sptTextArchDownCurveHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextCircleCurveVert[] =
+{
+ { 0, 0 }, { 21600, 21600 }, { 2 MSO_I, 3 MSO_I }, { 2 MSO_I, 4 MSO_I }
+};
+static const SvxMSDffCalculationData mso_sptTextCircleCurveCalc[] =
+{
+ { 0x400a, { 10800, DFF_Prop_adjustValue, 0 } },
+ { 0x4009, { 10800, DFF_Prop_adjustValue, 0 } },
+ { 0x2000, { 0x400, 10800, 0 } },
+ { 0x2000, { 0x401, 10800, 0 } },
+ { 0x8000, { 21600, 0, 0x403 } }
+};
+static const sal_uInt16 mso_sptTextCircleCurveSegm[] =
+{
+ 0xA504, 0x8000 // clockwise arc to
+};
+static const SvxMSDffHandle mso_sptTextCircleCurveHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_POLAR,
+ 10800, 0x100, 10800, 10800, 0, 10800, 0x80000000, 0x7fffffff }
+};
+static const sal_Int32 mso_sptTextCircleCurveDefault[] =
+{
+ 1, -179
+};
+static const mso_CustomShape msoTextCircleCurve =
+{
+ (SvxMSDffVertPair*)mso_sptTextCircleCurveVert, sizeof( mso_sptTextCircleCurveVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextCircleCurveSegm, sizeof( mso_sptTextCircleCurveSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextCircleCurveCalc, sizeof( mso_sptTextCircleCurveCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptTextCircleCurveDefault,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextCircleCurveHandle, sizeof( mso_sptTextCircleCurveHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextButtonCurveVert[] =
+{
+ { 0, 0 }, { 21600, 21600 }, { 2 MSO_I, 3 MSO_I }, { 4 MSO_I, 3 MSO_I },
+ { 0, 10800 }, { 21600, 10800 },
+ { 0, 0 }, { 21600, 21600 }, { 2 MSO_I, 5 MSO_I }, { 4 MSO_I, 5 MSO_I }
+};
+static const SvxMSDffCalculationData mso_sptTextButtonCurveCalc[] =
+{
+ { 0x400a, { 10800, DFF_Prop_adjustValue, 0 } },
+ { 0x4009, { 10800, DFF_Prop_adjustValue, 0 } },
+ { 0x2000, { 0x400, 10800, 0 } },
+ { 0x2000, { 0x401, 10800, 0 } },
+ { 0x8000, { 21600, 0, 0x402 } },
+ { 0x8000, { 21600, 0, 0x403 } }
+};
+static const sal_uInt16 mso_sptTextButtonCurveSegm[] =
+{
+ 0xA504, 0x8000, // clockwise arc
+ 0x4000, 0x0001, 0x8000,
+ 0xA304, 0x8000 // counter clockwise
+};
+static const SvxMSDffHandle mso_sptTextButtonCurveHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_POLAR,
+ 10800, 0x100, 10800, 10800, 0, 10800, 0x80000000, 0x7fffffff }
+};
+static const sal_Int32 mso_sptTextButtonCurveDefault[] =
+{
+ 1, 180
+};
+static const mso_CustomShape msoTextButtonCurve =
+{
+ (SvxMSDffVertPair*)mso_sptTextButtonCurveVert, sizeof( mso_sptTextButtonCurveVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextButtonCurveSegm, sizeof( mso_sptTextButtonCurveSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextButtonCurveCalc, sizeof( mso_sptTextButtonCurveCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptTextButtonCurveDefault,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextButtonCurveHandle, sizeof( mso_sptTextButtonCurveHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextArchUpPourVert[] =
+{
+ { 0, 0 }, { 21600, 21600 }, { 2 MSO_I, 3 MSO_I }, { 4 MSO_I, 3 MSO_I },
+ { 5 MSO_I, 5 MSO_I }, { 11 MSO_I, 11 MSO_I }, { 8 MSO_I, 9 MSO_I }, { 0xa MSO_I, 9 MSO_I }
+};
+static const SvxMSDffCalculationData mso_sptTextArchPourCalc[] =
+{
+ { 0x400a, { 10800, DFF_Prop_adjustValue, 0 } },
+ { 0x4009, { 10800, DFF_Prop_adjustValue, 0 } },
+ { 0x2000, { 0x400, 10800, 0 } },
+ { 0x2000, { 0x401, 10800, 0 } },
+ { 0x8000, { 21600, 0, 0x402 } },
+ { 0x8000, { 10800, 0, DFF_Prop_adjust2Value } },
+ { 0x600a, { 0x405, DFF_Prop_adjustValue, 0 } }, // 6
+ { 0x6009, { 0x405, DFF_Prop_adjustValue, 0 } },
+ { 0x2000, { 0x406, 10800, 0 } }, // 8
+ { 0x2000, { 0x407, 10800, 0 } },
+ { 0x8000, { 21600, 0, 0x408 } }, // 10
+ { 0x8000, { 21600, 0, 0x405 } }
+};
+static const sal_uInt16 mso_sptTextArchUpPourSegm[] =
+{
+ 0xA504, 0x8000, 0xA504, 0x8000
+};
+static const SvxMSDffHandle mso_sptTextArchPourHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_POLAR | MSDFF_HANDLE_FLAGS_RADIUS_RANGE,
+ 0x101, 0x100, 10800, 10800, 0, 10800, 0x80000000, 0x7fffffff }
+};
+static const sal_Int32 mso_sptTextArchUpPourDefault[] =
+{
+ 2, 180, 5400
+};
+static const mso_CustomShape msoTextArchUpPour =
+{
+ (SvxMSDffVertPair*)mso_sptTextArchUpPourVert, sizeof( mso_sptTextArchUpPourVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextArchUpPourSegm, sizeof( mso_sptTextArchUpPourSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextArchPourCalc, sizeof( mso_sptTextArchPourCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptTextArchUpPourDefault,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextArchPourHandle, sizeof( mso_sptTextArchPourHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextArchDownPourVert[] =
+{
+ { 5 MSO_I, 5 MSO_I }, { 11 MSO_I, 11 MSO_I }, { 0xa MSO_I, 9 MSO_I }, { 8 MSO_I, 9 MSO_I },
+ { 0, 0 }, { 21600, 21600 }, { 4 MSO_I, 3 MSO_I }, { 2 MSO_I, 3 MSO_I }
+};
+static const sal_uInt16 mso_sptTextArchDownPourSegm[] =
+{
+ 0xA304, 0x8000, 0xA304, 0x8000
+};
+static const sal_Int32 mso_sptTextArchDownPourDefault[] =
+{
+ 2, 0, 5400
+};
+static const mso_CustomShape msoTextArchDownPour =
+{
+ (SvxMSDffVertPair*)mso_sptTextArchDownPourVert, sizeof( mso_sptTextArchDownPourVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextArchDownPourSegm, sizeof( mso_sptTextArchDownPourSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextArchPourCalc, sizeof( mso_sptTextArchPourCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptTextArchDownPourDefault,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextArchPourHandle, sizeof( mso_sptTextArchPourHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextCirclePourVert[] =
+{
+ { 0, 0 }, { 21600, 21600 }, { 2 MSO_I, 3 MSO_I }, { 2 MSO_I, 4 MSO_I },
+ { 5 MSO_I, 5 MSO_I }, { 11 MSO_I, 11 MSO_I }, { 8 MSO_I, 9 MSO_I }, { 8 MSO_I, 0xa MSO_I }
+};
+static const SvxMSDffCalculationData mso_sptTextCirclePourCalc[] =
+{
+ { 0x400a, { 10800, DFF_Prop_adjustValue, 0 } },
+ { 0x4009, { 10800, DFF_Prop_adjustValue, 0 } },
+ { 0x2000, { 0x400, 10800, 0 } },
+ { 0x2000, { 0x401, 10800, 0 } },
+ { 0x8000, { 21600, 0, 0x403 } },
+ { 0x8000, { 10800, 0, DFF_Prop_adjust2Value } },
+ { 0x600a, { 0x405, DFF_Prop_adjustValue, 0 } }, // 6
+ { 0x6009, { 0x405, DFF_Prop_adjustValue, 0 } },
+ { 0x2000, { 0x406, 10800, 0 } }, // 8
+ { 0x2000, { 0x407, 10800, 0 } },
+ { 0x8000, { 21600, 0, 0x409 } }, // 10
+ { 0x8000, { 21600, 0, 0x405 } },
+ { 0x000, { 21600, 0, 0 } }
+};
+static const sal_uInt16 mso_sptTextCirclePourSegm[] =
+{
+ 0xA504, 0x8000, 0xA504, 0x8000
+};
+static const SvxMSDffHandle mso_sptTextCirclePourHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_POLAR | MSDFF_HANDLE_FLAGS_RADIUS_RANGE,
+ 0x101, 0x100, 10800, 10800, 0, 10800, 0x80000000, 0x7fffffff }
+};
+static const sal_Int32 mso_sptTextCirclePourDefault[] =
+{
+ 2, -179, 5400
+};
+static const mso_CustomShape msoTextCirclePour =
+{
+ (SvxMSDffVertPair*)mso_sptTextCirclePourVert, sizeof( mso_sptTextCirclePourVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextCirclePourSegm, sizeof( mso_sptTextCirclePourSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextCirclePourCalc, sizeof( mso_sptTextCirclePourCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptTextCirclePourDefault,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextCirclePourHandle, sizeof( mso_sptTextCirclePourHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextButtonPourVert[] =
+{
+ { 0, 0 }, { 21600, 21600 }, { 2 MSO_I, 3 MSO_I }, { 4 MSO_I, 3 MSO_I },
+ { 6 MSO_I, 6 MSO_I }, { 7 MSO_I, 7 MSO_I }, { 10 MSO_I, 11 MSO_I }, { 12 MSO_I, 11 MSO_I },
+ { 0x16 MSO_I, 16 MSO_I }, { 0x15 MSO_I, 16 MSO_I },
+ { 0x16 MSO_I, 15 MSO_I }, { 0x15 MSO_I, 15 MSO_I },
+ { 6 MSO_I, 6 MSO_I }, { 7 MSO_I, 7 MSO_I }, { 10 MSO_I, 13 MSO_I }, { 12 MSO_I, 13 MSO_I },
+ { 0, 0 }, { 21600, 21600 }, { 2 MSO_I, 5 MSO_I }, { 4 MSO_I, 5 MSO_I }
+};
+static const SvxMSDffCalculationData mso_sptTextButtonPourCalc[] =
+{
+ { 0x400a, { 10800, DFF_Prop_adjustValue, 0 } }, // 0x00
+ { 0x4009, { 10800, DFF_Prop_adjustValue, 0 } }, // 0x01
+ { 0x2000, { 0x400, 10800, 0 } }, // 0x02
+ { 0x2000, { 0x401, 10800, 0 } }, // 0x03
+ { 0x8000, { 21600, 0, 0x402 } }, // 0x04
+ { 0x8000, { 21600, 0, 0x403 } }, // 0x05
+
+ { 0x8000, { 10800, 0, DFF_Prop_adjust2Value } }, // 0x06
+ { 0x8000, { 21600, 0, 0x406 } }, // 0x07
+
+ { 0x600a, { DFF_Prop_adjust2Value, DFF_Prop_adjustValue, 0 } }, // 0x08
+ { 0x6009, { DFF_Prop_adjust2Value, DFF_Prop_adjustValue, 0 } }, // 0x09
+ { 0x2000, { 0x408, 10800, 0 } }, // 0x0a
+ { 0x2000, { 0x409, 10800, 0 } }, // 0x0b
+ { 0x8000, { 21600, 0, 0x40a } }, // 0x0c
+ { 0x8000, { 21600, 0, 0x40b } }, // 0x0d
+ { 0x2001, { 0x406, 1, 2 } }, // 0x0e
+ { 0x4000, { 10800, 0x40e, 0 } }, // 0x0f
+ { 0x8000, { 10800, 0, 0x40e } }, // 0x10
+ { 0x6001, { 0x40e, 0x40e, 1 } }, // 0x11
+ { 0x6001, { DFF_Prop_adjust2Value, DFF_Prop_adjust2Value, 1 } }, // 0x12
+ { 0xA000, { 0x412, 0, 0x411 } }, // 0x13
+ { 0x200d, { 0x413, 0, 0 } }, // 0x14
+ { 0x4000, { 10800, 0x414, 0 } }, // 0x15
+ { 0x8000, { 10800, 0, 0x414 } } // 0x16
+};
+static const sal_uInt16 mso_sptTextButtonPourSegm[] =
+{
+ 0xA504, 0x8000, // clockwise arc
+ 0xA504, 0x8000, // clockwise arc
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x0001, 0x8000,
+ 0xA304, 0x8000, // counter clockwise
+ 0xA304, 0x8000 // counter clockwise
+};
+static const SvxMSDffHandle mso_sptTextButtonPourHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_POLAR | MSDFF_HANDLE_FLAGS_RADIUS_RANGE,
+ 0x101, 0x100, 10800, 10800, 4320, 10800, 0x80000000, 0x7fffffff }
+};
+static const sal_Int32 mso_sptTextButtonPourDefault[] =
+{
+ 2, 180, 5400
+};
+static const mso_CustomShape msoTextButtonPour =
+{
+ (SvxMSDffVertPair*)mso_sptTextButtonPourVert, sizeof( mso_sptTextButtonPourVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextButtonPourSegm, sizeof( mso_sptTextButtonPourSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextButtonPourCalc, sizeof( mso_sptTextButtonPourCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptTextButtonPourDefault,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextButtonPourHandle, sizeof( mso_sptTextButtonPourHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextCurveUpVert[] =
+{
+ { 0, 0 MSO_I }, { 4900, 1 MSO_I /*12170->0 14250 ->0*/ }, { 11640, 2 MSO_I /*12170->0 12800 ->0*/ }, { 21600, 0 },
+ { 0, 4 MSO_I /*12170->0 17220 ->21600*/ }, { 3700, 21600 }, { 8500, 21600 }, { 10100, 21600 }, { 14110, 21600 }, { 15910, 21600 }, { 21600, 4 MSO_I /*12170->0 17220 ->21600*/ }
+};
+static const SvxMSDffCalculationData mso_sptTextCurveUpCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, // 400
+ { 0x4001, { 14250, 0x400, 12170 } }, // 401
+ { 0x4001, { 12800, 0x400, 12170 } }, // 402
+ { 0x4001, { 6380, 0x400, 12170 } }, // 403
+ { 0x8000, { 21600, 0, 0x403 } } // 404
+};
+static const sal_uInt16 mso_sptTextCurveUpSegm[] =
+{
+ 0x4000, 0x2001, 0x8000,
+ 0x4000, 0x2002, 0x8000
+};
+static const SvxMSDffHandle mso_sptTextCurveUpHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 0, 12170 }
+};
+static const sal_Int32 mso_sptTextCurveUpDefault[] =
+{
+ 1, 9900
+};
+static const mso_CustomShape msoTextCurveUp =
+{
+ (SvxMSDffVertPair*)mso_sptTextCurveUpVert, sizeof( mso_sptTextCurveUpVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextCurveUpSegm, sizeof( mso_sptTextCurveUpSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextCurveUpCalc, sizeof( mso_sptTextCurveUpCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptTextCurveUpDefault,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextCurveUpHandle, sizeof( mso_sptTextCurveUpHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextCurveDownVert[] =
+{
+// { 0, 0 MSO_I }, { 4900, 1 MSO_I /*12170->0 14250 ->0*/ }, { 11640, 2 MSO_I /*12170->0 12800 ->0*/ }, { 21600, 0 },
+ { 0, 0 }, { 9960, 2 MSO_I }, { 16700, 1 MSO_I }, { 21600, 0 MSO_I },
+
+// { 0, 4 MSO_I /*12170->0 17220 ->21600*/ }, { 3700, 21600 }, { 8500, 21600 }, { 10100, 21600 }, { 14110, 21600 }, { 15910, 21600 }, { 21600, 4 MSO_I /*12170->0 17220 ->21600*/ }
+ { 0, 4 MSO_I }, { 5690, 21600 }, { 7490, 21600 }, { 11500, 21600 }, { 13100, 21600 }, { 17900, 21600 }, { 21600, 4 MSO_I }
+};
+static const SvxMSDffHandle mso_sptTextCurveDownHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 21600, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 0, 12170 }
+};
+static const mso_CustomShape msoTextCurveDown =
+{
+ (SvxMSDffVertPair*)mso_sptTextCurveDownVert, sizeof( mso_sptTextCurveDownVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextCurveUpSegm, sizeof( mso_sptTextCurveUpSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextCurveUpCalc, sizeof( mso_sptTextCurveUpCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptTextCurveUpDefault,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextCurveDownHandle, sizeof( mso_sptTextCurveDownHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextCanUpVert[] =
+{
+ { 0, 1 MSO_I }, { 900, 0 }, { 7100, 0 }, { 10800, 0 }, { 14500, 0 }, { 20700, 0 }, { 21600, 1 MSO_I },
+ { 0, 21600 }, { 900, 4 MSO_I }, { 7100, 0 MSO_I }, { 10800, 0 MSO_I }, { 14500, 0 MSO_I }, { 20700, 4 MSO_I }, { 21600, 21600 }
+};
+static const SvxMSDffCalculationData mso_sptTextCanUpCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, // 400
+ { 0x8000, { 21600, 0, DFF_Prop_adjustValue } }, // 401
+ { 0x2000, { DFF_Prop_adjustValue, 0, 14400 } }, // 402
+ { 0x4001, { 5470, 0x402, 7200 } }, // 403
+ { 0x4000, { 16130, 0x403, 0 } } // 404
+};
+static const sal_uInt16 mso_sptTextCanUpSegm[] =
+{
+ 0x4000, 0x2002, 0x8000,
+ 0x4000, 0x2002, 0x8000
+};
+static const SvxMSDffHandle mso_sptTextCanUpHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 10800, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 14400, 21600 }
+};
+static const sal_Int32 mso_sptTextCanUpDefault[] =
+{
+ 1, 18500
+};
+static const mso_CustomShape msoTextCanUp =
+{
+ (SvxMSDffVertPair*)mso_sptTextCanUpVert, sizeof( mso_sptTextCanUpVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextCanUpSegm, sizeof( mso_sptTextCanUpSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextCanUpCalc, sizeof( mso_sptTextCanUpCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptTextCanUpDefault,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextCanUpHandle, sizeof( mso_sptTextCanUpHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextCanDownVert[] =
+{
+ { 0, 0 }, { 900, 2 MSO_I }, { 7100, 0 MSO_I }, { 10800, 0 MSO_I }, { 14500, 0 MSO_I }, { 20700, 2 MSO_I }, { 21600, 0 },
+ { 0, 1 MSO_I }, { 900, 21600 }, { 7100, 21600 }, { 10800, 21600 }, { 14500, 21600 }, { 20700, 21600 }, { 21600, 1 MSO_I }
+};
+static const SvxMSDffCalculationData mso_sptTextCanDownCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, // 400
+ { 0x8000, { 21600, 0, DFF_Prop_adjustValue } }, // 401
+ { 0x4001, { 5470, 0x400, 7200 } } // 402
+};
+static const SvxMSDffHandle mso_sptTextCanDownHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 10800, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 0, 7200 }
+};
+static const sal_Int32 mso_sptTextCanDownDefault[] =
+{
+ 1, 3100
+};
+static const mso_CustomShape msoTextCanDown =
+{
+ (SvxMSDffVertPair*)mso_sptTextCanDownVert, sizeof( mso_sptTextCanDownVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextCanUpSegm, sizeof( mso_sptTextCanUpSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextCanDownCalc, sizeof( mso_sptTextCanDownCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptTextCanDownDefault,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextCanDownHandle, sizeof( mso_sptTextCanDownHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextInflateVert[] =
+{
+ { 0, 0 MSO_I }, { 4100, 1 MSO_I }, { 7300, 0 }, { 10800, 0 }, { 14300, 0 }, { 17500, 1 MSO_I }, { 21600, 0 MSO_I },
+ { 0, 2 MSO_I }, { 4100, 3 MSO_I }, { 7300, 21600 }, { 10800, 21600 }, { 14300, 21600 }, { 17500, 3 MSO_I }, { 21600, 2 MSO_I }
+};
+static const SvxMSDffCalculationData mso_sptTextInflateCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, // 400
+ { 0x4001, { 1530, 0x400, 4650 } }, // 401
+ { 0x8000, { 21600, 0, 0x400 } }, // 402
+ { 0x8000, { 21600, 0, 0x401 } } // 403
+};
+static const SvxMSDffHandle mso_sptTextInflateHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 0, 4650 }
+};
+static const sal_Int32 mso_sptTextInflateDefault[] =
+{
+ 1, 2950
+};
+static const mso_CustomShape msoTextInflate =
+{
+ (SvxMSDffVertPair*)mso_sptTextInflateVert, sizeof( mso_sptTextInflateVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextCanUpSegm, sizeof( mso_sptTextCanUpSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextInflateCalc, sizeof( mso_sptTextInflateCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptTextInflateDefault,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextInflateHandle, sizeof( mso_sptTextInflateHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextDeflateVert[] =
+{
+ { 0, 0 }, { 3500, 1 MSO_I }, { 7100, 0 MSO_I }, { 10800, 0 MSO_I }, { 14500, 0 MSO_I }, { 18100, 1 MSO_I }, { 21600, 0 },
+ { 0, 21600 }, { 3500, 3 MSO_I }, { 7100, 2 MSO_I }, { 10800, 2 MSO_I }, { 14500, 2 MSO_I }, { 18100, 3 MSO_I }, { 21600, 21600 }
+};
+static const SvxMSDffCalculationData mso_sptTextDeflateCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, // 400
+ { 0x2001, { 0x400, 5320, 7100 } }, // 401
+ { 0x8000, { 21600, 0, 0x400 } }, // 402
+ { 0x8000, { 21600, 0, 0x401 } } // 403
+};
+static const SvxMSDffHandle mso_sptTextDeflateHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 10800, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 0, 8100 }
+};
+static const mso_CustomShape msoTextDeflate =
+{
+ (SvxMSDffVertPair*)mso_sptTextDeflateVert, sizeof( mso_sptTextDeflateVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextCanUpSegm, sizeof( mso_sptTextCanUpSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextDeflateCalc, sizeof( mso_sptTextDeflateCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDefault8100,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextDeflateHandle, sizeof( mso_sptTextDeflateHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextInflateBottomVert[] =
+{
+ { 0, 0 }, { 21600, 0 },
+ { 0, 0 MSO_I }, { 3500, 3 MSO_I }, { 7300, 21600 }, { 10800, 21600 }, { 14300, 21600 }, { 18100, 3 MSO_I }, { 21600, 0 MSO_I }
+};
+static const SvxMSDffCalculationData mso_sptTextInflateBottomCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, // 400
+ { 0x2000, { 0x400, 0, 11150 } }, // 401 0->10450
+ { 0x2001, { 0x401, 3900, 10450 } }, // 402
+ { 0x2000, { 0x402, 17700, 0 } } // 403
+};
+static const sal_uInt16 mso_sptTextInflateBottomSegm[] =
+{
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x2002, 0x8000
+};
+static const SvxMSDffHandle mso_sptTextInflateBottomHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 11150, 21600 }
+};
+static const sal_Int32 mso_sptTextInflateBottomDefault[] =
+{
+ 1, 14700
+};
+static const mso_CustomShape msoTextInflateBottom =
+{
+ (SvxMSDffVertPair*)mso_sptTextInflateBottomVert, sizeof( mso_sptTextInflateBottomVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextInflateBottomSegm, sizeof( mso_sptTextInflateBottomSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextInflateBottomCalc, sizeof( mso_sptTextInflateBottomCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptTextInflateBottomDefault,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextInflateBottomHandle, sizeof( mso_sptTextInflateBottomHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextDeflateBottomVert[] =
+{
+ { 0, 0 }, { 21600, 0 },
+ { 0, 21600 }, { 2900, 3 MSO_I }, { 7200, 0 MSO_I }, { 10800, 0 MSO_I }, { 14400, 0 MSO_I }, { 18700, 3 MSO_I }, { 21600, 21600 }
+};
+static const SvxMSDffCalculationData mso_sptTextDeflateBottomCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, // 400
+ { 0x2000, { 0x400, 0, 1350 } }, // 401 0->20250
+ { 0x2001, { 0x401, 12070, 20250 } }, // 402
+ { 0x2000, { 0x402, 9530, 0 } } // 403
+};
+static const sal_uInt16 mso_sptTextDeflateBottomSegm[] =
+{
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x2002, 0x8000
+};
+static const SvxMSDffHandle mso_sptTextDeflateBottomHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 10800, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 1350, 21600 }
+};
+static const sal_Int32 mso_sptTextDeflateBottomDefault[] =
+{
+ 1, 11500
+};
+static const mso_CustomShape msoTextDeflateBottom =
+{
+ (SvxMSDffVertPair*)mso_sptTextDeflateBottomVert, sizeof( mso_sptTextDeflateBottomVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextDeflateBottomSegm, sizeof( mso_sptTextDeflateBottomSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextDeflateBottomCalc, sizeof( mso_sptTextDeflateBottomCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptTextDeflateBottomDefault,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextDeflateBottomHandle, sizeof( mso_sptTextDeflateBottomHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextInflateTopVert[] =
+{
+ { 0, 0 MSO_I }, { 3500, 1 MSO_I }, { 7300, 0 }, { 10800, 0 }, { 14300, 0 }, { 18100, 1 MSO_I }, { 21600, 0 MSO_I },
+ { 0, 21600 }, { 21600, 21600 }
+};
+static const SvxMSDffCalculationData mso_sptTextInflateTopCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, // 400
+ { 0x2001, { 0x400, 3900, 10450 } } // 401
+};
+static const sal_uInt16 mso_sptTextInflateTopSegm[] =
+{
+ 0x4000, 0x2002, 0x8000,
+ 0x4000, 0x0001, 0x8000
+};
+static const SvxMSDffHandle mso_sptTextInflateTopHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 0, 10450 }
+};
+static const sal_Int32 mso_sptTextInflateTopDefault[] =
+{
+ 1, 6900
+};
+static const mso_CustomShape msoTextInflateTop =
+{
+ (SvxMSDffVertPair*)mso_sptTextInflateTopVert, sizeof( mso_sptTextInflateTopVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextInflateTopSegm, sizeof( mso_sptTextInflateTopSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextInflateTopCalc, sizeof( mso_sptTextInflateTopCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptTextInflateTopDefault,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextInflateTopHandle, sizeof( mso_sptTextInflateTopHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextDeflateTopVert[] =
+{
+ { 0, 0 }, { 2900, 1 MSO_I }, { 7200, 0 MSO_I }, { 10800, 0 MSO_I }, { 14400, 0 MSO_I }, { 18700, 1 MSO_I }, { 21600, 0 },
+ { 0, 21600 }, { 21600, 21600 }
+};
+static const SvxMSDffCalculationData mso_sptTextDeflateTopCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, // 400
+ { 0x2001, { 0x400, 12070, 20250 } } // 402
+};
+static const sal_uInt16 mso_sptTextDeflateTopSegm[] =
+{
+ 0x4000, 0x2002, 0x8000,
+ 0x4000, 0x0001, 0x8000
+};
+static const SvxMSDffHandle mso_sptTextDeflateTopHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 10800, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 0, 20250 }
+};
+static const sal_Int32 mso_sptTextDeflateTopDefault[] =
+{
+ 1, 10100
+};
+static const mso_CustomShape msoTextDeflateTop =
+{
+ (SvxMSDffVertPair*)mso_sptTextDeflateTopVert, sizeof( mso_sptTextDeflateTopVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextDeflateTopSegm, sizeof( mso_sptTextDeflateTopSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextDeflateTopCalc, sizeof( mso_sptTextDeflateTopCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptTextDeflateTopDefault,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextDeflateTopHandle, sizeof( mso_sptTextDeflateTopHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextDeflateInflateVert[] =
+{
+ { 0, 0 }, { 21600, 0 },
+ { 0, 10100 }, { 3300, 3 MSO_I }, { 7100, 5 MSO_I }, { 10800, 5 MSO_I }, { 14500, 5 MSO_I }, { 18300, 3 MSO_I }, { 21600, 10100 },
+ { 0, 11500 }, { 3300, 4 MSO_I }, { 7100, 6 MSO_I }, { 10800, 6 MSO_I }, { 14500, 6 MSO_I }, { 18300, 4 MSO_I }, { 21600, 11500 },
+ { 0, 21600 }, { 21600, 21600 }
+};
+static const SvxMSDffCalculationData mso_sptTextDeflateInflateCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, // 400
+ { 0x8000, { 10800, 0, 0x400 } }, // 401
+ { 0x2001, { 0x401, 5770, 9500 } }, // 402
+ { 0x8000, { 10100, 0, 0x402 } }, // 403
+ { 0x8000, { 11500, 0, 0x402 } }, // 404
+ { 0x2000, { 0x400, 0, 700 } }, // 405
+ { 0x2000, { 0x400, 700, 0 } } // 406
+};
+static const sal_uInt16 mso_sptTextDeflateInflateSegm[] =
+{
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x2002, 0x8000,
+ 0x4000, 0x2002, 0x8000,
+ 0x4000, 0x0001, 0x8000
+};
+static const SvxMSDffHandle mso_sptTextDeflateInflateHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 10800, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 1300, 20300 }
+};
+static const sal_Int32 mso_sptTextDeflateInflateDefault[] =
+{
+ 1, 6500
+};
+static const mso_CustomShape msoTextDeflateInflate =
+{
+ (SvxMSDffVertPair*)mso_sptTextDeflateInflateVert, sizeof( mso_sptTextDeflateInflateVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextDeflateInflateSegm, sizeof( mso_sptTextDeflateInflateSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextDeflateInflateCalc, sizeof( mso_sptTextDeflateInflateCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptTextDeflateInflateDefault,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextDeflateInflateHandle, sizeof( mso_sptTextDeflateInflateHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextDeflateInflateDeflateVert[] =
+{
+ { 0, 0 }, { 21600, 0 },
+ { 0, 6600 }, { 3600, 3 MSO_I }, { 7250, 4 MSO_I }, { 10800, 4 MSO_I }, { 14350, 4 MSO_I }, { 18000, 3 MSO_I }, { 21600, 6600 },
+ { 0, 7500 }, { 3600, 5 MSO_I }, { 7250, 6 MSO_I }, { 10800, 6 MSO_I }, { 14350, 6 MSO_I }, { 18000, 5 MSO_I }, { 21600, 7500 },
+ { 0, 14100 }, { 3600, 9 MSO_I }, { 7250, 10 MSO_I }, { 10800, 10 MSO_I }, { 14350, 10 MSO_I }, { 18000, 9 MSO_I }, { 21600, 14100 },
+ { 0, 15000 }, { 3600, 7 MSO_I }, { 7250, 8 MSO_I }, { 10800, 8 MSO_I }, { 14350, 8 MSO_I }, { 18000, 7 MSO_I }, { 21600, 15000 },
+ { 0, 21600 }, { 21600, 21600 }
+};
+static const SvxMSDffCalculationData mso_sptTextDeflateInflateDeflateCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 850 } }, // 400
+ { 0x2001, { 0x400, 6120, 8700 } },
+ { 0x2000, { 0x401, 0, 4280 } },
+ { 0x4000, { 6600, 0x402, 0 } },
+ { 0x2000, { DFF_Prop_adjustValue, 0, 450 } }, // 404
+ { 0x2000, { 0x403, 900, 0 } }, // 405
+ { 0x2000, { 0x404, 900, 0 } }, // 406
+ { 0x8000, { 21600, 0, 0x403 } }, // 407
+ { 0x8000, { 21600, 0, 0x404 } }, // 408
+ { 0x8000, { 21600, 0, 0x405 } }, // 409
+ { 0x8000, { 21600, 0, 0x406 } } // 410
+};
+static const sal_uInt16 mso_sptTextDeflateInflateDeflateSegm[] =
+{
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x2002, 0x8000,
+ 0x4000, 0x2002, 0x8000,
+ 0x4000, 0x2002, 0x8000,
+ 0x4000, 0x2002, 0x8000,
+ 0x4000, 0x0001, 0x8000
+};
+static const SvxMSDffHandle mso_sptTextDeflateInflateDeflateHandle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 10800, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 850, 9550 }
+};
+static const sal_Int32 mso_sptTextDeflateInflateDeflateDefault[] =
+{
+ 1, 6050
+};
+static const mso_CustomShape msoTextDeflateInflateDeflate =
+{
+ (SvxMSDffVertPair*)mso_sptTextDeflateInflateDeflateVert, sizeof( mso_sptTextDeflateInflateDeflateVert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextDeflateInflateDeflateSegm, sizeof( mso_sptTextDeflateInflateDeflateSegm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptTextDeflateInflateDeflateCalc, sizeof( mso_sptTextDeflateInflateDeflateCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptTextDeflateInflateDeflateDefault,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptTextDeflateInflateDeflateHandle, sizeof( mso_sptTextDeflateInflateDeflateHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextWave1Vert[] = // adjustment1 : 0 - 4459
+{ // adjustment2 : 8640 - 12960
+ { 7 MSO_I, 0 MSO_I }, { 15 MSO_I, 9 MSO_I }, { 16 MSO_I, 10 MSO_I }, { 12 MSO_I, 0 MSO_I },
+ { 29 MSO_I, 1 MSO_I }, { 27 MSO_I, 28 MSO_I }, { 25 MSO_I, 26 MSO_I }, { 24 MSO_I, 1 MSO_I }
+};
+static const sal_uInt16 mso_sptTextWave1Segm[] =
+{
+ 0x4000, 0x2001, 0x8000,
+ 0x4000, 0x2001, 0x8000
+};
+static const mso_CustomShape msoTextWave1 =
+{
+ (SvxMSDffVertPair*)mso_sptTextWave1Vert, sizeof( mso_sptTextWave1Vert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextWave1Segm, sizeof( mso_sptTextWave1Segm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptWaveCalc, sizeof( mso_sptWaveCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptWaveDefault,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptWaveGluePoints, sizeof( mso_sptWaveGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptWaveHandle, sizeof( mso_sptWaveHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextWave2Vert[] = // adjustment1 : 0 - 4459
+{ // adjustment2 : 8640 - 12960
+ { 7 MSO_I, 0 MSO_I }, { 15 MSO_I, 10 MSO_I }, { 16 MSO_I, 9 MSO_I }, { 12 MSO_I, 0 MSO_I },
+ { 29 MSO_I, 1 MSO_I }, { 27 MSO_I, 26 MSO_I }, { 25 MSO_I, 28 MSO_I }, { 24 MSO_I, 1 MSO_I }
+};
+static const mso_CustomShape msoTextWave2 =
+{
+ (SvxMSDffVertPair*)mso_sptTextWave2Vert, sizeof( mso_sptTextWave2Vert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextWave1Segm, sizeof( mso_sptTextWave1Segm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptWaveCalc, sizeof( mso_sptWaveCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptWaveDefault,
+ (SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptWaveGluePoints, sizeof( mso_sptWaveGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptWaveHandle, sizeof( mso_sptWaveHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextWave3Vert[] = // adjustment1 : 0 - 2230
+{ // adjustment2 : 8640 - 12960
+ { 7 MSO_I, 0 MSO_I }, { 15 MSO_I, 9 MSO_I }, { 0x1e MSO_I, 10 MSO_I }, { 0x12 MSO_I, 0 MSO_I }, { 0x1f MSO_I, 9 MSO_I }, { 16 MSO_I, 10 MSO_I }, { 12 MSO_I, 0 MSO_I },
+ { 29 MSO_I, 1 MSO_I }, { 27 MSO_I, 28 MSO_I }, { 0x20 MSO_I, 26 MSO_I }, { 0x13 MSO_I, 1 MSO_I }, { 0x21 MSO_I, 28 MSO_I }, { 25 MSO_I, 26 MSO_I }, { 24 MSO_I, 1 MSO_I }
+};
+static const sal_uInt16 mso_sptTextWave3Segm[] =
+{
+ 0x4000, 0x2002, 0x8000,
+ 0x4000, 0x2002, 0x8000
+};
+static const mso_CustomShape msoTextWave3 =
+{
+ (SvxMSDffVertPair*)mso_sptTextWave3Vert, sizeof( mso_sptTextWave3Vert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextWave3Segm, sizeof( mso_sptTextWave3Segm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptDoubleWaveCalc, sizeof( mso_sptDoubleWaveCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDoubleWaveDefault,
+ (SvxMSDffTextRectangles*)mso_sptDoubleWaveTextRect, sizeof( mso_sptDoubleWaveTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptDoubleWaveGluePoints, sizeof( mso_sptDoubleWaveGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptDoubleWaveHandle, sizeof( mso_sptDoubleWaveHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptTextWave4Vert[] = // adjustment1 : 0 - 2230
+{ // adjustment2 : 8640 - 12960
+ { 7 MSO_I, 0 MSO_I }, { 15 MSO_I, 10 MSO_I }, { 0x1e MSO_I, 9 MSO_I }, { 0x12 MSO_I, 0 MSO_I }, { 0x1f MSO_I, 10 MSO_I }, { 16 MSO_I, 9 MSO_I }, { 12 MSO_I, 0 MSO_I },
+ { 29 MSO_I, 1 MSO_I }, { 27 MSO_I, 26 MSO_I }, { 0x20 MSO_I, 28 MSO_I }, { 0x13 MSO_I, 1 MSO_I }, { 0x21 MSO_I, 26 MSO_I }, { 25 MSO_I, 28 MSO_I }, { 24 MSO_I, 1 MSO_I }
+};
+static const mso_CustomShape msoTextWave4 =
+{
+ (SvxMSDffVertPair*)mso_sptTextWave4Vert, sizeof( mso_sptTextWave4Vert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptTextWave3Segm, sizeof( mso_sptTextWave3Segm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptDoubleWaveCalc, sizeof( mso_sptDoubleWaveCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptDoubleWaveDefault,
+ (SvxMSDffTextRectangles*)mso_sptDoubleWaveTextRect, sizeof( mso_sptDoubleWaveTextRect ) / sizeof( SvxMSDffTextRectangles ),
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ (SvxMSDffVertPair*)mso_sptDoubleWaveGluePoints, sizeof( mso_sptDoubleWaveGluePoints ) / sizeof( SvxMSDffVertPair ),
+ (SvxMSDffHandle*)mso_sptDoubleWaveHandle, sizeof( mso_sptDoubleWaveHandle ) / sizeof( SvxMSDffHandle )
+};
+
+static const sal_Int32 mso_sptCalloutDefault1[] =
+{
+ 4, -1800, 24500, -1800, 4000
+};
+static const sal_Int32 mso_sptCalloutDefault2[] =
+{
+ 4, -8300, 24500, -1800, 4000
+};
+static const sal_Int32 mso_sptCalloutDefault3[] =
+{
+ 6, -10000, 24500, -3600, 4000, -1800, 4000
+};
+static const sal_Int32 mso_sptCalloutDefault4[] =
+{
+ 8, 23400, 24500, 25200, 21600, 25200, 4000, 23400, 4000
+};
+static const SvxMSDffVertPair mso_sptCalloutVert1[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 21600 }, { 0, 21600 }, { 0 MSO_I, 1 MSO_I }, { 2 MSO_I, 3 MSO_I }
+};
+static const SvxMSDffHandle mso_sptCalloutHandle1[] =
+{
+ { 0,
+ 0x100, 0x101, 10800, 10800, 0x80000000, 0x7fffffff, 0x80000000, 0x7fffffff },
+ { 0,
+ 0x102, 0x103, 10800, 10800, 0x80000000, 0x7fffffff, 0x80000000, 0x7fffffff }
+};
+static const sal_uInt16 mso_sptCalloutSegm1a[] =
+{
+ 0x4000, 0x0003, 0x6000, 0x8000,
+ 0x4000, 0x0001, 0x8000
+};
+static const sal_uInt16 mso_sptCalloutSegm1b[] =
+{
+ 0x4000, 0xab00, 0x0003, 0x6000, 0x8000, // NO STROKE
+ 0x4000, 0x0001, 0x8000
+};
+static const SvxMSDffVertPair mso_sptCallout1Vert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 21600 }, { 0, 21600 }, { 0 MSO_I, 1 MSO_I }, { 2 MSO_I, 3 MSO_I }, { 2 MSO_I, 0 }, { 2 MSO_I, 21600 }
+};
+static const sal_uInt16 mso_sptCallout1Segm1a[] =
+{
+ 0x4000, 0x0003, 0x6000, 0x8000,
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x0001, 0x8000
+};
+static const sal_uInt16 mso_sptCallout1Segm1b[] =
+{
+ 0x4000, 0xab00, 0x0003, 0x6000, 0x8000, // NO STROKE
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x0001, 0x8000
+};
+static const SvxMSDffVertPair mso_sptCallout2Verta[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 21600 }, { 0, 21600 }, { 0 MSO_I, 1 MSO_I }, { 2 MSO_I, 3 MSO_I }, { 2 MSO_I, 3 MSO_I }, { 4 MSO_I, 5 MSO_I }
+};
+static const SvxMSDffVertPair mso_sptCallout2Vertb[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 21600 }, { 0, 21600 }, { 0 MSO_I, 1 MSO_I }, { 2 MSO_I, 3 MSO_I }, { 2 MSO_I, 3 MSO_I }, { 4 MSO_I, 5 MSO_I }, { 4 MSO_I, 0 }, { 4 MSO_I, 21600 }
+};
+static const SvxMSDffHandle mso_sptCalloutHandle2[] =
+{
+ { 0,
+ 0x100, 0x101, 10800, 10800, 0x80000000, 0x7fffffff, 0x80000000, 0x7fffffff },
+ { 0,
+ 0x102, 0x103, 10800, 10800, 0x80000000, 0x7fffffff, 0x80000000, 0x7fffffff },
+ { 0,
+ 0x104, 0x105, 10800, 10800, 0x80000000, 0x7fffffff, 0x80000000, 0x7fffffff }
+};
+static const sal_uInt16 mso_sptCallout2Segm1a[] =
+{
+ 0x4000, 0x0003, 0x6000, 0x8000,
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x0001, 0x8000
+};
+static const sal_uInt16 mso_sptCallout2Segm1b[] =
+{
+ 0x4000, 0xab00, 0x0003, 0x6000, 0x8000, // NO STROKE
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x0001, 0x8000
+};
+static const sal_uInt16 mso_sptCallout2Segm1c[] =
+{
+ 0x4000, 0x0003, 0x6000, 0x8000,
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x0001, 0x8000
+};
+static const sal_uInt16 mso_sptCallout2Segm1d[] =
+{
+ 0x4000, 0xab00, 0x0003, 0x6000, 0x8000, // NO STROKE
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x0001, 0x8000,
+ 0x4000, 0x0001, 0x8000
+};
+static const SvxMSDffVertPair mso_sptCallout3Verta[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 21600 }, { 0, 21600 }, { 6 MSO_I, 7 MSO_I }, { 4 MSO_I, 5 MSO_I }, { 2 MSO_I, 3 MSO_I }, { 0 MSO_I, 1 MSO_I }
+};
+static const SvxMSDffVertPair mso_sptCallout3Vertb[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 21600 }, { 0, 21600 }, { 6 MSO_I, 7 MSO_I }, { 4 MSO_I, 5 MSO_I }, { 2 MSO_I, 3 MSO_I }, { 0 MSO_I, 1 MSO_I }, { 6 MSO_I, 0 }, { 6 MSO_I, 21600 }
+};
+static const SvxMSDffHandle mso_sptCalloutHandle3[] =
+{
+ { 0,
+ 0x100, 0x101, 10800, 10800, 0x80000000, 0x7fffffff, 0x80000000, 0x7fffffff },
+ { 0,
+ 0x102, 0x103, 10800, 10800, 0x80000000, 0x7fffffff, 0x80000000, 0x7fffffff },
+ { 0,
+ 0x104, 0x105, 10800, 10800, 0x80000000, 0x7fffffff, 0x80000000, 0x7fffffff },
+ { 0,
+ 0x106, 0x107, 10800, 10800, 0x80000000, 0x7fffffff, 0x80000000, 0x7fffffff }
+};
+static const sal_uInt16 mso_sptCallout3Segm1a[] =
+{
+ 0x4000, 0x0003, 0x6000, 0x8000,
+ 0x4000, 0xaa00, 0x0003, 0x8000 // NO_FILL
+};
+static const sal_uInt16 mso_sptCallout3Segm1b[] =
+{
+ 0x4000, 0xab00, 0x0003, 0x6000, 0x8000, // NO STROKE
+ 0x4000, 0xaa00, 0x0003, 0x8000 // NO FILL
+};
+static const sal_uInt16 mso_sptCallout3Segm1c[] =
+{
+ 0x4000, 0x0003, 0x6000, 0x8000,
+ 0x4000, 0xaa00, 0x0003, 0x8000, // NO FILL
+ 0x4000, 0x0001, 0x8000
+};
+static const sal_uInt16 mso_sptCallout3Segm1d[] =
+{
+ 0x4000, 0xab00, 0x0003, 0x6000, 0x8000, // NO STROKE
+ 0x4000, 0xaa00, 0x0003, 0x8000, // NO FILL
+ 0x4000, 0x0001, 0x8000
+};
+
+static const SvxMSDffCalculationData mso_sptCalloutCalc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust3Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust4Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust5Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust6Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust7Value, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust8Value, 0, 0 } }
+};
+
+static const mso_CustomShape msoCallout90 =
+{
+ (SvxMSDffVertPair*)mso_sptCalloutVert1, sizeof( mso_sptCalloutVert1 ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCalloutSegm1b, sizeof( mso_sptCalloutSegm1b ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCalloutCalc, sizeof( mso_sptCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptCalloutDefault1,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptCalloutHandle1, sizeof( mso_sptCalloutHandle1 ) / sizeof( SvxMSDffHandle )
+};
+static const mso_CustomShape msoCallout1 =
+{
+ (SvxMSDffVertPair*)mso_sptCalloutVert1, sizeof( mso_sptCalloutVert1 ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCalloutSegm1b, sizeof( mso_sptCalloutSegm1b ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCalloutCalc, sizeof( mso_sptCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptCalloutDefault2,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptCalloutHandle1, sizeof( mso_sptCalloutHandle1 ) / sizeof( SvxMSDffHandle )
+};
+static const mso_CustomShape msoCallout2 =
+{
+ (SvxMSDffVertPair*)mso_sptCallout2Verta, sizeof( mso_sptCallout2Verta ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCallout2Segm1b, sizeof( mso_sptCallout2Segm1b ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCalloutCalc, sizeof( mso_sptCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptCalloutDefault3,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptCalloutHandle2, sizeof( mso_sptCalloutHandle2 ) / sizeof( SvxMSDffHandle )
+};
+static const mso_CustomShape msoCallout3 =
+{
+ (SvxMSDffVertPair*)mso_sptCallout3Verta, sizeof( mso_sptCallout3Verta ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCallout3Segm1b, sizeof( mso_sptCallout3Segm1b ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCalloutCalc, sizeof( mso_sptCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptCalloutDefault4,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptCalloutHandle3, sizeof( mso_sptCalloutHandle3 ) / sizeof( SvxMSDffHandle )
+};
+static const mso_CustomShape msoAccentCallout90 =
+{
+ (SvxMSDffVertPair*)mso_sptCalloutVert1, sizeof( mso_sptCalloutVert1 ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCalloutSegm1b, sizeof( mso_sptCalloutSegm1b ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCalloutCalc, sizeof( mso_sptCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptCalloutDefault1,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptCalloutHandle1, sizeof( mso_sptCalloutHandle1 ) / sizeof( SvxMSDffHandle )
+};
+static const mso_CustomShape msoAccentCallout1 =
+{
+ (SvxMSDffVertPair*)mso_sptCallout1Vert, sizeof( mso_sptCallout1Vert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCallout1Segm1b, sizeof( mso_sptCallout1Segm1b ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCalloutCalc, sizeof( mso_sptCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptCalloutDefault2,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptCalloutHandle1, sizeof( mso_sptCalloutHandle1 ) / sizeof( SvxMSDffHandle )
+};
+static const mso_CustomShape msoAccentCallout2 =
+{
+ (SvxMSDffVertPair*)mso_sptCallout2Vertb, sizeof( mso_sptCallout2Vertb ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCallout2Segm1d, sizeof( mso_sptCallout2Segm1d ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCalloutCalc, sizeof( mso_sptCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptCalloutDefault3,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptCalloutHandle2, sizeof( mso_sptCalloutHandle2 ) / sizeof( SvxMSDffHandle )
+};
+static const mso_CustomShape msoAccentCallout3 =
+{
+ (SvxMSDffVertPair*)mso_sptCallout3Vertb, sizeof( mso_sptCallout3Vertb ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCallout3Segm1d, sizeof( mso_sptCallout3Segm1d ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCalloutCalc, sizeof( mso_sptCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptCalloutDefault4,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptCalloutHandle3, sizeof( mso_sptCalloutHandle3 ) / sizeof( SvxMSDffHandle )
+};
+static const mso_CustomShape msoBorderCallout90 =
+{
+ (SvxMSDffVertPair*)mso_sptCalloutVert1, sizeof( mso_sptCalloutVert1 ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCalloutSegm1a, sizeof( mso_sptCalloutSegm1a ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCalloutCalc, sizeof( mso_sptCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptCalloutDefault1,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptCalloutHandle1, sizeof( mso_sptCalloutHandle1 ) / sizeof( SvxMSDffHandle )
+};
+static const mso_CustomShape msoBorderCallout1 =
+{
+ (SvxMSDffVertPair*)mso_sptCalloutVert1, sizeof( mso_sptCalloutVert1 ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCalloutSegm1a, sizeof( mso_sptCalloutSegm1a ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCalloutCalc, sizeof( mso_sptCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptCalloutDefault2,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptCalloutHandle1, sizeof( mso_sptCalloutHandle1 ) / sizeof( SvxMSDffHandle )
+};
+static const mso_CustomShape msoBorderCallout2 =
+{
+ (SvxMSDffVertPair*)mso_sptCallout2Verta, sizeof( mso_sptCallout2Verta ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCallout2Segm1a, sizeof( mso_sptCallout2Segm1a ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCalloutCalc, sizeof( mso_sptCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptCalloutDefault3,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptCalloutHandle2, sizeof( mso_sptCalloutHandle2 ) / sizeof( SvxMSDffHandle )
+};
+static const mso_CustomShape msoBorderCallout3 =
+{
+ (SvxMSDffVertPair*)mso_sptCallout3Verta, sizeof( mso_sptCallout3Verta ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCallout3Segm1a, sizeof( mso_sptCallout3Segm1a ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCalloutCalc, sizeof( mso_sptCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptCalloutDefault4,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptCalloutHandle3, sizeof( mso_sptCalloutHandle3 ) / sizeof( SvxMSDffHandle )
+};
+static const mso_CustomShape msoAccentBorderCallout90 =
+{
+ (SvxMSDffVertPair*)mso_sptCalloutVert1, sizeof( mso_sptCalloutVert1 ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCalloutSegm1a, sizeof( mso_sptCalloutSegm1a ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCalloutCalc, sizeof( mso_sptCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptCalloutDefault1,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptCalloutHandle1, sizeof( mso_sptCalloutHandle1 ) / sizeof( SvxMSDffHandle )
+};
+static const mso_CustomShape msoAccentBorderCallout1 =
+{
+ (SvxMSDffVertPair*)mso_sptCallout1Vert, sizeof( mso_sptCallout1Vert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCallout1Segm1a, sizeof( mso_sptCallout1Segm1a ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCalloutCalc, sizeof( mso_sptCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptCalloutDefault2,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptCalloutHandle1, sizeof( mso_sptCalloutHandle1 ) / sizeof( SvxMSDffHandle )
+};
+static const mso_CustomShape msoAccentBorderCallout2 =
+{
+ (SvxMSDffVertPair*)mso_sptCallout2Vertb, sizeof( mso_sptCallout2Vertb ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCallout2Segm1c, sizeof( mso_sptCallout2Segm1c ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCalloutCalc, sizeof( mso_sptCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptCalloutDefault3,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptCalloutHandle2, sizeof( mso_sptCalloutHandle2 ) / sizeof( SvxMSDffHandle )
+};
+static const mso_CustomShape msoAccentBorderCallout3 =
+{
+ (SvxMSDffVertPair*)mso_sptCallout3Vertb, sizeof( mso_sptCallout3Vertb ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCallout3Segm1c, sizeof( mso_sptCallout3Segm1c ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCalloutCalc, sizeof( mso_sptCalloutCalc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptCalloutDefault4,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptCalloutHandle3, sizeof( mso_sptCalloutHandle3 ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptStraightConnector1Vert[] =
+{
+ { 0, 0 }, { 21600, 21600 }
+};
+static const sal_uInt16 mso_sptStraightConnector1Segm[] =
+{
+ 0x4000, 0x0001, 0x8000
+};
+static const mso_CustomShape msoStraightConnector1 =
+{
+ (SvxMSDffVertPair*)mso_sptStraightConnector1Vert, sizeof( mso_sptStraightConnector1Vert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptStraightConnector1Segm, sizeof( mso_sptStraightConnector1Segm ) >> 1,
+ (SvxMSDffCalculationData*)NULL, 0,
+ (sal_Int32*)NULL,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)NULL, 0
+};
+
+static const SvxMSDffVertPair mso_sptBentConnector2Vert[] =
+{
+ { 0, 0 }, { 21600, 0 }, { 21600, 21600 }
+};
+static const sal_uInt16 mso_sptBentConnector2Segm[] =
+{
+ 0x4000, 0x0002, 0x8000
+};
+static const mso_CustomShape msoBentConnector2 =
+{
+ (SvxMSDffVertPair*)mso_sptBentConnector2Vert, sizeof( mso_sptBentConnector2Vert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptBentConnector2Segm, sizeof( mso_sptBentConnector2Segm ) >> 1,
+ (SvxMSDffCalculationData*)NULL, 0,
+ (sal_Int32*)NULL,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)NULL, 0
+};
+
+static const SvxMSDffVertPair mso_sptBentConnector3Vert[] =
+{
+ { 0, 0 }, { 0 MSO_I, 0 }, { 0 MSO_I, 21600 }, { 21600, 21600 }
+};
+static const sal_uInt16 mso_sptBentConnector3Segm[] =
+{
+ 0x4000, 0x0003, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptBentConnector3Calc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } }
+};
+static const sal_Int32 mso_sptBentConnector3Default[] =
+{
+ 1, 10800
+};
+static const SvxMSDffHandle mso_sptBentConnector3Handle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 10800, 10800, 10800, 0x80000000, 0x7fffffff, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoBentConnector3 =
+{
+ (SvxMSDffVertPair*)mso_sptBentConnector3Vert, sizeof( mso_sptBentConnector3Vert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptBentConnector3Segm, sizeof( mso_sptBentConnector3Segm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptBentConnector3Calc, sizeof( mso_sptBentConnector3Calc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptBentConnector3Default,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptBentConnector3Handle, sizeof( mso_sptBentConnector3Handle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptBentConnector4Vert[] =
+{
+ { 0, 0 }, { 0 MSO_I, 0 }, { 0 MSO_I, 1 MSO_I }, { 21600, 1 MSO_I }, { 21600, 21600 }
+};
+static const sal_uInt16 mso_sptBentConnector4Segm[] =
+{
+ 0x4000, 0x0004, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptBentConnector4Calc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } },
+ { 0x2000, { 0x400, 21600, 0 } },
+ { 0x2001, { 0x402, 1, 2 } },
+ { 0x2001, { 0x401, 1, 2 } }
+};
+static const sal_Int32 mso_sptBentConnector4Default[] =
+{
+ 2, 10800, 10800
+};
+static const SvxMSDffHandle mso_sptBentConnector4Handle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL,
+ 0x100, 4 + 3, 10800, 10800, 0x80000000, 0x7fffffff, 4 + 3, 4 + 3 },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL,
+ 3 + 3, 0x101, 10800, 10800, 3 + 3, 3 + 3, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoBentConnector4 =
+{
+ (SvxMSDffVertPair*)mso_sptBentConnector4Vert, sizeof( mso_sptBentConnector4Vert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptBentConnector4Segm, sizeof( mso_sptBentConnector4Segm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptBentConnector4Calc, sizeof( mso_sptBentConnector4Calc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptBentConnector4Default,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptBentConnector4Handle, sizeof( mso_sptBentConnector4Handle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptBentConnector5Vert[] =
+{
+ { 0, 0 }, { 0 MSO_I, 0 }, { 0 MSO_I, 4 MSO_I }, { 1 MSO_I, 4 MSO_I }, { 1 MSO_I, 21600 }, { 21600, 21600 }
+};
+static const sal_uInt16 mso_sptBentConnector5Segm[] =
+{
+ 0x4000, 0x0005, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptBentConnector5Calc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust3Value, 0, 0 } },
+ { 0x6000, { 0x400, 0x401, 0 } },
+ { 0x2001, { 0x402, 1, 2 } },
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } },
+ { 0x2001, { 0x404, 1, 2 } },
+ { 0x4000, { 21600, 0x404, 0 } },
+ { 0x2001, { 0x406, 1, 2 } }
+};
+static const sal_Int32 mso_sptBentConnector5Default[] =
+{
+ 3, 10800, 10800, 10800
+};
+static const SvxMSDffHandle mso_sptBentConnector5Handle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL,
+ 0x100, 5 + 3, 10800, 10800, 0x80000000, 0x7fffffff, 5 + 3, 5 + 3 },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL,
+ 3 + 3, 0x101, 10800, 10800, 3 + 3, 3 + 3, 0x80000000, 0x7fffffff },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL,
+ 0x102, 7 + 3, 10800, 10800, 0x80000000, 0x7fffffff, 7 + 3, 7 + 3 }
+};
+static const mso_CustomShape msoBentConnector5 =
+{
+ (SvxMSDffVertPair*)mso_sptBentConnector5Vert, sizeof( mso_sptBentConnector5Vert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptBentConnector5Segm, sizeof( mso_sptBentConnector5Segm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptBentConnector5Calc, sizeof( mso_sptBentConnector5Calc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptBentConnector5Default,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptBentConnector5Handle, sizeof( mso_sptBentConnector5Handle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptCurvedConnector2Vert[] =
+{
+ { 0, 0 }, { 10800, 0 }, { 21600, 10800 }, { 21600, 21600 }
+};
+static const sal_uInt16 mso_sptCurvedConnector2Segm[] =
+{
+ 0x4000, 0x2001, 0x8000
+};
+static const mso_CustomShape msoCurvedConnector2 =
+{
+ (SvxMSDffVertPair*)mso_sptCurvedConnector2Vert, sizeof( mso_sptCurvedConnector2Vert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCurvedConnector2Segm, sizeof( mso_sptCurvedConnector2Segm ) >> 1,
+ (SvxMSDffCalculationData*)NULL, 0,
+ (sal_Int32*)NULL,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)NULL, 0
+};
+
+static const SvxMSDffVertPair mso_sptCurvedConnector3Vert[] =
+{
+ { 0, 0 }, { 1 MSO_I, 0 }, { 0 MSO_I, 5400 }, { 0 MSO_I, 10800 }, { 0 MSO_I, 16200 }, { 3 MSO_I, 21600 }, { 21600, 21600 }
+};
+static const sal_uInt16 mso_sptCurvedConnector3Segm[] =
+{
+ 0x4000, 0x2002, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptCurvedConnector3Calc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x2001, { 0x400, 1, 2 } },
+ { 0x2000, { 0x400, 21600, 0 } },
+ { 0x2001, { 0x402, 1, 2 } }
+};
+static const sal_Int32 mso_sptCurvedConnector3Default[] =
+{
+ 1, 10800
+};
+static const SvxMSDffHandle mso_sptCurvedConnector3Handle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE,
+ 0x100, 10800, 10800, 10800, 0x80000000, 0x7fffffff, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoCurvedConnector3 =
+{
+ (SvxMSDffVertPair*)mso_sptCurvedConnector3Vert, sizeof( mso_sptCurvedConnector3Vert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCurvedConnector3Segm, sizeof( mso_sptCurvedConnector3Segm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCurvedConnector3Calc, sizeof( mso_sptCurvedConnector3Calc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptCurvedConnector3Default,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptCurvedConnector3Handle, sizeof( mso_sptCurvedConnector3Handle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptCurvedConnector4Vert[] =
+{
+ { 0, 0 }, { 1 MSO_I, 0 }, { 0 MSO_I, 10 MSO_I }, { 0 MSO_I, 9 MSO_I },
+ { 0 MSO_I, 12 MSO_I }, { 5 MSO_I, 8 MSO_I }, { 3 MSO_I, 8 MSO_I },
+ { 7 MSO_I, 8 MSO_I }, { 21600, 14 MSO_I }, { 21600, 21600 }
+
+};
+static const sal_uInt16 mso_sptCurvedConnector4Segm[] =
+{
+ 0x4000, 0x2003, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptCurvedConnector4Calc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x2001, { 0x400, 1, 2 } },
+ { 0x4000, { 21600, 0x400, 0 } },
+ { 0x2001, { 0x402, 1, 2 } },
+ { 0x6000, { 0x400, 0x403, 0 } },
+ { 0x2001, { 0x404, 1, 2 } },
+ { 0x2000, { 0x403, 21600, 0 } },
+ { 0x2001, { 0x406, 1, 2 } },
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } },
+ { 0x2001, { DFF_Prop_adjust2Value, 1, 2 } },
+ { 0x2001, { DFF_Prop_adjust2Value, 1, 4 } },
+ { 0x6000, { 0x408, 0x409, 0 } },
+ { 0x2001, { 0x40b, 1, 2 } },
+ { 0x2000, { 0x408, 21600, 0 } },
+ { 0x2001, { 0x40d, 1, 2 } }
+};
+static const sal_Int32 mso_sptCurvedConnector4Default[] =
+{
+ 2, 10800, 10800
+};
+static const SvxMSDffHandle mso_sptCurvedConnector4Handle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL,
+ 0x100, 9 + 3, 10800, 10800, 0x80000000, 0x7fffffff, 9 + 3, 9 + 3 },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL,
+ 3 + 3, 0x101, 10800, 10800, 3 + 3, 3 + 3, 0x80000000, 0x7fffffff }
+};
+static const mso_CustomShape msoCurvedConnector4 =
+{
+ (SvxMSDffVertPair*)mso_sptCurvedConnector4Vert, sizeof( mso_sptCurvedConnector4Vert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCurvedConnector4Segm, sizeof( mso_sptCurvedConnector4Segm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCurvedConnector4Calc, sizeof( mso_sptCurvedConnector4Calc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptCurvedConnector4Default,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptCurvedConnector4Handle, sizeof( mso_sptCurvedConnector4Handle ) / sizeof( SvxMSDffHandle )
+};
+
+static const SvxMSDffVertPair mso_sptCurvedConnector5Vert[] =
+{
+ { 0, 0 },
+ { 21 MSO_I, 0 }, { 0 MSO_I, 12 MSO_I }, { 0 MSO_I, 11 MSO_I },
+ { 0 MSO_I, 14 MSO_I }, { 6 MSO_I, 4 MSO_I }, { 3 MSO_I, 4 MSO_I },
+ { 8 MSO_I, 4 MSO_I }, { 1 MSO_I, 18 MSO_I }, { 1 MSO_I, 16 MSO_I },
+ { 1 MSO_I, 20 MSO_I }, { 10 MSO_I, 21600 }, { 21600, 21600 }
+};
+static const sal_uInt16 mso_sptCurvedConnector5Segm[] =
+{
+ 0x4000, 0x2004, 0x8000
+};
+static const SvxMSDffCalculationData mso_sptCurvedConnector5Calc[] =
+{
+ { 0x2000, { DFF_Prop_adjustValue, 0, 0 } },
+ { 0x2000, { DFF_Prop_adjust3Value, 0, 0 } },
+ { 0x6000, { 0x400, 0x401, 0 } },
+ { 0x2001, { 0x402, 1, 2 } },
+ { 0x2000, { DFF_Prop_adjust2Value, 0, 0 } },
+ { 0x6000, { 0x400, 0x403, 0 } },
+ { 0x2001, { 0x405, 1, 2 } },
+ { 0x6000, { 0x401, 0x403, 0 } },
+ { 0x2001, { 0x407, 1, 2 } },
+ { 0x2000, { 0x401, 21600, 0 } },
+ { 0x2001, { 0x409, 1, 2 } },
+ { 0x2001, { 0x404, 1, 2 } },
+ { 0x2001, { 0x40b, 1, 2 } },
+ { 0x6000, { 0x404, 0x40b, 0 } },
+ { 0x2001, { 0x40d, 1, 2 } },
+ { 0x2000, { 0x404, 21600, 0 } },
+ { 0x2001, { 0x40f, 1, 2 } },
+ { 0x6000, { 0x404, 0x410, 0 } },
+ { 0x2001, { 0x411, 1, 2 } },
+ { 0x2000, { 0x410, 21600, 0 } },
+ { 0x2001, { 0x413, 1, 2 } },
+ { 0x2001, { 0x400, 1, 2 } }
+};
+static const sal_Int32 mso_sptCurvedConnector5Default[] =
+{
+ 3, 10800, 10800, 10800
+};
+static const SvxMSDffHandle mso_sptCurvedConnector5Handle[] =
+{
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL,
+ 0x100, 11 + 3, 10800, 10800, 0x80000000, 0x7fffffff, 11 + 3, 11 + 3 },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL,
+ 3 + 3, 0x101, 10800, 10800, 3 + 3, 3 + 3, 0x80000000, 0x7fffffff },
+ { MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL,
+ 0x102, 16 + 3, 10800, 10800, 0x80000000, 0x7fffffff, 16 + 3, 16 + 3 }
+};
+static const mso_CustomShape msoCurvedConnector5 =
+{
+ (SvxMSDffVertPair*)mso_sptCurvedConnector5Vert, sizeof( mso_sptCurvedConnector5Vert ) / sizeof( SvxMSDffVertPair ),
+ (sal_uInt16*)mso_sptCurvedConnector5Segm, sizeof( mso_sptCurvedConnector5Segm ) >> 1,
+ (SvxMSDffCalculationData*)mso_sptCurvedConnector5Calc, sizeof( mso_sptCurvedConnector5Calc ) / sizeof( SvxMSDffCalculationData ),
+ (sal_Int32*)mso_sptCurvedConnector5Default,
+ NULL, 0,
+ 21600, 21600,
+ 0x80000000, 0x80000000,
+ NULL, 0,
+ (SvxMSDffHandle*)mso_sptCurvedConnector5Handle, sizeof( mso_sptCurvedConnector5Handle ) / sizeof( SvxMSDffHandle )
+};
+
+const mso_CustomShape* GetCustomShapeContent( MSO_SPT eSpType )
+{
+ const mso_CustomShape* pCustomShape = NULL;
+ switch( eSpType )
+ {
+ case mso_sptArc : pCustomShape = &msoArc; break;
+ case mso_sptRectangle : pCustomShape = &msoRectangle; break;
+ case mso_sptParallelogram : pCustomShape = &msoParallelogram; break;
+ case mso_sptTrapezoid : pCustomShape = &msoTrapezoid; break;
+ case mso_sptDiamond : pCustomShape = &msoDiamond; break;
+ case mso_sptRoundRectangle : pCustomShape = &msoRoundRectangle; break;
+ case mso_sptOctagon : pCustomShape = &msoOctagon; break;
+ case mso_sptIsocelesTriangle : pCustomShape = &msoIsocelesTriangle; break;
+ case mso_sptRightTriangle : pCustomShape = &msoRightTriangle; break;
+ case mso_sptEllipse : pCustomShape = &msoEllipse; break;
+ case mso_sptHexagon : pCustomShape = &msoHexagon; break;
+ case mso_sptPlus : pCustomShape = &msoPlus; break;
+ case mso_sptPentagon : pCustomShape = &msoPentagon; break;
+ case mso_sptCan : pCustomShape = &msoCan; break;
+ case mso_sptCube : pCustomShape = &msoCube; break;
+ case mso_sptBalloon : pCustomShape = &msoBalloon; break;
+ case mso_sptActionButtonBlank : pCustomShape = &msoActionButtonBlank; break;
+ case mso_sptActionButtonHome : pCustomShape = &msoActionButtonHome; break;
+ case mso_sptActionButtonHelp : pCustomShape = &msoActionButtonHelp; break;
+ case mso_sptActionButtonInformation : pCustomShape = &msoActionButtonInformation; break;
+ case mso_sptActionButtonBackPrevious : pCustomShape = &msoActionButtonBackPrevious; break;
+ case mso_sptActionButtonForwardNext : pCustomShape = &msoActionButtonForwardNext; break;
+ case mso_sptActionButtonBeginning : pCustomShape = &msoActionButtonBeginning; break;
+ case mso_sptActionButtonEnd : pCustomShape = &msoActionButtonEnd; break;
+ case mso_sptActionButtonReturn : pCustomShape = &msoActionButtonReturn; break;
+ case mso_sptActionButtonDocument : pCustomShape = &msoActionButtonDocument; break;
+ case mso_sptActionButtonSound : pCustomShape = &msoActionButtonSound; break;
+ case mso_sptActionButtonMovie : pCustomShape = &msoActionButtonMovie; break;
+ case mso_sptBevel : pCustomShape = &msoBevel; break;
+ case mso_sptFoldedCorner : pCustomShape = &msoFoldedCorner; break;
+ case mso_sptSmileyFace : pCustomShape = &msoSmileyFace; break;
+ case mso_sptDonut : pCustomShape = &msoDonut; break;
+ case mso_sptNoSmoking : pCustomShape = &msoNoSmoking; break;
+ case mso_sptBlockArc : pCustomShape = &msoBlockArc; break;
+ case mso_sptHeart : pCustomShape = &msoHeart; break;
+ case mso_sptLightningBolt : pCustomShape = &msoLightningBold; break;
+ case mso_sptSun : pCustomShape = &msoSun; break;
+ case mso_sptMoon : pCustomShape = &msoMoon; break;
+ case mso_sptBracketPair : pCustomShape = &msoBracketPair; break;
+ case mso_sptBracePair : pCustomShape = &msoBracePair; break;
+ case mso_sptPlaque : pCustomShape = &msoPlaque; break;
+ case mso_sptLeftBracket : pCustomShape = &msoLeftBracket; break;
+ case mso_sptRightBracket : pCustomShape = &msoRightBracket; break;
+ case mso_sptLeftBrace : pCustomShape = &msoLeftBrace; break;
+ case mso_sptRightBrace : pCustomShape = &msoRightBrace; break;
+ case mso_sptArrow : pCustomShape = &msoArrow; break;
+ case mso_sptUpArrow : pCustomShape = &msoUpArrow; break;
+ case mso_sptDownArrow : pCustomShape = &msoDownArrow; break;
+ case mso_sptLeftArrow : pCustomShape = &msoLeftArrow; break;
+ case mso_sptLeftRightArrow : pCustomShape = &msoLeftRightArrow; break;
+ case mso_sptUpDownArrow : pCustomShape = &msoUpDownArrow; break;
+ case mso_sptQuadArrow : pCustomShape = &msoQuadArrow; break;
+ case mso_sptLeftRightUpArrow : pCustomShape = &msoLeftRightUpArrow; break;
+ case mso_sptBentArrow : pCustomShape = &msoBentArrow; break;
+ case mso_sptUturnArrow : pCustomShape = &msoUturnArrow; break;
+ case mso_sptLeftUpArrow : pCustomShape = &msoLeftUpArrow; break;
+ case mso_sptBentUpArrow : pCustomShape = &msoBentUpArrow; 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;
+ case mso_sptChevron : pCustomShape = &msoChevron; break;
+ case mso_sptRightArrowCallout : pCustomShape = &msoRightArrowCallout; break;
+ case mso_sptLeftArrowCallout : pCustomShape = &msoLeftArrowCallout; break;
+ case mso_sptUpArrowCallout : pCustomShape = &msoUpArrowCallout; break;
+ case mso_sptDownArrowCallout : pCustomShape = &msoDownArrowCallout; break;
+ case mso_sptLeftRightArrowCallout : pCustomShape = &msoLeftRightArrowCallout; break;
+ case mso_sptUpDownArrowCallout : pCustomShape = &msoUpDownArrowCallout; break;
+ case mso_sptQuadArrowCallout : pCustomShape = &msoQuadArrowCallout; break;
+ case mso_sptCircularArrow : pCustomShape = &msoCircularArrow; break;
+ case mso_sptIrregularSeal1 : pCustomShape = &msoIrregularSeal1; break;
+ case mso_sptIrregularSeal2 : pCustomShape = &msoIrregularSeal2; break;
+ case mso_sptSeal4 : pCustomShape = &msoSeal4; break;
+ case mso_sptStar : pCustomShape = &msoStar; break;
+ case mso_sptSeal8 : pCustomShape = &msoSeal8; break;
+ case mso_sptSeal :
+ case mso_sptSeal16 : pCustomShape = &msoSeal16; break;
+ case mso_sptSeal24 : pCustomShape = &msoSeal24; break;
+ case mso_sptSeal32 : pCustomShape = &msoSeal32; break;
+ case mso_sptRibbon2 : pCustomShape = &msoRibbon2; break;
+ case mso_sptRibbon : pCustomShape = &msoRibbon; break;
+ case mso_sptEllipseRibbon2 : pCustomShape = &msoRibbon2; break; // SJ: TODO
+ case mso_sptEllipseRibbon : pCustomShape = &msoRibbon; break; // SJ: TODO
+ case mso_sptVerticalScroll : pCustomShape = &msoVerticalScroll; break;
+ case mso_sptHorizontalScroll : pCustomShape = &msoHorizontalScroll; break;
+ case mso_sptFlowChartProcess : pCustomShape = &msoFlowChartProcess; break;
+ case mso_sptFlowChartAlternateProcess : pCustomShape = &msoFlowChartAlternateProcess; break;
+ case mso_sptFlowChartDecision : pCustomShape = &msoFlowChartDecision; break;
+ case mso_sptFlowChartInputOutput : pCustomShape = &msoFlowChartInputOutput; break;
+ case mso_sptFlowChartPredefinedProcess :pCustomShape = &msoFlowChartPredefinedProcess; break;
+ case mso_sptFlowChartInternalStorage : pCustomShape = &msoFlowChartInternalStorage; break;
+ case mso_sptFlowChartDocument : pCustomShape = &msoFlowChartDocument; break;
+ case mso_sptFlowChartMultidocument : pCustomShape = &msoFlowChartMultidocument; break;
+ case mso_sptFlowChartTerminator : pCustomShape = &msoFlowChartTerminator; break;
+ case mso_sptFlowChartPreparation : pCustomShape = &msoFlowChartPreparation; break;
+ case mso_sptFlowChartManualInput : pCustomShape = &msoFlowChartManualInput; break;
+ case mso_sptFlowChartManualOperation : pCustomShape = &msoFlowChartManualOperation; break;
+ case mso_sptFlowChartConnector : pCustomShape = &msoFlowChartConnector; break;
+ case mso_sptFlowChartOffpageConnector : pCustomShape = &msoFlowChartOffpageConnector; break;
+ case mso_sptFlowChartPunchedCard : pCustomShape = &msoFlowChartPunchedCard; break;
+ case mso_sptFlowChartPunchedTape : pCustomShape = &msoFlowChartPunchedTape; break;
+ case mso_sptFlowChartSummingJunction : pCustomShape = &msoFlowChartSummingJunction; break;
+ case mso_sptFlowChartOr : pCustomShape = &msoFlowChartOr; break;
+ case mso_sptFlowChartCollate : pCustomShape = &msoFlowChartCollate; break;
+ case mso_sptFlowChartSort : pCustomShape = &msoFlowChartSort; break;
+ case mso_sptFlowChartExtract : pCustomShape = &msoFlowChartExtract; break;
+ case mso_sptFlowChartMerge : pCustomShape = &msoFlowChartMerge; break;
+ case mso_sptFlowChartOnlineStorage : pCustomShape = &msoFlowChartOnlineStorage; break;
+ case mso_sptFlowChartDelay : pCustomShape = &msoFlowChartDelay; break;
+ case mso_sptFlowChartMagneticTape : pCustomShape = &msoFlowChartMagneticTape; break;
+ case mso_sptFlowChartMagneticDisk : pCustomShape = &msoFlowChartMagneticDisk; break;
+ case mso_sptFlowChartMagneticDrum : pCustomShape = &msoFlowChartMagneticDrum; break;
+ case mso_sptFlowChartDisplay : pCustomShape = &msoFlowChartDisplay; break;
+ case mso_sptWedgeRectCallout : pCustomShape = &msoWedgeRectCallout; break;
+ case mso_sptWedgeRRectCallout : pCustomShape = &msoWedgeRRectCallout; break;
+ case mso_sptWedgeEllipseCallout : pCustomShape = &msoWedgeEllipseCallout; break;
+ case mso_sptCloudCallout : pCustomShape = &msoCloudCallout; break;
+ case mso_sptWave : pCustomShape = &msoWave; break;
+ case mso_sptDoubleWave : pCustomShape = &msoDoubleWave; break;
+
+ // callout
+ case mso_sptCallout1 : pCustomShape = &msoCallout1; break;
+ case mso_sptCallout2 : pCustomShape = &msoCallout2; break;
+ case mso_sptCallout3 : pCustomShape = &msoCallout3; break;
+ case mso_sptAccentCallout1 : pCustomShape = &msoAccentCallout1; break;
+ case mso_sptAccentCallout2 : pCustomShape = &msoAccentCallout2; break;
+ case mso_sptAccentCallout3 : pCustomShape = &msoAccentCallout3; break;
+ case mso_sptBorderCallout1 : pCustomShape = &msoBorderCallout1; break;
+ case mso_sptBorderCallout2 : pCustomShape = &msoBorderCallout2; break;
+ case mso_sptBorderCallout3 : pCustomShape = &msoBorderCallout3; break;
+ case mso_sptAccentBorderCallout1 : pCustomShape = &msoAccentBorderCallout1; break;
+ case mso_sptAccentBorderCallout2 : pCustomShape = &msoAccentBorderCallout2; break;
+ case mso_sptAccentBorderCallout3 : pCustomShape = &msoAccentBorderCallout3; break;
+ case mso_sptCallout90 : pCustomShape = &msoCallout90; break;
+ case mso_sptAccentCallout90 : pCustomShape = &msoAccentCallout90; break;
+ case mso_sptBorderCallout90 : pCustomShape = &msoBorderCallout90; break;
+ case mso_sptAccentBorderCallout90 : pCustomShape = &msoAccentBorderCallout90; break;
+
+ // connectors
+ case mso_sptStraightConnector1 : pCustomShape = &msoStraightConnector1; break;
+ case mso_sptBentConnector2 : pCustomShape = &msoBentConnector2; break;
+ case mso_sptBentConnector3 : pCustomShape = &msoBentConnector3; break;
+ case mso_sptBentConnector4 : pCustomShape = &msoBentConnector4; break;
+ case mso_sptBentConnector5 : pCustomShape = &msoBentConnector5; break;
+ case mso_sptCurvedConnector2 : pCustomShape = &msoCurvedConnector2; break;
+ case mso_sptCurvedConnector3 : pCustomShape = &msoCurvedConnector3; break;
+ case mso_sptCurvedConnector4 : pCustomShape = &msoCurvedConnector4; break;
+ case mso_sptCurvedConnector5 : pCustomShape = &msoCurvedConnector5; break;
+
+ // Dont know, simply mapping to TextSimple
+ case mso_sptTextOnRing :
+ case mso_sptTextOnCurve :
+ case mso_sptTextRing :
+ case mso_sptTextWave :
+ case mso_sptTextCurve :
+ case mso_sptTextHexagon :
+ case mso_sptTextOctagon :
+ case mso_sptTextBox : pCustomShape = &msoTextSimple; break;
+
+ // FontWork
+ case mso_sptTextSimple :
+ case mso_sptTextPlainText : pCustomShape = &msoTextPlainText; break;
+ case mso_sptTextStop : pCustomShape = &msoTextStop; break;
+ case mso_sptTextTriangle : pCustomShape = &msoTextTriangle; break;
+ case mso_sptTextTriangleInverted : pCustomShape = &msoTextTriangleInverted; break;
+ case mso_sptTextChevron : pCustomShape = &msoTextChevron; break;
+ case mso_sptTextChevronInverted : pCustomShape = &msoTextChevronInverted; break;
+ case mso_sptTextRingInside : pCustomShape = &msoTextRingOutside; break; // SJ: TODO->the orientation of the ellipse needs to be changed
+ case mso_sptTextRingOutside : pCustomShape = &msoTextRingOutside; break;
+ case mso_sptTextFadeRight : pCustomShape = &msoTextFadeRight; break;
+ case mso_sptTextFadeLeft : pCustomShape = &msoTextFadeLeft; break;
+ case mso_sptTextFadeUp : pCustomShape = &msoTextFadeUp; break;
+ case mso_sptTextFadeDown : pCustomShape = &msoTextFadeDown; break;
+ case mso_sptTextSlantUp : pCustomShape = &msoTextSlantUp; break;
+ case mso_sptTextSlantDown : pCustomShape = &msoTextSlantDown; break;
+ case mso_sptTextCascadeUp : pCustomShape = &msoTextCascadeUp; break;
+ case mso_sptTextCascadeDown : pCustomShape = &msoTextCascadeDown; break;
+ case mso_sptTextArchUpCurve : pCustomShape = &msoTextArchUpCurve; break;
+ case mso_sptTextArchDownCurve : pCustomShape = &msoTextArchDownCurve; break;
+ case mso_sptTextCircleCurve : pCustomShape = &msoTextCircleCurve; break;
+ case mso_sptTextButtonCurve : pCustomShape = &msoTextButtonCurve; break;
+ case mso_sptTextArchUpPour : pCustomShape = &msoTextArchUpPour; break;
+ case mso_sptTextArchDownPour : pCustomShape = &msoTextArchDownPour; break;
+ case mso_sptTextCirclePour : pCustomShape = &msoTextCirclePour; break;
+ case mso_sptTextButtonPour : pCustomShape = &msoTextButtonPour; break;
+ case mso_sptTextCurveUp : pCustomShape = &msoTextCurveUp; break;
+ case mso_sptTextCurveDown : pCustomShape = &msoTextCurveDown; break;
+ case mso_sptTextCanUp : pCustomShape = &msoTextCanUp; break;
+ case mso_sptTextCanDown : pCustomShape = &msoTextCanDown; break;
+ case mso_sptTextInflate : pCustomShape = &msoTextInflate; break;
+ case mso_sptTextDeflate : pCustomShape = &msoTextDeflate; break;
+ case mso_sptTextInflateBottom : pCustomShape = &msoTextInflateBottom; break;
+ case mso_sptTextDeflateBottom : pCustomShape = &msoTextDeflateBottom; break;
+ case mso_sptTextInflateTop : pCustomShape = &msoTextInflateTop; break;
+ case mso_sptTextDeflateTop : pCustomShape = &msoTextDeflateTop; break;
+ case mso_sptTextDeflateInflate : pCustomShape = &msoTextDeflateInflate; break;
+ case mso_sptTextDeflateInflateDeflate : pCustomShape = &msoTextDeflateInflateDeflate; break;
+ case mso_sptTextWave1 : pCustomShape = &msoTextWave1; break;
+ case mso_sptTextWave2 : pCustomShape = &msoTextWave2; break;
+ case mso_sptTextWave3 : pCustomShape = &msoTextWave3; break;
+ case mso_sptTextWave4 : pCustomShape = &msoTextWave4; break;
+ default :
+ break;
+ }
+ return pCustomShape;
+}
diff --git a/svx/source/customshapes/EnhancedCustomShapeHandle.cxx b/svx/source/customshapes/EnhancedCustomShapeHandle.cxx
new file mode 100644
index 000000000000..92104f0ae82e
--- /dev/null
+++ b/svx/source/customshapes/EnhancedCustomShapeHandle.cxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "EnhancedCustomShapeHandle.hxx"
+#include "svx/EnhancedCustomShape2d.hxx"
+#include "svx/unoapi.hxx"
+
+// -----------------------------------------------------------------------------
+
+EnhancedCustomShapeHandle::EnhancedCustomShapeHandle( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xCustomShape, sal_uInt32 nIndex ) :
+ mnIndex ( nIndex ),
+ mxCustomShape ( xCustomShape )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+EnhancedCustomShapeHandle::~EnhancedCustomShapeHandle()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL EnhancedCustomShapeHandle::acquire() throw()
+{
+ OWeakObject::acquire();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL EnhancedCustomShapeHandle::release() throw()
+{
+ OWeakObject::release();
+}
+
+// XCustomShapeHandle
+com::sun::star::awt::Point SAL_CALL EnhancedCustomShapeHandle::getPosition()
+ throw ( com::sun::star::uno::RuntimeException )
+{
+ SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxCustomShape ) );
+ if ( !pSdrObjCustomShape )
+ throw com::sun::star::uno::RuntimeException();
+
+ Point aPosition;
+ EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
+ if ( !aCustomShape2d.GetHandlePosition( mnIndex, aPosition ) )
+ throw com::sun::star::uno::RuntimeException();
+ return com::sun::star::awt::Point( aPosition.X(), aPosition.Y() );
+}
+
+void SAL_CALL EnhancedCustomShapeHandle::setControllerPosition( const com::sun::star::awt::Point& aPnt )
+ throw ( com::sun::star::uno::RuntimeException )
+{
+ SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxCustomShape ) );
+ if ( !pSdrObjCustomShape )
+ throw com::sun::star::uno::RuntimeException();
+
+ EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
+ if ( !aCustomShape2d.SetHandleControllerPosition( mnIndex, aPnt ) )
+ throw com::sun::star::uno::RuntimeException();
+}
+
+// XInitialization
+void SAL_CALL EnhancedCustomShapeHandle::initialize( const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& /* aArguments */ )
+ throw ( com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException )
+{
+}
diff --git a/svx/source/customshapes/EnhancedCustomShapeHandle.hxx b/svx/source/customshapes/EnhancedCustomShapeHandle.hxx
new file mode 100644
index 000000000000..c87f6d12116c
--- /dev/null
+++ b/svx/source/customshapes/EnhancedCustomShapeHandle.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ENHANCED_CUSTOMSHAPE_HANDLE_HXX
+#define _ENHANCED_CUSTOMSHAPE_HANDLE_HXX
+
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/XCustomShapeHandle.hpp>
+#include <com/sun/star/awt/Point.hpp>
+#include <cppuhelper/weakref.hxx>
+
+class EnhancedCustomShapeHandle : public cppu::WeakImplHelper2
+<
+ com::sun::star::drawing::XCustomShapeHandle,
+ com::sun::star::lang::XInitialization
+>
+{
+ sal_uInt32 mnIndex;
+ com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxCustomShape;
+
+public:
+
+ EnhancedCustomShapeHandle( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xCustomShape, sal_uInt32 nIndex );
+ virtual ~EnhancedCustomShapeHandle();
+
+ // XInterface
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // XCustomShapeHandle
+ virtual com::sun::star::awt::Point SAL_CALL getPosition()
+ throw ( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setControllerPosition( const com::sun::star::awt::Point& )
+ throw ( com::sun::star::uno::RuntimeException );
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments )
+ throw ( com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException );
+};
+
+#endif
diff --git a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx
new file mode 100644
index 000000000000..093bae0d2a2d
--- /dev/null
+++ b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx
@@ -0,0 +1,321 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "svx/EnhancedCustomShapeTypeNames.hxx"
+#include <osl/mutex.hxx>
+#include <hash_map>
+
+struct TCheck
+{
+ bool operator()( const char* s1, const char* s2 ) const
+ {
+ return strcmp( s1, s2 ) == 0;
+ }
+};
+typedef std::hash_map< const char*, MSO_SPT, std::hash<const char*>, TCheck> TypeNameHashMap;
+static TypeNameHashMap* pHashMap = NULL;
+static ::osl::Mutex& getHashMapMutex()
+{
+ static osl::Mutex s_aHashMapProtection;
+ return s_aHashMapProtection;
+}
+
+struct NameTypeTable
+{
+ const char* pS;
+ MSO_SPT pE;
+};
+static const NameTypeTable pNameTypeTableArray[] =
+{
+ { "non-primitive", mso_sptMin },
+ { "rectangle", mso_sptRectangle },
+ { "round-rectangle", mso_sptRoundRectangle },
+ { "ellipse", mso_sptEllipse },
+ { "diamond", mso_sptDiamond },
+ { "isosceles-triangle", mso_sptIsocelesTriangle },
+ { "right-triangle", mso_sptRightTriangle },
+ { "parallelogram", mso_sptParallelogram },
+ { "trapezoid", mso_sptTrapezoid },
+ { "hexagon", mso_sptHexagon },
+ { "octagon", mso_sptOctagon },
+ { "cross", mso_sptPlus },
+ { "star5", mso_sptStar },
+ { "right-arrow", mso_sptArrow },
+ { "mso-spt14", mso_sptThickArrow },
+ { "pentagon-right", mso_sptHomePlate },
+ { "cube", mso_sptCube },
+ { "mso-spt17", mso_sptBalloon },
+ { "mso-spt18", mso_sptSeal },
+ { "mso-spt19", mso_sptArc },
+ { "mso-spt20", mso_sptLine },
+ { "mso-spt21", mso_sptPlaque },
+ { "can", mso_sptCan },
+ { "ring", mso_sptDonut },
+ { "mso-spt24", mso_sptTextSimple },
+ { "mso-spt25", mso_sptTextOctagon },
+ { "mso-spt26", mso_sptTextHexagon },
+ { "mso-spt27", mso_sptTextCurve },
+ { "mso-spt28", mso_sptTextWave },
+ { "mso-spt29", mso_sptTextRing },
+ { "mso-spt30", mso_sptTextOnCurve },
+ { "mso-spt31", mso_sptTextOnRing },
+ { "mso-spt32", mso_sptStraightConnector1 },
+ { "mso-spt33", mso_sptBentConnector2 },
+ { "mso-spt34", mso_sptBentConnector3 },
+ { "mso-spt35", mso_sptBentConnector4 },
+ { "mso-spt36", mso_sptBentConnector5 },
+ { "mso-spt37", mso_sptCurvedConnector2 },
+ { "mso-spt38", mso_sptCurvedConnector3 },
+ { "mso-spt39", mso_sptCurvedConnector4 },
+ { "mso-spt40", mso_sptCurvedConnector5 },
+ { "mso-spt41", mso_sptCallout1 },
+ { "mso-spt42", mso_sptCallout2 },
+ { "mso-spt43", mso_sptCallout3 },
+ { "mso-spt44", mso_sptAccentCallout1 },
+ { "mso-spt45", mso_sptAccentCallout2 },
+ { "mso-spt46", mso_sptAccentCallout3 },
+ { "line-callout-1", mso_sptBorderCallout1 },
+ { "line-callout-2", mso_sptBorderCallout2 },
+ { "mso-spt49", mso_sptBorderCallout3 },
+ { "mso-spt50", mso_sptAccentBorderCallout1 },
+ { "mso-spt51", mso_sptAccentBorderCallout2 },
+ { "mso-spt52", mso_sptAccentBorderCallout3 },
+ { "mso-spt53", mso_sptRibbon },
+ { "mso-spt54", mso_sptRibbon2 },
+ { "chevron", mso_sptChevron },
+ { "pentagon", mso_sptPentagon },
+ { "forbidden", mso_sptNoSmoking },
+ { "star8", mso_sptSeal8 },
+ { "mso-spt59", mso_sptSeal16 },
+ { "mso-spt60", mso_sptSeal32 },
+ { "rectangular-callout", mso_sptWedgeRectCallout },
+ { "round-rectangular-callout", mso_sptWedgeRRectCallout },
+ { "round-callout", mso_sptWedgeEllipseCallout },
+ { "mso-spt64", mso_sptWave },
+ { "paper", mso_sptFoldedCorner },
+ { "left-arrow", mso_sptLeftArrow },
+ { "down-arrow", mso_sptDownArrow },
+ { "up-arrow", mso_sptUpArrow },
+ { "left-right-arrow", mso_sptLeftRightArrow },
+ { "up-down-arrow", mso_sptUpDownArrow },
+ { "mso-spt71", mso_sptIrregularSeal1 },
+ { "bang", mso_sptIrregularSeal2 },
+ { "lightning", mso_sptLightningBolt },
+ { "heart", mso_sptHeart },
+ { "mso-spt75", mso_sptPictureFrame },
+ { "quad-arrow", mso_sptQuadArrow },
+ { "left-arrow-callout", mso_sptLeftArrowCallout },
+ { "right-arrow-callout", mso_sptRightArrowCallout },
+ { "up-arrow-callout", mso_sptUpArrowCallout },
+ { "down-arrow-callout", mso_sptDownArrowCallout },
+ { "left-right-arrow-callout", mso_sptLeftRightArrowCallout },
+ { "up-down-arrow-callout", mso_sptUpDownArrowCallout },
+ { "quad-arrow-callout", mso_sptQuadArrowCallout },
+ { "quad-bevel", mso_sptBevel },
+ { "left-bracket", mso_sptLeftBracket },
+ { "right-bracket", mso_sptRightBracket },
+ { "left-brace", mso_sptLeftBrace },
+ { "right-brace", mso_sptRightBrace },
+ { "mso-spt89", mso_sptLeftUpArrow },
+ { "mso-spt90", mso_sptBentUpArrow },
+ { "mso-spt91", mso_sptBentArrow },
+ { "star24", mso_sptSeal24 },
+ { "striped-right-arrow", mso_sptStripedRightArrow },
+ { "notched-right-arrow", mso_sptNotchedRightArrow },
+ { "block-arc", mso_sptBlockArc },
+ { "smiley", mso_sptSmileyFace },
+ { "vertical-scroll", mso_sptVerticalScroll },
+ { "horizontal-scroll", mso_sptHorizontalScroll },
+ { "circular-arrow", mso_sptCircularArrow },
+ { "mso-spt100", mso_sptNotchedCircularArrow },
+ { "mso-spt101", mso_sptUturnArrow },
+ { "mso-spt102", mso_sptCurvedRightArrow },
+ { "mso-spt103", mso_sptCurvedLeftArrow },
+ { "mso-spt104", mso_sptCurvedUpArrow },
+ { "mso-spt105", mso_sptCurvedDownArrow },
+ { "cloud-callout", mso_sptCloudCallout },
+ { "mso-spt107", mso_sptEllipseRibbon },
+ { "mso-spt108", mso_sptEllipseRibbon2 },
+ { "flowchart-process", mso_sptFlowChartProcess },
+ { "flowchart-decision", mso_sptFlowChartDecision },
+ { "flowchart-data", mso_sptFlowChartInputOutput },
+ { "flowchart-predefined-process", mso_sptFlowChartPredefinedProcess },
+ { "flowchart-internal-storage", mso_sptFlowChartInternalStorage },
+ { "flowchart-document", mso_sptFlowChartDocument },
+ { "flowchart-multidocument", mso_sptFlowChartMultidocument },
+ { "flowchart-terminator", mso_sptFlowChartTerminator },
+ { "flowchart-preparation", mso_sptFlowChartPreparation },
+ { "flowchart-manual-input", mso_sptFlowChartManualInput },
+ { "flowchart-manual-operation", mso_sptFlowChartManualOperation },
+ { "flowchart-connector", mso_sptFlowChartConnector },
+ { "flowchart-card", mso_sptFlowChartPunchedCard },
+ { "flowchart-punched-tape", mso_sptFlowChartPunchedTape },
+ { "flowchart-summing-junction", mso_sptFlowChartSummingJunction },
+ { "flowchart-or", mso_sptFlowChartOr },
+ { "flowchart-collate", mso_sptFlowChartCollate },
+ { "flowchart-sort", mso_sptFlowChartSort },
+ { "flowchart-extract", mso_sptFlowChartExtract },
+ { "flowchart-merge", mso_sptFlowChartMerge },
+ { "mso-spt129", mso_sptFlowChartOfflineStorage },
+ { "flowchart-stored-data", mso_sptFlowChartOnlineStorage },
+ { "flowchart-sequential-access", mso_sptFlowChartMagneticTape },
+ { "flowchart-magnetic-disk", mso_sptFlowChartMagneticDisk },
+ { "flowchart-direct-access-storage", mso_sptFlowChartMagneticDrum },
+ { "flowchart-display", mso_sptFlowChartDisplay },
+ { "flowchart-delay", mso_sptFlowChartDelay },
+ { "fontwork-plain-text", mso_sptTextPlainText },
+ { "fontwork-stop", mso_sptTextStop },
+ { "fontwork-triangle-up", mso_sptTextTriangle },
+ { "fontwork-triangle-down", mso_sptTextTriangleInverted },
+ { "fontwork-chevron-up", mso_sptTextChevron },
+ { "fontwork-chevron-down", mso_sptTextChevronInverted },
+ { "mso-spt142", mso_sptTextRingInside },
+ { "mso-spt143", mso_sptTextRingOutside },
+ { "fontwork-arch-up-curve", mso_sptTextArchUpCurve },
+ { "fontwork-arch-down-curve", mso_sptTextArchDownCurve },
+ { "fontwork-circle-curve", mso_sptTextCircleCurve },
+ { "fontwork-open-circle-curve", mso_sptTextButtonCurve },
+ { "fontwork-arch-up-pour", mso_sptTextArchUpPour },
+ { "fontwork-arch-down-pour", mso_sptTextArchDownPour },
+ { "fontwork-circle-pour", mso_sptTextCirclePour },
+ { "fontwork-open-circle-pour", mso_sptTextButtonPour },
+ { "fontwork-curve-up", mso_sptTextCurveUp },
+ { "fontwork-curve-down", mso_sptTextCurveDown },
+ { "fontwork-fade-up-and-right", mso_sptTextCascadeUp },
+ { "fontwork-fade-up-and-left", mso_sptTextCascadeDown },
+ { "fontwork-wave", mso_sptTextWave1 },
+ { "mso-spt157", mso_sptTextWave2 },
+ { "mso-spt158", mso_sptTextWave3 },
+ { "mso-spt159", mso_sptTextWave4 },
+ { "fontwork-inflate", mso_sptTextInflate },
+ { "mso-spt161", mso_sptTextDeflate },
+ { "mso-spt162", mso_sptTextInflateBottom },
+ { "mso-spt163", mso_sptTextDeflateBottom },
+ { "mso-spt164", mso_sptTextInflateTop },
+ { "mso-spt165", mso_sptTextDeflateTop },
+ { "mso-spt166", mso_sptTextDeflateInflate },
+ { "mso-spt167", mso_sptTextDeflateInflateDeflate },
+ { "fontwork-fade-right", mso_sptTextFadeRight },
+ { "fontwork-fade-left", mso_sptTextFadeLeft },
+ { "fontwork-fade-up", mso_sptTextFadeUp },
+ { "fontwork-fade-down", mso_sptTextFadeDown },
+ { "fontwork-slant-up", mso_sptTextSlantUp },
+ { "fontwork-slant-down", mso_sptTextSlantDown },
+ { "mso-spt174", mso_sptTextCanUp },
+ { "mso-spt175", mso_sptTextCanDown },
+ { "flowchart-alternate-process", mso_sptFlowChartAlternateProcess },
+ { "flowchart-off-page-connector", mso_sptFlowChartOffpageConnector },
+ { "mso-spt178", mso_sptCallout90 },
+ { "mso-spt179", mso_sptAccentCallout90 },
+ { "mso-spt180", mso_sptBorderCallout90 },
+ { "line-callout-3", mso_sptAccentBorderCallout90 },
+ { "mso-spt182", mso_sptLeftRightUpArrow },
+ { "sun", mso_sptSun },
+ { "moon", mso_sptMoon },
+ { "bracket-pair", mso_sptBracketPair },
+ { "brace-pair", mso_sptBracePair },
+ { "star4", mso_sptSeal4 },
+ { "mso-spt188", mso_sptDoubleWave },
+ { "mso-spt189", mso_sptActionButtonBlank },
+ { "mso-spt190", mso_sptActionButtonHome },
+ { "mso-spt191", mso_sptActionButtonHelp },
+ { "mso-spt192", mso_sptActionButtonInformation },
+ { "mso-spt193", mso_sptActionButtonForwardNext },
+ { "mso-spt194", mso_sptActionButtonBackPrevious },
+ { "mso-spt195", mso_sptActionButtonEnd },
+ { "mso-spt196", mso_sptActionButtonBeginning },
+ { "mso-spt197", mso_sptActionButtonReturn },
+ { "mso-spt198", mso_sptActionButtonDocument },
+ { "mso-spt199", mso_sptActionButtonSound },
+ { "mso-spt200", mso_sptActionButtonMovie },
+ { "mso-spt201", mso_sptHostControl },
+ { "mso-spt202", mso_sptTextBox }
+};
+
+ // gallery: quadrat
+ // gallery: round-quadrat
+ // gallery: circle
+ // gallery: circle-pie
+ // gallery: frame
+ // gallery: flower
+ // gallery: cloud
+ // gallery: puzzle
+ // gallery: octagon-bevel
+ // gallery: diamond-bevel
+ // gallery: up-right-arrow
+ // gallery: up-right-down-arrow
+ // gallery: corner-right-arrow
+ // gallery: split-arrow
+ // gallery: up-right-arrow-callout
+ // gallery: split-round-arrow
+ // gallery: s-sharped-arrow
+ // Gallery: star6
+ // Gallery: star12
+ // Gallery: concave-star6
+ // Gallery: signet
+ // Gallery: doorplate
+ // gallery: fontwork-arch-left-curve
+ // gallery: fontwork-arch-right-curve
+ // gallery: fontwork-arch-left-pour
+ // gallery: fontwork-arch-right-pour
+
+MSO_SPT EnhancedCustomShapeTypeNames::Get( const rtl::OUString& rShapeType )
+{
+ if ( !pHashMap )
+ { // init hash map
+ ::osl::MutexGuard aGuard( getHashMapMutex() );
+ if ( !pHashMap )
+ {
+ TypeNameHashMap* pH = new TypeNameHashMap;
+ const NameTypeTable* pPtr = pNameTypeTableArray;
+ const NameTypeTable* pEnd = pPtr + ( sizeof( pNameTypeTableArray ) / sizeof( NameTypeTable ) );
+ for ( ; pPtr < pEnd; pPtr++ )
+ (*pH)[ pPtr->pS ] = pPtr->pE;
+ pHashMap = pH;
+ }
+ }
+ MSO_SPT eRetValue = mso_sptNil;
+ int i, nLen = rShapeType.getLength();
+ char* pBuf = new char[ nLen + 1 ];
+ for ( i = 0; i < nLen; i++ )
+ pBuf[ i ] = (char)rShapeType[ i ];
+ pBuf[ i ] = 0;
+ TypeNameHashMap::iterator aHashIter( pHashMap->find( pBuf ) );
+ delete[] pBuf;
+ if ( aHashIter != pHashMap->end() )
+ eRetValue = (*aHashIter).second;
+ return eRetValue;
+}
+
+rtl::OUString EnhancedCustomShapeTypeNames::Get( const MSO_SPT eShapeType )
+{
+ return eShapeType <= mso_sptTextBox
+ ? rtl::OUString::createFromAscii( pNameTypeTableArray[ eShapeType ].pS )
+ : rtl::OUString();
+}
diff --git a/svx/source/customshapes/tbxcustomshapes.cxx b/svx/source/customshapes/tbxcustomshapes.cxx
new file mode 100644
index 000000000000..f0879be033ee
--- /dev/null
+++ b/svx/source/customshapes/tbxcustomshapes.cxx
@@ -0,0 +1,204 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <string> // HACK: prevent conflict between STLPORT and Workshop headers
+
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+#include <tools/shl.hxx>
+#include <svl/eitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <vcl/toolbox.hxx>
+#include <vos/mutex.hxx>
+
+#include <sfx2/imagemgr.hxx>
+#include <vcl/svapp.hxx>
+#include "svx/tbxcustomshapes.hxx"
+
+SFX_IMPL_TOOLBOX_CONTROL(SvxTbxCtlCustomShapes, SfxBoolItem);
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+SvxTbxCtlCustomShapes::SvxTbxCtlCustomShapes( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
+ SfxToolBoxControl( nSlotId, nId, rTbx ),
+ m_aSubTbxResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/" ) )
+{
+ switch( nSlotId )
+ {
+ default :
+ {
+ DBG_ASSERT( false, "SvxTbxCtlCustomShapes: unknown slot executed. ?" );
+ }
+ case SID_DRAWTBX_CS_BASIC :
+ {
+ m_aCommand = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:BasicShapes.diamond" ) );
+ m_aSubTbName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "basicshapes" ) );
+ }
+ break;
+
+ case SID_DRAWTBX_CS_SYMBOL :
+ {
+ m_aCommand = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:SymbolShapes.smiley" ) );
+ m_aSubTbName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "symbolshapes" ) );
+ }
+ break;
+
+ case SID_DRAWTBX_CS_ARROW :
+ {
+ m_aCommand = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ArrowShapes.left-right-arrow" ) );
+ m_aSubTbName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "arrowshapes" ) );
+ }
+ break;
+ case SID_DRAWTBX_CS_FLOWCHART :
+ {
+ m_aCommand = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FlowChartShapes.flowchart-internal-storage" ) );
+ m_aSubTbName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "flowchartshapes" ) );
+ }
+ break;
+ case SID_DRAWTBX_CS_CALLOUT :
+ {
+ m_aCommand = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CalloutShapes.round-rectangular-callout" ) );
+ m_aSubTbName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "calloutshapes" ) );
+ }
+ break;
+ case SID_DRAWTBX_CS_STAR :
+ {
+ m_aCommand = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:StarShapes.star5" ) );
+ m_aSubTbName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "starshapes" ) );
+ }
+ break;
+ }
+ m_aSubTbxResName += m_aSubTbName;
+ rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) );
+ rTbx.Invalidate();
+}
+
+/*************************************************************************
+|*
+|* Benachrichtigung, wenn sich der Applikationsstatus geaendert hat
+|*
+\************************************************************************/
+
+void SvxTbxCtlCustomShapes::StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState )
+{
+ SfxToolBoxControl::StateChanged( nSID, eState, pState );
+}
+
+/*************************************************************************
+|*
+|* Wenn man ein PopupWindow erzeugen will
+|*
+\************************************************************************/
+
+SfxPopupWindowType SvxTbxCtlCustomShapes::GetPopupWindowType() const
+{
+ return( m_aCommand.getLength() == 0 ? SFX_POPUPWINDOW_ONCLICK : SFX_POPUPWINDOW_ONTIMEOUT);
+}
+
+/*************************************************************************
+|*
+|* Hier wird das Fenster erzeugt
+|* Lage der Toolbox mit GetToolBox() abfragbar
+|* rItemRect sind die Screen-Koordinaten
+|*
+\************************************************************************/
+
+SfxPopupWindow* SvxTbxCtlCustomShapes::CreatePopupWindow()
+{
+ createAndPositionSubToolBar( m_aSubTbxResName );
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxTbxCtlCustomShapes::Select( sal_Bool /*bMod1*/ )
+{
+ if ( m_aCommand.getLength() > 0 )
+ {
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > aParamSeq( 0 );
+ Dispatch( m_aCommand, aParamSeq );
+ }
+}
+
+
+::sal_Bool SAL_CALL SvxTbxCtlCustomShapes::opensSubToolbar() throw (::com::sun::star::uno::RuntimeException)
+{
+ // We control a sub-toolbar therefor, we have to return true.
+ return sal_True;
+}
+
+::rtl::OUString SAL_CALL SvxTbxCtlCustomShapes::getSubToolbarName() throw (::com::sun::star::uno::RuntimeException)
+{
+ // Provide the controlled sub-toolbar name, so we are notified whenever
+ // this toolbar executes a function.
+ return m_aSubTbName;
+}
+
+void SAL_CALL SvxTbxCtlCustomShapes::functionSelected( const ::rtl::OUString& rCommand ) throw (::com::sun::star::uno::RuntimeException)
+{
+ // remind the new command
+ m_aCommand = rCommand;
+ // Our sub-toolbar wants to execute a function.
+ // We have to change the image of our toolbar button to reflect the new function.
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( !m_bDisposed )
+ {
+ if ( m_aCommand.getLength() > 0 )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame( getFrameInterface());
+ Image aImage = GetImage( xFrame, m_aCommand, hasBigImages(), isHighContrast() );
+ if ( !!aImage )
+ GetToolBox().SetItemImage( GetId(), aImage );
+ }
+ }
+}
+
+void SAL_CALL SvxTbxCtlCustomShapes::updateImage( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ // We should update the button image of our parent (toolbar).
+ // Use the stored command to set the correct current image.
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( m_aCommand.getLength() > 0 )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame( getFrameInterface());
+ Image aImage = GetImage( xFrame, m_aCommand, hasBigImages(), isHighContrast() );
+ if ( !!aImage )
+ GetToolBox().SetItemImage( GetId(), aImage );
+ }
+}
+
diff --git a/svx/source/dialog/SpellDialogChildWindow.cxx b/svx/source/dialog/SpellDialogChildWindow.cxx
new file mode 100644
index 000000000000..22dcdcc3a1be
--- /dev/null
+++ b/svx/source/dialog/SpellDialogChildWindow.cxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/SpellDialogChildWindow.hxx>
+
+#include <svx/svxdlg.hxx>
+
+namespace svx {
+
+/*-------------------------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SpellDialogChildWindow::SpellDialogChildWindow (
+ Window* _pParent,
+ sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* /*pInfo*/)
+ : SfxChildWindow (_pParent, nId)
+
+{
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SvxAbstractDialogFactory::Create() failed");
+ m_pAbstractSpellDialog = pFact->CreateSvxSpellDialog(_pParent,
+ pBindings,
+ this );
+ pWindow = m_pAbstractSpellDialog->GetWindow();
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+ SetHideNotDelete (sal_True);
+}
+/*-------------------------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SpellDialogChildWindow::~SpellDialogChildWindow (void)
+{
+}
+/*-------------------------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SfxBindings& SpellDialogChildWindow::GetBindings (void) const
+{
+ OSL_ASSERT (m_pAbstractSpellDialog != NULL);
+ return m_pAbstractSpellDialog->GetBindings();
+}
+/*-------------------------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SpellDialogChildWindow::InvalidateSpellDialog()
+{
+ OSL_ASSERT (m_pAbstractSpellDialog != NULL);
+ if(m_pAbstractSpellDialog)
+ m_pAbstractSpellDialog->Invalidate();
+}
+/*-------------------------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SpellDialogChildWindow::HasAutoCorrection()
+{
+ return false;
+}
+/*-------------------------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SpellDialogChildWindow::AddAutoCorrection(
+ const String& /*rOld*/,
+ const String& /*rNew*/,
+ LanguageType /*eLanguage*/)
+{
+ DBG_ERROR("AutoCorrection should have been overloaded - if available");
+}
+/*-- 16.06.2008 10:11:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SpellDialogChildWindow::HasGrammarChecking()
+{
+ return false;
+}
+/*-- 18.06.2008 12:26:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SpellDialogChildWindow::IsGrammarChecking()
+{
+ DBG_ERROR("Grammar checking should have been overloaded - if available");
+ return false;
+}
+/*-- 18.06.2008 12:26:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SpellDialogChildWindow::SetGrammarChecking(bool )
+{
+ DBG_ERROR("Grammar checking should have been overloaded - if available");
+}
+} // end of namespace ::svx
diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx
new file mode 100644
index 000000000000..9c2a5fc9a3bb
--- /dev/null
+++ b/svx/source/dialog/_bmpmask.cxx
@@ -0,0 +1,1241 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <vcl/wrkwin.hxx>
+#include <tools/shl.hxx>
+#include <vcl/metaact.hxx>
+#include <svtools/valueset.hxx>
+#include <svl/eitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svtools/colrdlg.hxx>
+
+#define BMPMASK_PRIVATE
+
+#include <svx/dialmgr.hxx>
+#include <svx/bmpmask.hxx>
+#include <svx/dialogs.hrc>
+#include <bmpmask.hrc>
+#include <svx/svxids.hrc>
+
+//-------------------------------------------------------------------------
+
+#define BMP_RESID(nId) ResId(nId, DIALOG_MGR())
+#define TRANSP_STRING "Transparent"
+#define TRANSP_COL (Color( 252, 252, 252 ))
+#define OWN_CALLMODE SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD
+
+//-------------------------------------------------------------------------
+
+#define TEST_COLS() \
+{ \
+ nR = aCol.GetRed(); nG = aCol.GetGreen(); nB = aCol.GetBlue(); \
+ for( i = 0; i < nCount; i++ ) \
+ { \
+ if ( ( pMinR[i] <= nR ) && ( pMaxR[i] >= nR ) && \
+ ( pMinG[i] <= nG ) && ( pMaxG[i] >= nG ) && \
+ ( pMinB[i] <= nB ) && ( pMaxB[i] >= nB ) ) \
+ { \
+ aCol = pDstCols[i]; bReplace = sal_True; break; \
+ } \
+ } \
+}
+
+// -------------------------------------------------------------------------
+
+SFX_IMPL_DOCKINGWINDOW( SvxBmpMaskChildWindow, SID_BMPMASK )
+
+// -------------------------------------------------------------------------
+
+class ColorWindow : public Control
+{
+ Color aColor;
+
+
+public:
+
+ ColorWindow( Window* pParent, WinBits nWinStyle ) :
+ Control( pParent, nWinStyle ),
+ aColor( COL_WHITE ) {};
+
+ ColorWindow( Window* pParent, const ResId& rId ) :
+ Control( pParent, rId ),
+ aColor( COL_WHITE ) {};
+
+ void SetColor( const Color& rColor )
+ {
+ aColor = rColor;
+ Invalidate();
+ }
+
+ virtual void Paint( const Rectangle& rRect );
+};
+
+//-------------------------------------------------------------------------
+
+class MaskSet : public ValueSet
+{
+ SvxBmpMask* pSvxBmpMask;
+
+
+public:
+ MaskSet( SvxBmpMask* pParent, WinBits nWinStyle );
+ MaskSet( SvxBmpMask* pParent, const ResId& rId );
+
+ virtual void Select();
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void GetFocus();
+
+ void onEditColor();
+};
+
+//-------------------------------------------------------------------------
+
+MaskSet::MaskSet( SvxBmpMask* pParent, WinBits nWinStyle ) :
+ ValueSet ( pParent, nWinStyle ),
+ pSvxBmpMask ( pParent )
+{
+}
+
+//-------------------------------------------------------------------------
+
+MaskSet::MaskSet( SvxBmpMask* pParent, const ResId& rId ) :
+ ValueSet ( pParent, rId ),
+ pSvxBmpMask ( pParent )
+{
+}
+
+//-------------------------------------------------------------------------
+
+void MaskSet::Select()
+{
+ ValueSet::Select();
+
+ pSvxBmpMask->onSelect( this );
+}
+
+void MaskSet::GetFocus()
+{
+ SelectItem( 1 );
+ pSvxBmpMask->onSelect( this );
+}
+
+void MaskSet::KeyInput( const KeyEvent& rKEvt )
+{
+ KeyCode aCode = rKEvt.GetKeyCode();
+
+ // if the key has a modifier we don't care
+ if( aCode.GetModifier() )
+ {
+ ValueSet::KeyInput( rKEvt );
+ }
+ else
+ {
+ // check for keys that interests us
+ switch ( aCode.GetCode() )
+ {
+ case KEY_SPACE:
+ onEditColor();
+ break;
+ default:
+ ValueSet::KeyInput( rKEvt );
+ }
+
+ }
+}
+
+void MaskSet::onEditColor()
+{
+ SvColorDialog* pColorDlg = new SvColorDialog( GetParent() );
+
+ pColorDlg->SetColor(GetItemColor(1));
+
+ if( pColorDlg->Execute() )
+ SetItemColor( 1, pColorDlg->GetColor() );
+
+ delete pColorDlg;
+}
+
+//-------------------------------------------------------------------------
+
+class MaskData
+{
+ SvxBmpMask* pMask;
+ sal_Bool bIsReady;
+ sal_Bool bExecState;
+ SfxBindings& rBindings;
+
+public:
+ MaskData( SvxBmpMask* pBmpMask, SfxBindings& rBind );
+
+ sal_Bool IsCbxReady() const { return bIsReady; }
+ void SetExecState( sal_Bool bState ) { bExecState = bState; }
+ sal_Bool IsExecReady() const { return bExecState; }
+
+ DECL_LINK( PipetteHdl, ToolBox* pTbx );
+ DECL_LINK( CbxHdl, CheckBox* pCbx );
+ DECL_LINK( CbxTransHdl, CheckBox* pCbx );
+ DECL_LINK( FocusLbHdl, ColorLB* pLb );
+ DECL_LINK( ExecHdl, PushButton* pBtn );
+};
+
+//-------------------------------------------------------------------------
+
+MaskData::MaskData( SvxBmpMask* pBmpMask, SfxBindings& rBind ) :
+
+ pMask ( pBmpMask ),
+ bIsReady ( sal_False ),
+ bExecState ( sal_False ),
+ rBindings ( rBind )
+
+{
+}
+
+//-------------------------------------------------------------------------
+
+IMPL_LINK( MaskData, PipetteHdl, ToolBox*, pTbx )
+{
+ SfxBoolItem aBItem( SID_BMPMASK_PIPETTE,
+ pTbx->IsItemChecked( TBI_PIPETTE ) );
+
+ rBindings.GetDispatcher()->Execute( SID_BMPMASK_PIPETTE, OWN_CALLMODE, &aBItem, 0L );
+
+ return 0;
+}
+
+//-------------------------------------------------------------------------
+
+IMPL_LINK( MaskData, CbxHdl, CheckBox*, pCbx )
+{
+ bIsReady = pMask->aCbx1.IsChecked() || pMask->aCbx2.IsChecked() ||
+ pMask->aCbx3.IsChecked() || pMask->aCbx4.IsChecked();
+
+ if ( bIsReady && IsExecReady() )
+ pMask->aBtnExec.Enable();
+ else
+ pMask->aBtnExec.Disable();
+
+ // Wenn eine Checkbox gecheckt wurde, wird die Pipette enabled
+ if ( pCbx->IsChecked() )
+ {
+ MaskSet* pSet = NULL;
+
+ if ( pCbx == &( pMask->aCbx1 ) )
+ pSet = pMask->pQSet1;
+ else if ( pCbx == &( pMask->aCbx2 ) )
+ pSet = pMask->pQSet2;
+ else if ( pCbx == &( pMask->aCbx3 ) )
+ pSet = pMask->pQSet3;
+ else // if ( pCbx == &( pMask->aCbx4 ) )
+ pSet = pMask->pQSet4;
+
+ pSet->SelectItem( 1 );
+ pSet->Select();
+
+ pMask->aTbxPipette.CheckItem( TBI_PIPETTE, sal_True );
+ PipetteHdl( &( pMask->aTbxPipette ) );
+ }
+
+ return 0;
+}
+
+//-------------------------------------------------------------------------
+
+IMPL_LINK( MaskData, CbxTransHdl, CheckBox*, pCbx )
+{
+ bIsReady = pCbx->IsChecked();
+ if ( bIsReady )
+ {
+ pMask->pQSet1->Disable();
+ pMask->pQSet2->Disable();
+ pMask->pQSet3->Disable();
+ pMask->pQSet4->Disable();
+ pMask->pCtlPipette->Disable();
+ pMask->aCbx1.Disable();
+ pMask->aSp1.Disable();
+ pMask->aCbx2.Disable();
+ pMask->aSp2.Disable();
+ pMask->aCbx3.Disable();
+ pMask->aSp3.Disable();
+ pMask->aCbx4.Disable();
+ pMask->aSp4.Disable();
+ pMask->aTbxPipette.Disable();
+
+ pMask->aLbColor1.Disable();
+ pMask->aLbColor2.Disable();
+ pMask->aLbColor3.Disable();
+ pMask->aLbColor4.Disable();
+ pMask->aLbColorTrans.Enable();
+ }
+ else
+ {
+ pMask->pQSet1->Enable();
+ pMask->pQSet2->Enable();
+ pMask->pQSet3->Enable();
+ pMask->pQSet4->Enable();
+ pMask->pCtlPipette->Enable();
+ pMask->aCbx1.Enable();
+ pMask->aSp1.Enable();
+ pMask->aCbx2.Enable();
+ pMask->aSp2.Enable();
+ pMask->aCbx3.Enable();
+ pMask->aSp3.Enable();
+ pMask->aCbx4.Enable();
+ pMask->aSp4.Enable();
+ pMask->aTbxPipette.Enable();
+
+ pMask->aLbColor1.Enable();
+ pMask->aLbColor2.Enable();
+ pMask->aLbColor3.Enable();
+ pMask->aLbColor4.Enable();
+ pMask->aLbColorTrans.Disable();
+
+ bIsReady = pMask->aCbx1.IsChecked() || pMask->aCbx2.IsChecked() ||
+ pMask->aCbx3.IsChecked() || pMask->aCbx4.IsChecked();
+ }
+
+ if ( bIsReady && IsExecReady() )
+ pMask->aBtnExec.Enable();
+ else
+ pMask->aBtnExec.Disable();
+
+ return 0L;
+}
+
+//-------------------------------------------------------------------------
+
+IMPL_LINK( MaskData, FocusLbHdl, ColorLB*, pLb )
+{
+ pMask->pQSet1->SelectItem( pLb == &( pMask->aLbColor1 ) ? 1 : 0 );
+ pMask->pQSet2->SelectItem( pLb == &( pMask->aLbColor2 ) ? 1 : 0 );
+ pMask->pQSet3->SelectItem( pLb == &( pMask->aLbColor3 ) ? 1 : 0 );
+ pMask->pQSet4->SelectItem( pLb == &( pMask->aLbColor4 ) ? 1 : 0 );
+
+ return 0;
+}
+
+//-------------------------------------------------------------------------
+
+IMPL_LINK( MaskData, ExecHdl, PushButton*, EMPTYARG )
+{
+ SfxBoolItem aBItem( SID_BMPMASK_EXEC, sal_True );
+ rBindings.GetDispatcher()->Execute( SID_BMPMASK_EXEC, OWN_CALLMODE, &aBItem, 0L );
+
+ return 0L;
+}
+
+//-------------------------------------------------------------------------
+
+void ColorWindow::Paint( const Rectangle &/*Rect*/ )
+{
+ const Color& rOldLineColor = GetLineColor();
+ const Color& rOldFillColor = GetFillColor();
+
+ SetLineColor( aColor );
+ SetFillColor( aColor );
+
+ DrawRect( Rectangle( Point(), GetSizePixel() ) );
+
+ SetLineColor( rOldLineColor );
+ SetFillColor( rOldFillColor );
+}
+
+//-------------------------------------------------------------------------
+
+SvxBmpMaskSelectItem::SvxBmpMaskSelectItem( sal_uInt16 nId_, SvxBmpMask& rMask,
+ SfxBindings& rBindings ) :
+ SfxControllerItem ( nId_, rBindings ),
+ rBmpMask ( rMask)
+{
+}
+
+//-------------------------------------------------------------------------
+
+void SvxBmpMaskSelectItem::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/,
+ const SfxPoolItem* pItem )
+{
+ if ( ( nSID == SID_BMPMASK_EXEC ) && pItem )
+ {
+ const SfxBoolItem* pStateItem = PTR_CAST( SfxBoolItem, pItem );
+
+ DBG_ASSERT( pStateItem || pItem == 0, "SfxBoolItem erwartet");
+
+ rBmpMask.SetExecState( pStateItem->GetValue() );
+ }
+}
+
+//-------------------------------------------------------------------------
+
+SvxBmpMaskChildWindow::SvxBmpMaskChildWindow( Window* pParent_, sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo ) :
+ SfxChildWindow( pParent_, nId )
+{
+ pWindow = new SvxBmpMask( pBindings, this, pParent_,
+ BMP_RESID( RID_SVXDLG_BMPMASK ) );
+ SvxBmpMask* pDlg = (SvxBmpMask*) pWindow;
+
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+
+ pDlg->Initialize( pInfo );
+}
+
+//-------------------------------------------------------------------------
+
+SvxBmpMask::SvxBmpMask( SfxBindings *pBindinx,
+ SfxChildWindow *pCW,
+ Window* pParent,
+ const ResId& rResId ) :
+ SfxDockingWindow ( pBindinx, pCW, pParent, rResId ),
+ aTbxPipette ( this, BMP_RESID( TBX_PIPETTE ) ),
+ pCtlPipette ( new ColorWindow( this, BMP_RESID( WND_PIPETTE ) ) ),
+ aBtnExec ( this, BMP_RESID( BTN_EXEC ) ),
+ aGrpQ ( this, BMP_RESID( GRP_Q ) ),
+
+ aCbx1 ( this, BMP_RESID( CBX_1 ) ),
+ pQSet1 ( new MaskSet( this, BMP_RESID( QCOL_1 ) ) ),
+ aSp1 ( this, BMP_RESID( SP_1 ) ),
+ aLbColor1 ( this, BMP_RESID ( LB_1 ) ),
+
+ aCbx2 ( this, BMP_RESID( CBX_2 ) ),
+ pQSet2 ( new MaskSet( this, BMP_RESID( QCOL_2 ) ) ),
+ aSp2 ( this, BMP_RESID( SP_2 ) ),
+ aLbColor2 ( this, BMP_RESID ( LB_2 ) ),
+
+ aCbx3 ( this, BMP_RESID( CBX_3 ) ),
+ pQSet3 ( new MaskSet( this, BMP_RESID( QCOL_3 ) ) ),
+ aSp3 ( this, BMP_RESID( SP_3 ) ),
+ aLbColor3 ( this, BMP_RESID ( LB_3 ) ),
+
+ aCbx4 ( this, BMP_RESID( CBX_4 ) ),
+ pQSet4 ( new MaskSet( this, BMP_RESID( QCOL_4 ) ) ),
+ aSp4 ( this, BMP_RESID( SP_4 ) ),
+ aLbColor4 ( this, BMP_RESID ( LB_4 ) ),
+
+ pData ( new MaskData( this, *pBindinx ) ),
+ aCbxTrans ( this, BMP_RESID( CBX_TRANS ) ),
+ aLbColorTrans ( this, BMP_RESID ( LB_TRANS ) ),
+ aFt1 ( this, BMP_RESID ( FT_1 ) ),
+ aFt2 ( this, BMP_RESID ( FT_2 ) ),
+ aFt3 ( this, BMP_RESID ( FT_3 ) ),
+ pColTab ( NULL ),
+ aPipetteColor ( COL_WHITE ),
+ aSelItem ( SID_BMPMASK_EXEC, *this, *pBindinx ),
+ maImgPipette ( BMP_RESID ( IMG_PIPETTE ) ),
+ maImgPipetteH ( BMP_RESID ( IMG_PIPETTE_H ) )
+{
+ FreeResource();
+
+ ApplyStyle();
+
+ aTbxPipette.SetSizePixel( aTbxPipette.CalcWindowSizePixel() );
+ aTbxPipette.SetSelectHdl( LINK( pData, MaskData, PipetteHdl ) );
+ aBtnExec.SetClickHdl( LINK( pData, MaskData, ExecHdl ) );
+
+ aCbx1.SetClickHdl( LINK( pData, MaskData, CbxHdl ) );
+ aCbx2.SetClickHdl( LINK( pData, MaskData, CbxHdl ) );
+ aCbx3.SetClickHdl( LINK( pData, MaskData, CbxHdl ) );
+ aCbx4.SetClickHdl( LINK( pData, MaskData, CbxHdl ) );
+ aCbxTrans.SetClickHdl( LINK( pData, MaskData, CbxTransHdl ) );
+
+ SetAccessibleNames ();
+
+ aLbColor1.SetGetFocusHdl( LINK( pData, MaskData, FocusLbHdl ) );
+ aLbColor2.SetGetFocusHdl( LINK( pData, MaskData, FocusLbHdl ) );
+ aLbColor3.SetGetFocusHdl( LINK( pData, MaskData, FocusLbHdl ) );
+ aLbColor4.SetGetFocusHdl( LINK( pData, MaskData, FocusLbHdl ) );
+ aLbColorTrans.Disable();
+
+ aSp1.SetValue( 10 );
+ aSp2.SetValue( 10 );
+ aSp3.SetValue( 10 );
+ aSp4.SetValue( 10 );
+
+ pQSet1->SetStyle( pQSet1->GetStyle() | WB_DOUBLEBORDER | WB_ITEMBORDER );
+ pQSet1->SetColCount( 1 );
+ pQSet1->SetLineCount( 1 );
+// pQSet1->SetExtraSpacing( 1 );
+ pQSet1->InsertItem( 1, aPipetteColor );
+ pQSet1->SelectItem( 1 );
+
+ pQSet2->SetStyle( pQSet2->GetStyle() | WB_DOUBLEBORDER | WB_ITEMBORDER );
+ pQSet2->SetColCount( 1 );
+ pQSet2->SetLineCount( 1 );
+// pQSet2->SetExtraSpacing( 1 );
+ pQSet2->InsertItem( 1, aPipetteColor );
+ pQSet2->SelectItem( 0 );
+
+ pQSet3->SetStyle( pQSet3->GetStyle() | WB_DOUBLEBORDER | WB_ITEMBORDER );
+ pQSet3->SetColCount( 1 );
+ pQSet3->SetLineCount( 1 );
+// pQSet3->SetExtraSpacing( 1 );
+ pQSet3->InsertItem( 1, aPipetteColor );
+ pQSet3->SelectItem( 0 );
+
+ pQSet4->SetStyle( pQSet4->GetStyle() | WB_DOUBLEBORDER | WB_ITEMBORDER );
+ pQSet4->SetColCount( 1 );
+ pQSet4->SetLineCount( 1 );
+// pQSet4->SetExtraSpacing( 1 );
+ pQSet4->InsertItem( 1, aPipetteColor );
+ pQSet4->SelectItem( 0 );
+
+ pQSet1->Show();
+ pQSet2->Show();
+ pQSet3->Show();
+ pQSet4->Show();
+}
+
+//-------------------------------------------------------------------------
+
+SvxBmpMask::~SvxBmpMask()
+{
+ delete pQSet1;
+ delete pQSet2;
+ delete pQSet3;
+ delete pQSet4;
+ delete pCtlPipette;
+ delete pData;
+}
+
+//-------------------------------------------------------------------------
+
+/** is called by a MaskSet when it is selected */
+void SvxBmpMask::onSelect( MaskSet* pSet )
+{
+ // automaticaly set focus to the corresponding listbox
+/*
+ if( pSet == pQSet1 )
+ aLbColor1.GrabFocus();
+ else if( pSet == pQSet2 )
+ aLbColor2.GrabFocus();
+ else if( pSet == pQSet2 )
+ aLbColor3.GrabFocus();
+ else if( pSet == pQSet2 )
+ aLbColor4.GrabFocus();
+*/
+
+ // now deselect all other value sets
+ if( pSet != pQSet1 )
+ pQSet1->SelectItem( 0 );
+
+ if( pSet != pQSet2 )
+ pQSet2->SelectItem( 0 );
+
+ if( pSet != pQSet3 )
+ pQSet3->SelectItem( 0 );
+
+ if( pSet != pQSet4 )
+ pQSet4->SelectItem( 0 );
+}
+
+//-------------------------------------------------------------------------
+
+sal_Bool SvxBmpMask::Close()
+{
+ SfxBoolItem aItem2( SID_BMPMASK_PIPETTE, sal_False );
+ GetBindings().GetDispatcher()->Execute( SID_BMPMASK_PIPETTE, OWN_CALLMODE, &aItem2, 0L );
+
+ return SfxDockingWindow::Close();
+}
+
+//-------------------------------------------------------------------------
+
+sal_Bool SvxBmpMask::NeedsColorTable() const
+{
+ return ( aLbColor1.GetEntryCount() == 0 );
+}
+
+//-------------------------------------------------------------------------
+
+void SvxBmpMask::SetColorTable( const XColorTable* pTable )
+{
+ if ( pTable && ( pTable != pColTab ) )
+ {
+ const String aTransp( BMP_RESID( RID_SVXDLG_BMPMASK_STR_TRANSP ) );
+
+ pColTab = pTable;
+
+ aLbColorTrans.Fill( pColTab );
+ aLbColorTrans.SelectEntryPos( 0 );
+
+ aLbColor1.Fill( pColTab );
+ aLbColor1.InsertEntry( TRANSP_COL, aTransp, 0 );
+ aLbColor1.SelectEntryPos( 0 );
+
+ aLbColor2.Fill( pColTab );
+ aLbColor2.InsertEntry( TRANSP_COL, aTransp, 0 );
+ aLbColor2.SelectEntryPos( 0 );
+
+ aLbColor3.Fill( pColTab );
+ aLbColor3.InsertEntry( TRANSP_COL, aTransp, 0 );
+ aLbColor3.SelectEntryPos( 0 );
+
+ aLbColor4.Fill( pColTab );
+ aLbColor4.InsertEntry( TRANSP_COL, aTransp, 0 );
+ aLbColor4.SelectEntryPos( 0 );
+ }
+}
+
+//-------------------------------------------------------------------------
+
+void SvxBmpMask::SetColor( const Color& rColor )
+{
+ aPipetteColor = rColor;
+ pCtlPipette->SetColor( aPipetteColor );
+}
+
+//-------------------------------------------------------------------------
+
+void SvxBmpMask::PipetteClicked()
+{
+ if( pQSet1->GetSelectItemId() == 1 )
+ {
+ aCbx1.Check( sal_True );
+ pData->CbxHdl( &aCbx1 );
+ pQSet1->SetItemColor( 1, aPipetteColor );
+ }
+ else if( pQSet2->GetSelectItemId() == 1 )
+ {
+ aCbx2.Check( sal_True );
+ pData->CbxHdl( &aCbx2 );
+ pQSet2->SetItemColor( 1, aPipetteColor );
+ }
+ else if( pQSet3->GetSelectItemId() == 1 )
+ {
+ aCbx3.Check( sal_True );
+ pData->CbxHdl( &aCbx3 );
+ pQSet3->SetItemColor( 1, aPipetteColor );
+ }
+ else if( pQSet4->GetSelectItemId() == 1 )
+ {
+ aCbx4.Check( sal_True );
+ pData->CbxHdl( &aCbx4 );
+ pQSet4->SetItemColor( 1, aPipetteColor );
+ }
+
+ aTbxPipette.CheckItem( TBI_PIPETTE, sal_False );
+ pData->PipetteHdl( &aTbxPipette );
+}
+
+//-------------------------------------------------------------------------
+
+void SvxBmpMask::SetExecState( sal_Bool bEnable )
+{
+ pData->SetExecState( bEnable );
+
+ if ( pData->IsExecReady() && pData->IsCbxReady() )
+ aBtnExec.Enable();
+ else
+ aBtnExec.Disable();
+}
+
+//-------------------------------------------------------------------------
+
+sal_uInt16 SvxBmpMask::InitColorArrays( Color* pSrcCols, Color* pDstCols, sal_uIntPtr* pTols )
+{
+ sal_uInt16 nCount = 0;
+
+ if ( aCbx1.IsChecked() )
+ {
+ pSrcCols[nCount] = pQSet1->GetItemColor( 1 );
+ pDstCols[nCount] = aLbColor1.GetSelectEntryColor();
+ pTols[nCount++] = static_cast<sal_uIntPtr>(aSp1.GetValue());
+ }
+
+ if ( aCbx2.IsChecked() )
+ {
+ pSrcCols[nCount] = pQSet2->GetItemColor( 1 );
+ pDstCols[nCount] = aLbColor2.GetSelectEntryColor();
+ pTols[nCount++] = static_cast<sal_uIntPtr>(aSp2.GetValue());
+ }
+
+ if ( aCbx3.IsChecked() )
+ {
+ pSrcCols[nCount] = pQSet3->GetItemColor( 1 );
+ pDstCols[nCount] = aLbColor3.GetSelectEntryColor();
+ pTols[nCount++] = static_cast<sal_uIntPtr>(aSp3.GetValue());
+ }
+
+ if ( aCbx4.IsChecked() )
+ {
+ pSrcCols[nCount] = pQSet4->GetItemColor( 1 );
+ pDstCols[nCount] = aLbColor4.GetSelectEntryColor();
+ pTols[nCount++] = static_cast<sal_uIntPtr>(aSp4.GetValue());
+ }
+
+ return nCount;
+}
+
+//-------------------------------------------------------------------------
+
+Bitmap SvxBmpMask::ImpMask( const Bitmap& rBitmap )
+{
+ Bitmap aBitmap( rBitmap );
+ Color pSrcCols[4];
+ Color pDstCols[4];
+ sal_uIntPtr pTols[4];
+ const sal_uInt16 nCount = InitColorArrays( pSrcCols, pDstCols, pTols );
+
+ EnterWait();
+ aBitmap.Replace( pSrcCols, pDstCols, nCount, pTols );
+ LeaveWait();
+
+ return aBitmap;
+}
+
+//-------------------------------------------------------------------------
+
+BitmapEx SvxBmpMask::ImpMask( const BitmapEx& rBitmapEx )
+{
+ return BitmapEx( ImpMask( rBitmapEx.GetBitmap() ), rBitmapEx.GetMask() );
+}
+
+//-------------------------------------------------------------------------
+
+BitmapEx SvxBmpMask::ImpMaskTransparent( const BitmapEx& rBitmapEx, const Color& rColor, const long nTol )
+{
+ EnterWait();
+
+ BitmapEx aBmpEx;
+ Bitmap aMask( rBitmapEx.GetBitmap().CreateMask( rColor, nTol ) );
+
+ if( rBitmapEx.IsTransparent() )
+ aMask.CombineSimple( rBitmapEx.GetMask(), BMP_COMBINE_OR );
+
+ aBmpEx = BitmapEx( rBitmapEx.GetBitmap(), aMask );
+ LeaveWait();
+
+ return aBmpEx;
+}
+
+//-------------------------------------------------------------------------
+
+Animation SvxBmpMask::ImpMask( const Animation& rAnimation )
+{
+ Animation aAnimation( rAnimation );
+ Color pSrcCols[4];
+ Color pDstCols[4];
+ sal_uIntPtr pTols[4];
+ InitColorArrays( pSrcCols, pDstCols, pTols );
+ sal_uInt16 nAnimationCount = aAnimation.Count();
+
+ for( sal_uInt16 i = 0; i < nAnimationCount; i++ )
+ {
+ AnimationBitmap aAnimBmp( aAnimation.Get( i ) );
+ aAnimBmp.aBmpEx = Mask( aAnimBmp.aBmpEx ).GetBitmapEx();
+ aAnimation.Replace( aAnimBmp, i );
+ }
+
+ return aAnimation;
+}
+
+//-------------------------------------------------------------------------
+
+GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf )
+{
+ GDIMetaFile aMtf;
+ Color pSrcCols[4];
+ Color pDstCols[4];
+ sal_uIntPtr pTols[4];
+ sal_uInt16 nCount = InitColorArrays( pSrcCols, pDstCols, pTols );
+ sal_Bool pTrans[4];
+
+ // Falls keine Farben ausgewaehlt, kopieren wir nur das Mtf
+ if( !nCount )
+ aMtf = rMtf;
+ else
+ {
+ Color aCol;
+ long nVal;
+ long nTol;
+ long nR;
+ long nG;
+ long nB;
+ long* pMinR = new long[nCount];
+ long* pMaxR = new long[nCount];
+ long* pMinG = new long[nCount];
+ long* pMaxG = new long[nCount];
+ long* pMinB = new long[nCount];
+ long* pMaxB = new long[nCount];
+ sal_uInt16 i;
+ sal_Bool bReplace;
+
+ aMtf.SetPrefSize( rMtf.GetPrefSize() );
+ aMtf.SetPrefMapMode( rMtf.GetPrefMapMode() );
+
+ // Farbvergleichsarrays vorbereiten
+ for( i = 0; i < nCount; i++ )
+ {
+ nTol = ( pTols[i] * 255L ) / 100L;
+
+ nVal = ( (long) pSrcCols[i].GetRed() );
+ pMinR[i] = Max( nVal - nTol, 0L );
+ pMaxR[i] = Min( nVal + nTol, 255L );
+
+ nVal = ( (long) pSrcCols[i].GetGreen() );
+ pMinG[i] = Max( nVal - nTol, 0L );
+ pMaxG[i] = Min( nVal + nTol, 255L );
+
+ nVal = ( (long) pSrcCols[i].GetBlue() );
+ pMinB[i] = Max( nVal - nTol, 0L );
+ pMaxB[i] = Min( nVal + nTol, 255L );
+
+ pTrans[ i ] = ( pDstCols[ i ] == TRANSP_COL );
+ }
+
+ // Actions untersuchen und Farben ggf. ersetzen
+ for( sal_uIntPtr nAct = 0UL, nActCount = rMtf.GetActionCount(); nAct < nActCount; nAct++ )
+ {
+ MetaAction* pAction = rMtf.GetAction( nAct );
+
+ bReplace = sal_False;
+
+ switch( pAction->GetType() )
+ {
+ case( META_PIXEL_ACTION ):
+ {
+ MetaPixelAction* pAct = (MetaPixelAction*) pAction;
+
+ aCol = pAct->GetColor();
+ TEST_COLS();
+
+ if( bReplace )
+ pAct = new MetaPixelAction( pAct->GetPoint(), aCol );
+ else
+ pAct->Duplicate();
+
+ aMtf.AddAction( pAct );
+ }
+ break;
+
+ case( META_LINECOLOR_ACTION ):
+ {
+ MetaLineColorAction* pAct = (MetaLineColorAction*) pAction;
+
+ aCol = pAct->GetColor();
+ TEST_COLS();
+
+ if( bReplace )
+ pAct = new MetaLineColorAction( aCol, !pTrans[ i ] );
+ else
+ pAct->Duplicate();
+
+ aMtf.AddAction( pAct );
+ }
+ break;
+
+ case( META_FILLCOLOR_ACTION ):
+ {
+ MetaFillColorAction* pAct = (MetaFillColorAction*) pAction;
+
+ aCol = pAct->GetColor();
+ TEST_COLS();
+
+ if( bReplace )
+ pAct = new MetaFillColorAction( aCol, !pTrans[ i ] );
+ else
+ pAct->Duplicate();
+
+ aMtf.AddAction( pAct );
+ }
+ break;
+
+ case( META_TEXTCOLOR_ACTION ):
+ {
+ MetaTextColorAction* pAct = (MetaTextColorAction*) pAction;
+
+ aCol = pAct->GetColor();
+ TEST_COLS();
+
+ if( bReplace )
+ pAct = new MetaTextColorAction( aCol );
+ else
+ pAct->Duplicate();
+
+ aMtf.AddAction( pAct );
+ }
+ break;
+
+ case( META_TEXTFILLCOLOR_ACTION ):
+ {
+ MetaTextFillColorAction* pAct = (MetaTextFillColorAction*) pAction;
+
+ aCol = pAct->GetColor();
+ TEST_COLS();
+
+ if( bReplace )
+ pAct = new MetaTextFillColorAction( aCol, !pTrans[ i ] );
+ else
+ pAct->Duplicate();
+
+ aMtf.AddAction( pAct );
+ }
+ break;
+
+ case( META_FONT_ACTION ):
+ {
+ MetaFontAction* pAct = (MetaFontAction*) pAction;
+ Font aFont( pAct->GetFont() );
+
+ aCol = aFont.GetColor();
+ TEST_COLS();
+
+ if( bReplace )
+ {
+ aFont.SetColor( aCol );
+ pAct = new MetaFontAction( aFont );
+ }
+ else
+ pAct->Duplicate();
+
+ aMtf.AddAction( pAct );
+ }
+ break;
+
+ case( META_WALLPAPER_ACTION ):
+ {
+ MetaWallpaperAction* pAct = (MetaWallpaperAction*) pAction;
+ Wallpaper aWall( pAct->GetWallpaper() );
+
+ aCol = aWall.GetColor();
+ TEST_COLS();
+
+ if( bReplace )
+ {
+ aWall.SetColor( aCol );
+ pAct = new MetaWallpaperAction( pAct->GetRect(), aWall );
+ }
+ else
+ pAct->Duplicate();
+
+ aMtf.AddAction( pAct );
+ }
+ break;
+
+ case( META_BMP_ACTION ):
+ {
+ MetaBmpAction* pAct = (MetaBmpAction*) pAction;
+ const Bitmap aBmp( Mask( pAct->GetBitmap() ).GetBitmap() );
+
+ pAct = new MetaBmpAction( pAct->GetPoint(), aBmp );
+ aMtf.AddAction( pAct );
+ }
+ break;
+
+ case( META_BMPSCALE_ACTION ):
+ {
+ MetaBmpScaleAction* pAct = (MetaBmpScaleAction*) pAction;
+ const Bitmap aBmp( Mask( pAct->GetBitmap() ).GetBitmap() );
+
+ pAct = new MetaBmpScaleAction( pAct->GetPoint(), pAct->GetSize(), aBmp );
+ aMtf.AddAction( pAct );
+ }
+ break;
+
+ case( META_BMPSCALEPART_ACTION ):
+ {
+ MetaBmpScalePartAction* pAct = (MetaBmpScalePartAction*) pAction;
+ const Bitmap aBmp( Mask( pAct->GetBitmap() ).GetBitmap() );
+
+ pAct = new MetaBmpScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(),
+ pAct->GetSrcPoint(), pAct->GetSrcSize(), aBmp );
+ aMtf.AddAction( pAct );
+ }
+ break;
+
+ case( META_BMPEX_ACTION ):
+ {
+ MetaBmpExAction* pAct = (MetaBmpExAction*) pAction;
+ const BitmapEx aBmpEx( Mask( pAct->GetBitmapEx() ).GetBitmapEx() );
+
+ pAct = new MetaBmpExAction( pAct->GetPoint(), aBmpEx );
+ aMtf.AddAction( pAct );
+ }
+ break;
+
+ case( META_BMPEXSCALE_ACTION ):
+ {
+ MetaBmpExScaleAction* pAct = (MetaBmpExScaleAction*) pAction;
+ const BitmapEx aBmpEx( Mask( pAct->GetBitmapEx() ).GetBitmapEx() );
+
+ pAct = new MetaBmpExScaleAction( pAct->GetPoint(), pAct->GetSize(), aBmpEx );
+ aMtf.AddAction( pAct );
+ }
+ break;
+
+ case( META_BMPEXSCALEPART_ACTION ):
+ {
+ MetaBmpExScalePartAction* pAct = (MetaBmpExScalePartAction*) pAction;
+ const BitmapEx aBmpEx( Mask( pAct->GetBitmapEx() ).GetBitmapEx() );
+
+ pAct = new MetaBmpExScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(),
+ pAct->GetSrcPoint(), pAct->GetSrcSize(), aBmpEx );
+ aMtf.AddAction( pAct );
+ }
+ break;
+
+ default:
+ {
+ pAction->Duplicate();
+ aMtf.AddAction( pAction );
+ }
+ break;
+ }
+ }
+
+ delete[] pMinR;
+ delete[] pMaxR;
+ delete[] pMinG;
+ delete[] pMaxG;
+ delete[] pMinB;
+ delete[] pMaxB;
+ }
+
+ LeaveWait();
+
+ return aMtf;
+}
+
+//-------------------------------------------------------------------------
+
+BitmapEx SvxBmpMask::ImpReplaceTransparency( const BitmapEx& rBmpEx, const Color& rColor )
+{
+ if( rBmpEx.IsTransparent() )
+ {
+ Bitmap aBmp( rBmpEx.GetBitmap() );
+ aBmp.Replace( rBmpEx.GetMask(), rColor );
+ return aBmp;
+ }
+ else
+ return rBmpEx;
+}
+
+//-------------------------------------------------------------------------
+
+Animation SvxBmpMask::ImpReplaceTransparency( const Animation& rAnim, const Color& rColor )
+{
+ Animation aAnimation( rAnim );
+ sal_uInt16 nAnimationCount = aAnimation.Count();
+
+ for( sal_uInt16 i = 0; i < nAnimationCount; i++ )
+ {
+ AnimationBitmap aAnimBmp( aAnimation.Get( i ) );
+ aAnimBmp.aBmpEx = ImpReplaceTransparency( aAnimBmp.aBmpEx, rColor );
+ aAnimation.Replace( aAnimBmp, i );
+ }
+
+ return aAnimation;
+}
+
+//-------------------------------------------------------------------------
+
+GDIMetaFile SvxBmpMask::ImpReplaceTransparency( const GDIMetaFile& rMtf, const Color& rColor )
+{
+ VirtualDevice aVDev;
+ GDIMetaFile aMtf;
+ const MapMode& rPrefMap = rMtf.GetPrefMapMode();
+ const Size& rPrefSize = rMtf.GetPrefSize();
+ const sal_uIntPtr nActionCount = rMtf.GetActionCount();
+
+ aVDev.EnableOutput( sal_False );
+ aMtf.Record( &aVDev );
+ aMtf.SetPrefSize( rPrefSize );
+ aMtf.SetPrefMapMode( rPrefMap );
+ aVDev.SetLineColor( rColor );
+ aVDev.SetFillColor( rColor );
+
+ // Actions nacheinander abspielen; zuerst
+ // den gesamten Bereich auf die Ersatzfarbe setzen
+ aVDev.DrawRect( Rectangle( rPrefMap.GetOrigin(), rPrefSize ) );
+ for ( sal_uIntPtr i = 0; i < nActionCount; i++ )
+ {
+ MetaAction* pAct = rMtf.GetAction( i );
+
+ pAct->Duplicate();
+ aMtf.AddAction( pAct );
+ }
+
+ aMtf.Stop();
+ aMtf.WindStart();
+
+ return aMtf;
+}
+
+//-------------------------------------------------------------------------
+
+Graphic SvxBmpMask::Mask( const Graphic& rGraphic )
+{
+ Graphic aGraphic( rGraphic );
+ const Color aReplColor( aLbColorTrans.GetSelectEntryColor() );
+
+ switch( rGraphic.GetType() )
+ {
+ case( GRAPHIC_BITMAP ):
+ {
+ if( rGraphic.IsAnimated() )
+ {
+ // Transparenz ersetzen?
+ if ( aCbxTrans.IsChecked() )
+ aGraphic = ImpReplaceTransparency( rGraphic.GetAnimation(), aReplColor );
+ else
+ aGraphic = ImpMask( rGraphic.GetAnimation() );
+ }
+ else
+ {
+ // Transparenz ersetzen?
+ if( aCbxTrans.IsChecked() )
+ {
+ if( aGraphic.IsTransparent() )
+ {
+ BitmapEx aBmpEx( ImpReplaceTransparency( aGraphic.GetBitmapEx(), aReplColor ) );
+ const Size aSize( aBmpEx.GetSizePixel() );
+
+ if( aSize.Width() && aSize.Height() )
+ aGraphic = aBmpEx;
+ }
+ }
+ else
+ {
+ Color pSrcCols[4];
+ Color pDstCols[4];
+ sal_uIntPtr pTols[4];
+ sal_uInt16 nCount = InitColorArrays( pSrcCols, pDstCols, pTols );
+
+ if( nCount )
+ {
+ // erstmal alle Transparent-Farben setzen
+ for( sal_uInt16 i = 0; i < nCount; i++ )
+ {
+ // Haben wir eine Transparenzfarbe?
+ if( pDstCols[i] == TRANSP_COL )
+ {
+ BitmapEx aBmpEx( ImpMaskTransparent( aGraphic.GetBitmapEx(),
+ pSrcCols[ i ], pTols[ i ] ) );
+ const Size aSize( aBmpEx.GetSizePixel() );
+
+ if( aSize.Width() && aSize.Height() )
+ aGraphic = aBmpEx;
+ }
+ }
+
+ // jetzt noch einmal mit den normalen Farben ersetzen
+ Bitmap aBitmap( ImpMask( aGraphic.GetBitmap() ) );
+ Size aSize( aBitmap.GetSizePixel() );
+
+ if ( aSize.Width() && aSize.Height() )
+ {
+ if ( aGraphic.IsTransparent() )
+ aGraphic = Graphic( BitmapEx( aBitmap, aGraphic.GetBitmapEx().GetMask() ) );
+ else
+ aGraphic = aBitmap;
+ }
+ }
+ }
+ }
+ }
+ break;
+
+ case( GRAPHIC_GDIMETAFILE ):
+ {
+ GDIMetaFile aMtf( aGraphic.GetGDIMetaFile() );
+
+ // Transparenz ersetzen?
+ if( aCbxTrans.IsChecked() )
+ aMtf = ImpReplaceTransparency( aMtf, aReplColor );
+ else
+ aMtf = ImpMask( aMtf );
+
+ Size aSize( aMtf.GetPrefSize() );
+ if ( aSize.Width() && aSize.Height() )
+ aGraphic = Graphic( aMtf );
+ else
+ aGraphic = rGraphic;
+ }
+ break;
+
+ default:
+ aGraphic = rGraphic;
+ break;
+ }
+
+ if( aGraphic != rGraphic )
+ {
+ aGraphic.SetPrefSize( rGraphic.GetPrefSize() );
+ aGraphic.SetPrefMapMode( rGraphic.GetPrefMapMode() );
+ }
+
+ return aGraphic;
+}
+
+//-------------------------------------------------------------------------
+
+sal_Bool SvxBmpMask::IsEyedropping() const
+{
+ return aTbxPipette.IsItemChecked( TBI_PIPETTE );
+}
+
+void SvxBmpMask::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SfxDockingWindow::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ ApplyStyle();
+}
+
+void SvxBmpMask::ApplyStyle()
+{
+ bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ aTbxPipette.SetItemImage( TBI_PIPETTE, bHighContrast ? maImgPipetteH : maImgPipette );
+}
+
+
+/** Set an accessible name for the source color check boxes. Without this
+ the lengthy description is read.
+*/
+void SvxBmpMask::SetAccessibleNames (void)
+{
+ String sSourceColor (BMP_RESID( RID_SVXDLG_BMPMASK_STR_SOURCECOLOR));
+ String sSourceColorN;
+
+ sSourceColorN = sSourceColor;
+ sSourceColorN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 1"));
+ aCbx1.SetAccessibleName (sSourceColorN);
+
+ sSourceColorN = sSourceColor;
+ sSourceColorN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 2"));
+ aCbx2.SetAccessibleName (sSourceColorN);
+
+ sSourceColorN = sSourceColor;
+ sSourceColorN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 3"));
+ aCbx3.SetAccessibleName (sSourceColorN);
+
+ sSourceColorN = sSourceColor;
+ sSourceColorN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 4"));
+ aCbx4.SetAccessibleName (sSourceColorN);
+}
diff --git a/svx/source/dialog/_contdlg.cxx b/svx/source/dialog/_contdlg.cxx
new file mode 100644
index 000000000000..cff80865e1c8
--- /dev/null
+++ b/svx/source/dialog/_contdlg.cxx
@@ -0,0 +1,1161 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <vcl/wrkwin.hxx>
+#include <sot/factory.hxx>
+#include <tools/shl.hxx>
+#include <vcl/salbtype.hxx> // FRound
+#include <vcl/msgbox.hxx>
+#include <svl/eitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svtools/miscopt.hxx>
+#include <unotools/localedatawrapper.hxx>
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX
+#include <comphelper/processfactory.hxx>
+#endif
+
+#define _SDR_NOITEMS
+#define _SDR_NOTOUCH
+#define _SDR_NOTRANSFORM
+#define _SDR_NOOBJECTS
+#define _SDR_NOVIEWMARKER
+#define _SDR_NODRAGMETHODS
+#define _SDR_NOUNDO
+#define _SDR_NOXOUTDEV
+#define _XOUTBMP_STATICS_ONLY
+
+#include <svx/dialmgr.hxx>
+#include "svx/xoutbmp.hxx"
+#include <svx/dialogs.hrc>
+#include <svx/svxids.hrc>
+#include <svx/contdlg.hxx>
+#include "contimp.hxx"
+#include "contdlg.hrc"
+#include "contwnd.hxx"
+#include <svx/svdtrans.hxx>
+#include <svx/svdopath.hxx>
+#include "svx/dlgutil.hxx"
+#include <vcl/svapp.hxx>
+
+/******************************************************************************/
+
+inline String GetUnitString( long nVal_100, FieldUnit eFieldUnit, sal_Unicode cSep )
+{
+ String aVal = UniString::CreateFromInt64( MetricField::ConvertValue( nVal_100, 2, MAP_100TH_MM, eFieldUnit ) );
+
+ while( aVal.Len() < 3 )
+ aVal.Insert( sal_Unicode('0'), 0 );
+
+ aVal.Insert( cSep, aVal.Len() - 2 );
+ aVal += sal_Unicode(' ');
+ aVal += SdrFormatter::GetUnitStr( eFieldUnit );
+
+ return aVal;
+}
+
+
+/******************************************************************************/
+
+
+SFX_IMPL_FLOATINGWINDOW( SvxContourDlgChildWindow, SID_CONTOUR_DLG );
+
+
+/******************************************************************************/
+
+
+/*************************************************************************
+|*
+|* ControllerItem
+|*
+\************************************************************************/
+
+SvxContourDlgItem::SvxContourDlgItem( sal_uInt16 _nId, SvxSuperContourDlg& rContourDlg, SfxBindings& rBindings ) :
+ SfxControllerItem ( _nId, rBindings ),
+ rDlg ( rContourDlg )
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxContourDlgItem::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/, const SfxPoolItem* pItem )
+{
+ if ( pItem && ( SID_CONTOUR_EXEC == nSID ) )
+ {
+ const SfxBoolItem* pStateItem = PTR_CAST( SfxBoolItem, pItem );
+
+ DBG_ASSERT( pStateItem || pItem == 0, "SfxBoolItem erwartet");
+
+ rDlg.SetExecState( !pStateItem->GetValue() );
+ }
+}
+
+
+/******************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Contour-Float
+|*
+\************************************************************************/
+
+SvxContourDlgChildWindow::SvxContourDlgChildWindow( Window* _pParent, sal_uInt16 nId,
+ SfxBindings* pBindings, SfxChildWinInfo* pInfo ) :
+ SfxChildWindow( _pParent, nId )
+{
+ SvxSuperContourDlg* pDlg = new SvxSuperContourDlg( pBindings, this, _pParent, CONT_RESID( RID_SVXDLG_CONTOUR ) );
+ pWindow = pDlg;
+
+ if ( pInfo->nFlags & SFX_CHILDWIN_ZOOMIN )
+ pDlg->RollUp();
+
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+
+ pDlg->Initialize( pInfo );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxContourDlgChildWindow::UpdateContourDlg( const Graphic& rGraphic, sal_Bool bGraphicLinked,
+ const PolyPolygon* pPolyPoly, void* pEditingObj )
+{
+ if ( SfxViewFrame::Current() &&
+ SfxViewFrame::Current()->HasChildWindow( SvxContourDlgChildWindow::GetChildWindowId() ) )
+ SVXCONTOURDLG()->Update( rGraphic, bGraphicLinked, pPolyPoly, pEditingObj );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+SvxContourDlg::SvxContourDlg( SfxBindings* _pBindings, SfxChildWindow* pCW,
+ Window* _pParent, const ResId& rResId ) :
+
+ SfxFloatingWindow ( _pBindings, pCW, _pParent, rResId )
+
+{
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+SvxContourDlg::~SvxContourDlg()
+{
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+PolyPolygon SvxContourDlg::CreateAutoContour( const Graphic& rGraphic,
+ const Rectangle* pRect,
+ const sal_uIntPtr nFlags )
+{
+ Bitmap aBmp;
+ sal_uIntPtr nContourFlags = XOUTBMP_CONTOUR_HORZ;
+
+ if ( rGraphic.GetType() == GRAPHIC_BITMAP )
+ {
+ if( rGraphic.IsAnimated() )
+ {
+ VirtualDevice aVDev;
+ MapMode aTransMap;
+ PolyPolygon aAnimPolyPoly;
+ const Animation aAnim( rGraphic.GetAnimation() );
+ const Size& rSizePix = aAnim.GetDisplaySizePixel();
+ const sal_uInt16 nCount = aAnim.Count();
+
+ if ( aVDev.SetOutputSizePixel( rSizePix ) )
+ {
+ aVDev.SetLineColor( Color( COL_BLACK ) );
+ aVDev.SetFillColor( Color( COL_BLACK ) );
+
+ for( sal_uInt16 i = 0; i < nCount; i++ )
+ {
+ const AnimationBitmap& rStepBmp = aAnim.Get( i );
+
+ // Polygonausgabe an die richtige Stelle schieben;
+ // dies ist der Offset des Teilbildes innerhalb
+ // der Gesamtanimation
+ aTransMap.SetOrigin( Point( rStepBmp.aPosPix.X(), rStepBmp.aPosPix.Y() ) );
+ aVDev.SetMapMode( aTransMap );
+ aVDev.DrawPolyPolygon( CreateAutoContour( rStepBmp.aBmpEx, pRect, nFlags ) );
+ }
+
+ aTransMap.SetOrigin( Point() );
+ aVDev.SetMapMode( aTransMap );
+ aBmp = aVDev.GetBitmap( Point(), rSizePix );
+ aBmp.Convert( BMP_CONVERSION_1BIT_THRESHOLD );
+ }
+ }
+ else if( rGraphic.IsTransparent() )
+ aBmp = rGraphic.GetBitmapEx().GetMask();
+ else
+ {
+ aBmp = rGraphic.GetBitmap();
+ nContourFlags |= XOUTBMP_CONTOUR_EDGEDETECT;
+ }
+ }
+ else if( rGraphic.GetType() != GRAPHIC_NONE )
+ {
+ const Graphic aTmpGrf( rGraphic.GetGDIMetaFile().GetMonochromeMtf( Color( COL_BLACK ) ) );
+ VirtualDevice aVDev;
+ Size aSizePix( aVDev.LogicToPixel( aTmpGrf.GetPrefSize(), aTmpGrf.GetPrefMapMode() ) );
+
+ if( aSizePix.Width() && aSizePix.Height() && ( aSizePix.Width() > 512 || aSizePix.Height() > 512 ) )
+ {
+ double fWH = (double) aSizePix.Width() / aSizePix.Height();
+
+ if( fWH <= 1.0 )
+ aSizePix.Width() = FRound( ( aSizePix.Height() = 512 ) * fWH );
+ else
+ aSizePix.Height() = FRound( ( aSizePix.Width() = 512 ) / fWH );
+ }
+
+ if( aVDev.SetOutputSizePixel( aSizePix ) )
+ {
+ const Point aPt;
+ aTmpGrf.Draw( &aVDev, aPt, aSizePix );
+ aBmp = aVDev.GetBitmap( aPt, aSizePix );
+ }
+
+ nContourFlags |= XOUTBMP_CONTOUR_EDGEDETECT;
+ }
+
+ aBmp.SetPrefSize( rGraphic.GetPrefSize() );
+ aBmp.SetPrefMapMode( rGraphic.GetPrefMapMode() );
+
+ return PolyPolygon( XOutBitmap::GetCountour( aBmp, nContourFlags, 128, pRect ) );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxContourDlg::ScaleContour( PolyPolygon& rContour, const Graphic& rGraphic,
+ const MapUnit eUnit, const Size& rDisplaySize )
+{
+ DBG_ASSERT( rGraphic.GetType() != GRAPHIC_NONE, "Graphic is not valid!" );
+
+ OutputDevice* pOutDev = Application::GetDefaultDevice();
+ const MapMode aDispMap( eUnit );
+ const MapMode aGrfMap( rGraphic.GetPrefMapMode() );
+ const Size aGrfSize( rGraphic.GetPrefSize() );
+ double fScaleX;
+ double fScaleY;
+ Size aOrgSize;
+ Point aNewPoint;
+ sal_Bool bPixelMap = aGrfMap.GetMapUnit() == MAP_PIXEL;
+
+ if ( bPixelMap )
+ aOrgSize = pOutDev->PixelToLogic( aGrfSize, aDispMap );
+ else
+ aOrgSize = pOutDev->LogicToLogic( aGrfSize, aGrfMap, aDispMap );
+
+ if ( aOrgSize.Width() && aOrgSize.Height() )
+ {
+ fScaleX = (double) rDisplaySize.Width() / aOrgSize.Width();
+ fScaleY = (double) rDisplaySize.Height() / aOrgSize.Height();
+
+ for ( sal_uInt16 j = 0, nPolyCount = rContour.Count(); j < nPolyCount; j++ )
+ {
+ Polygon& rPoly = rContour[ j ];
+
+ for ( sal_uInt16 i = 0, nCount = rPoly.GetSize(); i < nCount; i++ )
+ {
+ if ( bPixelMap )
+ aNewPoint = pOutDev->PixelToLogic( rPoly[ i ], aDispMap );
+ else
+ aNewPoint = pOutDev->LogicToLogic( rPoly[ i ], aGrfMap, aDispMap );
+
+ rPoly[ i ] = Point( FRound( aNewPoint.X() * fScaleX ), FRound( aNewPoint.Y() * fScaleY ) );
+ }
+ }
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Durchschleifen an SuperClass; keine virt. Methoden, um
+|* bei IF-Aenderungen nicht inkompatibel zu werden
+|*
+\************************************************************************/
+
+void SvxContourDlg::SetExecState( sal_Bool bEnable )
+{
+ pSuperClass->SetExecState( bEnable );
+}
+
+void SvxContourDlg::SetGraphic( const Graphic& rGraphic )
+{
+ pSuperClass->SetGraphic( rGraphic );
+}
+
+void SvxContourDlg::SetGraphicLinked( sal_Bool bGraphicLinked )
+{
+ pSuperClass->SetGraphicLinked( bGraphicLinked );
+}
+
+const Graphic& SvxContourDlg::GetGraphic() const
+{
+ return pSuperClass->GetGraphic();
+}
+
+sal_Bool SvxContourDlg::IsGraphicChanged() const
+{
+ return pSuperClass->IsGraphicChanged();
+}
+
+void SvxContourDlg::SetPolyPolygon( const PolyPolygon& rPolyPoly )
+{
+ pSuperClass->SetPolyPolygon( rPolyPoly );
+}
+
+PolyPolygon SvxContourDlg::GetPolyPolygon()
+{
+ return pSuperClass->GetPolyPolygon( sal_True );
+}
+
+void SvxContourDlg::SetEditingObject( void* pObj )
+{
+ pSuperClass->SetEditingObject( pObj );
+}
+
+const void* SvxContourDlg::GetEditingObject() const
+{
+ return pSuperClass->GetEditingObject();
+}
+
+void SvxContourDlg::Update( const Graphic& rGraphic, sal_Bool bGraphicLinked,
+ const PolyPolygon* pPolyPoly, void* pEditingObj )
+{
+ pSuperClass->UpdateGraphic( rGraphic, bGraphicLinked, pPolyPoly, pEditingObj );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+SvxSuperContourDlg::SvxSuperContourDlg( SfxBindings *_pBindings, SfxChildWindow *pCW,
+ Window* _pParent, const ResId& rResId ) :
+ SvxContourDlg ( _pBindings, pCW, _pParent, rResId ),
+ pCheckObj ( NULL ),
+ aContourItem ( SID_CONTOUR_EXEC, *this, *_pBindings ),
+ aTbx1 ( this, ResId( TBX1, *rResId.GetResMgr() ) ),
+ aMtfTolerance ( this, ResId( MTF_TOLERANCE, *rResId.GetResMgr() ) ),
+ aContourWnd ( this, ResId( CTL_CONTOUR, *rResId.GetResMgr() ) ),
+ aStbStatus ( this, WB_BORDER | WB_3DLOOK | WB_LEFT ),
+ nGrfChanged ( 0UL ),
+ bExecState ( sal_False ),
+ bGraphicLinked ( sal_False ),
+ maImageList ( SVX_RES( CD_IMAPDLG ) ),
+ maImageListH ( SVX_RES( CDH_IMAPDLG ) )
+{
+ ApplyImageList();
+
+ FreeResource();
+
+ SvxContourDlg::SetSuperClass( *this );
+
+ aContourWnd.SetMousePosLink( LINK( this, SvxSuperContourDlg, MousePosHdl ) );
+ aContourWnd.SetGraphSizeLink( LINK( this, SvxSuperContourDlg, GraphSizeHdl ) );
+ aContourWnd.SetUpdateLink( LINK( this, SvxSuperContourDlg, StateHdl ) );
+ aContourWnd.SetPipetteHdl( LINK( this, SvxSuperContourDlg, PipetteHdl ) );
+ aContourWnd.SetPipetteClickHdl( LINK( this, SvxSuperContourDlg, PipetteClickHdl ) );
+ aContourWnd.SetWorkplaceClickHdl( LINK( this, SvxSuperContourDlg, WorkplaceClickHdl ) );
+
+ const Size aTbxSize( aTbx1.CalcWindowSizePixel() );
+ Point aPos( aTbx1.GetPosPixel() );
+ SvtMiscOptions aMiscOptions;
+
+ aMiscOptions.AddListenerLink( LINK( this, SvxSuperContourDlg, MiscHdl ) );
+
+ aTbx1.SetOutStyle( aMiscOptions.GetToolboxStyle() );
+ aTbx1.SetSizePixel( aTbxSize );
+ aTbx1.SetSelectHdl( LINK( this, SvxSuperContourDlg, Tbx1ClickHdl ) );
+
+ aPos.X() += aTbxSize.Width() + LogicToPixel( Size( 3, 0 ), MapMode( MAP_APPFONT ) ).Width();
+ aMtfTolerance.SetPosPixel( aPos );
+ aMtfTolerance.SetValue( 10L );
+
+ SetMinOutputSizePixel( aLastSize = GetOutputSizePixel() );
+
+ aStbStatus.InsertItem( 1, 130, SIB_LEFT | SIB_IN | SIB_AUTOSIZE );
+ aStbStatus.InsertItem( 2, 10 + GetTextWidth( String::CreateFromAscii( " 9999,99 cm / 9999,99 cm " ) ), SIB_CENTER | SIB_IN );
+ aStbStatus.InsertItem( 3, 10 + GetTextWidth( String::CreateFromAscii( " 9999,99 cm x 9999,99 cm " ) ), SIB_CENTER | SIB_IN );
+ aStbStatus.InsertItem( 4, 20, SIB_CENTER | SIB_IN );
+
+ Resize();
+
+ aUpdateTimer.SetTimeout( 100 );
+ aUpdateTimer.SetTimeoutHdl( LINK( this, SvxSuperContourDlg, UpdateHdl ) );
+
+ aCreateTimer.SetTimeout( 50 );
+ aCreateTimer.SetTimeoutHdl( LINK( this, SvxSuperContourDlg, CreateHdl ) );
+}
+
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+SvxSuperContourDlg::~SvxSuperContourDlg()
+{
+}
+
+
+/*************************************************************************
+|*
+|* Resize-Methode
+|*
+\************************************************************************/
+
+void SvxSuperContourDlg::Resize()
+{
+ SfxFloatingWindow::Resize();
+
+ Size aMinSize( GetMinOutputSizePixel() );
+ Size aNewSize( GetOutputSizePixel() );
+
+ if ( aNewSize.Height() >= aMinSize.Height() )
+ {
+ Size _aSize( aStbStatus.GetSizePixel() );
+ Point aPoint( 0, aNewSize.Height() - _aSize.Height() );
+
+ // StatusBar positionieren
+ aStbStatus.SetPosSizePixel( aPoint, Size( aNewSize.Width(), _aSize.Height() ) );
+ aStbStatus.Show();
+
+ // EditWindow positionieren
+ _aSize.Width() = aNewSize.Width() - 18;
+ _aSize.Height() = aPoint.Y() - aContourWnd.GetPosPixel().Y() - 6;
+ aContourWnd.SetSizePixel( _aSize );
+
+ aLastSize = aNewSize;
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Close-Methode
+|*
+\************************************************************************/
+
+sal_Bool SvxSuperContourDlg::Close()
+{
+ sal_Bool bRet = sal_True;
+
+ if ( aTbx1.IsItemEnabled( TBI_APPLY ) )
+ {
+ QueryBox aQBox( this, WB_YES_NO_CANCEL | WB_DEF_YES,
+ String( CONT_RESID( STR_CONTOURDLG_MODIFY ) ) );
+ const long nRet = aQBox.Execute();
+
+ if ( nRet == RET_YES )
+ {
+ SfxBoolItem aBoolItem( SID_CONTOUR_EXEC, sal_True );
+ GetBindings().GetDispatcher()->Execute(
+ SID_CONTOUR_EXEC, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD, &aBoolItem, 0L );
+ }
+ else if ( nRet == RET_CANCEL )
+ bRet = sal_False;
+ }
+
+ return( bRet ? SfxFloatingWindow::Close() : sal_False );
+}
+
+
+/*************************************************************************
+|*
+|* Enabled oder disabled alle Controls
+|*
+\************************************************************************/
+
+void SvxSuperContourDlg::SetExecState( sal_Bool bEnable )
+{
+ bExecState = bEnable;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxSuperContourDlg::SetGraphic( const Graphic& rGraphic )
+{
+ aUndoGraphic = aRedoGraphic = Graphic();
+ aGraphic = rGraphic;
+ nGrfChanged = 0UL;
+ aContourWnd.SetGraphic( aGraphic );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxSuperContourDlg::SetPolyPolygon( const PolyPolygon& rPolyPoly )
+{
+ DBG_ASSERT( aContourWnd.GetGraphic().GetType() != GRAPHIC_NONE, "Graphic must've been set first!" );
+
+ PolyPolygon aPolyPoly( rPolyPoly );
+ const MapMode aMap100( MAP_100TH_MM );
+ const MapMode aGrfMap( aGraphic.GetPrefMapMode() );
+ OutputDevice* pOutDev = Application::GetDefaultDevice();
+ sal_Bool bPixelMap = aGrfMap.GetMapUnit() == MAP_PIXEL;
+
+ for ( sal_uInt16 j = 0, nPolyCount = aPolyPoly.Count(); j < nPolyCount; j++ )
+ {
+ Polygon& rPoly = aPolyPoly[ j ];
+
+ for ( sal_uInt16 i = 0, nCount = rPoly.GetSize(); i < nCount; i++ )
+ {
+ Point& rPt = rPoly[ i ];
+
+ if ( !bPixelMap )
+ rPt = pOutDev->LogicToPixel( rPt, aGrfMap );
+
+ rPt = pOutDev->PixelToLogic( rPt, aMap100 );
+ }
+ }
+
+ aContourWnd.SetPolyPolygon( aPolyPoly );
+ aContourWnd.GetSdrModel()->SetChanged( sal_True );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+PolyPolygon SvxSuperContourDlg::GetPolyPolygon( sal_Bool bRescaleToGraphic )
+{
+ PolyPolygon aRetPolyPoly( aContourWnd.GetPolyPolygon() );
+
+ if ( bRescaleToGraphic )
+ {
+ const MapMode aMap100( MAP_100TH_MM );
+ const MapMode aGrfMap( aGraphic.GetPrefMapMode() );
+ OutputDevice* pOutDev = Application::GetDefaultDevice();
+ sal_Bool bPixelMap = aGrfMap.GetMapUnit() == MAP_PIXEL;
+
+ for ( sal_uInt16 j = 0, nPolyCount = aRetPolyPoly.Count(); j < nPolyCount; j++ )
+ {
+ Polygon& rPoly = aRetPolyPoly[ j ];
+
+ for ( sal_uInt16 i = 0, nCount = rPoly.GetSize(); i < nCount; i++ )
+ {
+ Point& rPt = rPoly[ i ];
+
+ rPt = pOutDev->LogicToPixel( rPt, aMap100 );
+
+ if ( !bPixelMap )
+ rPt = pOutDev->PixelToLogic( rPt, aGrfMap );
+ }
+ }
+ }
+
+ return aRetPolyPoly;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxSuperContourDlg::UpdateGraphic( const Graphic& rGraphic, sal_Bool _bGraphicLinked,
+ const PolyPolygon* pPolyPoly, void* pEditingObj )
+{
+ aUpdateGraphic = rGraphic;
+ bUpdateGraphicLinked = _bGraphicLinked;
+ pUpdateEditingObject = pEditingObj;
+
+ if ( pPolyPoly )
+ aUpdatePolyPoly = *pPolyPoly;
+ else
+ aUpdatePolyPoly = PolyPolygon();
+
+ aUpdateTimer.Start();
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+sal_Bool SvxSuperContourDlg::IsUndoPossible() const
+{
+ return aUndoGraphic.GetType() != GRAPHIC_NONE;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+sal_Bool SvxSuperContourDlg::IsRedoPossible() const
+{
+ return aRedoGraphic.GetType() != GRAPHIC_NONE;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxSuperContourDlg::DoAutoCreate()
+{
+ aCreateTimer.Start();
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxSuperContourDlg::ReducePoints( const long nTol )
+{
+ PolyPolygon aPolyPoly( GetPolyPolygon( sal_False ) );
+
+ if ( aPolyPoly.Count() )
+ {
+ const MapMode aMapMode( MAP_100TH_MM );
+ const long nTol2 = nTol * nTol;
+ Polygon& rPoly = aPolyPoly[ 0 ];
+ OutputDevice* pOutDev = Application::GetDefaultDevice();
+ Point aPtPix;
+ const sal_uInt16 nSize = rPoly.GetSize();
+ sal_uInt16 nCounter = 0;
+
+ if ( nSize )
+ aPtPix = pOutDev->LogicToPixel( rPoly[ 0 ], aMapMode );
+
+ for( sal_uInt16 i = 1; i < nSize; i++ )
+ {
+ const Point& rNewPt = rPoly[ i ];
+ const Point aNewPtPix( pOutDev->LogicToPixel( rNewPt, aMapMode ) );
+
+ const long nDistX = aNewPtPix.X() - aPtPix.X();
+ const long nDistY = aNewPtPix.Y() - aPtPix.Y();
+
+ if( ( nDistX * nDistX + nDistY * nDistY ) >= nTol2 )
+ {
+ rPoly[ ++nCounter ] = rNewPt;
+ aPtPix = aNewPtPix;
+ }
+ }
+
+ rPoly.SetSize( nCounter );
+ aContourWnd.SetPolyPolygon( aPolyPoly );
+ aContourWnd.GetSdrModel()->SetChanged( sal_True );
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Click-Hdl fuer ToolBox
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxSuperContourDlg, Tbx1ClickHdl, ToolBox*, pTbx )
+{
+ sal_uInt16 nNewItemId = pTbx->GetCurItemId();
+
+ switch( pTbx->GetCurItemId() )
+ {
+ case( TBI_APPLY ):
+ {
+ SfxBoolItem aBoolItem( SID_CONTOUR_EXEC, sal_True );
+ GetBindings().GetDispatcher()->Execute(
+ SID_CONTOUR_EXEC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aBoolItem, 0L );
+ }
+ break;
+
+ case( TBI_WORKPLACE ):
+ {
+ if ( aTbx1.IsItemChecked( TBI_WORKPLACE ) )
+ {
+ QueryBox aQBox( this, WB_YES_NO | WB_DEF_NO, String( CONT_RESID( STR_CONTOURDLG_WORKPLACE ) ) );
+
+ if ( !aContourWnd.IsContourChanged() || ( aQBox.Execute() == RET_YES ) )
+ aContourWnd.SetWorkplaceMode( sal_True );
+ else
+ aTbx1.CheckItem( TBI_WORKPLACE, sal_False );
+ }
+ else
+ aContourWnd.SetWorkplaceMode( sal_False );
+ }
+ break;
+
+ case( TBI_SELECT ):
+ {
+ pTbx->CheckItem( nNewItemId, sal_True );
+ aContourWnd.SetEditMode( sal_True );
+ }
+ break;
+
+ case( TBI_RECT ):
+ {
+ pTbx->CheckItem( nNewItemId, sal_True );
+ aContourWnd.SetObjKind( OBJ_RECT );
+ }
+ break;
+
+ case( TBI_CIRCLE ):
+ {
+ pTbx->CheckItem( nNewItemId, sal_True );
+ aContourWnd.SetObjKind( OBJ_CIRC );
+
+ }
+ break;
+
+ case( TBI_POLY ):
+ {
+ pTbx->CheckItem( nNewItemId, sal_True );
+ aContourWnd.SetObjKind( OBJ_POLY );
+ }
+ break;
+
+ case( TBI_FREEPOLY ):
+ {
+ pTbx->CheckItem( nNewItemId, sal_True );
+ aContourWnd.SetObjKind( OBJ_FREEFILL );
+ }
+ break;
+
+ case( TBI_POLYEDIT ):
+ aContourWnd.SetPolyEditMode( pTbx->IsItemChecked( TBI_POLYEDIT ) ? SID_BEZIER_MOVE : 0 );
+ break;
+
+ case( TBI_POLYMOVE ):
+ aContourWnd.SetPolyEditMode( SID_BEZIER_MOVE );
+ break;
+
+ case( TBI_POLYINSERT ):
+ aContourWnd.SetPolyEditMode( SID_BEZIER_INSERT );
+ break;
+
+ case( TBI_POLYDELETE ):
+ aContourWnd.GetSdrView()->DeleteMarkedPoints();
+ break;
+
+ case( TBI_UNDO ):
+ {
+ nGrfChanged = nGrfChanged ? nGrfChanged-- : 0UL;
+ aRedoGraphic = aGraphic;
+ aGraphic = aUndoGraphic;
+ aUndoGraphic = Graphic();
+ aContourWnd.SetGraphic( aGraphic, sal_False );
+ }
+ break;
+
+ case( TBI_REDO ):
+ {
+ nGrfChanged++;
+ aUndoGraphic = aGraphic;
+ aGraphic = aRedoGraphic;
+ aRedoGraphic = Graphic();
+ aContourWnd.SetGraphic( aGraphic, sal_False );
+ }
+ break;
+
+ case( TBI_AUTOCONTOUR ):
+ aCreateTimer.Start();
+ break;
+
+ case( TBI_PIPETTE ):
+ {
+ sal_Bool bPipette = aTbx1.IsItemChecked( TBI_PIPETTE );
+
+ if ( !bPipette )
+ aStbStatus.Invalidate();
+ else if ( bGraphicLinked )
+ {
+ QueryBox aQBox( this, WB_YES_NO | WB_DEF_YES, String( CONT_RESID( STR_CONTOURDLG_LINKED ) ) );
+
+ if ( aQBox.Execute() != RET_YES )
+ {
+ aTbx1.CheckItem( TBI_PIPETTE, bPipette = sal_False );
+ aStbStatus.Invalidate();
+ }
+ }
+
+ aContourWnd.SetPipetteMode( bPipette );
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return 0L;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxSuperContourDlg, MousePosHdl, ContourWindow*, pWnd )
+{
+ String aStr;
+ const FieldUnit eFieldUnit = GetBindings().GetDispatcher()->GetModule()->GetFieldUnit();
+ const Point& rMousePos = pWnd->GetMousePos();
+ LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
+ const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep().GetChar(0);
+
+ aStr.Assign( GetUnitString( rMousePos.X(), eFieldUnit, cSep ) );
+ aStr.Append( String::CreateFromAscii( " / " ) );
+ aStr.Append( GetUnitString( rMousePos.Y(), eFieldUnit, cSep ) );
+
+ aStbStatus.SetItemText( 2, aStr );
+
+ return 0L;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxSuperContourDlg, GraphSizeHdl, ContourWindow*, pWnd )
+{
+ String aStr;
+ const FieldUnit eFieldUnit = GetBindings().GetDispatcher()->GetModule()->GetFieldUnit();
+ const Size& rSize = pWnd->GetGraphicSize();
+ LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
+ const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep().GetChar(0);
+
+ aStr.Assign( GetUnitString( rSize.Width(), eFieldUnit, cSep ) );
+ aStr.Append( String::CreateFromAscii( " x " ) );
+ aStr.Append( GetUnitString( rSize.Height(), eFieldUnit, cSep ) );
+
+ aStbStatus.SetItemText( 3, aStr );
+
+ return 0L;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxSuperContourDlg, UpdateHdl, Timer*, EMPTYARG )
+{
+ aUpdateTimer.Stop();
+
+ if ( pUpdateEditingObject != pCheckObj )
+ {
+ if( !GetEditingObject() )
+ aContourWnd.GrabFocus();
+
+ SetGraphic( aUpdateGraphic );
+ SetPolyPolygon( aUpdatePolyPoly );
+ SetEditingObject( pUpdateEditingObject );
+ bGraphicLinked = bUpdateGraphicLinked;
+
+ aUpdateGraphic = Graphic();
+ aUpdatePolyPoly = PolyPolygon();
+ bUpdateGraphicLinked = sal_False;
+
+ aContourWnd.GetSdrModel()->SetChanged( sal_False );
+ }
+
+ GetBindings().Invalidate( SID_CONTOUR_EXEC );
+
+ return 0L;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxSuperContourDlg, CreateHdl, Timer*, EMPTYARG )
+{
+ aCreateTimer.Stop();
+
+ const Rectangle aWorkRect = aContourWnd.LogicToPixel( aContourWnd.GetWorkRect(), MapMode( MAP_100TH_MM ) );
+ const Graphic& rGraphic = aContourWnd.GetGraphic();
+ const sal_Bool bValid = aWorkRect.Left() != aWorkRect.Right() && aWorkRect.Top() != aWorkRect.Bottom();
+
+ EnterWait();
+ SetPolyPolygon( CreateAutoContour( rGraphic, bValid ? &aWorkRect : NULL ) );
+ LeaveWait();
+
+ return 0L;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxSuperContourDlg, StateHdl, ContourWindow*, pWnd )
+{
+ const SdrObject* pObj = pWnd->GetSelectedSdrObject();
+ const SdrView* pView = pWnd->GetSdrView();
+ const sal_Bool bPolyEdit = ( pObj != NULL ) && pObj->ISA( SdrPathObj );
+ const sal_Bool bDrawEnabled = !( bPolyEdit && aTbx1.IsItemChecked( TBI_POLYEDIT ) );
+ const sal_Bool bPipette = aTbx1.IsItemChecked( TBI_PIPETTE );
+ const sal_Bool bWorkplace = aTbx1.IsItemChecked( TBI_WORKPLACE );
+ const sal_Bool bDontHide = !( bPipette || bWorkplace );
+ const sal_Bool bBitmap = pWnd->GetGraphic().GetType() == GRAPHIC_BITMAP;
+
+ aTbx1.EnableItem( TBI_APPLY, bDontHide && bExecState && pWnd->IsChanged() );
+
+ aTbx1.EnableItem( TBI_WORKPLACE, !bPipette && bDrawEnabled );
+
+ aTbx1.EnableItem( TBI_SELECT, bDontHide && bDrawEnabled );
+ aTbx1.EnableItem( TBI_RECT, bDontHide && bDrawEnabled );
+ aTbx1.EnableItem( TBI_CIRCLE, bDontHide && bDrawEnabled );
+ aTbx1.EnableItem( TBI_POLY, bDontHide && bDrawEnabled );
+ aTbx1.EnableItem( TBI_FREEPOLY, bDontHide && bDrawEnabled );
+
+ aTbx1.EnableItem( TBI_POLYEDIT, bDontHide && bPolyEdit );
+ aTbx1.EnableItem( TBI_POLYMOVE, bDontHide && !bDrawEnabled );
+ aTbx1.EnableItem( TBI_POLYINSERT, bDontHide && !bDrawEnabled );
+ aTbx1.EnableItem( TBI_POLYDELETE, bDontHide && !bDrawEnabled && pView->IsDeleteMarkedPointsPossible() );
+
+ aTbx1.EnableItem( TBI_AUTOCONTOUR, bDontHide && bDrawEnabled );
+ aTbx1.EnableItem( TBI_PIPETTE, !bWorkplace && bDrawEnabled && bBitmap );
+
+ aTbx1.EnableItem( TBI_UNDO, bDontHide && IsUndoPossible() );
+ aTbx1.EnableItem( TBI_REDO, bDontHide && IsRedoPossible() );
+
+ if ( bPolyEdit )
+ {
+ sal_uInt16 nId = 0;
+
+ switch( pWnd->GetPolyEditMode() )
+ {
+ case( SID_BEZIER_MOVE ): nId = TBI_POLYMOVE; break;
+ case( SID_BEZIER_INSERT ): nId = TBI_POLYINSERT; break;
+
+ default:
+ break;
+ }
+
+ aTbx1.CheckItem( nId, sal_True );
+ }
+ else
+ {
+ aTbx1.CheckItem( TBI_POLYEDIT, sal_False );
+ aTbx1.CheckItem( TBI_POLYMOVE, sal_True );
+ aTbx1.CheckItem( TBI_POLYINSERT, sal_False );
+ pWnd->SetPolyEditMode( 0 );
+ }
+
+ return 0L;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxSuperContourDlg, PipetteHdl, ContourWindow*, pWnd )
+{
+ const Color& rOldLineColor = aStbStatus.GetLineColor();
+ const Color& rOldFillColor = aStbStatus.GetFillColor();
+
+ Rectangle aRect( aStbStatus.GetItemRect( 4 ) );
+ const Color& rColor = pWnd->GetPipetteColor();
+
+ aStbStatus.SetLineColor( rColor );
+ aStbStatus.SetFillColor( rColor );
+
+ aRect.Left() += 4;
+ aRect.Top() += 4;
+ aRect.Right() -= 4;
+ aRect.Bottom() -= 4;
+
+ aStbStatus.DrawRect( aRect );
+
+ aStbStatus.SetLineColor( rOldLineColor );
+ aStbStatus.SetFillColor( rOldFillColor );
+
+ return 0L;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxSuperContourDlg, PipetteClickHdl, ContourWindow*, pWnd )
+{
+ if ( pWnd->IsClickValid() )
+ {
+ Bitmap aMask;
+ const Color& rColor = pWnd->GetPipetteColor();
+
+ EnterWait();
+
+ if( aGraphic.GetType() == GRAPHIC_BITMAP )
+ {
+ Bitmap aBmp( aGraphic.GetBitmap() );
+ const long nTol = static_cast<long>(aMtfTolerance.GetValue() * 255L / 100L);
+
+ aMask = aBmp.CreateMask( rColor, nTol );
+
+ if( aGraphic.IsTransparent() )
+ aMask.CombineSimple( aGraphic.GetBitmapEx().GetMask(), BMP_COMBINE_OR );
+
+ if( !!aMask )
+ {
+ QueryBox aQBox( this, WB_YES_NO | WB_DEF_YES, String( CONT_RESID( STR_CONTOURDLG_NEWPIPETTE ) ) );
+ sal_Bool bNewContour;
+
+ aRedoGraphic = Graphic();
+ aUndoGraphic = aGraphic;
+ aGraphic = Graphic( BitmapEx( aBmp, aMask ) );
+ nGrfChanged++;
+
+ bNewContour = ( aQBox.Execute() == RET_YES );
+ pWnd->SetGraphic( aGraphic, bNewContour );
+
+ if( bNewContour )
+ aCreateTimer.Start();
+ }
+ }
+
+ LeaveWait();
+ }
+
+ aTbx1.CheckItem( TBI_PIPETTE, sal_False );
+ pWnd->SetPipetteMode( sal_False );
+ aStbStatus.Invalidate();
+
+ return 0L;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxSuperContourDlg, WorkplaceClickHdl, ContourWindow*, pWnd )
+{
+ aTbx1.CheckItem( TBI_WORKPLACE, sal_False );
+ aTbx1.CheckItem( TBI_SELECT, sal_True );
+ pWnd->SetWorkplaceMode( sal_False );
+
+ return 0L;
+}
+
+void SvxSuperContourDlg::ApplyImageList()
+{
+ bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ ImageList& rImgLst = bHighContrast ? maImageListH : maImageList;
+
+ aTbx1.SetImageList( rImgLst );
+}
+
+void SvxSuperContourDlg::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SfxFloatingWindow::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ ApplyImageList();
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxSuperContourDlg, MiscHdl, void*, EMPTYARG )
+{
+ SvtMiscOptions aMiscOptions;
+ aTbx1.SetOutStyle( aMiscOptions.GetToolboxStyle() );
+
+ return 0L;
+}
+
diff --git a/svx/source/dialog/bmpmask.hrc b/svx/source/dialog/bmpmask.hrc
new file mode 100644
index 000000000000..99c9eab04b7b
--- /dev/null
+++ b/svx/source/dialog/bmpmask.hrc
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define RID_SVXDLG_BMPMASK (RID_SVX_BMPMASK_START)
+#define RID_SVXDLG_BMPMASK_STR_TRANSP (RID_SVX_BMPMASK_START + 1)
+#define RID_SVXDLG_BMPMASK_STR_SOURCECOLOR (RID_SVX_BMPMASK_START + 2)
+
+#define GRP_Q 1
+#define CTR_PIPETTE 1
+#define CBX_1 1
+#define CBX_2 4
+#define CBX_3 3
+#define CBX_4 2
+#define CBX_TRANS 5
+#define QCOL_1 2
+#define QCOL_2 5
+#define QCOL_3 4
+#define QCOL_4 3
+#define SP_1 2
+#define SP_2 4
+#define SP_3 1
+#define SP_4 3
+#define GRP_D 2
+#define TBX_PIPETTE 1
+#define TBI_PIPETTE 1
+#define WND_PIPETTE 10
+#define BTN_EXEC 1
+#define LB_1 1
+#define LB_2 2
+#define LB_3 3
+#define LB_4 4
+#define LB_TRANS 5
+#define FT_1 1
+#define FT_2 2
+#define FT_3 3
+#define IMG_PIPETTE 11
+#define IMG_PIPETTE_H 12
+
+
diff --git a/svx/source/dialog/bmpmask.src b/svx/source/dialog/bmpmask.src
new file mode 100644
index 000000000000..7823007dbe7c
--- /dev/null
+++ b/svx/source/dialog/bmpmask.src
@@ -0,0 +1,373 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ---------------------------------------------------------------
+#include <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+#include "bmpmask.hrc"
+#include "helpid.hrc"
+
+
+#define MASKCOLOR MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
+
+
+ // RID_SVXDLG_BMPMASK ----------------------------------------------------
+DockingWindow RID_SVXDLG_BMPMASK
+{
+ HelpId = CMD_SID_BMPMASK ;
+ OutputSize = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 163 , 126 ) ;
+ Sizeable = FALSE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+ Dockable = TRUE ;
+ EnableResizing = TRUE ;
+ FixedLine GRP_Q
+ {
+ Pos = MAP_APPFONT ( 6 , 26 ) ;
+ Size = MAP_APPFONT ( 151 , 8 ) ;
+ Text [ en-US ] = "Colors" ;
+ };
+ FixedText FT_1
+ {
+ Pos = MAP_APPFONT ( 12 , 37 ) ;
+ Size = MAP_APPFONT ( 44 , 8 ) ;
+ Text [ en-US ] = "Source color" ;
+ };
+ FixedText FT_2
+ {
+ Pos = MAP_APPFONT ( 58 , 37 ) ;
+ Size = MAP_APPFONT ( 34 , 8 ) ;
+ Text [ en-US ] = "Tolerance" ;
+ };
+ FixedText FT_3
+ {
+ Pos = MAP_APPFONT ( 93 , 37 ) ;
+ Size = MAP_APPFONT ( 64 , 8 ) ;
+ Text [ en-US ] = "Replace with..." ;
+ };
+
+ // line 1
+
+ CheckBox CBX_1
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_BMPMASK:CBX_1";
+ Pos = MAP_APPFONT ( 12 , 50 ) ;
+ Size = MAP_APPFONT ( 10 , 10 ) ;
+ TabStop = TRUE ;
+ };
+ Control QCOL_1
+ {
+ HelpId = HID_BMPMASK_CTL_QCOL_1 ;
+ Pos = MAP_APPFONT ( 24 , 48 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ MetricField SP_1
+ {
+ HelpID = "svx:MetricField:RID_SVXDLG_BMPMASK:SP_1";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 58 , 48 ) ;
+ Size = MAP_APPFONT ( 29 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 99 ;
+ Last = 99 ;
+ SpinSize = 1 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = " %" ;
+ };
+ ListBox LB_1
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_BMPMASK:LB_1";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 93 , 48 ) ;
+ Size = MAP_APPFONT ( 64 , 75 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+
+ // line 2
+
+ CheckBox CBX_2
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_BMPMASK:CBX_2";
+ Pos = MAP_APPFONT ( 12 , 65 ) ;
+ Size = MAP_APPFONT ( 10 , 10 ) ;
+ TabStop = TRUE ;
+ };
+ Control QCOL_2
+ {
+ HelpId = HID_BMPMASK_CTL_QCOL_1 ;
+ Pos = MAP_APPFONT ( 24 , 63 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ MetricField SP_2
+ {
+ HelpID = "svx:MetricField:RID_SVXDLG_BMPMASK:SP_2";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 58 , 63 ) ;
+ Size = MAP_APPFONT ( 29 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 99 ;
+ Last = 99 ;
+ SpinSize = 1 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = " %" ;
+ };
+ ListBox LB_2
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_BMPMASK:LB_2";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 93 , 63 ) ;
+ Size = MAP_APPFONT ( 64 , 75 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+
+ // line 3
+
+ CheckBox CBX_3
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_BMPMASK:CBX_3";
+ Pos = MAP_APPFONT ( 12 , 80 ) ;
+ Size = MAP_APPFONT ( 10 , 10 ) ;
+ TabStop = TRUE ;
+ };
+ Control QCOL_3
+ {
+ HelpId = HID_BMPMASK_CTL_QCOL_1 ;
+ Pos = MAP_APPFONT ( 24 , 78 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ MetricField SP_3
+ {
+ HelpID = "svx:MetricField:RID_SVXDLG_BMPMASK:SP_3";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 58, 78 ) ;
+ Size = MAP_APPFONT ( 29 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 99 ;
+ Last = 99 ;
+ SpinSize = 1 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = " %" ;
+ };
+ ListBox LB_3
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_BMPMASK:LB_3";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 93 , 78 ) ;
+ Size = MAP_APPFONT ( 64 , 75 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+
+ // Line 4
+
+ CheckBox CBX_4
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_BMPMASK:CBX_4";
+ Pos = MAP_APPFONT ( 12 , 95 ) ;
+ Size = MAP_APPFONT ( 10 , 10 ) ;
+ TabStop = TRUE ;
+ };
+ Control QCOL_4
+ {
+ HelpId = HID_BMPMASK_CTL_QCOL_1 ;
+ Pos = MAP_APPFONT ( 24 , 93 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ MetricField SP_4
+ {
+ HelpID = "svx:MetricField:RID_SVXDLG_BMPMASK:SP_4";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 58 , 93 ) ;
+ Size = MAP_APPFONT ( 29 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 99 ;
+ Last = 99 ;
+ SpinSize = 1 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = " %" ;
+ };
+ ListBox LB_4
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_BMPMASK:LB_4";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 93 , 93 ) ;
+ Size = MAP_APPFONT ( 64 , 75 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+
+ CheckBox CBX_TRANS
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_BMPMASK:CBX_TRANS";
+ Pos = MAP_APPFONT ( 12 , 110 ) ;
+ Size = MAP_APPFONT ( 71 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Tr~ansparency" ;
+ };
+
+ PushButton BTN_EXEC
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_BMPMASK:BTN_EXEC";
+ Pos = MAP_APPFONT ( 93 , 6 ) ;
+ Size = MAP_APPFONT ( 64 , 14 ) ;
+ Text [ en-US ] = "~Replace" ;
+ };
+
+ ListBox LB_TRANS
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_BMPMASK:LB_TRANS";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 93 , 108 ) ;
+ Size = MAP_APPFONT ( 64 , 75 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+ ToolBox TBX_PIPETTE
+ {
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 7 ) ;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ Identifier = TBI_PIPETTE ;
+ HelpId = HID_BMPMASK_TBI_PIPETTE ;
+ ItemImage = Image
+ {
+ ImageBitmap = Bitmap { File = "sc10350.bmp" ; };
+ MASKCOLOR
+ };
+ Text [ en-US ] = "Pipette" ;
+ };
+ };
+ };
+ Control WND_PIPETTE
+ {
+ HelpId = HID_BMPMASK_CTL_PIPETTE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 22 , 6 ) ;
+ Size = MAP_APPFONT ( 43 , 14 ) ;
+ };
+ Text [ en-US ] = "Color Replacer" ;
+
+ Image IMG_PIPETTE
+ {
+ ImageBitmap = Bitmap { File = "sc10350.bmp" ; };
+ MASKCOLOR
+ };
+
+ Image IMG_PIPETTE_H
+ {
+ ImageBitmap = Bitmap { File = "sc10350_h.bmp" ; };
+ MASKCOLOR
+ };
+};
+
+String RID_SVXDLG_BMPMASK_STR_TRANSP
+{
+ Text [ en-US ] = "Transparent";
+};
+
+String RID_SVXDLG_BMPMASK_STR_SOURCECOLOR
+{
+ // This string is used by the eyedropper dialog to denote a color in an image
+ // that will be replaced by another color.
+ Text [ en-US ] = "Source Color";
+};
+
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
new file mode 100644
index 000000000000..b86121412ab7
--- /dev/null
+++ b/svx/source/dialog/charmap.cxx
@@ -0,0 +1,893 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <stdio.h>
+
+#define _SVX_CHARMAP_CXX_
+#include <vcl/svapp.hxx>
+#include <svtools/colorcfg.hxx>
+
+#include <rtl/textenc.h>
+#include <svx/ucsubset.hxx>
+
+#include <svx/dialogs.hrc>
+
+#include <svx/charmap.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/svxdlg.hxx>
+
+#include "charmapacc.hxx"
+#include <com/sun/star/accessibility/AccessibleEventObject.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <comphelper/types.hxx>
+#include <svl/itemset.hxx>
+
+#include "rtl/ustrbuf.hxx"
+
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+
+// -----------------------------------------------------------------------
+sal_uInt32& SvxShowCharSet::getSelectedChar()
+{
+ static sal_uInt32 cSelectedChar = ' '; // keeps selected character over app livetime
+ return cSelectedChar;
+}
+
+// class SvxShowCharSet ==================================================
+
+#define SBWIDTH 16
+
+SvxShowCharSet::SvxShowCharSet( Window* pParent, const ResId& rResId ) :
+ Control( pParent, rResId )
+ ,m_pAccessible(NULL)
+ ,aVscrollSB( this, WB_VERT)
+{
+ nSelectedIndex = -1; // TODO: move into init list when it is no longer static
+
+ aOrigSize = GetOutputSizePixel();
+ aOrigPos = GetPosPixel();
+
+ SetStyle( GetStyle() | WB_CLIPCHILDREN );
+ aVscrollSB.SetScrollHdl( LINK( this, SvxShowCharSet, VscrollHdl ) );
+ aVscrollSB.EnableDrag( sal_True );
+ // other settings like aVscroll depend on selected font => see SetFont
+
+ bDrag = sal_False;
+ InitSettings( sal_True, sal_True );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::GetFocus()
+{
+ Control::GetFocus();
+ SelectIndex( nSelectedIndex, sal_True );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::LoseFocus()
+{
+ Control::LoseFocus();
+ SelectIndex( nSelectedIndex, sal_False );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::StateChanged( StateChangedType nType )
+{
+ if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ InitSettings( sal_True, sal_False );
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ InitSettings( sal_False, sal_True );
+
+ Control::StateChanged( nType );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS )
+ && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
+ InitSettings( sal_True, sal_True );
+ else
+ Control::DataChanged( rDCEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( rMEvt.IsLeft() )
+ {
+ if ( rMEvt.GetClicks() == 1 )
+ {
+ GrabFocus();
+ bDrag = sal_True;
+ CaptureMouse();
+
+ int nIndex = PixelToMapIndex( rMEvt.GetPosPixel() );
+ SelectIndex( nIndex );
+ }
+
+ if ( !(rMEvt.GetClicks() % 2) )
+ aDoubleClkHdl.Call( this );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ if ( bDrag && rMEvt.IsLeft() )
+ {
+ // released mouse over character map
+ if ( Rectangle(Point(), GetOutputSize()).IsInside(rMEvt.GetPosPixel()))
+ aSelectHdl.Call( this );
+ ReleaseMouse();
+ bDrag = sal_False;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::MouseMove( const MouseEvent& rMEvt )
+{
+ if ( rMEvt.IsLeft() && bDrag )
+ {
+ Point aPos = rMEvt.GetPosPixel();
+ Size aSize = GetSizePixel();
+
+ if ( aPos.X() < 0 )
+ aPos.X() = 0;
+ else if ( aPos.X() > aSize.Width()-5 )
+ aPos.X() = aSize.Width()-5;
+ if ( aPos.Y() < 0 )
+ aPos.Y() = 0;
+ else if ( aPos.Y() > aSize.Height()-5 )
+ aPos.Y() = aSize.Height()-5;
+
+ int nIndex = PixelToMapIndex( aPos );
+ SelectIndex( nIndex );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::Command( const CommandEvent& rCEvt )
+{
+ if( !HandleScrollCommand( rCEvt, 0, &aVscrollSB ) )
+ Control::Command( rCEvt );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_uInt16 SvxShowCharSet::GetRowPos(sal_uInt16 _nPos) const
+{
+ return _nPos / COLUMN_COUNT ;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_uInt16 SvxShowCharSet::GetColumnPos(sal_uInt16 _nPos) const
+{
+ return _nPos % COLUMN_COUNT ;
+}
+
+// -----------------------------------------------------------------------
+
+int SvxShowCharSet::FirstInView( void ) const
+{
+ int nIndex = 0;
+ if( aVscrollSB.IsVisible() )
+ nIndex += aVscrollSB.GetThumbPos() * COLUMN_COUNT;
+ return nIndex;
+}
+
+// -----------------------------------------------------------------------
+
+int SvxShowCharSet::LastInView( void ) const
+{
+ sal_uIntPtr nIndex = FirstInView();
+ nIndex += ROW_COUNT * COLUMN_COUNT - 1;
+ sal_uIntPtr nCompare = sal::static_int_cast<sal_uIntPtr>( maFontCharMap.GetCharCount() - 1 );
+ if( nIndex > nCompare )
+ nIndex = nCompare;
+ return nIndex;
+}
+
+// -----------------------------------------------------------------------
+
+inline Point SvxShowCharSet::MapIndexToPixel( int nIndex ) const
+{
+ const int nBase = FirstInView();
+ int x = ((nIndex - nBase) % COLUMN_COUNT) * nX;
+ int y = ((nIndex - nBase) / COLUMN_COUNT) * nY;
+ return Point( x, y );
+}
+// -----------------------------------------------------------------------------
+
+int SvxShowCharSet::PixelToMapIndex( const Point& point) const
+{
+ int nBase = FirstInView();
+ return (nBase + (point.X()/nX) + (point.Y()/nY) * COLUMN_COUNT);
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::KeyInput( const KeyEvent& rKEvt )
+{
+ KeyCode aCode = rKEvt.GetKeyCode();
+
+ if( aCode.GetModifier() )
+ {
+ Control::KeyInput( rKEvt );
+ return;
+ }
+
+ int tmpSelected = nSelectedIndex;
+
+ switch ( aCode.GetCode() )
+ {
+ case KEY_SPACE:
+ aSelectHdl.Call( this );
+ break;
+ case KEY_LEFT:
+ --tmpSelected;
+ break;
+ case KEY_RIGHT:
+ ++tmpSelected;
+ break;
+ case KEY_UP:
+ tmpSelected -= COLUMN_COUNT;
+ break;
+ case KEY_DOWN:
+ tmpSelected += COLUMN_COUNT;
+ break;
+ case KEY_PAGEUP:
+ tmpSelected -= ROW_COUNT * COLUMN_COUNT;
+ break;
+ case KEY_PAGEDOWN:
+ tmpSelected += ROW_COUNT * COLUMN_COUNT;
+ break;
+ case KEY_HOME:
+ tmpSelected = 0;
+ break;
+ case KEY_END:
+ tmpSelected = maFontCharMap.GetCharCount() - 1;
+ break;
+ case KEY_TAB: // some fonts have a character at these unicode control codes
+ case KEY_ESCAPE:
+ case KEY_RETURN:
+ Control::KeyInput( rKEvt );
+ tmpSelected = - 1; // mark as invalid
+ break;
+ default:
+ {
+ sal_UCS4 cChar = rKEvt.GetCharCode();
+ sal_UCS4 cNext = maFontCharMap.GetNextChar( cChar - 1 );
+ tmpSelected = maFontCharMap.GetIndexFromChar( cNext );
+ if( tmpSelected < 0 || (cChar != cNext) )
+ {
+ Control::KeyInput( rKEvt );
+ tmpSelected = - 1; // mark as invalid
+ }
+ }
+ }
+
+ if ( tmpSelected >= 0 )
+ {
+ SelectIndex( tmpSelected, sal_True );
+ aPreSelectHdl.Call( this );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::Paint( const Rectangle& )
+{
+ DrawChars_Impl( FirstInView(), LastInView() );
+}
+// -----------------------------------------------------------------------------
+void SvxShowCharSet::DeSelect()
+{
+ DrawChars_Impl(nSelectedIndex,nSelectedIndex);
+}
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::DrawChars_Impl( int n1, int n2 )
+{
+ if( n1 > LastInView() || n2 < FirstInView() )
+ return;
+
+ Size aOutputSize = GetOutputSizePixel();
+ if( aVscrollSB.IsVisible() )
+ aOutputSize.setWidth( aOutputSize.Width() - SBWIDTH );
+
+ int i;
+ for ( i = 1; i < COLUMN_COUNT; ++i )
+ DrawLine( Point( nX * i, 0 ), Point( nX * i, aOutputSize.Height() ) );
+ for ( i = 1; i < ROW_COUNT; ++i )
+ DrawLine( Point( 0, nY * i ), Point( aOutputSize.Width(), nY * i ) );
+
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+ const Color aWindowTextColor( rStyleSettings.GetFieldTextColor() );
+ Color aHighlightColor( rStyleSettings.GetHighlightColor() );
+ Color aHighlightTextColor( rStyleSettings.GetHighlightTextColor() );
+ Color aFaceColor( rStyleSettings.GetFaceColor() );
+ Color aLightColor( rStyleSettings.GetLightColor() );
+ Color aShadowColor( rStyleSettings.GetShadowColor() );
+
+ int nTextHeight = GetTextHeight();
+ Rectangle aBoundRect;
+ for( i = n1; i <= n2; ++i )
+ {
+ Point pix = MapIndexToPixel( i );
+ int x = pix.X();
+ int y = pix.Y();
+
+ rtl::OUStringBuffer buf;
+ buf.appendUtf32( maFontCharMap.GetCharFromIndex( i ) );
+ String aCharStr(buf.makeStringAndClear());
+ int nTextWidth = GetTextWidth(aCharStr);
+ int tx = x + (nX - nTextWidth + 1) / 2;
+ int ty = y + (nY - nTextHeight + 1) / 2;
+ Point aPointTxTy( tx, ty );
+
+ // adjust position before it gets out of bounds
+ if( GetTextBoundRect( aBoundRect, aCharStr ) && !aBoundRect.IsEmpty() )
+ {
+ // zero advance width => use ink width to center glyph
+ if( !nTextWidth )
+ {
+ aPointTxTy.X() = x - aBoundRect.Left()
+ + (nX - aBoundRect.GetWidth() + 1) / 2;
+ }
+
+ aBoundRect += aPointTxTy;
+
+ // shift back vertically if needed
+ int nYLDelta = aBoundRect.Top() - y;
+ int nYHDelta = (y + nY) - aBoundRect.Bottom();
+ if( nYLDelta <= 0 )
+ aPointTxTy.Y() -= nYLDelta - 1;
+ else if( nYHDelta <= 0 )
+ aPointTxTy.Y() += nYHDelta - 1;
+
+ // shift back horizontally if needed
+ int nXLDelta = aBoundRect.Left() - x;
+ int nXHDelta = (x + nX) - aBoundRect.Right();
+ if( nXLDelta <= 0 )
+ aPointTxTy.X() -= nXLDelta - 1;
+ else if( nXHDelta <= 0 )
+ aPointTxTy.X() += nXHDelta - 1;
+ }
+
+ Color aTextCol = GetTextColor();
+ if ( i != nSelectedIndex )
+ {
+ SetTextColor( aWindowTextColor );
+ DrawText( aPointTxTy, aCharStr );
+ }
+ else
+ {
+ Color aLineCol = GetLineColor();
+ Color aFillCol = GetFillColor();
+ SetLineColor();
+ Point aPointUL( x + 1, y + 1 );
+ if( HasFocus() )
+ {
+ SetFillColor( aHighlightColor );
+ DrawRect( Rectangle( aPointUL, Size(nX-1,nY-1) ) );
+
+ SetTextColor( aHighlightTextColor );
+ DrawText( aPointTxTy, aCharStr );
+ }
+ else
+ {
+ SetFillColor( aFaceColor );
+ DrawRect( Rectangle( aPointUL, Size( nX-1, nY-1) ) );
+
+ SetLineColor( aLightColor );
+ DrawLine( aPointUL, Point( x+nX-1, y+1) );
+ DrawLine( aPointUL, Point( x+1, y+nY-1) );
+
+ SetLineColor( aShadowColor );
+ DrawLine( Point( x+1, y+nY-1), Point( x+nX-1, y+nY-1) );
+ DrawLine( Point( x+nX-1, y+nY-1), Point( x+nX-1, y+1) );
+
+ DrawText( aPointTxTy, aCharStr );
+ }
+ SetLineColor( aLineCol );
+ SetFillColor( aFillCol );
+ }
+ SetTextColor( aTextCol );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::InitSettings( sal_Bool bForeground, sal_Bool bBackground )
+{
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+
+ if ( bForeground )
+ {
+ Color aTextColor( rStyleSettings.GetDialogTextColor() );
+
+ if ( IsControlForeground() )
+ aTextColor = GetControlForeground();
+ SetTextColor( aTextColor );
+ }
+
+ if ( bBackground )
+ {
+ if ( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( rStyleSettings.GetWindowColor() );
+ }
+
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+sal_UCS4 SvxShowCharSet::GetSelectCharacter() const
+{
+ if( nSelectedIndex >= 0 )
+ getSelectedChar() = maFontCharMap.GetCharFromIndex( nSelectedIndex );
+ return getSelectedChar();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::SetFont( const Font& rFont )
+{
+ // save last selected unicode
+ if( nSelectedIndex >= 0 )
+ getSelectedChar() = maFontCharMap.GetCharFromIndex( nSelectedIndex );
+
+ Font aFont = rFont;
+ aFont.SetWeight( WEIGHT_LIGHT );
+ aFont.SetAlign( ALIGN_TOP );
+ int nFontHeight = (aOrigSize.Height() - 5) * 2 / (3 * ROW_COUNT);
+ aFont.SetSize( PixelToLogic( Size( 0, nFontHeight ) ) );
+ aFont.SetTransparent( sal_True );
+ Control::SetFont( aFont );
+ GetFontCharMap( maFontCharMap );
+
+ // hide scrollbar when there is nothing to scroll
+ sal_Bool bNeedVscroll = (maFontCharMap.GetCharCount() > ROW_COUNT*COLUMN_COUNT);
+
+ nX = (aOrigSize.Width() - (bNeedVscroll ? SBWIDTH : 0)) / COLUMN_COUNT;
+ nY = aOrigSize.Height() / ROW_COUNT;
+
+ if( bNeedVscroll)
+ {
+ aVscrollSB.SetPosSizePixel( nX * COLUMN_COUNT, 0, SBWIDTH, nY * ROW_COUNT );
+ aVscrollSB.SetRangeMin( 0 );
+ int nLastRow = (maFontCharMap.GetCharCount() - 1 + COLUMN_COUNT) / COLUMN_COUNT;
+ aVscrollSB.SetRangeMax( nLastRow );
+ aVscrollSB.SetPageSize( ROW_COUNT-1 );
+ aVscrollSB.SetVisibleSize( ROW_COUNT );
+ }
+
+ // restore last selected unicode
+ int nMapIndex = maFontCharMap.GetIndexFromChar( getSelectedChar() );
+ SelectIndex( nMapIndex );
+
+ // rearrange CharSet element in sync with nX- and nY-multiples
+ Size aNewSize( nX * COLUMN_COUNT + (bNeedVscroll ? SBWIDTH : 0), nY * ROW_COUNT );
+ Point aNewPos = aOrigPos + Point( (aOrigSize.Width() - aNewSize.Width()) / 2, 0 );
+ SetPosPixel( aNewPos );
+ SetOutputSizePixel( aNewSize );
+
+ aVscrollSB.Show( bNeedVscroll );
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::SelectIndex( int nNewIndex, sal_Bool bFocus )
+{
+ if( nNewIndex < 0 )
+ {
+ // need to scroll see closest unicode
+ sal_uInt32 cPrev = maFontCharMap.GetPrevChar( getSelectedChar() );
+ int nMapIndex = maFontCharMap.GetIndexFromChar( cPrev );
+ int nNewPos = nMapIndex / COLUMN_COUNT;
+ aVscrollSB.SetThumbPos( nNewPos );
+ nSelectedIndex = bFocus ? nMapIndex+1 : -1;
+ Invalidate();
+ Update();
+ }
+ else if( nNewIndex < FirstInView() )
+ {
+ // need to scroll up to see selected item
+ int nOldPos = aVscrollSB.GetThumbPos();
+ int nDelta = (FirstInView() - nNewIndex + COLUMN_COUNT-1) / COLUMN_COUNT;
+ aVscrollSB.SetThumbPos( nOldPos - nDelta );
+ nSelectedIndex = nNewIndex;
+ Invalidate();
+ if( nDelta )
+ Update();
+ }
+ else if( nNewIndex > LastInView() )
+ {
+ // need to scroll down to see selected item
+ int nOldPos = aVscrollSB.GetThumbPos();
+ int nDelta = (nNewIndex - LastInView() + COLUMN_COUNT) / COLUMN_COUNT;
+ aVscrollSB.SetThumbPos( nOldPos + nDelta );
+ if( nNewIndex < maFontCharMap.GetCharCount() )
+ {
+ nSelectedIndex = nNewIndex;
+ Invalidate();
+ }
+ if( nOldPos != aVscrollSB.GetThumbPos() )
+ {
+ Invalidate();
+ Update();
+ }
+ }
+ else
+ {
+ // remove highlighted view
+ Color aLineCol = GetLineColor();
+ Color aFillCol = GetFillColor();
+ SetLineColor();
+ SetFillColor( GetBackground().GetColor() );
+
+ Point aOldPixel = MapIndexToPixel( nSelectedIndex );
+ aOldPixel.Move( +1, +1);
+ DrawRect( Rectangle( aOldPixel, Size( nX-1, nY-1 ) ) );
+ SetLineColor( aLineCol );
+ SetFillColor( aFillCol );
+
+ int nOldIndex = nSelectedIndex;
+ nSelectedIndex = nNewIndex;
+ DrawChars_Impl( nOldIndex, nOldIndex );
+ DrawChars_Impl( nNewIndex, nNewIndex );
+ }
+
+ if( nSelectedIndex >= 0 )
+ {
+ getSelectedChar() = maFontCharMap.GetCharFromIndex( nSelectedIndex );
+ if( m_pAccessible )
+ {
+ ::svx::SvxShowCharSetItem* pItem = ImplGetItem(nSelectedIndex);
+ m_pAccessible->fireEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), makeAny(pItem->GetAccessible()) ); // this call asures that m_pItem is set
+
+ OSL_ENSURE(pItem->m_pItem,"No accessible created!");
+ Any aOldAny, aNewAny;
+ aNewAny <<= AccessibleStateType::FOCUSED;
+ pItem->m_pItem->fireEvent( AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny );
+
+ aNewAny <<= AccessibleStateType::SELECTED;
+ pItem->m_pItem->fireEvent( AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny );
+ }
+ }
+
+
+ aHighHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::SelectCharacter( sal_UCS4 cNew, sal_Bool bFocus )
+{
+ // get next available char of current font
+ sal_UCS4 cNext = maFontCharMap.GetNextChar( cNew - 1 );
+
+ int nMapIndex = maFontCharMap.GetIndexFromChar( cNext );
+ SelectIndex( nMapIndex, bFocus );
+ if( !bFocus )
+ {
+ // move selected item to top row if not in focus
+ aVscrollSB.SetThumbPos( nMapIndex / COLUMN_COUNT );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxShowCharSet, VscrollHdl, ScrollBar *, EMPTYARG )
+{
+ if( nSelectedIndex < FirstInView() )
+ {
+ SelectIndex( FirstInView() + (nSelectedIndex % COLUMN_COUNT) );
+ }
+ else if( nSelectedIndex > LastInView() )
+ {
+ if( m_pAccessible )
+ {
+ ::com::sun::star::uno::Any aOldAny, aNewAny;
+ int nLast = LastInView();
+ for ( ; nLast != nSelectedIndex; ++nLast)
+ {
+ aOldAny <<= ImplGetItem(nLast)->GetAccessible();
+ m_pAccessible ->fireEvent( AccessibleEventId::CHILD, aOldAny, aNewAny );
+ }
+ }
+ SelectIndex( (LastInView() - COLUMN_COUNT + 1) + (nSelectedIndex % COLUMN_COUNT) );
+ }
+
+ Invalidate();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+SvxShowCharSet::~SvxShowCharSet()
+{
+ if ( m_pAccessible )
+ ReleaseAccessible();
+}
+// -----------------------------------------------------------------------------
+void SvxShowCharSet::ReleaseAccessible()
+{
+ m_aItems.clear();
+ m_pAccessible = NULL;
+ m_xAccessible = NULL;
+}
+// -----------------------------------------------------------------------------
+::com::sun::star::uno::Reference< XAccessible > SvxShowCharSet::CreateAccessible()
+{
+ OSL_ENSURE(!m_pAccessible,"Accessible already created!");
+ m_pAccessible = new ::svx::SvxShowCharSetVirtualAcc(this);
+ m_xAccessible = m_pAccessible;
+ return m_xAccessible;
+}
+// -----------------------------------------------------------------------------
+::svx::SvxShowCharSetItem* SvxShowCharSet::ImplGetItem( int _nPos )
+{
+ ItemsMap::iterator aFind = m_aItems.find(_nPos);
+ if ( aFind == m_aItems.end() )
+ {
+ OSL_ENSURE(m_pAccessible,"Who wants to create a child of my table without a parent?");
+ aFind = m_aItems.insert(ItemsMap::value_type(_nPos,new ::svx::SvxShowCharSetItem(*this,m_pAccessible->getTable(),sal::static_int_cast< sal_uInt16 >(_nPos)))).first;
+ rtl::OUStringBuffer buf;
+ buf.appendUtf32( maFontCharMap.GetCharFromIndex( _nPos ) );
+ aFind->second->maText = buf.makeStringAndClear();
+ Point pix = MapIndexToPixel( _nPos );
+ aFind->second->maRect = Rectangle( Point( pix.X() + 1, pix.Y() + 1 ), Size(nX-1,nY-1) );
+ }
+
+ return aFind->second;
+}
+// -----------------------------------------------------------------------------
+void SvxShowCharSet::ImplFireAccessibleEvent( short nEventId, const ::com::sun::star::uno::Any& rOldValue, const ::com::sun::star::uno::Any& rNewValue )
+{
+ if( m_pAccessible )
+ m_pAccessible->fireEvent( nEventId, rOldValue, rNewValue );
+}
+// -----------------------------------------------------------------------------
+ScrollBar* SvxShowCharSet::getScrollBar()
+{
+ return &aVscrollSB;
+}
+// -----------------------------------------------------------------------
+sal_Int32 SvxShowCharSet::getMaxCharCount() const
+{
+ return maFontCharMap.GetCharCount();
+}
+
+
+// class SubsetMap =======================================================
+// TODO: should be moved into Font Attributes stuff
+// we let it mature here though because it is currently the only use
+
+SubsetMap::SubsetMap( const FontCharMap* pFontCharMap )
+: Resource( SVX_RES(RID_SUBSETMAP) )
+{
+ InitList();
+ ApplyCharMap( pFontCharMap );
+ FreeResource();
+}
+
+const Subset* SubsetMap::GetNextSubset( bool bFirst ) const
+{
+ if( bFirst )
+ maSubsetIterator = maSubsets.begin();
+ if( maSubsetIterator == maSubsets.end() )
+ return NULL;
+ const Subset* s = &*(maSubsetIterator++);
+ return s;
+}
+
+const Subset* SubsetMap::GetSubsetByUnicode( sal_UCS4 cChar ) const
+{
+ // TODO: is it worth to avoid a linear search?
+ for( const Subset* s = GetNextSubset( true ); s; s = GetNextSubset( false ) )
+ if( (s->GetRangeMin() <= cChar) && (cChar <= s->GetRangeMax()) )
+ return s;
+ return NULL;
+}
+
+inline Subset::Subset( sal_UCS4 nMin, sal_UCS4 nMax, int resId)
+: mnRangeMin(nMin), mnRangeMax(nMax), maRangeName( SVX_RES(resId) )
+{}
+
+void SubsetMap::InitList()
+{
+ static SubsetList aAllSubsets;
+ static bool bInit = true;
+ if( bInit )
+ {
+ bInit = false;
+
+ // TODO: eventually merge or split unicode subranges
+ // a "native writer" should decide for his subsets
+ aAllSubsets.push_back( Subset( 0x0020, 0x007F, RID_SUBSETSTR_BASIC_LATIN ) );
+ aAllSubsets.push_back( Subset( 0x0080, 0x00FF, RID_SUBSETSTR_LATIN_1 ) );
+ aAllSubsets.push_back( Subset( 0x0100, 0x017F, RID_SUBSETSTR_LATIN_EXTENDED_A ) );
+ aAllSubsets.push_back( Subset( 0x0180, 0x024F, RID_SUBSETSTR_LATIN_EXTENDED_B ) );
+ aAllSubsets.push_back( Subset( 0x0250, 0x02AF, RID_SUBSETSTR_IPA_EXTENSIONS ) );
+ aAllSubsets.push_back( Subset( 0x02B0, 0x02FF, RID_SUBSETSTR_SPACING_MODIFIERS ) );
+ aAllSubsets.push_back( Subset( 0x0300, 0x036F, RID_SUBSETSTR_COMB_DIACRITICAL ) );
+ aAllSubsets.push_back( Subset( 0x0370, 0x03FF, RID_SUBSETSTR_BASIC_GREEK ) );
+ // aAllSubsets.push_back( Subset( 0x03D0, 0x03F3, RID_SUBSETSTR_GREEK_SYMS_COPTIC ) );
+ aAllSubsets.push_back( Subset( 0x0400, 0x04FF, RID_SUBSETSTR_CYRILLIC ) );
+ aAllSubsets.push_back( Subset( 0x0530, 0x058F, RID_SUBSETSTR_ARMENIAN ) );
+ aAllSubsets.push_back( Subset( 0x0590, 0x05FF, RID_SUBSETSTR_BASIC_HEBREW ) );
+ // aAllSubsets.push_back( Subset( 0x0591, 0x05C4, RID_SUBSETSTR_HEBREW_EXTENDED ) );
+ aAllSubsets.push_back( Subset( 0x0600, 0x065F, RID_SUBSETSTR_BASIC_ARABIC ) );
+ aAllSubsets.push_back( Subset( 0x0660, 0x06FF, RID_SUBSETSTR_ARABIC_EXTENDED ) );
+ aAllSubsets.push_back( Subset( 0x0700, 0x074F, RID_SUBSETSTR_SYRIAC ) );
+ aAllSubsets.push_back( Subset( 0x0780, 0x07BF, RID_SUBSETSTR_THAANA ) );
+ aAllSubsets.push_back( Subset( 0x0900, 0x097F, RID_SUBSETSTR_DEVANAGARI ) );
+ aAllSubsets.push_back( Subset( 0x0980, 0x09FF, RID_SUBSETSTR_BENGALI ) );
+ aAllSubsets.push_back( Subset( 0x0A00, 0x0A7F, RID_SUBSETSTR_GURMUKHI ) );
+ aAllSubsets.push_back( Subset( 0x0A80, 0x0AFF, RID_SUBSETSTR_GUJARATI ) );
+ aAllSubsets.push_back( Subset( 0x0B00, 0x0B7F, RID_SUBSETSTR_ORIYA ) );
+ aAllSubsets.push_back( Subset( 0x0B80, 0x0BFF, RID_SUBSETSTR_TAMIL ) );
+ aAllSubsets.push_back( Subset( 0x0C00, 0x0C7F, RID_SUBSETSTR_TELUGU ) );
+ aAllSubsets.push_back( Subset( 0x0C80, 0x0CFF, RID_SUBSETSTR_KANNADA ) );
+ aAllSubsets.push_back( Subset( 0x0D00, 0x0D7F, RID_SUBSETSTR_MALAYALAM ) );
+ aAllSubsets.push_back( Subset( 0x0D80, 0x0DFF, RID_SUBSETSTR_SINHALA ) );
+ aAllSubsets.push_back( Subset( 0x0E00, 0x0E7F, RID_SUBSETSTR_THAI ) );
+ aAllSubsets.push_back( Subset( 0x0E80, 0x0EFF, RID_SUBSETSTR_LAO ) );
+ aAllSubsets.push_back( Subset( 0x0F00, 0x0FBF, RID_SUBSETSTR_TIBETAN ) );
+ aAllSubsets.push_back( Subset( 0x1000, 0x109F, RID_SUBSETSTR_MYANMAR ) );
+ aAllSubsets.push_back( Subset( 0x10A0, 0x10FF, RID_SUBSETSTR_BASIC_GEORGIAN ) );
+ // aAllSubsets.push_back( Subset( 0x10A0, 0x10C5, RID_SUBSETSTR_GEORGIAN_EXTENDED ) );
+ aAllSubsets.push_back( Subset( 0x1100, 0x11FF, RID_SUBSETSTR_HANGUL_JAMO ) );
+ aAllSubsets.push_back( Subset( 0x1200, 0x137F, RID_SUBSETSTR_ETHIOPIC ) );
+ aAllSubsets.push_back( Subset( 0x13A0, 0x13FF, RID_SUBSETSTR_CHEROKEE ) );
+ aAllSubsets.push_back( Subset( 0x1400, 0x167F, RID_SUBSETSTR_CANADIAN_ABORIGINAL ) );
+ aAllSubsets.push_back( Subset( 0x1680, 0x169F, RID_SUBSETSTR_OGHAM ) );
+ aAllSubsets.push_back( Subset( 0x16A0, 0x16F0, RID_SUBSETSTR_RUNIC ) );
+ aAllSubsets.push_back( Subset( 0x1700, 0x171F, RID_SUBSETSTR_TAGALOG ) );
+ aAllSubsets.push_back( Subset( 0x1720, 0x173F, RID_SUBSETSTR_HANUNOO ) );
+ aAllSubsets.push_back( Subset( 0x1740, 0x175F, RID_SUBSETSTR_BUHID ) );
+ aAllSubsets.push_back( Subset( 0x1760, 0x177F, RID_SUBSETSTR_TAGBANWA ) );
+ aAllSubsets.push_back( Subset( 0x1780, 0x17FF, RID_SUBSETSTR_KHMER ) );
+ aAllSubsets.push_back( Subset( 0x1800, 0x18AF, RID_SUBSETSTR_MONGOLIAN ) );
+ aAllSubsets.push_back( Subset( 0x1E00, 0x1EFF, RID_SUBSETSTR_LATIN_EXTENDED_ADDS ) );
+ aAllSubsets.push_back( Subset( 0x1F00, 0x1FFF, RID_SUBSETSTR_GREEK_EXTENDED ) );
+
+ aAllSubsets.push_back( Subset( 0x2000, 0x206F, RID_SUBSETSTR_GENERAL_PUNCTUATION ) );
+ aAllSubsets.push_back( Subset( 0x2070, 0x209F, RID_SUBSETSTR_SUB_SUPER_SCRIPTS ) );
+ aAllSubsets.push_back( Subset( 0x20A0, 0x20CF, RID_SUBSETSTR_CURRENCY_SYMBOLS ) );
+ aAllSubsets.push_back( Subset( 0x20D0, 0x20FF, RID_SUBSETSTR_COMB_DIACRITIC_SYMS ) );
+ aAllSubsets.push_back( Subset( 0x2100, 0x214F, RID_SUBSETSTR_LETTERLIKE_SYMBOLS ) );
+ aAllSubsets.push_back( Subset( 0x2150, 0x218F, RID_SUBSETSTR_NUMBER_FORMS ) );
+ aAllSubsets.push_back( Subset( 0x2190, 0x21FF, RID_SUBSETSTR_ARROWS ) );
+ aAllSubsets.push_back( Subset( 0x2200, 0x22FF, RID_SUBSETSTR_MATH_OPERATORS ) );
+ aAllSubsets.push_back( Subset( 0x2300, 0x23FF, RID_SUBSETSTR_MISC_TECHNICAL ) );
+ aAllSubsets.push_back( Subset( 0x2400, 0x243F, RID_SUBSETSTR_CONTROL_PICTURES ) );
+ aAllSubsets.push_back( Subset( 0x2440, 0x245F, RID_SUBSETSTR_OPTICAL_CHAR_REC ) );
+ aAllSubsets.push_back( Subset( 0x2460, 0x24FF, RID_SUBSETSTR_ENCLOSED_ALPHANUM ) );
+ aAllSubsets.push_back( Subset( 0x2500, 0x257F, RID_SUBSETSTR_BOX_DRAWING ) );
+ aAllSubsets.push_back( Subset( 0x2580, 0x259F, RID_SUBSETSTR_BLOCK_ELEMENTS ) );
+ aAllSubsets.push_back( Subset( 0x25A0, 0x25FF, RID_SUBSETSTR_GEOMETRIC_SHAPES ) );
+ aAllSubsets.push_back( Subset( 0x2600, 0x26FF, RID_SUBSETSTR_MISC_DINGBATS ) );
+ aAllSubsets.push_back( Subset( 0x2700, 0x27BF, RID_SUBSETSTR_DINGBATS ) );
+
+ aAllSubsets.push_back( Subset( 0x27C0, 0x27FF, RID_SUBSETSTR_MISC_MATH_SYMS_A ) );
+ aAllSubsets.push_back( Subset( 0x27F0, 0x27FF, RID_SUBSETSTR_SUPPL_ARROWS_A ) );
+ aAllSubsets.push_back( Subset( 0x2800, 0x28FF, RID_SUBSETSTR_BRAILLE_PATTERNS ) );
+ aAllSubsets.push_back( Subset( 0x2900, 0x297F, RID_SUBSETSTR_SUPPL_ARROWS_B ) );
+ aAllSubsets.push_back( Subset( 0x2980, 0x29FF, RID_SUBSETSTR_MISC_MATH_SYMS_B ) );
+ aAllSubsets.push_back( Subset( 0x2E80, 0x2EFF, RID_SUBSETSTR_CJK_RADICAL_SUPPL ) );
+ aAllSubsets.push_back( Subset( 0x2F00, 0x2FDF, RID_SUBSETSTR_KANXI_RADICALS ) );
+ aAllSubsets.push_back( Subset( 0x2FF0, 0x2FFF, RID_SUBSETSTR_IDEO_DESC_CHARS ) );
+
+ aAllSubsets.push_back( Subset( 0x3000, 0x303F, RID_SUBSETSTR_CJK_SYMS_PUNCTUATION ) );
+ aAllSubsets.push_back( Subset( 0x3040, 0x309F, RID_SUBSETSTR_HIRAGANA ) );
+ aAllSubsets.push_back( Subset( 0x30A0, 0x30FF, RID_SUBSETSTR_KATAKANA ) );
+ aAllSubsets.push_back( Subset( 0x3100, 0x312F, RID_SUBSETSTR_BOPOMOFO ) );
+ aAllSubsets.push_back( Subset( 0x3130, 0x318F, RID_SUBSETSTR_HANGUL_COMPAT_JAMO ) );
+ aAllSubsets.push_back( Subset( 0x3190, 0x319F, RID_SUBSETSTR_KANBUN ) );
+ aAllSubsets.push_back( Subset( 0x31A0, 0x31BF, RID_SUBSETSTR_BOPOMOFO_EXTENDED ) );
+ aAllSubsets.push_back( Subset( 0x31C0, 0x31FF, RID_SUBSETSTR_KATAKANA_PHONETIC ) );
+ aAllSubsets.push_back( Subset( 0x3200, 0x32FF, RID_SUBSETSTR_ENCLOSED_CJK_LETTERS ) );
+ aAllSubsets.push_back( Subset( 0x3300, 0x33FF, RID_SUBSETSTR_CJK_COMPATIBILITY ) );
+
+ aAllSubsets.push_back( Subset( 0x3400, 0x4DFF, RID_SUBSETSTR_CJK_EXT_A_UNIFIED_IDGRAPH ) );
+ aAllSubsets.push_back( Subset( 0x4E00, 0x9FA5, RID_SUBSETSTR_CJK_UNIFIED_IDGRAPH ) );
+ aAllSubsets.push_back( Subset( 0xA000, 0xA4CF, RID_SUBSETSTR_YI ) );
+ aAllSubsets.push_back( Subset( 0xAC00, 0xB097, RID_SUBSETSTR_HANGUL_GA ) );
+ aAllSubsets.push_back( Subset( 0xB098, 0xB2E3, RID_SUBSETSTR_HANGUL_NA ) );
+ aAllSubsets.push_back( Subset( 0xB2E4, 0xB77B, RID_SUBSETSTR_HANGUL_DA ) );
+ aAllSubsets.push_back( Subset( 0xB77C, 0xB9C7, RID_SUBSETSTR_HANGUL_RA ) );
+ aAllSubsets.push_back( Subset( 0xB9C8, 0xBC13, RID_SUBSETSTR_HANGUL_MA ) );
+ aAllSubsets.push_back( Subset( 0xBC14, 0xC0AB, RID_SUBSETSTR_HANGUL_BA ) );
+ aAllSubsets.push_back( Subset( 0xC0AC, 0xC543, RID_SUBSETSTR_HANGUL_SA ) );
+ aAllSubsets.push_back( Subset( 0xC544, 0xC78F, RID_SUBSETSTR_HANGUL_AH ) );
+ aAllSubsets.push_back( Subset( 0xC790, 0xCC27, RID_SUBSETSTR_HANGUL_JA ) );
+ aAllSubsets.push_back( Subset( 0xCC28, 0xCE73, RID_SUBSETSTR_HANGUL_CHA ) );
+ aAllSubsets.push_back( Subset( 0xCE74, 0xD0BF, RID_SUBSETSTR_HANGUL_KA ) );
+ aAllSubsets.push_back( Subset( 0xD0C0, 0xD30B, RID_SUBSETSTR_HANGUL_TA ) );
+ aAllSubsets.push_back( Subset( 0xD30C, 0xD557, RID_SUBSETSTR_HANGUL_PA ) );
+ aAllSubsets.push_back( Subset( 0xD558, 0xD7A3, RID_SUBSETSTR_HANGUL_HA ) );
+ // aAllSubsets.push_back( Subset( 0xAC00, 0xD7AF, RID_SUBSETSTR_HANGUL ) );
+
+ // aAllSubsets.push_back( Subset( 0xD800, 0xDFFF, RID_SUBSETSTR_SURROGATE ) );
+ aAllSubsets.push_back( Subset( 0xE000, 0xF8FF, RID_SUBSETSTR_PRIVATE_USE_AREA ) );
+ aAllSubsets.push_back( Subset( 0xF900, 0xFAFF, RID_SUBSETSTR_CJK_COMPAT_IDGRAPHS ) );
+ aAllSubsets.push_back( Subset( 0xFB00, 0xFB4F, RID_SUBSETSTR_ALPHA_PRESENTATION ) );
+ aAllSubsets.push_back( Subset( 0xFB50, 0xFDFF, RID_SUBSETSTR_ARABIC_PRESENT_A ) );
+ aAllSubsets.push_back( Subset( 0xFE20, 0xFE2F, RID_SUBSETSTR_COMBINING_HALF_MARKS ) );
+ aAllSubsets.push_back( Subset( 0xFE30, 0xFE4F, RID_SUBSETSTR_CJK_COMPAT_FORMS ) );
+ aAllSubsets.push_back( Subset( 0xFE50, 0xFE6F, RID_SUBSETSTR_SMALL_FORM_VARIANTS ) );
+ aAllSubsets.push_back( Subset( 0xFE70, 0xFEFF, RID_SUBSETSTR_ARABIC_PRESENT_B ) );
+ aAllSubsets.push_back( Subset( 0xFF00, 0xFFEF, RID_SUBSETSTR_HALFW_FULLW_FORMS ) );
+ aAllSubsets.push_back( Subset( 0xFFF0, 0xFFFF, RID_SUBSETSTR_SPECIALS ) );
+ }
+
+ maSubsets = aAllSubsets;
+}
+
+void SubsetMap::ApplyCharMap( const FontCharMap* pFontCharMap )
+{
+ if( !pFontCharMap )
+ return;
+
+ // remove subsets that are not matched in any range
+ SubsetList::iterator it_next = maSubsets.begin();
+ while( it_next != maSubsets.end() )
+ {
+ SubsetList::iterator it = it_next++;
+ const Subset& rSubset = *it;
+ sal_uInt32 cMin = rSubset.GetRangeMin();
+ sal_uInt32 cMax = rSubset.GetRangeMax();
+
+ int nCount = pFontCharMap->CountCharsInRange( cMin, cMax );
+ if( nCount <= 0 )
+ maSubsets.erase( it );
+ }
+}
diff --git a/svx/source/dialog/checklbx.cxx b/svx/source/dialog/checklbx.cxx
new file mode 100644
index 000000000000..0a54e3464730
--- /dev/null
+++ b/svx/source/dialog/checklbx.cxx
@@ -0,0 +1,277 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+
+#define _SVX_CHECKLBX_CXX
+
+#include <svx/checklbx.hxx>
+#include <svx/dialmgr.hxx>
+
+#include <svx/dialogs.hrc>
+
+// class SvxCheckListBox -------------------------------------------------
+
+SvxCheckListBox::SvxCheckListBox( Window* pParent, WinBits nWinStyle ) :
+
+ SvTreeListBox( pParent, nWinStyle )
+
+{
+ Init_Impl();
+}
+
+// -----------------------------------------------------------------------
+
+SvxCheckListBox::SvxCheckListBox( Window* pParent, const ResId& rResId ) :
+
+ SvTreeListBox( pParent, rResId )
+
+{
+ Init_Impl();
+}
+
+// -----------------------------------------------------------------------
+
+SvxCheckListBox::SvxCheckListBox( Window* pParent, const ResId& rResId,
+ const Image& rNormalStaticImage,
+ const Image& /*TODO#i72485# rHighContrastStaticImage*/ ) :
+
+ SvTreeListBox( pParent, rResId )
+
+{
+ Init_Impl();
+ pCheckButton->aBmps[SV_BMP_STATICIMAGE] = rNormalStaticImage;
+}
+
+// -----------------------------------------------------------------------
+
+SvxCheckListBox::~SvxCheckListBox()
+{
+ delete pCheckButton;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCheckListBox::Init_Impl()
+{
+ pCheckButton = new SvLBoxButtonData( this );
+ EnableCheckButton( pCheckButton );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCheckListBox::InsertEntry( const String& rStr, sal_uInt16 nPos,
+ void* pUserData,
+ SvLBoxButtonKind eButtonKind )
+{
+ SvTreeListBox::InsertEntry( rStr, NULL, sal_False, nPos, pUserData,
+ eButtonKind );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCheckListBox::RemoveEntry( sal_uInt16 nPos )
+{
+ if ( nPos < GetEntryCount() )
+ SvTreeListBox::GetModel()->Remove( GetEntry( nPos ) );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCheckListBox::SelectEntryPos( sal_uInt16 nPos, sal_Bool bSelect )
+{
+ if ( nPos < GetEntryCount() )
+ Select( GetEntry( nPos ), bSelect );
+}
+
+// -----------------------------------------------------------------------
+
+sal_uInt16 SvxCheckListBox::GetSelectEntryPos() const
+{
+ SvLBoxEntry* pEntry = GetCurEntry();
+
+ if ( pEntry )
+ return (sal_uInt16)GetModel()->GetAbsPos( pEntry );
+ return LISTBOX_ENTRY_NOTFOUND;
+}
+
+// -----------------------------------------------------------------------
+
+String SvxCheckListBox::GetText( sal_uInt16 nPos ) const
+{
+ SvLBoxEntry* pEntry = GetEntry( nPos );
+
+ if ( pEntry )
+ return GetEntryText( pEntry );
+ return String();
+}
+
+// -----------------------------------------------------------------------
+
+sal_uInt16 SvxCheckListBox::GetCheckedEntryCount() const
+{
+ sal_uInt16 nCheckCount = 0;
+ sal_uInt16 nCount = (sal_uInt16)GetEntryCount();
+
+ for ( sal_uInt16 i = 0; i < nCount; ++i )
+ {
+ if ( IsChecked( i ) )
+ nCheckCount++;
+ }
+ return nCheckCount;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCheckListBox::CheckEntryPos( sal_uInt16 nPos, sal_Bool bCheck )
+{
+ if ( nPos < GetEntryCount() )
+ SetCheckButtonState(
+ GetEntry( nPos ), bCheck ? SvButtonState( SV_BUTTON_CHECKED ) :
+ SvButtonState( SV_BUTTON_UNCHECKED ) );
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxCheckListBox::IsChecked( sal_uInt16 nPos ) const
+{
+ if ( nPos < GetEntryCount() )
+ return (GetCheckButtonState( GetEntry( nPos ) ) == SV_BUTTON_CHECKED);
+ else
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------
+
+void* SvxCheckListBox::SetEntryData ( sal_uInt16 nPos, void* pNewData )
+{
+ void* pOld = NULL;
+
+ if ( nPos < GetEntryCount() )
+ {
+ pOld = GetEntry( nPos )->GetUserData();
+ GetEntry( nPos )->SetUserData( pNewData );
+ }
+ return pOld;
+}
+
+// -----------------------------------------------------------------------
+
+void* SvxCheckListBox::GetEntryData( sal_uInt16 nPos ) const
+{
+ if ( nPos < GetEntryCount() )
+ return GetEntry( nPos )->GetUserData();
+ else
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCheckListBox::ToggleCheckButton( SvLBoxEntry* pEntry )
+{
+ if ( pEntry )
+ {
+ if ( !IsSelected( pEntry ) )
+ Select( pEntry );
+ else
+ CheckEntryPos( GetSelectEntryPos(), !IsChecked( GetSelectEntryPos() ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCheckListBox::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( rMEvt.IsLeft() )
+ {
+ const Point aPnt = rMEvt.GetPosPixel();
+ SvLBoxEntry* pEntry = GetEntry( aPnt );
+
+ if ( pEntry )
+ {
+ sal_Bool bCheck = ( GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED );
+ SvLBoxItem* pItem = GetItem( pEntry, aPnt.X() );
+
+ if ( pItem && pItem->IsA() == SV_ITEM_ID_LBOXBUTTON )
+ {
+ SvTreeListBox::MouseButtonDown( rMEvt );
+ Select( pEntry, sal_True );
+ return;
+ }
+ else
+ {
+ ToggleCheckButton( pEntry );
+ SvTreeListBox::MouseButtonDown( rMEvt );
+
+ // check if the entry below the mouse changed during the base method call. This is possible if,
+ // for instance, a handler invoked by the base class tampers with the list entries.
+ const SvLBoxEntry* pNewEntry = GetEntry( aPnt );
+ if ( pNewEntry != pEntry )
+ return;
+
+ if ( bCheck != ( GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED ) )
+ CheckButtonHdl();
+ return;
+ }
+ }
+ }
+ SvTreeListBox::MouseButtonDown( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCheckListBox::KeyInput( const KeyEvent& rKEvt )
+{
+ const KeyCode& rKey = rKEvt.GetKeyCode();
+
+ if ( rKey.GetCode() == KEY_RETURN || rKey.GetCode() == KEY_SPACE )
+ {
+ SvLBoxEntry* pEntry = GetCurEntry();
+
+ if ( pEntry )
+ {
+ sal_Bool bCheck = ( GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED );
+ ToggleCheckButton( pEntry );
+ if ( bCheck != ( GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED ) )
+ CheckButtonHdl();
+ }
+ }
+ else if ( GetEntryCount() )
+ SvTreeListBox::KeyInput( rKEvt );
+}
+
+// -----------------------------------------------------------------------
+
+SvLBoxEntry* SvxCheckListBox::InsertEntry( const XubString& rText, SvLBoxEntry* pParent, sal_Bool bChildsOnDemand, sal_uIntPtr nPos, void* pUserData, SvLBoxButtonKind eButtonKind )
+{
+ return SvTreeListBox::InsertEntry( rText, pParent, bChildsOnDemand, nPos, pUserData, eButtonKind );
+}
+
diff --git a/svx/source/dialog/connctrl.cxx b/svx/source/dialog/connctrl.cxx
new file mode 100644
index 000000000000..81091d7d7e98
--- /dev/null
+++ b/svx/source/dialog/connctrl.cxx
@@ -0,0 +1,387 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <svx/svdoedge.hxx>
+#include <svx/svdattrx.hxx>
+#include <svx/svdmark.hxx>
+#include <svx/svdview.hxx>
+
+#include <svx/svdpage.hxx> // SdrObjList
+
+#include "svx/connctrl.hxx"
+#include <svx/dialmgr.hxx>
+#include "svx/dlgutil.hxx"
+
+// #110094#
+#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
+
+// #110094#
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <vcl/svapp.hxx>
+
+/*************************************************************************
+|*
+|* Ctor SvxXConnectionPreview
+|*
+*************************************************************************/
+
+SvxXConnectionPreview::SvxXConnectionPreview( Window* pParent, const ResId& rResId,
+ const SfxItemSet& rInAttrs ) :
+ Control ( pParent, rResId ),
+ rAttrs ( rInAttrs ),
+ pEdgeObj( NULL ),
+ pObjList( NULL ),
+ pView ( NULL )
+{
+ SetMapMode( MAP_100TH_MM );
+ SetStyles();
+}
+
+/*************************************************************************
+|*
+|* Dtor SvxXConnectionPreview
+|*
+*************************************************************************/
+
+SvxXConnectionPreview::~SvxXConnectionPreview()
+{
+ delete pObjList;
+}
+
+/*************************************************************************
+|*
+|* Dtor SvxXConnectionPreview
+|*
+*************************************************************************/
+
+void SvxXConnectionPreview::Construct()
+{
+ DBG_ASSERT( pView, "Keine gueltige View Uebergeben!" );
+
+ const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
+ sal_uIntPtr nMarkCount = rMarkList.GetMarkCount();
+
+ if( nMarkCount >= 1 )
+ {
+ sal_Bool bFound = sal_False;
+ const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+
+
+ for( sal_uInt16 i = 0; i < nMarkCount && !bFound; i++ )
+ {
+ pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
+ sal_uInt32 nInv = pObj->GetObjInventor();
+ sal_uInt16 nId = pObj->GetObjIdentifier();
+ if( nInv == SdrInventor && nId == OBJ_EDGE )
+ {
+ bFound = sal_True;
+ SdrEdgeObj* pTmpEdgeObj = (SdrEdgeObj*) pObj;
+ pEdgeObj = (SdrEdgeObj*) pTmpEdgeObj->Clone();
+
+ SdrObjConnection& rConn1 = (SdrObjConnection&)pEdgeObj->GetConnection( sal_True );
+ SdrObjConnection& rConn2 = (SdrObjConnection&)pEdgeObj->GetConnection( sal_False );
+
+ rConn1 = pTmpEdgeObj->GetConnection( sal_True );
+ rConn2 = pTmpEdgeObj->GetConnection( sal_False );
+
+ SdrObject* pTmpObj1 = pTmpEdgeObj->GetConnectedNode( sal_True );
+ SdrObject* pTmpObj2 = pTmpEdgeObj->GetConnectedNode( sal_False );
+
+ // #110094#
+ // potential memory leak here (!). Create SdrObjList only when there is
+ // not yet one.
+ if(!pObjList)
+ {
+ pObjList = new SdrObjList( pView->GetModel(), NULL );
+ }
+
+ if( pTmpObj1 )
+ {
+ SdrObject* pObj1 = pTmpObj1->Clone();
+ pObjList->InsertObject( pObj1 );
+ pEdgeObj->ConnectToNode( sal_True, pObj1 );
+ }
+ if( pTmpObj2 )
+ {
+ SdrObject* pObj2 = pTmpObj2->Clone();
+ pObjList->InsertObject( pObj2 );
+ pEdgeObj->ConnectToNode( sal_False, pObj2 );
+ }
+ pObjList->InsertObject( pEdgeObj );
+ }
+ }
+ }
+
+ if( !pEdgeObj )
+ pEdgeObj = new SdrEdgeObj();
+
+ // Groesse anpassen
+ if( pObjList )
+ {
+ OutputDevice* pOD = pView->GetFirstOutputDevice(); // GetWin( 0 );
+ Rectangle aRect = pObjList->GetAllObjBoundRect();
+
+ MapMode aMapMode = GetMapMode();
+ aMapMode.SetMapUnit( pOD->GetMapMode().GetMapUnit() );
+ SetMapMode( aMapMode );
+
+ MapMode aDisplayMap( aMapMode );
+ Point aNewPos;
+ Size aNewSize;
+ const Size aWinSize = PixelToLogic( GetOutputSizePixel(), aDisplayMap );
+ const long nWidth = aWinSize.Width();
+ const long nHeight = aWinSize.Height();
+ double fRectWH = (double) aRect.GetWidth() / aRect.GetHeight();
+ double fWinWH = (double) nWidth / nHeight;
+
+ // Bitmap an Thumbgroesse anpassen (hier nicht!)
+ if ( fRectWH < fWinWH)
+ {
+ aNewSize.Width() = (long) ( (double) nHeight * fRectWH );
+ aNewSize.Height()= nHeight;
+ }
+ else
+ {
+ aNewSize.Width() = nWidth;
+ aNewSize.Height()= (long) ( (double) nWidth / fRectWH );
+ }
+
+ Fraction aFrac1( aWinSize.Width(), aRect.GetWidth() );
+ Fraction aFrac2( aWinSize.Height(), aRect.GetHeight() );
+ Fraction aMinFrac( aFrac1 <= aFrac2 ? aFrac1 : aFrac2 );
+
+ // MapMode umsetzen
+ aDisplayMap.SetScaleX( aMinFrac );
+ aDisplayMap.SetScaleY( aMinFrac );
+
+ // Zentrierung
+ aNewPos.X() = ( nWidth - aNewSize.Width() ) >> 1;
+ aNewPos.Y() = ( nHeight - aNewSize.Height() ) >> 1;
+
+ aDisplayMap.SetOrigin( LogicToLogic( aNewPos, aMapMode, aDisplayMap ) );
+ SetMapMode( aDisplayMap );
+
+ // Ursprung
+ aNewPos = aDisplayMap.GetOrigin();
+ aNewPos -= Point( aRect.TopLeft().X(), aRect.TopLeft().Y() );
+ aDisplayMap.SetOrigin( aNewPos );
+ SetMapMode( aDisplayMap );
+
+
+ Point aPos;
+ MouseEvent aMEvt( aPos, 1, 0, MOUSE_RIGHT );
+ MouseButtonDown( aMEvt );
+ /*
+ Point aPt( -aRect.TopLeft().X(), -aRect.TopLeft().Y() );
+ aMapMode.SetOrigin( aPt );
+
+ // Skalierung
+ Size aSize = GetOutputSize();
+ Fraction aFrac1( aSize.Width(), aRect.GetWidth() );
+ Fraction aFrac2( aSize.Height(), aRect.GetHeight() );
+ Fraction aMaxFrac( aFrac1 > aFrac2 ? aFrac1 : aFrac2 );
+ Fraction aMinFrac( aFrac1 <= aFrac2 ? aFrac1 : aFrac2 );
+ sal_Bool bChange = (sal_Bool) ( (double)aMinFrac > 1.0 );
+ aMapMode.SetScaleX( aMinFrac );
+ aMapMode.SetScaleY( aMinFrac );
+
+ // zentrieren
+ long nXXL = aSize.Width() > aRect.GetWidth() ? aSize.Width() : aRect.GetWidth();
+ long nXS = aSize.Width() <= aRect.GetWidth() ? aSize.Width() : aRect.GetWidth();
+ if( bChange )
+ {
+ long nTmp = nXXL; nXXL = nXS; nXS = nTmp;
+ }
+ long nX = (long) ( (double)aMinFrac * (double)nXXL );
+ nX = (long) ( (double)labs( nXS - nX ) / (double)aMinFrac / 2.0 );
+
+ long nYXL = aSize.Height() > aRect.GetHeight() ? aSize.Height() : aRect.GetHeight();
+ long nYS = aSize.Height() <= aRect.GetHeight() ? aSize.Height() : aRect.GetHeight();
+ if( bChange )
+ {
+ long nTmp = nXXL; nXXL = nXS; nXS = nTmp;
+ }
+ long nY = (long) ( (double)aMinFrac * (double)nYXL );
+ nY = (long) ( (double)labs( nYS - nY ) / (double)aMinFrac / 2.0 );
+
+ aPt += Point( nX, nY );
+ aMapMode.SetOrigin( aPt );
+
+ SetMapMode( aMapMode );
+ */
+ }
+}
+
+/*************************************************************************
+|*
+|* SvxXConnectionPreview: Paint()
+|*
+*************************************************************************/
+
+void SvxXConnectionPreview::Paint( const Rectangle& )
+{
+ if( pObjList )
+ {
+ // #110094#
+ // This will not work anymore. To not start at Adam and Eve, i will
+ // ATM not try to change all this stuff to really using an own model
+ // and a view. I will just try to provide a mechanism to paint such
+ // objects without own model and without a page/view with the new
+ // mechanism.
+
+ // New stuff: Use a ObjectContactOfObjListPainter.
+ sdr::contact::SdrObjectVector aObjectVector;
+
+ for(sal_uInt32 a(0L); a < pObjList->GetObjCount(); a++)
+ {
+ SdrObject* pObject = pObjList->GetObj(a);
+ DBG_ASSERT(pObject,
+ "SvxXConnectionPreview::Paint: Corrupt ObjectList (!)");
+ aObjectVector.push_back(pObject);
+ }
+
+ sdr::contact::ObjectContactOfObjListPainter aPainter(*this, aObjectVector, 0);
+ sdr::contact::DisplayInfo aDisplayInfo;
+
+ // do processing
+ aPainter.ProcessDisplay(aDisplayInfo);
+ }
+}
+
+/*************************************************************************
+|*
+|* SvxXConnectionPreview: SetAttributes()
+|*
+*************************************************************************/
+
+void SvxXConnectionPreview::SetAttributes( const SfxItemSet& rInAttrs )
+{
+ //pEdgeObj->SetItemSetAndBroadcast(rInAttrs);
+ pEdgeObj->SetMergedItemSetAndBroadcast(rInAttrs);
+
+ Invalidate();
+}
+
+/*************************************************************************
+|*
+|* Ermittelt die Anzahl der Linienversaetze anhand des Preview-Objektes
+|*
+*************************************************************************/
+
+sal_uInt16 SvxXConnectionPreview::GetLineDeltaAnz()
+{
+ const SfxItemSet& rSet = pEdgeObj->GetMergedItemSet();
+ sal_uInt16 nCount(0);
+
+ if(SFX_ITEM_DONTCARE != rSet.GetItemState(SDRATTR_EDGELINEDELTAANZ))
+ nCount = ((const SdrEdgeLineDeltaAnzItem&)rSet.Get(SDRATTR_EDGELINEDELTAANZ)).GetValue();
+
+ return nCount;
+}
+
+/*************************************************************************
+|*
+|* SvxXConnectionPreview: MouseButtonDown()
+|*
+*************************************************************************/
+
+void SvxXConnectionPreview::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ sal_Bool bZoomIn = rMEvt.IsLeft() && !rMEvt.IsShift();
+ sal_Bool bZoomOut = rMEvt.IsRight() || rMEvt.IsShift();
+ sal_Bool bCtrl = rMEvt.IsMod1();
+
+ if( bZoomIn || bZoomOut )
+ {
+ MapMode aMapMode = GetMapMode();
+ Fraction aXFrac = aMapMode.GetScaleX();
+ Fraction aYFrac = aMapMode.GetScaleY();
+ Fraction* pMultFrac;
+
+ if( bZoomIn )
+ {
+ if( bCtrl )
+ pMultFrac = new Fraction( 3, 2 );
+ else
+ pMultFrac = new Fraction( 11, 10 );
+ }
+ else
+ {
+ if( bCtrl )
+ pMultFrac = new Fraction( 2, 3 );
+ else
+ pMultFrac = new Fraction( 10, 11 );
+ }
+
+ aXFrac *= *pMultFrac;
+ aYFrac *= *pMultFrac;
+ if( (double)aXFrac > 0.001 && (double)aXFrac < 1000.0 &&
+ (double)aYFrac > 0.001 && (double)aYFrac < 1000.0 )
+ {
+ aMapMode.SetScaleX( aXFrac );
+ aMapMode.SetScaleY( aYFrac );
+ SetMapMode( aMapMode );
+
+ Size aOutSize( GetOutputSize() );
+
+ Point aPt( aMapMode.GetOrigin() );
+ long nX = (long)( ( (double)aOutSize.Width() - ( (double)aOutSize.Width() * (double)*pMultFrac ) ) / 2.0 + 0.5 );
+ long nY = (long)( ( (double)aOutSize.Height() - ( (double)aOutSize.Height() * (double)*pMultFrac ) ) / 2.0 + 0.5 );
+ aPt.X() += nX;
+ aPt.Y() += nY;
+
+ aMapMode.SetOrigin( aPt );
+ SetMapMode( aMapMode );
+
+ Invalidate();
+ }
+ delete pMultFrac;
+ }
+}
+
+void SvxXConnectionPreview::SetStyles()
+{
+ const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
+ SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR );
+ SetBackground( Wallpaper( Color( rStyles.GetFieldColor() ) ) );
+}
+
+void SvxXConnectionPreview::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Control::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ SetStyles();
+ }
+}
+
diff --git a/svx/source/dialog/contdlg.hrc b/svx/source/dialog/contdlg.hrc
new file mode 100644
index 000000000000..a191231daa22
--- /dev/null
+++ b/svx/source/dialog/contdlg.hrc
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <svx/dialogs.hrc>
+
+
+// ImapDlg-Dialoge
+#define RID_SVX_CONTOURDLG_START RID_SVX_CONTOUR_START
+
+
+/******************************************************************************/
+
+
+#define RID_SVXDLG_CONTOUR (RID_SVX_CONTOURDLG_START)
+
+#define TBX1 1
+#define TBI_APPLY 1
+
+#define TBI_WORKPLACE 2
+
+#define TBI_SELECT 5
+#define TBI_RECT 6
+#define TBI_CIRCLE 7
+#define TBI_POLY 8
+#define TBI_FREEPOLY 9
+
+#define TBI_POLYEDIT 15
+#define TBI_POLYMOVE 16
+#define TBI_POLYINSERT 17
+#define TBI_POLYDELETE 18
+
+#define TBI_UNDO 20
+#define TBI_REDO 21
+
+#define TBI_AUTOCONTOUR 25
+#define TBI_PIPETTE 26
+
+#define MTF_TOLERANCE 1
+
+#define CTL_CONTOUR 1
+
+#define STB_STATUS 1
+
+#define CD_IMAPDLG 1300
+#define CDH_IMAPDLG 1301
+
+
+/******************************************************************************/
+
+#define STR_CONTOURDLG_MODIFY (RID_SVX_CONTOURDLG_START + 2)
+#define STR_CONTOURDLG_NEWPIPETTE (RID_SVX_CONTOURDLG_START + 3)
+#define STR_CONTOURDLG_WORKPLACE (RID_SVX_CONTOURDLG_START + 4)
+#define STR_CONTOURDLG_LINKED (RID_SVX_CONTOURDLG_START + 5)
+
+/******************************************************************************/
+
+
+/******************************************************************************/
+
+
+/******************************************************************************/
+
+
+/******************************************************************************/
diff --git a/svx/source/dialog/contdlg.src b/svx/source/dialog/contdlg.src
new file mode 100644
index 000000000000..989bdd93d336
--- /dev/null
+++ b/svx/source/dialog/contdlg.src
@@ -0,0 +1,290 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ---------------------------------------------------------------
+#include "helpid.hrc"
+#include "contdlg.hrc"
+
+#define MASKCOLOR MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; } ;
+
+ // RID_SVXDLG_CONTOUR ----------------------------------------------------
+FloatingWindow RID_SVXDLG_CONTOUR
+{
+ HelpID = "svx:FloatingWindow:RID_SVXDLG_CONTOUR";
+ OutputSize = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 270 , 213 ) ;
+ Text [ en-US ] = "Contour Editor" ;
+ Sizeable = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+ ToolBox TBX1
+ {
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ HelpId = HID_CONTDLG_TOOLBOX ;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ Identifier = TBI_APPLY ;
+ HelpId = HID_CONTDLG_APPLY ;
+ Text [ en-US ] = "Apply" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_WORKPLACE ;
+ HelpId = HID_CONTDLG_WORKPLACE ;
+ Text [ en-US ] = "Workspace" ;
+ AutoCheck = TRUE ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_SELECT ;
+ HelpId = HID_CONTDLG_SELECT ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ Text [ en-US ] = "Select" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_RECT ;
+ HelpId = HID_CONTDLG_RECT ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ Text [ en-US ] = "Rectangle" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_CIRCLE ;
+ HelpId = HID_CONTDLG_CIRCLE ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ Text [ en-US ] = "Ellipse" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_POLY ;
+ HelpId = HID_CONTDLG_POLY ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ Text [ en-US ] = "Polygon" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_POLYEDIT ;
+ HelpId = HID_CONTDLG_POLYEDIT ;
+ Text [ en-US ] = "Edit Points" ;
+ AutoCheck = TRUE ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_POLYMOVE ;
+ HelpId = HID_CONTDLG_POLYMOVE ;
+ Text [ en-US ] = "Move Points" ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_POLYINSERT ;
+ HelpId = HID_CONTDLG_POLYINSERT ;
+ Text [ en-US ] = "Insert Points" ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_POLYDELETE ;
+ HelpId = HID_CONTDLG_POLYDELETE ;
+ Text [ en-US ] = "Delete Points" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_AUTOCONTOUR ;
+ HelpId = HID_CONTDLG_AUTOCONTOUR ;
+ Text [ en-US ] = "AutoContour" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_UNDO ;
+ HelpId = HID_CONTDLG_UNDO ;
+
+ Text [ en-US ] = "Undo " ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_REDO ;
+ HelpId = HID_CONTDLG_REDO ;
+
+
+ Text [ en-US ] = "Redo " ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_PIPETTE ;
+ HelpId = HID_CONTDLG_PIPETTE ;
+ Text [ en-US ] = "Pipette" ;
+ AutoCheck = TRUE ;
+ };
+ };
+ };
+ MetricField MTF_TOLERANCE
+ {
+ HelpID = "svx:MetricField:RID_SVXDLG_CONTOUR:MTF_TOLERANCE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 28 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 99 ;
+ Last = 99 ;
+ SpinSize = 1 ;
+ Unit = FUNIT_CUSTOM ;
+ QuickHelpText [ en-US ] = "Color Tolerance" ;
+ CustomUnitText [ en-US ] = "%" ;
+ };
+ Control CTL_CONTOUR
+ {
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 24 ) ;
+ HelpId = HID_CONTDLG_GRAPHWND ;
+ };
+
+#define CONTOURDLG_IDLIST \
+ IdList = \
+ { \
+ TBI_APPLY ; \
+ TBI_WORKPLACE ; \
+ TBI_SELECT ; \
+ TBI_RECT ; \
+ TBI_CIRCLE ; \
+ TBI_POLY ; \
+ TBI_POLYEDIT ; \
+ TBI_POLYMOVE ; \
+ TBI_POLYINSERT ; \
+ TBI_POLYDELETE ; \
+ TBI_AUTOCONTOUR ; \
+ TBI_UNDO ; \
+ TBI_REDO ; \
+ TBI_PIPETTE ; \
+ }; \
+ IdCount = { 14 ; };
+
+ ImageList CD_IMAPDLG
+ {
+ Prefix = "cd";
+ MASKCOLOR
+ CONTOURDLG_IDLIST
+ };
+ ImageList CDH_IMAPDLG
+ {
+ Prefix = "cdh";
+ MASKCOLOR
+ CONTOURDLG_IDLIST
+ };
+};
+/******************************************************************************/
+String STR_CONTOURDLG_MODIFY
+{
+ Text [ en-US ] = "The contour has been modified.\nDo you want to save the changes?" ;
+};
+String STR_CONTOURDLG_NEWPIPETTE
+{
+ Text [ en-US ] = "Do you want to create a new contour?" ;
+};
+String STR_CONTOURDLG_WORKPLACE
+{
+ Text [ en-US ] = "Setting a new workspace will\ncause the contour to be deleted.\nAre you sure you want to continue?" ;
+};
+String STR_CONTOURDLG_LINKED
+{
+ Text [ en-US ] = "This graphic object is linked to the document. Do you want to unlink the graphics in order to edit it?" ;
+};
+/******************************************************************************/
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/dialog/contimp.hxx b/svx/source/dialog/contimp.hxx
new file mode 100644
index 000000000000..4993d15839e4
--- /dev/null
+++ b/svx/source/dialog/contimp.hxx
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CONTIMP_HXX_
+#define _CONTIMP_HXX_
+
+#ifndef _CONTDLG_HXX
+#include <svx/contdlg.hxx>
+#endif
+#include "contwnd.hxx"
+#include <vcl/toolbox.hxx>
+#include <vcl/status.hxx>
+
+#define CONT_RESID(nId) ResId( nId, DIALOG_MGR() )
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+class SvxSuperContourDlg : public SvxContourDlg
+{
+ using SvxContourDlg::GetPolyPolygon;
+
+ Graphic aGraphic;
+ Graphic aUndoGraphic;
+ Graphic aRedoGraphic;
+ Graphic aUpdateGraphic;
+ PolyPolygon aUpdatePolyPoly;
+ Timer aUpdateTimer;
+ Timer aCreateTimer;
+ Size aLastSize;
+ void* pUpdateEditingObject;
+ void* pCheckObj;
+ SvxContourDlgItem aContourItem;
+ ToolBox aTbx1;
+ MetricField aMtfTolerance;
+ ContourWindow aContourWnd;
+ StatusBar aStbStatus;
+ sal_uIntPtr nGrfChanged;
+ sal_Bool bExecState;
+ sal_Bool bPipetteMode;
+ sal_Bool bWorkplaceMode;
+ sal_Bool bUpdateGraphicLinked;
+ sal_Bool bGraphicLinked;
+ ImageList maImageList;
+ ImageList maImageListH;
+
+ virtual void Resize();
+ virtual sal_Bool Close();
+
+ void DoAutoCreate();
+ void ReducePoints( const long nTol = 8 );
+
+ DECL_LINK( Tbx1ClickHdl, ToolBox* );
+ DECL_LINK( MousePosHdl, ContourWindow* );
+ DECL_LINK( GraphSizeHdl, ContourWindow* );
+ DECL_LINK( UpdateHdl, Timer* );
+ DECL_LINK( CreateHdl, Timer* );
+ DECL_LINK( StateHdl, ContourWindow* );
+ DECL_LINK( PipetteHdl, ContourWindow* );
+ DECL_LINK( PipetteClickHdl, ContourWindow* );
+ DECL_LINK( WorkplaceClickHdl, ContourWindow* );
+ DECL_LINK( MiscHdl, void* );
+
+public:
+
+ SvxSuperContourDlg( SfxBindings *pBindings, SfxChildWindow *pCW,
+ Window* pParent, const ResId& rResId );
+ ~SvxSuperContourDlg();
+
+ void SetExecState( sal_Bool bEnable );
+
+ void SetGraphic( const Graphic& rGraphic );
+ void SetGraphicLinked( sal_Bool bLinked ) { bGraphicLinked = bLinked; }
+ const Graphic& GetGraphic() const { return aGraphic; }
+ sal_Bool IsGraphicChanged() const { return nGrfChanged > 0UL; }
+
+ void SetPolyPolygon( const PolyPolygon& rPolyPoly );
+ PolyPolygon GetPolyPolygon( sal_Bool bRescaleToGraphic = sal_True );
+
+ void SetEditingObject( void* pObj ) { pCheckObj = pObj; }
+ const void* GetEditingObject() const { return pCheckObj; }
+
+ sal_Bool IsUndoPossible() const;
+ sal_Bool IsRedoPossible() const;
+
+ void UpdateGraphic( const Graphic& rGraphic, sal_Bool bGraphicLinked,
+ const PolyPolygon* pPolyPoly = NULL,
+ void* pEditingObj = NULL );
+
+ /** switches the toolbox images depending on the actuall high contrast display mode state */
+ void ApplyImageList();
+
+ /** virtual method from Window is used to detect change in high contrast display mode
+ to switch the toolbox images */
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+};
+
+
+#endif // _CONTIMP_HXX_
+
diff --git a/svx/source/dialog/contwnd.cxx b/svx/source/dialog/contwnd.cxx
new file mode 100644
index 000000000000..a7f98ea124de
--- /dev/null
+++ b/svx/source/dialog/contwnd.cxx
@@ -0,0 +1,358 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/xoutbmp.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/svxids.hrc>
+#include <contdlg.hrc>
+#include <contwnd.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/xfltrit.hxx>
+#include <svx/xfillit.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+
+// #i75482#
+#include "svx/sdrpaintwindow.hxx"
+
+#define TRANSCOL Color( COL_WHITE )
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+ContourWindow::ContourWindow( Window* pParent, const ResId& rResId ) :
+ GraphCtrl ( pParent, rResId ),
+ aWorkRect ( 0, 0, 0, 0 ),
+ bPipetteMode ( sal_False ),
+ bWorkplaceMode ( sal_False ),
+ bClickValid ( sal_False )
+{
+ SetWinStyle( WB_SDRMODE );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+ContourWindow::~ContourWindow()
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void ContourWindow::SetPolyPolygon( const PolyPolygon& rPolyPoly )
+{
+ SdrPage* pPage = (SdrPage*) pModel->GetPage( 0 );
+ const sal_uInt16 nPolyCount = rPolyPoly.Count();
+
+ // zuerst alle Zeichenobjekte loeschen
+ aPolyPoly = rPolyPoly;
+
+ // #117412#
+ // To avoid to have destroyed objects which are still selected, it is necessary to deselect
+ // them first (!)
+ pView->UnmarkAllObj();
+
+ pPage->Clear();
+
+ for ( sal_uInt16 i = 0; i < nPolyCount; i++ )
+ {
+ basegfx::B2DPolyPolygon aPolyPolygon;
+ aPolyPolygon.append(aPolyPoly[ i ].getB2DPolygon());
+ SdrPathObj* pPathObj = new SdrPathObj( OBJ_PATHFILL, aPolyPolygon );
+
+ if ( pPathObj )
+ {
+ SfxItemSet aSet( pModel->GetItemPool() );
+
+ aSet.Put( XFillStyleItem( XFILL_SOLID ) );
+ aSet.Put( XFillColorItem( String(), TRANSCOL ) );
+ aSet.Put( XFillTransparenceItem( 50 ) );
+
+ //pPathObj->SetItemSetAndBroadcast(aSet);
+ pPathObj->SetMergedItemSetAndBroadcast(aSet);
+
+ pPage->InsertObject( pPathObj );
+ }
+ }
+
+ if ( nPolyCount )
+ {
+ pView->MarkAll();
+ pView->CombineMarkedObjects( sal_False );
+ }
+
+ pModel->SetChanged( sal_False );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+const PolyPolygon& ContourWindow::GetPolyPolygon()
+{
+ if ( pModel->IsChanged() )
+ {
+ SdrPage* pPage = (SdrPage*) pModel->GetPage( 0 );
+
+ aPolyPoly = PolyPolygon();
+
+ if ( pPage && pPage->GetObjCount() )
+ {
+ SdrPathObj* pPathObj = (SdrPathObj*)pPage->GetObj(0L);
+ // Not sure if subdivision is needed for ContourWindow, but maybe it cannot handle
+ // curves at all. Keeping subdivision here for security
+ const basegfx::B2DPolyPolygon aB2DPolyPolygon(basegfx::tools::adaptiveSubdivideByAngle(pPathObj->GetPathPoly()));
+ aPolyPoly = PolyPolygon(aB2DPolyPolygon);
+ }
+
+ pModel->SetChanged( sal_False );
+ }
+
+ return aPolyPoly;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void ContourWindow::InitSdrModel()
+{
+ GraphCtrl::InitSdrModel();
+
+ SfxItemSet aSet( pModel->GetItemPool() );
+
+ aSet.Put( XFillColorItem( String(), TRANSCOL ) );
+ aSet.Put( XFillTransparenceItem( 50 ) );
+ pView->SetAttributes( aSet );
+ pView->SetFrameDragSingles( sal_True );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void ContourWindow::SdrObjCreated( const SdrObject& )
+{
+ pView->MarkAll();
+ pView->CombineMarkedObjects( sal_False );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+sal_Bool ContourWindow::IsContourChanged() const
+{
+ SdrPage* pPage = (SdrPage*) pModel->GetPage( 0 );
+ sal_Bool bRet = sal_False;
+
+ if ( pPage && pPage->GetObjCount() )
+ bRet = ( (SdrPathObj*) pPage->GetObj( 0 ) )->GetPathPoly().count() && pModel->IsChanged();
+
+ return bRet;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void ContourWindow::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( bWorkplaceMode )
+ {
+ const Point aLogPt( PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ SetPolyPolygon( PolyPolygon() );
+ aWorkRect = Rectangle( aLogPt, aLogPt );
+ Paint( Rectangle( Point(), GetGraphicSize() ) );
+ SetEditMode( sal_True );
+ }
+
+ if ( !bPipetteMode )
+ GraphCtrl::MouseButtonDown( rMEvt );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void ContourWindow::MouseMove( const MouseEvent& rMEvt )
+{
+ bClickValid = sal_False;
+
+ if ( bPipetteMode )
+ {
+ const Point aLogPt( PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ aPipetteColor = GetPixel( aLogPt );
+ Control::MouseMove( rMEvt );
+
+ if ( aPipetteLink.IsSet() && Rectangle( Point(), GetGraphicSize() ).IsInside( aLogPt ) )
+ {
+ SetPointer( POINTER_REFHAND );
+ aPipetteLink.Call( this );
+ }
+ }
+ else
+ GraphCtrl::MouseMove( rMEvt );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void ContourWindow::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ Point aTmpPoint;
+ const Rectangle aGraphRect( aTmpPoint, GetGraphicSize() );
+ const Point aLogPt( PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ bClickValid = aGraphRect.IsInside( aLogPt );
+ ReleaseMouse();
+
+ if ( bPipetteMode )
+ {
+ Control::MouseButtonUp( rMEvt );
+
+ if ( aPipetteClickLink.IsSet() )
+ aPipetteClickLink.Call( this );
+ }
+ else if ( bWorkplaceMode )
+ {
+ GraphCtrl::MouseButtonUp( rMEvt );
+
+ aWorkRect.Right() = aLogPt.X();
+ aWorkRect.Bottom() = aLogPt.Y();
+ aWorkRect.Intersection( aGraphRect );
+ aWorkRect.Justify();
+
+ if ( aWorkRect.Left() != aWorkRect.Right() && aWorkRect.Top() != aWorkRect.Bottom() )
+ {
+ PolyPolygon _aPolyPoly( GetPolyPolygon() );
+
+ _aPolyPoly.Clip( aWorkRect );
+ SetPolyPolygon( _aPolyPoly );
+ pView->SetWorkArea( aWorkRect );
+ }
+ else
+ pView->SetWorkArea( aGraphRect );
+
+ Invalidate( aGraphRect );
+
+ if ( aWorkplaceClickLink.IsSet() )
+ aWorkplaceClickLink.Call( this );
+ }
+ else
+ GraphCtrl::MouseButtonUp( rMEvt );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void ContourWindow::Paint( const Rectangle& rRect )
+{
+ // #i75482#
+ // encapsulate the redraw using Begin/End and use the returned
+ // data to get the target output device (e.g. when pre-rendering)
+ SdrPaintWindow* pPaintWindow = pView->BeginCompleteRedraw(this);
+ OutputDevice& rTarget = pPaintWindow->GetTargetOutputDevice();
+
+ const Graphic& rGraphic = GetGraphic();
+ const Color& rOldLineColor = GetLineColor();
+ const Color& rOldFillColor = GetFillColor();
+
+ rTarget.SetLineColor( Color( COL_BLACK ) );
+ rTarget.SetFillColor( Color( COL_WHITE ) );
+
+ rTarget.DrawRect( Rectangle( Point(), GetGraphicSize() ) );
+
+ rTarget.SetLineColor( rOldLineColor );
+ rTarget.SetFillColor( rOldFillColor );
+
+ if ( rGraphic.GetType() != GRAPHIC_NONE )
+ rGraphic.Draw( &rTarget, Point(), GetGraphicSize() );
+
+ if ( aWorkRect.Left() != aWorkRect.Right() && aWorkRect.Top() != aWorkRect.Bottom() )
+ {
+ PolyPolygon _aPolyPoly( 2, 2 );
+ const Color aOldFillColor( GetFillColor() );
+
+ _aPolyPoly.Insert( Rectangle( Point(), GetGraphicSize() ) );
+ _aPolyPoly.Insert( aWorkRect );
+
+ rTarget.SetFillColor( COL_LIGHTRED );
+ rTarget.DrawTransparent( _aPolyPoly, 50 );
+ rTarget.SetFillColor( aOldFillColor );
+ }
+
+ // #i75482#
+ const Region aRepaintRegion(rRect);
+ pView->DoCompleteRedraw(*pPaintWindow, aRepaintRegion);
+ pView->EndCompleteRedraw(*pPaintWindow, true);
+}
+
+// eof
diff --git a/svx/source/dialog/contwnd.hxx b/svx/source/dialog/contwnd.hxx
new file mode 100644
index 000000000000..94addbe0b51f
--- /dev/null
+++ b/svx/source/dialog/contwnd.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CONTWND_HXX
+#define _CONTWND_HXX
+
+#include <tools/poly.hxx>
+#include <svx/graphctl.hxx>
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+class ContourWindow : public GraphCtrl
+{
+ PolyPolygon aPolyPoly;
+ Color aPipetteColor;
+ Rectangle aWorkRect;
+ Link aPipetteLink;
+ Link aPipetteClickLink;
+ Link aWorkplaceClickLink;
+ sal_Bool bPipetteMode;
+ sal_Bool bWorkplaceMode;
+ sal_Bool bClickValid;
+
+protected:
+
+ virtual void MouseButtonDown(const MouseEvent& rMEvt);
+ virtual void MouseMove(const MouseEvent& rMEvt);
+ virtual void MouseButtonUp(const MouseEvent& rMEvt);
+ virtual void SdrObjCreated( const SdrObject& rObj );
+ virtual void InitSdrModel();
+ virtual void Paint( const Rectangle& rRect );
+
+ void CreatePolyPolygon();
+
+public:
+
+ ContourWindow( Window* pParent, const ResId& rResId );
+ ~ContourWindow();
+
+ void SetPolyPolygon( const PolyPolygon& rPolyPoly );
+ const PolyPolygon& GetPolyPolygon();
+
+ void SetPipetteMode( const sal_Bool bPipette ) { bPipetteMode = bPipette; }
+ sal_Bool IsPipetteMode() const { return bPipetteMode; }
+ const Color& GetPipetteColor() const { return aPipetteColor; }
+
+ sal_Bool IsClickValid() const { return bClickValid; }
+ sal_Bool IsContourChanged() const;
+
+ void SetWorkplaceMode( const sal_Bool bWorkplace ) { bWorkplaceMode = bWorkplace; }
+ sal_Bool IsWorkplaceMode() const { return bWorkplaceMode; }
+ const Rectangle& GetWorkRect() const { return aWorkRect; }
+
+ void SetPipetteHdl( const Link& rLink ) { aPipetteLink = rLink; }
+ void SetPipetteClickHdl( const Link& rLink ) { aPipetteClickLink = rLink; }
+
+ void SetWorkplaceClickHdl( const Link& rLink ) { aWorkplaceClickLink = rLink; }
+};
+
+
+#endif
+
diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx
new file mode 100644
index 000000000000..c3f1f0b17a52
--- /dev/null
+++ b/svx/source/dialog/ctredlin.cxx
@@ -0,0 +1,1531 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// System - Includes ---------------------------------------------------------
+#include <vcl/svapp.hxx>
+#include <tools/shl.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/module.hxx>
+#include <svtools/txtcmp.hxx>
+#include <unotools/charclass.hxx>
+// INCLUDE -------------------------------------------------------------------
+#include <editeng/unolingu.hxx>
+#include <svx/dialmgr.hxx>
+#include "ctredlin.hrc"
+#include <svx/ctredlin.hxx>
+#include "helpid.hrc"
+
+//============================================================================
+// Local Defines and Function
+//----------------------------------------------------------------------------
+
+inline void EnableDisable( Window& rWin, sal_Bool bEnable )
+{
+ if (bEnable)
+ rWin.Enable();
+ else
+ rWin.Disable();
+}
+
+static long nStaticTabs[]=
+{
+ 5,10,65,120,170,220
+};
+
+#define MIN_DISTANCE 6
+#define WRITER_AUTHOR 1
+#define WRITER_DATE 2
+#define CALC_AUTHOR 2
+#define CALC_DATE 3
+
+RedlinData::RedlinData()
+{
+ bDisabled=sal_False;
+ pData=NULL;
+}
+RedlinData::~RedlinData()
+{
+}
+
+//============================================================================
+// class SvxRedlinEntry (Eintraege fuer Liste)
+//----------------------------------------------------------------------------
+
+SvxRedlinEntry::SvxRedlinEntry()
+ :SvLBoxEntry()
+{
+}
+
+SvxRedlinEntry::~SvxRedlinEntry()
+{
+ RedlinData* pRedDat=(RedlinData*) GetUserData();
+ if(pRedDat!=NULL)
+ {
+ delete pRedDat;
+ }
+}
+
+/*************************************************************************
+#* Funktionen der in den SvxRedlinTable eingefuegten Items
+#************************************************************************/
+
+DBG_NAME(SvLBoxColorString);
+
+/*************************************************************************
+#* Member: SvLBoxColorString Datum:23.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvLBoxColorString
+#*
+#* Funktion: Konstruktor der Klasse SvLBoxColorString
+#*
+#* Input: Box- Entry,Flags, Text fuer Anzeige, Schrift
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+SvLBoxColorString::SvLBoxColorString( SvLBoxEntry*pEntry,sal_uInt16 nFlags,const XubString& rStr,
+ const Color& rCol)
+
+: SvLBoxString( pEntry, nFlags, rStr )
+{
+ DBG_CTOR(SvLBoxColorString,0);
+ aPrivColor=rCol;
+ SetText( pEntry, rStr );
+}
+
+/*************************************************************************
+#* Member: SvLBoxColorString Datum:23.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvLBoxColorString
+#*
+#* Funktion: Default Konstruktor der Klasse SvLBoxColorString
+#*
+#* Input: ---
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+SvLBoxColorString::SvLBoxColorString()
+: SvLBoxString()
+{
+ DBG_CTOR(SvLBoxColorString,0);
+}
+
+/*************************************************************************
+#* Member: ~SvLBoxColorString Datum:23.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvLBoxColorString
+#*
+#* Funktion: Destruktor der Klasse SvLBoxColorString
+#*
+#* Input: ---
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+SvLBoxColorString::~SvLBoxColorString()
+{
+ DBG_DTOR(SvLBoxColorString,0);
+}
+
+
+/*************************************************************************
+#* Member: SvLBoxColorString Datum:23.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvLBoxColorString
+#*
+#* Funktion: Erzeugt einen neuen SvLBoxColorString
+#*
+#* Input: ---
+#*
+#* Output: SvLBoxColorString
+#*
+#************************************************************************/
+
+SvLBoxItem* SvLBoxColorString::Create() const
+{
+ DBG_CHKTHIS(SvLBoxColorString,0);
+ return new SvLBoxColorString;
+}
+
+
+
+/*************************************************************************
+#* Member: SvLBoxColorString Datum:23.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvLBoxColorString
+#*
+#* Funktion: Zeichenroutine des SvLBoxColorString. Gezeichnet wird
+#* der entsprechende Text mit der eingestellten Farbe
+#* im Ausgabe- Device.
+#*
+#* Input: Position, Ausgabe- Device, Flag fuer Selection,
+#* Zeiger auf den Eintrag
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+void SvLBoxColorString::Paint( const Point& rPos, SvLBox& rDev,
+ sal_uInt16 nFlags, SvLBoxEntry* pEntry )
+{
+ Color aColor=rDev.GetTextColor();
+ Color a2Color=aColor;
+ if(!(nFlags & SVLISTENTRYFLAG_SELECTED))
+ {
+ rDev.SetTextColor(aPrivColor);
+ }
+ SvLBoxString::Paint(rPos,rDev,nFlags,pEntry );
+ rDev.SetTextColor(a2Color);
+}
+
+//============================================================================
+// class SvxRedlinTable
+//----------------------------------------------------------------------------
+
+SvxRedlinTable::SvxRedlinTable( Window* pParent,WinBits nBits ):
+ SvxSimpleTable(pParent,nBits )
+{
+ bAuthor=sal_False;
+ bDate=sal_False;
+ bIsCalc=sal_False;
+ bComment=sal_False;
+ nDatePos=WRITER_DATE;
+ pCommentSearcher=NULL;
+ SetNodeDefaultImages();
+}
+
+SvxRedlinTable::SvxRedlinTable( Window* pParent,const ResId& rResId):
+ SvxSimpleTable(pParent,rResId)
+{
+ bAuthor=sal_False;
+ bDate=sal_False;
+ bIsCalc=sal_False;
+ bComment=sal_False;
+ nDatePos=WRITER_DATE;
+ pCommentSearcher=NULL;
+ SetNodeDefaultImages();
+}
+
+SvxRedlinTable::~SvxRedlinTable()
+{
+ if(pCommentSearcher!=NULL)
+ delete pCommentSearcher;
+}
+
+StringCompare SvxRedlinTable::ColCompare(SvLBoxEntry* pLeft,SvLBoxEntry* pRight)
+{
+ StringCompare eCompare=COMPARE_EQUAL;
+
+ if(aColCompareLink.IsSet())
+ {
+ SvSortData aRedlinCompare;
+ aRedlinCompare.pLeft=pLeft;
+ aRedlinCompare.pRight=pRight;
+ eCompare=(StringCompare) aColCompareLink.Call(&aRedlinCompare);
+ }
+ else
+ {
+ if(nDatePos==GetSortedCol())
+ {
+ RedlinData *pLeftData=(RedlinData *)(pLeft->GetUserData());
+ RedlinData *pRightData=(RedlinData *)(pRight->GetUserData());
+
+ if(pLeftData!=NULL && pRightData!=NULL)
+ {
+ if(pLeftData->aDateTime < pRightData->aDateTime)
+ {
+ eCompare=COMPARE_LESS;
+ }
+ else if(pLeftData->aDateTime > pRightData->aDateTime)
+ {
+ eCompare=COMPARE_GREATER;
+ }
+ }
+ else
+ eCompare=SvxSimpleTable::ColCompare(pLeft,pRight);
+ }
+ else
+ {
+ eCompare=SvxSimpleTable::ColCompare(pLeft,pRight);
+ }
+
+ }
+
+ return eCompare;
+}
+void SvxRedlinTable::SetCalcView(sal_Bool bFlag)
+{
+ bIsCalc=bFlag;
+ if(bFlag)
+ {
+ nDatePos=CALC_DATE;
+ }
+ else
+ {
+ nDatePos=WRITER_DATE;
+ }
+}
+
+
+void SvxRedlinTable::UpdateFilterTest()
+{
+ Date aDateMax;
+ sal_uInt16 nYEAR=aDateMax.GetYear()+100;
+ aDateMax.SetYear(nYEAR);
+ Date aDateMin(1,1,1989);
+ Time aTMin(0);
+ Time aTMax(23,59,59);
+
+
+ DateTime aDTMin(aDateMin);
+ DateTime aDTMax(aDateMax);
+
+ switch(nDaTiMode)
+ {
+ case FLT_DATE_BEFORE:
+ aDaTiFilterFirst=aDTMin;
+ aDaTiFilterLast=aDaTiFirst;
+ break;
+ case FLT_DATE_SAVE:
+ case FLT_DATE_SINCE:
+ aDaTiFilterFirst=aDaTiFirst;
+ aDaTiFilterLast=aDTMax;
+ break;
+ case FLT_DATE_EQUAL:
+ aDaTiFilterFirst=aDaTiFirst;
+ aDaTiFilterLast=aDaTiFirst;
+ aDaTiFilterFirst.SetTime(aTMin.GetTime());
+ aDaTiFilterLast.SetTime(aTMax.GetTime());
+ break;
+ case FLT_DATE_NOTEQUAL:
+ aDaTiFilterFirst=aDaTiFirst;
+ aDaTiFilterLast=aDaTiFirst;
+ aDaTiFilterFirst.SetTime(aTMin.GetTime());
+ aDaTiFilterLast.SetTime(aTMax.GetTime());
+ break;
+ case FLT_DATE_BETWEEN:
+ aDaTiFilterFirst=aDaTiFirst;
+ aDaTiFilterLast=aDaTiLast;
+ break;
+ }
+}
+
+
+void SvxRedlinTable::SetFilterDate(sal_Bool bFlag)
+{
+ bDate=bFlag;
+}
+
+void SvxRedlinTable::SetDateTimeMode(sal_uInt16 nMode)
+{
+ nDaTiMode=nMode;
+}
+
+void SvxRedlinTable::SetFirstDate(const Date& aDate)
+{
+ aDaTiFirst.SetDate(aDate.GetDate());
+}
+
+void SvxRedlinTable::SetLastDate(const Date& aDate)
+{
+ aDaTiLast.SetDate(aDate.GetDate());
+}
+
+void SvxRedlinTable::SetFirstTime(const Time& aTime)
+{
+ aDaTiFirst.SetTime(aTime.GetTime());
+}
+
+void SvxRedlinTable::SetLastTime(const Time& aTime)
+{
+ aDaTiLast.SetTime(aTime.GetTime());
+}
+
+void SvxRedlinTable::SetFilterAuthor(sal_Bool bFlag)
+{
+ bAuthor=bFlag;
+}
+
+void SvxRedlinTable::SetAuthor(const String &aString)
+{
+ aAuthor=aString;
+}
+
+void SvxRedlinTable::SetFilterComment(sal_Bool bFlag)
+{
+ bComment=bFlag;
+}
+
+void SvxRedlinTable::SetCommentParams( const utl::SearchParam* pSearchPara )
+{
+ if(pSearchPara!=NULL)
+ {
+ if(pCommentSearcher!=NULL) delete pCommentSearcher;
+
+ pCommentSearcher=new utl::TextSearch(*pSearchPara, LANGUAGE_SYSTEM );
+ }
+}
+
+sal_Bool SvxRedlinTable::IsValidWriterEntry(const String& rString,RedlinData *pUserData)
+{
+ sal_Bool nTheFlag=sal_True;
+ String aString=rString.GetToken(WRITER_AUTHOR,'\t');
+ if(pUserData==NULL)
+ {
+ if(bAuthor)
+ {
+ if(aAuthor.CompareTo(aString)==COMPARE_EQUAL)
+ nTheFlag=sal_True;
+ else
+ nTheFlag=sal_False;
+ }
+ }
+ else
+ {
+ DateTime aDateTime=pUserData->aDateTime;
+ nTheFlag=IsValidEntry(&aString,&aDateTime);
+ }
+ return nTheFlag;
+}
+
+sal_Bool SvxRedlinTable::IsValidCalcEntry(const String& rString,RedlinData *pUserData)
+{
+ sal_Bool nTheFlag=sal_True;
+ String aString=rString.GetToken(CALC_AUTHOR,'\t');
+ if(pUserData==NULL)
+ {
+ if(bAuthor)
+ {
+ if(aAuthor.CompareTo(aString)==COMPARE_EQUAL)
+ nTheFlag=sal_True;
+ else
+ nTheFlag=sal_False;
+ }
+ }
+ else
+ {
+ DateTime aDateTime=pUserData->aDateTime;
+ nTheFlag=IsValidEntry(&aString,&aDateTime);
+ }
+ return nTheFlag;
+}
+
+sal_Bool SvxRedlinTable::IsValidEntry(const String* pAuthorStr,
+ const DateTime *pDateTime,const String* pCommentStr)
+{
+ bool nTheFlag=true;
+ if(bAuthor)
+ {
+ nTheFlag = aAuthor.CompareTo(*pAuthorStr)==COMPARE_EQUAL;
+ }
+ if(bDate && nTheFlag)
+ {
+ if(nDaTiMode!=FLT_DATE_NOTEQUAL)
+ {
+ nTheFlag=pDateTime->IsBetween(aDaTiFilterFirst,aDaTiFilterLast);
+ }
+ else
+ {
+ nTheFlag=!(pDateTime->IsBetween(aDaTiFilterFirst,aDaTiFilterLast));
+ }
+ }
+ if(bComment && nTheFlag)
+ {
+ xub_StrLen nStartPos = 0;
+ xub_StrLen nEndPos = pCommentStr->Len();
+
+ nTheFlag=pCommentSearcher->SearchFrwrd( *pCommentStr, &nStartPos, &nEndPos);
+ }
+ return nTheFlag;
+}
+
+sal_Bool SvxRedlinTable::IsValidEntry(const String* pAuthorStr,const DateTime *pDateTime)
+{
+ sal_Bool nTheFlag=sal_True;
+ if(bAuthor)
+ {
+ if(aAuthor.CompareTo(*pAuthorStr)==COMPARE_EQUAL)
+ nTheFlag=sal_True;
+ else
+ nTheFlag=sal_False;
+ }
+ if(bDate && nTheFlag)
+ {
+ if(nDaTiMode!=FLT_DATE_NOTEQUAL)
+ {
+ nTheFlag=pDateTime->IsBetween(aDaTiFilterFirst,aDaTiFilterLast);
+ }
+ else
+ {
+ nTheFlag=!(pDateTime->IsBetween(aDaTiFilterFirst,aDaTiFilterLast));
+ }
+ }
+ return nTheFlag;
+}
+
+sal_Bool SvxRedlinTable::IsValidComment(const String* pCommentStr)
+{
+ bool nTheFlag=true;
+
+ if(bComment)
+ {
+ xub_StrLen nStartPos = 0;
+ xub_StrLen nEndPos = pCommentStr->Len();
+
+ nTheFlag=pCommentSearcher->SearchFrwrd( *pCommentStr, &nStartPos, &nEndPos);
+ }
+ return nTheFlag;
+}
+
+SvLBoxEntry* SvxRedlinTable::InsertEntry(const String& rStr,RedlinData *pUserData,
+ SvLBoxEntry* pParent,sal_uIntPtr nPos)
+{
+ aEntryColor=GetTextColor();
+ if(pUserData!=NULL)
+ {
+ if(pUserData->bDisabled)
+ aEntryColor=Color(COL_GRAY);
+ }
+
+ XubString aStr= rStr;
+
+ XubString aFirstStr( aStr );
+ xub_StrLen nEnd = aFirstStr.Search( sal_Unicode( '\t' ) );
+ if( nEnd != STRING_NOTFOUND )
+ {
+ aFirstStr.Erase( nEnd );
+ aCurEntry = aStr;
+ aCurEntry.Erase( 0, ++nEnd );
+ }
+ else
+ aCurEntry.Erase();
+
+ return SvTreeListBox::InsertEntry( aFirstStr, pParent, sal_False, nPos, pUserData );
+
+}
+
+SvLBoxEntry* SvxRedlinTable::InsertEntry(const String& rStr,RedlinData *pUserData,const Color& aColor,
+ SvLBoxEntry* pParent,sal_uIntPtr nPos)
+{
+ aEntryColor=aColor;
+
+ XubString aStr= rStr;
+
+ XubString aFirstStr( aStr );
+ xub_StrLen nEnd = aFirstStr.Search( sal_Unicode ( '\t' ) );
+ if( nEnd != STRING_NOTFOUND )
+ {
+ aFirstStr.Erase( nEnd );
+ aCurEntry = aStr;
+ aCurEntry.Erase( 0, ++nEnd );
+ }
+ else
+ aCurEntry.Erase();
+
+ return SvTreeListBox::InsertEntry( aFirstStr, pParent, sal_False, nPos, pUserData );
+}
+
+SvLBoxEntry* SvxRedlinTable::CreateEntry() const
+{
+ return new SvxRedlinEntry;
+}
+
+void SvxRedlinTable::InitEntry( SvLBoxEntry* pEntry, const XubString& rStr,
+ const Image& rColl, const Image& rExp, SvLBoxButtonKind eButtonKind )
+{
+ SvLBoxButton* pButton;
+ SvLBoxString* pString;
+ SvLBoxContextBmp* pContextBmp;
+
+ if( nTreeFlags & TREEFLAG_CHKBTN )
+ {
+ pButton= new SvLBoxButton( pEntry,eButtonKind,0,pCheckButtonData );
+ pEntry->AddItem( pButton );
+ }
+
+ pContextBmp= new SvLBoxContextBmp( pEntry,0, rColl,rExp,
+ SVLISTENTRYFLAG_EXPANDED);
+ pEntry->AddItem( pContextBmp );
+
+ pString = new SvLBoxColorString( pEntry, 0, rStr ,aEntryColor);
+ pEntry->AddItem( pString );
+
+ XubString aToken;
+
+ xub_Unicode* pCurToken = (xub_Unicode*)aCurEntry.GetBuffer();
+ sal_uInt16 nCurTokenLen;
+ xub_Unicode* pNextToken = (xub_Unicode*)GetToken( pCurToken, nCurTokenLen );
+ sal_uInt16 nCount = TabCount(); nCount--;
+
+ for( sal_uInt16 nToken = 0; nToken < nCount; nToken++ )
+ {
+ if( pCurToken && nCurTokenLen )
+ // aToken.Assign( pCurToken, nCurTokenLen );
+ aToken = XubString( pCurToken, nCurTokenLen );
+ else
+ aToken.Erase();
+
+ SvLBoxColorString* pStr = new SvLBoxColorString( pEntry, 0, aToken ,aEntryColor);
+ pEntry->AddItem( pStr );
+
+ pCurToken = pNextToken;
+ if( pCurToken )
+ pNextToken = (xub_Unicode*)GetToken( pCurToken, nCurTokenLen );
+ else
+ nCurTokenLen = 0;
+ }
+}
+
+
+
+
+//============================================================================
+// class SvxTPView
+//----------------------------------------------------------------------------
+
+SvxTPView::SvxTPView( Window * pParent)
+ : TabPage( pParent, SVX_RES(SID_REDLIN_VIEW_PAGE)),
+ aViewData ( this, SVX_RES( DG_VIEW) ),
+ PbAccept ( this, SVX_RES(PB_ACCEPT ) ),
+ PbReject ( this, SVX_RES(PB_REJECT ) ),
+ PbAcceptAll ( this, SVX_RES(PB_ACCEPTALL ) ),
+ PbRejectAll ( this, SVX_RES(PB_REJECTALL ) ),
+ PbUndo ( this, SVX_RES(PB_UNDO ) ),
+ aTitle1 ( SVX_RES( STR_TITLE1 ) ), // lokale Resource
+ aTitle2 ( SVX_RES( STR_TITLE2 ) ),
+ aTitle3 ( SVX_RES( STR_TITLE3 ) ),
+ aTitle4 ( SVX_RES( STR_TITLE4 ) ),
+ aTitle5 ( SVX_RES( STR_TITLE5 ) ),
+ aStrMyName ( SVX_RES( STR_VIEW) )
+{
+ FreeResource();
+
+ aViewData.SetHelpId(HID_REDLINING_VIEW_DG_VIEW_TABLE);
+ aViewData.SetHeaderBarHelpId(HID_REDLINING_VIEW_DG_VIEW_HEADER);
+
+ aMinSize=GetSizePixel();
+
+ Link aLink=LINK( this, SvxTPView, PbClickHdl);
+
+ PbAccept.SetClickHdl(aLink);
+ PbAcceptAll.SetClickHdl(aLink);
+ PbReject.SetClickHdl(aLink);
+ PbRejectAll.SetClickHdl(aLink);
+ PbUndo.SetClickHdl(aLink);
+
+ nDistance=PbAccept.GetSizePixel().Height()+2*MIN_DISTANCE;
+ aViewData.SetTabs(nStaticTabs);
+}
+
+String SvxTPView::GetMyName() const
+{
+ return aStrMyName;
+}
+
+void SvxTPView::Resize()
+{
+ Size aSize=GetOutputSizePixel();
+ Point aPos=aViewData.GetPosPixel();
+ aSize.Height()-=aPos.Y()+nDistance;
+ aSize.Width()-=2*aPos.X();
+
+ long newY=aPos.Y()+aSize.Height()+MIN_DISTANCE;
+ aPos=PbAccept.GetPosPixel();
+ aPos.Y()=newY;
+ PbAccept.SetPosPixel(aPos);
+ aPos=PbAcceptAll.GetPosPixel();
+ aPos.Y()=newY;
+ PbAcceptAll.SetPosPixel(aPos);
+ aPos=PbReject.GetPosPixel();
+ aPos.Y()=newY;
+ PbReject.SetPosPixel(aPos);
+ aPos=PbRejectAll.GetPosPixel();
+ aPos.Y()=newY;
+ PbRejectAll.SetPosPixel(aPos);
+
+ if(PbUndo.IsVisible())
+ {
+ aPos=PbUndo.GetPosPixel();
+ aPos.Y()=newY;
+ PbUndo.SetPosPixel(aPos);
+ }
+ aViewData.SetSizePixel(aSize);
+}
+
+void SvxTPView::InsertWriterHeader()
+{
+ String aStrTab(sal_Unicode('\t'));
+ String aString(aTitle1);
+ aString+=aStrTab;
+ aString+=aTitle3;
+ aString+=aStrTab;
+ aString+=aTitle4;
+ aString+=aStrTab;
+ aString+=aTitle5;
+ aViewData.ClearHeader();
+ aViewData.InsertHeaderEntry(aString);
+}
+
+void SvxTPView::InsertCalcHeader()
+{
+ String aStrTab(sal_Unicode('\t'));
+ String aString(aTitle1);
+ aString+=aStrTab;
+ aString+=aTitle2;
+ aString+=aStrTab;
+ aString+=aTitle3;
+ aString+=aStrTab;
+ aString+=aTitle4;
+ aString+=aStrTab;
+ aString+=aTitle5;
+ aViewData.ClearHeader();
+ aViewData.InsertHeaderEntry(aString);
+}
+
+void SvxTPView::EnableAccept(sal_Bool nFlag)
+{
+ PbAccept.Enable(nFlag);
+}
+
+void SvxTPView::EnableAcceptAll(sal_Bool nFlag)
+{
+ PbAcceptAll.Enable(nFlag);
+}
+
+void SvxTPView::EnableReject(sal_Bool nFlag)
+{
+ PbReject.Enable(nFlag);
+}
+
+void SvxTPView::EnableRejectAll(sal_Bool nFlag)
+{
+ PbRejectAll.Enable(nFlag);
+}
+
+void SvxTPView::ShowUndo(sal_Bool nFlag)
+{
+ PbUndo.Show(nFlag);
+}
+
+void SvxTPView::EnableUndo(sal_Bool nFlag)
+{
+ PbUndo.Enable(nFlag);
+}
+
+Size SvxTPView::GetMinSizePixel()
+{
+ Size aSize=aMinSize;
+ if(PbUndo.IsVisible())
+ {
+ sal_uIntPtr nSize=PbUndo.GetSizePixel().Width()
+ +PbUndo.GetPosPixel().X()
+ +PbAccept.GetPosPixel().X();
+
+ aSize.Width()=nSize;
+ }
+
+ return aSize;
+}
+
+
+SvxRedlinTable* SvxTPView::GetTableControl()
+{
+ return &aViewData;
+}
+
+IMPL_LINK( SvxTPView, PbClickHdl, PushButton*, pPushB )
+{
+ if(pPushB==&PbAccept)
+ {
+ AcceptClickLk.Call(this);
+ }
+ else if(pPushB==&PbAcceptAll)
+ {
+ AcceptAllClickLk.Call(this);
+ }
+ else if(pPushB==&PbReject)
+ {
+ RejectClickLk.Call(this);
+ }
+ else if(pPushB==&PbRejectAll)
+ {
+ RejectAllClickLk.Call(this);
+ }
+ else if(pPushB==&PbUndo)
+ {
+ UndoClickLk.Call(this);
+ }
+
+ return 0;
+}
+
+
+
+
+//============================================================================
+// class SvxTPFilter
+//----------------------------------------------------------------------------
+
+SvxTPFilter::SvxTPFilter( Window * pParent)
+ : TabPage( pParent, SVX_RES(SID_REDLIN_FILTER_PAGE)),
+ pRedlinTable(NULL),
+ aCbDate ( this, SVX_RES( CB_DATE ) ),
+ aLbDate ( this, SVX_RES( LB_DATE ) ),
+ aDfDate ( this, SVX_RES( DF_DATE ) ),
+ aTfDate ( this, SVX_RES( TF_DATE ) ),
+ aIbClock ( this, SVX_RES( IB_CLOCK ) ),
+ aFtDate2 ( this, SVX_RES( FT_DATE2 ) ),
+ aDfDate2 ( this, SVX_RES( DF_DATE2 ) ),
+ aTfDate2 ( this, SVX_RES( TF_DATE2 ) ),
+ aIbClock2 ( this, SVX_RES( IB_CLOCK2) ),
+ aCbAuthor ( this, SVX_RES( CB_AUTOR ) ),
+ aLbAuthor ( this, SVX_RES( LB_AUTOR ) ),
+ aCbRange ( this, SVX_RES( CB_RANGE ) ),
+ aEdRange ( this, SVX_RES( ED_RANGE ) ),
+ aBtnRange ( this, SVX_RES( BTN_REF ) ),
+ aLbAction ( this, SVX_RES( LB_ACTION ) ),
+ aCbComment ( this, SVX_RES( CB_COMMENT) ),
+ aEdComment ( this, SVX_RES( ED_COMMENT) ),
+ aActionStr ( SVX_RES( STR_ACTION) ),
+ aStrMyName ( SVX_RES( STR_FILTER) ),
+ bModified (sal_False)
+{
+ Image aImgTimeHC( SVX_RES( IMG_TIME_H ) );
+ FreeResource();
+
+ aIbClock.SetModeImage( aImgTimeHC, BMP_COLOR_HIGHCONTRAST );
+ aIbClock2.SetModeImage( aImgTimeHC, BMP_COLOR_HIGHCONTRAST );
+
+ aDfDate.SetShowDateCentury( sal_True );
+ aDfDate2.SetShowDateCentury( sal_True );
+
+ aRangeStr=aCbRange.GetText();
+ aLbDate.SelectEntryPos(0);
+ aLbDate.SetSelectHdl( LINK( this, SvxTPFilter, SelDateHdl ) );
+ aIbClock.SetClickHdl( LINK( this, SvxTPFilter, TimeHdl) );
+ aIbClock2.SetClickHdl( LINK( this, SvxTPFilter,TimeHdl) );
+ aBtnRange.SetClickHdl( LINK( this, SvxTPFilter, RefHandle));
+
+ Link aLink=LINK( this, SvxTPFilter, RowEnableHdl) ;
+ aCbDate.SetClickHdl(aLink);
+ aCbAuthor.SetClickHdl(aLink);
+ aCbRange.SetClickHdl(aLink);
+ aCbComment.SetClickHdl(aLink);
+
+ Link a2Link=LINK( this, SvxTPFilter, ModifyDate);
+ aDfDate.SetModifyHdl(a2Link);
+ aTfDate.SetModifyHdl(a2Link);
+ aDfDate2.SetModifyHdl(a2Link);
+ aTfDate2.SetModifyHdl(a2Link);
+
+ Link a3Link=LINK( this, SvxTPFilter, ModifyHdl);
+ aEdRange.SetModifyHdl(a3Link);
+ aEdComment.SetModifyHdl(a3Link);
+ aLbAction.SetSelectHdl(a3Link);
+ aLbAuthor.SetSelectHdl(a3Link);
+
+ RowEnableHdl(&aCbDate);
+ RowEnableHdl(&aCbAuthor);
+ RowEnableHdl(&aCbRange);
+ RowEnableHdl(&aCbComment);
+
+ Date aDate;
+ Time aTime;
+ aDfDate.SetDate(aDate);
+ aTfDate.SetTime(aTime);
+ aDfDate2.SetDate(aDate);
+ aTfDate2.SetTime(aTime);
+ HideRange();
+ ShowAction();
+ bModified=sal_False;
+}
+
+void SvxTPFilter::SetRedlinTable(SvxRedlinTable* pTable)
+{
+ pRedlinTable=pTable;
+}
+
+String SvxTPFilter::GetMyName() const
+{
+ return aStrMyName;
+}
+
+void SvxTPFilter::DisableRange(sal_Bool bFlag)
+{
+ if(bFlag)
+ {
+ aCbRange.Disable();
+ aEdRange.Disable();
+ aBtnRange.Disable();
+ }
+ else
+ {
+ aCbRange.Enable();
+ aEdRange.Enable();
+ aBtnRange.Enable();
+ }
+}
+
+void SvxTPFilter::ShowDateFields(sal_uInt16 nKind)
+{
+ String aEmpty;
+ switch(nKind)
+ {
+ case FLT_DATE_BEFORE:
+ EnableDateLine1(sal_True);
+ EnableDateLine2(sal_False);
+ break;
+ case FLT_DATE_SINCE:
+ EnableDateLine1(sal_True);
+ EnableDateLine2(sal_False);
+ break;
+ case FLT_DATE_EQUAL:
+ EnableDateLine1(sal_True);
+ aTfDate.Disable();
+ aTfDate.SetText(aEmpty);
+ EnableDateLine2(sal_False);
+ break;
+ case FLT_DATE_NOTEQUAL:
+ EnableDateLine1(sal_True);
+ aTfDate.Disable();
+ aTfDate.SetText(aEmpty);
+ EnableDateLine2(sal_False);
+ break;
+ case FLT_DATE_BETWEEN:
+ EnableDateLine1(sal_True);
+ EnableDateLine2(sal_True);
+ break;
+ case FLT_DATE_SAVE:
+ EnableDateLine1(sal_False);
+ EnableDateLine2(sal_False);
+ break;
+ }
+}
+
+void SvxTPFilter::EnableDateLine1(sal_Bool bFlag)
+{
+ if(bFlag && aCbDate.IsChecked())
+ {
+ aDfDate.Enable();
+ aTfDate.Enable();
+ aIbClock.Enable();
+ }
+ else
+ {
+ aDfDate.Disable();
+ aTfDate.Disable();
+ aIbClock.Disable();
+ }
+}
+void SvxTPFilter::EnableDateLine2(sal_Bool bFlag)
+{
+ String aEmpty;
+ if(bFlag && aCbDate.IsChecked())
+ {
+ aFtDate2.Enable();
+ aDfDate2.Enable();
+ aTfDate2.Enable();
+ aIbClock2.Enable();
+ }
+ else
+ {
+ aFtDate2.Disable();
+ aDfDate2.Disable();
+ aDfDate2.SetText(aEmpty);
+ aTfDate2.Disable();
+ aTfDate2.SetText(aEmpty);
+ aIbClock2.Disable();
+ }
+}
+
+Date SvxTPFilter::GetFirstDate() const
+{
+ return aDfDate.GetDate();
+}
+
+void SvxTPFilter::SetFirstDate(const Date &aDate)
+{
+ aDfDate.SetDate(aDate);
+}
+
+Time SvxTPFilter::GetFirstTime() const
+{
+ return aTfDate.GetTime();
+}
+
+void SvxTPFilter::SetFirstTime(const Time &aTime)
+{
+ aTfDate.SetTime(aTime);
+}
+
+
+Date SvxTPFilter::GetLastDate() const
+{
+ return aDfDate2.GetDate();
+}
+
+void SvxTPFilter::SetLastDate(const Date &aDate)
+{
+ aDfDate2.SetDate(aDate);
+}
+
+Time SvxTPFilter::GetLastTime() const
+{
+ return aTfDate2.GetTime();
+}
+
+void SvxTPFilter::SetLastTime(const Time &aTime)
+{
+ aTfDate2.SetTime(aTime);
+}
+
+void SvxTPFilter::SetDateMode(sal_uInt16 nMode)
+{
+ aLbDate.SelectEntryPos(nMode);
+ SelDateHdl(&aLbDate);
+}
+
+sal_uInt16 SvxTPFilter::GetDateMode()
+{
+ return (sal_uInt16) aLbDate.GetSelectEntryPos();
+}
+void SvxTPFilter::ClearAuthors()
+{
+ aLbAuthor.Clear();
+}
+
+void SvxTPFilter::InsertAuthor( const String& rString, sal_uInt16 nPos)
+{
+ aLbAuthor.InsertEntry(rString,nPos);
+}
+
+String SvxTPFilter::GetSelectedAuthor() const
+{
+ return aLbAuthor.GetSelectEntry();
+}
+
+sal_uInt16 SvxTPFilter::GetSelectedAuthorPos()
+{
+ return (sal_uInt16) aLbAuthor.GetSelectEntryPos();
+}
+
+void SvxTPFilter::SelectedAuthorPos(sal_uInt16 nPos)
+{
+ aLbAuthor.SelectEntryPos(nPos);
+}
+
+sal_uInt16 SvxTPFilter::SelectAuthor(const String& aString)
+{
+ aLbAuthor.SelectEntry(aString);
+ return aLbAuthor.GetSelectEntryPos();
+}
+
+void SvxTPFilter::SetRange(const String& rString)
+{
+ aEdRange.SetText(rString);
+}
+
+String SvxTPFilter::GetRange() const
+{
+ return aEdRange.GetText();
+}
+
+void SvxTPFilter::SetFocusToRange()
+{
+ aEdRange.GrabFocus();
+}
+
+void SvxTPFilter::HideRange(sal_Bool bHide)
+{
+ if(bHide)
+ {
+ aCbRange.Hide();
+ aEdRange.Hide();
+ aBtnRange.Hide();
+ }
+ else
+ {
+ ShowAction(sal_False);
+ aCbRange.SetText(aRangeStr);
+ aCbRange.Show();
+ aEdRange.Show();
+ aBtnRange.Show();
+ }
+}
+
+void SvxTPFilter::HideClocks(sal_Bool bHide)
+{
+ if(bHide)
+ {
+ aIbClock. Hide();
+ aIbClock2.Hide();
+ }
+ else
+ {
+ aIbClock. Show();
+ aIbClock2.Show();
+ }
+}
+
+void SvxTPFilter::SetComment(const String &rComment)
+{
+ aEdComment.SetText(rComment);
+}
+String SvxTPFilter::GetComment()const
+{
+ return aEdComment.GetText();
+}
+
+sal_Bool SvxTPFilter::IsDate()
+{
+ return aCbDate.IsChecked();
+}
+
+sal_Bool SvxTPFilter::IsAuthor()
+{
+ return aCbAuthor.IsChecked();
+}
+
+sal_Bool SvxTPFilter::IsRange()
+{
+ return aCbRange.IsChecked();
+}
+sal_Bool SvxTPFilter::IsAction()
+{
+ return aCbRange.IsChecked();
+}
+
+sal_Bool SvxTPFilter::IsComment()
+{
+ return aCbComment.IsChecked();
+}
+
+void SvxTPFilter::CheckDate(sal_Bool bFlag)
+{
+ aCbDate.Check(bFlag);
+ RowEnableHdl(&aCbDate);
+ bModified=sal_False;
+}
+
+void SvxTPFilter::CheckAuthor(sal_Bool bFlag)
+{
+ aCbAuthor.Check(bFlag);
+ RowEnableHdl(&aCbAuthor);
+ bModified=sal_False;
+}
+
+void SvxTPFilter::CheckRange(sal_Bool bFlag)
+{
+ aCbRange.Check(bFlag);
+ RowEnableHdl(&aCbRange);
+ bModified=sal_False;
+}
+
+void SvxTPFilter::CheckAction(sal_Bool bFlag)
+{
+ aCbRange.Check(bFlag);
+ RowEnableHdl(&aCbRange);
+ bModified=sal_False;
+}
+
+void SvxTPFilter::CheckComment(sal_Bool bFlag)
+{
+ aCbComment.Check(bFlag);
+ RowEnableHdl(&aCbComment);
+ bModified=sal_False;
+}
+
+void SvxTPFilter::ShowAction(sal_Bool bShow)
+{
+ if(!bShow)
+ {
+ aCbRange.Hide();
+ aLbAction.Hide();
+ aCbRange.SetHelpId(HID_REDLINING_FILTER_CB_RANGE);
+ }
+ else
+ {
+ HideRange();
+ aCbRange.SetText(aActionStr);
+ aCbRange.SetHelpId(HID_REDLINING_FILTER_CB_ACTION);
+ aCbRange.Show();
+ aLbAction.Show();
+
+ }
+}
+
+ListBox* SvxTPFilter::GetLbAction()
+{
+ return &aLbAction;
+}
+
+IMPL_LINK( SvxTPFilter, SelDateHdl, ListBox*, pLb )
+{
+ ShowDateFields((sal_uInt16)aLbDate.GetSelectEntryPos());
+ ModifyHdl(pLb);
+ return 0;
+}
+
+IMPL_LINK( SvxTPFilter, RowEnableHdl, CheckBox*, pCB )
+{
+ if(pCB==&aCbDate)
+ {
+ aLbDate.Enable(aCbDate.IsChecked());
+ aLbDate.Invalidate();
+ EnableDateLine1(sal_False);
+ EnableDateLine2(sal_False);
+ if(aCbDate.IsChecked()) SelDateHdl(&aLbDate);
+ }
+ else if(pCB==&aCbAuthor)
+ {
+ aLbAuthor.Enable(aCbAuthor.IsChecked());
+ aLbAuthor.Invalidate();
+ }
+ else if(pCB==&aCbRange)
+ {
+ aLbAction.Enable(aCbRange.IsChecked());
+ aLbAction.Invalidate();
+ aEdRange.Enable(aCbRange.IsChecked());
+ aBtnRange.Enable(aCbRange.IsChecked());
+ }
+ else if(pCB==&aCbComment)
+ {
+ aEdComment.Enable(aCbComment.IsChecked());
+ aEdComment.Invalidate();
+ }
+
+ ModifyHdl(pCB);
+ return 0;
+}
+
+IMPL_LINK( SvxTPFilter, TimeHdl, ImageButton*,pIB )
+{
+ Date aDate;
+ Time aTime;
+ if(pIB==&aIbClock)
+ {
+ aDfDate.SetDate(aDate);
+ aTfDate.SetTime(aTime);
+ }
+ else if(pIB==&aIbClock2)
+ {
+ aDfDate2.SetDate(aDate);
+ aTfDate2.SetTime(aTime);
+ }
+ ModifyHdl(&aDfDate);
+ return 0;
+}
+
+IMPL_LINK( SvxTPFilter, ModifyHdl, void*, pCtr)
+{
+ if(pCtr!=NULL)
+ {
+ if(pCtr==&aCbDate || pCtr==&aLbDate ||
+ pCtr==&aDfDate || pCtr==&aTfDate ||
+ pCtr==&aIbClock || pCtr==&aFtDate2||
+ pCtr==&aDfDate2 || pCtr==&aTfDate2||
+ pCtr==&aIbClock2)
+ {
+ aModifyDateLink.Call(this);
+ }
+ else if(pCtr==&aCbAuthor || pCtr==&aLbAuthor)
+ {
+ aModifyAuthorLink.Call(this);
+ }
+ else if(pCtr==&aCbRange || pCtr==&aEdRange ||
+ pCtr==&aBtnRange )
+ {
+ aModifyRefLink.Call(this);
+ }
+ else if(pCtr==&aCbComment || pCtr==&aEdComment)
+ {
+ aModifyComLink.Call(this);
+ }
+
+ bModified=sal_True;
+ aModifyLink.Call(this);
+ }
+ return 0;
+}
+
+void SvxTPFilter::DeactivatePage()
+{
+ if(bModified)
+ {
+ if(pRedlinTable!=NULL)
+ {
+ pRedlinTable->SetFilterDate(IsDate());
+ pRedlinTable->SetDateTimeMode(GetDateMode());
+ pRedlinTable->SetFirstDate(aDfDate.GetDate());
+ pRedlinTable->SetLastDate(aDfDate2.GetDate());
+ pRedlinTable->SetFirstTime(aTfDate.GetTime());
+ pRedlinTable->SetLastTime(aTfDate2.GetTime());
+ pRedlinTable->SetFilterAuthor(IsAuthor());
+ pRedlinTable->SetAuthor(GetSelectedAuthor());
+
+ pRedlinTable->SetFilterComment(IsComment());
+
+ utl::SearchParam aSearchParam( aEdComment.GetText(),
+ utl::SearchParam::SRCH_REGEXP,sal_False,sal_False,sal_False );
+
+ pRedlinTable->SetCommentParams(&aSearchParam);
+
+ pRedlinTable->UpdateFilterTest();
+ }
+
+ aReadyLink.Call(this);
+ }
+ bModified=sal_False;
+ TabPage::DeactivatePage();
+}
+
+void SvxTPFilter::Enable( bool bEnable, bool bChild)
+{
+ TabPage::Enable(bEnable,bChild);
+ if(aCbDate.IsEnabled())
+ {
+ RowEnableHdl(&aCbDate);
+ RowEnableHdl(&aCbAuthor);
+ RowEnableHdl(&aCbRange);
+ RowEnableHdl(&aCbComment);
+ }
+}
+void SvxTPFilter::Disable( bool bChild)
+{
+ Enable( false, bChild );
+}
+
+IMPL_LINK( SvxTPFilter, ModifyDate, void*,pTF)
+{
+
+ Date aDate;
+ Time aTime(0);
+ if(&aDfDate==pTF)
+ {
+ if(aDfDate.GetText().Len()==0)
+ aDfDate.SetDate(aDate);
+
+ if(pRedlinTable!=NULL)
+ pRedlinTable->SetFirstDate(aDfDate.GetDate());
+ }
+ else if(&aDfDate2==pTF)
+ {
+ if(aDfDate2.GetText().Len()==0)
+ aDfDate2.SetDate(aDate);
+
+ if(pRedlinTable!=NULL)
+ pRedlinTable->SetLastDate(aDfDate2.GetDate());
+ }
+ else if(&aTfDate==pTF)
+ {
+ if(aTfDate.GetText().Len()==0)
+ aTfDate.SetTime(aTime);
+
+ if(pRedlinTable!=NULL)
+ pRedlinTable->SetFirstTime(aTfDate.GetTime());
+ }
+ else if(&aTfDate2==pTF)
+ {
+ if(aTfDate2.GetText().Len()==0)
+ aTfDate2.SetTime(aTime);
+
+ if(pRedlinTable!=NULL)
+ pRedlinTable->SetLastTime(aTfDate2.GetTime());
+
+ }
+ ModifyHdl(&aDfDate);
+ return 0;
+}
+
+IMPL_LINK( SvxTPFilter, RefHandle, PushButton*, pRef )
+{
+ if(pRef!=NULL)
+ {
+ aRefLink.Call(this);
+ }
+ return 0;
+}
+
+static Size gDiffSize;
+//============================================================================
+// class SvxAcceptChgCtr
+//----------------------------------------------------------------------------
+
+SvxAcceptChgCtr::SvxAcceptChgCtr( Window* pParent, WinBits nWinStyle)
+ : Control(pParent,nWinStyle |WB_DIALOGCONTROL),
+ aTCAccept(this,WB_TABSTOP |WB_DIALOGCONTROL)
+{
+ pTPFilter=new SvxTPFilter(&aTCAccept);
+ pTPView=new SvxTPView(&aTCAccept);
+ aMinSize=pTPView->GetMinSizePixel();
+
+ aTCAccept.InsertPage( TP_VIEW, pTPView->GetMyName());
+ aTCAccept.InsertPage( TP_FILTER, pTPFilter->GetMyName());
+ aTCAccept.SetTabPage( TP_VIEW, pTPView);
+ aTCAccept.SetTabPage( TP_FILTER, pTPFilter);
+ aTCAccept.SetHelpId(HID_REDLINING_TABCONTROL);
+
+ aTCAccept.SetTabPageSizePixel(aMinSize);
+ Size aSize=aTCAccept.GetSizePixel();
+
+ gDiffSize.Height()=aSize.Height()-aMinSize.Height();
+ gDiffSize.Width()=aSize.Width()-aMinSize.Width();
+
+
+ pTPFilter->SetRedlinTable(GetViewTable());
+
+ aTCAccept.Show();
+ ShowViewPage();
+}
+
+SvxAcceptChgCtr::SvxAcceptChgCtr( Window* pParent, const ResId& rResId )
+ : Control(pParent,rResId ),
+ aTCAccept(this,WB_TABSTOP |WB_DIALOGCONTROL)
+{
+ pTPFilter=new SvxTPFilter(&aTCAccept);
+ pTPView=new SvxTPView(&aTCAccept);
+ aMinSize=pTPView->GetMinSizePixel();
+
+ aTCAccept.InsertPage( TP_VIEW, pTPView->GetMyName());
+ aTCAccept.InsertPage( TP_FILTER, pTPFilter->GetMyName());
+ aTCAccept.SetTabPage( TP_VIEW, pTPView);
+ aTCAccept.SetTabPage( TP_FILTER, pTPFilter);
+ aTCAccept.SetHelpId(HID_REDLINING_TABCONTROL);
+
+ aTCAccept.SetTabPageSizePixel(aMinSize);
+ Size aSize=aTCAccept.GetSizePixel();
+
+ gDiffSize.Height()=aSize.Height()-aMinSize.Height();
+ gDiffSize.Width()=aSize.Width()-aMinSize.Width();
+
+
+ pTPFilter->SetRedlinTable(GetViewTable());
+ WinBits nWinStyle=GetStyle()|WB_DIALOGCONTROL;
+ SetStyle(nWinStyle);
+
+ aTCAccept.Show();
+ ShowViewPage();
+ Resize();
+}
+
+SvxAcceptChgCtr::~SvxAcceptChgCtr()
+{
+ delete pTPView;
+ delete pTPFilter;
+}
+
+void SvxAcceptChgCtr::Resize()
+{
+ aMinSize=pTPView->GetMinSizePixel();
+ Size aSize=GetOutputSizePixel();
+ sal_Bool bFlag=sal_False;
+
+ if(aMinSize.Height()>aSize.Height())
+ {
+ aSize.Height()=aMinSize.Height();
+ bFlag=sal_True;
+ }
+ if(aMinSize.Width()>aSize.Width())
+ {
+ aSize.Width()=aMinSize.Width();
+ bFlag=sal_True;
+ }
+
+ if(bFlag)
+ {
+ SetOutputSizePixel(aSize);
+ aMinSizeLink.Call(this);
+ }
+
+ aSize.Height()-=2;
+ aSize.Width()-=2;
+ aTCAccept.SetSizePixel(aSize);
+}
+
+Size SvxAcceptChgCtr::GetMinSizePixel() const
+{
+ Size aSize=pTPView->GetMinSizePixel();
+ aSize.Height()+=gDiffSize.Height();
+ aSize.Width()+=gDiffSize.Width();
+ return aSize;
+}
+
+void SvxAcceptChgCtr::ShowFilterPage()
+{
+ aTCAccept.SetCurPageId(TP_FILTER);
+}
+
+void SvxAcceptChgCtr::ShowViewPage()
+{
+ aTCAccept.SetCurPageId(TP_VIEW);
+}
+
+sal_Bool SvxAcceptChgCtr::IsFilterPageVisible()
+{
+ return (aTCAccept.GetCurPageId()==TP_FILTER);
+}
+
+sal_Bool SvxAcceptChgCtr::IsViewPageVisible()
+{
+ return (aTCAccept.GetCurPageId()==TP_VIEW);
+}
+
+SvxTPFilter* SvxAcceptChgCtr::GetFilterPage()
+{
+ return pTPFilter;
+}
+
+SvxTPView* SvxAcceptChgCtr::GetViewPage()
+{
+ return pTPView;
+}
+
+SvxRedlinTable* SvxAcceptChgCtr::GetViewTable()
+{
+ if(pTPView!=NULL)
+ {
+ return pTPView->GetTableControl();
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+
diff --git a/svx/source/dialog/ctredlin.hrc b/svx/source/dialog/ctredlin.hrc
new file mode 100644
index 000000000000..23cc504c0573
--- /dev/null
+++ b/svx/source/dialog/ctredlin.hrc
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svx/svxids.hrc> // ->SID_REDLIN_FILTER_PAGE
+ // ->SID_REDLIN_VIEW_PAGE
+
+#define TP_FILTER 11
+#define TP_VIEW 12
+
+#define LB_DATE 1
+#define DF_DATE 2
+#define TF_DATE 3
+#define LB_AUTOR 4
+#define ED_RANGE 5
+#define IB_CLOCK 6
+#define BTN_REF 7
+#define CB_DATE 8
+#define CB_AUTOR 9
+#define CB_RANGE 10
+#define FT_DATE2 12
+#define DF_DATE2 13
+#define TF_DATE2 14
+#define IB_CLOCK2 15
+#define STR_FILTER 16
+#define STR_ACTION 17
+#define LB_ACTION 18
+#define CB_COMMENT 19
+#define ED_COMMENT 20
+#define IMG_TIME_H 30
+
+#define HG_VIEW 1
+#define DG_VIEW 2
+#define PB_ACCEPT 3
+#define PB_ACCEPTALL 4
+#define PB_REJECT 5
+#define PB_REJECTALL 6
+#define PB_UNDO 7
+#define STR_VIEW 8
+
+#define STR_TITLE1 1
+#define STR_TITLE2 2
+#define STR_TITLE3 3
+#define STR_TITLE4 4
+#define STR_TITLE5 5
+//
+
diff --git a/svx/source/dialog/ctredlin.src b/svx/source/dialog/ctredlin.src
new file mode 100644
index 000000000000..e617607ebfad
--- /dev/null
+++ b/svx/source/dialog/ctredlin.src
@@ -0,0 +1,365 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ctredlin.hrc"
+#include "helpid.hrc"
+
+#define MASKCOLOR MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; } ;
+
+TabPage SID_REDLIN_FILTER_PAGE
+{
+ String STR_FILTER
+ {
+ Text [ en-US ] = "Filter" ;
+ };
+ HelpId = HID_REDLINING_FILTER_PAGE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 261 , 86 ) ;
+ Hide = TRUE ;
+ CheckBox CB_DATE
+ {
+ Pos = MAP_APPFONT ( 6 , 8 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ TabStop = TRUE ;
+ HelpId = HID_REDLINING_FILTER_CB_DATE ;
+ Text [ en-US ] = "~Date" ;
+ };
+ ListBox LB_DATE
+ {
+ HelpId = HID_REDLINING_FILTER_LB_DATE ;
+ Border = TRUE ;
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 6 ) ;
+ Size = MAP_APPFONT ( 78 , 99 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "earlier than" ; Default ; > ;
+ < "since" ; Default ; > ;
+ < "equal to " ; Default ; > ;
+ < "not equal to" ; Default ; > ;
+ < "between" ; Default ; > ;
+ < "since saving" ; Default ; > ;
+ };
+ };
+ DateField DF_DATE
+ {
+ HelpId = HID_REDLINING_FILTER_DF_DATE ;
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 144 , 6 ) ;
+ Size = MAP_APPFONT ( 57 , 12 ) ;
+ TabStop = TRUE ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ Minimum = Date
+ {
+ Year = 1985 ;
+ Month = 12 ;
+ Day = 31 ;
+ };
+ Maximum = Date
+ {
+ Year = 2050 ;
+ Month = 12 ;
+ Day = 31 ;
+ };
+ };
+ TimeField TF_DATE
+ {
+ HelpId = HID_REDLINING_FILTER_TF_DATE ;
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 203 , 6 ) ;
+ Size = MAP_APPFONT ( 35 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ };
+ ImageButton IB_CLOCK
+ {
+ HelpId = HID_REDLINING_FILTER_IB_CLOCK ;
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 240 , 5 ) ;
+ Size = MAP_APPFONT ( 13 , 15 ) ;
+ TabStop = TRUE ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "time.bmp" ; };
+ MASKCOLOR
+ };
+ QuickHelpText [ en-US ] = "Set Date/Time" ;
+ };
+ FixedText FT_DATE2
+ {
+ Pos = MAP_APPFONT ( 60 , 24 ) ;
+ Size = MAP_APPFONT ( 78 , 8 ) ;
+ Right = TRUE ;
+ Disable = TRUE ;
+ Text [ en-US ] = "and" ;
+ };
+ DateField DF_DATE2
+ {
+ HelpId = HID_REDLINING_FILTER_DF_DATE2 ;
+ Border = TRUE ;
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 144 , 22 ) ;
+ Size = MAP_APPFONT ( 57 , 12 ) ;
+ TabStop = TRUE ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ Minimum = Date
+ {
+ Year = 1985 ;
+ Month = 12 ;
+ Day = 31 ;
+ };
+ Maximum = Date
+ {
+ Year = 2050 ;
+ Month = 12 ;
+ Day = 31 ;
+ };
+ };
+ TimeField TF_DATE2
+ {
+ HelpId = HID_REDLINING_FILTER_TF_DATE2 ;
+ Border = TRUE ;
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 203 , 22 ) ;
+ Size = MAP_APPFONT ( 35 , 12 ) ;
+ TabStop = TRUE ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ };
+ ImageButton IB_CLOCK2
+ {
+ HelpId = HID_REDLINING_FILTER_IB_CLOCK2 ;
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 240 , 21 ) ;
+ Size = MAP_APPFONT ( 13 , 15 ) ;
+ TabStop = TRUE ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "time.bmp" ; };
+ MASKCOLOR
+ };
+ QuickHelpText [ en-US ] = "Set Date/Time" ;
+ };
+ CheckBox CB_AUTOR
+ {
+ HelpId = HID_REDLINING_FILTER_CB_AUTOR ;
+ Pos = MAP_APPFONT ( 6 , 40 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Author" ;
+ };
+ ListBox LB_AUTOR
+ {
+ HelpId = HID_REDLINING_FILTER_LB_AUTOR ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 38 ) ;
+ Size = MAP_APPFONT ( 178 , 100 ) ;
+ TabStop = TRUE ;
+ Disable = TRUE ;
+ DropDown = TRUE ;
+ };
+ CheckBox CB_RANGE
+ {
+ HelpId = HID_REDLINING_FILTER_CB_RANGE ;
+ Pos = MAP_APPFONT ( 6 , 56 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Range" ;
+ };
+ Edit ED_RANGE
+ {
+ HelpId = HID_REDLINING_FILTER_ED_RANGE ;
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 54 ) ;
+ Size = MAP_APPFONT ( 178 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ String STR_ACTION
+ {
+ Text [ en-US ] = "A~ction" ;
+ };
+ ListBox LB_ACTION
+ {
+ HelpId = HID_REDLINING_FILTER_LB_ACTION ;
+ Border = TRUE ;
+ Hide = TRUE ;
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 54 ) ;
+ Size = MAP_APPFONT ( 178 , 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ PushButton BTN_REF
+ {
+ HelpId = HID_REDLINING_FILTER_BTN_REF ;
+ Pos = MAP_APPFONT ( 240 , 54 ) ;
+ Size = MAP_APPFONT ( 12 , 12 ) ;
+ Disable = TRUE ;
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Set Reference" ;
+ Text [ en-US ] = "..." ;
+ };
+ CheckBox CB_COMMENT
+ {
+ HelpId = HID_REDLINING_FILTER_CB_COMMENT ;
+ Pos = MAP_APPFONT ( 6 , 72 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Comment";
+ };
+ Edit ED_COMMENT
+ {
+ HelpId = HID_REDLINING_FILTER_ED_COMMENT ;
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 70 ) ;
+ Size = MAP_APPFONT ( 178 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ Image IMG_TIME_H
+ {
+ ImageBitmap = Bitmap { File = "time_h.bmp" ; };
+ MASKCOLOR
+ };
+};
+TabPage SID_REDLIN_VIEW_PAGE
+{
+ HelpId = HID_REDLINING_VIEW_PAGE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 270 , 126 ) ;
+ Hide = TRUE ;
+ String STR_VIEW
+ {
+ Text [ en-US ] = "List" ;
+ };
+ Control DG_VIEW
+ {
+ HelpId = HID_REDLINING_VIEW_DG_VIEW ;
+ Pos = MAP_APPFONT ( 3 , 1 ) ;
+ Size = MAP_APPFONT ( 221 , 65 ) ;
+ Border = TRUE ;
+ };
+ PushButton PB_ACCEPT
+ {
+ HelpId = HID_REDLINING_VIEW_PB_ACCEPT ;
+ Pos = MAP_APPFONT ( 3 , 69 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "~Accept" ;
+ };
+ PushButton PB_REJECT
+ {
+ HelpId = HID_REDLINING_VIEW_PB_REJECT ;
+ Pos = MAP_APPFONT ( 69 , 69 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "~Reject" ;
+ };
+ PushButton PB_ACCEPTALL
+ {
+ HelpId = HID_REDLINING_VIEW_PB_ACCEPTALL ;
+ Pos = MAP_APPFONT ( 141 , 69 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "A~ccept All" ;
+ };
+ PushButton PB_REJECTALL
+ {
+ HelpId = HID_REDLINING_VIEW_PB_REJECTALL ;
+ Pos = MAP_APPFONT ( 207 , 69 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "R~eject All" ;
+ };
+
+ PushButton PB_UNDO
+ {
+ HelpId = HID_REDLINING_VIEW_PB_UNDO ;
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( 279 , 69 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "Undo";
+ };
+ String STR_TITLE1
+ {
+ Text [ en-US ] = "Action" ;
+ };
+ String STR_TITLE2
+ {
+ Text [ en-US ] = "Position" ;
+ };
+ String STR_TITLE3
+ {
+ Text [ en-US ] = "Author" ;
+ };
+ String STR_TITLE4
+ {
+ Text [ en-US ] = "Date" ;
+ };
+ String STR_TITLE5
+ {
+ Text [ en-US ] = "Comment" ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/dialog/databaseregistrationui.cxx b/svx/source/dialog/databaseregistrationui.cxx
new file mode 100644
index 000000000000..4a4088c47253
--- /dev/null
+++ b/svx/source/dialog/databaseregistrationui.cxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// === includes (declaration) ============================================
+#include "svx/databaseregistrationui.hxx"
+
+// === includes (UNO) ====================================================
+// === /includes (UNO) ===================================================
+
+// === includes (project) ================================================
+#include <svx/svxdlg.hxx>
+#ifndef _SVX_DIALOGS_HRC
+#include <svx/dialogs.hrc>
+#endif
+//#include "connpooloptions.hxx"
+// === /includes (project) ===============================================
+
+// === includes (global) =================================================
+#include <sfx2/app.hxx>
+#include <svl/itemset.hxx>
+#include <vcl/msgbox.hxx>
+// === /includes (global) ================================================
+
+namespace svx
+{
+ sal_uInt16 administrateDatabaseRegistration( Window* _parentWindow )
+ {
+ sal_uInt16 nResult = RET_CANCEL;
+
+ SfxItemSet aRegistrationItems( SFX_APP()->GetPool(), SID_SB_DB_REGISTER, SID_SB_DB_REGISTER, 0 );
+
+ SvxAbstractDialogFactory* pDialogFactory = SvxAbstractDialogFactory::Create();
+ ::std::auto_ptr< SfxAbstractDialog > pDialog;
+ if ( pDialogFactory )
+ pDialog.reset( pDialogFactory->CreateSfxDialog( _parentWindow, aRegistrationItems, NULL, RID_SFXPAGE_DBREGISTER ) );
+ if ( pDialog.get() )
+ nResult = pDialog->Execute();
+
+ return nResult;
+ }
+
+} // namespace svx
diff --git a/svx/source/dialog/dialcontrol.cxx b/svx/source/dialog/dialcontrol.cxx
new file mode 100644
index 000000000000..2e5501e589af
--- /dev/null
+++ b/svx/source/dialog/dialcontrol.cxx
@@ -0,0 +1,572 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "svx/dialcontrol.hxx"
+
+#include <math.h>
+#include <vcl/virdev.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/bitmap.hxx>
+#include <vcl/field.hxx>
+#include <svtools/colorcfg.hxx>
+
+namespace svx {
+
+// ============================================================================
+
+const long DIAL_OUTER_WIDTH = 8;
+
+// ============================================================================
+
+class DialControlBmp : public VirtualDevice
+{
+public:
+ explicit DialControlBmp( Window& rParent );
+
+ void InitBitmap( const Size& rSize, const Font& rFont );
+ void CopyBackground( const DialControlBmp& rSrc );
+ void DrawBackground( const Size& rSize, bool bEnabled );
+ void DrawElements( const String& rText, sal_Int32 nAngle );
+
+private:
+ const Color& GetBackgroundColor() const;
+ const Color& GetTextColor() const;
+ const Color& GetScaleLineColor() const;
+ const Color& GetButtonLineColor() const;
+ const Color& GetButtonFillColor( bool bMain ) const;
+
+ void Init( const Size& rSize );
+ void DrawBackground();
+
+ Window& mrParent;
+ Rectangle maRect;
+ long mnCenterX;
+ long mnCenterY;
+ bool mbEnabled;
+};
+
+// ----------------------------------------------------------------------------
+
+DialControlBmp::DialControlBmp( Window& rParent ) :
+ VirtualDevice( rParent, 0, 0 ),
+ mrParent( rParent ),
+ mbEnabled( true )
+{
+ EnableRTL( sal_False );
+}
+
+void DialControlBmp::InitBitmap( const Size& rSize, const Font& rFont )
+{
+ Init( rSize );
+ SetFont( rFont );
+}
+
+void DialControlBmp::CopyBackground( const DialControlBmp& rSrc )
+{
+ Init( rSrc.maRect.GetSize() );
+ mbEnabled = rSrc.mbEnabled;
+ Point aPos;
+ DrawBitmapEx( aPos, rSrc.GetBitmapEx( aPos, maRect.GetSize() ) );
+}
+
+void DialControlBmp::DrawBackground( const Size& rSize, bool bEnabled )
+{
+ Init( rSize );
+ mbEnabled = bEnabled;
+ DrawBackground();
+}
+
+void DialControlBmp::DrawElements( const String& rText, sal_Int32 nAngle )
+{
+ // *** rotated text ***
+
+ Font aFont( GetFont() );
+ aFont.SetColor( GetTextColor() );
+ aFont.SetOrientation( static_cast< short >( (nAngle + 5) / 10 ) ); // Font uses 1/10 degrees
+ aFont.SetWeight( WEIGHT_BOLD );
+ SetFont( aFont );
+
+ double fAngle = nAngle * F_PI180 / 100.0;
+ double fSin = sin( fAngle );
+ double fCos = cos( fAngle );
+ double fWidth = GetTextWidth( rText ) / 2.0;
+ double fHeight = GetTextHeight() / 2.0;
+ long nX = static_cast< long >( mnCenterX - fWidth * fCos - fHeight * fSin );
+ long nY = static_cast< long >( mnCenterY + fWidth * fSin - fHeight * fCos );
+ Rectangle aRect( nX, nY, 2 * mnCenterX - nX, 2 * mnCenterY - nY );
+ DrawText( aRect, rText, mbEnabled ? 0 : TEXT_DRAW_DISABLE );
+
+ // *** drag button ***
+
+ bool bMain = (nAngle % 4500) != 0;
+ SetLineColor( GetButtonLineColor() );
+ SetFillColor( GetButtonFillColor( bMain ) );
+
+ nX = mnCenterX - static_cast< long >( (DIAL_OUTER_WIDTH / 2 - mnCenterX) * fCos );
+ nY = mnCenterY - static_cast< long >( (mnCenterY - DIAL_OUTER_WIDTH / 2) * fSin );
+ long nSize = bMain ? (DIAL_OUTER_WIDTH / 4) : (DIAL_OUTER_WIDTH / 2 - 1);
+ DrawEllipse( Rectangle( nX - nSize, nY - nSize, nX + nSize, nY + nSize ) );
+}
+
+// private --------------------------------------------------------------------
+
+const Color& DialControlBmp::GetBackgroundColor() const
+{
+ return GetSettings().GetStyleSettings().GetDialogColor();
+}
+
+const Color& DialControlBmp::GetTextColor() const
+{
+ return GetSettings().GetStyleSettings().GetLabelTextColor();
+}
+
+const Color& DialControlBmp::GetScaleLineColor() const
+{
+ const StyleSettings& rSett = GetSettings().GetStyleSettings();
+ return mbEnabled ? rSett.GetButtonTextColor() : rSett.GetDisableColor();
+}
+
+const Color& DialControlBmp::GetButtonLineColor() const
+{
+ const StyleSettings& rSett = GetSettings().GetStyleSettings();
+ return mbEnabled ? rSett.GetButtonTextColor() : rSett.GetDisableColor();
+}
+
+const Color& DialControlBmp::GetButtonFillColor( bool bMain ) const
+{
+ const StyleSettings& rSett = GetSettings().GetStyleSettings();
+ return mbEnabled ? (bMain ? rSett.GetMenuColor() : rSett.GetHighlightColor()) : rSett.GetDisableColor();
+}
+
+void DialControlBmp::Init( const Size& rSize )
+{
+ SetSettings( mrParent.GetSettings() );
+ maRect.SetPos( Point( 0, 0 ) );
+ maRect.SetSize( rSize );
+ mnCenterX = rSize.Width() / 2;
+ mnCenterY = rSize.Height() / 2;
+ SetOutputSize( rSize );
+ SetBackground();
+}
+
+void DialControlBmp::DrawBackground()
+{
+ // *** background with 3D effect ***
+
+ SetLineColor();
+ SetFillColor();
+ Erase();
+
+ EnableRTL( sal_True ); // #107807# draw 3D effect in correct direction
+
+ sal_uInt8 nDiff = mbEnabled ? 0x18 : 0x10;
+ Color aColor;
+
+ aColor = GetBackgroundColor();
+ SetFillColor( aColor );
+ DrawPie( maRect, maRect.TopRight(), maRect.TopCenter() );
+ DrawPie( maRect, maRect.BottomLeft(), maRect.BottomCenter() );
+
+ aColor.DecreaseLuminance( nDiff );
+ SetFillColor( aColor );
+ DrawPie( maRect, maRect.BottomCenter(), maRect.TopRight() );
+
+ aColor.DecreaseLuminance( nDiff );
+ SetFillColor( aColor );
+ DrawPie( maRect, maRect.BottomRight(), maRect.RightCenter() );
+
+ aColor = GetBackgroundColor();
+ aColor.IncreaseLuminance( nDiff );
+ SetFillColor( aColor );
+ DrawPie( maRect, maRect.TopCenter(), maRect.BottomLeft() );
+
+ aColor.IncreaseLuminance( nDiff );
+ SetFillColor( aColor );
+ DrawPie( maRect, maRect.TopLeft(), maRect.LeftCenter() );
+
+ EnableRTL( sal_False );
+
+ // *** calibration ***
+
+ Point aStartPos( mnCenterX, mnCenterY );
+ Color aFullColor( GetScaleLineColor() );
+ Color aLightColor( GetBackgroundColor() );
+ aLightColor.Merge( aFullColor, 128 );
+
+ for( int nAngle = 0; nAngle < 360; nAngle += 15 )
+ {
+ SetLineColor( (nAngle % 45) ? aLightColor : aFullColor );
+ double fAngle = nAngle * F_PI180;
+ long nX = static_cast< long >( -mnCenterX * cos( fAngle ) );
+ long nY = static_cast< long >( mnCenterY * sin( fAngle ) );
+ DrawLine( aStartPos, Point( mnCenterX - nX, mnCenterY - nY ) );
+ }
+
+ // *** clear inner area ***
+
+ SetLineColor();
+ SetFillColor( GetBackgroundColor() );
+ DrawEllipse( Rectangle( maRect.Left() + DIAL_OUTER_WIDTH, maRect.Top() + DIAL_OUTER_WIDTH,
+ maRect.Right() - DIAL_OUTER_WIDTH, maRect.Bottom() - DIAL_OUTER_WIDTH ) );
+}
+
+// ============================================================================
+
+struct DialControl_Impl
+{
+ DialControlBmp maBmpEnabled;
+ DialControlBmp maBmpDisabled;
+ DialControlBmp maBmpBuffered;
+ Link maModifyHdl;
+ NumericField* mpLinkField;
+ Size maWinSize;
+ Font maWinFont;
+ sal_Int32 mnAngle;
+ sal_Int32 mnOldAngle;
+ long mnCenterX;
+ long mnCenterY;
+ bool mbNoRot;
+
+ explicit DialControl_Impl( Window& rParent );
+ void Init( const Size& rWinSize, const Font& rWinFont );
+};
+
+// ----------------------------------------------------------------------------
+
+DialControl_Impl::DialControl_Impl( Window& rParent ) :
+ maBmpEnabled( rParent ),
+ maBmpDisabled( rParent ),
+ maBmpBuffered( rParent ),
+ mpLinkField( 0 ),
+ mnAngle( 0 ),
+ mbNoRot( false )
+{
+}
+
+void DialControl_Impl::Init( const Size& rWinSize, const Font& rWinFont )
+{
+ // "(x - 1) | 1" creates odd value <= x, to have a well-defined center pixel position
+ maWinSize = Size( (rWinSize.Width() - 1) | 1, (rWinSize.Height() - 1) | 1 );
+ maWinFont = rWinFont;
+
+ mnCenterX = maWinSize.Width() / 2;
+ mnCenterY = maWinSize.Height() / 2;
+ maWinFont.SetTransparent( sal_True );
+
+ maBmpEnabled.DrawBackground( maWinSize, true );
+ maBmpDisabled.DrawBackground( maWinSize, false );
+ maBmpBuffered.InitBitmap( maWinSize, maWinFont );
+}
+
+// ============================================================================
+
+DialControl::DialControl( Window* pParent, const Size& rSize, const Font& rFont, WinBits nWinStyle ) :
+ Control( pParent, nWinStyle ),
+ mpImpl( new DialControl_Impl( *this ) )
+{
+ Init( rSize, rFont );
+}
+
+DialControl::DialControl( Window* pParent, const Size& rSize, WinBits nWinStyle ) :
+ Control( pParent, nWinStyle ),
+ mpImpl( new DialControl_Impl( *this ) )
+{
+ if( pParent )
+ Init( rSize, pParent->GetFont() );
+ else
+ Init( rSize );
+}
+
+DialControl::DialControl( Window* pParent, const ResId& rResId ) :
+ Control( pParent, rResId ),
+ mpImpl( new DialControl_Impl( *this ) )
+{
+ Init( GetOutputSizePixel() );
+}
+
+DialControl::~DialControl()
+{
+}
+
+void DialControl::Paint( const Rectangle& )
+{
+ Point aPos;
+ DrawBitmapEx( aPos, mpImpl->maBmpBuffered.GetBitmapEx( aPos, mpImpl->maWinSize ) );
+}
+
+void DialControl::StateChanged( StateChangedType nStateChange )
+{
+ if( nStateChange == STATE_CHANGE_ENABLE )
+ InvalidateControl();
+
+ // update the linked edit field
+ if( mpImpl->mpLinkField )
+ {
+ NumericField& rField = *mpImpl->mpLinkField;
+ switch( nStateChange )
+ {
+ case STATE_CHANGE_VISIBLE: rField.Show( IsVisible() ); break;
+ case STATE_CHANGE_ENABLE: rField.Enable( IsEnabled() ); break;
+ }
+ }
+
+ Control::StateChanged( nStateChange );
+}
+
+void DialControl::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ Init( mpImpl->maWinSize, mpImpl->maWinFont );
+ InvalidateControl();
+ }
+ Control::DataChanged( rDCEvt );
+}
+
+void DialControl::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if( rMEvt.IsLeft() )
+ {
+ GrabFocus();
+ CaptureMouse();
+ mpImpl->mnOldAngle = mpImpl->mnAngle;
+ HandleMouseEvent( rMEvt.GetPosPixel(), true );
+ }
+ Control::MouseButtonDown( rMEvt );
+}
+
+void DialControl::MouseMove( const MouseEvent& rMEvt )
+{
+ if( IsMouseCaptured() && rMEvt.IsLeft() )
+ HandleMouseEvent( rMEvt.GetPosPixel(), false );
+ Control::MouseMove(rMEvt );
+}
+
+void DialControl::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ if( IsMouseCaptured() )
+ {
+ ReleaseMouse();
+ if( mpImpl->mpLinkField )
+ mpImpl->mpLinkField->GrabFocus();
+ }
+ Control::MouseButtonUp( rMEvt );
+}
+
+void DialControl::KeyInput( const KeyEvent& rKEvt )
+{
+ const KeyCode& rKCode = rKEvt.GetKeyCode();
+ if( !rKCode.GetModifier() && (rKCode.GetCode() == KEY_ESCAPE) )
+ HandleEscapeEvent();
+ else
+ Control::KeyInput( rKEvt );
+}
+
+void DialControl::LoseFocus()
+{
+ // release captured mouse
+ HandleEscapeEvent();
+ Control::LoseFocus();
+}
+
+bool DialControl::HasRotation() const
+{
+ return !mpImpl->mbNoRot;
+}
+
+void DialControl::SetNoRotation()
+{
+ if( !mpImpl->mbNoRot )
+ {
+ mpImpl->mbNoRot = true;
+ InvalidateControl();
+ if( mpImpl->mpLinkField )
+ mpImpl->mpLinkField->SetText( String() );
+ }
+}
+
+sal_Int32 DialControl::GetRotation() const
+{
+ return mpImpl->mnAngle;
+}
+
+void DialControl::SetRotation( sal_Int32 nAngle )
+{
+ ImplSetRotation( nAngle, false );
+}
+
+void DialControl::SetLinkedField( NumericField* pField )
+{
+ // remove modify handler from old linked field
+ ImplSetFieldLink( Link() );
+ // remember the new linked field
+ mpImpl->mpLinkField = pField;
+ // set modify handler at new linked field
+ ImplSetFieldLink( LINK( this, DialControl, LinkedFieldModifyHdl ) );
+}
+
+NumericField* DialControl::GetLinkedField() const
+{
+ return mpImpl->mpLinkField;
+}
+
+void DialControl::SetModifyHdl( const Link& rLink )
+{
+ mpImpl->maModifyHdl = rLink;
+}
+
+const Link& DialControl::GetModifyHdl() const
+{
+ return mpImpl->maModifyHdl;
+}
+
+// private --------------------------------------------------------------------
+
+void DialControl::Init( const Size& rWinSize, const Font& rWinFont )
+{
+ mpImpl->Init( rWinSize, rWinFont );
+ EnableRTL( sal_False ); // #107807# don't mirror mouse handling
+ SetOutputSizePixel( mpImpl->maWinSize );
+ SetBackground();
+}
+
+void DialControl::Init( const Size& rWinSize )
+{
+ Font aFont( OutputDevice::GetDefaultFont(
+ DEFAULTFONT_UI_SANS, Application::GetSettings().GetUILanguage(), DEFAULTFONT_FLAGS_ONLYONE ) );
+ Init( rWinSize, aFont );
+}
+
+void DialControl::InvalidateControl()
+{
+ mpImpl->maBmpBuffered.CopyBackground( IsEnabled() ? mpImpl->maBmpEnabled : mpImpl->maBmpDisabled );
+ if( !mpImpl->mbNoRot )
+ mpImpl->maBmpBuffered.DrawElements( GetText(), mpImpl->mnAngle );
+ Invalidate();
+}
+
+void DialControl::ImplSetRotation( sal_Int32 nAngle, bool bBroadcast )
+{
+ bool bOldSel = mpImpl->mbNoRot;
+ mpImpl->mbNoRot = false;
+
+ while( nAngle < 0 ) nAngle += 36000;
+ nAngle = (((nAngle + 50) / 100) * 100) % 36000;
+ if( !bOldSel || (mpImpl->mnAngle != nAngle) )
+ {
+ mpImpl->mnAngle = nAngle;
+ InvalidateControl();
+ if( mpImpl->mpLinkField )
+ mpImpl->mpLinkField->SetValue( static_cast< long >( GetRotation() / 100 ) );
+ if( bBroadcast )
+ mpImpl->maModifyHdl.Call( this );
+ }
+}
+
+void DialControl::ImplSetFieldLink( const Link& rLink )
+{
+ if( mpImpl->mpLinkField )
+ {
+ NumericField& rField = *mpImpl->mpLinkField;
+ rField.SetModifyHdl( rLink );
+ rField.SetUpHdl( rLink );
+ rField.SetDownHdl( rLink );
+ rField.SetFirstHdl( rLink );
+ rField.SetLastHdl( rLink );
+ rField.SetLoseFocusHdl( rLink );
+ }
+}
+
+void DialControl::HandleMouseEvent( const Point& rPos, bool bInitial )
+{
+ long nX = rPos.X() - mpImpl->mnCenterX;
+ long nY = mpImpl->mnCenterY - rPos.Y();
+ double fH = sqrt( static_cast< double >( nX ) * nX + static_cast< double >( nY ) * nY );
+ if( fH != 0.0 )
+ {
+ double fAngle = acos( nX / fH );
+ sal_Int32 nAngle = static_cast< sal_Int32 >( fAngle / F_PI180 * 100.0 );
+ if( nY < 0 )
+ nAngle = 36000 - nAngle;
+ if( bInitial ) // round to entire 15 degrees
+ nAngle = ((nAngle + 750) / 1500) * 1500;
+ ImplSetRotation( nAngle, true );
+ }
+}
+
+void DialControl::HandleEscapeEvent()
+{
+ if( IsMouseCaptured() )
+ {
+ ReleaseMouse();
+ ImplSetRotation( mpImpl->mnOldAngle, true );
+ if( mpImpl->mpLinkField )
+ mpImpl->mpLinkField->GrabFocus();
+ }
+}
+
+IMPL_LINK( DialControl, LinkedFieldModifyHdl, NumericField*, pField )
+{
+ if( pField )
+ ImplSetRotation( static_cast< sal_Int32 >( pField->GetValue() * 100 ), false );
+ return 0;
+}
+
+// ============================================================================
+
+DialControlWrapper::DialControlWrapper( DialControl& rDial ) :
+ SingleControlWrapperType( rDial )
+{
+}
+
+bool DialControlWrapper::IsControlDontKnow() const
+{
+ return !GetControl().HasRotation();
+}
+
+void DialControlWrapper::SetControlDontKnow( bool bSet )
+{
+ if( bSet )
+ GetControl().SetNoRotation();
+}
+
+sal_Int32 DialControlWrapper::GetControlValue() const
+{
+ return GetControl().GetRotation();
+}
+
+void DialControlWrapper::SetControlValue( sal_Int32 nValue )
+{
+ GetControl().SetRotation( nValue );
+}
+
+// ============================================================================
+
+} // namespace svx
+
diff --git a/svx/source/dialog/dialmgr.cxx b/svx/source/dialog/dialmgr.cxx
new file mode 100644
index 000000000000..c8e057ee8502
--- /dev/null
+++ b/svx/source/dialog/dialmgr.cxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+//#ifdef SVX_DLLIMPLEMENTATION
+//#undef SVX_DLLIMPLEMENTATION
+//#endif
+
+// include ---------------------------------------------------------------
+
+#include <svx/dialmgr.hxx>
+#include <tools/rc.hxx>
+#include <svl/solar.hrc>
+#include <vcl/svapp.hxx>
+
+static ResMgr* pResMgr=0;
+
+// struct DialogsResMgr --------------------------------------------------
+ResMgr* DialogsResMgr::GetResMgr()
+{
+ if ( !pResMgr )
+ {
+ ByteString aName( "svx" );
+ pResMgr = ResMgr::CreateResMgr( aName.GetBuffer(), Application::GetSettings().GetUILocale() );
+ }
+
+ return pResMgr;
+}
diff --git a/svx/source/dialog/dlgctl3d.cxx b/svx/source/dialog/dlgctl3d.cxx
new file mode 100644
index 000000000000..5f05d360007c
--- /dev/null
+++ b/svx/source/dialog/dlgctl3d.cxx
@@ -0,0 +1,1323 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/dlgctl3d.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/view3d.hxx>
+#include <svx/fmmodel.hxx>
+#include <svl/itempool.hxx>
+#include <svx/fmpage.hxx>
+#include <svx/polysc3d.hxx>
+#include <svx/sphere3d.hxx>
+#include <svx/cube3d.hxx>
+#include <vcl/svapp.hxx>
+#include <svx/helperhittest3d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <svx/polygn3d.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xlnwtit.hxx>
+#include "helpid.hrc"
+#include <algorithm>
+
+//////////////////////////////////////////////////////////////////////////////
+
+Svx3DPreviewControl::Svx3DPreviewControl(Window* pParent, const ResId& rResId)
+: Control(pParent, rResId),
+ mpModel(0),
+ mpFmPage(0),
+ mp3DView(0),
+ mpScene(0),
+ mp3DObj(0),
+ mnObjectType(PREVIEW_OBJECTTYPE_SPHERE)
+{
+ Construct();
+
+ // do not paint background self, DrawingLayer paints this buffered and as page
+ SetControlBackground();
+ SetBackground();
+}
+
+Svx3DPreviewControl::Svx3DPreviewControl(Window* pParent, WinBits nStyle)
+: Control(pParent, nStyle),
+ mpModel(0),
+ mpFmPage(0),
+ mp3DView(0),
+ mpScene(0),
+ mp3DObj(0),
+ mnObjectType(PREVIEW_OBJECTTYPE_SPHERE)
+{
+ Construct();
+
+ // do not paint background self, DrawingLayer paints this buffered and as page
+ SetControlBackground();
+ SetBackground();
+}
+
+Svx3DPreviewControl::~Svx3DPreviewControl()
+{
+ delete mp3DView;
+ delete mpModel;
+}
+
+void Svx3DPreviewControl::Construct()
+{
+ // Do never mirror the preview window. This explicitly includes right
+ // to left writing environments.
+ EnableRTL (sal_False);
+ SetMapMode( MAP_100TH_MM );
+
+ // Model
+ mpModel = new FmFormModel();
+ mpModel->GetItemPool().FreezeIdRanges();
+
+ // Page
+ mpFmPage = new FmFormPage( *mpModel, NULL );
+ mpModel->InsertPage( mpFmPage, 0 );
+
+ // 3D View
+ mp3DView = new E3dView( mpModel, this );
+ mp3DView->SetBufferedOutputAllowed(true);
+ mp3DView->SetBufferedOverlayAllowed(true);
+
+ // 3D Scene
+ mpScene = new E3dPolyScene(mp3DView->Get3DDefaultAttributes());
+
+ // initially create object
+ SetObjectType(PREVIEW_OBJECTTYPE_SPHERE);
+
+ // camera and perspective
+ Camera3D& rCamera = (Camera3D&) mpScene->GetCamera();
+ const basegfx::B3DRange& rVolume = mpScene->GetBoundVolume();
+ double fW = rVolume.getWidth();
+ double fH = rVolume.getHeight();
+ double fCamZ = rVolume.getMaxZ() + ((fW + fH) / 2.0);
+
+ rCamera.SetAutoAdjustProjection(sal_False);
+ rCamera.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
+ basegfx::B3DPoint aLookAt;
+ double fDefaultCamPosZ = mp3DView->GetDefaultCamPosZ();
+ basegfx::B3DPoint aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ);
+ rCamera.SetPosAndLookAt(aCamPos, aLookAt);
+ double fDefaultCamFocal = mp3DView->GetDefaultCamFocal();
+ rCamera.SetFocalLength(fDefaultCamFocal);
+ rCamera.SetDefaults(basegfx::B3DPoint(0.0, 0.0, fDefaultCamPosZ), aLookAt, fDefaultCamFocal);
+
+ mpScene->SetCamera( rCamera );
+ mpFmPage->InsertObject( mpScene );
+
+ basegfx::B3DHomMatrix aRotation;
+ aRotation.rotate(DEG2RAD( 25 ), 0.0, 0.0);
+ aRotation.rotate(0.0, DEG2RAD( 40 ), 0.0);
+ mpScene->SetTransform(aRotation * mpScene->GetTransform());
+
+ // invalidate SnapRects of objects
+ mpScene->SetRectsDirty();
+
+ SfxItemSet aSet( mpModel->GetItemPool(),
+ XATTR_LINESTYLE, XATTR_LINESTYLE,
+ XATTR_FILL_FIRST, XATTR_FILLBITMAP,
+ 0, 0 );
+ aSet.Put( XLineStyleItem( XLINE_NONE ) );
+ aSet.Put( XFillStyleItem( XFILL_SOLID ) );
+ aSet.Put( XFillColorItem( String(), Color( COL_WHITE ) ) );
+
+ mpScene->SetMergedItemSet(aSet);
+
+ // PageView
+ SdrPageView* pPageView = mp3DView->ShowSdrPage( mpFmPage );
+ mp3DView->hideMarkHandles();
+
+ // mark scene
+ mp3DView->MarkObj( mpScene, pPageView );
+}
+
+void Svx3DPreviewControl::Resize()
+{
+ // size of page
+ Size aSize( GetSizePixel() );
+ aSize = PixelToLogic( aSize );
+ mpFmPage->SetSize( aSize );
+
+ // set size
+ Size aObjSize( aSize.Width()*5/6, aSize.Height()*5/6 );
+ Point aObjPoint( (aSize.Width() - aObjSize.Width()) / 2,
+ (aSize.Height() - aObjSize.Height()) / 2);
+ Rectangle aRect( aObjPoint, aObjSize);
+ mpScene->SetSnapRect( aRect );
+}
+
+void Svx3DPreviewControl::Paint(const Rectangle& rRect)
+{
+ mp3DView->CompleteRedraw(this, Region(rRect));
+}
+
+void Svx3DPreviewControl::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ Control::MouseButtonDown(rMEvt);
+
+ if( rMEvt.IsShift() && rMEvt.IsMod1() )
+ {
+ if(PREVIEW_OBJECTTYPE_SPHERE == GetObjectType())
+ {
+ SetObjectType(PREVIEW_OBJECTTYPE_CUBE);
+ }
+ else
+ {
+ SetObjectType(PREVIEW_OBJECTTYPE_SPHERE);
+ }
+ }
+}
+
+void Svx3DPreviewControl::SetObjectType(sal_uInt16 nType)
+{
+ if( mnObjectType != nType || !mp3DObj)
+ {
+ SfxItemSet aSet(mpModel->GetItemPool(), SDRATTR_START, SDRATTR_END, 0, 0);
+ mnObjectType = nType;
+
+ if( mp3DObj )
+ {
+ aSet.Put(mp3DObj->GetMergedItemSet());
+ mpScene->Remove3DObj( mp3DObj );
+ delete mp3DObj;
+ mp3DObj = NULL;
+ }
+
+ switch( nType )
+ {
+ case PREVIEW_OBJECTTYPE_SPHERE:
+ {
+ mp3DObj = new E3dSphereObj(
+ mp3DView->Get3DDefaultAttributes(),
+ basegfx::B3DPoint( 0, 0, 0 ),
+ basegfx::B3DVector( 5000, 5000, 5000 ));
+ }
+ break;
+
+ case PREVIEW_OBJECTTYPE_CUBE:
+ {
+ mp3DObj = new E3dCubeObj(
+ mp3DView->Get3DDefaultAttributes(),
+ basegfx::B3DPoint( -2500, -2500, -2500 ),
+ basegfx::B3DVector( 5000, 5000, 5000 ));
+ }
+ break;
+ }
+
+ mpScene->Insert3DObj( mp3DObj );
+ mp3DObj->SetMergedItemSet(aSet);
+
+ Resize();
+ }
+}
+
+SfxItemSet Svx3DPreviewControl::Get3DAttributes() const
+{
+ return mp3DObj->GetMergedItemSet();
+}
+
+void Svx3DPreviewControl::Set3DAttributes( const SfxItemSet& rAttr )
+{
+ mp3DObj->SetMergedItemSet(rAttr, true);
+ Resize();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+#define RADIUS_LAMP_PREVIEW_SIZE (4500.0)
+#define RADIUS_LAMP_SMALL (600.0)
+#define RADIUS_LAMP_BIG (1000.0)
+#define NO_LIGHT_SELECTED (0xffffffff)
+#define MAX_NUMBER_LIGHTS (8)
+
+Svx3DLightControl::Svx3DLightControl(Window* pParent, const ResId& rResId)
+: Svx3DPreviewControl(pParent, rResId),
+ maUserInteractiveChangeCallback(),
+ maUserSelectionChangeCallback(),
+ maChangeCallback(),
+ maSelectionChangeCallback(),
+ maSelectedLight(NO_LIGHT_SELECTED),
+ mpExpansionObject(0),
+ mpLampBottomObject(0),
+ mpLampShaftObject(0),
+ maLightObjects(MAX_NUMBER_LIGHTS, (E3dObject*)0),
+ mfRotateX(-20.0),
+ mfRotateY(45.0),
+ mfRotateZ(0.0),
+ maActionStartPoint(),
+ mnInteractionStartDistance(5 * 5 * 2),
+ mfSaveActionStartHor(0.0),
+ mfSaveActionStartVer(0.0),
+ mfSaveActionStartRotZ(0.0),
+ mbMouseMoved(false),
+ mbGeometrySelected(false)
+{
+ Construct2();
+}
+
+Svx3DLightControl::Svx3DLightControl(Window* pParent, WinBits nStyle)
+: Svx3DPreviewControl(pParent, nStyle),
+ maUserInteractiveChangeCallback(),
+ maUserSelectionChangeCallback(),
+ maChangeCallback(),
+ maSelectionChangeCallback(),
+ maSelectedLight(NO_LIGHT_SELECTED),
+ mpExpansionObject(0),
+ mpLampBottomObject(0),
+ mpLampShaftObject(0),
+ maLightObjects(MAX_NUMBER_LIGHTS, (E3dObject*)0),
+ mfRotateX(-20.0),
+ mfRotateY(45.0),
+ mfRotateZ(0.0),
+ maActionStartPoint(),
+ mnInteractionStartDistance(5 * 5 * 2),
+ mfSaveActionStartHor(0.0),
+ mfSaveActionStartVer(0.0),
+ mfSaveActionStartRotZ(0.0),
+ mbMouseMoved(false),
+ mbGeometrySelected(false)
+{
+ Construct2();
+}
+
+Svx3DLightControl::~Svx3DLightControl()
+{
+ // SdrObjects like mpExpansionObject and mpLampBottomObject/mpLampShaftObject get deleted
+ // with deletion of the DrawingLayer and model
+}
+
+void Svx3DLightControl::Construct2()
+{
+ {
+ // hide all page stuff, use control background (normally gray)
+ const Color aDialogColor(Application::GetSettings().GetStyleSettings().GetDialogColor());
+ mp3DView->SetPageVisible(false);
+ mp3DView->SetApplicationBackgroundColor(aDialogColor);
+ mp3DView->SetApplicationDocumentColor(aDialogColor);
+ }
+
+ {
+ // create invisible expansion object
+ const double fMaxExpansion(RADIUS_LAMP_BIG + RADIUS_LAMP_PREVIEW_SIZE);
+ mpExpansionObject = new E3dCubeObj(
+ mp3DView->Get3DDefaultAttributes(),
+ basegfx::B3DPoint(-fMaxExpansion, -fMaxExpansion, -fMaxExpansion),
+ basegfx::B3DVector(2.0 * fMaxExpansion, 2.0 * fMaxExpansion, 2.0 * fMaxExpansion));
+ mpScene->Insert3DObj( mpExpansionObject );
+ SfxItemSet aSet(mpModel->GetItemPool());
+ aSet.Put( XLineStyleItem( XLINE_NONE ) );
+ aSet.Put( XFillStyleItem( XFILL_NONE ) );
+ mpExpansionObject->SetMergedItemSet(aSet);
+ }
+
+ {
+ // create lamp control object (Yellow lined object)
+ // base circle
+ const basegfx::B2DPolygon a2DCircle(basegfx::tools::createPolygonFromCircle(basegfx::B2DPoint(0.0, 0.0), RADIUS_LAMP_PREVIEW_SIZE));
+ basegfx::B3DPolygon a3DCircle(basegfx::tools::createB3DPolygonFromB2DPolygon(a2DCircle));
+ basegfx::B3DHomMatrix aTransform;
+
+ aTransform.rotate(F_PI2, 0.0, 0.0);
+ aTransform.translate(0.0, -RADIUS_LAMP_PREVIEW_SIZE, 0.0);
+ a3DCircle.transform(aTransform);
+
+ // create object for it
+ mpLampBottomObject = new E3dPolygonObj(
+ mp3DView->Get3DDefaultAttributes(),
+ basegfx::B3DPolyPolygon(a3DCircle),
+ true);
+ mpScene->Insert3DObj( mpLampBottomObject );
+
+ // half circle with stand
+ basegfx::B2DPolygon a2DHalfCircle;
+ a2DHalfCircle.append(basegfx::B2DPoint(RADIUS_LAMP_PREVIEW_SIZE, 0.0));
+ a2DHalfCircle.append(basegfx::B2DPoint(RADIUS_LAMP_PREVIEW_SIZE, -RADIUS_LAMP_PREVIEW_SIZE));
+ a2DHalfCircle.append(basegfx::tools::createPolygonFromEllipseSegment(
+ basegfx::B2DPoint(0.0, 0.0), RADIUS_LAMP_PREVIEW_SIZE, RADIUS_LAMP_PREVIEW_SIZE, F_2PI - F_PI2, F_PI2));
+ basegfx::B3DPolygon a3DHalfCircle(basegfx::tools::createB3DPolygonFromB2DPolygon(a2DHalfCircle));
+
+ // create object for it
+ mpLampShaftObject = new E3dPolygonObj(
+ mp3DView->Get3DDefaultAttributes(),
+ basegfx::B3DPolyPolygon(a3DHalfCircle),
+ true);
+ mpScene->Insert3DObj( mpLampShaftObject );
+
+ // initially invisible
+ SfxItemSet aSet(mpModel->GetItemPool());
+ aSet.Put( XLineStyleItem( XLINE_NONE ) );
+ aSet.Put( XFillStyleItem( XFILL_NONE ) );
+
+ mpLampBottomObject->SetMergedItemSet(aSet);
+ mpLampShaftObject->SetMergedItemSet(aSet);
+ }
+
+ {
+ // change camera settings
+ Camera3D& rCamera = (Camera3D&) mpScene->GetCamera();
+ const basegfx::B3DRange& rVolume = mpScene->GetBoundVolume();
+ double fW = rVolume.getWidth();
+ double fH = rVolume.getHeight();
+ double fCamZ = rVolume.getMaxZ() + ((fW + fH) / 2.0);
+
+ rCamera.SetAutoAdjustProjection(sal_False);
+ rCamera.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
+ basegfx::B3DPoint aLookAt;
+ double fDefaultCamPosZ = mp3DView->GetDefaultCamPosZ();
+ basegfx::B3DPoint aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ);
+ rCamera.SetPosAndLookAt(aCamPos, aLookAt);
+ double fDefaultCamFocal = mp3DView->GetDefaultCamFocal();
+ rCamera.SetFocalLength(fDefaultCamFocal);
+ rCamera.SetDefaults(basegfx::B3DPoint(0.0, 0.0, fDefaultCamPosZ), aLookAt, fDefaultCamFocal);
+
+ mpScene->SetCamera( rCamera );
+
+ basegfx::B3DHomMatrix aNeutral;
+ mpScene->SetTransform(aNeutral);
+ }
+
+ // invalidate SnapRects of objects
+ mpScene->SetRectsDirty();
+}
+
+void Svx3DLightControl::ConstructLightObjects()
+{
+ for(sal_uInt32 a(0); a < MAX_NUMBER_LIGHTS; a++)
+ {
+ // get rid of evtl. existing light object
+ if(maLightObjects[a])
+ {
+ mpScene->Remove3DObj(maLightObjects[a]);
+ delete maLightObjects[a];
+ maLightObjects[a] = 0;
+ }
+
+ if(GetLightOnOff(a))
+ {
+ const bool bIsSelectedLight(a == maSelectedLight);
+ basegfx::B3DVector aDirection(GetLightDirection(a));
+ aDirection.normalize();
+ aDirection *= RADIUS_LAMP_PREVIEW_SIZE;
+
+ const double fLampSize(bIsSelectedLight ? RADIUS_LAMP_BIG : RADIUS_LAMP_SMALL);
+ E3dObject* pNewLight = new E3dSphereObj(
+ mp3DView->Get3DDefaultAttributes(),
+ basegfx::B3DPoint( 0, 0, 0 ),
+ basegfx::B3DVector( fLampSize, fLampSize, fLampSize));
+ mpScene->Insert3DObj(pNewLight);
+
+ basegfx::B3DHomMatrix aTransform;
+ aTransform.translate(aDirection.getX(), aDirection.getY(), aDirection.getZ());
+ pNewLight->SetTransform(aTransform);
+
+ SfxItemSet aSet(mpModel->GetItemPool());
+ aSet.Put( XLineStyleItem( XLINE_NONE ) );
+ aSet.Put( XFillStyleItem( XFILL_SOLID ) );
+ aSet.Put( XFillColorItem(String(), GetLightColor(a)));
+ pNewLight->SetMergedItemSet(aSet);
+
+ maLightObjects[a] = pNewLight;
+ }
+ }
+}
+
+void Svx3DLightControl::AdaptToSelectedLight()
+{
+ if(NO_LIGHT_SELECTED == maSelectedLight)
+ {
+ // make mpLampBottomObject/mpLampShaftObject invisible
+ SfxItemSet aSet(mpModel->GetItemPool());
+ aSet.Put( XLineStyleItem( XLINE_NONE ) );
+ aSet.Put( XFillStyleItem( XFILL_NONE ) );
+ mpLampBottomObject->SetMergedItemSet(aSet);
+ mpLampShaftObject->SetMergedItemSet(aSet);
+ }
+ else
+ {
+ basegfx::B3DVector aDirection(GetLightDirection(maSelectedLight));
+ aDirection.normalize();
+
+ // make mpLampBottomObject/mpLampShaftObject visible (yellow hairline)
+ SfxItemSet aSet(mpModel->GetItemPool());
+ aSet.Put( XLineStyleItem( XLINE_SOLID ) );
+ aSet.Put( XLineColorItem(String(), COL_YELLOW));
+ aSet.Put( XLineWidthItem(0));
+ aSet.Put( XFillStyleItem( XFILL_NONE ) );
+ mpLampBottomObject->SetMergedItemSet(aSet);
+ mpLampShaftObject->SetMergedItemSet(aSet);
+
+ // adapt transformation of mpLampShaftObject
+ basegfx::B3DHomMatrix aTransform;
+ double fRotateY(0.0);
+
+ if(!basegfx::fTools::equalZero(aDirection.getZ()) || !basegfx::fTools::equalZero(aDirection.getX()))
+ {
+ fRotateY = atan2(-aDirection.getZ(), aDirection.getX());
+ }
+
+ aTransform.rotate(0.0, fRotateY, 0.0);
+ mpLampShaftObject->SetTransform(aTransform);
+
+ // adapt transformation of selected light
+ E3dObject* pSelectedLight = maLightObjects[sal_Int32(maSelectedLight)];
+
+ if(pSelectedLight)
+ {
+ aTransform.identity();
+ aTransform.translate(
+ aDirection.getX() * RADIUS_LAMP_PREVIEW_SIZE,
+ aDirection.getY() * RADIUS_LAMP_PREVIEW_SIZE,
+ aDirection.getZ() * RADIUS_LAMP_PREVIEW_SIZE);
+ pSelectedLight->SetTransform(aTransform);
+ }
+ }
+}
+
+void Svx3DLightControl::TrySelection(Point aPosPixel)
+{
+ if(mpScene)
+ {
+ const Point aPosLogic(PixelToLogic(aPosPixel));
+ const basegfx::B2DPoint aPoint(aPosLogic.X(), aPosLogic.Y());
+ std::vector< const E3dCompoundObject* > aResult;
+ getAllHit3DObjectsSortedFrontToBack(aPoint, *mpScene, aResult);
+
+ if(aResult.size())
+ {
+ // exclude expansion object which will be part of
+ // the hits. It's invisible, but for HitTest, it's included
+ const E3dCompoundObject* pResult = 0;
+
+ for(sal_uInt32 b(0); !pResult && b < aResult.size(); b++)
+ {
+ if(aResult[b] && aResult[b] != mpExpansionObject)
+ {
+ pResult = aResult[b];
+ }
+ }
+
+ if(pResult == mp3DObj)
+ {
+ if(!mbGeometrySelected)
+ {
+ mbGeometrySelected = true;
+ maSelectedLight = NO_LIGHT_SELECTED;
+ ConstructLightObjects();
+ AdaptToSelectedLight();
+ Invalidate();
+
+ if(maSelectionChangeCallback.IsSet())
+ {
+ maSelectionChangeCallback.Call(this);
+ }
+ }
+ }
+ else
+ {
+ sal_uInt32 aNewSelectedLight(NO_LIGHT_SELECTED);
+
+ for(sal_uInt32 a(0); a < MAX_NUMBER_LIGHTS; a++)
+ {
+ if(maLightObjects[a] && maLightObjects[a] == pResult)
+ {
+ aNewSelectedLight = a;
+ }
+ }
+
+ if(aNewSelectedLight != maSelectedLight)
+ {
+ SelectLight(aNewSelectedLight);
+
+ if(maSelectionChangeCallback.IsSet())
+ {
+ maSelectionChangeCallback.Call(this);
+ }
+ }
+ }
+ }
+ }
+}
+
+void Svx3DLightControl::Paint(const Rectangle& rRect)
+{
+ Svx3DPreviewControl::Paint(rRect);
+}
+
+void Svx3DLightControl::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ bool bCallParent(true);
+
+ // switch state
+ if(rMEvt.IsLeft())
+ {
+ if(IsSelectionValid() || mbGeometrySelected)
+ {
+ mbMouseMoved = false;
+ bCallParent = false;
+ maActionStartPoint = rMEvt.GetPosPixel();
+ StartTracking();
+ }
+ else
+ {
+ // Einfacher Click ohne viel Bewegen, versuche eine
+ // Selektion
+ TrySelection(rMEvt.GetPosPixel());
+ bCallParent = false;
+ }
+ }
+
+ // call parent
+ if(bCallParent)
+ {
+ Svx3DPreviewControl::MouseButtonDown(rMEvt);
+ }
+}
+
+void Svx3DLightControl::Tracking( const TrackingEvent& rTEvt )
+{
+ if(rTEvt.IsTrackingEnded())
+ {
+ if(rTEvt.IsTrackingCanceled())
+ {
+ if(mbMouseMoved)
+ {
+ // interrupt tracking
+ mbMouseMoved = false;
+
+ if(mbGeometrySelected)
+ {
+ SetRotation(mfSaveActionStartVer, mfSaveActionStartHor, mfSaveActionStartRotZ);
+ }
+ else
+ {
+ SetPosition(mfSaveActionStartHor, mfSaveActionStartVer);
+ }
+
+ if(maChangeCallback.IsSet())
+ {
+ maChangeCallback.Call(this);
+ }
+ }
+ }
+ else
+ {
+ const MouseEvent& rMEvt = rTEvt.GetMouseEvent();
+
+ if(mbMouseMoved)
+ {
+ // was change dinteractively
+ }
+ else
+ {
+ // simple click without much movement, try selection
+ TrySelection(rMEvt.GetPosPixel());
+ }
+ }
+ }
+ else
+ {
+ const MouseEvent& rMEvt = rTEvt.GetMouseEvent();
+ Point aDeltaPos = rMEvt.GetPosPixel() - maActionStartPoint;
+
+ if(!mbMouseMoved)
+ {
+ if(sal_Int32(aDeltaPos.X() * aDeltaPos.X() + aDeltaPos.Y() * aDeltaPos.Y()) > mnInteractionStartDistance)
+ {
+ if(mbGeometrySelected)
+ {
+ GetRotation(mfSaveActionStartVer, mfSaveActionStartHor, mfSaveActionStartRotZ);
+ }
+ else
+ {
+ // intercation start, save values
+ GetPosition(mfSaveActionStartHor, mfSaveActionStartVer);
+ }
+
+ mbMouseMoved = true;
+ }
+ }
+
+ if(mbMouseMoved)
+ {
+ if(mbGeometrySelected)
+ {
+ double fNewRotX = mfSaveActionStartVer - ((double)aDeltaPos.Y() * F_PI180);
+ double fNewRotY = mfSaveActionStartHor + ((double)aDeltaPos.X() * F_PI180);
+
+ // cut horizontal
+ while(fNewRotY < 0.0)
+ {
+ fNewRotY += F_2PI;
+ }
+
+ while(fNewRotY >= F_2PI)
+ {
+ fNewRotY -= F_2PI;
+ }
+
+ // cut vertical
+ if(fNewRotX < -F_PI2)
+ {
+ fNewRotX = -F_PI2;
+ }
+
+ if(fNewRotX > F_PI2)
+ {
+ fNewRotX = F_PI2;
+ }
+
+ SetRotation(fNewRotX, fNewRotY, mfSaveActionStartRotZ);
+
+ if(maChangeCallback.IsSet())
+ {
+ maChangeCallback.Call(this);
+ }
+ }
+ else
+ {
+ // interaction in progress
+ double fNewPosHor = mfSaveActionStartHor + ((double)aDeltaPos.X());
+ double fNewPosVer = mfSaveActionStartVer - ((double)aDeltaPos.Y());
+
+ // cut horizontal
+ while(fNewPosHor < 0.0)
+ {
+ fNewPosHor += 360.0;
+ }
+
+ while(fNewPosHor >= 360.0)
+ {
+ fNewPosHor -= 360.0;
+ }
+
+ // cut vertical
+ if(fNewPosVer < -90.0)
+ {
+ fNewPosVer = -90.0;
+ }
+
+ if(fNewPosVer > 90.0)
+ {
+ fNewPosVer = 90.0;
+ }
+
+ SetPosition(fNewPosHor, fNewPosVer);
+
+ if(maChangeCallback.IsSet())
+ {
+ maChangeCallback.Call(this);
+ }
+ }
+ }
+ }
+}
+
+void Svx3DLightControl::Resize()
+{
+ // set size of page
+ const Size aSize(PixelToLogic(GetSizePixel()));
+ mpFmPage->SetSize(aSize);
+
+ // set position and size of scene
+ mpScene->SetSnapRect(Rectangle(Point(0, 0), aSize));
+}
+
+void Svx3DLightControl::SetObjectType(sal_uInt16 nType)
+{
+ // call parent
+ Svx3DPreviewControl::SetObjectType(nType);
+
+ // apply object rotation
+ if(mp3DObj)
+ {
+ basegfx::B3DHomMatrix aObjectRotation;
+ aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ);
+ mp3DObj->SetTransform(aObjectRotation);
+ }
+}
+
+bool Svx3DLightControl::IsSelectionValid()
+{
+ if((NO_LIGHT_SELECTED != maSelectedLight) && (GetLightOnOff(maSelectedLight)))
+ {
+ return true;
+ }
+
+ return false;
+}
+
+void Svx3DLightControl::GetPosition(double& rHor, double& rVer)
+{
+ if(IsSelectionValid())
+ {
+ basegfx::B3DVector aDirection(GetLightDirection(maSelectedLight));
+ aDirection.normalize();
+ rHor = atan2(-aDirection.getX(), -aDirection.getZ()) + F_PI; // 0..2PI
+ rVer = atan2(aDirection.getY(), aDirection.getXZLength()); // -PI2..PI2
+ rHor /= F_PI180; // 0..360.0
+ rVer /= F_PI180; // -90.0..90.0
+ }
+ if(IsGeometrySelected())
+ {
+ rHor = mfRotateY / F_PI180; // 0..360.0
+ rVer = mfRotateX / F_PI180; // -90.0..90.0
+ }
+}
+
+void Svx3DLightControl::SetPosition(double fHor, double fVer)
+{
+ if(IsSelectionValid())
+ {
+ // set selected light's direction
+ fHor = (fHor * F_PI180) - F_PI; // -PI..PI
+ fVer *= F_PI180; // -PI2..PI2
+ basegfx::B3DVector aDirection(cos(fVer) * -sin(fHor), sin(fVer), cos(fVer) * -cos(fHor));
+ aDirection.normalize();
+
+ if(!aDirection.equal(GetLightDirection(maSelectedLight)))
+ {
+ // set changed light direction at SdrScene
+ SfxItemSet aSet(mpModel->GetItemPool());
+
+ switch(maSelectedLight)
+ {
+ case 0: aSet.Put(Svx3DLightDirection1Item(aDirection)); break;
+ case 1: aSet.Put(Svx3DLightDirection2Item(aDirection)); break;
+ case 2: aSet.Put(Svx3DLightDirection3Item(aDirection)); break;
+ case 3: aSet.Put(Svx3DLightDirection4Item(aDirection)); break;
+ case 4: aSet.Put(Svx3DLightDirection5Item(aDirection)); break;
+ case 5: aSet.Put(Svx3DLightDirection6Item(aDirection)); break;
+ case 6: aSet.Put(Svx3DLightDirection7Item(aDirection)); break;
+ default:
+ case 7: aSet.Put(Svx3DLightDirection8Item(aDirection)); break;
+ }
+
+ mpScene->SetMergedItemSet(aSet);
+
+ // correct 3D light's and LampFrame's geometries
+ AdaptToSelectedLight();
+ Invalidate();
+ }
+ }
+ if(IsGeometrySelected())
+ {
+ if(mfRotateX != fVer || mfRotateY != fHor)
+ {
+ mfRotateX = fVer * F_PI180;
+ mfRotateY = fHor * F_PI180;
+
+ if(mp3DObj)
+ {
+ basegfx::B3DHomMatrix aObjectRotation;
+ aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ);
+ mp3DObj->SetTransform(aObjectRotation);
+
+ Invalidate();
+ }
+ }
+ }
+}
+
+void Svx3DLightControl::SetRotation(double fRotX, double fRotY, double fRotZ)
+{
+ if(IsGeometrySelected())
+ {
+ if(fRotX != mfRotateX || fRotY != mfRotateY || fRotZ != mfRotateZ)
+ {
+ mfRotateX = fRotX;
+ mfRotateY = fRotY;
+ mfRotateZ = fRotZ;
+
+ if(mp3DObj)
+ {
+ basegfx::B3DHomMatrix aObjectRotation;
+ aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ);
+ mp3DObj->SetTransform(aObjectRotation);
+
+ Invalidate();
+ }
+ }
+ }
+}
+
+void Svx3DLightControl::GetRotation(double& rRotX, double& rRotY, double& rRotZ)
+{
+ rRotX = mfRotateX;
+ rRotY = mfRotateY;
+ rRotZ = mfRotateZ;
+}
+
+void Svx3DLightControl::Set3DAttributes( const SfxItemSet& rAttr )
+{
+ // call parent
+ Svx3DPreviewControl::Set3DAttributes(rAttr);
+
+ if(maSelectedLight != NO_LIGHT_SELECTED && !GetLightOnOff(maSelectedLight))
+ {
+ // selected light is no more active, select new one
+ maSelectedLight = NO_LIGHT_SELECTED;
+ }
+
+ // local updates
+ ConstructLightObjects();
+ AdaptToSelectedLight();
+ Invalidate();
+}
+
+void Svx3DLightControl::SelectLight(sal_uInt32 nLightNumber)
+{
+ if(nLightNumber > 7)
+ {
+ nLightNumber = NO_LIGHT_SELECTED;
+ }
+
+ if(NO_LIGHT_SELECTED != nLightNumber)
+ {
+ if(!GetLightOnOff(nLightNumber))
+ {
+ nLightNumber = NO_LIGHT_SELECTED;
+ }
+ }
+
+ if(nLightNumber != maSelectedLight)
+ {
+ maSelectedLight = nLightNumber;
+ mbGeometrySelected = false;
+ ConstructLightObjects();
+ AdaptToSelectedLight();
+ Invalidate();
+ }
+}
+
+bool Svx3DLightControl::GetLightOnOff(sal_uInt32 nNum) const
+{
+ if(nNum <= 7)
+ {
+ const SfxItemSet aLightItemSet(Get3DAttributes());
+
+ switch(nNum)
+ {
+ case 0 : return ((const Svx3DLightOnOff1Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_1)).GetValue();
+ case 1 : return ((const Svx3DLightOnOff2Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_2)).GetValue();
+ case 2 : return ((const Svx3DLightOnOff3Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_3)).GetValue();
+ case 3 : return ((const Svx3DLightOnOff4Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_4)).GetValue();
+ case 4 : return ((const Svx3DLightOnOff5Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_5)).GetValue();
+ case 5 : return ((const Svx3DLightOnOff6Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_6)).GetValue();
+ case 6 : return ((const Svx3DLightOnOff7Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_7)).GetValue();
+ case 7 : return ((const Svx3DLightOnOff8Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_8)).GetValue();
+ }
+ }
+
+ return false;
+}
+
+Color Svx3DLightControl::GetLightColor(sal_uInt32 nNum) const
+{
+ if(nNum <= 7)
+ {
+ const SfxItemSet aLightItemSet(Get3DAttributes());
+
+ switch(nNum)
+ {
+ case 0 : return ((const Svx3DLightcolor1Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1)).GetValue();
+ case 1 : return ((const Svx3DLightcolor2Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_2)).GetValue();
+ case 2 : return ((const Svx3DLightcolor3Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_3)).GetValue();
+ case 3 : return ((const Svx3DLightcolor4Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_4)).GetValue();
+ case 4 : return ((const Svx3DLightcolor5Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_5)).GetValue();
+ case 5 : return ((const Svx3DLightcolor6Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_6)).GetValue();
+ case 6 : return ((const Svx3DLightcolor7Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_7)).GetValue();
+ case 7 : return ((const Svx3DLightcolor8Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_8)).GetValue();
+ }
+ }
+
+ return Color(COL_BLACK);
+}
+
+basegfx::B3DVector Svx3DLightControl::GetLightDirection(sal_uInt32 nNum) const
+{
+ if(nNum <= 7)
+ {
+ const SfxItemSet aLightItemSet(Get3DAttributes());
+
+ switch(nNum)
+ {
+ case 0 : return ((const Svx3DLightDirection1Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1)).GetValue();
+ case 1 : return ((const Svx3DLightDirection2Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2)).GetValue();
+ case 2 : return ((const Svx3DLightDirection3Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3)).GetValue();
+ case 3 : return ((const Svx3DLightDirection4Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4)).GetValue();
+ case 4 : return ((const Svx3DLightDirection5Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5)).GetValue();
+ case 5 : return ((const Svx3DLightDirection6Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6)).GetValue();
+ case 6 : return ((const Svx3DLightDirection7Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7)).GetValue();
+ case 7 : return ((const Svx3DLightDirection8Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8)).GetValue();
+ }
+ }
+
+ return basegfx::B3DVector();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvxLightCtl3D::SvxLightCtl3D( Window* pParent, const ResId& rResId)
+: Control(pParent, rResId),
+ maLightControl(this, 0),
+ maHorScroller(this, WB_HORZ | WB_DRAG),
+ maVerScroller(this, WB_VERT | WB_DRAG),
+ maSwitcher(this, 0)
+{
+ // init members
+ Init();
+}
+
+SvxLightCtl3D::SvxLightCtl3D( Window* pParent, WinBits nStyle )
+: Control(pParent, nStyle),
+ maLightControl(this, 0),
+ maHorScroller(this, WB_HORZ | WB_DRAG),
+ maVerScroller(this, WB_VERT | WB_DRAG),
+ maSwitcher(this, 0)
+{
+ // init members
+ Init();
+}
+
+void SvxLightCtl3D::Init()
+{
+ // #i58240# set HelpIDs for scrollbars and switcher
+ maHorScroller.SetHelpId(HID_CTRL3D_HSCROLL);
+ maVerScroller.SetHelpId(HID_CTRL3D_VSCROLL);
+ maSwitcher.SetHelpId(HID_CTRL3D_SWITCHER);
+
+ // Light preview
+ maLightControl.Show();
+ maLightControl.SetChangeCallback( LINK(this, SvxLightCtl3D, InternalInteractiveChange) );
+ maLightControl.SetSelectionChangeCallback( LINK(this, SvxLightCtl3D, InternalSelectionChange) );
+
+ // Horiz Scrollbar
+ maHorScroller.Show();
+ maHorScroller.SetRange(Range(0, 36000));
+ maHorScroller.SetLineSize(100);
+ maHorScroller.SetPageSize(1000);
+ maHorScroller.SetScrollHdl( LINK(this, SvxLightCtl3D, ScrollBarMove) );
+
+ // Vert Scrollbar
+ maVerScroller.Show();
+ maVerScroller.SetRange(Range(0, 18000));
+ maVerScroller.SetLineSize(100);
+ maVerScroller.SetPageSize(1000);
+ maVerScroller.SetScrollHdl( LINK(this, SvxLightCtl3D, ScrollBarMove) );
+
+ // Switch Button
+ maSwitcher.Show();
+ maSwitcher.SetClickHdl( LINK(this, SvxLightCtl3D, ButtonPress) );
+
+ // check selection
+ CheckSelection();
+
+ // new layout
+ NewLayout();
+}
+
+SvxLightCtl3D::~SvxLightCtl3D()
+{
+}
+
+void SvxLightCtl3D::Resize()
+{
+ // call parent
+ Control::Resize();
+
+ // new layout
+ NewLayout();
+}
+
+void SvxLightCtl3D::NewLayout()
+{
+ // Layout members
+ const Size aSize(GetOutputSizePixel());
+ const sal_Int32 nScrollSize(maHorScroller.GetSizePixel().Height());
+
+ // Preview control
+ Point aPoint(0, 0);
+ Size aDestSize(aSize.Width() - nScrollSize, aSize.Height() - nScrollSize);
+ maLightControl.SetPosSizePixel(aPoint, aDestSize);
+
+ // hor scrollbar
+ aPoint.Y() = aSize.Height() - nScrollSize;
+ aDestSize.Height() = nScrollSize;
+ maHorScroller.SetPosSizePixel(aPoint, aDestSize);
+
+ // vert scrollbar
+ aPoint.X() = aSize.Width() - nScrollSize;
+ aPoint.Y() = 0;
+ aDestSize.Width() = nScrollSize;
+ aDestSize.Height() = aSize.Height() - nScrollSize;
+ maVerScroller.SetPosSizePixel(aPoint, aDestSize);
+
+ // button
+ aPoint.Y() = aSize.Height() - nScrollSize;
+ aDestSize.Height() = nScrollSize;
+ maSwitcher.SetPosSizePixel(aPoint, aDestSize);
+}
+
+void SvxLightCtl3D::CheckSelection()
+{
+ const bool bSelectionValid(maLightControl.IsSelectionValid() || maLightControl.IsGeometrySelected());
+ maHorScroller.Enable(bSelectionValid);
+ maVerScroller.Enable(bSelectionValid);
+
+ if(bSelectionValid)
+ {
+ double fHor, fVer;
+ maLightControl.GetPosition(fHor, fVer);
+ maHorScroller.SetThumbPos( sal_Int32(fHor * 100.0) );
+ maVerScroller.SetThumbPos( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
+ }
+}
+
+void SvxLightCtl3D::move( double fDeltaHor, double fDeltaVer )
+{
+ double fHor, fVer;
+
+ maLightControl.GetPosition(fHor, fVer);
+ fHor += fDeltaHor;
+ fVer += fDeltaVer;
+
+ if( fVer > 90.0 )
+ return;
+
+ if ( fVer < -90.0 )
+ return;
+
+ maLightControl.SetPosition(fHor, fVer);
+ maHorScroller.SetThumbPos( sal_Int32(fHor * 100.0) );
+ maVerScroller.SetThumbPos( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
+
+ if(maUserInteractiveChangeCallback.IsSet())
+ {
+ maUserInteractiveChangeCallback.Call(this);
+ }
+}
+
+void SvxLightCtl3D::KeyInput( const KeyEvent& rKEvt )
+{
+ const KeyCode aCode(rKEvt.GetKeyCode());
+
+ if( aCode.GetModifier() )
+ {
+ Control::KeyInput( rKEvt );
+ return;
+ }
+
+ switch ( aCode.GetCode() )
+ {
+ case KEY_SPACE:
+ {
+ break;
+ }
+ case KEY_LEFT:
+ {
+ move( -4.0, 0.0 ); // #i58242# changed move direction in X
+ break;
+ }
+ case KEY_RIGHT:
+ {
+ move( 4.0, 0.0 ); // #i58242# changed move direction in X
+ break;
+ }
+ case KEY_UP:
+ {
+ move( 0.0, 4.0 );
+ break;
+ }
+ case KEY_DOWN:
+ {
+ move( 0.0, -4.0 );
+ break;
+ }
+ case KEY_PAGEUP:
+ {
+ sal_Int32 nLight(maLightControl.GetSelectedLight() - 1);
+
+ while((nLight >= 0) && !maLightControl.GetLightOnOff(nLight))
+ {
+ nLight--;
+ }
+
+ if(nLight < 0)
+ {
+ nLight = 7;
+
+ while((nLight >= 0) && !maLightControl.GetLightOnOff(nLight))
+ {
+ nLight--;
+ }
+ }
+
+ if(nLight >= 0)
+ {
+ maLightControl.SelectLight(nLight);
+ CheckSelection();
+
+ if(maUserSelectionChangeCallback.IsSet())
+ {
+ maUserSelectionChangeCallback.Call(this);
+ }
+ }
+
+ break;
+ }
+ case KEY_PAGEDOWN:
+ {
+ sal_Int32 nLight(maLightControl.GetSelectedLight() - 1);
+
+ while(nLight <= 7 && !maLightControl.GetLightOnOff(nLight))
+ {
+ nLight++;
+ }
+
+ if(nLight > 7)
+ {
+ nLight = 0;
+
+ while(nLight <= 7 && !maLightControl.GetLightOnOff(nLight))
+ {
+ nLight++;
+ }
+ }
+
+ if(nLight <= 7)
+ {
+ maLightControl.SelectLight(nLight);
+ CheckSelection();
+
+ if(maUserSelectionChangeCallback.IsSet())
+ {
+ maUserSelectionChangeCallback.Call(this);
+ }
+ }
+
+ break;
+ }
+ default:
+ {
+ Control::KeyInput( rKEvt );
+ break;
+ }
+ }
+}
+
+void SvxLightCtl3D::GetFocus()
+{
+ Control::GetFocus();
+
+ if(HasFocus() && IsEnabled())
+ {
+ CheckSelection();
+
+ Size aFocusSize = maLightControl.GetOutputSizePixel();
+
+ aFocusSize.Width() -= 4;
+ aFocusSize.Height() -= 4;
+
+ Rectangle aFocusRect( Point( 2, 2 ), aFocusSize );
+
+ aFocusRect = maLightControl.PixelToLogic( aFocusRect );
+
+ maLightControl.ShowFocus( aFocusRect );
+ }
+}
+
+void SvxLightCtl3D::LoseFocus()
+{
+ Control::LoseFocus();
+
+ maLightControl.HideFocus();
+}
+
+IMPL_LINK( SvxLightCtl3D, ScrollBarMove, void*, EMPTYARG)
+{
+ const sal_Int32 nHor(maHorScroller.GetThumbPos());
+ const sal_Int32 nVer(maVerScroller.GetThumbPos());
+
+ maLightControl.SetPosition(
+ ((double)nHor) / 100.0,
+ ((double)((18000 - nVer) - 9000)) / 100.0);
+
+ if(maUserInteractiveChangeCallback.IsSet())
+ {
+ maUserInteractiveChangeCallback.Call(this);
+ }
+
+ return 0;
+}
+
+IMPL_LINK( SvxLightCtl3D, ButtonPress, void*, EMPTYARG)
+{
+ if(PREVIEW_OBJECTTYPE_SPHERE == GetSvx3DLightControl().GetObjectType())
+ {
+ GetSvx3DLightControl().SetObjectType(PREVIEW_OBJECTTYPE_CUBE);
+ }
+ else
+ {
+ GetSvx3DLightControl().SetObjectType(PREVIEW_OBJECTTYPE_SPHERE);
+ }
+
+ return 0;
+}
+
+IMPL_LINK( SvxLightCtl3D, InternalInteractiveChange, void*, EMPTYARG)
+{
+ double fHor, fVer;
+
+ maLightControl.GetPosition(fHor, fVer);
+ maHorScroller.SetThumbPos( sal_Int32(fHor * 100.0) );
+ maVerScroller.SetThumbPos( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
+
+ if(maUserInteractiveChangeCallback.IsSet())
+ {
+ maUserInteractiveChangeCallback.Call(this);
+ }
+
+ return 0;
+}
+
+IMPL_LINK( SvxLightCtl3D, InternalSelectionChange, void*, EMPTYARG)
+{
+ CheckSelection();
+
+ if(maUserSelectionChangeCallback.IsSet())
+ {
+ maUserSelectionChangeCallback.Call(this);
+ }
+
+ return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
new file mode 100644
index 000000000000..7d3d6d05912c
--- /dev/null
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -0,0 +1,2287 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#ifndef _APP_HXX //autogen
+#include <vcl/svapp.hxx>
+#endif
+
+#include <svx/xtable.hxx>
+#include <svx/xpool.hxx>
+
+#include <svx/dialogs.hrc>
+#include "accessibility.hrc"
+#include <svx/dlgctrl.hxx>
+#include <svx/dialmgr.hxx>
+#include <tools/poly.hxx>
+#include <vcl/region.hxx>
+#include <vcl/gradient.hxx>
+#include <vcl/hatch.hxx>
+#include <svtools/colorcfg.hxx>
+
+#include "svxrectctaccessiblecontext.hxx"
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <svx/svdorect.hxx>
+
+#include <svx/svdmodel.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include "linectrl.hrc"
+
+#define OUTPUT_DRAWMODE_COLOR (DRAWMODE_DEFAULT)
+#define OUTPUT_DRAWMODE_CONTRAST (DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT)
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::accessibility;
+
+
+/*************************************************************************
+|*
+|* Control zur Darstellung und Auswahl der Eckpunkte (und Mittelpunkt)
+|* eines Objekts
+|*
+\************************************************************************/
+
+Bitmap& SvxRectCtl::GetRectBitmap( void )
+{
+ if( !pBitmap )
+ InitRectBitmap();
+
+ return *pBitmap;
+}
+
+SvxRectCtl::SvxRectCtl( Window* pParent, const ResId& rResId, RECT_POINT eRpt,
+ sal_uInt16 nBorder, sal_uInt16 nCircle, CTL_STYLE eStyle ) :
+
+ Control( pParent, rResId ),
+
+ pAccContext ( NULL ),
+ nBorderWidth( nBorder ),
+ nRadius ( nCircle),
+ eDefRP ( eRpt ),
+ eCS ( eStyle ),
+ pBitmap ( NULL ),
+ m_nState ( 0 ),
+ mbCompleteDisable(sal_False)
+{
+ SetMapMode( MAP_100TH_MM );
+ Resize_Impl();
+}
+
+// -----------------------------------------------------------------------
+
+SvxRectCtl::~SvxRectCtl()
+{
+ delete pBitmap;
+
+ if( pAccContext )
+ pAccContext->release();
+}
+
+// -----------------------------------------------------------------------
+void SvxRectCtl::Resize()
+{
+ Resize_Impl();
+ Control::Resize();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxRectCtl::Resize_Impl()
+{
+ aSize = GetOutputSize();
+
+ switch( eCS )
+ {
+ case CS_RECT:
+ case CS_ANGLE:
+ case CS_SHADOW:
+ aPtLT = Point( 0 + nBorderWidth, 0 + nBorderWidth );
+ aPtMT = Point( aSize.Width() / 2, 0 + nBorderWidth );
+ aPtRT = Point( aSize.Width() - nBorderWidth, 0 + nBorderWidth );
+
+ aPtLM = Point( 0 + nBorderWidth, aSize.Height() / 2 );
+ aPtMM = Point( aSize.Width() / 2, aSize.Height() / 2 );
+ aPtRM = Point( aSize.Width() - nBorderWidth, aSize.Height() / 2 );
+
+ aPtLB = Point( 0 + nBorderWidth, aSize.Height() - nBorderWidth );
+ aPtMB = Point( aSize.Width() / 2, aSize.Height() - nBorderWidth );
+ aPtRB = Point( aSize.Width() - nBorderWidth, aSize.Height() - nBorderWidth );
+ break;
+
+ case CS_LINE:
+ aPtLT = Point( 0 + 3 * nBorderWidth, 0 + nBorderWidth );
+ aPtMT = Point( aSize.Width() / 2, 0 + nBorderWidth );
+ aPtRT = Point( aSize.Width() - 3 * nBorderWidth, 0 + nBorderWidth );
+
+ aPtLM = Point( 0 + 3 * nBorderWidth, aSize.Height() / 2 );
+ aPtMM = Point( aSize.Width() / 2, aSize.Height() / 2 );
+ aPtRM = Point( aSize.Width() - 3 * nBorderWidth, aSize.Height() / 2 );
+
+ aPtLB = Point( 0 + 3 * nBorderWidth, aSize.Height() - nBorderWidth );
+ aPtMB = Point( aSize.Width() / 2, aSize.Height() - nBorderWidth );
+ aPtRB = Point( aSize.Width() - 3 * nBorderWidth, aSize.Height() - nBorderWidth );
+ break;
+ }
+ Reset();
+ InitSettings( sal_True, sal_True );
+}
+// -----------------------------------------------------------------------
+
+void SvxRectCtl::InitRectBitmap( void )
+{
+ if( pBitmap )
+ delete pBitmap;
+
+ const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
+ svtools::ColorConfig aColorConfig;
+
+ pBitmap = new Bitmap( SVX_RES( RID_SVXCTRL_RECTBTNS ) );
+
+ // set bitmap-colors
+ 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 sal_Bool bModify = sal_False;
+ sal_Bool& rModify = bModify;
+ if( rModify )
+ {
+ static int n = 0;
+ static sal_uInt8 r = 0xFF;
+ static sal_uInt8 g = 0x00;
+ static sal_uInt8 b = 0xFF;
+ int& rn = n;
+ sal_uInt8& rr = r;
+ sal_uInt8& rg = g;
+ sal_uInt8& rb = b;
+ aColorAry2[ rn ] = Color( rr, rg, rb );
+ }
+#endif
+
+ pBitmap->Replace( aColorAry1, aColorAry2, 7, NULL );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxRectCtl::InitSettings( sal_Bool bForeground, sal_Bool bBackground )
+{
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+
+ if( bForeground )
+ {
+ svtools::ColorConfig aColorConfig;
+ Color aTextColor( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
+
+ if ( IsControlForeground() )
+ aTextColor = GetControlForeground();
+ SetTextColor( aTextColor );
+ }
+
+ if( bBackground )
+ {
+ if ( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( rStyleSettings.GetWindowColor() );
+ }
+
+ delete pBitmap;
+ pBitmap = NULL; // forces new creating of bitmap
+
+ Invalidate();
+}
+
+/*************************************************************************
+|*
+|* Das angeklickte Rechteck (3 x 3) wird ermittelt und der Parent (Dialog)
+|* wird benachrichtigt, dass der Punkt geaendert wurde
+|*
+\************************************************************************/
+
+void SvxRectCtl::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ // #103516# CompletelyDisabled() added to have a disabled state for SvxRectCtl
+ if(!IsCompletelyDisabled())
+ {
+ Point aPtLast = aPtNew;
+
+ aPtNew = GetApproxLogPtFromPixPt( rMEvt.GetPosPixel() );
+
+ if( aPtNew == aPtMM && ( eCS == CS_SHADOW || eCS == CS_ANGLE ) )
+ {
+ aPtNew = aPtLast;
+ }
+ else
+ {
+ Invalidate( Rectangle( aPtLast - Point( nRadius, nRadius ),
+ aPtLast + Point( nRadius, nRadius ) ) );
+ Invalidate( Rectangle( aPtNew - Point( nRadius, nRadius ),
+ aPtNew + Point( nRadius, nRadius ) ) );
+ eRP = GetRPFromPoint( aPtNew );
+
+ SetActualRP( eRP );
+
+ if( WINDOW_TABPAGE == GetParent()->GetType() )
+ ( (SvxTabPage*) GetParent() )->PointChanged( this, eRP );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxRectCtl::KeyInput( const KeyEvent& rKeyEvt )
+{
+ // #103516# CompletelyDisabled() added to have a disabled state for SvxRectCtl
+ if(!IsCompletelyDisabled())
+ {
+ RECT_POINT eNewRP = eRP;
+ sal_Bool bUseMM = (eCS != CS_SHADOW) && (eCS != CS_ANGLE);
+
+ switch( rKeyEvt.GetKeyCode().GetCode() )
+ {
+ case KEY_DOWN:
+ {
+ if( !(m_nState & CS_NOVERT) )
+ switch( eNewRP )
+ {
+ case RP_LT: eNewRP = RP_LM; break;
+ case RP_MT: eNewRP = bUseMM ? RP_MM : RP_MB; break;
+ case RP_RT: eNewRP = RP_RM; break;
+ case RP_LM: eNewRP = RP_LB; break;
+ case RP_MM: eNewRP = RP_MB; break;
+ case RP_RM: eNewRP = RP_RB; break;
+ default: ; //prevent warning
+ }
+ }
+ break;
+ case KEY_UP:
+ {
+ if( !(m_nState & CS_NOVERT) )
+ switch( eNewRP )
+ {
+ case RP_LM: eNewRP = RP_LT; break;
+ case RP_MM: eNewRP = RP_MT; break;
+ case RP_RM: eNewRP = RP_RT; break;
+ case RP_LB: eNewRP = RP_LM; break;
+ case RP_MB: eNewRP = bUseMM ? RP_MM : RP_MT; break;
+ case RP_RB: eNewRP = RP_RM; break;
+ default: ; //prevent warning
+ }
+ }
+ break;
+ case KEY_LEFT:
+ {
+ if( !(m_nState & CS_NOHORZ) )
+ switch( eNewRP )
+ {
+ case RP_MT: eNewRP = RP_LT; break;
+ case RP_RT: eNewRP = RP_MT; break;
+ case RP_MM: eNewRP = RP_LM; break;
+ case RP_RM: eNewRP = bUseMM ? RP_MM : RP_LM; break;
+ case RP_MB: eNewRP = RP_LB; break;
+ case RP_RB: eNewRP = RP_MB; break;
+ default: ; //prevent warning
+ }
+ }
+ break;
+ case KEY_RIGHT:
+ {
+ if( !(m_nState & CS_NOHORZ) )
+ switch( eNewRP )
+ {
+ case RP_LT: eNewRP = RP_MT; break;
+ case RP_MT: eNewRP = RP_RT; break;
+ case RP_LM: eNewRP = bUseMM ? RP_MM : RP_RM; break;
+ case RP_MM: eNewRP = RP_RM; break;
+ case RP_LB: eNewRP = RP_MB; break;
+ case RP_MB: eNewRP = RP_RB; break;
+ default: ; //prevent warning
+ }
+ }
+ break;
+ default:
+ Control::KeyInput( rKeyEvt );
+ return;
+ }
+ if( eNewRP != eRP )
+ {
+ SetActualRP( eNewRP );
+
+ if( WINDOW_TABPAGE == GetParent()->GetType() )
+ ( (SvxTabPage*) GetParent() )->PointChanged( this, eRP );
+
+ SetFocusRect();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxRectCtl::StateChanged( StateChangedType nType )
+{
+ if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ InitSettings( sal_True, sal_False );
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ InitSettings( sal_False, sal_True );
+
+ Window::StateChanged( nType );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxRectCtl::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
+ InitSettings( sal_True, sal_True );
+ else
+ Window::DataChanged( rDCEvt );
+}
+
+/*************************************************************************
+|*
+|* Zeichnet das Control (Rechteck mit 9 Kreisen)
+|*
+\************************************************************************/
+
+void SvxRectCtl::Paint( const Rectangle& )
+{
+ Point aPtDiff( PixelToLogic( Point( 1, 1 ) ) );
+
+ const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
+
+ SetLineColor( rStyles.GetDialogColor() );
+ SetFillColor( rStyles.GetDialogColor() );
+ DrawRect( Rectangle( Point(0,0), GetOutputSize() ) );
+
+ if( IsEnabled() )
+ SetLineColor( rStyles.GetLabelTextColor() );
+ else
+ SetLineColor( rStyles.GetShadowColor() );
+
+ SetFillColor();
+
+ switch( eCS )
+ {
+
+ case CS_RECT:
+ case CS_SHADOW:
+ if( !IsEnabled() )
+ {
+ Color aOldCol = GetLineColor();
+ SetLineColor( rStyles.GetLightColor() );
+ DrawRect( Rectangle( aPtLT + aPtDiff, aPtRB + aPtDiff ) );
+ SetLineColor( aOldCol );
+ }
+ DrawRect( Rectangle( aPtLT, aPtRB ) );
+ break;
+
+ case CS_LINE:
+ if( !IsEnabled() )
+ {
+ Color aOldCol = GetLineColor();
+ SetLineColor( rStyles.GetLightColor() );
+ DrawLine( aPtLM - Point( 2 * nBorderWidth, 0) + aPtDiff,
+ aPtRM + Point( 2 * nBorderWidth, 0 ) + aPtDiff );
+ SetLineColor( aOldCol );
+ }
+ DrawLine( aPtLM - Point( 2 * nBorderWidth, 0),
+ aPtRM + Point( 2 * nBorderWidth, 0 ) );
+ break;
+
+ case CS_ANGLE:
+ if( !IsEnabled() )
+ {
+ Color aOldCol = GetLineColor();
+ SetLineColor( rStyles.GetLightColor() );
+ DrawLine( aPtLT + aPtDiff, aPtRB + aPtDiff );
+ DrawLine( aPtLB + aPtDiff, aPtRT + aPtDiff );
+ DrawLine( aPtLM + aPtDiff, aPtRM + aPtDiff );
+ DrawLine( aPtMT + aPtDiff, aPtMB + aPtDiff );
+ SetLineColor( aOldCol );
+ }
+ DrawLine( aPtLT, aPtRB );
+ DrawLine( aPtLB, aPtRT );
+ DrawLine( aPtLM, aPtRM );
+ DrawLine( aPtMT, aPtMB );
+ break;
+
+ default:
+ break;
+ }
+ SetFillColor( GetBackground().GetColor() );
+
+ Size aBtnSize( 11, 11 );
+ Size aDstBtnSize( PixelToLogic( aBtnSize ) );
+ Point aToCenter( aDstBtnSize.Width() >> 1, aDstBtnSize.Height() >> 1);
+ Point aBtnPnt1( IsEnabled()?0:22,0 );
+ Point aBtnPnt2( 11,0 );
+ Point aBtnPnt3( 22,0 );
+
+ sal_Bool bNoHorz = (m_nState & CS_NOHORZ) != 0;
+ sal_Bool bNoVert = (m_nState & CS_NOVERT) != 0;
+
+ Bitmap& rBitmap = GetRectBitmap();
+
+ // #103516# CompletelyDisabled() added to have a disabled state for SvxRectCtl
+ if(IsCompletelyDisabled())
+ {
+ DrawBitmap( aPtLT - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
+ DrawBitmap( aPtMT - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
+ DrawBitmap( aPtRT - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
+ DrawBitmap( aPtLM - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
+ if( eCS == CS_RECT || eCS == CS_LINE )
+ DrawBitmap( aPtMM - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
+ DrawBitmap( aPtRM - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
+ DrawBitmap( aPtLB - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
+ DrawBitmap( aPtMB - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
+ DrawBitmap( aPtRB - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
+ }
+ else
+ {
+ DrawBitmap( aPtLT - aToCenter, aDstBtnSize, (bNoHorz | bNoVert)?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
+ DrawBitmap( aPtMT - aToCenter, aDstBtnSize, bNoVert?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
+ DrawBitmap( aPtRT - aToCenter, aDstBtnSize, (bNoHorz | bNoVert)?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
+
+ DrawBitmap( aPtLM - aToCenter, aDstBtnSize, bNoHorz?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
+
+ // Mittelpunkt bei Rechteck und Linie
+ if( eCS == CS_RECT || eCS == CS_LINE )
+ DrawBitmap( aPtMM - aToCenter, aDstBtnSize, aBtnPnt1, aBtnSize, rBitmap );
+
+ DrawBitmap( aPtRM - aToCenter, aDstBtnSize, bNoHorz?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
+
+ DrawBitmap( aPtLB - aToCenter, aDstBtnSize, (bNoHorz | bNoVert)?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
+ DrawBitmap( aPtMB - aToCenter, aDstBtnSize, bNoVert?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
+ DrawBitmap( aPtRB - aToCenter, aDstBtnSize, (bNoHorz | bNoVert)?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
+ }
+
+ // draw active button, avoid center pos for angle
+ // #103516# CompletelyDisabled() added to have a disabled state for SvxRectCtl
+ if(!IsCompletelyDisabled())
+ {
+ if( IsEnabled() && (eCS != CS_ANGLE || aPtNew != aPtMM) )
+ {
+ Point aCenterPt( aPtNew );
+ aCenterPt -= aToCenter;
+
+ DrawBitmap( aCenterPt, aDstBtnSize, aBtnPnt2, aBtnSize, rBitmap );
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Konvertiert RECT_POINT in Point
+|*
+\************************************************************************/
+
+Point SvxRectCtl::GetPointFromRP( RECT_POINT _eRP) const
+{
+ switch( _eRP )
+ {
+ case RP_LT: return aPtLT;
+ case RP_MT: return aPtMT;
+ case RP_RT: return aPtRT;
+ case RP_LM: return aPtLM;
+ case RP_MM: return aPtMM;
+ case RP_RM: return aPtRM;
+ case RP_LB: return aPtLB;
+ case RP_MB: return aPtMB;
+ case RP_RB: return aPtRB;
+ }
+ return( aPtMM ); // default
+}
+
+
+void SvxRectCtl::SetFocusRect( const Rectangle* pRect )
+{
+ HideFocus();
+
+ if( pRect )
+ ShowFocus( *pRect );
+ else
+ ShowFocus( CalculateFocusRectangle() );
+}
+
+Point SvxRectCtl::SetActualRPWithoutInvalidate( RECT_POINT eNewRP )
+{
+ Point aPtLast = aPtNew;
+ aPtNew = GetPointFromRP( eNewRP );
+
+ if( (m_nState & CS_NOHORZ) != 0 )
+ aPtNew.X() = aPtMM.X();
+
+ if( (m_nState & CS_NOVERT) != 0 )
+ aPtNew.Y() = aPtMM.Y();
+
+ eNewRP = GetRPFromPoint( aPtNew );
+
+ eDefRP = eNewRP;
+ eRP = eNewRP;
+
+ return aPtLast;
+}
+
+void SvxRectCtl::GetFocus()
+{
+ SetFocusRect();
+}
+
+
+void SvxRectCtl::LoseFocus()
+{
+ HideFocus();
+}
+
+
+Point SvxRectCtl::GetApproxLogPtFromPixPt( const Point& rPt ) const
+{
+ Point aPt = PixelToLogic( rPt );
+ long x;
+ long y;
+
+ if( ( m_nState & CS_NOHORZ ) == 0 )
+ {
+ if( aPt.X() < aSize.Width() / 3 )
+ x = aPtLT.X();
+ else if( aPt.X() < aSize.Width() * 2 / 3 )
+ x = aPtMM.X();
+ else
+ x = aPtRB.X();
+ }
+ else
+ x = aPtMM.X();
+
+ if( ( m_nState & CS_NOVERT ) == 0 )
+ {
+ if( aPt.Y() < aSize.Height() / 3 )
+ y = aPtLT.Y();
+ else if( aPt.Y() < aSize.Height() * 2 / 3 )
+ y = aPtMM.Y();
+ else
+ y = aPtRB.Y();
+ }
+ else
+ y = aPtMM.Y();
+
+ return Point( x, y );
+}
+
+
+/*************************************************************************
+|*
+|* Konvertiert Point in RECT_POINT
+|*
+\************************************************************************/
+
+RECT_POINT SvxRectCtl::GetRPFromPoint( Point aPt ) const
+{
+ if ( aPt == aPtLT) return RP_LT;
+ else if( aPt == aPtMT) return RP_MT;
+ else if( aPt == aPtRT) return RP_RT;
+ else if( aPt == aPtLM) return RP_LM;
+ else if( aPt == aPtRM) return RP_RM;
+ else if( aPt == aPtLB) return RP_LB;
+ else if( aPt == aPtMB) return RP_MB;
+ else if( aPt == aPtRB) return RP_RB;
+
+ else
+ return RP_MM; // default
+}
+
+/*************************************************************************
+|*
+|* Bewirkt den Ursprungszustand des Controls
+|*
+\************************************************************************/
+
+void SvxRectCtl::Reset()
+{
+ aPtNew = GetPointFromRP( eDefRP );
+ eRP = eDefRP;
+ Invalidate();
+}
+
+/*************************************************************************
+|*
+|* Gibt den aktuell ausgewaehlten RECT_POINT zur�ck
+|*
+\************************************************************************/
+
+RECT_POINT SvxRectCtl::GetActualRP() const
+{
+ return( eRP );
+}
+
+/*************************************************************************
+|*
+|* Gibt den aktuell ausgewaehlten RECT_POINT zur�ck
+|*
+\************************************************************************/
+
+void SvxRectCtl::SetActualRP( RECT_POINT eNewRP )
+{
+ Point aPtLast( SetActualRPWithoutInvalidate( eNewRP ) );
+
+ Invalidate( Rectangle( aPtLast - Point( nRadius, nRadius ), aPtLast + Point( nRadius, nRadius ) ) );
+ Invalidate( Rectangle( aPtNew - Point( nRadius, nRadius ), aPtNew + Point( nRadius, nRadius ) ) );
+
+ // notify accessibility object about change
+ if( pAccContext )
+ pAccContext->selectChild( eNewRP );
+}
+
+void SvxRectCtl::SetState( CTL_STATE nState )
+{
+ m_nState = nState;
+
+ Point aPtLast( GetPointFromRP( eRP ) );
+ Point _aPtNew( aPtLast );
+
+ if( (m_nState & CS_NOHORZ) != 0 )
+ _aPtNew.X() = aPtMM.X();
+
+ if( (m_nState & CS_NOVERT) != 0 )
+ _aPtNew.Y() = aPtMM.Y();
+
+ eRP = GetRPFromPoint( _aPtNew );
+ Invalidate();
+
+ if( WINDOW_TABPAGE == GetParent()->GetType() )
+ ( (SvxTabPage*) GetParent() )->PointChanged( this, eRP );
+}
+
+sal_uInt8 SvxRectCtl::GetNumOfChilds( void ) const
+{
+ return ( eCS == CS_ANGLE )? 8 : 9;
+}
+
+Rectangle SvxRectCtl::CalculateFocusRectangle( void ) const
+{
+ Size aDstBtnSize( PixelToLogic( Size( 15, 15 ) ) );
+ return Rectangle( aPtNew - Point( aDstBtnSize.Width() >> 1, aDstBtnSize.Height() >> 1 ), aDstBtnSize );
+}
+
+Rectangle SvxRectCtl::CalculateFocusRectangle( RECT_POINT eRectPoint ) const
+{
+ Rectangle aRet;
+ RECT_POINT eOldRectPoint = GetActualRP();
+
+ if( eOldRectPoint == eRectPoint )
+ aRet = CalculateFocusRectangle();
+ else
+ {
+ SvxRectCtl* pThis = const_cast< SvxRectCtl* >( this );
+
+ pThis->SetActualRPWithoutInvalidate( eRectPoint ); // no invalidation because it's only temporary!
+ aRet = CalculateFocusRectangle();
+
+ pThis->SetActualRPWithoutInvalidate( eOldRectPoint ); // no invalidation because nothing has changed!
+ }
+
+ return aRet;
+}
+
+Reference< XAccessible > SvxRectCtl::CreateAccessible()
+{
+ Window* pParent = GetAccessibleParentWindow();
+
+ DBG_ASSERT( pParent, "-SvxRectCtl::CreateAccessible(): No Parent!" );
+
+ Reference< XAccessible > xAccParent = pParent->GetAccessible();
+ if( xAccParent.is() )
+ {
+ pAccContext = new SvxRectCtlAccessibleContext( xAccParent, *this );
+ pAccContext->acquire();
+
+ SetActualRP( GetActualRP() );
+
+ return pAccContext;
+ }
+ else
+ return Reference< XAccessible >();
+}
+
+RECT_POINT SvxRectCtl::GetApproxRPFromPixPt( const ::com::sun::star::awt::Point& r ) const
+{
+ return GetRPFromPoint( GetApproxLogPtFromPixPt( Point( r.X, r.Y ) ) );
+}
+
+// #103516# CompletelyDisabled() added to have a disabled state for SvxRectCtl
+void SvxRectCtl::DoCompletelyDisable(sal_Bool bNew)
+{
+ mbCompleteDisable = bNew;
+ Invalidate();
+}
+
+/*************************************************************************
+|*
+|* Konstruktor ohne Size-Parameter
+|*
+\************************************************************************/
+
+SvxAngleCtl::SvxAngleCtl( Window* pParent, const ResId& rResId ) :
+
+ SvxRectCtl( pParent, rResId ),
+
+ aFont( Application::GetSettings().GetStyleSettings().GetAppFont() )
+{
+ aFontSize = Size( 250, 400 );
+ Initialize();
+}
+
+/*************************************************************************
+|*
+|* Konstruktor mit Size-Parameter
+|*
+\************************************************************************/
+
+SvxAngleCtl::SvxAngleCtl( Window* pParent, const ResId& rResId, Size _aSize ) :
+
+ SvxRectCtl( pParent, rResId ),
+
+ aFont( Application::GetSettings().GetStyleSettings().GetAppFont() )
+{
+ aFontSize = _aSize;
+ Initialize();
+}
+
+/*************************************************************************
+|*
+|* Initialisierung
+|*
+\************************************************************************/
+
+void SvxAngleCtl::Initialize()
+{
+ bPositive = sal_True;
+
+ // aFont.SetName( "Helvetica" );
+ aFont.SetSize( aFontSize );
+ aFont.SetWeight( WEIGHT_NORMAL );
+ aFont.SetTransparent( sal_False );
+
+ SetFont( aFont );
+}
+
+/*************************************************************************
+|*
+|* Zeichnet das (Mini-)Koordinatensystem
+|*
+\************************************************************************/
+
+void SvxAngleCtl::Paint( const Rectangle& )
+{
+ SetLineColor( Color( COL_BLACK ) ); // PEN_DOT ???
+ DrawLine( aPtLT - Point( 0, 0), aPtRB + Point( 0, 0 ) );
+ DrawLine( aPtLB - Point( 0, 0), aPtRT + Point( 0, 0 ) );
+
+ SetLineColor( Color( COL_BLACK ) );
+ DrawLine( aPtLM - Point( 0, 0), aPtRM + Point( 0, 0 ) );
+ DrawLine( aPtMT - Point( 0, 0), aPtMB + Point( 0, 0 ) );
+
+ Point aDiff(aFontSize.Width() / 2, aFontSize.Height() / 2);
+
+ DrawText( aPtLT - aDiff, UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "135" ) ) );
+ DrawText( aPtLM - aDiff, UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "180" ) ) );
+
+ if ( bPositive )
+ DrawText( aPtLB - aDiff, UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "225" ) ) );
+ else
+ DrawText( aPtLB - aDiff, UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "-135" ) ) );
+
+ aDiff.X() = aFontSize.Width();
+ DrawText( aPtMT - aDiff, UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "90" ) ) );
+ DrawText( aPtRT - aDiff, UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "45" ) ) );
+ aDiff.X() = aDiff .X() * 3 / 2;
+
+ if ( bPositive )
+ DrawText( aPtMB - aDiff, UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "270" ) ) );
+ else
+ DrawText( aPtMB - aDiff, UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "-90" ) ) );
+
+ DrawText( aPtRM - Point( 0, aDiff.Y() ), UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "0" ) ) );
+ aDiff.X() = aFontSize.Width() * 2;
+
+ if ( bPositive )
+ DrawText( aPtRB - aDiff, UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "315" ) ) );
+ else
+ DrawText( aPtRB - aDiff, UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "-45" ) ) );
+}
+
+/*************************************************************************
+|*
+|* Control zum Editieren von Bitmaps
+|*
+\************************************************************************/
+
+SvxPixelCtl::SvxPixelCtl( Window* pParent, const ResId& rResId, sal_uInt16 nNumber ) :
+ Control ( pParent, rResId ),
+ nLines ( nNumber ),
+ bPaintable ( sal_True )
+{
+ // SetMapMode( MAP_100TH_MM );
+ aRectSize = GetOutputSize();
+
+ SetPixelColor( Color( COL_BLACK ) );
+ SetBackgroundColor( Color( COL_WHITE ) );
+ SetLineColor( Application::GetSettings().GetStyleSettings().GetShadowColor() );
+
+ nSquares = nLines * nLines;
+ pPixel = new sal_uInt16[ nSquares ];
+ rtl_zeroMemory(pPixel, nSquares * sizeof(sal_uInt16));
+}
+
+/*************************************************************************
+|*
+|* Destruktor dealociert dyn. Array
+|*
+\************************************************************************/
+
+SvxPixelCtl::~SvxPixelCtl( )
+{
+ delete []pPixel;
+}
+
+/*************************************************************************
+|*
+|* Wechselt die Vordergrund- ,bzw. Hintergrundfarbe
+|*
+\************************************************************************/
+
+void SvxPixelCtl::ChangePixel( sal_uInt16 nPixel )
+{
+ if( *( pPixel + nPixel) == 0 )
+ *( pPixel + nPixel) = 1; // koennte erweitert werden auf mehrere Farben
+ else
+ *( pPixel + nPixel) = 0;
+}
+
+/*************************************************************************
+|*
+|* Das angeklickte Rechteck wird ermittelt um die Farbe zu wechseln
+|*
+\************************************************************************/
+
+void SvxPixelCtl::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ Point aPt = PixelToLogic( rMEvt.GetPosPixel() );
+ Point aPtTl, aPtBr;
+ sal_uInt16 nX, nY;
+
+ nX = (sal_uInt16) ( aPt.X() * nLines / aRectSize.Width() );
+ nY = (sal_uInt16) ( aPt.Y() * nLines / aRectSize.Height() );
+
+ ChangePixel( nX + nY * nLines );
+
+ aPtTl.X() = aRectSize.Width() * nX / nLines + 1;
+ aPtBr.X() = aRectSize.Width() * (nX + 1) / nLines - 1;
+ aPtTl.Y() = aRectSize.Height() * nY / nLines + 1;
+ aPtBr.Y() = aRectSize.Height() * (nY + 1) / nLines - 1;
+
+ Invalidate( Rectangle( aPtTl, aPtBr ) );
+
+ if( WINDOW_TABPAGE == GetParent()->GetType() )
+ ( (SvxTabPage*) GetParent() )->PointChanged( this, RP_MM ); // RectPoint ist dummy
+}
+
+/*************************************************************************
+|*
+|* Zeichnet das Control (Rechteck mit 9 Kreisen)
+|*
+\************************************************************************/
+
+void SvxPixelCtl::Paint( const Rectangle& )
+{
+ sal_uInt16 i, j, nTmp;
+ Point aPtTl, aPtBr;
+
+ if( bPaintable )
+ {
+ // Linien Zeichnen
+ Control::SetLineColor( aLineColor );
+ for( i = 1; i < nLines; i++)
+ {
+ // horizontal
+ nTmp = (sal_uInt16) ( aRectSize.Height() * i / nLines );
+ DrawLine( Point( 0, nTmp ), Point( aRectSize.Width(), nTmp ) );
+ // vertikal
+ nTmp = (sal_uInt16) ( aRectSize.Width() * i / nLines );
+ DrawLine( Point( nTmp, 0 ), Point( nTmp, aRectSize.Height() ) );
+ }
+
+ // Rechtecke (Quadrate) zeichnen
+ Control::SetLineColor();
+ sal_uInt16 nLastPixel = *pPixel ? 0 : 1;
+
+ for( i = 0; i < nLines; i++)
+ {
+ aPtTl.Y() = aRectSize.Height() * i / nLines + 1;
+ aPtBr.Y() = aRectSize.Height() * (i + 1) / nLines - 1;
+
+ for( j = 0; j < nLines; j++)
+ {
+ aPtTl.X() = aRectSize.Width() * j / nLines + 1;
+ aPtBr.X() = aRectSize.Width() * (j + 1) / nLines - 1;
+
+ if ( *( pPixel + i * nLines + j ) != nLastPixel )
+ {
+ nLastPixel = *( pPixel + i * nLines + j );
+ // Farbe wechseln: 0 -> Hintergrundfarbe
+ SetFillColor( nLastPixel ? aPixelColor : aBackgroundColor );
+ }
+ DrawRect( Rectangle( aPtTl, aPtBr ) );
+ }
+ }
+ } // bPaintable
+ else
+ {
+ SetBackground( Wallpaper( Color( COL_LIGHTGRAY ) ) );
+ Control::SetLineColor( Color( COL_LIGHTRED ) );
+ DrawLine( Point( 0, 0 ), Point( aRectSize.Width(), aRectSize.Height() ) );
+ DrawLine( Point( 0, aRectSize.Height() ), Point( aRectSize.Width(), 0 ) );
+ }
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxPixelCtl::SetXBitmap( const XOBitmap& rXBmp )
+{
+ if( rXBmp.GetBitmapType() == XBITMAP_8X8 )
+ {
+ aPixelColor = rXBmp.GetPixelColor();
+ aBackgroundColor = rXBmp.GetBackgroundColor();
+
+ sal_uInt16* pArray = rXBmp.GetPixelArray();
+
+ for( sal_uInt16 i = 0; i < nSquares; i++ )
+ *( pPixel + i ) = *( pArray + i );
+ }
+}
+
+/*************************************************************************
+|*
+|* Gibt ein bestimmtes Pixel zurueck
+|*
+\************************************************************************/
+
+sal_uInt16 SvxPixelCtl::GetBitmapPixel( const sal_uInt16 nPixel )
+{
+ return( *( pPixel + nPixel ) );
+}
+
+/*************************************************************************
+|*
+|* Bewirkt den Ursprungszustand des Controls
+|*
+\************************************************************************/
+
+void SvxPixelCtl::Reset()
+{
+ // clear pixel area
+ rtl_zeroMemory(pPixel, nSquares * sizeof(sal_uInt16));
+ Invalidate();
+}
+
+/*************************************************************************
+|*
+|* Ctor: BitmapCtl fuer SvxPixelCtl
+|*
+\************************************************************************/
+
+SvxBitmapCtl::SvxBitmapCtl( Window* /*pParent*/, const Size& rSize )
+{
+ aSize = rSize;
+ // aVD.SetOutputSizePixel( aSize );
+}
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+SvxBitmapCtl::~SvxBitmapCtl()
+{
+}
+
+/*************************************************************************
+|*
+|* BitmapCtl: Gibt die Bitmap zurueck
+|*
+\************************************************************************/
+
+XOBitmap SvxBitmapCtl::GetXBitmap()
+{
+ XOBitmap aXOBitmap( pBmpArray, aPixelColor, aBackgroundColor );
+
+ return( aXOBitmap );
+}
+
+/*************************************************************************
+|*
+|* Fuellt die Listbox mit Farben und Strings
+|*
+\************************************************************************/
+
+void ColorLB::Fill( const XColorTable* pColorTab )
+{
+ long nCount = pColorTab->Count();
+ XColorEntry* pEntry;
+ SetUpdateMode( sal_False );
+
+ for( long i = 0; i < nCount; i++ )
+ {
+ pEntry = pColorTab->GetColor( i );
+ InsertEntry( pEntry->GetColor(), pEntry->GetName() );
+ }
+ SetUpdateMode( sal_True );
+}
+
+/************************************************************************/
+
+void ColorLB::Append( XColorEntry* pEntry, Bitmap* )
+{
+ InsertEntry( pEntry->GetColor(), pEntry->GetName() );
+}
+
+/************************************************************************/
+
+void ColorLB::Modify( XColorEntry* pEntry, sal_uInt16 nPos, Bitmap* )
+{
+ RemoveEntry( nPos );
+ InsertEntry( pEntry->GetColor(), pEntry->GetName(), nPos );
+}
+
+/*************************************************************************
+|*
+|* Fuellt die Listbox mit Farben und Strings
+|*
+\************************************************************************/
+
+void FillAttrLB::Fill( const XColorTable* pColorTab )
+{
+ long nCount = pColorTab->Count();
+ XColorEntry* pEntry;
+ SetUpdateMode( sal_False );
+
+ for( long i = 0; i < nCount; i++ )
+ {
+ pEntry = pColorTab->GetColor( i );
+ InsertEntry( pEntry->GetColor(), pEntry->GetName() );
+ }
+ SetUpdateMode( sal_True );
+}
+
+/*************************************************************************
+|*
+|* Fuellt die Listbox (vorlaeufig) mit Strings
+|*
+\************************************************************************/
+
+HatchingLB::HatchingLB( Window* pParent, ResId Id, sal_Bool bUserDraw /*= sal_True*/ )
+: ListBox( pParent, Id ),
+ mpList ( NULL ),
+ mbUserDraw( bUserDraw )
+{
+ EnableUserDraw( mbUserDraw );
+}
+
+HatchingLB::HatchingLB( Window* pParent, WinBits aWB, sal_Bool bUserDraw /*= sal_True*/ )
+: ListBox( pParent, aWB ),
+ mpList ( NULL ),
+ mbUserDraw( bUserDraw )
+{
+ EnableUserDraw( mbUserDraw );
+}
+
+void HatchingLB::Fill( const XHatchList* pList )
+{
+ mpList = (XHatchList*)pList;
+ XHatchEntry* pEntry;
+ long nCount = pList->Count();
+
+ SetUpdateMode( sal_False );
+
+ if( mbUserDraw )
+ {
+ for( long i = 0; i < nCount; i++ )
+ InsertEntry( pList->GetHatch( i )->GetName() );
+ }
+ else
+ {
+ for( long i = 0; i < nCount; i++ )
+ {
+ pEntry = pList->GetHatch( i );
+ Bitmap* pBitmap = pList->GetBitmap( i );
+ if( pBitmap )
+ InsertEntry( pEntry->GetName(), *pBitmap );
+ else
+ InsertEntry( pEntry->GetName() );
+ }
+ }
+
+ SetUpdateMode( sal_True );
+}
+
+void HatchingLB::UserDraw( const UserDrawEvent& rUDEvt )
+{
+ if( mpList != NULL )
+ {
+ // Draw gradient with borderrectangle
+ const Rectangle& rDrawRect = rUDEvt.GetRect();
+ Rectangle aRect( rDrawRect.nLeft+1, rDrawRect.nTop+1, rDrawRect.nLeft+33, rDrawRect.nBottom-1 );
+
+ sal_Int32 nId = rUDEvt.GetItemId();
+ if( nId >= 0 && nId <= mpList->Count() )
+ {
+ OutputDevice* pDevice = rUDEvt.GetDevice();
+
+ sal_uIntPtr nOldDrawMode = pDevice->GetDrawMode();
+ pDevice->SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR );
+
+ XHatch& rXHatch = mpList->GetHatch( rUDEvt.GetItemId() )->GetHatch();
+ MapMode aMode( MAP_100TH_MM );
+ Hatch aHatch( (HatchStyle) rXHatch.GetHatchStyle(),
+ rXHatch.GetColor(),
+ rUDEvt.GetDevice()->LogicToPixel( Point( rXHatch.GetDistance(), 0 ), aMode ).X(),
+ (sal_uInt16)rXHatch.GetAngle() );
+ const Polygon aPolygon( aRect );
+ const PolyPolygon aPolypoly( aPolygon );
+ pDevice->DrawHatch( aPolypoly, aHatch );
+
+ pDevice->SetLineColor( COL_BLACK );
+ pDevice->SetFillColor();
+ pDevice->DrawRect( aRect );
+
+ pDevice->SetDrawMode( nOldDrawMode );
+
+ // Draw name
+ pDevice->DrawText( Point( aRect.nRight+7, aRect.nTop-1 ), mpList->GetHatch( rUDEvt.GetItemId() )->GetName() );
+ }
+ }
+}
+
+/************************************************************************/
+
+void HatchingLB::Append( XHatchEntry* pEntry, Bitmap* pBmp )
+{
+ if( pBmp )
+ InsertEntry( pEntry->GetName(), *pBmp );
+ else
+ InsertEntry( pEntry->GetName() );
+}
+
+/************************************************************************/
+
+void HatchingLB::Modify( XHatchEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp )
+{
+ RemoveEntry( nPos );
+
+ if( pBmp )
+ InsertEntry( pEntry->GetName(), *pBmp, nPos );
+ else
+ InsertEntry( pEntry->GetName(), nPos );
+}
+
+/************************************************************************/
+
+void HatchingLB::SelectEntryByList( const XHatchList* pList, const String& rStr,
+ const XHatch& rHatch, sal_uInt16 nDist )
+{
+ long nCount = pList->Count();
+ XHatchEntry* pEntry;
+ sal_Bool bFound = sal_False;
+ String aStr;
+
+ long i;
+ for( i = 0; i < nCount && !bFound; i++ )
+ {
+ pEntry = pList->GetHatch( i );
+
+ aStr = pEntry->GetName();
+
+ if( rStr == aStr && rHatch == pEntry->GetHatch() )
+ bFound = sal_True;
+ }
+ if( bFound )
+ SelectEntryPos( (sal_uInt16) ( i - 1 + nDist ) );
+}
+
+/*************************************************************************
+|*
+|* Fuellt die Listbox (vorlaeufig) mit Strings
+|*
+\************************************************************************/
+
+void FillAttrLB::Fill( const XHatchList* pList )
+{
+ long nCount = pList->Count();
+ XHatchEntry* pEntry;
+ ListBox::SetUpdateMode( sal_False );
+
+ for( long i = 0; i < nCount; i++ )
+ {
+ pEntry = pList->GetHatch( i );
+ Bitmap* pBitmap = pList->GetBitmap( i );
+ if( pBitmap )
+ ListBox::InsertEntry( pEntry->GetName(), *pBitmap );
+ else
+ InsertEntry( pEntry->GetName() );
+ }
+ ListBox::SetUpdateMode( sal_True );
+}
+
+/*************************************************************************
+|*
+|* Fuellt die Listbox (vorlaeufig) mit Strings
+|*
+\************************************************************************/
+
+GradientLB::GradientLB( Window* pParent, ResId Id, sal_Bool bUserDraw /*= sal_True*/ )
+: ListBox( pParent, Id ),
+ mpList(NULL),
+ mbUserDraw( bUserDraw )
+{
+ EnableUserDraw( mbUserDraw);
+}
+
+GradientLB::GradientLB( Window* pParent, WinBits aWB, sal_Bool bUserDraw /*= sal_True*/ )
+: ListBox( pParent, aWB ),
+ mpList(NULL),
+ mbUserDraw( bUserDraw )
+{
+ EnableUserDraw( mbUserDraw );
+}
+
+void GradientLB::Fill( const XGradientList* pList )
+{
+ mpList = (XGradientList*)pList;
+ XGradientEntry* pEntry;
+ long nCount = pList->Count();
+
+ SetUpdateMode( sal_False );
+
+ if( mbUserDraw )
+ {
+ for( long i = 0; i < nCount; i++ )
+ InsertEntry( pList->GetGradient( i )->GetName() );
+ }
+ else
+ {
+ for( long i = 0; i < nCount; i++ )
+ {
+ pEntry = pList->GetGradient( i );
+ Bitmap* pBitmap = pList->GetBitmap( i );
+ if( pBitmap )
+ InsertEntry( pEntry->GetName(), *pBitmap );
+ else
+ InsertEntry( pEntry->GetName() );
+ }
+ }
+
+ SetUpdateMode( sal_True );
+}
+
+void GradientLB::UserDraw( const UserDrawEvent& rUDEvt )
+{
+ if( mpList != NULL )
+ {
+ // Draw gradient with borderrectangle
+ const Rectangle& rDrawRect = rUDEvt.GetRect();
+ Rectangle aRect( rDrawRect.nLeft+1, rDrawRect.nTop+1, rDrawRect.nLeft+33, rDrawRect.nBottom-1 );
+
+ sal_Int32 nId = rUDEvt.GetItemId();
+ if( nId >= 0 && nId <= mpList->Count() )
+ {
+ OutputDevice* pDevice = rUDEvt.GetDevice();
+
+ XGradient& rXGrad = mpList->GetGradient( rUDEvt.GetItemId() )->GetGradient();
+ Gradient aGradient( (GradientStyle) rXGrad.GetGradientStyle(), rXGrad.GetStartColor(), rXGrad.GetEndColor() );
+ aGradient.SetAngle( (sal_uInt16)rXGrad.GetAngle() );
+ aGradient.SetBorder( rXGrad.GetBorder() );
+ aGradient.SetOfsX( rXGrad.GetXOffset() );
+ aGradient.SetOfsY( rXGrad.GetYOffset() );
+ aGradient.SetStartIntensity( rXGrad.GetStartIntens() );
+ aGradient.SetEndIntensity( rXGrad.GetEndIntens() );
+ aGradient.SetSteps( 255 );
+
+ // #i76307# always paint the preview in LTR, because this is what the document does
+ Window* pWin = dynamic_cast<Window*>(pDevice);
+ if( pWin && pWin->IsRTLEnabled() && Application::GetSettings().GetLayoutRTL())
+ {
+ long nWidth = pDevice->GetOutputSize().Width();
+
+ pWin->EnableRTL( sal_False );
+
+ Rectangle aMirrorRect( Point( nWidth - aRect.Left() - aRect.GetWidth(), aRect.Top() ),
+ aRect.GetSize() );
+
+ pDevice->DrawGradient( aMirrorRect, aGradient );
+
+ pWin->EnableRTL( sal_True );
+ }
+ else
+ pDevice->DrawGradient( aRect, aGradient );
+
+ pDevice->SetLineColor( COL_BLACK );
+ pDevice->SetFillColor();
+ pDevice->DrawRect( aRect );
+
+ // Draw name
+ pDevice->DrawText( Point( aRect.nRight+7, aRect.nTop-1 ), mpList->GetGradient( rUDEvt.GetItemId() )->GetName() );
+ }
+ }
+}
+
+/************************************************************************/
+
+void GradientLB::Append( XGradientEntry* pEntry, Bitmap* pBmp )
+{
+ if( pBmp )
+ InsertEntry( pEntry->GetName(), *pBmp );
+ else
+ InsertEntry( pEntry->GetName() );
+}
+
+/************************************************************************/
+
+void GradientLB::Modify( XGradientEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp )
+{
+ RemoveEntry( nPos );
+
+ if( pBmp )
+ InsertEntry( pEntry->GetName(), *pBmp, nPos );
+ else
+ InsertEntry( pEntry->GetName(), nPos );
+}
+
+/************************************************************************/
+
+void GradientLB::SelectEntryByList( const XGradientList* pList, const String& rStr,
+ const XGradient& rGradient, sal_uInt16 nDist )
+{
+ long nCount = pList->Count();
+ XGradientEntry* pEntry;
+ sal_Bool bFound = sal_False;
+ String aStr;
+
+ long i;
+ for( i = 0; i < nCount && !bFound; i++ )
+ {
+ pEntry = pList->GetGradient( i );
+
+ aStr = pEntry->GetName();
+
+ if( rStr == aStr && rGradient == pEntry->GetGradient() )
+ bFound = sal_True;
+ }
+ if( bFound )
+ SelectEntryPos( (sal_uInt16) ( i - 1 + nDist ) );
+}
+
+/*************************************************************************
+|*
+|* Fuellt die Listbox (vorlaeufig) mit Strings
+|*
+\************************************************************************/
+
+void FillAttrLB::Fill( const XGradientList* pList )
+{
+ long nCount = pList->Count();
+ XGradientEntry* pEntry;
+ ListBox::SetUpdateMode( sal_False );
+
+ for( long i = 0; i < nCount; i++ )
+ {
+ pEntry = pList->GetGradient( i );
+ Bitmap* pBitmap = pList->GetBitmap( i );
+ if( pBitmap )
+ ListBox::InsertEntry( pEntry->GetName(), *pBitmap );
+ else
+ InsertEntry( pEntry->GetName() );
+ }
+ ListBox::SetUpdateMode( sal_True );
+}
+
+/*************************************************************************
+|*
+|* Konstruktor von BitmapLB
+|*
+\************************************************************************/
+
+BitmapLB::BitmapLB( Window* pParent, ResId Id, sal_Bool bUserDraw /*= sal_True*/ )
+: ListBox( pParent, Id ),
+ mpList( NULL ),
+ mbUserDraw( bUserDraw )
+{
+ aVD.SetOutputSizePixel( Size( 32, 16 ) );
+ EnableUserDraw( mbUserDraw );
+}
+
+/************************************************************************/
+
+void BitmapLB::SetVirtualDevice()
+{
+ if( aBitmap.GetSizePixel().Width() > 8 ||
+ aBitmap.GetSizePixel().Height() > 8 )
+ {
+ aVD.DrawBitmap( Point( 0, 0 ), Size( 32, 16 ), aBitmap );
+ }
+ else
+ {
+ aVD.DrawBitmap( Point( 0, 0 ), aBitmap );
+ aVD.DrawBitmap( Point( 8, 0 ), aBitmap );
+ aVD.DrawBitmap( Point( 16, 0 ), aBitmap );
+ aVD.DrawBitmap( Point( 24, 0 ), aBitmap );
+ aVD.DrawBitmap( Point( 0, 8 ), aBitmap );
+ aVD.DrawBitmap( Point( 8, 8 ), aBitmap );
+ aVD.DrawBitmap( Point( 16, 8 ), aBitmap );
+ aVD.DrawBitmap( Point( 24, 8 ), aBitmap );
+ }
+}
+
+/************************************************************************/
+
+void BitmapLB::Fill( const XBitmapList* pList )
+{
+ mpList = (XBitmapList*)pList;
+ XBitmapEntry* pEntry;
+ long nCount = pList->Count();
+
+ SetUpdateMode( sal_False );
+
+ if( mbUserDraw )
+ {
+ for( long i = 0; i < nCount; i++ )
+ InsertEntry( pList->GetBitmap( i )->GetName() );
+ }
+ else
+ {
+ for( long i = 0; i < nCount; i++ )
+ {
+ pEntry = pList->GetBitmap( i );
+ aBitmap = pEntry->GetXBitmap().GetBitmap();
+
+ SetVirtualDevice();
+
+ InsertEntry( pEntry->GetName(), aVD.GetBitmap( Point( 0, 2 ), Size( 32, 12 ) ) );
+ }
+ }
+
+ SetUpdateMode( sal_True );
+}
+
+void BitmapLB::UserDraw( const UserDrawEvent& rUDEvt )
+{
+ if( mpList != NULL )
+ {
+ // Draw bitmap
+ const Rectangle& rDrawRect = rUDEvt.GetRect();
+ Rectangle aRect( rDrawRect.nLeft+1, rDrawRect.nTop+1, rDrawRect.nLeft+33, rDrawRect.nBottom-1 );
+
+ sal_Int32 nId = rUDEvt.GetItemId();
+ if( nId >= 0 && nId <= mpList->Count() )
+ {
+ Rectangle aClipRect( rDrawRect.nLeft+1, rDrawRect.nTop+1, rDrawRect.nRight-1, rDrawRect.nBottom-1 );
+
+ OutputDevice* pDevice = rUDEvt.GetDevice();
+ pDevice->SetClipRegion( Region( aClipRect ) );
+
+ aBitmap = mpList->GetBitmap( nId )->GetXBitmap().GetBitmap();
+
+ long nPosBaseX = aRect.nLeft;
+ long nPosBaseY = aRect.nTop;
+
+ if( aBitmap.GetSizePixel().Width() > 8 ||
+ aBitmap.GetSizePixel().Height() > 8 )
+ {
+ pDevice->DrawBitmap( Point( nPosBaseX, nPosBaseY ), Size( 32, 16 ), aBitmap );
+ }
+ else
+ {
+ pDevice->DrawBitmap( Point( nPosBaseX+ 0, nPosBaseY+0 ), aBitmap );
+ pDevice->DrawBitmap( Point( nPosBaseX+ 8, nPosBaseY+0 ), aBitmap );
+ pDevice->DrawBitmap( Point( nPosBaseX+16, nPosBaseY+0 ), aBitmap );
+ pDevice->DrawBitmap( Point( nPosBaseX+24, nPosBaseY+0 ), aBitmap );
+ pDevice->DrawBitmap( Point( nPosBaseX+ 0, nPosBaseY+8 ), aBitmap );
+ pDevice->DrawBitmap( Point( nPosBaseX+ 8, nPosBaseY+8 ), aBitmap );
+ pDevice->DrawBitmap( Point( nPosBaseX+16, nPosBaseY+8 ), aBitmap );
+ pDevice->DrawBitmap( Point( nPosBaseX+24, nPosBaseY+8 ), aBitmap );
+ }
+
+ pDevice->SetClipRegion();
+
+ // Draw name
+ pDevice->DrawText( Point( aRect.nRight+7, aRect.nTop-1 ), mpList->GetBitmap( nId )->GetName() );
+ }
+ }
+}
+
+/************************************************************************/
+
+void BitmapLB::Append( XBitmapEntry* pEntry, Bitmap* pBmp )
+{
+ if( pBmp )
+ {
+ aBitmap = pEntry->GetXBitmap().GetBitmap();
+ SetVirtualDevice();
+ InsertEntry( pEntry->GetName(), aVD.GetBitmap( Point( 0, 2 ), Size( 32, 12 ) ) );
+ }
+ else
+ InsertEntry( pEntry->GetName() );
+}
+
+/************************************************************************/
+
+void BitmapLB::Modify( XBitmapEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp )
+{
+ RemoveEntry( nPos );
+
+ if( pBmp )
+ {
+ aBitmap = pEntry->GetXBitmap().GetBitmap();
+ SetVirtualDevice();
+
+ InsertEntry( pEntry->GetName(), aVD.GetBitmap( Point( 0, 2 ), Size( 32, 12 ) ), nPos );
+ }
+ else
+ InsertEntry( pEntry->GetName() );
+}
+
+/************************************************************************/
+
+void BitmapLB::SelectEntryByList( const XBitmapList* pList, const String& rStr,
+ const Bitmap& )
+{
+ long nCount = pList->Count();
+ XBitmapEntry* pEntry;
+ sal_Bool bFound = sal_False;
+
+ long i;
+ for( i = 0; i < nCount && !bFound; i++ )
+ {
+ pEntry = pList->GetBitmap( i );
+
+ String aStr = pEntry->GetName();
+ // Bitmap aBmp = pEntry->GetBitmap();
+
+ if( rStr == aStr )
+ {
+ bFound = sal_True;
+ }
+ }
+ if( bFound )
+ SelectEntryPos( (sal_uInt16) ( i - 1 ) );
+}
+
+/*************************************************************************
+|*
+|* Konstruktor von FillAttrLB
+|*
+\************************************************************************/
+
+FillAttrLB::FillAttrLB( Window* pParent, ResId Id ) :
+ ColorListBox( pParent, Id )
+{
+ aVD.SetOutputSizePixel( Size( 32, 16 ) );
+}
+
+/************************************************************************/
+
+FillAttrLB::FillAttrLB( Window* pParent, WinBits aWB ) :
+ ColorListBox( pParent, aWB )
+{
+ aVD.SetOutputSizePixel( Size( 32, 16 ) );
+}
+
+/************************************************************************/
+
+void FillAttrLB::SetVirtualDevice()
+{
+ if( aBitmap.GetSizePixel().Width() > 8 ||
+ aBitmap.GetSizePixel().Height() > 8 )
+ {
+ aVD.DrawBitmap( Point( 0, 0 ), Size( 32, 16 ), aBitmap );
+ }
+ else
+ {
+ aVD.DrawBitmap( Point( 0, 0 ), aBitmap );
+ aVD.DrawBitmap( Point( 8, 0 ), aBitmap );
+ aVD.DrawBitmap( Point( 16, 0 ), aBitmap );
+ aVD.DrawBitmap( Point( 24, 0 ), aBitmap );
+ aVD.DrawBitmap( Point( 0, 8 ), aBitmap );
+ aVD.DrawBitmap( Point( 8, 8 ), aBitmap );
+ aVD.DrawBitmap( Point( 16, 8 ), aBitmap );
+ aVD.DrawBitmap( Point( 24, 8 ), aBitmap );
+ }
+}
+
+/************************************************************************/
+
+void FillAttrLB::Fill( const XBitmapList* pList )
+{
+ long nCount = pList->Count();
+ XBitmapEntry* pEntry;
+ ListBox::SetUpdateMode( sal_False );
+
+ for( long i = 0; i < nCount; i++ )
+ {
+ pEntry = pList->GetBitmap( i );
+ aBitmap = pEntry->GetXBitmap().GetBitmap();
+
+ SetVirtualDevice();
+
+ ListBox::InsertEntry( pEntry->GetName(), aVD.GetBitmap( Point( 0, 2 ), Size( 32, 12 ) ) );
+ }
+ ListBox::SetUpdateMode( sal_True );
+}
+
+/************************************************************************/
+
+void FillAttrLB::SelectEntryByList( const XBitmapList* pList, const String& rStr,
+ const Bitmap& /*rBmp*/)
+{
+ long nCount = pList->Count();
+ XBitmapEntry* pEntry;
+ sal_Bool bFound = sal_False;
+
+ long i;
+ for( i = 0; i < nCount && !bFound; i++ )
+ {
+ pEntry = pList->GetBitmap( i );
+
+ String aStr = pEntry->GetName();
+ // Bitmap aBmp = pEntry->GetBitmap();
+
+ if( rStr == aStr )
+ {
+ bFound = sal_True;
+ }
+ /*
+ if( rStr == aStr && rBmp == aBmp )
+ bFound = sal_True; */
+ }
+ if( bFound )
+ SelectEntryPos( (sal_uInt16) ( i - 1 ) );
+}
+
+/*************************************************************************
+|*
+|* Fuellt die Listbox (vorlaeufig) mit Strings
+|*
+\************************************************************************/
+
+void FillTypeLB::Fill()
+{
+ SetUpdateMode( sal_False );
+ InsertEntry( String( SVX_RES( RID_SVXSTR_INVISIBLE ) ) );
+ InsertEntry( String( SVX_RES( RID_SVXSTR_COLOR ) ) );
+ InsertEntry( String( SVX_RES( RID_SVXSTR_GRADIENT ) ) );
+ InsertEntry( String( SVX_RES( RID_SVXSTR_HATCH ) ) );
+ InsertEntry( String( SVX_RES( RID_SVXSTR_BITMAP ) ) );
+ SetUpdateMode( sal_True );
+}
+
+/*************************************************************************
+|*
+|* Fuellt die Listbox (vorlaeufig) mit Strings
+|*
+\************************************************************************/
+
+void LineLB::Fill( const XDashList* pList )
+{
+ long nCount = pList->Count();
+ XDashEntry* pEntry;
+ SetUpdateMode( sal_False );
+
+ for( long i = 0; i < nCount; i++ )
+ {
+ pEntry = pList->GetDash( i );
+ Bitmap* pBitmap = const_cast<XDashList*>(pList)->CreateBitmapForUI( i );
+ if( pBitmap )
+ {
+ InsertEntry( pEntry->GetName(), *pBitmap );
+ delete pBitmap;
+ }
+ else
+ InsertEntry( pEntry->GetName() );
+ }
+ SetUpdateMode( sal_True );
+}
+
+void LineLB::FillStyles()
+{
+ ResMgr& rMgr = DIALOG_MGR();
+
+ // Linienstile
+ Clear();
+ InsertEntry( String( ResId( RID_SVXSTR_INVISIBLE, rMgr ) ) );
+
+ const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
+ Bitmap aBitmap ( SVX_RES ( RID_SVXCTRL_LINECTRL ) );
+ Color aSourceColors[2];
+ Color aDestColors[2];
+
+ aSourceColors[0] = Color( COL_WHITE );
+ aSourceColors[1] = Color( COL_BLACK );
+
+ aDestColors[0] = rStyles.GetFieldColor();
+ aDestColors[1] = rStyles.GetFieldTextColor();
+
+ aBitmap.Replace ( aSourceColors, aDestColors, 2 );
+ Image aSolidLine ( aBitmap );
+ InsertEntry( String( ResId( RID_SVXSTR_SOLID, rMgr ) ), aSolidLine );
+}
+
+/************************************************************************/
+
+void LineLB::Append( XDashEntry* pEntry, Bitmap* pBmp )
+{
+ if( pBmp )
+ InsertEntry( pEntry->GetName(), *pBmp );
+ else
+ InsertEntry( pEntry->GetName() );
+}
+
+/************************************************************************/
+
+void LineLB::Modify( XDashEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp )
+{
+ RemoveEntry( nPos );
+
+ if( pBmp )
+ InsertEntry( pEntry->GetName(), *pBmp, nPos );
+ else
+ InsertEntry( pEntry->GetName(), nPos );
+}
+
+/************************************************************************/
+
+void LineLB::SelectEntryByList( const XDashList* pList, const String& rStr,
+ const XDash& rDash, sal_uInt16 nDist )
+{
+ long nCount = pList->Count();
+ XDashEntry* pEntry;
+ sal_Bool bFound = sal_False;
+ String aStr;
+ XDash aDash;
+
+ long i;
+ for( i = 0; i < nCount && !bFound; i++ )
+ {
+ pEntry = pList->GetDash( i );
+
+ aStr = pEntry->GetName();
+ aDash = pEntry->GetDash();
+
+ if( rStr == aStr && rDash == aDash )
+ bFound = sal_True;
+ }
+ if( bFound )
+ SelectEntryPos( (sal_uInt16) ( i - 1 + nDist ) );
+}
+
+/*************************************************************************
+|*
+|* Fuellt die Listbox (vorlaeufig) mit Strings
+|*
+\************************************************************************/
+
+void LineEndLB::Fill( const XLineEndList* pList, sal_Bool bStart )
+{
+ long nCount = pList->Count();
+ XLineEndEntry* pEntry;
+ VirtualDevice aVD;
+ SetUpdateMode( sal_False );
+
+ for( long i = 0; i < nCount; i++ )
+ {
+ pEntry = pList->GetLineEnd( i );
+ Bitmap* pBitmap = const_cast<XLineEndList*>(pList)->CreateBitmapForUI( i );
+ if( pBitmap )
+ {
+ Size aBmpSize( pBitmap->GetSizePixel() );
+ aVD.SetOutputSizePixel( aBmpSize, sal_False );
+ aVD.DrawBitmap( Point(), *pBitmap );
+ InsertEntry( pEntry->GetName(),
+ aVD.GetBitmap( bStart ? Point() : Point( aBmpSize.Width() / 2, 0 ),
+ Size( aBmpSize.Width() / 2, aBmpSize.Height() ) ) );
+
+ delete pBitmap;
+ }
+ else
+ InsertEntry( pEntry->GetName() );
+ }
+ SetUpdateMode( sal_True );
+}
+
+/************************************************************************/
+
+void LineEndLB::Append( XLineEndEntry* pEntry, Bitmap* pBmp,
+ sal_Bool bStart )
+{
+ if( pBmp )
+ {
+ VirtualDevice aVD;
+ Size aBmpSize( pBmp->GetSizePixel() );
+
+ aVD.SetOutputSizePixel( aBmpSize, sal_False );
+ aVD.DrawBitmap( Point(), *pBmp );
+ InsertEntry( pEntry->GetName(),
+ aVD.GetBitmap( bStart ? Point() : Point( aBmpSize.Width() / 2, 0 ),
+ Size( aBmpSize.Width() / 2, aBmpSize.Height() ) ) );
+ }
+ else
+ InsertEntry( pEntry->GetName() );
+}
+
+/************************************************************************/
+
+void LineEndLB::Modify( XLineEndEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp,
+ sal_Bool bStart )
+{
+ RemoveEntry( nPos );
+
+ if( pBmp )
+ {
+ VirtualDevice aVD;
+ Size aBmpSize( pBmp->GetSizePixel() );
+
+ aVD.SetOutputSizePixel( aBmpSize, sal_False );
+ aVD.DrawBitmap( Point(), *pBmp );
+ InsertEntry( pEntry->GetName(),
+ aVD.GetBitmap( bStart ? Point() : Point( aBmpSize.Width() / 2, 0 ),
+ Size( aBmpSize.Width() / 2, aBmpSize.Height() ) ), nPos );
+ }
+ else
+ InsertEntry( pEntry->GetName(), nPos );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SvxPreviewBase::InitSettings(bool bForeground, bool bBackground)
+{
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+
+ if(bForeground)
+ {
+ svtools::ColorConfig aColorConfig;
+ Color aTextColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
+
+ if(IsControlForeground())
+ {
+ aTextColor = GetControlForeground();
+ }
+
+ getBufferDevice().SetTextColor(aTextColor);
+ }
+
+ if(bBackground)
+ {
+ if(IsControlBackground())
+ {
+ getBufferDevice().SetBackground(GetControlBackground());
+ }
+ else
+ {
+ getBufferDevice().SetBackground(rStyleSettings.GetWindowColor());
+ }
+ }
+
+ // do not paint background self, it gets painted buffered
+ SetControlBackground();
+ SetBackground();
+
+ Invalidate();
+}
+
+SvxPreviewBase::SvxPreviewBase( Window* pParent, const ResId& rResId )
+: Control( pParent, rResId ),
+ mpModel( new SdrModel() ),
+ mpBufferDevice( new VirtualDevice(*this) )
+{
+ // Draw the control's border as a flat thin black line.
+ SetBorderStyle(WINDOW_BORDER_MONO);
+ SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR );
+ SetMapMode(MAP_100TH_MM);
+
+ // init model
+ mpModel->GetItemPool().FreezeIdRanges();
+}
+
+SvxPreviewBase::~SvxPreviewBase()
+{
+ delete mpModel;
+ delete mpBufferDevice;
+}
+
+void SvxPreviewBase::LocalPrePaint()
+{
+ // init BufferDevice
+ if(mpBufferDevice->GetOutputSizePixel() != GetOutputSizePixel())
+ {
+ mpBufferDevice->SetDrawMode(GetDrawMode());
+ mpBufferDevice->SetSettings(GetSettings());
+ mpBufferDevice->SetAntialiasing(GetAntialiasing());
+ mpBufferDevice->SetOutputSizePixel(GetOutputSizePixel());
+ mpBufferDevice->SetMapMode(GetMapMode());
+ }
+
+ mpBufferDevice->Erase();
+}
+
+void SvxPreviewBase::LocalPostPaint()
+{
+ // copy to front (in pixel mode)
+ const bool bWasEnabledSrc(mpBufferDevice->IsMapModeEnabled());
+ const bool bWasEnabledDst(IsMapModeEnabled());
+ const Point aEmptyPoint;
+
+ mpBufferDevice->EnableMapMode(false);
+ EnableMapMode(false);
+
+ DrawOutDev(
+ aEmptyPoint, GetOutputSizePixel(),
+ aEmptyPoint, GetOutputSizePixel(),
+ *mpBufferDevice);
+
+ mpBufferDevice->EnableMapMode(bWasEnabledSrc);
+ EnableMapMode(bWasEnabledDst);
+}
+
+void SvxPreviewBase::StateChanged(StateChangedType nType)
+{
+ Control::StateChanged(nType);
+
+ if(STATE_CHANGE_CONTROLFOREGROUND == nType)
+ {
+ InitSettings(true, false);
+ }
+ else if(STATE_CHANGE_CONTROLBACKGROUND == nType)
+ {
+ InitSettings(false, true);
+ }
+}
+
+void SvxPreviewBase::DataChanged(const DataChangedEvent& rDCEvt)
+{
+ SetDrawMode(GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR);
+
+ if((DATACHANGED_SETTINGS == rDCEvt.GetType()) && (rDCEvt.GetFlags() & SETTINGS_STYLE))
+ {
+ InitSettings(true, true);
+ }
+ else
+ {
+ Control::DataChanged(rDCEvt);
+ }
+}
+
+/*************************************************************************
+|*
+|* SvxXLinePreview::SvxXLinePreview()
+|*
+*************************************************************************/
+
+SvxXLinePreview::SvxXLinePreview( Window* pParent, const ResId& rResId )
+: SvxPreviewBase( pParent, rResId ),
+ mpLineObjA( 0L ),
+ mpLineObjB( 0L ),
+ mpLineObjC( 0L ),
+ mpGraphic( 0L ),
+ mbWithSymbol( sal_False )
+{
+ const Size aOutputSize(GetOutputSize());
+ InitSettings( sal_True, sal_True );
+
+ const sal_Int32 nDistance(500L);
+ const sal_Int32 nAvailableLength(aOutputSize.Width() - (4 * nDistance));
+
+ // create DrawObectA
+ const sal_Int32 aYPosA(aOutputSize.Height() / 2);
+ const basegfx::B2DPoint aPointA1( nDistance, aYPosA);
+ const basegfx::B2DPoint aPointA2( aPointA1.getX() + ((nAvailableLength * 14) / 20), aYPosA );
+ basegfx::B2DPolygon aPolygonA;
+ aPolygonA.append(aPointA1);
+ aPolygonA.append(aPointA2);
+ mpLineObjA = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPolygonA));
+ mpLineObjA->SetModel(&getModel());
+
+ // create DrawObectB
+ const sal_Int32 aYPosB1((aOutputSize.Height() * 3) / 4);
+ const sal_Int32 aYPosB2((aOutputSize.Height() * 1) / 4);
+ const basegfx::B2DPoint aPointB1( aPointA2.getX() + nDistance, aYPosB1);
+ const basegfx::B2DPoint aPointB2( aPointB1.getX() + ((nAvailableLength * 2) / 20), aYPosB2 );
+ const basegfx::B2DPoint aPointB3( aPointB2.getX() + ((nAvailableLength * 2) / 20), aYPosB1 );
+ basegfx::B2DPolygon aPolygonB;
+ aPolygonB.append(aPointB1);
+ aPolygonB.append(aPointB2);
+ aPolygonB.append(aPointB3);
+ mpLineObjB = new SdrPathObj(OBJ_PLIN, basegfx::B2DPolyPolygon(aPolygonB));
+ mpLineObjB->SetModel(&getModel());
+
+ // create DrawObectC
+ const basegfx::B2DPoint aPointC1( aPointB3.getX() + nDistance, aYPosB1);
+ const basegfx::B2DPoint aPointC2( aPointC1.getX() + ((nAvailableLength * 1) / 20), aYPosB2 );
+ const basegfx::B2DPoint aPointC3( aPointC2.getX() + ((nAvailableLength * 1) / 20), aYPosB1 );
+ basegfx::B2DPolygon aPolygonC;
+ aPolygonC.append(aPointC1);
+ aPolygonC.append(aPointC2);
+ aPolygonC.append(aPointC3);
+ mpLineObjC = new SdrPathObj(OBJ_PLIN, basegfx::B2DPolyPolygon(aPolygonC));
+ mpLineObjC->SetModel(&getModel());
+}
+
+SvxXLinePreview::~SvxXLinePreview()
+{
+ SdrObject::Free( mpLineObjA );
+ SdrObject::Free( mpLineObjB );
+ SdrObject::Free( mpLineObjC );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxXLinePreview::SetSymbol(Graphic* p,const Size& s)
+{
+ mpGraphic = p;
+ maSymbolSize = s;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxXLinePreview::ResizeSymbol(const Size& s)
+{
+ if ( s != maSymbolSize )
+ {
+ maSymbolSize = s;
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxXLinePreview::SetLineAttributes(const SfxItemSet& rItemSet)
+{
+ // Set ItemSet at objects
+ mpLineObjA->SetMergedItemSet(rItemSet);
+
+ // At line joints, do not use arrows
+ SfxItemSet aTempSet(rItemSet);
+ aTempSet.ClearItem(XATTR_LINESTART);
+ aTempSet.ClearItem(XATTR_LINEEND);
+
+ mpLineObjB->SetMergedItemSet(aTempSet);
+ mpLineObjC->SetMergedItemSet(aTempSet);
+}
+
+// -----------------------------------------------------------------------
+
+void SvxXLinePreview::Paint( const Rectangle& )
+{
+ LocalPrePaint();
+
+ // paint objects to buffer device
+ sdr::contact::SdrObjectVector aObjectVector;
+ aObjectVector.push_back(mpLineObjA);
+ aObjectVector.push_back(mpLineObjB);
+ aObjectVector.push_back(mpLineObjC);
+
+ sdr::contact::ObjectContactOfObjListPainter aPainter(getBufferDevice(), aObjectVector, 0);
+ sdr::contact::DisplayInfo aDisplayInfo;
+
+ // do processing
+ aPainter.ProcessDisplay(aDisplayInfo);
+
+ if ( mbWithSymbol && mpGraphic )
+ {
+ const Size aOutputSize(GetOutputSize());
+ Point aPos = Point( aOutputSize.Width() / 3, aOutputSize.Height() / 2 );
+ aPos.X() -= maSymbolSize.Width() / 2;
+ aPos.Y() -= maSymbolSize.Height() / 2;
+ mpGraphic->Draw( &getBufferDevice(), aPos, maSymbolSize );
+ }
+
+ LocalPostPaint();
+}
+
+/*************************************************************************
+|*
+|* SvxXRectPreview::SvxXRectPreview()
+|*
+*************************************************************************/
+
+SvxXRectPreview::SvxXRectPreview( Window* pParent, const ResId& rResId )
+: SvxPreviewBase( pParent, rResId ),
+ mpRectangleObject(0)
+{
+ InitSettings(true, true);
+
+ // create RectangleObject
+ const Rectangle aObjectSize(Point(), GetOutputSize());
+ mpRectangleObject = new SdrRectObj(aObjectSize);
+ mpRectangleObject->SetModel(&getModel());
+}
+
+SvxXRectPreview::~SvxXRectPreview()
+{
+ SdrObject::Free(mpRectangleObject);
+}
+
+void SvxXRectPreview::SetAttributes(const SfxItemSet& rItemSet)
+{
+ mpRectangleObject->SetMergedItemSet(rItemSet, true);
+ mpRectangleObject->SetMergedItem(XLineStyleItem(XLINE_NONE));
+}
+
+void SvxXRectPreview::Paint( const Rectangle& )
+{
+ LocalPrePaint();
+
+ sdr::contact::SdrObjectVector aObjectVector;
+
+ aObjectVector.push_back(mpRectangleObject);
+
+ sdr::contact::ObjectContactOfObjListPainter aPainter(getBufferDevice(), aObjectVector, 0);
+ sdr::contact::DisplayInfo aDisplayInfo;
+
+ aPainter.ProcessDisplay(aDisplayInfo);
+
+ LocalPostPaint();
+}
+
+/*************************************************************************
+|*
+|* SvxXShadowPreview::SvxXShadowPreview()
+|*
+*************************************************************************/
+
+SvxXShadowPreview::SvxXShadowPreview( Window* pParent, const ResId& rResId )
+: SvxPreviewBase( pParent, rResId ),
+ mpRectangleObject(0),
+ mpRectangleShadow(0)
+{
+ InitSettings(true, true);
+
+ // prepare size
+ Size aSize = GetOutputSize();
+ aSize.Width() = aSize.Width() / 3;
+ aSize.Height() = aSize.Height() / 3;
+
+ // create RectangleObject
+ const Rectangle aObjectSize( Point( aSize.Width(), aSize.Height() ), aSize );
+ mpRectangleObject = new SdrRectObj(aObjectSize);
+ mpRectangleObject->SetModel(&getModel());
+
+ // create ShadowObject
+ const Rectangle aShadowSize( Point( aSize.Width(), aSize.Height() ), aSize );
+ mpRectangleShadow = new SdrRectObj(aShadowSize);
+ mpRectangleShadow->SetModel(&getModel());
+}
+
+SvxXShadowPreview::~SvxXShadowPreview()
+{
+ SdrObject::Free(mpRectangleObject);
+ SdrObject::Free(mpRectangleShadow);
+}
+
+void SvxXShadowPreview::SetRectangleAttributes(const SfxItemSet& rItemSet)
+{
+ mpRectangleObject->SetMergedItemSet(rItemSet, true);
+ mpRectangleObject->SetMergedItem(XLineStyleItem(XLINE_NONE));
+}
+
+void SvxXShadowPreview::SetShadowAttributes(const SfxItemSet& rItemSet)
+{
+ mpRectangleShadow->SetMergedItemSet(rItemSet, true);
+ mpRectangleShadow->SetMergedItem(XLineStyleItem(XLINE_NONE));
+}
+
+void SvxXShadowPreview::SetShadowPosition(const Point& rPos)
+{
+ Rectangle aObjectPosition(mpRectangleObject->GetSnapRect());
+ aObjectPosition.Move(rPos.X(), rPos.Y());
+ mpRectangleShadow->SetSnapRect(aObjectPosition);
+}
+
+void SvxXShadowPreview::Paint( const Rectangle& )
+{
+ LocalPrePaint();
+
+ sdr::contact::SdrObjectVector aObjectVector;
+
+ aObjectVector.push_back(mpRectangleShadow);
+ aObjectVector.push_back(mpRectangleObject);
+
+ sdr::contact::ObjectContactOfObjListPainter aPainter(getBufferDevice(), aObjectVector, 0);
+ sdr::contact::DisplayInfo aDisplayInfo;
+
+ aPainter.ProcessDisplay(aDisplayInfo);
+
+ LocalPostPaint();
+}
+
+// -----------------------------------------------------------------------
+// eof
diff --git a/svx/source/dialog/dlgctrl.src b/svx/source/dialog/dlgctrl.src
new file mode 100644
index 000000000000..2da544673c65
--- /dev/null
+++ b/svx/source/dialog/dlgctrl.src
@@ -0,0 +1,34 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svx/dialogs.hrc>
+
+Bitmap RID_SVXCTRL_RECTBTNS
+{
+ File = "rectbtns.bmp" ;
+};
+
diff --git a/svx/source/dialog/dlgutil.cxx b/svx/source/dialog/dlgutil.cxx
new file mode 100644
index 000000000000..44a9762a023a
--- /dev/null
+++ b/svx/source/dialog/dlgutil.cxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#include "svx/dlgutil.hxx"
+#include <svl/itemset.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <sfx2/module.hxx>
+#include <svl/intitem.hxx>
+
+// -----------------------------------------------------------------------
+
+FieldUnit GetModuleFieldUnit( const SfxItemSet& rSet )
+{
+ FieldUnit eUnit = FUNIT_INCH;
+ const SfxPoolItem* pItem = NULL;
+ if ( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_METRIC, sal_False, &pItem ) )
+ eUnit = (FieldUnit)( (const SfxUInt16Item*)pItem )->GetValue();
+ else
+ {
+ DBG_ERROR("Using fallback for field unit - field unit should be provided in ItemSet");
+ return SfxModule::GetCurrentFieldUnit();
+ }
+
+ return eUnit;
+}
+
diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx
new file mode 100644
index 000000000000..da320eea50d7
--- /dev/null
+++ b/svx/source/dialog/docrecovery.cxx
@@ -0,0 +1,2181 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/dialmgr.hxx>
+
+#include <svx/dialogs.hrc>
+#include "docrecovery.hxx"
+#include "docrecovery.hrc"
+
+#include <comphelper/processfactory.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+#include <comphelper/configurationhelper.hxx>
+#include <svtools/imagemgr.hxx>
+#include <svtools/xtextedt.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <vcl/scrbar.hxx>
+
+#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
+#include <toolkit/unohlp.hxx>
+#endif
+
+//#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+//#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/util/URL.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <osl/file.hxx>
+#include <osl/security.hxx>
+#include <rtl/bootstrap.hxx>
+#include <unotools/pathoptions.hxx>
+#include <unotools/localfilehelper.hxx>
+
+#define RET_BACK 100
+
+//===============================================
+// namespace
+namespace svx{
+ namespace DocRecovery{
+
+namespace css = ::com::sun::star;
+
+using namespace ::rtl;
+using namespace ::osl;
+
+//===============================================
+TabDialog4Recovery::TabDialog4Recovery(Window* pParent)
+ : TabDialog (pParent, SVX_RES( RID_SVX_TABDLG_DOCRECOVERY ))
+ , m_pActualPage(m_lTabPages.begin() )
+{
+}
+
+//===============================================
+TabDialog4Recovery::~TabDialog4Recovery()
+{
+ m_lTabPages.clear();
+}
+
+//===============================================
+void TabDialog4Recovery::addTabPage(IExtendedTabPage* pPage)
+{
+ if (pPage)
+ m_lTabPages.push_back(pPage);
+}
+
+//===============================================
+short TabDialog4Recovery::Execute()
+{
+ ::vos::OGuard aLock(Application::GetSolarMutex());
+
+ Show();
+ m_pActualPage = m_lTabPages.begin();
+ while(sal_True)
+ {
+ IExtendedTabPage* pPage = *m_pActualPage;
+ SetViewWindow(pPage);
+ pPage->Show();
+ pPage->setDefButton();
+ short nRet = pPage->execute();
+ pPage->Hide();
+
+ switch(nRet)
+ {
+ case DLG_RET_OK :
+ {
+ ++m_pActualPage;
+ if (m_pActualPage == m_lTabPages.end())
+ return nRet;
+ }
+ break;
+
+ case DLG_RET_BACK :
+ {
+ if (m_pActualPage != m_lTabPages.begin())
+ --m_pActualPage;
+ }
+ break;
+
+ case DLG_RET_UNKNOWN :
+ case DLG_RET_CANCEL :
+ case DLG_RET_OK_AUTOLUNCH :
+ return nRet;
+ }
+ }
+}
+
+//===============================================
+RecoveryCore::RecoveryCore(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
+ sal_Bool bUsedForSaving)
+ : m_xSMGR ( xSMGR )
+ , m_pListener ( 0 )
+ , m_bListenForSaving(bUsedForSaving)
+{
+ impl_startListening();
+}
+
+//===============================================
+RecoveryCore::~RecoveryCore()
+{
+ impl_stopListening();
+}
+
+//===============================================
+css::uno::Reference< css::lang::XMultiServiceFactory > RecoveryCore::getSMGR()
+{
+ return m_xSMGR;
+}
+
+//===============================================
+TURLList* RecoveryCore::getURLListAccess()
+{
+ return &m_lURLs;
+}
+
+//===============================================
+sal_Bool RecoveryCore::existsBrokenTempEntries()
+{
+ TURLList::const_iterator pIt;
+ for ( pIt = m_lURLs.begin();
+ pIt != m_lURLs.end() ;
+ ++pIt )
+ {
+ const TURLInfo& rInfo = *pIt;
+ if (RecoveryCore::isBrokenTempEntry(rInfo))
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+//===============================================
+sal_Bool RecoveryCore::existsNonRecoveredEntries()
+{
+ TURLList::const_iterator pIt;
+ for ( pIt = m_lURLs.begin();
+ pIt != m_lURLs.end() ;
+ ++pIt )
+ {
+ const TURLInfo& rInfo = *pIt;
+ if (rInfo.RecoveryState == E_NOT_RECOVERED_YET)
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+//===============================================
+sal_Bool RecoveryCore::isBrokenTempEntry(const TURLInfo& rInfo)
+{
+ if (!rInfo.TempURL.getLength())
+ return sal_False;
+
+ // Note: If the original files was recovery ... but a temp file
+ // exists ... an error inside the temp file exists!
+ if (
+ !(rInfo.RecoveryState == E_RECOVERY_FAILED ) &&
+ !(rInfo.RecoveryState == E_ORIGINAL_DOCUMENT_RECOVERED)
+ )
+ return sal_False;
+
+ return sal_True;
+}
+
+//===============================================
+void RecoveryCore::saveBrokenTempEntries(const ::rtl::OUString& sPath)
+{
+ if (!sPath.getLength())
+ return;
+
+ if (!m_xRealCore.is())
+ return;
+
+ // prepare all needed parameters for the following dispatch() request.
+ css::util::URL aCopyURL = impl_getParsedURL(RECOVERY_CMD_DO_ENTRY_BACKUP);
+ css::uno::Sequence< css::beans::PropertyValue > lCopyArgs(3);
+ lCopyArgs[0].Name = PROP_DISPATCHASYNCHRON;
+ lCopyArgs[0].Value <<= sal_False;
+ lCopyArgs[1].Name = PROP_SAVEPATH;
+ lCopyArgs[1].Value <<= sPath;
+ lCopyArgs[2].Name = PROP_ENTRYID;
+ // lCopyArgs[2].Value will be changed during next loop ...
+
+ // work on a copied list only ...
+ // Reason: We will get notifications from the core for every
+ // changed or removed element. And that will change our m_lURLs list.
+ // That's not a good idea, if we use a stl iterator inbetween .-)
+ TURLList lURLs = m_lURLs;
+ TURLList::const_iterator pIt;
+ for ( pIt = lURLs.begin();
+ pIt != lURLs.end() ;
+ ++pIt )
+ {
+ const TURLInfo& rInfo = *pIt;
+ if (!RecoveryCore::isBrokenTempEntry(rInfo))
+ continue;
+
+ lCopyArgs[2].Value <<= rInfo.ID;
+ m_xRealCore->dispatch(aCopyURL, lCopyArgs);
+ }
+}
+
+//===============================================
+void RecoveryCore::saveAllTempEntries(const ::rtl::OUString& sPath)
+{
+ if (!sPath.getLength())
+ return;
+
+ if (!m_xRealCore.is())
+ return;
+
+ // prepare all needed parameters for the following dispatch() request.
+ css::util::URL aCopyURL = impl_getParsedURL(RECOVERY_CMD_DO_ENTRY_BACKUP);
+ css::uno::Sequence< css::beans::PropertyValue > lCopyArgs(3);
+ lCopyArgs[0].Name = PROP_DISPATCHASYNCHRON;
+ lCopyArgs[0].Value <<= sal_False;
+ lCopyArgs[1].Name = PROP_SAVEPATH;
+ lCopyArgs[1].Value <<= sPath;
+ lCopyArgs[2].Name = PROP_ENTRYID;
+ // lCopyArgs[2].Value will be changed during next loop ...
+
+ // work on a copied list only ...
+ // Reason: We will get notifications from the core for every
+ // changed or removed element. And that will change our m_lURLs list.
+ // That's not a good idea, if we use a stl iterator inbetween .-)
+ TURLList lURLs = m_lURLs;
+ TURLList::const_iterator pIt;
+ for ( pIt = lURLs.begin();
+ pIt != lURLs.end() ;
+ ++pIt )
+ {
+ const TURLInfo& rInfo = *pIt;
+ if (!rInfo.TempURL.getLength())
+ continue;
+
+ lCopyArgs[2].Value <<= rInfo.ID;
+ m_xRealCore->dispatch(aCopyURL, lCopyArgs);
+ }
+}
+
+//===============================================
+void RecoveryCore::forgetBrokenTempEntries()
+{
+ if (!m_xRealCore.is())
+ return;
+
+ css::util::URL aRemoveURL = impl_getParsedURL(RECOVERY_CMD_DO_ENTRY_CLEANUP);
+ css::uno::Sequence< css::beans::PropertyValue > lRemoveArgs(2);
+ lRemoveArgs[0].Name = PROP_DISPATCHASYNCHRON;
+ lRemoveArgs[0].Value <<= sal_False;
+ lRemoveArgs[1].Name = PROP_ENTRYID;
+ // lRemoveArgs[1].Value will be changed during next loop ...
+
+ // work on a copied list only ...
+ // Reason: We will get notifications from the core for every
+ // changed or removed element. And that will change our m_lURLs list.
+ // That's not a good idea, if we use a stl iterator inbetween .-)
+ TURLList lURLs = m_lURLs;
+ TURLList::const_iterator pIt;
+ for ( pIt = lURLs.begin();
+ pIt != lURLs.end() ;
+ ++pIt )
+ {
+ const TURLInfo& rInfo = *pIt;
+ if (!RecoveryCore::isBrokenTempEntry(rInfo))
+ continue;
+
+ lRemoveArgs[1].Value <<= rInfo.ID;
+ m_xRealCore->dispatch(aRemoveURL, lRemoveArgs);
+ }
+}
+
+//===============================================
+void RecoveryCore::forgetAllRecoveryEntries()
+{
+ if (!m_xRealCore.is())
+ return;
+
+ css::util::URL aRemoveURL = impl_getParsedURL(RECOVERY_CMD_DO_ENTRY_CLEANUP);
+ css::uno::Sequence< css::beans::PropertyValue > lRemoveArgs(2);
+ lRemoveArgs[0].Name = PROP_DISPATCHASYNCHRON;
+ lRemoveArgs[0].Value <<= sal_False;
+ lRemoveArgs[1].Name = PROP_ENTRYID;
+ // lRemoveArgs[1].Value will be changed during next loop ...
+
+ // work on a copied list only ...
+ // Reason: We will get notifications from the core for every
+ // changed or removed element. And that will change our m_lURLs list.
+ // That's not a good idea, if we use a stl iterator inbetween .-)
+ TURLList lURLs = m_lURLs;
+ TURLList::const_iterator pIt;
+ for ( pIt = lURLs.begin();
+ pIt != lURLs.end() ;
+ ++pIt )
+ {
+ const TURLInfo& rInfo = *pIt;
+ lRemoveArgs[1].Value <<= rInfo.ID;
+ m_xRealCore->dispatch(aRemoveURL, lRemoveArgs);
+ }
+}
+
+//===============================================
+void RecoveryCore::forgetBrokenRecoveryEntries()
+{
+ if (!m_xRealCore.is())
+ return;
+
+ css::util::URL aRemoveURL = impl_getParsedURL(RECOVERY_CMD_DO_ENTRY_CLEANUP);
+ css::uno::Sequence< css::beans::PropertyValue > lRemoveArgs(2);
+ lRemoveArgs[0].Name = PROP_DISPATCHASYNCHRON;
+ lRemoveArgs[0].Value <<= sal_False;
+ lRemoveArgs[1].Name = PROP_ENTRYID;
+ // lRemoveArgs[1].Value will be changed during next loop ...
+
+ // work on a copied list only ...
+ // Reason: We will get notifications from the core for every
+ // changed or removed element. And that will change our m_lURLs list.
+ // That's not a good idea, if we use a stl iterator inbetween .-)
+ TURLList lURLs = m_lURLs;
+ TURLList::const_iterator pIt;
+ for ( pIt = lURLs.begin();
+ pIt != lURLs.end() ;
+ ++pIt )
+ {
+ const TURLInfo& rInfo = *pIt;
+ if (!RecoveryCore::isBrokenTempEntry(rInfo))
+ continue;
+
+ lRemoveArgs[1].Value <<= rInfo.ID;
+ m_xRealCore->dispatch(aRemoveURL, lRemoveArgs);
+ }
+}
+
+//===============================================
+void RecoveryCore::setProgressHandler(const css::uno::Reference< css::task::XStatusIndicator >& xProgress)
+{
+ m_xProgress = xProgress;
+}
+
+//===============================================
+void RecoveryCore::setUpdateListener(IRecoveryUpdateListener* pListener)
+{
+ m_pListener = pListener;
+}
+
+//===============================================
+void RecoveryCore::doEmergencySavePrepare()
+{
+ if (!m_xRealCore.is())
+ return;
+
+ css::util::URL aURL = impl_getParsedURL(RECOVERY_CMD_DO_PREPARE_EMERGENCY_SAVE);
+
+ css::uno::Sequence< css::beans::PropertyValue > lArgs(1);
+ lArgs[0].Name = PROP_DISPATCHASYNCHRON;
+ lArgs[0].Value <<= sal_False;
+
+ m_xRealCore->dispatch(aURL, lArgs);
+}
+
+//===============================================
+void RecoveryCore::doEmergencySave()
+{
+ if (!m_xRealCore.is())
+ return;
+
+ css::util::URL aURL = impl_getParsedURL(RECOVERY_CMD_DO_EMERGENCY_SAVE);
+
+ css::uno::Sequence< css::beans::PropertyValue > lArgs(2);
+ lArgs[0].Name = PROP_STATUSINDICATOR;
+ lArgs[0].Value <<= m_xProgress;
+ lArgs[1].Name = PROP_DISPATCHASYNCHRON;
+ lArgs[1].Value <<= sal_True;
+
+ m_xRealCore->dispatch(aURL, lArgs);
+}
+
+//===============================================
+void RecoveryCore::doRecovery()
+{
+ if (!m_xRealCore.is())
+ return;
+
+ css::util::URL aURL = impl_getParsedURL(RECOVERY_CMD_DO_RECOVERY);
+
+ css::uno::Sequence< css::beans::PropertyValue > lArgs(2);
+ lArgs[0].Name = PROP_STATUSINDICATOR;
+ lArgs[0].Value <<= m_xProgress;
+ lArgs[1].Name = PROP_DISPATCHASYNCHRON;
+ lArgs[1].Value <<= sal_True;
+
+ m_xRealCore->dispatch(aURL, lArgs);
+}
+
+//===============================================
+ERecoveryState RecoveryCore::mapDocState2RecoverState(sal_Int32 eDocState)
+{
+ // ???
+ ERecoveryState eRecState = E_NOT_RECOVERED_YET;
+
+ /* Attention:
+ Some of the following states can occure at the
+ same time. So we have to check for the "worst case" first!
+
+ DAMAGED -> INCOMPLETE -> HANDLED
+ */
+
+ // running ...
+ if (
+ ((eDocState & E_TRY_LOAD_BACKUP ) == E_TRY_LOAD_BACKUP ) ||
+ ((eDocState & E_TRY_LOAD_ORIGINAL) == E_TRY_LOAD_ORIGINAL)
+ )
+ eRecState = E_RECOVERY_IS_IN_PROGRESS;
+ // red
+ else
+ if ((eDocState & E_DAMAGED) == E_DAMAGED)
+ eRecState = E_RECOVERY_FAILED;
+ // yellow
+ else
+ if ((eDocState & E_INCOMPLETE) == E_INCOMPLETE)
+ eRecState = E_ORIGINAL_DOCUMENT_RECOVERED;
+ // green
+ else
+ if ((eDocState & E_SUCCEDED) == E_SUCCEDED)
+ eRecState = E_SUCCESSFULLY_RECOVERED;
+
+ return eRecState;
+}
+
+//===============================================
+void SAL_CALL RecoveryCore::statusChanged(const css::frame::FeatureStateEvent& aEvent)
+ throw(css::uno::RuntimeException)
+{
+ // a) special notification about start/stop async dispatch!
+ // FeatureDescriptor = "start" || "stop"
+ if (aEvent.FeatureDescriptor.equals(RECOVERY_OPERATIONSTATE_START))
+ {
+ if (m_pListener)
+ m_pListener->start();
+ return;
+ }
+
+ if (aEvent.FeatureDescriptor.equals(RECOVERY_OPERATIONSTATE_STOP))
+ {
+ if (m_pListener)
+ m_pListener->end();
+ return;
+ }
+
+ // b) normal notification about changed items
+ // FeatureDescriptor = "Update"
+ // State = Lits of informations [seq< NamedValue >]
+ if (! aEvent.FeatureDescriptor.equals(RECOVERY_OPERATIONSTATE_UPDATE))
+ return;
+
+ ::comphelper::SequenceAsHashMap lInfo(aEvent.State);
+ TURLInfo aNew;
+
+ aNew.ID = lInfo.getUnpackedValueOrDefault(STATEPROP_ID , (sal_Int32)0 );
+ aNew.DocState = lInfo.getUnpackedValueOrDefault(STATEPROP_STATE , (sal_Int32)0 );
+ aNew.OrgURL = lInfo.getUnpackedValueOrDefault(STATEPROP_ORGURL , ::rtl::OUString());
+ aNew.TempURL = lInfo.getUnpackedValueOrDefault(STATEPROP_TEMPURL , ::rtl::OUString());
+ aNew.FactoryURL = lInfo.getUnpackedValueOrDefault(STATEPROP_FACTORYURL , ::rtl::OUString());
+ aNew.TemplateURL = lInfo.getUnpackedValueOrDefault(STATEPROP_TEMPLATEURL, ::rtl::OUString());
+ aNew.DisplayName = lInfo.getUnpackedValueOrDefault(STATEPROP_TITLE , ::rtl::OUString());
+ aNew.Module = lInfo.getUnpackedValueOrDefault(STATEPROP_MODULE , ::rtl::OUString());
+
+ // search for already existing items and update her nState value ...
+ TURLList::iterator pIt;
+ for ( pIt = m_lURLs.begin();
+ pIt != m_lURLs.end() ;
+ ++pIt )
+ {
+ TURLInfo& aOld = *pIt;
+ if (aOld.ID == aNew.ID)
+ {
+ // change existing
+ aOld.DocState = aNew.DocState;
+ aOld.RecoveryState = RecoveryCore::mapDocState2RecoverState(aOld.DocState);
+ if (m_pListener)
+ {
+ m_pListener->updateItems();
+ m_pListener->stepNext(&aOld);
+ }
+ return;
+ }
+ }
+
+ // append as new one
+ // TODO think about mmatching Module name to a corresponding icon
+ String sURL = aNew.OrgURL;
+ if (!sURL.Len())
+ sURL = aNew.FactoryURL;
+ if (!sURL.Len())
+ sURL = aNew.TempURL;
+ if (!sURL.Len())
+ sURL = aNew.TemplateURL;
+ INetURLObject aURL(sURL);
+ aNew.StandardImage = SvFileInformationManager::GetFileImage(aURL, false, false);
+ aNew.HCImage = SvFileInformationManager::GetFileImage(aURL, false, true );
+
+ /* set the right UI state for this item to NOT_RECOVERED_YET ... because nDocState shows the state of
+ the last emergency save operation before and is interessting for the used recovery core service only ...
+ for now! But if there is a further notification for this item (see lines above!) we must
+ map the doc state to an UI state. */
+ aNew.RecoveryState = E_NOT_RECOVERED_YET;
+
+ // patch DisplayName! Because the document title contain more then the file name ...
+ sal_Int32 i = aNew.DisplayName.indexOf(::rtl::OUString::createFromAscii(" - "));
+ if (i > 0)
+ aNew.DisplayName = aNew.DisplayName.copy(0, i);
+
+ m_lURLs.push_back(aNew);
+
+ if (m_pListener)
+ m_pListener->updateItems();
+}
+
+//===============================================
+void SAL_CALL RecoveryCore::disposing(const css::lang::EventObject& /*aEvent*/)
+ throw(css::uno::RuntimeException)
+{
+ m_xRealCore.clear();
+}
+
+//===============================================
+void RecoveryCore::impl_startListening()
+{
+ // listening already initialized ?
+ if (m_xRealCore.is())
+ return;
+ m_xRealCore = css::uno::Reference< css::frame::XDispatch >(m_xSMGR->createInstance(SERVICENAME_RECOVERYCORE), css::uno::UNO_QUERY_THROW);
+
+ css::util::URL aURL;
+ if (m_bListenForSaving)
+ aURL.Complete = RECOVERY_CMD_DO_EMERGENCY_SAVE;
+ else
+ aURL.Complete = RECOVERY_CMD_DO_RECOVERY;
+ css::uno::Reference< css::util::XURLTransformer > xParser(m_xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY_THROW);
+ xParser->parseStrict(aURL);
+
+ /* Note: addStatusListener() call us synchronous back ... so we
+ will get the complete list of currently open documents! */
+ m_xRealCore->addStatusListener(static_cast< css::frame::XStatusListener* >(this), aURL);
+}
+
+//===============================================
+void RecoveryCore::impl_stopListening()
+{
+ // Ignore it, if this instance doesnt listen currently
+ if (!m_xRealCore.is())
+ return;
+
+ css::util::URL aURL;
+ if (m_bListenForSaving)
+ aURL.Complete = RECOVERY_CMD_DO_EMERGENCY_SAVE;
+ else
+ aURL.Complete = RECOVERY_CMD_DO_RECOVERY;
+ css::uno::Reference< css::util::XURLTransformer > xParser(m_xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY_THROW);
+ xParser->parseStrict(aURL);
+
+ m_xRealCore->removeStatusListener(static_cast< css::frame::XStatusListener* >(this), aURL);
+ m_xRealCore.clear();
+}
+
+//===============================================
+css::util::URL RecoveryCore::impl_getParsedURL(const ::rtl::OUString& sURL)
+{
+ css::util::URL aURL;
+ aURL.Complete = sURL;
+
+ css::uno::Reference< css::util::XURLTransformer > xParser(m_xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY_THROW);
+ xParser->parseStrict(aURL);
+
+ return aURL;
+}
+
+//===============================================
+PluginProgressWindow::PluginProgressWindow( Window* pParent ,
+ const css::uno::Reference< css::lang::XComponent >& xProgress)
+ : Window (pParent )
+ , m_xProgress(xProgress)
+{
+ Show();
+ Size aParentSize = pParent->GetSizePixel();
+ // align the progressbar to its parent
+ SetPosSizePixel( -9, 0, aParentSize.Width() + 15, aParentSize.Height() - 4 );
+}
+
+//===============================================
+PluginProgressWindow::~PluginProgressWindow()
+{
+ if (m_xProgress.is())
+ m_xProgress->dispose();
+}
+
+//===============================================
+PluginProgress::PluginProgress( Window* pParent,
+ const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR )
+{
+ m_pPlugProgressWindow = new PluginProgressWindow(pParent, static_cast< css::lang::XComponent* >(this));
+ css::uno::Reference< css::awt::XWindow > xProgressWindow = VCLUnoHelper::GetInterface(m_pPlugProgressWindow);
+ m_xProgressFactory = css::uno::Reference< css::task::XStatusIndicatorFactory >(xSMGR->createInstance(SERVICENAME_PROGRESSFACTORY), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::lang::XInitialization > xInit(m_xProgressFactory, css::uno::UNO_QUERY_THROW);
+
+ css::uno::Sequence< css::uno::Any > lArgs(2);
+ css::beans::NamedValue aProp;
+ aProp.Name = PROP_PARENTWINDOW;
+ aProp.Value <<= xProgressWindow;
+ lArgs[0] <<= aProp;
+ aProp.Name = PROP_ALLOWPARENTSHOW;
+ aProp.Value <<= sal_True;
+ lArgs[1] <<= aProp;
+
+ xInit->initialize(lArgs);
+
+ m_xProgress = m_xProgressFactory->createStatusIndicator();
+}
+
+//===============================================
+PluginProgress::~PluginProgress()
+{
+}
+
+//===============================================
+Window* PluginProgress::getPlugWindow()
+{
+ return m_pPlugProgressWindow;
+}
+
+//===============================================
+void SAL_CALL PluginProgress::dispose()
+ throw(css::uno::RuntimeException)
+{
+ // m_pPluginProgressWindow was deleted ...
+ // So the internal pointer of this progress
+ // weill be dead!
+ m_xProgress.clear();
+}
+
+//===============================================
+void SAL_CALL PluginProgress::addEventListener(const css::uno::Reference< css::lang::XEventListener >& )
+ throw(css::uno::RuntimeException)
+{
+}
+
+//===============================================
+void SAL_CALL PluginProgress::removeEventListener( const css::uno::Reference< css::lang::XEventListener >& )
+ throw(css::uno::RuntimeException)
+{
+}
+
+//===============================================
+void SAL_CALL PluginProgress::start(const ::rtl::OUString&,
+ sal_Int32 nRange)
+ throw(css::uno::RuntimeException)
+{
+ if (m_xProgress.is())
+ m_xProgress->start(::rtl::OUString(), nRange);
+}
+
+//===============================================
+void SAL_CALL PluginProgress::end()
+ throw(css::uno::RuntimeException)
+{
+ if (m_xProgress.is())
+ m_xProgress->end();
+}
+
+//===============================================
+void SAL_CALL PluginProgress::setText(const ::rtl::OUString& sText)
+ throw(css::uno::RuntimeException)
+{
+ if (m_xProgress.is())
+ m_xProgress->setText(sText);
+}
+
+//===============================================
+void SAL_CALL PluginProgress::setValue(sal_Int32 nValue)
+ throw(css::uno::RuntimeException)
+{
+ if (m_xProgress.is())
+ m_xProgress->setValue(nValue);
+}
+
+//===============================================
+void SAL_CALL PluginProgress::reset()
+ throw(css::uno::RuntimeException)
+{
+ if (m_xProgress.is())
+ m_xProgress->reset();
+}
+
+//===============================================
+SaveDialog::SaveDialog(Window* pParent,
+ RecoveryCore* pCore )
+ : IExtendedTabPage( pParent, SVX_RES( RID_SVXPAGE_DOCRECOVERY_SAVE ) )
+ , m_aTitleWin ( this , SVX_RES ( WIN_SAVE_TITLE ) )
+ , m_aTitleFT ( this , SVX_RES ( FT_SAVE_TITLE ) )
+ , m_aTitleFL ( this , SVX_RES ( FL_SAVE_TITLE ) )
+ , m_aDescrFT ( this , SVX_RES ( FT_SAVE_DESCR ) )
+ , m_aFileListFT ( this , SVX_RES ( FT_SAVE_FILELIST ) )
+ , m_aFileListLB ( this , SVX_RES ( LB_SAVE_FILELIST ) )
+ , m_aBottomFL ( this , SVX_RES ( FL_SAVE_BOTTOM ) )
+ , m_aOkBtn ( this , SVX_RES ( BT_SAVE_OK ) )
+ , m_pCore ( pCore )
+{
+ FreeResource();
+
+ // Prepare the office for the following crash save step.
+ // E.g. hide all open widows so the user cant influence our
+ // operation .-)
+ m_pCore->doEmergencySavePrepare();
+
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ Wallpaper aBackground(rStyleSettings.GetWindowColor());
+ m_aTitleWin.SetBackground(aBackground);
+ m_aTitleFT.SetBackground (aBackground);
+
+ Font aFont(m_aTitleFT.GetFont());
+ aFont.SetWeight(WEIGHT_BOLD);
+ m_aTitleFT.SetFont(aFont);
+
+ m_aOkBtn.SetClickHdl( LINK( this, SaveDialog, OKButtonHdl ) );
+// m_aFileListLB.EnableInput( sal_False );
+ m_aFileListLB.SetControlBackground( rStyleSettings.GetDialogColor() );
+
+ // fill listbox with current open documents
+ m_aFileListLB.Clear();
+
+ TURLList* pURLs = m_pCore->getURLListAccess();
+ TURLList::const_iterator pIt;
+
+ for ( pIt = pURLs->begin();
+ pIt != pURLs->end() ;
+ ++pIt )
+ {
+ const TURLInfo& rInfo = *pIt;
+ m_aFileListLB.InsertEntry( rInfo.DisplayName, rInfo.StandardImage );
+ }
+}
+
+//===============================================
+SaveDialog::~SaveDialog()
+{
+}
+
+//===============================================
+IMPL_LINK( SaveDialog, OKButtonHdl, void*, EMPTYARG )
+{
+ m_nResult = DLG_RET_OK;
+ return 0;
+}
+
+//===============================================
+short SaveDialog::execute()
+{
+ ::vos::OGuard aLock(Application::GetSolarMutex());
+
+ // wait for user input "OK"
+ m_nResult = DLG_RET_UNKNOWN;
+ while(m_nResult == DLG_RET_UNKNOWN)
+ Application::Yield();
+
+ // start crash-save with progress
+ if (m_nResult == DLG_RET_OK)
+ {
+ SaveProgressDialog* pProgress = new SaveProgressDialog(this, m_pCore);
+ m_nResult = pProgress->Execute();
+ delete pProgress;
+ }
+ // if "CANCEL" => return "CANCEL"
+ // if "OK" => "AUTOLUNCH" always !
+ if (m_nResult == DLG_RET_OK)
+ m_nResult = DLG_RET_OK_AUTOLUNCH;
+
+ return m_nResult;
+}
+
+//===============================================
+void SaveDialog::setDefButton()
+{
+ m_aOkBtn.GrabFocus();
+}
+
+//===============================================
+SaveProgressDialog::SaveProgressDialog(Window* pParent,
+ RecoveryCore* pCore )
+ : ModalDialog ( pParent , SVX_RES( RID_SVX_MDLG_DOCRECOVERY_PROGR ) )
+ , m_aHintFT ( this , SVX_RES ( FT_SAVEPROGR_HINT ) )
+ , m_aProgrFT ( this , SVX_RES ( FT_SAVEPROGR_PROGR ) )
+ , m_aProgrParent( this , SVX_RES ( WIN_SAVEPROGR_PROGR ) )
+ , m_pCore ( pCore )
+{
+ FreeResource();
+ PluginProgress* pProgress = new PluginProgress( &m_aProgrParent, pCore->getSMGR() );
+ m_xProgress = css::uno::Reference< css::task::XStatusIndicator >(static_cast< css::task::XStatusIndicator* >(pProgress), css::uno::UNO_QUERY_THROW);
+// m_aProgrBaseTxt = m_aProgrFT.GetText();
+}
+
+//===============================================
+SaveProgressDialog::~SaveProgressDialog()
+{
+}
+
+//===============================================
+short SaveProgressDialog::Execute()
+{
+ ::vos::OGuard aLock(Application::GetSolarMutex());
+
+ m_pCore->setProgressHandler(m_xProgress);
+ m_pCore->setUpdateListener(this);
+ m_pCore->doEmergencySave();
+ short nRet = ModalDialog::Execute();
+ m_pCore->setUpdateListener(0);
+ return nRet;
+}
+
+//===============================================
+void SaveProgressDialog::updateItems()
+{
+}
+
+//===============================================
+void SaveProgressDialog::stepNext(TURLInfo* )
+{
+ /* TODO
+
+ wenn die m_pCore noch ein Member m_nCurrentItem haette
+ koennte man dort erkennen, wer gerade drann war, wer demnaechst
+ dran ist ... Diese Info kann man dann in unserem Progress FixText anzeigen ...
+ */
+}
+
+//===============================================
+void SaveProgressDialog::start()
+{
+}
+
+//===============================================
+void SaveProgressDialog::end()
+{
+ EndDialog(DLG_RET_OK);
+}
+
+//===============================================
+RecovDocListEntry::RecovDocListEntry( SvLBoxEntry* pEntry,
+ sal_uInt16 nFlags,
+ const String& sText )
+ : SvLBoxString( pEntry, nFlags, sText )
+{
+}
+
+//===============================================
+void RecovDocListEntry::Paint(const Point& aPos ,
+ SvLBox& aDevice,
+ sal_uInt16 /*nFlags */,
+ SvLBoxEntry* pEntry )
+{
+ const Image* pImg = 0;
+ const String* pTxt = 0;
+ RecovDocList* pList = static_cast< RecovDocList* >(&aDevice);
+
+ sal_Bool bHC = aDevice.GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ TURLInfo* pInfo = (TURLInfo*)pEntry->GetUserData();
+ switch(pInfo->RecoveryState)
+ {
+ case E_SUCCESSFULLY_RECOVERED :
+ {
+ pImg = &pList->m_aGreenCheckImg;
+ if (bHC)
+ pImg = &pList->m_aGreenCheckImgHC;
+ pTxt = &pList->m_aSuccessRecovStr;
+ }
+ break;
+
+ case E_ORIGINAL_DOCUMENT_RECOVERED : // TODO must be renamed into ORIGINAL DOCUMENT recovered! Because its marked as yellow
+ {
+ pImg = &pList->m_aYellowCheckImg;
+ if (bHC)
+ pImg = &pList->m_aYellowCheckImgHC;
+ pTxt = &pList->m_aOrigDocRecovStr;
+ }
+ break;
+
+ case E_RECOVERY_FAILED :
+ {
+ pImg = &pList->m_aRedCrossImg;
+ if (bHC)
+ pImg = &pList->m_aRedCrossImgHC;
+ pTxt = &pList->m_aRecovFailedStr;
+ }
+ break;
+
+ case E_RECOVERY_IS_IN_PROGRESS :
+ {
+ pImg = 0;
+ pTxt = &pList->m_aRecovInProgrStr;
+ }
+ break;
+
+ case E_NOT_RECOVERED_YET :
+ {
+ pImg = 0;
+ pTxt = &pList->m_aNotRecovYetStr;
+ }
+ break;
+ }
+
+ if (pImg)
+ aDevice.DrawImage(aPos, *pImg);
+
+ if (pTxt)
+ {
+ ::rtl::OUString sT1(*pTxt);
+
+ Point aPnt(aPos);
+ aPnt.X() += pList->m_aGreenCheckImg.GetSizePixel().Width();
+ aPnt.X() += 10;
+ aDevice.DrawText(aPnt, *pTxt);
+ }
+}
+//===============================================
+RecovDocList::RecovDocList( Window* pParent,
+ const ResId& rResId )
+ : SvxSimpleTable ( pParent, rResId )
+ , m_aGreenCheckImg ( ResId(IMG_GREENCHECK,*rResId.GetResMgr() ) )
+ , m_aYellowCheckImg ( ResId(IMG_YELLOWCHECK,*rResId.GetResMgr() ) )
+ , m_aRedCrossImg ( ResId(IMG_REDCROSS,*rResId.GetResMgr() ) )
+ , m_aGreenCheckImgHC ( ResId(IMG_GREENCHECK_HC,*rResId.GetResMgr() ) )
+ , m_aYellowCheckImgHC ( ResId(IMG_YELLOWCHECK_HC,*rResId.GetResMgr() ) )
+ , m_aRedCrossImgHC ( ResId(IMG_REDCROSS_HC,*rResId.GetResMgr() ) )
+ , m_aSuccessRecovStr ( ResId(STR_SUCCESSRECOV,*rResId.GetResMgr() ) )
+ , m_aOrigDocRecovStr ( ResId(STR_ORIGDOCRECOV,*rResId.GetResMgr() ) )
+ , m_aRecovFailedStr ( ResId(STR_RECOVFAILED,*rResId.GetResMgr() ) )
+ , m_aRecovInProgrStr ( ResId(STR_RECOVINPROGR,*rResId.GetResMgr() ) )
+ , m_aNotRecovYetStr ( ResId(STR_NOTRECOVYET,*rResId.GetResMgr() ) )
+{
+ //SetEntryHeight( short( maGreenCheckImg.GetSizePixel().Height() ) );
+}
+
+//===============================================
+RecovDocList::~RecovDocList()
+{
+}
+
+//===============================================
+void RecovDocList::InitEntry( SvLBoxEntry* pEntry ,
+ const XubString& sText ,
+ const Image& aImage1,
+ const Image& aImage2,
+ SvLBoxButtonKind eButtonKind)
+{
+ SvTabListBox::InitEntry(pEntry, sText, aImage1, aImage2, eButtonKind);
+ DBG_ASSERT( TabCount() == 2, "*RecovDocList::InitEntry(): structure missmatch" );
+
+ SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem(2);
+ RecovDocListEntry* p = new RecovDocListEntry(pEntry, 0, pCol->GetText());
+ pEntry->ReplaceItem(p, 2);
+}
+
+//===============================================
+short impl_askUserForWizardCancel(Window* pParent, sal_Int16 nRes)
+{
+ QueryBox aQuery(pParent, SVX_RES(nRes));
+ if (aQuery.Execute() == RET_YES)
+ return DLG_RET_OK;
+ else
+ return DLG_RET_CANCEL;
+}
+
+//===============================================
+RecoveryDialog::RecoveryDialog(Window* pParent,
+ RecoveryCore* pCore )
+ : IExtendedTabPage( pParent , SVX_RES( RID_SVXPAGE_DOCRECOVERY_RECOVER ) )
+ , m_aTitleWin ( this , SVX_RES ( WIN_RECOV_TITLE ) )
+ , m_aTitleFT ( this , SVX_RES ( FT_RECOV_TITLE ) )
+ , m_aTitleFL ( this , SVX_RES ( FL_RECOV_TITLE ) )
+ , m_aDescrFT ( this , SVX_RES ( FT_RECOV_DESCR ) )
+ , m_aProgressFT ( this , SVX_RES ( FT_RECOV_PROGR ) )
+ , m_aProgrParent ( this , SVX_RES ( WIN_RECOV_PROGR ) )
+ , m_aFileListFT ( this , SVX_RES ( FT_RECOV_FILELIST ) )
+ , m_aFileListLB ( this , SVX_RES ( LB_RECOV_FILELIST ) )
+ , m_aBottomFL ( this , SVX_RES ( FL_RECOV_BOTTOM ) )
+ , m_aNextBtn ( this , SVX_RES ( BTN_RECOV_NEXT ) )
+ , m_aCancelBtn ( this , SVX_RES ( BTN_RECOV_CANCEL ) )
+ , m_aNextStr ( SVX_RES ( STR_RECOVERY_NEXT ) )
+ , m_aTitleRecoveryInProgress( SVX_RES ( STR_RECOVERY_INPROGRESS ) )
+ , m_aTitleRecoveryReport( SVX_RES ( STR_RECOVERY_REPORT ) )
+ , m_aRecoveryOnlyFinish ( SVX_RES ( STR_RECOVERYONLY_FINISH ) )
+ , m_aRecoveryOnlyFinishDescr( SVX_RES ( STR_RECOVERYONLY_FINISH_DESCR ) )
+ , m_pDefButton ( NULL )
+ , m_pCore ( pCore )
+ , m_eRecoveryState (RecoveryDialog::E_RECOVERY_PREPARED)
+ , m_bWaitForUser (sal_False)
+ , m_bWaitForCore (sal_False)
+ , m_bUserDecideNext (sal_False)
+ , m_bWasRecoveryStarted (sal_False)
+ , m_bRecoveryOnly (sal_False)
+{
+ static long nTabs[] = { 2, 0, 40*RECOV_CONTROLWIDTH/100 };
+ m_aFileListLB.SetTabs( &nTabs[0] );
+ m_aFileListLB.InsertHeaderEntry( String( SVX_RES( STR_HEADERBAR ) ) );
+
+ FreeResource();
+
+ ::rtl::OUString CFG_PACKAGE_RECOVERY( RTL_CONSTASCII_USTRINGPARAM ( "org.openoffice.Office.Recovery/" ));
+ ::rtl::OUString CFG_PATH_CRASHREPORTER( RTL_CONSTASCII_USTRINGPARAM( "CrashReporter" ));
+ ::rtl::OUString CFG_ENTRY_ENABLED( RTL_CONSTASCII_USTRINGPARAM ( "Enabled" ));
+
+ sal_Bool bCrashRepEnabled( sal_True );
+ css::uno::Any aVal = ::comphelper::ConfigurationHelper::readDirectKey(
+ pCore->getSMGR(),
+ CFG_PACKAGE_RECOVERY,
+ CFG_PATH_CRASHREPORTER,
+ CFG_ENTRY_ENABLED,
+ ::comphelper::ConfigurationHelper::E_READONLY);
+ aVal >>= bCrashRepEnabled;
+ m_bRecoveryOnly = !bCrashRepEnabled;
+
+ PluginProgress* pProgress = new PluginProgress( &m_aProgrParent, pCore->getSMGR() );
+ m_xProgress = css::uno::Reference< css::task::XStatusIndicator >(static_cast< css::task::XStatusIndicator* >(pProgress), css::uno::UNO_QUERY_THROW);
+
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ Wallpaper aBackground( rStyleSettings.GetWindowColor() );
+ m_aTitleWin.SetBackground(aBackground);
+ m_aTitleFT.SetBackground (aBackground);
+
+ Font aFont(m_aTitleFT.GetFont());
+ aFont.SetWeight(WEIGHT_BOLD);
+ m_aTitleFT.SetFont(aFont);
+
+ m_aFileListLB.SetBackground( rStyleSettings.GetDialogColor() );
+
+ m_aNextBtn.Enable(sal_True);
+ m_aNextBtn.SetClickHdl( LINK( this, RecoveryDialog, NextButtonHdl ) );
+ m_aCancelBtn.SetClickHdl( LINK( this, RecoveryDialog, CancelButtonHdl ) );
+
+ // fill list box first time
+ TURLList* pURLList = m_pCore->getURLListAccess();
+ TURLList::const_iterator pIt;
+ for ( pIt = pURLList->begin();
+ pIt != pURLList->end() ;
+ ++pIt )
+ {
+ const TURLInfo& rInfo = *pIt;
+
+ String sName( rInfo.DisplayName );
+ sName += '\t';
+ sName += impl_getStatusString( rInfo );
+ SvLBoxEntry* pEntry = m_aFileListLB.InsertEntry(sName, rInfo.StandardImage, rInfo.StandardImage);
+ pEntry->SetUserData((void*)&rInfo);
+ m_aFileListLB.SetExpandedEntryBmp (pEntry, rInfo.HCImage, BMP_COLOR_HIGHCONTRAST);
+ m_aFileListLB.SetCollapsedEntryBmp(pEntry, rInfo.HCImage, BMP_COLOR_HIGHCONTRAST);
+ }
+
+ // mark first item
+ SvLBoxEntry* pFirst = m_aFileListLB.First();
+ if (pFirst)
+ m_aFileListLB.SetCursor(pFirst, sal_True);
+}
+
+//===============================================
+RecoveryDialog::~RecoveryDialog()
+{
+}
+
+//===============================================
+short RecoveryDialog::execute()
+{
+ ::vos::OGuard aSolarLock(Application::GetSolarMutex());
+
+ switch(m_eRecoveryState)
+ {
+ case RecoveryDialog::E_RECOVERY_PREPARED :
+ {
+ // Dialog was started first time ...
+ // wait for user decision ("start" or "cancel" recovery)
+ // This decision will be made inside the NextBtn handler.
+ m_aNextBtn.Enable(sal_True);
+ m_aCancelBtn.Enable(sal_True);
+ m_bWaitForUser = sal_True;
+ while(m_bWaitForUser)
+ Application::Yield();
+ if (m_bUserDecideNext)
+ m_eRecoveryState = RecoveryDialog::E_RECOVERY_IN_PROGRESS;
+ else
+ m_eRecoveryState = RecoveryDialog::E_RECOVERY_CANCELED;
+ return execute();
+ }
+
+ case RecoveryDialog::E_RECOVERY_IN_PROGRESS :
+ {
+ // user decided to start recovery ...
+ m_bWasRecoveryStarted = sal_True;
+ // do it asynchronous (to allow repaints)
+ // and wait for this asynchronous operation.
+ m_aDescrFT.SetText( m_aTitleRecoveryInProgress );
+ m_aNextBtn.Enable(sal_False);
+ m_aCancelBtn.Enable(sal_False);
+ m_pCore->setProgressHandler(m_xProgress);
+ m_pCore->setUpdateListener(this);
+ m_pCore->doRecovery();
+
+ m_bWaitForCore = sal_True;
+ while(m_bWaitForCore)
+ Application::Yield();
+
+ m_pCore->setUpdateListener(0);
+ m_eRecoveryState = RecoveryDialog::E_RECOVERY_CORE_DONE;
+ return execute();
+ }
+
+ case RecoveryDialog::E_RECOVERY_CORE_DONE :
+ {
+ // the core finished it's task.
+ // let the user decide the next step.
+ if ( m_bRecoveryOnly )
+ {
+ m_aDescrFT.SetText(m_aRecoveryOnlyFinishDescr);
+ m_aNextBtn.SetText(m_aRecoveryOnlyFinish);
+ m_aNextBtn.Enable(sal_True);
+ m_aCancelBtn.Enable(sal_False);
+ }
+ else
+ {
+ m_aDescrFT.SetText(m_aTitleRecoveryReport);
+ m_aNextBtn.SetText(m_aNextStr);
+ m_aNextBtn.Enable(sal_True);
+ m_aCancelBtn.Enable(sal_True);
+ }
+
+ m_bWaitForUser = sal_True;
+ while(m_bWaitForUser)
+ Application::Yield();
+
+ if (m_bUserDecideNext)
+ m_eRecoveryState = RecoveryDialog::E_RECOVERY_DONE;
+ else
+ m_eRecoveryState = RecoveryDialog::E_RECOVERY_CANCELED;
+ return execute();
+ }
+
+ case RecoveryDialog::E_RECOVERY_DONE :
+ {
+ // All documents was reovered.
+ // User decided to step to the "next" wizard page.
+ // Do it ... but check first, if there exist some
+ // failed recovery documents. They must be saved to
+ // a user selected directrory.
+ short nRet = DLG_RET_UNKNOWN;
+ BrokenRecoveryDialog* pBrokenRecoveryDialog = new BrokenRecoveryDialog(this, m_pCore, !m_bWasRecoveryStarted);
+ String sSaveDir = pBrokenRecoveryDialog->getSaveDirURL(); // get the default dir
+ if (pBrokenRecoveryDialog->isExecutionNeeded())
+ {
+ nRet = pBrokenRecoveryDialog->Execute();
+ sSaveDir = pBrokenRecoveryDialog->getSaveDirURL();
+ }
+ delete pBrokenRecoveryDialog;
+
+ switch(nRet)
+ {
+ // no broken temp files exists
+ // step to the next wizard page
+ case DLG_RET_UNKNOWN :
+ {
+ m_eRecoveryState = RecoveryDialog::E_RECOVERY_HANDLED;
+ return DLG_RET_OK;
+ }
+
+ // user decided to save the broken temp files
+ // do and forget it
+ // step to the next wizard page
+ case DLG_RET_OK :
+ {
+ m_pCore->saveBrokenTempEntries(sSaveDir);
+ m_pCore->forgetBrokenTempEntries();
+ m_eRecoveryState = RecoveryDialog::E_RECOVERY_HANDLED;
+ return DLG_RET_OK;
+ }
+
+ // user decided to ignore broken temp files.
+ // Ask it again ... may be this decision was wrong.
+ // Results:
+ // IGNORE => remove broken temp files
+ // => step to the next wizard page
+ // CANCEL => step back to the recovery page
+ case DLG_RET_CANCEL :
+ {
+ // TODO ask user ...
+ m_pCore->forgetBrokenTempEntries();
+ m_eRecoveryState = RecoveryDialog::E_RECOVERY_HANDLED;
+ return DLG_RET_OK;
+ }
+ }
+
+ m_eRecoveryState = RecoveryDialog::E_RECOVERY_HANDLED;
+ return DLG_RET_OK;
+ }
+
+ case RecoveryDialog::E_RECOVERY_CANCELED :
+ {
+ // "YES" => break recovery
+ // But there exist different states, where "cancel" can be called.
+ // Handle it different.
+ if (m_bWasRecoveryStarted)
+ m_eRecoveryState = RecoveryDialog::E_RECOVERY_CANCELED_AFTERWARDS;
+ else
+ m_eRecoveryState = RecoveryDialog::E_RECOVERY_CANCELED_BEFORE;
+ return execute();
+ }
+
+ case RecoveryDialog::E_RECOVERY_CANCELED_BEFORE :
+ case RecoveryDialog::E_RECOVERY_CANCELED_AFTERWARDS :
+ {
+ // We have to check if there exists some temp. files.
+ // They should be saved to a user defined location.
+ // If no temp files exists or user decided to ignore it ...
+ // we have to remove all recovery/session data anyway!
+ short nRet = DLG_RET_UNKNOWN;
+ BrokenRecoveryDialog* pBrokenRecoveryDialog = new BrokenRecoveryDialog(this, m_pCore, !m_bWasRecoveryStarted);
+ String sSaveDir = pBrokenRecoveryDialog->getSaveDirURL(); // get the default save location
+
+ // dialog itself checks if there is a need to copy files for this mode.
+ // It uses the information m_bWasRecoveryStarted doing so.
+ if (pBrokenRecoveryDialog->isExecutionNeeded())
+ {
+ nRet = pBrokenRecoveryDialog->Execute();
+ sSaveDir = pBrokenRecoveryDialog->getSaveDirURL();
+ }
+ delete pBrokenRecoveryDialog;
+
+ // Possible states:
+ // a) nRet == DLG_RET_UNKNOWN
+ // dialog was not shown ...
+ // because there exists no temp file for copy.
+ // => remove all recovery data
+ // b) nRet == DLG_RET_OK
+ // dialog was shown ...
+ // user decided to save temp files
+ // => save all OR broken temp files (depends from the time, where cancel was called)
+ // => remove all recovery data
+ // c) nRet == DLG_RET_CANCEL
+ // dialog was shown ...
+ // user decided to ignore temp files
+ // => remove all recovery data
+ // => a)/c) are the same ... b) has one additional operation
+
+ // b)
+ if (nRet == DLG_RET_OK)
+ {
+ if (m_bWasRecoveryStarted)
+ m_pCore->saveBrokenTempEntries(sSaveDir);
+ else
+ m_pCore->saveAllTempEntries(sSaveDir);
+ }
+
+ // a,b,c)
+ if (m_bWasRecoveryStarted)
+ m_pCore->forgetBrokenRecoveryEntries();
+ else
+ m_pCore->forgetAllRecoveryEntries();
+ m_eRecoveryState = RecoveryDialog::E_RECOVERY_HANDLED;
+
+ // THERE IS NO WAY BACK. see impl_askUserForWizardCancel()!
+ return DLG_RET_CANCEL;
+ }
+
+ case RecoveryDialog::E_RECOVERY_HANDLED :
+ {
+ m_bWaitForUser = sal_True;
+ while(m_bWaitForUser)
+ Application::Yield();
+
+ // TODO: show BrokenRecoveryDialog again, ift he user
+ // doesnt accepted it last time.
+
+ if (m_bUserDecideNext)
+ return DLG_RET_OK;
+ else
+ return DLG_RET_CANCEL;
+ }
+ }
+
+ // should never be reached .-)
+ DBG_ERROR("Should never be reached!");
+ return DLG_RET_OK;
+}
+
+//===============================================
+void RecoveryDialog::setDefButton()
+{
+ if ( m_aNextBtn.IsEnabled() )
+ m_aNextBtn.GrabFocus();
+ else
+ m_pDefButton = &m_aNextBtn;
+}
+
+//===============================================
+void RecoveryDialog::start()
+{
+}
+
+//===============================================
+void RecoveryDialog::updateItems()
+{
+ sal_uIntPtr c = m_aFileListLB.GetEntryCount();
+ sal_uIntPtr i = 0;
+ for ( i=0; i<c; ++i )
+ {
+ SvLBoxEntry* pEntry = m_aFileListLB.GetEntry(i);
+ if ( !pEntry )
+ continue;
+
+ TURLInfo* pInfo = (TURLInfo*)pEntry->GetUserData();
+ if ( !pInfo )
+ continue;
+
+ String sStatus = impl_getStatusString( *pInfo );
+ if ( sStatus.Len() > 0 )
+ m_aFileListLB.SetEntryText( sStatus, pEntry, 1 );
+ }
+
+ m_aFileListLB.Invalidate();
+ m_aFileListLB.Update();
+}
+
+//===============================================
+void RecoveryDialog::stepNext(TURLInfo* pItem)
+{
+ sal_uIntPtr c = m_aFileListLB.GetEntryCount();
+ sal_uIntPtr i = 0;
+ for (i=0; i<c; ++i)
+ {
+ SvLBoxEntry* pEntry = m_aFileListLB.GetEntry(i);
+ if (!pEntry)
+ continue;
+
+ TURLInfo* pInfo = (TURLInfo*)pEntry->GetUserData();
+ if (pInfo->ID != pItem->ID)
+ continue;
+
+ m_aFileListLB.SetCursor(pEntry, sal_True);
+ m_aFileListLB.MakeVisible(pEntry);
+ m_aFileListLB.Invalidate();
+ m_aFileListLB.Update();
+ break;
+ }
+}
+
+//===============================================
+void RecoveryDialog::end()
+{
+ if ( m_pDefButton )
+ {
+ m_pDefButton->GrabFocus();
+ m_pDefButton = NULL;
+ }
+ m_bWaitForCore = sal_False;
+}
+
+//===============================================
+IMPL_LINK( RecoveryDialog, NextButtonHdl, void*, EMPTYARG )
+{
+ m_bUserDecideNext = sal_True;
+ m_bWaitForUser = sal_False;
+ return 0;
+}
+
+//===============================================
+IMPL_LINK( RecoveryDialog, CancelButtonHdl, void*, EMPTYARG )
+{
+ if (m_eRecoveryState == RecoveryDialog::E_RECOVERY_PREPARED)
+ {
+ if (impl_askUserForWizardCancel(this, RID_SVXQB_EXIT_RECOVERY) == DLG_RET_CANCEL)
+ return 0;
+ }
+ m_bUserDecideNext = sal_False;
+ m_bWaitForUser = sal_False;
+ return 0;
+}
+
+//===============================================
+void RecoveryDialog::impl_refreshDocList()
+{
+}
+
+//===============================================
+String RecoveryDialog::impl_getStatusString( const TURLInfo& rInfo ) const
+{
+ String sStatus;
+ switch ( rInfo.RecoveryState )
+ {
+ case E_SUCCESSFULLY_RECOVERED :
+ sStatus = m_aFileListLB.m_aSuccessRecovStr;
+ break;
+ case E_ORIGINAL_DOCUMENT_RECOVERED :
+ sStatus = m_aFileListLB.m_aOrigDocRecovStr;
+ break;
+ case E_RECOVERY_FAILED :
+ sStatus = m_aFileListLB.m_aRecovFailedStr;
+ break;
+ case E_RECOVERY_IS_IN_PROGRESS :
+ sStatus = m_aFileListLB.m_aRecovInProgrStr;
+ break;
+ case E_NOT_RECOVERED_YET :
+ sStatus = m_aFileListLB.m_aNotRecovYetStr;
+ break;
+ default:
+ break;
+ }
+ return sStatus;
+}
+
+//===============================================
+BrokenRecoveryDialog::BrokenRecoveryDialog(Window* pParent ,
+ RecoveryCore* pCore ,
+ sal_Bool bBeforeRecovery)
+ : ModalDialog ( pParent, SVX_RES( RID_SVX_MDLG_DOCRECOVERY_BROKEN ) )
+ , m_aDescrFT ( this , SVX_RES( FT_BROKEN_DESCR ) )
+ , m_aFileListFT ( this , SVX_RES( FT_BROKEN_FILELIST ) )
+ , m_aFileListLB ( this , SVX_RES( LB_BROKEN_FILELIST ) )
+ , m_aSaveDirFT ( this , SVX_RES( FT_BROKEN_SAVEDIR ) )
+ , m_aSaveDirED ( this , SVX_RES( ED_BROKEN_SAVEDIR ) )
+ , m_aSaveDirBtn ( this , SVX_RES( BTN_BROKEN_SAVEDIR ) )
+ , m_aBottomFL ( this , SVX_RES( FL_BROKEN_BOTTOM ) )
+ , m_aOkBtn ( this , SVX_RES( BTN_BROKEN_OK ) )
+ , m_aCancelBtn ( this , SVX_RES( BTN_BROKEN_CANCEL ) )
+ , m_pCore ( pCore )
+ , m_bBeforeRecovery (bBeforeRecovery)
+ , m_bExecutionNeeded(sal_False)
+{
+ FreeResource();
+
+ m_aSaveDirBtn.SetClickHdl( LINK( this, BrokenRecoveryDialog, SaveButtonHdl ) );
+ m_aOkBtn.SetClickHdl( LINK( this, BrokenRecoveryDialog, OkButtonHdl ) );
+ m_aCancelBtn.SetClickHdl( LINK( this, BrokenRecoveryDialog, CancelButtonHdl ) );
+
+ m_sSavePath = SvtPathOptions().GetWorkPath();
+ INetURLObject aObj( m_sSavePath );
+ String sPath;
+ ::utl::LocalFileHelper::ConvertURLToSystemPath( aObj.GetMainURL( INetURLObject::NO_DECODE ), sPath );
+ m_aSaveDirED.SetText( sPath );
+
+ impl_refresh();
+}
+
+//===============================================
+BrokenRecoveryDialog::~BrokenRecoveryDialog()
+{
+}
+
+//===============================================
+void BrokenRecoveryDialog::impl_refresh()
+{
+ m_bExecutionNeeded = sal_False;
+ TURLList* pURLList = m_pCore->getURLListAccess();
+ TURLList::const_iterator pIt;
+ for ( pIt = pURLList->begin();
+ pIt != pURLList->end() ;
+ ++pIt )
+ {
+ const TURLInfo& rInfo = *pIt;
+
+ if (m_bBeforeRecovery)
+ {
+ // "Cancel" before recovery ->
+ // search for any temp files!
+ if (!rInfo.TempURL.getLength())
+ continue;
+ }
+ else
+ {
+ // "Cancel" after recovery ->
+ // search for broken temp files
+ if (!RecoveryCore::isBrokenTempEntry(rInfo))
+ continue;
+ }
+
+ m_bExecutionNeeded = sal_True;
+
+ sal_uInt16 nPos = m_aFileListLB.InsertEntry(rInfo.DisplayName, rInfo.StandardImage );
+ m_aFileListLB.SetEntryData( nPos, (void*)&rInfo );
+ }
+ m_sSavePath = ::rtl::OUString();
+ m_aOkBtn.GrabFocus();
+}
+
+//===============================================
+sal_Bool BrokenRecoveryDialog::isExecutionNeeded()
+{
+ return m_bExecutionNeeded;
+}
+
+//===============================================
+::rtl::OUString BrokenRecoveryDialog::getSaveDirURL()
+{
+ return m_sSavePath;
+}
+
+//===============================================
+IMPL_LINK( BrokenRecoveryDialog, OkButtonHdl, void*, EMPTYARG )
+{
+ String sPhysicalPath = m_aSaveDirED.GetText().EraseLeadingChars().EraseTrailingChars();
+ String sURL;
+ ::utl::LocalFileHelper::ConvertPhysicalNameToURL( sPhysicalPath, sURL );
+ m_sSavePath = sURL;
+ while (!m_sSavePath.getLength())
+ impl_askForSavePath();
+
+ EndDialog(DLG_RET_OK);
+ return 0;
+}
+
+//===============================================
+IMPL_LINK( BrokenRecoveryDialog, CancelButtonHdl, void*, EMPTYARG )
+{
+ EndDialog(DLG_RET_CANCEL);
+ return 0;
+}
+
+//===============================================
+IMPL_LINK( BrokenRecoveryDialog, SaveButtonHdl, void*, EMPTYARG )
+{
+ impl_askForSavePath();
+ return 0;
+}
+
+//===============================================
+void BrokenRecoveryDialog::impl_askForSavePath()
+{
+ css::uno::Reference< css::ui::dialogs::XFolderPicker > xFolderPicker(
+ m_pCore->getSMGR()->createInstance(SERVICENAME_FOLDERPICKER), css::uno::UNO_QUERY_THROW);
+
+ INetURLObject aURL(m_sSavePath, INET_PROT_FILE);
+ xFolderPicker->setDisplayDirectory(aURL.GetMainURL(INetURLObject::NO_DECODE));
+ short nRet = xFolderPicker->execute();
+ if (nRet == css::ui::dialogs::ExecutableDialogResults::OK)
+ {
+ m_sSavePath = xFolderPicker->getDirectory();
+ String sPath;
+ ::utl::LocalFileHelper::ConvertURLToSystemPath( m_sSavePath, sPath );
+ m_aSaveDirED.SetText( sPath );
+ }
+}
+
+//===============================================
+ ///////////////////////////////////////////////////////////////////////
+ // Error Report Welcome Dialog
+ ///////////////////////////////////////////////////////////////////////
+
+ ErrorRepWelcomeDialog::ErrorRepWelcomeDialog( Window* _pParent, sal_Bool _bAllowBack )
+ :IExtendedTabPage ( _pParent, SVX_RES( RID_SVXPAGE_ERR_REP_WELCOME ) )
+ ,maTitleWin ( this, SVX_RES( WIN_RECOV_TITLE ) )
+ ,maTitleFT ( this, SVX_RES( FT_RECOV_TITLE ) )
+ ,maTitleFL ( this, SVX_RES( FL_RECOV_TITLE ) )
+ ,maDescrFT ( this, SVX_RES( FT_RECOV_DESCR ) )
+ ,maBottomFL ( this, SVX_RES( FL_RECOV_BOTTOM ) )
+ ,maPrevBtn ( this, SVX_RES( BTN_RECOV_PREV ) )
+ ,maNextBtn ( this, SVX_RES( BTN_RECOV_NEXT ) )
+ ,maCancelBtn ( this, SVX_RES( BTN_RECOV_CANCEL ) )
+ {
+ FreeResource();
+
+ Wallpaper aBack( GetSettings().GetStyleSettings().GetWindowColor() );
+ maTitleWin.SetBackground( aBack );
+ maTitleFT.SetBackground( aBack );
+
+ Font aFnt( maTitleFT.GetFont() );
+ aFnt.SetWeight( WEIGHT_BOLD );
+ maTitleFT.SetFont( aFnt );
+
+ maPrevBtn.SetClickHdl( LINK( this, ErrorRepWelcomeDialog, PrevBtnHdl ) );
+ maPrevBtn.Enable( _bAllowBack );
+
+ maNextBtn.SetClickHdl( LINK( this, ErrorRepWelcomeDialog, NextBtnHdl ) );
+ maNextBtn.Enable( sal_True );
+
+ maCancelBtn.SetClickHdl( LINK( this, ErrorRepWelcomeDialog, CancelBtnHdl ) );
+ maCancelBtn.Enable( sal_True );
+ }
+
+ ErrorRepWelcomeDialog::~ErrorRepWelcomeDialog()
+ {
+ }
+
+ IMPL_LINK( ErrorRepWelcomeDialog, PrevBtnHdl, void*, EMPTYARG )
+ {
+ m_nResult = DLG_RET_BACK;
+ return 0;
+ }
+
+ IMPL_LINK( ErrorRepWelcomeDialog, NextBtnHdl, void*, EMPTYARG )
+ {
+ m_nResult = DLG_RET_OK;
+ return 0;
+ }
+
+ IMPL_LINK( ErrorRepWelcomeDialog, CancelBtnHdl, void*, EMPTYARG )
+ {
+ m_nResult = DLG_RET_CANCEL;
+ return 0;
+ }
+
+ short ErrorRepWelcomeDialog::execute()
+ {
+ ::vos::OGuard aLock(Application::GetSolarMutex());
+ Show();
+ m_nResult = DLG_RET_UNKNOWN;
+ while(m_nResult == DLG_RET_UNKNOWN)
+ Application::Yield();
+ return m_nResult;
+ }
+
+ void ErrorRepWelcomeDialog::setDefButton()
+ {
+ maNextBtn.GrabFocus();
+ }
+
+ ///////////////////////////////////////////////////////////////////////
+ // Error Report Send Dialog and its MultiLineEdit
+ ///////////////////////////////////////////////////////////////////////
+
+ ErrorDescriptionEdit::ErrorDescriptionEdit( Window* pParent, const ResId& rResId ) :
+
+ MultiLineEdit( pParent, rResId )
+
+ {
+ SetModifyHdl( LINK( this, ErrorDescriptionEdit, ModifyHdl ) );
+ if ( GetVScrollBar() )
+ GetVScrollBar()->Hide();
+ }
+
+ ErrorDescriptionEdit::~ErrorDescriptionEdit()
+ {
+ }
+
+ IMPL_LINK( ErrorDescriptionEdit, ModifyHdl, void*, EMPTYARG )
+ {
+ if ( !GetVScrollBar() )
+ return 0;
+
+ ExtTextEngine* pTextEngine = GetTextEngine();
+ DBG_ASSERT( pTextEngine, "no text engine" );
+
+ sal_uIntPtr i, nParaCount = pTextEngine->GetParagraphCount();
+ sal_uInt16 nLineCount = 0;
+
+ for ( i = 0; i < nParaCount; ++i )
+ nLineCount = nLineCount + pTextEngine->GetLineCount(i);
+
+ sal_uInt16 nVisCols = 0, nVisLines = 0;
+ GetMaxVisColumnsAndLines( nVisCols, nVisLines );
+ GetVScrollBar()->Show( nLineCount > nVisLines );
+
+ return 0;
+ }
+
+ ErrorRepSendDialog::ErrorRepSendDialog( Window* _pParent )
+ :IExtendedTabPage ( _pParent, SVX_RES( RID_SVXPAGE_ERR_REP_SEND ) )
+ ,maTitleWin ( this, SVX_RES( WIN_RECOV_TITLE ) )
+ ,maTitleFT ( this, SVX_RES( FT_RECOV_TITLE ) )
+ ,maTitleFL ( this, SVX_RES( FL_RECOV_TITLE ) )
+ ,maDescrFT ( this, SVX_RES( FT_RECOV_DESCR ) )
+
+ ,maDocTypeFT ( this, SVX_RES( FT_ERRSEND_DOCTYPE ) )
+ ,maDocTypeED ( this, SVX_RES( ED_ERRSEND_DOCTYPE ) )
+ ,maUsingFT ( this, SVX_RES( FT_ERRSEND_USING ) )
+ ,maUsingML ( this, SVX_RES( ML_ERRSEND_USING ) )
+ ,maShowRepBtn ( this, SVX_RES( BTN_ERRSEND_SHOWREP ) )
+ ,maOptBtn ( this, SVX_RES( BTN_ERRSEND_OPT ) )
+ ,maContactCB ( this, SVX_RES( CB_ERRSEND_CONTACT ) )
+ ,maEMailAddrFT ( this, SVX_RES( FT_ERRSEND_EMAILADDR ) )
+ ,maEMailAddrED ( this, SVX_RES( ED_ERRSEND_EMAILADDR ) )
+
+ ,maBottomFL ( this, SVX_RES( FL_RECOV_BOTTOM ) )
+ ,maPrevBtn ( this, SVX_RES( BTN_RECOV_PREV ) )
+ ,maNextBtn ( this, SVX_RES( BTN_RECOV_NEXT ) )
+ ,maCancelBtn ( this, SVX_RES( BTN_RECOV_CANCEL ) )
+ {
+ FreeResource();
+
+ initControls();
+
+ Wallpaper aBack( GetSettings().GetStyleSettings().GetWindowColor() );
+ maTitleWin.SetBackground( aBack );
+ maTitleFT.SetBackground( aBack );
+
+ Font aFnt( maTitleFT.GetFont() );
+ aFnt.SetWeight( WEIGHT_BOLD );
+ maTitleFT.SetFont( aFnt );
+
+ maShowRepBtn.SetClickHdl( LINK( this, ErrorRepSendDialog, ShowRepBtnHdl ) );
+ maOptBtn.SetClickHdl( LINK( this, ErrorRepSendDialog, OptBtnHdl ) );
+ maContactCB.SetClickHdl( LINK( this, ErrorRepSendDialog, ContactCBHdl ) );
+ maPrevBtn.SetClickHdl( LINK( this, ErrorRepSendDialog, PrevBtnHdl ) );
+ maNextBtn.SetClickHdl( LINK( this, ErrorRepSendDialog, SendBtnHdl ) );
+ maCancelBtn.SetClickHdl( LINK( this, ErrorRepSendDialog, CancelBtnHdl ) );
+
+ ReadParams();
+
+ /*
+ maDocTypeED.SetText( maParams.maSubject );
+ maUsingML.SetText( maParams.maBody );
+ maContactCB.Check( maParams.mbAllowContact );
+ maEMailAddrED.SetText( maParams.maReturnAddress );
+ */
+ ContactCBHdl( 0 );
+ }
+
+ ErrorRepSendDialog::~ErrorRepSendDialog()
+ {
+ }
+
+ short ErrorRepSendDialog::execute()
+ {
+ ::vos::OGuard aLock(Application::GetSolarMutex());
+ Show();
+ m_nResult = DLG_RET_UNKNOWN;
+ while(m_nResult == DLG_RET_UNKNOWN)
+ Application::Yield();
+ return m_nResult;
+ }
+
+ void ErrorRepSendDialog::setDefButton()
+ {
+ // set first focus
+ maDocTypeED.GrabFocus();
+ }
+
+ IMPL_LINK( ErrorRepSendDialog, PrevBtnHdl, void*, EMPTYARG )
+ {
+ m_nResult = DLG_RET_BACK;
+ return 0;
+ }
+
+ IMPL_LINK( ErrorRepSendDialog, CancelBtnHdl, void*, EMPTYARG )
+ {
+ m_nResult = DLG_RET_CANCEL;
+ return 0;
+ }
+
+ IMPL_LINK( ErrorRepSendDialog, SendBtnHdl, void*, EMPTYARG )
+ {
+
+ SaveParams();
+ SendReport();
+
+ m_nResult = DLG_RET_OK;
+ return 0;
+ }
+
+ IMPL_LINK( ErrorRepSendDialog, ShowRepBtnHdl, void*, EMPTYARG )
+ {
+ ErrorRepPreviewDialog aDlg( this );
+ aDlg.Execute();
+ return 0;
+ }
+
+ IMPL_LINK( ErrorRepSendDialog, OptBtnHdl, void*, EMPTYARG )
+ {
+ ErrorRepOptionsDialog aDlg( this, maParams );
+ aDlg.Execute();
+ return 0;
+ }
+
+ IMPL_LINK( ErrorRepSendDialog, ContactCBHdl, void*, EMPTYARG )
+ {
+ bool bCheck = maContactCB.IsChecked();
+ maEMailAddrFT.Enable( bCheck );
+ maEMailAddrED.Enable( bCheck );
+ return 0;
+ }
+
+ void ErrorRepSendDialog::initControls()
+ {
+ // if the text is too short for two lines, insert a newline
+ String sText = maDocTypeFT.GetText();
+ if ( maDocTypeFT.GetCtrlTextWidth( sText ) <= maDocTypeFT.GetSizePixel().Width() )
+ {
+ sText.Insert( '\n', 0 );
+ maDocTypeFT.SetText( sText );
+ }
+
+ // if the button text is too wide, then broaden the button
+ sText = maShowRepBtn.GetText();
+ long nTxtW = maShowRepBtn.GetCtrlTextWidth( sText );
+ long nBtnW = maShowRepBtn.GetSizePixel().Width();
+ if ( nTxtW >= nBtnW )
+ {
+ const long nMinDelta = 10;
+ long nDelta = Max( nTxtW - nBtnW, nMinDelta );
+ sal_uInt32 i = 0;
+ Window* pWins[] =
+ {
+ &maShowRepBtn, &maOptBtn,
+ &maDescrFT, &maDocTypeFT, &maDocTypeED, &maUsingFT,
+ &maUsingML, &maContactCB, &maEMailAddrFT, &maEMailAddrED
+ };
+ // the first two buttons need a new size (wider) and position (more left)
+ Window** pCurrent = pWins;
+ const sal_uInt32 nBtnCount = 2;
+ for ( ; i < nBtnCount; ++i, ++pCurrent )
+ {
+ Size aNewSize = (*pCurrent)->GetSizePixel();
+ aNewSize.Width() += nDelta;
+ (*pCurrent)->SetSizePixel( aNewSize );
+ Point aNewPos = (*pCurrent)->GetPosPixel();
+ aNewPos.X() -= nDelta;
+ (*pCurrent)->SetPosPixel( aNewPos );
+ }
+
+ // loop through all the other windows and adjust their size
+ for ( ; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent )
+ {
+ Size aSize = (*pCurrent)->GetSizePixel();
+ aSize.Width() -= nDelta;
+ (*pCurrent)->SetSizePixel( aSize );
+ }
+ }
+ }
+
+ String ErrorRepSendDialog::GetDocType( void ) const
+ {
+ return maDocTypeED.GetText();
+ }
+
+ String ErrorRepSendDialog::GetUsing( void ) const
+ {
+ return maUsingML.GetText();
+ }
+
+ bool ErrorRepSendDialog::IsContactAllowed( void ) const
+ {
+ return maContactCB.IsChecked();
+ }
+
+ String ErrorRepSendDialog::GetEMailAddress( void ) const
+ {
+ return maEMailAddrED.GetText();
+ }
+
+
+ ///////////////////////////////////////////////////////////////////////
+ // Error Report Options Dialog
+ ///////////////////////////////////////////////////////////////////////
+
+ ErrorRepOptionsDialog::ErrorRepOptionsDialog( Window* _pParent, ErrorRepParams& _rParams )
+ :ModalDialog ( _pParent, SVX_RES( RID_SVX_MDLG_ERR_REP_OPTIONS ) )
+ ,maProxyFL( this, SVX_RES( FL_ERROPT_PROXY ) )
+ ,maSystemBtn( this, SVX_RES( BTN_ERROPT_SYSTEM ) )
+ ,maDirectBtn( this, SVX_RES( BTN_ERROPT_DIRECT ) )
+ ,maManualBtn( this, SVX_RES( BTN_ERROPT_MANUAL ) )
+ ,maProxyServerFT( this, SVX_RES( FT_ERROPT_PROXYSERVER ) )
+ ,maProxyServerEd( this, SVX_RES( ED_ERROPT_PROXYSERVER ) )
+ ,maProxyPortFT( this, SVX_RES( FT_ERROPT_PROXYPORT ) )
+ ,maProxyPortEd( this, SVX_RES( ED_ERROPT_PROXYPORT ) )
+ ,maDescriptionFT( this, SVX_RES( FT_ERROPT_DESCRIPTION ) )
+ ,maButtonsFL( this, SVX_RES( FL_ERROPT_BUTTONS ) )
+ ,maOKBtn( this, SVX_RES( BTN_ERROPT_OK ) )
+ ,maCancelBtn( this, SVX_RES( BTN_ERROPT_CANCEL ) )
+ ,mrParams( _rParams )
+ {
+ FreeResource();
+
+ maManualBtn.SetToggleHdl( LINK( this, ErrorRepOptionsDialog, ManualBtnHdl ) );
+ maCancelBtn.SetClickHdl( LINK( this, ErrorRepOptionsDialog, CancelBtnHdl ) );
+ maOKBtn.SetClickHdl( LINK( this, ErrorRepOptionsDialog, OKBtnHdl ) );
+
+ maProxyServerEd.SetText( mrParams.maHTTPProxyServer );
+ maProxyPortEd.SetText( mrParams.maHTTPProxyPort );
+
+#ifndef WNT
+ // no "Use system settings" button on non windows systems
+ // so hide this button
+ maSystemBtn.Hide();
+ long nDelta = maDirectBtn.GetPosPixel().Y() - maSystemBtn.GetPosPixel().Y();
+ // and loop through all these controls and adjust their position
+ Window* pWins[] =
+ {
+ &maDirectBtn, &maManualBtn, &maProxyServerFT,
+ &maProxyServerEd, &maProxyPortFT, &maProxyPortEd, &maDescriptionFT
+ };
+ Window** pCurrent = pWins;
+ for ( sal_uInt32 i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent )
+ {
+ Point aPos = (*pCurrent)->GetPosPixel();
+ aPos.Y() -= nDelta;
+ (*pCurrent)->SetPosPixel( aPos );
+ }
+#endif
+
+
+ switch ( mrParams.miHTTPConnectionType )
+ {
+ default:
+#ifdef WNT
+ case 0:
+ maSystemBtn.Check( sal_True );
+ break;
+#endif
+ case 1:
+ maDirectBtn.Check( sal_True );
+ break;
+ case 2:
+ maManualBtn.Check( sal_True );
+ break;
+ }
+
+ ManualBtnHdl( 0 );
+ }
+
+ ErrorRepOptionsDialog::~ErrorRepOptionsDialog()
+ {
+ }
+
+ IMPL_LINK( ErrorRepOptionsDialog, ManualBtnHdl, void*, EMPTYARG )
+ {
+ bool bCheck = maManualBtn.IsChecked();
+ maProxyServerFT.Enable( bCheck );
+ maProxyServerEd.Enable( bCheck );
+ maProxyPortFT.Enable( bCheck );
+ maProxyPortEd.Enable( bCheck );
+ return 0;
+ }
+
+ IMPL_LINK( ErrorRepOptionsDialog, OKBtnHdl, void*, EMPTYARG )
+ {
+ if ( maManualBtn.IsChecked() )
+ mrParams.miHTTPConnectionType = 2;
+ else if ( maDirectBtn.IsChecked() )
+ mrParams.miHTTPConnectionType = 1;
+ else if ( maSystemBtn.IsChecked() )
+ mrParams.miHTTPConnectionType = 0;
+
+ mrParams.maHTTPProxyServer = maProxyServerEd.GetText();
+ mrParams.maHTTPProxyPort = maProxyPortEd.GetText();
+
+ EndDialog(DLG_RET_OK);
+ return 0;
+ }
+
+ IMPL_LINK( ErrorRepOptionsDialog, CancelBtnHdl, void*, EMPTYARG )
+ {
+ EndDialog(DLG_RET_CANCEL);
+ return 0;
+ }
+
+ ///////////////////////////////////////////////////////////////////////
+ // Error Report Edit (MultiLineEdit with fixed font)
+ ///////////////////////////////////////////////////////////////////////
+
+ ErrorRepEdit::ErrorRepEdit( Window* pParent, const ResId& rResId ) :
+ ExtMultiLineEdit( pParent, rResId )
+ {
+ // fixed font for error report
+ Color aColor = GetTextColor();
+
+ Font aFont = OutputDevice::GetDefaultFont(
+ DEFAULTFONT_FIXED, LANGUAGE_SYSTEM, DEFAULTFONT_FLAGS_ONLYONE );
+
+ // Set font color because the default font color is transparent !!!
+ aFont.SetColor( aColor );
+
+ GetTextEngine()->SetFont( aFont );
+
+ // no blinking cursor and a little left margin
+ EnableCursor( sal_False );
+ SetLeftMargin( 4 );
+ }
+
+ ErrorRepEdit::~ErrorRepEdit()
+ {
+ }
+
+ ///////////////////////////////////////////////////////////////////////
+ // Error Report Preview Dialog
+ ///////////////////////////////////////////////////////////////////////
+
+
+ static ::rtl::OUString GetCrashConfigDir()
+ {
+
+#if defined(WNT) || defined(OS2)
+ OUString ustrValue = OUString::createFromAscii("${$BRAND_BASE_DIR/program/bootstrap.ini:UserInstallation}");
+#elif defined( MACOSX )
+ OUString ustrValue = OUString::createFromAscii("~");
+#else
+ OUString ustrValue = OUString::createFromAscii("$SYSUSERCONFIG");
+#endif
+ Bootstrap::expandMacros( ustrValue );
+
+#if defined(WNT) || defined(OS2)
+ ustrValue += OUString::createFromAscii("/user/crashdata");
+#endif
+ return ustrValue;
+ }
+
+#if defined(WNT) || defined(OS2)
+#define CHKFILE "crashdat.chk"
+#define STKFILE "crashdat.stk"
+#define PRVFILE "crashdat.prv"
+#else
+#define CHKFILE ".crash_report_checksum"
+#define STKFILE ".crash_report_frames"
+#define PRVFILE ".crash_report_preview"
+#endif
+
+// static ::rtl::OUString GetChecksumURL()
+// {
+// ::rtl::OUString aURL = GetCrashConfigDir();
+
+// aURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
+// aURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CHKFILE ) );
+
+// return aURL;
+// }
+
+// static ::rtl::OUString GetStackURL()
+// {
+// ::rtl::OUString aURL = GetCrashConfigDir();
+
+// aURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
+// aURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( STKFILE ) );
+
+// return aURL;
+// }
+
+ static ::rtl::OUString GetPreviewURL()
+ {
+ ::rtl::OUString aURL = GetCrashConfigDir();
+
+ aURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
+ aURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( PRVFILE ) );
+
+ return aURL;
+ }
+
+ static String LoadCrashFile( const ::rtl::OUString &rURL )
+ {
+ String aFileContent;
+ ::osl::File aFile( rURL );
+
+ printf( "Loading %s:", OString( rURL.getStr(), rURL.getLength(), osl_getThreadTextEncoding() ).getStr() );
+ if ( ::osl::FileBase::E_None == aFile.open( OpenFlag_Read ) )
+ {
+ ::rtl::OString aContent;
+ ::osl::FileBase::RC result;
+ sal_uInt64 aBytesRead;
+
+ do
+ {
+ sal_Char aBuffer[256];
+
+ result = aFile.read( aBuffer, sizeof(aBuffer), aBytesRead );
+
+ if ( ::osl::FileBase::E_None == result )
+ {
+ ::rtl::OString aTemp( aBuffer, static_cast< xub_StrLen >( aBytesRead ) );
+ aContent += aTemp;
+ }
+ } while ( ::osl::FileBase::E_None == result && aBytesRead );
+
+ ::rtl::OUString ustrContent( aContent.getStr(), aContent.getLength(), RTL_TEXTENCODING_UTF8 );
+ aFileContent = ustrContent;
+
+ aFile.close();
+
+ printf( "SUCCEEDED\n" );
+ }
+ else
+ printf( "FAILED\n" );
+
+ return aFileContent;
+ }
+
+
+
+ ErrorRepPreviewDialog::ErrorRepPreviewDialog( Window* _pParent )
+ :ModalDialog ( _pParent, SVX_RES( RID_SVX_MDLG_ERR_REP_PREVIEW ) )
+ ,maContentML( this, SVX_RES( ML_ERRPREVIEW_CONTENT ) )
+ ,maOKBtn( this, SVX_RES( BTN_ERRPREVIEW_OK ) )
+
+ {
+ FreeResource();
+
+ mnMinHeight = ( maContentML.GetSizePixel().Height() / 2 );
+
+ String aPreview = LoadCrashFile( GetPreviewURL() );
+ ErrorRepSendDialog *pMainDlg = (ErrorRepSendDialog *)_pParent;
+
+ String aSeperator = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "\r\n\r\n================\r\n\r\n" ) );
+
+ String aContent = pMainDlg->GetDocType();
+ if ( aContent.Len() > 0 )
+ aContent += aSeperator;
+ aContent += pMainDlg->GetUsing();
+ if ( aContent.Len() > 0 )
+ aContent += aSeperator;
+ aContent += aPreview;
+
+ maContentML.SetText( aContent );
+ }
+
+ ErrorRepPreviewDialog::~ErrorRepPreviewDialog()
+ {
+ }
+
+ void ErrorRepPreviewDialog::Resize()
+ {
+ Size a3Sz = LogicToPixel( Size( 3, 3 ), MAP_APPFONT );
+ Size aWinSz = GetSizePixel();
+ Size aBtnSz = maOKBtn.GetSizePixel();
+ Point aEditPnt = maContentML.GetPosPixel();
+
+ long nNewHeight = Max( aWinSz.Height() - aEditPnt.Y() - 3 * a3Sz.Height() - aBtnSz.Height(), mnMinHeight );
+ long nNewWidth = aWinSz.Width() - 4 * a3Sz.Width();
+
+ Size aNewSize( nNewWidth, nNewHeight );
+ maContentML.SetSizePixel( aNewSize );
+ Point aNewPoint( Max( aEditPnt.X() + aNewSize.Width() - aBtnSz.Width(), aEditPnt.X() ),
+ aEditPnt.Y() + aNewSize.Height() + a3Sz.Height() );
+ maOKBtn.SetPosPixel( aNewPoint );
+ }
+ } // namespace DocRecovery
+} // namespace svx
+
diff --git a/svx/source/dialog/docrecovery.hrc b/svx/source/dialog/docrecovery.hrc
new file mode 100644
index 000000000000..acf1a1631c6b
--- /dev/null
+++ b/svx/source/dialog/docrecovery.hrc
@@ -0,0 +1,292 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_DOCRECOVERY_HRC
+#define _SVX_DOCRECOVERY_HRC
+
+#include <svtools/controldims.hrc>
+
+// general
+
+#define PROGR_HEIGHT (RSC_CD_PUSHBUTTON_HEIGHT)
+
+// TabDialog
+#define TABDLG_WIDTH 290
+#define TABDLG_HEIGHT 238
+
+// TabPage CrashSave
+
+#define WIN_SAVE_TITLE 1
+#define FT_SAVE_TITLE 2
+#define FL_SAVE_TITLE 3
+#define FT_SAVE_DESCR 4
+#define FT_SAVE_FILELIST 5
+#define LB_SAVE_FILELIST 6
+#define CB_SAVE_LAUNCHAUTO 7
+#define FL_SAVE_BOTTOM 8
+#define BT_SAVE_OK 9
+
+
+#define SAVE_WIDTH 290
+#define SAVE_HEIGHT 238
+#define SAVE_TITLEWINHEIGHT 36
+#define SAVE_DESCRHEIGHT 48
+#define SAVE_COL0 (RSC_SP_DLG_INNERBORDER_LEFT)
+#define SAVE_COL2 (SAVE_WIDTH-RSC_SP_DLG_INNERBORDER_RIGHT)
+#define SAVE_COL1 (SAVE_COL2-RSC_CD_PUSHBUTTON_WIDTH)
+#define SAVE_ROW0 ((SAVE_TITLEWINHEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2)
+#define SAVE_ROW1 (SAVE_TITLEWINHEIGHT)
+#define SAVE_ROW2 (SAVE_ROW1+RSC_SP_CTRL_Y)
+#define SAVE_ROW3 (SAVE_ROW2+3*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define SAVE_ROW4 (SAVE_ROW3+RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define SAVE_ROW9 (SAVE_HEIGHT-RSC_SP_DLG_INNERBORDER_BOTTOM)
+#define SAVE_ROW8 (SAVE_ROW9-RSC_CD_PUSHBUTTON_HEIGHT)
+#define SAVE_ROW7 (SAVE_ROW8-RSC_SP_CTRL_GROUP_Y-RSC_CD_FIXEDLINE_HEIGHT)
+#define SAVE_ROW6 (SAVE_ROW7-RSC_SP_CTRL_GROUP_Y-RSC_CD_CHECKBOX_HEIGHT)
+#define SAVE_ROW5 (SAVE_ROW6-RSC_SP_CTRL_Y)
+#define SAVE_FILELISTHEIGHT (SAVE_ROW5-SAVE_ROW4)
+#define SAVE_CONTROLWIDTH (SAVE_COL2-SAVE_COL0)
+
+// Save Progress Dialog
+
+#define FT_SAVEPROGR_HINT 1
+#define FT_SAVEPROGR_PROGR 2
+#define WIN_SAVEPROGR_PROGR 3
+
+#define SAVEPROGR_WIDTH 240
+#define SAVEPROGR_COL0 (RSC_SP_DLG_INNERBORDER_LEFT)
+#define SAVEPROGR_COL1 (SAVEPROGR_WIDTH-RSC_SP_DLG_INNERBORDER_RIGHT)
+#define SAVEPROGR_ROW0 (RSC_SP_DLG_INNERBORDER_TOP)
+#define SAVEPROGR_ROW1 (SAVEPROGR_ROW0+2*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_Y)
+#define SAVEPROGR_ROW2 (SAVEPROGR_ROW1+RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define SAVEPROGR_ROW3 (SAVEPROGR_ROW2+PROGR_HEIGHT)
+#define SAVEPROGR_CONTROLWIDTH (SAVEPROGR_COL1-SAVEPROGR_COL0)
+#define SAVEPROGR_HEIGHT (SAVEPROGR_ROW3+RSC_SP_DLG_INNERBORDER_BOTTOM)
+
+// TabPage Recovery
+
+#define WIN_RECOV_TITLE 1
+#define FT_RECOV_TITLE 2
+#define FL_RECOV_TITLE 3
+#define FT_RECOV_DESCR 4
+#define FT_RECOV_PROGR 5
+#define WIN_RECOV_PROGR 6
+#define FT_RECOV_FILELIST 7
+#define LB_RECOV_FILELIST 8
+#define FL_RECOV_BOTTOM 9
+#define BTN_RECOV_PREV 10
+#define BTN_RECOV_NEXT 11
+#define BTN_RECOV_CANCEL 12
+#define STR_HEADERBAR 13
+#define IMG_GREENCHECK 14
+#define IMG_YELLOWCHECK 15
+#define IMG_REDCROSS 16
+#define IMG_GREENCHECK_HC 17
+#define IMG_YELLOWCHECK_HC 18
+#define IMG_REDCROSS_HC 19
+#define STR_SUCCESSRECOV 20
+#define STR_ORIGDOCRECOV 21
+#define STR_RECOVFAILED 22
+#define STR_RECOVINPROGR 23
+#define STR_NOTRECOVYET 24
+#define STR_RECOVERY_NEXT 25
+#define STR_RECOVERY_INPROGRESS 26
+#define STR_RECOVERY_REPORT 27
+#define STR_RECOVERYONLY_FINISH_DESCR 28
+#define STR_RECOVERYONLY_FINISH 29
+
+#define RECOV_WIDTH SAVE_WIDTH
+#define RECOV_HEIGHT SAVE_HEIGHT
+#define RECOV_TITLEWINHEIGHT SAVE_TITLEWINHEIGHT
+#define RECOV_DESCRHEIGHT 6*RSC_CD_FIXEDTEXT_HEIGHT
+#define RECOV_COL1 (RSC_SP_DLG_INNERBORDER_LEFT)
+#define RECOV_COL2 40
+#define RECOV_COL3 (RECOV_WIDTH-RSC_SP_DLG_INNERBORDER_RIGHT)
+#define RECOV_COL_A (RECOV_COL1)
+#define RECOV_COL_B (COL_1+RSC_CD_PUSHBUTTON_WIDTH)
+#define RECOV_COL_G (RECOV_COL3)
+#define RECOV_COL_F (RECOV_COL_G-RSC_CD_PUSHBUTTON_WIDTH)
+#define RECOV_COL_E (RECOV_COL_F-RSC_SP_CTRL_X)
+#define RECOV_COL_D (RECOV_COL_E-RSC_CD_PUSHBUTTON_WIDTH)
+#define RECOV_COL_C (RECOV_COL_D-RSC_CD_PUSHBUTTON_WIDTH)
+#define RECOV_ROW0 ((RECOV_TITLEWINHEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2)
+#define RECOV_ROW1 (RECOV_TITLEWINHEIGHT)
+#define RECOV_ROW2 (RECOV_ROW1+RSC_SP_CTRL_Y)
+#define RECOV_ROW3 (RECOV_ROW2+RECOV_DESCRHEIGHT+RSC_SP_CTRL_DESC_Y)
+#define RECOV_ROW4 (RECOV_ROW3+RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define RECOV_ROW5 (RECOV_ROW4+PROGR_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+#define RECOV_ROW6 (RECOV_ROW5+RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define RECOV_ROW10 (RECOV_HEIGHT-RSC_SP_DLG_INNERBORDER_BOTTOM)
+#define RECOV_ROW9 (RECOV_ROW10-RSC_CD_PUSHBUTTON_HEIGHT)
+#define RECOV_ROW8 (RECOV_ROW9-RSC_SP_CTRL_GROUP_Y-RSC_CD_FIXEDLINE_HEIGHT)
+#define RECOV_ROW7 (RECOV_ROW8-RSC_SP_CTRL_GROUP_Y)
+#define RECOV_FILELISTHEIGHT (RECOV_ROW7-RECOV_ROW6)
+#define RECOV_CONTROLWIDTH (SAVE_COL2-SAVE_COL0)
+
+// TabPage Broken Recovery
+
+#define FT_BROKEN_DESCR 1
+#define FT_BROKEN_FILELIST 2
+#define LB_BROKEN_FILELIST 3
+#define FT_BROKEN_SAVEDIR 4
+#define ED_BROKEN_SAVEDIR 5
+#define BTN_BROKEN_SAVEDIR 6
+#define FL_BROKEN_BOTTOM 7
+#define BTN_BROKEN_OK 8
+#define BTN_BROKEN_CANCEL 9
+
+#define BROKEN_WIDTH 210
+#define BROKEN_HEIGHT 160
+#define BROKEN_COL0 (RSC_SP_DLG_INNERBORDER_LEFT)
+#define BROKEN_COL4 (BROKEN_WIDTH-RSC_SP_DLG_INNERBORDER_RIGHT)
+#define BROKEN_COL3 (BROKEN_COL4-RSC_CD_PUSHBUTTON_WIDTH)
+#define BROKEN_COL2 (BROKEN_COL3-RSC_SP_CTRL_GROUP_X)
+#define BROKEN_COL1 (BROKEN_COL2-RSC_CD_PUSHBUTTON_WIDTH)
+
+#define BROKEN_ROW0 (RSC_SP_DLG_INNERBORDER_TOP)
+#define BROKEN_ROW1 (BROKEN_ROW0+5*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+#define BROKEN_ROW2 (BROKEN_ROW1+RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+#define BROKEN_ROW8 (BROKEN_HEIGHT-RSC_SP_DLG_INNERBORDER_BOTTOM)
+#define BROKEN_ROW7 (BROKEN_ROW8-RSC_CD_PUSHBUTTON_HEIGHT)
+#define BROKEN_ROW6 (BROKEN_ROW7-RSC_SP_FLGR_INNERBORDER_BOTTOM-RSC_CD_FIXEDLINE_HEIGHT)
+#define BROKEN_ROW5 (BROKEN_ROW6-RSC_SP_FLGR_INNERBORDER_TOP-RSC_CD_PUSHBUTTON_HEIGHT)
+#define BROKEN_ROW4 (BROKEN_ROW5-RSC_SP_CTRL_GROUP_Y-RSC_CD_FIXEDTEXT_HEIGHT)
+#define BROKEN_ROW3 (BROKEN_ROW4-RSC_SP_CTRL_GROUP_Y)
+
+#define BROKEN_CONTROLWIDTH (BROKEN_COL4-BROKEN_COL0)
+
+// TabPage Error Report Welcome
+// most defines equal to TabPage Recovery
+
+#define RECOV_DESCR_HEIGHT (RECOV_ROW7-RECOV_ROW2)
+
+// TabPage Error Report Send
+// borrow basic metrics from TabPage Recovery
+
+#define FT_ERRSEND_DOCTYPE 20
+#define ED_ERRSEND_DOCTYPE 21
+#define FT_ERRSEND_USING 22
+#define ML_ERRSEND_USING 23
+#define BTN_ERRSEND_SHOWREP 24
+#define BTN_ERRSEND_OPT 25
+#define CB_ERRSEND_CONTACT 26
+#define FT_ERRSEND_EMAILADDR 27
+#define ED_ERRSEND_EMAILADDR 28
+
+#define ERRSEND_WIDTH (RECOV_WIDTH)
+#define ERRSEND_HEIGHT (RECOV_HEIGHT)
+#define ERRSEND_TITLEWINHEIGHT SAVE_TITLEWINHEIGHT
+
+#define ERRSEND_COL0 (RSC_SP_DLG_INNERBORDER_LEFT)
+#define ERRSEND_COL1 (ERRSEND_COL0+RSC_SP_CHK_TEXTINDENT)
+
+#define ERRSEND_COL4 (ERRSEND_WIDTH-RSC_SP_DLG_INNERBORDER_RIGHT)
+#define ERRSEND_COL3 (ERRSEND_COL4-RSC_CD_PUSHBUTTON_WIDTH)
+#define ERRSEND_COL2 (ERRSEND_COL3-RSC_SP_CTRL_X)
+
+#define ERRSEND_COL6 (ERRSEND_COL3-RSC_SP_CTRL_GROUP_X-RSC_CD_PUSHBUTTON_WIDTH)
+#define ERRSEND_COL5 (ERRSEND_COL6-RSC_SP_CTRL_X-RSC_CD_PUSHBUTTON_WIDTH)
+
+#define ERRSEND_CONTROLWIDTH1 (ERRSEND_COL4-ERRSEND_COL0)
+#define ERRSEND_CONTROLWIDTH2 (ERRSEND_COL2-ERRSEND_COL0)
+#define ERRSEND_CONTROLWIDTH3 (ERRSEND_COL2-ERRSEND_COL1)
+
+#define ERRSEND_ROW0 ((ERRSEND_TITLEWINHEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2)
+#define ERRSEND_ROW1 (ERRSEND_TITLEWINHEIGHT)
+#define ERRSEND_ROW2 (ERRSEND_ROW1+RSC_SP_CTRL_Y)
+#define ERRSEND_ROW3 (ERRSEND_ROW2+3*RSC_CD_FIXEDTEXT_HEIGHT)
+#define ERRSEND_ROW4 (ERRSEND_ROW3+RSC_SP_CTRL_GROUP_Y)
+#define ERRSEND_ROW5 (ERRSEND_ROW4+2*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+#define ERRSEND_ROW6 (ERRSEND_ROW5+RSC_CD_TEXTBOX_HEIGHT)
+#define ERRSEND_ROW7 (ERRSEND_ROW6+RSC_SP_CTRL_Y)
+#define ERRSEND_ROW8 (ERRSEND_ROW7+RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+#define ERRSEND_ROW9 (ERRSEND_ROW8+RSC_CD_PUSHBUTTON_HEIGHT)
+#define ERRSEND_ROW10 (ERRSEND_ROW9+RSC_SP_CTRL_GROUP_Y)
+#define ERRSEND_ROW11 (ERRSEND_ROW10+RSC_CD_PUSHBUTTON_HEIGHT)
+
+#define ERRSEND_ROW16 (ERRSEND_HEIGHT-RSC_SP_DLG_INNERBORDER_RIGHT-RSC_CD_PUSHBUTTON_HEIGHT)
+#define ERRSEND_ROW15 (ERRSEND_ROW16-RSC_SP_CTRL_GROUP_Y-RSC_CD_FIXEDLINE_HEIGHT)
+#define ERRSEND_ROW14 (ERRSEND_ROW15-RSC_SP_CTRL_GROUP_Y-RSC_CD_TEXTBOX_HEIGHT)
+#define ERRSEND_ROW13 (ERRSEND_ROW14-RSC_SP_CTRL_GROUP_Y-RSC_CD_FIXEDTEXT_HEIGHT)
+#define ERRSEND_ROW12 (ERRSEND_ROW13-RSC_SP_CTRL_GROUP_Y-RSC_CD_CHECKBOX_HEIGHT)
+
+// Error Report Options Dialog
+
+#define ERROPT_WIDTH 220
+#define ERROPT_HEIGHT 180
+
+#define FL_ERROPT_PROXY 1
+#define BTN_ERROPT_SYSTEM 2
+#define BTN_ERROPT_DIRECT 3
+#define BTN_ERROPT_MANUAL 4
+#define FT_ERROPT_PROXYSERVER 5
+#define ED_ERROPT_PROXYSERVER 6
+#define FT_ERROPT_PROXYPORT 7
+#define ED_ERROPT_PROXYPORT 8
+#define FT_ERROPT_DESCRIPTION 9
+#define FL_ERROPT_BUTTONS 10
+#define BTN_ERROPT_OK 11
+#define BTN_ERROPT_CANCEL 12
+
+#define ERROPT_COLA (RSC_SP_DLG_INNERBORDER_LEFT)
+#define ERROPT_COLB (ERROPT_COLA + RSC_SP_CTRL_X)
+#define ERROPT_COLC (ERROPT_COLB + RSC_SP_CHK_TEXTINDENT)
+
+#define ERROPT_COLF (ERROPT_WIDTH - RSC_SP_DLG_INNERBORDER_RIGHT)
+#define ERROPT_COLE (ERROPT_COLF - RSC_CD_PUSHBUTTON_WIDTH)
+#define ERROPT_COLD (ERROPT_COLE - RSC_SP_CTRL_DESC_X - RSC_CD_PUSHBUTTON_WIDTH)
+
+#define ERROPT_ROW0 (RSC_SP_DLG_INNERBORDER_TOP)
+#define ERROPT_ROW1 (ERROPT_ROW0 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_CTRL_Y)
+#define ERROPT_ROW2 (ERROPT_ROW1 + RSC_CD_RADIOBUTTON_HEIGHT + RSC_SP_CTRL_GROUP_Y)
+#define ERROPT_ROW3 (ERROPT_ROW2 + RSC_CD_RADIOBUTTON_HEIGHT + RSC_SP_CTRL_GROUP_Y)
+#define ERROPT_ROW4 (ERROPT_ROW3 + RSC_CD_RADIOBUTTON_HEIGHT + RSC_SP_CTRL_GROUP_Y)
+#define ERROPT_ROW5 (ERROPT_ROW4 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_DESC_Y)
+#define ERROPT_ROW6 (ERROPT_ROW5 + RSC_CD_TEXTBOX_HEIGHT + RSC_SP_CTRL_Y)
+
+#define ERROPT_ROW9 (ERROPT_HEIGHT - RSC_SP_DLG_INNERBORDER_BOTTOM - RSC_CD_PUSHBUTTON_HEIGHT)
+#define ERROPT_ROW8 (ERROPT_ROW9 - RSC_SP_CTRL_DESC_Y - RSC_CD_FIXEDLINE_HEIGHT)
+#define ERROPT_ROW7 (ERROPT_ROW8 - RSC_SP_CTRL_DESC_Y)
+
+#define ERROPT_SERVER_WIDTH 150
+#define ERROPT_PORT_WIDTH (ERROPT_COLF-ERROPT_COLC-RSC_SP_CTRL_GROUP_X-ERROPT_SERVER_WIDTH)
+
+// Error Report Preview Dialog
+
+#define ERRPREVIEW_WIDTH 300
+#define ERRPREVIEW_HEIGHT 200
+
+#define ML_ERRPREVIEW_CONTENT 1
+#define BTN_ERRPREVIEW_OK 2
+#define ERRPREVIEW_COLA (RSC_SP_DLG_INNERBORDER_LEFT)
+#define ERRPREVIEW_COLB (ERRPREVIEW_WIDTH - RSC_SP_DLG_INNERBORDER_RIGHT - RSC_CD_PUSHBUTTON_WIDTH)
+#define ERRPREVIEW_COLC (ERRPREVIEW_WIDTH - RSC_SP_DLG_INNERBORDER_RIGHT)
+#define ERRPREVIEW_ROW0 (RSC_SP_DLG_INNERBORDER_TOP)
+#define ERRPREVIEW_ROW1 (ERRPREVIEW_ROW2 - RSC_SP_CTRL_Y)
+#define ERRPREVIEW_ROW2 (ERRPREVIEW_HEIGHT - RSC_SP_DLG_INNERBORDER_BOTTOM - RSC_CD_PUSHBUTTON_HEIGHT)
+
+#endif
diff --git a/svx/source/dialog/docrecovery.src b/svx/source/dialog/docrecovery.src
new file mode 100644
index 000000000000..cf9cf6f0adcf
--- /dev/null
+++ b/svx/source/dialog/docrecovery.src
@@ -0,0 +1,654 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+
+#include "docrecovery.hrc"
+
+TabDialog RID_SVX_TABDLG_DOCRECOVERY
+{
+ Size = MAP_APPFONT( TABDLG_WIDTH, TABDLG_HEIGHT );
+ HelpId = HID_SVX_TABDLG_DOCRECOVERY;
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Moveable = TRUE;
+ Closeable = FALSE;
+ Text = "%PRODUCTNAME %PRODUCTVERSION";
+};
+
+TabPage RID_SVXPAGE_DOCRECOVERY_SAVE
+{
+ Size = MAP_APPFONT( SAVE_WIDTH, SAVE_HEIGHT );
+ HelpId = HID_SVX_TP_DOCRECOVERY_SAVE;
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Hide = TRUE;
+ Window WIN_SAVE_TITLE
+ {
+ Pos = MAP_APPFONT( 0 , 0 );
+ Size = MAP_APPFONT( SAVE_WIDTH, SAVE_ROW1 );
+ };
+ FixedText FT_SAVE_TITLE
+ {
+ Pos = MAP_APPFONT( SAVE_COL0 , SAVE_ROW0 );
+ Size = MAP_APPFONT( SAVE_CONTROLWIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "%PRODUCTNAME Document Recovery";
+ };
+ FixedLine FL_SAVE_TITLE
+ {
+ Pos = MAP_APPFONT( 0 , SAVE_ROW1 );
+ Size = MAP_APPFONT( SAVE_WIDTH, 2 );
+ };
+ FixedText FT_SAVE_DESCR
+ {
+ Pos = MAP_APPFONT( SAVE_COL0 , SAVE_ROW2 );
+ Size = MAP_APPFONT( SAVE_CONTROLWIDTH, (SAVE_ROW3-SAVE_ROW2-RSC_SP_CTRL_DESC_Y) );
+ WordBreak = TRUE;
+ Text[ en-US ] = "Due to an unexpected error, %PRODUCTNAME crashed. All the files you were working on will now be saved. The next time %PRODUCTNAME is launched, your files will be recovered automatically.";
+ };
+ FixedText FT_SAVE_FILELIST
+ {
+ Pos = MAP_APPFONT( SAVE_COL0 , SAVE_ROW3 );
+ Size = MAP_APPFONT( SAVE_CONTROLWIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "The following files will be recovered:";
+ };
+ ListBox LB_SAVE_FILELIST
+ {
+ HelpID = "svx:ListBox:RID_SVXPAGE_DOCRECOVERY_SAVE:LB_SAVE_FILELIST";
+ Pos = MAP_APPFONT( SAVE_COL0 , SAVE_ROW4 );
+ Size = MAP_APPFONT( SAVE_CONTROLWIDTH, SAVE_FILELISTHEIGHT );
+ Border = TRUE;
+ TabStop = TRUE;
+ };
+ FixedLine FL_SAVE_BOTTOM
+ {
+ Pos = MAP_APPFONT( 0 , SAVE_ROW7 );
+ Size = MAP_APPFONT( SAVE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ };
+ OKButton BT_SAVE_OK
+ {
+ Pos = MAP_APPFONT( SAVE_COL1 , SAVE_ROW8 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ DefButton = TRUE;
+ };
+};
+
+ModalDialog RID_SVX_MDLG_DOCRECOVERY_PROGR
+{
+ Size = MAP_APPFONT( SAVEPROGR_WIDTH, SAVEPROGR_HEIGHT );
+ HelpId = HID_SVX_MDLG_DOCRECOVERY_PROGR;
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Moveable = TRUE;
+ Closeable = FALSE;
+ Text = "%PRODUCTNAME %PRODUCTVERSION";
+
+ FixedText FT_SAVEPROGR_HINT
+ {
+ Pos = MAP_APPFONT( SAVEPROGR_COL0, SAVEPROGR_ROW0 );
+ Size = MAP_APPFONT( SAVEPROGR_CONTROLWIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "Documents are being saved.";
+ };
+ FixedText FT_SAVEPROGR_PROGR
+ {
+ Pos = MAP_APPFONT( SAVEPROGR_COL0, SAVEPROGR_ROW1 );
+ Size = MAP_APPFONT( SAVEPROGR_CONTROLWIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "Progress of saving: ";
+ };
+ Window WIN_SAVEPROGR_PROGR
+ {
+ Pos = MAP_APPFONT( SAVEPROGR_COL0, SAVEPROGR_ROW2 );
+ Size = MAP_APPFONT( SAVEPROGR_CONTROLWIDTH, PROGR_HEIGHT );
+ Border = TRUE;
+ };
+};
+
+TabPage RID_SVXPAGE_DOCRECOVERY_RECOVER
+{
+ Size = MAP_APPFONT( RECOV_WIDTH, RECOV_HEIGHT );
+ HelpId = HID_SVX_TP_DOCRECOVERY_RECOVER;
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Hide = TRUE;
+ Window WIN_RECOV_TITLE
+ {
+ Pos = MAP_APPFONT( 0 , 0 );
+ Size = MAP_APPFONT( RECOV_WIDTH, RECOV_TITLEWINHEIGHT );
+ };
+ FixedText FT_RECOV_TITLE
+ {
+ Pos = MAP_APPFONT( RECOV_COL1, RECOV_ROW0 );
+ Size = MAP_APPFONT( RECOV_CONTROLWIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "%PRODUCTNAME Document Recovery";
+ };
+ FixedLine FL_RECOV_TITLE
+ {
+ Pos = MAP_APPFONT( 0 , RECOV_TITLEWINHEIGHT );
+ Size = MAP_APPFONT( RECOV_WIDTH, 2 );
+ };
+ FixedText FT_RECOV_DESCR
+ {
+ Pos = MAP_APPFONT( RECOV_COL1, RECOV_ROW2 );
+ Size = MAP_APPFONT( RECOV_CONTROLWIDTH, RECOV_DESCRHEIGHT );
+ WordBreak = TRUE;
+ Text[ en-US ] = "Press 'Start Recovery' to start the recovery process of the documents listed below.\n\nThe 'Status' column shows whether the document could be recovered.";
+ };
+ FixedText FT_RECOV_PROGR
+ {
+ Pos = MAP_APPFONT( RECOV_COL1, RECOV_ROW3 );
+ Size = MAP_APPFONT( RECOV_CONTROLWIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "Recovering document:";
+ };
+ Window WIN_RECOV_PROGR
+ {
+ Pos = MAP_APPFONT( RECOV_COL1, RECOV_ROW4 );
+ Size = MAP_APPFONT( RECOV_CONTROLWIDTH, PROGR_HEIGHT );
+ Border = TRUE;
+ };
+ FixedText FT_RECOV_FILELIST
+ {
+ Pos = MAP_APPFONT( RECOV_COL1, RECOV_ROW5 );
+ Size = MAP_APPFONT( RECOV_CONTROLWIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "Status of recovered documents:";
+ };
+ String STR_HEADERBAR
+ {
+ Text[ en-US ] = "Document Name\tStatus";
+ };
+ Control LB_RECOV_FILELIST
+ {
+ Pos = MAP_APPFONT( RECOV_COL1, RECOV_ROW6 );
+ Size = MAP_APPFONT( RECOV_CONTROLWIDTH, RECOV_FILELISTHEIGHT );
+ Border = TRUE;
+ SVLook = TRUE;
+ };
+ FixedLine FL_RECOV_BOTTOM
+ {
+ Pos = MAP_APPFONT( 0 , RECOV_ROW8 );
+ Size = MAP_APPFONT( RECOV_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ };
+ PushButton BTN_RECOV_NEXT
+ {
+ HelpID = "svx:PushButton:RID_SVXPAGE_DOCRECOVERY_RECOVER:BTN_RECOV_NEXT";
+ Pos = MAP_APPFONT( RECOV_COL_C, RECOV_ROW9 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH*2, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text[ en-US ] = "~Start Recovery >";
+ DefButton = TRUE;
+ };
+ String STR_RECOVERY_NEXT
+ {
+ Text[ en-US ] = "~Next >";
+ };
+ CancelButton BTN_RECOV_CANCEL
+ {
+ Pos = MAP_APPFONT( RECOV_COL_F, RECOV_ROW9 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ };
+ Image IMG_GREENCHECK
+ {
+ ImageBitmap = Bitmap { File = "nu01.png"; };
+ };
+ Image IMG_GREENCHECK_HC
+ {
+ ImageBitmap = Bitmap { File = "nuh01.png"; };
+ };
+ Image IMG_YELLOWCHECK
+ {
+ ImageBitmap = Bitmap { File = "nu04.png"; };
+ };
+ Image IMG_YELLOWCHECK_HC
+ {
+ ImageBitmap = Bitmap { File = "nuh04.png"; };
+ };
+ Image IMG_REDCROSS
+ {
+ ImageBitmap = Bitmap { File = "nu02.png"; };
+ };
+ Image IMG_REDCROSS_HC
+ {
+ ImageBitmap = Bitmap { File = "nuh02.png"; };
+ };
+ String STR_SUCCESSRECOV
+ {
+ Text[ en-US ] = "Successfully recovered";
+ };
+ String STR_ORIGDOCRECOV
+ {
+ Text[ en-US ] = "Original document recovered";
+ };
+ String STR_RECOVFAILED
+ {
+ Text[ en-US ] = "Recovery failed";
+ };
+ String STR_RECOVINPROGR
+ {
+ Text[ en-US ] = "Recovery in progress";
+ };
+ String STR_NOTRECOVYET
+ {
+ Text[ en-US ] = "Not recovered yet";
+ };
+ String STR_RECOVERY_INPROGRESS
+ {
+ Text[ en-US ] = "%PRODUCTNAME %PRODUCTVERSION will start to recover your documents. Depending on the size of the documents this process can take some time." ;
+ };
+ String STR_RECOVERY_REPORT
+ {
+ Text[ en-US ] = "A report of the crash was created to help us identify the reason why %PRODUCTNAME crashed. Click 'Next' to get to the Error Report Tool or press 'Cancel' to skip this step." ;
+ };
+ String STR_RECOVERYONLY_FINISH_DESCR
+ {
+ Text[ en-US ] = "Recovery of your documents was finished.\nClick 'Finish' to see your documents.";
+ };
+ String STR_RECOVERYONLY_FINISH
+ {
+ Text[ en-US ] = "~Finish";
+ };
+};
+
+QueryBox RID_SVXQB_EXIT_RECOVERY
+{
+ BUTTONS = WB_YES_NO ;
+ DEFBUTTON = WB_DEF_YES ;
+ Message [ en-US ] = "Are you sure you want to cancel the %PRODUCTNAME document recovery?";
+};
+
+ModalDialog RID_SVX_MDLG_DOCRECOVERY_BROKEN
+{
+ Size = MAP_APPFONT( BROKEN_WIDTH, BROKEN_HEIGHT );
+ HelpId = HID_SVX_MDLG_DOCRECOVERY_BROKEN;
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Moveable = TRUE;
+ Text = "%PRODUCTNAME %PRODUCTVERSION";
+
+ FixedText FT_BROKEN_DESCR
+ {
+ Pos = MAP_APPFONT( BROKEN_COL0, BROKEN_ROW0 );
+ Size = MAP_APPFONT( BROKEN_CONTROLWIDTH, (5*RSC_CD_FIXEDTEXT_HEIGHT) );
+ WordBreak = TRUE;
+ Text[ en-US ] = "The automatic recovery process was interrupted.\n\nThe documents listed below will be saved in the folder noted below if you click 'Save'. Click 'Cancel' to close the wizard without saving the documents.";
+ };
+ FixedText FT_BROKEN_FILELIST
+ {
+ Pos = MAP_APPFONT( BROKEN_COL0, BROKEN_ROW1 );
+ Size = MAP_APPFONT( BROKEN_CONTROLWIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "Documents";
+ };
+ ListBox LB_BROKEN_FILELIST
+ {
+ HelpID = "svx:ListBox:RID_SVX_MDLG_DOCRECOVERY_BROKEN:LB_BROKEN_FILELIST";
+ Pos = MAP_APPFONT( BROKEN_COL0, BROKEN_ROW2 );
+ Size = MAP_APPFONT( BROKEN_CONTROLWIDTH, (BROKEN_ROW3-BROKEN_ROW2) );
+ Border = TRUE;
+ TabStop = TRUE;
+ };
+ FixedText FT_BROKEN_SAVEDIR
+ {
+ Pos = MAP_APPFONT( BROKEN_COL0, BROKEN_ROW4 + 1 ); // see ED_BROKEN_SAVEDIR
+ Size = MAP_APPFONT( BROKEN_CONTROLWIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "~Save to";
+ };
+ Edit ED_BROKEN_SAVEDIR
+ {
+ HelpID = "svx:Edit:RID_SVX_MDLG_DOCRECOVERY_BROKEN:ED_BROKEN_SAVEDIR";
+ Pos = MAP_APPFONT( BROKEN_COL0, BROKEN_ROW5 + 1 ); // center to pushbutton
+ Size = MAP_APPFONT( BROKEN_COL2 - BROKEN_COL0, RSC_CD_TEXTBOX_HEIGHT );
+ Border = TRUE;
+ };
+ PushButton BTN_BROKEN_SAVEDIR
+ {
+ HelpID = "svx:PushButton:RID_SVX_MDLG_DOCRECOVERY_BROKEN:BTN_BROKEN_SAVEDIR";
+ Pos = MAP_APPFONT( BROKEN_COL3, BROKEN_ROW5 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text [ en-US ] = "Chan~ge...";
+ };
+ FixedLine FL_BROKEN_BOTTOM
+ {
+ Pos = MAP_APPFONT( 0 , BROKEN_ROW6 );
+ Size = MAP_APPFONT( BROKEN_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ };
+ OKButton BTN_BROKEN_OK
+ {
+ Pos = MAP_APPFONT( BROKEN_COL1, BROKEN_ROW7 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ DefButton = TRUE;
+ Text [ en-US ] = "~Save";
+ };
+ CancelButton BTN_BROKEN_CANCEL
+ {
+ Pos = MAP_APPFONT( BROKEN_COL3, BROKEN_ROW7 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ };
+};
+
+TabPage RID_SVXPAGE_ERR_REP_WELCOME
+{
+ Size = MAP_APPFONT( RECOV_WIDTH, RECOV_HEIGHT );
+ HelpId = HID_SVX_TP_ERR_REP_WELCOME;
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Hide = TRUE;
+ Window WIN_RECOV_TITLE
+ {
+ Pos = MAP_APPFONT( 0 , 0 );
+ Size = MAP_APPFONT( RECOV_WIDTH, RECOV_TITLEWINHEIGHT );
+ };
+ FixedText FT_RECOV_TITLE
+ {
+ Pos = MAP_APPFONT( RECOV_COL1, RECOV_ROW0 );
+ Size = MAP_APPFONT( RECOV_CONTROLWIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "Welcome to the %PRODUCTNAME %PRODUCTVERSION Error Report";
+ };
+ FixedLine FL_RECOV_TITLE
+ {
+ Pos = MAP_APPFONT( 0 , RECOV_TITLEWINHEIGHT );
+ Size = MAP_APPFONT( RECOV_WIDTH, 2 );
+ };
+ FixedText FT_RECOV_DESCR
+ {
+ Pos = MAP_APPFONT( RECOV_COL1, RECOV_ROW2 );
+ Size = MAP_APPFONT( RECOV_CONTROLWIDTH, (RECOV_ROW7-RECOV_ROW2-RSC_SP_CTRL_Y) );
+ WordBreak = TRUE;
+ Text[ en-US ] = "This error report tool gathers information about how %PRODUCTNAME is working and sends it to Oracle to help improve future versions.\n\nIt's easy - just send the report without any further effort on your part by clicking 'Send' in the next dialog, or you can briefly describe how the error occurred and then click 'Send'. If you want to see the report, click the 'Show Report' button. No data will be sent if you click 'Do Not Send'.\n\nCustomer Privacy\nThe information gathered is limited to data concerning the state of %PRODUCTNAME %PRODUCTVERSION when the error occurred. Other information about passwords or document contents is not collected.\n\nThe information will only be used to improve the quality of %PRODUCTNAME and will not be shared with third parties.\nFor more information on Oracle's privacy policy, visit\nwww.oracle.com/html/services-privacy-policy.html";
+ };
+ FixedLine FL_RECOV_BOTTOM
+ {
+ Pos = MAP_APPFONT( 0 , RECOV_ROW8 );
+ Size = MAP_APPFONT( RECOV_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ };
+ PushButton BTN_RECOV_PREV
+ {
+ HelpID = "svx:PushButton:RID_SVXPAGE_ERR_REP_WELCOME:BTN_RECOV_PREV";
+ Pos = MAP_APPFONT( RECOV_COL_C, RECOV_ROW9 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text[ en-US ] = "< ~Back";
+ };
+ OKButton BTN_RECOV_NEXT
+ {
+ Pos = MAP_APPFONT( RECOV_COL_D, RECOV_ROW9 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text[ en-US ] = "~Next >";
+ DefButton = TRUE;
+ };
+ CancelButton BTN_RECOV_CANCEL
+ {
+ Pos = MAP_APPFONT( RECOV_COL_F, RECOV_ROW9 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ };
+};
+
+TabPage RID_SVXPAGE_ERR_REP_SEND
+{
+ Size = MAP_APPFONT( ERRSEND_WIDTH, ERRSEND_HEIGHT );
+ HelpId = HID_SVX_TP_ERR_REP_SEND;
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Hide = TRUE;
+ Window WIN_RECOV_TITLE
+ {
+ Pos = MAP_APPFONT( 0 , 0 );
+ Size = MAP_APPFONT( ERRSEND_WIDTH, RECOV_TITLEWINHEIGHT );
+ };
+ FixedText FT_RECOV_TITLE
+ {
+ Pos = MAP_APPFONT( ERRSEND_COL0, ERRSEND_ROW0 );
+ Size = MAP_APPFONT( ERRSEND_CONTROLWIDTH1, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "Sending the Error Report";
+ };
+ FixedLine FL_RECOV_TITLE
+ {
+ Pos = MAP_APPFONT( 0 , RECOV_TITLEWINHEIGHT );
+ Size = MAP_APPFONT( RECOV_WIDTH, 2 );
+ };
+ FixedText FT_RECOV_DESCR
+ {
+ Pos = MAP_APPFONT( ERRSEND_COL0, ERRSEND_ROW2 );
+ Size = MAP_APPFONT( ERRSEND_CONTROLWIDTH2, (ERRSEND_ROW3-ERRSEND_ROW2) );
+ WordBreak = TRUE;
+ Text[ en-US ] = "In the spaces below, you can enter a title for your error report and describe the action you were trying to carry out when the error occurred. Then click 'Send'.";
+ };
+
+ FixedText FT_ERRSEND_DOCTYPE
+ {
+ Pos = MAP_APPFONT( ERRSEND_COL0, ERRSEND_ROW4 );
+ Size = MAP_APPFONT( ERRSEND_CONTROLWIDTH2, 2*RSC_CD_FIXEDTEXT_HEIGHT );
+ WordBreak = TRUE;
+ Text[ en-US ] = "~Which type of document (e.g. presentation) were you using when the error occurred?";
+ };
+ Edit ED_ERRSEND_DOCTYPE
+ {
+ HelpID = "svx:Edit:RID_SVXPAGE_ERR_REP_SEND:ED_ERRSEND_DOCTYPE";
+ Pos = MAP_APPFONT( ERRSEND_COL0, ERRSEND_ROW5 );
+ Size = MAP_APPFONT( ERRSEND_CONTROLWIDTH2, RSC_CD_TEXTBOX_HEIGHT );
+ Border = TRUE;
+ };
+ FixedText FT_ERRSEND_USING
+ {
+ Pos = MAP_APPFONT( ERRSEND_COL0, ERRSEND_ROW7 );
+ Size = MAP_APPFONT( ERRSEND_CONTROLWIDTH2, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "~How were you using %PRODUCTNAME when the error occurred? (optional)";
+ };
+ MultiLineEdit ML_ERRSEND_USING
+ {
+ HelpID = "svx:MultiLineEdit:RID_SVXPAGE_ERR_REP_SEND:ML_ERRSEND_USING";
+ Pos = MAP_APPFONT( ERRSEND_COL0, ERRSEND_ROW8 );
+ Size = MAP_APPFONT( ERRSEND_CONTROLWIDTH2, (ERRSEND_ROW12-ERRSEND_ROW8-RSC_SP_CTRL_Y) );
+ VScroll = TRUE;
+ IgnoreTab = TRUE;
+ Border = TRUE;
+ };
+ PushButton BTN_ERRSEND_SHOWREP
+ {
+ HelpID = "svx:PushButton:RID_SVXPAGE_ERR_REP_SEND:BTN_ERRSEND_SHOWREP";
+ Pos = MAP_APPFONT( ERRSEND_COL3, ERRSEND_ROW8 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text[ en-US ] = "Show ~Report";
+ };
+ PushButton BTN_ERRSEND_OPT
+ {
+ HelpID = "svx:PushButton:RID_SVXPAGE_ERR_REP_SEND:BTN_ERRSEND_OPT";
+ Pos = MAP_APPFONT( ERRSEND_COL3, ERRSEND_ROW10 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text[ en-US ] = "~Options...";
+ };
+ CheckBox CB_ERRSEND_CONTACT
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_ERR_REP_SEND:CB_ERRSEND_CONTACT";
+ Pos = MAP_APPFONT( ERRSEND_COL0, ERRSEND_ROW12 );
+ Size = MAP_APPFONT( ERRSEND_CONTROLWIDTH2, RSC_CD_CHECKBOX_HEIGHT );
+ Check = FALSE;
+ Text[ en-US ] = "~I allow Oracle to contact me regarding this report.";
+ };
+ FixedText FT_ERRSEND_EMAILADDR
+ {
+ Pos = MAP_APPFONT( ERRSEND_COL1, ERRSEND_ROW13 );
+ Size = MAP_APPFONT( ERRSEND_CONTROLWIDTH3, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "~Please enter your e-mail address";
+ };
+ Edit ED_ERRSEND_EMAILADDR
+ {
+ HelpID = "svx:Edit:RID_SVXPAGE_ERR_REP_SEND:ED_ERRSEND_EMAILADDR";
+ Pos = MAP_APPFONT( ERRSEND_COL1, ERRSEND_ROW14 );
+ Size = MAP_APPFONT( ERRSEND_CONTROLWIDTH3, RSC_CD_TEXTBOX_HEIGHT );
+ Border = TRUE;
+ };
+ FixedLine FL_RECOV_BOTTOM
+ {
+ Pos = MAP_APPFONT( 0 , ERRSEND_ROW15 );
+ Size = MAP_APPFONT( ERRSEND_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ };
+ PushButton BTN_RECOV_PREV
+ {
+ HelpID = "svx:PushButton:RID_SVXPAGE_ERR_REP_SEND:BTN_RECOV_PREV";
+ Pos = MAP_APPFONT( ERRSEND_COL5, ERRSEND_ROW16 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text[ en-US ] = "< ~Back";
+ };
+ OKButton BTN_RECOV_NEXT
+ {
+ Pos = MAP_APPFONT( ERRSEND_COL6, ERRSEND_ROW16 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text[ en-US ] = "S~end";
+ DefButton = TRUE;
+ };
+ CancelButton BTN_RECOV_CANCEL
+ {
+ Pos = MAP_APPFONT( ERRSEND_COL3, ERRSEND_ROW16 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text[ en-US ] = "Do ~Not Send";
+ };
+};
+
+ModalDialog RID_SVX_MDLG_ERR_REP_OPTIONS
+{
+ Size = MAP_APPFONT( ERROPT_WIDTH, ERROPT_HEIGHT );
+ HelpId = HID_SVX_MDLG_ERR_REP_OPTIONS;
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Moveable = TRUE;
+ Text[ en-US ] = "Options";
+
+ FixedLine FL_ERROPT_PROXY
+ {
+ Pos = MAP_APPFONT( ERROPT_COLA, ERROPT_ROW0 );
+ Size = MAP_APPFONT( ERROPT_COLF - ERROPT_COLA, RSC_CD_FIXEDLINE_HEIGHT );
+ Text[ en-US ] = "Proxy settings";
+ };
+
+ RadioButton BTN_ERROPT_SYSTEM
+ {
+ HelpID = "svx:RadioButton:RID_SVX_MDLG_ERR_REP_OPTIONS:BTN_ERROPT_SYSTEM";
+ Pos = MAP_APPFONT( ERROPT_COLB, ERROPT_ROW1 );
+ Size = MAP_APPFONT( ERROPT_COLF - ERROPT_COLB, RSC_CD_RADIOBUTTON_HEIGHT );
+ Text[ en-US ] = "Use ~system settings";
+ };
+
+ RadioButton BTN_ERROPT_DIRECT
+ {
+ HelpID = "svx:RadioButton:RID_SVX_MDLG_ERR_REP_OPTIONS:BTN_ERROPT_DIRECT";
+ Pos = MAP_APPFONT( ERROPT_COLB, ERROPT_ROW2 );
+ Size = MAP_APPFONT( ERROPT_COLF - ERROPT_COLB, RSC_CD_RADIOBUTTON_HEIGHT );
+ Text[ en-US ] = "Use ~direct connection to the Internet";
+ };
+
+ RadioButton BTN_ERROPT_MANUAL
+ {
+ HelpID = "svx:RadioButton:RID_SVX_MDLG_ERR_REP_OPTIONS:BTN_ERROPT_MANUAL";
+ Pos = MAP_APPFONT( ERROPT_COLB, ERROPT_ROW3 );
+ Size = MAP_APPFONT( ERROPT_COLF - ERROPT_COLB, RSC_CD_RADIOBUTTON_HEIGHT );
+ Text[ en-US ] = "Use ~manual settings";
+ };
+
+ FixedText FT_ERROPT_PROXYSERVER
+ {
+ Pos = MAP_APPFONT( ERROPT_COLC, ERROPT_ROW4 );
+ Size = MAP_APPFONT( ERROPT_SERVER_WIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "HT~TP Proxy";
+ };
+
+ Edit ED_ERROPT_PROXYSERVER
+ {
+ HelpID = "svx:Edit:RID_SVX_MDLG_ERR_REP_OPTIONS:ED_ERROPT_PROXYSERVER";
+ Pos = MAP_APPFONT( ERROPT_COLC, ERROPT_ROW5 );
+ Size = MAP_APPFONT( ERROPT_SERVER_WIDTH, RSC_CD_TEXTBOX_HEIGHT );
+ Border = TRUE;
+ };
+
+ FixedText FT_ERROPT_PROXYPORT
+ {
+ Pos = MAP_APPFONT( ERROPT_COLC + ERROPT_SERVER_WIDTH + RSC_SP_CTRL_GROUP_X, ERROPT_ROW4 );
+ Size = MAP_APPFONT( ERROPT_PORT_WIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "~Port";
+ };
+
+ Edit ED_ERROPT_PROXYPORT
+ {
+ HelpID = "svx:Edit:RID_SVX_MDLG_ERR_REP_OPTIONS:ED_ERROPT_PROXYPORT";
+ Pos = MAP_APPFONT( ERROPT_COLC + ERROPT_SERVER_WIDTH + RSC_SP_CTRL_GROUP_X, ERROPT_ROW5 );
+ Size = MAP_APPFONT( ERROPT_PORT_WIDTH, RSC_CD_TEXTBOX_HEIGHT );
+ Border = TRUE;
+ };
+
+ FixedText FT_ERROPT_DESCRIPTION
+ {
+ Pos = MAP_APPFONT( ERROPT_COLB, ERROPT_ROW6 );
+ Size = MAP_APPFONT( ERROPT_COLF - ERROPT_COLB, ERROPT_ROW7 - ERROPT_ROW6 );
+ WordBreak = TRUE;
+ Text[ en-US ] = "The %PRODUCTNAME Error Report tool needs to be connected to the Internet to be able to send error reports.\nCompanies often use proxy servers in conjunction with a firewall to protect the network.\nIf this applies to your situation, you have to specify the address and port for the server.";
+ };
+
+ FixedLine FL_ERROPT_BUTTONS
+ {
+ Pos = MAP_APPFONT( 0, ERROPT_ROW8 );
+ Size = MAP_APPFONT( ERROPT_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ };
+
+ OKButton BTN_ERROPT_OK
+ {
+ Pos = MAP_APPFONT( ERROPT_COLD, ERROPT_ROW9 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ DefButton = TRUE;
+ };
+
+ CancelButton BTN_ERROPT_CANCEL
+ {
+ Pos = MAP_APPFONT( ERROPT_COLE, ERROPT_ROW9 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ };
+};
+
+
+ModalDialog RID_SVX_MDLG_ERR_REP_PREVIEW
+{
+ Size = MAP_APPFONT( ERRPREVIEW_WIDTH, ERRPREVIEW_HEIGHT );
+ HelpId = HID_SVX_MDLG_ERR_REP_PREVIEW;
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Moveable = TRUE;
+ Sizeable = TRUE;
+ Text[ en-US ] = "Error Report";
+
+ MultiLineEdit ML_ERRPREVIEW_CONTENT
+ {
+ HelpID = "svx:MultiLineEdit:RID_SVX_MDLG_ERR_REP_PREVIEW:ML_ERRPREVIEW_CONTENT";
+ Pos = MAP_APPFONT( ERRPREVIEW_COLA, ERRPREVIEW_ROW0 );
+ Size = MAP_APPFONT( ERRPREVIEW_COLC - ERRPREVIEW_COLA, ERRPREVIEW_ROW1 - ERRPREVIEW_ROW0 );
+ VScroll = TRUE;
+ HScroll = TRUE;
+ ReadOnly = TRUE;
+ Border = TRUE;
+ };
+
+ OKButton BTN_ERRPREVIEW_OK
+ {
+ Pos = MAP_APPFONT( ERRPREVIEW_COLB, ERRPREVIEW_ROW2 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ DefButton = TRUE;
+ };
+}; \ No newline at end of file
diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx
new file mode 100644
index 000000000000..b1e7757c07f9
--- /dev/null
+++ b/svx/source/dialog/fntctrl.cxx
@@ -0,0 +1,851 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <sfx2/viewsh.hxx> // SfxViewShell
+#include <sfx2/printer.hxx> // Printer
+#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>
+#include <comphelper/processfactory.hxx>
+
+#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
+#include <com/sun/star/i18n/ScriptType.hdl>
+#endif
+
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_USHORTS
+#define _SVSTDARR_ULONGS
+#define _SVSTDARR_XUB_STRLEN
+#include <svl/svstdarr.hxx>
+#endif
+#include <svtools/colorcfg.hxx>
+
+#include <svx/fntctrl.hxx>
+#include <svx/dialogs.hrc>
+#define TEXT_WIDTH 20
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using ::com::sun::star::i18n::XBreakIterator;
+
+// -----------------------------------------------------------------------
+// small helper functions to set fonts
+// -----------------------------------------------------------------------
+namespace
+{
+ void scaleFontWidth(Font& _rFont,const OutputDevice& rOutDev,long& _n100PercentFont)
+ {
+ _rFont.SetWidth( 0 );
+ _n100PercentFont = rOutDev.GetFontMetric( _rFont ).GetWidth();
+ }
+ // -----------------------------------------------------------------------
+ void initFont(Font& _rFont)
+ {
+ _rFont.SetTransparent(sal_True);
+ _rFont.SetAlign(ALIGN_BASELINE);
+ }
+ // -----------------------------------------------------------------------
+ void setFontSize(Font& _rFont)
+ {
+ Size aSize( _rFont.GetSize() );
+ aSize.Height() = ( aSize.Height() * 3 ) / 5;
+ aSize.Width() = ( aSize.Width() * 3 ) / 5;
+ _rFont.SetSize( aSize );
+ }
+ // -----------------------------------------------------------------------
+ void calcFontHeightAnyAscent(OutputDevice* _pWin,Font& _rFont,long& _nHeight,long& _nAscent)
+ {
+ if ( !_nHeight )
+ {
+ _pWin->SetFont( _rFont );
+ FontMetric aMetric( _pWin->GetFontMetric() );
+ _nHeight = aMetric.GetLineHeight();
+ _nAscent = aMetric.GetAscent();
+ }
+ }
+ // -----------------------------------------------------------------------
+ void setFont( const SvxFont& rNewFont, SvxFont& rImplFont )
+ {
+ rImplFont = rNewFont;
+ rImplFont.SetTransparent( sal_True );
+ rImplFont.SetAlign( ALIGN_BASELINE );
+ }
+
+}
+// -----------------------------------------------------------------------
+
+
+// class FontPrevWin_Impl -----------------------------------------------
+
+class FontPrevWin_Impl
+{
+ friend class SvxFontPrevWindow;
+
+ SvxFont aFont;
+ Printer* pPrinter;
+ sal_Bool bDelPrinter;
+
+ Reference < XBreakIterator > xBreak;
+ SvULongs aTextWidth;
+ SvXub_StrLens aScriptChg;
+ SvUShorts aScriptType;
+ SvxFont aCJKFont;
+ SvxFont aCTLFont;
+ String aText;
+ String aScriptText;
+ Color* pColor;
+ Color* pBackColor;
+ long nAscent;
+ sal_Unicode cStartBracket;
+ sal_Unicode cEndBracket;
+
+ long n100PercentFontWidth; // initial -1 -> not set yet
+ long n100PercentFontWidthCJK;
+ long n100PercentFontWidthCTL;
+ sal_uInt16 nFontWidthScale;
+
+ sal_Bool bSelection : 1,
+ bGetSelection : 1,
+ bUseResText : 1,
+ bTwoLines : 1,
+ bIsCJKUI : 1,
+ bIsCTLUI : 1,
+ bUseFontNameAsText : 1,
+ bTextInited : 1;
+
+ void _CheckScript();
+public:
+ inline FontPrevWin_Impl() :
+ pPrinter( NULL ), bDelPrinter( sal_False ),
+ pColor( NULL ), pBackColor( 0 ),
+ cStartBracket( 0 ), cEndBracket( 0 ), nFontWidthScale( 100 ),
+ bSelection( sal_False ), bGetSelection( sal_False ), bUseResText( sal_False ),
+ bTwoLines( sal_False ),
+ bIsCJKUI( sal_False ), bIsCTLUI( sal_False ),
+ bUseFontNameAsText( sal_False ), bTextInited( sal_False )
+ {
+ Invalidate100PercentFontWidth();
+ }
+
+ inline ~FontPrevWin_Impl()
+ {
+ delete pColor;
+ delete pBackColor;
+ if( bDelPrinter )
+ delete pPrinter;
+ }
+
+ void CheckScript();
+ Size CalcTextSize( OutputDevice* pWin, OutputDevice* pPrt, SvxFont &rFont );
+ void DrawPrev( OutputDevice* pWin, Printer* pPrt, Point &rPt, SvxFont &rFont );
+
+ sal_Bool SetFontWidthScale( sal_uInt16 nScaleInPercent );
+ inline void Invalidate100PercentFontWidth();
+ inline sal_Bool Is100PercentFontWidthValid() const;
+ void ScaleFontWidth( const OutputDevice& rOutDev );
+ // scales rNonCJKFont and aCJKFont depending on nFontWidthScale and
+ // sets the 100%-Font-Widths
+};
+
+void FontPrevWin_Impl::CheckScript()
+{
+ if( aText != aScriptText )
+ _CheckScript();
+}
+
+inline void FontPrevWin_Impl::Invalidate100PercentFontWidth()
+{
+ n100PercentFontWidth = n100PercentFontWidthCJK = n100PercentFontWidthCTL = -1;
+}
+
+inline sal_Bool FontPrevWin_Impl::Is100PercentFontWidthValid() const
+{
+ DBG_ASSERT( ( n100PercentFontWidth == -1 && n100PercentFontWidthCJK == -1 ) ||
+ ( n100PercentFontWidth != -1 && n100PercentFontWidthCJK != -1 ) ||
+ ( n100PercentFontWidth == -1 && n100PercentFontWidthCTL == -1 ) ||
+ ( n100PercentFontWidth != -1 && n100PercentFontWidthCTL != -1 ),
+ "*FontPrevWin_Impl::Is100PercentFontWidthValid(): 100PercentFontWidth's not synchronous" );
+ return n100PercentFontWidth != -1;
+}
+
+// class FontPrevWin_Impl -----------------------------------------------
+
+/*-----------------19.7.2001 08:44------------------
+ * void FontPrevWin_Impl::_CheckScript()
+ * evalutates the scripttypes of the actual string.
+ * Afterwards the positions of script change are notified in aScriptChg,
+ * the scripttypes in aScriptType.
+ * The aTextWidth array will be filled with zero.
+ * --------------------------------------------------*/
+
+void FontPrevWin_Impl::_CheckScript()
+{
+ aScriptText = aText;
+ size_t nCnt = aScriptChg.size();
+ if( nCnt )
+ {
+ aScriptChg.clear();
+ aScriptType.Remove( 0, nCnt );
+ aTextWidth.Remove( 0, nCnt );
+ nCnt = 0;
+ }
+ if( !xBreak.is() )
+ {
+ Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ xBreak = Reference< XBreakIterator >(xMSF->createInstance(
+ ::rtl::OUString::createFromAscii( "com.sun.star.i18n.BreakIterator" ) ),UNO_QUERY);
+ }
+ if( xBreak.is() )
+ {
+ sal_uInt16 nScript = xBreak->getScriptType( aText, 0 );
+ sal_uInt16 nChg = 0;
+ if( com::sun::star::i18n::ScriptType::WEAK == nScript )
+ {
+ nChg = (xub_StrLen)xBreak->endOfScript( aText, nChg, nScript );
+ if( nChg < aText.Len() )
+ nScript = xBreak->getScriptType( aText, nChg );
+ else
+ nScript = com::sun::star::i18n::ScriptType::LATIN;
+ }
+
+ do
+ {
+ nChg = (xub_StrLen)xBreak->endOfScript( aText, nChg, nScript );
+ 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.push_back( nChg - 1 );
+ }
+ else
+ {
+ aScriptChg.push_back( nChg );
+ }
+ }
+ else
+ {
+ aScriptChg.push_back( nChg );
+ }
+ aScriptType.Insert( nScript, nCnt );
+ aTextWidth.Insert( sal_uIntPtr(0), nCnt++ );
+
+ if( nChg < aText.Len() )
+ nScript = xBreak->getScriptType( aText, nChg );
+ else
+ break;
+ } while( sal_True );
+ }
+}
+
+/*-----------------19.7.2001 08:48------------------
+ * Size FontPrevWin_Impl::CalcTextSize(..)
+ * fills the aTextWidth array with the text width of every part
+ * of the actual string without a script change inside.
+ * For Latin parts the given rFont will be used,
+ * for Asian parts the aCJKFont.
+ * The returned size contains the whole string.
+ * The member nAscent is calculated to the maximal ascent of all used fonts.
+ * --------------------------------------------------*/
+
+Size FontPrevWin_Impl::CalcTextSize( OutputDevice* pWin, OutputDevice* _pPrinter,
+ SvxFont &rFont )
+{
+ sal_uInt16 nScript;
+ sal_uInt16 nIdx = 0;
+ xub_StrLen nStart = 0;
+ xub_StrLen nEnd;
+ size_t nCnt = aScriptChg.size();
+ if( nCnt )
+ {
+ nEnd = aScriptChg[ nIdx ];
+ nScript = aScriptType[ nIdx ];
+ }
+ else
+ {
+ nEnd = aText.Len();
+ nScript = com::sun::star::i18n::ScriptType::LATIN;
+ }
+ long nTxtWidth = 0;
+ long nCJKHeight = 0;
+ long nCTLHeight = 0;
+ long nHeight = 0;
+ nAscent = 0;
+ long nCJKAscent = 0;
+ long nCTLAscent = 0;
+ do
+ {
+ SvxFont& rFnt = (nScript==com::sun::star::i18n::ScriptType::ASIAN) ? aCJKFont : ((nScript==com::sun::star::i18n::ScriptType::COMPLEX) ? aCTLFont : rFont);
+ sal_uIntPtr nWidth = rFnt.GetTxtSize( _pPrinter, aText, nStart, nEnd-nStart ).
+ Width();
+ aTextWidth[ nIdx++ ] = nWidth;
+ nTxtWidth += nWidth;
+ switch(nScript)
+ {
+ case com::sun::star::i18n::ScriptType::ASIAN:
+ calcFontHeightAnyAscent(pWin,aCJKFont,nCJKHeight,nCJKAscent);
+ break;
+ case com::sun::star::i18n::ScriptType::COMPLEX:
+ calcFontHeightAnyAscent(pWin,aCTLFont,nCTLHeight,nCTLAscent);
+ break;
+ default:
+ calcFontHeightAnyAscent(pWin,rFont,nHeight,nAscent);
+ }
+
+ if( nEnd < aText.Len() && nIdx < nCnt )
+ {
+ nStart = nEnd;
+ nEnd = aScriptChg[ nIdx ];
+ nScript = aScriptType[ nIdx ];
+ }
+ else
+ break;
+ }
+ while( sal_True );
+ nHeight -= nAscent;
+ nCJKHeight -= nCJKAscent;
+ nCTLHeight -= nCTLAscent;
+ if( nHeight < nCJKHeight )
+ nHeight = nCJKHeight;
+ if( nAscent < nCJKAscent )
+ nAscent = nCJKAscent;
+ if( nHeight < nCTLHeight )
+ nHeight = nCTLHeight;
+ if( nAscent < nCTLAscent )
+ nAscent = nCTLAscent;
+ nHeight += nAscent;
+
+ Size aTxtSize( nTxtWidth, nHeight );
+ return aTxtSize;
+}
+
+/*-----------------19.7.2001 08:54------------------
+ * void FontPrevWin_Impl::DrawPrev(..)
+ * calls SvxFont::DrawPrev(..) for every part of the string without a script
+ * change inside, for Asian parts the aCJKFont will be used, otherwise the
+ * given rFont.
+ * --------------------------------------------------*/
+
+void FontPrevWin_Impl::DrawPrev( OutputDevice* pWin, Printer* _pPrinter,
+ Point &rPt, SvxFont &rFont )
+{
+ Font aOldFont = _pPrinter->GetFont();
+ sal_uInt16 nScript;
+ sal_uInt16 nIdx = 0;
+ xub_StrLen nStart = 0;
+ xub_StrLen nEnd;
+ size_t nCnt = aScriptChg.size();
+ if( nCnt )
+ {
+ nEnd = aScriptChg[ nIdx ];
+ nScript = aScriptType[ nIdx ];
+ }
+ else
+ {
+ nEnd = aText.Len();
+ nScript = com::sun::star::i18n::ScriptType::LATIN;
+ }
+ do
+ {
+ SvxFont& rFnt = (nScript==com::sun::star::i18n::ScriptType::ASIAN) ? aCJKFont : ((nScript==com::sun::star::i18n::ScriptType::COMPLEX) ? aCTLFont : rFont);
+ _pPrinter->SetFont( rFnt );
+
+ rFnt.DrawPrev( pWin, _pPrinter, rPt, aText, nStart, nEnd - nStart );
+
+ rPt.X() += aTextWidth[ nIdx++ ];
+ if( nEnd < aText.Len() && nIdx < nCnt )
+ {
+ nStart = nEnd;
+ nEnd = aScriptChg[ nIdx ];
+ nScript = aScriptType[ nIdx ];
+ }
+ else
+ break;
+ }
+ while( sal_True );
+ _pPrinter->SetFont( aOldFont );
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool FontPrevWin_Impl::SetFontWidthScale( sal_uInt16 nScale )
+{
+ if( nFontWidthScale != nScale )
+ {
+ nFontWidthScale = nScale;
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+
+// -----------------------------------------------------------------------
+
+void FontPrevWin_Impl::ScaleFontWidth( const OutputDevice& rOutDev )
+{
+ if( !Is100PercentFontWidthValid() )
+ {
+ scaleFontWidth(aFont,rOutDev,n100PercentFontWidth);
+ scaleFontWidth(aCJKFont,rOutDev,n100PercentFontWidthCJK);
+ scaleFontWidth(aCTLFont,rOutDev,n100PercentFontWidthCTL);
+ }
+
+ aFont.SetWidth( n100PercentFontWidth * nFontWidthScale / 100 );
+ aCJKFont.SetWidth( n100PercentFontWidthCJK * nFontWidthScale / 100 );
+ aCTLFont.SetWidth( n100PercentFontWidthCTL * nFontWidthScale / 100 );
+}
+
+// class SvxFontPrevWindow -----------------------------------------------
+
+void SvxFontPrevWindow::InitSettings( sal_Bool bForeground, sal_Bool bBackground )
+{
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+
+ if ( bForeground )
+ {
+ svtools::ColorConfig aColorConfig;
+ Color aTextColor( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
+
+ if ( IsControlForeground() )
+ aTextColor = GetControlForeground();
+ SetTextColor( aTextColor );
+ }
+
+ if ( bBackground )
+ {
+ if ( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( rStyleSettings.GetWindowColor() );
+ }
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+SvxFontPrevWindow::SvxFontPrevWindow( Window* pParent, const ResId& rId ) :
+
+ Window ( pParent, rId )
+{
+ pImpl = new FontPrevWin_Impl;
+ SfxViewShell* pSh = SfxViewShell::Current();
+
+ if ( pSh )
+ pImpl->pPrinter = pSh->GetPrinter();
+
+ if ( !pImpl->pPrinter )
+ {
+ pImpl->pPrinter = new Printer;
+ pImpl->bDelPrinter = sal_True;
+ }
+ SetMapMode( MapMode( MAP_TWIP ) );
+ initFont(pImpl->aFont);
+ initFont(pImpl->aCJKFont);
+ initFont(pImpl->aCTLFont);
+ InitSettings( sal_True, sal_True );
+ SetBorderStyle( WINDOW_BORDER_MONO );
+
+ LanguageType eLanguage = Application::GetSettings().GetUILanguage();
+ switch( eLanguage )
+ {
+ case LANGUAGE_CHINESE:
+ case LANGUAGE_JAPANESE:
+ case LANGUAGE_KOREAN:
+ case LANGUAGE_KOREAN_JOHAB:
+ case LANGUAGE_CHINESE_SIMPLIFIED:
+ case LANGUAGE_CHINESE_HONGKONG:
+ case LANGUAGE_CHINESE_SINGAPORE:
+ case LANGUAGE_CHINESE_MACAU:
+ case LANGUAGE_CHINESE_TRADITIONAL:
+ pImpl->bIsCJKUI = sal_True;
+ break;
+ // TODO: CTL Locale
+ // pImpl->bIsCTLUI = sal_True;
+ // break;
+ default:
+ pImpl->bIsCJKUI = pImpl->bIsCTLUI = sal_False;
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SvxFontPrevWindow::~SvxFontPrevWindow()
+{
+ delete pImpl;
+}
+
+// -----------------------------------------------------------------------
+SvxFont& SvxFontPrevWindow::GetCTLFont()
+{
+ return pImpl->aCTLFont;
+}
+
+// -----------------------------------------------------------------------
+
+SvxFont& SvxFontPrevWindow::GetCJKFont()
+{
+ return pImpl->aCJKFont;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::StateChanged( StateChangedType nType )
+{
+ if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ InitSettings( sal_True, sal_False );
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ InitSettings( sal_False, sal_True );
+
+ Window::StateChanged( nType );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
+ InitSettings( sal_True, sal_True );
+ else
+ Window::DataChanged( rDCEvt );
+}
+
+SvxFont& SvxFontPrevWindow::GetFont()
+{
+ pImpl->Invalidate100PercentFontWidth(); // because the user might change the size
+ return pImpl->aFont;
+}
+
+const SvxFont& SvxFontPrevWindow::GetFont() const
+{
+ return pImpl->aFont;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::SetPreviewText( const ::rtl::OUString& rString )
+{
+ pImpl->aText = rString;
+ pImpl->bTextInited = sal_True;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::SetFontNameAsPreviewText()
+{
+ pImpl->bUseFontNameAsText = sal_True;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::SetFont( const SvxFont& rOutFont )
+{
+ setFont( rOutFont, pImpl->aFont );
+
+ pImpl->Invalidate100PercentFontWidth();
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::SetFont( const SvxFont& rNormalOutFont, const SvxFont& rCJKOutFont, const SvxFont& rCTLFont )
+{
+ setFont( rNormalOutFont, pImpl->aFont );
+ setFont( rCJKOutFont, pImpl->aCJKFont );
+ setFont( rCTLFont, pImpl->aCTLFont );
+
+
+ pImpl->Invalidate100PercentFontWidth();
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::SetCJKFont( const SvxFont &rCJKOutFont )
+{
+ setFont( rCJKOutFont, pImpl->aCJKFont );
+
+ pImpl->Invalidate100PercentFontWidth();
+ Invalidate();
+}
+// -----------------------------------------------------------------------------
+void SvxFontPrevWindow::SetCTLFont( const SvxFont &rCTLOutFont )
+{
+ setFont( rCTLOutFont, pImpl->aCTLFont );
+
+ pImpl->Invalidate100PercentFontWidth();
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::SetColor(const Color &rColor)
+{
+ delete pImpl->pColor;
+ pImpl->pColor = new Color( rColor );
+ Invalidate();
+}
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::ResetColor()
+{
+ delete pImpl->pColor;
+ pImpl->pColor = 0;
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::SetBackColor(const Color &rColor)
+{
+ delete pImpl->pBackColor;
+ pImpl->pBackColor = new Color( rColor );
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::UseResourceText( sal_Bool bUse )
+{
+ pImpl->bUseResText = bUse;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::Paint( const Rectangle& )
+{
+ Printer* pPrinter = pImpl->pPrinter;
+ SvxFont& rFont = pImpl->aFont;
+ SvxFont& rCJKFont = pImpl->aCJKFont;
+ // TODO: SvxFont& rCTLFont = pImpl->aCTLFont;
+
+ if ( pImpl->bUseResText )
+ pImpl->aText = GetText();
+ else if ( !pImpl->bSelection && !pImpl->bTextInited )
+ {
+ SfxViewShell* pSh = SfxViewShell::Current();
+
+ if ( pSh && !pImpl->bGetSelection && !pImpl->bUseFontNameAsText )
+ {
+ pImpl->aText = pSh->GetSelectionText();
+ pImpl->bGetSelection = sal_True;
+ pImpl->bSelection = pImpl->aText.Len() != 0;
+
+ }
+
+ if ( !pImpl->bSelection || pImpl->bUseFontNameAsText )
+ {
+ pImpl->aText = rFont.GetName();
+ if( pImpl->bIsCJKUI )
+ pImpl->aText += rCJKFont.GetName();
+ //TODO bIsCTLUI
+ }
+
+ if ( !pImpl->aText.Len() )
+ pImpl->aText = GetText();
+
+ // remove line feeds and carriage returns from string
+ bool bNotEmpty = false;
+ for ( xub_StrLen i = 0; i < pImpl->aText.Len(); ++i )
+ {
+ if ( 0xa == pImpl->aText.GetChar( i ) ||
+ 0xd == pImpl->aText.GetChar( i ) )
+ pImpl->aText.SetChar( i, ' ' );
+ else
+ bNotEmpty = true;
+ }
+ if ( !bNotEmpty )
+ pImpl->aText = GetText();
+
+ if ( pImpl->aText.Len() > (TEXT_WIDTH-1) )
+ pImpl->aText.Erase( pImpl->aText.Search( sal_Unicode( ' ' ), TEXT_WIDTH ) );
+ }
+
+ // calculate text width scaling
+ pImpl->ScaleFontWidth( *this/*, rFont*/ );
+
+ pImpl->CheckScript();
+ Size aTxtSize = pImpl->CalcTextSize( this, pPrinter, rFont );
+
+ const Size aLogSize( GetOutputSize() );
+
+ long nX = aLogSize.Width() / 2 - aTxtSize.Width() / 2;
+ long nY = aLogSize.Height() / 2 - aTxtSize.Height() / 2;
+
+ if ( nY + pImpl->nAscent > aLogSize.Height() )
+ nY = aLogSize.Height() - pImpl->nAscent;
+
+ if ( pImpl->pBackColor )
+ {
+ Rectangle aRect( Point( 0, 0 ), aLogSize );
+ Color aLineCol = GetLineColor();
+ Color aFillCol = GetFillColor();
+ SetLineColor();
+ SetFillColor( *pImpl->pBackColor );
+ DrawRect( aRect );
+ SetLineColor( aLineCol );
+ SetFillColor( aFillCol );
+ }
+ if ( pImpl->pColor )
+ {
+ Rectangle aRect( Point( nX, nY ), aTxtSize );
+ Color aLineCol = GetLineColor();
+ Color aFillCol = GetFillColor();
+ SetLineColor();
+ SetFillColor( *pImpl->pColor );
+ DrawRect( aRect );
+ SetLineColor( aLineCol );
+ SetFillColor( aFillCol );
+ }
+
+ long nStdAscent = pImpl->nAscent;
+ nY += nStdAscent;
+
+ if(pImpl->bTwoLines)
+ {
+ SvxFont aSmallFont( rFont );
+ Size aOldSize = pImpl->aCJKFont.GetSize();
+ setFontSize(aSmallFont);
+ setFontSize(pImpl->aCJKFont);
+
+ long nStartBracketWidth = 0;
+ long nEndBracketWidth = 0;
+ long nTextWidth = 0;
+ if(pImpl->cStartBracket)
+ {
+ String sBracket(pImpl->cStartBracket);
+ nStartBracketWidth = rFont.GetTxtSize( pPrinter, sBracket ).Width();
+ }
+ if(pImpl->cEndBracket)
+ {
+ String sBracket(pImpl->cEndBracket);
+ nEndBracketWidth = rFont.GetTxtSize( pPrinter, sBracket ).Width();
+ }
+ nTextWidth = pImpl->CalcTextSize( this, pPrinter, aSmallFont ).Width();
+ long nResultWidth = nStartBracketWidth;
+ nResultWidth += nEndBracketWidth;
+ nResultWidth += nTextWidth;
+
+ long _nX = (aLogSize.Width() - nResultWidth) / 2;
+ DrawLine( Point( 0, nY ), Point( _nX, nY ) );
+ DrawLine( Point( _nX + nResultWidth, nY ), Point( aLogSize.Width(), nY ) );
+
+ long nSmallAscent = pImpl->nAscent;
+ long nOffset = (nStdAscent - nSmallAscent ) / 2;
+
+ if(pImpl->cStartBracket)
+ {
+ String sBracket(pImpl->cStartBracket);
+ rFont.DrawPrev( this, pPrinter, Point( _nX, nY - nOffset - 4), sBracket );
+ _nX += nStartBracketWidth;
+ }
+
+ Point aTmpPoint1( _nX, nY - nSmallAscent - 2 );
+ Point aTmpPoint2( _nX, nY );
+ pImpl->DrawPrev( this, pPrinter, aTmpPoint1, aSmallFont );
+ pImpl->DrawPrev( this, pPrinter, aTmpPoint2, aSmallFont );
+
+ _nX += nTextWidth;
+ if(pImpl->cEndBracket)
+ {
+ Point aTmpPoint( _nX + 1, nY - nOffset - 4);
+ String sBracket(pImpl->cEndBracket);
+ rFont.DrawPrev( this, pPrinter, aTmpPoint, sBracket );
+ }
+ pImpl->aCJKFont.SetSize( aOldSize );
+ }
+ else
+ {
+ Color aLineCol = GetLineColor();
+
+ SetLineColor( rFont.GetColor() );
+ DrawLine( Point( 0, nY ), Point( nX, nY ) );
+ DrawLine( Point( nX + aTxtSize.Width(), nY ), Point( aLogSize.Width(), nY ) );
+
+ SetLineColor( aLineCol );
+
+ Point aTmpPoint( nX, nY );
+ pImpl->DrawPrev( this, pPrinter, aTmpPoint, rFont );
+ }
+}
+/* -----------------------------04.12.00 16:26--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SvxFontPrevWindow::IsTwoLines() const
+{
+ return pImpl->bTwoLines;
+}
+/* -----------------------------04.12.00 16:26--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxFontPrevWindow::SetTwoLines(sal_Bool bSet)
+{
+ pImpl->bTwoLines = bSet;}
+
+/* -----------------------------04.12.00 16:26--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxFontPrevWindow::SetBrackets(sal_Unicode cStart, sal_Unicode cEnd)
+{
+ pImpl->cStartBracket = cStart;
+ pImpl->cEndBracket = cEnd;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::SetFontWidthScale( sal_uInt16 n )
+{
+ if( pImpl->SetFontWidthScale( n ) )
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::AutoCorrectFontColor( void )
+{
+ Color aFontColor( GetTextColor() );
+
+ if( COL_AUTO == pImpl->aFont.GetColor().GetColor() )
+ pImpl->aFont.SetColor( aFontColor );
+
+ if( COL_AUTO == pImpl->aCJKFont.GetColor().GetColor() )
+ pImpl->aCJKFont.SetColor( aFontColor );
+
+ if( COL_AUTO == pImpl->aCTLFont.GetColor().GetColor() )
+ pImpl->aCTLFont.SetColor( aFontColor );
+}
diff --git a/svx/source/dialog/fontlb.cxx b/svx/source/dialog/fontlb.cxx
new file mode 100644
index 000000000000..984d7dca4af4
--- /dev/null
+++ b/svx/source/dialog/fontlb.cxx
@@ -0,0 +1,189 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "svx/fontlb.hxx"
+#include <vcl/svapp.hxx>
+
+// ============================================================================
+
+DBG_NAME( SvLBoxFontString );
+
+SvLBoxFontString::SvLBoxFontString() :
+ SvLBoxString()
+{
+ DBG_CTOR( SvLBoxFontString, 0 );
+}
+
+SvLBoxFontString::SvLBoxFontString(
+ SvLBoxEntry* pEntry, sal_uInt16 nFlags, const XubString& rString,
+ const Font& rFont, const Color* pColor ) :
+ SvLBoxString( pEntry, nFlags, rString ),
+ maFont( rFont ),
+ mbUseColor( pColor != NULL )
+{
+ DBG_CTOR( SvLBoxFontString, 0 );
+ SetText( pEntry, rString );
+ if( pColor )
+ maFont.SetColor( *pColor );
+}
+
+SvLBoxFontString::~SvLBoxFontString()
+{
+ DBG_DTOR( SvLBoxFontString, 0 );
+}
+
+
+SvLBoxItem* SvLBoxFontString::Create() const
+{
+ DBG_CHKTHIS( SvLBoxFontString, 0 );
+ return new SvLBoxFontString;
+}
+
+void SvLBoxFontString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, SvLBoxEntry* pEntry )
+{
+ DBG_CHKTHIS( SvLBoxFontString, 0 );
+ Font aOldFont( rDev.GetFont() );
+ Font aNewFont( maFont );
+ bool bSel = (nFlags & SVLISTENTRYFLAG_SELECTED) != 0;
+// if( !mbUseColor ) // selection gets font color, if available
+ if( !mbUseColor || bSel ) // selection always gets highlight color
+ {
+ const StyleSettings& rSett = Application::GetSettings().GetStyleSettings();
+ aNewFont.SetColor( bSel ? rSett.GetHighlightTextColor() : rSett.GetFieldTextColor() );
+ }
+
+ rDev.SetFont( aNewFont );
+ SvLBoxString::Paint( rPos, rDev, nFlags, pEntry );
+ rDev.SetFont( aOldFont );
+}
+
+void SvLBoxFontString::InitViewData( SvLBox* pView, SvLBoxEntry* pEntry, SvViewDataItem* pViewData )
+{
+ DBG_CHKTHIS( SvLBoxFontString, 0 );
+ Font aOldFont( pView->GetFont() );
+ pView->SetFont( maFont );
+ SvLBoxString::InitViewData( pView, pEntry, pViewData);
+ pView->SetFont( aOldFont );
+}
+
+
+// ============================================================================
+
+SvxFontListBox::SvxFontListBox( Window* pParent, const ResId& rResId ) :
+ SvTabListBox( pParent, rResId ),
+ maStdFont( GetFont() ),
+ mbUseFont( false )
+{
+ maStdFont.SetTransparent( sal_True );
+ maEntryFont = maStdFont;
+}
+
+void SvxFontListBox::InsertFontEntry( const String& rString, const Font& rFont, const Color* pColor )
+{
+ mbUseFont = true; // InitEntry() will use maEntryFont
+ maEntryFont = rFont; // font to use in InitEntry() over InsertEntry()
+ mpEntryColor = pColor; // color to use in InitEntry() over InsertEntry()
+ InsertEntry( rString );
+ mbUseFont = false;
+}
+
+void SvxFontListBox::SelectEntryPos( sal_uInt16 nPos, bool bSelect )
+{
+ SvLBoxEntry* pEntry = GetEntry( nPos );
+ if( pEntry )
+ {
+ Select( pEntry, bSelect );
+ ShowEntry( pEntry );
+ }
+}
+
+void SvxFontListBox::SetNoSelection()
+{
+ SelectAll( sal_False, sal_True );
+}
+
+sal_uLong SvxFontListBox::GetSelectEntryPos() const
+{
+ SvLBoxEntry* pSvLBoxEntry = FirstSelected();
+ return pSvLBoxEntry ? GetModel()->GetAbsPos( pSvLBoxEntry ) : LIST_APPEND;
+}
+
+XubString SvxFontListBox::GetSelectEntry() const
+{
+ return GetEntryText( GetSelectEntryPos() );
+}
+
+void SvxFontListBox::InitEntry(
+ SvLBoxEntry* pEntry, const XubString& rEntryText,
+ const Image& rCollImg, const Image& rExpImg,
+ SvLBoxButtonKind eButtonKind )
+{
+ if( mbUseFont )
+ {
+ if( nTreeFlags & TREEFLAG_CHKBTN )
+ pEntry->AddItem( new SvLBoxButton( pEntry, eButtonKind, 0,
+ pCheckButtonData ) );
+ pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, rCollImg, rExpImg, SVLISTENTRYFLAG_EXPANDED ) );
+ pEntry->AddItem( new SvLBoxFontString( pEntry, 0, rEntryText, maEntryFont, mpEntryColor ) );
+ }
+ else
+ SvTreeListBox::InitEntry( pEntry, rEntryText, rCollImg, rExpImg,
+ eButtonKind );
+}
+
+#if ENABLE_LAYOUT
+
+namespace layout
+{
+
+SvxFontListBox::~SvxFontListBox ()
+{
+}
+
+sal_uInt16 SvxFontListBox::InsertFontEntry (String const& entry, Font const&, Color const*)
+{
+ return InsertEntry (entry);
+}
+
+SvxFontListBox::SvxFontListBox( Context* pParent, const char* pFile)
+: ListBox( pParent, pFile )
+{
+}
+
+/*IMPL_IMPL (SvxFontListBox, ListBox);
+IMPL_CONSTRUCTORS (SvxFontListBox, ListBox, "svxfontlistbox");
+IMPL_GET_IMPL (SvxFontListBox);
+IMPL_GET_WINDOW (SvxFontListBox);*/
+
+};
+
+#endif
+
+// ============================================================================
+
diff --git a/svx/source/dialog/fontwork.cxx b/svx/source/dialog/fontwork.cxx
new file mode 100644
index 000000000000..ae2eb6c04098
--- /dev/null
+++ b/svx/source/dialog/fontwork.cxx
@@ -0,0 +1,1283 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <sfx2/module.hxx>
+#include <sfx2/dispatch.hxx>
+#include <tools/shl.hxx>
+
+#define _SVX_FONTWORK_CXX
+#include <svx/svdobj.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdocirc.hxx>
+#include <svx/xtextit.hxx>
+
+#include <svx/dialmgr.hxx>
+#include "svx/dlgutil.hxx"
+
+#include <svx/dialogs.hrc>
+#include "fontwork.hrc"
+#include <svx/fontwork.hxx>
+#include <editeng/outlobj.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+
+SFX_IMPL_DOCKINGWINDOW( SvxFontWorkChildWindow, SID_FONTWORK );
+
+/*************************************************************************
+|*
+|* ControllerItem fuer Fontwork
+|*
+\************************************************************************/
+
+SvxFontWorkControllerItem::SvxFontWorkControllerItem
+(
+ sal_uInt16 _nId,
+ SvxFontWorkDialog& rDlg,
+ SfxBindings& rBindings
+) :
+
+ SfxControllerItem( _nId, rBindings ),
+
+ rFontWorkDlg( rDlg )
+{
+}
+
+/*************************************************************************
+|*
+|* StateChanged-Methode fuer FontWork-Items
+|*
+\************************************************************************/
+
+void SvxFontWorkControllerItem::StateChanged( sal_uInt16 /*nSID*/, SfxItemState /*eState*/,
+ const SfxPoolItem* pItem )
+{
+ switch ( GetId() )
+ {
+ case SID_FORMTEXT_STYLE:
+ {
+ const XFormTextStyleItem* pStateItem =
+ PTR_CAST(XFormTextStyleItem, pItem);
+ DBG_ASSERT(pStateItem || pItem == 0, "XFormTextStyleItem erwartet");
+ rFontWorkDlg.SetStyle_Impl(pStateItem);
+ break;
+ }
+ case SID_FORMTEXT_ADJUST:
+ {
+ const XFormTextAdjustItem* pStateItem =
+ PTR_CAST(XFormTextAdjustItem, pItem);
+ DBG_ASSERT(pStateItem || pItem == 0, "XFormTextAdjustItem erwartet");
+ rFontWorkDlg.SetAdjust_Impl(pStateItem);
+ break;
+ }
+ case SID_FORMTEXT_DISTANCE:
+ {
+ const XFormTextDistanceItem* pStateItem =
+ PTR_CAST(XFormTextDistanceItem, pItem);
+ DBG_ASSERT(pStateItem || pItem == 0, "XFormTextDistanceItem erwartet");
+ rFontWorkDlg.SetDistance_Impl(pStateItem);
+ break;
+ }
+ case SID_FORMTEXT_START:
+ {
+ const XFormTextStartItem* pStateItem =
+ PTR_CAST(XFormTextStartItem, pItem);
+ DBG_ASSERT(pStateItem || pItem == 0, "XFormTextStartItem erwartet");
+ rFontWorkDlg.SetStart_Impl(pStateItem);
+ break;
+ }
+ case SID_FORMTEXT_MIRROR:
+ {
+ const XFormTextMirrorItem* pStateItem =
+ PTR_CAST(XFormTextMirrorItem, pItem);
+ DBG_ASSERT(pStateItem || pItem == 0, "XFormTextMirrorItem erwartet");
+ rFontWorkDlg.SetMirror_Impl(pStateItem);
+ break;
+ }
+ case SID_FORMTEXT_STDFORM:
+ {
+ const XFormTextStdFormItem* pStateItem =
+ PTR_CAST(XFormTextStdFormItem, pItem);
+ DBG_ASSERT(pStateItem || pItem == 0, "XFormTextStdFormItem erwartet");
+ rFontWorkDlg.SetStdForm_Impl(pStateItem);
+ break;
+ }
+ case SID_FORMTEXT_HIDEFORM:
+ {
+ const XFormTextHideFormItem* pStateItem =
+ PTR_CAST(XFormTextHideFormItem, pItem);
+ DBG_ASSERT(pStateItem || pItem == 0, "XFormTextHideFormItem erwartet");
+ rFontWorkDlg.SetShowForm_Impl(pStateItem);
+ break;
+ }
+ case SID_FORMTEXT_OUTLINE:
+ {
+ const XFormTextOutlineItem* pStateItem =
+ PTR_CAST(XFormTextOutlineItem, pItem);
+ DBG_ASSERT(pStateItem || pItem == 0, "XFormTextOutlineItem erwartet");
+ rFontWorkDlg.SetOutline_Impl(pStateItem);
+ break;
+ }
+ case SID_FORMTEXT_SHADOW:
+ {
+ const XFormTextShadowItem* pStateItem =
+ PTR_CAST(XFormTextShadowItem, pItem);
+ DBG_ASSERT(pStateItem || pItem == 0, "XFormTextShadowItem erwartet");
+ rFontWorkDlg.SetShadow_Impl(pStateItem);
+ break;
+ }
+ case SID_FORMTEXT_SHDWCOLOR:
+ {
+ const XFormTextShadowColorItem* pStateItem =
+ PTR_CAST(XFormTextShadowColorItem, pItem);
+ DBG_ASSERT(pStateItem || pItem == 0, "XFormTextShadowColorItem erwartet");
+ rFontWorkDlg.SetShadowColor_Impl(pStateItem);
+ break;
+ }
+ case SID_FORMTEXT_SHDWXVAL:
+ {
+ const XFormTextShadowXValItem* pStateItem =
+ PTR_CAST(XFormTextShadowXValItem, pItem);
+ DBG_ASSERT(pStateItem || pItem == 0, "XFormTextShadowXValItem erwartet");
+ rFontWorkDlg.SetShadowXVal_Impl(pStateItem);
+ break;
+ }
+ case SID_FORMTEXT_SHDWYVAL:
+ {
+ const XFormTextShadowYValItem* pStateItem =
+ PTR_CAST(XFormTextShadowYValItem, pItem);
+ DBG_ASSERT(pStateItem || pItem == 0, "XFormTextShadowYValItem erwartet");
+ rFontWorkDlg.SetShadowYVal_Impl(pStateItem);
+ break;
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Ableitung vom SfxChildWindow als "Behaelter" fuer Fontwork-Dialog
+|*
+\************************************************************************/
+
+SvxFontWorkChildWindow::SvxFontWorkChildWindow
+(
+ Window* _pParent,
+ sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo
+) :
+
+ SfxChildWindow( _pParent, nId )
+
+{
+ pWindow = new SvxFontWorkDialog( pBindings, this, _pParent,
+ SVX_RES( RID_SVXDLG_FONTWORK ) );
+ SvxFontWorkDialog* pDlg = (SvxFontWorkDialog*) pWindow;
+
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+
+ pDlg->Initialize( pInfo );
+}
+
+/*************************************************************************
+|*
+|* Floating Window zur Attributierung von Texteffekten
+|*
+\************************************************************************/
+
+SvxFontWorkDialog::SvxFontWorkDialog( SfxBindings *pBindinx,
+ SfxChildWindow *pCW,
+ Window* _pParent,
+ const ResId& rResId ) :
+ SfxDockingWindow( pBindinx, pCW, _pParent, rResId ),
+
+ aFormSet (this, ResId(VS_FORMS,*rResId.GetResMgr())),
+
+ aTbxStyle (this, ResId(TBX_STYLE,*rResId.GetResMgr())),
+ aTbxAdjust (this, ResId(TBX_ADJUST,*rResId.GetResMgr())),
+
+ aFbDistance (this, ResId(FB_DISTANCE,*rResId.GetResMgr())),
+ aMtrFldDistance (this, ResId(MTR_FLD_DISTANCE,*rResId.GetResMgr())),
+ aFbTextStart (this, ResId(FB_TEXTSTART,*rResId.GetResMgr())),
+ aMtrFldTextStart(this, ResId(MTR_FLD_TEXTSTART,*rResId.GetResMgr())),
+
+ aTbxShadow (this, ResId(TBX_SHADOW,*rResId.GetResMgr())),
+
+ aFbShadowX (this, ResId(FB_SHADOW_X,*rResId.GetResMgr())),
+ aMtrFldShadowX (this, ResId(MTR_FLD_SHADOW_X,*rResId.GetResMgr())),
+ aFbShadowY (this, ResId(FB_SHADOW_Y,*rResId.GetResMgr())),
+ aMtrFldShadowY (this, ResId(MTR_FLD_SHADOW_Y,*rResId.GetResMgr())),
+
+ aShadowColorLB (this, ResId(CLB_SHADOW_COLOR,*rResId.GetResMgr())),
+ rBindings (*pBindinx),
+
+ nLastStyleTbxId(0),
+ nLastAdjustTbxId(0),
+ nLastShadowTbxId(0),
+ nSaveShadowX (0),
+ nSaveShadowY (0),
+ nSaveShadowAngle(450),
+ nSaveShadowSize (100),
+
+ maImageList (ResId(IL_FONTWORK,*rResId.GetResMgr())),
+ maImageListH (ResId(ILH_FONTWORK,*rResId.GetResMgr())),
+
+ pColorTable (NULL)
+{
+ FreeResource();
+
+ ApplyImageList();
+
+ pCtrlItems[0] = new SvxFontWorkControllerItem(SID_FORMTEXT_STYLE, *this, rBindings);
+ pCtrlItems[1] = new SvxFontWorkControllerItem(SID_FORMTEXT_ADJUST, *this, rBindings);
+ pCtrlItems[2] = new SvxFontWorkControllerItem(SID_FORMTEXT_DISTANCE, *this, rBindings);
+ pCtrlItems[3] = new SvxFontWorkControllerItem(SID_FORMTEXT_START, *this, rBindings);
+ pCtrlItems[4] = new SvxFontWorkControllerItem(SID_FORMTEXT_MIRROR, *this, rBindings);
+ pCtrlItems[5] = new SvxFontWorkControllerItem(SID_FORMTEXT_STDFORM, *this, rBindings);
+ pCtrlItems[6] = new SvxFontWorkControllerItem(SID_FORMTEXT_HIDEFORM, *this, rBindings);
+ pCtrlItems[7] = new SvxFontWorkControllerItem(SID_FORMTEXT_OUTLINE, *this, rBindings);
+ pCtrlItems[8] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHADOW, *this, rBindings);
+ pCtrlItems[9] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHDWCOLOR, *this, rBindings);
+ pCtrlItems[10] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHDWXVAL, *this, rBindings);
+ pCtrlItems[11] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHDWYVAL, *this, rBindings);
+
+ WinBits aNewStyle = ( aFormSet.GetStyle() | WB_VSCROLL | WB_ITEMBORDER | WB_DOUBLEBORDER );
+ aFormSet.SetStyle( aNewStyle );
+
+ Size aSize = aTbxStyle.CalcWindowSizePixel();
+ aTbxStyle.SetSizePixel(aSize);
+ aTbxStyle.SetSelectHdl( LINK(this, SvxFontWorkDialog, SelectStyleHdl_Impl) );
+
+ aTbxAdjust.SetSizePixel(aSize);
+ aTbxAdjust.SetSelectHdl( LINK(this, SvxFontWorkDialog, SelectAdjustHdl_Impl) );
+
+ aTbxShadow.SetSizePixel(aSize);
+ aTbxShadow.SetSelectHdl( LINK(this, SvxFontWorkDialog, SelectShadowHdl_Impl) );
+
+// aFbShadowX.SetBitmap(Bitmap(FW_RESID(RID_SVXBMP_SHADOW_XDIST)));
+// aFbShadowY.SetBitmap(Bitmap(FW_RESID(RID_SVXBMP_SHADOW_YDIST)));
+
+ Link aLink = LINK(this, SvxFontWorkDialog, ModifyInputHdl_Impl);
+ aMtrFldDistance.SetModifyHdl( aLink );
+ aMtrFldTextStart.SetModifyHdl( aLink );
+ aMtrFldShadowX.SetModifyHdl( aLink );
+ aMtrFldShadowY.SetModifyHdl( aLink );
+
+ // System-Metrik setzen
+ const FieldUnit eDlgUnit = rBindings.GetDispatcher()->GetModule()->GetFieldUnit();
+ SetFieldUnit( aMtrFldDistance, eDlgUnit, sal_True );
+ SetFieldUnit( aMtrFldTextStart, eDlgUnit, sal_True );
+ SetFieldUnit( aMtrFldShadowX, eDlgUnit, sal_True );
+ SetFieldUnit( aMtrFldShadowY, eDlgUnit, sal_True );
+ if( eDlgUnit == FUNIT_MM )
+ {
+ aMtrFldDistance.SetSpinSize( 50 );
+ aMtrFldTextStart.SetSpinSize( 50 );
+ aMtrFldShadowX.SetSpinSize( 50 );
+ aMtrFldShadowY.SetSpinSize( 50 );
+ }
+ else
+ {
+ aMtrFldDistance.SetSpinSize( 10 );
+ aMtrFldTextStart.SetSpinSize( 10 );
+ aMtrFldShadowX.SetSpinSize( 10 );
+ aMtrFldShadowY.SetSpinSize( 10 );
+ }
+
+ aShadowColorLB.SetSelectHdl( LINK(this, SvxFontWorkDialog, ColorSelectHdl_Impl) );
+
+ aInputTimer.SetTimeout(500);
+ aInputTimer.SetTimeoutHdl(LINK(this, SvxFontWorkDialog, InputTimoutHdl_Impl));
+
+ aFormSet.SetSelectHdl( LINK(this, SvxFontWorkDialog, FormSelectHdl_Impl) );
+ aFormSet.SetColCount(4);
+ aFormSet.SetLineCount(2);
+
+ Bitmap aBmp(SVX_RES(RID_SVXBMP_FONTWORK_FORM1));
+ aSize.Height() = aFormSet.CalcWindowSizePixel(aBmp.GetSizePixel()).Height() + 2;
+ aFormSet.SetSizePixel(aSize);
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+SvxFontWorkDialog::~SvxFontWorkDialog()
+{
+ for (sal_uInt16 i = 0; i < CONTROLLER_COUNT; i++)
+ DELETEZ(pCtrlItems[i]);
+}
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::Zoom()
+{
+ SfxDockingWindow::Roll();
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+SfxChildAlignment SvxFontWorkDialog::CheckAlignment( SfxChildAlignment eActAlign,
+ SfxChildAlignment eAlign )
+{
+ SfxChildAlignment eAlignment;
+
+ switch ( eAlign )
+ {
+ case SFX_ALIGN_TOP:
+ case SFX_ALIGN_HIGHESTTOP:
+ case SFX_ALIGN_LOWESTTOP:
+ case SFX_ALIGN_BOTTOM:
+ case SFX_ALIGN_LOWESTBOTTOM:
+ case SFX_ALIGN_HIGHESTBOTTOM:
+ {
+ eAlignment = eActAlign;
+ }
+ break;
+
+ case SFX_ALIGN_LEFT:
+ case SFX_ALIGN_RIGHT:
+ case SFX_ALIGN_FIRSTLEFT:
+ case SFX_ALIGN_LASTLEFT:
+ case SFX_ALIGN_FIRSTRIGHT:
+ case SFX_ALIGN_LASTRIGHT:
+ {
+ eAlignment = eAlign;
+ }
+ break;
+
+ default:
+ {
+ eAlignment = eAlign;
+ }
+ break;
+ }
+
+ return eAlignment;
+}
+
+
+/*************************************************************************
+|*
+|* Style-Buttons setzen
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetStyle_Impl(const XFormTextStyleItem* pItem)
+{
+ if ( pItem )
+ {
+ sal_uInt16 nId = TBI_STYLE_OFF;
+
+ switch ( pItem->GetValue() )
+ {
+ case XFT_ROTATE : nId = TBI_STYLE_ROTATE; break;
+ case XFT_UPRIGHT: nId = TBI_STYLE_UPRIGHT; break;
+ case XFT_SLANTX : nId = TBI_STYLE_SLANTX; break;
+ case XFT_SLANTY : nId = TBI_STYLE_SLANTY; break;
+ default: ;//prevent warning
+ }
+ aTbxStyle.Enable();
+
+ // Make sure that there is allways exactly one checked toolbox item.
+ if ( pItem->GetValue() == XFT_NONE )
+ {
+ aTbxStyle.CheckItem(TBI_STYLE_ROTATE, sal_False);
+ aTbxStyle.CheckItem(TBI_STYLE_UPRIGHT, sal_False);
+ aTbxStyle.CheckItem(TBI_STYLE_SLANTX, sal_False);
+ aTbxStyle.CheckItem(TBI_STYLE_SLANTY, sal_False);
+
+ aTbxStyle.CheckItem(TBI_STYLE_OFF, sal_True);
+ }
+ else
+ {
+ aTbxStyle.CheckItem(TBI_STYLE_OFF, sal_False);
+ aTbxStyle.CheckItem(nId);
+ }
+
+ nLastStyleTbxId = nId;
+ }
+ else
+ aTbxStyle.Disable();
+}
+
+/*************************************************************************
+|*
+|* Adjust-Buttons setzen
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetAdjust_Impl(const XFormTextAdjustItem* pItem)
+{
+ if ( pItem )
+ {
+ sal_uInt16 nId;
+
+ aTbxAdjust.Enable();
+ aMtrFldDistance.Enable();
+
+ if ( pItem->GetValue() == XFT_LEFT || pItem->GetValue() == XFT_RIGHT )
+ {
+ if ( pItem->GetValue() == XFT_LEFT ) nId = TBI_ADJUST_LEFT;
+ else nId = TBI_ADJUST_RIGHT;
+ aMtrFldTextStart.Enable();
+ }
+ else
+ {
+ if ( pItem->GetValue() == XFT_CENTER ) nId = TBI_ADJUST_CENTER;
+ else nId = TBI_ADJUST_AUTOSIZE;
+ aMtrFldTextStart.Disable();
+ }
+
+ if ( !aTbxAdjust.IsItemChecked(nId) )
+ {
+ aTbxAdjust.CheckItem(nId);
+ }
+ nLastAdjustTbxId = nId;
+ }
+ else
+ {
+ aTbxAdjust.Disable();
+ aMtrFldTextStart.Disable();
+ aMtrFldDistance.Disable();
+ }
+}
+
+/*************************************************************************
+|*
+|* Abstand-Wert in Editfeld eintragen
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetDistance_Impl(const XFormTextDistanceItem* pItem)
+{
+ // #104596# Use HasChildPathFocus() instead of HasFocus() at SpinFields
+ if ( pItem && !aMtrFldDistance.HasChildPathFocus() )
+ {
+ SetMetricValue( aMtrFldDistance, pItem->GetValue(), SFX_MAPUNIT_100TH_MM );
+ }
+}
+
+/*************************************************************************
+|*
+|* Einzug-Wert in Editfeld eintragen
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetStart_Impl(const XFormTextStartItem* pItem)
+{
+ // #104596# Use HasChildPathFocus() instead of HasFocus() at SpinFields
+ if ( pItem && !aMtrFldTextStart.HasChildPathFocus() )
+ {
+ SetMetricValue( aMtrFldTextStart, pItem->GetValue(), SFX_MAPUNIT_100TH_MM );
+ }
+}
+
+/*************************************************************************
+|*
+|* Button fuer Umkehrung der Textrichtung setzen
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetMirror_Impl(const XFormTextMirrorItem* pItem)
+{
+ if ( pItem )
+ aTbxAdjust.CheckItem(TBI_ADJUST_MIRROR, pItem->GetValue());
+}
+
+/*************************************************************************
+|*
+|* Standardform im ValueSet anzeigen
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetStdForm_Impl(const XFormTextStdFormItem* pItem)
+{
+ if ( pItem )
+ {
+ aFormSet.Enable();
+ aFormSet.SetNoSelection();
+
+ if ( pItem->GetValue() != XFTFORM_NONE )
+ aFormSet.SelectItem(
+ sal::static_int_cast< sal_uInt16 >(pItem->GetValue()));
+ }
+ else
+ aFormSet.Disable();
+}
+
+/*************************************************************************
+|*
+|* Button fuer Konturanzeige setzen
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetShowForm_Impl(const XFormTextHideFormItem* pItem)
+{
+ if ( pItem )
+ aTbxShadow.CheckItem(TBI_SHOWFORM, !pItem->GetValue());
+}
+
+/*************************************************************************
+|*
+|* Button fuer Zeichenumrandung setzen
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetOutline_Impl(const XFormTextOutlineItem* pItem)
+{
+ if ( pItem )
+ aTbxShadow.CheckItem(TBI_OUTLINE, pItem->GetValue());
+}
+
+/*************************************************************************
+|*
+|* Shadow-Buttons setzen
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetShadow_Impl(const XFormTextShadowItem* pItem,
+ sal_Bool bRestoreValues)
+{
+ if ( pItem )
+ {
+ sal_uInt16 nId;
+
+ aTbxShadow.Enable();
+
+ if ( pItem->GetValue() == XFTSHADOW_NONE )
+ {
+ nId = TBI_SHADOW_OFF;
+ aFbShadowX.Hide();
+ aFbShadowY.Hide();
+ aMtrFldShadowX.Disable();
+ aMtrFldShadowY.Disable();
+ aShadowColorLB.Disable();
+ }
+ else
+ {
+ aFbShadowX.Show();
+ aFbShadowY.Show();
+ aMtrFldShadowX.Enable();
+ aMtrFldShadowY.Enable();
+ aShadowColorLB.Enable();
+
+ if ( pItem->GetValue() == XFTSHADOW_NORMAL )
+ {
+ nId = TBI_SHADOW_NORMAL;
+ const FieldUnit eDlgUnit = rBindings.GetDispatcher()->GetModule()->GetFieldUnit();
+
+// aFbShadowX.SetBitmap( Bitmap( ResId(RID_SVXBMP_SHADOW_XDIST, _pMgr ) ) );
+ //aMtrFldShadowX.SetUnit(FUNIT_MM);
+ aMtrFldShadowX.SetUnit( eDlgUnit );
+ aMtrFldShadowX.SetDecimalDigits(2);
+ aMtrFldShadowX.SetMin(LONG_MIN);
+ aMtrFldShadowX.SetMax(LONG_MAX);
+ if( eDlgUnit == FUNIT_MM )
+ aMtrFldShadowX.SetSpinSize( 50 );
+ else
+ aMtrFldShadowX.SetSpinSize( 10 );
+
+// aFbShadowY.SetBitmap( Bitmap( ResId( RID_SVXBMP_SHADOW_YDIST, _pMgr ) ) );
+ //aMtrFldShadowY.SetUnit(FUNIT_MM);
+ aMtrFldShadowY.SetUnit( eDlgUnit );
+ aMtrFldShadowY.SetDecimalDigits(2);
+ aMtrFldShadowY.SetMin(LONG_MIN);
+ aMtrFldShadowY.SetMax(LONG_MAX);
+ if( eDlgUnit == FUNIT_MM )
+ aMtrFldShadowY.SetSpinSize( 50 );
+ else
+ aMtrFldShadowY.SetSpinSize( 10 );
+
+ if ( bRestoreValues )
+ {
+ SetMetricValue( aMtrFldShadowX, nSaveShadowX, SFX_MAPUNIT_100TH_MM );
+ SetMetricValue( aMtrFldShadowY, nSaveShadowY, SFX_MAPUNIT_100TH_MM );
+
+ XFormTextShadowXValItem aXItem( nSaveShadowX );
+ XFormTextShadowYValItem aYItem( nSaveShadowY );
+
+ GetBindings().GetDispatcher()->Execute(
+ SID_FORMTEXT_SHDWXVAL, SFX_CALLMODE_RECORD, &aXItem, &aYItem, 0L );
+ }
+ }
+ else
+ {
+ nId = TBI_SHADOW_SLANT;
+
+// aFbShadowX.SetBitmap( Bitmap( ResId( RID_SVXBMP_SHADOW_ANGLE, _pMgr ) ) );
+ aMtrFldShadowX.SetUnit(FUNIT_CUSTOM);
+ aMtrFldShadowX.SetDecimalDigits(1);
+ aMtrFldShadowX.SetMin(-1800);
+ aMtrFldShadowX.SetMax( 1800);
+ aMtrFldShadowX.SetSpinSize(10);
+
+// aFbShadowY.SetBitmap( Bitmap( ResId( RID_SVXBMP_SHADOW_SIZE, _pMgr ) ) );
+ aMtrFldShadowY.SetUnit(FUNIT_CUSTOM);
+ aMtrFldShadowY.SetDecimalDigits(0);
+ aMtrFldShadowY.SetMin(-999);
+ aMtrFldShadowY.SetMax( 999);
+ aMtrFldShadowY.SetSpinSize(10);
+
+ if ( bRestoreValues )
+ {
+ aMtrFldShadowX.SetValue(nSaveShadowAngle);
+ aMtrFldShadowY.SetValue(nSaveShadowSize);
+ XFormTextShadowXValItem aXItem(nSaveShadowAngle);
+ XFormTextShadowYValItem aYItem(nSaveShadowSize);
+ GetBindings().GetDispatcher()->Execute(
+ SID_FORMTEXT_SHDWXVAL, SFX_CALLMODE_RECORD, &aXItem, &aYItem, 0L );
+ }
+ }
+ }
+
+ if ( !aTbxShadow.IsItemChecked(nId) )
+ {
+ aTbxShadow.CheckItem(nId);
+ }
+ nLastShadowTbxId = nId;
+
+ ApplyImageList();
+ }
+ else
+ {
+ aTbxShadow.Disable();
+ aMtrFldShadowX.Disable();
+ aMtrFldShadowY.Disable();
+ aShadowColorLB.Disable();
+ }
+}
+
+/*************************************************************************
+|*
+|* Schattenfarbe in Listbox eintragen
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetShadowColor_Impl(const XFormTextShadowColorItem* pItem)
+{
+ if ( pItem )
+ aShadowColorLB.SelectEntry(pItem->GetColorValue());
+}
+
+/*************************************************************************
+|*
+|* X-Wert fuer Schatten in Editfeld eintragen
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetShadowXVal_Impl(const XFormTextShadowXValItem* pItem)
+{
+ // #104596# Use HasChildPathFocus() instead of HasFocus() at SpinFields
+ if ( pItem && !aMtrFldShadowX.HasChildPathFocus() )
+ {
+ // #i19251#
+ // sal_Int32 nValue = pItem->GetValue();
+
+ // #i19251#
+ // The two involved fields/items are used double and contain/give different
+ // values regarding to the access method. Thus, here we need to separate the access
+ // methos regarding to the kind of value accessed.
+ if(aTbxShadow.IsItemChecked(TBI_SHADOW_SLANT))
+ {
+ // #i19251#
+ // There is no value correction necessary at all, i think this
+ // was only tried to be done without understanding that the two
+ // involved fields/items are used double and contain/give different
+ // values regarding to the access method.
+ // nValue = nValue - ( int( float( nValue ) / 360.0 ) * 360 );
+ aMtrFldShadowX.SetValue(pItem->GetValue());
+ }
+ else
+ {
+ SetMetricValue( aMtrFldShadowX, pItem->GetValue(), SFX_MAPUNIT_100TH_MM );
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Y-Wert fuer Schatten in Editfeld eintragen
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetShadowYVal_Impl(const XFormTextShadowYValItem* pItem)
+{
+ // #104596# Use HasChildPathFocus() instead of HasFocus() at SpinFields
+ if ( pItem && !aMtrFldShadowY.HasChildPathFocus() )
+ {
+ // #i19251#
+ // The two involved fields/items are used double and contain/give different
+ // values regarding to the access method. Thus, here we need to separate the access
+ // methos regarding to the kind of value accessed.
+ if(aTbxShadow.IsItemChecked(TBI_SHADOW_SLANT))
+ {
+ aMtrFldShadowY.SetValue(pItem->GetValue());
+ }
+ else
+ {
+ SetMetricValue( aMtrFldShadowY, pItem->GetValue(), SFX_MAPUNIT_100TH_MM );
+ }
+ }
+}
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxFontWorkDialog, SelectStyleHdl_Impl, void *, EMPTYARG )
+{
+ sal_uInt16 nId = aTbxStyle.GetCurItemId();
+
+ // Execute this block when a different toolbox item has been clicked or
+ // when the off item has been clicked. The later is necessary to
+ // override the toolbox behaviour of unchecking the item after second
+ // click on it: One of the items has to be checked at all times (when
+ // enabled that is.)
+ if (nId == TBI_STYLE_OFF || nId != nLastStyleTbxId )
+ {
+ XFormTextStyle eStyle = XFT_NONE;
+
+ switch ( nId )
+ {
+ case TBI_STYLE_ROTATE : eStyle = XFT_ROTATE; break;
+ case TBI_STYLE_UPRIGHT : eStyle = XFT_UPRIGHT; break;
+ case TBI_STYLE_SLANTX : eStyle = XFT_SLANTX; break;
+ case TBI_STYLE_SLANTY : eStyle = XFT_SLANTY; break;
+ }
+ XFormTextStyleItem aItem( eStyle );
+ GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L );
+ SetStyle_Impl( &aItem );
+ nLastStyleTbxId = nId;
+ }
+ return 0;
+}
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxFontWorkDialog, SelectAdjustHdl_Impl, void *, EMPTYARG )
+{
+ sal_uInt16 nId = aTbxAdjust.GetCurItemId();
+
+ if ( nId == TBI_ADJUST_MIRROR )
+ {
+ XFormTextMirrorItem aItem(aTbxAdjust.IsItemChecked(nId));
+ GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_MIRROR, SFX_CALLMODE_SLOT, &aItem, 0L );
+ }
+ else if ( nId != nLastAdjustTbxId )
+ {
+ XFormTextAdjust eAdjust = XFT_AUTOSIZE;
+
+ switch ( nId )
+ {
+ case TBI_ADJUST_LEFT : eAdjust = XFT_LEFT; break;
+ case TBI_ADJUST_CENTER : eAdjust = XFT_CENTER; break;
+ case TBI_ADJUST_RIGHT : eAdjust = XFT_RIGHT; break;
+ }
+ XFormTextAdjustItem aItem(eAdjust);
+ GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_ADJUST, SFX_CALLMODE_RECORD, &aItem, 0L );
+ SetAdjust_Impl(&aItem);
+ nLastAdjustTbxId = nId;
+ }
+ return 0;
+}
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxFontWorkDialog, SelectShadowHdl_Impl, void *, EMPTYARG )
+{
+ sal_uInt16 nId = aTbxShadow.GetCurItemId();
+
+ if ( nId == TBI_SHOWFORM )
+ {
+ XFormTextHideFormItem aItem(!aTbxShadow.IsItemChecked(nId));
+ GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_HIDEFORM, SFX_CALLMODE_RECORD, &aItem, 0L );
+ }
+ else if ( nId == TBI_OUTLINE )
+ {
+ XFormTextOutlineItem aItem(aTbxShadow.IsItemChecked(nId));
+ GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_OUTLINE, SFX_CALLMODE_RECORD, &aItem, 0L );
+ }
+ else if ( nId != nLastShadowTbxId )
+ {
+ XFormTextShadow eShadow = XFTSHADOW_NONE;
+
+ if ( nLastShadowTbxId == TBI_SHADOW_NORMAL )
+ {
+ nSaveShadowX = GetCoreValue( aMtrFldShadowX, SFX_MAPUNIT_100TH_MM );
+ nSaveShadowY = GetCoreValue( aMtrFldShadowY, SFX_MAPUNIT_100TH_MM );
+ }
+ else if ( nLastShadowTbxId == TBI_SHADOW_SLANT )
+ {
+ nSaveShadowAngle = static_cast<long>(aMtrFldShadowX.GetValue());
+ nSaveShadowSize = static_cast<long>(aMtrFldShadowY.GetValue());
+ }
+ nLastShadowTbxId = nId;
+
+ if ( nId == TBI_SHADOW_NORMAL ) eShadow = XFTSHADOW_NORMAL;
+ else if ( nId == TBI_SHADOW_SLANT ) eShadow = XFTSHADOW_SLANT;
+
+ XFormTextShadowItem aItem(eShadow);
+ GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_SHADOW, SFX_CALLMODE_RECORD, &aItem, 0L );
+ SetShadow_Impl(&aItem, sal_True);
+ }
+ return 0;
+}
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+IMPL_LINK_INLINE_START( SvxFontWorkDialog, ModifyInputHdl_Impl, void *, EMPTYARG )
+{
+ aInputTimer.Start();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvxFontWorkDialog, ModifyInputHdl_Impl, void *, EMPTYARG )
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxFontWorkDialog, InputTimoutHdl_Impl, void *, EMPTYARG )
+{
+ // System-Metrik evtl. neu setzen
+ // Dieses sollte mal als Listener passieren, ist aber aus
+ // inkompatibilitaetsgruenden z.Z. nicht moeglich
+ const FieldUnit eDlgUnit = rBindings.GetDispatcher()->GetModule()->GetFieldUnit();
+ if( eDlgUnit != aMtrFldDistance.GetUnit() )
+ {
+ SetFieldUnit( aMtrFldDistance, eDlgUnit, sal_True );
+ SetFieldUnit( aMtrFldTextStart, eDlgUnit, sal_True );
+ aMtrFldDistance.SetSpinSize( eDlgUnit == FUNIT_MM ? 50 : 10 );
+ aMtrFldTextStart.SetSpinSize( eDlgUnit == FUNIT_MM ? 50 : 10 );
+ }
+ if( eDlgUnit != aMtrFldShadowX.GetUnit() &&
+ aTbxShadow.IsItemChecked( TBI_SHADOW_NORMAL ) )
+ {
+ SetFieldUnit( aMtrFldShadowX, eDlgUnit, sal_True );
+ SetFieldUnit( aMtrFldShadowY, eDlgUnit, sal_True );
+ aMtrFldShadowX.SetSpinSize( eDlgUnit == FUNIT_MM ? 50 : 10 );
+ aMtrFldShadowY.SetSpinSize( eDlgUnit == FUNIT_MM ? 50 : 10 );
+ }
+
+ long nValue = GetCoreValue( aMtrFldDistance, SFX_MAPUNIT_100TH_MM );
+ XFormTextDistanceItem aDistItem( nValue );
+ nValue = GetCoreValue( aMtrFldTextStart, SFX_MAPUNIT_100TH_MM );
+ XFormTextStartItem aStartItem( nValue );
+
+ sal_Int32 nValueX(0L);
+ sal_Int32 nValueY(0L);
+
+ // #i19251#
+ // The two involved fields/items are used double and contain/give different
+ // values regarding to the access method. Thus, here we need to separate the access
+ // methos regarding to the kind of value accessed.
+ if(nLastShadowTbxId == TBI_SHADOW_NORMAL)
+ {
+ nValueX = GetCoreValue( aMtrFldShadowX, SFX_MAPUNIT_100TH_MM );
+ nValueY = GetCoreValue( aMtrFldShadowY, SFX_MAPUNIT_100TH_MM );
+ }
+ else if(nLastShadowTbxId == TBI_SHADOW_SLANT)
+ {
+ nValueX = static_cast<long>(aMtrFldShadowX.GetValue());
+ nValueY = static_cast<long>(aMtrFldShadowY.GetValue());
+ }
+
+ XFormTextShadowXValItem aShadowXItem( nValueX );
+ XFormTextShadowYValItem aShadowYItem( nValueY );
+
+ // Slot-ID ist egal, die Exec-Methode wertet das gesamte ItemSet aus
+ GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_DISTANCE, SFX_CALLMODE_RECORD, &aDistItem,
+ &aStartItem, &aShadowXItem, &aShadowYItem, 0L );
+ return 0;
+}
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxFontWorkDialog, FormSelectHdl_Impl, void *, EMPTYARG )
+{
+ XFormTextStdFormItem aItem;
+
+ if ( aFormSet.IsNoSelection() )
+ aItem.SetValue(XFTFORM_NONE);
+ else
+ aItem.SetValue(aFormSet.GetSelectItemId());
+ GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_STDFORM, SFX_CALLMODE_RECORD, &aItem, 0L );
+ aFormSet.SetNoSelection();
+ return 0;
+}
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxFontWorkDialog, ColorSelectHdl_Impl, void *, EMPTYARG )
+{
+// Changed by obo. Linux-Compiler can't parse commented lines
+ XFormTextShadowColorItem aItem( (const String &) String(),
+ (const Color &) aShadowColorLB.GetSelectEntryColor() );
+// XFormTextShadowColorItem aItem( String(),
+// aShadowColorLB.GetSelectEntryColor() );
+ GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_SHDWCOLOR, SFX_CALLMODE_RECORD, &aItem, 0L );
+ return 0;
+}
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetColorTable(const XColorTable* pTable)
+{
+ if ( pTable && pTable != pColorTable )
+ {
+ pColorTable = pTable;
+ aShadowColorLB.Clear();
+ aShadowColorLB.Fill(pColorTable);
+ }
+}
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetActive(sal_Bool /*bActivate*/)
+{
+}
+
+/*************************************************************************
+|*
+|* Standard-FontWork-Objekt erzeugen
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::CreateStdFormObj(SdrView& rView, SdrPageView& rPV,
+ const SfxItemSet& rAttr,
+ SdrObject& rOldObj,
+ XFormTextStdForm eForm)
+{
+ SfxItemSet aAttr(*rAttr.GetPool(), XATTR_FORMTXTSTYLE,
+ XATTR_FORMTXTHIDEFORM);
+ SdrObject* pNewObj = NULL;
+ Rectangle aRect;
+ XFormTextAdjust eAdjust = XFT_AUTOSIZE;
+
+//-/ rOldObj.TakeAttributes(aAttr, sal_True, sal_False);
+ aAttr.Put(rOldObj.GetMergedItemSet());
+
+ const XFormTextStdFormItem& rOldForm = (const XFormTextStdFormItem&)
+ aAttr.Get(XATTR_FORMTXTSTDFORM);
+
+ aRect = rOldObj.GetSnapRect();
+
+ if ( !rOldObj.ISA(SdrPathObj) )
+ {
+ Point aPos = aRect.TopLeft();
+ aRect = rOldObj.GetLogicRect();
+ aRect.SetPos(aPos);
+ }
+
+ aAttr.Put(rAttr);
+
+ if ( rOldForm.GetValue() == XFTFORM_NONE )
+ {
+ long nW = aRect.GetWidth();
+ aRect.SetSize(Size(nW, nW));
+ aAttr.Put(XFormTextStyleItem(XFT_ROTATE));
+ }
+
+ Point aCenter = aRect.Center();
+
+ switch ( eForm )
+ {
+ case XFTFORM_TOPCIRC:
+ case XFTFORM_BOTCIRC:
+ case XFTFORM_LFTCIRC:
+ case XFTFORM_RGTCIRC:
+ case XFTFORM_TOPARC:
+ case XFTFORM_BOTARC:
+ case XFTFORM_LFTARC:
+ case XFTFORM_RGTARC:
+ {
+ long nBeg, nEnd;
+
+ switch ( eForm )
+ {
+ default: ; //prevent warning
+ case XFTFORM_TOPCIRC:
+ nBeg = 0;
+ nEnd = 18000;
+ break;
+ case XFTFORM_BOTCIRC:
+ nBeg = 18000;
+ nEnd = 36000;
+ break;
+ case XFTFORM_LFTCIRC:
+ nBeg = 9000;
+ nEnd = 27000;
+ break;
+ case XFTFORM_RGTCIRC:
+ nBeg = 27000;
+ nEnd = 9000;
+ break;
+ case XFTFORM_TOPARC:
+ nBeg = 4500;
+ nEnd = 13500;
+ break;
+ case XFTFORM_BOTARC:
+ nBeg = 22500;
+ nEnd = 31500;
+ break;
+ case XFTFORM_LFTARC:
+ nBeg = 13500;
+ nEnd = 22500;
+ break;
+ case XFTFORM_RGTARC:
+ nBeg = 31500;
+ nEnd = 4500;
+ break;
+ }
+ pNewObj = new SdrCircObj(OBJ_CARC, aRect, nBeg, nEnd);
+ break;
+ }
+ case XFTFORM_BUTTON1:
+ {
+ basegfx::B2DPolyPolygon aPolyPolygon;
+ basegfx::B2DPolygon aLine;
+ long nR = aRect.GetWidth() / 2;
+ basegfx::B2DPolygon aTopArc(XPolygon(aCenter, -nR, nR, 50, 1750, sal_False).getB2DPolygon());
+ basegfx::B2DPolygon aBottomArc(XPolygon(aCenter, -nR, nR, 1850, 3550, sal_False).getB2DPolygon());
+
+ // Polygone schliessen
+ aTopArc.setClosed(true);
+ aBottomArc.setClosed(true);
+ aPolyPolygon.append(aTopArc);
+
+ aLine.append(aBottomArc.getB2DPoint(aBottomArc.count() - 1L));
+ aLine.append(aBottomArc.getB2DPoint(0L));
+ aLine.setClosed(true);
+
+ aPolyPolygon.append(aLine);
+ aPolyPolygon.append(aBottomArc);
+
+ pNewObj = new SdrPathObj(OBJ_PATHFILL, aPolyPolygon);
+ eAdjust = XFT_CENTER;
+ break;
+ }
+ case XFTFORM_BUTTON2:
+ case XFTFORM_BUTTON3:
+ case XFTFORM_BUTTON4:
+ {
+ basegfx::B2DPolyPolygon aPolyPolygon;
+ basegfx::B2DPolygon aLine;
+ long nR = aRect.GetWidth() / 2;
+ long nWDiff = nR / 5;
+ long nHDiff;
+
+ if ( eForm == XFTFORM_BUTTON4 )
+ {
+ basegfx::B2DPolygon aNewArc(XPolygon(aCenter, -nR, nR, 950, 2650, sal_False).getB2DPolygon());
+ aNewArc.setClosed(true);
+ aPolyPolygon.append(aNewArc);
+ eAdjust = XFT_CENTER;
+ }
+ else
+ {
+ basegfx::B2DPolygon aNewArc(XPolygon(aCenter, -nR, nR, 2700, 2700).getB2DPolygon());
+ aPolyPolygon.append(aNewArc);
+ }
+
+ if ( eForm == XFTFORM_BUTTON3 )
+ nHDiff = -aRect.GetHeight() / 10;
+ else
+ nHDiff = aRect.GetHeight() / 20;
+
+ aLine.append(basegfx::B2DPoint(aRect.Left() + nWDiff, aRect.Center().Y() + nHDiff));
+ aLine.append(basegfx::B2DPoint(aRect.Right() - nWDiff, aRect.Center().Y() + nHDiff));
+ aLine.setClosed(true);
+ aPolyPolygon.append(aLine);
+
+ if ( eForm == XFTFORM_BUTTON4 )
+ {
+ basegfx::B2DPolygon aNewArc(XPolygon(aCenter, -nR, nR, 2750, 850, sal_False).getB2DPolygon());
+ aNewArc.setClosed(true);
+ aPolyPolygon.append(aNewArc);
+ }
+
+ if ( eForm == XFTFORM_BUTTON3 )
+ {
+ nHDiff += nHDiff;
+ aLine.setB2DPoint(0L, basegfx::B2DPoint(aLine.getB2DPoint(0L).getX(), aLine.getB2DPoint(0L).getY() - nHDiff));
+ aLine.setB2DPoint(1L, basegfx::B2DPoint(aLine.getB2DPoint(1L).getX(), aLine.getB2DPoint(1L).getY() - nHDiff));
+ aPolyPolygon.append(aLine);
+ }
+
+ pNewObj = new SdrPathObj(OBJ_PATHFILL, aPolyPolygon);
+ break;
+ }
+ default: ; //prevent warning
+ }
+ if ( pNewObj )
+ {
+ // #78478# due to DLs changes in Outliner the object needs
+ // a model to get an outliner for later calls to
+ // pNewObj->SetOutlinerParaObject(pPara) (see below).
+ pNewObj->SetModel(rOldObj.GetModel());
+
+ Size aSize;
+ Rectangle aSnap = pNewObj->GetSnapRect();
+
+ aSize.Width() = aRect.Left() - aSnap.Left();
+ aSize.Height() = aRect.Top() - aSnap.Top();
+ pNewObj->NbcMove(aSize);
+
+ rView.BegUndo( SVX_RESSTR( RID_SVXSTR_FONTWORK_UNDOCREATE ) );
+ OutlinerParaObject* pPara = rOldObj.GetOutlinerParaObject();
+ sal_Bool bHide = sal_True;
+
+ if ( pPara != NULL )
+ {
+ pPara = new OutlinerParaObject(*pPara);
+ pNewObj->SetOutlinerParaObject(pPara);
+ }
+ else
+ bHide = sal_False;
+
+ rView.ReplaceObjectAtView(&rOldObj, rPV, pNewObj, sal_True);
+ pNewObj->SetLayer(rOldObj.GetLayer());
+ aAttr.Put(XFormTextHideFormItem(bHide));
+ aAttr.Put(XFormTextAdjustItem(eAdjust));
+
+ XFormTextShadow eShadow = XFTSHADOW_NONE;
+
+ if ( nLastShadowTbxId == TBI_SHADOW_NORMAL )
+ {
+ eShadow = XFTSHADOW_NORMAL;
+ aAttr.Put(XFormTextShadowXValItem(nSaveShadowX));
+ aAttr.Put(XFormTextShadowYValItem(nSaveShadowY));
+ }
+ else if ( nLastShadowTbxId == TBI_SHADOW_SLANT )
+ {
+ eShadow = XFTSHADOW_SLANT;
+ aAttr.Put(XFormTextShadowXValItem(nSaveShadowAngle));
+ aAttr.Put(XFormTextShadowYValItem(nSaveShadowSize));
+ }
+
+ aAttr.Put(XFormTextShadowItem(eShadow));
+
+ rView.SetAttributes(aAttr);
+ rView.EndUndo();
+ }
+}
+
+void SvxFontWorkDialog::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ ApplyImageList();
+
+ SfxDockingWindow::DataChanged( rDCEvt );
+}
+/* -----------------------------08.05.2002 14:28------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxFontWorkDialog::ApplyImageList()
+{
+ bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ ResMgr* _pMgr = &DIALOG_MGR();
+
+ sal_uInt16 nBitmapResId = bHighContrast ? RID_SVXBMP_FONTWORK_FORM1_H : RID_SVXBMP_FONTWORK_FORM1;
+ sal_uInt16 nTextResId = RID_SVXSTR_FONTWORK_FORM1;
+
+ bool bInit = aFormSet.GetItemCount() == 0;
+
+ if( bInit )
+ {
+/*
+ Size aSize( aTbxStyle.CalcWindowSizePixel() );
+ Bitmap aBmp(ResId(RID_SVXBMP_FONTWORK_FORM1,_pMgr));
+ aSize.Height() = aFormSet.CalcWindowSizePixel(aBmp.GetSizePixel()).Height() + 2;
+ aFormSet.SetSizePixel(aSize);
+*/
+ }
+
+ sal_uInt16 i;
+ for( i = 1; i < 13; i++, nTextResId++, nBitmapResId++ )
+ {
+ if( bInit )
+ {
+ aFormSet.InsertItem( i, Bitmap(ResId(nBitmapResId,*_pMgr)),
+ String(ResId(nTextResId,*_pMgr)));
+ }
+ else
+ {
+ aFormSet.SetItemImage( i, Bitmap(ResId(nBitmapResId,*_pMgr)) );
+ }
+ }
+
+ ImageList& rImgLst = bHighContrast ? maImageListH : maImageList;
+
+ aTbxStyle.SetImageList( rImgLst );
+ aTbxAdjust.SetImageList( rImgLst );
+ aTbxShadow.SetImageList( rImgLst );
+
+ switch( nLastShadowTbxId )
+ {
+ case TBI_SHADOW_SLANT:
+ aFbShadowX.SetImage( rImgLst.GetImage( TBI_SHADOW_ANGLE ) );
+ aFbShadowY.SetImage( rImgLst.GetImage( TBI_SHADOW_SIZE ) );
+ break;
+// case TBI_SHADOW_NORMAL:
+ default:
+ aFbShadowX.SetImage( rImgLst.GetImage( TBI_SHADOW_XDIST ) );
+ aFbShadowY.SetImage( rImgLst.GetImage( TBI_SHADOW_YDIST ) );
+ break;
+ }
+
+ aFbDistance.SetImage( rImgLst.GetImage( TBI_DISTANCE ) );
+ aFbTextStart.SetImage( rImgLst.GetImage( TBI_TEXTSTART ) );
+
+}
diff --git a/svx/source/dialog/fontwork.hrc b/svx/source/dialog/fontwork.hrc
new file mode 100644
index 000000000000..cdbc48aa032e
--- /dev/null
+++ b/svx/source/dialog/fontwork.hrc
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define VS_FORMS 1
+#define TBX_STYLE 1
+#define TBX_ADJUST 2
+#define TBX_SHADOW 3
+
+#define FB_DISTANCE 1
+#define FB_TEXTSTART 2
+#define FB_SHADOW_X 3
+#define FB_SHADOW_Y 4
+#define MTR_FLD_DISTANCE 1
+#define MTR_FLD_TEXTSTART 2
+#define MTR_FLD_SHADOW_X 3
+#define MTR_FLD_SHADOW_Y 4
+#define CLB_SHADOW_COLOR 1
+
+#define IL_FONTWORK 1200
+#define ILH_FONTWORK 1201
+
+// the following ids are also used to identify the
+// bitmaps for the image list
+#define TBI_STYLE_OFF 1
+#define TBI_STYLE_ROTATE 2
+#define TBI_STYLE_UPRIGHT 3
+#define TBI_STYLE_SLANTX 4
+#define TBI_STYLE_SLANTY 5
+#define TBI_ADJUST_MIRROR 6
+#define TBI_ADJUST_LEFT 7
+#define TBI_ADJUST_CENTER 8
+#define TBI_ADJUST_RIGHT 9
+#define TBI_ADJUST_AUTOSIZE 10
+#define TBI_SHOWFORM 11
+#define TBI_OUTLINE 12
+#define TBI_SHADOW_OFF 13
+#define TBI_SHADOW_NORMAL 14
+#define TBI_SHADOW_SLANT 15
+#define TBI_SHADOW_XDIST 16
+#define TBI_SHADOW_YDIST 17
+#define TBI_SHADOW_ANGLE 18
+#define TBI_SHADOW_SIZE 19
+#define TBI_DISTANCE 20
+#define TBI_TEXTSTART 21
diff --git a/svx/source/dialog/fontwork.src b/svx/source/dialog/fontwork.src
new file mode 100644
index 000000000000..92d1be8abc97
--- /dev/null
+++ b/svx/source/dialog/fontwork.src
@@ -0,0 +1,560 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ---------------------------------------------------------------
+#include <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+#include "fontwork.hrc"
+#include "helpid.hrc"
+ // pragma ----------------------------------------------------------------
+
+ // RID_SVXDLG_FONTWORK ---------------------------------------------------
+DockingWindow RID_SVXDLG_FONTWORK
+{
+ HelpId = CMD_SID_FONTWORK ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 89 , 193 ) ;
+ Text [ en-US ] = "Fontwork" ;
+ Moveable = TRUE ;
+ Zoomable = TRUE ;
+ Closeable = TRUE ;
+ Dockable = TRUE ;
+ EnableResizing = TRUE ;
+ Control VS_FORMS
+ {
+ HelpId = HID_FONTWORK_CTL_FORMS ;
+ Pos = MAP_APPFONT ( 6 , 4 ) ;
+ Size = MAP_APPFONT ( 71 , 30 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ ToolBox TBX_STYLE
+ {
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 41 ) ;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ Identifier = TBI_STYLE_OFF ;
+ HelpId = HID_FONTWORK_TBI_STYLE_OFF ;
+ Text [ en-US ] = "Off" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ RadioCheck = TRUE ;
+ Identifier = TBI_STYLE_ROTATE ;
+ HelpId = HID_FONTWORK_TBI_STYLE_ROTATE ;
+ Text [ en-US ] = "Rotate" ;
+ };
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ RadioCheck = TRUE ;
+ Identifier = TBI_STYLE_UPRIGHT ;
+ HelpId = HID_FONTWORK_TBI_STYLE_UPRIGHT ;
+ Text [ en-US ] = "Upright" ;
+ };
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ RadioCheck = TRUE ;
+ Identifier = TBI_STYLE_SLANTX ;
+ HelpId = HID_FONTWORK_TBI_STYLE_SLANTX ;
+ Text [ en-US ] = "Slant Horizontal" ;
+ };
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ RadioCheck = TRUE ;
+ Identifier = TBI_STYLE_SLANTY ;
+ HelpId = HID_FONTWORK_TBI_STYLE_SLANTY ;
+ Text [ en-US ] = "Slant Vertical" ;
+ };
+ };
+ };
+ ToolBox TBX_ADJUST
+ {
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 63 ) ;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ Checkable = TRUE ;
+ Identifier = TBI_ADJUST_MIRROR ;
+ HelpId = HID_FONTWORK_TBI_ADJUST_MIRROR ;
+ Text [ en-US ] = "Orientation" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ RadioCheck = TRUE ;
+ Identifier = TBI_ADJUST_LEFT ;
+ HelpId = HID_FONTWORK_TBI_ADJUST_LEFT ;
+ Text [ en-US ] = "Align Left" ;
+ };
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ RadioCheck = TRUE ;
+ Identifier = TBI_ADJUST_CENTER ;
+ HelpId = HID_FONTWORK_TBI_ADJUST_CENTER ;
+ Text [ en-US ] = "Center" ;
+ };
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ RadioCheck = TRUE ;
+ Identifier = TBI_ADJUST_RIGHT ;
+ HelpId = HID_FONTWORK_TBI_ADJUST_RIGHT ;
+ Text [ en-US ] = "Align Right" ;
+ };
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ RadioCheck = TRUE ;
+ Identifier = TBI_ADJUST_AUTOSIZE ;
+ HelpId = HID_FONTWORK_TBI_ADJUST_AUTOSIZE ;
+ Text [ en-US ] = "AutoSize Text" ;
+ };
+ };
+ };
+ FixedImage FB_DISTANCE
+ {
+ Pos = MAP_APPFONT ( 10 , 84 ) ;
+ Size = MAP_APPFONT ( 14 , 15 ) ;
+ };
+ MetricField MTR_FLD_DISTANCE
+ {
+ HelpID = "svx:MetricField:RID_SVXDLG_FONTWORK:MTR_FLD_DISTANCE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 29 , 85 ) ;
+ Size = MAP_APPFONT ( 48 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -5000000 ;
+ Maximum = 5000000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ First = -5000000 ;
+ Last = 5000000 ;
+ SpinSize = 50 ;
+ QuickHelpText [ en-US ] = "Distance" ;
+
+ };
+ FixedImage FB_TEXTSTART
+ {
+ Pos = MAP_APPFONT ( 10 , 99 ) ;
+ Size = MAP_APPFONT ( 14 , 15 ) ;
+ };
+ MetricField MTR_FLD_TEXTSTART
+ {
+ HelpID = "svx:MetricField:RID_SVXDLG_FONTWORK:MTR_FLD_TEXTSTART";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 29 , 100 ) ;
+ Size = MAP_APPFONT ( 48 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 5000000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ Last = 5000000 ;
+ SpinSize = 50 ;
+ QuickHelpText [ en-US ] = "Indent" ;
+ };
+ ToolBox TBX_SHADOW
+ {
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 122 ) ;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ Checkable = TRUE ;
+ Identifier = TBI_SHOWFORM ;
+ HelpId = HID_FONTWORK_TBI_SHOWFORM ;
+ Text [ en-US ] = "Contour" ;
+ };
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ Checkable = TRUE ;
+ Identifier = TBI_OUTLINE ;
+ HelpId = HID_FONTWORK_TBI_OUTLINE ;
+ Text [ en-US ] = "Text Contour" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ RadioCheck = TRUE ;
+ Identifier = TBI_SHADOW_OFF ;
+ HelpId = HID_FONTWORK_TBI_SHADOW_OFF ;
+ Text [ en-US ] = "No Shadow" ;
+ };
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ RadioCheck = TRUE ;
+ Identifier = TBI_SHADOW_NORMAL ;
+ HelpId = HID_FONTWORK_TBI_SHADOW_NORMAL ;
+ Text [ en-US ] = "Vertical" ;
+ };
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ RadioCheck = TRUE ;
+ Identifier = TBI_SHADOW_SLANT ;
+ HelpId = HID_FONTWORK_TBI_SHADOW_SLANT ;
+ Text [ en-US ] = "Slant" ;
+ };
+ };
+ };
+ FixedImage FB_SHADOW_X
+ {
+ Pos = MAP_APPFONT ( 10 , 143 ) ;
+ Size = MAP_APPFONT ( 14 , 15 ) ;
+ };
+ MetricField MTR_FLD_SHADOW_X
+ {
+ HelpID = "svx:MetricField:RID_SVXDLG_FONTWORK:MTR_FLD_SHADOW_X";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 29 , 144 ) ;
+ Size = MAP_APPFONT ( 48 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -5000000 ;
+ Maximum = 5000000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ CustomUnitText [ en-US ] = " degrees" ;
+ First = -5000000 ;
+ Last = 5000000 ;
+ SpinSize = 50 ;
+ QuickHelpText [ en-US ] = "Distance X" ;
+ };
+ FixedImage FB_SHADOW_Y
+ {
+ Pos = MAP_APPFONT ( 10 , 158 ) ;
+ Size = MAP_APPFONT ( 14 , 15 ) ;
+ };
+ MetricField MTR_FLD_SHADOW_Y
+ {
+ HelpID = "svx:MetricField:RID_SVXDLG_FONTWORK:MTR_FLD_SHADOW_Y";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 29 , 159 ) ;
+ Size = MAP_APPFONT ( 48 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 5000000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ Last = 5000000 ;
+ SpinSize = 50 ;
+ QuickHelpText [ en-US ] = "Distance Y" ;
+ CustomUnitText [ en-US ] = "%" ;
+ };
+ ListBox CLB_SHADOW_COLOR
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_FONTWORK:CLB_SHADOW_COLOR";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 174 ) ;
+ Size = MAP_APPFONT ( 71 , 60 ) ;
+ DropDown = TRUE ;
+ QuickHelpText [ en-US ] = "Shadow Color" ;
+ Text = "-";
+ };
+
+#define FONTWORK_IDLIST \
+ IdList = \
+ { \
+ TBI_STYLE_OFF ; \
+ TBI_STYLE_ROTATE ; \
+ TBI_STYLE_UPRIGHT ; \
+ TBI_STYLE_SLANTX ; \
+ TBI_STYLE_SLANTY ; \
+ TBI_ADJUST_MIRROR ; \
+ TBI_ADJUST_LEFT ; \
+ TBI_ADJUST_CENTER ; \
+ TBI_ADJUST_RIGHT ; \
+ TBI_ADJUST_AUTOSIZE ; \
+ TBI_SHOWFORM ; \
+ TBI_OUTLINE ; \
+ TBI_SHADOW_OFF ; \
+ TBI_SHADOW_NORMAL ; \
+ TBI_SHADOW_SLANT ; \
+ TBI_SHADOW_XDIST ; \
+ TBI_SHADOW_YDIST ; \
+ TBI_SHADOW_ANGLE ; \
+ TBI_SHADOW_SIZE ; \
+ TBI_DISTANCE ; \
+ TBI_TEXTSTART ; \
+ }; \
+ IdCount = { 21 ; };
+
+ #define IMAGE_STDBTN_COLOR Color { Red = 0xff00; Green = 0x0000; Blue = 0xff00; }
+
+ ImageList IL_FONTWORK
+ {
+ Prefix = "fw";
+ MaskColor = IMAGE_STDBTN_COLOR ;
+ FONTWORK_IDLIST
+ };
+ ImageList ILH_FONTWORK
+ {
+ Prefix = "fwh";
+ MaskColor = IMAGE_STDBTN_COLOR ;
+ FONTWORK_IDLIST
+ };
+};
+ // Bitmaps ---------------------------------------------------------------
+Bitmap RID_SVXBMP_FONTWORK_FORM1
+{
+ File = "fwthcirc.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM2
+{
+ File = "fwbhcirc.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM3
+{
+ File = "fwlhcirc.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM4
+{
+ File = "fwrhcirc.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM5
+{
+ File = "fwtoparc.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM6
+{
+ File = "fwbotarc.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM7
+{
+ File = "fwlftarc.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM8
+{
+ File = "fwrgtarc.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM9
+{
+ File = "fwbuttn1.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM10
+{
+ File = "fwbuttn2.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM11
+{
+ File = "fwbuttn3.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM12
+{
+ File = "fwbuttn4.bmp" ;
+};
+
+Bitmap RID_SVXBMP_FONTWORK_FORM1_H
+{
+ File = "fwthcirc_h.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM2_H
+{
+ File = "fwbhcirc_h.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM3_H
+{
+ File = "fwlhcirc_h.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM4_H
+{
+ File = "fwrhcirc_h.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM5_H
+{
+ File = "fwtoparc_h.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM6_H
+{
+ File = "fwbotarc_h.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM7_H
+{
+ File = "fwlftarc_h.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM8_H
+{
+ File = "fwrgtarc_h.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM9_H
+{
+ File = "fwbuttn1_h.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM10_H
+{
+ File = "fwbuttn2_h.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM11_H
+{
+ File = "fwbuttn3_h.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM12_H
+{
+ File = "fwbuttn4_h.bmp" ;
+};
+
+ // Strings ---------------------------------------------------------------
+String RID_SVXSTR_FONTWORK_FORM1
+{
+ Text [ en-US ] = "Upper Semicircle" ;
+};
+String RID_SVXSTR_FONTWORK_FORM2
+{
+ Text [ en-US ] = "Lower Semicircle" ;
+};
+String RID_SVXSTR_FONTWORK_FORM3
+{
+ Text [ en-US ] = "Left Semicircle" ;
+};
+String RID_SVXSTR_FONTWORK_FORM4
+{
+ Text [ en-US ] = "Right Semicircle" ;
+};
+String RID_SVXSTR_FONTWORK_FORM5
+{
+ Text [ en-US ] = "Upper Arc" ;
+};
+String RID_SVXSTR_FONTWORK_FORM6
+{
+ Text [ en-US ] = "Lower Arc" ;
+};
+String RID_SVXSTR_FONTWORK_FORM7
+{
+ Text [ en-US ] = "Left Arc" ;
+};
+String RID_SVXSTR_FONTWORK_FORM8
+{
+ Text [ en-US ] = "Right Arc" ;
+};
+String RID_SVXSTR_FONTWORK_FORM9
+{
+ Text [ en-US ] = "Open Circle" ;
+};
+String RID_SVXSTR_FONTWORK_FORM10
+{
+ Text [ en-US ] = "Closed Circle" ;
+};
+String RID_SVXSTR_FONTWORK_FORM11
+{
+ Text [ en-US ] = "Closed Circle II" ;
+};
+String RID_SVXSTR_FONTWORK_FORM12
+{
+ Text [ en-US ] = "Open Circle Vertical" ;
+};
+String RID_SVXSTR_FONTWORK_UNDOCREATE
+{
+ Text [ en-US ] = "Create Fontwork object" ;
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx
new file mode 100644
index 000000000000..45ceac57c564
--- /dev/null
+++ b/svx/source/dialog/framelink.cxx
@@ -0,0 +1,1531 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/framelink.hxx>
+
+#include <math.h>
+#include <vcl/outdev.hxx>
+#include <editeng/borderline.hxx>
+
+// ----------------------------------------------------------------------------
+
+/** Define to select the drawing mode of thin dotted lines.
+
+ 0 = Draw lines using an own implementation (recommended). Draws always
+ little dots in an appropriate distance.
+ 1 = Draw dotted lines using vcl/LineInfo. Results in dashed lines instead
+ of dotted lines, which may look ugly for diagonal lines.
+ */
+#define SVX_FRAME_USE_LINEINFO 0
+
+// ----------------------------------------------------------------------------
+
+#if SVX_FRAME_USE_LINEINFO
+#include <vcl/lineinfo.hxx>
+#endif
+
+namespace svx {
+namespace frame {
+
+// ============================================================================
+// ============================================================================
+
+namespace {
+
+typedef std::vector< Point > PointVec;
+
+// ----------------------------------------------------------------------------
+// Link result structs for horizontal and vertical lines and borders.
+
+/** Result struct used by the horizontal/vertical frame link functions.
+
+ This struct is used to return coordinate offsets for one end of a single
+ line in a frame border, i.e. the left end of the primary line of a
+ horizontal frame border.
+
+ 1) Usage for horizontal lines
+
+ If this struct is returned by the lclLinkHorFrameBorder() function, each
+ member refers to the X coordinate of one edge of a single line end in a
+ horizontal frame border. They specify an offset to modify this coordinate
+ when the line is painted. The values in this struct may change a
+ rectangular line shape into a line with slanted left or right border, which
+ is used to connect the line with diagonal lines.
+
+ Usage for a left line end: Usage for a right line end:
+ mnOffs1 mnOffs1
+ <-------> <------->
+ +-------------------------------+
+ | the original horizontal line |
+ +-------------------------------+
+ <-------> <------->
+ mnOffs2 mnOffs2
+
+ 2) Usage for vertical lines
+
+ If this struct is returned by the lclLinkVerFrameBorder() function, each
+ member refers to the Y coordinate of one edge of a single line end in a
+ vertical frame border. They specify an offset to modify this coordinate
+ when the line is painted. The values in this struct may change a
+ rectangular line shape into a line with slanted top or bottom border, which
+ is used to connect the line with diagonal lines.
+
+ Usage for a top line end: mnOffs1 ^ ^ mnOffs2
+ | +-------+ |
+ v | | v
+ | |
+ | |
+ the original vertical line ---> | |
+ | |
+ | |
+ ^ | | ^
+ | +-------+ |
+ Usage for a bottom line end: mnOffs1 v v mnOffs2
+ */
+struct LineEndResult
+{
+ long mnOffs1; /// Offset for top or left edge, dependent of context.
+ long mnOffs2; /// Offset for bottom or right edge, dependent of context
+
+ inline explicit LineEndResult() : mnOffs1( 0 ), mnOffs2( 0 ) {}
+
+ inline void Swap() { std::swap( mnOffs1, mnOffs2 ); }
+ inline void Negate() { mnOffs1 = -mnOffs1; mnOffs2 = -mnOffs2; }
+};
+
+/** Result struct used by the horizontal/vertical frame link functions.
+
+ This struct contains the linking results for one end of a frame border,
+ including both the primary and secondary line ends.
+ */
+struct BorderEndResult
+{
+ LineEndResult maPrim; /// Result for primary line.
+ LineEndResult maSecn; /// Result for secondary line.
+
+ inline void Negate() { maPrim.Negate(); maSecn.Negate(); }
+};
+
+/** Result struct used by the horizontal/vertical frame link functions.
+
+ This struct contains the linking results for both frame border ends, and
+ therefore for the complete frame border.
+ */
+struct BorderResult
+{
+ BorderEndResult maBeg; /// Result for begin of border line (left or top end).
+ BorderEndResult maEnd; /// Result for end of border line (right or bottom end).
+};
+
+// ----------------------------------------------------------------------------
+// Link result structs for diagonal lines and borders.
+
+/** Result struct used by the diagonal frame link functions.
+
+ This struct contains the linking results for one line of a diagonal frame
+ border.
+ */
+struct DiagLineResult
+{
+ long mnLClip; /// Offset for left border of clipping rectangle.
+ long mnRClip; /// Offset for right border of clipping rectangle.
+ long mnTClip; /// Offset for top border of clipping rectangle.
+ long mnBClip; /// Offset for bottom border of clipping rectangle.
+
+ inline explicit DiagLineResult() : mnLClip( 0 ), mnRClip( 0 ), mnTClip( 0 ), mnBClip( 0 ) {}
+};
+
+/** Result struct used by the diagonal frame link functions.
+
+ This struct contains the linking results for one diagonal frame border.
+ */
+struct DiagBorderResult
+{
+ DiagLineResult maPrim; /// Result for primary line.
+ DiagLineResult maSecn; /// Result for secondary line.
+};
+
+/** Result struct used by the diagonal frame link functions.
+
+ This struct contains the linking results for both diagonal frame borders.
+ */
+struct DiagBordersResult
+{
+ DiagBorderResult maTLBR; /// Result for top-left to bottom-right frame border.
+ DiagBorderResult maBLTR; /// Result for bottom-left to top-right frame border.
+};
+
+// ----------------------------------------------------------------------------
+
+/** A helper struct containing two points of a line.
+ */
+struct LinePoints
+{
+ Point maBeg; /// Start position of the line.
+ Point maEnd; /// End position of the line.
+
+ explicit LinePoints( const Point& rBeg, const Point& rEnd ) :
+ maBeg( rBeg ), maEnd( rEnd ) {}
+ explicit LinePoints( const Rectangle& rRect, bool bTLBR ) :
+ maBeg( bTLBR ? rRect.TopLeft() : rRect.TopRight() ),
+ maEnd( bTLBR ? rRect.BottomRight() : rRect.BottomLeft() ) {}
+};
+
+// ============================================================================
+
+/** Rounds and casts a double value to a long value. */
+inline long lclD2L( double fValue )
+{
+ return static_cast< long >( (fValue < 0.0) ? (fValue - 0.5) : (fValue + 0.5) );
+}
+
+/** Converts a width in twips to a width in another map unit (specified by fScale). */
+sal_uInt16 lclScaleValue( long nValue, double fScale, sal_uInt16 nMaxWidth )
+{
+ // convert any width except 0 to at least 1 unit
+ // #i61324# 1 twip must scale to 1/100mm
+ return nValue ? static_cast< sal_uInt16 >( std::min< long >( std::max(
+ static_cast< long >( nValue * fScale ), 1L ), nMaxWidth ) ) : 0;
+}
+
+// ----------------------------------------------------------------------------
+// Line width offset calculation.
+
+/** Returns the start offset of the single/primary line across the frame border.
+
+ All following lclGet*Beg() and lclGet*End() functions return sub units to
+ increase the computational accuracy, where 256 sub units are equal to
+ 1 map unit of the used OutputDevice.
+
+ The following pictures show the upper end of a vertical frame border and
+ illustrates the return values of all following lclGet*Beg() and lclGet*End()
+ functions. The first picture shows a single frame border, the second picture
+ shows a double frame border.
+
+ The functions regard the reference point handling mode of the passed border
+ style.
+ REFMODE_CENTERED:
+ All returned offsets are relative to the middle position of the frame
+ border (offsets left of the middle are returned negative, offsets right
+ of the middle are returned positive).
+ REFMODE_BEGIN:
+ All returned offsets are relative to the begin of the frame border
+ (lclGetBeg() always returns 0).
+ REFMODE_END:
+ All returned offsets are relative to the end of the frame border
+ (lclGetEnd() always returns 0).
+
+ |<- lclGetEnd()
+ |<- lclGetBeforeBeg() |<- lclGetPrimEnd()
+ | |
+ ||<- lclGetBeg() ||<- lclGetBehindEnd()
+ || ||
+ |#################################|
+ direction of | #################################
+ the frame | #################################
+ border is | #################################
+ vertical | #################################
+ v #################################
+ |
+ |<- middle of the frame border
+
+
+ lclGetDistEnd() ->||<- lclGetSecnBeg()
+ ||
+ lclGetBeg() ->| lclGetDistBeg() ->| || |<- lclGetEnd()
+ | | || |
+ lclGetBeforeBeg()->|| lclGetPrimEnd() ->|| || ||<- lclGetBehindEnd()
+ || || || ||
+ |######################| |#############|
+ direction of | ###################### #############
+ the frame | ###################### #############
+ border is | ###################### #############
+ vertical | ###################### | #############
+ v ###################### | #############
+ primary line | secondary line
+ |
+ |<- middle of the frame border
+
+ @return
+ The start offset of the single/primary line relative to the reference
+ position of the frame border (sub units; 0 for invisible or one pixel
+ wide single frame styles).
+ */
+long lclGetBeg( const Style& rBorder )
+{
+ long nPos = 0;
+ switch( rBorder.GetRefMode() )
+ {
+ case REFMODE_CENTERED: if( rBorder.Prim() ) nPos = -128 * (rBorder.GetWidth() - 1); break;
+ case REFMODE_END: if( rBorder.Prim() ) nPos = -256 * (rBorder.GetWidth() - 1); break;
+ case REFMODE_BEGIN: break;
+ }
+ return nPos;
+}
+
+/** Returns the end offset of the single/secondary line across the frame border.
+ @descr See description of lclGetBeg() for an illustration.
+ @return The end offset of the single/secondary line relative to the
+ reference position of the frame border (sub units; 0 for invisible or one
+ pixel wide single frame styles). */
+long lclGetEnd( const Style& rBorder )
+{
+ long nPos = 0;
+ switch( rBorder.GetRefMode() )
+ {
+ case REFMODE_CENTERED: if( rBorder.Prim() ) nPos = 128 * (rBorder.GetWidth() - 1); break;
+ case REFMODE_BEGIN: if( rBorder.Prim() ) nPos = 256 * (rBorder.GetWidth() - 1); break;
+ case REFMODE_END: break;
+ }
+ return nPos;
+}
+
+/** Returns the end offset of the primary line across the frame border.
+ @descr See description of lclGetBeg() for an illustration.
+ @return The end offset of the primary line relative to the reference
+ position of the frame border (sub units; the end of the primary line in a
+ double frame style, otherwise the same as lclGetEnd()). */
+inline long lclGetPrimEnd( const Style& rBorder )
+{ return rBorder.Prim() ? (lclGetBeg( rBorder ) + 256 * (rBorder.Prim() - 1)) : 0; }
+
+/** Returns the start offset of the secondary line across the frame border.
+ @descr See description of lclGetBeg() for an illustration.
+ @return The start offset of the secondary line relative to the reference
+ position of the frame border (sub units; 0 for single/invisible border
+ styles). */
+inline long lclGetSecnBeg( const Style& rBorder )
+{ return rBorder.Secn() ? (lclGetEnd( rBorder ) - 256 * (rBorder.Secn() - 1)) : 0; }
+
+/** Returns the start offset of the distance space across the frame border.
+ @descr See description of lclGetBeg() for an illustration.
+ @return The start offset of the distance space relative to the reference
+ position of the frame border (sub units; 0 for single/invisible border
+ styles). */
+inline long lclGetDistBeg( const Style& rBorder )
+{ return rBorder.Secn() ? (lclGetBeg( rBorder ) + 256 * rBorder.Prim()) : 0; }
+
+/** Returns the end offset of the distance space across the frame border.
+ @descr See description of lclGetBeg() for an illustration.
+ @return The end offset of the distance space relative to the reference
+ position of the frame border (sub units; 0 for single/invisible border
+ styles). */
+inline long lclGetDistEnd( const Style& rBorder )
+{ return rBorder.Secn() ? (lclGetEnd( rBorder ) - 256 * rBorder.Secn()) : 0; }
+
+/** Returns the offset before start of single/primary line across the frame border.
+ @descr See description of lclGetBeg() for an illustration.
+ @return The offset directly before start of single/primary line relative
+ to the reference position of the frame border (sub units; a value one less
+ than lclGetBeg() for visible frame styles, or 0 for invisible frame style). */
+inline long lclGetBeforeBeg( const Style& rBorder )
+{ return rBorder.Prim() ? (lclGetBeg( rBorder ) - 256) : 0; }
+
+/** Returns the offset behind end of single/secondary line across the frame border.
+ @descr See description of lclGetBeg() for an illustration.
+ @return The offset directly behind end of single/secondary line relative
+ to the reference position of the frame border (sub units; a value one
+ greater than lclGetEnd() for visible frame styles, or 0 for invisible frame
+ style). */
+inline long lclGetBehindEnd( const Style& rBorder )
+{ return rBorder.Prim() ? (lclGetEnd( rBorder ) + 256) : 0; }
+
+// ============================================================================
+// Linking functions
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// Linking of single horizontal line ends.
+
+/** Calculates X offsets for the left end of a single horizontal frame border.
+
+ See DrawHorFrameBorder() function for a description of all parameters.
+
+ @param rResult
+ (out-param) The contained values (sub units) specify offsets for the
+ X coordinates of the left line end.
+ */
+void lclLinkLeftEnd_Single(
+ LineEndResult& rResult, const Style& rBorder,
+ const DiagStyle& rLFromTR, const Style& rLFromT, const Style& rLFromL, const Style& rLFromB, const DiagStyle& rLFromBR )
+{
+ // both vertical and diagonal frame borders are double
+ if( rLFromT.Secn() && rLFromB.Secn() && rLFromTR.Secn() && rLFromBR.Secn() )
+ {
+ // take left position of upper and lower secondary start
+ rResult.mnOffs1 = GetBLDiagOffset( lclGetBeg( rBorder ), lclGetSecnBeg( rLFromTR ), rLFromTR.GetAngle() );
+ rResult.mnOffs2 = GetTLDiagOffset( lclGetEnd( rBorder ), lclGetSecnBeg( rLFromBR ), rLFromBR.GetAngle() );
+ }
+ else
+ {
+ // both vertical frame borders are double
+ if( rLFromT.Secn() && rLFromB.Secn() )
+ rResult.mnOffs1 = (!rLFromTR.Secn() && !rLFromBR.Secn() && (rLFromT.GetWidth() == rLFromB.GetWidth())) ?
+ // don't overdraw vertical borders with equal width
+ lclGetBehindEnd( rLFromT ) :
+ // take leftmost start of both secondary lines (#46488#)
+ rResult.mnOffs1 = std::min( lclGetSecnBeg( rLFromT ), lclGetSecnBeg( rLFromB ) );
+
+ // single border with equal width coming from left
+ else if( !rLFromL.Secn() && (rLFromL.Prim() == rBorder.Prim()) )
+ // draw to connection point
+ rResult.mnOffs1 = 0;
+
+ // single border coming from left
+ else if( !rLFromL.Secn() && rLFromL.Prim() )
+ {
+ if( rLFromL.Prim() == rBorder.Prim() )
+ // draw to reference position, if from left has equal width
+ rResult.mnOffs1 = 0;
+ else
+ rResult.mnOffs1 = (rLFromL < rBorder) ?
+ // take leftmost start of both frame borders, if from left is thinner
+ std::min( lclGetBeg( rLFromT ), lclGetBeg( rLFromB ) ) :
+ // do not overdraw vertical, if from left is thicker
+ std::max( lclGetBehindEnd( rLFromT ), lclGetBehindEnd( rLFromB ) );
+ }
+
+ // no border coming from left
+ else if( !rLFromL.Prim() )
+ // don't overdraw vertical borders with equal width
+ rResult.mnOffs1 = (rLFromT.GetWidth() == rLFromB.GetWidth()) ?
+ lclGetBehindEnd( rLFromT ) :
+ std::min( lclGetBeg( rLFromT ), lclGetBeg( rLFromB ) );
+
+ // double frame border coming from left and from top
+ else if( rLFromT.Secn() )
+ // do not overdraw the vertical double frame border
+ rResult.mnOffs1 = lclGetBehindEnd( rLFromT );
+
+ // double frame border coming from left and from bottom
+ else if( rLFromB.Secn() )
+ // do not overdraw the vertical double frame border
+ rResult.mnOffs1 = lclGetBehindEnd( rLFromB );
+
+ // double frame border coming from left, both vertical frame borders are single or off
+ else
+ // draw from leftmost start of both frame borders, if from left is not thicker
+ rResult.mnOffs1 = (rLFromL <= rBorder) ?
+ std::min( lclGetBeg( rLFromT ), lclGetBeg( rLFromB ) ) :
+ std::max( lclGetBehindEnd( rLFromT ), lclGetBehindEnd( rLFromB ) );
+
+ // bottom-left point is equal to top-left point (results in rectangle)
+ rResult.mnOffs2 = rResult.mnOffs1;
+ }
+}
+
+/** Calculates X offsets for the left end of a primary horizontal line.
+
+ See DrawHorFrameBorder() function for a description of all parameters.
+
+ @param rResult
+ (out-param) The contained values (sub units) specify offsets for the
+ X coordinates of the left end of the primary line.
+ */
+void lclLinkLeftEnd_Prim(
+ LineEndResult& rResult, const Style& rBorder,
+ const DiagStyle& rLFromTR, const Style& rLFromT, const Style& rLFromL, const Style& rLFromB, const DiagStyle& /*rLFromBR*/ )
+{
+ // double diagonal frame border coming from top right
+ if( rLFromTR.Secn() )
+ {
+ // draw from where secondary diagonal line meets the own primary
+ rResult.mnOffs1 = GetBLDiagOffset( lclGetBeg( rBorder ), lclGetSecnBeg( rLFromTR ), rLFromTR.GetAngle() );
+ rResult.mnOffs2 = GetBLDiagOffset( lclGetPrimEnd( rBorder ), lclGetSecnBeg( rLFromTR ), rLFromTR.GetAngle() );
+ }
+
+ // no or single diagonal frame border - ignore it
+ else
+ {
+ // double frame border coming from top
+ if( rLFromT.Secn() )
+ // draw from left edge of secondary vertical
+ rResult.mnOffs1 = lclGetSecnBeg( rLFromT );
+
+ // double frame border coming from left (from top is not double)
+ else if( rLFromL.Secn() )
+ // do not overdraw single frame border coming from top
+ rResult.mnOffs1 = (rLFromL.GetWidth() == rBorder.GetWidth()) ?
+ 0 : lclGetBehindEnd( rLFromT );
+
+ // double frame border coming from bottom (from top and from left are not double)
+ else if( rLFromB.Secn() )
+ // draw from left edge of primary vertical from bottom
+ rResult.mnOffs1 = lclGetBeg( rLFromB );
+
+ // no other frame border is double
+ else
+ // do not overdraw vertical frame borders
+ rResult.mnOffs1 = std::max( lclGetBehindEnd( rLFromT ), lclGetBehindEnd( rLFromB ) );
+
+ // bottom-left point is equal to top-left point (results in rectangle)
+ rResult.mnOffs2 = rResult.mnOffs1;
+ }
+}
+
+/** Calculates X offsets for the left end of a secondary horizontal line.
+
+ See DrawHorFrameBorder() function for a description of all parameters.
+
+ @param rResult
+ (out-param) The contained values (sub units) specify offsets for the
+ X coordinates of the left end of the secondary line.
+ */
+void lclLinkLeftEnd_Secn(
+ LineEndResult& rResult, const Style& rBorder,
+ const DiagStyle& rLFromTR, const Style& rLFromT, const Style& rLFromL, const Style& rLFromB, const DiagStyle& rLFromBR )
+{
+ /* Recycle lclLinkLeftEnd_Prim() function with mirrored horizontal borders. */
+ lclLinkLeftEnd_Prim( rResult, rBorder.Mirror(), rLFromBR, rLFromB, rLFromL.Mirror(), rLFromT, rLFromTR );
+ rResult.Swap();
+}
+
+// ----------------------------------------------------------------------------
+// Linking of horizontal frame border ends.
+
+/** Calculates X offsets for the left end of a horizontal frame border.
+
+ This function can be used for single and double frame borders.
+ See DrawHorFrameBorder() function for a description of all parameters.
+
+ @param rResult
+ (out-param) The contained values (sub units) specify offsets for the
+ X coordinates of the left end of the line(s) in the frame border.
+ */
+void lclLinkLeftEnd(
+ BorderEndResult& rResult, const Style& rBorder,
+ const DiagStyle& rLFromTR, const Style& rLFromT, const Style& rLFromL, const Style& rLFromB, const DiagStyle& rLFromBR )
+{
+ if( rBorder.Secn() )
+ {
+ // current frame border is double
+ lclLinkLeftEnd_Prim( rResult.maPrim, rBorder, rLFromTR, rLFromT, rLFromL, rLFromB, rLFromBR );
+ lclLinkLeftEnd_Secn( rResult.maSecn, rBorder, rLFromTR, rLFromT, rLFromL, rLFromB, rLFromBR );
+ }
+ else if( rBorder.Prim() )
+ {
+ // current frame border is single
+ lclLinkLeftEnd_Single( rResult.maPrim, rBorder, rLFromTR, rLFromT, rLFromL, rLFromB, rLFromBR );
+ }
+ else
+ {
+ DBG_ERRORFILE( "lclLinkLeftEnd - called for invisible frame style" );
+ }
+}
+
+/** Calculates X offsets for the right end of a horizontal frame border.
+
+ This function can be used for single and double frame borders.
+ See DrawHorFrameBorder() function for a description of all parameters.
+
+ @param rResult
+ (out-param) The contained values (sub units) specify offsets for the
+ X coordinates of the right end of the line(s) in the frame border.
+ */
+void lclLinkRightEnd(
+ BorderEndResult& rResult, const Style& rBorder,
+ const DiagStyle& rRFromTL, const Style& rRFromT, const Style& rRFromR, const Style& rRFromB, const DiagStyle& rRFromBL )
+{
+ /* Recycle lclLinkLeftEnd() function with mirrored vertical borders. */
+ lclLinkLeftEnd( rResult, rBorder, rRFromTL.Mirror(), rRFromT.Mirror(), rRFromR, rRFromB.Mirror(), rRFromBL.Mirror() );
+ rResult.Negate();
+}
+
+// ----------------------------------------------------------------------------
+// Linking of horizontal and vertical frame borders.
+
+/** Calculates X offsets for all line ends of a horizontal frame border.
+
+ This function can be used for single and double frame borders.
+ See DrawHorFrameBorder() function for a description of all parameters.
+
+ @param rResult
+ (out-param) The contained values (sub units) specify offsets for the
+ X coordinates of both ends of the line(s) in the frame border. To get
+ the actual X coordinates to draw the lines, these offsets have to be
+ added to the X coordinates of the reference points of the frame border
+ (the offsets may be negative).
+ */
+void lclLinkHorFrameBorder(
+ BorderResult& rResult, const Style& rBorder,
+ const DiagStyle& rLFromTR, const Style& rLFromT, const Style& rLFromL, const Style& rLFromB, const DiagStyle& rLFromBR,
+ const DiagStyle& rRFromTL, const Style& rRFromT, const Style& rRFromR, const Style& rRFromB, const DiagStyle& rRFromBL )
+{
+ lclLinkLeftEnd( rResult.maBeg, rBorder, rLFromTR, rLFromT, rLFromL, rLFromB, rLFromBR );
+ lclLinkRightEnd( rResult.maEnd, rBorder, rRFromTL, rRFromT, rRFromR, rRFromB, rRFromBL );
+}
+
+/** Calculates Y offsets for all line ends of a vertical frame border.
+
+ This function can be used for single and double frame borders.
+ See DrawVerFrameBorder() function for a description of all parameters.
+
+ @param rResult
+ (out-param) The contained values (sub units) specify offsets for the
+ Y coordinates of both ends of the line(s) in the frame border. To get
+ the actual Y coordinates to draw the lines, these offsets have to be
+ added to the Y coordinates of the reference points of the frame border
+ (the offsets may be negative).
+ */
+void lclLinkVerFrameBorder(
+ BorderResult& rResult, const Style& rBorder,
+ const DiagStyle& rTFromBL, const Style& rTFromL, const Style& rTFromT, const Style& rTFromR, const DiagStyle& rTFromBR,
+ const DiagStyle& rBFromTL, const Style& rBFromL, const Style& rBFromB, const Style& rBFromR, const DiagStyle& rBFromTR )
+{
+ /* Recycle lclLinkHorFrameBorder() function with correct parameters. The
+ frame border is virtually mirrored at the top-left to bottom-right
+ diagonal. rTFromBR and rBFromTL are mirrored to process their primary
+ and secondary lines correctly. */
+ lclLinkHorFrameBorder( rResult, rBorder,
+ rTFromBL, rTFromL, rTFromT, rTFromR, rTFromBR.Mirror(),
+ rBFromTL.Mirror(), rBFromL, rBFromB, rBFromR, rBFromTR );
+}
+
+// ============================================================================
+
+#if 0
+// Not used anymore, but not deleted for possible future usage.
+
+/** Returns the relative Y offset of the intercept point of 2 diagonal borders.
+
+ @param nTLBROffs
+ Width offset (sub units) across the top-left to bottom-right frame border.
+ @param fTLBRAngle
+ Inner angle between horizontal and top-left to bottom-right frame border.
+ @param nBLTROffs
+ Width offset (sub units) across the bottom-left to top-right frame border.
+ @param fBLTRAngle
+ Inner angle between horizontal and bottom-left to top-right frame border.
+ @return
+ Offset (sub units) relative to the Y position of the centered intercept
+ point of both diagonal frame borders.
+ */
+long lclGetDiagDiagOffset( long nTLBROffs, double fTLBRAngle, long nBLTROffs, double fBLTRAngle )
+{
+ double fASin = sin( fTLBRAngle );
+ double fACos = cos( fTLBRAngle );
+ double fAX = -nTLBROffs * fASin;
+ double fAY = nTLBROffs * fACos;
+ double fRAX = fACos;
+ double fRAY = fASin;
+
+ double fBSin = sin( fBLTRAngle );
+ double fBCos = cos( fBLTRAngle );
+ double fBX = nBLTROffs * fBSin;
+ double fBY = nBLTROffs * fBCos;
+ double fRBX = fBCos;
+ double fRBY = -fBSin;
+
+ double fKA = (fRBX * (fBY - fAY) - fRBY * (fBX - fAX)) / (fRBX * fRAY - fRAX * fRBY);
+ return lclD2L( fAY + fKA * fRAY );
+}
+#endif
+
+// ----------------------------------------------------------------------------
+// Linking of diagonal frame borders.
+
+/** Calculates clipping offsets for a top-left to bottom-right frame border.
+
+ This function can be used for single and double frame borders.
+ See DrawDiagFrameBorders() function for a description of all parameters.
+
+ @param rResult
+ (out-param) The contained values (sub units) specify offsets for all
+ borders of the reference rectangle containing the diagonal frame border.
+ */
+void lclLinkTLBRFrameBorder(
+ DiagBorderResult& rResult, const Style& rBorder,
+ const Style& rTLFromB, const Style& rTLFromR, const Style& rBRFromT, const Style& rBRFromL )
+{
+ bool bIsDbl = rBorder.Secn() != 0;
+
+ rResult.maPrim.mnLClip = lclGetBehindEnd( rTLFromB );
+ rResult.maPrim.mnRClip = (bIsDbl && rBRFromT.Secn()) ? lclGetEnd( rBRFromT ) : lclGetBeforeBeg( rBRFromT );
+ rResult.maPrim.mnTClip = (bIsDbl && rTLFromR.Secn()) ? lclGetBeg( rTLFromR ) : lclGetBehindEnd( rTLFromR );
+ rResult.maPrim.mnBClip = lclGetBeforeBeg( rBRFromL );
+
+ if( bIsDbl )
+ {
+ rResult.maSecn.mnLClip = rTLFromB.Secn() ? lclGetBeg( rTLFromB ) : lclGetBehindEnd( rTLFromB );
+ rResult.maSecn.mnRClip = lclGetBeforeBeg( rBRFromT );
+ rResult.maSecn.mnTClip = lclGetBehindEnd( rTLFromR );
+ rResult.maSecn.mnBClip = rBRFromL.Secn() ? lclGetEnd( rBRFromL ) : lclGetBeforeBeg( rBRFromL );
+ }
+}
+
+/** Calculates clipping offsets for a bottom-left to top-right frame border.
+
+ This function can be used for single and double frame borders.
+ See DrawDiagFrameBorders() function for a description of all parameters.
+
+ @param rResult
+ (out-param) The contained values (sub units) specify offsets for all
+ borders of the reference rectangle containing the diagonal frame border.
+ */
+void lclLinkBLTRFrameBorder(
+ DiagBorderResult& rResult, const Style& rBorder,
+ const Style& rBLFromT, const Style& rBLFromR, const Style& rTRFromB, const Style& rTRFromL )
+{
+ bool bIsDbl = rBorder.Secn() != 0;
+
+ rResult.maPrim.mnLClip = lclGetBehindEnd( rBLFromT );
+ rResult.maPrim.mnRClip = (bIsDbl && rTRFromB.Secn()) ? lclGetEnd( rTRFromB ) : lclGetBeforeBeg( rTRFromB );
+ rResult.maPrim.mnTClip = lclGetBehindEnd( rTRFromL );
+ rResult.maPrim.mnBClip = (bIsDbl && rBLFromR.Secn()) ? lclGetEnd( rBLFromR ) : lclGetBeforeBeg( rBLFromR );
+
+ if( bIsDbl )
+ {
+ rResult.maSecn.mnLClip = rBLFromT.Secn() ? lclGetBeg( rBLFromT ) : lclGetBehindEnd( rBLFromT );
+ rResult.maSecn.mnRClip = lclGetBeforeBeg( rTRFromB );
+ rResult.maSecn.mnTClip = rTRFromL.Secn() ? lclGetBeg( rTRFromL ) : lclGetBehindEnd( rTRFromL );
+ rResult.maSecn.mnBClip = lclGetBeforeBeg( rBLFromR );
+ }
+}
+
+/** Calculates clipping offsets for both diagonal frame borders.
+
+ This function can be used for single and double frame borders.
+ See DrawDiagFrameBorders() function for a description of all parameters.
+
+ @param rResult
+ (out-param) The contained values (sub units) specify offsets for all
+ borders of the reference rectangle containing the diagonal frame
+ borders.
+ */
+void lclLinkDiagFrameBorders(
+ DiagBordersResult& rResult, const Style& rTLBR, const Style& rBLTR,
+ const Style& rTLFromB, const Style& rTLFromR, const Style& rBRFromT, const Style& rBRFromL,
+ const Style& rBLFromT, const Style& rBLFromR, const Style& rTRFromB, const Style& rTRFromL )
+{
+ lclLinkTLBRFrameBorder( rResult.maTLBR, rTLBR, rTLFromB, rTLFromR, rBRFromT, rBRFromL );
+ lclLinkBLTRFrameBorder( rResult.maBLTR, rBLTR, rBLFromT, rBLFromR, rTRFromB, rTRFromL );
+}
+
+// ============================================================================
+// Drawing functions
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// Simple helper functions
+
+/** Converts sub units to OutputDevice map units. */
+inline long lclToMapUnit( long nSubUnits )
+{
+ return ((nSubUnits < 0) ? (nSubUnits - 127) : (nSubUnits + 128)) / 256;
+}
+
+/** Converts a point in sub units to an OutputDevice point. */
+inline Point lclToMapUnit( long nSubXPos, long nSubYPos )
+{
+ return Point( lclToMapUnit( nSubXPos ), lclToMapUnit( nSubYPos ) );
+}
+
+/** Returns a polygon constructed from a vector of points. */
+inline Polygon lclCreatePolygon( const PointVec& rPoints )
+{
+ return Polygon( static_cast< sal_uInt16 >( rPoints.size() ), &rPoints[ 0 ] );
+}
+
+/** Returns a polygon constructed from the four passed points. */
+Polygon lclCreatePolygon( const Point& rP1, const Point& rP2, const Point& rP3, const Point& rP4 )
+{
+ PointVec aPoints;
+ aPoints.reserve( 4 );
+ aPoints.push_back( rP1 );
+ aPoints.push_back( rP2 );
+ aPoints.push_back( rP3 );
+ aPoints.push_back( rP4 );
+ return lclCreatePolygon( aPoints );
+}
+
+/** Returns a polygon constructed from the five passed points. */
+Polygon lclCreatePolygon( const Point& rP1, const Point& rP2, const Point& rP3, const Point& rP4, const Point& rP5 )
+{
+ PointVec aPoints;
+ aPoints.reserve( 5 );
+ aPoints.push_back( rP1 );
+ aPoints.push_back( rP2 );
+ aPoints.push_back( rP3 );
+ aPoints.push_back( rP4 );
+ aPoints.push_back( rP5 );
+ return lclCreatePolygon( aPoints );
+}
+
+/** Returns a polygon constructed from the two passed line positions. */
+inline Polygon lclCreatePolygon( const LinePoints& rPoints1, const LinePoints& rPoints2 )
+{
+ return lclCreatePolygon( rPoints1.maBeg, rPoints1.maEnd, rPoints2.maEnd, rPoints2.maBeg );
+}
+
+/** Sets the color of the passed frame style to the output device.
+
+ Sets the line color and fill color in the output device.
+
+ @param rDev
+ The output device the color has to be set to. The old colors are pushed
+ onto the device's stack and can be restored with a call to
+ OutputDevice::Pop(). Please take care about the correct calling order
+ of Pop() if this function is used with other functions pushing
+ something onto the stack.
+ @param rStyle
+ The border style that contains the line color to be set to the device.
+ */
+void lclSetColorToOutDev( OutputDevice& rDev, const Style& rStyle, const Color* pForceColor )
+{
+ rDev.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
+ rDev.SetLineColor( pForceColor ? *pForceColor : rStyle.GetColor() );
+ rDev.SetFillColor( pForceColor ? *pForceColor : rStyle.GetColor() );
+}
+
+// ----------------------------------------------------------------------------
+// Generic drawing functions.
+
+/** Draws a thin (1 pixel wide) line, optionally dotted, into the passed output device. */
+void lclDrawThinLine( OutputDevice& rDev, const Point& rBeg, const Point& rEnd, bool bDotted )
+{
+#if SVX_FRAME_USE_LINEINFO
+ if( bDotted && (rBeg != rEnd) )
+ {
+// using LineInfo for dotted lines looks ugly and does not work well for diagonal lines
+ LineInfo aLineInfo( LINE_DASH, 1 );
+ aLineInfo.SetDotCount( 1 );
+ aLineInfo.SetDotLen( 1 );
+ aLineInfo.SetDistance( 3 );
+ rDev.DrawLine( rBeg, rEnd, aLineInfo );
+ }
+#else
+ Point aBeg( rDev.LogicToPixel( rBeg ) );
+ Point aEnd( rDev.LogicToPixel( rEnd ) );
+ if( bDotted && (aBeg != aEnd) )
+ {
+ bool bHor = Abs( aEnd.X() - aBeg.X() ) > Abs( aEnd.Y() - aBeg.Y() );
+ const Point& rBegPos( bHor ? ((aBeg.X() < aEnd.X()) ? aBeg : aEnd) : ((aBeg.Y() < aEnd.Y()) ? aBeg : aEnd ) );
+ const Point& rEndPos( (rBegPos == aBeg) ? aEnd : aBeg );
+
+ long nAlongBeg = bHor ? rBegPos.X() : rBegPos.Y();
+ long nAcrssBeg = bHor ? rBegPos.Y() : rBegPos.X();
+ long nAlongSize = (bHor ? rEndPos.X() : rEndPos.Y()) - nAlongBeg;
+ long nAcrssSize = (bHor ? rEndPos.Y() : rEndPos.X()) - nAcrssBeg;
+ double fGradient = static_cast< double >( nAcrssSize ) / nAlongSize;
+
+ PointVec aPoints;
+ aPoints.reserve( (nAlongSize + 1) / 2 );
+ for( long nAlongIdx = 0; nAlongIdx <= nAlongSize; nAlongIdx += 2 )
+ {
+ long nAl = nAlongBeg + nAlongIdx;
+ long nAc = nAcrssBeg + lclD2L( fGradient * nAlongIdx );
+ aPoints.push_back( Point( bHor ? nAl : nAc, bHor ? nAc : nAl ) );
+ }
+
+ rDev.Push( PUSH_MAPMODE );
+ rDev.SetMapMode( MAP_PIXEL );
+ rDev.DrawPixel( lclCreatePolygon( aPoints ) );
+ rDev.Pop(); // map mode
+ }
+#endif
+ else
+ rDev.DrawLine( rBeg, rEnd );
+}
+
+/** Draws a thin (1 pixel wide) line, optionally dotted, into the passed output device. */
+inline void lclDrawThinLine( OutputDevice& rDev, const LinePoints& rPoints, bool bDotted )
+{
+ lclDrawThinLine( rDev, rPoints.maBeg, rPoints.maEnd, bDotted );
+}
+
+/** Draws a polygon with four points into the passed output device. */
+inline void lclDrawPolygon( OutputDevice& rDev, const Point& rP1, const Point& rP2, const Point& rP3, const Point& rP4 )
+{
+ rDev.DrawPolygon( lclCreatePolygon( rP1, rP2, rP3, rP4 ) );
+}
+
+/** Draws a polygon specified by two borders into the passed output device. */
+inline void lclDrawPolygon( OutputDevice& rDev, const LinePoints& rPoints1, const LinePoints& rPoints2 )
+{
+ rDev.DrawPolygon( lclCreatePolygon( rPoints1, rPoints2 ) );
+}
+
+// ============================================================================
+// Drawing of horizontal frame borders.
+
+/** Draws a horizontal thin or thick line into the passed output device.
+
+ The X coordinates of the edges of the line are adjusted according to the
+ passed LineEndResult structs. A one pixel wide line can be drawn dotted.
+ */
+void lclDrawHorLine(
+ OutputDevice& rDev,
+ const Point& rLPos, const LineEndResult& rLRes,
+ const Point& rRPos, const LineEndResult& rRRes,
+ long nTOffs, long nBOffs, bool bDotted )
+{
+ LinePoints aTPoints( rLPos + lclToMapUnit( rLRes.mnOffs1, nTOffs ), rRPos + lclToMapUnit( rRRes.mnOffs1, nTOffs ) );
+ if( nTOffs == nBOffs )
+ lclDrawThinLine( rDev, aTPoints, bDotted );
+ else
+ {
+ LinePoints aBPoints( rLPos + lclToMapUnit( rLRes.mnOffs2, nBOffs ), rRPos + lclToMapUnit( rRRes.mnOffs2, nBOffs ) );
+ lclDrawPolygon( rDev, aTPoints, aBPoints );
+ }
+}
+
+/** Draws a horizontal frame border into the passed output device.
+
+ @param rLPos
+ The top-left or bottom-left reference point of the diagonal frame border.
+ @param rRPos
+ The top-right or bottom-right reference point of the diagonal frame border.
+ @param rBorder
+ The frame style used to draw the border.
+ @param rResult
+ The X coordinates of the edges of all lines of the frame border are
+ adjusted according to the offsets contained here.
+ */
+void lclDrawHorFrameBorder(
+ OutputDevice& rDev, const Point& rLPos, const Point& rRPos,
+ const Style& rBorder, const BorderResult& rResult, const Color* pForceColor )
+{
+ DBG_ASSERT( rBorder.Prim(), "svx::frame::lclDrawHorFrameBorder - line not visible" );
+ DBG_ASSERT( rLPos.X() <= rRPos.X(), "svx::frame::lclDrawHorFrameBorder - wrong order of line ends" );
+ DBG_ASSERT( rLPos.Y() == rRPos.Y(), "svx::frame::lclDrawHorFrameBorder - line not horizontal" );
+ if( rLPos.X() <= rRPos.X() )
+ {
+ lclSetColorToOutDev( rDev, rBorder, pForceColor );
+ lclDrawHorLine( rDev, rLPos, rResult.maBeg.maPrim, rRPos, rResult.maEnd.maPrim,
+ lclGetBeg( rBorder ), lclGetPrimEnd( rBorder ), rBorder.Dotted() );
+ if( rBorder.Secn() )
+ lclDrawHorLine( rDev, rLPos, rResult.maBeg.maSecn, rRPos, rResult.maEnd.maSecn,
+ lclGetSecnBeg( rBorder ), lclGetEnd( rBorder ), rBorder.Dotted() );
+ rDev.Pop(); // colors
+ }
+}
+
+// ----------------------------------------------------------------------------
+// Drawing of vertical frame borders.
+
+/** Draws a vertical thin or thick line into the passed output device.
+
+ The Y coordinates of the edges of the line are adjusted according to the
+ passed LineEndResult structs. A one pixel wide line can be drawn dotted.
+ */
+void lclDrawVerLine(
+ OutputDevice& rDev,
+ const Point& rTPos, const LineEndResult& rTRes,
+ const Point& rBPos, const LineEndResult& rBRes,
+ long nLOffs, long nROffs, bool bDotted )
+{
+ LinePoints aLPoints( rTPos + lclToMapUnit( nLOffs, rTRes.mnOffs1 ), rBPos + lclToMapUnit( nLOffs, rBRes.mnOffs1 ) );
+ if( nLOffs == nROffs )
+ lclDrawThinLine( rDev, aLPoints, bDotted );
+ else
+ {
+ LinePoints aRPoints( rTPos + lclToMapUnit( nROffs, rTRes.mnOffs2 ), rBPos + lclToMapUnit( nROffs, rBRes.mnOffs2 ) );
+ lclDrawPolygon( rDev, aLPoints, aRPoints );
+ }
+}
+
+/** Draws a vertical frame border into the passed output device.
+
+ @param rTPos
+ The top-left or top-right reference point of the diagonal frame border.
+ @param rBPos
+ The bottom-left or bottom-right reference point of the diagonal frame border.
+ @param rBorder
+ The frame style used to draw the border.
+ @param rResult
+ The Y coordinates of the edges of all lines of the frame border are
+ adjusted according to the offsets contained here.
+ */
+void lclDrawVerFrameBorder(
+ OutputDevice& rDev, const Point& rTPos, const Point& rBPos,
+ const Style& rBorder, const BorderResult& rResult, const Color* pForceColor )
+{
+ DBG_ASSERT( rBorder.Prim(), "svx::frame::lclDrawVerFrameBorder - line not visible" );
+ DBG_ASSERT( rTPos.Y() <= rBPos.Y(), "svx::frame::lclDrawVerFrameBorder - wrong order of line ends" );
+ DBG_ASSERT( rTPos.X() == rBPos.X(), "svx::frame::lclDrawVerFrameBorder - line not vertical" );
+ if( rTPos.Y() <= rBPos.Y() )
+ {
+ lclSetColorToOutDev( rDev, rBorder, pForceColor );
+ lclDrawVerLine( rDev, rTPos, rResult.maBeg.maPrim, rBPos, rResult.maEnd.maPrim,
+ lclGetBeg( rBorder ), lclGetPrimEnd( rBorder ), rBorder.Dotted() );
+ if( rBorder.Secn() )
+ lclDrawVerLine( rDev, rTPos, rResult.maBeg.maSecn, rBPos, rResult.maEnd.maSecn,
+ lclGetSecnBeg( rBorder ), lclGetEnd( rBorder ), rBorder.Dotted() );
+ rDev.Pop(); // colors
+ }
+}
+
+// ============================================================================
+// Drawing of diagonal frame borders, incudes clipping functions.
+
+/** Returns the drawing coordinates for a diagonal thin line.
+
+ This function can be used for top-left to bottom-right and for bottom-left
+ to top-right lines.
+
+ @param rRect
+ The reference rectangle of the diagonal frame border.
+ @param bTLBR
+ true = top-left to bottom-right; false = bottom-left to top-right.
+ @param nDiagOffs
+ Width offset (sub units) across the diagonal frame border.
+ @return
+ A struct containg start and end position of the diagonal line.
+ */
+LinePoints lclGetDiagLineEnds( const Rectangle& rRect, bool bTLBR, long nDiagOffs )
+{
+ LinePoints aPoints( rRect, bTLBR );
+ bool bVert = rRect.GetWidth() < rRect.GetHeight();
+ double fAngle = bVert ? GetVerDiagAngle( rRect ) : GetHorDiagAngle( rRect );
+ // vertical top-left to bottom-right borders are handled mirrored
+ if( bVert && bTLBR )
+ nDiagOffs = -nDiagOffs;
+ long nTOffs = bTLBR ? GetTLDiagOffset( 0, nDiagOffs, fAngle ) : GetTRDiagOffset( 0, nDiagOffs, fAngle );
+ long nBOffs = bTLBR ? GetBRDiagOffset( 0, nDiagOffs, fAngle ) : GetBLDiagOffset( 0, nDiagOffs, fAngle );
+ // vertical bottom-left to top-right borders are handled with exchanged end points
+ if( bVert && !bTLBR )
+ std::swap( nTOffs, nBOffs );
+ (bVert ? aPoints.maBeg.Y() : aPoints.maBeg.X()) += lclToMapUnit( nTOffs );
+ (bVert ? aPoints.maEnd.Y() : aPoints.maEnd.X()) += lclToMapUnit( nBOffs );
+ return aPoints;
+}
+
+// ----------------------------------------------------------------------------
+// Clipping functions for diagonal frame borders.
+
+/** Limits the clipping region to the inner area of a rectange.
+
+ Takes the values from the passed DiagLineResult struct into account. They
+ may specify to not clip one or more borders of a rectangle.
+
+ @param rDev
+ The output device with the clipping region to be modified. The old
+ clipping region is pushed onto the device's stack and can be restored
+ with a call to OutputDevice::Pop(). Please take care about the correct
+ calling order of Pop() if this function is used with other functions
+ pushing something onto the stack.
+ @param rRect
+ The reference rectangle of the diagonal frame borders.
+ @param rResult
+ The result struct containing modifies for each border of the reference
+ rectangle.
+ */
+void lclPushDiagClipRect( OutputDevice& rDev, const Rectangle& rRect, const DiagLineResult& rResult )
+{
+ // PixelToLogic() regards internal offset of the output device
+ Rectangle aClipRect( rRect );
+ aClipRect.Left() += lclToMapUnit( rResult.mnLClip );
+ aClipRect.Top() += lclToMapUnit( rResult.mnTClip );
+ aClipRect.Right() += lclToMapUnit( rResult.mnRClip );
+ aClipRect.Bottom() += lclToMapUnit( rResult.mnBClip );
+ // output device would adjust the rectangle -> invalidate it before
+ if( (aClipRect.GetWidth() < 1) ||(aClipRect.GetHeight() < 1) )
+ aClipRect.SetEmpty();
+
+ rDev.Push( PUSH_CLIPREGION );
+ rDev.IntersectClipRegion( aClipRect );
+}
+
+/** Excludes inner area of a crossing double frame border from clipping region.
+
+ This function is used to modify the clipping region so that it excludes the
+ inner free area of a double diagonal frame border. This makes it possible
+ to draw a diagonal frame border in one step without taking care of the
+ crossing double frame border.
+
+ @param rDev
+ The output device with the clipping region to be modified. The old
+ clipping region is pushed onto the device's stack and can be restored
+ with a call to OutputDevice::Pop(). Please take care about the correct
+ calling order of Pop() if this function is used with other functions
+ pushing something onto the stack.
+ @param rRect
+ The reference rectangle of the diagonal frame borders.
+ @param bTLBR
+ The orientation of the processed frame border (not the orientation of
+ the crossing frame border).
+ @param bCrossStyle
+ The style of the crossing frame border. Must be a double frame style.
+ */
+void lclPushCrossingClipRegion( OutputDevice& rDev, const Rectangle& rRect, bool bTLBR, const Style& rCrossStyle )
+{
+ DBG_ASSERT( rCrossStyle.Secn(), "lclGetCrossingClipRegion - use only for double styles" );
+ LinePoints aLPoints( lclGetDiagLineEnds( rRect, !bTLBR, lclGetPrimEnd( rCrossStyle ) ) );
+ LinePoints aRPoints( lclGetDiagLineEnds( rRect, !bTLBR, lclGetSecnBeg( rCrossStyle ) ) );
+
+ Region aClipReg;
+ if( bTLBR )
+ {
+ aClipReg = lclCreatePolygon(
+ aLPoints.maBeg, aLPoints.maEnd, rRect.BottomRight(), rRect.BottomLeft(), rRect.TopLeft() );
+ aClipReg.Union( lclCreatePolygon(
+ aRPoints.maBeg, aRPoints.maEnd, rRect.BottomRight(), rRect.TopRight(), rRect.TopLeft() ) );
+ }
+ else
+ {
+ aClipReg = lclCreatePolygon(
+ aLPoints.maBeg, aLPoints.maEnd, rRect.BottomLeft(), rRect.TopLeft(), rRect.TopRight() );
+ aClipReg.Union( lclCreatePolygon(
+ aRPoints.maBeg, aRPoints.maEnd, rRect.BottomLeft(), rRect.BottomRight(), rRect.TopRight() ) );
+ }
+
+ rDev.Push( PUSH_CLIPREGION );
+ rDev.IntersectClipRegion( aClipReg );
+}
+
+// ----------------------------------------------------------------------------
+// Drawing functions for diagonal frame borders.
+
+/** Draws a diagonal thin or thick line into the passed output device.
+
+ The clipping region of the output device is modified according to the
+ passed DiagLineResult struct. A one pixel wide line can be drawn dotted.
+ */
+void lclDrawDiagLine(
+ OutputDevice& rDev, const Rectangle& rRect, bool bTLBR,
+ const DiagLineResult& rResult, long nDiagOffs1, long nDiagOffs2, bool bDotted )
+{
+ lclPushDiagClipRect( rDev, rRect, rResult );
+ LinePoints aLPoints( lclGetDiagLineEnds( rRect, bTLBR, nDiagOffs1 ) );
+ if( nDiagOffs1 == nDiagOffs2 )
+ lclDrawThinLine( rDev, aLPoints, bDotted );
+ else
+ lclDrawPolygon( rDev, aLPoints, lclGetDiagLineEnds( rRect, bTLBR, nDiagOffs2 ) );
+ rDev.Pop(); // clipping region
+}
+
+/** Draws a diagonal frame border into the passed output device.
+
+ The lines of the frame border are drawn interrupted, if the style of the
+ crossing frame border is double.
+
+ @param rRect
+ The reference rectangle of the diagonal frame border.
+ @param bTLBR
+ The orientation of the diagonal frame border.
+ @param rBorder
+ The frame style used to draw the border.
+ @param rResult
+ Offsets (sub units) to modify the clipping region of the output device.
+ @param rCrossStyle
+ Style of the crossing diagonal frame border.
+ */
+void lclDrawDiagFrameBorder(
+ OutputDevice& rDev, const Rectangle& rRect, bool bTLBR,
+ const Style& rBorder, const DiagBorderResult& rResult, const Style& rCrossStyle,
+ const Color* pForceColor, bool bDiagDblClip )
+{
+ DBG_ASSERT( rBorder.Prim(), "svx::frame::lclDrawDiagFrameBorder - line not visible" );
+
+ bool bClip = bDiagDblClip && rCrossStyle.Secn();
+ if( bClip )
+ lclPushCrossingClipRegion( rDev, rRect, bTLBR, rCrossStyle );
+
+ lclSetColorToOutDev( rDev, rBorder, pForceColor );
+ lclDrawDiagLine( rDev, rRect, bTLBR, rResult.maPrim, lclGetBeg( rBorder ), lclGetPrimEnd( rBorder ), rBorder.Dotted() );
+ if( rBorder.Secn() )
+ lclDrawDiagLine( rDev, rRect, bTLBR, rResult.maSecn, lclGetSecnBeg( rBorder ), lclGetEnd( rBorder ), rBorder.Dotted() );
+ rDev.Pop(); // colors
+
+ if( bClip )
+ rDev.Pop(); // clipping region
+}
+
+/** Draws both diagonal frame borders into the passed output device.
+
+ The lines of each frame border is drawn interrupted, if the style of the
+ other crossing frame border is double.
+
+ @param rRect
+ The reference rectangle of the diagonal frame borders.
+ @param rTLBR
+ The frame style of the top-left to bottom-right frame border.
+ @param rBLTR
+ The frame style of the bottom-left to top-right frame border.
+ @param rResult
+ Offsets (sub units) to modify the clipping region of the output device.
+ */
+void lclDrawDiagFrameBorders(
+ OutputDevice& rDev, const Rectangle& rRect,
+ const Style& rTLBR, const Style& rBLTR, const DiagBordersResult& rResult,
+ const Color* pForceColor, bool bDiagDblClip )
+{
+ DBG_ASSERT( (rRect.GetWidth() > 1) && (rRect.GetHeight() > 1), "svx::frame::lclDrawDiagFrameBorders - rectangle too small" );
+ if( (rRect.GetWidth() > 1) && (rRect.GetHeight() > 1) )
+ {
+ bool bDrawTLBR = rTLBR.Prim() != 0;
+ bool bDrawBLTR = rBLTR.Prim() != 0;
+ bool bFirstDrawBLTR = rTLBR.Secn() != 0;
+
+ if( bDrawBLTR && bFirstDrawBLTR )
+ lclDrawDiagFrameBorder( rDev, rRect, false, rBLTR, rResult.maBLTR, rTLBR, pForceColor, bDiagDblClip );
+ if( bDrawTLBR )
+ lclDrawDiagFrameBorder( rDev, rRect, true, rTLBR, rResult.maTLBR, rBLTR, pForceColor, bDiagDblClip );
+ if( bDrawBLTR && !bFirstDrawBLTR )
+ lclDrawDiagFrameBorder( rDev, rRect, false, rBLTR, rResult.maBLTR, rTLBR, pForceColor, bDiagDblClip );
+ }
+}
+
+// ============================================================================
+
+} // namespace
+
+// ============================================================================
+// Classes
+// ============================================================================
+
+#define SCALEVALUE( value ) lclScaleValue( value, fScale, nMaxWidth )
+
+void Style::Clear()
+{
+ Set( Color(), 0, 0, 0 );
+}
+
+void Style::Set( sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS )
+{
+ /* nP nD nS -> mnPrim mnDist mnSecn
+ --------------------------------------
+ any any 0 nP 0 0
+ 0 any >0 nS 0 0
+ >0 0 >0 nP 0 0
+ >0 >0 >0 nP nD nS
+ */
+ mnPrim = nP ? nP : nS;
+ mnDist = (nP && nS) ? nD : 0;
+ mnSecn = (nP && nD) ? nS : 0;
+}
+
+void Style::Set( const Color& rColor, sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS )
+{
+ maColor = rColor;
+ Set( nP, nD, nS );
+}
+
+void Style::Set( const SvxBorderLine& rBorder, double fScale, sal_uInt16 nMaxWidth, bool bUseDots )
+{
+ maColor = rBorder.GetColor();
+
+ sal_uInt16 nPrim = rBorder.GetOutWidth();
+ sal_uInt16 nDist = rBorder.GetDistance();
+ sal_uInt16 nSecn = rBorder.GetInWidth();
+
+ if( !nSecn ) // no or single frame border
+ {
+ Set( SCALEVALUE( nPrim ), 0, 0 );
+ mbDotted = bUseDots && (0 < nPrim) && (nPrim < 10);
+ }
+ else
+ {
+ Set( SCALEVALUE( nPrim ), SCALEVALUE( nDist ), SCALEVALUE( nSecn ) );
+ mbDotted = false;
+ // Enlarge the style if distance is too small due to rounding losses.
+ sal_uInt16 nPixWidth = SCALEVALUE( nPrim + nDist + nSecn );
+ if( nPixWidth > GetWidth() )
+ mnDist = nPixWidth - mnPrim - mnSecn;
+ // Shrink the style if it is too thick for the control.
+ while( GetWidth() > nMaxWidth )
+ {
+ // First decrease space between lines.
+ if( mnDist )
+ --mnDist;
+ // Still too thick? Decrease the line widths.
+ if( GetWidth() > nMaxWidth )
+ {
+ if( mnPrim && (mnPrim == mnSecn) )
+ {
+ // Both lines equal - decrease both to keep symmetry.
+ --mnPrim;
+ --mnSecn;
+ }
+ else
+ {
+ // Decrease each line for itself
+ if( mnPrim )
+ --mnPrim;
+ if( (GetWidth() > nMaxWidth) && mnSecn )
+ --mnSecn;
+ }
+ }
+ }
+ }
+}
+
+void Style::Set( const SvxBorderLine* pBorder, double fScale, sal_uInt16 nMaxWidth, bool bUseDots )
+{
+ if( pBorder )
+ Set( *pBorder, fScale, nMaxWidth, bUseDots );
+ else
+ {
+ Clear();
+ mbDotted = false;
+ }
+}
+
+Style& Style::ScaleSelf( double fScale, sal_uInt16 nMaxWidth )
+{
+ Set( SCALEVALUE( mnPrim ), SCALEVALUE( mnDist ), SCALEVALUE( mnSecn ) );
+ return *this;
+}
+
+Style Style::Scale( double fScale, sal_uInt16 nMaxWidth ) const
+{
+ return Style( *this ).ScaleSelf( fScale, nMaxWidth );
+}
+
+Style& Style::MirrorSelf()
+{
+ if( mnSecn )
+ std::swap( mnPrim, mnSecn );
+ if( meRefMode != REFMODE_CENTERED )
+ meRefMode = (meRefMode == REFMODE_BEGIN) ? REFMODE_END : REFMODE_BEGIN;
+ return *this;
+}
+
+Style Style::Mirror() const
+{
+ return Style( *this ).MirrorSelf();
+}
+
+bool operator==( const Style& rL, const Style& rR )
+{
+ return (rL.Prim() == rR.Prim()) && (rL.Dist() == rR.Dist()) && (rL.Secn() == rR.Secn()) &&
+ (rL.GetColor() == rR.GetColor()) && (rL.GetRefMode() == rR.GetRefMode()) && (rL.Dotted() == rR.Dotted());
+}
+
+bool operator<( const Style& rL, const Style& rR )
+{
+ // different total widths -> rL<rR, if rL is thinner
+ sal_uInt16 nLW = rL.GetWidth();
+ sal_uInt16 nRW = rR.GetWidth();
+ if( nLW != nRW ) return nLW < nRW;
+
+ // one line double, the other single -> rL<rR, if rL is single
+ if( (rL.Secn() == 0) != (rR.Secn() == 0) ) return rL.Secn() == 0;
+
+ // both lines double with different distances -> rL<rR, if distance of rL greater
+ if( (rL.Secn() && rR.Secn()) && (rL.Dist() != rR.Dist()) ) return rL.Dist() > rR.Dist();
+
+ // both lines single and 1 unit thick, only one is dotted -> rL<rR, if rL is dotted
+ if( (nLW == 1) && (rL.Dotted() != rR.Dotted()) ) return rL.Dotted();
+
+ // seem to be equal
+ return false;
+}
+
+#undef SCALEVALUE
+
+// ============================================================================
+// Various helper functions
+// ============================================================================
+
+double GetHorDiagAngle( long nWidth, long nHeight )
+{
+ return atan2( static_cast< double >( Abs( nHeight ) ), static_cast< double >( Abs( nWidth ) ) );
+}
+
+// ============================================================================
+
+long GetTLDiagOffset( long nVerOffs, long nDiagOffs, double fAngle )
+{
+ return lclD2L( nVerOffs / tan( fAngle ) + nDiagOffs / sin( fAngle ) );
+}
+
+long GetBLDiagOffset( long nVerOffs, long nDiagOffs, double fAngle )
+{
+ return lclD2L( -nVerOffs / tan( fAngle ) + nDiagOffs / sin( fAngle ) );
+}
+
+long GetBRDiagOffset( long nVerOffs, long nDiagOffs, double fAngle )
+{
+ return -lclD2L( -nVerOffs / tan( fAngle ) - nDiagOffs / sin( fAngle ) );
+}
+
+long GetTRDiagOffset( long nVerOffs, long nDiagOffs, double fAngle )
+{
+ return -lclD2L( nVerOffs / tan( fAngle ) - nDiagOffs / sin( fAngle ) );
+}
+
+// ============================================================================
+
+bool CheckFrameBorderConnectable( const Style& rLBorder, const Style& rRBorder,
+ const Style& rTFromTL, const Style& rTFromT, const Style& rTFromTR,
+ const Style& rBFromBL, const Style& rBFromB, const Style& rBFromBR )
+{
+ return // returns 1 AND (2a OR 2b)
+ // 1) only, if both frame borders are equal
+ (rLBorder == rRBorder)
+ &&
+ (
+ (
+ // 2a) if the borders are not double, at least one of the vertical must not be double
+ !rLBorder.Secn() && (!rTFromT.Secn() || !rBFromB.Secn())
+ )
+ ||
+ (
+ // 2b) if the borders are double, all other borders must not be double
+ rLBorder.Secn() &&
+ !rTFromTL.Secn() && !rTFromT.Secn() && !rTFromTR.Secn() &&
+ !rBFromBL.Secn() && !rBFromB.Secn() && !rBFromBR.Secn()
+ )
+ );
+}
+
+// ============================================================================
+// Drawing functions
+// ============================================================================
+
+void DrawHorFrameBorder( OutputDevice& rDev,
+ const Point& rLPos, const Point& rRPos, const Style& rBorder,
+ const DiagStyle& rLFromTR, const Style& rLFromT, const Style& rLFromL, const Style& rLFromB, const DiagStyle& rLFromBR,
+ const DiagStyle& rRFromTL, const Style& rRFromT, const Style& rRFromR, const Style& rRFromB, const DiagStyle& rRFromBL,
+ const Color* pForceColor )
+{
+ if( rBorder.Prim() )
+ {
+ BorderResult aResult;
+ lclLinkHorFrameBorder( aResult, rBorder,
+ rLFromTR, rLFromT, rLFromL, rLFromB, rLFromBR,
+ rRFromTL, rRFromT, rRFromR, rRFromB, rRFromBL );
+ lclDrawHorFrameBorder( rDev, rLPos, rRPos, rBorder, aResult, pForceColor );
+ }
+}
+
+void DrawHorFrameBorder( OutputDevice& rDev,
+ const Point& rLPos, const Point& rRPos, const Style& rBorder,
+ const Style& rLFromT, const Style& rLFromL, const Style& rLFromB,
+ const Style& rRFromT, const Style& rRFromR, const Style& rRFromB,
+ const Color* pForceColor )
+{
+ /* Recycle complex version of the DrawHorFrameBorder() function with empty diagonals. */
+ const DiagStyle aNoStyle;
+ DrawHorFrameBorder(
+ rDev, rLPos, rRPos, rBorder,
+ aNoStyle, rLFromT, rLFromL, rLFromB, aNoStyle,
+ aNoStyle, rRFromT, rRFromR, rRFromB, aNoStyle,
+ pForceColor );
+}
+
+void DrawHorFrameBorder( OutputDevice& rDev,
+ const Point& rLPos, const Point& rRPos, const Style& rBorder, const Color* pForceColor )
+{
+ if( rBorder.Prim() )
+ lclDrawHorFrameBorder( rDev, rLPos, rRPos, rBorder, BorderResult(), pForceColor );
+}
+
+// ----------------------------------------------------------------------------
+
+void DrawVerFrameBorder( OutputDevice& rDev,
+ const Point& rTPos, const Point& rBPos, const Style& rBorder,
+ const DiagStyle& rTFromBL, const Style& rTFromL, const Style& rTFromT, const Style& rTFromR, const DiagStyle& rTFromBR,
+ const DiagStyle& rBFromTL, const Style& rBFromL, const Style& rBFromB, const Style& rBFromR, const DiagStyle& rBFromTR,
+ const Color* pForceColor )
+{
+ if( rBorder.Prim() )
+ {
+ BorderResult aResult;
+ lclLinkVerFrameBorder( aResult, rBorder,
+ rTFromBL, rTFromL, rTFromT, rTFromR, rTFromBR,
+ rBFromTL, rBFromL, rBFromB, rBFromR, rBFromTR );
+ lclDrawVerFrameBorder( rDev, rTPos, rBPos, rBorder, aResult, pForceColor );
+ }
+}
+
+void DrawVerFrameBorder( OutputDevice& rDev,
+ const Point& rTPos, const Point& rBPos, const Style& rBorder,
+ const Style& rTFromL, const Style& rTFromT, const Style& rTFromR,
+ const Style& rBFromL, const Style& rBFromB, const Style& rBFromR,
+ const Color* pForceColor )
+{
+ /* Recycle complex version of the DrawVerFrameBorder() function with empty diagonals. */
+ const DiagStyle aNoStyle;
+ DrawVerFrameBorder(
+ rDev, rTPos, rBPos, rBorder,
+ aNoStyle, rTFromL, rTFromT, rTFromR, aNoStyle,
+ aNoStyle, rBFromL, rBFromB, rBFromR, aNoStyle,
+ pForceColor );
+}
+
+void DrawVerFrameBorder( OutputDevice& rDev,
+ const Point& rTPos, const Point& rBPos, const Style& rBorder, const Color* pForceColor )
+{
+ if( rBorder.Prim() )
+ lclDrawVerFrameBorder( rDev, rTPos, rBPos, rBorder, BorderResult(), pForceColor );
+}
+
+// ----------------------------------------------------------------------------
+
+void DrawVerFrameBorderSlanted( OutputDevice& rDev,
+ const Point& rTPos, const Point& rBPos, const Style& rBorder, const Color* pForceColor )
+{
+ DBG_ASSERT( rTPos.Y() < rBPos.Y(), "svx::frame::DrawVerFrameBorderSlanted - wrong order of line ends" );
+ if( rBorder.Prim() && (rTPos.Y() < rBPos.Y()) )
+ {
+ if( rTPos.X() == rBPos.X() )
+ {
+ DrawVerFrameBorder( rDev, rTPos, rBPos, rBorder, pForceColor );
+ }
+ else
+ {
+ const LineEndResult aRes;
+
+ Style aScaled( rBorder );
+ aScaled.ScaleSelf( 1.0 / cos( GetVerDiagAngle( rTPos, rBPos ) ) );
+
+ lclSetColorToOutDev( rDev, aScaled, pForceColor );
+ lclDrawVerLine( rDev, rTPos, aRes, rBPos, aRes,
+ lclGetBeg( aScaled ), lclGetPrimEnd( aScaled ), aScaled.Dotted() );
+ if( aScaled.Secn() )
+ lclDrawVerLine( rDev, rTPos, aRes, rBPos, aRes,
+ lclGetSecnBeg( aScaled ), lclGetEnd( aScaled ), aScaled.Dotted() );
+ rDev.Pop(); // colors
+ }
+ }
+}
+
+// ============================================================================
+
+void DrawDiagFrameBorders(
+ OutputDevice& rDev, const Rectangle& rRect, const Style& rTLBR, const Style& rBLTR,
+ const Style& rTLFromB, const Style& rTLFromR, const Style& rBRFromT, const Style& rBRFromL,
+ const Style& rBLFromT, const Style& rBLFromR, const Style& rTRFromB, const Style& rTRFromL,
+ const Color* pForceColor, bool bDiagDblClip )
+{
+ if( rTLBR.Prim() || rBLTR.Prim() )
+ {
+ DiagBordersResult aResult;
+ lclLinkDiagFrameBorders( aResult, rTLBR, rBLTR,
+ rTLFromB, rTLFromR, rBRFromT, rBRFromL, rBLFromT, rBLFromR, rTRFromB, rTRFromL );
+ lclDrawDiagFrameBorders( rDev, rRect, rTLBR, rBLTR, aResult, pForceColor, bDiagDblClip );
+ }
+}
+
+// ============================================================================
+
+} // namespace frame
+} // namespace svx
+
diff --git a/svx/source/dialog/framelinkarray.cxx b/svx/source/dialog/framelinkarray.cxx
new file mode 100644
index 000000000000..a449c778f7b3
--- /dev/null
+++ b/svx/source/dialog/framelinkarray.cxx
@@ -0,0 +1,1247 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/framelinkarray.hxx>
+
+#include <math.h>
+#include <vector>
+#include <algorithm>
+#include <vcl/outdev.hxx>
+
+namespace svx {
+namespace frame {
+
+// ============================================================================
+
+
+Cell::Cell() :
+ mnAddLeft( 0 ),
+ mnAddRight( 0 ),
+ mnAddTop( 0 ),
+ mnAddBottom( 0 ),
+ mbMergeOrig( false ),
+ mbOverlapX( false ),
+ mbOverlapY( false )
+{
+}
+
+void Cell::MirrorSelfX( bool bMirrorStyles, bool bSwapDiag )
+{
+ std::swap( maLeft, maRight );
+ std::swap( mnAddLeft, mnAddRight );
+ if( bMirrorStyles )
+ {
+ maLeft.MirrorSelf();
+ maRight.MirrorSelf();
+ }
+ if( bSwapDiag )
+ {
+ std::swap( maTLBR, maBLTR );
+ if( bMirrorStyles )
+ {
+ maTLBR.MirrorSelf();
+ maBLTR.MirrorSelf();
+ }
+ }
+}
+
+void Cell::MirrorSelfY( bool bMirrorStyles, bool bSwapDiag )
+{
+ std::swap( maTop, maBottom );
+ std::swap( mnAddTop, mnAddBottom );
+ if( bMirrorStyles )
+ {
+ maTop.MirrorSelf();
+ maBottom.MirrorSelf();
+ }
+ if( bSwapDiag )
+ std::swap( maTLBR, maBLTR );
+ /* Do not mirror diagonal styles, because they are oriented vertical.
+ Therefore swapping the styles is sufficient for correct behaviour. */
+}
+
+// ----------------------------------------------------------------------------
+
+
+void lclRecalcCoordVec( LongVec& rCoords, const LongVec& rSizes )
+{
+ DBG_ASSERT( rCoords.size() == rSizes.size() + 1, "lclRecalcCoordVec - inconsistent vectors" );
+ LongVec::iterator aCIt = rCoords.begin();
+ LongVec::const_iterator aSIt = rSizes.begin(), aSEnd = rSizes.end();
+ for( ; aSIt != aSEnd; ++aCIt, ++aSIt )
+ *(aCIt + 1) = *aCIt + *aSIt;
+}
+
+void lclSetMergedRange( CellVec& rCells, size_t nWidth, size_t nFirstCol, size_t nFirstRow, size_t nLastCol, size_t nLastRow )
+{
+ for( size_t nCol = nFirstCol; nCol <= nLastCol; ++nCol )
+ {
+ for( size_t nRow = nFirstRow; nRow <= nLastRow; ++nRow )
+ {
+ Cell& rCell = rCells[ nRow * nWidth + nCol ];
+ rCell.mbMergeOrig = false;
+ rCell.mbOverlapX = nCol > nFirstCol;
+ rCell.mbOverlapY = nRow > nFirstRow;
+ }
+ }
+ rCells[ nFirstRow * nWidth + nFirstCol ].mbMergeOrig = true;
+}
+
+// ----------------------------------------------------------------------------
+
+static const Style OBJ_STYLE_NONE;
+static const Cell OBJ_CELL_NONE;
+
+const bool DIAG_DBL_CLIP_DEFAULT = false;
+
+// ============================================================================
+
+ArrayImpl::ArrayImpl( size_t nWidth, size_t nHeight, bool bDiagDblClip ) :
+ mnWidth( nWidth ),
+ mnHeight( nHeight ),
+ mnFirstClipCol( 0 ),
+ mnFirstClipRow( 0 ),
+ mnLastClipCol( nWidth - 1 ),
+ mnLastClipRow( nHeight - 1 ),
+ mbXCoordsDirty( false ),
+ mbYCoordsDirty( false ),
+ mbDiagDblClip( bDiagDblClip )
+{
+ // default-construct all vectors
+ maCells.resize( mnWidth * mnHeight );
+ maWidths.resize( mnWidth, 0L );
+ maHeights.resize( mnHeight, 0L );
+ maXCoords.resize( mnWidth + 1, 0L );
+ maYCoords.resize( mnHeight + 1, 0L );
+}
+
+const Cell& ArrayImpl::GetCell( size_t nCol, size_t nRow ) const
+{
+ return IsValidPos( nCol, nRow ) ? maCells[ GetIndex( nCol, nRow ) ] : OBJ_CELL_NONE;
+}
+
+Cell& ArrayImpl::GetCellAcc( size_t nCol, size_t nRow )
+{
+ static Cell aDummy;
+ return IsValidPos( nCol, nRow ) ? maCells[ GetIndex( nCol, nRow ) ] : aDummy;
+}
+
+size_t ArrayImpl::GetMergedFirstCol( size_t nCol, size_t nRow ) const
+{
+ size_t nFirstCol = nCol;
+ while( (nFirstCol > 0) && GetCell( nFirstCol, nRow ).mbOverlapX ) --nFirstCol;
+ return nFirstCol;
+}
+
+size_t ArrayImpl::GetMergedFirstRow( size_t nCol, size_t nRow ) const
+{
+ size_t nFirstRow = nRow;
+ while( (nFirstRow > 0) && GetCell( nCol, nFirstRow ).mbOverlapY ) --nFirstRow;
+ return nFirstRow;
+}
+
+size_t ArrayImpl::GetMergedLastCol( size_t nCol, size_t nRow ) const
+{
+ size_t nLastCol = nCol + 1;
+ while( (nLastCol < mnWidth) && GetCell( nLastCol, nRow ).mbOverlapX ) ++nLastCol;
+ return nLastCol - 1;
+}
+
+size_t ArrayImpl::GetMergedLastRow( size_t nCol, size_t nRow ) const
+{
+ size_t nLastRow = nRow + 1;
+ while( (nLastRow < mnHeight) && GetCell( nCol, nLastRow ).mbOverlapY ) ++nLastRow;
+ return nLastRow - 1;
+}
+
+const Cell& ArrayImpl::GetMergedOriginCell( size_t nCol, size_t nRow ) const
+{
+ return GetCell( GetMergedFirstCol( nCol, nRow ), GetMergedFirstRow( nCol, nRow ) );
+}
+
+Cell& ArrayImpl::GetMergedOriginCellAcc( size_t nCol, size_t nRow )
+{
+ return GetCellAcc( GetMergedFirstCol( nCol, nRow ), GetMergedFirstRow( nCol, nRow ) );
+}
+
+bool ArrayImpl::IsMergedOverlappedLeft( size_t nCol, size_t nRow ) const
+{
+ const Cell& rCell = GetCell( nCol, nRow );
+ return rCell.mbOverlapX || (rCell.mnAddLeft > 0);
+}
+
+bool ArrayImpl::IsMergedOverlappedRight( size_t nCol, size_t nRow ) const
+{
+ return GetCell( nCol + 1, nRow ).mbOverlapX || (GetCell( nCol, nRow ).mnAddRight > 0);
+}
+
+bool ArrayImpl::IsMergedOverlappedTop( size_t nCol, size_t nRow ) const
+{
+ const Cell& rCell = GetCell( nCol, nRow );
+ return rCell.mbOverlapY || (rCell.mnAddTop > 0);
+}
+
+bool ArrayImpl::IsMergedOverlappedBottom( size_t nCol, size_t nRow ) const
+{
+ return GetCell( nCol, nRow + 1 ).mbOverlapY || (GetCell( nCol, nRow ).mnAddBottom > 0);
+}
+
+bool ArrayImpl::IsColInClipRange( size_t nCol ) const
+{
+ return (mnFirstClipCol <= nCol) && (nCol <= mnLastClipCol);
+}
+
+bool ArrayImpl::IsRowInClipRange( size_t nRow ) const
+{
+ return (mnFirstClipRow <= nRow) && (nRow <= mnLastClipRow);
+}
+
+bool ArrayImpl::IsInClipRange( size_t nCol, size_t nRow ) const
+{
+ return IsColInClipRange( nCol ) && IsRowInClipRange( nRow );
+}
+
+long ArrayImpl::GetColPosition( size_t nCol ) const
+{
+ if( mbXCoordsDirty )
+ {
+ lclRecalcCoordVec( maXCoords, maWidths );
+ mbXCoordsDirty = false;
+ }
+ return maXCoords[ nCol ];
+}
+
+long ArrayImpl::GetRowPosition( size_t nRow ) const
+{
+ if( mbYCoordsDirty )
+ {
+ lclRecalcCoordVec( maYCoords, maHeights );
+ mbYCoordsDirty = false;
+ }
+ return maYCoords[ nRow ];
+}
+
+long ArrayImpl::GetColWidth( size_t nFirstCol, size_t nLastCol ) const
+{
+ return GetColPosition( nLastCol + 1 ) - GetColPosition( nFirstCol );
+}
+
+long ArrayImpl::GetRowHeight( size_t nFirstRow, size_t nLastRow ) const
+{
+ return GetRowPosition( nLastRow + 1 ) - GetRowPosition( nFirstRow );
+}
+
+double ArrayImpl::GetHorDiagAngle( size_t nCol, size_t nRow, bool bSimple ) const
+{
+ double fAngle = 0.0;
+ if( IsValidPos( nCol, nRow ) )
+ {
+ if( bSimple || !GetCell( nCol, nRow ).IsMerged() )
+ {
+ fAngle = frame::GetHorDiagAngle( maWidths[ nCol ] + 1, maHeights[ nRow ] + 1 );
+ }
+ else
+ {
+ // return correct angle for each cell in the merged range
+ size_t nFirstCol = GetMergedFirstCol( nCol, nRow );
+ size_t nFirstRow = GetMergedFirstRow( nCol, nRow );
+ const Cell& rCell = GetCell( nFirstCol, nFirstRow );
+ long nWidth = GetColWidth( nFirstCol, GetMergedLastCol( nCol, nRow ) ) + rCell.mnAddLeft + rCell.mnAddRight;
+ long nHeight = GetRowHeight( nFirstRow, GetMergedLastRow( nCol, nRow ) ) + rCell.mnAddTop + rCell.mnAddBottom;
+ fAngle = frame::GetHorDiagAngle( nWidth + 1, nHeight + 1 );
+ }
+ }
+ return fAngle;
+}
+
+double ArrayImpl::GetVerDiagAngle( size_t nCol, size_t nRow, bool bSimple ) const
+{
+ double fAngle = GetHorDiagAngle( nCol, nRow, bSimple );
+ return (fAngle > 0.0) ? (F_PI2 - fAngle) : 0.0;
+}
+
+// ============================================================================
+
+class MergedCellIterator
+{
+public:
+ explicit MergedCellIterator( const Array& rArray, size_t nCol, size_t nRow );
+
+ inline bool Is() const { return (mnCol <= mnLastCol) && (mnRow <= mnLastRow); }
+ inline size_t Col() const { return mnCol; }
+ inline size_t Row() const { return mnRow; }
+
+ MergedCellIterator& operator++();
+
+private:
+ size_t mnFirstCol;
+ size_t mnFirstRow;
+ size_t mnLastCol;
+ size_t mnLastRow;
+ size_t mnCol;
+ size_t mnRow;
+};
+
+// ----------------------------------------------------------------------------
+
+MergedCellIterator::MergedCellIterator( const Array& rArray, size_t nCol, size_t nRow )
+{
+ DBG_ASSERT( rArray.IsMerged( nCol, nRow ), "svx::frame::MergedCellIterator::MergedCellIterator - not in merged range" );
+ rArray.GetMergedRange( mnFirstCol, mnFirstRow, mnLastCol, mnLastRow, nCol, nRow );
+ mnCol = mnFirstCol;
+ mnRow = mnFirstRow;
+}
+
+MergedCellIterator& MergedCellIterator::operator++()
+{
+ DBG_ASSERT( Is(), "svx::frame::MergedCellIterator::operator++() - already invalid" );
+ if( ++mnCol > mnLastCol )
+ {
+ mnCol = mnFirstCol;
+ ++mnRow;
+ }
+ return *this;
+}
+
+// ============================================================================
+
+#define DBG_FRAME_ERROR( funcname, error ) DBG_ERRORFILE( "svx::frame::Array::" funcname " - " error )
+#define DBG_FRAME_CHECK( cond, funcname, error ) DBG_ASSERT( cond, "svx::frame::Array::" funcname " - " error )
+#define DBG_FRAME_CHECK_COL( col, funcname ) DBG_FRAME_CHECK( (col) < GetColCount(), funcname, "invalid column index" )
+#define DBG_FRAME_CHECK_ROW( row, funcname ) DBG_FRAME_CHECK( (row) < GetRowCount(), funcname, "invalid row index" )
+#define DBG_FRAME_CHECK_COLROW( col, row, funcname ) DBG_FRAME_CHECK( ((col) < GetColCount()) && ((row) < GetRowCount()), funcname, "invalid cell index" )
+#define DBG_FRAME_CHECK_INDEX( index, funcname ) DBG_FRAME_CHECK( (index) < GetCellCount(), funcname, "invalid cell index" )
+#define DBG_FRAME_CHECK_COL_1( col, funcname ) DBG_FRAME_CHECK( (col) <= GetColCount(), funcname, "invalid column index" )
+#define DBG_FRAME_CHECK_ROW_1( row, funcname ) DBG_FRAME_CHECK( (row) <= GetRowCount(), funcname, "invalid row index" )
+
+// ----------------------------------------------------------------------------
+
+#define CELL( col, row ) mxImpl->GetCell( col, row )
+#define CELLACC( col, row ) mxImpl->GetCellAcc( col, row )
+#define ORIGCELL( col, row ) mxImpl->GetMergedOriginCell( col, row )
+#define ORIGCELLACC( col, row ) mxImpl->GetMergedOriginCellAcc( col, row )
+
+// ----------------------------------------------------------------------------
+
+Array::Array()
+{
+ Initialize( 0, 0 );
+}
+
+Array::Array( size_t nWidth, size_t nHeight )
+{
+ Initialize( nWidth, nHeight );
+}
+
+Array::~Array()
+{
+}
+
+// array size and column/row indexes ------------------------------------------
+
+void Array::Initialize( size_t nWidth, size_t nHeight )
+{
+ bool bDiagDblClip = mxImpl.get() ? mxImpl->mbDiagDblClip : DIAG_DBL_CLIP_DEFAULT;
+ mxImpl.reset( new ArrayImpl( nWidth, nHeight, bDiagDblClip ) );
+}
+
+void Array::Clear()
+{
+ Initialize( mxImpl->mnWidth, mxImpl->mnHeight );
+}
+
+size_t Array::GetColCount() const
+{
+ return mxImpl->mnWidth;
+}
+
+size_t Array::GetRowCount() const
+{
+ return mxImpl->mnHeight;
+}
+
+size_t Array::GetCellCount() const
+{
+ return mxImpl->maCells.size();
+}
+
+size_t Array::GetColFromIndex( size_t nCellIndex ) const
+{
+ DBG_FRAME_CHECK_INDEX( nCellIndex, "GetColFromIndex" );
+ return mxImpl->mnWidth ? (nCellIndex % mxImpl->mnWidth) : 0;
+}
+
+size_t Array::GetRowFromIndex( size_t nCellIndex ) const
+{
+ DBG_FRAME_CHECK_INDEX( nCellIndex, "GetRowFromIndex" );
+ return mxImpl->mnWidth ? (nCellIndex / mxImpl->mnWidth) : 0;
+}
+
+size_t Array::GetCellIndex( size_t nCol, size_t nRow, bool bRTL ) const
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "GetCellIndex" );
+ if (bRTL)
+ nCol = mxImpl->GetMirrorCol(nCol);
+ return mxImpl->GetIndex( nCol, nRow );
+}
+
+// cell border styles ---------------------------------------------------------
+
+void Array::SetCellStyleLeft( size_t nCol, size_t nRow, const Style& rStyle )
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "SetCellStyleLeft" );
+ CELLACC( nCol, nRow ).maLeft = rStyle;
+}
+
+void Array::SetCellStyleRight( size_t nCol, size_t nRow, const Style& rStyle )
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "SetCellStyleRight" );
+ CELLACC( nCol, nRow ).maRight = rStyle;
+}
+
+void Array::SetCellStyleTop( size_t nCol, size_t nRow, const Style& rStyle )
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "SetCellStyleTop" );
+ CELLACC( nCol, nRow ).maTop = rStyle;
+}
+
+void Array::SetCellStyleBottom( size_t nCol, size_t nRow, const Style& rStyle )
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "SetCellStyleBottom" );
+ CELLACC( nCol, nRow ).maBottom = rStyle;
+}
+
+void Array::SetCellStyleTLBR( size_t nCol, size_t nRow, const Style& rStyle )
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "SetCellStyleTLBR" );
+ CELLACC( nCol, nRow ).maTLBR = rStyle;
+}
+
+void Array::SetCellStyleBLTR( size_t nCol, size_t nRow, const Style& rStyle )
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "SetCellStyleBLTR" );
+ CELLACC( nCol, nRow ).maBLTR = rStyle;
+}
+
+void Array::SetCellStyleDiag( size_t nCol, size_t nRow, const Style& rTLBR, const Style& rBLTR )
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "SetCellStyleDiag" );
+ Cell& rCell = CELLACC( nCol, nRow );
+ rCell.maTLBR = rTLBR;
+ rCell.maBLTR = rBLTR;
+}
+
+void Array::SetColumnStyleLeft( size_t nCol, const Style& rStyle )
+{
+ DBG_FRAME_CHECK_COL( nCol, "SetColumnStyleLeft" );
+ for( size_t nRow = 0; nRow < mxImpl->mnHeight; ++nRow )
+ SetCellStyleLeft( nCol, nRow, rStyle );
+}
+
+void Array::SetColumnStyleRight( size_t nCol, const Style& rStyle )
+{
+ DBG_FRAME_CHECK_COL( nCol, "SetColumnStyleRight" );
+ for( size_t nRow = 0; nRow < mxImpl->mnHeight; ++nRow )
+ SetCellStyleRight( nCol, nRow, rStyle );
+}
+
+void Array::SetRowStyleTop( size_t nRow, const Style& rStyle )
+{
+ DBG_FRAME_CHECK_ROW( nRow, "SetRowStyleTop" );
+ for( size_t nCol = 0; nCol < mxImpl->mnWidth; ++nCol )
+ SetCellStyleTop( nCol, nRow, rStyle );
+}
+
+void Array::SetRowStyleBottom( size_t nRow, const Style& rStyle )
+{
+ DBG_FRAME_CHECK_ROW( nRow, "SetRowStyleBottom" );
+ for( size_t nCol = 0; nCol < mxImpl->mnWidth; ++nCol )
+ SetCellStyleBottom( nCol, nRow, rStyle );
+}
+
+const Style& Array::GetCellStyleLeft( size_t nCol, size_t nRow, bool bSimple ) const
+{
+ // simple: always return own left style
+ if( bSimple )
+ return CELL( nCol, nRow ).maLeft;
+ // outside clipping rows or overlapped in merged cells: invisible
+ if( !mxImpl->IsRowInClipRange( nRow ) || mxImpl->IsMergedOverlappedLeft( nCol, nRow ) )
+ return OBJ_STYLE_NONE;
+ // left clipping border: always own left style
+ if( nCol == mxImpl->mnFirstClipCol )
+ return ORIGCELL( nCol, nRow ).maLeft;
+ // right clipping border: always right style of left neighbor cell
+ if( nCol == mxImpl->mnLastClipCol + 1 )
+ return ORIGCELL( nCol - 1, nRow ).maRight;
+ // outside clipping columns: invisible
+ if( !mxImpl->IsColInClipRange( nCol ) )
+ return OBJ_STYLE_NONE;
+ // inside clipping range: maximum of own left style and right style of left neighbor cell
+ return std::max( ORIGCELL( nCol, nRow ).maLeft, ORIGCELL( nCol - 1, nRow ).maRight );
+}
+
+const Style& Array::GetCellStyleRight( size_t nCol, size_t nRow, bool bSimple ) const
+{
+ // simple: always return own right style
+ if( bSimple )
+ return CELL( nCol, nRow ).maRight;
+ // outside clipping rows or overlapped in merged cells: invisible
+ if( !mxImpl->IsRowInClipRange( nRow ) || mxImpl->IsMergedOverlappedRight( nCol, nRow ) )
+ return OBJ_STYLE_NONE;
+ // left clipping border: always left style of right neighbor cell
+ if( nCol + 1 == mxImpl->mnFirstClipCol )
+ return ORIGCELL( nCol + 1, nRow ).maLeft;
+ // right clipping border: always own right style
+ if( nCol == mxImpl->mnLastClipCol )
+ return ORIGCELL( nCol, nRow ).maRight;
+ // outside clipping columns: invisible
+ if( !mxImpl->IsColInClipRange( nCol ) )
+ return OBJ_STYLE_NONE;
+ // inside clipping range: maximum of own right style and left style of right neighbor cell
+ return std::max( ORIGCELL( nCol, nRow ).maRight, ORIGCELL( nCol + 1, nRow ).maLeft );
+}
+
+const Style& Array::GetCellStyleTop( size_t nCol, size_t nRow, bool bSimple ) const
+{
+ // simple: always return own top style
+ if( bSimple )
+ return CELL( nCol, nRow ).maTop;
+ // outside clipping columns or overlapped in merged cells: invisible
+ if( !mxImpl->IsColInClipRange( nCol ) || mxImpl->IsMergedOverlappedTop( nCol, nRow ) )
+ return OBJ_STYLE_NONE;
+ // top clipping border: always own top style
+ if( nRow == mxImpl->mnFirstClipRow )
+ return ORIGCELL( nCol, nRow ).maTop;
+ // bottom clipping border: always bottom style of top neighbor cell
+ if( nRow == mxImpl->mnLastClipRow + 1 )
+ return ORIGCELL( nCol, nRow - 1 ).maBottom;
+ // outside clipping rows: invisible
+ if( !mxImpl->IsRowInClipRange( nRow ) )
+ return OBJ_STYLE_NONE;
+ // inside clipping range: maximum of own top style and bottom style of top neighbor cell
+ return std::max( ORIGCELL( nCol, nRow ).maTop, ORIGCELL( nCol, nRow - 1 ).maBottom );
+}
+
+const Style& Array::GetCellStyleBottom( size_t nCol, size_t nRow, bool bSimple ) const
+{
+ // simple: always return own bottom style
+ if( bSimple )
+ return CELL( nCol, nRow ).maBottom;
+ // outside clipping columns or overlapped in merged cells: invisible
+ if( !mxImpl->IsColInClipRange( nCol ) || mxImpl->IsMergedOverlappedBottom( nCol, nRow ) )
+ return OBJ_STYLE_NONE;
+ // top clipping border: always top style of bottom neighbor cell
+ if( nRow + 1 == mxImpl->mnFirstClipRow )
+ return ORIGCELL( nCol, nRow + 1 ).maTop;
+ // bottom clipping border: always own bottom style
+ if( nRow == mxImpl->mnLastClipRow )
+ return ORIGCELL( nCol, nRow ).maBottom;
+ // outside clipping rows: invisible
+ if( !mxImpl->IsRowInClipRange( nRow ) )
+ return OBJ_STYLE_NONE;
+ // inside clipping range: maximum of own bottom style and top style of bottom neighbor cell
+ return std::max( ORIGCELL( nCol, nRow ).maBottom, ORIGCELL( nCol, nRow + 1 ).maTop );
+}
+
+const Style& Array::GetCellStyleTLBR( size_t nCol, size_t nRow, bool bSimple ) const
+{
+ return bSimple ? CELL( nCol, nRow ).maTLBR :
+ (mxImpl->IsInClipRange( nCol, nRow ) ? ORIGCELL( nCol, nRow ).maTLBR : OBJ_STYLE_NONE);
+}
+
+const Style& Array::GetCellStyleBLTR( size_t nCol, size_t nRow, bool bSimple ) const
+{
+ return bSimple ? CELL( nCol, nRow ).maBLTR :
+ (mxImpl->IsInClipRange( nCol, nRow ) ? ORIGCELL( nCol, nRow ).maBLTR : OBJ_STYLE_NONE);
+}
+
+const Style& Array::GetCellStyleTL( size_t nCol, size_t nRow ) const
+{
+ // not in clipping range: always invisible
+ if( !mxImpl->IsInClipRange( nCol, nRow ) )
+ return OBJ_STYLE_NONE;
+ // return style only for top-left cell
+ size_t nFirstCol = mxImpl->GetMergedFirstCol( nCol, nRow );
+ size_t nFirstRow = mxImpl->GetMergedFirstRow( nCol, nRow );
+ return ((nCol == nFirstCol) && (nRow == nFirstRow)) ?
+ CELL( nFirstCol, nFirstRow ).maTLBR : OBJ_STYLE_NONE;
+}
+
+const Style& Array::GetCellStyleBR( size_t nCol, size_t nRow ) const
+{
+ // not in clipping range: always invisible
+ if( !mxImpl->IsInClipRange( nCol, nRow ) )
+ return OBJ_STYLE_NONE;
+ // return style only for bottom-right cell
+ size_t nLastCol = mxImpl->GetMergedLastCol( nCol, nRow );
+ size_t nLastRow = mxImpl->GetMergedLastRow( nCol, nRow );
+ return ((nCol == nLastCol) && (nRow == nLastRow)) ?
+ CELL( mxImpl->GetMergedFirstCol( nCol, nRow ), mxImpl->GetMergedFirstRow( nCol, nRow ) ).maTLBR : OBJ_STYLE_NONE;
+}
+
+const Style& Array::GetCellStyleBL( size_t nCol, size_t nRow ) const
+{
+ // not in clipping range: always invisible
+ if( !mxImpl->IsInClipRange( nCol, nRow ) )
+ return OBJ_STYLE_NONE;
+ // return style only for bottom-left cell
+ size_t nFirstCol = mxImpl->GetMergedFirstCol( nCol, nRow );
+ size_t nLastRow = mxImpl->GetMergedLastRow( nCol, nRow );
+ return ((nCol == nFirstCol) && (nRow == nLastRow)) ?
+ CELL( nFirstCol, mxImpl->GetMergedFirstRow( nCol, nRow ) ).maBLTR : OBJ_STYLE_NONE;
+}
+
+const Style& Array::GetCellStyleTR( size_t nCol, size_t nRow ) const
+{
+ // not in clipping range: always invisible
+ if( !mxImpl->IsInClipRange( nCol, nRow ) )
+ return OBJ_STYLE_NONE;
+ // return style only for top-right cell
+ size_t nFirstRow = mxImpl->GetMergedFirstRow( nCol, nRow );
+ size_t nLastCol = mxImpl->GetMergedLastCol( nCol, nRow );
+ return ((nCol == nLastCol) && (nRow == nFirstRow)) ?
+ CELL( mxImpl->GetMergedFirstCol( nCol, nRow ), nFirstRow ).maBLTR : OBJ_STYLE_NONE;
+}
+
+// cell merging ---------------------------------------------------------------
+
+void Array::SetMergedRange( size_t nFirstCol, size_t nFirstRow, size_t nLastCol, size_t nLastRow )
+{
+ DBG_FRAME_CHECK_COLROW( nFirstCol, nFirstRow, "SetMergedRange" );
+ DBG_FRAME_CHECK_COLROW( nLastCol, nLastRow, "SetMergedRange" );
+#if OSL_DEBUG_LEVEL >= 2
+ {
+ bool bFound = false;
+ for( size_t nCurrCol = nFirstCol; !bFound && (nCurrCol <= nLastCol); ++nCurrCol )
+ for( size_t nCurrRow = nFirstRow; !bFound && (nCurrRow <= nLastRow); ++nCurrRow )
+ bFound = CELL( nCurrCol, nCurrRow ).IsMerged();
+ DBG_FRAME_CHECK( !bFound, "SetMergedRange", "overlapping merged ranges" );
+ }
+#endif
+ if( mxImpl->IsValidPos( nFirstCol, nFirstRow ) && mxImpl->IsValidPos( nLastCol, nLastRow ) )
+ lclSetMergedRange( mxImpl->maCells, mxImpl->mnWidth, nFirstCol, nFirstRow, nLastCol, nLastRow );
+}
+
+void Array::RemoveMergedRange( size_t nCol, size_t nRow )
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "RemoveMergedRange" );
+ for( MergedCellIterator aIt( *this, nCol, nRow ); aIt.Is(); ++aIt )
+ {
+ Cell& rCell = CELLACC( aIt.Col(), aIt.Row() );
+ rCell.mbMergeOrig = rCell.mbOverlapX = rCell.mbOverlapY = false;
+ rCell.mnAddLeft = rCell.mnAddRight = rCell.mnAddTop = rCell.mnAddBottom = 0;
+ }
+}
+
+void Array::SetAddMergedLeftSize( size_t nCol, size_t nRow, long nAddSize )
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "SetAddMergedLeftSize" );
+ DBG_FRAME_CHECK( mxImpl->GetMergedFirstCol( nCol, nRow ) == 0, "SetAddMergedLeftSize", "additional border inside array" );
+ for( MergedCellIterator aIt( *this, nCol, nRow ); aIt.Is(); ++aIt )
+ CELLACC( aIt.Col(), aIt.Row() ).mnAddLeft = nAddSize;
+}
+
+void Array::SetAddMergedRightSize( size_t nCol, size_t nRow, long nAddSize )
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "SetAddMergedRightSize" );
+ DBG_FRAME_CHECK( mxImpl->GetMergedLastCol( nCol, nRow ) + 1 == mxImpl->mnWidth, "SetAddMergedRightSize", "additional border inside array" );
+ for( MergedCellIterator aIt( *this, nCol, nRow ); aIt.Is(); ++aIt )
+ CELLACC( aIt.Col(), aIt.Row() ).mnAddRight = nAddSize;
+}
+
+void Array::SetAddMergedTopSize( size_t nCol, size_t nRow, long nAddSize )
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "SetAddMergedTopSize" );
+ DBG_FRAME_CHECK( mxImpl->GetMergedFirstRow( nCol, nRow ) == 0, "SetAddMergedTopSize", "additional border inside array" );
+ for( MergedCellIterator aIt( *this, nCol, nRow ); aIt.Is(); ++aIt )
+ CELLACC( aIt.Col(), aIt.Row() ).mnAddTop = nAddSize;
+}
+
+void Array::SetAddMergedBottomSize( size_t nCol, size_t nRow, long nAddSize )
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "SetAddMergedBottomSize" );
+ DBG_FRAME_CHECK( mxImpl->GetMergedLastRow( nCol, nRow ) + 1 == mxImpl->mnHeight, "SetAddMergedBottomSize", "additional border inside array" );
+ for( MergedCellIterator aIt( *this, nCol, nRow ); aIt.Is(); ++aIt )
+ CELLACC( aIt.Col(), aIt.Row() ).mnAddBottom = nAddSize;
+}
+
+bool Array::IsMerged( size_t nCol, size_t nRow ) const
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "IsMerged" );
+ return CELL( nCol, nRow ).IsMerged();
+}
+
+bool Array::IsMergedOrigin( size_t nCol, size_t nRow ) const
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "IsMergedOrigin" );
+ return CELL( nCol, nRow ).mbMergeOrig;
+}
+
+bool Array::IsMergedOverlapped( size_t nCol, size_t nRow ) const
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "IsMergedOverlapped" );
+ return CELL( nCol, nRow ).IsOverlapped();
+}
+
+bool Array::IsMergedOverlappedLeft( size_t nCol, size_t nRow ) const
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "IsMergedOverlappedLeft" );
+ return mxImpl->IsMergedOverlappedLeft( nCol, nRow );
+}
+
+bool Array::IsMergedOverlappedRight( size_t nCol, size_t nRow ) const
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "IsMergedOverlappedRight" );
+ return mxImpl->IsMergedOverlappedRight( nCol, nRow );
+}
+
+bool Array::IsMergedOverlappedTop( size_t nCol, size_t nRow ) const
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "IsMergedOverlappedTop" );
+ return mxImpl->IsMergedOverlappedTop( nCol, nRow );
+}
+
+bool Array::IsMergedOverlappedBottom( size_t nCol, size_t nRow ) const
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "IsMergedOverlappedBottom" );
+ return mxImpl->IsMergedOverlappedBottom( nCol, nRow );
+}
+
+void Array::GetMergedOrigin( size_t& rnFirstCol, size_t& rnFirstRow, size_t nCol, size_t nRow ) const
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "GetMergedOrigin" );
+ rnFirstCol = mxImpl->GetMergedFirstCol( nCol, nRow );
+ rnFirstRow = mxImpl->GetMergedFirstRow( nCol, nRow );
+}
+
+void Array::GetMergedSize( size_t& rnWidth, size_t& rnHeight, size_t nCol, size_t nRow ) const
+{
+ size_t nFirstCol, nFirstRow, nLastCol, nLastRow;
+ GetMergedRange( nFirstCol, nFirstRow, nLastCol, nLastRow, nCol, nRow );
+ rnWidth = nLastCol - nFirstCol + 1;
+ rnHeight = nLastRow - nFirstRow + 1;
+}
+
+void Array::GetMergedRange( size_t& rnFirstCol, size_t& rnFirstRow,
+ size_t& rnLastCol, size_t& rnLastRow, size_t nCol, size_t nRow ) const
+{
+ GetMergedOrigin( rnFirstCol, rnFirstRow, nCol, nRow );
+ rnLastCol = mxImpl->GetMergedLastCol( nCol, nRow );
+ rnLastRow = mxImpl->GetMergedLastRow( nCol, nRow );
+}
+
+// clipping -------------------------------------------------------------------
+
+void Array::SetClipRange( size_t nFirstCol, size_t nFirstRow, size_t nLastCol, size_t nLastRow )
+{
+ DBG_FRAME_CHECK_COLROW( nFirstCol, nFirstRow, "SetClipRange" );
+ DBG_FRAME_CHECK_COLROW( nLastCol, nLastRow, "SetClipRange" );
+ mxImpl->mnFirstClipCol = nFirstCol;
+ mxImpl->mnFirstClipRow = nFirstRow;
+ mxImpl->mnLastClipCol = nLastCol;
+ mxImpl->mnLastClipRow = nLastRow;
+}
+
+void Array::RemoveClipRange()
+{
+ if( !mxImpl->maCells.empty() )
+ SetClipRange( 0, 0, mxImpl->mnWidth - 1, mxImpl->mnHeight - 1 );
+}
+
+bool Array::IsInClipRange( size_t nCol, size_t nRow ) const
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "IsInClipRange" );
+ return mxImpl->IsInClipRange( nCol, nRow );
+}
+
+Rectangle Array::GetClipRangeRectangle() const
+{
+ return Rectangle(
+ mxImpl->GetColPosition( mxImpl->mnFirstClipCol ),
+ mxImpl->GetRowPosition( mxImpl->mnFirstClipRow ),
+ mxImpl->GetColPosition( mxImpl->mnLastClipCol + 1 ),
+ mxImpl->GetRowPosition( mxImpl->mnLastClipRow + 1 ) );
+}
+
+// cell coordinates -----------------------------------------------------------
+
+void Array::SetXOffset( long nXOffset )
+{
+ mxImpl->maXCoords[ 0 ] = nXOffset;
+ mxImpl->mbXCoordsDirty = true;
+}
+
+void Array::SetYOffset( long nYOffset )
+{
+ mxImpl->maYCoords[ 0 ] = nYOffset;
+ mxImpl->mbYCoordsDirty = true;
+}
+
+void Array::SetColWidth( size_t nCol, long nWidth )
+{
+ DBG_FRAME_CHECK_COL( nCol, "SetColWidth" );
+ mxImpl->maWidths[ nCol ] = nWidth;
+ mxImpl->mbXCoordsDirty = true;
+}
+
+void Array::SetRowHeight( size_t nRow, long nHeight )
+{
+ DBG_FRAME_CHECK_ROW( nRow, "SetRowHeight" );
+ mxImpl->maHeights[ nRow ] = nHeight;
+ mxImpl->mbYCoordsDirty = true;
+}
+
+void Array::SetAllColWidths( long nWidth )
+{
+ std::fill( mxImpl->maWidths.begin(), mxImpl->maWidths.end(), nWidth );
+ mxImpl->mbXCoordsDirty = true;
+}
+
+void Array::SetAllRowHeights( long nHeight )
+{
+ std::fill( mxImpl->maHeights.begin(), mxImpl->maHeights.end(), nHeight );
+ mxImpl->mbYCoordsDirty = true;
+}
+
+long Array::GetColPosition( size_t nCol ) const
+{
+ DBG_FRAME_CHECK_COL_1( nCol, "GetColPosition" );
+ return mxImpl->GetColPosition( nCol );
+}
+
+long Array::GetRowPosition( size_t nRow ) const
+{
+ DBG_FRAME_CHECK_ROW_1( nRow, "GetRowPosition" );
+ return mxImpl->GetRowPosition( nRow );
+}
+
+long Array::GetColWidth( size_t nCol ) const
+{
+ DBG_FRAME_CHECK_COL( nCol, "GetColWidth" );
+ return mxImpl->maWidths[ nCol ];
+}
+
+long Array::GetColWidth( size_t nFirstCol, size_t nLastCol ) const
+{
+ DBG_FRAME_CHECK_COL( nFirstCol, "GetColWidth" );
+ DBG_FRAME_CHECK_COL( nLastCol, "GetColWidth" );
+ return GetColPosition( nLastCol + 1 ) - GetColPosition( nFirstCol );
+}
+
+long Array::GetRowHeight( size_t nRow ) const
+{
+ DBG_FRAME_CHECK_ROW( nRow, "GetRowHeight" );
+ return mxImpl->maHeights[ nRow ];
+}
+
+long Array::GetRowHeight( size_t nFirstRow, size_t nLastRow ) const
+{
+ DBG_FRAME_CHECK_ROW( nFirstRow, "GetRowHeight" );
+ DBG_FRAME_CHECK_ROW( nLastRow, "GetRowHeight" );
+ return GetRowPosition( nLastRow + 1 ) - GetRowPosition( nFirstRow );
+}
+
+long Array::GetWidth() const
+{
+ return GetColPosition( mxImpl->mnWidth ) - GetColPosition( 0 );
+}
+
+long Array::GetHeight() const
+{
+ return GetRowPosition( mxImpl->mnHeight ) - GetRowPosition( 0 );
+}
+
+Point Array::GetCellPosition( size_t nCol, size_t nRow, bool bSimple ) const
+{
+ size_t nFirstCol = bSimple ? nCol : mxImpl->GetMergedFirstCol( nCol, nRow );
+ size_t nFirstRow = bSimple ? nRow : mxImpl->GetMergedFirstRow( nCol, nRow );
+ return Point( GetColPosition( nFirstCol ), GetRowPosition( nFirstRow ) );
+}
+
+Size Array::GetCellSize( size_t nCol, size_t nRow, bool bSimple ) const
+{
+ size_t nFirstCol = bSimple ? nCol : mxImpl->GetMergedFirstCol( nCol, nRow );
+ size_t nFirstRow = bSimple ? nRow : mxImpl->GetMergedFirstRow( nCol, nRow );
+ size_t nLastCol = bSimple ? nCol : mxImpl->GetMergedLastCol( nCol, nRow );
+ size_t nLastRow = bSimple ? nRow : mxImpl->GetMergedLastRow( nCol, nRow );
+ return Size( GetColWidth( nFirstCol, nLastCol ) + 1, GetRowHeight( nFirstRow, nLastRow ) + 1 );
+}
+
+Rectangle Array::GetCellRect( size_t nCol, size_t nRow, bool bSimple ) const
+{
+ Rectangle aRect( GetCellPosition( nCol, nRow, bSimple ), GetCellSize( nCol, nRow, bSimple ) );
+
+ // adjust rectangle for partly visible merged cells
+ const Cell& rCell = CELL( nCol, nRow );
+ if( !bSimple && rCell.IsMerged() )
+ {
+ aRect.Left() -= rCell.mnAddLeft;
+ aRect.Right() += rCell.mnAddRight;
+ aRect.Top() -= rCell.mnAddTop;
+ aRect.Bottom() += rCell.mnAddBottom;
+ }
+ return aRect;
+}
+
+// diagonal frame borders -----------------------------------------------------
+
+double Array::GetHorDiagAngle( size_t nCol, size_t nRow, bool bSimple ) const
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "GetHorDiagAngle" );
+ return mxImpl->GetHorDiagAngle( nCol, nRow, bSimple );
+}
+
+double Array::GetVerDiagAngle( size_t nCol, size_t nRow, bool bSimple ) const
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "GetVerDiagAngle" );
+ return mxImpl->GetVerDiagAngle( nCol, nRow, bSimple );
+}
+
+void Array::SetUseDiagDoubleClipping( bool bSet )
+{
+ mxImpl->mbDiagDblClip = bSet;
+}
+
+bool Array::GetUseDiagDoubleClipping() const
+{
+ return mxImpl->mbDiagDblClip;
+}
+
+// mirroring ------------------------------------------------------------------
+
+void Array::MirrorSelfX( bool bMirrorStyles, bool bSwapDiag )
+{
+ CellVec aNewCells;
+ aNewCells.reserve( GetCellCount() );
+
+ size_t nCol, nRow;
+ for( nRow = 0; nRow < mxImpl->mnHeight; ++nRow )
+ {
+ for( nCol = 0; nCol < mxImpl->mnWidth; ++nCol )
+ {
+ aNewCells.push_back( CELL( mxImpl->GetMirrorCol( nCol ), nRow ) );
+ aNewCells.back().MirrorSelfX( bMirrorStyles, bSwapDiag );
+ }
+ }
+ for( nRow = 0; nRow < mxImpl->mnHeight; ++nRow )
+ {
+ for( nCol = 0; nCol < mxImpl->mnWidth; ++nCol )
+ {
+ if( CELL( nCol, nRow ).mbMergeOrig )
+ {
+ size_t nLastCol = mxImpl->GetMergedLastCol( nCol, nRow );
+ size_t nLastRow = mxImpl->GetMergedLastRow( nCol, nRow );
+ lclSetMergedRange( aNewCells, mxImpl->mnWidth,
+ mxImpl->GetMirrorCol( nLastCol ), nRow,
+ mxImpl->GetMirrorCol( nCol ), nLastRow );
+ }
+ }
+ }
+ mxImpl->maCells.swap( aNewCells );
+
+ std::reverse( mxImpl->maWidths.begin(), mxImpl->maWidths.end() );
+ mxImpl->mbXCoordsDirty = true;
+}
+
+void Array::MirrorSelfY( bool bMirrorStyles, bool bSwapDiag )
+{
+ CellVec aNewCells;
+ aNewCells.reserve( GetCellCount() );
+
+ size_t nCol, nRow;
+ for( nRow = 0; nRow < mxImpl->mnHeight; ++nRow )
+ {
+ for( nCol = 0; nCol < mxImpl->mnWidth; ++nCol )
+ {
+ aNewCells.push_back( CELL( nCol, mxImpl->GetMirrorRow( nRow ) ) );
+ aNewCells.back().MirrorSelfY( bMirrorStyles, bSwapDiag );
+ }
+ }
+ for( nRow = 0; nRow < mxImpl->mnHeight; ++nRow )
+ {
+ for( nCol = 0; nCol < mxImpl->mnWidth; ++nCol )
+ {
+ if( CELL( nCol, nRow ).mbMergeOrig )
+ {
+ size_t nLastCol = mxImpl->GetMergedLastCol( nCol, nRow );
+ size_t nLastRow = mxImpl->GetMergedLastRow( nCol, nRow );
+ lclSetMergedRange( aNewCells, mxImpl->mnWidth,
+ nCol, mxImpl->GetMirrorRow( nLastRow ),
+ nLastCol, mxImpl->GetMirrorRow( nRow ) );
+ }
+ }
+ }
+ mxImpl->maCells.swap( aNewCells );
+
+ std::reverse( mxImpl->maHeights.begin(), mxImpl->maHeights.end() );
+ mxImpl->mbYCoordsDirty = true;
+}
+
+// drawing --------------------------------------------------------------------
+
+void Array::DrawCell( OutputDevice& rDev, size_t nCol, size_t nRow, const Color* pForceColor ) const
+{
+ DrawRange( rDev, nCol, nRow, nCol, nRow, pForceColor );
+}
+
+void Array::DrawRange( OutputDevice& rDev,
+ size_t nFirstCol, size_t nFirstRow, size_t nLastCol, size_t nLastRow,
+ const Color* pForceColor ) const
+{
+ DBG_FRAME_CHECK_COLROW( nFirstCol, nFirstRow, "DrawRange" );
+ DBG_FRAME_CHECK_COLROW( nLastCol, nLastRow, "DrawRange" );
+
+ size_t nCol, nRow;
+
+ // *** diagonal frame borders ***
+
+ // set clipping region to clip partly visible merged cells
+ rDev.Push( PUSH_CLIPREGION );
+ rDev.IntersectClipRegion( GetClipRangeRectangle() );
+ for( nRow = nFirstRow; nRow <= nLastRow; ++nRow )
+ {
+ for( nCol = nFirstCol; nCol <= nLastCol; ++nCol )
+ {
+ const Cell& rCell = CELL( nCol, nRow );
+ bool bOverlapX = rCell.mbOverlapX;
+ bool bOverlapY = rCell.mbOverlapY;
+ bool bFirstCol = nCol == nFirstCol;
+ bool bFirstRow = nRow == nFirstRow;
+ if( (!bOverlapX && !bOverlapY) || (bFirstCol && bFirstRow) ||
+ (!bOverlapY && bFirstCol) || (!bOverlapX && bFirstRow) )
+ {
+ Rectangle aRect( GetCellRect( nCol, nRow ) );
+ if( (aRect.GetWidth() > 1) && (aRect.GetHeight() > 1) )
+ {
+ size_t _nFirstCol = mxImpl->GetMergedFirstCol( nCol, nRow );
+ size_t _nFirstRow = mxImpl->GetMergedFirstRow( nCol, nRow );
+ size_t _nLastCol = mxImpl->GetMergedLastCol( nCol, nRow );
+ size_t _nLastRow = mxImpl->GetMergedLastRow( nCol, nRow );
+
+ DrawDiagFrameBorders( rDev, aRect,
+ GetCellStyleTLBR( _nFirstCol, _nFirstRow, true ), GetCellStyleBLTR( _nFirstCol, _nFirstRow, true ),
+ GetCellStyleLeft( _nFirstCol, _nFirstRow ), GetCellStyleTop( _nFirstCol, _nFirstRow ),
+ GetCellStyleRight( _nLastCol, _nLastRow ), GetCellStyleBottom( _nLastCol, _nLastRow ),
+ GetCellStyleLeft( _nFirstCol, _nLastRow ), GetCellStyleBottom( _nFirstCol, _nLastRow ),
+ GetCellStyleRight( _nLastCol, _nFirstRow ), GetCellStyleTop( _nLastCol, _nFirstRow ),
+ pForceColor, mxImpl->mbDiagDblClip );
+ }
+ }
+ }
+ }
+ rDev.Pop(); // clip region
+
+ // *** horizontal frame borders ***
+
+ for( nRow = nFirstRow; nRow <= nLastRow + 1; ++nRow )
+ {
+ double fAngle = mxImpl->GetHorDiagAngle( nFirstCol, nRow );
+ double fTAngle = mxImpl->GetHorDiagAngle( nFirstCol, nRow - 1 );
+
+ // *Start*** variables store the data of the left end of the cached frame border
+ Point aStartPos( mxImpl->GetColPosition( nFirstCol ), mxImpl->GetRowPosition( nRow ) );
+ const Style* pStart = &GetCellStyleTop( nFirstCol, nRow );
+ DiagStyle aStartLFromTR( GetCellStyleBL( nFirstCol, nRow - 1 ), fTAngle );
+ const Style* pStartLFromT = &GetCellStyleLeft( nFirstCol, nRow - 1 );
+ const Style* pStartLFromL = &GetCellStyleTop( nFirstCol - 1, nRow );
+ const Style* pStartLFromB = &GetCellStyleLeft( nFirstCol, nRow );
+ DiagStyle aStartLFromBR( GetCellStyleTL( nFirstCol, nRow ), fAngle );
+
+ // *End*** variables store the data of the right end of the cached frame border
+ DiagStyle aEndRFromTL( GetCellStyleBR( nFirstCol, nRow - 1 ), fTAngle );
+ const Style* pEndRFromT = &GetCellStyleRight( nFirstCol, nRow - 1 );
+ const Style* pEndRFromR = &GetCellStyleTop( nFirstCol + 1, nRow );
+ const Style* pEndRFromB = &GetCellStyleRight( nFirstCol, nRow );
+ DiagStyle aEndRFromBL( GetCellStyleTR( nFirstCol, nRow ), fAngle );
+
+ for( nCol = nFirstCol + 1; nCol <= nLastCol; ++nCol )
+ {
+ fAngle = mxImpl->GetHorDiagAngle( nCol, nRow );
+ fTAngle = mxImpl->GetHorDiagAngle( nCol, nRow - 1 );
+
+ const Style& rCurr = *pEndRFromR;
+
+ DiagStyle aLFromTR( GetCellStyleBL( nCol, nRow - 1 ), fTAngle );
+ const Style& rLFromT = *pEndRFromT;
+ const Style& rLFromL = *pStart;
+ const Style& rLFromB = *pEndRFromB;
+ DiagStyle aLFromBR( GetCellStyleTL( nCol, nRow ), fAngle );
+
+ DiagStyle aRFromTL( GetCellStyleBR( nCol, nRow - 1 ), fTAngle );
+ const Style& rRFromT = GetCellStyleRight( nCol, nRow - 1 );
+ const Style& rRFromR = GetCellStyleTop( nCol + 1, nRow );
+ const Style& rRFromB = GetCellStyleRight( nCol, nRow );
+ DiagStyle aRFromBL( GetCellStyleTR( nCol, nRow ), fAngle );
+
+ // check if current frame border can be connected to cached frame border
+ if( !CheckFrameBorderConnectable( *pStart, rCurr,
+ aEndRFromTL, rLFromT, aLFromTR, aEndRFromBL, rLFromB, aLFromBR ) )
+ {
+ // draw previous frame border
+ Point aEndPos( mxImpl->GetColPosition( nCol ), aStartPos.Y() );
+ if( pStart->Prim() && (aStartPos.X() <= aEndPos.X()) )
+ DrawHorFrameBorder( rDev, aStartPos, aEndPos, *pStart,
+ aStartLFromTR, *pStartLFromT, *pStartLFromL, *pStartLFromB, aStartLFromBR,
+ aEndRFromTL, *pEndRFromT, *pEndRFromR, *pEndRFromB, aEndRFromBL, pForceColor );
+
+ // re-init "*Start***" variables
+ aStartPos = aEndPos;
+ pStart = &rCurr;
+ aStartLFromTR = aLFromTR;
+ pStartLFromT = &rLFromT;
+ pStartLFromL = &rLFromL;
+ pStartLFromB = &rLFromB;
+ aStartLFromBR = aLFromBR;
+ }
+
+ // store current styles in "*End***" variables
+ aEndRFromTL = aRFromTL;
+ pEndRFromT = &rRFromT;
+ pEndRFromR = &rRFromR;
+ pEndRFromB = &rRFromB;
+ aEndRFromBL = aRFromBL;
+ }
+
+ // draw last frame border
+ Point aEndPos( mxImpl->GetColPosition( nCol ), aStartPos.Y() );
+ if( pStart->Prim() && (aStartPos.X() <= aEndPos.X()) )
+ DrawHorFrameBorder( rDev, aStartPos, aEndPos, *pStart,
+ aStartLFromTR, *pStartLFromT, *pStartLFromL, *pStartLFromB, aStartLFromBR,
+ aEndRFromTL, *pEndRFromT, *pEndRFromR, *pEndRFromB, aEndRFromBL, pForceColor );
+ }
+
+ // *** vertical frame borders ***
+
+ for( nCol = nFirstCol; nCol <= nLastCol + 1; ++nCol )
+ {
+ double fAngle = mxImpl->GetVerDiagAngle( nCol, nFirstRow );
+ double fLAngle = mxImpl->GetVerDiagAngle( nCol - 1, nFirstRow );
+
+ // *Start*** variables store the data of the top end of the cached frame border
+ Point aStartPos( mxImpl->GetColPosition( nCol ), mxImpl->GetRowPosition( nFirstRow ) );
+ const Style* pStart = &GetCellStyleLeft( nCol, nFirstRow );
+ DiagStyle aStartTFromBL( GetCellStyleTR( nCol - 1, nFirstRow ), fLAngle );
+ const Style* pStartTFromL = &GetCellStyleTop( nCol - 1, nFirstRow );
+ const Style* pStartTFromT = &GetCellStyleLeft( nCol, nFirstRow - 1 );
+ const Style* pStartTFromR = &GetCellStyleTop( nCol, nFirstRow );
+ DiagStyle aStartTFromBR( GetCellStyleTL( nCol, nFirstRow ), fAngle );
+
+ // *End*** variables store the data of the bottom end of the cached frame border
+ DiagStyle aEndBFromTL( GetCellStyleBR( nCol - 1, nFirstRow ), fLAngle );
+ const Style* pEndBFromL = &GetCellStyleBottom( nCol - 1, nFirstRow );
+ const Style* pEndBFromB = &GetCellStyleLeft( nCol, nFirstRow + 1 );
+ const Style* pEndBFromR = &GetCellStyleBottom( nCol, nFirstRow );
+ DiagStyle aEndBFromTR( GetCellStyleBL( nCol, nFirstRow ), fAngle );
+
+ for( nRow = nFirstRow + 1; nRow <= nLastRow; ++nRow )
+ {
+ fAngle = mxImpl->GetVerDiagAngle( nCol, nRow );
+ fLAngle = mxImpl->GetVerDiagAngle( nCol - 1, nRow );
+
+ const Style& rCurr = *pEndBFromB;
+
+ DiagStyle aTFromBL( GetCellStyleTR( nCol - 1, nRow ), fLAngle );
+ const Style& rTFromL = *pEndBFromL;
+ const Style& rTFromT = *pStart;
+ const Style& rTFromR = *pEndBFromR;
+ DiagStyle aTFromBR( GetCellStyleTL( nCol, nRow ), fAngle );
+
+ DiagStyle aBFromTL( GetCellStyleBR( nCol - 1, nRow ), fLAngle );
+ const Style& rBFromL = GetCellStyleBottom( nCol - 1, nRow );
+ const Style& rBFromB = GetCellStyleLeft( nCol, nRow + 1 );
+ const Style& rBFromR = GetCellStyleBottom( nCol, nRow );
+ DiagStyle aBFromTR( GetCellStyleBL( nCol, nRow ), fAngle );
+
+ // check if current frame border can be connected to cached frame border
+ if( !CheckFrameBorderConnectable( *pStart, rCurr,
+ aEndBFromTL, rTFromL, aTFromBL, aEndBFromTR, rTFromR, aTFromBR ) )
+ {
+ // draw previous frame border
+ Point aEndPos( aStartPos.X(), mxImpl->GetRowPosition( nRow ) );
+ if( pStart->Prim() && (aStartPos.Y() <= aEndPos.Y()) )
+ DrawVerFrameBorder( rDev, aStartPos, aEndPos, *pStart,
+ aStartTFromBL, *pStartTFromL, *pStartTFromT, *pStartTFromR, aStartTFromBR,
+ aEndBFromTL, *pEndBFromL, *pEndBFromB, *pEndBFromR, aEndBFromTR, pForceColor );
+
+ // re-init "*Start***" variables
+ aStartPos = aEndPos;
+ pStart = &rCurr;
+ aStartTFromBL = aTFromBL;
+ pStartTFromL = &rTFromL;
+ pStartTFromT = &rTFromT;
+ pStartTFromR = &rTFromR;
+ aStartTFromBR = aTFromBR;
+ }
+
+ // store current styles in "*End***" variables
+ aEndBFromTL = aBFromTL;
+ pEndBFromL = &rBFromL;
+ pEndBFromB = &rBFromB;
+ pEndBFromR = &rBFromR;
+ aEndBFromTR = aBFromTR;
+ }
+
+ // draw last frame border
+ Point aEndPos( aStartPos.X(), mxImpl->GetRowPosition( nRow ) );
+ if( pStart->Prim() && (aStartPos.Y() <= aEndPos.Y()) )
+ DrawVerFrameBorder( rDev, aStartPos, aEndPos, *pStart,
+ aStartTFromBL, *pStartTFromL, *pStartTFromT, *pStartTFromR, aStartTFromBR,
+ aEndBFromTL, *pEndBFromL, *pEndBFromB, *pEndBFromR, aEndBFromTR, pForceColor );
+ }
+}
+
+void Array::DrawArray( OutputDevice& rDev, const Color* pForceColor ) const
+{
+ if( mxImpl->mnWidth && mxImpl->mnHeight )
+ DrawRange( rDev, 0, 0, mxImpl->mnWidth - 1, mxImpl->mnHeight - 1, pForceColor );
+}
+
+// ----------------------------------------------------------------------------
+
+#undef ORIGCELLACC
+#undef ORIGCELL
+#undef CELLACC
+#undef CELL
+
+// ----------------------------------------------------------------------------
+
+#undef DBG_FRAME_CHECK_ROW_1
+#undef DBG_FRAME_CHECK_COL_1
+#undef DBG_FRAME_CHECK_INDEX
+#undef DBG_FRAME_CHECK_COLROW
+#undef DBG_FRAME_CHECK_ROW
+#undef DBG_FRAME_CHECK_COL
+#undef DBG_FRAME_CHECK
+#undef DBG_FRAME_ERROR
+
+// ============================================================================
+
+} // namespace frame
+} // namespace svx
+
diff --git a/svx/source/dialog/frmdirlbox.cxx b/svx/source/dialog/frmdirlbox.cxx
new file mode 100644
index 000000000000..dcfc14afcacd
--- /dev/null
+++ b/svx/source/dialog/frmdirlbox.cxx
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/frmdirlbox.hxx>
+
+namespace svx {
+
+// ============================================================================
+
+namespace {
+
+inline void* lclEnumToVoid( SvxFrameDirection eDirection )
+{
+ return reinterpret_cast< void* >( static_cast< sal_uInt32 >( eDirection ) );
+}
+
+inline SvxFrameDirection lclVoidToEnum( void* pDirection )
+{
+ return static_cast< SvxFrameDirection >( reinterpret_cast< sal_IntPtr >( pDirection ) );
+}
+
+} // namespace
+
+// ============================================================================
+
+FrameDirectionListBox::FrameDirectionListBox( Window* pParent, WinBits nStyle ) :
+ ListBox( pParent, nStyle )
+{
+}
+
+FrameDirectionListBox::FrameDirectionListBox( Window* pParent, const ResId& rResId ) :
+ ListBox( pParent, rResId )
+{
+}
+
+FrameDirectionListBox::~FrameDirectionListBox()
+{
+}
+
+void FrameDirectionListBox::InsertEntryValue( const String& rString, SvxFrameDirection eDirection, sal_uInt16 nPos )
+{
+ sal_uInt16 nRealPos = InsertEntry( rString, nPos );
+ SetEntryData( nRealPos, lclEnumToVoid( eDirection ) );
+}
+
+void FrameDirectionListBox::RemoveEntryValue( SvxFrameDirection eDirection )
+{
+ sal_uInt16 nPos = GetEntryPos( lclEnumToVoid( eDirection ) );
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ RemoveEntry( nPos );
+}
+
+void FrameDirectionListBox::SelectEntryValue( SvxFrameDirection eDirection )
+{
+ sal_uInt16 nPos = GetEntryPos( lclEnumToVoid( eDirection ) );
+ if( nPos == LISTBOX_ENTRY_NOTFOUND )
+ SetNoSelection();
+ else
+ SelectEntryPos( nPos );
+}
+
+SvxFrameDirection FrameDirectionListBox::GetSelectEntryValue() const
+{
+ sal_uInt16 nPos = GetSelectEntryPos();
+ if( nPos == LISTBOX_ENTRY_NOTFOUND )
+ return static_cast< SvxFrameDirection >( 0xFFFF );
+ return lclVoidToEnum( GetEntryData( nPos ) );
+}
+
+// ============================================================================
+
+FrameDirListBoxWrapper::FrameDirListBoxWrapper( FrameDirListBox& rListBox ) :
+ SingleControlWrapperType( rListBox )
+{
+}
+
+bool FrameDirListBoxWrapper::IsControlDontKnow() const
+{
+ return GetControl().GetSelectEntryCount() == 0;
+}
+
+void FrameDirListBoxWrapper::SetControlDontKnow( bool bSet )
+{
+ if( bSet )
+ GetControl().SetNoSelection();
+}
+
+SvxFrameDirection FrameDirListBoxWrapper::GetControlValue() const
+{
+ return GetControl().GetSelectEntryValue();
+}
+
+void FrameDirListBoxWrapper::SetControlValue( SvxFrameDirection eValue )
+{
+ GetControl().SelectEntryValue( eValue );
+}
+
+// ============================================================================
+
+} // namespace svx
+
diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx
new file mode 100644
index 000000000000..d25473f32570
--- /dev/null
+++ b/svx/source/dialog/frmsel.cxx
@@ -0,0 +1,1205 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/frmsel.hxx>
+
+#include <algorithm>
+#include <math.h>
+#include "frmselimpl.hxx"
+#include "AccessibleFrameSelector.hxx"
+#include <svx/dialmgr.hxx>
+
+#ifndef _SVX_DIALOGS_HRC
+#include <svx/dialogs.hrc>
+#endif
+#ifndef SVX_FRMSEL_HRC
+#include "frmsel.hrc"
+#endif
+
+#include <tools/rcid.h>
+
+namespace svx {
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::accessibility::XAccessible;
+
+// ============================================================================
+// global functions from framebordertype.hxx
+
+FrameBorderType GetFrameBorderTypeFromIndex( size_t nIndex )
+{
+ DBG_ASSERT( nIndex < (size_t)FRAMEBORDERTYPE_COUNT,
+ "svx::GetFrameBorderTypeFromIndex - invalid index" );
+ return static_cast< FrameBorderType >( nIndex + 1 );
+}
+
+size_t GetIndexFromFrameBorderType( FrameBorderType eBorder )
+{
+ DBG_ASSERT( eBorder != FRAMEBORDER_NONE,
+ "svx::GetIndexFromFrameBorderType - invalid frame border type" );
+ return static_cast< size_t >( eBorder ) - 1;
+}
+
+// ============================================================================
+
+namespace {
+
+/** Space between outer control border and any graphical element of the control. */
+const long FRAMESEL_GEOM_OUTER = 2;
+
+/** Space between arrows and usable inner area. */
+const long FRAMESEL_GEOM_INNER = 3;
+
+/** Maximum width to draw a frame border style. */
+const long FRAMESEL_GEOM_WIDTH = 9;
+
+/** Additional margin for click area of outer lines. */
+const long FRAMESEL_GEOM_ADD_CLICK_OUTER = 5;
+
+/** Additional margin for click area of inner lines. */
+const long FRAMESEL_GEOM_ADD_CLICK_INNER = 2;
+
+// ----------------------------------------------------------------------------
+
+static const frame::Style OBJ_FRAMESTYLE_DONTCARE( 3, 0, 0 );
+static const FrameBorder OBJ_FRAMEBORDER_NONE( FRAMEBORDER_NONE );
+
+// ----------------------------------------------------------------------------
+
+/** Returns the corresponding flag for a frame border. */
+FrameSelFlags lclGetFlagFromType( FrameBorderType eBorder )
+{
+ switch( eBorder )
+ {
+ case FRAMEBORDER_LEFT: return FRAMESEL_LEFT;
+ case FRAMEBORDER_RIGHT: return FRAMESEL_RIGHT;
+ case FRAMEBORDER_TOP: return FRAMESEL_TOP;
+ case FRAMEBORDER_BOTTOM: return FRAMESEL_BOTTOM;
+ case FRAMEBORDER_HOR: return FRAMESEL_INNER_HOR;
+ case FRAMEBORDER_VER: return FRAMESEL_INNER_VER;
+ case FRAMEBORDER_TLBR: return FRAMESEL_DIAG_TLBR;
+ case FRAMEBORDER_BLTR: return FRAMESEL_DIAG_BLTR;
+ case FRAMEBORDER_NONE : break;
+ }
+ return FRAMESEL_NONE;
+}
+
+/** Converts an SvxBorderLine line width (in twips) to a pixel line width. */
+inline sal_uInt16 lclGetPixel( sal_uInt16 nWidth )
+{
+ // convert all core styles expect 0 to a visible UI style (at least 1 pixel), map 1pt to 1pixel
+ return nWidth ? std::min< sal_uInt16 >( std::max< sal_uInt16 >( (nWidth + 5) / 20, 1 ), FRAMESEL_GEOM_WIDTH ) : 0;
+}
+
+/** Merges the rSource polypolygon into the rDest polypolygon. */
+inline void lclPolyPolyUnion( PolyPolygon& rDest, const PolyPolygon& rSource )
+{
+ const PolyPolygon aTmp( rDest );
+ aTmp.GetUnion( rSource, rDest );
+}
+
+} // namespace
+
+// ============================================================================
+// FrameBorder
+// ============================================================================
+
+FrameBorder::FrameBorder( FrameBorderType eType ) :
+ meType( eType ),
+ meState( FRAMESTATE_HIDE ),
+ meKeyLeft( FRAMEBORDER_NONE ),
+ meKeyRight( FRAMEBORDER_NONE ),
+ meKeyTop( FRAMEBORDER_NONE ),
+ meKeyBottom( FRAMEBORDER_NONE ),
+ mbEnabled( false ),
+ mbSelected( false )
+{
+}
+
+void FrameBorder::Enable( FrameSelFlags nFlags )
+{
+ mbEnabled = (nFlags & lclGetFlagFromType( meType )) != 0;
+ if( !mbEnabled )
+ SetState( FRAMESTATE_HIDE );
+}
+
+void FrameBorder::SetCoreStyle( const SvxBorderLine* pStyle )
+{
+ if( pStyle )
+ maCoreStyle = *pStyle;
+ else
+ maCoreStyle = SvxBorderLine();
+
+ // from twips to points
+ maUIStyle.Set( maCoreStyle, 0.05, FRAMESEL_GEOM_WIDTH, true );
+ meState = maUIStyle.Prim() ? FRAMESTATE_SHOW : FRAMESTATE_HIDE;
+}
+
+void FrameBorder::SetState( FrameBorderState eState )
+{
+ meState = eState;
+ switch( meState )
+ {
+ case FRAMESTATE_SHOW:
+ DBG_ERRORFILE( "svx::FrameBorder::SetState - use SetCoreStyle to make border visible" );
+ break;
+ case FRAMESTATE_HIDE:
+ maCoreStyle = SvxBorderLine();
+ maUIStyle.Clear();
+ break;
+ case FRAMESTATE_DONTCARE:
+ maCoreStyle = SvxBorderLine();
+ maUIStyle = OBJ_FRAMESTYLE_DONTCARE;
+ break;
+ }
+}
+
+void FrameBorder::AddFocusPolygon( const Polygon& rFocus )
+{
+ lclPolyPolyUnion( maFocusArea, rFocus );
+}
+
+void FrameBorder::MergeFocusToPolyPolygon( PolyPolygon& rPPoly ) const
+{
+ lclPolyPolyUnion( rPPoly, maFocusArea );
+}
+
+void FrameBorder::AddClickRect( const Rectangle& rRect )
+{
+ lclPolyPolyUnion( maClickArea, Polygon( rRect ) );
+}
+
+bool FrameBorder::ContainsClickPoint( const Point& rPos ) const
+{
+ return Region( maClickArea ).IsInside( rPos );
+}
+
+void FrameBorder::MergeClickAreaToPolyPolygon( PolyPolygon& rPPoly ) const
+{
+ lclPolyPolyUnion( rPPoly, maClickArea );
+}
+
+Rectangle FrameBorder::GetClickBoundRect() const
+{
+ return maClickArea.GetBoundRect();
+}
+
+void FrameBorder::SetKeyboardNeighbors(
+ FrameBorderType eLeft, FrameBorderType eRight, FrameBorderType eTop, FrameBorderType eBottom )
+{
+ meKeyLeft = eLeft;
+ meKeyRight = eRight;
+ meKeyTop = eTop;
+ meKeyBottom = eBottom;
+}
+
+FrameBorderType FrameBorder::GetKeyboardNeighbor( sal_uInt16 nKeyCode ) const
+{
+ FrameBorderType eBorder = FRAMEBORDER_NONE;
+ switch( nKeyCode )
+ {
+ case KEY_LEFT: eBorder = meKeyLeft; break;
+ case KEY_RIGHT: eBorder = meKeyRight; break;
+ case KEY_UP: eBorder = meKeyTop; break;
+ case KEY_DOWN: eBorder = meKeyBottom; break;
+ default: DBG_ERRORFILE( "svx::FrameBorder::GetKeyboardNeighbor - unknown key code" );
+ }
+ return eBorder;
+}
+
+// ============================================================================
+// FrameSelectorImpl
+// ============================================================================
+
+FrameSelectorImpl::FrameSelectorImpl( FrameSelector& rFrameSel ) :
+ Resource( SVX_RES( RID_SVXSTR_BORDER_CONTROL ) ),
+ mrFrameSel( rFrameSel ),
+ maILArrows( 16 ),
+ maLeft( FRAMEBORDER_LEFT ),
+ maRight( FRAMEBORDER_RIGHT ),
+ maTop( FRAMEBORDER_TOP ),
+ maBottom( FRAMEBORDER_BOTTOM ),
+ maHor( FRAMEBORDER_HOR ),
+ maVer( FRAMEBORDER_VER ),
+ maTLBR( FRAMEBORDER_TLBR ),
+ maBLTR( FRAMEBORDER_BLTR ),
+ mnFlags( FRAMESEL_OUTER ),
+ mbHor( false ),
+ mbVer( false ),
+ mbTLBR( false ),
+ mbBLTR( false ),
+ mbFullRepaint( true ),
+ mbAutoSelect( true ),
+ mbClicked( false ),
+ mbHCMode( false ),
+ mpAccess( 0 ),
+ maChildVec( 8, static_cast< a11y::AccFrameSelector* >( 0 ) ),
+ mxChildVec( 8 )
+{
+ FreeResource();
+
+ maAllBorders.resize( FRAMEBORDERTYPE_COUNT, 0 );
+ maAllBorders[ GetIndexFromFrameBorderType( FRAMEBORDER_LEFT ) ] = &maLeft;
+ maAllBorders[ GetIndexFromFrameBorderType( FRAMEBORDER_RIGHT ) ] = &maRight;
+ maAllBorders[ GetIndexFromFrameBorderType( FRAMEBORDER_TOP ) ] = &maTop;
+ maAllBorders[ GetIndexFromFrameBorderType( FRAMEBORDER_BOTTOM ) ] = &maBottom;
+ maAllBorders[ GetIndexFromFrameBorderType( FRAMEBORDER_HOR ) ] = &maHor;
+ maAllBorders[ GetIndexFromFrameBorderType( FRAMEBORDER_VER ) ] = &maVer;
+ maAllBorders[ GetIndexFromFrameBorderType( FRAMEBORDER_TLBR ) ] = &maTLBR;
+ maAllBorders[ GetIndexFromFrameBorderType( FRAMEBORDER_BLTR ) ] = &maBLTR;
+#if OSL_DEBUG_LEVEL >= 2
+ {
+ bool bOk = true;
+ for( FrameBorderCIter aIt( maAllBorders ); bOk && aIt.Is(); bOk = (*aIt != 0), ++aIt );
+ DBG_ASSERT( bOk, "svx::FrameSelectorImpl::FrameSelectorImpl - missing entry in maAllBorders" );
+ }
+#endif
+ // left neighbor right neighbor upper neighbor lower neighbor
+ maLeft.SetKeyboardNeighbors( FRAMEBORDER_NONE, FRAMEBORDER_TLBR, FRAMEBORDER_TOP, FRAMEBORDER_BOTTOM );
+ maRight.SetKeyboardNeighbors( FRAMEBORDER_BLTR, FRAMEBORDER_NONE, FRAMEBORDER_TOP, FRAMEBORDER_BOTTOM );
+ maTop.SetKeyboardNeighbors( FRAMEBORDER_LEFT, FRAMEBORDER_RIGHT, FRAMEBORDER_NONE, FRAMEBORDER_TLBR );
+ maBottom.SetKeyboardNeighbors( FRAMEBORDER_LEFT, FRAMEBORDER_RIGHT, FRAMEBORDER_BLTR, FRAMEBORDER_NONE );
+ maHor.SetKeyboardNeighbors( FRAMEBORDER_LEFT, FRAMEBORDER_RIGHT, FRAMEBORDER_TLBR, FRAMEBORDER_BLTR );
+ maVer.SetKeyboardNeighbors( FRAMEBORDER_TLBR, FRAMEBORDER_BLTR, FRAMEBORDER_TOP, FRAMEBORDER_BOTTOM );
+ maTLBR.SetKeyboardNeighbors( FRAMEBORDER_LEFT, FRAMEBORDER_VER, FRAMEBORDER_TOP, FRAMEBORDER_HOR );
+ maBLTR.SetKeyboardNeighbors( FRAMEBORDER_VER, FRAMEBORDER_RIGHT, FRAMEBORDER_HOR, FRAMEBORDER_BOTTOM );
+}
+
+FrameSelectorImpl::~FrameSelectorImpl()
+{
+ if( mpAccess )
+ mpAccess->Invalidate();
+ for( AccessibleImplVec::iterator aIt = maChildVec.begin(), aEnd = maChildVec.end(); aIt != aEnd; ++aIt )
+ if( *aIt )
+ (*aIt)->Invalidate();
+}
+
+// initialization -------------------------------------------------------------
+
+void FrameSelectorImpl::Initialize( FrameSelFlags nFlags )
+{
+ mnFlags = nFlags;
+
+ maEnabBorders.clear();
+ for( FrameBorderIter aIt( maAllBorders ); aIt.Is(); ++aIt )
+ {
+ (*aIt)->Enable( mnFlags );
+ if( (*aIt)->IsEnabled() )
+ maEnabBorders.push_back( *aIt );
+ }
+ mbHor = maHor.IsEnabled();
+ mbVer = maVer.IsEnabled();
+ mbTLBR = maTLBR.IsEnabled();
+ mbBLTR = maBLTR.IsEnabled();
+
+ InitVirtualDevice();
+}
+
+void FrameSelectorImpl::InitColors()
+{
+ const StyleSettings& rSett = mrFrameSel.GetSettings().GetStyleSettings();
+ maBackCol = rSett.GetFieldColor();
+ mbHCMode = rSett.GetHighContrastMode();
+ maArrowCol = rSett.GetFieldTextColor();
+ maMarkCol.operator=( maBackCol ).Merge( maArrowCol, mbHCMode ? 0x80 : 0xC0 );
+ maHCLineCol = rSett.GetLabelTextColor();
+}
+
+void FrameSelectorImpl::InitArrowImageList()
+{
+ /* Build the arrow images bitmap with current colors. */
+ Color pColorAry1[3];
+ Color pColorAry2[3];
+ pColorAry1[0] = Color( 0, 0, 0 );
+ pColorAry2[0] = maArrowCol; // black -> arrow color
+ pColorAry1[1] = Color( 0, 255, 0 );
+ pColorAry2[1] = maMarkCol; // green -> marker color
+ pColorAry1[2] = Color( 255, 0, 255 );
+ pColorAry2[2] = maBackCol; // magenta -> background
+
+ GetRes( SVX_RES( RID_SVXSTR_BORDER_CONTROL ).SetRT( RSC_RESOURCE ) );
+ maILArrows.InsertFromHorizontalBitmap(
+ SVX_RES( BMP_FRMSEL_ARROWS ), 16, NULL, pColorAry1, pColorAry2, 3);
+ FreeResource();
+ DBG_ASSERT( maILArrows.GetImageSize().Height() == maILArrows.GetImageSize().Width(),
+ "svx::FrameSelectorImpl::InitArrowImageList - images are not squarish" );
+ mnArrowSize = maILArrows.GetImageSize().Height();
+}
+
+void FrameSelectorImpl::InitGlobalGeometry()
+{
+ Size aCtrlSize( mrFrameSel.CalcOutputSize( mrFrameSel.GetSizePixel() ) );
+ /* nMinSize is the lower of width and height (control will always be squarish).
+ FRAMESEL_GEOM_OUTER is the minimal distance between inner control border
+ and any element. */
+ long nMinSize = Min( aCtrlSize.Width(), aCtrlSize.Height() ) - 2 * FRAMESEL_GEOM_OUTER;
+ /* nFixedSize is the size all existing elements need in one direction:
+ the diag. arrow, space betw. arrow and frame border, outer frame border,
+ inner frame border, other outer frame border, space betw. frame border
+ and arrow, the other arrow. */
+ long nFixedSize = 2 * mnArrowSize + 2 * FRAMESEL_GEOM_INNER + 3 * FRAMESEL_GEOM_WIDTH;
+ /* nBetwBordersSize contains the size between an outer and inner frame border (made odd). */
+ long nBetwBordersSize = (((nMinSize - nFixedSize) / 2) - 1) | 1;
+
+ /* The final size of the usable area. */
+ mnCtrlSize = 2 * nBetwBordersSize + nFixedSize;
+ maVirDev.SetOutputSizePixel( Size( mnCtrlSize, mnCtrlSize ) );
+
+ /* Center the virtual device in the control. */
+ maVirDevPos = Point( (aCtrlSize.Width() - mnCtrlSize) / 2, (aCtrlSize.Height() - mnCtrlSize) / 2 );
+}
+
+void FrameSelectorImpl::InitBorderGeometry()
+{
+ size_t nCol, nCols, nRow, nRows;
+
+ // Global border geometry values ------------------------------------------
+
+ /* mnLine* is the middle point inside a frame border (i.e. mnLine1 is mid X inside left border). */
+ mnLine1 = mnArrowSize + FRAMESEL_GEOM_INNER + FRAMESEL_GEOM_WIDTH / 2;
+ mnLine2 = mnCtrlSize / 2;
+ mnLine3 = 2 * mnLine2 - mnLine1;
+
+ // Frame helper array -----------------------------------------------------
+
+ maArray.Initialize( mbVer ? 2 : 1, mbHor ? 2 : 1 );
+ maArray.SetUseDiagDoubleClipping( true );
+
+ maArray.SetXOffset( mnLine1 );
+ maArray.SetAllColWidths( (mbVer ? mnLine2 : mnLine3) - mnLine1 );
+
+ maArray.SetYOffset( mnLine1 );
+ maArray.SetAllRowHeights( (mbHor ? mnLine2 : mnLine3) - mnLine1 );
+
+ Rectangle aTLRect( maArray.GetCellRect( 0, 0 ) );
+
+ // Focus polygons ---------------------------------------------------------
+
+ /* Width for focus rectangles from center of frame borders. */
+ mnFocusOffs = FRAMESEL_GEOM_WIDTH / 2 + 1;
+
+ maLeft.AddFocusPolygon( Rectangle( mnLine1 - mnFocusOffs, mnLine1 - mnFocusOffs, mnLine1 + mnFocusOffs, mnLine3 + mnFocusOffs ) );
+ maVer.AddFocusPolygon( Rectangle( mnLine2 - mnFocusOffs, mnLine1 - mnFocusOffs, mnLine2 + mnFocusOffs, mnLine3 + mnFocusOffs ) );
+ maRight.AddFocusPolygon( Rectangle( mnLine3 - mnFocusOffs, mnLine1 - mnFocusOffs, mnLine3 + mnFocusOffs, mnLine3 + mnFocusOffs ) );
+ maTop.AddFocusPolygon( Rectangle( mnLine1 - mnFocusOffs, mnLine1 - mnFocusOffs, mnLine3 + mnFocusOffs, mnLine1 + mnFocusOffs ) );
+ maHor.AddFocusPolygon( Rectangle( mnLine1 - mnFocusOffs, mnLine2 - mnFocusOffs, mnLine3 + mnFocusOffs, mnLine2 + mnFocusOffs ) );
+ maBottom.AddFocusPolygon( Rectangle( mnLine1 - mnFocusOffs, mnLine3 - mnFocusOffs, mnLine3 + mnFocusOffs, mnLine3 + mnFocusOffs ) );
+
+ for( nCol = 0, nCols = maArray.GetColCount(); nCol < nCols; ++nCol )
+ {
+ for( nRow = 0, nRows = maArray.GetRowCount(); nRow < nRows; ++nRow )
+ {
+ Rectangle aRect( maArray.GetCellRect( nCol, nRow ) );
+ long nDiagFocusOffsX = frame::GetTLDiagOffset( -mnFocusOffs, mnFocusOffs, maArray.GetHorDiagAngle( nCol, nRow ) );
+ long nDiagFocusOffsY = frame::GetTLDiagOffset( -mnFocusOffs, mnFocusOffs, maArray.GetVerDiagAngle( nCol, nRow ) );
+
+ std::vector< Point > aFocusVec;
+ aFocusVec.push_back( Point( aRect.Left() - mnFocusOffs, aRect.Top() + nDiagFocusOffsY ) );
+ aFocusVec.push_back( Point( aRect.Left() - mnFocusOffs, aRect.Top() - mnFocusOffs ) );
+ aFocusVec.push_back( Point( aRect.Left() + nDiagFocusOffsX, aRect.Top() - mnFocusOffs ) );
+ aFocusVec.push_back( Point( aRect.Right() + mnFocusOffs, aRect.Bottom() - nDiagFocusOffsY ) );
+ aFocusVec.push_back( Point( aRect.Right() + mnFocusOffs, aRect.Bottom() + mnFocusOffs ) );
+ aFocusVec.push_back( Point( aRect.Right() - nDiagFocusOffsX, aRect.Bottom() + mnFocusOffs ) );
+ maTLBR.AddFocusPolygon( Polygon( static_cast< sal_uInt16 >( aFocusVec.size() ), &aFocusVec[ 0 ] ) );
+
+ aFocusVec.clear();
+ aFocusVec.push_back( Point( aRect.Right() + mnFocusOffs, aRect.Top() + nDiagFocusOffsY ) );
+ aFocusVec.push_back( Point( aRect.Right() + mnFocusOffs, aRect.Top() - mnFocusOffs ) );
+ aFocusVec.push_back( Point( aRect.Right() - nDiagFocusOffsX, aRect.Top() - mnFocusOffs ) );
+ aFocusVec.push_back( Point( aRect.Left() - mnFocusOffs, aRect.Bottom() - nDiagFocusOffsY ) );
+ aFocusVec.push_back( Point( aRect.Left() - mnFocusOffs, aRect.Bottom() + mnFocusOffs ) );
+ aFocusVec.push_back( Point( aRect.Left() + nDiagFocusOffsX, aRect.Bottom() + mnFocusOffs ) );
+ maBLTR.AddFocusPolygon( Polygon( static_cast< sal_uInt16 >( aFocusVec.size() ), &aFocusVec[ 0 ] ) );
+ }
+ }
+
+ // Click areas ------------------------------------------------------------
+
+ for( FrameBorderIter aIt( maAllBorders ); aIt.Is(); ++aIt )
+ (*aIt)->ClearClickArea();
+
+ /* Additional space for click area: is added to the space available to draw
+ the frame borders. For instance left frame border:
+ - To left, top, and bottom always big additional space (outer area).
+ - To right: Dependent on existence of inner vertical frame border
+ (if enabled, use less space).
+ */
+ long nClO = FRAMESEL_GEOM_WIDTH / 2 + FRAMESEL_GEOM_ADD_CLICK_OUTER;
+ long nClI = (mbTLBR && mbBLTR) ? (FRAMESEL_GEOM_WIDTH / 2 + FRAMESEL_GEOM_ADD_CLICK_INNER) : nClO;
+ long nClH = mbHor ? nClI : nClO; // additional space dependent of horizontal inner border
+ long nClV = mbVer ? nClI : nClO; // additional space dependent of vertical inner border
+
+ maLeft.AddClickRect( Rectangle( mnLine1 - nClO, mnLine1 - nClO, mnLine1 + nClV, mnLine3 + nClO ) );
+ maVer.AddClickRect( Rectangle( mnLine2 - nClI, mnLine1 - nClO, mnLine2 + nClI, mnLine3 + nClO ) );
+ maRight.AddClickRect( Rectangle( mnLine3 - nClV, mnLine1 - nClO, mnLine3 + nClO, mnLine3 + nClO ) );
+ maTop.AddClickRect( Rectangle( mnLine1 - nClO, mnLine1 - nClO, mnLine3 + nClO, mnLine1 + nClH ) );
+ maHor.AddClickRect( Rectangle( mnLine1 - nClO, mnLine2 - nClI, mnLine3 + nClO, mnLine2 + nClI ) );
+ maBottom.AddClickRect( Rectangle( mnLine1 - nClO, mnLine3 - nClH, mnLine3 + nClO, mnLine3 + nClO ) );
+
+ /* Diagonal frame borders use the remaining space between outer and inner frame borders. */
+ if( mbTLBR || mbBLTR )
+ {
+ for( nCol = 0, nCols = maArray.GetColCount(); nCol < nCols; ++nCol )
+ {
+ for( nRow = 0, nRows = maArray.GetRowCount(); nRow < nRows; ++nRow )
+ {
+ // the usable area between horizonal/vertical frame borders of current quadrant
+ Rectangle aRect( maArray.GetCellRect( nCol, nRow ) );
+ aRect.Left() += nClV + 1;
+ aRect.Right() -= nClV + 1;
+ aRect.Top() += nClH + 1;
+ aRect.Bottom() -= nClH + 1;
+
+ /* Both diagonal frame borders enabled. */
+ if( mbTLBR && mbBLTR )
+ {
+ // single areas
+ Point aMid( aRect.Center() );
+ maTLBR.AddClickRect( Rectangle( aRect.TopLeft(), aMid ) );
+ maTLBR.AddClickRect( Rectangle( aMid + Point( 1, 1 ), aRect.BottomRight() ) );
+ maBLTR.AddClickRect( Rectangle( aRect.Left(), aMid.Y() + 1, aMid.X(), aRect.Bottom() ) );
+ maBLTR.AddClickRect( Rectangle( aMid.X() + 1, aRect.Top(), aRect.Right(), aMid.Y() ) );
+ // centered rectangle for both frame borders
+ Rectangle aMidRect( aRect.TopLeft(), Size( aRect.GetWidth() / 3, aRect.GetHeight() / 3 ) );
+ aMidRect.Move( (aRect.GetWidth() - aMidRect.GetWidth()) / 2, (aRect.GetHeight() - aMidRect.GetHeight()) / 2 );
+ maTLBR.AddClickRect( aMidRect );
+ maBLTR.AddClickRect( aMidRect );
+ }
+ /* One of the diagonal frame borders enabled - use entire rectangle. */
+ else if( mbTLBR && !mbBLTR ) // top-left to bottom-right only
+ maTLBR.AddClickRect( aRect );
+ else if( !mbTLBR && mbBLTR ) // bottom-left to top-right only
+ maBLTR.AddClickRect( aRect );
+ }
+ }
+ }
+}
+
+void FrameSelectorImpl::InitVirtualDevice()
+{
+ // initialize resources
+ InitColors();
+ InitArrowImageList();
+
+ // initialize geometry
+ InitGlobalGeometry();
+ InitBorderGeometry();
+
+ // correct background around the used area
+ mrFrameSel.SetBackground( Wallpaper( maBackCol ) );
+ DoInvalidate( true );
+}
+
+// frame border access --------------------------------------------------------
+
+const FrameBorder& FrameSelectorImpl::GetBorder( FrameBorderType eBorder ) const
+{
+ size_t nIndex = GetIndexFromFrameBorderType( eBorder );
+ if( nIndex < maAllBorders.size() )
+ return *maAllBorders[ nIndex ];
+ DBG_ERRORFILE( "svx::FrameSelectorImpl::GetBorder - unknown border type" );
+ return maTop;
+}
+
+FrameBorder& FrameSelectorImpl::GetBorderAccess( FrameBorderType eBorder )
+{
+ return const_cast< FrameBorder& >( GetBorder( eBorder ) );
+}
+
+// drawing --------------------------------------------------------------------
+
+void FrameSelectorImpl::DrawBackground()
+{
+ // clear the area
+ maVirDev.SetLineColor();
+ maVirDev.SetFillColor( maBackCol );
+ maVirDev.DrawRect( Rectangle( Point( 0, 0 ), maVirDev.GetOutputSizePixel() ) );
+
+ // draw the inner gray (or whatever color) rectangle
+ maVirDev.SetLineColor();
+ maVirDev.SetFillColor( maMarkCol );
+ maVirDev.DrawRect( Rectangle(
+ mnLine1 - mnFocusOffs, mnLine1 - mnFocusOffs, mnLine3 + mnFocusOffs, mnLine3 + mnFocusOffs ) );
+
+ // draw the white space for enabled frame borders
+ PolyPolygon aPPoly;
+ for( FrameBorderCIter aIt( maEnabBorders ); aIt.Is(); ++aIt )
+ (*aIt)->MergeFocusToPolyPolygon( aPPoly );
+ aPPoly.Optimize( POLY_OPTIMIZE_CLOSE );
+ maVirDev.SetLineColor( maBackCol );
+ maVirDev.SetFillColor( maBackCol );
+ maVirDev.DrawPolyPolygon( aPPoly );
+}
+
+void FrameSelectorImpl::DrawArrows( const FrameBorder& rBorder )
+{
+ DBG_ASSERT( rBorder.IsEnabled(), "svx::FrameSelectorImpl::DrawArrows - access to disabled border" );
+
+ long nLinePos = 0;
+ switch( rBorder.GetType() )
+ {
+ case FRAMEBORDER_LEFT:
+ case FRAMEBORDER_TOP: nLinePos = mnLine1; break;
+ case FRAMEBORDER_VER:
+ case FRAMEBORDER_HOR: nLinePos = mnLine2; break;
+ case FRAMEBORDER_RIGHT:
+ case FRAMEBORDER_BOTTOM: nLinePos = mnLine3; break;
+ default: ; //prevent warning
+ }
+ nLinePos -= mnArrowSize / 2;
+
+ long nTLPos = 0;
+ long nBRPos = mnCtrlSize - mnArrowSize;
+ Point aPos1, aPos2;
+ sal_uInt16 nImgId1 = 0, nImgId2 = 0;
+ switch( rBorder.GetType() )
+ {
+ case FRAMEBORDER_LEFT:
+ case FRAMEBORDER_RIGHT:
+ case FRAMEBORDER_VER:
+ aPos1 = Point( nLinePos, nTLPos ); nImgId1 = 1;
+ aPos2 = Point( nLinePos, nBRPos ); nImgId2 = 2;
+ break;
+
+ case FRAMEBORDER_TOP:
+ case FRAMEBORDER_BOTTOM:
+ case FRAMEBORDER_HOR:
+ aPos1 = Point( nTLPos, nLinePos ); nImgId1 = 3;
+ aPos2 = Point( nBRPos, nLinePos ); nImgId2 = 4;
+ break;
+
+ case FRAMEBORDER_TLBR:
+ aPos1 = Point( nTLPos, nTLPos ); nImgId1 = 5;
+ aPos2 = Point( nBRPos, nBRPos ); nImgId2 = 6;
+ break;
+ case FRAMEBORDER_BLTR:
+ aPos1 = Point( nTLPos, nBRPos ); nImgId1 = 7;
+ aPos2 = Point( nBRPos, nTLPos ); nImgId2 = 8;
+ break;
+ default: ; //prevent warning
+ }
+
+ // Arrow or marker? Do not draw arrows into disabled control.
+ sal_uInt16 nSelectAdd = (mrFrameSel.IsEnabled() && rBorder.IsSelected()) ? 0 : 8;
+ maVirDev.DrawImage( aPos1, maILArrows.GetImage( nImgId1 + nSelectAdd ) );
+ maVirDev.DrawImage( aPos2, maILArrows.GetImage( nImgId2 + nSelectAdd ) );
+}
+
+void FrameSelectorImpl::DrawAllArrows()
+{
+ for( FrameBorderCIter aIt( maEnabBorders ); aIt.Is(); ++aIt )
+ DrawArrows( **aIt );
+}
+
+Color FrameSelectorImpl::GetDrawLineColor( const Color& rColor ) const
+{
+ Color aColor( mbHCMode ? maHCLineCol : rColor );
+ if( aColor == maBackCol )
+ aColor.Invert();
+ return aColor;
+}
+
+void FrameSelectorImpl::DrawAllFrameBorders()
+{
+ // Translate core colors to current UI colors (regards current background and HC mode).
+ for( FrameBorderIter aIt( maEnabBorders ); aIt.Is(); ++aIt )
+ {
+ Color aCoreColor = ((*aIt)->GetState() == FRAMESTATE_DONTCARE) ? maMarkCol : (*aIt)->GetCoreStyle().GetColor();
+ (*aIt)->SetUIColor( GetDrawLineColor( aCoreColor ) );
+ }
+
+ // Copy all frame border styles to the helper array
+ maArray.SetColumnStyleLeft( 0, maLeft.GetUIStyle() );
+ if( mbVer ) maArray.SetColumnStyleLeft( 1, maVer.GetUIStyle() );
+ maArray.SetColumnStyleRight( mbVer ? 1 : 0, maRight.GetUIStyle() );
+
+ maArray.SetRowStyleTop( 0, maTop.GetUIStyle() );
+ if( mbHor ) maArray.SetRowStyleTop( 1, maHor.GetUIStyle() );
+ maArray.SetRowStyleBottom( mbHor ? 1 : 0, maBottom.GetUIStyle() );
+
+ for( size_t nCol = 0; nCol < maArray.GetColCount(); ++nCol )
+ for( size_t nRow = 0; nRow < maArray.GetRowCount(); ++nRow )
+ maArray.SetCellStyleDiag( nCol, nRow, maTLBR.GetUIStyle(), maBLTR.GetUIStyle() );
+
+ // Let the helper array draw itself
+ maArray.DrawArray( maVirDev );
+}
+
+void FrameSelectorImpl::DrawVirtualDevice()
+{
+ DrawBackground();
+ DrawAllArrows();
+ DrawAllFrameBorders();
+ mbFullRepaint = false;
+}
+
+void FrameSelectorImpl::CopyVirDevToControl()
+{
+ if( mbFullRepaint )
+ DrawVirtualDevice();
+ mrFrameSel.DrawBitmap( maVirDevPos, maVirDev.GetBitmap( Point( 0, 0 ), maVirDev.GetOutputSizePixel() ) );
+}
+
+void FrameSelectorImpl::DrawAllTrackingRects()
+{
+ PolyPolygon aPPoly;
+ if( mrFrameSel.IsAnyBorderSelected() )
+ {
+ for( SelFrameBorderCIter aIt( maEnabBorders ); aIt.Is(); ++aIt )
+ (*aIt)->MergeFocusToPolyPolygon( aPPoly );
+ aPPoly.Move( maVirDevPos.X(), maVirDevPos.Y() );
+ }
+ else
+ // no frame border selected -> draw tracking rectangle around entire control
+ aPPoly.Insert( Polygon( Rectangle( maVirDevPos, maVirDev.GetOutputSizePixel() ) ) );
+
+ aPPoly.Optimize( POLY_OPTIMIZE_CLOSE );
+ for( sal_uInt16 nIdx = 0, nCount = aPPoly.Count(); nIdx < nCount; ++nIdx )
+ mrFrameSel.InvertTracking( aPPoly.GetObject( nIdx ), SHOWTRACK_SMALL | SHOWTRACK_WINDOW );
+}
+
+Point FrameSelectorImpl::GetDevPosFromMousePos( const Point& rMousePos ) const
+{
+ return rMousePos - maVirDevPos;
+}
+
+void FrameSelectorImpl::DoInvalidate( bool bFullRepaint )
+{
+ mbFullRepaint |= bFullRepaint;
+ mrFrameSel.Invalidate( INVALIDATE_NOERASE );
+}
+
+// frame border state and style -----------------------------------------------
+
+void FrameSelectorImpl::SetBorderState( FrameBorder& rBorder, FrameBorderState eState )
+{
+ DBG_ASSERT( rBorder.IsEnabled(), "svx::FrameSelectorImpl::SetBorderState - access to disabled border" );
+ if( eState == FRAMESTATE_SHOW )
+ SetBorderCoreStyle( rBorder, &maCurrStyle );
+ else
+ rBorder.SetState( eState );
+ DoInvalidate( true );
+}
+
+void FrameSelectorImpl::SetBorderCoreStyle( FrameBorder& rBorder, const SvxBorderLine* pStyle )
+{
+ DBG_ASSERT( rBorder.IsEnabled(), "svx::FrameSelectorImpl::SetBorderCoreStyle - access to disabled border" );
+ rBorder.SetCoreStyle( pStyle );
+ DoInvalidate( true );
+}
+
+void FrameSelectorImpl::ToggleBorderState( FrameBorder& rBorder )
+{
+ bool bDontCare = mrFrameSel.SupportsDontCareState();
+ switch( rBorder.GetState() )
+ {
+ // same order as tristate check box: visible -> don't care -> hidden
+ case FRAMESTATE_SHOW:
+ SetBorderState( rBorder, bDontCare ? FRAMESTATE_DONTCARE : FRAMESTATE_HIDE );
+ break;
+ case FRAMESTATE_HIDE:
+ SetBorderState( rBorder, FRAMESTATE_SHOW );
+ break;
+ case FRAMESTATE_DONTCARE:
+ SetBorderState( rBorder, FRAMESTATE_HIDE );
+ break;
+ }
+}
+
+// frame border selection -----------------------------------------------------
+
+void FrameSelectorImpl::SelectBorder( FrameBorder& rBorder, bool bSelect )
+{
+ DBG_ASSERT( rBorder.IsEnabled(), "svx::FrameSelectorImpl::SelectBorder - access to disabled border" );
+ rBorder.Select( bSelect );
+ DrawArrows( rBorder );
+ DoInvalidate( false );
+ maSelectHdl.Call( this );
+}
+
+void FrameSelectorImpl::SilentGrabFocus()
+{
+ bool bOldAuto = mbAutoSelect;
+ mbAutoSelect = false;
+ mrFrameSel.GrabFocus();
+ mbAutoSelect = bOldAuto;
+}
+
+bool FrameSelectorImpl::SelectedBordersEqual() const
+{
+ bool bEqual = true;
+ SelFrameBorderCIter aIt( maEnabBorders );
+ if( aIt.Is() )
+ {
+ const SvxBorderLine& rFirstStyle = (*aIt)->GetCoreStyle();
+ for( ++aIt; bEqual && aIt.Is(); ++aIt )
+ bEqual = ((*aIt)->GetCoreStyle() == rFirstStyle);
+ }
+ return bEqual;
+}
+
+// ============================================================================
+// FrameSelector
+// ============================================================================
+
+FrameSelector::FrameSelector( Window* pParent, const ResId& rResId ) :
+ Control( pParent, rResId )
+{
+ // not in c'tor init list (avoid warning about usage of *this)
+ mxImpl.reset( new FrameSelectorImpl( *this ) );
+ EnableRTL( false ); // #107808# don't mirror the mouse handling
+}
+
+FrameSelector::~FrameSelector()
+{
+}
+
+void FrameSelector::Initialize( FrameSelFlags nFlags )
+{
+ mxImpl->Initialize( nFlags );
+ Show();
+}
+
+// enabled frame borders ------------------------------------------------------
+
+bool FrameSelector::IsBorderEnabled( FrameBorderType eBorder ) const
+{
+ return mxImpl->GetBorder( eBorder ).IsEnabled();
+}
+
+sal_Int32 FrameSelector::GetEnabledBorderCount() const
+{
+ return static_cast< sal_Int32 >( mxImpl->maEnabBorders.size() );
+}
+
+FrameBorderType FrameSelector::GetEnabledBorderType( sal_Int32 nIndex ) const
+{
+ FrameBorderType eBorder = FRAMEBORDER_NONE;
+ if( nIndex >= 0 )
+ {
+ size_t nVecIdx = static_cast< size_t >( nIndex );
+ if( nVecIdx < mxImpl->maEnabBorders.size() )
+ eBorder = mxImpl->maEnabBorders[ nVecIdx ]->GetType();
+ }
+ return eBorder;
+}
+
+sal_Int32 FrameSelector::GetEnabledBorderIndex( FrameBorderType eBorder ) const
+{
+ sal_Int32 nIndex = 0;
+ for( FrameBorderCIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt, ++nIndex )
+ if( (*aIt)->GetType() == eBorder )
+ return nIndex;
+ return -1;
+}
+
+// frame border state and style -----------------------------------------------
+
+bool FrameSelector::SupportsDontCareState() const
+{
+ return (mxImpl->mnFlags & FRAMESEL_DONTCARE) != 0;
+}
+
+FrameBorderState FrameSelector::GetFrameBorderState( FrameBorderType eBorder ) const
+{
+ return mxImpl->GetBorder( eBorder ).GetState();
+}
+
+const SvxBorderLine* FrameSelector::GetFrameBorderStyle( FrameBorderType eBorder ) const
+{
+ const SvxBorderLine& rStyle = mxImpl->GetBorder( eBorder ).GetCoreStyle();
+ // rest of the world uses null pointer for invisible frame border
+ return rStyle.GetOutWidth() ? &rStyle : 0;
+}
+
+void FrameSelector::ShowBorder( FrameBorderType eBorder, const SvxBorderLine* pStyle )
+{
+ mxImpl->SetBorderCoreStyle( mxImpl->GetBorderAccess( eBorder ), pStyle );
+}
+
+void FrameSelector::SetBorderDontCare( FrameBorderType eBorder )
+{
+ mxImpl->SetBorderState( mxImpl->GetBorderAccess( eBorder ), FRAMESTATE_DONTCARE );
+}
+
+bool FrameSelector::IsAnyBorderVisible() const
+{
+ bool bIsSet = false;
+ for( FrameBorderCIter aIt( mxImpl->maEnabBorders ); !bIsSet && aIt.Is(); ++aIt )
+ bIsSet = ((*aIt)->GetState() == FRAMESTATE_SHOW);
+ return bIsSet;
+}
+
+void FrameSelector::HideAllBorders()
+{
+ for( FrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
+ mxImpl->SetBorderState( **aIt, FRAMESTATE_HIDE );
+}
+
+bool FrameSelector::GetVisibleWidth( sal_uInt16& rnPrim, sal_uInt16& rnDist, sal_uInt16& rnSecn ) const
+{
+ VisFrameBorderCIter aIt( mxImpl->maEnabBorders );
+ if( !aIt.Is() )
+ return false;
+
+ const SvxBorderLine& rStyle = (*aIt)->GetCoreStyle();
+ bool bFound = true;
+ for( ++aIt; bFound && aIt.Is(); ++aIt )
+ bFound =
+ (rStyle.GetOutWidth() == (*aIt)->GetCoreStyle().GetOutWidth()) &&
+ (rStyle.GetDistance() == (*aIt)->GetCoreStyle().GetDistance()) &&
+ (rStyle.GetInWidth() == (*aIt)->GetCoreStyle().GetInWidth());
+
+ if( bFound )
+ {
+ rnPrim = rStyle.GetOutWidth();
+ rnDist = rStyle.GetDistance();
+ rnSecn = rStyle.GetInWidth();
+ }
+ return bFound;
+}
+
+bool FrameSelector::GetVisibleColor( Color& rColor ) const
+{
+ VisFrameBorderCIter aIt( mxImpl->maEnabBorders );
+ if( !aIt.Is() )
+ return false;
+
+ const SvxBorderLine& rStyle = (*aIt)->GetCoreStyle();
+ bool bFound = true;
+ for( ++aIt; bFound && aIt.Is(); ++aIt )
+ bFound = (rStyle.GetColor() == (*aIt)->GetCoreStyle().GetColor());
+
+ if( bFound )
+ rColor = rStyle.GetColor();
+ return bFound;
+}
+
+// frame border selection -----------------------------------------------------
+
+const Link& FrameSelector::GetSelectHdl() const
+{
+ return mxImpl->maSelectHdl;
+}
+
+void FrameSelector::SetSelectHdl( const Link& rHdl )
+{
+ mxImpl->maSelectHdl = rHdl;
+}
+
+bool FrameSelector::IsBorderSelected( FrameBorderType eBorder ) const
+{
+ return mxImpl->GetBorder( eBorder ).IsSelected();
+}
+
+void FrameSelector::SelectBorder( FrameBorderType eBorder, bool bSelect )
+{
+ mxImpl->SelectBorder( mxImpl->GetBorderAccess( eBorder ), bSelect );
+}
+
+bool FrameSelector::IsAnyBorderSelected() const
+{
+ // Construct an iterator for selected borders. If it is valid, there is a selected border.
+ return SelFrameBorderCIter( mxImpl->maEnabBorders ).Is();
+}
+
+void FrameSelector::SelectAllBorders( bool bSelect )
+{
+ for( FrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
+ mxImpl->SelectBorder( **aIt, bSelect );
+}
+
+void FrameSelector::SelectAllVisibleBorders( bool bSelect )
+{
+ for( VisFrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
+ mxImpl->SelectBorder( **aIt, bSelect );
+}
+
+void FrameSelector::SetStyleToSelection( sal_uInt16 nPrim, sal_uInt16 nDist, sal_uInt16 nSecn )
+{
+ mxImpl->maCurrStyle.SetOutWidth( nPrim );
+ mxImpl->maCurrStyle.SetDistance( nDist );
+ mxImpl->maCurrStyle.SetInWidth( nSecn );
+ for( SelFrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
+ mxImpl->SetBorderState( **aIt, FRAMESTATE_SHOW );
+}
+
+void FrameSelector::SetColorToSelection( const Color& rColor )
+{
+ mxImpl->maCurrStyle.SetColor( rColor );
+ for( SelFrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
+ mxImpl->SetBorderState( **aIt, FRAMESTATE_SHOW );
+}
+
+// accessibility --------------------------------------------------------------
+
+Reference< XAccessible > FrameSelector::CreateAccessible()
+{
+ if( !mxImpl->mxAccess.is() )
+ mxImpl->mxAccess = mxImpl->mpAccess =
+ new a11y::AccFrameSelector( *this, FRAMEBORDER_NONE );
+ return mxImpl->mxAccess;
+}
+
+Reference< XAccessible > FrameSelector::GetChildAccessible( FrameBorderType eBorder )
+{
+ Reference< XAccessible > xRet;
+ size_t nVecIdx = static_cast< size_t >( eBorder );
+ if( IsBorderEnabled( eBorder ) && (1 <= nVecIdx) && (nVecIdx <= mxImpl->maChildVec.size()) )
+ {
+ --nVecIdx;
+ if( !mxImpl->maChildVec[ nVecIdx ] )
+ mxImpl->mxChildVec[ nVecIdx ] = mxImpl->maChildVec[ nVecIdx ] =
+ new a11y::AccFrameSelector( *this, eBorder );
+ xRet = mxImpl->mxChildVec[ nVecIdx ];
+ }
+ return xRet;
+}
+
+Reference< XAccessible > FrameSelector::GetChildAccessible( sal_Int32 nIndex )
+{
+ return GetChildAccessible( GetEnabledBorderType( nIndex ) );
+}
+
+Reference< XAccessible > FrameSelector::GetChildAccessible( const Point& rPos )
+{
+ Reference< XAccessible > xRet;
+ for( FrameBorderCIter aIt( mxImpl->maEnabBorders ); !xRet.is() && aIt.Is(); ++aIt )
+ if( (*aIt)->ContainsClickPoint( rPos ) )
+ xRet = GetChildAccessible( (*aIt)->GetType() );
+ return xRet;
+}
+
+bool FrameSelector::ContainsClickPoint( const Point& rPos ) const
+{
+ bool bContains = false;
+ for( FrameBorderCIter aIt( mxImpl->maEnabBorders ); !bContains && aIt.Is(); ++aIt )
+ bContains = (*aIt)->ContainsClickPoint( rPos );
+ return bContains;
+}
+
+Rectangle FrameSelector::GetClickBoundRect( FrameBorderType eBorder ) const
+{
+ Rectangle aRect;
+ const FrameBorder& rBorder = mxImpl->GetBorder( eBorder );
+ if( rBorder.IsEnabled() )
+ aRect = rBorder.GetClickBoundRect();
+ return aRect;
+}
+
+// virtual functions from base class ------------------------------------------
+
+void FrameSelector::Paint( const Rectangle& )
+{
+ mxImpl->CopyVirDevToControl();
+ if( HasFocus() )
+ mxImpl->DrawAllTrackingRects();
+}
+
+void FrameSelector::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ /* Mouse handling:
+ * Click on an unselected frame border:
+ Set current style/color, make frame border visible, deselect all
+ other frame borders.
+ * Click on a selected frame border:
+ Toggle state of the frame border (visible -> don't care -> hidden),
+ deselect all other frame borders.
+ * SHIFT+Click or CTRL+Click on an unselected frame border:
+ Extend selection, set current style/color to all selected frame
+ borders independent of the state/style/color of the borders.
+ * SHIFT+Click or CTRL+Click on a selected frame border:
+ If all frame borders have same style/color, toggle state of all
+ borders (see above), otherwise set current style/color to all
+ borders.
+ * Click on unused area: Do not modify selection and selected frame
+ borders.
+ */
+
+ // #107394# do not auto-select a frame border
+ mxImpl->SilentGrabFocus();
+
+ if( rMEvt.IsLeft() )
+ {
+ Point aPos( mxImpl->GetDevPosFromMousePos( rMEvt.GetPosPixel() ) );
+ FrameBorderPtrVec aDeselectBorders;
+
+ bool bAnyClicked = false; // Any frame border clicked?
+ bool bNewSelected = false; // Any unselected frame border selected?
+
+ /* If frame borders are set to "don't care" and the control does not
+ support this state, hide them on first mouse click.
+ DR 2004-01-30: Why are the borders set to "don't care" then?!? */
+ bool bHideDontCare = !mxImpl->mbClicked && !SupportsDontCareState();
+
+ for( FrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
+ {
+ if( (*aIt)->ContainsClickPoint( aPos ) )
+ {
+ // frame border is clicked
+ bAnyClicked = true;
+ if( !(*aIt)->IsSelected() )
+ {
+ bNewSelected = true;
+ mxImpl->SelectBorder( **aIt, true );
+ }
+ }
+ else
+ {
+ // hide a "don't care" frame border only if it is not clicked
+ if( bHideDontCare && ((*aIt)->GetState() == FRAMESTATE_DONTCARE) )
+ mxImpl->SetBorderState( **aIt, FRAMESTATE_HIDE );
+
+ // deselect frame borders not clicked (if SHIFT or CTRL are not pressed)
+ if( !rMEvt.IsShift() && !rMEvt.IsMod1() )
+ aDeselectBorders.push_back( *aIt );
+ }
+ }
+
+ if( bAnyClicked )
+ {
+ // any valid frame border clicked? -> deselect other frame borders
+ for( FrameBorderIter aIt( aDeselectBorders ); aIt.Is(); ++aIt )
+ mxImpl->SelectBorder( **aIt, false );
+
+ if( bNewSelected || !mxImpl->SelectedBordersEqual() )
+ {
+ // new frame border selected, selection extended, or selected borders different? -> show
+ for( SelFrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
+ // SetBorderState() sets current style and color to the frame border
+ mxImpl->SetBorderState( **aIt, FRAMESTATE_SHOW );
+ }
+ else
+ {
+ // all selected frame borders are equal -> toggle state
+ for( SelFrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
+ mxImpl->ToggleBorderState( **aIt );
+ }
+ }
+ }
+}
+
+void FrameSelector::KeyInput( const KeyEvent& rKEvt )
+{
+ bool bHandled = false;
+ KeyCode aKeyCode = rKEvt.GetKeyCode();
+ if( !aKeyCode.GetModifier() )
+ {
+ sal_uInt16 nCode = aKeyCode.GetCode();
+ switch( nCode )
+ {
+ case KEY_SPACE:
+ {
+ for( SelFrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
+ mxImpl->ToggleBorderState( **aIt );
+ bHandled = true;
+ }
+ break;
+
+ case KEY_UP:
+ case KEY_DOWN:
+ case KEY_LEFT:
+ case KEY_RIGHT:
+ {
+ if( !mxImpl->maEnabBorders.empty() )
+ {
+ // start from first selected frame border
+ SelFrameBorderCIter aIt( mxImpl->maEnabBorders );
+ FrameBorderType eBorder = aIt.Is() ? (*aIt)->GetType() : mxImpl->maEnabBorders.front()->GetType();
+
+ // search for next enabled frame border
+ do
+ {
+ eBorder = mxImpl->GetBorder( eBorder ).GetKeyboardNeighbor( nCode );
+ }
+ while( (eBorder != FRAMEBORDER_NONE) && !IsBorderEnabled( eBorder ) );
+
+ // select the frame border
+ if( eBorder != FRAMEBORDER_NONE )
+ {
+ DeselectAllBorders();
+ SelectBorder( eBorder );
+ }
+ }
+ }
+ break;
+ }
+ }
+ if( !bHandled )
+ Window::KeyInput(rKEvt);
+}
+
+void FrameSelector::GetFocus()
+{
+ // auto-selection of a frame border, if focus reaches control, and nothing is selected
+ if( mxImpl->mbAutoSelect && !IsAnyBorderSelected() && !mxImpl->maEnabBorders.empty() )
+ mxImpl->SelectBorder( *mxImpl->maEnabBorders.front(), true );
+
+ mxImpl->DoInvalidate( false );
+ if( mxImpl->mxAccess.is() )
+ mxImpl->mpAccess->NotifyFocusListeners( sal_True );
+ Control::GetFocus();
+}
+
+void FrameSelector::LoseFocus()
+{
+ mxImpl->DoInvalidate( false );
+ if( mxImpl->mxAccess.is() )
+ mxImpl->mpAccess->NotifyFocusListeners( sal_False );
+ Control::LoseFocus();
+}
+
+void FrameSelector::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Control::DataChanged( rDCEvt );
+ if( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ mxImpl->InitVirtualDevice();
+}
+
+// ============================================================================
+
+template< typename Cont, typename Iter, typename Pred >
+FrameBorderIterBase< Cont, Iter, Pred >::FrameBorderIterBase( container_type& rCont ) :
+ maIt( rCont.begin() ),
+ maEnd( rCont.end() )
+{
+ while( Is() && !maPred( *maIt ) ) ++maIt;
+}
+
+template< typename Cont, typename Iter, typename Pred >
+FrameBorderIterBase< Cont, Iter, Pred >& FrameBorderIterBase< Cont, Iter, Pred >::operator++()
+{
+ do { ++maIt; } while( Is() && !maPred( *maIt ) );
+ return *this;
+}
+
+// ============================================================================
+
+} // namespace svx
+
diff --git a/svx/source/dialog/frmsel.src b/svx/source/dialog/frmsel.src
new file mode 100644
index 000000000000..754e0b962b29
--- /dev/null
+++ b/svx/source/dialog/frmsel.src
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_DIALOGS_HRC
+#include <svx/dialogs.hrc>
+#endif
+#ifndef SVX_FRMSEL_HRC
+#include "frmsel.hrc"
+#endif
+
+Resource RID_SVXSTR_BORDER_CONTROL
+{
+ StringArray ARR_TEXTS
+ {
+ ItemList [ en-US ] =
+ {
+ < "Border setting" ; 0; > ;
+ < "Left border line" ; 1; > ;
+ < "Right border line" ; 2; > ;
+ < "Top border line" ; 3; > ;
+ < "Bottom border line" ; 4; > ;
+ < "Horizontal border line" ; 5; > ;
+ < "Vertical border line" ; 6; > ;
+ < "Diagonal border line from top left to bottom right" ; 7; > ;
+ < "Diagonal border line from bottom left to top right" ; 8; > ;
+ };
+ };
+ StringArray ARR_DESCRIPTIONS
+ {
+ ItemList [ en-US ] =
+ {
+ < "Border setting" ; 0; > ;
+ < "Left border line" ; 1; > ;
+ < "Right border line" ; 2; > ;
+ < "Top border line" ; 3; > ;
+ < "Bottom border line" ; 4; > ;
+ < "Horizontal border line" ; 5; > ;
+ < "Vertical border line" ; 6; > ;
+ < "Diagonal border line from top left to bottom right" ; 7; > ;
+ < "Diagonal border line from bottom left to top right" ; 8; > ;
+ };
+ };
+
+ Bitmap BMP_FRMSEL_ARROWS { File = "frmsel.bmp"; };
+};
+
diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx
new file mode 100644
index 000000000000..66f4e34eb022
--- /dev/null
+++ b/svx/source/dialog/graphctl.cxx
@@ -0,0 +1,960 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svl/itempool.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/wrkwin.hxx>
+#include <unotools/syslocale.hxx>
+#include <rtl/math.hxx>
+#include <unotools/localedatawrapper.hxx>
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX
+#include <comphelper/processfactory.hxx>
+#endif
+#include <vcl/svapp.hxx>
+#include <osl/mutex.hxx>
+
+#include <svx/graphctl.hxx>
+#include "GraphCtlAccessibleContext.hxx"
+#include "svx/xoutbmp.hxx"
+#include <svx/svxids.hrc>
+#include <svx/svdpage.hxx>
+
+// #i72889#
+#include "svx/sdrpaintwindow.hxx"
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrlUserCall::Changed( const SdrObject& rObj, SdrUserCallType eType, const Rectangle& /*rOldBoundRect*/ )
+{
+ switch( eType )
+ {
+ case( SDRUSERCALL_MOVEONLY ):
+ case( SDRUSERCALL_RESIZE ):
+ rWin.SdrObjChanged( rObj );
+ break;
+
+ case( SDRUSERCALL_INSERTED ):
+ rWin.SdrObjCreated( rObj );
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+GraphCtrl::GraphCtrl( Window* pParent, const WinBits nWinBits ) :
+ Control ( pParent, nWinBits ),
+ aMap100 ( MAP_100TH_MM ),
+ eObjKind ( OBJ_NONE ),
+ nPolyEdit ( 0 ),
+ bEditMode ( sal_False ),
+ bSdrMode ( sal_False ),
+ mpAccContext ( NULL ),
+ pModel ( NULL ),
+ pView ( NULL )
+{
+ pUserCall = new GraphCtrlUserCall( *this );
+ aUpdateTimer.SetTimeout( 200 );
+ aUpdateTimer.SetTimeoutHdl( LINK( this, GraphCtrl, UpdateHdl ) );
+ aUpdateTimer.Start();
+
+ SetWinStyle( nWinBits );
+
+ EnableRTL( sal_False );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+GraphCtrl::GraphCtrl( Window* pParent, const ResId& rResId ) :
+ Control ( pParent, rResId ),
+ aMap100 ( MAP_100TH_MM ),
+ nWinStyle ( 0 ),
+ eObjKind ( OBJ_NONE ),
+ nPolyEdit ( 0 ),
+ bEditMode ( sal_False ),
+ bSdrMode ( sal_False ),
+ bAnim ( sal_False ),
+ mpAccContext ( NULL ),
+ pModel ( NULL ),
+ pView ( NULL )
+{
+ pUserCall = new GraphCtrlUserCall( *this );
+ aUpdateTimer.SetTimeout( 500 );
+ aUpdateTimer.SetTimeoutHdl( LINK( this, GraphCtrl, UpdateHdl ) );
+ aUpdateTimer.Start();
+ EnableRTL( sal_False );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+GraphCtrl::~GraphCtrl()
+{
+ if( mpAccContext )
+ {
+ mpAccContext->disposing();
+ mpAccContext->release();
+ }
+ delete pView;
+ delete pModel;
+ delete pUserCall;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::SetWinStyle( WinBits nWinBits )
+{
+ nWinStyle = nWinBits;
+ bAnim = ( nWinStyle & WB_ANIMATION ) == WB_ANIMATION;
+ bSdrMode = ( nWinStyle & WB_SDRMODE ) == WB_SDRMODE;
+
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+ SetBackground( Wallpaper( rStyleSettings.GetWindowColor() ) );
+ SetMapMode( aMap100 );
+
+ delete pView;
+ pView = NULL;
+
+ delete pModel;
+ pModel = NULL;
+
+ if ( bSdrMode )
+ InitSdrModel();
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::InitSdrModel()
+{
+ ::vos::OGuard aGuard (Application::GetSolarMutex());
+
+ SdrPage* pPage;
+
+ // alten Kram zerstoeren
+ delete pView;
+ delete pModel;
+
+ // Model anlegen
+ pModel = new SdrModel;
+ pModel->GetItemPool().FreezeIdRanges();
+ pModel->SetScaleUnit( aMap100.GetMapUnit() );
+ pModel->SetScaleFraction( Fraction( 1, 1 ) );
+ pModel->SetDefaultFontHeight( 500 );
+
+ pPage = new SdrPage( *pModel );
+
+ pPage->SetSize( aGraphSize );
+ pPage->SetBorder( 0, 0, 0, 0 );
+ pModel->InsertPage( pPage );
+ pModel->SetChanged( sal_False );
+
+ // View anlegen
+ pView = new GraphCtrlView( pModel, this );
+ pView->SetWorkArea( Rectangle( Point(), aGraphSize ) );
+ pView->EnableExtendedMouseEventDispatcher( sal_True );
+ pView->ShowSdrPage(pView->GetModel()->GetPage(0));
+// pView->ShowSdrPage(pView->GetModel()->GetPage(0));
+ pView->SetFrameDragSingles( sal_True );
+ pView->SetMarkedPointsSmooth( SDRPATHSMOOTH_SYMMETRIC );
+ pView->SetEditMode( sal_True );
+
+ // #i72889# set neeeded flags
+ pView->SetPagePaintingAllowed(false);
+ pView->SetBufferedOutputAllowed(true);
+ pView->SetBufferedOverlayAllowed(true);
+
+ // Tell the accessibility object about the changes.
+ if (mpAccContext != NULL)
+ mpAccContext->setModelAndView (pModel, pView);
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::SetGraphic( const Graphic& rGraphic, sal_Bool bNewModel )
+{
+ // Bitmaps dithern wir ggf. fuer die Anzeige
+ if ( !bAnim && ( rGraphic.GetType() == GRAPHIC_BITMAP ) )
+ {
+ if ( rGraphic.IsTransparent() )
+ {
+ Bitmap aBmp( rGraphic.GetBitmap() );
+
+ DitherBitmap( aBmp );
+ aGraphic = Graphic( BitmapEx( aBmp, rGraphic.GetBitmapEx().GetMask() ) );
+ }
+ else
+ {
+ Bitmap aBmp( rGraphic.GetBitmap() );
+ DitherBitmap( aBmp );
+ aGraphic = aBmp;
+ }
+ }
+ else
+ aGraphic = rGraphic;
+
+ if ( aGraphic.GetPrefMapMode().GetMapUnit() == MAP_PIXEL )
+ aGraphSize = Application::GetDefaultDevice()->PixelToLogic( aGraphic.GetPrefSize(), aMap100 );
+ else
+ aGraphSize = OutputDevice::LogicToLogic( aGraphic.GetPrefSize(), aGraphic.GetPrefMapMode(), aMap100 );
+
+ if ( bSdrMode && bNewModel )
+ InitSdrModel();
+
+ if ( aGraphSizeLink.IsSet() )
+ aGraphSizeLink.Call( this );
+
+ Resize();
+ Invalidate();
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::Resize()
+{
+ Control::Resize();
+
+ if ( aGraphSize.Width() && aGraphSize.Height() )
+ {
+ MapMode aDisplayMap( aMap100 );
+ Point aNewPos;
+ Size aNewSize;
+ const Size aWinSize = PixelToLogic( GetOutputSizePixel(), aDisplayMap );
+ const long nWidth = aWinSize.Width();
+ const long nHeight = aWinSize.Height();
+ double fGrfWH = (double) aGraphSize.Width() / aGraphSize.Height();
+ double fWinWH = (double) nWidth / nHeight;
+
+ // Bitmap an Thumbgroesse anpassen
+ if ( fGrfWH < fWinWH)
+ {
+ aNewSize.Width() = (long) ( (double) nHeight * fGrfWH );
+ aNewSize.Height()= nHeight;
+ }
+ else
+ {
+ aNewSize.Width() = nWidth;
+ aNewSize.Height()= (long) ( (double) nWidth / fGrfWH );
+ }
+
+ aNewPos.X() = ( nWidth - aNewSize.Width() ) >> 1;
+ aNewPos.Y() = ( nHeight - aNewSize.Height() ) >> 1;
+
+ // MapMode fuer Engine umsetzen
+ aDisplayMap.SetScaleX( Fraction( aNewSize.Width(), aGraphSize.Width() ) );
+ aDisplayMap.SetScaleY( Fraction( aNewSize.Height(), aGraphSize.Height() ) );
+
+ aDisplayMap.SetOrigin( LogicToLogic( aNewPos, aMap100, aDisplayMap ) );
+ SetMapMode( aDisplayMap );
+ }
+
+ Invalidate();
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::Paint( const Rectangle& rRect )
+{
+ // #i72889# used splitted repaint to be able to paint an own background
+ // even to the buffered view
+ const bool bGraphicValid(GRAPHIC_NONE != aGraphic.GetType());
+
+ if(bSdrMode)
+ {
+ SdrPaintWindow* pPaintWindow = pView->BeginCompleteRedraw(this);
+
+ if(bGraphicValid)
+ {
+ OutputDevice& rTarget = pPaintWindow->GetTargetOutputDevice();
+
+ rTarget.SetBackground(GetBackground());
+ rTarget.Erase();
+
+ aGraphic.Draw(&rTarget, Point(), aGraphSize);
+ }
+
+ const Region aRepaintRegion(rRect);
+ pView->DoCompleteRedraw(*pPaintWindow, aRepaintRegion);
+ pView->EndCompleteRedraw(*pPaintWindow, true);
+ }
+ else
+ {
+ // #i73381# in non-SdrMode, paint to local directly
+ if(bGraphicValid)
+ {
+ aGraphic.Draw(this, Point(), aGraphSize);
+ }
+ }
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::SdrObjChanged( const SdrObject& )
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::SdrObjCreated( const SdrObject& )
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::MarkListHasChanged()
+{
+ if ( aMarkObjLink.IsSet() )
+ aMarkObjLink.Call( this );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::KeyInput( const KeyEvent& rKEvt )
+{
+ KeyCode aCode( rKEvt.GetKeyCode() );
+ sal_Bool bProc = sal_False;
+
+ switch ( aCode.GetCode() )
+ {
+ case KEY_DELETE:
+ case KEY_BACKSPACE:
+ {
+ if ( bSdrMode )
+ {
+ pView->DeleteMarked();
+ bProc = sal_True;
+ if( !pView->AreObjectsMarked() )
+ ((Dialog*)GetParent())->GrabFocusToFirstControl();
+ }
+ }
+ break;
+
+ case KEY_ESCAPE:
+ {
+ if ( bSdrMode )
+ {
+ if ( pView->IsAction() )
+ {
+ pView->BrkAction();
+ }
+ else if ( pView->AreObjectsMarked() )
+ {
+ const SdrHdlList& rHdlList = pView->GetHdlList();
+ SdrHdl* pHdl = rHdlList.GetFocusHdl();
+
+ if(pHdl)
+ {
+ ((SdrHdlList&)rHdlList).ResetFocusHdl();
+ }
+ else
+ {
+ ((Dialog*)GetParent())->GrabFocusToFirstControl();
+ }
+ }
+ else
+ {
+ ((Dialog*)GetParent())->GrabFocusToFirstControl();
+ }
+ bProc = sal_True;
+ }
+ }
+ break;
+
+ case KEY_F11:
+ case KEY_TAB:
+ {
+ if( bSdrMode )
+ {
+ if( !aCode.IsMod1() && !aCode.IsMod2() )
+ {
+ bool bForward = !aCode.IsShift();
+ // select next object
+ if ( ! pView->MarkNextObj( bForward ))
+ {
+ // At first or last object. Cycle to the other end
+ // of the list.
+ pView->UnmarkAllObj();
+ pView->MarkNextObj (bForward);
+ }
+ bProc = sal_True;
+ }
+ else if(aCode.IsMod1())
+ {
+ // select next handle
+ const SdrHdlList& rHdlList = pView->GetHdlList();
+ sal_Bool bForward(!aCode.IsShift());
+
+ ((SdrHdlList&)rHdlList).TravelFocusHdl(bForward);
+
+ bProc = true;
+ }
+ }
+ }
+ break;
+
+ case KEY_END:
+ {
+
+ if ( aCode.IsMod1() )
+ {
+ // #97016# mark last object
+ pView->UnmarkAllObj();
+ pView->MarkNextObj(sal_False);
+
+ bProc = true;
+ }
+ }
+ break;
+
+ case KEY_HOME:
+ {
+ if ( aCode.IsMod1() )
+ {
+ pView->UnmarkAllObj();
+ pView->MarkNextObj(sal_True);
+
+ bProc = true;
+ }
+ }
+ break;
+
+ case KEY_UP:
+ case KEY_DOWN:
+ case KEY_LEFT:
+ case KEY_RIGHT:
+ {
+ long nX = 0;
+ long nY = 0;
+
+ if (aCode.GetCode() == KEY_UP)
+ {
+ // Scroll nach oben
+ nX = 0;
+ nY =-1;
+ }
+ else if (aCode.GetCode() == KEY_DOWN)
+ {
+ // Scroll nach unten
+ nX = 0;
+ nY = 1;
+ }
+ else if (aCode.GetCode() == KEY_LEFT)
+ {
+ // Scroll nach links
+ nX =-1;
+ nY = 0;
+ }
+ else if (aCode.GetCode() == KEY_RIGHT)
+ {
+ // Scroll nach rechts
+ nX = 1;
+ nY = 0;
+ }
+
+ if (pView->AreObjectsMarked() && !aCode.IsMod1() )
+ {
+ if(aCode.IsMod2())
+ {
+ // #97016# move in 1 pixel distance
+ Size aLogicSizeOnePixel = PixelToLogic(Size(1,1));
+ nX *= aLogicSizeOnePixel.Width();
+ nY *= aLogicSizeOnePixel.Height();
+ }
+ else
+ {
+ // old, fixed move distance
+ nX *= 100;
+ nY *= 100;
+ }
+
+ // #97016# II
+ const SdrHdlList& rHdlList = pView->GetHdlList();
+ SdrHdl* pHdl = rHdlList.GetFocusHdl();
+
+ if(0L == pHdl)
+ {
+ // #90129# restrict movement to WorkArea
+ const Rectangle& rWorkArea = pView->GetWorkArea();
+
+ if(!rWorkArea.IsEmpty())
+ {
+ Rectangle aMarkRect(pView->GetMarkedObjRect());
+ aMarkRect.Move(nX, nY);
+
+ if(!aMarkRect.IsInside(rWorkArea))
+ {
+ if(aMarkRect.Left() < rWorkArea.Left())
+ {
+ nX += rWorkArea.Left() - aMarkRect.Left();
+ }
+
+ if(aMarkRect.Right() > rWorkArea.Right())
+ {
+ nX -= aMarkRect.Right() - rWorkArea.Right();
+ }
+
+ if(aMarkRect.Top() < rWorkArea.Top())
+ {
+ nY += rWorkArea.Top() - aMarkRect.Top();
+ }
+
+ if(aMarkRect.Bottom() > rWorkArea.Bottom())
+ {
+ nY -= aMarkRect.Bottom() - rWorkArea.Bottom();
+ }
+ }
+ }
+
+ // no handle selected
+ if(0 != nX || 0 != nY)
+ {
+ pView->MoveAllMarked(Size(nX, nY));
+ }
+ }
+ else
+ {
+ // move handle with index nHandleIndex
+ if(pHdl && (nX || nY))
+ {
+ // now move the Handle (nX, nY)
+ Point aStartPoint(pHdl->GetPos());
+ Point aEndPoint(pHdl->GetPos() + Point(nX, nY));
+ const SdrDragStat& rDragStat = pView->GetDragStat();
+
+ // start dragging
+ pView->BegDragObj(aStartPoint, 0, pHdl, 0);
+
+ if(pView->IsDragObj())
+ {
+ FASTBOOL bWasNoSnap = rDragStat.IsNoSnap();
+ sal_Bool bWasSnapEnabled = pView->IsSnapEnabled();
+
+ // switch snapping off
+ if(!bWasNoSnap)
+ ((SdrDragStat&)rDragStat).SetNoSnap(sal_True);
+ if(bWasSnapEnabled)
+ pView->SetSnapEnabled(sal_False);
+
+ pView->MovAction(aEndPoint);
+ pView->EndDragObj();
+
+ // restore snap
+ if(!bWasNoSnap)
+ ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap);
+ if(bWasSnapEnabled)
+ pView->SetSnapEnabled(bWasSnapEnabled);
+ }
+ }
+ }
+
+ bProc = true;
+ }
+ }
+ break;
+
+ case KEY_SPACE:
+ {
+ const SdrHdlList& rHdlList = pView->GetHdlList();
+ SdrHdl* pHdl = rHdlList.GetFocusHdl();
+
+ if(pHdl)
+ {
+ if(pHdl->GetKind() == HDL_POLY)
+ {
+ // rescue ID of point with focus
+ sal_uInt32 nPol(pHdl->GetPolyNum());
+ sal_uInt32 nPnt(pHdl->GetPointNum());
+
+ if(pView->IsPointMarked(*pHdl))
+ {
+ if(rKEvt.GetKeyCode().IsShift())
+ {
+ pView->UnmarkPoint(*pHdl);
+ }
+ }
+ else
+ {
+ if(!rKEvt.GetKeyCode().IsShift())
+ {
+ pView->UnmarkAllPoints();
+ }
+
+ pView->MarkPoint(*pHdl);
+ }
+
+ if(0L == rHdlList.GetFocusHdl())
+ {
+ // restore point with focus
+ SdrHdl* pNewOne = 0L;
+
+ for(sal_uInt32 a(0); !pNewOne && a < rHdlList.GetHdlCount(); a++)
+ {
+ SdrHdl* pAct = rHdlList.GetHdl(a);
+
+ if(pAct
+ && pAct->GetKind() == HDL_POLY
+ && pAct->GetPolyNum() == nPol
+ && pAct->GetPointNum() == nPnt)
+ {
+ pNewOne = pAct;
+ }
+ }
+
+ if(pNewOne)
+ {
+ ((SdrHdlList&)rHdlList).SetFocusHdl(pNewOne);
+ }
+ }
+
+ bProc = sal_True;
+ }
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if ( !bProc )
+ Control::KeyInput( rKEvt );
+ else
+ ReleaseMouse();
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( bSdrMode && ( rMEvt.GetClicks() < 2 ) )
+ {
+ const Point aLogPt( PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ if ( !Rectangle( Point(), aGraphSize ).IsInside( aLogPt ) && !pView->IsEditMode() )
+ Control::MouseButtonDown( rMEvt );
+ else
+ {
+ // Focus anziehen fuer Key-Inputs
+ GrabFocus();
+
+ if ( nPolyEdit )
+ {
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = pView->PickAnything( rMEvt, SDRMOUSEBUTTONDOWN, aVEvt );
+
+ if ( nPolyEdit == SID_BEZIER_INSERT && eHit == SDRHIT_MARKEDOBJECT )
+ pView->BegInsObjPoint( aLogPt, rMEvt.IsMod1());
+ else
+ pView->MouseButtonDown( rMEvt, this );
+ }
+ else
+ pView->MouseButtonDown( rMEvt, this );
+ }
+
+ SdrObject* pCreateObj = pView->GetCreateObj();
+
+ // Wir wollen das Inserten mitbekommen
+ if ( pCreateObj && !pCreateObj->GetUserCall() )
+ pCreateObj->SetUserCall( pUserCall );
+
+ SetPointer( pView->GetPreferedPointer( aLogPt, this ) );
+ }
+ else
+ Control::MouseButtonDown( rMEvt );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::MouseMove(const MouseEvent& rMEvt)
+{
+ const Point aLogPos( PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ if ( bSdrMode )
+ {
+ pView->MouseMove( rMEvt, this );
+
+ if( ( SID_BEZIER_INSERT == nPolyEdit ) &&
+ !pView->PickHandle( aLogPos ) &&
+ !pView->IsInsObjPoint() )
+ {
+ SetPointer( POINTER_CROSS );
+ }
+ else
+ SetPointer( pView->GetPreferedPointer( aLogPos, this ) );
+ }
+ else
+ Control::MouseButtonUp( rMEvt );
+
+ if ( aMousePosLink.IsSet() )
+ {
+ if ( Rectangle( Point(), aGraphSize ).IsInside( aLogPos ) )
+ aMousePos = aLogPos;
+ else
+ aMousePos = Point();
+
+ aMousePosLink.Call( this );
+ }
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ if ( bSdrMode )
+ {
+ if ( pView->IsInsObjPoint() )
+ pView->EndInsObjPoint( SDRCREATE_FORCEEND );
+ else
+ pView->MouseButtonUp( rMEvt, this );
+
+ ReleaseMouse();
+ SetPointer( pView->GetPreferedPointer( PixelToLogic( rMEvt.GetPosPixel() ), this ) );
+ }
+ else
+ Control::MouseButtonUp( rMEvt );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+SdrObject* GraphCtrl::GetSelectedSdrObject() const
+{
+ SdrObject* pSdrObj = NULL;
+
+ if ( bSdrMode )
+ {
+ const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
+
+ if ( rMarkList.GetMarkCount() == 1 )
+ pSdrObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+ }
+
+ return pSdrObj;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::SetEditMode( const sal_Bool _bEditMode )
+{
+ if ( bSdrMode )
+ {
+ bEditMode = _bEditMode;
+ pView->SetEditMode( bEditMode );
+ eObjKind = OBJ_NONE;
+ pView->SetCurrentObj( sal::static_int_cast< sal_uInt16 >( eObjKind ) );
+ }
+ else
+ bEditMode = sal_False;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::SetPolyEditMode( const sal_uInt16 _nPolyEdit )
+{
+ if ( bSdrMode && ( _nPolyEdit != nPolyEdit ) )
+ {
+ nPolyEdit = _nPolyEdit;
+ pView->SetFrameDragSingles( nPolyEdit == 0 );
+ }
+ else
+ nPolyEdit = 0;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::SetObjKind( const SdrObjKind _eObjKind )
+{
+ if ( bSdrMode )
+ {
+ bEditMode = sal_False;
+ pView->SetEditMode( bEditMode );
+ eObjKind = _eObjKind;
+ pView->SetCurrentObj( sal::static_int_cast< sal_uInt16 >( eObjKind ) );
+ }
+ else
+ eObjKind = OBJ_NONE;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+String GraphCtrl::GetStringFromDouble( const double& rDouble )
+{
+ sal_Unicode cSep =
+ SvtSysLocale().GetLocaleData().getNumDecimalSep().GetChar(0);
+ String aStr( ::rtl::math::doubleToUString( rDouble,
+ rtl_math_StringFormat_F, 2, cSep ));
+ return aStr;
+}
+
+
+/*************************************************************************
+www|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( GraphCtrl, UpdateHdl, Timer*, pTimer )
+{
+ if ( aUpdateLink.IsSet() )
+ aUpdateLink.Call( this );
+
+ pTimer->Start();
+
+ return 0L;
+}
+
+
+::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GraphCtrl::CreateAccessible()
+{
+ if( mpAccContext == NULL )
+ {
+ Window* pParent = GetParent();
+
+ DBG_ASSERT( pParent, "-GraphCtrl::CreateAccessible(): No Parent!" );
+
+ if( pParent )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAccParent( pParent->GetAccessible() );
+
+ // #103856# Disable accessibility if no model/view data available
+ if( pView &&
+ pModel &&
+ xAccParent.is() )
+ {
+ mpAccContext = new SvxGraphCtrlAccessibleContext( xAccParent, *this );
+ mpAccContext->acquire();
+ }
+ }
+ }
+
+ return mpAccContext;
+}
diff --git a/svx/source/dialog/grfflt.cxx b/svx/source/dialog/grfflt.cxx
new file mode 100644
index 000000000000..53cead9f00cf
--- /dev/null
+++ b/svx/source/dialog/grfflt.cxx
@@ -0,0 +1,793 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <tools/shl.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/viewsh.hxx>
+#ifndef _SFXOBJSH_HXX
+#include <sfx2/objsh.hxx>
+#endif
+#include <sfx2/request.hxx>
+
+#include <svx/dialmgr.hxx>
+#include <svx/grfflt.hxx>
+//#include "grfflt.hrc"
+#include <svx/dialogs.hrc>
+#include <svx/svxdlg.hxx> //CHINA001
+
+// --------------------
+// - SvxGraphicFilter -
+// --------------------
+
+sal_uIntPtr SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest& rReq, GraphicObject& rFilterObject )
+{
+ const Graphic& rGraphic = rFilterObject.GetGraphic();
+ sal_uIntPtr nRet = SVX_GRAPHICFILTER_UNSUPPORTED_GRAPHICTYPE;
+
+ if( rGraphic.GetType() == GRAPHIC_BITMAP )
+ {
+ SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+ SfxObjectShell* pShell = pViewFrame ? pViewFrame->GetObjectShell() : NULL;
+ Window* pWindow = ( pViewFrame && pViewFrame->GetViewShell() ) ? pViewFrame->GetViewShell()->GetWindow() : NULL;
+ Graphic aGraphic;
+
+ switch( rReq.GetSlot() )
+ {
+ case( SID_GRFFILTER_INVERT ):
+ {
+ if( pShell )
+ pShell->SetWaitCursor( sal_True );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnimation( rGraphic.GetAnimation() );
+
+ if( aAnimation.Invert() )
+ aGraphic = aAnimation;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Invert() )
+ aGraphic = aBmpEx;
+ }
+
+ if( pShell )
+ pShell->SetWaitCursor( sal_False );
+ }
+ break;
+
+ case( SID_GRFFILTER_SMOOTH ):
+ {
+ if( pShell )
+ pShell->SetWaitCursor( sal_True );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnimation( rGraphic.GetAnimation() );
+
+ if( aAnimation.Filter( BMP_FILTER_SMOOTH ) )
+ aGraphic = aAnimation;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_SMOOTH ) )
+ aGraphic = aBmpEx;
+ }
+
+ if( pShell )
+ pShell->SetWaitCursor( sal_False );
+ }
+ break;
+
+ case( SID_GRFFILTER_SHARPEN ):
+ {
+ if( pShell )
+ pShell->SetWaitCursor( sal_True );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnimation( rGraphic.GetAnimation() );
+
+ if( aAnimation.Filter( BMP_FILTER_SHARPEN ) )
+ aGraphic = aAnimation;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_SHARPEN ) )
+ aGraphic = aBmpEx;
+ }
+
+ if( pShell )
+ pShell->SetWaitCursor( sal_False );
+ }
+ break;
+
+ case( SID_GRFFILTER_REMOVENOISE ):
+ {
+ if( pShell )
+ pShell->SetWaitCursor( sal_True );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnimation( rGraphic.GetAnimation() );
+
+ if( aAnimation.Filter( BMP_FILTER_REMOVENOISE ) )
+ aGraphic = aAnimation;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_REMOVENOISE ) )
+ aGraphic = aBmpEx;
+ }
+
+ if( pShell )
+ pShell->SetWaitCursor( sal_False );
+ }
+ break;
+
+ case( SID_GRFFILTER_SOBEL ):
+ {
+ if( pShell )
+ pShell->SetWaitCursor( sal_True );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnimation( rGraphic.GetAnimation() );
+
+ if( aAnimation.Filter( BMP_FILTER_SOBEL_GREY ) )
+ aGraphic = aAnimation;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_SOBEL_GREY ) )
+ aGraphic = aBmpEx;
+ }
+
+ if( pShell )
+ pShell->SetWaitCursor( sal_False );
+ }
+ break;
+
+ case( SID_GRFFILTER_MOSAIC ):
+ {
+ //CHINA001 GraphicFilterMosaic aDlg( pWindow, rGraphic, 4, 4, sal_False );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ AbstractGraphicFilterDialog* aDlg = pFact->CreateGraphicFilterMosaic( pWindow, rGraphic, 4, 4, sal_False, RID_SVX_GRFFILTER_DLG_MOSAIC);
+ DBG_ASSERT(aDlg, "Dialogdiet fail!");//CHINA001
+ if( aDlg->Execute() == RET_OK ) //CHINA001 if( aDlg.Execute() == RET_OK )
+ aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 ); //CHINA001 aGraphic = aDlg.GetFilteredGraphic( rGraphic, 1.0, 1.0 );
+ delete aDlg; //add by CHINA001
+ }
+ }
+ break;
+
+ case( SID_GRFFILTER_EMBOSS ):
+ {
+ //CHINA001 GraphicFilterEmboss aDlg( pWindow, rGraphic, RP_MM );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ AbstractGraphicFilterDialog* aDlg = pFact->CreateGraphicFilterEmboss( pWindow, rGraphic, RP_MM, RID_SVX_GRFFILTER_DLG_EMBOSS );
+ DBG_ASSERT(aDlg, "Dialogdiet fail!");//CHINA001
+ if( aDlg->Execute() == RET_OK ) //CHINA001 if( aDlg.Execute() == RET_OK )
+ aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 ); //CHINA001 aGraphic = aDlg.GetFilteredGraphic( rGraphic, 1.0, 1.0 );
+ delete aDlg; //add by CHINA001
+ }
+ }
+ break;
+
+ case( SID_GRFFILTER_POSTER ):
+ {
+ //CHINA001 GraphicFilterPoster aDlg( pWindow, rGraphic, 16 );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ AbstractGraphicFilterDialog* aDlg = pFact->CreateGraphicFilterPosterSepia( pWindow, rGraphic, 16, RID_SVX_GRFFILTER_DLG_POSTER );
+ DBG_ASSERT(aDlg, "Dialogdiet fail!");//CHINA001
+ if( aDlg->Execute() == RET_OK ) //CHINA001 if( aDlg.Execute() == RET_OK )
+ aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 ); //CHINA001 aGraphic = aDlg.GetFilteredGraphic( rGraphic, 1.0, 1.0 );
+ delete aDlg; //add by CHINA001
+ }
+ }
+ break;
+
+ case( SID_GRFFILTER_POPART ):
+ {
+ if( pShell )
+ pShell->SetWaitCursor( sal_True );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnimation( rGraphic.GetAnimation() );
+
+ if( aAnimation.Filter( BMP_FILTER_POPART ) )
+ aGraphic = aAnimation;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_POPART ) )
+ aGraphic = aBmpEx;
+ }
+
+ if( pShell )
+ pShell->SetWaitCursor( sal_False );
+ }
+ break;
+
+ case( SID_GRFFILTER_SEPIA ):
+ {
+ //CHINA001 GraphicFilterSepia aDlg( pWindow, rGraphic, 10 );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ AbstractGraphicFilterDialog* aDlg = pFact->CreateGraphicFilterPosterSepia( pWindow, rGraphic, 10, RID_SVX_GRFFILTER_DLG_SEPIA );
+ DBG_ASSERT(aDlg, "Dialogdiet fail!");//CHINA001
+ if( aDlg->Execute() == RET_OK ) //CHINA001 if( aDlg.Execute() == RET_OK )
+ aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 ); //CHINA001 aGraphic = aDlg.GetFilteredGraphic( rGraphic, 1.0, 1.0 );
+ delete aDlg; //add by CHINA001
+ }
+ }
+ break;
+
+ case( SID_GRFFILTER_SOLARIZE ):
+ {
+ //CHINA001 GraphicFilterSolarize aDlg( pWindow, rGraphic, 128, sal_False );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ AbstractGraphicFilterDialog* aDlg = pFact->CreateGraphicFilterSolarize( pWindow, rGraphic, 128, sal_False, RID_SVX_GRFFILTER_DLG_SOLARIZE );
+ DBG_ASSERT(aDlg, "Dialogdiet fail!");//CHINA001
+ if( aDlg->Execute() == RET_OK ) //CHINA001 if( aDlg.Execute() == RET_OK )
+ aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 ); //CHINA001 aGraphic = aDlg.GetFilteredGraphic( rGraphic, 1.0, 1.0 );
+ delete aDlg; //add by CHINA001
+ }
+ }
+ break;
+
+ case SID_GRFFILTER :
+ {
+ // do nothing; no error
+ nRet = SVX_GRAPHICFILTER_ERRCODE_NONE;
+ break;
+ }
+
+ default:
+ {
+ DBG_ERROR( "SvxGraphicFilter: selected filter slot not yet implemented" );
+ nRet = SVX_GRAPHICFILTER_UNSUPPORTED_SLOT;
+ }
+ break;
+ }
+
+ if( aGraphic.GetType() != GRAPHIC_NONE )
+ {
+ rFilterObject.SetGraphic( aGraphic );
+ nRet = SVX_GRAPHICFILTER_ERRCODE_NONE;
+ }
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void SvxGraphicFilter::DisableGraphicFilterSlots( SfxItemSet& rSet )
+{
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER ) )
+ rSet.DisableItem( SID_GRFFILTER );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_INVERT ) )
+ rSet.DisableItem( SID_GRFFILTER_INVERT );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_SMOOTH ) )
+ rSet.DisableItem( SID_GRFFILTER_SMOOTH );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_SHARPEN ) )
+ rSet.DisableItem( SID_GRFFILTER_SHARPEN );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_REMOVENOISE ) )
+ rSet.DisableItem( SID_GRFFILTER_REMOVENOISE );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_SOBEL ) )
+ rSet.DisableItem( SID_GRFFILTER_SOBEL );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_MOSAIC ) )
+ rSet.DisableItem( SID_GRFFILTER_MOSAIC );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_EMBOSS ) )
+ rSet.DisableItem( SID_GRFFILTER_EMBOSS );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_POSTER ) )
+ rSet.DisableItem( SID_GRFFILTER_POSTER );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_POPART ) )
+ rSet.DisableItem( SID_GRFFILTER_POPART );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_SEPIA ) )
+ rSet.DisableItem( SID_GRFFILTER_SEPIA );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_SOLARIZE ) )
+ rSet.DisableItem( SID_GRFFILTER_SOLARIZE );
+};
+/* CHINA001 move to cuigrfflt.cxx
+// --------------------------------------
+// - GraphicFilterDialog::PreviewWindow -
+// --------------------------------------
+
+GraphicFilterDialog::PreviewWindow::PreviewWindow( Window* pParent, const ResId& rResId ) :
+ Control( pParent, rResId )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+GraphicFilterDialog::PreviewWindow::~PreviewWindow()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void GraphicFilterDialog::PreviewWindow::Paint( const Rectangle& rRect )
+{
+ Control::Paint( rRect );
+
+ const Size aGrfSize( LogicToPixel( maGraphic.GetPrefSize(), maGraphic.GetPrefMapMode() ) );
+ const Size aOutSize( GetOutputSizePixel() );
+ const Point aGrfPos( ( aOutSize.Width() - aGrfSize.Width() ) >> 1,
+ ( aOutSize.Height() - aGrfSize.Height() ) >> 1 );
+
+ if( maGraphic.IsAnimated() )
+ maGraphic.StartAnimation( this , aGrfPos, aGrfSize );
+ else
+ maGraphic.Draw( this, aGrfPos, aGrfSize );
+}
+
+// -----------------------------------------------------------------------------
+
+void GraphicFilterDialog::PreviewWindow::SetGraphic( const Graphic& rGraphic )
+{
+ maGraphic = rGraphic;
+
+ if( maGraphic.IsAnimated() || maGraphic.IsTransparent() )
+ Invalidate();
+ else
+ Paint( Rectangle( Point(), GetOutputSizePixel() ) );
+}
+
+// -----------------------
+// - GraphicFilterDialog -
+// -----------------------
+
+GraphicFilterDialog::GraphicFilterDialog( Window* pParent, const ResId& rResId, const Graphic& rGraphic ) :
+ ModalDialog ( pParent, rResId ),
+ mfScaleX ( 0.0 ),
+ mfScaleY ( 0.0 ),
+ maSizePixel ( LogicToPixel( rGraphic.GetPrefSize(), rGraphic.GetPrefMapMode() ) ),
+ maModifyHdl ( LINK( this, GraphicFilterDialog, ImplModifyHdl ) ),
+ maPreview ( this, SVX_RES( CTL_PREVIEW ) ),
+ maFlParameter ( this, SVX_RES( FL_PARAMETER ) ),
+ maBtnOK ( this, SVX_RES( BTN_OK ) ),
+ maBtnCancel ( this, SVX_RES( BTN_CANCEL ) ),
+ maBtnHelp ( this, SVX_RES( BTN_HELP ) )
+{
+ const Size aPreviewSize( maPreview.GetOutputSizePixel() );
+ Size aGrfSize( maSizePixel );
+
+ if( rGraphic.GetType() == GRAPHIC_BITMAP &&
+ aPreviewSize.Width() && aPreviewSize.Height() &&
+ aGrfSize.Width() && aGrfSize.Height() )
+ {
+ const double fGrfWH = (double) aGrfSize.Width() / aGrfSize.Height();
+ const double fPreWH = (double) aPreviewSize.Width() / aPreviewSize.Height();
+
+ if( fGrfWH < fPreWH )
+ {
+ aGrfSize.Width() = (long) ( aPreviewSize.Height() * fGrfWH );
+ aGrfSize.Height()= aPreviewSize.Height();
+ }
+ else
+ {
+ aGrfSize.Width() = aPreviewSize.Width();
+ aGrfSize.Height()= (long) ( aPreviewSize.Width() / fGrfWH);
+ }
+
+ mfScaleX = (double) aGrfSize.Width() / maSizePixel.Width();
+ mfScaleY = (double) aGrfSize.Height() / maSizePixel.Height();
+
+ if( !rGraphic.IsAnimated() )
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Scale( aGrfSize, BMP_SCALE_INTERPOLATE ) )
+ maGraphic = aBmpEx;
+ }
+ }
+
+ maTimer.SetTimeoutHdl( LINK( this, GraphicFilterDialog, ImplPreviewTimeoutHdl ) );
+ maTimer.SetTimeout( 100 );
+ ImplModifyHdl( NULL );
+}
+
+// -----------------------------------------------------------------------------
+
+GraphicFilterDialog::~GraphicFilterDialog()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( GraphicFilterDialog, ImplPreviewTimeoutHdl, Timer*, pTimer )
+{
+ maTimer.Stop();
+ maPreview.SetGraphic( GetFilteredGraphic( maGraphic, mfScaleX, mfScaleY ) );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( GraphicFilterDialog, ImplModifyHdl, void*, p )
+{
+ if( maGraphic.GetType() == GRAPHIC_BITMAP )
+ {
+ maTimer.Stop();
+ maTimer.Start();
+ }
+
+ return 0;
+}
+
+// ----------------
+// - FilterMosaic -
+// ----------------
+
+GraphicFilterMosaic::GraphicFilterMosaic( Window* pParent, const Graphic& rGraphic,
+ sal_uInt16 nTileWidth, sal_uInt16 nTileHeight, sal_Bool bEnhanceEdges ) :
+ GraphicFilterDialog( pParent, SVX_RES( RID_SVX_GRFFILTER_DLG_MOSAIC ), rGraphic ),
+ maFtWidth ( this, SVX_RES( DLG_FILTERMOSAIC_FT_WIDTH ) ),
+ maMtrWidth ( this, SVX_RES( DLG_FILTERMOSAIC_MTR_WIDTH ) ),
+ maFtHeight ( this, SVX_RES( DLG_FILTERMOSAIC_FT_HEIGHT ) ),
+ maMtrHeight ( this, SVX_RES( DLG_FILTERMOSAIC_MTR_HEIGHT ) ),
+ maCbxEdges ( this, SVX_RES( DLG_FILTERMOSAIC_CBX_EDGES ) )
+{
+ FreeResource();
+
+ maMtrWidth.SetValue( nTileWidth );
+ maMtrWidth.SetLast( GetGraphicSizePixel().Width() );
+ maMtrWidth.SetModifyHdl( GetModifyHdl() );
+
+ maMtrHeight.SetValue( nTileHeight );
+ maMtrHeight.SetLast( GetGraphicSizePixel().Height() );
+ maMtrHeight.SetModifyHdl( GetModifyHdl() );
+
+ maCbxEdges.Check( bEnhanceEdges );
+ maCbxEdges.SetToggleHdl( GetModifyHdl() );
+
+ maMtrWidth.GrabFocus();
+}
+
+// -----------------------------------------------------------------------------
+
+GraphicFilterMosaic::~GraphicFilterMosaic()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+Graphic GraphicFilterMosaic::GetFilteredGraphic( const Graphic& rGraphic,
+ double fScaleX, double fScaleY )
+{
+ Graphic aRet;
+ const Size aSize( Max( FRound( GetTileWidth() * fScaleX ), 1L ),
+ Max( FRound( GetTileHeight() * fScaleY ), 1L ) );
+ BmpFilterParam aParam( aSize );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnim( rGraphic.GetAnimation() );
+
+ if( aAnim.Filter( BMP_FILTER_MOSAIC, &aParam ) )
+ {
+ if( IsEnhanceEdges() )
+ aAnim.Filter( BMP_FILTER_SHARPEN );
+
+ aRet = aAnim;
+ }
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_MOSAIC, &aParam ) )
+ {
+ if( IsEnhanceEdges() )
+ aBmpEx.Filter( BMP_FILTER_SHARPEN );
+
+ aRet = aBmpEx;
+ }
+ }
+
+ return aRet;
+}
+
+// ------------------
+// - GraphicFilterSolarize -
+// ------------------
+
+GraphicFilterSolarize::GraphicFilterSolarize( Window* pParent, const Graphic& rGraphic,
+ sal_uInt8 cGreyThreshold, sal_Bool bInvert ) :
+ GraphicFilterDialog ( pParent, SVX_RES( RID_SVX_GRFFILTER_DLG_SOLARIZE ), rGraphic ),
+ maFtThreshold ( this, SVX_RES( DLG_FILTERSOLARIZE_FT_THRESHOLD ) ),
+ maMtrThreshold ( this, SVX_RES( DLG_FILTERSOLARIZE_MTR_THRESHOLD ) ),
+ maCbxInvert ( this, SVX_RES( DLG_FILTERSOLARIZE_CBX_INVERT ) )
+{
+ FreeResource();
+
+ maMtrThreshold.SetValue( FRound( cGreyThreshold / 2.55 ) );
+ maMtrThreshold.SetModifyHdl( GetModifyHdl() );
+
+ maCbxInvert.Check( bInvert );
+ maCbxInvert.SetToggleHdl( GetModifyHdl() );
+
+ maMtrThreshold.GrabFocus();
+}
+
+// -----------------------------------------------------------------------------
+
+GraphicFilterSolarize::~GraphicFilterSolarize()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+Graphic GraphicFilterSolarize::GetFilteredGraphic( const Graphic& rGraphic,
+ double fScaleX, double fScaleY )
+{
+ Graphic aRet;
+ BmpFilterParam aParam( GetGreyThreshold() );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnim( rGraphic.GetAnimation() );
+
+ if( aAnim.Filter( BMP_FILTER_SOLARIZE, &aParam ) )
+ {
+ if( IsInvert() )
+ aAnim.Invert();
+
+ aRet = aAnim;
+ }
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_SOLARIZE, &aParam ) )
+ {
+ if( IsInvert() )
+ aBmpEx.Invert();
+
+ aRet = aBmpEx;
+ }
+ }
+
+ return aRet;
+}
+
+// ----------------------
+// - GraphicFilterSepia -
+// ----------------------
+
+GraphicFilterSepia::GraphicFilterSepia( Window* pParent, const Graphic& rGraphic,
+ sal_uInt16 nSepiaPercent ) :
+ GraphicFilterDialog ( pParent, SVX_RES( RID_SVX_GRFFILTER_DLG_SEPIA ), rGraphic ),
+ maFtSepia ( this, SVX_RES( DLG_FILTERSEPIA_FT_SEPIA ) ),
+ maMtrSepia ( this, SVX_RES( DLG_FILTERSEPIA_MTR_SEPIA ) )
+{
+ FreeResource();
+
+ maMtrSepia.SetValue( nSepiaPercent );
+ maMtrSepia.SetModifyHdl( GetModifyHdl() );
+
+ maMtrSepia.GrabFocus();
+}
+
+// -----------------------------------------------------------------------------
+
+GraphicFilterSepia::~GraphicFilterSepia()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+Graphic GraphicFilterSepia::GetFilteredGraphic( const Graphic& rGraphic,
+ double fScaleX, double fScaleY )
+{
+ Graphic aRet;
+ BmpFilterParam aParam( GetSepiaPercent() );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnim( rGraphic.GetAnimation() );
+
+ if( aAnim.Filter( BMP_FILTER_SEPIA, &aParam ) )
+ aRet = aAnim;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_SEPIA, &aParam ) )
+ aRet = aBmpEx;
+ }
+
+ return aRet;
+}
+
+// -----------------------
+// - GraphicFilterPoster -
+// -----------------------
+
+GraphicFilterPoster::GraphicFilterPoster( Window* pParent, const Graphic& rGraphic,
+ sal_uInt16 nPosterCount ) :
+ GraphicFilterDialog ( pParent, SVX_RES( RID_SVX_GRFFILTER_DLG_POSTER ), rGraphic ),
+ maFtPoster ( this, SVX_RES( DLG_FILTERPOSTER_FT_POSTER ) ),
+ maNumPoster ( this, SVX_RES( DLG_FILTERPOSTER_NUM_POSTER ) )
+{
+ FreeResource();
+
+ maNumPoster.SetFirst( 2 );
+ maNumPoster.SetLast( rGraphic.GetBitmapEx().GetBitCount() );
+ maNumPoster.SetValue( nPosterCount );
+ maNumPoster.SetModifyHdl( GetModifyHdl() );
+ maNumPoster.GrabFocus();
+}
+
+// -----------------------------------------------------------------------------
+
+GraphicFilterPoster::~GraphicFilterPoster()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+Graphic GraphicFilterPoster::GetFilteredGraphic( const Graphic& rGraphic,
+ double fScaleX, double fScaleY )
+{
+ Graphic aRet;
+ const sal_uInt16 nPosterCount = GetPosterColorCount();
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnim( rGraphic.GetAnimation() );
+
+ if( aAnim.ReduceColors( nPosterCount, BMP_REDUCE_POPULAR ) )
+ aRet = aAnim;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.ReduceColors( nPosterCount, BMP_REDUCE_POPULAR ) )
+ aRet = aBmpEx;
+ }
+
+ return aRet;
+}
+
+// -----------------------
+// - GraphicFilterEmboss -
+// -----------------------
+
+void GraphicFilterEmboss::EmbossControl::MouseButtonDown( const MouseEvent& rEvt )
+{
+ const RECT_POINT eOldRP = GetActualRP();
+
+ SvxRectCtl::MouseButtonDown( rEvt );
+
+ if( GetActualRP() != eOldRP )
+ maModifyHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------------
+
+GraphicFilterEmboss::GraphicFilterEmboss( Window* pParent, const Graphic& rGraphic,
+ RECT_POINT eLightSource ) :
+ GraphicFilterDialog ( pParent, SVX_RES( RID_SVX_GRFFILTER_DLG_EMBOSS ), rGraphic ),
+ maFtLight ( this, SVX_RES( DLG_FILTEREMBOSS_FT_LIGHT ) ),
+ maCtlLight ( this, SVX_RES( DLG_FILTEREMBOSS_CTL_LIGHT ), eLightSource )
+{
+ FreeResource();
+
+ maCtlLight.SetModifyHdl( GetModifyHdl() );
+ maCtlLight.GrabFocus();
+}
+
+// -----------------------------------------------------------------------------
+
+GraphicFilterEmboss::~GraphicFilterEmboss()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+Graphic GraphicFilterEmboss::GetFilteredGraphic( const Graphic& rGraphic,
+ double fScaleX, double fScaleY )
+{
+ Graphic aRet;
+ sal_uInt16 nAzim, nElev;
+
+ switch( maCtlLight.GetActualRP() )
+ {
+ case( RP_LT ): nAzim = 4500, nElev = 4500; break;
+ case( RP_MT ): nAzim = 9000, nElev = 4500; break;
+ case( RP_RT ): nAzim = 13500, nElev = 4500; break;
+ case( RP_LM ): nAzim = 0, nElev = 4500; break;
+ case( RP_MM ): nAzim = 0, nElev = 9000; break;
+ case( RP_RM ): nAzim = 18000, nElev = 4500; break;
+ case( RP_LB ): nAzim = 31500, nElev = 4500; break;
+ case( RP_MB ): nAzim = 27000, nElev = 4500; break;
+ case( RP_RB ): nAzim = 22500, nElev = 4500; break;
+ }
+
+ BmpFilterParam aParam( nAzim, nElev );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnim( rGraphic.GetAnimation() );
+
+ if( aAnim.Filter( BMP_FILTER_EMBOSS_GREY, &aParam ) )
+ aRet = aAnim;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_EMBOSS_GREY, &aParam ) )
+ aRet = aBmpEx;
+ }
+
+ return aRet;
+}
+*/
diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx
new file mode 100644
index 000000000000..67e34801ca34
--- /dev/null
+++ b/svx/source/dialog/hdft.cxx
@@ -0,0 +1,983 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#include <svl/itemiter.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/module.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/graph.hxx>
+
+#include <sfx2/sfxsids.hrc>
+#include <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+#include "hdft.hrc"
+#include <svl/intitem.hxx>
+
+#define _SVX_HDFT_CXX
+
+#include <svx/hdft.hxx>
+#include <svx/pageitem.hxx>
+//CHINA001 #include "bbdlg.hxx"
+#include "svx/dlgutil.hxx"
+#include <svx/dialmgr.hxx>
+#include "svx/htmlmode.hxx"
+
+#include <editeng/brshitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/shaditem.hxx>
+#include <editeng/sizeitem.hxx>
+#include <editeng/boxitem.hxx>
+
+#include <svx/svxdlg.hxx> //CHINA001
+#include <svx/dialogs.hrc> //CHINA001
+// static ----------------------------------------------------------------
+
+// --> OD 2004-06-18 #i19922#
+//static const long MINBODY = 284; // 0,5cm in twips aufgerundet
+static const long MINBODY = 56; // 1mm in twips rounded
+
+// default distance to Header or footer
+static const long DEF_DIST_WRITER = 500; // 5mm (Writer)
+static const long DEF_DIST_CALC = 250; // 2,5mm (Calc)
+
+static sal_uInt16 pRanges[] =
+{
+ SID_ATTR_BRUSH, SID_ATTR_BRUSH,
+ SID_ATTR_BORDER_OUTER, SID_ATTR_BORDER_OUTER,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ SID_ATTR_BORDER_SHADOW, SID_ATTR_BORDER_SHADOW,
+ SID_ATTR_LRSPACE, SID_ATTR_LRSPACE,
+ SID_ATTR_ULSPACE, SID_ATTR_ULSPACE,
+ SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
+ SID_ATTR_PAGE_HEADERSET, SID_ATTR_PAGE_HEADERSET,
+ SID_ATTR_PAGE_FOOTERSET, SID_ATTR_PAGE_FOOTERSET,
+ SID_ATTR_PAGE_ON, SID_ATTR_PAGE_ON,
+ SID_ATTR_PAGE_DYNAMIC, SID_ATTR_PAGE_DYNAMIC,
+ SID_ATTR_PAGE_SHARED, SID_ATTR_PAGE_SHARED,
+ SID_ATTR_HDFT_DYNAMIC_SPACING, SID_ATTR_HDFT_DYNAMIC_SPACING,
+ 0
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+// gibt den Bereich der Which-Werte zurueck
+
+
+sal_uInt16* SvxHeaderPage::GetRanges()
+{
+ return pRanges;
+}
+
+//------------------------------------------------------------------------
+
+SfxTabPage* SvxHeaderPage::Create( Window* pParent, const SfxItemSet& rSet )
+{
+ return new SvxHeaderPage( pParent, rSet );
+}
+
+//------------------------------------------------------------------------
+
+sal_uInt16* SvxFooterPage::GetRanges()
+{
+ return pRanges;
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxFooterPage::Create( Window* pParent, const SfxItemSet& rSet )
+{
+ return new SvxFooterPage( pParent, rSet );
+}
+
+// -----------------------------------------------------------------------
+
+SvxHeaderPage::SvxHeaderPage( Window* pParent, const SfxItemSet& rAttr ) :
+
+ SvxHFPage( pParent, RID_SVXPAGE_HEADER, rAttr, SID_ATTR_PAGE_HEADERSET )
+
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxFooterPage::SvxFooterPage( Window* pParent, const SfxItemSet& rAttr ) :
+
+ SvxHFPage( pParent, RID_SVXPAGE_FOOTER, rAttr, SID_ATTR_PAGE_FOOTERSET )
+
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxHFPage::SvxHFPage( Window* pParent, sal_uInt16 nResId, const SfxItemSet& rAttr, sal_uInt16 nSetId ) :
+
+ SfxTabPage( pParent, SVX_RES( nResId ), rAttr ),
+
+ aTurnOnBox ( this, SVX_RES( CB_TURNON ) ),
+ aCntSharedBox ( this, SVX_RES( CB_SHARED ) ),
+ aLMLbl ( this, SVX_RES( FT_LMARGIN ) ),
+ aLMEdit ( this, SVX_RES( ED_LMARGIN ) ),
+ aRMLbl ( this, SVX_RES( FT_RMARGIN ) ),
+ aRMEdit ( this, SVX_RES( ED_RMARGIN ) ),
+ aDistFT ( this, SVX_RES( FT_DIST ) ),
+ aDistEdit ( this, SVX_RES( ED_DIST ) ),
+ aDynSpacingCB ( this, SVX_RES( CB_DYNSPACING ) ),
+ aHeightFT ( this, SVX_RES( FT_HEIGHT ) ),
+ aHeightEdit ( this, SVX_RES( ED_HEIGHT ) ),
+ aHeightDynBtn ( this, SVX_RES( CB_HEIGHT_DYN ) ),
+ aFrm ( this, SVX_RES( FL_FRAME ) ),
+ aBspWin ( this, SVX_RES( WN_BSP ) ),
+ aBackgroundBtn ( this, SVX_RES( BTN_EXTRAS ) ),
+
+ nId ( nSetId ),
+ pBBSet ( NULL ),
+ bDisableQueryBox ( sal_False ),
+ bEnableBackgroundSelector ( sal_True )
+
+{
+ InitHandler();
+ aBspWin.EnableRTL( sal_False );
+
+ // diese Page braucht ExchangeSupport
+ SetExchangeSupport();
+
+ FreeResource();
+
+ // Metrik einstellen
+ FieldUnit eFUnit = GetModuleFieldUnit( rAttr );
+ SetFieldUnit( aDistEdit, eFUnit );
+ SetFieldUnit( aHeightEdit, eFUnit );
+ SetFieldUnit( aLMEdit, eFUnit );
+ SetFieldUnit( aRMEdit, eFUnit );
+}
+
+// -----------------------------------------------------------------------
+
+SvxHFPage::~SvxHFPage()
+{
+ delete pBBSet;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxHFPage::FillItemSet( SfxItemSet& rSet )
+{
+ const sal_uInt16 nWSize = GetWhich( SID_ATTR_PAGE_SIZE );
+ const sal_uInt16 nWLRSpace = GetWhich( SID_ATTR_LRSPACE );
+ const sal_uInt16 nWULSpace = GetWhich( SID_ATTR_ULSPACE );
+ const sal_uInt16 nWOn = GetWhich( SID_ATTR_PAGE_ON );
+ const sal_uInt16 nWDynamic = GetWhich( SID_ATTR_PAGE_DYNAMIC );
+ const sal_uInt16 nWDynSpacing = GetWhich( SID_ATTR_HDFT_DYNAMIC_SPACING );
+ const sal_uInt16 nWShared = GetWhich( SID_ATTR_PAGE_SHARED );
+ const sal_uInt16 nWBrush = GetWhich( SID_ATTR_BRUSH );
+ const sal_uInt16 nWBox = GetWhich( SID_ATTR_BORDER_OUTER );
+ const sal_uInt16 nWBoxInfo = GetWhich( SID_ATTR_BORDER_INNER );
+ const sal_uInt16 nWShadow = GetWhich( SID_ATTR_BORDER_SHADOW );
+ const sal_uInt16 aWhichTab[] = { nWSize, nWSize,
+ nWLRSpace, nWLRSpace,
+ nWULSpace, nWULSpace,
+ nWOn, nWOn,
+ nWDynamic, nWDynamic,
+ nWShared, nWShared,
+ nWBrush, nWBrush,
+ nWBoxInfo, nWBoxInfo,
+ nWBox, nWBox,
+ nWShadow, nWShadow,
+ nWDynSpacing, nWDynSpacing,
+ 0 };
+ const SfxItemSet& rOldSet = GetItemSet();
+ SfxItemPool* pPool = rOldSet.GetPool();
+ DBG_ASSERT( pPool, "no pool :-(" );
+ SfxMapUnit eUnit = pPool->GetMetric( nWSize );
+ SfxItemSet aSet ( *pPool, aWhichTab );
+
+ //--------------------------------------------------------------------
+
+ aSet.Put( SfxBoolItem( nWOn, aTurnOnBox.IsChecked() ) );
+ aSet.Put( SfxBoolItem( nWDynamic, aHeightDynBtn.IsChecked() ) );
+ aSet.Put( SfxBoolItem( nWShared, aCntSharedBox.IsChecked() ) );
+ if(aDynSpacingCB.IsVisible() && SFX_WHICH_MAX > nWDynSpacing)
+ {
+ SfxBoolItem* pBoolItem = (SfxBoolItem*)pPool->GetDefaultItem(nWDynSpacing).Clone();
+ pBoolItem->SetValue(aDynSpacingCB.IsChecked());
+ aSet.Put(*pBoolItem);
+ delete pBoolItem;
+ }
+
+ // Groesse
+ SvxSizeItem aSizeItem( (const SvxSizeItem&)rOldSet.Get( nWSize ) );
+ Size aSize( aSizeItem.GetSize() );
+ long nDist = GetCoreValue( aDistEdit, eUnit );
+ long nH = GetCoreValue( aHeightEdit, eUnit );
+
+ // fixe Hoehe?
+// if ( !aHeightDynBtn.IsChecked() )
+ nH += nDist; // dann Abstand dazu addieren
+ aSize.Height() = nH;
+ aSizeItem.SetSize( aSize );
+ aSet.Put( aSizeItem );
+
+ // Raender
+ SvxLRSpaceItem aLR( nWLRSpace );
+ aLR.SetLeft( (sal_uInt16)GetCoreValue( aLMEdit, eUnit ) );
+ aLR.SetRight( (sal_uInt16)GetCoreValue( aRMEdit, eUnit ) );
+ aSet.Put( aLR );
+
+ SvxULSpaceItem aUL( nWULSpace );
+ if ( nId == SID_ATTR_PAGE_HEADERSET )
+ aUL.SetLower( (sal_uInt16)nDist );
+ else
+ aUL.SetUpper( (sal_uInt16)nDist );
+ aSet.Put( aUL );
+
+ // Hintergrund und Umrandung?
+ if ( pBBSet )
+ aSet.Put( *pBBSet );
+ else
+ {
+ const SfxItemSet* _pSet;
+ const SfxPoolItem* pItem;
+
+ if ( SFX_ITEM_SET ==
+ GetItemSet().GetItemState( GetWhich( nId ), sal_False, &pItem ) )
+ {
+ _pSet = &( (SvxSetItem*)pItem )->GetItemSet();
+
+ if ( _pSet->GetItemState( nWBrush ) == SFX_ITEM_SET )
+ aSet.Put( (const SvxBrushItem&)_pSet->Get( nWBrush ) );
+ if ( _pSet->GetItemState( nWBoxInfo ) == SFX_ITEM_SET )
+ aSet.Put( (const SvxBoxInfoItem&)_pSet->Get( nWBoxInfo ) );
+ if ( _pSet->GetItemState( nWBox ) == SFX_ITEM_SET )
+ aSet.Put( (const SvxBoxItem&)_pSet->Get( nWBox ) );
+ if ( _pSet->GetItemState( nWShadow ) == SFX_ITEM_SET )
+ aSet.Put( (const SvxShadowItem&)_pSet->Get( nWShadow ) );
+ }
+ }
+
+ // Das SetItem wegschreiben
+ SvxSetItem aSetItem( GetWhich( nId ), aSet );
+ rSet.Put( aSetItem );
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------
+void SvxHFPage::Reset( const SfxItemSet& rSet )
+{
+ ActivatePage( rSet );
+ ResetBackground_Impl( rSet );
+
+ SfxItemPool* pPool = GetItemSet().GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool" );
+ SfxMapUnit eUnit = pPool->GetMetric( GetWhich( SID_ATTR_PAGE_SIZE ) );
+
+ // Kopf-/Fusszeilen-Attribute auswerten
+ //
+ const SvxSetItem* pSetItem = 0;
+
+ if ( SFX_ITEM_SET == rSet.GetItemState( GetWhich(nId), sal_False,
+ (const SfxPoolItem**)&pSetItem ) )
+ {
+ const SfxItemSet& rHeaderSet = pSetItem->GetItemSet();
+ const SfxBoolItem& rHeaderOn =
+ (const SfxBoolItem&)rHeaderSet.Get(GetWhich(SID_ATTR_PAGE_ON));
+
+ aTurnOnBox.Check(rHeaderOn.GetValue());
+
+ if ( rHeaderOn.GetValue() )
+ {
+ const SfxBoolItem& rDynamic =
+ (const SfxBoolItem&)rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_DYNAMIC ) );
+ const SfxBoolItem& rShared =
+ (const SfxBoolItem&)rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SHARED ) );
+ const SvxSizeItem& rSize =
+ (const SvxSizeItem&)rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
+ const SvxULSpaceItem& rUL =
+ (const SvxULSpaceItem&)rHeaderSet.Get( GetWhich( SID_ATTR_ULSPACE ) );
+ const SvxLRSpaceItem& rLR =
+ (const SvxLRSpaceItem&)rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
+ if(aDynSpacingCB.IsVisible())
+ {
+ const SfxBoolItem& rDynSpacing =
+ (const SfxBoolItem&)rHeaderSet.Get(GetWhich(SID_ATTR_HDFT_DYNAMIC_SPACING));
+ aDynSpacingCB.Check(rDynSpacing.GetValue());
+ }
+
+
+ if ( nId == SID_ATTR_PAGE_HEADERSET )
+ { // Kopfzeile
+ SetMetricValue( aDistEdit, rUL.GetLower(), eUnit );
+ SetMetricValue( aHeightEdit, rSize.GetSize().Height() - rUL.GetLower(), eUnit );
+ }
+ else
+ { // Fusszeile
+ SetMetricValue( aDistEdit, rUL.GetUpper(), eUnit );
+ SetMetricValue( aHeightEdit, rSize.GetSize().Height() - rUL.GetUpper(), eUnit );
+ }
+
+ aHeightDynBtn.Check(rDynamic.GetValue());
+ SetMetricValue( aLMEdit, rLR.GetLeft(), eUnit );
+ SetMetricValue( aRMEdit, rLR.GetRight(), eUnit );
+ aCntSharedBox.Check(rShared.GetValue());
+ }
+ else
+ pSetItem = 0;
+ }
+ else
+ {
+ // defaults for distance and height
+ long nDefaultDist = DEF_DIST_WRITER;
+ const SfxPoolItem* pExt1 = GetItem( rSet, SID_ATTR_PAGE_EXT1 );
+ const SfxPoolItem* pExt2 = GetItem( rSet, SID_ATTR_PAGE_EXT2 );
+
+ if ( pExt1 && pExt1->ISA(SfxBoolItem) && pExt2 && pExt2->ISA(SfxBoolItem) )
+ nDefaultDist = DEF_DIST_CALC;
+
+ SetMetricValue( aDistEdit, nDefaultDist, SFX_MAPUNIT_100TH_MM );
+ SetMetricValue( aHeightEdit, 500, SFX_MAPUNIT_100TH_MM );
+ }
+
+ if ( !pSetItem )
+ {
+ aTurnOnBox.Check( sal_False );
+ aHeightDynBtn.Check( sal_True );
+ aCntSharedBox.Check( sal_True );
+ }
+
+ TurnOnHdl(0);
+
+ aTurnOnBox.SaveValue();
+ aDistEdit.SaveValue();
+ aHeightEdit.SaveValue();
+ aHeightDynBtn.SaveValue();
+ aLMEdit.SaveValue();
+ aRMEdit.SaveValue();
+ aCntSharedBox.SaveValue();
+ RangeHdl( 0 );
+
+ sal_uInt16 nHtmlMode = 0;
+ const SfxPoolItem* pItem = 0;
+ SfxObjectShell* pShell;
+ if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, sal_False, &pItem) ||
+ ( 0 != (pShell = SfxObjectShell::Current()) &&
+ 0 != (pItem = pShell->GetItem(SID_HTML_MODE))))
+ {
+ nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue();
+ if(nHtmlMode && HTMLMODE_ON)
+ {
+ aCntSharedBox.Hide();
+ aBackgroundBtn.Hide();
+ }
+ }
+
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Handler initialisieren
+ --------------------------------------------------------------------*/
+
+void SvxHFPage::InitHandler()
+{
+ aTurnOnBox.SetClickHdl(LINK(this, SvxHFPage, TurnOnHdl));
+ aDistEdit.SetModifyHdl(LINK(this, SvxHFPage, DistModify));
+ aDistEdit.SetLoseFocusHdl(LINK(this, SvxHFPage, RangeHdl));
+
+ aHeightEdit.SetModifyHdl(LINK(this, SvxHFPage, HeightModify));
+ aHeightEdit.SetLoseFocusHdl(LINK(this,SvxHFPage,RangeHdl));
+
+ aLMEdit.SetModifyHdl(LINK(this, SvxHFPage, BorderModify));
+ aLMEdit.SetLoseFocusHdl(LINK(this, SvxHFPage, RangeHdl));
+ aRMEdit.SetModifyHdl(LINK(this, SvxHFPage, BorderModify));
+ aRMEdit.SetLoseFocusHdl(LINK(this, SvxHFPage, RangeHdl));
+ aBackgroundBtn.SetClickHdl(LINK(this,SvxHFPage, BackgroundHdl));
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ein/aus
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SvxHFPage, TurnOnHdl, CheckBox *, pBox )
+{
+ if ( aTurnOnBox.IsChecked() )
+ {
+ aDistFT.Enable();
+ aDistEdit.Enable();
+ aDynSpacingCB.Enable();
+ aHeightFT.Enable();
+ aHeightEdit.Enable();
+ aHeightDynBtn.Enable();
+ aLMLbl.Enable();
+ aLMEdit.Enable();
+ aRMLbl.Enable();
+ aRMEdit.Enable();
+
+ sal_uInt16 nUsage = aBspWin.GetUsage();
+
+ if( nUsage == SVX_PAGE_RIGHT || nUsage == SVX_PAGE_LEFT )
+ aCntSharedBox.Disable();
+ else
+ aCntSharedBox.Enable();
+ aBackgroundBtn.Enable();
+ }
+ else
+ {
+ sal_Bool bDelete = sal_True;
+
+ if ( !bDisableQueryBox && pBox && aTurnOnBox.GetSavedValue() == sal_True )
+ bDelete = ( QueryBox( this, SVX_RES( RID_SVXQBX_DELETE_HEADFOOT ) ).Execute() == RET_YES );
+
+ if ( bDelete )
+ {
+ aDistFT.Disable();
+ aDistEdit.Disable();
+ aDynSpacingCB.Enable(sal_False);
+ aHeightFT.Disable();
+ aHeightEdit.Disable();
+ aHeightDynBtn.Disable();
+
+ aLMLbl.Disable();
+ aLMEdit.Disable();
+ aRMLbl.Disable();
+ aRMEdit.Disable();
+
+ aCntSharedBox.Disable();
+ aBackgroundBtn.Disable();
+ }
+ else
+ aTurnOnBox.Check();
+ }
+ UpdateExample();
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Abstand im Bsp Modifizieren
+ --------------------------------------------------------------------*/
+
+IMPL_LINK_INLINE_START( SvxHFPage, DistModify, MetricField *, EMPTYARG )
+{
+ UpdateExample();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvxHFPage, DistModify, MetricField *, EMPTYARG )
+
+IMPL_LINK_INLINE_START( SvxHFPage, HeightModify, MetricField *, EMPTYARG )
+{
+ UpdateExample();
+
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvxHFPage, HeightModify, MetricField *, EMPTYARG )
+
+/*--------------------------------------------------------------------
+ Beschreibung: Raender einstellen
+ --------------------------------------------------------------------*/
+
+IMPL_LINK_INLINE_START( SvxHFPage, BorderModify, MetricField *, EMPTYARG )
+{
+ UpdateExample();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvxHFPage, BorderModify, MetricField *, EMPTYARG )
+
+/*--------------------------------------------------------------------
+ Beschreibung: Hintergrund
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SvxHFPage, BackgroundHdl, Button *, EMPTYARG )
+{
+ if ( !pBBSet )
+ {
+ // nur die n"otigen Items f"uer Umrandung und Hintergrund benutzen
+ sal_uInt16 nBrush = GetWhich( SID_ATTR_BRUSH );
+ sal_uInt16 nOuter = GetWhich( SID_ATTR_BORDER_OUTER );
+ sal_uInt16 nInner = GetWhich( SID_ATTR_BORDER_INNER, sal_False );
+ sal_uInt16 nShadow = GetWhich( SID_ATTR_BORDER_SHADOW );
+
+ // einen leeren Set erzeugenc
+ pBBSet = new SfxItemSet( *GetItemSet().GetPool(), nBrush, nBrush,
+ nOuter, nOuter, nInner, nInner,
+ nShadow, nShadow, 0 );
+ const SfxPoolItem* pItem;
+
+ if ( SFX_ITEM_SET ==
+ GetItemSet().GetItemState( GetWhich( nId ), sal_False, &pItem ) )
+ // wenn es schon einen gesetzen Set gibt, dann diesen benutzen
+ pBBSet->Put( ( (SvxSetItem*)pItem)->GetItemSet() );
+
+ if ( SFX_ITEM_SET ==
+ GetItemSet().GetItemState( nInner, sal_False, &pItem ) )
+ // das gesetze InfoItem wird immer ben"otigt
+ pBBSet->Put( *pItem );
+ }
+
+ //CHINA001 SvxBorderBackgroundDlg* pDlg =
+//CHINA001 new SvxBorderBackgroundDlg( this, *pBBSet, bEnableBackgroundSelector );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ SfxAbstractTabDialog* pDlg = pFact->CreateSvxBorderBackgroundDlg( this, *pBBSet, bEnableBackgroundSelector );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+ if ( pDlg->Execute() == RET_OK && pDlg->GetOutputItemSet() )
+ {
+ SfxItemIter aIter( *pDlg->GetOutputItemSet() );
+ const SfxPoolItem* pItem = aIter.FirstItem();
+
+ while ( pItem )
+ {
+ if ( !IsInvalidItem( pItem ) )
+ pBBSet->Put( *pItem );
+ pItem = aIter.NextItem();
+ }
+
+ //----------------------------------------------------------------
+
+ sal_uInt16 nWhich = GetWhich( SID_ATTR_BRUSH );
+
+ if ( pBBSet->GetItemState( nWhich ) == SFX_ITEM_SET )
+ {
+ const SvxBrushItem& rItem = (const SvxBrushItem&)pBBSet->Get( nWhich );
+ if ( nId == SID_ATTR_PAGE_HEADERSET )
+ aBspWin.SetHdColor( rItem.GetColor() );
+ else
+ aBspWin.SetFtColor( rItem.GetColor() );
+ }
+
+ //----------------------------------------------------------------
+
+ nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
+
+ if ( pBBSet->GetItemState( nWhich ) == SFX_ITEM_SET )
+ {
+ const SvxBoxItem& rItem = (const SvxBoxItem&)pBBSet->Get( nWhich );
+
+ if ( nId == SID_ATTR_PAGE_HEADERSET )
+ aBspWin.SetHdBorder( rItem );
+ else
+ aBspWin.SetFtBorder( rItem );
+ }
+
+ UpdateExample();
+ }
+ delete pDlg;
+ }
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Bsp
+ --------------------------------------------------------------------*/
+
+void SvxHFPage::UpdateExample()
+{
+ if ( nId == SID_ATTR_PAGE_HEADERSET )
+ {
+ aBspWin.SetHeader( aTurnOnBox.IsChecked() );
+ aBspWin.SetHdHeight( GetCoreValue( aHeightEdit, SFX_MAPUNIT_TWIP ) );
+ aBspWin.SetHdDist( GetCoreValue( aDistEdit, SFX_MAPUNIT_TWIP ) );
+ aBspWin.SetHdLeft( GetCoreValue( aLMEdit, SFX_MAPUNIT_TWIP ) );
+ aBspWin.SetHdRight( GetCoreValue( aRMEdit, SFX_MAPUNIT_TWIP ) );
+ }
+ else
+ {
+ aBspWin.SetFooter( aTurnOnBox.IsChecked() );
+ aBspWin.SetFtHeight( GetCoreValue( aHeightEdit, SFX_MAPUNIT_TWIP ) );
+ aBspWin.SetFtDist( GetCoreValue( aDistEdit, SFX_MAPUNIT_TWIP ) );
+ aBspWin.SetFtLeft( GetCoreValue( aLMEdit, SFX_MAPUNIT_TWIP ) );
+ aBspWin.SetFtRight( GetCoreValue( aRMEdit, SFX_MAPUNIT_TWIP ) );
+ }
+ aBspWin.Invalidate();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Hintergrund im Beispiel setzen
+ --------------------------------------------------------------------*/
+
+void SvxHFPage::ResetBackground_Impl( const SfxItemSet& rSet )
+{
+ sal_uInt16 nWhich = GetWhich( SID_ATTR_PAGE_HEADERSET );
+
+ if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET )
+ {
+ const SvxSetItem& rSetItem =
+ (const SvxSetItem&)rSet.Get( nWhich, sal_False );
+ const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
+ const SfxBoolItem& rOn =
+ (const SfxBoolItem&)rTmpSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
+
+ if ( rOn.GetValue() )
+ {
+ nWhich = GetWhich( SID_ATTR_BRUSH );
+
+ if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
+ {
+ const SvxBrushItem& rItem = (const SvxBrushItem&)rTmpSet.Get( nWhich );
+ aBspWin.SetHdColor( rItem.GetColor() );
+ }
+ nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
+
+ if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
+ {
+ const SvxBoxItem& rItem =
+ (const SvxBoxItem&)rTmpSet.Get( nWhich );
+ aBspWin.SetHdBorder( rItem );
+ }
+ }
+ }
+
+ nWhich = GetWhich( SID_ATTR_PAGE_FOOTERSET );
+
+ if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET )
+ {
+ const SvxSetItem& rSetItem =
+ (const SvxSetItem&)rSet.Get( nWhich, sal_False );
+ const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
+ const SfxBoolItem& rOn =
+ (const SfxBoolItem&)rTmpSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
+
+ if ( rOn.GetValue() )
+ {
+ nWhich = GetWhich( SID_ATTR_BRUSH );
+
+ if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
+ {
+ const SvxBrushItem& rItem = (const SvxBrushItem&)rTmpSet.Get( nWhich );
+ aBspWin.SetFtColor( rItem.GetColor() );
+ }
+ nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
+
+ if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
+ {
+ const SvxBoxItem& rItem =
+ (const SvxBoxItem&)rTmpSet.Get( nWhich );
+ aBspWin.SetFtBorder( rItem );
+ }
+ }
+ }
+ nWhich = GetWhich( SID_ATTR_BRUSH );
+
+ if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
+ {
+ const SvxBrushItem& rItem = (const SvxBrushItem&)rSet.Get( nWhich );
+ aBspWin.SetColor( rItem.GetColor() );
+ const Graphic* pGrf = rItem.GetGraphic();
+
+ if ( pGrf )
+ {
+ Bitmap aBitmap = pGrf->GetBitmap();
+ aBspWin.SetBitmap( &aBitmap );
+ }
+ else
+ aBspWin.SetBitmap( NULL );
+ }
+ nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
+
+ if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
+ {
+ const SvxBoxItem& rItem = (const SvxBoxItem&)rSet.Get( nWhich );
+ aBspWin.SetBorder( rItem );
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SvxHFPage::ActivatePage( const SfxItemSet& rSet )
+{
+ const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_LRSPACE );
+
+ if ( pItem )
+ {
+ // linken und rechten Rand einstellen
+ const SvxLRSpaceItem& rLRSpace = (const SvxLRSpaceItem&)*pItem;
+
+ aBspWin.SetLeft( rLRSpace.GetLeft() );
+ aBspWin.SetRight( rLRSpace.GetRight() );
+ }
+ else
+ {
+ aBspWin.SetLeft( 0 );
+ aBspWin.SetRight( 0 );
+ }
+
+ pItem = GetItem( rSet, SID_ATTR_ULSPACE );
+
+ if ( pItem )
+ {
+ // oberen und unteren Rand einstellen
+ const SvxULSpaceItem& rULSpace = (const SvxULSpaceItem&)*pItem;
+
+ aBspWin.SetTop( rULSpace.GetUpper() );
+ aBspWin.SetBottom( rULSpace.GetLower() );
+ }
+ else
+ {
+ aBspWin.SetTop( 0 );
+ aBspWin.SetBottom( 0 );
+ }
+
+ sal_uInt16 nUsage = SVX_PAGE_ALL;
+ pItem = GetItem( rSet, SID_ATTR_PAGE );
+
+ if ( pItem )
+ nUsage = ( (const SvxPageItem*)pItem )->GetPageUsage();
+
+ aBspWin.SetUsage( nUsage );
+
+ if ( SVX_PAGE_RIGHT == nUsage || SVX_PAGE_LEFT == nUsage )
+ aCntSharedBox.Disable();
+ else
+ aCntSharedBox.Enable();
+ pItem = GetItem( rSet, SID_ATTR_PAGE_SIZE );
+
+ if ( pItem )
+ {
+ // Orientation und Size aus dem PageItem
+ const SvxSizeItem& rSize = (const SvxSizeItem&)*pItem;
+ // die Groesse ist ggf. schon geswappt (Querformat)
+ aBspWin.SetSize( rSize.GetSize() );
+ }
+
+ // Kopfzeilen-Attribute auswerten
+ const SvxSetItem* pSetItem = 0;
+
+ if ( SFX_ITEM_SET == rSet.GetItemState( GetWhich( SID_ATTR_PAGE_HEADERSET ),
+ sal_False,
+ (const SfxPoolItem**)&pSetItem ) )
+ {
+ const SfxItemSet& rHeaderSet = pSetItem->GetItemSet();
+ const SfxBoolItem& rHeaderOn =
+ (const SfxBoolItem&)rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
+
+ if ( rHeaderOn.GetValue() )
+ {
+ const SvxSizeItem& rSize = (const SvxSizeItem&)
+ rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
+ const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)
+ rHeaderSet.Get( GetWhich(SID_ATTR_ULSPACE ) );
+ const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)
+ rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
+ long nDist = rUL.GetLower();
+
+ aBspWin.SetHdHeight( rSize.GetSize().Height() - nDist );
+ aBspWin.SetHdDist( nDist );
+ aBspWin.SetHdLeft( rLR.GetLeft() );
+ aBspWin.SetHdRight( rLR.GetRight() );
+ aBspWin.SetHeader( sal_True );
+ }
+ else
+ pSetItem = 0;
+ }
+
+ if ( !pSetItem )
+ {
+ aBspWin.SetHeader( sal_False );
+
+ if ( SID_ATTR_PAGE_HEADERSET == nId )
+ aCntSharedBox.Disable();
+ }
+ pSetItem = 0;
+
+ if ( SFX_ITEM_SET == rSet.GetItemState( GetWhich( SID_ATTR_PAGE_FOOTERSET ),
+ sal_False,
+ (const SfxPoolItem**)&pSetItem ) )
+ {
+ const SfxItemSet& rFooterSet = pSetItem->GetItemSet();
+ const SfxBoolItem& rFooterOn =
+ (const SfxBoolItem&)rFooterSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
+
+ if ( rFooterOn.GetValue() )
+ {
+ const SvxSizeItem& rSize = (const SvxSizeItem&)
+ rFooterSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
+ const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)
+ rFooterSet.Get( GetWhich( SID_ATTR_ULSPACE ) );
+ const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)
+ rFooterSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
+ long nDist = rUL.GetUpper();
+
+ aBspWin.SetFtHeight( rSize.GetSize().Height() - nDist );
+ aBspWin.SetFtDist( nDist );
+ aBspWin.SetFtLeft( rLR.GetLeft() );
+ aBspWin.SetFtRight( rLR.GetRight() );
+ aBspWin.SetFooter( sal_True );
+ }
+ else
+ pSetItem = 0;
+ }
+
+ if ( !pSetItem )
+ {
+ aBspWin.SetFooter( sal_False );
+
+ if ( SID_ATTR_PAGE_FOOTERSET == nId )
+ aCntSharedBox.Disable();
+ }
+
+ pItem = GetItem( rSet, SID_ATTR_PAGE_EXT1 );
+
+ if ( pItem && pItem->ISA(SfxBoolItem) )
+ {
+ aBspWin.SetTable( sal_True );
+ aBspWin.SetHorz( ( (SfxBoolItem*)pItem )->GetValue() );
+ }
+
+ pItem = GetItem( rSet, SID_ATTR_PAGE_EXT2 );
+
+ if ( pItem && pItem->ISA(SfxBoolItem) )
+ {
+ aBspWin.SetTable( sal_True );
+ aBspWin.SetVert( ( (SfxBoolItem*)pItem )->GetValue() );
+ }
+ ResetBackground_Impl( rSet );
+ RangeHdl( 0 );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+int SvxHFPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if ( _pSet )
+ FillItemSet( *_pSet );
+ return LEAVE_PAGE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Berech
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SvxHFPage, RangeHdl, Edit *, EMPTYARG )
+{
+ long nHHeight = aBspWin.GetHdHeight();
+ long nHDist = aBspWin.GetHdDist();
+
+ long nFHeight = aBspWin.GetFtHeight();
+ long nFDist = aBspWin.GetFtDist();
+
+ long nHeight = Max( (long)MINBODY,
+ static_cast<long>(aHeightEdit.Denormalize( aHeightEdit.GetValue( FUNIT_TWIP ) ) ) );
+ long nDist = aTurnOnBox.IsChecked() ?
+ static_cast<long>(aDistEdit.Denormalize( aDistEdit.GetValue( FUNIT_TWIP ) )) : 0;
+
+ long nMin;
+ long nMax;
+
+ if ( nId == SID_ATTR_PAGE_HEADERSET )
+ {
+ nHHeight = nHeight;
+ nHDist = nDist;
+ }
+ else
+ {
+ nFHeight = nHeight;
+ nFDist = nDist;
+ }
+
+ // Aktuelle Werte der Seitenraender
+ long nBT = aBspWin.GetTop();
+ long nBB = aBspWin.GetBottom();
+ long nBL = aBspWin.GetLeft();
+ long nBR = aBspWin.GetRight();
+
+ long nH = aBspWin.GetSize().Height();
+ long nW = aBspWin.GetSize().Width();
+
+ // Grenzen
+ if ( nId == SID_ATTR_PAGE_HEADERSET )
+ {
+ // Header
+ nMin = ( nH - nBB - nBT ) / 5; // 20%
+ nMax = Max( nH - nMin - nHDist - nFDist - nFHeight - nBB - nBT,
+ nMin );
+ aHeightEdit.SetMax( aHeightEdit.Normalize( nMax ), FUNIT_TWIP );
+ nMin = ( nH - nBB - nBT ) / 5; // 20%
+ nDist = Max( nH - nMin - nHHeight - nFDist - nFHeight - nBB - nBT,
+ long(0) );
+ aDistEdit.SetMax( aDistEdit.Normalize( nDist ), FUNIT_TWIP );
+ }
+ else
+ {
+ // Footer
+ nMin = ( nH - nBT - nBB ) / 5; // 20%
+ nMax = Max( nH - nMin - nFDist - nHDist - nHHeight - nBT - nBB,
+ nMin );
+ aHeightEdit.SetMax( aHeightEdit.Normalize( nMax ), FUNIT_TWIP );
+ nMin = ( nH - nBT - nBB ) / 5; // 20%
+ nDist = Max( nH - nMin - nFHeight - nHDist - nHHeight - nBT - nBB,
+ long(0) );
+ aDistEdit.SetMax( aDistEdit.Normalize( nDist ), FUNIT_TWIP );
+ }
+
+ // Einzuege beschraenken
+ nMax = nW - nBL - nBR -
+ static_cast<long>(aRMEdit.Denormalize( aRMEdit.GetValue( FUNIT_TWIP ) )) - MINBODY;
+ aLMEdit.SetMax( aLMEdit.Normalize( nMax ), FUNIT_TWIP );
+
+ nMax = nW - nBL - nBR -
+ static_cast<long>(aLMEdit.Denormalize( aLMEdit.GetValue( FUNIT_TWIP ) )) - MINBODY;
+ aRMEdit.SetMax( aLMEdit.Normalize( nMax ), FUNIT_TWIP );
+ return 0;
+}
+/* -----------------------------26.08.2002 12:49------------------------------
+
+ ---------------------------------------------------------------------------*/
+void lcl_Move(Window& rWin, sal_Int32 nDiff)
+{
+ Point aPos(rWin.GetPosPixel());
+ aPos.Y() -= nDiff;
+ rWin.SetPosPixel(aPos);
+}
+void SvxHFPage::EnableDynamicSpacing()
+{
+ aDynSpacingCB.Show();
+ //move all following controls
+ Window* aMoveWindows[] =
+ {
+ &aHeightFT,
+ &aHeightEdit,
+ &aHeightDynBtn,
+ &aBackgroundBtn,
+ 0
+ };
+ sal_Int32 nOffset = aTurnOnBox.GetPosPixel().Y() - aCntSharedBox.GetPosPixel().Y();
+ sal_Int32 nIdx = 0;
+ while(aMoveWindows[nIdx])
+ lcl_Move(*aMoveWindows[nIdx++], nOffset);
+}
+
diff --git a/svx/source/dialog/hdft.hrc b/svx/source/dialog/hdft.hrc
new file mode 100644
index 000000000000..e9c72c38b45f
--- /dev/null
+++ b/svx/source/dialog/hdft.hrc
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_HDFT_HRC
+#define _SVX_HDFT_HRC
+
+// defines ---------------------------------------------------------------
+
+#define CB_TURNON 10
+#define FT_DIST 11
+#define ED_DIST 12
+#define FT_HEIGHT 13
+#define ED_HEIGHT 14
+#define CB_HEIGHT_DYN 15
+#define FT_LMARGIN 16
+#define ED_LMARGIN 17
+#define FT_RMARGIN 18
+#define ED_RMARGIN 19
+#define CB_SHARED 20
+#define FL_FRAME 21
+#define CB_DYNSPACING 22
+
+#define WN_BSP 30
+
+#define BTN_EXTRAS 40
+
+
+#endif
+
diff --git a/svx/source/dialog/hdft.src b/svx/source/dialog/hdft.src
new file mode 100644
index 000000000000..1cd402611dc8
--- /dev/null
+++ b/svx/source/dialog/hdft.src
@@ -0,0 +1,383 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ---------------------------------------------------------------
+#include "helpid.hrc"
+#include <svx/dialogs.hrc>
+#include "hdft.hrc"
+ // pragma ----------------------------------------------------------------
+
+#define _TEXT_FT_LMARGIN \
+ Text [ en-US ] = "~Left margin" ; \
+
+#define _TEXT_FT_RMARGIN \
+ Text [ en-US ] = "R~ight margin" ; \
+
+
+ // RID_SVXPAGE_HEADER ----------------------------------------------------
+TabPage RID_SVXPAGE_HEADER
+{
+ HelpId = HID_FORMAT_HEADER ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Header" ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ CheckBox CB_TURNON
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_HEADER:CB_TURNON";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 152 , 10 ) ;
+ Text [ en-US ] = "Hea~der on" ;
+ };
+ CheckBox CB_SHARED
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_HEADER:CB_SHARED";
+ Pos = MAP_APPFONT ( 12 , 30 ) ;
+ Size = MAP_APPFONT ( 152 , 10 ) ;
+ Text [ en-US ] = "Same ~content left/right" ;
+ };
+ FixedText FT_LMARGIN
+ {
+ Pos = MAP_APPFONT ( 12 , 48 ) ;
+ Size = MAP_APPFONT ( 102 , 8 ) ;
+ _TEXT_FT_LMARGIN
+ Left = TRUE ;
+ };
+ MetricField ED_LMARGIN
+ {
+ HelpID = "svx:MetricField:RID_SVXPAGE_HEADER:ED_LMARGIN";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 124 , 46 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 9999 ;
+ Minimum = 0 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_RMARGIN
+ {
+ Pos = MAP_APPFONT ( 12 , 64 ) ;
+ Size = MAP_APPFONT ( 102 , 8 ) ;
+ _TEXT_FT_RMARGIN
+ Left = TRUE ;
+ };
+ MetricField ED_RMARGIN
+ {
+ HelpID = "svx:MetricField:RID_SVXPAGE_HEADER:ED_RMARGIN";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 124 , 62 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+
+ FixedText FT_DIST
+ {
+ Pos = MAP_APPFONT ( 12 , 82 ) ;
+ Size = MAP_APPFONT ( 102 , 8 ) ;
+ Text [ en-US ] = "~Spacing" ;
+ };
+ MetricField ED_DIST
+ {
+ HelpID = "svx:MetricField:RID_SVXPAGE_HEADER:ED_DIST";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 124 , 80 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ CheckBox CB_DYNSPACING
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_HEADER:CB_DYNSPACING";
+ Pos = MAP_APPFONT ( 12 , 96 ) ;
+ Size = MAP_APPFONT ( 152 , 10 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Use d~ynamic spacing" ;
+ };
+ FixedText FT_HEIGHT
+ {
+ Pos = MAP_APPFONT ( 12 , 98 ) ;
+ Size = MAP_APPFONT ( 102 , 8 ) ;
+ Text [ en-US ] = "~Height" ;
+ };
+ MetricField ED_HEIGHT
+ {
+ HelpID = "svx:MetricField:RID_SVXPAGE_HEADER:ED_HEIGHT";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 124 , 96 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 10 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 50 ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ CheckBox CB_HEIGHT_DYN
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_HEADER:CB_HEIGHT_DYN";
+ Pos = MAP_APPFONT ( 12 , 112 ) ;
+ Size = MAP_APPFONT ( 152 , 10 ) ;
+ Text [ en-US ] = "~AutoFit height" ;
+ };
+ FixedLine FL_FRAME
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 164 , 8 ) ;
+ Text [ en-US ] = "Header" ;
+ };
+ Window WN_BSP
+ {
+ Pos = MAP_APPFONT ( 176 , 6 ) ;
+ Size = MAP_APPFONT ( 75 , 46 ) ;
+ };
+ PushButton BTN_EXTRAS
+ {
+ HelpID = "svx:PushButton:RID_SVXPAGE_HEADER:BTN_EXTRAS";
+ Pos = MAP_APPFONT ( 12 , 130 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~More..." ;
+ };
+};
+ // RID_SVXPAGE_FOOTER ----------------------------------------------------
+TabPage RID_SVXPAGE_FOOTER
+{
+ HelpId = HID_FORMAT_FOOTER ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Footer" ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ CheckBox CB_TURNON
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_FOOTER:CB_TURNON";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 152 , 10 ) ;
+ Text [ en-US ] = "~Footer on" ;
+ };
+ CheckBox CB_SHARED
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_FOOTER:CB_SHARED";
+ Pos = MAP_APPFONT ( 12 , 30 ) ;
+ Size = MAP_APPFONT ( 152 , 10 ) ;
+ Text [ en-US ] = "Same ~content left/right" ;
+ };
+ FixedText FT_LMARGIN
+ {
+ Pos = MAP_APPFONT ( 12 , 48 ) ;
+ Size = MAP_APPFONT ( 102 , 8 ) ;
+ Left = TRUE ;
+ _TEXT_FT_LMARGIN
+ };
+ MetricField ED_LMARGIN
+ {
+ HelpID = "svx:MetricField:RID_SVXPAGE_FOOTER:ED_LMARGIN";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 124 , 46 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_RMARGIN
+ {
+ Pos = MAP_APPFONT ( 12 , 64 ) ;
+ Size = MAP_APPFONT ( 102 , 8 ) ;
+ _TEXT_FT_RMARGIN
+ Left = TRUE ;
+ };
+ MetricField ED_RMARGIN
+ {
+ HelpID = "svx:MetricField:RID_SVXPAGE_FOOTER:ED_RMARGIN";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 124 , 62 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_DIST
+ {
+ Pos = MAP_APPFONT ( 12 , 82 ) ;
+ Size = MAP_APPFONT ( 102 , 8 ) ;
+ Text [ en-US ] = "~Spacing" ;
+ };
+ MetricField ED_DIST
+ {
+ HelpID = "svx:MetricField:RID_SVXPAGE_FOOTER:ED_DIST";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 124 , 80 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ CheckBox CB_DYNSPACING
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_FOOTER:CB_DYNSPACING";
+ Pos = MAP_APPFONT ( 12 , 96 ) ;
+ Size = MAP_APPFONT ( 152 , 10 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Use d~ynamic spacing" ;
+ };
+ FixedText FT_HEIGHT
+ {
+ Pos = MAP_APPFONT ( 12 , 98 ) ;
+ Size = MAP_APPFONT ( 102 , 8 ) ;
+ Disable = TRUE ;
+ Text [ en-US ] = "~Height" ;
+ };
+ MetricField ED_HEIGHT
+ {
+ HelpID = "svx:MetricField:RID_SVXPAGE_FOOTER:ED_HEIGHT";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 124 , 96 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 10 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 50 ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ CheckBox CB_HEIGHT_DYN
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_FOOTER:CB_HEIGHT_DYN";
+ Pos = MAP_APPFONT ( 12 , 112 ) ;
+ Size = MAP_APPFONT ( 152 , 10 ) ;
+ Text [ en-US ] = "~AutoFit height" ;
+ };
+
+ FixedLine FL_FRAME
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 164 , 8 ) ;
+ Text [ en-US ] = "Footer" ;
+ };
+ Window WN_BSP
+ {
+ Pos = MAP_APPFONT ( 176 , 6 ) ;
+ Size = MAP_APPFONT ( 75 , 46 ) ;
+ };
+ PushButton BTN_EXTRAS
+ {
+ HelpID = "svx:PushButton:RID_SVXPAGE_FOOTER:BTN_EXTRAS";
+ Pos = MAP_APPFONT ( 12 , 130 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~More..." ;
+ };
+};
+QueryBox RID_SVXQBX_DELETE_HEADFOOT
+{
+ Buttons = WB_YES_NO ;
+ DefButton = WB_DEF_NO ;
+ Message [ en-US ] = "Removing headers or footers deletes the contents.\nDo you want to delete this text?" ;
+};
+
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/dialog/hyperdlg.cxx b/svx/source/dialog/hyperdlg.cxx
new file mode 100644
index 000000000000..3b15bc245779
--- /dev/null
+++ b/svx/source/dialog/hyperdlg.cxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <vcl/settings.hxx>
+#include <unotools/viewoptions.hxx>
+#include "svx/hyperdlg.hxx"
+#include <svx/svxdlg.hxx> //CHINA001
+#include <sfx2/app.hxx>
+#include <sfx2/sfxsids.hrc>
+
+//########################################################################
+//# #
+//# Childwindow-Wrapper-Class #
+//# #
+//########################################################################
+
+SFX_IMPL_CHILDWINDOW(SvxHlinkDlgWrapper, SID_HYPERLINK_DIALOG)
+
+// -----------------------------------------------------------------------
+
+struct MyStruct
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame;
+ SfxChildWinFactory* pFact;
+ sal_Bool bHideNotDelete;
+ sal_Bool bVisible;
+ sal_Bool bHideAtToggle;
+ SfxModule* pContextModule;
+ SfxWorkWindow* pWorkWin;
+};
+
+SvxHlinkDlgWrapper::SvxHlinkDlgWrapper( Window* _pParent, sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo ) :
+ SfxChildWindow( _pParent, nId ),
+
+ mpDlg( NULL )
+
+{
+ //CHINA001 pWindow = new SvxHpLinkDlg( _pParent, pBindings );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
+ mpDlg = pFact->CreateSvxHpLinkDlg( _pParent, pBindings, SID_HYPERLINK_DIALOG );
+ DBG_ASSERT(mpDlg, "Dialogdiet fail!");//CHINA001
+ pWindow = mpDlg->GetWindow();
+ ((MyStruct*)pImp)->bVisible = sal_False;
+
+ Window* pTopWindow = 0;
+ if ( pInfo->aSize.Width() != 0 && pInfo->aSize.Height() != 0 &&
+ (0 != (pTopWindow = SFX_APP()->GetTopWindow())))
+ {
+ Size aParentSize( pTopWindow->GetSizePixel() );
+ Size aDlgSize ( GetSizePixel () );
+
+ if( aParentSize.Width() < pInfo->aPos.X() )
+ pInfo->aPos.setX( aParentSize.Width()-aDlgSize.Width() < long(0.1*aParentSize.Width()) ?
+ long(0.1*aParentSize.Width()) : aParentSize.Width()-aDlgSize.Width() );
+ if( aParentSize.Height() < pInfo->aPos. Y() )
+ pInfo->aPos.setY( aParentSize.Height()-aDlgSize.Height() < long(0.1*aParentSize.Height()) ?
+ long(0.1*aParentSize.Height()) : aParentSize.Height()-aDlgSize.Height() );
+
+ pWindow->SetPosPixel( pInfo->aPos );
+ }
+
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+
+ SetHideNotDelete( sal_True );
+}
+
+SfxChildWinInfo SvxHlinkDlgWrapper::GetInfo() const
+{
+ return SfxChildWindow::GetInfo();
+}
+
+sal_Bool SvxHlinkDlgWrapper::QueryClose()
+{
+ return mpDlg ? mpDlg->QueryClose() : sal_True;
+}
+
diff --git a/svx/source/dialog/hyprdlg.hxx b/svx/source/dialog/hyprdlg.hxx
new file mode 100644
index 000000000000..d29a4f5969e1
--- /dev/null
+++ b/svx/source/dialog/hyprdlg.hxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_DLG_HYPERDLG_HXX
+#define _SVX_DLG_HYPERDLG_HXX
+
+#include <vcl/combobox.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/menu.hxx>
+#include <svtools/stdctrl.hxx>
+#include <sfx2/ctrlitem.hxx>
+#include <svl/srchcfg.hxx>
+#include <sfx2/tbxctrl.hxx>
+
+class SvxHyperlinkDlg;
+class SfxViewFrame;
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+class HyperCombo : public ComboBox
+{
+ SvxHyperlinkDlg *pDlg;
+ long nMaxWidth;
+ long nMinWidth;
+ long nRatio;
+
+ virtual long Notify( NotifyEvent& rNEvt );
+ virtual long PreNotify( NotifyEvent& rNEvt );
+
+public:
+ HyperCombo( SvxHyperlinkDlg* pDialog, const ResId& rResId );
+
+ inline void SetRatio( long nR ) { nRatio = nR; }
+ inline long GetRatio() { return nRatio; }
+ long CalcResizeWidth( long nW );
+ inline long GetResizeWidth() { return (nMaxWidth - nMinWidth); }
+ void DoResize( long nW );
+};
+
+class HyperFixedText : public FixedInfo
+{
+ SvxHyperlinkDlg *pDlg;
+
+public:
+ HyperFixedText( SvxHyperlinkDlg* pDialog, const ResId& rResId );
+
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Dialog zum Einfgen/Žndern eines Hyperlink
+ --------------------------------------------------------------------*/
+
+class SvxHyperlinkDlg : public ToolBox, public SfxControllerItem
+{
+ friend class HyperCombo;
+ friend class HyperFixedText;
+ using ToolBox::StateChanged;
+
+private:
+ SfxStatusForwarder aForwarder;
+ SfxStatusForwarder aHyperlinkDlgForward;
+ HyperCombo aNameCB;
+ HyperFixedText aUrlFT;
+ HyperCombo aUrlCB;
+
+ SvxSearchConfig aSearchConfig;
+
+ String sAddress;
+ String sExplorer;
+ String sOldName;
+ String sSearchTitle;
+ PopupMenu aLinkPopup;
+ PopupMenu *pTargetMenu;
+ sal_Bool bNoDoc;
+ sal_Bool bSend;
+ sal_Bool bHasOldName;
+ long nMaxWidth;
+ long nMinWidth;
+ long nMaxHeight;
+ sal_Bool bHtmlMode;
+
+ SfxImageManager* mpManager;
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ // DockingWindow
+ virtual void Resize();
+ virtual void Resizing(Size& rSize);
+
+ // Drag&Drop
+ sal_Bool GetDragData(sal_uInt16 nItem, sal_uIntPtr nDDFormatId, String& rBuffer);
+
+ DECL_LINK(TBClickHdl, ToolBox *);
+ DECL_LINK(TBSelectHdl, ToolBox *);
+ DECL_LINK(DropdownClick, ToolBox * );
+ DECL_LINK(LinkPopupSelectHdl, Menu *);
+ DECL_LINK(SearchPopupSelectHdl, Menu *);
+ DECL_LINK(ComboSelectHdl, ComboBox *);
+ DECL_LINK(ComboModifyHdl, ComboBox *);
+ DECL_LINK(BookmarkFoundHdl, String *);
+
+ void OpenDoc( const String& rURL, SfxViewFrame* pViewFrame );
+ void EnableLink();
+ void SendToApp(sal_uInt16 nType);
+ void AddToHistory(const String& rName, const String& rURL);
+ void TargetMenu(const String& rSelEntry, sal_Bool bExecute);
+ String GetSelTarget();
+
+ void SetImages();
+public:
+ SvxHyperlinkDlg(SfxBindings *pBindings, Window* pWindow);
+ ~SvxHyperlinkDlg();
+};
+
+
+#endif // _SVX_DLG_HYPERDLG_HXX
+
diff --git a/svx/source/dialog/hyprlink.cxx b/svx/source/dialog/hyprlink.cxx
new file mode 100644
index 000000000000..dc7b438db0af
--- /dev/null
+++ b/svx/source/dialog/hyprlink.cxx
@@ -0,0 +1,999 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <tools/urlobj.hxx>
+#include <vcl/msgbox.hxx>
+#include <unotools/configitem.hxx>
+#include <unotools/cmdoptions.hxx>
+#include <svtools/inetimg.hxx>
+#include <svl/urlbmk.hxx>
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/imgmgr.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svl/urihelper.hxx>
+#include <sfx2/objsh.hxx>
+#include <comphelper/processfactory.hxx>
+
+#include "svx/hlnkitem.hxx"
+#include <svx/dialogs.hrc>
+#include "hyprlink.hrc"
+#include <svx/dialmgr.hxx>
+#include "svx/hyprlink.hxx"
+#include "hyprdlg.hxx"
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+// -----------------------------------------------------------------------
+
+class SearchDefaultConfigItem_Impl : public ::utl::ConfigItem
+{
+ OUString sDefaultEngine;
+public:
+ SearchDefaultConfigItem_Impl();
+ ~SearchDefaultConfigItem_Impl();
+
+ const OUString& GetDefaultSearchEngine(){ return sDefaultEngine;}
+ virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
+ virtual void Commit();
+};
+
+/*-- 11.11.2003 14:20:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SearchDefaultConfigItem_Impl::SearchDefaultConfigItem_Impl() :
+ ConfigItem(OUString::createFromAscii("Inet/DefaultSearchEngine"))
+{
+ uno::Sequence<OUString> aNames(1);
+ aNames.getArray()[0] = OUString::createFromAscii("Name");
+ uno::Sequence< uno::Any > aValues = GetProperties(aNames);
+ aValues.getConstArray()[0] >>= sDefaultEngine;
+}
+/*-- 11.11.2003 14:21:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SearchDefaultConfigItem_Impl::~SearchDefaultConfigItem_Impl()
+{
+}
+
+void SearchDefaultConfigItem_Impl::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& )
+{
+}
+
+void SearchDefaultConfigItem_Impl::Commit()
+{
+}
+
+/*************************************************************************
+|*
+|* Dialog zum Einf"ugen/"Andern eines Hyperlink
+|*
+\************************************************************************/
+
+SvxHyperlinkDlg::SvxHyperlinkDlg( SfxBindings *_pBindings, Window* pParent) :
+
+ ToolBox ( pParent, SVX_RES( RID_SVXDLG_HYPERLINK ) ),
+ SfxControllerItem ( SID_HYPERLINK_SETLINK, *_pBindings ),
+
+ aForwarder ( SID_HYPERLINK_GETLINK, *this ),
+ aHyperlinkDlgForward( SID_HYPERLINK_DIALOG , *this),
+
+ aNameCB ( this, SVX_RES( CB_NAME ) ),
+ aUrlFT ( this, SVX_RES( FT_URL ) ),
+ aUrlCB ( this, SVX_RES( CB_URL ) ),
+ aSearchConfig (sal_True),
+ sAddress ( SVX_RES( STR_ADDRESS ) ),
+ sExplorer ( SVX_RES( STR_EXPLORER ) ),
+ sSearchTitle ( SVX_RES( STR_BOOKMARK_SEARCH ) ),
+ aLinkPopup ( SVX_RES( RID_SVXMN_HYPERLINK ) ),
+ pTargetMenu ( NULL ),
+
+ bNoDoc ( sal_True ),
+ bSend ( sal_False ),
+ bHasOldName ( sal_False ),
+ bHtmlMode ( sal_False )
+
+{
+ FreeResource();
+
+ mpManager = SfxImageManager::GetImageManager( 0 );
+ mpManager->RegisterToolBox( this );
+
+ SetImages();
+
+ // save initial size
+ nMaxWidth = GetSizePixel().Width();
+ nMaxHeight = GetSizePixel().Height();
+
+
+ InsertSeparator( 0 );
+ InsertWindow( CB_URL, &aUrlCB, 0, 0 );
+ // we need an item text for accessibility
+ String sItemText = aUrlCB.GetText();
+ if ( sItemText.Len() == 0 )
+ sItemText = aUrlCB.GetQuickHelpText();
+ if ( sItemText.Len() > 0 )
+ {
+ SetItemText( CB_URL, sItemText );
+ sItemText.Erase();
+ }
+ InsertWindow( FT_URL, &aUrlFT, 0, 0 );
+ InsertSeparator( 0 );
+ InsertWindow( CB_NAME, &aNameCB, 0, 0 );
+ sItemText = aNameCB.GetText();
+ if ( sItemText.Len() == 0 )
+ sItemText = aNameCB.GetQuickHelpText();
+ if ( sItemText.Len() > 0 )
+ SetItemText( CB_NAME, sItemText );
+
+ SetSizePixel(CalcWindowSizePixel()); // Groesse initialisieren
+
+ nMaxHeight = GetSizePixel().Height(); // Hoehe nochmal merken, da sie veraendert wurde
+ // SetSizePixel ruft Resize-Handler!
+
+ Show();
+ Resize();
+
+ long nUrlWidth = aUrlCB.GetResizeWidth();
+ long nNameWidth = aNameCB.GetResizeWidth();
+ long nSum = nUrlWidth + nNameWidth;
+
+ aUrlCB.SetRatio((nUrlWidth * 100L) / nSum);
+ aNameCB.SetRatio((nNameWidth * 100L) / nSum);
+
+ SetClickHdl( LINK( this, SvxHyperlinkDlg, TBClickHdl ) );
+ SetSelectHdl( LINK( this, SvxHyperlinkDlg, TBSelectHdl ) );
+ SetDropdownClickHdl( LINK( this, SvxHyperlinkDlg, DropdownClick ) );
+
+ SetItemBits( BTN_TARGET, GetItemBits( BTN_TARGET ) | TIB_DROPDOWNONLY );
+ SetItemBits( BTN_INET_SEARCH, GetItemBits( BTN_INET_SEARCH ) | TIB_DROPDOWN );
+ SetItemBits( BTN_INET_SEARCH, GetItemBits( BTN_TARGET ) | TIB_DROPDOWNONLY );
+
+ aLinkPopup.SetSelectHdl(LINK(this, SvxHyperlinkDlg, LinkPopupSelectHdl));
+
+ Link aLk = LINK(this, SvxHyperlinkDlg, ComboSelectHdl);
+ aNameCB.SetSelectHdl(aLk);
+ aUrlCB.SetSelectHdl(aLk);
+
+ aLk = LINK(this, SvxHyperlinkDlg, ComboModifyHdl);
+ aNameCB.SetModifyHdl(aLk);
+ aUrlCB.SetModifyHdl(aLk);
+
+ // Accessibility: Set the quick help text as accessible name for the
+ // drop down lists.
+ aNameCB.SetAccessibleName (aNameCB.GetQuickHelpText());
+ aUrlCB.SetAccessibleName (aUrlCB.GetQuickHelpText());
+
+ // Hide button according to config item.
+ SvtCommandOptions aCmdOpts;
+ if ( aCmdOpts.Lookup( SvtCommandOptions::CMDOPTION_DISABLED,
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "InternetSearch" ) ) ) )
+ HideItem( BTN_INET_SEARCH );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SvxHyperlinkDlg::~SvxHyperlinkDlg()
+{
+ SfxImageManager::GetImageManager( 0 )->ReleaseToolBox(this);
+
+ if (pTargetMenu != NULL)
+ delete pTargetMenu;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Leiste so resizen, dass die Comboboxen automatisch mit
+ verkleinert werden
+ --------------------------------------------------------------------*/
+
+void SvxHyperlinkDlg::Resize()
+{
+ long nWidth = GetSizePixel().Width();
+
+ ToolBox::Resize();
+
+ if (nWidth) // nWidth ist manchmal 0
+ {
+ long nDeltaW = nMaxWidth - nWidth + aUrlCB.LogicToPixel(Size(3, 1)).Width() + 1;
+
+ long nNewUrlWidth = aUrlCB.CalcResizeWidth(nDeltaW);
+ long nNewNameWidth = aNameCB.CalcResizeWidth(nDeltaW);
+
+ if (nNewUrlWidth && nNewNameWidth) // Flackern reduzieren
+ {
+ SetUpdateMode(sal_False);
+
+ // Comboboxen resizen
+ aUrlCB.DoResize(nNewUrlWidth);
+ aNameCB.DoResize(nNewNameWidth);
+ RecalcItems(); // Alle Elemente neu anordnen
+
+ SetUpdateMode(sal_True);
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SvxHyperlinkDlg::Resizing(Size& rSize)
+{
+ if (rSize.Height() > nMaxHeight)
+ rSize.Height() = nMaxHeight;
+
+ if (rSize.Width() > nMaxWidth)
+ rSize.Width() = nMaxWidth;
+
+ ToolBox::Resizing(rSize);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Im Dokument selektierten Hyperlink in Leiste anzeigen
+ --------------------------------------------------------------------*/
+
+void SvxHyperlinkDlg::StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState )
+{
+ if ( nSID == SID_HYPERLINK_DIALOG )
+ {
+ if( eState != SFX_ITEM_DISABLED)
+ {
+ EnableItem( BTN_OPENDIALOG, sal_True );
+
+ sal_Bool bItem = sal_False;
+ if ( pState && eState == SFX_ITEM_AVAILABLE )
+ bItem = ((SfxBoolItem*)pState)->GetValue();
+ SetItemState ( BTN_OPENDIALOG, bItem ? STATE_CHECK : STATE_NOCHECK );
+ }
+ else
+ {
+ SetItemState ( BTN_OPENDIALOG, STATE_NOCHECK );
+ EnableItem( BTN_OPENDIALOG, sal_False );
+ }
+ }
+
+ if (nSID == SID_HYPERLINK_SETLINK)
+ {
+ if (eState == SFX_ITEM_DISABLED)
+ bNoDoc = sal_True;
+ else
+ bNoDoc = sal_False;
+ EnableItem(BTN_TARGET, !bNoDoc);
+ EnableLink();
+ }
+
+ if (nSID == SID_HYPERLINK_GETLINK)
+ {
+ if (eState == SFX_ITEM_AVAILABLE)
+ {
+ const SvxHyperlinkItem& rHLnkItem = *((const SvxHyperlinkItem*)pState);
+
+ sal_uInt16 nNamePos = aNameCB.GetEntryPos(aNameCB.GetText());
+ sal_uInt16 nUrlPos = aUrlCB.GetEntryPos(aUrlCB.GetText());
+ sal_uInt16 nNotFound = COMBOBOX_ENTRY_NOTFOUND;
+
+ if (!bHasOldName &&
+ (nNamePos == nNotFound || nUrlPos == nNotFound))
+ {
+ sOldName = aNameCB.GetText();
+ bHasOldName = sal_True;
+ }
+ if (rHLnkItem.GetName().Len())
+ {
+ aNameCB.SetText(rHLnkItem.GetName());
+ ComboModifyHdl(&aNameCB);
+ }
+ if (rHLnkItem.GetURL().Len() || rHLnkItem.GetName().Len())
+ {
+ String sUrl = INetURLObject(rHLnkItem.GetURL()).GetURLNoPass();
+ aUrlCB.SetText(sUrl);
+ }
+ else if (aUrlCB.GetEntryCount())
+ { // Letzten Eintrag wieder selektieren
+ aNameCB.SetText(aNameCB.GetEntry(0));
+ aUrlCB.SetText(aUrlCB.GetEntry(0));
+ }
+
+ TargetMenu(rHLnkItem.GetTargetFrame(), sal_False);
+ bHtmlMode = (rHLnkItem.GetInsertMode() & HLINK_HTMLMODE) != 0;
+ }
+ else
+ return;
+
+ ComboModifyHdl(&aUrlCB);
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SvxHyperlinkDlg, TBClickHdl, ToolBox *, pBox )
+{
+ switch (pBox->GetCurItemId())
+ {
+ case BTN_LINK:
+ {
+ if (!bSend) // Link ins Dokument einfuegen
+ SendToApp(HLINK_DEFAULT);
+ }
+ break;
+
+ case BTN_OPENDIALOG:
+ {
+ GetBindings().GetDispatcher()->Execute( SID_HYPERLINK_DIALOG );
+ }
+ break;
+ }
+
+ return sal_True;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SvxHyperlinkDlg, TBSelectHdl, ToolBox *, pBox )
+{
+ switch (pBox->GetCurItemId())
+ {
+ // Link als Bookmark im Explorer eintragen
+ // Soll erst im Loslassen der Maus gerufen werden, daher im Select-Hdl
+ case BTN_INSERT_BOOKMARK:
+ {
+ String sName = aNameCB.GetText();
+ if ( !sName.Len() )
+ sName = aUrlCB.GetText();
+
+ String aBase = GetBindings().GetDispatcher()->GetFrame()->GetObjectShell()->GetMedium()->GetBaseURL();
+ SfxStringItem aName( SID_BOOKMARK_TITLE, sName );
+ SfxStringItem aURL( SID_BOOKMARK_URL,
+ URIHelper::SmartRel2Abs( INetURLObject(aBase), aUrlCB.GetText(), URIHelper::GetMaybeFileHdl(), true, false,
+ INetURLObject::WAS_ENCODED,
+ INetURLObject::DECODE_UNAMBIGUOUS ) );
+ GetBindings().GetDispatcher()->Execute(
+ SID_CREATELINK, SFX_CALLMODE_ASYNCHRON, &aName, &aURL, 0L );
+ }
+ break;
+ }
+
+ return sal_True;
+}
+
+IMPL_LINK( SvxHyperlinkDlg, DropdownClick, ToolBox *, pBox )
+{
+ switch (pBox->GetCurItemId())
+ {
+ case BTN_LINK:
+ {
+ // Link-Popup anstossen
+ EndSelection(); // Vor dem Execute, damit Popup den Focus bekommt
+ aLinkPopup.EnableItem(MN_BUTTON, !bHtmlMode);
+ aLinkPopup.Execute( this, GetItemRect( BTN_LINK ), FLOATWIN_POPUPMODE_DOWN );
+ }
+ break;
+
+ case BTN_INET_SEARCH:
+ {
+ // Search-Engines per Popup auswaehlen
+ PopupMenu *pMenu = new PopupMenu;
+ pMenu->SetSelectHdl(LINK(this, SvxHyperlinkDlg, SearchPopupSelectHdl));
+ SearchDefaultConfigItem_Impl aDefaultEngine;
+ String sDefault(aDefaultEngine.GetDefaultSearchEngine());
+ sDefault.ToLowerAscii();
+ const bool bHasDefault = sDefault.Len() > 0;
+
+ sal_uInt16 nCount = aSearchConfig.Count();
+ String sFound;
+ for (sal_uInt16 i = 0; i < nCount; i++)
+ {
+ const SvxSearchEngineData& rData = aSearchConfig.GetData(i);
+ //check if it's the configured default search engine
+ String sTest(rData.sEngineName);
+ sTest.ToLowerAscii();
+ bool bIsDefaultEngine = bHasDefault && STRING_NOTFOUND != sTest.Search( sDefault );
+ //then put it at the top
+ if(i && bIsDefaultEngine)
+ {
+ pMenu->InsertItem( i + 1, rData.sEngineName, 0, 0);
+ pMenu->InsertSeparator(1);
+ }
+ else
+ {
+ if (i)
+ pMenu->InsertSeparator();
+ pMenu->InsertItem( i + 1, rData.sEngineName);
+ }
+ }
+ pBox->SetItemDown(BTN_INET_SEARCH, sal_True, sal_True);
+ pMenu->Execute( this, GetItemRect( BTN_INET_SEARCH ), FLOATWIN_POPUPMODE_DOWN );
+ pBox->SetItemDown(BTN_INET_SEARCH, sal_False, sal_True);
+ EndSelection();
+ delete pMenu;
+ }
+ break;
+
+ case BTN_TARGET:
+ {
+ // Target Frame einstellen
+ TargetMenu(GetSelTarget(), sal_True);
+ EndSelection();
+ }
+ break;
+ }
+
+ return sal_True;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SvxHyperlinkDlg::TargetMenu(const String& rSelEntry, sal_Bool bExecute)
+{
+ if (pTargetMenu && !bExecute)
+ {
+ for (sal_uInt16 i = 1; i <= pTargetMenu->GetItemCount(); i++)
+ {
+ if (pTargetMenu->GetItemText(i) == rSelEntry)
+ {
+ pTargetMenu->CheckItem(i);
+ return;
+ }
+ }
+ }
+
+ SfxViewFrame* pVwFrm = SfxViewFrame::Current();
+
+ if (pVwFrm) // Alle moeglichen Target Frames zusammensammeln und anzeigen
+ {
+ TargetList aList;
+ pVwFrm->GetTopFrame().GetTargetList(aList);
+
+ sal_uInt16 nCount = (sal_uInt16)aList.Count();
+ if( nCount )
+ {
+ sal_Bool bChecked = sal_False;
+
+ if (pTargetMenu != NULL)
+ delete pTargetMenu;
+
+ pTargetMenu = new PopupMenu;
+ pTargetMenu->SetMenuFlags( pTargetMenu->GetMenuFlags() |
+ MENU_FLAG_NOAUTOMNEMONICS );
+ sal_uInt16 i;
+ for ( i = 0; i < nCount; i++ )
+ {
+ String sEntry(*aList.GetObject(i));
+ pTargetMenu->InsertItem(i + 1, sEntry, MIB_RADIOCHECK|MIB_AUTOCHECK);
+
+ if (sEntry == rSelEntry)
+ {
+ pTargetMenu->CheckItem(i + 1);
+ bChecked = sal_True;
+ }
+ }
+ for ( i = nCount; i; i-- )
+ delete aList.GetObject( i - 1 );
+
+ if (!bChecked)
+ pTargetMenu->CheckItem(1);
+
+ if (bExecute)
+ {
+ sal_uInt16 nEntry = pTargetMenu->Execute(
+ this, GetItemRect( BTN_TARGET ), FLOATWIN_POPUPMODE_DOWN );
+ if ( nEntry )
+ pTargetMenu->CheckItem( nEntry );
+ }
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SvxHyperlinkDlg, LinkPopupSelectHdl, Menu *, pMenu )
+{
+ switch (pMenu->GetCurItemId())
+ {
+ case MN_FIELD: // URL als Hyperlink ins Dok einfuegen
+ SendToApp(HLINK_FIELD);
+ break;
+ case MN_BUTTON: // URL als Button ins Dok einfuegen
+ SendToApp(HLINK_BUTTON);
+ break;
+ }
+
+ return sal_True;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SvxHyperlinkDlg, SearchPopupSelectHdl, Menu *, pMenu )
+{
+ const SvxSearchEngineData& rData = aSearchConfig.GetData(pMenu->GetCurItemId() - 1);
+ String sText(aNameCB.GetText());
+ sText.EraseLeadingChars().EraseTrailingChars();
+
+ rtl::OUString sPrefix;
+ rtl::OUString sSuffix;
+ rtl::OUString sSeparator;
+ sal_Int32 nCaseMatch;
+ sal_Unicode cToken = 0;
+
+ if (sText.Search(' ') != STRING_NOTFOUND)
+ {
+ sPrefix = rData.sExactPrefix;
+ sSuffix = rData.sExactSuffix;
+ sSeparator = rData.sExactSeparator;
+ nCaseMatch = rData.nExactCaseMatch;
+ cToken = ' ';
+ }
+ else if (sText.Search('+') != STRING_NOTFOUND)
+ {
+ sPrefix = rData.sAndPrefix;
+ sSuffix = rData.sAndSuffix;
+ sSeparator = rData.sAndSeparator;
+ nCaseMatch = rData.nAndCaseMatch;
+ cToken = '+';
+ }
+ else if (sText.Search(',') != STRING_NOTFOUND)
+ {
+ sPrefix = rData.sOrPrefix;
+ sSuffix = rData.sOrSuffix;
+ sSeparator = rData.sOrSeparator;
+ nCaseMatch = rData.nOrCaseMatch;
+ cToken = ',';
+ }
+ else
+ {
+ sPrefix = rData.sExactPrefix;
+ sSuffix = rData.sExactSuffix;
+ nCaseMatch = rData.nExactCaseMatch;
+ cToken = 0;
+ }
+
+ String sURL = sPrefix;
+ xub_StrLen nTok;
+
+ if(1 == nCaseMatch)
+ sText.ToUpperAscii();
+ else if(2 == nCaseMatch)
+ sText.ToLowerAscii();
+
+ if ((nTok = sText.GetTokenCount(cToken)) > 1)
+ {
+ for (sal_uInt16 i = 0; i < nTok; i++)
+ {
+ sURL += sText.GetToken(i, cToken);
+ if(i < nTok -1)
+ sURL += (String)sSeparator;
+ }
+ sURL += (String)sSuffix;
+ }
+ else
+ {
+ sURL += sText;
+ sURL += (String)sSuffix;
+ }
+ sURL.EraseAllChars(); // remove all spaces
+ SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+ if ( pViewFrame )
+ pViewFrame = pViewFrame->GetTopViewFrame();
+ OpenDoc( sURL, pViewFrame );
+
+ return sal_True;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SvxHyperlinkDlg, BookmarkFoundHdl, String *, pUrl )
+{
+ if (pUrl && pUrl->Len())
+ {
+ aUrlCB.SetText(*pUrl);
+ ComboModifyHdl(&aUrlCB);
+ }
+
+ return sal_True;
+}
+/*--------------------------------------------------------------------
+ Beschreibung: Link-Button enablen/disablen
+ --------------------------------------------------------------------*/
+
+void SvxHyperlinkDlg::EnableLink()
+{
+ sal_Bool bEnable = aUrlCB.GetText().Len() != 0;
+
+ EnableItem(BTN_LINK, (!bNoDoc) & bEnable);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: URL im Dokument einfuegen
+ --------------------------------------------------------------------*/
+
+void SvxHyperlinkDlg::SendToApp(sal_uInt16 nType)
+{
+ sal_Bool bIsFile = sal_False;
+ bSend = sal_True;
+ String sURL( aUrlCB.GetText() );
+
+ if ( !sURL.Len() )
+ return;
+
+ String aBase = GetBindings().GetDispatcher()->GetFrame()->GetObjectShell()->GetMedium()->GetBaseURL();
+ INetURLObject aObj( URIHelper::SmartRel2Abs( INetURLObject(aBase), sURL, URIHelper::GetMaybeFileHdl(), true, false,
+ INetURLObject::WAS_ENCODED,
+ INetURLObject::DECODE_UNAMBIGUOUS ) );
+ sURL = aObj.GetMainURL( INetURLObject::NO_DECODE );
+ if ( aObj.GetProtocol() == INET_PROT_FILE )
+ bIsFile = sal_True;
+
+ if ( bIsFile )
+ {
+ EnterWait();
+ SfxMedium aMedium( sURL, STREAM_STD_READ, sal_True );
+ if ( aMedium.Exists( sal_False ) == sal_False )
+ {
+ LeaveWait();
+ QueryBox aBox( this, SVX_RES( RID_SVXQB_DONTEXIST ) );
+ if ( aBox.Execute() == RET_NO )
+ return;
+ }
+ else
+ LeaveWait();
+ }
+
+ SvxHyperlinkItem aItem( SID_HYPERLINK_SETLINK );
+
+ if (aNameCB.GetText().Len())
+ aItem.SetName( aNameCB.GetText() );
+ else
+ aItem.SetName( sURL );
+
+ sOldName = aNameCB.GetText();
+
+ aItem.SetURL(sURL);
+ aItem.SetInsertMode( (SvxLinkInsertMode)nType );
+ aItem.SetTargetFrame( GetSelTarget() );
+
+ GetBindings().GetDispatcher()->Execute(
+ SID_HYPERLINK_SETLINK, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
+
+ AddToHistory( aNameCB.GetText(), sURL );
+
+ if ( sURL != aUrlCB.GetText() )
+ aUrlCB.SetText( sURL );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Selektierten Target Frame Eintrag im Popup ermitteln
+ --------------------------------------------------------------------*/
+
+String SvxHyperlinkDlg::GetSelTarget()
+{
+ String sTarget;
+
+ if (pTargetMenu != NULL)
+ {
+ for (sal_uInt16 i = 1; i <= pTargetMenu->GetItemCount(); i++)
+ {
+ if (pTargetMenu->IsItemChecked(i))
+ {
+ sTarget = pTargetMenu->GetItemText(i);
+ break;
+ }
+ }
+ }
+
+ return sTarget;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: URL in History der Leiste aufnehmen
+ --------------------------------------------------------------------*/
+
+void SvxHyperlinkDlg::AddToHistory(const String& rName, const String& rURL)
+{
+ String sName(rName);
+
+ if (bHasOldName && sOldName.Len())
+ {
+ sName = sOldName;
+ bHasOldName = sal_False;
+ }
+
+ if (!sName.Len())
+ sName = rURL;
+
+ if (rURL.Len())
+ {
+ sal_uInt16 nNamePos = aNameCB.GetEntryPos(sName);
+ sal_uInt16 nUrlPos = aUrlCB.GetEntryPos(rURL);
+ sal_uInt16 nPos = COMBOBOX_ENTRY_NOTFOUND;
+
+ if (nNamePos != COMBOBOX_ENTRY_NOTFOUND)
+ nPos = nNamePos;
+ else
+ nPos = nUrlPos;
+
+ // Alten Eintrag durch neuen Eintrag ersetzen
+ if (nPos != COMBOBOX_ENTRY_NOTFOUND)
+ {
+ aNameCB.RemoveEntry(nPos);
+ aUrlCB.RemoveEntry(nPos);
+ aNameCB.SetText(rName);
+ aUrlCB.SetText(rURL);
+ }
+
+ aNameCB.InsertEntry(sName, 0);
+ aUrlCB.InsertEntry(rURL, 0);
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Bookmark und Search-Button enablen/disablen
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SvxHyperlinkDlg, ComboSelectHdl, ComboBox *, pCombo )
+{
+ sal_uInt16 nPos = pCombo->GetEntryPos(pCombo->GetText());
+
+ if (nPos != COMBOBOX_ENTRY_NOTFOUND)
+ {
+ aNameCB.SetText(aNameCB.GetEntry(nPos));
+ aUrlCB.SetText(aUrlCB.GetEntry(nPos));
+
+ EnableLink();
+ EnableItem(BTN_INSERT_BOOKMARK, sal_True);
+ EnableItem(BTN_INET_SEARCH, sal_True);
+ }
+ return sal_True;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SvxHyperlinkDlg, ComboModifyHdl, ComboBox *, pCombo )
+{
+ sal_Bool bEnable = sal_True;
+
+ if (!pCombo->GetText().Len())
+ bEnable = sal_False;
+
+ if (pCombo == &aNameCB)
+ {
+ if (IsItemEnabled(BTN_INET_SEARCH) != bEnable)
+ EnableItem(BTN_INET_SEARCH, bEnable);
+ }
+
+ EnableLink();
+
+ if (aUrlCB.GetText().Len())
+ bEnable = sal_True;
+ else
+ bEnable = sal_False;
+
+ if (IsItemEnabled(BTN_INSERT_BOOKMARK) != bEnable)
+ EnableItem(BTN_INSERT_BOOKMARK, bEnable);
+
+ return sal_True;
+}
+
+// --------------------------------------------------------------------
+
+void SvxHyperlinkDlg::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ ToolBox::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE))
+ SetImages();
+}
+
+// --------------------------------------------------------------------
+
+void SvxHyperlinkDlg::SetImages()
+{
+ bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ SetItemImage( BTN_LINK, mpManager->GetImage( BTN_LINK, bHighContrast ) );
+ SetItemImage( BTN_INSERT_BOOKMARK, mpManager->GetImage( BTN_INSERT_BOOKMARK, bHighContrast ) );
+ SetItemImage( BTN_INET_SEARCH, mpManager->GetImage( BTN_INET_SEARCH, bHighContrast ) );
+ SetItemImage( BTN_TARGET, mpManager->GetImage( BTN_TARGET, bHighContrast ) );
+ SetItemImage( BTN_OPENDIALOG, mpManager->GetImage( BTN_OPENDIALOG, bHighContrast ) );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Comboboxen
+ --------------------------------------------------------------------*/
+
+HyperCombo::HyperCombo( SvxHyperlinkDlg* pDialog, const ResId& rResId ) :
+ ComboBox( (Window *)pDialog, rResId )
+{
+ pDlg = pDialog;
+
+ nMaxWidth = GetSizePixel().Width();
+ if (this == &pDlg->aUrlCB)
+ nMinWidth = GetTextWidth(String::CreateFromAscii("http://www.stardiv.dewww"));
+ else
+ nMinWidth = GetTextWidth(String::CreateFromAscii("StarDivision GmbHwww"));
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Comboboxen KeyInput
+ --------------------------------------------------------------------*/
+
+long HyperCombo::Notify( NotifyEvent& rNEvt )
+{
+ long nHandled = 0;
+ static sal_Bool bLocked = sal_False;
+
+ if (bLocked) // Keine weiteren RETURNs annehmen (nicht Reentrant!)
+ return nHandled;
+
+ bLocked = sal_True;
+
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ const KeyCode aKeyCode = pKEvt->GetKeyCode();
+
+ if (aKeyCode.GetCode() == KEY_RETURN)
+ {
+ pDlg->SendToApp(HLINK_DEFAULT);
+ nHandled = 1;
+ }
+ }
+ if (this == &pDlg->aNameCB)
+ pDlg->sOldName = GetText();
+
+ if (!nHandled)
+ nHandled = ComboBox::Notify( rNEvt );
+
+ bLocked = sal_False;
+
+ return nHandled;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Drag&Drop vor dem Combo-Edit abfangen und weiterleiten
+ --------------------------------------------------------------------*/
+
+long HyperCombo::PreNotify( NotifyEvent& rNEvt )
+{
+ long nHandled = 0;
+
+ nHandled = ComboBox::PreNotify( rNEvt );
+
+ return nHandled;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+long HyperCombo::CalcResizeWidth( long nW )
+{
+ long nNewWidth = Max(nMaxWidth - nW * GetRatio() / 100L, nMinWidth);
+
+ if (nNewWidth > nMaxWidth)
+ nNewWidth = nMaxWidth;
+
+ if (nNewWidth != GetSizePixel().Width())
+ return nNewWidth;
+ else
+ return 0; // Kein Resize notwendig
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void HyperCombo::DoResize( long nNewWidth )
+{
+ SetSizePixel(Size(nNewWidth, GetSizePixel().Height()));
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: FixedText
+ --------------------------------------------------------------------*/
+
+HyperFixedText::HyperFixedText( SvxHyperlinkDlg* pDialog, const ResId& rResId ) :
+ FixedInfo( (Window *)pDialog, rResId )
+{
+ pDlg = pDialog;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Webseite der Search-Engine mit Suchergebnissen anzeigen
+ --------------------------------------------------------------------*/
+void SvxHyperlinkDlg::OpenDoc( const String& rURL, SfxViewFrame* pViewFrame )
+{
+ SfxStringItem aName( SID_FILE_NAME, rURL );
+ SfxStringItem aReferer( SID_REFERER, String::CreateFromAscii("private:user") );
+ SfxBoolItem aNewView( SID_OPEN_NEW_VIEW, sal_True );
+ SfxBoolItem aSilent( SID_SILENT, sal_True );
+ SfxBoolItem aReadOnly( SID_DOC_READONLY, sal_True );
+ SfxBoolItem aExternal( SID_BROWSE, sal_True );
+ SfxDispatcher* pDisp = SfxViewFrame::Current() ? SfxViewFrame::Current()->GetDispatcher() : NULL;
+
+ if ( pViewFrame )
+ {
+ SfxFrameItem aView( SID_DOCFRAME, pViewFrame ? &pViewFrame->GetFrame() : NULL );
+ if ( pDisp )
+ pDisp->Execute( SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aName, &aView, &aNewView, &aSilent, &aReadOnly, &aReferer, &aExternal, 0L );
+ }
+ else if ( pDisp )
+ pDisp->Execute( SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aName, &aNewView, &aSilent, &aReadOnly, &aReferer, 0L );
+}
+// class SvxHyperlinkDialogWrapper ------------------------------------------
+
+SFX_IMPL_CHILDWINDOW(SvxHyperlinkDlgWrapper, SID_HYPERLINK_INSERT)
+
+/*--------------------------------------------------------------------
+ Beschreibung: Wrapper fuer Hyperlinkleiste
+ --------------------------------------------------------------------*/
+
+SvxHyperlinkDlgWrapper::SvxHyperlinkDlgWrapper( Window* _pParent, sal_uInt16 nId,
+ SfxBindings* _pBindings, SfxChildWinInfo* /*pInfo*/ ) :
+
+ SfxChildWindow( _pParent, nId )
+
+{
+ pWindow = new SvxHyperlinkDlg( _pBindings, _pParent );
+ eChildAlignment = SFX_ALIGN_TOP;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxChildWinInfo SvxHyperlinkDlgWrapper::GetInfo() const
+{
+ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo();
+ return aInfo;
+}
+
diff --git a/svx/source/dialog/hyprlink.hrc b/svx/source/dialog/hyprlink.hrc
new file mode 100644
index 000000000000..add71ece3bcc
--- /dev/null
+++ b/svx/source/dialog/hyprlink.hrc
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_HYPERLINK_HRC
+#define _SVX_HYPERLINK_HRC
+
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+
+#ifndef _SFXSIDS_HRC
+#include <sfx2/sfxsids.hrc>
+#endif
+
+// defines ------------------------------------------------------------------
+
+#define CB_NAME 1
+#define FT_URL 2
+#define CB_URL 3
+#define BTN_LINK SID_HLINKBAR_LINK
+#define BTN_INSERT_BOOKMARK SID_HLINKBAR_BOOKMARK
+#define BTN_INET_SEARCH SID_HLINKBAR_SEARCH
+#define TB 7
+#define MN_FIELD 8
+#define MN_BUTTON 9
+#define BTN_TARGET SID_HLINKBAR_TARGET
+#define STR_ADDRESS 11
+#define STR_EXPLORER 12
+#define STR_BOOKMARK_SEARCH 13
+
+#define BTN_OPENDIALOG SID_HYPERLINK_DIALOG
+
+
+#endif
+
diff --git a/svx/source/dialog/hyprlink.src b/svx/source/dialog/hyprlink.src
new file mode 100644
index 000000000000..c59a2f8eb52a
--- /dev/null
+++ b/svx/source/dialog/hyprlink.src
@@ -0,0 +1,167 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ------------------------------------------------------------------
+#include <svx/dialogs.hrc>
+#include "hyprlink.hrc"
+#include "helpid.hrc"
+#include <svx/svxids.hrc>
+
+ // pragma -------------------------------------------------------------------
+
+ // RID_SVXDLG_HYPERLINK ------------------------------------------------------
+ToolBox RID_SVXDLG_HYPERLINK
+{
+ OutputSize = TRUE ;
+ Hide = TRUE;
+
+ // Dockable = TRUE ;
+ // Closeable = TRUE ;
+ // Moveable = TRUE ;
+ // Sizeable = TRUE ;
+ // EnableResizing = TRUE ;
+
+ SVLook = TRUE ;
+ Border = TRUE ;
+ Size = MAP_APPFONT ( 410 , 17 ) ;
+ Scroll = TRUE ;
+ HelpID = HID_OFA_HYPERLINK_DLG ;
+
+ Text [ en-US ] = "Insert Hyperlink" ;
+
+ ComboBox CB_NAME
+ {
+ HelpID = HID_OFA_HYPERLINK_NAME ;
+ Pos = MAP_APPFONT ( 2 , 3 ) ;
+ Size = MAP_APPFONT ( 100 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ AutoSize = TRUE ;
+ AutoHScroll = TRUE ;
+ DDExtraWidth = TRUE ;
+ QuickHelpText [ en-US ] = "URL Name" ;
+ };
+ FixedText FT_URL
+ {
+ HelpID = HID_OFA_HYPERLINK_URL_TXT ;
+ Pos = MAP_APPFONT ( 105 , 5 ) ;
+ Size = MAP_APPFONT ( 16 , 10 ) ;
+ Text [ en-US ] = "URL:" ;
+ };
+ ComboBox CB_URL
+ {
+ HelpID = HID_OFA_HYPERLINK_URL ;
+ Pos = MAP_APPFONT ( 121 , 3 ) ;
+ Size = MAP_APPFONT ( 204 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ AutoSize = TRUE ;
+ AutoHScroll = TRUE ;
+ DDExtraWidth = TRUE ;
+ QuickHelpText [ en-US ] = "Internet URLs" ;
+ };
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ HelpID = HID_OFA_HYPERLINK_TARGET ;
+ Identifier = BTN_TARGET ;
+ DropDown = TRUE ;
+ Text [ en-US ] = "Target Frame" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ HelpID = CMD_SID_HYPERLINK_SETLINK ;
+ Identifier = BTN_LINK ;
+ Disable = TRUE ;
+ DropDown = TRUE ;
+ Text [ en-US ] = "Hyperlink" ;
+ };
+ ToolBoxItem
+ {
+ HelpID = CMD_SID_CREATELINK ;
+ Identifier = BTN_INSERT_BOOKMARK ;
+ Disable = TRUE ;
+ Hide = TRUE;
+ Text [ en-US ] = "Link" ;
+ };
+ ToolBoxItem
+ {
+ HelpID = HID_OFA_HYPERLINK_SEARCH ;
+ Identifier = BTN_INET_SEARCH ;
+ Disable = TRUE ;
+ DropDown = TRUE ;
+ Text [ en-US ] = "Find" ;
+ };
+ };
+ String STR_ADDRESS
+ {
+ Text [ en-US ] = "Address Book" ;
+ };
+ String STR_EXPLORER
+ {
+ Text [ en-US ] = "Bookmark folder" ;
+ };
+ String STR_BOOKMARK_SEARCH
+ {
+ Text [ en-US ] = "Search in bookmarks";
+ };
+};
+ // PopupMenu -------------------------------------------------------------
+Menu RID_SVXMN_HYPERLINK
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = MN_FIELD ;
+ Text [ en-US ] = "As Text" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_BUTTON ;
+ Text [ en-US ] = "As Button" ;
+ };
+ };
+};
+QueryBox RID_SVXQB_DONTEXIST
+{
+ BUTTONS = WB_YES_NO ;
+ DEFBUTTON = WB_DEF_YES ;
+ Message [ en-US ] = "This URL does not exist.\nInsert anyway?" ;
+};
+
+
+
+
+
+
+
+
diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx
new file mode 100644
index 000000000000..9cd43f0f5195
--- /dev/null
+++ b/svx/source/dialog/imapdlg.cxx
@@ -0,0 +1,1055 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#define _SDR_NOITEMS
+#define _SDR_NOTOUCH
+#define _SDR_NOTRANSFORM
+#define _SDR_NOOBJECTS
+#define _SDR_NOVIEWMARKER
+#define _SDR_NODRAGMETHODS
+#define _SDR_NOUNDO
+#define _SDR_NOXOUTDEV
+
+#include <stdlib.h>
+#include <tools/shl.hxx>
+#ifndef _EINF_HXX
+#include <tools/errinf.hxx>
+#endif
+#include <tools/urlobj.hxx>
+#ifndef _UNOTOOLS_UCBSTREAMHELPER_HXX
+#include <unotools/ucbstreamhelper.hxx>
+#endif
+#include <vcl/msgbox.hxx>
+#include <vcl/group.hxx>
+#include <vcl/lstbox.hxx>
+#include <svl/eitem.hxx>
+#include <unotools/pathoptions.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/module.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+#include <svl/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>
+#include <unotools/localedatawrapper.hxx>
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX
+#include <comphelper/processfactory.hxx>
+#endif
+
+#define _IMAPDLG_PRIVATE
+#include "svx/imapdlg.hxx"
+
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/svxids.hrc>
+#include "imapdlg.hrc"
+#include "imapwnd.hxx"
+#include "imapimp.hxx"
+#include "svx/dlgutil.hxx"
+#include <svx/svdtrans.hxx>
+#include <svx/svdopath.hxx>
+#include <vcl/svapp.hxx>
+
+#define SELF_TARGET "_self"
+#define IMAP_ALL_FILTER "<Alle>"
+#define IMAP_CERN_FILTER "MAP - CERN"
+#define IMAP_NCSA_FILTER "MAP - NCSA"
+#define IMAP_BINARY_FILTER "SIP - StarView ImageMap"
+#define IMAP_ALL_TYPE "*.*"
+#define IMAP_BINARY_TYPE "*.sip"
+#define IMAP_CERN_TYPE "*.map"
+#define IMAP_NCSA_TYPE "*.map"
+#define IMAP_BINARY_EXT "sip"
+#define IMAP_CERN_EXT "map"
+#define IMAP_NCSA_EXT "map"
+
+/******************************************************************************/
+
+SFX_IMPL_MODELESSDIALOG( SvxIMapDlgChildWindow, SID_IMAP );
+
+/******************************************************************************/
+
+inline String GetUnitString( long nVal_100, FieldUnit eFieldUnit, sal_Unicode cSep )
+{
+ String aVal = UniString::CreateFromInt64( MetricField::ConvertValue( nVal_100, 2, MAP_100TH_MM, eFieldUnit ) );
+
+ while( aVal.Len() < 3 )
+ aVal.Insert( sal_Unicode('0'), 0 );
+
+ aVal.Insert( cSep, aVal.Len() - 2 );
+ aVal += sal_Unicode(' ');
+ aVal += SdrFormatter::GetUnitStr( eFieldUnit );
+
+ return aVal;
+}
+
+/*************************************************************************
+|*
+|* ControllerItem
+|*
+\************************************************************************/
+
+SvxIMapDlgItem::SvxIMapDlgItem( sal_uInt16 _nId, SvxIMapDlg& rIMapDlg, SfxBindings& rBindings ) :
+ SfxControllerItem ( _nId, rBindings ),
+ rIMap ( rIMapDlg )
+{
+}
+
+/*************************************************************************
+|*
+|* StateChanged-Methode
+|*
+\************************************************************************/
+
+void SvxIMapDlgItem::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/,
+ const SfxPoolItem* pItem )
+{
+ if ( ( nSID == SID_IMAP_EXEC ) && pItem )
+ {
+ const SfxBoolItem* pStateItem = PTR_CAST( SfxBoolItem, pItem );
+
+ DBG_ASSERT( pStateItem || pItem == 0, "SfxBoolItem erwartet");
+
+ // Float ggf. disablen
+ rIMap.SetExecState( !pStateItem->GetValue() );
+ }
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+SvxIMapDlgChildWindow::SvxIMapDlgChildWindow( Window* _pParent, sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo ) :
+ SfxChildWindow( _pParent, nId )
+{
+ pWindow = new SvxIMapDlg( pBindings, this, _pParent, SVX_RES( RID_SVXDLG_IMAP ) );
+ SvxIMapDlg* pDlg = (SvxIMapDlg*) pWindow;
+
+ if ( pInfo->nFlags & SFX_CHILDWIN_ZOOMIN )
+ pDlg->RollUp();
+
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+
+ pDlg->Initialize( pInfo );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxIMapDlgChildWindow::UpdateIMapDlg( const Graphic& rGraphic, const ImageMap* pImageMap,
+ const TargetList* pTargetList, void* pEditingObj )
+{
+ if ( SfxViewFrame::Current() &&
+ SfxViewFrame::Current()->HasChildWindow( SvxIMapDlgChildWindow::GetChildWindowId() ) )
+ SVXIMAPDLG()->Update( rGraphic, pImageMap, pTargetList, pEditingObj );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+SvxIMapDlg::SvxIMapDlg( SfxBindings *_pBindings, SfxChildWindow *pCW,
+ Window* _pParent, const ResId& rResId ) :
+ SfxModelessDialog ( _pBindings, pCW, _pParent, rResId ),
+
+ aTbxIMapDlg1 ( this, SVX_RES( TBX_IMAPDLG1 ) ),
+ aFtURL ( this, SVX_RES( FT_URL ) ),
+ maURLBox ( this, SVX_RES( CBB_URL ) ),
+ aFtText ( this, SVX_RES( FT_TEXT ) ),
+ aEdtText ( this, SVX_RES( EDT_TEXT ) ),
+ maFtTarget ( this, SVX_RES( RID_SVXCTL_FT_TARGET ) ),
+ maCbbTarget ( this, SVX_RES( RID_SVXCTL_CBB_TARGET ) ),
+ aStbStatus ( this, WB_BORDER | WB_3DLOOK | WB_LEFT ),
+ maImageList ( SVX_RES( IL_IMAPDLG ) ),
+ maImageListH ( SVX_RES( ILH_IMAPDLG ) ),
+ pCheckObj ( NULL ),
+ aIMapItem ( SID_IMAP_EXEC, *this, *_pBindings )
+{
+ pIMapWnd = new IMapWindow( this, SVX_RES( RID_SVXCTL_IMAP ), _pBindings->GetActiveFrame() );
+
+ ApplyImageList();
+
+ FreeResource();
+
+ pOwnData = new IMapOwnData( this );
+
+ pIMapWnd->SetInfoLink( LINK( this, SvxIMapDlg, InfoHdl ) );
+ pIMapWnd->SetMousePosLink( LINK( this, SvxIMapDlg, MousePosHdl ) );
+ pIMapWnd->SetGraphSizeLink( LINK( this, SvxIMapDlg, GraphSizeHdl ) );
+ pIMapWnd->SetUpdateLink( LINK( this, SvxIMapDlg, StateHdl ) );
+
+ maURLBox.SetModifyHdl( LINK( this, SvxIMapDlg, URLModifyHdl ) );
+ maURLBox.SetSelectHdl( LINK( this, SvxIMapDlg, URLModifyHdl ) );
+ maURLBox.SetLoseFocusHdl( LINK( this, SvxIMapDlg, URLLoseFocusHdl ) );
+ aEdtText.SetModifyHdl( LINK( this, SvxIMapDlg, URLModifyHdl ) );
+ maCbbTarget.SetLoseFocusHdl( LINK( this, SvxIMapDlg, URLLoseFocusHdl ) );
+
+ SvtMiscOptions aMiscOptions;
+ aMiscOptions.AddListenerLink( LINK( this, SvxIMapDlg, MiscHdl ) );
+
+ aTbxIMapDlg1.SetOutStyle( aMiscOptions.GetToolboxStyle() );
+ aTbxIMapDlg1.SetSizePixel( aTbxIMapDlg1.CalcWindowSizePixel() );
+ aTbxIMapDlg1.SetSelectHdl( LINK( this, SvxIMapDlg, TbxClickHdl ) );
+ aTbxIMapDlg1.CheckItem( TBI_SELECT, sal_True );
+ TbxClickHdl( &aTbxIMapDlg1 );
+
+ SetMinOutputSizePixel( aLastSize = GetOutputSizePixel() );
+
+ aStbStatus.InsertItem( 1, 130, SIB_LEFT | SIB_IN | SIB_AUTOSIZE );
+ aStbStatus.InsertItem( 2, 10 + GetTextWidth( DEFINE_CONST_UNICODE( " 9999,99 cm / 9999,99 cm ") ), SIB_CENTER | SIB_IN );
+ aStbStatus.InsertItem( 3, 10 + GetTextWidth( DEFINE_CONST_UNICODE( " 9999,99 cm x 9999,99 cm ") ), SIB_CENTER | SIB_IN );
+
+ aFtURL.Disable();
+ maURLBox.Disable();
+ aFtText.Disable();
+ aEdtText.Disable();
+ maFtTarget.Disable();
+ maCbbTarget.Disable();
+ pOwnData->bExecState = sal_False;
+
+ Resize();
+
+ pOwnData->aTimer.SetTimeout( 100 );
+ pOwnData->aTimer.SetTimeoutHdl( LINK( this, SvxIMapDlg, UpdateHdl ) );
+
+ aTbxIMapDlg1.EnableItem( TBI_ACTIVE, sal_False );
+ aTbxIMapDlg1.EnableItem( TBI_MACRO, sal_False );
+ aTbxIMapDlg1.EnableItem( TBI_PROPERTY, sal_False );
+}
+
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+SvxIMapDlg::~SvxIMapDlg()
+{
+ // URL-Liste loeschen
+ delete pIMapWnd;
+ delete pOwnData;
+}
+
+
+/*************************************************************************
+|*
+|* Resize-Methode
+|*
+\************************************************************************/
+
+void SvxIMapDlg::Resize()
+{
+ SfxModelessDialog::Resize();
+
+ Size aMinSize( GetMinOutputSizePixel() );
+ Size aNewSize( GetOutputSizePixel() );
+
+ if ( aNewSize.Height() >= aMinSize.Height() )
+ {
+ Size _aSize( aStbStatus.GetSizePixel() );
+ Point aPoint( 0, aNewSize.Height() - _aSize.Height() );
+
+ // StatusBar positionieren
+ aStbStatus.SetPosSizePixel( aPoint, Size( aNewSize.Width(), _aSize.Height() ) );
+ aStbStatus.Show();
+
+ // EditWindow positionieren
+ _aSize.Width() = aNewSize.Width() - 18;
+ _aSize.Height() = aPoint.Y() - pIMapWnd->GetPosPixel().Y() - 6;
+ pIMapWnd->SetSizePixel( _aSize );
+
+ aLastSize = aNewSize;
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Close-Methode
+|*
+\************************************************************************/
+
+sal_Bool SvxIMapDlg::Close()
+{
+ sal_Bool bRet = sal_True;
+
+ if ( aTbxIMapDlg1.IsItemEnabled( TBI_APPLY ) )
+ {
+ QueryBox aQBox( this, WB_YES_NO_CANCEL | WB_DEF_YES,
+ String( SVX_RES( STR_IMAPDLG_MODIFY ) ) );
+ const long nRet = aQBox.Execute();
+
+ if( nRet == RET_YES )
+ {
+ SfxBoolItem aBoolItem( SID_IMAP_EXEC, sal_True );
+ GetBindings().GetDispatcher()->Execute(
+ SID_IMAP_EXEC, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD, &aBoolItem, 0L );
+ }
+ else if( nRet == RET_CANCEL )
+ bRet = sal_False;
+ }
+ else if( pIMapWnd->IsChanged() )
+ {
+ QueryBox aQBox( this, WB_YES_NO_CANCEL | WB_DEF_YES,
+ String( SVX_RES( STR_IMAPDLG_SAVE ) ) );
+ const long nRet = aQBox.Execute();
+
+ if( nRet == RET_YES )
+ bRet = DoSave();
+ else if( nRet == RET_CANCEL )
+ bRet = sal_False;
+ }
+
+ return( bRet ? SfxModelessDialog::Close() : sal_False );
+}
+
+
+/*************************************************************************
+|*
+|* Enabled oder disabled alle Controls
+|*
+\************************************************************************/
+
+void SvxIMapDlg::SetExecState( sal_Bool bEnable )
+{
+ pOwnData->bExecState = bEnable;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxIMapDlg::SetGraphic( const Graphic& rGraphic )
+{
+ pIMapWnd->SetGraphic( rGraphic );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxIMapDlg::SetImageMap( const ImageMap& rImageMap )
+{
+ pIMapWnd->SetImageMap( rImageMap );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+const ImageMap& SvxIMapDlg::GetImageMap() const
+{
+ return pIMapWnd->GetImageMap();
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxIMapDlg::SetTargetList( const TargetList& rTargetList )
+{
+ TargetList aNewList( rTargetList );
+
+ pIMapWnd->SetTargetList( aNewList );
+
+ maCbbTarget.Clear();
+
+ for( String* pStr = aNewList.First(); pStr; pStr = aNewList.Next() )
+ maCbbTarget.InsertEntry( *pStr );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+const TargetList& SvxIMapDlg::GetTargetList() const
+{
+ return pIMapWnd->GetTargetList();
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxIMapDlg::Update( const Graphic& rGraphic, const ImageMap* pImageMap,
+ const TargetList* pTargetList, void* pEditingObj )
+{
+ pOwnData->aUpdateGraphic = rGraphic;
+
+ if ( pImageMap )
+ pOwnData->aUpdateImageMap = *pImageMap;
+ else
+ pOwnData->aUpdateImageMap.ClearImageMap();
+
+ pOwnData->pUpdateEditingObject = pEditingObj;
+
+ // UpdateTargetList loeschen, da diese Methode
+ // vor dem Zuschlagen des Update-Timers noch
+ // mehrmals gerufen werden kann( #46540 )
+ for( String* pStr = pOwnData->aUpdateTargetList.First(); pStr; pStr = pOwnData->aUpdateTargetList.Next() )
+ delete pStr;
+ pOwnData->aUpdateTargetList.Clear();
+
+ // TargetListe muss kopiert werden, da sie im
+ // Besitz des Aufrufers ist und von ihm nach diesem
+ // Aufruf sofort geloescht werden kann;
+ // die kopierte Liste wird im Handler wieder geloescht
+ if( pTargetList )
+ {
+ TargetList aTargetList( *pTargetList );
+
+ for( String* pStr = aTargetList.First(); pStr; pStr = aTargetList.Next() )
+ pOwnData->aUpdateTargetList.Insert( new String( *pStr ) );
+ }
+
+ pOwnData->aTimer.Start();
+}
+
+
+void SvxIMapDlg::KeyInput( const KeyEvent& rKEvt )
+{
+ SfxModelessDialog::KeyInput( rKEvt );
+}
+
+/*************************************************************************
+|*
+|* Click-Hdl fuer ToolBox
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxIMapDlg, TbxClickHdl, ToolBox*, pTbx )
+{
+ sal_uInt16 nNewItemId = pTbx->GetCurItemId();
+
+ switch( pTbx->GetCurItemId() )
+ {
+ case( TBI_APPLY ):
+ {
+ URLLoseFocusHdl( NULL );
+ SfxBoolItem aBoolItem( SID_IMAP_EXEC, sal_True );
+ GetBindings().GetDispatcher()->Execute(
+ SID_IMAP_EXEC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aBoolItem, 0L );
+ }
+ break;
+
+ case( TBI_OPEN ):
+ DoOpen();
+ break;
+
+ case( TBI_SAVEAS ):
+ DoSave();
+ break;
+
+ case( TBI_SELECT ):
+ {
+ pTbx->CheckItem( nNewItemId, sal_True );
+ pIMapWnd->SetEditMode( sal_True );
+ if( pTbx->IsKeyEvent() )
+ {
+ if((pTbx->GetKeyModifier() & KEY_MOD1) != 0)
+ pIMapWnd->SelectFirstObject();
+ else
+ pIMapWnd->GrabFocus();
+ }
+ }
+ break;
+
+ case( TBI_RECT ):
+ {
+ pTbx->CheckItem( nNewItemId, sal_True );
+ pIMapWnd->SetObjKind( OBJ_RECT );
+ if( pTbx->IsKeyEvent() && ((pTbx->GetKeyModifier() & KEY_MOD1) != 0) )
+ {
+ pIMapWnd->CreateDefaultObject();
+ pIMapWnd->GrabFocus();
+ }
+ }
+ break;
+
+ case( TBI_CIRCLE ):
+ {
+ pTbx->CheckItem( nNewItemId, sal_True );
+ pIMapWnd->SetObjKind( OBJ_CIRC );
+ if( pTbx->IsKeyEvent() && ((pTbx->GetKeyModifier() & KEY_MOD1) != 0) )
+ {
+ pIMapWnd->CreateDefaultObject();
+ pIMapWnd->GrabFocus();
+ }
+ }
+ break;
+
+ case( TBI_POLY ):
+ {
+ pTbx->CheckItem( nNewItemId, sal_True );
+ pIMapWnd->SetObjKind( OBJ_POLY );
+ if( pTbx->IsKeyEvent() && ((pTbx->GetKeyModifier() & KEY_MOD1) != 0) )
+ {
+ pIMapWnd->CreateDefaultObject();
+ pIMapWnd->GrabFocus();
+ }
+ }
+ break;
+
+ case( TBI_FREEPOLY ):
+ {
+ pTbx->CheckItem( nNewItemId, sal_True );
+ pIMapWnd->SetObjKind( OBJ_FREEFILL );
+ if( pTbx->IsKeyEvent() && ((pTbx->GetKeyModifier() & KEY_MOD1) != 0) )
+ {
+ pIMapWnd->CreateDefaultObject();
+ pIMapWnd->GrabFocus();
+ }
+ }
+ break;
+
+ case( TBI_ACTIVE ):
+ {
+ URLLoseFocusHdl( NULL );
+ sal_Bool bNewState = !pTbx->IsItemChecked( TBI_ACTIVE );
+ pTbx->CheckItem( TBI_ACTIVE, bNewState );
+ pIMapWnd->SetCurrentObjState( !bNewState );
+ }
+ break;
+
+ case( TBI_MACRO ):
+ pIMapWnd->DoMacroAssign();
+ break;
+
+ case( TBI_PROPERTY ):
+ pIMapWnd->DoPropertyDialog();
+ break;
+
+ case( TBI_POLYEDIT ):
+ pIMapWnd->SetPolyEditMode( pTbx->IsItemChecked( TBI_POLYEDIT ) ? SID_BEZIER_MOVE : 0 );
+ if( pTbx->IsKeyEvent() && pTbx->IsItemChecked( TBI_POLYEDIT ) )
+ pIMapWnd->StartPolyEdit();
+ break;
+
+ case( TBI_POLYMOVE ):
+ pIMapWnd->SetPolyEditMode( SID_BEZIER_MOVE );
+ break;
+
+ case( TBI_POLYINSERT ):
+ pIMapWnd->SetPolyEditMode( SID_BEZIER_INSERT );
+ break;
+
+ case( TBI_POLYDELETE ):
+ pIMapWnd->GetSdrView()->DeleteMarkedPoints();
+ break;
+
+ case( TBI_UNDO ):
+ {
+ URLLoseFocusHdl( NULL );
+ pIMapWnd->GetSdrModel()->Undo();
+ }
+ break;
+
+ case( TBI_REDO ):
+ {
+ URLLoseFocusHdl( NULL );
+ pIMapWnd->GetSdrModel()->Redo();
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxIMapDlg::DoOpen()
+{
+ ::sfx2::FileDialogHelper aDlg(
+ com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 );
+
+ ImageMap aLoadIMap;
+ const String aFilter( DEFINE_CONST_UNICODE( IMAP_ALL_FILTER ) );
+
+ aDlg.AddFilter( aFilter, DEFINE_CONST_UNICODE( IMAP_ALL_TYPE ) );
+ aDlg.AddFilter( DEFINE_CONST_UNICODE( IMAP_CERN_FILTER ), DEFINE_CONST_UNICODE( IMAP_CERN_TYPE ) );
+ aDlg.AddFilter( DEFINE_CONST_UNICODE( IMAP_NCSA_FILTER ), DEFINE_CONST_UNICODE( IMAP_NCSA_TYPE ) );
+ aDlg.AddFilter( DEFINE_CONST_UNICODE( IMAP_BINARY_FILTER ), DEFINE_CONST_UNICODE( IMAP_BINARY_TYPE ) );
+
+ aDlg.SetCurrentFilter( aFilter );
+ aDlg.SetDisplayDirectory( SvtPathOptions().GetWorkPath() );
+
+ if( aDlg.Execute() == ERRCODE_NONE )
+ {
+ INetURLObject aURL( aDlg.GetPath() );
+ DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+ SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ );
+
+ if( pIStm )
+ {
+ 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 );
+
+ delete pIStm;
+ }
+
+ pIMapWnd->Invalidate();
+ }
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+sal_Bool SvxIMapDlg::DoSave()
+{
+ ::sfx2::FileDialogHelper aDlg(
+ com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 );
+
+ const String aBinFilter( DEFINE_CONST_UNICODE( IMAP_BINARY_FILTER ) );
+ const String aCERNFilter( DEFINE_CONST_UNICODE( IMAP_CERN_FILTER ) );
+ const String aNCSAFilter( DEFINE_CONST_UNICODE( IMAP_NCSA_FILTER ) );
+ SdrModel* pModel = pIMapWnd->GetSdrModel();
+ const sal_Bool bChanged = pModel->IsChanged();
+ sal_Bool bRet = false;
+
+ aDlg.AddFilter( aCERNFilter, DEFINE_CONST_UNICODE( IMAP_CERN_TYPE ) );
+ aDlg.AddFilter( aNCSAFilter, DEFINE_CONST_UNICODE( IMAP_NCSA_TYPE ) );
+ aDlg.AddFilter( aBinFilter, DEFINE_CONST_UNICODE( IMAP_BINARY_TYPE ) );
+
+ aDlg.SetCurrentFilter( aCERNFilter );
+ aDlg.SetDisplayDirectory( SvtPathOptions().GetWorkPath() );
+
+ if( aDlg.Execute() == ERRCODE_NONE )
+ {
+ const String aFilter( aDlg.GetCurrentFilter() );
+ String aExt;
+ sal_uIntPtr nFormat;
+
+ if ( aFilter == aBinFilter )
+ {
+ nFormat = IMAP_FORMAT_BIN;
+ aExt = DEFINE_CONST_UNICODE( IMAP_BINARY_EXT );
+ }
+ else if ( aFilter == aCERNFilter )
+ {
+ nFormat = IMAP_FORMAT_CERN;
+ aExt = DEFINE_CONST_UNICODE( IMAP_CERN_EXT );
+ }
+ else if ( aFilter == aNCSAFilter )
+ {
+ nFormat = IMAP_FORMAT_NCSA;
+ aExt = DEFINE_CONST_UNICODE( IMAP_NCSA_EXT );
+ }
+ else
+ {
+ return sal_False;
+ }
+
+ INetURLObject aURL( aDlg.GetPath() );
+
+ if( aURL.GetProtocol() == INET_PROT_NOT_VALID )
+ {
+ DBG_ERROR( "invalid URL" );
+ }
+ else
+ {
+ if( !aURL.getExtension().getLength() )
+ aURL.setExtension( aExt );
+
+ SvStream* pOStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE | STREAM_TRUNC );
+ if( pOStm )
+ {
+ pIMapWnd->GetImageMap().Write( *pOStm, nFormat, String() );
+
+ if( pOStm->GetError() )
+ ErrorHandler::HandleError( ERRCODE_IO_GENERAL );
+
+ delete pOStm;
+ pModel->SetChanged( bChanged );
+ bRet = sal_True;
+ }
+ }
+ }
+
+ return bRet;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxIMapDlg, InfoHdl, IMapWindow*, pWnd )
+{
+ String aStr;
+ const NotifyInfo& rInfo = pWnd->GetInfo();
+
+ if ( rInfo.bNewObj )
+ {
+ if( rInfo.aMarkURL.Len() && ( maURLBox.GetEntryPos( rInfo.aMarkURL ) == LISTBOX_ENTRY_NOTFOUND ) )
+ maURLBox.InsertEntry( rInfo.aMarkURL );
+
+ maURLBox.SetText( rInfo.aMarkURL );
+ aEdtText.SetText( rInfo.aMarkAltText );
+
+ if ( !rInfo.aMarkTarget.Len() )
+ maCbbTarget.SetText( DEFINE_CONST_UNICODE( SELF_TARGET ) );
+ else
+ maCbbTarget.SetText( rInfo.aMarkTarget );
+ }
+
+ if ( !rInfo.bOneMarked )
+ {
+ aTbxIMapDlg1.CheckItem( TBI_ACTIVE, sal_False );
+ aTbxIMapDlg1.EnableItem( TBI_ACTIVE, sal_False );
+ aTbxIMapDlg1.EnableItem( TBI_MACRO, sal_False );
+ aTbxIMapDlg1.EnableItem( TBI_PROPERTY, sal_False );
+ aStbStatus.SetItemText( 1, aStr );
+
+ aFtURL.Disable();
+ maURLBox.Disable();
+ aFtText.Disable();
+ aEdtText.Disable();
+ maFtTarget.Disable();
+ maCbbTarget.Disable();
+
+ maURLBox.SetText( String() );
+ aEdtText.SetText( String() );
+ }
+ else
+ {
+ aTbxIMapDlg1.EnableItem( TBI_ACTIVE, sal_True );
+ aTbxIMapDlg1.CheckItem( TBI_ACTIVE, !rInfo.bActivated );
+ aTbxIMapDlg1.EnableItem( TBI_MACRO, sal_True );
+ aTbxIMapDlg1.EnableItem( TBI_PROPERTY, sal_True );
+
+ aFtURL.Enable();
+ maURLBox.Enable();
+ aFtText.Enable();
+ aEdtText.Enable();
+ maFtTarget.Enable();
+ maCbbTarget.Enable();
+
+ aStbStatus.SetItemText( 1, rInfo.aMarkURL );
+
+ if ( maURLBox.GetText() != rInfo.aMarkURL )
+ maURLBox.SetText( rInfo.aMarkURL );
+
+ if ( aEdtText.GetText() != rInfo.aMarkAltText )
+ aEdtText.SetText( rInfo.aMarkAltText );
+
+ if ( !rInfo.aMarkTarget.Len() )
+ maCbbTarget.SetText( DEFINE_CONST_UNICODE( SELF_TARGET ) );
+ else
+ maCbbTarget.SetText( rInfo.aMarkTarget );
+ }
+
+ return 0;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxIMapDlg, MousePosHdl, IMapWindow*, pWnd )
+{
+ String aStr;
+ const FieldUnit eFieldUnit = GetBindings().GetDispatcher()->GetModule()->GetFieldUnit();
+ const Point& rMousePos = pWnd->GetMousePos();
+ LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
+ const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep().GetChar(0);
+
+ aStr.Assign( GetUnitString( rMousePos.X(), eFieldUnit, cSep ) );
+ aStr.Append( DEFINE_CONST_UNICODE( " / " ) );
+ aStr.Append( GetUnitString( rMousePos.Y(), eFieldUnit, cSep ) );
+
+ aStbStatus.SetItemText( 2, aStr );
+
+ return 0L;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxIMapDlg, GraphSizeHdl, IMapWindow*, pWnd )
+{
+ String aStr;
+ const FieldUnit eFieldUnit = GetBindings().GetDispatcher()->GetModule()->GetFieldUnit();
+ const Size& rSize = pWnd->GetGraphicSize();
+ LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
+ const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep().GetChar(0);
+
+ aStr.Assign( GetUnitString( rSize.Width(), eFieldUnit, cSep ) );
+ aStr.Append( DEFINE_CONST_UNICODE( " x " ) );
+ aStr.Append( GetUnitString( rSize.Height(), eFieldUnit, cSep ) );
+
+ aStbStatus.SetItemText( 3, aStr );
+
+ return 0L;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxIMapDlg, URLModifyHdl, void*, EMPTYARG )
+{
+ NotifyInfo aNewInfo;
+
+ aNewInfo.aMarkURL = maURLBox.GetText();
+ aNewInfo.aMarkAltText = aEdtText.GetText();
+ aNewInfo.aMarkTarget = maCbbTarget.GetText();
+
+ pIMapWnd->ReplaceActualIMapInfo( aNewInfo );
+
+ return 0;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxIMapDlg, URLLoseFocusHdl, void*, EMPTYARG )
+{
+ NotifyInfo aNewInfo;
+ const String aURLText( maURLBox.GetText() );
+ const String aTargetText( maCbbTarget.GetText() );
+
+ if ( aURLText.Len() )
+ {
+ String aBase = GetBindings().GetDispatcher()->GetFrame()->GetObjectShell()->GetMedium()->GetBaseURL();
+ aNewInfo.aMarkURL = ::URIHelper::SmartRel2Abs( INetURLObject(aBase), aURLText, URIHelper::GetMaybeFileHdl(), true, false,
+ INetURLObject::WAS_ENCODED,
+ INetURLObject::DECODE_UNAMBIGUOUS );
+ }
+ else
+ aNewInfo.aMarkURL = aURLText;
+
+ aNewInfo.aMarkAltText = aEdtText.GetText();
+
+ if ( !aTargetText.Len() )
+ aNewInfo.aMarkTarget = DEFINE_CONST_UNICODE( SELF_TARGET );
+ else
+ aNewInfo.aMarkTarget = aTargetText;
+
+ pIMapWnd->ReplaceActualIMapInfo( aNewInfo );
+
+ return 0;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxIMapDlg, UpdateHdl, Timer*, EMPTYARG )
+{
+ pOwnData->aTimer.Stop();
+
+ if ( pOwnData->pUpdateEditingObject != pCheckObj )
+ {
+ if ( pIMapWnd->IsChanged() &&
+ ( QueryBox( this, WB_YES_NO | WB_DEF_YES,
+ String( SVX_RES( STR_IMAPDLG_SAVE ) ) ).Execute() == RET_YES ) )
+ {
+ DoSave();
+ }
+
+ SetGraphic( pOwnData->aUpdateGraphic );
+ SetImageMap( pOwnData->aUpdateImageMap );
+ SetTargetList( pOwnData->aUpdateTargetList );
+ SetEditingObject( pOwnData->pUpdateEditingObject );
+
+ // Nach Wechsel => default Selektion
+ aTbxIMapDlg1.CheckItem( TBI_SELECT, sal_True );
+ pIMapWnd->SetEditMode( sal_True );
+ }
+
+ // die in der Update-Methode kopierte Liste wieder loeschen
+ for( String* pStr = pOwnData->aUpdateTargetList.First(); pStr; pStr = pOwnData->aUpdateTargetList.Next() )
+ delete pStr;
+
+ pOwnData->aUpdateTargetList.Clear();
+
+ GetBindings().Invalidate( SID_IMAP_EXEC );
+
+ return 0L;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxIMapDlg, StateHdl, IMapWindow*, pWnd )
+{
+ const SdrObject* pObj = pWnd->GetSelectedSdrObject();
+ const SdrModel* pModel = pWnd->GetSdrModel();
+ const SdrView* pView = pWnd->GetSdrView();
+ const sal_Bool bPolyEdit = ( pObj != NULL ) && pObj->ISA( SdrPathObj );
+ const sal_Bool bDrawEnabled = !( bPolyEdit && aTbxIMapDlg1.IsItemChecked( TBI_POLYEDIT ) );
+
+ aTbxIMapDlg1.EnableItem( TBI_APPLY, pOwnData->bExecState && pWnd->IsChanged() );
+
+ aTbxIMapDlg1.EnableItem( TBI_SELECT, bDrawEnabled );
+ aTbxIMapDlg1.EnableItem( TBI_RECT, bDrawEnabled );
+ aTbxIMapDlg1.EnableItem( TBI_CIRCLE, bDrawEnabled );
+ aTbxIMapDlg1.EnableItem( TBI_POLY, bDrawEnabled );
+ aTbxIMapDlg1.EnableItem( TBI_FREEPOLY, bDrawEnabled );
+
+ // BezierEditor-Stati
+ aTbxIMapDlg1.EnableItem( TBI_POLYEDIT, bPolyEdit );
+ aTbxIMapDlg1.EnableItem( TBI_POLYMOVE, !bDrawEnabled );
+ aTbxIMapDlg1.EnableItem( TBI_POLYINSERT, !bDrawEnabled );
+ aTbxIMapDlg1.EnableItem( TBI_POLYDELETE, !bDrawEnabled && pView->IsDeleteMarkedPointsPossible() );
+
+ // Undo/Redo
+ aTbxIMapDlg1.EnableItem( TBI_UNDO, pModel->GetUndoActionCount() > 0 );
+ aTbxIMapDlg1.EnableItem( TBI_REDO, pModel->GetRedoActionCount() > 0 );
+
+ if ( bPolyEdit )
+ {
+ sal_uInt16 nId = 0;
+
+ switch( pWnd->GetPolyEditMode() )
+ {
+ case( SID_BEZIER_MOVE ): nId = TBI_POLYMOVE; break;
+ case( SID_BEZIER_INSERT ): nId = TBI_POLYINSERT; break;
+
+ default:
+ break;
+ }
+
+ aTbxIMapDlg1.CheckItem( nId, sal_True );
+ }
+ else
+ {
+ aTbxIMapDlg1.CheckItem( TBI_POLYEDIT, sal_False );
+ aTbxIMapDlg1.CheckItem( TBI_POLYMOVE, sal_True );
+ aTbxIMapDlg1.CheckItem( TBI_POLYINSERT, sal_False );
+ pWnd->SetPolyEditMode( 0 );
+ }
+
+ return 0L;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxIMapDlg, MiscHdl, void*, EMPTYARG )
+{
+ SvtMiscOptions aMiscOptions;
+ aTbxIMapDlg1.SetOutStyle( aMiscOptions.GetToolboxStyle() );
+
+ return 0L;
+}
+
+void SvxIMapDlg::ApplyImageList()
+{
+ bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ ImageList& rImgLst = bHighContrast ? maImageListH : maImageList;
+
+ aTbxIMapDlg1.SetImageList( rImgLst );
+}
+
+void SvxIMapDlg::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SfxModelessDialog::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ ApplyImageList();
+}
diff --git a/svx/source/dialog/imapdlg.hrc b/svx/source/dialog/imapdlg.hrc
new file mode 100644
index 000000000000..4a6d322699b5
--- /dev/null
+++ b/svx/source/dialog/imapdlg.hrc
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <svx/dialogs.hrc>
+
+
+// ImapDlg-Dialoge
+#define RID_SVX_IMAPDLG_START RID_SVX_IMAP_START
+
+
+/******************************************************************************/
+
+
+#define RID_SVXDLG_IMAP (RID_SVX_IMAPDLG_START)
+#define RID_SVXCTL_IMAP (RID_SVX_IMAPDLG_START + 7)
+
+#define TBX_IMAPDLG1 1
+#define TBI_APPLY 1
+#define TBI_OPEN 2
+#define TBI_SAVEAS 3
+
+#define TBI_SELECT 4
+#define TBI_RECT 5
+#define TBI_CIRCLE 6
+#define TBI_POLY 7
+#define TBI_FREEPOLY 8
+
+#define TBI_ACTIVE 16
+#define TBI_COLOR 17
+#define TBI_MACRO 18
+#define TBI_PROPERTY 19
+
+#define TBI_POLYEDIT 30
+#define TBI_POLYMOVE 31
+#define TBI_POLYINSERT 32
+#define TBI_POLYDELETE 33
+
+#define TBI_UNDO 40
+#define TBI_REDO 41
+
+#define FT_URL 1
+#define FT_TEXT 2
+#define FT_TARG 3
+#define CBB_URL 1
+#define EDT_TEXT 1
+#define LB_TARG 1
+
+#define STB_STATUS 1
+
+#define IL_IMAPDLG 1024
+#define ILH_IMAPDLG 1025
+
+/******************************************************************************/
+
+
+#define RID_SVXMN_IMAP (RID_SVX_IMAPDLG_START + 1)
+
+#define MN_URL 1
+#define MN_POSITION 2
+#define MN_FRAME_TO_TOP 3
+#define MN_MOREFRONT 4
+#define MN_MOREBACK 5
+#define MN_FRAME_TO_BOTTOM 6
+#define MN_MARK_ALL 7
+#define MN_DELETE1 8
+#define MN_ACTIVATE 9
+#define MN_MACRO 10
+
+/******************************************************************************/
+
+
+#define RID_SVXCTL_FT_TARGET (RID_SVX_IMAPDLG_START + 3)
+#define RID_SVXCTL_CBB_TARGET (RID_SVX_IMAPDLG_START + 4)
+
+
+/******************************************************************************/
+
+
+#define STR_IMAPDLG_SAVE (RID_SVX_IMAPDLG_START + 5)
+#define STR_IMAPDLG_MODIFY (RID_SVX_IMAPDLG_START + 6)
+
+
+/******************************************************************************/
diff --git a/svx/source/dialog/imapdlg.src b/svx/source/dialog/imapdlg.src
new file mode 100644
index 000000000000..d691f5443b5a
--- /dev/null
+++ b/svx/source/dialog/imapdlg.src
@@ -0,0 +1,369 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ---------------------------------------------------------------
+#include "helpid.hrc"
+#include "imapdlg.hrc"
+ // pragma ----------------------------------------------------------------
+
+ // RID_SVXDLG_IMAP ----------------------------------------------------
+ModelessDialog RID_SVXDLG_IMAP
+{
+ HelpID = "svx:ModelessDialog:RID_SVXDLG_IMAP";
+ OutputSize = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 270 , 213 ) ;
+ Sizeable = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ ToolBox TBX_IMAPDLG1
+ {
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ HelpId = HID_IMAPDLG_TOOLBOX ;
+
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ Identifier = TBI_APPLY ;
+ HelpId = HID_IMAPDLG_APPLY ;
+ Text [ en-US ] = "Apply" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_OPEN ;
+ HelpId = HID_IMAPDLG_OPEN ;
+ Text [ en-US ] = "Open..." ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_SAVEAS ;
+ HelpId = HID_IMAPDLG_SAVEAS ;
+
+ Text [ en-US ] = "Save..." ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_SELECT ;
+ HelpId = HID_IMAPDLG_SELECT ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ Text [ en-US ] = "Select" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_RECT ;
+ HelpId = HID_IMAPDLG_RECT ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ Text [ en-US ] = "Rectangle" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_CIRCLE ;
+ HelpId = HID_IMAPDLG_CIRCLE ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ Text [ en-US ] = "Ellipse" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_POLY ;
+ HelpId = HID_IMAPDLG_POLY ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ Text [ en-US ] = "Polygon" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_FREEPOLY ;
+ HelpId = HID_IMAPDLG_FREEPOLY ;
+ Text [ en-US ] = "Freeform Polygon" ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_POLYEDIT ;
+ HelpId = HID_IMAPDLG_POLYEDIT ;
+ Text [ en-US ] = "Edit Points" ;
+ AutoCheck = TRUE ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_POLYMOVE ;
+ HelpId = HID_IMAPDLG_POLYMOVE ;
+ Text [ en-US ] = "Move Points" ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_POLYINSERT ;
+ HelpId = HID_IMAPDLG_POLYINSERT ;
+ Text [ en-US ] = "Insert Points" ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_POLYDELETE ;
+ HelpId = HID_IMAPDLG_POLYDELETE ;
+ Text [ en-US ] = "Delete Points" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_UNDO ;
+ HelpId = HID_IMAPDLG_UNDO ;
+ Text [ en-US ] = "Undo " ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_REDO ;
+ HelpId = HID_IMAPDLG_REDO ;
+ Text [ en-US ] = "Redo" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_ACTIVE ;
+ HelpId = HID_IMAPDLG_ACTIVE ;
+ Text [ en-US ] = "Active" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_MACRO ;
+ HelpId = HID_IMAPDLG_MACRO ;
+ Text [ en-US ] = "Macro..." ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_PROPERTY ;
+ HelpId = HID_IMAPDLG_PROPERTY ;
+ Text [ en-US ] = "Properties..." ;
+ };
+ };
+ };
+
+ FixedText FT_URL
+ {
+ Pos = MAP_APPFONT ( 6 , 25 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ Text [ en-US ] = "Address:" ;
+ };
+ ComboBox CBB_URL
+ {
+ HelpID = "svx:ComboBox:RID_SVXDLG_IMAP:CBB_URL";
+ Pos = MAP_APPFONT ( 39 , 23 ) ;
+ Size = MAP_APPFONT ( 225 , 69 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ AutoSize = TRUE ;
+ AutoHScroll = TRUE ;
+ };
+ FixedText FT_TEXT
+ {
+ Pos = MAP_APPFONT ( 6 , 43 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ Text [ en-US ] = "Text:" ;
+ };
+ Edit EDT_TEXT
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_IMAP:EDT_TEXT";
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 39 , 41 ) ;
+ Size = MAP_APPFONT ( 143 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ };
+ Text [ en-US ] = "ImageMap Editor" ;
+
+ FixedText RID_SVXCTL_FT_TARGET
+ {
+ Pos = MAP_APPFONT ( 188 , 43 ) ;
+ Size = MAP_APPFONT ( 22 , 12 ) ;
+ Text [ en-US ] = "Frame:" ;
+ };
+ // nur temporaer
+ ComboBox RID_SVXCTL_CBB_TARGET
+ {
+ HelpID = "svx:ComboBox:RID_SVXDLG_IMAP:RID_SVXCTL_CBB_TARGET";
+ Border = TRUE ;
+ Sort = TRUE ;
+ Pos = MAP_APPFONT ( 213 , 41 ) ;
+ Size = MAP_APPFONT ( 51 , 50 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ HScroll = TRUE ;
+ };
+
+
+#define IMAPDLG_IDLIST \
+ IdList = \
+ { \
+ TBI_APPLY ; \
+ TBI_OPEN ; \
+ TBI_SAVEAS ; \
+ TBI_SELECT ; \
+ TBI_RECT ; \
+ TBI_CIRCLE ; \
+ TBI_POLY ; \
+ TBI_FREEPOLY ; \
+ TBI_POLYEDIT ; \
+ TBI_POLYMOVE ; \
+ TBI_POLYINSERT ; \
+ TBI_POLYDELETE ; \
+ TBI_UNDO ; \
+ TBI_REDO ; \
+ TBI_ACTIVE ; \
+ TBI_MACRO ; \
+ TBI_PROPERTY ; \
+ }; \
+ IdCount = { 17 ; };
+
+ ImageList IL_IMAPDLG
+ {
+ Prefix = "id";
+ MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; } ;
+ IMAPDLG_IDLIST
+ };
+ ImageList ILH_IMAPDLG
+ {
+ Prefix = "idh";
+ MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; } ;
+ IMAPDLG_IDLIST
+ };
+};
+Control RID_SVXCTL_IMAP
+{
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 56 ) ;
+ HelpId = HID_IMAPDLG_GRAPHWND ;
+};
+
+/******************************************************************************/
+Menu RID_SVXMN_IMAP
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = MN_URL ;
+ Text [ en-US ] = "Description..." ;
+ };
+ MenuItem
+ {
+ Identifier = MN_MACRO ;
+ Text [ en-US ] = "~Macro..." ;
+ };
+ MenuItem
+ {
+ Identifier = MN_ACTIVATE ;
+ Text [ en-US ] = "Active" ;
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = MN_POSITION ;
+ Text [ en-US ] = "Arrange" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = MN_FRAME_TO_TOP ;
+ Text [ en-US ] = "Bring to Front" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_MOREFRONT ;
+ Text [ en-US ] = "Bring ~Forward" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_MOREBACK ;
+ Text [ en-US ] = "Send Back~ward" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_FRAME_TO_BOTTOM ;
+ Text [ en-US ] = "~Send to Back" ;
+ };
+ };
+ };
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = MN_MARK_ALL ;
+ Text [ en-US ] = "Select ~All" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_DELETE1 ;
+ Text [ en-US ] = "~Delete" ;
+ };
+ };
+};
+
+/******************************************************************************/
+
+String STR_IMAPDLG_SAVE
+{
+ Text [ en-US ] = "The ImageMap has been modified.\nDo you want to save the changes?";
+};
+
+String STR_IMAPDLG_MODIFY
+{
+ Text [ en-US ] = "The ImageMap has been modified.\nDo you want to save the changes?" ;
+};
diff --git a/svx/source/dialog/imapimp.hxx b/svx/source/dialog/imapimp.hxx
new file mode 100644
index 000000000000..fd496a609f90
--- /dev/null
+++ b/svx/source/dialog/imapimp.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _IMAPIMP_HXX_
+#define _IMAPIMP_HXX_
+
+// ---------------
+// - IMapOwnData -
+// ---------------
+
+class IMapOwnData
+{
+private:
+
+ SvxIMapDlg* pIMap;
+
+public:
+
+ Timer aTimer;
+ Timer aTbxTimer;
+ Graphic aUpdateGraphic;
+ ImageMap aUpdateImageMap;
+ TargetList aUpdateTargetList;
+ void* pUpdateEditingObject;
+ sal_Bool bExecState;
+
+ IMapOwnData( SvxIMapDlg* pIMapDlg ) : pIMap ( pIMapDlg ) {}
+};
+
+
+#endif // _IMAPIMP_HXX
diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx
new file mode 100644
index 000000000000..ff152a152d51
--- /dev/null
+++ b/svx/source/dialog/imapwnd.cxx
@@ -0,0 +1,1069 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <tools/urlobj.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/help.hxx>
+#include <sfx2/sfxsids.hrc> // SID_ATTR_MACROITEM
+#define _ANIMATION
+#include <svtools/imaprect.hxx>
+#include <svtools/imapcirc.hxx>
+#include <svtools/imappoly.hxx>
+#include <svl/urlbmk.hxx>
+
+#include <svx/xoutbmp.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/svxids.hrc>
+#include <imapdlg.hrc>
+#include <imapwnd.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdorect.hxx>
+#include <svx/svdocirc.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/xfltrit.hxx>
+#include <svx/svdpagv.hxx>
+#include <svl/urihelper.hxx>
+#include <svx/xfillit.hxx>
+#include <svx/xlineit.hxx>
+#include <sfx2/evntconf.hxx>
+
+#include <sot/formats.hxx>
+
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+using ::com::sun::star::frame::XFrame;
+using ::com::sun::star::uno::Reference;
+
+#define TRANSCOL Color( COL_WHITE )
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMapWindow::IMapWindow( Window* pParent, const ResId& rResId, const Reference< XFrame >& rxDocumentFrame ) :
+ GraphCtrl( pParent, rResId ),
+ DropTargetHelper( this ),
+ mxDocumentFrame( rxDocumentFrame )
+{
+ SetWinStyle( WB_SDRMODE );
+
+ pItemInfo = new SfxItemInfo[ 1 ];
+ memset( pItemInfo, 0, sizeof( SfxItemInfo ) );
+ pIMapPool = new SfxItemPool( String::CreateFromAscii( "IMapItemPool" ),
+ SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, pItemInfo );
+ pIMapPool->FreezeIdRanges();
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMapWindow::~IMapWindow()
+{
+ // Liste loeschen
+ for( String* pStr = aTargetList.First(); pStr; pStr = aTargetList.Next() )
+ delete pStr;
+
+ SfxItemPool::Free(pIMapPool);
+ delete[] pItemInfo;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::SetImageMap( const ImageMap& rImageMap )
+{
+ ReplaceImageMap( rImageMap, sal_False );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::ReplaceImageMap( const ImageMap& rImageMap, sal_Bool /*bScaleToGraphic*/ )
+{
+ SdrPage* pPage = 0;
+ aIMap = rImageMap;
+
+ if(GetSdrModel())
+ {
+ // try to access page
+ pPage = GetSdrModel()->GetPage(0L);
+ }
+
+ if(pPage)
+ {
+ // clear all draw objects
+ pPage->Clear();
+ }
+
+ if(GetSdrView())
+ {
+ // #i63762# reset selection at view
+ GetSdrView()->UnmarkAllObj();
+ }
+
+ // create new drawing objects
+ const sal_uInt16 nCount(rImageMap.GetIMapObjectCount());
+
+ for ( sal_uInt16 i(nCount); i > 0; i-- )
+ {
+ SdrObject* pNewObj = CreateObj( rImageMap.GetIMapObject( i - 1 ) );
+
+ if ( pNewObj )
+ {
+ pPage->InsertObject( pNewObj );
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+sal_Bool IMapWindow::ReplaceActualIMapInfo( const NotifyInfo& rNewInfo )
+{
+ const SdrObject* pSdrObj = GetSelectedSdrObject();
+ IMapObject* pIMapObj;
+ sal_Bool bRet = sal_False;
+
+ if ( pSdrObj && ( ( pIMapObj = GetIMapObj( pSdrObj ) ) != NULL ) )
+ {
+ pIMapObj->SetURL( rNewInfo.aMarkURL );
+ pIMapObj->SetAltText( rNewInfo.aMarkAltText );
+ pIMapObj->SetTarget( rNewInfo.aMarkTarget );
+ pModel->SetChanged( sal_True );
+ UpdateInfo( sal_False );
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+const ImageMap& IMapWindow::GetImageMap()
+{
+ if ( pModel->IsChanged() )
+ {
+ SdrPage* pPage = (SdrPage*) pModel->GetPage( 0 );
+
+ if ( pPage )
+ {
+ const long nCount = pPage->GetObjCount();
+
+ aIMap.ClearImageMap();
+
+ for ( long i = nCount - 1; i > -1; i-- )
+ aIMap.InsertIMapObject( *( ( (IMapUserData*) pPage->GetObj( i )->GetUserData( 0 ) )->GetObject() ) );
+ }
+
+ pModel->SetChanged( sal_False );
+ }
+
+ return aIMap;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::SetTargetList( TargetList& rTargetList )
+{
+ String* pStr;
+
+ // alte Liste loeschen
+ for( pStr = aTargetList.First(); pStr; pStr = aTargetList.Next() )
+ delete pStr;
+
+ aTargetList.Clear();
+
+ // mit uebergebener Liste fuellen
+ for( pStr = rTargetList.First(); pStr; pStr = rTargetList.Next() )
+ aTargetList.Insert( new String( *pStr ) );
+
+ pModel->SetChanged( sal_False );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj )
+{
+ Point aPoint;
+ Rectangle aClipRect( aPoint, GetGraphicSize() );
+ SdrObject* pSdrObj = NULL;
+ IMapObjectPtr pCloneIMapObj;
+
+ switch( pIMapObj->GetType() )
+ {
+ case( IMAP_OBJ_RECTANGLE ):
+ {
+ IMapRectangleObject* pIMapRectObj = (IMapRectangleObject*) pIMapObj;
+ Rectangle aDrawRect( pIMapRectObj->GetRectangle( sal_False ) );
+
+ // auf Zeichenflaeche clippen
+ aDrawRect.Intersection( aClipRect );
+
+ pSdrObj = (SdrObject*) new SdrRectObj( aDrawRect );
+ pCloneIMapObj.reset((IMapObject*) new IMapRectangleObject( *pIMapRectObj ));
+ }
+ break;
+
+ case( IMAP_OBJ_CIRCLE ):
+ {
+ IMapCircleObject* pIMapCircleObj = (IMapCircleObject*) pIMapObj;
+ const Point aCenter( pIMapCircleObj->GetCenter( sal_False ) );
+ const long nRadius = pIMapCircleObj->GetRadius( sal_False );
+ const Point aOffset( nRadius, nRadius );
+ Rectangle aCircle( aCenter - aOffset, aCenter + aOffset );
+
+ // auf Zeichenflaeche begrenzen
+ aCircle.Intersection( aClipRect );
+
+ pSdrObj = (SdrObject*) new SdrCircObj( OBJ_CIRC, aCircle, 0, 36000 );
+ pCloneIMapObj.reset((IMapObject*) new IMapCircleObject( *pIMapCircleObj ));
+ }
+ break;
+
+ case( IMAP_OBJ_POLYGON ):
+ {
+ IMapPolygonObject* pIMapPolyObj = (IMapPolygonObject*) pIMapObj;
+
+ // Falls wir eigentlich eine Ellipse sind,
+ // erzeugen wir auch wieder eine Ellipse
+ if ( pIMapPolyObj->HasExtraEllipse() )
+ {
+ Rectangle aDrawRect( pIMapPolyObj->GetExtraEllipse() );
+
+ // auf Zeichenflaeche clippen
+ aDrawRect.Intersection( aClipRect );
+
+ pSdrObj = (SdrObject*) new SdrCircObj( OBJ_CIRC, aDrawRect, 0, 36000 );
+ }
+ else
+ {
+ const Polygon& rPoly = pIMapPolyObj->GetPolygon( sal_False );
+ Polygon aDrawPoly( rPoly );
+
+ // auf Zeichenflaeche clippen
+ aDrawPoly.Clip( aClipRect );
+
+ basegfx::B2DPolygon aPolygon;
+ aPolygon.append(aDrawPoly.getB2DPolygon());
+ pSdrObj = (SdrObject*)new SdrPathObj(OBJ_POLY, basegfx::B2DPolyPolygon(aPolygon));
+ }
+
+ pCloneIMapObj.reset((IMapObject*) new IMapPolygonObject( *pIMapPolyObj ));
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if ( pSdrObj )
+ {
+ SfxItemSet aSet( pModel->GetItemPool() );
+
+ aSet.Put( XFillStyleItem( XFILL_SOLID ) );
+ aSet.Put( XFillColorItem( String(), TRANSCOL ) );
+
+ if ( !pIMapObj->IsActive() )
+ {
+ aSet.Put( XFillTransparenceItem( 100 ) );
+ aSet.Put( XLineColorItem( String(), Color( COL_RED ) ) );
+ }
+ else
+ {
+ aSet.Put( XFillTransparenceItem( 50 ) );
+ aSet.Put( XLineColorItem( String(), Color( COL_BLACK ) ) );
+ }
+
+ //pSdrObj->SetItemSetAndBroadcast(aSet);
+ pSdrObj->SetMergedItemSetAndBroadcast(aSet);
+
+ pSdrObj->InsertUserData( new IMapUserData( pCloneIMapObj ) );
+ pSdrObj->SetUserCall( GetSdrUserCall() );
+ }
+
+ return pSdrObj;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::InitSdrModel()
+{
+ GraphCtrl::InitSdrModel();
+
+ SfxItemSet aSet( pModel->GetItemPool() );
+
+ aSet.Put( XFillColorItem( String(), TRANSCOL ) );
+ aSet.Put( XFillTransparenceItem( 50 ) );
+ pView->SetAttributes( aSet );
+ pView->SetFrameDragSingles( sal_True );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::SdrObjCreated( const SdrObject& rObj )
+{
+ switch( rObj.GetObjIdentifier() )
+ {
+ case( OBJ_RECT ):
+ {
+ SdrRectObj* pRectObj = (SdrRectObj*) &rObj;
+ IMapRectangleObject* pObj = new IMapRectangleObject( pRectObj->GetLogicRect(),
+ String(), String(), String(), String(), String(), sal_True, sal_False );
+
+ pRectObj->InsertUserData( new IMapUserData( IMapObjectPtr(pObj) ) );
+ }
+ break;
+
+ case( OBJ_CIRC ):
+ {
+ SdrCircObj* pCircObj = (SdrCircObj*) &rObj;
+ SdrPathObj* pPathObj = (SdrPathObj*) pCircObj->ConvertToPolyObj( sal_False, sal_False );
+ Polygon aPoly(pPathObj->GetPathPoly().getB2DPolygon(0L));
+ delete pPathObj;
+
+ IMapPolygonObject* pObj = new IMapPolygonObject( Polygon(aPoly), String(), String(), String(), String(), String(), sal_True, sal_False );
+ pObj->SetExtraEllipse( aPoly.GetBoundRect() );
+ pCircObj->InsertUserData( new IMapUserData( IMapObjectPtr(pObj) ) );
+ }
+ break;
+
+ case( OBJ_POLY ):
+ case( OBJ_FREEFILL ):
+ case( OBJ_PATHPOLY ):
+ case( OBJ_PATHFILL ):
+ {
+ SdrPathObj* pPathObj = (SdrPathObj*) &rObj;
+ const basegfx::B2DPolyPolygon& rXPolyPoly = pPathObj->GetPathPoly();
+
+ if ( rXPolyPoly.count() )
+ {
+ Polygon aPoly(rXPolyPoly.getB2DPolygon(0L));
+ IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, String(), String(), String(), String(), String(), sal_True, sal_False );
+ pPathObj->InsertUserData( new IMapUserData( IMapObjectPtr(pObj) ) );
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::SdrObjChanged( const SdrObject& rObj )
+{
+ IMapUserData* pUserData = (IMapUserData*) rObj.GetUserData( 0 );
+
+ if ( pUserData )
+ {
+ String aURL;
+ String aAltText;
+ String aDesc;
+ String aTarget;
+ IMapObjectPtr pIMapObj = pUserData->GetObject();
+ sal_Bool bActive = sal_True;
+
+ if ( pIMapObj.get() )
+ {
+ aURL = pIMapObj->GetURL();
+ aAltText = pIMapObj->GetAltText();
+ aDesc = pIMapObj->GetDesc();
+ aTarget = pIMapObj->GetTarget();
+ bActive = pIMapObj->IsActive();
+ }
+
+ switch( rObj.GetObjIdentifier() )
+ {
+ case( OBJ_RECT ):
+ {
+ pUserData->ReplaceObject( IMapObjectPtr(new IMapRectangleObject( ( (const SdrRectObj&) rObj ).GetLogicRect(),
+ aURL, aAltText, aDesc, aTarget, String(), bActive, sal_False ) ) );
+ }
+ break;
+
+ case( OBJ_CIRC ):
+ {
+ const SdrCircObj& rCircObj = (const SdrCircObj&) rObj;
+ SdrPathObj* pPathObj = (SdrPathObj*) rCircObj.ConvertToPolyObj( sal_False, sal_False );
+ Polygon aPoly(pPathObj->GetPathPoly().getB2DPolygon(0L));
+
+ IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, aURL, aAltText, aDesc, aTarget, String(), bActive, sal_False );
+ pObj->SetExtraEllipse( aPoly.GetBoundRect() );
+
+ // wurde von uns nur temporaer angelegt
+ delete pPathObj;
+ pUserData->ReplaceObject( IMapObjectPtr(pObj) );
+ }
+ break;
+
+ case( OBJ_POLY ):
+ case( OBJ_FREEFILL ):
+ case( OBJ_PATHPOLY ):
+ case( OBJ_PATHFILL ):
+ {
+ const SdrPathObj& rPathObj = (const SdrPathObj&) rObj;
+ const basegfx::B2DPolyPolygon& rXPolyPoly = rPathObj.GetPathPoly();
+
+ if ( rXPolyPoly.count() )
+ {
+ Polygon aPoly(rPathObj.GetPathPoly().getB2DPolygon(0L));
+ IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, aURL, aAltText, aDesc, aTarget, String(), bActive, sal_False );
+ pUserData->ReplaceObject( IMapObjectPtr(pObj) );
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ GraphCtrl::MouseButtonUp( rMEvt );
+ UpdateInfo( sal_True );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::MarkListHasChanged()
+{
+ GraphCtrl::MarkListHasChanged();
+ UpdateInfo( sal_False );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+SdrObject* IMapWindow::GetHitSdrObj( const Point& rPosPixel ) const
+{
+ SdrObject* pObj = NULL;
+ Point aPt = PixelToLogic( rPosPixel );
+
+ if ( Rectangle( Point(), GetGraphicSize() ).IsInside( aPt ) )
+ {
+ SdrPage* pPage = (SdrPage*) pModel->GetPage( 0 );
+ sal_uIntPtr nCount;
+
+ if ( pPage && ( ( nCount = pPage->GetObjCount() ) > 0 ) )
+ {
+ for ( long i = nCount - 1; i >= 0; i-- )
+ {
+ SdrObject* pTestObj = pPage->GetObj( i );
+ IMapObject* pIMapObj = GetIMapObj( pTestObj );
+
+ if ( pIMapObj && pIMapObj->IsHit( aPt ) )
+ {
+ pObj = pTestObj;
+ break;
+ }
+ }
+ }
+ }
+
+ return pObj;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMapObject* IMapWindow::GetIMapObj( const SdrObject* pSdrObj ) const
+{
+ IMapObject* pIMapObj = NULL;
+
+ if ( pSdrObj )
+ {
+ IMapUserData* pUserData = (IMapUserData*) pSdrObj->GetUserData( 0 );
+
+ if ( pUserData )
+ pIMapObj = pUserData->GetObject().get();
+ }
+
+ return pIMapObj;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+SdrObject* IMapWindow::GetSdrObj( const IMapObject* pIMapObj ) const
+{
+ SdrObject* pSdrObj = NULL;
+ SdrPage* pPage = (SdrPage*) pModel->GetPage( 0 );
+ sal_uIntPtr nCount;
+
+ if ( pPage && ( ( nCount = pPage->GetObjCount() ) > 0 ) )
+ {
+ for ( sal_uIntPtr i = 0; i < nCount; i++ )
+ {
+ SdrObject* pTestObj = pPage->GetObj( i );
+
+ if ( pIMapObj == GetIMapObj( pTestObj ) )
+ {
+ pSdrObj = pTestObj;
+ break;
+ }
+ }
+ }
+
+ return pSdrObj;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::Command(const CommandEvent& rCEvt)
+{
+ Region aRegion;
+
+ if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
+ {
+ PopupMenu aMenu( SVX_RES( RID_SVXMN_IMAP ) );
+ const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
+ sal_uIntPtr nMarked = rMarkList.GetMarkCount();
+
+ aMenu.EnableItem( MN_URL, sal_False );
+ aMenu.EnableItem( MN_ACTIVATE, sal_False );
+ aMenu.EnableItem( MN_MACRO, sal_False );
+ aMenu.EnableItem( MN_MARK_ALL, pModel->GetPage( 0 )->GetObjCount() != pView->GetMarkedObjectCount() );
+
+ if ( !nMarked )
+ {
+ aMenu.EnableItem( MN_POSITION, sal_False );
+ aMenu.EnableItem( MN_FRAME_TO_TOP, sal_False );
+ aMenu.EnableItem( MN_MOREFRONT, sal_False );
+ aMenu.EnableItem( MN_MOREBACK, sal_False );
+ aMenu.EnableItem( MN_FRAME_TO_BOTTOM, sal_False );
+ aMenu.EnableItem( MN_DELETE1, sal_False );
+ }
+ else
+ {
+ if ( nMarked == 1 )
+ {
+ SdrObject* pSdrObj = GetSelectedSdrObject();
+
+ aMenu.EnableItem( MN_URL, sal_True );
+ aMenu.EnableItem( MN_ACTIVATE, sal_True );
+ aMenu.EnableItem( MN_MACRO, sal_True );
+ aMenu.CheckItem( MN_ACTIVATE, GetIMapObj( pSdrObj )->IsActive() );
+ }
+
+ aMenu.EnableItem( MN_POSITION, sal_True );
+ aMenu.EnableItem( MN_FRAME_TO_TOP, sal_True );
+ aMenu.EnableItem( MN_MOREFRONT, sal_True );
+ aMenu.EnableItem( MN_MOREBACK, sal_True );
+ aMenu.EnableItem( MN_FRAME_TO_BOTTOM, sal_True );
+ aMenu.EnableItem( MN_DELETE1, sal_True );
+ }
+
+ aMenu.SetSelectHdl( LINK( this, IMapWindow, MenuSelectHdl ) );
+ aMenu.Execute( this, rCEvt.GetMousePosPixel() );
+ }
+ else
+ Window::Command(rCEvt);
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+sal_Int8 IMapWindow::AcceptDrop( const AcceptDropEvent& rEvt )
+{
+ return( ( GetHitSdrObj( rEvt.maPosPixel ) != NULL ) ? rEvt.mnAction : DND_ACTION_NONE );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+sal_Int8 IMapWindow::ExecuteDrop( const ExecuteDropEvent& rEvt )
+{
+ sal_Int8 nRet = DND_ACTION_NONE;
+
+ if( IsDropFormatSupported( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ) )
+ {
+ const String aString;
+ INetBookmark aBookMark( aString, aString );
+ SdrObject* pSdrObj = GetHitSdrObj( rEvt.maPosPixel );
+
+ if( pSdrObj && TransferableDataHelper( rEvt.maDropEvent.Transferable ).GetINetBookmark( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, aBookMark ) )
+ {
+ IMapObject* pIMapObj = GetIMapObj( pSdrObj );
+
+ pIMapObj->SetURL( aBookMark.GetURL() );
+ pIMapObj->SetAltText( aBookMark.GetDescription() );
+ pModel->SetChanged( sal_True );
+ pView->UnmarkAll();
+ pView->MarkObj( pSdrObj, pView->GetSdrPageView() );
+ UpdateInfo( sal_True );
+ nRet = rEvt.mnAction;
+ }
+ }
+
+ return nRet;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::RequestHelp( const HelpEvent& rHEvt )
+{
+ SdrObject* pSdrObj = NULL;
+ SdrPageView* pPageView = NULL;
+ Point aPos = PixelToLogic( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) );
+
+ if ( Help::IsBalloonHelpEnabled() || Help::IsQuickHelpEnabled() )
+ {
+ if ( pView->PickObj( aPos, pView->getHitTolLog(), pSdrObj, pPageView ) )
+ {
+ const IMapObject* pIMapObj = GetIMapObj( pSdrObj );
+ String aStr;
+
+ if ( pIMapObj && ( aStr = pIMapObj->GetURL() ).Len() )
+ {
+ String aDescr( pIMapObj->GetAltText() );
+ Rectangle aLogicPix( LogicToPixel( Rectangle( Point(), GetGraphicSize() ) ) );
+ Rectangle aScreenRect( OutputToScreenPixel( aLogicPix.TopLeft() ),
+ OutputToScreenPixel( aLogicPix.BottomRight() ) );
+
+ if ( Help::IsBalloonHelpEnabled() )
+ Help::ShowBalloon( this, rHEvt.GetMousePosPixel(), aScreenRect, aStr );
+ else if ( Help::IsQuickHelpEnabled() )
+ Help::ShowQuickHelp( this, aScreenRect, aStr );
+ }
+ }
+ else
+ Window::RequestHelp( rHEvt );
+ }
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::SetCurrentObjState( sal_Bool bActive )
+{
+ SdrObject* pObj = GetSelectedSdrObject();
+
+ if ( pObj )
+ {
+ SfxItemSet aSet( pModel->GetItemPool() );
+
+ GetIMapObj( pObj )->SetActive( bActive );
+
+ aSet.Put( XFillColorItem( String(), TRANSCOL ) );
+
+ if ( !bActive )
+ {
+ aSet.Put( XFillTransparenceItem( 100 ) );
+ aSet.Put( XLineColorItem( String(), Color( COL_RED ) ) );
+ }
+ else
+ {
+ aSet.Put( XFillTransparenceItem( 50 ) );
+ aSet.Put( XLineColorItem( String(), Color( COL_BLACK ) ) );
+ }
+
+ pView->SetAttributes( aSet, sal_False );
+ }
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::UpdateInfo( sal_Bool bNewObj )
+{
+ if ( aInfoLink.IsSet() )
+ {
+ const SdrObject* pSdrObj = GetSelectedSdrObject();
+ const IMapObject* pIMapObj = pSdrObj ? GetIMapObj( pSdrObj ) : NULL;
+
+ aInfo.bNewObj = bNewObj;
+
+ if ( pIMapObj )
+ {
+ aInfo.bOneMarked = sal_True;
+ aInfo.aMarkURL = pIMapObj->GetURL();
+ aInfo.aMarkAltText = pIMapObj->GetAltText();
+ aInfo.aMarkTarget = pIMapObj->GetTarget();
+ aInfo.bActivated = pIMapObj->IsActive();
+ aInfoLink.Call( this );
+ }
+ else
+ {
+ aInfo.aMarkURL = aInfo.aMarkAltText = aInfo.aMarkTarget = String();
+ aInfo.bOneMarked = sal_False;
+ aInfo.bActivated = sal_False;
+ }
+
+ aInfoLink.Call( this );
+ }
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::DoMacroAssign()
+{
+ SdrObject* pSdrObj = GetSelectedSdrObject();
+
+ if ( pSdrObj )
+ {
+ SfxItemSet aSet( *pIMapPool, SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, SID_EVENTCONFIG, SID_EVENTCONFIG, 0 );
+
+ SfxEventNamesItem aNamesItem(SID_EVENTCONFIG);
+ aNamesItem.AddEvent( String::CreateFromAscii( "MouseOver" ), String(), SFX_EVENT_MOUSEOVER_OBJECT );
+ aNamesItem.AddEvent( String::CreateFromAscii( "MouseOut" ), String(), SFX_EVENT_MOUSEOUT_OBJECT );
+ aSet.Put( aNamesItem );
+
+ SvxMacroItem aMacroItem(SID_ATTR_MACROITEM);
+ IMapObject* pIMapObj = GetIMapObj( pSdrObj );
+ aMacroItem.SetMacroTable( pIMapObj->GetMacroTable() );
+ aSet.Put( aMacroItem, SID_ATTR_MACROITEM );
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ SfxAbstractDialog* pMacroDlg = pFact->CreateSfxDialog( this, aSet, mxDocumentFrame, SID_EVENTCONFIG );
+
+ if ( pMacroDlg && pMacroDlg->Execute() == RET_OK )
+ {
+ const SfxItemSet* pOutSet = pMacroDlg->GetOutputItemSet();
+ pIMapObj->SetMacroTable( ((const SvxMacroItem& )pOutSet->Get( SID_ATTR_MACROITEM )).GetMacroTable() );
+ pModel->SetChanged( sal_True );
+ UpdateInfo( sal_False );
+ }
+
+ delete pMacroDlg;
+ }
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::DoPropertyDialog()
+{
+ SdrObject* pSdrObj = GetSelectedSdrObject();
+
+ if ( pSdrObj )
+ {
+ IMapObject* pIMapObj = GetIMapObj( pSdrObj );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ AbstractURLDlg* aDlg = pFact->CreateURLDialog( this, pIMapObj->GetURL(), pIMapObj->GetAltText(), pIMapObj->GetDesc(),
+ pIMapObj->GetTarget(), pIMapObj->GetName(), aTargetList );
+ DBG_ASSERT(aDlg, "Dialogdiet fail!");
+ if ( aDlg->Execute() == RET_OK )
+ {
+ const String aURLText( aDlg->GetURL() );
+
+ if ( aURLText.Len() )
+ {
+ INetURLObject aObj( aURLText, INET_PROT_FILE );
+ DBG_ASSERT( aObj.GetProtocol() != INET_PROT_NOT_VALID, "Invalid URL" );
+ pIMapObj->SetURL( aObj.GetMainURL( INetURLObject::NO_DECODE ) );
+ }
+ else
+ pIMapObj->SetURL( aURLText );
+
+ pIMapObj->SetAltText( aDlg->GetAltText() );
+ pIMapObj->SetDesc( aDlg->GetDesc() );
+ pIMapObj->SetTarget( aDlg->GetTarget() );
+ pIMapObj->SetName( aDlg->GetName() );
+ pModel->SetChanged( sal_True );
+ UpdateInfo( sal_True );
+ }
+ delete aDlg; //add by CHINA001
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( IMapWindow, MenuSelectHdl, Menu*, pMenu )
+{
+ if (pMenu)
+ {
+ sal_uInt16 nId = pMenu->GetCurItemId();
+
+ switch(nId)
+ {
+ case( MN_URL ):
+ DoPropertyDialog();
+ break;
+
+ case( MN_MACRO ):
+ DoMacroAssign();
+ break;
+
+ case( MN_ACTIVATE ):
+ {
+ const sal_Bool bNewState = !pMenu->IsItemChecked( MN_ACTIVATE );
+
+ pMenu->CheckItem( MN_ACTIVATE, bNewState );
+ SetCurrentObjState( bNewState );
+ UpdateInfo( sal_False );
+ }
+
+ case( MN_FRAME_TO_TOP ):
+ pView->PutMarkedToTop();
+ break;
+
+ case( MN_MOREFRONT ):
+ pView->MovMarkedToTop();
+ break;
+
+ case( MN_MOREBACK ):
+ pView->MovMarkedToBtm();
+ break;
+
+ case( MN_FRAME_TO_BOTTOM ):
+ pView->PutMarkedToBtm();
+ break;
+
+ case( MN_MARK_ALL ):
+ pView->MarkAll();
+ break;
+
+ case( MN_DELETE1 ):
+ pView->DeleteMarked();
+
+ default :
+ break;
+ }
+ }
+
+ return 0;
+}
+
+void IMapWindow::CreateDefaultObject()
+{
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(pPageView)
+ {
+ // calc position and size
+ Point aPagePos(0, 0); // = pPageView->GetOffset();
+ Size aPageSize = pPageView->GetPage()->GetSize();
+ sal_uInt32 nDefaultObjectSizeWidth = aPageSize.Width() / 4;
+ sal_uInt32 nDefaultObjectSizeHeight = aPageSize.Height() / 4;
+ aPagePos.X() += (aPageSize.Width() / 2) - (nDefaultObjectSizeWidth / 2);
+ aPagePos.Y() += (aPageSize.Height() / 2) - (nDefaultObjectSizeHeight / 2);
+ Rectangle aNewObjectRectangle(aPagePos, Size(nDefaultObjectSizeWidth, nDefaultObjectSizeHeight));
+
+ SdrObject* pObj = SdrObjFactory::MakeNewObject( pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(), 0L, pModel);
+ pObj->SetLogicRect(aNewObjectRectangle);
+
+ switch( pObj->GetObjIdentifier() )
+ {
+ case OBJ_POLY:
+ case OBJ_PATHPOLY:
+ {
+ basegfx::B2DPolygon aInnerPoly;
+ aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.BottomLeft().X(), aNewObjectRectangle.BottomLeft().Y()));
+ aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.TopLeft().X(), aNewObjectRectangle.TopLeft().Y()));
+ aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.TopCenter().X(), aNewObjectRectangle.TopCenter().Y()));
+ aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.Center().X(), aNewObjectRectangle.Center().Y()));
+ aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.RightCenter().X(), aNewObjectRectangle.RightCenter().Y()));
+ aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.BottomRight().X(), aNewObjectRectangle.BottomRight().Y()));
+ aInnerPoly.setClosed(true);
+ ((SdrPathObj*)pObj)->SetPathPoly(basegfx::B2DPolyPolygon(aInnerPoly));
+ break;
+ }
+ case OBJ_FREEFILL:
+ case OBJ_PATHFILL:
+ {
+ sal_Int32 nWdt(aNewObjectRectangle.GetWidth() / 2);
+ sal_Int32 nHgt(aNewObjectRectangle.GetHeight() / 2);
+ basegfx::B2DPolygon aInnerPoly(XPolygon(aNewObjectRectangle.Center(), nWdt, nHgt).getB2DPolygon());
+ ((SdrPathObj*)pObj)->SetPathPoly(basegfx::B2DPolyPolygon(aInnerPoly));
+ break;
+ }
+
+ }
+
+ pView->InsertObjectAtView(pObj, *pPageView);
+ SdrObjCreated( *pObj );
+ SetCurrentObjState( true );
+ pView->MarkObj( pObj, pPageView );
+ }
+}
+
+void IMapWindow::KeyInput( const KeyEvent& rKEvt )
+{
+ KeyCode aCode = rKEvt.GetKeyCode();
+
+/*
+ switch(aCode.GetCode())
+ {
+ case KEY_ESCAPE:
+ {
+ if ( pView->IsAction() )
+ {
+ pView->BrkAction();
+ return;
+ }
+ else if ( pView->AreObjectsMarked() )
+ {
+ const SdrHdlList& rHdlList = pView->GetHdlList();
+ SdrHdl* pHdl = rHdlList.GetFocusHdl();
+
+ if(pHdl)
+ {
+ ((SdrHdlList&)rHdlList).ResetFocusHdl();
+ }
+ else
+ {
+ pView->UnmarkAllObj();
+ ((Dialog*)GetParent())->GrabFocusToFirstControl();
+ }
+
+ return;
+ }
+ }
+ break;
+
+ }
+*/
+ GraphCtrl::KeyInput( rKEvt );
+}
+
+void IMapWindow::SelectFirstObject()
+{
+ SdrPage* pPage = (SdrPage*) pModel->GetPage( 0 );
+ if( pPage->GetObjCount() != 0 )
+ {
+ GrabFocus();
+ pView->UnmarkAllObj();
+ pView->MarkNextObj(sal_True);
+ }
+}
+
+void IMapWindow::StartPolyEdit()
+{
+ GrabFocus();
+
+ if( !pView->AreObjectsMarked() )
+ pView->MarkNextObj(sal_True);
+
+ const SdrHdlList& rHdlList = pView->GetHdlList();
+ SdrHdl* pHdl = rHdlList.GetFocusHdl();
+
+ if(!pHdl)
+ {
+ ((SdrHdlList&)rHdlList).TravelFocusHdl(true);
+ }
+}
diff --git a/svx/source/dialog/imapwnd.hxx b/svx/source/dialog/imapwnd.hxx
new file mode 100644
index 000000000000..bbc6a2c1ed6d
--- /dev/null
+++ b/svx/source/dialog/imapwnd.hxx
@@ -0,0 +1,226 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _IMAPWND_HXX
+#define _IMAPWND_HXX
+
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/menu.hxx>
+#include <svl/itempool.hxx>
+#include <svtools/imapobj.hxx>
+#include <svtools/transfer.hxx>
+#include <svtools/imap.hxx>
+#include <sfx2/frame.hxx>
+#include <svx/graphctl.hxx>
+
+#include <com/sun/star/frame/XFrame.hpp>
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+struct NotifyInfo
+{
+ String aMarkURL;
+ String aMarkAltText;
+ String aMarkTarget;
+ sal_Bool bNewObj;
+ sal_Bool bOneMarked;
+ sal_Bool bActivated;
+};
+
+
+struct NotifyPosSize
+{
+ Size aPictureSize;
+ Point aMousePos;
+ sal_Bool bPictureSize;
+ sal_Bool bMousePos;
+};
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+#define SVD_IMAP_USERDATA 0x0001
+
+const sal_uInt32 IMapInventor = sal_uInt32('I') * 0x00000001+
+ sal_uInt32('M') * 0x00000100+
+ sal_uInt32('A') * 0x00010000+
+ sal_uInt32('P') * 0x01000000;
+
+
+typedef boost::shared_ptr< IMapObject > IMapObjectPtr;
+
+class IMapUserData : public SdrObjUserData
+{
+ // #i98386# use boost::shared_ptr here due to cloning possibilities
+ IMapObjectPtr mpObj;
+
+public:
+
+ IMapUserData() :
+ SdrObjUserData ( IMapInventor, SVD_IMAP_USERDATA, 0 ),
+ mpObj ( ) {}
+
+ IMapUserData( const IMapObjectPtr& rIMapObj ) :
+ SdrObjUserData ( IMapInventor, SVD_IMAP_USERDATA, 0 ),
+ mpObj ( rIMapObj ) {}
+
+ IMapUserData( const IMapUserData& rIMapUserData ) :
+ SdrObjUserData ( IMapInventor, SVD_IMAP_USERDATA, 0 ),
+ mpObj ( rIMapUserData.mpObj ) {}
+
+ ~IMapUserData() { }
+
+ virtual SdrObjUserData* Clone( SdrObject * ) const { return new IMapUserData( *this ); }
+
+ void SetObject( const IMapObjectPtr& rIMapObj ) { mpObj = rIMapObj; }
+ const IMapObjectPtr GetObject() const { return mpObj; }
+ void ReplaceObject( const IMapObjectPtr& pNewIMapObject ) { mpObj = pNewIMapObject; }
+};
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+/* move to cui //CHINA001
+class URLDlg : public ModalDialog
+{
+ FixedLine aFlURL;
+ FixedText aFtURL1;
+ Edit aEdtURL;
+ FixedText aFtURLDescription;
+ Edit aEdtURLDescription;
+ FixedText aFtTarget;
+ ComboBox aCbbTargets;
+ FixedText aFtName;
+ Edit aEdtName;
+ OKButton aBtnOk;
+ CancelButton aBtnCancel;
+
+public:
+
+ URLDlg( Window* pWindow,
+ const String& rURL, const String& rDescription,
+ const String& rTarget, const String& rName,
+ TargetList& rTargetList );
+
+ String GetURL() const { return aEdtURL.GetText(); }
+ String GetDescription() const { return aEdtURLDescription.GetText(); }
+ String GetTarget() const { return aCbbTargets.GetText(); }
+ String GetName() const { return aEdtName.GetText(); }
+};
+*/
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+class IMapWindow : public GraphCtrl, public DropTargetHelper
+{
+ NotifyInfo aInfo;
+ ImageMap aIMap;
+ TargetList aTargetList;
+ Link aInfoLink;
+ SfxItemPool* pIMapPool;
+ SfxItemInfo* pItemInfo;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
+ mxDocumentFrame;
+
+ DECL_LINK( MenuSelectHdl, Menu* );
+ DECL_LINK( MouseTimerHdl, Timer* );
+
+protected:
+
+ // GraphCtrl
+ virtual void MouseButtonUp(const MouseEvent& rMEvt);
+ virtual void Command(const CommandEvent& rCEvt);
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ virtual void SdrObjCreated( const SdrObject& rObj );
+ virtual void SdrObjChanged( const SdrObject& rObj );
+ virtual void MarkListHasChanged();
+ virtual void InitSdrModel();
+
+ // DropTargetHelper
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+
+ void CreateImageMap();
+ void ReplaceImageMap( const ImageMap& rNewImageMap, sal_Bool bScaleToGraphic );
+
+ void ClearTargetList();
+
+ SdrObject* CreateObj( const IMapObject* pIMapObj );
+ IMapObject* GetIMapObj( const SdrObject* pSdrObj ) const;
+ SdrObject* GetSdrObj( const IMapObject* pIMapObj ) const;
+ SdrObject* GetHitSdrObj( const Point& rPosPixel ) const;
+
+ void UpdateInfo( sal_Bool bNewObj );
+
+public:
+
+ IMapWindow( Window* pParent, const ResId& rResId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame );
+ ~IMapWindow();
+
+ sal_Bool ReplaceActualIMapInfo( const NotifyInfo& rNewInfo );
+
+ void SetImageMap( const ImageMap& rImageMap );
+ const ImageMap& GetImageMap();
+
+ void SetCurrentObjState( sal_Bool bActive );
+ void DoMacroAssign();
+ void DoPropertyDialog();
+
+ void SetInfoLink( const Link& rLink ) { aInfoLink = rLink; }
+ const Link& GetInfoLink() const { return aInfoLink; }
+
+ void SetTargetList( TargetList& rTargetList );
+ const TargetList& GetTargetList() const { return aTargetList; }
+
+ const NotifyInfo& GetInfo() const { return aInfo; }
+
+ void CreateDefaultObject();
+ void SelectFirstObject();
+ void StartPolyEdit();
+
+ virtual void KeyInput( const KeyEvent& rKEvt );
+};
+
+
+#endif
+
diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx
new file mode 100644
index 000000000000..cdc4cfc0b9b8
--- /dev/null
+++ b/svx/source/dialog/langbox.cxx
@@ -0,0 +1,526 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <com/sun/star/linguistic2/XLinguServiceManager.hdl>
+#include <com/sun/star/linguistic2/XAvailableLocales.hpp>
+#include <com/sun/star/i18n/ScriptType.hpp>
+#include <linguistic/misc.hxx>
+#include <rtl/ustring.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <tools/urlobj.hxx>
+#include <svtools/langtab.hxx>
+#include <tools/shl.hxx>
+#include <i18npool/mslangid.hxx>
+#include <i18npool/lang.h>
+#include <editeng/scripttypeitem.hxx>
+#include <editeng/unolingu.hxx>
+#include <svx/langbox.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::linguistic2;
+using namespace ::com::sun::star::uno;
+
+// -----------------------------------------------------------------------
+
+String GetDicInfoStr( const String& rName, const sal_uInt16 nLang, sal_Bool bNeg )
+{
+ INetURLObject aURLObj;
+ aURLObj.SetSmartProtocol( INET_PROT_FILE );
+ aURLObj.SetSmartURL( rName, INetURLObject::ENCODE_ALL );
+ String aTmp( aURLObj.GetBase() );
+ aTmp += sal_Unicode( ' ' );
+
+ if ( bNeg )
+ {
+ sal_Char const sTmp[] = " (-) ";
+ aTmp.AppendAscii( sTmp );
+ }
+
+ if ( LANGUAGE_NONE == nLang )
+ aTmp += String( ResId( RID_SVXSTR_LANGUAGE_ALL, DIALOG_MGR() ) );
+ else
+ {
+ aTmp += sal_Unicode( '[' );
+ aTmp += SvtLanguageTable::GetLanguageString( (LanguageType)nLang );
+ aTmp += sal_Unicode( ']' );
+ }
+
+ return aTmp;
+}
+
+//========================================================================
+// misc local helper functions
+//========================================================================
+
+static Sequence< sal_Int16 > lcl_LocaleSeqToLangSeq( Sequence< Locale > &rSeq )
+{
+ const Locale *pLocale = rSeq.getConstArray();
+ sal_Int32 nCount = rSeq.getLength();
+
+ Sequence< sal_Int16 > aLangs( nCount );
+ sal_Int16 *pLang = aLangs.getArray();
+ for (sal_Int32 i = 0; i < nCount; ++i)
+ {
+ pLang[i] = SvxLocaleToLanguage( pLocale[i] );
+
+ }
+
+ return aLangs;
+}
+
+
+static sal_Bool lcl_SeqHasLang( const Sequence< sal_Int16 > & rLangSeq, sal_Int16 nLang )
+{
+ sal_Int32 i = -1;
+ sal_Int32 nLen = rLangSeq.getLength();
+ if (nLen)
+ {
+ const sal_Int16 *pLang = rLangSeq.getConstArray();
+ for (i = 0; i < nLen; ++i)
+ {
+ if (nLang == pLang[i])
+ break;
+ }
+ }
+ return i >= 0 && i < nLen;
+}
+
+//========================================================================
+// class SvxLanguageBox
+//========================================================================
+
+sal_uInt16 TypeToPos_Impl( LanguageType eType, const ListBox& rLb )
+{
+ sal_uInt16 nPos = LISTBOX_ENTRY_NOTFOUND;
+ sal_uInt16 nCount = rLb.GetEntryCount();
+
+ for ( sal_uInt16 i=0; nPos == LISTBOX_ENTRY_NOTFOUND && i<nCount; i++ )
+ if ( eType == LanguageType((sal_uIntPtr)rLb.GetEntryData(i)) )
+ nPos = i;
+
+ return nPos;
+}
+
+//-----------------------------------------------------------------------
+SvxLanguageBox::SvxLanguageBox( Window* pParent, WinBits nWinStyle, sal_Bool bCheck ) :
+ ListBox( pParent, nWinStyle ),
+ m_pSpellUsedLang( NULL ),
+ m_bWithCheckmark( bCheck )
+{
+ Init();
+}
+//------------------------------------------------------------------------
+SvxLanguageBox::SvxLanguageBox( Window* pParent, const ResId& rResId, sal_Bool bCheck ) :
+ ListBox( pParent, rResId ),
+ m_pSpellUsedLang( NULL ),
+ m_bWithCheckmark( bCheck )
+{
+ Init();
+}
+//------------------------------------------------------------------------
+void SvxLanguageBox::Init()
+{
+ m_pLangTable = new SvtLanguageTable;
+ m_aNotCheckedImage = Image( SVX_RES( RID_SVXIMG_NOTCHECKED ) );
+ m_aCheckedImage = Image( SVX_RES( RID_SVXIMG_CHECKED ) );
+ m_aCheckedImageHC = Image( SVX_RES( RID_SVXIMG_CHECKED_H ) );
+ m_aAllString = String( SVX_RESSTR( RID_SVXSTR_LANGUAGE_ALL ) );
+ m_nLangList = LANG_LIST_EMPTY;
+ m_bHasLangNone = sal_False;
+ m_bLangNoneIsLangAll = sal_False;
+
+ // display entries sorted
+ SetStyle( GetStyle() | WB_SORT );
+
+ if ( m_bWithCheckmark )
+ {
+ SvtLanguageTable aLangTable;
+ sal_uInt32 nCount = aLangTable.GetEntryCount();
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
+ {
+ LanguageType nLangType = aLangTable.GetTypeAtIndex( i );
+
+ sal_Bool bInsert = sal_True;
+ if ((LANGUAGE_DONTKNOW == nLangType) ||
+ (LANGUAGE_SYSTEM == nLangType) ||
+ (LANGUAGE_USER1 <= nLangType && nLangType <= LANGUAGE_USER9))
+ {
+ bInsert = sal_False;
+ }
+
+ if ( bInsert )
+ InsertLanguage( nLangType );
+ }
+ m_nLangList = LANG_LIST_ALL;
+ }
+}
+//------------------------------------------------------------------------
+
+SvxLanguageBox::~SvxLanguageBox()
+{
+ delete m_pSpellUsedLang;
+ delete m_pLangTable;
+}
+
+//------------------------------------------------------------------------
+
+sal_uInt16 SvxLanguageBox::ImplInsertImgEntry( const String& rEntry, sal_uInt16 nPos, bool bChecked )
+{
+ sal_uInt16 nRet = 0;
+ if( !bChecked )
+ nRet = InsertEntry( rEntry, m_aNotCheckedImage, nPos );
+ else if( GetSettings().GetStyleSettings().GetHighContrastMode() )
+ nRet = InsertEntry( rEntry, m_aCheckedImageHC, nPos );
+ else
+ nRet = InsertEntry( rEntry, m_aCheckedImage, nPos );
+ return nRet;
+}
+
+//------------------------------------------------------------------------
+
+void SvxLanguageBox::SetLanguageList( sal_Int16 nLangList,
+ sal_Bool bHasLangNone, sal_Bool bLangNoneIsLangAll, sal_Bool bCheckSpellAvail )
+{
+ Clear();
+
+ m_nLangList = nLangList;
+ m_bHasLangNone = bHasLangNone;
+ m_bLangNoneIsLangAll = bLangNoneIsLangAll;
+ m_bWithCheckmark = bCheckSpellAvail;
+
+ if ( LANG_LIST_EMPTY != nLangList )
+ {
+ Sequence< sal_Int16 > aSpellAvailLang;
+ Sequence< sal_Int16 > aHyphAvailLang;
+ Sequence< sal_Int16 > aThesAvailLang;
+ Sequence< sal_Int16 > aSpellUsedLang;
+ Sequence< sal_Int16 > aHyphUsedLang;
+ Sequence< sal_Int16 > aThesUsedLang;
+ Reference< XAvailableLocales > xAvail( LinguMgr::GetLngSvcMgr(), UNO_QUERY );
+ if (xAvail.is())
+ {
+ Sequence< Locale > aTmp;
+
+ if (LANG_LIST_SPELL_AVAIL & nLangList)
+ {
+ aTmp = xAvail->getAvailableLocales( A2OU( SN_SPELLCHECKER ) );
+ aSpellAvailLang = lcl_LocaleSeqToLangSeq( aTmp );
+ }
+ if (LANG_LIST_HYPH_AVAIL & nLangList)
+ {
+ aTmp = xAvail->getAvailableLocales( A2OU( SN_HYPHENATOR ) );
+ aHyphAvailLang = lcl_LocaleSeqToLangSeq( aTmp );
+ }
+ if (LANG_LIST_THES_AVAIL & nLangList)
+ {
+ aTmp = xAvail->getAvailableLocales( A2OU( SN_THESAURUS ) );
+ aThesAvailLang = lcl_LocaleSeqToLangSeq( aTmp );
+ }
+ }
+ if (LANG_LIST_SPELL_USED & nLangList)
+ {
+ Reference< XSpellChecker1 > xTmp1( SvxGetSpellChecker(), UNO_QUERY );
+ if (xTmp1.is())
+ aSpellUsedLang = xTmp1->getLanguages();
+ }
+ if (LANG_LIST_HYPH_USED & nLangList)
+ {
+ Reference< XHyphenator > xTmp( SvxGetHyphenator() );
+ if (xTmp.is()) {
+ Sequence < Locale > aLocaleSequence( xTmp->getLocales() );
+ aHyphUsedLang = lcl_LocaleSeqToLangSeq( aLocaleSequence );
+ }
+ }
+ if (LANG_LIST_THES_USED & nLangList)
+ {
+ Reference< XThesaurus > xTmp( SvxGetThesaurus() );
+ if (xTmp.is()) {
+ Sequence < Locale > aLocaleSequence( xTmp->getLocales() );
+ aThesUsedLang = lcl_LocaleSeqToLangSeq( aLocaleSequence );
+ }
+ }
+
+ SvtLanguageTable aLangTable;
+ ::com::sun::star::uno::Sequence< sal_uInt16 > xKnown;
+ const sal_uInt16* pKnown;
+ sal_uInt32 nCount;
+ if ( nLangList & LANG_LIST_ONLY_KNOWN )
+ {
+ xKnown = LocaleDataWrapper::getInstalledLanguageTypes();
+ pKnown = xKnown.getConstArray();
+ nCount = xKnown.getLength();
+ }
+ else
+ {
+ nCount = aLangTable.GetEntryCount();
+ pKnown = NULL;
+ }
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
+ {
+ LanguageType nLangType;
+ if ( nLangList & LANG_LIST_ONLY_KNOWN )
+ nLangType = pKnown[i];
+ else
+ nLangType = aLangTable.GetTypeAtIndex( i );
+ if ( nLangType != LANGUAGE_DONTKNOW &&
+ nLangType != LANGUAGE_SYSTEM &&
+ nLangType != LANGUAGE_NONE &&
+ (nLangType < LANGUAGE_USER1 || nLangType > LANGUAGE_USER9) &&
+ (MsLangId::getSubLanguage( nLangType) != 0 ||
+ (nLangList & LANG_LIST_ALSO_PRIMARY_ONLY)) &&
+ ((nLangList & LANG_LIST_ALL) != 0 ||
+ ((nLangList & LANG_LIST_WESTERN) != 0 &&
+ (SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType) ==
+ SCRIPTTYPE_LATIN)) ||
+ ((nLangList & LANG_LIST_CTL) != 0 &&
+ (SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType) ==
+ SCRIPTTYPE_COMPLEX)) ||
+ ((nLangList & LANG_LIST_CJK) != 0 &&
+ (SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType) ==
+ SCRIPTTYPE_ASIAN)) ||
+ ((nLangList & LANG_LIST_FBD_CHARS) != 0 &&
+ MsLangId::hasForbiddenCharacters(nLangType)) ||
+ ((nLangList & LANG_LIST_SPELL_AVAIL) != 0 &&
+ lcl_SeqHasLang(aSpellAvailLang, nLangType)) ||
+ ((nLangList & LANG_LIST_HYPH_AVAIL) != 0 &&
+ lcl_SeqHasLang(aHyphAvailLang, nLangType)) ||
+ ((nLangList & LANG_LIST_THES_AVAIL) != 0 &&
+ lcl_SeqHasLang(aThesAvailLang, nLangType)) ||
+ ((nLangList & LANG_LIST_SPELL_USED) != 0 &&
+ lcl_SeqHasLang(aSpellUsedLang, nLangType)) ||
+ ((nLangList & LANG_LIST_HYPH_USED) != 0 &&
+ lcl_SeqHasLang(aHyphUsedLang, nLangType)) ||
+ ((nLangList & LANG_LIST_THES_USED) != 0 &&
+ lcl_SeqHasLang(aThesUsedLang, nLangType))) )
+ InsertLanguage( nLangType );
+ }
+
+ if (bHasLangNone)
+ InsertLanguage( LANGUAGE_NONE );
+ }
+}
+
+//------------------------------------------------------------------------
+
+sal_uInt16 SvxLanguageBox::InsertLanguage( const LanguageType nLangType, sal_uInt16 nPos )
+{
+ return ImplInsertLanguage( nLangType, nPos, ::com::sun::star::i18n::ScriptType::WEAK );
+}
+
+//------------------------------------------------------------------------
+
+sal_uInt16 SvxLanguageBox::ImplInsertLanguage( const LanguageType nLangType, sal_uInt16 nPos, sal_Int16 nType )
+{
+ LanguageType nLang = MsLangId::getReplacementForObsoleteLanguage( nLangType);
+ // For obsolete and to be replaced languages check whether an entry of the
+ // replacement already exists and if so don't add an entry with identical
+ // string as would be returned by SvtLanguageTable::GetString().
+ if (nLang != nLangType)
+ {
+ sal_uInt16 nAt = TypeToPos_Impl( nLang, *this );
+ if ( nAt != LISTBOX_ENTRY_NOTFOUND )
+ return nAt;
+ }
+
+ String aStrEntry = m_pLangTable->GetString( nLang );
+ if (LANGUAGE_NONE == nLang && m_bHasLangNone && m_bLangNoneIsLangAll)
+ aStrEntry = m_aAllString;
+
+ LanguageType nRealLang = nLang;
+ if (nRealLang == LANGUAGE_SYSTEM)
+ {
+ nRealLang = MsLangId::resolveSystemLanguageByScriptType(nRealLang, nType);
+ aStrEntry.AppendAscii(" - ");
+ aStrEntry.Append(m_pLangTable->GetString( nRealLang ));
+ }
+
+ aStrEntry = ApplyLreOrRleEmbedding( aStrEntry );
+
+ sal_uInt16 nAt = 0;
+ if ( m_bWithCheckmark )
+ {
+ sal_Bool bFound = sal_False;
+
+ if (!m_pSpellUsedLang)
+ {
+ Reference< XSpellChecker1 > xSpell( SvxGetSpellChecker(), UNO_QUERY );
+ if ( xSpell.is() )
+ m_pSpellUsedLang = new Sequence< sal_Int16 >( xSpell->getLanguages() );
+ }
+ bFound = m_pSpellUsedLang ?
+ lcl_SeqHasLang( *m_pSpellUsedLang, nRealLang ) : sal_False;
+
+ nAt = ImplInsertImgEntry( aStrEntry, nPos, bFound );
+ }
+ else
+ nAt = InsertEntry( aStrEntry, nPos );
+
+ SetEntryData( nAt, (void*)(sal_uIntPtr)nLangType );
+ return nAt;
+}
+
+//------------------------------------------------------------------------
+
+sal_uInt16 SvxLanguageBox::InsertDefaultLanguage( sal_Int16 nType, sal_uInt16 nPos )
+{
+ return ImplInsertLanguage( LANGUAGE_SYSTEM, nPos, nType );
+}
+
+//------------------------------------------------------------------------
+
+sal_uInt16 SvxLanguageBox::InsertLanguage( const LanguageType nLangType,
+ sal_Bool bCheckEntry, sal_uInt16 nPos )
+{
+ LanguageType nLang = MsLangId::getReplacementForObsoleteLanguage( nLangType);
+ // For obsolete and to be replaced languages check whether an entry of the
+ // replacement already exists and if so don't add an entry with identical
+ // string as would be returned by SvtLanguageTable::GetString().
+ if (nLang != nLangType)
+ {
+ sal_uInt16 nAt = TypeToPos_Impl( nLang, *this );
+ if ( nAt != LISTBOX_ENTRY_NOTFOUND )
+ return nAt;
+ }
+
+ String aStrEntry = m_pLangTable->GetString( nLang );
+ if (LANGUAGE_NONE == nLang && m_bHasLangNone && m_bLangNoneIsLangAll)
+ aStrEntry = m_aAllString;
+
+ sal_uInt16 nAt = ImplInsertImgEntry( aStrEntry, nPos, bCheckEntry );
+ SetEntryData( nAt, (void*)(sal_uIntPtr)nLang );
+
+ return nAt;
+}
+
+//------------------------------------------------------------------------
+
+void SvxLanguageBox::RemoveLanguage( const LanguageType eLangType )
+{
+ sal_uInt16 nAt = TypeToPos_Impl( eLangType, *this );
+
+ if ( nAt != LISTBOX_ENTRY_NOTFOUND )
+ RemoveEntry( nAt );
+}
+
+//------------------------------------------------------------------------
+
+LanguageType SvxLanguageBox::GetSelectLanguage() const
+{
+ sal_uInt16 nPos = GetSelectEntryPos();
+
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ return LanguageType( (sal_uIntPtr)GetEntryData(nPos) );
+ else
+ return LanguageType( LANGUAGE_DONTKNOW );
+}
+
+//------------------------------------------------------------------------
+
+void SvxLanguageBox::SelectLanguage( const LanguageType eLangType, sal_Bool bSelect )
+{
+ // If the core uses a LangID of an imported MS document and wants to select
+ // a language that is replaced, we need to select the replacement instead.
+ LanguageType nLang = MsLangId::getReplacementForObsoleteLanguage( eLangType);
+
+ sal_uInt16 nAt = TypeToPos_Impl( nLang, *this );
+
+ if ( nAt != LISTBOX_ENTRY_NOTFOUND )
+ SelectEntryPos( nAt, bSelect );
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool SvxLanguageBox::IsLanguageSelected( const LanguageType eLangType ) const
+{
+ // Same here, work on the replacement if applicable.
+ LanguageType nLang = MsLangId::getReplacementForObsoleteLanguage( eLangType);
+
+ sal_uInt16 nAt = TypeToPos_Impl( nLang, *this );
+
+ if ( nAt != LISTBOX_ENTRY_NOTFOUND )
+ return IsEntryPosSelected( nAt );
+ else
+ return sal_False;
+}
+
+#if ENABLE_LAYOUT
+
+namespace layout
+{
+
+SvxLanguageBox::~SvxLanguageBox ()
+{
+}
+
+SvxLanguageBox::SvxLanguageBox( Context* pParent, const char* pFile, sal_Bool bCheck )
+: ListBox ( pParent, pFile, bCheck )
+{
+}
+
+void SvxLanguageBox::SetLanguageList( sal_Int16/*list*/, bool/*hasLangNone*/, bool /*langNoneIsLangAll*/, bool /*checkSpellAvail*/)
+{
+}
+
+sal_uInt16 SvxLanguageBox::InsertLanguage( const LanguageType/*type*/, sal_uInt16/*pos*/)
+{
+ return 0;
+}
+sal_uInt16 SvxLanguageBox::InsertLanguage( const LanguageType/*type*/, bool/*checkEntry*/, sal_uInt16 /*pos*/)
+{
+ return 0;
+}
+void SvxLanguageBox::RemoveLanguage( const LanguageType/*type*/)
+{
+}
+void SvxLanguageBox::SelectLanguage( const LanguageType/*type*/, bool/*select*/)
+{
+}
+LanguageType SvxLanguageBox::GetSelectLanguage() const
+{
+ return 0;
+}
+bool SvxLanguageBox::IsLanguageSelected( const LanguageType/*type*/) const
+{
+ return true;
+}
+
+/*IMPL_IMPL (SvxLanguageBox, ListBox);
+IMPL_CONSTRUCTORS ( SvxLanguageBox, ListBox, "svxlanguagebox" );
+IMPL_GET_IMPL( SvxLanguageBox );
+IMPL_GET_WINDOW (SvxLanguageBox);*/
+};
+
+#endif
+
diff --git a/svx/source/dialog/langbox.src b/svx/source/dialog/langbox.src
new file mode 100644
index 000000000000..79bf1cf010c3
--- /dev/null
+++ b/svx/source/dialog/langbox.src
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// include ---------------------------------------------------------------
+
+#include <svx/dialogs.hrc>
+
+Image RID_SVXIMG_NOTCHECKED
+{
+ ImageBitmap = Bitmap { File = "notcheck.bmp" ; } ;
+ MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
+};
+Image RID_SVXIMG_CHECKED
+{
+ ImageBitmap = Bitmap { File = "lngcheck.bmp" ; } ;
+ MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
+};
+Image RID_SVXIMG_CHECKED_H
+{
+ ImageBitmap = Bitmap { File = "lngcheck_h.bmp" ; } ;
+ MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
+};
+
+// ********************************************************************** EOF
+
diff --git a/svx/source/dialog/language.src b/svx/source/dialog/language.src
new file mode 100644
index 000000000000..aa2bee89d742
--- /dev/null
+++ b/svx/source/dialog/language.src
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+ // include ---------------------------------------------------------------
+#include <svx/dialogs.hrc>
+ // pragma ----------------------------------------------------------------
+
+ // Language-Strings ------------------------------------------------------
+
+String RID_SVXSTR_LANGUAGE_ALL
+{
+ Text [ en-US ] = "[All]" ;
+};
+
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/dialog/measctrl.cxx b/svx/source/dialog/measctrl.cxx
new file mode 100644
index 000000000000..df93370dda8e
--- /dev/null
+++ b/svx/source/dialog/measctrl.cxx
@@ -0,0 +1,199 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <svx/svdomeas.hxx>
+#include <svx/svdmodel.hxx>
+
+#include "svx/measctrl.hxx"
+#include <svx/dialmgr.hxx>
+#include "svx/dlgutil.hxx"
+
+/*************************************************************************
+|*
+|* Ctor SvxXMeasurePreview
+|*
+*************************************************************************/
+
+SvxXMeasurePreview::SvxXMeasurePreview
+(
+ Window* pParent,
+ const ResId& rResId,
+ const SfxItemSet& rInAttrs
+) :
+
+ Control ( pParent, rResId ),
+ rAttrs ( rInAttrs )
+
+{
+ SetMapMode( MAP_100TH_MM );
+
+ Size aSize = GetOutputSize();
+
+ // Massstab: 1:2
+ MapMode aMapMode = GetMapMode();
+ aMapMode.SetScaleX( Fraction( 1, 2 ) );
+ aMapMode.SetScaleY( Fraction( 1, 2 ) );
+ SetMapMode( aMapMode );
+
+ aSize = GetOutputSize();
+ Rectangle aRect = Rectangle( Point(), aSize );
+ Point aPt1 = Point( aSize.Width() / 5, (long) ( aSize.Height() / 2 ) );
+ Point aPt2 = Point( aSize.Width() * 4 / 5, (long) ( aSize.Height() / 2 ) );
+
+ pMeasureObj = new SdrMeasureObj( aPt1, aPt2 );
+ pModel = new SdrModel();
+ pMeasureObj->SetModel( pModel );
+
+ //pMeasureObj->SetItemSetAndBroadcast(rInAttrs);
+ pMeasureObj->SetMergedItemSetAndBroadcast(rInAttrs);
+
+ SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR );
+
+ Invalidate();
+}
+
+/*************************************************************************
+|*
+|* Dtor SvxXMeasurePreview
+|*
+*************************************************************************/
+
+SvxXMeasurePreview::~SvxXMeasurePreview()
+{
+ // #111111#
+ // No one is deleting the MeasureObj? This is not only an error but also
+ // a memory leak (!). Main problem is that this object is still listening to
+ // a StyleSheet of the model which was set. Thus, if You want to keep the obnject,
+ // set the modfel to 0L, if object is not needed (seems to be the case here),
+ // delete it.
+ delete pMeasureObj;
+
+ delete pModel;
+}
+
+/*************************************************************************
+|*
+|* SvxXMeasurePreview: Paint()
+|*
+*************************************************************************/
+
+void SvxXMeasurePreview::Paint( const Rectangle& )
+{
+ pMeasureObj->SingleObjectPainter(*this); // #110094#-17
+}
+
+/*************************************************************************
+|*
+|* SvxXMeasurePreview: SetAttributes()
+|*
+*************************************************************************/
+
+void SvxXMeasurePreview::SetAttributes( const SfxItemSet& rInAttrs )
+{
+ //pMeasureObj->SetItemSetAndBroadcast(rInAttrs);
+ pMeasureObj->SetMergedItemSetAndBroadcast(rInAttrs);
+
+ Invalidate();
+}
+
+/*************************************************************************
+|*
+|* SvxXMeasurePreview: SetAttributes()
+|*
+*************************************************************************/
+
+void SvxXMeasurePreview::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ sal_Bool bZoomIn = rMEvt.IsLeft() && !rMEvt.IsShift();
+ sal_Bool bZoomOut = rMEvt.IsRight() || rMEvt.IsShift();
+ sal_Bool bCtrl = rMEvt.IsMod1();
+
+ if( bZoomIn || bZoomOut )
+ {
+ MapMode aMapMode = GetMapMode();
+ Fraction aXFrac = aMapMode.GetScaleX();
+ Fraction aYFrac = aMapMode.GetScaleY();
+ Fraction* pMultFrac;
+
+ if( bZoomIn )
+ {
+ if( bCtrl )
+ pMultFrac = new Fraction( 3, 2 );
+ else
+ pMultFrac = new Fraction( 11, 10 );
+ }
+ else
+ {
+ if( bCtrl )
+ pMultFrac = new Fraction( 2, 3 );
+ else
+ pMultFrac = new Fraction( 10, 11 );
+ }
+
+ aXFrac *= *pMultFrac;
+ aYFrac *= *pMultFrac;
+ if( (double)aXFrac > 0.001 && (double)aXFrac < 1000.0 &&
+ (double)aYFrac > 0.001 && (double)aYFrac < 1000.0 )
+ {
+ aMapMode.SetScaleX( aXFrac );
+ aMapMode.SetScaleY( aYFrac );
+ SetMapMode( aMapMode );
+
+ Size aOutSize( GetOutputSize() );
+
+ Point aPt( aMapMode.GetOrigin() );
+ long nX = (long)( ( (double)aOutSize.Width() - ( (double)aOutSize.Width() * (double)*pMultFrac ) ) / 2.0 + 0.5 );
+ long nY = (long)( ( (double)aOutSize.Height() - ( (double)aOutSize.Height() * (double)*pMultFrac ) ) / 2.0 + 0.5 );
+ aPt.X() += nX;
+ aPt.Y() += nY;
+
+ aMapMode.SetOrigin( aPt );
+ SetMapMode( aMapMode );
+
+ Invalidate();
+ }
+ delete pMultFrac;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxXMeasurePreview::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Control::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR );
+ }
+}
+
diff --git a/svx/source/dialog/optgrid.cxx b/svx/source/dialog/optgrid.cxx
new file mode 100644
index 000000000000..83d8206111f8
--- /dev/null
+++ b/svx/source/dialog/optgrid.cxx
@@ -0,0 +1,415 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/module.hxx>
+#include <svl/intitem.hxx>
+
+#define _SVX_OPTGRID_CXX
+
+#include <svx/svxids.hrc>
+#include <svx/dialmgr.hxx>
+#include "svx/optgrid.hxx"
+#include <svx/dialogs.hrc>
+#include "optgrid.hrc"
+#include "svx/dlgutil.hxx"
+
+/* -----------------18.08.98 17:41-------------------
+ * local functions
+ * --------------------------------------------------*/
+void lcl_GetMinMax(MetricField& rField, long& nFirst, long& nLast, long& nMin, long& nMax)
+{
+ nFirst = static_cast<long>(rField.Denormalize( rField.GetFirst( FUNIT_TWIP ) ));
+ nLast = static_cast<long>(rField.Denormalize( rField.GetLast( FUNIT_TWIP ) ));
+ nMin = static_cast<long>(rField.Denormalize( rField.GetMin( FUNIT_TWIP ) ));
+ nMax = static_cast<long>(rField.Denormalize( rField.GetMax( FUNIT_TWIP ) ));
+}
+
+void lcl_SetMinMax(MetricField& rField, long nFirst, long nLast, long nMin, long nMax)
+{
+ rField.SetFirst( rField.Normalize( nFirst ), FUNIT_TWIP );
+ rField.SetLast( rField.Normalize( nLast ), FUNIT_TWIP );
+ rField.SetMin( rField.Normalize( nMin ), FUNIT_TWIP );
+ rField.SetMax( rField.Normalize( nMax ), FUNIT_TWIP );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Rastereinstellungen Ctor
+ --------------------------------------------------------------------*/
+
+SvxOptionsGrid::SvxOptionsGrid() :
+ nFldDrawX ( 100 ),
+ nFldDivisionX ( 0 ),
+ nFldDrawY ( 100 ),
+ nFldDivisionY ( 0 ),
+ nFldSnapX ( 100 ),
+ nFldSnapY ( 100 ),
+ bUseGridsnap ( 0 ),
+ bSynchronize ( 1 ),
+ bGridVisible ( 0 ),
+ bEqualGrid ( 1 )
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Rastereinstellungen Dtor
+ --------------------------------------------------------------------*/
+
+SvxOptionsGrid::~SvxOptionsGrid()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Item fuer Rastereinstellungen
+ --------------------------------------------------------------------*/
+
+SvxGridItem::SvxGridItem( const SvxGridItem& rItem )
+: SvxOptionsGrid()
+, SfxPoolItem(rItem)
+{
+ bUseGridsnap = rItem.bUseGridsnap ;
+ bSynchronize = rItem.bSynchronize ;
+ bGridVisible = rItem.bGridVisible ;
+ bEqualGrid = rItem.bEqualGrid ;
+ nFldDrawX = rItem.nFldDrawX ;
+ nFldDivisionX= rItem.nFldDivisionX;
+ nFldDrawY = rItem.nFldDrawY ;
+ nFldDivisionY= rItem.nFldDivisionY;
+ nFldSnapX = rItem.nFldSnapX ;
+ nFldSnapY = rItem.nFldSnapY ;
+
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxPoolItem* SvxGridItem::Clone( SfxItemPool* ) const
+{
+ return new SvxGridItem( *this );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+int SvxGridItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unterschiedliche Typen" );
+
+ const SvxGridItem& rItem = (const SvxGridItem&) rAttr;
+
+ return ( bUseGridsnap == rItem.bUseGridsnap &&
+ bSynchronize == rItem.bSynchronize &&
+ bGridVisible == rItem.bGridVisible &&
+ bEqualGrid == rItem.bEqualGrid &&
+ nFldDrawX == rItem.nFldDrawX &&
+ nFldDivisionX== rItem.nFldDivisionX&&
+ nFldDrawY == rItem.nFldDrawY &&
+ nFldDivisionY== rItem.nFldDivisionY&&
+ nFldSnapX == rItem.nFldSnapX &&
+ nFldSnapY == rItem.nFldSnapY );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxItemPresentation SvxGridItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& rText, const IntlWrapper *
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText = String::CreateFromAscii("SvxGridItem");
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+
+/*----------------- OS 23.02.95 -----------------------
+ TabPage Rastereinstellungen
+-------------------------------------------------------*/
+
+SvxGridTabPage::SvxGridTabPage( Window* pParent, const SfxItemSet& rCoreSet) :
+
+ SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_GRID ), rCoreSet ),
+
+ aCbxUseGridsnap ( this, SVX_RES( CBX_USE_GRIDSNAP ) ),
+ aCbxGridVisible ( this, SVX_RES( CBX_GRID_VISIBLE ) ),
+
+ aFlResolution ( this, SVX_RES( FL_RESOLUTION ) ),
+ aFtDrawX ( this, SVX_RES( FT_DRAW_X ) ),
+ aMtrFldDrawX ( this, SVX_RES( MTR_FLD_DRAW_X ) ),
+ aFtDrawY ( this, SVX_RES( FT_DRAW_Y ) ),
+ aMtrFldDrawY ( this, SVX_RES( MTR_FLD_DRAW_Y ) ),
+
+ aFlDivision ( this, SVX_RES( FL_DIVISION ) ),
+ aFtDivisionX( this, SVX_RES( FT_DIVISION_X) ),
+ aNumFldDivisionX( this, SVX_RES( NUM_FLD_DIVISION_X ) ),
+ aDivisionPointX( this, SVX_RES( FT_HORZ_POINTS) ),
+
+ aFtDivisionY( this, SVX_RES( FT_DIVISION_Y) ),
+ aNumFldDivisionY( this, SVX_RES( NUM_FLD_DIVISION_Y ) ),
+ aDivisionPointY( this, SVX_RES( FT_VERT_POINTS) ),
+
+ aCbxSynchronize ( this, SVX_RES( CBX_SYNCHRONIZE ) ),
+ aGrpDrawGrid ( this, SVX_RES( GRP_DRAWGRID ) ),
+
+ aGrpSnap ( this, SVX_RES( GRP_SNAP ) ),
+ aCbxSnapHelplines ( this, SVX_RES( CBX_SNAP_HELPLINES ) ),
+ aCbxSnapBorder ( this, SVX_RES( CBX_SNAP_BORDER ) ),
+ aCbxSnapFrame ( this, SVX_RES( CBX_SNAP_FRAME ) ),
+ aCbxSnapPoints ( this, SVX_RES( CBX_SNAP_POINTS ) ),
+ aFtSnapArea ( this, SVX_RES( FT_SNAP_AREA ) ),
+ aMtrFldSnapArea ( this, SVX_RES( MTR_FLD_SNAP_AREA ) ),
+
+ aSeparatorFL ( this, SVX_RES( FL_SEPARATOR ) ),
+
+ aGrpOrtho ( this, SVX_RES( GRP_ORTHO ) ),
+ aCbxOrtho ( this, SVX_RES( CBX_ORTHO ) ),
+ aCbxBigOrtho ( this, SVX_RES( CBX_BIGORTHO ) ),
+ aCbxRotate ( this, SVX_RES( CBX_ROTATE ) ),
+ aMtrFldAngle ( this, SVX_RES( MTR_FLD_ANGLE ) ),
+ aFtBezAngle ( this, SVX_RES( FT_BEZ_ANGLE ) ),
+ aMtrFldBezAngle ( this, SVX_RES( MTR_FLD_BEZ_ANGLE ) ),
+
+ bAttrModified( sal_False )
+{
+ // diese Page braucht ExchangeSupport
+ SetExchangeSupport();
+
+ FreeResource();
+
+ aDivisionPointY.SetText(aDivisionPointX.GetText());
+ // Metrik einstellen
+ FieldUnit eFUnit = GetModuleFieldUnit( rCoreSet );
+ long nFirst, nLast, nMin, nMax;
+
+ lcl_GetMinMax(aMtrFldDrawX, nFirst, nLast, nMin, nMax);
+ SetFieldUnit( aMtrFldDrawX, eFUnit, sal_True );
+ lcl_SetMinMax(aMtrFldDrawX, nFirst, nLast, nMin, nMax);
+
+ lcl_GetMinMax(aMtrFldDrawY, nFirst, nLast, nMin, nMax);
+ SetFieldUnit( aMtrFldDrawY, eFUnit, sal_True );
+ lcl_SetMinMax(aMtrFldDrawY, nFirst, nLast, nMin, nMax);
+
+
+ aCbxRotate.SetClickHdl( LINK( this, SvxGridTabPage, ClickRotateHdl_Impl ) );
+ Link aLink = LINK( this, SvxGridTabPage, ChangeGridsnapHdl_Impl );
+ aCbxUseGridsnap.SetClickHdl( aLink );
+ aCbxSynchronize.SetClickHdl( aLink );
+ aCbxGridVisible.SetClickHdl( aLink );
+ aMtrFldDrawX.SetModifyHdl(
+ LINK( this, SvxGridTabPage, ChangeDrawHdl_Impl ) );
+ aMtrFldDrawY.SetModifyHdl(
+ LINK( this, SvxGridTabPage, ChangeDrawHdl_Impl ) );
+ aNumFldDivisionX.SetModifyHdl(
+ LINK( this, SvxGridTabPage, ChangeDivisionHdl_Impl ) );
+ aNumFldDivisionY.SetModifyHdl(
+ LINK( this, SvxGridTabPage, ChangeDivisionHdl_Impl ) );
+}
+
+//------------------------------------------------------------------------
+
+SfxTabPage* SvxGridTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return ( new SvxGridTabPage( pParent, rAttrSet ) );
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool SvxGridTabPage::FillItemSet( SfxItemSet& rCoreSet )
+{
+ if ( bAttrModified )
+ {
+ SvxGridItem aGridItem( SID_ATTR_GRID_OPTIONS );
+
+ aGridItem.bUseGridsnap = aCbxUseGridsnap.IsChecked();
+ aGridItem.bSynchronize = aCbxSynchronize.IsChecked();
+ aGridItem.bGridVisible = aCbxGridVisible.IsChecked();
+
+ SfxMapUnit eUnit =
+ rCoreSet.GetPool()->GetMetric( GetWhich( SID_ATTR_GRID_OPTIONS ) );
+ long nX =GetCoreValue( aMtrFldDrawX, eUnit );
+ long nY = GetCoreValue( aMtrFldDrawY, eUnit );
+
+ aGridItem.nFldDrawX = (sal_uInt32) nX;
+ aGridItem.nFldDrawY = (sal_uInt32) nY;
+ aGridItem.nFldDivisionX = static_cast<long>(aNumFldDivisionX.GetValue()-1);
+ aGridItem.nFldDivisionY = static_cast<long>(aNumFldDivisionY.GetValue()-1);
+
+ rCoreSet.Put( aGridItem );
+ }
+ return bAttrModified;
+}
+
+//------------------------------------------------------------------------
+
+void SvxGridTabPage::Reset( const SfxItemSet& rSet )
+{
+ const SfxPoolItem* pAttr = 0;
+
+ if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRID_OPTIONS , sal_False,
+ (const SfxPoolItem**)&pAttr ))
+ {
+ const SvxGridItem* pGridAttr = (SvxGridItem*)pAttr;
+ aCbxUseGridsnap.Check( pGridAttr->bUseGridsnap == 1 );
+ aCbxSynchronize.Check( pGridAttr->bSynchronize == 1 );
+ aCbxGridVisible.Check( pGridAttr->bGridVisible == 1 );
+
+ SfxMapUnit eUnit =
+ rSet.GetPool()->GetMetric( GetWhich( SID_ATTR_GRID_OPTIONS ) );
+ SetMetricValue( aMtrFldDrawX , pGridAttr->nFldDrawX, eUnit );
+ SetMetricValue( aMtrFldDrawY , pGridAttr->nFldDrawY, eUnit );
+
+ aNumFldDivisionX.SetValue( pGridAttr->nFldDivisionX+1 );
+ aNumFldDivisionY.SetValue( pGridAttr->nFldDivisionY+1 );
+ }
+
+ ChangeGridsnapHdl_Impl( &aCbxUseGridsnap );
+ bAttrModified = sal_False;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxGridTabPage::ActivatePage( const SfxItemSet& rSet )
+{
+ const SfxPoolItem* pAttr = NULL;
+ if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRID_OPTIONS , sal_False,
+ (const SfxPoolItem**)&pAttr ))
+ {
+ const SvxGridItem* pGridAttr = (SvxGridItem*) pAttr;
+ aCbxUseGridsnap.Check( pGridAttr->bUseGridsnap == 1 );
+
+ ChangeGridsnapHdl_Impl( &aCbxUseGridsnap );
+ }
+
+ // Metrik ggfs. aendern (da TabPage im Dialog liegt,
+ // wo die Metrik eingestellt werden kann
+ //sal_uInt16 nWhich = GetWhich( SID_ATTR_METRIC );
+ //if( rSet.GetItemState( GetWhich( SID_ATTR_METRIC ) ) >= SFX_ITEM_AVAILABLE )
+ if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_METRIC , sal_False,
+ (const SfxPoolItem**)&pAttr ))
+ {
+ const SfxUInt16Item* pItem = (SfxUInt16Item*) pAttr;
+
+ FieldUnit eFUnit = (FieldUnit)(long)pItem->GetValue();
+
+ if( eFUnit != aMtrFldDrawX.GetUnit() )
+ {
+ // Metriken einstellen
+ long nFirst, nLast, nMin, nMax;
+ long nVal = static_cast<long>(aMtrFldDrawX.Denormalize( aMtrFldDrawX.GetValue( FUNIT_TWIP ) ));
+
+ lcl_GetMinMax(aMtrFldDrawX, nFirst, nLast, nMin, nMax);
+ SetFieldUnit( aMtrFldDrawX, eFUnit, sal_True );
+ lcl_SetMinMax(aMtrFldDrawX, nFirst, nLast, nMin, nMax);
+
+ aMtrFldDrawX.SetValue( aMtrFldDrawX.Normalize( nVal ), FUNIT_TWIP );
+
+ nVal = static_cast<long>(aMtrFldDrawY.Denormalize( aMtrFldDrawY.GetValue( FUNIT_TWIP ) ));
+ lcl_GetMinMax(aMtrFldDrawY, nFirst, nLast, nMin, nMax);
+ SetFieldUnit( aMtrFldDrawY, eFUnit, sal_True );
+ lcl_SetMinMax(aMtrFldDrawY, nFirst, nLast, nMin, nMax);
+ aMtrFldDrawY.SetValue( aMtrFldDrawY.Normalize( nVal ), FUNIT_TWIP );
+
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+int SvxGridTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if ( _pSet )
+ FillItemSet( *_pSet );
+ return( LEAVE_PAGE );
+}
+//------------------------------------------------------------------------
+IMPL_LINK( SvxGridTabPage, ChangeDrawHdl_Impl, MetricField *, pField )
+{
+ bAttrModified = sal_True;
+ if( aCbxSynchronize.IsChecked() )
+ {
+ if(pField == &aMtrFldDrawX)
+ aMtrFldDrawY.SetValue( aMtrFldDrawX.GetValue() );
+ else
+ aMtrFldDrawX.SetValue( aMtrFldDrawY.GetValue() );
+ }
+ return 0;
+}
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxGridTabPage, ClickRotateHdl_Impl, void *, EMPTYARG )
+{
+ if( aCbxRotate.IsChecked() )
+ aMtrFldAngle.Enable();
+ else
+ aMtrFldAngle.Disable();
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxGridTabPage, ChangeDivisionHdl_Impl, NumericField *, pField )
+{
+ bAttrModified = sal_True;
+ if( aCbxSynchronize.IsChecked() )
+ {
+ if(&aNumFldDivisionX == pField)
+ aNumFldDivisionY.SetValue( aNumFldDivisionX.GetValue() );
+ else
+ aNumFldDivisionX.SetValue( aNumFldDivisionY.GetValue() );
+ }
+ return 0;
+}
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxGridTabPage, ChangeGridsnapHdl_Impl, void *, EMPTYARG )
+{
+ bAttrModified = sal_True;
+ return 0;
+}
+
+
diff --git a/svx/source/dialog/optgrid.hrc b/svx/source/dialog/optgrid.hrc
new file mode 100644
index 000000000000..ced9bee740ca
--- /dev/null
+++ b/svx/source/dialog/optgrid.hrc
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTGRID_HRC
+#define _SVX_OPTGRID_HRC
+
+//Grid-Page
+#define MTR_FLD_GRID 1
+#define GRP_DRAWGRID 2
+#define GRP_SNAPGRID 3
+#define CBX_USE_GRIDSNAP 4
+#define CBX_SYNCHRONIZE 5
+#define CBX_EQUAL_GRID 6
+#define CBX_SNAPGRID 7
+#define CBX_GRID_VISIBLE 8
+#define MTR_FLD_DRAW_Y 9
+#define MTR_FLD_SNAP_X 10
+#define MTR_FLD_SNAP_Y 11
+#define MTR_FLD_DRAW_X 12
+#define NUM_FLD_DIVISION_X 13
+#define NUM_FLD_DIVISION_Y 14
+#define FT_SNAP_X 15
+#define FT_SNAP_Y 16
+#define FT_DRAW_X 17
+#define FT_DRAW_Y 18
+#define FL_RESOLUTION 19
+#define FL_DIVISION 20
+#define FT_VERT_POINTS 21
+#define FT_HORZ_POINTS 22
+#define FT_DIVISION_Y 23
+#define FT_DIVISION_X 24
+#define CBX_SNAP_HELPLINES 25
+#define CBX_SNAP_BORDER 26
+#define CBX_SNAP_FRAME 27
+#define CBX_SNAP_POINTS 28
+#define FT_SNAP_AREA 29
+#define MTR_FLD_SNAP_AREA 30
+#define GRP_SNAP 31
+#define CBX_ORTHO 32
+#define CBX_BIGORTHO 33
+#define CBX_ROTATE 34
+#define MTR_FLD_ANGLE 35
+#define FT_BEZ_ANGLE 36
+#define MTR_FLD_BEZ_ANGLE 37
+#define GRP_ORTHO 38
+#define FL_SEPARATOR 39
+
+#endif
diff --git a/svx/source/dialog/optgrid.src b/svx/source/dialog/optgrid.src
new file mode 100644
index 000000000000..0d65c63f5d2f
--- /dev/null
+++ b/svx/source/dialog/optgrid.src
@@ -0,0 +1,372 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ---------------------------------------------------------------
+#include <sfx2/sfx.hrc>
+#include "helpid.hrc"
+#include <svx/dialogs.hrc>
+#include "optgrid.hrc"
+ // pragma ----------------------------------------------------------------
+
+TabPage RID_SVXPAGE_GRID
+{
+ HelpId = HID_OPTIONS_GRID ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedLine GRP_DRAWGRID
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Grid" ;
+ };
+ CheckBox CBX_USE_GRIDSNAP
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_GRID:CBX_USE_GRIDSNAP";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 204 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Sn~ap to grid" ;
+ };
+ CheckBox CBX_GRID_VISIBLE
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_GRID:CBX_GRID_VISIBLE";
+ Pos = MAP_APPFONT ( 12 , 27 ) ;
+ Size = MAP_APPFONT ( 204 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "V~isible grid" ;
+ };
+ FixedLine FL_RESOLUTION
+ {
+ Pos = MAP_APPFONT ( 6 , 45 ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "Resolution" ;
+ };
+ FixedText FT_DRAW_X
+ {
+ Pos = MAP_APPFONT ( 12 , 56 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "H~orizontal";
+ };
+ FixedText FT_DRAW_Y
+ {
+ Pos = MAP_APPFONT ( 12 , 71 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "~Vertical";
+ };
+ MetricField MTR_FLD_DRAW_X
+ {
+ HelpID = "svx:MetricField:RID_SVXPAGE_GRID:MTR_FLD_DRAW_X";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 75 , 54 ) ;
+ Size = MAP_APPFONT ( 45 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 10 ;
+ First = 10 ;
+ Maximum = 10000 ;
+ Last = 10000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ SpinSize = 50 ;
+ };
+ MetricField MTR_FLD_DRAW_Y
+ {
+ HelpID = "svx:MetricField:RID_SVXPAGE_GRID:MTR_FLD_DRAW_Y";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 75 , 69 ) ;
+ Size = MAP_APPFONT ( 45 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 10 ;
+ First = 10 ;
+ Maximum = 10000 ;
+ Last = 10000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ SpinSize = 50 ;
+ };
+ FixedLine FL_DIVISION
+ {
+ Pos = MAP_APPFONT ( 130 , 45 ) ;
+ Size = MAP_APPFONT ( 124 , 8 ) ;
+ Text [ en-US ] = "Subdivision" ;
+ };
+ FixedText FT_DIVISION_X
+ {
+ Pos = MAP_APPFONT ( 136 , 56 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "Horizont~al";
+ };
+ FixedText FT_DIVISION_Y
+ {
+ Pos = MAP_APPFONT ( 136 , 71 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "V~ertical";
+ };
+ NumericField NUM_FLD_DIVISION_X
+ {
+ HelpID = "svx:NumericField:RID_SVXPAGE_GRID:NUM_FLD_DIVISION_X";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 195 , 54 ) ;
+ Size = MAP_APPFONT ( 25 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 99 ;
+ Last = 99 ;
+ StrictFormat = TRUE ;
+ SpinSize = 1 ;
+ };
+ FixedText FT_HORZ_POINTS
+ {
+ Pos = MAP_APPFONT ( 223 , 56 ) ;
+ Size = MAP_APPFONT ( 29 , 8 ) ;
+ Text [ en-US ] = "space(s)" ;
+ };
+ NumericField NUM_FLD_DIVISION_Y
+ {
+ HelpID = "svx:NumericField:RID_SVXPAGE_GRID:NUM_FLD_DIVISION_Y";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 195 , 69 ) ;
+ Size = MAP_APPFONT ( 25 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 99 ;
+ Last = 99 ;
+ StrictFormat = TRUE ;
+ SpinSize = 1 ;
+ };
+ FixedText FT_VERT_POINTS
+ {
+ Pos = MAP_APPFONT ( 223 , 71 ) ;
+ Size = MAP_APPFONT ( 29 , 8 ) ;
+
+ };
+ CheckBox CBX_SYNCHRONIZE
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_GRID:CBX_SYNCHRONIZE";
+ Pos = MAP_APPFONT ( 12 , 84 ) ;
+ Size = MAP_APPFONT ( 127 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Synchronize a~xes" ;
+ };
+ FixedLine GRP_SNAP
+ {
+ Pos = MAP_APPFONT ( 6 , 100 ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Snap" ;
+ };
+
+ CheckBox CBX_SNAP_HELPLINES
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_GRID:CBX_SNAP_HELPLINES";
+ Pos = MAP_APPFONT ( 12 , 111 ) ;
+ Size = MAP_APPFONT ( 106 , 10 ) ;
+ Hide = TRUE;
+ TabStop = TRUE ;
+ Text [ en-US ] = "To snap lines" ;
+ };
+ CheckBox CBX_SNAP_BORDER
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_GRID:CBX_SNAP_BORDER";
+ Hide = TRUE;
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 125 ) ;
+ Size = MAP_APPFONT ( 106 , 10 ) ;
+ Text [ en-US ] = "To the ~page margins" ;
+ };
+ CheckBox CBX_SNAP_FRAME
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_GRID:CBX_SNAP_FRAME";
+ Pos = MAP_APPFONT ( 12 , 139 ) ;
+ Size = MAP_APPFONT ( 106 , 10 ) ;
+ Hide = TRUE;
+ TabStop = TRUE ;
+ Text [ en-US ] = "To object ~frame" ;
+ };
+ CheckBox CBX_SNAP_POINTS
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_GRID:CBX_SNAP_POINTS";
+ Pos = MAP_APPFONT ( 12 , 153 ) ;
+ Size = MAP_APPFONT ( 106 , 10 ) ;
+ Hide = TRUE;
+ TabStop = TRUE ;
+ Text [ en-US ] = "To obje~ct points" ;
+ };
+ FixedText FT_SNAP_AREA
+ {
+ Pos = MAP_APPFONT ( 12 , 169 ) ;
+ Size = MAP_APPFONT ( 69 , 10 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "~Snap range" ;
+ };
+ MetricField MTR_FLD_SNAP_AREA
+ {
+ HelpID = "svx:MetricField:RID_SVXPAGE_GRID:MTR_FLD_SNAP_AREA";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 83 , 167 ) ;
+ Size = MAP_APPFONT ( 35 , 12 ) ;
+ Hide = TRUE;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 50 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ First = 1 ;
+ Last = 999 ;
+ CustomUnitText [ en-US ] = " Pixels" ;
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 127 , 111 ) ;
+ Size = MAP_APPFONT ( 4 , 68 ) ;
+ Hide = TRUE;
+ Vert = TRUE;
+ };
+ FixedLine GRP_ORTHO
+ {
+ Pos = MAP_APPFONT ( 130 , 100 ) ;
+ Size = MAP_APPFONT ( 124 , 8 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Snap position" ;
+ };
+ CheckBox CBX_ORTHO
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_GRID:CBX_ORTHO";
+ Pos = MAP_APPFONT ( 136 , 111 ) ;
+ Size = MAP_APPFONT ( 112 , 10 ) ;
+ Hide = TRUE;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~When creating or moving objects" ;
+ };
+ CheckBox CBX_BIGORTHO
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_GRID:CBX_BIGORTHO";
+ Pos = MAP_APPFONT ( 136 , 125 ) ;
+ Size = MAP_APPFONT ( 112 , 10 ) ;
+ Hide = TRUE;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Extend edges" ;
+ };
+ CheckBox CBX_ROTATE
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_GRID:CBX_ROTATE";
+ Pos = MAP_APPFONT ( 136 , 139 ) ;
+ // 136, 111
+ Size = MAP_APPFONT ( 55 , 10 ) ;
+ Hide = TRUE;
+ TabStop = TRUE ;
+ Text [ en-US ] = "When ro~tating" ;
+ };
+ MetricField MTR_FLD_ANGLE
+ {
+ HelpID = "svx:MetricField:RID_SVXPAGE_GRID:MTR_FLD_ANGLE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 194 , 137 ) ;
+ // 190, 111
+ Size = MAP_APPFONT ( 54 , 12 ) ;
+ Hide = TRUE;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 18000 ;
+ Last = 18000 ;
+ DecimalDigits = 2 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ SpinSize = 500 ;
+ CustomUnitText [ en-US ] = " degrees" ;
+ };
+ FixedText FT_BEZ_ANGLE
+ {
+ Pos = MAP_APPFONT ( 136 , 156 ) ;
+ Size = MAP_APPFONT ( 55 , 10 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Point reducti~on" ;
+ };
+ MetricField MTR_FLD_BEZ_ANGLE
+ {
+ HelpID = "svx:MetricField:RID_SVXPAGE_GRID:MTR_FLD_BEZ_ANGLE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 194 , 154 ) ;
+ Size = MAP_APPFONT ( 54 , 12 ) ;
+ Hide = TRUE;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 9000 ;
+ Last = 9000 ;
+ DecimalDigits = 2 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ SpinSize = 500 ;
+ CustomUnitText [ en-US ] = " degrees" ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/dialog/orienthelper.cxx b/svx/source/dialog/orienthelper.cxx
new file mode 100644
index 000000000000..95b6e5b4ca08
--- /dev/null
+++ b/svx/source/dialog/orienthelper.cxx
@@ -0,0 +1,206 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "svx/orienthelper.hxx"
+
+#include <vector>
+#include <utility>
+
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include "svx/dialcontrol.hxx"
+
+namespace svx {
+
+// ============================================================================
+
+struct OrientationHelper_Impl
+{
+ typedef std::pair< Window*, TriState > WindowPair;
+ typedef std::vector< WindowPair > WindowVec;
+
+ DialControl& mrCtrlDial;
+ CheckBox& mrCbStacked;
+ WindowVec maWinVec;
+ bool mbEnabled;
+ bool mbVisible;
+
+ explicit OrientationHelper_Impl( DialControl& rCtrlDial, CheckBox& rCbStacked );
+
+ void AddDependentWindow( Window& rWindow, TriState eDisableIfStacked );
+
+ void EnableDependentWindows();
+ void EnableWindow( Window& rWindow, TriState eDisableIfStacked );
+
+ void ShowDependentWindows();
+
+ DECL_LINK( ClickHdl, void* );
+};
+
+// ----------------------------------------------------------------------------
+
+OrientationHelper_Impl::OrientationHelper_Impl( DialControl& rCtrlDial, CheckBox& rCbStacked ) :
+ mrCtrlDial( rCtrlDial ),
+ mrCbStacked( rCbStacked ),
+ mbEnabled( rCtrlDial.IsEnabled() ),
+ mbVisible( rCtrlDial.IsVisible() )
+{
+ maWinVec.push_back( WindowPair( &mrCtrlDial, STATE_CHECK ) );
+ maWinVec.push_back( WindowPair( &mrCbStacked, STATE_DONTKNOW ) );
+ mrCbStacked.SetClickHdl( LINK( this, OrientationHelper_Impl, ClickHdl ) );
+}
+
+void OrientationHelper_Impl::AddDependentWindow( Window& rWindow, TriState eDisableIfStacked )
+{
+ maWinVec.push_back( std::make_pair( &rWindow, eDisableIfStacked ) );
+ EnableWindow( rWindow, eDisableIfStacked );
+}
+
+void OrientationHelper_Impl::EnableDependentWindows()
+{
+ for( WindowVec::iterator aIt = maWinVec.begin(), aEnd = maWinVec.end(); aIt != aEnd; ++aIt )
+ EnableWindow( *aIt->first, aIt->second );
+}
+
+void OrientationHelper_Impl::EnableWindow( Window& rWindow, TriState eDisableIfStacked )
+{
+ bool bDisableOnStacked = false;
+ switch( eDisableIfStacked )
+ {
+ // STATE_CHECK: Disable window, if stacked text is turned on or "don't know".
+ case STATE_CHECK: bDisableOnStacked = (mrCbStacked.GetState() != STATE_NOCHECK); break;
+ // STATE_NOCHECK: Disable window, if stacked text is turned off or "don't know".
+ case STATE_NOCHECK: bDisableOnStacked = (mrCbStacked.GetState() != STATE_CHECK); break;
+ default: ;//prevent warning
+ }
+ rWindow.Enable( mbEnabled && !bDisableOnStacked );
+}
+
+void OrientationHelper_Impl::ShowDependentWindows()
+{
+ for( WindowVec::iterator aIt = maWinVec.begin(), aEnd = maWinVec.end(); aIt != aEnd; ++aIt )
+ aIt->first->Show( mbVisible );
+}
+
+IMPL_LINK( OrientationHelper_Impl, ClickHdl, void*, EMPTYARG )
+{
+ EnableDependentWindows();
+ return 0L;
+}
+
+// ============================================================================
+
+OrientationHelper::OrientationHelper( DialControl& rCtrlDial, CheckBox& rCbStacked ) :
+ mpImpl( new OrientationHelper_Impl( rCtrlDial, rCbStacked ) )
+{
+ mpImpl->EnableDependentWindows();
+ mpImpl->ShowDependentWindows();
+}
+
+OrientationHelper::OrientationHelper( DialControl& rCtrlDial, NumericField& rNfRotation, CheckBox& rCbStacked ) :
+ mpImpl( new OrientationHelper_Impl( rCtrlDial, rCbStacked ) )
+{
+ rCtrlDial.SetLinkedField( &rNfRotation );
+ mpImpl->EnableDependentWindows();
+ mpImpl->ShowDependentWindows();
+}
+
+OrientationHelper::~OrientationHelper()
+{
+}
+
+void OrientationHelper::AddDependentWindow( Window& rWindow, TriState eDisableIfStacked )
+{
+ mpImpl->AddDependentWindow( rWindow, eDisableIfStacked );
+}
+
+void OrientationHelper::Enable( bool bEnable )
+{
+ mpImpl->mbEnabled = bEnable;
+ mpImpl->EnableDependentWindows();
+}
+
+void OrientationHelper::Show( bool bShow )
+{
+ mpImpl->mbVisible = bShow;
+ mpImpl->ShowDependentWindows();
+}
+
+void OrientationHelper::SetStackedState( TriState eState )
+{
+ if( eState != GetStackedState() )
+ {
+ mpImpl->mrCbStacked.SetState( eState );
+ mpImpl->EnableDependentWindows();
+ }
+}
+
+TriState OrientationHelper::GetStackedState() const
+{
+ return mpImpl->mrCbStacked.GetState();
+}
+
+void OrientationHelper::EnableStackedTriState( bool bEnable )
+{
+ mpImpl->mrCbStacked.EnableTriState( bEnable );
+}
+
+// ============================================================================
+
+OrientStackedWrapper::OrientStackedWrapper( OrientationHelper& rOrientHlp ) :
+ SingleControlWrapperType( rOrientHlp )
+{
+}
+
+bool OrientStackedWrapper::IsControlDontKnow() const
+{
+ return GetControl().GetStackedState() == STATE_DONTKNOW;
+}
+
+void OrientStackedWrapper::SetControlDontKnow( bool bSet )
+{
+ GetControl().EnableStackedTriState( bSet );
+ GetControl().SetStackedState( bSet ? STATE_DONTKNOW : STATE_NOCHECK );
+}
+
+bool OrientStackedWrapper::GetControlValue() const
+{
+ return GetControl().GetStackedState() == STATE_CHECK;
+}
+
+void OrientStackedWrapper::SetControlValue( bool bValue )
+{
+ GetControl().SetStackedState( bValue ? STATE_CHECK : STATE_NOCHECK );
+}
+
+// ============================================================================
+
+} // namespace svx
+
diff --git a/svx/source/dialog/pagectrl.cxx b/svx/source/dialog/pagectrl.cxx
new file mode 100644
index 000000000000..e0c302da38df
--- /dev/null
+++ b/svx/source/dialog/pagectrl.cxx
@@ -0,0 +1,421 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+
+#include <vcl/bitmap.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <svx/pageitem.hxx>
+#include <svx/pagectrl.hxx>
+#include <editeng/boxitem.hxx>
+
+#include <algorithm>
+
+// struct PageWindow_Impl ------------------------------------------------
+
+struct PageWindow_Impl
+{
+ SvxBoxItem* pBorder;
+ Bitmap aBitmap;
+ FASTBOOL bBitmap;
+ sal_Bool bResetBackground;
+ sal_Bool bFrameDirection;
+ sal_Int32 nFrameDirection;
+
+
+ PageWindow_Impl() :
+ pBorder(0),
+ bBitmap(sal_False),
+ bResetBackground(sal_False),
+ bFrameDirection(sal_False),
+ nFrameDirection(0) {}
+
+ void EnableFrameDirection(sal_Bool bEnable){bFrameDirection = bEnable;}
+ void SetFrameDirection(sal_Int32 nDirection){nFrameDirection = nDirection;}
+
+};
+
+// STATIC DATA -----------------------------------------------------------
+
+#define CELL_WIDTH 1600L
+#define CELL_HEIGHT 800L
+
+// class SvxPageWindow ---------------------------------------------------
+
+SvxPageWindow::SvxPageWindow( Window* pParent, const ResId& rId ) :
+
+ Window( pParent, rId ),
+
+ nTop ( 0 ),
+ nBottom ( 0 ),
+ nLeft ( 0 ),
+ nRight ( 0 ),
+ aColor ( COL_TRANSPARENT ),
+ nHdLeft ( 0 ),
+ nHdRight ( 0 ),
+ nHdDist ( 0 ),
+ nHdHeight ( 0 ),
+ aHdColor ( COL_TRANSPARENT ),
+ pHdBorder ( 0 ),
+ nFtLeft ( 0 ),
+ nFtRight ( 0 ),
+ nFtDist ( 0 ),
+ nFtHeight ( 0 ),
+ aFtColor ( COL_TRANSPARENT ),
+ pFtBorder ( 0 ),
+ bFooter ( sal_False ),
+ bHeader ( sal_False ),
+ bTable ( sal_False ),
+ bHorz ( sal_False ),
+ bVert ( sal_False ),
+ eUsage ( SVX_PAGE_ALL )
+
+{
+ pImpl = new PageWindow_Impl;
+
+ // defaultmaessing in Twips rechnen
+ SetMapMode( MapMode( MAP_TWIP ) );
+ aWinSize = GetOutputSizePixel();
+ aWinSize.Height() -= 4;
+ aWinSize.Width() -= 4;
+
+ aWinSize = PixelToLogic( aWinSize );
+ SetBackground();
+}
+
+// -----------------------------------------------------------------------
+
+SvxPageWindow::~SvxPageWindow()
+{
+ delete pImpl;
+ delete pHdBorder;
+ delete pFtBorder;
+}
+
+// -----------------------------------------------------------------------
+
+void __EXPORT SvxPageWindow::Paint( const Rectangle& )
+{
+ Fraction aXScale( aWinSize.Width(), std::max( (long) (aSize.Width() * 2 + aSize.Width() / 8), 1L ) );
+ Fraction aYScale( aWinSize.Height(), std::max( aSize.Height(), 1L ) );
+ MapMode aMapMode( GetMapMode() );
+
+ if ( aYScale < aXScale )
+ {
+ aMapMode.SetScaleX( aYScale );
+ aMapMode.SetScaleY( aYScale );
+ }
+ else
+ {
+ aMapMode.SetScaleX( aXScale );
+ aMapMode.SetScaleY( aXScale );
+ }
+ SetMapMode( aMapMode );
+ Size aSz( PixelToLogic( GetSizePixel() ) );
+ long nYPos = ( aSz.Height() - aSize.Height() ) / 2;
+
+ if ( eUsage == SVX_PAGE_ALL )
+ {
+ // alle Seiten gleich -> eine Seite malen
+ if ( aSize.Width() > aSize.Height() )
+ {
+ // Querformat in gleicher Gr"osse zeichnen
+ Fraction aX = aMapMode.GetScaleX();
+ Fraction aY = aMapMode.GetScaleY();
+ Fraction a2( 1.5 );
+ aX *= a2;
+ aY *= a2;
+ aMapMode.SetScaleX( aX );
+ aMapMode.SetScaleY( aY );
+ SetMapMode( aMapMode );
+ aSz = PixelToLogic( GetSizePixel() );
+ nYPos = ( aSz.Height() - aSize.Height() ) / 2;
+ long nXPos = ( aSz.Width() - aSize.Width() ) / 2;
+ DrawPage( Point( nXPos, nYPos ), sal_True, sal_True );
+ }
+ else
+ // Hochformat
+ DrawPage( Point( ( aSz.Width() - aSize.Width() ) / 2, nYPos ), sal_True, sal_True );
+ }
+ else
+ {
+ // Linke und rechte Seite unterschiedlich -> ggf. zwei Seiten malen
+ DrawPage( Point( 0, nYPos ), sal_False, (sal_Bool)( eUsage & SVX_PAGE_LEFT ) );
+ DrawPage( Point( aSize.Width() + aSize.Width() / 8, nYPos ), sal_True,
+ (sal_Bool)( eUsage & SVX_PAGE_RIGHT ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+void SvxPageWindow::DrawPage( const Point& rOrg, const sal_Bool bSecond, const sal_Bool bEnabled )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ const Color& rFieldColor = rStyleSettings.GetFieldColor();
+ const Color& rFieldTextColor = rStyleSettings.GetFieldTextColor();
+ const Color& rDisableColor = rStyleSettings.GetDisableColor();
+ const Color& rDlgColor = rStyleSettings.GetDialogColor();
+
+ // background
+ if(!bSecond || pImpl->bResetBackground)
+ {
+ SetLineColor( Color(COL_TRANSPARENT) );
+ SetFillColor( rDlgColor );
+ Size winSize(GetOutputSize());
+ DrawRect( Rectangle( Point(0,0), winSize ) );
+
+ if ( pImpl->bResetBackground )
+ pImpl->bResetBackground = sal_False;
+ }
+ SetLineColor( rFieldTextColor );
+ // Schatten
+ Size aTempSize = aSize;
+ // Seite
+ if ( !bEnabled )
+ {
+ SetFillColor( rDisableColor );
+ DrawRect( Rectangle( rOrg, aTempSize ) );
+ return;
+ }
+ SetFillColor( rFieldColor );
+ DrawRect( Rectangle( rOrg, aTempSize ) );
+
+ // Border Top Bottom Left Right
+ Point aBegin( rOrg );
+ Point aEnd( rOrg );
+
+ long nL = nLeft;
+ long nR = nRight;
+
+ if ( eUsage == SVX_PAGE_MIRROR && !bSecond )
+ {
+ // f"ur gespiegelt drehen
+ nL = nRight;
+ nR = nLeft;
+ }
+
+ Rectangle aRect;
+
+ aRect.Left() = rOrg.X() + nL;
+ aRect.Right() = rOrg.X() + aTempSize.Width() - nR;
+ aRect.Top() = rOrg.Y() + nTop;
+ aRect.Bottom()= rOrg.Y() + aTempSize.Height() - nBottom;
+
+ Rectangle aHdRect( aRect );
+ Rectangle aFtRect( aRect );
+
+ if ( bHeader )
+ {
+ // ggf. Header anzeigen
+ aHdRect.Left() += nHdLeft;
+ aHdRect.Right() -= nHdRight;
+ aHdRect.Bottom() = aRect.Top() + nHdHeight;
+ aRect.Top() += nHdHeight + nHdDist;
+ SetFillColor( aHdColor );
+ DrawRect( aHdRect );
+ }
+
+ if ( bFooter )
+ {
+ // ggf. Footer anzeigen
+ aFtRect.Left() += nFtLeft;
+ aFtRect.Right() -= nFtRight;
+ aFtRect.Top() = aRect.Bottom() - nFtHeight;
+ aRect.Bottom() -= nFtHeight + nFtDist;
+ SetFillColor( aFtColor );
+ DrawRect( aFtRect );
+ }
+
+ // Body malen
+ SetFillColor( aColor );
+ if ( pImpl->bBitmap )
+ {
+ DrawRect( aRect );
+ Point aBmpPnt = aRect.TopLeft();
+ Size aBmpSiz = aRect.GetSize();
+ long nDeltaX = aBmpSiz.Width() / 15;
+ long nDeltaY = aBmpSiz.Height() / 15;
+ aBmpPnt.X() += nDeltaX;
+ aBmpPnt.Y() += nDeltaY;
+ aBmpSiz.Width() -= nDeltaX * 2;
+ aBmpSiz.Height() -= nDeltaY * 2;
+ DrawBitmap( aBmpPnt, aBmpSiz, pImpl->aBitmap );
+ }
+ else
+ DrawRect( aRect );
+
+ if(pImpl->bFrameDirection && !bTable)
+ {
+ //pImpl->nFrameDirection
+ Point aPos;
+ Font aFont(GetFont());
+ const Size aSaveSize = aFont.GetSize();
+ Size aDrawSize( 0, aRect.GetHeight() / 6);
+ aFont.SetSize(aDrawSize);
+ SetFont(aFont);
+ String sText(String::CreateFromAscii("ABC"));
+ Point aMove(1, GetTextHeight());
+ sal_Unicode cArrow = 0x2193;
+ long nAWidth = GetTextWidth(String(sText.GetChar(0)));
+ switch(pImpl->nFrameDirection)
+ {
+ case FRMDIR_HORI_LEFT_TOP:
+ aPos = aRect.TopLeft();
+ aPos.X() += PixelToLogic(Point(1,1)).X();
+ aMove.Y() = 0;
+ cArrow = 0x2192;
+ break;
+ case FRMDIR_HORI_RIGHT_TOP:
+ aPos = aRect.TopRight();
+ aPos.X() -= nAWidth;
+ aMove.Y() = 0;
+ aMove.X() *= -1;
+ cArrow = 0x2190;
+ break;
+ case FRMDIR_VERT_TOP_LEFT:
+ aPos = aRect.TopLeft();
+ aPos.X() += PixelToLogic(Point(1,1)).X();
+ aMove.X() = 0;
+ break;
+ case FRMDIR_VERT_TOP_RIGHT:
+ aPos = aRect.TopRight();
+ aPos.X() -= nAWidth;
+ aMove.X() = 0;
+ break;
+ }
+ sText.Append(cArrow);
+ for(sal_uInt16 i = 0; i < sText.Len(); i++)
+ {
+ String sDraw(sText.GetChar(i));
+ long nHDiff = 0;
+ long nCharWidth = GetTextWidth(sDraw);
+ sal_Bool bHorizontal = 0 == aMove.Y();
+ if(!bHorizontal)
+ {
+ nHDiff = (nAWidth - nCharWidth)/2;
+ aPos.X() += nHDiff;
+ }
+ DrawText(aPos, sDraw);
+ if(bHorizontal)
+ {
+ aPos.X() += aMove.X() < 0 ? - nCharWidth : nCharWidth;
+ }
+ else
+ {
+ aPos.X() -= nHDiff;
+ aPos.Y() += aMove.Y();
+ }
+ }
+ aFont.SetSize(aSaveSize);
+ SetFont(aFont);
+
+ }
+ if ( bTable )
+ {
+ // Tabelle malen, ggf. zentrieren
+ SetLineColor( Color(COL_LIGHTGRAY) );
+
+ long nW = aRect.GetWidth(), nH = aRect.GetHeight();
+ long nTW = CELL_WIDTH * 3, nTH = CELL_HEIGHT * 3;
+ long _nLeft = bHorz ? aRect.Left() + ((nW - nTW) / 2) : aRect.Left();
+ long _nTop = bVert ? aRect.Top() + ((nH - nTH) / 2) : aRect.Top();
+ Rectangle aCellRect( Point( _nLeft, _nTop ), Size( CELL_WIDTH, CELL_HEIGHT ) );
+
+ for ( sal_uInt16 i = 0; i < 3; ++i )
+ {
+ aCellRect.Left() = _nLeft;
+ aCellRect.Right() = _nLeft + CELL_WIDTH;
+ if ( i > 0 )
+ aCellRect.Move( 0, CELL_HEIGHT );
+
+ for ( sal_uInt16 j = 0; j < 3; ++j )
+ {
+ if ( j > 0 )
+ aCellRect.Move( CELL_WIDTH, 0 );
+ DrawRect( aCellRect );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPageWindow::SetBorder( const SvxBoxItem& rNew )
+{
+ delete pImpl->pBorder;
+ pImpl->pBorder = new SvxBoxItem( rNew );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPageWindow::SetBitmap( Bitmap* pBmp )
+{
+ if ( pBmp )
+ {
+ pImpl->aBitmap = *pBmp;
+ pImpl->bBitmap = sal_True;
+ }
+ else
+ pImpl->bBitmap = sal_False;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPageWindow::SetHdBorder( const SvxBoxItem& rNew )
+{
+ delete pHdBorder;
+ pHdBorder = new SvxBoxItem( rNew );
+}
+// -----------------------------------------------------------------------
+
+void SvxPageWindow::SetFtBorder( const SvxBoxItem& rNew )
+{
+ delete pFtBorder;
+ pFtBorder = new SvxBoxItem( rNew );
+}
+/* -----------------------------13.06.2002 16:16------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxPageWindow::EnableFrameDirection(sal_Bool bEnable)
+{
+ pImpl->EnableFrameDirection(bEnable);
+}
+/* -----------------------------13.06.2002 16:16------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxPageWindow::SetFrameDirection(sal_Int32 nFrameDirection)
+{
+ pImpl->SetFrameDirection(nFrameDirection);
+}
+
+void SvxPageWindow::ResetBackground()
+{
+ pImpl->bResetBackground = sal_True;
+}
diff --git a/svx/source/dialog/paraprev.cxx b/svx/source/dialog/paraprev.cxx
new file mode 100644
index 000000000000..2e9283b1c15d
--- /dev/null
+++ b/svx/source/dialog/paraprev.cxx
@@ -0,0 +1,238 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <svx/paraprev.hxx>
+
+// STATIC DATA -----------------------------------------------------------
+
+#define FOUR_POINTS 80
+
+// class SvxParaPrevWindow -----------------------------------------------
+
+SvxParaPrevWindow::SvxParaPrevWindow( Window* pParent, const ResId& rId ) :
+
+ Window( pParent, rId ),
+
+ nLeftMargin ( 0 ),
+ nRightMargin ( 0 ),
+ nFirstLineOfst ( 0 ),
+ nUpper ( 0 ),
+ nLower ( 0 ),
+ eAdjust ( SVX_ADJUST_LEFT ),
+ eLastLine ( SVX_ADJUST_LEFT ),
+ eLine ( SVX_PREV_LINESPACE_1 ),
+ nLineVal ( 0 )
+
+{
+ // defaultmaessing in Twips rechnen
+ SetMapMode( MapMode( MAP_TWIP ) );
+ aWinSize = GetOutputSizePixel();
+ aWinSize = PixelToLogic( aWinSize );
+ Size aTmp(1, 1);
+ aTmp = PixelToLogic(aTmp);
+ aWinSize.Width() -= aTmp.Width() /2;
+ aWinSize.Height() -= aTmp.Height() /2;
+
+ aSize = Size( 11905, 16837 );
+
+ SetBorderStyle( WINDOW_BORDER_MONO );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxParaPrevWindow::Paint( const Rectangle& )
+{
+ DrawParagraph( sal_True );
+}
+
+// -----------------------------------------------------------------------
+
+#define DEF_MARGIN 120
+
+void SvxParaPrevWindow::DrawParagraph( sal_Bool bAll )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ const Color& rWinColor = rStyleSettings.GetWindowColor();
+ Color aGrayColor(COL_LIGHTGRAY);
+
+ SetFillColor( Color( rWinColor ) );
+ if( bAll )
+ DrawRect( Rectangle( Point(), aWinSize ) );
+
+ SetLineColor();
+
+ long nH = aWinSize.Height() / 19;
+ Size aLineSiz( aWinSize.Width() - DEF_MARGIN, nH ),
+ aSiz = aLineSiz;
+ Point aPnt;
+ aPnt.X() = DEF_MARGIN / 2;
+ SetFillColor( aGrayColor );
+
+ for ( sal_uInt16 i = 0; i < 9; ++i )
+ {
+ if ( 3 == i )
+ {
+ SetFillColor( Color( COL_GRAY ) );
+ long nTop = nUpper * aLineSiz.Height() / aSize.Height();
+ aPnt.Y() += nTop * 2;
+ }
+
+ if ( 6 == i )
+ SetFillColor( aGrayColor );
+
+ if ( 3 <= i && 6 > i )
+ {
+ long nLeft = nLeftMargin * aLineSiz.Width() / aSize.Width();
+ long nFirst = nFirstLineOfst * aLineSiz.Width() / aSize.Width();
+ long nTmp = nLeft + nFirst;
+
+ if ( 3 == i )
+ {
+ aPnt.X() += nTmp;
+ aSiz.Width() -= nTmp;
+ }
+ else
+ {
+ aPnt.X() += nLeft;
+ aSiz.Width() -= nLeft;
+ }
+ long nRight = nRightMargin * aLineSiz.Width() / aSize.Width();
+ aSiz.Width() -= nRight;
+ }
+
+ if ( 4 == i || 5 == i || 6 == i )
+ {
+ switch ( eLine )
+ {
+ case SVX_PREV_LINESPACE_1: break;
+ case SVX_PREV_LINESPACE_15: aPnt.Y() += nH / 2; break;
+ case SVX_PREV_LINESPACE_2: aPnt.Y() += nH; break;
+
+ case SVX_PREV_LINESPACE_PROP:
+ case SVX_PREV_LINESPACE_MIN:
+ case SVX_PREV_LINESPACE_DURCH: break;
+ }
+ }
+
+ aPnt.Y() += nH;
+
+ if ( (3 <= i) && (5 >= i) )
+ {
+ long nLW;
+ switch( i )
+ {
+ default:
+ case 3: nLW = aLineSiz.Width() * 8 / 10; break;
+ case 4: nLW = aLineSiz.Width() * 9 / 10; break;
+ case 5: nLW = aLineSiz.Width() / 2; break;
+ }
+
+ if ( nLW > aSiz.Width() )
+ nLW = aSiz.Width();
+
+ switch ( eAdjust )
+ {
+ case SVX_ADJUST_LEFT:
+ break;
+ case SVX_ADJUST_RIGHT:
+ aPnt.X() += ( aSiz.Width() - nLW );
+ break;
+ case SVX_ADJUST_CENTER:
+ aPnt.X() += ( aSiz.Width() - nLW ) / 2;
+ break;
+ default: ; //prevent warning
+ }
+ if( SVX_ADJUST_BLOCK == eAdjust )
+ {
+ if( 5 == i )
+ {
+ switch( eLastLine )
+ {
+ case SVX_ADJUST_LEFT:
+ break;
+ case SVX_ADJUST_RIGHT:
+ aPnt.X() += ( aSiz.Width() - nLW );
+ break;
+ case SVX_ADJUST_CENTER:
+ aPnt.X() += ( aSiz.Width() - nLW ) / 2;
+ break;
+ case SVX_ADJUST_BLOCK:
+ nLW = aSiz.Width();
+ break;
+ default: ; //prevent warning
+ }
+ }
+ else
+ nLW = aSiz.Width();
+ }
+ aSiz.Width() = nLW;
+ }
+
+ Rectangle aRect( aPnt, aSiz );
+
+ if ( Lines[i] != aRect || bAll )
+ {
+ if ( !bAll )
+ {
+ Color aFillCol = GetFillColor();
+ SetFillColor( rWinColor );
+ DrawRect( Lines[i] );
+ SetFillColor( aFillCol );
+ }
+ DrawRect( aRect );
+ Lines[i] = aRect;
+ }
+
+ if ( 5 == i )
+ {
+ long nBottom = nLower * aLineSiz.Height() / aSize.Height();
+ aPnt.Y() += nBottom * 2;
+ }
+
+ aPnt.Y() += nH;
+ // wieder zuruecksetzen, fuer jede Linie neu berechnen
+ aPnt.X() = DEF_MARGIN / 2;
+ aSiz = aLineSiz;
+ }
+}
+
+#undef DEF_MARGIN
+
+// -----------------------------------------------------------------------
+
+void SvxParaPrevWindow::OutputSizeChanged()
+{
+ aWinSize = GetOutputSizePixel();
+ aWinSize = PixelToLogic( aWinSize );
+ Invalidate();
+}
+
diff --git a/svx/source/dialog/passwd.cxx b/svx/source/dialog/passwd.cxx
new file mode 100644
index 000000000000..2a107d9e23af
--- /dev/null
+++ b/svx/source/dialog/passwd.cxx
@@ -0,0 +1,136 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+
+#define _SVX_PASSWD_CXX
+
+#include "svx/passwd.hxx"
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+#include "passwd.hrc"
+
+// class SvxPasswordDialog -----------------------------------------------
+
+IMPL_LINK( SvxPasswordDialog, ButtonHdl, OKButton *, EMPTYARG )
+{
+ sal_Bool bOK = sal_True;
+ short nRet = RET_OK;
+ String aEmpty;
+
+ if ( aNewPasswdED.GetText() != aRepeatPasswdED.GetText() )
+ {
+ ErrorBox( this, WB_OK, aRepeatPasswdErrStr ).Execute();
+ aNewPasswdED.SetText( aEmpty );
+ aRepeatPasswdED.SetText( aEmpty );
+ aNewPasswdED.GrabFocus();
+ bOK = sal_False;
+ }
+
+ if ( bOK && aCheckPasswordHdl.IsSet() && !aCheckPasswordHdl.Call( this ) )
+ {
+ ErrorBox( this, WB_OK, aOldPasswdErrStr ).Execute();
+ aOldPasswdED.SetText( aEmpty );
+ aOldPasswdED.GrabFocus();
+ bOK = sal_False;
+ }
+
+ if ( bOK )
+ EndDialog( nRet );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxPasswordDialog, EditModifyHdl, Edit *, EMPTYARG )
+{
+ if ( !bEmpty )
+ {
+ String aPasswd = aRepeatPasswdED.GetText();
+ aPasswd.EraseLeadingChars().EraseTrailingChars();
+
+ if ( !aPasswd.Len() && aOKBtn.IsEnabled() )
+ aOKBtn.Disable();
+ else if ( aPasswd.Len() && !aOKBtn.IsEnabled() )
+ aOKBtn.Enable();
+ }
+ else if ( !aOKBtn.IsEnabled() )
+ aOKBtn.Enable();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+SvxPasswordDialog::SvxPasswordDialog( Window* pParent, sal_Bool bAllowEmptyPasswords, sal_Bool bDisableOldPassword ) :
+ SfxModalDialog( pParent, SVX_RES( RID_SVXDLG_PASSWORD ) ),
+ aOldFL ( this, SVX_RES( FL_OLD_PASSWD ) ),
+ aOldPasswdFT ( this, SVX_RES( FT_OLD_PASSWD ) ),
+ aOldPasswdED ( this, SVX_RES( ED_OLD_PASSWD ) ),
+ aNewFL ( this, SVX_RES( FL_NEW_PASSWD ) ),
+ aNewPasswdFT ( this, SVX_RES( FT_NEW_PASSWD ) ),
+ aNewPasswdED ( this, SVX_RES( ED_NEW_PASSWD ) ),
+ aRepeatPasswdFT ( this, SVX_RES( FT_REPEAT_PASSWD ) ),
+ aRepeatPasswdED ( this, SVX_RES( ED_REPEAT_PASSWD ) ),
+ aOKBtn ( this, SVX_RES( BTN_PASSWD_OK ) ),
+ aEscBtn ( this, SVX_RES( BTN_PASSWD_ESC ) ),
+ aHelpBtn ( this, SVX_RES( BTN_PASSWD_HELP ) ),
+ aOldPasswdErrStr ( SVX_RES( STR_ERR_OLD_PASSWD ) ),
+ aRepeatPasswdErrStr ( SVX_RES( STR_ERR_REPEAT_PASSWD ) ),
+ bEmpty ( bAllowEmptyPasswords )
+{
+ FreeResource();
+
+ aOKBtn.SetClickHdl( LINK( this, SvxPasswordDialog, ButtonHdl ) );
+ aRepeatPasswdED.SetModifyHdl( LINK( this, SvxPasswordDialog, EditModifyHdl ) );
+ EditModifyHdl( 0 );
+
+ if ( bDisableOldPassword )
+ {
+ aOldFL.Disable();
+ aOldPasswdFT.Disable();
+ aOldPasswdED.Disable();
+ aNewPasswdED.GrabFocus();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SvxPasswordDialog::~SvxPasswordDialog()
+{
+}
+
+// -----------------------------------------------------------------------
+
+
diff --git a/svx/source/dialog/passwd.hrc b/svx/source/dialog/passwd.hrc
new file mode 100644
index 000000000000..337990a952e6
--- /dev/null
+++ b/svx/source/dialog/passwd.hrc
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_PASSWD_HRC
+#define _SVX_PASSWD_HRC
+
+// defines ------------------------------------------------------------------
+
+#define FT_OLD_PASSWD 10
+#define ED_OLD_PASSWD 11
+#define FL_OLD_PASSWD 12
+
+#define FT_NEW_PASSWD 20
+#define ED_NEW_PASSWD 21
+#define FT_REPEAT_PASSWD 22
+#define ED_REPEAT_PASSWD 23
+#define FL_NEW_PASSWD 24
+
+#define BTN_PASSWD_OK 30
+#define BTN_PASSWD_ESC 31
+#define BTN_PASSWD_HELP 32
+
+#define STR_ERR_OLD_PASSWD 40
+#define STR_ERR_REPEAT_PASSWD 41
+
+
+#endif
+
diff --git a/svx/source/dialog/passwd.src b/svx/source/dialog/passwd.src
new file mode 100644
index 000000000000..821ede7c9357
--- /dev/null
+++ b/svx/source/dialog/passwd.src
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ---------------------------------------------------------------
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+#include "passwd.hrc"
+ // pragma ----------------------------------------------------------------
+
+ // RID_SVXDLG_PASSWORD ---------------------------------------------------
+ModalDialog RID_SVXDLG_PASSWORD
+{
+ HelpId = HID_PASSWORD ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 210 , 77 ) ;
+ Moveable = TRUE ;
+ FixedText FT_OLD_PASSWD
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 57 , 8 ) ;
+ Text [ en-US ] = "~Password" ;
+ };
+ Edit ED_OLD_PASSWD
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_PASSWORD:ED_OLD_PASSWD";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 71 , 14 ) ;
+ Size = MAP_APPFONT ( 71 , 12 ) ;
+ PassWord = TRUE ;
+ };
+ FixedLine FL_OLD_PASSWD
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 142 , 8 ) ;
+ Text [ en-US ] = "Old password" ;
+ };
+ FixedText FT_NEW_PASSWD
+ {
+ Pos = MAP_APPFONT ( 12 , 45 ) ;
+ Size = MAP_APPFONT ( 57 , 8 ) ;
+ Text [ en-US ] = "Pa~ssword" ;
+ };
+ Edit ED_NEW_PASSWD
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_PASSWORD:ED_NEW_PASSWD";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 71 , 43 ) ;
+ Size = MAP_APPFONT ( 71 , 12 ) ;
+ PassWord = TRUE ;
+ };
+ FixedText FT_REPEAT_PASSWD
+ {
+ Pos = MAP_APPFONT ( 12 , 61 ) ;
+ Size = MAP_APPFONT ( 57 , 8 ) ;
+ Text [ en-US ] = "Confi~rm";
+ };
+ Edit ED_REPEAT_PASSWD
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_PASSWORD:ED_REPEAT_PASSWD";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 71 , 59 ) ;
+ Size = MAP_APPFONT ( 71 , 12 ) ;
+ PassWord = TRUE ;
+ };
+ FixedLine FL_NEW_PASSWD
+ {
+ Pos = MAP_APPFONT ( 6 , 32 ) ;
+ Size = MAP_APPFONT ( 142 , 8 ) ;
+ Text [ en-US ] = "New password" ;
+ };
+ OKButton BTN_PASSWD_OK
+ {
+ Pos = MAP_APPFONT ( 154 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ Disable = TRUE ;
+ };
+ CancelButton BTN_PASSWD_ESC
+ {
+ Pos = MAP_APPFONT ( 154 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton BTN_PASSWD_HELP
+ {
+ Pos = MAP_APPFONT ( 154 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ String STR_ERR_OLD_PASSWD
+ {
+ Text [ en-US ] = "Invalid password" ;
+ };
+ String STR_ERR_REPEAT_PASSWD
+ {
+ Text [ en-US ] = "Passwords do not match" ;
+ };
+ Text [ en-US ] = "Change Password" ;
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/dialog/pfiledlg.cxx b/svx/source/dialog/pfiledlg.cxx
new file mode 100644
index 000000000000..2938988fac7e
--- /dev/null
+++ b/svx/source/dialog/pfiledlg.cxx
@@ -0,0 +1,280 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <sfx2/docfile.hxx>
+#include <com/sun/star/plugin/PluginDescription.hpp>
+#include <com/sun/star/plugin/XPluginManager.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+#include "svx/pfiledlg.hxx"
+#include <svx/dialogs.hrc>
+
+#include <svx/dialmgr.hxx>
+#include <list>
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+sal_Char __READONLY_DATA sAudio[] = "audio";
+sal_Char __READONLY_DATA sVideo[] = "video";
+
+/*************************************************************************
+|*
+|* Filedialog to insert Plugin-Fileformats
+|*
+\************************************************************************/
+
+ErrCode SvxPluginFileDlg::Execute()
+{
+ return maFileDlg.Execute();
+}
+
+String SvxPluginFileDlg::GetPath() const
+{
+ return maFileDlg.GetPath();
+}
+
+SvxPluginFileDlg::SvxPluginFileDlg (Window *, sal_uInt16 nKind ) :
+ maFileDlg(SFXWB_INSERT)
+{
+ // set title of the dialogwindow
+ switch (nKind)
+ {
+ case SID_INSERT_SOUND :
+ {
+ maFileDlg.SetTitle(SVX_RESSTR(STR_INSERT_SOUND_TITLE));
+ }
+ break;
+ case SID_INSERT_VIDEO :
+ {
+ maFileDlg.SetTitle(SVX_RESSTR(STR_INSERT_VIDEO_TITLE));
+ }
+ break;
+ }
+
+ // fill the filterlist of the filedialog with data of installed plugins
+ uno::Reference< lang::XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+
+ if( xMgr.is() )
+ {
+ uno::Reference< plugin::XPluginManager > rPluginManager( xMgr->createInstance(
+ OUString::createFromAscii( "com.sun.star.plugin.PluginManager" ) ), uno::UNO_QUERY );
+ if ( rPluginManager.is() )
+ {
+ const uno::Sequence<plugin::PluginDescription > aSeq( rPluginManager->getPluginDescriptions() );
+ const plugin::PluginDescription* pDescription = aSeq.getConstArray();
+ sal_Int32 nAnzahlPlugins = rPluginManager->getPluginDescriptions().getLength();
+
+ std::list< String > aPlugNames;
+ std::list< String > aPlugExtensions;
+ std::list< String >::iterator j;
+ std::list< String >::iterator k;
+ std::list< String >::const_iterator end;
+
+ for ( int i = 0; i < nAnzahlPlugins; i++ )
+ {
+ String aStrPlugMIMEType( pDescription[i].Mimetype );
+ String aStrPlugName( pDescription[i].Description );
+ String aStrPlugExtension( pDescription[i].Extension );
+
+ aStrPlugMIMEType.ToLowerAscii();
+ aStrPlugExtension.ToLowerAscii();
+
+ if ( ( nKind == SID_INSERT_SOUND && aStrPlugMIMEType.SearchAscii ( sAudio ) == 0 ) ||
+ ( nKind == SID_INSERT_VIDEO && aStrPlugMIMEType.SearchAscii ( sVideo ) == 0 ) )
+ {
+ // extension already in the filterlist of the filedlg ?
+ sal_Bool bAlreadyExist = sal_False;
+ for ( j = aPlugExtensions.begin(), end = aPlugExtensions.end(); j != end && !bAlreadyExist; ++j )
+ {
+ bAlreadyExist = (j->Search( aStrPlugExtension ) != STRING_NOTFOUND );
+ }
+
+ if ( !bAlreadyExist )
+ {
+ // filterdescription already there?
+ // (then append the new extension to the existing filter)
+ int nfound = -1;
+ for ( j = aPlugNames.begin(),
+ k = aPlugExtensions.begin(),
+ end = aPlugNames.end();
+ j != end && nfound != 0; )
+ {
+ if ( ( nfound = j->Search( aStrPlugName ) ) == 0 )
+ {
+ if ( aStrPlugExtension.Len() > 0 )
+ aStrPlugExtension.Insert( sal_Unicode( ';' ) );
+ aStrPlugExtension.Insert( *k );
+
+ // remove old entry, increment (iterators are invalid thereafter, thus the postincrement)
+ aPlugNames.erase(j++); aPlugExtensions.erase(k++);
+
+ // update end iterator (which may be invalid, too!)
+ end = aPlugNames.end();
+ }
+ else
+ {
+ // next element
+ ++j; ++k;
+ }
+ }
+
+ // build filterdescription
+ aStrPlugName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) );
+ aStrPlugName.Append( aStrPlugExtension );
+ aStrPlugName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ")" ) );
+
+ // use a own description for the video-formate avi, mov and mpeg
+ // the descriptions of these MIME-types are not very meaningful
+ const sal_Char sAVI[] = "*.avi";
+ const sal_Char sMOV[] = "*.mov";
+ const sal_Char sMPG[] = "*.mpg";
+ const sal_Char sMPE[] = "*.mpe";
+ const sal_Char sMPEG[] = "*.mpeg";
+
+ if ( aStrPlugExtension.EqualsIgnoreCaseAscii( sAVI ) )
+ aStrPlugName = SVX_RESSTR( STR_INSERT_VIDEO_EXTFILTER_AVI );
+ else if ( aStrPlugExtension.EqualsIgnoreCaseAscii( sMOV ) )
+ aStrPlugName = SVX_RESSTR( STR_INSERT_VIDEO_EXTFILTER_MOV );
+ else if ( aStrPlugExtension.SearchAscii( sMPG ) != STRING_NOTFOUND ||
+ aStrPlugExtension.SearchAscii( sMPE ) != STRING_NOTFOUND ||
+ aStrPlugExtension.SearchAscii( sMPEG ) != STRING_NOTFOUND )
+ aStrPlugName = SVX_RESSTR(STR_INSERT_VIDEO_EXTFILTER_MPEG);
+
+ aPlugNames.push_back( aStrPlugName );
+ aPlugExtensions.push_back( aStrPlugExtension );
+ }
+ }
+ }
+
+ // add filter to dialog
+ for ( j = aPlugNames.begin(),
+ k = aPlugExtensions.begin(),
+ end = aPlugNames.end();
+ j != end; ++j, ++k )
+ {
+ maFileDlg.AddFilter( *j, *k );
+ }
+ }
+ }
+
+ // add the All-Filter
+ String aAllFilter( ResId( STR_EXTFILTER_ALL, DIALOG_MGR() ) );
+ maFileDlg.AddFilter( aAllFilter, UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "*.*" ) ) );
+
+ // and activate him
+ maFileDlg.SetCurrentFilter( aAllFilter );
+}
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+SvxPluginFileDlg::~SvxPluginFileDlg()
+{
+}
+
+/*************************************************************************
+|*
+|* Plugins available for the the MIME-Typ in nKind
+|* (whith nKind = SID_INSERT_SOUND for MIME-Type audio
+|* SID_INSERT_VIDEO for MIME-Type video
+|*
+\************************************************************************/
+
+#define PFDLG_CHECKED_SOUND 0x0001
+#define PFDLG_CHECKED_VIDEO 0x0002
+#define PFDLG_FOUND_SOUND 0x0004
+#define PFDLG_FOUND_VIDEO 0x0008
+
+bool SvxPluginFileDlg::IsAvailable (sal_uInt16 nKind)
+{
+ static sal_uInt16 nCheck = 0;
+
+ if ( nKind == SID_INSERT_SOUND && ( nCheck & PFDLG_CHECKED_SOUND ) )
+ return (nCheck & PFDLG_FOUND_SOUND) != 0;
+ if ( nKind == SID_INSERT_VIDEO && ( nCheck & PFDLG_CHECKED_VIDEO ) )
+ return (nCheck & PFDLG_FOUND_VIDEO) != 0;
+
+ bool bFound = false;
+ uno::Reference< lang::XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+
+ if( xMgr.is() )
+ {
+ uno::Reference< plugin::XPluginManager > rPluginManager = uno::Reference< plugin::XPluginManager > ( xMgr->createInstance( OUString::createFromAscii( "com.sun.star.plugin.PluginManager" ) ), uno::UNO_QUERY );
+ if( rPluginManager.is() )
+ {
+ const uno::Sequence<plugin::PluginDescription > aSeq( rPluginManager->getPluginDescriptions() );
+ const plugin::PluginDescription* pDescription = aSeq.getConstArray();
+ sal_Int32 nAnzahlPlugins = rPluginManager->getPluginDescriptions().getLength();
+
+ for ( sal_uInt16 i = 0; i < nAnzahlPlugins && !bFound; ++i )
+ {
+ String aStrPlugMIMEType( pDescription[i].Mimetype );
+ switch (nKind)
+ {
+ case SID_INSERT_SOUND :
+ {
+ nCheck |= PFDLG_CHECKED_SOUND;
+
+ if( aStrPlugMIMEType.SearchAscii( sAudio ) == 0 )
+ {
+ bFound = true;
+ nCheck |= PFDLG_FOUND_SOUND;
+ }
+ }
+ break;
+ case SID_INSERT_VIDEO :
+ {
+ nCheck |= PFDLG_CHECKED_VIDEO;
+
+ if (aStrPlugMIMEType.SearchAscii( sVideo ) == 0)
+ {
+ bFound = true;
+ nCheck |= PFDLG_FOUND_VIDEO;
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ return bFound;
+}
+
+void SvxPluginFileDlg::SetContext( sfx2::FileDialogHelper::Context _eNewContext )
+{
+ maFileDlg.SetContext( _eNewContext );
+}
diff --git a/svx/source/dialog/prtqry.cxx b/svx/source/dialog/prtqry.cxx
new file mode 100644
index 000000000000..0a19d52958e3
--- /dev/null
+++ b/svx/source/dialog/prtqry.cxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#ifndef _SVX_DIALOGS_HRC
+#include <svx/dialogs.hrc>
+#endif
+#include <svx/prtqry.hxx>
+#include <svx/dialmgr.hxx>
+#include <tools/shl.hxx>
+
+/* -----------------------------01.02.00 13:57--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxPrtQryBox::SvxPrtQryBox(Window* pParent) :
+ MessBox(pParent, 0,
+ String(SVX_RES(RID_SVXSTR_QRY_PRINT_TITLE)),
+ String(SVX_RES(RID_SVXSTR_QRY_PRINT_MSG)))
+{
+ SetImage( QueryBox::GetStandardImage() );
+
+ AddButton(String(SVX_RES(RID_SVXSTR_QRY_PRINT_SELECTION)), RET_OK,
+ BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON);
+
+ AddButton(String(SVX_RES(RID_SVXSTR_QRY_PRINT_ALL)), 2, 0);
+ AddButton(BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON);
+ SetButtonHelpText( RET_OK, String() );
+}
+/* -----------------------------01.02.00 13:57--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxPrtQryBox::~SvxPrtQryBox()
+{
+}
+
+
diff --git a/svx/source/dialog/prtqry.src b/svx/source/dialog/prtqry.src
new file mode 100644
index 000000000000..9ae23f6a4a05
--- /dev/null
+++ b/svx/source/dialog/prtqry.src
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svx/dialogs.hrc>
+
+
+String RID_SVXSTR_QRY_PRINT_TITLE
+{
+ Text [ en-US ] = "Printing selection";
+};
+String RID_SVXSTR_QRY_PRINT_MSG
+{
+ Text [ en-US ] = "Do you want to print the selection or the entire document?";
+};
+String RID_SVXSTR_QRY_PRINT_ALL
+{
+ Text [ en-US ] = "~All";
+};
+String RID_SVXSTR_QRY_PRINT_SELECTION
+{
+ Text [ en-US ] = "~Selection";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/dialog/relfld.cxx b/svx/source/dialog/relfld.cxx
new file mode 100644
index 000000000000..2b94fde81edb
--- /dev/null
+++ b/svx/source/dialog/relfld.cxx
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <tools/ref.hxx>
+#include "svx/relfld.hxx"
+
+// -----------------------------------------------------------------------
+
+SvxRelativeField::SvxRelativeField( Window* pParent, WinBits nWinSize ) :
+ MetricField( pParent, nWinSize )
+{
+ bNegativeEnabled = sal_False;
+ bRelativeMode = sal_False;
+ bRelative = sal_False;
+
+ SetDecimalDigits( 2 );
+ SetMin( 0 );
+ SetMax( 9999 );
+}
+
+// -----------------------------------------------------------------------
+
+SvxRelativeField::SvxRelativeField( Window* pParent, const ResId& rResId ) :
+ MetricField( pParent, rResId )
+{
+ bNegativeEnabled = sal_False;
+ bRelativeMode = sal_False;
+ bRelative = sal_False;
+
+ SetDecimalDigits( 2 );
+ SetMin( 0 );
+ SetMax( 9999 );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxRelativeField::Modify()
+{
+ MetricField::Modify();
+
+ if ( bRelativeMode )
+ {
+ String aStr = GetText();
+ sal_Bool bNewMode = bRelative;
+
+ if ( bRelative )
+ {
+ const sal_Unicode* pStr = aStr.GetBuffer();
+
+ while ( *pStr )
+ {
+ if( ( ( *pStr < sal_Unicode( '0' ) ) || ( *pStr > sal_Unicode( '9' ) ) ) &&
+ ( *pStr != sal_Unicode( '%' ) ) )
+ {
+ bNewMode = sal_False;
+ break;
+ }
+ pStr++;
+ }
+ }
+ else
+ {
+ xub_StrLen nPos = aStr.Search( sal_Unicode( '%' ) );
+
+ if ( nPos != STRING_NOTFOUND )
+ bNewMode = sal_True;
+ }
+
+ if ( bNewMode != bRelative )
+ SetRelative( bNewMode );
+
+ MetricField::Modify();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxRelativeField::EnableRelativeMode( sal_uInt16 nMin,
+ sal_uInt16 nMax, sal_uInt16 nStep )
+{
+ bRelativeMode = sal_True;
+ nRelMin = nMin;
+ nRelMax = nMax;
+ nRelStep = nStep;
+ SetUnit( FUNIT_CM );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxRelativeField::SetRelative( sal_Bool bNewRelative )
+{
+ Selection aSelection = GetSelection();
+ String aStr = GetText();
+
+ if ( bNewRelative )
+ {
+ bRelative = sal_True;
+ SetDecimalDigits( 0 );
+ SetMin( nRelMin );
+ SetMax( nRelMax );
+ SetCustomUnitText( String( sal_Unicode( '%' ) ) );
+ SetUnit( FUNIT_CUSTOM );
+ }
+ else
+ {
+ bRelative = sal_False;
+ SetDecimalDigits( 2 );
+ SetMin( bNegativeEnabled ? -9999 : 0 );
+ SetMax( 9999 );
+ SetUnit( FUNIT_CM );
+ }
+
+ SetText( aStr );
+ SetSelection( aSelection );
+}
+
+
diff --git a/svx/source/dialog/rlrcitem.cxx b/svx/source/dialog/rlrcitem.cxx
new file mode 100644
index 000000000000..7e2cd0868cce
--- /dev/null
+++ b/svx/source/dialog/rlrcitem.cxx
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// INCLUDE ---------------------------------------------------------------
+#include <svl/rectitem.hxx>
+
+
+
+
+
+
+#include <svx/dialogs.hrc>
+
+#include <svx/ruler.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/tstpitem.hxx>
+#include "editeng/protitem.hxx"
+#include "rlrcitem.hxx"
+#include "svx/rulritem.hxx"
+#include <svl/eitem.hxx>
+
+// class SvxRulerItem ----------------------------------------------------
+
+SvxRulerItem::SvxRulerItem(sal_uInt16 _nId, SvxRuler &rRul, SfxBindings &rBindings)
+: SfxControllerItem(_nId, rBindings),
+ rRuler(rRul)
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SvxRulerItem::StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState)
+{
+ // SFX_ITEM_DONTCARE => pState == -1 => PTR_CAST buff
+ if ( eState != SFX_ITEM_AVAILABLE )
+ pState = 0;
+
+ switch(nSID)
+ {
+ // Linker / rechter Seitenrand
+ case SID_RULER_LR_MIN_MAX:
+ {
+ const SfxRectangleItem *pItem = PTR_CAST(SfxRectangleItem, pState);
+ rRuler.UpdateFrameMinMax(pItem);
+ break;
+ }
+ case SID_ATTR_LONG_LRSPACE:
+ {
+ const SvxLongLRSpaceItem *pItem = PTR_CAST(SvxLongLRSpaceItem, pState);
+ DBG_ASSERT(pState? 0 != pItem: sal_True, "SvxLRSpaceItem erwartet");
+ rRuler.UpdateFrame(pItem);
+ break;
+ }
+ case SID_ATTR_LONG_ULSPACE:
+ {
+ const SvxLongULSpaceItem *pItem = PTR_CAST(SvxLongULSpaceItem, pState);
+ DBG_ASSERT(pState? 0 != pItem: sal_True, "SvxULSpaceItem erwartet");
+ rRuler.UpdateFrame(pItem);
+ break;
+ }
+ case SID_ATTR_TABSTOP_VERTICAL:
+ case SID_ATTR_TABSTOP:
+ {
+ const SvxTabStopItem *pItem = PTR_CAST(SvxTabStopItem, pState);
+ DBG_ASSERT(pState? 0 != pItem: sal_True, "SvxTabStopItem erwartet");
+ rRuler.Update(pItem);
+ break;
+ }
+ case SID_ATTR_PARA_LRSPACE_VERTICAL:
+ case SID_ATTR_PARA_LRSPACE:
+ {
+ const SvxLRSpaceItem *pItem = PTR_CAST(SvxLRSpaceItem, pState);
+ DBG_ASSERT(pState? 0 != pItem: sal_True, "SvxLRSpaceItem erwartet");
+ rRuler.UpdatePara(pItem);
+ break;
+ }
+ case SID_RULER_BORDERS_VERTICAL:
+ case SID_RULER_BORDERS:
+ case SID_RULER_ROWS:
+ case SID_RULER_ROWS_VERTICAL:
+ {
+ const SvxColumnItem *pItem = PTR_CAST(SvxColumnItem, pState);
+ DBG_ASSERT(pState? 0 != pItem: sal_True, "SvxColumnItem erwartet");
+#ifdef DBG_UTIL
+ if(pItem)
+ {
+ if(pItem->IsConsistent())
+ rRuler.Update(pItem, nSID);
+ else
+ DBG_ERROR("Spaltenitem corrupted");
+ }
+ else
+ rRuler.Update(pItem, nSID);
+#else
+ rRuler.Update(pItem, nSID);
+#endif
+ break;
+ }
+ case SID_RULER_PAGE_POS:
+ { // Position Seite, Seitenbreite
+ const SvxPagePosSizeItem *pItem = PTR_CAST(SvxPagePosSizeItem, pState);
+ DBG_ASSERT(pState? 0 != pItem: sal_True, "SvxPagePosSizeItem erwartet");
+ rRuler.Update(pItem);
+ break;
+ }
+ case SID_RULER_OBJECT:
+ { // Object-Selektion
+ const SvxObjectItem *pItem = PTR_CAST(SvxObjectItem, pState);
+ DBG_ASSERT(pState? 0 != pItem: sal_True, "SvxObjectItem erwartet");
+ rRuler.Update(pItem);
+ break;
+ }
+ case SID_RULER_PROTECT:
+ {
+ const SvxProtectItem *pItem = PTR_CAST(SvxProtectItem, pState);
+ DBG_ASSERT(pState? 0 != pItem: sal_True, "SvxProtectItem erwartet");
+ rRuler.Update(pItem);
+ break;
+ }
+ case SID_RULER_BORDER_DISTANCE:
+ {
+ const SvxLRSpaceItem *pItem = PTR_CAST(SvxLRSpaceItem, pState);
+ DBG_ASSERT(pState? 0 != pItem: sal_True, "SvxLRSpaceItem erwartet");
+ rRuler.UpdateParaBorder(pItem);
+ }
+ break;
+ case SID_RULER_TEXT_RIGHT_TO_LEFT :
+ {
+ const SfxBoolItem *pItem = PTR_CAST(SfxBoolItem, pState);
+ DBG_ASSERT(pState? 0 != pItem: sal_True, "SfxBoolItem erwartet");
+ rRuler.UpdateTextRTL(pItem);
+ }
+ break;
+ }
+}
+
+
diff --git a/svx/source/dialog/rlrcitem.hxx b/svx/source/dialog/rlrcitem.hxx
new file mode 100644
index 000000000000..dccb5d97a2ec
--- /dev/null
+++ b/svx/source/dialog/rlrcitem.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_RLRCITEM_HXX
+#define _SVX_RLRCITEM_HXX
+
+#include <sfx2/ctrlitem.hxx>
+
+class SvxRuler;
+
+// class SvxRulerItem ----------------------------------------------------
+
+class SvxRulerItem : public SfxControllerItem
+{
+private:
+ SvxRuler& rRuler;
+
+protected:
+ virtual void StateChanged( sal_uInt16,
+ SfxItemState, const SfxPoolItem* pState );
+
+public:
+ SvxRulerItem( sal_uInt16 nId, SvxRuler&, SfxBindings& );
+};
+
+
+#endif
+
diff --git a/svx/source/dialog/rubydialog.cxx b/svx/source/dialog/rubydialog.cxx
new file mode 100644
index 000000000000..a85fc023eca5
--- /dev/null
+++ b/svx/source/dialog/rubydialog.cxx
@@ -0,0 +1,990 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/rubydialog.hxx>
+#include <tools/shl.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+#include <rubydialog.hrc>
+#include <sfx2/app.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svl/eitem.hxx>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/text/XRubySelection.hpp>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/text/RubyAdjust.hpp>
+#include <com/sun/star/view/XSelectionChangeListener.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#ifndef _CPPUHELPER_IMPLBASE3_HXX_
+#include <cppuhelper/implbase1.hxx>
+#endif
+#include <svtools/colorcfg.hxx>
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::frame;
+using namespace com::sun::star::text;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::style;
+using namespace com::sun::star::text;
+using namespace com::sun::star::view;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::container;
+using rtl::OUString;
+
+#define C2U(cChar) rtl::OUString::createFromAscii(cChar)
+
+SFX_IMPL_CHILDWINDOW( SvxRubyChildWindow, SID_RUBY_DIALOG );
+
+static const sal_Char cRubyBaseText[] = "RubyBaseText";
+static const sal_Char cRubyText[] = "RubyText";
+static const sal_Char cCharacterStyles[] = "CharacterStyles";
+static const sal_Char cRubyAdjust[] = "RubyAdjust";
+static const sal_Char cRubyIsAbove[] = "RubyIsAbove";
+static const sal_Char cDisplayName[] = "DisplayName";
+static const sal_Char cRubyCharStyleName[] = "RubyCharStyleName";
+static const sal_Char cRubies[] = "Rubies";
+/* -----------------------------09.01.01 17:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxRubyChildWindow::SvxRubyChildWindow( Window* _pParent, sal_uInt16 nId,
+ SfxBindings* pBindings, SfxChildWinInfo* pInfo) :
+ SfxChildWindow(_pParent, nId)
+{
+ pWindow = new SvxRubyDialog( pBindings, this, _pParent, SVX_RES( RID_SVXDLG_RUBY ) );
+ SvxRubyDialog* pDlg = (SvxRubyDialog*) pWindow;
+
+ if ( pInfo->nFlags & SFX_CHILDWIN_ZOOMIN )
+ pDlg->RollUp();
+
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+
+ pDlg->Initialize( pInfo );
+}
+/* -----------------------------10.01.01 13:53--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SfxChildWinInfo SvxRubyChildWindow::GetInfo() const
+{
+ return SfxChildWindow::GetInfo();
+}
+/* -----------------------------09.01.01 17:17--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SvxRubyData_Impl : public cppu::WeakImplHelper1
+ < ::com::sun::star::view::XSelectionChangeListener >
+{
+ Reference<XModel> xModel;
+ Reference<XRubySelection> xSelection;
+ Sequence<PropertyValues> aRubyValues;
+ Reference<XController> xController;
+ sal_Bool bHasSelectionChanged;
+ public:
+ SvxRubyData_Impl();
+ ~SvxRubyData_Impl();
+
+ void SetController(Reference<XController> xCtrl);
+ Reference<XModel> GetModel()
+ {
+ if(!xController.is())
+ xModel = 0;
+ else
+ xModel = xController->getModel();
+ return xModel;
+ }
+ sal_Bool HasSelectionChanged() const{return bHasSelectionChanged;}
+ Reference<XRubySelection> GetRubySelection()
+ {
+ xSelection = Reference<XRubySelection>(xController, UNO_QUERY);
+ return xSelection;
+ }
+ void UpdateRubyValues(sal_Bool bAutoUpdate)
+ {
+ if(!xSelection.is())
+ aRubyValues.realloc(0);
+ else
+ aRubyValues = xSelection->getRubyList(bAutoUpdate);
+ bHasSelectionChanged = sal_False;
+ }
+ Sequence<PropertyValues>& GetRubyValues() {return aRubyValues;}
+ void AssertOneEntry();
+
+ virtual void SAL_CALL selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) throw (RuntimeException);
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (RuntimeException);
+
+};
+//-----------------------------------------------------------------------------
+SvxRubyData_Impl::SvxRubyData_Impl() :
+ bHasSelectionChanged(sal_False)
+{
+}
+//-----------------------------------------------------------------------------
+SvxRubyData_Impl::~SvxRubyData_Impl()
+{
+}
+//-----------------------------------------------------------------------------
+void SvxRubyData_Impl::SetController(Reference<XController> xCtrl)
+{
+ if(xCtrl.get() != xController.get())
+ {
+ try
+ {
+ Reference<XSelectionSupplier> xSelSupp(xController, UNO_QUERY);
+ if(xSelSupp.is())
+ xSelSupp->removeSelectionChangeListener(this);
+
+ bHasSelectionChanged = sal_True;
+ xController = xCtrl;
+ xSelSupp = Reference<XSelectionSupplier>(xController, UNO_QUERY);
+ if(xSelSupp.is())
+ xSelSupp->addSelectionChangeListener(this);
+ }
+ catch(Exception&)
+ {}
+ }
+}
+//-----------------------------------------------------------------------------
+void SvxRubyData_Impl::selectionChanged( const EventObject& ) throw (RuntimeException)
+{
+ bHasSelectionChanged = sal_True;
+}
+//-----------------------------------------------------------------------------
+void SvxRubyData_Impl::disposing( const EventObject&) throw (RuntimeException)
+{
+ try
+ {
+ Reference<XSelectionSupplier> xSelSupp(xController, UNO_QUERY);
+ if(xSelSupp.is())
+ xSelSupp->removeSelectionChangeListener(this);
+ }
+ catch(Exception&)
+ {}
+ xController = 0;
+}
+//-----------------------------------------------------------------------------
+void SvxRubyData_Impl::AssertOneEntry()
+{
+ //create one entry
+ if(!aRubyValues.getLength())
+ {
+ aRubyValues.realloc(1);
+ Sequence<PropertyValue>& rValues = aRubyValues.getArray()[0];
+ rValues.realloc(5);
+ PropertyValue* pValues = rValues.getArray();
+ pValues[0].Name = C2U(cRubyBaseText);
+ pValues[1].Name = C2U(cRubyText);
+ pValues[2].Name = C2U(cRubyAdjust);
+ pValues[3].Name = C2U(cRubyIsAbove);
+ pValues[4].Name = C2U(cRubyCharStyleName);
+ }
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxRubyDialog::SvxRubyDialog( SfxBindings *pBind, SfxChildWindow *pCW,
+ Window* _pParent, const ResId& rResId ) :
+ SfxModelessDialog( pBind, pCW, _pParent, rResId ),
+ aLeftFT(this, ResId(FT_LEFT,*rResId.GetResMgr() )),
+ aLeft1ED(this, ResId(ED_LEFT_1,*rResId.GetResMgr() )),
+ aRightFT(this, ResId(FT_RIGHT,*rResId.GetResMgr() )),
+ aRight1ED(this, ResId(ED_RIGHT_1,*rResId.GetResMgr() )),
+ aLeft2ED(this, ResId(ED_LEFT_2,*rResId.GetResMgr() )),
+ aRight2ED(this, ResId(ED_RIGHT_2,*rResId.GetResMgr() )),
+ aLeft3ED(this, ResId(ED_LEFT_3,*rResId.GetResMgr() )),
+ aRight3ED(this, ResId(ED_RIGHT_3,*rResId.GetResMgr() )),
+ aLeft4ED(this, ResId(ED_LEFT_4,*rResId.GetResMgr() )),
+ aRight4ED(this, ResId(ED_RIGHT_4,*rResId.GetResMgr() )),
+ aScrollSB(this, ResId(SB_SCROLL,*rResId.GetResMgr() )),
+ aAutoDetectionCB(this, ResId(CB_AUTO_DETECT,*rResId.GetResMgr() )),
+ aAdjustFT(this, ResId(FT_ADJUST,*rResId.GetResMgr() )),
+ aAdjustLB(this, ResId(LB_ADJUST,*rResId.GetResMgr() )),
+ aPositionFT(this, ResId(FT_POSITION,*rResId.GetResMgr() )),
+ aPositionLB(this, ResId(LB_POSITION,*rResId.GetResMgr() )),
+ aCharStyleFT(this, ResId(FT_CHAR_STYLE,*rResId.GetResMgr() )),
+ aCharStyleLB(this, ResId(LB_CHAR_STYLE,*rResId.GetResMgr() )),
+ aStylistPB(this, ResId(PB_STYLIST,*rResId.GetResMgr() )),
+ aPreviewFT(this, ResId(FT_PREVIEW,*rResId.GetResMgr() )),
+ aPreviewWin(*this, ResId(WIN_PREVIEW,*rResId.GetResMgr() )),
+ aApplyPB(this, ResId(PB_APPLY,*rResId.GetResMgr() )),
+ aClosePB(this, ResId(PB_CLOSE,*rResId.GetResMgr() )),
+ aHelpPB(this, ResId(PB_HELP,*rResId.GetResMgr() )),
+ nLastPos(0),
+ nCurrentEdit(0),
+ bModified(sal_False),
+ pBindings(pBind)
+{
+ xImpl = pImpl = new SvxRubyData_Impl;
+ FreeResource();
+ //#85638# automatic detection not yet available
+ aAutoDetectionCB.Hide();
+ aEditArr[0] = &aLeft1ED; aEditArr[1] = &aRight1ED;
+ aEditArr[2] = &aLeft2ED; aEditArr[3] = &aRight2ED;
+ aEditArr[4] = &aLeft3ED; aEditArr[5] = &aRight3ED;
+ aEditArr[6] = &aLeft4ED; aEditArr[7] = &aRight4ED;
+
+ aApplyPB.SetClickHdl(LINK(this, SvxRubyDialog, ApplyHdl_Impl));
+ aClosePB.SetClickHdl(LINK(this, SvxRubyDialog, CloseHdl_Impl));
+ aStylistPB.SetClickHdl(LINK(this, SvxRubyDialog, StylistHdl_Impl));
+ aAutoDetectionCB.SetClickHdl(LINK(this, SvxRubyDialog, AutomaticHdl_Impl));
+ aAdjustLB.SetSelectHdl(LINK(this, SvxRubyDialog, AdjustHdl_Impl));
+ aPositionLB.SetSelectHdl(LINK(this, SvxRubyDialog, PositionHdl_Impl));
+ aCharStyleLB.SetSelectHdl(LINK(this, SvxRubyDialog, CharStyleHdl_Impl));
+
+ Link aScrLk(LINK(this, SvxRubyDialog, ScrollHdl_Impl));
+ aScrollSB.SetScrollHdl( aScrLk );
+ aScrollSB.SetEndScrollHdl( aScrLk );
+
+ Link aEditLk(LINK(this, SvxRubyDialog, EditModifyHdl_Impl));
+ Link aScrollLk(LINK(this, SvxRubyDialog, EditScrollHdl_Impl));
+ Link aJumpLk(LINK(this, SvxRubyDialog, EditJumpHdl_Impl));
+ for(sal_uInt16 i = 0; i < 8; i++)
+ {
+ aEditArr[i]->SetModifyHdl(aEditLk);
+ aEditArr[i]->SetJumpHdl(aJumpLk);
+ if(!i || 7 == i)
+ aEditArr[i]->SetScrollHdl(aScrollLk);
+ }
+
+ UpdateColors();
+}
+/* -----------------------------09.01.01 17:17--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxRubyDialog::~SvxRubyDialog()
+{
+ ClearCharStyleList();
+ EventObject aEvent;
+ xImpl->disposing(aEvent);
+}
+/* -----------------------------01.02.01 10:29--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxRubyDialog::ClearCharStyleList()
+{
+ for(sal_uInt16 i = 0; i < aCharStyleLB.GetEntryCount(); i++)
+ {
+ void* pData = aCharStyleLB.GetEntryData(i);
+ delete (OUString*)pData;
+ }
+ aCharStyleLB.Clear();
+}
+/* -----------------------------09.01.01 17:17--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SvxRubyDialog::Close()
+{
+ pBindings->GetDispatcher()->Execute( SID_RUBY_DIALOG,
+ SFX_CALLMODE_ASYNCHRON |
+ SFX_CALLMODE_RECORD);
+ return sal_True;
+}
+/* -----------------------------29.01.01 15:26--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxRubyDialog::Activate()
+{
+ SfxModelessDialog::Activate();
+ SfxPoolItem* pState = 0;
+ SfxItemState eState = pBindings->QueryState( SID_STYLE_DESIGNER, pState );
+ sal_Bool bEnable = (eState < SFX_ITEM_AVAILABLE) || !pState || !((SfxBoolItem*)pState)->GetValue();
+ aStylistPB.Enable(bEnable);
+ //get selection from current view frame
+ SfxViewFrame* pCurFrm = SfxViewFrame::Current();
+ Reference< XController > xCtrl = pCurFrm->GetFrame().GetController();
+ pImpl->SetController(xCtrl);
+ if(pImpl->HasSelectionChanged())
+ {
+
+ Reference< XRubySelection > xRubySel = pImpl->GetRubySelection();
+ pImpl->UpdateRubyValues(aAutoDetectionCB.IsChecked());
+ EnableControls(xRubySel.is());
+ if(xRubySel.is())
+ {
+ Reference< XModel > xModel = pImpl->GetModel();
+ const String sCharStyleSelect = aCharStyleLB.GetSelectEntry();
+ ClearCharStyleList();
+ Reference<XStyleFamiliesSupplier> xSupplier(xModel, UNO_QUERY);
+ if(xSupplier.is())
+ {
+ try
+ {
+ Reference<XNameAccess> xFam = xSupplier->getStyleFamilies();
+ Any aChar = xFam->getByName(C2U(cCharacterStyles));
+ Reference<XNameContainer> xChar;
+ aChar >>= xChar;
+ Reference<XIndexAccess> xCharIdx(xChar, UNO_QUERY);
+ if(xCharIdx.is())
+ {
+ OUString sUIName(C2U(cDisplayName));
+ for(sal_Int32 nStyle = 0; nStyle < xCharIdx->getCount(); nStyle++)
+ {
+ Any aStyle = xCharIdx->getByIndex(nStyle);
+ Reference<XStyle> xStyle;
+ aStyle >>= xStyle;
+ Reference<XPropertySet> xPrSet(xStyle, UNO_QUERY);
+ OUString sName, sCoreName;
+ if(xPrSet.is())
+ {
+ Reference<XPropertySetInfo> xInfo = xPrSet->getPropertySetInfo();
+ if(xInfo->hasPropertyByName(sUIName))
+ {
+ Any aName = xPrSet->getPropertyValue(sUIName);
+ aName >>= sName;
+ }
+ }
+ Reference<XNamed> xNamed(xStyle, UNO_QUERY);
+ if(xNamed.is())
+ {
+ sCoreName = xNamed->getName();
+ if(!sName.getLength())
+ sName = sCoreName;
+ }
+ if(sName.getLength())
+ {
+ sal_uInt16 nPos = aCharStyleLB.InsertEntry(sName);
+ aCharStyleLB.SetEntryData( nPos, new OUString(sCoreName) );
+
+ }
+ }
+ }
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("exception in style access");
+ }
+ if(sCharStyleSelect.Len())
+ aCharStyleLB.SelectEntry(sCharStyleSelect);
+ }
+ aCharStyleLB.Enable(xSupplier.is());
+ aCharStyleFT.Enable(xSupplier.is());
+ }
+ Update();
+ aPreviewWin.Invalidate();
+ }
+}
+/* -----------------------------29.01.01 15:26--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxRubyDialog::Deactivate()
+{
+ SfxModelessDialog::Deactivate();
+}
+/* -----------------------------30.01.01 15:35--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxRubyDialog::SetText(sal_Int32 nPos, Edit& rLeft, Edit& rRight)
+{
+ OUString sLeft, sRight;
+ const Sequence<PropertyValues>& aRubyValues = pImpl->GetRubyValues();
+ sal_Bool bEnable = aRubyValues.getLength() > nPos;
+ if(bEnable)
+ {
+ const Sequence<PropertyValue> aProps = aRubyValues.getConstArray()[nPos];
+ const PropertyValue* pProps = aProps.getConstArray();
+ for(sal_Int32 nProp = 0; nProp < aProps.getLength(); nProp++)
+ {
+ if(pProps[nProp].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cRubyBaseText)))
+ pProps[nProp].Value >>= sLeft;
+ else if(pProps[nProp].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cRubyText)))
+ pProps[nProp].Value >>= sRight;
+ }
+ }
+ else if(!nPos)
+ bEnable = sal_True;
+ rLeft.Enable(bEnable);
+ rRight.Enable(bEnable);
+ rLeft.SetText(sLeft);
+ rRight.SetText(sRight);
+ rLeft.SaveValue();
+ rRight.SaveValue();
+}
+//-----------------------------------------------------------------------------
+void SvxRubyDialog::GetText()
+{
+ long nTempLastPos = GetLastPos();
+ for(int i = 0; i < 8; i+=2)
+ {
+ if(aEditArr[i]->IsEnabled() &&
+ (aEditArr[i]->GetText() != aEditArr[i]->GetSavedValue() ||
+ aEditArr[i + 1]->GetText() != aEditArr[i + 1]->GetSavedValue()))
+ {
+ Sequence<PropertyValues>& aRubyValues = pImpl->GetRubyValues();
+ DBG_ASSERT(aRubyValues.getLength() > (i / 2 + nTempLastPos), "wrong index" );
+ SetModified(sal_True);
+ Sequence<PropertyValue> &rProps = aRubyValues.getArray()[i / 2 + nTempLastPos];
+ PropertyValue* pProps = rProps.getArray();
+ for(sal_Int32 nProp = 0; nProp < rProps.getLength(); nProp++)
+ {
+ if(pProps[nProp].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cRubyBaseText)))
+ pProps[nProp].Value <<= OUString(aEditArr[i]->GetText());
+ else if(pProps[nProp].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cRubyText)))
+ pProps[nProp].Value <<= OUString(aEditArr[i + 1]->GetText());
+ }
+ }
+ }
+}
+//-----------------------------------------------------------------------------
+void SvxRubyDialog::Update()
+{
+ const Sequence<PropertyValues>& aRubyValues = pImpl->GetRubyValues();
+ sal_Int32 nLen = aRubyValues.getLength();
+ aScrollSB.Enable(nLen > 4);
+ aScrollSB.SetRange( Range(0, nLen > 4 ? nLen - 4 : 0));
+ aScrollSB.SetThumbPos(0);
+ SetLastPos(0);
+ SetModified(sal_False);
+
+ sal_Int16 nAdjust = -1;
+ sal_Int16 nPosition = -1;
+ OUString sCharStyleName, sTmp;
+ sal_Bool bCharStyleEqual = sal_True;
+ for(sal_Int32 nRuby = 0; nRuby < nLen; nRuby++)
+ {
+ const Sequence<PropertyValue> &rProps = aRubyValues.getConstArray()[nRuby];
+ const PropertyValue* pProps = rProps.getConstArray();
+ for(sal_Int32 nProp = 0; nProp < rProps.getLength(); nProp++)
+ {
+ if(nAdjust > -2 &&
+ pProps[nProp].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cRubyAdjust)))
+ {
+ sal_Int16 nTmp = sal_Int16();
+ pProps[nProp].Value >>= nTmp;
+ if(!nRuby)
+ nAdjust = nTmp;
+ else if(nAdjust != nTmp)
+ nAdjust = -2;
+ }
+ if(nPosition > -2 &&
+ pProps[nProp].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cRubyIsAbove)))
+ {
+ sal_Bool bTmp = *(sal_Bool*)pProps[nProp].Value.getValue();
+ if(!nRuby)
+ nPosition = bTmp ? 0 : 1;
+ else if( (!nPosition && !bTmp) || (nPosition == 1 && bTmp) )
+ nPosition = -2;
+ }
+ if(bCharStyleEqual &&
+ pProps[nProp].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cRubyCharStyleName)))
+ {
+ pProps[nProp].Value >>= sTmp;
+ if(!nRuby)
+ sCharStyleName = sTmp;
+ else if(sCharStyleName != sTmp)
+ bCharStyleEqual = sal_False;
+ }
+ }
+ }
+ if(!nLen)
+ {
+ //enable selection if the ruby list is empty
+ nAdjust = 0;
+ nPosition = 0;
+ }
+ if(nAdjust > -1)
+ aAdjustLB.SelectEntryPos(nAdjust);
+ else
+ aAdjustLB.SetNoSelection();
+ if(nPosition > -1)
+ aPositionLB.SelectEntryPos(nPosition ? 1 : 0);
+ if(!nLen || (bCharStyleEqual && !sCharStyleName.getLength()))
+ sCharStyleName = C2U(cRubies);
+ if(sCharStyleName.getLength())
+ {
+ for(sal_uInt16 i = 0; i < aCharStyleLB.GetEntryCount(); i++)
+ {
+ const OUString* pCoreName = (const OUString*)aCharStyleLB.GetEntryData(i);
+ if(pCoreName && sCharStyleName == *pCoreName)
+ {
+ aCharStyleLB.SelectEntryPos(i);
+ break;
+ }
+ }
+ }
+ else
+ aCharStyleLB.SetNoSelection();
+
+ ScrollHdl_Impl(&aScrollSB);
+}
+/* -----------------------------16.02.01 14:01--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxRubyDialog::GetCurrentText(String& rBase, String& rRuby)
+{
+ rBase = aEditArr[nCurrentEdit * 2]->GetText();
+ rRuby = aEditArr[nCurrentEdit * 2 + 1]->GetText();
+}
+/* -----------------------------31.01.01 14:09--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxRubyDialog, ScrollHdl_Impl, ScrollBar*, pScroll)
+{
+ long nPos = pScroll->GetThumbPos();
+ if(GetLastPos() != nPos)
+ {
+ GetText();
+ }
+ SetText(nPos++, aLeft1ED, aRight1ED);
+ SetText(nPos++, aLeft2ED, aRight2ED);
+ SetText(nPos++, aLeft3ED, aRight3ED);
+ SetText(nPos, aLeft4ED, aRight4ED);
+ SetLastPos(nPos - 3);
+ aPreviewWin.Invalidate();
+ return 0;
+}
+/* -----------------------------30.01.01 14:48--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxRubyDialog, ApplyHdl_Impl, PushButton*, EMPTYARG)
+{
+ const Sequence<PropertyValues>& aRubyValues = pImpl->GetRubyValues();
+ if(!aRubyValues.getLength())
+ {
+ AssertOneEntry();
+ PositionHdl_Impl(&aPositionLB);
+ AdjustHdl_Impl(&aAdjustLB);
+ CharStyleHdl_Impl(&aCharStyleLB);
+ }
+ GetText();
+ //reset all edit fields - SaveValue is called
+ ScrollHdl_Impl(&aScrollSB);
+
+ Reference<XRubySelection> xSelection = pImpl->GetRubySelection();
+ if(IsModified() && xSelection.is())
+ {
+ try
+ {
+ xSelection->setRubyList(aRubyValues, aAutoDetectionCB.IsChecked());
+ }
+ catch(Exception& )
+ {
+ DBG_ERROR("Exception caught");
+ }
+ }
+ return 0;
+}
+/* -----------------------------29.01.01 09:38--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxRubyDialog, CloseHdl_Impl, PushButton*, EMPTYARG)
+{
+ Close();
+ return 0;
+}
+/* -----------------------------29.01.01 15:10--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxRubyDialog, StylistHdl_Impl, PushButton*, EMPTYARG)
+{
+ SfxPoolItem* pState = 0;
+ SfxItemState eState = pBindings->QueryState( SID_STYLE_DESIGNER, pState );
+ if(eState <= SFX_ITEM_SET || !pState || !((SfxBoolItem*)pState)->GetValue())
+ {
+ pBindings->GetDispatcher()->Execute( SID_STYLE_DESIGNER,
+ SFX_CALLMODE_ASYNCHRON |
+ SFX_CALLMODE_RECORD);
+ }
+ return 0;
+}
+/* -----------------------------30.01.01 15:32--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxRubyDialog, AutomaticHdl_Impl, CheckBox*, pBox)
+{
+ pImpl->UpdateRubyValues(pBox->IsChecked());
+ Update();
+ return 0;
+}
+/* -----------------------------31.01.01 16:37--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxRubyDialog, AdjustHdl_Impl, ListBox*, pBox)
+{
+ AssertOneEntry();
+ sal_Int16 nAdjust = pBox->GetSelectEntryPos();
+ Sequence<PropertyValues>& aRubyValues = pImpl->GetRubyValues();
+ for(sal_Int32 nRuby = 0; nRuby < aRubyValues.getLength(); nRuby++)
+ {
+ Sequence<PropertyValue> &rProps = aRubyValues.getArray()[nRuby];
+ PropertyValue* pProps = rProps.getArray();
+ for(sal_Int32 nProp = 0; nProp < rProps.getLength(); nProp++)
+ {
+ if(pProps[nProp].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cRubyAdjust)))
+ pProps[nProp].Value <<= nAdjust;
+ }
+ SetModified(sal_True);
+ }
+ aPreviewWin.Invalidate();
+ return 0;
+}
+/* -----------------------------01.06.01 10:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxRubyDialog, PositionHdl_Impl, ListBox*, pBox)
+{
+ AssertOneEntry();
+ sal_Bool bAbove = !pBox->GetSelectEntryPos();
+ const Type& rType = ::getBooleanCppuType();
+ Sequence<PropertyValues>& aRubyValues = pImpl->GetRubyValues();
+ for(sal_Int32 nRuby = 0; nRuby < aRubyValues.getLength(); nRuby++)
+ {
+ Sequence<PropertyValue> &rProps = aRubyValues.getArray()[nRuby];
+ PropertyValue* pProps = rProps.getArray();
+ for(sal_Int32 nProp = 0; nProp < rProps.getLength(); nProp++)
+ {
+ if(pProps[nProp].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cRubyIsAbove)))
+ pProps[nProp].Value.setValue(&bAbove, rType);
+ }
+ SetModified(sal_True);
+ }
+ aPreviewWin.Invalidate();
+ return 0;
+}
+/* -----------------------------01.02.01 10:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxRubyDialog, CharStyleHdl_Impl, ListBox*, EMPTYARG )
+{
+ AssertOneEntry();
+ OUString sStyleName;
+ if(LISTBOX_ENTRY_NOTFOUND != aCharStyleLB.GetSelectEntryPos())
+ sStyleName = *(OUString*) aCharStyleLB.GetEntryData(aCharStyleLB.GetSelectEntryPos());
+ Sequence<PropertyValues>& aRubyValues = pImpl->GetRubyValues();
+ for(sal_Int32 nRuby = 0; nRuby < aRubyValues.getLength(); nRuby++)
+ {
+ Sequence<PropertyValue> &rProps = aRubyValues.getArray()[nRuby];
+ PropertyValue* pProps = rProps.getArray();
+ for(sal_Int32 nProp = 0; nProp < rProps.getLength(); nProp++)
+ {
+ if(pProps[nProp].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cRubyCharStyleName)))
+ {
+ pProps[nProp].Value <<= sStyleName;
+ }
+ }
+ SetModified(sal_True);
+ }
+ return 0;
+}
+/* -----------------------------16.02.01 08:35--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxRubyDialog, EditModifyHdl_Impl, Edit*, pEdit)
+{
+ for(sal_uInt16 i = 0; i < 8; i++)
+ {
+ if(pEdit == aEditArr[i])
+ {
+ nCurrentEdit = i / 2;
+ break;
+ }
+ }
+ aPreviewWin.Invalidate();
+ return 0;
+}
+/* -----------------------------17.07.01 09:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxRubyDialog, EditScrollHdl_Impl, sal_Int32*, pParam)
+{
+ long nRet = 0;
+ if(aScrollSB.IsEnabled())
+ {
+ //scroll forward
+ if(*pParam > 0 && (aEditArr[7]->HasFocus() || aEditArr[6]->HasFocus() ))
+ {
+ if(aScrollSB.GetRangeMax() > aScrollSB.GetThumbPos())
+ {
+ aScrollSB.SetThumbPos(aScrollSB.GetThumbPos() + 1);
+ aEditArr[6]->GrabFocus();
+ nRet = 1;
+ }
+ }
+ //scroll backward
+ else if(aScrollSB.GetThumbPos() && (aEditArr[0]->HasFocus()||aEditArr[1]->HasFocus()) )
+ {
+ aScrollSB.SetThumbPos(aScrollSB.GetThumbPos() - 1);
+ aEditArr[1]->GrabFocus();
+ nRet = 1;
+ }
+ if(nRet)
+ ScrollHdl_Impl(&aScrollSB);
+ }
+ return nRet;
+}
+/* -----------------------------20.07.2001 15:18------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxRubyDialog, EditJumpHdl_Impl, sal_Int32*, pParam)
+{
+ sal_uInt16 nIndex = USHRT_MAX;
+ for(sal_uInt16 i = 0; i < 8; i++)
+ {
+ if(aEditArr[i]->HasFocus())
+ nIndex = i;
+ }
+ if(nIndex < 8)
+ {
+ if(*pParam > 0)
+ {
+ if(nIndex < 6)
+ aEditArr[nIndex + 2]->GrabFocus();
+ else if( EditScrollHdl_Impl(pParam))
+ aEditArr[nIndex]->GrabFocus();
+ }
+ else
+ {
+ if(nIndex > 1)
+ aEditArr[nIndex - 2]->GrabFocus();
+ else if( EditScrollHdl_Impl(pParam))
+ aEditArr[nIndex]->GrabFocus();
+ }
+ }
+ return 0;
+};
+/* -----------------------------19.06.01 11:33--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxRubyDialog::AssertOneEntry()
+{
+ pImpl->AssertOneEntry();
+}
+
+// ----------------------------------------------------------------------------
+
+void SvxRubyDialog::UpdateColors( void )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ svtools::ColorConfig aColorConfig;
+
+ Font aFnt( aPreviewWin.GetFont() );
+
+ Color aNewTextCol( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
+ Color aNewFillCol( rStyleSettings.GetWindowColor() );
+
+ if( aNewFillCol != aFnt.GetFillColor() || aNewTextCol != aFnt.GetColor() )
+ {
+ aFnt.SetFillColor( aNewFillCol );
+ aFnt.SetColor( aNewTextCol );
+ aPreviewWin.SetFont( aFnt );
+
+ aPreviewWin.Invalidate();
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+void SvxRubyDialog::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SfxModelessDialog::DataChanged( rDCEvt );
+
+ if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
+ UpdateColors();
+}
+
+/* -----------------------------29.01.01 15:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void lcl_MoveBox(long nOffset, Edit& rLeft, Edit& rRight)
+{
+ Size aLeftSz(rLeft.GetSizePixel());
+ Point aRightPos(rRight.GetPosPixel());
+ Size aRightSz(rRight.GetSizePixel());
+ aLeftSz.Width() += nOffset;
+ aRightSz.Width() -= nOffset;
+ aRightPos.X() += nOffset;
+ rLeft.SetSizePixel(aLeftSz);
+ rRight.SetPosSizePixel(aRightPos, aRightSz);
+
+}
+/* -----------------------------16.02.01 08:09--------------------------------
+
+ ---------------------------------------------------------------------------*/
+RubyPreview::RubyPreview(SvxRubyDialog& rParent, const ResId& rResId) :
+ Window(&rParent, rResId),
+ rParentDlg(rParent)
+{
+ SetMapMode(MAP_TWIP);
+ Size aWinSize = GetOutputSize();
+
+ Font aFont = GetFont();
+ aFont.SetHeight(aWinSize.Height() / 4);
+ SetFont(aFont);
+
+ SetBorderStyle( WINDOW_BORDER_MONO );
+}
+/* -----------------------------29.01.01 14:05--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void RubyPreview::Paint( const Rectangle& /* rRect */ )
+{
+ Font aRubyFont = GetFont();
+ Font aSaveFont(aRubyFont);
+ aRubyFont.SetHeight(aRubyFont.GetHeight() * 70 / 100);
+
+ Size aWinSize = GetOutputSize();
+ Rectangle aRect(Point(0, 0), aWinSize);
+ SetLineColor();
+ SetFillColor( aSaveFont.GetFillColor() );
+ DrawRect(aRect);
+
+ String sBaseText, sRubyText;
+ rParentDlg.GetCurrentText(sBaseText, sRubyText);
+
+ long nTextHeight = GetTextHeight();
+ long nBaseWidth = GetTextWidth(sBaseText);
+ SetFont(aRubyFont);
+ long nRubyWidth = GetTextWidth(sRubyText);
+ SetFont(aSaveFont);
+
+ sal_uInt16 nAdjust = rParentDlg.aAdjustLB.GetSelectEntryPos();
+ //use center if no adjustment is available
+ if(nAdjust > 4)
+ nAdjust = 1;
+
+ //which part is stretched ?
+ sal_Bool bRubyStretch = nBaseWidth >= nRubyWidth;
+
+ long nCenter = aWinSize.Width() / 2;
+ long nLeftStart = nCenter - (bRubyStretch ? (nBaseWidth / 2) : (nRubyWidth / 2));
+ long nRightEnd = nCenter + (bRubyStretch ? (nBaseWidth / 2) : (nRubyWidth / 2));
+
+ long nYRuby = aWinSize.Height() / 4 - nTextHeight / 2;
+ long nYBase = aWinSize.Height() * 3 / 4 - nTextHeight / 2;
+
+ //use above also if no selection is set
+ sal_Bool bAbove = rParentDlg.aPositionLB.GetSelectEntryPos() != 1;
+ if(!bAbove)
+ {
+ long nTmp = nYRuby;
+ nYRuby = nYBase;
+ nYBase = nTmp;
+ }
+ long nYOutput, nOutTextWidth;
+ String sOutputText;
+
+
+ if(bRubyStretch)
+ {
+ DrawText( Point( nLeftStart , nYBase), sBaseText );
+ nYOutput = nYRuby;
+ sOutputText = sRubyText;
+ nOutTextWidth = nRubyWidth;
+ SetFont(aRubyFont);
+ }
+ else
+ {
+ SetFont(aRubyFont);
+ DrawText( Point( nLeftStart , nYRuby), sRubyText );
+ nYOutput = nYBase;
+ sOutputText = sBaseText;
+ nOutTextWidth = nBaseWidth;
+ SetFont(aSaveFont);
+ }
+
+ switch(nAdjust)
+ {
+ case RubyAdjust_LEFT:
+ DrawText( Point( nLeftStart , nYOutput), sOutputText );
+ break;
+ case RubyAdjust_RIGHT:
+ DrawText( Point( nRightEnd - nOutTextWidth, nYOutput), sOutputText );
+ break;
+ case RubyAdjust_INDENT_BLOCK:
+ {
+ long nCharWidth = GetTextWidth(String::CreateFromAscii("X"));
+ if(nOutTextWidth < (nRightEnd - nLeftStart - nCharWidth))
+ {
+ nCharWidth /= 2;
+ nLeftStart += nCharWidth;
+ nRightEnd -= nCharWidth;
+ }
+ }
+ // no break!
+ case RubyAdjust_BLOCK:
+ if(sOutputText.Len() > 1)
+ {
+ xub_StrLen nCount = sOutputText.Len();
+ long nSpace = ((nRightEnd - nLeftStart) - GetTextWidth(sOutputText)) / (nCount - 1);
+ for(xub_StrLen i = 0; i < nCount; i++)
+ {
+ sal_Unicode cChar = sOutputText.GetChar(i);
+ DrawText( Point( nLeftStart , nYOutput), cChar);
+ long nCharWidth = GetTextWidth(cChar);
+ nLeftStart += nCharWidth + nSpace;
+ }
+ break;
+ }
+ //no break;
+ case RubyAdjust_CENTER:
+ DrawText( Point( nCenter - nOutTextWidth / 2 , nYOutput), sOutputText );
+ break;
+ }
+ SetFont(aSaveFont);
+}
+/* -----------------------------16.02.01 15:12--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void RubyEdit::GetFocus()
+{
+ GetModifyHdl().Call(this);
+ Edit::GetFocus();
+}
+/* -----------------------------17.07.01 09:00--------------------------------
+
+ ---------------------------------------------------------------------------*/
+long RubyEdit::PreNotify( NotifyEvent& rNEvt )
+{
+ long nHandled = 0;
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ const KeyCode& rKeyCode = pKEvt->GetKeyCode();
+ sal_uInt16 nMod = rKeyCode.GetModifier();
+ sal_uInt16 nCode = rKeyCode.GetCode();
+ if( nCode == KEY_TAB && (!nMod || KEY_SHIFT == nMod))
+ {
+ sal_Int32 nParam = KEY_SHIFT == nMod ? -1 : 1;
+ if(aScrollHdl.IsSet() && aScrollHdl.Call(&nParam))
+ nHandled = 1;
+ }
+ else if(KEY_UP == nCode || KEY_DOWN == nCode)
+ {
+ sal_Int32 nParam = KEY_UP == nCode ? -1 : 1;
+ aJumpHdl.Call(&nParam);
+ }
+ }
+ if(!nHandled)
+ nHandled = Edit::PreNotify(rNEvt);
+ return nHandled;
+}
+
diff --git a/svx/source/dialog/rubydialog.hrc b/svx/source/dialog/rubydialog.hrc
new file mode 100644
index 000000000000..f22b1da10ea7
--- /dev/null
+++ b/svx/source/dialog/rubydialog.hrc
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define CB_AUTO_DETECT 1
+#define FT_CHAR_STYLE 2
+#define LB_CHAR_STYLE 3
+#define PB_STYLIST 4
+#define FT_PREVIEW 5
+#define WIN_PREVIEW 6
+#define PB_APPLY 7
+#define PB_CLOSE 8
+#define PB_HELP 9
+#define ED_LEFT_1 10
+#define ED_LEFT_2 11
+#define ED_LEFT_3 12
+#define ED_LEFT_4 13
+#define ED_RIGHT_1 14
+#define ED_RIGHT_2 15
+#define ED_RIGHT_3 16
+#define ED_RIGHT_4 17
+#define HB_HEADER 18
+#define SB_SCROLL 19
+#define FT_LEFT 20
+#define FT_RIGHT 21
+#define FT_ADJUST 22
+#define LB_ADJUST 23
+#define FT_POSITION 24
+#define LB_POSITION 25
+
diff --git a/svx/source/dialog/rubydialog.src b/svx/source/dialog/rubydialog.src
new file mode 100644
index 000000000000..e10d4d0e57e2
--- /dev/null
+++ b/svx/source/dialog/rubydialog.src
@@ -0,0 +1,221 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <rubydialog.hrc>
+#include "helpid.hrc"
+#include <svx/dialogs.hrc>
+
+ModelessDialog RID_SVXDLG_RUBY
+{
+ OutputSize = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ HelpId = HID_RUBY_DIALOG;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 227 , 195 ) ;
+ Text [ en-US ] = "Asian Phonetic Guide" ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ CheckBox CB_AUTO_DETECT
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_RUBY:CB_AUTO_DETECT";
+ Pos = MAP_APPFONT ( 6, 6 ) ;
+ Size = MAP_APPFONT ( 186 , 12 ) ;
+ Text [ en-US ] = "Automatic detection";
+ };
+ FixedText FT_LEFT
+ {
+ Pos = MAP_APPFONT ( 6 , 17 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Base text";
+ };
+ FixedText FT_RIGHT
+ {
+ Pos = MAP_APPFONT ( 109 , 17 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Ruby text";
+ };
+ Edit ED_LEFT_1
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_RUBY:ED_LEFT_1";
+ Pos = MAP_APPFONT ( 6 , 30 ) ;
+ Size = MAP_APPFONT ( 102 , 12 ) ;
+ Hide = False;
+ Border = TRUE;
+ };
+ Edit ED_RIGHT_1
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_RUBY:ED_RIGHT_1";
+ Pos = MAP_APPFONT ( 109 , 30 ) ;
+ Size = MAP_APPFONT ( 102 , 12 ) ;
+ Border = TRUE;
+ };
+ Edit ED_LEFT_2
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_RUBY:ED_LEFT_2";
+ Pos = MAP_APPFONT ( 6 , 42) ;
+ Size = MAP_APPFONT ( 102 , 12 ) ;
+ Border = TRUE;
+ };
+ Edit ED_RIGHT_2
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_RUBY:ED_RIGHT_2";
+ Pos = MAP_APPFONT ( 109 , 42 ) ;
+ Size = MAP_APPFONT ( 102 , 12 ) ;
+ Border = TRUE;
+ };
+ Edit ED_LEFT_3
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_RUBY:ED_LEFT_3";
+ Pos = MAP_APPFONT ( 6 , 54 ) ;
+ Size = MAP_APPFONT ( 102 , 12 ) ;
+ Border = TRUE;
+ };
+ Edit ED_RIGHT_3
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_RUBY:ED_RIGHT_3";
+ Pos = MAP_APPFONT ( 109 , 54 ) ;
+ Size = MAP_APPFONT ( 102 , 12 ) ;
+ Border = TRUE;
+ };
+ Edit ED_LEFT_4
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_RUBY:ED_LEFT_4";
+ Pos = MAP_APPFONT ( 6 , 66 ) ;
+ Size = MAP_APPFONT ( 102 , 12 ) ;
+ Border = TRUE;
+ };
+ Edit ED_RIGHT_4
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_RUBY:ED_RIGHT_4";
+ Pos = MAP_APPFONT ( 109 , 66 ) ;
+ Size = MAP_APPFONT ( 102 , 12 ) ;
+ Border = TRUE;
+ };
+ ScrollBar SB_SCROLL
+ {
+ Pos = MAP_APPFONT ( 213 , 30 ) ;
+ Size = MAP_APPFONT ( 8 , 48 ) ;
+ VScroll = TRUE ;
+ Drag = TRUE ;
+ };
+ FixedText FT_ADJUST
+ {
+ Pos = MAP_APPFONT ( 6 , 82 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
+ Text [ en-US ] = "Alignment";
+ };
+ ListBox LB_ADJUST
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_RUBY:LB_ADJUST";
+ Pos = MAP_APPFONT ( 6 , 93) ;
+ Size = MAP_APPFONT ( 35 , 60 ) ;
+ DropDown = TRUE;
+ Border = TRUE;
+ StringList [ en-US ] =
+ {
+ "Left" ;
+ "Center" ;
+ "Right" ;
+ "0 1 0" ;
+ "1 2 1" ;
+ };
+ };
+ FixedText FT_POSITION
+ {
+ Pos = MAP_APPFONT ( 43 , 82 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
+ Text [ en-US ] = "Position";
+ };
+ ListBox LB_POSITION
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_RUBY:LB_POSITION";
+ Pos = MAP_APPFONT ( 43 , 93) ;
+ Size = MAP_APPFONT ( 35 , 60 ) ;
+ DropDown = TRUE;
+ Border = TRUE;
+ StringList [ en-US ] =
+ {
+ "Top" ;
+ "Bottom" ;
+ };
+ };
+ FixedText FT_CHAR_STYLE
+ {
+ Pos = MAP_APPFONT ( 80 , 82 ) ;
+ Size = MAP_APPFONT ( 141 , 8 ) ;
+ Text [ en-US ] = "Character Style for ruby text";
+ };
+ ListBox LB_CHAR_STYLE
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_RUBY:LB_CHAR_STYLE";
+ Pos = MAP_APPFONT ( 80 , 93) ;
+ Size = MAP_APPFONT ( 89 , 60 ) ;
+ DropDown = TRUE;
+ Border = TRUE;
+ Sort = TRUE;
+ };
+ PushButton PB_STYLIST
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_RUBY:PB_STYLIST";
+ Pos = MAP_APPFONT ( 171 , 92 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "Styles";
+ };
+ FixedText FT_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 6, 110 ) ;
+ Size = MAP_APPFONT ( 195 , 8 ) ;
+ Text [ en-US ] = "Preview:";
+ };
+ Window WIN_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 6 , 121 ) ;
+ Size = MAP_APPFONT ( 215 , 50 ) ;
+ Border = TRUE ;
+ };
+ OKButton PB_APPLY
+ {
+ DefButton = TRUE;
+ Pos = MAP_APPFONT ( 65 , 175 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Apply";
+ };
+ PushButton PB_CLOSE
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_RUBY:PB_CLOSE";
+ Pos = MAP_APPFONT ( 118, 175 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Close";
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 171 , 175 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
+
diff --git a/svx/source/dialog/ruler.hrc b/svx/source/dialog/ruler.hrc
new file mode 100644
index 000000000000..1280b1237bc5
--- /dev/null
+++ b/svx/source/dialog/ruler.hrc
@@ -0,0 +1,37 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+//!! Abhaegigkeit zu sv.hxx
+#define ID_MM 1
+#define ID_CM 2
+#define ID_M 3
+#define ID_KM 4
+#define ID_INCH 8
+#define ID_FOOT 9
+#define ID_MILE 10
+#define ID_POINT 6
+#define ID_PICA 7
+
diff --git a/svx/source/dialog/ruler.src b/svx/source/dialog/ruler.src
new file mode 100644
index 000000000000..4d0218f525ee
--- /dev/null
+++ b/svx/source/dialog/ruler.src
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <svx/dialogs.hrc>
+#include "ruler.hrc"
+
+Menu RID_SVXMN_RULER
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = ID_MM ;
+ Checkable = TRUE ;
+ Text [ en-US ] = "Millimeter" ;
+ };
+ MenuItem
+ {
+ Identifier = ID_CM ;
+ Checkable = TRUE ;
+ Text [ en-US ] = "Centimeter" ;
+ };
+ MenuItem
+ {
+ Identifier = ID_M ;
+ Checkable = TRUE ;
+ Text [ en-US ] = "Meter" ;
+ };
+ MenuItem
+ {
+ Identifier = ID_KM ;
+ Checkable = TRUE ;
+ Text [ en-US ] = "Kilometer" ;
+ };
+ MenuItem
+ {
+ Identifier = ID_INCH ;
+ Checkable = TRUE ;
+ Text [ en-US ] = "Inch" ;
+ };
+ MenuItem
+ {
+ Identifier = ID_FOOT ;
+ Checkable = TRUE ;
+ /* ### ACHTUNG: Neuer Text in Resource? Fuß : Fu˜ */
+ /* ### ACHTUNG: Neuer Text in Resource? Fuß : Fu˜ */
+ Text [ en-US ] = "Foot" ;
+ };
+ MenuItem
+ {
+ Identifier = ID_MILE ;
+ Checkable = TRUE ;
+ Text [ en-US ] = "Miles" ;
+ };
+ MenuItem
+ {
+ Identifier = ID_POINT ;
+ Checkable = TRUE ;
+ Text [ en-US ] = "Point" ;
+ };
+ MenuItem
+ {
+ Identifier = ID_PICA ;
+ Checkable = TRUE ;
+ Text [ en-US ] = "Pica" ;
+ };
+ };
+};
+String RID_SVXSTR_RULER_TAB_LEFT
+{
+ Text [ en-US ] = "Left" ;
+};
+String RID_SVXSTR_RULER_TAB_RIGHT
+{
+ Text [ en-US ] = "Right" ;
+};
+String RID_SVXSTR_RULER_TAB_DECIMAL
+{
+ Text [ en-US ] = "Decimal" ;
+};
+String RID_SVXSTR_RULER_TAB_CENTER
+{
+ Text [ en-US ] = "Center" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/dialog/rulritem.cxx b/svx/source/dialog/rulritem.cxx
new file mode 100644
index 000000000000..fa6936e7581e
--- /dev/null
+++ b/svx/source/dialog/rulritem.cxx
@@ -0,0 +1,743 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <tools/string.hxx>
+
+#include <svx/dialogs.hrc>
+#include "svx/rulritem.hxx"
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/frame/status/LeftRightMargin.hpp>
+#include <com/sun/star/frame/status/UpperLowerMargin.hpp>
+
+//------------------------------------------------------------------------
+
+TYPEINIT1_AUTOFACTORY(SvxPagePosSizeItem, SfxPoolItem);
+TYPEINIT1_AUTOFACTORY(SvxLongLRSpaceItem, SfxPoolItem);
+TYPEINIT1_AUTOFACTORY(SvxLongULSpaceItem, SfxPoolItem);
+TYPEINIT1(SvxColumnItem, SfxPoolItem);
+TYPEINIT1(SvxObjectItem, SfxPoolItem);
+
+//------------------------------------------------------------------------
+
+int SvxLongLRSpaceItem::operator==( const SfxPoolItem& rCmp) const
+{
+ return SfxPoolItem::operator==(rCmp) &&
+ lLeft==((const SvxLongLRSpaceItem &)rCmp).lLeft &&
+ lRight==((const SvxLongLRSpaceItem &)rCmp).lRight;
+}
+
+
+//------------------------------------------------------------------------
+
+String SvxLongLRSpaceItem::GetValueText() const
+{
+ return String();
+}
+
+#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
+#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L))
+
+sal_Bool SvxLongLRSpaceItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+ sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+
+ sal_Int32 nVal;
+ switch( nMemberId )
+ {
+ case 0:
+ {
+ ::com::sun::star::frame::status::LeftRightMargin aLeftRightMargin;
+ aLeftRightMargin.Left = bConvert ? TWIP_TO_MM100( lLeft ) : lLeft;
+ aLeftRightMargin.Right = bConvert ? TWIP_TO_MM100( lRight ) : lRight;
+ rVal <<= aLeftRightMargin;
+ return sal_True;
+ }
+
+ case MID_LEFT: nVal = lLeft; break;
+ case MID_RIGHT: nVal = lRight; break;
+ default: DBG_ERROR("Wrong MemberId!"); return sal_False;
+ }
+
+ if ( bConvert )
+ nVal = TWIP_TO_MM100( nVal );
+
+ rVal <<= nVal;
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------
+sal_Bool SvxLongLRSpaceItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
+{
+ sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+
+ sal_Int32 nVal = 0;
+ if ( nMemberId == 0 )
+ {
+ ::com::sun::star::frame::status::LeftRightMargin aLeftRightMargin;
+ if ( rVal >>= aLeftRightMargin )
+ {
+ lLeft = bConvert ? MM100_TO_TWIP( aLeftRightMargin.Left ) : aLeftRightMargin.Left;
+ lRight = bConvert ? MM100_TO_TWIP( aLeftRightMargin.Right ) : aLeftRightMargin.Right;
+ return sal_True;
+ }
+ }
+ else if ( rVal >>= nVal )
+ {
+ if ( bConvert )
+ nVal = MM100_TO_TWIP( nVal );
+
+ switch( nMemberId )
+ {
+ case MID_LEFT: lLeft = nVal; break;
+ case MID_RIGHT: lRight = nVal; break;
+ default: DBG_ERROR("Wrong MemberId!"); return sal_False;
+ }
+
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxLongLRSpaceItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& /*rText*/, const IntlWrapper *
+) const
+{
+
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//------------------------------------------------------------------------
+
+SfxPoolItem* SvxLongLRSpaceItem::Clone(SfxItemPool *) const
+{
+ return new SvxLongLRSpaceItem(*this);
+}
+
+//------------------------------------------------------------------------
+
+SvxLongLRSpaceItem::SvxLongLRSpaceItem(long lL, long lR, sal_uInt16 nId)
+ : SfxPoolItem(nId),
+ lLeft(lL),
+ lRight(lR)
+{}
+
+//------------------------------------------------------------------------
+
+SvxLongLRSpaceItem::SvxLongLRSpaceItem() :
+ SfxPoolItem( 0 ),
+ lLeft( 0 ),
+ lRight( 0 )
+{}
+
+//------------------------------------------------------------------------
+
+SvxLongLRSpaceItem::SvxLongLRSpaceItem(const SvxLongLRSpaceItem &rCpy)
+ : SfxPoolItem(rCpy),
+ lLeft(rCpy.lLeft),
+ lRight(rCpy.lRight)
+ {}
+
+//------------------------------------------------------------------------
+
+int SvxLongULSpaceItem::operator==( const SfxPoolItem& rCmp) const
+{
+ return SfxPoolItem::operator==(rCmp) &&
+ lLeft==((const SvxLongULSpaceItem &)rCmp).lLeft &&
+ lRight==((const SvxLongULSpaceItem &)rCmp).lRight;
+}
+
+
+//------------------------------------------------------------------------
+
+String SvxLongULSpaceItem::GetValueText() const
+{
+ return String();
+}
+
+sal_Bool SvxLongULSpaceItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+ sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+
+ sal_Int32 nVal;
+ switch( nMemberId )
+ {
+ case 0:
+ {
+ ::com::sun::star::frame::status::UpperLowerMargin aUpperLowerMargin;
+ aUpperLowerMargin.Upper = bConvert ? TWIP_TO_MM100( lLeft ) : lLeft;
+ aUpperLowerMargin.Lower = bConvert ? TWIP_TO_MM100( lRight ) : lRight;
+ rVal <<= aUpperLowerMargin;
+ return sal_True;
+ }
+
+ case MID_UPPER: nVal = lLeft; break;
+ case MID_LOWER: nVal = lRight; break;
+ default: DBG_ERROR("Wrong MemberId!"); return sal_False;
+ }
+
+ if ( bConvert )
+ nVal = TWIP_TO_MM100( nVal );
+
+ rVal <<= nVal;
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------
+sal_Bool SvxLongULSpaceItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
+{
+ sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+
+ sal_Int32 nVal = 0;
+ if ( nMemberId == 0 )
+ {
+ ::com::sun::star::frame::status::UpperLowerMargin aUpperLowerMargin;
+ if ( rVal >>= aUpperLowerMargin )
+ {
+ lLeft = bConvert ? MM100_TO_TWIP( aUpperLowerMargin.Upper ) : aUpperLowerMargin.Upper;
+ lRight = bConvert ? MM100_TO_TWIP( aUpperLowerMargin.Lower ) : aUpperLowerMargin.Lower;
+ return sal_True;
+ }
+ }
+ else if ( rVal >>= nVal )
+ {
+ if ( bConvert )
+ nVal = MM100_TO_TWIP( nVal );
+
+ switch( nMemberId )
+ {
+ case MID_UPPER: lLeft = nVal; break;
+ case MID_LOWER: lRight = nVal; break;
+ default: DBG_ERROR("Wrong MemberId!"); return sal_False;
+ }
+
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxLongULSpaceItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& /*rText*/, const IntlWrapper *
+) const
+{
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//------------------------------------------------------------------------
+
+SfxPoolItem* SvxLongULSpaceItem::Clone(SfxItemPool *) const
+{
+ return new SvxLongULSpaceItem(*this);
+}
+
+//------------------------------------------------------------------------
+
+SvxLongULSpaceItem::SvxLongULSpaceItem(long lL, long lR, sal_uInt16 nId)
+ : SfxPoolItem(nId),
+ lLeft(lL),
+ lRight(lR)
+{}
+
+//------------------------------------------------------------------------
+
+SvxLongULSpaceItem::SvxLongULSpaceItem(const SvxLongULSpaceItem &rCpy)
+ : SfxPoolItem(rCpy),
+ lLeft(rCpy.lLeft),
+ lRight(rCpy.lRight)
+ {}
+
+//------------------------------------------------------------------------
+
+SvxLongULSpaceItem::SvxLongULSpaceItem() :
+ SfxPoolItem( 0 ),
+ lLeft( 0 ),
+ lRight( 0 )
+{}
+
+//------------------------------------------------------------------------
+
+int SvxPagePosSizeItem::operator==( const SfxPoolItem& rCmp) const
+{
+ return SfxPoolItem::operator==(rCmp) &&
+ aPos == ((const SvxPagePosSizeItem &)rCmp).aPos &&
+ lWidth == ((const SvxPagePosSizeItem &)rCmp).lWidth &&
+ lHeight == ((const SvxPagePosSizeItem &)rCmp).lHeight;
+}
+
+sal_Bool SvxPagePosSizeItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+ nMemberId &= ~CONVERT_TWIPS;
+
+ sal_Int32 nVal;
+ switch ( nMemberId )
+ {
+ case 0 :
+ {
+ com::sun::star::awt::Rectangle aPagePosSize;
+ aPagePosSize.X = aPos.X();
+ aPagePosSize.Y = aPos.Y();
+ aPagePosSize.Width = lWidth;
+ aPagePosSize.Height = lHeight;
+ rVal <<= aPagePosSize;
+ return sal_True;
+ }
+
+ case MID_X: nVal = aPos.X(); break;
+ case MID_Y: nVal = aPos.Y(); break;
+ case MID_WIDTH: nVal = lWidth; break;
+ case MID_HEIGHT: nVal = lHeight; break;
+
+ default: DBG_ERROR("Wrong MemberId!"); return sal_False;
+ }
+
+ rVal <<= nVal;
+ return sal_True;
+}
+
+sal_Bool SvxPagePosSizeItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
+{
+ nMemberId &= ~CONVERT_TWIPS;
+
+ sal_Int32 nVal = 0;
+ if ( nMemberId == 0 )
+ {
+ com::sun::star::awt::Rectangle aPagePosSize;
+ if ( rVal >>= aPagePosSize )
+ {
+ aPos.X() = aPagePosSize.X;
+ aPos.Y() = aPagePosSize.Y;
+ lWidth = aPagePosSize.Width;
+ lHeight = aPagePosSize.Height;
+ return sal_True;
+ }
+ else
+ return sal_False;
+ }
+ else if ( rVal >>= nVal )
+ {
+ switch ( nMemberId )
+ {
+ case MID_X: aPos.X() = nVal; break;
+ case MID_Y: aPos.Y() = nVal; break;
+ case MID_WIDTH: lWidth = nVal; break;
+ case MID_HEIGHT: lHeight = nVal; break;
+
+ default: DBG_ERROR("Wrong MemberId!"); return sal_False;
+ }
+
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+//------------------------------------------------------------------------
+
+String SvxPagePosSizeItem::GetValueText() const
+{
+ return String();
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxPagePosSizeItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& /*rText*/, const IntlWrapper *
+) const
+{
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//------------------------------------------------------------------------
+
+SfxPoolItem* SvxPagePosSizeItem::Clone(SfxItemPool *) const
+{
+ return new SvxPagePosSizeItem(*this);
+}
+
+//------------------------------------------------------------------------
+
+SvxPagePosSizeItem::SvxPagePosSizeItem(const Point &rP, long lW, long lH)
+ : SfxPoolItem(SID_RULER_PAGE_POS),
+ aPos(rP),
+ lWidth(lW),
+ lHeight(lH)
+{}
+
+//------------------------------------------------------------------------
+
+SvxPagePosSizeItem::SvxPagePosSizeItem(const SvxPagePosSizeItem &rCpy)
+ : SfxPoolItem(rCpy),
+ aPos(rCpy.aPos),
+ lWidth(rCpy.lWidth),
+ lHeight(rCpy.lHeight)
+ {}
+
+//------------------------------------------------------------------------
+
+SvxPagePosSizeItem::SvxPagePosSizeItem()
+ : SfxPoolItem( 0 ),
+ aPos( 0, 0 ),
+ lWidth( 0 ),
+ lHeight( 0 )
+{}
+
+//------------------------------------------------------------------------
+
+void SvxColumnItem::DeleteAndDestroyColumns()
+{
+ for( sal_uInt16 i = aColumns.Count(); i>0; )
+ {
+ SvxColumnDescription *pTmp = (SvxColumnDescription *)aColumns[--i];
+ aColumns.Remove( i );
+ delete pTmp;
+ }
+}
+
+//------------------------------------------------------------------------
+
+int SvxColumnItem::operator==(const SfxPoolItem& rCmp) const
+{
+ if(!SfxPoolItem::operator==(rCmp) ||
+ nActColumn != ((const SvxColumnItem&)rCmp).nActColumn ||
+ nLeft != ((const SvxColumnItem&)rCmp).nLeft ||
+ nRight != ((const SvxColumnItem&)rCmp).nRight ||
+ bTable != ((const SvxColumnItem&)rCmp).bTable ||
+ Count() != ((const SvxColumnItem&)rCmp).Count())
+ return sal_False;
+
+ const sal_uInt16 nCount = ((const SvxColumnItem&)rCmp).Count();
+ for(sal_uInt16 i = 0; i < nCount;++i) {
+#if OSL_DEBUG_LEVEL > 1
+ SvxColumnDescription *p1, *p2;
+ p1 = (SvxColumnDescription *)aColumns[i];
+ p2 = (SvxColumnDescription *)((const SvxColumnItem&)rCmp).aColumns[i];
+#endif
+ if( (*this)[i] != ((const SvxColumnItem&)rCmp)[i] )
+ return sal_False;
+ }
+ return sal_True;
+}
+
+//------------------------------------------------------------------------
+
+String SvxColumnItem::GetValueText() const
+{
+ return String();
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxColumnItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& /*rText*/, const IntlWrapper *
+) const
+{
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//------------------------------------------------------------------------
+
+SfxPoolItem* SvxColumnItem::Clone( SfxItemPool * ) const
+{
+ return new SvxColumnItem(*this);
+}
+
+//------------------------------------------------------------------------
+
+SvxColumnItem::SvxColumnItem( sal_uInt16 nAct ) :
+
+ SfxPoolItem( SID_RULER_BORDERS ),
+
+ nLeft ( 0 ),
+ nRight ( 0 ),
+ nActColumn ( nAct ),
+ bTable ( sal_False ),
+ bOrtho (sal_True )
+
+{
+}
+
+//------------------------------------------------------------------------
+
+SvxColumnItem::SvxColumnItem( sal_uInt16 nActCol, sal_uInt16 left, sal_uInt16 right ) :
+
+ SfxPoolItem( SID_RULER_BORDERS ),
+
+ nLeft ( left ),
+ nRight ( right ),
+ nActColumn ( nActCol ),
+ bTable ( sal_True ),
+ bOrtho ( sal_True )
+{
+}
+
+//------------------------------------------------------------------------
+
+SvxColumnItem::SvxColumnItem( const SvxColumnItem& rCopy ) :
+
+ SfxPoolItem( rCopy ),
+
+ aColumns ( (sal_uInt8)rCopy.Count() ),
+ nLeft ( rCopy.nLeft ),
+ nRight ( rCopy.nRight ),
+ nActColumn( rCopy.nActColumn ),
+ bTable ( rCopy.bTable ),
+ bOrtho ( rCopy.bOrtho )
+
+{
+ const sal_uInt16 nCount = rCopy.Count();
+
+ for ( sal_uInt16 i = 0; i < nCount; ++i )
+ Append( rCopy[i] );
+}
+
+//------------------------------------------------------------------------
+
+SvxColumnItem::~SvxColumnItem()
+{
+ DeleteAndDestroyColumns();
+}
+
+//------------------------------------------------------------------------
+
+const SvxColumnItem &SvxColumnItem::operator=(const SvxColumnItem &rCopy)
+{
+ nLeft = rCopy.nLeft;
+ nRight = rCopy.nRight;
+ bTable = rCopy.bTable;
+ nActColumn = rCopy.nActColumn;
+ DeleteAndDestroyColumns();
+ const sal_uInt16 nCount = rCopy.Count();
+ for(sal_uInt16 i = 0; i < nCount;++i)
+ Insert(rCopy[i], i);
+ return *this;
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool SvxColumnItem::CalcOrtho() const
+{
+ const sal_uInt16 nCount = Count();
+ DBG_ASSERT(nCount >= 2, "keine Spalten");
+ if(nCount < 2)
+ return sal_False;
+
+ long nColWidth = (*this)[0].GetWidth();
+ for(sal_uInt16 i = 1; i < nCount; ++i) {
+ if( (*this)[i].GetWidth() != nColWidth)
+ return sal_False;
+ }
+ //!! Breite Trenner
+ return sal_True;
+}
+
+//------------------------------------------------------------------------
+
+long SvxColumnItem::GetVisibleRight() const
+{
+ sal_uInt16 nIdx = 0;
+
+ for ( sal_uInt16 i = 0; i < nActColumn; ++i )
+ {
+ if ( (*this)[i].bVisible )
+ ++nIdx;
+ }
+ return (*this)[nIdx].nEnd;
+}
+
+sal_Bool SvxColumnItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ case MID_COLUMNARRAY:
+ {
+ return sal_False;
+ }
+ case MID_RIGHT: rVal <<= nRight; break;
+ case MID_LEFT: rVal <<= nLeft; break;
+ case MID_ORTHO: rVal <<= (sal_Bool) bOrtho; break;
+ case MID_ACTUAL: rVal <<= (sal_Int32) nActColumn; break;
+ case MID_TABLE: rVal <<= (sal_Bool) bTable; break;
+ default: DBG_ERROR("Wrong MemberId!"); return sal_False;
+ }
+
+ return sal_True;
+}
+
+sal_Bool SvxColumnItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
+{
+ nMemberId &= ~CONVERT_TWIPS;
+ sal_Int32 nVal = 0;
+ switch ( nMemberId )
+ {
+ case MID_COLUMNARRAY:
+ {
+ return sal_False;
+ }
+ case MID_RIGHT: rVal >>= nRight; break;
+ case MID_LEFT: rVal >>= nLeft; break;
+ case MID_ORTHO: rVal >>= nVal; bOrtho = (sal_Bool) nVal; break;
+ case MID_ACTUAL: rVal >>= nVal; nActColumn = (sal_uInt16) nVal; break;
+ case MID_TABLE: rVal >>= nVal; bTable = (sal_Bool) nVal; break;
+ default: DBG_ERROR("Wrong MemberId!"); return sal_False;
+ }
+
+ return sal_True;
+}
+
+//------------------------------------------------------------------------
+
+int SvxObjectItem::operator==( const SfxPoolItem& rCmp ) const
+{
+ return SfxPoolItem::operator==(rCmp) &&
+ nStartX == ((const SvxObjectItem&)rCmp).nStartX &&
+ nEndX == ((const SvxObjectItem&)rCmp).nEndX &&
+ nStartY == ((const SvxObjectItem&)rCmp).nStartY &&
+ nEndY == ((const SvxObjectItem&)rCmp).nEndY &&
+ bLimits == ((const SvxObjectItem&)rCmp).bLimits;
+}
+
+//------------------------------------------------------------------------
+
+String SvxObjectItem::GetValueText() const
+{
+ return String();
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxObjectItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& /*rText*/, const IntlWrapper *
+) const
+{
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//------------------------------------------------------------------------
+
+SfxPoolItem* SvxObjectItem::Clone(SfxItemPool *) const
+{
+ return new SvxObjectItem(*this);
+}
+
+//------------------------------------------------------------------------
+
+SvxObjectItem::SvxObjectItem( long nSX, long nEX,
+ long nSY, long nEY, sal_Bool limits ) :
+
+ SfxPoolItem( SID_RULER_OBJECT ),
+
+ nStartX ( nSX ),
+ nEndX ( nEX ),
+ nStartY ( nSY ),
+ nEndY ( nEY ),
+ bLimits ( limits )
+
+{
+}
+
+//------------------------------------------------------------------------
+
+SvxObjectItem::SvxObjectItem( const SvxObjectItem& rCopy ) :
+
+ SfxPoolItem( rCopy ),
+
+ nStartX ( rCopy.nStartX ),
+ nEndX ( rCopy.nEndX ),
+ nStartY ( rCopy.nStartY ),
+ nEndY ( rCopy.nEndY ),
+ bLimits ( rCopy.bLimits )
+
+{
+}
+
+sal_Bool SvxObjectItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ case MID_START_X : rVal <<= nStartX; break;
+ case MID_START_Y : rVal <<= nStartY; break;
+ case MID_END_X : rVal <<= nEndX; break;
+ case MID_END_Y : rVal <<= nEndY; break;
+ case MID_LIMIT : rVal <<= bLimits; break;
+ default:
+ DBG_ERROR( "Wrong MemberId" );
+ return sal_False;
+ }
+
+ return sal_True;
+}
+
+sal_Bool SvxObjectItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
+{
+ nMemberId &= ~CONVERT_TWIPS;
+ sal_Bool bRet=sal_False;
+ switch ( nMemberId )
+ {
+ case MID_START_X : bRet = (rVal >>= nStartX); break;
+ case MID_START_Y : bRet = (rVal >>= nStartY); break;
+ case MID_END_X : bRet = (rVal >>= nEndX); break;
+ case MID_END_Y : bRet = (rVal >>= nEndY); break;
+ case MID_LIMIT : bRet = (rVal >>= bLimits); break;
+ default: DBG_ERROR( "Wrong MemberId" );
+ }
+
+ return bRet;
+}
+
diff --git a/svx/source/dialog/sdstring.src b/svx/source/dialog/sdstring.src
new file mode 100644
index 000000000000..4b70dda6a151
--- /dev/null
+++ b/svx/source/dialog/sdstring.src
@@ -0,0 +1,1289 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ------------------------------------------------------------------
+#include <svx/dialogs.hrc>
+ // pragma -------------------------------------------------------------------
+
+ // Strings fuer die Draw-Dialoge --------------------------------------------
+String RID_SVXSTR_SOLID
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Durchgängig : Durchgõngig */
+ /* ### ACHTUNG: Neuer Text in Resource? Durchgängig : Durchgõngig */
+ Text [ en-US ] = "Continuous" ;
+};
+String RID_SVXSTR_GRADIENT
+{
+ Text [ en-US ] = "Gradient" ;
+};
+String RID_SVXSTR_BITMAP
+{
+ Text [ en-US ] = "Bitmap" ;
+};
+String RID_SVXSTR_LINESTYLE
+{
+ Text [ en-US ] = "Line Style" ;
+};
+String RID_SVXSTR_INVISIBLE
+{
+ Text [ en-US ] = "Invisible" ;
+};
+String RID_SVXSTR_COLOR
+{
+ Text [ en-US ] = "Color" ;
+};
+String RID_SVXSTR_HATCH
+{
+ Text [ en-US ] = "Hatching" ;
+};
+String RID_SVXSTR_LINEEND
+{
+ Text [ en-US ] = "Arrowheads" ;
+};
+
+String RID_SVXSTR_CLOSE
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Schließen : Schlie˜en */
+ /* ### ACHTUNG: Neuer Text in Resource? Schließen : Schlie˜en */
+ Text [ en-US ] = "Close" ;
+};
+String RID_SVXSTR_BLACK
+{
+ Text [ en-US ] = "Black" ;
+};
+String RID_SVXSTR_BLUE
+{
+ Text [ en-US ] = "Blue" ;
+};
+String RID_SVXSTR_GREEN
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Grün : Gr³n */
+ /* ### ACHTUNG: Neuer Text in Resource? Grün : Gr³n */
+ Text [ en-US ] = "Green" ;
+};
+String RID_SVXSTR_CYAN
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Türkis : T³rkis */
+ /* ### ACHTUNG: Neuer Text in Resource? Türkis : T³rkis */
+ Text [ en-US ] = "Turquoise" ;
+};
+String RID_SVXSTR_RED
+{
+ Text [ en-US ] = "Red" ;
+};
+String RID_SVXSTR_MAGENTA
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Magenta : Violett */
+ Text [ en-US ] = "Magenta" ;
+};
+String RID_SVXSTR_BROWN
+{
+ Text [ en-US ] = "Brown" ;
+};
+String RID_SVXSTR_GREY
+{
+ Text [ en-US ] = "Gray" ;
+};
+String RID_SVXSTR_LIGHTGREY
+{
+ Text [ en-US ] = "Light gray" ;
+};
+String RID_SVXSTR_LIGHTBLUE
+{
+ Text [ en-US ] = "Light blue" ;
+};
+String RID_SVXSTR_LIGHTGREEN
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Hellgrün : Hellgr³n */
+ /* ### ACHTUNG: Neuer Text in Resource? Hellgrün : Hellgr³n */
+ Text [ en-US ] = "Light green" ;
+};
+String RID_SVXSTR_LIGHTCYAN
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Helltürkis : Hellt³rkis */
+ /* ### ACHTUNG: Neuer Text in Resource? Helltürkis : Hellt³rkis */
+ Text [ en-US ] = "Light cyan" ;
+};
+String RID_SVXSTR_LIGHTRED
+{
+ Text [ en-US ] = "Light red" ;
+};
+String RID_SVXSTR_LIGHTMAGENTA
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Hellmagenta : Hellviolett */
+ Text [ en-US ] = "Light magenta" ;
+};
+String RID_SVXSTR_YELLOW
+{
+ Text [ en-US ] = "Yellow" ;
+};
+String RID_SVXSTR_WHITE
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Weiß : Wei˜ */
+ /* ### ACHTUNG: Neuer Text in Resource? Weiß : Wei˜ */
+ Text [ en-US ] = "White" ;
+};
+String RID_SVXSTR_BLUEGREY
+{
+ Text [ en-US ] = "Blue gray" ;
+};
+String RID_SVXSTR_ORANGE
+{
+ Text [ en-US ] = "Orange" ;
+};
+String RID_SVXSTR_ARROW
+{
+ Text [ en-US ] = "Arrow" ;
+};
+String RID_SVXSTR_SQUARE
+{
+ Text [ en-US ] = "Square" ;
+};
+String RID_SVXSTR_CIRCLE
+{
+ Text [ en-US ] = "Circle" ;
+};
+String RID_SVXSTR_NONE
+{
+ Text [ en-US ] = "- none -" ;
+};
+String RID_SVXSTR_TRANSPARENCE
+{
+ Text [ en-US ] = "Transparency" ;
+};
+String RID_SVXSTR_CENTERED
+{
+ Text [ en-US ] = "Centered" ;
+};
+String RID_SVXSTR_NOTCENTERED
+{
+ Text [ en-US ] = "Not centered" ;
+};
+String RID_SVXSTR_GRAFMODE_STANDARD
+{
+ Text [ en-US ] = "Default";
+};
+String RID_SVXSTR_GRAFMODE_GREYS
+{
+ Text [ en-US ] = "Grayscale";
+};
+String RID_SVXSTR_GRAFMODE_MONO
+{
+ Text [ en-US ] = "Black/White";
+};
+String RID_SVXSTR_GRAFMODE_WATERMARK
+{
+ Text [ en-US ] = "Watermark";
+};
+String STR_INSERT_VIDEO_EXTFILTER_IVF
+{
+ Text [ en-US ] = "Intel Indeo Video (*.ivf)" ;
+};
+
+String STR_INSERT_VIDEO_EXTFILTER_AVI
+{
+ Text [ en-US ] = "Video for Windows (*.avi)" ;
+};
+
+String STR_INSERT_VIDEO_EXTFILTER_MOV
+{
+ Text [ en-US ] = "QuickTime Movie (*.mov)" ;
+};
+
+String STR_INSERT_VIDEO_EXTFILTER_MPEG
+{
+ Text [ en-US ] = "MPEG - Motion Pictures Experts Group (*.mpe;*.mpeg;*.mpg)" ;
+};
+
+String STR_EXTFILTER_ALL
+{
+ Text [ en-US ] = "<All>" ;
+};
+
+String STR_INSERT_SOUND_TITLE
+{
+ Text [ en-US ] = "Insert sound" ;
+};
+
+String STR_INSERT_VIDEO_TITLE
+{
+ Text [ en-US ] = "Insert video" ;
+};
+
+
+// BM: some additional standard colors
+
+String RID_SVXSTR_VIOLET
+{
+ Text [ en-US ] = "Violet";
+};
+
+String RID_SVXSTR_BORDEAUX
+{
+ Text [ en-US ] = "Bordeaux";
+};
+
+String RID_SVXSTR_PALE_YELLOW
+{
+ Text [ en-US ] = "Pale yellow";
+};
+
+String RID_SVXSTR_PALE_GREEN
+{
+ Text [ en-US ] = "Pale green";
+};
+
+String RID_SVXSTR_DKVIOLET
+{
+ Text [ en-US ] = "Dark violet";
+};
+
+String RID_SVXSTR_SALMON
+{
+ Text [ en-US ] = "Salmon";
+};
+
+String RID_SVXSTR_SEABLUE
+{
+ Text [ en-US ] = "Sea blue";
+};
+
+String RID_SVXSTR_COLOR_SUN
+{
+ // attention: this is the color string for the Sun Microsystems specific colors !!!
+ Text [ en-US ] = "Sun" ;
+};
+
+String RID_SVXSTR_COLOR_CHART
+{
+ Text [ en-US ] = "Chart" ;
+};
+
+String RID_SVXSTR_TBLAFMT_3D
+{
+ Text [ en-US ] = "3D";
+};
+String RID_SVXSTR_TBLAFMT_BLACK1
+{
+ Text [ en-US ] = "Black 1";
+};
+String RID_SVXSTR_TBLAFMT_BLACK2
+{
+ Text [ en-US ] = "Black 2";
+};
+String RID_SVXSTR_TBLAFMT_BLUE
+{
+ Text [ en-US ] = "Blue";
+};
+String RID_SVXSTR_TBLAFMT_BROWN
+{
+ Text [ en-US ] = "Brown";
+};
+String RID_SVXSTR_TBLAFMT_CURRENCY
+{
+ Text [ en-US ] = "Currency";
+};
+String RID_SVXSTR_TBLAFMT_CURRENCY_3D
+{
+ Text [ en-US ] = "Currency 3D";
+};
+String RID_SVXSTR_TBLAFMT_CURRENCY_GRAY
+{
+ Text [ en-US ] = "Currency Gray";
+};
+String RID_SVXSTR_TBLAFMT_CURRENCY_LAVENDER
+{
+ Text [ en-US ] = "Currency Lavender";
+};
+String RID_SVXSTR_TBLAFMT_CURRENCY_TURQUOISE
+{
+ Text [ en-US ] = "Currency Turquoise";
+};
+String RID_SVXSTR_TBLAFMT_GRAY
+{
+ Text [ en-US ] = "Gray";
+};
+String RID_SVXSTR_TBLAFMT_GREEN
+{
+ Text [ en-US ] = "Green";
+};
+String RID_SVXSTR_TBLAFMT_LAVENDER
+{
+ Text [ en-US ] = "Lavender";
+};
+String RID_SVXSTR_TBLAFMT_RED
+{
+ Text [ en-US ] = "Red";
+};
+String RID_SVXSTR_TBLAFMT_TURQUOISE
+{
+ Text [ en-US ] = "Turquoise";
+};
+String RID_SVXSTR_TBLAFMT_YELLOW
+{
+ Text [ en-US ] = "Yellow";
+};
+
+String RID_SVXSTR_LINEJOINT_MIDDLE
+{
+ Text [ en-US ] = "Line joint averaged";
+};
+String RID_SVXSTR_LINEJOINT_BEVEL
+{
+ Text [ en-US ] = "Line joint bevel";
+};
+String RID_SVXSTR_LINEJOINT_MITER
+{
+ Text [ en-US ] = "Line joint miter";
+};
+String RID_SVXSTR_LINEJOINT_ROUND
+{
+ Text [ en-US ] = "Line joint round";
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Reference-strings for standardcolor-table
+//
+
+/* nicht uebersetzen */
+String RID_SVXSTR_BLACK_DEF
+{
+ Text = "Black" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BLUE_DEF
+{
+ Text = "Blue" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_GREEN_DEF
+{
+ Text = "Green" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_CYAN_DEF
+{
+ Text = "Turquoise" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_RED_DEF
+{
+ Text = "Red" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_MAGENTA_DEF
+{
+ Text = "Magenta" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BROWN_DEF
+{
+ Text = "Brown" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_GREY_DEF
+{
+ Text = "Gray" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LIGHTGREY_DEF
+{
+ Text = "Light gray" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LIGHTBLUE_DEF
+{
+ Text = "Light blue" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LIGHTGREEN_DEF
+{
+ Text = "Light green" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LIGHTCYAN_DEF
+{
+ Text = "Light cyan" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LIGHTRED_DEF
+{
+ Text = "Light red" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LIGHTMAGENTA_DEF
+{
+ Text = "Light magenta" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_YELLOW_DEF
+{
+ Text = "Yellow" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_WHITE_DEF
+{
+ Text = "White" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BLUEGREY_DEF
+{
+ Text = "Blue gray" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_ORANGE_DEF
+{
+ Text = "Orange" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_VIOLET_DEF
+{
+ Text = "Violet";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BORDEAUX_DEF
+{
+ Text = "Bordeaux";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_PALE_YELLOW_DEF
+{
+ Text = "Pale yellow";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_PALE_GREEN_DEF
+{
+ Text = "Pale green";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_DKVIOLET_DEF
+{
+ Text = "Dark violet";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_SALMON_DEF
+{
+ Text = "Salmon";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_SEABLUE_DEF
+{
+ Text = "Sea blue";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_COLOR_SUN_DEF
+{
+ // attention: this is the color string for the Sun Microsystems specific colors !!!
+ Text = "Sun";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_COLOR_CHART_DEF
+{
+ Text = "Chart";
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Reference-strings for standard-gradient-table
+//
+
+/* nicht uebersetzen */
+String RID_SVXSTR_GRDT0_DEF
+{
+ Text = "Gradient";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_GRDT1_DEF
+{
+ Text = "Linear blue/white";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_GRDT2_DEF
+{
+ Text = "Linear magenta/green";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_GRDT3_DEF
+{
+ Text = "Linear yellow/brown";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_GRDT4_DEF
+{
+ Text = "Radial green/black";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_GRDT5_DEF
+{
+ Text = "Radial red/yellow";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_GRDT6_DEF
+{
+ Text = "Rectangular red/white";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_GRDT7_DEF
+{
+ Text = "Square yellow/white";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_GRDT8_DEF
+{
+ Text = "Ellipsoid blue grey/light blue";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_GRDT9_DEF
+{
+ Text = "Axial light red/white";
+};
+
+String RID_SVXSTR_GRDT0
+{
+ Text [ en-US ] = "Gradient";
+};
+String RID_SVXSTR_GRDT1
+{
+ Text [ en-US ] = "Linear blue/white";
+};
+String RID_SVXSTR_GRDT2
+{
+ Text [ en-US ] = "Linear magenta/green";
+};
+String RID_SVXSTR_GRDT3
+{
+ Text [ en-US ] = "Linear yellow/brown";
+};
+String RID_SVXSTR_GRDT4
+{
+ Text [ en-US ] = "Radial green/black";
+};
+String RID_SVXSTR_GRDT5
+{
+ Text [ en-US ] = "Radial red/yellow";
+};
+String RID_SVXSTR_GRDT6
+{
+ Text [ en-US ] = "Rectangular red/white";
+};
+String RID_SVXSTR_GRDT7
+{
+ Text [ en-US ] = "Square yellow/white";
+};
+String RID_SVXSTR_GRDT8
+{
+ Text [ en-US ] = "Ellipsoid blue gray/light blue";
+};
+String RID_SVXSTR_GRDT9
+{
+ Text [ en-US ] = "Axial light red/white";
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Reference-strings for standard-hatch-table
+//
+
+/* nicht uebersetzen */
+String RID_SVXSTR_HATCH0_DEF
+{
+ Text = "Black 45 Degrees Wide";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_HATCH1_DEF
+{
+ Text = "Black 45 Degrees";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_HATCH2_DEF
+{
+ Text = "Black -45 Degrees";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_HATCH3_DEF
+{
+ Text = "Black 90 Degrees";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_HATCH4_DEF
+{
+ Text = "Red Crossed 45 Degrees";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_HATCH5_DEF
+{
+ Text = "Red Crossed 0 Degrees";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_HATCH6_DEF
+{
+ Text = "Blue Crossed 45 Degrees";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_HATCH7_DEF
+{
+ Text = "Blue Crossed 0 Degrees";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_HATCH8_DEF
+{
+ Text = "Blue Triple 90 Degrees";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_HATCH9_DEF
+{
+ Text = "Black 0 Degrees";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_HATCH10_DEF
+{
+ Text = "Hatch";
+};
+
+String RID_SVXSTR_HATCH0
+{
+ Text [ en-US ] = "Black 45 degrees wide";
+};
+String RID_SVXSTR_HATCH1
+{
+ Text [ en-US ] = "Black 45 degrees";
+};
+String RID_SVXSTR_HATCH2
+{
+ Text [ en-US ] = "Black -45 degrees";
+};
+String RID_SVXSTR_HATCH3
+{
+ Text [ en-US ] = "Black 90 degrees";
+};
+String RID_SVXSTR_HATCH4
+{
+ Text [ en-US ] = "Red crossed 45 degrees";
+};
+String RID_SVXSTR_HATCH5
+{
+ Text [ en-US ] = "Red crossed 0 degrees";
+};
+String RID_SVXSTR_HATCH6
+{
+ Text [ en-US ] = "Blue crossed 45 degrees";
+};
+String RID_SVXSTR_HATCH7
+{
+ Text [ en-US ] = "Blue crossed 0 degrees";
+};
+String RID_SVXSTR_HATCH8
+{
+ Text [ en-US ] = "Blue triple 90 degrees";
+};
+String RID_SVXSTR_HATCH9
+{
+ Text [ en-US ] = "Black 0 degrees";
+};
+String RID_SVXSTR_HATCH10
+{
+ Text [ en-US ] = "Hatching" ;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Reference-strings for standard-bitmap-table
+//
+
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP0_DEF
+{
+ Text = "Empty";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP1_DEF
+{
+ Text = "Sky";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP2_DEF
+{
+ Text = "Aqua";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP3_DEF
+{
+ Text = "Coarse";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP4_DEF
+{
+ Text = "Space Metal";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP5_DEF
+{
+ Text = "Space";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP6_DEF
+{
+ Text = "Metal";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP7_DEF
+{
+ Text = "Wet";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP8_DEF
+{
+ Text = "Marble";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP9_DEF
+{
+ Text = "Linen";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP10_DEF
+{
+ Text = "Stone";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP11_DEF
+{
+ Text = "Pebbles";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP12_DEF
+{
+ Text = "Wall";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP13_DEF
+{
+ Text = "Red Wall";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP14_DEF
+{
+ Text = "Pattern";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP15_DEF
+{
+ Text = "Leaves";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP16_DEF
+{
+ Text = "Lawn Artificial";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP17_DEF
+{
+ Text = "Daisy";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP18_DEF
+{
+ Text = "Orange";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP19_DEF
+{
+ Text = "Fiery";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP20_DEF
+{
+ Text = "Roses";
+};
+
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP21_DEF
+{
+ Text = "Bitmape";
+};
+
+String RID_SVXSTR_BMP0
+{
+ Text [ en-US ] = "Blank";
+};
+String RID_SVXSTR_BMP1
+{
+ Text [ en-US ] = "Sky";
+};
+String RID_SVXSTR_BMP2
+{
+ Text [ en-US ] = "Water";
+};
+String RID_SVXSTR_BMP3
+{
+ Text [ en-US ] = "Coarse grained";
+};
+String RID_SVXSTR_BMP4
+{
+ Text [ en-US ] = "Mercury";
+};
+String RID_SVXSTR_BMP5
+{
+ Text [ en-US ] = "Space";
+};
+String RID_SVXSTR_BMP6
+{
+ Text [ en-US ] = "Metal";
+};
+String RID_SVXSTR_BMP7
+{
+ Text [ en-US ] = "Droplets";
+};
+String RID_SVXSTR_BMP8
+{
+ Text [ en-US ] = "Marble";
+};
+String RID_SVXSTR_BMP9
+{
+ Text [ en-US ] = "Linen";
+};
+String RID_SVXSTR_BMP10
+{
+ Text [ en-US ] = "Stone";
+};
+String RID_SVXSTR_BMP11
+{
+ Text [ en-US ] = "Gravel";
+};
+String RID_SVXSTR_BMP12
+{
+ Text [ en-US ] = "Wall";
+};
+String RID_SVXSTR_BMP13
+{
+ Text [ en-US ] = "Brownstone";
+};
+String RID_SVXSTR_BMP14
+{
+ Text [ en-US ] = "Netting";
+};
+String RID_SVXSTR_BMP15
+{
+ Text [ en-US ] = "Leaves";
+};
+String RID_SVXSTR_BMP16
+{
+ Text [ en-US ] = "Artificial Turf";
+};
+String RID_SVXSTR_BMP17
+{
+ Text [ en-US ] = "Daisy";
+};
+String RID_SVXSTR_BMP18
+{
+ Text [ en-US ] = "Orange";
+};
+String RID_SVXSTR_BMP19
+{
+ Text [ en-US ] = "Fiery";
+};
+String RID_SVXSTR_BMP20
+{
+ Text [ en-US ] = "Roses";
+};
+
+String RID_SVXSTR_BMP21
+{
+ Text [ en-US ] = "Bitmap";
+};
+///////////////////////////////////////////////////////////////////////////////
+//
+// Reference-strings for standard-dash-table
+//
+
+/* nicht uebersetzen */
+String RID_SVXSTR_DASH0_DEF
+{
+ Text = "Ultrafine Dashed";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_DASH1_DEF
+{
+ Text = "Fine Dashed";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_DASH2_DEF
+{
+ Text = "Ultrafine 2 Dots 3 Dashes";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_DASH3_DEF
+{
+ Text = "Fine Dotted";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_DASH4_DEF
+{
+ Text = "Line with Fine Dots";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_DASH5_DEF
+{
+ Text = "Fine Dashed (var)";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_DASH6_DEF
+{
+ Text = "3 Dashes 3 Dots (var)";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_DASH7_DEF
+{
+ Text = "Ultrafine Dotted (var)";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_DASH8_DEF
+{
+ Text = "Line Style 9";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_DASH9_DEF
+{
+ Text = "2 Dots 1 Dash";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_DASH10_DEF
+{
+ Text = "Dashed (var)";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_DASH11_DEF
+{
+ Text = "Dash";
+};
+
+String RID_SVXSTR_DASH0
+{
+ Text [ en-US ] = "Ultrafine dashed";
+};
+String RID_SVXSTR_DASH1
+{
+ Text [ en-US ] = "Fine dashed";
+};
+String RID_SVXSTR_DASH2
+{
+ Text [ en-US ] = "Ultrafine 2 dots 3 dashes";
+};
+String RID_SVXSTR_DASH3
+{
+ Text [ en-US ] = "Fine dotted";
+};
+String RID_SVXSTR_DASH4
+{
+ Text [ en-US ] = "Line with fine dots";
+};
+String RID_SVXSTR_DASH5
+{
+ Text [ en-US ] = "Fine dashed (variable)";
+};
+String RID_SVXSTR_DASH6
+{
+ Text [ en-US ] = "3 dashes 3 dots (variable)";
+};
+String RID_SVXSTR_DASH7
+{
+ Text [ en-US ] = "Ultrafine dotted (variable)";
+};
+String RID_SVXSTR_DASH8
+{
+ Text [ en-US ] = "Line style 9";
+};
+String RID_SVXSTR_DASH9
+{
+ Text [ en-US ] = "2 dots 1 dash";
+};
+String RID_SVXSTR_DASH10
+{
+ Text [ en-US ] = "Dashed (variable)";
+};
+String RID_SVXSTR_DASH11
+{
+ Text [ en-US ] = "Dashed";
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Reference-strings for standard-line-end-table
+//
+
+/* nicht uebersetzen */
+String RID_SVXSTR_LEND0_DEF
+{
+ Text = "Arrow concave";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LEND1_DEF
+{
+ Text = "Square 45";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LEND2_DEF
+{
+ Text = "Small Arrow";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LEND3_DEF
+{
+ Text = "Dimension Lines";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LEND4_DEF
+{
+ Text = "Double Arrow";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LEND5_DEF
+{
+ Text = "Rounded short Arrow";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LEND6_DEF
+{
+ Text = "Symmetric Arrow";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LEND7_DEF
+{
+ Text = "Line Arrow";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LEND8_DEF
+{
+ Text = "Rounded large Arrow";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LEND9_DEF
+{
+ Text = "Circle";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LEND10_DEF
+{
+ Text = "Square";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LEND11_DEF
+{
+ Text = "Arrow";
+};
+
+String RID_SVXSTR_LEND0
+{
+ Text [ en-US ] = "Arrow concave";
+};
+String RID_SVXSTR_LEND1
+{
+ Text [ en-US ] = "Square 45";
+};
+String RID_SVXSTR_LEND2
+{
+ Text [ en-US ] = "Small arrow";
+};
+String RID_SVXSTR_LEND3
+{
+ Text [ en-US ] = "Dimension lines";
+};
+String RID_SVXSTR_LEND4
+{
+ Text [ en-US ] = "Double Arrow";
+};
+String RID_SVXSTR_LEND5
+{
+ Text [ en-US ] = "Rounded short arrow";
+};
+String RID_SVXSTR_LEND6
+{
+ Text [ en-US ] = "Symmetric arrow";
+};
+String RID_SVXSTR_LEND7
+{
+ Text [ en-US ] = "Line arrow";
+};
+String RID_SVXSTR_LEND8
+{
+ Text [ en-US ] = "Rounded large arrow";
+};
+String RID_SVXSTR_LEND9
+{
+ Text [ en-US ] = "Circle";
+};
+String RID_SVXSTR_LEND10
+{
+ Text [ en-US ] = "Square";
+};
+String RID_SVXSTR_LEND11
+{
+ Text [ en-US ] = "Arrow";
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Reference-strings for standard transparence gradients
+//
+
+/* nicht uebersetzen */
+String RID_SVXSTR_TRASNGR0_DEF
+{
+ Text = "Transparency";
+};
+
+String RID_SVXSTR_TRASNGR0
+{
+ Text [ en-US ] = "Transparency";
+};
+
+ // ********************************************************************** EOF
+
+ // RID_SVXSTR_FIELDUNIT_TABLE --------------------------------------------
+
+StringArray RID_SVXSTR_FIELDUNIT_TABLE
+{
+ ItemList [ en-US ] =
+ {
+ < "Millimeter" ; FUNIT_MM ; > ;
+ < "Centimeter" ; FUNIT_CM ; > ;
+ < "Meter" ; FUNIT_M ; > ;
+ < "Kilometer" ; FUNIT_KM ; > ;
+ < "Inch" ; FUNIT_INCH ; > ;
+ < "Foot" ; FUNIT_FOOT ; > ;
+ < "Miles" ; FUNIT_MILE ; > ;
+ < "Pica" ; FUNIT_PICA ; > ;
+ < "Point" ; FUNIT_POINT ; > ;
+ };
+ };
+
+// unbekannte Zeichenfarbe
+String RID_SVXSTR_COLOR_USER
+{
+ Text [ en-US ] = "User" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/dialog/sendreportgen.cxx b/svx/source/dialog/sendreportgen.cxx
new file mode 100644
index 000000000000..00295556164f
--- /dev/null
+++ b/svx/source/dialog/sendreportgen.cxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "docrecovery.hxx"
+
+namespace svx{
+ namespace DocRecovery{
+
+ bool ErrorRepSendDialog::ReadParams()
+ {
+ return false;
+ }
+
+ bool ErrorRepSendDialog::SaveParams()
+ {
+ return false;
+ }
+
+ bool ErrorRepSendDialog::SendReport()
+ {
+ return false;
+ }
+
+
+ } // namespace DocRecovery
+} // namespace svx
diff --git a/svx/source/dialog/sendreportunx.cxx b/svx/source/dialog/sendreportunx.cxx
new file mode 100644
index 000000000000..d59bc9bb1cba
--- /dev/null
+++ b/svx/source/dialog/sendreportunx.cxx
@@ -0,0 +1,272 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "docrecovery.hxx"
+#include "osl/file.hxx"
+#include "rtl/bootstrap.hxx"
+#include "rtl/strbuf.hxx"
+#include "tools/appendunixshellword.hxx"
+#include <string>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <pwd.h>
+
+#define RCFILE ".crash_reportrc"
+
+using namespace ::std;
+
+static const char *get_home_dir()
+{
+ struct passwd *ppwd = getpwuid( getuid() );
+
+ return ppwd ? (ppwd->pw_dir ? ppwd->pw_dir : "/") : "/";
+}
+
+static bool read_line( FILE *fp, string& rLine )
+{
+ char szBuffer[1024];
+ bool bSuccess = false;
+ bool bEOL = false;
+ string line;
+
+
+ while ( !bEOL && fgets( szBuffer, sizeof(szBuffer), fp ) )
+ {
+ int len = strlen(szBuffer);
+
+ bSuccess = true;
+
+ while ( len && szBuffer[len - 1] == '\n' )
+ {
+ szBuffer[--len] = 0;
+ bEOL = true;
+ }
+
+ line.append( szBuffer );
+ }
+
+ rLine = line;
+ return bSuccess;
+}
+
+static string trim_string( const string& rString )
+{
+ string temp = rString;
+
+ while ( temp.length() && (temp[0] == ' ' || temp[0] == '\t') )
+ temp.erase( 0, 1 );
+
+ string::size_type len = temp.length();
+
+ while ( len && (temp[len-1] == ' ' || temp[len-1] == '\t') )
+ {
+ temp.erase( len - 1, 1 );
+ len = temp.length();
+ }
+
+ return temp;
+}
+
+static string get_profile_string( const char *pFileName, const char *pSectionName, const char *pKeyName, const char *pDefault = NULL )
+{
+ FILE *fp = fopen( pFileName, "r" );
+ string retValue = pDefault ? pDefault : "";
+
+ if ( fp )
+ {
+ string line;
+ string section;
+
+ while ( read_line( fp, line ) )
+ {
+ line = trim_string( line );
+
+ if ( line.length() && line[0] == '[' )
+ {
+ line.erase( 0, 1 );
+ string::size_type end = line.find( ']', 0 );
+
+ if ( string::npos != end )
+ section = trim_string( line.substr( 0, end ) );
+ }
+ else
+ {
+
+ string::size_type iEqualSign = line.find( '=', 0 );
+
+ if ( iEqualSign != string::npos )
+ {
+ string keyname = line.substr( 0, iEqualSign );
+ keyname = trim_string( keyname );
+
+ string value = line.substr( iEqualSign + 1, string::npos );
+ value = trim_string( value );
+
+ if (
+ 0 == strcasecmp( section.c_str(), pSectionName ) &&
+ 0 == strcasecmp( keyname.c_str(), pKeyName )
+ )
+ {
+ retValue = value;
+ break;
+ }
+ }
+ }
+ }
+
+ fclose( fp );
+ }
+
+ return retValue;
+}
+
+static bool get_profile_bool( const char *pFileName, const char *pSectionName, const char *pKeyName )
+{
+ string str = get_profile_string( pFileName, pSectionName, pKeyName );
+
+ if ( !strcasecmp( str.c_str(), "true" ) )
+ return true;
+ return false;
+}
+
+static String get_profile_String( const char *pFileName, const char *pSectionName, const char *pKeyName, const char * = NULL )
+{
+ string str = get_profile_string( pFileName, pSectionName, pKeyName );
+ String result( str.c_str(), RTL_TEXTENCODING_UTF8 );
+
+ return result;
+}
+
+namespace svx{
+ namespace DocRecovery{
+
+ bool ErrorRepSendDialog::ReadParams()
+ {
+ string sRCFile = get_home_dir();
+
+ sRCFile += "/";
+ sRCFile += string(RCFILE);
+
+ maEMailAddrED.SetText( get_profile_String( sRCFile.c_str(), "Options", "ReturnAddress" ) );
+ maParams.maHTTPProxyServer = get_profile_String( sRCFile.c_str(), "Options", "ProxyServer" );
+ maParams.maHTTPProxyPort = get_profile_String( sRCFile.c_str(), "Options", "ProxyPort" );
+ maParams.miHTTPConnectionType = get_profile_bool( sRCFile.c_str(), "Options", "UseProxy" ) ? 2 : 1;
+ maContactCB.Check( get_profile_bool( sRCFile.c_str(), "Options", "AllowContact" ) );
+
+ return true;
+ }
+
+ bool ErrorRepSendDialog::SaveParams()
+ {
+ bool success = false;
+ string sRCFile = get_home_dir();
+
+ sRCFile += "/";
+ sRCFile += string(RCFILE);
+
+ FILE *fp = fopen( sRCFile.c_str(), "w" );
+
+ if ( fp )
+ {
+ fprintf( fp, "[Options]\n" );
+ fprintf( fp, "UseProxy=%s\n", 2 == maParams.miHTTPConnectionType ? "true" : "false" );
+ fprintf( fp, "ProxyServer=%s\n", ByteString( maParams.maHTTPProxyServer, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+ fprintf( fp, "ProxyPort=%s\n", ByteString( maParams.maHTTPProxyPort, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+ fprintf( fp, "ReturnAddress=%s\n", ByteString( GetEMailAddress(), RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+ fprintf( fp, "AllowContact=%s\n", IsContactAllowed() ? "true" : "false" );
+ fclose( fp );
+ }
+
+ return success;
+ }
+
+ bool ErrorRepSendDialog::SendReport()
+ {
+ ByteString strSubject( GetDocType(), RTL_TEXTENCODING_UTF8 );
+
+#if defined( LINUX ) || defined (MACOSX )
+ setenv( "ERRORREPORT_SUBJECT", strSubject.GetBuffer(), 1 );
+#else
+ static ::rtl::OString strEnvSubject = "ERRORREPORT_SUBJECT";
+ strEnvSubject += "=";
+ strEnvSubject += strSubject.GetBuffer();
+ putenv( (char *)strEnvSubject.getStr() );
+#endif
+
+ char szBodyFile[L_tmpnam] = "";
+ FILE *fp = fopen( tmpnam( szBodyFile ), "w" );
+
+ if ( fp )
+ {
+ ByteString strUTF8( GetUsing(), RTL_TEXTENCODING_UTF8 );
+
+ fwrite( strUTF8.GetBuffer(), 1, strUTF8.Len(), fp );
+ fclose( fp );
+#if defined( LINUX ) || defined (MACOSX)
+ setenv( "ERRORREPORT_BODYFILE", szBodyFile, 1 );
+#else
+ static ::rtl::OString strEnvBodyFile = "ERRORREPORT_BODYFILE";
+ strEnvBodyFile += "=";
+ strEnvBodyFile += szBodyFile;
+ putenv( (char *)strEnvBodyFile.getStr() );
+#endif
+ }
+
+ int ret = -1;
+ rtl::OUString path1(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "$BRAND_BASE_DIR/program/crashrep"));
+ rtl::Bootstrap::expandMacros(path1);
+ rtl::OString path2;
+ if ((osl::FileBase::getSystemPathFromFileURL(path1, path1) ==
+ osl::FileBase::E_None) &&
+ path1.convertToString(
+ &path2, osl_getThreadTextEncoding(),
+ (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)))
+ {
+ rtl::OStringBuffer cmd;
+ tools::appendUnixShellWord(&cmd, path2);
+ cmd.append(RTL_CONSTASCII_STRINGPARAM(" -debug -load -send -noui"));
+ ret = system(cmd.getStr());
+ }
+
+ if ( szBodyFile[0] )
+ {
+ unlink( szBodyFile );
+ }
+
+ return -1 != ret;
+ }
+
+
+ } // namespace DocRecovery
+} // namespace svx
diff --git a/svx/source/dialog/sendreportw32.cxx b/svx/source/dialog/sendreportw32.cxx
new file mode 100644
index 000000000000..7d15a0e2c65e
--- /dev/null
+++ b/svx/source/dialog/sendreportw32.cxx
@@ -0,0 +1,260 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#define UNICODE
+#define _UNICODE
+
+#include <tools/svwin.h>
+
+#define WIN32_LEAN_AND_MEAN
+#include <tchar.h>
+#include <stdio.h>
+#include <systools/win32/uwinapi.h>
+
+// need to undef min and max macros from MS headers here to make
+// the std::min and std::max from stl visible again
+#ifdef min
+#undef min
+#endif
+#ifdef max
+#undef max
+#endif
+
+#include "docrecovery.hxx"
+
+//***************************************************************************
+
+static LONG RegReadValue( HKEY hBaseKey, LPCTSTR lpSubKey, LPCTSTR lpValueName, LPVOID lpData, DWORD cbData )
+{
+ HKEY hKey = NULL;
+ LONG lResult;
+
+ lResult = RegOpenKeyEx( hBaseKey, lpSubKey, 0, KEY_QUERY_VALUE, &hKey );
+
+ if ( ERROR_SUCCESS == lResult )
+ {
+ lResult = RegQueryValueEx( hKey, lpValueName, NULL, NULL, (LPBYTE)lpData, &cbData );
+ RegCloseKey( hKey );
+ }
+
+ return lResult;
+}
+
+//***************************************************************************
+
+static LONG RegWriteValue( HKEY hBaseKey, LPCTSTR lpSubKey, LPCTSTR lpValueName, DWORD dwType, LPCVOID lpData, DWORD cbData )
+{
+ HKEY hKey = NULL;
+ LONG lResult;
+
+ lResult = RegCreateKeyEx( hBaseKey, lpSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL );
+
+ if ( ERROR_SUCCESS == lResult )
+ {
+ lResult = RegSetValueEx( hKey, lpValueName, NULL, dwType, (CONST sal_uInt8 *)lpData, cbData );
+ RegCloseKey( hKey );
+ }
+
+ return lResult;
+}
+
+//***************************************************************************
+
+namespace svx{
+ namespace DocRecovery{
+
+ bool ErrorRepSendDialog::ReadParams()
+ {
+ _TCHAR szBuffer[2048];
+
+ if ( ERROR_SUCCESS == RegReadValue(
+ HKEY_CURRENT_USER,
+ TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"),
+ TEXT("HTTPProxyServer"),
+ szBuffer,
+ sizeof(szBuffer) ) )
+ maParams.maHTTPProxyServer = (sal_Unicode *)szBuffer;
+
+ DWORD dwProxyPort;
+ if ( ERROR_SUCCESS == RegReadValue(
+ HKEY_CURRENT_USER,
+ TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"),
+ TEXT("HTTPProxyPort"),
+ &dwProxyPort,
+ sizeof(dwProxyPort) ) )
+ {
+ _stprintf( szBuffer, _T("%d"), dwProxyPort );
+ maParams.maHTTPProxyPort = (sal_Unicode *)szBuffer;
+ }
+
+ if ( ERROR_SUCCESS == RegReadValue(
+ HKEY_CURRENT_USER,
+ TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"),
+ TEXT("ReturnAddress"),
+ szBuffer,
+ sizeof(szBuffer) ) )
+ maEMailAddrED.SetText( (sal_Unicode *)szBuffer );
+
+ DWORD fAllowContact = sal_False;
+ RegReadValue(
+ HKEY_CURRENT_USER,
+ TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"),
+ TEXT("AllowContact"),
+ &fAllowContact,
+ sizeof(fAllowContact) );
+ maContactCB.Check( (sal_Bool)fAllowContact );
+
+ DWORD uInternetConnection = 0;
+ RegReadValue(
+ HKEY_CURRENT_USER,
+ TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"),
+ TEXT("HTTPConnection"),
+ &uInternetConnection,
+ sizeof(uInternetConnection) );
+ maParams.miHTTPConnectionType = uInternetConnection;
+
+ return true;
+ }
+
+ bool ErrorRepSendDialog::SaveParams()
+ {
+ const _TCHAR *lpHTTPProxyServer = reinterpret_cast<LPCTSTR>(maParams.maHTTPProxyServer.GetBuffer());
+ RegWriteValue(
+ HKEY_CURRENT_USER,
+ TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"),
+ TEXT("HTTPProxyServer"), REG_SZ,
+ lpHTTPProxyServer,
+ sizeof(TCHAR) * (_tcslen(lpHTTPProxyServer) + 1) );
+
+ _TCHAR* endptr = NULL;
+ DWORD dwProxyPort = _tcstoul( reinterpret_cast<LPCTSTR>(maParams.maHTTPProxyPort.GetBuffer()), &endptr, 10 );
+
+ RegWriteValue(
+ HKEY_CURRENT_USER,
+ TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"),
+ TEXT("HTTPProxyPort"), REG_DWORD,
+ &dwProxyPort,
+ sizeof(DWORD) );
+
+ DWORD fAllowContact = IsContactAllowed();
+ RegWriteValue(
+ HKEY_CURRENT_USER,
+ TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"),
+ TEXT("AllowContact"), REG_DWORD,
+ &fAllowContact,
+ sizeof(DWORD) );
+
+
+ DWORD uInternetConnection = maParams.miHTTPConnectionType;
+
+ RegWriteValue(
+ HKEY_CURRENT_USER,
+ TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"),
+ TEXT("HTTPConnection"), REG_DWORD,
+ &uInternetConnection,
+ sizeof(DWORD) );
+
+ const _TCHAR *lpEmail = reinterpret_cast<LPCTSTR>(GetEMailAddress().GetBuffer());
+ RegWriteValue(
+ HKEY_CURRENT_USER,
+ TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"),
+ TEXT("ReturnAddress"), REG_SZ,
+ lpEmail,
+ sizeof(TCHAR) * (_tcslen(lpEmail) + 1) );
+
+ return true;
+ }
+
+ bool ErrorRepSendDialog::SendReport()
+ {
+ TCHAR szTempPath[MAX_PATH];
+ TCHAR szFileName[MAX_PATH];
+
+ GetTempPath( elementsof(szTempPath), szTempPath );
+ GetTempFileName( szTempPath, TEXT("DSC"), 0, szFileName );
+
+ FILE *fp = _tfopen( szFileName, _T("wb") );
+
+ if ( fp )
+ {
+ ByteString strUTF8( GetUsing(), RTL_TEXTENCODING_UTF8 );
+
+ fwrite( strUTF8.GetBuffer(), 1, strUTF8.Len(), fp );
+ fclose( fp );
+ }
+
+ SetEnvironmentVariable( TEXT("ERRORREPORT_SUBJECT"), reinterpret_cast<LPCTSTR>(GetDocType().GetBuffer()) );
+ SetEnvironmentVariable( TEXT("ERRORREPORT_BODYFILE"), szFileName );
+
+ _TCHAR szBuffer[1024];
+ TCHAR szPath[MAX_PATH];
+ LPTSTR lpFilePart;
+ PROCESS_INFORMATION ProcessInfo;
+ STARTUPINFO StartupInfo;
+
+ if ( SearchPath( NULL, TEXT("crashrep.exe"), NULL, MAX_PATH, szPath, &lpFilePart ) )
+ {
+ ZeroMemory( &StartupInfo, sizeof(StartupInfo) );
+ StartupInfo.cb = sizeof(StartupInfo.cb);
+
+ sntprintf( szBuffer, elementsof(szBuffer),
+ _T("%s -noui -load -send"),
+ szPath );
+
+ if (
+ CreateProcess(
+ NULL,
+ szBuffer,
+ NULL,
+ NULL,
+ sal_False,
+ 0,
+ NULL, NULL, &StartupInfo, &ProcessInfo )
+ )
+ {
+ DWORD dwExitCode;
+
+ WaitForSingleObject( ProcessInfo.hProcess, INFINITE );
+ if ( GetExitCodeProcess( ProcessInfo.hProcess, &dwExitCode ) && 0 == dwExitCode )
+ return true;
+
+ }
+ }
+
+ DeleteFile( szFileName );
+
+
+ return false;
+ }
+
+
+ } // namespace DocRecovery
+} // namespace svx
diff --git a/svx/source/dialog/simptabl.cxx b/svx/source/dialog/simptabl.cxx
new file mode 100644
index 000000000000..199464a0966c
--- /dev/null
+++ b/svx/source/dialog/simptabl.cxx
@@ -0,0 +1,579 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// INCLUDE -------------------------------------------------------------------
+
+#include <svx/simptabl.hxx>
+#include <vcl/svapp.hxx>
+
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX
+#include <comphelper/processfactory.hxx>
+#endif
+#include <unotools/intlwrapper.hxx>
+
+// SvxSimpTblContainer ------------------------------------------------------
+
+SvxSimpTblContainer::SvxSimpTblContainer( Window* pParent, WinBits nWinStyle):
+ Control(pParent,nWinStyle)
+{
+ //Do Nothing;
+}
+
+SvxSimpTblContainer::SvxSimpTblContainer( Window* pParent, const ResId& rResId):
+ Control(pParent,rResId)
+{
+ //Do Nothing;
+}
+
+long SvxSimpTblContainer::PreNotify( NotifyEvent& rNEvt )
+{
+ long nResult = sal_True;
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyCode& aKeyCode = rNEvt.GetKeyEvent()->GetKeyCode();
+ sal_uInt16 nKey = aKeyCode.GetCode();
+ if ( nKey == KEY_TAB )
+ GetParent()->Notify( rNEvt );
+ else if ( m_pTable->IsFocusOnCellEnabled() && ( nKey == KEY_LEFT || nKey == KEY_RIGHT ) )
+ return 0;
+ else
+ nResult = Control::PreNotify( rNEvt );
+ }
+ else
+ nResult = Control::PreNotify( rNEvt );
+
+ return nResult;
+}
+
+
+// SvxSimpleTable ------------------------------------------------------------
+
+SvxSimpleTable::SvxSimpleTable( Window* pParent,WinBits nBits ):
+ SvHeaderTabListBox(pParent,WB_CLIPCHILDREN | WB_HSCROLL | WB_TABSTOP),
+ aPrivContainer(pParent,nBits|WB_DIALOGCONTROL),
+ aHeaderBar(pParent,WB_BUTTONSTYLE | WB_BORDER | WB_TABSTOP),
+ nHeaderItemId(1),
+ bResizeFlag(sal_False),
+ bPaintFlag(sal_True)
+{
+ bSortDirection=sal_True;
+ nSortCol=0xFFFF;
+ nOldPos=0;
+
+ SetParent(&aPrivContainer);
+ aHeaderBar.SetParent(&aPrivContainer);
+ aPrivContainer.SetTable( this );
+
+ aHeaderBar.SetStartDragHdl(LINK( this, SvxSimpleTable, StartDragHdl));
+ aHeaderBar.SetDragHdl(LINK( this, SvxSimpleTable, DragHdl));
+ aHeaderBar.SetEndDragHdl(LINK( this, SvxSimpleTable, EndDragHdl));
+ aHeaderBar.SetSelectHdl(LINK( this, SvxSimpleTable, HeaderBarClick));
+ aHeaderBar.SetDoubleClickHdl(LINK( this, SvxSimpleTable, HeaderBarDblClick));
+
+ EnableCellFocus();
+ DisableTransientChildren();
+ InitHeaderBar( &aHeaderBar );
+
+ aHeaderBar.Show();
+ SvHeaderTabListBox::Show();
+}
+
+
+SvxSimpleTable::SvxSimpleTable( Window* pParent,const ResId& rResId):
+ SvHeaderTabListBox(pParent,WB_CLIPCHILDREN | WB_HSCROLL | WB_TABSTOP),
+ aPrivContainer(pParent,rResId),
+ aHeaderBar(pParent,WB_BUTTONSTYLE | WB_BORDER | WB_TABSTOP),
+ nHeaderItemId(1),
+ bResizeFlag(sal_True),
+ bPaintFlag(sal_True)
+{
+
+ bSortDirection=sal_True;
+ nOldPos=0;
+ nSortCol=0xFFFF;
+
+ pMyParentWin=pParent;
+ SetParent(&aPrivContainer);
+ aHeaderBar.SetParent(&aPrivContainer);
+ aPrivContainer.SetTable( this );
+
+ WinBits nBits=aPrivContainer.GetStyle()|WB_DIALOGCONTROL;
+ aPrivContainer.SetStyle(nBits);
+
+ aHeaderBar.SetStartDragHdl(LINK( this, SvxSimpleTable, StartDragHdl));
+ aHeaderBar.SetDragHdl(LINK( this, SvxSimpleTable, DragHdl));
+ aHeaderBar.SetEndDragHdl(LINK( this, SvxSimpleTable, EndDragHdl));
+ aHeaderBar.SetSelectHdl(LINK( this, SvxSimpleTable, HeaderBarClick));
+ aHeaderBar.SetDoubleClickHdl(LINK( this, SvxSimpleTable, HeaderBarDblClick));
+
+ Size theWinSize=aPrivContainer.GetOutputSizePixel();
+ Size HbSize=aHeaderBar.GetSizePixel();
+
+ HbSize.Width()=theWinSize.Width();
+ theWinSize.Height()-=HbSize.Height();
+ Point thePos(0,0);
+
+ aHeaderBar.SetPosPixel(thePos);
+ aHeaderBar.SetSizePixel(HbSize);
+
+ thePos.Y()+=HbSize.Height();
+ SvHeaderTabListBox::SetPosPixel(thePos);
+ SvHeaderTabListBox::SetSizePixel(theWinSize);
+
+ EnableCellFocus();
+ DisableTransientChildren();
+ InitHeaderBar( &aHeaderBar );
+
+ aHeaderBar.Show();
+ SvHeaderTabListBox::Show();
+}
+
+SvxSimpleTable::~SvxSimpleTable()
+{
+ SetParent(pMyParentWin);
+ aPrivContainer.SetParent(this);
+ aHeaderBar.SetParent(this);
+}
+
+
+void SvxSimpleTable::UpdateViewSize()
+{
+ Size theWinSize=aPrivContainer.GetOutputSizePixel();
+ Size HbSize=aHeaderBar.GetSizePixel();
+
+ HbSize.Width()=theWinSize.Width();
+ theWinSize.Height()-=HbSize.Height();
+ Point thePos(0,0);
+
+ aHeaderBar.SetPosPixel(thePos);
+ aHeaderBar.SetSizePixel(HbSize);
+
+ thePos.Y()+=HbSize.Height();
+ SvHeaderTabListBox::SetPosPixel(thePos);
+ SvHeaderTabListBox::SetSizePixel(theWinSize);
+ Invalidate();
+}
+
+void SvxSimpleTable::NotifyScrolled()
+{
+ long nOffset=-GetXOffset();
+ if(nOldPos!=nOffset)
+ {
+ aHeaderBar.SetOffset(nOffset);
+ aHeaderBar.Invalidate();
+ aHeaderBar.Update();
+ nOldPos=nOffset;
+ }
+ SvHeaderTabListBox::NotifyScrolled();
+}
+
+void SvxSimpleTable::SetTabs()
+{
+ SvHeaderTabListBox::SetTabs();
+
+ sal_uInt16 nPrivTabCount = TabCount();
+ if ( nPrivTabCount )
+ {
+ if ( nPrivTabCount > aHeaderBar.GetItemCount() )
+ nPrivTabCount = aHeaderBar.GetItemCount();
+
+ sal_uInt16 i, nNewSize = static_cast< sal_uInt16 >( GetTab(0) ), nPos = 0;
+ for ( i = 1; i < nPrivTabCount; ++i )
+ {
+ nNewSize = static_cast< sal_uInt16 >( GetTab(i) ) - nPos;
+ aHeaderBar.SetItemSize( i, nNewSize );
+ nPos = (sal_uInt16)GetTab(i);
+ }
+
+ aHeaderBar.SetItemSize( i, HEADERBAR_FULLSIZE ); // because no tab for last entry
+ }
+}
+
+void SvxSimpleTable::SetTabs( long* pTabs, MapUnit eMapUnit)
+{
+ SvHeaderTabListBox::SetTabs(pTabs,eMapUnit);
+}
+
+void SvxSimpleTable::Paint( const Rectangle& rRect )
+{
+ SvHeaderTabListBox::Paint(rRect );
+
+ sal_uInt16 nPrivTabCount = TabCount();
+ sal_uInt16 nPos = 0;
+ sal_uInt16 nNewSize = ( nPrivTabCount > 0 ) ? (sal_uInt16)GetTab(0) : 0;
+
+ long nOffset=-GetXOffset();
+ nOldPos=nOffset;
+
+ aHeaderBar.SetOffset(nOffset);
+ aHeaderBar.Invalidate();
+
+ if(nPrivTabCount && bPaintFlag)
+ {
+ if(nPrivTabCount>aHeaderBar.GetItemCount())
+ nPrivTabCount=aHeaderBar.GetItemCount();
+
+ for(sal_uInt16 i=1;i<nPrivTabCount;i++)
+ {
+ nNewSize = static_cast< sal_uInt16 >( GetTab(i) ) - nPos;
+ aHeaderBar.SetItemSize( i, nNewSize );
+ nPos= static_cast< sal_uInt16 >( GetTab(i) );
+ }
+ }
+ bPaintFlag=sal_True;
+}
+void SvxSimpleTable::InsertHeaderEntry(const XubString& rText,sal_uInt16 nCol,
+ HeaderBarItemBits nBits)
+{
+ xub_StrLen nEnd = rText.Search( sal_Unicode( '\t' ) );
+ if( nEnd == STRING_NOTFOUND )
+ {
+ aHeaderBar.InsertItem(nHeaderItemId++, rText, 0, nBits, nCol);
+ }
+ else
+ {
+ xub_StrLen nCount = rText.GetTokenCount( sal_Unicode( '\t' ) );
+
+ for( xub_StrLen i=0; i<nCount; i++ )
+ {
+ String aString=rText.GetToken(i, sal_Unicode( '\t' ) );
+ aHeaderBar.InsertItem(nHeaderItemId++, aString, 0, nBits, nCol);
+ }
+ }
+ SetTabs();
+}
+
+void SvxSimpleTable::ClearAll()
+{
+ aHeaderBar.Clear();
+ Clear();
+}
+void SvxSimpleTable::ClearHeader()
+{
+ aHeaderBar.Clear();
+}
+
+void SvxSimpleTable::ShowTable()
+{
+ aPrivContainer.Show();
+}
+
+void SvxSimpleTable::HideTable()
+{
+ aPrivContainer.Hide();
+}
+
+sal_Bool SvxSimpleTable::IsVisible() const
+{
+ return aPrivContainer.IsVisible();
+}
+
+void SvxSimpleTable::EnableTable()
+{
+ aPrivContainer.Enable();
+}
+
+void SvxSimpleTable::DisableTable()
+{
+ aPrivContainer.Disable();
+}
+
+sal_Bool SvxSimpleTable::IsEnabled() const
+{
+ return aPrivContainer.IsEnabled();
+}
+
+void SvxSimpleTable::TableToTop()
+{
+ aPrivContainer.ToTop();
+}
+
+void SvxSimpleTable::SetPosPixel( const Point& rNewPos )
+{
+ aPrivContainer.SetPosPixel(rNewPos);
+}
+
+Point SvxSimpleTable::GetPosPixel() const
+{
+ return aPrivContainer.GetPosPixel();
+}
+
+void SvxSimpleTable::SetPosSizePixel( const Point& rNewPos, Size& rNewSize )
+{
+ aPrivContainer.SetPosPixel(rNewPos);
+ aPrivContainer.SetSizePixel(rNewSize);
+}
+
+void SvxSimpleTable::SetPosSize( const Point& rNewPos, const Size& rNewSize )
+{
+ aPrivContainer.SetPosPixel(rNewPos);
+ SvHeaderTabListBox::SetPosSizePixel(rNewPos,rNewSize);
+}
+
+Size SvxSimpleTable::GetSizePixel() const
+{
+ return aPrivContainer.GetSizePixel();
+}
+
+Size SvxSimpleTable::GetOutputSizePixel() const
+{
+ return aPrivContainer.GetOutputSizePixel();
+}
+
+void SvxSimpleTable::SetSizePixel(const Size& rNewSize )
+{
+ aPrivContainer.SetSizePixel(rNewSize);
+ UpdateViewSize();
+}
+
+void SvxSimpleTable::SetOutputSizePixel(const Size& rNewSize )
+{
+ aPrivContainer.SetOutputSizePixel(rNewSize);
+ UpdateViewSize();
+}
+
+sal_uInt16 SvxSimpleTable::GetSelectedCol()
+{
+ return (aHeaderBar.GetCurItemId()-1);
+}
+
+void SvxSimpleTable::SortByCol(sal_uInt16 nCol,sal_Bool bDir)
+{
+ bSortDirection=bDir;
+ if(nSortCol!=0xFFFF)
+ aHeaderBar.SetItemBits(nSortCol+1,HIB_STDSTYLE);
+
+ if (nCol != 0xFFFF)
+ {
+ if(bDir)
+ {
+ aHeaderBar.SetItemBits( nCol+1, HIB_STDSTYLE | HIB_DOWNARROW);
+ GetModel()->SetSortMode(SortAscending);
+ }
+ else
+ {
+ aHeaderBar.SetItemBits( nCol+1, HIB_STDSTYLE | HIB_UPARROW);
+ GetModel()->SetSortMode(SortDescending);
+ }
+ nSortCol=nCol;
+ GetModel()->SetCompareHdl( LINK( this, SvxSimpleTable, CompareHdl));
+ GetModel()->Resort();
+ }
+ else
+ GetModel()->SetSortMode(SortNone);
+ nSortCol=nCol;
+}
+
+void SvxSimpleTable::HBarClick()
+{
+ sal_uInt16 nId=aHeaderBar.GetCurItemId();
+
+ if (aHeaderBar.GetItemBits(nId) & HIB_CLICKABLE)
+ {
+ if(nId==nSortCol+1)
+ {
+ SortByCol(nId-1,!bSortDirection);
+ }
+ else
+ {
+ SortByCol(nId-1,bSortDirection);
+ }
+
+ aHeaderBarClickLink.Call(this);
+ }
+}
+
+void SvxSimpleTable::HBarDblClick()
+{
+ aHeaderBarDblClickLink.Call(this);
+}
+
+void SvxSimpleTable::HBarStartDrag()
+{
+ if(!aHeaderBar.IsItemMode())
+ {
+ Rectangle aSizeRect(Point(0,0),
+ SvHeaderTabListBox::GetOutputSizePixel());
+ aSizeRect.Left()=-GetXOffset()+aHeaderBar.GetDragPos();
+ aSizeRect.Right()=-GetXOffset()+aHeaderBar.GetDragPos();
+ ShowTracking( aSizeRect, SHOWTRACK_SPLIT );
+ }
+}
+void SvxSimpleTable::HBarDrag()
+{
+ HideTracking();
+ if(!aHeaderBar.IsItemMode())
+ {
+ Rectangle aSizeRect(Point(0,0),
+ SvHeaderTabListBox::GetOutputSizePixel());
+ aSizeRect.Left()=-GetXOffset()+aHeaderBar.GetDragPos();
+ aSizeRect.Right()=-GetXOffset()+aHeaderBar.GetDragPos();
+ ShowTracking( aSizeRect, SHOWTRACK_SPLIT );
+ }
+}
+void SvxSimpleTable::HBarEndDrag()
+{
+ HideTracking();
+ sal_uInt16 nPrivTabCount=TabCount();
+ sal_uInt16 nPos=0;
+ sal_uInt16 nNewSize=0;
+
+ if(nPrivTabCount)
+ {
+ if(nPrivTabCount>aHeaderBar.GetItemCount())
+ nPrivTabCount=aHeaderBar.GetItemCount();
+
+ //for(sal_uInt16 i=1;i<=nPrivTabCount;i++)
+ for(sal_uInt16 i=1;i<nPrivTabCount;i++)
+ {
+ nNewSize = static_cast< sal_uInt16 >( aHeaderBar.GetItemSize(i) ) + nPos;
+ SetTab( i, nNewSize, MAP_PIXEL );
+ nPos = nNewSize;
+ }
+ }
+ bPaintFlag=sal_False;
+ Invalidate();
+ Update();
+}
+
+CommandEvent SvxSimpleTable::GetCommandEvent() const
+{
+ return aCEvt;
+}
+
+void SvxSimpleTable::Command( const CommandEvent& rCEvt )
+{
+ aCEvt=rCEvt;
+ aCommandLink.Call(this);
+ SvHeaderTabListBox::Command(rCEvt);
+}
+
+IMPL_LINK( SvxSimpleTable, StartDragHdl, HeaderBar*, pCtr)
+{
+ if(pCtr==&aHeaderBar)
+ {
+ HBarStartDrag();
+ }
+ return 0;
+}
+
+IMPL_LINK( SvxSimpleTable, DragHdl, HeaderBar*, pCtr)
+{
+ if(pCtr==&aHeaderBar)
+ {
+ HBarDrag();
+ }
+ return 0;
+}
+
+IMPL_LINK( SvxSimpleTable, EndDragHdl, HeaderBar*, pCtr)
+{
+ if(pCtr==&aHeaderBar)
+ {
+ HBarEndDrag();
+ }
+ return 0;
+}
+
+IMPL_LINK( SvxSimpleTable, HeaderBarClick, HeaderBar*, pCtr)
+{
+ if(pCtr==&aHeaderBar)
+ {
+ HBarClick();
+ }
+ return 0;
+}
+
+IMPL_LINK( SvxSimpleTable, HeaderBarDblClick, HeaderBar*, pCtr)
+{
+ if(pCtr==&aHeaderBar)
+ {
+ HBarDblClick();
+ }
+ return 0;
+}
+
+SvLBoxItem* SvxSimpleTable::GetEntryAtPos( SvLBoxEntry* pEntry, sal_uInt16 nPos ) const
+{
+ DBG_ASSERT(pEntry,"GetEntryText:Invalid Entry");
+ SvLBoxItem* pItem = NULL;
+
+ if( pEntry )
+ {
+ sal_uInt16 nCount = pEntry->ItemCount();
+
+ nPos++;
+
+ if( nTreeFlags & TREEFLAG_CHKBTN ) nPos++;
+
+ if( nPos < nCount )
+ {
+ pItem = pEntry->GetItem( nPos);
+ }
+ }
+ return pItem;
+}
+
+StringCompare SvxSimpleTable::ColCompare(SvLBoxEntry* pLeft,SvLBoxEntry* pRight)
+{
+ StringCompare eCompare=COMPARE_EQUAL;
+
+ SvLBoxItem* pLeftItem = GetEntryAtPos( pLeft, nSortCol);
+ SvLBoxItem* pRightItem = GetEntryAtPos( pRight, nSortCol);
+
+
+ if(pLeftItem != NULL && pRightItem != NULL)
+ {
+ sal_uInt16 nLeftKind=pLeftItem->IsA();
+ sal_uInt16 nRightKind=pRightItem->IsA();
+
+ if(nRightKind == SV_ITEM_ID_LBOXSTRING &&
+ nLeftKind == SV_ITEM_ID_LBOXSTRING )
+ {
+ IntlWrapper aIntlWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
+ const CollatorWrapper* pCollator = aIntlWrapper.getCaseCollator();
+
+ eCompare=(StringCompare)pCollator->compareString( ((SvLBoxString*)pLeftItem)->GetText(),
+ ((SvLBoxString*)pRightItem)->GetText());
+
+ if(eCompare==COMPARE_EQUAL) eCompare=COMPARE_LESS;
+ }
+ }
+ return eCompare;
+}
+
+IMPL_LINK( SvxSimpleTable, CompareHdl, SvSortData*, pData)
+{
+ SvLBoxEntry* pLeft = (SvLBoxEntry*)(pData->pLeft );
+ SvLBoxEntry* pRight = (SvLBoxEntry*)(pData->pRight );
+ return (long) ColCompare(pLeft,pRight);
+}
+
+
diff --git a/svx/source/dialog/srchctrl.cxx b/svx/source/dialog/srchctrl.cxx
new file mode 100644
index 000000000000..fe60ac939811
--- /dev/null
+++ b/svx/source/dialog/srchctrl.cxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/pstm.hxx>
+#include <svl/intitem.hxx>
+#include <sfx2/objsh.hxx>
+
+#include <svx/svxids.hrc>
+
+#define _SVX_SRCHDLG_CXX // damit private-Methoden vom SrchDlg bekannt sind
+
+
+
+#include "srchctrl.hxx"
+#include "svx/srchdlg.hxx"
+#include <svl/srchitem.hxx>
+
+// class SvxSearchFamilyControllerItem -----------------------------------
+
+SvxSearchController::SvxSearchController
+(
+ sal_uInt16 _nId,
+ SfxBindings& rBind,
+ SvxSearchDialog& rDlg
+) :
+ SfxControllerItem( _nId, rBind ),
+
+ rSrchDlg( rDlg )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchController::StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState )
+{
+ if ( SFX_ITEM_AVAILABLE == eState )
+ {
+ if ( SID_STYLE_FAMILY1 <= nSID && nSID <= SID_STYLE_FAMILY4 )
+ {
+ SfxObjectShell* pShell = SfxObjectShell::Current();
+
+ if ( pShell && pShell->GetStyleSheetPool() )
+ rSrchDlg.TemplatesChanged_Impl( *pShell->GetStyleSheetPool() );
+ }
+ else if ( SID_SEARCH_OPTIONS == nSID )
+ {
+ DBG_ASSERT( pState->ISA(SfxUInt16Item), "wrong item type" );
+ sal_uInt16 nFlags = (sal_uInt16)( (SfxUInt16Item*)pState )->GetValue();
+ rSrchDlg.EnableControls_Impl( nFlags );
+ }
+ else if ( SID_SEARCH_ITEM == nSID )
+ {
+ DBG_ASSERT( pState->ISA(SvxSearchItem), "wrong item type" );
+ rSrchDlg.SetItem_Impl( (const SvxSearchItem*)pState );
+ }
+ }
+ else if ( SID_SEARCH_OPTIONS == nSID || SID_SEARCH_ITEM == nSID )
+ rSrchDlg.EnableControls_Impl( 0 );
+}
+
+
diff --git a/svx/source/dialog/srchctrl.hxx b/svx/source/dialog/srchctrl.hxx
new file mode 100644
index 000000000000..6320ddeb8420
--- /dev/null
+++ b/svx/source/dialog/srchctrl.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_SRCHCTRL_HXX
+#define _SVX_SRCHCTRL_HXX
+
+// include ---------------------------------------------------------------
+
+
+#include <sfx2/ctrlitem.hxx>
+// class SvxSearchFamilyController ---------------------------------------
+
+class SvxSearchDialog;
+
+class SvxSearchController : public SfxControllerItem
+{
+ SvxSearchDialog& rSrchDlg;
+
+protected:
+ virtual void StateChanged( sal_uInt16, SfxItemState, const SfxPoolItem* pState );
+
+public:
+ SvxSearchController( sal_uInt16 nId, SfxBindings& rBnd, SvxSearchDialog& rDlg );
+};
+
+
+#endif
+
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
new file mode 100644
index 000000000000..5f91c6dabacb
--- /dev/null
+++ b/svx/source/dialog/srchdlg.cxx
@@ -0,0 +1,2549 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <vcl/wrkwin.hxx>
+#include <vcl/morebtn.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/slstitm.hxx>
+#include <svl/itemiter.hxx>
+#include <svl/style.hxx>
+#include <unotools/searchopt.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/module.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <svl/cjkoptions.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <comphelper/processfactory.hxx>
+#include <svl/itempool.hxx>
+#include <svl/intitem.hxx>
+
+#include <sfx2/app.hxx>
+#include <toolkit/unohlp.hxx>
+
+#define _SVX_SRCHDLG_CXX
+#include "svx/srchdlg.hxx"
+
+#include <svx/dialogs.hrc>
+#include <svx/svxitems.hrc>
+#include "srchdlg.hrc"
+
+
+#define ITEMID_SETITEM 0
+
+#include <svl/srchitem.hxx>
+#include <svx/pageitem.hxx>
+#include "srchctrl.hxx"
+#include <svx/dialmgr.hxx>
+#include "svx/dlgutil.hxx"
+#include <editeng/brshitem.hxx>
+#include <tools/resary.hxx>
+#include <svx/svxdlg.hxx> //CHINA001
+
+#include <sfx2/layout-pre.hxx>
+
+using namespace com::sun::star::i18n;
+using namespace com::sun::star;
+using namespace comphelper;
+
+// -----------------------------------------------------------------------
+
+#define REMEMBER_SIZE 10
+
+#define MODIFY_SEARCH 0x00000001
+#define MODIFY_REPLACE 0x00000002
+#define MODIFY_WORD 0x00000004
+#define MODIFY_EXACT 0x00000008
+#define MODIFY_BACKWARDS 0x00000010
+#define MODIFY_SELECTION 0x00000020
+#define MODIFY_REGEXP 0x00000040
+#define MODIFY_LAYOUT 0x00000080
+#define MODIFY_SIMILARITY 0x00000100
+#define MODIFY_FORMULAS 0x00000200
+#define MODIFY_VALUES 0x00000400
+#define MODIFY_CALC_NOTES 0x00000800
+#define MODIFY_ROWS 0x00001000
+#define MODIFY_COLUMNS 0x00002000
+#define MODIFY_ALLTABLES 0x00004000
+#define MODIFY_NOTES 0x00008000
+
+SV_IMPL_VARARR(SrchAttrItemList, SearchAttrItem);
+
+//#define NotifyApp( nId )
+// rBindings.ExecuteSynchron( nId, (const SfxPoolItem**)&pSearchItem, 0L )
+
+#define GetCheckBoxValue( rBox ) \
+ rBox.IsEnabled() ? rBox.IsChecked() : sal_False
+
+#if ENABLE_LAYOUT
+#undef SVX_RES
+#define SVX_RES(x) #x
+#endif /* ENABLE_LAYOUT */
+
+struct SearchDlg_Impl
+{
+ FixedText aSearchFormats;
+ FixedText aReplaceFormats;
+
+ sal_Bool bMultiLineEdit : 1,
+ bSaveToModule : 1,
+ bFocusOnSearch : 1,
+ bDeltaCalculated : 1;
+ sal_uInt16* pRanges;
+ Timer aSelectionTimer;
+
+ uno::Reference< frame::XDispatch > xCommand1Dispatch;
+ uno::Reference< frame::XDispatch > xCommand2Dispatch;
+ util::URL aCommand1URL;
+ util::URL aCommand2URL;
+
+#if ENABLE_LAYOUT
+ SearchDlg_Impl( layout::Context* pParent ) :
+#else /* !ENABLE_LAYOUT */
+ SearchDlg_Impl( Window* pParent ) :
+#endif /* !ENABLE_LAYOUT */
+ aSearchFormats ( pParent, SVX_RES( FT_SEARCH_FORMATS ) ),
+ aReplaceFormats ( pParent, SVX_RES( FT_REPLACE_FORMATS ) ),
+ bMultiLineEdit ( sal_False ),
+ bSaveToModule ( sal_True ),
+ bFocusOnSearch ( sal_True ),
+ bDeltaCalculated( sal_False ),
+ pRanges ( NULL )
+ {
+ aCommand1URL.Complete = aCommand1URL.Main = rtl::OUString::createFromAscii("vnd.sun.search:SearchViaComponent1");
+ aCommand1URL.Protocol = rtl::OUString::createFromAscii("vnd.sun.search:");
+ aCommand1URL.Path = rtl::OUString::createFromAscii("SearchViaComponent1");
+ aCommand2URL.Complete = aCommand2URL.Main = rtl::OUString::createFromAscii("vnd.sun.search:SearchViaComponent2");
+ aCommand2URL.Protocol = rtl::OUString::createFromAscii("vnd.sun.search:");
+ aCommand2URL.Path = rtl::OUString::createFromAscii("SearchViaComponent2");
+ }
+ ~SearchDlg_Impl() { delete[] pRanges; }
+};
+
+// -----------------------------------------------------------------------
+
+void ListToStrArr_Impl( sal_uInt16 nId, SvStringsDtor& rStrLst, ComboBox& rCBox )
+{
+ SfxStringListItem* pSrchItem =
+ (SfxStringListItem*)SFX_APP()->GetItem( nId );
+ List* pLst = pSrchItem ? pSrchItem->GetList() : 0;
+
+ if ( pLst )
+ for ( sal_uInt16 i = 0; i < pLst->Count(); ++i )
+ {
+ String* pTmp = new String( *(String*)( pLst->GetObject(i) ) );
+ rStrLst.Insert( pTmp, rStrLst.Count() );
+ rCBox.InsertEntry( *pTmp );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void StrArrToList_Impl( sal_uInt16 nId, const SvStringsDtor& rStrLst )
+{
+ DBG_ASSERT( rStrLst.Count(), "vorher abpruefen!!" );
+ List aLst;
+
+ for ( sal_uInt16 i = 0; i < rStrLst.Count(); ++i )
+ aLst.Insert( rStrLst[ i ], LIST_APPEND );
+
+ SFX_APP()->PutItem( SfxStringListItem( nId, &aLst ) );
+}
+
+// class SearchAttrItemList ----------------------------------------------
+
+SearchAttrItemList::SearchAttrItemList( const SearchAttrItemList& rList ) :
+
+ SrchAttrItemList( (sal_uInt8)rList.Count() )
+
+{
+ SrchAttrItemList::Insert( &rList, 0 );
+ SearchAttrItem* _pData = (SearchAttrItem*)GetData();
+
+ for ( sal_uInt16 i = Count(); i; --i, ++_pData )
+ if ( !IsInvalidItem( _pData->pItem ) )
+ _pData->pItem = _pData->pItem->Clone();
+}
+
+// -----------------------------------------------------------------------
+
+SearchAttrItemList::~SearchAttrItemList()
+{
+ Clear();
+}
+
+// -----------------------------------------------------------------------
+
+void SearchAttrItemList::Put( const SfxItemSet& rSet )
+{
+ if ( !rSet.Count() )
+ return;
+
+ SfxItemPool* pPool = rSet.GetPool();
+ SfxItemIter aIter( rSet );
+ SearchAttrItem aItem;
+ const SfxPoolItem* pItem = aIter.GetCurItem();
+ sal_uInt16 nWhich;
+
+ while ( sal_True )
+ {
+ // nur testen, ob vorhanden ist ?
+ if( IsInvalidItem( pItem ) )
+ {
+ nWhich = rSet.GetWhichByPos( aIter.GetCurPos() );
+ aItem.pItem = (SfxPoolItem*)pItem;
+ }
+ else
+ {
+ nWhich = pItem->Which();
+ aItem.pItem = pItem->Clone();
+ }
+
+ aItem.nSlot = pPool->GetSlotId( nWhich );
+ Insert( aItem );
+
+ if ( aIter.IsAtEnd() )
+ break;
+ pItem = aIter.NextItem();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SfxItemSet& SearchAttrItemList::Get( SfxItemSet& rSet )
+{
+ SfxItemPool* pPool = rSet.GetPool();
+ SearchAttrItem* _pData = (SearchAttrItem*)GetData();
+
+ for ( sal_uInt16 i = Count(); i; --i, ++_pData )
+ if ( IsInvalidItem( _pData->pItem ) )
+ rSet.InvalidateItem( pPool->GetWhich( _pData->nSlot ) );
+ else
+ rSet.Put( *_pData->pItem );
+ return rSet;
+}
+
+// -----------------------------------------------------------------------
+
+void SearchAttrItemList::Clear()
+{
+ SearchAttrItem* _pData = (SearchAttrItem*)GetData();
+
+ for ( sal_uInt16 i = Count(); i; --i, ++_pData )
+ if ( !IsInvalidItem( _pData->pItem ) )
+ delete _pData->pItem;
+ SrchAttrItemList::Remove( 0, Count() );
+}
+
+// -----------------------------------------------------------------------
+
+// l"oscht die Pointer auf die Items
+void SearchAttrItemList::Remove( sal_uInt16 nPos, sal_uInt16 nLen )
+{
+ if ( nPos + nLen > Count() )
+ nLen = Count() - nPos;
+ SearchAttrItem* _pData = (SearchAttrItem*)GetData() + nPos;
+
+ for ( sal_uInt16 n = nLen; n; --n, ++_pData )
+ if ( !IsInvalidItem( _pData->pItem ) )
+ delete _pData->pItem;
+
+ SrchAttrItemList::Remove( nPos, nLen );
+}
+
+#if ENABLE_LAYOUT
+#undef SfxModelessDialog
+#define SfxModelessDialog(bindings, child, parent, id) SfxDialog (parent, "find-and-replace.xml", id, bindings, child)
+#define SVX_RES_PLAIN(x) ResId (x, DIALOG_MGR ())
+#define THIS_SVX_RES(x) this, #x
+#else /* !ENABLE_LAYOUT */
+#define SVX_RES_PLAIN SVX_RES
+#define THIS_SVX_RES SVX_RES
+#endif /* !ENABLE_LAYOUT */
+
+#undef INI_LIST
+#define INI_LIST() \
+ aSearchText ( this, SVX_RES( FT_SEARCH ) ), \
+ aSearchLB ( this, SVX_RES( ED_SEARCH ) ), \
+ aSearchTmplLB ( this, SVX_RES( LB_SEARCH ) ), \
+ aSearchAttrText ( this, SVX_RES( FT_SEARCH_ATTR ) ), \
+ aReplaceText ( this, SVX_RES( FT_REPLACE ) ), \
+ aReplaceLB ( this, SVX_RES( ED_REPLACE ) ), \
+ aReplaceTmplLB ( this, SVX_RES( LB_REPLACE ) ), \
+ aReplaceAttrText( this, SVX_RES( FT_REPLACE_ATTR ) ), \
+ aSearchBtn ( this, SVX_RES( BTN_SEARCH ) ), \
+ aSearchAllBtn ( this, SVX_RES( BTN_SEARCH_ALL ) ), \
+ aSearchCmdLine ( this, SVX_RES( FL_SEARCH_COMMAND ) ), \
+ aReplaceBtn ( this, SVX_RES( BTN_REPLACE ) ), \
+ aReplaceAllBtn ( this, SVX_RES( BTN_REPLACE_ALL ) ), \
+ aSearchComponentFL( this, SVX_RES( FL_SEARCH_COMPONENT ) ), \
+ aSearchComponent1PB( this, SVX_RES( BTN_COMPONENT_1 ) ), \
+ aSearchComponent2PB( this, SVX_RES( BTN_COMPONENT_2 ) ), \
+ aMatchCaseCB ( this, SVX_RES( CB_MATCH_CASE ) ), \
+ aWordBtn ( this, SVX_RES( CB_WHOLE_WORDS ) ), \
+ aButtonsFL ( this, SVX_RES( FL_BUTTONS ) ), \
+ pMoreBtn ( new MoreButton( this, SVX_RES( BTN_MORE ) ) ), \
+ aHelpBtn ( this, SVX_RES( BTN_HELP ) ), \
+ aCloseBtn ( this, SVX_RES( BTN_CLOSE ) ), \
+ aOptionsFL ( this, SVX_RES( FL_OPTIONS ) ), \
+ aSelectionBtn ( this, SVX_RES( CB_SELECTIONS ) ), \
+ aBackwardsBtn ( this, SVX_RES( CB_BACKWARDS ) ), \
+ aRegExpBtn ( this, SVX_RES( CB_REGEXP ) ), \
+ aSimilarityBox ( this, SVX_RES( CB_SIMILARITY) ), \
+ aSimilarityBtn ( this, SVX_RES( PB_SIMILARITY) ), \
+ aLayoutBtn ( this, SVX_RES( CB_LAYOUTS ) ), \
+ aNotesBtn ( this, SVX_RES( CB_NOTES ) ), \
+ aJapMatchFullHalfWidthCB( this, SVX_RES( CB_JAP_MATCH_FULL_HALF_WIDTH ) ),\
+ aJapOptionsCB ( this, SVX_RES( CB_JAP_SOUNDS_LIKE ) ), \
+ aJapOptionsBtn ( this, SVX_RES( PB_JAP_OPTIONS ) ), \
+ aAttributeBtn ( this, SVX_RES( BTN_ATTRIBUTE ) ), \
+ aFormatBtn ( this, SVX_RES( BTN_FORMAT ) ), \
+ aNoFormatBtn ( this, SVX_RES( BTN_NOFORMAT ) ), \
+ aCalcFL ( this, SVX_RES( FL_CALC ) ), \
+ aCalcSearchInFT ( this, SVX_RES( FT_CALC_SEARCHIN ) ), \
+ aCalcSearchInLB ( this, SVX_RES( LB_CALC_SEARCHIN ) ), \
+ aCalcSearchDirFT( this, SVX_RES( FT_CALC_SEARCHDIR ) ), \
+ aRowsBtn ( this, SVX_RES( RB_CALC_ROWS ) ), \
+ aColumnsBtn ( this, SVX_RES( RB_CALC_COLUMNS ) ), \
+ aAllSheetsCB ( this, SVX_RES( CB_ALL_SHEETS ) ), \
+ rBindings ( rBind ), \
+ bWriter ( sal_False ), \
+ bSearch ( sal_True ), \
+ bFormat ( sal_False ), \
+ nOptions ( USHRT_MAX ), \
+ bSet ( sal_False ), \
+ bReadOnly ( sal_False ), \
+ bConstruct ( sal_True ), \
+ nModifyFlag ( 0 ), \
+ aCalcStr ( THIS_SVX_RES( STR_WORDCALC ) ), \
+ pImpl ( NULL ), \
+ pSearchList ( NULL ), \
+ pReplaceList ( new SearchAttrItemList ), \
+ pSearchItem ( NULL ), \
+ pSearchController ( NULL ), \
+ pOptionsController ( NULL ), \
+ pFamilyController ( NULL ), \
+ pSearchSetController ( NULL ), \
+ pReplaceSetController ( NULL ), \
+ nTransliterationFlags ( 0x00000000 )
+
+// class SvxSearchDialog -------------------------------------------------
+
+SvxSearchDialog::SvxSearchDialog( Window* pParent, SfxBindings& rBind ) :
+
+ SfxModelessDialog( &rBind, NULL, pParent, SVX_RES( RID_SVXDLG_SEARCH ) ),
+
+ INI_LIST()
+
+{
+ Construct_Impl();
+}
+
+// -----------------------------------------------------------------------
+
+SvxSearchDialog::SvxSearchDialog( Window* pParent, SfxChildWindow* pChildWin, SfxBindings& rBind ) :
+
+ SfxModelessDialog( &rBind, pChildWin, pParent, SVX_RES( RID_SVXDLG_SEARCH ) ),
+
+ INI_LIST()
+
+{
+ Construct_Impl();
+}
+
+#undef INI_LIST
+#if ENABLE_LAYOUT
+#undef SVX_RES
+#define SVX_RES(x) ResId (x, DIALOG_MGR ())
+#endif
+
+// -----------------------------------------------------------------------
+
+SvxSearchDialog::~SvxSearchDialog()
+{
+ Hide();
+
+ rBindings.EnterRegistrations();
+ delete pSearchController;
+ delete pOptionsController;
+ delete pFamilyController;
+ delete pSearchSetController;
+ delete pReplaceSetController;
+ rBindings.LeaveRegistrations();
+
+ delete pSearchItem;
+ delete pImpl;
+ delete pSearchList;
+ delete pReplaceList;
+ delete pMoreBtn;
+}
+
+#if ENABLE_LAYOUT
+#undef Window
+#define Window layout::Window
+#endif /* ENABLE_LAYOUT */
+
+void lcl_MoveDown( Window& rWindow, sal_Int32 nOffset )
+{
+ Point aPos(rWindow.GetPosPixel());
+ aPos.Y() += nOffset;
+ rWindow.SetPosPixel(aPos);
+}
+
+void SvxSearchDialog::Construct_Impl()
+{
+#if ENABLE_LAYOUT
+ SetHelpId (".uno:SearchDialog");
+#endif /* ENABLE_LAYOUT */
+
+ // temporary to avoid incompatibility
+ pImpl = new SearchDlg_Impl( this );
+#if !ENABLE_LAYOUT
+ pImpl->aSelectionTimer.SetTimeout( 500 );
+ pImpl->aSelectionTimer.SetTimeoutHdl(
+ LINK( this, SvxSearchDialog, TimeoutHdl_Impl ) );
+#endif /* !ENABLE_LAYOUT */
+ EnableControls_Impl( 0 );
+
+ // alten Text des aWordBtn's merken
+ aCalcStr += sal_Unicode('#');
+ aCalcStr += aWordBtn.GetText();
+
+ aLayoutStr = SVX_RESSTR( RID_SVXSTR_SEARCH_STYLES );
+ aStylesStr = aLayoutBtn.GetText();
+
+ // gemerkte Such-Strings von der Applikation holen
+ ListToStrArr_Impl( SID_SEARCHDLG_SEARCHSTRINGS,
+ aSearchStrings, aSearchLB );
+ ListToStrArr_Impl( SID_SEARCHDLG_REPLACESTRINGS,
+ aReplaceStrings, aReplaceLB );
+
+ pMoreBtn->SetMoreText( String( SVX_RES( STR_MORE_BTN ) ) );
+ pMoreBtn->SetLessText( String( SVX_RES( STR_LESS_BTN ) ) );
+
+ FreeResource();
+ InitControls_Impl();
+
+ // Attribut-Sets nur einmal im Ctor() besorgen
+ const SfxPoolItem* ppArgs[] = { pSearchItem, 0 };
+ const SvxSetItem* pSrchSetItem =
+ (const SvxSetItem*) rBindings.GetDispatcher()->Execute( FID_SEARCH_SEARCHSET, SFX_CALLMODE_SLOT, ppArgs );
+
+ if ( pSrchSetItem )
+ InitAttrList_Impl( &pSrchSetItem->GetItemSet(), 0 );
+
+ const SvxSetItem* pReplSetItem =
+ (const SvxSetItem*)rBindings.GetDispatcher()->Execute( FID_SEARCH_REPLACESET, SFX_CALLMODE_SLOT, ppArgs );
+
+ if ( pReplSetItem )
+ InitAttrList_Impl( 0, &pReplSetItem->GetItemSet() );
+
+ // Controller erzeugen und gleich aktualisieren
+ rBindings.EnterRegistrations();
+ pSearchController =
+ new SvxSearchController( SID_SEARCH_ITEM, rBindings, *this );
+ pOptionsController =
+ new SvxSearchController( SID_SEARCH_OPTIONS, rBindings, *this );
+ rBindings.LeaveRegistrations();
+ rBindings.GetDispatcher()->Execute( FID_SEARCH_ON, SFX_CALLMODE_SLOT, ppArgs );
+ pImpl->aSelectionTimer.Start();
+
+
+ SvtCJKOptions aCJKOptions;
+ if(!aCJKOptions.IsJapaneseFindEnabled())
+ {
+ aJapOptionsCB.Check( sal_False );
+ aJapOptionsCB.Hide();
+ aJapOptionsBtn.Hide();
+ }
+ if(!aCJKOptions.IsCJKFontEnabled())
+ {
+ aJapMatchFullHalfWidthCB.Hide();
+ }
+ //component extension - show component search buttons if the commands
+ // vnd.sun.star::SearchViaComponent1 and 2 are supported
+ const uno::Reference< frame::XFrame >xFrame = rBindings.GetActiveFrame();
+ const uno::Reference< frame::XDispatchProvider > xDispatchProv(xFrame, uno::UNO_QUERY);
+ rtl::OUString sTarget = rtl::OUString::createFromAscii("_self");
+
+ bool bSearchComponent1 = false;
+ bool bSearchComponent2 = false;
+ if(xDispatchProv.is() &&
+ (pImpl->xCommand1Dispatch = xDispatchProv->queryDispatch(pImpl->aCommand1URL, sTarget, 0)).is())
+ {
+ bSearchComponent1 = true;
+ }
+ if(xDispatchProv.is() &&
+ (pImpl->xCommand2Dispatch = xDispatchProv->queryDispatch(pImpl->aCommand2URL, sTarget, 0)).is())
+ {
+ bSearchComponent2 = true;
+ }
+
+ if( bSearchComponent1 || bSearchComponent2 )
+ {
+ //get the labels of the FixedLine and the buttons
+ // "/org.openoffice.Office.Common/SearchOptions/ComponentSearchGroupLabel
+ // "/org.openoffice.Office.Common/SearchOptions/ComponentSearchCommandLabel1
+ // "/org.openoffice.Office.Common/SearchOptions/ComponentSearchCommandLabel2
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xMgr = getProcessServiceFactory();
+ uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider(xMgr->createInstance(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider"))),
+ uno::UNO_QUERY);
+ uno::Sequence< uno::Any > aArgs(1);
+ ::rtl::OUString sPath(RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common/SearchOptions/"));
+ aArgs[0] <<= sPath;
+
+ uno::Reference< uno::XInterface > xIFace = xConfigurationProvider->createInstanceWithArguments(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess")),
+ aArgs);
+ uno::Reference< container::XNameAccess> xDirectAccess(xIFace, uno::UNO_QUERY);
+ if(xDirectAccess.is())
+ {
+ ::rtl::OUString sTemp;
+ ::rtl::OUString sProperty(RTL_CONSTASCII_USTRINGPARAM( "ComponentSearchGroupLabel"));
+ uno::Any aRet = xDirectAccess->getByName(sProperty);
+ aRet >>= sTemp;
+ aSearchComponentFL.SetText( sTemp );
+ aRet = xDirectAccess->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ComponentSearchCommandLabel1")));
+ aRet >>= sTemp;
+ aSearchComponent1PB.SetText( sTemp );
+ aRet = xDirectAccess->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ComponentSearchCommandLabel2")));
+ aRet >>= sTemp;
+ aSearchComponent2PB.SetText( sTemp );
+ }
+ }
+ catch(uno::Exception&){}
+
+ if(aSearchComponent1PB.GetText().Len() && bSearchComponent1 )
+ {
+ aSearchComponentFL.Show();
+ aSearchComponent1PB.Show();
+ }
+ if( aSearchComponent2PB.GetText().Len() )
+ {
+ if(!aSearchComponent1PB.IsVisible())
+ {
+ aSearchComponent2PB.SetPosPixel(aSearchComponent1PB.GetPosPixel());
+ }
+ aSearchComponentFL.Show();
+ aSearchComponent2PB.Show();
+ }
+ if( aSearchComponentFL.IsVisible() && aSearchComponent1PB.IsVisible() )
+ {
+
+ //dialog must be resized
+ Size aDlgSize(GetSizePixel());
+ sal_Int32 nOffset = aSearchCmdLine.GetPosPixel().Y() - aSearchAllBtn.GetPosPixel().Y()
+ - aButtonsFL.GetPosPixel().Y() + aSearchComponent2PB.GetPosPixel().Y();
+
+ aDlgSize.Height() += nOffset;
+ Window* aWindows[] =
+ {
+ &aOptionsFL,
+ &aSelectionBtn,
+ &aBackwardsBtn,
+ &aRegExpBtn,
+ &aSimilarityBox,
+ &aSimilarityBtn,
+ &aLayoutBtn,
+ &aNotesBtn,
+ &aJapMatchFullHalfWidthCB,
+ &aJapOptionsCB,
+ &aJapOptionsBtn,
+ &aAttributeBtn,
+ &aFormatBtn,
+ &aNoFormatBtn,
+ &aCalcFL,
+ &aCalcSearchInFT,
+ &aCalcSearchInLB,
+ &aCalcSearchDirFT,
+ &aRowsBtn,
+ &aColumnsBtn,
+ &aAllSheetsCB,
+ &aButtonsFL,
+ &aHelpBtn,
+ &aCloseBtn,
+ pMoreBtn,
+ 0
+ };
+ sal_Int32 nWindow = 0;
+ do
+ {
+ lcl_MoveDown( *aWindows[nWindow], nOffset );
+ }
+ while(aWindows[++nWindow]);
+
+ SetSizePixel(aDlgSize);
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxSearchDialog::Close()
+{
+ // remember strings speichern
+ if ( aSearchStrings.Count() )
+ StrArrToList_Impl( SID_SEARCHDLG_SEARCHSTRINGS, aSearchStrings );
+
+ if ( aReplaceStrings.Count() )
+ StrArrToList_Impl( SID_SEARCHDLG_REPLACESTRINGS, aReplaceStrings );
+
+ // save settings to configuration
+ SvtSearchOptions aOpt;
+ aOpt.SetWholeWordsOnly ( aWordBtn .IsChecked() );
+ aOpt.SetBackwards ( aBackwardsBtn .IsChecked() );
+ aOpt.SetUseRegularExpression ( aRegExpBtn .IsChecked() );
+ //aOpt.SetMatchCase ( aMatchCaseCB .IsChecked() );
+ aOpt.SetSearchForStyles ( aLayoutBtn .IsChecked() );
+ aOpt.SetSimilaritySearch ( aSimilarityBox .IsChecked() );
+ //aOpt.SetMatchFullHalfWidthForms ( !aJapMatchFullHalfWidthCB.IsChecked() );
+ aOpt.SetUseAsianOptions ( aJapOptionsCB .IsChecked() );
+ aOpt.SetNotes ( aNotesBtn .IsChecked() );
+
+ const SfxPoolItem* ppArgs[] = { pSearchItem, 0 };
+ rBindings.GetDispatcher()->Execute( FID_SEARCH_OFF, SFX_CALLMODE_SLOT, ppArgs );
+ rBindings.Execute( SID_SEARCH_DLG );
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Int32 SvxSearchDialog::GetTransliterationFlags() const
+{
+ if (!aMatchCaseCB.IsChecked())
+ nTransliterationFlags |= TransliterationModules_IGNORE_CASE;
+ else
+ nTransliterationFlags &= ~TransliterationModules_IGNORE_CASE;
+ if ( !aJapMatchFullHalfWidthCB.IsChecked())
+ nTransliterationFlags |= TransliterationModules_IGNORE_WIDTH;
+ else
+ nTransliterationFlags &= ~TransliterationModules_IGNORE_WIDTH;
+ return nTransliterationFlags;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::ApplyTransliterationFlags_Impl( sal_Int32 nSettings )
+{
+ nTransliterationFlags = nSettings;
+ sal_Bool bVal = 0 != (nSettings & TransliterationModules_IGNORE_CASE);
+ aMatchCaseCB .Check(!bVal );
+ bVal = 0 != (nSettings & TransliterationModules_IGNORE_WIDTH);
+ aJapMatchFullHalfWidthCB.Check( !bVal );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::Activate()
+{
+ // apply possible transliteration changes of the SvxSearchItem member
+ DBG_ASSERT( pSearchItem, "SearchItem missing" );
+ if (pSearchItem)
+ {
+ aMatchCaseCB .Check( pSearchItem->GetExact() );
+ aJapMatchFullHalfWidthCB.Check( !pSearchItem->IsMatchFullHalfWidthForms() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::InitControls_Impl()
+{
+ // CaseSensitives AutoComplete
+ aSearchLB.EnableAutocomplete( sal_True, sal_True );
+ aSearchLB.Show();
+ aReplaceLB.EnableAutocomplete( sal_True, sal_True );
+ aReplaceLB.Show();
+
+ aFormatBtn.Disable();
+ aAttributeBtn.Disable();
+
+ aSearchLB.SetModifyHdl( LINK( this, SvxSearchDialog, ModifyHdl_Impl ) );
+ aReplaceLB.SetModifyHdl( LINK( this, SvxSearchDialog, ModifyHdl_Impl ) );
+
+ Link aLink = LINK( this, SvxSearchDialog, FocusHdl_Impl );
+ aSearchLB.SetGetFocusHdl( aLink );
+ pImpl->aSearchFormats.SetGetFocusHdl( aLink );
+
+ aReplaceLB.SetGetFocusHdl( aLink );
+ pImpl->aReplaceFormats.SetGetFocusHdl( aLink );
+
+ aLink = LINK( this, SvxSearchDialog, LoseFocusHdl_Impl );
+ aSearchLB.SetLoseFocusHdl( aLink );
+ aReplaceLB.SetLoseFocusHdl( aLink );
+
+ aSearchTmplLB.SetLoseFocusHdl( aLink );
+ aReplaceTmplLB.SetLoseFocusHdl( aLink );
+
+ aLink = LINK( this, SvxSearchDialog, CommandHdl_Impl );
+ aSearchBtn.SetClickHdl( aLink );
+ aSearchAllBtn.SetClickHdl( aLink );
+ aReplaceBtn.SetClickHdl( aLink );
+ aReplaceAllBtn.SetClickHdl( aLink );
+ aCloseBtn.SetClickHdl( aLink );
+ aSimilarityBtn.SetClickHdl( aLink );
+ aJapOptionsBtn.SetClickHdl( aLink );
+ aSearchComponent1PB.SetClickHdl( aLink );
+ aSearchComponent2PB.SetClickHdl( aLink );
+
+ aLink = LINK( this, SvxSearchDialog, FlagHdl_Impl );
+ aWordBtn.SetClickHdl( aLink );
+ aSelectionBtn.SetClickHdl( aLink );
+ aMatchCaseCB.SetClickHdl( aLink );
+ aRegExpBtn.SetClickHdl( aLink );
+ aBackwardsBtn.SetClickHdl( aLink );
+ aNotesBtn.SetClickHdl( aLink );
+ aSimilarityBox.SetClickHdl( aLink );
+ aJapOptionsCB.SetClickHdl( aLink );
+ aJapMatchFullHalfWidthCB.SetClickHdl( aLink );
+
+ aLayoutBtn.SetClickHdl( LINK( this, SvxSearchDialog, TemplateHdl_Impl ) );
+ aFormatBtn.SetClickHdl( LINK( this, SvxSearchDialog, FormatHdl_Impl ) );
+ aNoFormatBtn.SetClickHdl(
+ LINK( this, SvxSearchDialog, NoFormatHdl_Impl ) );
+ aAttributeBtn.SetClickHdl(
+ LINK( this, SvxSearchDialog, AttributeHdl_Impl ) );
+
+ // check if buttontext is to wide
+ long nTxtW = Max( pMoreBtn->GetCtrlTextWidth( pMoreBtn->GetMoreText() ),
+ pMoreBtn->GetCtrlTextWidth( pMoreBtn->GetLessText() ) );
+ nTxtW += ( pMoreBtn->GetTextHeight() * 2 ); // add image size + offset
+ long nBtnW = pMoreBtn->GetSizePixel().Width();
+ if ( nTxtW > nBtnW )
+ {
+ // broaden the button
+ const long nMinDelta = 10;
+ long nDelta = Max( nTxtW - nBtnW, nMinDelta );
+ Size aNewSize = pMoreBtn->GetSizePixel();
+ aNewSize.Width() += nDelta;
+ pMoreBtn->SetSizePixel( aNewSize );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::CalculateDelta_Impl()
+{
+ DBG_ASSERT( pSearchItem, "no search item" );
+
+ bool bDrawApp = false;
+ bool bCalcApp = false;
+ bool bWriterApp = false;
+ bool bImpressApp = false;
+ const uno::Reference< frame::XFrame > xFrame = rBindings.GetActiveFrame();
+ uno::Reference< frame::XModuleManager > xModuleManager(
+ ::comphelper::getProcessServiceFactory()->createInstance(
+ DEFINE_CONST_UNICODE("com.sun.star.frame.ModuleManager") ), uno::UNO_QUERY );
+ if ( xModuleManager.is() )
+ {
+ try
+ {
+ ::rtl::OUString aModuleIdentifier = xModuleManager->identify( xFrame );
+ bCalcApp = aModuleIdentifier.equalsAscii( "com.sun.star.sheet.SpreadsheetDocument" );
+ bDrawApp = aModuleIdentifier.equalsAscii( "com.sun.star.drawing.DrawingDocument" );
+ bImpressApp = aModuleIdentifier.equalsAscii( "com.sun.star.presentation.PresentationDocument" );
+ bWriterApp = aModuleIdentifier.equalsAscii( "com.sun.star.text.TextDocument" );
+ }
+ catch ( uno::Exception& )
+ {
+ }
+ }
+
+ if ( pImpl->bDeltaCalculated )
+ return;
+ else
+ pImpl->bDeltaCalculated = sal_True;
+
+ sal_uIntPtr nDelta = 187, nOffset = 0;
+ SvtCJKOptions aCJKOptions;
+
+ pMoreBtn->AddWindow( &aOptionsFL );
+ if ( !bDrawApp )
+ pMoreBtn->AddWindow( &aLayoutBtn );
+ if ( bWriterApp )
+ pMoreBtn->AddWindow( &aNotesBtn );
+ else
+ {
+ aNotesBtn.Hide();
+ nOffset = !bDrawApp ? 13 : 0;
+ }
+ pMoreBtn->AddWindow( &aBackwardsBtn );
+ if ( !bDrawApp )
+ pMoreBtn->AddWindow( &aRegExpBtn );
+ pMoreBtn->AddWindow( &aSimilarityBox );
+ pMoreBtn->AddWindow( &aSimilarityBtn );
+ pMoreBtn->AddWindow( &aSelectionBtn );
+
+ if ( aCJKOptions.IsCJKFontEnabled() )
+ pMoreBtn->AddWindow( &aJapMatchFullHalfWidthCB );
+ else
+ nOffset += 13;
+ if ( aCJKOptions.IsJapaneseFindEnabled() )
+ {
+ pMoreBtn->AddWindow( &aJapOptionsCB );
+ pMoreBtn->AddWindow( &aJapOptionsBtn );
+ }
+ else
+ nOffset += 17;
+
+ if ( bWriter )
+ {
+ pMoreBtn->AddWindow( &aAttributeBtn );
+ pMoreBtn->AddWindow( &aFormatBtn );
+ pMoreBtn->AddWindow( &aNoFormatBtn );
+ }
+
+ if (bDrawApp || bImpressApp)
+ {
+ // "Find All" button is hidden--align "Find" vertically to the
+ // search listbox
+ Point aNewPt(aSearchBtn.GetPosPixel());
+ const Size aBtnSz(aSearchBtn.GetSizePixel());
+ const Size aLBSz(aSearchLB.GetSizePixel());
+ const int nOff((aLBSz.Height() - aBtnSz.Height()) / 2);
+ aNewPt.Y() = aSearchLB.GetPosPixel().Y() + nOff;
+ aSearchBtn.SetPosPixel(aNewPt);
+ }
+
+ if ( bDrawApp )
+ {
+ // Draw App: "Regular expressions" and "Search for Styles" check boxes are hidden
+ // so align the other buttons
+ const long nAppFontHeight = 13; // checkbox height + space between in APPFONT
+ long nH = LogicToPixel( Size( 0, nAppFontHeight ), MAP_APPFONT ).Height();
+
+ Point aNewPos = aSimilarityBox.GetPosPixel();
+ aNewPos.Y() -= nH;
+ aSimilarityBox.SetPosPixel( aNewPos );
+ aNewPos = aSimilarityBtn.GetPosPixel();
+ aNewPos.Y() -= nH;
+ aSimilarityBtn.SetPosPixel( aNewPos );
+ nH *= 3;
+ nOffset += ( 3 * nAppFontHeight );
+ if ( aCJKOptions.IsCJKFontEnabled() )
+ {
+ aNewPos = aJapMatchFullHalfWidthCB.GetPosPixel();
+ aNewPos.Y() -= nH;
+ aJapMatchFullHalfWidthCB.SetPosPixel( aNewPos );
+ }
+ if ( aCJKOptions.IsJapaneseFindEnabled() )
+ {
+ aNewPos = aJapOptionsCB.GetPosPixel();
+ aNewPos.Y() -= nH;
+ aJapOptionsCB.SetPosPixel( aNewPos );
+ aNewPos = aJapOptionsBtn.GetPosPixel();
+ aNewPos.Y() -= nH;
+ aJapOptionsBtn.SetPosPixel( aNewPos );
+ }
+ }
+
+ if ( bCalcApp || bImpressApp )
+ {
+ Window* pWins[] =
+ {
+ &aCalcFL, &aCalcSearchInFT, &aCalcSearchInLB, &aCalcSearchDirFT,
+ &aRowsBtn, &aColumnsBtn, &aAllSheetsCB, &aJapMatchFullHalfWidthCB,
+ &aJapOptionsCB, &aJapOptionsBtn
+ };
+ Window** pCurrent = pWins;
+ sal_uInt32 i = 0;
+ const sal_uInt32 nCalcCtrlCount = 7;
+ if ( nOffset > 0 )
+ {
+ long nH = LogicToPixel( Size( 0, nOffset ), MAP_APPFONT ).Height();
+ for ( i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent )
+ {
+ if ( ( bCalcApp && i < nCalcCtrlCount )
+ || ( i == nCalcCtrlCount && aCJKOptions.IsCJKFontEnabled() )
+ || ( i > nCalcCtrlCount && aCJKOptions.IsJapaneseFindEnabled() ) )
+ {
+ Point aNewPos = (*pCurrent)->GetPosPixel();
+ aNewPos.Y() -= nH;
+ (*pCurrent)->SetPosPixel( aNewPos );
+ }
+ }
+ }
+
+ if ( bCalcApp)
+ {
+ pCurrent = pWins;
+ for ( i = 0; i < nCalcCtrlCount; ++i, ++pCurrent )
+ pMoreBtn->AddWindow( *pCurrent );
+ }
+ else
+ nOffset += 64;
+ }
+ else
+ nOffset += 64;
+
+ pMoreBtn->SetDelta( nDelta - nOffset );
+ pMoreBtn->Show();
+ pMoreBtn->Enable();
+}
+
+#if ENABLE_LAYOUT
+#undef Window
+#define Window ::Window
+#endif /* ENABLE_LAYOUT */
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::Init_Impl( int bSearchPattern )
+{
+ DBG_ASSERT( pSearchItem, "SearchItem == 0" );
+ bWriter = ( pSearchItem->GetAppFlag() == SVX_SEARCHAPP_WRITER );
+
+ pImpl->bMultiLineEdit = sal_False;
+
+ if ( !pImpl->bMultiLineEdit )
+ {
+ pImpl->aSearchFormats.Hide();
+ aSearchAttrText.Show();
+ pImpl->aReplaceFormats.Hide();
+ aReplaceAttrText.Show();
+ }
+ else
+ {
+ String aText = aSearchAttrText.GetText();
+ aSearchAttrText.Hide();
+
+ if ( aText.Len() )
+ pImpl->aSearchFormats.SetText( aText );
+ pImpl->aSearchFormats.Show();
+ aText = aReplaceAttrText.GetText();
+ aReplaceAttrText.Hide();
+
+ if ( aText.Len() )
+ pImpl->aReplaceFormats.SetText( aText );
+ pImpl->aReplaceFormats.Show();
+ }
+
+ if ( ( nModifyFlag & MODIFY_WORD ) == 0 )
+ aWordBtn.Check( pSearchItem->GetWordOnly() );
+ if ( ( nModifyFlag & MODIFY_EXACT ) == 0 )
+ aMatchCaseCB.Check( pSearchItem->GetExact() );
+ if ( ( nModifyFlag & MODIFY_BACKWARDS ) == 0 )
+ aBackwardsBtn.Check( pSearchItem->GetBackward() );
+ if ( ( nModifyFlag & MODIFY_NOTES ) == 0 )
+ aNotesBtn.Check( pSearchItem->GetNotes() );
+ if ( ( nModifyFlag & MODIFY_SELECTION ) == 0 )
+ aSelectionBtn.Check( pSearchItem->GetSelection() );
+ if ( ( nModifyFlag & MODIFY_REGEXP ) == 0 )
+ aRegExpBtn.Check( pSearchItem->GetRegExp() );
+ if ( ( nModifyFlag & MODIFY_LAYOUT ) == 0 )
+ aLayoutBtn.Check( pSearchItem->GetPattern() );
+ if (aNotesBtn.IsChecked())
+ aLayoutBtn.Disable();
+ aSimilarityBox.Check( pSearchItem->IsLevenshtein() );
+ if( aJapOptionsCB.IsVisible() )
+ aJapOptionsCB.Check( pSearchItem->IsUseAsianOptions() );
+ ApplyTransliterationFlags_Impl( pSearchItem->GetTransliterationFlags() );
+
+ CalculateDelta_Impl();
+
+ bool bDraw = sal_False;
+ if ( pSearchItem->GetAppFlag() == SVX_SEARCHAPP_CALC )
+ {
+ Link aLink = LINK( this, SvxSearchDialog, FlagHdl_Impl );
+ aCalcSearchInLB.SetSelectHdl( aLink );
+ aRowsBtn.SetClickHdl( aLink );
+ aColumnsBtn.SetClickHdl( aLink );
+ aAllSheetsCB.SetClickHdl( aLink );
+
+ switch ( pSearchItem->GetCellType() )
+ {
+ case SVX_SEARCHIN_FORMULA:
+ if ( ( nModifyFlag & MODIFY_FORMULAS ) == 0 )
+ aCalcSearchInLB.SelectEntryPos( SVX_SEARCHIN_FORMULA );
+ break;
+
+ case SVX_SEARCHIN_VALUE:
+ if ( ( nModifyFlag & MODIFY_VALUES ) == 0 )
+ aCalcSearchInLB.SelectEntryPos( SVX_SEARCHIN_VALUE );
+ break;
+
+ case SVX_SEARCHIN_NOTE:
+ if ( ( nModifyFlag & MODIFY_CALC_NOTES ) == 0 )
+ aCalcSearchInLB.SelectEntryPos( SVX_SEARCHIN_NOTE );
+ break;
+ }
+ aWordBtn.SetText( aCalcStr.GetToken( 0, '#' ) );
+
+ if ( pSearchItem->GetRowDirection() &&
+ ( nModifyFlag & MODIFY_ROWS ) == 0 )
+ aRowsBtn.Check();
+ else if ( !pSearchItem->GetRowDirection() &&
+ ( nModifyFlag & MODIFY_COLUMNS ) == 0 )
+ aColumnsBtn.Check();
+
+ if ( ( nModifyFlag & MODIFY_ALLTABLES ) == 0 )
+ aAllSheetsCB.Check( pSearchItem->IsAllTables() );
+
+ // nur im Writer Suche nach Formatierung
+ aFormatBtn.Hide();
+ aNoFormatBtn.Hide();
+ aAttributeBtn.Hide();
+ }
+ else
+ {
+ aWordBtn.SetText( aCalcStr.GetToken( 1, '#' ) );
+
+ if ( pSearchItem->GetAppFlag() == SVX_SEARCHAPP_DRAW )
+ {
+ aSearchAllBtn.Hide();
+
+ aRegExpBtn.Hide();
+ aLayoutBtn.Hide();
+
+ // nur im Writer Suche nach Formatierung
+ aFormatBtn.Hide();
+ aNoFormatBtn.Hide();
+ aAttributeBtn.Hide();
+ bDraw = sal_True;
+ }
+ else
+ {
+ if ( !pSearchList )
+ {
+ // Attribut-Sets besorgen, wenn noch nicht geschehen
+ const SfxPoolItem* ppArgs[] = { pSearchItem, 0 };
+ const SvxSetItem* pSrchSetItem =
+ (const SvxSetItem*)rBindings.GetDispatcher()->Execute( FID_SEARCH_SEARCHSET, SFX_CALLMODE_SLOT, ppArgs );
+
+ if ( pSrchSetItem )
+ InitAttrList_Impl( &pSrchSetItem->GetItemSet(), 0 );
+
+ const SvxSetItem* pReplSetItem =
+ (const SvxSetItem*)rBindings.GetDispatcher()->Execute( FID_SEARCH_REPLACESET, SFX_CALLMODE_SLOT, ppArgs );
+
+ if ( pReplSetItem )
+ InitAttrList_Impl( 0, &pReplSetItem->GetItemSet() );
+ }
+/*
+ aFormatBtn.Show();
+ aNoFormatBtn.Show();
+ aAttributeBtn.Show();
+*/
+ }
+// pMoreBtn->SetState( sal_False );
+// pMoreBtn->Hide();
+ }
+
+ if ( 0 && !bDraw ) //!!!!!
+ {
+ aRegExpBtn.Show();
+ aLayoutBtn.Show();
+ }
+
+ // "Ahnlichkeitssuche?
+ if ( ( nModifyFlag & MODIFY_SIMILARITY ) == 0 )
+ aSimilarityBox.Check( pSearchItem->IsLevenshtein() );
+ bSet = sal_True;
+
+ pImpl->bSaveToModule = sal_False;
+ FlagHdl_Impl( &aSimilarityBox );
+ FlagHdl_Impl( &aJapOptionsCB );
+ pImpl->bSaveToModule = sal_True;
+
+ bool bDisableSearch = sal_False;
+ SfxViewShell* pViewShell = SfxViewShell::Current();
+
+ if ( pViewShell )
+ {
+ sal_Bool bText = !bSearchPattern;
+
+ if ( pViewShell->HasSelection( bText ) )
+ EnableControl_Impl( &aSelectionBtn );
+ else
+ {
+ aSelectionBtn.Check( sal_False );
+ aSelectionBtn.Disable();
+ }
+ }
+
+ // Patternsuche und es wurden keine AttrSets "ubergeben
+ if ( bSearchPattern )
+ {
+ SfxObjectShell* pShell = SfxObjectShell::Current();
+
+ if ( pShell && pShell->GetStyleSheetPool() )
+ {
+ // Vorlagen beschaffen
+ aSearchTmplLB .Clear();
+ aReplaceTmplLB.Clear();
+ SfxStyleSheetBasePool* pStylePool = pShell->GetStyleSheetPool();
+ pStylePool->SetSearchMask( pSearchItem->GetFamily(),
+ SFXSTYLEBIT_ALL );
+ SfxStyleSheetBase* pBase = pStylePool->First();
+
+ while ( pBase )
+ {
+ if ( pBase->IsUsed() )
+ aSearchTmplLB.InsertEntry( pBase->GetName() );
+ aReplaceTmplLB.InsertEntry( pBase->GetName() );
+ pBase = pStylePool->Next();
+ }
+ aSearchTmplLB.SelectEntry( pSearchItem->GetSearchString() );
+ aReplaceTmplLB.SelectEntry( pSearchItem->GetReplaceString() );
+
+ }
+ aSearchTmplLB.Show();
+
+ if ( bConstruct )
+ // nur nach dem Erzeugen den Fokus grappen
+ aSearchTmplLB.GrabFocus();
+ aReplaceTmplLB.Show();
+ aSearchLB.Hide();
+ aReplaceLB.Hide();
+
+ aWordBtn.Disable();
+ aRegExpBtn.Disable();
+ aMatchCaseCB.Disable();
+
+ bDisableSearch = !aSearchTmplLB.GetEntryCount();
+ }
+ else
+ {
+ bool bSetSearch = ( ( nModifyFlag & MODIFY_SEARCH ) == 0 );
+ bool bSetReplace = ( ( nModifyFlag & MODIFY_REPLACE ) == 0 );
+
+ if ( pSearchItem->GetSearchString().Len() && bSetSearch )
+ aSearchLB.SetText( pSearchItem->GetSearchString() );
+ else if ( aSearchStrings.Count() )
+ {
+ bool bAttributes =
+ ( ( pSearchList && pSearchList->Count() ) ||
+ ( pReplaceList && pReplaceList->Count() ) );
+
+ if ( bSetSearch && !bAttributes )
+ aSearchLB.SetText( *aSearchStrings[ 0 ] );
+
+ String aReplaceTxt = pSearchItem->GetReplaceString();
+
+ if ( aReplaceStrings.Count() )
+ aReplaceTxt = *aReplaceStrings[ 0 ];
+
+ if ( bSetReplace && !bAttributes )
+ aReplaceLB.SetText( aReplaceTxt );
+ }
+ aSearchLB.Show();
+
+ if ( bConstruct )
+ // nur nach dem Erzeugen den Fokus grappen
+ aSearchLB.GrabFocus();
+ aReplaceLB.Show();
+ aSearchTmplLB.Hide();
+ aReplaceTmplLB.Hide();
+
+ EnableControl_Impl( &aRegExpBtn );
+ EnableControl_Impl( &aMatchCaseCB );
+
+ if ( aRegExpBtn.IsChecked() )
+ aWordBtn.Disable();
+ else
+ EnableControl_Impl( &aWordBtn );
+
+ String aSrchAttrTxt;
+
+ if ( pImpl->bMultiLineEdit )
+ aSrchAttrTxt = pImpl->aSearchFormats.GetText();
+ else
+ aSrchAttrTxt = aSearchAttrText.GetText();
+
+ bDisableSearch = !aSearchLB.GetText().Len() && !aSrchAttrTxt.Len();
+ }
+ FocusHdl_Impl( &aSearchLB );
+
+ if ( bDisableSearch )
+ {
+ aSearchBtn.Disable();
+ aSearchAllBtn.Disable();
+ aReplaceBtn.Disable();
+ aReplaceAllBtn.Disable();
+ aSearchComponentFL.Enable(sal_False);
+ aSearchComponent1PB.Enable(sal_False);
+ aSearchComponent2PB.Enable(sal_False);
+ }
+ else
+ {
+ EnableControl_Impl( &aSearchBtn );
+ EnableControl_Impl( &aReplaceBtn );
+ if (!bWriter || (bWriter && !aNotesBtn.IsChecked()))
+ {
+ EnableControl_Impl( &aSearchAllBtn );
+ EnableControl_Impl( &aReplaceAllBtn );
+ }
+ if (bWriter && pSearchItem->GetNotes())
+ {
+ aSearchAllBtn.Disable();
+ aReplaceAllBtn.Disable();
+ }
+ }
+
+ if ( ( !pImpl->bMultiLineEdit && aSearchAttrText.GetText().Len() ) ||
+ ( pImpl->bMultiLineEdit && pImpl->aSearchFormats.GetText().Len() ) )
+ EnableControl_Impl( &aNoFormatBtn );
+ else
+ aNoFormatBtn.Disable();
+
+ if ( !pSearchList )
+ {
+ aAttributeBtn.Disable();
+ aFormatBtn.Disable();
+ }
+
+ if ( aLayoutBtn.IsChecked() )
+ {
+ pImpl->bSaveToModule = sal_False;
+ TemplateHdl_Impl( &aLayoutBtn );
+ pImpl->bSaveToModule = sal_True;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::InitAttrList_Impl( const SfxItemSet* pSSet,
+ const SfxItemSet* pRSet )
+{
+ if ( !pSSet && !pRSet )
+ return;
+
+ if ( !pImpl->pRanges && pSSet )
+ {
+ sal_sSize nCnt = 0;
+ const sal_uInt16* pPtr = pSSet->GetRanges();
+ const sal_uInt16* pTmp = pPtr;
+
+ while( *pPtr )
+ {
+ nCnt += ( *(pPtr+1) - *pPtr ) + 1;
+ pPtr += 2;
+ }
+ nCnt = pPtr - pTmp + 1;
+ pImpl->pRanges = new sal_uInt16[nCnt];
+ memcpy( pImpl->pRanges, pTmp, sizeof(sal_uInt16) * nCnt );
+ }
+
+ // sorge daf"ur, das die Texte der Attribute richtig stehen
+ String aDesc;
+
+ if ( pSSet )
+ {
+ delete pSearchList;
+ pSearchList = new SearchAttrItemList;
+
+ if ( pSSet->Count() )
+ {
+ pSearchList->Put( *pSSet );
+
+ if ( !pImpl->bMultiLineEdit )
+ aSearchAttrText.SetText( BuildAttrText_Impl( aDesc, sal_True ) );
+ else
+ pImpl->aSearchFormats.SetText( BuildAttrText_Impl( aDesc, sal_True ) );
+
+ if ( aDesc.Len() )
+ bFormat |= sal_True;
+ }
+ }
+
+ if ( pRSet )
+ {
+ delete pReplaceList;
+ pReplaceList = new SearchAttrItemList;
+
+ if ( pRSet->Count() )
+ {
+ pReplaceList->Put( *pRSet );
+
+ if ( !pImpl->bMultiLineEdit )
+ aReplaceAttrText.SetText( BuildAttrText_Impl( aDesc, sal_False ) );
+ else
+ pImpl->aReplaceFormats.SetText( BuildAttrText_Impl( aDesc, sal_False ) );
+
+ if ( aDesc.Len() )
+ bFormat |= sal_True;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchDialog, FlagHdl_Impl, Control *, pCtrl )
+{
+ if ( pCtrl && !bSet )
+ SetModifyFlag_Impl( pCtrl );
+ else
+ bSet = sal_False;
+
+ if ( pCtrl == &aSimilarityBox )
+ {
+ sal_Bool bIsChecked = aSimilarityBox.IsChecked();
+
+ if ( bIsChecked )
+ {
+ aSimilarityBtn.Enable();
+ aRegExpBtn.Check( sal_False );
+ aRegExpBtn.Disable();
+ EnableControl_Impl( &aWordBtn );
+
+ if ( aLayoutBtn.IsChecked() )
+ {
+ EnableControl_Impl( &aMatchCaseCB );
+ aLayoutBtn.Check( sal_False );
+ }
+ aRegExpBtn.Disable();
+ aLayoutBtn.Disable();
+ aFormatBtn.Disable();
+ aNoFormatBtn.Disable();
+ aAttributeBtn.Disable();
+ }
+ else
+ {
+ EnableControl_Impl( &aRegExpBtn );
+ if (!aNotesBtn.IsChecked())
+ EnableControl_Impl( &aLayoutBtn );
+ EnableControl_Impl( &aFormatBtn );
+ EnableControl_Impl( &aAttributeBtn );
+ aSimilarityBtn.Disable();
+ }
+ pSearchItem->SetLevenshtein( bIsChecked );
+ }
+ else
+ if ( pCtrl == &aNotesBtn)
+ {
+ if (aNotesBtn.IsChecked())
+ {
+ aLayoutBtn.Disable();
+ aSearchAllBtn.Disable();
+ aReplaceAllBtn.Disable();
+ }
+ else
+ {
+ EnableControl_Impl( &aLayoutBtn );
+ ModifyHdl_Impl( &aSearchLB );
+ }
+ }
+ else
+ {
+ if ( aLayoutBtn.IsChecked() && !bFormat )
+ {
+ aWordBtn.Check( sal_False );
+ aWordBtn.Disable();
+ aRegExpBtn.Check( sal_False );
+ aRegExpBtn.Disable();
+ aMatchCaseCB.Check( sal_False );
+ aMatchCaseCB.Disable();
+ aNotesBtn.Disable();
+
+ if ( aSearchTmplLB.GetEntryCount() )
+ {
+ EnableControl_Impl( &aSearchBtn );
+ EnableControl_Impl( &aSearchAllBtn );
+ EnableControl_Impl( &aReplaceBtn );
+ EnableControl_Impl( &aReplaceAllBtn );
+ }
+ }
+ else
+ {
+ EnableControl_Impl( &aRegExpBtn );
+ EnableControl_Impl( &aMatchCaseCB );
+ EnableControl_Impl( &aNotesBtn );
+
+ if ( aRegExpBtn.IsChecked() )
+ {
+ aWordBtn.Check( sal_False );
+ aWordBtn.Disable();
+ aSimilarityBox.Disable();
+ aSimilarityBtn.Disable();
+ }
+ else
+ {
+ EnableControl_Impl( &aWordBtn );
+ EnableControl_Impl( &aSimilarityBox );
+ }
+
+ // Such-String vorhanden? dann Buttons enablen
+ bSet = sal_True;
+ ModifyHdl_Impl( &aSearchLB );
+ }
+ }
+
+ if ( &aAllSheetsCB == pCtrl )
+ {
+ if ( aAllSheetsCB.IsChecked() )
+ aSearchAllBtn.Disable();
+ else
+ {
+ bSet = sal_True;
+ ModifyHdl_Impl( &aSearchLB );
+ }
+ }
+
+ if ( &aJapOptionsCB == pCtrl )
+ {
+ sal_Bool bEnableJapOpt = aJapOptionsCB.IsChecked();
+ aMatchCaseCB .Enable(!bEnableJapOpt );
+ aJapMatchFullHalfWidthCB.Enable(!bEnableJapOpt );
+ aJapOptionsBtn .Enable( bEnableJapOpt );
+ }
+
+ if ( pImpl->bSaveToModule )
+ SaveToModule_Impl();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchDialog, CommandHdl_Impl, Button *, pBtn )
+{
+ bool bInclusive = ( aLayoutBtn.GetText() == aLayoutStr );
+
+ if ( ( pBtn == &aSearchBtn ) ||
+ ( pBtn == &aSearchAllBtn ) ||
+ ( pBtn == &aReplaceBtn ) ||
+ ( pBtn == &aReplaceAllBtn ) )
+ {
+ if ( aLayoutBtn.IsChecked() && !bInclusive )
+ {
+ pSearchItem->SetSearchString ( aSearchTmplLB.GetSelectEntry() );
+ pSearchItem->SetReplaceString( aReplaceTmplLB.GetSelectEntry() );
+ }
+ else
+ {
+ pSearchItem->SetSearchString ( aSearchLB.GetText() );
+ pSearchItem->SetReplaceString( aReplaceLB.GetText() );
+
+ if ( pBtn == &aReplaceBtn )
+ Remember_Impl( aReplaceLB.GetText(), sal_False );
+ else
+ {
+ Remember_Impl( aSearchLB.GetText(), sal_True );
+
+ if ( pBtn == &aReplaceAllBtn )
+ Remember_Impl( aReplaceLB.GetText(), sal_False );
+ }
+ }
+
+ pSearchItem->SetRegExp( sal_False );
+ pSearchItem->SetLevenshtein( sal_False );
+ if (GetCheckBoxValue( aRegExpBtn ))
+ pSearchItem->SetRegExp( sal_True );
+ else if (GetCheckBoxValue( aSimilarityBox ))
+ pSearchItem->SetLevenshtein( sal_True );
+
+ pSearchItem->SetWordOnly( GetCheckBoxValue( aWordBtn ) );
+ pSearchItem->SetBackward( GetCheckBoxValue( aBackwardsBtn ) );
+ pSearchItem->SetNotes( GetCheckBoxValue( aNotesBtn ) );
+ pSearchItem->SetPattern( GetCheckBoxValue( aLayoutBtn ) );
+ pSearchItem->SetSelection( GetCheckBoxValue( aSelectionBtn ) );
+
+ pSearchItem->SetUseAsianOptions( GetCheckBoxValue( aJapOptionsCB ) );
+ sal_Int32 nFlags = GetTransliterationFlags();
+ if( !pSearchItem->IsUseAsianOptions())
+ nFlags &= (TransliterationModules_IGNORE_CASE |
+ TransliterationModules_IGNORE_WIDTH );
+ pSearchItem->SetTransliterationFlags( nFlags );
+
+ if ( !bWriter )
+ {
+ if ( aCalcSearchInLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND )
+ pSearchItem->SetCellType( aCalcSearchInLB.GetSelectEntryPos() );
+
+ pSearchItem->SetRowDirection( aRowsBtn.IsChecked() );
+ pSearchItem->SetAllTables( aAllSheetsCB.IsChecked() );
+ }
+
+ if ( pBtn == &aSearchBtn )
+ pSearchItem->SetCommand( SVX_SEARCHCMD_FIND );
+ else if ( pBtn == &aSearchAllBtn )
+ pSearchItem->SetCommand( SVX_SEARCHCMD_FIND_ALL );
+ else if ( pBtn == &aReplaceBtn )
+ pSearchItem->SetCommand( SVX_SEARCHCMD_REPLACE );
+ else if ( pBtn == &aReplaceAllBtn )
+ pSearchItem->SetCommand( SVX_SEARCHCMD_REPLACE_ALL );
+
+ // wenn nach Vorlagen gesucht wird, dann Format-Listen l"oschen
+ if ( !bFormat && pSearchItem->GetPattern() )
+ {
+ if ( pSearchList )
+ pSearchList->Clear();
+
+ if ( pReplaceList )
+ pReplaceList->Clear();
+ }
+ nModifyFlag = 0;
+ const SfxPoolItem* ppArgs[] = { pSearchItem, 0 };
+ rBindings.ExecuteSynchron( FID_SEARCH_NOW, ppArgs, 0L );
+ }
+ else if ( pBtn == &aCloseBtn )
+ {
+ if ( !aLayoutBtn.IsChecked() || bInclusive )
+ {
+ String aStr( aSearchLB.GetText() );
+
+ if ( aStr.Len() )
+ Remember_Impl( aStr, sal_True );
+ aStr = aReplaceLB.GetText();
+
+ if ( aStr.Len() )
+ Remember_Impl( aStr, sal_False );
+ }
+ SaveToModule_Impl();
+ Close();
+ }
+ else if ( pBtn == &aSimilarityBtn )
+ {
+//CHINA001 SvxSearchSimilarityDialog* pDlg =
+//CHINA001 new SvxSearchSimilarityDialog( this,
+//CHINA001 pSearchItem->IsLEVRelaxed(),
+//CHINA001 pSearchItem->GetLEVOther(),
+//CHINA001 pSearchItem->GetLEVShorter(),
+//CHINA001 pSearchItem->GetLEVLonger() );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ AbstractSvxSearchSimilarityDialog* pDlg = pFact->CreateSvxSearchSimilarityDialog( LAYOUT_THIS_WINDOW (this),
+ pSearchItem->IsLEVRelaxed(),
+ pSearchItem->GetLEVOther(),
+ pSearchItem->GetLEVShorter(),
+ pSearchItem->GetLEVLonger() );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+ if ( pDlg && pDlg->Execute() == RET_OK )
+ {
+ pSearchItem->SetLEVRelaxed( pDlg->IsRelaxed() );
+ pSearchItem->SetLEVOther( pDlg->GetOther() );
+ pSearchItem->SetLEVShorter( pDlg->GetShorter() );
+ pSearchItem->SetLEVLonger( pDlg->GetLonger() );
+ SaveToModule_Impl();
+ }
+ delete pDlg;
+ }
+ }
+ else if ( pBtn == &aJapOptionsBtn )
+ {
+ SfxItemSet aSet( SFX_APP()->GetPool() );
+ pSearchItem->SetTransliterationFlags( GetTransliterationFlags() );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ AbstractSvxJSearchOptionsDialog* aDlg = pFact->CreateSvxJSearchOptionsDialog( LAYOUT_THIS_WINDOW (this), aSet,
+ pSearchItem->GetTransliterationFlags() );
+ DBG_ASSERT(aDlg, "Dialogdiet fail!");//CHINA001
+ int nRet = aDlg->Execute(); //CHINA001 int nRet = aDlg.Execute();
+ if (RET_OK == nRet) //! true only if FillItemSet of SvxJSearchOptionsPage returns true
+ {
+ sal_Int32 nFlags = aDlg->GetTransliterationFlags(); //CHINA001 sal_Int32 nFlags = aDlg.GetTransliterationFlags();
+ pSearchItem->SetTransliterationFlags( nFlags );
+ ApplyTransliterationFlags_Impl( nFlags );
+ }
+ delete aDlg; //add for CHINA001
+ }
+ }
+ else if(pBtn == &aSearchComponent1PB || pBtn == &aSearchComponent2PB )
+ {
+ uno::Sequence < beans::PropertyValue > aArgs(2);
+ beans::PropertyValue* pArgs = aArgs.getArray();
+ pArgs[0].Name = ::rtl::OUString::createFromAscii("SearchString");
+ pArgs[0].Value <<= ::rtl::OUString(aSearchLB.GetText());
+ pArgs[1].Name = ::rtl::OUString::createFromAscii("ParentWindow");
+ pArgs[1].Value <<= VCLUnoHelper::GetInterface( LAYOUT_THIS_WINDOW (this) );
+ if(pBtn == &aSearchComponent1PB)
+ {
+ if ( pImpl->xCommand1Dispatch.is() )
+ pImpl->xCommand1Dispatch->dispatch(pImpl->aCommand1URL, aArgs);
+ }
+ else
+ {
+ if ( pImpl->xCommand2Dispatch.is() )
+ pImpl->xCommand2Dispatch->dispatch(pImpl->aCommand2URL, aArgs);
+ }
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchDialog, ModifyHdl_Impl, ComboBox *, pEd )
+{
+ if ( !bSet )
+ SetModifyFlag_Impl( pEd );
+ else
+ bSet = sal_False;
+
+ if ( pEd == &aSearchLB || pEd == &aReplaceLB )
+ {
+ xub_StrLen nLBTxtLen = aSearchLB.GetText().Len(), nTxtLen;
+
+ if ( !pImpl->bMultiLineEdit )
+ nTxtLen = aSearchAttrText.GetText().Len();
+ else
+ nTxtLen = pImpl->aSearchFormats.GetText().Len();
+
+ if ( nLBTxtLen || nTxtLen )
+ {
+ EnableControl_Impl( &aSearchBtn );
+ EnableControl_Impl( &aReplaceBtn );
+ if (!bWriter || (bWriter && !aNotesBtn.IsChecked()))
+ {
+ EnableControl_Impl( &aSearchAllBtn );
+ EnableControl_Impl( &aReplaceAllBtn );
+ }
+ }
+ else
+ {
+ aSearchComponentFL.Enable(sal_False);
+ aSearchComponent1PB.Enable(sal_False);
+ aSearchComponent2PB.Enable(sal_False);
+ aSearchBtn.Disable();
+ aSearchAllBtn.Disable();
+ aReplaceBtn.Disable();
+ aReplaceAllBtn.Disable();
+ }
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchDialog, TemplateHdl_Impl, Button *, EMPTYARG )
+{
+ if ( pImpl->bSaveToModule )
+ SaveToModule_Impl();
+
+ if ( bFormat )
+ return 0;
+ String sDesc;
+
+ if ( aLayoutBtn.IsChecked() )
+ {
+ if ( !pFamilyController )
+ {
+ sal_uInt16 nId = 0;
+
+ // Vorlagen-Controller enablen
+ switch ( pSearchItem->GetFamily() )
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ nId = SID_STYLE_FAMILY1; break;
+
+ case SFX_STYLE_FAMILY_PARA:
+ nId = SID_STYLE_FAMILY2; break;
+
+ case SFX_STYLE_FAMILY_FRAME:
+ nId = SID_STYLE_FAMILY3; break;
+
+ case SFX_STYLE_FAMILY_PAGE:
+ nId = SID_STYLE_FAMILY4; break;
+
+ case SFX_STYLE_FAMILY_ALL:
+ break;
+
+ default:
+ DBG_ERROR( "StyleSheetFamily wurde geaendert?" );
+ }
+
+ rBindings.EnterRegistrations();
+ pFamilyController =
+ new SvxSearchController( nId, rBindings, *this );
+ rBindings.LeaveRegistrations();
+ aSearchTmplLB.Clear();
+ aReplaceTmplLB.Clear();
+
+ aSearchTmplLB.Show();
+ aReplaceTmplLB.Show();
+ aSearchLB.Hide();
+ aReplaceLB.Hide();
+
+ if ( !pImpl->bMultiLineEdit )
+ {
+ aSearchAttrText.SetText( sDesc );
+ aReplaceAttrText.SetText( sDesc );
+ }
+ else
+ {
+ pImpl->aSearchFormats.SetText( sDesc );
+ pImpl->aReplaceFormats.SetText( sDesc );
+ }
+ }
+ aFormatBtn.Disable();
+ aNoFormatBtn.Disable();
+ aAttributeBtn.Disable();
+ aSimilarityBox.Disable();
+ aSimilarityBtn.Disable();
+ }
+ else
+ {
+ // Vorlagen-Controller disablen
+ rBindings.EnterRegistrations();
+ DELETEZ( pFamilyController );
+ rBindings.LeaveRegistrations();
+
+ aSearchLB.Show();
+ aReplaceLB.Show();
+ aSearchTmplLB.Hide();
+ aReplaceTmplLB.Hide();
+
+ if ( !pImpl->bMultiLineEdit )
+ {
+ aSearchAttrText.SetText( BuildAttrText_Impl( sDesc, sal_True ) );
+ aReplaceAttrText.SetText( BuildAttrText_Impl( sDesc, sal_False ) );
+ }
+ else
+ {
+ pImpl->aSearchFormats.SetText( BuildAttrText_Impl( sDesc, sal_True ) );
+ pImpl->aReplaceFormats.SetText( BuildAttrText_Impl( sDesc, sal_False ) );
+ }
+
+ EnableControl_Impl( &aFormatBtn );
+ EnableControl_Impl( &aAttributeBtn );
+ EnableControl_Impl( &aSimilarityBox );
+
+ FocusHdl_Impl( bSearch ? &aSearchLB : &aReplaceLB );
+ }
+ bSet = sal_True;
+ pImpl->bSaveToModule = sal_False;
+ FlagHdl_Impl( &aLayoutBtn );
+ pImpl->bSaveToModule = sal_True;
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::Remember_Impl( const String &rStr,sal_Bool _bSearch )
+{
+ if ( !rStr.Len() )
+ return;
+
+ SvStringsDtor* pArr = _bSearch ? &aSearchStrings : &aReplaceStrings;
+ ComboBox* pListBox = _bSearch ? &aSearchLB : &aReplaceLB;
+
+ // identische Strings ignorieren
+ for ( sal_uInt16 i = 0; i < pArr->Count(); ++i )
+ {
+ if ( COMPARE_EQUAL == (*pArr)[i]->CompareTo( rStr ) )
+ return;
+ }
+
+ // bei maximaler Belegung "altesten Eintrag l"oschen (ListBox und Array)
+ String* pInsStr;
+
+ if ( pArr->Count() >= REMEMBER_SIZE )
+ {
+ pInsStr = (*pArr)[REMEMBER_SIZE - 1];
+ pListBox->RemoveEntry( sal_uInt16(REMEMBER_SIZE - 1) );
+ pArr->Remove( REMEMBER_SIZE - 1 );
+ *pInsStr = rStr;
+ }
+ else
+ pInsStr = new String( rStr );
+
+ pArr->Insert( pInsStr, 0 );
+ pListBox->InsertEntry( *pInsStr, 0 );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::TemplatesChanged_Impl( SfxStyleSheetBasePool& rPool )
+{
+// SetUpdateMode( sal_False );
+ String aOldSrch( aSearchTmplLB .GetSelectEntry() );
+ String aOldRepl( aReplaceTmplLB.GetSelectEntry() );
+ aSearchTmplLB .Clear();
+ aReplaceTmplLB.Clear();
+ rPool.SetSearchMask( pSearchItem->GetFamily(), SFXSTYLEBIT_ALL );
+ aSearchTmplLB.SetUpdateMode( sal_False );
+ aReplaceTmplLB.SetUpdateMode( sal_False );
+ SfxStyleSheetBase* pBase = rPool.First();
+
+ while ( pBase )
+ {
+ if ( pBase->IsUsed() )
+ aSearchTmplLB.InsertEntry( pBase->GetName() );
+ aReplaceTmplLB.InsertEntry( pBase->GetName() );
+ pBase = rPool.Next();
+ }
+ aSearchTmplLB.SetUpdateMode( sal_True );
+ aReplaceTmplLB.SetUpdateMode( sal_True );
+ aSearchTmplLB.SelectEntryPos(0);
+
+ if ( aOldSrch.Len() )
+ aSearchTmplLB .SelectEntry( aOldSrch );
+ aReplaceTmplLB.SelectEntryPos(0);
+
+ if ( aOldRepl.Len() )
+ aReplaceTmplLB.SelectEntry( aOldRepl );
+
+ if ( aSearchTmplLB.GetEntryCount() )
+ {
+ EnableControl_Impl( &aSearchBtn );
+ EnableControl_Impl( &aSearchAllBtn );
+ EnableControl_Impl( &aReplaceBtn );
+ EnableControl_Impl( &aReplaceAllBtn );
+ }
+// FlagHdl_Impl(0);
+// SetUpdateMode( sal_True );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::EnableControls_Impl( const sal_uInt16 nFlags )
+{
+ if ( nFlags == nOptions )
+ return;
+ else
+ nOptions = nFlags;
+
+ if ( !nOptions )
+ {
+ if ( IsVisible() )
+ {
+ Hide();
+ return;
+ }
+ }
+ else if ( !IsVisible() )
+ Show();
+ bool bNoSearch = sal_True;
+
+ sal_Bool bEnableSearch = ( SEARCH_OPTIONS_SEARCH & nOptions ) != 0;
+ aSearchBtn.Enable(bEnableSearch);
+
+ if( bEnableSearch )
+ bNoSearch = sal_False;
+
+
+ if ( ( SEARCH_OPTIONS_SEARCH_ALL & nOptions ) != 0 )
+ {
+ aSearchAllBtn.Enable();
+ bNoSearch = sal_False;
+ }
+ else
+ aSearchAllBtn.Disable();
+ if ( ( SEARCH_OPTIONS_REPLACE & nOptions ) != 0 )
+ {
+ aReplaceBtn.Enable();
+ aReplaceText.Enable();
+ aReplaceLB.Enable();
+ aReplaceTmplLB.Enable();
+ bNoSearch = sal_False;
+ }
+ else
+ {
+ aReplaceBtn.Disable();
+ aReplaceText.Disable();
+ aReplaceLB.Disable();
+ aReplaceTmplLB.Disable();
+ }
+ if ( ( SEARCH_OPTIONS_REPLACE_ALL & nOptions ) != 0 )
+ {
+ aReplaceAllBtn.Enable();
+ bNoSearch = sal_False;
+ }
+ else
+ aReplaceAllBtn.Disable();
+ aSearchComponentFL.Enable(!bNoSearch);
+ aSearchComponent1PB.Enable(!bNoSearch);
+ aSearchComponent2PB.Enable(!bNoSearch);
+ aSearchBtn.Enable( !bNoSearch );
+ aSearchText.Enable( !bNoSearch );
+ aSearchLB.Enable( !bNoSearch );
+
+ if ( ( SEARCH_OPTIONS_WHOLE_WORDS & nOptions ) != 0 )
+ aWordBtn.Enable();
+ else
+ aWordBtn.Disable();
+ if ( ( SEARCH_OPTIONS_BACKWARDS & nOptions ) != 0 )
+ aBackwardsBtn.Enable();
+ else
+ aBackwardsBtn.Disable();
+ //!if ( ( SEARCH_OPTIONS_NOTES & nOptions ) != 0 )
+ aNotesBtn.Enable();
+ //!else
+ //! aNotesBtn.Disable();
+ if ( ( SEARCH_OPTIONS_REG_EXP & nOptions ) != 0 )
+ aRegExpBtn.Enable();
+ else
+ aRegExpBtn.Disable();
+ if ( ( SEARCH_OPTIONS_EXACT & nOptions ) != 0 )
+ aMatchCaseCB.Enable();
+ else
+ aMatchCaseCB.Disable();
+ if ( ( SEARCH_OPTIONS_SELECTION & nOptions ) != 0 )
+ aSelectionBtn.Enable();
+ else
+ aSelectionBtn.Disable();
+ if ( ( SEARCH_OPTIONS_FAMILIES & nOptions ) != 0 )
+ aLayoutBtn.Enable();
+ else
+ aLayoutBtn.Disable();
+ if ( ( SEARCH_OPTIONS_FORMAT & nOptions ) != 0 )
+ {
+ aAttributeBtn.Enable();
+ aFormatBtn.Enable();
+ aNoFormatBtn.Enable();
+ }
+ else
+ {
+ aAttributeBtn.Disable();
+ aFormatBtn.Disable();
+ aNoFormatBtn.Disable();
+ }
+/*
+ if ( ( SEARCH_OPTIONS_MORE & nOptions ) != 0 &&
+ pSearchItem && pSearchItem->GetAppFlag() == SVX_SEARCHAPP_CALC )
+ pMoreBtn->Enable();
+ else
+ {
+ pMoreBtn->SetState( sal_False );
+ pMoreBtn->Disable();
+ }
+*/
+ if ( ( SEARCH_OPTIONS_SIMILARITY & nOptions ) != 0 )
+ {
+ aSimilarityBox.Enable();
+ aSimilarityBtn.Enable();
+ }
+ else
+ {
+ aSimilarityBox.Disable();
+ aSimilarityBtn.Disable();
+ }
+
+ if ( pSearchItem )
+ Init_Impl( pSearchItem->GetPattern() &&
+ ( !pSearchList || !pSearchList->Count() ) );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::EnableControl_Impl( Control* pCtrl )
+{
+ if ( &aSearchBtn == pCtrl && ( SEARCH_OPTIONS_SEARCH & nOptions ) != 0 )
+ {
+ aSearchComponentFL.Enable();
+ aSearchComponent1PB.Enable();
+ aSearchComponent2PB.Enable();
+ aSearchBtn.Enable();
+ return;
+ }
+ if ( &aSearchAllBtn == pCtrl &&
+ ( SEARCH_OPTIONS_SEARCH_ALL & nOptions ) != 0 )
+ {
+ aSearchAllBtn.Enable( ( bWriter || !aAllSheetsCB.IsChecked() ) );
+ return;
+ }
+ if ( &aReplaceBtn == pCtrl && ( SEARCH_OPTIONS_REPLACE & nOptions ) != 0 )
+ {
+ aReplaceBtn.Enable();
+ return;
+ }
+ if ( &aReplaceAllBtn == pCtrl &&
+ ( SEARCH_OPTIONS_REPLACE_ALL & nOptions ) != 0 )
+ {
+ aReplaceAllBtn.Enable();
+ return;
+ }
+ if ( &aWordBtn == pCtrl && ( SEARCH_OPTIONS_WHOLE_WORDS & nOptions ) != 0 )
+ {
+ aWordBtn.Enable();
+ return;
+ }
+ if ( &aBackwardsBtn == pCtrl && ( SEARCH_OPTIONS_BACKWARDS & nOptions ) != 0 )
+ {
+ aBackwardsBtn.Enable();
+ return;
+ }
+ if ( &aNotesBtn == pCtrl /*! && ( SEARCH_OPTIONS_NOTES & nOptions ) != 0 */ )
+ {
+ aNotesBtn.Enable();
+ return;
+ }
+ if ( &aRegExpBtn == pCtrl && ( SEARCH_OPTIONS_REG_EXP & nOptions ) != 0
+ && !aSimilarityBox.IsChecked())
+ {
+ aRegExpBtn.Enable();
+ return;
+ }
+ if ( &aMatchCaseCB == pCtrl && ( SEARCH_OPTIONS_EXACT & nOptions ) != 0 )
+ {
+ if (!aJapOptionsCB.IsChecked())
+ aMatchCaseCB.Enable();
+ return;
+ }
+ if ( &aSelectionBtn == pCtrl && ( SEARCH_OPTIONS_SELECTION & nOptions ) != 0 )
+ {
+ aSelectionBtn.Enable();
+ return;
+ }
+ if ( &aLayoutBtn == pCtrl && ( SEARCH_OPTIONS_FAMILIES & nOptions ) != 0 )
+ {
+ aLayoutBtn.Enable();
+ return;
+ }
+ if ( &aAttributeBtn == pCtrl
+ && ( SEARCH_OPTIONS_FORMAT & nOptions ) != 0
+ && pSearchList )
+ {
+ aAttributeBtn.Enable( pImpl->bFocusOnSearch );
+ }
+ if ( &aFormatBtn == pCtrl && ( SEARCH_OPTIONS_FORMAT & nOptions ) != 0 )
+ {
+ aFormatBtn.Enable();
+ return;
+ }
+ if ( &aNoFormatBtn == pCtrl && ( SEARCH_OPTIONS_FORMAT & nOptions ) != 0 )
+ {
+ aNoFormatBtn.Enable();
+ return;
+ }
+ if ( &aSimilarityBox == pCtrl &&
+ ( SEARCH_OPTIONS_SIMILARITY & nOptions ) != 0 )
+ {
+ aSimilarityBox.Enable();
+
+ if ( aSimilarityBox.IsChecked() )
+ aSimilarityBtn.Enable();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::SetItem_Impl( const SvxSearchItem* pItem )
+{
+ if ( pItem )
+ {
+ delete pSearchItem;
+ pSearchItem = (SvxSearchItem*)pItem->Clone();
+ Init_Impl( pSearchItem->GetPattern() &&
+ ( !pSearchList || !pSearchList->Count() ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchDialog, FocusHdl_Impl, Control *, pCtrl )
+{
+ xub_StrLen nTxtLen;
+
+ if ( !pImpl->bMultiLineEdit )
+ nTxtLen = aSearchAttrText.GetText().Len();
+ else
+ nTxtLen = pImpl->aSearchFormats.GetText().Len();
+
+ if ( pCtrl == &aSearchLB || pCtrl == &pImpl->aSearchFormats )
+ {
+ if ( pCtrl->HasChildPathFocus() )
+ pImpl->bFocusOnSearch = sal_True;
+ pCtrl = &aSearchLB;
+ bSearch = sal_True;
+
+ if( nTxtLen )
+ EnableControl_Impl( &aNoFormatBtn );
+ else
+ aNoFormatBtn.Disable();
+ EnableControl_Impl( &aAttributeBtn );
+ }
+ else
+ {
+ pImpl->bFocusOnSearch = sal_False;
+ pCtrl = &aReplaceLB;
+ bSearch = sal_False;
+
+ if ( ( !pImpl->bMultiLineEdit && aReplaceAttrText.GetText().Len() ) ||
+ ( pImpl->bMultiLineEdit && pImpl->aReplaceFormats.GetText().Len() ) )
+ EnableControl_Impl( &aNoFormatBtn );
+ else
+ aNoFormatBtn.Disable();
+ aAttributeBtn.Disable();
+ }
+ bSet = sal_True;
+
+ aSearchLB.SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
+
+ ModifyHdl_Impl( (ComboBox*)pCtrl );
+
+ aLayoutBtn.SetText( bFormat && nTxtLen ? aLayoutStr : aStylesStr );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchDialog, LoseFocusHdl_Impl, Control *, EMPTYARG )
+{
+ SaveToModule_Impl();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchDialog, FormatHdl_Impl, Button *, EMPTYARG )
+{
+ SfxObjectShell* pSh = SfxObjectShell::Current();
+
+ DBG_ASSERT( pSh, "no DocShell" );
+
+ if ( !pSh || !pImpl->pRanges )
+ return 0;
+
+ sal_sSize nCnt = 0;
+ const sal_uInt16* pPtr = pImpl->pRanges;
+ const sal_uInt16* pTmp = pPtr;
+
+ while( *pTmp )
+ pTmp++;
+ nCnt = pTmp - pPtr + 7;
+ sal_uInt16* pWhRanges = new sal_uInt16[nCnt];
+ sal_uInt16 nPos = 0;
+
+ while( *pPtr )
+ {
+ pWhRanges[nPos++] = *pPtr++;
+ }
+
+ pWhRanges[nPos++] = SID_ATTR_PARA_MODEL;
+ pWhRanges[nPos++] = SID_ATTR_PARA_MODEL;
+
+ sal_uInt16 nBrushWhich = pSh->GetPool().GetWhich(SID_ATTR_BRUSH);
+ pWhRanges[nPos++] = nBrushWhich;
+ pWhRanges[nPos++] = nBrushWhich;
+ pWhRanges[nPos++] = SID_PARA_BACKGRND_DESTINATION;
+ pWhRanges[nPos++] = SID_PARA_BACKGRND_DESTINATION;
+ pWhRanges[nPos] = 0;
+ SfxItemPool& rPool = pSh->GetPool();
+ SfxItemSet aSet( rPool, pWhRanges );
+ String aTxt;
+
+ aSet.InvalidateAllItems();
+ aSet.Put(SvxBrushItem(nBrushWhich));
+ aSet.Put(SfxUInt16Item(SID_PARA_BACKGRND_DESTINATION, PARA_DEST_CHAR));
+
+ if ( bSearch )
+ {
+ aTxt = SVX_RESSTR( RID_SVXSTR_SEARCH );
+ pSearchList->Get( aSet );
+ }
+ else
+ {
+ aTxt = SVX_RESSTR( RID_SVXSTR_REPLACE );
+ pReplaceList->Get( aSet );
+ }
+ aSet.DisableItem(SID_ATTR_PARA_MODEL);
+ aSet.DisableItem(rPool.GetWhich(SID_ATTR_PARA_PAGEBREAK));
+ aSet.DisableItem(rPool.GetWhich(SID_ATTR_PARA_KEEP));
+
+ //CHINA001 SvxSearchFormatDialog* pDlg = new SvxSearchFormatDialog( this, aSet );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ SfxAbstractTabDialog* pDlg = pFact->CreateTabItemDialog( LAYOUT_THIS_WINDOW (this), aSet, RID_SVXDLG_SEARCHFORMAT );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+ aTxt.Insert( pDlg->GetText(), 0 );
+ pDlg->SetText( aTxt );
+
+ if ( pDlg->Execute() == RET_OK )
+ {
+ DBG_ASSERT( pDlg->GetOutputItemSet(), "invalid Output-Set" );
+ SfxItemSet aOutSet( *pDlg->GetOutputItemSet() );
+
+ SearchAttrItemList* pList = bSearch ? pSearchList : pReplaceList;
+
+ SearchAttrItem* pAItem;
+ const SfxPoolItem* pItem;
+ for( sal_uInt16 n = 0; n < pList->Count(); ++n )
+ if( !IsInvalidItem( (pAItem = &pList->GetObject(n))->pItem ) &&
+ SFX_ITEM_SET == aOutSet.GetItemState(
+ pAItem->pItem->Which(), sal_False, &pItem ) )
+ {
+ delete pAItem->pItem;
+ pAItem->pItem = pItem->Clone();
+ aOutSet.ClearItem( pAItem->pItem->Which() );
+ }
+
+ if( aOutSet.Count() )
+ pList->Put( aOutSet );
+
+ PaintAttrText_Impl(); // AttributText in GroupBox setzen
+ }
+ delete pDlg;
+ }
+ delete[] pWhRanges;
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchDialog, NoFormatHdl_Impl, Button *, EMPTYARG )
+{
+ aLayoutBtn.SetText( aStylesStr );
+ bFormat = sal_False;
+ aLayoutBtn.Check( sal_False );
+
+ if ( bSearch )
+ {
+ if ( !pImpl->bMultiLineEdit )
+ aSearchAttrText.SetText( String() );
+ else
+ pImpl->aSearchFormats.SetText( String() );
+ pSearchList->Clear();
+ }
+ else
+ {
+ if ( !pImpl->bMultiLineEdit )
+ aReplaceAttrText.SetText( String() );
+ else
+ pImpl->aReplaceFormats.SetText( String() );
+ pReplaceList->Clear();
+ }
+ pImpl->bSaveToModule = sal_False;
+ TemplateHdl_Impl( &aLayoutBtn );
+ pImpl->bSaveToModule = sal_True;
+ aNoFormatBtn.Disable();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchDialog, AttributeHdl_Impl, Button *, EMPTYARG )
+{
+ if ( !pSearchList || !pImpl->pRanges )
+ return 0;
+
+ //CHINA001 SvxSearchAttributeDialog* pDlg = new SvxSearchAttributeDialog( this, *pSearchList, pImpl->pRanges );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ VclAbstractDialog* pDlg = pFact->CreateSvxSearchAttributeDialog( LAYOUT_THIS_WINDOW (this), *pSearchList, pImpl->pRanges );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+ pDlg->Execute();
+ delete pDlg;
+ }
+ PaintAttrText_Impl();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchDialog, TimeoutHdl_Impl, Timer *, pTimer )
+{
+ SfxViewShell* pViewShell = SfxViewShell::Current();
+
+ if ( pViewShell )
+ {
+ if ( pViewShell->HasSelection( aSearchLB.IsVisible() ) )
+ EnableControl_Impl( &aSelectionBtn );
+ else
+ {
+ aSelectionBtn.Check( sal_False );
+ aSelectionBtn.Disable();
+ }
+ }
+
+ pTimer->Start();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::GetSearchItems( SfxItemSet& rSet )
+{
+ xub_StrLen nLen;
+
+ if ( !pImpl->bMultiLineEdit )
+ nLen = aSearchAttrText.GetText().Len();
+ else
+ nLen = pImpl->aSearchFormats.GetText().Len();
+
+ if ( nLen && pSearchList )
+ pSearchList->Get( rSet );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::GetReplaceItems( SfxItemSet& rSet )
+{
+ xub_StrLen nLen;
+
+ if ( !pImpl->bMultiLineEdit )
+ nLen = aReplaceAttrText.GetText().Len();
+ else
+ nLen = pImpl->aReplaceFormats.GetText().Len();
+
+ if ( nLen && pReplaceList )
+ pReplaceList->Get( rSet );
+}
+
+// -----------------------------------------------------------------------
+
+String& SvxSearchDialog::BuildAttrText_Impl( String& rStr,
+ sal_Bool bSrchFlag ) const
+{
+ if ( rStr.Len() )
+ rStr.Erase();
+
+ SfxObjectShell* pSh = SfxObjectShell::Current();
+ DBG_ASSERT( pSh, "no DocShell" );
+
+ if ( !pSh )
+ return rStr;
+
+ SfxItemPool& rPool = pSh->GetPool();
+ SearchAttrItemList* pList = bSrchFlag ? pSearchList : pReplaceList;
+
+ if ( !pList )
+ return rStr;
+
+ // Metrik abfragen
+ SfxMapUnit eMapUnit = SFX_MAPUNIT_CM;
+ FieldUnit eFieldUnit = pSh->GetModule()->GetFieldUnit();
+ switch ( eFieldUnit )
+ {
+ case FUNIT_MM: eMapUnit = SFX_MAPUNIT_MM; break;
+ case FUNIT_CM:
+ case FUNIT_M:
+ case FUNIT_KM: eMapUnit = SFX_MAPUNIT_CM; break;
+ case FUNIT_TWIP: eMapUnit = SFX_MAPUNIT_TWIP; break;
+ case FUNIT_POINT:
+ case FUNIT_PICA: eMapUnit = SFX_MAPUNIT_POINT; break;
+ case FUNIT_INCH:
+ case FUNIT_FOOT:
+ case FUNIT_MILE: eMapUnit = SFX_MAPUNIT_INCH; break;
+ case FUNIT_100TH_MM: eMapUnit = SFX_MAPUNIT_100TH_MM; break;
+ default: ;//prevent warning
+ }
+
+ ResStringArray aAttrNames( SVX_RES( RID_ATTR_NAMES ) );
+
+ for ( sal_uInt16 i = 0; i < pList->Count(); ++i )
+ {
+ const SearchAttrItem& rItem = pList->GetObject(i);
+
+ if ( rStr.Len() )
+ rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) );
+
+ if ( !IsInvalidItem( rItem.pItem ) )
+ {
+ String aStr;
+ rPool.GetPresentation( *rItem.pItem,
+ SFX_ITEM_PRESENTATION_COMPLETE,
+ eMapUnit, aStr );
+ rStr += aStr;
+ }
+ else if ( rItem.nSlot == SID_ATTR_BRUSH_CHAR )
+ {
+ //Sonderbehandlung fuer Zeichenhintergrund
+ rStr += SVX_RESSTR( RID_SVXITEMS_BRUSH_CHAR );
+ }
+ else
+ {
+ sal_uInt32 nId = aAttrNames.FindIndex( rItem.nSlot );
+ if ( RESARRAY_INDEX_NOTFOUND != nId )
+ rStr += aAttrNames.GetString( nId );
+ }
+ }
+ return rStr;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::PaintAttrText_Impl()
+{
+ String aDesc;
+ BuildAttrText_Impl( aDesc, bSearch );
+
+ if ( !bFormat && aDesc.Len() )
+ bFormat = sal_True;
+
+ if ( bSearch )
+ {
+ if ( !pImpl->bMultiLineEdit )
+ aSearchAttrText.SetText( aDesc );
+ else
+ pImpl->aSearchFormats.SetText( aDesc );
+ FocusHdl_Impl( &aSearchLB );
+ }
+ else
+ {
+ if ( !pImpl->bMultiLineEdit )
+ aReplaceAttrText.SetText( aDesc );
+ else
+ pImpl->aReplaceFormats.SetText( aDesc );
+ FocusHdl_Impl( &aReplaceLB );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::SetModifyFlag_Impl( const Control* pCtrl )
+{
+ if ( &aSearchLB == (ComboBox*)pCtrl )
+ nModifyFlag |= MODIFY_SEARCH;
+ else if ( &aReplaceLB == (ComboBox*)pCtrl )
+ nModifyFlag |= MODIFY_REPLACE;
+ else if ( &aWordBtn == (CheckBox*)pCtrl )
+ nModifyFlag |= MODIFY_WORD;
+ else if ( &aMatchCaseCB == (CheckBox*)pCtrl )
+ nModifyFlag |= MODIFY_EXACT;
+ else if ( &aBackwardsBtn == (CheckBox*)pCtrl )
+ nModifyFlag |= MODIFY_BACKWARDS;
+ else if ( &aNotesBtn == (CheckBox*)pCtrl )
+ nModifyFlag |= MODIFY_NOTES;
+ else if ( &aSelectionBtn == (CheckBox*)pCtrl )
+ nModifyFlag |= MODIFY_SELECTION;
+ else if ( &aRegExpBtn == (CheckBox*)pCtrl )
+ nModifyFlag |= MODIFY_REGEXP;
+ else if ( &aLayoutBtn == (CheckBox*)pCtrl )
+ nModifyFlag |= MODIFY_LAYOUT;
+ else if ( &aSimilarityBox == (CheckBox*)pCtrl )
+ nModifyFlag |= MODIFY_SIMILARITY;
+ else if ( &aCalcSearchInLB == (ListBox*)pCtrl )
+ {
+ nModifyFlag |= MODIFY_FORMULAS;
+ nModifyFlag |= MODIFY_VALUES;
+ nModifyFlag |= MODIFY_CALC_NOTES;
+ }
+ else if ( &aRowsBtn == (RadioButton*)pCtrl )
+ nModifyFlag |= MODIFY_ROWS;
+ else if ( &aColumnsBtn == (RadioButton*)pCtrl )
+ nModifyFlag |= MODIFY_COLUMNS;
+ else if ( &aAllSheetsCB == (CheckBox*)pCtrl )
+ nModifyFlag |= MODIFY_ALLTABLES;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::SaveToModule_Impl()
+{
+ if ( !pSearchItem )
+ return;
+
+ if ( aLayoutBtn.IsChecked() )
+ {
+ pSearchItem->SetSearchString ( aSearchTmplLB.GetSelectEntry() );
+ pSearchItem->SetReplaceString( aReplaceTmplLB.GetSelectEntry() );
+ }
+ else
+ {
+ pSearchItem->SetSearchString ( aSearchLB.GetText() );
+ pSearchItem->SetReplaceString( aReplaceLB.GetText() );
+ Remember_Impl( aSearchLB.GetText(), sal_True );
+ }
+
+ pSearchItem->SetRegExp( sal_False );
+ pSearchItem->SetLevenshtein( sal_False );
+ if (GetCheckBoxValue( aRegExpBtn ))
+ pSearchItem->SetRegExp( sal_True );
+ else if (GetCheckBoxValue( aSimilarityBox ))
+ pSearchItem->SetLevenshtein( sal_True );
+
+ pSearchItem->SetWordOnly( GetCheckBoxValue( aWordBtn ) );
+ pSearchItem->SetBackward( GetCheckBoxValue( aBackwardsBtn ) );
+ pSearchItem->SetNotes( GetCheckBoxValue( aNotesBtn ) );
+ pSearchItem->SetPattern( GetCheckBoxValue( aLayoutBtn ) );
+ pSearchItem->SetSelection( GetCheckBoxValue( aSelectionBtn ) );
+
+ pSearchItem->SetUseAsianOptions( GetCheckBoxValue( aJapOptionsCB ) );
+ sal_Int32 nFlags = GetTransliterationFlags();
+ if( !pSearchItem->IsUseAsianOptions())
+ nFlags &= (TransliterationModules_IGNORE_CASE |
+ TransliterationModules_IGNORE_WIDTH );
+ pSearchItem->SetTransliterationFlags( nFlags );
+
+ if ( !bWriter )
+ {
+ if ( aCalcSearchInLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND )
+ pSearchItem->SetCellType( aCalcSearchInLB.GetSelectEntryPos() );
+
+ pSearchItem->SetRowDirection( aRowsBtn.IsChecked() );
+ pSearchItem->SetAllTables( aAllSheetsCB.IsChecked() );
+ }
+
+ pSearchItem->SetCommand( SVX_SEARCHCMD_FIND );
+ nModifyFlag = 0;
+ const SfxPoolItem* ppArgs[] = { pSearchItem, 0 };
+ rBindings.GetDispatcher()->Execute( SID_SEARCH_ITEM, SFX_CALLMODE_SLOT, ppArgs );
+}
+
+// class SvxSearchDialogWrapper ------------------------------------------
+
+SFX_IMPL_CHILDWINDOW(SvxSearchDialogWrapper, SID_SEARCH_DLG);
+
+// -----------------------------------------------------------------------
+
+SvxSearchDialogWrapper::SvxSearchDialogWrapper( Window* _pParent, sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo )
+ : SfxChildWindow( _pParent, nId )
+ , dialog (new SvxSearchDialog (_pParent, this, *pBindings))
+{
+ pWindow = LAYOUT_THIS_WINDOW (dialog);
+ dialog->Initialize( pInfo );
+
+ pBindings->Update( SID_SEARCH_ITEM );
+ pBindings->Update( SID_SEARCH_OPTIONS );
+ pBindings->Update( SID_SEARCH_SEARCHSET );
+ pBindings->Update( SID_SEARCH_REPLACESET );
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+ dialog->bConstruct = sal_False;
+}
+
+SvxSearchDialogWrapper::~SvxSearchDialogWrapper ()
+{
+#if ENABLE_LAYOUT
+ delete dialog;
+ pWindow = 0;
+#endif /* ENABLE_LAYOUT */
+}
+
+SvxSearchDialog *SvxSearchDialogWrapper::getDialog ()
+{
+ return dialog;
+}
+
+// -----------------------------------------------------------------------
+
+SfxChildWinInfo SvxSearchDialogWrapper::GetInfo() const
+{
+ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo();
+ aInfo.bVisible = sal_False;
+ return aInfo;
+}
+
diff --git a/svx/source/dialog/srchdlg.hrc b/svx/source/dialog/srchdlg.hrc
new file mode 100644
index 000000000000..6632b11fd7c8
--- /dev/null
+++ b/svx/source/dialog/srchdlg.hrc
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_SRCHDLG_HRC
+#define _SVX_SRCHDLG_HRC
+
+// defines ------------------------------------------------------------------
+
+#define FT_SEARCH 10
+#define ED_SEARCH 11
+#define LB_SEARCH 12
+#define FT_SEARCH_ATTR 13
+#define FT_SEARCH_FORMATS 14
+#define FT_REPLACE 15
+#define ED_REPLACE 16
+#define LB_REPLACE 17
+#define FT_REPLACE_ATTR 18
+#define FT_REPLACE_FORMATS 19
+
+#define BTN_SEARCH 20
+#define BTN_SEARCH_ALL 21
+#define FL_SEARCH_COMMAND 22
+#define BTN_REPLACE 23
+#define BTN_REPLACE_ALL 24
+
+#define CB_MATCH_CASE 25
+#define CB_WHOLE_WORDS 26
+#define FL_SEARCH_COMPONENT 27
+#define BTN_COMPONENT_1 28
+#define BTN_COMPONENT_2 29
+
+#define FL_BUTTONS 30
+#define BTN_MORE 31
+#define BTN_HELP 32
+#define BTN_CLOSE 33
+
+#define FL_OPTIONS 40
+#define CB_SELECTIONS 41
+#define CB_BACKWARDS 42
+#define CB_REGEXP 43
+#define CB_SIMILARITY 44
+#define PB_SIMILARITY 45
+#define CB_LAYOUTS 46
+#define CB_JAP_MATCH_FULL_HALF_WIDTH 47
+#define CB_JAP_SOUNDS_LIKE 48
+#define PB_JAP_OPTIONS 49
+
+#define BTN_ATTRIBUTE 50
+#define BTN_FORMAT 51
+#define BTN_NOFORMAT 52
+
+#define FL_CALC 53
+#define FT_CALC_SEARCHIN 54
+#define LB_CALC_SEARCHIN 55
+#define FT_CALC_SEARCHDIR 56
+#define RB_CALC_ROWS 57
+#define RB_CALC_COLUMNS 58
+#define CB_ALL_SHEETS 59
+
+#define CB_NOTES 60
+
+#define IMG_MOREBTN_DOWN 100
+#define IMG_MOREBTN_UP 101
+
+#define STR_WORDCALC 100
+#define STR_MORE_BTN 101
+#define STR_LESS_BTN 102
+
+#endif // #ifndef _SVX_SRCHDLG_HRC
+
diff --git a/svx/source/dialog/srchdlg.src b/svx/source/dialog/srchdlg.src
new file mode 100644
index 000000000000..f82d4f06cb88
--- /dev/null
+++ b/svx/source/dialog/srchdlg.src
@@ -0,0 +1,442 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+ // include ---------------------------------------------------------------
+
+#include <svx/dialogs.hrc>
+#include "srchdlg.hrc"
+#include <sfx2/sfxcommands.h>
+
+#define MASKCOLOR MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; } ;
+
+ // Strings ---------------------------------------------------------------
+
+String RID_SVXSTR_SEARCH_STYLES
+{
+ Text [ en-US ] = "Including Styles" ;
+};
+String RID_SVXSTR_SEARCH
+{
+ Text [ en-US ] = "(Search)" ;
+};
+String RID_SVXSTR_REPLACE
+{
+ Text [ en-US ] = "(Replace)" ;
+};
+
+ // RID_SVXDLG_SEARCH -----------------------------------------------------
+
+ModelessDialog RID_SVXDLG_SEARCH
+{
+ HelpId = CMD_SID_SEARCH_DLG ;
+ OutputSize = TRUE ;
+ Hide = TRUE ;
+ SvLook = TRUE ;
+ Size = MAP_APPFONT ( 200 , 155 ) ;
+ Text [ en-US ] = "Find & Replace" ;
+ Moveable = TRUE ;
+ FixedText FT_SEARCH
+ {
+ Pos = MAP_APPFONT ( 6 , 7 ) ;
+ Size = MAP_APPFONT ( 132 , 8 ) ;
+ Text [ en-US ] = "~Search for" ;
+ };
+ ComboBox ED_SEARCH
+ {
+ HelpID = "svx:ComboBox:RID_SVXDLG_SEARCH:ED_SEARCH";
+ Pos = MAP_APPFONT ( 6 , 18 ) ;
+ Size = MAP_APPFONT ( 132 , 98 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ ListBox LB_SEARCH
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_SEARCH:LB_SEARCH";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 18 ) ;
+ Size = MAP_APPFONT ( 132 , 98 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Hide = TRUE ;
+ Sort = TRUE ;
+ };
+ FixedText FT_SEARCH_ATTR
+ {
+ Pos = MAP_APPFONT ( 9 , 35 ) ;
+ Size = MAP_APPFONT ( 129 , 16 ) ;
+ WordBreak = TRUE ;
+ Hide = TRUE ;
+ };
+ FixedText FT_SEARCH_FORMATS
+ {
+ Pos = MAP_APPFONT ( 9 , 35 ) ;
+ Size = MAP_APPFONT ( 129 , 16 ) ;
+ WordBreak = TRUE ;
+ Hide = TRUE ;
+ };
+ FixedText FT_REPLACE
+ {
+ Pos = MAP_APPFONT ( 6 , 54 ) ;
+ Size = MAP_APPFONT ( 132 , 8 ) ;
+ Text [ en-US ] = "Re~place with" ;
+ };
+ ComboBox ED_REPLACE
+ {
+ HelpID = "svx:ComboBox:RID_SVXDLG_SEARCH:ED_REPLACE";
+ Pos = MAP_APPFONT ( 6 , 65 ) ;
+ Size = MAP_APPFONT ( 132 , 98 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ ListBox LB_REPLACE
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_SEARCH:LB_REPLACE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 65 ) ;
+ Size = MAP_APPFONT ( 132 , 98 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Hide = TRUE ;
+ Sort = TRUE ;
+ };
+ FixedText FT_REPLACE_ATTR
+ {
+ Pos = MAP_APPFONT ( 9 , 82 ) ;
+ Size = MAP_APPFONT ( 129 , 16 ) ;
+ WordBreak = TRUE ;
+ Hide = TRUE ;
+ };
+ FixedText FT_REPLACE_FORMATS
+ {
+ Pos = MAP_APPFONT ( 9 , 82 ) ;
+ Size = MAP_APPFONT ( 129 , 16 ) ;
+ WordBreak = TRUE ;
+ Hide = TRUE ;
+ };
+ PushButton BTN_SEARCH
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_SEARCH:BTN_SEARCH";
+ Pos = MAP_APPFONT ( 144 , 9 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Find" ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ PushButton BTN_SEARCH_ALL
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_SEARCH:BTN_SEARCH_ALL";
+ Pos = MAP_APPFONT ( 144 , 26 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "Find ~All" ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_SEARCH_COMMAND
+ {
+ Pos = MAP_APPFONT ( 141 , 44 ) ;
+ Size = MAP_APPFONT ( 56 , 8 ) ;
+ };
+ PushButton BTN_REPLACE
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_SEARCH:BTN_REPLACE";
+ Pos = MAP_APPFONT ( 144 , 56 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Replace" ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_REPLACE_ALL
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_SEARCH:BTN_REPLACE_ALL";
+ Pos = MAP_APPFONT ( 144 , 73 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "Replace A~ll" ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_SEARCH_COMPONENT
+ {
+ Pos = MAP_APPFONT ( 141 , 91 ) ;
+ Size = MAP_APPFONT ( 56 , 8 ) ;
+ Hide = TRUE;
+ };
+ PushButton BTN_COMPONENT_1
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_SEARCH:BTN_COMPONENT_1";
+ Pos = MAP_APPFONT ( 144 , 103 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE;
+ };
+ PushButton BTN_COMPONENT_2
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_SEARCH:BTN_COMPONENT_2";
+ Pos = MAP_APPFONT ( 144 , 120 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE;
+ };
+ CheckBox CB_MATCH_CASE
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_SEARCH:CB_MATCH_CASE";
+ Pos = MAP_APPFONT ( 12 , 101 ) ;
+ Size = MAP_APPFONT ( 126 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Ma~tch case";
+ };
+ CheckBox CB_WHOLE_WORDS
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_SEARCH:CB_WHOLE_WORDS";
+ Pos = MAP_APPFONT ( 12 , 114 ) ;
+ Size = MAP_APPFONT ( 126 , 10 ) ;
+ Text [ en-US ] = "Whole wor~ds only" ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_BUTTONS
+ {
+ Pos = MAP_APPFONT ( 0 , 124 ) ;
+ Size = MAP_APPFONT ( 200 , 8 ) ;
+ };
+ MoreButton BTN_MORE
+ {
+ HelpID = "svx:MoreButton:RID_SVXDLG_SEARCH:BTN_MORE";
+ Pos = MAP_APPFONT ( 6 , 135 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ MapUnit = MAP_APPFONT ;
+ Delta = 174 ;
+ State = FALSE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 88 , 135 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ CancelButton BTN_CLOSE
+ {
+ Pos = MAP_APPFONT ( 144 , 135 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Close" ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 6 , 152 ) ;
+ Size = MAP_APPFONT ( 191 , 8 ) ;
+ Hide = TRUE ;
+ };
+ CheckBox CB_SELECTIONS
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_SEARCH:CB_SELECTIONS";
+ Pos = MAP_APPFONT ( 12 , 163 ) ;
+ Size = MAP_APPFONT ( 126 , 10 ) ;
+ Text [ en-US ] = "C~urrent selection only" ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ CheckBox CB_BACKWARDS
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_SEARCH:CB_BACKWARDS";
+ Pos = MAP_APPFONT ( 12 , 176 ) ;
+ Size = MAP_APPFONT ( 126 , 10 ) ;
+ Text [ en-US ] = "Bac~kwards" ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ CheckBox CB_REGEXP
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_SEARCH:CB_REGEXP";
+ Pos = MAP_APPFONT ( 12 , 189 ) ;
+ Size = MAP_APPFONT ( 126 , 10 ) ;
+ Text [ en-US ] = "Regular e~xpressions" ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ CheckBox CB_SIMILARITY
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_SEARCH:CB_SIMILARITY";
+ Pos = MAP_APPFONT ( 12 , 204 ) ;
+ Size = MAP_APPFONT ( 109 , 10 ) ;
+ Text [ en-US ] = "S~imilarity search" ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ PushButton PB_SIMILARITY
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_SEARCH:PB_SIMILARITY";
+ Pos = MAP_APPFONT ( 124 , 202 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ Text = "~..." ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ CheckBox CB_LAYOUTS
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_SEARCH:CB_LAYOUTS";
+ Pos = MAP_APPFONT ( 12 , 219 ) ;
+ Size = MAP_APPFONT ( 126 , 10 ) ;
+ Text [ en-US ] = "Search for St~yles" ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ CheckBox CB_NOTES
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_SEARCH:CB_NOTES";
+ Pos = MAP_APPFONT ( 12 , 232 ) ;
+ Size = MAP_APPFONT ( 126 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Notes";
+ };
+ CheckBox CB_JAP_MATCH_FULL_HALF_WIDTH
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_SEARCH:CB_JAP_MATCH_FULL_HALF_WIDTH";
+ Pos = MAP_APPFONT ( 12 , 247 ) ;
+ Size = MAP_APPFONT ( 126 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Match character width";
+ Hide = TRUE ;
+ };
+ CheckBox CB_JAP_SOUNDS_LIKE
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_SEARCH:CB_JAP_SOUNDS_LIKE";
+ Pos = MAP_APPFONT ( 12 , 260 ) ;
+ Size = MAP_APPFONT ( 109 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Sounds like (Japanese)";
+ Hide = TRUE ;
+ };
+ PushButton PB_JAP_OPTIONS
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_SEARCH:PB_JAP_OPTIONS";
+ Pos = MAP_APPFONT ( 124 , 258 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ Text = "..." ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ PushButton BTN_ATTRIBUTE
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_SEARCH:BTN_ATTRIBUTE";
+ Pos = MAP_APPFONT ( 144 , 163 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "Attri~butes..." ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ PushButton BTN_FORMAT
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_SEARCH:BTN_FORMAT";
+ Pos = MAP_APPFONT ( 144 , 180 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "For~mat..." ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ PushButton BTN_NOFORMAT
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_SEARCH:BTN_NOFORMAT";
+ Pos = MAP_APPFONT ( 144 , 197 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~No Format" ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ FixedLine FL_CALC
+ {
+ Pos = MAP_APPFONT ( 6 , 272 ) ;
+ Size = MAP_APPFONT ( 191 , 8 ) ;
+ Hide = TRUE ;
+ };
+ FixedText FT_CALC_SEARCHIN
+ {
+ Pos = MAP_APPFONT ( 12 , 285 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "Search i~n" ;
+ Hide = TRUE ;
+ };
+ ListBox LB_CALC_SEARCHIN
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_SEARCH:LB_CALC_SEARCHIN";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 75 , 283 ) ;
+ Size = MAP_APPFONT ( 63 , 48 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Hide = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Formulas" ; Default ; > ;
+ < "Values" ; Default ; > ;
+ < "Notes" ; Default ; > ;
+ };
+ };
+ FixedText FT_CALC_SEARCHDIR
+ {
+ Pos = MAP_APPFONT ( 12 , 300 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "Search ~direction" ;
+ Hide = TRUE ;
+ };
+ RadioButton RB_CALC_ROWS
+ {
+ HelpID = "svx:RadioButton:RID_SVXDLG_SEARCH:RB_CALC_ROWS";
+ Pos = MAP_APPFONT ( 75 , 300 ) ;
+ Size = MAP_APPFONT ( 63 , 10 ) ;
+ Text [ en-US ] = "Ro~ws" ;
+ Hide = TRUE ;
+ };
+ RadioButton RB_CALC_COLUMNS
+ {
+ HelpID = "svx:RadioButton:RID_SVXDLG_SEARCH:RB_CALC_COLUMNS";
+ Pos = MAP_APPFONT ( 75 , 313 ) ;
+ Size = MAP_APPFONT ( 63 , 10 ) ;
+ Text [ en-US ] = "Colu~mns" ;
+ Hide = TRUE ;
+ };
+ CheckBox CB_ALL_SHEETS
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_SEARCH:CB_ALL_SHEETS";
+ Pos = MAP_APPFONT ( 12 , 326 ) ;
+ Size = MAP_APPFONT ( 126 , 10 ) ;
+ Text [ en-US ] = "Search in all sheets" ;
+ Hide = TRUE ;
+ };
+
+ String STR_WORDCALC
+ {
+ Text [ en-US ] = "~Entire cells" ;
+ };
+ String STR_MORE_BTN
+ {
+ Text [ en-US ] = "More ~Options" ;
+ };
+ String STR_LESS_BTN
+ {
+ Text [ en-US ] = "Fewer ~Options" ;
+ };
+};
+
+ // ********************************************************************** EOF
+
diff --git a/svx/source/dialog/stddlg.cxx b/svx/source/dialog/stddlg.cxx
new file mode 100644
index 000000000000..0cd6421f5a77
--- /dev/null
+++ b/svx/source/dialog/stddlg.cxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+
+#include <svx/stddlg.hxx>
+
+// STATIC DATA -----------------------------------------------------------
+
+
+// class SvxStandardDialog -----------------------------------------------
+
+short SvxStandardDialog::Execute()
+{
+ short nRet = ModalDialog::Execute();
+
+ if ( RET_OK == nRet )
+ Apply();
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+SvxStandardDialog::SvxStandardDialog( Window *pParent, const ResId &rResId ) :
+ SfxModalDialog( pParent, rResId )
+{
+}
+
+// -----------------------------------------------------------------------
+
+__EXPORT SvxStandardDialog::~SvxStandardDialog()
+{
+}
+
+
+
diff --git a/svx/source/dialog/strarray.cxx b/svx/source/dialog/strarray.cxx
new file mode 100644
index 000000000000..47cb66850e9f
--- /dev/null
+++ b/svx/source/dialog/strarray.cxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <tools/shl.hxx>
+
+// include ---------------------------------------------------------------
+
+#include <svx/dialogs.hrc> // -> RID_SVXSTR_LANGUAGE_TABLE
+#include <svx/dialmgr.hxx>
+#include <svx/strarray.hxx>
+
+//------------------------------------------------------------------------
+
+SvxStringArray::SvxStringArray( sal_uInt32 nResId ) :
+
+ ResStringArray( SVX_RES( nResId ) )
+
+{
+}
+
+//------------------------------------------------------------------------
+
+SvxStringArray::SvxStringArray( const ResId& rResId ) :
+ ResStringArray( rResId )
+{
+}
+
+
+//------------------------------------------------------------------------
+
+SvxStringArray::~SvxStringArray()
+{
+}
+
+//------------------------------------------------------------------------
+
+const String& SvxStringArray::GetStringByPos( sal_uInt32 nPos ) const
+{
+ if ( RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count() )
+ return ResStringArray::GetString( nPos );
+ else
+ return String::EmptyString();
+}
+
+//------------------------------------------------------------------------
+
+const String& SvxStringArray::GetStringByType( long nType ) const
+{
+ sal_uInt32 nPos = FindIndex( nType );
+
+ if ( RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count() )
+ return ResStringArray::GetString( nPos );
+ else
+ return String::EmptyString();
+}
+
+//------------------------------------------------------------------------
+
+long SvxStringArray::GetValueByStr( const String& rStr ) const
+{
+ long nType = 0;
+ sal_uInt32 nCount = Count();
+
+ for ( sal_uInt32 i = 0; i < nCount; ++i )
+ if ( rStr == ResStringArray::GetString( i ) )
+ {
+ nType = GetValue( i );
+ break;
+ }
+ return nType;
+}
+
+
diff --git a/svx/source/dialog/svxbmpnumvalueset.cxx b/svx/source/dialog/svxbmpnumvalueset.cxx
new file mode 100644
index 000000000000..dd4b03147445
--- /dev/null
+++ b/svx/source/dialog/svxbmpnumvalueset.cxx
@@ -0,0 +1,572 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/dialmgr.hxx>
+#ifndef _SVX_DIALOGS_HRC
+#include <svx/dialogs.hrc>
+#endif
+#include <tools/shl.hxx>
+#include <i18npool/mslangid.hxx>
+#include <svtools/valueset.hxx>
+#include <svl/languageoptions.hxx>
+#ifndef _SVX_HELPID_HRC
+#include <helpid.hrc>
+#endif
+#include <editeng/numitem.hxx>
+#include <svl/eitem.hxx>
+#include <vcl/svapp.hxx>
+#include <svx/gallery.hxx>
+#include <svl/urihelper.hxx>
+#include <editeng/brshitem.hxx>
+#include <svl/intitem.hxx>
+#include <sfx2/objsh.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/msgbox.hxx>
+#include <editeng/flstitem.hxx>
+#include <svx/dlgutil.hxx>
+#ifndef _XTABLE_HXX //autogen
+
+#include <svx/xtable.hxx>
+#endif
+#include <svx/drawitem.hxx>
+#include <svx/numvset.hxx>
+#include <svx/htmlmode.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svtools/ctrltool.hxx>
+#include <editeng/unolingu.hxx>
+#include <com/sun/star/style/NumberingType.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/text/XDefaultNumberingProvider.hpp>
+#include <com/sun/star/text/XNumberingFormatter.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/text/XNumberingTypeInfo.hpp>
+
+#include <algorithm>
+#include <sfx2/opengrf.hxx>
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::i18n;
+using namespace com::sun::star::text;
+using namespace com::sun::star::container;
+using namespace com::sun::star::style;
+using rtl::OUString;
+
+#define C2U(cChar) OUString::createFromAscii(cChar)
+#define NUM_PAGETYPE_BULLET 0
+#define NUM_PAGETYPE_SINGLENUM 1
+#define NUM_PAGETYPE_NUM 2
+#define NUM_PAGETYPE_BMP 3
+#define PAGETYPE_USER_START 10
+
+#define SHOW_NUMBERING 0
+#define SHOW_BULLET 1
+#define SHOW_BITMAP 2
+
+#define MAX_BMP_WIDTH 16
+#define MAX_BMP_HEIGHT 16
+
+static const sal_Char cNumberingType[] = "NumberingType";
+static const sal_Char cValue[] = "Value";
+static const sal_Char cParentNumbering[] = "ParentNumbering";
+static const sal_Char cPrefix[] = "Prefix";
+static const sal_Char cSuffix[] = "Suffix";
+static const sal_Char cBulletChar[] = "BulletChar";
+static const sal_Char cBulletFontName[] = "BulletFontName";
+
+/* -----------------28.10.98 08:32-------------------
+ *
+ * --------------------------------------------------*/
+// Die Auswahl an Bullets aus den StarSymbol
+static const sal_Unicode aBulletTypes[] =
+{
+ 0x2022,
+ 0x25cf,
+ 0xe00c,
+ 0xe00a,
+ 0x2794,
+ 0x27a2,
+ 0x2717,
+ 0x2714
+};
+
+static Font& lcl_GetDefaultBulletFont()
+{
+ static sal_Bool bInit = 0;
+ static Font aDefBulletFont( UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "StarSymbol" ) ),
+ String(), Size( 0, 14 ) );
+ if(!bInit)
+ {
+ aDefBulletFont.SetCharSet( RTL_TEXTENCODING_SYMBOL );
+ aDefBulletFont.SetFamily( FAMILY_DONTKNOW );
+ aDefBulletFont.SetPitch( PITCH_DONTKNOW );
+ aDefBulletFont.SetWeight( WEIGHT_DONTKNOW );
+ aDefBulletFont.SetTransparent( sal_True );
+ bInit = sal_True;
+ }
+ return aDefBulletFont;
+}
+
+static void lcl_PaintLevel(OutputDevice* pVDev, sal_Int16 nNumberingType,
+ const OUString& rBulletChar, const OUString& rText, const OUString& rFontName,
+ Point& rLeft, Font& rRuleFont, const Font& rTextFont)
+{
+
+ if(NumberingType::CHAR_SPECIAL == nNumberingType )
+ {
+ rRuleFont.SetStyleName(rFontName);
+ pVDev->SetFont(rRuleFont);
+ pVDev->DrawText(rLeft, rBulletChar);
+ rLeft.X() += pVDev->GetTextWidth(rBulletChar);
+ }
+ else
+ {
+ pVDev->SetFont(rTextFont);
+ pVDev->DrawText(rLeft, rText);
+ rLeft.X() += pVDev->GetTextWidth(rText);
+ }
+}
+void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
+{
+ static sal_uInt16 __READONLY_DATA aLinesArr[] =
+ {
+ 15, 10,
+ 20, 30,
+ 25, 50,
+ 30, 70,
+ 35, 90, // up to here line positions
+ 05, 10, // character positions
+ 10, 30,
+ 15, 50,
+ 20, 70,
+ 25, 90,
+ };
+
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ const Color aBackColor = rStyleSettings.GetFieldColor();
+ const Color aTextColor = rStyleSettings.GetFieldTextColor();
+
+ OutputDevice* pDev = rUDEvt.GetDevice();
+ Rectangle aRect = rUDEvt.GetRect();
+ sal_uInt16 nItemId = rUDEvt.GetItemId();
+ long nRectWidth = aRect.GetWidth();
+ long nRectHeight = aRect.GetHeight();
+ Size aRectSize(nRectWidth, aRect.GetHeight());
+ Point aBLPos = aRect.TopLeft();
+ Font aOldFont = pDev->GetFont();
+ Color aOldColor = pDev->GetLineColor();
+ pDev->SetLineColor(aTextColor);
+ Font aFont(OutputDevice::GetDefaultFont(
+ DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE));
+
+ Size aSize = aFont.GetSize();
+
+ Font aRuleFont( lcl_GetDefaultBulletFont() );
+ aSize.Height() = nRectHeight/6;
+ aRuleFont.SetSize(aSize);
+ aRuleFont.SetColor(aTextColor);
+ aRuleFont.SetFillColor(aBackColor);
+ if(nPageType == NUM_PAGETYPE_BULLET)
+ aFont = aRuleFont;
+ else if(nPageType == NUM_PAGETYPE_NUM)
+ {
+ aSize.Height() = nRectHeight/8;
+ }
+ aFont.SetColor(aTextColor);
+ aFont.SetFillColor(aBackColor);
+ aFont.SetSize( aSize );
+ pDev->SetFont(aFont);
+
+ if(!pVDev)
+ {
+ // Die Linien werden nur einmalig in das VirtualDevice gepainted
+ // nur die Gliederungspage bekommt es aktuell
+ pVDev = new VirtualDevice(*pDev);
+ pVDev->SetMapMode(pDev->GetMapMode());
+ pVDev->EnableRTL( IsRTLEnabled() );
+ pVDev->SetOutputSize( aRectSize );
+ aOrgRect = aRect;
+ pVDev->SetFillColor( aBackColor );
+ pVDev->DrawRect(aOrgRect);
+
+ if(aBackColor == aLineColor)
+ aLineColor.Invert();
+ pVDev->SetLineColor(aLineColor);
+ // Linien nur einmalig Zeichnen
+ if(nPageType != NUM_PAGETYPE_NUM)
+ {
+ Point aStart(aBLPos.X() + nRectWidth *25 / 100,0);
+ Point aEnd(aBLPos.X() + nRectWidth * 9 / 10,0);
+ for( sal_uInt16 i = 11; i < 100; i += 33)
+ {
+ aStart.Y() = aEnd.Y() = aBLPos.Y() + nRectHeight * i / 100;
+ pVDev->DrawLine(aStart, aEnd);
+ aStart.Y() = aEnd.Y() = aBLPos.Y() + nRectHeight * (i + 11) / 100;
+ pVDev->DrawLine(aStart, aEnd);
+ }
+ }
+ }
+ pDev->DrawOutDev( aRect.TopLeft(), aRectSize,
+ aOrgRect.TopLeft(), aRectSize,
+ *pVDev );
+ // jetzt kommt der Text
+ const OUString sValue(C2U(cValue));
+ if( NUM_PAGETYPE_SINGLENUM == nPageType ||
+ NUM_PAGETYPE_BULLET == nPageType )
+ {
+ Point aStart(aBLPos.X() + nRectWidth / 9,0);
+ for( sal_uInt16 i = 0; i < 3; i++ )
+ {
+ sal_uInt16 nY = 11 + i * 33;
+ aStart.Y() = aBLPos.Y() + nRectHeight * nY / 100;
+ String sText;
+ if(nPageType == NUM_PAGETYPE_BULLET)
+ {
+ sText = aBulletTypes[nItemId - 1];
+ aStart.Y() -= pDev->GetTextHeight()/2;
+ aStart.X() = aBLPos.X() + 5;
+ }
+ else
+ {
+ if(xFormatter.is() && aNumSettings.getLength() > nItemId - 1)
+ {
+ Sequence<PropertyValue> aLevel = aNumSettings.getConstArray()[nItemId - 1];
+ try
+ {
+ aLevel.realloc(aLevel.getLength() + 1);
+ PropertyValue& rValue = aLevel.getArray()[aLevel.getLength() - 1];
+ rValue.Name = sValue;
+ rValue.Value <<= (sal_Int32)(i + 1);
+ sText = xFormatter->makeNumberingString( aLevel, aLocale );
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("Exception in DefaultNumberingProvider::makeNumberingString");
+ }
+ }
+ // knapp neben dem linken Rand beginnen
+ aStart.X() = aBLPos.X() + 2;
+ aStart.Y() -= pDev->GetTextHeight()/2;
+ }
+ pDev->DrawText(aStart, sText);
+ }
+ }
+ else if(NUM_PAGETYPE_NUM == nPageType )
+ {
+ // Outline numbering has to be painted into the virtual device
+ // to get correct lines
+ // has to be made again
+ pVDev->DrawRect(aOrgRect);
+ long nStartX = aOrgRect.TopLeft().X();
+ long nStartY = aOrgRect.TopLeft().Y();
+
+ if(xFormatter.is() && aOutlineSettings.getLength() > nItemId - 1)
+ {
+ Reference<XIndexAccess> xLevel = aOutlineSettings.getArray()[nItemId - 1];
+ try
+ {
+ OUString sLevelTexts[5];
+ OUString sFontNames[5];
+ OUString sBulletChars[5];
+ sal_Int16 aNumberingTypes[5];
+ OUString sPrefixes[5];
+ OUString sSuffixes[5];
+ sal_Int16 aParentNumberings[5];
+
+ sal_Int32 nLevelCount = xLevel->getCount();
+ if(nLevelCount > 5)
+ nLevelCount = 5;
+ for( sal_Int32 i = 0; i < nLevelCount && i < 5; i++)
+ {
+ long nTop = nStartY + nRectHeight * (aLinesArr[2 * i + 11])/100 ;
+ Point aLeft(nStartX + nRectWidth * (aLinesArr[2 * i + 10])/ 100, nTop );
+
+ Any aLevelAny = xLevel->getByIndex(i);
+ Sequence<PropertyValue> aLevel;
+ aLevelAny >>= aLevel;
+ const PropertyValue* pValues = aLevel.getConstArray();
+ aNumberingTypes[i] = 0;
+ for(sal_Int32 nProperty = 0; nProperty < aLevel.getLength() - 1; nProperty++)
+ {
+ if(pValues[nProperty].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cNumberingType)))
+ pValues[nProperty].Value >>= aNumberingTypes[i];
+ else if(pValues[nProperty].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cBulletFontName)))
+ pValues[nProperty].Value >>= sFontNames[i];
+ else if(pValues[nProperty].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cBulletChar)))
+ pValues[nProperty].Value >>= sBulletChars[i];
+ else if(pValues[nProperty].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cPrefix)))
+ pValues[nProperty].Value >>= sPrefixes[i];
+ else if(pValues[nProperty].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cSuffix)))
+ pValues[nProperty].Value >>= sSuffixes[i];
+ else if(pValues[nProperty].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cParentNumbering)))
+ pValues[nProperty].Value >>= aParentNumberings[i];
+ }
+ Sequence< PropertyValue > aProperties(2);
+ PropertyValue* pProperties = aProperties.getArray();
+ pProperties[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NumberingType"));
+ pProperties[0].Value <<= aNumberingTypes[i];
+ pProperties[1].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value"));
+ pProperties[1].Value <<= (sal_Int32)1;
+ try
+ {
+ sLevelTexts[i] = xFormatter->makeNumberingString( aProperties, aLocale );
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("Exception in DefaultNumberingProvider::makeNumberingString");
+ }
+
+ aLeft.Y() -= (pDev->GetTextHeight()/2);
+ if(sPrefixes[i].getLength() &&
+ !sPrefixes[i].equalsAsciiL(" ", 1) &&
+ sPrefixes[i].getStr()[0] != 0)
+ {
+ pVDev->SetFont(aFont);
+ pVDev->DrawText(aLeft, sPrefixes[i]);
+ aLeft.X() += pDev->GetTextWidth(sPrefixes[i]);
+ }
+ if(aParentNumberings[i])
+ {
+ //insert old numberings here
+ sal_Int32 nStartLevel = std::min((sal_Int32)aParentNumberings[i], i);
+ for(sal_Int32 nParentLevel = i - nStartLevel; nParentLevel < i; nParentLevel++)
+ {
+ OUString sTmp(sLevelTexts[nParentLevel]);
+ sTmp += C2U(".");
+ lcl_PaintLevel(pVDev,
+ aNumberingTypes[nParentLevel],
+ sBulletChars[nParentLevel],
+ sTmp,
+ sFontNames[nParentLevel],
+ aLeft,
+ aRuleFont,
+ aFont);
+ }
+ }
+ lcl_PaintLevel(pVDev,
+ aNumberingTypes[i],
+ sBulletChars[i],
+ sLevelTexts[i],
+ sFontNames[i],
+ aLeft,
+ aRuleFont,
+ aFont);
+ if(sSuffixes[i].getLength()&&
+ !sSuffixes[i].equalsAsciiL(" ", 1) &&
+ sSuffixes[i].getStr()[0] != 0)
+ {
+ pVDev->SetFont(aFont);
+ pVDev->DrawText(aLeft, sSuffixes[i]);
+ aLeft.X() += pDev->GetTextWidth(sSuffixes[i]);
+ }
+
+ long nLineTop = nStartY + nRectHeight * aLinesArr[2 * i + 1]/100 ;
+ Point aLineLeft(aLeft.X() /*+ nStartX + nRectWidth * aLinesArr[2 * i]/ 100*/, nLineTop );
+ Point aLineRight(nStartX + nRectWidth * 90 /100, nLineTop );
+ pVDev->DrawLine(aLineLeft, aLineRight);
+ }
+
+ }
+#ifdef DBG_UTIL
+ catch(Exception&)
+ {
+ static sal_Bool bAssert = sal_False;
+ if(!bAssert)
+ {
+ DBG_ERROR("exception in ::UserDraw");
+ bAssert = sal_True;
+ }
+ }
+#else
+ catch(Exception&)
+ {
+ }
+#endif
+ }
+ pDev->DrawOutDev( aRect.TopLeft(), aRectSize,
+ aOrgRect.TopLeft(), aRectSize,
+ *pVDev );
+ }
+
+ pDev->SetFont(aOldFont);
+ pDev->SetLineColor(aOldColor);
+}
+
+/**************************************************************************/
+/* */
+/* */
+/**************************************************************************/
+
+SvxNumValueSet::SvxNumValueSet( Window* pParent, const ResId& rResId, sal_uInt16 nType ) :
+
+ ValueSet( pParent, rResId ),
+
+ aLineColor ( COL_LIGHTGRAY ),
+ nPageType ( nType ),
+ bHTMLMode ( sal_False ),
+ pVDev ( NULL )
+{
+ SetColCount( 4 );
+ SetLineCount( 2 );
+ SetStyle( GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER );
+ if(NUM_PAGETYPE_BULLET == nType)
+ {
+ for ( sal_uInt16 i = 0; i < 8; i++ )
+ {
+ InsertItem( i + 1, i );
+ SetItemText( i + 1, SVX_RESSTR( RID_SVXSTR_BULLET_DESCRIPTIONS + i ) );
+ }
+ }
+}
+
+/*-----------------08.02.97 12.38-------------------
+
+--------------------------------------------------*/
+
+ SvxNumValueSet::~SvxNumValueSet()
+{
+ delete pVDev;
+}
+/* -----------------------------30.01.01 16:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxNumValueSet::SetNumberingSettings(
+ const Sequence<Sequence<PropertyValue> >& aNum,
+ Reference<XNumberingFormatter>& xFormat,
+ const Locale& rLocale )
+{
+ aNumSettings = aNum;
+ xFormatter = xFormat;
+ aLocale = rLocale;
+ if(aNum.getLength() > 8)
+ SetStyle( GetStyle()|WB_VSCROLL);
+ for ( sal_uInt16 i = 0; i < aNum.getLength(); i++ )
+ {
+ InsertItem( i + 1, i );
+ if( i < 8 )
+ SetItemText( i + 1, SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTIONS + i ));
+ }
+}
+/* -----------------------------31.01.01 09:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxNumValueSet::SetOutlineNumberingSettings(
+ Sequence<Reference<XIndexAccess> >& rOutline,
+ Reference<XNumberingFormatter>& xFormat,
+ const Locale& rLocale)
+{
+ aOutlineSettings = rOutline;
+ xFormatter = xFormat;
+ aLocale = rLocale;
+ if(aOutlineSettings.getLength() > 8)
+ SetStyle( GetStyle() | WB_VSCROLL );
+ for ( sal_uInt16 i = 0; i < aOutlineSettings.getLength(); i++ )
+ {
+ InsertItem( i + 1, i );
+ if( i < 8 )
+ SetItemText( i + 1, SVX_RESSTR( RID_SVXSTR_OUTLINENUM_DESCRIPTIONS + i ));
+ }
+}
+
+SvxBmpNumValueSet::SvxBmpNumValueSet( Window* pParent, const ResId& rResId/*, const List& rStrNames*/ ) :
+
+ SvxNumValueSet( pParent, rResId, NUM_PAGETYPE_BMP ),
+// rStrList ( rStrNames ),
+ bGrfNotFound( sal_False )
+
+{
+ GalleryExplorer::BeginLocking(GALLERY_THEME_BULLETS);
+ SetStyle( GetStyle() | WB_VSCROLL );
+ SetLineCount( 3 );
+ aFormatTimer.SetTimeout(300);
+ aFormatTimer.SetTimeoutHdl(LINK(this, SvxBmpNumValueSet, FormatHdl_Impl));
+}
+
+/*-----------------13.02.97 09.41-------------------
+
+--------------------------------------------------*/
+
+ SvxBmpNumValueSet::~SvxBmpNumValueSet()
+{
+ GalleryExplorer::EndLocking(GALLERY_THEME_BULLETS);
+ aFormatTimer.Stop();
+}
+/*-----------------13.02.97 09.41-------------------
+
+--------------------------------------------------*/
+
+void SvxBmpNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
+{
+ SvxNumValueSet::UserDraw(rUDEvt);
+
+ Rectangle aRect = rUDEvt.GetRect();
+ OutputDevice* pDev = rUDEvt.GetDevice();
+ sal_uInt16 nItemId = rUDEvt.GetItemId();
+ Point aBLPos = aRect.TopLeft();
+
+ int nRectHeight = aRect.GetHeight();
+ Size aSize(nRectHeight/8, nRectHeight/8);
+
+ Graphic aGraphic;
+ if(!GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, nItemId - 1,
+ &aGraphic, NULL))
+ {
+ bGrfNotFound = sal_True;
+ }
+ else
+ {
+ Point aPos(aBLPos.X() + 5, 0);
+ for( sal_uInt16 i = 0; i < 3; i++ )
+ {
+ sal_uInt16 nY = 11 + i * 33;
+ aPos.Y() = aBLPos.Y() + nRectHeight * nY / 100;
+ aGraphic.Draw( pDev, aPos, aSize );
+ }
+ }
+}
+
+/*-----------------14.02.97 07.34-------------------
+
+--------------------------------------------------*/
+
+IMPL_LINK(SvxBmpNumValueSet, FormatHdl_Impl, Timer*, EMPTYARG)
+{
+ // nur, wenn eine Grafik nicht da war, muss formatiert werden
+ if(bGrfNotFound)
+ {
+ bGrfNotFound = sal_False;
+ Format();
+ }
+ Invalidate();
+ return 0;
+}
diff --git a/svx/source/dialog/svxbmpnumvalueset.src b/svx/source/dialog/svxbmpnumvalueset.src
new file mode 100644
index 000000000000..aa01932e359b
--- /dev/null
+++ b/svx/source/dialog/svxbmpnumvalueset.src
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svx/dialogs.hrc>
+
+String RID_SVXSTR_BULLET_DESCRIPTION_0
+{
+ Text [en-US] = "Solid small circular bullets";
+};
+String RID_SVXSTR_BULLET_DESCRIPTION_1
+{
+ Text [en-US] = "Solid large circular bullets";
+};
+String RID_SVXSTR_BULLET_DESCRIPTION_2
+{
+ Text [en-US] = "Solid diamond bullets";
+};
+String RID_SVXSTR_BULLET_DESCRIPTION_3
+{
+ Text [en-US] = "Solid large square bullets";
+};
+String RID_SVXSTR_BULLET_DESCRIPTION_4
+{
+ Text [en-US] = "Right pointing arrow bullets filled out";
+};
+String RID_SVXSTR_BULLET_DESCRIPTION_5
+{
+ Text [en-US] = "Right pointing arrow bullets";
+};
+String RID_SVXSTR_BULLET_DESCRIPTION_6
+{
+ Text [en-US] = "Check mark bullets";
+};
+String RID_SVXSTR_BULLET_DESCRIPTION_7
+{
+ Text [en-US] = "Tick mark bullets";
+};
+String RID_SVXSTR_SINGLENUM_DESCRIPTION_0
+{
+ Text [en-US] = "Number 1) 2) 3)";
+};
+String RID_SVXSTR_SINGLENUM_DESCRIPTION_1
+{
+ Text [en-US] = "Number 1. 2. 3.";
+};
+String RID_SVXSTR_SINGLENUM_DESCRIPTION_2
+{
+ Text [en-US] = "Number (1) (2) (3)";
+};
+String RID_SVXSTR_SINGLENUM_DESCRIPTION_3
+{
+ Text [en-US] = "Uppercase Roman number I. II. III.";
+};
+String RID_SVXSTR_SINGLENUM_DESCRIPTION_4
+{
+ Text [en-US] = "Uppercase letter A) B) C)";
+};
+String RID_SVXSTR_SINGLENUM_DESCRIPTION_5
+{
+ Text [en-US] = "Lowercase letter a) b) c)";
+};
+String RID_SVXSTR_SINGLENUM_DESCRIPTION_6
+{
+ Text [en-US] = "Lowercase letter (a) (b) (c)";
+};
+String RID_SVXSTR_SINGLENUM_DESCRIPTION_7
+{
+ Text [en-US] = "Lowercase Roman number i. ii. iii.";
+};
+
+String RID_SVXSTR_OUTLINENUM_DESCRIPTION_0
+{
+ Text [en-US] = "Numeric, numeric, lowercase letters, solid small circular bullet";
+};
+String RID_SVXSTR_OUTLINENUM_DESCRIPTION_1
+{
+ Text [en-US] = "Numeric, lowercase letters, solid small circular bullet";
+};
+String RID_SVXSTR_OUTLINENUM_DESCRIPTION_2
+{
+ Text [en-US] = "Numeric, lowercase letters, lowercase Roman, uppercase letters, solid small circular bullet";
+};
+String RID_SVXSTR_OUTLINENUM_DESCRIPTION_3
+{
+ Text [en-US] = "Numeric";
+};
+String RID_SVXSTR_OUTLINENUM_DESCRIPTION_4
+{
+ Text [en-US] = "Uppercase Roman, uppercase letters, lowercase Roman, lowercase letters, solid small circular bullet";
+};
+String RID_SVXSTR_OUTLINENUM_DESCRIPTION_5
+{
+ Text [en-US] = "Uppercase letters, uppercase Roman, lowercase letters, lowercase Roman, solid small circular bullet";
+};
+String RID_SVXSTR_OUTLINENUM_DESCRIPTION_6
+{
+ Text [en-US] = "Numeric with all sublevels";
+};
+String RID_SVXSTR_OUTLINENUM_DESCRIPTION_7
+{
+ Text [en-US] = "Right pointing bullet, right pointing arrow bullet, solid diamond bullet, solid small circular bullet";
+};
+
diff --git a/svx/source/dialog/svxdlg.cxx b/svx/source/dialog/svxdlg.cxx
new file mode 100644
index 000000000000..4ee81686e9c0
--- /dev/null
+++ b/svx/source/dialog/svxdlg.cxx
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svxdlg.hxx>
+
+SvxAbstractDialogFactory* SvxAbstractDialogFactory::Create()
+{
+ return dynamic_cast< SvxAbstractDialogFactory* >( VclAbstractDialogFactory::Create() );
+}
+
+SvxAbstractDialogFactory::~SvxAbstractDialogFactory()
+{
+}
+
diff --git a/svx/source/dialog/svxgrahicitem.cxx b/svx/source/dialog/svxgrahicitem.cxx
new file mode 100644
index 000000000000..8a77fcfc6ef3
--- /dev/null
+++ b/svx/source/dialog/svxgrahicitem.cxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "svx/svxgrahicitem.hxx"
+TYPEINIT1(SvxGraphicItem,SfxPoolItem);
+SvxGraphicItem::SvxGraphicItem( sal_uInt16 _nWhich, const Graphic& rGraphic )
+ : SfxPoolItem( _nWhich ), aGraphic( rGraphic )
+{
+
+}
+SvxGraphicItem::SvxGraphicItem( const SvxGraphicItem& rItem)
+ : SfxPoolItem( rItem.Which() ), aGraphic( rItem.aGraphic )
+{
+}
+
+int SvxGraphicItem::operator==( const SfxPoolItem& rItem) const
+{
+ return ((SvxGraphicItem&)rItem).aGraphic == aGraphic;
+}
+
+SfxPoolItem* SvxGraphicItem::Clone( SfxItemPool * ) const
+{
+ return new SvxGraphicItem( *this );
+}
diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx
new file mode 100644
index 000000000000..4fbd1f3c288e
--- /dev/null
+++ b/svx/source/dialog/svxruler.cxx
@@ -0,0 +1,3976 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// INCLUDE ---------------------------------------------------------------
+
+#include <string.h>
+#include <limits.h>
+#include <tools/shl.hxx>
+#include <vcl/image.hxx>
+#include <svl/eitem.hxx>
+#include <svl/rectitem.hxx>
+#include <sfx2/dispatch.hxx>
+
+#include <svl/smplhint.hxx>
+
+
+
+
+
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <svx/ruler.hxx>
+#include "rlrcitem.hxx"
+#include "svx/rulritem.hxx"
+#include <editeng/tstpitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include "editeng/protitem.hxx"
+#ifndef _APP_HXX
+#include <vcl/svapp.hxx>
+#endif
+#ifndef RULER_TAB_RTL
+#define RULER_TAB_RTL ((sal_uInt16)0x0010)
+#endif
+
+#include <comphelper/uieventslogger.hxx>
+
+namespace
+{
+ void lcl_logRulerUse(const ::rtl::OUString& sURL) //#i99729#
+ {
+ using namespace ::com::sun::star;
+ util::URL aTargetURL;
+ aTargetURL.Complete = sURL;
+ aTargetURL.Main = sURL;
+ if(::comphelper::UiEventsLogger::isEnabled()) //#i88653#
+ {
+ ::rtl::OUString sAppName;
+ uno::Sequence<beans::PropertyValue> source;
+ ::comphelper::UiEventsLogger::appendDispatchOrigin(source, sAppName, ::rtl::OUString::createFromAscii("SfxRuler"));
+ ::comphelper::UiEventsLogger::logDispatch(aTargetURL, source);
+ }
+ }
+}
+
+
+
+// STATIC DATA -----------------------------------------------------------
+
+#define CTRL_ITEM_COUNT 14
+#define GAP 10
+#define OBJECT_BORDER_COUNT 4
+#define TAB_GAP 1
+#define INDENT_GAP 2
+#define INDENT_FIRST_LINE 4
+#define INDENT_LEFT_MARGIN 5
+#define INDENT_RIGHT_MARGIN 6
+#define INDENT_LEFT_BORDER 2
+#define INDENT_RIGHT_BORDER 3
+#define INDENT_COUNT 5 //without the first two old values
+
+#define PIXEL_H_ADJUST( l1, l2 ) PixelHAdjust(l1,l2)
+
+#ifdef DEBUGLIN
+
+inline long ToMM(Window *pWin, long lVal)
+{
+ return pWin->PixelToLogic(Size(lVal, 0), MapMode(MAP_MM)).Width();
+}
+
+void Debug_Impl(Window *pWin, SvxColumnItem& rColItem)
+{
+ String aTmp("Aktuell: ");
+ aTmp += rColItem.GetActColumn();
+ aTmp += " ColLeft: ";
+ aTmp += String(ToMM(pWin, rColItem.GetLeft()));
+ aTmp += " ColRight: ";
+ aTmp += String(ToMM(pWin, rColItem.GetRight()));
+ for(sal_uInt16 i = 0; i < rColItem.Count(); ++i) {
+ aTmp += " Start: ";
+ aTmp += String(ToMM(pWin, rColItem[i].nStart));
+ aTmp += " End: ";
+ aTmp += String(ToMM(pWin, rColItem[i].nEnd));
+ }
+
+ InfoBox(0, aTmp).Execute();
+}
+
+void Debug_Impl(Window *pWin, const SvxLongLRSpaceItem& rLRSpace)
+{
+ String aTmp("Left: ");
+ aTmp += pWin->PixelToLogic(Size(rLRSpace.GetLeft(), 0), MapMode(MAP_MM)).Width();
+ aTmp += " Right: ";
+ aTmp +=pWin->PixelToLogic(Size(rLRSpace.GetRight(), 0), MapMode(MAP_MM)).Width();
+ InfoBox(0, aTmp).Execute();
+}
+
+void Debug_Impl(Window *pWin, const SvxLongULSpaceItem& rULSpace)
+{
+ String aTmp("Upper: ");
+ aTmp += pWin->PixelToLogic(Size(rULSpace.GetUpper(), 0), MapMode(MAP_MM)).Width();
+ aTmp += " Lower: ";
+ aTmp += pWin->PixelToLogic(Size(rULSpace.GetLower(), 0), MapMode(MAP_MM)).Width();
+
+ InfoBox(0, aTmp).Execute();
+}
+
+void DebugTabStops_Impl(const SvxTabStopItem& rTabs)
+{
+ String aTmp("Tabs: ");
+
+ // Def Tabs loeschen
+ for(sal_uInt16 i = 0; i < rTabs.Count(); ++i)
+ {
+ aTmp += String(rTabs[i].GetTabPos() / 56);
+ aTmp += " : ";
+ }
+ InfoBox(0, aTmp).Execute();
+}
+
+void DebugParaMargin_Impl(const SvxLRSpaceItem& rLRSpace)
+{
+ String aTmp("ParaLeft: ");
+ aTmp += rLRSpace.GetTxtLeft() / 56;
+ aTmp += " ParaRight: ";
+ aTmp += rLRSpace.GetRight() / 56;
+ aTmp += " FLI: ";
+ aTmp += rLRSpace.GetTxtFirstLineOfst() / 56;
+ InfoBox(0, aTmp).Execute();
+}
+
+#endif // DEBUGLIN
+#ifdef DEBUG_RULER
+#include <vcl/svapp.hxx>
+#include <vcl/lstbox.hxx>
+class RulerDebugWindow : public Window
+{
+ ListBox aBox;
+public:
+ RulerDebugWindow(Window* pParent) :
+ Window(pParent, WB_BORDER|WB_SIZEMOVE|WB_DIALOGCONTROL|WB_CLIPCHILDREN|WB_SYSTEMWINDOW),
+ aBox(this, WB_BORDER)
+ {
+ Size aOutput(200, 400);
+ SetOutputSizePixel(aOutput);
+ aBox.SetSizePixel(aOutput);
+ aBox.Show();
+ Show();
+ Size aParentSize(pParent->GetOutputSizePixel());
+ Size aOwnSize(GetSizePixel());
+ aParentSize.Width() -= aOwnSize.Width();
+ aParentSize.Height() -= aOwnSize.Height();
+ SetPosPixel(Point(aParentSize.Width(), aParentSize.Height()));
+ }
+ ~RulerDebugWindow();
+
+ ListBox& GetLBox() {return aBox;}
+ static void AddDebugText(const sal_Char* pDescription, const String& rText );
+};
+static RulerDebugWindow* pDebugWindow = 0;
+
+RulerDebugWindow::~RulerDebugWindow()
+{
+ pDebugWindow = 0;
+}
+void RulerDebugWindow::AddDebugText(const sal_Char* pDescription, const String& rText )
+{
+ if(!pDebugWindow)
+ {
+ Window* pParent = Application::GetFocusWindow();
+ while(pParent->GetParent())
+ pParent = pParent->GetParent();
+ pDebugWindow = new RulerDebugWindow(pParent);
+ }
+ String sContent(String::CreateFromAscii(pDescription));
+ sContent += rText;
+ sal_uInt16 nPos = pDebugWindow->GetLBox().InsertEntry(sContent);
+ pDebugWindow->GetLBox().SelectEntryPos(nPos);
+ pDebugWindow->GrabFocus();
+}
+
+#define ADD_DEBUG_TEXT(cDescription, sValue) \
+ RulerDebugWindow::AddDebugText(cDescription, sValue);
+
+#define REMOVE_DEBUG_WINDOW \
+ delete pDebugWindow; \
+ pDebugWindow = 0;
+
+#else
+#define ADD_DEBUG_TEXT(cDescription, sValue)
+#define REMOVE_DEBUG_WINDOW
+#endif
+
+struct SvxRuler_Impl {
+ sal_uInt16 *pPercBuf;
+ sal_uInt16 *pBlockBuf;
+ sal_uInt16 nPercSize;
+ long nTotalDist;
+ long lOldWinPos;
+ long lMaxLeftLogic;
+ long lMaxRightLogic;
+ long lLastLMargin;
+ long lLastRMargin;
+ SvxProtectItem aProtectItem;
+ SfxBoolItem* pTextRTLItem;
+ sal_uInt16 nControlerItems;
+ sal_uInt16 nIdx;
+ sal_uInt16 nColLeftPix, nColRightPix; // Pixelwerte fuer linken / rechten Rand
+ // bei Spalten; gepuffert, um Umrechenfehler
+ // zu vermeiden.
+ // Muesste vielleicht fuer weitere Werte
+ // aufgebohrt werden
+ sal_Bool bIsTableRows : 1; // pColumnItem contains table rows instead of columns
+ //#i24363# tab stops relative to indent
+ sal_Bool bIsTabsRelativeToIndent : 1; // Tab stops relative to paragraph indent?
+ SvxRuler_Impl() :
+ pPercBuf(0), pBlockBuf(0),
+ nPercSize(0), nTotalDist(0),
+ lOldWinPos(0),
+ lMaxLeftLogic(0), lMaxRightLogic(0),
+ lLastLMargin(0), lLastRMargin(0),
+ aProtectItem(SID_RULER_PROTECT),
+ pTextRTLItem(0), nControlerItems(0),
+ nIdx(0),
+ nColLeftPix(0), nColRightPix(0),
+
+ bIsTableRows(sal_False),
+ bIsTabsRelativeToIndent(sal_True)
+ {
+ }
+ ~SvxRuler_Impl()
+ {
+ nPercSize = 0; nTotalDist = 0;
+ delete[] pPercBuf; delete[] pBlockBuf; pPercBuf = 0;
+ delete pTextRTLItem;
+ }
+ void SetPercSize(sal_uInt16 nSize);
+
+};
+
+
+
+void SvxRuler_Impl::SetPercSize(sal_uInt16 nSize)
+{
+ if(nSize > nPercSize)
+ {
+ delete[] pPercBuf;
+ delete[] pBlockBuf;
+ pPercBuf = new sal_uInt16[nPercSize = nSize];
+ pBlockBuf = new sal_uInt16[nPercSize = nSize];
+ }
+ size_t nSize2 = sizeof(sal_uInt16) * nPercSize;
+ memset(pPercBuf, 0, nSize2);
+ memset(pBlockBuf, 0, nSize2);
+}
+
+
+// Konstruktor des Lineals
+
+// SID_ATTR_ULSPACE, SID_ATTR_LRSPACE
+// erwartet als Parameter SvxULSpaceItem f"ur Seitenr"ander
+// (entweder links/rechts oder oben/unten)
+// Lineal: SetMargin1, SetMargin2
+
+// SID_RULER_PAGE_POS
+// erwartet als Parameter Anfangswert der Seite sowie Seitenbreite
+// Lineal: SetPagePos
+
+// SID_ATTR_TABSTOP
+// erwartet: SvxTabStopItem
+// Lineal: SetTabs
+
+// SID_ATTR_PARA_LRSPACE
+// linker, rechter Absatzrand bei H-Lineal
+// Lineal: SetIndents
+
+// SID_RULER_BORDERS
+// Tabellenraender, Spalten
+// erwartet: so etwas wie SwTabCols
+// Lineal: SetBorders
+
+
+SvxRuler::SvxRuler
+(
+ Window* pParent, // StarView Parent
+ Window* pWin, // Ausgabefenster; wird fuer Umrechnung logische
+ // Einheiten <-> Pixel verwendet
+ sal_uInt16 flags, // Anzeige Flags, siehe ruler.hxx
+ SfxBindings &rBindings, // zugeordnete Bindings
+ WinBits nWinStyle // StarView WinBits
+)
+: Ruler(pParent, nWinStyle),
+ pCtrlItem(new SvxRulerItem *[CTRL_ITEM_COUNT]),
+ pLRSpaceItem(0),
+ pMinMaxItem(0),
+ pULSpaceItem(0),
+ pTabStopItem(0),
+ pParaItem(0),
+ pParaBorderItem(0),
+ pPagePosItem(0),
+ pColumnItem(0),
+ pObjectItem(0),
+ pEditWin(pWin),
+ pRuler_Imp(new SvxRuler_Impl),
+ bAppSetNullOffset(sal_False), //Wird der 0-Offset des Lineals
+ //durch die appl. gesetzt?
+ lLogicNullOffset(0),
+ lAppNullOffset(LONG_MAX),
+ lMinFrame(5),
+ lInitialDragPos(0),
+ nFlags(flags),
+ nDragType(NONE),
+ nDefTabType(RULER_TAB_LEFT),
+ nTabCount(0),
+ nTabBufSize(0),
+ lDefTabDist(50),
+ lTabPos(-1),
+ pTabs(0),
+ pIndents(0),
+ pBorders(new RulerBorder[1]), //wg 1 Spaltiger Tabellen
+ nBorderCount(0),
+ pObjectBorders(0),
+ pBindings(&rBindings),
+ nDragOffset(0),
+ nMaxLeft(0),
+ nMaxRight(0),
+ bValid(sal_False),
+ bListening(sal_False),
+ bActive(sal_True)
+
+/*
+ [Beschreibung]
+
+ ctor;
+ Datenpuffer initialisieren; ControllerItems werden erzeugt
+
+*/
+{
+ memset(pCtrlItem, 0, sizeof(SvxRulerItem *) * CTRL_ITEM_COUNT);
+
+ rBindings.EnterRegistrations();
+
+ // Unterstuetzte Items anlegen
+ sal_uInt16 i = 0;
+ // Seitenraender
+
+ pCtrlItem[i++] = new SvxRulerItem(SID_RULER_LR_MIN_MAX, *this, rBindings);
+ if((nWinStyle & WB_VSCROLL) == WB_VSCROLL)
+ {
+ bHorz = sal_False;
+ pCtrlItem[i++] = new SvxRulerItem(SID_ATTR_LONG_ULSPACE, *this, rBindings);
+ }
+ else
+ {
+ bHorz = sal_True;
+ pCtrlItem[i++] = new SvxRulerItem(SID_ATTR_LONG_LRSPACE, *this, rBindings);
+ }
+
+ // Seitenposition
+ pCtrlItem[i++] = new SvxRulerItem(SID_RULER_PAGE_POS, *this, rBindings);
+
+ if((nFlags & SVXRULER_SUPPORT_TABS) == SVXRULER_SUPPORT_TABS)
+ {
+ sal_uInt16 nTabStopId = bHorz ? SID_ATTR_TABSTOP : SID_ATTR_TABSTOP_VERTICAL;
+ pCtrlItem[i++] = new SvxRulerItem(nTabStopId, *this, rBindings);
+ SetExtraType(RULER_EXTRA_TAB, nDefTabType);
+ }
+
+
+ if(0 != (nFlags & (SVXRULER_SUPPORT_PARAGRAPH_MARGINS |SVXRULER_SUPPORT_PARAGRAPH_MARGINS_VERTICAL)))
+ {
+ if(bHorz)
+ pCtrlItem[i++] = new SvxRulerItem(SID_ATTR_PARA_LRSPACE, *this, rBindings);
+ else
+ pCtrlItem[i++] = new SvxRulerItem(SID_ATTR_PARA_LRSPACE_VERTICAL, *this, rBindings);
+ pIndents = new RulerIndent[5+INDENT_GAP];
+ memset(pIndents, 0, sizeof(RulerIndent)*(3+INDENT_GAP));
+ pIndents[0].nStyle = RULER_STYLE_DONTKNOW;
+ pIndents[1].nStyle = RULER_STYLE_DONTKNOW;
+ pIndents[INDENT_FIRST_LINE].nStyle = RULER_INDENT_TOP;
+ pIndents[INDENT_LEFT_MARGIN].nStyle = RULER_INDENT_BOTTOM;
+ pIndents[INDENT_RIGHT_MARGIN].nStyle = RULER_INDENT_BOTTOM;
+ pIndents[INDENT_LEFT_BORDER].nStyle = RULER_INDENT_BORDER;
+ pIndents[INDENT_RIGHT_BORDER].nStyle = RULER_INDENT_BORDER;
+ for(sal_uInt16 nIn = 0; nIn < 7; nIn++)
+ pIndents[nIn].nPos = 0;
+ }
+
+ if((nFlags & SVXRULER_SUPPORT_BORDERS) == SVXRULER_SUPPORT_BORDERS)
+ {
+ pCtrlItem[i++] = new SvxRulerItem(bHorz ? SID_RULER_BORDERS : SID_RULER_BORDERS_VERTICAL, *this, rBindings);
+ pCtrlItem[i++] = new SvxRulerItem(bHorz ? SID_RULER_ROWS : SID_RULER_ROWS_VERTICAL, *this, rBindings);
+ }
+
+ pCtrlItem[i++] = new SvxRulerItem(SID_RULER_TEXT_RIGHT_TO_LEFT, *this, rBindings);
+
+ if((nFlags & SVXRULER_SUPPORT_OBJECT) == SVXRULER_SUPPORT_OBJECT)
+ {
+ pCtrlItem[i++] = new SvxRulerItem(SID_RULER_OBJECT, *this, rBindings );
+ pObjectBorders = new RulerBorder[OBJECT_BORDER_COUNT];
+ size_t nSize = sizeof( RulerBorder ) * OBJECT_BORDER_COUNT;
+ memset(pObjectBorders, 0, nSize);
+ for(sal_uInt16 nBorder = 0; nBorder < OBJECT_BORDER_COUNT; ++nBorder)
+ {
+ pObjectBorders[nBorder].nPos = 0;
+ pObjectBorders[nBorder].nWidth = 0;
+ pObjectBorders[nBorder].nStyle = RULER_BORDER_MOVEABLE;
+ }
+ }
+
+ pCtrlItem[i++] = new SvxRulerItem( SID_RULER_PROTECT, *this, rBindings );
+ pCtrlItem[i++] = new SvxRulerItem(SID_RULER_BORDER_DISTANCE, *this, rBindings);
+ pRuler_Imp->nControlerItems=i;
+
+ if((nFlags & SVXRULER_SUPPORT_SET_NULLOFFSET) ==
+ SVXRULER_SUPPORT_SET_NULLOFFSET)
+ SetExtraType(RULER_EXTRA_NULLOFFSET, 0);
+
+ rBindings.LeaveRegistrations();
+}
+
+
+__EXPORT SvxRuler::~SvxRuler()
+/*
+ [Beschreibung]
+
+ Destruktor Lineal
+ Freigabe interner Puffer
+
+
+*/
+{
+ REMOVE_DEBUG_WINDOW
+ if(bListening)
+ EndListening(*pBindings);
+
+ pBindings->EnterRegistrations();
+
+ for(sal_uInt16 i = 0; i < CTRL_ITEM_COUNT && pCtrlItem[i]; ++i)
+ delete pCtrlItem[i];
+ delete[] pCtrlItem;
+
+ delete pLRSpaceItem;
+ delete pMinMaxItem;
+ delete pULSpaceItem;
+ delete pTabStopItem;
+ delete pParaItem;
+ delete pParaBorderItem;
+ delete pPagePosItem;
+ delete pColumnItem;
+ delete pObjectItem;
+ delete[] pIndents;
+ delete[] pBorders;
+ delete[] pObjectBorders;
+ delete[] pTabs;
+ delete pRuler_Imp;
+
+ pBindings->LeaveRegistrations();
+}
+
+/*
+
+ [Beschreibung]
+
+ Interne Umrechenroutinen
+
+*/
+
+long SvxRuler::ConvertHPosPixel(long nVal) const
+{
+ return pEditWin->LogicToPixel(Size(nVal, 0)).Width();
+}
+
+long SvxRuler::ConvertVPosPixel(long nVal) const
+{
+ return pEditWin->LogicToPixel(Size(0, nVal)).Height();
+}
+
+long SvxRuler::ConvertHSizePixel(long nVal) const
+{
+ return pEditWin->LogicToPixel(Size(nVal, 0)).Width();
+}
+
+long SvxRuler::ConvertVSizePixel(long nVal) const
+{
+ return pEditWin->LogicToPixel(Size(0, nVal)).Height();
+}
+
+long SvxRuler::ConvertPosPixel(long nVal) const
+{
+ return bHorz ? ConvertHPosPixel(nVal): ConvertVPosPixel(nVal);
+}
+
+long SvxRuler::ConvertSizePixel(long nVal) const
+{
+ return bHorz? ConvertHSizePixel(nVal): ConvertVSizePixel(nVal);
+}
+
+
+inline long SvxRuler::ConvertHPosLogic(long nVal) const
+{
+ return pEditWin->PixelToLogic(Size(nVal, 0)).Width();
+}
+
+inline long SvxRuler::ConvertVPosLogic(long nVal) const
+{
+ return pEditWin->PixelToLogic(Size(0, nVal)).Height();
+}
+
+inline long SvxRuler::ConvertHSizeLogic(long nVal) const
+{
+ return pEditWin->PixelToLogic(Size(nVal, 0)).Width();
+}
+
+inline long SvxRuler::ConvertVSizeLogic(long nVal) const
+{
+ return pEditWin->PixelToLogic(Size(0, nVal)).Height();
+}
+
+inline long SvxRuler::ConvertPosLogic(long nVal) const
+{
+ return bHorz? ConvertHPosLogic(nVal): ConvertVPosLogic(nVal);
+}
+
+inline long SvxRuler::ConvertSizeLogic(long nVal) const
+{
+ return bHorz? ConvertHSizeLogic(nVal): ConvertVSizeLogic(nVal);
+}
+
+long SvxRuler::PixelHAdjust(long nVal, long nValOld) const
+{
+ if(ConvertHSizePixel(nVal)!=ConvertHSizePixel(nValOld))
+ return nVal;
+ else
+ return nValOld;
+}
+
+long SvxRuler::PixelVAdjust(long nVal, long nValOld) const
+{
+ if(ConvertVSizePixel(nVal)!=ConvertVSizePixel(nValOld))
+ return nVal;
+ else
+ return nValOld;
+}
+
+long SvxRuler::PixelAdjust(long nVal, long nValOld) const
+{
+ if(ConvertSizePixel(nVal)!=ConvertSizePixel(nValOld))
+ return nVal;
+ else
+ return nValOld;
+}
+
+
+inline sal_uInt16 SvxRuler::GetObjectBordersOff(sal_uInt16 nIdx) const
+{
+ return bHorz? nIdx: nIdx + 2;
+}
+
+
+
+void SvxRuler::UpdateFrame()
+
+/*
+ [Beschreibung]
+
+ Linken, oberen Rand aktualisieren
+ Items werden in die Darstellung des Lineals uebersetzt.
+
+*/
+
+{
+ const sal_uInt16 nMarginStyle =
+ ( pRuler_Imp->aProtectItem.IsSizeProtected() ||
+ pRuler_Imp->aProtectItem.IsPosProtected() ) ?
+ 0 : RULER_MARGIN_SIZEABLE;
+
+ if(pLRSpaceItem && pPagePosItem)
+ {
+ // wenn keine Initialisierung durch App Defaultverhalten
+ const long nOld = lLogicNullOffset;
+ lLogicNullOffset = pColumnItem?
+ pColumnItem->GetLeft(): pLRSpaceItem->GetLeft();
+ if(bAppSetNullOffset)
+ lAppNullOffset += lLogicNullOffset - nOld;
+ if(!bAppSetNullOffset || lAppNullOffset == LONG_MAX)
+ {
+ Ruler::SetNullOffset(ConvertHPosPixel(lLogicNullOffset));
+ SetMargin1( 0, nMarginStyle );
+ lAppNullOffset = 0;
+ }
+ else
+ SetMargin1( ConvertHPosPixel( lAppNullOffset ), nMarginStyle );
+ long lRight = 0;
+ // bei Tabelle rechten Rand der Tabelle auswerten
+ if(pColumnItem && pColumnItem->IsTable())
+ lRight = pColumnItem->GetRight();
+ else
+ lRight = pLRSpaceItem->GetRight();
+
+ sal_uIntPtr aWidth=
+ ConvertHPosPixel(pPagePosItem->GetWidth() - lRight -
+ lLogicNullOffset + lAppNullOffset);
+ SetMargin2( aWidth, nMarginStyle );
+ }
+ else
+ if(pULSpaceItem && pPagePosItem)
+ {
+ // Nullpunkt aus oberem Rand des umgebenden Rahmens
+ const long nOld = lLogicNullOffset;
+ lLogicNullOffset = pColumnItem?
+ pColumnItem->GetLeft(): pULSpaceItem->GetUpper();
+ if(bAppSetNullOffset)
+ lAppNullOffset += lLogicNullOffset - nOld;
+ if(!bAppSetNullOffset || lAppNullOffset == LONG_MAX) {
+ Ruler::SetNullOffset(ConvertVPosPixel(lLogicNullOffset));
+ lAppNullOffset = 0;
+ SetMargin1( 0, nMarginStyle );
+ }
+ else
+ SetMargin1( ConvertVPosPixel( lAppNullOffset ),nMarginStyle );
+
+ long lLower = pColumnItem ?
+ pColumnItem->GetRight() : pULSpaceItem->GetLower();
+
+ SetMargin2(ConvertVPosPixel(pPagePosItem->GetHeight() - lLower -
+ lLogicNullOffset + lAppNullOffset),
+ nMarginStyle );
+ }
+ else
+ {
+ // schaltet die Anzeige aus
+ SetMargin1();
+ SetMargin2();
+ }
+ if(pColumnItem)
+ {
+ pRuler_Imp->nColLeftPix = (sal_uInt16) ConvertSizePixel(pColumnItem->GetLeft());
+ pRuler_Imp->nColRightPix = (sal_uInt16) ConvertSizePixel(pColumnItem->GetRight());
+ }
+
+}
+
+void SvxRuler::MouseMove( const MouseEvent& rMEvt )
+{
+ if( bActive )
+ {
+ pBindings->Update( SID_RULER_LR_MIN_MAX );
+ pBindings->Update( SID_ATTR_LONG_ULSPACE );
+ pBindings->Update( SID_ATTR_LONG_LRSPACE );
+ pBindings->Update( SID_RULER_PAGE_POS );
+ pBindings->Update( bHorz ? SID_ATTR_TABSTOP : SID_ATTR_TABSTOP_VERTICAL);
+ pBindings->Update( bHorz ? SID_ATTR_PARA_LRSPACE : SID_ATTR_PARA_LRSPACE_VERTICAL);
+ pBindings->Update( bHorz ? SID_RULER_BORDERS : SID_RULER_BORDERS_VERTICAL);
+ pBindings->Update( bHorz ? SID_RULER_ROWS : SID_RULER_ROWS_VERTICAL);
+ pBindings->Update( SID_RULER_OBJECT );
+ pBindings->Update( SID_RULER_PROTECT );
+ }
+ Ruler::MouseMove( rMEvt );
+}
+void SvxRuler::StartListening_Impl()
+{
+ if(!bListening)
+ {
+ bValid = sal_False;
+ StartListening(*pBindings);
+ bListening = sal_True;
+ }
+}
+
+void SvxRuler::UpdateFrame
+(
+ const SvxLongLRSpaceItem *pItem // neuer Wert LRSpace
+)
+
+/*
+ [Beschreibung]
+
+ Neuen Wert fuer LRSpace merken; alten gfs. loeschen
+
+*/
+
+{
+ if(bActive)
+ {
+ delete pLRSpaceItem; pLRSpaceItem = 0;
+ if(pItem)
+ pLRSpaceItem = new SvxLongLRSpaceItem(*pItem);
+ StartListening_Impl();
+ }
+}
+
+
+void SvxRuler::UpdateFrameMinMax
+(
+ const SfxRectangleItem *pItem // Werte fuer MinMax
+)
+
+/*
+ [Beschreibung]
+
+ Neuen Wert fuer MinMax setzen; alten gfs. loeschen
+
+*/
+
+{
+ if(bActive)
+ {
+ delete pMinMaxItem; pMinMaxItem = 0;
+ if(pItem)
+ pMinMaxItem = new SfxRectangleItem(*pItem);
+ }
+}
+
+
+void SvxRuler::UpdateFrame
+(
+ const SvxLongULSpaceItem *pItem // neuer Wert
+)
+
+/*
+ [Beschreibung]
+
+ Rechten / unteren Rand aktualisieren
+
+*/
+
+
+{
+ if(bActive && !bHorz)
+ {
+ delete pULSpaceItem; pULSpaceItem = 0;
+ if(pItem)
+ pULSpaceItem = new SvxLongULSpaceItem(*pItem);
+ StartListening_Impl();
+ }
+}
+
+void SvxRuler::Update( const SvxProtectItem* pItem )
+{
+ if( pItem ) pRuler_Imp->aProtectItem = *pItem;
+}
+/* -----------------------------22.08.2002 13:10------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxRuler::UpdateTextRTL(const SfxBoolItem* pItem)
+{
+ if(bActive && bHorz)
+ {
+ delete pRuler_Imp->pTextRTLItem; pRuler_Imp->pTextRTLItem = 0;
+ if(pItem)
+ pRuler_Imp->pTextRTLItem = new SfxBoolItem(*pItem);
+ SetTextRTL(pRuler_Imp->pTextRTLItem && pRuler_Imp->pTextRTLItem->GetValue());
+ StartListening_Impl();
+ }
+}
+
+void SvxRuler::Update
+(
+ const SvxColumnItem *pItem, // neuer Wert
+ sal_uInt16 nSID //Slot Id to identify NULL items
+)
+
+/*
+ [Beschreibung]
+
+ Neuen Wert fuer Spaltendarstellung setzen
+
+*/
+
+{
+ if(bActive)
+ {
+ if(pItem)
+ {
+ delete pColumnItem; pColumnItem = 0;
+ pRuler_Imp->bIsTableRows = (pItem->Which() == SID_RULER_ROWS || pItem->Which() == SID_RULER_ROWS_VERTICAL);
+ pColumnItem = new SvxColumnItem(*pItem);
+ if(!bHorz && !pRuler_Imp->bIsTableRows)
+ pColumnItem->SetWhich(SID_RULER_BORDERS_VERTICAL);
+ }
+ else if(pColumnItem && pColumnItem->Which() == nSID)
+ //there are two groups of column items table/frame columns and table rows
+ //both can occur in vertical or horizontal mode
+ //the horizontal ruler handles the SID_RULER_BORDERS and SID_RULER_ROWS_VERTICAL
+ //and the vertical handles SID_RULER_BORDERS_VERTICAL and SID_RULER_ROWS
+ //if pColumnItem is already set with one of the ids then a NULL pItem argument
+ //must not delete it
+ {
+ delete pColumnItem; pColumnItem = 0;
+ pRuler_Imp->bIsTableRows = sal_False;
+ }
+ StartListening_Impl();
+ }
+}
+
+
+void SvxRuler::UpdateColumns()
+/*
+ [Beschreibung]
+
+ Anzeige der Spaltendarstellung aktualisieren
+
+*/
+{
+ if(pColumnItem && pColumnItem->Count() > 1)
+ {
+ if( nBorderCount < pColumnItem->Count())
+ {
+ delete[] pBorders;
+ nBorderCount = pColumnItem->Count();
+ pBorders = new RulerBorder[nBorderCount];
+ }
+ sal_uInt16 _nFlags = RULER_BORDER_VARIABLE;
+ sal_Bool bProtectColumns =
+ pRuler_Imp->aProtectItem.IsSizeProtected() ||
+ pRuler_Imp->aProtectItem.IsPosProtected();
+ if( !bProtectColumns )
+ _nFlags |= RULER_BORDER_MOVEABLE;
+ if( pColumnItem->IsTable() )
+ _nFlags |= RULER_BORDER_TABLE;
+ else
+ if ( !bProtectColumns )
+ _nFlags |= RULER_BORDER_SIZEABLE;
+
+ sal_uInt16 nBorders = pColumnItem->Count();
+ if(!pRuler_Imp->bIsTableRows)
+ --nBorders;
+ for(sal_uInt16 i = 0; i < nBorders; ++i)
+ {
+ pBorders[i].nStyle = _nFlags;
+ if(!(*pColumnItem)[i].bVisible)
+ pBorders[i].nStyle |= RULER_STYLE_INVISIBLE;
+ pBorders[i].nPos =
+ ConvertPosPixel((*pColumnItem)[i].nEnd + lAppNullOffset);
+ if(pColumnItem->Count() == i + 1)
+ {
+ //with table rows the end of the table is contained in the
+ //column item but it has no width!
+ pBorders[i].nWidth = 0;
+ }
+ else
+ {
+ pBorders[i].nWidth =
+ ConvertSizePixel((*pColumnItem)[i+1].nStart -
+ (*pColumnItem)[i].nEnd);
+ }
+ pBorders[i].nMinPos =
+ ConvertPosPixel((*pColumnItem)[i].nEndMin + lAppNullOffset);
+ pBorders[i].nMaxPos =
+ ConvertPosPixel((*pColumnItem)[i].nEndMax + lAppNullOffset);
+ }
+ SetBorders(pColumnItem->Count()-1, pBorders);
+ }
+ else
+ {
+ SetBorders();
+ }
+}
+
+
+void SvxRuler::UpdateObject()
+
+/*
+ [Beschreibung]
+
+ Anzeige der Objektdarstellung aktualisieren
+
+*/
+
+{
+ if(pObjectItem)
+ {
+ DBG_ASSERT(pObjectBorders, "kein Buffer");
+ // !! zum Seitenrand
+ long nMargin = pLRSpaceItem? pLRSpaceItem->GetLeft(): 0;
+ pObjectBorders[0].nPos =
+ ConvertPosPixel(pObjectItem->GetStartX() -
+ nMargin + lAppNullOffset);
+ pObjectBorders[1].nPos =
+ ConvertPosPixel(pObjectItem->GetEndX() - nMargin + lAppNullOffset);
+ nMargin = pULSpaceItem? pULSpaceItem->GetUpper(): 0;
+ pObjectBorders[2].nPos =
+ ConvertPosPixel(pObjectItem->GetStartY() -
+ nMargin + lAppNullOffset);
+ pObjectBorders[3].nPos =
+ ConvertPosPixel(pObjectItem->GetEndY() - nMargin + lAppNullOffset);
+
+ const sal_uInt16 nOff = GetObjectBordersOff(0);
+ SetBorders(2, pObjectBorders + nOff);
+ }
+ else
+ {
+ SetBorders();
+ }
+}
+
+
+void SvxRuler::UpdatePara()
+
+/*
+ [Beschreibung]
+
+ Anzeige der Absatzeinzuege aktualisieren:
+ Linken Rand, Erstzeileneinzug, rechten Rand Absatz aktualisieren
+ pIndents[0] = Buffer fuer alten Einzug
+ pIndents[1] = Buffer fuer alten Einzug
+ pIndents[INDENT_FIRST_LINE] = Erstzeileneinzug
+ pIndents[3] = linker Rand
+ pIndents[4] = rechter Rand
+ pIndents[5] = left border distance
+ pIndents[6] = right border distance
+
+*/
+
+{
+ // Abhaengigkeit zu PagePosItem
+ if(pParaItem && pPagePosItem && !pObjectItem)
+ {
+ sal_Bool bRTLText = pRuler_Imp->pTextRTLItem && pRuler_Imp->pTextRTLItem->GetValue();
+ // Erstzeileneinzug, ist negativ zum linken Absatzrand
+ long nLeftFrameMargin = GetLeftFrameMargin();
+ long nRightFrameMargin = GetRightFrameMargin();
+ if(bRTLText)
+ pIndents[INDENT_FIRST_LINE].nPos =
+ ConvertHPosPixel(
+ nRightFrameMargin -
+ pParaItem->GetTxtLeft() -
+ pParaItem->GetTxtFirstLineOfst() + lAppNullOffset );
+ else
+ pIndents[INDENT_FIRST_LINE].nPos =
+ ConvertHPosPixel(
+ nLeftFrameMargin +
+ pParaItem->GetTxtLeft() +
+ pParaItem->GetTxtFirstLineOfst() +
+ lAppNullOffset);
+ if( pParaItem->IsAutoFirst() )
+ pIndents[INDENT_FIRST_LINE].nStyle |= RULER_STYLE_INVISIBLE;
+ else
+ pIndents[INDENT_FIRST_LINE].nStyle &= ~RULER_STYLE_INVISIBLE;
+
+ if(bRTLText)
+ {
+ // left margin
+ pIndents[INDENT_LEFT_MARGIN].nPos =
+ ConvertHPosPixel(
+ nRightFrameMargin -
+ pParaItem->GetTxtLeft() + lAppNullOffset);
+ // right margin
+ pIndents[INDENT_RIGHT_MARGIN].nPos =
+ ConvertHPosPixel(
+ nLeftFrameMargin +
+ pParaItem->GetRight() + lAppNullOffset);
+ }
+ else
+ {
+ // linker Rand
+ pIndents[INDENT_LEFT_MARGIN].nPos =
+ ConvertHPosPixel(
+ nLeftFrameMargin +
+ pParaItem->GetTxtLeft() + lAppNullOffset);
+ // rechter Rand, immer negativ zum rechten Rand des umgebenden Frames
+ pIndents[INDENT_RIGHT_MARGIN].nPos =
+ ConvertHPosPixel(
+ nRightFrameMargin -
+ pParaItem->GetRight() + lAppNullOffset);
+ }
+ if(pParaBorderItem)
+ {
+ pIndents[INDENT_LEFT_BORDER].nPos =
+ ConvertHPosPixel( nLeftFrameMargin + lAppNullOffset);
+ pIndents[INDENT_RIGHT_BORDER].nPos =
+ ConvertHPosPixel(nRightFrameMargin - lAppNullOffset);
+ pIndents[INDENT_LEFT_BORDER].nStyle = pIndents[INDENT_RIGHT_BORDER].nStyle &= ~RULER_STYLE_INVISIBLE;
+ }
+ else
+ pIndents[INDENT_LEFT_BORDER].nStyle = pIndents[INDENT_RIGHT_BORDER].nStyle |= RULER_STYLE_INVISIBLE;
+
+ SetIndents(INDENT_COUNT, pIndents+INDENT_GAP);
+ }
+ else
+ {
+ if(pIndents)
+ {
+ pIndents[INDENT_FIRST_LINE].nPos =
+ pIndents[INDENT_LEFT_MARGIN].nPos =
+ pIndents[INDENT_RIGHT_MARGIN].nPos = 0;
+ }
+ SetIndents(); // ausschalten
+ }
+}
+
+
+void SvxRuler::UpdatePara
+(
+ const SvxLRSpaceItem *pItem // neuer Wert Absatzeinzuege
+)
+
+/*
+ [Beschreibung]
+
+ Neuen Wert Absatzeinzuege merken
+*/
+
+{
+ if(bActive)
+ {
+ delete pParaItem; pParaItem = 0;
+ if(pItem)
+ pParaItem = new SvxLRSpaceItem(*pItem);
+ StartListening_Impl();
+ }
+}
+void SvxRuler::UpdateParaBorder(const SvxLRSpaceItem * pItem )
+/*
+ [Description]
+ Border distance
+*/
+
+{
+ if(bActive)
+ {
+ delete pParaBorderItem; pParaBorderItem = 0;
+ if(pItem)
+ pParaBorderItem = new SvxLRSpaceItem(*pItem);
+ StartListening_Impl();
+ }
+}
+
+
+void SvxRuler::UpdatePage()
+
+/*
+ [Beschreibung]
+
+ Anzeige von Postion und Breite der Seite aktualisieren
+
+*/
+
+{
+ if(pPagePosItem)
+ {
+ // alle Objekte werden automatisch angepasst
+ if(bHorz)
+ SetPagePos(
+ pEditWin->LogicToPixel(pPagePosItem->GetPos()).X(),
+ pEditWin->LogicToPixel(Size(pPagePosItem->GetWidth(),0)).
+ Width());
+ else
+ SetPagePos(
+ pEditWin->LogicToPixel(pPagePosItem->GetPos()).Y(),
+ pEditWin->LogicToPixel(Size(0, pPagePosItem->GetHeight())).
+ Height());
+ if(bAppSetNullOffset)
+ SetNullOffset(ConvertSizePixel(-lAppNullOffset + lLogicNullOffset));
+ }
+ else
+ SetPagePos();
+
+ long lPos = 0;
+ Point aOwnPos = GetPosPixel();
+ Point aEdtWinPos = pEditWin->GetPosPixel();
+ if( Application::GetSettings().GetLayoutRTL() && bHorz )
+ {
+ //#i73321# in RTL the window and the ruler is not mirrored but the
+ // influence of the vertical ruler is inverted
+ Size aOwnSize = GetSizePixel();
+ Size aEdtWinSize = pEditWin->GetSizePixel();
+ lPos = aOwnSize.Width() - aEdtWinSize.Width();
+ lPos -= (aEdtWinPos - aOwnPos).X();
+ }
+ else
+ {
+ Point aPos(aEdtWinPos - aOwnPos);
+ lPos= bHorz ? aPos.X() : aPos.Y();
+ }
+
+// Leider bekommen wir den Offset des Editfensters zum Lineal nie
+// per Statusmeldung. Also setzen wir ihn selbst, wenn noetig.
+
+ if(lPos!=pRuler_Imp->lOldWinPos)
+ {
+ pRuler_Imp->lOldWinPos=lPos;
+ SetWinPos(lPos);
+ }
+}
+
+
+void SvxRuler::Update
+(
+ const SvxPagePosSizeItem *pItem // neuer Wert Seitenattribute
+)
+
+/*
+ [Beschreibung]
+
+ Neuen Wert Seitenattribute merken
+
+*/
+
+{
+ if(bActive)
+ {
+ delete pPagePosItem; pPagePosItem = 0;
+ if(pItem)
+ pPagePosItem = new SvxPagePosSizeItem(*pItem);
+ StartListening_Impl();
+ }
+}
+
+
+//
+
+void SvxRuler::SetDefTabDist
+(
+ long l // Neuer Abstand fuer DefaultTabs in App-Metrik
+)
+
+/*
+ [Beschreibung]
+
+ Neuer Abstand fuer DefaultTabs wird gesetzt
+
+*/
+
+{
+
+ lDefTabDist = l;
+ UpdateTabs();
+}
+
+
+long SvxRuler::GetDefTabDist() const
+
+/*
+ [Beschreibung]
+
+ Wert fuer DefaultTabs erfragen (wird in App.-Methik geliefert)
+
+*/
+
+{
+ return lDefTabDist;
+}
+
+
+sal_uInt16 ToSvTab_Impl(SvxTabAdjust eAdj)
+
+/*
+ [Beschreibung]
+
+ Interne Konvertierungsroutinen zwischen SV-Tab.-Enum und Svx
+
+*/
+
+{
+ switch(eAdj) {
+ case SVX_TAB_ADJUST_LEFT: return RULER_TAB_LEFT;
+ case SVX_TAB_ADJUST_RIGHT: return RULER_TAB_RIGHT;
+ case SVX_TAB_ADJUST_DECIMAL: return RULER_TAB_DECIMAL;
+ case SVX_TAB_ADJUST_CENTER: return RULER_TAB_CENTER;
+ case SVX_TAB_ADJUST_DEFAULT: return RULER_TAB_DEFAULT;
+ default: ;//prevent warning
+ }
+ return 0;
+}
+
+
+SvxTabAdjust ToAttrTab_Impl(sal_uInt16 eAdj)
+{
+ switch(eAdj) {
+ case RULER_TAB_LEFT: return SVX_TAB_ADJUST_LEFT ;
+ case RULER_TAB_RIGHT: return SVX_TAB_ADJUST_RIGHT ;
+ case RULER_TAB_DECIMAL: return SVX_TAB_ADJUST_DECIMAL ;
+ case RULER_TAB_CENTER: return SVX_TAB_ADJUST_CENTER ;
+ case RULER_TAB_DEFAULT: return SVX_TAB_ADJUST_DEFAULT ;
+ }
+ return SVX_TAB_ADJUST_LEFT;
+}
+
+
+void SvxRuler::UpdateTabs()
+
+/*
+ [Beschreibung]
+
+ Anzeige der Tabulatoren
+
+*/
+
+{
+ if(IsDrag())
+ return;
+ if(pPagePosItem && pParaItem && pTabStopItem && !pObjectItem)
+ {
+ // Puffer fuer DefaultTabStop
+ // Abstand letzter Tab <-> Rechter Absatzrand / DefaultTabDist
+ sal_Bool bRTL = pRuler_Imp->pTextRTLItem && pRuler_Imp->pTextRTLItem->GetValue();
+ long nLeftFrameMargin = GetLeftFrameMargin();
+ long nRightFrameMargin = GetRightFrameMargin();
+
+ //#i24363# tab stops relative to indent
+ const long nParaItemTxtLeft = pParaItem->GetTxtLeft();
+
+ const long lParaIndent = nLeftFrameMargin + nParaItemTxtLeft;
+
+ const long lLastTab =
+ pTabStopItem->Count()?
+ ConvertHPosPixel((*pTabStopItem)[pTabStopItem->Count()-1].GetTabPos()): 0;
+ const long lPosPixel =
+ ConvertHPosPixel(lParaIndent) + lLastTab;
+ const long lRightIndent =
+ ConvertHPosPixel(nRightFrameMargin - pParaItem->GetRight());
+ long nDefTabDist = ConvertHPosPixel(lDefTabDist);
+ if( !nDefTabDist )
+ nDefTabDist = 1;
+ const sal_uInt16 nDefTabBuf = lPosPixel > lRightIndent ||
+ lLastTab > lRightIndent
+ ? 0
+ : (sal_uInt16)( (lRightIndent - lPosPixel) / nDefTabDist );
+
+ if(pTabStopItem->Count() + TAB_GAP + nDefTabBuf > nTabBufSize)
+ {
+ delete[] pTabs;
+ // 10 (GAP) auf Vorrat
+ nTabBufSize = pTabStopItem->Count() + TAB_GAP + nDefTabBuf + GAP;
+ pTabs = new RulerTab[nTabBufSize];
+ }
+
+ nTabCount = 0;
+ sal_uInt16 j;
+ //#i24363# tab stops relative to indent
+ const long lRightPixMargin = ConvertSizePixel(nRightFrameMargin - nParaItemTxtLeft );
+ const long lParaIndentPix = ConvertSizePixel(lParaIndent);
+ for(j = 0; j < pTabStopItem->Count(); ++j)
+ {
+ const SvxTabStop *pTab = &(*pTabStopItem)[j];
+ pTabs[nTabCount+TAB_GAP].nPos =
+ ConvertHPosPixel(
+ (pRuler_Imp->bIsTabsRelativeToIndent ? lParaIndent : 0 ) + pTab->GetTabPos() + lAppNullOffset);
+ if(bRTL)
+ {
+ pTabs[nTabCount+TAB_GAP].nPos = lParaIndentPix + lRightPixMargin - pTabs[nTabCount+TAB_GAP].nPos;
+ }
+ pTabs[nTabCount+TAB_GAP].nStyle = ToSvTab_Impl(pTab->GetAdjustment());
+ ++nTabCount;
+ }
+ if(!pTabStopItem->Count())
+ pTabs[0].nPos = bRTL ? lRightPixMargin : lParaIndentPix;
+
+ // Rest mit Default-Tabs fuellen
+ if(bRTL)
+ {
+ for(j = 0; j < nDefTabBuf; ++j)
+ {
+ pTabs[nTabCount + TAB_GAP].nPos =
+ pTabs[nTabCount].nPos - nDefTabDist;
+
+ if(j == 0 )
+ pTabs[nTabCount + TAB_GAP].nPos -=
+ ((pTabs[nTabCount + TAB_GAP].nPos - lRightPixMargin)
+ % nDefTabDist );
+ if(pTabs[nTabCount+TAB_GAP].nPos <= lParaIndentPix)
+ break;
+ pTabs[nTabCount + TAB_GAP].nStyle = RULER_TAB_DEFAULT;
+ ++nTabCount;
+ }
+ }
+ else
+ {
+ for(j = 0; j < nDefTabBuf; ++j)
+ {
+ if( j == 0 )
+ {
+ //set the first default tab stop
+ if(pRuler_Imp->bIsTabsRelativeToIndent)
+ {
+ pTabs[nTabCount + TAB_GAP].nPos =
+ (pTabs[nTabCount].nPos + nDefTabDist);
+ pTabs[nTabCount + TAB_GAP].nPos -=
+ ((pTabs[nTabCount + TAB_GAP].nPos - lParaIndentPix)
+ % nDefTabDist );
+ }
+ else
+ {
+ if( pTabs[nTabCount].nPos < 0 )
+ {
+ pTabs[nTabCount + TAB_GAP].nPos = ( pTabs[nTabCount].nPos / nDefTabDist ) * nDefTabDist;
+ }
+ else
+ {
+ pTabs[nTabCount + TAB_GAP].nPos = ( pTabs[nTabCount].nPos / nDefTabDist + 1 ) * nDefTabDist;
+ }
+ }
+
+ }
+ else
+ {
+ //simply add the default distance to the last position
+ pTabs[nTabCount + TAB_GAP].nPos =
+ pTabs[nTabCount].nPos + nDefTabDist;
+ }
+
+ if(pTabs[nTabCount+TAB_GAP].nPos >= lRightIndent)
+ break;
+ pTabs[nTabCount + TAB_GAP].nStyle = RULER_TAB_DEFAULT;
+ ++nTabCount;
+ }
+ }
+ SetTabs(nTabCount, pTabs+TAB_GAP);
+ DBG_ASSERT(nTabCount + TAB_GAP <= nTabBufSize, "BufferSize zu klein");
+ }
+ else
+ {
+ SetTabs();
+ }
+}
+
+
+void SvxRuler::Update
+(
+ const SvxTabStopItem *pItem // Neuer Wert fuer Tabulatoren
+)
+
+/*
+ [Beschreibung]
+
+ Neuen Wert fuer Tabulatoren merken; alten gfs. loeschen
+
+*/
+
+{
+ if(bActive)
+ {
+ delete pTabStopItem; pTabStopItem = 0;
+ if(pItem)
+ {
+ pTabStopItem = new SvxTabStopItem(*pItem);
+ if(!bHorz)
+ pTabStopItem->SetWhich(SID_ATTR_TABSTOP_VERTICAL);
+ }
+ StartListening_Impl();
+ }
+}
+
+
+void SvxRuler::Update
+(
+ const SvxObjectItem *pItem // Neuer Wert fuer Objekte
+)
+
+/*
+ [Beschreibung]
+
+ Neuen Wert fuer Objekte merken
+
+*/
+
+{
+ if(bActive)
+ {
+ delete pObjectItem; pObjectItem = 0;
+ if(pItem)
+ pObjectItem = new SvxObjectItem(*pItem);
+ StartListening_Impl();
+ }
+}
+
+
+void SvxRuler::SetNullOffsetLogic
+(
+ long lVal // Setzen des logischen NullOffsets
+)
+{
+ lAppNullOffset = lLogicNullOffset - lVal;
+ bAppSetNullOffset = sal_True;
+ Ruler::SetNullOffset(ConvertSizePixel(lVal));
+ Update();
+}
+
+
+void SvxRuler::Update()
+
+/*
+ [Beschreibung]
+
+ Aktualisierung der Anzeige anstossen
+
+*/
+
+{
+ if(IsDrag())
+ return;
+ UpdatePage();
+ UpdateFrame();
+ if((nFlags & SVXRULER_SUPPORT_OBJECT) == SVXRULER_SUPPORT_OBJECT)
+ UpdateObject();
+ else
+ UpdateColumns();
+
+ if(0 != (nFlags & (SVXRULER_SUPPORT_PARAGRAPH_MARGINS |SVXRULER_SUPPORT_PARAGRAPH_MARGINS_VERTICAL)))
+ UpdatePara();
+ if(0 != (nFlags & SVXRULER_SUPPORT_TABS))
+ UpdateTabs();
+}
+
+
+inline long SvxRuler::GetPageWidth() const
+{
+ return bHorz ? pPagePosItem->GetWidth() : pPagePosItem->GetHeight();
+
+}
+
+
+inline long SvxRuler::GetFrameLeft() const
+
+/*
+ [Beschreibung]
+
+ Erfragen des linken Randes in Pixeln
+
+*/
+
+
+{
+ return bAppSetNullOffset?
+ GetMargin1() + ConvertSizePixel(lLogicNullOffset):
+ Ruler::GetNullOffset();
+}
+
+inline void SvxRuler::SetFrameLeft(long l)
+
+/*
+ [Beschreibung]
+
+ Setzen des linken Randes in Pixeln
+
+*/
+
+{
+ sal_Bool bProtectColumns =
+ pRuler_Imp->aProtectItem.IsSizeProtected() ||
+ pRuler_Imp->aProtectItem.IsPosProtected();
+ if(bAppSetNullOffset)
+ SetMargin1(l - ConvertSizePixel(lLogicNullOffset),
+ bProtectColumns ? 0 : RULER_MARGIN_SIZEABLE);
+ else
+ Ruler::SetNullOffset(l);
+}
+
+
+long SvxRuler::GetFirstLineIndent() const
+
+/*
+ [Beschreibung]
+
+ Erstzeileneinzug in Pixels erfragen
+*/
+
+{
+ return pParaItem? pIndents[INDENT_FIRST_LINE].nPos: GetMargin1();
+}
+
+
+long SvxRuler::GetLeftIndent() const
+
+/*
+ [Beschreibung]
+
+ Linken Absatzrand in Pixels erfragen
+*/
+
+{
+ return pParaItem? pIndents[INDENT_LEFT_MARGIN].nPos: GetMargin1();
+}
+
+
+
+long SvxRuler::GetRightIndent() const
+
+/*
+ [Beschreibung]
+
+ Rechten Absatzrand in Pixels erfragen
+*/
+
+{
+ return pParaItem? pIndents[INDENT_RIGHT_MARGIN].nPos: GetMargin2();
+}
+
+
+long SvxRuler::GetLogicRightIndent() const
+
+/*
+ [Beschreibung]
+
+ Rechten Absatzrand in Logic erfragen
+*/
+
+{
+ return pParaItem ? GetRightFrameMargin()-pParaItem->GetRight() : GetRightFrameMargin();
+}
+
+// linker Rand in App-Werten; ist entweder der Seitenrand (=0)
+// oder der linke Rand der Spalte, die im Spaltenattribut als
+// altuelle Spalte eingestellt ist.
+
+long SvxRuler::GetLeftFrameMargin() const
+{
+ // #126721# for some unknown reason the current column is set to 0xffff
+ DBG_ASSERT(!pColumnItem || pColumnItem->GetActColumn() < pColumnItem->Count(),
+ "issue #126721# - invalid current column!");
+ long nLeft =
+ pColumnItem && pColumnItem->Count() && pColumnItem->GetActColumn() < pColumnItem->Count() ?
+ (*pColumnItem)[pColumnItem->GetActColumn()].nStart : 0;
+ if(pParaBorderItem && (!pColumnItem || pColumnItem->IsTable()))
+ nLeft += pParaBorderItem->GetLeft();
+ return nLeft;
+}
+
+inline long SvxRuler::GetLeftMin() const
+{
+ DBG_ASSERT(pMinMaxItem, "kein MinMax-Wert gesetzt");
+ return pMinMaxItem?
+ bHorz? pMinMaxItem->GetValue().Left(): pMinMaxItem->GetValue().Top()
+ : 0;
+}
+
+inline long SvxRuler::GetRightMax() const
+{
+ DBG_ASSERT(pMinMaxItem, "kein MinMax-Wert gesetzt");
+ return pMinMaxItem?
+ bHorz? pMinMaxItem->GetValue().Right(): pMinMaxItem->GetValue().Bottom()
+ : 0;
+}
+
+
+long SvxRuler::GetRightFrameMargin() const
+
+/*
+ [Beschreibung]
+
+ Rechten umgebenden Rand erfragen (in logischen Einheiten)
+
+*/
+
+{
+ if(pColumnItem)
+ {
+ if(!IsActLastColumn( sal_True ))
+ {
+ long nRet = (*pColumnItem)[GetActRightColumn( sal_True )].nEnd;
+ if(pColumnItem->IsTable() && pParaBorderItem)
+ nRet -= pParaBorderItem->GetRight();
+ return nRet;
+ }
+ }
+
+ long l = lLogicNullOffset;
+
+ // gfs. rechten Tabelleneinzug abziehen
+ if(pColumnItem && pColumnItem->IsTable())
+ l += pColumnItem->GetRight();
+ else if(bHorz && pLRSpaceItem)
+ l += pLRSpaceItem->GetRight();
+ else if(!bHorz && pULSpaceItem)
+ l += pULSpaceItem->GetLower();
+
+ if(pParaBorderItem &&
+ (!pColumnItem || pColumnItem->IsTable()||IsActLastColumn( sal_True )))
+ l += pParaBorderItem->GetRight();
+
+ if(bHorz)
+ l = pPagePosItem->GetWidth() - l;
+ else
+ l = pPagePosItem->GetHeight() - l;
+ return l;
+}
+
+#define NEG_FLAG ( (nFlags & SVXRULER_SUPPORT_NEGATIVE_MARGINS) == \
+ SVXRULER_SUPPORT_NEGATIVE_MARGINS )
+#define TAB_FLAG ( pColumnItem && pColumnItem->IsTable() )
+
+long SvxRuler::GetCorrectedDragPos( sal_Bool bLeft, sal_Bool bRight )
+
+/*
+ [Beschreibung]
+
+ Korrigiert die Position innerhalb der errechneten Grenzwerte.
+ Die Grenzwerte sind in Pixel relativ zum Seitenrand.
+
+*/
+
+{
+ const long lNullPix = Ruler::GetNullOffset();
+ long lDragPos = GetDragPos() + lNullPix;
+ADD_DEBUG_TEXT("lDragPos: ", String::CreateFromInt32(lDragPos))
+ sal_Bool bHoriRows = bHorz && pRuler_Imp->bIsTableRows;
+ if((bLeft || (bHoriRows)) && lDragPos < nMaxLeft)
+ lDragPos = nMaxLeft;
+ else if((bRight||bHoriRows) && lDragPos > nMaxRight)
+ lDragPos = nMaxRight;
+ return lDragPos - lNullPix;
+}
+
+
+
+void ModifyTabs_Impl
+(
+ sal_uInt16 nCount, // Anzahl Tabs
+ RulerTab *pTabs, // Tab-Puffer
+ long lDiff // zu addierende Differenz
+ )
+
+/*
+ [Beschreibung]
+
+ Hilfsroutine; alle Tabs um einen festen Wert verschieben
+
+*/
+{
+ if( pTabs )
+ for(sal_uInt16 i = 0; i < nCount; ++i) pTabs[i].nPos += lDiff;
+}
+
+
+
+void SvxRuler::DragMargin1()
+
+/*
+ [Beschreibung]
+
+ Draggen des linken Frame-Randes
+
+*/
+{
+ const long lDragPos = GetCorrectedDragPos( !TAB_FLAG || !NEG_FLAG, sal_True );
+ DrawLine_Impl(lTabPos, ( TAB_FLAG && NEG_FLAG ) ? 3 : 7, bHorz);
+ if(pColumnItem&&
+ (//nDragType & DRAG_OBJECT_SIZE_LINEAR ||
+ nDragType & DRAG_OBJECT_SIZE_PROPORTIONAL))
+ DragBorders();
+ AdjustMargin1(lDragPos);
+}
+void SvxRuler::AdjustMargin1(long lDiff)
+{
+ const long nOld = bAppSetNullOffset? GetMargin1(): GetNullOffset();
+ const long lDragPos = lDiff;
+ sal_Bool bProtectColumns =
+ pRuler_Imp->aProtectItem.IsSizeProtected() ||
+ pRuler_Imp->aProtectItem.IsPosProtected();
+
+ const sal_uInt16 nMarginStyle =
+ bProtectColumns ? 0 : RULER_MARGIN_SIZEABLE;
+
+ if(!bAppSetNullOffset)
+ {
+ long _lDiff = lDragPos;
+ SetNullOffset(nOld + _lDiff);
+ if(!pColumnItem||!(nDragType & DRAG_OBJECT_SIZE_LINEAR))
+ {
+ SetMargin2( GetMargin2() - _lDiff, nMarginStyle );
+
+ if(!pColumnItem && !pObjectItem && pParaItem)
+ {
+ // Rechten Einzug an alter Position
+ pIndents[INDENT_RIGHT_MARGIN].nPos -= _lDiff;
+ SetIndents(INDENT_COUNT, pIndents+INDENT_GAP);
+ }
+ if(pObjectItem)
+ {
+ pObjectBorders[GetObjectBordersOff(0)].nPos -= _lDiff;
+ pObjectBorders[GetObjectBordersOff(1)].nPos -= _lDiff;
+ SetBorders(2, pObjectBorders + GetObjectBordersOff(0));
+ }
+ if(pColumnItem)
+ {
+ for(sal_uInt16 i = 0; i < pColumnItem->Count()-1; ++i)
+ pBorders[i].nPos -= _lDiff;
+ SetBorders(pColumnItem->Count()-1, pBorders);
+ if(pColumnItem->IsFirstAct())
+ {
+ // Rechten Einzug an alter Position
+ if(pParaItem)
+ {
+ pIndents[INDENT_RIGHT_MARGIN].nPos -= _lDiff;
+ SetIndents(INDENT_COUNT, pIndents+INDENT_GAP);
+ }
+ }
+ else
+ {
+ if(pParaItem)
+ {
+ pIndents[INDENT_FIRST_LINE].nPos -= _lDiff;
+ pIndents[INDENT_LEFT_MARGIN].nPos -= _lDiff;
+ pIndents[INDENT_RIGHT_MARGIN].nPos -= _lDiff;
+ SetIndents(INDENT_COUNT, pIndents+INDENT_GAP);
+ }
+ }
+ if(pTabStopItem&& (nDragType & DRAG_OBJECT_SIZE_PROPORTIONAL)
+ &&!IsActFirstColumn())
+ {
+ ModifyTabs_Impl(nTabCount+TAB_GAP, pTabs, -_lDiff);
+ SetTabs(nTabCount, pTabs+TAB_GAP);
+ }
+ }
+ }
+ }
+ else
+ {
+ long _lDiff = lDragPos - nOld;
+ SetMargin1(nOld + _lDiff, nMarginStyle );
+
+ if(!pColumnItem||!(nDragType & (DRAG_OBJECT_SIZE_LINEAR |
+ DRAG_OBJECT_SIZE_PROPORTIONAL)))
+ {
+ if(!pColumnItem && !pObjectItem && pParaItem)
+ {
+ // Linke Einzuege an alter Position
+ pIndents[INDENT_FIRST_LINE].nPos += _lDiff;
+ pIndents[INDENT_LEFT_MARGIN].nPos += _lDiff;
+ SetIndents(INDENT_COUNT, pIndents+INDENT_GAP);
+ }
+
+ if(pColumnItem)
+ {
+ for(sal_uInt16 i = 0; i < pColumnItem->Count()-1; ++i)
+ pBorders[i].nPos += _lDiff;
+ SetBorders(pColumnItem->Count()-1, pBorders);
+ if(pColumnItem->IsFirstAct())
+ {
+ // Linke Einzuege an alter Position
+ if(pParaItem)
+ {
+ pIndents[INDENT_FIRST_LINE].nPos += _lDiff;
+ pIndents[INDENT_LEFT_MARGIN].nPos += _lDiff;
+ SetIndents(INDENT_COUNT, pIndents+INDENT_GAP);
+ }
+ }
+ else
+ {
+ if(pParaItem)
+ {
+ pIndents[INDENT_FIRST_LINE].nPos += _lDiff;
+ pIndents[INDENT_LEFT_MARGIN].nPos += _lDiff;
+ pIndents[INDENT_RIGHT_MARGIN].nPos += _lDiff;
+ SetIndents(INDENT_COUNT, pIndents+INDENT_GAP);
+ }
+ }
+ }
+ if(pTabStopItem)
+ {
+ ModifyTabs_Impl(nTabCount+TAB_GAP, pTabs, _lDiff);
+ SetTabs(nTabCount, pTabs+TAB_GAP);
+ }
+ }
+ }
+}
+
+
+void SvxRuler::DragMargin2()
+/*
+ [Beschreibung]
+
+ Draggen des rechten Frame-Randes
+
+*/
+{
+ const long lDragPos = GetCorrectedDragPos( sal_True, !TAB_FLAG || !NEG_FLAG);
+ DrawLine_Impl(lTabPos, ( TAB_FLAG && NEG_FLAG ) ? 5 : 7, bHorz);
+ long lDiff = lDragPos - GetMargin2();
+
+ if(pRuler_Imp->bIsTableRows && !bHorz && pColumnItem&&
+ (//nDragType & DRAG_OBJECT_SIZE_LINEAR ||
+ nDragType & DRAG_OBJECT_SIZE_PROPORTIONAL))
+ DragBorders();
+
+ sal_Bool bProtectColumns =
+ pRuler_Imp->aProtectItem.IsSizeProtected() ||
+ pRuler_Imp->aProtectItem.IsPosProtected();
+ const sal_uInt16 nMarginStyle =
+ bProtectColumns ? 0 : RULER_MARGIN_SIZEABLE;
+ SetMargin2( lDragPos, nMarginStyle );
+
+ // Rechten Einzug an alter Position
+ if((!pColumnItem || IsActLastColumn()) && pParaItem)
+ {
+ pIndents[INDENT_FIRST_LINE].nPos += lDiff;
+ SetIndents(INDENT_COUNT, pIndents+INDENT_GAP);
+ }
+}
+
+
+void SvxRuler::DragIndents()
+/*
+ [Beschreibung]
+
+ Draggen der Absatzeinzuege
+
+*/
+{
+ const long lDragPos = NEG_FLAG ? GetDragPos() : GetCorrectedDragPos();
+ const sal_uInt16 nIdx = GetDragAryPos()+INDENT_GAP;
+ const long lDiff = pIndents[nIdx].nPos - lDragPos;
+
+ if((nIdx == INDENT_FIRST_LINE ||
+ nIdx == INDENT_LEFT_MARGIN ) &&
+ (nDragType & DRAG_OBJECT_LEFT_INDENT_ONLY) !=
+ DRAG_OBJECT_LEFT_INDENT_ONLY)
+ pIndents[INDENT_FIRST_LINE].nPos -= lDiff;
+
+ pIndents[nIdx].nPos = lDragPos;
+
+ SetIndents(INDENT_COUNT, pIndents + INDENT_GAP);
+ DrawLine_Impl(lTabPos, 1, bHorz);
+}
+
+
+void SvxRuler::DrawLine_Impl(long &_lTabPos, int nNew, sal_Bool Hori)
+/*
+ [Beschreibung]
+
+ Ausgaberoutine fuer Hilfslinie beim Vereschieben von Tabs, Tabellen-
+ und anderen Spalten
+
+*/
+{
+ if(Hori)
+ {
+ const long nHeight = pEditWin->GetOutputSize().Height();
+ Point aZero=pEditWin->GetMapMode().GetOrigin();
+ if(_lTabPos!=-1)
+ pEditWin->InvertTracking(
+ Rectangle( Point(_lTabPos, -aZero.Y()),
+ Point(_lTabPos, -aZero.Y()+nHeight)),
+ SHOWTRACK_SPLIT | SHOWTRACK_CLIP );
+ if( nNew & 1 )
+ {
+
+ _lTabPos = ConvertHSizeLogic(
+ GetCorrectedDragPos( ( nNew&4 ) != 0, ( nNew&2 ) != 0 ) +
+ GetNullOffset() );
+ if(pPagePosItem)
+ _lTabPos += pPagePosItem->GetPos().X();
+ pEditWin->InvertTracking(
+ Rectangle(Point(_lTabPos, -aZero.Y()),
+ Point(_lTabPos, -aZero.Y()+nHeight)),
+ SHOWTRACK_CLIP | SHOWTRACK_SPLIT );
+ }
+ }
+ else
+ {
+ const long nWidth = pEditWin->GetOutputSize().Width();
+ Point aZero=pEditWin->GetMapMode().GetOrigin();
+ if(_lTabPos != -1)
+ {
+ pEditWin->InvertTracking(
+ Rectangle( Point(-aZero.X(), _lTabPos),
+ Point(-aZero.X()+nWidth, _lTabPos)),
+ SHOWTRACK_SPLIT | SHOWTRACK_CLIP );
+ }
+
+ if(nNew & 1)
+ {
+ _lTabPos = ConvertVSizeLogic(GetCorrectedDragPos()+GetNullOffset());
+ if(pPagePosItem)
+ _lTabPos += pPagePosItem->GetPos().Y();
+ pEditWin->InvertTracking(
+ Rectangle( Point(-aZero.X(), _lTabPos),
+ Point(-aZero.X()+nWidth, _lTabPos)),
+ SHOWTRACK_CLIP | SHOWTRACK_SPLIT );
+ }
+ }
+}
+
+
+
+
+void SvxRuler::DragTabs()
+
+/*
+ [Beschreibung]
+
+ Draggen von Tabs
+
+*/
+{
+
+ long lDragPos = GetCorrectedDragPos(sal_True, sal_False);
+
+ sal_uInt16 nIdx = GetDragAryPos()+TAB_GAP;
+ DrawLine_Impl(lTabPos, 7, bHorz);
+
+ long nDiff = lDragPos - pTabs[nIdx].nPos;
+
+ if(nDragType & DRAG_OBJECT_SIZE_LINEAR)
+ {
+
+ for(sal_uInt16 i = nIdx; i < nTabCount; ++i)
+ {
+ pTabs[i].nPos += nDiff;
+ // auf Maximum begrenzen
+ if(pTabs[i].nPos > GetMargin2())
+ pTabs[nIdx].nStyle |= RULER_STYLE_INVISIBLE;
+ else
+ pTabs[nIdx].nStyle &= ~RULER_STYLE_INVISIBLE;
+ }
+ }
+ else if(nDragType & DRAG_OBJECT_SIZE_PROPORTIONAL)
+ {
+ pRuler_Imp->nTotalDist -= nDiff;
+ pTabs[nIdx].nPos = lDragPos;
+ for(sal_uInt16 i = nIdx+1; i < nTabCount; ++i)
+ {
+ if(pTabs[i].nStyle & RULER_TAB_DEFAULT)
+ // bei den DefaultTabs kann abgebrochen werden
+ break;
+ long nDelta = pRuler_Imp->nTotalDist * pRuler_Imp->pPercBuf[i];
+ nDelta /= 1000;
+ pTabs[i].nPos = pTabs[nIdx].nPos + nDelta;
+ if(pTabs[i].nPos+GetNullOffset() > nMaxRight)
+ pTabs[i].nStyle |= RULER_STYLE_INVISIBLE;
+ else
+ pTabs[i].nStyle &= ~RULER_STYLE_INVISIBLE;
+ }
+ }
+ else
+ pTabs[nIdx].nPos = lDragPos;
+
+ if(IsDragDelete())
+ pTabs[nIdx].nStyle |= RULER_STYLE_INVISIBLE;
+ else
+ pTabs[nIdx].nStyle &= ~RULER_STYLE_INVISIBLE;
+ SetTabs(nTabCount, pTabs+TAB_GAP);
+}
+
+
+
+void SvxRuler::SetActive(sal_Bool bOn)
+{
+ if(bOn)
+ {
+ Activate();
+/* pBindings->Invalidate( SID_RULER_LR_MIN_MAX, sal_True, sal_True );
+ pBindings->Update( SID_RULER_LR_MIN_MAX );
+ pBindings->Invalidate( SID_ATTR_LONG_ULSPACE, sal_True, sal_True );
+ pBindings->Update( SID_ATTR_LONG_ULSPACE );
+ pBindings->Invalidate( SID_ATTR_LONG_LRSPACE, sal_True, sal_True );
+ pBindings->Update( SID_ATTR_LONG_LRSPACE );
+ pBindings->Invalidate( SID_RULER_PAGE_POS, sal_True, sal_True );
+ pBindings->Update( SID_RULER_PAGE_POS );
+ pBindings->Invalidate( SID_ATTR_TABSTOP, sal_True, sal_True );
+ pBindings->Update( SID_ATTR_TABSTOP );
+ pBindings->Invalidate( SID_ATTR_PARA_LRSPACE, sal_True, sal_True );
+ pBindings->Update( SID_ATTR_PARA_LRSPACE );
+ pBindings->Invalidate( SID_RULER_BORDERS, sal_True, sal_True );
+ pBindings->Update( SID_RULER_BORDERS );
+ pBindings->Invalidate( SID_RULER_OBJECT, sal_True, sal_True );
+ pBindings->Update( SID_RULER_OBJECT );
+ pBindings->Invalidate( SID_RULER_PROTECT, sal_True, sal_True );
+ pBindings->Update( SID_RULER_PROTECT );*/
+ }
+ else
+ Deactivate();
+ if(bActive!=bOn)
+ {
+ pBindings->EnterRegistrations();
+ if(bOn)
+ for(sal_uInt16 i=0;i<pRuler_Imp->nControlerItems;i++)
+ pCtrlItem[i]->ReBind();
+ else
+ for(sal_uInt16 j=0;j<pRuler_Imp->nControlerItems;j++)
+ pCtrlItem[j]->UnBind();
+ pBindings->LeaveRegistrations();
+ }
+ bActive = bOn;
+}
+
+
+
+
+void SvxRuler::UpdateParaContents_Impl
+(
+ long l, // Differenz
+ UpdateType eType // Art (alle, links oder rechts)
+)
+
+/*
+ [Beschreibung]
+
+ Hilfsroutine; Mitfuehren von Tabulatoren und Absatzraendern
+
+*/
+{
+ switch(eType) {
+ case MOVE_RIGHT:
+ pIndents[INDENT_RIGHT_MARGIN].nPos += l;
+ break;
+ case MOVE_ALL:
+ pIndents[INDENT_RIGHT_MARGIN].nPos += l;
+ // no break
+ case MOVE_LEFT:
+ {
+ pIndents[INDENT_FIRST_LINE].nPos += l;
+ pIndents[INDENT_LEFT_MARGIN].nPos += l;
+ if ( pTabs )
+ {
+ for(sal_uInt16 i = 0; i < nTabCount+TAB_GAP;++i)
+ pTabs[i].nPos += l;
+ SetTabs(nTabCount, pTabs+TAB_GAP);
+ }
+ break;
+ }
+ }
+ SetIndents(INDENT_COUNT, pIndents+INDENT_GAP);
+}
+
+
+
+void SvxRuler::DragBorders()
+
+/*
+ [Beschreibung]
+
+ Draggen von Borders (Tabellen- und anderen Spalten)
+
+*/
+{
+ sal_Bool bLeftIndentsCorrected = sal_False, bRightIndentsCorrected = sal_False;
+ int nIdx;
+
+ if(GetDragType()==RULER_TYPE_BORDER)
+ {
+ DrawLine_Impl(lTabPos, 7, bHorz);
+ nIdx = GetDragAryPos();
+ }
+ else
+ nIdx=0;
+
+ sal_uInt16 nDragSize = GetDragSize();
+ long lDiff = 0;
+
+ // the drag position has to be corrected to be able to prevent borders from passing each other
+ long lPos = GetCorrectedDragPos();
+
+
+ switch(nDragSize)
+ {
+ case RULER_DRAGSIZE_MOVE:
+ {
+ADD_DEBUG_TEXT("lLastLMargin: ", String::CreateFromInt32(pRuler_Imp->lLastLMargin))
+ lDiff = GetDragType()==RULER_TYPE_BORDER ?
+ lPos-nDragOffset - pBorders[nIdx].nPos
+ : GetDragType() == RULER_TYPE_MARGIN1 ? lPos - pRuler_Imp->lLastLMargin : lPos - pRuler_Imp->lLastRMargin;
+
+// pBorders[nIdx].nPos += lDiff;
+// lDiff = pBorders[nIdx].nPos - nOld;
+ if(nDragType & DRAG_OBJECT_SIZE_LINEAR)
+ {
+ long nRight = GetMargin2()-lMinFrame; // rechter Begrenzer
+ for(int i = nBorderCount-2; i >= nIdx; --i)
+ {
+ long l = pBorders[i].nPos;
+ pBorders[i].nPos += lDiff;
+ pBorders[i].nPos = Min(pBorders[i].nPos, nRight - pBorders[i].nWidth);
+ nRight = pBorders[i].nPos - lMinFrame;
+ // RR der Spalte aktualisieren
+ if(i == GetActRightColumn())
+ {
+ UpdateParaContents_Impl(pBorders[i].nPos - l, MOVE_RIGHT);
+ bRightIndentsCorrected = sal_True;
+ }
+ // LAR, EZE der Spalte aktualisieren
+ else if(i == GetActLeftColumn())
+ {
+ UpdateParaContents_Impl(pBorders[i].nPos - l, MOVE_LEFT);
+ bLeftIndentsCorrected = sal_True;
+ }
+ }
+ }
+ else if(nDragType & DRAG_OBJECT_SIZE_PROPORTIONAL)
+ {
+ int nLimit;
+ long lLeft;
+ int nStartLimit = nBorderCount-2;
+ switch(GetDragType())
+ {
+ default: ;//prevent warning
+ DBG_ERROR("svx::SvxRuler::DragBorders(), unknown drag type!" );
+ case RULER_TYPE_BORDER:
+ if(pRuler_Imp->bIsTableRows)
+ {
+ pBorders[nIdx].nPos += lDiff;
+ if(bHorz)
+ {
+ lLeft = pBorders[nIdx].nPos;
+ pRuler_Imp->nTotalDist -= lDiff;
+ nLimit=nIdx+1;
+ }
+ else
+ {
+ lLeft = 0;
+ nStartLimit = nIdx - 1;
+ pRuler_Imp->nTotalDist += lDiff;
+ nLimit = 0;
+ }
+ }
+ else
+ {
+ nLimit=nIdx+1;
+ pBorders[nIdx].nPos += lDiff;
+ lLeft = pBorders[nIdx].nPos;
+ pRuler_Imp->nTotalDist-=lDiff;
+ }
+ break;
+ case RULER_TYPE_MARGIN1:
+ nLimit=0;
+ lLeft=pRuler_Imp->lLastLMargin+lDiff;
+ pRuler_Imp->nTotalDist-=lDiff;
+ break;
+ case RULER_TYPE_MARGIN2:
+ nLimit = 0;
+ lLeft= 0;//pRuler_Imp->lLastRMargin + lDiff;
+ nStartLimit = nBorderCount - 2;
+ pRuler_Imp->nTotalDist += lDiff;
+ break;
+ }
+
+ for(int i = nStartLimit; i >= nLimit; --i)
+ {
+
+ long l = pBorders[i].nPos;
+ pBorders[i].nPos=lLeft+
+ (pRuler_Imp->nTotalDist*pRuler_Imp->pPercBuf[i])/1000+
+ pRuler_Imp->pBlockBuf[i];
+
+ // RR der Spalte aktualisieren
+ if(!pRuler_Imp->bIsTableRows)
+ {
+ if(i == GetActRightColumn())
+ {
+ UpdateParaContents_Impl(pBorders[i].nPos - l, MOVE_RIGHT);
+ bRightIndentsCorrected = sal_True;
+ }
+ // LAR, EZE der Spalte aktualisieren
+ else if(i == GetActLeftColumn())
+ {
+ UpdateParaContents_Impl(pBorders[i].nPos - l, MOVE_LEFT);
+ bLeftIndentsCorrected = sal_True;
+ }
+ }
+ }
+ if(pRuler_Imp->bIsTableRows)
+ {
+ //in vertical tables the left borders have to be moved
+ if(bHorz)
+ {
+ for(int i = 0; i < nIdx; ++i)
+ pBorders[i].nPos += lDiff;
+ AdjustMargin1(lDiff);
+ }
+ else
+ {
+ //otherwise the right borders are moved
+ for(int i = pColumnItem->Count() - 1; i > nIdx; --i)
+ pBorders[i].nPos += lDiff;
+ SetMargin2( GetMargin2() + lDiff, 0 );
+ }
+ }
+ }
+ else if(pRuler_Imp->bIsTableRows)
+ {
+ //moving rows: if a row is resized all following rows
+ //have to be moved by the same amount.
+ //This includes the left border when the table is not limited
+ //to a lower frame border.
+ int nLimit;
+ long lLeft;
+ if(GetDragType()==RULER_TYPE_BORDER)
+ {
+ nLimit=nIdx+1;
+ lLeft=(pBorders[nIdx].nPos+=lDiff);
+ }
+ else
+ {
+ nLimit=0;
+ lLeft=pRuler_Imp->lLastLMargin+lDiff;
+ }
+ //in vertical tables the left borders have to be moved
+ if(bHorz)
+ {
+ for(int i = 0; i < nIdx; ++i)
+ {
+ pBorders[i].nPos += lDiff;
+ }
+ AdjustMargin1(lDiff);
+ }
+ else
+ {
+ //otherwise the right borders are moved
+ for(int i = nBorderCount-2; i >= nLimit; --i)
+ {
+ pBorders[i].nPos += lDiff;
+ }
+ SetMargin2( GetMargin2() + lDiff, 0 );
+ }
+ }
+ else
+ pBorders[nIdx].nPos+=lDiff;
+ break;
+ }
+ case RULER_DRAGSIZE_1:
+ {
+ lDiff = lPos - pBorders[nIdx].nPos;
+ pBorders[nIdx].nWidth += pBorders[nIdx].nPos - lPos;
+ pBorders[nIdx].nPos = lPos;
+ break;
+ }
+ case RULER_DRAGSIZE_2:
+ {
+ const long nOld = pBorders[nIdx].nWidth;
+ pBorders[nIdx].nWidth = lPos - pBorders[nIdx].nPos;
+ lDiff = pBorders[nIdx].nWidth - nOld;
+ break;
+ }
+ }
+ if(!bRightIndentsCorrected &&
+ GetActRightColumn() == nIdx &&
+ nDragSize != RULER_DRAGSIZE_2 && pIndents &&
+ !pRuler_Imp->bIsTableRows)
+ {
+ UpdateParaContents_Impl(lDiff, MOVE_RIGHT);
+ }
+ else if(!bLeftIndentsCorrected &&
+ GetActLeftColumn()==nIdx &&
+ nDragSize != RULER_DRAGSIZE_1 && pIndents)
+ {
+ UpdateParaContents_Impl(lDiff, MOVE_LEFT);
+ }
+ SetBorders(pColumnItem->Count()-1, pBorders);
+}
+
+
+void SvxRuler::DragObjectBorder()
+
+/*
+ [Beschreibung]
+
+ Draggen von Objektraendern
+
+*/
+{
+ if(RULER_DRAGSIZE_MOVE == GetDragSize())
+ {
+ const long lPos = GetCorrectedDragPos();
+ const sal_uInt16 nIdx = GetDragAryPos();
+ pObjectBorders[GetObjectBordersOff(nIdx)].nPos = lPos;
+ SetBorders(2, pObjectBorders + GetObjectBordersOff(0));
+ DrawLine_Impl(lTabPos, 7, bHorz);
+
+ }
+}
+
+
+void SvxRuler::ApplyMargins()
+/*
+ [Beschreibung]
+
+ Anwenden von Randeinstellungen; durch Draggen veraendert.
+
+*/
+{
+ const SfxPoolItem *pItem = 0;
+ sal_uInt16 nId = SID_ATTR_LONG_LRSPACE;
+ if(bHorz)
+ {
+ const long lOldNull = lLogicNullOffset;
+ if(pRuler_Imp->lMaxLeftLogic!=-1&&nMaxLeft==GetMargin1()+Ruler::GetNullOffset())
+ pLRSpaceItem->SetLeft(lLogicNullOffset=pRuler_Imp->lMaxLeftLogic);
+ else
+ pLRSpaceItem->SetLeft(PixelHAdjust(
+ lLogicNullOffset = ConvertHPosLogic(GetFrameLeft()) -
+ lAppNullOffset, pLRSpaceItem->GetLeft()));
+
+ if(bAppSetNullOffset)
+ lAppNullOffset += lLogicNullOffset - lOldNull;
+
+ if(pRuler_Imp->lMaxRightLogic!=-1
+ &&nMaxRight==GetMargin2()+Ruler::GetNullOffset())
+ pLRSpaceItem->SetRight(GetPageWidth()-pRuler_Imp->lMaxRightLogic);
+ else
+ pLRSpaceItem->SetRight(
+ PixelHAdjust(
+ Max((long)0,pPagePosItem->GetWidth() -
+ pLRSpaceItem->GetLeft() -
+ (ConvertHPosLogic(GetMargin2()) -
+ lAppNullOffset)),pLRSpaceItem->GetRight()));
+ pItem = pLRSpaceItem;
+#ifdef DEBUGLIN
+ Debug_Impl(pEditWin,*pLRSpaceItem);
+#endif // DEBUGLIN
+ }
+ else {
+ const long lOldNull = lLogicNullOffset;
+ pULSpaceItem->SetUpper(
+ PixelVAdjust(
+ lLogicNullOffset =
+ ConvertVPosLogic(GetFrameLeft()) -
+ lAppNullOffset,pULSpaceItem->GetUpper()));
+ if(bAppSetNullOffset)
+ lAppNullOffset += lLogicNullOffset - lOldNull;
+ pULSpaceItem->SetLower(
+ PixelVAdjust(
+ Max((long)0, pPagePosItem->GetHeight() -
+ pULSpaceItem->GetUpper() -
+ (ConvertVPosLogic(GetMargin2()) -
+ lAppNullOffset)),pULSpaceItem->GetLower()));
+ pItem = pULSpaceItem;
+ nId = SID_ATTR_LONG_ULSPACE;
+#ifdef DEBUGLIN
+ Debug_Impl(pEditWin,*pULSpaceItem);
+#endif // DEBUGLIN
+ }
+ pBindings->GetDispatcher()->Execute( nId, SFX_CALLMODE_RECORD, pItem, 0L );
+ if(pTabStopItem)
+ UpdateTabs();
+}
+
+
+void SvxRuler::ApplyIndents()
+/*
+ [Beschreibung]
+
+ Anwenden von Absatzeinstellungen; durch Draggen veraendert.
+
+*/
+{
+ long nNewTxtLeft;
+ if(pColumnItem&&!IsActFirstColumn( sal_True ))
+ {
+ long nLeftCol=GetActLeftColumn( sal_True );
+ nNewTxtLeft =
+ PixelHAdjust(
+ ConvertHPosLogic(
+ pIndents[INDENT_LEFT_MARGIN].nPos-
+ (pBorders[nLeftCol].nPos +
+ pBorders[nLeftCol].nWidth))-
+ lAppNullOffset,pParaItem->GetTxtLeft());
+ }
+ else
+ nNewTxtLeft =
+ PixelHAdjust(
+ ConvertHPosLogic(pIndents[INDENT_LEFT_MARGIN].nPos),
+ pParaItem->GetTxtLeft());
+
+ sal_Bool bRTL = pRuler_Imp->pTextRTLItem && pRuler_Imp->pTextRTLItem->GetValue();
+
+ long nNewFirstLineOffset;
+ if(bRTL)
+ {
+ long nRightFrameMargin = GetRightFrameMargin();
+ nNewFirstLineOffset = PixelHAdjust(nRightFrameMargin -
+ ConvertHPosLogic(pIndents[INDENT_FIRST_LINE].nPos ) -
+ lAppNullOffset,
+ pParaItem->GetTxtFirstLineOfst());
+ }
+ else
+ nNewFirstLineOffset=
+ PixelHAdjust(
+ ConvertHPosLogic(pIndents[INDENT_FIRST_LINE].nPos -
+ pIndents[INDENT_LEFT_MARGIN].nPos) -
+ lAppNullOffset,
+ pParaItem->GetTxtFirstLineOfst());
+
+ // #62986# : Ist der neue TxtLeft kleiner als der alte FirstLineIndent,
+ // dann geht die Differenz verloren und der Absatz wird insgesamt
+ // zu weit eingerueckt, deswegen erst den FirstLineOffset setzen, dann den TxtLeft
+ if(bRTL)
+ {
+ long nLeftFrameMargin = GetLeftFrameMargin();
+ long nRightFrameMargin = GetRightFrameMargin();
+ nNewTxtLeft = nRightFrameMargin - nNewTxtLeft - nLeftFrameMargin;
+ nNewFirstLineOffset -= nNewTxtLeft;
+ if(pParaBorderItem)
+ {
+ nNewTxtLeft += pParaBorderItem->GetLeft() + pParaBorderItem->GetRight();
+ nNewFirstLineOffset -= pParaBorderItem->GetRight();
+ }
+ }
+ pParaItem->SetTxtFirstLineOfst(
+ sal::static_int_cast< short >(nNewFirstLineOffset));
+ pParaItem->SetTxtLeft(nNewTxtLeft);
+
+ if(pColumnItem && ((!bRTL && !IsActLastColumn( sal_True ))|| (bRTL && !IsActFirstColumn())))
+ {
+ if(bRTL)
+ {
+ long nActBorder = pBorders[GetActLeftColumn( sal_True )].nPos;
+ long nRightMargin = pIndents[INDENT_RIGHT_MARGIN].nPos;
+ long nConvert = ConvertHPosLogic( nRightMargin - nActBorder );
+ pParaItem->SetRight( PixelHAdjust( nConvert - lAppNullOffset, pParaItem->GetRight() ) );
+ }
+ else
+ {
+ pParaItem->SetRight(
+ PixelHAdjust(
+ ConvertHPosLogic(
+ pBorders[GetActRightColumn( sal_True )].nPos -
+ pIndents[INDENT_RIGHT_MARGIN].nPos) -
+ lAppNullOffset,
+ pParaItem->GetRight()));
+ }
+
+ }
+ else
+ {
+ if(bRTL)
+ {
+ pParaItem->SetRight( PixelHAdjust(
+ ConvertHPosLogic(GetMargin1() +
+ pIndents[INDENT_RIGHT_MARGIN].nPos) - GetLeftFrameMargin() +
+ (pParaBorderItem ? pParaBorderItem->GetLeft() : 0) -
+ lAppNullOffset, pParaItem->GetRight()));
+ }
+ else
+ {
+ pParaItem->SetRight( PixelHAdjust(
+ ConvertHPosLogic(GetMargin2() -
+ pIndents[INDENT_RIGHT_MARGIN].nPos) -
+ lAppNullOffset, pParaItem->GetRight()));
+ }
+ }
+ sal_uInt16 nParaId = bHorz ? SID_ATTR_PARA_LRSPACE : SID_ATTR_PARA_LRSPACE_VERTICAL;
+ pBindings->GetDispatcher()->Execute( nParaId, SFX_CALLMODE_RECORD, pParaItem, 0L );
+ UpdateTabs();
+}
+
+
+void SvxRuler::ApplyTabs()
+/*
+ [Beschreibung]
+
+ Anwenden von Tabulatoreinstellungen; durch Draggen veraendert.
+
+*/
+{
+ sal_Bool bRTL = pRuler_Imp->pTextRTLItem && pRuler_Imp->pTextRTLItem->GetValue();
+ const sal_uInt16 nCoreIdx = GetDragAryPos();
+ if(IsDragDelete())
+ {
+ pTabStopItem->Remove(nCoreIdx);
+ }
+ else if(DRAG_OBJECT_SIZE_LINEAR & nDragType ||
+ DRAG_OBJECT_SIZE_PROPORTIONAL & nDragType)
+ {
+ SvxTabStopItem *pItem = new SvxTabStopItem(pTabStopItem->Which());
+ //remove default tab stops
+ for ( sal_uInt16 i = 0; i < pItem->Count(); )
+ {
+ if ( SVX_TAB_ADJUST_DEFAULT == (*pItem)[i].GetAdjustment() )
+ {
+ pItem->Remove(i);
+ continue;
+ }
+ ++i;
+ }
+
+ sal_uInt16 j;
+ for(j = 0; j < nCoreIdx; ++j)
+ {
+ pItem->Insert((*pTabStopItem)[j]);
+ }
+ for(; j < pTabStopItem->Count(); ++j)
+ {
+ SvxTabStop aTabStop = (*pTabStopItem)[j];
+ aTabStop.GetTabPos() = PixelHAdjust(
+ ConvertHPosLogic(pTabs[j+TAB_GAP].nPos -
+ GetLeftIndent()) -
+ lAppNullOffset,
+ aTabStop.GetTabPos());
+ pItem->Insert(aTabStop);
+ }
+ delete pTabStopItem;
+ pTabStopItem = pItem;
+ }
+ else if( pTabStopItem->Count() == 0 )
+ return;
+ else
+ {
+ SvxTabStop aTabStop = (*pTabStopItem)[nCoreIdx];
+ if(pRuler_Imp->lMaxRightLogic!=-1&&
+ pTabs[nCoreIdx+TAB_GAP].nPos+Ruler::GetNullOffset()==nMaxRight)
+ aTabStop.GetTabPos() = pRuler_Imp->lMaxRightLogic-lLogicNullOffset;
+ else
+ {
+ if(bRTL)
+ {
+ //#i24363# tab stops relative to indent
+ const long nTmpLeftIndent = pRuler_Imp->bIsTabsRelativeToIndent ?
+ GetLeftIndent() :
+ ConvertHPosPixel( GetRightFrameMargin() + lAppNullOffset );
+
+ aTabStop.GetTabPos() = PixelHAdjust(
+ ConvertHPosLogic( nTmpLeftIndent - pTabs[nCoreIdx+TAB_GAP].nPos) - lAppNullOffset,
+ aTabStop.GetTabPos());
+ }
+ else
+ {
+ //#i24363# tab stops relative to indent
+ const long nTmpLeftIndent = pRuler_Imp->bIsTabsRelativeToIndent ?
+ GetLeftIndent() :
+ 0;
+
+ aTabStop.GetTabPos() = PixelHAdjust(
+ ConvertHPosLogic( pTabs[nCoreIdx+TAB_GAP].nPos - nTmpLeftIndent ) - lAppNullOffset,
+ aTabStop.GetTabPos() );
+ }
+ }
+ pTabStopItem->Remove(nCoreIdx);
+ pTabStopItem->Insert(aTabStop);
+ }
+ sal_uInt16 nTabStopId = bHorz ? SID_ATTR_TABSTOP : SID_ATTR_TABSTOP_VERTICAL;
+ pBindings->GetDispatcher()->Execute( nTabStopId, SFX_CALLMODE_RECORD, pTabStopItem, 0L );
+ UpdateTabs();
+}
+
+
+void SvxRuler::ApplyBorders()
+/*
+ [Beschreibung]
+
+ Anwenden von (Tabellen-)Spalteneinstellungen; durch Draggen veraendert.
+
+*/
+{
+ if(pColumnItem->IsTable())
+ {
+ long l = GetFrameLeft();
+ if(l != pRuler_Imp->nColLeftPix)
+ pColumnItem->SetLeft( PixelHAdjust(
+ ConvertHPosLogic(l) - lAppNullOffset, pColumnItem->GetLeft()));
+ l = GetMargin2();
+ if(l != pRuler_Imp->nColRightPix)
+ {
+ long nWidthOrHeight = bHorz ? pPagePosItem->GetWidth() : pPagePosItem->GetHeight();
+ pColumnItem->SetRight( PixelHAdjust( nWidthOrHeight -
+ pColumnItem->GetLeft() - ConvertHPosLogic(l) -
+ lAppNullOffset, pColumnItem->GetRight() ) );
+ }
+ }
+ for(sal_uInt16 i = 0; i < pColumnItem->Count()-1; ++i)
+ {
+ long& nEnd = (*pColumnItem)[i].nEnd;
+ nEnd = PIXEL_H_ADJUST(
+ ConvertPosLogic(pBorders[i].nPos),
+ (*pColumnItem)[i].nEnd);
+ long& nStart = (*pColumnItem)[i+1].nStart;
+ nStart = PIXEL_H_ADJUST(
+ ConvertSizeLogic(pBorders[i].nPos +
+ pBorders[i].nWidth) -
+ lAppNullOffset,
+ (*pColumnItem)[i+1].nStart);
+ // Es kann sein, dass aufgrund der PIXEL_H_ADJUST rejustierung auf
+ // alte Werte die Breite < 0 wird. Das rerejustieren wir.
+ if( nEnd > nStart )
+ nStart = nEnd;
+ }
+#ifdef DEBUGLIN
+ Debug_Impl(pEditWin,*pColumnItem);
+#endif // DEBUGLIN
+ SfxBoolItem aFlag(SID_RULER_ACT_LINE_ONLY,
+ nDragType & DRAG_OBJECT_ACTLINE_ONLY? sal_True : sal_False);
+ sal_uInt16 nColId = pRuler_Imp->bIsTableRows ? (bHorz ? SID_RULER_ROWS : SID_RULER_ROWS_VERTICAL) :
+ (bHorz ? SID_RULER_BORDERS : SID_RULER_BORDERS_VERTICAL);
+ pBindings->GetDispatcher()->Execute( nColId, SFX_CALLMODE_RECORD, pColumnItem, &aFlag, 0L );
+}
+
+void SvxRuler::ApplyObject()
+/*
+ [Beschreibung]
+
+ Anwenden von Objekteinstellungen; durch Draggen veraendert.
+
+*/
+{
+ // zum Seitenrand
+ long nMargin = pLRSpaceItem? pLRSpaceItem->GetLeft(): 0;
+ pObjectItem->SetStartX(
+ PixelAdjust(
+ ConvertPosLogic(pObjectBorders[0].nPos)
+ + nMargin - lAppNullOffset,pObjectItem->GetStartX()));
+ pObjectItem->SetEndX(
+ PixelAdjust(
+ ConvertPosLogic(pObjectBorders[1].nPos)
+ + nMargin - lAppNullOffset,pObjectItem->GetEndX()));
+ nMargin = pULSpaceItem? pULSpaceItem->GetUpper(): 0;
+ pObjectItem->SetStartY(
+ PixelAdjust(
+ ConvertPosLogic(pObjectBorders[2].nPos)
+ + nMargin - lAppNullOffset,pObjectItem->GetStartY()));
+ pObjectItem->SetEndY(
+ PixelAdjust(
+ ConvertPosLogic(pObjectBorders[3].nPos)
+ + nMargin - lAppNullOffset,pObjectItem->GetEndY()));
+ pBindings->GetDispatcher()->Execute( SID_RULER_OBJECT, SFX_CALLMODE_RECORD, pObjectItem, 0L );
+}
+
+void SvxRuler::PrepareProportional_Impl(RulerType eType)
+/*
+ [Beschreibung]
+
+ Vorbereitung proportionales Draggen; es wird der proportionale
+ Anteil bezogen auf die Gesamtbreite in Promille berechnet.
+
+*/
+{
+ pRuler_Imp->nTotalDist = GetMargin2();
+ switch((int)eType)
+ {
+ case RULER_TYPE_MARGIN2:
+ case RULER_TYPE_MARGIN1:
+ case RULER_TYPE_BORDER:
+ {
+ DBG_ASSERT(pColumnItem, "kein ColumnItem");
+
+ pRuler_Imp->SetPercSize(pColumnItem->Count());
+
+ long lPos;
+ long lWidth=0;
+ sal_uInt16 nStart;
+ sal_uInt16 nIdx=GetDragAryPos();
+ lWidth=0;
+ long lActWidth=0;
+ long lActBorderSum;
+ long lOrigLPos;
+
+ if(eType != RULER_TYPE_BORDER)
+ {
+ lOrigLPos = GetMargin1();
+ nStart = 0;
+ lActBorderSum = 0;
+ }
+ else
+ {
+ if(pRuler_Imp->bIsTableRows &&!bHorz)
+ {
+ lOrigLPos = GetMargin1();
+ nStart = 0;
+ }
+ else
+ {
+ lOrigLPos = pBorders[nIdx].nPos + pBorders[nIdx].nWidth;
+ nStart = 1;
+ }
+ lActBorderSum = pBorders[nIdx].nWidth;
+ }
+
+ //in horizontal mode the percentage value has to be
+ //calculated on a "current change" position base
+ //because the height of the table changes while dragging
+ if(pRuler_Imp->bIsTableRows && RULER_TYPE_BORDER == eType)
+ {
+ sal_uInt16 nStartBorder;
+ sal_uInt16 nEndBorder;
+ if(bHorz)
+ {
+ nStartBorder = nIdx + 1;
+ nEndBorder = pColumnItem->Count() - 1;
+ }
+ else
+ {
+ nStartBorder = 0;
+ nEndBorder = nIdx;
+ }
+
+ lWidth = pBorders[nIdx].nPos;
+ if(bHorz)
+ lWidth = GetMargin2() - lWidth;
+ pRuler_Imp->nTotalDist = lWidth;
+ lPos = lOrigLPos = pBorders[nIdx].nPos;
+
+ for(sal_uInt16 i = nStartBorder; i < nEndBorder; ++i)
+ {
+ if(bHorz)
+ {
+ lActWidth += pBorders[i].nPos - lPos;
+ lPos = pBorders[i].nPos + pBorders[i].nWidth;
+ }
+ else
+ lActWidth = pBorders[i].nPos;
+ pRuler_Imp->pPercBuf[i] = (sal_uInt16)((lActWidth * 1000)
+ / pRuler_Imp->nTotalDist);
+ pRuler_Imp->pBlockBuf[i] = (sal_uInt16)lActBorderSum;
+ lActBorderSum += pBorders[i].nWidth;
+ }
+ }
+ else
+ {
+ lPos = lOrigLPos;
+ for(sal_uInt16 ii = nStart; ii < pColumnItem->Count() - 1; ++ii)
+ {
+ lWidth += pBorders[ii].nPos - lPos;
+ lPos = pBorders[ii].nPos + pBorders[ii].nWidth;
+ }
+
+ lWidth += GetMargin2() - lPos;
+ pRuler_Imp->nTotalDist = lWidth;
+ lPos = lOrigLPos;
+
+ for(sal_uInt16 i = nStart; i < pColumnItem->Count() - 1; ++i)
+ {
+ lActWidth += pBorders[i].nPos - lPos;
+ lPos = pBorders[i].nPos + pBorders[i].nWidth;
+ pRuler_Imp->pPercBuf[i] = (sal_uInt16)((lActWidth * 1000)
+ / pRuler_Imp->nTotalDist);
+ pRuler_Imp->pBlockBuf[i] = (sal_uInt16)lActBorderSum;
+ lActBorderSum += pBorders[i].nWidth;
+ }
+ }
+ }
+ break;
+ case RULER_TYPE_TAB:
+ {
+ const sal_uInt16 nIdx = GetDragAryPos()+TAB_GAP;
+ pRuler_Imp->nTotalDist -= pTabs[nIdx].nPos;
+ pRuler_Imp->SetPercSize(nTabCount);
+ for(sal_uInt16 n=0;n<=nIdx;pRuler_Imp->pPercBuf[n++]=0) ;
+ for(sal_uInt16 i = nIdx+1; i < nTabCount; ++i)
+ {
+ const long nDelta = pTabs[i].nPos - pTabs[nIdx].nPos;
+ pRuler_Imp->pPercBuf[i] = (sal_uInt16)((nDelta * 1000) / pRuler_Imp->nTotalDist);
+ }
+ break;
+ }
+ }
+}
+
+
+void SvxRuler::EvalModifier()
+
+/*
+ [Beschreibung]
+
+ Modifier Draggen auswerten
+
+ Shift: Linear verschieben
+ Control: Proportional verschieben
+ Shift+Control: Tabelle: nur aktuelle Zeile
+ alt: Bemassungspfeile (n.i.) //!!
+
+*/
+
+{
+ sal_uInt16 nModifier = GetDragModifier();
+ if(pRuler_Imp->bIsTableRows)
+ {
+ //rows can only be moved in one way, additionally current column is possible
+ if(nModifier == KEY_SHIFT)
+ nModifier = 0;
+ }
+ switch(nModifier)
+ {
+ case KEY_SHIFT:
+ nDragType = DRAG_OBJECT_SIZE_LINEAR;
+ break;
+ case KEY_MOD1: {
+ const RulerType eType = GetDragType();
+ nDragType = DRAG_OBJECT_SIZE_PROPORTIONAL;
+ if( RULER_TYPE_TAB == eType ||
+ ( ( RULER_TYPE_BORDER == eType || RULER_TYPE_MARGIN1 == eType ) &&
+ pColumnItem ) )
+ PrepareProportional_Impl(eType);
+ break;
+ }
+ case KEY_MOD1 | KEY_SHIFT:
+ if(GetDragType()!=RULER_TYPE_MARGIN1&&
+ GetDragType()!=RULER_TYPE_MARGIN2)
+ nDragType = DRAG_OBJECT_ACTLINE_ONLY;
+ break;
+ // alt: Bemassungspfeile
+ }
+}
+
+
+void __EXPORT SvxRuler::Click()
+
+/*
+ [Beschreibung]
+
+ Ueberladener Handler SV; setzt Tab per Dispatcheraufruf
+
+*/
+
+{
+ lcl_logRulerUse(::rtl::OUString::createFromAscii(".special://SfxRuler/Click"));
+ Ruler::Click();
+ if( bActive )
+ {
+ pBindings->Update( SID_RULER_LR_MIN_MAX );
+ pBindings->Update( SID_ATTR_LONG_ULSPACE );
+ pBindings->Update( SID_ATTR_LONG_LRSPACE );
+ pBindings->Update( SID_RULER_PAGE_POS );
+ pBindings->Update( bHorz ? SID_ATTR_TABSTOP : SID_ATTR_TABSTOP_VERTICAL);
+ pBindings->Update( bHorz ? SID_ATTR_PARA_LRSPACE : SID_ATTR_PARA_LRSPACE_VERTICAL);
+ pBindings->Update( bHorz ? SID_RULER_BORDERS : SID_RULER_BORDERS_VERTICAL);
+ pBindings->Update( bHorz ? SID_RULER_ROWS : SID_RULER_ROWS_VERTICAL);
+ pBindings->Update( SID_RULER_OBJECT );
+ pBindings->Update( SID_RULER_PROTECT );
+ pBindings->Update( SID_ATTR_PARA_LRSPACE_VERTICAL );
+ }
+ sal_Bool bRTL = pRuler_Imp->pTextRTLItem && pRuler_Imp->pTextRTLItem->GetValue();
+ if(pTabStopItem &&
+ (nFlags & SVXRULER_SUPPORT_TABS) == SVXRULER_SUPPORT_TABS)
+ {
+ sal_Bool bContentProtected = pRuler_Imp->aProtectItem.IsCntntProtected();
+ if( bContentProtected ) return;
+ const long lPos = GetClickPos();
+ if((bRTL && lPos < Min(GetFirstLineIndent(), GetLeftIndent()) && lPos > GetRightIndent()) ||
+ (!bRTL && lPos > Min(GetFirstLineIndent(), GetLeftIndent()) && lPos < GetRightIndent()))
+ {
+ //convert position in left-to-right text
+ long nTabPos;
+ //#i24363# tab stops relative to indent
+ if(bRTL)
+ nTabPos = ( pRuler_Imp->bIsTabsRelativeToIndent ?
+ GetLeftIndent() :
+ ConvertHPosPixel( GetRightFrameMargin() + lAppNullOffset ) ) -
+ lPos;
+ else
+ nTabPos = lPos -
+ ( pRuler_Imp->bIsTabsRelativeToIndent ?
+ GetLeftIndent() :
+ 0 );
+
+ SvxTabStop aTabStop(ConvertHPosLogic(nTabPos),
+ ToAttrTab_Impl(nDefTabType));
+ pTabStopItem->Insert(aTabStop);
+ UpdateTabs();
+ }
+ }
+}
+
+
+sal_Bool SvxRuler::CalcLimits
+(
+ long &nMax1, // zu setzenden Minimalwert
+ long &nMax2, // zu setzenden Maximalwert
+ sal_Bool
+) const
+/*
+ [Beschreibung]
+
+ Defaultimplementierung der virtuellen Funktion; kann die Applikation
+ ueberladen, um eine eigene Grenzwertbehandlung zu implementieren.
+ Die Werte sind auf die Seite bezogen.
+*/
+{
+ nMax1 = LONG_MIN;
+ nMax2 = LONG_MAX;
+ return sal_False;
+}
+
+
+void SvxRuler::CalcMinMax()
+
+/*
+ [Beschreibung]
+
+ Berechnet die Grenzwerte fuers Draggen; diese sind in Pixeln
+ relativ zum Seitenrand
+
+*/
+
+{
+ sal_Bool bRTL = pRuler_Imp->pTextRTLItem && pRuler_Imp->pTextRTLItem->GetValue();
+ const long lNullPix = ConvertPosPixel(lLogicNullOffset);
+ pRuler_Imp->lMaxLeftLogic=pRuler_Imp->lMaxRightLogic=-1;
+ switch(GetDragType())
+ {
+ case RULER_TYPE_MARGIN1:
+ { // linker Rand umgebender Frame
+ // DragPos - NOf zwischen links - rechts
+ pRuler_Imp->lMaxLeftLogic = GetLeftMin();
+ nMaxLeft=ConvertSizePixel(pRuler_Imp->lMaxLeftLogic);
+
+ if(!pColumnItem || pColumnItem->Count() == 1 )
+ {
+ if(bRTL)
+ {
+ nMaxRight = lNullPix - GetRightIndent() +
+ Max(GetFirstLineIndent(), GetLeftIndent()) -
+ lMinFrame;
+ }
+ else
+ {
+ nMaxRight = lNullPix + GetRightIndent() -
+ Max(GetFirstLineIndent(), GetLeftIndent()) -
+ lMinFrame;
+ }
+ }
+ else if(pRuler_Imp->bIsTableRows)
+ {
+ //top border is not moveable when table rows are displayed
+ // protection of content means the margin is not moveable - it's just a page break inside of a cell
+ if(bHorz && !pRuler_Imp->aProtectItem.IsCntntProtected())
+ {
+ nMaxLeft = pBorders[0].nMinPos + lNullPix;
+ if(nDragType & DRAG_OBJECT_SIZE_PROPORTIONAL)
+ nMaxRight = GetRightIndent() + lNullPix -
+ (pColumnItem->Count() - 1 ) * lMinFrame;
+ else
+ nMaxRight = pBorders[0].nPos - lMinFrame + lNullPix;
+ }
+ else
+ nMaxLeft = nMaxRight = lNullPix;
+ }
+ else
+ {
+ if(nDragType & DRAG_OBJECT_SIZE_PROPORTIONAL)
+ //nDragType & DRAG_OBJECT_SIZE_LINEAR)
+ {
+ nMaxRight=lNullPix+CalcPropMaxRight();
+ }
+ else if(nDragType & DRAG_OBJECT_SIZE_LINEAR)
+ {
+ nMaxRight = ConvertPosPixel(
+ GetPageWidth() - (
+ (pColumnItem->IsTable() && pLRSpaceItem)
+ ? pLRSpaceItem->GetRight() : 0))
+ - GetMargin2() + GetMargin1();
+ }
+ else
+ {
+ nMaxRight = lNullPix - lMinFrame;
+ if(pColumnItem->IsFirstAct())
+ {
+ if(bRTL)
+ {
+ nMaxRight += Min(
+ pBorders[0].nPos,
+ Max(GetFirstLineIndent(), GetLeftIndent()) - GetRightIndent());
+ }
+ else
+ {
+ nMaxRight += Min(
+ pBorders[0].nPos, GetRightIndent() -
+ Max(GetFirstLineIndent(), GetLeftIndent()));
+ }
+ }
+ else if( pColumnItem->Count() > 1 )
+ nMaxRight += pBorders[0].nPos;
+ else
+ nMaxRight +=GetRightIndent() -
+ Max(GetFirstLineIndent(), GetLeftIndent());
+ // den linken Tabellen-Rand nicht ueber den Seitenrand ziehen
+ if(pLRSpaceItem&&pColumnItem->IsTable())
+ {
+ long nTmp=ConvertSizePixel(pLRSpaceItem->GetLeft());
+ if(nTmp>nMaxLeft)
+ nMaxLeft=nTmp;
+ }
+ }
+ }
+ break;
+ }
+ case RULER_TYPE_MARGIN2:
+ { // rechter Rand umgebender Frame
+ pRuler_Imp->lMaxRightLogic =
+ pMinMaxItem ?
+ GetPageWidth() - GetRightMax() : GetPageWidth();
+ nMaxRight = ConvertSizePixel(pRuler_Imp->lMaxRightLogic);
+
+
+ if(!pColumnItem)
+ {
+ if(bRTL)
+ {
+ nMaxLeft = GetMargin2() + GetRightIndent() -
+ Max(GetFirstLineIndent(),GetLeftIndent()) - GetMargin1()+
+ lMinFrame + lNullPix;
+ }
+ else
+ {
+ nMaxLeft = GetMargin2() - GetRightIndent() +
+ Max(GetFirstLineIndent(),GetLeftIndent()) - GetMargin1()+
+ lMinFrame + lNullPix;
+ }
+ }
+ else if(pRuler_Imp->bIsTableRows)
+ {
+ // get the bottom move range from the last border position - only available for rows!
+ // protection of content means the margin is not moveable - it's just a page break inside of a cell
+ if(bHorz || pRuler_Imp->aProtectItem.IsCntntProtected())
+ {
+ nMaxLeft = nMaxRight = pBorders[pColumnItem->Count() - 1].nMaxPos + lNullPix;
+ }
+ else
+ {
+ if(nDragType & DRAG_OBJECT_SIZE_PROPORTIONAL)
+ {
+ nMaxLeft = (pColumnItem->Count()) * lMinFrame + lNullPix;
+ }
+ else
+ {
+ if(pColumnItem->Count() > 1)
+ nMaxLeft = pBorders[pColumnItem->Count() - 2].nPos + lMinFrame + lNullPix;
+ else
+ nMaxLeft = lMinFrame + lNullPix;
+ }
+ if(pColumnItem->Count() > 1)
+ nMaxRight = pBorders[pColumnItem->Count() - 2].nMaxPos + lNullPix;
+ else
+ nMaxRight -= GetRightIndent() - lNullPix;
+ }
+ }
+ else
+ {
+ nMaxLeft = lMinFrame + lNullPix;
+ if(IsActLastColumn() || pColumnItem->Count() < 2 ) //Falls letzte Spalte aktiv
+ {
+ if(bRTL)
+ {
+ nMaxLeft = lMinFrame + lNullPix + GetMargin2() +
+ GetRightIndent() - Max(GetFirstLineIndent(),
+ GetLeftIndent());
+ }
+ else
+ {
+ nMaxLeft = lMinFrame + lNullPix + GetMargin2() -
+ GetRightIndent() + Max(GetFirstLineIndent(),
+ GetLeftIndent());
+ }
+ }
+ if( pColumnItem->Count() >= 2 )
+ {
+ long nNewMaxLeft =
+ lMinFrame + lNullPix +
+ pBorders[pColumnItem->Count()-2].nPos +
+ pBorders[pColumnItem->Count()-2].nWidth;
+ nMaxLeft=Max(nMaxLeft,nNewMaxLeft);
+ }
+
+ }
+ break;
+ }
+ case RULER_TYPE_BORDER:
+ { // Tabelle, Spalten (Modifier)
+ const sal_uInt16 nIdx = GetDragAryPos();
+ switch(GetDragSize())
+ {
+ case RULER_DRAGSIZE_1 :
+ {
+ nMaxRight = pBorders[nIdx].nPos +
+ pBorders[nIdx].nWidth + lNullPix;
+
+ if(0 == nIdx)
+ nMaxLeft = lNullPix;
+ else
+ nMaxLeft = pBorders[nIdx-1].nPos +
+ pBorders[nIdx-1].nWidth + lNullPix;
+ if(nIdx == pColumnItem->GetActColumn())
+ {
+ if(bRTL)
+ {
+ nMaxLeft += pBorders[nIdx].nPos +
+ GetRightIndent() - Max(GetFirstLineIndent(),
+ GetLeftIndent());
+ }
+ else
+ {
+ nMaxLeft += pBorders[nIdx].nPos -
+ GetRightIndent() + Max(GetFirstLineIndent(),
+ GetLeftIndent());
+ }
+ if(0 != nIdx)
+ nMaxLeft -= pBorders[nIdx-1].nPos +
+ pBorders[nIdx-1].nWidth;
+ }
+ nMaxLeft += lMinFrame;
+ nMaxLeft += nDragOffset;
+ break;
+ }
+ case RULER_DRAGSIZE_MOVE:
+ {
+ if(pColumnItem)
+ {
+ //nIdx contains the position of the currently moved item
+ //next visible separator on the left
+ sal_uInt16 nLeftCol=GetActLeftColumn(sal_False, nIdx);
+ //next visible separator on the right
+ sal_uInt16 nRightCol=GetActRightColumn(sal_False, nIdx);
+ //next separator on the left - regardless if visible or not
+ sal_uInt16 nActLeftCol=GetActLeftColumn();
+ //next separator on the right - regardless if visible or not
+ sal_uInt16 nActRightCol=GetActRightColumn();
+ if(pColumnItem->IsTable())
+ {
+ if(nDragType & DRAG_OBJECT_ACTLINE_ONLY)
+ {
+ //the current row/column should be modified only
+ //then the next/previous visible border position
+ //marks the min/max positions
+ nMaxLeft = nLeftCol == USHRT_MAX ?
+ 0 :
+ pBorders[nLeftCol].nPos;
+ //rows can always be increased without a limit
+ if(pRuler_Imp->bIsTableRows)
+ nMaxRight = pBorders[nIdx].nMaxPos;
+ else
+ nMaxRight = nRightCol == USHRT_MAX ?
+ GetMargin2():
+ pBorders[nRightCol].nPos;
+ nMaxLeft += lNullPix;
+ nMaxRight += lNullPix;
+ }
+ else
+ {
+ if(DRAG_OBJECT_SIZE_PROPORTIONAL & nDragType && !bHorz && pRuler_Imp->bIsTableRows)
+ nMaxLeft = (nIdx + 1) * lMinFrame + lNullPix;
+ else
+ nMaxLeft = pBorders[nIdx].nMinPos + lNullPix;
+ if(DRAG_OBJECT_SIZE_PROPORTIONAL & nDragType||
+ (DRAG_OBJECT_SIZE_LINEAR & nDragType) )
+ {
+ if(pRuler_Imp->bIsTableRows)
+ {
+ if(bHorz)
+ nMaxRight = GetRightIndent() + lNullPix -
+ (pColumnItem->Count() - nIdx - 1) * lMinFrame;
+ else
+ nMaxRight = pBorders[nIdx].nMaxPos + lNullPix;
+ }
+ else
+ nMaxRight=lNullPix+CalcPropMaxRight(nIdx);
+ }
+ else
+ nMaxRight = pBorders[nIdx].nMaxPos + lNullPix;
+ }
+ nMaxLeft += lMinFrame;
+ nMaxRight -= lMinFrame;
+
+ }
+ else
+ {
+ if(nLeftCol==USHRT_MAX)
+ nMaxLeft=lNullPix;
+ else
+ nMaxLeft = pBorders[nLeftCol].nPos +
+ pBorders[nLeftCol].nWidth + lNullPix;
+
+ if(nActRightCol == nIdx)
+ {
+ if(bRTL)
+ {
+ nMaxLeft += pBorders[nIdx].nPos +
+ GetRightIndent() - Max(GetFirstLineIndent(),
+ GetLeftIndent());
+ if(nActLeftCol!=USHRT_MAX)
+ nMaxLeft -= pBorders[nActLeftCol].nPos +
+ pBorders[nActLeftCol].nWidth;
+ }
+ else
+ {
+ nMaxLeft += pBorders[nIdx].nPos -
+ GetRightIndent() + Max(GetFirstLineIndent(),
+ GetLeftIndent());
+ if(nActLeftCol!=USHRT_MAX)
+ nMaxLeft -= pBorders[nActLeftCol].nPos +
+ pBorders[nActLeftCol].nWidth;
+ }
+ }
+ nMaxLeft += lMinFrame;
+ nMaxLeft += nDragOffset;
+
+ // nMaxRight
+ // linear / proprotional verschieben
+ if(DRAG_OBJECT_SIZE_PROPORTIONAL & nDragType||
+ (DRAG_OBJECT_SIZE_LINEAR & nDragType) )
+ {
+ nMaxRight=lNullPix+CalcPropMaxRight(nIdx);
+ }
+ else if(DRAG_OBJECT_SIZE_LINEAR & nDragType)
+ {
+ nMaxRight=lNullPix+GetMargin2()-GetMargin1()+
+ (nBorderCount-nIdx-1)*lMinFrame;
+ }
+ else
+ {
+ if(nRightCol==USHRT_MAX)
+ { // letzte Spalte
+ nMaxRight = GetMargin2() + lNullPix;
+ if(IsActLastColumn())
+ {
+ if(bRTL)
+ {
+ nMaxRight -=
+ GetMargin2() + GetRightIndent() -
+ Max(GetFirstLineIndent(),
+ GetLeftIndent());
+ }
+ else
+ {
+ nMaxRight -=
+ GetMargin2() - GetRightIndent() +
+ Max(GetFirstLineIndent(),
+ GetLeftIndent());
+ }
+ nMaxRight += pBorders[nIdx].nPos +
+ pBorders[nIdx].nWidth;
+ }
+ }
+ else
+ {
+ nMaxRight = lNullPix + pBorders[nRightCol].nPos;
+ sal_uInt16 nNotHiddenRightCol =
+ GetActRightColumn(sal_True, nIdx);
+
+ if( nActLeftCol == nIdx )
+ {
+ long nBorder = nNotHiddenRightCol ==
+ USHRT_MAX ?
+ GetMargin2() :
+ pBorders[nNotHiddenRightCol].nPos;
+ if(bRTL)
+ {
+ nMaxRight -= nBorder + GetRightIndent() -
+ Max(GetFirstLineIndent(),
+ GetLeftIndent());
+ }
+ else
+ {
+ nMaxRight -= nBorder - GetRightIndent() +
+ Max(GetFirstLineIndent(),
+ GetLeftIndent());
+ }
+ nMaxRight += pBorders[nIdx].nPos +
+ pBorders[nIdx].nWidth;
+ }
+ }
+ nMaxRight -= lMinFrame;
+ nMaxRight -= pBorders[nIdx].nWidth;
+ }
+ }
+ }
+ // ObjectItem
+ else
+ {
+ if(pObjectItem->HasLimits())
+ {
+ if(CalcLimits(nMaxLeft, nMaxRight, nIdx & 1? sal_False : sal_True))
+ {
+ nMaxLeft = ConvertPosPixel(nMaxLeft);
+ nMaxRight = ConvertPosPixel(nMaxRight);
+ }
+ }
+ else
+ {
+ nMaxLeft = LONG_MIN;
+ nMaxRight = LONG_MAX;
+ }
+ }
+ break;
+ }
+ case RULER_DRAGSIZE_2:
+ {
+ nMaxLeft = lNullPix + pBorders[nIdx].nPos;
+ if(nIdx == pColumnItem->Count()-2) { // letzte Spalte
+ nMaxRight = GetMargin2() + lNullPix;
+ if(pColumnItem->IsLastAct()) {
+ nMaxRight -=
+ GetMargin2() - GetRightIndent() +
+ Max(GetFirstLineIndent(),
+ GetLeftIndent());
+ nMaxRight += pBorders[nIdx].nPos +
+ pBorders[nIdx].nWidth;
+ }
+ }
+ else {
+ nMaxRight = lNullPix + pBorders[nIdx+1].nPos;
+ if(pColumnItem->GetActColumn()-1 == nIdx) {
+ nMaxRight -= pBorders[nIdx+1].nPos - GetRightIndent() +
+ Max(GetFirstLineIndent(),
+ GetLeftIndent());
+ nMaxRight += pBorders[nIdx].nPos +
+ pBorders[nIdx].nWidth;
+ }
+ }
+ nMaxRight -= lMinFrame;
+ nMaxRight -= pBorders[nIdx].nWidth;
+ break;
+ }
+ }
+ nMaxRight += nDragOffset;
+ break;
+ }
+ case RULER_TYPE_INDENT:
+ {
+ const sal_uInt16 nIdx = GetDragAryPos();
+ switch(nIdx) {
+ case INDENT_FIRST_LINE - INDENT_GAP:
+ case INDENT_LEFT_MARGIN - INDENT_GAP:
+ {
+ if(bRTL)
+ {
+ nMaxLeft = lNullPix + GetRightIndent();
+
+ if(pColumnItem && !pColumnItem->IsFirstAct())
+ nMaxLeft += pBorders[pColumnItem->GetActColumn()-1].nPos +
+ pBorders[pColumnItem->GetActColumn()-1].nWidth;
+ nMaxRight = lNullPix + GetMargin2();
+
+ // zusammem draggen
+ if((INDENT_FIRST_LINE - INDENT_GAP) != nIdx &&
+ (nDragType & DRAG_OBJECT_LEFT_INDENT_ONLY) !=
+ DRAG_OBJECT_LEFT_INDENT_ONLY)
+ {
+ if(GetLeftIndent() > GetFirstLineIndent())
+ nMaxLeft += GetLeftIndent() - GetFirstLineIndent();
+ else
+ nMaxRight -= GetFirstLineIndent() - GetLeftIndent();
+ }
+ }
+ else
+ {
+ nMaxLeft = lNullPix;
+
+ if(pColumnItem && !pColumnItem->IsFirstAct())
+ nMaxLeft += pBorders[pColumnItem->GetActColumn()-1].nPos +
+ pBorders[pColumnItem->GetActColumn()-1].nWidth;
+ nMaxRight = lNullPix + GetRightIndent() - lMinFrame;
+
+ // zusammem draggen
+ if((INDENT_FIRST_LINE - INDENT_GAP) != nIdx &&
+ (nDragType & DRAG_OBJECT_LEFT_INDENT_ONLY) !=
+ DRAG_OBJECT_LEFT_INDENT_ONLY)
+ {
+ if(GetLeftIndent() > GetFirstLineIndent())
+ nMaxLeft += GetLeftIndent() - GetFirstLineIndent();
+ else
+ nMaxRight -= GetFirstLineIndent() - GetLeftIndent();
+ }
+ }
+ }
+ break;
+ case INDENT_RIGHT_MARGIN - INDENT_GAP:
+ {
+ if(bRTL)
+ {
+ nMaxLeft = lNullPix;
+ nMaxRight = lNullPix + Min(GetFirstLineIndent(), GetLeftIndent()) - lMinFrame;
+ if(pColumnItem)
+ {
+ sal_uInt16 nRightCol=GetActRightColumn( sal_True );
+ if(!IsActLastColumn( sal_True ))
+ nMaxRight += pBorders[nRightCol].nPos;
+ else
+ nMaxRight += GetMargin2();
+ }
+ else
+ nMaxLeft += GetMargin1();
+ nMaxLeft += lMinFrame;
+ }
+ else
+ {
+ nMaxLeft = lNullPix +
+ Max(GetFirstLineIndent(), GetLeftIndent());
+ nMaxRight = lNullPix;
+ if(pColumnItem)
+ {
+ sal_uInt16 nRightCol=GetActRightColumn( sal_True );
+ if(!IsActLastColumn( sal_True ))
+ nMaxRight += pBorders[nRightCol].nPos;
+ else
+ nMaxRight += GetMargin2();
+ }
+ else
+ nMaxRight += GetMargin2();
+ nMaxLeft += lMinFrame;
+ }
+ }
+ break;
+ }
+ break;
+ }
+ case RULER_TYPE_TAB: // Tabs (Modifier)
+ /*
+ links = NOf + Max(LAR, EZ)
+ rechts = NOf + RAR
+ */
+ nMaxLeft = bRTL ? lNullPix + GetRightIndent()
+ : lNullPix + Min(GetFirstLineIndent(), GetLeftIndent());
+ pRuler_Imp->lMaxRightLogic=GetLogicRightIndent()+lLogicNullOffset;
+ nMaxRight = ConvertSizePixel(pRuler_Imp->lMaxRightLogic);
+ break;
+ default: ; //prevent warning
+ }
+#ifdef DEBUGLIN
+ {
+ String aStr("MinLeft: ");
+ Size aSize(nMaxLeft + lNullPix, 0);
+ Size aSize2(nMaxRight + lNullPix, 0);
+ aSize = pEditWin->PixelToLogic(aSize, MapMode(MAP_MM));
+ aSize2 = pEditWin->PixelToLogic(aSize2, MapMode(MAP_MM));
+ aStr += String(aSize.Width());
+ aStr += " MaxRight: ";
+ aStr += String(aSize2.Width());
+ InfoBox(0, aStr).Execute();
+ }
+#endif
+}
+
+
+long __EXPORT SvxRuler::StartDrag()
+
+/*
+ [Beschreibung]
+
+ Beginn eines Drag-Vorgangs (SV-Handler); wertet Modifier aus
+ und berechnet Grenzwerte
+
+ [Querverweise]
+
+ <SvxRuler::EvalModifier()>
+ <SvxRuler::CalcMinMax()>
+ <SvxRuler::EndDrag()>
+
+*/
+
+{
+ lcl_logRulerUse(::rtl::OUString::createFromAscii(".special://SfxRuler/StartDrag"));
+ sal_Bool bContentProtected = pRuler_Imp->aProtectItem.IsCntntProtected();
+ if(!bValid)
+ return sal_False;
+
+ pRuler_Imp->lLastLMargin=GetMargin1();
+ pRuler_Imp->lLastRMargin=GetMargin2();
+ long bOk = 1;
+ if(GetStartDragHdl().IsSet())
+ bOk = Ruler::StartDrag();
+ if(bOk) {
+ lInitialDragPos = GetDragPos();
+ switch(GetDragType()) {
+ case RULER_TYPE_MARGIN1: // linker Rand umgebender Frame
+ case RULER_TYPE_MARGIN2: // rechter Rand umgebender Frame
+ if((bHorz && pLRSpaceItem) || (!bHorz && pULSpaceItem))
+ {
+ if(pColumnItem)
+ EvalModifier();
+ else
+ nDragType = DRAG_OBJECT;
+ }
+ else
+ bOk = sal_False;
+ break;
+ case RULER_TYPE_BORDER: // Tabelle, Spalten (Modifier)
+ if(pColumnItem)
+ {
+ nDragOffset = pColumnItem->IsTable()? 0 :
+ GetDragPos() - pBorders[GetDragAryPos()].nPos;
+ EvalModifier();
+
+ }
+ else
+ nDragOffset = 0;
+ break;
+ case RULER_TYPE_INDENT: { // Absatzeinzuege (Modifier)
+ if( bContentProtected )
+ return sal_False;
+ sal_uInt16 nIndent = INDENT_LEFT_MARGIN;
+ if((nIndent) == GetDragAryPos() + INDENT_GAP) { // Linker Absatzeinzug
+ pIndents[0] = pIndents[INDENT_FIRST_LINE];
+ pIndents[0].nStyle |= RULER_STYLE_DONTKNOW;
+ EvalModifier();
+ }
+ else
+ nDragType = DRAG_OBJECT;
+ pIndents[1] = pIndents[GetDragAryPos()+INDENT_GAP];
+ pIndents[1].nStyle |= RULER_STYLE_DONTKNOW;
+ break;
+ }
+ case RULER_TYPE_TAB: // Tabs (Modifier)
+ if( bContentProtected ) return sal_False;
+ EvalModifier();
+ pTabs[0] = pTabs[GetDragAryPos()+1];
+ pTabs[0].nStyle |= RULER_STYLE_DONTKNOW;
+ break;
+ default:
+ nDragType = NONE;
+ }
+ }
+ else
+ nDragType = NONE;
+ if(bOk)
+ CalcMinMax();
+ return bOk;
+}
+
+
+void __EXPORT SvxRuler::Drag()
+/*
+ [Beschreibung]
+
+ SV-Draghandler
+
+*/
+{
+ if(IsDragCanceled())
+ {
+ Ruler::Drag();
+ return;
+ }
+ switch(GetDragType()) {
+ case RULER_TYPE_MARGIN1: // linker Rand umgebender Frame
+ DragMargin1();
+ pRuler_Imp->lLastLMargin=GetMargin1();
+ break;
+ case RULER_TYPE_MARGIN2: // rechter Rand umgebender Frame
+ DragMargin2();
+ pRuler_Imp->lLastRMargin = GetMargin2();
+ break;
+ case RULER_TYPE_INDENT: // Absatzeinzuege
+ DragIndents();
+ break;
+ case RULER_TYPE_BORDER: // Tabelle, Spalten
+ if(pColumnItem)
+ DragBorders();
+ else if(pObjectItem)
+ DragObjectBorder();
+ break;
+ case RULER_TYPE_TAB: // Tabs
+ DragTabs();
+ break;
+ default: ;//prevent warning
+ }
+ Ruler::Drag();
+}
+
+
+void __EXPORT SvxRuler::EndDrag()
+/*
+ [Beschreibung]
+
+ SV-Handler; wird beim Beenden des Draggens gerufen.
+ Stoesst die Aktualisierung der Daten der Applikation an, indem
+ durch Aufruf der jeweiligen Apply...()- Methoden die Daten an die
+ Applikation geschickt werden.
+
+*/
+{
+ lcl_logRulerUse(::rtl::OUString::createFromAscii(".special://SfxRuler/EndDrag"));
+ const sal_Bool bUndo = IsDragCanceled();
+ const long lPos = GetDragPos();
+ DrawLine_Impl(lTabPos, 6, bHorz);
+ lTabPos=-1;
+ if(!bUndo)
+ switch(GetDragType())
+ {
+ case RULER_TYPE_MARGIN1: // linker, oberer Rand umgebender Frame
+ case RULER_TYPE_MARGIN2: // rechter, unterer Rand umgebender Frame
+ {
+ if(!pColumnItem || !pColumnItem->IsTable())
+ ApplyMargins();
+
+ if(pColumnItem &&
+ (pColumnItem->IsTable() ||
+ (nDragType & DRAG_OBJECT_SIZE_PROPORTIONAL)))
+ ApplyBorders();
+
+ }
+ break;
+ case RULER_TYPE_BORDER: // Tabelle, Spalten
+ if(lInitialDragPos != lPos ||
+ (pRuler_Imp->bIsTableRows && bHorz)) //special case - the null offset is changed here
+ {
+ if(pColumnItem)
+ {
+ ApplyBorders();
+ if(bHorz)
+ UpdateTabs();
+ }
+ else if(pObjectItem)
+ ApplyObject();
+ }
+ break;
+ case RULER_TYPE_INDENT: // Absatzeinzuege
+ if(lInitialDragPos != lPos)
+ ApplyIndents();
+ SetIndents(INDENT_COUNT, pIndents+INDENT_GAP);
+ break;
+ case RULER_TYPE_TAB: // Tabs
+ {
+ ApplyTabs();
+ pTabs[GetDragAryPos()].nStyle &= ~RULER_STYLE_INVISIBLE;
+ SetTabs(nTabCount, pTabs+TAB_GAP);
+ }
+ break;
+ default: ; //prevent warning
+ }
+ nDragType = NONE;
+ Ruler::EndDrag();
+ if(bUndo)
+ for(sal_uInt16 i=0;i<pRuler_Imp->nControlerItems;i++)
+ {
+ pCtrlItem[i]->ClearCache();
+ pCtrlItem[i]->GetBindings().Invalidate(pCtrlItem[i]->GetId());
+ // pCtrlItem[i]->UnBind();
+// pCtrlItem[i]->ReBind();
+ }
+}
+
+
+void __EXPORT SvxRuler::ExtraDown()
+
+/*
+ [Beschreibung]
+
+ Ueberladene SV-Methode; setzt den neuen Typ fuer den Defaulttabulator.
+*/
+
+{
+ // Tabulator Typ umschalten
+ if(pTabStopItem &&
+ (nFlags & SVXRULER_SUPPORT_TABS) == SVXRULER_SUPPORT_TABS) {
+ ++nDefTabType;
+ if(RULER_TAB_DEFAULT == nDefTabType)
+ nDefTabType = RULER_TAB_LEFT;
+ SetExtraType(RULER_EXTRA_TAB, nDefTabType);
+ }
+ Ruler::ExtraDown();
+}
+
+
+void __EXPORT SvxRuler::Notify(SfxBroadcaster&, const SfxHint& rHint)
+/*
+
+ [Beschreibung]
+
+ Benachrichtigung durch die Bindings, dass die Statusaktualisierung
+ beendet ist.
+ Das Lineal aktualisiert seine Darstellung und meldet sich bei den
+ Bindings wieder ab.
+
+*/
+
+{
+ // Aktualisierung anstossen
+ if(bActive &&
+ rHint.Type() == TYPE(SfxSimpleHint) &&
+ ((SfxSimpleHint&) rHint ).GetId() == SFX_HINT_UPDATEDONE ) {
+ Update();
+ EndListening(*pBindings);
+ bValid = sal_True;
+ bListening = sal_False;
+ }
+}
+
+
+IMPL_LINK_INLINE_START( SvxRuler, MenuSelect, Menu *, pMenu )
+
+/*
+ [Beschreibung]
+
+ Handler des Kontextmenues fuer das Umschalten der Masseinheit
+
+*/
+
+{
+ SetUnit(FieldUnit(pMenu->GetCurItemId()));
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvxRuler, MenuSelect, Menu *, pMenu )
+
+
+IMPL_LINK( SvxRuler, TabMenuSelect, Menu *, pMenu )
+
+/*
+ [Beschreibung]
+
+ Handler des Tabulatormenues fuer das Setzen des Typs
+
+*/
+
+{
+ if(pTabStopItem && pTabStopItem->Count() > pRuler_Imp->nIdx)
+ {
+ SvxTabStop aTabStop = (*pTabStopItem)[pRuler_Imp->nIdx];
+ aTabStop.GetAdjustment() = ToAttrTab_Impl(pMenu->GetCurItemId()-1);
+ pTabStopItem->Remove(pRuler_Imp->nIdx);
+ pTabStopItem->Insert(aTabStop);
+ sal_uInt16 nTabStopId = bHorz ? SID_ATTR_TABSTOP : SID_ATTR_TABSTOP_VERTICAL;
+ pBindings->GetDispatcher()->Execute( nTabStopId, SFX_CALLMODE_RECORD, pTabStopItem, 0L );
+ UpdateTabs();
+ pRuler_Imp->nIdx = 0;
+ }
+ return 0;
+}
+
+
+void SvxRuler::Command( const CommandEvent& rCEvt )
+
+/*
+ [Beschreibung]
+
+ Mauskontextmenue fuer das Umschalten der Masseinheit
+
+*/
+
+{
+ if ( COMMAND_CONTEXTMENU == rCEvt.GetCommand() )
+ {
+ CancelDrag();
+ sal_Bool bRTL = pRuler_Imp->pTextRTLItem && pRuler_Imp->pTextRTLItem->GetValue();
+ if ( pTabs &&
+ RULER_TYPE_TAB ==
+ GetType( rCEvt.GetMousePosPixel(), &pRuler_Imp->nIdx ) &&
+ pTabs[pRuler_Imp->nIdx+TAB_GAP].nStyle < RULER_TAB_DEFAULT )
+ {
+ PopupMenu aMenu;
+ aMenu.SetSelectHdl(LINK(this, SvxRuler, TabMenuSelect));
+ VirtualDevice aDev;
+ const Size aSz(RULER_TAB_WIDTH+2, RULER_TAB_HEIGHT+2);
+ aDev.SetOutputSize(aSz);
+ aDev.SetBackground(Wallpaper(Color(COL_WHITE)));
+ const Point aPt(aSz.Width() / 2, aSz.Height() / 2);
+
+ for ( sal_uInt16 i = RULER_TAB_LEFT; i < RULER_TAB_DEFAULT; ++i )
+ {
+ sal_uInt16 nStyle = bRTL ? i|RULER_TAB_RTL : i;
+ nStyle |= (sal_uInt16)(bHorz ? WB_HORZ : WB_VERT);
+ DrawTab(&aDev, aPt, nStyle);
+ aMenu.InsertItem(i+1,
+ String(ResId(RID_SVXSTR_RULER_START+i, DIALOG_MGR())),
+ Image(aDev.GetBitmap(Point(), aSz), Color(COL_WHITE)));
+ aMenu.CheckItem(i+1, i == pTabs[pRuler_Imp->nIdx+TAB_GAP].nStyle);
+ aDev.SetOutputSize(aSz); // device loeschen
+ }
+ aMenu.Execute( this, rCEvt.GetMousePosPixel() );
+ }
+ else
+ {
+ PopupMenu aMenu(ResId(RID_SVXMN_RULER, DIALOG_MGR()));
+ aMenu.SetSelectHdl(LINK(this, SvxRuler, MenuSelect));
+ FieldUnit eUnit = GetUnit();
+ const sal_uInt16 nCount = aMenu.GetItemCount();
+
+ sal_Bool bReduceMetric = 0 != (nFlags &SVXRULER_SUPPORT_REDUCED_METRIC);
+ for ( sal_uInt16 i = nCount; i; --i )
+ {
+ const sal_uInt16 nId = aMenu.GetItemId(i - 1);
+ aMenu.CheckItem(nId, nId == (sal_uInt16)eUnit);
+ if(bReduceMetric &&
+ (nId == FUNIT_M ||
+ nId == FUNIT_KM ||
+ nId == FUNIT_FOOT ||
+ nId == FUNIT_MILE ))
+ aMenu.RemoveItem(i - 1);
+ }
+ aMenu.Execute( this, rCEvt.GetMousePosPixel() );
+ }
+ }
+ else
+ Ruler::Command( rCEvt );
+}
+
+
+sal_uInt16 SvxRuler::GetActRightColumn(
+ sal_Bool bForceDontConsiderHidden, sal_uInt16 nAct ) const
+{
+ if( nAct == USHRT_MAX )
+ nAct = pColumnItem->GetActColumn();
+ else nAct++; //Damit man die ActDrag uebergeben kann
+
+ sal_Bool bConsiderHidden = !bForceDontConsiderHidden &&
+ !( nDragType & DRAG_OBJECT_ACTLINE_ONLY );
+
+ while( nAct < pColumnItem->Count() - 1 )
+ {
+ if( (*pColumnItem)[nAct].bVisible || bConsiderHidden )
+ return nAct;
+ else
+ nAct++;
+ }
+ return USHRT_MAX;
+}
+
+
+
+sal_uInt16 SvxRuler::GetActLeftColumn(
+ sal_Bool bForceDontConsiderHidden, sal_uInt16 nAct ) const
+{
+ if(nAct==USHRT_MAX)
+ nAct=pColumnItem->GetActColumn();
+
+ sal_uInt16 nLOffs=1;
+
+ sal_Bool bConsiderHidden = !bForceDontConsiderHidden &&
+ !( nDragType & DRAG_OBJECT_ACTLINE_ONLY );
+
+ while(nAct>=nLOffs)
+ {
+ if( (*pColumnItem)[ nAct - nLOffs ].bVisible || bConsiderHidden )
+ return nAct-nLOffs;
+ else
+ nLOffs++;
+ }
+ return USHRT_MAX;
+}
+
+
+sal_Bool SvxRuler::IsActLastColumn(
+ sal_Bool bForceDontConsiderHidden, sal_uInt16 nAct) const
+{
+ return GetActRightColumn(bForceDontConsiderHidden, nAct)==USHRT_MAX;
+}
+
+sal_Bool SvxRuler::IsActFirstColumn(
+ sal_Bool bForceDontConsiderHidden, sal_uInt16 nAct) const
+{
+ return GetActLeftColumn(bForceDontConsiderHidden, nAct)==USHRT_MAX;
+}
+
+long SvxRuler::CalcPropMaxRight(sal_uInt16 nCol) const
+{
+
+ if(!(nDragType & DRAG_OBJECT_SIZE_LINEAR))
+ {
+
+ // ausgehend vom rechten Rand die Mindestbreiten
+ // aller betroffenen Spalten abziehen
+ long _nMaxRight = GetMargin2()-GetMargin1();
+
+ long lFences=0;
+ long lMinSpace=USHRT_MAX;
+ long lOldPos;
+ long lColumns=0;
+ sal_uInt16 nStart;
+ if(!pColumnItem->IsTable())
+ {
+ if(nCol==USHRT_MAX)
+ {
+ lOldPos=GetMargin1();
+ nStart=0;
+ }
+ else
+ {
+ lOldPos=pBorders[nCol].nPos+pBorders[nCol].nWidth;
+ nStart=nCol+1;
+ lFences=pBorders[nCol].nWidth;
+ }
+
+ for(sal_uInt16 i = nStart; i < nBorderCount-1; ++i)
+ {
+ long lWidth=pBorders[i].nPos-lOldPos;
+ lColumns+=lWidth;
+ if(lWidth<lMinSpace)
+ lMinSpace=lWidth;
+ lOldPos=pBorders[i].nPos+pBorders[i].nWidth;
+ lFences+=pBorders[i].nWidth;
+ }
+ long lWidth=GetMargin2()-lOldPos;
+ lColumns+=lWidth;
+ if(lWidth<lMinSpace)
+ lMinSpace=lWidth;
+ }
+ else
+ {
+ sal_uInt16 nActCol;
+ if(nCol==USHRT_MAX) //CalcMinMax fuer LeftMargin
+ {
+ lOldPos=GetMargin1();
+ }
+ else
+ {
+ lOldPos=pBorders[nCol].nPos;
+ }
+ lColumns=GetMargin2()-lOldPos;
+ nActCol=nCol;
+ lFences=0;
+ while(nActCol<nBorderCount||nActCol==USHRT_MAX)
+ {
+ sal_uInt16 nRight;
+ if(nActCol==USHRT_MAX)
+ {
+ nRight=0;
+ while(!(*pColumnItem)[nRight].bVisible)
+ nRight++;
+ }
+ else
+ nRight=GetActRightColumn(sal_False, nActCol);
+ long lWidth;
+ if(nRight!=USHRT_MAX)
+ {
+ lWidth=pBorders[nRight].nPos-lOldPos;
+ lOldPos=pBorders[nRight].nPos;
+ }
+ else
+ lWidth=GetMargin2()-lOldPos;
+ nActCol=nRight;
+ if(lWidth<lMinSpace)
+ lMinSpace=lWidth;
+ if(nActCol==USHRT_MAX)
+ break;
+ }
+ }
+
+ _nMaxRight-=(long)(lFences+lMinFrame/(float)lMinSpace*lColumns);
+ return _nMaxRight;
+ }
+ else
+ {
+ if(pColumnItem->IsTable())
+ {
+ sal_uInt16 nVisCols=0;
+ for(sal_uInt16 i=GetActRightColumn(sal_False, nCol);i<nBorderCount;)
+ {
+ if((*pColumnItem)[i].bVisible)
+ nVisCols++;
+ i=GetActRightColumn(sal_False, i);
+ }
+ return GetMargin2()-GetMargin1()-(nVisCols+1)*lMinFrame;
+ }
+ else
+ {
+ long lWidth=0;
+ for(sal_uInt16 i=nCol;i<nBorderCount-1;i++)
+ {
+ lWidth+=lMinFrame+pBorders[i].nWidth;
+ }
+ return GetMargin2()-GetMargin1()-lWidth;
+ }
+ }
+}
+/*-- 29.11.2007 08:24:23---------------------------------------------------
+ //#i24363# tab stops relative to indent
+ -----------------------------------------------------------------------*/
+void SvxRuler::SetTabsRelativeToIndent( sal_Bool bRel )
+{
+ pRuler_Imp->bIsTabsRelativeToIndent = bRel;
+}
+
diff --git a/svx/source/dialog/swframeexample.cxx b/svx/source/dialog/swframeexample.cxx
new file mode 100644
index 000000000000..b030a27c952a
--- /dev/null
+++ b/svx/source/dialog/swframeexample.cxx
@@ -0,0 +1,737 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+
+#include <tools/poly.hxx>
+#include <vcl/metric.hxx>
+#include <vcl/svapp.hxx>
+#include <svtools/colorcfg.hxx>
+#include <svx/swframeexample.hxx>
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <com/sun/star/text/HoriOrientation.hpp>
+#include <com/sun/star/text/VertOrientation.hpp>
+#include <com/sun/star/text/RelOrientation.hpp>
+#include <com/sun/star/text/WrapTextMode.hpp>
+
+using namespace ::com::sun::star::text;
+
+#define FLYINFLY_BORDER 3
+#define DEMOTEXT "Ij"
+#define C2S(cChar) UniString::CreateFromAscii(cChar)
+
+
+SvxSwFrameExample::SvxSwFrameExample( Window *pParent, const ResId& rResID ) :
+
+ Window(pParent, rResID),
+
+ nHAlign (HoriOrientation::CENTER),
+ nHRel (RelOrientation::FRAME),
+ nVAlign (VertOrientation::TOP),
+ nVRel (RelOrientation::PRINT_AREA),
+ nWrap (WrapTextMode_NONE),
+ nAnchor (TextContentAnchorType_AT_PAGE),
+ bTrans (sal_False),
+ aRelPos (Point(0,0))
+{
+ InitColors_Impl();
+ SetMapMode(MAP_PIXEL);
+}
+
+SvxSwFrameExample::~SvxSwFrameExample()
+{
+}
+
+void SvxSwFrameExample::InitColors_Impl( void )
+{
+ const StyleSettings& rSettings = GetSettings().GetStyleSettings();
+ m_aBgCol = Color( rSettings.GetWindowColor() ); // old: COL_WHITE
+
+ sal_Bool bHC = rSettings.GetHighContrastMode();
+
+ m_aFrameColor = Color( COL_LIGHTGREEN );
+ m_aAlignColor = Color( COL_LIGHTRED );
+ m_aTransColor = Color( COL_TRANSPARENT );
+
+ m_aTxtCol = bHC?
+ svtools::ColorConfig().GetColorValue(svtools::FONTCOLOR).nColor :
+ Color( COL_GRAY ); // old: COL_GRAY
+ m_aPrintAreaCol = bHC? m_aTxtCol : Color( COL_GRAY );
+ m_aBorderCol = m_aTxtCol; // old: COL_BLACK;
+ m_aBlankCol = bHC? m_aTxtCol : Color( COL_LIGHTGRAY );
+ m_aBlankFrameCol = bHC? m_aTxtCol : Color( COL_GRAY );
+}
+
+void SvxSwFrameExample::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+
+ if( rDCEvt.GetType() == DATACHANGED_SETTINGS && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
+ InitColors_Impl();
+}
+
+void SvxSwFrameExample::InitAllRects_Impl()
+{
+// const Size aSz(GetOutputSizePixel());
+
+ // Seite
+// aPage.SetSize(Size(aSz.Width() - 3, aSz.Height() - 3));
+ aPage.SetSize( GetOutputSizePixel() );
+
+ sal_uIntPtr nOutWPix = aPage.GetWidth();
+ sal_uIntPtr nOutHPix = aPage.GetHeight();
+
+ // PrintArea
+ sal_uIntPtr nLBorder;
+ sal_uIntPtr nRBorder;
+ sal_uIntPtr nTBorder;
+ sal_uIntPtr nBBorder;
+
+ sal_uIntPtr nLTxtBorder;
+ sal_uIntPtr nRTxtBorder;
+ sal_uIntPtr nTTxtBorder;
+ sal_uIntPtr nBTxtBorder;
+
+ if (nAnchor != TextContentAnchorType_AS_CHARACTER)
+ {
+ nLBorder = 14;
+ nRBorder = 10;
+ nTBorder = 10;
+ nBBorder = 15;
+
+ nLTxtBorder = 8;
+ nRTxtBorder = 4;
+ nTTxtBorder = 2;
+ nBTxtBorder = 2;
+ }
+ else
+ {
+ nLBorder = 2;
+ nRBorder = 2;
+ nTBorder = 2;
+ nBBorder = 2;
+
+ nLTxtBorder = 2;
+ nRTxtBorder = 2;
+ nTTxtBorder = 2;
+ nBTxtBorder = 2;
+ }
+ aPagePrtArea = Rectangle(Point(nLBorder, nTBorder), Point((nOutWPix - 1) - nRBorder, (nOutHPix - 1) - nBBorder));
+
+ // Beispiel-Text: Vorbereiten fuer die Textausgabe
+ // Eine Textzeile
+ aTextLine = aPagePrtArea;
+ aTextLine.SetSize(Size(aTextLine.GetWidth(), 2));
+ aTextLine.Left() += nLTxtBorder;
+ aTextLine.Right() -= nRTxtBorder;
+ aTextLine.Move(0, nTTxtBorder);
+
+ // Rechteck um Absatz incl. Raender
+ sal_uInt16 nLines = (sal_uInt16)((aPagePrtArea.GetHeight() / 2 - nTTxtBorder - nBTxtBorder)
+ / (aTextLine.GetHeight() + 2));
+ aPara = aPagePrtArea;
+ aPara.SetSize(Size(aPara.GetWidth(),
+ (aTextLine.GetHeight() + 2) * nLines + nTTxtBorder + nBTxtBorder));
+
+ // Rechteck um Absatz ohne Raender
+ aParaPrtArea = aPara;
+ aParaPrtArea.Left() += nLTxtBorder;
+ aParaPrtArea.Right() -= nRTxtBorder;
+ aParaPrtArea.Top() += nTTxtBorder;
+ aParaPrtArea.Bottom() -= nBTxtBorder;
+
+ if (nAnchor == TextContentAnchorType_AS_CHARACTER || nAnchor == TextContentAnchorType_AT_CHARACTER)
+ {
+ Font aFont = OutputDevice::GetDefaultFont(
+ DEFAULTFONT_LATIN_TEXT, Application::GetSettings().GetLanguage(),
+ DEFAULTFONT_FLAGS_ONLYONE, this );
+ aFont.SetColor( m_aTxtCol );
+ aFont.SetFillColor( m_aBgCol );
+ aFont.SetWeight(WEIGHT_NORMAL);
+
+ if (nAnchor == TextContentAnchorType_AS_CHARACTER)
+ {
+ aFont.SetSize(Size(0, aParaPrtArea.GetHeight() - 2));
+ SetFont(aFont);
+ aParaPrtArea.SetSize(Size(GetTextWidth(C2S(DEMOTEXT)), GetTextHeight()));
+ }
+ else
+ {
+ aFont.SetSize(Size(0, aParaPrtArea.GetHeight() / 2));
+ SetFont(aFont);
+ aAutoCharFrame.SetSize(Size(GetTextWidth('A'), GetTextHeight()));
+ aAutoCharFrame.SetPos(Point(aParaPrtArea.Left() + (aParaPrtArea.GetWidth() - aAutoCharFrame.GetWidth()) / 2,
+ aParaPrtArea.Top() + (aParaPrtArea.GetHeight() - aAutoCharFrame.GetHeight()) / 2));
+ }
+ }
+
+ // Innerer Frame fuer am Frame verankerte Rahmen
+ aFrameAtFrame = aPara;
+ aFrameAtFrame.Left() += 9;
+ aFrameAtFrame.Right() -= 5;
+ aFrameAtFrame.Bottom() += 5;
+ aFrameAtFrame.SetPos(Point(aFrameAtFrame.Left() + 2, (aPagePrtArea.Bottom() - aFrameAtFrame.GetHeight()) / 2 + 5));
+
+ // Groesse des zu positionierenden Rahmens
+ if (nAnchor != TextContentAnchorType_AS_CHARACTER)
+ {
+ sal_uIntPtr nLFBorder = nAnchor == TextContentAnchorType_AT_PAGE ? nLBorder : nLTxtBorder;
+ sal_uIntPtr nRFBorder = nAnchor == TextContentAnchorType_AT_PAGE ? nRBorder : nRTxtBorder;
+
+ switch (nHRel)
+ {
+ case RelOrientation::PAGE_LEFT:
+ case RelOrientation::FRAME_LEFT:
+ aFrmSize = Size(nLFBorder - 4, (aTextLine.GetHeight() + 2) * 3);
+ break;
+
+ case RelOrientation::PAGE_RIGHT:
+ case RelOrientation::FRAME_RIGHT:
+ aFrmSize = Size(nRFBorder - 4, (aTextLine.GetHeight() + 2) * 3);
+ break;
+
+ default:
+ aFrmSize = Size(nLBorder - 3, (aTextLine.GetHeight() + 2) * 3);
+ break;
+ }
+ aFrmSize.Width() = Max(5L, aFrmSize.Width());
+ aFrmSize.Height() = Max(5L, aFrmSize.Height());
+ }
+ else
+ {
+ sal_uIntPtr nFreeWidth = aPagePrtArea.GetWidth() - GetTextWidth(C2S(DEMOTEXT));
+
+ aFrmSize = Size(nFreeWidth / 2, (aTextLine.GetHeight() + 2) * 3);
+ aDrawObj.SetSize(Size(Max(5L, (long)nFreeWidth / 3L), Max(5L, aFrmSize.Height() * 3L)));
+ aDrawObj.SetPos(Point(aParaPrtArea.Right() + 1, aParaPrtArea.Bottom() / 2));
+ aParaPrtArea.Right() = aDrawObj.Right();
+ }
+}
+
+void SvxSwFrameExample::CalcBoundRect_Impl(Rectangle &rRect)
+{
+ switch (nAnchor)
+ {
+ case TextContentAnchorType_AT_PAGE:
+ {
+ switch (nHRel)
+ {
+ case RelOrientation::FRAME:
+ case RelOrientation::PAGE_FRAME:
+ rRect.Left() = aPage.Left();
+ rRect.Right() = aPage.Right();
+ break;
+
+ case RelOrientation::PRINT_AREA:
+ case RelOrientation::PAGE_PRINT_AREA:
+ rRect.Left() = aPagePrtArea.Left();
+ rRect.Right() = aPagePrtArea.Right();
+ break;
+
+ case RelOrientation::PAGE_LEFT:
+ rRect.Left() = aPage.Left();
+ rRect.Right() = aPagePrtArea.Left();
+ break;
+
+ case RelOrientation::PAGE_RIGHT:
+ rRect.Left() = aPagePrtArea.Right();
+ rRect.Right() = aPage.Right();
+ break;
+ }
+
+ switch (nVRel)
+ {
+ case RelOrientation::PRINT_AREA:
+ case RelOrientation::PAGE_PRINT_AREA:
+ rRect.Top() = aPagePrtArea.Top();
+ rRect.Bottom() = aPagePrtArea.Bottom();
+ break;
+
+ case RelOrientation::FRAME:
+ case RelOrientation::PAGE_FRAME:
+ rRect.Top() = aPage.Top();
+ rRect.Bottom() = aPage.Bottom();
+ break;
+ }
+ }
+ break;
+
+ case TextContentAnchorType_AT_FRAME:
+ {
+ switch (nHRel)
+ {
+ case RelOrientation::FRAME:
+ case RelOrientation::PAGE_FRAME:
+ rRect.Left() = aFrameAtFrame.Left();
+ rRect.Right() = aFrameAtFrame.Right();
+ break;
+
+ case RelOrientation::PRINT_AREA:
+ case RelOrientation::PAGE_PRINT_AREA:
+ rRect.Left() = aFrameAtFrame.Left() + FLYINFLY_BORDER;
+ rRect.Right() = aFrameAtFrame.Right() - FLYINFLY_BORDER;
+ break;
+
+ case RelOrientation::PAGE_RIGHT:
+ rRect.Left() = aFrameAtFrame.Left();
+ rRect.Right() = aFrameAtFrame.Left() + FLYINFLY_BORDER;
+ break;
+
+ case RelOrientation::PAGE_LEFT:
+ rRect.Left() = aFrameAtFrame.Right();
+ rRect.Right() = aFrameAtFrame.Right() - FLYINFLY_BORDER;
+ break;
+ }
+
+ switch (nVRel)
+ {
+ case RelOrientation::FRAME:
+ case RelOrientation::PAGE_FRAME:
+ rRect.Top() = aFrameAtFrame.Top();
+ rRect.Bottom() = aFrameAtFrame.Bottom();
+ break;
+
+ case RelOrientation::PRINT_AREA:
+ case RelOrientation::PAGE_PRINT_AREA:
+ rRect.Top() = aFrameAtFrame.Top() + FLYINFLY_BORDER;
+ rRect.Bottom() = aFrameAtFrame.Bottom() - FLYINFLY_BORDER;
+ break;
+ }
+ }
+ break;
+ case TextContentAnchorType_AT_PARAGRAPH:
+ case TextContentAnchorType_AT_CHARACTER:
+ {
+ switch (nHRel)
+ {
+ case RelOrientation::FRAME:
+ rRect.Left() = aPara.Left();
+ rRect.Right() = aPara.Right();
+ break;
+
+ case RelOrientation::PRINT_AREA:
+ rRect.Left() = aParaPrtArea.Left();
+ rRect.Right() = aParaPrtArea.Right();
+ break;
+
+ case RelOrientation::PAGE_LEFT:
+ rRect.Left() = aPage.Left();
+ rRect.Right() = aPagePrtArea.Left();
+ break;
+
+ case RelOrientation::PAGE_RIGHT:
+ rRect.Left() = aPagePrtArea.Right();
+ rRect.Right() = aPage.Right();
+ break;
+
+ case RelOrientation::PAGE_FRAME:
+ rRect.Left() = aPage.Left();
+ rRect.Right() = aPage.Right();
+ break;
+
+ case RelOrientation::PAGE_PRINT_AREA:
+ rRect.Left() = aPagePrtArea.Left();
+ rRect.Right() = aPagePrtArea.Right();
+ break;
+
+ case RelOrientation::FRAME_LEFT:
+ rRect.Left() = aPara.Left();
+ rRect.Right() = aParaPrtArea.Left();
+ break;
+
+ case RelOrientation::FRAME_RIGHT:
+ rRect.Left() = aParaPrtArea.Right();
+ rRect.Right() = aPara.Right();
+ break;
+
+ case RelOrientation::CHAR:
+ rRect.Left() = aAutoCharFrame.Left();
+ rRect.Right() = aAutoCharFrame.Left();
+ break;
+ }
+
+ switch (nVRel)
+ {
+ case RelOrientation::FRAME:
+ rRect.Top() = aPara.Top();
+ rRect.Bottom() = aPara.Bottom();
+ break;
+
+ case RelOrientation::PRINT_AREA:
+ rRect.Top() = aParaPrtArea.Top();
+ rRect.Bottom() = aParaPrtArea.Bottom();
+ break;
+
+ case RelOrientation::CHAR:
+ if (nVAlign != VertOrientation::NONE &&
+ nVAlign != VertOrientation::CHAR_BOTTOM)
+ rRect.Top() = aAutoCharFrame.Top();
+ else
+ rRect.Top() = aAutoCharFrame.Bottom();
+ rRect.Bottom() = aAutoCharFrame.Bottom();
+ break;
+ // OD 12.11.2003 #i22341#
+ case RelOrientation::TEXT_LINE:
+ rRect.Top() = aAutoCharFrame.Top();
+ rRect.Bottom() = aAutoCharFrame.Top();
+ break;
+ }
+ }
+ break;
+
+ case TextContentAnchorType_AS_CHARACTER:
+ rRect.Left() = aParaPrtArea.Left();
+ rRect.Right() = aParaPrtArea.Right();
+
+ switch (nVAlign)
+ {
+ case VertOrientation::NONE:
+ case VertOrientation::TOP:
+ case VertOrientation::CENTER:
+ case VertOrientation::BOTTOM:
+ {
+ FontMetric aMetric(GetFontMetric());
+
+ rRect.Top() = aParaPrtArea.Bottom() - aMetric.GetDescent();
+ rRect.Bottom() = rRect.Top();
+ }
+ break;
+
+ default:
+
+ case VertOrientation::LINE_TOP:
+ case VertOrientation::LINE_CENTER:
+ case VertOrientation::LINE_BOTTOM:
+ rRect.Top() = aParaPrtArea.Top();
+ rRect.Bottom() = aDrawObj.Bottom();
+ break;
+
+ case VertOrientation::CHAR_TOP:
+ case VertOrientation::CHAR_CENTER:
+ case VertOrientation::CHAR_BOTTOM:
+ rRect.Top() = aParaPrtArea.Top();
+ rRect.Bottom() = aParaPrtArea.Bottom();
+ break;
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+Rectangle SvxSwFrameExample::DrawInnerFrame_Impl(const Rectangle &rRect, const Color &rFillColor, const Color &rBorderColor)
+{
+ DrawRect_Impl(rRect, rFillColor, rBorderColor);
+
+ // Bereich, zu dem relativ positioniert wird, bestimmen
+ Rectangle aRect(rRect); // aPagePrtArea = Default
+ CalcBoundRect_Impl(aRect);
+
+ if (nAnchor == TextContentAnchorType_AT_FRAME && &rRect == &aPagePrtArea)
+ {
+ // Testabsatz zeichnen
+ Rectangle aTxt(aTextLine);
+ sal_Int32 nStep = aTxt.GetHeight() + 2;
+ sal_uInt16 nLines = (sal_uInt16)(aParaPrtArea.GetHeight() / (aTextLine.GetHeight() + 2));
+
+ for (sal_uInt16 i = 0; i < nLines; i++)
+ {
+ if (i == nLines - 1)
+ aTxt.SetSize(Size(aTxt.GetWidth() / 2, aTxt.GetHeight()));
+ DrawRect_Impl(aTxt, m_aTxtCol, m_aTransColor);
+ aTxt.Move(0, nStep);
+ }
+ }
+
+ return aRect;
+}
+
+void SvxSwFrameExample::Paint(const Rectangle&)
+{
+ InitAllRects_Impl();
+
+ // Schatten zeichnen
+// Rectangle aShadow(aPage);
+// aShadow += Point(3, 3);
+// DrawRect_Impl(aShadow, Color(COL_GRAY), aTransColor);
+
+ // Seite zeichnen
+ DrawRect_Impl( aPage, m_aBgCol, m_aBorderCol );
+
+ // PrintArea zeichnen
+ Rectangle aRect = DrawInnerFrame_Impl( aPagePrtArea, m_aTransColor, m_aPrintAreaCol );
+
+ if (nAnchor == TextContentAnchorType_AT_FRAME)
+ aRect = DrawInnerFrame_Impl( aFrameAtFrame, m_aBgCol, m_aBorderCol );
+
+ long lXPos = 0;
+ long lYPos = 0;
+
+ // Horizontale Ausrichtung
+ //
+ if (nAnchor != TextContentAnchorType_AS_CHARACTER)
+ {
+ switch (nHAlign)
+ {
+ case HoriOrientation::RIGHT:
+ {
+ lXPos = aRect.Right() - aFrmSize.Width() + 1;
+ break;
+ }
+ case HoriOrientation::CENTER:
+ {
+ lXPos = aRect.Left() + (aRect.GetWidth() - aFrmSize.Width()) / 2;
+ break;
+ }
+ case HoriOrientation::NONE:
+ {
+ lXPos = aRect.Left() + aRelPos.X();
+ break;
+ }
+
+ default: // HoriOrientation::LEFT
+ lXPos = aRect.Left();
+ break;
+ }
+ }
+ else
+ lXPos = aRect.Right() + 2;
+
+ // Vertikale Ausrichtung
+ //
+ if (nAnchor != TextContentAnchorType_AS_CHARACTER)
+ {
+ switch (nVAlign)
+ {
+ case VertOrientation::BOTTOM:
+ case VertOrientation::LINE_BOTTOM:
+ {
+ // OD 12.11.2003 #i22341#
+ if ( nVRel != RelOrientation::TEXT_LINE )
+ {
+ lYPos = aRect.Bottom() - aFrmSize.Height() + 1;
+ }
+ else
+ {
+ lYPos = aRect.Top();
+ }
+ break;
+ }
+ case VertOrientation::CENTER:
+ case VertOrientation::LINE_CENTER:
+ {
+ lYPos = aRect.Top() + (aRect.GetHeight() - aFrmSize.Height()) / 2;
+ break;
+ }
+ case VertOrientation::NONE:
+ {
+ // OD 12.11.2003 #i22341#
+ if ( nVRel != RelOrientation::CHAR && nVRel != RelOrientation::TEXT_LINE )
+ lYPos = aRect.Top() + aRelPos.Y();
+ else
+ lYPos = aRect.Top() - aRelPos.Y();
+ break;
+ }
+ default:
+ // OD 12.11.2003 #i22341#
+ if ( nVRel != RelOrientation::TEXT_LINE )
+ {
+ lYPos = aRect.Top();
+ }
+ else
+ {
+ lYPos = aRect.Bottom() - aFrmSize.Height() + 1;
+ }
+ break;
+ }
+ }
+ else
+ {
+ switch(nVAlign)
+ {
+ case VertOrientation::CENTER:
+ case VertOrientation::CHAR_CENTER:
+ case VertOrientation::LINE_CENTER:
+ lYPos = aRect.Top() + (aRect.GetHeight() - aFrmSize.Height()) / 2;
+ break;
+
+ case VertOrientation::TOP:
+ case VertOrientation::CHAR_BOTTOM:
+ case VertOrientation::LINE_BOTTOM:
+ lYPos = aRect.Bottom() - aFrmSize.Height() + 1;
+ break;
+
+/* case VertOrientation::NONE:
+ case VertOrientation::BOTTOM:
+ case VertOrientation::CHAR_TOP:
+ case VertOrientation::LINE_TOP:*/
+ default:
+ lYPos = aRect.Top() - aRelPos.Y();
+ break;
+ }
+ }
+
+ Rectangle aFrmRect(Point(lXPos, lYPos), aFrmSize);
+
+ Rectangle *pOuterFrame = &aPage;
+
+ if (nAnchor == TextContentAnchorType_AT_FRAME)
+ pOuterFrame = &aFrameAtFrame;
+
+ if (aFrmRect.Left() < pOuterFrame->Left())
+ aFrmRect.Move(pOuterFrame->Left() - aFrmRect.Left(), 0);
+ if (aFrmRect.Right() > pOuterFrame->Right())
+ aFrmRect.Move(pOuterFrame->Right() - aFrmRect.Right(), 0);
+
+ if (aFrmRect.Top() < pOuterFrame->Top())
+ aFrmRect.Move(0, pOuterFrame->Top() - aFrmRect.Top());
+ if (aFrmRect.Bottom() > pOuterFrame->Bottom())
+ aFrmRect.Move(0, pOuterFrame->Bottom() - aFrmRect.Bottom());
+
+ // Testabsatz zeichnen
+ const long nTxtLineHeight = aTextLine.GetHeight();
+ Rectangle aTxt(aTextLine);
+ sal_Int32 nStep;
+ sal_uInt16 nLines;
+
+ if (nAnchor == TextContentAnchorType_AT_FRAME)
+ {
+ aTxt.Left() = aFrameAtFrame.Left() + FLYINFLY_BORDER;
+ aTxt.Right() = aFrameAtFrame.Right() - FLYINFLY_BORDER;
+ aTxt.Top() = aFrameAtFrame.Top() + FLYINFLY_BORDER;
+ aTxt.Bottom() = aTxt.Top() + aTextLine.GetHeight() - 1;
+
+ nStep = aTxt.GetHeight() + 2;
+ nLines = (sal_uInt16)(((aFrameAtFrame.GetHeight() - 2 * FLYINFLY_BORDER) * 2 / 3)
+ / (aTxt.GetHeight() + 2));
+ }
+ else
+ {
+ nStep = aTxt.GetHeight() + 2;
+ nLines = (sal_uInt16)(aParaPrtArea.GetHeight() / (aTextLine.GetHeight() + 2));
+ }
+
+ if (nAnchor != TextContentAnchorType_AS_CHARACTER)
+ {
+ // Text simulieren
+ //
+ const long nOldR = aTxt.Right();
+ const long nOldL = aTxt.Left();
+
+ // OD 12.11.2003 #i22341#
+ const bool bIgnoreWrap = nAnchor == TextContentAnchorType_AT_CHARACTER &&
+ ( nHRel == RelOrientation::CHAR || nVRel == RelOrientation::CHAR ||
+ nVRel == RelOrientation::TEXT_LINE );
+
+ for (sal_uInt16 i = 0; i < nLines; ++i)
+ {
+ if (i == (nLines - 1))
+ aTxt.SetSize(Size(aTxt.GetWidth() / 2, aTxt.GetHeight()));
+
+ if (aTxt.IsOver(aFrmRect) && nAnchor != TextContentAnchorType_AS_CHARACTER && !bIgnoreWrap)
+ {
+ switch(nWrap)
+ {
+ case WrapTextMode_NONE:
+ aTxt.Top() = aFrmRect.Bottom() + nTxtLineHeight;
+ aTxt.Bottom() = aTxt.Top() + nTxtLineHeight - 1;
+ break;
+
+ case WrapTextMode_LEFT:
+ aTxt.Right() = aFrmRect.Left();
+ break;
+
+ case WrapTextMode_RIGHT:
+ aTxt.Left() = aFrmRect.Right();
+ break;
+ }
+ }
+ if (pOuterFrame->IsInside(aTxt))
+ DrawRect_Impl( aTxt, m_aTxtCol, m_aTransColor );
+
+ aTxt.Move(0, nStep);
+ aTxt.Right() = nOldR;
+ aTxt.Left() = nOldL;
+ }
+ aTxt.Move(0, -nStep);
+
+ if (nAnchor != TextContentAnchorType_AT_FRAME && aTxt.Bottom() > aParaPrtArea.Bottom())
+ {
+ // Text wurde durch Rahmen verdraengt, daher Para-Hoehe anpassen
+ sal_uIntPtr nDiff = aTxt.Bottom() - aParaPrtArea.Bottom();
+ aParaPrtArea.Bottom() += nDiff;
+ aPara.Bottom() += nDiff;
+
+ CalcBoundRect_Impl(aRect);
+
+ aParaPrtArea.Bottom() -= nDiff;
+ aPara.Bottom() -= nDiff;
+ }
+ if (nAnchor == TextContentAnchorType_AT_CHARACTER && bIgnoreWrap)
+ DrawText(aAutoCharFrame, 'A');
+ }
+ else
+ {
+ DrawText(aParaPrtArea, C2S(DEMOTEXT));
+ DrawRect_Impl(aDrawObj, m_aBlankCol, m_aBlankFrameCol );
+ }
+
+ // Rechteck zeichnen, zu dem der Rahmen ausgerichtet wird:
+ DrawRect_Impl(aRect, m_aTransColor, m_aAlignColor);
+
+ // Frame anzeigen
+ sal_Bool bDontFill = (nAnchor == TextContentAnchorType_AT_CHARACTER && aFrmRect.IsOver(aAutoCharFrame)) ? sal_True : bTrans;
+ DrawRect_Impl( aFrmRect, bDontFill? m_aTransColor : m_aBgCol, m_aFrameColor );
+}
+
+void SvxSwFrameExample::SetRelPos(const Point& rP)
+{
+ aRelPos = rP;
+
+ if (aRelPos.X() > 0)
+ aRelPos.X() = 5;
+ if (aRelPos.X() < 0)
+ aRelPos.X() = -5;
+
+ if (aRelPos.Y() > 0)
+ aRelPos.Y() = 5;
+ if (aRelPos.Y() < 0)
+ aRelPos.Y() = -5;
+}
+
+void SvxSwFrameExample::DrawRect_Impl(const Rectangle &rRect, const Color &rFillColor, const Color &rLineColor)
+{
+ SetFillColor(rFillColor);
+ SetLineColor(rLineColor);
+ Window::DrawRect(rRect);
+}
+
+
+
diff --git a/svx/source/dialog/swframeposstrings.cxx b/svx/source/dialog/swframeposstrings.cxx
new file mode 100644
index 000000000000..5da8843489be
--- /dev/null
+++ b/svx/source/dialog/swframeposstrings.cxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/swframeposstrings.hxx>
+#include <tools/rc.hxx>
+#include <tools/debug.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+
+class SvxSwFramePosString_Impl : public Resource
+{
+ friend class SvxSwFramePosString;
+ String aStrings[SvxSwFramePosString::STR_MAX];
+public:
+ SvxSwFramePosString_Impl();
+};
+SvxSwFramePosString_Impl::SvxSwFramePosString_Impl() :
+ Resource(SVX_RES(RID_SVXSW_FRAMEPOSITIONS))
+{
+ for(sal_uInt16 i = 0; i < SvxSwFramePosString::STR_MAX; i++)
+ {
+ //string ids have to start at 1
+ aStrings[i] = String(SVX_RES(i + 1));
+ }
+ FreeResource();
+}
+/*-- 04.03.2004 13:14:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SvxSwFramePosString::SvxSwFramePosString() :
+ pImpl(new SvxSwFramePosString_Impl)
+{
+}
+/*-- 04.03.2004 13:14:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SvxSwFramePosString::~SvxSwFramePosString()
+{
+ delete pImpl;
+}
+/*-- 04.03.2004 13:14:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const String& SvxSwFramePosString::GetString(StringId eId)
+{
+ DBG_ASSERT(eId >= 0 && eId < STR_MAX, "invalid StringId");
+ if(!(eId >= 0 && eId < STR_MAX))
+ eId = LEFT;
+ return pImpl->aStrings[eId];
+}
diff --git a/svx/source/dialog/swframeposstrings.src b/svx/source/dialog/swframeposstrings.src
new file mode 100644
index 000000000000..c6a164630c5e
--- /dev/null
+++ b/svx/source/dialog/swframeposstrings.src
@@ -0,0 +1,245 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <svx/dialogs.hrc>
+
+//the following defines have to match the (enum values + 1) in svx/swframeposstrings.hxx!
+#define STR_LEFT 1
+#define STR_RIGHT 2
+#define STR_FROMLEFT 3
+#define STR_MIR_LEFT 4
+#define STR_MIR_RIGHT 5
+#define STR_MIR_FROMLEFT 6
+#define STR_FRAME 7
+#define STR_PRTAREA 8
+#define STR_REL_PG_LEFT 9
+#define STR_REL_PG_RIGHT 10
+#define STR_REL_FRM_LEFT 11
+#define STR_REL_FRM_RIGHT 12
+#define STR_MIR_REL_PG_LEFT 13
+#define STR_MIR_REL_PG_RIGHT 14
+#define STR_MIR_REL_FRM_LEFT 15
+#define STR_MIR_REL_FRM_RIGHT 16
+#define STR_REL_PG_FRAME 17
+#define STR_REL_PG_PRTAREA 18
+#define STR_REL_BASE 19
+#define STR_REL_CHAR 20
+#define STR_REL_ROW 21
+#define STR_REL_BORDER 22
+#define STR_REL_PRTAREA 23
+#define STR_FLY_REL_PG_LEFT 24
+#define STR_FLY_REL_PG_RIGHT 25
+#define STR_FLY_REL_PG_FRAME 26
+#define STR_FLY_REL_PG_PRTAREA 27
+#define STR_FLY_MIR_REL_PG_LEFT 28
+#define STR_FLY_MIR_REL_PG_RIGHT 29
+#define STR_TOP 30
+#define STR_BOTTOM 31
+#define STR_CENTER_HORI 32
+#define STR_CENTER_VERT 33
+#define STR_FROMTOP 34
+#define STR_FROMBOTTOM 35
+#define STR_BELOW 36
+#define STR_FROMRIGHT 37
+#define STR_REL_PG_TOP 38
+#define STR_REL_PG_BOTTOM 39
+#define STR_REL_FRM_TOP 40
+#define STR_REL_FRM_BOTTOM 41
+#define STR_REL_LINE 42
+
+Resource RID_SVXSW_FRAMEPOSITIONS
+{
+ String STR_LEFT
+ {
+ Text [ en-US ] = "Left" ;
+ };
+ String STR_MIR_LEFT
+ {
+ Text [ en-US ] = "Inside" ;
+ };
+ String STR_RIGHT
+ {
+ Text [ en-US ] = "Right" ;
+ };
+ String STR_MIR_RIGHT
+ {
+ Text [ en-US ] = "Outside" ;
+ };
+ String STR_CENTER_VERT
+ {
+ Text [ en-US ] = "Center" ;
+ };
+ String STR_FROMLEFT
+ {
+ Text [ en-US ] = "From left" ;
+ };
+ String STR_MIR_FROMLEFT
+ {
+ Text [ en-US ] = "From inside" ;
+ };
+ String STR_FRAME
+ {
+ Text [ en-US ] = "Paragraph area" ;
+ };
+ String STR_PRTAREA
+ {
+ Text [ en-US ] = "Paragraph text area" ;
+ };
+ String STR_REL_PG_LEFT
+ {
+ Text [ en-US ] = "Left page border" ;
+ };
+ String STR_MIR_REL_PG_LEFT
+ {
+ Text [ en-US ] = "Inner page border" ;
+ };
+ String STR_REL_PG_RIGHT
+ {
+ Text [ en-US ] = "Right page border" ;
+ };
+ String STR_MIR_REL_PG_RIGHT
+ {
+ Text [ en-US ] = "Outer page border" ;
+ };
+ String STR_REL_FRM_LEFT
+ {
+ Text [ en-US ] = "Left paragraph border" ;
+ };
+ String STR_MIR_REL_FRM_LEFT
+ {
+ Text [ en-US ] = "Inner paragraph border" ;
+ };
+ String STR_REL_FRM_RIGHT
+ {
+ Text [ en-US ] = "Right paragraph border" ;
+ };
+ String STR_MIR_REL_FRM_RIGHT
+ {
+ Text [ en-US ] = "Outer paragraph border" ;
+ };
+ String STR_REL_PG_FRAME
+ {
+ Text [ en-US ] = "Entire page" ;
+ };
+ String STR_REL_PG_PRTAREA
+ {
+ Text [ en-US ] = "Page text area" ;
+ };
+ String STR_TOP
+ {
+ Text [ en-US ] = "Top" ;
+ };
+ String STR_BOTTOM
+ {
+ Text [ en-US ] = "Bottom" ;
+ };
+ String STR_CENTER_HORI
+ {
+ Text [ en-US ] = "Center" ;
+ };
+ String STR_FROMTOP
+ {
+ Text [ en-US ] = "From top" ;
+ };
+ String STR_FROMBOTTOM
+ {
+ Text [ en-US ] = "From bottom" ;
+ };
+ String STR_BELOW
+ {
+ Text [ en-US ] = "Below" ;
+ };
+ String STR_FROMRIGHT
+ {
+ Text [ en-US ] = "From right" ;
+ };
+ String STR_REL_PG_TOP
+ {
+ Text [ en-US ] = "Top page border" ;
+ };
+ String STR_REL_PG_BOTTOM
+ {
+ Text [ en-US ] = "Bottom page border" ;
+ };
+ String STR_REL_FRM_TOP
+ {
+ Text [ en-US ] = "Top paragraph border" ;
+ };
+ String STR_REL_FRM_BOTTOM
+ {
+ Text [ en-US ] = "Bottom paragraph border" ;
+ };
+ String STR_REL_BORDER
+ {
+ Text [ en-US ] = "Margin" ;
+ };
+ String STR_REL_PRTAREA
+ {
+ Text [ en-US ] = "Paragraph text area" ;
+ };
+ String STR_FLY_REL_PG_LEFT
+ {
+ Text [ en-US ] = "Left frame border" ;
+ };
+ String STR_FLY_MIR_REL_PG_LEFT
+ {
+ Text [ en-US ] = "Inner frame border" ;
+ };
+ String STR_FLY_REL_PG_RIGHT
+ {
+ Text [ en-US ] = "Right frame border" ;
+ };
+ String STR_FLY_MIR_REL_PG_RIGHT
+ {
+ Text [ en-US ] = "Outer frame border" ;
+ };
+ String STR_FLY_REL_PG_FRAME
+ {
+ Text [ en-US ] = "Entire frame" ;
+ };
+ String STR_FLY_REL_PG_PRTAREA
+ {
+ Text [ en-US ] = "Frame text area" ;
+ };
+ String STR_REL_BASE
+ {
+ Text [ en-US ] = "Base line" ;
+ };
+ String STR_REL_CHAR
+ {
+ Text [ en-US ] = "Character" ;
+ };
+ String STR_REL_ROW
+ {
+ Text [ en-US ] = "Row" ;
+ };
+ // OD 05.01.2004 #i22341#
+ String STR_REL_LINE
+ {
+ Text [ en-US ] = "Line of text" ;
+ };
+};
+
diff --git a/svx/source/dialog/txencbox.cxx b/svx/source/dialog/txencbox.cxx
new file mode 100644
index 000000000000..132ca585a87f
--- /dev/null
+++ b/svx/source/dialog/txencbox.cxx
@@ -0,0 +1,254 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svx/txencbox.hxx"
+#include "svx/txenctab.hxx"
+#include <svx/dialogs.hrc>
+#include "svx/dbcharsethelper.hxx"
+#include <vcl/svapp.hxx>
+#include <rtl/tencinfo.h>
+#include <rtl/locale.h>
+#include <osl/nlsupport.h>
+
+//========================================================================
+// class SvxTextEncodingBox
+//========================================================================
+
+SvxTextEncodingBox::SvxTextEncodingBox( Window* pParent, const ResId& rResId )
+ :
+ ListBox( pParent, rResId )
+{
+ m_pEncTable = new SvxTextEncodingTable;
+}
+
+//------------------------------------------------------------------------
+
+SvxTextEncodingBox::~SvxTextEncodingBox()
+{
+ delete m_pEncTable;
+}
+
+//------------------------------------------------------------------------
+
+sal_uInt16 SvxTextEncodingBox::EncodingToPos_Impl( rtl_TextEncoding nEnc ) const
+{
+ sal_uInt16 nCount = GetEntryCount();
+ for ( sal_uInt16 i=0; i<nCount; i++ )
+ {
+ if ( nEnc == rtl_TextEncoding( (sal_uIntPtr)GetEntryData(i) ) )
+ return i;
+ }
+ return LISTBOX_ENTRY_NOTFOUND;
+}
+
+//------------------------------------------------------------------------
+
+void SvxTextEncodingBox::FillFromTextEncodingTable(
+ sal_Bool bExcludeImportSubsets, sal_uInt32 nExcludeInfoFlags,
+ sal_uInt32 nButIncludeInfoFlags )
+{
+ rtl_TextEncodingInfo aInfo;
+ aInfo.StructSize = sizeof(rtl_TextEncodingInfo);
+ sal_uInt32 nCount = m_pEncTable->Count();
+ for ( sal_uInt32 j=0; j<nCount; j++ )
+ {
+ sal_Bool bInsert = sal_True;
+ rtl_TextEncoding nEnc = rtl_TextEncoding( m_pEncTable->GetValue( j ) );
+ if ( nExcludeInfoFlags )
+ {
+ if ( !rtl_getTextEncodingInfo( nEnc, &aInfo ) )
+ bInsert = sal_False;
+ else
+ {
+ if ( (aInfo.Flags & nExcludeInfoFlags) == 0 )
+ {
+ if ( (nExcludeInfoFlags & RTL_TEXTENCODING_INFO_UNICODE) &&
+ ((nEnc == RTL_TEXTENCODING_UCS2) ||
+ nEnc == RTL_TEXTENCODING_UCS4) )
+ bInsert = sal_False; // InfoFlags don't work for Unicode :-(
+ }
+ else if ( (aInfo.Flags & nButIncludeInfoFlags) == 0 )
+ bInsert = sal_False;
+ }
+ }
+ if ( bInsert )
+ {
+ if ( bExcludeImportSubsets )
+ {
+ switch ( nEnc )
+ {
+ // subsets of RTL_TEXTENCODING_GB_18030
+ case RTL_TEXTENCODING_GB_2312 :
+ case RTL_TEXTENCODING_GBK :
+ case RTL_TEXTENCODING_MS_936 :
+ bInsert = sal_False;
+ break;
+ }
+ }
+ if ( bInsert )
+ InsertTextEncoding( nEnc, m_pEncTable->GetString( j ) );
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+
+void SvxTextEncodingBox::FillFromDbTextEncodingMap(
+ sal_Bool bExcludeImportSubsets, sal_uInt32 nExcludeInfoFlags,
+ sal_uInt32 nButIncludeInfoFlags )
+{
+ rtl_TextEncodingInfo aInfo;
+ aInfo.StructSize = sizeof(rtl_TextEncodingInfo);
+ svxform::ODataAccessCharsetHelper aCSH;
+ ::std::vector< rtl_TextEncoding > aEncs;
+ sal_Int32 nCount = aCSH.getSupportedTextEncodings( aEncs );
+ for ( sal_uInt16 j=0; j<nCount; j++ )
+ {
+ sal_Bool bInsert = sal_True;
+ rtl_TextEncoding nEnc = rtl_TextEncoding( aEncs[j] );
+ if ( nExcludeInfoFlags )
+ {
+ if ( !rtl_getTextEncodingInfo( nEnc, &aInfo ) )
+ bInsert = sal_False;
+ else
+ {
+ if ( (aInfo.Flags & nExcludeInfoFlags) == 0 )
+ {
+ if ( (nExcludeInfoFlags & RTL_TEXTENCODING_INFO_UNICODE) &&
+ ((nEnc == RTL_TEXTENCODING_UCS2) ||
+ nEnc == RTL_TEXTENCODING_UCS4) )
+ bInsert = sal_False; // InfoFlags don't work for Unicode :-(
+ }
+ else if ( (aInfo.Flags & nButIncludeInfoFlags) == 0 )
+ bInsert = sal_False;
+ }
+ }
+ if ( bInsert )
+ {
+ if ( bExcludeImportSubsets )
+ {
+ switch ( nEnc )
+ {
+ // subsets of RTL_TEXTENCODING_GB_18030
+ case RTL_TEXTENCODING_GB_2312 :
+ case RTL_TEXTENCODING_GBK :
+ case RTL_TEXTENCODING_MS_936 :
+ bInsert = sal_False;
+ break;
+ }
+ }
+ // CharsetMap offers a RTL_TEXTENCODING_DONTKNOW for internal use,
+ // makes no sense here and would result in an empty string as list
+ // entry.
+ if ( bInsert && nEnc != RTL_TEXTENCODING_DONTKNOW )
+ InsertTextEncoding( nEnc );
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+
+void SvxTextEncodingBox::FillWithMimeAndSelectBest()
+{
+ FillFromTextEncodingTable( sal_False, 0xffffffff, RTL_TEXTENCODING_INFO_MIME );
+ rtl_TextEncoding nEnc = SvtSysLocale::GetBestMimeEncoding();
+ SelectTextEncoding( nEnc );
+}
+
+//------------------------------------------------------------------------
+
+void SvxTextEncodingBox::InsertTextEncoding( const rtl_TextEncoding nEnc,
+ const String& rEntry, sal_uInt16 nPos )
+{
+ sal_uInt16 nAt = InsertEntry( rEntry, nPos );
+ SetEntryData( nAt, (void*)(sal_uIntPtr)nEnc );
+}
+
+//------------------------------------------------------------------------
+
+void SvxTextEncodingBox::InsertTextEncoding( const rtl_TextEncoding nEnc, sal_uInt16 nPos )
+{
+ const String& rEntry = m_pEncTable->GetTextString( nEnc );
+ if ( rEntry.Len() )
+ InsertTextEncoding( nEnc, rEntry, nPos );
+ else
+ {
+#ifdef DBG_UTIL
+ ByteString aMsg( "SvxTextEncodingBox::InsertTextEncoding: no resource string for text encoding: " );
+ aMsg += ByteString::CreateFromInt32( nEnc );
+ DBG_ERRORFILE( aMsg.GetBuffer() );
+#endif
+ }
+}
+
+//------------------------------------------------------------------------
+
+void SvxTextEncodingBox::RemoveTextEncoding( const rtl_TextEncoding nEnc )
+{
+ sal_uInt16 nAt = EncodingToPos_Impl( nEnc );
+
+ if ( nAt != LISTBOX_ENTRY_NOTFOUND )
+ RemoveEntry( nAt );
+}
+
+//------------------------------------------------------------------------
+
+rtl_TextEncoding SvxTextEncodingBox::GetSelectTextEncoding() const
+{
+ sal_uInt16 nPos = GetSelectEntryPos();
+
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ return rtl_TextEncoding( (sal_uIntPtr)GetEntryData(nPos) );
+ else
+ return RTL_TEXTENCODING_DONTKNOW;
+}
+
+//------------------------------------------------------------------------
+
+void SvxTextEncodingBox::SelectTextEncoding( const rtl_TextEncoding nEnc, sal_Bool bSelect )
+{
+ sal_uInt16 nAt = EncodingToPos_Impl( nEnc );
+
+ if ( nAt != LISTBOX_ENTRY_NOTFOUND )
+ SelectEntryPos( nAt, bSelect );
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool SvxTextEncodingBox::IsTextEncodingSelected( const rtl_TextEncoding nEnc ) const
+{
+ sal_uInt16 nAt = EncodingToPos_Impl( nEnc );
+
+ if ( nAt != LISTBOX_ENTRY_NOTFOUND )
+ return IsEntryPosSelected( nAt );
+ else
+ return sal_False;
+}
+
diff --git a/svx/source/dialog/txenctab.cxx b/svx/source/dialog/txenctab.cxx
new file mode 100644
index 000000000000..74b60a08d2bd
--- /dev/null
+++ b/svx/source/dialog/txenctab.cxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/dialogs.hrc> // -> RID_SVXSTR_TEXTENCODING_TABLE
+#include <svx/dialmgr.hxx>
+#include "svx/txenctab.hxx"
+#include <tools/shl.hxx>
+
+//------------------------------------------------------------------------
+
+SvxTextEncodingTable::SvxTextEncodingTable()
+ :
+ ResStringArray( SVX_RES( RID_SVXSTR_TEXTENCODING_TABLE ) )
+{
+}
+
+//------------------------------------------------------------------------
+
+SvxTextEncodingTable::~SvxTextEncodingTable()
+{
+}
+
+//------------------------------------------------------------------------
+
+const String& SvxTextEncodingTable::GetTextString( const rtl_TextEncoding nEnc ) const
+{
+ sal_uInt32 nPos = FindIndex( (long)nEnc );
+
+ if ( RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count() )
+ return ResStringArray::GetString( nPos );
+
+ static String aEmptyString;
+ return aEmptyString;
+}
+
+//------------------------------------------------------------------------
+
+rtl_TextEncoding SvxTextEncodingTable::GetTextEncoding( const String& rStr ) const
+{
+ sal_uInt32 nCount = Count();
+
+ for ( sal_uInt32 i = 0; i < nCount; ++i )
+ {
+ if ( rStr == ResStringArray::GetString( i ) )
+ return rtl_TextEncoding( GetValue( i ) );
+ }
+ return RTL_TEXTENCODING_DONTKNOW;
+}
+
diff --git a/svx/source/dialog/txenctab.src b/svx/source/dialog/txenctab.src
new file mode 100644
index 000000000000..b90b5fb9a94c
--- /dev/null
+++ b/svx/source/dialog/txenctab.src
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+ // include ---------------------------------------------------------------
+
+#include <svx/dialogs.hrc>
+
+#define _SOLAR_RSC_INVOKED
+#include <rtl/textenc.h>
+#define PairedList ItemList
+// Encodings for which no conversion exist yet are commented out.
+
+ // RID_SVXSTR_TEXTENCODING_TABLE ----------------------------------------------------
+StringArray RID_SVXSTR_TEXTENCODING_TABLE
+{
+ PairedList [ en-US ] =
+ {
+ < "Western Europe (Windows-1252/WinLatin 1)" ; RTL_TEXTENCODING_MS_1252 ; > ;
+ < "Western Europe (Apple Macintosh)" ; RTL_TEXTENCODING_APPLE_ROMAN ; > ;
+ < "Western Europe (DOS/OS2-850/International)" ; RTL_TEXTENCODING_IBM_850 ; > ;
+ < "Western Europe (DOS/OS2-437/US)" ; RTL_TEXTENCODING_IBM_437 ; > ;
+ < "Western Europe (DOS/OS2-860/Portuguese)" ; RTL_TEXTENCODING_IBM_860 ; > ;
+ < "Western Europe (DOS/OS2-861/Icelandic)" ; RTL_TEXTENCODING_IBM_861 ; > ;
+ < "Western Europe (DOS/OS2-863/French (Can.))" ; RTL_TEXTENCODING_IBM_863 ; > ;
+ < "Western Europe (DOS/OS2-865/Nordic)" ; RTL_TEXTENCODING_IBM_865 ; > ;
+ < "Western Europe (ASCII/US)" ; RTL_TEXTENCODING_ASCII_US ; > ;
+ < "Western Europe (ISO-8859-1)" ; RTL_TEXTENCODING_ISO_8859_1 ; > ;
+ < "Eastern Europe (ISO-8859-2)" ; RTL_TEXTENCODING_ISO_8859_2 ; > ;
+ < "Latin 3 (ISO-8859-3)" ; RTL_TEXTENCODING_ISO_8859_3 ; > ;
+ < "Baltic (ISO-8859-4)" ; RTL_TEXTENCODING_ISO_8859_4 ; > ;
+ < "Cyrillic (ISO-8859-5)" ; RTL_TEXTENCODING_ISO_8859_5 ; > ;
+ < "Arabic (ISO-8859-6)" ; RTL_TEXTENCODING_ISO_8859_6 ; > ;
+ < "Greek (ISO-8859-7)" ; RTL_TEXTENCODING_ISO_8859_7 ; > ;
+ < "Hebrew (ISO-8859-8)" ; RTL_TEXTENCODING_ISO_8859_8 ; > ;
+ < "Turkish (ISO-8859-9)" ; RTL_TEXTENCODING_ISO_8859_9 ; > ;
+ < "Western Europe (ISO-8859-14)" ; RTL_TEXTENCODING_ISO_8859_14 ; > ;
+ < "Western Europe (ISO-8859-15/EURO)" ; RTL_TEXTENCODING_ISO_8859_15 ; > ;
+ < "Greek (DOS/OS2-737)" ; RTL_TEXTENCODING_IBM_737 ; > ;
+ < "Baltic (DOS/OS2-775)" ; RTL_TEXTENCODING_IBM_775 ; > ;
+ < "Eastern Europe (DOS/OS2-852)" ; RTL_TEXTENCODING_IBM_852 ; > ;
+ < "Cyrillic (DOS/OS2-855)" ; RTL_TEXTENCODING_IBM_855 ; > ;
+ < "Turkish (DOS/OS2-857)" ; RTL_TEXTENCODING_IBM_857 ; > ;
+ < "Hebrew (DOS/OS2-862)" ; RTL_TEXTENCODING_IBM_862 ; > ;
+ < "Arabic (DOS/OS2-864)" ; RTL_TEXTENCODING_IBM_864 ; > ;
+ < "Cyrillic (DOS/OS2-866/Russian)" ; RTL_TEXTENCODING_IBM_866 ; > ;
+ < "Greek (DOS/OS2-869/Modern)" ; RTL_TEXTENCODING_IBM_869 ; > ;
+ < "Eastern Europe (Windows-1250/WinLatin 2)" ; RTL_TEXTENCODING_MS_1250 ; > ;
+ < "Cyrillic (Windows-1251)" ; RTL_TEXTENCODING_MS_1251 ; > ;
+ < "Greek (Windows-1253)" ; RTL_TEXTENCODING_MS_1253 ; > ;
+ < "Turkish (Windows-1254)" ; RTL_TEXTENCODING_MS_1254 ; > ;
+ < "Hebrew (Windows-1255)" ; RTL_TEXTENCODING_MS_1255 ; > ;
+ < "Arabic (Windows-1256)" ; RTL_TEXTENCODING_MS_1256 ; > ;
+ < "Baltic (Windows-1257)" ; RTL_TEXTENCODING_MS_1257 ; > ;
+ < "Eastern Europe (Apple Macintosh)" ; RTL_TEXTENCODING_APPLE_CENTEURO ; > ;
+ < "Eastern Europe (Apple Macintosh/Croatian)" ; RTL_TEXTENCODING_APPLE_CROATIAN ; > ;
+ < "Cyrillic (Apple Macintosh)" ; RTL_TEXTENCODING_APPLE_CYRILLIC ; > ;
+ < "Greek (Apple Macintosh)" ; RTL_TEXTENCODING_APPLE_GREEK ; > ;
+ < "Western Europe (Apple Macintosh/Icelandic)" ; RTL_TEXTENCODING_APPLE_ICELAND ; > ;
+ < "Eastern Europe (Apple Macintosh/Rumanian)" ; RTL_TEXTENCODING_APPLE_ROMANIAN ; > ;
+ < "Turkish (Apple Macintosh)" ; RTL_TEXTENCODING_APPLE_TURKISH ; > ;
+ < "Cyrillic (Apple Macintosh/Ukrainian)" ; RTL_TEXTENCODING_APPLE_UKRAINIAN ; > ;
+ < "Chinese simplified (Apple Macintosh)" ; RTL_TEXTENCODING_APPLE_CHINSIMP ; > ;
+ < "Chinese traditional (Apple Macintosh)" ; RTL_TEXTENCODING_APPLE_CHINTRAD ; > ;
+ < "Japanese (Apple Macintosh)" ; RTL_TEXTENCODING_APPLE_JAPANESE ; > ;
+ < "Korean (Apple Macintosh)" ; RTL_TEXTENCODING_APPLE_KOREAN ; > ;
+ < "Japanese (Windows-932)" ; RTL_TEXTENCODING_MS_932 ; > ;
+ < "Chinese simplified (Windows-936)" ; RTL_TEXTENCODING_MS_936 ; > ;
+ < "Korean (Windows-949)" ; RTL_TEXTENCODING_MS_949 ; > ;
+ < "Chinese traditional (Windows-950)" ; RTL_TEXTENCODING_MS_950 ; > ;
+ < "Japanese (Shift-JIS)" ; RTL_TEXTENCODING_SHIFT_JIS ; > ;
+ < "Chinese simplified (GB-2312)" ; RTL_TEXTENCODING_GB_2312 ; > ;
+ < "Chinese simplified (GB-18030)" ; RTL_TEXTENCODING_GB_18030 ; > ;
+ < "Chinese traditional (GBT-12345)" ; RTL_TEXTENCODING_GBT_12345 ; > ;
+ < "Chinese simplified (GBK/GB-2312-80)" ; RTL_TEXTENCODING_GBK ; > ;
+ < "Chinese traditional (Big5)" ; RTL_TEXTENCODING_BIG5 ; > ;
+ < "Chinese traditional (BIG5-HKSCS)" ; RTL_TEXTENCODING_BIG5_HKSCS ; > ;
+ < "Japanese (EUC-JP)" ; RTL_TEXTENCODING_EUC_JP ; > ;
+ < "Chinese simplified (EUC-CN)" ; RTL_TEXTENCODING_EUC_CN ; > ;
+ < "Chinese traditional (EUC-TW)" ; RTL_TEXTENCODING_EUC_TW ; > ;
+ < "Japanese (ISO-2022-JP)" ; RTL_TEXTENCODING_ISO_2022_JP ; > ;
+ < "Chinese simplified (ISO-2022-CN)" ; RTL_TEXTENCODING_ISO_2022_CN ; > ;
+ < "Cyrillic (KOI8-R)" ; RTL_TEXTENCODING_KOI8_R ; > ;
+ < "Unicode (UTF-7)" ; RTL_TEXTENCODING_UTF7 ; > ;
+ < "Unicode (UTF-8)" ; RTL_TEXTENCODING_UTF8 ; > ;
+ < "Eastern Europe (ISO-8859-10)" ; RTL_TEXTENCODING_ISO_8859_10 ; > ;
+ < "Eastern Europe (ISO-8859-13)" ; RTL_TEXTENCODING_ISO_8859_13 ; > ;
+ < "Korean (EUC-KR)" ; RTL_TEXTENCODING_EUC_KR ; > ;
+ < "Korean (ISO-2022-KR)" ; RTL_TEXTENCODING_ISO_2022_KR ; > ;
+ < "Korean (Windows-Johab-1361)" ; RTL_TEXTENCODING_MS_1361 ; > ;
+ < "Unicode" ; RTL_TEXTENCODING_UCS2 ; > ;
+ < "Thai (ISO-8859-11/TIS-620)" ; RTL_TEXTENCODING_TIS_620 ; > ;
+ < "Thai (Windows-874)" ; RTL_TEXTENCODING_MS_874 ; > ;
+ < "Cyrillic (KOI8-U)" ; RTL_TEXTENCODING_KOI8_U ; > ;
+ < "Cyrillic (PT154)" ; RTL_TEXTENCODING_PT154 ; > ;
+ };
+};
+ // ********************************************************************** EOF
+
diff --git a/svx/source/dialog/ucsubset.src b/svx/source/dialog/ucsubset.src
new file mode 100755
index 000000000000..2a47777469ea
--- /dev/null
+++ b/svx/source/dialog/ucsubset.src
@@ -0,0 +1,511 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+ // include ---------------------------------------------------------------
+#include <svx/ucsubset.hrc>
+
+/*
+ * strings for unicode range descriptions (used e.g. by charmap)
+ * (see the Unicode Standard & TrueType::OS2.ulUnicodeRange description)
+ */
+
+Resource RID_SUBSETMAP
+{
+String RID_SUBSETSTR_BASIC_LATIN
+{
+ Text [ en-US ] = "Basic Latin";
+ };
+String RID_SUBSETSTR_LATIN_1
+{
+ Text [ en-US ] = "Latin-1";
+ };
+String RID_SUBSETSTR_LATIN_EXTENDED_A
+{
+ Text [ en-US ] = "Latin Extended-A";
+ };
+String RID_SUBSETSTR_LATIN_EXTENDED_B
+{
+ Text [ en-US ] = "Latin Extended-B";
+ };
+String RID_SUBSETSTR_IPA_EXTENSIONS
+{
+ Text [ en-US ] = "IPA Extensions";
+ };
+String RID_SUBSETSTR_SPACING_MODIFIERS
+{
+ Text [ en-US ] = "Spacing Modifier Letters";
+ };
+String RID_SUBSETSTR_COMB_DIACRITICAL
+{
+ Text [ en-US ] = "Combining Diacritical Marks";
+ };
+String RID_SUBSETSTR_BASIC_GREEK
+{
+ Text [ en-US ] = "Basic Greek";
+ };
+String RID_SUBSETSTR_GREEK_SYMS_COPTIC
+{
+ Text [ en-US ] = "Greek Symbols And Coptic";
+ };
+String RID_SUBSETSTR_CYRILLIC
+{
+ Text [ en-US ] = "Cyrillic";
+ };
+String RID_SUBSETSTR_CYRILLIC_SUPPL
+{
+ Text [ en-US ] = "Cyrillic Supplementary";
+ };
+String RID_SUBSETSTR_ARMENIAN
+{
+ Text [ en-US ] = "Armenian";
+ };
+String RID_SUBSETSTR_BASIC_HEBREW
+{
+ Text [ en-US ] = "Basic Hebrew";
+ };
+String RID_SUBSETSTR_HEBREW_EXTENDED
+{
+ Text [ en-US ] = "Hebrew Extended";
+ };
+String RID_SUBSETSTR_BASIC_ARABIC
+{
+ Text [ en-US ] = "Basic Arabic";
+ };
+String RID_SUBSETSTR_ARABIC_EXTENDED
+{
+ Text [ en-US ] = "Arabic Extended";
+
+ };
+String RID_SUBSETSTR_DEVANAGARI
+{
+ Text [ en-US ] = "Devanagari";
+ };
+String RID_SUBSETSTR_BENGALI
+{
+ Text [ en-US ] = "Bengali";
+ };
+String RID_SUBSETSTR_GURMUKHI
+{
+ Text [ en-US ] = "Gurmukhi";
+ };
+String RID_SUBSETSTR_GUJARATI
+{
+ Text [ en-US ] = "Gujarati";
+ };
+String RID_SUBSETSTR_ORIYA
+{
+ Text [ en-US ] = "Oriya";
+ };
+String RID_SUBSETSTR_TAMIL
+{
+ Text [ en-US ] = "Tamil";
+ };
+String RID_SUBSETSTR_TELUGU
+{
+ Text [ en-US ] = "Telugu";
+
+ };
+String RID_SUBSETSTR_KANNADA
+{
+ Text [ en-US ] = "Kannada";
+ };
+String RID_SUBSETSTR_MALAYALAM
+{
+ Text [ en-US ] = "Malayalam";
+ };
+String RID_SUBSETSTR_THAI
+{
+ Text [ en-US ] = "Thai";
+ };
+String RID_SUBSETSTR_LAO
+{
+ Text [ en-US ] = "Lao";
+ };
+String RID_SUBSETSTR_BASIC_GEORGIAN
+{
+ Text [ en-US ] = "Basic Georgian";
+ };
+String RID_SUBSETSTR_GEORGIAN_EXTENDED
+{
+ Text [ en-US ] = "Georgian Extended";
+ };
+String RID_SUBSETSTR_HANGUL_JAMO
+{
+ Text [ en-US ] = "Hangul Jamo";
+ };
+String RID_SUBSETSTR_LATIN_EXTENDED_ADDS
+{
+ Text [ en-US ] = "Latin Extended Additionals";
+ };
+String RID_SUBSETSTR_GREEK_EXTENDED
+{
+ Text [ en-US ] = "Greek Extended";
+ };
+String RID_SUBSETSTR_GENERAL_PUNCTUATION
+{
+ Text [ en-US ] = "General punctuation";
+ };
+String RID_SUBSETSTR_SUB_SUPER_SCRIPTS
+{
+ Text [ en-US ] = "Superscripts and Subscripts";
+ };
+String RID_SUBSETSTR_CURRENCY_SYMBOLS
+{
+ Text [ en-US ] = "Currency Symbols";
+ };
+String RID_SUBSETSTR_COMB_DIACRITIC_SYMS
+{
+ Text [ en-US ] = "Combining Diacritical Symbols";
+ };
+String RID_SUBSETSTR_LETTERLIKE_SYMBOLS
+{
+ Text [ en-US ] = "Letterlike Symbols";
+ };
+String RID_SUBSETSTR_NUMBER_FORMS
+{
+ Text [ en-US ] = "Number Forms";
+ };
+String RID_SUBSETSTR_ARROWS
+{
+ Text [ en-US ] = "Arrows";
+ };
+String RID_SUBSETSTR_MATH_OPERATORS
+{
+ Text [ en-US ] = "Mathematical Operators";
+ };
+String RID_SUBSETSTR_MISC_TECHNICAL
+{
+ Text [ en-US ] = "Miscellaneous Technical";
+
+ };
+String RID_SUBSETSTR_CONTROL_PICTURES
+{
+ Text [ en-US ] = "Control Pictures";
+ };
+String RID_SUBSETSTR_OPTICAL_CHAR_REC
+{
+ Text [ en-US ] = "Optical Character Recognition";
+ };
+String RID_SUBSETSTR_ENCLOSED_ALPHANUM
+{
+ Text [ en-US ] = "Enclosed Alphanumerics";
+ };
+String RID_SUBSETSTR_BOX_DRAWING
+{
+ Text [ en-US ] = "Box Drawing";
+ };
+String RID_SUBSETSTR_BLOCK_ELEMENTS
+{
+ Text [ en-US ] = "Block Elements";
+ };
+String RID_SUBSETSTR_GEOMETRIC_SHAPES
+{
+ Text [ en-US ] = "Geometric Shapes";
+ };
+String RID_SUBSETSTR_MISC_DINGBATS
+{
+ Text [ en-US ] = "Miscellaneous Symbols";
+
+ };
+String RID_SUBSETSTR_DINGBATS
+{
+ Text [ en-US ] = "Dingbats";
+
+ };
+String RID_SUBSETSTR_CJK_SYMS_PUNCTUATION
+{
+ Text [ en-US ] = "CJK Symbols And Punctuation";
+ };
+String RID_SUBSETSTR_HIRAGANA
+{
+ Text [ en-US ] = "Hiragana";
+ };
+String RID_SUBSETSTR_KATAKANA
+{
+ Text [ en-US ] = "Katakana";
+ };
+String RID_SUBSETSTR_BOPOMOFO
+{
+ Text [ en-US ] = "Bopomofo";
+ };
+String RID_SUBSETSTR_HANGUL_COMPAT_JAMO
+{
+ Text [ en-US ] = "Hangul Compatibility Jamo";
+ };
+String RID_SUBSETSTR_CJK_MISC
+{
+ Text [ en-US ] = "CJK Miscellaneous";
+ };
+String RID_SUBSETSTR_ENCLOSED_CJK_LETTERS
+{
+ Text [ en-US ] = "Enclosed CJK Letters And Months";
+ };
+String RID_SUBSETSTR_CJK_COMPATIBILITY
+{
+ Text [ en-US ] = "CJK Compatibility";
+
+ };
+String RID_SUBSETSTR_HANGUL
+{
+ Text [ en-US ] = "Hangul";
+ };
+String RID_SUBSETSTR_CJK_UNIFIED_IDGRAPH
+{
+ Text [ en-US ] = "CJK Unified Ideographs";
+ };
+String RID_SUBSETSTR_CJK_EXT_A_UNIFIED_IDGRAPH
+{
+ Text [ en-US ] = "CJK Unified Ideographs Extension-A";
+ };
+String RID_SUBSETSTR_PRIVATE_USE_AREA
+{
+ Text [ en-US ] = "Private Use Area";
+ };
+String RID_SUBSETSTR_CJK_COMPAT_IDGRAPHS
+{
+ Text [ en-US ] = "CJK Compatibility Ideographs";
+ };
+String RID_SUBSETSTR_ALPHA_PRESENTATION
+{
+ Text [ en-US ] = "Alphabetic Presentation Forms";
+ };
+String RID_SUBSETSTR_ARABIC_PRESENT_A
+{
+ Text [ en-US ] = "Arabic Presentation Forms-A";
+
+ };
+String RID_SUBSETSTR_COMBINING_HALF_MARKS
+{
+ Text [ en-US ] = "Combining Half Marks";
+ };
+String RID_SUBSETSTR_CJK_COMPAT_FORMS
+{
+ Text [ en-US ] = "CJK Compatibility Forms";
+ };
+String RID_SUBSETSTR_SMALL_FORM_VARIANTS
+{
+ Text [ en-US ] = "Small Form Variants";
+
+ };
+String RID_SUBSETSTR_ARABIC_PRESENT_B
+{
+ Text [ en-US ] = "Arabic Presentation Forms-B";
+ };
+String RID_SUBSETSTR_HALFW_FULLW_FORMS
+{
+ Text [ en-US ] = "Half-width and Full-width Forms";
+ };
+String RID_SUBSETSTR_SPECIALS
+{
+ Text [ en-US ] = "Specials";
+ };
+String RID_SUBSETSTR_HANGUL_GA
+{
+ Text [ en-US ] = "Hangul Ga";
+ };
+String RID_SUBSETSTR_HANGUL_NA
+{
+ Text [ en-US ] = "Hangul Na";
+ };
+String RID_SUBSETSTR_HANGUL_DA
+{
+ Text [ en-US ] = "Hangul Da";
+ };
+String RID_SUBSETSTR_HANGUL_RA
+{
+ Text [ en-US ] = "Hangul Ra";
+ };
+String RID_SUBSETSTR_HANGUL_MA
+{
+ Text [ en-US ] = "Hangul Ma";
+ };
+String RID_SUBSETSTR_HANGUL_BA
+{
+ Text [ en-US ] = "Hangul Ba";
+ };
+String RID_SUBSETSTR_HANGUL_SA
+{
+ Text [ en-US ] = "Hangul Sa";
+ };
+String RID_SUBSETSTR_HANGUL_AH
+{
+ Text [ en-US ] = "Hangul Ah";
+ };
+String RID_SUBSETSTR_HANGUL_JA
+{
+ Text [ en-US ] = "Hangul Ja";
+ };
+String RID_SUBSETSTR_HANGUL_CHA
+{
+ Text [ en-US ] = "Hangul Cha";
+ };
+String RID_SUBSETSTR_HANGUL_KA
+{
+ Text [ en-US ] = "Hangul Ka";
+ };
+String RID_SUBSETSTR_HANGUL_TA
+{
+ Text [ en-US ] = "Hangul Ta";
+ };
+String RID_SUBSETSTR_HANGUL_PA
+{
+ Text [ en-US ] = "Hangul Pa";
+ };
+String RID_SUBSETSTR_HANGUL_HA
+{
+ Text [ en-US ] = "Hangul Ha";
+ };
+String RID_SUBSETSTR_YI
+{
+ Text [ en-US ] = "Yi";
+ };
+String RID_SUBSETSTR_SINHALA
+{
+ Text [ en-US ] = "Sinhala";
+ };
+String RID_SUBSETSTR_TIBETAN
+{
+ Text [ en-US ] = "Tibetan";
+ };
+String RID_SUBSETSTR_MYANMAR
+{
+ Text [ en-US ] = "Myanmar";
+ };
+String RID_SUBSETSTR_KHMER
+{
+ Text [ en-US ] = "Khmer";
+ };
+String RID_SUBSETSTR_OGHAM
+{
+ Text [ en-US ] = "Ogham";
+ };
+String RID_SUBSETSTR_RUNIC
+{
+ Text [ en-US ] = "Runic";
+ };
+String RID_SUBSETSTR_SYRIAC
+{
+ Text [ en-US ] = "Syriac";
+ };
+String RID_SUBSETSTR_THAANA
+{
+ Text [ en-US ] = "Thaana";
+ };
+String RID_SUBSETSTR_ETHIOPIC
+{
+ Text [ en-US ] = "Ethiopic";
+ };
+String RID_SUBSETSTR_CHEROKEE
+{
+ Text [ en-US ] = "Cherokee";
+ };
+String RID_SUBSETSTR_CANADIAN_ABORIGINAL
+{
+ Text [ en-US ] = "Canadan Aboriginal Syllables";
+ };
+String RID_SUBSETSTR_MONGOLIAN
+{
+ Text [ en-US ] = "Mongolian";
+ };
+
+String RID_SUBSETSTR_MISC_MATH_SYMS_A
+{
+ Text [ en-US ] = "Miscellaneous Mathematical Symbols-A";
+ };
+
+String RID_SUBSETSTR_SUPPL_ARROWS_A
+{
+ Text [ en-US ] = "Supplemental Arrows-A";
+ };
+
+String RID_SUBSETSTR_BRAILLE_PATTERNS
+{
+ Text [ en-US ] = "Braille Patterns";
+ };
+
+String RID_SUBSETSTR_SUPPL_ARROWS_B
+{
+ Text [ en-US ] = "Supplemental Arrows-B";
+ };
+
+String RID_SUBSETSTR_MISC_MATH_SYMS_B
+{
+ Text [ en-US ] = "Miscellaneous Mathematical Symbols-B";
+ };
+
+String RID_SUBSETSTR_CJK_RADICAL_SUPPL
+{
+ Text [ en-US ] = "CJK Radical Supplement";
+ };
+
+String RID_SUBSETSTR_KANXI_RADICALS
+{
+ Text [ en-US ] = "Kanxi Radicals";
+ };
+
+String RID_SUBSETSTR_IDEO_DESC_CHARS
+{
+ Text [ en-US ] = "Ideographic Description Characters";
+ };
+
+String RID_SUBSETSTR_TAGALOG
+{
+ Text [ en-US ] = "Tagalog";
+ };
+
+String RID_SUBSETSTR_HANUNOO
+{
+ Text [ en-US ] = "Hanunoo";
+ };
+
+String RID_SUBSETSTR_TAGBANWA
+{
+ Text [ en-US ] = "Tagbanwa";
+ };
+
+String RID_SUBSETSTR_BUHID
+{
+ Text [ en-US ] = "Buhid";
+ };
+
+String RID_SUBSETSTR_KANBUN
+{
+ Text [ en-US ] = "Kanbun";
+ };
+
+String RID_SUBSETSTR_BOPOMOFO_EXTENDED
+{
+ Text [ en-US ] = "Bopomofo Extended";
+ };
+
+String RID_SUBSETSTR_KATAKANA_PHONETIC
+{
+ Text [ en-US ] = "Katakana Phonetics";
+ };
+};
+
+// ********************************************************************** EOF
diff --git a/svx/source/dialog/wrapfield.cxx b/svx/source/dialog/wrapfield.cxx
new file mode 100644
index 000000000000..ee152439254c
--- /dev/null
+++ b/svx/source/dialog/wrapfield.cxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "svx/wrapfield.hxx"
+
+namespace svx {
+
+// ============================================================================
+
+WrapField::WrapField( Window* pParent, WinBits nWinStyle ) :
+ NumericField( pParent, nWinStyle )
+{
+}
+
+WrapField::WrapField( Window* pParent, const ResId& rResId ) :
+ NumericField( pParent, rResId )
+{
+}
+
+void WrapField::Up()
+{
+ SetValue( ((GetValue() + GetSpinSize() - GetMin()) % (GetMax() + 1)) + GetMin() );
+ GetUpHdl().Call( this );
+}
+
+void WrapField::Down()
+{
+ SetValue( ((GetValue() - GetSpinSize() + GetMax() + 1 - GetMin()) % (GetMax() + 1)) + GetMin() );
+ GetDownHdl().Call( this );
+}
+
+// ============================================================================
+
+} // namespace svx
+
diff --git a/svx/source/engine3d/camera3d.cxx b/svx/source/engine3d/camera3d.cxx
new file mode 100644
index 000000000000..d64f7aeaa3a0
--- /dev/null
+++ b/svx/source/engine3d/camera3d.cxx
@@ -0,0 +1,392 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/camera3d.hxx>
+#include <tools/stream.hxx>
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+Camera3D::Camera3D(const basegfx::B3DPoint& rPos, const basegfx::B3DPoint& rLookAt,
+ double fFocalLen, double fBankAng) :
+ aResetPos(rPos),
+ aResetLookAt(rLookAt),
+ fResetFocalLength(fFocalLen),
+ fResetBankAngle(fBankAng),
+ fBankAngle(fBankAng),
+ bAutoAdjustProjection(sal_True)
+{
+ SetVPD(0);
+ SetPosition(rPos);
+ SetLookAt(rLookAt);
+ SetFocalLength(fFocalLen);
+}
+
+/*************************************************************************
+|*
+|* Default-Konstruktor
+|*
+\************************************************************************/
+
+Camera3D::Camera3D()
+{
+ basegfx::B3DPoint aVector3D(0.0 ,0.0 ,1.0);
+ Camera3D(aVector3D, basegfx::B3DPoint());
+}
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+void Camera3D::Reset()
+{
+ SetVPD(0);
+ fBankAngle = fResetBankAngle;
+ SetPosition(aResetPos);
+ SetLookAt(aResetLookAt);
+ SetFocalLength(fResetFocalLength);
+}
+
+/*************************************************************************
+|*
+|* Defaultwerte fuer Reset setzen
+|*
+\************************************************************************/
+
+void Camera3D::SetDefaults(const basegfx::B3DPoint& rPos, const basegfx::B3DPoint& rLookAt,
+ double fFocalLen, double fBankAng)
+{
+ aResetPos = rPos;
+ aResetLookAt = rLookAt;
+ fResetFocalLength = fFocalLen;
+ fResetBankAngle = fBankAng;
+}
+
+/*************************************************************************
+|*
+|* ViewWindow setzen und PRP anpassen
+|*
+\************************************************************************/
+
+void Camera3D::SetViewWindow(double fX, double fY, double fW, double fH)
+{
+ Viewport3D::SetViewWindow(fX, fY, fW, fH);
+ if ( bAutoAdjustProjection )
+ SetFocalLength(fFocalLength);
+}
+
+/*************************************************************************
+|*
+|* Kameraposition setzen
+|*
+\************************************************************************/
+
+void Camera3D::SetPosition(const basegfx::B3DPoint& rNewPos)
+{
+ if ( rNewPos != aPosition )
+ {
+ aPosition = rNewPos;
+ SetVRP(aPosition);
+ SetVPN(aPosition - aLookAt);
+ SetBankAngle(fBankAngle);
+ }
+}
+
+/*************************************************************************
+|*
+|* Blickpunkt setzen
+|*
+\************************************************************************/
+
+void Camera3D::SetLookAt(const basegfx::B3DPoint& rNewLookAt)
+{
+ if ( rNewLookAt != aLookAt )
+ {
+ aLookAt = rNewLookAt;
+ SetVPN(aPosition - aLookAt);
+ SetBankAngle(fBankAngle);
+ }
+}
+
+/*************************************************************************
+|*
+|* Position und Blickpunkt setzen
+|*
+\************************************************************************/
+
+void Camera3D::SetPosAndLookAt(const basegfx::B3DPoint& rNewPos,
+ const basegfx::B3DPoint& rNewLookAt)
+{
+ if ( rNewPos != aPosition || rNewLookAt != aLookAt )
+ {
+ aPosition = rNewPos;
+ aLookAt = rNewLookAt;
+
+ SetVRP(aPosition);
+ SetVPN(aPosition - aLookAt);
+ SetBankAngle(fBankAngle);
+ }
+}
+
+/*************************************************************************
+|*
+|* seitlichen Neigungswinkel setzen
+|*
+\************************************************************************/
+
+void Camera3D::SetBankAngle(double fAngle)
+{
+ basegfx::B3DVector aDiff(aPosition - aLookAt);
+ basegfx::B3DVector aPrj(aDiff);
+ fBankAngle = fAngle;
+
+ if ( aDiff.getY() == 0 )
+ {
+ aPrj.setY(-1.0);
+ }
+ else
+ { // aPrj = Projektion von aDiff auf die XZ-Ebene
+ aPrj.setY(0.0);
+
+ if ( aDiff.getY() < 0.0 )
+ {
+ aPrj = -aPrj;
+ }
+ }
+
+ // von aDiff nach oben zeigenden View-Up-Vektor berechnen
+ aPrj = aPrj.getPerpendicular(aDiff);
+ aPrj = aPrj.getPerpendicular(aDiff);
+ aDiff.normalize();
+
+ // auf Z-Achse rotieren, dort um BankAngle drehen und zurueck
+ basegfx::B3DHomMatrix aTf;
+ const double fV(sqrt(aDiff.getY() * aDiff.getY() + aDiff.getZ() * aDiff.getZ()));
+
+ if ( fV != 0.0 )
+ {
+ basegfx::B3DHomMatrix aTemp;
+ const double fSin(aDiff.getY() / fV);
+ const double fCos(aDiff.getZ() / fV);
+
+ aTemp.set(1, 1, fCos);
+ aTemp.set(2, 2, fCos);
+ aTemp.set(2, 1, fSin);
+ aTemp.set(1, 2, -fSin);
+
+ aTf *= aTemp;
+ }
+
+ {
+ basegfx::B3DHomMatrix aTemp;
+ const double fSin(-aDiff.getX());
+ const double fCos(fV);
+
+ aTemp.set(0, 0, fCos);
+ aTemp.set(2, 2, fCos);
+ aTemp.set(0, 2, fSin);
+ aTemp.set(2, 0, -fSin);
+
+ aTf *= aTemp;
+ }
+
+ aTf.rotate(0.0, 0.0, fBankAngle);
+
+ {
+ basegfx::B3DHomMatrix aTemp;
+ const double fSin(aDiff.getX());
+ const double fCos(fV);
+
+ aTemp.set(0, 0, fCos);
+ aTemp.set(2, 2, fCos);
+ aTemp.set(0, 2, fSin);
+ aTemp.set(2, 0, -fSin);
+
+ aTf *= aTemp;
+ }
+
+ if ( fV != 0.0 )
+ {
+ basegfx::B3DHomMatrix aTemp;
+ const double fSin(-aDiff.getY() / fV);
+ const double fCos(aDiff.getZ() / fV);
+
+ aTemp.set(1, 1, fCos);
+ aTemp.set(2, 2, fCos);
+ aTemp.set(2, 1, fSin);
+ aTemp.set(1, 2, -fSin);
+
+ aTf *= aTemp;
+ }
+
+ SetVUV(aTf * aPrj);
+}
+
+/*************************************************************************
+|*
+|* Brennweite setzen
+|*
+\************************************************************************/
+
+void Camera3D::SetFocalLength(double fLen)
+{
+ if ( fLen < 5 )
+ fLen = 5;
+ SetPRP(basegfx::B3DPoint(0.0, 0.0, fLen / 35.0 * aViewWin.W));
+ fFocalLength = fLen;
+}
+
+/*************************************************************************
+|*
+|* Um die Kameraposition drehen, LookAt wird dabei veraendert
+|*
+\************************************************************************/
+
+void Camera3D::Rotate(double fHAngle, double fVAngle)
+{
+ basegfx::B3DHomMatrix aTf;
+ basegfx::B3DVector aDiff(aLookAt - aPosition);
+ const double fV(sqrt(aDiff.getX() * aDiff.getX() + aDiff.getZ() * aDiff.getZ()));
+
+ if ( fV != 0.0 )
+ {
+ basegfx::B3DHomMatrix aTemp;
+ const double fSin(aDiff.getZ() / fV);
+ const double fCos(aDiff.getX() / fV);
+
+ aTemp.set(0, 0, fCos);
+ aTemp.set(2, 2, fCos);
+ aTemp.set(0, 2, fSin);
+ aTemp.set(2, 0, -fSin);
+
+ aTf *= aTemp;
+ }
+
+ {
+ aTf.rotate(0.0, 0.0, fVAngle);
+ }
+
+ if ( fV != 0.0 )
+ {
+ basegfx::B3DHomMatrix aTemp;
+ const double fSin(-aDiff.getZ() / fV);
+ const double fCos(aDiff.getX() / fV);
+
+ aTemp.set(0, 0, fCos);
+ aTemp.set(2, 2, fCos);
+ aTemp.set(0, 2, fSin);
+ aTemp.set(2, 0, -fSin);
+
+ aTf *= aTemp;
+ }
+
+ {
+ aTf.rotate(0.0, fHAngle, 0.0);
+ }
+
+ aDiff *= aTf;
+ SetLookAt(aPosition + aDiff);
+}
+
+
+/*************************************************************************
+|*
+|* Um den Blickpunkt drehen, Position wird dabei veraendert
+|*
+\************************************************************************/
+
+void Camera3D::RotateAroundLookAt(double fHAngle, double fVAngle)
+{
+ basegfx::B3DHomMatrix aTf;
+ basegfx::B3DVector aDiff(aPosition - aLookAt);
+ const double fV(sqrt(aDiff.getX() * aDiff.getX() + aDiff.getZ() * aDiff.getZ()));
+
+ if ( fV != 0.0 )
+ {
+ basegfx::B3DHomMatrix aTemp;
+ const double fSin(aDiff.getZ() / fV);
+ const double fCos(aDiff.getX() / fV);
+
+ aTemp.set(0, 0, fCos);
+ aTemp.set(2, 2, fCos);
+ aTemp.set(0, 2, fSin);
+ aTemp.set(2, 0, -fSin);
+
+ aTf *= aTemp;
+ }
+
+ {
+ aTf.rotate(0.0, 0.0, fVAngle);
+ }
+
+ if ( fV != 0.0 )
+ {
+ basegfx::B3DHomMatrix aTemp;
+ const double fSin(-aDiff.getZ() / fV);
+ const double fCos(aDiff.getX() / fV);
+
+ aTemp.set(0, 0, fCos);
+ aTemp.set(2, 2, fCos);
+ aTemp.set(0, 2, fSin);
+ aTemp.set(2, 0, -fSin);
+
+ aTf *= aTemp;
+ }
+
+ {
+ aTf.rotate(0.0, fHAngle, 0.0);
+ }
+
+ aDiff *= aTf;
+ SetPosition(aLookAt + aDiff);
+}
+
+/*************************************************************************
+|*
+|* FG: ??? Setzt wohl die Projektionsebene in eine bestimmte Tiefe
+|*
+\************************************************************************/
+
+void Camera3D::SetFocalLengthWithCorrect(double fLen)
+{
+ if ( fLen < 5.0 )
+ {
+ fLen = 5.0;
+ }
+
+ SetPRP(basegfx::B3DPoint(0.0, 0.0, aPRP.getZ() * fLen / fFocalLength));
+ fFocalLength = fLen;
+}
+
+// eof
diff --git a/svx/source/engine3d/cube3d.cxx b/svx/source/engine3d/cube3d.cxx
new file mode 100644
index 000000000000..6329ca2a3203
--- /dev/null
+++ b/svx/source/engine3d/cube3d.cxx
@@ -0,0 +1,199 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svx/svdstr.hrc"
+#include "svx/svdglob.hxx"
+#include <svx/cube3d.hxx>
+#include "svx/globl3d.hxx"
+#include <basegfx/point/b3dpoint.hxx>
+#include <basegfx/polygon/b3dpolygon.hxx>
+#include <svx/sdr/contact/viewcontactofe3dcube.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// #110094# DrawContact section
+
+sdr::contact::ViewContact* E3dCubeObj::CreateObjectSpecificViewContact()
+{
+ return new sdr::contact::ViewContactOfE3dCube(*this);
+}
+
+TYPEINIT1(E3dCubeObj, E3dCompoundObject);
+
+/*************************************************************************
+|*
+|* Konstruktor: |
+|* 3D-Quader erzeugen; aPos: Zentrum oder links, unten, hinten |__
+|* (abhaengig von bPosIsCenter) /
+|*
+\************************************************************************/
+
+E3dCubeObj::E3dCubeObj(E3dDefaultAttributes& rDefault, basegfx::B3DPoint aPos, const basegfx::B3DVector& r3DSize)
+: E3dCompoundObject(rDefault)
+{
+ // Defaults setzen
+ SetDefaultAttributes(rDefault);
+
+ // uebergebene drueberbuegeln
+ aCubePos = aPos;
+ aCubeSize = r3DSize;
+}
+
+E3dCubeObj::E3dCubeObj()
+: E3dCompoundObject()
+{
+ // Defaults setzen
+ E3dDefaultAttributes aDefault;
+ SetDefaultAttributes(aDefault);
+}
+
+void E3dCubeObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
+{
+ aCubePos = rDefault.GetDefaultCubePos();
+ aCubeSize = rDefault.GetDefaultCubeSize();
+ nSideFlags = rDefault.GetDefaultCubeSideFlags();
+ bPosIsCenter = rDefault.GetDefaultCubePosIsCenter();
+}
+
+/*************************************************************************
+|*
+|* Identifier zurueckgeben
+|*
+\************************************************************************/
+
+sal_uInt16 E3dCubeObj::GetObjIdentifier() const
+{
+ return E3D_CUBEOBJ_ID;
+}
+
+/*************************************************************************
+|*
+|* Wandle das Objekt in ein Gruppenobjekt bestehend aus 6 Polygonen
+|*
+\************************************************************************/
+
+SdrObject *E3dCubeObj::DoConvertToPolyObj(sal_Bool /*bBezier*/) const
+{
+ return NULL;
+}
+
+/*************************************************************************
+|*
+|* Zuweisungsoperator
+|*
+\************************************************************************/
+
+void E3dCubeObj::operator=(const SdrObject& rObj)
+{
+ // erstmal alle Childs kopieren
+ E3dCompoundObject::operator=(rObj);
+
+ // weitere Parameter kopieren
+ const E3dCubeObj& r3DObj = (const E3dCubeObj&)rObj;
+
+ aCubePos = r3DObj.aCubePos;
+ aCubeSize = r3DObj.aCubeSize;
+ bPosIsCenter = r3DObj.bPosIsCenter;
+ nSideFlags = r3DObj.nSideFlags;
+}
+
+/*************************************************************************
+|*
+|* Lokale Parameter setzen mit Geometrieneuerzeugung
+|*
+\************************************************************************/
+
+void E3dCubeObj::SetCubePos(const basegfx::B3DPoint& rNew)
+{
+ if(aCubePos != rNew)
+ {
+ aCubePos = rNew;
+ ActionChanged();
+ }
+}
+
+void E3dCubeObj::SetCubeSize(const basegfx::B3DVector& rNew)
+{
+ if(aCubeSize != rNew)
+ {
+ aCubeSize = rNew;
+ ActionChanged();
+ }
+}
+
+void E3dCubeObj::SetPosIsCenter(sal_Bool bNew)
+{
+ if(bPosIsCenter != bNew)
+ {
+ bPosIsCenter = bNew;
+ ActionChanged();
+ }
+}
+
+void E3dCubeObj::SetSideFlags(sal_uInt16 nNew)
+{
+ if(nSideFlags != nNew)
+ {
+ nSideFlags = nNew;
+ ActionChanged();
+ }
+}
+
+/*************************************************************************
+|*
+|* Get the name of the object (singular)
+|*
+\************************************************************************/
+
+void E3dCubeObj::TakeObjNameSingul(XubString& rName) const
+{
+ rName=ImpGetResStr(STR_ObjNameSingulCube3d);
+
+ String aName( GetName() );
+ if(aName.Len())
+ {
+ rName += sal_Unicode(' ');
+ rName += sal_Unicode('\'');
+ rName += aName;
+ rName += sal_Unicode('\'');
+ }
+}
+
+/*************************************************************************
+|*
+|* Get the name of the object (plural)
+|*
+\************************************************************************/
+
+void E3dCubeObj::TakeObjNamePlural(XubString& rName) const
+{
+ rName=ImpGetResStr(STR_ObjNamePluralCube3d);
+}
+
+// eof
diff --git a/svx/source/engine3d/deflt3d.cxx b/svx/source/engine3d/deflt3d.cxx
new file mode 100644
index 000000000000..e8473033ccf3
--- /dev/null
+++ b/svx/source/engine3d/deflt3d.cxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/deflt3d.hxx>
+#include <svx/cube3d.hxx>
+#include <svx/svxids.hrc>
+#include <editeng/colritem.hxx>
+#include <svx/e3ditem.hxx>
+
+/*************************************************************************
+|*
+|* Klasse zum verwalten der 3D-Default Attribute
+|*
+\************************************************************************/
+
+// Konstruktor
+E3dDefaultAttributes::E3dDefaultAttributes()
+{
+ Reset();
+}
+
+void E3dDefaultAttributes::Reset()
+{
+ // Compound-Objekt
+ bDefaultCreateNormals = sal_True;
+ bDefaultCreateTexture = sal_True;
+
+ // Cube-Objekt
+ aDefaultCubePos = basegfx::B3DPoint(-500.0, -500.0, -500.0);
+ aDefaultCubeSize = basegfx::B3DVector(1000.0, 1000.0, 1000.0);
+ nDefaultCubeSideFlags = CUBE_FULL;
+ bDefaultCubePosIsCenter = sal_False;
+
+ // Sphere-Objekt
+ aDefaultSphereCenter = basegfx::B3DPoint(0.0, 0.0, 0.0);
+ aDefaultSphereSize = basegfx::B3DPoint(1000.0, 1000.0, 1000.0);
+
+ // Lathe-Objekt
+ nDefaultLatheEndAngle = 3600;
+ bDefaultLatheSmoothed = sal_True;
+ bDefaultLatheSmoothFrontBack = sal_False;
+ bDefaultLatheCharacterMode = sal_False;
+ bDefaultLatheCloseFront = sal_True;
+ bDefaultLatheCloseBack = sal_True;
+
+ // Extrude-Objekt
+ bDefaultExtrudeSmoothed = sal_True;
+ bDefaultExtrudeSmoothFrontBack = sal_False;
+ bDefaultExtrudeCharacterMode = sal_False;
+ bDefaultExtrudeCloseFront = sal_True;
+ bDefaultExtrudeCloseBack = sal_True;
+}
+
+// eof
diff --git a/svx/source/engine3d/dragmt3d.cxx b/svx/source/engine3d/dragmt3d.cxx
new file mode 100644
index 000000000000..6fadec8cc9dc
--- /dev/null
+++ b/svx/source/engine3d/dragmt3d.cxx
@@ -0,0 +1,789 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <dragmt3d.hxx>
+#include <tools/shl.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/svddrgmt.hxx>
+#include <svx/svdtrans.hxx>
+#include <svx/obj3d.hxx>
+#include <svx/polysc3d.hxx>
+#include <svx/e3dundo.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/sdr/overlay/overlaypolypolygon.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+#include <svx/e3dsceneupdater.hxx>
+
+TYPEINIT1(E3dDragMethod, SdrDragMethod);
+
+/*************************************************************************
+|*
+|* Konstruktor aller 3D-DragMethoden
+|*
+\************************************************************************/
+
+E3dDragMethod::E3dDragMethod (
+ SdrDragView &_rView,
+ const SdrMarkList& rMark,
+ E3dDragConstraint eConstr,
+ sal_Bool bFull)
+: SdrDragMethod(_rView),
+ meConstraint(eConstr),
+ mbMoveFull(bFull),
+ mbMovedAtAll(sal_False)
+{
+ // Fuer alle in der selektion befindlichen 3D-Objekte
+ // eine Unit anlegen
+ const long nCnt(rMark.GetMarkCount());
+ static bool bDoInvalidate(false);
+ long nObjs(0);
+
+ if(mbMoveFull)
+ {
+ // for non-visible 3D objects fallback to wireframe interaction
+ bool bInvisibleObjects(false);
+
+ for(nObjs = 0;!bInvisibleObjects && nObjs < nCnt;nObjs++)
+ {
+ E3dObject* pE3dObj = dynamic_cast< E3dObject* >(rMark.GetMark(nObjs)->GetMarkedSdrObj());
+
+ if(pE3dObj)
+ {
+ if(!pE3dObj->HasFillStyle() && !pE3dObj->HasLineStyle())
+ {
+ bInvisibleObjects = true;
+ }
+ }
+ }
+
+ if(bInvisibleObjects)
+ {
+ mbMoveFull = false;
+ }
+ }
+
+ for(nObjs = 0;nObjs < nCnt;nObjs++)
+ {
+ E3dObject* pE3dObj = dynamic_cast< E3dObject* >(rMark.GetMark(nObjs)->GetMarkedSdrObj());
+
+ if(pE3dObj)
+ {
+ // fill new interaction unit
+ E3dDragMethodUnit aNewUnit;
+ aNewUnit.mp3DObj = pE3dObj;
+
+ // get transformations
+ aNewUnit.maInitTransform = aNewUnit.maTransform = pE3dObj->GetTransform();
+
+ if(pE3dObj->GetParentObj())
+ {
+ // get transform between object and world, normally scene transform
+ aNewUnit.maInvDisplayTransform = aNewUnit.maDisplayTransform = pE3dObj->GetParentObj()->GetFullTransform();
+ aNewUnit.maInvDisplayTransform.invert();
+ }
+
+ // SnapRects der beteiligten Objekte invalidieren, um eine
+ // Neuberechnung beim Setzen der Marker zu erzwingen
+ if(bDoInvalidate)
+ {
+ pE3dObj->SetRectsDirty();
+ }
+
+ if(!mbMoveFull)
+ {
+ // create wireframe visualisation for parent coordinate system
+ aNewUnit.maWireframePoly.clear();
+ aNewUnit.maWireframePoly = pE3dObj->CreateWireframe();
+ aNewUnit.maWireframePoly.transform(aNewUnit.maTransform);
+ }
+
+ // FullBound ermitteln
+ maFullBound.Union(pE3dObj->GetSnapRect());
+
+ // Unit einfuegen
+ maGrp.push_back(aNewUnit);
+ }
+ }
+}
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+void E3dDragMethod::TakeSdrDragComment(XubString& /*rStr*/) const
+{
+}
+
+/*************************************************************************
+|*
+|* Erstelle das Drahtgittermodel fuer alle Aktionen
+|*
+\************************************************************************/
+
+bool E3dDragMethod::BeginSdrDrag()
+{
+ if(E3DDRAG_CONSTR_Z == meConstraint)
+ {
+ const sal_uInt32 nCnt(maGrp.size());
+ DragStat().Ref1() = maFullBound.Center();
+
+ for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
+ {
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
+ rCandidate.mnStartAngle = GetAngle(DragStat().GetStart() - DragStat().GetRef1());
+ rCandidate.mnLastAngle = 0;
+ }
+ }
+ else
+ {
+ maLastPos = DragStat().GetStart();
+ }
+
+ if(!mbMoveFull)
+ {
+ Show();
+ }
+
+ return sal_True;
+}
+
+/*************************************************************************
+|*
+|* Schluss
+|*
+\************************************************************************/
+
+bool E3dDragMethod::EndSdrDrag(bool /*bCopy*/)
+{
+ const sal_uInt32 nCnt(maGrp.size());
+
+ if(!mbMoveFull)
+ {
+ // WireFrame ausblenden
+ Hide();
+ }
+
+ // Alle Transformationen anwenden und UnDo's anlegen
+ if(mbMovedAtAll)
+ {
+ const bool bUndo = getSdrDragView().IsUndoEnabled();
+ if( bUndo )
+ getSdrDragView().BegUndo(SVX_RESSTR(RID_SVX_3D_UNDO_ROTATE));
+ sal_uInt32 nOb(0);
+
+ for(nOb=0;nOb<nCnt;nOb++)
+ {
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
+ E3DModifySceneSnapRectUpdater aUpdater(rCandidate.mp3DObj);
+ rCandidate.mp3DObj->SetTransform(rCandidate.maTransform);
+ if( bUndo )
+ {
+ getSdrDragView().AddUndo(new E3dRotateUndoAction(rCandidate.mp3DObj->GetModel(),
+ rCandidate.mp3DObj, rCandidate.maInitTransform,
+ rCandidate.maTransform));
+ }
+ }
+ if( bUndo )
+ getSdrDragView().EndUndo();
+ }
+
+ return sal_True;
+}
+
+/*************************************************************************
+|*
+|* Abbruch
+|*
+\************************************************************************/
+
+void E3dDragMethod::CancelSdrDrag()
+{
+ if(mbMoveFull)
+ {
+ if(mbMovedAtAll)
+ {
+ const sal_uInt32 nCnt(maGrp.size());
+
+ for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
+ {
+ // Transformation restaurieren
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
+ E3DModifySceneSnapRectUpdater aUpdater(rCandidate.mp3DObj);
+ rCandidate.mp3DObj->SetTransform(rCandidate.maInitTransform);
+ }
+ }
+ }
+ else
+ {
+ // WireFrame ausblenden
+ Hide();
+ }
+}
+
+/*************************************************************************
+|*
+|* Gemeinsames MoveSdrDrag()
+|*
+\************************************************************************/
+
+void E3dDragMethod::MoveSdrDrag(const Point& /*rPnt*/)
+{
+ mbMovedAtAll = true;
+}
+
+/*************************************************************************
+|*
+|* Zeichne das Drahtgittermodel
+|*
+\************************************************************************/
+
+// for migration from XOR to overlay
+void E3dDragMethod::CreateOverlayGeometry(::sdr::overlay::OverlayManager& rOverlayManager)
+{
+ const sal_uInt32 nCnt(maGrp.size());
+ basegfx::B2DPolyPolygon aResult;
+
+ for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
+ {
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
+ SdrPageView* pPV = getSdrDragView().GetSdrPageView();
+
+ if(pPV && pPV->HasMarkedObjPageView())
+ {
+ const basegfx::B3DPolyPolygon aCandidate(rCandidate.maWireframePoly);
+ const sal_uInt32 nPlyCnt(aCandidate.count());
+
+ if(nPlyCnt)
+ {
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+ const basegfx::B3DHomMatrix aWorldToView(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection() * aViewInfo3D.getOrientation());
+ const basegfx::B3DHomMatrix aTransform(aWorldToView * rCandidate.maDisplayTransform);
+
+ // transform to relative scene coordinates
+ basegfx::B2DPolyPolygon aPolyPolygon(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(aCandidate, aTransform));
+
+ // transform to 2D view coordinates
+ aPolyPolygon.transform(rVCScene.getObjectTransformation());
+
+ aResult.append(aPolyPolygon);
+ }
+ }
+ }
+
+ if(aResult.count())
+ {
+ ::sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(aResult);
+ rOverlayManager.add(*pNew);
+ addToOverlayObjectList(*pNew);
+ }
+}
+
+/*************************************************************************
+
+ E3dDragRotate
+
+*************************************************************************/
+
+TYPEINIT1(E3dDragRotate, E3dDragMethod);
+
+E3dDragRotate::E3dDragRotate(SdrDragView &_rView,
+ const SdrMarkList& rMark,
+ E3dDragConstraint eConstr,
+ sal_Bool bFull)
+: E3dDragMethod(_rView, rMark, eConstr, bFull)
+{
+ // Zentrum aller selektierten Objekte in Augkoordinaten holen
+ const sal_uInt32 nCnt(maGrp.size());
+
+ if(nCnt)
+ {
+ const E3dScene *pScene = maGrp[0].mp3DObj->GetScene();
+
+ if(pScene)
+ {
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+
+ for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
+ {
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
+ basegfx::B3DPoint aObjCenter = rCandidate.mp3DObj->GetBoundVolume().getCenter();
+ const basegfx::B3DHomMatrix aTransform(aViewInfo3D.getOrientation() * rCandidate.maDisplayTransform * rCandidate.maInitTransform);
+
+ aObjCenter = aTransform * aObjCenter;
+ maGlobalCenter += aObjCenter;
+ }
+
+ // Teilen durch Anzahl
+ if(nCnt > 1)
+ {
+ maGlobalCenter /= (double)nCnt;
+ }
+
+ // get rotate center and transform to 3D eye coordinates
+ basegfx::B2DPoint aRotCenter2D(Ref1().X(), Ref1().Y());
+
+ // from world to relative scene using inverse getObjectTransformation()
+ basegfx::B2DHomMatrix aInverseObjectTransform(rVCScene.getObjectTransformation());
+ aInverseObjectTransform.invert();
+ aRotCenter2D = aInverseObjectTransform * aRotCenter2D;
+
+ // from 3D view to 3D eye
+ basegfx::B3DPoint aRotCenter3D(aRotCenter2D.getX(), aRotCenter2D.getY(), 0.0);
+ basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection());
+ aInverseViewToEye.invert();
+ aRotCenter3D = aInverseViewToEye * aRotCenter3D;
+
+ // X,Y des RotCenter und Tiefe der gemeinsamen Objektmitte aus
+ // Rotationspunkt im Raum benutzen
+ maGlobalCenter.setX(aRotCenter3D.getX());
+ maGlobalCenter.setY(aRotCenter3D.getY());
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Das Objekt wird bewegt, bestimme die Winkel
+|*
+\************************************************************************/
+
+void E3dDragRotate::MoveSdrDrag(const Point& rPnt)
+{
+ // call parent
+ E3dDragMethod::MoveSdrDrag(rPnt);
+
+ if(DragStat().CheckMinMoved(rPnt))
+ {
+ // Modifier holen
+ sal_uInt16 nModifier = 0;
+ if(getSdrDragView().ISA(E3dView))
+ {
+ const MouseEvent& rLastMouse = ((E3dView&)getSdrDragView()).GetMouseEvent();
+ nModifier = rLastMouse.GetModifier();
+ }
+
+ // Alle Objekte rotieren
+ const sal_uInt32 nCnt(maGrp.size());
+
+ for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
+ {
+ // Rotationswinkel bestimmen
+ double fWAngle, fHAngle;
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
+
+ if(E3DDRAG_CONSTR_Z == meConstraint)
+ {
+ fWAngle = NormAngle360(GetAngle(rPnt - DragStat().GetRef1()) -
+ rCandidate.mnStartAngle) - rCandidate.mnLastAngle;
+ rCandidate.mnLastAngle = (long)fWAngle + rCandidate.mnLastAngle;
+ fWAngle /= 100.0;
+ fHAngle = 0.0;
+ }
+ else
+ {
+ fWAngle = 90.0 * (double)(rPnt.X() - maLastPos.X())
+ / (double)maFullBound.GetWidth();
+ fHAngle = 90.0 * (double)(rPnt.Y() - maLastPos.Y())
+ / (double)maFullBound.GetHeight();
+ }
+ long nSnap = 0;
+
+ if(!getSdrDragView().IsRotateAllowed(sal_False))
+ nSnap = 90;
+
+ if(nSnap != 0)
+ {
+ fWAngle = (double)(((long) fWAngle + nSnap/2) / nSnap * nSnap);
+ fHAngle = (double)(((long) fHAngle + nSnap/2) / nSnap * nSnap);
+ }
+
+ // nach radiant
+ fWAngle *= F_PI180;
+ fHAngle *= F_PI180;
+
+ // Transformation bestimmen
+ basegfx::B3DHomMatrix aRotMat;
+ if(E3DDRAG_CONSTR_Y & meConstraint)
+ {
+ if(nModifier & KEY_MOD2)
+ aRotMat.rotate(0.0, 0.0, fWAngle);
+ else
+ aRotMat.rotate(0.0, fWAngle, 0.0);
+ }
+ else if(E3DDRAG_CONSTR_Z & meConstraint)
+ {
+ if(nModifier & KEY_MOD2)
+ aRotMat.rotate(0.0, fWAngle, 0.0);
+ else
+ aRotMat.rotate(0.0, 0.0, fWAngle);
+ }
+ if(E3DDRAG_CONSTR_X & meConstraint)
+ {
+ aRotMat.rotate(fHAngle, 0.0, 0.0);
+ }
+
+ // Transformation in Eye-Koordinaten, dort rotieren
+ // und zurueck
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+ basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
+ aInverseOrientation.invert();
+
+ basegfx::B3DHomMatrix aTransMat(rCandidate.maDisplayTransform);
+ aTransMat *= aViewInfo3D.getOrientation();
+ aTransMat.translate(-maGlobalCenter.getX(), -maGlobalCenter.getY(), -maGlobalCenter.getZ());
+ aTransMat *= aRotMat;
+ aTransMat.translate(maGlobalCenter.getX(), maGlobalCenter.getY(), maGlobalCenter.getZ());
+ aTransMat *= aInverseOrientation;
+ aTransMat *= rCandidate.maInvDisplayTransform;
+
+ // ...und anwenden
+ rCandidate.maTransform *= aTransMat;
+
+ if(mbMoveFull)
+ {
+ E3DModifySceneSnapRectUpdater aUpdater(rCandidate.mp3DObj);
+ rCandidate.mp3DObj->SetTransform(rCandidate.maTransform);
+ }
+ else
+ {
+ Hide();
+ rCandidate.maWireframePoly.transform(aTransMat);
+ Show();
+ }
+ }
+ maLastPos = rPnt;
+ DragStat().NextMove(rPnt);
+ }
+}
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+Pointer E3dDragRotate::GetSdrDragPointer() const
+{
+ return Pointer(POINTER_ROTATE);
+}
+
+/*************************************************************************
+|*
+|* E3dDragMove
+|* Diese DragMethod wird nur bei Translationen innerhalb von 3D-Scenen
+|* benoetigt. Wird eine 3D-Scene selbst verschoben, so wird diese DragMethod
+|* nicht verwendet.
+|*
+\************************************************************************/
+
+TYPEINIT1(E3dDragMove, E3dDragMethod);
+
+E3dDragMove::E3dDragMove(SdrDragView &_rView,
+ const SdrMarkList& rMark,
+ SdrHdlKind eDrgHdl,
+ E3dDragConstraint eConstr,
+ sal_Bool bFull)
+: E3dDragMethod(_rView, rMark, eConstr, bFull),
+ meWhatDragHdl(eDrgHdl)
+{
+ switch(meWhatDragHdl)
+ {
+ case HDL_LEFT:
+ maScaleFixPos = maFullBound.RightCenter();
+ break;
+ case HDL_RIGHT:
+ maScaleFixPos = maFullBound.LeftCenter();
+ break;
+ case HDL_UPPER:
+ maScaleFixPos = maFullBound.BottomCenter();
+ break;
+ case HDL_LOWER:
+ maScaleFixPos = maFullBound.TopCenter();
+ break;
+ case HDL_UPLFT:
+ maScaleFixPos = maFullBound.BottomRight();
+ break;
+ case HDL_UPRGT:
+ maScaleFixPos = maFullBound.BottomLeft();
+ break;
+ case HDL_LWLFT:
+ maScaleFixPos = maFullBound.TopRight();
+ break;
+ case HDL_LWRGT:
+ maScaleFixPos = maFullBound.TopLeft();
+ break;
+ default:
+ // Bewegen des Objektes, HDL_MOVE
+ break;
+ }
+
+ // Override wenn IsResizeAtCenter()
+ if(getSdrDragView().IsResizeAtCenter())
+ {
+ meWhatDragHdl = HDL_USER;
+ maScaleFixPos = maFullBound.Center();
+ }
+}
+
+/*************************************************************************
+|*
+|* Das Objekt wird bewegt, bestimme die Translation
+|*
+\************************************************************************/
+
+void E3dDragMove::MoveSdrDrag(const Point& rPnt)
+{
+ // call parent
+ E3dDragMethod::MoveSdrDrag(rPnt);
+
+ if(DragStat().CheckMinMoved(rPnt))
+ {
+ if(HDL_MOVE == meWhatDragHdl)
+ {
+ // Translation
+ // Bewegungsvektor bestimmen
+ basegfx::B3DPoint aGlobalMoveHead((double)(rPnt.X() - maLastPos.X()), (double)(rPnt.Y() - maLastPos.Y()), 32768.0);
+ basegfx::B3DPoint aGlobalMoveTail(0.0, 0.0, 32768.0);
+ const sal_uInt32 nCnt(maGrp.size());
+
+ // Modifier holen
+ sal_uInt16 nModifier(0);
+
+ if(getSdrDragView().ISA(E3dView))
+ {
+ const MouseEvent& rLastMouse = ((E3dView&)getSdrDragView()).GetMouseEvent();
+ nModifier = rLastMouse.GetModifier();
+ }
+
+ for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
+ {
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+
+ // move coor from 2d world to 3d Eye
+ basegfx::B2DPoint aGlobalMoveHead2D((double)(rPnt.X() - maLastPos.X()), (double)(rPnt.Y() - maLastPos.Y()));
+ basegfx::B2DPoint aGlobalMoveTail2D(0.0, 0.0);
+ basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
+
+ aInverseSceneTransform.invert();
+ aGlobalMoveHead2D = aInverseSceneTransform * aGlobalMoveHead2D;
+ aGlobalMoveTail2D = aInverseSceneTransform * aGlobalMoveTail2D;
+
+ basegfx::B3DPoint aMoveHead3D(aGlobalMoveHead2D.getX(), aGlobalMoveHead2D.getY(), 0.5);
+ basegfx::B3DPoint aMoveTail3D(aGlobalMoveTail2D.getX(), aGlobalMoveTail2D.getY(), 0.5);
+ basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection());
+ aInverseViewToEye.invert();
+
+ aMoveHead3D = aInverseViewToEye * aMoveHead3D;
+ aMoveTail3D = aInverseViewToEye * aMoveTail3D;
+
+ // eventually switch movement from XY to XZ plane
+ if(nModifier & KEY_MOD2)
+ {
+ double fZwi = aMoveHead3D.getY();
+ aMoveHead3D.setY(aMoveHead3D.getZ());
+ aMoveHead3D.setZ(fZwi);
+
+ fZwi = aMoveTail3D.getY();
+ aMoveTail3D.setY(aMoveTail3D.getZ());
+ aMoveTail3D.setZ(fZwi);
+ }
+
+ // Bewegungsvektor von Aug-Koordinaten nach Parent-Koordinaten
+ basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
+ aInverseOrientation.invert();
+ basegfx::B3DHomMatrix aCompleteTrans(rCandidate.maInvDisplayTransform * aInverseOrientation);
+
+ aMoveHead3D = aCompleteTrans * aMoveHead3D;
+ aMoveTail3D = aCompleteTrans* aMoveTail3D;
+
+ // build transformation
+ basegfx::B3DHomMatrix aTransMat;
+ basegfx::B3DPoint aTranslate(aMoveHead3D - aMoveTail3D);
+ aTransMat.translate(aTranslate.getX(), aTranslate.getY(), aTranslate.getZ());
+
+ // ...and apply
+ rCandidate.maTransform *= aTransMat;
+
+ if(mbMoveFull)
+ {
+ E3DModifySceneSnapRectUpdater aUpdater(rCandidate.mp3DObj);
+ rCandidate.mp3DObj->SetTransform(rCandidate.maTransform);
+ }
+ else
+ {
+ Hide();
+ rCandidate.maWireframePoly.transform(aTransMat);
+ Show();
+ }
+ }
+ }
+ else
+ {
+ // Skalierung
+ // Skalierungsvektor bestimmen
+ Point aStartPos = DragStat().GetStart();
+ const sal_uInt32 nCnt(maGrp.size());
+
+ for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
+ {
+ E3dDragMethodUnit& rCandidate = maGrp[nOb];
+ const basegfx::B3DPoint aObjectCenter(rCandidate.mp3DObj->GetBoundVolume().getCenter());
+
+ // transform from 2D world view to 3D eye
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+
+ basegfx::B2DPoint aGlobalScaleStart2D((double)(aStartPos.X()), (double)(aStartPos.Y()));
+ basegfx::B2DPoint aGlobalScaleNext2D((double)(rPnt.X()), (double)(rPnt.Y()));
+ basegfx::B2DPoint aGlobalScaleFixPos2D((double)(maScaleFixPos.X()), (double)(maScaleFixPos.Y()));
+ basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
+
+ aInverseSceneTransform.invert();
+ aGlobalScaleStart2D = aInverseSceneTransform * aGlobalScaleStart2D;
+ aGlobalScaleNext2D = aInverseSceneTransform * aGlobalScaleNext2D;
+ aGlobalScaleFixPos2D = aInverseSceneTransform * aGlobalScaleFixPos2D;
+
+ basegfx::B3DPoint aGlobalScaleStart3D(aGlobalScaleStart2D.getX(), aGlobalScaleStart2D.getY(), aObjectCenter.getZ());
+ basegfx::B3DPoint aGlobalScaleNext3D(aGlobalScaleNext2D.getX(), aGlobalScaleNext2D.getY(), aObjectCenter.getZ());
+ basegfx::B3DPoint aGlobalScaleFixPos3D(aGlobalScaleFixPos2D.getX(), aGlobalScaleFixPos2D.getY(), aObjectCenter.getZ());
+ basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection());
+
+ aInverseViewToEye.invert();
+ basegfx::B3DPoint aScStart(aInverseViewToEye * aGlobalScaleStart3D);
+ basegfx::B3DPoint aScNext(aInverseViewToEye * aGlobalScaleNext3D);
+ basegfx::B3DPoint aScFixPos(aInverseViewToEye * aGlobalScaleFixPos3D);
+
+ // constraints?
+ switch(meWhatDragHdl)
+ {
+ case HDL_LEFT:
+ case HDL_RIGHT:
+ // constrain to auf X -> Y equal
+ aScNext.setY(aScFixPos.getY());
+ break;
+ case HDL_UPPER:
+ case HDL_LOWER:
+ // constrain to auf Y -> X equal
+ aScNext.setX(aScFixPos.getX());
+ break;
+ default:
+ break;
+ }
+
+ // get scale vector in eye coordinates
+ basegfx::B3DPoint aScaleVec(aScStart - aScFixPos);
+ aScaleVec.setZ(1.0);
+
+ if(aScaleVec.getX() != 0.0)
+ {
+ aScaleVec.setX((aScNext.getX() - aScFixPos.getX()) / aScaleVec.getX());
+ }
+ else
+ {
+ aScaleVec.setX(1.0);
+ }
+
+ if(aScaleVec.getY() != 0.0)
+ {
+ aScaleVec.setY((aScNext.getY() - aScFixPos.getY()) / aScaleVec.getY());
+ }
+ else
+ {
+ aScaleVec.setY(1.0);
+ }
+
+ // SHIFT-key used?
+ if(getSdrDragView().IsOrtho())
+ {
+ if(fabs(aScaleVec.getX()) > fabs(aScaleVec.getY()))
+ {
+ // X is biggest
+ aScaleVec.setY(aScaleVec.getX());
+ }
+ else
+ {
+ // Y is biggest
+ aScaleVec.setX(aScaleVec.getY());
+ }
+ }
+
+ // build transformation
+ basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
+ aInverseOrientation.invert();
+
+ basegfx::B3DHomMatrix aNewTrans = rCandidate.maInitTransform;
+ aNewTrans *= rCandidate.maDisplayTransform;
+ aNewTrans *= aViewInfo3D.getOrientation();
+ aNewTrans.translate(-aScFixPos.getX(), -aScFixPos.getY(), -aScFixPos.getZ());
+ aNewTrans.scale(aScaleVec.getX(), aScaleVec.getY(), aScaleVec.getZ());
+ aNewTrans.translate(aScFixPos.getX(), aScFixPos.getY(), aScFixPos.getZ());
+ aNewTrans *= aInverseOrientation;
+ aNewTrans *= rCandidate.maInvDisplayTransform;
+
+ // ...und anwenden
+ rCandidate.maTransform = aNewTrans;
+
+ if(mbMoveFull)
+ {
+ E3DModifySceneSnapRectUpdater aUpdater(rCandidate.mp3DObj);
+ rCandidate.mp3DObj->SetTransform(rCandidate.maTransform);
+ }
+ else
+ {
+ Hide();
+ rCandidate.maWireframePoly.clear();
+ rCandidate.maWireframePoly = rCandidate.mp3DObj->CreateWireframe();
+ rCandidate.maWireframePoly.transform(rCandidate.maTransform);
+ Show();
+ }
+ }
+ }
+ maLastPos = rPnt;
+ DragStat().NextMove(rPnt);
+ }
+}
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+Pointer E3dDragMove::GetSdrDragPointer() const
+{
+ return Pointer(POINTER_MOVE);
+}
+
+// eof
diff --git a/svx/source/engine3d/e3dsceneupdater.cxx b/svx/source/engine3d/e3dsceneupdater.cxx
new file mode 100644
index 000000000000..8fdaaf3ffc29
--- /dev/null
+++ b/svx/source/engine3d/e3dsceneupdater.cxx
@@ -0,0 +1,130 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/e3dsceneupdater.hxx>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+#include <svx/obj3d.hxx>
+#include <svx/scene3d.hxx>
+#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+E3DModifySceneSnapRectUpdater::E3DModifySceneSnapRectUpdater(const SdrObject* pObject)
+: mpScene(0),
+ mpViewInformation3D(0)
+{
+ // Secure old 3D transformation stack before modification
+ if(pObject)
+ {
+ const E3dObject* pE3dObject = dynamic_cast< const E3dObject* >(pObject);
+
+ if(pE3dObject)
+ {
+ mpScene = pE3dObject->GetScene();
+
+ if(mpScene && mpScene->GetScene() == mpScene)
+ {
+ // if there is a scene and it's the outmost scene, get current 3D range
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(mpScene->GetViewContact());
+ const basegfx::B3DRange aAllContentRange(rVCScene.getAllContentRange3D());
+
+ if(aAllContentRange.isEmpty())
+ {
+ // no content, nothing to do
+ mpScene = 0;
+ }
+ else
+ {
+ // secure current 3D transformation stack
+ mpViewInformation3D = new drawinglayer::geometry::ViewInformation3D(rVCScene.getViewInformation3D(aAllContentRange));
+ }
+ }
+ }
+ }
+}
+
+E3DModifySceneSnapRectUpdater::~E3DModifySceneSnapRectUpdater()
+{
+ if(mpScene && mpViewInformation3D)
+ {
+ // after changing parts of the scene, use the secured last 3d transformation stack and the new content
+ // range to calculate a new, eventually expanded or shrunk, 2D geometry for the scene and apply it.
+ // Get new content range
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(mpScene->GetViewContact());
+ basegfx::B3DRange aAllContentRange(rVCScene.getAllContentRange3D());
+
+ // only change when there is still content; else let scene stay at old SnapRect
+ if(!aAllContentRange.isEmpty())
+ {
+ // check if object transform of scene has changed
+ if(mpViewInformation3D->getObjectTransformation() != mpScene->GetTransform())
+ {
+ // If Yes, it needs to be updated since it's - for historical reasons -
+ // part of the basic 3d transformation stack of the scene
+ drawinglayer::geometry::ViewInformation3D* pNew = new drawinglayer::geometry::ViewInformation3D(
+ mpScene->GetTransform(), // replace object transformation with new local transform
+ mpViewInformation3D->getOrientation(),
+ mpViewInformation3D->getProjection(),
+ mpViewInformation3D->getDeviceToView(),
+ mpViewInformation3D->getViewTime(),
+ mpViewInformation3D->getExtendedInformationSequence());
+ delete mpViewInformation3D;
+ mpViewInformation3D = pNew;
+ }
+
+ // transform content range to scene-relative coordinates using old 3d transformation stack
+ aAllContentRange.transform(mpViewInformation3D->getObjectToView());
+
+ // build 2d relative content range
+ basegfx::B2DRange aSnapRange(
+ aAllContentRange.getMinX(), aAllContentRange.getMinY(),
+ aAllContentRange.getMaxX(), aAllContentRange.getMaxY());
+
+ // transform to 2D world coordiantes using scene's 2D transformation
+ aSnapRange.transform(rVCScene.getObjectTransformation());
+
+ // snap to (old) integer
+ const Rectangle aNewSnapRect(
+ sal_Int32(floor(aSnapRange.getMinX())), sal_Int32(floor(aSnapRange.getMinY())),
+ sal_Int32(ceil(aSnapRange.getMaxX())), sal_Int32(ceil(aSnapRange.getMaxY())));
+
+ // set as new SnapRect and invalidate bound volume
+ if(mpScene->GetSnapRect() != aNewSnapRect)
+ {
+ mpScene->SetSnapRect(aNewSnapRect);
+ mpScene->InvalidateBoundVolume();
+ }
+ }
+ }
+
+ delete mpViewInformation3D;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/engine3d/e3dundo.cxx b/svx/source/engine3d/e3dundo.cxx
new file mode 100644
index 000000000000..97658f4dcd68
--- /dev/null
+++ b/svx/source/engine3d/e3dundo.cxx
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/e3dundo.hxx>
+#include <svx/svdmodel.hxx>
+#include <editeng/outlobj.hxx>
+#include <svx/view3d.hxx>
+#include <svx/scene3d.hxx>
+#include <svx/e3dsceneupdater.hxx>
+
+/************************************************************************/
+
+TYPEINIT1(E3dUndoAction, SfxUndoAction);
+
+/************************************************************************\
+|*
+|* Destruktor der Basisklasse
+|*
+\************************************************************************/
+E3dUndoAction::~E3dUndoAction ()
+{
+}
+
+/************************************************************************\
+|*
+|* Repeat gibt es nicht
+|*
+\************************************************************************/
+sal_Bool E3dUndoAction::CanRepeat(SfxRepeatTarget&) const
+{
+ return sal_False;
+}
+
+/************************************************************************/
+
+TYPEINIT1(E3dRotateUndoAction, E3dUndoAction);
+
+/************************************************************************
+
+ E3dRotateUndoAction
+
+************************************************************************/
+
+/************************************************************************\
+|*
+|* Undodestruktor fuer 3D-Rotation
+|*
+\************************************************************************/
+E3dRotateUndoAction::~E3dRotateUndoAction ()
+{
+}
+
+/************************************************************************\
+|*
+|* Undo fuer 3D-Rotation ueber die Rotationsmatrizen
+|*
+\************************************************************************/
+void E3dRotateUndoAction::Undo ()
+{
+ E3DModifySceneSnapRectUpdater aUpdater(pMy3DObj);
+ pMy3DObj->SetTransform(aMyOldRotation);
+}
+
+/************************************************************************\
+|*
+|* Undo fuer 3D-Rotation ueber die Rotationsmatrizen
+|*
+\************************************************************************/
+void E3dRotateUndoAction::Redo ()
+{
+ E3DModifySceneSnapRectUpdater aUpdater(pMy3DObj);
+ pMy3DObj->SetTransform(aMyNewRotation);
+}
+
+/*************************************************************************
+|*
+|* E3dAttributesUndoAction
+|*
+\************************************************************************/
+
+TYPEINIT1(E3dAttributesUndoAction, SdrUndoAction);
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+E3dAttributesUndoAction::E3dAttributesUndoAction( SdrModel &rModel,
+ E3dView* p3dView,
+ E3dObject* pInObject,
+ const SfxItemSet& rNewSet,
+ const SfxItemSet& rOldSet,
+ sal_Bool bUseSubObj)
+: SdrUndoAction( rModel ),
+ pObject ( pInObject ),
+ pView ( p3dView ),
+ bUseSubObjects(bUseSubObj),
+ aNewSet ( rNewSet ),
+ aOldSet ( rOldSet )
+{
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+E3dAttributesUndoAction::~E3dAttributesUndoAction()
+{
+}
+
+/*************************************************************************
+|*
+|* Undo()
+|* Implementiert ueber Set3DAttributes(), um die Attribute nur an einer
+|* Stelle pflegen zu muessen!
+|*
+\************************************************************************/
+void E3dAttributesUndoAction::Undo()
+{
+ E3DModifySceneSnapRectUpdater aUpdater(pObject);
+ pObject->SetMergedItemSetAndBroadcast(aOldSet);
+}
+
+/*************************************************************************
+|*
+|* Redo()
+|*
+\************************************************************************/
+void E3dAttributesUndoAction::Redo()
+{
+ E3DModifySceneSnapRectUpdater aUpdater(pObject);
+ pObject->SetMergedItemSetAndBroadcast(aNewSet);
+}
+
+/*************************************************************************
+|*
+|* Mehrfaches Undo nicht moeglich
+|*
+\************************************************************************/
+sal_Bool E3dAttributesUndoAction::CanRepeat(SfxRepeatTarget& /*rView*/) const
+{
+ return sal_False;
+}
+
+/*************************************************************************
+|*
+|* Mehrfaches Undo nicht moeglich
+|*
+\************************************************************************/
+void E3dAttributesUndoAction::Repeat()
+{
+}
+
diff --git a/svx/source/engine3d/extrud3d.cxx b/svx/source/engine3d/extrud3d.cxx
new file mode 100644
index 000000000000..b3fdd6fd9b00
--- /dev/null
+++ b/svx/source/engine3d/extrud3d.cxx
@@ -0,0 +1,264 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svx/svdstr.hrc"
+#include "svx/svdglob.hxx"
+#include <svx/svdpage.hxx>
+#include "svx/globl3d.hxx"
+#include <svx/extrud3d.hxx>
+#include <svx/scene3d.hxx>
+
+#include <svx/svxids.hrc>
+#include <svx/xpoly.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svx3ditems.hxx>
+#include <svx/sdr/properties/e3dextrudeproperties.hxx>
+#include <svx/sdr/contact/viewcontactofe3dextrude.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b3dpolygontools.hxx>
+#include <basegfx/polygon/b3dpolypolygontools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// #110094# DrawContact section
+
+sdr::contact::ViewContact* E3dExtrudeObj::CreateObjectSpecificViewContact()
+{
+ return new sdr::contact::ViewContactOfE3dExtrude(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+sdr::properties::BaseProperties* E3dExtrudeObj::CreateObjectSpecificProperties()
+{
+ return new sdr::properties::E3dExtrudeProperties(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(E3dExtrudeObj, E3dCompoundObject);
+
+/*************************************************************************
+|*
+|* Konstruktor, erzeugt zwei Deckelflaechen-PolyPolygone und (PointCount-1)
+|* Seitenflaechen-Rechtecke aus dem uebergebenen PolyPolygon
+|*
+\************************************************************************/
+
+E3dExtrudeObj::E3dExtrudeObj(E3dDefaultAttributes& rDefault, const basegfx::B2DPolyPolygon& rPP, double fDepth)
+: E3dCompoundObject(rDefault),
+ maExtrudePolygon(rPP)
+{
+ // since the old class PolyPolygon3D did mirror the given PolyPolygons in Y, do the same here
+ basegfx::B2DHomMatrix aMirrorY;
+ aMirrorY.scale(1.0, -1.0);
+ maExtrudePolygon.transform(aMirrorY);
+
+ // Defaults setzen
+ SetDefaultAttributes(rDefault);
+
+ // set extrude depth
+ GetProperties().SetObjectItemDirect(Svx3DDepthItem((sal_uInt32)(fDepth + 0.5)));
+}
+
+E3dExtrudeObj::E3dExtrudeObj()
+: E3dCompoundObject()
+{
+ // Defaults setzen
+ E3dDefaultAttributes aDefault;
+ SetDefaultAttributes(aDefault);
+}
+
+void E3dExtrudeObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
+{
+ GetProperties().SetObjectItemDirect(Svx3DSmoothNormalsItem(rDefault.GetDefaultExtrudeSmoothed()));
+ GetProperties().SetObjectItemDirect(Svx3DSmoothLidsItem(rDefault.GetDefaultExtrudeSmoothFrontBack()));
+ GetProperties().SetObjectItemDirect(Svx3DCharacterModeItem(rDefault.GetDefaultExtrudeCharacterMode()));
+ GetProperties().SetObjectItemDirect(Svx3DCloseFrontItem(rDefault.GetDefaultExtrudeCloseFront()));
+ GetProperties().SetObjectItemDirect(Svx3DCloseBackItem(rDefault.GetDefaultExtrudeCloseBack()));
+
+ // Bei extrudes defaultmaessig StdTexture in X und Y
+ GetProperties().SetObjectItemDirect(Svx3DTextureProjectionXItem(1));
+ GetProperties().SetObjectItemDirect(Svx3DTextureProjectionYItem(1));
+}
+
+/*************************************************************************
+|*
+|* Identifier zurueckgeben
+|*
+\************************************************************************/
+
+sal_uInt16 E3dExtrudeObj::GetObjIdentifier() const
+{
+ return E3D_EXTRUDEOBJ_ID;
+}
+
+/*************************************************************************
+|*
+|* Zuweisungsoperator
+|*
+\************************************************************************/
+
+void E3dExtrudeObj::operator=(const SdrObject& rObj)
+{
+ // erstmal alle Childs kopieren
+ E3dCompoundObject::operator=(rObj);
+
+ // weitere Parameter kopieren
+ const E3dExtrudeObj& r3DObj = (const E3dExtrudeObj&)rObj;
+
+ maExtrudePolygon = r3DObj.maExtrudePolygon;
+}
+
+/*************************************************************************
+|*
+|* Lokale Parameter setzen mit Geometrieneuerzeugung
+|*
+\************************************************************************/
+
+void E3dExtrudeObj::SetExtrudePolygon(const basegfx::B2DPolyPolygon &rNew)
+{
+ if(maExtrudePolygon != rNew)
+ {
+ maExtrudePolygon = rNew;
+ ActionChanged();
+ }
+}
+
+/*************************************************************************
+|*
+|* Get the name of the object (singular)
+|*
+\************************************************************************/
+
+void E3dExtrudeObj::TakeObjNameSingul(XubString& rName) const
+{
+ rName=ImpGetResStr(STR_ObjNameSingulExtrude3d);
+
+ String aName( GetName() );
+ if(aName.Len())
+ {
+ rName += sal_Unicode(' ');
+ rName += sal_Unicode('\'');
+ rName += aName;
+ rName += sal_Unicode('\'');
+ }
+}
+
+/*************************************************************************
+|*
+|* Get the name of the object (plural)
+|*
+\************************************************************************/
+
+void E3dExtrudeObj::TakeObjNamePlural(XubString& rName) const
+{
+ rName=ImpGetResStr(STR_ObjNamePluralExtrude3d);
+}
+
+/*************************************************************************
+|*
+|* Aufbrechen
+|*
+\************************************************************************/
+
+sal_Bool E3dExtrudeObj::IsBreakObjPossible()
+{
+ return sal_True;
+}
+
+SdrAttrObj* E3dExtrudeObj::GetBreakObj()
+{
+ basegfx::B3DPolyPolygon aFrontSide;
+ basegfx::B3DPolyPolygon aBackSide;
+
+ if(maExtrudePolygon.count())
+ {
+ basegfx::B2DPolyPolygon aTemp(maExtrudePolygon);
+ aTemp.removeDoublePoints();
+ aTemp = basegfx::tools::correctOrientations(aTemp);
+ const basegfx::B2VectorOrientation aOrient = basegfx::tools::getOrientation(aTemp.getB2DPolygon(0L));
+
+ if(basegfx::ORIENTATION_POSITIVE == aOrient)
+ {
+ aTemp.flip();
+ }
+
+ aFrontSide = basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(aTemp);
+ }
+
+ if(aFrontSide.count())
+ {
+ aBackSide = aFrontSide;
+
+ if(GetExtrudeDepth())
+ {
+ basegfx::B3DHomMatrix aTransform;
+
+ if(100 != GetPercentBackScale())
+ {
+ // scale polygon from center
+ const double fScaleFactor(GetPercentBackScale() / 100.0);
+ const basegfx::B3DRange aPolyPolyRange(basegfx::tools::getRange(aBackSide));
+ const basegfx::B3DPoint aCenter(aPolyPolyRange.getCenter());
+
+ aTransform.translate(-aCenter.getX(), -aCenter.getY(), -aCenter.getZ());
+ aTransform.scale(fScaleFactor, fScaleFactor, fScaleFactor);
+ aTransform.translate(aCenter.getX(), aCenter.getY(), aCenter.getZ());
+ }
+
+ // translate by extrude depth
+ aTransform.translate(0.0, 0.0, (double)GetExtrudeDepth());
+
+ aBackSide.transform(aTransform);
+ }
+ }
+
+ if(aBackSide.count())
+ {
+ // create PathObj
+ basegfx::B2DPolyPolygon aPoly = TransformToScreenCoor(aBackSide);
+ SdrPathObj* pPathObj = new SdrPathObj(OBJ_PLIN, aPoly);
+
+ if(pPathObj)
+ {
+ SfxItemSet aSet(GetObjectItemSet());
+ aSet.Put(XLineStyleItem(XLINE_SOLID));
+ pPathObj->SetMergedItemSet(aSet);
+ }
+
+ return pPathObj;
+ }
+
+ return 0;
+}
+
+// eof
diff --git a/svx/source/engine3d/float3d.cxx b/svx/source/engine3d/float3d.cxx
new file mode 100644
index 000000000000..ea33f2089ed0
--- /dev/null
+++ b/svx/source/engine3d/float3d.cxx
@@ -0,0 +1,3333 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <sfx2/dispatch.hxx>
+#include <sfx2/module.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svl/eitem.hxx>
+#include <svtools/colrdlg.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/viewsh.hxx>
+#include <tools/shl.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/globl3d.hxx>
+#include <svx/view3d.hxx>
+#include <svx/obj3d.hxx>
+#include <svx/sphere3d.hxx>
+#include <svx/scene3d.hxx>
+#include <svx/camera3d.hxx>
+#include <svx/fmmodel.hxx>
+#include <svx/fmpage.hxx>
+#include <svx/polysc3d.hxx>
+#include <editeng/eeitem.hxx>
+#include <svl/style.hxx>
+#include <svx/dlgutil.hxx>
+
+#include <svx/dlgutil.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/viewpt3d.hxx> // ProjectionType
+
+#include <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+
+#include <editeng/colritem.hxx>
+#include <svx/e3ditem.hxx>
+
+#include <svx/gallery.hxx>
+#define GALLERY_THEME "3D"
+#include <svl/whiter.hxx>
+
+#include <svx/float3d.hxx>
+#include "float3d.hrc"
+
+SFX_IMPL_DOCKINGWINDOW( Svx3DChildWindow, SID_3D_WIN )
+
+struct Svx3DWinImpl
+{
+ SfxItemPool* pPool;
+ Image maImgLightOnH;
+ Image maImgLightOffH;
+};
+
+#define SETHCIMAGE(btn,res) \
+{ \
+ Bitmap aBmp( SVX_RES( res ) ); \
+ Image aImage( aBmp, COL_LIGHTMAGENTA ); \
+ btn.SetModeImage( aImage, BMP_COLOR_HIGHCONTRAST ); \
+}
+
+namespace {
+ /** Get the dispatcher from the current view frame, or, if that is not
+ available, from the given bindings.
+ @param pBindings
+ May be NULL.
+ @returns NULL when both the current view frame is NULL and the given
+ bindings are NULL.
+ */
+ SfxDispatcher* LocalGetDispatcher (const SfxBindings* pBindings)
+ {
+ SfxDispatcher* pDispatcher = NULL;
+
+ if (SfxViewFrame::Current() != NULL)
+ pDispatcher = SfxViewFrame::Current()->GetDispatcher();
+ else if (pBindings != NULL)
+ pDispatcher = pBindings->GetDispatcher();
+
+ return pDispatcher;
+ }
+}
+
+
+/*************************************************************************
+|* Svx3DWin - FloatingWindow
+\************************************************************************/
+__EXPORT Svx3DWin::Svx3DWin( SfxBindings* pInBindings,
+ SfxChildWindow *pCW, Window* pParent ) :
+ SfxDockingWindow ( pInBindings, pCW, pParent,
+ SVX_RES( RID_SVXFLOAT_3D ) ),
+ aBtnGeo ( this, SVX_RES( BTN_GEO ) ),
+ aBtnRepresentation ( this, SVX_RES( BTN_REPRESENTATION ) ),
+ aBtnLight ( this, SVX_RES( BTN_LIGHT ) ),
+ aBtnTexture ( this, SVX_RES( BTN_TEXTURE ) ),
+ aBtnMaterial ( this, SVX_RES( BTN_MATERIAL ) ),
+ aBtnUpdate ( this, SVX_RES( BTN_UPDATE ) ),
+ aBtnAssign ( this, SVX_RES( BTN_ASSIGN ) ),
+
+ // Geometrie
+ aFtPercentDiagonal ( this, SVX_RES( FT_PERCENT_DIAGONAL ) ),
+ aMtrPercentDiagonal ( this, SVX_RES( MTR_PERCENT_DIAGONAL ) ),
+ aFtBackscale ( this, SVX_RES( FT_BACKSCALE ) ),
+ aMtrBackscale ( this, SVX_RES( MTR_BACKSCALE ) ),
+ aFtEndAngle ( this, SVX_RES( FT_END_ANGLE ) ),
+ aMtrEndAngle ( this, SVX_RES( MTR_END_ANGLE ) ),
+ aFtDepth ( this, SVX_RES( FT_DEPTH ) ),
+ aMtrDepth ( this, SVX_RES( MTR_DEPTH ) ),
+ aFLGeometrie ( this, SVX_RES( FL_GEOMETRIE ) ),
+
+ aFtHorizontal ( this, SVX_RES( FT_HORIZONTAL ) ),
+ aNumHorizontal ( this, SVX_RES( NUM_HORIZONTAL ) ),
+ aFtVertical ( this, SVX_RES( FT_VERTICAL ) ),
+ aNumVertical ( this, SVX_RES( NUM_VERTICAL ) ),
+ aFLSegments ( this, SVX_RES( FL_SEGMENTS ) ),
+
+ aBtnNormalsObj ( this, SVX_RES( BTN_NORMALS_OBJ ) ),
+ aBtnNormalsFlat ( this, SVX_RES( BTN_NORMALS_FLAT ) ),
+ aBtnNormalsSphere ( this, SVX_RES( BTN_NORMALS_SPHERE ) ),
+ aBtnNormalsInvert ( this, SVX_RES( BTN_NORMALS_INVERT ) ),
+ aBtnTwoSidedLighting( this, SVX_RES( BTN_TWO_SIDED_LIGHTING ) ),
+ aFLNormals ( this, SVX_RES( FL_NORMALS ) ),
+
+ aBtnDoubleSided ( this, SVX_RES( BTN_DOUBLE_SIDED ) ),
+
+ // Darstellung
+ aFtShademode ( this, SVX_RES( FT_SHADEMODE ) ),
+ aLbShademode ( this, SVX_RES( LB_SHADEMODE ) ),
+ aBtnShadow3d ( this, SVX_RES( BTN_SHADOW_3D ) ),
+ aFtSlant ( this, SVX_RES( FT_SLANT ) ),
+ aMtrSlant ( this, SVX_RES( MTR_SLANT ) ),
+ aFLShadow ( this, SVX_RES( FL_SHADOW ) ),
+ aFtDistance ( this, SVX_RES( FT_DISTANCE ) ),
+ aMtrDistance ( this, SVX_RES( MTR_DISTANCE ) ),
+ aFtFocalLeng ( this, SVX_RES( FT_FOCAL_LENGTH ) ),
+ aMtrFocalLength ( this, SVX_RES( MTR_FOCAL_LENGTH ) ),
+ aFLCamera ( this, SVX_RES( FL_CAMERA ) ),
+ aFLRepresentation ( this, SVX_RES( FL_REPRESENTATION ) ),
+
+ // Beleuchtung
+ aBtnLight1 ( this, SVX_RES( BTN_LIGHT_1 ) ),
+ aBtnLight2 ( this, SVX_RES( BTN_LIGHT_2 ) ),
+ aBtnLight3 ( this, SVX_RES( BTN_LIGHT_3 ) ),
+ aBtnLight4 ( this, SVX_RES( BTN_LIGHT_4 ) ),
+ aBtnLight5 ( this, SVX_RES( BTN_LIGHT_5 ) ),
+ aBtnLight6 ( this, SVX_RES( BTN_LIGHT_6 ) ),
+ aBtnLight7 ( this, SVX_RES( BTN_LIGHT_7 ) ),
+ aBtnLight8 ( this, SVX_RES( BTN_LIGHT_8 ) ),
+ aLbLight1 ( this, SVX_RES( LB_LIGHT_1 ) ),
+ aLbLight2 ( this, SVX_RES( LB_LIGHT_2 ) ),
+ aLbLight3 ( this, SVX_RES( LB_LIGHT_3 ) ),
+ aLbLight4 ( this, SVX_RES( LB_LIGHT_4 ) ),
+ aLbLight5 ( this, SVX_RES( LB_LIGHT_5 ) ),
+ aLbLight6 ( this, SVX_RES( LB_LIGHT_6 ) ),
+ aLbLight7 ( this, SVX_RES( LB_LIGHT_7 ) ),
+ aLbLight8 ( this, SVX_RES( LB_LIGHT_8 ) ),
+
+ aBtnLightColor ( this, SVX_RES( BTN_LIGHT_COLOR ) ),
+ aFTLightsource ( this, SVX_RES( FT_LIGHTSOURCE ) ),
+
+ // #99694# Keyboard shortcuts activate the next control, so the
+ // order needed to be changed here
+ aFTAmbientlight ( this, SVX_RES( FT_AMBIENTLIGHT ) ), // Text label
+ aLbAmbientlight ( this, SVX_RES( LB_AMBIENTLIGHT ) ), // ListBox
+ aBtnAmbientColor ( this, SVX_RES( BTN_AMBIENT_COLOR ) ), // color button
+
+ aFLLight ( this, SVX_RES( FL_LIGHT ) ),
+
+ // Texturen
+ aFtTexKind ( this, SVX_RES( FT_TEX_KIND ) ),
+ aBtnTexLuminance ( this, SVX_RES( BTN_TEX_LUMINANCE ) ),
+ aBtnTexColor ( this, SVX_RES( BTN_TEX_COLOR ) ),
+ aFtTexMode ( this, SVX_RES( FT_TEX_MODE ) ),
+ aBtnTexReplace ( this, SVX_RES( BTN_TEX_REPLACE ) ),
+ aBtnTexModulate ( this, SVX_RES( BTN_TEX_MODULATE ) ),
+ aBtnTexBlend ( this, SVX_RES( BTN_TEX_BLEND ) ),
+ aFtTexProjectionX ( this, SVX_RES( FT_TEX_PROJECTION_X ) ),
+ aBtnTexObjectX ( this, SVX_RES( BTN_TEX_OBJECT_X ) ),
+ aBtnTexParallelX ( this, SVX_RES( BTN_TEX_PARALLEL_X ) ),
+ aBtnTexCircleX ( this, SVX_RES( BTN_TEX_CIRCLE_X ) ),
+ aFtTexProjectionY ( this, SVX_RES( FT_TEX_PROJECTION_Y ) ),
+ aBtnTexObjectY ( this, SVX_RES( BTN_TEX_OBJECT_Y ) ),
+ aBtnTexParallelY ( this, SVX_RES( BTN_TEX_PARALLEL_Y ) ),
+ aBtnTexCircleY ( this, SVX_RES( BTN_TEX_CIRCLE_Y ) ),
+ aFtTexFilter ( this, SVX_RES( FT_TEX_FILTER ) ),
+ aBtnTexFilter ( this, SVX_RES( BTN_TEX_FILTER ) ),
+ aFLTexture ( this, SVX_RES( FL_TEXTURE ) ),
+
+ // Material
+ aFtMatFavorites ( this, SVX_RES( FT_MAT_FAVORITES ) ),
+ aLbMatFavorites ( this, SVX_RES( LB_MAT_FAVORITES ) ),
+ aFtMatColor ( this, SVX_RES( FT_MAT_COLOR ) ),
+ aLbMatColor ( this, SVX_RES( LB_MAT_COLOR ) ),
+ aBtnMatColor ( this, SVX_RES( BTN_MAT_COLOR ) ),
+ aFtMatEmission ( this, SVX_RES( FT_MAT_EMISSION ) ),
+ aLbMatEmission ( this, SVX_RES( LB_MAT_EMISSION ) ),
+ aBtnEmissionColor ( this, SVX_RES( BTN_EMISSION_COLOR ) ),
+ aFtMatSpecular ( this, SVX_RES( FT_MAT_SPECULAR ) ),
+ aLbMatSpecular ( this, SVX_RES( LB_MAT_SPECULAR ) ),
+ aBtnSpecularColor ( this, SVX_RES( BTN_SPECULAR_COLOR ) ),
+ aFtMatSpecularIntensity( this, SVX_RES( FT_MAT_SPECULAR_INTENSITY ) ),
+ aMtrMatSpecularIntensity( this, SVX_RES( MTR_MAT_SPECULAR_INTENSITY ) ),
+ aFLMatSpecular ( this, SVX_RES( FL_MAT_SPECULAR ) ),
+ aFLMaterial ( this, SVX_RES( FL_MATERIAL ) ),
+
+ // Unterer Bereich
+ aBtnConvertTo3D ( this, SVX_RES( BTN_CHANGE_TO_3D ) ),
+ aBtnLatheObject ( this, SVX_RES( BTN_LATHE_OBJ ) ),
+ aBtnPerspective ( this, SVX_RES( BTN_PERSPECTIVE ) ),
+ aCtlPreview ( this, SVX_RES( CTL_PREVIEW ) ),
+ aCtlLightPreview ( this, SVX_RES( CTL_LIGHT_PREVIEW ) ),
+
+ aImgLightOn ( SVX_RES( RID_SVXIMAGE_LIGHT_ON ) ),
+ aImgLightOff ( SVX_RES( RID_SVXIMAGE_LIGHT_OFF ) ),
+
+ bUpdate ( sal_False ),
+ eViewType ( VIEWTYPE_GEO ),
+
+ pModel ( NULL ),
+ pFmPage ( NULL ),
+ pVDev ( NULL ),
+ p3DView ( NULL ),
+ pFavorSetList ( NULL ),
+ pMatFavSetList ( NULL ),
+
+ pBindings ( pInBindings ),
+ pControllerItem(0L),
+ pConvertTo3DItem(0L),
+ pConvertTo3DLatheItem(0L),
+// pPool ( NULL ),
+ mpImpl ( new Svx3DWinImpl() ),
+ mpRemember2DAttributes(NULL),
+ bOnly3DChanged ( sal_False )
+{
+ SETHCIMAGE( aBtnGeo, BMP_GEO_H );
+ SETHCIMAGE( aBtnRepresentation, BMP_REPRESENTATION_H );
+ SETHCIMAGE( aBtnLight, BMP_3DLIGHT_H );
+ SETHCIMAGE( aBtnTexture, BMP_TEXTURE_H );
+ SETHCIMAGE( aBtnMaterial, BMP_MATERIAL_H );
+ SETHCIMAGE( aBtnUpdate, BMP_UPDATE_H );
+ SETHCIMAGE( aBtnAssign, BMP_ASSIGN_H );
+ SETHCIMAGE( aBtnNormalsObj, BMP_NORMALS_OBJ_H );
+ SETHCIMAGE( aBtnNormalsFlat, BMP_NORMALS_FLAT_H );
+ SETHCIMAGE( aBtnNormalsSphere, BMP_NORMALS_SPHERE_H );
+ SETHCIMAGE( aBtnTwoSidedLighting, BMP_TWO_SIDED_LIGHTING_H );
+ SETHCIMAGE( aBtnNormalsInvert, BMP_NORMALS_INVERT_H );
+ SETHCIMAGE( aBtnDoubleSided, BMP_DOUBLE_SIDED_H );
+ SETHCIMAGE( aBtnShadow3d, BMP_SHADOW_3D_H );
+ SETHCIMAGE( aBtnLight1, BMP_LIGHT_H );
+ SETHCIMAGE( aBtnLight2, BMP_LIGHT_H );
+ SETHCIMAGE( aBtnLight3, BMP_LIGHT_H );
+ SETHCIMAGE( aBtnLight4, BMP_LIGHT_H );
+ SETHCIMAGE( aBtnLight5, BMP_LIGHT_H );
+ SETHCIMAGE( aBtnLight6, BMP_LIGHT_H );
+ SETHCIMAGE( aBtnLight7, BMP_LIGHT_H );
+ SETHCIMAGE( aBtnLight8, BMP_LIGHT_H );
+ SETHCIMAGE( aBtnLightColor, BMP_LIGHT_COLOR_H );
+ SETHCIMAGE( aBtnAmbientColor, BMP_AMBIENT_COLOR_H );
+ SETHCIMAGE( aBtnTexLuminance, BMP_TEX_LUMINANCE_H );
+ SETHCIMAGE( aBtnTexColor, BMP_TEX_COLOR_H );
+ SETHCIMAGE( aBtnTexReplace, BMP_TEX_REPLACE_H );
+ SETHCIMAGE( aBtnTexModulate, BMP_TEX_MODULATE_H );
+ SETHCIMAGE( aBtnTexBlend, BMP_TEX_BLEND_H );
+ SETHCIMAGE( aBtnTexParallelX, BMP_TEX_PARALLEL_H );
+ SETHCIMAGE( aBtnTexCircleX, BMP_TEX_CIRCLE_H );
+ SETHCIMAGE( aBtnTexObjectX, BMP_TEX_OBJECT_H );
+ SETHCIMAGE( aBtnTexParallelY, BMP_TEX_PARALLEL_H );
+ SETHCIMAGE( aBtnTexCircleY, BMP_TEX_CIRCLE_H );
+ SETHCIMAGE( aBtnTexObjectY, BMP_TEX_OBJECT_H );
+ SETHCIMAGE( aBtnTexFilter, BMP_TEX_FILTER_H );
+ SETHCIMAGE( aBtnMatColor, BMP_COLORDLG_H );
+ SETHCIMAGE( aBtnEmissionColor, BMP_COLORDLG_H );
+ SETHCIMAGE( aBtnSpecularColor, BMP_COLORDLG_H );
+ SETHCIMAGE( aBtnPerspective, BMP_PERSPECTIVE_H );
+ SETHCIMAGE( aBtnConvertTo3D, BMP_CHANGE_TO_3D_H );
+ SETHCIMAGE( aBtnLatheObject, BMP_LATHE_OBJ_H );
+
+ mpImpl->pPool = NULL;
+ mpImpl->maImgLightOnH = Image( SVX_RES( RID_SVXIMAGE_LIGHT_ON_H ) );
+ mpImpl->maImgLightOffH = Image( SVX_RES( RID_SVXIMAGE_LIGHT_OFF_H ) );
+ FreeResource();
+
+ // Metrik einstellen
+ eFUnit = pInBindings->GetDispatcher()->GetModule()->GetFieldUnit();
+
+ aMtrDepth.SetUnit( eFUnit );
+ aMtrDistance.SetUnit( eFUnit );
+ aMtrFocalLength.SetUnit( eFUnit );
+
+ pControllerItem = new Svx3DCtrlItem(SID_3D_STATE, this, pBindings);
+ pConvertTo3DItem = new SvxConvertTo3DItem(SID_CONVERT_TO_3D, pBindings);
+ pConvertTo3DLatheItem = new SvxConvertTo3DItem(SID_CONVERT_TO_3D_LATHE_FAST, pBindings);
+
+ aBtnAssign.SetClickHdl( LINK( this, Svx3DWin, ClickAssignHdl ) );
+ aBtnUpdate.SetClickHdl( LINK( this, Svx3DWin, ClickUpdateHdl ) );
+
+ Link aLink( LINK( this, Svx3DWin, ClickViewTypeHdl ) );
+ aBtnGeo.SetClickHdl( aLink );
+ aBtnRepresentation.SetClickHdl( aLink );
+ aBtnLight.SetClickHdl( aLink );
+ aBtnTexture.SetClickHdl( aLink );
+ aBtnMaterial.SetClickHdl( aLink );
+
+ aLink = LINK( this, Svx3DWin, ClickHdl );
+ aBtnPerspective.SetClickHdl( aLink );
+ aBtnConvertTo3D.SetClickHdl( aLink );
+ aBtnLatheObject.SetClickHdl( aLink );
+
+ // Geometrie
+ aBtnNormalsObj.SetClickHdl( aLink );
+ aBtnNormalsFlat.SetClickHdl( aLink );
+ aBtnNormalsSphere.SetClickHdl( aLink );
+ aBtnTwoSidedLighting.SetClickHdl( aLink );
+ aBtnNormalsInvert.SetClickHdl( aLink );
+ aBtnDoubleSided.SetClickHdl( aLink );
+
+ // Darstellung
+ aBtnShadow3d.SetClickHdl( aLink );
+
+ // Beleuchtung
+ aBtnLight1.SetClickHdl( aLink );
+ aBtnLight2.SetClickHdl( aLink );
+ aBtnLight3.SetClickHdl( aLink );
+ aBtnLight4.SetClickHdl( aLink );
+ aBtnLight5.SetClickHdl( aLink );
+ aBtnLight6.SetClickHdl( aLink );
+ aBtnLight7.SetClickHdl( aLink );
+ aBtnLight8.SetClickHdl( aLink );
+
+ // Texturen
+ aBtnTexLuminance.SetClickHdl( aLink );
+ aBtnTexColor.SetClickHdl( aLink );
+ aBtnTexReplace.SetClickHdl( aLink );
+ aBtnTexModulate.SetClickHdl( aLink );
+ //aBtnTexBlend.SetClickHdl( aLink );
+ aBtnTexParallelX.SetClickHdl( aLink );
+ aBtnTexCircleX.SetClickHdl( aLink );
+ aBtnTexObjectX.SetClickHdl( aLink );
+ aBtnTexParallelY.SetClickHdl( aLink );
+ aBtnTexCircleY.SetClickHdl( aLink );
+ aBtnTexObjectY.SetClickHdl( aLink );
+ aBtnTexFilter.SetClickHdl( aLink );
+
+ // Material
+ aLink = LINK( this, Svx3DWin, ClickColorHdl );
+ aBtnLightColor.SetClickHdl( aLink );
+ aBtnAmbientColor.SetClickHdl( aLink );
+ aBtnMatColor.SetClickHdl( aLink );
+ aBtnEmissionColor.SetClickHdl( aLink );
+ aBtnSpecularColor.SetClickHdl( aLink );
+
+
+ aLink = LINK( this, Svx3DWin, SelectHdl );
+ aLbMatFavorites.SetSelectHdl( aLink );
+ aLbMatColor.SetSelectHdl( aLink );
+ aLbMatEmission.SetSelectHdl( aLink );
+ aLbMatSpecular.SetSelectHdl( aLink );
+ aLbLight1.SetSelectHdl( aLink );
+ aLbLight2.SetSelectHdl( aLink );
+ aLbLight3.SetSelectHdl( aLink );
+ aLbLight4.SetSelectHdl( aLink );
+ aLbLight5.SetSelectHdl( aLink );
+ aLbLight6.SetSelectHdl( aLink );
+ aLbLight7.SetSelectHdl( aLink );
+ aLbLight8.SetSelectHdl( aLink );
+ aLbAmbientlight.SetSelectHdl( aLink );
+ aLbShademode.SetSelectHdl( aLink );
+
+ aLink = LINK( this, Svx3DWin, ModifyHdl );
+ aMtrMatSpecularIntensity.SetModifyHdl( aLink );
+ aNumHorizontal.SetModifyHdl( aLink );
+ aNumVertical.SetModifyHdl( aLink );
+ aMtrSlant.SetModifyHdl( aLink );
+
+ // Preview-Callback
+ aLink = LINK( this, Svx3DWin, ChangeLightCallbackHdl );
+ aCtlLightPreview.SetUserInteractiveChangeCallback(aLink);
+ aLink = LINK( this, Svx3DWin, ChangeSelectionCallbackHdl );
+ aCtlLightPreview.SetUserSelectionChangeCallback(aLink);
+
+ aSize = GetOutputSizePixel();
+ SetMinOutputSizePixel( aSize );
+
+ Construct();
+
+ // Initiierung der Initialisierung der ColorLBs
+ SfxDispatcher* pDispatcher = LocalGetDispatcher(pBindings);
+ if (pDispatcher != NULL)
+ {
+ SfxBoolItem aItem( SID_3D_INIT, sal_True );
+ pDispatcher->Execute(
+ SID_3D_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
+ }
+
+ Reset();
+}
+
+// -----------------------------------------------------------------------
+__EXPORT Svx3DWin::~Svx3DWin()
+{
+ //delete pMatFavSetList;
+ delete p3DView;
+ delete pVDev;
+ delete pModel;
+
+ delete pControllerItem;
+ delete pConvertTo3DItem;
+ delete pConvertTo3DLatheItem;
+
+ if(mpRemember2DAttributes)
+ delete mpRemember2DAttributes;
+
+ delete mpImpl;
+}
+
+// -----------------------------------------------------------------------
+void Svx3DWin::Construct()
+{
+ aBtnGeo.Check();
+ Link aLink( LINK( this, Svx3DWin, ClickViewTypeHdl ) );
+ aLink.Call( &aBtnGeo );
+ aCtlLightPreview.Hide();
+}
+
+// -----------------------------------------------------------------------
+void Svx3DWin::Reset()
+{
+ // Diverse Initialisierungen, default ist AllAttributes
+ aLbShademode.SelectEntryPos( 0 );
+ aMtrMatSpecularIntensity.SetValue( 50 );
+
+ aBtnLight1.Check();
+ ClickUpdateHdl( NULL );
+
+ // Nichts selektieren, um Fehler beim erstselektieren zu vermeiden
+ aCtlLightPreview.GetSvx3DLightControl().SelectLight(0);
+}
+
+bool Svx3DWin::GetUILightState( ImageButton& aBtn ) const
+{
+ return (aBtn.GetModeImage() == aImgLightOn) || (aBtn.GetModeImage() == mpImpl->maImgLightOnH);
+}
+
+void Svx3DWin::SetUILightState( ImageButton& aBtn, bool bState )
+{
+ aBtn.SetModeImage( bState ? aImgLightOn : aImgLightOff );
+ aBtn.SetModeImage( bState ? mpImpl->maImgLightOnH : mpImpl->maImgLightOffH, BMP_COLOR_HIGHCONTRAST );
+}
+
+// -----------------------------------------------------------------------
+void Svx3DWin::Update( SfxItemSet& rAttrs )
+{
+ // remember 2d attributes
+ if(mpRemember2DAttributes)
+ mpRemember2DAttributes->ClearItem();
+ else
+ mpRemember2DAttributes = new SfxItemSet(*rAttrs.GetPool(),
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_3D_FIRST, SDRATTR_3D_LAST,
+ 0, 0);
+
+ SfxWhichIter aIter(*mpRemember2DAttributes);
+ sal_uInt16 nWhich(aIter.FirstWhich());
+
+ while(nWhich)
+ {
+ SfxItemState eState = rAttrs.GetItemState(nWhich, sal_False);
+ if(SFX_ITEM_DONTCARE == eState)
+ mpRemember2DAttributes->InvalidateItem(nWhich);
+ else if(SFX_ITEM_SET == eState)
+ mpRemember2DAttributes->Put(rAttrs.Get(nWhich, sal_False));
+
+ nWhich = aIter.NextWhich();
+ }
+
+ // construct field values
+ const SfxPoolItem* pItem;
+ //sal_Bool bUpdate = sal_False;
+
+ // evtl. PoolUnit ermitteln
+ if( !mpImpl->pPool )
+ {
+ mpImpl->pPool = rAttrs.GetPool();
+ DBG_ASSERT( mpImpl->pPool, "Wo ist der Pool?" );
+ ePoolUnit = mpImpl->pPool->GetMetric( SID_ATTR_LINE_WIDTH );
+ }
+ eFUnit = GetModuleFieldUnit( rAttrs );
+
+
+// Segmentanzahl aenderbar ? und andere Stati
+ SfxItemState eState = rAttrs.GetItemState( SID_ATTR_3D_INTERN, sal_False, &pItem );
+ if( SFX_ITEM_SET == eState )
+ {
+ sal_uInt32 nState = ( ( const SfxUInt32Item* )pItem )->GetValue();
+ //sal_Bool bLathe = (sal_Bool) ( nState & 1 );
+ sal_Bool bExtrude = (sal_Bool) ( nState & 2 );
+ sal_Bool bSphere = (sal_Bool) ( nState & 4 );
+ sal_Bool bCube = (sal_Bool) ( nState & 8 );
+
+ sal_Bool bChart = (sal_Bool) ( nState & 32 ); // Chart
+
+ if( !bChart )
+ {
+ // Bei Cube-Objekten werden keine Segmente eingestellt
+ aFtHorizontal.Enable( !bCube );
+ aNumHorizontal.Enable( !bCube );
+ aFtVertical.Enable( !bCube );
+ aNumVertical.Enable( !bCube );
+ aFLSegments.Enable( !bCube );
+
+ aFtPercentDiagonal.Enable( !bCube && !bSphere );
+ aMtrPercentDiagonal.Enable( !bCube && !bSphere );
+ aFtBackscale.Enable( !bCube && !bSphere );
+ aMtrBackscale.Enable( !bCube && !bSphere );
+ aFtDepth.Enable( !bCube && !bSphere );
+ aMtrDepth.Enable( !bCube && !bSphere );
+ if( bCube )
+ {
+ aNumHorizontal.SetEmptyFieldValue();
+ aNumVertical.SetEmptyFieldValue();
+ }
+ if( bCube || bSphere )
+ {
+ aMtrPercentDiagonal.SetEmptyFieldValue();
+ aMtrBackscale.SetEmptyFieldValue();
+ aMtrDepth.SetEmptyFieldValue();
+ }
+
+ // Nur bei Lathe-Objekten gibt es einen Endwinkel
+ aFtEndAngle.Enable( !bExtrude && !bCube && !bSphere );
+ aMtrEndAngle.Enable( !bExtrude && !bCube && !bSphere );
+ if( bExtrude || bCube || bSphere )
+ aMtrEndAngle.SetEmptyFieldValue();
+ }
+ else
+ {
+ // Geometrie
+ aFtHorizontal.Enable( sal_False );
+ aNumHorizontal.Enable( sal_False );
+ aNumHorizontal.SetEmptyFieldValue();
+ aFtVertical.Enable( sal_False );
+ aNumVertical.Enable( sal_False );
+ aNumVertical.SetEmptyFieldValue();
+ aFLSegments.Enable( sal_False );
+ aFtEndAngle.Enable( sal_False );
+ aMtrEndAngle.Enable( sal_False );
+ aMtrEndAngle.SetEmptyFieldValue();
+ aFtDepth.Enable( sal_False );
+ aMtrDepth.Enable( sal_False );
+ aMtrDepth.SetEmptyFieldValue();
+
+ // Darstellung
+ aBtnShadow3d.Enable( sal_False );
+ aFtSlant.Enable( sal_False );
+ aMtrSlant.Enable( sal_False );
+ aFLShadow.Enable( sal_False );
+
+ aFtDistance.Enable( sal_False );
+ aMtrDistance.Enable( sal_False );
+ aMtrDistance.SetEmptyFieldValue();
+ aFtFocalLeng.Enable( sal_False );
+ aMtrFocalLength.Enable( sal_False );
+ aMtrFocalLength.SetEmptyFieldValue();
+ aFLCamera.Enable( sal_False );
+
+ // Unterer Bereich
+ aBtnConvertTo3D.Enable( sal_False );
+ aBtnLatheObject.Enable( sal_False );
+ }
+ }
+// Bitmapfuellung ? -> Status
+ sal_Bool bBitmap(sal_False);
+ eState = rAttrs.GetItemState(XATTR_FILLSTYLE);
+ if(eState != SFX_ITEM_DONTCARE)
+ {
+ XFillStyle eXFS = (XFillStyle)((const XFillStyleItem&)rAttrs.Get(XATTR_FILLSTYLE)).GetValue();
+ bBitmap = (eXFS == XFILL_BITMAP || eXFS == XFILL_GRADIENT || eXFS == XFILL_HATCH);
+ }
+
+ aFtTexKind.Enable( bBitmap );
+ aBtnTexLuminance.Enable( bBitmap );
+ aBtnTexColor.Enable( bBitmap );
+ aFtTexMode.Enable( bBitmap );
+ aBtnTexReplace.Enable( bBitmap );
+ aBtnTexModulate.Enable( bBitmap );
+ aBtnTexBlend.Enable( bBitmap );
+ aFtTexProjectionX.Enable( bBitmap );
+ aBtnTexParallelX.Enable( bBitmap );
+ aBtnTexCircleX.Enable( bBitmap );
+ aBtnTexObjectX.Enable( bBitmap );
+ aFtTexProjectionY.Enable( bBitmap );
+ aBtnTexParallelY.Enable( bBitmap );
+ aBtnTexCircleY.Enable( bBitmap );
+ aBtnTexObjectY.Enable( bBitmap );
+ aFtTexFilter.Enable( bBitmap );
+ aBtnTexFilter.Enable( bBitmap );
+ aFLTexture.Enable( bBitmap );
+
+
+// Geometrie
+ // Anzahl Segmente (horizontal)
+ if( aNumHorizontal.IsEnabled() )
+ {
+ eState = rAttrs.GetItemState(SDRATTR_3DOBJ_HORZ_SEGS);
+ if(eState != SFX_ITEM_DONTCARE)
+ {
+ sal_uInt32 nValue = ((const Svx3DHorizontalSegmentsItem&)rAttrs.Get(SDRATTR_3DOBJ_HORZ_SEGS)).GetValue();
+ if(nValue != (sal_uInt32 )aNumHorizontal.GetValue())
+ {
+ aNumHorizontal.SetValue( nValue );
+ // evtl. am Ende...
+ // aCtlLightPreview.GetSvx3DLightControl().SetHorizontalSegments( (sal_uInt16)nValue );
+ bUpdate = sal_True;
+ }
+ else if( aNumHorizontal.IsEmptyFieldValue() )
+ aNumHorizontal.SetValue( nValue );
+ }
+ else
+ {
+ if( !aNumHorizontal.IsEmptyFieldValue() )
+ {
+ aNumHorizontal.SetEmptyFieldValue();
+ bUpdate = sal_True;
+ }
+ }
+ }
+
+ // Anzahl Segmente (vertikal)
+ if( aNumVertical.IsEnabled() )
+ {
+ eState = rAttrs.GetItemState(SDRATTR_3DOBJ_VERT_SEGS);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ sal_uInt32 nValue = ((const Svx3DVerticalSegmentsItem&)rAttrs.Get(SDRATTR_3DOBJ_VERT_SEGS)).GetValue();
+ if( nValue != (sal_uInt32) aNumVertical.GetValue() )
+ {
+ aNumVertical.SetValue( nValue );
+ // evtl. am Ende...
+ //aCtlLightPreview.GetSvx3DLightControl().SetVerticalSegments( (sal_uInt16)nValue );
+ bUpdate = sal_True;
+ }
+ else if( aNumVertical.IsEmptyFieldValue() )
+ aNumVertical.SetValue( nValue );
+ }
+ else
+ {
+ if( !aNumVertical.IsEmptyFieldValue() )
+ {
+ aNumVertical.SetEmptyFieldValue();
+ bUpdate = sal_True;
+ }
+ }
+ }
+
+ // Tiefe
+ if( aMtrDepth.IsEnabled() )
+ {
+ eState = rAttrs.GetItemState(SDRATTR_3DOBJ_DEPTH);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ sal_uInt32 nValue = ((const Svx3DDepthItem&)rAttrs.Get(SDRATTR_3DOBJ_DEPTH)).GetValue();
+ sal_uInt32 nValue2 = GetCoreValue( aMtrDepth, ePoolUnit );
+ if( nValue != nValue2 )
+ {
+ if( eFUnit != aMtrDepth.GetUnit() )
+ SetFieldUnit( aMtrDepth, eFUnit );
+
+ SetMetricValue( aMtrDepth, nValue, ePoolUnit );
+ bUpdate = sal_True;
+ }
+ else if( aMtrDepth.IsEmptyFieldValue() )
+ aMtrDepth.SetValue( aMtrDepth.GetValue() );
+ }
+ else
+ {
+ if( !aMtrDepth.IsEmptyFieldValue() )
+ {
+ aMtrDepth.SetEmptyFieldValue();
+ bUpdate = sal_True;
+ }
+ }
+ }
+
+ // Doppelwandig/-seitig
+ eState = rAttrs.GetItemState(SDRATTR_3DOBJ_DOUBLE_SIDED);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ sal_Bool bValue = ((const Svx3DDoubleSidedItem&)rAttrs.Get(SDRATTR_3DOBJ_DOUBLE_SIDED)).GetValue();
+ if( bValue != aBtnDoubleSided.IsChecked() )
+ {
+ aBtnDoubleSided.Check( bValue );
+ bUpdate = sal_True;
+ }
+ else if( aBtnDoubleSided.GetState() == STATE_DONTKNOW )
+ aBtnDoubleSided.Check( bValue );
+ }
+ else
+ {
+ if( aBtnDoubleSided.GetState() != STATE_DONTKNOW )
+ {
+ aBtnDoubleSided.SetState( STATE_DONTKNOW );
+ bUpdate = sal_True;
+ }
+ }
+
+ // Kantenrundung
+ if( aMtrPercentDiagonal.IsEnabled() )
+ {
+ eState = rAttrs.GetItemState(SDRATTR_3DOBJ_PERCENT_DIAGONAL);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ sal_uInt16 nValue = ((const Svx3DPercentDiagonalItem&)rAttrs.Get(SDRATTR_3DOBJ_PERCENT_DIAGONAL)).GetValue();
+ if( nValue != aMtrPercentDiagonal.GetValue() )
+ {
+ aMtrPercentDiagonal.SetValue( nValue );
+ bUpdate = sal_True;
+ }
+ else if( aMtrPercentDiagonal.IsEmptyFieldValue() )
+ aMtrPercentDiagonal.SetValue( nValue );
+ }
+ else
+ {
+ if( !aMtrPercentDiagonal.IsEmptyFieldValue() )
+ {
+ aMtrPercentDiagonal.SetEmptyFieldValue();
+ bUpdate = sal_True;
+ }
+ }
+ }
+
+ // Tiefenskalierung
+ if( aMtrBackscale.IsEnabled() )
+ {
+ eState = rAttrs.GetItemState(SDRATTR_3DOBJ_BACKSCALE);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ sal_uInt16 nValue = ((const Svx3DBackscaleItem&)rAttrs.Get(SDRATTR_3DOBJ_BACKSCALE)).GetValue();
+ if( nValue != aMtrBackscale.GetValue() )
+ {
+ aMtrBackscale.SetValue( nValue );
+ bUpdate = sal_True;
+ }
+ else if( aMtrBackscale.IsEmptyFieldValue() )
+ aMtrBackscale.SetValue( nValue );
+ }
+ else
+ {
+ if( !aMtrBackscale.IsEmptyFieldValue() )
+ {
+ aMtrBackscale.SetEmptyFieldValue();
+ bUpdate = sal_True;
+ }
+ }
+ }
+
+ // Endwinkel
+ if( aMtrEndAngle.IsEnabled() )
+ {
+ eState = rAttrs.GetItemState(SDRATTR_3DOBJ_END_ANGLE);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ sal_Int32 nValue = ((const Svx3DEndAngleItem&)rAttrs.Get(SDRATTR_3DOBJ_END_ANGLE)).GetValue();
+ if( nValue != aMtrEndAngle.GetValue() )
+ {
+ aMtrEndAngle.SetValue( nValue );
+ bUpdate = sal_True;
+ }
+ }
+ else
+ {
+ if( !aMtrEndAngle.IsEmptyFieldValue() )
+ {
+ aMtrEndAngle.SetEmptyFieldValue();
+ bUpdate = sal_True;
+ }
+ }
+ }
+
+ // Normalentyp
+ eState = rAttrs.GetItemState(SDRATTR_3DOBJ_NORMALS_KIND);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ sal_uInt16 nValue = ((const Svx3DNormalsKindItem&)rAttrs.Get(SDRATTR_3DOBJ_NORMALS_KIND)).GetValue();
+
+ if( ( !aBtnNormalsObj.IsChecked() && nValue == 0 ) ||
+ ( !aBtnNormalsFlat.IsChecked() && nValue == 1 ) ||
+ ( !aBtnNormalsSphere.IsChecked() && nValue == 2 ) )
+ {
+ aBtnNormalsObj.Check( nValue == 0 );
+ aBtnNormalsFlat.Check( nValue == 1 );
+ aBtnNormalsSphere.Check( nValue == 2 );
+ bUpdate = sal_True;
+ }
+ }
+ else
+ {
+ if( aBtnNormalsObj.IsChecked() ||
+ aBtnNormalsFlat.IsChecked() ||
+ aBtnNormalsSphere.IsChecked() )
+ {
+ aBtnNormalsObj.Check( sal_False );
+ aBtnNormalsFlat.Check( sal_False );
+ aBtnNormalsSphere.Check( sal_False );
+ bUpdate = sal_True;
+ }
+ }
+
+ // Normalen invertieren
+ eState = rAttrs.GetItemState(SDRATTR_3DOBJ_NORMALS_INVERT);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ sal_Bool bValue = ((const Svx3DNormalsInvertItem&)rAttrs.Get(SDRATTR_3DOBJ_NORMALS_INVERT)).GetValue();
+ if( bValue != aBtnNormalsInvert.IsChecked() )
+ {
+ aBtnNormalsInvert.Check( bValue );
+ bUpdate = sal_True;
+ }
+ else if( aBtnNormalsInvert.GetState() == STATE_DONTKNOW )
+ aBtnNormalsInvert.Check( bValue );
+ }
+ else
+ {
+ if( aBtnNormalsInvert.GetState() != STATE_DONTKNOW )
+ {
+ aBtnNormalsInvert.SetState( STATE_DONTKNOW );
+ bUpdate = sal_True;
+ }
+ }
+
+ // 2-seitige Beleuchtung
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ sal_Bool bValue = ((const Svx3DTwoSidedLightingItem&)rAttrs.Get(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING)).GetValue();
+ if( bValue != aBtnTwoSidedLighting.IsChecked() )
+ {
+ aBtnTwoSidedLighting.Check( bValue );
+ bUpdate = sal_True;
+ }
+ else if( aBtnTwoSidedLighting.GetState() == STATE_DONTKNOW )
+ aBtnTwoSidedLighting.Check( bValue );
+ }
+ else
+ {
+ if( aBtnTwoSidedLighting.GetState() != STATE_DONTKNOW )
+ {
+ aBtnTwoSidedLighting.SetState( STATE_DONTKNOW );
+ bUpdate = sal_True;
+ }
+ }
+
+// Darstellung
+ // Shademode
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_SHADE_MODE);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ sal_uInt16 nValue = ((const Svx3DShadeModeItem&)rAttrs.Get(SDRATTR_3DSCENE_SHADE_MODE)).GetValue();
+ if( nValue != aLbShademode.GetSelectEntryPos() )
+ {
+ aLbShademode.SelectEntryPos( nValue );
+ bUpdate = sal_True;
+ }
+ }
+ else
+ {
+ if( aLbShademode.GetSelectEntryCount() != 0 )
+ {
+ aLbShademode.SetNoSelection();
+ bUpdate = sal_True;
+ }
+ }
+
+ // 3D-Shatten
+ eState = rAttrs.GetItemState(SDRATTR_3DOBJ_SHADOW_3D);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ sal_Bool bValue = ((const Svx3DShadow3DItem&)rAttrs.Get(SDRATTR_3DOBJ_SHADOW_3D)).GetValue();
+ if( bValue != aBtnShadow3d.IsChecked() )
+ {
+ aBtnShadow3d.Check( bValue );
+ aFtSlant.Enable( bValue );
+ aMtrSlant.Enable( bValue );
+ bUpdate = sal_True;
+ }
+ else if( aBtnShadow3d.GetState() == STATE_DONTKNOW )
+ aBtnShadow3d.Check( bValue );
+ }
+ else
+ {
+ if( aBtnShadow3d.GetState() != STATE_DONTKNOW )
+ {
+ aBtnShadow3d.SetState( STATE_DONTKNOW );
+ bUpdate = sal_True;
+ }
+ }
+
+ // Neigung (Schatten)
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_SHADOW_SLANT);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ sal_uInt16 nValue = ((const Svx3DShadowSlantItem&)rAttrs.Get(SDRATTR_3DSCENE_SHADOW_SLANT)).GetValue();
+ if( nValue != aMtrSlant.GetValue() )
+ {
+ aMtrSlant.SetValue( nValue );
+ bUpdate = sal_True;
+ }
+ }
+ else
+ {
+ if( !aMtrSlant.IsEmptyFieldValue() )
+ {
+ aMtrSlant.SetEmptyFieldValue();
+ bUpdate = sal_True;
+ }
+ }
+
+ // Distanz
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_DISTANCE);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ sal_uInt32 nValue = ((const Svx3DDistanceItem&)rAttrs.Get(SDRATTR_3DSCENE_DISTANCE)).GetValue();
+ sal_uInt32 nValue2 = GetCoreValue( aMtrDistance, ePoolUnit );
+ if( nValue != nValue2 )
+ {
+ if( eFUnit != aMtrDistance.GetUnit() )
+ SetFieldUnit( aMtrDistance, eFUnit );
+
+ SetMetricValue( aMtrDistance, nValue, ePoolUnit );
+ bUpdate = sal_True;
+ }
+ }
+ else
+ {
+ if( !aMtrDepth.IsEmptyFieldValue() )
+ {
+ aMtrDepth.SetEmptyFieldValue();
+ bUpdate = sal_True;
+ }
+ }
+
+ // Brennweite
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_FOCAL_LENGTH);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ sal_uInt32 nValue = ((const Svx3DFocalLengthItem&)rAttrs.Get(SDRATTR_3DSCENE_FOCAL_LENGTH)).GetValue();
+ sal_uInt32 nValue2 = GetCoreValue( aMtrFocalLength, ePoolUnit );
+ if( nValue != nValue2 )
+ {
+ if( eFUnit != aMtrFocalLength.GetUnit() )
+ SetFieldUnit( aMtrFocalLength, eFUnit );
+
+ SetMetricValue( aMtrFocalLength, nValue, ePoolUnit );
+ bUpdate = sal_True;
+ }
+ }
+ else
+ {
+ if( !aMtrFocalLength.IsEmptyFieldValue() )
+ {
+ aMtrFocalLength.SetEmptyFieldValue();
+ bUpdate = sal_True;
+ }
+ }
+
+// Beleuchtung
+ Color aColor;
+ basegfx::B3DVector aVector;
+ // Licht 1 (Farbe)
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_1);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ aColor = ((const Svx3DLightcolor1Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1)).GetValue();
+ ColorLB* pLb = &aLbLight1;
+ if( aColor != pLb->GetSelectEntryColor() )
+ {
+ LBSelectColor( pLb, aColor );
+ bUpdate = sal_True;
+ }
+ }
+ else
+ {
+ if( aLbLight1.GetSelectEntryCount() != 0 )
+ {
+ aLbLight1.SetNoSelection();
+ bUpdate = sal_True;
+ }
+ }
+ // Licht 1 (an/aus)
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_1);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ bool bOn = ((const Svx3DLightOnOff1Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_1)).GetValue() != 0;
+ if( ( bOn && !GetUILightState( aBtnLight1 )) ||
+ ( !bOn && GetUILightState( aBtnLight1 )) )
+ {
+ SetUILightState( aBtnLight1, bOn );
+ bUpdate = sal_True;
+ }
+ if( aBtnLight1.GetState() == STATE_DONTKNOW )
+ aBtnLight1.Check( aBtnLight1.IsChecked() );
+ }
+ else
+ {
+ if( aBtnLight1.GetState() != STATE_DONTKNOW )
+ {
+ aBtnLight1.SetState( STATE_DONTKNOW );
+ bUpdate = sal_True;
+ }
+ }
+ // Licht 1 (Richtung)
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_1);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ bUpdate = sal_True;
+ }
+
+ // Licht 2 (Farbe)
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_2);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ aColor = ((const Svx3DLightcolor2Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_2)).GetValue();
+ ColorLB* pLb = &aLbLight2;
+ if( aColor != pLb->GetSelectEntryColor() )
+ {
+ LBSelectColor( pLb, aColor );
+ bUpdate = sal_True;
+ }
+ }
+ else
+ {
+ if( aLbLight2.GetSelectEntryCount() != 0 )
+ {
+ aLbLight2.SetNoSelection();
+ bUpdate = sal_True;
+ }
+ }
+ // Licht 2 (an/aus)
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_2);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ bool bOn = ((const Svx3DLightOnOff2Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_2)).GetValue() != 0;
+ if( ( bOn && !GetUILightState( aBtnLight2 )) ||
+ ( !bOn && GetUILightState( aBtnLight2 )) )
+ {
+ SetUILightState( aBtnLight2, bOn );
+ bUpdate = sal_True;
+ }
+ if( aBtnLight2.GetState() == STATE_DONTKNOW )
+ aBtnLight2.Check( aBtnLight2.IsChecked() );
+ }
+ else
+ {
+ if( aBtnLight2.GetState() != STATE_DONTKNOW )
+ {
+ aBtnLight2.SetState( STATE_DONTKNOW );
+ bUpdate = sal_True;
+ }
+ }
+ // Licht 2 (Richtung)
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_2);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ bUpdate = sal_True;
+ }
+
+ // Licht 3 (Farbe)
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_3);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ aColor = ((const Svx3DLightcolor3Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_3)).GetValue();
+ ColorLB* pLb = &aLbLight3;
+ if( aColor != pLb->GetSelectEntryColor() )
+ {
+ LBSelectColor( pLb, aColor );
+ bUpdate = sal_True;
+ }
+ }
+ else
+ {
+ if( aLbLight3.GetSelectEntryCount() != 0 )
+ {
+ aLbLight3.SetNoSelection();
+ bUpdate = sal_True;
+ }
+ }
+ // Licht 3 (an/aus)
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_3);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ bool bOn = ((const Svx3DLightOnOff3Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_3)).GetValue() != 0;
+ if( ( bOn && !GetUILightState( aBtnLight3)) ||
+ ( !bOn && GetUILightState( aBtnLight3)) )
+ {
+ SetUILightState( aBtnLight3, bOn );
+ bUpdate = sal_True;
+ }
+ if( aBtnLight3.GetState() == STATE_DONTKNOW )
+ aBtnLight3.Check( aBtnLight3.IsChecked() );
+ }
+ else
+ {
+ if( aBtnLight3.GetState() != STATE_DONTKNOW )
+ {
+ aBtnLight3.SetState( STATE_DONTKNOW );
+ bUpdate = sal_True;
+ }
+ }
+ // Licht 3 (Richtung)
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_3);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ bUpdate = sal_True;
+ }
+
+ // Licht 4 (Farbe)
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_4);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ aColor = ((const Svx3DLightcolor4Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_4)).GetValue();
+ ColorLB* pLb = &aLbLight4;
+ if( aColor != pLb->GetSelectEntryColor() )
+ {
+ LBSelectColor( pLb, aColor );
+ bUpdate = sal_True;
+ }
+ }
+ else
+ {
+ if( aLbLight4.GetSelectEntryCount() != 0 )
+ {
+ aLbLight4.SetNoSelection();
+ bUpdate = sal_True;
+ }
+ }
+ // Licht 4 (an/aus)
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_4);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ bool bOn = ((const Svx3DLightOnOff4Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_4)).GetValue() != 0;
+ if( ( bOn && !GetUILightState( aBtnLight4 )) ||
+ ( !bOn && GetUILightState( aBtnLight4 )) )
+ {
+ SetUILightState( aBtnLight4, bOn );
+ bUpdate = sal_True;
+ }
+ if( aBtnLight4.GetState() == STATE_DONTKNOW )
+ aBtnLight4.Check( aBtnLight4.IsChecked() );
+ }
+ else
+ {
+ if( aBtnLight4.GetState() != STATE_DONTKNOW )
+ {
+ aBtnLight4.SetState( STATE_DONTKNOW );
+ bUpdate = sal_True;
+ }
+ }
+ // Licht 4 (Richtung)
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_4);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ bUpdate = sal_True;
+ }
+
+ // Licht 5 (Farbe)
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_5);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ aColor = ((const Svx3DLightcolor5Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_5)).GetValue();
+ ColorLB* pLb = &aLbLight5;
+ if( aColor != pLb->GetSelectEntryColor() )
+ {
+ LBSelectColor( pLb, aColor );
+ bUpdate = sal_True;
+ }
+ }
+ else
+ {
+ if( aLbLight5.GetSelectEntryCount() != 0 )
+ {
+ aLbLight5.SetNoSelection();
+ bUpdate = sal_True;
+ }
+ }
+ // Licht 5 (an/aus)
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_5);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ bool bOn = ((const Svx3DLightOnOff5Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_5)).GetValue() != 0;
+ if( ( bOn && !GetUILightState( aBtnLight5 )) ||
+ ( !bOn && GetUILightState( aBtnLight5 )) )
+ {
+ SetUILightState( aBtnLight5, bOn );
+ bUpdate = sal_True;
+ }
+ if( aBtnLight5.GetState() == STATE_DONTKNOW )
+ aBtnLight5.Check( aBtnLight5.IsChecked() );
+ }
+ else
+ {
+ if( aBtnLight5.GetState() != STATE_DONTKNOW )
+ {
+ aBtnLight5.SetState( STATE_DONTKNOW );
+ bUpdate = sal_True;
+ }
+ }
+ // Licht 5 (Richtung)
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_5);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ bUpdate = sal_True;
+ }
+
+ // Licht 6 (Farbe)
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_6);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ aColor = ((const Svx3DLightcolor6Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_6)).GetValue();
+ ColorLB* pLb = &aLbLight6;
+ if( aColor != pLb->GetSelectEntryColor() )
+ {
+ LBSelectColor( pLb, aColor );
+ bUpdate = sal_True;
+ }
+ }
+ else
+ {
+ if( aLbLight6.GetSelectEntryCount() != 0 )
+ {
+ aLbLight6.SetNoSelection();
+ bUpdate = sal_True;
+ }
+ }
+ // Licht 6 (an/aus)
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_6);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ bool bOn = ((const Svx3DLightOnOff6Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_6)).GetValue() != 0;
+ if( ( bOn && !GetUILightState( aBtnLight6 )) ||
+ ( !bOn && GetUILightState( aBtnLight6 )) )
+ {
+ SetUILightState( aBtnLight6, bOn );
+ bUpdate = sal_True;
+ }
+ if( aBtnLight6.GetState() == STATE_DONTKNOW )
+ aBtnLight6.Check( aBtnLight6.IsChecked() );
+ }
+ else
+ {
+ if( aBtnLight6.GetState() != STATE_DONTKNOW )
+ {
+ aBtnLight6.SetState( STATE_DONTKNOW );
+ bUpdate = sal_True;
+ }
+ }
+ // Licht 6 (Richtung)
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_6);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ bUpdate = sal_True;
+ }
+
+ // Licht 7 (Farbe)
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_7);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ aColor = ((const Svx3DLightcolor7Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_7)).GetValue();
+ ColorLB* pLb = &aLbLight7;
+ if( aColor != pLb->GetSelectEntryColor() )
+ {
+ LBSelectColor( pLb, aColor );
+ bUpdate = sal_True;
+ }
+ }
+ else
+ {
+ if( aLbLight7.GetSelectEntryCount() != 0 )
+ {
+ aLbLight7.SetNoSelection();
+ bUpdate = sal_True;
+ }
+ }
+ // Licht 7 (an/aus)
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_7);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ bool bOn = ((const Svx3DLightOnOff7Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_7)).GetValue() != 0;
+ if( ( bOn && !GetUILightState( aBtnLight7 )) ||
+ ( !bOn && GetUILightState( aBtnLight7 )) )
+ {
+ SetUILightState( aBtnLight7 , bOn );
+ bUpdate = sal_True;
+ }
+ if( aBtnLight7.GetState() == STATE_DONTKNOW )
+ aBtnLight7.Check( aBtnLight7.IsChecked() );
+ }
+ else
+ {
+ if( aBtnLight7.GetState() != STATE_DONTKNOW )
+ {
+ aBtnLight7.SetState( STATE_DONTKNOW );
+ bUpdate = sal_True;
+ }
+ }
+ // Licht 7 (Richtung)
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_7);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ bUpdate = sal_True;
+ }
+
+ // Licht 8 (Farbe)
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_8);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ aColor = ((const Svx3DLightcolor8Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_8)).GetValue();
+ ColorLB* pLb = &aLbLight8;
+ if( aColor != pLb->GetSelectEntryColor() )
+ {
+ LBSelectColor( pLb, aColor );
+ bUpdate = sal_True;
+ }
+ }
+ else
+ {
+ if( aLbLight8.GetSelectEntryCount() != 0 )
+ {
+ aLbLight8.SetNoSelection();
+ bUpdate = sal_True;
+ }
+ }
+ // Licht 8 (an/aus)
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_8);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ bool bOn = ((const Svx3DLightOnOff8Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_8)).GetValue() != 0;
+ if( ( bOn && !GetUILightState( aBtnLight8 )) ||
+ ( !bOn && GetUILightState( aBtnLight8 )) )
+ {
+ SetUILightState( aBtnLight8, bOn );
+ bUpdate = sal_True;
+ }
+ if( aBtnLight8.GetState() == STATE_DONTKNOW )
+ aBtnLight8.Check( aBtnLight8.IsChecked() );
+ }
+ else
+ {
+ if( aBtnLight8.GetState() != STATE_DONTKNOW )
+ {
+ aBtnLight8.SetState( STATE_DONTKNOW );
+ bUpdate = sal_True;
+ }
+ }
+ // Licht 8 (Richtung)
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_8);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ bUpdate = sal_True;
+ }
+
+ // Umgebungslicht
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_AMBIENTCOLOR);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ aColor = ((const Svx3DAmbientcolorItem&)rAttrs.Get(SDRATTR_3DSCENE_AMBIENTCOLOR)).GetValue();
+ ColorLB* pLb = &aLbAmbientlight;
+ if( aColor != pLb->GetSelectEntryColor() )
+ {
+ LBSelectColor( pLb, aColor );
+ bUpdate = sal_True;
+ }
+ }
+ else
+ {
+ if( aLbAmbientlight.GetSelectEntryCount() != 0 )
+ {
+ aLbAmbientlight.SetNoSelection();
+ bUpdate = sal_True;
+ }
+ }
+
+
+// Texturen
+ // Art
+ if( bBitmap )
+ {
+ eState = rAttrs.GetItemState(SDRATTR_3DOBJ_TEXTURE_KIND);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ sal_uInt16 nValue = ((const Svx3DTextureKindItem&)rAttrs.Get(SDRATTR_3DOBJ_TEXTURE_KIND)).GetValue();
+
+ if( ( !aBtnTexLuminance.IsChecked() && nValue == 1 ) ||
+ ( !aBtnTexColor.IsChecked() && nValue == 3 ) )
+ {
+ aBtnTexLuminance.Check( nValue == 1 );
+ aBtnTexColor.Check( nValue == 3 );
+ bUpdate = sal_True;
+ }
+ }
+ else
+ {
+ if( aBtnTexLuminance.IsChecked() ||
+ aBtnTexColor.IsChecked() )
+ {
+ aBtnTexLuminance.Check( sal_False );
+ aBtnTexColor.Check( sal_False );
+ bUpdate = sal_True;
+ }
+ }
+
+ // Modus
+ eState = rAttrs.GetItemState(SDRATTR_3DOBJ_TEXTURE_MODE);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ sal_uInt16 nValue = ((const Svx3DTextureModeItem&)rAttrs.Get(SDRATTR_3DOBJ_TEXTURE_MODE)).GetValue();
+
+ if( ( !aBtnTexReplace.IsChecked() && nValue == 1 ) ||
+ ( !aBtnTexModulate.IsChecked() && nValue == 2 ) )
+ {
+ aBtnTexReplace.Check( nValue == 1 );
+ aBtnTexModulate.Check( nValue == 2 );
+ //aBtnTexBlend.Check( nValue == 2 );
+ bUpdate = sal_True;
+ }
+ }
+ else
+ {
+ if( aBtnTexReplace.IsChecked() ||
+ aBtnTexModulate.IsChecked() )
+ {
+ aBtnTexReplace.Check( sal_False );
+ aBtnTexModulate.Check( sal_False );
+ //aBtnTexBlend.Check( sal_False );
+ bUpdate = sal_True;
+ }
+ }
+
+ // Projektion X
+ eState = rAttrs.GetItemState(SDRATTR_3DOBJ_TEXTURE_PROJ_X);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ sal_uInt16 nValue = ((const Svx3DTextureProjectionXItem&)rAttrs.Get(SDRATTR_3DOBJ_TEXTURE_PROJ_X)).GetValue();
+
+ if( ( !aBtnTexObjectX.IsChecked() && nValue == 0 ) ||
+ ( !aBtnTexParallelX.IsChecked() && nValue == 1 ) ||
+ ( !aBtnTexCircleX.IsChecked() && nValue == 2 ) )
+ {
+ aBtnTexObjectX.Check( nValue == 0 );
+ aBtnTexParallelX.Check( nValue == 1 );
+ aBtnTexCircleX.Check( nValue == 2 );
+ bUpdate = sal_True;
+ }
+ }
+ else
+ {
+ if( aBtnTexObjectX.IsChecked() ||
+ aBtnTexParallelX.IsChecked() ||
+ aBtnTexCircleX.IsChecked() )
+ {
+ aBtnTexObjectX.Check( sal_False );
+ aBtnTexParallelX.Check( sal_False );
+ aBtnTexCircleX.Check( sal_False );
+ bUpdate = sal_True;
+ }
+ }
+
+ // Projektion Y
+ eState = rAttrs.GetItemState(SDRATTR_3DOBJ_TEXTURE_PROJ_Y);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ sal_uInt16 nValue = ((const Svx3DTextureProjectionYItem&)rAttrs.Get(SDRATTR_3DOBJ_TEXTURE_PROJ_Y)).GetValue();
+
+ if( ( !aBtnTexObjectY.IsChecked() && nValue == 0 ) ||
+ ( !aBtnTexParallelY.IsChecked() && nValue == 1 ) ||
+ ( !aBtnTexCircleY.IsChecked() && nValue == 2 ) )
+ {
+ aBtnTexObjectY.Check( nValue == 0 );
+ aBtnTexParallelY.Check( nValue == 1 );
+ aBtnTexCircleY.Check( nValue == 2 );
+ bUpdate = sal_True;
+ }
+ }
+ else
+ {
+ if( aBtnTexObjectY.IsChecked() ||
+ aBtnTexParallelY.IsChecked() ||
+ aBtnTexCircleY.IsChecked() )
+ {
+ aBtnTexObjectY.Check( sal_False );
+ aBtnTexParallelY.Check( sal_False );
+ aBtnTexCircleY.Check( sal_False );
+ bUpdate = sal_True;
+ }
+ }
+
+ // Filter
+ eState = rAttrs.GetItemState(SDRATTR_3DOBJ_TEXTURE_FILTER);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ sal_Bool bValue = ((const Svx3DTextureFilterItem&)rAttrs.Get(SDRATTR_3DOBJ_TEXTURE_FILTER)).GetValue();
+ if( bValue != aBtnTexFilter.IsChecked() )
+ {
+ aBtnTexFilter.Check( bValue );
+ bUpdate = sal_True;
+ }
+ if( aBtnTexFilter.GetState() == STATE_DONTKNOW )
+ aBtnTexFilter.Check( bValue );
+ }
+ else
+ {
+ if( aBtnTexFilter.GetState() != STATE_DONTKNOW )
+ {
+ aBtnTexFilter.SetState( STATE_DONTKNOW );
+ bUpdate = sal_True;
+ }
+ }
+ }
+
+
+ // Material Favoriten
+ aLbMatFavorites.SelectEntryPos( 0 );
+
+ // Objektfarbe
+ eState = rAttrs.GetItemState(XATTR_FILLCOLOR);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ aColor = ((const XFillColorItem&)rAttrs.Get(XATTR_FILLCOLOR)).GetColorValue();
+ ColorLB* pLb = &aLbMatColor;
+ if( aColor != pLb->GetSelectEntryColor() )
+ {
+ LBSelectColor( pLb, aColor );
+ bUpdate = sal_True;
+ }
+ }
+ else
+ {
+ if( aLbMatColor.GetSelectEntryCount() != 0 )
+ {
+ aLbMatColor.SetNoSelection();
+ bUpdate = sal_True;
+ }
+ }
+
+ // Slebstleuchtfarbe
+ eState = rAttrs.GetItemState(SDRATTR_3DOBJ_MAT_EMISSION);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ aColor = ((const Svx3DMaterialEmissionItem&)rAttrs.Get(SDRATTR_3DOBJ_MAT_EMISSION)).GetValue();
+ ColorLB* pLb = &aLbMatEmission;
+ if( aColor != pLb->GetSelectEntryColor() )
+ {
+ LBSelectColor( pLb, aColor );
+ bUpdate = sal_True;
+ }
+ }
+ else
+ {
+ if( aLbMatEmission.GetSelectEntryCount() != 0 )
+ {
+ aLbMatEmission.SetNoSelection();
+ bUpdate = sal_True;
+ }
+ }
+
+ // Glanzpunkt
+ eState = rAttrs.GetItemState(SDRATTR_3DOBJ_MAT_SPECULAR);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ aColor = ((const Svx3DMaterialSpecularItem&)rAttrs.Get(SDRATTR_3DOBJ_MAT_SPECULAR)).GetValue();
+ ColorLB* pLb = &aLbMatSpecular;
+ if( aColor != pLb->GetSelectEntryColor() )
+ {
+ LBSelectColor( pLb, aColor );
+ bUpdate = sal_True;
+ }
+ }
+ else
+ {
+ if( aLbMatSpecular.GetSelectEntryCount() != 0 )
+ {
+ aLbMatSpecular.SetNoSelection();
+ bUpdate = sal_True;
+ }
+ }
+
+ // Glanzpunkt Intensitaet
+ eState = rAttrs.GetItemState(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ sal_uInt16 nValue = ((const Svx3DMaterialSpecularIntensityItem&)rAttrs.Get(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY)).GetValue();
+ if( nValue != aMtrMatSpecularIntensity.GetValue() )
+ {
+ aMtrMatSpecularIntensity.SetValue( nValue );
+ bUpdate = sal_True;
+ }
+ }
+ else
+ {
+ if( !aMtrMatSpecularIntensity.IsEmptyFieldValue() )
+ {
+ aMtrMatSpecularIntensity.SetEmptyFieldValue();
+ bUpdate = sal_True;
+ }
+ }
+
+
+// Sonstige
+ // Perspektive
+ eState = rAttrs.GetItemState(SDRATTR_3DSCENE_PERSPECTIVE);
+ if( eState != SFX_ITEM_DONTCARE )
+ {
+ ProjectionType ePT = (ProjectionType)((const Svx3DPerspectiveItem&)rAttrs.Get(SDRATTR_3DSCENE_PERSPECTIVE)).GetValue();
+ if( ( !aBtnPerspective.IsChecked() && ePT == PR_PERSPECTIVE ) ||
+ ( aBtnPerspective.IsChecked() && ePT == PR_PARALLEL ) )
+ {
+ aBtnPerspective.Check( ePT == PR_PERSPECTIVE );
+ bUpdate = sal_True;
+ }
+ if( aBtnPerspective.GetState() == STATE_DONTKNOW )
+ aBtnPerspective.Check( ePT == PR_PERSPECTIVE );
+ }
+ else
+ {
+ if( aBtnPerspective.GetState() != STATE_DONTKNOW )
+ {
+ aBtnPerspective.SetState( STATE_DONTKNOW );
+ bUpdate = sal_True;
+ }
+ }
+
+ if( !bUpdate && !bOnly3DChanged )
+ {
+ // Eventuell sind aber die 2D-Attribute unterschiedlich. Vergleiche
+ // diese und entscheide
+
+
+ bUpdate = sal_True;
+ }
+
+ if( bUpdate || bOnly3DChanged )
+ {
+ // Preview updaten
+ SfxItemSet aSet(rAttrs);
+
+ // set LineStyle hard to XLINE_NONE when it's not set so that
+ // the default (XLINE_SOLID) is not used for 3d preview
+ if(SFX_ITEM_SET != aSet.GetItemState(XATTR_LINESTYLE, sal_False))
+ aSet.Put(XLineStyleItem(XLINE_NONE));
+
+ // set FillColor hard to WHITE when it's SFX_ITEM_DONTCARE so that
+ // the default (Blue7) is not used for 3d preview
+ if(SFX_ITEM_DONTCARE == aSet.GetItemState(XATTR_FILLCOLOR, sal_False))
+ aSet.Put(XFillColorItem(String(), Color(COL_WHITE)));
+
+ aCtlPreview.Set3DAttributes(aSet);
+ aCtlLightPreview.GetSvx3DLightControl().Set3DAttributes(aSet);
+
+ // try to select light corresponding to active button
+ sal_uInt32 nNumber(0xffffffff);
+
+ if(aBtnLight1.IsChecked())
+ nNumber = 0;
+ else if(aBtnLight2.IsChecked())
+ nNumber = 1;
+ else if(aBtnLight3.IsChecked())
+ nNumber = 2;
+ else if(aBtnLight4.IsChecked())
+ nNumber = 3;
+ else if(aBtnLight5.IsChecked())
+ nNumber = 4;
+ else if(aBtnLight6.IsChecked())
+ nNumber = 5;
+ else if(aBtnLight7.IsChecked())
+ nNumber = 6;
+ else if(aBtnLight8.IsChecked())
+ nNumber = 7;
+
+ if(nNumber != 0xffffffff)
+ {
+ aCtlLightPreview.GetSvx3DLightControl().SelectLight(nNumber);
+ }
+ }
+
+ // handle state of converts possible
+ aBtnConvertTo3D.Enable(pConvertTo3DItem->GetState());
+ aBtnLatheObject.Enable(pConvertTo3DLatheItem->GetState());
+}
+
+// -----------------------------------------------------------------------
+void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
+{
+ // get remembered 2d attributes from the dialog
+ if(mpRemember2DAttributes)
+ {
+ SfxWhichIter aIter(*mpRemember2DAttributes);
+ sal_uInt16 nWhich(aIter.FirstWhich());
+
+ while(nWhich)
+ {
+ SfxItemState eState = mpRemember2DAttributes->GetItemState(nWhich, sal_False);
+ if(SFX_ITEM_DONTCARE == eState)
+ rAttrs.InvalidateItem(nWhich);
+ else if(SFX_ITEM_SET == eState)
+ rAttrs.Put(mpRemember2DAttributes->Get(nWhich, sal_False));
+
+ nWhich = aIter.NextWhich();
+ }
+ }
+
+// Sonstige, muss vorne stehen da auf allen Seiten
+ // Perspektive
+ if( aBtnPerspective.GetState() != STATE_DONTKNOW )
+ {
+ sal_uInt16 nValue;
+ if( aBtnPerspective.IsChecked() )
+ nValue = PR_PERSPECTIVE;
+ else
+ nValue = PR_PARALLEL;
+ rAttrs.Put(Svx3DPerspectiveItem(nValue));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DSCENE_PERSPECTIVE);
+
+// Geometrie
+ // evtl. PoolUnit ermitteln (Falls dies in Update() nicht passiert ist)
+ if( !mpImpl->pPool )
+ {
+ DBG_ERROR( "Kein Pool in GetAttr()! Evtl. inkompatibel zu drviewsi.cxx ?" );
+ mpImpl->pPool = rAttrs.GetPool();
+ DBG_ASSERT( mpImpl->pPool, "Wo ist der Pool?" );
+ ePoolUnit = mpImpl->pPool->GetMetric( SID_ATTR_LINE_WIDTH );
+
+ eFUnit = GetModuleFieldUnit( rAttrs );
+ }
+
+ // Anzahl Segmente (horizontal)
+ if( !aNumHorizontal.IsEmptyFieldValue() )
+ {
+ sal_uInt32 nValue = static_cast<sal_uInt32>(aNumHorizontal.GetValue());
+ rAttrs.Put(Svx3DHorizontalSegmentsItem(nValue));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DOBJ_HORZ_SEGS);
+
+ // Anzahl Segmente (vertikal)
+ if( !aNumVertical.IsEmptyFieldValue() )
+ {
+ sal_uInt32 nValue = static_cast<sal_uInt32>(aNumVertical.GetValue());
+ rAttrs.Put(Svx3DVerticalSegmentsItem(nValue));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DOBJ_VERT_SEGS);
+
+ // Tiefe
+ if( !aMtrDepth.IsEmptyFieldValue() )
+ {
+ sal_uInt32 nValue = GetCoreValue( aMtrDepth, ePoolUnit );
+ rAttrs.Put(Svx3DDepthItem(nValue));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DOBJ_DEPTH);
+
+ // Doppelseitig
+ TriState eState = aBtnDoubleSided.GetState();
+ if( eState != STATE_DONTKNOW )
+ {
+ sal_Bool bValue = STATE_CHECK == eState;
+ rAttrs.Put(Svx3DDoubleSidedItem(bValue));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DOBJ_DOUBLE_SIDED);
+
+ // Kantenrundung
+ if( !aMtrPercentDiagonal.IsEmptyFieldValue() )
+ {
+ sal_uInt16 nValue = (sal_uInt16) aMtrPercentDiagonal.GetValue();
+ rAttrs.Put(Svx3DPercentDiagonalItem(nValue));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DOBJ_PERCENT_DIAGONAL);
+
+ // Tiefenskalierung
+ if( !aMtrBackscale.IsEmptyFieldValue() )
+ {
+ sal_uInt16 nValue = (sal_uInt16)aMtrBackscale.GetValue();
+ rAttrs.Put(Svx3DBackscaleItem(nValue));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DOBJ_BACKSCALE);
+
+ // Endwinkel
+ if( !aMtrEndAngle.IsEmptyFieldValue() )
+ {
+ sal_uInt16 nValue = (sal_uInt16)aMtrEndAngle.GetValue();
+ rAttrs.Put(Svx3DEndAngleItem(nValue));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DOBJ_END_ANGLE);
+
+ // Normalentyp
+ sal_uInt16 nValue = 99;
+ if( aBtnNormalsObj.IsChecked() )
+ nValue = 0;
+ else if( aBtnNormalsFlat.IsChecked() )
+ nValue = 1;
+ else if( aBtnNormalsSphere.IsChecked() )
+ nValue = 2;
+
+ if( nValue <= 2 )
+ rAttrs.Put(Svx3DNormalsKindItem(nValue));
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DOBJ_NORMALS_KIND);
+
+ // Normalen invertieren
+ eState = aBtnNormalsInvert.GetState();
+ if( eState != STATE_DONTKNOW )
+ {
+ sal_Bool bValue = STATE_CHECK == eState;
+ rAttrs.Put(Svx3DNormalsInvertItem(bValue));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DOBJ_NORMALS_INVERT);
+
+ // 2-seitige Beleuchtung
+ eState = aBtnTwoSidedLighting.GetState();
+ if( eState != STATE_DONTKNOW )
+ {
+ sal_Bool bValue = STATE_CHECK == eState;
+ rAttrs.Put(Svx3DTwoSidedLightingItem(bValue));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING);
+
+// Darstellung
+ // Shademode
+ if( aLbShademode.GetSelectEntryCount() )
+ {
+ nValue = aLbShademode.GetSelectEntryPos();
+ rAttrs.Put(Svx3DShadeModeItem(nValue));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DSCENE_SHADE_MODE);
+
+ // 3D-Shatten
+ eState = aBtnShadow3d.GetState();
+ if( eState != STATE_DONTKNOW )
+ {
+ sal_Bool bValue = STATE_CHECK == eState;
+ rAttrs.Put(Svx3DShadow3DItem(bValue));
+ rAttrs.Put(SdrShadowItem(bValue));
+ }
+ else
+ {
+ rAttrs.InvalidateItem(SDRATTR_3DOBJ_SHADOW_3D);
+ rAttrs.InvalidateItem(SDRATTR_SHADOW);
+ }
+
+ // Neigung (Schatten)
+ if( !aMtrSlant.IsEmptyFieldValue() )
+ {
+ sal_uInt16 nValue2 = (sal_uInt16) aMtrSlant.GetValue();
+ rAttrs.Put(Svx3DShadowSlantItem(nValue2));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DSCENE_SHADOW_SLANT);
+
+ // Distanz
+ if( !aMtrDistance.IsEmptyFieldValue() )
+ {
+ sal_uInt32 nValue2 = GetCoreValue( aMtrDistance, ePoolUnit );
+ rAttrs.Put(Svx3DDistanceItem(nValue2));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DSCENE_DISTANCE);
+
+ // Brennweite
+ if( !aMtrFocalLength.IsEmptyFieldValue() )
+ {
+ sal_uInt32 nValue2 = GetCoreValue( aMtrFocalLength, ePoolUnit );
+ rAttrs.Put(Svx3DFocalLengthItem(nValue2));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DSCENE_FOCAL_LENGTH);
+
+// Beleuchtung
+ Image aImg;
+ basegfx::B3DVector aVector;
+ Color aColor;
+ const SfxItemSet aLightItemSet(aCtlLightPreview.GetSvx3DLightControl().Get3DAttributes());
+
+ // Licht 1 Farbe
+ if( aLbLight1.GetSelectEntryCount() )
+ {
+ aColor = aLbLight1.GetSelectEntryColor();
+ rAttrs.Put(Svx3DLightcolor1Item(aColor));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_1);
+ // Licht 1 (an/aus)
+ eState = aBtnLight1.GetState();
+ if( eState != STATE_DONTKNOW )
+ {
+ sal_Bool bValue = GetUILightState( aBtnLight1 );
+ rAttrs.Put(Svx3DLightOnOff1Item(bValue));
+
+ // Licht 1 (Richtung)
+ if( bValue )
+ {
+ rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1));
+ }
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_1);
+
+
+ // Licht 2 Farbe
+ if( aLbLight2.GetSelectEntryCount() )
+ {
+ aColor = aLbLight2.GetSelectEntryColor();
+ rAttrs.Put(Svx3DLightcolor2Item(aColor));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_2);
+ // Licht 2 (an/aus)
+ eState = aBtnLight2.GetState();
+ if( eState != STATE_DONTKNOW )
+ {
+ sal_Bool bValue = GetUILightState( aBtnLight2 );
+ rAttrs.Put(Svx3DLightOnOff2Item(bValue));
+
+ // Licht 2 (Richtung)
+ if( bValue )
+ {
+ rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2));
+ }
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_2);
+
+ // Licht 3 Farbe
+ if( aLbLight3.GetSelectEntryCount() )
+ {
+ aColor = aLbLight3.GetSelectEntryColor();
+ rAttrs.Put(Svx3DLightcolor3Item(aColor));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_3);
+ // Licht 3 (an/aus)
+ eState = aBtnLight3.GetState();
+ if( eState != STATE_DONTKNOW )
+ {
+ sal_Bool bValue = GetUILightState( aBtnLight3 );
+ rAttrs.Put(Svx3DLightOnOff3Item(bValue));
+
+ // Licht 3 (Richtung)
+ if( bValue )
+ {
+ rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3));
+ }
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_3);
+
+ // Licht 4 Farbe
+ if( aLbLight4.GetSelectEntryCount() )
+ {
+ aColor = aLbLight4.GetSelectEntryColor();
+ rAttrs.Put(Svx3DLightcolor4Item(aColor));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_4);
+ // Licht 4 (an/aus)
+ eState = aBtnLight4.GetState();
+ if( eState != STATE_DONTKNOW )
+ {
+ sal_Bool bValue = GetUILightState( aBtnLight4 );
+ rAttrs.Put(Svx3DLightOnOff4Item(bValue));
+
+ // Licht 4 (Richtung)
+ if( bValue )
+ {
+ rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4));
+ }
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_4);
+
+ // Licht 5 Farbe
+ if( aLbLight5.GetSelectEntryCount() )
+ {
+ aColor = aLbLight5.GetSelectEntryColor();
+ rAttrs.Put(Svx3DLightcolor5Item(aColor));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_5);
+ // Licht 5 (an/aus)
+ eState = aBtnLight5.GetState();
+ if( eState != STATE_DONTKNOW )
+ {
+ sal_Bool bValue = GetUILightState( aBtnLight5 );
+ rAttrs.Put(Svx3DLightOnOff5Item(bValue));
+
+ // Licht 5 (Richtung)
+ if( bValue )
+ {
+ rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5));
+ }
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_5);
+
+ // Licht 6 Farbe
+ if( aLbLight6.GetSelectEntryCount() )
+ {
+ aColor = aLbLight6.GetSelectEntryColor();
+ rAttrs.Put(Svx3DLightcolor6Item(aColor));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_6);
+ // Licht 6 (an/aus)
+ eState = aBtnLight6.GetState();
+ if( eState != STATE_DONTKNOW )
+ {
+ sal_Bool bValue = GetUILightState( aBtnLight6 );
+ rAttrs.Put(Svx3DLightOnOff6Item(bValue));
+
+ // Licht 6 (Richtung)
+ if( bValue )
+ {
+ rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6));
+ }
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_6);
+
+ // Licht 7 Farbe
+ if( aLbLight7.GetSelectEntryCount() )
+ {
+ aColor = aLbLight7.GetSelectEntryColor();
+ rAttrs.Put(Svx3DLightcolor7Item(aColor));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_7);
+ // Licht 7 (an/aus)
+ eState = aBtnLight7.GetState();
+ if( eState != STATE_DONTKNOW )
+ {
+ sal_Bool bValue = GetUILightState( aBtnLight7 );
+ rAttrs.Put(Svx3DLightOnOff7Item(bValue));
+
+ // Licht 7 (Richtung)
+ if( bValue )
+ {
+ rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7));
+ }
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_7);
+
+ // Licht 8 Farbe
+ if( aLbLight8.GetSelectEntryCount() )
+ {
+ aColor = aLbLight8.GetSelectEntryColor();
+ rAttrs.Put(Svx3DLightcolor8Item(aColor));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_8);
+ // Licht 8 (an/aus)
+ eState = aBtnLight8.GetState();
+ if( eState != STATE_DONTKNOW )
+ {
+ sal_Bool bValue = GetUILightState( aBtnLight8 );
+ rAttrs.Put(Svx3DLightOnOff8Item(bValue));
+
+ // Licht 8 (Richtung)
+ if( bValue )
+ {
+ rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8));
+ }
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_8);
+
+ // Umgebungslicht
+ if( aLbAmbientlight.GetSelectEntryCount() )
+ {
+ aColor = aLbAmbientlight.GetSelectEntryColor();
+ rAttrs.Put(Svx3DAmbientcolorItem(aColor));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DSCENE_AMBIENTCOLOR);
+
+// Texturen
+ // Art
+ nValue = 3;
+ if( aBtnTexLuminance.IsChecked() )
+ nValue = 1;
+ else if( aBtnTexColor.IsChecked() )
+ nValue = 3;
+
+ if( nValue == 1 || nValue == 3 )
+ rAttrs.Put(Svx3DTextureKindItem(nValue));
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DOBJ_TEXTURE_KIND);
+
+
+ // Modus
+ nValue = 99;
+ if( aBtnTexReplace.IsChecked() )
+ nValue = 1;
+ else if( aBtnTexModulate.IsChecked() )
+ nValue = 2;
+ //else if( aBtnTexBlend.IsChecked() )
+ // nValue = 2;
+
+ if( nValue == 1 || nValue == 2 )
+ rAttrs.Put(Svx3DTextureModeItem(nValue));
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DOBJ_TEXTURE_MODE);
+
+ // Projektion X
+ nValue = 99;
+ if( aBtnTexObjectX.IsChecked() )
+ nValue = 0;
+ else if( aBtnTexParallelX.IsChecked() )
+ nValue = 1;
+ else if( aBtnTexCircleX.IsChecked() )
+ nValue = 2;
+
+ if( nValue <= 2 )
+ rAttrs.Put(Svx3DTextureProjectionXItem(nValue));
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DOBJ_TEXTURE_PROJ_X);
+
+ // Projektion Y
+ nValue = 99;
+ if( aBtnTexObjectY.IsChecked() )
+ nValue = 0;
+ else if( aBtnTexParallelY.IsChecked() )
+ nValue = 1;
+ else if( aBtnTexCircleY.IsChecked() )
+ nValue = 2;
+
+ if( nValue <= 2 )
+ rAttrs.Put(Svx3DTextureProjectionYItem(nValue));
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DOBJ_TEXTURE_PROJ_Y);
+
+
+ // Filter
+ eState = aBtnTexFilter.GetState();
+ if( eState != STATE_DONTKNOW )
+ {
+ sal_Bool bValue = STATE_CHECK == eState;
+ rAttrs.Put(Svx3DTextureFilterItem(bValue));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DOBJ_TEXTURE_FILTER);
+
+
+// Material
+ // Objektfarbe
+ if( aLbMatColor.GetSelectEntryCount() )
+ {
+ aColor = aLbMatColor.GetSelectEntryColor();
+ rAttrs.Put( XFillColorItem( String(), aColor) );
+ }
+ else
+ {
+ rAttrs.InvalidateItem( XATTR_FILLCOLOR );
+ }
+
+ // Slebstleuchtfarbe
+ if( aLbMatEmission.GetSelectEntryCount() )
+ {
+ aColor = aLbMatEmission.GetSelectEntryColor();
+ rAttrs.Put(Svx3DMaterialEmissionItem(aColor));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DOBJ_MAT_EMISSION);
+
+ // Glanzpunkt
+ if( aLbMatSpecular.GetSelectEntryCount() )
+ {
+ aColor = aLbMatSpecular.GetSelectEntryColor();
+ rAttrs.Put(Svx3DMaterialSpecularItem(aColor));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DOBJ_MAT_SPECULAR);
+
+ // Glanzpunkt Intensitaet
+ if( !aMtrMatSpecularIntensity.IsEmptyFieldValue() )
+ {
+ sal_uInt16 nValue2 = (sal_uInt16) aMtrMatSpecularIntensity.GetValue();
+ rAttrs.Put(Svx3DMaterialSpecularIntensityItem(nValue2));
+ }
+ else
+ rAttrs.InvalidateItem(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY);
+}
+
+// -----------------------------------------------------------------------
+void __EXPORT Svx3DWin::Resize()
+{
+ if ( !IsFloatingMode() ||
+ !GetFloatingWindow()->IsRollUp() )
+ {
+ Size aWinSize( GetOutputSizePixel() ); // vorher rSize im Resizing()
+
+ if( aWinSize.Height() >= GetMinOutputSizePixel().Height() &&
+ aWinSize.Width() >= GetMinOutputSizePixel().Width() )
+ {
+ Size aDiffSize;
+ aDiffSize.Width() = aWinSize.Width() - aSize.Width();
+ aDiffSize.Height() = aWinSize.Height() - aSize.Height();
+
+ Point aXPt;
+ Point aYPt;
+ aXPt.X() = aDiffSize.Width();
+ aYPt.Y() = aDiffSize.Height();
+
+ Size aObjSize;
+
+ // Hide
+ aBtnUpdate.Hide();
+ aBtnAssign.Hide();
+
+ aBtnConvertTo3D.Hide();
+ aBtnLatheObject.Hide();
+ aBtnPerspective.Hide();
+
+ aCtlPreview.Hide();
+ aCtlLightPreview.Hide();
+
+ aFLGeometrie.Hide();
+ aFLRepresentation.Hide();
+ aFLLight.Hide();
+ aFLTexture.Hide();
+ aFLMaterial.Hide();
+
+ // Verschieben / Resizen
+ aBtnUpdate.SetPosPixel( aBtnUpdate.GetPosPixel() + aXPt );
+ aBtnAssign.SetPosPixel( aBtnAssign.GetPosPixel() + aXPt );
+
+ // Preview-Controls
+ aObjSize = aCtlPreview.GetOutputSizePixel();
+ aObjSize.Width() += aDiffSize.Width();
+ aObjSize.Height() += aDiffSize.Height();
+ aCtlPreview.SetOutputSizePixel( aObjSize );
+ aCtlLightPreview.SetOutputSizePixel( aObjSize );
+
+ // Groups
+ aObjSize = aFLGeometrie.GetOutputSizePixel();
+ aObjSize.Width() += aDiffSize.Width();
+ aFLGeometrie.SetOutputSizePixel( aObjSize );
+ aFLSegments.SetOutputSizePixel( aObjSize );
+ aFLShadow.SetOutputSizePixel( aObjSize );
+ aFLCamera.SetOutputSizePixel( aObjSize );
+ aFLRepresentation.SetOutputSizePixel( aObjSize );
+ aFLLight.SetOutputSizePixel( aObjSize );
+ aFLTexture.SetOutputSizePixel( aObjSize );
+ aFLMaterial.SetOutputSizePixel( aObjSize );
+
+ // Y-Position der unteren Buttons
+ aBtnConvertTo3D.SetPosPixel( aBtnConvertTo3D.GetPosPixel() + aYPt );
+ aBtnLatheObject.SetPosPixel( aBtnLatheObject.GetPosPixel() + aYPt );
+ aBtnPerspective.SetPosPixel( aBtnPerspective.GetPosPixel() + aYPt );
+
+ // Show
+ aBtnUpdate.Show();
+ aBtnAssign.Show();
+
+ aBtnConvertTo3D.Show();
+ aBtnLatheObject.Show();
+ aBtnPerspective.Show();
+
+ if( aBtnGeo.IsChecked() )
+ ClickViewTypeHdl( &aBtnGeo );
+ if( aBtnRepresentation.IsChecked() )
+ ClickViewTypeHdl( &aBtnRepresentation );
+ if( aBtnLight.IsChecked() )
+ ClickViewTypeHdl( &aBtnLight );
+ if( aBtnTexture.IsChecked() )
+ ClickViewTypeHdl( &aBtnTexture );
+ if( aBtnMaterial.IsChecked() )
+ ClickViewTypeHdl( &aBtnMaterial );
+
+ aSize = aWinSize;
+ }
+ }
+
+ SfxDockingWindow::Resize();
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( Svx3DWin, ClickUpdateHdl, void *, EMPTYARG )
+{
+ bUpdate = !aBtnUpdate.IsChecked();
+ aBtnUpdate.Check( bUpdate );
+
+ if( bUpdate )
+ {
+ SfxDispatcher* pDispatcher = LocalGetDispatcher(pBindings);
+ if (pDispatcher != NULL)
+ {
+ SfxBoolItem aItem( SID_3D_STATE, sal_True );
+ pDispatcher->Execute(
+ SID_3D_STATE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
+ }
+ }
+ else
+ {
+ // Controls koennen u.U. disabled sein
+ }
+
+ return( 0L );
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( Svx3DWin, ClickAssignHdl, void *, EMPTYARG )
+{
+ SfxDispatcher* pDispatcher = LocalGetDispatcher(pBindings);
+ if (pDispatcher != NULL)
+ {
+ SfxBoolItem aItem( SID_3D_ASSIGN, sal_True );
+ pDispatcher->Execute(
+ SID_3D_ASSIGN, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
+ }
+
+ return( 0L );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( Svx3DWin, ClickViewTypeHdl, void *, pBtn )
+{
+
+ if( pBtn )
+ {
+ // Da das permanente Updaten der Preview zu teuer waere
+ sal_Bool bUpdatePreview = aBtnLight.IsChecked();
+
+ aBtnGeo.Check( &aBtnGeo == pBtn );
+ aBtnRepresentation.Check( &aBtnRepresentation == pBtn );
+ aBtnLight.Check( &aBtnLight == pBtn );
+ aBtnTexture.Check( &aBtnTexture == pBtn );
+ aBtnMaterial.Check( &aBtnMaterial == pBtn );
+
+ if( aBtnGeo.IsChecked() )
+ eViewType = VIEWTYPE_GEO;
+ if( aBtnRepresentation.IsChecked() )
+ eViewType = VIEWTYPE_REPRESENTATION;
+ if( aBtnLight.IsChecked() )
+ eViewType = VIEWTYPE_LIGHT;
+ if( aBtnTexture.IsChecked() )
+ eViewType = VIEWTYPE_TEXTURE;
+ if( aBtnMaterial.IsChecked() )
+ eViewType = VIEWTYPE_MATERIAL;
+
+ // Geometrie
+ if( eViewType == VIEWTYPE_GEO )
+ {
+ aFtHorizontal.Show();
+ aNumHorizontal.Show();
+ aFtVertical.Show();
+ aNumVertical.Show();
+ aFLSegments.Show();
+ aFtPercentDiagonal.Show();
+ aMtrPercentDiagonal.Show();
+ aFtBackscale.Show();
+ aMtrBackscale.Show();
+ aFtEndAngle.Show();
+ aMtrEndAngle.Show();
+ aFtDepth.Show();
+ aMtrDepth.Show();
+ aFLGeometrie.Show();
+
+ aBtnNormalsObj.Show();
+ aBtnNormalsFlat.Show();
+ aBtnNormalsSphere.Show();
+ aBtnTwoSidedLighting.Show();
+ aBtnNormalsInvert.Show();
+ aFLNormals.Show();
+ aBtnDoubleSided.Show();
+ }
+ else
+ {
+ aFtHorizontal.Hide();
+ aNumHorizontal.Hide();
+ aFtVertical.Hide();
+ aNumVertical.Hide();
+ aFLSegments.Hide();
+ aFtPercentDiagonal.Hide();
+ aMtrPercentDiagonal.Hide();
+ aFtBackscale.Hide();
+ aMtrBackscale.Hide();
+ aFtEndAngle.Hide();
+ aMtrEndAngle.Hide();
+ aFtDepth.Hide();
+ aMtrDepth.Hide();
+ aFLGeometrie.Hide();
+
+ aBtnNormalsObj.Hide();
+ aBtnNormalsFlat.Hide();
+ aBtnNormalsSphere.Hide();
+ aBtnTwoSidedLighting.Hide();
+ aBtnNormalsInvert.Hide();
+ aFLNormals.Hide();
+ aBtnDoubleSided.Hide();
+ }
+
+ // Darstellung
+ if( eViewType == VIEWTYPE_REPRESENTATION )
+ {
+ aFtShademode.Show();
+ aLbShademode.Show();
+ aBtnShadow3d.Show();
+ aFtSlant.Show();
+ aMtrSlant.Show();
+ aFLShadow.Show();
+ aFtDistance.Show();
+ aMtrDistance.Show();
+ aFtFocalLeng.Show();
+ aMtrFocalLength.Show();
+ aFLCamera.Show();
+ aFLRepresentation.Show();
+ }
+ else
+ {
+ aFtShademode.Hide();
+ aLbShademode.Hide();
+ aBtnShadow3d.Hide();
+ aFtSlant.Hide();
+ aMtrSlant.Hide();
+ aFLShadow.Hide();
+ aFtDistance.Hide();
+ aMtrDistance.Hide();
+ aFtFocalLeng.Hide();
+ aMtrFocalLength.Hide();
+ aFLCamera.Hide();
+ aFLRepresentation.Hide();
+ }
+
+ // Beleuchtung
+ if( eViewType == VIEWTYPE_LIGHT )
+ {
+ aBtnLight1.Show();
+ aBtnLight2.Show();
+ aBtnLight3.Show();
+ aBtnLight4.Show();
+ aBtnLight5.Show();
+ aBtnLight6.Show();
+ aBtnLight7.Show();
+ aBtnLight8.Show();
+ //aLbLight1.Show();
+ aBtnLightColor.Show();
+ aFTLightsource.Show();
+ aLbAmbientlight.Show();
+ aBtnAmbientColor.Show();
+ aFTAmbientlight.Show();
+ aFLLight.Show();
+ //aFtLightX.Show();
+ //aFtLightY.Show();
+ //aFtLightZ.Show();
+ //aGrpLightInfo.Show();
+
+ ColorLB* pLb = GetLbByButton();
+ if( pLb )
+ pLb->Show();
+
+ aCtlLightPreview.Show();
+ aCtlPreview.Hide();
+ }
+ else
+ {
+ aBtnLight1.Hide();
+ aBtnLight2.Hide();
+ aBtnLight3.Hide();
+ aBtnLight4.Hide();
+ aBtnLight5.Hide();
+ aBtnLight6.Hide();
+ aBtnLight7.Hide();
+ aBtnLight8.Hide();
+ aLbLight1.Hide();
+ aLbLight2.Hide();
+ aLbLight3.Hide();
+ aLbLight4.Hide();
+ aLbLight5.Hide();
+ aLbLight6.Hide();
+ aLbLight7.Hide();
+ aLbLight8.Hide();
+ aBtnLightColor.Hide();
+ aFTLightsource.Hide();
+ aLbAmbientlight.Hide();
+ aBtnAmbientColor.Hide();
+ aFTAmbientlight.Hide();
+ aFLLight.Hide();
+
+ if( !aCtlPreview.IsVisible() )
+ {
+ aCtlPreview.Show();
+ aCtlLightPreview.Hide();
+ }
+ }
+
+ // Texturen
+ if( eViewType == VIEWTYPE_TEXTURE )
+ {
+ aFtTexKind.Show();
+ aBtnTexLuminance.Show();
+ aBtnTexColor.Show();
+ aFtTexMode.Show();
+ aBtnTexReplace.Show();
+ aBtnTexModulate.Show();
+ //aBtnTexBlend.Show();
+ aFtTexProjectionX.Show();
+ aBtnTexParallelX.Show();
+ aBtnTexCircleX.Show();
+ aBtnTexObjectX.Show();
+ aFtTexProjectionY.Show();
+ aBtnTexParallelY.Show();
+ aBtnTexCircleY.Show();
+ aBtnTexObjectY.Show();
+ aFtTexFilter.Show();
+ aBtnTexFilter.Show();
+ aFLTexture.Show();
+ }
+ else
+ {
+ aFtTexKind.Hide();
+ aBtnTexLuminance.Hide();
+ aBtnTexColor.Hide();
+ aFtTexMode.Hide();
+ aBtnTexReplace.Hide();
+ aBtnTexModulate.Hide();
+ aBtnTexBlend.Hide();
+ aFtTexProjectionX.Hide();
+ aBtnTexParallelX.Hide();
+ aBtnTexCircleX.Hide();
+ aBtnTexObjectX.Hide();
+ aFtTexProjectionY.Hide();
+ aBtnTexParallelY.Hide();
+ aBtnTexCircleY.Hide();
+ aBtnTexObjectY.Hide();
+ aFtTexFilter.Hide();
+ aBtnTexFilter.Hide();
+ aFLTexture.Hide();
+ }
+
+ // Material
+ if( eViewType == VIEWTYPE_MATERIAL )
+ {
+ aFtMatFavorites.Show();
+ aLbMatFavorites.Show();
+ aFtMatColor.Show();
+ aLbMatColor.Show();
+ aBtnMatColor.Show();
+ aFtMatEmission.Show();
+ aLbMatEmission.Show();
+ aBtnEmissionColor.Show();
+ aFtMatSpecular.Show();
+ aLbMatSpecular.Show();
+ aBtnSpecularColor.Show();
+ aFtMatSpecularIntensity.Show();
+ aMtrMatSpecularIntensity.Show();
+ aFLMatSpecular.Show();
+ aFLMaterial.Show();
+ }
+ else
+ {
+ aFtMatFavorites.Hide();
+ aLbMatFavorites.Hide();
+ aFtMatColor.Hide();
+ aLbMatColor.Hide();
+ aBtnMatColor.Hide();
+ aFtMatEmission.Hide();
+ aLbMatEmission.Hide();
+ aBtnEmissionColor.Hide();
+ aFtMatSpecular.Hide();
+ aLbMatSpecular.Hide();
+ aBtnSpecularColor.Hide();
+ aFtMatSpecularIntensity.Hide();
+ aMtrMatSpecularIntensity.Hide();
+ aFLMatSpecular.Hide();
+ aFLMaterial.Hide();
+ }
+ if( bUpdatePreview && !aBtnLight.IsChecked() )
+ UpdatePreview();
+
+ }
+ else
+ {
+ aBtnGeo.Check( eViewType == VIEWTYPE_GEO );
+ aBtnRepresentation.Check( eViewType == VIEWTYPE_REPRESENTATION );
+ aBtnLight.Check( eViewType == VIEWTYPE_LIGHT );
+ aBtnTexture.Check( eViewType == VIEWTYPE_TEXTURE );
+ aBtnMaterial.Check( eViewType == VIEWTYPE_MATERIAL );
+ }
+ return( 0L );
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( Svx3DWin, ClickHdl, PushButton *, pBtn )
+{
+ sal_Bool bUpdatePreview = sal_False;
+
+ if( pBtn )
+ {
+ sal_uInt16 nSId = 0;
+
+ if( pBtn == &aBtnConvertTo3D )
+ {
+ nSId = SID_CONVERT_TO_3D;
+ }
+ else if( pBtn == &aBtnLatheObject )
+ {
+ nSId = SID_CONVERT_TO_3D_LATHE_FAST;
+ }
+ // Geometrie
+ else if( pBtn == &aBtnNormalsObj ||
+ pBtn == &aBtnNormalsFlat ||
+ pBtn == &aBtnNormalsSphere )
+ {
+ aBtnNormalsObj.Check( pBtn == &aBtnNormalsObj );
+ aBtnNormalsFlat.Check( pBtn == &aBtnNormalsFlat );
+ aBtnNormalsSphere.Check( pBtn == &aBtnNormalsSphere );
+ bUpdatePreview = sal_True;
+ }
+ else if( pBtn == &aBtnLight1 ||
+ pBtn == &aBtnLight2 ||
+ pBtn == &aBtnLight3 ||
+ pBtn == &aBtnLight4 ||
+ pBtn == &aBtnLight5 ||
+ pBtn == &aBtnLight6 ||
+ pBtn == &aBtnLight7 ||
+ pBtn == &aBtnLight8 )
+ {
+ // Beleuchtung
+ ColorLB* pLb = GetLbByButton( pBtn );
+ pLb->Show();
+
+ if( pBtn->IsChecked() )
+ {
+ SetUILightState( *(ImageButton*)pBtn, !GetUILightState( *(ImageButton*)pBtn ) );
+ }
+ else
+ {
+ pBtn->Check();
+
+ if( pBtn != &aBtnLight1 && aBtnLight1.IsChecked() )
+ {
+ aBtnLight1.Check( sal_False );
+ aLbLight1.Hide();
+ }
+ if( pBtn != &aBtnLight2 && aBtnLight2.IsChecked() )
+ {
+ aBtnLight2.Check( sal_False );
+ aLbLight2.Hide();
+ }
+ if( pBtn != &aBtnLight3 && aBtnLight3.IsChecked() )
+ {
+ aBtnLight3.Check( sal_False );
+ aLbLight3.Hide();
+ }
+ if( pBtn != &aBtnLight4 && aBtnLight4.IsChecked() )
+ {
+ aBtnLight4.Check( sal_False );
+ aLbLight4.Hide();
+ }
+ if( pBtn != &aBtnLight5 && aBtnLight5.IsChecked() )
+ {
+ aBtnLight5.Check( sal_False );
+ aLbLight5.Hide();
+ }
+ if( pBtn != &aBtnLight6 && aBtnLight6.IsChecked() )
+ {
+ aBtnLight6.Check( sal_False );
+ aLbLight6.Hide();
+ }
+ if( pBtn != &aBtnLight7 && aBtnLight7.IsChecked() )
+ {
+ aBtnLight7.Check( sal_False );
+ aLbLight7.Hide();
+ }
+ if( pBtn != &aBtnLight8 && aBtnLight8.IsChecked() )
+ {
+ aBtnLight8.Check( sal_False );
+ aLbLight8.Hide();
+ }
+ }
+ sal_Bool bEnable = GetUILightState( *(ImageButton*)pBtn );
+ aBtnLightColor.Enable( bEnable );
+ pLb->Enable( bEnable );
+
+ ClickLightHdl( pBtn );
+ bUpdatePreview = sal_True;
+ }
+ // Texturen
+ else if( pBtn == &aBtnTexLuminance ||
+ pBtn == &aBtnTexColor )
+ {
+ aBtnTexLuminance.Check( pBtn == &aBtnTexLuminance );
+ aBtnTexColor.Check( pBtn == &aBtnTexColor );
+ bUpdatePreview = sal_True;
+ }
+ else if( pBtn == &aBtnTexReplace ||
+ pBtn == &aBtnTexModulate )// ||
+ //pBtn == &aBtnTexBlend )
+ {
+ aBtnTexReplace.Check( pBtn == &aBtnTexReplace );
+ aBtnTexModulate.Check( pBtn == &aBtnTexModulate );
+ //aBtnTexBlend.Check( pBtn == &aBtnTexBlend );
+ bUpdatePreview = sal_True;
+ }
+ else if( pBtn == &aBtnTexParallelX ||
+ pBtn == &aBtnTexCircleX ||
+ pBtn == &aBtnTexObjectX )
+ {
+ aBtnTexParallelX.Check( pBtn == &aBtnTexParallelX );
+ aBtnTexCircleX.Check( pBtn == &aBtnTexCircleX );
+ aBtnTexObjectX.Check( pBtn == &aBtnTexObjectX );
+ bUpdatePreview = sal_True;
+ }
+ else if( pBtn == &aBtnTexParallelY ||
+ pBtn == &aBtnTexCircleY ||
+ pBtn == &aBtnTexObjectY )
+ {
+ aBtnTexParallelY.Check( pBtn == &aBtnTexParallelY );
+ aBtnTexCircleY.Check( pBtn == &aBtnTexCircleY );
+ aBtnTexObjectY.Check( pBtn == &aBtnTexObjectY );
+ bUpdatePreview = sal_True;
+ }
+ else if( pBtn == &aBtnShadow3d )
+ {
+ pBtn->Check( !pBtn->IsChecked() );
+ aFtSlant.Enable( pBtn->IsChecked() );
+ aMtrSlant.Enable( pBtn->IsChecked() );
+ bUpdatePreview = sal_True;
+ }
+ // Sonstige (keine Gruppen)
+ else if( pBtn != NULL )
+ {
+ pBtn->Check( !pBtn->IsChecked() );
+ bUpdatePreview = sal_True;
+ }
+
+ if( nSId > 0 )
+ {
+ SfxDispatcher* pDispatcher = LocalGetDispatcher(pBindings);
+ if (pDispatcher != NULL)
+ {
+ SfxBoolItem aItem( nSId, sal_True );
+ pDispatcher->Execute(
+ nSId, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
+ }
+ }
+ else if( bUpdatePreview == sal_True )
+ UpdatePreview();
+ }
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( Svx3DWin, ClickColorHdl, PushButton *, pBtn )
+{
+ SvColorDialog aColorDlg( this );
+ ColorLB* pLb;
+
+ if( pBtn == &aBtnLightColor )
+ pLb = GetLbByButton();
+ else if( pBtn == &aBtnAmbientColor )
+ pLb = &aLbAmbientlight;
+ else if( pBtn == &aBtnMatColor )
+ pLb = &aLbMatColor;
+ else if( pBtn == &aBtnEmissionColor )
+ pLb = &aLbMatEmission;
+ else // if( pBtn == &aBtnSpecularColor )
+ pLb = &aLbMatSpecular;
+
+ Color aColor = pLb->GetSelectEntryColor();
+
+ aColorDlg.SetColor( aColor );
+ if( aColorDlg.Execute() == RET_OK )
+ {
+ aColor = aColorDlg.GetColor();
+ if( LBSelectColor( pLb, aColor ) )
+ SelectHdl( pLb );
+ }
+ return( 0L );
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( Svx3DWin, SelectHdl, void *, p )
+{
+ if( p )
+ {
+ Color aColor;
+ sal_Bool bUpdatePreview = sal_False;
+
+ // Material
+ if( p == &aLbMatFavorites )
+ {
+ Color aColObj( COL_WHITE );
+ Color aColEmis( COL_BLACK );
+ Color aColSpec( COL_WHITE );
+ sal_uInt16 nSpecIntens = 20;
+
+ sal_uInt16 nPos = aLbMatFavorites.GetSelectEntryPos();
+ switch( nPos )
+ {
+ case 1: // Metall
+ {
+ aColObj = Color(230,230,255);
+ aColEmis = Color(10,10,30);
+ aColSpec = Color(200,200,200);
+ nSpecIntens = 20;
+ }
+ break;
+
+ case 2: // Gold
+ {
+ aColObj = Color(230,255,0);
+ aColEmis = Color(51,0,0);
+ aColSpec = Color(255,255,240);
+ nSpecIntens = 20;
+ }
+ break;
+
+ case 3: // Chrom
+ {
+ aColObj = Color(36,117,153);
+ aColEmis = Color(18,30,51);
+ aColSpec = Color(230,230,255);
+ nSpecIntens = 2;
+ }
+ break;
+
+ case 4: // Plastik
+ {
+ aColObj = Color(255,48,57);
+ aColEmis = Color(35,0,0);
+ aColSpec = Color(179,202,204);
+ nSpecIntens = 60;
+ }
+ break;
+
+ case 5: // Holz
+ {
+ aColObj = Color(153,71,1);
+ aColEmis = Color(21,22,0);
+ aColSpec = Color(255,255,153);
+ nSpecIntens = 75;
+ }
+ break;
+ }
+ LBSelectColor( &aLbMatColor, aColObj );
+ LBSelectColor( &aLbMatEmission, aColEmis );
+ LBSelectColor( &aLbMatSpecular, aColSpec );
+ aMtrMatSpecularIntensity.SetValue( nSpecIntens );
+
+ bUpdatePreview = sal_True;
+ }
+ else if( p == &aLbMatColor ||
+ p == &aLbMatEmission ||
+ p == &aLbMatSpecular )
+ {
+ aLbMatFavorites.SelectEntryPos( 0 );
+ bUpdatePreview = sal_True;
+ }
+ // Beleuchtung
+ else if( p == &aLbAmbientlight )
+ {
+ bUpdatePreview = sal_True;
+ }
+ else if( p == &aLbLight1 ||
+ p == &aLbLight2 ||
+ p == &aLbLight3 ||
+ p == &aLbLight4 ||
+ p == &aLbLight5 ||
+ p == &aLbLight6 ||
+ p == &aLbLight7 ||
+ p == &aLbLight8 )
+ {
+ bUpdatePreview = sal_True;
+ }
+ else if( p == &aLbShademode )
+ bUpdatePreview = sal_True;
+
+ if( bUpdatePreview == sal_True )
+ UpdatePreview();
+ }
+ return( 0L );
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( Svx3DWin, ModifyHdl, void*, pField )
+{
+ if( pField )
+ {
+ sal_Bool bUpdatePreview = sal_False;
+
+ // Material
+ if( pField == &aMtrMatSpecularIntensity )
+ {
+ bUpdatePreview = sal_True;
+ }
+ else if( pField == &aNumHorizontal )
+ {
+ bUpdatePreview = sal_True;
+ }
+ else if( pField == &aNumVertical )
+ {
+ bUpdatePreview = sal_True;
+ }
+ else if( pField == &aMtrSlant )
+ {
+ bUpdatePreview = sal_True;
+ }
+
+ if( bUpdatePreview == sal_True )
+ UpdatePreview();
+ }
+ return( 0L );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( Svx3DWin, ClickLightHdl, PushButton*, pBtn )
+{
+
+ if( pBtn )
+ {
+ sal_uInt16 nLightSource = GetLightSource( pBtn );
+ ColorLB* pLb = GetLbByButton( pBtn );
+ Color aColor( pLb->GetSelectEntryColor() );
+ SfxItemSet aLightItemSet(aCtlLightPreview.GetSvx3DLightControl().Get3DAttributes());
+ const bool bOnOff(GetUILightState( *(ImageButton*)pBtn ));
+
+ switch(nLightSource)
+ {
+ case 0: aLightItemSet.Put(Svx3DLightcolor1Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff1Item(bOnOff)); break;
+ case 1: aLightItemSet.Put(Svx3DLightcolor2Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff2Item(bOnOff)); break;
+ case 2: aLightItemSet.Put(Svx3DLightcolor3Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff3Item(bOnOff)); break;
+ case 3: aLightItemSet.Put(Svx3DLightcolor4Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff4Item(bOnOff)); break;
+ case 4: aLightItemSet.Put(Svx3DLightcolor5Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff5Item(bOnOff)); break;
+ case 5: aLightItemSet.Put(Svx3DLightcolor6Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff6Item(bOnOff)); break;
+ case 6: aLightItemSet.Put(Svx3DLightcolor7Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff7Item(bOnOff)); break;
+ default:
+ case 7: aLightItemSet.Put(Svx3DLightcolor8Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff8Item(bOnOff)); break;
+ }
+
+ aCtlLightPreview.GetSvx3DLightControl().Set3DAttributes(aLightItemSet);
+ aCtlLightPreview.GetSvx3DLightControl().SelectLight(nLightSource);
+ aCtlLightPreview.CheckSelection();
+ }
+ return( 0L );
+}
+
+
+// -----------------------------------------------------------------------
+IMPL_LINK( Svx3DWin, DoubleClickHdl, void*, EMPTYARG )
+{
+ //sal_uInt16 nItemId = aCtlFavorites.GetSelectItemId();
+
+ //SfxItemSet* pSet = (SfxItemSet*) pFavorSetList->GetObject( nItemId - 1 );
+ //Update( *pSet );
+
+ // und zuweisen
+ ClickAssignHdl( NULL );
+
+ return( 0L );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( Svx3DWin, ChangeLightCallbackHdl, void*, EMPTYARG )
+{
+ return( 0L );
+}
+
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( Svx3DWin, ChangeSelectionCallbackHdl, void*, EMPTYARG )
+{
+ const sal_uInt32 nLight(aCtlLightPreview.GetSvx3DLightControl().GetSelectedLight());
+ PushButton* pBtn = 0;
+
+ switch( nLight )
+ {
+ case 0: pBtn = &aBtnLight1; break;
+ case 1: pBtn = &aBtnLight2; break;
+ case 2: pBtn = &aBtnLight3; break;
+ case 3: pBtn = &aBtnLight4; break;
+ case 4: pBtn = &aBtnLight5; break;
+ case 5: pBtn = &aBtnLight6; break;
+ case 6: pBtn = &aBtnLight7; break;
+ case 7: pBtn = &aBtnLight8; break;
+ default: break;
+ }
+
+ if( pBtn )
+ ClickHdl( pBtn );
+ else
+ {
+ // Zustand: Keine Lampe selektiert
+ if( aBtnLight1.IsChecked() )
+ {
+ aBtnLight1.Check( sal_False );
+ aLbLight1.Enable( sal_False );
+ }
+ else if( aBtnLight2.IsChecked() )
+ {
+ aBtnLight2.Check( sal_False );
+ aLbLight2.Enable( sal_False );
+ }
+ else if( aBtnLight3.IsChecked() )
+ {
+ aBtnLight3.Check( sal_False );
+ aLbLight3.Enable( sal_False );
+ }
+ else if( aBtnLight4.IsChecked() )
+ {
+ aBtnLight4.Check( sal_False );
+ aLbLight4.Enable( sal_False );
+ }
+ else if( aBtnLight5.IsChecked() )
+ {
+ aBtnLight5.Check( sal_False );
+ aLbLight5.Enable( sal_False );
+ }
+ else if( aBtnLight6.IsChecked() )
+ {
+ aBtnLight6.Check( sal_False );
+ aLbLight6.Enable( sal_False );
+ }
+ else if( aBtnLight7.IsChecked() )
+ {
+ aBtnLight7.Check( sal_False );
+ aLbLight7.Enable( sal_False );
+ }
+ else if( aBtnLight8.IsChecked() )
+ {
+ aBtnLight8.Check( sal_False );
+ aLbLight8.Enable( sal_False );
+ }
+ aBtnLightColor.Enable( sal_False );
+ }
+
+ return( 0L );
+}
+
+// -----------------------------------------------------------------------
+// Methode um sicherzustellen, dass die LB auch mit einer Farbe gesetzt ist
+// Liefert sal_True zurueck, falls Farbe hinzugefuegt wurde
+// -----------------------------------------------------------------------
+sal_Bool Svx3DWin::LBSelectColor( ColorLB* pLb, const Color& rColor )
+{
+ sal_Bool bRet = sal_False;
+
+ pLb->SetNoSelection();
+ pLb->SelectEntry( rColor );
+ if( pLb->GetSelectEntryCount() == 0 )
+ {
+ String aStr(SVX_RES(RID_SVXFLOAT3D_FIX_R));
+
+ aStr += String::CreateFromInt32((sal_Int32)rColor.GetRed());
+ aStr += sal_Unicode(' ');
+ aStr += String(SVX_RES(RID_SVXFLOAT3D_FIX_G));
+ aStr += String::CreateFromInt32((sal_Int32)rColor.GetGreen());
+ aStr += sal_Unicode(' ');
+ aStr += String(SVX_RES(RID_SVXFLOAT3D_FIX_B));
+ aStr += String::CreateFromInt32((sal_Int32)rColor.GetBlue());
+
+ sal_uInt16 nPos = pLb->InsertEntry( rColor, aStr );
+ pLb->SelectEntryPos( nPos );
+ bRet = sal_True;
+ }
+ return( bRet );
+}
+
+// -----------------------------------------------------------------------
+void Svx3DWin::UpdatePreview()
+{
+ if( pModel == NULL )
+ pModel = new FmFormModel();
+
+ if(bOnly3DChanged)
+ {
+ // slot executen
+ SfxDispatcher* pDispatcher = LocalGetDispatcher(pBindings);
+ if (pDispatcher != NULL)
+ {
+ SfxBoolItem aItem( SID_3D_STATE, sal_True );
+ pDispatcher->Execute(
+ SID_3D_STATE, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
+ }
+ // Flag zuruecksetzen
+ bOnly3DChanged = sal_False;
+ }
+
+ // ItemSet besorgen
+ SfxItemSet aSet( pModel->GetItemPool(), SDRATTR_START, SDRATTR_END);
+
+ // Attribute holen und im Preview setzen
+ GetAttr( aSet );
+ aCtlPreview.Set3DAttributes( aSet );
+ aCtlLightPreview.GetSvx3DLightControl().Set3DAttributes( aSet );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// document is to be reloaded, destroy remembered ItemSet (#83951#)
+void Svx3DWin::DocumentReload()
+{
+ if(mpRemember2DAttributes)
+ delete mpRemember2DAttributes;
+ mpRemember2DAttributes = 0L;
+}
+
+// -----------------------------------------------------------------------
+void Svx3DWin::InitColorLB( const SdrModel* pDoc )
+{
+ aLbLight1.Fill( pDoc->GetColorTable() );
+ aLbLight2.CopyEntries( aLbLight1 );
+ aLbLight3.CopyEntries( aLbLight1 );
+ aLbLight4.CopyEntries( aLbLight1 );
+ aLbLight5.CopyEntries( aLbLight1 );
+ aLbLight6.CopyEntries( aLbLight1 );
+ aLbLight7.CopyEntries( aLbLight1 );
+ aLbLight8.CopyEntries( aLbLight1 );
+ aLbAmbientlight.CopyEntries( aLbLight1 );
+ aLbMatColor.CopyEntries( aLbLight1 );
+ aLbMatEmission.CopyEntries( aLbLight1 );
+ aLbMatSpecular.CopyEntries( aLbLight1 );
+
+ // Erstmal...
+ Color aColWhite( COL_WHITE );
+ Color aColBlack( COL_BLACK );
+ aLbLight1.SelectEntry( aColWhite );
+ aLbLight2.SelectEntry( aColWhite );
+ aLbLight3.SelectEntry( aColWhite );
+ aLbLight4.SelectEntry( aColWhite );
+ aLbLight5.SelectEntry( aColWhite );
+ aLbLight6.SelectEntry( aColWhite );
+ aLbLight7.SelectEntry( aColWhite );
+ aLbLight8.SelectEntry( aColWhite );
+ aLbAmbientlight.SelectEntry( aColBlack );
+ aLbMatColor.SelectEntry( aColWhite );
+ aLbMatEmission.SelectEntry( aColBlack );
+ aLbMatSpecular.SelectEntry( aColWhite );
+}
+
+// -----------------------------------------------------------------------
+sal_uInt16 Svx3DWin::GetLightSource( const PushButton* pBtn )
+{
+ sal_uInt16 nLight = 8;
+
+ if( pBtn == NULL )
+ {
+ if( aBtnLight1.IsChecked() )
+ nLight = 0;
+ else if( aBtnLight2.IsChecked() )
+ nLight = 1;
+ else if( aBtnLight3.IsChecked() )
+ nLight = 2;
+ else if( aBtnLight4.IsChecked() )
+ nLight = 3;
+ else if( aBtnLight5.IsChecked() )
+ nLight = 4;
+ else if( aBtnLight6.IsChecked() )
+ nLight = 5;
+ else if( aBtnLight7.IsChecked() )
+ nLight = 6;
+ else if( aBtnLight8.IsChecked() )
+ nLight = 7;
+ }
+ else
+ {
+ if( pBtn == &aBtnLight1 )
+ nLight = 0;
+ else if( pBtn == &aBtnLight2 )
+ nLight = 1;
+ else if( pBtn == &aBtnLight3 )
+ nLight = 2;
+ else if( pBtn == &aBtnLight4 )
+ nLight = 3;
+ else if( pBtn == &aBtnLight5 )
+ nLight = 4;
+ else if( pBtn == &aBtnLight6 )
+ nLight = 5;
+ else if( pBtn == &aBtnLight7 )
+ nLight = 6;
+ else if( pBtn == &aBtnLight8 )
+ nLight = 7;
+ }
+ return( nLight );
+};
+
+// -----------------------------------------------------------------------
+ColorLB* Svx3DWin::GetLbByButton( const PushButton* pBtn )
+{
+ ColorLB* pLb = NULL;
+
+ if( pBtn == NULL )
+ {
+ if( aBtnLight1.IsChecked() )
+ pLb = &aLbLight1;
+ else if( aBtnLight2.IsChecked() )
+ pLb = &aLbLight2;
+ else if( aBtnLight3.IsChecked() )
+ pLb = &aLbLight3;
+ else if( aBtnLight4.IsChecked() )
+ pLb = &aLbLight4;
+ else if( aBtnLight5.IsChecked() )
+ pLb = &aLbLight5;
+ else if( aBtnLight6.IsChecked() )
+ pLb = &aLbLight6;
+ else if( aBtnLight7.IsChecked() )
+ pLb = &aLbLight7;
+ else if( aBtnLight8.IsChecked() )
+ pLb = &aLbLight8;
+ }
+ else
+ {
+ if( pBtn == &aBtnLight1 )
+ pLb = &aLbLight1;
+ else if( pBtn == &aBtnLight2 )
+ pLb = &aLbLight2;
+ else if( pBtn == &aBtnLight3 )
+ pLb = &aLbLight3;
+ else if( pBtn == &aBtnLight4 )
+ pLb = &aLbLight4;
+ else if( pBtn == &aBtnLight5 )
+ pLb = &aLbLight5;
+ else if( pBtn == &aBtnLight6 )
+ pLb = &aLbLight6;
+ else if( pBtn == &aBtnLight7 )
+ pLb = &aLbLight7;
+ else if( pBtn == &aBtnLight8 )
+ pLb = &aLbLight8;
+ }
+ return( pLb );
+};
+
+/*************************************************************************
+|*
+|* Ableitung vom SfxChildWindow als "Behaelter" fuer Effekte
+|*
+\************************************************************************/
+__EXPORT Svx3DChildWindow::Svx3DChildWindow( Window* _pParent,
+ sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo ) :
+ SfxChildWindow( _pParent, nId )
+{
+ Svx3DWin* pWin = new Svx3DWin( pBindings, this, _pParent );
+ pWindow = pWin;
+
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+
+ pWin->Initialize( pInfo );
+}
+
+/*************************************************************************
+|*
+|* ControllerItem fuer 3DStatus
+|*
+\************************************************************************/
+Svx3DCtrlItem::Svx3DCtrlItem( sal_uInt16 _nId,
+ Svx3DWin* pWin,
+ SfxBindings* _pBindings) :
+ SfxControllerItem( _nId, *_pBindings ),
+ p3DWin( pWin )
+{
+}
+
+// -----------------------------------------------------------------------
+void __EXPORT Svx3DCtrlItem::StateChanged( sal_uInt16 /*nSId*/,
+ SfxItemState /*eState*/, const SfxPoolItem* /*pItem*/ )
+{
+}
+
+/*************************************************************************
+|*
+|* ControllerItem fuer Status Slot SID_CONVERT_TO_3D
+|*
+\************************************************************************/
+
+SvxConvertTo3DItem::SvxConvertTo3DItem(sal_uInt16 _nId, SfxBindings* _pBindings)
+: SfxControllerItem(_nId, *_pBindings),
+ bState(sal_False)
+{
+}
+
+void SvxConvertTo3DItem::StateChanged(sal_uInt16 /*_nId*/, SfxItemState eState, const SfxPoolItem* /*pState*/)
+{
+ sal_Bool bNewState = (eState != SFX_ITEM_DISABLED);
+ if(bNewState != bState)
+ {
+ bState = bNewState;
+ SfxDispatcher* pDispatcher = LocalGetDispatcher(&GetBindings());
+ if (pDispatcher != NULL)
+ {
+ SfxBoolItem aItem( SID_3D_STATE, sal_True );
+ pDispatcher->Execute(
+ SID_3D_STATE, SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD, &aItem, 0L);
+ }
+ }
+}
+
+
diff --git a/svx/source/engine3d/float3d.src b/svx/source/engine3d/float3d.src
new file mode 100644
index 000000000000..1947fead5556
--- /dev/null
+++ b/svx/source/engine3d/float3d.src
@@ -0,0 +1,1490 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svx/dialogs.hrc>
+#include "float3d.hrc"
+#include <svx/svxcommands.h>
+
+#define WIDTH 158
+#define HEIGHT 209
+#define BORDER 3
+#define BUTTON_WIDTH 13
+#define BUTTON_HEIGHT 13
+#define VT_BUTTON_WIDTH 18
+#define GROUP_Y (BORDER + BUTTON_HEIGHT + 3)
+#define GROUP_HEIGHT 95
+#define GROUP_WIDTH (WIDTH - 2 * BORDER)
+#define GROUP_PREV_X 60
+#define GROUP_PREV_Y (GROUP_Y + GROUP_HEIGHT + 1)
+#define GROUP_PREV_WIDTH (WIDTH - BORDER - GROUP_PREV_X)
+#define GROUP_PREV_HEIGHT (HEIGHT - GROUP_PREV_Y - BORDER)
+#define IMG_BUTTON_HEIGHT 15
+#define IMG_BUTTON_NEXT (IMG_BUTTON_HEIGHT + 2)
+#define IMG_BUTTON_SIZE MAP_APPFONT( BUTTON_WIDTH, IMG_BUTTON_HEIGHT )
+#define FIXED_LINE_HEIGHT 8
+#define FIXED_LINE_SIZE MAP_APPFONT( GROUP_WIDTH, FIXED_LINE_HEIGHT )
+#define TOP_FIXED_LINE_POS MAP_APPFONT( BORDER, 2+BORDER + IMG_BUTTON_HEIGHT )
+#define FT_WIDTH_SHORT 56
+#define FT_WIDTH_LONG 89
+#define FT_HEIGHT 8
+#define FT_OFFSET_NEXT (FT_HEIGHT + 6)
+#define FT_INDENT (BORDER + 6)
+#define FIRST_FT_START_Y (2+BORDER+IMG_BUTTON_HEIGHT + 13)
+#define SEGMENTS_START_Y (FIRST_FT_START_Y + 3*FT_OFFSET_NEXT + 13)
+#define NORMALS_START_Y (SEGMENTS_START_Y + 2*13)
+#define NORMALS_BT_START_Y (SEGMENTS_START_Y + 2*13 +11)
+#define SHADOW_START_Y (FIRST_FT_START_Y + 13)
+#define CAMERA_START_Y (SHADOW_START_Y + FT_OFFSET_NEXT + 13)
+#define SPECULAR_START_Y (FIRST_FT_START_Y + 2*FT_OFFSET_NEXT + 13)
+
+#define MASKCOLOR MaskColor = Color { Red=0xFFFF; Green=0x0000; Blue=0xFFFF; };
+
+
+DockingWindow RID_SVXFLOAT_3D
+{
+ HelpID = CMD_SID_3D_WIN ;
+ Border = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Sizeable = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+ Dockable = TRUE ;
+ EnableResizing = TRUE ;
+ Size = MAP_APPFONT ( WIDTH , HEIGHT ) ;
+ Text [ en-US ] = "3D Effects" ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+
+ ImageButton BTN_GEO
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_GEO";
+ Pos = MAP_APPFONT ( 4 , BORDER ) ;
+ Size = MAP_APPFONT ( VT_BUTTON_WIDTH , IMG_BUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "3dgeo.bmp" ; };
+ MASKCOLOR
+ };
+ QuickHelpText [ en-US ] = "Geometry" ;
+ };
+ ImageButton BTN_REPRESENTATION
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_REPRESENTATION";
+ Pos = MAP_APPFONT ( 22 , BORDER ) ;
+ Size = MAP_APPFONT ( VT_BUTTON_WIDTH , IMG_BUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "3drepres.bmp" ; };
+ MASKCOLOR
+ };
+ QuickHelpText [ en-US ] = "Shading" ;
+ };
+ ImageButton BTN_LIGHT
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_LIGHT";
+ Pos = MAP_APPFONT ( 40 , BORDER ) ;
+ Size = MAP_APPFONT ( VT_BUTTON_WIDTH , IMG_BUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "3dlight.bmp" ; };
+ MASKCOLOR
+ };
+ QuickHelpText [ en-US ] = "Illumination" ;
+ };
+ ImageButton BTN_TEXTURE
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_TEXTURE";
+ Pos = MAP_APPFONT ( 58 , BORDER ) ;
+ Size = MAP_APPFONT ( VT_BUTTON_WIDTH , IMG_BUTTON_HEIGHT ) ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "3dtextur.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Textures" ;
+ };
+ ImageButton BTN_MATERIAL
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_MATERIAL";
+ Pos = MAP_APPFONT ( 76 , BORDER ) ;
+ Size = MAP_APPFONT ( VT_BUTTON_WIDTH , IMG_BUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "material.bmp" ; };
+ MASKCOLOR
+ };
+ QuickHelpText [ en-US ] = "Material" ;
+ };
+
+ ImageButton BTN_UPDATE
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_UPDATE";
+ Pos = MAP_APPFONT ( WIDTH - BORDER - BUTTON_WIDTH * 2 , BORDER ) ;
+ Size = IMG_BUTTON_SIZE;
+ TabStop = TRUE ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "sc10350.bmp" ; };
+ MASKCOLOR
+ };
+ QuickHelpText [ en-US ] = "Update" ;
+ };
+ ImageButton BTN_ASSIGN
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_ASSIGN";
+ Pos = MAP_APPFONT ( WIDTH - BORDER - BUTTON_WIDTH , BORDER ) ;
+ Size = IMG_BUTTON_SIZE;
+ TabStop = TRUE ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "apply.bmp" ; };
+ MASKCOLOR
+ };
+ QuickHelpText [ en-US ] = "Assign" ;
+ };
+ // Unterer Teil
+ ImageButton BTN_CHANGE_TO_3D
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_CHANGE_TO_3D";
+ Pos = MAP_APPFONT ( 9 , 200 - BUTTON_HEIGHT ) ;
+ Size = IMG_BUTTON_SIZE;
+ TabStop = TRUE ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "convrt3d.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Convert to 3D" ;
+ };
+ ImageButton BTN_LATHE_OBJ
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_LATHE_OBJ";
+ Pos = MAP_APPFONT ( 9 + BUTTON_WIDTH + 1 , 200 - BUTTON_HEIGHT ) ;
+ Size = IMG_BUTTON_SIZE;
+ TabStop = TRUE ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "rotate3d.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Convert to Lathe Object" ;
+ };
+ ImageButton BTN_PERSPECTIVE
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_PERSPECTIVE";
+ Pos = MAP_APPFONT ( 9 + ( BUTTON_WIDTH + 1 ) * 2 , 200 - BUTTON_HEIGHT ) ;
+ Size = IMG_BUTTON_SIZE;
+ TabStop = TRUE ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "persp3d.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Perspective On/Off" ;
+ };
+ Control CTL_PREVIEW
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 66 , 124 ) ;
+ Size = MAP_APPFONT ( 83 , 76 ) ;
+ TabStop = TRUE ;
+ };
+ Control CTL_LIGHT_PREVIEW
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 66 , 124 ) ;
+ Size = MAP_APPFONT ( 83 , 76 ) ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_GEOMETRIE
+ {
+ Pos = TOP_FIXED_LINE_POS;
+ Size = FIXED_LINE_SIZE;
+ Text [ en-US ] = "Geometry" ;
+ };
+ FixedText FT_PERCENT_DIAGONAL
+ {
+ Pos = MAP_APPFONT ( FT_INDENT, FIRST_FT_START_Y );
+ Size = MAP_APPFONT ( FT_WIDTH_LONG , FT_HEIGHT ) ;
+ Text [ en-US ] = "R~ounded edges" ;
+ };
+ MetricField MTR_PERCENT_DIAGONAL
+ {
+ HelpID = "svx:MetricField:RID_SVXFLOAT_3D:MTR_PERCENT_DIAGONAL";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( FT_INDENT + FT_WIDTH_LONG + 1 , FIRST_FT_START_Y - 2 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ SpinSize = 5 ;
+ Maximum = 100 ;
+ Last = 100 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = " %" ;
+ };
+ FixedText FT_BACKSCALE
+ {
+ Pos = MAP_APPFONT ( FT_INDENT , FIRST_FT_START_Y + FT_OFFSET_NEXT ) ;
+ Size = MAP_APPFONT ( FT_WIDTH_LONG , FT_HEIGHT ) ;
+ Text [ en-US ] = "~Scaled depth" ;
+ };
+ MetricField MTR_BACKSCALE
+ {
+ HelpID = "svx:MetricField:RID_SVXFLOAT_3D:MTR_BACKSCALE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( FT_INDENT + FT_WIDTH_LONG + 1,
+ FIRST_FT_START_Y + FT_OFFSET_NEXT - 2 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ SpinSize = 5 ;
+ Maximum = 10000 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = " %" ;
+ Last = 10000 ;
+ };
+ FixedText FT_END_ANGLE
+ {
+ Pos = MAP_APPFONT ( FT_INDENT , FIRST_FT_START_Y + 2*FT_OFFSET_NEXT ) ;
+ Size = MAP_APPFONT ( FT_WIDTH_LONG , FT_HEIGHT ) ;
+ Text [ en-US ] = "~Rotation angle" ;
+ };
+ MetricField MTR_END_ANGLE
+ {
+ HelpID = "svx:MetricField:RID_SVXFLOAT_3D:MTR_END_ANGLE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( FT_INDENT + FT_WIDTH_LONG + 1,
+ FIRST_FT_START_Y + 2*FT_OFFSET_NEXT - 2 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ SpinSize = 5 ;
+ Unit = FUNIT_CUSTOM ;
+ Maximum = 36000 ;
+ Last = 36000 ;
+ DecimalDigits = 1 ;
+ CustomUnitText [ en-US ] = " degree(s)";
+ };
+ FixedText FT_DEPTH
+ {
+ Pos = MAP_APPFONT ( FT_INDENT , FIRST_FT_START_Y + 3*FT_OFFSET_NEXT ) ;
+ Size = MAP_APPFONT ( FT_WIDTH_LONG , FT_HEIGHT ) ;
+ Text [ en-US ] = "~Depth" ;
+ };
+ MetricField MTR_DEPTH
+ {
+ HelpID = "svx:MetricField:RID_SVXFLOAT_3D:MTR_DEPTH";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( FT_INDENT + FT_WIDTH_LONG + 1,
+ FIRST_FT_START_Y + 3*FT_OFFSET_NEXT - 2 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Unit = FUNIT_MM ;
+ StrictFormat = TRUE ;
+ Minimum = 0 ;
+ First = 0 ;
+ Maximum = 10000000 ;
+ Last = 10000000 ;
+ DecimalDigits = 2 ;
+ SpinSize = 100 ;
+ };
+ FixedLine FL_SEGMENTS
+ {
+ Pos = MAP_APPFONT ( BORDER , SEGMENTS_START_Y ) ;
+ Size = FIXED_LINE_SIZE;
+ Text [ en-US ] = "Segments" ;
+ };
+ // Geometrie
+ FixedText FT_HORIZONTAL
+ {
+ Pos = MAP_APPFONT ( FT_INDENT , SEGMENTS_START_Y+13 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Text [ en-US ] = "~Horizontal" ;
+ };
+ NumericField NUM_HORIZONTAL
+ {
+ HelpID = "svx:NumericField:RID_SVXFLOAT_3D:NUM_HORIZONTAL";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( FT_INDENT + 42, SEGMENTS_START_Y+13-2 ) ;
+ Size = MAP_APPFONT ( 22 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 2 ;
+ First = 2 ;
+ Maximum = 256 ;
+ Last = 256 ;
+ };
+ FixedText FT_VERTICAL
+ {
+ Pos = MAP_APPFONT ( FT_INDENT + 74 , SEGMENTS_START_Y+13 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Text [ en-US ] = "~Vertical" ;
+ };
+ NumericField NUM_VERTICAL
+ {
+ HelpID = "svx:NumericField:RID_SVXFLOAT_3D:NUM_VERTICAL";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( FT_INDENT + 114+2 , SEGMENTS_START_Y+13-2 ) ;
+ Size = MAP_APPFONT ( 22 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 2 ;
+ First = 2 ;
+ Maximum = 256 ;
+ Last = 256 ;
+ };
+
+ FixedLine FL_NORMALS
+ {
+ Pos = MAP_APPFONT ( BORDER , NORMALS_START_Y ) ;
+ Size = MAP_APPFONT ( 54 , 8 ) ;
+ Text [ en-US ] = "Normals" ;
+ };
+ ImageButton BTN_NORMALS_OBJ
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_NORMALS_OBJ";
+ Pos = MAP_APPFONT ( FT_INDENT , NORMALS_BT_START_Y ) ;
+ Size = IMG_BUTTON_SIZE;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "normobjs.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Object-Specific" ;
+ };
+ ImageButton BTN_NORMALS_FLAT
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_NORMALS_FLAT";
+ Pos = MAP_APPFONT ( FT_INDENT + (1+BUTTON_WIDTH) , NORMALS_BT_START_Y ) ;
+ Size = IMG_BUTTON_SIZE;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "normflat.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Flat" ;
+ };
+ ImageButton BTN_NORMALS_SPHERE
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_NORMALS_SPHERE";
+ Pos = MAP_APPFONT ( FT_INDENT + (1+BUTTON_WIDTH) * 2 , NORMALS_BT_START_Y ) ;
+ Size = IMG_BUTTON_SIZE;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "normsphe.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Spherical" ;
+ };
+ ImageButton BTN_NORMALS_INVERT
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_NORMALS_INVERT";
+ Pos = MAP_APPFONT ( FT_INDENT , NORMALS_BT_START_Y + IMG_BUTTON_NEXT ) ;
+ Size = IMG_BUTTON_SIZE;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "invert3d.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Invert Normals" ;
+ };
+ ImageButton BTN_TWO_SIDED_LIGHTING
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_TWO_SIDED_LIGHTING";
+ Pos = MAP_APPFONT ( FT_INDENT + (1+BUTTON_WIDTH) * 2 ,
+ NORMALS_BT_START_Y + IMG_BUTTON_NEXT ) ;
+ Size = IMG_BUTTON_SIZE;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "lght2sid.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Double-Sided Illumination" ;
+ };
+ ImageButton BTN_DOUBLE_SIDED
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_DOUBLE_SIDED";
+ Pos = MAP_APPFONT ( FT_INDENT , NORMALS_BT_START_Y + 2*IMG_BUTTON_NEXT ) ;
+ Size = IMG_BUTTON_SIZE;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "doublesi.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Double-Sided" ;
+ };
+
+ // Darstellung
+ FixedText FT_SHADEMODE
+ {
+ Pos = MAP_APPFONT ( FT_INDENT , FIRST_FT_START_Y ) ;
+ Size = MAP_APPFONT ( FT_WIDTH_SHORT , FT_HEIGHT ) ;
+ Text [ en-US ] = "~Mode" ;
+ };
+ ListBox LB_SHADEMODE
+ {
+ HelpID = "svx:ListBox:RID_SVXFLOAT_3D:LB_SHADEMODE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 66 , 30 ) ;
+ Size = MAP_APPFONT ( 83 , 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Flat" ; > ;
+ < "Phong" ; > ;
+ < "Gouraud" ; > ;
+ };
+ };
+ FixedLine FL_SHADOW
+ {
+ Pos = MAP_APPFONT ( BORDER , SHADOW_START_Y ) ;
+ Size = FIXED_LINE_SIZE;
+ Text [ en-US ] = "Shadow" ;
+ };
+ ImageButton BTN_SHADOW_3D
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_SHADOW_3D";
+ Pos = MAP_APPFONT ( FT_INDENT , SHADOW_START_Y + 11 ) ;
+ Size = IMG_BUTTON_SIZE;
+ TabStop = TRUE ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "shadow3d.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "3D Shadowing On/Off" ;
+ };
+ FixedText FT_SLANT
+ {
+ Pos = MAP_APPFONT ( FT_INDENT + BUTTON_WIDTH + 3 , SHADOW_START_Y + 11 + 2 ) ;
+ Size = MAP_APPFONT ( 68 , FT_HEIGHT ) ;
+ Right = TRUE;
+ Text [ en-US ] = "S~urface angle" ;
+ };
+ MetricField MTR_SLANT
+ {
+ HelpID = "svx:MetricField:RID_SVXFLOAT_3D:MTR_SLANT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 99 , SHADOW_START_Y + 11 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ SpinSize = 5 ;
+ Maximum = 90 ;
+ Unit = FUNIT_CUSTOM ;
+ Last = 90 ;
+ CustomUnitText [ en-US ] = " degree(s)";
+ };
+
+ FixedLine FL_CAMERA
+ {
+ Pos = MAP_APPFONT ( BORDER , CAMERA_START_Y ) ;
+ Size = FIXED_LINE_SIZE;
+ Text [ en-US ] = "Camera" ;
+ };
+ FixedText FT_DISTANCE
+ {
+ Pos = MAP_APPFONT ( FT_INDENT , CAMERA_START_Y + 11 ) ;
+ Size = MAP_APPFONT ( FT_WIDTH_LONG , FT_HEIGHT ) ;
+ Text [ en-US ] = "~Distance" ;
+ };
+ MetricField MTR_DISTANCE
+ {
+ HelpID = "svx:MetricField:RID_SVXFLOAT_3D:MTR_DISTANCE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( FT_INDENT + FT_WIDTH_LONG + 1 ,
+ CAMERA_START_Y + 11 - 2 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_MM ;
+ Minimum = 1 ;
+ First = 1 ;
+ Maximum = 1000000 ;
+ Last = 1000000 ;
+ DecimalDigits = 2 ;
+ SpinSize = 100 ;
+ };
+ FixedText FT_FOCAL_LENGTH
+ {
+ Pos = MAP_APPFONT ( FT_INDENT , CAMERA_START_Y + 11 + FT_OFFSET_NEXT ) ;
+ Size = MAP_APPFONT ( FT_WIDTH_LONG , FT_HEIGHT ) ;
+ Text [ en-US ] = "~Focal length" ;
+ };
+ MetricField MTR_FOCAL_LENGTH
+ {
+ HelpID = "svx:MetricField:RID_SVXFLOAT_3D:MTR_FOCAL_LENGTH";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( FT_INDENT + FT_WIDTH_LONG + 1 ,
+ CAMERA_START_Y + 11 + FT_OFFSET_NEXT - 2 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_MM ;
+ Minimum = 1 ;
+ First = 1 ;
+ Maximum = 1000000 ;
+ Last = 1000000 ;
+ DecimalDigits = 2 ;
+ SpinSize = 100 ;
+ };
+ FixedLine FL_REPRESENTATION
+ {
+ Pos = TOP_FIXED_LINE_POS;
+ Size = FIXED_LINE_SIZE;
+ Text [ en-US ] = "Shading" ;
+ };
+ // Beleuchtung
+ FixedText FT_LIGHTSOURCE
+ {
+ Pos = MAP_APPFONT ( FT_INDENT , FIRST_FT_START_Y ) ;
+ Size = MAP_APPFONT ( FT_WIDTH_LONG , FT_HEIGHT ) ;
+ Text [ en-US ] = "~Light source" ;
+ };
+ ImageButton BTN_LIGHT_1
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_LIGHT_1";
+ Pos = MAP_APPFONT ( FT_INDENT , FIRST_FT_START_Y + 11 ) ;
+ Size = MAP_APPFONT ( 12 , 14 ) ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "light.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Light Source 1" ;
+ };
+ ImageButton BTN_LIGHT_2
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_LIGHT_2";
+ Pos = MAP_APPFONT ( FT_INDENT + 13 , FIRST_FT_START_Y + 11 ) ;
+ Size = MAP_APPFONT ( 12 , 14 ) ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "light.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Light Source 2" ;
+ };
+ ImageButton BTN_LIGHT_3
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_LIGHT_3";
+ Pos = MAP_APPFONT ( FT_INDENT + 2*13 , FIRST_FT_START_Y + 11 ) ;
+ Size = MAP_APPFONT ( 12 , 14 ) ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "light.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Light Source 3" ;
+ };
+ ImageButton BTN_LIGHT_4
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_LIGHT_4";
+ Pos = MAP_APPFONT ( FT_INDENT + 3*13 , FIRST_FT_START_Y + 11 ) ;
+ Size = MAP_APPFONT ( 12 , 14 ) ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "light.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Light Source 4" ;
+ };
+ ImageButton BTN_LIGHT_5
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_LIGHT_5";
+ Pos = MAP_APPFONT ( FT_INDENT , FIRST_FT_START_Y + 26 ) ;
+ Size = MAP_APPFONT ( 12 , 14 ) ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "light.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Light Source 5" ;
+ };
+ ImageButton BTN_LIGHT_6
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_LIGHT_6";
+ Pos = MAP_APPFONT ( FT_INDENT + 13, FIRST_FT_START_Y + 26 ) ;
+ Size = MAP_APPFONT ( 12 , 14 ) ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "light.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Light Source 6" ;
+ };
+ ImageButton BTN_LIGHT_7
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_LIGHT_7";
+ Pos = MAP_APPFONT ( FT_INDENT + 2*13, FIRST_FT_START_Y + 26 ) ;
+ Size = MAP_APPFONT ( 12 , 14 ) ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "light.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Light Source 7" ;
+ };
+ ImageButton BTN_LIGHT_8
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_LIGHT_8";
+ Pos = MAP_APPFONT ( FT_INDENT +3*13 , FIRST_FT_START_Y + 26 ) ;
+ Size = MAP_APPFONT ( 12 , 14 ) ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "light.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Light Source 8" ;
+ };
+ ListBox LB_LIGHT_1
+ {
+ HelpID = "svx:ListBox:RID_SVXFLOAT_3D:LB_LIGHT_1";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 66 , FIRST_FT_START_Y + 11 ) ;
+ Size = MAP_APPFONT ( 68 , 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ ListBox LB_LIGHT_2
+ {
+ HelpID = "svx:ListBox:RID_SVXFLOAT_3D:LB_LIGHT_2";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 66 , FIRST_FT_START_Y + 11 ) ;
+ Size = MAP_APPFONT ( 68 , 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ ListBox LB_LIGHT_3
+ {
+ HelpID = "svx:ListBox:RID_SVXFLOAT_3D:LB_LIGHT_3";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 66 , FIRST_FT_START_Y + 11 ) ;
+ Size = MAP_APPFONT ( 68 , 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ ListBox LB_LIGHT_4
+ {
+ HelpID = "svx:ListBox:RID_SVXFLOAT_3D:LB_LIGHT_4";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 66 , FIRST_FT_START_Y + 11 ) ;
+ Size = MAP_APPFONT ( 68 , 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ ListBox LB_LIGHT_5
+ {
+ HelpID = "svx:ListBox:RID_SVXFLOAT_3D:LB_LIGHT_5";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 66 , FIRST_FT_START_Y + 11 ) ;
+ Size = MAP_APPFONT ( 68 , 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ ListBox LB_LIGHT_6
+ {
+ HelpID = "svx:ListBox:RID_SVXFLOAT_3D:LB_LIGHT_6";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 66 , FIRST_FT_START_Y + 11 ) ;
+ Size = MAP_APPFONT ( 68 , 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ ListBox LB_LIGHT_7
+ {
+ HelpID = "svx:ListBox:RID_SVXFLOAT_3D:LB_LIGHT_7";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 66 , FIRST_FT_START_Y + 11 ) ;
+ Size = MAP_APPFONT ( 68 , 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ ListBox LB_LIGHT_8
+ {
+ HelpID = "svx:ListBox:RID_SVXFLOAT_3D:LB_LIGHT_8";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 66 , FIRST_FT_START_Y + 11 ) ;
+ Size = MAP_APPFONT ( 68 , 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ ImageButton BTN_LIGHT_COLOR
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_LIGHT_COLOR";
+ Pos = MAP_APPFONT ( 137 , FIRST_FT_START_Y + 11 ) ;
+ Size = MAP_APPFONT ( 12 , 14 ) ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "colordlg.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Colors Dialog" ;
+ };
+ FixedText FT_AMBIENTLIGHT
+ {
+ Pos = MAP_APPFONT ( FT_INDENT, FIRST_FT_START_Y + 53 ) ;
+ Size = MAP_APPFONT ( FT_WIDTH_SHORT , FT_HEIGHT ) ;
+ Text [ en-US ] = "~Ambient light" ;
+ };
+ ListBox LB_AMBIENTLIGHT
+ {
+ HelpID = "svx:ListBox:RID_SVXFLOAT_3D:LB_AMBIENTLIGHT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( FT_INDENT + FT_WIDTH_SHORT + 1 , FIRST_FT_START_Y + 53 ) ;
+ Size = MAP_APPFONT ( 68 , 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ ImageButton BTN_AMBIENT_COLOR
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_AMBIENT_COLOR";
+ Pos = MAP_APPFONT ( 137 , FIRST_FT_START_Y + 53 ) ;
+ Size = MAP_APPFONT ( 12 , 14 ) ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "colordlg.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Colors Dialog" ;
+ };
+
+ FixedLine FL_LIGHT
+ {
+ Pos = TOP_FIXED_LINE_POS;
+ Size = FIXED_LINE_SIZE ;
+ Text [ en-US ] = "Illumination" ;
+ };
+ // Texturen
+ FixedText FT_TEX_KIND
+ {
+ Pos = MAP_APPFONT ( FT_INDENT , FIRST_FT_START_Y ) ;
+ Size = MAP_APPFONT ( FT_WIDTH_SHORT , FT_HEIGHT ) ;
+ Text [ en-US ] = "~Type" ;
+ };
+ ImageButton BTN_TEX_LUMINANCE
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_TEX_LUMINANCE";
+ Pos = MAP_APPFONT ( FT_INDENT + FT_WIDTH_SHORT + 1,
+ FIRST_FT_START_Y - 2 ) ;
+ Size = IMG_BUTTON_SIZE;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "luminanc.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Black & White" ;
+ };
+ ImageButton BTN_TEX_COLOR
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_TEX_COLOR";
+ Pos = MAP_APPFONT ( FT_INDENT + FT_WIDTH_SHORT + 1 + BUTTON_WIDTH,
+ FIRST_FT_START_Y - 2 ) ;
+ Size = IMG_BUTTON_SIZE;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "color.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Color" ;
+ };
+ FixedText FT_TEX_MODE
+ {
+ Pos = MAP_APPFONT ( FT_INDENT , FIRST_FT_START_Y + IMG_BUTTON_NEXT ) ;
+ Size = MAP_APPFONT ( FT_WIDTH_SHORT , FT_HEIGHT ) ;
+ Text [ en-US ] = "~Mode" ;
+ };
+ ImageButton BTN_TEX_REPLACE
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_TEX_REPLACE";
+ Pos = MAP_APPFONT ( FT_INDENT + FT_WIDTH_SHORT + 1,
+ FIRST_FT_START_Y + IMG_BUTTON_NEXT - 2 ) ;
+ Size = IMG_BUTTON_SIZE;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "replac3d.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Only Texture" ;
+ };
+ ImageButton BTN_TEX_MODULATE
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_TEX_MODULATE";
+ Pos = MAP_APPFONT ( FT_INDENT + FT_WIDTH_SHORT + 1 + BUTTON_WIDTH,
+ FIRST_FT_START_Y + IMG_BUTTON_NEXT - 2 ) ;
+ Size = IMG_BUTTON_SIZE;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "modula3d.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Texture and Shading" ;
+ };
+ ImageButton BTN_TEX_BLEND
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_TEX_BLEND";
+ Pos = MAP_APPFONT ( FT_INDENT + FT_WIDTH_SHORT + 1 + 2*BUTTON_WIDTH,
+ FIRST_FT_START_Y + IMG_BUTTON_NEXT - 2 ) ;
+ Size = IMG_BUTTON_SIZE;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "blend3d.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Texture, Shadow and Color" ;
+ };
+ FixedText FT_TEX_PROJECTION_X
+ {
+ Pos = MAP_APPFONT ( FT_INDENT , FIRST_FT_START_Y + 2*IMG_BUTTON_NEXT ) ;
+ Size = MAP_APPFONT ( FT_WIDTH_SHORT , FT_HEIGHT ) ;
+ Text [ en-US ] = "~Projection X" ;
+ };
+ ImageButton BTN_TEX_OBJECT_X
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_TEX_OBJECT_X";
+ Pos = MAP_APPFONT ( FT_INDENT + FT_WIDTH_SHORT + 1,
+ FIRST_FT_START_Y + 2*IMG_BUTTON_NEXT - 2 ) ;
+ Size = IMG_BUTTON_SIZE;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "objspc3d.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Object-Specific" ;
+ };
+ ImageButton BTN_TEX_PARALLEL_X
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_TEX_PARALLEL_X";
+ Pos = MAP_APPFONT ( FT_INDENT + FT_WIDTH_SHORT + 1 + BUTTON_WIDTH,
+ FIRST_FT_START_Y + 2*IMG_BUTTON_NEXT - 2 ) ;
+ Size = IMG_BUTTON_SIZE;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "parallel.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Parallel" ;
+ };
+ ImageButton BTN_TEX_CIRCLE_X
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_TEX_CIRCLE_X";
+ Pos = MAP_APPFONT ( FT_INDENT + FT_WIDTH_SHORT + 1 + 2*BUTTON_WIDTH,
+ FIRST_FT_START_Y + 2*IMG_BUTTON_NEXT - 2 ) ;
+ Size = IMG_BUTTON_SIZE;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "sphere3d.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Circular" ;
+ };
+ FixedText FT_TEX_PROJECTION_Y
+ {
+ Pos = MAP_APPFONT ( FT_INDENT , FIRST_FT_START_Y + 3*IMG_BUTTON_NEXT ) ;
+ Size = MAP_APPFONT ( FT_WIDTH_SHORT , FT_HEIGHT ) ;
+ Text [ en-US ] = "P~rojection Y" ;
+ };
+ ImageButton BTN_TEX_OBJECT_Y
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_TEX_OBJECT_Y";
+ Pos = MAP_APPFONT ( FT_INDENT + FT_WIDTH_SHORT + 1,
+ FIRST_FT_START_Y + 3*IMG_BUTTON_NEXT - 2 ) ;
+ Size = IMG_BUTTON_SIZE;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "objspc3d.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Object-Specific" ;
+ };
+ ImageButton BTN_TEX_PARALLEL_Y
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_TEX_PARALLEL_Y";
+ Pos = MAP_APPFONT ( FT_INDENT + FT_WIDTH_SHORT + 1 + BUTTON_WIDTH,
+ FIRST_FT_START_Y + 3*IMG_BUTTON_NEXT - 2 ) ;
+ Size = IMG_BUTTON_SIZE;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "parallel.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Parallel" ;
+ };
+ ImageButton BTN_TEX_CIRCLE_Y
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_TEX_CIRCLE_Y";
+ Pos = MAP_APPFONT ( FT_INDENT + FT_WIDTH_SHORT + 1 + 2*BUTTON_WIDTH,
+ FIRST_FT_START_Y + 3*IMG_BUTTON_NEXT - 2 ) ;
+ Size = IMG_BUTTON_SIZE;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "sphere3d.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Circular" ;
+ };
+ FixedText FT_TEX_FILTER
+ {
+ Pos = MAP_APPFONT ( FT_INDENT , FIRST_FT_START_Y + 4*IMG_BUTTON_NEXT ) ;
+ Size = MAP_APPFONT ( FT_WIDTH_SHORT , FT_HEIGHT ) ;
+ Text [ en-US ] = "~Filtering" ;
+ };
+ ImageButton BTN_TEX_FILTER
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_TEX_FILTER";
+ Pos = MAP_APPFONT ( FT_INDENT + FT_WIDTH_SHORT + 1,
+ FIRST_FT_START_Y + 4*IMG_BUTTON_NEXT - 2 ) ;
+ Size = IMG_BUTTON_SIZE;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "filter3d.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Filtering On/Off" ;
+ };
+ FixedLine FL_TEXTURE
+ {
+ Pos = TOP_FIXED_LINE_POS;
+ Size = FIXED_LINE_SIZE;
+ Text [ en-US ] = "Textures" ;
+ };
+ // Material
+ /* Control CTL_MATERIAL
+ {
+ //HelpId = HID_SD_CTL_FAVORITES ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( BORDER + 6 , GROUP_Y + 9 ) ;
+ Size = MAP_APPFONT ( GROUP_WIDTH - 12 , GROUP_HEIGHT - 15 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+*/
+ // Materialeditor
+ FixedText FT_MAT_FAVORITES
+ {
+ Pos = MAP_APPFONT ( FT_INDENT , FIRST_FT_START_Y ) ;
+ Size = MAP_APPFONT ( FT_WIDTH_SHORT , FT_HEIGHT ) ;
+ Text [ en-US ] = "~Favorites" ;
+ };
+ ListBox LB_MAT_FAVORITES
+ {
+ HelpID = "svx:ListBox:RID_SVXFLOAT_3D:LB_MAT_FAVORITES";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( FT_INDENT + FT_WIDTH_SHORT + 1,
+ FIRST_FT_START_Y - 2 ) ;
+ Size = MAP_APPFONT ( 83 , 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "User-defined" ; > ;
+ < "Metal" ; > ;
+ < "Gold" ; > ;
+ < "Chrome" ; > ;
+ < "Plastic" ; > ;
+ < "Wood" ; > ;
+ };
+ };
+ FixedText FT_MAT_COLOR
+ {
+ Pos = MAP_APPFONT ( FT_INDENT , FIRST_FT_START_Y + FT_OFFSET_NEXT ) ;
+ Size = MAP_APPFONT ( FT_WIDTH_SHORT , FT_HEIGHT ) ;
+ Text [ en-US ] = "~Object color" ;
+ };
+ ListBox LB_MAT_COLOR
+ {
+ HelpID = "svx:ListBox:RID_SVXFLOAT_3D:LB_MAT_COLOR";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( FT_INDENT + FT_WIDTH_SHORT + 1 ,
+ FIRST_FT_START_Y + FT_OFFSET_NEXT - 2 ) ;
+ Size = MAP_APPFONT ( 68 , 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ ImageButton BTN_MAT_COLOR
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_MAT_COLOR";
+ Pos = MAP_APPFONT ( FT_INDENT + FT_WIDTH_SHORT + 72 ,
+ FIRST_FT_START_Y + FT_OFFSET_NEXT - 2 ) ;
+ Size = MAP_APPFONT ( 12, 14 ) ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "colordlg.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Colors Dialog" ;
+ };
+ FixedText FT_MAT_EMISSION
+ {
+ Pos = MAP_APPFONT ( FT_INDENT , FIRST_FT_START_Y + 2*FT_OFFSET_NEXT ) ;
+ Size = MAP_APPFONT ( FT_WIDTH_SHORT , FT_HEIGHT ) ;
+ Text [ en-US ] = "~Illumination color" ;
+ };
+ ListBox LB_MAT_EMISSION
+ {
+ HelpID = "svx:ListBox:RID_SVXFLOAT_3D:LB_MAT_EMISSION";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( FT_INDENT + FT_WIDTH_SHORT + 1 ,
+ FIRST_FT_START_Y + 2*FT_OFFSET_NEXT - 2 ) ;
+ Size = MAP_APPFONT ( 68 , 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ ImageButton BTN_EMISSION_COLOR
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_EMISSION_COLOR";
+ Pos = MAP_APPFONT ( FT_INDENT + FT_WIDTH_SHORT + 72 ,
+ FIRST_FT_START_Y + 2*FT_OFFSET_NEXT - 2 ) ;
+ Size = MAP_APPFONT ( 12, 14 ) ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "colordlg.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Colors Dialog" ;
+ };
+
+ FixedLine FL_MAT_SPECULAR
+ {
+ Pos = MAP_APPFONT ( BORDER , SPECULAR_START_Y ) ;
+ Size = FIXED_LINE_SIZE;
+ Text [ en-US ] = "Specular" ;
+ };
+ FixedText FT_MAT_SPECULAR
+ {
+ Pos = MAP_APPFONT ( FT_INDENT , SPECULAR_START_Y + 13 ) ;
+ Size = MAP_APPFONT ( FT_WIDTH_SHORT , FT_HEIGHT ) ;
+ Text [ en-US ] = "~Color" ;
+ };
+ ListBox LB_MAT_SPECULAR
+ {
+ HelpID = "svx:ListBox:RID_SVXFLOAT_3D:LB_MAT_SPECULAR";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( FT_INDENT + FT_WIDTH_SHORT + 1, SPECULAR_START_Y + 13 - 2 ) ;
+ Size = MAP_APPFONT ( 68 , 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ ImageButton BTN_SPECULAR_COLOR
+ {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_SPECULAR_COLOR";
+ Pos = MAP_APPFONT ( 137 , SPECULAR_START_Y + 13 - 2 ) ;
+ Size = MAP_APPFONT ( 12, 14 ) ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "colordlg.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Colors Dialog" ;
+ };
+ FixedText FT_MAT_SPECULAR_INTENSITY
+ {
+ Pos = MAP_APPFONT ( FT_INDENT , SPECULAR_START_Y + 13 + FT_OFFSET_NEXT ) ;
+ Size = MAP_APPFONT ( FT_WIDTH_SHORT , FT_HEIGHT ) ;
+ Text [ en-US ] = "I~ntensity" ;
+ };
+ MetricField MTR_MAT_SPECULAR_INTENSITY
+ {
+ HelpID = "svx:MetricField:RID_SVXFLOAT_3D:MTR_MAT_SPECULAR_INTENSITY";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( FT_INDENT + FT_WIDTH_SHORT + 1 ,
+ SPECULAR_START_Y + 13 + FT_OFFSET_NEXT ) ;
+ Size = MAP_APPFONT ( 68 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = " %" ;
+ Minimum = 1 ;
+ First = 1 ;
+ Maximum = 100 ;
+ Last = 100 ;
+ SpinSize = 1 ;
+ };
+ /*
+ ImageButton BTN_MAT_FAVORITES {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_MAT_FAVORITES";
+ Pos = MAP_APPFONT( BORDER, GROUP_PREV_Y+1 );
+ Size = IMG_BUTTON_SIZE;
+ QuickHelpText = "Material Favoriten" ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "matfavor.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE;
+ };
+ ImageButton BTN_MAT_EDITOR {
+ HelpID = "svx:ImageButton:RID_SVXFLOAT_3D:BTN_MAT_EDITOR";
+ Pos = MAP_APPFONT( BORDER + BUTTON_WIDTH, GROUP_PREV_Y+1 );
+ Size = IMG_BUTTON_SIZE;
+ QuickHelpText = "Material Editor" ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "matedit.bmp" ; };
+ MASKCOLOR
+ };
+ TabStop = TRUE;
+ };
+*/
+ FixedLine FL_MATERIAL
+ {
+ Pos = TOP_FIXED_LINE_POS;
+ Size = FIXED_LINE_SIZE;
+ Text [ en-US ] = "Material" ;
+ };
+
+ Bitmap BMP_GEO_H
+ {
+ File = "3dgeo_h.bmp";
+ };
+
+ Bitmap BMP_REPRESENTATION_H
+ {
+ File = "3drepres_h.bmp";
+ };
+
+ Bitmap BMP_3DLIGHT_H
+ {
+ File = "3dlight_h.bmp";
+ };
+
+ Bitmap BMP_TEXTURE_H
+ {
+ File = "3dtextur_h.bmp";
+ };
+
+ Bitmap BMP_MATERIAL_H
+ {
+ File = "material_h.bmp";
+ };
+
+ Bitmap BMP_UPDATE_H
+ {
+ File = "sc10350_h.bmp";
+ };
+
+ Bitmap BMP_ASSIGN_H
+ {
+ File = "apply_h.bmp";
+ };
+
+ Bitmap BMP_CHANGE_TO_3D_H
+ {
+ File = "convrt3d_h.bmp";
+ };
+
+ Bitmap BMP_LATHE_OBJ_H
+ {
+ File = "rotate3d_h.bmp";
+ };
+
+ Bitmap BMP_PERSPECTIVE_H
+ {
+ File = "persp3d_h.bmp";
+ };
+
+ Bitmap BMP_NORMALS_OBJ_H
+ {
+ File = "normobjs_h.bmp";
+ };
+
+ Bitmap BMP_NORMALS_FLAT_H
+ {
+ File = "normflat_h.bmp";
+ };
+
+ Bitmap BMP_NORMALS_SPHERE_H
+ {
+ File = "normsphe_h.bmp";
+ };
+
+ Bitmap BMP_NORMALS_INVERT_H
+ {
+ File = "invert3d_h.bmp";
+ };
+
+ Bitmap BMP_TWO_SIDED_LIGHTING_H
+ {
+ File = "lght2sid_h.bmp";
+ };
+
+ Bitmap BMP_DOUBLE_SIDED_H
+ {
+ File = "doublesi_h.bmp";
+ };
+
+ Bitmap BMP_SHADOW_3D_H
+ {
+ File = "shadow3d_h.bmp";
+ };
+
+ Bitmap BMP_LIGHT_H
+ {
+ File = "light_h.bmp";
+ };
+
+ Bitmap BMP_LIGHT_COLOR_H
+ {
+ File = "colordlg_h.bmp";
+ };
+
+ Bitmap BMP_AMBIENT_COLOR_H
+ {
+ File = "colordlg_h.bmp";
+ };
+
+ Bitmap BMP_TEX_LUMINANCE_H
+ {
+ File = "luminanc_h.bmp";
+ };
+
+ Bitmap BMP_TEX_COLOR_H
+ {
+ File = "color_h.bmp";
+ };
+
+ Bitmap BMP_TEX_REPLACE_H
+ {
+ File = "replac3d_h.bmp";
+ };
+
+ Bitmap BMP_TEX_MODULATE_H
+ {
+ File = "modula3d_h.bmp";
+ };
+
+ Bitmap BMP_TEX_BLEND_H
+ {
+ File = "blend3d_h.bmp";
+ };
+
+ Bitmap BMP_TEX_OBJECT_H
+ {
+ File = "objspc3d_h.bmp";
+ };
+
+ Bitmap BMP_TEX_PARALLEL_H
+ {
+ File = "parallel_h.bmp";
+ };
+
+ Bitmap BMP_TEX_CIRCLE_H
+ {
+ File = "sphere3d_h.bmp";
+ };
+
+ Bitmap BMP_TEX_FILTER_H
+ {
+ File = "filter3d_h.bmp";
+ };
+
+ Bitmap BMP_COLORDLG_H
+ {
+ File = "colordlg_h.bmp";
+ };
+};
+
+Image RID_SVXIMAGE_LIGHT_ON
+{
+ ImageBitmap = Bitmap { File = "lighton.bmp" ; };
+ MASKCOLOR
+};
+
+Image RID_SVXIMAGE_LIGHT_OFF
+{
+ ImageBitmap = Bitmap { File = "light.bmp" ; };
+ MASKCOLOR
+};
+
+Image RID_SVXIMAGE_LIGHT_ON_H
+{
+ ImageBitmap = Bitmap { File = "lighton_h.bmp" ; };
+ MASKCOLOR
+};
+
+Image RID_SVXIMAGE_LIGHT_OFF_H
+{
+ ImageBitmap = Bitmap { File = "light_h.bmp" ; };
+ MASKCOLOR
+};
+
+Image RID_SVXIMAGE_COLORDLG
+{
+ ImageBitmap = Bitmap { File = "colordlg.bmp" ; };
+ MASKCOLOR
+};
+
+Image RID_SVXIMAGE_COLORDLG_H
+{
+ ImageBitmap = Bitmap { File = "colordlg_h.bmp" ; };
+ MASKCOLOR
+};
+
+/*Image RID_SVXIMAGE_LIGHT_ON_SELECTED {
+ ImageBitmap = Bitmap { File = "lightons.bmp" ; };
+ MASKCOLOR
+};
+Image RID_SVXIMAGE_LIGHT_OFF_SELECTED {
+ ImageBitmap = Bitmap { File = "lightsel.bmp" ; };
+ MASKCOLOR
+};*/
+
+String RID_SVXFLOAT3D_FAVORITE
+{
+ Text [ en-US ] = "Favorite";
+};
+String RID_SVXFLOAT3D_FIX_X
+{
+ Text [ en-US ] = "X";
+};
+String RID_SVXFLOAT3D_FIX_Y
+{
+ Text [ en-US ] = "Y";
+};
+String RID_SVXFLOAT3D_FIX_Z
+{
+ Text [ en-US ] = "Z";
+};
+String RID_SVXFLOAT3D_FIX_R
+{
+ Text [ en-US ] = "R:";
+};
+String RID_SVXFLOAT3D_FIX_G
+{
+ Text [ en-US ] = "G:";
+};
+String RID_SVXFLOAT3D_FIX_B
+{
+ Text [ en-US ] = "B:";
+
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/engine3d/helperhittest3d.cxx b/svx/source/engine3d/helperhittest3d.cxx
new file mode 100644
index 000000000000..c5e77870a073
--- /dev/null
+++ b/svx/source/engine3d/helperhittest3d.cxx
@@ -0,0 +1,295 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/helperhittest3d.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/scene3d.hxx>
+#include <svx/svditer.hxx>
+#include <drawinglayer/processor3d/cutfindprocessor3d.hxx>
+#include <svx/sdr/contact/viewcontactofe3d.hxx>
+#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
+#include <com/sun/star/uno/Sequence.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+class ImplPairDephAndObject
+{
+private:
+ const E3dCompoundObject* mpObject;
+ double mfDepth;
+
+public:
+ ImplPairDephAndObject(const E3dCompoundObject* pObject, double fDepth)
+ : mpObject(pObject),
+ mfDepth(fDepth)
+ {}
+
+ // for ::std::sort
+ bool operator<(const ImplPairDephAndObject& rComp) const
+ {
+ return (mfDepth < rComp.mfDepth);
+ }
+
+ // data read access
+ const E3dCompoundObject* getObject() const { return mpObject; }
+ double getDepth() const { return mfDepth; }
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+void getAllHit3DObjectWithRelativePoint(
+ const basegfx::B3DPoint& rFront,
+ const basegfx::B3DPoint& rBack,
+ const E3dCompoundObject& rObject,
+ const drawinglayer::geometry::ViewInformation3D& rObjectViewInformation3D,
+ ::std::vector< basegfx::B3DPoint >& o_rResult,
+ bool bAnyHit)
+{
+ o_rResult.clear();
+
+ if(!rFront.equal(rBack))
+ {
+ // rObject is a E3dCompoundObject, so it cannot be a scene (which is a E3dObject)
+ const sdr::contact::ViewContactOfE3d& rVCObject = static_cast< sdr::contact::ViewContactOfE3d& >(rObject.GetViewContact());
+ const drawinglayer::primitive3d::Primitive3DSequence aPrimitives(rVCObject.getViewIndependentPrimitive3DSequence());
+
+ if(aPrimitives.hasElements())
+ {
+ // make BoundVolume empty and overlapping test for speedup
+ const basegfx::B3DRange aObjectRange(drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence(aPrimitives, rObjectViewInformation3D));
+
+ if(!aObjectRange.isEmpty())
+ {
+ const basegfx::B3DRange aFrontBackRange(rFront, rBack);
+
+ if(aObjectRange.overlaps(aFrontBackRange))
+ {
+ // bound volumes hit, geometric cut tests needed
+ drawinglayer::processor3d::CutFindProcessor aCutFindProcessor(rObjectViewInformation3D, rFront, rBack, bAnyHit);
+ aCutFindProcessor.process(aPrimitives);
+ o_rResult = aCutFindProcessor.getCutPoints();
+ }
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+E3dScene* fillViewInformation3DForCompoundObject(drawinglayer::geometry::ViewInformation3D& o_rViewInformation3D, const E3dCompoundObject& rCandidate)
+{
+ // Search for root scene (outmost scene) of the 3d object since e.g. in chart, multiple scenes may
+ // be placed between object and outmost scene. On that search, remember the in-between scene's
+ // transformation for the correct complete ObjectTransformation. For historical reasons, the
+ // root scene's own object transformation is part of the scene's ViewTransformation, o do not
+ // add it. For more details, see ViewContactOfE3dScene::createViewInformation3D.
+ E3dScene* pParentScene = dynamic_cast< E3dScene* >(rCandidate.GetParentObj());
+ E3dScene* pRootScene = 0;
+ basegfx::B3DHomMatrix aInBetweenSceneMatrix;
+
+ while(pParentScene)
+ {
+ E3dScene* pParentParentScene = dynamic_cast< E3dScene* >(pParentScene->GetParentObj());
+
+ if(pParentParentScene)
+ {
+ // pParentScene is a in-between scene
+ aInBetweenSceneMatrix = pParentScene->GetTransform() * aInBetweenSceneMatrix;
+ }
+ else
+ {
+ // pParentScene is the root scene
+ pRootScene = pParentScene;
+ }
+
+ pParentScene = pParentParentScene;
+ }
+
+ if(pRootScene)
+ {
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pRootScene->GetViewContact());
+
+ if(aInBetweenSceneMatrix.isIdentity())
+ {
+ o_rViewInformation3D = rVCScene.getViewInformation3D();
+ }
+ else
+ {
+ // build new ViewInformation containing all transforms for the candidate
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+
+ o_rViewInformation3D = drawinglayer::geometry::ViewInformation3D(
+ aViewInfo3D.getObjectTransformation() * aInBetweenSceneMatrix,
+ aViewInfo3D.getOrientation(),
+ aViewInfo3D.getProjection(),
+ aViewInfo3D.getDeviceToView(),
+ aViewInfo3D.getViewTime(),
+ aViewInfo3D.getExtendedInformationSequence());
+ }
+ }
+ else
+ {
+ const uno::Sequence< beans::PropertyValue > aEmptyParameters;
+ o_rViewInformation3D = drawinglayer::geometry::ViewInformation3D(aEmptyParameters);
+ }
+
+ return pRootScene;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SVX_DLLPUBLIC void getAllHit3DObjectsSortedFrontToBack(
+ const basegfx::B2DPoint& rPoint,
+ const E3dScene& rScene,
+ ::std::vector< const E3dCompoundObject* >& o_rResult)
+{
+ o_rResult.clear();
+ SdrObjList* pList = rScene.GetSubList();
+
+ if(pList && pList->GetObjCount())
+ {
+ // prepare relative HitPoint. To do so, get the VC of the 3DScene and from there
+ // the Scene's 2D transformation. Multiplying with the inverse transformation
+ // will create a point relative to the 3D scene as unit-2d-object
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rScene.GetViewContact());
+ basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
+ aInverseSceneTransform.invert();
+ const basegfx::B2DPoint aRelativePoint(aInverseSceneTransform * rPoint);
+
+ // check if test point is inside scene's area at all
+ if(aRelativePoint.getX() >= 0.0 && aRelativePoint.getX() <= 1.0 && aRelativePoint.getY() >= 0.0 && aRelativePoint.getY() <= 1.0)
+ {
+ SdrObjListIter aIterator(*pList, IM_DEEPNOGROUPS);
+ ::std::vector< ImplPairDephAndObject > aDepthAndObjectResults;
+ const uno::Sequence< beans::PropertyValue > aEmptyParameters;
+ drawinglayer::geometry::ViewInformation3D aViewInfo3D(aEmptyParameters);
+
+ while(aIterator.IsMore())
+ {
+ const E3dCompoundObject* pCandidate = dynamic_cast< const E3dCompoundObject* >(aIterator.Next());
+
+ if(pCandidate)
+ {
+ fillViewInformation3DForCompoundObject(aViewInfo3D, *pCandidate);
+
+ // create HitPoint Front and Back, transform to object coordinates
+ basegfx::B3DHomMatrix aViewToObject(aViewInfo3D.getObjectToView());
+ aViewToObject.invert();
+ const basegfx::B3DPoint aFront(aViewToObject * basegfx::B3DPoint(aRelativePoint.getX(), aRelativePoint.getY(), 0.0));
+ const basegfx::B3DPoint aBack(aViewToObject * basegfx::B3DPoint(aRelativePoint.getX(), aRelativePoint.getY(), 1.0));
+
+ if(!aFront.equal(aBack))
+ {
+ // get all hit points with object
+ ::std::vector< basegfx::B3DPoint > aHitsWithObject;
+ getAllHit3DObjectWithRelativePoint(aFront, aBack, *pCandidate, aViewInfo3D, aHitsWithObject, false);
+
+ for(sal_uInt32 a(0); a < aHitsWithObject.size(); a++)
+ {
+ const basegfx::B3DPoint aPointInViewCoordinates(aViewInfo3D.getObjectToView() * aHitsWithObject[a]);
+ aDepthAndObjectResults.push_back(ImplPairDephAndObject(pCandidate, aPointInViewCoordinates.getZ()));
+ }
+ }
+ }
+ }
+
+ // fill nRetval
+ const sal_uInt32 nCount(aDepthAndObjectResults.size());
+
+ if(nCount)
+ {
+ // sort aDepthAndObjectResults by depth
+ ::std::sort(aDepthAndObjectResults.begin(), aDepthAndObjectResults.end());
+
+ // copy SdrObject pointers to return result set
+ ::std::vector< ImplPairDephAndObject >::iterator aIterator2(aDepthAndObjectResults.begin());
+
+ for(;aIterator2 != aDepthAndObjectResults.end(); aIterator2++)
+ {
+ o_rResult.push_back(aIterator2->getObject());
+ }
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+bool checkHitSingle3DObject(
+ const basegfx::B2DPoint& rPoint,
+ const E3dCompoundObject& rCandidate)
+{
+ const uno::Sequence< beans::PropertyValue > aEmptyParameters;
+ drawinglayer::geometry::ViewInformation3D aViewInfo3D(aEmptyParameters);
+ E3dScene* pRootScene = fillViewInformation3DForCompoundObject(aViewInfo3D, rCandidate);
+
+ if(pRootScene)
+ {
+ // prepare relative HitPoint. To do so, get the VC of the 3DScene and from there
+ // the Scene's 2D transformation. Multiplying with the inverse transformation
+ // will create a point relative to the 3D scene as unit-2d-object
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pRootScene->GetViewContact());
+ basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
+ aInverseSceneTransform.invert();
+ const basegfx::B2DPoint aRelativePoint(aInverseSceneTransform * rPoint);
+
+ // check if test point is inside scene's area at all
+ if(aRelativePoint.getX() >= 0.0 && aRelativePoint.getX() <= 1.0 && aRelativePoint.getY() >= 0.0 && aRelativePoint.getY() <= 1.0)
+ {
+ // create HitPoint Front and Back, transform to object coordinates
+ basegfx::B3DHomMatrix aViewToObject(aViewInfo3D.getObjectToView());
+ aViewToObject.invert();
+ const basegfx::B3DPoint aFront(aViewToObject * basegfx::B3DPoint(aRelativePoint.getX(), aRelativePoint.getY(), 0.0));
+ const basegfx::B3DPoint aBack(aViewToObject * basegfx::B3DPoint(aRelativePoint.getX(), aRelativePoint.getY(), 1.0));
+
+ if(!aFront.equal(aBack))
+ {
+ // get all hit points with object
+ ::std::vector< basegfx::B3DPoint > aHitsWithObject;
+ getAllHit3DObjectWithRelativePoint(aFront, aBack, rCandidate, aViewInfo3D, aHitsWithObject, true);
+
+ if(aHitsWithObject.size())
+ {
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/engine3d/helperminimaldepth3d.cxx b/svx/source/engine3d/helperminimaldepth3d.cxx
new file mode 100644
index 000000000000..b0f774c26fda
--- /dev/null
+++ b/svx/source/engine3d/helperminimaldepth3d.cxx
@@ -0,0 +1,212 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <helperminimaldepth3d.hxx>
+#include <drawinglayer/processor3d/baseprocessor3d.hxx>
+#include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
+#include <drawinglayer/primitive3d/transformprimitive3d.hxx>
+#include <drawinglayer/primitive3d/polygonprimitive3d.hxx>
+#include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx>
+#include <svx/sdr/contact/viewcontactofe3d.hxx>
+#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
+#include <svx/obj3d.hxx>
+#include <svx/scene3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor3d
+ {
+ class MinimalDephInViewExtractor : public BaseProcessor3D
+ {
+ private:
+ // the value which will be fetched as result
+ double mfMinimalDepth;
+
+ // as tooling, the process() implementation takes over API handling and calls this
+ // virtual render method when the primitive implementation is BasePrimitive3D-based.
+ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate);
+
+ public:
+ MinimalDephInViewExtractor(const geometry::ViewInformation3D& rViewInformation)
+ : BaseProcessor3D(rViewInformation),
+ mfMinimalDepth(DBL_MAX)
+ {}
+
+ // data access
+ double getMinimalDepth() const { return mfMinimalDepth; }
+ };
+
+ void MinimalDephInViewExtractor::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate)
+ {
+ // it is a BasePrimitive3D implementation, use getPrimitive3DID() call for switch
+ switch(rCandidate.getPrimitive3DID())
+ {
+ case PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D :
+ {
+ // transform group. Remember current transformations
+ const primitive3d::TransformPrimitive3D& rPrimitive = static_cast< const primitive3d::TransformPrimitive3D& >(rCandidate);
+ const geometry::ViewInformation3D aLastViewInformation3D(getViewInformation3D());
+
+ // create new transformation; add new object transform from right side
+ const geometry::ViewInformation3D aNewViewInformation3D(
+ aLastViewInformation3D.getObjectTransformation() * rPrimitive.getTransformation(),
+ aLastViewInformation3D.getOrientation(),
+ aLastViewInformation3D.getProjection(),
+ aLastViewInformation3D.getDeviceToView(),
+ aLastViewInformation3D.getViewTime(),
+ aLastViewInformation3D.getExtendedInformationSequence());
+ updateViewInformation(aNewViewInformation3D);
+
+ // let break down
+ process(rPrimitive.getChildren());
+
+ // restore transformations
+ updateViewInformation(aLastViewInformation3D);
+ break;
+ }
+ case PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D :
+ {
+ // PolygonHairlinePrimitive3D
+ const primitive3d::PolygonHairlinePrimitive3D& rPrimitive = static_cast< const primitive3d::PolygonHairlinePrimitive3D& >(rCandidate);
+ const basegfx::B3DPolygon& rPolygon = rPrimitive.getB3DPolygon();
+ const sal_uInt32 nCount(rPolygon.count());
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ const basegfx::B3DPoint aPointInView(getViewInformation3D().getObjectToView() * rPolygon.getB3DPoint(a));
+
+ if(aPointInView.getZ() < mfMinimalDepth)
+ {
+ mfMinimalDepth = aPointInView.getZ();
+ }
+ }
+
+ break;
+ }
+ case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D :
+ {
+ // PolyPolygonMaterialPrimitive3D
+ const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const primitive3d::PolyPolygonMaterialPrimitive3D& >(rCandidate);
+ const basegfx::B3DPolyPolygon& rPolyPolygon = rPrimitive.getB3DPolyPolygon();
+ const sal_uInt32 nPolyCount(rPolyPolygon.count());
+
+ for(sal_uInt32 a(0); a < nPolyCount; a++)
+ {
+ const basegfx::B3DPolygon aPolygon(rPolyPolygon.getB3DPolygon(a));
+ const sal_uInt32 nCount(aPolygon.count());
+
+ for(sal_uInt32 b(0); b < nCount; b++)
+ {
+ const basegfx::B3DPoint aPointInView(getViewInformation3D().getObjectToView() * aPolygon.getB3DPoint(b));
+
+ if(aPointInView.getZ() < mfMinimalDepth)
+ {
+ mfMinimalDepth = aPointInView.getZ();
+ }
+ }
+ }
+
+ break;
+ }
+ default :
+ {
+ // process recursively
+ process(rCandidate.get3DDecomposition(getViewInformation3D()));
+ break;
+ }
+ }
+ }
+ } // end of namespace processor3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// changed to create values using VCs, Primitive3DSequence and ViewInformation3D to allow
+// removal of old 3D bucket geometry. There is one slight difference in the result, it's
+// in [0.0 .. 1.0] for Z-Depth since the scaling of the scene as 2D object is no longer
+// part of the 3D transformations. This could be added since the ViewContactOfE3dScene is
+// given, but is not needed since the permutation of the depth values needs only be correct
+// relative to each other
+
+double getMinimalDepthInViewCoordinates(const E3dCompoundObject& rObject)
+{
+ // this is a E3dCompoundObject, so it cannot be a scene (which is a E3dObject).
+ // Get primitive sequence using VC
+ const sdr::contact::ViewContactOfE3d& rVCObject = static_cast< sdr::contact::ViewContactOfE3d& >(rObject.GetViewContact());
+ const drawinglayer::primitive3d::Primitive3DSequence aPrimitives = rVCObject.getViewIndependentPrimitive3DSequence();
+ double fRetval(DBL_MAX);
+
+ if(aPrimitives.hasElements())
+ {
+ const E3dScene* pScene = rObject.GetScene();
+
+ if(pScene)
+ {
+ // get ViewInformation3D from scene using VC
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+
+ // the scene's object transformation is already part of aViewInfo3D.getObjectTransformation()
+ // for historical reasons (see ViewContactOfE3dScene::createViewInformation3D for more info)
+ // and the object's transform is part of aPrimitives (and taken into account when decomposing
+ // to PolygonHairlinePrimitive3D and PolyPolygonMaterialPrimitive3D). The missing part may be
+ // some Scene SdrObjects lying in-between which may need to be added. This is e.g. used in chart,
+ // and generally allowed in 3d scenes an their 3d object hierarchy
+ basegfx::B3DHomMatrix aInBetweenSceneMatrix;
+ E3dScene* pParentScene = dynamic_cast< E3dScene* >(rObject.GetParentObj());
+
+ while(pParentScene && pParentScene != pScene)
+ {
+ aInBetweenSceneMatrix = pParentScene->GetTransform() * aInBetweenSceneMatrix;
+ pParentScene = dynamic_cast< E3dScene* >(pParentScene->GetParentObj());
+ }
+
+ // build new ViewInformation containing all transforms
+ const drawinglayer::geometry::ViewInformation3D aNewViewInformation3D(
+ aViewInfo3D.getObjectTransformation() * aInBetweenSceneMatrix,
+ aViewInfo3D.getOrientation(),
+ aViewInfo3D.getProjection(),
+ aViewInfo3D.getDeviceToView(),
+ aViewInfo3D.getViewTime(),
+ aViewInfo3D.getExtendedInformationSequence());
+
+ // create extractor helper, proccess geometry and get return value
+ drawinglayer::processor3d::MinimalDephInViewExtractor aExtractor(aNewViewInformation3D);
+ aExtractor.process(aPrimitives);
+ fRetval = aExtractor.getMinimalDepth();
+ }
+ }
+
+ return fRetval;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/engine3d/helperminimaldepth3d.hxx b/svx/source/engine3d/helperminimaldepth3d.hxx
new file mode 100644
index 000000000000..7fa1b11a8768
--- /dev/null
+++ b/svx/source/engine3d/helperminimaldepth3d.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SVX_HELPERMINIMALDEPTH_HXX
+#define INCLUDED_SVX_HELPERMINIMALDEPTH_HXX
+
+#include <sal/types.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+class E3dCompoundObject;
+class E3dScene;
+
+//////////////////////////////////////////////////////////////////////////////
+/** support extracting the minimal depth of a 3d object in it's scene
+
+ @param rObject
+ The 3D Object from which the minimal depth needs to be calculated. The scene
+ is defined by the object already
+
+ @return
+ The minimal depth of this object in unified ViewCoordinates. This is the
+ Z-Coordinate of one object point in the range of [0.0 .. 1.0]. ViewCoordinates
+ means the transformations (esp. rotation) of the scene are taken into account
+
+*/
+// support extracting the minimal depth of a 3d object in it's scene
+
+double getMinimalDepthInViewCoordinates(const E3dCompoundObject& rObject);
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_SVX_HELPERMINIMALDEPTH_HXX
+
+// eof
diff --git a/svx/source/engine3d/lathe3d.cxx b/svx/source/engine3d/lathe3d.cxx
new file mode 100644
index 000000000000..284394cc202c
--- /dev/null
+++ b/svx/source/engine3d/lathe3d.cxx
@@ -0,0 +1,277 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svx/svdstr.hrc"
+#include "svx/svdglob.hxx"
+#include <tools/poly.hxx>
+#include <svx/svdpage.hxx>
+#include "svx/globl3d.hxx"
+#include <svx/lathe3d.hxx>
+#include <svx/xpoly.hxx>
+#include <svx/svxids.hrc>
+#include <svx/svdopath.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svx3ditems.hxx>
+#include <svx/sdr/properties/e3dlatheproperties.hxx>
+#include <svx/sdr/contact/viewcontactofe3dlathe.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// #110094# DrawContact section
+
+sdr::contact::ViewContact* E3dLatheObj::CreateObjectSpecificViewContact()
+{
+ return new sdr::contact::ViewContactOfE3dLathe(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+sdr::properties::BaseProperties* E3dLatheObj::CreateObjectSpecificProperties()
+{
+ return new sdr::properties::E3dLatheProperties(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(E3dLatheObj, E3dCompoundObject);
+
+/*************************************************************************
+|*
+|* Konstruktor aus 3D-Polygon, Scale gibt den Umrechnungsfaktor fuer
+|* die Koordinaten an
+|*
+\************************************************************************/
+
+E3dLatheObj::E3dLatheObj(E3dDefaultAttributes& rDefault, const basegfx::B2DPolyPolygon rPoly2D)
+: E3dCompoundObject(rDefault),
+ maPolyPoly2D(rPoly2D)
+{
+ // since the old class PolyPolygon3D did mirror the given PolyPolygons in Y, do the same here
+ basegfx::B2DHomMatrix aMirrorY;
+ aMirrorY.scale(1.0, -1.0);
+ maPolyPoly2D.transform(aMirrorY);
+
+ // Defaults setzen
+ SetDefaultAttributes(rDefault);
+
+ // Ueberfluessige Punkte entfernen, insbesondere doppelte
+ // Start- und Endpunkte verhindern
+ maPolyPoly2D.removeDoublePoints();
+
+ if(maPolyPoly2D.count())
+ {
+ const basegfx::B2DPolygon rPoly(maPolyPoly2D.getB2DPolygon(0L));
+ sal_uInt32 nSegCnt(rPoly.count());
+
+ if(nSegCnt && !rPoly.isClosed())
+ {
+ nSegCnt -= 1;
+ }
+
+ GetProperties().SetObjectItemDirect(Svx3DVerticalSegmentsItem(nSegCnt));
+ }
+}
+
+/*************************************************************************
+|*
+|* Leer-Konstruktor
+|*
+\************************************************************************/
+
+E3dLatheObj::E3dLatheObj()
+: E3dCompoundObject()
+{
+ // Defaults setzen
+ E3dDefaultAttributes aDefault;
+ SetDefaultAttributes(aDefault);
+}
+
+void E3dLatheObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
+{
+ GetProperties().SetObjectItemDirect(Svx3DSmoothNormalsItem(rDefault.GetDefaultLatheSmoothed()));
+ GetProperties().SetObjectItemDirect(Svx3DSmoothLidsItem(rDefault.GetDefaultLatheSmoothFrontBack()));
+ GetProperties().SetObjectItemDirect(Svx3DCharacterModeItem(rDefault.GetDefaultLatheCharacterMode()));
+ GetProperties().SetObjectItemDirect(Svx3DCloseFrontItem(rDefault.GetDefaultLatheCloseFront()));
+ GetProperties().SetObjectItemDirect(Svx3DCloseBackItem(rDefault.GetDefaultLatheCloseBack()));
+}
+
+/*************************************************************************
+|*
+|* Identifier zurueckgeben
+|*
+\************************************************************************/
+
+sal_uInt16 E3dLatheObj::GetObjIdentifier() const
+{
+ return E3D_LATHEOBJ_ID;
+}
+
+/*************************************************************************
+|*
+|* Zuweisungsoperator
+|*
+\************************************************************************/
+
+void E3dLatheObj::operator=(const SdrObject& rObj)
+{
+ // erstmal alle Childs kopieren
+ E3dCompoundObject::operator=(rObj);
+
+ // weitere Parameter kopieren
+ const E3dLatheObj& r3DObj = (const E3dLatheObj&)rObj;
+
+ maPolyPoly2D = r3DObj.maPolyPoly2D;
+}
+
+/*************************************************************************
+|*
+|* Wandle das Objekt in ein Gruppenobjekt bestehend aus n Polygonen
+|*
+\************************************************************************/
+
+SdrObject *E3dLatheObj::DoConvertToPolyObj(sal_Bool /*bBezier*/) const
+{
+ return NULL;
+}
+
+/*************************************************************************
+|*
+|* Neue Segmentierung (Beschreibung siehe Header-File)
+|*
+\************************************************************************/
+
+void E3dLatheObj::ReSegment(sal_uInt32 nHSegs, sal_uInt32 nVSegs)
+{
+ if ((nHSegs != GetHorizontalSegments() || nVSegs != GetVerticalSegments()) &&
+ (nHSegs != 0 || nVSegs != 0))
+ {
+ GetProperties().SetObjectItemDirect(Svx3DHorizontalSegmentsItem(nHSegs));
+ GetProperties().SetObjectItemDirect(Svx3DVerticalSegmentsItem(nVSegs));
+
+ ActionChanged();
+ }
+}
+
+/*************************************************************************
+|*
+|* Lokale Parameter setzen mit Geometrieneuerzeugung
+|*
+\************************************************************************/
+
+void E3dLatheObj::SetPolyPoly2D(const basegfx::B2DPolyPolygon& rNew)
+{
+ if(maPolyPoly2D != rNew)
+ {
+ maPolyPoly2D = rNew;
+ maPolyPoly2D.removeDoublePoints();
+
+ if(maPolyPoly2D.count())
+ {
+ const basegfx::B2DPolygon rPoly(maPolyPoly2D.getB2DPolygon(0L));
+ sal_uInt32 nSegCnt(rPoly.count());
+
+ if(nSegCnt && !rPoly.isClosed())
+ {
+ nSegCnt -= 1;
+ }
+
+ GetProperties().SetObjectItemDirect(Svx3DVerticalSegmentsItem(nSegCnt));
+ }
+
+ ActionChanged();
+ }
+}
+
+/*************************************************************************
+|*
+|* Get the name of the object (singular)
+|*
+\************************************************************************/
+
+void E3dLatheObj::TakeObjNameSingul(XubString& rName) const
+{
+ rName=ImpGetResStr(STR_ObjNameSingulLathe3d);
+
+ String aName( GetName() );
+ if(aName.Len())
+ {
+ rName += sal_Unicode(' ');
+ rName += sal_Unicode('\'');
+ rName += aName;
+ rName += sal_Unicode('\'');
+ }
+}
+
+/*************************************************************************
+|*
+|* Get the name of the object (plural)
+|*
+\************************************************************************/
+
+void E3dLatheObj::TakeObjNamePlural(XubString& rName) const
+{
+ rName=ImpGetResStr(STR_ObjNamePluralLathe3d);
+}
+
+/*************************************************************************
+|*
+|* Aufbrechen
+|*
+\************************************************************************/
+
+sal_Bool E3dLatheObj::IsBreakObjPossible()
+{
+ return sal_True;
+}
+
+SdrAttrObj* E3dLatheObj::GetBreakObj()
+{
+ // create PathObj
+ basegfx::B3DPolyPolygon aLathePoly3D(basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(maPolyPoly2D));
+ basegfx::B2DPolyPolygon aTransPoly(TransformToScreenCoor(aLathePoly3D));
+ SdrPathObj* pPathObj = new SdrPathObj(OBJ_PLIN, aTransPoly);
+
+ if(pPathObj)
+ {
+ // Attribute setzen
+ SfxItemSet aSet(GetObjectItemSet());
+
+ // Linien aktivieren, um Objekt garantiert sichtbar zu machen
+ aSet.Put(XLineStyleItem(XLINE_SOLID));
+
+ pPathObj->SetMergedItemSet(aSet);
+ }
+
+ return pPathObj;
+}
+
+// eof
diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx
new file mode 100644
index 000000000000..64f43790513d
--- /dev/null
+++ b/svx/source/engine3d/obj3d.cxx
@@ -0,0 +1,1280 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svx/svdstr.hrc"
+#include "svx/svdglob.hxx"
+#include <svx/svdview.hxx>
+#include <svx/svdattr.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdmodel.hxx>
+#include "svx/svditer.hxx"
+#include "svx/globl3d.hxx"
+#include <svx/camera3d.hxx>
+#include <svx/scene3d.hxx>
+#include <svx/polysc3d.hxx>
+#include <svx/cube3d.hxx>
+#include <svx/lathe3d.hxx>
+#include <svx/sphere3d.hxx>
+#include <svx/extrud3d.hxx>
+#include <svx/obj3d.hxx>
+#include <svx/xtable.hxx>
+#include <svx/xflclit.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/settings.hxx>
+#include <svx/xlnclit.hxx>
+#include <svl/metitem.hxx>
+#include <svx/xtable.hxx>
+#include <svx/xfillit.hxx>
+#include <svx/xlnwtit.hxx>
+#include <vcl/virdev.hxx>
+#include <tools/poly.hxx>
+#include <tools/b3dtrans.hxx>
+#include <svx/svxids.hrc>
+#include <editeng/colritem.hxx>
+#include <svx/e3ditem.hxx>
+#include <svx/xlntrit.hxx>
+#include <svx/xfltrit.hxx>
+#include <svx/svdpagv.hxx>
+#include <vcl/gradient.hxx>
+#include <vcl/metaact.hxx>
+#include <svx/svx3ditems.hxx>
+#include <svl/whiter.hxx>
+#include <svtools/colorcfg.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/xgrscit.hxx>
+#include "svdoimp.hxx"
+#include <svx/sdr/properties/e3dproperties.hxx>
+#include <svx/sdr/properties/e3dcompoundproperties.hxx>
+#include <basegfx/polygon/b3dpolypolygontools.hxx>
+#include <basegfx/point/b3dpoint.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+#include <svx/xlndsit.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <basegfx/polygon/b3dpolygon.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <basegfx/polygon/b3dpolygontools.hxx>
+#include <svx/helperhittest3d.hxx>
+#include <svx/sdr/contact/viewcontactofe3d.hxx>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
+#include <basegfx/polygon/b3dpolypolygontools.hxx>
+#include <svx/e3dsceneupdater.hxx>
+
+#define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+/*************************************************************************
+|*
+|* Liste fuer 3D-Objekte
+|*
+\************************************************************************/
+
+TYPEINIT1(E3dObjList, SdrObjList);
+
+E3dObjList::E3dObjList(SdrModel* pNewModel, SdrPage* pNewPage, E3dObjList* pNewUpList)
+: SdrObjList(pNewModel, pNewPage, pNewUpList)
+{
+}
+
+E3dObjList::E3dObjList(const E3dObjList& rSrcList)
+: SdrObjList(rSrcList)
+{
+}
+
+E3dObjList::~E3dObjList()
+{
+}
+
+void E3dObjList::NbcInsertObject(SdrObject* pObj, sal_uIntPtr nPos, const SdrInsertReason* pReason)
+{
+ // Owner holen
+ DBG_ASSERT(GetOwnerObj()->ISA(E3dObject), "AW: Einfuegen 3DObject in Parent != 3DObject");
+
+ // Ist es ueberhaupt ein 3D-Objekt?
+ if(pObj && pObj->ISA(E3dObject))
+ {
+ // Normales 3D Objekt, einfuegen mittels
+ // call parent
+ SdrObjList::NbcInsertObject(pObj, nPos, pReason);
+ }
+ else
+ {
+ // Kein 3D Objekt, fuege in Seite statt in Szene ein...
+ GetOwnerObj()->GetPage()->InsertObject(pObj, nPos);
+ }
+}
+
+void E3dObjList::InsertObject(SdrObject* pObj, sal_uIntPtr nPos, const SdrInsertReason* pReason)
+{
+ OSL_ENSURE(GetOwnerObj()->ISA(E3dObject), "Insert 3DObject in non-3D Parent");
+ //E3DModifySceneSnapRectUpdater aUpdater(GetOwnerObj());
+
+ // call parent
+ SdrObjList::InsertObject(pObj, nPos, pReason);
+
+ E3dScene* pScene = ((E3dObject*)GetOwnerObj())->GetScene();
+ if(pScene)
+ {
+ pScene->Cleanup3DDepthMapper();
+ }
+}
+
+SdrObject* E3dObjList::NbcRemoveObject(sal_uIntPtr nObjNum)
+{
+ DBG_ASSERT(GetOwnerObj()->ISA(E3dObject), "AW: Entfernen 3DObject aus Parent != 3DObject");
+ //E3DModifySceneSnapRectUpdater aUpdater(GetOwnerObj());
+
+ // call parent
+ SdrObject* pRetval = SdrObjList::NbcRemoveObject(nObjNum);
+
+ E3dScene* pScene = ((E3dObject*)GetOwnerObj())->GetScene();
+ if(pScene)
+ {
+ pScene->Cleanup3DDepthMapper();
+ }
+
+ return pRetval;
+}
+
+SdrObject* E3dObjList::RemoveObject(sal_uIntPtr nObjNum)
+{
+ OSL_ENSURE(GetOwnerObj()->ISA(E3dObject), "3DObject is removed from non-3D Parent");
+ //E3DModifySceneSnapRectUpdater aUpdater(GetOwnerObj());
+
+ // call parent
+ SdrObject* pRetval = SdrObjList::RemoveObject(nObjNum);
+
+ E3dScene* pScene = ((E3dObject*)GetOwnerObj())->GetScene();
+ if(pScene)
+ {
+ pScene->Cleanup3DDepthMapper();
+ }
+
+ return pRetval;
+}
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+//////////////////////////////////////////////////////////////////////////////
+
+sdr::properties::BaseProperties* E3dObject::CreateObjectSpecificProperties()
+{
+ return new sdr::properties::E3dProperties(*this);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(E3dObject, SdrAttrObj);
+
+E3dObject::E3dObject()
+: maSubList(),
+ maLocalBoundVol(),
+ maTransformation(),
+ maFullTransform(),
+ mbTfHasChanged(true),
+ mbIsSelected(false)
+{
+ bIs3DObj = true;
+ maSubList.SetOwnerObj(this);
+ maSubList.SetListKind(SDROBJLIST_GROUPOBJ);
+ bClosedObj = true;
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+E3dObject::~E3dObject()
+{
+}
+
+/*************************************************************************
+|*
+|* Selektions-Flag setzen
+|*
+\************************************************************************/
+
+void E3dObject::SetSelected(bool bNew)
+{
+ if((bool)mbIsSelected != bNew)
+ {
+ mbIsSelected = bNew;
+ }
+
+ for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
+ {
+ E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a));
+
+ if(pCandidate)
+ {
+ pCandidate->SetSelected(bNew);
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Aufbrechen, default-Implementierungen
+|*
+\************************************************************************/
+
+sal_Bool E3dObject::IsBreakObjPossible()
+{
+ return sal_False;
+}
+
+SdrAttrObj* E3dObject::GetBreakObj()
+{
+ return 0L;
+}
+
+/*************************************************************************
+|*
+|* SetRectsDirty muss ueber die lokale SdrSubList gehen
+|*
+\************************************************************************/
+
+void E3dObject::SetRectsDirty(sal_Bool bNotMyself)
+{
+ // call parent
+ SdrAttrObj::SetRectsDirty(bNotMyself);
+
+ for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
+ {
+ E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a));
+
+ if(pCandidate)
+ {
+ pCandidate->SetRectsDirty(bNotMyself);
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Inventor zurueckgeben
+|*
+\************************************************************************/
+
+sal_uInt32 E3dObject::GetObjInventor() const
+{
+ return E3dInventor;
+}
+
+/*************************************************************************
+|*
+|* Identifier zurueckgeben
+|*
+\************************************************************************/
+
+sal_uInt16 E3dObject::GetObjIdentifier() const
+{
+ return E3D_OBJECT_ID;
+}
+
+/*************************************************************************
+|*
+|* Faehigkeiten des Objektes feststellen
+|*
+\************************************************************************/
+
+void E3dObject::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
+{
+ rInfo.bResizeFreeAllowed = sal_True;
+ rInfo.bResizePropAllowed = sal_True;
+ rInfo.bRotateFreeAllowed = sal_True;
+ rInfo.bRotate90Allowed = sal_True;
+ rInfo.bMirrorFreeAllowed = sal_False;
+ rInfo.bMirror45Allowed = sal_False;
+ rInfo.bMirror90Allowed = sal_False;
+ rInfo.bShearAllowed = sal_False;
+ rInfo.bEdgeRadiusAllowed = sal_False;
+ rInfo.bCanConvToPath = sal_False;
+
+ // no transparence for 3d objects
+ rInfo.bTransparenceAllowed = sal_False;
+
+ // gradient depends on fillstyle
+ // BM *** check if SetItem is NULL ***
+ XFillStyle eFillStyle = ((XFillStyleItem&)(GetMergedItem(XATTR_FILLSTYLE))).GetValue();
+ rInfo.bGradientAllowed = (eFillStyle == XFILL_GRADIENT);
+
+ // Umwandeln von 3D-Koerpern in Gruppe von Polygonen:
+ //
+ // Erst mal nicht moeglich, da die Erzeugung einer Gruppe von
+ // 2D-Polygonen notwendig waere, die tiefensortiert werden muessten,
+ // also bei Durchdringugnen auch gegeneinander geschnitten werden
+ // muessten. Auch die Texturkoorinaten waeren ein ungeloestes
+ // Problem.
+ rInfo.bCanConvToPoly = sal_False;
+ rInfo.bCanConvToContour = sal_False;
+ rInfo.bCanConvToPathLineToArea = sal_False;
+ rInfo.bCanConvToPolyLineToArea = sal_False;
+}
+
+/*************************************************************************
+|*
+|* Layer setzen
+|*
+\************************************************************************/
+
+void E3dObject::NbcSetLayer(SdrLayerID nLayer)
+{
+ SdrAttrObj::NbcSetLayer(nLayer);
+
+ for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
+ {
+ E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a));
+
+ if(pCandidate)
+ {
+ pCandidate->NbcSetLayer(nLayer);
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* ObjList auch an SubList setzen
+|*
+\************************************************************************/
+
+void E3dObject::SetObjList(SdrObjList* pNewObjList)
+{
+ SdrObject::SetObjList(pNewObjList);
+ maSubList.SetUpList(pNewObjList);
+}
+
+/*************************************************************************
+|*
+|* Layer setzen
+|*
+\************************************************************************/
+
+void E3dObject::SetPage(SdrPage* pNewPage)
+{
+ SdrAttrObj::SetPage(pNewPage);
+ maSubList.SetPage(pNewPage);
+}
+
+/*************************************************************************
+|*
+|* Layer setzen
+|*
+\************************************************************************/
+
+void E3dObject::SetModel(SdrModel* pNewModel)
+{
+ SdrAttrObj::SetModel(pNewModel);
+ maSubList.SetModel(pNewModel);
+}
+
+/*************************************************************************
+|*
+|* resize object, used from old 2d interfaces, e.g. in Move/Scale dialog
+|* (F4)
+|*
+\************************************************************************/
+void E3dObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+{
+ // Bewegung in X,Y im Augkoordinatensystem
+ E3dScene* pScene = GetScene();
+
+ if(pScene)
+ {
+ // transform pos from 2D world to 3D eye
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+ basegfx::B2DPoint aScaleCenter2D((double)rRef.X(), (double)rRef.Y());
+ basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
+
+ aInverseSceneTransform.invert();
+ aScaleCenter2D = aInverseSceneTransform * aScaleCenter2D;
+
+ basegfx::B3DPoint aScaleCenter3D(aScaleCenter2D.getX(), aScaleCenter2D.getY(), 0.5);
+ basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection());
+
+ aInverseViewToEye.invert();
+ aScaleCenter3D = aInverseViewToEye * aScaleCenter3D;
+
+ // scale-faktoren holen
+ double fScaleX(xFact);
+ double fScaleY(yFact);
+
+ // build transform
+ basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
+ aInverseOrientation.invert();
+ basegfx::B3DHomMatrix mFullTransform(GetFullTransform());
+ basegfx::B3DHomMatrix mTrans(mFullTransform);
+
+ mTrans *= aViewInfo3D.getOrientation();
+ mTrans.translate(-aScaleCenter3D.getX(), -aScaleCenter3D.getY(), -aScaleCenter3D.getZ());
+ mTrans.scale(fScaleX, fScaleY, 1.0);
+ mTrans.translate(aScaleCenter3D.getX(), aScaleCenter3D.getY(), aScaleCenter3D.getZ());
+ mTrans *= aInverseOrientation;
+ mFullTransform.invert();
+ mTrans *= mFullTransform;
+
+ // anwenden
+ basegfx::B3DHomMatrix mObjTrans(GetTransform());
+ mObjTrans *= mTrans;
+
+ E3DModifySceneSnapRectUpdater aUpdater(this);
+ SetTransform(mObjTrans);
+ }
+}
+
+/*************************************************************************
+|*
+|* Objekt verschieben in 2D, wird bei Cursortasten benoetigt
+|*
+\************************************************************************/
+void E3dObject::NbcMove(const Size& rSize)
+{
+ // Bewegung in X,Y im Augkoordinatensystem
+ E3dScene* pScene = GetScene();
+
+ if(pScene)
+ {
+ // Abmessungen der Szene in 3D und 2D als Vergleich
+ Rectangle aRect = pScene->GetSnapRect();
+
+ // Transformation Weltkoordinaten bis eine VOR Objektkoordinaten holen
+ basegfx::B3DHomMatrix mInvDispTransform;
+ if(GetParentObj())
+ {
+ mInvDispTransform = GetParentObj()->GetFullTransform();
+ mInvDispTransform.invert();
+ }
+
+ // BoundVolume from 3d world to 3d eye
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+ basegfx::B3DRange aEyeVol(pScene->GetBoundVolume());
+ aEyeVol.transform(aViewInfo3D.getOrientation());
+
+ // build relative movement vector in eye coordinates
+ basegfx::B3DPoint aMove(
+ (double)rSize.Width() * aEyeVol.getWidth() / (double)aRect.GetWidth(),
+ (double)-rSize.Height() * aEyeVol.getHeight() / (double)aRect.GetHeight(),
+ 0.0);
+ basegfx::B3DPoint aPos(0.0, 0.0, 0.0);
+
+ // movement vektor to local coordinates of objects' parent
+ basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
+ aInverseOrientation.invert();
+ basegfx::B3DHomMatrix aCompleteTrans(mInvDispTransform * aInverseOrientation);
+
+ aMove = aCompleteTrans * aMove;
+ aPos = aCompleteTrans * aPos;
+
+ // build transformation and apply
+ basegfx::B3DHomMatrix aTranslate;
+ aTranslate.translate(aMove.getX() - aPos.getX(), aMove.getY() - aPos.getY(), aMove.getZ() - aPos.getZ());
+
+ E3DModifySceneSnapRectUpdater aUpdater(pScene);
+ SetTransform(aTranslate * GetTransform());
+ }
+}
+
+/*************************************************************************
+|*
+|* liefere die Sublist, aber nur dann, wenn darin Objekte enthalten sind !
+|*
+\************************************************************************/
+
+SdrObjList* E3dObject::GetSubList() const
+{
+ return &(const_cast< E3dObjList& >(maSubList));
+}
+
+/*************************************************************************
+|*
+|* SnapRect berechnen
+|*
+\************************************************************************/
+
+void E3dObject::RecalcSnapRect()
+{
+ maSnapRect = Rectangle();
+
+ for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
+ {
+ E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a));
+
+ if(pCandidate)
+ {
+ maSnapRect.Union(pCandidate->GetSnapRect());
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Einfuegen eines 3D-Objekts an den Parent weitermelden, damit dieser
+|* ggf. eine Sonderbehandlung fuer spezielle Objekte durchfuehren kann
+|* (z.B. Light/Label in E3dScene)
+|*
+\************************************************************************/
+
+void E3dObject::NewObjectInserted(const E3dObject* p3DObj)
+{
+ if(GetParentObj())
+ GetParentObj()->NewObjectInserted(p3DObj);
+}
+
+/*************************************************************************
+|*
+|* Parent ueber Aenderung der Struktur (z.B. durch Transformation)
+|* informieren; dabei wird das Objekt, in welchem die Aenderung
+|* aufgetreten ist, uebergeben
+|*
+\************************************************************************/
+
+void E3dObject::StructureChanged()
+{
+ if ( GetParentObj() )
+ {
+ GetParentObj()->InvalidateBoundVolume();
+ GetParentObj()->StructureChanged();
+ }
+}
+
+/*************************************************************************
+|*
+|* 3D-Objekt einfuegen
+|*
+\************************************************************************/
+
+void E3dObject::Insert3DObj(E3dObject* p3DObj)
+{
+ DBG_ASSERT(p3DObj, "Insert3DObj mit NULL-Zeiger!");
+ SdrPage* pPg = pPage;
+ maSubList.InsertObject(p3DObj);
+ pPage = pPg;
+ InvalidateBoundVolume();
+ NewObjectInserted(p3DObj);
+ StructureChanged();
+}
+
+void E3dObject::Remove3DObj(E3dObject* p3DObj)
+{
+ DBG_ASSERT(p3DObj, "Remove3DObj mit NULL-Zeiger!");
+
+ if(p3DObj->GetParentObj() == this)
+ {
+ SdrPage* pPg = pPage;
+ maSubList.RemoveObject(p3DObj->GetOrdNum());
+ pPage = pPg;
+
+ InvalidateBoundVolume();
+ StructureChanged();
+ }
+}
+
+/*************************************************************************
+|*
+|* Parent holen
+|*
+\************************************************************************/
+
+E3dObject* E3dObject::GetParentObj() const
+{
+ E3dObject* pRetval = NULL;
+
+ if(GetObjList()
+ && GetObjList()->GetOwnerObj()
+ && GetObjList()->GetOwnerObj()->ISA(E3dObject))
+ pRetval = ((E3dObject*)GetObjList()->GetOwnerObj());
+ return pRetval;
+}
+
+/*************************************************************************
+|*
+|* Uebergeordnetes Szenenobjekt bestimmen
+|*
+\************************************************************************/
+
+E3dScene* E3dObject::GetScene() const
+{
+ if(GetParentObj())
+ return GetParentObj()->GetScene();
+ return NULL;
+}
+
+/*************************************************************************
+|*
+|* umschliessendes Volumen inklusive aller Kindobjekte berechnen
+|*
+\************************************************************************/
+
+basegfx::B3DRange E3dObject::RecalcBoundVolume() const
+{
+ basegfx::B3DRange aRetval;
+ const sal_uInt32 nObjCnt(maSubList.GetObjCount());
+
+ if(nObjCnt)
+ {
+ for(sal_uInt32 a(0); a < nObjCnt; a++)
+ {
+ const E3dObject* p3DObject = dynamic_cast< const E3dObject* >(maSubList.GetObj(a));
+
+ if(p3DObject)
+ {
+ basegfx::B3DRange aLocalRange(p3DObject->GetBoundVolume());
+ aLocalRange.transform(p3DObject->GetTransform());
+ aRetval.expand(aLocalRange);
+ }
+ }
+ }
+ else
+ {
+ // single 3D object
+ const sdr::contact::ViewContactOfE3d* pVCOfE3D = dynamic_cast< const sdr::contact::ViewContactOfE3d* >(&GetViewContact());
+
+ if(pVCOfE3D)
+ {
+ // BoundVolume is without 3D object transformation, use correct sequence
+ const drawinglayer::primitive3d::Primitive3DSequence xLocalSequence(pVCOfE3D->getVIP3DSWithoutObjectTransform());
+
+ if(xLocalSequence.hasElements())
+ {
+ const uno::Sequence< beans::PropertyValue > aEmptyParameters;
+ const drawinglayer::geometry::ViewInformation3D aLocalViewInformation3D(aEmptyParameters);
+
+ aRetval = drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence(
+ xLocalSequence, aLocalViewInformation3D);
+ }
+ }
+ }
+
+ return aRetval;
+}
+
+/*************************************************************************
+|*
+|* umschliessendes Volumen zurueckgeben und ggf. neu berechnen
+|*
+\************************************************************************/
+
+const basegfx::B3DRange& E3dObject::GetBoundVolume() const
+{
+ if(maLocalBoundVol.isEmpty())
+ {
+ const_cast< E3dObject* >(this)->maLocalBoundVol = RecalcBoundVolume();
+ }
+
+ return maLocalBoundVol;
+}
+
+void E3dObject::InvalidateBoundVolume()
+{
+ maLocalBoundVol.reset();
+}
+
+/*************************************************************************
+|*
+|* Aederung des BoundVolumes an alle Kindobjekte weitergeben
+|*
+\************************************************************************/
+
+void E3dObject::SetBoundVolInvalid()
+{
+ InvalidateBoundVolume();
+
+ for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
+ {
+ E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a));
+
+ if(pCandidate)
+ {
+ pCandidate->SetBoundVolInvalid();
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Aederung der Transformation an alle Kindobjekte weitergeben
+|*
+\************************************************************************/
+
+void E3dObject::SetTransformChanged()
+{
+ InvalidateBoundVolume();
+ mbTfHasChanged = true;
+
+ for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
+ {
+ E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a));
+
+ if(pCandidate)
+ {
+ pCandidate->SetTransformChanged();
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* hierarchische Transformation ueber alle Parents bestimmen, in
+|* maFullTransform ablegen und diese zurueckgeben
+|*
+\************************************************************************/
+
+const basegfx::B3DHomMatrix& E3dObject::GetFullTransform() const
+{
+ if(mbTfHasChanged)
+ {
+ basegfx::B3DHomMatrix aNewFullTransformation(maTransformation);
+
+ if ( GetParentObj() )
+ {
+ aNewFullTransformation = GetParentObj()->GetFullTransform() * aNewFullTransformation;
+ }
+
+ const_cast< E3dObject* >(this)->maFullTransform = aNewFullTransformation;
+ const_cast< E3dObject* >(this)->mbTfHasChanged = false;
+ }
+
+ return maFullTransform;
+}
+
+/*************************************************************************
+|*
+|* Transformationsmatrix abfragen
+|*
+\************************************************************************/
+
+const basegfx::B3DHomMatrix& E3dObject::GetTransform() const
+{
+ return maTransformation;
+}
+
+/*************************************************************************
+|*
+|* Transformationsmatrix setzen
+|*
+\************************************************************************/
+
+void E3dObject::NbcSetTransform(const basegfx::B3DHomMatrix& rMatrix)
+{
+ if(maTransformation != rMatrix)
+ {
+ maTransformation = rMatrix;
+ SetTransformChanged();
+ StructureChanged();
+ }
+}
+
+/*************************************************************************
+|*
+|* Transformationsmatrix setzen mit Repaint-Broadcast
+|*
+\************************************************************************/
+
+void E3dObject::SetTransform(const basegfx::B3DHomMatrix& rMatrix)
+{
+ if(rMatrix != maTransformation)
+ {
+ // #110094#-14 SendRepaintBroadcast();
+ NbcSetTransform(rMatrix);
+ SetChanged();
+ BroadcastObjectChange();
+ if (pUserCall != NULL) pUserCall->Changed(*this, SDRUSERCALL_RESIZE, Rectangle());
+ }
+}
+
+/*************************************************************************
+|*
+|* Linien fuer die Wireframe-Darstellung des Objekts dem uebergebenen
+|* basegfx::B3DPolygon hinzufuegen
+|*
+\************************************************************************/
+
+basegfx::B3DPolyPolygon E3dObject::CreateWireframe() const
+{
+ const basegfx::B3DRange aBoundVolume(GetBoundVolume());
+ return basegfx::tools::createCubePolyPolygonFromB3DRange(aBoundVolume);
+}
+
+/*************************************************************************
+|*
+|* Get the name of the object (singular)
+|*
+\************************************************************************/
+
+void E3dObject::TakeObjNameSingul(XubString& rName) const
+{
+ rName=ImpGetResStr(STR_ObjNameSingulObj3d);
+
+ String aName( GetName() );
+ if(aName.Len())
+ {
+ rName += sal_Unicode(' ');
+ rName += sal_Unicode('\'');
+ rName += aName;
+ rName += sal_Unicode('\'');
+ }
+}
+
+/*************************************************************************
+|*
+|* Get the name of the object (plural)
+|*
+\************************************************************************/
+
+void E3dObject::TakeObjNamePlural(XubString& rName) const
+{
+ rName=ImpGetResStr(STR_ObjNamePluralObj3d);
+}
+
+/*************************************************************************
+|*
+|* Zuweisungsoperator
+|*
+\************************************************************************/
+
+void E3dObject::operator=(const SdrObject& rObj)
+{
+ SdrObject::operator=(rObj);
+
+ const E3dObject& r3DObj = (const E3dObject&) rObj;
+ if (r3DObj.GetSubList())
+ {
+ maSubList.CopyObjects(*r3DObj.GetSubList());
+ }
+
+ // BoundVol kann uebernommen werden, da die Childs auch kopiert werden
+ maLocalBoundVol = r3DObj.maLocalBoundVol;
+ maTransformation = r3DObj.maTransformation;
+
+ // Da sich der Parent geaendert haben kann, Gesamttransformation beim
+ // naechsten Mal auf jeden Fall neu bestimmen
+ SetTransformChanged();
+
+ // Selektionsstatus kopieren
+ mbIsSelected = r3DObj.mbIsSelected;
+}
+
+/*************************************************************************
+|*
+|* erstelle neues GeoData-Objekt
+|*
+\************************************************************************/
+
+SdrObjGeoData *E3dObject::NewGeoData() const
+{
+ // Theoretisch duerfen auch nur Szenen ihre GeoDatas erstellen und verwalten !!
+ // AW: Dies stimmt nicht mehr, diese Stelle ist mit der neuen Engine OK!
+ return new E3DObjGeoData;
+}
+
+/*************************************************************************
+|*
+|* uebergebe aktuelle werte an das GeoData-Objekt
+|*
+\************************************************************************/
+
+void E3dObject::SaveGeoData(SdrObjGeoData& rGeo) const
+{
+ SdrAttrObj::SaveGeoData (rGeo);
+
+ ((E3DObjGeoData &) rGeo).maLocalBoundVol = maLocalBoundVol;
+ ((E3DObjGeoData &) rGeo).maTransformation = maTransformation;
+}
+
+/*************************************************************************
+|*
+|* uebernehme werte aus dem GeoData-Objekt
+|*
+\************************************************************************/
+
+void E3dObject::RestGeoData(const SdrObjGeoData& rGeo)
+{
+ maLocalBoundVol = ((E3DObjGeoData &) rGeo).maLocalBoundVol;
+ E3DModifySceneSnapRectUpdater aUpdater(this);
+ NbcSetTransform(((E3DObjGeoData &) rGeo).maTransformation);
+ SdrAttrObj::RestGeoData (rGeo);
+}
+
+/*************************************************************************
+|*
+|* Rotation eines 3d-Koerpers
+|*
+\************************************************************************/
+// 2D-rotation eines 3D-Koerpers, normalerweise macht das die Szene selbst
+// Ist aber eine korrekte Implementierung, denn alles was passiert ist eine
+// Rotation um die Achse die senkrecht auf dem Bildschirm steht und zwar
+// unabhaengig davon, wie die Szene bisher gedreht worden ist.
+
+void E3dObject::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
+{
+ // Also derzeit sind die Klebepunkte relativ zum aOutRect der Szene definiert. Vor dem Drehen
+ // werden die Klebepunkte relativ zur Seite definiert. Sie nehmen an der Drehung der Szene noch nicht Teil
+ // dafuer gibt es den
+ SetGlueReallyAbsolute(sal_True);
+
+ // SendRepaintBroadcast();
+ double fWinkelInRad = nWink/100 * F_PI180;
+
+ basegfx::B3DHomMatrix aRotateZ;
+ aRotateZ.rotate(0.0, 0.0, fWinkelInRad);
+ NbcSetTransform(aRotateZ * GetTransform());
+
+ SetRectsDirty(); // Veranlasst eine Neuberechnung aller BoundRects
+ NbcRotateGluePoints(rRef,nWink,sn,cs); // Rotiert die Klebepunkte (die haben noch Koordinaten relativ
+ // zum Urpsung des Blattes
+ SetGlueReallyAbsolute(sal_False); // ab jetzt sind sie wieder relativ zum BoundRect (also dem aOutRect definiert)
+}
+
+/*************************************************************************/
+
+//////////////////////////////////////////////////////////////////////////////
+
+sdr::properties::BaseProperties* E3dCompoundObject::CreateObjectSpecificProperties()
+{
+ return new sdr::properties::E3dCompoundProperties(*this);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(E3dCompoundObject, E3dObject);
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+E3dCompoundObject::E3dCompoundObject()
+: E3dObject(),
+ aMaterialAmbientColor(),
+ bCreateNormals(false),
+ bCreateTexture(false)
+{
+ // Defaults setzen
+ E3dDefaultAttributes aDefault;
+ SetDefaultAttributes(aDefault);
+}
+
+E3dCompoundObject::E3dCompoundObject(E3dDefaultAttributes& rDefault)
+: E3dObject(),
+ aMaterialAmbientColor(),
+ bCreateNormals(false),
+ bCreateTexture(false)
+{
+ // Defaults setzen
+ SetDefaultAttributes(rDefault);
+}
+
+void E3dCompoundObject::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
+{
+ // Defaults setzen
+ aMaterialAmbientColor = rDefault.GetDefaultAmbientColor();
+
+ bCreateNormals = rDefault.GetDefaultCreateNormals();
+ bCreateTexture = rDefault.GetDefaultCreateTexture();
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+E3dCompoundObject::~E3dCompoundObject ()
+{
+}
+
+/*************************************************************************
+|*
+|* Drag-Polygon zurueckgeben
+|*
+\************************************************************************/
+
+basegfx::B2DPolyPolygon E3dCompoundObject::TakeXorPoly() const
+{
+ basegfx::B2DPolyPolygon aRetval;
+ const uno::Sequence< beans::PropertyValue > aEmptyParameters;
+ drawinglayer::geometry::ViewInformation3D aViewInfo3D(aEmptyParameters);
+ E3dScene* pRootScene = fillViewInformation3DForCompoundObject(aViewInfo3D, *this);
+
+ if(pRootScene)
+ {
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pRootScene->GetViewContact());
+ const basegfx::B3DPolyPolygon aCubePolyPolygon(CreateWireframe());
+ aRetval = basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(aCubePolyPolygon,
+ aViewInfo3D.getObjectToView() * GetTransform());
+ aRetval.transform(rVCScene.getObjectTransformation());
+ }
+
+ return aRetval;
+}
+
+/*************************************************************************
+|*
+|* Anzahl der Handles zurueckgeben
+|*
+\************************************************************************/
+
+sal_uInt32 E3dCompoundObject::GetHdlCount() const
+{
+ // 8 Eckpunkte + 1 E3dVolumeMarker (= Wireframe-Darstellung)
+ return 9L;
+}
+
+/*************************************************************************
+|*
+|* Handle-Liste fuellen
+|*
+\************************************************************************/
+
+void E3dCompoundObject::AddToHdlList(SdrHdlList& rHdlList) const
+{
+ const uno::Sequence< beans::PropertyValue > aEmptyParameters;
+ drawinglayer::geometry::ViewInformation3D aViewInfo3D(aEmptyParameters);
+ E3dScene* pRootScene = fillViewInformation3DForCompoundObject(aViewInfo3D, *this);
+
+ if(pRootScene)
+ {
+ const basegfx::B3DRange aBoundVolume(GetBoundVolume());
+
+ if(!aBoundVolume.isEmpty())
+ {
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pRootScene->GetViewContact());
+
+ for(sal_uInt32 a(0); a < 8; a++)
+ {
+ basegfx::B3DPoint aPos3D;
+
+ switch(a)
+ {
+ case 0 : aPos3D.setX(aBoundVolume.getMinX()); aPos3D.setY(aBoundVolume.getMinY()); aPos3D.setZ(aBoundVolume.getMinZ()); break;
+ case 1 : aPos3D.setX(aBoundVolume.getMinX()); aPos3D.setY(aBoundVolume.getMinY()); aPos3D.setZ(aBoundVolume.getMaxZ()); break;
+ case 2 : aPos3D.setX(aBoundVolume.getMinX()); aPos3D.setY(aBoundVolume.getMaxY()); aPos3D.setZ(aBoundVolume.getMinZ()); break;
+ case 3 : aPos3D.setX(aBoundVolume.getMinX()); aPos3D.setY(aBoundVolume.getMaxY()); aPos3D.setZ(aBoundVolume.getMaxZ()); break;
+ case 4 : aPos3D.setX(aBoundVolume.getMaxX()); aPos3D.setY(aBoundVolume.getMinY()); aPos3D.setZ(aBoundVolume.getMinZ()); break;
+ case 5 : aPos3D.setX(aBoundVolume.getMaxX()); aPos3D.setY(aBoundVolume.getMinY()); aPos3D.setZ(aBoundVolume.getMaxZ()); break;
+ case 6 : aPos3D.setX(aBoundVolume.getMaxX()); aPos3D.setY(aBoundVolume.getMaxY()); aPos3D.setZ(aBoundVolume.getMinZ()); break;
+ case 7 : aPos3D.setX(aBoundVolume.getMaxX()); aPos3D.setY(aBoundVolume.getMaxY()); aPos3D.setZ(aBoundVolume.getMaxZ()); break;
+ }
+
+ // to 3d view coor
+ aPos3D *= aViewInfo3D.getObjectToView() * GetTransform();
+
+ // create 2d relative scene
+ basegfx::B2DPoint aPos2D(aPos3D.getX(), aPos3D.getY());
+
+ // to 2d world coor
+ aPos2D *= rVCScene.getObjectTransformation();
+
+ rHdlList.AddHdl(new SdrHdl(Point(basegfx::fround(aPos2D.getX()), basegfx::fround(aPos2D.getY())), HDL_BWGT));
+ }
+ }
+ }
+
+ const basegfx::B2DPolyPolygon aPolyPolygon(TakeXorPoly());
+
+ if(aPolyPolygon.count())
+ {
+ E3dVolumeMarker* pVolMarker = new E3dVolumeMarker(aPolyPolygon);
+ rHdlList.AddHdl(pVolMarker);
+ }
+}
+
+/*************************************************************************
+|*
+|* Identifier zurueckgeben
+|*
+\************************************************************************/
+
+sal_uInt16 E3dCompoundObject::GetObjIdentifier() const
+{
+ return E3D_COMPOUNDOBJ_ID;
+}
+
+/*************************************************************************
+|*
+|* SnapRect berechnen
+|*
+\************************************************************************/
+
+void E3dCompoundObject::RecalcSnapRect()
+{
+ const uno::Sequence< beans::PropertyValue > aEmptyParameters;
+ drawinglayer::geometry::ViewInformation3D aViewInfo3D(aEmptyParameters);
+ E3dScene* pRootScene = fillViewInformation3DForCompoundObject(aViewInfo3D, *this);
+ maSnapRect = Rectangle();
+
+ if(pRootScene)
+ {
+ // get VC of 3D candidate
+ const sdr::contact::ViewContactOfE3d* pVCOfE3D = dynamic_cast< const sdr::contact::ViewContactOfE3d* >(&GetViewContact());
+
+ if(pVCOfE3D)
+ {
+ // get 3D primitive sequence
+ const drawinglayer::primitive3d::Primitive3DSequence xLocalSequence(pVCOfE3D->getViewIndependentPrimitive3DSequence());
+
+ if(xLocalSequence.hasElements())
+ {
+ // get BoundVolume
+ basegfx::B3DRange aBoundVolume(drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence(
+ xLocalSequence, aViewInfo3D));
+
+ // transform bound volume to relative scene coordinates
+ aBoundVolume.transform(aViewInfo3D.getObjectToView());
+
+ // build 2d relative scene range
+ basegfx::B2DRange aSnapRange(
+ aBoundVolume.getMinX(), aBoundVolume.getMinY(),
+ aBoundVolume.getMaxX(), aBoundVolume.getMaxY());
+
+ // transform to 2D world coordiantes
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pRootScene->GetViewContact());
+ aSnapRange.transform(rVCScene.getObjectTransformation());
+
+ // snap to integer
+ maSnapRect = Rectangle(
+ sal_Int32(floor(aSnapRange.getMinX())), sal_Int32(floor(aSnapRange.getMinY())),
+ sal_Int32(ceil(aSnapRange.getMaxX())), sal_Int32(ceil(aSnapRange.getMaxY())));
+ }
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Copy-Operator
+|*
+\************************************************************************/
+
+void E3dCompoundObject::operator=(const SdrObject& rObj)
+{
+ // erstmal alle Childs kopieren
+ E3dObject::operator=(rObj);
+
+ // weitere Parameter kopieren
+ const E3dCompoundObject& r3DObj = (const E3dCompoundObject&) rObj;
+
+ bCreateNormals = r3DObj.bCreateNormals;
+ bCreateTexture = r3DObj.bCreateTexture;
+ aMaterialAmbientColor = r3DObj.aMaterialAmbientColor;
+}
+
+/*************************************************************************
+|*
+|* Parameter Geometrieerzeugung setzen
+|*
+\************************************************************************/
+
+void E3dCompoundObject::SetCreateNormals(sal_Bool bNew)
+{
+ if(bCreateNormals != bNew)
+ {
+ bCreateNormals = bNew;
+ ActionChanged();
+ }
+}
+
+void E3dCompoundObject::SetCreateTexture(sal_Bool bNew)
+{
+ if(bCreateTexture != bNew)
+ {
+ bCreateTexture = bNew;
+ ActionChanged();
+ }
+}
+
+/*************************************************************************
+|*
+|* Material des Objektes
+|*
+\************************************************************************/
+
+void E3dCompoundObject::SetMaterialAmbientColor(const Color& rColor)
+{
+ if(aMaterialAmbientColor != rColor)
+ {
+ aMaterialAmbientColor = rColor;
+ }
+}
+
+/*************************************************************************
+|*
+|* convert given basegfx::B3DPolyPolygon to screen coor
+|*
+\************************************************************************/
+
+basegfx::B2DPolyPolygon E3dCompoundObject::TransformToScreenCoor(const basegfx::B3DPolyPolygon& rCandidate)
+{
+ const uno::Sequence< beans::PropertyValue > aEmptyParameters;
+ drawinglayer::geometry::ViewInformation3D aViewInfo3D(aEmptyParameters);
+ E3dScene* pRootScene = fillViewInformation3DForCompoundObject(aViewInfo3D, *this);
+ basegfx::B2DPolyPolygon aRetval;
+
+ if(pRootScene)
+ {
+ aRetval = basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(rCandidate,
+ aViewInfo3D.getObjectToView() * GetTransform());
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pRootScene->GetViewContact());
+ aRetval.transform(rVCScene.getObjectTransformation());
+ }
+
+ return aRetval;
+}
+
+sal_Bool E3dCompoundObject::IsAOrdNumRemapCandidate(E3dScene*& prScene) const
+{
+ if(GetObjList()
+ && GetObjList()->GetOwnerObj()
+ && GetObjList()->GetOwnerObj()->ISA(E3dScene))
+ {
+ prScene = (E3dScene*)GetObjList()->GetOwnerObj();
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/engine3d/objfac3d.cxx b/svx/source/engine3d/objfac3d.cxx
new file mode 100644
index 000000000000..be9edd9bf60f
--- /dev/null
+++ b/svx/source/engine3d/objfac3d.cxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/svdpage.hxx>
+#include "svx/globl3d.hxx"
+#include <svx/polysc3d.hxx>
+#include <svx/cube3d.hxx>
+#include <svx/sphere3d.hxx>
+#include <svx/extrud3d.hxx>
+#include <svx/lathe3d.hxx>
+#include <svx/polygn3d.hxx>
+#include "svx/objfac3d.hxx"
+#include <svx/svdobj.hxx>
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+static sal_Bool bInit = sal_False;
+
+E3dObjFactory::E3dObjFactory()
+{
+ if ( !bInit )
+ {
+ SdrObjFactory::InsertMakeObjectHdl(LINK(this, E3dObjFactory, MakeObject));
+ bInit = sal_True;
+ }
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+E3dObjFactory::~E3dObjFactory()
+{
+}
+
+/*************************************************************************
+|*
+|* Chart-interne Objekte erzeugen
+|*
+\************************************************************************/
+
+IMPL_LINK( E3dObjFactory, MakeObject, SdrObjFactory*, pObjFactory)
+{
+ if ( pObjFactory->nInventor == E3dInventor )
+ {
+ switch ( pObjFactory->nIdentifier )
+ {
+ case E3D_POLYSCENE_ID:
+ pObjFactory->pNewObj = new E3dPolyScene();
+ break;
+ case E3D_POLYGONOBJ_ID :
+ pObjFactory->pNewObj = new E3dPolygonObj();
+ break;
+ case E3D_CUBEOBJ_ID :
+ pObjFactory->pNewObj = new E3dCubeObj();
+ break;
+ case E3D_SPHEREOBJ_ID:
+ // FG: ruft den dummy constructor, da dieser Aufruf nur beim Laden von Dokumenten erfolgt.
+ // die wirkliche Anzahkl Segmente wird aber erst nach dem Laden der Member festgelegt.
+ // dies hat zur Folge das die erste Kugel gleich wieder zerstoert wird, obwohl sie nie
+ // gebraucht worden ist.
+ pObjFactory->pNewObj = new E3dSphereObj(123);
+ break;
+ case E3D_EXTRUDEOBJ_ID:
+ pObjFactory->pNewObj = new E3dExtrudeObj();
+ break;
+ case E3D_LATHEOBJ_ID:
+ pObjFactory->pNewObj = new E3dLatheObj();
+ break;
+ case E3D_COMPOUNDOBJ_ID:
+ pObjFactory->pNewObj = new E3dCompoundObject();
+ break;
+ }
+ }
+ return 0;
+}
+
+
diff --git a/svx/source/engine3d/polygn3d.cxx b/svx/source/engine3d/polygn3d.cxx
new file mode 100644
index 000000000000..7086aace6659
--- /dev/null
+++ b/svx/source/engine3d/polygn3d.cxx
@@ -0,0 +1,361 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/polygn3d.hxx>
+#include <svx/svdpage.hxx>
+#include "svx/globl3d.hxx"
+#include <basegfx/point/b3dpoint.hxx>
+#include <svx/sdr/contact/viewcontactofe3dpolygon.hxx>
+#include <basegfx/polygon/b3dpolygon.hxx>
+#include <basegfx/polygon/b3dpolygontools.hxx>
+
+TYPEINIT1(E3dPolygonObj, E3dCompoundObject);
+
+//////////////////////////////////////////////////////////////////////////////
+// #110094# DrawContact section
+
+sdr::contact::ViewContact* E3dPolygonObj::CreateObjectSpecificViewContact()
+{
+ return new sdr::contact::ViewContactOfE3dPolygon(*this);
+}
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+E3dPolygonObj::E3dPolygonObj(
+ E3dDefaultAttributes& rDefault,
+ const basegfx::B3DPolyPolygon& rPolyPoly3D,
+ sal_Bool bLinOnly)
+: E3dCompoundObject(rDefault),
+ bLineOnly(bLinOnly)
+{
+ // Geometrie setzen
+ SetPolyPolygon3D(rPolyPoly3D);
+
+ // Default-Normals erzeugen
+ CreateDefaultNormals();
+
+ // Default-Texturkoordinaten erzeugen
+ CreateDefaultTexture();
+}
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+E3dPolygonObj::E3dPolygonObj(
+ E3dDefaultAttributes& rDefault,
+ const basegfx::B3DPolyPolygon& rPolyPoly3D,
+ const basegfx::B3DPolyPolygon& rPolyNormals3D,
+ sal_Bool bLinOnly)
+: E3dCompoundObject(rDefault),
+ bLineOnly(bLinOnly)
+{
+ // Geometrie und Normalen setzen
+ SetPolyPolygon3D(rPolyPoly3D);
+ SetPolyNormals3D(rPolyNormals3D);
+
+ // Default-Texturkoordinaten erzeugen
+ CreateDefaultTexture();
+}
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+E3dPolygonObj::E3dPolygonObj(
+ E3dDefaultAttributes& rDefault,
+ const basegfx::B3DPolyPolygon& rPolyPoly3D,
+ const basegfx::B3DPolyPolygon& rPolyNormals3D,
+ const basegfx::B2DPolyPolygon& rPolyTexture2D,
+ sal_Bool bLinOnly)
+: E3dCompoundObject(rDefault),
+ bLineOnly(bLinOnly)
+{
+ SetPolyPolygon3D(rPolyPoly3D);
+ SetPolyNormals3D(rPolyNormals3D);
+ SetPolyTexture2D(rPolyTexture2D);
+}
+
+/*************************************************************************
+|*
+|* Leer-Konstruktor
+|*
+\************************************************************************/
+
+E3dPolygonObj::E3dPolygonObj()
+: E3dCompoundObject(),
+ bLineOnly(false) // added missing initialisation
+{
+ // Keine Geometrie erzeugen
+}
+
+/*************************************************************************
+|*
+|* Default-Normalen erzeugen
+|*
+\************************************************************************/
+
+void E3dPolygonObj::CreateDefaultNormals()
+{
+ basegfx::B3DPolyPolygon aPolyNormals;
+
+ // Komplettes PolyPolygon mit den Ebenennormalen anlegen
+ for(sal_uInt32 a(0L); a < aPolyPoly3D.count(); a++)
+ {
+ // Quellpolygon finden
+ const basegfx::B3DPolygon aPolygon(aPolyPoly3D.getB3DPolygon(a));
+
+ // Neues Polygon fuer Normalen anlegen
+ basegfx::B3DPolygon aNormals;
+
+ // Normale holen (und umdrehen)
+ basegfx::B3DVector aNormal(-basegfx::tools::getNormal(aPolygon));
+
+ // Neues Polygon fuellen
+ for(sal_uInt32 b(0L); b < aPolygon.count(); b++)
+ {
+ aNormals.append(aNormal);
+ }
+
+ // Neues Polygon in PolyPolygon einfuegen
+ aPolyNormals.append(aNormals);
+ }
+
+ // Default-Normalen setzen
+ SetPolyNormals3D(aPolyNormals);
+}
+
+/*************************************************************************
+|*
+|* Default-Texturkoordinaten erzeugen
+|*
+\************************************************************************/
+
+void E3dPolygonObj::CreateDefaultTexture()
+{
+ basegfx::B2DPolyPolygon aPolyTexture;
+
+ // Komplettes PolyPolygon mit den Texturkoordinaten anlegen
+ // Die Texturkoordinaten erstrecken sich ueber X,Y und Z
+ // ueber die gesamten Extremwerte im Bereich 0.0 .. 1.0
+ for(sal_uInt32 a(0L); a < aPolyPoly3D.count(); a++)
+ {
+ // Quellpolygon finden
+ const basegfx::B3DPolygon& aPolygon(aPolyPoly3D.getB3DPolygon(a));
+
+ // Gesamtgroesse des Objektes feststellen
+ basegfx::B3DRange aVolume(basegfx::tools::getRange(aPolygon));
+
+ // Normale holen
+ basegfx::B3DVector aNormal(basegfx::tools::getNormal(aPolygon));
+ aNormal.setX(fabs(aNormal.getX()));
+ aNormal.setY(fabs(aNormal.getY()));
+ aNormal.setZ(fabs(aNormal.getZ()));
+
+ // Entscheiden, welche Koordinaten als Source fuer das
+ // Mapping benutzt werden sollen
+ sal_uInt16 nSourceMode = 0;
+
+ // Groessten Freiheitsgrad ermitteln
+ if(!(aNormal.getX() > aNormal.getY() && aNormal.getX() > aNormal.getZ()))
+ {
+ if(aNormal.getY() > aNormal.getZ())
+ {
+ // Y ist am groessten, benutze X,Z als mapping
+ nSourceMode = 1;
+ }
+ else
+ {
+ // Z ist am groessten, benutze X,Y als mapping
+ nSourceMode = 2;
+ }
+ }
+
+ // Neues Polygon fuer Texturkoordinaten anlegen
+ basegfx::B2DPolygon aTexture;
+
+ // Neues Polygon fuellen
+ for(sal_uInt32 b(0L); b < aPolygon.count(); b++)
+ {
+ basegfx::B2DPoint aTex;
+ const basegfx::B3DPoint aCandidate(aPolygon.getB3DPoint(b));
+
+ switch(nSourceMode)
+ {
+ case 0: // Quelle ist Y,Z
+ if(aVolume.getHeight())
+ aTex.setX((aCandidate.getY() - aVolume.getMinY()) / aVolume.getHeight());
+ if(aVolume.getDepth())
+ aTex.setY((aCandidate.getZ() - aVolume.getMinZ()) / aVolume.getDepth());
+ break;
+
+ case 1: // Quelle ist X,Z
+ if(aVolume.getWidth())
+ aTex.setX((aCandidate.getX() - aVolume.getMinX()) / aVolume.getWidth());
+ if(aVolume.getDepth())
+ aTex.setY((aCandidate.getZ() - aVolume.getMinZ()) / aVolume.getDepth());
+ break;
+
+ case 2: // Quelle ist X,Y
+ if(aVolume.getWidth())
+ aTex.setX((aCandidate.getX() - aVolume.getMinX()) / aVolume.getWidth());
+ if(aVolume.getHeight())
+ aTex.setY((aCandidate.getY() - aVolume.getMinY()) / aVolume.getHeight());
+ break;
+ }
+
+ aTexture.append(aTex);
+ }
+
+ // Neues Polygon in PolyPolygon einfuegen
+ aPolyTexture.append(aTexture);
+ }
+
+ // Default-Texturkoordinaten setzen
+ SetPolyTexture2D(aPolyTexture);
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+E3dPolygonObj::~E3dPolygonObj()
+{
+}
+
+/*************************************************************************
+|*
+|* Identifier zurueckgeben
+|*
+\************************************************************************/
+
+sal_uInt16 E3dPolygonObj::GetObjIdentifier() const
+{
+ return E3D_POLYGONOBJ_ID;
+}
+
+/*************************************************************************
+|*
+|* Polygon setzen
+|*
+\************************************************************************/
+
+void E3dPolygonObj::SetPolyPolygon3D(const basegfx::B3DPolyPolygon& rNewPolyPoly3D)
+{
+ if ( aPolyPoly3D != rNewPolyPoly3D )
+ {
+ // Neues PolyPolygon; kopieren
+ aPolyPoly3D = rNewPolyPoly3D;
+
+ // Geometrie neu erzeugen
+ ActionChanged();
+ }
+}
+
+void E3dPolygonObj::SetPolyNormals3D(const basegfx::B3DPolyPolygon& rNewPolyNormals3D)
+{
+ if ( aPolyNormals3D != rNewPolyNormals3D )
+ {
+ // Neue Normalen; kopieren
+ aPolyNormals3D = rNewPolyNormals3D;
+
+ // Geometrie neu erzeugen
+ ActionChanged();
+ }
+}
+
+void E3dPolygonObj::SetPolyTexture2D(const basegfx::B2DPolyPolygon& rNewPolyTexture2D)
+{
+ if ( aPolyTexture2D != rNewPolyTexture2D )
+ {
+ // Neue Texturkoordinaten; kopieren
+ aPolyTexture2D = rNewPolyTexture2D;
+
+ // Geometrie neu erzeugen
+ ActionChanged();
+ }
+}
+
+/*************************************************************************
+|*
+|* Wandle das Objekt in ein Gruppenobjekt bestehend aus 6 Polygonen
+|*
+\************************************************************************/
+
+SdrObject *E3dPolygonObj::DoConvertToPolyObj(sal_Bool /*bBezier*/) const
+{
+ return NULL;
+}
+
+/*************************************************************************
+|*
+|* Zuweisungsoperator
+|*
+\************************************************************************/
+
+void E3dPolygonObj::operator=(const SdrObject& rObj)
+{
+ // erstmal alle Childs kopieren
+ E3dCompoundObject::operator=(rObj);
+
+ // weitere Parameter kopieren
+ const E3dPolygonObj& r3DObj = (const E3dPolygonObj&)rObj;
+
+ aPolyPoly3D = r3DObj.aPolyPoly3D;
+ aPolyNormals3D = r3DObj.aPolyNormals3D;
+ aPolyTexture2D = r3DObj.aPolyTexture2D;
+ bLineOnly = r3DObj.bLineOnly;
+}
+
+/*************************************************************************
+|*
+|* LineOnly setzen
+|*
+\************************************************************************/
+
+void E3dPolygonObj::SetLineOnly(sal_Bool bNew)
+{
+ if(bNew != bLineOnly)
+ {
+ bLineOnly = bNew;
+ ActionChanged();
+ }
+}
+
+// eof
diff --git a/svx/source/engine3d/polysc3d.cxx b/svx/source/engine3d/polysc3d.cxx
new file mode 100644
index 000000000000..2ee7f795afc2
--- /dev/null
+++ b/svx/source/engine3d/polysc3d.cxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/xfillit.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/svdogrp.hxx>
+#include "svx/svditer.hxx"
+#include <svx/svdetc.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/svapp.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdpool.hxx>
+#include <svl/style.hxx>
+#include "svx/globl3d.hxx"
+#include <svx/polysc3d.hxx>
+#include <svx/xlnclit.hxx>
+#include <svl/metitem.hxx>
+#include <svx/xtable.hxx>
+#include <svx/xlnwtit.hxx>
+
+#define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+TYPEINIT1(E3dPolyScene, E3dScene);
+
+E3dPolyScene::E3dPolyScene()
+: E3dScene()
+{
+}
+
+E3dPolyScene::E3dPolyScene(E3dDefaultAttributes& rDefault)
+: E3dScene(rDefault)
+{
+}
+
+/*************************************************************************
+|*
+|* Identifier zurueckgeben
+|*
+\************************************************************************/
+
+sal_uInt16 E3dPolyScene::GetObjIdentifier() const
+{
+ return E3D_POLYSCENE_ID;
+}
+
+// eof
diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx
new file mode 100644
index 000000000000..7fc40f1abc60
--- /dev/null
+++ b/svx/source/engine3d/scene3d.cxx
@@ -0,0 +1,884 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svx/svdstr.hrc"
+#include "svx/svdglob.hxx"
+#include "svx/svditer.hxx"
+
+#if defined( UNX ) || defined( ICC )
+#include <stdlib.h>
+#endif
+#include "svx/globl3d.hxx"
+#include <svx/svdpage.hxx>
+#include <svl/style.hxx>
+#include <svx/scene3d.hxx>
+#include <svx/e3dundo.hxx>
+#include <svx/svdtrans.hxx>
+#include <svx/svxids.hrc>
+#include <editeng/colritem.hxx>
+#include <svx/e3ditem.hxx>
+#include <svx/xlntrit.hxx>
+#include <svx/xfltrit.hxx>
+#include <svx/svx3ditems.hxx>
+#include <svl/whiter.hxx>
+#include <svx/xflftrit.hxx>
+#include <svx/sdr/properties/e3dsceneproperties.hxx>
+#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
+#include <svx/svddrag.hxx>
+#include <helperminimaldepth3d.hxx>
+#include <algorithm>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <svx/e3dsceneupdater.hxx>
+
+#define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
+
+//////////////////////////////////////////////////////////////////////////////
+// #110988#
+
+class ImpRemap3DDepth
+{
+ sal_uInt32 mnOrdNum;
+ double mfMinimalDepth;
+
+ // bitfield
+ unsigned mbIsScene : 1;
+
+public:
+ ImpRemap3DDepth(sal_uInt32 nOrdNum, double fMinimalDepth);
+ ImpRemap3DDepth(sal_uInt32 nOrdNum);
+ ~ImpRemap3DDepth();
+
+ // for ::std::sort
+ bool operator<(const ImpRemap3DDepth& rComp) const;
+
+ sal_uInt32 GetOrdNum() const { return mnOrdNum; }
+ sal_Bool IsScene() const { return mbIsScene; }
+};
+
+ImpRemap3DDepth::ImpRemap3DDepth(sal_uInt32 nOrdNum, double fMinimalDepth)
+: mnOrdNum(nOrdNum),
+ mfMinimalDepth(fMinimalDepth),
+ mbIsScene(sal_False)
+{
+}
+
+ImpRemap3DDepth::ImpRemap3DDepth(sal_uInt32 nOrdNum)
+: mnOrdNum(nOrdNum),
+ mbIsScene(sal_True)
+{
+}
+
+ImpRemap3DDepth::~ImpRemap3DDepth()
+{
+}
+
+bool ImpRemap3DDepth::operator<(const ImpRemap3DDepth& rComp) const
+{
+ if(IsScene())
+ {
+ return sal_False;
+ }
+ else
+ {
+ if(rComp.IsScene())
+ {
+ return sal_True;
+ }
+ else
+ {
+ return mfMinimalDepth < rComp.mfMinimalDepth;
+ }
+ }
+}
+
+// typedefs for a vector of ImpRemap3DDepths
+typedef ::std::vector< ImpRemap3DDepth > ImpRemap3DDepthVector;
+
+//////////////////////////////////////////////////////////////////////////////
+// #110988#
+
+class Imp3DDepthRemapper
+{
+ ImpRemap3DDepthVector maVector;
+
+public:
+ Imp3DDepthRemapper(E3dScene& rScene);
+ ~Imp3DDepthRemapper();
+
+ sal_uInt32 RemapOrdNum(sal_uInt32 nOrdNum) const;
+};
+
+Imp3DDepthRemapper::Imp3DDepthRemapper(E3dScene& rScene)
+{
+ // only called when rScene.GetSubList() and nObjCount > 1L
+ SdrObjList* pList = rScene.GetSubList();
+ const sal_uInt32 nObjCount(pList->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nObjCount; a++)
+ {
+ SdrObject* pCandidate = pList->GetObj(a);
+
+ if(pCandidate)
+ {
+ if(pCandidate->ISA(E3dCompoundObject))
+ {
+ // single 3d object, calc depth
+ const double fMinimalDepth(getMinimalDepthInViewCoordinates(static_cast< const E3dCompoundObject& >(*pCandidate)));
+ ImpRemap3DDepth aEntry(a, fMinimalDepth);
+ maVector.push_back(aEntry);
+ }
+ else
+ {
+ // scene, use standard entry for scene
+ ImpRemap3DDepth aEntry(a);
+ maVector.push_back(aEntry);
+ }
+ }
+ }
+
+ // now, we need to sort the maVector by it's members minimal depth. The
+ // smaller, the nearer to the viewer.
+ ::std::sort(maVector.begin(), maVector.end());
+}
+
+Imp3DDepthRemapper::~Imp3DDepthRemapper()
+{
+}
+
+sal_uInt32 Imp3DDepthRemapper::RemapOrdNum(sal_uInt32 nOrdNum) const
+{
+ if(nOrdNum < maVector.size())
+ {
+ nOrdNum = maVector[(maVector.size() - 1) - nOrdNum].GetOrdNum();
+ }
+
+ return nOrdNum;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// BaseProperties section
+
+sdr::properties::BaseProperties* E3dScene::CreateObjectSpecificProperties()
+{
+ return new sdr::properties::E3dSceneProperties(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// #110094# DrawContact section
+
+sdr::contact::ViewContact* E3dScene::CreateObjectSpecificViewContact()
+{
+ return new sdr::contact::ViewContactOfE3dScene(*this);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(E3dScene, E3dObject);
+
+/*************************************************************************
+|*
+|* E3dScene-Konstruktor
+|*
+\************************************************************************/
+
+E3dScene::E3dScene()
+: E3dObject(),
+ aCamera(basegfx::B3DPoint(0.0, 0.0, 4.0), basegfx::B3DPoint()),
+ mp3DDepthRemapper(0L),
+ bDrawOnlySelected(false)
+{
+ // Defaults setzen
+ E3dDefaultAttributes aDefault;
+ SetDefaultAttributes(aDefault);
+}
+
+E3dScene::E3dScene(E3dDefaultAttributes& rDefault)
+: E3dObject(),
+ aCamera(basegfx::B3DPoint(0.0, 0.0, 4.0), basegfx::B3DPoint()),
+ mp3DDepthRemapper(0L),
+ bDrawOnlySelected(false)
+{
+ // Defaults setzen
+ SetDefaultAttributes(rDefault);
+}
+
+void E3dScene::SetDefaultAttributes(E3dDefaultAttributes& /*rDefault*/)
+{
+ // Fuer OS/2 die FP-Exceptions abschalten
+#if defined(OS2)
+#define SC_FPEXCEPTIONS_ON() _control87( MCW_EM, 0 )
+#define SC_FPEXCEPTIONS_OFF() _control87( MCW_EM, MCW_EM )
+ SC_FPEXCEPTIONS_OFF();
+#endif
+
+ // Fuer WIN95/NT die FP-Exceptions abschalten
+#if defined(WNT)
+#define SC_FPEXCEPTIONS_ON() _control87( _MCW_EM, 0 )
+#define SC_FPEXCEPTIONS_OFF() _control87( _MCW_EM, _MCW_EM )
+ SC_FPEXCEPTIONS_OFF();
+#endif
+
+ // Defaults setzen
+ aCamera.SetViewWindow(-2, -2, 4, 4);
+ aCameraSet.SetDeviceRectangle(-2, 2, -2, 2);
+ aCamera.SetDeviceWindow(Rectangle(0, 0, 10, 10));
+ Rectangle aRect(0, 0, 10, 10);
+ aCameraSet.SetViewportRectangle(aRect);
+
+ // set defaults for Camera from ItemPool
+ aCamera.SetProjection(GetPerspective());
+ basegfx::B3DPoint aActualPosition(aCamera.GetPosition());
+ double fNew = GetDistance();
+
+ if(fabs(fNew - aActualPosition.getZ()) > 1.0)
+ {
+ aCamera.SetPosition( basegfx::B3DPoint( aActualPosition.getX(), aActualPosition.getY(), fNew) );
+ }
+
+ fNew = GetFocalLength() / 100.0;
+ aCamera.SetFocalLength(fNew);
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+E3dScene::~E3dScene()
+{
+ // #110988#
+ ImpCleanup3DDepthMapper();
+}
+
+basegfx::B2DPolyPolygon E3dScene::TakeXorPoly() const
+{
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3D(rVCScene.getViewInformation3D());
+ const basegfx::B3DPolyPolygon aCubePolyPolygon(CreateWireframe());
+
+ basegfx::B2DPolyPolygon aRetval(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(aCubePolyPolygon,
+ aViewInfo3D.getObjectToView()));
+ aRetval.transform(rVCScene.getObjectTransformation());
+
+ return aRetval;
+}
+
+// #110988#
+void E3dScene::ImpCleanup3DDepthMapper()
+{
+ if(mp3DDepthRemapper)
+ {
+ delete mp3DDepthRemapper;
+ mp3DDepthRemapper = 0L;
+ }
+}
+
+// #110988#
+sal_uInt32 E3dScene::RemapOrdNum(sal_uInt32 nNewOrdNum) const
+{
+ if(!mp3DDepthRemapper)
+ {
+ const sal_uInt32 nObjCount(GetSubList() ? GetSubList()->GetObjCount() : 0L);
+
+ if(nObjCount > 1L)
+ {
+ ((E3dScene*)this)->mp3DDepthRemapper = new Imp3DDepthRemapper((E3dScene&)(*this));
+ }
+ }
+
+ if(mp3DDepthRemapper)
+ {
+ return mp3DDepthRemapper->RemapOrdNum(nNewOrdNum);
+ }
+
+ return nNewOrdNum;
+}
+
+/*************************************************************************
+|*
+|* Identifier zurueckgeben
+|*
+\************************************************************************/
+
+sal_uInt16 E3dScene::GetObjIdentifier() const
+{
+ return E3D_SCENE_ID;
+}
+
+void E3dScene::SetBoundRectDirty()
+{
+ E3dScene* pScene = GetScene();
+
+ if(pScene == this)
+ {
+ // avoid resetting aOutRect which in case of a 3D scene used as 2d object
+ // is model data,not re-creatable view data
+ }
+ else
+ {
+ // if not the outmost scene it is used as group in 3d, call parent
+ E3dObject::SetBoundRectDirty();
+ }
+}
+
+/*************************************************************************
+|*
+|* SetSnapRect
+|*
+\************************************************************************/
+
+void E3dScene::NbcSetSnapRect(const Rectangle& rRect)
+{
+ SetRectsDirty();
+ E3dObject::NbcSetSnapRect(rRect);
+ aCamera.SetDeviceWindow(rRect);
+ aCameraSet.SetViewportRectangle((Rectangle&)rRect);
+
+ // #110988#
+ ImpCleanup3DDepthMapper();
+}
+
+/*************************************************************************
+|*
+|* Objekt verschieben
+|*
+\************************************************************************/
+
+void E3dScene::NbcMove(const Size& rSize)
+{
+ Rectangle aNewSnapRect = GetSnapRect();
+ MoveRect(aNewSnapRect, rSize);
+ NbcSetSnapRect(aNewSnapRect);
+}
+
+/*************************************************************************
+|*
+|* Objekt Resizen
+|*
+\************************************************************************/
+
+void E3dScene::NbcResize(const Point& rRef, const Fraction& rXFact,
+ const Fraction& rYFact)
+{
+ Rectangle aNewSnapRect = GetSnapRect();
+ ResizeRect(aNewSnapRect, rRef, rXFact, rYFact);
+ NbcSetSnapRect(aNewSnapRect);
+}
+
+/*************************************************************************
+|*
+|* Neue Kamera setzen, und dabei die Szene und ggf. das BoundVolume
+|* als geaendert markieren
+|*
+\************************************************************************/
+
+void E3dScene::SetCamera(const Camera3D& rNewCamera)
+{
+ // Alte Kamera setzen
+ aCamera = rNewCamera;
+ ((sdr::properties::E3dSceneProperties&)GetProperties()).SetSceneItemsFromCamera();
+
+ SetRectsDirty();
+
+ // Neue Kamera aus alter fuellen
+ Camera3D& rCam = (Camera3D&)GetCamera();
+
+ // Ratio abschalten
+ if(rCam.GetAspectMapping() == AS_NO_MAPPING)
+ GetCameraSet().SetRatio(0.0);
+
+ // Abbildungsgeometrie setzen
+ basegfx::B3DPoint aVRP(rCam.GetViewPoint());
+ basegfx::B3DVector aVPN(aVRP - rCam.GetVRP());
+ basegfx::B3DVector aVUV(rCam.GetVUV());
+
+ // #91047# use SetViewportValues() to set VRP, VPN and VUV as vectors, too.
+ // Else these values would not be exported/imported correctly.
+ GetCameraSet().SetViewportValues(aVRP, aVPN, aVUV);
+
+ // Perspektive setzen
+ GetCameraSet().SetPerspective(rCam.GetProjection() == PR_PERSPECTIVE);
+ GetCameraSet().SetViewportRectangle((Rectangle&)rCam.GetDeviceWindow());
+
+ // #110988#
+ ImpCleanup3DDepthMapper();
+}
+
+/*************************************************************************
+|*
+|* 3D-Objekt einfuegen
+|*
+\************************************************************************/
+
+void E3dScene::NewObjectInserted(const E3dObject* p3DObj)
+{
+ E3dObject::NewObjectInserted(p3DObj);
+
+ if ( p3DObj == this )
+ return;
+
+ // #110988#
+ ImpCleanup3DDepthMapper();
+}
+
+/*************************************************************************
+|*
+|* Parent ueber Aenderung eines Childs informieren
+|*
+\************************************************************************/
+
+void E3dScene::StructureChanged()
+{
+ E3dObject::StructureChanged();
+ SetRectsDirty();
+
+ // #110988#
+ ImpCleanup3DDepthMapper();
+}
+
+/*************************************************************************
+|*
+|* Uebergeordnetes Szenenobjekt bestimmen
+|*
+\************************************************************************/
+
+E3dScene* E3dScene::GetScene() const
+{
+ if(GetParentObj())
+ return GetParentObj()->GetScene();
+ else
+ return (E3dScene*)this;
+}
+
+void E3dScene::removeAllNonSelectedObjects()
+{
+ E3DModifySceneSnapRectUpdater aUpdater(this);
+
+ for(sal_uInt32 a(0); a < maSubList.GetObjCount(); a++)
+ {
+ SdrObject* pObj = maSubList.GetObj(a);
+
+ if(pObj)
+ {
+ bool bRemoveObject(false);
+
+ if(pObj->ISA(E3dScene))
+ {
+ E3dScene* pScene = (E3dScene*)pObj;
+
+ // iterate over this sub-scene
+ pScene->removeAllNonSelectedObjects();
+
+ // check object count. Empty scenes can be deleted
+ const sal_uInt32 nObjCount(pScene->GetSubList() ? pScene->GetSubList()->GetObjCount() : 0);
+
+ if(!nObjCount)
+ {
+ // all objects removed, scene can be removed, too
+ bRemoveObject = true;
+ }
+ }
+ else if(pObj->ISA(E3dCompoundObject))
+ {
+ E3dCompoundObject* pCompound = (E3dCompoundObject*)pObj;
+
+ if(!pCompound->GetSelected())
+ {
+ bRemoveObject = true;
+ }
+ }
+
+ if(bRemoveObject)
+ {
+ maSubList.NbcRemoveObject(pObj->GetOrdNum());
+ a--;
+ SdrObject::Free(pObj);
+ }
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Zuweisungsoperator
+|*
+\************************************************************************/
+
+void E3dScene::operator=(const SdrObject& rObj)
+{
+ E3dObject::operator=(rObj);
+
+ const E3dScene& r3DObj = (const E3dScene&) rObj;
+ aCamera = r3DObj.aCamera;
+
+ // neu ab 377:
+ aCameraSet = r3DObj.aCameraSet;
+ ((sdr::properties::E3dSceneProperties&)GetProperties()).SetSceneItemsFromCamera();
+
+ // SetSnapRect(r3DObj.GetSnapRect());
+ InvalidateBoundVolume();
+ RebuildLists();
+ SetRectsDirty();
+
+ // #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();
+}
+
+/*************************************************************************
+|*
+|* Licht- und Labelobjektlisten neu aufbauen (nach Laden, Zuweisung)
+|*
+\************************************************************************/
+
+void E3dScene::RebuildLists()
+{
+ // zuerst loeschen
+ SdrLayerID nCurrLayerID = GetLayer();
+
+ SdrObjListIter a3DIterator(maSubList, IM_FLAT);
+
+ // dann alle Objekte in der Szene pruefen
+ while ( a3DIterator.IsMore() )
+ {
+ E3dObject* p3DObj = (E3dObject*) a3DIterator.Next();
+ p3DObj->NbcSetLayer(nCurrLayerID);
+ NewObjectInserted(p3DObj);
+ }
+}
+
+/*************************************************************************
+|*
+|* erstelle neues GeoData-Objekt
+|*
+\************************************************************************/
+
+SdrObjGeoData *E3dScene::NewGeoData() const
+{
+ return new E3DSceneGeoData;
+}
+
+/*************************************************************************
+|*
+|* uebergebe aktuelle werte an das GeoData-Objekt
+|*
+\************************************************************************/
+
+void E3dScene::SaveGeoData(SdrObjGeoData& rGeo) const
+{
+ E3dObject::SaveGeoData (rGeo);
+
+ ((E3DSceneGeoData &) rGeo).aCamera = aCamera;
+}
+
+/*************************************************************************
+|*
+|* uebernehme werte aus dem GeoData-Objekt
+|*
+\************************************************************************/
+
+void E3dScene::RestGeoData(const SdrObjGeoData& rGeo)
+{
+ // #i94832# removed E3DModifySceneSnapRectUpdater here.
+ // It should not be needed, is already part of E3dObject::RestGeoData
+ E3dObject::RestGeoData (rGeo);
+ SetCamera (((E3DSceneGeoData &) rGeo).aCamera);
+}
+
+/*************************************************************************
+|*
+|* Am StyleSheet wurde etwas geaendert, also Scene aendern
+|*
+\************************************************************************/
+
+void E3dScene::Notify(SfxBroadcaster &rBC, const SfxHint &rHint)
+{
+ SetRectsDirty();
+ E3dObject::Notify(rBC, rHint);
+}
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+void E3dScene::RotateScene (const Point& rRef, long /*nWink*/, double sn, double cs)
+{
+ Point UpperLeft, LowerRight, Center, NewCenter;
+
+ UpperLeft = aOutRect.TopLeft();
+ LowerRight = aOutRect.BottomRight();
+
+ long dxOutRectHalf = labs(UpperLeft.X() - LowerRight.X());
+ dxOutRectHalf /= 2;
+ long dyOutRectHalf = labs(UpperLeft.Y() - LowerRight.Y());
+ dyOutRectHalf /= 2;
+
+ Rectangle RectQuelle(aOutRect), RectZiel(aOutRect);
+
+ // Nur der Mittelpunkt wird bewegt. Die Ecken werden von NbcMove bewegt.
+ // Fuer das Drehen wird von mir ein kartesisches Koordinatensystem verwendet in dem der Drehpunkt
+ // der Nullpunkt ist und die Y- Achse nach oben ansteigt, die X-Achse nach rechts.
+ // Dies muss bei den Y-Werten beachtet werden. (Auf dem Blatt zeigt die Y-Achse nach unten
+ Center.X() = (UpperLeft.X() + dxOutRectHalf) - rRef.X();
+ Center.Y() = -((UpperLeft.Y() + dyOutRectHalf) - rRef.Y());
+ // Ein paar Spezialfaelle zuerst abhandeln (n*90 Grad n ganzzahlig)
+ if (sn==1.0 && cs==0.0) { // 90deg
+ NewCenter.X() = -Center.Y();
+ NewCenter.Y() = -Center.X();
+ } else if (sn==0.0 && cs==-1.0) { // 180deg
+ NewCenter.X() = -Center.X();
+ NewCenter.Y() = -Center.Y();
+ } else if (sn==-1.0 && cs==0.0) { // 270deg
+ NewCenter.X() = Center.Y();
+ NewCenter.Y() = -Center.X();
+ }
+ else // Hier wird um einen beliebigen Winkel in mathematisch positiver Richtung gedreht!
+ { // xneu = x * cos(alpha) - y * sin(alpha)
+ // yneu = x * sin(alpha) + y * cos(alpha)
+ // Unten Rechts wird nicht gedreht: die Seiten von RectQuelle muessen parallel
+ // zu den Koordinatenachsen bleiben.
+ NewCenter.X() = (long) (Center.X() * cs - Center.Y() * sn);
+ NewCenter.Y() = (long) (Center.X() * sn + Center.Y() * cs);
+ }
+
+ Size Differenz;
+ Point DiffPoint = (NewCenter - Center);
+ Differenz.Width() = DiffPoint.X();
+ Differenz.Height() = -DiffPoint.Y(); // Man beachte dass die Y-Achse nach unten positiv gezaehlt wird.
+ NbcMove (Differenz); // fuehrt die eigentliche Koordinatentransformation durch.
+}
+
+/*************************************************************************
+|*
+|* Get the name of the object (singular)
+|*
+\************************************************************************/
+
+void E3dScene::TakeObjNameSingul(XubString& rName) const
+{
+ rName=ImpGetResStr(STR_ObjNameSingulScene3d);
+
+ String aName( GetName() );
+ if(aName.Len())
+ {
+ rName += sal_Unicode(' ');
+ rName += sal_Unicode('\'');
+ rName += aName;
+ rName += sal_Unicode('\'');
+ }
+}
+
+/*************************************************************************
+|*
+|* Get the name of the object (plural)
+|*
+\************************************************************************/
+
+void E3dScene::TakeObjNamePlural(XubString& rName) const
+{
+ rName=ImpGetResStr(STR_ObjNamePluralScene3d);
+}
+
+/*************************************************************************
+|*
+|* Die NbcRotate-Routine ueberlaedt die des SdrObject. Die Idee ist die Scene
+|* drehen zu koennen und relativ zur Lage der Scene dann auch die Objekte
+|* in der Scene
+|*
+\************************************************************************/
+
+void E3dScene::NbcSetTransform(const basegfx::B3DHomMatrix& rMatrix)
+{
+ if(maTransformation != rMatrix)
+ {
+ // call parent
+ E3dObject::NbcSetTransform(rMatrix);
+ }
+}
+
+void E3dScene::SetTransform(const basegfx::B3DHomMatrix& rMatrix)
+{
+ if(rMatrix != maTransformation)
+ {
+ // call parent
+ E3dObject::SetTransform(rMatrix);
+ }
+}
+
+void E3dScene::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
+{
+ // Also derzeit sind die Klebepunkte relativ zum aOutRect der Szene definiert. Vor dem Drehen
+ // werden die Klebepunkte relativ zur Seite definiert. Sie nehmen an der Drehung der Szene noch nicht Teil
+ // dafuer gibt es den
+ SetGlueReallyAbsolute(sal_True);
+
+ // So dass war die Szene, ab jetzt kommen die Objekte in der Szene
+ // 3D-Objekte gibt es nur ein einziges das kann zwar mehrere Flaechen haben aber die Flaechen
+ // muessen ja nicht zusammenhaengend sein
+ // es ermoeglicht den Zugriff auf Kindobjekte
+ // Ich gehe also die gesamte Liste durch und rotiere um die Z-Achse die durch den
+ // Mittelpunkt von aOutRect geht (Satz von Steiner), also RotateZ
+
+ RotateScene (rRef, nWink, sn, cs); // Rotiert die Szene
+ double fWinkelInRad = nWink/100 * F_PI180;
+
+ basegfx::B3DHomMatrix aRotation;
+ aRotation.rotate(0.0, 0.0, fWinkelInRad);
+ NbcSetTransform(aRotation * GetTransform());
+
+ SetRectsDirty(); // Veranlasst eine Neuberechnung aller BoundRects
+ NbcRotateGluePoints(rRef,nWink,sn,cs); // Rotiert die Klebepunkte (die haben noch Koordinaten relativ
+ // zum Urpsung des Blattes
+ SetGlueReallyAbsolute(sal_False); // ab jetzt sind sie wieder relativ zum BoundRect (also dem aOutRect definiert)
+ SetRectsDirty();
+}
+
+/*************************************************************************
+|*
+|* SnapRect berechnen
+|*
+\************************************************************************/
+
+void E3dScene::RecalcSnapRect()
+{
+ E3dScene* pScene = GetScene();
+
+ if(pScene == this)
+ {
+ // Szene wird als 2D-Objekt benutzt, nimm SnapRect aus der
+ // 2D Bildschrimdarstellung
+ Camera3D& rCam = (Camera3D&)pScene->GetCamera();
+ maSnapRect = rCam.GetDeviceWindow();
+ }
+ else
+ {
+ // Szene ist selbst Mitglied einer anderen Szene, hole das
+ // SnapRect als zusammengesetztes Objekt
+ E3dObject::RecalcSnapRect();
+ }
+}
+
+/*************************************************************************
+|*
+|* Aufbrechen
+|*
+\************************************************************************/
+
+sal_Bool E3dScene::IsBreakObjPossible()
+{
+ // Szene ist aufzubrechen, wenn alle Mitglieder aufzubrechen sind
+ SdrObjListIter a3DIterator(maSubList, IM_DEEPWITHGROUPS);
+
+ while ( a3DIterator.IsMore() )
+ {
+ E3dObject* pObj = (E3dObject*) a3DIterator.Next();
+ DBG_ASSERT(pObj->ISA(E3dObject), "AW: In Szenen sind nur 3D-Objekte erlaubt!");
+ if(!pObj->IsBreakObjPossible())
+ return sal_False;
+ }
+
+ return sal_True;
+}
+
+basegfx::B3DVector E3dScene::GetShadowPlaneDirection() const
+{
+ double fWink = (double)GetShadowSlant() * F_PI180;
+ basegfx::B3DVector aShadowPlaneDir(0.0, sin(fWink), cos(fWink));
+ aShadowPlaneDir.normalize();
+ return aShadowPlaneDir;
+}
+
+void E3dScene::SetShadowPlaneDirection(const basegfx::B3DVector& rVec)
+{
+ sal_uInt16 nSceneShadowSlant = (sal_uInt16)((atan2(rVec.getY(), rVec.getZ()) / F_PI180) + 0.5);
+ GetProperties().SetObjectItemDirect(Svx3DShadowSlantItem(nSceneShadowSlant));
+}
+
+basegfx::B2DPolyPolygon E3dScene::TakeCreatePoly(const SdrDragStat& /*rDrag*/) const
+{
+ return TakeXorPoly();
+}
+
+FASTBOOL E3dScene::BegCreate(SdrDragStat& rStat)
+{
+ rStat.SetOrtho4Possible();
+ Rectangle aRect1(rStat.GetStart(), rStat.GetNow());
+ aRect1.Justify();
+ rStat.SetActionRect(aRect1);
+ NbcSetSnapRect(aRect1);
+ return sal_True;
+}
+
+FASTBOOL E3dScene::MovCreate(SdrDragStat& rStat)
+{
+ Rectangle aRect1;
+ rStat.TakeCreateRect(aRect1);
+ aRect1.Justify();
+ rStat.SetActionRect(aRect1);
+ NbcSetSnapRect(aRect1);
+ SetBoundRectDirty();
+ bSnapRectDirty=sal_True;
+ return sal_True;
+}
+
+FASTBOOL E3dScene::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
+{
+ Rectangle aRect1;
+ rStat.TakeCreateRect(aRect1);
+ aRect1.Justify();
+ NbcSetSnapRect(aRect1);
+ SetRectsDirty();
+ return (eCmd==SDRCREATE_FORCEEND || rStat.GetPointAnz()>=2);
+}
+
+FASTBOOL E3dScene::BckCreate(SdrDragStat& /*rStat*/)
+{
+ return sal_False;
+}
+
+void E3dScene::BrkCreate(SdrDragStat& /*rStat*/)
+{
+}
+
+// eof
diff --git a/svx/source/engine3d/sphere3d.cxx b/svx/source/engine3d/sphere3d.cxx
new file mode 100644
index 000000000000..2c1d4ea0480f
--- /dev/null
+++ b/svx/source/engine3d/sphere3d.cxx
@@ -0,0 +1,226 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svx/svdstr.hrc"
+#include "svx/svdglob.hxx"
+#include <svx/svdmodel.hxx>
+#include <svx/svdpage.hxx>
+#include "svx/globl3d.hxx"
+#include <svx/sphere3d.hxx>
+
+#include <svx/svxids.hrc>
+#include <svx/svx3ditems.hxx>
+#include <svx/sdr/properties/e3dsphereproperties.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+#include <basegfx/point/b3dpoint.hxx>
+#include <svx/sdr/contact/viewcontactofe3dsphere.hxx>
+#include <basegfx/polygon/b3dpolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// #110094# DrawContact section
+
+sdr::contact::ViewContact* E3dSphereObj::CreateObjectSpecificViewContact()
+{
+ return new sdr::contact::ViewContactOfE3dSphere(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+sdr::properties::BaseProperties* E3dSphereObj::CreateObjectSpecificProperties()
+{
+ return new sdr::properties::E3dSphereProperties(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(E3dSphereObj, E3dCompoundObject);
+
+/*************************************************************************
+|*
+|* Kugel aus Polygonfacetten nach Laengen und Breitengrad aufbauen
+|*
+\************************************************************************/
+
+E3dSphereObj::E3dSphereObj(E3dDefaultAttributes& rDefault, const basegfx::B3DPoint& rCenter, const basegfx::B3DVector& r3DSize)
+: E3dCompoundObject(rDefault)
+{
+ // Defaults setzen
+ SetDefaultAttributes(rDefault);
+
+ // Uebergebene drueberbuegeln
+ aCenter = rCenter;
+ aSize = r3DSize;
+}
+
+E3dSphereObj::E3dSphereObj()
+: E3dCompoundObject()
+{
+ // Defaults setzen
+ E3dDefaultAttributes aDefault;
+ SetDefaultAttributes(aDefault);
+}
+
+/*************************************************************************
+|*
+|* Kugel erzeugen ohne die Polygone darin zu erzeugen
+|*
+\************************************************************************/
+
+// FG: Dieser Aufruf erfolgt von der 3D-Object Factory (objfac3d.cxx) und zwar ausschliesslich beim
+// laden von Dokumenten. Hier braucht man keinen CreateSphere-Aufruf, denn die wirkliche
+// Anzahl Segmente ist ja noch nicht bekannt. Dies war bis zum 10.2.97 ein (kleines)
+// Speicherleck.
+E3dSphereObj::E3dSphereObj(int /*dummy*/) // den Parameter braucht es um unterscheiden zu koennen, welcher
+{ // der beiden Konstruktoren gemeint ist. Der obige halt per Default
+ // Defaults setzen
+ E3dDefaultAttributes aDefault;
+ SetDefaultAttributes(aDefault);
+}
+
+void E3dSphereObj::SetDefaultAttributes(E3dDefaultAttributes& rDefault)
+{
+ // Defaults setzen
+ aCenter = rDefault.GetDefaultSphereCenter();
+ aSize = rDefault.GetDefaultSphereSize();
+}
+
+/*************************************************************************
+|*
+|* Identifier zurueckgeben
+|*
+\************************************************************************/
+
+sal_uInt16 E3dSphereObj::GetObjIdentifier() const
+{
+ return E3D_SPHEREOBJ_ID;
+}
+
+/*************************************************************************
+|*
+|* Wandle das Objekt in ein Gruppenobjekt bestehend aus n Polygonen
+|*
+\************************************************************************/
+
+SdrObject *E3dSphereObj::DoConvertToPolyObj(sal_Bool /*bBezier*/) const
+{
+ return NULL;
+}
+
+/*************************************************************************
+|*
+|* Leer-Konstruktor
+|*
+\************************************************************************/
+
+void E3dSphereObj::ReSegment(sal_uInt32 nHSegs, sal_uInt32 nVSegs)
+{
+ if((nHSegs != GetHorizontalSegments() || nVSegs != GetVerticalSegments()) && (nHSegs != 0 || nVSegs != 0))
+ {
+ GetProperties().SetObjectItemDirect(Svx3DHorizontalSegmentsItem(nHSegs));
+ GetProperties().SetObjectItemDirect(Svx3DVerticalSegmentsItem(nVSegs));
+
+ ActionChanged();
+ }
+}
+
+/*************************************************************************
+|*
+|* Zuweisungsoperator
+|*
+\************************************************************************/
+
+void E3dSphereObj::operator=(const SdrObject& rObj)
+{
+ // erstmal alle Childs kopieren
+ E3dCompoundObject::operator=(rObj);
+
+ // weitere Parameter kopieren
+ const E3dSphereObj& r3DObj = (const E3dSphereObj&) rObj;
+
+ aCenter = r3DObj.aCenter;
+ aSize = r3DObj.aSize;
+}
+
+/*************************************************************************
+|*
+|* Lokale Parameter setzen mit Geometrieneuerzeugung
+|*
+\************************************************************************/
+
+void E3dSphereObj::SetCenter(const basegfx::B3DPoint& rNew)
+{
+ if(aCenter != rNew)
+ {
+ aCenter = rNew;
+ ActionChanged();
+ }
+}
+
+void E3dSphereObj::SetSize(const basegfx::B3DVector& rNew)
+{
+ if(aSize != rNew)
+ {
+ aSize = rNew;
+ ActionChanged();
+ }
+}
+
+/*************************************************************************
+|*
+|* Get the name of the object (singular)
+|*
+\************************************************************************/
+
+void E3dSphereObj::TakeObjNameSingul(XubString& rName) const
+{
+ rName=ImpGetResStr(STR_ObjNameSingulSphere3d);
+
+ String aName( GetName() );
+ if(aName.Len())
+ {
+ rName += sal_Unicode(' ');
+ rName += sal_Unicode('\'');
+ rName += aName;
+ rName += sal_Unicode('\'');
+ }
+}
+
+/*************************************************************************
+|*
+|* Get the name of the object (plural)
+|*
+\************************************************************************/
+
+void E3dSphereObj::TakeObjNamePlural(XubString& rName) const
+{
+ rName=ImpGetResStr(STR_ObjNamePluralSphere3d);
+}
+
+// eof
diff --git a/svx/source/engine3d/string3d.src b/svx/source/engine3d/string3d.src
new file mode 100644
index 000000000000..24b0592730ab
--- /dev/null
+++ b/svx/source/engine3d/string3d.src
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ------------------------------------------------------------------
+#include <svx/dialogs.hrc>
+ // pragma -------------------------------------------------------------------
+
+ // Strings fuer die Draw-Dialoge --------------------------------------------
+String RID_SVX_3D_CREATE_LATHE
+{
+ Text [ en-US ] = "Create 3D rotation object" ;
+};
+String RID_SVX_3D_UNDO_EXCHANGE_PASTE
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Objekt(e) einfügen : Objekt(e) einf³gen */
+ /* ### ACHTUNG: Neuer Text in Resource? Objekt(e) einfügen : Objekt(e) einf³gen */
+ Text [ en-US ] = "Insert object(s)" ;
+};
+String RID_SVX_3D_UNDO_SEGMENTS
+{
+ Text [ en-US ] = "Number of segments" ;
+};
+String RID_SVX_3D_UNDO_DEEPTH
+{
+ Text [ en-US ] = "Object depth" ;
+};
+String RID_SVX_3D_UNDO_FOCAL
+{
+ Text [ en-US ] = "Focal length" ;
+};
+String RID_SVX_3D_UNDO_CAMPOS
+{
+ Text [ en-US ] = "Camera position" ;
+};
+String RID_SVX_3D_UNDO_ROTATE
+{
+ Text [ en-US ] = "Rotate 3D object" ;
+};
+String RID_SVX_3D_UNDO_EXTRUDE
+{
+ Text [ en-US ] = "Create extrusion object" ;
+};
+String RID_SVX_3D_UNDO_LATHE
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Rotationskörper erstellen : Rotationsk÷rper erstellen */
+ /* ### ACHTUNG: Neuer Text in Resource? Rotationskörper erstellen : Rotationsk÷rper erstellen */
+ Text [ en-US ] = "Create rotation object" ;
+};
+String RID_SVX_3D_UNDO_BREAK_LATHE
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Rotationskörper aufbrechen : Rotationsk÷rper aufbrechen */
+ /* ### ACHTUNG: Neuer Text in Resource? Rotationskörper aufbrechen : Rotationsk÷rper aufbrechen */
+ Text [ en-US ] = "Split 3D object" ;
+};
+String RID_SVX_3D_UNDO_ATTRIBUTES
+{
+ Text [ en-US ] = "3D Attributes" ;
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/engine3d/svx3ditems.cxx b/svx/source/engine3d/svx3ditems.cxx
new file mode 100644
index 000000000000..ef108bb902ae
--- /dev/null
+++ b/svx/source/engine3d/svx3ditems.cxx
@@ -0,0 +1,547 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/svx3ditems.hxx>
+#include <com/sun/star/drawing/NormalsKind.hpp>
+#include <com/sun/star/drawing/TextureProjectionMode.hpp>
+#include <com/sun/star/drawing/TextureKind.hpp>
+#include <com/sun/star/drawing/TextureMode.hpp>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <com/sun/star/drawing/ShadeMode.hpp>
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+Svx3DPercentDiagonalItem::Svx3DPercentDiagonalItem(sal_uInt16 nVal)
+: SfxUInt16Item(SDRATTR_3DOBJ_PERCENT_DIAGONAL, nVal)
+{}
+
+Svx3DBackscaleItem::Svx3DBackscaleItem(sal_uInt16 nVal)
+: SfxUInt16Item(SDRATTR_3DOBJ_BACKSCALE, nVal)
+{}
+
+Svx3DDepthItem::Svx3DDepthItem(sal_uInt32 nVal)
+: SfxUInt32Item(SDRATTR_3DOBJ_DEPTH, nVal)
+{}
+
+Svx3DHorizontalSegmentsItem::Svx3DHorizontalSegmentsItem(sal_uInt32 nVal)
+: SfxUInt32Item(SDRATTR_3DOBJ_HORZ_SEGS, nVal)
+{}
+
+Svx3DVerticalSegmentsItem::Svx3DVerticalSegmentsItem(sal_uInt32 nVal)
+: SfxUInt32Item(SDRATTR_3DOBJ_VERT_SEGS, nVal)
+{}
+
+Svx3DEndAngleItem::Svx3DEndAngleItem(sal_uInt32 nVal)
+: SfxUInt32Item(SDRATTR_3DOBJ_END_ANGLE, nVal)
+{}
+
+Svx3DDoubleSidedItem::Svx3DDoubleSidedItem(sal_Bool bVal)
+: SfxBoolItem(SDRATTR_3DOBJ_DOUBLE_SIDED, bVal)
+{}
+
+//////////////////////////////////////////////////////////////////////////////
+// #i28528#
+// Added extra Item (Bool) for chart2 to be able to show reduced line geometry
+
+Svx3DReducedLineGeometryItem::Svx3DReducedLineGeometryItem(sal_Bool bVal)
+: SfxBoolItem(SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY, bVal)
+{}
+
+sal_uInt16 Svx3DReducedLineGeometryItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const
+{
+ return 1;
+}
+
+SfxPoolItem* Svx3DReducedLineGeometryItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const
+{
+ SfxBoolItem* pRetval = new Svx3DReducedLineGeometryItem();
+
+ if(nItemVersion > 0)
+ {
+ SfxBoolItem aBoolItem(Which(), rIn);
+ pRetval->SetValue(aBoolItem.GetValue());
+ }
+
+ return pRetval;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+Svx3DNormalsKindItem::Svx3DNormalsKindItem(sal_uInt16 nVal)
+: SfxUInt16Item(SDRATTR_3DOBJ_NORMALS_KIND, nVal)
+{}
+
+Svx3DNormalsInvertItem::Svx3DNormalsInvertItem(sal_Bool bVal)
+: SfxBoolItem(SDRATTR_3DOBJ_NORMALS_INVERT, bVal)
+{}
+
+Svx3DTextureProjectionXItem::Svx3DTextureProjectionXItem(sal_uInt16 nVal)
+: SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_PROJ_X, nVal)
+{}
+
+Svx3DTextureProjectionYItem::Svx3DTextureProjectionYItem(sal_uInt16 nVal)
+: SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_PROJ_Y, nVal)
+{}
+
+Svx3DShadow3DItem::Svx3DShadow3DItem(sal_Bool bVal)
+: SfxBoolItem(SDRATTR_3DOBJ_SHADOW_3D, bVal)
+{}
+
+Svx3DMaterialColorItem::Svx3DMaterialColorItem(const Color& rCol)
+: SvxColorItem(rCol, SDRATTR_3DOBJ_MAT_COLOR)
+{}
+
+Svx3DMaterialEmissionItem::Svx3DMaterialEmissionItem(const Color& rCol)
+: SvxColorItem(rCol, SDRATTR_3DOBJ_MAT_EMISSION)
+{}
+
+Svx3DMaterialSpecularItem::Svx3DMaterialSpecularItem(const Color& rCol)
+: SvxColorItem(rCol, SDRATTR_3DOBJ_MAT_SPECULAR)
+{}
+
+Svx3DMaterialSpecularIntensityItem::Svx3DMaterialSpecularIntensityItem(sal_uInt16 nVal)
+: SfxUInt16Item(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY, nVal)
+{}
+
+Svx3DTextureKindItem::Svx3DTextureKindItem(sal_uInt16 nVal)
+: SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_KIND, nVal)
+{}
+
+Svx3DTextureModeItem::Svx3DTextureModeItem(sal_uInt16 nVal)
+: SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_MODE, nVal)
+{}
+
+Svx3DTextureFilterItem::Svx3DTextureFilterItem(sal_Bool bVal)
+: SfxBoolItem(SDRATTR_3DOBJ_TEXTURE_FILTER, bVal)
+{}
+
+Svx3DPerspectiveItem::Svx3DPerspectiveItem(sal_uInt16 nVal)
+: SfxUInt16Item(SDRATTR_3DSCENE_PERSPECTIVE, nVal)
+{}
+
+Svx3DDistanceItem::Svx3DDistanceItem(sal_uInt32 nVal)
+: SfxUInt32Item(SDRATTR_3DSCENE_DISTANCE, nVal)
+{}
+
+Svx3DFocalLengthItem::Svx3DFocalLengthItem(sal_uInt32 nVal)
+: SfxUInt32Item(SDRATTR_3DSCENE_FOCAL_LENGTH, nVal)
+{}
+
+Svx3DTwoSidedLightingItem::Svx3DTwoSidedLightingItem(sal_Bool bVal)
+: SfxBoolItem(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING, bVal)
+{}
+
+Svx3DLightcolor1Item::Svx3DLightcolor1Item(const Color& rCol)
+: SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_1)
+{}
+
+Svx3DLightcolor2Item::Svx3DLightcolor2Item(const Color& rCol)
+: SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_2)
+{}
+
+Svx3DLightcolor3Item::Svx3DLightcolor3Item(const Color& rCol)
+: SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_3)
+{}
+
+Svx3DLightcolor4Item::Svx3DLightcolor4Item(const Color& rCol)
+: SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_4)
+{}
+
+Svx3DLightcolor5Item::Svx3DLightcolor5Item(const Color& rCol)
+: SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_5)
+{}
+
+Svx3DLightcolor6Item::Svx3DLightcolor6Item(const Color& rCol)
+: SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_6)
+{}
+
+Svx3DLightcolor7Item::Svx3DLightcolor7Item(const Color& rCol)
+: SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_7)
+{}
+
+Svx3DLightcolor8Item::Svx3DLightcolor8Item(const Color& rCol)
+: SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_8)
+{}
+
+Svx3DAmbientcolorItem::Svx3DAmbientcolorItem(const Color& rCol)
+: SvxColorItem(rCol, SDRATTR_3DSCENE_AMBIENTCOLOR)
+{}
+
+Svx3DLightOnOff1Item::Svx3DLightOnOff1Item(sal_Bool bVal)
+: SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_1, bVal)
+{}
+
+Svx3DLightOnOff2Item::Svx3DLightOnOff2Item(sal_Bool bVal)
+: SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_2, bVal)
+{}
+
+Svx3DLightOnOff3Item::Svx3DLightOnOff3Item(sal_Bool bVal)
+: SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_3, bVal)
+{}
+
+Svx3DLightOnOff4Item::Svx3DLightOnOff4Item(sal_Bool bVal)
+: SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_4, bVal)
+{}
+
+Svx3DLightOnOff5Item::Svx3DLightOnOff5Item(sal_Bool bVal)
+: SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_5, bVal)
+{}
+
+Svx3DLightOnOff6Item::Svx3DLightOnOff6Item(sal_Bool bVal)
+: SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_6, bVal)
+{}
+
+Svx3DLightOnOff7Item::Svx3DLightOnOff7Item(sal_Bool bVal)
+: SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_7, bVal)
+{}
+
+Svx3DLightOnOff8Item::Svx3DLightOnOff8Item(sal_Bool bVal)
+: SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_8, bVal)
+{}
+
+Svx3DLightDirection1Item::Svx3DLightDirection1Item(const basegfx::B3DVector& rVec)
+: SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_1, rVec)
+{}
+
+Svx3DLightDirection2Item::Svx3DLightDirection2Item(const basegfx::B3DVector& rVec)
+: SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_2, rVec)
+{}
+
+Svx3DLightDirection3Item::Svx3DLightDirection3Item(const basegfx::B3DVector& rVec)
+: SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_3, rVec)
+{}
+
+Svx3DLightDirection4Item::Svx3DLightDirection4Item(const basegfx::B3DVector& rVec)
+: SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_4, rVec)
+{}
+
+Svx3DLightDirection5Item::Svx3DLightDirection5Item(const basegfx::B3DVector& rVec)
+: SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_5, rVec)
+{}
+
+Svx3DLightDirection6Item::Svx3DLightDirection6Item(const basegfx::B3DVector& rVec)
+: SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_6, rVec)
+{}
+
+Svx3DLightDirection7Item::Svx3DLightDirection7Item(const basegfx::B3DVector& rVec)
+: SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_7, rVec)
+{}
+
+Svx3DLightDirection8Item::Svx3DLightDirection8Item(const basegfx::B3DVector& rVec)
+: SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_8, rVec)
+{}
+
+Svx3DShadowSlantItem::Svx3DShadowSlantItem(sal_uInt16 nVal)
+: SfxUInt16Item(SDRATTR_3DSCENE_SHADOW_SLANT, nVal)
+{}
+
+Svx3DShadeModeItem::Svx3DShadeModeItem(sal_uInt16 nVal)
+: SfxUInt16Item(SDRATTR_3DSCENE_SHADE_MODE, nVal)
+{}
+
+//////////////////////////////////////////////////////////////////////////////
+// #107245#
+
+Svx3DSmoothNormalsItem::Svx3DSmoothNormalsItem(sal_Bool bVal)
+: SfxBoolItem(SDRATTR_3DOBJ_SMOOTH_NORMALS, bVal)
+{}
+
+sal_uInt16 Svx3DSmoothNormalsItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const
+{
+ return 1;
+}
+
+SfxPoolItem* Svx3DSmoothNormalsItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const
+{
+ SfxBoolItem* pRetval = new Svx3DSmoothNormalsItem();
+
+ if(nItemVersion > 0)
+ {
+ SfxBoolItem aBoolItem(Which(), rIn);
+ pRetval->SetValue(aBoolItem.GetValue());
+ }
+
+ return pRetval;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// #107245#
+
+Svx3DSmoothLidsItem::Svx3DSmoothLidsItem(sal_Bool bVal)
+: SfxBoolItem(SDRATTR_3DOBJ_SMOOTH_LIDS, bVal)
+{}
+
+sal_uInt16 Svx3DSmoothLidsItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const
+{
+ return 1;
+}
+
+SfxPoolItem* Svx3DSmoothLidsItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const
+{
+ SfxBoolItem* pRetval = new Svx3DSmoothLidsItem();
+
+ if(nItemVersion > 0)
+ {
+ SfxBoolItem aBoolItem(Which(), rIn);
+ pRetval->SetValue(aBoolItem.GetValue());
+ }
+
+ return pRetval;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// #107245#
+
+Svx3DCharacterModeItem::Svx3DCharacterModeItem(sal_Bool bVal)
+: SfxBoolItem(SDRATTR_3DOBJ_CHARACTER_MODE, bVal)
+{}
+
+sal_uInt16 Svx3DCharacterModeItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const
+{
+ return 1;
+}
+
+SfxPoolItem* Svx3DCharacterModeItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const
+{
+ SfxBoolItem* pRetval = new Svx3DCharacterModeItem();
+
+ if(nItemVersion > 0)
+ {
+ SfxBoolItem aBoolItem(Which(), rIn);
+ pRetval->SetValue(aBoolItem.GetValue());
+ }
+
+ return pRetval;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// #107245#
+
+Svx3DCloseFrontItem::Svx3DCloseFrontItem(sal_Bool bVal)
+: SfxBoolItem(SDRATTR_3DOBJ_CLOSE_FRONT, bVal)
+{}
+
+sal_uInt16 Svx3DCloseFrontItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const
+{
+ return 1;
+}
+
+SfxPoolItem* Svx3DCloseFrontItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const
+{
+ SfxBoolItem* pRetval = new Svx3DCloseFrontItem();
+
+ if(nItemVersion > 0)
+ {
+ SfxBoolItem aBoolItem(Which(), rIn);
+ pRetval->SetValue(aBoolItem.GetValue());
+ }
+
+ return pRetval;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// #107245#
+
+Svx3DCloseBackItem::Svx3DCloseBackItem(sal_Bool bVal)
+: SfxBoolItem(SDRATTR_3DOBJ_CLOSE_BACK, bVal)
+{}
+
+sal_uInt16 Svx3DCloseBackItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const
+{
+ return 1;
+}
+
+SfxPoolItem* Svx3DCloseBackItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const
+{
+ SfxBoolItem* pRetval = new Svx3DCloseBackItem();
+
+ if(nItemVersion > 0)
+ {
+ SfxBoolItem aBoolItem(Which(), rIn);
+ pRetval->SetValue(aBoolItem.GetValue());
+ }
+
+ return pRetval;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// Svx3DNormalsKindItem: use drawing::NormalsKind
+sal_Bool Svx3DNormalsKindItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (drawing::NormalsKind)GetValue();
+ return sal_True;
+}
+
+sal_Bool Svx3DNormalsKindItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ drawing::NormalsKind eVar;
+ if(!(rVal >>= eVar))
+ return sal_False;
+ SetValue((sal_Int16)eVar);
+ return sal_True;
+}
+
+SfxPoolItem* Svx3DNormalsKindItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new Svx3DNormalsKindItem(*this);
+}
+
+// Svx3DTextureProjectionXItem: use drawing::TextureProjectionMode
+sal_Bool Svx3DTextureProjectionXItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (drawing::TextureProjectionMode)GetValue();
+ return sal_True;
+}
+
+sal_Bool Svx3DTextureProjectionXItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ drawing::TextureProjectionMode eVar;
+ if(!(rVal >>= eVar))
+ return sal_False;
+ SetValue((sal_Int16)eVar);
+ return sal_True;
+}
+
+SfxPoolItem* Svx3DTextureProjectionXItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new Svx3DTextureProjectionXItem(*this);
+}
+
+// Svx3DTextureProjectionYItem: use drawing::TextureProjectionMode
+sal_Bool Svx3DTextureProjectionYItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (drawing::TextureProjectionMode)GetValue();
+ return sal_True;
+}
+
+sal_Bool Svx3DTextureProjectionYItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ drawing::TextureProjectionMode eVar;
+ if(!(rVal >>= eVar))
+ return sal_False;
+ SetValue((sal_Int16)eVar);
+ return sal_True;
+}
+
+SfxPoolItem* Svx3DTextureProjectionYItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new Svx3DTextureProjectionYItem(*this);
+}
+
+// Svx3DTextureKindItem: use drawing::TextureKind
+sal_Bool Svx3DTextureKindItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (drawing::TextureKind)GetValue();
+ return sal_True;
+}
+
+sal_Bool Svx3DTextureKindItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ drawing::TextureKind eVar;
+ if(!(rVal >>= eVar))
+ return sal_False;
+ SetValue((sal_Int16)eVar);
+ return sal_True;
+}
+
+SfxPoolItem* Svx3DTextureKindItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new Svx3DTextureKindItem(*this);
+}
+
+// Svx3DTextureModeItem: use drawing:TextureMode
+sal_Bool Svx3DTextureModeItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (drawing::TextureMode)GetValue();
+ return sal_True;
+}
+
+sal_Bool Svx3DTextureModeItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ drawing::TextureMode eVar;
+ if(!(rVal >>= eVar))
+ return sal_False;
+ SetValue((sal_Int16)eVar);
+ return sal_True;
+}
+
+SfxPoolItem* Svx3DTextureModeItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new Svx3DTextureModeItem(*this);
+}
+
+// Svx3DPerspectiveItem: use drawing::ProjectionMode
+sal_Bool Svx3DPerspectiveItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (drawing::ProjectionMode)GetValue();
+ return sal_True;
+}
+
+sal_Bool Svx3DPerspectiveItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ drawing::ProjectionMode eVar;
+ if(!(rVal >>= eVar))
+ return sal_False;
+ SetValue((sal_Int16)eVar);
+ return sal_True;
+}
+
+SfxPoolItem* Svx3DPerspectiveItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new Svx3DPerspectiveItem(*this);
+}
+
+// Svx3DShadeModeItem: use drawing::ShadeMode
+sal_Bool Svx3DShadeModeItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (drawing::ShadeMode)GetValue();
+ return sal_True;
+}
+
+sal_Bool Svx3DShadeModeItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ drawing::ShadeMode eVar;
+ if(!(rVal >>= eVar))
+ return sal_False;
+ SetValue((sal_Int16)eVar);
+ return sal_True;
+}
+
+SfxPoolItem* Svx3DShadeModeItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new Svx3DShadeModeItem(*this);
+}
+
+// EOF
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx
new file mode 100644
index 000000000000..9d54fe3882e3
--- /dev/null
+++ b/svx/source/engine3d/view3d.cxx
@@ -0,0 +1,1927 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <vcl/wrkwin.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdopath.hxx>
+#include <tools/shl.hxx>
+#include "svx/svditer.hxx"
+#include <svx/svdpool.hxx>
+#include <svx/svdorect.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svxids.hrc>
+#include <editeng/colritem.hxx>
+#include <svx/xtable.hxx>
+#include <svx/svdview.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include "svx/globl3d.hxx"
+#include <svx/obj3d.hxx>
+#include <svx/lathe3d.hxx>
+#include <svx/sphere3d.hxx>
+#include <svx/extrud3d.hxx>
+#include <svx/cube3d.hxx>
+#include <svx/polysc3d.hxx>
+#include "dragmt3d.hxx"
+#include <svx/view3d.hxx>
+#include <svx/svdundo.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/xbtmpit.hxx>
+#include <svx/xflbmtit.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svx/sdr/overlay/overlaypolypolygon.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <svx/sdrpaintwindow.hxx>
+#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+#include <svx/sdrpagewindow.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/sdr/contact/objectcontact.hxx>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
+#include <svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx>
+#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
+
+#define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
+
+TYPEINIT1(E3dView, SdrView);
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Migrate Marking
+
+class Impl3DMirrorConstructOverlay
+{
+ // The OverlayObjects
+ ::sdr::overlay::OverlayObjectList maObjects;
+
+ // the view
+ const E3dView& mrView;
+
+ // the object count
+ sal_uInt32 mnCount;
+
+ // the unmirrored polygons
+ basegfx::B2DPolyPolygon* mpPolygons;
+
+ // the overlay geometry from selected objects
+ drawinglayer::primitive2d::Primitive2DSequence maFullOverlay;
+
+public:
+ Impl3DMirrorConstructOverlay(const E3dView& rView);
+ ~Impl3DMirrorConstructOverlay();
+
+ void SetMirrorAxis(Point aMirrorAxisA, Point aMirrorAxisB);
+};
+
+Impl3DMirrorConstructOverlay::Impl3DMirrorConstructOverlay(const E3dView& rView)
+: maObjects(),
+ mrView(rView),
+ mnCount(rView.GetMarkedObjectCount()),
+ mpPolygons(0),
+ maFullOverlay()
+{
+ if(mnCount)
+ {
+ if(mrView.IsSolidDragging())
+ {
+ SdrPageView* pPV = rView.GetSdrPageView();
+
+ if(pPV && pPV->PageWindowCount())
+ {
+ sdr::contact::ObjectContact& rOC = pPV->GetPageWindow(0)->GetObjectContact();
+ sdr::contact::DisplayInfo aDisplayInfo;
+
+ // Do not use the last ViewPort set at the OC at the last ProcessDisplay()
+ rOC.resetViewPort();
+
+ for(sal_uInt32 a(0);a < mnCount;a++)
+ {
+ SdrObject* pObject = mrView.GetMarkedObjectByIndex(a);
+
+ if(pObject)
+ {
+ sdr::contact::ViewContact& rVC = pObject->GetViewContact();
+ sdr::contact::ViewObjectContact& rVOC = rVC.GetViewObjectContact(rOC);
+
+ const drawinglayer::primitive2d::Primitive2DSequence aNewSequence(rVOC.getPrimitive2DSequenceHierarchy(aDisplayInfo));
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(maFullOverlay, aNewSequence);
+ }
+ }
+ }
+ }
+ else
+ {
+ mpPolygons = new basegfx::B2DPolyPolygon[mnCount];
+
+ for(sal_uInt32 a(0); a < mnCount; a++)
+ {
+ SdrObject* pObject = mrView.GetMarkedObjectByIndex(a);
+ mpPolygons[mnCount - (a + 1)] = pObject->TakeXorPoly();
+ }
+ }
+ }
+}
+
+Impl3DMirrorConstructOverlay::~Impl3DMirrorConstructOverlay()
+{
+ // The OverlayObjects are cleared using the destructor of OverlayObjectList.
+ // That destructor calls clear() at the list which removes all objects from the
+ // OverlayManager and deletes them.
+ if(!mrView.IsSolidDragging())
+ {
+ delete[] mpPolygons;
+ }
+}
+
+void Impl3DMirrorConstructOverlay::SetMirrorAxis(Point aMirrorAxisA, Point aMirrorAxisB)
+{
+ // get rid of old overlay objects
+ maObjects.clear();
+
+ // create new ones
+ for(sal_uInt32 a(0); a < mrView.PaintWindowCount(); a++)
+ {
+ SdrPaintWindow* pCandidate = mrView.GetPaintWindow(a);
+ ::sdr::overlay::OverlayManager* pTargetOverlay = pCandidate->GetOverlayManager();
+
+ if(pTargetOverlay)
+ {
+ // buld transfoprmation: translate and rotate so that given edge is
+ // on x axis, them mirror in y and translate back
+ const basegfx::B2DVector aEdge(aMirrorAxisB.X() - aMirrorAxisA.X(), aMirrorAxisB.Y() - aMirrorAxisA.Y());
+ basegfx::B2DHomMatrix aMatrixTransform(basegfx::tools::createTranslateB2DHomMatrix(
+ -aMirrorAxisA.X(), -aMirrorAxisA.Y()));
+ aMatrixTransform.rotate(-atan2(aEdge.getY(), aEdge.getX()));
+ aMatrixTransform.scale(1.0, -1.0);
+ aMatrixTransform.rotate(atan2(aEdge.getY(), aEdge.getX()));
+ aMatrixTransform.translate(aMirrorAxisA.X(), aMirrorAxisA.Y());
+
+ if(mrView.IsSolidDragging())
+ {
+ if(maFullOverlay.hasElements())
+ {
+ drawinglayer::primitive2d::Primitive2DSequence aContent(maFullOverlay);
+
+ if(!aMatrixTransform.isIdentity())
+ {
+ // embed in transformation group
+ drawinglayer::primitive2d::Primitive2DReference aTransformPrimitive2D(new drawinglayer::primitive2d::TransformPrimitive2D(aMatrixTransform, aContent));
+ aContent = drawinglayer::primitive2d::Primitive2DSequence(&aTransformPrimitive2D, 1);
+ }
+
+ // if we have full overlay from selected objects, embed with 50% transparence, the
+ // transformation is added to the OverlayPrimitive2DSequenceObject
+ drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparencePrimitive2D(new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(aContent, 0.5));
+ aContent = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparencePrimitive2D, 1);
+
+ sdr::overlay::OverlayPrimitive2DSequenceObject* pNew = new sdr::overlay::OverlayPrimitive2DSequenceObject(aContent);
+
+ pTargetOverlay->add(*pNew);
+ maObjects.append(*pNew);
+ }
+ }
+ else
+ {
+ for(sal_uInt32 b(0); b < mnCount; b++)
+ {
+ // apply to polygon
+ basegfx::B2DPolyPolygon aPolyPolygon(mpPolygons[b]);
+ aPolyPolygon.transform(aMatrixTransform);
+
+ ::sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(aPolyPolygon);
+ pTargetOverlay->add(*pNew);
+ maObjects.append(*pNew);
+ }
+ }
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Konstruktor 1
+|*
+\************************************************************************/
+
+E3dView::E3dView(SdrModel* pModel, OutputDevice* pOut) :
+ SdrView(pModel, pOut)
+{
+ InitView ();
+}
+
+/*************************************************************************
+|*
+|* DrawMarkedObj ueberladen, da eventuell nur einzelne 3D-Objekte
+|* gezeichnet werden sollen
+|*
+\************************************************************************/
+
+void E3dView::DrawMarkedObj(OutputDevice& rOut) const
+{
+ // Existieren 3D-Objekte, deren Szenen nicht selektiert sind?
+ sal_Bool bSpecialHandling = sal_False;
+ E3dScene *pScene = NULL;
+
+ long nCnt = GetMarkedObjectCount();
+ for(long nObjs = 0;nObjs < nCnt;nObjs++)
+ {
+ SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
+ if(pObj && pObj->ISA(E3dCompoundObject))
+ {
+ // zugehoerige Szene
+ pScene = ((E3dCompoundObject*)pObj)->GetScene();
+ if(pScene && !IsObjMarked(pScene))
+ bSpecialHandling = sal_True;
+ }
+ // Alle SelectionFlags zuruecksetzen
+ if(pObj && pObj->ISA(E3dObject))
+ {
+ pScene = ((E3dObject*)pObj)->GetScene();
+ if(pScene)
+ pScene->SetSelected(sal_False);
+ }
+ }
+
+ if(bSpecialHandling)
+ {
+ // SelectionFlag bei allen zu 3D Objekten gehoerigen
+ // Szenen und deren Objekten auf nicht selektiert setzen
+ long nObjs;
+ for(nObjs = 0;nObjs < nCnt;nObjs++)
+ {
+ SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
+ if(pObj && pObj->ISA(E3dCompoundObject))
+ {
+ // zugehoerige Szene
+ pScene = ((E3dCompoundObject*)pObj)->GetScene();
+ if(pScene)
+ pScene->SetSelected(sal_False);
+ }
+ }
+
+ // bei allen direkt selektierten Objekten auf selektiert setzen
+ SdrMark* pM = NULL;
+
+ for(nObjs = 0;nObjs < nCnt;nObjs++)
+ {
+ SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
+ if(pObj && pObj->ISA(E3dObject))
+ {
+ // Objekt markieren
+ E3dObject* p3DObj = (E3dObject*)pObj;
+ p3DObj->SetSelected(sal_True);
+ pScene = p3DObj->GetScene();
+ pM = GetSdrMarkByIndex(nObjs);
+ }
+ }
+
+ if(pScene)
+ {
+ // code from parent
+ SortMarkedObjects();
+
+ pScene->SetDrawOnlySelected(sal_True);
+ pScene->SingleObjectPainter(rOut); // #110094#-17
+ pScene->SetDrawOnlySelected(sal_False);
+ }
+
+ // SelectionFlag zuruecksetzen
+ for(nObjs = 0;nObjs < nCnt;nObjs++)
+ {
+ SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
+ if(pObj && pObj->ISA(E3dCompoundObject))
+ {
+ // zugehoerige Szene
+ pScene = ((E3dCompoundObject*)pObj)->GetScene();
+ if(pScene)
+ pScene->SetSelected(sal_False);
+ }
+ }
+ }
+ else
+ {
+ // call parent
+ SdrExchangeView::DrawMarkedObj(rOut);
+ }
+}
+
+/*************************************************************************
+|*
+|* Model holen ueberladen, da bei einzelnen 3D Objekten noch eine Szene
+|* untergeschoben werden muss
+|*
+\************************************************************************/
+
+SdrModel* E3dView::GetMarkedObjModel() const
+{
+ // Existieren 3D-Objekte, deren Szenen nicht selektiert sind?
+ bool bSpecialHandling(false);
+ const sal_uInt32 nCount(GetMarkedObjectCount());
+ sal_uInt32 nObjs(0);
+ E3dScene *pScene = 0;
+
+ for(nObjs = 0; nObjs < nCount; nObjs++)
+ {
+ const SdrObject* pObj = GetMarkedObjectByIndex(nObjs);
+
+ if(!bSpecialHandling && pObj && pObj->ISA(E3dCompoundObject))
+ {
+ // if the object is selected, but it's scene not,
+ // we need special handling
+ pScene = ((E3dCompoundObject*)pObj)->GetScene();
+
+ if(pScene && !IsObjMarked(pScene))
+ {
+ bSpecialHandling = true;
+ }
+ }
+
+ if(pObj && pObj->ISA(E3dObject))
+ {
+ // reset all selection flags at 3D objects
+ pScene = ((E3dObject*)pObj)->GetScene();
+
+ if(pScene)
+ {
+ pScene->SetSelected(false);
+ }
+ }
+ }
+
+ if(!bSpecialHandling)
+ {
+ // call parent
+ return SdrView::GetMarkedObjModel();
+ }
+
+ SdrModel* pNewModel = 0;
+ Rectangle aSelectedSnapRect;
+
+ // set 3d selection flags at all directly selected objects
+ // and collect SnapRect of selected objects
+ for(nObjs = 0; nObjs < nCount; nObjs++)
+ {
+ SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
+
+ if(pObj && pObj->ISA(E3dCompoundObject))
+ {
+ // mark object, but not scenes
+ E3dCompoundObject* p3DObj = (E3dCompoundObject*)pObj;
+ p3DObj->SetSelected(true);
+ aSelectedSnapRect.Union(p3DObj->GetSnapRect());
+ }
+ }
+
+ // create new mark list which contains all indirectly selected3d
+ // scenes as selected objects
+ SdrMarkList aOldML(GetMarkedObjectList());
+ SdrMarkList aNewML;
+ SdrMarkList& rCurrentMarkList = ((E3dView*)this)->GetMarkedObjectListWriteAccess();
+ rCurrentMarkList = aNewML;
+
+ for(nObjs = 0; nObjs < nCount; nObjs++)
+ {
+ SdrObject *pObj = aOldML.GetMark(nObjs)->GetMarkedSdrObj();
+
+ if(pObj && pObj->ISA(E3dObject))
+ {
+ pScene = ((E3dObject*)pObj)->GetScene();
+
+ if(pScene && !IsObjMarked(pScene) && GetSdrPageView())
+ {
+ ((E3dView*)this)->MarkObj(pScene, GetSdrPageView(), sal_False, sal_True);
+ }
+ }
+ }
+
+ // call parent. This will copy all scenes and the selection flags at the 3d objectss. So
+ // it will be possible to delete all non-selected 3d objects from the cloned 3d scenes
+ pNewModel = SdrView::GetMarkedObjModel();
+
+ if(pNewModel)
+ {
+ for(sal_uInt16 nPg(0); nPg < pNewModel->GetPageCount(); nPg++)
+ {
+ const SdrPage* pSrcPg=pNewModel->GetPage(nPg);
+ const sal_uInt32 nObAnz(pSrcPg->GetObjCount());
+
+ for(sal_uInt32 nOb(0); nOb < nObAnz; nOb++)
+ {
+ const SdrObject* pSrcOb=pSrcPg->GetObj(nOb);
+
+ if(pSrcOb->ISA(E3dScene))
+ {
+ pScene = (E3dScene*)pSrcOb;
+
+ // delete all not intentionally cloned 3d objects
+ pScene->removeAllNonSelectedObjects();
+
+ // reset select flags and set SnapRect of all selected objects
+ pScene->SetSelected(false);
+ pScene->SetSnapRect(aSelectedSnapRect);
+ }
+ }
+ }
+ }
+
+ // restore old selection
+ rCurrentMarkList = aOldML;
+
+ // model zurueckgeben
+ return pNewModel;
+}
+
+/*************************************************************************
+|*
+|* Bei Paste muss - falls in eine Scene eingefuegt wird - die
+|* Objekte der Szene eingefuegt werden, die Szene selbst aber nicht
+|*
+\************************************************************************/
+
+sal_Bool E3dView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions)
+{
+ sal_Bool bRetval = sal_False;
+
+ // Liste holen
+ Point aPos(rPos);
+ SdrObjList* pDstList = pLst;
+ ImpGetPasteObjList(aPos, pDstList);
+
+ if(!pDstList)
+ return sal_False;
+
+ // Owner der Liste holen
+ SdrObject* pOwner = pDstList->GetOwnerObj();
+ if(pOwner && pOwner->ISA(E3dScene))
+ {
+ E3dScene* pDstScene = (E3dScene*)pOwner;
+ BegUndo(SVX_RESSTR(RID_SVX_3D_UNDO_EXCHANGE_PASTE));
+
+ // Alle Objekte aus E3dScenes kopieren und direkt einfuegen
+ for(sal_uInt16 nPg(0); nPg < rMod.GetPageCount(); nPg++)
+ {
+ const SdrPage* pSrcPg=rMod.GetPage(nPg);
+ sal_uInt32 nObAnz(pSrcPg->GetObjCount());
+
+ // calculate offset for paste
+ Rectangle aR = pSrcPg->GetAllObjBoundRect();
+ Point aDist(aPos - aR.Center());
+
+ // Unterobjekte von Szenen einfuegen
+ for(sal_uInt32 nOb(0); nOb < nObAnz; nOb++)
+ {
+ const SdrObject* pSrcOb = pSrcPg->GetObj(nOb);
+ if(pSrcOb->ISA(E3dScene))
+ {
+ E3dScene* pSrcScene = (E3dScene*)pSrcOb;
+ ImpCloneAll3DObjectsToDestScene(pSrcScene, pDstScene, aDist);
+ }
+ }
+ }
+ EndUndo();
+ }
+ else
+ {
+ // call parent
+ bRetval = SdrView::Paste(rMod, rPos, pLst, nOptions);
+ }
+
+ // und Rueckgabewert liefern
+ return bRetval;
+}
+
+// #83403# Service routine used from local Clone() and from SdrCreateView::EndCreateObj(...)
+sal_Bool E3dView::ImpCloneAll3DObjectsToDestScene(E3dScene* pSrcScene, E3dScene* pDstScene, Point /*aOffset*/)
+{
+ sal_Bool bRetval(sal_False);
+
+ if(pSrcScene && pDstScene)
+ {
+ const sdr::contact::ViewContactOfE3dScene& rVCSceneDst = static_cast< sdr::contact::ViewContactOfE3dScene& >(pDstScene->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3DDst(rVCSceneDst.getViewInformation3D());
+ const sdr::contact::ViewContactOfE3dScene& rVCSceneSrc = static_cast< sdr::contact::ViewContactOfE3dScene& >(pSrcScene->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D aViewInfo3DSrc(rVCSceneSrc.getViewInformation3D());
+
+ for(sal_uInt32 i(0); i < pSrcScene->GetSubList()->GetObjCount(); i++)
+ {
+ E3dCompoundObject* pCompoundObj = dynamic_cast< E3dCompoundObject* >(pSrcScene->GetSubList()->GetObj(i));
+
+ if(pCompoundObj)
+ {
+ // #116235#
+ E3dCompoundObject* pNewCompoundObj = dynamic_cast< E3dCompoundObject* >(pCompoundObj->Clone());
+
+ if(pNewCompoundObj)
+ {
+ // get dest scene's current range in 3D world coordinates
+ const basegfx::B3DHomMatrix aSceneToWorldTrans(pDstScene->GetFullTransform());
+ basegfx::B3DRange aSceneRange(pDstScene->GetBoundVolume());
+ aSceneRange.transform(aSceneToWorldTrans);
+
+ // get new object's implied object transformation
+ const basegfx::B3DHomMatrix aNewObjectTrans(pNewCompoundObj->GetTransform());
+
+ // get new object's range in 3D world coordinates in dest scene
+ // as if it were already added
+ const basegfx::B3DHomMatrix aObjectToWorldTrans(aSceneToWorldTrans * aNewObjectTrans);
+ basegfx::B3DRange aObjectRange(pNewCompoundObj->GetBoundVolume());
+ aObjectRange.transform(aObjectToWorldTrans);
+
+ // get scale adaption
+ const basegfx::B3DVector aSceneScale(aSceneRange.getRange());
+ const basegfx::B3DVector aObjectScale(aObjectRange.getRange());
+ double fScale(1.0);
+
+ // if new object's size in X,Y or Z is bigger that 80% of dest scene, adapt scale
+ // to not change the scene by the inserted object
+ const double fSizeFactor(0.5);
+
+ if(aObjectScale.getX() * fScale > aSceneScale.getX() * fSizeFactor)
+ {
+ const double fObjSize(aObjectScale.getX() * fScale);
+ const double fFactor((aSceneScale.getX() * fSizeFactor) / (basegfx::fTools::equalZero(fObjSize) ? 1.0 : fObjSize));
+ fScale *= fFactor;
+ }
+
+ if(aObjectScale.getY() * fScale > aSceneScale.getY() * fSizeFactor)
+ {
+ const double fObjSize(aObjectScale.getY() * fScale);
+ const double fFactor((aSceneScale.getY() * fSizeFactor) / (basegfx::fTools::equalZero(fObjSize) ? 1.0 : fObjSize));
+ fScale *= fFactor;
+ }
+
+ if(aObjectScale.getZ() * fScale > aSceneScale.getZ() * fSizeFactor)
+ {
+ const double fObjSize(aObjectScale.getZ() * fScale);
+ const double fFactor((aSceneScale.getZ() * fSizeFactor) / (basegfx::fTools::equalZero(fObjSize) ? 1.0 : fObjSize));
+ fScale *= fFactor;
+ }
+
+ // get translation adaption
+ const basegfx::B3DPoint aSceneCenter(aSceneRange.getCenter());
+ const basegfx::B3DPoint aObjectCenter(aObjectRange.getCenter());
+
+ // build full modification transform. The object's transformation
+ // shall be modified, so start at object coordinates; transform to 3d world coor
+ basegfx::B3DHomMatrix aModifyingTransform(aObjectToWorldTrans);
+
+ // translate to absolute center in 3d world coor
+ aModifyingTransform.translate(-aObjectCenter.getX(), -aObjectCenter.getY(), -aObjectCenter.getZ());
+
+ // scale to dest size in 3d world coor
+ aModifyingTransform.scale(fScale, fScale, fScale);
+
+ // translate to dest scene center in 3d world coor
+ aModifyingTransform.translate(aSceneCenter.getX(), aSceneCenter.getY(), aSceneCenter.getZ());
+
+ // transform from 3d world to dest object coordinates
+ basegfx::B3DHomMatrix aWorldToObject(aObjectToWorldTrans);
+ aWorldToObject.invert();
+ aModifyingTransform = aWorldToObject * aModifyingTransform;
+
+ // correct implied object transform by applying changing one in object coor
+ pNewCompoundObj->SetTransform(aModifyingTransform * aNewObjectTrans);
+
+ // fill and insert new object
+ pNewCompoundObj->SetModel(pDstScene->GetModel());
+ pNewCompoundObj->SetPage(pDstScene->GetPage());
+ pNewCompoundObj->NbcSetLayer(pCompoundObj->GetLayer());
+ pNewCompoundObj->NbcSetStyleSheet(pCompoundObj->GetStyleSheet(), sal_True);
+ pDstScene->Insert3DObj(pNewCompoundObj);
+ bRetval = sal_True;
+
+ // Undo anlegen
+ if( GetModel()->IsUndoEnabled() )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pNewCompoundObj));
+ }
+ }
+ }
+ }
+
+ return bRetval;
+}
+
+/*************************************************************************
+|*
+|* 3D-Konvertierung moeglich?
+|*
+\************************************************************************/
+
+sal_Bool E3dView::IsConvertTo3DObjPossible() const
+{
+ sal_Bool bAny3D(sal_False);
+ sal_Bool bGroupSelected(sal_False);
+ sal_Bool bRetval(sal_True);
+
+ for(sal_uInt32 a=0;!bAny3D && a<GetMarkedObjectCount();a++)
+ {
+ SdrObject *pObj = GetMarkedObjectByIndex(a);
+ if(pObj)
+ {
+ ImpIsConvertTo3DPossible(pObj, bAny3D, bGroupSelected);
+ }
+ }
+
+ bRetval = !bAny3D
+ && (
+ IsConvertToPolyObjPossible(sal_False)
+ || IsConvertToPathObjPossible(sal_False)
+ || IsImportMtfPossible());
+ return bRetval;
+}
+
+void E3dView::ImpIsConvertTo3DPossible(SdrObject* pObj, sal_Bool& rAny3D,
+ sal_Bool& rGroupSelected) const
+{
+ if(pObj)
+ {
+ if(pObj->ISA(E3dObject))
+ {
+ rAny3D = sal_True;
+ }
+ else
+ {
+ if(pObj->IsGroupObject())
+ {
+ SdrObjListIter aIter(*pObj, IM_DEEPNOGROUPS);
+ while(aIter.IsMore())
+ {
+ SdrObject* pNewObj = aIter.Next();
+ ImpIsConvertTo3DPossible(pNewObj, rAny3D, rGroupSelected);
+ }
+ rGroupSelected = sal_True;
+ }
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* 3D-Konvertierung zu Extrude ausfuehren
+|*
+\************************************************************************/
+#include <editeng/eeitem.hxx>
+
+void E3dView::ImpChangeSomeAttributesFor3DConversion(SdrObject* pObj)
+{
+ if(pObj->ISA(SdrTextObj))
+ {
+ const SfxItemSet& rSet = pObj->GetMergedItemSet();
+ const SvxColorItem& rTextColorItem = (const SvxColorItem&)rSet.Get(EE_CHAR_COLOR);
+ if(rTextColorItem.GetValue() == RGB_Color(COL_BLACK))
+ {
+ // Bei schwarzen Textobjekten wird die Farbe auf grau gesetzt
+ if(pObj->GetPage())
+ {
+ // #84864# if black is only default attribute from
+ // pattern set it hard so that it is used in undo.
+ pObj->SetMergedItem(SvxColorItem(RGB_Color(COL_BLACK), EE_CHAR_COLOR));
+
+ // add undo now
+ if( GetModel()->IsUndoEnabled() )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj, false, false));
+ }
+
+ pObj->SetMergedItem(SvxColorItem(RGB_Color(COL_GRAY), EE_CHAR_COLOR));
+ }
+ }
+}
+
+void E3dView::ImpChangeSomeAttributesFor3DConversion2(SdrObject* pObj)
+{
+ if(pObj->ISA(SdrPathObj))
+ {
+ const SfxItemSet& rSet = pObj->GetMergedItemSet();
+ sal_Int32 nLineWidth = ((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue();
+ XLineStyle eLineStyle = (XLineStyle)((const XLineStyleItem&)rSet.Get(XATTR_LINESTYLE)).GetValue();
+ XFillStyle eFillStyle = ITEMVALUE(rSet, XATTR_FILLSTYLE, XFillStyleItem);
+
+ if(((SdrPathObj*)pObj)->IsClosed()
+ && eLineStyle == XLINE_SOLID
+ && !nLineWidth
+ && eFillStyle != XFILL_NONE)
+ {
+ if(pObj->GetPage() && GetModel()->IsUndoEnabled() )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj, false, false));
+ pObj->SetMergedItem(XLineStyleItem(XLINE_NONE));
+ pObj->SetMergedItem(XLineWidthItem(0L));
+ }
+ }
+}
+
+void E3dView::ImpCreateSingle3DObjectFlat(E3dScene* pScene, SdrObject* pObj, sal_Bool bExtrude, double fDepth, basegfx::B2DHomMatrix& rLatheMat)
+{
+ // Einzelnes PathObject, dieses umwanden
+ SdrPathObj* pPath = PTR_CAST(SdrPathObj, pObj);
+
+ if(pPath)
+ {
+ E3dDefaultAttributes aDefault = Get3DDefaultAttributes();
+ if(bExtrude)
+ aDefault.SetDefaultExtrudeCharacterMode(sal_True);
+ else
+ aDefault.SetDefaultLatheCharacterMode(sal_True);
+
+ // ItemSet des Ursprungsobjektes holen
+ SfxItemSet aSet(pObj->GetMergedItemSet());
+
+ XFillStyle eFillStyle = ITEMVALUE(aSet, XATTR_FILLSTYLE, XFillStyleItem);
+
+ // Linienstil ausschalten
+ aSet.Put(XLineStyleItem(XLINE_NONE));
+
+ // Feststellen, ob ein FILL_Attribut gesetzt ist.
+ if(!pPath->IsClosed() || eFillStyle == XFILL_NONE)
+ {
+ // Das SdrPathObj ist nicht gefuellt, lasse die
+ // vordere und hintere Flaeche weg. Ausserdem ist
+ // eine beidseitige Darstellung notwendig.
+ aDefault.SetDefaultExtrudeCloseFront(sal_False);
+ aDefault.SetDefaultExtrudeCloseBack(sal_False);
+
+ aSet.Put(Svx3DDoubleSidedItem(sal_True));
+
+ // Fuellattribut setzen
+ aSet.Put(XFillStyleItem(XFILL_SOLID));
+
+ // Fuellfarbe muss auf Linienfarbe, da das Objekt vorher
+ // nur eine Linie war
+ Color aColorLine = ((const XLineColorItem&)(aSet.Get(XATTR_LINECOLOR))).GetColorValue();
+ aSet.Put(XFillColorItem(String(), aColorLine));
+ }
+
+ // Neues Extrude-Objekt erzeugen
+ E3dObject* p3DObj = NULL;
+ if(bExtrude)
+ {
+ p3DObj = new E3dExtrudeObj(aDefault, pPath->GetPathPoly(), fDepth);
+ }
+ else
+ {
+ basegfx::B2DPolyPolygon aPolyPoly2D(pPath->GetPathPoly());
+ aPolyPoly2D.transform(rLatheMat);
+ p3DObj = new E3dLatheObj(aDefault, aPolyPoly2D);
+ }
+
+ // Attribute setzen
+ if(p3DObj)
+ {
+ p3DObj->NbcSetLayer(pObj->GetLayer());
+
+ p3DObj->SetMergedItemSet(aSet);
+
+ p3DObj->NbcSetStyleSheet(pObj->GetStyleSheet(), sal_True);
+
+ // Neues 3D-Objekt einfuegen
+ pScene->Insert3DObj(p3DObj);
+ }
+ }
+}
+
+void E3dView::ImpCreate3DObject(E3dScene* pScene, SdrObject* pObj, sal_Bool bExtrude, double fDepth, basegfx::B2DHomMatrix& rLatheMat)
+{
+ if(pObj)
+ {
+ // change text color attribute for not so dark colors
+ if(pObj->IsGroupObject())
+ {
+ SdrObjListIter aIter(*pObj, IM_DEEPWITHGROUPS);
+ while(aIter.IsMore())
+ {
+ SdrObject* pGroupMember = aIter.Next();
+ ImpChangeSomeAttributesFor3DConversion(pGroupMember);
+ }
+ }
+ else
+ ImpChangeSomeAttributesFor3DConversion(pObj);
+
+ // convert completely to path objects
+ SdrObject* pNewObj1 = pObj->ConvertToPolyObj(sal_False, sal_False);
+
+ if(pNewObj1)
+ {
+ // change text color attribute for not so dark colors
+ if(pNewObj1->IsGroupObject())
+ {
+ SdrObjListIter aIter(*pNewObj1, IM_DEEPWITHGROUPS);
+ while(aIter.IsMore())
+ {
+ SdrObject* pGroupMember = aIter.Next();
+ ImpChangeSomeAttributesFor3DConversion2(pGroupMember);
+ }
+ }
+ else
+ ImpChangeSomeAttributesFor3DConversion2(pNewObj1);
+
+ // convert completely to path objects
+ SdrObject* pNewObj2 = pObj->ConvertToContourObj(pNewObj1, sal_True);
+
+ if(pNewObj2)
+ {
+ // add all to flat scene
+ if(pNewObj2->IsGroupObject())
+ {
+ SdrObjListIter aIter(*pNewObj2, IM_DEEPWITHGROUPS);
+ while(aIter.IsMore())
+ {
+ SdrObject* pGroupMember = aIter.Next();
+ ImpCreateSingle3DObjectFlat(pScene, pGroupMember, bExtrude, fDepth, rLatheMat);
+ }
+ }
+ else
+ ImpCreateSingle3DObjectFlat(pScene, pNewObj2, bExtrude, fDepth, rLatheMat);
+
+ // delete zwi object
+ if(pNewObj2 != pObj && pNewObj2 != pNewObj1 && pNewObj2)
+ SdrObject::Free( pNewObj2 );
+ }
+
+ // delete zwi object
+ if(pNewObj1 != pObj && pNewObj1)
+ SdrObject::Free( pNewObj1 );
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* 3D-Konvertierung zu Extrude steuern
+|*
+\************************************************************************/
+
+void E3dView::ConvertMarkedObjTo3D(sal_Bool bExtrude, basegfx::B2DPoint aPnt1, basegfx::B2DPoint aPnt2)
+{
+ if(AreObjectsMarked())
+ {
+ // Undo anlegen
+ if(bExtrude)
+ BegUndo(SVX_RESSTR(RID_SVX_3D_UNDO_EXTRUDE));
+ else
+ BegUndo(SVX_RESSTR(RID_SVX_3D_UNDO_LATHE));
+
+ // Neue Szene fuer zu erzeugende 3D-Objekte anlegen
+ E3dScene* pScene = new E3dPolyScene(Get3DDefaultAttributes());
+
+ // Rechteck bestimmen und evtl. korrigieren
+ Rectangle aRect = GetAllMarkedRect();
+ if(aRect.GetWidth() <= 1)
+ aRect.SetSize(Size(500, aRect.GetHeight()));
+ if(aRect.GetHeight() <= 1)
+ aRect.SetSize(Size(aRect.GetWidth(), 500));
+
+ // Tiefe relativ zur Groesse der Selektion bestimmen
+ double fDepth = 0.0;
+ double fRot3D = 0.0;
+ basegfx::B2DHomMatrix aLatheMat;
+
+ if(bExtrude)
+ {
+ double fW = (double)aRect.GetWidth();
+ double fH = (double)aRect.GetHeight();
+ fDepth = sqrt(fW*fW + fH*fH) / 6.0;
+ }
+ if(!bExtrude)
+ {
+ // Transformation fuer Polygone Rotationskoerper erstellen
+ if(aPnt1 != aPnt2)
+ {
+ // Rotation um Kontrollpunkt1 mit eigestelltem Winkel
+ // fuer 3D Koordinaten
+ basegfx::B2DPoint aDiff(aPnt1 - aPnt2);
+ fRot3D = atan2(aDiff.getY(), aDiff.getX()) - F_PI2;
+
+ if(basegfx::fTools::equalZero(fabs(fRot3D)))
+ fRot3D = 0.0;
+
+ if(fRot3D != 0.0)
+ {
+ aLatheMat = basegfx::tools::createRotateAroundPoint(aPnt2, -fRot3D)
+ * aLatheMat;
+ }
+ }
+
+ if(aPnt2.getX() != 0.0)
+ {
+ // Translation auf Y=0 - Achse
+ aLatheMat.translate(-aPnt2.getX(), 0.0);
+ }
+ else
+ {
+ aLatheMat.translate((double)-aRect.Left(), 0.0);
+ }
+
+ // Inverse Matrix bilden, um die Zielausdehnung zu bestimmen
+ basegfx::B2DHomMatrix aInvLatheMat(aLatheMat);
+ aInvLatheMat.invert();
+
+ // SnapRect Ausdehnung mittels Spiegelung an der Rotationsachse
+ // erweitern
+ for(sal_uInt32 a=0;a<GetMarkedObjectCount();a++)
+ {
+ SdrMark* pMark = GetSdrMarkByIndex(a);
+ SdrObject* pObj = pMark->GetMarkedSdrObj();
+ Rectangle aTurnRect = pObj->GetSnapRect();
+ basegfx::B2DPoint aRot;
+ Point aRotPnt;
+
+ aRot = basegfx::B2DPoint(aTurnRect.Left(), -aTurnRect.Top());
+ aRot *= aLatheMat;
+ aRot.setX(-aRot.getX());
+ aRot *= aInvLatheMat;
+ aRotPnt = Point((long)(aRot.getX() + 0.5), (long)(-aRot.getY() - 0.5));
+ aRect.Union(Rectangle(aRotPnt, aRotPnt));
+
+ aRot = basegfx::B2DPoint(aTurnRect.Left(), -aTurnRect.Bottom());
+ aRot *= aLatheMat;
+ aRot.setX(-aRot.getX());
+ aRot *= aInvLatheMat;
+ aRotPnt = Point((long)(aRot.getX() + 0.5), (long)(-aRot.getY() - 0.5));
+ aRect.Union(Rectangle(aRotPnt, aRotPnt));
+
+ aRot = basegfx::B2DPoint(aTurnRect.Right(), -aTurnRect.Top());
+ aRot *= aLatheMat;
+ aRot.setX(-aRot.getX());
+ aRot *= aInvLatheMat;
+ aRotPnt = Point((long)(aRot.getX() + 0.5), (long)(-aRot.getY() - 0.5));
+ aRect.Union(Rectangle(aRotPnt, aRotPnt));
+
+ aRot = basegfx::B2DPoint(aTurnRect.Right(), -aTurnRect.Bottom());
+ aRot *= aLatheMat;
+ aRot.setX(-aRot.getX());
+ aRot *= aInvLatheMat;
+ aRotPnt = Point((long)(aRot.getX() + 0.5), (long)(-aRot.getY() - 0.5));
+ aRect.Union(Rectangle(aRotPnt, aRotPnt));
+ }
+ }
+
+ // Ueber die Selektion gehen und in 3D wandeln, komplett mit
+ // Umwandeln in SdrPathObject, auch Schriften
+ for(sal_uInt32 a=0;a<GetMarkedObjectCount();a++)
+ {
+ SdrMark* pMark = GetSdrMarkByIndex(a);
+ SdrObject* pObj = pMark->GetMarkedSdrObj();
+
+ ImpCreate3DObject(pScene, pObj, bExtrude, fDepth, aLatheMat);
+ }
+
+ if(pScene->GetSubList() && pScene->GetSubList()->GetObjCount() != 0)
+ {
+ // Alle angelegten Objekte Tiefenarrangieren
+ if(bExtrude)
+ DoDepthArrange(pScene, fDepth);
+
+ // 3D-Objekte auf die Mitte des Gesamtrechtecks zentrieren
+ basegfx::B3DPoint aCenter(pScene->GetBoundVolume().getCenter());
+ basegfx::B3DHomMatrix aMatrix;
+
+ aMatrix.translate(-aCenter.getX(), -aCenter.getY(), -aCenter.getZ());
+ pScene->SetTransform(aMatrix * pScene->GetTransform()); // #112587#
+
+ // Szene initialisieren
+ pScene->NbcSetSnapRect(aRect);
+ basegfx::B3DRange aBoundVol = pScene->GetBoundVolume();
+ InitScene(pScene, (double)aRect.GetWidth(), (double)aRect.GetHeight(), aBoundVol.getDepth());
+
+ // Szene anstelle des ersten selektierten Objektes einfuegen
+ // und alle alten Objekte weghauen
+ SdrObject* pRepObj = GetMarkedObjectByIndex(0);
+ SdrPageView* pPV = GetSdrPageViewOfMarkedByIndex(0);
+ MarkObj(pRepObj, pPV, sal_True);
+ ReplaceObjectAtView(pRepObj, *pPV, pScene, sal_False);
+ DeleteMarked();
+ MarkObj(pScene, pPV);
+
+ // Rotationskoerper um Rotationsachse drehen
+ basegfx::B3DHomMatrix aRotate;
+
+ if(!bExtrude && fRot3D != 0.0)
+ {
+ aRotate.rotate(0.0, 0.0, fRot3D);
+ }
+
+ // Default-Rotation setzen
+ {
+ double XRotateDefault = 20;
+ aRotate.rotate(DEG2RAD(XRotateDefault), 0.0, 0.0);
+ }
+
+ if(!aRotate.isIdentity())
+ {
+ pScene->SetTransform(aRotate * pScene->GetTransform());
+ }
+
+ // SnapRects der Objekte ungueltig
+ pScene->SetSnapRect(aRect);
+ }
+ else
+ {
+ // Es wurden keine 3D Objekte erzeugt, schmeiss alles weg
+ delete pScene;
+ }
+
+ // Undo abschliessen
+ EndUndo();
+ }
+}
+
+/*************************************************************************
+|*
+|* Alle enthaltenen Extrude-Objekte Tiefenarrangieren
+|*
+\************************************************************************/
+
+struct E3dDepthNeighbour
+{
+ E3dDepthNeighbour* mpNext;
+ E3dExtrudeObj* mpObj;
+ basegfx::B2DPolyPolygon maPreparedPolyPolygon;
+
+ E3dDepthNeighbour()
+ : mpNext(0),
+ mpObj(0),
+ maPreparedPolyPolygon()
+ {
+ }
+};
+
+struct E3dDepthLayer
+{
+ E3dDepthLayer* mpDown;
+ E3dDepthNeighbour* mpNext;
+
+ E3dDepthLayer()
+ : mpDown(0),
+ mpNext(0)
+ {
+ }
+
+ ~E3dDepthLayer()
+ {
+ while(mpNext)
+ {
+ E3dDepthNeighbour* pSucc = mpNext->mpNext;
+ delete mpNext;
+ mpNext = pSucc;
+ }
+ }
+};
+
+void E3dView::DoDepthArrange(E3dScene* pScene, double fDepth)
+{
+ if(pScene && pScene->GetSubList() && pScene->GetSubList()->GetObjCount() > 1)
+ {
+ SdrObjList* pSubList = pScene->GetSubList();
+ SdrObjListIter aIter(*pSubList, IM_FLAT);
+ E3dDepthLayer* pBaseLayer = NULL;
+ E3dDepthLayer* pLayer = NULL;
+ sal_Int32 nNumLayers = 0;
+
+ while(aIter.IsMore())
+ {
+ E3dExtrudeObj* pExtrudeObj = dynamic_cast< E3dExtrudeObj* >(aIter.Next());
+
+ if(pExtrudeObj)
+ {
+ const basegfx::B2DPolyPolygon aExtrudePoly(
+ basegfx::tools::prepareForPolygonOperation(pExtrudeObj->GetExtrudePolygon()));
+ const SfxItemSet& rLocalSet = pExtrudeObj->GetMergedItemSet();
+ const XFillStyle eLocalFillStyle = ITEMVALUE(rLocalSet, XATTR_FILLSTYLE, XFillStyleItem);
+ const Color aLocalColor = ((const XFillColorItem&)(rLocalSet.Get(XATTR_FILLCOLOR))).GetColorValue();
+
+ // sort in ExtrudeObj
+ if(pLayer)
+ {
+ // do we have overlap with an object of this layer?
+ bool bOverlap(false);
+ E3dDepthNeighbour* pAct = pLayer->mpNext;
+
+ while(!bOverlap && pAct)
+ {
+ // do pAct->mpObj and pExtrudeObj overlap? Check by
+ // using logical AND clipping
+ const basegfx::B2DPolyPolygon aAndPolyPolygon(
+ basegfx::tools::solvePolygonOperationAnd(
+ aExtrudePoly,
+ pAct->maPreparedPolyPolygon));
+
+ bOverlap = (0 != aAndPolyPolygon.count());
+
+ if(bOverlap)
+ {
+ // second ciriteria: is another fillstyle or color used?
+ const SfxItemSet& rCompareSet = pAct->mpObj->GetMergedItemSet();
+
+ XFillStyle eCompareFillStyle = ITEMVALUE(rCompareSet, XATTR_FILLSTYLE, XFillStyleItem);
+
+ if(eLocalFillStyle == eCompareFillStyle)
+ {
+ if(eLocalFillStyle == XFILL_SOLID)
+ {
+ Color aCompareColor = ((const XFillColorItem&)(rCompareSet.Get(XATTR_FILLCOLOR))).GetColorValue();
+
+ if(aCompareColor == aLocalColor)
+ {
+ bOverlap = sal_False;
+ }
+ }
+ else if(eLocalFillStyle == XFILL_NONE)
+ {
+ bOverlap = sal_False;
+ }
+ }
+ }
+
+ pAct = pAct->mpNext;
+ }
+
+ if(bOverlap)
+ {
+ // yes, start a new layer
+ pLayer->mpDown = new E3dDepthLayer;
+ pLayer = pLayer->mpDown;
+ nNumLayers++;
+ pLayer->mpNext = new E3dDepthNeighbour;
+ pLayer->mpNext->mpObj = pExtrudeObj;
+ pLayer->mpNext->maPreparedPolyPolygon = aExtrudePoly;
+ }
+ else
+ {
+ // no, add to current layer
+ E3dDepthNeighbour* pNewNext = new E3dDepthNeighbour;
+ pNewNext->mpObj = pExtrudeObj;
+ pNewNext->maPreparedPolyPolygon = aExtrudePoly;
+ pNewNext->mpNext = pLayer->mpNext;
+ pLayer->mpNext = pNewNext;
+ }
+ }
+ else
+ {
+ // first layer ever
+ pBaseLayer = new E3dDepthLayer;
+ pLayer = pBaseLayer;
+ nNumLayers++;
+ pLayer->mpNext = new E3dDepthNeighbour;
+ pLayer->mpNext->mpObj = pExtrudeObj;
+ pLayer->mpNext->maPreparedPolyPolygon = aExtrudePoly;
+ }
+ }
+ }
+
+ // number of layers is done
+ if(nNumLayers > 1)
+ {
+ // need to be arranged
+ double fMinDepth = fDepth * 0.8;
+ double fStep = (fDepth - fMinDepth) / (double)nNumLayers;
+ pLayer = pBaseLayer;
+
+ while(pLayer)
+ {
+ // move along layer
+ E3dDepthNeighbour* pAct = pLayer->mpNext;
+
+ while(pAct)
+ {
+ // adapt extrude value
+ pAct->mpObj->SetMergedItem(SfxUInt32Item(SDRATTR_3DOBJ_DEPTH, sal_uInt32(fMinDepth + 0.5)));
+
+ // next
+ pAct = pAct->mpNext;
+ }
+
+ // next layer
+ pLayer = pLayer->mpDown;
+ fMinDepth += fStep;
+ }
+ }
+
+ // cleanup
+ while(pBaseLayer)
+ {
+ pLayer = pBaseLayer->mpDown;
+ delete pBaseLayer;
+ pBaseLayer = pLayer;
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Drag beginnen, vorher ggf. Drag-Methode fuer 3D-Objekte erzeugen
+|*
+\************************************************************************/
+
+sal_Bool E3dView::BegDragObj(const Point& rPnt, OutputDevice* pOut,
+ SdrHdl* pHdl, short nMinMov,
+ SdrDragMethod* pForcedMeth)
+{
+ if(Is3DRotationCreationActive() && GetMarkedObjectCount())
+ {
+ // bestimme alle selektierten Polygone und gebe die gespiegelte Hilfsfigur aus
+ mpMirrorOverlay->SetMirrorAxis(aRef1, aRef2);
+ }
+ else
+ {
+ sal_Bool bOwnActionNecessary;
+ if (pHdl == NULL)
+ {
+ bOwnActionNecessary = sal_True;
+ }
+ else if (pHdl->IsVertexHdl() || pHdl->IsCornerHdl())
+ {
+ bOwnActionNecessary = sal_True;
+ }
+ else
+ {
+ bOwnActionNecessary = sal_False;
+ }
+
+ if(bOwnActionNecessary && GetMarkedObjectCount() >= 1)
+ {
+ E3dDragConstraint eConstraint = E3DDRAG_CONSTR_XYZ;
+ sal_Bool bThereAreRootScenes = sal_False;
+ sal_Bool bThereAre3DObjects = sal_False;
+ long nCnt = GetMarkedObjectCount();
+ for(long nObjs = 0;nObjs < nCnt;nObjs++)
+ {
+ SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
+ if(pObj)
+ {
+ if(pObj->ISA(E3dScene) && ((E3dScene*)pObj)->GetScene() == pObj)
+ bThereAreRootScenes = sal_True;
+ if(pObj->ISA(E3dObject))
+ bThereAre3DObjects = sal_True;
+ }
+ }
+ if( bThereAre3DObjects )
+ {
+ eDragHdl = ( pHdl == NULL ? HDL_MOVE : pHdl->GetKind() );
+ switch ( eDragMode )
+ {
+ case SDRDRAG_ROTATE:
+ case SDRDRAG_SHEAR:
+ {
+ switch ( eDragHdl )
+ {
+ case HDL_LEFT:
+ case HDL_RIGHT:
+ {
+ eConstraint = E3DDRAG_CONSTR_X;
+ }
+ break;
+
+ case HDL_UPPER:
+ case HDL_LOWER:
+ {
+ eConstraint = E3DDRAG_CONSTR_Y;
+ }
+ break;
+
+ case HDL_UPLFT:
+ case HDL_UPRGT:
+ case HDL_LWLFT:
+ case HDL_LWRGT:
+ {
+ eConstraint = E3DDRAG_CONSTR_Z;
+ }
+ break;
+ default: break;
+ }
+
+ // die nicht erlaubten Rotationen ausmaskieren
+ eConstraint = E3dDragConstraint(eConstraint& eDragConstraint);
+ pForcedMeth = new E3dDragRotate(*this, GetMarkedObjectList(), eConstraint, IsSolidDragging());
+ }
+ break;
+
+ case SDRDRAG_MOVE:
+ {
+ if(!bThereAreRootScenes)
+ {
+ pForcedMeth = new E3dDragMove(*this, GetMarkedObjectList(), eDragHdl, eConstraint, IsSolidDragging());
+ }
+ }
+ break;
+
+ // spaeter mal
+ case SDRDRAG_MIRROR:
+ case SDRDRAG_CROOK:
+ case SDRDRAG_DISTORT:
+ case SDRDRAG_TRANSPARENCE:
+ case SDRDRAG_GRADIENT:
+ default:
+ {
+ }
+ break;
+ }
+ }
+ }
+ }
+ return SdrView::BegDragObj(rPnt, pOut, pHdl, nMinMov, pForcedMeth);
+}
+
+/*************************************************************************
+|*
+|* Pruefen, obj 3D-Szene markiert ist
+|*
+\************************************************************************/
+
+sal_Bool E3dView::HasMarkedScene()
+{
+ return (GetMarkedScene() != NULL);
+}
+
+/*************************************************************************
+|*
+|* Pruefen, obj 3D-Szene markiert ist
+|*
+\************************************************************************/
+
+E3dScene* E3dView::GetMarkedScene()
+{
+ sal_uIntPtr nCnt = GetMarkedObjectCount();
+
+ for ( sal_uIntPtr i = 0; i < nCnt; i++ )
+ if ( GetMarkedObjectByIndex(i)->ISA(E3dScene) )
+ return (E3dScene*) GetMarkedObjectByIndex(i);
+
+ return NULL;
+}
+
+/*************************************************************************
+|*
+|* aktuelles 3D-Zeichenobjekt setzen, dafuer Szene erzeugen
+|*
+\************************************************************************/
+
+E3dScene* E3dView::SetCurrent3DObj(E3dObject* p3DObj)
+{
+ DBG_ASSERT(p3DObj != NULL, "Nana, wer steckt denn hier 'nen NULL-Zeiger rein?");
+ E3dScene* pScene = NULL;
+
+ // get transformed BoundVolume of the object
+ basegfx::B3DRange aVolume(p3DObj->GetBoundVolume());
+ aVolume.transform(p3DObj->GetTransform());
+ double fW(aVolume.getWidth());
+ double fH(aVolume.getHeight());
+
+ Rectangle aRect(0,0, (long) fW, (long) fH);
+
+ pScene = new E3dPolyScene(Get3DDefaultAttributes());
+
+ InitScene(pScene, fW, fH, aVolume.getMaxZ() + ((fW + fH) / 4.0));
+
+ pScene->Insert3DObj(p3DObj);
+ pScene->NbcSetSnapRect(aRect);
+
+ return pScene;
+}
+
+/*************************************************************************
+|*
+|* neu erzeugte Szene initialisieren
+|*
+\************************************************************************/
+
+void E3dView::InitScene(E3dScene* pScene, double fW, double fH, double fCamZ)
+{
+ Camera3D aCam(pScene->GetCamera());
+
+ aCam.SetAutoAdjustProjection(sal_False);
+ aCam.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
+ basegfx::B3DPoint aLookAt;
+
+ double fDefaultCamPosZ = GetDefaultCamPosZ();
+ basegfx::B3DPoint aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ);
+
+ aCam.SetPosAndLookAt(aCamPos, aLookAt);
+ aCam.SetFocalLength(GetDefaultCamFocal());
+ aCam.SetDefaults(basegfx::B3DPoint(0.0, 0.0, fDefaultCamPosZ), aLookAt, GetDefaultCamFocal());
+ pScene->SetCamera(aCam);
+}
+
+/*************************************************************************
+|*
+|* startsequenz fuer die erstellung eines 3D-Rotationskoerpers
+|*
+\************************************************************************/
+
+void E3dView::Start3DCreation()
+{
+ if (GetMarkedObjectCount())
+ {
+ // irgendwelche Markierungen ermitteln und ausschalten
+ //HMHBOOL bVis = IsMarkHdlShown();
+
+ //HMHif (bVis) HideMarkHdl();
+
+ // bestimme die koordinaten fuer JOEs Mirrorachse
+ // entgegen der normalen Achse wird diese an die linke Seite des Objektes
+ // positioniert
+ long nOutMin = 0;
+ long nOutMax = 0;
+ long nMinLen = 0;
+ long nObjDst = 0;
+ long nOutHgt = 0;
+ OutputDevice* pOut = GetFirstOutputDevice(); //GetWin(0);
+
+ // erstmal Darstellungsgrenzen bestimmen
+ if (pOut != NULL)
+ {
+ nMinLen = pOut->PixelToLogic(Size(0,50)).Height();
+ nObjDst = pOut->PixelToLogic(Size(0,20)).Height();
+
+ long nDst = pOut->PixelToLogic(Size(0,10)).Height();
+
+ nOutMin = -pOut->GetMapMode().GetOrigin().Y();
+ nOutMax = pOut->GetOutputSize().Height() - 1 + nOutMin;
+ nOutMin += nDst;
+ nOutMax -= nDst;
+
+ if (nOutMax - nOutMin < nDst)
+ {
+ nOutMin += nOutMax + 1;
+ nOutMin /= 2;
+ nOutMin -= (nDst + 1) / 2;
+ nOutMax = nOutMin + nDst;
+ }
+
+ nOutHgt = nOutMax - nOutMin;
+
+ long nTemp = nOutHgt / 4;
+ if (nTemp > nMinLen) nMinLen = nTemp;
+ }
+
+ // und dann die Markierungen oben und unten an das Objekt heften
+ basegfx::B2DRange aR;
+ for(sal_uInt32 nMark(0L); nMark < GetMarkedObjectCount(); nMark++)
+ {
+ SdrObject* pMark = GetMarkedObjectByIndex(nMark);
+ basegfx::B2DPolyPolygon aXPP(pMark->TakeXorPoly());
+ aR.expand(basegfx::tools::getRange(aXPP));
+ }
+
+ basegfx::B2DPoint aCenter(aR.getCenter());
+ long nMarkHgt = basegfx::fround(aR.getHeight()) - 1;
+ long nHgt = nMarkHgt + nObjDst * 2;
+
+ if (nHgt < nMinLen) nHgt = nMinLen;
+
+ long nY1 = basegfx::fround(aCenter.getY()) - (nHgt + 1) / 2;
+ long nY2 = nY1 + nHgt;
+
+ if (pOut && (nMinLen > nOutHgt)) nMinLen = nOutHgt;
+ if (pOut)
+ {
+ if (nY1 < nOutMin)
+ {
+ nY1 = nOutMin;
+ if (nY2 < nY1 + nMinLen) nY2 = nY1 + nMinLen;
+ }
+ if (nY2 > nOutMax)
+ {
+ nY2 = nOutMax;
+ if (nY1 > nY2 - nMinLen) nY1 = nY2 - nMinLen;
+ }
+ }
+
+ aRef1.X() = basegfx::fround(aR.getMinX()); // Initial Achse um 2/100mm nach links
+ aRef1.Y() = nY1;
+ aRef2.X() = aRef1.X();
+ aRef2.Y() = nY2;
+
+ // Markierungen einschalten
+ SetMarkHandles();
+
+ //HMHif (bVis) ShowMarkHdl();
+ if (AreObjectsMarked()) MarkListHasChanged();
+
+ // SpiegelPolygone SOFORT zeigen
+ const SdrHdlList &aHdlList = GetHdlList();
+ mpMirrorOverlay = new Impl3DMirrorConstructOverlay(*this);
+ mpMirrorOverlay->SetMirrorAxis(aHdlList.GetHdl(HDL_REF1)->GetPos(), aHdlList.GetHdl(HDL_REF2)->GetPos());
+ //CreateMirrorPolygons ();
+ //ShowMirrorPolygons (aHdlList.GetHdl (HDL_REF1)->GetPos (),
+ // aHdlList.GetHdl (HDL_REF2)->GetPos ());
+ }
+}
+
+/*************************************************************************
+|*
+|* was passiert bei einer Mausbewegung, wenn das Objekt erstellt wird ?
+|*
+\************************************************************************/
+
+void E3dView::MovAction(const Point& rPnt)
+{
+ if(Is3DRotationCreationActive())
+ {
+ SdrHdl* pHdl = GetDragHdl();
+
+ if (pHdl)
+ {
+ SdrHdlKind eHdlKind = pHdl->GetKind();
+
+ // reagiere nur bei einer spiegelachse
+ if ((eHdlKind == HDL_REF1) ||
+ (eHdlKind == HDL_REF2) ||
+ (eHdlKind == HDL_MIRX))
+ {
+ const SdrHdlList &aHdlList = GetHdlList ();
+
+ // loesche das gespiegelte Polygon, spiegele das Original und zeichne es neu
+ //ShowMirrored ();
+ SdrView::MovAction (rPnt);
+ mpMirrorOverlay->SetMirrorAxis(
+ aHdlList.GetHdl (HDL_REF1)->GetPos(),
+ aHdlList.GetHdl (HDL_REF2)->GetPos());
+ }
+ }
+ else
+ {
+ SdrView::MovAction (rPnt);
+ }
+ }
+ else
+ {
+ SdrView::MovAction (rPnt);
+ }
+}
+
+/*************************************************************************
+|*
+|* Schluss. Objekt und evtl. Unterobjekte ueber ImpCreate3DLathe erstellen
+|* [FG] Mit dem Parameterwert sal_True (SDefault: sal_False) wird einfach ein
+|* Rotationskoerper erzeugt, ohne den Benutzer die Lage der
+|* Achse fetlegen zu lassen. Es reicht dieser Aufruf, falls
+|* ein Objekt selektiert ist. (keine Initialisierung noetig)
+|*
+\************************************************************************/
+
+void E3dView::End3DCreation(sal_Bool bUseDefaultValuesForMirrorAxes)
+{
+ ResetCreationActive();
+
+ if(AreObjectsMarked())
+ {
+ if(bUseDefaultValuesForMirrorAxes)
+ {
+ Rectangle aRect = GetAllMarkedRect();
+ if(aRect.GetWidth() <= 1)
+ aRect.SetSize(Size(500, aRect.GetHeight()));
+ if(aRect.GetHeight() <= 1)
+ aRect.SetSize(Size(aRect.GetWidth(), 500));
+
+ basegfx::B2DPoint aPnt1(aRect.Left(), -aRect.Top());
+ basegfx::B2DPoint aPnt2(aRect.Left(), -aRect.Bottom());
+
+ ConvertMarkedObjTo3D(sal_False, aPnt1, aPnt2);
+ }
+ else
+ {
+ // Hilfsfigur ausschalten
+ // bestimme aus den Handlepositionen und den Versatz der Punkte
+ const SdrHdlList &aHdlList = GetHdlList();
+ Point aMirrorRef1 = aHdlList.GetHdl(HDL_REF1)->GetPos();
+ Point aMirrorRef2 = aHdlList.GetHdl(HDL_REF2)->GetPos();
+
+ basegfx::B2DPoint aPnt1(aMirrorRef1.X(), -aMirrorRef1.Y());
+ basegfx::B2DPoint aPnt2(aMirrorRef2.X(), -aMirrorRef2.Y());
+
+ ConvertMarkedObjTo3D(sal_False, aPnt1, aPnt2);
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+E3dView::~E3dView ()
+{
+}
+
+/*************************************************************************
+|*
+|* beende das erzeugen und loesche die polygone
+|*
+\************************************************************************/
+
+void E3dView::ResetCreationActive ()
+{
+ if(mpMirrorOverlay)
+ {
+ delete mpMirrorOverlay;
+ mpMirrorOverlay = 0L;
+ }
+}
+
+/*************************************************************************
+|*
+|* Klasse initialisieren
+|*
+\************************************************************************/
+
+void E3dView::InitView ()
+{
+ eDragConstraint = E3DDRAG_CONSTR_XYZ;
+ fDefaultScaleX =
+ fDefaultScaleY =
+ fDefaultScaleZ = 1.0;
+ fDefaultRotateX =
+ fDefaultRotateY =
+ fDefaultRotateZ = 0.0;
+ fDefaultExtrusionDeepth = 1000; // old: 2000;
+ fDefaultLightIntensity = 0.8; // old: 0.6;
+ fDefaultAmbientIntensity = 0.4;
+ nHDefaultSegments = 12;
+ nVDefaultSegments = 12;
+ aDefaultLightColor = RGB_Color(COL_WHITE);
+ aDefaultAmbientColor = RGB_Color(COL_BLACK);
+ bDoubleSided = sal_False;
+ mpMirrorOverlay = 0L;
+}
+
+/*************************************************************************
+|*
+|* Koennen die selektierten Objekte aufgebrochen werden?
+|*
+\************************************************************************/
+
+sal_Bool E3dView::IsBreak3DObjPossible() const
+{
+ sal_uIntPtr nCount = GetMarkedObjectCount();
+
+ if (nCount > 0)
+ {
+ sal_uIntPtr i = 0;
+
+ while (i < nCount)
+ {
+ SdrObject* pObj = GetMarkedObjectByIndex(i);
+
+ if (pObj && pObj->ISA(E3dObject))
+ {
+ if(!(((E3dObject*)pObj)->IsBreakObjPossible()))
+ return sal_False;
+ }
+ else
+ {
+ return sal_False;
+ }
+
+ i++;
+ }
+ }
+ else
+ {
+ return sal_False;
+ }
+
+ return sal_True;
+}
+
+/*************************************************************************
+|*
+|* Selektierte Lathe-Objekte aufbrechen
+|*
+\************************************************************************/
+
+void E3dView::Break3DObj()
+{
+ if(IsBreak3DObjPossible())
+ {
+ // ALLE selektierten Objekte werden gewandelt
+ sal_uInt32 nCount = GetMarkedObjectCount();
+
+ BegUndo(String(SVX_RESSTR(RID_SVX_3D_UNDO_BREAK_LATHE)));
+ for(sal_uInt32 a=0;a<nCount;a++)
+ {
+ E3dObject* pObj = (E3dObject*)GetMarkedObjectByIndex(a);
+ BreakSingle3DObj(pObj);
+ }
+ DeleteMarked();
+ EndUndo();
+ }
+}
+
+void E3dView::BreakSingle3DObj(E3dObject* pObj)
+{
+ if(pObj->ISA(E3dScene))
+ {
+ SdrObjList* pSubList = pObj->GetSubList();
+ SdrObjListIter aIter(*pSubList, IM_FLAT);
+
+ while(aIter.IsMore())
+ {
+ E3dObject* pSubObj = (E3dObject*)aIter.Next();
+ BreakSingle3DObj(pSubObj);
+ }
+ }
+ else
+ {
+ SdrAttrObj* pNewObj = pObj->GetBreakObj();
+ if(pNewObj)
+ {
+ InsertObjectAtView(pNewObj, *GetSdrPageView(), SDRINSERT_DONTMARK);
+ pNewObj->SetChanged();
+ pNewObj->BroadcastObjectChange();
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Szenen mischen
+|*
+\************************************************************************/
+
+void E3dView::MergeScenes ()
+{
+ sal_uIntPtr nCount = GetMarkedObjectCount();
+
+ if (nCount > 0)
+ {
+ sal_uIntPtr nObj = 0;
+ SdrObject *pObj = GetMarkedObjectByIndex(nObj);
+ E3dScene *pScene = new E3dPolyScene(Get3DDefaultAttributes());
+ basegfx::B3DRange aBoundVol;
+ Rectangle aAllBoundRect (GetMarkedObjBoundRect ());
+ Point aCenter (aAllBoundRect.Center());
+
+ while (pObj)
+ {
+ if (pObj->ISA(E3dScene))
+ {
+ /**********************************************************
+ * Es ist eine 3D-Scene oder 3D-PolyScene
+ **********************************************************/
+ SdrObjList* pSubList = ((E3dObject*) pObj)->GetSubList();
+
+ SdrObjListIter aIter(*pSubList, IM_FLAT);
+
+ while (aIter.IsMore())
+ {
+ /******************************************************
+ * LatheObjekte suchen
+ ******************************************************/
+ SdrObject* pSubObj = aIter.Next();
+
+ E3dObject *pNewObj = 0;
+
+ switch (pSubObj->GetObjIdentifier())
+ {
+ case E3D_CUBEOBJ_ID :
+ pNewObj = new E3dCubeObj;
+ *(E3dCubeObj*)pNewObj = *(E3dCubeObj*)pSubObj;
+ break;
+
+ case E3D_SPHEREOBJ_ID:
+ pNewObj = new E3dSphereObj;
+ *(E3dSphereObj*)pNewObj = *(E3dSphereObj*)pSubObj;
+ break;
+
+ case E3D_EXTRUDEOBJ_ID:
+ pNewObj = new E3dExtrudeObj;
+ *(E3dExtrudeObj*)pNewObj = *(E3dExtrudeObj*)pSubObj;
+ break;
+
+ case E3D_LATHEOBJ_ID:
+ pNewObj = new E3dLatheObj;
+ *(E3dLatheObj*)pNewObj = *(E3dLatheObj*)pSubObj;
+ break;
+
+ case E3D_COMPOUNDOBJ_ID:
+ pNewObj = new E3dCompoundObject;
+ *(E3dCompoundObject*)pNewObj = *(E3dCompoundObject*)pSubObj;
+ break;
+ }
+
+ Rectangle aBoundRect = pSubObj->GetCurrentBoundRect();
+
+ basegfx::B3DHomMatrix aMatrix;
+ aMatrix.translate(aBoundRect.Left() - aCenter.getX(), aCenter.getY(), 0.0);
+ pNewObj->SetTransform(aMatrix * pNewObj->GetTransform()); // #112587#
+
+ if (pNewObj) aBoundVol.expand(pNewObj->GetBoundVolume());
+ pScene->Insert3DObj (pNewObj);
+ }
+ }
+
+ nObj++;
+
+ if (nObj < nCount)
+ {
+ pObj = GetMarkedObjectByIndex(nObj);
+ }
+ else
+ {
+ pObj = NULL;
+ }
+ }
+
+ double fW = aAllBoundRect.GetWidth();
+ double fH = aAllBoundRect.GetHeight();
+ Rectangle aRect(0,0, (long) fW, (long) fH);
+
+ InitScene(pScene, fW, fH, aBoundVol.getMaxZ() + + ((fW + fH) / 4.0));
+ pScene->NbcSetSnapRect(aRect);
+
+ Camera3D &aCamera = (Camera3D&) pScene->GetCamera ();
+ basegfx::B3DPoint aMinVec(aBoundVol.getMinimum());
+ basegfx::B3DPoint aMaxVec(aBoundVol.getMaximum());
+ double fDeepth(fabs(aMaxVec.getZ() - aMinVec.getZ()));
+
+ aCamera.SetPRP(basegfx::B3DPoint(0.0, 0.0, 1000.0));
+ double fDefaultCamPosZ(GetDefaultCamPosZ());
+ aCamera.SetPosition(basegfx::B3DPoint(0.0, 0.0, fDefaultCamPosZ + fDeepth / 2.0));
+ aCamera.SetFocalLength(GetDefaultCamFocal());
+ pScene->SetCamera (aCamera);
+
+ // SnapRects der Objekte ungueltig
+ pScene->SetRectsDirty();
+
+ InsertObjectAtView(pScene, *(GetSdrPageViewOfMarkedByIndex(0)));
+
+ // SnapRects der Objekte ungueltig
+ pScene->SetRectsDirty();
+ }
+}
+
+/*************************************************************************
+|*
+|* Possibilities, hauptsaechlich gruppieren/ungruppieren
+|*
+\************************************************************************/
+void E3dView::CheckPossibilities()
+{
+ // call parent
+ SdrView::CheckPossibilities();
+
+ // Weitere Flags bewerten
+ if(bGroupPossible || bUnGroupPossible || bGrpEnterPossible)
+ {
+ sal_Int32 nMarkCnt = GetMarkedObjectCount();
+ sal_Bool bCoumpound = sal_False;
+ sal_Bool b3DObject = sal_False;
+ for(sal_Int32 nObjs = 0L; (nObjs < nMarkCnt) && !bCoumpound; nObjs++)
+ {
+ SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
+ if(pObj && pObj->ISA(E3dCompoundObject))
+ bCoumpound = sal_True;
+ if(pObj && pObj->ISA(E3dObject))
+ b3DObject = sal_True;
+ }
+
+ // Bisher: Es sind ZWEI oder mehr beliebiger Objekte selektiert.
+ // Nachsehen, ob CompoundObjects beteiligt sind. Falls ja,
+ // das Gruppieren verbieten.
+ if(bGroupPossible && bCoumpound)
+ bGroupPossible = sal_False;
+
+ if(bUnGroupPossible && b3DObject)
+ bUnGroupPossible = sal_False;
+
+ if(bGrpEnterPossible && bCoumpound)
+ bGrpEnterPossible = sal_False;
+ }
+}
+
+// eof
diff --git a/svx/source/engine3d/view3d1.cxx b/svx/source/engine3d/view3d1.cxx
new file mode 100644
index 000000000000..6dd4dd816450
--- /dev/null
+++ b/svx/source/engine3d/view3d1.cxx
@@ -0,0 +1,230 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <tools/shl.hxx>
+#include "svx/svditer.hxx"
+#include <svx/svdpool.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svxids.hrc>
+#include <svx/xtable.hxx>
+#include <svx/fmview.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include "svx/globl3d.hxx"
+#include <svx/obj3d.hxx>
+#include <svx/polysc3d.hxx>
+#include <svx/e3ditem.hxx>
+#include <editeng/colritem.hxx>
+#include <svx/lathe3d.hxx>
+#include <svx/sphere3d.hxx>
+#include <svx/extrud3d.hxx>
+#include <svx/e3dundo.hxx>
+#include <svx/view3d.hxx>
+#include <svx/cube3d.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/e3dsceneupdater.hxx>
+
+/*************************************************************************
+|*
+|* Konvertierung in Polygone
+|*
+\************************************************************************/
+
+void E3dView::ConvertMarkedToPolyObj(sal_Bool bLineToArea)
+{
+ SdrObject* pNewObj = NULL;
+
+ if (GetMarkedObjectCount() == 1)
+ {
+ SdrObject* pObj = GetMarkedObjectByIndex(0);
+
+ if (pObj && pObj->ISA(E3dPolyScene))
+ {
+ sal_Bool bBezier = sal_False;
+ pNewObj = ((E3dPolyScene*) pObj)->ConvertToPolyObj(bBezier, bLineToArea);
+
+ if (pNewObj)
+ {
+ BegUndo(SVX_RESSTR(RID_SVX_3D_UNDO_EXTRUDE));
+ ReplaceObjectAtView(pObj, *GetSdrPageView(), pNewObj);
+ EndUndo();
+ }
+ }
+ }
+
+ if (!pNewObj)
+ {
+ SdrView::ConvertMarkedToPolyObj(bLineToArea);
+ }
+}
+
+/*************************************************************************
+|*
+|* Get3DAttributes
+|*
+\************************************************************************/
+
+void Imp_E3dView_InorderRun3DObjects(const SdrObject* pObj, sal_uInt32& rMask)
+{
+ if(pObj->ISA(E3dLatheObj))
+ {
+ rMask |= 0x0001;
+ }
+ else if(pObj->ISA(E3dExtrudeObj))
+ {
+ rMask |= 0x0002;
+ }
+ else if(pObj->ISA(E3dSphereObj))
+ {
+ rMask |= 0x0004;
+ }
+ else if(pObj->ISA(E3dCubeObj))
+ {
+ rMask |= 0x0008;
+ }
+ else if(pObj->IsGroupObject())
+ {
+ SdrObjList* pList = pObj->GetSubList();
+ for(sal_uInt32 a(0); a < pList->GetObjCount(); a++)
+ Imp_E3dView_InorderRun3DObjects(pList->GetObj(a), rMask);
+ }
+}
+
+SfxItemSet E3dView::Get3DAttributes(E3dScene* pInScene, sal_Bool /*bOnly3DAttr*/) const
+{
+ // ItemSet mit entspr. Bereich anlegen
+ SfxItemSet aSet(
+ pMod->GetItemPool(),
+ SDRATTR_START, SDRATTR_END,
+ SID_ATTR_3D_INTERN, SID_ATTR_3D_INTERN,
+ 0, 0);
+
+ sal_uInt32 nSelectedItems(0L);
+
+ if(pInScene)
+ {
+ // special scene
+ aSet.Put(pInScene->GetMergedItemSet());
+ }
+ else
+ {
+ // get attributes from all selected objects
+ MergeAttrFromMarked(aSet, sal_False);
+
+ // calc flags for SID_ATTR_3D_INTERN
+ const SdrMarkList& rMarkList = GetMarkedObjectList();
+ sal_uInt32 nMarkCnt(rMarkList.GetMarkCount());
+
+ for(sal_uInt32 a(0); a < nMarkCnt; a++)
+ {
+ SdrObject* pObj = GetMarkedObjectByIndex(a);
+ Imp_E3dView_InorderRun3DObjects(pObj, nSelectedItems);
+ }
+ }
+
+ // setze SID_ATTR_3D_INTERN auf den Status der selektierten Objekte
+ aSet.Put(SfxUInt32Item(SID_ATTR_3D_INTERN, nSelectedItems));
+
+ // DefaultValues pflegen
+ if(!nSelectedItems && !pInScene)
+ {
+ // Defaults holen und hinzufuegen
+ SfxItemSet aDefaultSet(pMod->GetItemPool(), SDRATTR_3D_FIRST, SDRATTR_3D_LAST);
+ GetAttributes(aDefaultSet);
+ aSet.Put(aDefaultSet);
+
+ // ... aber keine Linien fuer 3D
+ aSet.Put(XLineStyleItem (XLINE_NONE));
+
+ // #84061# new defaults for distance and focal length
+ aSet.Put(Svx3DDistanceItem(100));
+ aSet.Put(Svx3DFocalLengthItem(10000));
+ }
+
+ // ItemSet zurueckgeben
+ return(aSet);
+}
+
+/*************************************************************************
+|*
+|* Set3DAttributes:
+|*
+\************************************************************************/
+
+void E3dView::Set3DAttributes( const SfxItemSet& rAttr, E3dScene* pInScene, sal_Bool bReplaceAll)
+{
+ sal_uInt32 nSelectedItems(0L);
+
+ if(pInScene)
+ {
+ //pInScene->SetItemSetAndBroadcast(rAttr, bReplaceAll);
+ pInScene->SetMergedItemSetAndBroadcast(rAttr, bReplaceAll);
+ }
+ else
+ {
+ // #i94832# removed usage of E3DModifySceneSnapRectUpdater here.
+ // They are not needed here, they are already handled in SetAttrToMarked
+
+ // set at selected objects
+ SetAttrToMarked(rAttr, bReplaceAll);
+
+ // old run
+ const SdrMarkList& rMarkList = GetMarkedObjectList();
+ const sal_uInt32 nMarkCnt(rMarkList.GetMarkCount());
+
+ for(sal_uInt32 a(0); a < nMarkCnt; a++)
+ {
+ SdrObject* pObj = GetMarkedObjectByIndex(a);
+ Imp_E3dView_InorderRun3DObjects(pObj, nSelectedItems);
+ }
+ }
+
+ // DefaultValues pflegen
+ if(!nSelectedItems && !pInScene)
+ {
+ // Defaults setzen
+ SfxItemSet aDefaultSet(pMod->GetItemPool(), SDRATTR_3D_FIRST, SDRATTR_3D_LAST);
+ aDefaultSet.Put(rAttr);
+ SetAttributes(aDefaultSet);
+
+ }
+}
+
+double E3dView::GetDefaultCamPosZ()
+{
+ return (double)((const SfxUInt32Item&)pMod->GetItemPool().GetDefaultItem(SDRATTR_3DSCENE_DISTANCE)).GetValue();
+}
+
+double E3dView::GetDefaultCamFocal()
+{
+ return (double)((const SfxUInt32Item&)pMod->GetItemPool().GetDefaultItem(SDRATTR_3DSCENE_FOCAL_LENGTH)).GetValue();
+}
+
diff --git a/svx/source/engine3d/viewpt3d2.cxx b/svx/source/engine3d/viewpt3d2.cxx
new file mode 100644
index 000000000000..bbfe84fafbf2
--- /dev/null
+++ b/svx/source/engine3d/viewpt3d2.cxx
@@ -0,0 +1,394 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/viewpt3d.hxx>
+#include <svx/volume3d.hxx>
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+Viewport3D::Viewport3D() :
+ aVRP(0, 0, 5),
+ aVPN(0, 0, 1),
+ aVUV(0, 1, 1),
+ aPRP(0, 0, 2),
+ fVPD(-3),
+ fNearClipDist (0.0),
+ fFarClipDist (0.0),
+ eProjection(PR_PERSPECTIVE),
+ eAspectMapping(AS_NO_MAPPING),
+ aDeviceRect(Point(0,0), Size(-1,-1)),
+ aViewPoint (0, 0, 5000),
+ bTfValid(0),
+ fWRatio (1.0),
+ fHRatio (1.0)
+{
+ aViewWin.X = -1; aViewWin.Y = -1;
+ aViewWin.W = 2; aViewWin.H = 2;
+}
+
+/*************************************************************************
+|*
+|* ViewWindow (in View-Koordinaten) setzen
+|*
+\************************************************************************/
+
+void Viewport3D::SetViewWindow(double fX, double fY, double fW, double fH)
+{
+ aViewWin.X = fX;
+ aViewWin.Y = fY;
+ if ( fW > 0 ) aViewWin.W = fW;
+ else aViewWin.W = 1.0;
+ if ( fH > 0 ) aViewWin.H = fH;
+ else aViewWin.H = 1.0;
+
+ fWRatio = aDeviceRect.GetWidth() / aViewWin.W;
+ fHRatio = aDeviceRect.GetHeight() / aViewWin.H;
+}
+
+/*************************************************************************
+|*
+|* ViewWindow zurueckgeben
+|*
+\************************************************************************/
+
+void Viewport3D::GetViewWindow(double& rX, double& rY,
+ double& rW, double& rH) const
+{
+ rX = aViewWin.X;
+ rY = aViewWin.Y;
+ rW = aViewWin.W;
+ rH = aViewWin.H;
+}
+
+/*************************************************************************
+|*
+|* Beobachterposition (PRP) in Weltkoordinaten zurueckgeben
+|*
+\************************************************************************/
+
+const basegfx::B3DPoint& Viewport3D::GetViewPoint()
+{
+ MakeTransform();
+
+ return aViewPoint;
+}
+
+/*************************************************************************
+|*
+|* Transformationsmatrix zurueckgeben
+|*
+\************************************************************************/
+
+const basegfx::B3DHomMatrix& Viewport3D::GetViewTransform()
+{
+ MakeTransform();
+
+ return aViewTf;
+}
+
+
+
+
+
+
+
+/*************************************************************************
+|*
+|* View-Transformationsmatrix berechnen
+|*
+\************************************************************************/
+
+void Viewport3D::MakeTransform(void)
+{
+ if ( !bTfValid )
+ {
+ double fV, fXupVp, fYupVp;
+ aViewPoint = aVRP + aVPN * aPRP.getZ();
+
+ // auf Einheitsmatrix zuruecksetzen
+ aViewTf.identity();
+
+ // in den Ursprung verschieben
+ aViewTf.translate(-aVRP.getX(), -aVRP.getY(), -aVRP.getZ());
+
+ // fV = Laenge der Projektion von aVPN auf die yz-Ebene:
+ fV = aVPN.getYZLength();
+
+ if ( fV != 0 )
+ {
+ basegfx::B3DHomMatrix aTemp;
+ const double fSin(aVPN.getY() / fV);
+ const double fCos(aVPN.getZ() / fV);
+ aTemp.set(2, 2, fCos);
+ aTemp.set(1, 1, fCos);
+ aTemp.set(2, 1, fSin);
+ aTemp.set(1, 2, -fSin);
+ aViewTf *= aTemp;
+ }
+
+ {
+ basegfx::B3DHomMatrix aTemp;
+ const double fSin(-aVPN.getX());
+ const double fCos(fV);
+ aTemp.set(2, 2, fCos);
+ aTemp.set(0, 0, fCos);
+ aTemp.set(0, 2, fSin);
+ aTemp.set(2, 0, -fSin);
+ aViewTf *= aTemp;
+ }
+
+ // X- und Y-Koordinaten des View Up Vektors in das (vorlaeufige)
+ // View-Koordinatensytem umrechnen
+ fXupVp = aViewTf.get(0, 0) * aVUV.getX() + aViewTf.get(0, 1) * aVUV.getY() + aViewTf.get(0, 2) * aVUV.getZ();
+ fYupVp = aViewTf.get(1, 0) * aVUV.getX() + aViewTf.get(1, 1) * aVUV.getY() + aViewTf.get(1, 2) * aVUV.getZ();
+ fV = sqrt(fXupVp * fXupVp + fYupVp * fYupVp);
+
+ if ( fV != 0 )
+ {
+ basegfx::B3DHomMatrix aTemp;
+ const double fSin(fXupVp / fV);
+ const double fCos(fYupVp / fV);
+ aTemp.set(1, 1, fCos);
+ aTemp.set(0, 0, fCos);
+ aTemp.set(1, 0, fSin);
+ aTemp.set(0, 1, -fSin);
+ aViewTf *= aTemp;
+ }
+
+ bTfValid = sal_True;
+ }
+}
+
+/*************************************************************************
+|*
+|* DeviceWindow des Ausgabegeraetes setzen
+|*
+\************************************************************************/
+
+void Viewport3D::SetDeviceWindow(const Rectangle& rRect)
+{
+ long nNewW = rRect.GetWidth();
+ long nNewH = rRect.GetHeight();
+ long nOldW = aDeviceRect.GetWidth();
+ long nOldH = aDeviceRect.GetHeight();
+
+ switch ( eAspectMapping )
+ {
+ double fRatio, fTmp;
+
+ // Mapping, ohne die reale Groesse der Objekte im Device-Window
+ // zu aendern
+ case AS_HOLD_SIZE:
+ // Wenn Device ungueltig (w, h = -1), zunaechst
+ // View mit AsHoldX anpassen
+ if ( nOldW > 0 && nOldH > 0 )
+ {
+ fRatio = (double) nNewW / nOldW;
+ aViewWin.X *= fRatio;
+ aViewWin.W *= fRatio;
+ fRatio = (double) nNewH / nOldH;
+ aViewWin.Y *= fRatio;
+ aViewWin.H *= fRatio;
+ break;
+ }
+ case AS_HOLD_X:
+ // View-Hoehe an -Breite anpassen
+ fRatio = (double) nNewH / nNewW;
+ fTmp = aViewWin.H;
+ aViewWin.H = aViewWin.W * fRatio;
+ aViewWin.Y = aViewWin.Y * aViewWin.H / fTmp;
+ break;
+
+ case AS_HOLD_Y:
+ // View-Breite an -Hoehe anpassen
+ fRatio = (double) nNewW / nNewH;
+ fTmp = aViewWin.W;
+ aViewWin.W = aViewWin.H * fRatio;
+ aViewWin.X = aViewWin.X * aViewWin.W / fTmp;
+ break;
+ default: break;
+ }
+ fWRatio = nNewW / aViewWin.W;
+ fHRatio = nNewH / aViewWin.H;
+
+ aDeviceRect = rRect;
+}
+
+
+
+
+
+
+
+
+
+
+/*************************************************************************
+|*
+|* 3D-Punkt auf Viewplane projizieren
+|*
+\************************************************************************/
+
+basegfx::B3DPoint Viewport3D::DoProjection(const basegfx::B3DPoint& rVec) const
+{
+ basegfx::B3DPoint aVec(rVec);
+
+ if ( eProjection == PR_PERSPECTIVE )
+ {
+ double fPrDist = fVPD - aPRP.getZ();
+
+ if ( aPRP.getZ() == rVec.getZ() )
+ {
+ aVec.setX(0.0);
+ aVec.setY(0.0);
+ }
+ else
+ {
+ // Das ist die Version fuer beliebigen PRP, wird aber
+ // aus Performancegruenden nicht verwendet
+ fPrDist /= aVec.getZ() - aPRP.getZ();
+ aVec.setX(aVec.getX() * fPrDist);
+ aVec.setY(aVec.getY() * fPrDist);
+ }
+ }
+
+ return aVec;
+}
+
+/*************************************************************************
+|*
+|* 3D-Punkt auf Geraetekoordinaten mappen
+|*
+\************************************************************************/
+
+basegfx::B3DPoint Viewport3D::MapToDevice(const basegfx::B3DPoint& rVec) const
+{
+ basegfx::B3DPoint aRetval;
+
+ // Y-Koordinate subtrahieren, da die Device-Y-Achse von oben
+ // nach unten verlaeuft
+ aRetval.setX((double)aDeviceRect.Left() + ((rVec.getX() - aViewWin.X) * fWRatio));
+ aRetval.setY((double)aDeviceRect.Bottom() - ((rVec.getY() - aViewWin.Y) * fHRatio));
+ aRetval.setZ(rVec.getZ());
+
+ return aRetval;
+}
+
+/*************************************************************************
+|*
+|* View Reference Point setzen
+|*
+\************************************************************************/
+
+void Viewport3D::SetVRP(const basegfx::B3DPoint& rNewVRP)
+{
+ aVRP = rNewVRP;
+ bTfValid = sal_False;
+}
+
+/*************************************************************************
+|*
+|* View Plane Normal setzen
+|*
+\************************************************************************/
+
+void Viewport3D::SetVPN(const basegfx::B3DVector& rNewVPN)
+{
+ aVPN = rNewVPN;
+ aVPN.normalize();
+ bTfValid = sal_False;
+}
+
+/*************************************************************************
+|*
+|* View Up Vector setzen
+|*
+\************************************************************************/
+
+void Viewport3D::SetVUV(const basegfx::B3DVector& rNewVUV)
+{
+ aVUV = rNewVUV;
+ bTfValid = sal_False;
+}
+
+/*************************************************************************
+|*
+|* Center Of Projection setzen
+|*
+\************************************************************************/
+
+void Viewport3D::SetPRP(const basegfx::B3DPoint& rNewPRP)
+{
+ aPRP = rNewPRP;
+ aPRP.setX(0.0);
+ aPRP.setY(0.0);
+ bTfValid = sal_False;
+}
+
+/*************************************************************************
+|*
+|* View Plane Distance setzen
+|*
+\************************************************************************/
+
+void Viewport3D::SetVPD(double fNewVPD)
+{
+ fVPD = fNewVPD;
+ bTfValid = sal_False;
+}
+
+/*************************************************************************
+|*
+|* Abstand der vorderen Clippingebene setzen
+|*
+\************************************************************************/
+
+void Viewport3D::SetNearClipDist(double fNewNCD)
+{
+ fNearClipDist = fNewNCD;
+ bTfValid = sal_False;
+}
+
+/*************************************************************************
+|*
+|* Abstand der hinteren Clippingebene setzen
+|*
+\************************************************************************/
+
+void Viewport3D::SetFarClipDist(double fNewFCD)
+{
+ fFarClipDist = fNewFCD;
+ bTfValid = sal_False;
+}
+
+// eof
diff --git a/svx/source/fmcomp/dbaexchange.cxx b/svx/source/fmcomp/dbaexchange.cxx
new file mode 100644
index 000000000000..9b5b6eae07f4
--- /dev/null
+++ b/svx/source/fmcomp/dbaexchange.cxx
@@ -0,0 +1,732 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/dbaexchange.hxx>
+#include <osl/diagnose.h>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#include <com/sun/star/sdb/XSQLQueryComposerFactory.hpp>
+#include <com/sun/star/sdb/XSQLQueryComposerFactory.hpp>
+#ifndef _SVX_FMPROP_HRC
+#include "fmprop.hrc"
+#endif
+#include <comphelper/extract.hxx>
+#include <sot/formats.hxx>
+#include <sot/exchange.hxx>
+#include <comphelper/propertysetinfo.hxx>
+#ifndef _SVX_FMPROP_HRC
+#include "fmprop.hrc"
+#endif
+#include <tools/urlobj.hxx>
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::sdb;
+ using namespace ::com::sun::star::sdbc;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::sdbcx;
+ using namespace ::com::sun::star::container;
+ using namespace ::com::sun::star::datatransfer;
+ using namespace ::comphelper;
+
+ //====================================================================
+ //= OColumnTransferable
+ //====================================================================
+ //--------------------------------------------------------------------
+ OColumnTransferable::OColumnTransferable(const ::rtl::OUString& _rDatasource
+ ,const ::rtl::OUString& _rConnectionResource
+ ,const sal_Int32 _nCommandType
+ ,const ::rtl::OUString& _rCommand
+ ,const ::rtl::OUString& _rFieldName
+ ,sal_Int32 _nFormats)
+ :m_nFormatFlags(_nFormats)
+ {
+ implConstruct(_rDatasource,_rConnectionResource,_nCommandType, _rCommand, _rFieldName);
+ }
+
+ //--------------------------------------------------------------------
+ OColumnTransferable::OColumnTransferable(const ODataAccessDescriptor& _rDescriptor, sal_Int32 _nFormats )
+ :m_nFormatFlags(_nFormats)
+ {
+ ::rtl::OUString sDataSource, sDatabaseLocation, sConnectionResource, sCommand, sFieldName;
+ if ( _rDescriptor.has( daDataSource ) ) _rDescriptor[ daDataSource ] >>= sDataSource;
+ if ( _rDescriptor.has( daDatabaseLocation ) ) _rDescriptor[ daDatabaseLocation ] >>= sDatabaseLocation;
+ if ( _rDescriptor.has( daConnectionResource ) ) _rDescriptor[ daConnectionResource ] >>= sConnectionResource;
+ if ( _rDescriptor.has( daCommand ) ) _rDescriptor[ daCommand ] >>= sCommand;
+ if ( _rDescriptor.has( daColumnName ) ) _rDescriptor[ daColumnName ] >>= sFieldName;
+
+ sal_Int32 nCommandType = CommandType::TABLE;
+ OSL_VERIFY( _rDescriptor[ daCommandType ] >>= nCommandType );
+
+
+ implConstruct(
+ sDataSource.getLength() ? sDataSource : sDatabaseLocation,
+ sConnectionResource, nCommandType, sCommand, sFieldName );
+
+ if ( m_nFormatFlags & CTF_COLUMN_DESCRIPTOR )
+ {
+ if ( _rDescriptor.has( daConnection ) )
+ m_aDescriptor[ daConnection ] = _rDescriptor[ daConnection ];
+ if ( _rDescriptor.has( daColumnObject ) )
+ m_aDescriptor[ daColumnObject ] = _rDescriptor[ daColumnObject ];
+ }
+ }
+
+ //--------------------------------------------------------------------
+ OColumnTransferable::OColumnTransferable(const Reference< XPropertySet >& _rxForm,
+ const ::rtl::OUString& _rFieldName, const Reference< XPropertySet >& _rxColumn,
+ const Reference< XConnection >& _rxConnection, sal_Int32 _nFormats)
+ :m_nFormatFlags(_nFormats)
+ {
+ OSL_ENSURE(_rxForm.is(), "OColumnTransferable::OColumnTransferable: invalid form!");
+ // collect the necessary information from the form
+ ::rtl::OUString sCommand;
+ sal_Int32 nCommandType = CommandType::TABLE;
+ ::rtl::OUString sDatasource,sURL;
+
+ sal_Bool bTryToParse = sal_True;
+ try
+ {
+ _rxForm->getPropertyValue(FM_PROP_COMMANDTYPE) >>= nCommandType;
+ _rxForm->getPropertyValue(FM_PROP_COMMAND) >>= sCommand;
+ _rxForm->getPropertyValue(FM_PROP_DATASOURCE) >>= sDatasource;
+ _rxForm->getPropertyValue(FM_PROP_URL) >>= sURL;
+ bTryToParse = ::cppu::any2bool(_rxForm->getPropertyValue(FM_PROP_ESCAPE_PROCESSING));
+ }
+ catch(Exception&)
+ {
+ OSL_ENSURE(sal_False, "OColumnTransferable::OColumnTransferable: could not collect essential data source attributes !");
+ }
+
+ // If the data source is an SQL-statement and simple enough (means "select <field list> from <table> where ....")
+ // we are able to fake the drag information we are about to create.
+ if (bTryToParse && (CommandType::COMMAND == nCommandType))
+ {
+ try
+ {
+ Reference< XTablesSupplier > xSupTab;
+ _rxForm->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SingleSelectQueryComposer"))) >>= xSupTab;
+
+ if(xSupTab.is())
+ {
+ Reference< XNameAccess > xNames = xSupTab->getTables();
+ if (xNames.is())
+ {
+ Sequence< ::rtl::OUString > aTables = xNames->getElementNames();
+ if (1 == aTables.getLength())
+ {
+ sCommand = aTables[0];
+ nCommandType = CommandType::TABLE;
+ }
+ }
+ }
+ }
+ catch(Exception&)
+ {
+ OSL_ENSURE(sal_False, "OColumnTransferable::OColumnTransferable: could not collect essential data source attributes (part two) !");
+ }
+ }
+
+ implConstruct(sDatasource, sURL,nCommandType, sCommand, _rFieldName);
+
+ if ((m_nFormatFlags & CTF_COLUMN_DESCRIPTOR) == CTF_COLUMN_DESCRIPTOR)
+ {
+ if (_rxColumn.is())
+ m_aDescriptor[daColumnObject] <<= _rxColumn;
+ if (_rxConnection.is())
+ m_aDescriptor[daConnection] <<= _rxConnection;
+ }
+ }
+
+ //--------------------------------------------------------------------
+ sal_uInt32 OColumnTransferable::getDescriptorFormatId()
+ {
+ static sal_uInt32 s_nFormat = (sal_uInt32)-1;
+ if ((sal_uInt32)-1 == s_nFormat)
+ {
+ s_nFormat = SotExchange::RegisterFormatName(String::CreateFromAscii("application/x-openoffice;windows_formatname=\"dbaccess.ColumnDescriptorTransfer\""));
+ OSL_ENSURE((sal_uInt32)-1 != s_nFormat, "OColumnTransferable::getDescriptorFormatId: bad exchange id!");
+ }
+ return s_nFormat;
+ }
+
+ //--------------------------------------------------------------------
+ void OColumnTransferable::implConstruct( const ::rtl::OUString& _rDatasource
+ ,const ::rtl::OUString& _rConnectionResource
+ ,const sal_Int32 _nCommandType
+ ,const ::rtl::OUString& _rCommand
+ , const ::rtl::OUString& _rFieldName)
+ {
+ const sal_Unicode cSeparator = sal_Unicode(11);
+ const ::rtl::OUString sSeparator(&cSeparator, 1);
+
+ m_sCompatibleFormat = ::rtl::OUString();
+ m_sCompatibleFormat += _rDatasource;
+ m_sCompatibleFormat += sSeparator;
+ m_sCompatibleFormat += _rCommand;
+ m_sCompatibleFormat += sSeparator;
+
+ sal_Unicode cCommandType;
+ switch (_nCommandType)
+ {
+ case CommandType::TABLE:
+ cCommandType = '0';
+ break;
+ case CommandType::QUERY:
+ cCommandType = '1';
+ break;
+ default:
+ cCommandType = '2';
+ break;
+ }
+ m_sCompatibleFormat += ::rtl::OUString(&cCommandType, 1);
+ m_sCompatibleFormat += sSeparator;
+ m_sCompatibleFormat += _rFieldName;
+
+ m_aDescriptor.clear();
+ if ((m_nFormatFlags & CTF_COLUMN_DESCRIPTOR) == CTF_COLUMN_DESCRIPTOR)
+ {
+ m_aDescriptor.setDataSource(_rDatasource);
+ if ( _rConnectionResource.getLength() )
+ m_aDescriptor[daConnectionResource] <<= _rConnectionResource;
+
+ m_aDescriptor[daCommand] <<= _rCommand;
+ m_aDescriptor[daCommandType] <<= _nCommandType;
+ m_aDescriptor[daColumnName] <<= _rFieldName;
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void OColumnTransferable::AddSupportedFormats()
+ {
+ if (CTF_CONTROL_EXCHANGE & m_nFormatFlags)
+ AddFormat(SOT_FORMATSTR_ID_SBA_CTRLDATAEXCHANGE);
+
+ if (CTF_FIELD_DESCRIPTOR & m_nFormatFlags)
+ AddFormat(SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE);
+
+ if (CTF_COLUMN_DESCRIPTOR & m_nFormatFlags)
+ AddFormat(getDescriptorFormatId());
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool OColumnTransferable::GetData( const DataFlavor& _rFlavor )
+ {
+ const sal_uInt32 nFormatId = SotExchange::GetFormat(_rFlavor);
+ switch (nFormatId)
+ {
+ case SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE:
+ case SOT_FORMATSTR_ID_SBA_CTRLDATAEXCHANGE:
+ return SetString(m_sCompatibleFormat, _rFlavor);
+ }
+ if (nFormatId == getDescriptorFormatId())
+ return SetAny( makeAny( m_aDescriptor.createPropertyValueSequence() ), _rFlavor );
+
+ return sal_False;
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool OColumnTransferable::canExtractColumnDescriptor(const DataFlavorExVector& _rFlavors, sal_Int32 _nFormats)
+ {
+ sal_Bool bFieldFormat = 0 != (_nFormats & CTF_FIELD_DESCRIPTOR);
+ sal_Bool bControlFormat = 0 != (_nFormats & CTF_CONTROL_EXCHANGE);
+ sal_Bool bDescriptorFormat = 0 != (_nFormats & CTF_COLUMN_DESCRIPTOR);
+ for ( DataFlavorExVector::const_iterator aCheck = _rFlavors.begin();
+ aCheck != _rFlavors.end();
+ ++aCheck
+ )
+ {
+ if (bFieldFormat && (SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE == aCheck->mnSotId))
+ return sal_True;
+ if (bControlFormat && (SOT_FORMATSTR_ID_SBA_CTRLDATAEXCHANGE == aCheck->mnSotId))
+ return sal_True;
+ if (bDescriptorFormat && (getDescriptorFormatId() == aCheck->mnSotId))
+ return sal_True;
+ }
+
+ return sal_False;
+ }
+
+ //--------------------------------------------------------------------
+ ODataAccessDescriptor OColumnTransferable::extractColumnDescriptor(const TransferableDataHelper& _rData)
+ {
+ if (_rData.HasFormat(getDescriptorFormatId()))
+ {
+ // the object has a real descriptor object (not just the old compatible format)
+
+ // extract the any from the transferable
+ DataFlavor aFlavor;
+#if OSL_DEBUG_LEVEL > 0
+ sal_Bool bSuccess =
+#endif
+ SotExchange::GetFormatDataFlavor(getDescriptorFormatId(), aFlavor);
+ OSL_ENSURE(bSuccess, "OColumnTransferable::extractColumnDescriptor: invalid data format (no flavor)!");
+
+ Any aDescriptor = _rData.GetAny(aFlavor);
+
+ // extract the property value sequence
+ Sequence< PropertyValue > aDescriptorProps;
+#if OSL_DEBUG_LEVEL > 0
+ bSuccess =
+#endif
+ aDescriptor >>= aDescriptorProps;
+ OSL_ENSURE(bSuccess, "OColumnTransferable::extractColumnDescriptor: invalid clipboard format!");
+
+ // build the real descriptor
+ return ODataAccessDescriptor(aDescriptorProps);
+ }
+
+ // only the old (compatible) format exists -> use the other extract method ...
+ ::rtl::OUString sDatasource, sCommand, sFieldName,sDatabaseLocation,sConnectionResource;
+ sal_Int32 nCommandType = CommandType::COMMAND;
+
+ ODataAccessDescriptor aDescriptor;
+ if (extractColumnDescriptor(_rData, sDatasource, sDatabaseLocation,sConnectionResource,nCommandType, sCommand, sFieldName))
+ {
+ // and build an own descriptor
+ if ( sDatasource.getLength() )
+ aDescriptor[daDataSource] <<= sDatasource;
+ if ( sDatabaseLocation.getLength() )
+ aDescriptor[daDatabaseLocation] <<= sDatabaseLocation;
+ if ( sConnectionResource.getLength() )
+ aDescriptor[daConnectionResource] <<= sConnectionResource;
+
+ aDescriptor[daCommand] <<= sCommand;
+ aDescriptor[daCommandType] <<= nCommandType;
+ aDescriptor[daColumnName] <<= sFieldName;
+ }
+ return aDescriptor;
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool OColumnTransferable::extractColumnDescriptor(const TransferableDataHelper& _rData
+ ,::rtl::OUString& _rDatasource
+ ,::rtl::OUString& _rDatabaseLocation
+ ,::rtl::OUString& _rConnectionResource
+ ,sal_Int32& _nCommandType
+ ,::rtl::OUString& _rCommand
+ ,::rtl::OUString& _rFieldName)
+ {
+ if ( _rData.HasFormat(getDescriptorFormatId()) )
+ {
+ ODataAccessDescriptor aDescriptor = extractColumnDescriptor(_rData);
+ if ( aDescriptor.has(daDataSource) )
+ aDescriptor[daDataSource] >>= _rDatasource;
+ if ( aDescriptor.has(daDatabaseLocation) )
+ aDescriptor[daDatabaseLocation] >>= _rDatabaseLocation;
+ if ( aDescriptor.has(daConnectionResource) )
+ aDescriptor[daConnectionResource] >>= _rConnectionResource;
+
+ aDescriptor[daCommand] >>= _rCommand;
+ aDescriptor[daCommandType] >>= _nCommandType;
+ aDescriptor[daColumnName] >>= _rFieldName;
+ return sal_True;
+ }
+
+ // check if we have a (string) format we can use ....
+ SotFormatStringId nRecognizedFormat = 0;
+ if (_rData.HasFormat(SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE))
+ nRecognizedFormat = SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE;
+ if (_rData.HasFormat(SOT_FORMATSTR_ID_SBA_CTRLDATAEXCHANGE))
+ nRecognizedFormat = SOT_FORMATSTR_ID_SBA_CTRLDATAEXCHANGE;
+ if (!nRecognizedFormat)
+ return sal_False;
+
+ String sFieldDescription;
+ const_cast<TransferableDataHelper&>(_rData).GetString(nRecognizedFormat, sFieldDescription);
+
+ const sal_Unicode cSeparator = sal_Unicode(11);
+ _rDatasource = sFieldDescription.GetToken(0, cSeparator);
+ _rCommand = sFieldDescription.GetToken(1, cSeparator);
+ _nCommandType = sFieldDescription.GetToken(2, cSeparator).ToInt32();
+ _rFieldName = sFieldDescription.GetToken(3, cSeparator);
+
+ return sal_True;
+ }
+
+ //--------------------------------------------------------------------
+ void OColumnTransferable::addDataToContainer( TransferDataContainer* _pContainer )
+ {
+ OSL_ENSURE( _pContainer, "OColumnTransferable::addDataToContainer: invalid container!" );
+ if ( _pContainer )
+ {
+ if ( m_nFormatFlags & CTF_FIELD_DESCRIPTOR )
+ _pContainer->CopyAny( SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE, makeAny( m_sCompatibleFormat ) );
+
+ if ( m_nFormatFlags & CTF_CONTROL_EXCHANGE )
+ _pContainer->CopyAny( SOT_FORMATSTR_ID_SBA_CTRLDATAEXCHANGE, makeAny( m_sCompatibleFormat ) );
+
+ if ( m_nFormatFlags & CTF_COLUMN_DESCRIPTOR )
+ {
+ Any aContent = makeAny( m_aDescriptor.createPropertyValueSequence() );
+ _pContainer->CopyAny(
+ sal::static_int_cast< sal_uInt16 >( getDescriptorFormatId() ),
+ aContent );
+ }
+ }
+ }
+
+ //====================================================================
+ //= ODataAccessObjectTransferable
+ //====================================================================
+ ODataAccessObjectTransferable::ODataAccessObjectTransferable(
+ const ::rtl::OUString& _rDatasource
+ ,const ::rtl::OUString& _rConnectionResource
+ ,const sal_Int32 _nCommandType
+ ,const ::rtl::OUString& _rCommand
+ )
+ {
+ construct(_rDatasource,_rConnectionResource,_nCommandType,_rCommand,NULL,(CommandType::COMMAND == _nCommandType),_rCommand);
+ }
+ //--------------------------------------------------------------------
+ ODataAccessObjectTransferable::ODataAccessObjectTransferable(
+ const ::rtl::OUString& _rDatasource
+ ,const ::rtl::OUString& _rConnectionResource
+ ,const sal_Int32 _nCommandType
+ ,const ::rtl::OUString& _rCommand
+ ,const Reference< XConnection >& _rxConnection)
+ {
+ OSL_ENSURE(_rxConnection.is(),"Wrong ctor used.!");
+ construct(_rDatasource,_rConnectionResource,_nCommandType,_rCommand,_rxConnection,(CommandType::COMMAND == _nCommandType),_rCommand);
+ }
+
+ // -----------------------------------------------------------------------------
+ ODataAccessObjectTransferable::ODataAccessObjectTransferable(const Reference< XPropertySet >& _rxLivingForm)
+ {
+ // collect some properties of the form
+ ::rtl::OUString sDatasourceName,sConnectionResource;
+ sal_Int32 nObjectType = CommandType::COMMAND;
+ ::rtl::OUString sObjectName;
+ Reference< XConnection > xConnection;
+ try
+ {
+ _rxLivingForm->getPropertyValue(FM_PROP_COMMANDTYPE) >>= nObjectType;
+ _rxLivingForm->getPropertyValue(FM_PROP_COMMAND) >>= sObjectName;
+ _rxLivingForm->getPropertyValue(FM_PROP_DATASOURCE) >>= sDatasourceName;
+ _rxLivingForm->getPropertyValue(FM_PROP_URL) >>= sConnectionResource;
+ _rxLivingForm->getPropertyValue(FM_PROP_ACTIVE_CONNECTION) >>= xConnection;
+ }
+ catch(Exception&)
+ {
+ OSL_ENSURE(sal_False, "ODataAccessObjectTransferable::ODataAccessObjectTransferable: could not collect essential form attributes !");
+ return;
+ }
+
+ String sObjectKind = (CommandType::TABLE == nObjectType) ? String('1') : String('0');
+
+ // check if the SQL-statement is modified
+ ::rtl::OUString sCompleteStatement;
+ try
+ {
+ _rxLivingForm->getPropertyValue(FM_PROP_ACTIVECOMMAND) >>= sCompleteStatement;
+ }
+ catch(Exception&)
+ {
+ OSL_ENSURE(sal_False, "ODataAccessObjectTransferable::ODataAccessObjectTransferable: could not collect essential form attributes (part two) !");
+ return;
+ }
+
+ construct( sDatasourceName
+ ,sConnectionResource
+ ,nObjectType
+ ,sObjectName,xConnection
+ ,!((CommandType::QUERY == nObjectType))
+ ,sCompleteStatement);
+ }
+
+ // -----------------------------------------------------------------------------
+ void ODataAccessObjectTransferable::AddSupportedFormats()
+ {
+ sal_Int32 nObjectType = CommandType::COMMAND;
+ m_aDescriptor[daCommandType] >>= nObjectType;
+ switch (nObjectType)
+ {
+ case CommandType::TABLE:
+ AddFormat(SOT_FORMATSTR_ID_DBACCESS_TABLE);
+ break;
+ case CommandType::QUERY:
+ AddFormat(SOT_FORMATSTR_ID_DBACCESS_QUERY);
+ break;
+ case CommandType::COMMAND:
+ AddFormat(SOT_FORMATSTR_ID_DBACCESS_COMMAND);
+ break;
+ }
+
+ sal_Int32 nDescriptorLen = m_sCompatibleObjectDescription.getLength();
+ if (nDescriptorLen)
+ {
+ if (m_sCompatibleObjectDescription.getStr()[nDescriptorLen] == 11)
+ m_sCompatibleObjectDescription = m_sCompatibleObjectDescription.copy(0, nDescriptorLen - 1);
+
+ if (nDescriptorLen)
+ AddFormat(SOT_FORMATSTR_ID_SBA_DATAEXCHANGE);
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+ sal_Bool ODataAccessObjectTransferable::GetData( const DataFlavor& rFlavor )
+ {
+ sal_uIntPtr nFormat = SotExchange::GetFormat(rFlavor);
+ switch (nFormat)
+ {
+ case SOT_FORMATSTR_ID_DBACCESS_TABLE:
+ case SOT_FORMATSTR_ID_DBACCESS_QUERY:
+ case SOT_FORMATSTR_ID_DBACCESS_COMMAND:
+ return SetAny( makeAny(m_aDescriptor.createPropertyValueSequence()), rFlavor );
+
+ case SOT_FORMATSTR_ID_SBA_DATAEXCHANGE:
+ return SetString(m_sCompatibleObjectDescription, rFlavor);
+ }
+ return sal_False;
+ }
+
+ // -----------------------------------------------------------------------------
+ sal_Bool ODataAccessObjectTransferable::canExtractObjectDescriptor(const DataFlavorExVector& _rFlavors)
+ {
+ for ( DataFlavorExVector::const_iterator aCheck = _rFlavors.begin();
+ aCheck != _rFlavors.end();
+ ++aCheck
+ )
+ {
+ if (SOT_FORMATSTR_ID_DBACCESS_TABLE == aCheck->mnSotId)
+ return sal_True;
+ if (SOT_FORMATSTR_ID_DBACCESS_QUERY == aCheck->mnSotId)
+ return sal_True;
+ if (SOT_FORMATSTR_ID_DBACCESS_COMMAND == aCheck->mnSotId)
+ return sal_True;
+ }
+ return sal_False;
+ }
+
+ // -----------------------------------------------------------------------------
+ ODataAccessDescriptor ODataAccessObjectTransferable::extractObjectDescriptor(const TransferableDataHelper& _rData)
+ {
+ sal_Int32 nKnownFormatId = 0;
+ if ( _rData.HasFormat( SOT_FORMATSTR_ID_DBACCESS_TABLE ) )
+ nKnownFormatId = SOT_FORMATSTR_ID_DBACCESS_TABLE;
+ if ( _rData.HasFormat( SOT_FORMATSTR_ID_DBACCESS_QUERY ) )
+ nKnownFormatId = SOT_FORMATSTR_ID_DBACCESS_QUERY;
+ if ( _rData.HasFormat( SOT_FORMATSTR_ID_DBACCESS_COMMAND ) )
+ nKnownFormatId = SOT_FORMATSTR_ID_DBACCESS_COMMAND;
+
+ if (0 != nKnownFormatId)
+ {
+ // extract the any from the transferable
+ DataFlavor aFlavor;
+#if OSL_DEBUG_LEVEL > 0
+ sal_Bool bSuccess =
+#endif
+ SotExchange::GetFormatDataFlavor(nKnownFormatId, aFlavor);
+ OSL_ENSURE(bSuccess, "OColumnTransferable::extractColumnDescriptor: invalid data format (no flavor)!");
+
+ Any aDescriptor = _rData.GetAny(aFlavor);
+
+ // extract the property value sequence
+ Sequence< PropertyValue > aDescriptorProps;
+#if OSL_DEBUG_LEVEL > 0
+ bSuccess =
+#endif
+ aDescriptor >>= aDescriptorProps;
+ OSL_ENSURE(bSuccess, "OColumnTransferable::extractColumnDescriptor: invalid clipboard format!");
+
+ // build the real descriptor
+ return ODataAccessDescriptor(aDescriptorProps);
+ }
+
+ OSL_ENSURE( sal_False, "OColumnTransferable::extractColumnDescriptor: unsupported formats only!" );
+ return ODataAccessDescriptor();
+ }
+
+ // -----------------------------------------------------------------------------
+ void ODataAccessObjectTransferable::addCompatibleSelectionDescription( const Sequence< Any >& _rSelRows )
+ {
+ const sal_Unicode cSeparator(11);
+ const ::rtl::OUString sSeparator(&cSeparator, 1);
+
+ const Any* pSelRows = _rSelRows.getConstArray();
+ const Any* pSelRowsEnd = pSelRows + _rSelRows.getLength();
+ for ( ; pSelRows < pSelRowsEnd; ++pSelRows )
+ {
+ sal_Int32 nSelectedRow( 0 );
+ OSL_VERIFY( *pSelRows >>= nSelectedRow );
+
+ m_sCompatibleObjectDescription += ::rtl::OUString::valueOf((sal_Int32)nSelectedRow);
+ m_sCompatibleObjectDescription += sSeparator;
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+ void ODataAccessObjectTransferable::ObjectReleased()
+ {
+ m_aDescriptor.clear();
+ }
+ // -----------------------------------------------------------------------------
+ void ODataAccessObjectTransferable::construct( const ::rtl::OUString& _rDatasource
+ ,const ::rtl::OUString& _rConnectionResource
+ ,const sal_Int32 _nCommandType
+ ,const ::rtl::OUString& _rCommand
+ ,const Reference< XConnection >& _rxConnection
+ ,sal_Bool _bAddCommand
+ ,const ::rtl::OUString& _sActiveCommand)
+ {
+ m_aDescriptor.setDataSource(_rDatasource);
+ // build the descriptor (the property sequence)
+ if ( _rConnectionResource.getLength() )
+ m_aDescriptor[daConnectionResource] <<= _rConnectionResource;
+ if ( _rxConnection.is() )
+ m_aDescriptor[daConnection] <<= _rxConnection;
+ m_aDescriptor[daCommand] <<= _rCommand;
+ m_aDescriptor[daCommandType] <<= _nCommandType;
+
+ // extract the single values from the sequence
+
+ ::rtl::OUString sObjectName;
+ ::rtl::OUString sDatasourceName = _rDatasource;
+ sObjectName = _rCommand;
+
+ // for compatibility: create a string which can be used for the SOT_FORMATSTR_ID_SBA_DATAEXCHANGE format
+
+ sal_Bool bTreatAsStatement = (CommandType::COMMAND == _nCommandType);
+ // statements are - in this old and ugly format - described as queries
+
+ const sal_Unicode cSeparator = sal_Unicode(11);
+ const ::rtl::OUString sSeparator(&cSeparator, 1);
+
+ const sal_Unicode cTableMark = '1';
+ const sal_Unicode cQueryMark = '0';
+
+ // build the descriptor string
+ m_sCompatibleObjectDescription += sDatasourceName;
+ m_sCompatibleObjectDescription += sSeparator;
+ m_sCompatibleObjectDescription += bTreatAsStatement ? ::rtl::OUString() : sObjectName;
+ m_sCompatibleObjectDescription += sSeparator;
+ switch (_nCommandType)
+ {
+ case CommandType::TABLE:
+ m_sCompatibleObjectDescription += ::rtl::OUString(&cTableMark, 1);
+ break;
+ case CommandType::QUERY:
+ m_sCompatibleObjectDescription += ::rtl::OUString(&cQueryMark, 1);
+ break;
+ case CommandType::COMMAND:
+ m_sCompatibleObjectDescription += ::rtl::OUString(&cQueryMark, 1);
+ // think of it as a query
+ break;
+ }
+ m_sCompatibleObjectDescription += sSeparator;
+ m_sCompatibleObjectDescription += _bAddCommand ? _sActiveCommand : ::rtl::OUString();
+ m_sCompatibleObjectDescription += sSeparator;
+ }
+
+ //--------------------------------------------------------------------
+ OMultiColumnTransferable::OMultiColumnTransferable(const Sequence< PropertyValue >& _aDescriptors) : m_aDescriptors(_aDescriptors)
+ {
+ }
+ //--------------------------------------------------------------------
+ sal_uInt32 OMultiColumnTransferable::getDescriptorFormatId()
+ {
+ static sal_uInt32 s_nFormat = (sal_uInt32)-1;
+ if ((sal_uInt32)-1 == s_nFormat)
+ {
+ s_nFormat = SotExchange::RegisterFormatName(String::CreateFromAscii("application/x-openoffice;windows_formatname=\"dbaccess.MultipleColumnDescriptorTransfer\""));
+ OSL_ENSURE((sal_uInt32)-1 != s_nFormat, "OColumnTransferable::getDescriptorFormatId: bad exchange id!");
+ }
+ return s_nFormat;
+ }
+ //--------------------------------------------------------------------
+ void OMultiColumnTransferable::AddSupportedFormats()
+ {
+ AddFormat(getDescriptorFormatId());
+ }
+ //--------------------------------------------------------------------
+ void OMultiColumnTransferable::push_back(ODataAccessDescriptor& _aDescriptor)
+ {
+ const sal_Int32 nCount = m_aDescriptors.getLength();
+ m_aDescriptors.realloc(nCount+1);
+ m_aDescriptors[nCount].Value <<= _aDescriptor.createPropertyValueSequence();
+ }
+ //--------------------------------------------------------------------
+ sal_Bool OMultiColumnTransferable::GetData( const DataFlavor& _rFlavor )
+ {
+ const sal_uInt32 nFormatId = SotExchange::GetFormat(_rFlavor);
+ if (nFormatId == getDescriptorFormatId())
+ {
+ return SetAny( makeAny( m_aDescriptors ), _rFlavor );
+ }
+
+ return sal_False;
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool OMultiColumnTransferable::canExtractDescriptor(const DataFlavorExVector& _rFlavors)
+ {
+ DataFlavorExVector::const_iterator aCheck = _rFlavors.begin();
+ for ( ;
+ aCheck != _rFlavors.end() && getDescriptorFormatId() == aCheck->mnSotId;
+ ++aCheck
+ )
+ ;
+
+ return aCheck == _rFlavors.end();
+ }
+
+ //--------------------------------------------------------------------
+ Sequence< PropertyValue > OMultiColumnTransferable::extractDescriptor(const TransferableDataHelper& _rData)
+ {
+ Sequence< PropertyValue > aList;
+ if (_rData.HasFormat(getDescriptorFormatId()))
+ {
+ // extract the any from the transferable
+ DataFlavor aFlavor;
+#if OSL_DEBUG_LEVEL > 0
+ sal_Bool bSuccess =
+#endif
+ SotExchange::GetFormatDataFlavor(getDescriptorFormatId(), aFlavor);
+ OSL_ENSURE(bSuccess, "OColumnTransferable::extractColumnDescriptor: invalid data format (no flavor)!");
+
+ _rData.GetAny(aFlavor) >>= aList;
+ } // if (_rData.HasFormat(getDescriptorFormatId()))
+ return aList;
+ }
+ // -----------------------------------------------------------------------------
+ void OMultiColumnTransferable::ObjectReleased()
+ {
+ m_aDescriptors.realloc(0);
+ }
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+
diff --git a/svx/source/fmcomp/dbaobjectex.cxx b/svx/source/fmcomp/dbaobjectex.cxx
new file mode 100644
index 000000000000..a9c3cf05e1f2
--- /dev/null
+++ b/svx/source/fmcomp/dbaobjectex.cxx
@@ -0,0 +1,187 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/dbaobjectex.hxx>
+#include <osl/diagnose.h>
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#include <com/sun/star/sdb/XSQLQueryComposerFactory.hpp>
+#include <com/sun/star/sdb/XSQLQueryComposerFactory.hpp>
+#ifndef _SVX_FMPROP_HRC
+#include "fmprop.hrc"
+#endif
+#include <comphelper/extract.hxx>
+#include <sot/formats.hxx>
+#include <sot/exchange.hxx>
+#include <comphelper/propertysetinfo.hxx>
+#ifndef _SVX_FMPROP_HRC
+#include "fmprop.hrc"
+#endif
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::sdb;
+ using namespace ::com::sun::star::sdbc;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::ucb;
+ using namespace ::com::sun::star::sdbcx;
+ using namespace ::com::sun::star::container;
+ using namespace ::com::sun::star::datatransfer;
+ using namespace ::comphelper;
+
+ //====================================================================
+ //= OComponentTransferable
+ //====================================================================
+ //--------------------------------------------------------------------
+ OComponentTransferable::OComponentTransferable(const ::rtl::OUString& _rDatasourceOrLocation
+ ,const Reference< XContent>& _xContent)
+ {
+ m_aDescriptor.setDataSource(_rDatasourceOrLocation);
+ m_aDescriptor[daComponent] <<= _xContent;
+ }
+
+
+ //--------------------------------------------------------------------
+ sal_uInt32 OComponentTransferable::getDescriptorFormatId(sal_Bool _bExtractForm)
+ {
+ static sal_uInt32 s_nReportFormat = (sal_uInt32)-1;
+ static sal_uInt32 s_nFormFormat = (sal_uInt32)-1;
+ if ( _bExtractForm && (sal_uInt32)-1 == s_nFormFormat )
+ {
+ s_nFormFormat = SotExchange::RegisterFormatName(String::CreateFromAscii("application/x-openoffice;windows_formatname=\"dbaccess.FormComponentDescriptorTransfer\"" ));
+ OSL_ENSURE((sal_uInt32)-1 != s_nFormFormat, "OComponentTransferable::getDescriptorFormatId: bad exchange id!");
+ }
+ else if ( !_bExtractForm && (sal_uInt32)-1 == s_nReportFormat)
+ {
+ s_nReportFormat = SotExchange::RegisterFormatName(String::CreateFromAscii("application/x-openoffice;windows_formatname=\"dbaccess.ReportComponentDescriptorTransfer\""));
+ OSL_ENSURE((sal_uInt32)-1 != s_nReportFormat, "OComponentTransferable::getDescriptorFormatId: bad exchange id!");
+ }
+ return _bExtractForm ? s_nFormFormat : s_nReportFormat;
+ }
+
+ //--------------------------------------------------------------------
+ void OComponentTransferable::AddSupportedFormats()
+ {
+ sal_Bool bForm = sal_True;
+ try
+ {
+ Reference<XPropertySet> xProp;
+ m_aDescriptor[daComponent] >>= xProp;
+ if ( xProp.is() )
+ xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsForm"))) >>= bForm;
+ }
+ catch(Exception)
+ {}
+ AddFormat(getDescriptorFormatId(bForm));
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool OComponentTransferable::GetData( const DataFlavor& _rFlavor )
+ {
+ const sal_uInt32 nFormatId = SotExchange::GetFormat(_rFlavor);
+ if ( nFormatId == getDescriptorFormatId(sal_True) || nFormatId == getDescriptorFormatId(sal_False) )
+ return SetAny( makeAny( m_aDescriptor.createPropertyValueSequence() ), _rFlavor );
+
+ return sal_False;
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool OComponentTransferable::canExtractComponentDescriptor(const DataFlavorExVector& _rFlavors,sal_Bool _bForm )
+ {
+ DataFlavorExVector::const_iterator aEnd = _rFlavors.end();
+ for ( DataFlavorExVector::const_iterator aCheck = _rFlavors.begin();
+ aCheck != aEnd;
+ ++aCheck
+ )
+ {
+ if ( getDescriptorFormatId(_bForm) == aCheck->mnSotId )
+ return sal_True;
+ }
+
+ return sal_False;
+ }
+
+ //--------------------------------------------------------------------
+ ODataAccessDescriptor OComponentTransferable::extractComponentDescriptor(const TransferableDataHelper& _rData)
+ {
+ sal_Bool bForm = _rData.HasFormat(getDescriptorFormatId(sal_True));
+ if ( bForm || _rData.HasFormat(getDescriptorFormatId(sal_False)) )
+ {
+ // the object has a real descriptor object (not just the old compatible format)
+
+ // extract the any from the transferable
+ DataFlavor aFlavor;
+#if OSL_DEBUG_LEVEL > 0
+ sal_Bool bSuccess =
+#endif
+ SotExchange::GetFormatDataFlavor(getDescriptorFormatId(bForm), aFlavor);
+ OSL_ENSURE(bSuccess, "OComponentTransferable::extractColumnDescriptor: invalid data format (no flavor)!");
+
+ Any aDescriptor = _rData.GetAny(aFlavor);
+
+ // extract the property value sequence
+ Sequence< PropertyValue > aDescriptorProps;
+#if OSL_DEBUG_LEVEL > 0
+ bSuccess =
+#endif
+ aDescriptor >>= aDescriptorProps;
+ OSL_ENSURE(bSuccess, "OComponentTransferable::extractColumnDescriptor: invalid clipboard format!");
+
+ // build the real descriptor
+ return ODataAccessDescriptor(aDescriptorProps);
+ }
+
+ return ODataAccessDescriptor();
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool OComponentTransferable::extractComponentDescriptor(const TransferableDataHelper& _rData
+ ,sal_Bool _bExtractForm
+ , ::rtl::OUString& _rDatasourceOrLocation
+ , ::com::sun::star::uno::Reference< XContent>& _xContent)
+ {
+ if ( _rData.HasFormat( getDescriptorFormatId(_bExtractForm)) )
+ {
+ ODataAccessDescriptor aDescriptor = extractComponentDescriptor(_rData);
+ _rDatasourceOrLocation = aDescriptor.getDataSource();
+ aDescriptor[daComponent] >>= _xContent;
+ return sal_True;
+ }
+
+ return sal_False;
+ }
+//........................................................................
+} // namespace svx
+//........................................................................
+
+
diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx
new file mode 100644
index 000000000000..b974fe3ff5f3
--- /dev/null
+++ b/svx/source/fmcomp/fmgridcl.cxx
@@ -0,0 +1,2144 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svx/dbexch.hrc"
+#include "svx/fmgridif.hxx"
+#include "fmitems.hxx"
+#include "fmprop.hrc"
+#include "svx/fmtools.hxx"
+#include "svx/fmresids.hrc"
+#include "fmservs.hxx"
+#include "fmurl.hxx"
+#include "formcontrolfactory.hxx"
+#include "gridcell.hxx"
+#include "gridcols.hxx"
+#include "svx/dbaexchange.hxx"
+#include "svx/dialmgr.hxx"
+#include "svx/dialogs.hrc"
+#include "svx/fmgridcl.hxx"
+#include "svx/svxdlg.hxx"
+#include "svx/svxids.hrc"
+#include "trace.hxx"
+
+#include <com/sun/star/form/XConfirmDeleteListener.hpp>
+#include <com/sun/star/form/XFormComponent.hpp>
+#include <com/sun/star/form/XGridColumnFactory.hpp>
+#include <com/sun/star/io/XPersistObject.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/sdb/RowChangeAction.hpp>
+#include <com/sun/star/sdb/XQueriesSupplier.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/XPreparedStatement.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdbcx/XDeleteRows.hpp>
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#include <com/sun/star/uno/XNamingService.hpp>
+#include <com/sun/star/util/XNumberFormats.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+
+#ifndef _SVSTDARR_STRINGSDTOR
+#define _SVSTDARR_STRINGSDTOR
+#define _SVSTDARR_ULONGS
+#include <svl/svstdarr.hxx>
+#endif
+
+#include <comphelper/extract.hxx>
+#include <comphelper/numbers.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/property.hxx>
+#include <connectivity/dbtools.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svl/eitem.hxx>
+#include <svtools/fmtfield.hxx>
+#include <svl/numuno.hxx>
+#include <tools/multisel.hxx>
+#include <tools/shl.hxx>
+#include <tools/diagnose_ex.h>
+#include <vcl/help.hxx>
+#include <vcl/image.hxx>
+#include <vcl/longcurr.hxx>
+#include <vcl/menu.hxx>
+
+#include <math.h>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::view;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::form;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::container;
+using namespace ::cppu;
+using namespace ::svxform;
+using namespace ::svx;
+
+//==============================================================================
+//------------------------------------------------------------------------------
+::rtl::OUString FieldServiceFromId(sal_Int32 nID)
+{
+ switch (nID)
+ {
+ case SID_FM_EDIT : return FM_COL_TEXTFIELD;
+ case SID_FM_COMBOBOX : return FM_COL_COMBOBOX;
+ case SID_FM_LISTBOX : return FM_COL_LISTBOX;
+ case SID_FM_CHECKBOX : return FM_COL_CHECKBOX;
+ case SID_FM_DATEFIELD : return FM_COL_DATEFIELD;
+ case SID_FM_TIMEFIELD : return FM_COL_TIMEFIELD;
+ case SID_FM_NUMERICFIELD : return FM_COL_NUMERICFIELD;
+ case SID_FM_CURRENCYFIELD : return FM_COL_CURRENCYFIELD;
+ case SID_FM_PATTERNFIELD : return FM_COL_PATTERNFIELD;
+ case SID_FM_FORMATTEDFIELD : return FM_COL_FORMATTEDFIELD;
+ }
+ return ::rtl::OUString();
+}
+
+//==============================================================================
+struct FmGridHeaderData
+{
+ ODataAccessDescriptor aDropData;
+ Point aDropPosPixel;
+ sal_Int8 nDropAction;
+ Reference< XInterface > xDroppedStatement;
+ Reference< XInterface > xDroppedResultSet;
+};
+
+//==============================================================================
+//------------------------------------------------------------------------------
+const sal_Int16 nChangeTypeOffset = 1000;
+void SetMenuItem(const ImageList& rList, sal_uInt16 nID, Menu* pMenu, Menu& rNewMenu, sal_Bool bDesignMode = sal_True, sal_Int16 nOffset = nChangeTypeOffset)
+{
+ pMenu->SetItemImage(nID, rList.GetImage(nID));
+ pMenu->EnableItem(nID, bDesignMode);
+ rNewMenu.InsertItem(nID + nOffset, pMenu->GetItemText(nID));
+ rNewMenu.SetItemImage(nID + nOffset, rList.GetImage(nID));
+ rNewMenu.SetHelpId(nID + nOffset, pMenu->GetHelpId(nID));
+ rNewMenu.EnableItem(nID + nOffset, bDesignMode);
+}
+
+//------------------------------------------------------------------------------
+FmGridHeader::FmGridHeader( BrowseBox* pParent, WinBits nWinBits)
+ :EditBrowserHeader(pParent, nWinBits)
+ ,DropTargetHelper(this)
+ ,m_pImpl(new FmGridHeaderData)
+{
+}
+
+//------------------------------------------------------------------------------
+FmGridHeader::~FmGridHeader()
+{
+ delete m_pImpl;
+}
+
+//------------------------------------------------------------------------------
+sal_uInt16 FmGridHeader::GetModelColumnPos(sal_uInt16 nId) const
+{
+ return static_cast<FmGridControl*>(GetParent())->GetModelColumnPos(nId);
+}
+//---------------------------------------------------------------------------------------
+void FmGridHeader::notifyColumnSelect(sal_uInt16 nColumnId)
+{
+ sal_uInt16 nPos = GetModelColumnPos(nColumnId);
+ Reference< XIndexAccess > xColumns(((FmGridControl*)GetParent())->GetPeer()->getColumns(), UNO_QUERY);
+ if ( nPos < xColumns->getCount() )
+ {
+ Reference< XSelectionSupplier > xSelSupplier(xColumns, UNO_QUERY);
+ if ( xSelSupplier.is() )
+ {
+ Reference< XPropertySet > xColumn;
+ xColumns->getByIndex(nPos) >>= xColumn;
+ xSelSupplier->select(makeAny(xColumn));
+ }
+ }
+}
+//------------------------------------------------------------------------------
+void FmGridHeader::Select()
+{
+ EditBrowserHeader::Select();
+ notifyColumnSelect(GetCurItemId());
+}
+
+//------------------------------------------------------------------------------
+void FmGridHeader::RequestHelp( const HelpEvent& rHEvt )
+{
+ sal_uInt16 nItemId = GetItemId( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) );
+ if ( nItemId )
+ {
+ if ( rHEvt.GetMode() & (HELPMODE_QUICK | HELPMODE_BALLOON) )
+ {
+ Rectangle aItemRect = GetItemRect( nItemId );
+ Point aPt = OutputToScreenPixel( aItemRect.TopLeft() );
+ aItemRect.Left() = aPt.X();
+ aItemRect.Top() = aPt.Y();
+ aPt = OutputToScreenPixel( aItemRect.BottomRight() );
+ aItemRect.Right() = aPt.X();
+ aItemRect.Bottom() = aPt.Y();
+
+ sal_uInt16 nPos = GetModelColumnPos(nItemId);
+ Reference< ::com::sun::star::container::XIndexContainer > xColumns(static_cast<FmGridControl*>(GetParent())->GetPeer()->getColumns());
+ try
+ {
+ Reference< ::com::sun::star::beans::XPropertySet > xColumn(xColumns->getByIndex(nPos),UNO_QUERY);
+ ::rtl::OUString aHelpText;
+ xColumn->getPropertyValue(FM_PROP_HELPTEXT) >>= aHelpText;
+ if ( !aHelpText.getLength() )
+ xColumn->getPropertyValue(FM_PROP_DESCRIPTION) >>= aHelpText;
+ if ( aHelpText.getLength() )
+ {
+ if ( rHEvt.GetMode() & HELPMODE_BALLOON )
+ Help::ShowBalloon( this, aItemRect.Center(), aItemRect, aHelpText );
+ else
+ Help::ShowQuickHelp( this, aItemRect, aHelpText );
+ return;
+ }
+ }
+ catch(Exception&)
+ {
+ return;
+ }
+ }
+ }
+ EditBrowserHeader::RequestHelp( rHEvt );
+}
+
+//------------------------------------------------------------------------------
+sal_Int8 FmGridHeader::AcceptDrop( const AcceptDropEvent& rEvt )
+{
+ // drop allowed in design mode only
+ if (!static_cast<FmGridControl*>(GetParent())->IsDesignMode())
+ return DND_ACTION_NONE;
+
+ // search for recognized formats
+ const DataFlavorExVector& rFlavors = GetDataFlavorExVector();
+ if (OColumnTransferable::canExtractColumnDescriptor(rFlavors, CTF_COLUMN_DESCRIPTOR | CTF_FIELD_DESCRIPTOR))
+ return rEvt.mnAction;
+
+ return DND_ACTION_NONE;
+}
+
+//------------------------------------------------------------------------------
+sal_Int8 FmGridHeader::ExecuteDrop( const ExecuteDropEvent& _rEvt )
+{
+ if (!static_cast<FmGridControl*>(GetParent())->IsDesignMode())
+ return DND_ACTION_NONE;
+
+ TransferableDataHelper aDroppedData(_rEvt.maDropEvent.Transferable);
+
+ // check the formats
+ sal_Bool bColumnDescriptor = OColumnTransferable::canExtractColumnDescriptor(aDroppedData.GetDataFlavorExVector(), CTF_COLUMN_DESCRIPTOR);
+ sal_Bool bFieldDescriptor = OColumnTransferable::canExtractColumnDescriptor(aDroppedData.GetDataFlavorExVector(), CTF_FIELD_DESCRIPTOR);
+ if (!bColumnDescriptor && !bFieldDescriptor)
+ {
+ DBG_ERROR("FmGridHeader::ExecuteDrop: should never have reached this (no extractable format)!");
+ return DND_ACTION_NONE;
+ }
+
+ // extract the descriptor
+ ::rtl::OUString sDatasouce, sCommand, sFieldName,sDatabaseLocation,sConnnectionResource;
+ sal_Int32 nCommandType = CommandType::COMMAND;
+ Reference< XPreparedStatement > xStatement;
+ Reference< XResultSet > xResultSet;
+ Reference< XPropertySet > xField;
+ Reference< XConnection > xConnection;
+
+ ODataAccessDescriptor aColumn = OColumnTransferable::extractColumnDescriptor(aDroppedData);
+ if (aColumn.has(daDataSource)) aColumn[daDataSource] >>= sDatasouce;
+ if (aColumn.has(daDatabaseLocation)) aColumn[daDatabaseLocation] >>= sDatabaseLocation;
+ if (aColumn.has(daConnectionResource)) aColumn[daConnectionResource] >>= sConnnectionResource;
+ if (aColumn.has(daCommand)) aColumn[daCommand] >>= sCommand;
+ if (aColumn.has(daCommandType)) aColumn[daCommandType] >>= nCommandType;
+ if (aColumn.has(daColumnName)) aColumn[daColumnName] >>= sFieldName;
+ if (aColumn.has(daColumnObject))aColumn[daColumnObject] >>= xField;
+ if (aColumn.has(daConnection)) aColumn[daConnection] >>= xConnection;
+
+ if ( !sFieldName.getLength()
+ || !sCommand.getLength()
+ || ( !sDatasouce.getLength()
+ && !sDatabaseLocation.getLength()
+ && !xConnection.is()
+ )
+ )
+ {
+ DBG_ERROR( "FmGridHeader::ExecuteDrop: somebody started a nonsense drag operation!!" );
+ return DND_ACTION_NONE;
+ }
+
+ try
+ {
+ // need a connection
+ if (!xConnection.is())
+ { // the transferable did not contain the connection -> build an own one
+ try
+ {
+ ::rtl::OUString sSignificantSource( sDatasouce.getLength() ? sDatasouce : sDatabaseLocation );
+ xConnection = OStaticDataAccessTools().getConnection_withFeedback(sSignificantSource, ::rtl::OUString(),::rtl::OUString(),static_cast<FmGridControl*>(GetParent())->getServiceManager());
+ }
+ catch(NoSuchElementException&)
+ { // allowed, means sDatasouce isn't a valid data source name ....
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("FmGridHeader::ExecuteDrop: could not retrieve the database access object !");
+ }
+
+ if (!xConnection.is())
+ {
+ DBG_ERROR("FmGridHeader::ExecuteDrop: could not retrieve the database access object !");
+ return DND_ACTION_NONE;
+ }
+ }
+
+ // try to obtain the column object
+ if (!xField.is())
+ {
+#ifdef DBG_UTIL
+ Reference< XServiceInfo > xServiceInfo(xConnection, UNO_QUERY);
+ DBG_ASSERT(xServiceInfo.is() && xServiceInfo->supportsService(SRV_SDB_CONNECTION), "FmGridHeader::ExecuteDrop: invalid connection (no database access connection !)");
+#endif
+
+ Reference< XNameAccess > xFields;
+ switch (nCommandType)
+ {
+ case CommandType::TABLE:
+ {
+ Reference< XTablesSupplier > xSupplyTables(xConnection, UNO_QUERY);
+ Reference< XColumnsSupplier > xSupplyColumns;
+ xSupplyTables->getTables()->getByName(sCommand) >>= xSupplyColumns;
+ xFields = xSupplyColumns->getColumns();
+ }
+ break;
+ case CommandType::QUERY:
+ {
+ Reference< XQueriesSupplier > xSupplyQueries(xConnection, UNO_QUERY);
+ Reference< XColumnsSupplier > xSupplyColumns;
+ xSupplyQueries->getQueries()->getByName(sCommand) >>= xSupplyColumns;
+ xFields = xSupplyColumns->getColumns();
+ }
+ break;
+ default:
+ {
+ xStatement = xConnection->prepareStatement(sCommand);
+ // not interested in any results
+
+ Reference< XPropertySet > xStatProps(xStatement,UNO_QUERY);
+ xStatProps->setPropertyValue(rtl::OUString::createFromAscii("MaxRows"), makeAny(sal_Int32(0)));
+
+ xResultSet = xStatement->executeQuery();
+ Reference< XColumnsSupplier > xSupplyCols(xResultSet, UNO_QUERY);
+ if (xSupplyCols.is())
+ xFields = xSupplyCols->getColumns();
+ }
+ }
+
+ if (xFields.is() && xFields->hasByName(sFieldName))
+ xFields->getByName(sFieldName) >>= xField;
+
+ if (!xField.is())
+ {
+ ::comphelper::disposeComponent(xStatement);
+ return DND_ACTION_NONE;
+ }
+ }
+
+ // do the drop asynchronously
+ // (85957 - UI actions within the drop are not allowed, but we want to open a popup menu)
+ m_pImpl->aDropData = aColumn;
+ m_pImpl->aDropData[daConnection] <<= xConnection;
+ m_pImpl->aDropData[daColumnObject] <<= xField;
+
+ m_pImpl->nDropAction = _rEvt.mnAction;
+ m_pImpl->aDropPosPixel = _rEvt.maPosPixel;
+ m_pImpl->xDroppedStatement = xStatement;
+ m_pImpl->xDroppedResultSet = xResultSet;
+
+ PostUserEvent(LINK(this, FmGridHeader, OnAsyncExecuteDrop));
+ }
+ catch (Exception&)
+ {
+ DBG_ERROR("FmGridHeader::ExecuteDrop: caught an exception while creatin' the column !");
+ ::comphelper::disposeComponent(xStatement);
+ return sal_False;
+ }
+
+ return DND_ACTION_LINK;
+}
+
+//------------------------------------------------------------------------------
+IMPL_LINK( FmGridHeader, OnAsyncExecuteDrop, void*, /*NOTINTERESTEDIN*/ )
+{
+ ::rtl::OUString sCommand, sFieldName,sURL;
+ sal_Int32 nCommandType = CommandType::COMMAND;
+ Reference< XPropertySet > xField;
+ Reference< XConnection > xConnection;
+
+ ::rtl::OUString sDatasouce = m_pImpl->aDropData.getDataSource();
+ if ( !sDatasouce.getLength() && m_pImpl->aDropData.has(daConnectionResource) )
+ m_pImpl->aDropData[daConnectionResource] >>= sURL;
+ m_pImpl->aDropData[daCommand] >>= sCommand;
+ m_pImpl->aDropData[daCommandType] >>= nCommandType;
+ m_pImpl->aDropData[daColumnName] >>= sFieldName;
+ m_pImpl->aDropData[daConnection] >>= xConnection;
+ m_pImpl->aDropData[daColumnObject] >>= xField;
+
+ try
+ {
+ // need number formats
+ Reference< XNumberFormatsSupplier > xSupplier = OStaticDataAccessTools().getNumberFormats(xConnection, sal_True);
+ Reference< XNumberFormats > xNumberFormats;
+ if (xSupplier.is())
+ xNumberFormats = xSupplier->getNumberFormats();
+ if (!xNumberFormats.is())
+ {
+ ::comphelper::disposeComponent(m_pImpl->xDroppedResultSet);
+ ::comphelper::disposeComponent(m_pImpl->xDroppedStatement);
+ return 0L;
+ }
+
+ // Vom Feld werden nun zwei Informationen benoetigt:
+ // a.) Name des Feldes fuer Label und ControlSource
+ // b.) FormatKey, um festzustellen, welches Feld erzeugt werden soll
+ sal_Int32 nDataType = 0;
+ xField->getPropertyValue(FM_PROP_FIELDTYPE) >>= nDataType;
+ // diese Datentypen koennen im Gridcontrol nicht verarbeitet werden
+ switch (nDataType)
+ {
+ case DataType::BLOB:
+ case DataType::LONGVARBINARY:
+ case DataType::BINARY:
+ case DataType::VARBINARY:
+ case DataType::OTHER:
+ ::comphelper::disposeComponent(m_pImpl->xDroppedResultSet);
+ ::comphelper::disposeComponent(m_pImpl->xDroppedStatement);
+ return 0L;
+ }
+
+ // Erstellen der Column
+ Reference< XIndexContainer > xCols(static_cast<FmGridControl*>(GetParent())->GetPeer()->getColumns());
+ Reference< XGridColumnFactory > xFactory(xCols, UNO_QUERY);
+
+ Point aPos = OutputToScreenPixel(m_pImpl->aDropPosPixel);
+ sal_uInt16 nColId = GetItemId(m_pImpl->aDropPosPixel);
+ // EinfuegePosition, immer vor der aktuellen Spalte
+ sal_uInt16 nPos = GetModelColumnPos(nColId);
+ Reference< XPropertySet > xCol, xSecondCol;
+
+ // erzeugen der Column in abhaengigkeit vom type, default textfeld
+ SvULongs aPossibleTypes;
+ switch (nDataType)
+ {
+ case DataType::BIT:
+ case DataType::BOOLEAN:
+ aPossibleTypes.Insert(SID_FM_CHECKBOX, aPossibleTypes.Count());
+ break;
+ case DataType::TINYINT:
+ case DataType::SMALLINT:
+ case DataType::INTEGER:
+ aPossibleTypes.Insert(SID_FM_NUMERICFIELD, aPossibleTypes.Count());
+ aPossibleTypes.Insert(SID_FM_FORMATTEDFIELD, aPossibleTypes.Count());
+ break;
+ case DataType::REAL:
+ case DataType::DOUBLE:
+ case DataType::NUMERIC:
+ case DataType::DECIMAL:
+ aPossibleTypes.Insert(SID_FM_FORMATTEDFIELD, aPossibleTypes.Count());
+ aPossibleTypes.Insert(SID_FM_NUMERICFIELD, aPossibleTypes.Count());
+ break;
+ case DataType::TIMESTAMP:
+ aPossibleTypes.Insert(SID_FM_TWOFIELDS_DATE_N_TIME, aPossibleTypes.Count());
+ aPossibleTypes.Insert(SID_FM_DATEFIELD, aPossibleTypes.Count());
+ aPossibleTypes.Insert(SID_FM_TIMEFIELD, aPossibleTypes.Count());
+ aPossibleTypes.Insert(SID_FM_FORMATTEDFIELD, aPossibleTypes.Count());
+ break;
+ case DataType::DATE:
+ aPossibleTypes.Insert(SID_FM_DATEFIELD, aPossibleTypes.Count());
+ aPossibleTypes.Insert(SID_FM_FORMATTEDFIELD, aPossibleTypes.Count());
+ break;
+ case DataType::TIME:
+ aPossibleTypes.Insert(SID_FM_TIMEFIELD, aPossibleTypes.Count());
+ aPossibleTypes.Insert(SID_FM_FORMATTEDFIELD, aPossibleTypes.Count());
+ break;
+ case DataType::CHAR:
+ case DataType::VARCHAR:
+ case DataType::LONGVARCHAR:
+ default:
+ aPossibleTypes.Insert(SID_FM_EDIT, aPossibleTypes.Count());
+ aPossibleTypes.Insert(SID_FM_FORMATTEDFIELD, aPossibleTypes.Count());
+ break;
+ }
+ // if it's a currency field, a a "currency field" option
+ try
+ {
+ if ( ::comphelper::hasProperty(FM_PROP_ISCURRENCY, xField)
+ && ::comphelper::getBOOL(xField->getPropertyValue(FM_PROP_ISCURRENCY)))
+ aPossibleTypes.Insert(SID_FM_CURRENCYFIELD, 0);
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("FmGridHeader::ExecuteDrop: Exception occured!");
+ }
+
+ sal_Int32 nPreferedType = -1;
+ sal_Bool bDateNTimeCol = sal_False;
+ if (aPossibleTypes.Count() != 0)
+ {
+ nPreferedType = aPossibleTypes[0];
+ if ((m_pImpl->nDropAction == DND_ACTION_LINK) && (aPossibleTypes.Count() > 1))
+ {
+ ImageList aImageList( SVX_RES(RID_SVXIMGLIST_FMEXPL) );
+
+ PopupMenu aInsertMenu(SVX_RES(RID_SVXMNU_COLS));
+ PopupMenu aTypeMenu;
+ PopupMenu* pMenu = aInsertMenu.GetPopupMenu(SID_FM_INSERTCOL);
+ for (sal_uInt32 i=0; i<aPossibleTypes.Count(); ++i)
+ SetMenuItem(aImageList, sal_uInt16(aPossibleTypes[(sal_uInt16)i]), pMenu, aTypeMenu, sal_True, 0);
+ nPreferedType = aTypeMenu.Execute(this, m_pImpl->aDropPosPixel);
+ }
+
+ bDateNTimeCol = nPreferedType == SID_FM_TWOFIELDS_DATE_N_TIME;
+ sal_uInt16 nColCount = bDateNTimeCol ? 2 : 1;
+ ::rtl::OUString sFieldService;
+ while (nColCount--)
+ {
+ if (bDateNTimeCol)
+ nPreferedType = nColCount ? SID_FM_DATEFIELD : SID_FM_TIMEFIELD;
+
+ sFieldService = FieldServiceFromId(nPreferedType);
+ Reference< XPropertySet > xThisRoundCol;
+ if ( sFieldService.getLength() )
+ xThisRoundCol = xFactory->createColumn(sFieldService);
+ if (nColCount)
+ xSecondCol = xThisRoundCol;
+ else
+ xCol = xThisRoundCol;
+ }
+ }
+
+ if (!xCol.is() || (bDateNTimeCol && !xSecondCol.is()))
+ {
+ ::comphelper::disposeComponent(xCol); // in case only the creation of the second column failed
+ ::comphelper::disposeComponent(m_pImpl->xDroppedResultSet);
+ ::comphelper::disposeComponent(m_pImpl->xDroppedStatement);
+ return 0L;
+ }
+
+ if (bDateNTimeCol)
+ {
+ String sTimePostfix( SVX_RES( RID_STR_POSTFIX_TIME ) );
+ xCol->setPropertyValue(FM_PROP_LABEL, makeAny( ::rtl::OUString( sFieldName + sTimePostfix ) ) );
+
+ String sDatePostfix( SVX_RES( RID_STR_POSTFIX_DATE ) );
+ xSecondCol->setPropertyValue(FM_PROP_LABEL, makeAny( ::rtl::OUString( sFieldName + sDatePostfix ) ) );
+ }
+ else
+ xCol->setPropertyValue(FM_PROP_LABEL, makeAny(sFieldName));
+
+ FormControlFactory aControlFactory( ::comphelper::getProcessServiceFactory() );
+ aControlFactory.initializeControlModel( DocumentClassification::classifyHostDocument( xCols ), xCol );
+ aControlFactory.initializeFieldDependentProperties( xField, xCol, xNumberFormats );
+
+ xCol->setPropertyValue(FM_PROP_CONTROLSOURCE, makeAny(sFieldName));
+ if ( xSecondCol.is() )
+ xSecondCol->setPropertyValue(FM_PROP_CONTROLSOURCE, makeAny(sFieldName));
+
+ if (bDateNTimeCol)
+ {
+ String sRealName,sPurePostfix;
+
+ String aPostfix[] = {
+ String( SVX_RES( RID_STR_POSTFIX_DATE ) ),
+ String( SVX_RES( RID_STR_POSTFIX_TIME ) )
+ };
+
+ for ( size_t i=0; i<2; ++i )
+ {
+ sPurePostfix = aPostfix[i];
+ sPurePostfix.EraseLeadingChars(' ');
+ sPurePostfix.EraseLeadingChars('(');
+ sPurePostfix.EraseTrailingChars(')');
+ sRealName = sFieldName;
+ sRealName += '_';
+ sRealName += sPurePostfix;
+ if (i)
+ xSecondCol->setPropertyValue(FM_PROP_NAME, makeAny(::rtl::OUString(sRealName)));
+ else
+ xCol->setPropertyValue(FM_PROP_NAME, makeAny(::rtl::OUString(sRealName)));
+ }
+ }
+ else
+ xCol->setPropertyValue(FM_PROP_NAME, makeAny(sFieldName));
+
+ // jetzt einfuegen
+ Any aElement;
+ aElement <<= xCol;
+ xCols->insertByIndex(nPos, aElement);
+
+ if (bDateNTimeCol)
+ {
+ aElement <<= xSecondCol;
+ xCols->insertByIndex(nPos == (sal_uInt16)-1 ? nPos : ++nPos, aElement);
+ }
+
+ // ist die component::Form an die Datenbankangebunden?
+ Reference< XFormComponent > xFormCp(xCols, UNO_QUERY);
+ Reference< XPropertySet > xForm(xFormCp->getParent(), UNO_QUERY);
+ if (xForm.is())
+ {
+ if (!::comphelper::getString(xForm->getPropertyValue(FM_PROP_DATASOURCE)).getLength())
+ {
+ if ( sDatasouce.getLength() )
+ xForm->setPropertyValue(FM_PROP_DATASOURCE, makeAny(sDatasouce));
+ else
+ xForm->setPropertyValue(FM_PROP_URL, makeAny(sURL));
+ }
+
+ if (!::comphelper::getString(xForm->getPropertyValue(FM_PROP_COMMAND)).getLength())
+ {
+ xForm->setPropertyValue(FM_PROP_COMMAND, makeAny(sCommand));
+ Any aCommandType;
+ switch (nCommandType)
+ {
+ case CommandType::TABLE:
+ aCommandType <<= (sal_Int32)CommandType::TABLE;
+ break;
+ case CommandType::QUERY:
+ aCommandType <<= (sal_Int32)CommandType::QUERY;
+ break;
+ default:
+ aCommandType <<= (sal_Int32)CommandType::COMMAND;
+ xForm->setPropertyValue(FM_PROP_ESCAPE_PROCESSING, bool2any((sal_Bool)(2 == nCommandType)));
+ break;
+ }
+ xForm->setPropertyValue(FM_PROP_COMMANDTYPE, aCommandType);
+ }
+ }
+ }
+ catch (Exception&)
+ {
+ DBG_ERROR("FmGridHeader::OnAsyncExecuteDrop: caught an exception while creatin' the column !");
+ ::comphelper::disposeComponent(m_pImpl->xDroppedResultSet);
+ ::comphelper::disposeComponent(m_pImpl->xDroppedStatement);
+ return 0L;
+ }
+
+ ::comphelper::disposeComponent(m_pImpl->xDroppedResultSet);
+ ::comphelper::disposeComponent(m_pImpl->xDroppedStatement);
+ return 1L;
+}
+
+//------------------------------------------------------------------------------
+void FmGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rMenu)
+{
+ sal_Bool bDesignMode = static_cast<FmGridControl*>(GetParent())->IsDesignMode();
+
+ Reference< ::com::sun::star::container::XIndexContainer > xCols(static_cast<FmGridControl*>(GetParent())->GetPeer()->getColumns());
+ // Aufbau des Insert Menues
+ // mark the column if nColId != HEADERBAR_ITEM_NOTFOUND
+ if(nColId > 0)
+ {
+ sal_uInt16 nPos2 = GetModelColumnPos(nColId);
+
+ Reference< ::com::sun::star::container::XIndexContainer > xColumns(static_cast<FmGridControl*>(GetParent())->GetPeer()->getColumns());
+ Reference< ::com::sun::star::beans::XPropertySet> xColumn;
+ ::cppu::extractInterface(xColumn, xColumns->getByIndex(nPos2));
+ Reference< ::com::sun::star::view::XSelectionSupplier > xSelSupplier(xColumns, UNO_QUERY);
+ if (xSelSupplier.is())
+ xSelSupplier->select(makeAny(xColumn));
+ }
+
+ // EinfuegePosition, immer vor der aktuellen Spalte
+ sal_uInt16 nPos = GetModelColumnPos(nColId);
+ sal_Bool bMarked = nColId && static_cast<FmGridControl*>(GetParent())->isColumnMarked(nColId);
+
+ ImageList aImageList( SVX_RES(RID_SVXIMGLIST_FMEXPL) );
+ PopupMenu* pControlMenu = new PopupMenu;
+
+ PopupMenu* pMenu = rMenu.GetPopupMenu(SID_FM_INSERTCOL);
+ if (pMenu)
+ {
+ SetMenuItem(aImageList, SID_FM_EDIT, pMenu, *pControlMenu, bDesignMode);
+ SetMenuItem(aImageList, SID_FM_CHECKBOX, pMenu, *pControlMenu, bDesignMode);
+ SetMenuItem(aImageList, SID_FM_COMBOBOX, pMenu, *pControlMenu, bDesignMode);
+ SetMenuItem(aImageList, SID_FM_LISTBOX, pMenu, *pControlMenu, bDesignMode);
+ SetMenuItem(aImageList, SID_FM_DATEFIELD, pMenu, *pControlMenu, bDesignMode);
+ SetMenuItem(aImageList, SID_FM_TIMEFIELD, pMenu, *pControlMenu, bDesignMode);
+ SetMenuItem(aImageList, SID_FM_NUMERICFIELD, pMenu, *pControlMenu, bDesignMode);
+ SetMenuItem(aImageList, SID_FM_CURRENCYFIELD, pMenu, *pControlMenu, bDesignMode);
+ SetMenuItem(aImageList, SID_FM_PATTERNFIELD, pMenu, *pControlMenu, bDesignMode);
+ SetMenuItem(aImageList, SID_FM_FORMATTEDFIELD, pMenu, *pControlMenu, bDesignMode);
+ }
+
+ if (pMenu && xCols.is() && nColId)
+ {
+ Reference< ::com::sun::star::beans::XPropertySet > xSet;
+ ::cppu::extractInterface(xSet, xCols->getByIndex(nPos));
+ sal_Int16 nClassId;
+ xSet->getPropertyValue(FM_PROP_CLASSID) >>= nClassId;
+
+ Reference< ::com::sun::star::io::XPersistObject > xServiceQuestion(xSet, UNO_QUERY);
+ sal_Int32 nColType = xServiceQuestion.is() ? getColumnTypeByModelName(xServiceQuestion->getServiceName()) : 0;
+ if (nColType == TYPE_TEXTFIELD)
+ { // edit fields and formatted fields have the same service name, thus getColumnTypeByModelName returns TYPE_TEXTFIELD
+ // in both cases. And as columns don't have an ::com::sun::star::lang::XServiceInfo interface, we have to distinguish both
+ // types via the existence of special properties
+ Reference< ::com::sun::star::beans::XPropertySet > xProps(xSet, UNO_QUERY);
+ if (xProps.is())
+ {
+ Reference< ::com::sun::star::beans::XPropertySetInfo > xPropsInfo = xProps->getPropertySetInfo();
+ if (xPropsInfo.is() && xPropsInfo->hasPropertyByName(FM_PROP_FORMATSSUPPLIER))
+ nColType = TYPE_FORMATTEDFIELD;
+ }
+ }
+
+ pControlMenu->EnableItem(SID_FM_EDIT + nChangeTypeOffset, bDesignMode && (nColType != TYPE_TEXTFIELD));
+ pControlMenu->EnableItem(SID_FM_COMBOBOX + nChangeTypeOffset, bDesignMode && (nColType != TYPE_COMBOBOX));
+ pControlMenu->EnableItem(SID_FM_LISTBOX + nChangeTypeOffset, bDesignMode && (nColType != TYPE_LISTBOX));
+ pControlMenu->EnableItem(SID_FM_CHECKBOX + nChangeTypeOffset, bDesignMode && (nColType != TYPE_CHECKBOX));
+ pControlMenu->EnableItem(SID_FM_DATEFIELD + nChangeTypeOffset, bDesignMode && (nColType != TYPE_DATEFIELD));
+ pControlMenu->EnableItem(SID_FM_NUMERICFIELD + nChangeTypeOffset, bDesignMode && (nColType != TYPE_NUMERICFIELD));
+ pControlMenu->EnableItem(SID_FM_TIMEFIELD + nChangeTypeOffset, bDesignMode && (nColType != TYPE_TIMEFIELD));
+ pControlMenu->EnableItem(SID_FM_CURRENCYFIELD + nChangeTypeOffset, bDesignMode && (nColType != TYPE_CURRENCYFIELD));
+ pControlMenu->EnableItem(SID_FM_PATTERNFIELD + nChangeTypeOffset, bDesignMode && (nColType != TYPE_PATTERNFIELD));
+ pControlMenu->EnableItem(SID_FM_FORMATTEDFIELD + nChangeTypeOffset, bDesignMode && (nColType != TYPE_FORMATTEDFIELD));
+ rMenu.SetPopupMenu(SID_FM_CHANGECOL, pControlMenu);
+ }
+
+ rMenu.EnableItem(SID_FM_INSERTCOL, bDesignMode && xCols.is());
+ rMenu.EnableItem(SID_FM_DELETECOL, bDesignMode && bMarked && xCols.is());
+ rMenu.EnableItem(SID_FM_CHANGECOL, bDesignMode && bMarked && xCols.is());
+ rMenu.EnableItem(SID_FM_SHOW_PROPERTY_BROWSER, bDesignMode && bMarked && xCols.is());
+
+ PopupMenu* pShowColsMenu = rMenu.GetPopupMenu(SID_FM_SHOWCOLS);
+ sal_uInt16 nHiddenCols = 0;
+ if (pShowColsMenu)
+ {
+ if (xCols.is())
+ {
+ // check for hidden cols
+ Reference< ::com::sun::star::beans::XPropertySet > xCurCol;
+ Any aHidden,aName;
+ for (sal_uInt16 i=0; i<xCols->getCount(); ++i)
+ {
+ ::cppu::extractInterface(xCurCol, xCols->getByIndex(i));
+ DBG_ASSERT(xCurCol.is(), "FmGridHeader::PreExecuteColumnContextMenu : the Peer has invalid columns !");
+ aHidden = xCurCol->getPropertyValue(FM_PROP_HIDDEN);
+ DBG_ASSERT(aHidden.getValueType().getTypeClass() == TypeClass_BOOLEAN,
+ "FmGridHeader::PreExecuteColumnContextMenu : the property 'hidden' should be boolean !");
+ if (::comphelper::getBOOL(aHidden))
+ {
+ // put the column name into the 'show col' menu
+ if (nHiddenCols < 16)
+ { // (only the first 16 items to keep the menu rather small)
+ aName = xCurCol->getPropertyValue(FM_PROP_LABEL);
+ pShowColsMenu->InsertItem(nHiddenCols + 1, ::comphelper::getString(aName), 0, nHiddenCols);
+ // the ID is arbitrary, but should be unique within the whole menu
+ }
+ ++nHiddenCols;
+ }
+ }
+ }
+ pShowColsMenu->EnableItem(SID_FM_SHOWCOLS_MORE, xCols.is() && (nHiddenCols > 16));
+ pShowColsMenu->EnableItem(SID_FM_SHOWALLCOLS, xCols.is() && (nHiddenCols > 0));
+ }
+
+ // allow the 'hide column' item ?
+ sal_Bool bAllowHide = bMarked; // a column is marked
+ bAllowHide = bAllowHide || (!bDesignMode && (nPos != (sal_uInt16)-1)); // OR we are in alive mode and have hit a column
+ bAllowHide = bAllowHide && xCols.is(); // AND we have a column container
+ bAllowHide = bAllowHide && (xCols->getCount()-nHiddenCols > 1); // AND there are at least two visible columns
+ rMenu.EnableItem(SID_FM_HIDECOL, bAllowHide);
+
+ sal_Bool bChecked = sal_False;
+ if (bMarked)
+ {
+
+ SfxViewFrame* pCurrentFrame = SfxViewFrame::Current();
+ SfxItemState eState = SFX_ITEM_UNKNOWN;
+ // ask the bindings of the current view frame (which should be the one we're residing in) for the state
+ if (pCurrentFrame)
+ {
+ SfxPoolItem* pItem = NULL;
+ eState = pCurrentFrame->GetBindings().QueryState(SID_FM_CTL_PROPERTIES, pItem);
+
+ if (eState >= SFX_ITEM_AVAILABLE && pItem )
+ {
+ bChecked = pItem->ISA(SfxBoolItem) && ((SfxBoolItem*)pItem)->GetValue();
+ rMenu.CheckItem(SID_FM_SHOW_PROPERTY_BROWSER,bChecked);
+ }
+ delete pItem;
+ }
+ }
+}
+
+enum InspectorAction { eOpenInspector, eCloseInspector, eUpdateInspector, eNone };
+
+//------------------------------------------------------------------------------
+void FmGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMenu& rMenu, sal_uInt16 nExecutionResult)
+{
+ Reference< ::com::sun::star::container::XIndexContainer > xCols(static_cast<FmGridControl*>(GetParent())->GetPeer()->getColumns());
+ sal_uInt16 nPos = GetModelColumnPos(nColId);
+
+ // remove and delet the menu we inserted in PreExecuteColumnContextMenu
+ PopupMenu* pControlMenu = rMenu.GetPopupMenu(SID_FM_CHANGECOL);
+ delete pControlMenu;
+
+ ::rtl::OUString aFieldType;
+ sal_Bool bReplace = sal_False;
+ InspectorAction eInspectorAction = eNone;
+ Reference< XPropertySet > xColumnToInspect;
+ switch (nExecutionResult)
+ {
+ case SID_FM_DELETECOL:
+ {
+ Reference< XInterface > xCol;
+ ::cppu::extractInterface(xCol, xCols->getByIndex(nPos));
+ xCols->removeByIndex(nPos);
+ ::comphelper::disposeComponent(xCol);
+ } break;
+ case SID_FM_SHOW_PROPERTY_BROWSER:
+ eInspectorAction = rMenu.IsItemChecked( SID_FM_SHOW_PROPERTY_BROWSER ) ? eOpenInspector : eCloseInspector;
+ xColumnToInspect.set( xCols->getByIndex( nPos ), UNO_QUERY );
+ break;
+ case SID_FM_EDIT + nChangeTypeOffset:
+ bReplace = sal_True;
+ case SID_FM_EDIT:
+ aFieldType = FM_COL_TEXTFIELD;
+ break;
+ case SID_FM_COMBOBOX + nChangeTypeOffset:
+ bReplace = sal_True;
+ case SID_FM_COMBOBOX:
+ aFieldType = FM_COL_COMBOBOX;
+ break;
+ case SID_FM_LISTBOX + nChangeTypeOffset:
+ bReplace = sal_True;
+ case SID_FM_LISTBOX:
+ aFieldType = FM_COL_LISTBOX;
+ break;
+ case SID_FM_CHECKBOX + nChangeTypeOffset:
+ bReplace = sal_True;
+ case SID_FM_CHECKBOX:
+ aFieldType = FM_COL_CHECKBOX;
+ break;
+ case SID_FM_DATEFIELD + nChangeTypeOffset:
+ bReplace = sal_True;
+ case SID_FM_DATEFIELD:
+ aFieldType = FM_COL_DATEFIELD;
+ break;
+ case SID_FM_TIMEFIELD + nChangeTypeOffset:
+ bReplace = sal_True;
+ case SID_FM_TIMEFIELD:
+ aFieldType = FM_COL_TIMEFIELD;
+ break;
+ case SID_FM_NUMERICFIELD + nChangeTypeOffset:
+ bReplace = sal_True;
+ case SID_FM_NUMERICFIELD:
+ aFieldType = FM_COL_NUMERICFIELD;
+ break;
+ case SID_FM_CURRENCYFIELD + nChangeTypeOffset:
+ bReplace = sal_True;
+ case SID_FM_CURRENCYFIELD:
+ aFieldType = FM_COL_CURRENCYFIELD;
+ break;
+ case SID_FM_PATTERNFIELD + nChangeTypeOffset:
+ bReplace = sal_True;
+ case SID_FM_PATTERNFIELD:
+ aFieldType = FM_COL_PATTERNFIELD;
+ break;
+ case SID_FM_FORMATTEDFIELD + nChangeTypeOffset:
+ bReplace = sal_True;
+ case SID_FM_FORMATTEDFIELD:
+ aFieldType = FM_COL_FORMATTEDFIELD;
+ break;
+ case SID_FM_HIDECOL:
+ {
+ Reference< ::com::sun::star::beans::XPropertySet > xCurCol;
+ ::cppu::extractInterface(xCurCol, xCols->getByIndex(nPos));
+ xCurCol->setPropertyValue(FM_PROP_HIDDEN, makeAny((sal_Bool)sal_True));
+ }
+ break;
+ case SID_FM_SHOWCOLS_MORE:
+ {
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ AbstractFmShowColsDialog* pDlg = pFact->CreateFmShowColsDialog(NULL);
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+ pDlg->SetColumns(xCols);
+ pDlg->Execute();
+ delete pDlg;
+ }
+
+ }
+ break;
+ case SID_FM_SHOWALLCOLS:
+ {
+ // just iterate through all the cols ...
+ Reference< ::com::sun::star::beans::XPropertySet > xCurCol;
+ for (sal_uInt16 i=0; i<xCols->getCount(); ++i)
+ {
+ ::cppu::extractInterface(xCurCol, xCols->getByIndex(i));
+ xCurCol->setPropertyValue(FM_PROP_HIDDEN, makeAny((sal_Bool)sal_False));
+ }
+ // TODO : there must be a more clever way to do this ....
+ // with the above the view is updated after every single model update ...
+ }
+ break;
+ default:
+ if (nExecutionResult>0 && nExecutionResult<=16)
+ { // it was a "show column/<colname>" command (there are at most 16 such items)
+ // search the nExecutionResult'th hidden col
+ Reference< ::com::sun::star::beans::XPropertySet > xCurCol;
+ for (sal_uInt16 i=0; i<xCols->getCount() && nExecutionResult; ++i)
+ {
+ ::cppu::extractInterface(xCurCol, xCols->getByIndex(i));
+ Any aHidden = xCurCol->getPropertyValue(FM_PROP_HIDDEN);
+ if (::comphelper::getBOOL(aHidden))
+ if (!--nExecutionResult)
+ {
+ xCurCol->setPropertyValue(FM_PROP_HIDDEN, makeAny((sal_Bool)sal_False));
+ break;
+ }
+ }
+ }
+ break;
+ }
+
+ if ( aFieldType.getLength() )
+ {
+ try
+ {
+ Reference< XGridColumnFactory > xFactory( xCols, UNO_QUERY_THROW );
+ Reference< XPropertySet > xNewCol( xFactory->createColumn( aFieldType ), UNO_SET_THROW );
+
+ if ( bReplace )
+ {
+ // ein paar Properties hinueberretten
+ Reference< XPropertySet > xReplaced( xCols->getByIndex( nPos ), UNO_QUERY );
+
+ OStaticDataAccessTools().TransferFormComponentProperties(
+ xReplaced, xNewCol, Application::GetSettings().GetUILocale() );
+
+ xCols->replaceByIndex( nPos, makeAny( xNewCol ) );
+ ::comphelper::disposeComponent( xReplaced );
+
+ eInspectorAction = eUpdateInspector;
+ xColumnToInspect = xNewCol;
+ }
+ else
+ {
+ FormControlFactory factory( ::comphelper::getProcessServiceFactory() );
+
+ ::rtl::OUString sLabel = factory.getDefaultUniqueName_ByComponentType(
+ Reference< XNameAccess >( xCols, UNO_QUERY_THROW ), xNewCol );
+ xNewCol->setPropertyValue( FM_PROP_LABEL, makeAny( sLabel ) );
+ xNewCol->setPropertyValue( FM_PROP_NAME, makeAny( sLabel ) );
+
+ factory.initializeControlModel( DocumentClassification::classifyHostDocument( xCols ), xNewCol );
+
+ xCols->insertByIndex( nPos, makeAny( xNewCol ) );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ SfxViewFrame* pCurrentFrame = SfxViewFrame::Current();
+ OSL_ENSURE( pCurrentFrame, "FmGridHeader::PostExecuteColumnContextMenu: no view frame -> no bindings -> no property browser!" );
+ if ( pCurrentFrame )
+ {
+ if ( eInspectorAction == eUpdateInspector )
+ {
+ if ( !pCurrentFrame->HasChildWindow( SID_FM_SHOW_PROPERTIES ) )
+ eInspectorAction = eNone;
+ }
+
+ if ( eInspectorAction != eNone )
+ {
+ FmInterfaceItem aIFaceItem( SID_FM_SHOW_PROPERTY_BROWSER, xColumnToInspect );
+ SfxBoolItem aShowItem( SID_FM_SHOW_PROPERTIES, eInspectorAction == eCloseInspector ? sal_False : sal_True );
+
+ pCurrentFrame->GetBindings().GetDispatcher()->Execute( SID_FM_SHOW_PROPERTY_BROWSER, SFX_CALLMODE_ASYNCHRON,
+ &aIFaceItem, &aShowItem, 0L );
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmGridHeader::triggerColumnContextMenu( const ::Point& _rPreferredPos )
+{
+ // the affected col
+ sal_uInt16 nColId = GetItemId( _rPreferredPos );
+
+ // the menu
+ PopupMenu aContextMenu( SVX_RES( RID_SVXMNU_COLS ) );
+
+ // let derivees modify the menu
+ PreExecuteColumnContextMenu( nColId, aContextMenu );
+ aContextMenu.RemoveDisabledEntries( sal_True, sal_True );
+
+ // execute the menu
+ sal_uInt16 nResult = aContextMenu.Execute( this, _rPreferredPos );
+
+ // let derivees handle the result
+ PostExecuteColumnContextMenu( nColId, aContextMenu, nResult );
+}
+
+//------------------------------------------------------------------------------
+void FmGridHeader::Command(const CommandEvent& rEvt)
+{
+ switch (rEvt.GetCommand())
+ {
+ case COMMAND_CONTEXTMENU:
+ {
+ if (!rEvt.IsMouseEvent())
+ return;
+
+ triggerColumnContextMenu( rEvt.GetMousePosPixel() );
+ }
+ break;
+ default:
+ EditBrowserHeader::Command(rEvt);
+ }
+}
+
+//------------------------------------------------------------------------------
+FmGridControl::FmGridControl(
+ Reference< ::com::sun::star::lang::XMultiServiceFactory > _rxFactory,
+ Window* pParent,
+ FmXGridPeer* _pPeer,
+ WinBits nBits)
+ :DbGridControl(_rxFactory, pParent, nBits)
+ ,m_pPeer(_pPeer)
+ ,m_nCurrentSelectedColumn(-1)
+ ,m_nMarkedColumnId(BROWSER_INVALIDID)
+ ,m_bSelecting(sal_False)
+ ,m_bInColumnMove(sal_False)
+{
+ EnableInteractiveRowHeight( );
+}
+
+//------------------------------------------------------------------------------
+void FmGridControl::Command(const CommandEvent& _rEvt)
+{
+ if ( COMMAND_CONTEXTMENU == _rEvt.GetCommand() )
+ {
+ FmGridHeader* pMyHeader = static_cast< FmGridHeader* >( GetHeaderBar() );
+ if ( pMyHeader && !_rEvt.IsMouseEvent() )
+ { // context menu requested by keyboard
+ if ( 1 == GetSelectColumnCount() || IsDesignMode() )
+ {
+ sal_uInt16 nSelId = GetColumnId(
+ sal::static_int_cast< sal_uInt16 >( FirstSelectedColumn() ) );
+ ::Rectangle aColRect( GetFieldRectPixel( 0, nSelId, sal_False ) );
+
+ Point aRelativePos( pMyHeader->ScreenToOutputPixel( OutputToScreenPixel( aColRect.TopCenter() ) ) );
+ pMyHeader->triggerColumnContextMenu( aRelativePos, FmGridHeader::AccessControl() );
+
+ // handled
+ return;
+ }
+ }
+ }
+
+ DbGridControl::Command( _rEvt );
+}
+
+// ::com::sun::star::beans::XPropertyChangeListener
+//------------------------------------------------------------------------------
+void FmGridControl::propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt)
+{
+ if (evt.PropertyName == FM_PROP_ROWCOUNT)
+ {
+ // if we're not in the main thread call AdjustRows asynchronously
+ implAdjustInSolarThread(sal_True);
+ return;
+ }
+
+ const DbGridRowRef& xRow = GetCurrentRow();
+ // waehrend Positionierung wird kein abgleich der Properties vorgenommen
+ Reference<XPropertySet> xSet(evt.Source,UNO_QUERY);
+ if (xRow.Is() && (::cppu::any2bool(xSet->getPropertyValue(FM_PROP_ISNEW))|| CompareBookmark(getDataSource()->getBookmark(), xRow->GetBookmark())))
+ {
+ if (evt.PropertyName == FM_PROP_ISMODIFIED)
+ {
+ // modified or clean ?
+ GridRowStatus eStatus = ::comphelper::getBOOL(evt.NewValue) ? GRS_MODIFIED : GRS_CLEAN;
+ if (eStatus != xRow->GetStatus())
+ {
+ xRow->SetStatus(eStatus);
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ RowModified(GetCurrentPos());
+ }
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmGridControl::SetDesignMode(sal_Bool bMode)
+{
+ sal_Bool bOldMode = IsDesignMode();
+ DbGridControl::SetDesignMode(bMode);
+ if (bOldMode != bMode)
+ {
+ if (!bMode)
+ {
+ // selection aufheben
+ markColumn(USHRT_MAX);
+ }
+ else
+ {
+ Reference< ::com::sun::star::container::XIndexContainer > xColumns(GetPeer()->getColumns());
+ Reference< ::com::sun::star::view::XSelectionSupplier > xSelSupplier(xColumns, UNO_QUERY);
+ if (xSelSupplier.is())
+ {
+ Any aSelection = xSelSupplier->getSelection();
+ Reference< ::com::sun::star::beans::XPropertySet > xColumn;
+ if (aSelection.getValueType().getTypeClass() == TypeClass_INTERFACE)
+ ::cppu::extractInterface(xColumn, aSelection);
+ Reference< XInterface > xCurrent;
+ for (sal_uInt16 i=0; i<xColumns->getCount(); ++i)
+ {
+ ::cppu::extractInterface(xCurrent, xColumns->getByIndex(i));
+ if (xCurrent == xColumn)
+ {
+ markColumn(GetColumnIdFromModelPos(i));
+ break;
+ }
+ }
+ }
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmGridControl::DeleteSelectedRows()
+{
+ if (!m_pSeekCursor)
+ return;
+
+ // how many rows are selected?
+ sal_Int32 nSelectedRows = GetSelectRowCount();
+
+ // the current line should be deleted but it is currently in edit mode
+ if ( IsCurrentAppending() )
+ return;
+ // is the insert row selected
+ if (GetEmptyRow().Is() && IsRowSelected(GetRowCount() - 1))
+ nSelectedRows -= 1;
+
+ // nothing to do
+ if (nSelectedRows <= 0)
+ return;
+
+ // try to confirm the delete
+ Reference< ::com::sun::star::frame::XDispatchProvider > xDispatcher = (::com::sun::star::frame::XDispatchProvider*)GetPeer();
+ if (xDispatcher.is())
+ {
+ ::com::sun::star::util::URL aUrl;
+ aUrl.Complete = FMURL_CONFIRM_DELETION;
+ // #100312# ------------
+ Reference< ::com::sun::star::util::XURLTransformer > xTransformer(
+ ::comphelper::getProcessServiceFactory()->createInstance(
+ ::rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer")), UNO_QUERY);
+ if( xTransformer.is() )
+ xTransformer->parseStrict( aUrl );
+
+ Reference< ::com::sun::star::frame::XDispatch > xDispatch = xDispatcher->queryDispatch(aUrl, rtl::OUString(), 0);
+ Reference< ::com::sun::star::form::XConfirmDeleteListener > xConfirm(xDispatch, UNO_QUERY);
+ if (xConfirm.is())
+ {
+ ::com::sun::star::sdb::RowChangeEvent aEvent;
+ aEvent.Source = (Reference< XInterface > )(*getDataSource());
+ aEvent.Rows = nSelectedRows;
+ aEvent.Action = ::com::sun::star::sdb::RowChangeAction::DELETE;
+ if (!xConfirm->confirmDelete(aEvent))
+ return;
+ }
+ }
+
+ const MultiSelection* pRowSelection = GetSelection();
+ if ( pRowSelection && pRowSelection->IsAllSelected() )
+ {
+ BeginCursorAction();
+ CursorWrapper* pCursor = getDataSource();
+ Reference< XResultSetUpdate > xUpdateCursor((Reference< XInterface >)*pCursor, UNO_QUERY);
+ try
+ {
+ pCursor->beforeFirst();
+ while( pCursor->next() )
+ xUpdateCursor->deleteRow();
+
+ SetUpdateMode(sal_False);
+ SetNoSelection();
+
+ xUpdateCursor->moveToInsertRow();
+ }
+ catch(const Exception&)
+ {
+ OSL_ENSURE(0,"Exception caught while deleting rows!");
+ }
+ // An den DatenCursor anpassen
+ AdjustDataSource(sal_True);
+ EndCursorAction();
+ SetUpdateMode(sal_True);
+ }
+ else
+ {
+ Reference< ::com::sun::star::sdbcx::XDeleteRows > xDeleteThem((Reference< XInterface >)*getDataSource(), UNO_QUERY);
+
+ // colect the bookmarks of the selected rows
+ Sequence < Any> aBookmarks = getSelectionBookmarks();
+
+ // determine the next row to position after deletion
+ Any aBookmark;
+ sal_Bool bNewPos = sal_False;
+ // if the current row isn't selected we take the row as row after deletion
+ OSL_ENSURE( GetCurrentRow().Is(), "FmGridControl::DeleteSelectedRows: no current row here?" );
+ // crash reports suggest it can happen we don't have a current row - how?
+ // #154303# / 2008-04-23 / frank.schoenheit@sun.com
+ if ( !IsRowSelected( GetCurrentPos() ) && !IsCurrentAppending() && GetCurrentRow().Is() )
+ {
+ aBookmark = GetCurrentRow()->GetBookmark();
+ bNewPos = sal_True;
+ }
+ else
+ {
+ // we look for the first row after the selected block for selection
+ long nIdx = LastSelectedRow() + 1;
+ if (nIdx < GetRowCount() - 1)
+ {
+ // there is a next row to position on
+ if (SeekCursor(nIdx))
+ {
+ GetSeekRow()->SetState(m_pSeekCursor, sal_True);
+
+ bNewPos = sal_True;
+ // if it's not the row for inserting we keep the bookmark
+ if (!IsInsertionRow(nIdx))
+ aBookmark = m_pSeekCursor->getBookmark();
+ }
+ }
+ else
+ {
+ // we look for the first row before the selected block for selection after deletion
+ nIdx = FirstSelectedRow() - 1;
+ if (nIdx >= 0 && SeekCursor(nIdx))
+ {
+ GetSeekRow()->SetState(m_pSeekCursor, sal_True);
+
+ bNewPos = sal_True;
+ aBookmark = m_pSeekCursor->getBookmark();
+ }
+ }
+ }
+
+ // Sind alle Zeilen Selectiert
+ // Zweite bedingung falls keine einguegeZeile existiert
+ sal_Bool bAllSelected = GetTotalCount() == nSelectedRows || GetRowCount() == nSelectedRows;
+
+ BeginCursorAction();
+
+ // now delete the row
+ Sequence <sal_Int32> aDeletedRows;
+ SetUpdateMode( sal_False );
+ try
+ {
+ aDeletedRows = xDeleteThem->deleteRows(aBookmarks);
+ }
+ catch(SQLException&)
+ {
+ }
+ SetUpdateMode( sal_True );
+
+ // how many rows are deleted?
+ sal_Int32 nDeletedRows = 0;
+ const sal_Int32* pSuccess = aDeletedRows.getConstArray();
+ for (sal_Int32 i = 0; i < aDeletedRows.getLength(); i++)
+ {
+ if (pSuccess[i])
+ ++nDeletedRows;
+ }
+
+ // sind Zeilen geloescht worden?
+ if (nDeletedRows)
+ {
+ SetUpdateMode(sal_False);
+ SetNoSelection();
+ try
+ {
+ // did we delete all the rows than try to move to the next possible row
+ if (nDeletedRows == aDeletedRows.getLength())
+ {
+ // there exists a new position to move on
+ if (bNewPos)
+ {
+ if (aBookmark.hasValue())
+ getDataSource()->moveToBookmark(aBookmark);
+ // no valid bookmark so move to the insert row
+ else
+ {
+ Reference< XResultSetUpdate > xUpdateCursor((Reference< XInterface >)*m_pDataCursor, UNO_QUERY);
+ xUpdateCursor->moveToInsertRow();
+ }
+ }
+ else
+ {
+ Reference< ::com::sun::star::beans::XPropertySet > xSet((Reference< XInterface >)*m_pDataCursor, UNO_QUERY);
+
+ sal_Int32 nRecordCount(0);
+ xSet->getPropertyValue(FM_PROP_ROWCOUNT) >>= nRecordCount;
+ if ( m_pDataCursor->rowDeleted() )
+ --nRecordCount;
+
+ // there are no rows left and we have an insert row
+ if (!nRecordCount && GetEmptyRow().Is())
+ {
+ Reference< XResultSetUpdate > xUpdateCursor((Reference< XInterface >)*m_pDataCursor, UNO_QUERY);
+ xUpdateCursor->moveToInsertRow();
+ }
+ else if (nRecordCount)
+ // move to the first row
+ getDataSource()->first();
+ }
+ }
+ // not all the rows where deleted, so move to the first row which remained in the resultset
+ else
+ {
+ for (sal_Int32 i = 0; i < aDeletedRows.getLength(); i++)
+ {
+ if (!pSuccess[i])
+ {
+ getDataSource()->moveToBookmark(aBookmarks.getConstArray()[i]);
+ break;
+ }
+ }
+ }
+ }
+ catch(const Exception&)
+ {
+ try
+ {
+ // positioning went wrong so try to move to the first row
+ getDataSource()->first();
+ }
+ catch(const Exception&)
+ {
+ }
+ }
+
+ // An den DatenCursor anpassen
+ AdjustDataSource(sal_True);
+
+ // es konnten nicht alle Zeilen geloescht werden
+ // da nie nicht geloeschten wieder selektieren
+ if (nDeletedRows < nSelectedRows)
+ {
+ // waren alle selektiert
+ if (bAllSelected)
+ {
+ SelectAll();
+ if (IsInsertionRow(GetRowCount() - 1)) // einfuegeZeile nicht
+ SelectRow(GetRowCount() - 1, sal_False);
+ }
+ else
+ {
+ // select the remaining rows
+ for (sal_Int32 i = 0; i < aDeletedRows.getLength(); i++)
+ {
+ try
+ {
+ if (!pSuccess[i])
+ {
+ m_pSeekCursor->moveToBookmark(m_pDataCursor->getBookmark());
+ SetSeekPos(m_pSeekCursor->getRow() - 1);
+ SelectRow(GetSeekPos());
+ }
+ }
+ catch(const Exception&)
+ {
+ // keep the seekpos in all cases
+ SetSeekPos(m_pSeekCursor->getRow() - 1);
+ }
+ }
+ }
+ }
+
+ EndCursorAction();
+ SetUpdateMode(sal_True);
+ }
+ else // Zeile konnte nicht geloescht werden
+ {
+ EndCursorAction();
+ try
+ {
+ // currentrow is the insert row?
+ if (!IsCurrentAppending())
+ getDataSource()->refreshRow();
+ }
+ catch(const Exception&)
+ {
+ }
+ }
+ }
+
+ // if there is no selection anymore we can start editing
+ if (!GetSelectRowCount())
+ ActivateCell();
+}
+
+
+// XCurrentRecordListener
+//------------------------------------------------------------------------------
+void FmGridControl::positioned(const ::com::sun::star::lang::EventObject& /*rEvent*/)
+{
+ TRACE_RANGE("FmGridControl::positioned");
+ // position on the data source (force it to be done in the main thread)
+ implAdjustInSolarThread(sal_False);
+}
+
+//------------------------------------------------------------------------------
+sal_Bool FmGridControl::commit()
+{
+ // Commit nur ausfuehren, wenn nicht bereits ein Update vom ::com::sun::star::form::component::GridControl ausgefuehrt
+ // wird
+ if (!IsUpdating())
+ {
+ if (Controller().Is() && Controller()->IsModified())
+ {
+ if (!SaveModified())
+ return sal_False;
+ }
+ }
+ return sal_True;
+}
+
+//------------------------------------------------------------------------------
+void FmGridControl::inserted(const ::com::sun::star::lang::EventObject& /*rEvent*/)
+{
+ const DbGridRowRef& xRow = GetCurrentRow();
+ if (!xRow.Is())
+ return;
+
+ // Zeile ist eingefuegt worden, dann den status und mode zuruecksetzen
+ xRow->SetState(m_pDataCursor, sal_False);
+ xRow->SetNew(sal_False);
+
+}
+
+// XCancelUpdateRecordListener
+//------------------------------------------------------------------------------
+void FmGridControl::restored(const ::com::sun::star::lang::EventObject& rEvent)
+{
+ if (!GetCurrentRow().Is())
+ return;
+
+ sal_Bool bAppending = GetCurrentRow()->IsNew();
+ sal_Bool bDirty = GetCurrentRow()->IsModified();
+ if (bAppending && (EditBrowseBox::IsModified() || bDirty))
+ {
+ if (Controller().Is())
+ Controller()->ClearModified();
+
+ // jetzt die Zeile herausnehmen
+ RowRemoved(GetRowCount() - 1, 1, sal_True);
+ GetNavigationBar().InvalidateAll();
+ }
+
+ positioned(rEvent);
+}
+
+//------------------------------------------------------------------------------
+BrowserHeader* FmGridControl::imp_CreateHeaderBar(BrowseBox* pParent)
+{
+ DBG_ASSERT( pParent == this, "FmGridControl::imp_CreateHeaderBar: parent?" );
+ return new FmGridHeader( pParent );
+}
+
+//------------------------------------------------------------------------------
+void FmGridControl::markColumn(sal_uInt16 nId)
+{
+ if (GetHeaderBar() && m_nMarkedColumnId != nId)
+ {
+ // deselektieren
+ if (m_nMarkedColumnId != BROWSER_INVALIDID)
+ {
+ HeaderBarItemBits aBits = GetHeaderBar()->GetItemBits(m_nMarkedColumnId) & ~HIB_FLAT;
+ GetHeaderBar()->SetItemBits(m_nMarkedColumnId, aBits);
+ }
+
+
+ if (nId != BROWSER_INVALIDID)
+ {
+ HeaderBarItemBits aBits = GetHeaderBar()->GetItemBits(nId) | HIB_FLAT;
+ GetHeaderBar()->SetItemBits(nId, aBits);
+ }
+ m_nMarkedColumnId = nId;
+ }
+}
+
+//------------------------------------------------------------------------------
+sal_Bool FmGridControl::isColumnMarked(sal_uInt16 nId) const
+{
+ return m_nMarkedColumnId == nId;
+}
+
+//------------------------------------------------------------------------------
+long FmGridControl::QueryMinimumRowHeight()
+{
+ long nMinimalLogicHeight = 20; // 0.2 cm
+ long nMinimalPixelHeight = LogicToPixel( Point( 0, nMinimalLogicHeight ), MAP_10TH_MM ).Y();
+ return CalcZoom( nMinimalPixelHeight );
+}
+
+//------------------------------------------------------------------------------
+void FmGridControl::RowHeightChanged()
+{
+ DbGridControl::RowHeightChanged();
+
+ Reference< XPropertySet > xModel( GetPeer()->getColumns(), UNO_QUERY );
+ DBG_ASSERT( xModel.is(), "FmGridControl::RowHeightChanged: no model!" );
+ if ( xModel.is() )
+ {
+ try
+ {
+ sal_Int32 nUnzoomedPixelHeight = CalcReverseZoom( GetDataRowHeight() );
+ Any aProperty = makeAny( (sal_Int32)PixelToLogic( Point( 0, nUnzoomedPixelHeight ), MAP_10TH_MM ).Y() );
+ xModel->setPropertyValue( FM_PROP_ROWHEIGHT, aProperty );
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "FmGridControl::RowHeightChanged: caught an exception!" );
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmGridControl::ColumnResized(sal_uInt16 nId)
+{
+ DbGridControl::ColumnResized(nId);
+
+ // Wert ans model uebergeben
+ DbGridColumn* pCol = DbGridControl::GetColumns().GetObject(GetModelColumnPos(nId));
+ Reference< ::com::sun::star::beans::XPropertySet > xColModel(pCol->getModel());
+ if (xColModel.is())
+ {
+ Any aWidth;
+ sal_Int32 nColumnWidth = GetColumnWidth(nId);
+ nColumnWidth = CalcReverseZoom(nColumnWidth);
+ // Umrechnen in 10THMM
+ aWidth <<= (sal_Int32)PixelToLogic(Point(nColumnWidth,0),MAP_10TH_MM).X();
+ xColModel->setPropertyValue(FM_PROP_WIDTH, aWidth);
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmGridControl::CellModified()
+{
+ DbGridControl::CellModified();
+ GetPeer()->CellModified();
+}
+
+//------------------------------------------------------------------------------
+void FmGridControl::BeginCursorAction()
+{
+ DbGridControl::BeginCursorAction();
+ m_pPeer->stopCursorListening();
+}
+
+//------------------------------------------------------------------------------
+void FmGridControl::EndCursorAction()
+{
+ m_pPeer->startCursorListening();
+ DbGridControl::EndCursorAction();
+}
+
+//------------------------------------------------------------------------------
+void FmGridControl::ColumnMoved(sal_uInt16 nId)
+{
+ m_bInColumnMove = sal_True;
+
+ DbGridControl::ColumnMoved(nId);
+ Reference< ::com::sun::star::container::XIndexContainer > xColumns(GetPeer()->getColumns());
+
+ if (xColumns.is())
+ {
+ // suchen der Spalte und verschieben im Model
+ // ColumnPos holen
+ DbGridColumn* pCol = DbGridControl::GetColumns().GetObject(GetModelColumnPos(nId));
+ Reference< ::com::sun::star::beans::XPropertySet > xCol;
+
+ // Einfuegen muß sich an den Column Positionen orientieren
+ sal_Int32 i;
+ Reference< XInterface > xCurrent;
+ for (i = 0; !xCol.is() && i < xColumns->getCount(); i++)
+ {
+ ::cppu::extractInterface(xCurrent, xColumns->getByIndex(i));
+ if (xCurrent == pCol->getModel())
+ {
+ xCol = pCol->getModel();
+ break;
+ }
+ }
+
+ DBG_ASSERT(i < xColumns->getCount(), "Falscher ::com::sun::star::sdbcx::Index");
+ xColumns->removeByIndex(i);
+ Any aElement;
+ aElement <<= xCol;
+ xColumns->insertByIndex(GetModelColumnPos(nId), aElement);
+ pCol->setModel(xCol);
+ // if the column which is shown here is selected ...
+ if ( isColumnSelected(nId,pCol) )
+ markColumn(nId); // ... -> mark it
+ }
+
+ m_bInColumnMove = sal_False;
+}
+
+//------------------------------------------------------------------------------
+void FmGridControl::InitColumnsByModels(const Reference< ::com::sun::star::container::XIndexContainer >& xColumns)
+{
+ // Spalten wieder neu setzen
+ // wenn es nur eine HandleColumn gibt, dann nicht
+ if (GetModelColCount())
+ {
+ RemoveColumns();
+ InsertHandleColumn();
+ }
+
+ if (!xColumns.is())
+ return;
+
+ SetUpdateMode(sal_False);
+
+ // Einfuegen mu� sich an den Column Positionen orientieren
+ sal_Int32 i;
+ String aName;
+ Any aWidth;
+ for (i = 0; i < xColumns->getCount(); ++i)
+ {
+ Reference< ::com::sun::star::beans::XPropertySet > xCol;
+ ::cppu::extractInterface(xCol, xColumns->getByIndex(i));
+
+ aName = (const sal_Unicode*)::comphelper::getString(xCol->getPropertyValue(FM_PROP_LABEL));
+
+ aWidth = xCol->getPropertyValue(FM_PROP_WIDTH);
+ sal_Int32 nWidth = 0;
+ if (aWidth >>= nWidth)
+ nWidth = LogicToPixel(Point(nWidth,0),MAP_10TH_MM).X();
+
+ AppendColumn(aName, (sal_uInt16)nWidth);
+ DbGridColumn* pCol = DbGridControl::GetColumns().GetObject(i);
+ pCol->setModel(xCol);
+ }
+
+ // und jetzt noch die hidden columns rausnehmen
+ // (wir haben das nicht gleich in der oberen Schleife gemacht, da wir dann Probleme mit den
+ // IDs der Spalten bekommen haetten : AppendColumn vergibt die automatisch, die Spalte _nach_
+ // einer versteckten braucht aber eine um eine erhoehte ID ....
+ Any aHidden;
+ for (i = 0; i < xColumns->getCount(); ++i)
+ {
+ Reference< ::com::sun::star::beans::XPropertySet > xCol;
+ ::cppu::extractInterface(xCol, xColumns->getByIndex(i));
+ aHidden = xCol->getPropertyValue(FM_PROP_HIDDEN);
+ if (::comphelper::getBOOL(aHidden))
+ HideColumn(GetColumnIdFromModelPos((sal_uInt16)i));
+ }
+
+ SetUpdateMode(sal_True);
+}
+
+//------------------------------------------------------------------------------
+void FmGridControl::InitColumnByField(
+ DbGridColumn* _pColumn, const Reference< XPropertySet >& _rxColumnModel,
+ const Reference< XNameAccess >& _rxFieldsByNames, const Reference< XIndexAccess >& _rxFieldsByIndex )
+{
+ DBG_ASSERT( _rxFieldsByNames == _rxFieldsByIndex, "FmGridControl::InitColumnByField: invalid container interfaces!" );
+
+ // lookup the column which belongs to the control source
+ ::rtl::OUString sFieldName;
+ _rxColumnModel->getPropertyValue( FM_PROP_CONTROLSOURCE ) >>= sFieldName;
+ Reference< XPropertySet > xField;
+ _rxColumnModel->getPropertyValue( FM_PROP_BOUNDFIELD ) >>= xField;
+
+
+ if ( !xField.is() && /*sFieldName.getLength() && */_rxFieldsByNames->hasByName( sFieldName ) ) // #i93452# do not check for name length
+ _rxFieldsByNames->getByName( sFieldName ) >>= xField;
+
+ // determine the position of this column
+ sal_Int32 nFieldPos = -1;
+ if ( xField.is() )
+ {
+ Reference< XPropertySet > xCheck;
+ sal_Int32 nFieldCount = _rxFieldsByIndex->getCount();
+ for ( sal_Int32 i = 0; i < nFieldCount; ++i)
+ {
+ _rxFieldsByIndex->getByIndex( i ) >>= xCheck;
+ if ( xField.get() == xCheck.get() )
+ {
+ nFieldPos = i;
+ break;
+ }
+ }
+ }
+
+ if ( xField.is() && ( nFieldPos >= 0 ) )
+ {
+ // some data types are not allowed
+ sal_Int32 nDataType = DataType::OTHER;
+ xField->getPropertyValue( FM_PROP_FIELDTYPE ) >>= nDataType;
+
+ sal_Bool bIllegalType = sal_False;
+ switch ( nDataType )
+ {
+ case DataType::BLOB:
+ case DataType::LONGVARBINARY:
+ case DataType::BINARY:
+ case DataType::VARBINARY:
+ case DataType::OTHER:
+ bIllegalType = sal_True;
+ break;
+ }
+
+ if ( bIllegalType )
+ {
+ _pColumn->SetObject( (sal_Int16)nFieldPos );
+ return;
+ }
+/*
+ // handle readonly columns
+ sal_Bool bReadOnly = sal_True;
+ xField->getPropertyValue( FM_PROP_ISREADONLY ) >>= bReadOnly;
+ _pColumn->SetReadOnly( bReadOnly );
+*/
+ }
+
+ // the control type is determined by the ColumnServiceName
+ static ::rtl::OUString s_sPropColumnServiceName( RTL_CONSTASCII_USTRINGPARAM( "ColumnServiceName" ) );
+ if ( !::comphelper::hasProperty( s_sPropColumnServiceName, _rxColumnModel ) )
+ return;
+
+ _pColumn->setModel( _rxColumnModel );
+
+ ::rtl::OUString sColumnServiceName;
+ _rxColumnModel->getPropertyValue( s_sPropColumnServiceName ) >>= sColumnServiceName;
+
+ sal_Int32 nTypeId = getColumnTypeByModelName( sColumnServiceName );
+ _pColumn->CreateControl( nFieldPos, xField, nTypeId );
+}
+
+//------------------------------------------------------------------------------
+void FmGridControl::InitColumnsByFields(const Reference< ::com::sun::star::container::XIndexAccess >& _rxFields)
+{
+ if ( !_rxFields.is() )
+ return;
+
+ // Spalten initialisieren
+ Reference< XIndexContainer > xColumns( GetPeer()->getColumns() );
+ Reference< XNameAccess > xFieldsAsNames( _rxFields, UNO_QUERY );
+
+ // Einfuegen muss sich an den Column Positionen orientieren
+ for (sal_Int32 i = 0; i < xColumns->getCount(); i++)
+ {
+ DbGridColumn* pCol = GetColumns().GetObject(i);
+ OSL_ENSURE(pCol,"No grid column!");
+ if ( pCol )
+ {
+ Reference< XPropertySet > xColumnModel;
+ ::cppu::extractInterface( xColumnModel, xColumns->getByIndex( i ) );
+
+ InitColumnByField( pCol, xColumnModel, xFieldsAsNames, _rxFields );
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmGridControl::HideColumn(sal_uInt16 nId)
+{
+ DbGridControl::HideColumn(nId);
+
+ sal_uInt16 nPos = GetModelColumnPos(nId);
+ if (nPos == (sal_uInt16)-1)
+ return;
+
+ DbGridColumn* pColumn = GetColumns().GetObject(nPos);
+ if (pColumn->IsHidden())
+ GetPeer()->columnHidden(pColumn);
+
+ if (nId == m_nMarkedColumnId)
+ m_nMarkedColumnId = (sal_uInt16)-1;
+}
+// -----------------------------------------------------------------------------
+sal_Bool FmGridControl::isColumnSelected(sal_uInt16 /*nId*/,DbGridColumn* _pColumn)
+{
+ OSL_ENSURE(_pColumn,"Column can not be null!");
+ sal_Bool bSelected = sal_False;
+ // if the column which is shown here is selected ...
+ Reference< ::com::sun::star::view::XSelectionSupplier > xSelSupplier(GetPeer()->getColumns(), UNO_QUERY);
+ if ( xSelSupplier.is() )
+ {
+ Reference< ::com::sun::star::beans::XPropertySet > xColumn;
+ xSelSupplier->getSelection() >>= xColumn;
+ bSelected = (xColumn.get() == _pColumn->getModel().get());
+ }
+ return bSelected;
+}
+
+//------------------------------------------------------------------------------
+void FmGridControl::ShowColumn(sal_uInt16 nId)
+{
+ DbGridControl::ShowColumn(nId);
+
+ sal_uInt16 nPos = GetModelColumnPos(nId);
+ if (nPos == (sal_uInt16)-1)
+ return;
+
+ DbGridColumn* pColumn = GetColumns().GetObject(nPos);
+ if (!pColumn->IsHidden())
+ GetPeer()->columnVisible(pColumn);
+
+ // if the column which is shown here is selected ...
+ if ( isColumnSelected(nId,pColumn) )
+ markColumn(nId); // ... -> mark it
+}
+
+//------------------------------------------------------------------------------
+sal_Bool FmGridControl::selectBookmarks(const Sequence< Any >& _rBookmarks)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ // need to lock the SolarMutex so that no paint call disturbs us ...
+
+ if ( !m_pSeekCursor )
+ {
+ DBG_ERROR( "FmGridControl::selectBookmarks: no seek cursor!" );
+ return sal_False;
+ }
+
+ const Any* pBookmark = _rBookmarks.getConstArray();
+ const Any* pBookmarkEnd = pBookmark + _rBookmarks.getLength();
+
+ SetNoSelection();
+
+ sal_Bool bAllSuccessfull = sal_True;
+ try
+ {
+ for (; pBookmark != pBookmarkEnd; ++pBookmark)
+ {
+ // move the seek cursor to the row given
+ if (m_pSeekCursor->moveToBookmark(*pBookmark))
+ SelectRow( m_pSeekCursor->getRow() - 1);
+ else
+ bAllSuccessfull = sal_False;
+ }
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("FmGridControl::selectBookmarks: could not move to one of the bookmarks!");
+ return sal_False;
+ }
+
+ return bAllSuccessfull;
+}
+
+//------------------------------------------------------------------------------
+Sequence< Any> FmGridControl::getSelectionBookmarks()
+{
+ // lock our update so no paint-triggered seeks interfere ...
+ SetUpdateMode(sal_False);
+
+ sal_Int32 nSelectedRows = GetSelectRowCount(), i = 0;
+ Sequence< Any> aBookmarks(nSelectedRows);
+ if ( nSelectedRows )
+ {
+ Any* pBookmarks = (Any*)aBookmarks.getArray();
+
+ // (I'm not sure if the problem isn't deeper : The szenario : a large table displayed by a grid with a
+ // thread-safe cursor (dBase). On loading the sdb-cursor started a counting thread. While this counting progress
+ // was running, I tried do delete 3 records from within the grid. Deletion caused a SeekCursor, which did a
+ // m_pSeekCursor->moveRelative and a m_pSeekCursor->getPosition.
+ // Unfortunally the first call caused a propertyChanged(RECORDCOUNT) which resulted in a repaint of the
+ // navigation bar and the grid. The latter itself will result in SeekRow calls. So after (successfully) returning
+ // from the moveRelative the getPosition returns an invalid value. And so the SeekCursor fails.
+ // In the consequence ALL parts of code where two calls to the seek cursor are done, while the second call _relys_ on
+ // the first one, should be secured against recursion, with a broad-minded interpretion of "recursion" : if any of these
+ // code parts is executed, no other should be accessible. But this sounds very difficult to achieve ....
+ // )
+
+ // The next problem caused by the same behaviuor (SeekCursor causes a propertyChanged) : when adjusting rows we implicitly
+ // change our selection. So a "FirstSelected(); SeekCursor(); NextSelected();" may produce unpredictable results.
+ // That's why we _first_ collect the indicies of the selected rows and _then_ their bookmarks.
+ long nIdx = FirstSelectedRow();
+ while (nIdx >= 0)
+ {
+ // (we misuse the bookmarks array for this ...)
+ pBookmarks[i++] <<= (sal_Int32)nIdx;
+ nIdx = NextSelectedRow();
+ }
+ DBG_ASSERT(i == nSelectedRows, "FmGridControl::DeleteSelectedRows : could not collect the row indicies !");
+
+ for (i=0; i<nSelectedRows; ++i)
+ {
+ nIdx = ::comphelper::getINT32(pBookmarks[i]);
+ if (IsInsertionRow(nIdx))
+ {
+ // leerzeile nicht loeschen
+ aBookmarks.realloc(--nSelectedRows);
+ SelectRow(nIdx,sal_False); // selection aufheben fuer leerzeile
+ break;
+ }
+
+ // Zunaechst den DatenCursor auf den selektierten Satz pos.
+ if (SeekCursor(nIdx))
+ {
+ GetSeekRow()->SetState(m_pSeekCursor, sal_True);
+
+ pBookmarks[i] = m_pSeekCursor->getBookmark();
+ }
+ #ifdef DBG_UTIL
+ else
+ DBG_ERROR("FmGridControl::DeleteSelectedRows : a bookmark could not be determined !");
+ #endif
+ }
+ }
+ SetUpdateMode(sal_True);
+
+ // if one of the SeekCursor-calls failed ....
+ aBookmarks.realloc(i);
+
+ // (the alternative : while collecting the bookmarks lock our propertyChanged, this should resolve both our problems.
+ // but this would be incompatible as we need a locking flag, then ...)
+
+ return aBookmarks;
+}
+// -----------------------------------------------------------------------------
+namespace
+{
+ ::rtl::OUString getColumnPropertyFromPeer(FmXGridPeer* _pPeer,sal_Int32 _nPosition,const ::rtl::OUString& _sPropName)
+ {
+ ::rtl::OUString sRetText;
+ if ( _pPeer && _nPosition != -1)
+ {
+ Reference<XIndexContainer> xIndex = _pPeer->getColumns();
+ if ( xIndex.is() && xIndex->getCount() > _nPosition )
+ {
+ Reference<XPropertySet> xProp;
+ xIndex->getByIndex( _nPosition ) >>= xProp;
+ if ( xProp.is() )
+ xProp->getPropertyValue( _sPropName ) >>= sRetText;
+ }
+ }
+ return sRetText;
+ }
+}
+// Object data and state ------------------------------------------------------
+::rtl::OUString FmGridControl::GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType _eObjType,sal_Int32 _nPosition ) const
+{
+ ::rtl::OUString sRetText;
+ switch( _eObjType )
+ {
+ case ::svt::BBTYPE_BROWSEBOX:
+ if ( GetPeer() )
+ {
+ Reference<XPropertySet> xProp(GetPeer()->getColumns(),UNO_QUERY);
+ if ( xProp.is() )
+ xProp->getPropertyValue(FM_PROP_NAME) >>= sRetText;
+ }
+ break;
+ case ::svt::BBTYPE_COLUMNHEADERCELL:
+ sRetText = getColumnPropertyFromPeer(
+ GetPeer(),
+ GetModelColumnPos(
+ sal::static_int_cast< sal_uInt16 >(_nPosition)),
+ FM_PROP_LABEL);
+ break;
+ default:
+ sRetText = DbGridControl::GetAccessibleObjectName(_eObjType,_nPosition);
+ }
+ return sRetText;
+}
+// -----------------------------------------------------------------------------
+
+::rtl::OUString FmGridControl::GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType _eObjType,sal_Int32 _nPosition ) const
+{
+ ::rtl::OUString sRetText;
+ switch( _eObjType )
+ {
+ case ::svt::BBTYPE_BROWSEBOX:
+ if ( GetPeer() )
+ {
+ Reference<XPropertySet> xProp(GetPeer()->getColumns(),UNO_QUERY);
+ if ( xProp.is() )
+ {
+ xProp->getPropertyValue(FM_PROP_HELPTEXT) >>= sRetText;
+ if ( !sRetText.getLength() )
+ xProp->getPropertyValue(FM_PROP_DESCRIPTION) >>= sRetText;
+ }
+ }
+ break;
+ case ::svt::BBTYPE_COLUMNHEADERCELL:
+ sRetText = getColumnPropertyFromPeer(
+ GetPeer(),
+ GetModelColumnPos(
+ sal::static_int_cast< sal_uInt16 >(_nPosition)),
+ FM_PROP_HELPTEXT);
+ if ( !sRetText.getLength() )
+ sRetText = getColumnPropertyFromPeer(
+ GetPeer(),
+ GetModelColumnPos(
+ sal::static_int_cast< sal_uInt16 >(_nPosition)),
+ FM_PROP_DESCRIPTION);
+
+ break;
+ default:
+ sRetText = DbGridControl::GetAccessibleObjectDescription(_eObjType,_nPosition);
+ }
+ return sRetText;
+}
+// -----------------------------------------------------------------------------
+void FmGridControl::Select()
+{
+ DbGridControl::Select();
+ // ... betrifft das unsere Spalten ?
+ const MultiSelection* pColumnSelection = GetColumnSelection();
+
+ sal_uInt16 nSelectedColumn =
+ pColumnSelection && pColumnSelection->GetSelectCount()
+ ? sal::static_int_cast< sal_uInt16 >(
+ ((MultiSelection*)pColumnSelection)->FirstSelected())
+ : SAL_MAX_UINT16;
+ // die HandleColumn wird nicht selektiert
+ switch (nSelectedColumn)
+ {
+ case SAL_MAX_UINT16: break; // no selection
+ case 0 : nSelectedColumn = SAL_MAX_UINT16; break;
+ // handle col can't be seledted
+ default :
+ // get the model col pos instead of the view col pos
+ nSelectedColumn = GetModelColumnPos(GetColumnIdFromViewPos(nSelectedColumn - 1));
+ break;
+ }
+
+ if (nSelectedColumn != m_nCurrentSelectedColumn)
+ {
+ // VOR dem Aufruf des select am SelectionSupplier !
+ m_nCurrentSelectedColumn = nSelectedColumn;
+
+ if (!m_bSelecting)
+ {
+ m_bSelecting = sal_True;
+
+ try
+ {
+ Reference< XIndexAccess > xColumns(GetPeer()->getColumns(), UNO_QUERY);
+ Reference< XSelectionSupplier > xSelSupplier(xColumns, UNO_QUERY);
+ if (xSelSupplier.is())
+ {
+ if (nSelectedColumn != SAL_MAX_UINT16)
+ {
+ Reference< XPropertySet > xColumn;
+ ::cppu::extractInterface(xColumn,xColumns->getByIndex(nSelectedColumn));
+ xSelSupplier->select(makeAny(xColumn));
+ }
+ else
+ {
+ xSelSupplier->select(Any());
+ }
+ }
+ }
+ catch(Exception&)
+ {
+ }
+
+
+ m_bSelecting = sal_False;
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+sal_Int32 FmGridControl::GetSelectedColumn() const
+{
+ return m_nCurrentSelectedColumn;
+}
+// -----------------------------------------------------------------------------
+void FmGridControl::KeyInput( const KeyEvent& rKEvt )
+{
+ sal_Bool bDone = sal_False;
+ const KeyCode& rKeyCode = rKEvt.GetKeyCode();
+ if ( IsDesignMode()
+ && !rKeyCode.IsShift()
+ && !rKeyCode.IsMod1()
+ && !rKeyCode.IsMod2()
+ && GetParent() )
+ {
+ switch ( rKeyCode.GetCode() )
+ {
+ case KEY_ESCAPE:
+ GetParent()->GrabFocus();
+ bDone = sal_True;
+ break;
+ case KEY_DELETE:
+ if ( GetSelectColumnCount() && GetPeer() && m_nCurrentSelectedColumn >= 0 )
+ {
+ Reference< ::com::sun::star::container::XIndexContainer > xCols(GetPeer()->getColumns());
+ if ( xCols.is() )
+ {
+ try
+ {
+ if ( m_nCurrentSelectedColumn < xCols->getCount() )
+ {
+ Reference< XInterface > xCol;
+ xCols->getByIndex(m_nCurrentSelectedColumn) >>= xCol;
+ xCols->removeByIndex(m_nCurrentSelectedColumn);
+ ::comphelper::disposeComponent(xCol);
+ }
+ }
+ catch(const Exception&)
+ {
+ OSL_ENSURE(0,"exception occured while deleting a column");
+ }
+ }
+ }
+ bDone = sal_True;
+ break;
+ }
+ }
+ if ( !bDone )
+ DbGridControl::KeyInput( rKEvt );
+}
+// -----------------------------------------------------------------------------
+
+
+
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
new file mode 100644
index 000000000000..47aeceda995b
--- /dev/null
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -0,0 +1,2967 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svx/fmgridif.hxx"
+#include "fmprop.hrc"
+#include "fmservs.hxx"
+#include "svx/fmtools.hxx"
+#include "fmurl.hxx"
+#include "formcontrolfactory.hxx"
+#include "gridcell.hxx"
+#include "sdbdatacolumn.hxx"
+#include "svx/fmgridcl.hxx"
+#include "svx/svxids.hrc"
+#include <tools/urlobj.hxx>
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/form/FormComponentType.hpp>
+#include <com/sun/star/form/XFormComponent.hpp>
+#include <com/sun/star/form/XLoadable.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/sdbc/ResultSetType.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/sdbcx/XRowLocate.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/container.hxx>
+#include <comphelper/enumhelper.hxx>
+#include <comphelper/extract.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/property.hxx>
+#include <comphelper/sequence.hxx>
+#include <comphelper/types.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <tools/diagnose_ex.h>
+
+using namespace ::svxform;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::view;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::form;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star;
+
+using ::com::sun::star::sdbcx::XColumnsSupplier;
+using ::com::sun::star::frame::XDispatchProviderInterceptor;
+using ::com::sun::star::frame::XDispatchProvider;
+using ::com::sun::star::accessibility::XAccessible;
+using ::com::sun::star::accessibility::XAccessibleContext;
+using ::com::sun::star::sdb::XRowSetSupplier;
+using ::com::sun::star::awt::XVclWindowPeer;
+
+
+//------------------------------------------------------------------
+::com::sun::star::awt::FontDescriptor ImplCreateFontDescriptor( const Font& rFont )
+{
+ ::com::sun::star::awt::FontDescriptor aFD;
+ aFD.Name = rFont.GetName();
+ aFD.StyleName = rFont.GetStyleName();
+ aFD.Height = (sal_Int16)rFont.GetSize().Height();
+ aFD.Width = (sal_Int16)rFont.GetSize().Width();
+ aFD.Family = (sal_Int16)rFont.GetFamily();
+ aFD.CharSet = rFont.GetCharSet();
+ aFD.Pitch = (sal_Int16)rFont.GetPitch();
+ aFD.CharacterWidth = VCLUnoHelper::ConvertFontWidth( rFont.GetWidthType() );
+ aFD.Weight= VCLUnoHelper::ConvertFontWeight( rFont.GetWeight() );
+ aFD.Slant = (::com::sun::star::awt::FontSlant)rFont.GetItalic();
+ aFD.Underline = (sal_Int16)rFont.GetUnderline();
+ aFD.Strikeout = (sal_Int16)rFont.GetStrikeout();
+ aFD.Orientation = rFont.GetOrientation();
+ aFD.Kerning = rFont.IsKerning();
+ aFD.WordLineMode = rFont.IsWordLineMode();
+ aFD.Type = 0; // ??? => Nur an Metric...
+ return aFD;
+}
+
+//------------------------------------------------------------------
+Font ImplCreateFont( const ::com::sun::star::awt::FontDescriptor& rDescr )
+{
+ Font aFont;
+ aFont.SetName( rDescr.Name );
+ aFont.SetStyleName( rDescr.StyleName );
+ aFont.SetSize( ::Size( rDescr.Width, rDescr.Height ) );
+ aFont.SetFamily( (FontFamily)rDescr.Family );
+ aFont.SetCharSet( (CharSet)rDescr.CharSet );
+ aFont.SetPitch( (FontPitch)rDescr.Pitch );
+ aFont.SetWidthType( VCLUnoHelper::ConvertFontWidth( rDescr.CharacterWidth ) );
+ aFont.SetWeight( VCLUnoHelper::ConvertFontWeight( rDescr.Weight ) );
+ aFont.SetItalic( (FontItalic)rDescr.Slant );
+ aFont.SetUnderline( (::FontUnderline)rDescr.Underline );
+ aFont.SetStrikeout( (::FontStrikeout)rDescr.Strikeout );
+ aFont.SetOrientation( (sal_Int16)rDescr.Orientation );
+ aFont.SetKerning( rDescr.Kerning );
+ aFont.SetWordLineMode( rDescr.WordLineMode );
+ return aFont;
+}
+
+//==================================================================
+//= FmXModifyMultiplexer
+//==================================================================
+//------------------------------------------------------------------
+FmXModifyMultiplexer::FmXModifyMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& _rMutex )
+ :OWeakSubObject( rSource )
+ ,OInterfaceContainerHelper( _rMutex )
+{
+}
+
+//------------------------------------------------------------------
+Any SAL_CALL FmXModifyMultiplexer::queryInterface(const Type& _rType) throw (RuntimeException)
+{
+ Any aReturn;
+ aReturn = ::cppu::queryInterface(_rType,
+ static_cast< ::com::sun::star::util::XModifyListener*>(this),
+ static_cast< XEventListener*>(this)
+ );
+
+ if (!aReturn.hasValue())
+ aReturn = OWeakSubObject::queryInterface( _rType );
+
+ return aReturn;
+}
+
+//------------------------------------------------------------------
+void FmXModifyMultiplexer::disposing(const EventObject& ) throw( RuntimeException )
+{
+}
+
+//------------------------------------------------------------------
+void FmXModifyMultiplexer::modified(const EventObject& e) throw( RuntimeException )
+{
+ EventObject aMulti( e);
+ aMulti.Source = &m_rParent;
+ notifyEach( &XModifyListener::modified, aMulti );
+}
+
+//==================================================================
+//= FmXUpdateMultiplexer
+//==================================================================
+//------------------------------------------------------------------
+FmXUpdateMultiplexer::FmXUpdateMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& _rMutex )
+ :OWeakSubObject( rSource )
+ ,OInterfaceContainerHelper( _rMutex )
+{
+}
+
+//------------------------------------------------------------------
+Any SAL_CALL FmXUpdateMultiplexer::queryInterface(const Type& _rType) throw (RuntimeException)
+{
+ Any aReturn;
+ aReturn = ::cppu::queryInterface(_rType,
+ static_cast< XUpdateListener*>(this),
+ static_cast< XEventListener*>(this)
+ );
+
+ if (!aReturn.hasValue())
+ aReturn = OWeakSubObject::queryInterface( _rType );
+
+ return aReturn;
+}
+
+//------------------------------------------------------------------
+void FmXUpdateMultiplexer::disposing(const EventObject& ) throw( RuntimeException )
+{
+}
+
+//------------------------------------------------------------------
+sal_Bool FmXUpdateMultiplexer::approveUpdate(const EventObject &e) throw( RuntimeException )
+{
+ EventObject aMulti( e );
+ aMulti.Source = &m_rParent;
+
+ sal_Bool bResult = sal_True;
+ if (getLength())
+ {
+ ::cppu::OInterfaceIteratorHelper aIter(*this);
+ while ( bResult && aIter.hasMoreElements() )
+ bResult = static_cast< XUpdateListener* >( aIter.next() )->approveUpdate( aMulti );
+ }
+
+ return bResult;
+}
+
+//------------------------------------------------------------------
+void FmXUpdateMultiplexer::updated(const EventObject &e) throw( RuntimeException )
+{
+ EventObject aMulti( e );
+ aMulti.Source = &m_rParent;
+ notifyEach( &XUpdateListener::updated, aMulti );
+}
+
+
+//==================================================================
+//= FmXSelectionMultiplexer
+//==================================================================
+//------------------------------------------------------------------
+FmXSelectionMultiplexer::FmXSelectionMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& _rMutex )
+ :OWeakSubObject( rSource )
+ ,OInterfaceContainerHelper( _rMutex )
+{
+}
+
+//------------------------------------------------------------------
+Any SAL_CALL FmXSelectionMultiplexer::queryInterface(const Type& _rType) throw (RuntimeException)
+{
+ Any aReturn;
+ aReturn = ::cppu::queryInterface(_rType,
+ static_cast< XSelectionChangeListener*>(this),
+ static_cast< XEventListener*>(this)
+ );
+
+ if (!aReturn.hasValue())
+ aReturn = OWeakSubObject::queryInterface( _rType );
+
+ return aReturn;
+}
+
+//------------------------------------------------------------------
+void FmXSelectionMultiplexer::disposing(const EventObject& ) throw( RuntimeException )
+{
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXSelectionMultiplexer::selectionChanged( const EventObject& _rEvent ) throw (RuntimeException)
+{
+ EventObject aMulti(_rEvent);
+ aMulti.Source = &m_rParent;
+ notifyEach( &XSelectionChangeListener::selectionChanged, aMulti );
+}
+
+//==================================================================
+//= FmXContainerMultiplexer
+//==================================================================
+//------------------------------------------------------------------
+FmXContainerMultiplexer::FmXContainerMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& _rMutex )
+ :OWeakSubObject( rSource )
+ ,OInterfaceContainerHelper( _rMutex )
+{
+}
+
+//------------------------------------------------------------------
+Any SAL_CALL FmXContainerMultiplexer::queryInterface(const Type& _rType) throw (RuntimeException)
+{
+ Any aReturn;
+ aReturn = ::cppu::queryInterface(_rType,
+ static_cast< XContainerListener*>(this),
+ static_cast< XEventListener*>(this)
+ );
+
+ if (!aReturn.hasValue())
+ aReturn = OWeakSubObject::queryInterface( _rType );
+
+ return aReturn;
+}
+
+//------------------------------------------------------------------
+void FmXContainerMultiplexer::disposing(const EventObject& ) throw( RuntimeException )
+{
+}
+//------------------------------------------------------------------
+void FmXContainerMultiplexer::elementInserted(const ContainerEvent& e) throw( RuntimeException )
+{
+ ContainerEvent aMulti( e );
+ aMulti.Source = &m_rParent;
+ notifyEach( &XContainerListener::elementInserted, aMulti );
+}
+
+//------------------------------------------------------------------
+void FmXContainerMultiplexer::elementRemoved(const ContainerEvent& e) throw( RuntimeException )
+{
+ ContainerEvent aMulti( e );
+ aMulti.Source = &m_rParent;
+ notifyEach( &XContainerListener::elementRemoved, aMulti );
+}
+
+
+//------------------------------------------------------------------
+void FmXContainerMultiplexer::elementReplaced(const ContainerEvent& e) throw( RuntimeException )
+{
+ ContainerEvent aMulti( e );
+ aMulti.Source = &m_rParent;
+ notifyEach( &XContainerListener::elementReplaced, aMulti );
+}
+
+//==================================================================
+//= FmXGridControlMultiplexer
+//==================================================================
+//------------------------------------------------------------------
+FmXGridControlMultiplexer::FmXGridControlMultiplexer( ::cppu::OWeakObject& rSource, ::osl::Mutex& _rMutex )
+ :OWeakSubObject( rSource )
+ ,OInterfaceContainerHelper( _rMutex )
+{
+}
+
+//------------------------------------------------------------------
+Any SAL_CALL FmXGridControlMultiplexer::queryInterface(const Type& _rType) throw (RuntimeException)
+{
+ Any aReturn;
+ aReturn = ::cppu::queryInterface( _rType,
+ static_cast< XGridControlListener*>(this)
+ );
+
+ if (!aReturn.hasValue())
+ aReturn = OWeakSubObject::queryInterface( _rType );
+
+ return aReturn;
+}
+
+//------------------------------------------------------------------
+void FmXGridControlMultiplexer::disposing( const EventObject& ) throw( RuntimeException )
+{
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXGridControlMultiplexer::columnChanged( const EventObject& _event ) throw (RuntimeException)
+{
+ EventObject aForwardedEvent( _event );
+ aForwardedEvent.Source = &m_rParent;
+ notifyEach( &XGridControlListener::columnChanged, aForwardedEvent );
+}
+
+//==================================================================
+//= FmXGridControl
+//==================================================================
+
+//------------------------------------------------------------------
+Reference< XInterface > SAL_CALL FmXGridControl_NewInstance_Impl(const Reference< XMultiServiceFactory>& _rxFactory)
+{
+ return *(new FmXGridControl(_rxFactory));
+}
+DBG_NAME(FmXGridControl )
+//------------------------------------------------------------------------------
+FmXGridControl::FmXGridControl(const Reference< XMultiServiceFactory >& _rxFactory)
+ :m_aModifyListeners(*this, GetMutex())
+ ,m_aUpdateListeners(*this, GetMutex())
+ ,m_aContainerListeners(*this, GetMutex())
+ ,m_aSelectionListeners(*this, GetMutex())
+ ,m_aGridControlListeners(*this, GetMutex())
+ ,m_nPeerCreationLevel(0)
+ ,m_bInDraw(sal_False)
+ ,m_xServiceFactory(_rxFactory)
+{
+ DBG_CTOR(FmXGridControl ,NULL);
+}
+
+//------------------------------------------------------------------------------
+FmXGridControl::~FmXGridControl()
+{
+ DBG_DTOR(FmXGridControl ,NULL);
+}
+
+//------------------------------------------------------------------
+Any SAL_CALL FmXGridControl::queryAggregation(const Type& _rType) throw (RuntimeException)
+{
+ Any aReturn = FmXGridControl_BASE::queryInterface(_rType);
+
+ if (!aReturn.hasValue())
+ aReturn = UnoControl::queryAggregation( _rType );
+ return aReturn;
+}
+
+//------------------------------------------------------------------
+Sequence< Type> SAL_CALL FmXGridControl::getTypes( ) throw(RuntimeException)
+{
+ return comphelper::concatSequences(UnoControl::getTypes(),FmXGridControl_BASE::getTypes());
+}
+
+//------------------------------------------------------------------
+Sequence<sal_Int8> SAL_CALL FmXGridControl::getImplementationId( ) throw(RuntimeException)
+{
+ static ::cppu::OImplementationId* pId = 0;
+ if (! pId)
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if (! pId)
+ {
+ static ::cppu::OImplementationId aId;
+ pId = &aId;
+ }
+ }
+ return pId->getImplementationId();
+}
+
+// XServiceInfo
+//------------------------------------------------------------------------------
+sal_Bool SAL_CALL FmXGridControl::supportsService(const ::rtl::OUString& ServiceName) throw()
+{
+ ::comphelper::StringSequence aSupported = getSupportedServiceNames();
+ const ::rtl::OUString * pArray = aSupported.getConstArray();
+ for( sal_Int32 i = 0; i < aSupported.getLength(); i++ )
+ if( pArray[i] == ServiceName )
+ return sal_True;
+ return sal_False;
+}
+
+//------------------------------------------------------------------------------
+::rtl::OUString SAL_CALL FmXGridControl::getImplementationName() throw()
+{
+ return ::rtl::OUString::createFromAscii("com.sun.star.form.FmXGridControl");
+}
+
+//------------------------------------------------------------------------------
+::comphelper::StringSequence SAL_CALL FmXGridControl::getSupportedServiceNames() throw()
+{
+ Sequence< ::rtl::OUString > aServiceNames(2);
+ aServiceNames[0] = FM_SUN_CONTROL_GRIDCONTROL;
+ aServiceNames[1] = ::rtl::OUString::createFromAscii("com.sun.star.awt.UnoControl");
+ return aServiceNames;
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXGridControl::dispose() throw( RuntimeException )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ EventObject aEvt;
+ aEvt.Source = static_cast< ::cppu::OWeakObject* >(this);
+ m_aModifyListeners.disposeAndClear(aEvt);
+ m_aUpdateListeners.disposeAndClear(aEvt);
+ m_aContainerListeners.disposeAndClear(aEvt);
+
+ UnoControl::dispose();
+}
+
+//------------------------------------------------------------------------------
+::rtl::OUString FmXGridControl::GetComponentServiceName()
+{
+ ::rtl::OUString aName = ::rtl::OUString::createFromAscii("DBGrid");
+ return aName;
+}
+
+//------------------------------------------------------------------------------
+sal_Bool SAL_CALL FmXGridControl::setModel(const Reference< ::com::sun::star::awt::XControlModel >& rModel) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ if (!UnoControl::setModel(rModel))
+ return sal_False;
+
+ Reference< XGridPeer > xGridPeer(getPeer(), UNO_QUERY);
+ if (xGridPeer.is())
+ {
+ Reference< XIndexContainer > xCols(mxModel, UNO_QUERY);
+ xGridPeer->setColumns(xCols);
+ }
+ return sal_True;
+}
+
+//------------------------------------------------------------------------------
+FmXGridPeer* FmXGridControl::imp_CreatePeer(Window* pParent)
+{
+ FmXGridPeer* pReturn = new FmXGridPeer(m_xServiceFactory);
+
+ // translate properties into WinBits
+ WinBits nStyle = WB_TABSTOP;
+ Reference< XPropertySet > xModelSet(getModel(), UNO_QUERY);
+ if (xModelSet.is())
+ {
+ try
+ {
+ if (::comphelper::getINT16(xModelSet->getPropertyValue(FM_PROP_BORDER)))
+ nStyle |= WB_BORDER;
+ }
+ catch(const Exception&)
+ {
+ OSL_ASSERT(!"Can not get style");
+ }
+ }
+
+ pReturn->Create(pParent, nStyle);
+ return pReturn;
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXGridControl::createPeer(const Reference< ::com::sun::star::awt::XToolkit >& /*rToolkit*/, const Reference< ::com::sun::star::awt::XWindowPeer >& rParentPeer) throw( RuntimeException )
+{
+ if ( !mxModel.is() )
+ throw DisposedException( ::rtl::OUString(), *this );
+
+ DBG_ASSERT(/*(0 == m_nPeerCreationLevel) && */!mbCreatingPeer, "FmXGridControl::createPeer : recursion!");
+ // I think this should never assert, now that we're using the base class' mbCreatingPeer in addition to
+ // our own m_nPeerCreationLevel
+ // But I'm not sure as I don't _fully_ understand the underlying toolkit implementations ....
+ // (if this asserts, we still need m_nPeerCreationLevel. If not, we could omit it ....)
+ // 14.05.2001 - 86836 - frank.schoenheit@germany.sun.com
+
+ // TODO: why the hell this whole class does not use any mutex?
+
+ if (!getPeer().is())
+ {
+ mbCreatingPeer = sal_True;
+ // mbCreatingPeer is virtually the same as m_nPeerCreationLevel, but it's the base class' method
+ // to prevent recursion.
+
+ Window* pParentWin = NULL;
+ if (rParentPeer.is())
+ {
+ VCLXWindow* pParent = VCLXWindow::GetImplementation(rParentPeer);
+ if (pParent)
+ pParentWin = pParent->GetWindow();
+ }
+
+ FmXGridPeer* pPeer = imp_CreatePeer(pParentWin);
+ DBG_ASSERT(pPeer != NULL, "FmXGridControl::createPeer : imp_CreatePeer didn't return a peer !");
+ setPeer( pPeer );
+
+ // lesen der properties aus dem model
+// ++m_nPeerCreationLevel;
+ updateFromModel();
+
+ // folgendes unschoene Szenario : updateFromModel fuehrt zu einem propertiesChanged am Control,
+ // das stellt fest, dass sich eine 'kritische' Property geaendert hat (zum Beispiel "Border") und
+ // legt daraufhin eine neue Peer an, was wieder hier im createPeer landet, wir legen also eine
+ // zweite FmXGridPeer an und initialisieren die. Dann kommen wir in der ersten Inkarnation aus
+ // dem updsateFromModel raus und arbeiten dort weiter mit dem pPeer, das jetzt eigentlich schon
+ // veraltet ist (da ja in der zweiten Inkarnation eine andere Peer angelegt wurde).
+ // Deswegen also der Aufwand mit dem PeerCreationLevel, das stellt sicher, dass wir die in dem
+ // tiefsten Level angelegte Peer wirklich verwenden, sie aber erst im top-level
+ // initialisieren.
+// if (--m_nPeerCreationLevel == 0)
+ {
+ DBG_ASSERT(getPeer().is(), "FmXGridControl::createPeer : something went wrong ... no top level peer !");
+ pPeer = FmXGridPeer::getImplementation(getPeer());
+
+ setPosSize( maComponentInfos.nX, maComponentInfos.nY, maComponentInfos.nWidth, maComponentInfos.nHeight, ::com::sun::star::awt::PosSize::POSSIZE );
+
+ Reference< XIndexContainer > xColumns(getModel(), UNO_QUERY);
+ if (xColumns.is())
+ pPeer->setColumns(xColumns);
+
+ if (maComponentInfos.bVisible)
+ pPeer->setVisible(sal_True);
+
+ if (!maComponentInfos.bEnable)
+ pPeer->setEnable(sal_False);
+
+ if (maWindowListeners.getLength())
+ pPeer->addWindowListener( &maWindowListeners );
+
+ if (maFocusListeners.getLength())
+ pPeer->addFocusListener( &maFocusListeners );
+
+ if (maKeyListeners.getLength())
+ pPeer->addKeyListener( &maKeyListeners );
+
+ if (maMouseListeners.getLength())
+ pPeer->addMouseListener( &maMouseListeners );
+
+ if (maMouseMotionListeners.getLength())
+ pPeer->addMouseMotionListener( &maMouseMotionListeners );
+
+ if (maPaintListeners.getLength())
+ pPeer->addPaintListener( &maPaintListeners );
+
+ if (m_aModifyListeners.getLength())
+ pPeer->addModifyListener( &m_aModifyListeners );
+
+ if (m_aUpdateListeners.getLength())
+ pPeer->addUpdateListener( &m_aUpdateListeners );
+
+ if (m_aContainerListeners.getLength())
+ pPeer->addContainerListener( &m_aContainerListeners );
+
+ // forward the design mode
+ sal_Bool bForceAlivePeer = m_bInDraw && !maComponentInfos.bVisible;
+ // (we force a alive-mode peer if we're in "draw", cause in this case the peer will be used for drawing in
+ // foreign devices. We ensure this with the visibility check as an living peer is assumed to be noncritical
+ // only if invisible)
+ Any aOldCursorBookmark;
+ if (!mbDesignMode || bForceAlivePeer)
+ {
+ Reference< XFormComponent > xComp(getModel(), UNO_QUERY);
+ if (xComp.is())
+ {
+ Reference< XRowSet > xForm(xComp->getParent(), UNO_QUERY);
+ // is the form alive?
+ // we can see that if the form contains columns
+ Reference< ::com::sun::star::sdbcx::XColumnsSupplier > xColumnsSupplier(xForm, UNO_QUERY);
+ if (xColumnsSupplier.is())
+ {
+ if (Reference< XIndexAccess > (xColumnsSupplier->getColumns(),UNO_QUERY)->getCount())
+ {
+ // we get only a new bookmark if the resultset is not forwardonly
+ if (::comphelper::getINT32(Reference< XPropertySet > (xForm, UNO_QUERY)->getPropertyValue(FM_PROP_RESULTSET_TYPE)) != ResultSetType::FORWARD_ONLY)
+ {
+ // as the FmGridControl touches the data source it is connected to we have to remember the current
+ // cursor position (and restore afterwards)
+ // OJ: but only when we stand on a valid row
+ Reference< XResultSet > xResultSet(xForm, UNO_QUERY);
+ if ( !xResultSet->isBeforeFirst() && !xResultSet->isAfterLast() )
+ {
+ try
+ {
+ aOldCursorBookmark = Reference< ::com::sun::star::sdbcx::XRowLocate > (xForm, UNO_QUERY)->getBookmark();
+ }
+ catch( const Exception& e )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ (void)e;
+ }
+ }
+ }
+ }
+ }
+ pPeer->setRowSet(xForm);
+ }
+ }
+ pPeer->setDesignMode(mbDesignMode && !bForceAlivePeer);
+
+ try
+ {
+ if (aOldCursorBookmark.hasValue())
+ { // we have a valid bookmark, so we have to restore the cursor's position
+ Reference< XFormComponent > xComp(getModel(), UNO_QUERY);
+ Reference< ::com::sun::star::sdbcx::XRowLocate > xLocate(xComp->getParent(), UNO_QUERY);
+ xLocate->moveToBookmark(aOldCursorBookmark);
+ }
+ }
+ catch( const Exception& e )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ (void)e;
+ }
+
+ Reference< ::com::sun::star::awt::XView > xPeerView(getPeer(), UNO_QUERY);
+ xPeerView->setZoom( maComponentInfos.nZoomX, maComponentInfos.nZoomY );
+ xPeerView->setGraphics( mxGraphics );
+ }
+ mbCreatingPeer = sal_False;
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXGridControl::addModifyListener(const Reference< ::com::sun::star::util::XModifyListener >& l) throw( RuntimeException )
+{
+ m_aModifyListeners.addInterface( l );
+ if( getPeer().is() && m_aModifyListeners.getLength() == 1 )
+ {
+ Reference< ::com::sun::star::util::XModifyBroadcaster > xGrid(getPeer(), UNO_QUERY);
+ xGrid->addModifyListener( &m_aModifyListeners);
+ }
+}
+
+//------------------------------------------------------------------------------
+sal_Bool SAL_CALL FmXGridControl::select( const Any& _rSelection ) throw (IllegalArgumentException, RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ Reference< XSelectionSupplier > xPeer(getPeer(), UNO_QUERY);
+ return xPeer->select(_rSelection);
+}
+
+//------------------------------------------------------------------------------
+Any SAL_CALL FmXGridControl::getSelection( ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ Reference< XSelectionSupplier > xPeer(getPeer(), UNO_QUERY);
+ return xPeer->getSelection();
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXGridControl::addSelectionChangeListener( const Reference< XSelectionChangeListener >& _rxListener ) throw (RuntimeException)
+{
+ m_aSelectionListeners.addInterface( _rxListener );
+ if( getPeer().is() && 1 == m_aSelectionListeners.getLength() )
+ {
+ Reference< XSelectionSupplier > xGrid(getPeer(), UNO_QUERY);
+ xGrid->addSelectionChangeListener( &m_aSelectionListeners);
+ }
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXGridControl::removeSelectionChangeListener( const Reference< XSelectionChangeListener >& _rxListener ) throw (RuntimeException)
+{
+ if( getPeer().is() && 1 == m_aSelectionListeners.getLength() )
+ {
+ Reference< XSelectionSupplier > xGrid(getPeer(), UNO_QUERY);
+ xGrid->removeSelectionChangeListener( &m_aSelectionListeners);
+ }
+ m_aSelectionListeners.removeInterface( _rxListener );
+}
+
+//------------------------------------------------------------------------------
+Sequence< sal_Bool > SAL_CALL FmXGridControl::queryFieldDataType( const Type& xType ) throw(RuntimeException)
+{
+ if (getPeer().is())
+ {
+ Reference< XGridFieldDataSupplier > xPeerSupplier(getPeer(), UNO_QUERY);
+ if (xPeerSupplier.is())
+ return xPeerSupplier->queryFieldDataType(xType);
+ }
+
+ return Sequence<sal_Bool>();
+}
+
+//------------------------------------------------------------------------------
+Sequence< Any > SAL_CALL FmXGridControl::queryFieldData( sal_Int32 nRow, const Type& xType ) throw(RuntimeException)
+{
+ if (getPeer().is())
+ {
+ Reference< XGridFieldDataSupplier > xPeerSupplier(getPeer(), UNO_QUERY);
+ if (xPeerSupplier.is())
+ return xPeerSupplier->queryFieldData(nRow, xType);
+ }
+
+ return Sequence< Any>();
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXGridControl::removeModifyListener(const Reference< ::com::sun::star::util::XModifyListener >& l) throw( RuntimeException )
+{
+ if( getPeer().is() && m_aModifyListeners.getLength() == 1 )
+ {
+ Reference< ::com::sun::star::util::XModifyBroadcaster > xGrid(getPeer(), UNO_QUERY);
+ xGrid->removeModifyListener( &m_aModifyListeners);
+ }
+ m_aModifyListeners.removeInterface( l );
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXGridControl::draw( sal_Int32 x, sal_Int32 y ) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ m_bInDraw = sal_True;
+ UnoControl::draw(x, y);
+ m_bInDraw = sal_False;
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXGridControl::setDesignMode(sal_Bool bOn) throw( RuntimeException )
+{
+ ::com::sun::star::util::ModeChangeEvent aModeChangeEvent;
+
+ // --- <mutex_lock> ---
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ Reference< XRowSetSupplier > xGrid(getPeer(), UNO_QUERY);
+
+ if (xGrid.is() && (bOn != mbDesignMode || (!bOn && !xGrid->getRowSet().is())))
+ {
+ if (bOn)
+ {
+ xGrid->setRowSet(Reference< XRowSet > ());
+ }
+ else
+ {
+ Reference< XFormComponent > xComp(getModel(), UNO_QUERY);
+ if (xComp.is())
+ {
+ Reference< XRowSet > xForm(xComp->getParent(), UNO_QUERY);
+ xGrid->setRowSet(xForm);
+ }
+ }
+
+ mbDesignMode = bOn;
+
+ Reference< XVclWindowPeer > xVclWindowPeer( getPeer(), UNO_QUERY );
+ if (xVclWindowPeer.is())
+ xVclWindowPeer->setDesignMode(bOn);
+ }
+ mbDesignMode = bOn;
+
+ // dispose our current AccessibleContext, if we have one
+ // (changing the design mode implies having a new implementation for this context,
+ // so the old one must be declared DEFUNC)
+ disposeAccessibleContext();
+
+ // prepare firing an event
+ aModeChangeEvent.Source = *this;
+ aModeChangeEvent.NewMode = ::rtl::OUString::createFromAscii( mbDesignMode ? "design" : "alive" );
+ }
+
+ // --- </mutex_lock> ---
+ maModeChangeListeners.notifyEach( &XModeChangeListener::modeChanged, aModeChangeEvent );
+}
+
+// XBoundComponent
+//------------------------------------------------------------------------------
+void SAL_CALL FmXGridControl::addUpdateListener(const Reference< XUpdateListener >& l) throw( RuntimeException )
+{
+ m_aUpdateListeners.addInterface( l );
+ if( getPeer().is() && m_aUpdateListeners.getLength() == 1 )
+ {
+ Reference< XBoundComponent > xBound(getPeer(), UNO_QUERY);
+ xBound->addUpdateListener( &m_aUpdateListeners);
+ }
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXGridControl::removeUpdateListener(const Reference< XUpdateListener >& l) throw( RuntimeException )
+{
+ if( getPeer().is() && m_aUpdateListeners.getLength() == 1 )
+ {
+ Reference< XBoundComponent > xBound(getPeer(), UNO_QUERY);
+ xBound->removeUpdateListener( &m_aUpdateListeners);
+ }
+ m_aUpdateListeners.removeInterface( l );
+}
+
+//------------------------------------------------------------------------------
+sal_Bool SAL_CALL FmXGridControl::commit() throw( RuntimeException )
+{
+ Reference< XBoundComponent > xBound(getPeer(), UNO_QUERY);
+ if (xBound.is())
+ return xBound->commit();
+ else
+ return sal_True;
+}
+
+// XContainer
+//------------------------------------------------------------------------------
+void SAL_CALL FmXGridControl::addContainerListener(const Reference< XContainerListener >& l) throw( RuntimeException )
+{
+ m_aContainerListeners.addInterface( l );
+ if( getPeer().is() && m_aContainerListeners.getLength() == 1 )
+ {
+ Reference< XContainer > xContainer(getPeer(), UNO_QUERY);
+ xContainer->addContainerListener( &m_aContainerListeners);
+ }
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXGridControl::removeContainerListener(const Reference< XContainerListener >& l) throw( RuntimeException )
+{
+ if( getPeer().is() && m_aContainerListeners.getLength() == 1 )
+ {
+ Reference< XContainer > xContainer(getPeer(), UNO_QUERY);
+ xContainer->removeContainerListener( &m_aContainerListeners);
+ }
+ m_aContainerListeners.removeInterface( l );
+}
+
+//------------------------------------------------------------------------------
+Reference< ::com::sun::star::frame::XDispatch > SAL_CALL FmXGridControl::queryDispatch(const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags) throw( RuntimeException )
+{
+ Reference< ::com::sun::star::frame::XDispatchProvider > xPeerProvider(getPeer(), UNO_QUERY);
+ if (xPeerProvider.is())
+ return xPeerProvider->queryDispatch(aURL, aTargetFrameName, nSearchFlags);
+ else
+ return Reference< ::com::sun::star::frame::XDispatch > ();
+}
+
+//------------------------------------------------------------------------------
+Sequence< Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL FmXGridControl::queryDispatches(const Sequence< ::com::sun::star::frame::DispatchDescriptor>& aDescripts) throw( RuntimeException )
+{
+ Reference< ::com::sun::star::frame::XDispatchProvider > xPeerProvider(getPeer(), UNO_QUERY);
+ if (xPeerProvider.is())
+ return xPeerProvider->queryDispatches(aDescripts);
+ else
+ return Sequence< Reference< ::com::sun::star::frame::XDispatch > >();
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXGridControl::registerDispatchProviderInterceptor(const Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& _xInterceptor) throw( RuntimeException )
+{
+ Reference< ::com::sun::star::frame::XDispatchProviderInterception > xPeerInterception(getPeer(), UNO_QUERY);
+ if (xPeerInterception.is())
+ xPeerInterception->registerDispatchProviderInterceptor(_xInterceptor);
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXGridControl::releaseDispatchProviderInterceptor(const Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& _xInterceptor) throw( RuntimeException )
+{
+ Reference< ::com::sun::star::frame::XDispatchProviderInterception > xPeerInterception(getPeer(), UNO_QUERY);
+ if (xPeerInterception.is())
+ xPeerInterception->releaseDispatchProviderInterceptor(_xInterceptor);
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXGridControl::addGridControlListener( const Reference< XGridControlListener >& _listener ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ m_aGridControlListeners.addInterface( _listener );
+ if ( getPeer().is() && 1 == m_aGridControlListeners.getLength() )
+ {
+ Reference< XGridControl > xPeerGrid( getPeer(), UNO_QUERY );
+ if ( xPeerGrid.is() )
+ xPeerGrid->addGridControlListener( &m_aGridControlListeners );
+ }
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXGridControl::removeGridControlListener( const Reference< XGridControlListener >& _listener ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ if( getPeer().is() && 1 == m_aGridControlListeners.getLength() )
+ {
+ Reference< XGridControl > xPeerGrid( getPeer(), UNO_QUERY );
+ if ( xPeerGrid.is() )
+ xPeerGrid->removeGridControlListener( &m_aGridControlListeners );
+ }
+
+ m_aGridControlListeners.removeInterface( _listener );
+}
+
+//------------------------------------------------------------------------------
+sal_Int16 SAL_CALL FmXGridControl::getCurrentColumnPosition() throw( RuntimeException )
+{
+ Reference< XGridControl > xGrid( getPeer(), UNO_QUERY );
+ return xGrid.is() ? xGrid->getCurrentColumnPosition() : -1;
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXGridControl::setCurrentColumnPosition(sal_Int16 nPos) throw( RuntimeException )
+{
+ Reference< XGridControl > xGrid( getPeer(), UNO_QUERY );
+ if ( xGrid.is() )
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ xGrid->setCurrentColumnPosition( nPos );
+ }
+}
+
+// XElementAccess
+//------------------------------------------------------------------------------
+sal_Bool SAL_CALL FmXGridControl::hasElements() throw( RuntimeException )
+{
+ Reference< XElementAccess > xPeer(getPeer(), UNO_QUERY);
+ return xPeer.is() ? xPeer->hasElements() : 0;
+}
+
+//------------------------------------------------------------------------------
+Type SAL_CALL FmXGridControl::getElementType( ) throw(RuntimeException)
+{
+ return ::getCppuType((const Reference< ::com::sun::star::awt::XTextComponent >*)NULL);
+}
+
+// XEnumerationAccess
+//------------------------------------------------------------------------------
+Reference< XEnumeration > SAL_CALL FmXGridControl::createEnumeration() throw( RuntimeException )
+{
+ Reference< XEnumerationAccess > xPeer(getPeer(), UNO_QUERY);
+ if (xPeer.is())
+ return xPeer->createEnumeration();
+ else
+ return new ::comphelper::OEnumerationByIndex(this);
+}
+
+// XIndexAccess
+//------------------------------------------------------------------------------
+sal_Int32 SAL_CALL FmXGridControl::getCount() throw( RuntimeException )
+{
+ Reference< XIndexAccess > xPeer(getPeer(), UNO_QUERY);
+ return xPeer.is() ? xPeer->getCount() : 0;
+}
+
+//------------------------------------------------------------------------------
+Any SAL_CALL FmXGridControl::getByIndex(sal_Int32 _nIndex) throw( IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
+{
+ Reference< XIndexAccess > xPeer(getPeer(), UNO_QUERY);
+ if (!xPeer.is())
+ throw IndexOutOfBoundsException();
+
+ return xPeer->getByIndex(_nIndex);
+}
+
+// ::com::sun::star::util::XModeSelector
+//------------------------------------------------------------------------------
+void SAL_CALL FmXGridControl::setMode(const ::rtl::OUString& Mode) throw( NoSupportException, RuntimeException )
+{
+ Reference< ::com::sun::star::util::XModeSelector > xPeer(getPeer(), UNO_QUERY);
+ if (!xPeer.is())
+ throw NoSupportException();
+
+ xPeer->setMode(Mode);
+}
+
+//------------------------------------------------------------------------------
+::rtl::OUString SAL_CALL FmXGridControl::getMode() throw( RuntimeException )
+{
+ Reference< ::com::sun::star::util::XModeSelector > xPeer(getPeer(), UNO_QUERY);
+ return xPeer.is() ? xPeer->getMode() : ::rtl::OUString();
+}
+
+//------------------------------------------------------------------------------
+::comphelper::StringSequence SAL_CALL FmXGridControl::getSupportedModes() throw( RuntimeException )
+{
+ Reference< ::com::sun::star::util::XModeSelector > xPeer(getPeer(), UNO_QUERY);
+ return xPeer.is() ? xPeer->getSupportedModes() : ::comphelper::StringSequence();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool SAL_CALL FmXGridControl::supportsMode(const ::rtl::OUString& Mode) throw( RuntimeException )
+{
+ Reference< ::com::sun::star::util::XModeSelector > xPeer(getPeer(), UNO_QUERY);
+ return xPeer.is() ? xPeer->supportsMode(Mode) : sal_False;
+}
+
+//==============================================================================
+//= FmXGridPeer
+//==============================================================================
+// helper class which prevents that in the peer's header the FmGridListener must be known
+class FmXGridPeer::GridListenerDelegator : public FmGridListener
+{
+protected:
+ FmXGridPeer* m_pPeer;
+
+public:
+ GridListenerDelegator( FmXGridPeer* _pPeer );
+
+protected:
+ virtual void selectionChanged();
+ virtual void columnChanged();
+};
+
+//------------------------------------------------------------------
+FmXGridPeer::GridListenerDelegator::GridListenerDelegator(FmXGridPeer* _pPeer)
+ :m_pPeer(_pPeer)
+{
+ DBG_ASSERT(m_pPeer, "GridListenerDelegator::GridListenerDelegator");
+}
+
+//------------------------------------------------------------------
+void FmXGridPeer::GridListenerDelegator::selectionChanged()
+{
+ m_pPeer->selectionChanged();
+}
+
+//------------------------------------------------------------------
+void FmXGridPeer::GridListenerDelegator::columnChanged()
+{
+ m_pPeer->columnChanged();
+}
+
+//==============================================================================
+//------------------------------------------------------------------
+Reference< XInterface > FmXGridPeer_CreateInstance(const Reference< XMultiServiceFactory>& _rxFactory)
+{
+ FmXGridPeer* pNewObject = new FmXGridPeer(_rxFactory);
+ pNewObject->Create(NULL, WB_TABSTOP);
+ return *pNewObject;
+}
+
+//------------------------------------------------------------------
+Sequence< Type> SAL_CALL FmXGridPeer::getTypes( ) throw(RuntimeException)
+{
+ return comphelper::concatSequences( VCLXWindow::getTypes(), FmXGridPeer_BASE::getTypes() );
+}
+
+//------------------------------------------------------------------
+Sequence<sal_Int8> SAL_CALL FmXGridPeer::getImplementationId( ) throw(RuntimeException)
+{
+ static ::cppu::OImplementationId* pId = 0;
+ if (! pId)
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if (! pId)
+ {
+ static ::cppu::OImplementationId aId;
+ pId = &aId;
+ }
+ }
+ return pId->getImplementationId();
+}
+
+//------------------------------------------------------------------
+Any SAL_CALL FmXGridPeer::queryInterface(const Type& _rType) throw (RuntimeException)
+{
+ Any aReturn = FmXGridPeer_BASE::queryInterface(_rType);
+
+ if (!aReturn.hasValue())
+ aReturn = VCLXWindow::queryInterface( _rType );
+
+ return aReturn;
+}
+
+//------------------------------------------------------------------
+void FmXGridPeer::selectionChanged()
+{
+ EventObject aSource;
+ aSource.Source = static_cast< ::cppu::OWeakObject* >(this);
+ m_aSelectionListeners.notifyEach( &XSelectionChangeListener::selectionChanged, aSource);
+}
+
+//------------------------------------------------------------------
+void FmXGridPeer::columnChanged()
+{
+ EventObject aEvent( *this );
+ m_aGridControlListeners.notifyEach( &XGridControlListener::columnChanged, aEvent );
+}
+
+//------------------------------------------------------------------
+namespace fmgridif
+{
+ const ::rtl::OUString getDataModeIdentifier()
+ {
+ static ::rtl::OUString s_sDataModeIdentifier = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DataMode" ) );
+ return s_sDataModeIdentifier;
+ }
+}
+using namespace fmgridif;
+
+//------------------------------------------------------------------
+FmXGridPeer::FmXGridPeer(const Reference< XMultiServiceFactory >& _rxFactory)
+ :m_aModifyListeners(m_aMutex)
+ ,m_aUpdateListeners(m_aMutex)
+ ,m_aContainerListeners(m_aMutex)
+ ,m_aSelectionListeners(m_aMutex)
+ ,m_aGridControlListeners(m_aMutex)
+ ,m_aMode( getDataModeIdentifier() )
+ ,m_nCursorListening(0)
+ ,m_bInterceptingDispatch(sal_False)
+ ,m_pStateCache(NULL)
+ ,m_pDispatchers(NULL)
+ ,m_pGridListener(NULL)
+ ,m_xServiceFactory(_rxFactory)
+{
+ // nach diesem Constructor muss Create gerufen werden !
+ m_pGridListener = new GridListenerDelegator( this );
+}
+
+//------------------------------------------------------------------------------
+FmGridControl* FmXGridPeer::imp_CreateControl(Window* pParent, WinBits nStyle)
+{
+ return new FmGridControl(m_xServiceFactory, pParent, this, nStyle);
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::Create(Window* pParent, WinBits nStyle)
+{
+ FmGridControl* pWin = imp_CreateControl(pParent, nStyle);
+ DBG_ASSERT(pWin != NULL, "FmXGridPeer::Create : imp_CreateControl didn't return a control !");
+
+ pWin->SetStateProvider(LINK(this, FmXGridPeer, OnQueryGridSlotState));
+ pWin->SetSlotExecutor(LINK(this, FmXGridPeer, OnExecuteGridSlot));
+
+ // want to hear about row selections
+ pWin->setGridListener( m_pGridListener );
+
+ // Init muß immer aufgerufen werden
+ pWin->Init();
+ pWin->SetComponentInterface(this);
+
+ getSupportedURLs();
+}
+
+//------------------------------------------------------------------------------
+FmXGridPeer::~FmXGridPeer()
+{
+ setRowSet(Reference< XRowSet > ());
+ setColumns(Reference< XIndexContainer > ());
+
+ delete m_pGridListener;
+}
+
+//------------------------------------------------------------------------------
+const Sequence< sal_Int8 >& FmXGridPeer::getUnoTunnelImplementationId() throw()
+{
+ static Sequence< sal_Int8 > * pSeq = 0;
+ if( !pSeq )
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !pSeq )
+ {
+ static Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+ return *pSeq;
+}
+
+//------------------------------------------------------------------------------
+FmXGridPeer* FmXGridPeer::getImplementation( const Reference< XInterface >& _rxIFace ) throw()
+{
+ FmXGridPeer* pReturn = NULL;
+ Reference< XUnoTunnel > xTunnel(_rxIFace, UNO_QUERY);
+ if (xTunnel.is())
+ pReturn = reinterpret_cast<FmXGridPeer*>(xTunnel->getSomething(getUnoTunnelImplementationId()));
+
+ return pReturn;
+}
+
+//------------------------------------------------------------------------------
+sal_Int64 SAL_CALL FmXGridPeer::getSomething( const Sequence< sal_Int8 >& _rIdentifier ) throw(RuntimeException)
+{
+ sal_Int64 nReturn(0);
+
+ if ( (_rIdentifier.getLength() == 16)
+ && (0 == rtl_compareMemory( getUnoTunnelImplementationId().getConstArray(), _rIdentifier.getConstArray(), 16 ))
+ )
+ {
+ nReturn = reinterpret_cast<sal_Int64>(this);
+ }
+ else
+ nReturn = VCLXWindow::getSomething(_rIdentifier);
+
+ return nReturn;
+}
+
+// XEventListener
+//------------------------------------------------------------------------------
+void FmXGridPeer::disposing(const EventObject& e) throw( RuntimeException )
+{
+using namespace ::com::sun::star::util;
+ bool bKnownSender = false;
+
+ Reference< XIndexContainer > xCols( e.Source, UNO_QUERY );
+ if ( xCols.is() )
+ {
+ setColumns(Reference< XIndexContainer > ());
+ bKnownSender = true;
+ }
+
+ Reference< XRowSet > xCursor(e.Source, UNO_QUERY);
+ if (xCursor.is())
+ {
+ setRowSet( m_xCursor );
+ m_xCursor = NULL;
+ bKnownSender = true;
+ }
+
+
+ if ( !bKnownSender && m_pDispatchers )
+ {
+ const Sequence< URL>& aSupportedURLs = getSupportedURLs();
+ const URL* pSupportedURLs = aSupportedURLs.getConstArray();
+ for ( sal_uInt16 i=0; i < ( aSupportedURLs.getLength() ) && !bKnownSender; ++i, ++pSupportedURLs )
+ {
+ if ( m_pDispatchers[i] == e.Source )
+ {
+ m_pDispatchers[i]->removeStatusListener( static_cast< ::com::sun::star::frame::XStatusListener* >( this ), *pSupportedURLs );
+ m_pDispatchers[i] = NULL;
+ m_pStateCache[i] = 0;
+ bKnownSender = true;
+ }
+ }
+ }
+
+ if ( !bKnownSender )
+ VCLXWindow::disposing(e);
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::addModifyListener(const Reference< ::com::sun::star::util::XModifyListener >& l) throw( RuntimeException )
+{
+ m_aModifyListeners.addInterface( l );
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::removeModifyListener(const Reference< ::com::sun::star::util::XModifyListener >& l) throw( RuntimeException )
+{
+ m_aModifyListeners.removeInterface( l );
+}
+
+//------------------------------------------------------------------------------
+#define LAST_KNOWN_TYPE FormComponentType::PATTERNFIELD
+Sequence< sal_Bool > SAL_CALL FmXGridPeer::queryFieldDataType( const Type& xType ) throw(RuntimeException)
+{
+ // eine 'Konvertierungstabelle'
+ static sal_Bool bCanConvert[LAST_KNOWN_TYPE][4] =
+ {
+ { sal_False, sal_False, sal_False, sal_False }, // FormComponentType::CONTROL
+ { sal_False, sal_False, sal_False, sal_False }, // FormComponentType::COMMANDBUTTON
+ { sal_False, sal_False, sal_False, sal_False }, // FormComponentType::RADIOBUTTON
+ { sal_False, sal_False, sal_False, sal_False }, // FormComponentType::IMAGEBUTTON
+ { sal_False, sal_False, sal_False, sal_True }, // FormComponentType::CHECKBOX
+ { sal_False, sal_False, sal_False, sal_False }, // FormComponentType::LISTBOX
+ { sal_False, sal_False, sal_False, sal_False }, // FormComponentType::COMBOBOX
+ { sal_False, sal_False, sal_False, sal_False }, // FormComponentType::GROUPBOX
+ { sal_True , sal_False, sal_False, sal_False }, // FormComponentType::TEXTFIELD
+ { sal_False, sal_False, sal_False, sal_False }, // FormComponentType::FIXEDTEXT
+ { sal_False, sal_False, sal_False, sal_False }, // FormComponentType::GRIDCONTROL
+ { sal_False, sal_False, sal_False, sal_False }, // FormComponentType::FILECONTROL
+ { sal_False, sal_False, sal_False, sal_False }, // FormComponentType::HIDDENCONTROL
+ { sal_False, sal_False, sal_False, sal_False }, // FormComponentType::IMAGECONTROL
+ { sal_True , sal_True , sal_True , sal_False }, // FormComponentType::DATEFIELD
+ { sal_True , sal_True , sal_False, sal_False }, // FormComponentType::TIMEFIELD
+ { sal_True , sal_True , sal_False, sal_False }, // FormComponentType::NUMERICFIELD
+ { sal_True , sal_True , sal_False, sal_False }, // FormComponentType::CURRENCYFIELD
+ { sal_True , sal_False, sal_False, sal_False } // FormComponentType::PATTERNFIELD
+ };
+
+
+ sal_Int16 nMapColumn = -1;
+ switch (xType.getTypeClass())
+ {
+ case TypeClass_STRING : nMapColumn = 0; break;
+ case TypeClass_FLOAT:
+ case TypeClass_DOUBLE : nMapColumn = 1; break;
+ case TypeClass_SHORT:
+ case TypeClass_LONG:
+ case TypeClass_UNSIGNED_LONG:
+ case TypeClass_UNSIGNED_SHORT : nMapColumn = 2; break;
+ case TypeClass_BOOLEAN : nMapColumn = 3; break;
+ default:
+ break;
+ }
+
+ Reference< XIndexContainer > xColumns = getColumns();
+
+ FmGridControl* pGrid = (FmGridControl*) GetWindow();
+ sal_Int32 nColumns = pGrid->GetViewColCount();
+
+ DbGridColumns aColumns = pGrid->GetColumns();
+
+ Sequence<sal_Bool> aReturnSequence(nColumns);
+ sal_Bool* pReturnArray = aReturnSequence.getArray();
+
+ sal_Bool bRequestedAsAny = (xType.getTypeClass() == TypeClass_ANY);
+
+ DbGridColumn* pCol;
+ Reference< ::com::sun::star::sdb::XColumn > xFieldContent;
+ Reference< XPropertySet > xCurrentColumn;
+ for (sal_Int32 i=0; i<nColumns; ++i)
+ {
+ if (bRequestedAsAny)
+ {
+ pReturnArray[i] = sal_True;
+ continue;
+ }
+
+ pReturnArray[i] = sal_False;
+
+ sal_uInt16 nModelPos = pGrid->GetModelColumnPos(pGrid->GetColumnIdFromViewPos((sal_uInt16)i));
+ DBG_ASSERT(nModelPos != (sal_uInt16)-1, "FmXGridPeer::queryFieldDataType : no model pos !");
+
+ pCol = aColumns.GetObject(nModelPos);
+ const DbGridRowRef xRow = pGrid->GetSeekRow();
+ xFieldContent = (xRow.Is() && xRow->HasField(pCol->GetFieldPos())) ? xRow->GetField(pCol->GetFieldPos()).getColumn() : Reference< ::com::sun::star::sdb::XColumn > ();
+ if (!xFieldContent.is())
+ // can't supply anything without a field content
+ // FS - 07.12.99 - 54391
+ continue;
+
+ xColumns->getByIndex(nModelPos) >>= xCurrentColumn;
+ if (!::comphelper::hasProperty(FM_PROP_CLASSID, xCurrentColumn))
+ continue;
+
+ sal_Int16 nClassId = sal_Int16();
+ xCurrentColumn->getPropertyValue(FM_PROP_CLASSID) >>= nClassId;
+ if (nClassId>LAST_KNOWN_TYPE)
+ continue;
+ DBG_ASSERT(nClassId>0, "FmXGridPeer::queryFieldDataType : somebody changed the definition of the FormComponentType enum !");
+
+ if (nMapColumn != -1)
+ pReturnArray[i] = bCanConvert[nClassId-1][nMapColumn];
+ }
+
+ return aReturnSequence;
+}
+
+//------------------------------------------------------------------------------
+Sequence< Any > SAL_CALL FmXGridPeer::queryFieldData( sal_Int32 nRow, const Type& xType ) throw(RuntimeException)
+{
+ FmGridControl* pGrid = (FmGridControl*) GetWindow();
+ DBG_ASSERT(pGrid && pGrid->IsOpen(), "FmXGridPeer::queryFieldData : have no valid grid window !");
+ if (!pGrid || !pGrid->IsOpen())
+ return Sequence< Any>();
+
+ // das Control zur angegebenen Row fahren
+ if (!pGrid->SeekRow(nRow))
+ {
+ throw IllegalArgumentException();
+ }
+
+ // don't use GetCurrentRow as this isn't affected by the above SeekRow
+ // FS - 30.09.99 - 68644
+ DbGridRowRef xPaintRow = pGrid->GetPaintRow();
+ ENSURE_OR_THROW( xPaintRow.Is(), "invalid paint row" );
+
+ // die Columns des Controls brauche ich fuer GetFieldText
+ DbGridColumns aColumns = pGrid->GetColumns();
+
+ // und durch alle Spalten durch
+ sal_Int32 nColumnCount = pGrid->GetViewColCount();
+
+ Sequence< Any> aReturnSequence(nColumnCount);
+ Any* pReturnArray = aReturnSequence.getArray();
+
+ sal_Bool bRequestedAsAny = (xType.getTypeClass() == TypeClass_ANY);
+ Reference< ::com::sun::star::sdb::XColumn > xFieldContent;
+ DbGridColumn* pCol;
+ for (sal_Int32 i=0; i < nColumnCount; ++i)
+ {
+ sal_uInt16 nModelPos = pGrid->GetModelColumnPos(pGrid->GetColumnIdFromViewPos((sal_uInt16)i));
+ DBG_ASSERT(nModelPos != (sal_uInt16)-1, "FmXGridPeer::queryFieldData : invalid model pos !");
+
+ // don't use GetCurrentFieldValue to determine the field content as this isn't affected by the above SeekRow
+ // FS - 30.09.99 - 68644
+ pCol = aColumns.GetObject(nModelPos);
+ xFieldContent = xPaintRow->HasField( pCol->GetFieldPos() )
+ ? xPaintRow->GetField( pCol->GetFieldPos() ).getColumn()
+ : Reference< XColumn > ();
+
+ if ( !xFieldContent.is() )
+ continue;
+
+ if (bRequestedAsAny)
+ {
+ Reference< XPropertySet > xFieldSet(xFieldContent, UNO_QUERY);
+ pReturnArray[i] = xFieldSet->getPropertyValue(FM_PROP_VALUE);
+ }
+ else
+ {
+ switch (xType.getTypeClass())
+ {
+ // Strings werden direkt ueber das GetFieldText abgehandelt
+ case TypeClass_STRING :
+ {
+ String sText = aColumns.GetObject(nModelPos)->GetCellText( xPaintRow, pGrid->getNumberFormatter() );
+ pReturnArray[i] <<= ::rtl::OUString(sText);
+ }
+ break;
+ // alles andere wird an der DatabaseVariant erfragt
+ case TypeClass_FLOAT : pReturnArray[i] <<= xFieldContent->getFloat(); break;
+ case TypeClass_DOUBLE : pReturnArray[i] <<= xFieldContent->getDouble(); break;
+ case TypeClass_SHORT : pReturnArray[i] <<= (sal_Int16)xFieldContent->getShort(); break;
+ case TypeClass_LONG : pReturnArray[i] <<= (sal_Int32)xFieldContent->getLong(); break;
+ case TypeClass_UNSIGNED_SHORT : pReturnArray[i] <<= (sal_uInt16)xFieldContent->getShort(); break;
+ case TypeClass_UNSIGNED_LONG : pReturnArray[i] <<= (sal_uInt32)xFieldContent->getLong(); break;
+ case TypeClass_BOOLEAN : ::comphelper::setBOOL(pReturnArray[i],xFieldContent->getBoolean()); break;
+ default:
+ {
+ throw IllegalArgumentException();
+ }
+ }
+ }
+ }
+ return aReturnSequence;
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::CellModified()
+{
+ EventObject aEvt;
+ aEvt.Source = static_cast< ::cppu::OWeakObject* >(this);
+ m_aModifyListeners.notifyEach( &XModifyListener::modified, aEvt );
+}
+
+// XPropertyChangeListener
+//------------------------------------------------------------------------------
+void FmXGridPeer::propertyChange(const PropertyChangeEvent& evt) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ // want to do a lot of VCL stuff here ...
+ // this should not be (deadlock) critical, as by definition, every component should release
+ // any own mutexes before notifying
+
+ FmGridControl* pGrid = (FmGridControl*) GetWindow();
+ if (!pGrid)
+ return;
+
+ // DatenbankEvent
+ Reference< XRowSet > xCursor(evt.Source, UNO_QUERY);
+ if (evt.PropertyName == FM_PROP_VALUE || m_xCursor == evt.Source)
+ pGrid->propertyChange(evt);
+ else if (pGrid && m_xColumns.is() && m_xColumns->hasElements())
+ {
+ // zunaechst raussuchen welche Column sich geaendert hat
+ ::comphelper::InterfaceRef xCurrent;
+ sal_Int32 i;
+
+ for ( i = 0; i < m_xColumns->getCount(); i++)
+ {
+ ::cppu::extractInterface(xCurrent, m_xColumns->getByIndex(i));
+ if (evt.Source == xCurrent)
+ break;
+ }
+
+ if (i >= m_xColumns->getCount())
+ // this is valid because we are listening at the cursor, too (RecordCount, -status, edit mode)
+ return;
+
+ sal_uInt16 nId = pGrid->GetColumnIdFromModelPos((sal_uInt16)i);
+ sal_Bool bInvalidateColumn = sal_False;
+
+ if (evt.PropertyName == FM_PROP_LABEL)
+ {
+ String aName = ::comphelper::getString(evt.NewValue);
+ if (aName != pGrid->GetColumnTitle(nId))
+ pGrid->SetColumnTitle(nId, aName);
+ }
+ else if (evt.PropertyName == FM_PROP_WIDTH)
+ {
+ sal_Int32 nWidth = 0;
+ if (evt.NewValue.getValueType().getTypeClass() == TypeClass_VOID)
+ nWidth = pGrid->GetDefaultColumnWidth(pGrid->GetColumnTitle(nId));
+ // GetDefaultColumnWidth already considerd the zoom factor
+ else
+ {
+ sal_Int32 nTest = 0;
+ if (evt.NewValue >>= nTest)
+ {
+ nWidth = pGrid->LogicToPixel(Point(nTest,0),MAP_10TH_MM).X();
+ // take the zoom factor into account
+ nWidth = pGrid->CalcZoom(nWidth);
+ }
+ }
+ if (nWidth != (sal_Int32(pGrid->GetColumnWidth(nId))))
+ {
+ if (pGrid->IsEditing())
+ {
+ pGrid->DeactivateCell();
+ pGrid->ActivateCell();
+ }
+ pGrid->SetColumnWidth(nId, nWidth);
+ }
+ }
+ else if (evt.PropertyName == FM_PROP_HIDDEN)
+ {
+ DBG_ASSERT(evt.NewValue.getValueType().getTypeClass() == TypeClass_BOOLEAN,
+ "FmXGridPeer::propertyChange : the property 'hidden' should be of type boolean !");
+ if (::comphelper::getBOOL(evt.NewValue))
+ pGrid->HideColumn(nId);
+ else
+ pGrid->ShowColumn(nId);
+ }
+ else if (evt.PropertyName == FM_PROP_ALIGN)
+ {
+ // it design mode it doesn't matter
+ if (!isDesignMode())
+ {
+ DbGridColumn* pCol = pGrid->GetColumns().GetObject(i);
+
+ pCol->SetAlignmentFromModel(-1);
+ bInvalidateColumn = sal_True;
+ }
+ }
+ else if (evt.PropertyName == FM_PROP_FORMATKEY)
+ {
+ if (!isDesignMode())
+ bInvalidateColumn = sal_True;
+ }
+
+ // need to invalidate the affected column ?
+ if (bInvalidateColumn)
+ {
+ sal_Bool bWasEditing = pGrid->IsEditing();
+ if (bWasEditing)
+ pGrid->DeactivateCell();
+
+ ::Rectangle aColRect = pGrid->GetFieldRect(nId);
+ aColRect.Top() = 0;
+ aColRect.Bottom() = pGrid->GetSizePixel().Height();
+ pGrid->Invalidate(aColRect);
+
+ if (bWasEditing)
+ pGrid->ActivateCell();
+ }
+ }
+}
+
+// XBoundComponent
+//------------------------------------------------------------------------------
+void FmXGridPeer::addUpdateListener(const Reference< XUpdateListener >& l) throw( RuntimeException )
+{
+ m_aUpdateListeners.addInterface(l);
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::removeUpdateListener(const Reference< XUpdateListener >& l) throw( RuntimeException )
+{
+ m_aUpdateListeners.removeInterface(l);
+}
+
+//------------------------------------------------------------------------------
+sal_Bool FmXGridPeer::commit() throw( RuntimeException )
+{
+ FmGridControl* pGrid = (FmGridControl*) GetWindow();
+ if (!m_xCursor.is() || !pGrid)
+ return sal_True;
+
+ EventObject aEvt(static_cast< ::cppu::OWeakObject* >(this));
+ ::cppu::OInterfaceIteratorHelper aIter(m_aUpdateListeners);
+ sal_Bool bCancel = sal_False;
+ while (aIter.hasMoreElements() && !bCancel)
+ if ( !static_cast< XUpdateListener* >( aIter.next() )->approveUpdate( aEvt ) )
+ bCancel = sal_True;
+
+ if (!bCancel)
+ bCancel = !pGrid->commit();
+
+ if (!bCancel)
+ m_aUpdateListeners.notifyEach( &XUpdateListener::updated, aEvt );
+ return !bCancel;
+}
+
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::cursorMoved(const EventObject& _rEvent) throw( RuntimeException )
+{
+ FmGridControl* pGrid = (FmGridControl*) GetWindow();
+ // we are not interested in move to insert row only in the resetted event
+ // which is fired after positioning an the insert row
+ if (pGrid && pGrid->IsOpen() && !::comphelper::getBOOL(Reference< XPropertySet > (_rEvent.Source, UNO_QUERY)->getPropertyValue(FM_PROP_ISNEW)))
+ pGrid->positioned(_rEvent);
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::rowChanged(const EventObject& _rEvent) throw( RuntimeException )
+{
+ FmGridControl* pGrid = (FmGridControl*) GetWindow();
+ if (pGrid && pGrid->IsOpen())
+ {
+ if (m_xCursor->rowUpdated() && !pGrid->IsCurrentAppending())
+ pGrid->RowModified(pGrid->GetCurrentPos());
+ else if (m_xCursor->rowInserted())
+ pGrid->inserted(_rEvent);
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::rowSetChanged(const EventObject& /*event*/) throw( RuntimeException )
+{
+ // not interested in ...
+ // (our parent is a form which means we get a loaded or reloaded after this rowSetChanged)
+}
+
+// XLoadListener
+//------------------------------------------------------------------------------
+void FmXGridPeer::loaded(const EventObject& /*rEvent*/) throw( RuntimeException )
+{
+ updateGrid(m_xCursor);
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::unloaded(const EventObject& /*rEvent*/) throw( RuntimeException )
+{
+ updateGrid( Reference< XRowSet > (NULL) );
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::reloading(const EventObject& /*aEvent*/) throw( RuntimeException )
+{
+ // empty the grid
+ updateGrid( Reference< XRowSet > (NULL) );
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::unloading(const EventObject& /*aEvent*/) throw( RuntimeException )
+{
+ // empty the grid
+ updateGrid( Reference< XRowSet > (NULL) );
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::reloaded(const EventObject& /*aEvent*/) throw( RuntimeException )
+{
+ updateGrid(m_xCursor);
+}
+
+// XGridPeer
+//------------------------------------------------------------------------------
+Reference< XIndexContainer > FmXGridPeer::getColumns() throw( RuntimeException )
+{
+ return m_xColumns;
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::addColumnListeners(const Reference< XPropertySet >& xCol)
+{
+ static const ::rtl::OUString aPropsListenedTo[] =
+ {
+ FM_PROP_LABEL, FM_PROP_WIDTH, FM_PROP_HIDDEN, FM_PROP_ALIGN, FM_PROP_FORMATKEY
+ };
+
+ // as not all properties have to be supported by all columns we have to check this
+ // before adding a listener
+ Reference< XPropertySetInfo > xInfo = xCol->getPropertySetInfo();
+ Property aPropDesc;
+ const ::rtl::OUString* pProps = aPropsListenedTo;
+ const ::rtl::OUString* pPropsEnd = pProps + sizeof( aPropsListenedTo ) / sizeof( aPropsListenedTo[ 0 ] );
+ for (; pProps != pPropsEnd; ++pProps)
+ {
+ if ( xInfo->hasPropertyByName( *pProps ) )
+ {
+ aPropDesc = xInfo->getPropertyByName( *pProps );
+ if ( 0 != ( aPropDesc.Attributes & PropertyAttribute::BOUND ) )
+ xCol->addPropertyChangeListener( *pProps, this );
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::removeColumnListeners(const Reference< XPropertySet >& xCol)
+{
+ // the same props as in addColumnListeners ... linux has problems with global static UStrings, so
+ // we have to do it this way ....
+ static ::rtl::OUString aPropsListenedTo[] =
+ {
+ FM_PROP_LABEL, FM_PROP_WIDTH, FM_PROP_HIDDEN, FM_PROP_ALIGN, FM_PROP_FORMATKEY
+ };
+
+ Reference< XPropertySetInfo > xInfo = xCol->getPropertySetInfo();
+ for (sal_uInt16 i=0; i<sizeof(aPropsListenedTo)/sizeof(aPropsListenedTo[0]); ++i)
+ if (xInfo->hasPropertyByName(aPropsListenedTo[i]))
+ xCol->removePropertyChangeListener(aPropsListenedTo[i], this);
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::setColumns(const Reference< XIndexContainer >& Columns) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ FmGridControl* pGrid = static_cast< FmGridControl* >( GetWindow() );
+
+ if (m_xColumns.is())
+ {
+ Reference< XPropertySet > xCol;
+ for (sal_Int32 i = 0; i < m_xColumns->getCount(); i++)
+ {
+ ::cppu::extractInterface(xCol, m_xColumns->getByIndex(i));
+ removeColumnListeners(xCol);
+ }
+ Reference< XContainer > xContainer(m_xColumns, UNO_QUERY);
+ xContainer->removeContainerListener(this);
+
+ Reference< XSelectionSupplier > xSelSupplier(m_xColumns, UNO_QUERY);
+ xSelSupplier->removeSelectionChangeListener(this);
+
+ Reference< XReset > xColumnReset(m_xColumns, UNO_QUERY);
+ if (xColumnReset.is())
+ xColumnReset->removeResetListener((XResetListener*)this);
+ }
+ if (Columns.is())
+ {
+ Reference< XContainer > xContainer(Columns, UNO_QUERY);
+ xContainer->addContainerListener(this);
+
+ Reference< XSelectionSupplier > xSelSupplier(Columns, UNO_QUERY);
+ xSelSupplier->addSelectionChangeListener(this);
+
+ Reference< XPropertySet > xCol;
+ for (sal_Int32 i = 0; i < Columns->getCount(); i++)
+ {
+ ::cppu::extractInterface(xCol, Columns->getByIndex(i));
+ addColumnListeners(xCol);
+ }
+
+ Reference< XReset > xColumnReset(Columns, UNO_QUERY);
+ if (xColumnReset.is())
+ xColumnReset->addResetListener((XResetListener*)this);
+ }
+ m_xColumns = Columns;
+ if (pGrid)
+ {
+ pGrid->InitColumnsByModels(m_xColumns);
+
+ if (m_xColumns.is())
+ {
+ EventObject aEvt(m_xColumns);
+ selectionChanged(aEvt);
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::setDesignMode(sal_Bool bOn) throw( RuntimeException )
+{
+ if (bOn != isDesignMode())
+ {
+ Window* pWin = GetWindow();
+ if (pWin)
+ ((FmGridControl*) pWin)->SetDesignMode(bOn);
+ }
+
+ if (bOn)
+ DisConnectFromDispatcher();
+ else
+ UpdateDispatches(); // will connect if not already connected and just update else
+}
+
+//------------------------------------------------------------------------------
+sal_Bool FmXGridPeer::isDesignMode() throw( RuntimeException )
+{
+ Window* pWin = GetWindow();
+ if (pWin)
+ return ((FmGridControl*) pWin)->IsDesignMode();
+ else
+ return sal_False;
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::elementInserted(const ContainerEvent& evt) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ FmGridControl* pGrid = (FmGridControl*) GetWindow();
+ // Handle Column beruecksichtigen
+ if (!pGrid || !m_xColumns.is() || pGrid->IsInColumnMove() || m_xColumns->getCount() == ((sal_Int32)pGrid->GetModelColCount()))
+ return;
+
+ Reference< XPropertySet > xSet;
+ ::cppu::extractInterface(xSet, evt.Element);
+ addColumnListeners(xSet);
+
+ Reference< XPropertySet > xNewColumn(xSet);
+ String aName = ::comphelper::getString(xNewColumn->getPropertyValue(FM_PROP_LABEL));
+ Any aWidth = xNewColumn->getPropertyValue(FM_PROP_WIDTH);
+ sal_Int32 nWidth = 0;
+ if (aWidth >>= nWidth)
+ nWidth = pGrid->LogicToPixel(Point(nWidth,0),MAP_10TH_MM).X();
+
+ pGrid->AppendColumn(aName, (sal_uInt16)nWidth, (sal_Int16)::comphelper::getINT32(evt.Accessor));
+
+ // jetzt die Spalte setzen
+ DbGridColumn* pCol = pGrid->GetColumns().GetObject(::comphelper::getINT32(evt.Accessor));
+ pCol->setModel(xNewColumn);
+
+ Any aHidden = xNewColumn->getPropertyValue(FM_PROP_HIDDEN);
+ if (::comphelper::getBOOL(aHidden))
+ pGrid->HideColumn(pCol->GetId());
+
+ FormControlFactory( m_xServiceFactory ).initializeTextFieldLineEnds( xNewColumn );
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::elementReplaced(const ContainerEvent& evt) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ FmGridControl* pGrid = (FmGridControl*) GetWindow();
+
+ // Handle Column beruecksichtigen
+ if (!pGrid || !m_xColumns.is() || pGrid->IsInColumnMove())
+ return;
+
+ Reference< XPropertySet > xNewColumn;
+ Reference< XPropertySet > xOldColumn;
+ ::cppu::extractInterface(xNewColumn, evt.Element);
+ ::cppu::extractInterface(xOldColumn, evt.ReplacedElement);
+
+ sal_Bool bWasEditing = pGrid->IsEditing();
+ if (bWasEditing)
+ pGrid->DeactivateCell();
+
+ pGrid->RemoveColumn(pGrid->GetColumnIdFromModelPos((sal_uInt16)::comphelper::getINT32(evt.Accessor)));
+
+ removeColumnListeners(xOldColumn);
+ addColumnListeners(xNewColumn);
+
+ String aName = ::comphelper::getString(xNewColumn->getPropertyValue(FM_PROP_LABEL));
+ Any aWidth = xNewColumn->getPropertyValue(FM_PROP_WIDTH);
+ sal_Int32 nWidth = 0;
+ if (aWidth >>= nWidth)
+ nWidth = pGrid->LogicToPixel(Point(nWidth,0),MAP_10TH_MM).X();
+ sal_uInt16 nNewId = pGrid->AppendColumn(aName, (sal_uInt16)nWidth, (sal_Int16)::comphelper::getINT32(evt.Accessor));
+ sal_uInt16 nNewPos = pGrid->GetModelColumnPos(nNewId);
+
+ // set the model of the new column
+ DbGridColumn* pCol = pGrid->GetColumns().GetObject(nNewPos);
+
+ // for initializong this grid column, we need the fields of the grid's data source
+ Reference< XColumnsSupplier > xSuppColumns;
+ CursorWrapper* pGridDataSource = pGrid->getDataSource();
+ if ( pGridDataSource )
+ xSuppColumns = xSuppColumns.query( (Reference< XInterface >)( *pGridDataSource ) );
+ Reference< XNameAccess > xColumnsByName;
+ if ( xSuppColumns.is() )
+ xColumnsByName = xSuppColumns->getColumns();
+ Reference< XIndexAccess > xColumnsByIndex( xColumnsByName, UNO_QUERY );
+
+ if ( xColumnsByIndex.is() )
+ pGrid->InitColumnByField( pCol, xNewColumn, xColumnsByName, xColumnsByIndex );
+ else
+ // the simple version, applies when the grid is not yet connected to a data source
+ pCol->setModel(xNewColumn);
+
+ if (bWasEditing)
+ pGrid->ActivateCell();
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::elementRemoved(const ContainerEvent& evt) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ FmGridControl* pGrid = (FmGridControl*) GetWindow();
+
+ // Handle Column beruecksichtigen
+ if (!pGrid || !m_xColumns.is() || pGrid->IsInColumnMove() || m_xColumns->getCount() == ((sal_Int32)pGrid->GetModelColCount()))
+ return;
+
+ pGrid->RemoveColumn(pGrid->GetColumnIdFromModelPos((sal_uInt16)::comphelper::getINT32(evt.Accessor)));
+
+ Reference< XPropertySet > xOldColumn;
+ ::cppu::extractInterface(xOldColumn, evt.Element);
+ removeColumnListeners(xOldColumn);
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::setProperty( const ::rtl::OUString& PropertyName, const Any& Value) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ FmGridControl* pGrid = (FmGridControl*) GetWindow();
+
+ sal_Bool bVoid = !Value.hasValue();
+
+ if ( 0 == PropertyName.compareTo( FM_PROP_TEXTLINECOLOR ) )
+ {
+ ::Color aTextLineColor( bVoid ? COL_TRANSPARENT : ::comphelper::getINT32( Value ) );
+ if (bVoid)
+ {
+ pGrid->SetTextLineColor();
+ pGrid->GetDataWindow().SetTextLineColor();
+ }
+ else
+ {
+ pGrid->SetTextLineColor(aTextLineColor);
+ pGrid->GetDataWindow().SetTextLineColor(aTextLineColor);
+ }
+
+ // need to forward this to the columns
+ DbGridColumns& rColumns = const_cast<DbGridColumns&>(pGrid->GetColumns());
+ DbGridColumn* pLoop = rColumns.First();
+ while (pLoop)
+ {
+ FmXGridCell* pXCell = pLoop->GetCell();
+ if (pXCell)
+ {
+ if (bVoid)
+ pXCell->SetTextLineColor();
+ else
+ pXCell->SetTextLineColor(aTextLineColor);
+ }
+
+ pLoop = rColumns.Next();
+ }
+
+ if (isDesignMode())
+ pGrid->Invalidate();
+ }
+ else if ( 0 == PropertyName.compareTo( FM_PROP_FONTEMPHASISMARK ) )
+ {
+ Font aGridFont = pGrid->GetControlFont();
+ sal_Int16 nValue = ::comphelper::getINT16(Value);
+ aGridFont.SetEmphasisMark( nValue );
+ pGrid->SetControlFont( aGridFont );
+ }
+ else if ( 0 == PropertyName.compareTo( FM_PROP_FONTRELIEF ) )
+ {
+ Font aGridFont = pGrid->GetControlFont();
+ sal_Int16 nValue = ::comphelper::getINT16(Value);
+ aGridFont.SetRelief( (FontRelief)nValue );
+ pGrid->SetControlFont( aGridFont );
+ }
+ else if ( 0 == PropertyName.compareTo( FM_PROP_HELPURL ) )
+ {
+ ::rtl::OUString sHelpURL;
+ OSL_VERIFY( Value >>= sHelpURL );
+ INetURLObject aHID( sHelpURL );
+ if ( aHID.GetProtocol() == INET_PROT_HID )
+ sHelpURL = aHID.GetURLPath();
+ pGrid->SetHelpId( rtl::OUStringToOString( sHelpURL, RTL_TEXTENCODING_UTF8 ) );
+ }
+ else if ( 0 == PropertyName.compareTo( FM_PROP_DISPLAYSYNCHRON ) )
+ {
+ pGrid->setDisplaySynchron(::comphelper::getBOOL(Value));
+ }
+ else if ( 0 == PropertyName.compareTo( FM_PROP_CURSORCOLOR ) )
+ {
+ if (bVoid)
+ pGrid->SetCursorColor(COL_TRANSPARENT);
+ else
+ pGrid->SetCursorColor( ::Color(::comphelper::getINT32(Value)));
+ if (isDesignMode())
+ pGrid->Invalidate();
+ }
+ else if ( 0 == PropertyName.compareTo( FM_PROP_ALWAYSSHOWCURSOR ) )
+ {
+ pGrid->EnablePermanentCursor(::comphelper::getBOOL(Value));
+ if (isDesignMode())
+ pGrid->Invalidate();
+ }
+ else if ( 0 == PropertyName.compareTo( FM_PROP_FONT ) )
+ {
+ if ( bVoid )
+ pGrid->SetControlFont( Font() );
+ else
+ {
+ ::com::sun::star::awt::FontDescriptor aFont;
+ if (Value >>= aFont)
+ {
+ Font aNewVclFont;
+ if (::comphelper::operator!=(aFont, ::comphelper::getDefaultFont())) // ist das der Default
+ aNewVclFont = ImplCreateFont( aFont );
+
+ // need to add relief and emphasis (they're stored in a VCL-Font, but not in a FontDescriptor
+ Font aOldVclFont = pGrid->GetControlFont();
+ aNewVclFont.SetRelief( aOldVclFont.GetRelief() );
+ aNewVclFont.SetEmphasisMark( aOldVclFont.GetEmphasisMark() );
+
+ // now set it ...
+ pGrid->SetControlFont( aNewVclFont );
+
+ // if our row-height property is void (which means "calculate it font-dependent") we have
+ // to adjust the control's row height
+ Reference< XPropertySet > xModelSet(getColumns(), UNO_QUERY);
+ if (xModelSet.is() && ::comphelper::hasProperty(FM_PROP_ROWHEIGHT, xModelSet))
+ {
+ Any aHeight = xModelSet->getPropertyValue(FM_PROP_ROWHEIGHT);
+ if (!aHeight.hasValue())
+ pGrid->SetDataRowHeight(0);
+ }
+
+ }
+ }
+ }
+ else if ( 0 == PropertyName.compareTo( FM_PROP_BACKGROUNDCOLOR ) )
+ {
+ if ( bVoid )
+ {
+ pGrid->SetControlBackground();
+ }
+ else
+ {
+ ::Color aColor( ::comphelper::getINT32(Value) );
+ pGrid->SetBackground( aColor );
+ pGrid->SetControlBackground( aColor );
+ }
+ }
+ else if ( 0 == PropertyName.compareTo( FM_PROP_TEXTCOLOR ) )
+ {
+ if ( bVoid )
+ {
+ pGrid->SetControlForeground();
+ }
+ else
+ {
+ ::Color aColor( ::comphelper::getINT32(Value) );
+ pGrid->SetTextColor( aColor );
+ pGrid->SetControlForeground( aColor );
+ }
+ }
+ else if ( 0 == PropertyName.compareTo( FM_PROP_ROWHEIGHT ) )
+ {
+ sal_Int32 nLogHeight(0);
+ if (Value >>= nLogHeight)
+ {
+ sal_Int32 nHeight = pGrid->LogicToPixel(Point(0,nLogHeight),MAP_10TH_MM).Y();
+ // take the zoom factor into account
+ nHeight = pGrid->CalcZoom(nHeight);
+ pGrid->SetDataRowHeight(nHeight);
+ }
+ else if (bVoid)
+ pGrid->SetDataRowHeight(0);
+ }
+ else if ( 0 == PropertyName.compareTo( FM_PROP_HASNAVIGATION ) )
+ {
+ sal_Bool bValue( sal_True );
+ OSL_VERIFY( Value >>= bValue );
+ pGrid->EnableNavigationBar( bValue );
+ }
+ else if ( 0 == PropertyName.compareTo( FM_PROP_RECORDMARKER ) )
+ {
+ sal_Bool bValue( sal_True );
+ OSL_VERIFY( Value >>= bValue );
+ pGrid->EnableHandle( bValue );
+ }
+ else if ( 0 == PropertyName.compareTo( FM_PROP_ENABLED ) )
+ {
+ sal_Bool bValue( sal_True );
+ OSL_VERIFY( Value >>= bValue );
+ pGrid->EnableHandle( bValue );
+
+ // Im DesignModus nur das Datenfenster disablen
+ // Sonst kann das Control nicht mehr konfiguriert werden
+ if (isDesignMode())
+ pGrid->GetDataWindow().Enable( bValue );
+ else
+ pGrid->Enable( bValue );
+ }
+ else
+ VCLXWindow::setProperty( PropertyName, Value );
+}
+
+//------------------------------------------------------------------------------
+Reference< XAccessibleContext > FmXGridPeer::CreateAccessibleContext()
+{
+ Reference< XAccessibleContext > xContext;
+
+ // use the AccessibleContext provided by the VCL window
+ Window* pGrid = GetWindow();
+ if ( pGrid )
+ {
+ Reference< XAccessible > xAcc( pGrid->GetAccessible( sal_True ) );
+ if ( xAcc.is() )
+ xContext = xAcc->getAccessibleContext();
+ // TODO: this has a slight conceptual problem:
+ //
+ // We know that the XAccessible and XAccessibleContext implementation of the browse
+ // box is the same (the class implements both interfaces), which, speaking strictly,
+ // is bad here (means when a browse box acts as UnoControl): We (the FmXGridPeer) are
+ // the XAccessible here, and the browse box should be able to provide us an XAccessibleContext,
+ // but it should _not_ be the XAccessible itself.
+ // However, as long as no client implementation uses dirty hacks such as querying an
+ // XAccessibleContext for XAccessible, this should not be a problem.
+ }
+
+ if ( !xContext.is() )
+ xContext = VCLXWindow::CreateAccessibleContext( );
+
+ return xContext;
+}
+
+//------------------------------------------------------------------------------
+Any FmXGridPeer::getProperty( const ::rtl::OUString& _rPropertyName ) throw( RuntimeException )
+{
+ Any aProp;
+ if (GetWindow())
+ {
+ FmGridControl* pGrid = (FmGridControl*) GetWindow();
+ Window* pDataWindow = &pGrid->GetDataWindow();
+
+ if ( 0 == _rPropertyName.compareTo( FM_PROP_NAME ) )
+ {
+ Font aFont = pDataWindow->GetControlFont();
+ aProp <<= ImplCreateFontDescriptor( aFont );
+ }
+ else if ( 0 == _rPropertyName.compareTo( FM_PROP_TEXTCOLOR ) )
+ {
+ aProp <<= (sal_Int32)pDataWindow->GetControlForeground().GetColor();
+ }
+ else if ( 0 == _rPropertyName.compareTo( FM_PROP_BACKGROUNDCOLOR ) )
+ {
+ aProp <<= (sal_Int32)pDataWindow->GetControlBackground().GetColor();
+ }
+ else if ( 0 == _rPropertyName.compareTo( FM_PROP_ROWHEIGHT ) )
+ {
+ sal_Int32 nPixelHeight = pGrid->GetDataRowHeight();
+ // take the zoom factor into account
+ nPixelHeight = pGrid->CalcReverseZoom(nPixelHeight);
+ aProp <<= (sal_Int32)pGrid->PixelToLogic(Point(0,nPixelHeight),MAP_10TH_MM).Y();
+ }
+ else if ( 0 == _rPropertyName.compareTo( FM_PROP_HASNAVIGATION ) )
+ {
+ sal_Bool bHasNavBar = pGrid->HasNavigationBar();
+ aProp <<= (sal_Bool)bHasNavBar;
+ }
+ else if ( 0 == _rPropertyName.compareTo( FM_PROP_RECORDMARKER ) )
+ {
+ sal_Bool bHasHandle = pGrid->HasHandle();
+ aProp <<= (sal_Bool)bHasHandle;
+ }
+ else if ( 0 == _rPropertyName.compareTo( FM_PROP_ENABLED ) )
+ {
+ aProp <<= (sal_Bool)pDataWindow->IsEnabled();
+ }
+ else
+ aProp = VCLXWindow::getProperty( _rPropertyName );
+ }
+ return aProp;
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::dispose() throw( RuntimeException )
+{
+ EventObject aEvt;
+ aEvt.Source = static_cast< ::cppu::OWeakObject* >(this);
+ m_aModifyListeners.disposeAndClear(aEvt);
+ m_aUpdateListeners.disposeAndClear(aEvt);
+ m_aContainerListeners.disposeAndClear(aEvt);
+ VCLXWindow::dispose();
+
+ // release all interceptors
+ // discovered during #100312# - 2002-10-23 - fs@openoffice.org
+ Reference< XDispatchProviderInterceptor > xInterceptor( m_xFirstDispatchInterceptor );
+ m_xFirstDispatchInterceptor.clear();
+ while ( xInterceptor.is() )
+ {
+ // tell the interceptor it has a new (means no) predecessor
+ xInterceptor->setMasterDispatchProvider( NULL );
+
+ // ask for it's successor
+ Reference< XDispatchProvider > xSlave = xInterceptor->getSlaveDispatchProvider();
+ // and give it the new (means no) successoert
+ xInterceptor->setSlaveDispatchProvider( NULL );
+
+ // start over with the next chain element
+ xInterceptor = xInterceptor.query( xSlave );
+ }
+
+ DisConnectFromDispatcher();
+ setRowSet(Reference< XRowSet > ());
+}
+
+// XContainer
+//------------------------------------------------------------------------------
+void FmXGridPeer::addContainerListener(const Reference< XContainerListener >& l) throw( RuntimeException )
+{
+ m_aContainerListeners.addInterface( l );
+}
+//------------------------------------------------------------------------------
+void FmXGridPeer::removeContainerListener(const Reference< XContainerListener >& l) throw( RuntimeException )
+{
+ m_aContainerListeners.removeInterface( l );
+}
+
+// ::com::sun::star::data::XDatabaseCursorSupplier
+//------------------------------------------------------------------------------
+void FmXGridPeer::startCursorListening()
+{
+ if (!m_nCursorListening)
+ {
+ Reference< XRowSet > xRowSet(m_xCursor, UNO_QUERY);
+ if (xRowSet.is())
+ xRowSet->addRowSetListener(this);
+
+ Reference< XReset > xReset(m_xCursor, UNO_QUERY);
+ if (xReset.is())
+ xReset->addResetListener(this);
+
+ // alle Listener anmelden
+ Reference< XPropertySet > xSet(m_xCursor, UNO_QUERY);
+ if (xSet.is())
+ {
+ xSet->addPropertyChangeListener(FM_PROP_ISMODIFIED, this);
+ xSet->addPropertyChangeListener(FM_PROP_ROWCOUNT, this);
+ }
+ }
+ m_nCursorListening++;
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::stopCursorListening()
+{
+ if (!--m_nCursorListening)
+ {
+ Reference< XRowSet > xRowSet(m_xCursor, UNO_QUERY);
+ if (xRowSet.is())
+ xRowSet->removeRowSetListener(this);
+
+ Reference< XReset > xReset(m_xCursor, UNO_QUERY);
+ if (xReset.is())
+ xReset->removeResetListener(this);
+
+ Reference< XPropertySet > xSet(m_xCursor, UNO_QUERY);
+ if (xSet.is())
+ {
+ xSet->removePropertyChangeListener(FM_PROP_ISMODIFIED, this);
+ xSet->removePropertyChangeListener(FM_PROP_ROWCOUNT, this);
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::updateGrid(const Reference< XRowSet >& _rxCursor)
+{
+ FmGridControl* pGrid = (FmGridControl*)GetWindow();
+ if (pGrid)
+ pGrid->setDataSource(_rxCursor);
+}
+
+//------------------------------------------------------------------------------
+Reference< XRowSet > FmXGridPeer::getRowSet() throw( RuntimeException )
+{
+ return m_xCursor;
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::setRowSet(const Reference< XRowSet >& _rDatabaseCursor) throw( RuntimeException )
+{
+ FmGridControl* pGrid = (FmGridControl*) GetWindow();
+ if (!pGrid || !m_xColumns.is() || !m_xColumns->getCount())
+ return;
+ // alle Listener abmelden
+ if (m_xCursor.is())
+ {
+ Reference< XLoadable > xLoadable(m_xCursor, UNO_QUERY);
+ // only if the form is loaded we set the rowset
+ if (xLoadable.is())
+ {
+ stopCursorListening();
+ xLoadable->removeLoadListener(this);
+ }
+ }
+
+ m_xCursor = _rDatabaseCursor;
+
+ if (pGrid)
+ {
+ Reference< XLoadable > xLoadable(m_xCursor, UNO_QUERY);
+ // only if the form is loaded we set the rowset
+ if (xLoadable.is() && xLoadable->isLoaded())
+ pGrid->setDataSource(m_xCursor);
+ else
+ pGrid->setDataSource(Reference< XRowSet > ());
+
+ if (xLoadable.is())
+ {
+ startCursorListening();
+ xLoadable->addLoadListener(this);
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXGridPeer::addGridControlListener( const Reference< XGridControlListener >& _listener ) throw( RuntimeException )
+{
+ m_aGridControlListeners.addInterface( _listener );
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXGridPeer::removeGridControlListener( const Reference< XGridControlListener >& _listener ) throw( RuntimeException )
+{
+ m_aGridControlListeners.removeInterface( _listener );
+}
+
+//------------------------------------------------------------------------------
+sal_Int16 FmXGridPeer::getCurrentColumnPosition() throw( RuntimeException )
+{
+ FmGridControl* pGrid = (FmGridControl*) GetWindow();
+ return pGrid ? pGrid->GetViewColumnPos(pGrid->GetCurColumnId()) : -1;
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::setCurrentColumnPosition(sal_Int16 nPos) throw( RuntimeException )
+{
+ FmGridControl* pGrid = (FmGridControl*) GetWindow();
+ if (pGrid)
+ pGrid->GoToColumnId(pGrid->GetColumnIdFromViewPos(nPos));
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::selectionChanged(const EventObject& evt) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+
+ FmGridControl* pGrid = (FmGridControl*) GetWindow();
+ if (pGrid)
+ {
+ Reference< ::com::sun::star::view::XSelectionSupplier > xSelSupplier(evt.Source, UNO_QUERY);
+ Any aSelection = xSelSupplier->getSelection();
+ DBG_ASSERT(aSelection.getValueType().getTypeClass() == TypeClass_INTERFACE, "FmXGridPeer::selectionChanged : invalid selection !");
+ Reference< XPropertySet > xSelection;
+ aSelection >>= xSelection;
+ if (xSelection.is())
+ {
+ Reference< XPropertySet > xCol;
+ sal_Int32 i = 0;
+ sal_Int32 nColCount = m_xColumns->getCount();
+
+ for (; i < nColCount; ++i)
+ {
+ m_xColumns->getByIndex(i) >>= xCol;
+ if ( xCol == xSelection )
+ {
+ pGrid->markColumn(pGrid->GetColumnIdFromModelPos((sal_uInt16)i));
+ break;
+ }
+ }
+ // fuer das VCL-Control muessen die Columns 1-basiert sein
+ // die Selektion an das VCL-Control weiterreichen, wenn noetig
+ if ( i != pGrid->GetSelectedColumn() )
+ { // (wenn das nicht greift, wurde das selectionChanged implizit von dem Control selber ausgeloest
+ if ( i < nColCount )
+ {
+ pGrid->SelectColumnPos(pGrid->GetViewColumnPos(pGrid->GetColumnIdFromModelPos( (sal_uInt16)i )) + 1, sal_True);
+ // SelectColumnPos hat wieder zu einem impliziten ActivateCell gefuehrt
+ if (pGrid->IsEditing())
+ pGrid->DeactivateCell();
+ }
+ else
+ pGrid->SetNoSelection();
+ }
+ }
+ else
+ pGrid->markColumn(USHRT_MAX);
+ }
+}
+
+// XElementAccess
+//------------------------------------------------------------------------------
+sal_Bool FmXGridPeer::hasElements() throw( RuntimeException )
+{
+ return getCount() != 0;
+}
+
+//------------------------------------------------------------------------------
+Type SAL_CALL FmXGridPeer::getElementType( ) throw(RuntimeException)
+{
+ return ::getCppuType((Reference< ::com::sun::star::awt::XControl> *)NULL);
+}
+
+// XEnumerationAccess
+//------------------------------------------------------------------------------
+Reference< XEnumeration > FmXGridPeer::createEnumeration() throw( RuntimeException )
+{
+ return new ::comphelper::OEnumerationByIndex(this);
+}
+
+// XIndexAccess
+//------------------------------------------------------------------------------
+sal_Int32 FmXGridPeer::getCount() throw( RuntimeException )
+{
+ FmGridControl* pGrid = (FmGridControl*) GetWindow();
+ if (pGrid)
+ return pGrid->GetViewColCount();
+ else
+ return 0;
+}
+
+//------------------------------------------------------------------------------
+Any FmXGridPeer::getByIndex(sal_Int32 _nIndex) throw( IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
+{
+ FmGridControl* pGrid = (FmGridControl*) GetWindow();
+ if (_nIndex < 0 ||
+ _nIndex >= getCount() || !pGrid)
+ throw IndexOutOfBoundsException();
+
+ Any aElement;
+ // get the columnid
+ sal_uInt16 nId = pGrid->GetColumnIdFromViewPos((sal_uInt16)_nIndex);
+ // get the list position
+ sal_uInt16 nPos = pGrid->GetModelColumnPos(nId);
+
+ DbGridColumn* pCol = pGrid->GetColumns().GetObject(nPos);
+// DBG_ASSERT(pCol && pCol->GetCell(), "FmXGridPeer::getByIndex(): Invalid cell");
+ Reference< ::com::sun::star::awt::XControl > xControl(pCol->GetCell());
+ aElement <<= xControl;
+
+ return aElement;
+}
+
+// ::com::sun::star::util::XModeSelector
+//------------------------------------------------------------------------------
+void FmXGridPeer::setMode(const ::rtl::OUString& Mode) throw( NoSupportException, RuntimeException )
+{
+ if (!supportsMode(Mode))
+ throw NoSupportException();
+
+ if (Mode == m_aMode)
+ return;
+
+ m_aMode = Mode;
+
+ FmGridControl* pGrid = (FmGridControl*) GetWindow();
+ if ( Mode == ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterMode" ) ) )
+ pGrid->SetFilterMode(sal_True);
+ else
+ {
+ pGrid->SetFilterMode(sal_False);
+ pGrid->setDataSource(m_xCursor);
+ }
+}
+
+//------------------------------------------------------------------------------
+::rtl::OUString FmXGridPeer::getMode() throw( RuntimeException )
+{
+ return m_aMode;
+}
+
+//------------------------------------------------------------------------------
+::comphelper::StringSequence FmXGridPeer::getSupportedModes() throw( RuntimeException )
+{
+ static ::comphelper::StringSequence aModes;
+ if (!aModes.getLength())
+ {
+ aModes.realloc(2);
+ ::rtl::OUString* pModes = aModes.getArray();
+ pModes[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DataMode" ) );
+ pModes[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterMode" ) );
+ }
+ return aModes;
+}
+
+//------------------------------------------------------------------------------
+sal_Bool FmXGridPeer::supportsMode(const ::rtl::OUString& Mode) throw( RuntimeException )
+{
+ ::comphelper::StringSequence aModes(getSupportedModes());
+ const ::rtl::OUString* pModes = aModes.getConstArray();
+ for (sal_Int32 i = aModes.getLength(); i > 0; )
+ {
+ if (pModes[--i] == Mode)
+ return sal_True;
+ }
+ return sal_False;
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::columnVisible(DbGridColumn* pColumn)
+{
+ FmGridControl* pGrid = (FmGridControl*) GetWindow();
+
+ sal_Int32 _nIndex = pGrid->GetModelColumnPos(pColumn->GetId());
+ Reference< ::com::sun::star::awt::XControl > xControl(pColumn->GetCell());
+ ContainerEvent aEvt;
+ aEvt.Source = (XContainer*)this;
+ aEvt.Accessor <<= _nIndex;
+ aEvt.Element <<= xControl;
+
+ m_aContainerListeners.notifyEach( &XContainerListener::elementInserted, aEvt );
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::columnHidden(DbGridColumn* pColumn)
+{
+ FmGridControl* pGrid = (FmGridControl*) GetWindow();
+
+ sal_Int32 _nIndex = pGrid->GetModelColumnPos(pColumn->GetId());
+ Reference< ::com::sun::star::awt::XControl > xControl(pColumn->GetCell());
+ ContainerEvent aEvt;
+ aEvt.Source = (XContainer*)this;
+ aEvt.Accessor <<= _nIndex;
+ aEvt.Element <<= xControl;
+
+ m_aContainerListeners.notifyEach( &XContainerListener::elementRemoved, aEvt );
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::draw( sal_Int32 x, sal_Int32 y ) throw( RuntimeException )
+{
+ FmGridControl* pGrid = (FmGridControl*) GetWindow();
+ sal_Int32 nOldFlags = pGrid->GetBrowserFlags();
+ pGrid->SetBrowserFlags(nOldFlags | EBBF_NOROWPICTURE);
+
+ VCLXWindow::draw(x, y);
+
+ pGrid->SetBrowserFlags(nOldFlags);
+}
+
+//------------------------------------------------------------------------------
+Reference< ::com::sun::star::frame::XDispatch > FmXGridPeer::queryDispatch(const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags) throw( RuntimeException )
+{
+ Reference< ::com::sun::star::frame::XDispatch > xResult;
+
+ // first ask our interceptor chain
+ if (m_xFirstDispatchInterceptor.is() && !m_bInterceptingDispatch)
+ {
+ m_bInterceptingDispatch = sal_True;
+ // safety against recursion : as we are master of the first chain element and slave of the last one we would
+ // have an infinite loop without this if no dispatcher can fullfill the rewuest)
+ xResult = m_xFirstDispatchInterceptor->queryDispatch(aURL, aTargetFrameName, nSearchFlags);
+ m_bInterceptingDispatch = sal_False;
+ }
+
+ // then ask ourself : we don't have any dispatches
+ return xResult;
+}
+
+//------------------------------------------------------------------------------
+Sequence< Reference< ::com::sun::star::frame::XDispatch > > FmXGridPeer::queryDispatches(const Sequence< ::com::sun::star::frame::DispatchDescriptor>& aDescripts) throw( RuntimeException )
+{
+ if (m_xFirstDispatchInterceptor.is())
+ return m_xFirstDispatchInterceptor->queryDispatches(aDescripts);
+
+ // then ask ourself : we don't have any dispatches
+ return Sequence< Reference< ::com::sun::star::frame::XDispatch > >();
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::registerDispatchProviderInterceptor(const Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& _xInterceptor) throw( RuntimeException )
+{
+ if (_xInterceptor.is())
+ {
+ if (m_xFirstDispatchInterceptor.is())
+ {
+ Reference< ::com::sun::star::frame::XDispatchProvider > xFirstProvider(m_xFirstDispatchInterceptor, UNO_QUERY);
+ // there is already an interceptor; the new one will become its master
+ _xInterceptor->setSlaveDispatchProvider(xFirstProvider);
+ m_xFirstDispatchInterceptor->setMasterDispatchProvider(xFirstProvider);
+ }
+ else
+ {
+ // it is the first interceptor; set ourself as slave
+ _xInterceptor->setSlaveDispatchProvider((::com::sun::star::frame::XDispatchProvider*)this);
+ }
+
+ // we are the master of the chain's first interceptor
+ m_xFirstDispatchInterceptor = _xInterceptor;
+ m_xFirstDispatchInterceptor->setMasterDispatchProvider((::com::sun::star::frame::XDispatchProvider*)this);
+
+ // we have a new interceptor and we're alive ?
+ if (!isDesignMode())
+ // -> check for new dispatchers
+ UpdateDispatches();
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::releaseDispatchProviderInterceptor(const Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& _xInterceptor) throw( RuntimeException )
+{
+ if (!_xInterceptor.is())
+ return;
+
+ Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > xChainWalk(m_xFirstDispatchInterceptor);
+
+ if (m_xFirstDispatchInterceptor == _xInterceptor)
+ { // our chain will have a new first element
+ Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > xSlave(m_xFirstDispatchInterceptor->getSlaveDispatchProvider(), UNO_QUERY);
+ m_xFirstDispatchInterceptor = xSlave;
+ }
+ // do this before removing the interceptor from the chain as we won't know it's slave afterwards)
+
+ while (xChainWalk.is())
+ {
+ // walk along the chain of interceptors and look for the interceptor that has to be removed
+ Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > xSlave(xChainWalk->getSlaveDispatchProvider(), UNO_QUERY);
+
+ if (xChainWalk == _xInterceptor)
+ {
+ // old master may be an interceptor too
+ Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > xMaster(xChainWalk->getMasterDispatchProvider(), UNO_QUERY);
+
+ // unchain the interceptor that has to be removed
+ xChainWalk->setSlaveDispatchProvider(Reference< ::com::sun::star::frame::XDispatchProvider > ());
+ xChainWalk->setMasterDispatchProvider(Reference< ::com::sun::star::frame::XDispatchProvider > ());
+
+ // reconnect the chain
+ if (xMaster.is())
+ {
+ if (xSlave.is())
+ xMaster->setSlaveDispatchProvider(Reference< ::com::sun::star::frame::XDispatchProvider >::query(xSlave));
+ else
+ // it's the first interceptor of the chain, set ourself as slave
+ xMaster->setSlaveDispatchProvider((::com::sun::star::frame::XDispatchProvider*)this);
+ }
+ else
+ {
+ // the chain's first element was removed, set ourself as new master of the second one
+ if (xSlave.is())
+ xSlave->setMasterDispatchProvider((::com::sun::star::frame::XDispatchProvider*)this);
+ }
+ }
+
+ xChainWalk = xSlave;
+ }
+ // our interceptor chain has changed and we're alive ?
+ if (!isDesignMode())
+ // -> check the dispatchers
+ UpdateDispatches();
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event) throw( RuntimeException )
+{
+ DBG_ASSERT(m_pStateCache, "FmXGridPeer::statusChanged : invalid call !");
+ DBG_ASSERT(m_pDispatchers, "FmXGridPeer::statusChanged : invalid call !");
+
+ Sequence< ::com::sun::star::util::URL>& aUrls = getSupportedURLs();
+ const ::com::sun::star::util::URL* pUrls = aUrls.getConstArray();
+
+ Sequence<sal_uInt16> aSlots = getSupportedGridSlots();
+ const sal_uInt16* pSlots = aSlots.getConstArray();
+
+ sal_uInt16 i;
+ for (i=0; i<aUrls.getLength(); ++i, ++pUrls, ++pSlots)
+ {
+ if (pUrls->Main == Event.FeatureURL.Main)
+ {
+ DBG_ASSERT(m_pDispatchers[i] == Event.Source, "FmXGridPeer::statusChanged : the event source is a little bit suspect !");
+ m_pStateCache[i] = Event.IsEnabled;
+ FmGridControl* pGrid = (FmGridControl*) GetWindow();
+ if (*pSlots != SID_FM_RECORD_UNDO)
+ pGrid->GetNavigationBar().InvalidateState(*pSlots);
+ break;
+ }
+ }
+ DBG_ASSERT(i<aUrls.getLength(), "FmXGridPeer::statusChanged : got a call for an unknown url !");
+}
+
+//------------------------------------------------------------------------------
+sal_Bool FmXGridPeer::approveReset(const EventObject& /*rEvent*/) throw( RuntimeException )
+{
+ return sal_True;
+}
+
+//------------------------------------------------------------------------------
+sal_Bool SAL_CALL FmXGridPeer::select( const Any& _rSelection ) throw (IllegalArgumentException, RuntimeException)
+{
+ Sequence< Any > aBookmarks;
+ if ( !( _rSelection >>= aBookmarks ) )
+ throw IllegalArgumentException();
+
+ FmGridControl* pVclControl = static_cast<FmGridControl*>(GetWindow());
+ return pVclControl->selectBookmarks(aBookmarks);
+
+ // TODO:
+ // speaking strictly, we would have to adjust our model, as our ColumnSelection may have changed.
+ // Our model is a XSelectionSupplier, too, it handles the selection of single columns.
+ // This is somewhat strange, as selection should be a view (not a model) aspect.
+ // So for a clean solution, we should handle column selection ourself, and the model shouldn't
+ // deal with selection at all.
+}
+
+//------------------------------------------------------------------------------
+Any SAL_CALL FmXGridPeer::getSelection( ) throw (RuntimeException)
+{
+ FmGridControl* pVclControl = static_cast<FmGridControl*>(GetWindow());
+ Sequence< Any > aSelectionBookmarks = pVclControl->getSelectionBookmarks();
+ return makeAny(aSelectionBookmarks);
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXGridPeer::addSelectionChangeListener( const Reference< XSelectionChangeListener >& _rxListener ) throw (RuntimeException)
+{
+ m_aSelectionListeners.addInterface( _rxListener );
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXGridPeer::removeSelectionChangeListener( const Reference< XSelectionChangeListener >& _rxListener ) throw (RuntimeException)
+{
+ m_aSelectionListeners.removeInterface( _rxListener );
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::resetted(const EventObject& rEvent) throw( RuntimeException )
+{
+ if (m_xColumns == rEvent.Source)
+ { // my model was reset -> refresh the grid content
+ FmGridControl* pGrid = (FmGridControl*)GetWindow();
+ if (!pGrid)
+ return;
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ pGrid->resetCurrentRow();
+ }
+ // if the cursor fired a reset event we seem to be on the insert row
+ else if (m_xCursor == rEvent.Source)
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ FmGridControl* pGrid = (FmGridControl*) GetWindow();
+ if (pGrid && pGrid->IsOpen())
+ pGrid->positioned(rEvent);
+ }
+}
+
+//------------------------------------------------------------------------------
+Sequence<sal_uInt16>& FmXGridPeer::getSupportedGridSlots()
+{
+ static Sequence<sal_uInt16> aSupported;
+ if (aSupported.getLength() == 0)
+ {
+ sal_uInt16 nSupported[] = {
+ DbGridControl::NavigationBar::RECORD_FIRST,
+ DbGridControl::NavigationBar::RECORD_PREV,
+ DbGridControl::NavigationBar::RECORD_NEXT,
+ DbGridControl::NavigationBar::RECORD_LAST,
+ DbGridControl::NavigationBar::RECORD_NEW,
+ SID_FM_RECORD_UNDO
+ };
+ aSupported.realloc(sizeof(nSupported)/sizeof(nSupported[0]));
+ sal_uInt16* pSupported = aSupported.getArray();
+ for (sal_uInt16 i=0; i<aSupported.getLength(); ++i, ++pSupported)
+ *pSupported = nSupported[i];
+ }
+ return aSupported;
+}
+
+//------------------------------------------------------------------------------
+Sequence< ::com::sun::star::util::URL>& FmXGridPeer::getSupportedURLs()
+{
+ static Sequence< ::com::sun::star::util::URL> aSupported;
+ if (aSupported.getLength() == 0)
+ {
+ static ::rtl::OUString sSupported[] = {
+ FMURL_RECORD_MOVEFIRST,
+ FMURL_RECORD_MOVEPREV,
+ FMURL_RECORD_MOVENEXT,
+ FMURL_RECORD_MOVELAST,
+ FMURL_RECORD_MOVETONEW,
+ FMURL_RECORD_UNDO
+ };
+ aSupported.realloc(sizeof(sSupported)/sizeof(sSupported[0]));
+ ::com::sun::star::util::URL* pSupported = aSupported.getArray();
+ sal_uInt16 i;
+
+ for ( i = 0; i < aSupported.getLength(); ++i, ++pSupported)
+ pSupported->Complete = sSupported[i];
+
+ // let an ::com::sun::star::util::URL-transformer normalize the URLs
+ Reference< ::com::sun::star::util::XURLTransformer > xTransformer(
+ ::comphelper::getProcessServiceFactory()->createInstance(
+ ::rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer")),
+ UNO_QUERY);
+ pSupported = aSupported.getArray();
+ if (xTransformer.is())
+ {
+ for (i=0; i<aSupported.getLength(); ++i)
+ xTransformer->parseStrict(pSupported[i]);
+ }
+ }
+
+ return aSupported;
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::UpdateDispatches()
+{
+ if (!m_pStateCache)
+ { // we don't have any dispatchers yet -> do the initial connect
+ ConnectToDispatcher();
+ return;
+ }
+
+ sal_uInt16 nDispatchersGot = 0;
+ const Sequence< ::com::sun::star::util::URL>& aSupportedURLs = getSupportedURLs();
+ const ::com::sun::star::util::URL* pSupportedURLs = aSupportedURLs.getConstArray();
+ Reference< ::com::sun::star::frame::XDispatch > xNewDispatch;
+ for (sal_uInt16 i=0; i<aSupportedURLs.getLength(); ++i, ++pSupportedURLs)
+ {
+ xNewDispatch = queryDispatch(*pSupportedURLs, rtl::OUString(), 0);
+ if (xNewDispatch != m_pDispatchers[i])
+ {
+ if (m_pDispatchers[i].is())
+ m_pDispatchers[i]->removeStatusListener((::com::sun::star::frame::XStatusListener*)this, *pSupportedURLs);
+ m_pDispatchers[i] = xNewDispatch;
+ if (m_pDispatchers[i].is())
+ m_pDispatchers[i]->addStatusListener((::com::sun::star::frame::XStatusListener*)this, *pSupportedURLs);
+ }
+ if (m_pDispatchers[i].is())
+ ++nDispatchersGot;
+ }
+
+ if (!nDispatchersGot)
+ {
+ delete[] m_pStateCache;
+ delete[] m_pDispatchers;
+ m_pStateCache = NULL;
+ m_pDispatchers = NULL;
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::ConnectToDispatcher()
+{
+ DBG_ASSERT((m_pStateCache != NULL) == (m_pDispatchers != NULL), "FmXGridPeer::ConnectToDispatcher : inconsistent !");
+ if (m_pStateCache)
+ { // already connected -> just do an update
+ UpdateDispatches();
+ return;
+ }
+
+ const Sequence< ::com::sun::star::util::URL>& aSupportedURLs = getSupportedURLs();
+
+ // _before_ adding the status listeners (as the add should result in a statusChanged-call) !
+ m_pStateCache = new sal_Bool[aSupportedURLs.getLength()];
+ m_pDispatchers = new Reference< ::com::sun::star::frame::XDispatch > [aSupportedURLs.getLength()];
+
+ sal_uInt16 nDispatchersGot = 0;
+ const ::com::sun::star::util::URL* pSupportedURLs = aSupportedURLs.getConstArray();
+ for (sal_uInt16 i=0; i<aSupportedURLs.getLength(); ++i, ++pSupportedURLs)
+ {
+ m_pStateCache[i] = 0;
+ m_pDispatchers[i] = queryDispatch(*pSupportedURLs, rtl::OUString(), 0);
+ if (m_pDispatchers[i].is())
+ {
+ m_pDispatchers[i]->addStatusListener((::com::sun::star::frame::XStatusListener*)this, *pSupportedURLs);
+ ++nDispatchersGot;
+ }
+ }
+
+ if (!nDispatchersGot)
+ {
+ delete[] m_pStateCache;
+ delete[] m_pDispatchers;
+ m_pStateCache = NULL;
+ m_pDispatchers = NULL;
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXGridPeer::DisConnectFromDispatcher()
+{
+ if (!m_pStateCache || !m_pDispatchers)
+ return;
+ // we're not connected
+
+ const Sequence< ::com::sun::star::util::URL>& aSupportedURLs = getSupportedURLs();
+ const ::com::sun::star::util::URL* pSupportedURLs = aSupportedURLs.getConstArray();
+ for (sal_uInt16 i=0; i<aSupportedURLs.getLength(); ++i, ++pSupportedURLs)
+ {
+ if (m_pDispatchers[i].is())
+ m_pDispatchers[i]->removeStatusListener((::com::sun::star::frame::XStatusListener*)this, *pSupportedURLs);
+ }
+
+ delete[] m_pStateCache;
+ delete[] m_pDispatchers;
+ m_pStateCache = NULL;
+ m_pDispatchers = NULL;
+}
+
+//------------------------------------------------------------------------------
+IMPL_LINK(FmXGridPeer, OnQueryGridSlotState, void*, pSlot)
+{
+ if (!m_pStateCache)
+ return -1; // unspecified
+
+ sal_uInt16 nSlot = (sal_uInt16)(sal_uIntPtr)pSlot;
+
+ // search the given slot with our supported sequence
+ Sequence<sal_uInt16>& aSupported = getSupportedGridSlots();
+ const sal_uInt16* pSlots = aSupported.getConstArray();
+ for (sal_uInt16 i=0; i<aSupported.getLength(); ++i)
+ {
+ if (pSlots[i] == nSlot)
+ {
+ if (!m_pDispatchers[i].is())
+ return -1; // nothing known about this slot
+ else
+ return m_pStateCache[i];
+ }
+ }
+
+ return -1;
+}
+
+//------------------------------------------------------------------------------
+IMPL_LINK(FmXGridPeer, OnExecuteGridSlot, void*, pSlot)
+{
+ if (!m_pDispatchers)
+ return 0; // not handled
+
+ Sequence< ::com::sun::star::util::URL>& aUrls = getSupportedURLs();
+ const ::com::sun::star::util::URL* pUrls = aUrls.getConstArray();
+
+ Sequence<sal_uInt16> aSlots = getSupportedGridSlots();
+ const sal_uInt16* pSlots = aSlots.getConstArray();
+
+ DBG_ASSERT(aSlots.getLength() == aUrls.getLength(), "FmXGridPeer::OnExecuteGridSlot : inconstent data returned by getSupportedURLs/getSupportedGridSlots !");
+
+ sal_uInt16 nSlot = (sal_uInt16)(sal_uIntPtr)pSlot;
+ for (sal_uInt16 i=0; i<aSlots.getLength(); ++i, ++pUrls, ++pSlots)
+ {
+ if (*pSlots == nSlot)
+ {
+ if (m_pDispatchers[i].is())
+ {
+ // commit any changes done so far, if it's not the undoRecord URL
+ if ( 0 == pUrls->Complete.compareTo( FMURL_RECORD_UNDO ) || commit() )
+ m_pDispatchers[i]->dispatch(*pUrls, Sequence< PropertyValue>());
+
+ return 1; // handled
+ }
+ }
+ }
+
+ return 0; // not handled
+}
+
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
new file mode 100644
index 000000000000..b0ee4fe13a66
--- /dev/null
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -0,0 +1,4843 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+
+#include "fmprop.hrc"
+#include "svx/fmresids.hrc"
+#include "svx/fmtools.hxx"
+#include "gridcell.hxx"
+#include "gridcols.hxx"
+#include "sdbdatacolumn.hxx"
+
+#include <com/sun/star/awt/LineEndFormat.hpp>
+#include <com/sun/star/awt/MouseWheelBehavior.hpp>
+#include <com/sun/star/awt/VisualEffect.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/form/FormComponentType.hpp>
+#include <com/sun/star/form/XBoundComponent.hpp>
+#include <com/sun/star/script/XEventAttacherManager.hpp>
+#include <com/sun/star/sdb/XSQLQueryComposerFactory.hpp>
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/XStatement.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/util/NumberFormat.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+
+#include <comphelper/extract.hxx>
+#include <comphelper/numbers.hxx>
+#include <comphelper/property.hxx>
+#include <connectivity/formattedcolumnvalue.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <i18npool/lang.h>
+
+#include <rtl/math.hxx>
+#include <svtools/calendar.hxx>
+#include <svtools/fmtfield.hxx>
+#include <svl/numuno.hxx>
+#include <svtools/svmedit.hxx>
+#include <svx/dialmgr.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <tools/diagnose_ex.h>
+#include <tools/shl.hxx>
+#include <vcl/longcurr.hxx>
+
+#include <math.h>
+#include <stdio.h>
+
+using namespace ::connectivity;
+using namespace ::connectivity::simple;
+using namespace ::svxform;
+using namespace ::comphelper;
+using namespace ::svt;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::form;
+
+using ::com::sun::star::util::XNumberFormatter;
+namespace MouseWheelBehavior = ::com::sun::star::awt::MouseWheelBehavior;
+
+String INVALIDTEXT = String::CreateFromAscii("###");
+String OBJECTTEXT = String::CreateFromAscii("<OBJECT>");
+ // TODO: resource
+
+//==================================================================
+//= helper
+//==================================================================
+namespace
+{
+ static LineEnd getModelLineEndSetting( const Reference< XPropertySet >& _rxModel )
+ {
+ LineEnd eFormat = LINEEND_LF;
+
+ try
+ {
+ sal_Int16 nLineEndFormat = awt::LineEndFormat::LINE_FEED;
+
+ Reference< XPropertySetInfo > xPSI;
+ if ( _rxModel.is() )
+ xPSI = _rxModel->getPropertySetInfo();
+
+ OSL_ENSURE( xPSI.is(), "getModelLineEndSetting: invalid column model!" );
+ if ( xPSI.is() && xPSI->hasPropertyByName( FM_PROP_LINEENDFORMAT ) )
+ {
+ OSL_VERIFY( _rxModel->getPropertyValue( FM_PROP_LINEENDFORMAT ) >>= nLineEndFormat );
+
+ switch ( nLineEndFormat )
+ {
+ case awt::LineEndFormat::CARRIAGE_RETURN: eFormat = LINEEND_CR; break;
+ case awt::LineEndFormat::LINE_FEED: eFormat = LINEEND_LF; break;
+ case awt::LineEndFormat::CARRIAGE_RETURN_LINE_FEED: eFormat = LINEEND_CRLF; break;
+ default:
+ OSL_ENSURE( sal_False, "getModelLineEndSetting: what's this?" );
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "getModelLineEndSetting: caught an exception!" );
+ }
+ return eFormat;
+ }
+}
+
+//==================================================================
+//= DbGridColumn
+//==================================================================
+//------------------------------------------------------------------------------
+CellControllerRef DbGridColumn::s_xEmptyController;
+
+//------------------------------------------------------------------------------
+void DbGridColumn::CreateControl(sal_Int32 _nFieldPos, const Reference< ::com::sun::star::beans::XPropertySet >& xField, sal_Int32 nTypeId)
+{
+ Clear();
+
+ m_nTypeId = (sal_Int16)nTypeId;
+ if (xField != m_xField)
+ {
+ // Grundeinstellung
+ m_xField = xField;
+ xField->getPropertyValue(FM_PROP_FORMATKEY) >>= m_nFormatKey;
+ m_nFieldPos = (sal_Int16)_nFieldPos;
+ m_bReadOnly = ::comphelper::getBOOL(xField->getPropertyValue(FM_PROP_ISREADONLY));
+ m_bAutoValue = ::comphelper::getBOOL(xField->getPropertyValue(FM_PROP_AUTOINCREMENT));
+ m_nFieldType = (sal_Int16)::comphelper::getINT32(xField->getPropertyValue(FM_PROP_FIELDTYPE));
+
+ switch (m_nFieldType)
+ {
+ case DataType::DATE:
+ case DataType::TIME:
+ case DataType::TIMESTAMP:
+ m_bDateTime = sal_True;
+
+ case DataType::BIT:
+ case DataType::BOOLEAN:
+ case DataType::TINYINT:
+ case DataType::SMALLINT:
+ case DataType::INTEGER:
+ case DataType::BIGINT:
+ case DataType::FLOAT:
+ case DataType::REAL:
+ case DataType::DOUBLE:
+ case DataType::NUMERIC:
+ case DataType::DECIMAL:
+ m_nAlign = ::com::sun::star::awt::TextAlign::RIGHT;
+ m_bNumeric = sal_True;
+ break;
+ default:
+ m_nAlign = ::com::sun::star::awt::TextAlign::LEFT;
+ break;
+ }
+ }
+
+ DbCellControl* pCellControl = NULL;
+ if (m_rParent.IsFilterMode())
+ {
+ pCellControl = new DbFilterField(m_rParent.getServiceManager(),*this);
+ }
+ else
+ {
+
+ switch (nTypeId)
+ {
+ case TYPE_CHECKBOX: pCellControl = new DbCheckBox(*this); break;
+ case TYPE_COMBOBOX: pCellControl = new DbComboBox(*this); break;
+ case TYPE_CURRENCYFIELD: pCellControl = new DbCurrencyField(*this); break;
+ case TYPE_DATEFIELD: pCellControl = new DbDateField(*this); break;
+ case TYPE_LISTBOX: pCellControl = new DbListBox(*this); break;
+ case TYPE_NUMERICFIELD: pCellControl = new DbNumericField(*this); break;
+ case TYPE_PATTERNFIELD: pCellControl = new DbPatternField( *this, ::comphelper::ComponentContext( m_rParent.getServiceManager() ) ); break;
+ case TYPE_TEXTFIELD: pCellControl = new DbTextField(*this); break;
+ case TYPE_TIMEFIELD: pCellControl = new DbTimeField(*this); break;
+ case TYPE_FORMATTEDFIELD: pCellControl = new DbFormattedField(*this); break;
+ default:
+ DBG_ERROR("DbGridColumn::CreateControl: Unknown Column");
+ return;
+ }
+
+ }
+ Reference< XRowSet > xCur;
+ if (m_rParent.getDataSource())
+ xCur = Reference< XRowSet > ((Reference< XInterface >)*m_rParent.getDataSource(), UNO_QUERY);
+ // TODO : the cursor wrapper should use an XRowSet interface, too
+
+ pCellControl->Init( m_rParent.GetDataWindow(), xCur );
+
+ // now create the control wrapper
+ if (m_rParent.IsFilterMode())
+ m_pCell = new FmXFilterCell(this, pCellControl);
+ else
+ {
+ switch (nTypeId)
+ {
+ case TYPE_CHECKBOX: m_pCell = new FmXCheckBoxCell( this, *pCellControl ); break;
+ case TYPE_LISTBOX: m_pCell = new FmXListBoxCell( this, *pCellControl ); break;
+ case TYPE_COMBOBOX: m_pCell = new FmXComboBoxCell( this, *pCellControl ); break;
+ default:
+ m_pCell = new FmXEditCell( this, *pCellControl );
+ }
+ }
+ m_pCell->acquire();
+ m_pCell->init();
+
+ impl_toggleScriptManager_nothrow( true );
+
+ // only if we use have a bound field, we use a a controller for displaying the
+ // window in the grid
+ if (m_xField.is())
+ m_xController = pCellControl->CreateController();
+}
+
+//------------------------------------------------------------------------------
+void DbGridColumn::impl_toggleScriptManager_nothrow( bool _bAttach )
+{
+ try
+ {
+ Reference< container::XChild > xChild( m_xModel, UNO_QUERY_THROW );
+ Reference< script::XEventAttacherManager > xManager( xChild->getParent(), UNO_QUERY_THROW );
+ Reference< container::XIndexAccess > xContainer( xChild->getParent(), UNO_QUERY_THROW );
+
+ sal_Int32 nIndexInParent( getElementPos( xContainer, m_xModel ) );
+
+ Reference< XInterface > xCellInterface( *m_pCell, UNO_QUERY );
+ if ( _bAttach )
+ xManager->attach( nIndexInParent, xCellInterface, makeAny( xCellInterface ) );
+ else
+ xManager->detach( nIndexInParent, xCellInterface );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbGridColumn::UpdateFromField(const DbGridRow* pRow, const Reference< XNumberFormatter >& xFormatter)
+{
+ if (m_pCell && m_pCell->ISA(FmXFilterCell))
+ PTR_CAST(FmXFilterCell, m_pCell)->Update();
+ else if (pRow && pRow->IsValid() && m_nFieldPos >= 0 && m_pCell && pRow->HasField(m_nFieldPos))
+ {
+ PTR_CAST(FmXDataCell, m_pCell)->UpdateFromField( pRow->GetField( m_nFieldPos ).getColumn(), xFormatter );
+ }
+}
+
+//------------------------------------------------------------------------------
+sal_Bool DbGridColumn::Commit()
+{
+ sal_Bool bResult = sal_True;
+ if (!m_bInSave && m_pCell)
+ {
+ m_bInSave = sal_True;
+ bResult = m_pCell->Commit();
+
+ // store the data into the model
+ FmXDataCell* pDataCell = PTR_CAST(FmXDataCell, m_pCell);
+ if (bResult && pDataCell)
+ {
+ Reference< ::com::sun::star::form::XBoundComponent > xComp(m_xModel, UNO_QUERY);
+ if (xComp.is())
+ bResult = xComp->commit();
+ }
+ m_bInSave = sal_False;
+ }
+ return bResult;
+}
+
+//------------------------------------------------------------------------------
+DbGridColumn::~DbGridColumn()
+{
+ Clear();
+}
+
+//------------------------------------------------------------------------------
+void DbGridColumn::setModel(::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _xModel)
+{
+ if ( m_pCell )
+ impl_toggleScriptManager_nothrow( false );
+
+ m_xModel = _xModel;
+
+ if ( m_pCell )
+ impl_toggleScriptManager_nothrow( true );
+}
+
+//------------------------------------------------------------------------------
+void DbGridColumn::Clear()
+{
+ if ( m_pCell )
+ {
+ impl_toggleScriptManager_nothrow( false );
+
+ m_pCell->dispose();
+ m_pCell->release();
+ m_pCell = NULL;
+ }
+
+ m_xController = NULL;
+ m_xField = NULL;
+
+ m_nFormatKey = 0;
+ m_nFieldPos = -1;
+ m_bReadOnly = sal_True;
+ m_bAutoValue = sal_False;
+ m_nFieldType = DataType::OTHER;
+}
+
+//------------------------------------------------------------------------------
+sal_Int16 DbGridColumn::SetAlignment(sal_Int16 _nAlign)
+{
+ if (_nAlign == -1)
+ { // 'Standard'
+ if (m_xField.is())
+ {
+ sal_Int32 nType = 0;
+ m_xField->getPropertyValue(FM_PROP_FIELDTYPE) >>= nType;
+
+ switch (nType)
+ {
+ case DataType::NUMERIC:
+ case DataType::DECIMAL:
+ case DataType::DOUBLE:
+ case DataType::REAL:
+ case DataType::BIGINT:
+ case DataType::INTEGER:
+ case DataType::SMALLINT:
+ case DataType::TINYINT:
+ case DataType::DATE:
+ case DataType::TIME:
+ case DataType::TIMESTAMP:
+ _nAlign = ::com::sun::star::awt::TextAlign::RIGHT;
+ break;
+ case DataType::BIT:
+ case DataType::BOOLEAN:
+ _nAlign = ::com::sun::star::awt::TextAlign::CENTER;
+ break;
+ default:
+ _nAlign = ::com::sun::star::awt::TextAlign::LEFT;
+ break;
+ }
+ }
+ else
+ _nAlign = ::com::sun::star::awt::TextAlign::LEFT;
+ }
+
+ m_nAlign = _nAlign;
+ if (m_pCell && m_pCell->isAlignedController())
+ m_pCell->AlignControl(m_nAlign);
+
+ return m_nAlign;
+}
+
+//------------------------------------------------------------------------------
+sal_Int16 DbGridColumn::SetAlignmentFromModel(sal_Int16 nStandardAlign)
+{
+ Any aAlign( m_xModel->getPropertyValue(FM_PROP_ALIGN));
+ if (aAlign.hasValue())
+ {
+ sal_Int16 nTest = sal_Int16();
+ if (aAlign >>= nTest)
+ nStandardAlign = nTest;
+ }
+ return SetAlignment(nStandardAlign);
+}
+
+//------------------------------------------------------------------------------
+void DbGridColumn::setLock(sal_Bool _bLock)
+{
+ if (m_bLocked == _bLock)
+ return;
+ m_bLocked = _bLock;
+
+ // is the column we represent active ?
+ if (m_bHidden)
+ return; // no, it isn't (or at least it shouldn't be ...)
+
+ if (m_rParent.GetCurColumnId() == m_nId)
+ {
+ m_rParent.DeactivateCell();
+ m_rParent.ActivateCell(m_rParent.GetCurRow(), m_rParent.GetCurColumnId());
+ }
+}
+
+//------------------------------------------------------------------------------
+String DbGridColumn::GetCellText(const DbGridRow* pRow, const Reference< XNumberFormatter >& xFormatter) const
+{
+ String aText;
+ if (m_pCell && m_pCell->ISA(FmXFilterCell))
+ return aText;
+
+ if (!pRow || !pRow->IsValid())
+ aText = INVALIDTEXT;
+ else if (pRow->HasField(m_nFieldPos))
+ {
+ aText = GetCellText( pRow->GetField( m_nFieldPos ).getColumn(), xFormatter );
+ }
+ return aText;
+}
+
+//------------------------------------------------------------------------------
+String DbGridColumn::GetCellText(const Reference< ::com::sun::star::sdb::XColumn >& xField, const Reference< XNumberFormatter >& xFormatter) const
+{
+ String aText;
+ if (xField.is())
+ {
+ FmXTextCell* pTextCell = PTR_CAST(FmXTextCell, m_pCell);
+ if (pTextCell)
+ aText = pTextCell->GetText(xField, xFormatter);
+ else if (m_bObject)
+ aText = OBJECTTEXT;
+ }
+ return aText;
+}
+
+//------------------------------------------------------------------------------
+Reference< ::com::sun::star::sdb::XColumn > DbGridColumn::GetCurrentFieldValue() const
+{
+ Reference< ::com::sun::star::sdb::XColumn > xField;
+ const DbGridRowRef xRow = m_rParent.GetCurrentRow();
+ if (xRow.Is() && xRow->HasField(m_nFieldPos))
+ {
+ xField = xRow->GetField(m_nFieldPos).getColumn();
+ }
+ return xField;
+}
+
+//------------------------------------------------------------------------------
+void DbGridColumn::Paint(OutputDevice& rDev,
+ const Rectangle& rRect,
+ const DbGridRow* pRow,
+ const Reference< XNumberFormatter >& xFormatter)
+{
+ bool bEnabled = ( rDev.GetOutDevType() != OUTDEV_WINDOW )
+ || ( static_cast< Window& >( rDev ).IsEnabled() );
+
+ FmXDataCell* pDataCell = PTR_CAST(FmXDataCell, m_pCell);
+ if (pDataCell)
+ {
+ if (!pRow || !pRow->IsValid())
+ {
+ sal_uInt16 nStyle = TEXT_DRAW_CLIP | TEXT_DRAW_CENTER;
+ if ( !bEnabled )
+ nStyle |= TEXT_DRAW_DISABLE;
+
+ rDev.DrawText(rRect, INVALIDTEXT, nStyle);
+ }
+ else if (m_bAutoValue && pRow->IsNew())
+ {
+ static String aAutoText(SVX_RES(RID_STR_AUTOFIELD));
+ sal_uInt16 nStyle = TEXT_DRAW_CLIP | TEXT_DRAW_VCENTER;
+ if ( !bEnabled )
+ nStyle |= TEXT_DRAW_DISABLE;
+
+ switch (GetAlignment())
+ {
+ case ::com::sun::star::awt::TextAlign::RIGHT:
+ nStyle |= TEXT_DRAW_RIGHT;
+ break;
+ case ::com::sun::star::awt::TextAlign::CENTER:
+ nStyle |= TEXT_DRAW_CENTER;
+ break;
+ default:
+ nStyle |= TEXT_DRAW_LEFT;
+ }
+
+ rDev.DrawText(rRect, aAutoText , nStyle);
+ }
+ else if (pRow->HasField(m_nFieldPos))
+ {
+ pDataCell->PaintFieldToCell(rDev, rRect, pRow->GetField( m_nFieldPos ).getColumn(), xFormatter);
+ }
+ }
+ else if (!m_pCell)
+ {
+ if (!pRow || !pRow->IsValid())
+ {
+ sal_uInt16 nStyle = TEXT_DRAW_CLIP | TEXT_DRAW_CENTER;
+ if ( !bEnabled )
+ nStyle |= TEXT_DRAW_DISABLE;
+
+ rDev.DrawText(rRect, INVALIDTEXT, nStyle);
+ }
+ else if (pRow->HasField(m_nFieldPos) && m_bObject)
+ {
+ sal_uInt16 nStyle = TEXT_DRAW_CLIP | TEXT_DRAW_CENTER;
+ if ( !bEnabled )
+ nStyle |= TEXT_DRAW_DISABLE;
+ rDev.DrawText(rRect, OBJECTTEXT, nStyle);
+ }
+ }
+ else if ( m_pCell->ISA( FmXFilterCell ) )
+ static_cast< FmXFilterCell* >( m_pCell )->PaintCell( rDev, rRect );
+}
+
+//------------------------------------------------------------------------------
+void DbGridColumn::ImplInitWindow( Window& rParent, const InitWindowFacet _eInitWhat )
+{
+ if ( m_pCell )
+ m_pCell->ImplInitWindow( rParent, _eInitWhat );
+}
+
+//==============================================================================
+//= cell controls
+//==============================================================================
+TYPEINIT0( DbCellControl )
+TYPEINIT1( DbLimitedLengthField, DbCellControl )
+TYPEINIT1( DbTextField, DbLimitedLengthField )
+TYPEINIT1( DbFormattedField, DbLimitedLengthField )
+TYPEINIT1( DbCheckBox, DbCellControl )
+TYPEINIT1( DbComboBox, DbCellControl )
+TYPEINIT1( DbListBox, DbCellControl )
+TYPEINIT1( DbPatternField, DbCellControl )
+TYPEINIT1( DbSpinField, DbCellControl )
+TYPEINIT1( DbDateField, DbSpinField )
+TYPEINIT1( DbTimeField, DbSpinField )
+TYPEINIT1( DbCurrencyField, DbSpinField )
+TYPEINIT1( DbNumericField, DbSpinField )
+TYPEINIT1( DbFilterField, DbCellControl )
+
+//------------------------------------------------------------------------------
+DbCellControl::DbCellControl( DbGridColumn& _rColumn, sal_Bool /*_bText*/ )
+ :OPropertyChangeListener(m_aMutex)
+ ,m_pFieldChangeBroadcaster(NULL)
+ ,m_bTransparent( sal_False )
+ ,m_bAlignedController( sal_True )
+ ,m_bAccessingValueProperty( sal_False )
+ ,m_rColumn( _rColumn )
+ ,m_pPainter( NULL )
+ ,m_pWindow( NULL )
+{
+ Reference< XPropertySet > xColModelProps( _rColumn.getModel(), UNO_QUERY );
+ if ( xColModelProps.is() )
+ {
+ // if our model's format key changes we want to propagate the new value to our windows
+ m_pModelChangeBroadcaster = new ::comphelper::OPropertyChangeMultiplexer(this, Reference< ::com::sun::star::beans::XPropertySet > (_rColumn.getModel(), UNO_QUERY));
+ m_pModelChangeBroadcaster->acquire();
+
+ // be listener for some common properties
+ implDoPropertyListening( FM_PROP_READONLY, sal_False );
+ implDoPropertyListening( FM_PROP_ENABLED, sal_False );
+
+ // add as listener for all know "value" properties
+ implDoPropertyListening( FM_PROP_VALUE, sal_False );
+ implDoPropertyListening( FM_PROP_STATE, sal_False );
+ implDoPropertyListening( FM_PROP_TEXT, sal_False );
+ implDoPropertyListening( FM_PROP_EFFECTIVE_VALUE, sal_False );
+
+ // be listener at the bound field as well
+ try
+ {
+ Reference< XPropertySetInfo > xPSI( xColModelProps->getPropertySetInfo(), UNO_SET_THROW );
+ if ( xPSI->hasPropertyByName( FM_PROP_BOUNDFIELD ) )
+ {
+ Reference< XPropertySet > xField;
+ xColModelProps->getPropertyValue( FM_PROP_BOUNDFIELD ) >>= xField;
+ if ( xField.is() )
+ {
+ m_pFieldChangeBroadcaster = new ::comphelper::OPropertyChangeMultiplexer(this, xField);
+ m_pFieldChangeBroadcaster->acquire();
+ m_pFieldChangeBroadcaster->addProperty( FM_PROP_ISREADONLY );
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_ERROR( "DbCellControl::doPropertyListening: caught an exception!" );
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbCellControl::implDoPropertyListening( const ::rtl::OUString& _rPropertyName, sal_Bool _bWarnIfNotExistent )
+{
+ try
+ {
+ Reference< XPropertySet > xColModelProps( m_rColumn.getModel(), UNO_QUERY );
+ Reference< XPropertySetInfo > xPSI;
+ if ( xColModelProps.is() )
+ xPSI = xColModelProps->getPropertySetInfo();
+
+ DBG_ASSERT( !_bWarnIfNotExistent || ( xPSI.is() && xPSI->hasPropertyByName( _rPropertyName ) ),
+ "DbCellControl::doPropertyListening: no property set info or non-existent property!" );
+ (void)_bWarnIfNotExistent;
+
+ if ( xPSI.is() && xPSI->hasPropertyByName( _rPropertyName ) )
+ m_pModelChangeBroadcaster->addProperty( _rPropertyName );
+ }
+ catch( const Exception& )
+ {
+ DBG_ERROR( "DbCellControl::doPropertyListening: caught an exception!" );
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbCellControl::doPropertyListening( const ::rtl::OUString& _rPropertyName )
+{
+ implDoPropertyListening( _rPropertyName );
+}
+//------------------------------------------------------------------------------
+void lcl_clearBroadCaster(::comphelper::OPropertyChangeMultiplexer*& _pBroadcaster)
+{
+ if ( _pBroadcaster )
+ {
+ _pBroadcaster->dispose();
+ _pBroadcaster->release();
+ _pBroadcaster = NULL;
+ // no delete, this is done implicitly
+ }
+}
+//------------------------------------------------------------------------------
+DbCellControl::~DbCellControl()
+{
+ lcl_clearBroadCaster(m_pModelChangeBroadcaster);
+ lcl_clearBroadCaster(m_pFieldChangeBroadcaster);
+
+ delete m_pWindow;
+ delete m_pPainter;
+}
+
+//------------------------------------------------------------------------------
+void DbCellControl::implValuePropertyChanged( )
+{
+ OSL_ENSURE( !isValuePropertyLocked(),
+ "DbCellControl::implValuePropertyChanged: not to be called with the value property locked!" );
+
+ if ( m_pWindow )
+ {
+ if ( m_rColumn.getModel().is() )
+ updateFromModel( m_rColumn.getModel() );
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbCellControl::implAdjustGenericFieldSetting( const Reference< XPropertySet >& /*_rxModel*/ )
+{
+ // nothing to to here
+}
+
+//------------------------------------------------------------------------------
+void DbCellControl::_propertyChanged(const PropertyChangeEvent& _rEvent) throw(RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ Reference< XPropertySet > xSourceProps( _rEvent.Source, UNO_QUERY );
+
+ if ( _rEvent.PropertyName.equals( FM_PROP_VALUE )
+ || _rEvent.PropertyName.equals( FM_PROP_STATE )
+ || _rEvent.PropertyName.equals( FM_PROP_TEXT )
+ || _rEvent.PropertyName.equals( FM_PROP_EFFECTIVE_VALUE )
+ )
+ { // it was one of the known "value" properties
+ if ( !isValuePropertyLocked() )
+ {
+ implValuePropertyChanged( );
+ }
+ }
+ else if ( _rEvent.PropertyName.equals( FM_PROP_READONLY ) )
+ {
+ implAdjustReadOnly( xSourceProps, true);
+ }
+ else if ( _rEvent.PropertyName.equals( FM_PROP_ISREADONLY ) )
+ {
+ sal_Bool bReadOnly = sal_True;
+ _rEvent.NewValue >>= bReadOnly;
+ m_rColumn.SetReadOnly(bReadOnly);
+ implAdjustReadOnly( xSourceProps, false);
+ }
+ else if ( _rEvent.PropertyName.equals( FM_PROP_ENABLED ) )
+ {
+ implAdjustEnabled( xSourceProps );
+ }
+ else
+ implAdjustGenericFieldSetting( xSourceProps );
+}
+
+//------------------------------------------------------------------------------
+sal_Bool DbCellControl::Commit()
+{
+ // lock the listening for value property changes
+ lockValueProperty();
+ // commit the content of the control into the model's value property
+ sal_Bool bReturn = sal_False;
+ try
+ {
+ bReturn = commitControl();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ // unlock the listening for value property changes
+ unlockValueProperty();
+ // outta here
+ return bReturn;
+}
+
+//------------------------------------------------------------------------------
+void DbCellControl::ImplInitWindow( Window& rParent, const InitWindowFacet _eInitWhat )
+{
+ Window* pWindows[] = { m_pPainter, m_pWindow };
+
+ if ( ( _eInitWhat & InitWritingMode ) != 0 )
+ {
+ for ( size_t i=0; i < sizeof( pWindows ) / sizeof( pWindows[0] ); ++i )
+ {
+ if ( pWindows[i] )
+ pWindows[i]->EnableRTL( rParent.IsRTLEnabled() );
+ }
+ }
+
+ if ( ( _eInitWhat & InitFont ) != 0 )
+ {
+ for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i)
+ {
+ if ( !pWindows[i] )
+ continue;
+
+ pWindows[i]->SetZoom( rParent.GetZoom() );
+
+ const StyleSettings& rStyleSettings = pWindows[i]->GetSettings().GetStyleSettings();
+ Font aFont = rStyleSettings.GetFieldFont();
+ aFont.SetTransparent( isTransparent() );
+
+ if ( rParent.IsControlFont() )
+ {
+ pWindows[i]->SetControlFont( rParent.GetControlFont() );
+ aFont.Merge( rParent.GetControlFont() );
+ }
+ else
+ pWindows[i]->SetControlFont();
+
+ pWindows[i]->SetZoomedPointFont( aFont );
+ }
+ }
+
+ if ( ( ( _eInitWhat & InitFont ) != 0 )
+ || ( ( _eInitWhat & InitForeground ) != 0 )
+ )
+ {
+ Color aTextColor( rParent.IsControlForeground() ? rParent.GetControlForeground() : rParent.GetTextColor() );
+
+ sal_Bool bTextLineColor = rParent.IsTextLineColor();
+ Color aTextLineColor( rParent.GetTextLineColor() );
+
+ for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i)
+ {
+ if ( pWindows[i] )
+ {
+ pWindows[i]->SetTextColor(aTextColor);
+ if (rParent.IsControlForeground())
+ pWindows[i]->SetControlForeground(aTextColor);
+
+ if (bTextLineColor)
+ pWindows[i]->SetTextLineColor();
+ else
+ pWindows[i]->SetTextLineColor(aTextLineColor);
+ }
+ }
+ }
+
+ if ( ( _eInitWhat & InitBackground ) != 0 )
+ {
+ if (rParent.IsControlBackground())
+ {
+ Color aColor( rParent.GetControlBackground());
+ for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i)
+ {
+ if ( pWindows[i] )
+ {
+ if ( isTransparent() )
+ pWindows[i]->SetBackground();
+ else
+ {
+ pWindows[i]->SetBackground(aColor);
+ pWindows[i]->SetControlBackground(aColor);
+ }
+ pWindows[i]->SetFillColor(aColor);
+ }
+ }
+ }
+ else
+ {
+ if (m_pPainter)
+ {
+ if ( isTransparent() )
+ m_pPainter->SetBackground();
+ else
+ m_pPainter->SetBackground(rParent.GetBackground());
+ m_pPainter->SetFillColor(rParent.GetFillColor());
+ }
+
+ if (m_pWindow)
+ {
+ if ( isTransparent() )
+ m_pWindow->SetBackground(rParent.GetBackground());
+ else
+ m_pWindow->SetFillColor(rParent.GetFillColor());
+ }
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbCellControl::implAdjustReadOnly( const Reference< XPropertySet >& _rxModel,bool i_bReadOnly )
+{
+ DBG_ASSERT( m_pWindow, "DbCellControl::implAdjustReadOnly: not to be called without window!" );
+ DBG_ASSERT( _rxModel.is(), "DbCellControl::implAdjustReadOnly: invalid model!" );
+ if ( m_pWindow && _rxModel.is() )
+ {
+ Edit* pEditWindow = dynamic_cast< Edit* >( m_pWindow );
+ if ( pEditWindow )
+ {
+ sal_Bool bReadOnly = m_rColumn.IsReadOnly();
+ if ( !bReadOnly )
+ {
+ _rxModel->getPropertyValue( i_bReadOnly ? FM_PROP_READONLY : FM_PROP_ISREADONLY) >>= bReadOnly;
+ }
+ static_cast< Edit* >( m_pWindow )->SetReadOnly( bReadOnly );
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbCellControl::implAdjustEnabled( const Reference< XPropertySet >& _rxModel )
+{
+ DBG_ASSERT( m_pWindow, "DbCellControl::implAdjustEnabled: not to be called without window!" );
+ DBG_ASSERT( _rxModel.is(), "DbCellControl::implAdjustEnabled: invalid model!" );
+ if ( m_pWindow && _rxModel.is() )
+ {
+ sal_Bool bEnable = sal_True;
+ _rxModel->getPropertyValue( FM_PROP_ENABLED ) >>= bEnable;
+ m_pWindow->Enable( bEnable );
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbCellControl::Init( Window& rParent, const Reference< XRowSet >& _rxCursor )
+{
+ ImplInitWindow( rParent, InitAll );
+
+ if ( m_pWindow )
+ {
+ // align the control
+ if ( isAlignedController() )
+ AlignControl( m_rColumn.GetAlignment() );
+
+ try
+ {
+ // some other common properties
+ Reference< XPropertySet > xModel( m_rColumn.getModel(), UNO_SET_THROW );
+ Reference< XPropertySetInfo > xModelPSI( xModel->getPropertySetInfo(), UNO_SET_THROW );
+
+ if ( xModelPSI->hasPropertyByName( FM_PROP_READONLY ) )
+ {
+ implAdjustReadOnly( xModel,true );
+ }
+
+ 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 );
+ sal_uInt16 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, sal_True );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ m_xCursor = _rxCursor;
+}
+
+//------------------------------------------------------------------------------
+void DbCellControl::SetTextLineColor()
+{
+ if (m_pWindow)
+ m_pWindow->SetTextLineColor();
+ if (m_pPainter)
+ m_pPainter->SetTextLineColor();
+}
+
+//------------------------------------------------------------------------------
+void DbCellControl::SetTextLineColor(const Color& _rColor)
+{
+ if (m_pWindow)
+ m_pWindow->SetTextLineColor(_rColor);
+ if (m_pPainter)
+ m_pPainter->SetTextLineColor(_rColor);
+}
+
+namespace
+{
+ static void lcl_implAlign( Window* _pWindow, WinBits _nAlignmentBit )
+ {
+ WinBits nStyle = _pWindow->GetStyle();
+ nStyle &= ~(WB_LEFT | WB_RIGHT | WB_CENTER);
+ _pWindow->SetStyle( nStyle | _nAlignmentBit );
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbCellControl::AlignControl(sal_Int16 nAlignment)
+{
+ WinBits nAlignmentBit = 0;
+ switch (nAlignment)
+ {
+ case ::com::sun::star::awt::TextAlign::RIGHT:
+ nAlignmentBit = WB_RIGHT;
+ break;
+ case ::com::sun::star::awt::TextAlign::CENTER:
+ nAlignmentBit = WB_CENTER;
+ break;
+ default:
+ nAlignmentBit = WB_LEFT;
+ break;
+ }
+ lcl_implAlign( m_pWindow, nAlignmentBit );
+ if ( m_pPainter )
+ lcl_implAlign( m_pPainter, nAlignmentBit );
+}
+
+//------------------------------------------------------------------------------
+void DbCellControl::PaintCell( OutputDevice& _rDev, const Rectangle& _rRect )
+{
+ if ( m_pPainter->GetParent() == &_rDev )
+ {
+ m_pPainter->SetPaintTransparent( sal_True );
+ m_pPainter->SetBackground( );
+ m_pPainter->SetControlBackground( _rDev.GetFillColor() );
+ m_pPainter->SetControlForeground( _rDev.GetTextColor() );
+ m_pPainter->SetTextColor( _rDev.GetTextColor() );
+ m_pPainter->SetTextFillColor( _rDev.GetTextColor() );
+
+ Font aFont( _rDev.GetFont() );
+ aFont.SetTransparent( sal_True );
+ m_pPainter->SetFont( aFont );
+
+ m_pPainter->SetPosSizePixel( _rRect.TopLeft(), _rRect.GetSize() );
+ m_pPainter->Show();
+ m_pPainter->Update();
+ m_pPainter->SetParentUpdateMode( sal_False );
+ m_pPainter->Hide();
+ m_pPainter->SetParentUpdateMode( sal_True );
+ }
+ else
+ m_pPainter->Draw( &_rDev, _rRect.TopLeft(), _rRect.GetSize(), 0 );
+}
+
+//------------------------------------------------------------------------------
+void DbCellControl::PaintFieldToCell( OutputDevice& _rDev, const Rectangle& _rRect, const Reference< XColumn >& _rxField, const Reference< XNumberFormatter >& _rxFormatter )
+{
+ m_pPainter->SetText( GetFormatText( _rxField, _rxFormatter ) );
+ PaintCell( _rDev, _rRect );
+}
+
+//------------------------------------------------------------------------------
+double DbCellControl::GetValue(const Reference< ::com::sun::star::sdb::XColumn >& _rxField, const Reference< XNumberFormatter >& xFormatter) const
+{
+ double fValue = 0;
+ if (m_rColumn.IsNumeric())
+ {
+ try
+ {
+ fValue = _rxField->getDouble();
+ }
+ catch(const Exception&) { }
+ }
+ else
+ {
+ sal_Bool bSuccess = sal_False;
+ try
+ {
+ fValue = _rxField->getDouble();
+ bSuccess = sal_True;
+ }
+ catch(const Exception&) { }
+ if (!bSuccess)
+ {
+ try
+ {
+ fValue = xFormatter->convertStringToNumber(m_rColumn.GetKey(), _rxField->getString());
+ }
+ catch(const Exception&) { }
+ }
+ }
+ return fValue;
+}
+
+//------------------------------------------------------------------------------
+void DbCellControl::invalidatedController()
+{
+ m_rColumn.GetParent().refreshController(m_rColumn.GetId(), DbGridControl::GrantControlAccess());
+}
+
+/*************************************************************************/
+// CellModels
+/*************************************************************************/
+
+//==============================================================================
+//= DbLimitedLengthField
+//==============================================================================
+//------------------------------------------------------------------------------
+DbLimitedLengthField::DbLimitedLengthField( DbGridColumn& _rColumn )
+ :DbCellControl( _rColumn )
+{
+ doPropertyListening( FM_PROP_MAXTEXTLEN );
+}
+
+//------------------------------------------------------------------------------
+void DbLimitedLengthField::implAdjustGenericFieldSetting( const Reference< XPropertySet >& _rxModel )
+{
+ DBG_ASSERT( m_pWindow, "DbLimitedLengthField::implAdjustGenericFieldSetting: not to be called without window!" );
+ DBG_ASSERT( _rxModel.is(), "DbLimitedLengthField::implAdjustGenericFieldSetting: invalid model!" );
+ if ( m_pWindow && _rxModel.is() )
+ {
+ sal_Int16 nMaxLen = 0;
+ _rxModel->getPropertyValue( FM_PROP_MAXTEXTLEN ) >>= nMaxLen;
+ implSetMaxTextLen( nMaxLen );
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbLimitedLengthField::implSetEffectiveMaxTextLen( sal_Int16 _nMaxLen )
+{
+ dynamic_cast< Edit* >( m_pWindow )->SetMaxTextLen( _nMaxLen );
+ if ( m_pPainter )
+ dynamic_cast< Edit* >( m_pPainter )->SetMaxTextLen( _nMaxLen );
+}
+
+//==============================================================================
+//= DbTextField
+//==============================================================================
+//------------------------------------------------------------------------------
+DbTextField::DbTextField(DbGridColumn& _rColumn)
+ :DbLimitedLengthField(_rColumn)
+ ,m_pEdit( NULL )
+ ,m_pPainterImplementation( NULL )
+ ,m_nKeyType(::com::sun::star::util::NumberFormat::TEXT)
+ ,m_bIsSimpleEdit( sal_True )
+{
+}
+
+//------------------------------------------------------------------------------
+DbTextField::~DbTextField( )
+{
+ DELETEZ( m_pPainterImplementation );
+ DELETEZ( m_pEdit );
+}
+
+//------------------------------------------------------------------------------
+void DbTextField::Init( Window& rParent, const Reference< XRowSet >& xCursor)
+{
+ sal_Int16 nAlignment = m_rColumn.SetAlignmentFromModel(-1);
+
+ Reference< XPropertySet > xModel( m_rColumn.getModel() );
+
+ WinBits nStyle = WB_LEFT;
+ switch (nAlignment)
+ {
+ case awt::TextAlign::RIGHT:
+ nStyle = WB_RIGHT;
+ break;
+
+ case awt::TextAlign::CENTER:
+ nStyle = WB_CENTER;
+ break;
+ }
+
+ // is this a multi-line field?
+ sal_Bool bIsMultiLine = sal_False;
+ try
+ {
+ if ( xModel.is() )
+ {
+ OSL_VERIFY( xModel->getPropertyValue( FM_PROP_MULTILINE ) >>= bIsMultiLine );
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "DbTextField::Init: caught an exception while determining the multi-line capabilities!" );
+ }
+
+ m_bIsSimpleEdit = !bIsMultiLine;
+ if ( bIsMultiLine )
+ {
+ m_pWindow = new MultiLineTextCell( &rParent, nStyle );
+ m_pEdit = new MultiLineEditImplementation( *static_cast< MultiLineTextCell* >( m_pWindow ) );
+
+ m_pPainter = new MultiLineTextCell( &rParent, nStyle );
+ m_pPainterImplementation = new MultiLineEditImplementation( *static_cast< MultiLineTextCell* >( m_pPainter ) );
+ }
+ else
+ {
+ m_pWindow = new Edit( &rParent, nStyle );
+ m_pEdit = new EditImplementation( *static_cast< Edit* >( m_pWindow ) );
+
+ m_pPainter = new Edit( &rParent, nStyle );
+ m_pPainterImplementation = new EditImplementation( *static_cast< Edit* >( m_pPainter ) );
+ }
+
+ if ( WB_LEFT == nStyle )
+ {
+ // this is so that when getting the focus, the selection is oriented left-to-right
+ AllSettings aSettings = m_pWindow->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ aStyleSettings.SetSelectionOptions(
+ aStyleSettings.GetSelectionOptions() | SELECTION_OPTION_SHOWFIRST);
+ aSettings.SetStyleSettings(aStyleSettings);
+ m_pWindow->SetSettings(aSettings);
+ }
+
+ implAdjustGenericFieldSetting( xModel );
+
+ if (m_rColumn.GetParent().getNumberFormatter().is() && m_rColumn.GetKey())
+ m_nKeyType = comphelper::getNumberFormatType(m_rColumn.GetParent().getNumberFormatter()->getNumberFormatsSupplier()->getNumberFormats(), m_rColumn.GetKey());
+
+ DbLimitedLengthField::Init( rParent, xCursor );
+}
+
+//------------------------------------------------------------------------------
+CellControllerRef DbTextField::CreateController() const
+{
+ return new EditCellController( m_pEdit );
+}
+
+//------------------------------------------------------------------------------
+void DbTextField::PaintFieldToCell( OutputDevice& _rDev, const Rectangle& _rRect, const Reference< XColumn >& _rxField, const Reference< XNumberFormatter >& _rxFormatter )
+{
+ if ( m_pPainterImplementation )
+ m_pPainterImplementation->SetText( GetFormatText( _rxField, _rxFormatter, NULL ) );
+
+ DbLimitedLengthField::PaintFieldToCell( _rDev, _rRect, _rxField, _rxFormatter );
+}
+
+//------------------------------------------------------------------------------
+String DbTextField::GetFormatText(const Reference< XColumn >& _rxField, const Reference< XNumberFormatter >& xFormatter, Color** /*ppColor*/)
+{
+ ::rtl::OUString aString;
+ if ( _rxField.is() )
+ try
+ {
+ aString = getFormattedValue( _rxField, xFormatter, m_rColumn.GetParent().getNullDate(), m_rColumn.GetKey(), m_nKeyType);
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return aString;
+}
+
+//------------------------------------------------------------------------------
+void DbTextField::UpdateFromField(const Reference< ::com::sun::star::sdb::XColumn >& _rxField, const Reference< XNumberFormatter >& xFormatter)
+{
+ m_pEdit->SetText( GetFormatText( _rxField, xFormatter ) );
+ m_pEdit->SetSelection( Selection( SELECTION_MAX, SELECTION_MIN ) );
+}
+
+//------------------------------------------------------------------------------
+void DbTextField::updateFromModel( Reference< XPropertySet > _rxModel )
+{
+ OSL_ENSURE( _rxModel.is() && m_pWindow, "DbTextField::updateFromModel: invalid call!" );
+
+ ::rtl::OUString sText;
+ _rxModel->getPropertyValue( FM_PROP_TEXT ) >>= sText;
+
+ xub_StrLen nMaxTextLen = m_pEdit->GetMaxTextLen();
+ if ( EDIT_NOLIMIT != nMaxTextLen && sText.getLength() > nMaxTextLen )
+ {
+ sal_Int32 nDiff = sText.getLength() - nMaxTextLen;
+ sText = sText.replaceAt(sText.getLength() - nDiff,nDiff,::rtl::OUString());
+ }
+
+
+ m_pEdit->SetText( sText );
+ m_pEdit->SetSelection( Selection( SELECTION_MAX, SELECTION_MIN ) );
+}
+
+//------------------------------------------------------------------------------
+sal_Bool DbTextField::commitControl()
+{
+ ::rtl::OUString aText( m_pEdit->GetText( getModelLineEndSetting( m_rColumn.getModel() ) ) );
+ // we have to check if the length before we can decide if the value was modified
+ xub_StrLen nMaxTextLen = m_pEdit->GetMaxTextLen();
+ if ( EDIT_NOLIMIT != nMaxTextLen )
+ {
+ ::rtl::OUString sOldValue;
+ m_rColumn.getModel()->getPropertyValue( FM_PROP_TEXT ) >>= sOldValue;
+ // if the new value didn't change we must set the old long value again
+ if ( sOldValue.getLength() > nMaxTextLen && sOldValue.compareTo(aText,nMaxTextLen) == 0 )
+ aText = sOldValue;
+ }
+ m_rColumn.getModel()->setPropertyValue( FM_PROP_TEXT, makeAny( aText ) );
+ return sal_True;
+}
+
+//------------------------------------------------------------------------------
+void DbTextField::implSetEffectiveMaxTextLen( sal_Int16 _nMaxLen )
+{
+ if ( m_pEdit )
+ m_pEdit->SetMaxTextLen( _nMaxLen );
+ if ( m_pPainterImplementation )
+ m_pPainterImplementation->SetMaxTextLen( _nMaxLen );
+}
+
+//==============================================================================
+//= DbFormattedField
+//==============================================================================
+DBG_NAME(DbFormattedField);
+//------------------------------------------------------------------------------
+DbFormattedField::DbFormattedField(DbGridColumn& _rColumn)
+ :DbLimitedLengthField(_rColumn)
+ ,m_nKeyType(::com::sun::star::util::NumberFormat::UNDEFINED)
+{
+ DBG_CTOR(DbFormattedField,NULL);
+
+ // if our model's format key changes we want to propagate the new value to our windows
+ doPropertyListening( FM_PROP_FORMATKEY );
+}
+
+//------------------------------------------------------------------------------
+DbFormattedField::~DbFormattedField()
+{
+ DBG_DTOR(DbFormattedField,NULL);
+}
+
+//------------------------------------------------------------------------------
+void DbFormattedField::Init( Window& rParent, const Reference< XRowSet >& xCursor)
+{
+ sal_Int16 nAlignment = m_rColumn.SetAlignmentFromModel(-1);
+
+ Reference< ::com::sun::star::beans::XPropertySet > xUnoModel = m_rColumn.getModel();
+
+ switch (nAlignment)
+ {
+ case ::com::sun::star::awt::TextAlign::RIGHT:
+ m_pWindow = new FormattedField( &rParent, WB_RIGHT );
+ m_pPainter = new FormattedField( &rParent, WB_RIGHT );
+ break;
+
+ case ::com::sun::star::awt::TextAlign::CENTER:
+ m_pWindow = new FormattedField( &rParent, WB_CENTER );
+ m_pPainter = new FormattedField( &rParent, WB_CENTER );
+ break;
+ default:
+ m_pWindow = new FormattedField( &rParent, WB_LEFT );
+ m_pPainter = new FormattedField( &rParent, WB_LEFT );
+
+ // Alles nur damit die Selektion bei Focuserhalt von rechts nach links geht
+ AllSettings aSettings = m_pWindow->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ aStyleSettings.SetSelectionOptions(
+ aStyleSettings.GetSelectionOptions() | SELECTION_OPTION_SHOWFIRST);
+ aSettings.SetStyleSettings(aStyleSettings);
+ m_pWindow->SetSettings(aSettings);
+ }
+
+ implAdjustGenericFieldSetting( xUnoModel );
+
+ static_cast< FormattedField* >( m_pWindow )->SetStrictFormat( sal_False );
+ static_cast< FormattedField* >( m_pPainter )->SetStrictFormat( sal_False );
+ // wenn man _irgendeine_ Formatierung zulaesst, kann man da sowieso keine Eingabe-Ueberpruefung
+ // machen (das FormattedField unterstuetzt das sowieso nicht, nur abgeleitete Klassen)
+
+ // von dem Uno-Model den Formatter besorgen
+ // (Ich koennte theoretisch auch ueber den ::com::sun::star::util::NumberFormatter gehen, den mir der Cursor bestimmt
+ // liefern wuerde. Das Problem dabei ist, dass ich mich eigentlich nicht darauf verlassen
+ // kann, dass die beiden Formatter die selben sind, sauber ist das Ganze, wenn ich ueber das
+ // UNO-Model gehe.)
+ sal_Int32 nFormatKey = -1;
+
+ // mal sehen, ob das Model einen hat ...
+ DBG_ASSERT(::comphelper::hasProperty(FM_PROP_FORMATSSUPPLIER, xUnoModel), "DbFormattedField::Init : invalid UNO model !");
+ Any aSupplier( xUnoModel->getPropertyValue(FM_PROP_FORMATSSUPPLIER));
+ if (aSupplier.hasValue())
+ {
+ ::cppu::extractInterface(m_xSupplier, aSupplier);
+ if (m_xSupplier.is())
+ {
+ // wenn wir den Supplier vom Model nehmen, dann auch den Key
+ Any aFmtKey( xUnoModel->getPropertyValue(FM_PROP_FORMATKEY));
+ if (aFmtKey.hasValue())
+ {
+ DBG_ASSERT(aFmtKey.getValueType().getTypeClass() == TypeClass_LONG, "DbFormattedField::Init : invalid format key property (no sal_Int32) !");
+ nFormatKey = ::comphelper::getINT32(aFmtKey);
+ }
+ else
+ {
+ DBG_WARNING("DbFormattedField::Init : my uno-model has no format-key, but a formats supplier !");
+ // the OFormattedModel which we usually are working with ensures that the model has a format key
+ // as soon as the form is loaded. Unfortunally this method here is called from within loaded, too.
+ // So if our LoadListener is called before the LoadListener of the model, this "else case" is
+ // allowed.
+ // Of course our property listener for the FormatKey property will notify us if the prop is changed,
+ // so this here isn't really bad ....
+ nFormatKey = 0;
+ }
+ }
+ }
+
+ // nein ? vielleicht die ::com::sun::star::form::component::Form hinter dem Cursor ?
+ if (!m_xSupplier.is())
+ {
+ Reference< XRowSet > xCursorForm(xCursor, UNO_QUERY);
+ if (xCursorForm.is())
+ { // wenn wir vom Cursor den Formatter nehmen, dann auch den Key vom Feld, an das wir gebunden sind
+ m_xSupplier = getNumberFormats(getRowSetConnection(xCursorForm), sal_False);
+
+ if (m_rColumn.GetField().is())
+ nFormatKey = ::comphelper::getINT32(m_rColumn.GetField()->getPropertyValue(FM_PROP_FORMATKEY));
+ }
+ }
+
+ SvNumberFormatter* pFormatterUsed = NULL;
+ if (m_xSupplier.is())
+ {
+ SvNumberFormatsSupplierObj* pImplmentation = SvNumberFormatsSupplierObj::getImplementation(m_xSupplier);
+ if (pImplmentation)
+ pFormatterUsed = pImplmentation->GetNumberFormatter();
+ else
+ // alles hingfaellig : der Supplier ist vom falschen Typ, dann koennen wir uns auch nicht darauf verlassen, dass
+ // ein Standard-Formatter den (eventuell nicht-Standard-)Key kennt.
+ nFormatKey = -1;
+ }
+
+ // einen Standard-Formatter ...
+ if (pFormatterUsed == NULL)
+ {
+ pFormatterUsed = ((FormattedField*)m_pWindow)->StandardFormatter();
+ DBG_ASSERT(pFormatterUsed != NULL, "DbFormattedField::Init : no standard formatter given by the numeric field !");
+ }
+ // ... und einen Standard-Key
+ if (nFormatKey == -1)
+ nFormatKey = 0;
+
+ m_nKeyType = comphelper::getNumberFormatType(m_xSupplier->getNumberFormats(), nFormatKey);
+
+ ((FormattedField*)m_pWindow)->SetFormatter(pFormatterUsed);
+ ((FormattedField*)m_pPainter)->SetFormatter(pFormatterUsed);
+
+ ((FormattedField*)m_pWindow)->SetFormatKey(nFormatKey);
+ ((FormattedField*)m_pPainter)->SetFormatKey(nFormatKey);
+
+ ((FormattedField*)m_pWindow)->TreatAsNumber(m_rColumn.IsNumeric());
+ ((FormattedField*)m_pPainter)->TreatAsNumber(m_rColumn.IsNumeric());
+
+ // Min- und Max-Werte
+ if (m_rColumn.IsNumeric())
+ {
+ sal_Bool bClearMin = sal_True;
+ if (::comphelper::hasProperty(FM_PROP_EFFECTIVE_MIN, xUnoModel))
+ {
+ Any aMin( xUnoModel->getPropertyValue(FM_PROP_EFFECTIVE_MIN));
+ if (aMin.getValueType().getTypeClass() != TypeClass_VOID)
+ {
+ DBG_ASSERT(aMin.getValueType().getTypeClass() == TypeClass_DOUBLE, "DbFormattedField::Init : the model has an invalid min value !");
+ double dMin = ::comphelper::getDouble(aMin);
+ ((FormattedField*)m_pWindow)->SetMinValue(dMin);
+ ((FormattedField*)m_pPainter)->SetMinValue(dMin);
+ bClearMin = sal_False;
+ }
+ }
+ if (bClearMin)
+ {
+ ((FormattedField*)m_pWindow)->ClearMinValue();
+ ((FormattedField*)m_pPainter)->ClearMinValue();
+ }
+ sal_Bool bClearMax = sal_True;
+ if (::comphelper::hasProperty(FM_PROP_EFFECTIVE_MAX, xUnoModel))
+ {
+ Any aMin( xUnoModel->getPropertyValue(FM_PROP_EFFECTIVE_MAX));
+ if (aMin.getValueType().getTypeClass() != TypeClass_VOID)
+ {
+ DBG_ASSERT(aMin.getValueType().getTypeClass() == TypeClass_DOUBLE, "DbFormattedField::Init : the model has an invalid max value !");
+ double dMin = ::comphelper::getDouble(aMin);
+ ((FormattedField*)m_pWindow)->SetMaxValue(dMin);
+ ((FormattedField*)m_pPainter)->SetMaxValue(dMin);
+ bClearMax = sal_False;
+ }
+ }
+ if (bClearMax)
+ {
+ ((FormattedField*)m_pWindow)->ClearMaxValue();
+ ((FormattedField*)m_pPainter)->ClearMaxValue();
+ }
+ }
+
+ // den Default-Wert
+ Any aDefault( xUnoModel->getPropertyValue(FM_PROP_EFFECTIVE_DEFAULT));
+ if (aDefault.hasValue())
+ { // das Ding kann ein double oder ein String sein
+ switch (aDefault.getValueType().getTypeClass())
+ {
+ case TypeClass_DOUBLE:
+ if (m_rColumn.IsNumeric())
+ {
+ ((FormattedField*)m_pWindow)->SetDefaultValue(::comphelper::getDouble(aDefault));
+ ((FormattedField*)m_pPainter)->SetDefaultValue(::comphelper::getDouble(aDefault));
+ }
+ else
+ {
+ String sConverted;
+ Color* pDummy;
+ pFormatterUsed->GetOutputString(::comphelper::getDouble(aDefault), 0, sConverted, &pDummy);
+ ((FormattedField*)m_pWindow)->SetDefaultText(sConverted);
+ ((FormattedField*)m_pPainter)->SetDefaultText(sConverted);
+ }
+ break;
+ case TypeClass_STRING:
+ {
+ String sDefault( ::comphelper::getString(aDefault) );
+ if (m_rColumn.IsNumeric())
+ {
+ double dVal;
+ sal_uInt32 nTestFormat(0);
+ if (pFormatterUsed->IsNumberFormat(sDefault, nTestFormat, dVal))
+ {
+ ((FormattedField*)m_pWindow)->SetDefaultValue(dVal);
+ ((FormattedField*)m_pPainter)->SetDefaultValue(dVal);
+ }
+ }
+ else
+ {
+ ((FormattedField*)m_pWindow)->SetDefaultText(sDefault);
+ ((FormattedField*)m_pPainter)->SetDefaultText(sDefault);
+ }
+ }
+ default:
+ DBG_ERROR( "DbFormattedField::Init: unexpected value type!" );
+ break;
+ }
+ }
+ DbLimitedLengthField::Init( rParent, xCursor );
+}
+
+//------------------------------------------------------------------------------
+CellControllerRef DbFormattedField::CreateController() const
+{
+ return new ::svt::FormattedFieldCellController( static_cast< FormattedField* >( m_pWindow ) );
+}
+
+//------------------------------------------------------------------------------
+void DbFormattedField::_propertyChanged( const PropertyChangeEvent& _rEvent ) throw( RuntimeException )
+{
+ if (_rEvent.PropertyName.compareTo(FM_PROP_FORMATKEY) == COMPARE_EQUAL)
+ {
+ sal_Int32 nNewKey = _rEvent.NewValue.hasValue() ? ::comphelper::getINT32(_rEvent.NewValue) : 0;
+ m_nKeyType = comphelper::getNumberFormatType(m_xSupplier->getNumberFormats(), nNewKey);
+
+ DBG_ASSERT(m_pWindow && m_pPainter, "DbFormattedField::_propertyChanged : where are my windows ?");
+ if (m_pWindow)
+ static_cast< FormattedField* >( m_pWindow )->SetFormatKey( nNewKey );
+ if (m_pPainter)
+ static_cast< FormattedField* >( m_pPainter )->SetFormatKey( nNewKey );
+ }
+ else
+ {
+ DbLimitedLengthField::_propertyChanged( _rEvent );
+ }
+}
+
+//------------------------------------------------------------------------------
+String DbFormattedField::GetFormatText(const Reference< ::com::sun::star::sdb::XColumn >& _rxField, const Reference< XNumberFormatter >& /*xFormatter*/, Color** ppColor)
+{
+ // defaultmaessig keine Farb-Angabe
+ if (ppColor != NULL)
+ *ppColor = NULL;
+
+ // NULL-Wert -> leerer Text
+ if (!_rxField.is())
+ return String();
+
+ String aText;
+ try
+ {
+ if (m_rColumn.IsNumeric())
+ {
+ // das IsNumeric an der Column sagt nichts aus ueber die Klasse des benutzen Formates, sondern
+ // ueber die des an die Column gebundenen Feldes. Wenn man also eine FormattedField-Spalte an
+ // ein double-Feld bindet und als Text formatiert, liefert m_rColumn.IsNumeric() sal_True. Das heisst
+ // also einfach, dass ich den Inhalt der Variant mittels getDouble abfragen kann, und dann kann
+ // ich den Rest (die Formatierung) dem FormattedField ueberlassen.
+ double dValue = getValue( _rxField, m_rColumn.GetParent().getNullDate() );
+ if (_rxField->wasNull())
+ return aText;
+ ((FormattedField*)m_pPainter)->SetValue(dValue);
+ }
+ else
+ {
+ // Hier kann ich nicht mit einem double arbeiten, da das Feld mir keines liefern kann.
+ // Also einfach den Text vom ::com::sun::star::util::NumberFormatter in die richtige ::com::sun::star::form::component::Form brinden lassen.
+ aText = (const sal_Unicode*)_rxField->getString();
+ if (_rxField->wasNull())
+ return aText;
+ ((FormattedField*)m_pPainter)->SetTextFormatted(aText);
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ aText = m_pPainter->GetText();
+ if (ppColor != NULL)
+ *ppColor = ((FormattedField*)m_pPainter)->GetLastOutputColor();
+
+ return aText;
+}
+
+//------------------------------------------------------------------------------
+void DbFormattedField::UpdateFromField(const Reference< ::com::sun::star::sdb::XColumn >& _rxField, const Reference< XNumberFormatter >& /*xFormatter*/)
+{
+ try
+ {
+ FormattedField* pFormattedWindow = static_cast<FormattedField*>(m_pWindow);
+ if (!_rxField.is())
+ { // NULL-Wert -> leerer Text
+ m_pWindow->SetText(String());
+ }
+ else if (m_rColumn.IsNumeric())
+ {
+ // das IsNumeric an der Column sagt nichts aus ueber die Klasse des benutzen Formates, sondern
+ // ueber die des an die Column gebundenen Feldes. Wenn man also eine FormattedField-Spalte an
+ // ein double-Feld bindet und als Text formatiert, liefert m_rColumn.IsNumeric() sal_True. Das heisst
+ // also einfach, dass ich den Inhalt der Variant mittels getDouble abfragen kann, und dann kann
+ // ich den Rest (die Formatierung) dem FormattedField ueberlassen.
+ double dValue = getValue( _rxField, m_rColumn.GetParent().getNullDate() );
+ if (_rxField->wasNull())
+ m_pWindow->SetText(String());
+ else
+ pFormattedWindow->SetValue(dValue);
+ }
+ else
+ {
+ // Hier kann ich nicht mit einem double arbeiten, da das Feld mir keines liefern kann.
+ // Also einfach den Text vom ::com::sun::star::util::NumberFormatter in die richtige ::com::sun::star::form::component::Form brinden lassen.
+ String sText( _rxField->getString());
+
+ pFormattedWindow->SetTextFormatted( sText );
+ pFormattedWindow->SetSelection( Selection( SELECTION_MAX, SELECTION_MIN ) );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbFormattedField::updateFromModel( Reference< XPropertySet > _rxModel )
+{
+ OSL_ENSURE( _rxModel.is() && m_pWindow, "DbFormattedField::updateFromModel: invalid call!" );
+
+ FormattedField* pFormattedWindow = static_cast< FormattedField* >( m_pWindow );
+
+ ::rtl::OUString sText;
+ Any aValue = _rxModel->getPropertyValue( FM_PROP_EFFECTIVE_VALUE );
+ if ( aValue >>= sText )
+ { // our effective value is transfered as string
+ pFormattedWindow->SetTextFormatted( sText );
+ pFormattedWindow->SetSelection( Selection( SELECTION_MAX, SELECTION_MIN ) );
+ }
+ else
+ {
+ double dValue = 0;
+ aValue >>= dValue;
+ pFormattedWindow->SetValue(dValue);
+ }
+}
+
+//------------------------------------------------------------------------------
+sal_Bool DbFormattedField::commitControl()
+{
+ Any aNewVal;
+ FormattedField& rField = *(FormattedField*)m_pWindow;
+ DBG_ASSERT(&rField == m_pWindow, "DbFormattedField::commitControl : can't work with a window other than my own !");
+ if (m_rColumn.IsNumeric())
+ {
+ if (rField.GetText().Len() != 0)
+ aNewVal <<= rField.GetValue();
+ // ein LeerString wird erst mal standardmaessig als void weitergereicht
+ }
+ else
+ aNewVal <<= ::rtl::OUString(rField.GetTextValue());
+
+ m_rColumn.getModel()->setPropertyValue(FM_PROP_EFFECTIVE_VALUE, aNewVal);
+ return sal_True;
+}
+
+//==============================================================================
+//= DbCheckBox
+//==============================================================================
+//------------------------------------------------------------------------------
+DbCheckBox::DbCheckBox( DbGridColumn& _rColumn )
+ :DbCellControl( _rColumn, sal_True )
+{
+ setAlignedController( sal_False );
+}
+
+namespace
+{
+ void setCheckBoxStyle( Window* _pWindow, bool bMono )
+ {
+ AllSettings aSettings = _pWindow->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ if( bMono )
+ aStyleSettings.SetOptions( aStyleSettings.GetOptions() | STYLE_OPTION_MONO );
+ else
+ aStyleSettings.SetOptions( aStyleSettings.GetOptions() & (~STYLE_OPTION_MONO) );
+ aSettings.SetStyleSettings( aStyleSettings );
+ _pWindow->SetSettings( aSettings );
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbCheckBox::Init( Window& rParent, const Reference< XRowSet >& xCursor )
+{
+ setTransparent( sal_True );
+
+ m_pWindow = new CheckBoxControl( &rParent );
+ m_pPainter = new CheckBoxControl( &rParent );
+
+ m_pWindow->SetPaintTransparent( sal_True );
+ m_pPainter->SetPaintTransparent( sal_True );
+
+ m_pPainter->SetBackground();
+
+ try
+ {
+ Reference< XPropertySet > xModel( m_rColumn.getModel(), UNO_SET_THROW );
+
+ sal_Int16 nStyle = awt::VisualEffect::LOOK3D;
+ OSL_VERIFY( xModel->getPropertyValue( FM_PROP_VISUALEFFECT ) >>= nStyle );
+
+ setCheckBoxStyle( m_pWindow, nStyle == awt::VisualEffect::FLAT );
+ setCheckBoxStyle( m_pPainter, nStyle == awt::VisualEffect::FLAT );
+
+ sal_Bool bTristate = sal_True;
+ OSL_VERIFY( xModel->getPropertyValue( FM_PROP_TRISTATE ) >>= bTristate );
+ static_cast< CheckBoxControl* >( m_pWindow )->GetBox().EnableTriState( bTristate );
+ static_cast< CheckBoxControl* >( m_pPainter )->GetBox().EnableTriState( bTristate );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ DbCellControl::Init( rParent, xCursor );
+}
+
+//------------------------------------------------------------------------------
+CellControllerRef DbCheckBox::CreateController() const
+{
+ return new CheckBoxCellController((CheckBoxControl*)m_pWindow);
+}
+//------------------------------------------------------------------------------
+static void lcl_setCheckBoxState( const Reference< ::com::sun::star::sdb::XColumn >& _rxField,
+ CheckBoxControl* _pCheckBoxControl )
+{
+ TriState eState = STATE_DONTKNOW;
+ if (_rxField.is())
+ {
+ try
+ {
+ sal_Bool bValue = _rxField->getBoolean();
+ if (!_rxField->wasNull())
+ eState = bValue ? STATE_CHECK : STATE_NOCHECK;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ _pCheckBoxControl->GetBox().SetState(eState);
+}
+
+//------------------------------------------------------------------------------
+void DbCheckBox::UpdateFromField(const Reference< ::com::sun::star::sdb::XColumn >& _rxField, const Reference< XNumberFormatter >& /*xFormatter*/)
+{
+ lcl_setCheckBoxState( _rxField, static_cast<CheckBoxControl*>(m_pWindow) );
+}
+
+//------------------------------------------------------------------------------
+void DbCheckBox::PaintFieldToCell(OutputDevice& rDev, const Rectangle& rRect,
+ const Reference< ::com::sun::star::sdb::XColumn >& _rxField,
+ const Reference< XNumberFormatter >& xFormatter)
+{
+ lcl_setCheckBoxState( _rxField, static_cast<CheckBoxControl*>(m_pPainter) );
+ DbCellControl::PaintFieldToCell( rDev, rRect, _rxField, xFormatter );
+}
+
+//------------------------------------------------------------------------------
+void DbCheckBox::updateFromModel( Reference< XPropertySet > _rxModel )
+{
+ OSL_ENSURE( _rxModel.is() && m_pWindow, "DbCheckBox::updateFromModel: invalid call!" );
+
+ sal_Int16 nState = STATE_DONTKNOW;
+ _rxModel->getPropertyValue( FM_PROP_STATE ) >>= nState;
+ static_cast< CheckBoxControl* >( m_pWindow )->GetBox().SetState( static_cast< TriState >( nState ) );
+}
+
+//------------------------------------------------------------------------------
+sal_Bool DbCheckBox::commitControl()
+{
+#if OSL_DEBUG_LEVEL > 0
+ Any aVal = makeAny( (sal_Int16)( static_cast< CheckBoxControl* >( m_pWindow )->GetBox().GetState() ) );
+#endif
+ m_rColumn.getModel()->setPropertyValue( FM_PROP_STATE,
+ makeAny( (sal_Int16)( static_cast< CheckBoxControl* >( m_pWindow )->GetBox().GetState() ) ) );
+ return sal_True;
+}
+
+//------------------------------------------------------------------------------
+XubString DbCheckBox::GetFormatText(const Reference< XColumn >& /*_rxField*/, const Reference< XNumberFormatter >& /*xFormatter*/, Color** /*ppColor*/)
+{
+ return XubString();
+}
+
+//==============================================================================
+//= DbPatternField
+//------------------------------------------------------------------------------
+DbPatternField::DbPatternField( DbGridColumn& _rColumn, const ::comphelper::ComponentContext& _rContext )
+ :DbCellControl( _rColumn )
+ ,m_aContext( _rContext )
+{
+ doPropertyListening( FM_PROP_LITERALMASK );
+ doPropertyListening( FM_PROP_EDITMASK );
+ doPropertyListening( FM_PROP_STRICTFORMAT );
+}
+
+//------------------------------------------------------------------------------
+void DbPatternField::implAdjustGenericFieldSetting( const Reference< XPropertySet >& _rxModel )
+{
+ DBG_ASSERT( m_pWindow, "DbPatternField::implAdjustGenericFieldSetting: not to be called without window!" );
+ DBG_ASSERT( _rxModel.is(), "DbPatternField::implAdjustGenericFieldSetting: invalid model!" );
+ if ( m_pWindow && _rxModel.is() )
+ {
+ ::rtl::OUString aLitMask;
+ ::rtl::OUString aEditMask;
+ sal_Bool bStrict = sal_False;
+
+ _rxModel->getPropertyValue( FM_PROP_LITERALMASK ) >>= aLitMask;
+ _rxModel->getPropertyValue( FM_PROP_EDITMASK ) >>= aEditMask;
+ _rxModel->getPropertyValue( FM_PROP_STRICTFORMAT ) >>= bStrict;
+
+ ByteString aAsciiEditMask( aEditMask.getStr(), RTL_TEXTENCODING_ASCII_US );
+
+ static_cast< PatternField* >( m_pWindow )->SetMask( aAsciiEditMask, aLitMask );
+ static_cast< PatternField* >( m_pPainter )->SetMask( aAsciiEditMask, aLitMask );
+ static_cast< PatternField* >( m_pWindow )->SetStrictFormat( bStrict );
+ static_cast< PatternField* >( m_pPainter )->SetStrictFormat( bStrict );
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbPatternField::Init( Window& rParent, const Reference< XRowSet >& xCursor)
+{
+ m_rColumn.SetAlignmentFromModel(-1);
+
+ m_pWindow = new PatternField( &rParent, 0 );
+ m_pPainter= new PatternField( &rParent, 0 );
+
+ Reference< XPropertySet > xModel( m_rColumn.getModel() );
+ implAdjustGenericFieldSetting( xModel );
+
+ DbCellControl::Init( rParent, xCursor );
+}
+
+//------------------------------------------------------------------------------
+CellControllerRef DbPatternField::CreateController() const
+{
+ return new SpinCellController( static_cast< PatternField* >( m_pWindow ) );
+}
+
+//------------------------------------------------------------------------------
+String DbPatternField::impl_formatText( const String& _rText )
+{
+ m_pPainter->SetText( _rText );
+ static_cast< PatternField* >( m_pPainter )->ReformatAll();
+ return m_pPainter->GetText();
+}
+
+//------------------------------------------------------------------------------
+String DbPatternField::GetFormatText(const Reference< ::com::sun::star::sdb::XColumn >& _rxField, const Reference< XNumberFormatter >& /*xFormatter*/, Color** /*ppColor*/)
+{
+ bool bIsForPaint = _rxField != m_rColumn.GetField();
+ ::std::auto_ptr< ::dbtools::FormattedColumnValue >& rpFormatter = bIsForPaint ? m_pPaintFormatter : m_pValueFormatter;
+
+ if ( !rpFormatter.get() )
+ {
+ DBToolsObjectFactory aFactory;
+ rpFormatter = aFactory.createFormattedColumnValue(
+ m_aContext, getCursor(), Reference< XPropertySet >( _rxField, UNO_QUERY ) );
+ OSL_ENSURE( rpFormatter.get(), "DbPatternField::Init: no value formatter!" );
+ }
+ else
+ OSL_ENSURE( rpFormatter->getColumn() == _rxField, "DbPatternField::GetFormatText: my value formatter is working for another field ...!" );
+ // re-creating the value formatter here everytime would be quite expensive ...
+
+ String sText;
+ if ( rpFormatter.get() )
+ sText = rpFormatter->getFormattedValue();
+
+ return impl_formatText( sText );
+}
+
+//------------------------------------------------------------------------------
+void DbPatternField::UpdateFromField( const Reference< XColumn >& _rxField, const Reference< XNumberFormatter >& _rxFormatter )
+{
+ static_cast< Edit* >( m_pWindow )->SetText( GetFormatText( _rxField, _rxFormatter ) );
+ static_cast< Edit* >( m_pWindow )->SetSelection( Selection( SELECTION_MAX, SELECTION_MIN ) );
+}
+
+//------------------------------------------------------------------------------
+void DbPatternField::updateFromModel( Reference< XPropertySet > _rxModel )
+{
+ OSL_ENSURE( _rxModel.is() && m_pWindow, "DbPatternField::updateFromModel: invalid call!" );
+
+ ::rtl::OUString sText;
+ _rxModel->getPropertyValue( FM_PROP_TEXT ) >>= sText;
+
+ static_cast< Edit* >( m_pWindow )->SetText( impl_formatText( sText ) );
+ static_cast< Edit* >( m_pWindow )->SetSelection( Selection( SELECTION_MAX, SELECTION_MIN ) );
+}
+
+//------------------------------------------------------------------------------
+sal_Bool DbPatternField::commitControl()
+{
+ String aText(m_pWindow->GetText());
+ m_rColumn.getModel()->setPropertyValue(FM_PROP_TEXT, makeAny(::rtl::OUString(aText)));
+ return sal_True;
+}
+
+//==============================================================================
+//= DbSpinField
+//==============================================================================
+//------------------------------------------------------------------------------
+DbSpinField::DbSpinField( DbGridColumn& _rColumn, sal_Int16 _nStandardAlign )
+ :DbCellControl( _rColumn )
+ ,m_nStandardAlign( _nStandardAlign )
+{
+}
+
+//------------------------------------------------------------------------------
+void DbSpinField::Init( Window& _rParent, const Reference< XRowSet >& _rxCursor )
+{
+ m_rColumn.SetAlignmentFromModel( m_nStandardAlign );
+
+ Reference< XPropertySet > xModel( m_rColumn.getModel() );
+
+ // determine the WinBits for the field
+ WinBits nFieldStyle = 0;
+ if ( ::comphelper::getBOOL( xModel->getPropertyValue( FM_PROP_SPIN ) ) )
+ nFieldStyle = WB_REPEAT | WB_SPIN;
+ // create the fields
+ m_pWindow = createField( &_rParent, nFieldStyle, xModel );
+ m_pPainter = createField( &_rParent, nFieldStyle, xModel );
+
+ // adjust all other settings which depend on the property values
+ implAdjustGenericFieldSetting( xModel );
+
+ // call the base class
+ DbCellControl::Init( _rParent, _rxCursor );
+}
+
+//------------------------------------------------------------------------------
+CellControllerRef DbSpinField::CreateController() const
+{
+ return new SpinCellController( static_cast< SpinField* >( m_pWindow ) );
+}
+
+//==============================================================================
+//= DbNumericField
+//==============================================================================
+//------------------------------------------------------------------------------
+DbNumericField::DbNumericField( DbGridColumn& _rColumn )
+ :DbSpinField( _rColumn )
+{
+ doPropertyListening( FM_PROP_DECIMAL_ACCURACY );
+ doPropertyListening( FM_PROP_VALUEMIN );
+ doPropertyListening( FM_PROP_VALUEMAX );
+ doPropertyListening( FM_PROP_VALUESTEP );
+ doPropertyListening( FM_PROP_STRICTFORMAT );
+ doPropertyListening( FM_PROP_SHOWTHOUSANDSEP );
+}
+
+//------------------------------------------------------------------------------
+void DbNumericField::implAdjustGenericFieldSetting( const Reference< XPropertySet >& _rxModel )
+{
+ DBG_ASSERT( m_pWindow, "DbNumericField::implAdjustGenericFieldSetting: not to be called without window!" );
+ DBG_ASSERT( _rxModel.is(), "DbNumericField::implAdjustGenericFieldSetting: invalid model!" );
+ if ( m_pWindow && _rxModel.is() )
+ {
+ sal_Int32 nMin = (sal_Int32)getDouble( _rxModel->getPropertyValue( FM_PROP_VALUEMIN ) );
+ sal_Int32 nMax = (sal_Int32)getDouble( _rxModel->getPropertyValue( FM_PROP_VALUEMAX ) );
+ sal_Int32 nStep = (sal_Int32)getDouble( _rxModel->getPropertyValue( FM_PROP_VALUESTEP ) );
+ sal_Bool bStrict = getBOOL( _rxModel->getPropertyValue( FM_PROP_STRICTFORMAT ) );
+ sal_Int16 nScale = getINT16( _rxModel->getPropertyValue( FM_PROP_DECIMAL_ACCURACY ) );
+ sal_Bool bThousand = getBOOL( _rxModel->getPropertyValue( FM_PROP_SHOWTHOUSANDSEP ) );
+
+ static_cast< DoubleNumericField* >( m_pWindow )->SetMinValue(nMin);
+ static_cast< DoubleNumericField* >( m_pWindow )->SetMaxValue(nMax);
+ static_cast< DoubleNumericField* >( m_pWindow )->SetSpinSize(nStep);
+ static_cast< DoubleNumericField* >( m_pWindow )->SetStrictFormat(bStrict);
+
+ static_cast< DoubleNumericField* >( m_pPainter )->SetMinValue(nMin);
+ static_cast< DoubleNumericField* >( m_pPainter )->SetMaxValue(nMax);
+ static_cast< DoubleNumericField* >( m_pPainter )->SetStrictFormat(bStrict);
+
+
+ // dem Field und dem Painter einen Formatter spendieren
+ // zuerst testen, ob ich von dem Service hinter einer Connection bekommen kann
+ Reference< ::com::sun::star::util::XNumberFormatsSupplier > xSupplier;
+ Reference< XRowSet > xForm;
+ if ( m_rColumn.GetParent().getDataSource() )
+ xForm = Reference< XRowSet >( ( Reference< XInterface > )*m_rColumn.GetParent().getDataSource(), UNO_QUERY );
+ if ( xForm.is() )
+ xSupplier = getNumberFormats( getRowSetConnection( xForm ), sal_True );
+ SvNumberFormatter* pFormatterUsed = NULL;
+ if ( xSupplier.is() )
+ {
+ SvNumberFormatsSupplierObj* pImplmentation = SvNumberFormatsSupplierObj::getImplementation( xSupplier );
+ pFormatterUsed = pImplmentation ? pImplmentation->GetNumberFormatter() : NULL;
+ }
+ if ( NULL == pFormatterUsed )
+ { // der Cursor fuehrte nicht zum Erfolg -> Standard
+ pFormatterUsed = static_cast< DoubleNumericField* >( m_pWindow )->StandardFormatter();
+ DBG_ASSERT( pFormatterUsed != NULL, "DbNumericField::implAdjustGenericFieldSetting: no standard formatter given by the numeric field !" );
+ }
+ static_cast< DoubleNumericField* >( m_pWindow )->SetFormatter( pFormatterUsed );
+ static_cast< DoubleNumericField* >( m_pPainter )->SetFormatter( pFormatterUsed );
+
+ // und dann ein Format generieren, dass die gewuenschten Nachkommastellen usw. hat
+ String sFormatString;
+ LanguageType aAppLanguage = Application::GetSettings().GetUILanguage();
+ pFormatterUsed->GenerateFormat( sFormatString, 0, aAppLanguage, bThousand, sal_False, nScale );
+
+ static_cast< DoubleNumericField* >( m_pWindow )->SetFormat( sFormatString, aAppLanguage );
+ static_cast< DoubleNumericField* >( m_pPainter )->SetFormat( sFormatString, aAppLanguage );
+ }
+}
+
+//------------------------------------------------------------------------------
+SpinField* DbNumericField::createField( Window* _pParent, WinBits _nFieldStyle, const Reference< XPropertySet >& /*_rxModel*/ )
+{
+ return new DoubleNumericField( _pParent, _nFieldStyle );
+}
+
+namespace
+{
+ //--------------------------------------------------------------------------
+ static String lcl_setFormattedNumeric_nothrow( DoubleNumericField& _rField, const DbCellControl& _rControl,
+ const Reference< XColumn >& _rxField, const Reference< XNumberFormatter >& _rxFormatter )
+ {
+ String sValue;
+ if ( _rxField.is() )
+ {
+ try
+ {
+ double fValue = _rControl.GetValue( _rxField, _rxFormatter );
+ if ( !_rxField->wasNull() )
+ {
+ _rField.SetValue( fValue );
+ sValue = _rField.GetText();
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ return sValue;
+ }
+}
+
+//------------------------------------------------------------------------------
+String DbNumericField::GetFormatText(const Reference< ::com::sun::star::sdb::XColumn >& _rxField, const Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter, Color** /*ppColor*/)
+{
+ return lcl_setFormattedNumeric_nothrow( *dynamic_cast< DoubleNumericField* >( m_pPainter ), *this, _rxField, _rxFormatter );
+}
+
+//------------------------------------------------------------------------------
+void DbNumericField::UpdateFromField(const Reference< ::com::sun::star::sdb::XColumn >& _rxField, const Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter)
+{
+ lcl_setFormattedNumeric_nothrow( *dynamic_cast< DoubleNumericField* >( m_pWindow ), *this, _rxField, _rxFormatter );
+}
+
+//------------------------------------------------------------------------------
+void DbNumericField::updateFromModel( Reference< XPropertySet > _rxModel )
+{
+ OSL_ENSURE( _rxModel.is() && m_pWindow, "DbNumericField::updateFromModel: invalid call!" );
+
+ double dValue = 0;
+ if ( _rxModel->getPropertyValue( FM_PROP_VALUE ) >>= dValue )
+ static_cast< DoubleNumericField* >( m_pWindow )->SetValue( dValue );
+ else
+ m_pWindow->SetText( String() );
+}
+
+//------------------------------------------------------------------------------
+sal_Bool DbNumericField::commitControl()
+{
+ String aText( m_pWindow->GetText());
+ Any aVal;
+
+ if (aText.Len() != 0) // nicht null
+ {
+ double fValue = ((DoubleNumericField*)m_pWindow)->GetValue();
+ aVal <<= (double)fValue;
+ }
+ m_rColumn.getModel()->setPropertyValue(FM_PROP_VALUE, aVal);
+ return sal_True;
+}
+
+//==============================================================================
+//= DbCurrencyField
+//==============================================================================
+//------------------------------------------------------------------------------
+DbCurrencyField::DbCurrencyField(DbGridColumn& _rColumn)
+ :DbSpinField( _rColumn )
+ ,m_nScale( 0 )
+{
+ doPropertyListening( FM_PROP_DECIMAL_ACCURACY );
+ doPropertyListening( FM_PROP_VALUEMIN );
+ doPropertyListening( FM_PROP_VALUEMAX );
+ doPropertyListening( FM_PROP_VALUESTEP );
+ doPropertyListening( FM_PROP_STRICTFORMAT );
+ doPropertyListening( FM_PROP_SHOWTHOUSANDSEP );
+ doPropertyListening( FM_PROP_CURRENCYSYMBOL );
+}
+
+//------------------------------------------------------------------------------
+void DbCurrencyField::implAdjustGenericFieldSetting( const Reference< XPropertySet >& _rxModel )
+{
+ DBG_ASSERT( m_pWindow, "DbCurrencyField::implAdjustGenericFieldSetting: not to be called without window!" );
+ DBG_ASSERT( _rxModel.is(), "DbCurrencyField::implAdjustGenericFieldSetting: invalid model!" );
+ if ( m_pWindow && _rxModel.is() )
+ {
+ m_nScale = getINT16( _rxModel->getPropertyValue( FM_PROP_DECIMAL_ACCURACY ) );
+ double nMin = getDouble( _rxModel->getPropertyValue( FM_PROP_VALUEMIN ) );
+ double nMax = getDouble( _rxModel->getPropertyValue( FM_PROP_VALUEMAX ) );
+ double nStep = getDouble( _rxModel->getPropertyValue( FM_PROP_VALUESTEP ) );
+ sal_Bool bStrict = getBOOL( _rxModel->getPropertyValue( FM_PROP_STRICTFORMAT ) );
+ sal_Bool bThousand = getBOOL( _rxModel->getPropertyValue( FM_PROP_SHOWTHOUSANDSEP ) );
+ ::rtl::OUString aStr( getString( _rxModel->getPropertyValue(FM_PROP_CURRENCYSYMBOL ) ) );
+
+ static_cast< LongCurrencyField* >( m_pWindow )->SetUseThousandSep( bThousand );
+ static_cast< LongCurrencyField* >( m_pWindow )->SetDecimalDigits( m_nScale );
+ static_cast< LongCurrencyField* >( m_pWindow )->SetCurrencySymbol( aStr );
+ static_cast< LongCurrencyField* >( m_pWindow )->SetFirst( nMin );
+ static_cast< LongCurrencyField* >( m_pWindow )->SetLast( nMax );
+ static_cast< LongCurrencyField* >( m_pWindow )->SetMin( nMin );
+ static_cast< LongCurrencyField* >( m_pWindow )->SetMax( nMax );
+ static_cast< LongCurrencyField* >( m_pWindow )->SetSpinSize( nStep );
+ static_cast< LongCurrencyField* >( m_pWindow )->SetStrictFormat( bStrict );
+
+ static_cast< LongCurrencyField* >( m_pPainter )->SetUseThousandSep( bThousand );
+ static_cast< LongCurrencyField* >( m_pPainter )->SetDecimalDigits( m_nScale );
+ static_cast< LongCurrencyField* >( m_pPainter )->SetCurrencySymbol( aStr );
+ static_cast< LongCurrencyField* >( m_pPainter )->SetFirst( nMin );
+ static_cast< LongCurrencyField* >( m_pPainter )->SetLast( nMax );
+ static_cast< LongCurrencyField* >( m_pPainter )->SetMin( nMin );
+ static_cast< LongCurrencyField* >( m_pPainter )->SetMax( nMax );
+ static_cast< LongCurrencyField* >( m_pPainter )->SetStrictFormat( bStrict );
+ }
+}
+
+//------------------------------------------------------------------------------
+SpinField* DbCurrencyField::createField( Window* _pParent, WinBits _nFieldStyle, const Reference< XPropertySet >& /*_rxModel*/ )
+{
+ return new LongCurrencyField( _pParent, _nFieldStyle );
+}
+
+//------------------------------------------------------------------------------
+double DbCurrencyField::GetCurrency(const Reference< ::com::sun::star::sdb::XColumn >& _rxField, const Reference< XNumberFormatter >& xFormatter) const
+{
+ double fValue = GetValue(_rxField, xFormatter);
+ if (m_nScale)
+ {
+ // OSL_TRACE("double = %.64f ",fValue);
+ fValue = ::rtl::math::pow10Exp(fValue, m_nScale);
+ fValue = ::rtl::math::round(fValue, 0);
+ }
+ return fValue;
+}
+
+namespace
+{
+ //--------------------------------------------------------------------------
+ static String lcl_setFormattedCurrency_nothrow( LongCurrencyField& _rField, const DbCurrencyField& _rControl,
+ const Reference< XColumn >& _rxField, const Reference< XNumberFormatter >& _rxFormatter )
+ {
+ String sValue;
+ if ( _rxField.is() )
+ {
+ try
+ {
+ double fValue = _rControl.GetCurrency( _rxField, _rxFormatter );
+ if ( !_rxField->wasNull() )
+ {
+ _rField.SetValue( fValue );
+ BigInt aValue = _rField.GetCorrectedValue();
+ sValue = aValue.GetString();
+ sValue = _rField.GetText();
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ return sValue;
+ }
+}
+
+//------------------------------------------------------------------------------
+String DbCurrencyField::GetFormatText(const Reference< ::com::sun::star::sdb::XColumn >& _rxField, const Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter, Color** /*ppColor*/)
+{
+ return lcl_setFormattedCurrency_nothrow( *dynamic_cast< LongCurrencyField* >( m_pPainter ), *this, _rxField, _rxFormatter );
+}
+
+//------------------------------------------------------------------------------
+void DbCurrencyField::UpdateFromField(const Reference< ::com::sun::star::sdb::XColumn >& _rxField, const Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter)
+{
+ lcl_setFormattedCurrency_nothrow( *dynamic_cast< LongCurrencyField* >( m_pWindow ), *this, _rxField, _rxFormatter );
+}
+
+//------------------------------------------------------------------------------
+void DbCurrencyField::updateFromModel( Reference< XPropertySet > _rxModel )
+{
+ OSL_ENSURE( _rxModel.is() && m_pWindow, "DbCurrencyField::updateFromModel: invalid call!" );
+
+ double dValue = 0;
+ if ( _rxModel->getPropertyValue( FM_PROP_VALUE ) >>= dValue )
+ {
+ if ( m_nScale )
+ {
+ dValue = ::rtl::math::pow10Exp( dValue, m_nScale );
+ dValue = ::rtl::math::round(dValue, 0);
+ }
+
+ static_cast< LongCurrencyField* >( m_pWindow )->SetValue( dValue );
+ }
+ else
+ m_pWindow->SetText( String() );
+}
+
+//------------------------------------------------------------------------------
+sal_Bool DbCurrencyField::commitControl()
+{
+ String aText( m_pWindow->GetText());
+ Any aVal;
+ if (aText.Len() != 0) // nicht null
+ {
+ double fValue = ((LongCurrencyField*)m_pWindow)->GetValue();
+ if (m_nScale)
+ {
+ fValue /= ::rtl::math::pow10Exp(1.0, m_nScale);
+ //fValue = ::rtl::math::round(fValue, m_nScale);
+ }
+ aVal <<= (double)fValue;
+ }
+ m_rColumn.getModel()->setPropertyValue(FM_PROP_VALUE, aVal);
+ return sal_True;
+}
+
+//==============================================================================
+//= DbDateField
+//==============================================================================
+//------------------------------------------------------------------------------
+DbDateField::DbDateField( DbGridColumn& _rColumn )
+ :DbSpinField( _rColumn )
+{
+ doPropertyListening( FM_PROP_DATEFORMAT );
+ doPropertyListening( FM_PROP_DATEMIN );
+ doPropertyListening( FM_PROP_DATEMAX );
+ doPropertyListening( FM_PROP_STRICTFORMAT );
+ doPropertyListening( FM_PROP_DATE_SHOW_CENTURY );
+}
+
+//------------------------------------------------------------------------------
+SpinField* DbDateField::createField( Window* _pParent, WinBits _nFieldStyle, const Reference< XPropertySet >& _rxModel )
+{
+ // check if there is a DropDown property set to TRUE
+ sal_Bool bDropDown = !hasProperty( FM_PROP_DROPDOWN, _rxModel )
+ || getBOOL( _rxModel->getPropertyValue( FM_PROP_DROPDOWN ) );
+ if ( bDropDown )
+ _nFieldStyle |= WB_DROPDOWN;
+
+ CalendarField* pField = new CalendarField( _pParent, _nFieldStyle );
+
+ pField->EnableToday();
+ pField->EnableNone();
+
+ return pField;
+}
+
+//------------------------------------------------------------------------------
+void DbDateField::implAdjustGenericFieldSetting( const Reference< XPropertySet >& _rxModel )
+{
+ DBG_ASSERT( m_pWindow, "DbDateField::implAdjustGenericFieldSetting: not to be called without window!" );
+ DBG_ASSERT( _rxModel.is(), "DbDateField::implAdjustGenericFieldSetting: invalid model!" );
+ if ( m_pWindow && _rxModel.is() )
+ {
+ sal_Int16 nFormat = getINT16( _rxModel->getPropertyValue( FM_PROP_DATEFORMAT ) );
+ sal_Int32 nMin = getINT32( _rxModel->getPropertyValue( FM_PROP_DATEMIN ) );
+ sal_Int32 nMax = getINT32( _rxModel->getPropertyValue( FM_PROP_DATEMAX ) );
+ sal_Bool bStrict = getBOOL( _rxModel->getPropertyValue( FM_PROP_STRICTFORMAT ) );
+
+ Any aCentury = _rxModel->getPropertyValue( FM_PROP_DATE_SHOW_CENTURY );
+ if ( aCentury.getValueType().getTypeClass() != TypeClass_VOID )
+ {
+ sal_Bool bShowDateCentury = getBOOL( aCentury );
+
+ static_cast<DateField*>( m_pWindow )->SetShowDateCentury( bShowDateCentury );
+ static_cast<DateField*>( m_pPainter )->SetShowDateCentury( bShowDateCentury );
+ }
+
+ static_cast< DateField* >( m_pWindow )->SetExtDateFormat( (ExtDateFieldFormat)nFormat );
+ static_cast< DateField* >( m_pWindow )->SetMin( nMin );
+ static_cast< DateField* >( m_pWindow )->SetMax( nMax );
+ static_cast< DateField* >( m_pWindow )->SetStrictFormat( bStrict );
+ static_cast< DateField* >( m_pWindow )->EnableEmptyFieldValue( sal_True );
+
+ static_cast< DateField* >( m_pPainter )->SetExtDateFormat( (ExtDateFieldFormat)nFormat );
+ static_cast< DateField* >( m_pPainter )->SetMin( nMin );
+ static_cast< DateField* >( m_pPainter )->SetMax( nMax );
+ static_cast< DateField* >( m_pPainter )->SetStrictFormat( bStrict );
+ static_cast< DateField* >( m_pPainter )->EnableEmptyFieldValue( sal_True );
+ }
+}
+
+namespace
+{
+ //--------------------------------------------------------------------------
+ static String lcl_setFormattedDate_nothrow( DateField& _rField, const Reference< XColumn >& _rxField )
+ {
+ String sDate;
+ if ( _rxField.is() )
+ {
+ try
+ {
+ ::com::sun::star::util::Date aValue = _rxField->getDate();
+ if ( _rxField->wasNull() )
+ _rField.SetText( sDate );
+ else
+ {
+ _rField.SetDate( ::Date( aValue.Day, aValue.Month, aValue.Year ) );
+ sDate = _rField.GetText();
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ return sDate;
+ }
+}
+//------------------------------------------------------------------------------
+String DbDateField::GetFormatText(const Reference< ::com::sun::star::sdb::XColumn >& _rxField, const Reference< ::com::sun::star::util::XNumberFormatter >& /*xFormatter*/, Color** /*ppColor*/)
+{
+ return lcl_setFormattedDate_nothrow( *dynamic_cast< DateField* >( m_pPainter ), _rxField );
+}
+
+//------------------------------------------------------------------------------
+void DbDateField::UpdateFromField(const Reference< ::com::sun::star::sdb::XColumn >& _rxField, const Reference< XNumberFormatter >& /*xFormatter*/)
+{
+ lcl_setFormattedDate_nothrow( *dynamic_cast< DateField* >( m_pWindow ), _rxField );
+}
+
+//------------------------------------------------------------------------------
+void DbDateField::updateFromModel( Reference< XPropertySet > _rxModel )
+{
+ OSL_ENSURE( _rxModel.is() && m_pWindow, "DbDateField::updateFromModel: invalid call!" );
+
+ sal_Int32 nDate = 0;
+ if ( _rxModel->getPropertyValue( FM_PROP_DATE ) >>= nDate )
+ static_cast< DateField* >( m_pWindow )->SetDate( ::Date( nDate ) );
+ else
+ static_cast< DateField* >( m_pWindow )->SetText( String() );
+}
+
+//------------------------------------------------------------------------------
+sal_Bool DbDateField::commitControl()
+{
+ String aText( m_pWindow->GetText());
+ Any aVal;
+ if (aText.Len() != 0)
+ aVal <<= (sal_Int32)static_cast<DateField*>(m_pWindow)->GetDate().GetDate();
+ else
+ aVal.clear();
+
+ m_rColumn.getModel()->setPropertyValue(FM_PROP_DATE, aVal);
+ return sal_True;
+}
+
+//==============================================================================
+//= DbTimeField
+//==============================================================================
+//------------------------------------------------------------------------------
+DbTimeField::DbTimeField( DbGridColumn& _rColumn )
+ :DbSpinField( _rColumn, ::com::sun::star::awt::TextAlign::LEFT )
+{
+ doPropertyListening( FM_PROP_TIMEFORMAT );
+ doPropertyListening( FM_PROP_TIMEMIN );
+ doPropertyListening( FM_PROP_TIMEMAX );
+ doPropertyListening( FM_PROP_STRICTFORMAT );
+}
+
+//------------------------------------------------------------------------------
+SpinField* DbTimeField::createField( Window* _pParent, WinBits _nFieldStyle, const Reference< XPropertySet >& /*_rxModel*/ )
+{
+ return new TimeField( _pParent, _nFieldStyle );
+}
+
+//------------------------------------------------------------------------------
+void DbTimeField::implAdjustGenericFieldSetting( const Reference< XPropertySet >& _rxModel )
+{
+ DBG_ASSERT( m_pWindow, "DbTimeField::implAdjustGenericFieldSetting: not to be called without window!" );
+ DBG_ASSERT( _rxModel.is(), "DbTimeField::implAdjustGenericFieldSetting: invalid model!" );
+ if ( m_pWindow && _rxModel.is() )
+ {
+ sal_Int16 nFormat = getINT16( _rxModel->getPropertyValue( FM_PROP_TIMEFORMAT ) );
+ sal_Int32 nMin = getINT32( _rxModel->getPropertyValue( FM_PROP_TIMEMIN ) );
+ sal_Int32 nMax = getINT32( _rxModel->getPropertyValue( FM_PROP_TIMEMAX ) );
+ sal_Bool bStrict = getBOOL( _rxModel->getPropertyValue( FM_PROP_STRICTFORMAT ) );
+
+ static_cast< TimeField* >( m_pWindow )->SetExtFormat( (ExtTimeFieldFormat)nFormat );
+ static_cast< TimeField* >( m_pWindow )->SetMin( nMin );
+ static_cast< TimeField* >( m_pWindow )->SetMax( nMax );
+ static_cast< TimeField* >( m_pWindow )->SetStrictFormat( bStrict );
+ static_cast< TimeField* >( m_pWindow )->EnableEmptyFieldValue( sal_True );
+
+ static_cast< TimeField* >( m_pPainter )->SetExtFormat( (ExtTimeFieldFormat)nFormat );
+ static_cast< TimeField* >( m_pPainter )->SetMin( nMin );
+ static_cast< TimeField* >( m_pPainter )->SetMax( nMax );
+ static_cast< TimeField* >( m_pPainter )->SetStrictFormat( bStrict );
+ static_cast< TimeField* >( m_pPainter )->EnableEmptyFieldValue( sal_True );
+ }
+}
+
+namespace
+{
+ //--------------------------------------------------------------------------
+ static String lcl_setFormattedTime_nothrow( TimeField& _rField, const Reference< XColumn >& _rxField )
+ {
+ String sTime;
+ if ( _rxField.is() )
+ {
+ try
+ {
+ ::com::sun::star::util::Time aValue = _rxField->getTime();
+ if ( _rxField->wasNull() )
+ _rField.SetText( sTime );
+ else
+ {
+ _rField.SetTime( ::Time( aValue.Hours, aValue.Minutes, aValue.Seconds, aValue.HundredthSeconds ) );
+ sTime = _rField.GetText();
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ return sTime;
+ }
+}
+//------------------------------------------------------------------------------
+String DbTimeField::GetFormatText(const Reference< ::com::sun::star::sdb::XColumn >& _rxField, const Reference< ::com::sun::star::util::XNumberFormatter >& /*xFormatter*/, Color** /*ppColor*/)
+{
+ return lcl_setFormattedTime_nothrow( *static_cast< TimeField* >( m_pPainter ), _rxField );
+}
+
+//------------------------------------------------------------------------------
+void DbTimeField::UpdateFromField(const Reference< ::com::sun::star::sdb::XColumn >& _rxField, const Reference< XNumberFormatter >& /*xFormatter*/)
+{
+ lcl_setFormattedTime_nothrow( *static_cast< TimeField* >( m_pWindow ), _rxField );
+}
+
+//------------------------------------------------------------------------------
+void DbTimeField::updateFromModel( Reference< XPropertySet > _rxModel )
+{
+ OSL_ENSURE( _rxModel.is() && m_pWindow, "DbTimeField::updateFromModel: invalid call!" );
+
+ sal_Int32 nTime = 0;
+ if ( _rxModel->getPropertyValue( FM_PROP_DATE ) >>= nTime )
+ static_cast< TimeField* >( m_pWindow )->SetTime( ::Time( nTime ) );
+ else
+ static_cast< TimeField* >( m_pWindow )->SetText( String() );
+}
+
+//------------------------------------------------------------------------------
+sal_Bool DbTimeField::commitControl()
+{
+ String aText( m_pWindow->GetText());
+ Any aVal;
+ if (aText.Len() != 0)
+ aVal <<= (sal_Int32)static_cast<TimeField*>(m_pWindow)->GetTime().GetTime();
+ else
+ aVal.clear();
+
+ m_rColumn.getModel()->setPropertyValue(FM_PROP_TIME, aVal);
+ return sal_True;
+}
+
+//==============================================================================
+//= DbComboBox
+//==============================================================================
+//------------------------------------------------------------------------------
+DbComboBox::DbComboBox(DbGridColumn& _rColumn)
+ :DbCellControl(_rColumn)
+ ,m_nKeyType(::com::sun::star::util::NumberFormat::UNDEFINED)
+{
+ setAlignedController( sal_False );
+
+ doPropertyListening( FM_PROP_STRINGITEMLIST );
+ doPropertyListening( FM_PROP_LINECOUNT );
+}
+
+//------------------------------------------------------------------------------
+void DbComboBox::_propertyChanged( const PropertyChangeEvent& _rEvent ) throw( RuntimeException )
+{
+ if ( _rEvent.PropertyName.equals( FM_PROP_STRINGITEMLIST ) )
+ {
+ SetList(_rEvent.NewValue);
+ }
+ else
+ {
+ DbCellControl::_propertyChanged( _rEvent ) ;
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbComboBox::SetList(const Any& rItems)
+{
+ ComboBoxControl* pField = (ComboBoxControl*)m_pWindow;
+ pField->Clear();
+
+ ::comphelper::StringSequence aTest;
+ if (rItems >>= aTest)
+ {
+ const ::rtl::OUString* pStrings = aTest.getConstArray();
+ sal_Int32 nItems = aTest.getLength();
+ for (sal_Int32 i = 0; i < nItems; ++i, ++pStrings )
+ pField->InsertEntry(*pStrings, LISTBOX_APPEND);
+
+ // tell the grid control that this controller is invalid and has to be re-initialized
+ invalidatedController();
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbComboBox::implAdjustGenericFieldSetting( const Reference< XPropertySet >& _rxModel )
+{
+ DBG_ASSERT( m_pWindow, "DbComboBox::implAdjustGenericFieldSetting: not to be called without window!" );
+ DBG_ASSERT( _rxModel.is(), "DbComboBox::implAdjustGenericFieldSetting: invalid model!" );
+ if ( m_pWindow && _rxModel.is() )
+ {
+ sal_Int16 nLines = getINT16( _rxModel->getPropertyValue( FM_PROP_LINECOUNT ) );
+ static_cast< ComboBoxControl* >( m_pWindow )->SetDropDownLineCount( nLines );
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbComboBox::Init( Window& rParent, const Reference< XRowSet >& xCursor )
+{
+ m_rColumn.SetAlignmentFromModel(::com::sun::star::awt::TextAlign::LEFT);
+
+ m_pWindow = new ComboBoxControl( &rParent );
+
+ // selection von rechts nach links
+ AllSettings aSettings = m_pWindow->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ aStyleSettings.SetSelectionOptions(
+ aStyleSettings.GetSelectionOptions() | SELECTION_OPTION_SHOWFIRST);
+ aSettings.SetStyleSettings(aStyleSettings);
+ m_pWindow->SetSettings(aSettings, sal_True);
+
+ // some initial properties
+ Reference< XPropertySet > xModel(m_rColumn.getModel());
+ SetList( xModel->getPropertyValue( FM_PROP_STRINGITEMLIST ) );
+ implAdjustGenericFieldSetting( xModel );
+
+ if (m_rColumn.GetParent().getNumberFormatter().is())
+ m_nKeyType = comphelper::getNumberFormatType(m_rColumn.GetParent().getNumberFormatter()->getNumberFormatsSupplier()->getNumberFormats(), m_rColumn.GetKey());
+
+ DbCellControl::Init( rParent, xCursor );
+}
+
+//------------------------------------------------------------------------------
+CellControllerRef DbComboBox::CreateController() const
+{
+ return new ComboBoxCellController((ComboBoxControl*)m_pWindow);
+}
+
+//------------------------------------------------------------------------------
+String DbComboBox::GetFormatText(const Reference< ::com::sun::star::sdb::XColumn >& _rxField, const Reference< XNumberFormatter >& xFormatter, Color** /*ppColor*/)
+{
+ ::rtl::OUString aString;
+ if (_rxField.is())
+ try
+ {
+ aString = getFormattedValue( _rxField, xFormatter, m_rColumn.GetParent().getNullDate(), m_rColumn.GetKey(), m_nKeyType );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return aString;
+}
+
+//------------------------------------------------------------------------------
+void DbComboBox::UpdateFromField(const Reference< ::com::sun::star::sdb::XColumn >& _rxField, const Reference< XNumberFormatter >& xFormatter)
+{
+ m_pWindow->SetText(GetFormatText(_rxField, xFormatter));
+}
+
+//------------------------------------------------------------------------------
+void DbComboBox::updateFromModel( Reference< XPropertySet > _rxModel )
+{
+ OSL_ENSURE( _rxModel.is() && m_pWindow, "DbComboBox::updateFromModel: invalid call!" );
+
+ ::rtl::OUString sText;
+ _rxModel->getPropertyValue( FM_PROP_TEXT ) >>= sText;
+
+ static_cast< ComboBox* >( m_pWindow )->SetText( sText );
+ static_cast< ComboBox* >( m_pWindow )->SetSelection( Selection( SELECTION_MAX, SELECTION_MIN ) );
+}
+
+//------------------------------------------------------------------------------
+sal_Bool DbComboBox::commitControl()
+{
+ String aText( m_pWindow->GetText());
+ m_rColumn.getModel()->setPropertyValue(FM_PROP_TEXT, makeAny(::rtl::OUString(aText)));
+ return sal_True;
+}
+
+//------------------------------------------------------------------------------
+DbListBox::DbListBox(DbGridColumn& _rColumn)
+ :DbCellControl(_rColumn)
+ ,m_bBound(sal_False)
+{
+ setAlignedController( sal_False );
+
+ doPropertyListening( FM_PROP_STRINGITEMLIST );
+ doPropertyListening( FM_PROP_LINECOUNT );
+}
+
+//------------------------------------------------------------------------------
+void DbListBox::_propertyChanged( const ::com::sun::star::beans::PropertyChangeEvent& _rEvent ) throw( RuntimeException )
+{
+ if ( _rEvent.PropertyName.equals( FM_PROP_STRINGITEMLIST ) )
+ {
+ SetList(_rEvent.NewValue);
+ }
+ else
+ {
+ DbCellControl::_propertyChanged( _rEvent ) ;
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbListBox::SetList(const Any& rItems)
+{
+ ListBoxControl* pField = (ListBoxControl*)m_pWindow;
+
+ pField->Clear();
+ m_bBound = sal_False;
+
+ ::comphelper::StringSequence aTest;
+ if (rItems >>= aTest)
+ {
+ const ::rtl::OUString* pStrings = aTest.getConstArray();
+ sal_Int32 nItems = aTest.getLength();
+ if (nItems)
+ {
+ for (sal_Int32 i = 0; i < nItems; ++i, ++pStrings )
+ pField->InsertEntry(*pStrings, LISTBOX_APPEND);
+
+ m_rColumn.getModel()->getPropertyValue(FM_PROP_VALUE_SEQ) >>= m_aValueList;
+ m_bBound = m_aValueList.getLength() > 0;
+
+ // tell the grid control that this controller is invalid and has to be re-initialized
+ invalidatedController();
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbListBox::Init( Window& rParent, const Reference< XRowSet >& xCursor)
+{
+ m_rColumn.SetAlignment(::com::sun::star::awt::TextAlign::LEFT);
+
+ m_pWindow = new ListBoxControl( &rParent );
+
+ // some initial properties
+ Reference< XPropertySet > xModel( m_rColumn.getModel() );
+ SetList( xModel->getPropertyValue( FM_PROP_STRINGITEMLIST ) );
+ implAdjustGenericFieldSetting( xModel );
+
+ DbCellControl::Init( rParent, xCursor );
+}
+
+//------------------------------------------------------------------------------
+void DbListBox::implAdjustGenericFieldSetting( const Reference< XPropertySet >& _rxModel )
+{
+ DBG_ASSERT( m_pWindow, "DbListBox::implAdjustGenericFieldSetting: not to be called without window!" );
+ DBG_ASSERT( _rxModel.is(), "DbListBox::implAdjustGenericFieldSetting: invalid model!" );
+ if ( m_pWindow && _rxModel.is() )
+ {
+ sal_Int16 nLines = getINT16( _rxModel->getPropertyValue( FM_PROP_LINECOUNT ) );
+ static_cast< ListBoxControl* >( m_pWindow )->SetDropDownLineCount( nLines );
+ }
+}
+
+//------------------------------------------------------------------------------
+CellControllerRef DbListBox::CreateController() const
+{
+ return new ListBoxCellController((ListBoxControl*)m_pWindow);
+}
+
+//------------------------------------------------------------------------------
+String DbListBox::GetFormatText(const Reference< ::com::sun::star::sdb::XColumn >& _rxField, const Reference< XNumberFormatter >& /*xFormatter*/, Color** /*ppColor*/)
+{
+ String sText;
+ if ( _rxField.is() )
+ {
+ try
+ {
+ sText = _rxField->getString();
+ if ( m_bBound )
+ {
+ Sequence< sal_Int16 > aPosSeq = ::comphelper::findValue( m_aValueList, sText, sal_True );
+ if ( aPosSeq.getLength() )
+ sText = static_cast<ListBox*>(m_pWindow)->GetEntry(aPosSeq.getConstArray()[0]);
+ else
+ sText = String();
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ return sText;
+}
+
+//------------------------------------------------------------------------------
+void DbListBox::UpdateFromField(const Reference< ::com::sun::star::sdb::XColumn >& _rxField, const Reference< XNumberFormatter >& xFormatter)
+{
+ String sFormattedText( GetFormatText( _rxField, xFormatter ) );
+ if ( sFormattedText.Len() )
+ static_cast< ListBox* >( m_pWindow )->SelectEntry( sFormattedText );
+ else
+ static_cast< ListBox* >( m_pWindow )->SetNoSelection();
+}
+
+//------------------------------------------------------------------------------
+void DbListBox::updateFromModel( Reference< XPropertySet > _rxModel )
+{
+ OSL_ENSURE( _rxModel.is() && m_pWindow, "DbListBox::updateFromModel: invalid call!" );
+
+ Sequence< sal_Int16 > aSelection;
+ _rxModel->getPropertyValue( FM_PROP_SELECT_SEQ );
+
+ sal_Int16 nSelection = -1;
+ if ( aSelection.getLength() > 0 )
+ nSelection = aSelection[ 0 ];
+
+ ListBox* pListBox = static_cast< ListBox* >( m_pWindow );
+
+ if ( ( nSelection >= 0 ) && ( nSelection < pListBox->GetEntryCount() ) )
+ pListBox->SelectEntryPos( nSelection );
+ else
+ pListBox->SetNoSelection( );
+}
+
+//------------------------------------------------------------------------------
+sal_Bool DbListBox::commitControl()
+{
+ Any aVal;
+ Sequence<sal_Int16> aSelectSeq;
+ if (static_cast<ListBox*>(m_pWindow)->GetSelectEntryCount())
+ {
+ aSelectSeq.realloc(1);
+ *(sal_Int16 *)aSelectSeq.getArray() = (sal_Int16)static_cast<ListBox*>(m_pWindow)->GetSelectEntryPos();
+ }
+ aVal <<= aSelectSeq;
+ m_rColumn.getModel()->setPropertyValue(FM_PROP_SELECT_SEQ, aVal);
+ return sal_True;
+}
+
+
+DBG_NAME(DbFilterField);
+/*************************************************************************/
+DbFilterField::DbFilterField(const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,DbGridColumn& _rColumn)
+ :DbCellControl(_rColumn)
+ ,OSQLParserClient(_rxORB)
+ ,m_nControlClass(::com::sun::star::form::FormComponentType::TEXTFIELD)
+ ,m_bFilterList(sal_False)
+ ,m_bFilterListFilled(sal_False)
+ ,m_bBound(sal_False)
+{
+ DBG_CTOR(DbFilterField,NULL);
+
+ setAlignedController( sal_False );
+}
+
+//------------------------------------------------------------------------------
+DbFilterField::~DbFilterField()
+{
+ if (m_nControlClass == ::com::sun::star::form::FormComponentType::CHECKBOX)
+ ((CheckBoxControl*)m_pWindow)->SetClickHdl( Link() );
+
+ DBG_DTOR(DbFilterField,NULL);
+}
+
+//------------------------------------------------------------------------------
+void DbFilterField::PaintCell(OutputDevice& rDev, const Rectangle& rRect)
+{
+ static sal_uInt16 nStyle = TEXT_DRAW_CLIP | TEXT_DRAW_VCENTER | TEXT_DRAW_LEFT;
+ switch (m_nControlClass)
+ {
+ case FormComponentType::CHECKBOX:
+ DbCellControl::PaintCell( rDev, rRect );
+ break;
+ case FormComponentType::LISTBOX:
+ rDev.DrawText(rRect, static_cast<ListBox*>(m_pWindow)->GetSelectEntry(), nStyle);
+ break;
+ default:
+ rDev.DrawText(rRect, m_aText, nStyle);
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbFilterField::SetList(const Any& rItems, sal_Bool bComboBox)
+{
+ ::comphelper::StringSequence aTest;
+ rItems >>= aTest;
+ const ::rtl::OUString* pStrings = aTest.getConstArray();
+ sal_Int32 nItems = aTest.getLength();
+ if (nItems)
+ {
+ if (bComboBox)
+ {
+ ComboBox* pField = (ComboBox*)m_pWindow;
+ for (sal_Int32 i = 0; i < nItems; ++i, ++pStrings )
+ pField->InsertEntry(*pStrings, LISTBOX_APPEND);
+ }
+ else
+ {
+ ListBox* pField = (ListBox*)m_pWindow;
+ for (sal_Int32 i = 0; i < nItems; ++i, ++pStrings )
+ pField->InsertEntry(*pStrings, LISTBOX_APPEND);
+
+ m_rColumn.getModel()->getPropertyValue(FM_PROP_VALUE_SEQ) >>= m_aValueList;
+ m_bBound = m_aValueList.getLength() > 0;
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbFilterField::CreateControl(Window* pParent, const Reference< ::com::sun::star::beans::XPropertySet >& xModel)
+{
+ switch (m_nControlClass)
+ {
+ case ::com::sun::star::form::FormComponentType::CHECKBOX:
+ m_pWindow = new CheckBoxControl(pParent);
+ m_pWindow->SetPaintTransparent( sal_True );
+ ((CheckBoxControl*)m_pWindow)->SetClickHdl( LINK( this, DbFilterField, OnClick ) );
+
+ m_pPainter = new CheckBoxControl(pParent);
+ m_pPainter->SetPaintTransparent( sal_True );
+ m_pPainter->SetBackground();
+ break;
+ case ::com::sun::star::form::FormComponentType::LISTBOX:
+ {
+ m_pWindow = new ListBoxControl(pParent);
+ sal_Int16 nLines = ::comphelper::getINT16(xModel->getPropertyValue(FM_PROP_LINECOUNT));
+ Any aItems = xModel->getPropertyValue(FM_PROP_STRINGITEMLIST);
+ SetList(aItems, m_nControlClass == ::com::sun::star::form::FormComponentType::COMBOBOX);
+ static_cast<ListBox*>(m_pWindow)->SetDropDownLineCount(nLines);
+ } break;
+ case ::com::sun::star::form::FormComponentType::COMBOBOX:
+ {
+ m_pWindow = new ComboBoxControl(pParent);
+
+ AllSettings aSettings = m_pWindow->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ aStyleSettings.SetSelectionOptions(
+ aStyleSettings.GetSelectionOptions() | SELECTION_OPTION_SHOWFIRST);
+ aSettings.SetStyleSettings(aStyleSettings);
+ m_pWindow->SetSettings(aSettings, sal_True);
+
+ if (!m_bFilterList)
+ {
+ sal_Int16 nLines = ::comphelper::getINT16(xModel->getPropertyValue(FM_PROP_LINECOUNT));
+ Any aItems = xModel->getPropertyValue(FM_PROP_STRINGITEMLIST);
+ SetList(aItems, m_nControlClass == ::com::sun::star::form::FormComponentType::COMBOBOX);
+ ((ComboBox*)m_pWindow)->SetDropDownLineCount(nLines);
+ }
+ else
+ ((ComboBox*)m_pWindow)->SetDropDownLineCount(5);
+
+ } break;
+ default:
+ {
+ m_pWindow = new Edit(pParent, WB_LEFT);
+ AllSettings aSettings = m_pWindow->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ aStyleSettings.SetSelectionOptions(
+ aStyleSettings.GetSelectionOptions() | SELECTION_OPTION_SHOWFIRST);
+ aSettings.SetStyleSettings(aStyleSettings);
+ m_pWindow->SetSettings(aSettings, sal_True);
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbFilterField::Init( Window& rParent, const Reference< XRowSet >& xCursor )
+{
+ Reference< ::com::sun::star::beans::XPropertySet > xModel(m_rColumn.getModel());
+ m_rColumn.SetAlignment(::com::sun::star::awt::TextAlign::LEFT);
+
+ if (xModel.is())
+ {
+ m_bFilterList = ::comphelper::hasProperty(FM_PROP_FILTERPROPOSAL, xModel) && ::comphelper::getBOOL(xModel->getPropertyValue(FM_PROP_FILTERPROPOSAL));
+ if (m_bFilterList)
+ m_nControlClass = ::com::sun::star::form::FormComponentType::COMBOBOX;
+ else
+ {
+ sal_Int16 nClassId = ::comphelper::getINT16(xModel->getPropertyValue(FM_PROP_CLASSID));
+ switch (nClassId)
+ {
+ case FormComponentType::CHECKBOX:
+ case FormComponentType::LISTBOX:
+ case FormComponentType::COMBOBOX:
+ m_nControlClass = nClassId;
+ break;
+ default:
+ if (m_bFilterList)
+ m_nControlClass = FormComponentType::COMBOBOX;
+ else
+ m_nControlClass = FormComponentType::TEXTFIELD;
+ }
+ }
+ }
+
+ CreateControl( &rParent, xModel );
+ DbCellControl::Init( rParent, xCursor );
+
+ // filter cells are never readonly
+ // 31.07.2002 - 101584 - fs@openoffice.org
+ Edit* pAsEdit = dynamic_cast< Edit* >( m_pWindow );
+ if ( pAsEdit )
+ pAsEdit->SetReadOnly( sal_False );
+}
+
+//------------------------------------------------------------------------------
+CellControllerRef DbFilterField::CreateController() const
+{
+ CellControllerRef xController;
+ switch (m_nControlClass)
+ {
+ case ::com::sun::star::form::FormComponentType::CHECKBOX:
+ xController = new CheckBoxCellController((CheckBoxControl*)m_pWindow);
+ break;
+ case ::com::sun::star::form::FormComponentType::LISTBOX:
+ xController = new ListBoxCellController((ListBoxControl*)m_pWindow);
+ break;
+ case ::com::sun::star::form::FormComponentType::COMBOBOX:
+ xController = new ComboBoxCellController((ComboBoxControl*)m_pWindow);
+ break;
+ default:
+ if (m_bFilterList)
+ xController = new ComboBoxCellController((ComboBoxControl*)m_pWindow);
+ else
+ xController = new EditCellController((Edit*)m_pWindow);
+ }
+ return xController;
+}
+
+//------------------------------------------------------------------------------
+void DbFilterField::updateFromModel( Reference< XPropertySet > _rxModel )
+{
+ OSL_ENSURE( _rxModel.is() && m_pWindow, "DbFilterField::updateFromModel: invalid call!" );
+ (void)_rxModel;
+
+ OSL_ENSURE( sal_False, "DbListBox::updateFromModel: not implemented yet (how the hell did you reach this?)!" );
+ // TODO: implement this.
+ // remember: updateFromModel should be some kind of opposite of commitControl
+}
+
+//------------------------------------------------------------------------------
+sal_Bool DbFilterField::commitControl()
+{
+ String aText(m_aText);
+ switch (m_nControlClass)
+ {
+ case ::com::sun::star::form::FormComponentType::CHECKBOX:
+ return sal_True;
+ case ::com::sun::star::form::FormComponentType::LISTBOX:
+ aText.Erase();
+ if (static_cast<ListBox*>(m_pWindow)->GetSelectEntryCount())
+ {
+ sal_Int16 nPos = (sal_Int16)static_cast<ListBox*>(m_pWindow)->GetSelectEntryPos();
+ if ( ( nPos >= 0 ) && ( nPos < m_aValueList.getLength() ) )
+ aText = (const sal_Unicode*)m_aValueList.getConstArray()[nPos];
+ }
+
+ if (m_aText != aText)
+ {
+ m_aText = aText;
+ m_aCommitLink.Call(this);
+ }
+ return sal_True;
+ default:
+ aText = m_pWindow->GetText();
+ }
+
+ if (m_aText != aText)
+ {
+ // check the text with the SQL-Parser
+ String aNewText(aText);
+ aNewText.EraseTrailingChars();
+ if (aNewText.Len() != 0)
+ {
+ ::rtl::OUString aErrorMsg;
+ Reference< XNumberFormatter > xNumberFormatter(m_rColumn.GetParent().getNumberFormatter());
+
+ ::rtl::Reference< ISQLParseNode > xParseNode = predicateTree(aErrorMsg, aNewText,xNumberFormatter, m_rColumn.GetField());
+ if (xParseNode.is())
+ {
+ ::rtl::OUString aPreparedText;
+
+ ::com::sun::star::lang::Locale aAppLocale = Application::GetSettings().GetUILocale();
+
+ Reference< XRowSet > xDataSourceRowSet(
+ (Reference< XInterface >)*m_rColumn.GetParent().getDataSource(), UNO_QUERY);
+ Reference< XConnection > xConnection(getRowSetConnection(xDataSourceRowSet));
+
+ xParseNode->parseNodeToPredicateStr(aPreparedText,
+ xConnection,
+ xNumberFormatter,
+ m_rColumn.GetField(),aAppLocale,'.',
+ getParseContext());
+ m_aText = aPreparedText;
+ }
+ else
+ {
+ // display the error and return sal_False
+ String aTitle( SVX_RES(RID_STR_SYNTAXERROR) );
+
+ SQLException aError;
+ aError.Message = aErrorMsg;
+ displayException(aError, m_pWindow->GetParent());
+ // TODO: transport the title
+
+ return sal_False;
+ }
+ }
+ else
+ m_aText = aText;
+
+ m_pWindow->SetText(m_aText);
+ m_aCommitLink.Call(this);
+ }
+ return sal_True;
+}
+
+//------------------------------------------------------------------------------
+void DbFilterField::SetText(const String& rText)
+{
+ m_aText = rText;
+ switch (m_nControlClass)
+ {
+ case ::com::sun::star::form::FormComponentType::CHECKBOX:
+ {
+ TriState eState;
+ if (rText.EqualsAscii("1"))
+ eState = STATE_CHECK;
+ else if (rText.EqualsAscii("0"))
+ eState = STATE_NOCHECK;
+ else
+ eState = STATE_DONTKNOW;
+
+ ((CheckBoxControl*)m_pWindow)->GetBox().SetState(eState);
+ ((CheckBoxControl*)m_pPainter)->GetBox().SetState(eState);
+ } break;
+ case ::com::sun::star::form::FormComponentType::LISTBOX:
+ {
+ String aText;
+ Sequence<sal_Int16> aPosSeq = ::comphelper::findValue(m_aValueList, m_aText, sal_True);
+ if (aPosSeq.getLength())
+ static_cast<ListBox*>(m_pWindow)->SelectEntryPos(aPosSeq.getConstArray()[0], sal_True);
+ else
+ static_cast<ListBox*>(m_pWindow)->SetNoSelection();
+ } break;
+ default:
+ m_pWindow->SetText(m_aText);
+ }
+
+ // now force a repaint on the window
+ m_rColumn.GetParent().RowModified(0,m_rColumn.GetId());
+}
+
+//------------------------------------------------------------------------------
+void DbFilterField::Update()
+{
+ // should we fill the combobox with a filter proposal?
+ if (m_bFilterList && !m_bFilterListFilled)
+ {
+ m_bFilterListFilled = sal_True;
+ Reference< ::com::sun::star::beans::XPropertySet > xField = m_rColumn.GetField();
+ if (!xField.is())
+ return;
+
+ ::rtl::OUString aName;
+ xField->getPropertyValue(FM_PROP_NAME) >>= aName;
+
+ // the columnmodel
+ Reference< ::com::sun::star::container::XChild > xModelAsChild(m_rColumn.getModel(), UNO_QUERY);
+ // the grid model
+ xModelAsChild = Reference< ::com::sun::star::container::XChild > (xModelAsChild->getParent(),UNO_QUERY);
+ Reference< XRowSet > xForm(xModelAsChild->getParent(), UNO_QUERY);
+ if (!xForm.is())
+ return;
+
+ Reference<XPropertySet> xFormProp(xForm,UNO_QUERY);
+ Reference< XTablesSupplier > xSupTab;
+ xFormProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SingleSelectQueryComposer"))) >>= xSupTab;
+
+ Reference< XConnection > xConnection(getRowSetConnection(xForm));
+ if (!xSupTab.is())
+ return;
+
+ // search the field
+ Reference< XColumnsSupplier > xSupCol(xSupTab,UNO_QUERY);
+ Reference< ::com::sun::star::container::XNameAccess > xFieldNames = xSupCol->getColumns();
+ if (!xFieldNames->hasByName(aName))
+ return;
+
+ Reference< ::com::sun::star::container::XNameAccess > xTablesNames = xSupTab->getTables();
+ Reference< ::com::sun::star::beans::XPropertySet > xComposerFieldAsSet(xFieldNames->getByName(aName),UNO_QUERY);
+
+ if (xComposerFieldAsSet.is() && ::comphelper::hasProperty(FM_PROP_TABLENAME, xComposerFieldAsSet) &&
+ ::comphelper::hasProperty(FM_PROP_FIELDSOURCE, xComposerFieldAsSet))
+ {
+ ::rtl::OUString aFieldName;
+ ::rtl::OUString aTableName;
+ xComposerFieldAsSet->getPropertyValue(FM_PROP_FIELDSOURCE) >>= aFieldName;
+ xComposerFieldAsSet->getPropertyValue(FM_PROP_TABLENAME) >>= aTableName;
+
+ // no possibility to create a select statement
+ // looking for the complete table name
+ if (!xTablesNames->hasByName(aTableName))
+ return;
+
+ // ein Statement aufbauen und abschicken als query
+ // Access to the connection
+ Reference< XStatement > xStatement;
+ Reference< XResultSet > xListCursor;
+ Reference< ::com::sun::star::sdb::XColumn > xDataField;
+
+ try
+ {
+ Reference< XDatabaseMetaData > xMeta = xConnection->getMetaData();
+
+ String aQuote( xMeta->getIdentifierQuoteString());
+ String aStatement;
+ aStatement.AssignAscii("SELECT DISTINCT ");
+
+ aStatement += String(quoteName(aQuote, aName));
+ if (aFieldName.getLength() && aName != aFieldName)
+ {
+ aStatement.AppendAscii(" AS ");
+ aStatement += quoteName(aQuote, aFieldName).getStr();
+ }
+
+ aStatement.AppendAscii(" FROM ");
+
+ Reference< XPropertySet > xTableNameAccess( xTablesNames->getByName(aTableName), UNO_QUERY_THROW );
+ aStatement += composeTableNameForSelect( xConnection, xTableNameAccess ).getStr();
+
+ xStatement = xConnection->createStatement();
+ Reference< ::com::sun::star::beans::XPropertySet > xStatementProps(xStatement, UNO_QUERY);
+ xStatementProps->setPropertyValue(FM_PROP_ESCAPE_PROCESSING, makeAny((sal_Bool)sal_True));
+
+ xListCursor = xStatement->executeQuery(aStatement);
+
+ Reference< ::com::sun::star::sdbcx::XColumnsSupplier > xSupplyCols(xListCursor, UNO_QUERY);
+ Reference< ::com::sun::star::container::XIndexAccess > xFields(xSupplyCols->getColumns(), UNO_QUERY);
+ ::cppu::extractInterface(xDataField, xFields->getByIndex(0));
+ if (!xDataField.is())
+ return;
+ }
+ catch(const Exception&)
+ {
+ ::comphelper::disposeComponent(xStatement);
+ return;
+ }
+
+ sal_Int16 i = 0;
+ ::std::vector< ::rtl::OUString > aStringList;
+ aStringList.reserve(16);
+ ::rtl::OUString aStr;
+ com::sun::star::util::Date aNullDate = m_rColumn.GetParent().getNullDate();
+ sal_Int32 nFormatKey = m_rColumn.GetKey();
+ Reference< XNumberFormatter > xFormatter = m_rColumn.GetParent().getNumberFormatter();
+ sal_Int16 nKeyType = ::comphelper::getNumberFormatType(xFormatter->getNumberFormatsSupplier()->getNumberFormats(), nFormatKey);
+
+ while (!xListCursor->isAfterLast() && i++ < SHRT_MAX) // max anzahl eintraege
+ {
+ aStr = getFormattedValue(xDataField, xFormatter, aNullDate, nFormatKey, nKeyType);
+ aStringList.push_back(aStr);
+ xListCursor->next();
+ }
+
+ // filling the entries for the combobox
+ for (::std::vector< ::rtl::OUString >::const_iterator iter = aStringList.begin();
+ iter != aStringList.end(); ++iter)
+ ((ComboBox*)m_pWindow)->InsertEntry(*iter, LISTBOX_APPEND);
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+XubString DbFilterField::GetFormatText(const Reference< XColumn >& /*_rxField*/, const Reference< XNumberFormatter >& /*xFormatter*/, Color** /*ppColor*/)
+{
+ return XubString();
+}
+
+//------------------------------------------------------------------
+void DbFilterField::UpdateFromField(const Reference< XColumn >& /*_rxField*/, const Reference< XNumberFormatter >& /*xFormatter*/)
+{
+ DBG_ERROR( "DbFilterField::UpdateFromField: cannot update a filter control from a field!" );
+}
+
+//------------------------------------------------------------------
+IMPL_LINK( DbFilterField, OnClick, void*, EMPTYARG )
+{
+ TriState eState = ((CheckBoxControl*)m_pWindow)->GetBox().GetState();
+ String aText;
+
+ switch (eState)
+ {
+ case STATE_CHECK:
+ aText.AssignAscii("1");
+ break;
+ case STATE_NOCHECK:
+ aText.AssignAscii("0");
+ break;
+ case STATE_DONTKNOW:
+ aText = String();
+ break;
+ }
+
+ if (m_aText != aText)
+ {
+ m_aText = aText;
+ m_aCommitLink.Call(this);
+ }
+ return 1;
+}
+
+/*************************************************************************/
+TYPEINIT0(FmXGridCell);
+
+
+DBG_NAME(FmXGridCell);
+//-----------------------------------------------------------------------------
+FmXGridCell::FmXGridCell( DbGridColumn* pColumn, DbCellControl* _pControl )
+ :OComponentHelper(m_aMutex)
+ ,m_pColumn(pColumn)
+ ,m_pCellControl( _pControl )
+ ,m_aWindowListeners( m_aMutex )
+ ,m_aFocusListeners( m_aMutex )
+ ,m_aKeyListeners( m_aMutex )
+ ,m_aMouseListeners( m_aMutex )
+ ,m_aMouseMotionListeners( m_aMutex )
+{
+ DBG_CTOR(FmXGridCell,NULL);
+}
+
+//-----------------------------------------------------------------------------
+void FmXGridCell::init()
+{
+ Window* pEventWindow( getEventWindow() );
+ if ( pEventWindow )
+ pEventWindow->AddEventListener( LINK( this, FmXGridCell, OnWindowEvent ) );
+}
+
+//-----------------------------------------------------------------------------
+Window* FmXGridCell::getEventWindow() const
+{
+ if ( m_pCellControl )
+ return &m_pCellControl->GetWindow();
+ return NULL;
+}
+
+//-----------------------------------------------------------------------------
+FmXGridCell::~FmXGridCell()
+{
+ if (!OComponentHelper::rBHelper.bDisposed)
+ {
+ acquire();
+ dispose();
+ }
+
+ DBG_DTOR(FmXGridCell,NULL);
+}
+
+//------------------------------------------------------------------
+void FmXGridCell::SetTextLineColor()
+{
+ if (m_pCellControl)
+ m_pCellControl->SetTextLineColor();
+}
+
+//------------------------------------------------------------------
+void FmXGridCell::SetTextLineColor(const Color& _rColor)
+{
+ if (m_pCellControl)
+ m_pCellControl->SetTextLineColor(_rColor);
+}
+
+// XTypeProvider
+//------------------------------------------------------------------
+Sequence< Type > SAL_CALL FmXGridCell::getTypes( ) throw (RuntimeException)
+{
+ Sequence< uno::Type > aTypes = ::comphelper::concatSequences(
+ ::cppu::OComponentHelper::getTypes(),
+ FmXGridCell_Base::getTypes()
+ );
+ if ( m_pCellControl )
+ aTypes = ::comphelper::concatSequences(
+ aTypes,
+ FmXGridCell_WindowBase::getTypes()
+ );
+ return aTypes;
+}
+
+//------------------------------------------------------------------
+IMPLEMENT_GET_IMPLEMENTATION_ID( FmXGridCell )
+
+// OComponentHelper
+//-----------------------------------------------------------------------------
+void FmXGridCell::disposing()
+{
+ lang::EventObject aEvent( *this );
+ m_aWindowListeners.disposeAndClear( aEvent );
+ m_aFocusListeners.disposeAndClear( aEvent );
+ m_aKeyListeners.disposeAndClear( aEvent );
+ m_aMouseListeners.disposeAndClear( aEvent );
+ m_aMouseMotionListeners.disposeAndClear( aEvent );
+
+ OComponentHelper::disposing();
+ m_pColumn = NULL;
+ DELETEZ(m_pCellControl);
+}
+
+//------------------------------------------------------------------
+Any SAL_CALL FmXGridCell::queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(RuntimeException)
+{
+ Any aReturn = OComponentHelper::queryAggregation( _rType );
+
+ if ( !aReturn.hasValue() )
+ aReturn = FmXGridCell_Base::queryInterface( _rType );
+
+ if ( !aReturn.hasValue() && ( m_pCellControl != NULL ) )
+ aReturn = FmXGridCell_WindowBase::queryInterface( _rType );
+
+ return aReturn;
+}
+
+// ::com::sun::star::awt::XControl
+//-----------------------------------------------------------------------------
+Reference< XInterface > FmXGridCell::getContext() throw( RuntimeException )
+{
+ return Reference< XInterface > ();
+}
+
+//-----------------------------------------------------------------------------
+Reference< ::com::sun::star::awt::XControlModel > FmXGridCell::getModel() throw( ::com::sun::star::uno::RuntimeException )
+{
+ return Reference< ::com::sun::star::awt::XControlModel > (m_pColumn->getModel(), UNO_QUERY);
+}
+
+// ::com::sun::star::form::XBoundControl
+//------------------------------------------------------------------
+sal_Bool FmXGridCell::getLock() throw( RuntimeException )
+{
+ return m_pColumn->isLocked();
+}
+
+//------------------------------------------------------------------
+void FmXGridCell::setLock(sal_Bool _bLock) throw( RuntimeException )
+{
+ if (getLock() == _bLock)
+ return;
+ else
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ m_pColumn->setLock(_bLock);
+ }
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXGridCell::setPosSize( ::sal_Int32 _XX, ::sal_Int32 _Y, ::sal_Int32 _Width, ::sal_Int32 _Height, ::sal_Int16 _Flags ) throw (RuntimeException)
+{
+ OSL_ENSURE( false, "FmXGridCell::setPosSize: not implemented" );
+ (void)_XX;
+ (void)_Y;
+ (void)_Width;
+ (void)_Height;
+ (void)_Flags;
+ // not allowed to tamper with this for a grid cell
+}
+
+//------------------------------------------------------------------
+awt::Rectangle SAL_CALL FmXGridCell::getPosSize( ) throw (RuntimeException)
+{
+ OSL_ENSURE( false, "FmXGridCell::getPosSize: not implemented" );
+ return awt::Rectangle();
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXGridCell::setVisible( ::sal_Bool _Visible ) throw (RuntimeException)
+{
+ OSL_ENSURE( false, "FmXGridCell::setVisible: not implemented" );
+ (void)_Visible;
+ // not allowed to tamper with this for a grid cell
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXGridCell::setEnable( ::sal_Bool _Enable ) throw (RuntimeException)
+{
+ OSL_ENSURE( false, "FmXGridCell::setEnable: not implemented" );
+ (void)_Enable;
+ // not allowed to tamper with this for a grid cell
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXGridCell::setFocus( ) throw (RuntimeException)
+{
+ OSL_ENSURE( false, "FmXGridCell::setFocus: not implemented" );
+ // not allowed to tamper with this for a grid cell
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXGridCell::addWindowListener( const Reference< awt::XWindowListener >& _rxListener ) throw (RuntimeException)
+{
+ m_aWindowListeners.addInterface( _rxListener );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXGridCell::removeWindowListener( const Reference< awt::XWindowListener >& _rxListener ) throw (RuntimeException)
+{
+ m_aWindowListeners.removeInterface( _rxListener );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXGridCell::addFocusListener( const Reference< awt::XFocusListener >& _rxListener ) throw (RuntimeException)
+{
+ m_aFocusListeners.addInterface( _rxListener );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXGridCell::removeFocusListener( const Reference< awt::XFocusListener >& _rxListener ) throw (RuntimeException)
+{
+ m_aFocusListeners.removeInterface( _rxListener );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXGridCell::addKeyListener( const Reference< awt::XKeyListener >& _rxListener ) throw (RuntimeException)
+{
+ m_aKeyListeners.addInterface( _rxListener );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXGridCell::removeKeyListener( const Reference< awt::XKeyListener >& _rxListener ) throw (RuntimeException)
+{
+ m_aKeyListeners.removeInterface( _rxListener );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXGridCell::addMouseListener( const Reference< awt::XMouseListener >& _rxListener ) throw (RuntimeException)
+{
+ m_aMouseListeners.addInterface( _rxListener );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXGridCell::removeMouseListener( const Reference< awt::XMouseListener >& _rxListener ) throw (RuntimeException)
+{
+ m_aMouseListeners.removeInterface( _rxListener );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXGridCell::addMouseMotionListener( const Reference< awt::XMouseMotionListener >& _rxListener ) throw (RuntimeException)
+{
+ m_aMouseMotionListeners.addInterface( _rxListener );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXGridCell::removeMouseMotionListener( const Reference< awt::XMouseMotionListener >& _rxListener ) throw (RuntimeException)
+{
+ m_aMouseMotionListeners.removeInterface( _rxListener );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXGridCell::addPaintListener( const Reference< awt::XPaintListener >& _rxListener ) throw (RuntimeException)
+{
+ OSL_ENSURE( false, "FmXGridCell::addPaintListener: not implemented" );
+ (void)_rxListener;
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXGridCell::removePaintListener( const Reference< awt::XPaintListener >& _rxListener ) throw (RuntimeException)
+{
+ OSL_ENSURE( false, "FmXGridCell::removePaintListener: not implemented" );
+ (void)_rxListener;
+}
+
+//------------------------------------------------------------------
+IMPL_LINK( FmXGridCell, OnWindowEvent, VclWindowEvent*, _pEvent )
+{
+ ENSURE_OR_THROW( _pEvent, "illegal event pointer" );
+ ENSURE_OR_THROW( _pEvent->GetWindow(), "illegal window" );
+ onWindowEvent( _pEvent->GetId(), *_pEvent->GetWindow(), _pEvent->GetData() );
+ return 1L;
+}
+
+//------------------------------------------------------------------------------
+void FmXGridCell::onFocusGained( const awt::FocusEvent& _rEvent )
+{
+ m_aFocusListeners.notifyEach( &awt::XFocusListener::focusGained, _rEvent );
+}
+
+//------------------------------------------------------------------------------
+void FmXGridCell::onFocusLost( const awt::FocusEvent& _rEvent )
+{
+ m_aFocusListeners.notifyEach( &awt::XFocusListener::focusLost, _rEvent );
+}
+
+//------------------------------------------------------------------------------
+void FmXGridCell::onWindowEvent( const sal_uIntPtr _nEventId, const Window& _rWindow, const void* _pEventData )
+{
+ switch ( _nEventId )
+ {
+ case VCLEVENT_CONTROL_GETFOCUS:
+ case VCLEVENT_WINDOW_GETFOCUS:
+ case VCLEVENT_CONTROL_LOSEFOCUS:
+ case VCLEVENT_WINDOW_LOSEFOCUS:
+ {
+ if ( ( _rWindow.IsCompoundControl()
+ && ( _nEventId == VCLEVENT_CONTROL_GETFOCUS
+ || _nEventId == VCLEVENT_CONTROL_LOSEFOCUS
+ )
+ )
+ || ( !_rWindow.IsCompoundControl()
+ && ( _nEventId == VCLEVENT_WINDOW_GETFOCUS
+ || _nEventId == VCLEVENT_WINDOW_LOSEFOCUS
+ )
+ )
+ )
+ {
+ if ( !m_aFocusListeners.getLength() )
+ break;
+
+ bool bFocusGained = ( _nEventId == VCLEVENT_CONTROL_GETFOCUS ) || ( _nEventId == VCLEVENT_WINDOW_GETFOCUS );
+
+ awt::FocusEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.FocusFlags = _rWindow.GetGetFocusFlags();
+ aEvent.Temporary = sal_False;
+
+ if ( bFocusGained )
+ onFocusGained( aEvent );
+ else
+ onFocusLost( aEvent );
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_MOUSEBUTTONDOWN:
+ case VCLEVENT_WINDOW_MOUSEBUTTONUP:
+ {
+ if ( !m_aMouseListeners.getLength() )
+ break;
+
+ const bool bButtonDown = ( _nEventId == VCLEVENT_WINDOW_MOUSEBUTTONDOWN );
+
+ awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *static_cast< const ::MouseEvent* >( _pEventData ), *this ) );
+ m_aMouseListeners.notifyEach( bButtonDown ? &awt::XMouseListener::mousePressed : &awt::XMouseListener::mouseReleased, aEvent );
+ }
+ break;
+ case VCLEVENT_WINDOW_MOUSEMOVE:
+ {
+ const MouseEvent& rMouseEvent = *static_cast< const ::MouseEvent* >( _pEventData );
+ if ( rMouseEvent.IsEnterWindow() || rMouseEvent.IsLeaveWindow() )
+ {
+ if ( m_aMouseListeners.getLength() != 0 )
+ {
+ awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( rMouseEvent, *this ) );
+ m_aMouseListeners.notifyEach( rMouseEvent.IsEnterWindow() ? &awt::XMouseListener::mouseEntered: &awt::XMouseListener::mouseExited, aEvent );
+ }
+ }
+ else if ( !rMouseEvent.IsEnterWindow() && !rMouseEvent.IsLeaveWindow() )
+ {
+ if ( m_aMouseMotionListeners.getLength() != 0 )
+ {
+ awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( rMouseEvent, *this ) );
+ aEvent.ClickCount = 0;
+ const bool bSimpleMove = ( ( rMouseEvent.GetMode() & MOUSE_SIMPLEMOVE ) != 0 );
+ m_aMouseMotionListeners.notifyEach( bSimpleMove ? &awt::XMouseMotionListener::mouseMoved: &awt::XMouseMotionListener::mouseDragged, aEvent );
+ }
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_KEYINPUT:
+ case VCLEVENT_WINDOW_KEYUP:
+ {
+ if ( !m_aKeyListeners.getLength() )
+ break;
+
+ const bool bKeyPressed = ( _nEventId == VCLEVENT_WINDOW_KEYINPUT );
+ awt::KeyEvent aEvent( VCLUnoHelper::createKeyEvent( *static_cast< const ::KeyEvent* >( _pEventData ), *this ) );
+ m_aKeyListeners.notifyEach( bKeyPressed ? &awt::XKeyListener::keyPressed: &awt::XKeyListener::keyReleased, aEvent );
+ }
+ break;
+ }
+}
+
+/*************************************************************************/
+TYPEINIT1(FmXDataCell, FmXGridCell);
+//------------------------------------------------------------------------------
+void FmXDataCell::PaintFieldToCell(OutputDevice& rDev, const Rectangle& rRect,
+ const Reference< ::com::sun::star::sdb::XColumn >& _rxField,
+ const Reference< XNumberFormatter >& xFormatter)
+{
+ m_pCellControl->PaintFieldToCell( rDev, rRect, _rxField, xFormatter );
+}
+
+//------------------------------------------------------------------------------
+void FmXDataCell::UpdateFromColumn()
+{
+ Reference< ::com::sun::star::sdb::XColumn > xField(m_pColumn->GetCurrentFieldValue());
+ if (xField.is())
+ m_pCellControl->UpdateFromField(xField, m_pColumn->GetParent().getNumberFormatter());
+}
+
+/*************************************************************************/
+TYPEINIT1(FmXTextCell, FmXDataCell);
+
+FmXTextCell::FmXTextCell( DbGridColumn* pColumn, DbCellControl& _rControl )
+ :FmXDataCell( pColumn, _rControl )
+ ,m_bFastPaint( sal_True )
+{
+}
+
+//------------------------------------------------------------------------------
+void FmXTextCell::PaintFieldToCell(OutputDevice& rDev,
+ const Rectangle& rRect,
+ const Reference< ::com::sun::star::sdb::XColumn >& _rxField,
+ const Reference< XNumberFormatter >& xFormatter)
+{
+ if ( !m_bFastPaint )
+ {
+ FmXDataCell::PaintFieldToCell( rDev, rRect, _rxField, xFormatter );
+ return;
+ }
+
+ sal_uInt16 nStyle = TEXT_DRAW_CLIP | TEXT_DRAW_VCENTER;
+ if ( ( rDev.GetOutDevType() == OUTDEV_WINDOW ) && !static_cast< Window& >( rDev ).IsEnabled() )
+ nStyle |= TEXT_DRAW_DISABLE;
+
+ switch (m_pColumn->GetAlignment())
+ {
+ case ::com::sun::star::awt::TextAlign::RIGHT:
+ nStyle |= TEXT_DRAW_RIGHT;
+ break;
+ case ::com::sun::star::awt::TextAlign::CENTER:
+ nStyle |= TEXT_DRAW_CENTER;
+ break;
+ default:
+ nStyle |= TEXT_DRAW_LEFT;
+ }
+
+ Color* pColor = NULL;
+ String aText = GetText(_rxField, xFormatter, &pColor);
+ if (pColor != NULL)
+ {
+ Color aOldTextColor( rDev.GetTextColor() );
+ rDev.SetTextColor( *pColor );
+ rDev.DrawText(rRect, aText, nStyle);
+ rDev.SetTextColor( aOldTextColor );
+ }
+ else
+ rDev.DrawText(rRect, aText, nStyle);
+}
+
+
+/*************************************************************************/
+
+DBG_NAME(FmXEditCell);
+//------------------------------------------------------------------------------
+FmXEditCell::FmXEditCell( DbGridColumn* pColumn, DbCellControl& _rControl )
+ :FmXTextCell( pColumn, _rControl )
+ ,m_aTextListeners(m_aMutex)
+ ,m_aChangeListeners( m_aMutex )
+ ,m_pEditImplementation( NULL )
+ ,m_bOwnEditImplementation( false )
+{
+ DBG_CTOR(FmXEditCell,NULL);
+
+ DbTextField* pTextField = PTR_CAST( DbTextField, &_rControl );
+ if ( pTextField )
+ {
+
+ m_pEditImplementation = pTextField->GetEditImplementation();
+ if ( !pTextField->IsSimpleEdit() )
+ m_bFastPaint = sal_False;
+ }
+ else
+ {
+ m_pEditImplementation = new EditImplementation( static_cast< Edit& >( _rControl.GetWindow() ) );
+ m_bOwnEditImplementation = true;
+ }
+}
+
+//------------------------------------------------------------------
+FmXEditCell::~FmXEditCell()
+{
+ if (!OComponentHelper::rBHelper.bDisposed)
+ {
+ acquire();
+ dispose();
+ }
+
+
+ DBG_DTOR(FmXEditCell,NULL);
+}
+
+// OComponentHelper
+//-----------------------------------------------------------------------------
+void FmXEditCell::disposing()
+{
+ ::com::sun::star::lang::EventObject aEvt(*this);
+ m_aTextListeners.disposeAndClear(aEvt);
+ m_aChangeListeners.disposeAndClear(aEvt);
+
+ m_pEditImplementation->SetModifyHdl( Link() );
+ if ( m_bOwnEditImplementation )
+ delete m_pEditImplementation;
+ m_pEditImplementation = NULL;
+
+ FmXDataCell::disposing();
+}
+
+//------------------------------------------------------------------
+Any SAL_CALL FmXEditCell::queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(RuntimeException)
+{
+ Any aReturn = FmXTextCell::queryAggregation( _rType );
+
+ if ( !aReturn.hasValue() )
+ aReturn = FmXEditCell_Base::queryInterface( _rType );
+
+ return aReturn;
+}
+
+//-------------------------------------------------------------------------
+Sequence< ::com::sun::star::uno::Type > SAL_CALL FmXEditCell::getTypes( ) throw(RuntimeException)
+{
+ return ::comphelper::concatSequences(
+ FmXTextCell::getTypes(),
+ FmXEditCell_Base::getTypes()
+ );
+}
+
+//------------------------------------------------------------------------------
+IMPLEMENT_GET_IMPLEMENTATION_ID( FmXEditCell )
+
+// ::com::sun::star::awt::XTextComponent
+//------------------------------------------------------------------------------
+void SAL_CALL FmXEditCell::addTextListener(const Reference< ::com::sun::star::awt::XTextListener >& l) throw( RuntimeException )
+{
+ m_aTextListeners.addInterface( l );
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXEditCell::removeTextListener(const Reference< ::com::sun::star::awt::XTextListener >& l) throw( RuntimeException )
+{
+ m_aTextListeners.removeInterface( l );
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXEditCell::setText( const ::rtl::OUString& aText ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( m_pEditImplementation )
+ {
+ m_pEditImplementation->SetText( aText );
+
+ // In JAVA wird auch ein textChanged ausgeloest, in VCL nicht.
+ // ::com::sun::star::awt::Toolkit soll JAVA-komform sein...
+ onTextChanged();
+ }
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXEditCell::insertText(const ::com::sun::star::awt::Selection& rSel, const ::rtl::OUString& aText) throw(RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( m_pEditImplementation )
+ {
+ m_pEditImplementation->SetSelection( Selection( rSel.Min, rSel.Max ) );
+ m_pEditImplementation->ReplaceSelected( aText );
+ }
+}
+
+//------------------------------------------------------------------------------
+::rtl::OUString SAL_CALL FmXEditCell::getText() throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ ::rtl::OUString aText;
+ if ( m_pEditImplementation )
+ {
+ if ( m_pEditImplementation->GetControl().IsVisible() && m_pColumn->GetParent().getDisplaySynchron())
+ {
+ // if the display isn't sync with the cursor we can't ask the edit field
+ LineEnd eLineEndFormat = m_pColumn ? getModelLineEndSetting( m_pColumn->getModel() ) : LINEEND_LF;
+ aText = m_pEditImplementation->GetText( eLineEndFormat );
+ }
+ else
+ {
+ Reference< ::com::sun::star::sdb::XColumn > xField(m_pColumn->GetCurrentFieldValue());
+ if (xField.is())
+ aText = GetText(xField, m_pColumn->GetParent().getNumberFormatter());
+ }
+ }
+ return aText;
+}
+
+//------------------------------------------------------------------------------
+::rtl::OUString SAL_CALL FmXEditCell::getSelectedText( void ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ ::rtl::OUString aText;
+ if ( m_pEditImplementation )
+ {
+ LineEnd eLineEndFormat = m_pColumn ? getModelLineEndSetting( m_pColumn->getModel() ) : LINEEND_LF;
+ aText = m_pEditImplementation->GetSelected( eLineEndFormat );
+ }
+ return aText;
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXEditCell::setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( m_pEditImplementation )
+ m_pEditImplementation->SetSelection( Selection( aSelection.Min, aSelection.Max ) );
+}
+
+//------------------------------------------------------------------------------
+::com::sun::star::awt::Selection SAL_CALL FmXEditCell::getSelection( void ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ Selection aSel;
+ if ( m_pEditImplementation )
+ aSel = m_pEditImplementation->GetSelection();
+
+ return ::com::sun::star::awt::Selection(aSel.Min(), aSel.Max());
+}
+
+//------------------------------------------------------------------------------
+sal_Bool SAL_CALL FmXEditCell::isEditable( void ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ return ( m_pEditImplementation && !m_pEditImplementation->IsReadOnly() && m_pEditImplementation->GetControl().IsEnabled() ) ? sal_True : sal_False;
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXEditCell::setEditable( sal_Bool bEditable ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( m_pEditImplementation )
+ m_pEditImplementation->SetReadOnly( !bEditable );
+}
+
+//------------------------------------------------------------------------------
+sal_Int16 SAL_CALL FmXEditCell::getMaxTextLen() throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ return m_pEditImplementation ? m_pEditImplementation->GetMaxTextLen() : 0;
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXEditCell::setMaxTextLen( sal_Int16 nLen ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( m_pEditImplementation )
+ m_pEditImplementation->SetMaxTextLen( nLen );
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXEditCell::addChangeListener( const Reference< form::XChangeListener >& _Listener ) throw (RuntimeException)
+{
+ m_aChangeListeners.addInterface( _Listener );
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXEditCell::removeChangeListener( const Reference< form::XChangeListener >& _Listener ) throw (RuntimeException)
+{
+ m_aChangeListeners.removeInterface( _Listener );
+}
+
+//------------------------------------------------------------------------------
+void FmXEditCell::onTextChanged()
+{
+ ::com::sun::star::awt::TextEvent aEvent;
+ aEvent.Source = *this;
+ m_aTextListeners.notifyEach( &awt::XTextListener::textChanged, aEvent );
+}
+
+//------------------------------------------------------------------------------
+void FmXEditCell::onFocusGained( const awt::FocusEvent& _rEvent )
+{
+ FmXTextCell::onFocusGained( _rEvent );
+ m_sValueOnEnter = getText();
+}
+
+//------------------------------------------------------------------------------
+void FmXEditCell::onFocusLost( const awt::FocusEvent& _rEvent )
+{
+ FmXTextCell::onFocusLost( _rEvent );
+
+ if ( getText() != m_sValueOnEnter )
+ {
+ lang::EventObject aEvent( *this );
+ m_aChangeListeners.notifyEach( &XChangeListener::changed, aEvent );
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXEditCell::onWindowEvent( const sal_uIntPtr _nEventId, const Window& _rWindow, const void* _pEventData )
+{
+ switch ( _nEventId )
+ {
+ case VCLEVENT_EDIT_MODIFY:
+ {
+ if ( m_pEditImplementation && m_aTextListeners.getLength() )
+ onTextChanged();
+ return;
+ }
+ }
+
+ FmXTextCell::onWindowEvent( _nEventId, _rWindow, _pEventData );
+}
+
+/*************************************************************************/
+DBG_NAME(FmXCheckBoxCell);
+//------------------------------------------------------------------------------
+FmXCheckBoxCell::FmXCheckBoxCell( DbGridColumn* pColumn, DbCellControl& _rControl )
+ :FmXDataCell( pColumn, _rControl )
+ ,m_aItemListeners(m_aMutex)
+ ,m_aActionListeners( m_aMutex )
+ ,m_pBox( & static_cast< CheckBoxControl& >( _rControl.GetWindow() ).GetBox() )
+{
+ DBG_CTOR(FmXCheckBoxCell,NULL);
+}
+
+//------------------------------------------------------------------
+FmXCheckBoxCell::~FmXCheckBoxCell()
+{
+ if (!OComponentHelper::rBHelper.bDisposed)
+ {
+ acquire();
+ dispose();
+ }
+
+ DBG_DTOR(FmXCheckBoxCell,NULL);
+}
+
+// OComponentHelper
+//-----------------------------------------------------------------------------
+void FmXCheckBoxCell::disposing()
+{
+ ::com::sun::star::lang::EventObject aEvt(*this);
+ m_aItemListeners.disposeAndClear(aEvt);
+ m_aActionListeners.disposeAndClear(aEvt);
+
+ static_cast< CheckBoxControl& >( m_pCellControl->GetWindow() ).SetClickHdl(Link());
+ m_pBox = NULL;
+
+ FmXDataCell::disposing();
+}
+
+//------------------------------------------------------------------
+Any SAL_CALL FmXCheckBoxCell::queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(RuntimeException)
+{
+ Any aReturn = FmXDataCell::queryAggregation( _rType );
+
+ if ( !aReturn.hasValue() )
+ aReturn = FmXCheckBoxCell_Base::queryInterface( _rType );
+
+ return aReturn;
+}
+
+//-------------------------------------------------------------------------
+Sequence< ::com::sun::star::uno::Type > SAL_CALL FmXCheckBoxCell::getTypes( ) throw(RuntimeException)
+{
+ return ::comphelper::concatSequences(
+ FmXDataCell::getTypes(),
+ FmXCheckBoxCell_Base::getTypes()
+ );
+}
+
+//------------------------------------------------------------------------------
+IMPLEMENT_GET_IMPLEMENTATION_ID( FmXCheckBoxCell )
+
+//------------------------------------------------------------------
+void SAL_CALL FmXCheckBoxCell::addItemListener( const Reference< ::com::sun::star::awt::XItemListener >& l ) throw( RuntimeException )
+{
+ m_aItemListeners.addInterface( l );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXCheckBoxCell::removeItemListener( const Reference< ::com::sun::star::awt::XItemListener >& l ) throw( RuntimeException )
+{
+ m_aItemListeners.removeInterface( l );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXCheckBoxCell::setState( short n ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if (m_pBox)
+ {
+ UpdateFromColumn();
+ m_pBox->SetState( (TriState)n );
+ }
+}
+
+//------------------------------------------------------------------
+short SAL_CALL FmXCheckBoxCell::getState() throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if (m_pBox)
+ {
+ UpdateFromColumn();
+ return (short)m_pBox->GetState();
+ }
+ return STATE_DONTKNOW;
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXCheckBoxCell::enableTriState( sal_Bool b ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if (m_pBox)
+ m_pBox->EnableTriState( b );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXCheckBoxCell::addActionListener( const Reference< awt::XActionListener >& _Listener ) throw (RuntimeException)
+{
+ m_aActionListeners.addInterface( _Listener );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXCheckBoxCell::removeActionListener( const Reference< awt::XActionListener >& _Listener ) throw (RuntimeException)
+{
+ m_aActionListeners.removeInterface( _Listener );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXCheckBoxCell::setLabel( const ::rtl::OUString& _Label ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( m_pColumn )
+ {
+ DbGridControl& rGrid( m_pColumn->GetParent() );
+ rGrid.SetColumnTitle( rGrid.GetColumnId( m_pColumn->GetFieldPos() ), _Label );
+ }
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXCheckBoxCell::setActionCommand( const ::rtl::OUString& _Command ) throw (RuntimeException)
+{
+ m_aActionCommand = _Command;
+}
+
+//------------------------------------------------------------------
+Window* FmXCheckBoxCell::getEventWindow() const
+{
+ return m_pBox;
+}
+
+//------------------------------------------------------------------
+void FmXCheckBoxCell::onWindowEvent( const sal_uIntPtr _nEventId, const Window& _rWindow, const void* _pEventData )
+{
+ switch ( _nEventId )
+ {
+ case VCLEVENT_CHECKBOX_TOGGLE:
+ {
+ // check boxes are to be committed immediately (this holds for ordinary check box controls in
+ // documents, and this must hold for check boxes in grid columns, too
+ // 91210 - 22.08.2001 - frank.schoenheit@sun.com
+ m_pCellControl->Commit();
+
+ Reference< XWindow > xKeepAlive( this );
+ if ( m_aItemListeners.getLength() && m_pBox )
+ {
+ awt::ItemEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Highlighted = sal_False;
+ aEvent.Selected = m_pBox->GetState();
+ m_aItemListeners.notifyEach( &awt::XItemListener::itemStateChanged, aEvent );
+ }
+ if ( m_aActionListeners.getLength() )
+ {
+ awt::ActionEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.ActionCommand = m_aActionCommand;
+ m_aActionListeners.notifyEach( &awt::XActionListener::actionPerformed, aEvent );
+ }
+ }
+ break;
+
+ default:
+ FmXDataCell::onWindowEvent( _nEventId, _rWindow, _pEventData );
+ break;
+ }
+}
+
+/*************************************************************************/
+
+DBG_NAME(FmXListBoxCell);
+//------------------------------------------------------------------------------
+FmXListBoxCell::FmXListBoxCell(DbGridColumn* pColumn, DbCellControl& _rControl)
+ :FmXTextCell( pColumn, _rControl )
+ ,m_aItemListeners(m_aMutex)
+ ,m_aActionListeners(m_aMutex)
+ ,m_pBox( &static_cast< ListBox& >( _rControl.GetWindow() ) )
+{
+ DBG_CTOR(FmXListBoxCell,NULL);
+
+ m_pBox->SetDoubleClickHdl( LINK( this, FmXListBoxCell, OnDoubleClick ) );
+}
+
+//------------------------------------------------------------------
+FmXListBoxCell::~FmXListBoxCell()
+{
+ if (!OComponentHelper::rBHelper.bDisposed)
+ {
+ acquire();
+ dispose();
+ }
+
+ DBG_DTOR(FmXListBoxCell,NULL);
+}
+
+// OComponentHelper
+//-----------------------------------------------------------------------------
+void FmXListBoxCell::disposing()
+{
+ ::com::sun::star::lang::EventObject aEvt(*this);
+ m_aItemListeners.disposeAndClear(aEvt);
+ m_aActionListeners.disposeAndClear(aEvt);
+
+ m_pBox->SetSelectHdl( Link() );
+ m_pBox->SetDoubleClickHdl( Link() );
+ m_pBox = NULL;
+
+ FmXTextCell::disposing();
+}
+
+//------------------------------------------------------------------
+Any SAL_CALL FmXListBoxCell::queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(RuntimeException)
+{
+ Any aReturn = FmXTextCell::queryAggregation(_rType);
+
+ if ( !aReturn.hasValue() )
+ aReturn = FmXListBoxCell_Base::queryInterface( _rType );
+
+ return aReturn;
+}
+
+//-------------------------------------------------------------------------
+Sequence< ::com::sun::star::uno::Type > SAL_CALL FmXListBoxCell::getTypes( ) throw(RuntimeException)
+{
+ return ::comphelper::concatSequences(
+ FmXTextCell::getTypes(),
+ FmXListBoxCell_Base::getTypes()
+ );
+}
+
+//------------------------------------------------------------------------------
+IMPLEMENT_GET_IMPLEMENTATION_ID( FmXListBoxCell )
+
+//------------------------------------------------------------------
+void SAL_CALL FmXListBoxCell::addItemListener(const Reference< ::com::sun::star::awt::XItemListener >& l) throw( RuntimeException )
+{
+ m_aItemListeners.addInterface( l );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXListBoxCell::removeItemListener(const Reference< ::com::sun::star::awt::XItemListener >& l) throw( RuntimeException )
+{
+ m_aItemListeners.removeInterface( l );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXListBoxCell::addActionListener(const Reference< ::com::sun::star::awt::XActionListener >& l) throw( RuntimeException )
+{
+ m_aActionListeners.addInterface( l );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXListBoxCell::removeActionListener(const Reference< ::com::sun::star::awt::XActionListener >& l) throw( RuntimeException )
+{
+ m_aActionListeners.removeInterface( l );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXListBoxCell::addItem(const ::rtl::OUString& aItem, sal_Int16 nPos) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if (m_pBox)
+ m_pBox->InsertEntry( aItem, nPos );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXListBoxCell::addItems(const ::comphelper::StringSequence& aItems, sal_Int16 nPos) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if (m_pBox)
+ {
+ sal_uInt16 nP = nPos;
+ for ( sal_uInt16 n = 0; n < aItems.getLength(); n++ )
+ {
+ m_pBox->InsertEntry( aItems.getConstArray()[n], nP );
+ if ( nPos != -1 ) // Nicht wenn 0xFFFF, weil LIST_APPEND
+ nP++;
+ }
+ }
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXListBoxCell::removeItems(sal_Int16 nPos, sal_Int16 nCount) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( m_pBox )
+ {
+ for ( sal_uInt16 n = nCount; n; )
+ m_pBox->RemoveEntry( nPos + (--n) );
+ }
+}
+
+//------------------------------------------------------------------
+sal_Int16 SAL_CALL FmXListBoxCell::getItemCount() throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ return m_pBox ? m_pBox->GetEntryCount() : 0;
+}
+
+//------------------------------------------------------------------
+::rtl::OUString SAL_CALL FmXListBoxCell::getItem(sal_Int16 nPos) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ String aItem;
+ if (m_pBox)
+ aItem = m_pBox->GetEntry( nPos );
+ return aItem;
+}
+//------------------------------------------------------------------
+::comphelper::StringSequence SAL_CALL FmXListBoxCell::getItems() throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ ::comphelper::StringSequence aSeq;
+ if (m_pBox)
+ {
+ sal_uInt16 nEntries = m_pBox ->GetEntryCount();
+ aSeq = ::comphelper::StringSequence( nEntries );
+ for ( sal_uInt16 n = nEntries; n; )
+ {
+ --n;
+ aSeq.getArray()[n] = m_pBox ->GetEntry( n );
+ }
+ }
+ return aSeq;
+}
+
+//------------------------------------------------------------------
+sal_Int16 SAL_CALL FmXListBoxCell::getSelectedItemPos() throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if (m_pBox)
+ {
+ UpdateFromColumn();
+ return m_pBox->GetSelectEntryPos();
+ }
+ return 0;
+}
+
+//------------------------------------------------------------------
+Sequence< sal_Int16 > SAL_CALL FmXListBoxCell::getSelectedItemsPos() throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ Sequence<sal_Int16> aSeq;
+
+ if (m_pBox)
+ {
+ UpdateFromColumn();
+ sal_uInt16 nSelEntries = m_pBox->GetSelectEntryCount();
+ aSeq = Sequence<sal_Int16>( nSelEntries );
+ for ( sal_uInt16 n = 0; n < nSelEntries; n++ )
+ aSeq.getArray()[n] = m_pBox->GetSelectEntryPos( n );
+ }
+ return aSeq;
+}
+//------------------------------------------------------------------
+::rtl::OUString SAL_CALL FmXListBoxCell::getSelectedItem() throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ String aItem;
+ if (m_pBox)
+ {
+ UpdateFromColumn();
+ aItem = m_pBox->GetSelectEntry();
+ }
+
+ return aItem;
+}
+
+//------------------------------------------------------------------
+::comphelper::StringSequence SAL_CALL FmXListBoxCell::getSelectedItems() throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ ::comphelper::StringSequence aSeq;
+
+ if (m_pBox)
+ {
+ UpdateFromColumn();
+ sal_uInt16 nSelEntries = m_pBox->GetSelectEntryCount();
+ aSeq = ::comphelper::StringSequence( nSelEntries );
+ for ( sal_uInt16 n = 0; n < nSelEntries; n++ )
+ aSeq.getArray()[n] = m_pBox->GetSelectEntry( n );
+ }
+ return aSeq;
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXListBoxCell::selectItemPos(sal_Int16 nPos, sal_Bool bSelect) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if (m_pBox)
+ m_pBox->SelectEntryPos( nPos, bSelect );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXListBoxCell::selectItemsPos(const Sequence< sal_Int16 >& aPositions, sal_Bool bSelect) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if (m_pBox)
+ {
+ for ( sal_uInt16 n = (sal_uInt16)aPositions.getLength(); n; )
+ m_pBox->SelectEntryPos( (sal_uInt16) aPositions.getConstArray()[--n], bSelect );
+ }
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXListBoxCell::selectItem(const ::rtl::OUString& aItem, sal_Bool bSelect) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if (m_pBox)
+ m_pBox->SelectEntry( aItem, bSelect );
+}
+
+//------------------------------------------------------------------
+sal_Bool SAL_CALL FmXListBoxCell::isMutipleMode() throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ sal_Bool bMulti = sal_False;
+ if (m_pBox)
+ bMulti = m_pBox->IsMultiSelectionEnabled();
+ return bMulti;
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXListBoxCell::setMultipleMode(sal_Bool bMulti) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if (m_pBox)
+ m_pBox->EnableMultiSelection( bMulti );
+}
+
+//------------------------------------------------------------------
+sal_Int16 SAL_CALL FmXListBoxCell::getDropDownLineCount() throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ sal_Int16 nLines = 0;
+ if (m_pBox)
+ nLines = m_pBox->GetDropDownLineCount();
+
+ return nLines;
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXListBoxCell::setDropDownLineCount(sal_Int16 nLines) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if (m_pBox)
+ m_pBox->SetDropDownLineCount( nLines );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXListBoxCell::makeVisible(sal_Int16 nEntry) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if (m_pBox)
+ m_pBox->SetTopEntry( nEntry );
+}
+
+//------------------------------------------------------------------
+void FmXListBoxCell::onWindowEvent( const sal_uIntPtr _nEventId, const Window& _rWindow, const void* _pEventData )
+{
+ if ( ( &_rWindow == m_pBox )
+ && ( _nEventId == VCLEVENT_LISTBOX_SELECT )
+ )
+ {
+ OnDoubleClick( NULL );
+
+ ::com::sun::star::awt::ItemEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Highlighted = sal_False;
+
+ // Bei Mehrfachselektion 0xFFFF, sonst die ID
+ aEvent.Selected = (m_pBox->GetSelectEntryCount() == 1 )
+ ? m_pBox->GetSelectEntryPos() : 0xFFFF;
+
+ m_aItemListeners.notifyEach( &awt::XItemListener::itemStateChanged, aEvent );
+ return;
+ }
+
+ FmXTextCell::onWindowEvent( _nEventId, _rWindow, _pEventData );
+}
+
+
+//------------------------------------------------------------------
+IMPL_LINK( FmXListBoxCell, OnDoubleClick, void*, EMPTYARG )
+{
+ if (m_pBox)
+ {
+ ::cppu::OInterfaceIteratorHelper aIt( m_aActionListeners );
+
+ ::com::sun::star::awt::ActionEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.ActionCommand = m_pBox->GetSelectEntry();
+
+ while( aIt.hasMoreElements() )
+ ((::com::sun::star::awt::XActionListener *)aIt.next())->actionPerformed( aEvent );
+ }
+ return 1;
+}
+
+
+/*************************************************************************/
+
+DBG_NAME( FmXComboBoxCell );
+
+//------------------------------------------------------------------------------
+FmXComboBoxCell::FmXComboBoxCell( DbGridColumn* pColumn, DbCellControl& _rControl )
+ :FmXTextCell( pColumn, _rControl )
+ ,m_aItemListeners( m_aMutex )
+ ,m_aActionListeners( m_aMutex )
+ ,m_pComboBox( &static_cast< ComboBox& >( _rControl.GetWindow() ) )
+{
+ DBG_CTOR( FmXComboBoxCell, NULL );
+}
+
+//------------------------------------------------------------------------------
+FmXComboBoxCell::~FmXComboBoxCell()
+{
+ if ( !OComponentHelper::rBHelper.bDisposed )
+ {
+ acquire();
+ dispose();
+ }
+
+ DBG_DTOR( FmXComboBoxCell, NULL );
+}
+
+//-----------------------------------------------------------------------------
+void FmXComboBoxCell::disposing()
+{
+ ::com::sun::star::lang::EventObject aEvt(*this);
+ m_aItemListeners.disposeAndClear(aEvt);
+ m_aActionListeners.disposeAndClear(aEvt);
+
+ FmXTextCell::disposing();
+}
+
+//------------------------------------------------------------------
+Any SAL_CALL FmXComboBoxCell::queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(RuntimeException)
+{
+ Any aReturn = FmXTextCell::queryAggregation(_rType);
+
+ if ( !aReturn.hasValue() )
+ aReturn = FmXComboBoxCell_Base::queryInterface( _rType );
+
+ return aReturn;
+}
+
+//-------------------------------------------------------------------------
+Sequence< Type > SAL_CALL FmXComboBoxCell::getTypes( ) throw(RuntimeException)
+{
+ return ::comphelper::concatSequences(
+ FmXTextCell::getTypes(),
+ FmXComboBoxCell_Base::getTypes()
+ );
+}
+
+//------------------------------------------------------------------------------
+IMPLEMENT_GET_IMPLEMENTATION_ID( FmXComboBoxCell )
+
+//------------------------------------------------------------------
+void SAL_CALL FmXComboBoxCell::addItemListener(const Reference< awt::XItemListener >& l) throw( RuntimeException )
+{
+ m_aItemListeners.addInterface( l );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXComboBoxCell::removeItemListener(const Reference< awt::XItemListener >& l) throw( RuntimeException )
+{
+ m_aItemListeners.removeInterface( l );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXComboBoxCell::addActionListener(const Reference< awt::XActionListener >& l) throw( RuntimeException )
+{
+ m_aActionListeners.addInterface( l );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXComboBoxCell::removeActionListener(const Reference< awt::XActionListener >& l) throw( RuntimeException )
+{
+ m_aActionListeners.removeInterface( l );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXComboBoxCell::addItem( const ::rtl::OUString& _Item, sal_Int16 _Pos ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( m_pComboBox )
+ m_pComboBox->InsertEntry( _Item, _Pos );
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXComboBoxCell::addItems( const Sequence< ::rtl::OUString >& _Items, sal_Int16 _Pos ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( m_pComboBox )
+ {
+ sal_uInt16 nP = _Pos;
+ for ( sal_uInt16 n = 0; n < _Items.getLength(); n++ )
+ {
+ m_pComboBox->InsertEntry( _Items.getConstArray()[n], nP );
+ if ( _Pos != -1 )
+ nP++;
+ }
+ }
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXComboBoxCell::removeItems( sal_Int16 _Pos, sal_Int16 _Count ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( m_pComboBox )
+ {
+ for ( sal_uInt16 n = _Count; n; )
+ m_pComboBox->RemoveEntry( _Pos + (--n) );
+ }
+}
+
+//------------------------------------------------------------------
+sal_Int16 SAL_CALL FmXComboBoxCell::getItemCount() throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ return m_pComboBox ? m_pComboBox->GetEntryCount() : 0;
+}
+
+//------------------------------------------------------------------
+::rtl::OUString SAL_CALL FmXComboBoxCell::getItem( sal_Int16 _Pos ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ String sItem;
+ if ( m_pComboBox )
+ sItem = m_pComboBox->GetEntry( _Pos );
+ return sItem;
+}
+//------------------------------------------------------------------
+Sequence< ::rtl::OUString > SAL_CALL FmXComboBoxCell::getItems() throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ Sequence< ::rtl::OUString > aItems;
+ if ( m_pComboBox )
+ {
+ sal_uInt16 nEntries = m_pComboBox->GetEntryCount();
+ aItems.realloc( nEntries );
+ ::rtl::OUString* pItem = aItems.getArray();
+ for ( sal_uInt16 n=0; n<nEntries; ++n, ++pItem )
+ *pItem = m_pComboBox->GetEntry( n );
+ }
+ return aItems;
+}
+
+//------------------------------------------------------------------
+sal_Int16 SAL_CALL FmXComboBoxCell::getDropDownLineCount() throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ sal_Int16 nLines = 0;
+ if ( m_pComboBox )
+ nLines = m_pComboBox->GetDropDownLineCount();
+
+ return nLines;
+}
+
+//------------------------------------------------------------------
+void SAL_CALL FmXComboBoxCell::setDropDownLineCount(sal_Int16 nLines) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( m_pComboBox )
+ m_pComboBox->SetDropDownLineCount( nLines );
+}
+
+//------------------------------------------------------------------------------
+void FmXComboBoxCell::onWindowEvent( const sal_uIntPtr _nEventId, const Window& _rWindow, const void* _pEventData )
+{
+
+ switch ( _nEventId )
+ {
+ case VCLEVENT_COMBOBOX_SELECT:
+ {
+ awt::ItemEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Highlighted = sal_False;
+
+ // Bei Mehrfachselektion 0xFFFF, sonst die ID
+ aEvent.Selected = ( m_pComboBox->GetSelectEntryCount() == 1 )
+ ? m_pComboBox->GetSelectEntryPos()
+ : 0xFFFF;
+ m_aItemListeners.notifyEach( &awt::XItemListener::itemStateChanged, aEvent );
+ }
+ break;
+
+ default:
+ FmXTextCell::onWindowEvent( _nEventId, _rWindow, _pEventData );
+ break;
+ }
+}
+
+/*************************************************************************/
+TYPEINIT1(FmXFilterCell, FmXGridCell);
+
+//------------------------------------------------------------------------------
+Reference< XInterface > FmXFilterCell_CreateInstance(const Reference< ::com::sun::star::lang::XMultiServiceFactory >& /*_rxFactory*/)
+{
+ return *new FmXFilterCell();
+}
+
+DBG_NAME(FmXFilterCell);
+//------------------------------------------------------------------------------
+FmXFilterCell::FmXFilterCell(DbGridColumn* pColumn, DbCellControl* pControl )
+ :FmXGridCell( pColumn, pControl )
+ ,m_aTextListeners(m_aMutex)
+{
+ DBG_CTOR(FmXFilterCell,NULL);
+
+ DBG_ASSERT( m_pCellControl->ISA( DbFilterField ), "FmXFilterCell::FmXFilterCell: invalid cell control!" );
+ static_cast< DbFilterField* >( m_pCellControl )->SetCommitHdl( LINK( this, FmXFilterCell, OnCommit ) );
+}
+
+//------------------------------------------------------------------
+FmXFilterCell::~FmXFilterCell()
+{
+ if (!OComponentHelper::rBHelper.bDisposed)
+ {
+ acquire();
+ dispose();
+ }
+
+ DBG_DTOR(FmXFilterCell,NULL);
+}
+
+// XUnoTunnel
+//------------------------------------------------------------------------------
+sal_Int64 SAL_CALL FmXFilterCell::getSomething( const Sequence< sal_Int8 >& _rIdentifier ) throw(RuntimeException)
+{
+ sal_Int64 nReturn(0);
+
+ if ( (_rIdentifier.getLength() == 16)
+ && (0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), _rIdentifier.getConstArray(), 16 ))
+ )
+ {
+ nReturn = reinterpret_cast<sal_Int64>(this);
+ }
+
+ return nReturn;
+}
+
+//------------------------------------------------------------------------------
+const Sequence<sal_Int8>& FmXFilterCell::getUnoTunnelId()
+{
+ static Sequence< sal_Int8 > * pSeq = 0;
+ if( !pSeq )
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !pSeq )
+ {
+ static Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+ return *pSeq;
+}
+
+//------------------------------------------------------------------------------
+FmXFilterCell* FmXFilterCell::getImplementation(const Reference< ::com::sun::star::awt::XControl >& _rxObject)
+{
+ Reference< ::com::sun::star::lang::XUnoTunnel > xTunnel(
+ _rxObject, UNO_QUERY);
+ if (xTunnel.is())
+ return reinterpret_cast<FmXFilterCell*>(xTunnel->getSomething(getUnoTunnelId()));
+ return NULL;
+}
+
+//------------------------------------------------------------------------------
+void FmXFilterCell::PaintCell( OutputDevice& rDev, const Rectangle& rRect )
+{
+ static_cast< DbFilterField* >( m_pCellControl )->PaintCell( rDev, rRect );
+}
+
+// OComponentHelper
+//-----------------------------------------------------------------------------
+void FmXFilterCell::disposing()
+{
+ ::com::sun::star::lang::EventObject aEvt(*this);
+ m_aTextListeners.disposeAndClear(aEvt);
+
+ ((DbFilterField*)m_pCellControl)->SetCommitHdl(Link());
+
+ FmXGridCell::disposing();
+}
+
+//------------------------------------------------------------------
+Any SAL_CALL FmXFilterCell::queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(RuntimeException)
+{
+ Any aReturn = FmXGridCell::queryAggregation(_rType);
+
+ if ( !aReturn.hasValue() )
+ aReturn = FmXFilterCell_Base::queryInterface( _rType );
+
+ return aReturn;
+}
+
+//-------------------------------------------------------------------------
+Sequence< ::com::sun::star::uno::Type > SAL_CALL FmXFilterCell::getTypes( ) throw(RuntimeException)
+{
+ return ::comphelper::concatSequences(
+ FmXGridCell::getTypes(),
+ FmXFilterCell_Base::getTypes()
+ );
+}
+
+//------------------------------------------------------------------------------
+IMPLEMENT_GET_IMPLEMENTATION_ID( FmXFilterCell )
+
+// ::com::sun::star::awt::XTextComponent
+//------------------------------------------------------------------------------
+void SAL_CALL FmXFilterCell::addTextListener(const Reference< ::com::sun::star::awt::XTextListener >& l) throw( RuntimeException )
+{
+ m_aTextListeners.addInterface( l );
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXFilterCell::removeTextListener(const Reference< ::com::sun::star::awt::XTextListener >& l) throw( RuntimeException )
+{
+ m_aTextListeners.removeInterface( l );
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXFilterCell::setText( const ::rtl::OUString& aText ) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ ((DbFilterField*)m_pCellControl)->SetText(aText);
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXFilterCell::insertText( const ::com::sun::star::awt::Selection& /*rSel*/, const ::rtl::OUString& /*aText*/ ) throw( RuntimeException )
+{
+}
+
+//------------------------------------------------------------------------------
+::rtl::OUString SAL_CALL FmXFilterCell::getText() throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ return ((DbFilterField*)m_pCellControl)->GetText();
+}
+
+//------------------------------------------------------------------------------
+::rtl::OUString SAL_CALL FmXFilterCell::getSelectedText( void ) throw( RuntimeException )
+{
+ return getText();
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXFilterCell::setSelection( const ::com::sun::star::awt::Selection& /*aSelection*/ ) throw( RuntimeException )
+{
+}
+
+//------------------------------------------------------------------------------
+::com::sun::star::awt::Selection SAL_CALL FmXFilterCell::getSelection( void ) throw( RuntimeException )
+{
+ return ::com::sun::star::awt::Selection();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool SAL_CALL FmXFilterCell::isEditable( void ) throw( RuntimeException )
+{
+ return sal_True;
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXFilterCell::setEditable( sal_Bool /*bEditable*/ ) throw( RuntimeException )
+{
+}
+
+//------------------------------------------------------------------------------
+sal_Int16 SAL_CALL FmXFilterCell::getMaxTextLen() throw( RuntimeException )
+{
+ return 0;
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXFilterCell::setMaxTextLen( sal_Int16 /*nLen*/ ) throw( RuntimeException )
+{
+}
+
+//------------------------------------------------------------------------------
+IMPL_LINK( FmXFilterCell, OnCommit, void*, EMPTYARG )
+{
+ ::cppu::OInterfaceIteratorHelper aIt( m_aTextListeners );
+ ::com::sun::star::awt::TextEvent aEvt;
+ aEvt.Source = *this;
+ while( aIt.hasMoreElements() )
+ ((::com::sun::star::awt::XTextListener *)aIt.next())->textChanged( aEvt );
+ return 1;
+}
+
diff --git a/svx/source/fmcomp/gridcols.cxx b/svx/source/fmcomp/gridcols.cxx
new file mode 100644
index 000000000000..969f1307a2ef
--- /dev/null
+++ b/svx/source/fmcomp/gridcols.cxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "gridcols.hxx"
+#include <tools/debug.hxx>
+#include <comphelper/types.hxx>
+#include "fmservs.hxx"
+#include "svx/fmtools.hxx"
+using namespace ::com::sun::star::uno;
+
+//------------------------------------------------------------------------------
+const ::comphelper::StringSequence& getColumnTypes()
+{
+ static ::comphelper::StringSequence aColumnTypes(10);
+ if (!aColumnTypes.getConstArray()[0].getLength())
+ {
+ ::rtl::OUString* pNames = aColumnTypes.getArray();
+ pNames[TYPE_CHECKBOX] = FM_COL_CHECKBOX;
+ pNames[TYPE_COMBOBOX] = FM_COL_COMBOBOX;
+ pNames[TYPE_CURRENCYFIELD] = FM_COL_CURRENCYFIELD;
+ pNames[TYPE_DATEFIELD] = FM_COL_DATEFIELD;
+ pNames[TYPE_FORMATTEDFIELD] = FM_COL_FORMATTEDFIELD;
+ pNames[TYPE_LISTBOX] = FM_COL_LISTBOX;
+ pNames[TYPE_NUMERICFIELD] = FM_COL_NUMERICFIELD;
+ pNames[TYPE_PATTERNFIELD] = FM_COL_PATTERNFIELD;
+ pNames[TYPE_TEXTFIELD] = FM_COL_TEXTFIELD;
+ pNames[TYPE_TIMEFIELD] = FM_COL_TIMEFIELD;
+ }
+ return aColumnTypes;
+}
+
+//------------------------------------------------------------------
+// Vergleichen von PropertyInfo
+extern "C" int
+#if defined( WNT )
+ __cdecl
+#endif
+#if defined( ICC ) && defined( OS2 )
+_Optlink
+#endif
+ NameCompare(const void* pFirst, const void* pSecond)
+{
+ return ((::rtl::OUString*)pFirst)->compareTo(*(::rtl::OUString*)pSecond);
+}
+
+namespace
+{
+ //------------------------------------------------------------------------------
+ sal_Int32 lcl_findPos(const ::rtl::OUString& aStr, const Sequence< ::rtl::OUString>& rList)
+ {
+ const ::rtl::OUString* pStrList = rList.getConstArray();
+ ::rtl::OUString* pResult = (::rtl::OUString*) bsearch(&aStr, (void*)pStrList, rList.getLength(), sizeof(::rtl::OUString),
+ &NameCompare);
+
+ if (pResult)
+ return (pResult - pStrList);
+ else
+ return -1;
+ }
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 getColumnTypeByModelName(const ::rtl::OUString& aModelName)
+{
+ const ::rtl::OUString aModelPrefix = ::rtl::OUString::createFromAscii("com.sun.star.form.component.");
+ const ::rtl::OUString aCompatibleModelPrefix = ::rtl::OUString::createFromAscii("stardiv.one.form.component.");
+
+ sal_Int32 nTypeId = -1;
+ if (aModelName == FM_COMPONENT_EDIT)
+ nTypeId = TYPE_TEXTFIELD;
+ else
+ {
+ sal_Int32 nPrefixPos = aModelName.indexOf(aModelPrefix);
+#ifdef DBG_UTIL
+ sal_Int32 nCompatiblePrefixPos = aModelName.indexOf(aCompatibleModelPrefix);
+ DBG_ASSERT( (nPrefixPos != -1) || (nCompatiblePrefixPos != -1), "::getColumnTypeByModelName() : wrong servivce !");
+#endif
+
+ ::rtl::OUString aColumnType = (nPrefixPos != -1)
+ ? aModelName.copy(aModelPrefix.getLength())
+ : aModelName.copy(aCompatibleModelPrefix.getLength());
+
+ const ::comphelper::StringSequence& rColumnTypes = getColumnTypes();
+ nTypeId = lcl_findPos(aColumnType, rColumnTypes);
+ }
+ return nTypeId;
+}
+
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
new file mode 100644
index 000000000000..38342bf355ea
--- /dev/null
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -0,0 +1,3893 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#ifndef _SVX_FMHELP_HRC
+#include "fmhelp.hrc"
+#endif
+#include <svx/gridctrl.hxx>
+#include "gridcell.hxx"
+#include "svx/dbtoolsclient.hxx"
+#include "svx/fmtools.hxx"
+#include <svtools/stringtransfer.hxx>
+
+#ifndef _SVX_FMPROP_HRC
+#include "fmprop.hrc"
+#endif
+#include <svtools/stringtransfer.hxx>
+#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/sdb/XResultSetAccess.hpp>
+#include <com/sun/star/sdb/RowChangeAction.hpp>
+#include <com/sun/star/sdb/XRowsChangeBroadcaster.hpp>
+#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
+#include <com/sun/star/sdbcx/Privilege.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyChangeEvent.hpp>
+#include <comphelper/extract.hxx>
+#include <tools/resid.hxx>
+#include <tools/diagnose_ex.h>
+#include <vcl/sound.hxx>
+#include <vcl/menu.hxx>
+
+#ifndef _SVX_FMRESIDS_HRC
+#include "svx/fmresids.hrc"
+#endif
+
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+#include <tools/shl.hxx>
+#include <svx/dialmgr.hxx>
+#include "fmservs.hxx"
+#include "sdbdatacolumn.hxx"
+
+#define HANDLE_ID 0
+
+#include <comphelper/stl_types.hxx>
+#include <comphelper/property.hxx>
+#include "trace.hxx"
+
+#include <algorithm>
+
+using namespace ::svxform;
+using namespace ::svt;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::datatransfer;
+using namespace ::com::sun::star::container;
+using namespace com::sun::star::accessibility;
+
+#define ROWSTATUS(row) !row.Is() ? "NULL" : row->GetStatus() == GRS_CLEAN ? "CLEAN" : row->GetStatus() == GRS_MODIFIED ? "MODIFIED" : row->GetStatus() == GRS_DELETED ? "DELETED" : "INVALID"
+
+
+#define DEFAULT_BROWSE_MODE \
+ BROWSER_COLUMNSELECTION \
+ | BROWSER_MULTISELECTION \
+ | BROWSER_KEEPSELECTION \
+ | BROWSER_TRACKING_TIPS \
+ | BROWSER_HLINESFULL \
+ | BROWSER_VLINESFULL \
+ | BROWSER_HEADERBAR_NEW \
+
+class RowSetEventListener : public ::cppu::WeakImplHelper1<XRowsChangeListener>
+{
+ DbGridControl* m_pControl;
+public:
+ RowSetEventListener(DbGridControl* i_pControl) : m_pControl(i_pControl)
+ {
+ }
+private:
+ // XEventListener
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& /*i_aEvt*/) throw ( RuntimeException )
+ {
+ }
+ virtual void SAL_CALL rowsChanged(const ::com::sun::star::sdb::RowsChangeEvent& i_aEvt) throw ( RuntimeException )
+ {
+ if ( i_aEvt.Action == RowChangeAction::UPDATE )
+ {
+ ::DbGridControl::GrantControlAccess aAccess;
+ CursorWrapper* pSeek = m_pControl->GetSeekCursor(aAccess);
+ const DbGridRowRef& rSeekRow = m_pControl->GetSeekRow(aAccess);
+ const Any* pIter = i_aEvt.Bookmarks.getConstArray();
+ const Any* pEnd = pIter + i_aEvt.Bookmarks.getLength();
+ for(;pIter != pEnd;++pIter)
+ {
+ pSeek->moveToBookmark(*pIter);
+ // get the data
+ rSeekRow->SetState(pSeek, sal_True);
+ sal_Int32 nSeekPos = pSeek->getRow() - 1;
+ m_pControl->SetSeekPos(nSeekPos,aAccess);
+ m_pControl->RowModified(nSeekPos);
+ }
+ }
+ }
+};
+//==============================================================================
+
+class GridFieldValueListener;
+DECLARE_STL_MAP(sal_uInt16, GridFieldValueListener*, ::std::less<sal_uInt16>, ColumnFieldValueListeners);
+
+//==============================================================================
+
+DBG_NAME(GridFieldValueListener)
+class GridFieldValueListener : protected ::comphelper::OPropertyChangeListener
+{
+ osl::Mutex m_aMutex;
+ DbGridControl& m_rParent;
+ ::comphelper::OPropertyChangeMultiplexer* m_pRealListener;
+ sal_uInt16 m_nId;
+ sal_Int16 m_nSuspended;
+ sal_Bool m_bDisposed : 1;
+
+public:
+ GridFieldValueListener(DbGridControl& _rParent, const Reference< XPropertySet >& xField, sal_uInt16 _nId);
+ virtual ~GridFieldValueListener();
+
+ virtual void _propertyChanged(const PropertyChangeEvent& evt) throw( RuntimeException );
+
+ void suspend() { ++m_nSuspended; }
+ void resume() { --m_nSuspended; }
+
+ void dispose();
+};
+//------------------------------------------------------------------------------
+GridFieldValueListener::GridFieldValueListener(DbGridControl& _rParent, const Reference< XPropertySet >& _rField, sal_uInt16 _nId)
+ :OPropertyChangeListener(m_aMutex)
+ ,m_rParent(_rParent)
+ ,m_pRealListener(NULL)
+ ,m_nId(_nId)
+ ,m_nSuspended(0)
+ ,m_bDisposed(sal_False)
+{
+ DBG_CTOR(GridFieldValueListener, NULL);
+ if (_rField.is())
+ {
+ m_pRealListener = new ::comphelper::OPropertyChangeMultiplexer(this, _rField);
+ m_pRealListener->addProperty(FM_PROP_VALUE);
+ m_pRealListener->acquire();
+ }
+}
+
+//------------------------------------------------------------------------------
+GridFieldValueListener::~GridFieldValueListener()
+{
+ DBG_DTOR(GridFieldValueListener, NULL);
+ dispose();
+}
+
+//------------------------------------------------------------------------------
+void GridFieldValueListener::_propertyChanged(const PropertyChangeEvent& _evt) throw( RuntimeException )
+{
+ DBG_ASSERT(m_nSuspended>=0, "GridFieldValueListener::_propertyChanged : resume > suspend !");
+ if (m_nSuspended <= 0)
+ m_rParent.FieldValueChanged(m_nId, _evt);
+}
+
+//------------------------------------------------------------------------------
+void GridFieldValueListener::dispose()
+{
+ if (m_bDisposed)
+ {
+ DBG_ASSERT(m_pRealListener == NULL, "GridFieldValueListener::dispose : inconsistent !");
+ return;
+ }
+
+ if (m_pRealListener)
+ {
+ m_pRealListener->dispose();
+ m_pRealListener->release();
+ m_pRealListener = NULL;
+ }
+
+ m_bDisposed = sal_True;
+ m_rParent.FieldListenerDisposing(m_nId);
+}
+
+//==============================================================================
+
+class DisposeListenerGridBridge : public FmXDisposeListener
+{
+ osl::Mutex m_aMutex;
+ DbGridControl& m_rParent;
+ FmXDisposeMultiplexer* m_pRealListener;
+
+public:
+ DisposeListenerGridBridge( DbGridControl& _rParent, const Reference< XComponent >& _rxObject, sal_Int16 _rId = -1);
+ virtual ~DisposeListenerGridBridge();
+
+ virtual void disposing(const EventObject& _rEvent, sal_Int16 _nId) throw( RuntimeException ) { m_rParent.disposing(_nId, _rEvent); }
+};
+
+//==============================================================================
+
+
+DBG_NAME(DisposeListenerGridBridge)
+//------------------------------------------------------------------------------
+DisposeListenerGridBridge::DisposeListenerGridBridge(DbGridControl& _rParent, const Reference< XComponent >& _rxObject, sal_Int16 _rId)
+ :FmXDisposeListener(m_aMutex)
+ ,m_rParent(_rParent)
+ ,m_pRealListener(NULL)
+{
+ DBG_CTOR(DisposeListenerGridBridge,NULL);
+
+ if (_rxObject.is())
+ {
+ m_pRealListener = new FmXDisposeMultiplexer(this, _rxObject, _rId);
+ m_pRealListener->acquire();
+ }
+}
+
+//------------------------------------------------------------------------------
+DisposeListenerGridBridge::~DisposeListenerGridBridge()
+{
+ if (m_pRealListener)
+ {
+ m_pRealListener->dispose();
+ m_pRealListener->release();
+ m_pRealListener = NULL;
+ }
+
+ DBG_DTOR(DisposeListenerGridBridge,NULL);
+}
+
+//==============================================================================
+
+static sal_uInt16 ControlMap[] =
+ {
+ DbGridControl::NavigationBar::RECORD_TEXT,
+ DbGridControl::NavigationBar::RECORD_ABSOLUTE,
+ DbGridControl::NavigationBar::RECORD_OF,
+ DbGridControl::NavigationBar::RECORD_COUNT,
+ DbGridControl::NavigationBar::RECORD_FIRST,
+ DbGridControl::NavigationBar::RECORD_NEXT,
+ DbGridControl::NavigationBar::RECORD_PREV,
+ DbGridControl::NavigationBar::RECORD_LAST,
+ DbGridControl::NavigationBar::RECORD_NEW,
+ 0
+ };
+
+//------------------------------------------------------------------------------
+sal_Bool CompareBookmark(const Any& aLeft, const Any& aRight)
+{
+ return ::comphelper::compare(aLeft, aRight);
+}
+
+//==============================================================================
+class FmXGridSourcePropListener : public ::comphelper::OPropertyChangeListener
+{
+ DbGridControl* m_pParent;
+
+ // a DbGridControl has no mutex, so we use our own as the base class expects one
+ osl::Mutex m_aMutex;
+ sal_Int16 m_nSuspended;
+
+public:
+ FmXGridSourcePropListener(DbGridControl* _pParent);
+
+ void suspend() { ++m_nSuspended; }
+ void resume() { --m_nSuspended; }
+
+ virtual void _propertyChanged(const PropertyChangeEvent& evt) throw( RuntimeException );
+};
+
+//------------------------------------------------------------------------------
+FmXGridSourcePropListener::FmXGridSourcePropListener(DbGridControl* _pParent)
+ :OPropertyChangeListener(m_aMutex)
+ ,m_pParent(_pParent)
+ ,m_nSuspended(0)
+{
+ DBG_ASSERT(m_pParent, "FmXGridSourcePropListener::FmXGridSourcePropListener : invalid parent !");
+}
+
+//------------------------------------------------------------------------------
+void FmXGridSourcePropListener::_propertyChanged(const PropertyChangeEvent& evt) throw( RuntimeException )
+{
+ DBG_ASSERT(m_nSuspended>=0, "FmXGridSourcePropListener::_propertyChanged : resume > suspend !");
+ if (m_nSuspended <= 0)
+ m_pParent->DataSourcePropertyChanged(evt);
+}
+
+//==============================================================================
+//------------------------------------------------------------------------------
+DbGridControl::NavigationBar::AbsolutePos::AbsolutePos(Window* pParent, WinBits nStyle)
+ :NumericField(pParent, nStyle)
+{
+ SetMin(1);
+ SetFirst(1);
+ SetSpinSize(1);
+
+ SetDecimalDigits(0);
+ SetStrictFormat(sal_True);
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::NavigationBar::AbsolutePos::KeyInput(const KeyEvent& rEvt)
+{
+ if (rEvt.GetKeyCode() == KEY_RETURN && GetText().Len())
+ {
+ sal_Int64 nRecord = GetValue();
+ if (nRecord < GetMin() || nRecord > GetMax())
+ return;
+ else
+ ((NavigationBar*)GetParent())->PositionDataSource(static_cast<sal_Int32>(nRecord));
+ }
+ else if (rEvt.GetKeyCode() == KEY_TAB)
+ GetParent()->GetParent()->GrabFocus();
+ else
+ NumericField::KeyInput(rEvt);
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::NavigationBar::AbsolutePos::LoseFocus()
+{
+ NumericField::LoseFocus();
+ sal_Int64 nRecord = GetValue();
+ if (nRecord < GetMin() || nRecord > GetMax())
+ return;
+ else
+ {
+ ((NavigationBar*)GetParent())->PositionDataSource(static_cast<sal_Int32>(nRecord));
+ ((NavigationBar*)GetParent())->InvalidateState(NavigationBar::RECORD_ABSOLUTE);
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::NavigationBar::PositionDataSource(sal_Int32 nRecord)
+{
+ if (m_bPositioning)
+ return;
+ // the MoveToPosition may cause a LoseFocus which would lead to a second MoveToPosition, so protect agains this
+ // recursion
+ // 68167 - 13.08.99 - FS
+ m_bPositioning = sal_True;
+ ((DbGridControl*)GetParent())->MoveToPosition(nRecord - 1);
+ m_bPositioning = sal_False;
+}
+
+//------------------------------------------------------------------------------
+DbGridControl::NavigationBar::NavigationBar(Window* pParent, WinBits nStyle)
+ :Control(pParent, nStyle)
+ ,m_aRecordText(this, WB_VCENTER)
+ ,m_aAbsolute(this, WB_VCENTER)
+ ,m_aRecordOf(this, WB_VCENTER)
+ ,m_aRecordCount(this, WB_CENTER | WB_VCENTER)
+ ,m_aFirstBtn(this, WB_RECTSTYLE|WB_NOPOINTERFOCUS)
+ ,m_aPrevBtn(this, WB_REPEAT|WB_RECTSTYLE|WB_NOPOINTERFOCUS)
+ ,m_aNextBtn(this, WB_REPEAT|WB_RECTSTYLE|WB_NOPOINTERFOCUS)
+ ,m_aLastBtn(this, WB_RECTSTYLE|WB_NOPOINTERFOCUS)
+ ,m_aNewBtn(this, WB_RECTSTYLE|WB_NOPOINTERFOCUS)
+ ,m_nDefaultWidth(0)
+ ,m_nCurrentPos(-1)
+ ,m_bPositioning(sal_False)
+{
+ m_aFirstBtn.SetSymbol(SYMBOL_FIRST);
+ m_aPrevBtn.SetSymbol(SYMBOL_PREV);
+ m_aNextBtn.SetSymbol(SYMBOL_NEXT);
+ m_aLastBtn.SetSymbol(SYMBOL_LAST);
+ m_aNewBtn.SetModeImage(((DbGridControl*)pParent)->GetImage(DbGridControl_Base::NEW));
+
+ m_aFirstBtn.SetHelpId(HID_GRID_TRAVEL_FIRST);
+ m_aPrevBtn.SetHelpId(HID_GRID_TRAVEL_PREV);
+ m_aNextBtn.SetHelpId(HID_GRID_TRAVEL_NEXT);
+ m_aLastBtn.SetHelpId(HID_GRID_TRAVEL_LAST);
+ m_aNewBtn.SetHelpId(HID_GRID_TRAVEL_NEW);
+ m_aAbsolute.SetHelpId(HID_GRID_TRAVEL_ABSOLUTE);
+ m_aRecordCount.SetHelpId(HID_GRID_NUMBEROFRECORDS);
+
+ // Handler fuer Buttons einrichten
+ m_aFirstBtn.SetClickHdl(LINK(this,NavigationBar,OnClick));
+ m_aPrevBtn.SetClickHdl(LINK(this,NavigationBar,OnClick));
+ m_aNextBtn.SetClickHdl(LINK(this,NavigationBar,OnClick));
+ m_aLastBtn.SetClickHdl(LINK(this,NavigationBar,OnClick));
+ m_aNewBtn.SetClickHdl(LINK(this,NavigationBar,OnClick));
+
+ m_aRecordText.SetText(XubString(SVX_RES(RID_STR_REC_TEXT)));
+ m_aRecordOf.SetText(XubString(SVX_RES(RID_STR_REC_FROM_TEXT)));
+ m_aRecordCount.SetText('?');
+
+ m_nDefaultWidth = ArrangeControls();
+
+ m_aFirstBtn.Disable();
+ m_aPrevBtn.Disable();
+ m_aNextBtn.Disable();
+ m_aLastBtn.Disable();
+ m_aNewBtn.Disable();
+ m_aRecordText.Disable();
+ m_aRecordOf.Disable();
+ m_aRecordCount.Disable();
+ m_aAbsolute.Disable();
+
+ AllSettings aSettings = m_aNextBtn.GetSettings();
+ MouseSettings aMouseSettings = aSettings.GetMouseSettings();
+ aMouseSettings.SetButtonRepeat(aMouseSettings.GetButtonRepeat() / 4);
+ aSettings.SetMouseSettings(aMouseSettings);
+ m_aNextBtn.SetSettings(aSettings, sal_True);
+ m_aPrevBtn.SetSettings(aSettings, sal_True);
+
+ m_aFirstBtn.Show();
+ m_aPrevBtn.Show();
+ m_aNextBtn.Show();
+ m_aLastBtn.Show();
+ m_aNewBtn.Show();
+ m_aRecordText.Show();
+ m_aRecordOf.Show();
+ m_aRecordCount.Show();
+ m_aAbsolute.Show();
+}
+
+namespace
+{
+ void SetPosAndSize(Button& _rButton,Point& _rPos,const Size& _rSize)
+ {
+ _rButton.SetPosPixel( _rPos );
+ _rButton.SetSizePixel( _rSize );
+ _rPos.X() += (sal_uInt16)_rSize.Width();
+ }
+}
+//------------------------------------------------------------------------------
+sal_uInt16 DbGridControl::NavigationBar::ArrangeControls()
+{
+ // Positionierung der Controls
+ // Basisgroessen ermitteln
+ sal_uInt16 nX = 0;
+ sal_uInt16 nY = 0;
+ Rectangle aRect(((DbGridControl*)GetParent())->GetControlArea());
+ const long nH = aRect.GetSize().Height();
+ Size aBorder = LogicToPixel(Size(3, 3),MAP_APPFONT);
+ aBorder = Size(CalcZoom(aBorder.Width()), CalcZoom(aBorder.Height()));
+
+ // Controls Groessen und Positionen setzen
+ //
+ XubString aText = m_aRecordText.GetText();
+ long nTextWidth = m_aRecordText.GetTextWidth(aText);
+ m_aRecordText.SetPosPixel(Point(nX,nY) );
+ m_aRecordText.SetSizePixel(Size(nTextWidth,nH));
+ nX = sal::static_int_cast< sal_uInt16 >(nX + nTextWidth + aBorder.Width());
+
+ m_aAbsolute.SetPosPixel( Point(nX,nY));
+ m_aAbsolute.SetSizePixel( Size(3*nH,aRect.GetSize().Height()) ); // Heuristik XXXXXXX
+ nX = sal::static_int_cast< sal_uInt16 >(nX + (3*nH) + aBorder.Width());
+
+ aText = m_aRecordOf.GetText();
+ nTextWidth = m_aRecordOf.GetTextWidth(aText);
+ m_aRecordOf.SetPosPixel(Point(nX,nY) );
+ m_aRecordOf.SetSizePixel(Size(nTextWidth,nH));
+ nX = sal::static_int_cast< sal_uInt16 >(nX + nTextWidth + aBorder.Width());
+
+ nTextWidth = m_aRecordCount.GetTextWidth( String::CreateFromAscii("0000000 (00000) *") );
+ m_aRecordCount.SetPosPixel(Point(nX,nY) );
+ m_aRecordCount.SetSizePixel(Size(nTextWidth,nH));
+ nX = sal::static_int_cast< sal_uInt16 >(nX + nTextWidth + aBorder.Width());
+
+ Point aButtonPos(nX,nY);
+ Size aButtonSize(nH,nH);
+ SetPosAndSize(m_aFirstBtn, aButtonPos, aButtonSize);
+ SetPosAndSize(m_aPrevBtn, aButtonPos, aButtonSize);
+ SetPosAndSize(m_aNextBtn, aButtonPos, aButtonSize);
+ SetPosAndSize(m_aLastBtn, aButtonPos, aButtonSize);
+ SetPosAndSize(m_aNewBtn, aButtonPos, aButtonSize);
+
+ nX = sal::static_int_cast< sal_uInt16 >(
+ aButtonPos.X() + (sal_uInt16)(nH + aBorder.Width()));
+
+ // Ist der Font des Edits groesser als das Feld?
+ Font aOutputFont = m_aAbsolute.GetFont();
+ if (aOutputFont.GetSize().Height() > nH)
+ {
+ Font aApplFont = OutputDevice::GetDefaultFont(
+ DEFAULTFONT_SANS_UNICODE,
+ Application::GetSettings().GetUILanguage(),
+ DEFAULTFONT_FLAGS_ONLYONE,
+ this
+ );
+ aApplFont.SetSize( Size( 0, nH - 2 ) );
+ m_aAbsolute.SetControlFont( aApplFont );
+
+ aApplFont.SetTransparent( sal_True );
+ m_aRecordText.SetControlFont( aApplFont );
+ m_aRecordOf.SetControlFont( aApplFont );
+ m_aRecordCount.SetControlFont( aApplFont );
+ }
+ return nX;
+}
+
+//------------------------------------------------------------------------------
+IMPL_LINK(DbGridControl::NavigationBar, OnClick, Button *, pButton )
+{
+ DbGridControl* pParent = (DbGridControl*)GetParent();
+
+ if (pParent->m_aMasterSlotExecutor.IsSet())
+ {
+ long lResult = 0;
+ if (pButton == &m_aFirstBtn)
+ lResult = pParent->m_aMasterSlotExecutor.Call((void*)RECORD_FIRST);
+ else if( pButton == &m_aPrevBtn )
+ lResult = pParent->m_aMasterSlotExecutor.Call((void*)RECORD_PREV);
+ else if( pButton == &m_aNextBtn )
+ lResult = pParent->m_aMasterSlotExecutor.Call((void*)RECORD_NEXT);
+ else if( pButton == &m_aLastBtn )
+ lResult = pParent->m_aMasterSlotExecutor.Call((void*)RECORD_LAST);
+ else if( pButton == &m_aNewBtn )
+ lResult = pParent->m_aMasterSlotExecutor.Call((void*)RECORD_NEW);
+
+ if (lResult)
+ // the link already handled it
+ return 0;
+ }
+
+ if (pButton == &m_aFirstBtn)
+ pParent->MoveToFirst();
+ else if( pButton == &m_aPrevBtn )
+ pParent->MoveToPrev();
+ else if( pButton == &m_aNextBtn )
+ pParent->MoveToNext();
+ else if( pButton == &m_aLastBtn )
+ pParent->MoveToLast();
+ else if( pButton == &m_aNewBtn )
+ pParent->AppendNew();
+ return 0;
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::NavigationBar::InvalidateAll(sal_Int32 nCurrentPos, sal_Bool bAll)
+{
+ if (m_nCurrentPos != nCurrentPos || nCurrentPos < 0 || bAll)
+ {
+ DbGridControl* pParent = (DbGridControl*)GetParent();
+
+ sal_Int32 nAdjustedRowCount = pParent->GetRowCount() - ((pParent->GetOptions() & DbGridControl::OPT_INSERT) ? 2 : 1);
+
+ // Wann mu� alles invalidiert werden
+ bAll = bAll || m_nCurrentPos <= 0;
+ bAll = bAll || nCurrentPos <= 0;
+ bAll = bAll || m_nCurrentPos >= nAdjustedRowCount;
+ bAll = bAll || nCurrentPos >= nAdjustedRowCount;
+
+ if ( bAll )
+ {
+ m_nCurrentPos = nCurrentPos;
+ int i = 0;
+ while (ControlMap[i])
+ SetState(ControlMap[i++]);
+ }
+ else // befindet sich in der Mitte
+ {
+ m_nCurrentPos = nCurrentPos;
+ SetState(NavigationBar::RECORD_COUNT);
+ SetState(NavigationBar::RECORD_ABSOLUTE);
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+sal_Bool DbGridControl::NavigationBar::GetState(sal_uInt16 nWhich) const
+{
+ DbGridControl* pParent = (DbGridControl*)GetParent();
+
+ if (!pParent->IsOpen() || pParent->IsDesignMode() || !pParent->IsEnabled()
+ || pParent->IsFilterMode() )
+ return sal_False;
+ else
+ {
+ // check if we have a master state provider
+ if (pParent->m_aMasterStateProvider.IsSet())
+ {
+ long nState = pParent->m_aMasterStateProvider.Call(reinterpret_cast< void* >( nWhich ) );
+ if (nState>=0)
+ return (nState>0);
+ }
+
+ sal_Bool bAvailable = sal_True;
+
+ switch (nWhich)
+ {
+ case NavigationBar::RECORD_FIRST:
+ case NavigationBar::RECORD_PREV:
+ bAvailable = m_nCurrentPos > 0;
+ break;
+ case NavigationBar::RECORD_NEXT:
+ if(pParent->m_bRecordCountFinal)
+ {
+ bAvailable = m_nCurrentPos < pParent->GetRowCount() - 1;
+ if (!bAvailable && pParent->GetOptions() & DbGridControl::OPT_INSERT)
+ bAvailable = (m_nCurrentPos == pParent->GetRowCount() - 2) && pParent->IsModified();
+ }
+ break;
+ case NavigationBar::RECORD_LAST:
+ if(pParent->m_bRecordCountFinal)
+ {
+ if (pParent->GetOptions() & DbGridControl::OPT_INSERT)
+ bAvailable = pParent->IsCurrentAppending() ? pParent->GetRowCount() > 1 :
+ m_nCurrentPos != pParent->GetRowCount() - 2;
+ else
+ bAvailable = m_nCurrentPos != pParent->GetRowCount() - 1;
+ }
+ break;
+ case NavigationBar::RECORD_NEW:
+ bAvailable = (pParent->GetOptions() & DbGridControl::OPT_INSERT) && pParent->GetRowCount() && m_nCurrentPos < pParent->GetRowCount() - 1;
+ break;
+ case NavigationBar::RECORD_ABSOLUTE:
+ bAvailable = pParent->GetRowCount() > 0;
+ break;
+ }
+ return bAvailable;
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::NavigationBar::SetState(sal_uInt16 nWhich)
+{
+ sal_Bool bAvailable = GetState(nWhich);
+ DbGridControl* pParent = (DbGridControl*)GetParent();
+ Window* pWnd = NULL;
+ switch (nWhich)
+ {
+ case NavigationBar::RECORD_FIRST:
+ pWnd = &m_aFirstBtn;
+ break;
+ case NavigationBar::RECORD_PREV:
+ pWnd = &m_aPrevBtn;
+ break;
+ case NavigationBar::RECORD_NEXT:
+ pWnd = &m_aNextBtn;
+ break;
+ case NavigationBar::RECORD_LAST:
+ pWnd = &m_aLastBtn;
+ break;
+ case NavigationBar::RECORD_NEW:
+ pWnd = &m_aNewBtn;
+ break;
+ case NavigationBar::RECORD_ABSOLUTE:
+ pWnd = &m_aAbsolute;
+ if (bAvailable)
+ {
+ if (pParent->m_nTotalCount >= 0)
+ {
+ if (pParent->IsCurrentAppending())
+ m_aAbsolute.SetMax(pParent->m_nTotalCount + 1);
+ else
+ m_aAbsolute.SetMax(pParent->m_nTotalCount);
+ }
+ else
+ m_aAbsolute.SetMax(LONG_MAX);
+
+ m_aAbsolute.SetValue(m_nCurrentPos + 1);
+ }
+ else
+ m_aAbsolute.SetText(String());
+ break;
+ case NavigationBar::RECORD_TEXT:
+ pWnd = &m_aRecordText;
+ break;
+ case NavigationBar::RECORD_OF:
+ pWnd = &m_aRecordOf;
+ break;
+ case NavigationBar::RECORD_COUNT:
+ {
+ pWnd = &m_aRecordCount;
+ String aText;
+ if (bAvailable)
+ {
+ if (pParent->GetOptions() & DbGridControl::OPT_INSERT)
+ {
+ if (pParent->IsCurrentAppending() && !pParent->IsModified())
+ aText = String::CreateFromInt32(pParent->GetRowCount());
+ else
+ aText = String::CreateFromInt32(pParent->GetRowCount() - 1);
+ }
+ else
+ aText = String::CreateFromInt32(pParent->GetRowCount());
+ if(!pParent->m_bRecordCountFinal)
+ aText += String::CreateFromAscii(" *");
+ }
+ else
+ aText = String();
+
+ // add the number of selected rows, if applicable
+ if (pParent->GetSelectRowCount())
+ {
+ String aExtendedInfo(aText);
+ aExtendedInfo.AppendAscii(" (");
+ aExtendedInfo += String::CreateFromInt32(pParent->GetSelectRowCount());
+ aExtendedInfo += ')';
+ pWnd->SetText(aExtendedInfo);
+ }
+ else
+ pWnd->SetText(aText);
+
+ pParent->SetRealRowCount(aText);
+ } break;
+ }
+ DBG_ASSERT(pWnd, "kein Fenster");
+ if (pWnd && (pWnd->IsEnabled() != bAvailable))
+ // this "pWnd->IsEnabled() != bAvailable" is a little hack : Window::Enable always generates a user
+ // event (ImplGenerateMouseMove) even if nothing happened. This may lead to some unwanted effects, so we
+ // do this check.
+ // For further explanation see Bug 69900.
+ // FS - 18.11.99
+ pWnd->Enable(bAvailable);
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::NavigationBar::Resize()
+{
+ Control::Resize();
+ ArrangeControls();
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::NavigationBar::Paint(const Rectangle& rRect)
+{
+ Control::Paint(rRect);
+ Point aAbsolutePos = m_aAbsolute.GetPosPixel();
+ Size aAbsoluteSize = m_aAbsolute.GetSizePixel();
+
+ DrawLine(Point(aAbsolutePos.X() - 1, 0 ),
+ Point(aAbsolutePos.X() - 1, aAbsolutePos.Y() + aAbsoluteSize.Height()));
+
+ DrawLine(Point(aAbsolutePos.X() + aAbsoluteSize.Width() + 1, 0 ),
+ Point(aAbsolutePos.X() + aAbsoluteSize.Width() + 1, aAbsolutePos.Y() + aAbsoluteSize.Height()));
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::NavigationBar::StateChanged( StateChangedType nType )
+{
+ Control::StateChanged( nType );
+
+ Window* pWindows[] = { &m_aRecordText,
+ &m_aAbsolute,
+ &m_aRecordOf,
+ &m_aRecordCount,
+ &m_aFirstBtn,
+ &m_aPrevBtn,
+ &m_aNextBtn,
+ &m_aLastBtn,
+ &m_aNewBtn
+ };
+
+ switch ( nType )
+ {
+ case STATE_CHANGE_MIRRORING:
+ {
+ sal_Bool bIsRTLEnabled = IsRTLEnabled();
+ for ( size_t i=0; i < sizeof( pWindows ) / sizeof( pWindows[0] ); ++i )
+ pWindows[i]->EnableRTL( bIsRTLEnabled );
+ }
+ break;
+
+ case STATE_CHANGE_ZOOM:
+ {
+ Fraction aZoom = GetZoom();
+
+ // not all of these controls need to know the new zoom, but to be sure ...
+ Font aFont( GetSettings().GetStyleSettings().GetFieldFont() );
+ if ( IsControlFont() )
+ aFont.Merge( GetControlFont() );
+
+ for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i)
+ {
+ pWindows[i]->SetZoom(aZoom);
+ pWindows[i]->SetZoomedPointFont(aFont);
+ }
+
+ SetZoomedPointFont( aFont );
+
+ // rearrange the controls
+ m_nDefaultWidth = ArrangeControls();
+ }
+ break;
+ }
+}
+
+//------------------------------------------------------------------------------
+DbGridRow::DbGridRow(CursorWrapper* pCur, sal_Bool bPaintCursor)
+ :m_bIsNew(sal_False)
+{
+
+ if (pCur && pCur->Is())
+ {
+ Reference< XIndexAccess > xColumns(pCur->getColumns(), UNO_QUERY);
+ DataColumn* pColumn;
+ for (sal_Int32 i = 0; i < xColumns->getCount(); ++i)
+ {
+ Reference< XPropertySet > xColSet;
+ ::cppu::extractInterface(xColSet, xColumns->getByIndex(i));
+ pColumn = new DataColumn(xColSet);
+ m_aVariants.Insert(pColumn, LIST_APPEND);
+ }
+
+ if (pCur->rowDeleted())
+ m_eStatus = GRS_DELETED;
+ else
+ {
+ if (bPaintCursor)
+ m_eStatus = (pCur->isAfterLast() || pCur->isBeforeFirst()) ? GRS_INVALID : GRS_CLEAN;
+ else
+ {
+ Reference< XPropertySet > xSet = pCur->getPropertySet();
+ if (xSet.is())
+ {
+ m_bIsNew = ::comphelper::getBOOL(xSet->getPropertyValue(FM_PROP_ISNEW));
+ if (!m_bIsNew && (pCur->isAfterLast() || pCur->isBeforeFirst()))
+ m_eStatus = GRS_INVALID;
+ else if (::comphelper::getBOOL(xSet->getPropertyValue(FM_PROP_ISMODIFIED)))
+ m_eStatus = GRS_MODIFIED;
+ else
+ m_eStatus = GRS_CLEAN;
+ }
+ else
+ m_eStatus = GRS_INVALID;
+ }
+ }
+ if (!m_bIsNew && IsValid())
+ m_aBookmark = pCur->getBookmark();
+ else
+ m_aBookmark = Any();
+ }
+ else
+ m_eStatus = GRS_INVALID;
+}
+
+//------------------------------------------------------------------------------
+DbGridRow::~DbGridRow()
+{
+ sal_uInt32 nCount = m_aVariants.Count();
+ for (sal_uInt32 i = 0; i < nCount; i++)
+ delete m_aVariants.GetObject(i);
+}
+
+//------------------------------------------------------------------------------
+void DbGridRow::SetState(CursorWrapper* pCur, sal_Bool bPaintCursor)
+{
+ if (pCur && pCur->Is())
+ {
+ if (pCur->rowDeleted())
+ {
+ m_eStatus = GRS_DELETED;
+ m_bIsNew = sal_False;
+ }
+ else
+ {
+ m_eStatus = GRS_CLEAN;
+ if (!bPaintCursor)
+ {
+ Reference< XPropertySet > xSet = pCur->getPropertySet();
+ DBG_ASSERT(xSet.is(), "DbGridRow::SetState : invalid cursor !");
+
+ if (::comphelper::getBOOL(xSet->getPropertyValue(FM_PROP_ISMODIFIED)))
+ m_eStatus = GRS_MODIFIED;
+ m_bIsNew = ::comphelper::getBOOL(xSet->getPropertyValue(FM_PROP_ISNEW));
+ }
+ else
+ m_bIsNew = sal_False;
+ }
+
+ try
+ {
+ if (!m_bIsNew && IsValid())
+ m_aBookmark = pCur->getBookmark();
+ else
+ m_aBookmark = Any();
+ }
+ catch(SQLException&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ m_aBookmark = Any();
+ m_eStatus = GRS_INVALID;
+ m_bIsNew = sal_False;
+ }
+ }
+ else
+ {
+ m_aBookmark = Any();
+ m_eStatus = GRS_INVALID;
+ m_bIsNew = sal_False;
+ }
+}
+
+DBG_NAME(DbGridControl);
+//------------------------------------------------------------------------------
+DbGridControl::DbGridControl(
+ Reference< XMultiServiceFactory > _rxFactory,
+ Window* pParent,
+ WinBits nBits)
+ :DbGridControl_Base(pParent, EBBF_NONE, nBits, DEFAULT_BROWSE_MODE )
+ ,m_xServiceFactory(_rxFactory)
+ ,m_aBar(this)
+ ,m_nAsynAdjustEvent(0)
+ ,m_pDataSourcePropMultiplexer(NULL)
+ ,m_pDataSourcePropListener(NULL)
+ ,m_pFieldListeners(NULL)
+ ,m_pCursorDisposeListener(NULL)
+ ,m_pGridListener(NULL)
+ ,m_pDataCursor(NULL)
+ ,m_pSeekCursor(NULL)
+ ,m_nSeekPos(-1)
+ ,m_nTotalCount(-1)
+ ,m_aNullDate(OTypeConversionClient().getStandardDate())
+ ,m_nMode(DEFAULT_BROWSE_MODE)
+ ,m_nCurrentPos(-1)
+ ,m_nDeleteEvent(0)
+ ,m_nOptions(OPT_READONLY)
+ ,m_nOptionMask(OPT_INSERT | OPT_UPDATE | OPT_DELETE)
+ ,m_nLastColId((sal_uInt16)-1)
+ ,m_nLastRowId(-1)
+ ,m_bDesignMode(sal_False)
+ ,m_bRecordCountFinal(sal_False)
+ ,m_bMultiSelection(sal_True)
+ ,m_bNavigationBar(sal_True)
+ ,m_bSynchDisplay(sal_True)
+ ,m_bForceROController(sal_False)
+ ,m_bHandle(sal_True)
+ ,m_bFilterMode(sal_False)
+ ,m_bWantDestruction(sal_False)
+ ,m_bInAdjustDataSource(sal_False)
+ ,m_bPendingAdjustRows(sal_False)
+ ,m_bHideScrollbars( sal_False )
+ ,m_bUpdating(sal_False)
+{
+ DBG_CTOR(DbGridControl,NULL);
+
+ String sName(SVX_RES(RID_STR_NAVIGATIONBAR));
+ m_aBar.SetAccessibleName(sName);
+ m_aBar.Show();
+ ImplInitWindow( InitAll );
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::InsertHandleColumn()
+{
+ // Handle Column einfuegen
+ // Da die BrowseBox ohne handleColums Paintprobleme hat
+ // wird diese versteckt
+ if (HasHandle())
+ BrowseBox::InsertHandleColumn(GetDefaultColumnWidth(String()));
+ else
+ BrowseBox::InsertHandleColumn(0);
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::Init()
+{
+ BrowserHeader* pNewHeader = CreateHeaderBar(this);
+ pHeader->SetMouseTransparent(sal_False);
+
+ SetHeaderBar(pNewHeader);
+ SetMode(m_nMode);
+ SetCursorColor(Color(0xFF, 0, 0));
+
+ InsertHandleColumn();
+}
+
+//------------------------------------------------------------------------------
+DbGridControl::~DbGridControl()
+{
+ RemoveColumns();
+
+ {
+ m_bWantDestruction = sal_True;
+ osl::MutexGuard aGuard(m_aDestructionSafety);
+ if (m_pFieldListeners)
+ DisconnectFromFields();
+ if (m_pCursorDisposeListener)
+ {
+ delete m_pCursorDisposeListener;
+ m_pCursorDisposeListener = NULL;
+ }
+ }
+
+ if (m_nDeleteEvent)
+ Application::RemoveUserEvent(m_nDeleteEvent);
+
+ if (m_pDataSourcePropMultiplexer)
+ {
+ m_pDataSourcePropMultiplexer->dispose();
+ m_pDataSourcePropMultiplexer->release(); // this should delete the multiplexer
+ delete m_pDataSourcePropListener;
+ m_pDataSourcePropMultiplexer = NULL;
+ m_pDataSourcePropListener = NULL;
+ }
+ m_xRowSetListener.clear();
+
+ delete m_pDataCursor;
+ delete m_pSeekCursor;
+
+ DBG_DTOR(DbGridControl,NULL);
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::StateChanged( StateChangedType nType )
+{
+ DbGridControl_Base::StateChanged( nType );
+
+ switch (nType)
+ {
+ case STATE_CHANGE_MIRRORING:
+ ImplInitWindow( InitWritingMode );
+ Invalidate();
+ break;
+
+ case STATE_CHANGE_ZOOM:
+ {
+ ImplInitWindow( InitFont );
+
+ // and give it a chance to rearrange
+ Point aPoint = GetControlArea().TopLeft();
+ sal_uInt16 nX = (sal_uInt16)aPoint.X();
+ ArrangeControls(nX, (sal_uInt16)aPoint.Y());
+ ReserveControlArea((sal_uInt16)nX);
+ }
+ break;
+ case STATE_CHANGE_CONTROLFONT:
+ ImplInitWindow( InitFont );
+ Invalidate();
+ break;
+ case STATE_CHANGE_CONTROLFOREGROUND:
+ ImplInitWindow( InitForeground );
+ Invalidate();
+ break;
+ case STATE_CHANGE_CONTROLBACKGROUND:
+ ImplInitWindow( InitBackground );
+ Invalidate();
+ break;
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ DbGridControl_Base::DataChanged( rDCEvt );
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS ) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ ImplInitWindow( InitAll );
+ Invalidate();
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::Select()
+{
+ DbGridControl_Base::Select();
+
+ // as the selected rows may have changed, udate the according display in our navigation bar
+ m_aBar.InvalidateState(NavigationBar::RECORD_COUNT);
+
+ if (m_pGridListener)
+ m_pGridListener->selectionChanged();
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::ImplInitWindow( const InitWindowFacet _eInitWhat )
+{
+ for ( sal_uInt32 i = 0; i < m_aColumns.Count(); ++i )
+ {
+ DbGridColumn* pCol = m_aColumns.GetObject(i);
+ if (pCol)
+ pCol->ImplInitWindow( GetDataWindow(), _eInitWhat );
+ }
+
+ if ( ( _eInitWhat & InitWritingMode ) != 0 )
+ {
+ if ( m_bNavigationBar )
+ {
+ m_aBar.EnableRTL( IsRTLEnabled() );
+ }
+ }
+
+ if ( ( _eInitWhat & InitFont ) != 0 )
+ {
+ if ( m_bNavigationBar )
+ {
+ Font aFont = m_aBar.GetSettings().GetStyleSettings().GetFieldFont();
+ if ( IsControlFont() )
+ m_aBar.SetControlFont( GetControlFont() );
+ else
+ m_aBar.SetControlFont();
+
+ m_aBar.SetZoom( GetZoom() );
+ }
+ }
+
+ if ( ( _eInitWhat & InitBackground ) != 0 )
+ {
+ if (IsControlBackground())
+ {
+ GetDataWindow().SetBackground(GetControlBackground());
+ GetDataWindow().SetControlBackground(GetControlBackground());
+ GetDataWindow().SetFillColor(GetControlBackground());
+ }
+ else
+ {
+ GetDataWindow().SetControlBackground();
+ GetDataWindow().SetFillColor(GetFillColor());
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::RemoveRows(sal_Bool bNewCursor)
+{
+ // Hat sich der DatenCursor verandert ?
+ if (!bNewCursor)
+ {
+ DELETEZ(m_pSeekCursor);
+ m_xPaintRow = m_xDataRow = m_xEmptyRow = m_xCurrentRow = m_xSeekRow = NULL;
+ m_nCurrentPos = m_nSeekPos = -1;
+ m_nOptions = OPT_READONLY;
+
+ RowRemoved(0, GetRowCount(), sal_False);
+ m_nTotalCount = -1;
+ }
+ else
+ {
+ RemoveRows();
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::RemoveRows()
+{
+ // we're going to remove all columns and all row, so deactivate the current cell
+ if (IsEditing())
+ DeactivateCell();
+
+ // alle Columns deinitialisieren
+ // existieren Spalten, dann alle Controller freigeben
+ for (sal_uInt32 i = 0; i < m_aColumns.Count(); i++)
+ m_aColumns.GetObject(i)->Clear();
+
+ DELETEZ(m_pSeekCursor);
+ DELETEZ(m_pDataCursor);
+
+ m_xPaintRow = m_xDataRow = m_xEmptyRow = m_xCurrentRow = m_xSeekRow = NULL;
+ m_nCurrentPos = m_nSeekPos = m_nTotalCount = -1;
+ m_nOptions = OPT_READONLY;
+
+ // Anzahl Saetze im Browser auf 0 zuruecksetzen
+ DbGridControl_Base::RemoveRows();
+ m_aBar.InvalidateAll(m_nCurrentPos, sal_True);
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::ArrangeControls(sal_uInt16& nX, sal_uInt16 nY)
+{
+ // Positionierung der Controls
+ if (m_bNavigationBar)
+ {
+ nX = m_aBar.GetDefaultWidth();
+ Rectangle aRect(GetControlArea());
+ m_aBar.SetPosSizePixel(Point(0,nY + 1), Size(nX, aRect.GetSize().Height() - 1));
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::EnableHandle(sal_Bool bEnable)
+{
+ if (m_bHandle == bEnable)
+ return;
+
+ // HandleColumn wird nur ausgeblendet,
+ // da es sonst etliche Probleme mit dem Zeichnen gibt
+ RemoveColumn(0);
+ m_bHandle = bEnable;
+ InsertHandleColumn();
+}
+
+//------------------------------------------------------------------------------
+namespace
+{
+ bool adjustModeForScrollbars( BrowserMode& _rMode, sal_Bool _bNavigationBar, sal_Bool _bHideScrollbars )
+ {
+ BrowserMode nOldMode = _rMode;
+
+ if ( !_bNavigationBar )
+ {
+ _rMode &= ~BROWSER_AUTO_HSCROLL;
+ }
+
+ if ( _bHideScrollbars )
+ {
+ _rMode |= ( BROWSER_NO_HSCROLL | BROWSER_NO_VSCROLL );
+ _rMode &= ~( BROWSER_AUTO_HSCROLL | BROWSER_AUTO_VSCROLL );
+ }
+ else
+ {
+ _rMode |= ( BROWSER_AUTO_HSCROLL | BROWSER_AUTO_VSCROLL );
+ _rMode &= ~( BROWSER_NO_HSCROLL | BROWSER_NO_VSCROLL );
+ }
+
+ // note: if we have a navigation bar, we always have a AUTO_HSCROLL. In particular,
+ // _bHideScrollbars is ignored then
+ if ( _bNavigationBar )
+ {
+ _rMode |= BROWSER_AUTO_HSCROLL;
+ _rMode &= ~BROWSER_NO_HSCROLL;
+ }
+
+ return nOldMode != _rMode;
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::EnableNavigationBar(sal_Bool bEnable)
+{
+ if (m_bNavigationBar == bEnable)
+ return;
+
+ m_bNavigationBar = bEnable;
+
+ if (bEnable)
+ {
+ m_aBar.Show();
+ m_aBar.Enable();
+ m_aBar.InvalidateAll(m_nCurrentPos, sal_True);
+
+ if ( adjustModeForScrollbars( m_nMode, m_bNavigationBar, m_bHideScrollbars ) )
+ SetMode( m_nMode );
+
+ // liefert die Groe�e der Reserved ControlArea
+ Point aPoint = GetControlArea().TopLeft();
+ sal_uInt16 nX = (sal_uInt16)aPoint.X();
+
+ ArrangeControls(nX, (sal_uInt16)aPoint.Y());
+ ReserveControlArea((sal_uInt16)nX);
+ }
+ else
+ {
+ m_aBar.Hide();
+ m_aBar.Disable();
+
+ if ( adjustModeForScrollbars( m_nMode, m_bNavigationBar, m_bHideScrollbars ) )
+ SetMode( m_nMode );
+
+ ReserveControlArea();
+ }
+}
+
+//------------------------------------------------------------------------------
+sal_uInt16 DbGridControl::SetOptions(sal_uInt16 nOpt)
+{
+ DBG_ASSERT(!m_xCurrentRow || !m_xCurrentRow->IsModified(),
+ "DbGridControl::SetOptions : please do not call when editing a record (things are much easier this way ;) !");
+
+ // for the next setDataSource (which is triggered by a refresh, for instance)
+ m_nOptionMask = nOpt;
+
+ // normalize the new options
+ Reference< XPropertySet > xDataSourceSet = m_pDataCursor->getPropertySet();
+ if (xDataSourceSet.is())
+ {
+ // feststellen welche Updatem�glichkeiten bestehen
+ sal_Int32 nPrivileges = 0;
+ xDataSourceSet->getPropertyValue(FM_PROP_PRIVILEGES) >>= nPrivileges;
+ if ((nPrivileges & Privilege::INSERT) == 0)
+ nOpt &= ~OPT_INSERT;
+ if ((nPrivileges & Privilege::UPDATE) == 0)
+ nOpt &= ~OPT_UPDATE;
+ if ((nPrivileges & Privilege::DELETE) == 0)
+ nOpt &= ~OPT_DELETE;
+ }
+ else
+ nOpt = OPT_READONLY;
+
+ // need to do something after that ?
+ if (nOpt == m_nOptions)
+ return m_nOptions;
+
+ // the 'update' option only affects our BrowserMode (with or w/o focus rect)
+ BrowserMode nNewMode = m_nMode;
+ if ((m_nMode & BROWSER_CURSOR_WO_FOCUS) == 0)
+ {
+ if (nOpt & OPT_UPDATE)
+ nNewMode |= BROWSER_HIDECURSOR;
+ else
+ nNewMode &= ~BROWSER_HIDECURSOR;
+ }
+ else
+ nNewMode &= ~BROWSER_HIDECURSOR;
+ // should not be neccessary if EnablePermanentCursor is used to change the cursor behaviour, but to be sure ...
+
+ if (nNewMode != m_nMode)
+ {
+ SetMode(nNewMode);
+ m_nMode = nNewMode;
+ }
+
+ // _after_ setting the mode because this results in an ActivateCell
+ DeactivateCell();
+
+ sal_Bool bInsertChanged = (nOpt & OPT_INSERT) != (m_nOptions & OPT_INSERT);
+ m_nOptions = nOpt;
+ // we need to set this before the code below because it indirectly uses m_nOptions
+
+ // the 'insert' option affects our empty row
+ if (bInsertChanged)
+ {
+ if (m_nOptions & OPT_INSERT)
+ { // the insert option is to be set
+ m_xEmptyRow = new DbGridRow();
+ RowInserted(GetRowCount(), 1, sal_True);
+ }
+ else
+ { // the insert option is to be reset
+ m_xEmptyRow = NULL;
+ if ((GetCurRow() == GetRowCount() - 1) && (GetCurRow() > 0))
+ GoToRowColumnId(GetCurRow() - 1, GetCurColumnId());
+ RowRemoved(GetRowCount(), 1, sal_True);
+ }
+ }
+
+ // the 'delete' options has no immediate consequences
+
+ ActivateCell();
+ Invalidate();
+ return m_nOptions;
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::ForceHideScrollbars( sal_Bool _bForce )
+{
+ if ( m_bHideScrollbars == _bForce )
+ return;
+
+ m_bHideScrollbars = _bForce;
+
+ if ( adjustModeForScrollbars( m_nMode, m_bNavigationBar, m_bHideScrollbars ) )
+ SetMode( m_nMode );
+}
+
+//------------------------------------------------------------------------------
+sal_Bool DbGridControl::IsForceHideScrollbars() const
+{
+ return m_bHideScrollbars;
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::EnablePermanentCursor(sal_Bool bEnable)
+{
+ if (IsPermanentCursorEnabled() == bEnable)
+ return;
+
+ if (bEnable)
+ {
+ m_nMode &= ~BROWSER_HIDECURSOR; // without this BROWSER_CURSOR_WO_FOCUS won't have any affect
+ m_nMode |= BROWSER_CURSOR_WO_FOCUS;
+ }
+ else
+ {
+ if (m_nOptions & OPT_UPDATE)
+ m_nMode |= BROWSER_HIDECURSOR; // no cursor at all
+ else
+ m_nMode &= ~BROWSER_HIDECURSOR; // at least the "non-permanent" cursor
+
+ m_nMode &= ~BROWSER_CURSOR_WO_FOCUS;
+ }
+ SetMode(m_nMode);
+
+ sal_Bool bWasEditing = IsEditing();
+ DeactivateCell();
+ if (bWasEditing)
+ ActivateCell();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool DbGridControl::IsPermanentCursorEnabled() const
+{
+ return ((m_nMode & BROWSER_CURSOR_WO_FOCUS) != 0) && ((m_nMode & BROWSER_HIDECURSOR) == 0);
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::refreshController(sal_uInt16 _nColId, GrantControlAccess /*_aAccess*/)
+{
+ if ((GetCurColumnId() == _nColId) && IsEditing())
+ { // the controller which is currently active needs to be refreshed
+ DeactivateCell();
+ ActivateCell();
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::SetMultiSelection(sal_Bool bMulti)
+{
+ m_bMultiSelection = bMulti;
+ if (m_bMultiSelection)
+ m_nMode |= BROWSER_MULTISELECTION;
+ else
+ m_nMode &= ~BROWSER_MULTISELECTION;
+
+ SetMode(m_nMode);
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::setDataSource(const Reference< XRowSet >& _xCursor, sal_uInt16 nOpts)
+{
+ if (!_xCursor.is() && !m_pDataCursor)
+ return;
+
+ if (m_pDataSourcePropMultiplexer)
+ {
+ m_pDataSourcePropMultiplexer->dispose();
+ m_pDataSourcePropMultiplexer->release(); // this should delete the multiplexer
+ delete m_pDataSourcePropListener;
+ m_pDataSourcePropMultiplexer = NULL;
+ m_pDataSourcePropListener = NULL;
+ }
+ m_xRowSetListener.clear();
+
+ // is the new cursor valid ?
+ // the cursor is only valid if it contains some columns
+ // if there is no cursor or the cursor is not valid we have to clean up an leave
+ if (!_xCursor.is() || !Reference< XColumnsSupplier > (_xCursor, UNO_QUERY)->getColumns()->hasElements())
+ {
+ RemoveRows();
+ return;
+ }
+
+ // Hat sich der DatenCursor verandert ?
+ sal_uInt16 nCurPos = GetColumnPos(GetCurColumnId());
+
+ SetUpdateMode(sal_False);
+ RemoveRows();
+ DisconnectFromFields();
+
+ DELETEZ(m_pCursorDisposeListener);
+
+ {
+ ::osl::MutexGuard aGuard(m_aAdjustSafety);
+ if (m_nAsynAdjustEvent)
+ {
+ // the adjust was thought to work with the old cursor which we don't have anymore
+ RemoveUserEvent(m_nAsynAdjustEvent);
+ m_nAsynAdjustEvent = 0;
+ }
+ }
+
+ // get a new formatter and data cursor
+ m_xFormatter = NULL;
+ OStaticDataAccessTools aStaticTools;
+ Reference< ::com::sun::star::util::XNumberFormatsSupplier > xSupplier = aStaticTools.getNumberFormats(aStaticTools.getRowSetConnection(_xCursor), sal_True);
+ if (xSupplier.is() && m_xServiceFactory.is())
+ {
+ m_xFormatter = Reference< ::com::sun::star::util::XNumberFormatter >(
+ m_xServiceFactory->createInstance(FM_NUMBER_FORMATTER),
+ UNO_QUERY);
+ if (m_xFormatter.is())
+ {
+ m_xFormatter->attachNumberFormatsSupplier(xSupplier);
+
+ // retrieve the datebase of the Numberformatter
+ try
+ {
+ xSupplier->getNumberFormatSettings()->getPropertyValue(rtl::OUString::createFromAscii("NullDate")) >>= m_aNullDate;
+ }
+ catch(Exception&)
+ {
+ }
+ }
+ }
+
+ m_pDataCursor = new CursorWrapper(_xCursor);
+
+ // now create a cursor for painting rows
+ // we need that cursor only if we are not in insert only mode
+ Reference< XResultSet > xClone;
+ Reference< XResultSetAccess > xAccess( _xCursor, UNO_QUERY );
+ try
+ {
+ xClone = xAccess.is() ? xAccess->createResultSet() : Reference< XResultSet > ();
+ }
+ catch(Exception&)
+ {
+ }
+ if (xClone.is())
+ m_pSeekCursor = new CursorWrapper(xClone);
+
+ // property listening on the data source
+ // (Normally one class would be sufficient : the multiplexer which could forward the property change to us.
+ // But for that we would have been derived from ::comphelper::OPropertyChangeListener, which isn't exported.
+ // So we introduce a second class, which is a ::comphelper::OPropertyChangeListener (in the implementation file we know this class)
+ // and forwards the property changes to a our special method "DataSourcePropertyChanged".)
+ if (m_pDataCursor)
+ {
+ m_pDataSourcePropListener = new FmXGridSourcePropListener(this);
+ m_pDataSourcePropMultiplexer = new ::comphelper::OPropertyChangeMultiplexer(m_pDataSourcePropListener, m_pDataCursor->getPropertySet() );
+ m_pDataSourcePropMultiplexer->acquire();
+ m_pDataSourcePropMultiplexer->addProperty(FM_PROP_ISMODIFIED);
+ m_pDataSourcePropMultiplexer->addProperty(FM_PROP_ISNEW);
+ }
+
+ BrowserMode nOldMode = m_nMode;
+ if (m_pSeekCursor)
+ {
+ try
+ {
+ Reference< XPropertySet > xSet(_xCursor, UNO_QUERY);
+ if (xSet.is())
+ {
+ // feststellen welche Updatemoeglichkeiten bestehen
+ sal_Int32 nConcurrency = ResultSetConcurrency::READ_ONLY;
+ xSet->getPropertyValue(FM_PROP_RESULTSET_CONCURRENCY) >>= nConcurrency;
+
+ if ( ResultSetConcurrency::UPDATABLE == nConcurrency )
+ {
+ sal_Int32 nPrivileges = 0;
+ xSet->getPropertyValue(FM_PROP_PRIVILEGES) >>= nPrivileges;
+
+ // Insert Option should be set if insert only otherwise you won't see any rows
+ // and no insertion is possible
+ if ((m_nOptionMask & OPT_INSERT) && ((nPrivileges & Privilege::INSERT) == Privilege::INSERT) && (nOpts & OPT_INSERT))
+ m_nOptions |= OPT_INSERT;
+ if ((m_nOptionMask & OPT_UPDATE) && ((nPrivileges & Privilege::UPDATE) == Privilege::UPDATE) && (nOpts & OPT_UPDATE))
+ m_nOptions |= OPT_UPDATE;
+ if ((m_nOptionMask & OPT_DELETE) && ((nPrivileges & Privilege::DELETE) == Privilege::DELETE) && (nOpts & OPT_DELETE))
+ m_nOptions |= OPT_DELETE;
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ sal_Bool bPermanentCursor = IsPermanentCursorEnabled();
+ m_nMode = DEFAULT_BROWSE_MODE;
+
+ if ( bPermanentCursor )
+ {
+ m_nMode |= BROWSER_CURSOR_WO_FOCUS;
+ m_nMode &= ~BROWSER_HIDECURSOR;
+ }
+ else
+ {
+ // Duerfen Updates gemacht werden, kein Focus-RechtEck
+ if ( m_nOptions & OPT_UPDATE )
+ m_nMode |= BROWSER_HIDECURSOR;
+ }
+
+ if ( m_bMultiSelection )
+ m_nMode |= BROWSER_MULTISELECTION;
+ else
+ m_nMode &= ~BROWSER_MULTISELECTION;
+
+ adjustModeForScrollbars( m_nMode, m_bNavigationBar, m_bHideScrollbars );
+
+ Reference< XColumnsSupplier > xSupplyColumns(_xCursor, UNO_QUERY);
+ if (xSupplyColumns.is())
+ InitColumnsByFields(Reference< XIndexAccess > (xSupplyColumns->getColumns(), UNO_QUERY));
+
+ ConnectToFields();
+ }
+
+ sal_uInt32 nRecordCount(0);
+
+ if (m_pSeekCursor)
+ {
+ Reference< XPropertySet > xSet = m_pDataCursor->getPropertySet();
+ xSet->getPropertyValue(FM_PROP_ROWCOUNT) >>= nRecordCount;
+ m_bRecordCountFinal = ::comphelper::getBOOL(xSet->getPropertyValue(FM_PROP_ROWCOUNTFINAL));
+
+ m_xRowSetListener = new RowSetEventListener(this);
+ Reference< XRowsChangeBroadcaster> xChangeBroad(xSet,UNO_QUERY);
+ if ( xChangeBroad.is( ) )
+ xChangeBroad->addRowsChangeListener(m_xRowSetListener);
+
+
+ // insert the currently known rows
+ // and one row if we are able to insert rows
+ if (m_nOptions & OPT_INSERT)
+ {
+ // insert the empty row for insertion
+ m_xEmptyRow = new DbGridRow();
+ ++nRecordCount;
+ }
+ if (nRecordCount)
+ {
+ m_xPaintRow = m_xSeekRow = new DbGridRow(m_pSeekCursor, sal_True);
+ m_xDataRow = new DbGridRow(m_pDataCursor, sal_False);
+ RowInserted(0, nRecordCount, sal_False);
+
+ if (m_xSeekRow->IsValid())
+ try
+ {
+ m_nSeekPos = m_pSeekCursor->getRow() - 1;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ m_nSeekPos = -1;
+ }
+ }
+ else
+ {
+ // no rows so we don't need a seekcursor
+ DELETEZ(m_pSeekCursor);
+ }
+ }
+
+ // Zur alten Spalte gehen
+ if (!nCurPos || nCurPos >= ColCount())
+ nCurPos = 1;
+
+ // there are rows so go to the selected current column
+ if (nRecordCount)
+ GoToRowColumnId(0, GetColumnId(nCurPos));
+ // else stop the editing if neccessary
+ else if (IsEditing())
+ DeactivateCell();
+
+ // now reset the mode
+ if (m_nMode != nOldMode)
+ SetMode(m_nMode);
+
+ // beim Resizen wird RecalcRows gerufen
+ if (!IsResizing() && GetRowCount())
+ RecalcRows(GetTopRow(), GetVisibleRows(), sal_True);
+
+ m_aBar.InvalidateAll(m_nCurrentPos, sal_True);
+ SetUpdateMode(sal_True);
+
+ // start listening on the seek cursor
+ if (m_pSeekCursor)
+ m_pCursorDisposeListener = new DisposeListenerGridBridge(*this, Reference< XComponent > ((Reference< XInterface >)*m_pSeekCursor, UNO_QUERY), 0);
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::RemoveColumns()
+{
+ if ( IsEditing() )
+ DeactivateCell();
+
+ for (sal_uInt32 i = 0; i < m_aColumns.Count(); i++)
+ delete m_aColumns.GetObject(i);
+ m_aColumns.Clear();
+
+ DbGridControl_Base::RemoveColumns();
+}
+
+//------------------------------------------------------------------------------
+DbGridColumn* DbGridControl::CreateColumn(sal_uInt16 nId) const
+{
+ return new DbGridColumn(nId, *(DbGridControl*)this);
+}
+
+//------------------------------------------------------------------------------
+sal_uInt16 DbGridControl::AppendColumn(const XubString& rName, sal_uInt16 nWidth, sal_uInt16 nModelPos, sal_uInt16 nId)
+{
+ DBG_ASSERT(nId == (sal_uInt16)-1, "DbGridControl::AppendColumn : I want to set the ID myself ...");
+ sal_uInt16 nRealPos = nModelPos;
+ if (nModelPos != HEADERBAR_APPEND)
+ {
+ // calc the view pos. we can't use our converting functions because the new column
+ // has no VCL-representation, yet.
+ sal_Int16 nViewPos = nModelPos;
+ while (nModelPos--)
+ {
+ if (m_aColumns.GetObject(nModelPos)->IsHidden())
+ --nViewPos;
+ }
+ // restore nModelPos, we need it later
+ nModelPos = nRealPos;
+ // the position the base class gets is the view pos + 1 (because of the handle column)
+ nRealPos = nViewPos + 1;
+ }
+
+ // calculate the new id
+ for (nId=1; (GetModelColumnPos(nId) != GRID_COLUMN_NOT_FOUND) && (nId<=m_aColumns.Count()); ++nId)
+ ;
+ DBG_ASSERT(GetViewColumnPos(nId) == (sal_uInt16)-1, "DbGridControl::AppendColumn : inconsistent internal state !");
+ // my column's models say "there is no column with id nId", but the view (the base class) says "there is a column ..."
+
+ DbGridControl_Base::AppendColumn(rName, nWidth, nRealPos, nId);
+ if (nModelPos == HEADERBAR_APPEND)
+ m_aColumns.Insert(CreateColumn(nId), LIST_APPEND);
+ else
+ m_aColumns.Insert(CreateColumn(nId), nModelPos);
+
+ return nId;
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::RemoveColumn(sal_uInt16 nId)
+{
+ sal_Int16 nIndex = GetModelColumnPos(nId);
+ DbGridControl_Base::RemoveColumn(nId);
+ delete m_aColumns.Remove(nIndex);
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::ColumnMoved(sal_uInt16 nId)
+{
+ DbGridControl_Base::ColumnMoved(nId);
+
+ // remove the col from the model
+ sal_Int16 nOldModelPos = GetModelColumnPos(nId);
+#ifdef DBG_UTIL
+ DbGridColumn* pCol = m_aColumns.GetObject((sal_uInt32)nOldModelPos);
+ DBG_ASSERT(!pCol->IsHidden(), "DbGridControl::ColumnMoved : moved a hidden col ? how this ?");
+#endif
+
+ // for the new model pos we can't use GetModelColumnPos because we are altering the model at the moment
+ // so the method won't work (in fact it would return the old model pos)
+
+ // the new view pos is calculated easily
+ sal_uInt16 nNewViewPos = GetViewColumnPos(nId);
+
+ // from that we can compute the new model pos
+ sal_uInt16 nNewModelPos;
+ for (nNewModelPos = 0; nNewModelPos < m_aColumns.Count(); ++nNewModelPos)
+ {
+ if (!m_aColumns.GetObject(nNewModelPos)->IsHidden())
+ {
+ if (!nNewViewPos)
+ break;
+ else
+ --nNewViewPos;
+ }
+ }
+ DBG_ASSERT(nNewModelPos<m_aColumns.Count(), "DbGridControl::ColumnMoved : could not find the new model position !");
+
+ // this will work. of course the model isn't fully consistent with our view right now, but let's
+ // look at the situation : a column has been moved with in the VIEW from pos m to n, say m<n (in the
+ // other case we can use analogue arguments).
+ // All cols k with m<k<=n have been shifted left on pos, the former col m now has pos n.
+ // In the model this affects a range of cols x to y, where x<=m and y<=n. And the number of hidden cols
+ // within this range is constant, so we may calculate the view pos from the model pos in the above way.
+ //
+ // for instance, let's look at a grid with six columns where the third one is hidden. this will
+ // initially look like this :
+ //
+ // +---+---+---+---+---+---+
+ // model pos | 0 | 1 |*2*| 3 | 4 | 5 |
+ // +---+---+---+---+---+---+
+ // ID | 1 | 2 | 3 | 4 | 5 | 6 |
+ // +---+---+---+---+---+---+
+ // view pos | 0 | 1 | - | 2 | 3 | 4 |
+ // +---+---+---+---+---+---+
+ //
+ // if we move the column at (view) pos 1 to (view) pos 3 we have :
+ //
+ // +---+---+---+---+---+---+
+ // model pos | 0 | 3 |*2*| 4 | 1 | 5 | // not reflecting the changes, yet
+ // +---+---+---+---+---+---+
+ // ID | 1 | 4 | 3 | 5 | 2 | 6 | // already reflecting the changes
+ // +---+---+---+---+---+---+
+ // view pos | 0 | 1 | - | 2 | 3 | 4 |
+ // +---+---+---+---+---+---+
+ //
+ // or, sorted by the out-of-date model positions :
+ //
+ // +---+---+---+---+---+---+
+ // model pos | 0 | 1 |*2*| 3 | 4 | 5 |
+ // +---+---+---+---+---+---+
+ // ID | 1 | 2 | 3 | 4 | 5 | 6 |
+ // +---+---+---+---+---+---+
+ // view pos | 0 | 3 | - | 1 | 2 | 4 |
+ // +---+---+---+---+---+---+
+ //
+ // We know the new view pos (3) of the moved column because our base class tells us. So we look at our
+ // model for the 4th (the pos is zero-based) visible column, it is at (model) position 4. And this is
+ // exactly the pos where we have to re-insert our column's model, so it looks ike this :
+ //
+ // +---+---+---+---+---+---+
+ // model pos | 0 |*1*| 2 | 3 | 4 | 5 |
+ // +---+---+---+---+---+---+
+ // ID | 1 | 3 | 4 | 5 | 2 | 6 |
+ // +---+---+---+---+---+---+
+ // view pos | 0 | - | 1 | 2 | 3 | 4 |
+ // +---+---+---+---+---+---+
+ //
+ // Now, all is consistent again.
+ // (except of the hidden column : The cycling of the cols occured on the model, not on the view. maybe
+ // the user expected the latter but there really is no good argument against our method ;) ...)
+ //
+ // And no, this large explanation isn't just because I wanted to play a board game or something like
+ // that. It's because it took me a while to see it myself, and the whole theme (hidden cols, model col
+ // positions, view col positions) is really painful (at least for me) so the above pictures helped me a lot ;)
+
+ m_aColumns.Insert(m_aColumns.Remove((sal_uInt32)nOldModelPos), nNewModelPos);
+}
+
+//------------------------------------------------------------------------------
+sal_Bool DbGridControl::SeekRow(long nRow)
+{
+ // in filter mode or in insert only mode we don't have any cursor!
+ if ( !SeekCursor( nRow ) )
+ return sal_False;
+
+ if ( IsFilterMode() )
+ {
+ DBG_ASSERT( IsFilterRow( nRow ), "DbGridControl::SeekRow(): No filter row, wrong mode" );
+ m_xPaintRow = m_xEmptyRow;
+ }
+ else
+ {
+ // on the current position we have to take the current row for display as we want
+ // to have the most recent values for display
+ if ( ( nRow == m_nCurrentPos ) && getDisplaySynchron() )
+ m_xPaintRow = m_xCurrentRow;
+ // seek to the empty insert row
+ else if ( IsInsertionRow( nRow ) )
+ m_xPaintRow = m_xEmptyRow;
+ else
+ {
+ m_xSeekRow->SetState( m_pSeekCursor, sal_True );
+ m_xPaintRow = m_xSeekRow;
+ }
+ }
+
+ DbGridControl_Base::SeekRow(nRow);
+
+ return m_nSeekPos >= 0;
+}
+//------------------------------------------------------------------------------
+// Wird aufgerufen, wenn die dargestellte Datenmenge sich aendert
+//------------------------------------------------------------------------------
+void DbGridControl::VisibleRowsChanged( long nNewTopRow, sal_uInt16 nLinesOnScreen )
+{
+ RecalcRows(nNewTopRow, nLinesOnScreen , sal_False);
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::RecalcRows(long nNewTopRow, sal_uInt16 nLinesOnScreen, sal_Bool bUpdateCursor)
+{
+ DBG_CHKTHIS( DbGridControl, NULL );
+ // Wenn kein Cursor -> keine Rows im Browser.
+ if (!m_pSeekCursor)
+ {
+ DBG_ASSERT(GetRowCount() == 0,"DbGridControl: ohne Cursor darf es keine Rows geben");
+ return;
+ }
+
+ // ignore any updates implicit made
+ sal_Bool bDisablePaint = !bUpdateCursor && IsPaintEnabled();
+ if (bDisablePaint)
+ EnablePaint(sal_False);
+
+ // Cache an den sichtbaren Bereich anpassen
+ Reference< XPropertySet > xSet = m_pSeekCursor->getPropertySet();
+ sal_Int32 nCacheSize = 0;
+ xSet->getPropertyValue(FM_PROP_FETCHSIZE) >>= nCacheSize;
+ sal_Bool bCacheAligned = sal_False;
+ // Nach der Initialisierung (m_nSeekPos < 0) keine Cursorbewegung, da bereits auf den ersten
+ // Satz positioniert
+ long nDelta = nNewTopRow - GetTopRow();
+ // Limit fuer relative Positionierung
+ long nLimit = (nCacheSize) ? nCacheSize / 2 : 0;
+
+ // mehr Zeilen auf dem Bildschirm als im Cache
+ if (nLimit < nLinesOnScreen)
+ {
+ Any aCacheSize;
+ aCacheSize <<= sal_Int32(nLinesOnScreen*2);
+ xSet->setPropertyValue(FM_PROP_FETCHSIZE, aCacheSize);
+ // jetzt auf alle Faelle den Cursor anpassen
+ bUpdateCursor = sal_True;
+ bCacheAligned = sal_True;
+ nLimit = nLinesOnScreen;
+ }
+
+ // Im folgenden werden die Positionierungen so vorgenommen, da� sichergestellt ist
+ // da� ausreichend Zeilen im DatenCache vorhanden sind
+
+ // Fenster geht nach unten, weniger als zwei Fenster Differenz
+ // oder Cache angepasst und noch kein Rowcount
+ if (nDelta < nLimit && (nDelta > 0
+ || (bCacheAligned && m_nTotalCount < 0)) )
+ SeekCursor(nNewTopRow + nLinesOnScreen - 1, sal_False);
+ else if (nDelta < 0 && Abs(nDelta) < nLimit)
+ SeekCursor(nNewTopRow, sal_False);
+ else if (nDelta != 0 || bUpdateCursor)
+ SeekCursor(nNewTopRow, sal_True);
+
+ AdjustRows();
+
+ // ignore any updates implicit made
+ EnablePaint(sal_True);
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::RowInserted(long nRow, long nNumRows, sal_Bool bDoPaint, sal_Bool bKeepSelection)
+{
+ if (nNumRows)
+ {
+ if (m_bRecordCountFinal && m_nTotalCount < 0)
+ {
+ // if we have an insert row we have to reduce to count by 1
+ // as the total count reflects only the existing rows in database
+ m_nTotalCount = GetRowCount() + nNumRows;
+ if (m_xEmptyRow.Is())
+ --m_nTotalCount;
+ }
+ else if (m_nTotalCount >= 0)
+ m_nTotalCount += nNumRows;
+
+ DbGridControl_Base::RowInserted(nRow, nNumRows, bDoPaint, bKeepSelection);
+ m_aBar.InvalidateState(NavigationBar::RECORD_COUNT);
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::RowRemoved(long nRow, long nNumRows, sal_Bool bDoPaint)
+{
+ if (nNumRows)
+ {
+ if (m_bRecordCountFinal && m_nTotalCount < 0)
+ {
+ m_nTotalCount = GetRowCount() - nNumRows;
+ // if we have an insert row reduce by 1
+ if (m_xEmptyRow.Is())
+ --m_nTotalCount;
+ }
+ else if (m_nTotalCount >= 0)
+ m_nTotalCount -= nNumRows;
+
+ DbGridControl_Base::RowRemoved(nRow, nNumRows, bDoPaint);
+ m_aBar.InvalidateState(NavigationBar::RECORD_COUNT);
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::AdjustRows()
+{
+ if (!m_pSeekCursor)
+ return;
+
+ Reference< XPropertySet > xSet = m_pDataCursor->getPropertySet();
+
+ // Aktualisieren des RecordCounts
+ sal_Int32 nRecordCount = 0;
+ xSet->getPropertyValue(FM_PROP_ROWCOUNT) >>= nRecordCount;
+ if (!m_bRecordCountFinal)
+ m_bRecordCountFinal = ::comphelper::getBOOL(xSet->getPropertyValue(FM_PROP_ROWCOUNTFINAL));
+
+ // hat sich die aktuelle Anzahl Rows veraendert
+ // hierbei muss auch beruecksichtigt werden,
+ // das eine zusaetzliche Zeile zum einfuegen von Datensaetzen vorhanden sein kann
+
+ // zusaetzliche AppendRow fuers einfuegen
+ if (m_nOptions & OPT_INSERT)
+ ++nRecordCount;
+
+ // wird gerade eingefuegt, dann gehoert die gerade hinzuzufuegende
+ // Zeile nicht zum RecordCount und die Appendrow ebenfalls nicht
+ if (!IsUpdating() && m_bRecordCountFinal && IsModified() && m_xCurrentRow != m_xEmptyRow &&
+ m_xCurrentRow->IsNew())
+ ++nRecordCount;
+ // das ist mit !m_bUpdating abgesichert : innerhalb von SaveRow (m_bUpdating == sal_True) wuerde sonst der Datensatz, den ich editiere
+ // (und den SaveRow gerade angefuegt hat, wodurch diese Methode hier getriggert wurde), doppelt zaehlen : einmal ist er schon
+ // in dem normalen RecordCount drin, zum zweiten wuerde er hier gezaehlt werden (60787 - FS)
+
+ if (nRecordCount != GetRowCount())
+ {
+ long nDelta = GetRowCount() - (long)nRecordCount;
+ if (nDelta > 0) // zuviele
+ {
+ RowRemoved(GetRowCount() - nDelta, nDelta, sal_False);
+ // es sind Zeilen weggefallen, dann ab der aktuellen Position neu zeichen
+ Invalidate();
+ }
+ else // zuwenig
+ RowInserted(GetRowCount(), -nDelta, sal_True);
+ }
+
+ if (m_bRecordCountFinal && m_nTotalCount < 0)
+ {
+ if (m_nOptions & OPT_INSERT)
+ m_nTotalCount = GetRowCount() - 1;
+ else
+ m_nTotalCount = GetRowCount();
+ }
+ m_aBar.InvalidateState(NavigationBar::RECORD_COUNT);
+}
+
+//------------------------------------------------------------------------------
+DbGridControl_Base::RowStatus DbGridControl::GetRowStatus(long nRow) const
+{
+ if (IsFilterRow(nRow))
+ return DbGridControl_Base::FILTER;
+ else if (m_nCurrentPos >= 0 && nRow == m_nCurrentPos)
+ {
+ // neue Zeile
+ if (!IsValid(m_xCurrentRow))
+ return DbGridControl_Base::DELETED;
+ else if (IsModified())
+ return DbGridControl_Base::MODIFIED;
+ else if (m_xCurrentRow->IsNew())
+ return DbGridControl_Base::CURRENTNEW;
+ else
+ return DbGridControl_Base::CURRENT;
+ }
+ else if (IsInsertionRow(nRow))
+ return DbGridControl_Base::NEW;
+ else if (!IsValid(m_xSeekRow))
+ return DbGridControl_Base::DELETED;
+ else
+ return DbGridControl_Base::CLEAN;
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::PaintStatusCell(OutputDevice& rDev, const Rectangle& rRect) const
+{
+ DbGridControl_Base::PaintStatusCell(rDev, rRect);
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::PaintCell(OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId) const
+{
+ if (!IsValid(m_xPaintRow))
+ return;
+
+ DbGridColumn* pColumn = m_aColumns.GetObject(GetModelColumnPos(nColumnId));
+ if (pColumn)
+ {
+ Rectangle aArea(rRect);
+ if ((GetMode() & BROWSER_CURSOR_WO_FOCUS) == BROWSER_CURSOR_WO_FOCUS)
+ {
+ aArea.Top() += 1;
+ aArea.Bottom() -= 1;
+ }
+ pColumn->Paint(rDev, aArea, m_xPaintRow, getNumberFormatter());
+ }
+}
+
+//------------------------------------------------------------------------------
+sal_Bool DbGridControl::CursorMoving(long nNewRow, sal_uInt16 nNewCol)
+{
+ DBG_CHKTHIS( DbGridControl, NULL );
+
+ DeactivateCell( sal_False );
+
+ if ( m_pDataCursor
+ && ( m_nCurrentPos != nNewRow )
+ && !SetCurrent( nNewRow )
+ )
+ {
+ ActivateCell();
+ return sal_False;
+ }
+
+ if ( !DbGridControl_Base::CursorMoving( nNewRow, nNewCol ) )
+ return sal_False;
+
+ return sal_True;
+}
+
+//------------------------------------------------------------------------------
+sal_Bool DbGridControl::SetCurrent(long nNewRow)
+{
+ // Each movement of the datacursor must start with BeginCursorAction and end with
+ // EndCursorAction to block all notifications during the movement
+ BeginCursorAction();
+
+ try
+ {
+ // Abgleichen der Positionen
+ if (SeekCursor(nNewRow))
+ {
+ if (IsFilterRow(nNewRow)) // special mode for filtering
+ {
+ m_xCurrentRow = m_xDataRow = m_xPaintRow = m_xEmptyRow;
+ m_nCurrentPos = nNewRow;
+ }
+ else
+ {
+ sal_Bool bNewRowInserted = sal_False;
+ // Should we go to the insertrow ?
+ if (IsInsertionRow(nNewRow))
+ {
+ // to we need to move the cursor to the insert row?
+ // we need to insert the if the current row isn't the insert row or if the
+ // cursor triggered the move by itselt and we need a reinitialization of the row
+ Reference< XPropertySet > xCursorProps = m_pDataCursor->getPropertySet();
+ if ( !::comphelper::getBOOL(xCursorProps->getPropertyValue(FM_PROP_ISNEW)) )
+ {
+ Reference< XResultSetUpdate > xUpdateCursor((Reference< XInterface >)*m_pDataCursor, UNO_QUERY);
+ xUpdateCursor->moveToInsertRow();
+ }
+ bNewRowInserted = sal_True;
+ }
+ else
+ {
+
+ if ( !m_pSeekCursor->isBeforeFirst() && !m_pSeekCursor->isAfterLast() )
+ {
+ Any aBookmark = m_pSeekCursor->getBookmark();
+ if (!m_xCurrentRow || m_xCurrentRow->IsNew() || !CompareBookmark(aBookmark, m_pDataCursor->getBookmark()))
+ {
+ // adjust the cursor to the new desired row
+ if (!m_pDataCursor->moveToBookmark(aBookmark))
+ {
+ EndCursorAction();
+ return sal_False;
+ }
+ }
+ }
+ }
+ m_xDataRow->SetState(m_pDataCursor, sal_False);
+ m_xCurrentRow = m_xDataRow;
+
+ long nPaintPos = -1;
+ // do we have to repaint the last regular row in case of setting defaults or autovalues
+ if (m_nCurrentPos >= 0 && m_nCurrentPos >= (GetRowCount() - 2))
+ nPaintPos = m_nCurrentPos;
+
+ m_nCurrentPos = nNewRow;
+
+ // repaint the new row to display all defaults
+ if (bNewRowInserted)
+ RowModified(m_nCurrentPos);
+ if (nPaintPos >= 0)
+ RowModified(nPaintPos);
+ }
+ }
+ else
+ {
+ DBG_ERROR("DbGridControl::SetCurrent : SeekRow failed !");
+ EndCursorAction();
+ return sal_False;
+ }
+ }
+ catch ( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ EndCursorAction();
+ return sal_False;
+ }
+
+ EndCursorAction();
+ return sal_True;
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::CursorMoved()
+{
+ DBG_CHKTHIS( DbGridControl, NULL );
+
+ // CursorBewegung durch loeschen oder einfuegen von Zeilen
+ if (m_pDataCursor && m_nCurrentPos != GetCurRow())
+ {
+ DeactivateCell(sal_True);
+ SetCurrent(GetCurRow());
+ }
+
+ DbGridControl_Base::CursorMoved();
+ m_aBar.InvalidateAll(m_nCurrentPos);
+
+ // select the new column when they moved
+ if ( IsDesignMode() && GetSelectedColumnCount() > 0 && GetCurColumnId() )
+ {
+ SelectColumnId( GetCurColumnId() );
+ }
+
+ if ( m_nLastColId != GetCurColumnId() )
+ onColumnChange();
+ m_nLastColId = GetCurColumnId();
+
+ if ( m_nLastRowId != GetCurRow() )
+ onRowChange();
+ m_nLastRowId = GetCurRow();
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::onRowChange()
+{
+ // not interested in
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::onColumnChange()
+{
+ if ( m_pGridListener )
+ m_pGridListener->columnChanged();
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::setDisplaySynchron(sal_Bool bSync)
+{
+ if (bSync != m_bSynchDisplay)
+ {
+ m_bSynchDisplay = bSync;
+ if (m_bSynchDisplay)
+ AdjustDataSource(sal_False);
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::forceSyncDisplay()
+{
+ sal_Bool bOld = getDisplaySynchron();
+ setDisplaySynchron(sal_True);
+ if (!bOld)
+ setDisplaySynchron(bOld);
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::forceROController(sal_Bool bForce)
+{
+ if (m_bForceROController == bForce)
+ return;
+
+ m_bForceROController = bForce;
+ // alle Columns durchgehen und denen Bescheid geben
+ for (sal_uInt16 i=0; i<m_aColumns.Count(); ++i)
+ {
+ DbGridColumn* pColumn = m_aColumns.GetObject(i);
+ if (!pColumn)
+ continue;
+
+ CellController* pReturn = &pColumn->GetController();
+ if (!pReturn)
+ continue;
+
+ // nur wenn es eine Edit-Zeile ist, kann ich ihr das forced read-only mitgeben
+ if (!pReturn->ISA(EditCellController) && !pReturn->ISA(SpinCellController))
+ continue;
+
+ Edit& rEdit = (Edit&)pReturn->GetWindow();
+ rEdit.SetReadOnly(m_bForceROController);
+ if (m_bForceROController)
+ rEdit.SetStyle(rEdit.GetStyle() | WB_NOHIDESELECTION);
+ else
+ rEdit.SetStyle(rEdit.GetStyle() & ~WB_NOHIDESELECTION);
+ }
+
+ // die aktive Zelle erneut aktivieren, da sich ihr Controller geaendert haben kann
+ if (IsEditing())
+ DeactivateCell();
+ ActivateCell();
+}
+
+
+//------------------------------------------------------------------------------
+void DbGridControl::AdjustDataSource(sal_Bool bFull)
+{
+ TRACE_RANGE("DbGridControl::AdjustDataSource");
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ // wird die aktuelle Zeile gerade neu bestimmt,
+ // wird kein abgleich vorgenommen
+
+ if (bFull)
+ m_xCurrentRow = NULL;
+ // if we are on the same row only repaint
+ // but this is only possible for rows which are not inserted, in that case the comparision result
+ // may not be correct
+ else
+ if ( m_xCurrentRow.Is()
+ && !m_xCurrentRow->IsNew()
+ && !m_pDataCursor->isBeforeFirst()
+ && !m_pDataCursor->isAfterLast()
+ && !m_pDataCursor->rowDeleted()
+ )
+ {
+ sal_Bool bEqualBookmarks = CompareBookmark( m_xCurrentRow->GetBookmark(), m_pDataCursor->getBookmark() );
+
+ sal_Bool bDataCursorIsOnNew = sal_False;
+ m_pDataCursor->getPropertySet()->getPropertyValue( FM_PROP_ISNEW ) >>= bDataCursorIsOnNew;
+
+ if ( bEqualBookmarks && !bDataCursorIsOnNew )
+ {
+ // position of my data cursor is the same as the position our current row points tpo
+ // sync the status, repaint, done
+ DBG_ASSERT(m_xDataRow == m_xCurrentRow, "Fehler in den Datenzeilen");
+ TRACE_RANGE_MESSAGE1("same position, new state : %s", ROWSTATUS(m_xCurrentRow));
+ RowModified(m_nCurrentPos);
+ return;
+ }
+ }
+
+ // weg von der Row des DatenCursors
+ if (m_xPaintRow == m_xCurrentRow)
+ m_xPaintRow = m_xSeekRow;
+
+ // keine aktuelle Zeile dann komplett anpassen
+ if (!m_xCurrentRow)
+ AdjustRows();
+
+ sal_Int32 nNewPos = AlignSeekCursor();
+ if (nNewPos < 0) // keine Position gefunden
+ return;
+
+ m_bInAdjustDataSource = sal_True;
+ if (nNewPos != m_nCurrentPos)
+ {
+ if (m_bSynchDisplay)
+ DbGridControl_Base::GoToRow(nNewPos);
+
+ if (!m_xCurrentRow.Is())
+ // das tritt zum Beispiel auf, wenn man die n (n>1) letzten Datensaetze geloescht hat, waehrend der Cursor auf dem letzten
+ // steht : AdjustRows entfernt dann zwei Zeilen aus der BrowseBox, wodurch diese ihre CurrentRow um zwei nach unten
+ // korrigiert, so dass dann das GoToRow in's Leere laeuft (da wir uns ja angeblich schon an der richtigen Position
+ // befinden)
+ SetCurrent(nNewPos);
+ }
+ else
+ {
+ SetCurrent(nNewPos);
+ RowModified(nNewPos);
+ }
+ m_bInAdjustDataSource = sal_False;
+
+ // Wird der DatenCursor von aussen bewegt, wird die selektion aufgehoben
+ SetNoSelection();
+ m_aBar.InvalidateAll(m_nCurrentPos, m_xCurrentRow.Is());
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 DbGridControl::AlignSeekCursor()
+{
+ DBG_CHKTHIS( DbGridControl, NULL );
+ // Positioniert den SeekCursor auf den DatenCursor, Daten werden nicht uebertragen
+
+ if (!m_pSeekCursor)
+ return -1;
+
+ Reference< XPropertySet > xSet = m_pDataCursor->getPropertySet();
+
+ // jetzt den seekcursor an den DatenCursor angleichen
+ if (::comphelper::getBOOL(xSet->getPropertyValue(FM_PROP_ISNEW)))
+ m_nSeekPos = GetRowCount() - 1;
+ else
+ {
+ try
+ {
+ if ( m_pDataCursor->isBeforeFirst() )
+ {
+ // this is somewhat strange, but can nevertheless happen
+ DBG_WARNING( "DbGridControl::AlignSeekCursor: nobody should tamper with my cursor this way (before first)!" );
+ m_pSeekCursor->first();
+ m_pSeekCursor->previous();
+ m_nSeekPos = -1;
+ }
+ else if ( m_pDataCursor->isAfterLast() )
+ {
+ DBG_WARNING( "DbGridControl::AlignSeekCursor: nobody should tamper with my cursor this way (after last)!" );
+ m_pSeekCursor->last();
+ m_pSeekCursor->next();
+ m_nSeekPos = -1;
+ }
+ else
+ {
+ m_pSeekCursor->moveToBookmark(m_pDataCursor->getBookmark());
+ if (!CompareBookmark(m_pDataCursor->getBookmark(), m_pSeekCursor->getBookmark()))
+ // dummerweise kann das moveToBookmark indirekt dazu fuehren, dass der Seek-Cursor wieder neu positoniert wird (wenn
+ // naemlich das mit all seinen zu feuernden Events relativ komplexe moveToBookmark irgendwo ein Update ausloest),
+ // also muss ich es nochmal versuchen
+ m_pSeekCursor->moveToBookmark(m_pDataCursor->getBookmark());
+ // Nicht dass das jetzt nicht auch schief gegangen sein koennte, aber es ist zumindest unwahrscheinlicher geworden.
+ // Und die Alternative waere eine Schleife so lange bis es stimmt, und das kann auch nicht die Loesung sein
+ m_nSeekPos = m_pSeekCursor->getRow() - 1;
+ }
+ }
+ catch(Exception&)
+ {
+ }
+ }
+ return m_nSeekPos;
+}
+//------------------------------------------------------------------------------
+sal_Bool DbGridControl::SeekCursor(long nRow, sal_Bool bAbsolute)
+{
+ DBG_CHKTHIS( DbGridControl, NULL );
+ // Positioniert den SeekCursor, Daten werden nicht uebertragen
+
+ // additions for the filtermode
+ if (IsFilterRow(nRow))
+ {
+ m_nSeekPos = 0;
+ return sal_True;
+ }
+
+ if (!m_pSeekCursor)
+ return sal_False;
+
+ // Befinden wir uns gerade beim Einfuegen
+ if (IsValid(m_xCurrentRow) && m_xCurrentRow->IsNew() &&
+ nRow >= m_nCurrentPos)
+ {
+ // dann darf auf alle Faelle nicht weiter nach unten gescrollt werden
+ // da der letzte Datensatz bereits erreicht wurde!
+ if (nRow == m_nCurrentPos)
+ {
+ // auf die aktuelle Zeile bewegt, dann muß kein abgleich gemacht werden, wenn
+ // gerade ein Datensatz eingefuegt wird
+ m_nSeekPos = nRow;
+ }
+ else if (IsInsertionRow(nRow)) // Leerzeile zum Einfuegen von Datensaetzen
+ m_nSeekPos = nRow;
+ }
+ else if (IsInsertionRow(nRow)) // Leerzeile zum Einfuegen von Datensaetzen
+ m_nSeekPos = nRow;
+ else if ((-1 == nRow) && (GetRowCount() == ((m_nOptions & OPT_INSERT) ? 1 : 0)) && m_pSeekCursor->isAfterLast())
+ m_nSeekPos = nRow;
+ else
+ {
+
+ sal_Bool bSuccess=sal_False;
+ long nSteps = 0;
+ try
+ {
+ if ( m_pSeekCursor->rowDeleted() )
+ {
+ // somebody deleted the current row of the seek cursor. Move it away from this row.
+ m_pSeekCursor->next();
+ if ( m_pSeekCursor->isAfterLast() || m_pSeekCursor->isBeforeFirst() )
+ bAbsolute = sal_True;
+ }
+
+ if ( !bAbsolute )
+ {
+ DBG_ASSERT( !m_pSeekCursor->isAfterLast() && !m_pSeekCursor->isBeforeFirst(),
+ "DbGridControl::SeekCursor: how did the seek cursor get to this position?!" );
+ nSteps = nRow - (m_pSeekCursor->getRow() - 1);
+ bAbsolute = bAbsolute || (abs(nSteps) > 100);
+ }
+
+ if ( bAbsolute )
+ {
+ bSuccess = m_pSeekCursor->absolute(nRow + 1);
+ if (bSuccess)
+ m_nSeekPos = nRow;
+ }
+ else
+ {
+ if (nSteps > 0) // auf den letzten benoetigten Datensatz positionieren
+ {
+ if (m_pSeekCursor->isAfterLast())
+ bSuccess = sal_False;
+ else if (m_pSeekCursor->isBeforeFirst())
+ bSuccess = m_pSeekCursor->absolute(nSteps);
+ else
+ bSuccess = m_pSeekCursor->relative(nSteps);
+ }
+ else if (nSteps < 0)
+ {
+ if (m_pSeekCursor->isBeforeFirst())
+ bSuccess = sal_False;
+ else if (m_pSeekCursor->isAfterLast())
+ bSuccess = m_pSeekCursor->absolute(nSteps);
+ else
+ bSuccess = m_pSeekCursor->relative(nSteps);
+ }
+ else
+ {
+ m_nSeekPos = nRow;
+ return sal_True;
+ }
+ }
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("DbGridControl::SeekCursor : failed ...");
+ }
+
+ try
+ {
+ if (!bSuccess)
+ {
+ if (bAbsolute || nSteps > 0)
+ bSuccess = m_pSeekCursor->last();
+ else
+ bSuccess = m_pSeekCursor->first();
+ }
+
+ if (bSuccess)
+ m_nSeekPos = m_pSeekCursor->getRow() - 1;
+ else
+ m_nSeekPos = -1;
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("DbGridControl::SeekCursor : failed ...");
+ m_nSeekPos = -1; // kein Datensatz mehr vorhanden
+ }
+ }
+ return m_nSeekPos == nRow;
+}
+//------------------------------------------------------------------------------
+void DbGridControl::MoveToFirst()
+{
+ if (m_pSeekCursor && (GetCurRow() != 0))
+ MoveToPosition(0);
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::MoveToLast()
+{
+ if (!m_pSeekCursor)
+ return;
+
+ if (m_nTotalCount < 0) // RecordCount steht noch nicht fest
+ {
+ try
+ {
+ sal_Bool bRes = m_pSeekCursor->last();
+
+ if (bRes)
+ {
+ m_nSeekPos = m_pSeekCursor->getRow() - 1;
+ AdjustRows();
+ }
+ }
+ catch(Exception&)
+ {
+ }
+ }
+
+ // auf den letzen Datensatz positionieren, nicht auf die Leerzeile
+ if (m_nOptions & OPT_INSERT)
+ {
+ if ((GetRowCount() - 1) > 0)
+ MoveToPosition(GetRowCount() - 2);
+ }
+ else if (GetRowCount())
+ MoveToPosition(GetRowCount() - 1);
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::MoveToPrev()
+{
+ long nNewRow = std::max(GetCurRow() - 1L, 0L);
+ if (GetCurRow() != nNewRow)
+ MoveToPosition(nNewRow);
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::MoveToNext()
+{
+ if (!m_pSeekCursor)
+ return;
+
+ if (m_nTotalCount > 0)
+ {
+ // move the data cursor to the right position
+ long nNewRow = std::min(GetRowCount() - 1, GetCurRow() + 1);
+ if (GetCurRow() != nNewRow)
+ MoveToPosition(nNewRow);
+ }
+ else
+ {
+ sal_Bool bOk = sal_False;
+ try
+ {
+ // try to move to next row
+ // when not possible our paint cursor is already on the last row
+ // then we must be sure that the data cursor is on the position
+ // we call ourself again
+ bOk = m_pSeekCursor->next();
+ if (bOk)
+ {
+ m_nSeekPos = m_pSeekCursor->getRow() - 1;
+ MoveToPosition(GetCurRow() + 1);
+ }
+ }
+ catch(SQLException &)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ if(!bOk)
+ {
+ AdjustRows();
+ if (m_nTotalCount > 0) // only to avoid infinte recursion
+ MoveToNext();
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::MoveToPosition(sal_uInt32 nPos)
+{
+ if (!m_pSeekCursor)
+ return;
+
+ if (m_nTotalCount < 0 && (long)nPos >= GetRowCount())
+ {
+ try
+ {
+ if (!m_pSeekCursor->absolute(nPos + 1))
+ {
+ AdjustRows();
+ Sound::Beep();
+ return;
+ }
+ else
+ {
+ m_nSeekPos = m_pSeekCursor->getRow() - 1;
+ AdjustRows();
+ }
+ }
+ catch(Exception&)
+ {
+ return;
+ }
+ }
+ DbGridControl_Base::GoToRow(nPos);
+ m_aBar.InvalidateAll(m_nCurrentPos);
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::AppendNew()
+{
+ if (!m_pSeekCursor || !(m_nOptions & OPT_INSERT))
+ return;
+
+ if (m_nTotalCount < 0) // RecordCount steht noch nicht fest
+ {
+ try
+ {
+ sal_Bool bRes = m_pSeekCursor->last();
+
+ if (bRes)
+ {
+ m_nSeekPos = m_pSeekCursor->getRow() - 1;
+ AdjustRows();
+ }
+ }
+ catch(Exception&)
+ {
+ return;
+ }
+ }
+
+ long nNewRow = m_nTotalCount + 1;
+ if (nNewRow > 0 && GetCurRow() != nNewRow)
+ MoveToPosition(nNewRow - 1);
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::SetDesignMode(sal_Bool bMode)
+{
+ if (IsDesignMode() != bMode)
+ {
+ // Enable/Disable f�r den Designmode anpassen damit die Headerbar konfigurierbar bleibt
+ if (bMode)
+ {
+ if (!IsEnabled())
+ {
+ Enable();
+ GetDataWindow().Disable();
+ }
+ }
+ else
+ {
+ // komplett disablen
+ if (!GetDataWindow().IsEnabled())
+ Disable();
+ }
+
+ m_bDesignMode = bMode;
+ GetDataWindow().SetMouseTransparent(bMode);
+ SetMouseTransparent(bMode);
+
+ m_aBar.InvalidateAll(m_nCurrentPos, sal_True);
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::SetFilterMode(sal_Bool bMode)
+{
+ if (IsFilterMode() != bMode)
+ {
+ m_bFilterMode = bMode;
+
+ if (bMode)
+ {
+ SetUpdateMode(sal_False);
+
+ // es gibt kein Cursor mehr
+ if (IsEditing())
+ DeactivateCell();
+ RemoveRows(sal_False);
+
+ m_xEmptyRow = new DbGridRow();
+
+ // setting the new filter controls
+ for (sal_uInt16 i = 0; i<m_aColumns.Count(); ++i)
+ {
+ DbGridColumn* pCurCol = m_aColumns.GetObject(i);
+ if (!pCurCol->IsHidden())
+ pCurCol->UpdateControl();
+ }
+
+ // one row for filtering
+ RowInserted(0, 1, sal_True);
+ SetUpdateMode(sal_True);
+ }
+ else
+ setDataSource(Reference< XRowSet > ());
+ }
+}
+// -----------------------------------------------------------------------------
+String DbGridControl::GetCellText(long _nRow, sal_uInt16 _nColId) const
+{
+ DbGridColumn* pColumn = m_aColumns.GetObject( GetModelColumnPos( _nColId ) );
+ String sRet;
+ if ( const_cast<DbGridControl*>(this)->SeekRow(_nRow) )
+ sRet = GetCurrentRowCellText(pColumn, m_xPaintRow);
+ return sRet;
+}
+//------------------------------------------------------------------------------
+XubString DbGridControl::GetCurrentRowCellText(DbGridColumn* pColumn,const DbGridRowRef& _rRow) const
+{
+ // Ausgabe des Textes fuer eine Zelle
+ XubString aText;
+ if ( pColumn && IsValid(m_xPaintRow) )
+ aText = pColumn->GetCellText(_rRow, m_xFormatter);
+ return aText;
+}
+
+//------------------------------------------------------------------------------
+sal_uInt32 DbGridControl::GetTotalCellWidth(long nRow, sal_uInt16 nColId)
+{
+ if (SeekRow(nRow))
+ {
+ DbGridColumn* pColumn = m_aColumns.GetObject(GetModelColumnPos(nColId));
+ return GetDataWindow().GetTextWidth(GetCurrentRowCellText(pColumn,m_xPaintRow));
+ }
+ else
+ return 30; //xxxx
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::PreExecuteRowContextMenu(sal_uInt16 /*nRow*/, PopupMenu& rMenu)
+{
+ sal_Bool bDelete = (m_nOptions & OPT_DELETE) && GetSelectRowCount() && !IsCurrentAppending();
+ // ist nur die Leerzeile selektiert, dann nicht loeschen
+ bDelete = bDelete && !((m_nOptions & OPT_INSERT) && GetSelectRowCount() == 1 && IsRowSelected(GetRowCount() - 1));
+
+ rMenu.EnableItem(SID_FM_DELETEROWS, bDelete);
+ rMenu.EnableItem(SID_FM_RECORD_SAVE, IsModified());
+
+ // the undo is more difficult
+ sal_Bool bCanUndo = IsModified();
+ long nState = -1;
+ if (m_aMasterStateProvider.IsSet())
+ nState = m_aMasterStateProvider.Call((void*)SID_FM_RECORD_UNDO);
+ bCanUndo &= ( 0 != nState );
+
+ rMenu.EnableItem(SID_FM_RECORD_UNDO, bCanUndo);
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::PostExecuteRowContextMenu(sal_uInt16 /*nRow*/, const PopupMenu& /*rMenu*/, sal_uInt16 nExecutionResult)
+{
+ switch (nExecutionResult)
+ {
+ case SID_FM_DELETEROWS:
+ // delete asynchron
+ if (m_nDeleteEvent)
+ Application::RemoveUserEvent(m_nDeleteEvent);
+ m_nDeleteEvent = Application::PostUserEvent(LINK(this,DbGridControl,OnDelete));
+ break;
+ case SID_FM_RECORD_UNDO:
+ Undo();
+ break;
+ case SID_FM_RECORD_SAVE:
+ SaveRow();
+ break;
+ default:
+ break;
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::DataSourcePropertyChanged(const PropertyChangeEvent& evt) throw( RuntimeException )
+{
+ TRACE_RANGE("DbGridControl::DataSourcePropertyChanged");
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ // prop "IsModified" changed ?
+ // during update don't care about the modified state
+ if (!IsUpdating() && evt.PropertyName.compareTo(FM_PROP_ISMODIFIED) == COMPARE_EQUAL)
+ {
+ Reference< XPropertySet > xSource(evt.Source, UNO_QUERY);
+ DBG_ASSERT( xSource.is(), "DbGridControl::DataSourcePropertyChanged: invalid event source!" );
+ sal_Bool bIsNew = sal_False;
+ if (xSource.is())
+ bIsNew = ::comphelper::getBOOL(xSource->getPropertyValue(FM_PROP_ISNEW));
+
+ if (bIsNew && m_xCurrentRow.Is())
+ {
+ DBG_ASSERT(::comphelper::getBOOL(xSource->getPropertyValue(FM_PROP_ROWCOUNTFINAL)), "DbGridControl::DataSourcePropertyChanged : somebody moved the form to a new record before the row count was final !");
+ sal_Int32 nRecordCount = 0;
+ xSource->getPropertyValue(FM_PROP_ROWCOUNT) >>= nRecordCount;
+ if (::comphelper::getBOOL(evt.NewValue))
+ { // modified state changed from sal_False to sal_True and we're on a insert row
+ // -> we've to add a new grid row
+ if ((nRecordCount == GetRowCount() - 1) && m_xCurrentRow->IsNew())
+ {
+ RowInserted(GetRowCount(), 1, sal_True);
+ InvalidateStatusCell(m_nCurrentPos);
+ m_aBar.InvalidateAll(m_nCurrentPos);
+ }
+ }
+ else
+ { // modified state changed from sal_True to sal_False and we're on a insert row
+ // we have two "new row"s at the moment : the one we're editing currently (where the current
+ // column is the only dirty element) and a "new new" row which is completely clean. As the first
+ // one is about to be cleaned, too, the second one is obsolet now.
+ if (m_xCurrentRow->IsNew() && nRecordCount == (GetRowCount() - 2))
+ {
+ RowRemoved(GetRowCount() - 1, 1, sal_True);
+ InvalidateStatusCell(m_nCurrentPos);
+ m_aBar.InvalidateAll(m_nCurrentPos);
+ }
+ }
+ }
+ if (m_xCurrentRow.Is())
+ {
+ m_xCurrentRow->SetStatus(::comphelper::getBOOL(evt.NewValue) ? GRS_MODIFIED : GRS_CLEAN);
+ m_xCurrentRow->SetNew( bIsNew );
+ InvalidateStatusCell(m_nCurrentPos);
+ TRACE_RANGE_MESSAGE1("modified flag changed, new state : %s", ROWSTATUS(m_xCurrentRow));
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::StartDrag( sal_Int8 /*nAction*/, const Point& rPosPixel )
+{
+ if (!m_pSeekCursor || IsResizing())
+ return;
+
+ sal_uInt16 nColId = GetColumnAtXPosPixel(rPosPixel.X());
+ long nRow = GetRowAtYPosPixel(rPosPixel.Y());
+ if (nColId != HANDLE_ID && nRow >= 0)
+ {
+ if (GetDataWindow().IsMouseCaptured())
+ GetDataWindow().ReleaseMouse();
+
+ DbGridColumn* pColumn = m_aColumns.GetObject(GetModelColumnPos(nColId));
+ OStringTransferable* pTransferable = new OStringTransferable(GetCurrentRowCellText(pColumn,m_xPaintRow));
+ Reference< XTransferable > xEnsureDelete(pTransferable);
+ pTransferable->StartDrag(this, DND_ACTION_COPY);
+ }
+}
+
+//------------------------------------------------------------------------------
+sal_Bool DbGridControl::canCopyCellText(sal_Int32 _nRow, sal_Int16 _nColId)
+{
+ return (_nRow >= 0)
+ && (_nRow < GetRowCount())
+ && (_nColId > HANDLE_ID)
+ && (_nColId <= ColCount());
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::copyCellText(sal_Int32 _nRow, sal_Int16 _nColId)
+{
+ DBG_ASSERT(canCopyCellText(_nRow, _nColId), "DbGridControl::copyCellText: invalid call!");
+ DbGridColumn* pColumn = m_aColumns.GetObject(GetModelColumnPos(_nColId));
+ SeekRow(_nRow);
+ OStringTransfer::CopyString( GetCurrentRowCellText( pColumn,m_xPaintRow ), this );
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::executeRowContextMenu( long _nRow, const Point& _rPreferredPos )
+{
+ PopupMenu aContextMenu( SVX_RES( RID_SVXMNU_ROWS ) );
+
+ PreExecuteRowContextMenu( (sal_uInt16)_nRow, aContextMenu );
+ aContextMenu.RemoveDisabledEntries( sal_True, sal_True );
+ PostExecuteRowContextMenu( (sal_uInt16)_nRow, aContextMenu, aContextMenu.Execute( this, _rPreferredPos ) );
+
+ // TODO: why this weird cast to sal_uInt16? What if we really have more than 65535 lines?
+ // -> change this to sal_uInt32
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::Command(const CommandEvent& rEvt)
+{
+ switch (rEvt.GetCommand())
+ {
+ case COMMAND_CONTEXTMENU:
+ {
+ if ( !m_pSeekCursor )
+ {
+ DbGridControl_Base::Command(rEvt);
+ return;
+ }
+
+ if ( !rEvt.IsMouseEvent() )
+ { // context menu requested by keyboard
+ if ( GetSelectRowCount() )
+ {
+ long nRow = FirstSelectedRow( );
+
+ ::Rectangle aRowRect( GetRowRectPixel( nRow, sal_True ) );
+ executeRowContextMenu( nRow, aRowRect.LeftCenter() );
+
+ // handled
+ return;
+ }
+ }
+
+ sal_uInt16 nColId = GetColumnAtXPosPixel(rEvt.GetMousePosPixel().X());
+ long nRow = GetRowAtYPosPixel(rEvt.GetMousePosPixel().Y());
+
+ if (nColId == HANDLE_ID)
+ {
+ executeRowContextMenu( nRow, rEvt.GetMousePosPixel() );
+ }
+ else if (canCopyCellText(nRow, nColId))
+ {
+ PopupMenu aContextMenu(SVX_RES(RID_SVXMNU_CELL));
+ aContextMenu.RemoveDisabledEntries(sal_True, sal_True);
+ switch (aContextMenu.Execute(this, rEvt.GetMousePosPixel()))
+ {
+ case SID_COPY:
+ copyCellText(nRow, nColId);
+ break;
+ }
+ }
+ else
+ {
+ DbGridControl_Base::Command(rEvt);
+ return;
+ }
+ }
+ default:
+ DbGridControl_Base::Command(rEvt);
+ }
+}
+
+//------------------------------------------------------------------------------
+IMPL_LINK(DbGridControl, OnDelete, void*, /*EMPTYTAG*/ )
+{
+ DBG_CHKTHIS(DbGridControl, NULL );
+ m_nDeleteEvent = 0;
+ DeleteSelectedRows();
+ return 0;
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::DeleteSelectedRows()
+{
+ DBG_ASSERT(GetSelection(), "keine selection!!!");
+
+ if (!m_pSeekCursor)
+ return;
+
+/* Application::EnterWait();
+ Reference< XPropertySet > xSet = (XPropertySet*)xSeekCursor->queryInterface(XPropertySet::getSmartUik());
+
+ // wenn mehr als 25 Datensaetze geloescht werden, wird der Cache abgeschaltet
+ // da das loeschen ansonsten zu langsam wird
+ sal_uInt16 nCacheSize = 0;
+ if (GetSelectRowCount() > 25)
+ {
+ // CacheSize merken und Cache zuruecksetzen
+ nCacheSize = xSet->getPropertyValue(L"CacheSize").getUINT16();
+ if (nCacheSize)
+ xSet->setPropertyValue(L"CacheSize", Any(sal_uInt16(0)));
+ } */
+
+
+ /*
+ // mu� der Cache wiederhergestellt werden?
+ if (nCacheSize)
+ {
+ // Cache wieder einschalten
+ xSet->setPropertyValue(L"CacheSize", Any(sal_uInt16(nCacheSize)));
+
+ // Browser neu einstellen
+ RecalcRows(GetTopRow(), GetVisibleRows(), sal_True);
+
+ // aktuelle Zeile aktualisieren
+ SeekCursor(GetCurRow());
+ if (IsAppendRow(m_nSeekPos))
+ xDataCursor->addRecord();
+ else
+ {
+ Any aBookmark = xSeekCursor->getBookmark();
+ xDataCursor->moveToBookmark(aBookmark);
+ }
+ m_xCurrentRow = new DbGridRow(xDataCursor);
+ m_nCurrentPos = m_nSeekPos;
+
+ // complett invalidieren
+ Invalidate();
+ }
+ else
+ // Browser neu einstellen
+ RecalcRows(GetTopRow(), GetVisibleRows(), sal_True);
+
+ // gibt es keine Selection mehr?
+ if (!GetSelectRowCount())
+ ActivateCell();
+
+ m_aBar.InvalidateAll();
+ Application::LeaveWait();
+
+ m_bUpdating = sal_False;
+*/
+}
+
+//------------------------------------------------------------------------------
+CellController* DbGridControl::GetController(long /*nRow*/, sal_uInt16 nColumnId)
+{
+ if (!IsValid(m_xCurrentRow) || !IsEnabled())
+ return NULL;
+
+ DbGridColumn* pColumn = m_aColumns.GetObject(GetModelColumnPos(nColumnId));
+ if (!pColumn)
+ return NULL;
+
+ CellController* pReturn = NULL;
+ if (IsFilterMode())
+ pReturn = &pColumn->GetController();
+ else
+ {
+ if (::comphelper::hasProperty(FM_PROP_ENABLED, pColumn->getModel()))
+ {
+ if (!::comphelper::getBOOL(pColumn->getModel()->getPropertyValue(FM_PROP_ENABLED)))
+ return NULL;
+ }
+
+ sal_Bool bInsert = (m_xCurrentRow->IsNew() && (m_nOptions & OPT_INSERT));
+ sal_Bool bUpdate = (!m_xCurrentRow->IsNew() && (m_nOptions & OPT_UPDATE));
+
+ if ((bInsert && !pColumn->IsAutoValue()) || bUpdate || m_bForceROController)
+ {
+ pReturn = &pColumn->GetController();
+ if (pReturn)
+ {
+ // wenn es eine Edit-Zeile ist, kann ich ihr das forced read-only mitgeben
+ if (!pReturn->ISA(EditCellController) && !pReturn->ISA(SpinCellController))
+ // ich konnte den Controller in forceROController nicht auf ReadOnly setzen
+ if (!bInsert && !bUpdate)
+ // ich bin nur hier, da m_bForceROController gesetzt war
+ // -> lieber kein Controller als einer ohne RO
+ pReturn = NULL;
+ }
+ }
+ }
+ return pReturn;
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::InitController(CellControllerRef& /*rController*/, long /*nRow*/, sal_uInt16 nColumnId)
+{
+ DbGridColumn* pColumn = m_aColumns.GetObject(GetModelColumnPos(nColumnId));
+ if (pColumn)
+ pColumn->UpdateFromField(m_xCurrentRow, m_xFormatter);
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::CellModified()
+{
+ TRACE_RANGE("DbGridControl::CellModified");
+
+ {
+ ::osl::MutexGuard aGuard(m_aAdjustSafety);
+ if (m_nAsynAdjustEvent)
+ {
+ TRACE_RANGE_MESSAGE1("forcing a synchron call to ", m_bPendingAdjustRows ? "AdjustRows" : "AdustDataSource");
+ RemoveUserEvent(m_nAsynAdjustEvent);
+ m_nAsynAdjustEvent = 0;
+
+ // force the call : this should be no problem as we're probably running in the solar thread here
+ // (cell modified is triggered by user actions)
+ if (m_bPendingAdjustRows)
+ AdjustRows();
+ else
+ AdjustDataSource();
+ }
+ }
+
+ if (!IsFilterMode() && IsValid(m_xCurrentRow) && !m_xCurrentRow->IsModified())
+ {
+ // Einschalten des Editiermodus
+ // Datensatz soll eingefuegt werden
+ if (m_xCurrentRow->IsNew())
+ {
+ m_xCurrentRow->SetStatus(GRS_MODIFIED);
+ TRACE_RANGE_MESSAGE("current row is new, new state : MODIFIED");
+ // wenn noch keine Zeile hinzugefuegt wurde, dann neue hinzunehmen
+ if (m_nCurrentPos == GetRowCount() - 1)
+ {
+ // RowCount um einen erhoehen
+ RowInserted(GetRowCount(), 1, sal_True);
+ InvalidateStatusCell(m_nCurrentPos);
+ m_aBar.InvalidateAll(m_nCurrentPos);
+ }
+ }
+ else if (m_xCurrentRow->GetStatus() != GRS_MODIFIED)
+ {
+ m_xCurrentRow->SetState(m_pDataCursor, sal_False);
+ TRACE_RANGE_MESSAGE1("current row is not new, after SetState, new state : %s", ROWSTATUS(m_xCurrentRow));
+ m_xCurrentRow->SetStatus(GRS_MODIFIED);
+ TRACE_RANGE_MESSAGE("current row is not new, new state : MODIFIED");
+ InvalidateStatusCell(m_nCurrentPos);
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::Dispatch(sal_uInt16 nId)
+{
+ if (nId == BROWSER_CURSORENDOFFILE)
+ {
+ if (m_nOptions & OPT_INSERT)
+ AppendNew();
+ else
+ MoveToLast();
+ }
+ else
+ DbGridControl_Base::Dispatch(nId);
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::Undo()
+{
+ if (!IsFilterMode() && IsValid(m_xCurrentRow) && IsModified())
+ {
+ // check if we have somebody doin' the UNDO for us
+ long nState = -1;
+ if (m_aMasterStateProvider.IsSet())
+ nState = m_aMasterStateProvider.Call((void*)SID_FM_RECORD_UNDO);
+ if (nState>0)
+ { // yes, we have, and the slot is enabled
+ DBG_ASSERT(m_aMasterSlotExecutor.IsSet(), "DbGridControl::Undo : a state, but no execute link ?");
+ long lResult = m_aMasterSlotExecutor.Call((void*)SID_FM_RECORD_UNDO);
+ if (lResult)
+ // handled
+ return;
+ }
+ else if (nState == 0)
+ // yes, we have, and the slot is disabled
+ return;
+
+ BeginCursorAction();
+
+ sal_Bool bAppending = m_xCurrentRow->IsNew();
+ sal_Bool bDirty = m_xCurrentRow->IsModified();
+
+ try
+ {
+ // Editieren abbrechen
+ Reference< XResultSetUpdate > xUpdateCursor((Reference< XInterface >)*m_pDataCursor, UNO_QUERY);
+ // no effects if we're not updating currently
+ if (bAppending)
+ // just refresh the row
+ xUpdateCursor->moveToInsertRow();
+ else
+ xUpdateCursor->cancelRowUpdates();
+
+ }
+ catch(Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ EndCursorAction();
+
+ m_xDataRow->SetState(m_pDataCursor, sal_False);
+ if (&m_xPaintRow == &m_xCurrentRow)
+ m_xPaintRow = m_xCurrentRow = m_xDataRow;
+ else
+ m_xCurrentRow = m_xDataRow;
+
+ if (bAppending && (DbGridControl_Base::IsModified() || bDirty))
+ // remove the row
+ if (m_nCurrentPos == GetRowCount() - 2)
+ { // maybe we already removed it (in resetCurrentRow, called if the above moveToInsertRow
+ // caused our data source form to be reset - which should be the usual case ....)
+ RowRemoved(GetRowCount() - 1, 1, sal_True);
+ m_aBar.InvalidateAll(m_nCurrentPos);
+ }
+
+ RowModified(m_nCurrentPos);
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::resetCurrentRow()
+{
+ if (IsModified())
+ {
+ // scenario : we're on the insert row, the row is dirty, and thus there exists a "second" insert row (which
+ // is clean). Normally in DataSourcePropertyChanged we would remove this second row if the modified state of
+ // the insert row changes from sal_True to sal_False. But if our current cell is the only modified element (means the
+ // data source isn't modified) and we're reset this DataSourcePropertyChanged would never be called, so we
+ // would never delete the obsolet "second insert row". Thus in this special case this method here
+ // is the only possibility to determine the redundance of the row (resetCurrentRow is called when the
+ // "first insert row" is about to be cleaned, so of course the "second insert row" is redundant now)
+ Reference< XPropertySet > xDataSource = getDataSource()->getPropertySet();
+ if (xDataSource.is() && !::comphelper::getBOOL(xDataSource->getPropertyValue(FM_PROP_ISMODIFIED)))
+ {
+ // are we on a new row currently ?
+ if (m_xCurrentRow->IsNew())
+ {
+ if (m_nCurrentPos == GetRowCount() - 2)
+ {
+ RowRemoved(GetRowCount() - 1, 1, sal_True);
+ m_aBar.InvalidateAll(m_nCurrentPos);
+ }
+ }
+ }
+
+ // update the rows
+ m_xDataRow->SetState(m_pDataCursor, sal_False);
+ if (&m_xPaintRow == &m_xCurrentRow)
+ m_xPaintRow = m_xCurrentRow = m_xDataRow;
+ else
+ m_xCurrentRow = m_xDataRow;
+ }
+
+ RowModified(GetCurRow()); // will update the current controller if affected
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::RowModified( long nRow, sal_uInt16 /*nColId*/ )
+{
+ if (nRow == m_nCurrentPos && IsEditing())
+ {
+ CellControllerRef aTmpRef = Controller();
+ aTmpRef->ClearModified();
+ InitController(aTmpRef, m_nCurrentPos, GetCurColumnId());
+ }
+ DbGridControl_Base::RowModified(nRow);
+}
+
+//------------------------------------------------------------------------------
+sal_Bool DbGridControl::IsModified() const
+{
+ return !IsFilterMode() && IsValid(m_xCurrentRow) && (m_xCurrentRow->IsModified() || DbGridControl_Base::IsModified());
+}
+
+//------------------------------------------------------------------------------
+sal_Bool DbGridControl::IsCurrentAppending() const
+{
+ return m_xCurrentRow.Is() && m_xCurrentRow->IsNew();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool DbGridControl::IsInsertionRow(long nRow) const
+{
+ return (m_nOptions & OPT_INSERT) && m_nTotalCount >= 0 && (nRow == GetRowCount() - 1);
+}
+
+//------------------------------------------------------------------------------
+sal_Bool DbGridControl::SaveModified()
+{
+ TRACE_RANGE("DbGridControl::SaveModified");
+ DBG_ASSERT(IsValid(m_xCurrentRow), "GridControl:: Invalid row");
+ if (!IsValid(m_xCurrentRow))
+ return sal_True;
+
+ // Uebernimmt die Dateneingabe fuer das Feld
+ // Hat es aenderungen im aktuellen Eingabefeld gegeben ?
+ if (!DbGridControl_Base::IsModified())
+ return sal_True;
+
+ DbGridColumn* pColumn = m_aColumns.GetObject(GetModelColumnPos(GetCurColumnId()));
+ sal_Bool bOK = pColumn->Commit();
+ DBG_ASSERT( Controller().Is(), "DbGridControl::SaveModified: was modified, by have no controller?!" );
+ if ( !Controller().Is() )
+ // this might happen if the callbacks implicitly triggered by Commit
+ // fiddled with the form or the control ...
+ // (Note that this here is a workaround, at most. We need a general concept how
+ // to treat this, you can imagine an arbitrary number of scenarios where a callback
+ // triggers something which leaves us in an expected state.)
+ // #i67147# / 2006-07-17 / frank.schoenheit@sun.com
+ return bOK;
+
+ if (bOK)
+ {
+ Controller()->ClearModified();
+
+ if ( IsValid(m_xCurrentRow) )
+ {
+ m_xCurrentRow->SetState(m_pDataCursor, sal_False);
+ TRACE_RANGE_MESSAGE1("explicit SetState, new state : %s", ROWSTATUS(m_xCurrentRow));
+ InvalidateStatusCell( m_nCurrentPos );
+ }
+#ifdef DBG_UTIL
+ else
+ {
+ TRACE_RANGE_MESSAGE1("no SetState, new state : %s", ROWSTATUS(m_xCurrentRow));
+ }
+#endif
+ }
+ else
+ {
+ // reset the modified flag ....
+ Controller()->SetModified();
+ }
+
+ return bOK;
+}
+
+//------------------------------------------------------------------------------
+sal_Bool DbGridControl::SaveRow()
+{
+ TRACE_RANGE("DbGridControl::SaveRow");
+ // gueltige Zeile
+ if (!IsValid(m_xCurrentRow) || !IsModified())
+ return sal_True;
+ // Wert des Controllers noch nicht gespeichert
+ else if (Controller().Is() && Controller()->IsModified())
+ {
+ if (!SaveModified())
+ return sal_False;
+ }
+ m_bUpdating = sal_True;
+
+ BeginCursorAction();
+ sal_Bool bAppending = m_xCurrentRow->IsNew();
+ sal_Bool bSuccess = sal_False;
+ try
+ {
+ Reference< XResultSetUpdate > xUpdateCursor((Reference< XInterface >)*m_pDataCursor, UNO_QUERY);
+ if (bAppending)
+ xUpdateCursor->insertRow();
+ else
+ xUpdateCursor->updateRow();
+ bSuccess = sal_True;
+ }
+ catch(SQLException& e)
+ {
+ (void)e; // make compiler happy
+ EndCursorAction();
+ m_bUpdating = sal_False;
+ return sal_False;
+ }
+
+ try
+ {
+ if (bSuccess)
+ {
+ // if we are appending we still sit on the insert row
+ // we don't move just clear the flags not to move on the current row
+ m_xCurrentRow->SetState(m_pDataCursor, sal_False);
+ TRACE_RANGE_MESSAGE1("explicit SetState after a successfull update, new state : %s", ROWSTATUS(m_xCurrentRow));
+ m_xCurrentRow->SetNew(sal_False);
+
+ // adjust the seekcursor if it is on the same position as the datacursor
+ if (m_nSeekPos == m_nCurrentPos || bAppending)
+ {
+ // get the bookmark to refetch the data
+ // in insert mode we take the new bookmark of the data cursor
+ Any aBookmark = bAppending ? m_pDataCursor->getBookmark() : m_pSeekCursor->getBookmark();
+ m_pSeekCursor->moveToBookmark(aBookmark);
+ // get the data
+ m_xSeekRow->SetState(m_pSeekCursor, sal_True);
+ m_nSeekPos = m_pSeekCursor->getRow() - 1;
+ }
+ }
+ // and repaint the row
+ RowModified(m_nCurrentPos);
+ }
+ catch(Exception&)
+ {
+ }
+
+ m_bUpdating = sal_False;
+ EndCursorAction();
+
+ // The old code returned (nRecords != 0) here.
+ // Me thinks this is wrong : If something goes wrong while update the record, an exception will be thrown,
+ // which results in a "return sal_False" (see above). If no exception is thrown, everything is fine. If nRecords
+ // is zero, this simply means all fields had their original values.
+ // FS - 06.12.99 - 70502
+ return sal_True;
+}
+
+//------------------------------------------------------------------------------
+long DbGridControl::PreNotify(NotifyEvent& rEvt)
+{
+ // keine Events der Navbar behandeln
+ if (m_aBar.IsWindowOrChild(rEvt.GetWindow()))
+ return BrowseBox::PreNotify(rEvt);
+
+ switch (rEvt.GetType())
+ {
+ case EVENT_KEYINPUT:
+ {
+ const KeyEvent* pKeyEvent = rEvt.GetKeyEvent();
+
+ sal_uInt16 nCode = pKeyEvent->GetKeyCode().GetCode();
+ sal_Bool bShift = pKeyEvent->GetKeyCode().IsShift();
+ sal_Bool bCtrl = pKeyEvent->GetKeyCode().IsMod1();
+ sal_Bool bAlt = pKeyEvent->GetKeyCode().IsMod2();
+ if ( ( KEY_TAB == nCode ) && bCtrl && !bAlt )
+ {
+ // Ctrl-Tab is used to step out of the control, without traveling to the
+ // remaining cells first
+ // -> build a new key event without the Ctrl-key, and let the very base class handle it
+ KeyCode aNewCode( KEY_TAB, bShift, sal_False, sal_False, sal_False );
+ KeyEvent aNewEvent( pKeyEvent->GetCharCode(), aNewCode );
+
+ // call the Control - our direct base class will interpret this in a way we do not want (and do
+ // a cell traveling)
+ Control::KeyInput( aNewEvent );
+ return 1;
+ }
+
+ if ( !bShift && !bCtrl && ( KEY_ESCAPE == nCode ) )
+ {
+ if (IsModified())
+ {
+ Undo();
+ return 1;
+ }
+ }
+ else if ( ( KEY_DELETE == nCode ) && !bShift && !bCtrl ) // delete rows
+ {
+ if ((m_nOptions & OPT_DELETE) && GetSelectRowCount())
+ {
+ // delete asynchron
+ if (m_nDeleteEvent)
+ Application::RemoveUserEvent(m_nDeleteEvent);
+ m_nDeleteEvent = Application::PostUserEvent(LINK(this,DbGridControl,OnDelete));
+ return 1;
+ }
+ }
+ } // kein break!
+ default:
+ return DbGridControl_Base::PreNotify(rEvt);
+ }
+}
+
+//------------------------------------------------------------------------------
+sal_Bool DbGridControl::IsTabAllowed(sal_Bool bRight) const
+{
+ if (bRight)
+ // Tab nur wenn nicht auf der letzten Zelle
+ return GetCurRow() < (GetRowCount() - 1) || !m_bRecordCountFinal ||
+ GetViewColumnPos(GetCurColumnId()) < (GetViewColCount() - 1);
+ else
+ {
+ // Tab nur wenn nicht auf der ersten Zelle
+ return GetCurRow() > 0 || (GetCurColumnId() && GetViewColumnPos(GetCurColumnId()) > 0);
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::KeyInput( const KeyEvent& rEvt )
+{
+ if (rEvt.GetKeyCode().GetFunction() == KEYFUNC_COPY)
+ {
+ long nRow = GetCurRow();
+ sal_uInt16 nColId = GetCurColumnId();
+ if (nRow >= 0 && nRow < GetRowCount() && nColId < ColCount())
+ {
+ DbGridColumn* pColumn = m_aColumns.GetObject(GetModelColumnPos(nColId));
+ OStringTransfer::CopyString( GetCurrentRowCellText( pColumn,m_xPaintRow ), this );
+ return;
+ }
+ }
+ DbGridControl_Base::KeyInput(rEvt);
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::HideColumn(sal_uInt16 nId)
+{
+ DeactivateCell();
+
+ // determine the col for the focus to set to after removal
+ sal_uInt16 nPos = GetViewColumnPos(nId);
+ sal_uInt16 nNewColId = nPos == (ColCount()-1)
+ ? GetColumnIdFromViewPos(nPos-1) // last col is to be removed -> take the previous
+ : GetColumnIdFromViewPos(nPos+1); // take the next
+
+ long lCurrentWidth = GetColumnWidth(nId);
+ DbGridControl_Base::RemoveColumn(nId);
+ // don't use my own RemoveColumn, this would remove it from m_aColumns, too
+
+ // update my model
+ DbGridColumn* pColumn = m_aColumns.GetObject(GetModelColumnPos(nId));
+ DBG_ASSERT(pColumn, "DbGridControl::HideColumn : somebody did hide a nonexistent column !");
+ if (pColumn)
+ {
+ pColumn->m_bHidden = sal_True;
+ pColumn->m_nLastVisibleWidth = CalcReverseZoom(lCurrentWidth);
+ }
+
+ // and reset the focus
+ if ( nId == GetCurColumnId() )
+ GoToColumnId( nNewColId );
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::ShowColumn(sal_uInt16 nId)
+{
+ sal_uInt16 nPos = GetModelColumnPos(nId);
+ DBG_ASSERT(nPos != (sal_uInt16)-1, "DbGridControl::ShowColumn : invalid argument !");
+ if (nPos == (sal_uInt16)-1)
+ return;
+
+ DbGridColumn* pColumn = m_aColumns.GetObject(nPos);
+ if (!pColumn->IsHidden())
+ {
+ DBG_ASSERT(GetViewColumnPos(nId) != (sal_uInt16)-1, "DbGridControl::ShowColumn : inconsistent internal state !");
+ // if the column isn't marked as hidden, it should be visible, shouldn't it ?
+ return;
+ }
+ DBG_ASSERT(GetViewColumnPos(nId) == (sal_uInt16)-1, "DbGridControl::ShowColumn : inconsistent internal state !");
+ // the opposite situation ...
+
+ // to determine the new view position we need an adjacent non-hidden column
+ sal_uInt16 nNextNonHidden = (sal_uInt16)-1;
+ // first search the cols to the right
+ for (sal_uInt16 i = nPos + 1; i<m_aColumns.Count(); ++i)
+ {
+ DbGridColumn* pCurCol = m_aColumns.GetObject(i);
+ if (!pCurCol->IsHidden())
+ {
+ nNextNonHidden = i;
+ break;
+ }
+ }
+ if ((nNextNonHidden == (sal_uInt16)-1) && (nPos > 0))
+ {
+ // then to the left
+ for (sal_uInt16 i = nPos; i>0; --i)
+ {
+ DbGridColumn* pCurCol = m_aColumns.GetObject(i-1);
+ if (!pCurCol->IsHidden())
+ {
+ nNextNonHidden = i-1;
+ break;
+ }
+ }
+ }
+ sal_uInt16 nNewViewPos = (nNextNonHidden == (sal_uInt16)-1)
+ ? 1 // there is no visible column -> insert behinde the handle col
+ : GetViewColumnPos(m_aColumns.GetObject(nNextNonHidden)->GetId()) + 1;
+ // the first non-handle col has "view pos" 0, but the pos arg for InsertDataColumn expects
+ // a position 1 for the first non-handle col -> +1
+ DBG_ASSERT(nNewViewPos != (sal_uInt16)-1, "DbGridControl::ShowColumn : inconsistent internal state !");
+ // we found a col marked as visible but got no view pos for it ...
+
+ if ((nNextNonHidden<nPos) && (nNextNonHidden != (sal_uInt16)-1))
+ // nNextNonHidden is a column to the left, so we want to insert the new col _right_ beside it's pos
+ ++nNewViewPos;
+
+ DeactivateCell();
+
+ ::rtl::OUString aName;
+ pColumn->getModel()->getPropertyValue(FM_PROP_LABEL) >>= aName;
+ InsertDataColumn(nId, aName, CalcZoom(pColumn->m_nLastVisibleWidth), HIB_CENTER | HIB_VCENTER | HIB_CLICKABLE, nNewViewPos);
+ pColumn->m_bHidden = sal_False;
+
+ ActivateCell();
+ Invalidate();
+}
+
+//------------------------------------------------------------------------------
+sal_uInt16 DbGridControl::GetColumnIdFromModelPos( sal_uInt16 nPos ) const
+{
+ if (nPos >= m_aColumns.Count())
+ {
+ DBG_ERROR("DbGridControl::GetColumnIdFromModelPos : invalid argument !");
+ return (sal_uInt16)-1;
+ }
+
+ DbGridColumn* pCol = m_aColumns.GetObject(nPos);
+#if (OSL_DEBUG_LEVEL > 0) || defined DBG_UTIL
+ // in der Debug-Version rechnen wir die ModelPos in eine ViewPos um und vergleichen das mit dem Wert,
+ // den wir zurueckliefern werden (nId an der entsprechenden Col in m_aColumns)
+
+ if (!pCol->IsHidden())
+ { // macht nur Sinn, wenn die Spalte sichtbar ist
+ sal_uInt16 nViewPos = nPos;
+ for (sal_uInt16 i=0; i<m_aColumns.Count() && i<nPos; ++i)
+ if (m_aColumns.GetObject(i)->IsHidden())
+ --nViewPos;
+
+ DBG_ASSERT(pCol && GetColumnIdFromViewPos(nViewPos) == pCol->GetId(),
+ "DbGridControl::GetColumnIdFromModelPos : this isn't consistent .... did I misunderstand something ?");
+ }
+#endif
+ return pCol->GetId();
+}
+
+//------------------------------------------------------------------------------
+sal_uInt16 DbGridControl::GetModelColumnPos( sal_uInt16 nId ) const
+{
+ for (sal_uInt16 i=0; i<m_aColumns.Count(); ++i)
+ if (m_aColumns.GetObject(i)->GetId() == nId)
+ return i;
+
+ return GRID_COLUMN_NOT_FOUND;
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::implAdjustInSolarThread(sal_Bool _bRows)
+{
+ TRACE_RANGE("DbGridControl::implAdjustInSolarThread");
+ ::osl::MutexGuard aGuard(m_aAdjustSafety);
+ if (::vos::OThread::getCurrentIdentifier() != Application::GetMainThreadIdentifier())
+ {
+ m_nAsynAdjustEvent = PostUserEvent(LINK(this, DbGridControl, OnAsyncAdjust), reinterpret_cast< void* >( _bRows ));
+ m_bPendingAdjustRows = _bRows;
+#ifdef DBG_UTIL
+ if (_bRows)
+ TRACE_RANGE_MESSAGE("posting an AdjustRows")
+ else
+ TRACE_RANGE_MESSAGE("posting an AdjustDataSource")
+#endif
+ }
+ else
+ {
+#ifdef DBG_UTIL
+ if (_bRows)
+ TRACE_RANGE_MESSAGE("doing an AdjustRows")
+ else
+ TRACE_RANGE_MESSAGE("doing an AdjustDataSource")
+#endif
+ // always adjust the rows before adjusting the data source
+ // If this is not necessary (because the row count did not change), nothing is done
+ // The problem is that we can't rely on the order of which the calls come in: If the cursor was moved
+ // to a position behind row count know 'til now, the cursorMoved notification may come before the
+ // RowCountChanged notification
+ // 94093 - 02.11.2001 - frank.schoenheit@sun.com
+ AdjustRows();
+
+ if ( !_bRows )
+ AdjustDataSource();
+ }
+}
+
+//------------------------------------------------------------------------------
+IMPL_LINK(DbGridControl, OnAsyncAdjust, void*, pAdjustWhat)
+{
+ m_nAsynAdjustEvent = 0;
+
+ AdjustRows();
+ // see implAdjustInSolarThread for a comment why we do this every time
+
+ if ( !pAdjustWhat )
+ AdjustDataSource();
+
+ return 0L;
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::BeginCursorAction()
+{
+ if (m_pFieldListeners)
+ {
+ ColumnFieldValueListeners* pListeners = (ColumnFieldValueListeners*)m_pFieldListeners;
+ ConstColumnFieldValueListenersIterator aIter = pListeners->begin();
+ while (aIter != pListeners->end())
+ {
+ GridFieldValueListener* pCurrent = (*aIter).second;
+ if (pCurrent)
+ pCurrent->suspend();
+ ++aIter;
+ }
+ }
+
+ if (m_pDataSourcePropListener)
+ m_pDataSourcePropListener->suspend();
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::EndCursorAction()
+{
+ if (m_pFieldListeners)
+ {
+ ColumnFieldValueListeners* pListeners = (ColumnFieldValueListeners*)m_pFieldListeners;
+ ConstColumnFieldValueListenersIterator aIter = pListeners->begin();
+ while (aIter != pListeners->end())
+ {
+ GridFieldValueListener* pCurrent = (*aIter).second;
+ if (pCurrent)
+ pCurrent->resume();
+ ++aIter;
+ }
+ }
+
+ if (m_pDataSourcePropListener)
+ m_pDataSourcePropListener->resume();
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::ConnectToFields()
+{
+ ColumnFieldValueListeners* pListeners = (ColumnFieldValueListeners*)m_pFieldListeners;
+ DBG_ASSERT(!pListeners || pListeners->size() == 0, "DbGridControl::ConnectToFields : please call DisconnectFromFields first !");
+
+ if (!pListeners)
+ {
+ pListeners = new ColumnFieldValueListeners;
+ m_pFieldListeners = pListeners;
+ }
+
+ for (sal_Int32 i=0; i<(sal_Int32)m_aColumns.Count(); ++i)
+ {
+ DbGridColumn* pCurrent = m_aColumns.GetObject(i);
+ sal_uInt16 nViewPos = pCurrent ? GetViewColumnPos(pCurrent->GetId()) : (sal_uInt16)-1;
+ if ((sal_uInt16)-1 == nViewPos)
+ continue;
+
+ Reference< XPropertySet > xField = pCurrent->GetField();
+ if (!xField.is())
+ continue;
+
+ // column is visible and bound here
+ GridFieldValueListener*& rpListener = (*pListeners)[pCurrent->GetId()];
+ DBG_ASSERT(!rpListener, "DbGridControl::ConnectToFields : already a listener for this column ?!");
+ rpListener = new GridFieldValueListener(*this, xField, pCurrent->GetId());
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::DisconnectFromFields()
+{
+ if (!m_pFieldListeners)
+ return;
+
+ ColumnFieldValueListeners* pListeners = (ColumnFieldValueListeners*)m_pFieldListeners;
+ while (pListeners->size())
+ {
+#ifdef DBG_UTIL
+ sal_Int32 nOldSize = pListeners->size();
+#endif
+ pListeners->begin()->second->dispose();
+ DBG_ASSERT(nOldSize > (sal_Int32)pListeners->size(), "DbGridControl::DisconnectFromFields : dispose on a listener should result in a removal from my list !");
+ }
+
+ delete pListeners;
+ m_pFieldListeners = NULL;
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::FieldValueChanged(sal_uInt16 _nId, const PropertyChangeEvent& /*_evt*/)
+{
+ osl::MutexGuard aPreventDestruction(m_aDestructionSafety);
+ // needed as this may run in a thread other than the main one
+ if (GetRowStatus(GetCurRow()) != DbGridControl_Base::MODIFIED)
+ // all other cases are handled elsewhere
+ return;
+
+ DbGridColumn* pColumn = m_aColumns.GetObject(GetModelColumnPos(_nId));
+ if (pColumn)
+ {
+ sal_Bool bAcquiredPaintSafety = sal_False;
+ while (!m_bWantDestruction && !bAcquiredPaintSafety)
+ bAcquiredPaintSafety = Application::GetSolarMutex().tryToAcquire();
+
+ if (m_bWantDestruction)
+ { // at this moment, within another thread, our destructor tries to destroy the listener which called this method
+ // => don't do anything
+ // 73365 - 23.02.00 - FS
+ if (bAcquiredPaintSafety)
+ // though the above while-loop suggests that (m_bWantDestruction && bAcquiredPaintSafety) is impossible,
+ // it isnt't, as m_bWantDestruction isn't protected with any mutex
+ Application::GetSolarMutex().release();
+ return;
+ }
+ // here we got the solar mutex, transfer it to a guard for safety reasons
+ ::vos::OGuard aPaintSafety(Application::GetSolarMutex());
+ Application::GetSolarMutex().release();
+
+ // and finally do the update ...
+ pColumn->UpdateFromField(m_xCurrentRow, m_xFormatter);
+ RowModified(GetCurRow(), _nId);
+ }
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::FieldListenerDisposing(sal_uInt16 _nId)
+{
+ ColumnFieldValueListeners* pListeners = (ColumnFieldValueListeners*)m_pFieldListeners;
+ if (!pListeners)
+ {
+ DBG_ERROR("DbGridControl::FieldListenerDisposing : invalid call (have no listener array) !");
+ return;
+ }
+
+ ColumnFieldValueListenersIterator aPos = pListeners->find(_nId);
+ if (aPos == pListeners->end())
+ {
+ DBG_ERROR("DbGridControl::FieldListenerDisposing : invalid call (did not find the listener) !");
+ return;
+ }
+
+ delete aPos->second;
+
+ pListeners->erase(aPos);
+}
+
+//------------------------------------------------------------------------------
+void DbGridControl::disposing(sal_uInt16 _nId, const EventObject& /*_rEvt*/)
+{
+ if (_nId == 0)
+ { // the seek cursor is beeing disposed
+ ::osl::MutexGuard aGuard(m_aAdjustSafety);
+ setDataSource(NULL,0); // our clone was disposed so we set our datasource to null to avoid later acces to it
+ if (m_nAsynAdjustEvent)
+ {
+ RemoveUserEvent(m_nAsynAdjustEvent);
+ m_nAsynAdjustEvent = 0;
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+sal_Int32 DbGridControl::GetAccessibleControlCount() const
+{
+ return DbGridControl_Base::GetAccessibleControlCount() + 1; // the navigation control
+}
+// -----------------------------------------------------------------------------
+Reference<XAccessible > DbGridControl::CreateAccessibleControl( sal_Int32 _nIndex )
+{
+ Reference<XAccessible > xRet;
+ if ( _nIndex == DbGridControl_Base::GetAccessibleControlCount() )
+ {
+ xRet = m_aBar.GetAccessible();
+ }
+ else
+ xRet = DbGridControl_Base::CreateAccessibleControl( _nIndex );
+ return xRet;
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessible > DbGridControl::CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumnPos )
+{
+ sal_uInt16 nColumnId = GetColumnId( _nColumnPos );
+ DbGridColumn* pColumn = m_aColumns.GetObject(GetModelColumnPos(nColumnId));
+ if ( pColumn )
+ {
+ Reference< ::com::sun::star::awt::XControl> xInt(pColumn->GetCell());
+ Reference< ::com::sun::star::awt::XCheckBox> xBox(xInt,UNO_QUERY);
+ if ( xBox.is() )
+ {
+ TriState eValue = STATE_NOCHECK;
+ switch( xBox->getState() )
+ {
+ case 0:
+ eValue = STATE_NOCHECK;
+ break;
+ case 1:
+ eValue = STATE_CHECK;
+ break;
+ case 2:
+ eValue = STATE_DONTKNOW;
+ break;
+ }
+ return DbGridControl_Base::CreateAccessibleCheckBoxCell( _nRow, _nColumnPos,eValue,sal_True );
+ }
+ }
+ return DbGridControl_Base::CreateAccessibleCell( _nRow, _nColumnPos );
+}
+// -----------------------------------------------------------------------------
+
+
diff --git a/svx/source/fmcomp/gridctrl.src b/svx/source/fmcomp/gridctrl.src
new file mode 100644
index 000000000000..874f3ae4f0d9
--- /dev/null
+++ b/svx/source/fmcomp/gridctrl.src
@@ -0,0 +1,259 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "svx/fmresids.hrc"
+#include <svx/svxids.hrc>
+#include "globlmn.hrc"
+#include "fmhelp.hrc"
+#include <svx/svxcommands.h>
+
+Menu RID_SVXMNU_ROWS
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = SID_FM_DELETEROWS ;
+ HelpId = HID_FM_DELETEROWS ;
+ Text [ en-US ] = "Delete Rows" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_RECORD_SAVE ;
+ HelpId = CMD_SID_FM_RECORD_SAVE ;
+ Text [ en-US ] = "Save Record" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_RECORD_UNDO ;
+ HelpId = CMD_SID_FM_RECORD_UNDO ;
+ Text [ en-US ] = "Undo: Data entry" ;
+ };
+ };
+};
+Menu RID_SVXMNU_COLS
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = SID_FM_INSERTCOL ;
+ HelpId = HID_FM_INSERTCOL ;
+ Text [ en-US ] = "Insert ~Column" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = SID_FM_EDIT ;
+ HelpId = CMD_SID_FM_EDIT ;
+ Text [ en-US ] = "Text Box" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_CHECKBOX ;
+ HelpId = CMD_SID_FM_CHECKBOX ;
+ Text [ en-US ] = "Check Box" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_COMBOBOX ;
+ HelpId = CMD_SID_FM_COMBOBOX ;
+ Text [ en-US ] = "Combo Box" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_LISTBOX ;
+ HelpId = CMD_SID_FM_LISTBOX ;
+ Text [ en-US ] = "List Box" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_DATEFIELD ;
+ HelpId = CMD_SID_FM_DATEFIELD ;
+ Text [ en-US ] = "Date Field" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_TIMEFIELD ;
+ HelpId = CMD_SID_FM_TIMEFIELD ;
+ Text [ en-US ] = "Time Field" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_NUMERICFIELD ;
+ HelpId = CMD_SID_FM_NUMERICFIELD ;
+ Text [ en-US ] = "Numeric Field" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_CURRENCYFIELD ;
+ HelpId = CMD_SID_FM_CURRENCYFIELD ;
+ Text [ en-US ] = "Currency Field" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_PATTERNFIELD ;
+ HelpId = CMD_SID_FM_PATTERNFIELD ;
+ Text [ en-US ] = "Pattern Field" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_FORMATTEDFIELD ;
+ HelpId = CMD_SID_FM_FORMATTEDFIELD ;
+ Text [ en-US ] = "Formatted Field" ;
+ };
+ MenuItem
+ {
+ // this is a dummy which is never used herein but for copy to newly built menus
+ Identifier = SID_FM_TWOFIELDS_DATE_N_TIME;
+ HelpId = HID_CONTROLS_DATE_N_TIME;
+ Text [ en-US ] = "Date and Time Field" ;
+ Disable = True;
+ };
+ };
+ };
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_CHANGECOL ;
+ HelpId = HID_FM_CHANGECOL ;
+ Text [ en-US ] = "~Replace with" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_DELETECOL ;
+ HelpId = HID_FM_DELETECOL ;
+ Text [ en-US ] = "Delete Column" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_HIDECOL ;
+ HelpId = HID_FM_HIDECOL ;
+ Text [ en-US ] = "~Hide Column";
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_SHOWCOLS ;
+ HelpId = HID_FM_SHOWCOLS ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = SID_FM_SHOWCOLS_MORE ;
+ HelpId = HID_FM_SHOWCOLS_MORE ;
+ Text [ en-US ] = "~More...";
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_SHOWALLCOLS ;
+ HelpId = HID_FM_SHOWALLCOLS ;
+ Text [ en-US ] = "~All";
+ };
+ };
+ };
+ Text [ en-US ] = "~Show Columns";
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_SHOW_PROPERTY_BROWSER ;
+ HelpId = CMD_SID_FM_SHOW_PROPERTY_BROWSER ;
+ Text [ en-US ] = "Column..." ;
+ };
+ };
+};
+
+Menu RID_SVXMNU_CELL
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ ITEM_EDIT_COPY
+ };
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/fmcomp/trace.cxx b/svx/source/fmcomp/trace.cxx
new file mode 100644
index 000000000000..a8ab835548ac
--- /dev/null
+++ b/svx/source/fmcomp/trace.cxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "trace.hxx"
+#include <tools/debug.hxx>
+
+#if defined(DBG_UTIL)
+
+//==============================================================================
+
+//------------------------------------------------------------------------------
+::vos::OMutex Tracer::s_aMapSafety;
+::std::map< ::vos::OThread::TThreadIdentifier, sal_Int32, ::std::less< ::vos::OThread::TThreadIdentifier > >
+ Tracer::s_aThreadIndents;
+
+//------------------------------------------------------------------------------
+Tracer::Tracer(const char* _pBlockDescription)
+ :m_sBlockDescription(_pBlockDescription)
+{
+ ::vos::OGuard aGuard(s_aMapSafety);
+ sal_Int32 nIndent = s_aThreadIndents[ ::vos::OThread::getCurrentIdentifier() ]++;
+
+ ByteString sIndent;
+ while (nIndent--)
+ sIndent += '\t';
+
+ ByteString sThread( ByteString::CreateFromInt32( (sal_Int32)::vos::OThread::getCurrentIdentifier() ) );
+ sThread += '\t';
+
+ ByteString sMessage(sThread);
+ sMessage += sIndent;
+ sMessage += m_sBlockDescription;
+ sMessage += " {";
+ DBG_TRACE(sMessage.GetBuffer());
+}
+
+//------------------------------------------------------------------------------
+Tracer::~Tracer()
+{
+ ::vos::OGuard aGuard(s_aMapSafety);
+ sal_Int32 nIndent = --s_aThreadIndents[ ::vos::OThread::getCurrentIdentifier() ];
+
+ ByteString sIndent;
+ while (nIndent--)
+ sIndent += '\t';
+
+ ByteString sThread( ByteString::CreateFromInt32( (sal_Int32)::vos::OThread::getCurrentIdentifier() ) );
+ sThread += '\t';
+
+ ByteString sMessage(sThread);
+ sMessage += sIndent;
+ sMessage += "} // ";
+ sMessage += m_sBlockDescription;
+ DBG_TRACE(sMessage.GetBuffer());
+}
+
+//------------------------------------------------------------------------------
+void Tracer::TraceString(const char* _pMessage)
+{
+ ::vos::OGuard aGuard(s_aMapSafety);
+ sal_Int32 nIndent = s_aThreadIndents[ ::vos::OThread::getCurrentIdentifier() ];
+
+ ByteString sIndent;
+ while (nIndent--)
+ sIndent += '\t';
+
+ ByteString sThread( ByteString::CreateFromInt32( (sal_Int32)::vos::OThread::getCurrentIdentifier() ) );
+ sThread += '\t';
+
+ ByteString sMessage(sThread);
+ sMessage += sIndent;
+ sMessage += m_sBlockDescription;
+ sMessage += ": ";
+ sMessage += _pMessage;
+ DBG_TRACE(sMessage.GetBuffer());
+}
+
+//------------------------------------------------------------------------------
+void Tracer::TraceString1StringParam(const char* _pMessage, const char* _pParam)
+{
+ ::vos::OGuard aGuard(s_aMapSafety);
+ sal_Int32 nIndent = s_aThreadIndents[ ::vos::OThread::getCurrentIdentifier() ];
+
+ ByteString sIndent;
+ while (nIndent--)
+ sIndent += '\t';
+
+ ByteString sThread( ByteString::CreateFromInt32( (sal_Int32)::vos::OThread::getCurrentIdentifier() ) );
+ sThread += '\t';
+
+ ByteString sMessage(sThread);
+ sMessage += sIndent;
+ sMessage += m_sBlockDescription;
+ sMessage += ": ";
+ sMessage += _pMessage;
+ DBG_TRACE1(sMessage.GetBuffer(), _pParam);
+}
+#endif
diff --git a/svx/source/fmcomp/xmlexchg.cxx b/svx/source/fmcomp/xmlexchg.cxx
new file mode 100644
index 000000000000..1026356e08c2
--- /dev/null
+++ b/svx/source/fmcomp/xmlexchg.cxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "svx/xmlexchg.hxx"
+#include <sot/formats.hxx>
+#include <sot/exchange.hxx>
+#include <tools/debug.hxx>
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ using namespace ::com::sun::star::datatransfer;
+
+ //====================================================================
+ //= OXFormsTransferable
+ //====================================================================
+ //--------------------------------------------------------------------
+ OXFormsTransferable::OXFormsTransferable( const OXFormsDescriptor &rhs ) :
+ m_aDescriptor(rhs)
+ {
+ }
+ //--------------------------------------------------------------------
+ sal_uInt32 OXFormsTransferable::getDescriptorFormatId()
+ {
+ static sal_uInt32 s_nFormat = (sal_uInt32)-1;
+ if ((sal_uInt32)-1 == s_nFormat)
+ {
+ s_nFormat = SotExchange::RegisterFormatName( String::CreateFromAscii("application/x-openoffice;windows_formatname=\"???\"") );
+ OSL_ENSURE( (sal_uInt32)-1 != s_nFormat, "OXFormsTransferable::getDescriptorFormatId: bad exchange id!" );
+ }
+ return s_nFormat;
+ }
+ //--------------------------------------------------------------------
+ void OXFormsTransferable::AddSupportedFormats()
+ {
+ AddFormat( SOT_FORMATSTR_ID_XFORMS );
+ }
+ //--------------------------------------------------------------------
+ sal_Bool OXFormsTransferable::GetData( const DataFlavor& _rFlavor )
+ {
+ const sal_uInt32 nFormatId = SotExchange::GetFormat( _rFlavor );
+ if ( SOT_FORMATSTR_ID_XFORMS == nFormatId )
+ {
+ return SetString( ::rtl::OUString( String::CreateFromAscii("XForms-Transferable") ), _rFlavor );
+ }
+ return sal_False;
+ }
+ //--------------------------------------------------------------------
+ const OXFormsDescriptor &OXFormsTransferable::extractDescriptor( const TransferableDataHelper &_rData ) {
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::datatransfer;
+ Reference<XTransferable> &transfer = const_cast<Reference<XTransferable> &>(_rData.GetTransferable());
+ XTransferable *pInterface = transfer.get();
+ OXFormsTransferable *pThis = dynamic_cast<OXFormsTransferable *>(pInterface);
+ DBG_ASSERT(pThis,"XTransferable is NOT an OXFormsTransferable???");
+ return pThis->m_aDescriptor;
+ }
+
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+
diff --git a/svx/source/form/ParseContext.cxx b/svx/source/form/ParseContext.cxx
new file mode 100644
index 000000000000..e1f069be96a6
--- /dev/null
+++ b/svx/source/form/ParseContext.cxx
@@ -0,0 +1,249 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svx/ParseContext.hxx"
+#include "stringlistresource.hxx"
+#include "svx/fmresids.hrc"
+
+#include <svx/dialmgr.hxx>
+
+#include <unotools/syslocale.hxx>
+#include <vcl/svapp.hxx>
+#include <tools/debug.hxx>
+#include <vos/mutex.hxx>
+
+using namespace svxform;
+using namespace ::connectivity;
+//==========================================================================
+//= OSystemParseContext
+//==========================================================================
+DBG_NAME(OSystemParseContext)
+//-----------------------------------------------------------------------------
+OSystemParseContext::OSystemParseContext() : IParseContext()
+{
+ DBG_CTOR(OSystemParseContext,NULL);
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ ::svx::StringListResource aKeywords( SVX_RES( RID_RSC_SQL_INTERNATIONAL ) );
+ aKeywords.get( m_aLocalizedKeywords );
+}
+
+//-----------------------------------------------------------------------------
+OSystemParseContext::~OSystemParseContext()
+{
+ DBG_DTOR(OSystemParseContext,NULL);
+}
+
+//-----------------------------------------------------------------------------
+::com::sun::star::lang::Locale OSystemParseContext::getPreferredLocale( ) const
+{
+ return SvtSysLocale().GetLocaleData().getLocale();
+}
+
+//-----------------------------------------------------------------------------
+::rtl::OUString OSystemParseContext::getErrorMessage(ErrorCode _eCode) const
+{
+ String aMsg;
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ switch (_eCode)
+ {
+ case ERROR_GENERAL: aMsg = SVX_RES(RID_STR_SVT_SQL_SYNTAX_ERROR); break;
+ case ERROR_VALUE_NO_LIKE: aMsg = SVX_RES(RID_STR_SVT_SQL_SYNTAX_VALUE_NO_LIKE); break;
+ case ERROR_FIELD_NO_LIKE: aMsg = SVX_RES(RID_STR_SVT_SQL_SYNTAX_FIELD_NO_LIKE); break;
+ case ERROR_INVALID_COMPARE: aMsg = SVX_RES(RID_STR_SVT_SQL_SYNTAX_CRIT_NO_COMPARE); break;
+ case ERROR_INVALID_INT_COMPARE: aMsg = SVX_RES(RID_STR_SVT_SQL_SYNTAX_INT_NO_VALID); break;
+ case ERROR_INVALID_DATE_COMPARE: aMsg = SVX_RES(RID_STR_SVT_SQL_SYNTAX_ACCESS_DAT_NO_VALID); break;
+ case ERROR_INVALID_REAL_COMPARE: aMsg = SVX_RES(RID_STR_SVT_SQL_SYNTAX_REAL_NO_VALID); break;
+ case ERROR_INVALID_TABLE: aMsg = SVX_RES(RID_STR_SVT_SQL_SYNTAX_TABLE); break;
+ case ERROR_INVALID_TABLE_OR_QUERY: aMsg = SVX_RES(RID_STR_SVT_SQL_SYNTAX_TABLE_OR_QUERY); break;
+ case ERROR_INVALID_COLUMN: aMsg = SVX_RES(RID_STR_SVT_SQL_SYNTAX_COLUMN); break;
+ case ERROR_INVALID_TABLE_EXIST: aMsg = SVX_RES(RID_STR_SVT_SQL_SYNTAX_TABLE_EXISTS); break;
+ case ERROR_INVALID_QUERY_EXIST: aMsg = SVX_RES(RID_STR_SVT_SQL_SYNTAX_QUERY_EXISTS); break;
+ case ERROR_NONE: break;
+ }
+ return aMsg;
+}
+
+//-----------------------------------------------------------------------------
+::rtl::OString OSystemParseContext::getIntlKeywordAscii(InternationalKeyCode _eKey) const
+{
+ size_t nIndex = 0;
+ switch ( _eKey )
+ {
+ case KEY_LIKE: nIndex = 0; break;
+ case KEY_NOT: nIndex = 1; break;
+ case KEY_NULL: nIndex = 2; break;
+ case KEY_TRUE: nIndex = 3; break;
+ case KEY_FALSE: nIndex = 4; break;
+ case KEY_IS: nIndex = 5; break;
+ case KEY_BETWEEN: nIndex = 6; break;
+ case KEY_OR: nIndex = 7; break;
+ case KEY_AND: nIndex = 8; break;
+ case KEY_AVG: nIndex = 9; break;
+ case KEY_COUNT: nIndex = 10; break;
+ case KEY_MAX: nIndex = 11; break;
+ case KEY_MIN: nIndex = 12; break;
+ case KEY_SUM: nIndex = 13; break;
+ case KEY_EVERY: nIndex = 14; break;
+ case KEY_ANY: nIndex = 15; break;
+ case KEY_SOME: nIndex = 16; break;
+ case KEY_STDDEV_POP: nIndex = 17; break;
+ case KEY_STDDEV_SAMP: nIndex = 18; break;
+ case KEY_VAR_SAMP: nIndex = 19; break;
+ case KEY_VAR_POP: nIndex = 20; break;
+ case KEY_COLLECT: nIndex = 21; break;
+ case KEY_FUSION: nIndex = 22; break;
+ case KEY_INTERSECTION: nIndex = 23; break;
+ case KEY_NONE:
+ DBG_ERROR( "OSystemParseContext::getIntlKeywordAscii: illegal argument!" );
+ break;
+ }
+
+ OSL_ENSURE( nIndex < m_aLocalizedKeywords.size(), "OSystemParseContext::getIntlKeywordAscii: invalid index!" );
+
+ ByteString sKeyword;
+ if ( nIndex < m_aLocalizedKeywords.size() )
+ sKeyword = ByteString( m_aLocalizedKeywords[nIndex], RTL_TEXTENCODING_UTF8 );
+ return sKeyword;
+}
+
+//-----------------------------------------------------------------------------
+static sal_Unicode lcl_getSeparatorChar( const String& _rSeparator, sal_Unicode _nFallback )
+{
+ DBG_ASSERT( 0 < _rSeparator.Len(), "::lcl_getSeparatorChar: invalid decimal separator!" );
+
+ sal_Unicode nReturn( _nFallback );
+ if ( _rSeparator.Len() )
+ nReturn = static_cast< sal_Char >( _rSeparator.GetBuffer( )[0] );
+ return nReturn;
+}
+
+//-----------------------------------------------------------------------------
+sal_Unicode OSystemParseContext::getNumDecimalSep( ) const
+{
+ return lcl_getSeparatorChar( SvtSysLocale().GetLocaleData().getNumDecimalSep(), '.' );
+}
+
+//-----------------------------------------------------------------------------
+sal_Unicode OSystemParseContext::getNumThousandSep( ) const
+{
+ return lcl_getSeparatorChar( SvtSysLocale().GetLocaleData().getNumThousandSep(), ',' );
+}
+// -----------------------------------------------------------------------------
+IParseContext::InternationalKeyCode OSystemParseContext::getIntlKeyCode(const ::rtl::OString& rToken) const
+{
+ static IParseContext::InternationalKeyCode Intl_TokenID[] =
+ {
+ KEY_LIKE, KEY_NOT, KEY_NULL, KEY_TRUE,
+ KEY_FALSE, KEY_IS, KEY_BETWEEN, KEY_OR,
+ KEY_AND, KEY_AVG, KEY_COUNT, KEY_MAX,
+ KEY_MIN, KEY_SUM, KEY_EVERY,
+ KEY_ANY, KEY_SOME, KEY_STDDEV_POP,
+ KEY_STDDEV_SAMP, KEY_VAR_SAMP, KEY_VAR_POP,
+ KEY_COLLECT, KEY_FUSION, KEY_INTERSECTION
+ };
+
+ sal_uInt32 nCount = sizeof Intl_TokenID / sizeof Intl_TokenID[0];
+ for (sal_uInt32 i = 0; i < nCount; i++)
+ {
+ ::rtl::OString aKey = getIntlKeywordAscii(Intl_TokenID[i]);
+ if (rToken.equalsIgnoreAsciiCase(aKey))
+ return Intl_TokenID[i];
+ }
+
+ return KEY_NONE;
+}
+
+
+// =============================================================================
+// =============================================================================
+namespace
+{
+ // -----------------------------------------------------------------------------
+ ::osl::Mutex& getSafteyMutex()
+ {
+ static ::osl::Mutex s_aSafety;
+ return s_aSafety;
+ }
+ // -----------------------------------------------------------------------------
+ oslInterlockedCount& getCounter()
+ {
+ static oslInterlockedCount s_nCounter;
+ return s_nCounter;
+ }
+ // -----------------------------------------------------------------------------
+ OSystemParseContext* getSharedContext(OSystemParseContext* _pContext = NULL,sal_Bool _bSet = sal_False)
+ {
+ static OSystemParseContext* s_pSharedContext = NULL;
+ if ( _pContext && !s_pSharedContext )
+ {
+ s_pSharedContext = _pContext;
+ return s_pSharedContext;
+ }
+ if ( _bSet )
+ {
+ OSystemParseContext* pReturn = _pContext ? _pContext : s_pSharedContext;
+ s_pSharedContext = _pContext;
+ return pReturn;
+ }
+ return s_pSharedContext;
+ }
+ // -----------------------------------------------------------------------------
+}
+// -----------------------------------------------------------------------------
+OParseContextClient::OParseContextClient()
+{
+ ::osl::MutexGuard aGuard( getSafteyMutex() );
+ if ( 1 == osl_incrementInterlockedCount( &getCounter() ) )
+ { // first instance
+ getSharedContext( new OSystemParseContext );
+ }
+}
+
+// -----------------------------------------------------------------------------
+OParseContextClient::~OParseContextClient()
+{
+ {
+ ::osl::MutexGuard aGuard( getSafteyMutex() );
+ if ( 0 == osl_decrementInterlockedCount( &getCounter() ) )
+ delete getSharedContext(NULL,sal_True);
+ }
+}
+// -----------------------------------------------------------------------------
+const OSystemParseContext* OParseContextClient::getParseContext() const
+{
+ return getSharedContext();
+}
+// -----------------------------------------------------------------------------
+
+
+
+
+
diff --git a/svx/source/form/dataaccessdescriptor.cxx b/svx/source/form/dataaccessdescriptor.cxx
new file mode 100644
index 000000000000..b2d67e9b66ea
--- /dev/null
+++ b/svx/source/form/dataaccessdescriptor.cxx
@@ -0,0 +1,567 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/dataaccessdescriptor.hxx>
+#include <comphelper/stl_types.hxx>
+#include <comphelper/propertysetinfo.hxx>
+#include <comphelper/genericpropertyset.hxx>
+#include <osl/diagnose.h>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/ucb/XContent.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <tools/urlobj.hxx>
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::sdbc;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::ucb;
+ using namespace ::comphelper;
+
+#define CONST_CHAR( propname ) propname, sizeof(propname) - 1
+
+#ifndef SVX_LIGHT
+ //====================================================================
+ //= ODADescriptorImpl
+ //====================================================================
+ class ODADescriptorImpl
+ {
+ protected:
+ sal_Bool m_bSetOutOfDate : 1;
+ sal_Bool m_bSequenceOutOfDate : 1;
+
+ public:
+ typedef ::std::map< DataAccessDescriptorProperty, Any > DescriptorValues;
+ DescriptorValues m_aValues;
+ Sequence< PropertyValue > m_aAsSequence;
+ Reference< XPropertySet > m_xAsSet;
+
+ typedef ::std::map< ::rtl::OUString, PropertyMapEntry* > MapString2PropertyEntry;
+
+ public:
+ ODADescriptorImpl();
+ ODADescriptorImpl(const ODADescriptorImpl& _rSource);
+
+ void invalidateExternRepresentations();
+
+ void updateSequence();
+ void updateSet();
+
+ /** builds the descriptor from a property value sequence
+ @return <TRUE/>
+ if and only if the sequence contained valid properties only
+ */
+ sal_Bool buildFrom( const Sequence< PropertyValue >& _rValues );
+
+ /** builds the descriptor from a property set
+ @return <TRUE/>
+ if and only if the set contained valid properties only
+ */
+ sal_Bool buildFrom( const Reference< XPropertySet >& _rValues );
+
+ protected:
+ static PropertyValue buildPropertyValue( const DescriptorValues::const_iterator& _rPos );
+ static const MapString2PropertyEntry& getPropertyMap( );
+ static PropertyMapEntry* getPropertyMapEntry( const DescriptorValues::const_iterator& _rPos );
+ };
+
+ //--------------------------------------------------------------------
+ ODADescriptorImpl::ODADescriptorImpl()
+ :m_bSetOutOfDate(sal_True)
+ ,m_bSequenceOutOfDate(sal_True)
+ {
+ }
+
+ //--------------------------------------------------------------------
+ ODADescriptorImpl::ODADescriptorImpl(const ODADescriptorImpl& _rSource)
+ :m_bSetOutOfDate( _rSource.m_bSetOutOfDate )
+ ,m_bSequenceOutOfDate( _rSource.m_bSequenceOutOfDate )
+ ,m_aValues( _rSource.m_aValues )
+ {
+ if (!m_bSetOutOfDate)
+ m_xAsSet = _rSource.m_xAsSet;
+ if (!m_bSequenceOutOfDate)
+ m_aAsSequence = _rSource.m_aAsSequence;
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool ODADescriptorImpl::buildFrom( const Sequence< PropertyValue >& _rValues )
+ {
+ const MapString2PropertyEntry& rProperties = getPropertyMap();
+
+ sal_Bool bValidPropsOnly = sal_True;
+
+ // loop through the sequence, and fill our m_aValues
+ const PropertyValue* pValues = _rValues.getConstArray();
+ const PropertyValue* pValuesEnd = pValues + _rValues.getLength();
+ for (;pValues != pValuesEnd; ++pValues)
+ {
+ MapString2PropertyEntry::const_iterator aPropPos = rProperties.find( pValues->Name );
+ if ( aPropPos != rProperties.end() )
+ {
+ DataAccessDescriptorProperty eProperty = (DataAccessDescriptorProperty)aPropPos->second->mnHandle;
+ m_aValues[eProperty] = pValues->Value;
+ }
+ else
+ // unknown property
+ bValidPropsOnly = sal_False;
+ }
+
+ if (bValidPropsOnly)
+ {
+ m_aAsSequence = _rValues;
+ m_bSequenceOutOfDate = sal_False;
+ }
+ else
+ m_bSequenceOutOfDate = sal_True;
+
+ return bValidPropsOnly;
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool ODADescriptorImpl::buildFrom( const Reference< XPropertySet >& _rxValues )
+ {
+ Reference< XPropertySetInfo > xPropInfo;
+ if (_rxValues.is())
+ xPropInfo = _rxValues->getPropertySetInfo();
+ if (!xPropInfo.is())
+ {
+ OSL_ENSURE(sal_False, "ODADescriptorImpl::buildFrom: invalid property set!");
+ return sal_False;
+ }
+
+ // build a PropertyValue sequence with the current values
+ Sequence< Property > aProperties = xPropInfo->getProperties();
+ const Property* pProperty = aProperties.getConstArray();
+ const Property* pPropertyEnd = pProperty + aProperties.getLength();
+
+ Sequence< PropertyValue > aValues(aProperties.getLength());
+ PropertyValue* pValues = aValues.getArray();
+
+ for (;pProperty != pPropertyEnd; ++pProperty, ++pValues)
+ {
+ pValues->Name = pProperty->Name;
+ pValues->Value = _rxValues->getPropertyValue(pProperty->Name);
+ }
+
+ sal_Bool bValidPropsOnly = buildFrom(aValues);
+ if (bValidPropsOnly)
+ {
+ m_xAsSet = _rxValues;
+ m_bSetOutOfDate = sal_False;
+ }
+ else
+ m_bSetOutOfDate = sal_True;
+
+ return bValidPropsOnly;
+ }
+
+ //--------------------------------------------------------------------
+ void ODADescriptorImpl::invalidateExternRepresentations()
+ {
+ m_bSetOutOfDate = sal_True;
+ m_bSequenceOutOfDate = sal_True;
+ }
+
+ //--------------------------------------------------------------------
+ const ODADescriptorImpl::MapString2PropertyEntry& ODADescriptorImpl::getPropertyMap( )
+ {
+ // the properties we know
+ static MapString2PropertyEntry s_aProperties;
+ if ( s_aProperties.empty() )
+ {
+ static PropertyMapEntry s_aDesriptorProperties[] =
+ {
+ { CONST_CHAR("ActiveConnection"), daConnection, &::getCppuType( static_cast< Reference< XConnection >* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
+ { CONST_CHAR("BookmarkSelection"), daBookmarkSelection, &::getBooleanCppuType( ), PropertyAttribute::TRANSIENT, 0 },
+ { CONST_CHAR("Column"), daColumnObject, &::getCppuType( static_cast< Reference< XPropertySet >* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
+ { CONST_CHAR("ColumnName"), daColumnName, &::getCppuType( static_cast< ::rtl::OUString* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
+ { CONST_CHAR("Command"), daCommand, &::getCppuType( static_cast< ::rtl::OUString* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
+ { CONST_CHAR("CommandType"), daCommandType, &::getCppuType( static_cast< sal_Int32* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
+ { CONST_CHAR("Component"), daComponent, &::getCppuType( static_cast< Reference< XContent >* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
+ { CONST_CHAR("ConnectionResource"), daConnectionResource, &::getCppuType( static_cast< ::rtl::OUString* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
+ { CONST_CHAR("Cursor"), daCursor, &::getCppuType( static_cast< Reference< XResultSet>* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
+ { CONST_CHAR("DataSourceName"), daDataSource, &::getCppuType( static_cast< ::rtl::OUString* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
+ { CONST_CHAR("DatabaseLocation"), daDatabaseLocation, &::getCppuType( static_cast< ::rtl::OUString* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
+ { CONST_CHAR("EscapeProcessing"), daEscapeProcessing, &::getBooleanCppuType( ), PropertyAttribute::TRANSIENT, 0 },
+ { CONST_CHAR("Filter"), daFilter, &::getCppuType( static_cast< ::rtl::OUString* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
+ { CONST_CHAR("Selection"), daSelection, &::getCppuType( static_cast< Sequence< Any >* >(NULL) ), PropertyAttribute::TRANSIENT, 0 },
+ { NULL, 0, 0, NULL, 0, 0 }
+ };
+
+ PropertyMapEntry* pEntry = s_aDesriptorProperties;
+ while ( pEntry->mpName )
+ {
+ s_aProperties[ ::rtl::OUString::createFromAscii( pEntry->mpName ) ] = pEntry;
+ ++pEntry;
+ }
+ }
+
+ return s_aProperties;
+ }
+
+ //--------------------------------------------------------------------
+ PropertyMapEntry* ODADescriptorImpl::getPropertyMapEntry( const DescriptorValues::const_iterator& _rPos )
+ {
+ const MapString2PropertyEntry& rProperties = getPropertyMap();
+
+ sal_Int32 nNeededHandle = (sal_Int32)(_rPos->first);
+
+ for ( MapString2PropertyEntry::const_iterator loop = rProperties.begin();
+ loop != rProperties.end();
+ ++loop
+ )
+ {
+ if ( nNeededHandle == loop->second->mnHandle )
+ return loop->second;
+ }
+ throw RuntimeException();
+ }
+
+ //--------------------------------------------------------------------
+ PropertyValue ODADescriptorImpl::buildPropertyValue( const DescriptorValues::const_iterator& _rPos )
+ {
+ // the map entry
+ PropertyMapEntry* pProperty = getPropertyMapEntry( _rPos );
+
+ // build the property value
+ PropertyValue aReturn;
+ aReturn.Name = ::rtl::OUString( pProperty->mpName, pProperty->mnNameLen, RTL_TEXTENCODING_ASCII_US );
+ aReturn.Handle = pProperty->mnHandle;
+ aReturn.Value = _rPos->second;
+ aReturn.State = PropertyState_DIRECT_VALUE;
+
+ // outta here
+ return aReturn;
+ }
+
+ //--------------------------------------------------------------------
+ void ODADescriptorImpl::updateSequence()
+ {
+ if (!m_bSequenceOutOfDate)
+ return;
+
+ m_aAsSequence.realloc(m_aValues.size());
+ PropertyValue* pValue = m_aAsSequence.getArray();
+
+ // loop through all our values
+ for ( DescriptorValues::const_iterator aLoop = m_aValues.begin();
+ aLoop != m_aValues.end();
+ ++aLoop, ++pValue
+ )
+ {
+ *pValue = buildPropertyValue(aLoop);
+ }
+
+ // don't need to rebuild next time
+ m_bSequenceOutOfDate = sal_False;
+ }
+
+ //--------------------------------------------------------------------
+ void ODADescriptorImpl::updateSet()
+ {
+ if (!m_bSetOutOfDate)
+ return;
+
+ // will be the current values
+ Sequence< PropertyValue > aValuesToSet(m_aValues.size());
+ PropertyValue* pValuesToSet = aValuesToSet.getArray();
+
+ // build a new property set info
+ PropertySetInfo* pPropSetInfo = new PropertySetInfo;
+
+ // loop through all our values
+ for ( DescriptorValues::const_iterator aLoop = m_aValues.begin();
+ aLoop != m_aValues.end();
+ ++aLoop, ++pValuesToSet
+ )
+ {
+ PropertyMapEntry* pMapEntry = getPropertyMapEntry( aLoop );
+ pPropSetInfo->add( pMapEntry, 1 );
+
+ *pValuesToSet = buildPropertyValue(aLoop);
+ }
+
+ // create the generic set
+ m_xAsSet = GenericPropertySet_CreateInstance( pPropSetInfo );
+
+ // no we have the set, still need to set the current values
+ const PropertyValue* pSetValues = aValuesToSet.getConstArray();
+ const PropertyValue* pSetValuesEnd = pSetValues + aValuesToSet.getLength();
+ for (; pSetValues != pSetValuesEnd; ++pSetValues)
+ m_xAsSet->setPropertyValue(pSetValues->Name, pSetValues->Value);
+
+ // don't need to rebuild next time
+ m_bSetOutOfDate = sal_True;
+ }
+#endif
+
+ //====================================================================
+ //= ODataAccessDescriptor
+ //====================================================================
+ //--------------------------------------------------------------------
+ ODataAccessDescriptor::ODataAccessDescriptor()
+#ifndef SVX_LIGHT
+ :m_pImpl(new ODADescriptorImpl)
+#else
+ :m_pImpl(NULL)
+#endif
+ {
+ }
+
+ //--------------------------------------------------------------------
+ ODataAccessDescriptor::ODataAccessDescriptor( const ODataAccessDescriptor& _rSource )
+#ifndef SVX_LIGHT
+ :m_pImpl(new ODADescriptorImpl(*_rSource.m_pImpl))
+#else
+ :m_pImpl(NULL)
+#endif
+ {
+ }
+
+ //--------------------------------------------------------------------
+ const ODataAccessDescriptor& ODataAccessDescriptor::operator=(const ODataAccessDescriptor& _rSource)
+ {
+#ifndef SVX_LIGHT
+ delete m_pImpl;
+ m_pImpl = new ODADescriptorImpl(*_rSource.m_pImpl);
+#else
+ OSL_ENSURE(sal_False, "ODataAccessDescriptor::operator=: not available in the SVX_LIGHT version!");
+#endif
+ return *this;
+ }
+
+ //--------------------------------------------------------------------
+ ODataAccessDescriptor::ODataAccessDescriptor( const Reference< XPropertySet >& _rValues )
+#ifndef SVX_LIGHT
+ :m_pImpl(new ODADescriptorImpl)
+#else
+ :m_pImpl(NULL)
+#endif
+ {
+#ifndef SVX_LIGHT
+ m_pImpl->buildFrom(_rValues);
+#else
+ OSL_ENSURE(sal_False, "ODataAccessDescriptor::ODataAccessDescriptor: not available in the SVX_LIGHT version!");
+#endif
+ }
+
+ //--------------------------------------------------------------------
+ ODataAccessDescriptor::ODataAccessDescriptor( const Any& _rValues )
+#ifndef SVX_LIGHT
+ :m_pImpl(new ODADescriptorImpl)
+#else
+ :m_pImpl(NULL)
+#endif
+ {
+#ifndef SVX_LIGHT
+ // check if we know the format in the Any
+ Sequence< PropertyValue > aValues;
+ Reference< XPropertySet > xValues;
+ if ( _rValues >>= aValues )
+ m_pImpl->buildFrom( aValues );
+ else if ( _rValues >>= xValues )
+ m_pImpl->buildFrom( xValues );
+#else
+ OSL_ENSURE(sal_False, "ODataAccessDescriptor::ODataAccessDescriptor: not available in the SVX_LIGHT version!");
+#endif
+ }
+
+ //--------------------------------------------------------------------
+ ODataAccessDescriptor::ODataAccessDescriptor( const Sequence< PropertyValue >& _rValues )
+#ifndef SVX_LIGHT
+ :m_pImpl(new ODADescriptorImpl)
+#else
+ :m_pImpl(NULL)
+#endif
+ {
+#ifndef SVX_LIGHT
+ m_pImpl->buildFrom(_rValues);
+#else
+ OSL_ENSURE(sal_False, "ODataAccessDescriptor::ODataAccessDescriptor: not available in the SVX_LIGHT version!");
+#endif
+ }
+
+ //--------------------------------------------------------------------
+ ODataAccessDescriptor::~ODataAccessDescriptor()
+ {
+ delete m_pImpl;
+ }
+
+ //--------------------------------------------------------------------
+ void ODataAccessDescriptor::clear()
+ {
+#ifndef SVX_LIGHT
+ m_pImpl->m_aValues.clear();
+#endif
+ }
+
+ //--------------------------------------------------------------------
+ void ODataAccessDescriptor::erase(DataAccessDescriptorProperty _eWhich)
+ {
+#ifndef SVX_LIGHT
+ OSL_ENSURE(has(_eWhich), "ODataAccessDescriptor::erase: invalid call!");
+ if (has(_eWhich))
+ m_pImpl->m_aValues.erase(_eWhich);
+#endif
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool ODataAccessDescriptor::has(DataAccessDescriptorProperty _eWhich) const
+ {
+#ifndef SVX_LIGHT
+ return m_pImpl->m_aValues.find(_eWhich) != m_pImpl->m_aValues.end();
+#else
+ return sal_False;
+#endif
+ }
+
+ //--------------------------------------------------------------------
+ const Any& ODataAccessDescriptor::operator [] ( DataAccessDescriptorProperty _eWhich ) const
+ {
+#ifndef SVX_LIGHT
+ if (!has(_eWhich))
+ {
+ OSL_ENSURE(sal_False, "ODataAccessDescriptor::operator[]: invalid acessor!");
+ static const Any aDummy;
+ return aDummy;
+ }
+
+ return m_pImpl->m_aValues[_eWhich];
+#else
+ static const Any aDummy;
+ return aDummy;
+#endif
+ }
+
+ //--------------------------------------------------------------------
+ Any& ODataAccessDescriptor::operator[] ( DataAccessDescriptorProperty _eWhich )
+ {
+#ifndef SVX_LIGHT
+ m_pImpl->invalidateExternRepresentations();
+ return m_pImpl->m_aValues[_eWhich];
+#else
+ static const Any aDummy;
+ return aDummy;
+#endif
+ }
+
+ //--------------------------------------------------------------------
+ void ODataAccessDescriptor::initializeFrom(const Reference< XPropertySet >& _rxValues, sal_Bool _bClear)
+ {
+#ifndef SVX_LIGHT
+ if (_bClear)
+ clear();
+ m_pImpl->buildFrom(_rxValues);
+#endif
+ }
+
+ //--------------------------------------------------------------------
+ void ODataAccessDescriptor::initializeFrom(const Sequence< PropertyValue >& _rValues, sal_Bool _bClear)
+ {
+#ifndef SVX_LIGHT
+ if (_bClear)
+ clear();
+ m_pImpl->buildFrom(_rValues);
+#endif
+ }
+
+ //--------------------------------------------------------------------
+ Sequence< PropertyValue > ODataAccessDescriptor::createPropertyValueSequence()
+ {
+#ifndef SVX_LIGHT
+ m_pImpl->updateSequence();
+ return m_pImpl->m_aAsSequence;
+#else
+ return Sequence< PropertyValue >();
+#endif
+ }
+ //--------------------------------------------------------------------
+ Sequence< Any > ODataAccessDescriptor::createAnySequence()
+ {
+#ifndef SVX_LIGHT
+ m_pImpl->updateSequence();
+ Sequence< Any > aRet(m_pImpl->m_aAsSequence.getLength());
+ const PropertyValue* pBegin = m_pImpl->m_aAsSequence.getConstArray();
+ const PropertyValue* pEnd = pBegin + m_pImpl->m_aAsSequence.getLength();
+ for(sal_Int32 i=0;pBegin != pEnd;++pBegin,++i)
+ aRet[i] <<= *pBegin;
+ return aRet;
+#else
+ return Sequence< createAnySequence >();
+#endif
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XPropertySet > ODataAccessDescriptor::createPropertySet()
+ {
+#ifndef SVX_LIGHT
+ m_pImpl->updateSet();
+ return m_pImpl->m_xAsSet;
+#else
+ return Reference< XPropertySet >();
+#endif
+ }
+ //--------------------------------------------------------------------
+ ::rtl::OUString ODataAccessDescriptor::getDataSource() const
+ {
+#ifndef SVX_LIGHT
+ ::rtl::OUString sDataSourceName;
+ if ( has(daDataSource) )
+ (*this)[daDataSource] >>= sDataSourceName;
+ else if ( has(daDatabaseLocation) )
+ (*this)[daDatabaseLocation] >>= sDataSourceName;
+ return sDataSourceName;
+#else
+ return ::rtl::OUString();
+#endif
+ }
+ //--------------------------------------------------------------------
+ void ODataAccessDescriptor::setDataSource(const ::rtl::OUString& _sDataSourceNameOrLocation)
+ {
+#ifndef SVX_LIGHT
+ if ( _sDataSourceNameOrLocation.getLength() )
+ {
+ INetURLObject aURL(_sDataSourceNameOrLocation);
+ (*this)[ (( aURL.GetProtocol() == INET_PROT_FILE ) ? daDatabaseLocation : daDataSource)] <<= _sDataSourceNameOrLocation;
+ }
+ else
+ (*this)[ daDataSource ] <<= ::rtl::OUString();
+#endif
+ }
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+
diff --git a/svx/source/form/databaselocationinput.cxx b/svx/source/form/databaselocationinput.cxx
new file mode 100644
index 000000000000..c6df77774c77
--- /dev/null
+++ b/svx/source/form/databaselocationinput.cxx
@@ -0,0 +1,314 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svx/databaselocationinput.hxx"
+#include "svx/dialmgr.hxx"
+
+#include "svx/fmresids.hrc"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <svtools/urlcontrol.hxx>
+#include <svl/filenotation.hxx>
+#include <tools/diagnose_ex.h>
+#include <unotools/confignode.hxx>
+#include <unotools/ucbhelper.hxx>
+#include <vcl/button.hxx>
+#include <vcl/msgbox.hxx>
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::container::XNameAccess;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::Exception;
+ /** === end UNO using === **/
+ namespace TemplateDescription = ::com::sun::star::ui::dialogs::TemplateDescription;
+
+ //====================================================================
+ //= DatabaseLocationInputController_Impl
+ //====================================================================
+ class DatabaseLocationInputController_Impl
+ {
+ public:
+ DatabaseLocationInputController_Impl(
+ const ::comphelper::ComponentContext& _rContext,
+ ::svt::OFileURLControl& _rLocationInput,
+ PushButton& _rBrowseButton
+ );
+ ~DatabaseLocationInputController_Impl();
+
+ bool prepareCommit();
+ void setURL( const String& _rURL );
+ String getURL() const;
+
+ private:
+ void impl_initFilterProperties_nothrow();
+ void impl_onBrowseButtonClicked();
+ void impl_onLocationModified();
+ String impl_getCurrentURL() const;
+
+ DECL_LINK( OnControlAction, VclWindowEvent* );
+
+ private:
+ const ::comphelper::ComponentContext m_aContext;
+ ::svt::OFileURLControl& m_rLocationInput;
+ PushButton& m_rBrowseButton;
+ Sequence< ::rtl::OUString > m_aFilterExtensions;
+ ::rtl::OUString m_sFilterUIName;
+ bool m_bNeedExistenceCheck;
+ };
+
+ //--------------------------------------------------------------------
+ DatabaseLocationInputController_Impl::DatabaseLocationInputController_Impl( const ::comphelper::ComponentContext& _rContext,
+ ::svt::OFileURLControl& _rLocationInput, PushButton& _rBrowseButton )
+ :m_aContext( _rContext )
+ ,m_rLocationInput( _rLocationInput )
+ ,m_rBrowseButton( _rBrowseButton )
+ ,m_aFilterExtensions()
+ ,m_sFilterUIName()
+ ,m_bNeedExistenceCheck( true )
+ {
+ impl_initFilterProperties_nothrow();
+
+ // forward the allowed extensions to the input control
+ ::rtl::OUStringBuffer aExtensionList;
+ for ( const ::rtl::OUString* pExtension = m_aFilterExtensions.getConstArray();
+ pExtension != m_aFilterExtensions.getConstArray() + m_aFilterExtensions.getLength();
+ ++pExtension
+ )
+ {
+ aExtensionList.append( *pExtension );
+ aExtensionList.append( (sal_Unicode)';' );
+ }
+ m_rLocationInput.SetFilter( aExtensionList.makeStringAndClear() );
+
+ m_rBrowseButton.AddEventListener( LINK( this, DatabaseLocationInputController_Impl, OnControlAction ) );
+ m_rLocationInput.AddEventListener( LINK( this, DatabaseLocationInputController_Impl, OnControlAction ) );
+ }
+
+ //--------------------------------------------------------------------
+ DatabaseLocationInputController_Impl::~DatabaseLocationInputController_Impl()
+ {
+ m_rBrowseButton.RemoveEventListener( LINK( this, DatabaseLocationInputController_Impl, OnControlAction ) );
+ m_rLocationInput.RemoveEventListener( LINK( this, DatabaseLocationInputController_Impl, OnControlAction ) );
+ }
+
+ //--------------------------------------------------------------------
+ bool DatabaseLocationInputController_Impl::prepareCommit()
+ {
+ ::rtl::OUString sURL( impl_getCurrentURL() );
+ if ( !sURL.getLength() )
+ return false;
+
+ // check if the name exists
+ if ( m_bNeedExistenceCheck )
+ {
+ if ( ::utl::UCBContentHelper::Exists( sURL ) )
+ {
+ QueryBox aBox( m_rLocationInput.GetSystemWindow(), WB_YES_NO, SVX_RES( RID_STR_ALREADYEXISTOVERWRITE ) );
+ if ( aBox.Execute() != RET_YES )
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ //--------------------------------------------------------------------
+ void DatabaseLocationInputController_Impl::setURL( const String& _rURL )
+ {
+ ::svt::OFileNotation aTransformer( _rURL );
+ m_rLocationInput.SetText( aTransformer.get( ::svt::OFileNotation::N_SYSTEM ) );
+ }
+
+ //--------------------------------------------------------------------
+ String DatabaseLocationInputController_Impl::getURL() const
+ {
+ return impl_getCurrentURL();
+ }
+
+ //--------------------------------------------------------------------
+ void DatabaseLocationInputController_Impl::impl_initFilterProperties_nothrow()
+ {
+ try
+ {
+ // get the name of the default filter for database documents
+ ::utl::OConfigurationTreeRoot aConfig(
+ ::utl::OConfigurationTreeRoot::createWithServiceFactory(
+ m_aContext.getLegacyServiceFactory(),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Setup/Office/Factories/com.sun.star.sdb.OfficeDatabaseDocument" ) )
+ ) );
+ ::rtl::OUString sDatabaseFilter;
+ OSL_VERIFY( aConfig.getNodeValue( "ooSetupFactoryActualFilter" ) >>= sDatabaseFilter );
+
+ // get the type this filter is responsible for
+ Reference< XNameAccess > xFilterFactory(
+ m_aContext.createComponent( "com.sun.star.document.FilterFactory" ),
+ UNO_QUERY_THROW );
+ ::comphelper::NamedValueCollection aFilterProperties( xFilterFactory->getByName( sDatabaseFilter ) );
+ ::rtl::OUString sDocumentType = aFilterProperties.getOrDefault( "Type", ::rtl::OUString() );
+
+ // get the extension(s) for this type
+ Reference< XNameAccess > xTypeDetection(
+ m_aContext.createComponent( "com.sun.star.document.TypeDetection" ),
+ UNO_QUERY_THROW );
+
+ ::comphelper::NamedValueCollection aTypeProperties( xTypeDetection->getByName( sDocumentType ) );
+ m_aFilterExtensions = aTypeProperties.getOrDefault( "Extensions", m_aFilterExtensions );
+ m_sFilterUIName = aTypeProperties.getOrDefault( "UIName", m_sFilterUIName );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ // ensure we have at least one extension
+ OSL_ENSURE( m_aFilterExtensions.getLength(),
+ "DatabaseLocationInputController_Impl::impl_initFilterProperties_nothrow: unable to determine the file extension(s)!" );
+ if ( m_aFilterExtensions.getLength() == 0 )
+ {
+ m_aFilterExtensions.realloc(1);
+ m_aFilterExtensions[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*.odb" ) );
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+ IMPL_LINK( DatabaseLocationInputController_Impl, OnControlAction, VclWindowEvent*, _pEvent )
+ {
+ if ( ( _pEvent->GetWindow() == &m_rBrowseButton )
+ && ( _pEvent->GetId() == VCLEVENT_BUTTON_CLICK )
+ )
+ {
+ impl_onBrowseButtonClicked();
+ }
+
+ if ( ( _pEvent->GetWindow() == &m_rLocationInput )
+ && ( _pEvent->GetId() == VCLEVENT_EDIT_MODIFY )
+ )
+ {
+ impl_onLocationModified();
+ }
+
+ return 0L;
+ }
+
+ // -----------------------------------------------------------------------------
+ String DatabaseLocationInputController_Impl::impl_getCurrentURL() const
+ {
+ String sCurrentFile( m_rLocationInput.GetText() );
+ if ( sCurrentFile.Len() )
+ {
+ ::svt::OFileNotation aCurrentFile( sCurrentFile );
+ sCurrentFile = aCurrentFile.get( ::svt::OFileNotation::N_URL );
+ }
+ return sCurrentFile;
+ }
+
+ // -----------------------------------------------------------------------------
+ void DatabaseLocationInputController_Impl::impl_onBrowseButtonClicked()
+ {
+ ::sfx2::FileDialogHelper aFileDlg(
+ TemplateDescription::FILESAVE_AUTOEXTENSION,
+ WB_STDMODAL | WB_SAVEAS,
+ m_rLocationInput.GetSystemWindow()
+ );
+ aFileDlg.SetDisplayDirectory( impl_getCurrentURL() );
+
+ aFileDlg.AddFilter( m_sFilterUIName, ::rtl::OUStringBuffer().appendAscii( "*." ).append( m_aFilterExtensions[0] ).makeStringAndClear() );
+ aFileDlg.SetCurrentFilter( m_sFilterUIName );
+
+ if ( aFileDlg.Execute() == ERRCODE_NONE )
+ {
+ INetURLObject aURL( aFileDlg.GetPath() );
+ if( aURL.GetProtocol() != INET_PROT_NOT_VALID )
+ {
+ ::svt::OFileNotation aFileNotation( aURL.GetMainURL( INetURLObject::NO_DECODE ) );
+ m_rLocationInput.SetText( aFileNotation.get( ::svt::OFileNotation::N_SYSTEM ) );
+ m_rLocationInput.GetModifyHdl().Call( &m_rLocationInput );
+ // the dialog already checked for the file's existence, so we don't need to, again
+ m_bNeedExistenceCheck = false;
+ }
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+ void DatabaseLocationInputController_Impl::impl_onLocationModified()
+ {
+ m_bNeedExistenceCheck = true;
+ }
+
+ //====================================================================
+ //= DatabaseLocationInputController
+ //====================================================================
+ //--------------------------------------------------------------------
+ DatabaseLocationInputController::DatabaseLocationInputController( const ::comphelper::ComponentContext& _rContext,
+ ::svt::OFileURLControl& _rLocationInput, PushButton& _rBrowseButton )
+ :m_pImpl( new DatabaseLocationInputController_Impl( _rContext, _rLocationInput, _rBrowseButton ) )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ DatabaseLocationInputController::~DatabaseLocationInputController()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ bool DatabaseLocationInputController::prepareCommit()
+ {
+ return m_pImpl->prepareCommit();
+ }
+
+ //--------------------------------------------------------------------
+ void DatabaseLocationInputController::setURL( const String& _rURL )
+ {
+ m_pImpl->setURL( _rURL );
+ }
+
+ //--------------------------------------------------------------------
+ String DatabaseLocationInputController::getURL() const
+ {
+ return m_pImpl->getURL();
+ }
+
+//........................................................................
+} // namespace svx
+//........................................................................
diff --git a/svx/source/form/datalistener.cxx b/svx/source/form/datalistener.cxx
new file mode 100644
index 000000000000..244d9d2764e1
--- /dev/null
+++ b/svx/source/form/datalistener.cxx
@@ -0,0 +1,98 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "datalistener.hxx"
+#include "datanavi.hxx"
+
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::dom::events;
+
+//............................................................................
+namespace svxform
+{
+//............................................................................
+
+ DataListener::DataListener( DataNavigatorWindow* pNaviWin ) :
+
+ m_pNaviWin( pNaviWin )
+
+ {
+ DBG_ASSERT( m_pNaviWin, "DataListener::Ctor(): no navigator win" );
+ }
+
+ DataListener::~DataListener()
+ {
+ }
+
+ // XContainerListener
+ void SAL_CALL DataListener::elementInserted( const ContainerEvent& /*Event*/ ) throw (RuntimeException)
+ {
+ m_pNaviWin->NotifyChanges();
+ }
+
+ void SAL_CALL DataListener::elementRemoved( const ContainerEvent& /*Event*/ ) throw (RuntimeException)
+ {
+ m_pNaviWin->NotifyChanges();
+ }
+
+ void SAL_CALL DataListener::elementReplaced( const ContainerEvent& /*Event*/ ) throw (RuntimeException)
+ {
+ m_pNaviWin->NotifyChanges();
+ }
+
+ // XFrameActionListener
+ void SAL_CALL DataListener::frameAction( const FrameActionEvent& rActionEvt ) throw (RuntimeException)
+ {
+ if ( FrameAction_COMPONENT_ATTACHED == rActionEvt.Action ||
+ FrameAction_COMPONENT_REATTACHED == rActionEvt.Action )
+ {
+ m_pNaviWin->NotifyChanges( FrameAction_COMPONENT_REATTACHED == rActionEvt.Action );
+ }
+ }
+
+ // xml::dom::events::XEventListener
+ void SAL_CALL DataListener::handleEvent( const Reference< XEvent >& /*evt*/ ) throw (RuntimeException)
+ {
+ m_pNaviWin->NotifyChanges();
+ }
+
+ // lang::XEventListener
+ void SAL_CALL DataListener::disposing( const EventObject& /*Source*/ ) throw (RuntimeException)
+ {
+ DBG_ERRORFILE( "disposing" );
+ }
+
+//............................................................................
+} // namespace svxform
+//............................................................................
+
diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx
new file mode 100644
index 000000000000..de429ca75c57
--- /dev/null
+++ b/svx/source/form/datanavi.cxx
@@ -0,0 +1,3732 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "datanavi.hxx"
+#include "fmservs.hxx"
+
+#include "datanavi.hrc"
+#include "svx/fmresids.hrc"
+#include "fmhelp.hrc"
+#include <svx/svxids.hrc>
+#include <tools/rcid.h>
+#include <tools/diagnose_ex.h>
+#include "svx/xmlexchg.hxx"
+#include <svx/dialmgr.hxx>
+#include <svx/fmshell.hxx>
+#include <svtools/miscopt.hxx>
+#include <unotools/pathoptions.hxx>
+#include <unotools/viewoptions.hxx>
+#include <svtools/svtools.hrc>
+#include <sfx2/app.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <sfx2/objitem.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/container/XSet.hpp>
+#include <com/sun/star/datatransfer/XTransferable.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/frame/XFramesSupplier.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+#include <com/sun/star/xforms/XFormsSupplier.hpp>
+#include <com/sun/star/xml/dom/XDocument.hpp>
+#include <com/sun/star/xml/dom/DOMException.hpp>
+#include <com/sun/star/form/binding/XValueBinding.hpp>
+#include <comphelper/processfactory.hxx>
+#include <rtl/logfile.hxx>
+
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::datatransfer;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::dom::events;
+using namespace ::svx;
+
+namespace css = ::com::sun::star;
+
+#define CFGNAME_DATANAVIGATOR DEFINE_CONST_UNICODE("DataNavigator")
+#define CFGNAME_SHOWDETAILS DEFINE_CONST_UNICODE("ShowDetails")
+#define MSG_VARIABLE DEFINE_CONST_UNICODE("%1")
+#define MODELNAME DEFINE_CONST_UNICODE("$MODELNAME")
+#define INSTANCENAME DEFINE_CONST_UNICODE("$INSTANCENAME")
+#define ELEMENTNAME DEFINE_CONST_UNICODE("$ELEMENTNAME")
+#define ATTRIBUTENAME DEFINE_CONST_UNICODE("$ATTRIBUTENAME")
+#define SUBMISSIONNAME DEFINE_CONST_UNICODE("$SUBMISSIONNAME")
+#define BINDINGNAME DEFINE_CONST_UNICODE("$BINDINGNAME")
+
+//............................................................................
+namespace svxform
+{
+//............................................................................
+
+ // properties of instance
+ #define PN_INSTANCE_MODEL ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Instance" ) )
+ #define PN_INSTANCE_ID ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ID" ) )
+ #define PN_INSTANCE_URL ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) )
+ #define PN_INSTANCE_URLONCE ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URLOnce" ) )
+
+ // properties of binding
+ #define PN_BINDING_ID ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BindingID" ) )
+ #define PN_BINDING_EXPR ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BindingExpression" ) )
+ #define PN_BINDING_MODEL ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) )
+ #define PN_BINDING_NAMESPACES ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModelNamespaces" ) )
+ #define PN_BINDING_MODELID ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModelID" ) )
+ #define PN_READONLY_EXPR ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ReadonlyExpression" ) )
+ #define PN_RELEVANT_EXPR ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RelevantExpression" ) )
+ #define PN_REQUIRED_EXPR ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RequiredExpression" ) )
+ #define PN_CONSTRAINT_EXPR ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ConstraintExpression" ) )
+ #define PN_CALCULATE_EXPR ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CalculateExpression" ) )
+ #define PN_BINDING_TYPE ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Type" ) )
+ #define PN_BINDING_READONLY ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ReadOnly" ) )
+ #define PN_BINDING_ENABLED ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ) )
+
+ // properties of submission
+ #define PN_SUBMISSION_ID ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ID" ) )
+ #define PN_SUBMISSION_BIND ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Bind" ) )
+ #define PN_SUBMISSION_REF ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Ref" ) )
+ #define PN_SUBMISSION_ACTION ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Action" ) )
+ #define PN_SUBMISSION_METHOD ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Method" ) )
+ #define PN_SUBMISSION_MODEL ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) )
+ #define PN_SUBMISSION_REPLACE ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Replace" ) )
+
+ // submission methods
+ #define SUBMITMETHOD_POST ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "post" ) )
+ #define SUBMITMETHOD_GET ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "get" ) )
+ #define SUBMITMETHOD_PUT ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "put" ) )
+
+ // other const strings
+ #define TRUE_VALUE ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true()" ) )
+ #define FALSE_VALUE ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false()" ) )
+ #define NEW_ELEMENT ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "newElement" ) )
+ #define NEW_ATTRIBUTE ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "newAttribute" ) )
+ #define EVENTTYPE_SUBTREE ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DOMSubtreeModified" ) )
+ #define EVENTTYPE_CHARDATA ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DOMCharacterDataModified" ) )
+ #define EVENTTYPE_ATTR ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DOMAttrModified" ) )
+
+ #define MIN_PAGE_COUNT 3 // at least one instance, one submission and one binding page
+
+ struct ItemNode
+ {
+ Reference< css::xml::dom::XNode > m_xNode;
+ Reference< XPropertySet > m_xPropSet;
+
+ ItemNode( const Reference< css::xml::dom::XNode >& _rxNode ) :
+ m_xNode( _rxNode ) {}
+ ItemNode( const Reference< XPropertySet >& _rxSet ) :
+ m_xPropSet( _rxSet ) {}
+
+ DataGroupType GetDataGroupType() const;
+ };
+
+ //========================================================================
+ // class DataTreeListBox
+ //========================================================================
+ DataTreeListBox::DataTreeListBox( XFormsPage* pPage, DataGroupType _eGroup, const ResId& rResId ) :
+
+ SvTreeListBox( pPage, rResId ),
+
+ m_pXFormsPage ( pPage ),
+ m_eGroup ( _eGroup )
+
+ {
+ EnableContextMenuHandling();
+
+ if ( DGTInstance == m_eGroup )
+ SetDragDropMode( SV_DRAGDROP_CTRL_MOVE |SV_DRAGDROP_CTRL_COPY | SV_DRAGDROP_APP_COPY );
+ }
+
+ DataTreeListBox::~DataTreeListBox()
+ {
+ DeleteAndClear();
+ }
+
+ sal_Int8 DataTreeListBox::AcceptDrop( const AcceptDropEvent& /*rEvt*/ )
+ {
+ return DND_ACTION_NONE;
+ }
+ sal_Int8 DataTreeListBox::ExecuteDrop( const ExecuteDropEvent& /*rEvt*/ )
+ {
+ return DND_ACTION_NONE;
+ }
+ void DataTreeListBox::StartDrag( sal_Int8 /*_nAction*/, const Point& /*_rPosPixel*/ )
+ {
+ SvLBoxEntry* pSelected = FirstSelected();
+ if ( !pSelected )
+ // no drag without an entry
+ return;
+
+ if ( m_eGroup == DGTBinding )
+ // for the moment, bindings cannot be dragged.
+ // #i59395# / 2005-12-15 / frank.schoenheit@sun.com
+ return;
+
+ // GetServiceNameForNode() requires a datatype repository which
+ // will be automatically build if requested???
+ Reference< css::xforms::XModel > xModel( m_pXFormsPage->GetXFormsHelper(), UNO_QUERY );
+ Reference< css::xforms::XDataTypeRepository > xDataTypes =
+ xModel->getDataTypeRepository();
+ if(!xDataTypes.is())
+ return;
+
+ using namespace ::com::sun::star::uno;
+ typedef com::sun::star::form::binding::XValueBinding XValueBinding_t;
+
+ ItemNode *pItemNode = static_cast<ItemNode*>(pSelected->GetUserData());
+
+ if ( !pItemNode )
+ {
+ // the only known (and allowed?) case where this happens are sub-entries of a submission
+ // entry
+ DBG_ASSERT( DGTSubmission == m_eGroup, "DataTreeListBox::StartDrag: how this?" );
+ pSelected = GetParent( pSelected );
+ DBG_ASSERT( pSelected && !GetParent( pSelected ), "DataTreeListBox::StartDrag: what kind of entry *is* this?" );
+ // on the submission page, we have only top-level entries (the submission themself)
+ // plus direct children of those (facets of a submission)
+ pItemNode = pSelected ? static_cast< ItemNode* >( pSelected->GetUserData() ) : NULL;
+ if ( !pItemNode )
+ return;
+ }
+
+ OXFormsDescriptor desc;
+ desc.szName = GetEntryText(pSelected);
+ if(pItemNode->m_xNode.is()) {
+ // a valid node interface tells us that we need to create a control from a binding
+ desc.szServiceName = m_pXFormsPage->GetServiceNameForNode(pItemNode->m_xNode);
+ desc.xPropSet = m_pXFormsPage->GetBindingForNode(pItemNode->m_xNode);
+ DBG_ASSERT( desc.xPropSet.is(), "DataTreeListBox::StartDrag(): invalid node binding" );
+ }
+ else {
+ desc.szServiceName = FM_COMPONENT_COMMANDBUTTON;
+ desc.xPropSet = pItemNode->m_xPropSet;
+ }
+ OXFormsTransferable *pTransferable = new OXFormsTransferable(desc);
+ Reference< XTransferable > xEnsureDelete = pTransferable;
+ if(pTransferable) {
+ EndSelection();
+ pTransferable->StartDrag( this, DND_ACTION_COPY );
+ }
+ }
+
+ PopupMenu* DataTreeListBox::CreateContextMenu()
+ {
+ PopupMenu* pMenu = new PopupMenu( SVX_RES( RID_MENU_DATANAVIGATOR ) );
+ if ( DGTInstance == m_eGroup )
+ pMenu->RemoveItem( pMenu->GetItemPos( TBI_ITEM_ADD ) );
+ else
+ {
+ pMenu->RemoveItem( pMenu->GetItemPos( TBI_ITEM_ADD_ELEMENT ) );
+ pMenu->RemoveItem( pMenu->GetItemPos( TBI_ITEM_ADD_ATTRIBUTE ) );
+
+ if ( DGTSubmission == m_eGroup )
+ {
+ pMenu->SetItemText( TBI_ITEM_ADD, SVX_RESSTR( RID_STR_DATANAV_ADD_SUBMISSION ) );
+ pMenu->SetItemText( TBI_ITEM_EDIT, SVX_RESSTR( RID_STR_DATANAV_EDIT_SUBMISSION ) );
+ pMenu->SetItemText( TBI_ITEM_REMOVE, SVX_RESSTR( RID_STR_DATANAV_REMOVE_SUBMISSION ) );
+ }
+ else
+ {
+ pMenu->SetItemText( TBI_ITEM_ADD, SVX_RESSTR( RID_STR_DATANAV_ADD_BINDING ) );
+ pMenu->SetItemText( TBI_ITEM_EDIT, SVX_RESSTR( RID_STR_DATANAV_EDIT_BINDING ) );
+ pMenu->SetItemText( TBI_ITEM_REMOVE, SVX_RESSTR( RID_STR_DATANAV_REMOVE_BINDING ) );
+ }
+ }
+ m_pXFormsPage->EnableMenuItems( pMenu );
+ return pMenu;
+ }
+
+ void DataTreeListBox::ExcecuteContextMenuAction( sal_uInt16 _nSelectedPopupEntry )
+ {
+ m_pXFormsPage->DoMenuAction( _nSelectedPopupEntry );
+ }
+
+ void DataTreeListBox::RemoveEntry( SvLBoxEntry* _pEntry )
+ {
+ if ( _pEntry )
+ {
+ delete static_cast< ItemNode* >( _pEntry->GetUserData() );
+ SvTreeListBox::GetModel()->Remove( _pEntry );
+ }
+ }
+
+ void DataTreeListBox::DeleteAndClear()
+ {
+ sal_uIntPtr i, nCount = GetEntryCount();
+ for ( i = 0; i < nCount; ++i )
+ {
+ SvLBoxEntry* pEntry = GetEntry(i);
+ if ( pEntry )
+ delete static_cast< ItemNode* >( pEntry->GetUserData() );
+ }
+
+ Clear();
+ }
+
+ //========================================================================
+ // class XFormsPage
+ //========================================================================
+ XFormsPage::XFormsPage( Window* pParent, DataNavigatorWindow* _pNaviWin, DataGroupType _eGroup ) :
+
+ TabPage( pParent, SVX_RES( RID_SVX_XFORMS_TABPAGES ) ),
+
+ m_aToolBox ( this, SVX_RES( TB_ITEMS ) ),
+ m_aItemList ( this, _eGroup, SVX_RES( LB_ITEMS ) ),
+ m_pNaviWin ( _pNaviWin ),
+ m_bHasModel ( false ),
+ m_eGroup ( _eGroup ),
+ m_TbxImageList ( SVX_RES( IL_TBX_BMPS ) ),
+ m_TbxHCImageList( SVX_RES( IL_TBX_BMPS_HC ) )
+
+ {
+ FreeResource();
+
+ const ImageList& rImageList =
+ GetBackground().GetColor().IsDark() ? m_TbxHCImageList : m_TbxImageList;
+ m_aToolBox.SetItemImage( TBI_ITEM_ADD, rImageList.GetImage( IID_ITEM_ADD ) );
+ m_aToolBox.SetItemImage( TBI_ITEM_ADD_ELEMENT, rImageList.GetImage( IID_ITEM_ADD_ELEMENT ) );
+ m_aToolBox.SetItemImage( TBI_ITEM_ADD_ATTRIBUTE, rImageList.GetImage( IID_ITEM_ADD_ATTRIBUTE ) );
+ m_aToolBox.SetItemImage( TBI_ITEM_EDIT, rImageList.GetImage( IID_ITEM_EDIT ) );
+ m_aToolBox.SetItemImage( TBI_ITEM_REMOVE, rImageList.GetImage( IID_ITEM_REMOVE ) );
+
+ if ( DGTInstance == m_eGroup )
+ m_aToolBox.RemoveItem( m_aToolBox.GetItemPos( TBI_ITEM_ADD ) );
+ else
+ {
+ m_aToolBox.RemoveItem( m_aToolBox.GetItemPos( TBI_ITEM_ADD_ELEMENT ) );
+ m_aToolBox.RemoveItem( m_aToolBox.GetItemPos( TBI_ITEM_ADD_ATTRIBUTE ) );
+
+ if ( DGTSubmission == m_eGroup )
+ {
+ m_aToolBox.SetItemText( TBI_ITEM_ADD, SVX_RESSTR( RID_STR_DATANAV_ADD_SUBMISSION ) );
+ m_aToolBox.SetItemText( TBI_ITEM_EDIT, SVX_RESSTR( RID_STR_DATANAV_EDIT_SUBMISSION ) );
+ m_aToolBox.SetItemText( TBI_ITEM_REMOVE, SVX_RESSTR( RID_STR_DATANAV_REMOVE_SUBMISSION ) );
+ }
+ else
+ {
+ m_aToolBox.SetItemText( TBI_ITEM_ADD, SVX_RESSTR( RID_STR_DATANAV_ADD_BINDING ) );
+ m_aToolBox.SetItemText( TBI_ITEM_EDIT, SVX_RESSTR( RID_STR_DATANAV_EDIT_BINDING ) );
+ m_aToolBox.SetItemText( TBI_ITEM_REMOVE, SVX_RESSTR( RID_STR_DATANAV_REMOVE_BINDING ) );
+ }
+ }
+
+ const Size aTbxSz( m_aToolBox.CalcWindowSizePixel() );
+ m_aToolBox.SetSizePixel( aTbxSz );
+ m_aToolBox.SetOutStyle( SvtMiscOptions().GetToolboxStyle() );
+ m_aToolBox.SetSelectHdl( LINK( this, XFormsPage, TbxSelectHdl ) );
+ Point aPos = m_aItemList.GetPosPixel();
+ aPos.Y() = aTbxSz.Height();
+ m_aItemList.SetPosPixel( aPos );
+
+ m_aItemList.SetSelectHdl( LINK( this, XFormsPage, ItemSelectHdl ) );
+ m_aItemList.SetNodeDefaultImages();
+ WinBits nBits = WB_BORDER | WB_TABSTOP | WB_HIDESELECTION | WB_NOINITIALSELECTION;
+ if ( DGTInstance == m_eGroup || DGTSubmission == m_eGroup )
+ nBits |= WB_HASBUTTONS | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONSATROOT;
+ m_aItemList.SetStyle( m_aItemList.GetStyle() | nBits );
+ m_aItemList.Show();
+ ItemSelectHdl( &m_aItemList );
+ }
+ //------------------------------------------------------------------------
+ XFormsPage::~XFormsPage()
+ {
+ }
+ //------------------------------------------------------------------------
+ IMPL_LINK( XFormsPage, TbxSelectHdl, ToolBox *, EMPTYARG )
+ {
+ DoToolBoxAction( m_aToolBox.GetCurItemId() );
+ return 0;
+ }
+ //------------------------------------------------------------------------
+ IMPL_LINK( XFormsPage, ItemSelectHdl, DataTreeListBox *, EMPTYARG )
+ {
+ EnableMenuItems( NULL );
+ return 0;
+ }
+ //------------------------------------------------------------------------
+ void XFormsPage::AddChildren(
+ SvLBoxEntry* _pParent, const ImageList& _rImgLst,
+ const Reference< css::xml::dom::XNode >& _xNode )
+ {
+ DBG_ASSERT( m_xUIHelper.is(), "XFormsPage::AddChildren(): invalid UIHelper" );
+
+ try
+ {
+ Reference< css::xml::dom::XNodeList > xNodeList = _xNode->getChildNodes();
+ if ( xNodeList.is() )
+ {
+ bool bShowDetails = m_pNaviWin->IsShowDetails();
+ sal_Int32 i, nNodeCount = xNodeList->getLength();
+ for ( i = 0; i < nNodeCount; ++i )
+ {
+ Reference< css::xml::dom::XNode > xChild = xNodeList->item(i);
+ css::xml::dom::NodeType eChildType = xChild->getNodeType();
+ Image aExpImg, aCollImg;
+ switch ( eChildType )
+ {
+ case css::xml::dom::NodeType_ATTRIBUTE_NODE:
+ aExpImg = aCollImg = _rImgLst.GetImage( IID_ATTRIBUTE );
+ break;
+ case css::xml::dom::NodeType_ELEMENT_NODE:
+ aExpImg = aCollImg = _rImgLst.GetImage( IID_ELEMENT );
+ break;
+ case css::xml::dom::NodeType_TEXT_NODE:
+ aExpImg = aCollImg = _rImgLst.GetImage( IID_TEXT );
+ break;
+ default:
+ aExpImg = aCollImg = _rImgLst.GetImage( IID_OTHER );
+ }
+
+ ::rtl::OUString sName = m_xUIHelper->getNodeDisplayName( xChild, bShowDetails );
+ if ( sName.getLength() > 0 )
+ {
+ ItemNode* pNode = new ItemNode( xChild );
+ SvLBoxEntry* pEntry = m_aItemList.InsertEntry(
+ sName, aExpImg, aCollImg, _pParent, sal_False, LIST_APPEND, pNode );
+ if ( xChild->hasAttributes() )
+ {
+ Reference< css::xml::dom::XNamedNodeMap > xMap = xChild->getAttributes();
+ if ( xMap.is() )
+ {
+ aExpImg = aCollImg = _rImgLst.GetImage( IID_ATTRIBUTE );
+ sal_Int32 j, nMapLen = xMap->getLength();
+ for ( j = 0; j < nMapLen; ++j )
+ {
+ Reference< css::xml::dom::XNode > xAttr = xMap->item(j);
+ pNode = new ItemNode( xAttr );
+ ::rtl::OUString sAttrName =
+ m_xUIHelper->getNodeDisplayName( xAttr, bShowDetails );
+ m_aItemList.InsertEntry(
+ sAttrName, aExpImg, aCollImg,
+ pEntry, sal_False, LIST_APPEND, pNode );
+ }
+ }
+ }
+ if ( xChild->hasChildNodes() )
+ AddChildren( pEntry, _rImgLst, xChild );
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ //------------------------------------------------------------------------
+ bool XFormsPage::DoToolBoxAction( sal_uInt16 _nToolBoxID ) {
+
+ bool bHandled = false;
+ bool bIsDocModified = false;
+ m_pNaviWin->DisableNotify( true );
+
+ switch ( _nToolBoxID )
+ {
+ case TBI_ITEM_ADD:
+ case TBI_ITEM_ADD_ELEMENT:
+ case TBI_ITEM_ADD_ATTRIBUTE:
+ {
+ bHandled = true;
+ Reference< css::xforms::XModel > xModel( m_xUIHelper, UNO_QUERY );
+ DBG_ASSERT( xModel.is(), "XFormsPage::DoToolBoxAction(): Action without model" );
+ if ( DGTSubmission == m_eGroup )
+ {
+ AddSubmissionDialog aDlg( this, NULL, m_xUIHelper );
+ if ( aDlg.Execute() == RET_OK && aDlg.GetNewSubmission().is() )
+ {
+ try
+ {
+ Reference< css::xforms::XSubmission > xNewSubmission = aDlg.GetNewSubmission();
+ Reference< XSet > xSubmissions( xModel->getSubmissions(), UNO_QUERY );
+ xSubmissions->insert( makeAny( xNewSubmission ) );
+ Reference< XPropertySet > xNewPropSet( xNewSubmission, UNO_QUERY );
+ SvLBoxEntry* pEntry = AddEntry( xNewPropSet );
+ m_aItemList.Select( pEntry, sal_True );
+ bIsDocModified = true;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "XFormsPage::DoToolBoxAction(): exception while adding submission" );
+ }
+ }
+ }
+ else
+ {
+ DataItemType eType = DITElement;
+ SvLBoxEntry* pEntry = m_aItemList.FirstSelected();
+ ItemNode* pNode = NULL;
+ Reference< css::xml::dom::XNode > xParentNode;
+ Reference< XPropertySet > xNewBinding;
+ sal_uInt16 nResId = 0;
+ bool bIsElement = true;
+ if ( DGTInstance == m_eGroup )
+ {
+ if ( m_sInstanceURL.Len() > 0 )
+ {
+ LinkedInstanceWarningBox aMsgBox( this );
+ if ( aMsgBox.Execute() != RET_OK )
+ return bHandled;
+ }
+
+ DBG_ASSERT( pEntry, "XFormsPage::DoToolBoxAction(): no entry" );
+ ItemNode* pParentNode = static_cast< ItemNode* >( pEntry->GetUserData() );
+ DBG_ASSERT( pParentNode, "XFormsPage::DoToolBoxAction(): no parent node" );
+ xParentNode = pParentNode->m_xNode;
+ Reference< css::xml::dom::XNode > xNewNode;
+ if ( TBI_ITEM_ADD_ELEMENT == _nToolBoxID )
+ {
+ try
+ {
+ nResId = RID_STR_DATANAV_ADD_ELEMENT;
+ xNewNode = m_xUIHelper->createElement( xParentNode, NEW_ELEMENT );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "XFormsPage::DoToolBoxAction(): exception while create element" );
+ }
+ }
+ else
+ {
+ nResId = RID_STR_DATANAV_ADD_ATTRIBUTE;
+ bIsElement = false;
+ eType = DITAttribute;
+ try
+ {
+ xNewNode = m_xUIHelper->createAttribute( xParentNode, NEW_ATTRIBUTE );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "XFormsPage::DoToolBoxAction(): exception while create attribute" );
+ }
+ }
+
+ try
+ {
+ xNewNode = xParentNode->appendChild( xNewNode );
+ }
+ catch ( css::xml::dom::DOMException& e )
+ {
+ if ( e.Code == css::xml::dom::DOMExceptionType_DOMSTRING_SIZE_ERR )
+ {
+ DBG_ERRORFILE( "XFormsPage::DoToolBoxAction(): domexception: size error" );
+ }
+ DBG_ERRORFILE( "XFormsPage::DoToolBoxAction(): domexception while append child" );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "XFormsPage::DoToolBoxAction(): exception while append child" );
+ }
+
+ try
+ {
+ Reference< css::xml::dom::XNode > xPNode;
+ if ( xNewNode.is() )
+ xPNode = xNewNode->getParentNode();
+ // attributes don't have parents in the DOM model
+ DBG_ASSERT( TBI_ITEM_ADD_ATTRIBUTE == _nToolBoxID
+ || xPNode.is(), "XFormsPage::DoToolboxAction(): node not added" );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "XFormsPage::DoToolboxAction(): exception caught" );
+ }
+
+ try
+ {
+ m_xUIHelper->getBindingForNode( xNewNode, sal_True );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "XFormsPage::DoToolBoxAction(): exception while get binding for node" );
+ }
+ pNode = new ItemNode( xNewNode );
+ }
+ else
+ {
+ try
+ {
+ nResId = RID_STR_DATANAV_ADD_BINDING;
+ xNewBinding = xModel->createBinding();
+ Reference< XSet > xBindings( xModel->getBindings(), UNO_QUERY );
+ xBindings->insert( makeAny( xNewBinding ) );
+ pNode = new ItemNode( xNewBinding );
+ eType = DITBinding;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "XFormsPage::DoToolBoxAction(): exception while adding binding" );
+ }
+ }
+
+ AddDataItemDialog aDlg( this, pNode, m_xUIHelper );
+ aDlg.SetText( SVX_RESSTR( nResId ) );
+ aDlg.InitText( eType );
+ short nReturn = aDlg.Execute();
+ if ( DGTInstance == m_eGroup )
+ {
+ if ( RET_OK == nReturn )
+ {
+ SvLBoxEntry* pNewEntry = AddEntry( pNode, bIsElement );
+ m_aItemList.MakeVisible( pNewEntry );
+ m_aItemList.Select( pNewEntry, sal_True );
+ bIsDocModified = true;
+ }
+ else
+ {
+ try
+ {
+ Reference< css::xml::dom::XNode > xPNode;
+ Reference< css::xml::dom::XNode > xNode =
+ xParentNode->removeChild( pNode->m_xNode );
+ if ( xNode.is() )
+ xPNode = xNode->getParentNode();
+ DBG_ASSERT( !xPNode.is(), "XFormsPage::RemoveEntry(): node not removed" );
+ delete pNode;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "XFormsPage::DoToolboxAction(): exception caught" );
+ }
+ }
+ }
+ else
+ {
+ if ( RET_OK == nReturn )
+ {
+ SvLBoxEntry* pNewEntry = AddEntry( xNewBinding );
+ m_aItemList.Select( pNewEntry, sal_True );
+ bIsDocModified = true;
+ }
+ else
+ {
+ try
+ {
+ Reference< XSet > xBindings( xModel->getBindings(), UNO_QUERY );
+ xBindings->remove( makeAny( xNewBinding ) );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "XFormsPage::DoToolboxAction(): exception caught" );
+ }
+ }
+ delete pNode;
+ }
+ }
+ }
+ break;
+
+ case TBI_ITEM_EDIT:
+ {
+ bHandled = true;
+ SvLBoxEntry* pEntry = m_aItemList.FirstSelected();
+ if ( pEntry )
+ {
+ if ( DGTSubmission == m_eGroup && m_aItemList.GetParent( pEntry ) )
+ pEntry = m_aItemList.GetParent( pEntry );
+ ItemNode* pNode = static_cast< ItemNode* >( pEntry->GetUserData() );
+ if ( DGTInstance == m_eGroup || DGTBinding == m_eGroup )
+ {
+ if ( DGTInstance == m_eGroup && m_sInstanceURL.Len() > 0 )
+ {
+ LinkedInstanceWarningBox aMsgBox( this );
+ if ( aMsgBox.Execute() != RET_OK )
+ return bHandled;
+ }
+
+ AddDataItemDialog aDlg( this, pNode, m_xUIHelper );
+ DataItemType eType = DITElement;
+ sal_uInt16 nResId = RID_STR_DATANAV_EDIT_ELEMENT;
+ if ( pNode && pNode->m_xNode.is() )
+ {
+ try
+ {
+ css::xml::dom::NodeType eChildType = pNode->m_xNode->getNodeType();
+ if ( eChildType == css::xml::dom::NodeType_ATTRIBUTE_NODE )
+ {
+ nResId = RID_STR_DATANAV_EDIT_ATTRIBUTE;
+ eType = DITAttribute;
+ }
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "XFormsPage::DoToolboxAction(): exception caught" );
+ }
+ }
+ else if ( DGTBinding == m_eGroup )
+ {
+ nResId = RID_STR_DATANAV_EDIT_BINDING;
+ eType = DITBinding;
+ }
+ aDlg.SetText( SVX_RESSTR( nResId ) );
+ aDlg.InitText( eType );
+ if ( aDlg.Execute() == RET_OK )
+ {
+ // Set the new name
+ String sNewName;
+ if ( DGTInstance == m_eGroup )
+ {
+ try
+ {
+ sNewName = m_xUIHelper->getNodeDisplayName(
+ pNode->m_xNode, m_pNaviWin->IsShowDetails() );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "XFormsPage::DoToolboxAction(): exception caught" );
+ }
+ }
+ else
+ {
+ try
+ {
+ String sDelim( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+ ::rtl::OUString sTemp;
+ pNode->m_xPropSet->getPropertyValue( PN_BINDING_ID ) >>= sTemp;
+ sNewName += String( sTemp );
+ sNewName += sDelim;
+ pNode->m_xPropSet->getPropertyValue( PN_BINDING_EXPR ) >>= sTemp;
+ sNewName += String( sTemp );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "XFormsPage::DoToolboxAction(): exception caught" );
+ }
+ }
+
+ m_aItemList.SetEntryText( pEntry, sNewName );
+ bIsDocModified = true;
+ }
+ }
+ else
+ {
+ AddSubmissionDialog aDlg( this, pNode, m_xUIHelper );
+ aDlg.SetText( SVX_RESSTR( RID_STR_DATANAV_EDIT_SUBMISSION ) );
+ if ( aDlg.Execute() == RET_OK )
+ {
+ EditEntry( pNode->m_xPropSet );
+ bIsDocModified = true;
+ }
+ }
+ }
+ }
+ break;
+
+ case TBI_ITEM_REMOVE:
+ {
+ bHandled = true;
+ if ( DGTInstance == m_eGroup && m_sInstanceURL.Len() > 0 )
+ {
+ LinkedInstanceWarningBox aMsgBox( this );
+ if ( aMsgBox.Execute() != RET_OK )
+ return bHandled;
+ }
+ bIsDocModified = RemoveEntry();
+ }
+ break;
+
+ case MID_INSERT_CONTROL:
+ {
+ OSL_ENSURE( false, "XFormsPage::DoToolboxAction: MID_INSERT_CONTROL not implemented, yet!" );
+ }
+ break;
+
+ default:
+ OSL_ENSURE( false, "XFormsPage::DoToolboxAction: unknown ID!" );
+ break;
+ }
+
+ m_pNaviWin->DisableNotify( false );
+ EnableMenuItems( NULL );
+ if ( bIsDocModified )
+ m_pNaviWin->SetDocModified();
+ return bHandled;
+ }
+
+ //------------------------------------------------------------------------
+ SvLBoxEntry* XFormsPage::AddEntry( ItemNode* _pNewNode, bool _bIsElement )
+ {
+ SvLBoxEntry* pParent = m_aItemList.FirstSelected();
+ const ImageList& rImageList = GetSettings().GetStyleSettings().GetHighContrastMode()
+ ? m_pNaviWin->GetItemHCImageList()
+ : m_pNaviWin->GetItemImageList();
+ sal_uInt16 nImageID = ( _bIsElement ) ? IID_ELEMENT : IID_ATTRIBUTE;
+ Image aImage = rImageList.GetImage( nImageID );
+ ::rtl::OUString sName;
+ try
+ {
+ sName = m_xUIHelper->getNodeDisplayName(
+ _pNewNode->m_xNode, m_pNaviWin->IsShowDetails() );
+ }
+ catch ( Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return m_aItemList.InsertEntry(
+ sName, aImage, aImage, pParent, sal_False, LIST_APPEND, _pNewNode );
+ }
+ //------------------------------------------------------------------------
+ class lcl_ResourceString
+ {
+ protected:
+ lcl_ResourceString()
+ {
+ }
+
+ lcl_ResourceString( const lcl_ResourceString& );
+
+ virtual ~lcl_ResourceString()
+ {
+ }
+
+ // load UI resources from resource file
+ void init()
+ {
+ // create a resource manager, for the svx resource file
+ // and the UI locale
+ ByteString aResourceFile( "svx" );
+ ResMgr* pResMgr = ResMgr::CreateResMgr(
+ aResourceFile.GetBuffer(),
+ Application::GetSettings().GetUILocale() );
+
+ // load the resources for the AddSubmission modal dialog.
+ // This will create our own resource context.
+ ResId aRes( RID_SVXDLG_ADD_SUBMISSION, *pResMgr );
+ aRes.SetRT( RSC_MODALDIALOG );
+ pResMgr->GetResource( aRes );
+
+ // now, we can access the local resources from the dialog's
+ // resource context
+ _initResources(pResMgr);
+
+ // clean up: remove context, and delete the resource manager
+ // ( Increment(..) is needed since PopContext() requires that
+ // the file pointer is at the end. )
+ pResMgr->Increment( pResMgr->GetRemainSize() );
+ pResMgr->PopContext();
+ delete pResMgr;
+ }
+
+ // load resources... to be overloaded in sub-classes
+ virtual void _initResources( ResMgr* pMgr ) = 0;
+ };
+
+ class lcl_ReplaceString : public lcl_ResourceString
+ {
+ rtl::OUString m_sDoc_UI;
+ rtl::OUString m_sInstance_UI;
+ rtl::OUString m_sNone_UI;
+
+ rtl::OUString m_sDoc_API;
+ rtl::OUString m_sInstance_API;
+ rtl::OUString m_sNone_API;
+
+ lcl_ReplaceString() :
+ lcl_ResourceString(),
+ m_sDoc_API( RTL_CONSTASCII_USTRINGPARAM("all") ),
+ m_sInstance_API( RTL_CONSTASCII_USTRINGPARAM("instance") ),
+ m_sNone_API( RTL_CONSTASCII_USTRINGPARAM("none") )
+ {
+ init();
+ }
+
+ lcl_ReplaceString( const lcl_ReplaceString& );
+
+ virtual ~lcl_ReplaceString()
+ {
+ }
+
+ // load UI resources from resource file
+ virtual void _initResources( ResMgr * pMgr )
+ {
+ // now, we can access the local resources from the dialog's
+ // resource context
+ m_sDoc_UI = String( ResId( STR_REPLACE_DOC, *pMgr ) );
+ m_sInstance_UI = String( ResId( STR_REPLACE_INST, *pMgr ) );
+ m_sNone_UI = String( ResId( STR_REPLACE_NONE, *pMgr ) );
+ }
+
+ public:
+
+ /** create and obtain the singleton instance */
+ static const lcl_ReplaceString& get()
+ {
+ // keep the singleton instance here
+ static lcl_ReplaceString* m_pInstance = NULL;
+
+ if( m_pInstance == NULL )
+ m_pInstance = new lcl_ReplaceString();
+ return *m_pInstance;
+ }
+
+ /** convert submission replace string from API value to UI value.
+ Use 'none' as default. */
+ rtl::OUString toUI( const rtl::OUString& rStr ) const
+ {
+ if( rStr == m_sDoc_API )
+ return m_sDoc_UI;
+ else if( rStr == m_sInstance_API )
+ return m_sInstance_UI;
+ else
+ return m_sNone_UI;
+ }
+
+ /** convert submission replace string from UI to API.
+ Use 'none' as default. */
+ rtl::OUString toAPI( const rtl::OUString& rStr ) const
+ {
+ if( rStr == m_sDoc_UI )
+ return m_sDoc_API;
+ else if( rStr == m_sInstance_UI )
+ return m_sInstance_API;
+ else
+ return m_sNone_API;
+ }
+ };
+
+ class lcl_MethodString : public lcl_ResourceString
+ {
+ rtl::OUString m_sPost_UI;
+ rtl::OUString m_sPut_UI;
+ rtl::OUString m_sGet_UI;
+
+ rtl::OUString m_sPost_API;
+ rtl::OUString m_sPut_API;
+ rtl::OUString m_sGet_API;
+
+ lcl_MethodString() :
+ lcl_ResourceString(),
+ m_sPost_API( RTL_CONSTASCII_USTRINGPARAM("post") ),
+ m_sPut_API( RTL_CONSTASCII_USTRINGPARAM("put") ),
+ m_sGet_API( RTL_CONSTASCII_USTRINGPARAM("get") )
+ {
+ init();
+ }
+
+ lcl_MethodString( const lcl_MethodString& );
+
+ virtual ~lcl_MethodString()
+ {
+ }
+
+ // load UI resources from resource file
+ virtual void _initResources(ResMgr* pMgr)
+ {
+ m_sPost_UI = String( ResId( STR_METHOD_POST, *pMgr ) );
+ m_sPut_UI = String( ResId( STR_METHOD_PUT, *pMgr ) );
+ m_sGet_UI = String( ResId( STR_METHOD_GET, *pMgr ) );
+ }
+
+ public:
+
+ /** create and obtain the singleton instance */
+ static const lcl_MethodString& get()
+ {
+ // keep the singleton instance here
+ static lcl_MethodString* m_pInstance = NULL;
+
+ if( m_pInstance == NULL )
+ m_pInstance = new lcl_MethodString();
+ return *m_pInstance;
+ }
+
+ /** convert from API to UI; put is default. */
+ rtl::OUString toUI( const rtl::OUString& rStr ) const
+ {
+ if( rStr == m_sGet_API )
+ return m_sGet_UI;
+ else if( rStr == m_sPost_API )
+ return m_sPost_UI;
+ else
+ return m_sPut_UI;
+ }
+
+ /** convert from UI to API; put is default */
+ rtl::OUString toAPI( const rtl::OUString& rStr ) const
+ {
+ if( rStr == m_sGet_UI )
+ return m_sGet_API;
+ else if( rStr == m_sPost_UI )
+ return m_sPost_API;
+ else
+ return m_sPut_API;
+ }
+ };
+
+ //------------------------------------------------------------------------
+ SvLBoxEntry* XFormsPage::AddEntry( const Reference< XPropertySet >& _rEntry )
+ {
+ SvLBoxEntry* pEntry = NULL;
+ const ImageList& rImageList = GetSettings().GetStyleSettings().GetHighContrastMode()
+ ? m_pNaviWin->GetItemHCImageList()
+ : m_pNaviWin->GetItemImageList();
+ Image aImage = rImageList.GetImage( IID_ELEMENT );
+
+ ItemNode* pNode = new ItemNode( _rEntry );
+ rtl::OUString sTemp;
+
+ if ( DGTSubmission == m_eGroup )
+ {
+ try
+ {
+ // ID
+ _rEntry->getPropertyValue( PN_SUBMISSION_ID ) >>= sTemp;
+ pEntry = m_aItemList.InsertEntry( sTemp, aImage, aImage, NULL, sal_False, LIST_APPEND, pNode );
+ // Action
+ _rEntry->getPropertyValue( PN_SUBMISSION_ACTION ) >>= sTemp;
+ String sEntry = SVX_RESSTR( RID_STR_DATANAV_SUBM_ACTION );
+ sEntry += String( sTemp );
+ m_aItemList.InsertEntry( sEntry, aImage, aImage, pEntry );
+ // Method
+ _rEntry->getPropertyValue( PN_SUBMISSION_METHOD ) >>= sTemp;
+ sEntry = SVX_RESSTR( RID_STR_DATANAV_SUBM_METHOD );
+ sEntry += String( lcl_MethodString::get().toUI( sTemp ) );
+ m_aItemList.InsertEntry( sEntry, aImage, aImage, pEntry );
+ // Ref
+ _rEntry->getPropertyValue( PN_SUBMISSION_REF ) >>= sTemp;
+ sEntry = SVX_RESSTR( RID_STR_DATANAV_SUBM_REF );
+ sEntry += String( sTemp );
+ m_aItemList.InsertEntry( sEntry, aImage, aImage, pEntry );
+ // Bind
+ _rEntry->getPropertyValue( PN_SUBMISSION_BIND ) >>= sTemp;
+ sEntry = SVX_RESSTR( RID_STR_DATANAV_SUBM_BIND );
+ sEntry += String( sTemp );
+ m_aItemList.InsertEntry( sEntry, aImage, aImage, pEntry );
+ // Replace
+ _rEntry->getPropertyValue( PN_SUBMISSION_REPLACE ) >>= sTemp;
+ sEntry = SVX_RESSTR( RID_STR_DATANAV_SUBM_REPLACE );
+ sEntry += String( lcl_ReplaceString::get().toUI( sTemp ) );
+ m_aItemList.InsertEntry( sEntry, aImage, aImage, pEntry );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "XFormsPage::AddEntry(Ref): exception caught" );
+ }
+ }
+ else // then Binding Page
+ {
+ try
+ {
+ String sDelim( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+ ::rtl::OUString sName;
+ _rEntry->getPropertyValue( PN_BINDING_ID ) >>= sTemp;
+ sName += String( sTemp );
+ sName += sDelim;
+ _rEntry->getPropertyValue( PN_BINDING_EXPR ) >>= sTemp;
+ sName += String( sTemp );
+ pEntry = m_aItemList.InsertEntry(
+ sName, aImage, aImage, NULL, sal_False, LIST_APPEND, pNode );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "XFormsPage::AddEntry(Ref): exception caught" );
+ }
+ }
+
+ return pEntry;
+ }
+
+ //------------------------------------------------------------------------
+ void XFormsPage::EditEntry( const Reference< XPropertySet >& _rEntry )
+ {
+ SvLBoxEntry* pEntry = NULL;
+ rtl::OUString sTemp;
+
+ if ( DGTSubmission == m_eGroup )
+ {
+ try
+ {
+ pEntry = m_aItemList.FirstSelected();
+
+ // #i36262# may be called for submission entry *or* for
+ // submission children. If we don't have any children, we
+ // assume the latter case and use the parent
+ if( m_aItemList.GetEntry( pEntry, 0 ) == NULL )
+ {
+ pEntry = m_aItemList.GetModel()->GetParent( pEntry );
+ }
+
+ _rEntry->getPropertyValue( PN_SUBMISSION_ID ) >>= sTemp;
+ m_aItemList.SetEntryText( pEntry, sTemp );
+
+ _rEntry->getPropertyValue( PN_SUBMISSION_BIND ) >>= sTemp;
+ String sEntry = SVX_RESSTR( RID_STR_DATANAV_SUBM_BIND );
+ sEntry += String( sTemp );
+ sal_uIntPtr nPos = 0;
+ SvLBoxEntry* pChild = m_aItemList.GetEntry( pEntry, nPos++ );
+ m_aItemList.SetEntryText( pChild, sEntry );
+ _rEntry->getPropertyValue( PN_SUBMISSION_REF ) >>= sTemp;
+ sEntry = SVX_RESSTR( RID_STR_DATANAV_SUBM_REF );
+ sEntry += String( sTemp );
+ pChild = m_aItemList.GetEntry( pEntry, nPos++ );
+ m_aItemList.SetEntryText( pChild, sEntry );
+ _rEntry->getPropertyValue( PN_SUBMISSION_ACTION ) >>= sTemp;
+ sEntry = SVX_RESSTR( RID_STR_DATANAV_SUBM_ACTION );
+ sEntry += String( sTemp );
+ pChild = m_aItemList.GetEntry( pEntry, nPos++ );
+ m_aItemList.SetEntryText( pChild, sEntry );
+ _rEntry->getPropertyValue( PN_SUBMISSION_METHOD ) >>= sTemp;
+ sEntry = SVX_RESSTR( RID_STR_DATANAV_SUBM_METHOD );
+ sEntry += String( lcl_MethodString::get().toUI( sTemp ) );
+ pChild = m_aItemList.GetEntry( pEntry, nPos++ );
+ m_aItemList.SetEntryText( pChild, sEntry );
+ _rEntry->getPropertyValue( PN_SUBMISSION_REPLACE ) >>= sTemp;
+ sEntry = SVX_RESSTR( RID_STR_DATANAV_SUBM_REPLACE );
+ sEntry += String( lcl_ReplaceString::get().toUI( sTemp ) );
+ pChild = m_aItemList.GetEntry( pEntry, nPos++ );
+ m_aItemList.SetEntryText( pChild, sEntry );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "XFormsPage::EditEntry(): exception caught" );
+ }
+ }
+ }
+
+ //------------------------------------------------------------------------
+ bool XFormsPage::RemoveEntry()
+ {
+ bool bRet = false;
+ SvLBoxEntry* pEntry = m_aItemList.FirstSelected();
+ if ( pEntry &&
+ ( DGTInstance != m_eGroup || m_aItemList.GetParent( pEntry ) ) )
+ {
+ Reference< css::xforms::XModel > xModel( m_xUIHelper, UNO_QUERY );
+ DBG_ASSERT( xModel.is(), "XFormsPage::RemoveEntry(): no model" );
+ ItemNode* pNode = static_cast< ItemNode* >( pEntry->GetUserData() );
+ DBG_ASSERT( pNode, "XFormsPage::RemoveEntry(): no node" );
+
+ if ( DGTInstance == m_eGroup )
+ {
+ try
+ {
+ DBG_ASSERT( pNode->m_xNode.is(), "XFormsPage::RemoveEntry(): no XNode" );
+ css::xml::dom::NodeType eChildType = pNode->m_xNode->getNodeType();
+ bool bIsElement = ( eChildType == css::xml::dom::NodeType_ELEMENT_NODE );
+ sal_uInt16 nResId = bIsElement ? RID_QRY_REMOVE_ELEMENT : RID_QRY_REMOVE_ATTRIBUTE;
+ String sVar = bIsElement ? ELEMENTNAME : ATTRIBUTENAME;
+ QueryBox aQBox( this, SVX_RES( nResId ) );
+ String sMessText = aQBox.GetMessText();
+ sMessText.SearchAndReplace(
+ sVar, m_xUIHelper->getNodeDisplayName( pNode->m_xNode, sal_False ) );
+ aQBox.SetMessText( sMessText );
+ if ( aQBox.Execute() == RET_YES )
+ {
+ SvLBoxEntry* pParent = m_aItemList.GetParent( pEntry );
+ DBG_ASSERT( pParent, "XFormsPage::RemoveEntry(): no parent entry" );
+ ItemNode* pParentNode = static_cast< ItemNode* >( pParent->GetUserData() );
+ DBG_ASSERT( pParentNode && pParentNode->m_xNode.is(), "XFormsPage::RemoveEntry(): no parent XNode" );
+
+ Reference< css::xml::dom::XNode > xPNode;
+ Reference< css::xml::dom::XNode > xNode =
+ pParentNode->m_xNode->removeChild( pNode->m_xNode );
+ if ( xNode.is() )
+ xPNode = xNode->getParentNode();
+ DBG_ASSERT( !xPNode.is(), "XFormsPage::RemoveEntry(): node not removed" );
+ bRet = true;
+ }
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "XFormsPage::RemoveEntry(): exception caught" );
+ }
+ }
+ else
+ {
+ DBG_ASSERT( pNode->m_xPropSet.is(), "XFormsPage::RemoveEntry(): no propset" );
+ bool bSubmission = ( DGTSubmission == m_eGroup );
+ sal_uInt16 nResId = bSubmission ? RID_QRY_REMOVE_SUBMISSION : RID_QRY_REMOVE_BINDING;
+ rtl::OUString sProperty = bSubmission ? PN_SUBMISSION_ID : PN_BINDING_ID;
+ String sSearch = bSubmission ? SUBMISSIONNAME : BINDINGNAME;
+ rtl::OUString sName;
+ try
+ {
+ pNode->m_xPropSet->getPropertyValue( sProperty ) >>= sName;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "XFormsPage::RemoveEntry(): exception caught" );
+ }
+ QueryBox aQBox( this, SVX_RES( nResId ) );
+ String sMessText = aQBox.GetMessText();
+ sMessText.SearchAndReplace( sSearch, String( sName ) );
+ aQBox.SetMessText( sMessText );
+ if ( aQBox.Execute() == RET_YES )
+ {
+ try
+ {
+ if ( bSubmission )
+ xModel->getSubmissions()->remove( makeAny( pNode->m_xPropSet ) );
+ else // then Binding Page
+ xModel->getBindings()->remove( makeAny( pNode->m_xPropSet ) );
+ bRet = true;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "XFormsPage::RemoveEntry(): exception caught" );
+ }
+ }
+ }
+
+ if ( bRet )
+ m_aItemList.RemoveEntry( pEntry );
+ }
+
+ return bRet;
+ }
+
+ //------------------------------------------------------------------------
+ long XFormsPage::Notify( NotifyEvent& rNEvt )
+ {
+ long nHandled = 0;
+
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ sal_uInt16 nCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
+
+ switch ( nCode )
+ {
+ case KEY_DELETE:
+ nHandled = DoMenuAction( TBI_ITEM_REMOVE );
+ break;
+ }
+ }
+
+ return nHandled ? nHandled : Window::Notify( rNEvt );
+ }
+ //------------------------------------------------------------------------
+ void XFormsPage::Resize()
+ {
+ Size aSize = GetOutputSizePixel();
+ Size aTbxSize = m_aToolBox.GetSizePixel();
+ aTbxSize.Width() = aSize.Width();
+ m_aToolBox.SetSizePixel( aTbxSize );
+ aSize.Width() -= 4;
+ aSize.Height() -= ( 4 + aTbxSize.Height() );
+ m_aItemList.SetPosSizePixel( Point( 2, 2 + aTbxSize.Height() ), aSize );
+ }
+ //------------------------------------------------------------------------
+ String XFormsPage::SetModel( const Reference< css::xforms::XModel >& _xModel, sal_uInt16 _nPagePos )
+ {
+ DBG_ASSERT( _xModel.is(), "XFormsPage::SetModel(): invalid model" );
+
+ m_xUIHelper = Reference< css::xforms::XFormsUIHelper1 >( _xModel, UNO_QUERY );
+ String sRet;
+ m_bHasModel = true;
+ const ImageList& rImageList = GetSettings().GetStyleSettings().GetHighContrastMode()
+ ? m_pNaviWin->GetItemHCImageList()
+ : m_pNaviWin->GetItemImageList();
+
+ switch ( m_eGroup )
+ {
+ case DGTInstance :
+ {
+ DBG_ASSERT( _nPagePos != TAB_PAGE_NOTFOUND, "XFormsPage::SetModel(): invalid page position" );
+ try
+ {
+ Reference< XContainer > xContainer( _xModel->getInstances(), UNO_QUERY );
+ if ( xContainer.is() )
+ m_pNaviWin->AddContainerBroadcaster( xContainer );
+
+ sal_uInt16 nIter = 0;
+ Reference< XEnumerationAccess > xNumAccess( _xModel->getInstances(), UNO_QUERY );
+ if ( xNumAccess.is() )
+ {
+ Reference < XEnumeration > xNum = xNumAccess->createEnumeration();
+ if ( xNum.is() && xNum->hasMoreElements() )
+ {
+ while ( xNum->hasMoreElements() )
+ {
+ if ( nIter == _nPagePos )
+ {
+ Sequence< PropertyValue > xPropSeq;
+ Any aAny = xNum->nextElement();
+ if ( aAny >>= xPropSeq )
+ sRet = LoadInstance( xPropSeq, rImageList );
+ else
+ {
+ DBG_ERRORFILE( "XFormsPage::SetModel(): invalid instance" );
+ }
+ break;
+ }
+ else
+ {
+ xNum->nextElement();
+ nIter++;
+ }
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERRORFILE( "XFormsPage::SetModel(): exception caught" );
+ }
+ break;
+ }
+
+ case DGTSubmission :
+ {
+ DBG_ASSERT( TAB_PAGE_NOTFOUND == _nPagePos, "XFormsPage::SetModel(): invalid page position" );
+ try
+ {
+ Reference< XContainer > xContainer( _xModel->getSubmissions(), UNO_QUERY );
+ if ( xContainer.is() )
+ m_pNaviWin->AddContainerBroadcaster( xContainer );
+
+ Reference< XEnumerationAccess > xNumAccess( _xModel->getSubmissions(), UNO_QUERY );
+ if ( xNumAccess.is() )
+ {
+ Reference < XEnumeration > xNum = xNumAccess->createEnumeration();
+ if ( xNum.is() && xNum->hasMoreElements() )
+ {
+ while ( xNum->hasMoreElements() )
+ {
+ Reference< XPropertySet > xPropSet;
+ Any aAny = xNum->nextElement();
+ if ( aAny >>= xPropSet )
+ AddEntry( xPropSet );
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERRORFILE( "XFormsPage::SetModel(): exception caught" );
+ }
+ break;
+ }
+
+ case DGTBinding :
+ {
+ DBG_ASSERT( TAB_PAGE_NOTFOUND == _nPagePos, "XFormsPage::SetModel(): invalid page position" );
+ try
+ {
+ Reference< XContainer > xContainer( _xModel->getBindings(), UNO_QUERY );
+ if ( xContainer.is() )
+ m_pNaviWin->AddContainerBroadcaster( xContainer );
+
+ Reference< XEnumerationAccess > xNumAccess( _xModel->getBindings(), UNO_QUERY );
+ if ( xNumAccess.is() )
+ {
+ Reference < XEnumeration > xNum = xNumAccess->createEnumeration();
+ if ( xNum.is() && xNum->hasMoreElements() )
+ {
+ Image aImage1 = rImageList.GetImage( IID_ELEMENT );
+ Image aImage2 = rImageList.GetImage( IID_ELEMENT );
+ String sDelim( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+ while ( xNum->hasMoreElements() )
+ {
+ Reference< XPropertySet > xPropSet;
+ Any aAny = xNum->nextElement();
+ if ( aAny >>= xPropSet )
+ {
+ String sEntry;
+ rtl::OUString sTemp;
+ xPropSet->getPropertyValue( PN_BINDING_ID ) >>= sTemp;
+ sEntry += String( sTemp );
+ sEntry += sDelim;
+ xPropSet->getPropertyValue( PN_BINDING_EXPR ) >>= sTemp;
+ sEntry += String( sTemp );
+
+ ItemNode* pNode = new ItemNode( xPropSet );
+ m_aItemList.InsertEntry(
+ sEntry, aImage1, aImage2, NULL, sal_False, LIST_APPEND, pNode );
+ }
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERRORFILE( "XFormsPage::SetModel(): exception caught" );
+ }
+ break;
+ }
+ default:
+ DBG_ERROR( "XFormsPage::SetModel: unknown group!" );
+ break;
+ }
+
+ EnableMenuItems( NULL );
+
+ return sRet;
+ }
+ //------------------------------------------------------------------------
+ void XFormsPage::ClearModel()
+ {
+ m_bHasModel = false;
+ m_aItemList.DeleteAndClear();
+ }
+ //------------------------------------------------------------------------
+ String XFormsPage::LoadInstance(
+ const Sequence< PropertyValue >& _xPropSeq, const ImageList& _rImgLst )
+ {
+ String sRet;
+ rtl::OUString sTemp;
+ rtl::OUString sInstModel = PN_INSTANCE_MODEL;
+ rtl::OUString sInstName = PN_INSTANCE_ID;
+ rtl::OUString sInstURL = PN_INSTANCE_URL;
+ const PropertyValue* pProps = _xPropSeq.getConstArray();
+ const PropertyValue* pPropsEnd = pProps + _xPropSeq.getLength();
+ for ( ; pProps != pPropsEnd; ++pProps )
+ {
+ if ( sInstModel.compareTo( pProps->Name ) == 0 )
+ {
+ Reference< css::xml::dom::XNode > xRoot;
+ if ( pProps->Value >>= xRoot )
+ {
+ try
+ {
+ Reference< XEventTarget > xTarget( xRoot, UNO_QUERY );
+ if ( xTarget.is() )
+ m_pNaviWin->AddEventBroadcaster( xTarget );
+
+ #if OSL_DEBUG_LEVEL > 0
+ css::xml::dom::NodeType eNodeType = xRoot->getNodeType(); (void)eNodeType;
+ #endif
+ ::rtl::OUString sNodeName =
+ m_xUIHelper->getNodeDisplayName( xRoot, m_pNaviWin->IsShowDetails() );
+ if ( sNodeName.getLength() == 0 )
+ sNodeName = xRoot->getNodeName();
+ if ( xRoot->hasChildNodes() )
+ AddChildren( NULL, _rImgLst, xRoot );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "XFormsPage::LoadInstance(): exception caught" );
+ }
+ }
+ }
+ else if ( sInstName.compareTo( pProps->Name ) == 0 && ( pProps->Value >>= sTemp ) )
+ m_sInstanceName = sRet = sTemp;
+ else if ( sInstURL.compareTo( pProps->Name ) == 0 && ( pProps->Value >>= sTemp ) )
+ m_sInstanceURL = sTemp;
+ }
+
+ return sRet;
+ }
+
+ //------------------------------------------------------------------------
+ bool XFormsPage::DoMenuAction( sal_uInt16 _nMenuID )
+ {
+ return DoToolBoxAction( _nMenuID );
+ }
+
+ //------------------------------------------------------------------------
+ void XFormsPage::EnableMenuItems( Menu* _pMenu )
+ {
+ sal_Bool bEnableAdd = sal_False;
+ sal_Bool bEnableEdit = sal_False;
+ sal_Bool bEnableRemove = sal_False;
+
+ SvLBoxEntry* pEntry = m_aItemList.FirstSelected();
+ if ( pEntry )
+ {
+ bEnableAdd = sal_True;
+ bool bSubmitChild = false;
+ if ( DGTSubmission == m_eGroup && m_aItemList.GetParent( pEntry ) )
+ {
+ pEntry = m_aItemList.GetParent( pEntry );
+ bSubmitChild = true;
+ }
+ ItemNode* pNode = static_cast< ItemNode* >( pEntry->GetUserData() );
+ if ( pNode && ( pNode->m_xNode.is() || pNode->m_xPropSet.is() ) )
+ {
+ bEnableEdit = sal_True;
+ bEnableRemove = ( bSubmitChild != true );
+ if ( DGTInstance == m_eGroup && !m_aItemList.GetParent( pEntry ) )
+ bEnableRemove = sal_False;
+ if ( pNode->m_xNode.is() )
+ {
+ try
+ {
+ css::xml::dom::NodeType eChildType = pNode->m_xNode->getNodeType();
+ if ( eChildType != css::xml::dom::NodeType_ELEMENT_NODE
+ && eChildType != css::xml::dom::NodeType_DOCUMENT_NODE )
+ {
+ bEnableAdd = sal_False;
+ }
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "XFormsPage::EnableMenuItems(): exception caught" );
+ }
+ }
+ }
+ }
+ else if ( m_eGroup != DGTInstance )
+ bEnableAdd = sal_True;
+
+ m_aToolBox.EnableItem( TBI_ITEM_ADD, bEnableAdd );
+ m_aToolBox.EnableItem( TBI_ITEM_ADD_ELEMENT, bEnableAdd );
+ m_aToolBox.EnableItem( TBI_ITEM_ADD_ATTRIBUTE, bEnableAdd );
+ m_aToolBox.EnableItem( TBI_ITEM_EDIT, bEnableEdit );
+ m_aToolBox.EnableItem( TBI_ITEM_REMOVE, bEnableRemove );
+
+ if ( _pMenu )
+ {
+ _pMenu->EnableItem( TBI_ITEM_ADD, bEnableAdd );
+ _pMenu->EnableItem( TBI_ITEM_ADD_ELEMENT, bEnableAdd );
+ _pMenu->EnableItem( TBI_ITEM_ADD_ATTRIBUTE, bEnableAdd );
+ _pMenu->EnableItem( TBI_ITEM_EDIT, bEnableEdit );
+ _pMenu->EnableItem( TBI_ITEM_REMOVE, bEnableRemove );
+ }
+ if ( DGTInstance == m_eGroup )
+ {
+ sal_uInt16 nResId1 = RID_STR_DATANAV_EDIT_ELEMENT;
+ sal_uInt16 nResId2 = RID_STR_DATANAV_REMOVE_ELEMENT;
+ if ( pEntry )
+ {
+ ItemNode* pNode = static_cast< ItemNode* >( pEntry->GetUserData() );
+ if ( pNode && pNode->m_xNode.is() )
+ {
+ try
+ {
+ css::xml::dom::NodeType eChildType = pNode->m_xNode->getNodeType();
+ if ( eChildType == css::xml::dom::NodeType_ATTRIBUTE_NODE )
+ {
+ nResId1 = RID_STR_DATANAV_EDIT_ATTRIBUTE;
+ nResId2 = RID_STR_DATANAV_REMOVE_ATTRIBUTE;
+ }
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "XFormsPage::EnableMenuItems(): exception caught" );
+ }
+ }
+ }
+ m_aToolBox.SetItemText( TBI_ITEM_EDIT, SVX_RESSTR( nResId1 ) );
+ m_aToolBox.SetItemText( TBI_ITEM_REMOVE, SVX_RESSTR( nResId2 ) );
+ if ( _pMenu )
+ {
+ _pMenu->SetItemText( TBI_ITEM_EDIT, SVX_RESSTR( nResId1 ) );
+ _pMenu->SetItemText( TBI_ITEM_REMOVE, SVX_RESSTR( nResId2 ) );
+ }
+ }
+ }
+
+
+ //========================================================================
+ // class DataNavigatorWindow
+ //========================================================================
+ DataNavigatorWindow::DataNavigatorWindow( Window* pParent, SfxBindings* pBindings ) :
+
+ Window( pParent, SVX_RES( RID_SVXWIN_DATANAVIGATOR ) ),
+
+ m_aModelsBox ( this, SVX_RES( LB_MODELS ) ),
+ m_aModelBtn ( this, SVX_RES( MB_MODELS ) ),
+ m_aTabCtrl ( this, SVX_RES( TC_ITEMS ) ),
+ m_aInstanceBtn ( this, SVX_RES( MB_INSTANCES ) ),
+
+ m_pInstPage ( NULL ),
+ m_pSubmissionPage ( NULL ),
+ m_pBindingPage ( NULL ),
+
+ m_nMinWidth ( 0 ),
+ m_nMinHeight ( 0 ),
+ m_nBorderHeight ( 0 ),
+ m_nLastSelectedPos ( LISTBOX_ENTRY_NOTFOUND ),
+ m_bShowDetails ( false ),
+ m_bIsNotifyDisabled ( false ),
+
+ m_aItemImageList ( SVX_RES( IL_ITEM_BMPS ) ),
+ m_aItemHCImageList ( SVX_RES( IL_ITEM_BMPS_HC ) ),
+ m_xDataListener ( new DataListener( this ) )
+
+ {
+ FreeResource();
+
+ // init minimal metric
+ m_a2Size = LogicToPixel( Size( 2, 2 ), MAP_APPFONT );
+ m_a3Size = LogicToPixel( Size( 3, 3 ), MAP_APPFONT );
+ Size aOutSz = GetOutputSizePixel();
+ Size aLogSize = PixelToLogic( aOutSz, MAP_APPFONT );
+ m_nMinWidth = aLogSize.Width();
+ m_nMinHeight = aLogSize.Height();
+ m_nBorderHeight = 4*m_a3Size.Height() +
+ m_aModelBtn.GetSizePixel().Height() + m_aInstanceBtn.GetSizePixel().Height();
+
+ // handler
+ m_aModelsBox.SetSelectHdl( LINK( this, DataNavigatorWindow, ModelSelectHdl ) );
+ Link aLink = LINK( this, DataNavigatorWindow, MenuSelectHdl );
+ m_aModelBtn.SetSelectHdl( aLink );
+ m_aInstanceBtn.SetSelectHdl( aLink );
+ aLink = LINK( this, DataNavigatorWindow, MenuActivateHdl );
+ m_aModelBtn.SetActivateHdl( aLink );
+ m_aInstanceBtn.SetActivateHdl( aLink );
+ m_aTabCtrl.SetActivatePageHdl( LINK( this, DataNavigatorWindow, ActivatePageHdl ) );
+ m_aUpdateTimer.SetTimeout( 2000 );
+ m_aUpdateTimer.SetTimeoutHdl( LINK( this, DataNavigatorWindow, UpdateHdl ) );
+
+ // init tabcontrol
+ m_aTabCtrl.Show();
+ sal_Int32 nPageId = TID_INSTANCE;
+ SvtViewOptions aViewOpt( E_TABDIALOG, CFGNAME_DATANAVIGATOR );
+ if ( aViewOpt.Exists() )
+ {
+ nPageId = aViewOpt.GetPageID();
+ aViewOpt.GetUserItem(CFGNAME_SHOWDETAILS) >>= m_bShowDetails;
+ }
+
+ Menu* pMenu = m_aInstanceBtn.GetPopupMenu();
+ pMenu->SetItemBits( MID_SHOW_DETAILS, MIB_CHECKABLE );
+ pMenu->CheckItem( MID_SHOW_DETAILS, m_bShowDetails );
+
+ m_aTabCtrl.SetCurPageId( static_cast< sal_uInt16 >( nPageId ) );
+ ActivatePageHdl( &m_aTabCtrl );
+
+ // get our frame
+ DBG_ASSERT( pBindings != NULL,
+ "DataNavigatorWindow::LoadModels(): no SfxBindings; can't get frame" );
+ m_xFrame = Reference<XFrame>(
+ pBindings->GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface(),
+ UNO_QUERY );
+ DBG_ASSERT( m_xFrame.is(), "DataNavigatorWindow::LoadModels(): no frame" );
+ // add frameaction listener
+ Reference< XFrameActionListener > xListener(
+ static_cast< XFrameActionListener* >( m_xDataListener.get() ), UNO_QUERY );
+ m_xFrame->addFrameActionListener( xListener );
+
+ // load xforms models of the current document
+ LoadModels();
+ }
+ //------------------------------------------------------------------------
+ DataNavigatorWindow::~DataNavigatorWindow()
+ {
+ SvtViewOptions aViewOpt( E_TABDIALOG, CFGNAME_DATANAVIGATOR );
+ aViewOpt.SetPageID( static_cast< sal_Int32 >( m_aTabCtrl.GetCurPageId() ) );
+ Any aAny;
+ aAny <<= m_bShowDetails;
+ aViewOpt.SetUserItem(CFGNAME_SHOWDETAILS,aAny);
+
+ delete m_pInstPage;
+ delete m_pSubmissionPage;
+ delete m_pBindingPage;
+
+ sal_Int32 i, nCount = m_aPageList.size();
+ for ( i = 0; i < nCount; ++i )
+ delete m_aPageList[i];
+ Reference< XFrameActionListener > xListener(
+ static_cast< XFrameActionListener* >( m_xDataListener.get() ), UNO_QUERY );
+ m_xFrame->removeFrameActionListener( xListener );
+ RemoveBroadcaster();
+ m_xDataListener.clear();
+ }
+
+ // -----------------------------------------------------------------------
+ IMPL_LINK( DataNavigatorWindow, ModelSelectHdl, ListBox *, pBox )
+ {
+ sal_uInt16 nPos = m_aModelsBox.GetSelectEntryPos();
+ // pBox == NULL, if you want to force a new fill.
+ if ( nPos != m_nLastSelectedPos || !pBox )
+ {
+ m_nLastSelectedPos = nPos;
+ ClearAllPageModels( pBox != NULL );
+ InitPages();
+ SetPageModel();
+ }
+
+ return 0;
+ }
+ // -----------------------------------------------------------------------
+ IMPL_LINK( DataNavigatorWindow, MenuSelectHdl, MenuButton *, pBtn )
+ {
+ bool bIsDocModified = false;
+ Reference< css::xforms::XFormsUIHelper1 > xUIHelper;
+ sal_uInt16 nSelectedPos = m_aModelsBox.GetSelectEntryPos();
+ ::rtl::OUString sSelectedModel( m_aModelsBox.GetEntry( nSelectedPos ) );
+ Reference< css::xforms::XModel > xModel;
+ try
+ {
+ Any aAny = m_xDataContainer->getByName( sSelectedModel );
+ if ( aAny >>= xModel )
+ xUIHelper = Reference< css::xforms::XFormsUIHelper1 >( xModel, UNO_QUERY );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "DataNavigatorWindow::MenuSelectHdl(): exception caught" );
+ }
+ DBG_ASSERT( xUIHelper.is(), "DataNavigatorWindow::MenuSelectHdl(): no UIHelper" );
+
+ m_bIsNotifyDisabled = true;
+
+ if ( &m_aModelBtn == pBtn )
+ {
+ switch ( pBtn->GetCurItemId() )
+ {
+ case MID_MODELS_ADD :
+ {
+ AddModelDialog aDlg( this, false );
+ bool bShowDialog = true;
+ while ( bShowDialog )
+ {
+ bShowDialog = false;
+ if ( aDlg.Execute() == RET_OK )
+ {
+ String sNewName = aDlg.GetName();
+ sal_Bool bDocumentData = aDlg.GetModifyDoc();
+
+ if ( m_aModelsBox.GetEntryPos( sNewName ) != LISTBOX_ENTRY_NOTFOUND )
+ {
+ // error: model name already exists
+ ErrorBox aErrBox( this, SVX_RES( RID_ERR_DOUBLE_MODELNAME ) );
+ String sMessText = aErrBox.GetMessText();
+ sMessText.SearchAndReplace( MSG_VARIABLE, sNewName );
+ aErrBox.SetMessText( sMessText );
+ aErrBox.Execute();
+ bShowDialog = true;
+ }
+ else
+ {
+ try
+ {
+ // add new model to frame model
+ Reference< css::xforms::XModel > xNewModel(
+ xUIHelper->newModel( m_xFrameModel, sNewName ), UNO_SET_THROW );
+
+ Reference< XPropertySet > xModelProps( xNewModel, UNO_QUERY_THROW );
+ xModelProps->setPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ExternalData" ) ),
+ makeAny( sal_Bool( !bDocumentData ) ) );
+
+ sal_uInt16 nNewPos = m_aModelsBox.InsertEntry( sNewName );
+ m_aModelsBox.SelectEntryPos( nNewPos );
+ ModelSelectHdl( &m_aModelsBox );
+ bIsDocModified = true;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "DataNavigatorWindow::MenuSelectHdl(): exception caught" );
+ }
+ }
+ }
+ }
+ break;
+ }
+ case MID_MODELS_EDIT :
+ {
+ AddModelDialog aDlg( this, true );
+ aDlg.SetName( sSelectedModel );
+
+ bool bDocumentData( false );
+ try
+ {
+ Reference< css::xforms::XFormsSupplier > xFormsSupp( m_xFrameModel, UNO_QUERY_THROW );
+ Reference< XNameContainer > xXForms( xFormsSupp->getXForms(), UNO_SET_THROW );
+ Reference< XPropertySet > xModelProps( xXForms->getByName( sSelectedModel ), UNO_QUERY_THROW );
+ sal_Bool bExternalData = sal_False;
+ OSL_VERIFY( xModelProps->getPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ExternalData" ) ) ) >>= bExternalData );
+ bDocumentData = ( bExternalData == sal_False );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ aDlg.SetModifyDoc( bDocumentData );
+
+ if ( aDlg.Execute() == RET_OK )
+ {
+ if ( aDlg.GetModifyDoc() != bool( bDocumentData ) )
+ {
+ bDocumentData = aDlg.GetModifyDoc();
+ try
+ {
+ Reference< css::xforms::XFormsSupplier > xFormsSupp( m_xFrameModel, UNO_QUERY_THROW );
+ Reference< XNameContainer > xXForms( xFormsSupp->getXForms(), UNO_SET_THROW );
+ Reference< XPropertySet > xModelProps( xXForms->getByName( sSelectedModel ), UNO_QUERY_THROW );
+ xModelProps->setPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ExternalData" ) ),
+ makeAny( sal_Bool( !bDocumentData ) ) );
+ bIsDocModified = true;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ String sNewName = aDlg.GetName();
+ if ( sNewName.Len() > 0 && ( sNewName != String( sSelectedModel ) ) )
+ {
+ try
+ {
+ xUIHelper->renameModel( m_xFrameModel, sSelectedModel, sNewName );
+
+ m_aModelsBox.RemoveEntry( nSelectedPos );
+ nSelectedPos = m_aModelsBox.InsertEntry( sNewName );
+ m_aModelsBox.SelectEntryPos( nSelectedPos );
+ bIsDocModified = true;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "DataNavigatorWindow::MenuSelectHdl(): exception caught" );
+ }
+ }
+ }
+ break;
+ }
+ case MID_MODELS_REMOVE :
+ {
+ QueryBox aQBox( this, SVX_RES( RID_QRY_REMOVE_MODEL ) );
+ String sText = aQBox.GetMessText();
+ sText.SearchAndReplace( MODELNAME, sSelectedModel );
+ aQBox.SetMessText( sText );
+ if ( aQBox.Execute() == RET_YES )
+ {
+ try
+ {
+ xUIHelper->removeModel( m_xFrameModel, sSelectedModel );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "DataNavigatorWindow::MenuSelectHdl(): exception caught" );
+ }
+ m_aModelsBox.RemoveEntry( nSelectedPos );
+ if ( m_aModelsBox.GetEntryCount() <= nSelectedPos )
+ nSelectedPos = m_aModelsBox.GetEntryCount() - 1;
+ m_aModelsBox.SelectEntryPos( nSelectedPos );
+ ModelSelectHdl( &m_aModelsBox );
+ bIsDocModified = true;
+ }
+ break;
+ }
+ default:
+ {
+ DBG_ERRORFILE( "DataNavigatorWindow::MenuSelectHdl(): wrong menu item" );
+ }
+ }
+ }
+ else if ( &m_aInstanceBtn == pBtn )
+ {
+ switch ( pBtn->GetCurItemId() )
+ {
+ case MID_INSTANCES_ADD :
+ {
+ AddInstanceDialog aDlg( this, false );
+ if ( aDlg.Execute() == RET_OK )
+ {
+ sal_uInt16 nInst = GetNewPageId();
+ ::rtl::OUString sName = aDlg.GetName();
+ ::rtl::OUString sURL = aDlg.GetURL();
+ bool bLinkOnce = aDlg.IsLinkInstance();
+ try
+ {
+ Reference< css::xml::dom::XDocument > xNewInst =
+ xUIHelper->newInstance( sName, sURL, !bLinkOnce );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "DataNavigatorWindow::MenuSelectHdl(): exception caught" );
+ }
+ ModelSelectHdl( NULL );
+ m_aTabCtrl.SetCurPageId( nInst );
+ XFormsPage* pPage = GetCurrentPage( nInst );
+ pPage->SetInstanceName(sName);
+ pPage->SetInstanceURL(sURL);
+ pPage->SetLinkOnce(bLinkOnce);
+ ActivatePageHdl( &m_aTabCtrl );
+ bIsDocModified = true;
+ }
+ break;
+ }
+ case MID_INSTANCES_EDIT :
+ {
+ sal_uInt16 nId = 0;
+ XFormsPage* pPage = GetCurrentPage( nId );
+ if ( pPage )
+ {
+ AddInstanceDialog aDlg( this, true );
+ aDlg.SetName( pPage->GetInstanceName() );
+ aDlg.SetURL( pPage->GetInstanceURL() );
+ aDlg.SetLinkInstance( pPage->GetLinkOnce() );
+ String sOldName = aDlg.GetName();
+ if ( aDlg.Execute() == RET_OK )
+ {
+ String sNewName = aDlg.GetName();
+ ::rtl::OUString sURL = aDlg.GetURL();
+ bool bLinkOnce = aDlg.IsLinkInstance();
+ try
+ {
+ xUIHelper->renameInstance( sOldName,
+ sNewName,
+ sURL,
+ !bLinkOnce );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "DataNavigatorWindow::MenuSelectHdl(): exception caught" );
+ }
+ pPage->SetInstanceName(sNewName);
+ pPage->SetInstanceURL(sURL);
+ pPage->SetLinkOnce(bLinkOnce);
+ m_aTabCtrl.SetPageText( nId, sNewName );
+ bIsDocModified = true;
+ }
+ }
+ break;
+ }
+ case MID_INSTANCES_REMOVE :
+ {
+ sal_uInt16 nId = 0;
+ XFormsPage* pPage = GetCurrentPage( nId );
+ if ( pPage )
+ {
+ String sInstName = pPage->GetInstanceName();
+ QueryBox aQBox( this, SVX_RES( RID_QRY_REMOVE_INSTANCE ) );
+ String sMessText = aQBox.GetMessText();
+ sMessText.SearchAndReplace( INSTANCENAME, sInstName );
+ aQBox.SetMessText( sMessText );
+ if ( aQBox.Execute() == RET_YES )
+ {
+ bool bDoRemove = false;
+ if ( nId > TID_INSTANCE )
+ {
+ PageList::iterator aPageListEnd = m_aPageList.end();
+ PageList::iterator aFoundPage =
+ std::find( m_aPageList.begin(), aPageListEnd, pPage );
+ if ( aFoundPage != aPageListEnd )
+ {
+ m_aPageList.erase( aFoundPage );
+ delete pPage;
+ bDoRemove = true;
+ }
+ }
+ else
+ {
+ DELETEZ( m_pInstPage );
+ bDoRemove = true;
+ }
+
+ if ( bDoRemove )
+ {
+ try
+ {
+ xUIHelper->removeInstance( sInstName );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "DataNavigatorWindow::MenuSelectHdl(): exception caught" );
+ }
+ m_aTabCtrl.RemovePage( nId );
+ m_aTabCtrl.SetCurPageId( TID_INSTANCE );
+ ModelSelectHdl( NULL );
+ bIsDocModified = true;
+ }
+ }
+ }
+ break;
+ }
+ case MID_SHOW_DETAILS :
+ {
+ m_bShowDetails = !m_bShowDetails;
+ m_aInstanceBtn.GetPopupMenu()->CheckItem( MID_SHOW_DETAILS, m_bShowDetails );
+ ModelSelectHdl( &m_aModelsBox );
+ break;
+ }
+ default:
+ {
+ DBG_ERRORFILE( "DataNavigatorWindow::MenuSelectHdl(): wrong menu item" );
+ }
+ }
+ }
+ else
+ {
+ DBG_ERRORFILE( "DataNavigatorWindow::MenuSelectHdl(): wrong button" );
+ }
+
+ m_bIsNotifyDisabled = false;
+
+ if ( bIsDocModified )
+ SetDocModified();
+ return 0;
+ }
+ // -----------------------------------------------------------------------
+ IMPL_LINK( DataNavigatorWindow, MenuActivateHdl, MenuButton *, pBtn )
+ {
+ Menu* pMenu = pBtn->GetPopupMenu();
+
+ if ( &m_aInstanceBtn == pBtn )
+ {
+ bool bIsInstPage = ( m_aTabCtrl.GetCurPageId() >= TID_INSTANCE );
+ pMenu->EnableItem( MID_INSTANCES_EDIT, bIsInstPage );
+ pMenu->EnableItem( MID_INSTANCES_REMOVE,
+ bIsInstPage && m_aTabCtrl.GetPageCount() > MIN_PAGE_COUNT );
+ pMenu->EnableItem( MID_SHOW_DETAILS, bIsInstPage );
+ }
+ else if ( &m_aModelBtn == pBtn )
+ {
+ // we need at least one model!
+ pMenu->EnableItem( MID_MODELS_REMOVE, m_aModelsBox.GetEntryCount() > 1 );
+ }
+ else
+ {
+ DBG_ERRORFILE( "DataNavigatorWindow::MenuActivateHdl(): wrong button" );
+ }
+ return 0;
+ }
+ // -----------------------------------------------------------------------
+ IMPL_LINK( DataNavigatorWindow, ActivatePageHdl, TabControl *, EMPTYARG )
+ {
+ sal_uInt16 nId = 0;
+ XFormsPage* pPage = GetCurrentPage( nId );
+ if ( pPage )
+ {
+ m_aTabCtrl.SetTabPage( nId, pPage );
+ if ( m_xDataContainer.is() && !pPage->HasModel() )
+ SetPageModel();
+ }
+
+ return 0;
+ }
+ // -----------------------------------------------------------------------
+ IMPL_LINK( DataNavigatorWindow, UpdateHdl, Timer *, EMPTYARG )
+ {
+ ModelSelectHdl( NULL );
+ return 0;
+ }
+ // -----------------------------------------------------------------------
+ XFormsPage* DataNavigatorWindow::GetCurrentPage( sal_uInt16& rCurId )
+ {
+ rCurId = m_aTabCtrl.GetCurPageId();
+ XFormsPage* pPage = NULL;
+ switch ( rCurId )
+ {
+ case TID_SUBMISSION:
+ {
+ if ( !m_pSubmissionPage )
+ m_pSubmissionPage = new XFormsPage( &m_aTabCtrl, this, DGTSubmission );
+ pPage = m_pSubmissionPage;
+ break;
+ }
+
+ case TID_BINDINGS:
+ {
+ if ( !m_pBindingPage )
+ m_pBindingPage = new XFormsPage( &m_aTabCtrl, this, DGTBinding );
+ pPage = m_pBindingPage;
+ break;
+ }
+
+ case TID_INSTANCE:
+ {
+ if ( !m_pInstPage )
+ m_pInstPage = new XFormsPage( &m_aTabCtrl, this, DGTInstance );
+ pPage = m_pInstPage;
+ break;
+ }
+ }
+
+ if ( rCurId > TID_INSTANCE )
+ {
+ sal_uInt16 nPos = m_aTabCtrl.GetPagePos( rCurId );
+ if ( HasFirstInstancePage() && nPos > 0 )
+ nPos--;
+ if ( m_aPageList.size() > nPos )
+ pPage = m_aPageList[nPos];
+ else
+ {
+ pPage = new XFormsPage( &m_aTabCtrl, this, DGTInstance );
+ m_aPageList.push_back( pPage );
+ }
+ }
+
+ return pPage;
+ }
+ // -----------------------------------------------------------------------
+ void DataNavigatorWindow::LoadModels()
+ {
+ if ( !m_xFrameModel.is() )
+ {
+ // get model of active frame
+ Reference< XController > xCtrl = m_xFrame->getController();
+ if ( xCtrl.is() )
+ {
+ try
+ {
+ m_xFrameModel = xCtrl->getModel();
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "DataNavigatorWindow::LoadModels(): exception caught" );
+ }
+ }
+ }
+
+ if ( m_xFrameModel.is() )
+ {
+ try
+ {
+ ::rtl::OUString sURL = m_xFrameModel->getURL();
+ Reference< css::xforms::XFormsSupplier > xFormsSupp( m_xFrameModel, UNO_QUERY );
+ if ( xFormsSupp.is() )
+ {
+ Reference< XNameContainer > xContainer = xFormsSupp->getXForms();
+ if ( xContainer.is() )
+ {
+ m_xDataContainer = xContainer;
+ Sequence< ::rtl::OUString > aNameList = m_xDataContainer->getElementNames();
+ sal_Int32 i, nCount = aNameList.getLength();
+ ::rtl::OUString* pNames = aNameList.getArray();
+ for ( i = 0; i < nCount; ++i )
+ {
+ Any aAny = m_xDataContainer->getByName( pNames[i] );
+ Reference< css::xforms::XModel > xFormsModel;
+ if ( aAny >>= xFormsModel )
+ m_aModelsBox.InsertEntry( xFormsModel->getID() );
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERRORFILE( "DataNavigatorWindow::LoadModels(): exception caught" );
+ }
+ }
+
+ if ( m_aModelsBox.GetEntryCount() > 0 )
+ {
+ m_aModelsBox.SelectEntryPos(0);
+ ModelSelectHdl( &m_aModelsBox );
+ }
+ }
+ // -----------------------------------------------------------------------
+ void DataNavigatorWindow::SetPageModel()
+ {
+ rtl::OUString sModel( m_aModelsBox.GetSelectEntry() );
+ try
+ {
+ Any aAny = m_xDataContainer->getByName( sModel );
+ Reference< css::xforms::XModel > xFormsModel;
+ if ( aAny >>= xFormsModel )
+ {
+ sal_uInt16 nPagePos = TAB_PAGE_NOTFOUND;
+ sal_uInt16 nId = 0;
+ XFormsPage* pPage = GetCurrentPage( nId );
+ DBG_ASSERT( pPage, "DataNavigatorWindow::SetPageModel(): no page" );
+ if ( nId >= TID_INSTANCE )
+ // instance page
+ nPagePos = m_aTabCtrl.GetPagePos( nId );
+ m_bIsNotifyDisabled = true;
+ String sText = pPage->SetModel( xFormsModel, nPagePos );
+ m_bIsNotifyDisabled = false;
+ if ( sText.Len() > 0 )
+ m_aTabCtrl.SetPageText( nId, sText );
+ }
+ }
+ catch ( NoSuchElementException& )
+ {
+ DBG_ERRORFILE( "DataNavigatorWindow::SetPageModel(): no such element" );
+ }
+ catch( Exception& )
+ {
+ DBG_ERRORFILE( "DataNavigatorWindow::SetPageModel(): unexpected exception" );
+ }
+ }
+ // -----------------------------------------------------------------------
+ void DataNavigatorWindow::InitPages()
+ {
+ rtl::OUString sModel( m_aModelsBox.GetSelectEntry() );
+ try
+ {
+ Any aAny = m_xDataContainer->getByName( sModel );
+ Reference< css::xforms::XModel > xModel;
+ if ( aAny >>= xModel )
+ {
+ Reference< XEnumerationAccess > xNumAccess( xModel->getInstances(), UNO_QUERY );
+ if ( xNumAccess.is() )
+ {
+ Reference < XEnumeration > xNum = xNumAccess->createEnumeration();
+ if ( xNum.is() && xNum->hasMoreElements() )
+ {
+ sal_Int32 nAlreadyLoadedCount = m_aPageList.size();
+ if ( !HasFirstInstancePage() && nAlreadyLoadedCount > 0 )
+ nAlreadyLoadedCount--;
+ sal_Int32 nIdx = 0;
+ while ( xNum->hasMoreElements() )
+ {
+ if ( nIdx > nAlreadyLoadedCount )
+ {
+ Sequence< PropertyValue > xPropSeq;
+ if ( xNum->nextElement() >>= xPropSeq )
+ CreateInstancePage( xPropSeq );
+ else
+ {
+ DBG_ERRORFILE( "DataNavigator::InitPages(): invalid instance" );
+ }
+ }
+ else
+ xNum->nextElement();
+ nIdx++;
+ }
+ }
+ }
+ }
+ }
+ catch ( NoSuchElementException& )
+ {
+ DBG_ERRORFILE( "DataNavigatorWindow::SetPageModel(): no such element" );
+ }
+ catch( Exception& )
+ {
+ DBG_ERRORFILE( "DataNavigatorWindow::SetPageModel(): unexpected exception" );
+ }
+ }
+ // -----------------------------------------------------------------------
+ void DataNavigatorWindow::ClearAllPageModels( bool bClearPages )
+ {
+ if ( m_pInstPage )
+ m_pInstPage->ClearModel();
+ if ( m_pSubmissionPage )
+ m_pSubmissionPage->ClearModel();
+ if ( m_pBindingPage )
+ m_pBindingPage->ClearModel();
+
+ sal_Int32 i, nCount = m_aPageList.size();
+ for ( i = 0; i < nCount; ++i )
+ {
+ XFormsPage* pPage = m_aPageList[i];
+ pPage->ClearModel();
+ if ( bClearPages )
+ delete pPage;
+ }
+
+ if ( bClearPages )
+ {
+ m_aPageList.clear();
+ while ( m_aTabCtrl.GetPageCount() > MIN_PAGE_COUNT )
+ m_aTabCtrl.RemovePage( m_aTabCtrl.GetPageId( 1 ) );
+ }
+ }
+ // -----------------------------------------------------------------------
+ void DataNavigatorWindow::CreateInstancePage( const Sequence< PropertyValue >& _xPropSeq )
+ {
+ rtl::OUString sInstName;
+ rtl::OUString sID( PN_INSTANCE_ID );
+ const PropertyValue* pProps = _xPropSeq.getConstArray();
+ const PropertyValue* pPropsEnd = pProps + _xPropSeq.getLength();
+ for ( ; pProps != pPropsEnd; ++pProps )
+ {
+ if ( sID.compareTo( pProps->Name ) == 0 )
+ {
+ pProps->Value >>= sInstName;
+ break;
+ }
+ }
+
+ sal_uInt16 nPageId = GetNewPageId();
+ if ( sInstName.getLength() == 0 )
+ {
+ DBG_ERRORFILE( "DataNavigatorWindow::CreateInstancePage(): instance without name" );
+ String sTemp = String::CreateFromAscii( "untitled" );
+ sTemp += String::CreateFromInt32( nPageId );
+ sInstName = sTemp;
+ }
+ m_aTabCtrl.InsertPage( nPageId, sInstName, m_aTabCtrl.GetPageCount() - 2 );
+ }
+
+ //------------------------------------------------------------------------
+ bool DataNavigatorWindow::HasFirstInstancePage() const
+ {
+ return ( m_aTabCtrl.GetPageId( 0 ) == TID_INSTANCE );
+ }
+
+ //------------------------------------------------------------------------
+ sal_uInt16 DataNavigatorWindow::GetNewPageId() const
+ {
+ sal_uInt16 i, nMax = 0, nCount = m_aTabCtrl.GetPageCount();
+ for ( i = 0; i < nCount; ++i )
+ {
+ if ( nMax < m_aTabCtrl.GetPageId(i) )
+ nMax = m_aTabCtrl.GetPageId(i);
+ }
+ return ( nMax + 1 );
+ }
+
+ //------------------------------------------------------------------------
+ void DataNavigatorWindow::Resize()
+ {
+ Window::Resize();
+
+ Size aOutSz = GetOutputSizePixel();
+ long nWidth = Max( aOutSz.Width(), m_nMinWidth );
+ long nHeight = Max( aOutSz.Height(), m_nMinHeight );
+
+ Size aSz = m_aModelsBox.GetSizePixel();
+ aSz.Width() = nWidth - 3*m_a3Size.Width() - m_aModelBtn.GetSizePixel().Width();
+ m_aModelsBox.SetSizePixel( aSz );
+ Point aPos = m_aModelBtn.GetPosPixel();
+ aPos.X() = m_aModelsBox.GetPosPixel().X() + aSz.Width() + m_a3Size.Width();
+ m_aModelBtn.SetPosPixel( aPos );
+
+ aSz = m_aTabCtrl.GetSizePixel();
+ aSz.Width() = nWidth - 2*m_a3Size.Width();
+ aSz.Height() = nHeight - m_nBorderHeight;
+ m_aTabCtrl.SetSizePixel( aSz );
+ // Instance button positioning
+ aPos = m_aInstanceBtn.GetPosPixel();
+ // right aligned
+ aPos.X() = nWidth - m_aInstanceBtn.GetSizePixel().Width() - m_a3Size.Width();
+ // under the tabcontrol
+ aPos.Y() = m_aTabCtrl.GetPosPixel().Y() + aSz.Height() + m_a3Size.Height();
+ m_aInstanceBtn.SetPosPixel( aPos );
+ }
+
+ //------------------------------------------------------------------------
+ void DataNavigatorWindow::SetDocModified()
+ {
+ SfxObjectShell* pCurrentDoc = SfxObjectShell::Current();
+ DBG_ASSERT( pCurrentDoc, "DataNavigatorWindow::SetDocModified(): no objectshell" );
+ if ( !pCurrentDoc->IsModified() && pCurrentDoc->IsEnableSetModified() )
+ pCurrentDoc->SetModified();
+ }
+
+ //------------------------------------------------------------------------
+ void DataNavigatorWindow::NotifyChanges( bool _bLoadAll )
+ {
+ if ( !m_bIsNotifyDisabled )
+ {
+ if ( _bLoadAll )
+ {
+ // reset all members
+ RemoveBroadcaster();
+ m_xDataContainer.clear();
+ m_xFrameModel.clear();
+ m_aModelsBox.Clear();
+ m_nLastSelectedPos = LISTBOX_ENTRY_NOTFOUND;
+ // for a reload
+ LoadModels();
+ }
+ else
+ m_aUpdateTimer.Start();
+ }
+ }
+
+ //------------------------------------------------------------------------
+ void DataNavigatorWindow::AddContainerBroadcaster( const XContainer_ref& xContainer )
+ {
+ Reference< XContainerListener > xListener(
+ static_cast< XContainerListener* >( m_xDataListener.get() ), UNO_QUERY );
+ xContainer->addContainerListener( xListener );
+ m_aContainerList.push_back( xContainer );
+ }
+
+ //------------------------------------------------------------------------
+ void DataNavigatorWindow::AddEventBroadcaster( const XEventTarget_ref& xTarget )
+ {
+ Reference< XEventListener > xListener(
+ static_cast< XEventListener* >( m_xDataListener.get() ), UNO_QUERY );
+ xTarget->addEventListener( EVENTTYPE_CHARDATA, xListener, true );
+ xTarget->addEventListener( EVENTTYPE_CHARDATA, xListener, false );
+ xTarget->addEventListener( EVENTTYPE_ATTR, xListener, true );
+ xTarget->addEventListener( EVENTTYPE_ATTR, xListener, false );
+ m_aEventTargetList.push_back( xTarget );
+ }
+
+ //------------------------------------------------------------------------
+ void DataNavigatorWindow::RemoveBroadcaster()
+ {
+ Reference< XContainerListener > xContainerListener(
+ static_cast< XContainerListener* >( m_xDataListener.get() ), UNO_QUERY );
+ sal_Int32 i, nCount = m_aContainerList.size();
+ for ( i = 0; i < nCount; ++i )
+ m_aContainerList[i]->removeContainerListener( xContainerListener );
+ Reference< XEventListener > xEventListener(
+ static_cast< XEventListener* >( m_xDataListener.get() ), UNO_QUERY );
+ nCount = m_aEventTargetList.size();
+ for ( i = 0; i < nCount; ++i )
+ {
+ m_aEventTargetList[i]->removeEventListener( EVENTTYPE_CHARDATA, xEventListener, true );
+ m_aEventTargetList[i]->removeEventListener( EVENTTYPE_CHARDATA, xEventListener, false );
+ m_aEventTargetList[i]->removeEventListener( EVENTTYPE_ATTR, xEventListener, true );
+ m_aEventTargetList[i]->removeEventListener( EVENTTYPE_ATTR, xEventListener, false );
+ }
+ }
+
+ //========================================================================
+ // class DataNavigator
+ //========================================================================
+ DBG_NAME(DataNavigator)
+ //------------------------------------------------------------------------
+ DataNavigator::DataNavigator( SfxBindings* _pBindings, SfxChildWindow* _pMgr, Window* _pParent ) :
+
+ SfxDockingWindow( _pBindings, _pMgr, _pParent,
+ WinBits(WB_STDMODELESS|WB_SIZEABLE|WB_ROLLABLE|WB_3DLOOK|WB_DOCKABLE) ),
+ SfxControllerItem( SID_FM_DATANAVIGATOR_CONTROL, *_pBindings ),
+
+ m_aDataWin( this, _pBindings )
+
+ {
+ DBG_CTOR(DataNavigator,NULL);
+
+ SetHelpId( HID_DATA_NAVIGATOR_WIN );
+ SetText( SVX_RES( RID_STR_DATANAVIGATOR ) );
+
+ Size aSize = m_aDataWin.GetOutputSizePixel();
+ Size aLogSize = PixelToLogic( aSize, MAP_APPFONT );
+ SfxDockingWindow::SetFloatingSize( aLogSize );
+
+ m_aDataWin.Show();
+ }
+
+ //------------------------------------------------------------------------
+ DataNavigator::~DataNavigator()
+ {
+ DBG_DTOR(DataNavigator,NULL);
+ }
+
+ //-----------------------------------------------------------------------
+ void DataNavigator::Update( FmFormShell* /*pFormShell*/ )
+ {
+ }
+ //-----------------------------------------------------------------------
+ void DataNavigator::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+ {
+ if ( !pState || SID_FM_DATANAVIGATOR_CONTROL != nSID )
+ return;
+
+ if ( eState >= SFX_ITEM_AVAILABLE )
+ {
+ FmFormShell* pShell = PTR_CAST( FmFormShell,((SfxObjectItem*)pState)->GetShell() );
+ Update( pShell );
+ }
+ else
+ Update( NULL );
+ }
+
+ //-----------------------------------------------------------------------
+ void DataNavigator::GetFocus()
+ {
+ SfxDockingWindow::GetFocus();
+ }
+
+ //-----------------------------------------------------------------------
+ sal_Bool DataNavigator::Close()
+ {
+ Update( NULL );
+ return SfxDockingWindow::Close();
+ }
+
+ //-----------------------------------------------------------------------
+ Size DataNavigator::CalcDockingSize( SfxChildAlignment eAlign )
+ {
+ if ( ( eAlign == SFX_ALIGN_TOP ) || ( eAlign == SFX_ALIGN_BOTTOM ) )
+ return Size();
+
+ return SfxDockingWindow::CalcDockingSize( eAlign );
+ }
+
+ //-----------------------------------------------------------------------
+ SfxChildAlignment DataNavigator::CheckAlignment( SfxChildAlignment eActAlign, SfxChildAlignment eAlign )
+ {
+ switch ( eAlign )
+ {
+ case SFX_ALIGN_LEFT:
+ case SFX_ALIGN_RIGHT:
+ case SFX_ALIGN_NOALIGNMENT:
+ return eAlign;
+ default:
+ break;
+ }
+ return eActAlign;
+ }
+
+ //------------------------------------------------------------------------
+ void DataNavigator::Resize()
+ {
+ SfxDockingWindow::Resize();
+
+ Size aLogOutputSize = PixelToLogic( GetOutputSizePixel(), MAP_APPFONT );
+ Size aLogExplSize = aLogOutputSize;
+ aLogExplSize.Width() -= 2;
+ aLogExplSize.Height() -= 2;
+
+ Point aExplPos = LogicToPixel( Point(1,1), MAP_APPFONT );
+ Size aExplSize = LogicToPixel( aLogExplSize, MAP_APPFONT );
+
+ m_aDataWin.SetPosSizePixel( aExplPos, aExplSize );
+ }
+
+
+ //========================================================================
+ // class NavigatorFrameManager
+ //========================================================================
+
+ //-----------------------------------------------------------------------
+ SFX_IMPL_DOCKINGWINDOW( DataNavigatorManager, SID_FM_SHOW_DATANAVIGATOR )
+
+ //-----------------------------------------------------------------------
+ DataNavigatorManager::DataNavigatorManager(
+ Window* _pParent, sal_uInt16 _nId, SfxBindings* _pBindings, SfxChildWinInfo* _pInfo ) :
+
+ SfxChildWindow( _pParent, _nId )
+
+ {
+ pWindow = new DataNavigator( _pBindings, this, _pParent );
+ eChildAlignment = SFX_ALIGN_RIGHT;
+ pWindow->SetSizePixel( Size( 250, 400 ) );
+ ( (SfxDockingWindow*)pWindow )->Initialize( _pInfo );
+ }
+
+ //========================================================================
+ // class AddDataItemDialog
+ //========================================================================
+
+ AddDataItemDialog::AddDataItemDialog(
+ Window* pParent, ItemNode* _pNode,
+ const Reference< css::xforms::XFormsUIHelper1 >& _rUIHelper ) :
+
+ ModalDialog( pParent, SVX_RES( RID_SVXDLG_ADD_DATAITEM ) ),
+
+ m_aItemFL ( this, SVX_RES( FL_ITEM ) ),
+ m_aNameFT ( this, SVX_RES( FT_NAME ) ),
+ m_aNameED ( this, SVX_RES( ED_NAME ) ),
+ m_aDefaultFT ( this, SVX_RES( FT_DEFAULT ) ),
+ m_aDefaultED ( this, SVX_RES( ED_DEFAULT ) ),
+ m_aDefaultBtn ( this, SVX_RES( PB_DEFAULT ) ),
+ m_aSettingsFL ( this, SVX_RES( FL_SETTINGS ) ),
+ m_aDataTypeFT ( this, SVX_RES( FT_DATATYPE ) ),
+ m_aDataTypeLB ( this, SVX_RES( LB_DATATYPE ) ),
+ m_aRequiredCB ( this, SVX_RES( CB_REQUIRED ) ),
+ m_aRequiredBtn ( this, SVX_RES( PB_REQUIRED ) ),
+ m_aRelevantCB ( this, SVX_RES( CB_RELEVANT ) ),
+ m_aRelevantBtn ( this, SVX_RES( PB_RELEVANT ) ),
+ m_aConstraintCB ( this, SVX_RES( CB_CONSTRAINT ) ),
+ m_aConstraintBtn( this, SVX_RES( PB_CONSTRAINT ) ),
+ m_aReadonlyCB ( this, SVX_RES( CB_READONLY ) ),
+ m_aReadonlyBtn ( this, SVX_RES( PB_READONLY ) ),
+ m_aCalculateCB ( this, SVX_RES( CB_CALCULATE ) ),
+ m_aCalculateBtn ( this, SVX_RES( PB_CALCULATE ) ),
+ m_aButtonsFL ( this, SVX_RES( FL_DATANAV_BTN ) ),
+ m_aOKBtn ( this, SVX_RES( BTN_DATANAV_OK ) ),
+ m_aEscBtn ( this, SVX_RES( BTN_DATANAV_ESC ) ),
+ m_aHelpBtn ( this, SVX_RES( BTN_DATANAV_HELP ) ),
+
+ m_xUIHelper ( _rUIHelper ),
+ m_pItemNode ( _pNode ),
+ m_eItemType ( DITNone ),
+ m_sFL_Element ( SVX_RES( STR_FIXEDLINE_ELEMENT ) ),
+ m_sFL_Attribute ( SVX_RES( STR_FIXEDLINE_ATTRIBUTE ) ),
+ m_sFL_Binding ( SVX_RES( STR_FIXEDLINE_BINDING ) ),
+ m_sFT_BindingExp( SVX_RES( STR_FIXEDTEXT_BINDING ) )
+
+ {
+ FreeResource();
+ m_aDataTypeLB.SetDropDownLineCount( 10 );
+
+ InitDialog();
+ InitFromNode();
+ InitDataTypeBox();
+ CheckHdl( NULL );
+ }
+
+ //------------------------------------------------------------------------
+ AddDataItemDialog::~AddDataItemDialog()
+ {
+ if ( m_xTempBinding.is() )
+ {
+ Reference< css::xforms::XModel > xModel( m_xUIHelper, UNO_QUERY );
+ if ( xModel.is() )
+ {
+ try
+ {
+ Reference < XSet > xBindings = xModel->getBindings();
+ if ( xBindings.is() )
+ xBindings->remove( makeAny( m_xTempBinding ) );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "AddDataItemDialog::Dtor(): exception caught" );
+ }
+ }
+ }
+ if( m_xUIHelper.is() && m_xBinding.is() )
+ {
+ // remove binding, if it does not convey 'useful' information
+ m_xUIHelper->removeBindingIfUseless( m_xBinding );
+ }
+ }
+
+ //------------------------------------------------------------------------
+ IMPL_LINK( AddDataItemDialog, CheckHdl, CheckBox *, pBox )
+ {
+ // Condition buttons are only enable if their check box is checked
+ m_aReadonlyBtn.Enable( m_aReadonlyCB.IsChecked() );
+ m_aRequiredBtn.Enable( m_aRequiredCB.IsChecked() );
+ m_aRelevantBtn.Enable( m_aRelevantCB.IsChecked() );
+ m_aConstraintBtn.Enable( m_aConstraintCB.IsChecked() );
+ m_aCalculateBtn.Enable( m_aCalculateCB.IsChecked() );
+
+ if ( pBox && m_xTempBinding.is() )
+ {
+ ::rtl::OUString sTemp, sPropName;
+ if ( &m_aRequiredCB == pBox )
+ sPropName = PN_REQUIRED_EXPR;
+ else if ( &m_aRelevantCB == pBox )
+ sPropName = PN_RELEVANT_EXPR;
+ else if ( &m_aConstraintCB == pBox )
+ sPropName = PN_CONSTRAINT_EXPR;
+ else if ( &m_aReadonlyCB == pBox )
+ sPropName = PN_READONLY_EXPR;
+ else if ( &m_aCalculateCB == pBox )
+ sPropName = PN_CALCULATE_EXPR;
+ bool bIsChecked = ( pBox->IsChecked() != sal_False );
+ m_xTempBinding->getPropertyValue( sPropName ) >>= sTemp;
+ if ( bIsChecked && sTemp.getLength() == 0 )
+ sTemp = TRUE_VALUE;
+ else if ( !bIsChecked && sTemp.getLength() > 0 )
+ sTemp = ::rtl::OUString();
+ m_xTempBinding->setPropertyValue( sPropName, makeAny( sTemp ) );
+ }
+
+ return 0;
+ }
+
+ //------------------------------------------------------------------------
+ IMPL_LINK( AddDataItemDialog, ConditionHdl, PushButton *, pBtn )
+ {
+ ::rtl::OUString sTemp, sPropName;
+ if ( &m_aDefaultBtn == pBtn )
+ sPropName = PN_BINDING_EXPR;
+ else if ( &m_aRequiredBtn == pBtn )
+ sPropName = PN_REQUIRED_EXPR;
+ else if ( &m_aRelevantBtn == pBtn )
+ sPropName = PN_RELEVANT_EXPR;
+ else if ( &m_aConstraintBtn == pBtn )
+ sPropName = PN_CONSTRAINT_EXPR;
+ else if ( &m_aReadonlyBtn == pBtn )
+ sPropName = PN_READONLY_EXPR;
+ else if ( &m_aCalculateBtn == pBtn )
+ sPropName = PN_CALCULATE_EXPR;
+ AddConditionDialog aDlg( this, sPropName, m_xTempBinding );
+ bool bIsDefBtn = ( &m_aDefaultBtn == pBtn );
+ String sCondition;
+ if ( bIsDefBtn )
+ sCondition = m_aDefaultED.GetText();
+ else
+ {
+ m_xTempBinding->getPropertyValue( sPropName ) >>= sTemp;
+ if ( sTemp.getLength() == 0 )
+ sTemp = TRUE_VALUE;
+ sCondition = sTemp;
+ }
+ aDlg.SetCondition( sCondition );
+
+ if ( aDlg.Execute() == RET_OK )
+ {
+ String sNewCondition = aDlg.GetCondition();
+ if ( bIsDefBtn )
+ m_aDefaultED.SetText( sNewCondition );
+ else
+ {
+
+ m_xTempBinding->setPropertyValue(
+ sPropName, makeAny( ::rtl::OUString( sNewCondition ) ) );
+ }
+ }
+ return 0;
+ }
+
+ void copyPropSet( const Reference< XPropertySet >& xFrom, Reference< XPropertySet >& xTo )
+ {
+ DBG_ASSERT( xFrom.is(), "copyPropSet(): no source" );
+ DBG_ASSERT( xTo.is(), "copyPropSet(): no target" );
+
+ try
+ {
+ // get property names & infos, and iterate over target properties
+ Sequence< Property > aProperties = xTo->getPropertySetInfo()->getProperties();
+ sal_Int32 nProperties = aProperties.getLength();
+ const Property* pProperties = aProperties.getConstArray();
+ Reference< XPropertySetInfo > xFromInfo = xFrom->getPropertySetInfo();
+ for ( sal_Int32 i = 0; i < nProperties; ++i )
+ {
+ const ::rtl::OUString& rName = pProperties[i].Name;
+
+ // if both set have the property, copy the value
+ // (catch and ignore exceptions, if any)
+ if ( xFromInfo->hasPropertyByName( rName ) )
+ {
+ // don't set readonly properties
+ Property aProperty = xFromInfo->getPropertyByName( rName );
+ if ( ( aProperty.Attributes & PropertyAttribute::READONLY ) == 0 )
+ xTo->setPropertyValue(rName, xFrom->getPropertyValue( rName ));
+ }
+ // else: no property? then ignore.
+ }
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "copyPropSet(): exception caught" );
+ }
+ }
+
+ //------------------------------------------------------------------------
+ IMPL_LINK( AddDataItemDialog, OKHdl, OKButton *, EMPTYARG )
+ {
+ bool bIsHandleBinding = ( DITBinding == m_eItemType );
+ bool bIsHandleText = ( DITText == m_eItemType );
+ ::rtl::OUString sNewName( m_aNameED.GetText() );
+
+ if ( ( !bIsHandleBinding && !bIsHandleText && !m_xUIHelper->isValidXMLName( sNewName ) ) ||
+ ( bIsHandleBinding && sNewName.getLength() == 0 ) )
+ {
+ // Error and don't close the dialog
+ ErrorBox aErrBox( this, SVX_RES( RID_ERR_INVALID_XMLNAME ) );
+ String sMessText = aErrBox.GetMessText();
+ sMessText.SearchAndReplace( MSG_VARIABLE, sNewName );
+ aErrBox.SetMessText( sMessText );
+ aErrBox.Execute();
+ return 0;
+ }
+
+ ::rtl::OUString sDataType( m_aDataTypeLB.GetSelectEntry() );
+ m_xTempBinding->setPropertyValue( PN_BINDING_TYPE, makeAny( sDataType ) );
+
+ if ( bIsHandleBinding )
+ {
+ // copy properties from temp binding to original binding
+ copyPropSet( m_xTempBinding, m_pItemNode->m_xPropSet );
+ try
+ {
+ ::rtl::OUString sValue = m_aNameED.GetText();
+ m_pItemNode->m_xPropSet->setPropertyValue( PN_BINDING_ID, makeAny( sValue ) );
+ sValue = m_aDefaultED.GetText();
+ m_pItemNode->m_xPropSet->setPropertyValue( PN_BINDING_EXPR, makeAny( sValue ) );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "AddDataDialog::OKHdl(): exception caught" );
+ }
+ }
+ else
+ {
+ // copy properties from temp binding to original binding
+ copyPropSet( m_xTempBinding, m_xBinding );
+ try
+ {
+ if ( bIsHandleText )
+ m_xUIHelper->setNodeValue( m_pItemNode->m_xNode, m_aDefaultED.GetText() );
+ else
+ {
+ Reference< css::xml::dom::XNode > xNewNode =
+ m_xUIHelper->renameNode( m_pItemNode->m_xNode, m_aNameED.GetText() );
+ m_xUIHelper->setNodeValue( xNewNode, m_aDefaultED.GetText() );
+ m_pItemNode->m_xNode = xNewNode;
+ }
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "AddDataDialog::OKHdl(): exception caught" );
+ }
+ }
+ // then close the dialog
+ EndDialog( RET_OK );
+ return 0;
+ }
+
+ //------------------------------------------------------------------------
+ void AddDataItemDialog::InitDialog()
+ {
+ // set handler
+ Link aLink = LINK( this, AddDataItemDialog, CheckHdl );
+ m_aRequiredCB.SetClickHdl( aLink );
+ m_aRelevantCB.SetClickHdl( aLink );
+ m_aConstraintCB.SetClickHdl( aLink );
+ m_aReadonlyCB.SetClickHdl( aLink );
+ m_aCalculateCB.SetClickHdl( aLink );
+
+ aLink = LINK( this, AddDataItemDialog, ConditionHdl );
+ m_aDefaultBtn.SetClickHdl( aLink );
+ m_aRequiredBtn.SetClickHdl( aLink );
+ m_aRelevantBtn.SetClickHdl( aLink );
+ m_aConstraintBtn.SetClickHdl( aLink );
+ m_aReadonlyBtn.SetClickHdl( aLink );
+ m_aCalculateBtn.SetClickHdl( aLink );
+
+ m_aOKBtn.SetClickHdl( LINK( this, AddDataItemDialog, OKHdl ) );
+ }
+
+ //------------------------------------------------------------------------
+ void AddDataItemDialog::InitFromNode()
+ {
+ if ( m_pItemNode )
+ {
+ if ( m_pItemNode->m_xNode.is() )
+ {
+ try
+ {
+ // detect type of the node
+ css::xml::dom::NodeType eChildType = m_pItemNode->m_xNode->getNodeType();
+ switch ( eChildType )
+ {
+ case css::xml::dom::NodeType_ATTRIBUTE_NODE:
+ m_eItemType = DITAttribute;
+ break;
+ case css::xml::dom::NodeType_ELEMENT_NODE:
+ m_eItemType = DITElement;
+ break;
+ case css::xml::dom::NodeType_TEXT_NODE:
+ m_eItemType = DITText;
+ break;
+ default:
+ DBG_ERROR( "AddDataItemDialog::InitFronNode: cannot handle this node type!" );
+ break;
+ }
+
+ /** Get binding of the node and clone it
+ Then use this temporary binding in the dialog.
+ When the user click OK the temporary binding will be copied
+ into the original binding.
+ */
+
+ Reference< css::xml::dom::XNode > xNode = m_pItemNode->m_xNode;
+ m_xBinding = m_xUIHelper->getBindingForNode( xNode, sal_True );
+ if ( m_xBinding.is() )
+ {
+ Reference< css::xforms::XModel > xModel( m_xUIHelper, UNO_QUERY );
+ if ( xModel.is() )
+ {
+ m_xTempBinding = m_xUIHelper->cloneBindingAsGhost( m_xBinding );
+ Reference < XSet > xBindings = xModel->getBindings();
+ if ( xBindings.is() )
+ xBindings->insert( makeAny( m_xTempBinding ) );
+ }
+ }
+
+ if ( m_eItemType != DITText )
+ {
+ ::rtl::OUString sName( m_xUIHelper->getNodeName( m_pItemNode->m_xNode ) );
+ m_aNameED.SetText( sName );
+ }
+ m_aDefaultED.SetText( m_pItemNode->m_xNode->getNodeValue() );
+ }
+ catch( Exception& )
+ {
+ DBG_ERRORFILE( "AddDataItemDialog::InitFromNode(): exception caught" );
+ }
+ }
+ else if ( m_pItemNode->m_xPropSet.is() )
+ {
+ m_eItemType = DITBinding;
+ Reference< css::xforms::XModel > xModel( m_xUIHelper, UNO_QUERY );
+ if ( xModel.is() )
+ {
+ try
+ {
+ m_xTempBinding = m_xUIHelper->cloneBindingAsGhost( m_pItemNode->m_xPropSet );
+ Reference < XSet > xBindings = xModel->getBindings();
+ if ( xBindings.is() )
+ xBindings->insert( makeAny( m_xTempBinding ) );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "AddDataItemDialog::InitFromNode(): exception caught" );
+ }
+ }
+ rtl::OUString sTemp;
+ try
+ {
+ Reference< XPropertySetInfo > xInfo = m_pItemNode->m_xPropSet->getPropertySetInfo();
+ if ( xInfo->hasPropertyByName( PN_BINDING_ID ) )
+ {
+ m_pItemNode->m_xPropSet->getPropertyValue( PN_BINDING_ID ) >>= sTemp;
+ m_aNameED.SetText( sTemp );
+ m_pItemNode->m_xPropSet->getPropertyValue( PN_BINDING_EXPR ) >>= sTemp;
+ m_aDefaultED.SetText( sTemp );
+ }
+ else if ( xInfo->hasPropertyByName( PN_SUBMISSION_BIND ) )
+ {
+ m_pItemNode->m_xPropSet->getPropertyValue( PN_SUBMISSION_ID ) >>= sTemp;
+ m_aNameED.SetText( sTemp );
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERRORFILE( "AddDataItemDialog::InitFromNode(): exception caught" );
+ }
+
+ Size a3and1Sz = LogicToPixel( Size( 3, 1 ), MAP_APPFONT );
+ Size aNewSz = m_aDefaultED.GetSizePixel();
+ Point aNewPnt = m_aDefaultED.GetPosPixel();
+ aNewPnt.Y() += a3and1Sz.Height();
+ aNewSz.Width() -= ( m_aDefaultBtn.GetSizePixel().Width() + a3and1Sz.Width() );
+ m_aDefaultED.SetPosSizePixel( aNewPnt, aNewSz );
+ m_aDefaultBtn.Show();
+ }
+
+ if ( m_xTempBinding.is() )
+ {
+ ::rtl::OUString sTemp;
+ try
+ {
+ if ( ( m_xTempBinding->getPropertyValue( PN_REQUIRED_EXPR ) >>= sTemp )
+ && sTemp.getLength() > 0 )
+ m_aRequiredCB.Check( sal_True );
+ if ( ( m_xTempBinding->getPropertyValue( PN_RELEVANT_EXPR ) >>= sTemp )
+ && sTemp.getLength() > 0 )
+ m_aRelevantCB.Check( sal_True );
+ if ( ( m_xTempBinding->getPropertyValue( PN_CONSTRAINT_EXPR ) >>= sTemp )
+ && sTemp.getLength() > 0 )
+ m_aConstraintCB.Check( sal_True );
+ if ( ( m_xTempBinding->getPropertyValue( PN_READONLY_EXPR ) >>= sTemp )
+ && sTemp.getLength() > 0 )
+ m_aReadonlyCB.Check( sal_True );
+ if ( ( m_xTempBinding->getPropertyValue( PN_CALCULATE_EXPR ) >>= sTemp )
+ && sTemp.getLength() > 0 )
+ m_aCalculateCB.Check( sal_True );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "AddDataItemDialog::InitFromNode(): exception caught" );
+ }
+ }
+ }
+
+ if ( DITText == m_eItemType )
+ {
+ long nDelta = m_aButtonsFL.GetPosPixel().Y() - m_aSettingsFL.GetPosPixel().Y();
+ size_t i = 0;
+ Window* pWinsForHide[] =
+ {
+ &m_aSettingsFL, &m_aDataTypeFT, &m_aDataTypeLB, &m_aRequiredCB,
+ &m_aRequiredBtn, &m_aRelevantCB, &m_aRelevantBtn, &m_aConstraintCB,
+ &m_aConstraintBtn, &m_aReadonlyCB, &m_aReadonlyBtn, &m_aCalculateCB,
+ &m_aCalculateBtn
+ };
+ Window** pCurrent = pWinsForHide;
+ for ( ; i < sizeof( pWinsForHide ) / sizeof( pWinsForHide[ 0 ] ); ++i, ++pCurrent )
+ (*pCurrent)->Hide();
+
+ Window* pWinsForMove[] =
+ {
+ &m_aButtonsFL, &m_aOKBtn, &m_aEscBtn, &m_aHelpBtn
+ };
+ pCurrent = pWinsForMove;
+ for ( i = 0; i < sizeof( pWinsForMove ) / sizeof( pWinsForMove[ 0 ] ); ++i, ++pCurrent )
+ {
+ Point aNewPos = (*pCurrent)->GetPosPixel();
+ aNewPos.Y() -= nDelta;
+ (*pCurrent)->SetPosPixel( aNewPos );
+ }
+ Size aNewWinSz = GetSizePixel();
+ aNewWinSz.Height() -= nDelta;
+ SetSizePixel( aNewWinSz );
+
+ m_aNameFT.Disable();
+ m_aNameED.Disable();
+ }
+ }
+
+ //------------------------------------------------------------------------
+ void AddDataItemDialog::InitDataTypeBox()
+ {
+ if ( m_eItemType != DITText )
+ {
+ Reference< css::xforms::XModel > xModel( m_xUIHelper, UNO_QUERY );
+ if ( xModel.is() )
+ {
+ try
+ {
+ Reference< css::xforms::XDataTypeRepository > xDataTypes =
+ xModel->getDataTypeRepository();
+ if ( xDataTypes.is() )
+ {
+ Sequence< ::rtl::OUString > aNameList = xDataTypes->getElementNames();
+ sal_Int32 i, nCount = aNameList.getLength();
+ ::rtl::OUString* pNames = aNameList.getArray();
+ for ( i = 0; i < nCount; ++i )
+ m_aDataTypeLB.InsertEntry( pNames[i] );
+ }
+
+ if ( m_xTempBinding.is() )
+ {
+ rtl::OUString sTemp;
+ if ( m_xTempBinding->getPropertyValue( PN_BINDING_TYPE ) >>= sTemp )
+ {
+ sal_uInt16 nPos = m_aDataTypeLB.GetEntryPos( String( sTemp ) );
+ if ( LISTBOX_ENTRY_NOTFOUND == nPos )
+ nPos = m_aDataTypeLB.InsertEntry( sTemp );
+ m_aDataTypeLB.SelectEntryPos( nPos );
+ }
+ }
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "AddDataItemDialog::InitDataTypeBox(): exception caught" );
+ }
+ }
+ }
+ }
+
+ void AddDataItemDialog::InitText( DataItemType _eType )
+ {
+ String sText;
+
+ switch ( _eType )
+ {
+ case DITAttribute :
+ {
+ sText = m_sFL_Attribute;
+ break;
+ }
+
+ case DITBinding :
+ {
+ sText = m_sFL_Binding;
+ m_aDefaultFT.SetText( m_sFT_BindingExp );
+ break;
+ }
+
+ default:
+ {
+ sText = m_sFL_Element;
+ }
+ }
+
+ m_aItemFL.SetText( sText );
+ }
+
+ //========================================================================
+ // class AddConditionDialog
+ //========================================================================
+
+ AddConditionDialog::AddConditionDialog(
+ Window* pParent, const ::rtl::OUString& _rPropertyName,
+ const Reference< XPropertySet >& _rPropSet ) :
+
+ ModalDialog( pParent, SVX_RES( RID_SVXDLG_ADD_CONDITION ) ),
+
+ m_aConditionFT ( this, SVX_RES( FT_CONDITION ) ),
+ m_aConditionED ( this, SVX_RES( ED_CONDITION ) ),
+ m_aResultFT ( this, SVX_RES( FT_RESULT ) ),
+ m_aResultWin ( this, SVX_RES( FT_RESULT_PREVIEW ) ),
+ m_aEditNamespacesBtn( this, SVX_RES( PB_EDIT_NAMESPACES ) ),
+ m_aButtonsFL ( this, SVX_RES( FL_DATANAV_BTN ) ),
+ m_aOKBtn ( this, SVX_RES( BTN_DATANAV_OK ) ),
+ m_aEscBtn ( this, SVX_RES( BTN_DATANAV_ESC ) ),
+ m_aHelpBtn ( this, SVX_RES( BTN_DATANAV_HELP ) ),
+
+ m_sPropertyName ( _rPropertyName ),
+ m_xBinding ( _rPropSet )
+
+ {
+ FreeResource();
+
+ DBG_ASSERT( m_xBinding.is(), "AddConditionDialog::Ctor(): no Binding" );
+
+ m_aResultWin.SetBackground( m_aConditionED.GetBackground() );
+ m_aConditionED.SetModifyHdl( LINK( this, AddConditionDialog, ModifyHdl ) );
+ m_aEditNamespacesBtn.SetClickHdl( LINK( this, AddConditionDialog, EditHdl ) );
+ m_aOKBtn.SetClickHdl( LINK( this, AddConditionDialog, OKHdl ) );
+ m_aResultTimer.SetTimeout( 500 );
+ m_aResultTimer.SetTimeoutHdl( LINK( this, AddConditionDialog, ResultHdl ) );
+
+ if ( m_sPropertyName.getLength() > 0 )
+ {
+ try
+ {
+ rtl::OUString sTemp;
+ if ( ( m_xBinding->getPropertyValue( m_sPropertyName ) >>= sTemp )
+ && sTemp.getLength() > 0 )
+ {
+ m_aConditionED.SetText( sTemp );
+ }
+ else
+ {
+//! m_xBinding->setPropertyValue( m_sPropertyName, makeAny( TRUE_VALUE ) );
+ m_aConditionED.SetText( TRUE_VALUE );
+ }
+
+ Reference< css::xforms::XModel > xModel;
+ if ( ( m_xBinding->getPropertyValue( PN_BINDING_MODEL ) >>= xModel ) && xModel.is() )
+ m_xUIHelper = Reference< css::xforms::XFormsUIHelper1 >( xModel, UNO_QUERY );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "AddConditionDialog::Ctor(): exception caught" );
+ }
+ }
+
+ DBG_ASSERT( m_xUIHelper.is(), "AddConditionDialog::Ctor(): no UIHelper" );
+ ResultHdl( &m_aResultTimer );
+ }
+
+ //------------------------------------------------------------------------
+ AddConditionDialog::~AddConditionDialog()
+ {
+ }
+
+ //------------------------------------------------------------------------
+ IMPL_LINK( AddConditionDialog, EditHdl, PushButton *, EMPTYARG )
+ {
+ Reference< XNameContainer > xNameContnr;
+ try
+ {
+ m_xBinding->getPropertyValue( PN_BINDING_NAMESPACES ) >>= xNameContnr;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "AddDataItemDialog::EditHdl(): exception caught" );
+ }
+ NamespaceItemDialog aDlg( this, xNameContnr );
+ aDlg.Execute();
+ try
+ {
+ m_xBinding->setPropertyValue( PN_BINDING_NAMESPACES, makeAny( xNameContnr ) );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "AddDataItemDialog::EditHdl(): exception caught" );
+ }
+ return 0;
+ }
+
+ //------------------------------------------------------------------------
+ IMPL_LINK( AddConditionDialog, OKHdl, OKButton *, EMPTYARG )
+ {
+/*!!!
+ try
+ {
+ if ( m_xBinding.is() )
+ m_xBinding->setPropertyValue( m_sPropertyName, makeAny( ::rtl::OUString( m_aConditionED.GetText() ) ) );
+ }
+ catch( const Exception& )
+ {
+ DBG_ERRORFILE( "AddConditionDialog, OKHdl: caught an exception!" );
+ }
+*/
+ EndDialog( RET_OK );
+ return 0;
+ }
+
+ //------------------------------------------------------------------------
+ IMPL_LINK( AddConditionDialog, ModifyHdl, MultiLineEdit *, EMPTYARG )
+ {
+ m_aResultTimer.Start();
+ return 0;
+ }
+
+ //------------------------------------------------------------------------
+ IMPL_LINK( AddConditionDialog, ResultHdl, Timer *, EMPTYARG )
+ {
+ String sCondition = m_aConditionED.GetText().EraseLeadingChars().EraseTrailingChars();
+ String sResult;
+ if ( sCondition.Len() > 0 )
+ {
+ try
+ {
+ sResult = m_xUIHelper->getResultForExpression( m_xBinding, ( m_sPropertyName == PN_BINDING_EXPR ), sCondition );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "AddConditionDialog::ResultHdl(): exception caught" );
+ }
+ }
+ m_aResultWin.SetText( sResult );
+ return 0;
+ }
+
+ //========================================================================
+ // class NamespaceItemDialog
+ //========================================================================
+
+ NamespaceItemDialog::NamespaceItemDialog(
+ AddConditionDialog* _pCondDlg, Reference< XNameContainer >& _rContainer ) :
+
+ ModalDialog( _pCondDlg, SVX_RES( RID_SVXDLG_NAMESPACE_ITEM ) ),
+
+ m_aNamespacesFT ( this, SVX_RES( FT_NAMESPACES ) ),
+ m_aNamespacesList ( this, SVX_RES( LB_NAMESPACES ) ),
+ m_aAddNamespaceBtn ( this, SVX_RES( PB_ADD_NAMESPACE ) ),
+ m_aEditNamespaceBtn ( this, SVX_RES( PB_EDIT_NAMESPACE ) ),
+ m_aDeleteNamespaceBtn ( this, SVX_RES( PB_DELETE_NAMESPACE ) ),
+ m_aButtonsFL ( this, SVX_RES( FL_DATANAV_BTN ) ),
+ m_aOKBtn ( this, SVX_RES( BTN_DATANAV_OK ) ),
+ m_aEscBtn ( this, SVX_RES( BTN_DATANAV_ESC ) ),
+ m_aHelpBtn ( this, SVX_RES( BTN_DATANAV_HELP ) ),
+
+ m_pConditionDlg ( _pCondDlg ),
+ m_rNamespaces ( _rContainer )
+
+ {
+ static long aStaticTabs[]= { 3, 0, 35, 200 };
+ m_aNamespacesList.SvxSimpleTable::SetTabs( aStaticTabs );
+ String sHeader = String( SVX_RES( STR_HEADER_PREFIX ) );
+ sHeader += '\t';
+ sHeader += String( SVX_RES( STR_HEADER_URL ) );
+ m_aNamespacesList.InsertHeaderEntry(
+ sHeader, HEADERBAR_APPEND, HIB_LEFT /*| HIB_FIXEDPOS | HIB_FIXED*/ );
+
+ FreeResource();
+
+ m_aNamespacesList.SetSelectHdl( LINK( this, NamespaceItemDialog, SelectHdl ) );
+ Link aLink = LINK( this, NamespaceItemDialog, ClickHdl );
+ m_aAddNamespaceBtn.SetClickHdl( aLink );
+ m_aEditNamespaceBtn.SetClickHdl( aLink );
+ m_aDeleteNamespaceBtn.SetClickHdl( aLink );
+ m_aOKBtn.SetClickHdl( LINK( this, NamespaceItemDialog, OKHdl ) );
+
+ LoadNamespaces();
+ SelectHdl( &m_aNamespacesList );
+ }
+
+ //------------------------------------------------------------------------
+ NamespaceItemDialog::~NamespaceItemDialog()
+ {
+ }
+
+ //------------------------------------------------------------------------
+ IMPL_LINK( NamespaceItemDialog, SelectHdl, SvxSimpleTable *, EMPTYARG )
+ {
+ sal_Bool bEnable = ( m_aNamespacesList.FirstSelected() != NULL );
+ m_aEditNamespaceBtn.Enable( bEnable );
+ m_aDeleteNamespaceBtn.Enable( bEnable );
+
+ return 0;
+ }
+
+ //------------------------------------------------------------------------
+ IMPL_LINK( NamespaceItemDialog, ClickHdl, PushButton *, pBtn )
+ {
+ if ( &m_aAddNamespaceBtn == pBtn )
+ {
+ ManageNamespaceDialog aDlg( this, m_pConditionDlg, false );
+ if ( aDlg.Execute() == RET_OK )
+ {
+ String sEntry = aDlg.GetPrefix();
+ sEntry += '\t';
+ sEntry += aDlg.GetURL();
+ m_aNamespacesList.InsertEntry( sEntry );
+ }
+ }
+ else if ( &m_aEditNamespaceBtn == pBtn )
+ {
+ ManageNamespaceDialog aDlg( this, m_pConditionDlg, true );
+ SvLBoxEntry* pEntry = m_aNamespacesList.FirstSelected();
+ DBG_ASSERT( pEntry, "NamespaceItemDialog::ClickHdl(): no entry" );
+ String sPrefix( m_aNamespacesList.GetEntryText( pEntry, 0 ) );
+ aDlg.SetNamespace(
+ sPrefix,
+ m_aNamespacesList.GetEntryText( pEntry, 1 ) );
+ if ( aDlg.Execute() == RET_OK )
+ {
+ // if a prefix was changed, mark the old prefix as 'removed'
+ if( sPrefix != aDlg.GetPrefix() )
+ m_aRemovedList.push_back( sPrefix );
+
+ m_aNamespacesList.SetEntryText( aDlg.GetPrefix(), pEntry, 0 );
+ m_aNamespacesList.SetEntryText( aDlg.GetURL(), pEntry, 1 );
+ }
+ }
+ else if ( &m_aDeleteNamespaceBtn == pBtn )
+ {
+ SvLBoxEntry* pEntry = m_aNamespacesList.FirstSelected();
+ DBG_ASSERT( pEntry, "NamespaceItemDialog::ClickHdl(): no entry" );
+ ::rtl::OUString sPrefix( m_aNamespacesList.GetEntryText( pEntry, 0 ) );
+ m_aRemovedList.push_back( sPrefix );
+ m_aNamespacesList.GetModel()->Remove( pEntry );
+ }
+ else
+ {
+ DBG_ERRORFILE( "NamespaceItemDialog::ClickHdl(): invalid button" );
+ }
+
+ SelectHdl( &m_aNamespacesList );
+ return 0;
+ }
+
+ //------------------------------------------------------------------------
+ IMPL_LINK( NamespaceItemDialog, OKHdl, OKButton *, EMPTYARG )
+ {
+ try
+ {
+ // update namespace container
+ sal_Int32 i, nRemovedCount = m_aRemovedList.size();
+ for( i = 0; i < nRemovedCount; ++i )
+ m_rNamespaces->removeByName( m_aRemovedList[i] );
+
+ sal_Int32 nEntryCount = m_aNamespacesList.GetEntryCount();
+ for( i = 0; i < nEntryCount; ++i )
+ {
+ SvLBoxEntry* pEntry = m_aNamespacesList.GetEntry(i);
+ ::rtl::OUString sPrefix( m_aNamespacesList.GetEntryText( pEntry, 0 ) );
+ ::rtl::OUString sURL( m_aNamespacesList.GetEntryText( pEntry, 1 ) );
+
+ if ( m_rNamespaces->hasByName( sPrefix ) )
+ m_rNamespaces->replaceByName( sPrefix, makeAny( sURL ) );
+ else
+ m_rNamespaces->insertByName( sPrefix, makeAny( sURL ) );
+ }
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "NamespaceItemDialog::OKHdl(): exception caught" );
+ }
+ // and close the dialog
+ EndDialog( RET_OK );
+ return 0;
+ }
+
+ //------------------------------------------------------------------------
+ void NamespaceItemDialog::LoadNamespaces()
+ {
+ try
+ {
+ Sequence< ::rtl::OUString > aAllNames = m_rNamespaces->getElementNames();
+ const ::rtl::OUString* pAllNames = aAllNames.getConstArray();
+ const ::rtl::OUString* pAllNamesEnd = pAllNames + aAllNames.getLength();
+ for ( ; pAllNames != pAllNamesEnd; ++pAllNames )
+ {
+ ::rtl::OUString sURL;
+ ::rtl::OUString sPrefix = *pAllNames;
+ if ( m_rNamespaces->hasByName( sPrefix ) )
+ {
+ Any aAny = m_rNamespaces->getByName( sPrefix );
+ if ( aAny >>= sURL )
+ {
+ String sEntry( sPrefix );
+ sEntry += '\t';
+ sEntry += String( sURL );
+
+ m_aNamespacesList.InsertEntry( sEntry );
+ }
+ }
+ }
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "NamespaceItemDialog::LoadNamespaces(): exception caught" );
+ }
+ }
+
+ //========================================================================
+ // class ManageNamespaceDialog
+ //========================================================================
+
+ ManageNamespaceDialog::ManageNamespaceDialog(
+ Window* pParent, AddConditionDialog* _pCondDlg, bool _bIsEdit ) :
+
+ ModalDialog( pParent, SVX_RES( RID_SVXDLG_MANAGE_NAMESPACE ) ),
+
+ m_aPrefixFT ( this, SVX_RES( FT_PREFIX ) ),
+ m_aPrefixED ( this, SVX_RES( ED_PREFIX ) ),
+ m_aUrlFT ( this, SVX_RES( FT_URL ) ),
+ m_aUrlED ( this, SVX_RES( ED_URL ) ),
+ m_aButtonsFL ( this, SVX_RES( FL_DATANAV_BTN ) ),
+ m_aOKBtn ( this, SVX_RES( BTN_DATANAV_OK ) ),
+ m_aEscBtn ( this, SVX_RES( BTN_DATANAV_ESC ) ),
+ m_aHelpBtn ( this, SVX_RES( BTN_DATANAV_HELP ) ),
+
+ m_pConditionDlg ( _pCondDlg )
+
+ {
+ if ( _bIsEdit )
+ SetText( String( SVX_RES( STR_EDIT_TEXT ) ) );
+
+ FreeResource();
+
+ m_aOKBtn.SetClickHdl( LINK( this, ManageNamespaceDialog, OKHdl ) );
+ }
+
+ //------------------------------------------------------------------------
+ ManageNamespaceDialog::~ManageNamespaceDialog()
+ {
+ }
+
+ //------------------------------------------------------------------------
+ IMPL_LINK( ManageNamespaceDialog, OKHdl, OKButton *, EMPTYARG )
+ {
+ String sPrefix = m_aPrefixED.GetText();
+
+ try
+ {
+ if ( !m_pConditionDlg->GetUIHelper()->isValidPrefixName( sPrefix ) )
+ {
+ ErrorBox aErrBox( this, SVX_RES( RID_ERR_INVALID_XMLPREFIX ) );
+ String sMessText = aErrBox.GetMessText();
+ sMessText.SearchAndReplace( MSG_VARIABLE, sPrefix );
+ aErrBox.SetMessText( sMessText );
+ aErrBox.Execute();
+ return 0;
+ }
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "ManageNamespacesDialog::OKHdl(): exception caught" );
+ }
+
+ // no error so close the dialog
+ EndDialog( RET_OK );
+ return 0;
+ }
+
+ //========================================================================
+ // class AddSubmissionDialog
+ //========================================================================
+
+ AddSubmissionDialog::AddSubmissionDialog(
+ Window* pParent, ItemNode* _pNode,
+ const Reference< css::xforms::XFormsUIHelper1 >& _rUIHelper ) :
+
+ ModalDialog( pParent, SVX_RES( RID_SVXDLG_ADD_SUBMISSION ) ),
+
+ m_aSubmissionFL ( this, SVX_RES( FL_SUBMISSION ) ),
+ m_aNameFT ( this, SVX_RES( FT_SUBMIT_NAME ) ),
+ m_aNameED ( this, SVX_RES( ED_SUBMIT_NAME ) ),
+ m_aActionFT ( this, SVX_RES( FT_SUBMIT_ACTION ) ),
+ m_aActionED ( this, SVX_RES( ED_SUBMIT_ACTION ) ),
+ m_aMethodFT ( this, SVX_RES( FT_SUBMIT_METHOD ) ),
+ m_aMethodLB ( this, SVX_RES( LB_SUBMIT_METHOD ) ),
+ m_aRefFT ( this, SVX_RES( FT_SUBMIT_REF ) ),
+ m_aRefED ( this, SVX_RES( ED_SUBMIT_REF ) ),
+ m_aRefBtn ( this, SVX_RES( PB_SUBMIT_REF ) ),
+ m_aBindFT ( this, SVX_RES( FT_SUBMIT_BIND ) ),
+ m_aBindLB ( this, SVX_RES( LB_SUBMIT_BIND ) ),
+ m_aReplaceFT ( this, SVX_RES( FT_SUBMIT_REPLACE ) ),
+ m_aReplaceLB ( this, SVX_RES( LB_SUBMIT_REPLACE ) ),
+
+ m_aButtonsFL ( this, SVX_RES( FL_DATANAV_BTN ) ),
+ m_aOKBtn ( this, SVX_RES( BTN_DATANAV_OK ) ),
+ m_aEscBtn ( this, SVX_RES( BTN_DATANAV_ESC ) ),
+ m_aHelpBtn ( this, SVX_RES( BTN_DATANAV_HELP ) ),
+
+ m_pItemNode ( _pNode ),
+ m_xUIHelper ( _rUIHelper )
+
+ {
+ FillAllBoxes(); // we need local resources here, so call before FreeResource!!!
+
+ FreeResource();
+
+ m_aRefBtn.SetClickHdl( LINK( this, AddSubmissionDialog, RefHdl ) );
+ m_aOKBtn.SetClickHdl( LINK( this, AddSubmissionDialog, OKHdl ) );
+ }
+
+ //------------------------------------------------------------------------
+ AddSubmissionDialog::~AddSubmissionDialog()
+ {
+ // #i38991# if we have added a binding, we need to remove it as well.
+ if( m_xCreatedBinding.is() && m_xUIHelper.is() )
+ m_xUIHelper->removeBindingIfUseless( m_xCreatedBinding );
+ }
+
+ //------------------------------------------------------------------------
+ IMPL_LINK( AddSubmissionDialog, RefHdl, PushButton *, EMPTYARG )
+ {
+ AddConditionDialog aDlg( this, PN_BINDING_EXPR, m_xTempBinding );
+ aDlg.SetCondition( m_aRefED.GetText() );
+ if ( aDlg.Execute() == RET_OK )
+ m_aRefED.SetText( aDlg.GetCondition() );
+
+ return 0;
+ }
+
+ //------------------------------------------------------------------------
+ IMPL_LINK( AddSubmissionDialog, OKHdl, OKButton *, EMPTYARG )
+ {
+ rtl::OUString sName(m_aNameED.GetText());
+ if(!sName.getLength()) {
+
+ ErrorBox aErrorBox(this,SVX_RES(RID_ERR_EMPTY_SUBMISSIONNAME));
+ aErrorBox.SetText( Application::GetDisplayName() );
+ aErrorBox.Execute();
+ return 0;
+ }
+
+ if ( !m_xSubmission.is() )
+ {
+ DBG_ASSERT( !m_xNewSubmission.is(),
+ "AddSubmissionDialog::OKHdl(): new submission already exists" );
+
+ // add a new submission
+ Reference< css::xforms::XModel > xModel( m_xUIHelper, UNO_QUERY );
+ if ( xModel.is() )
+ {
+ try
+ {
+ m_xNewSubmission = xModel->createSubmission();
+ m_xSubmission = Reference< XPropertySet >( m_xNewSubmission, UNO_QUERY );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "AddSubmissionDialog::OKHdl(): exception caught" );
+ }
+ }
+ }
+
+ if ( m_xSubmission.is() )
+ {
+ rtl::OUString sTemp = m_aNameED.GetText();
+ try
+ {
+ m_xSubmission->setPropertyValue( PN_SUBMISSION_ID, makeAny( sTemp ) );
+ sTemp = m_aActionED.GetText();
+ m_xSubmission->setPropertyValue( PN_SUBMISSION_ACTION, makeAny( sTemp ) );
+ sTemp = lcl_MethodString::get().toAPI( m_aMethodLB.GetSelectEntry() );
+ m_xSubmission->setPropertyValue( PN_SUBMISSION_METHOD, makeAny( sTemp ) );
+ sTemp = m_aRefED.GetText();
+ m_xSubmission->setPropertyValue( PN_SUBMISSION_REF, makeAny( sTemp ) );
+ String sEntry = m_aBindLB.GetSelectEntry();
+ sEntry.Erase( sEntry.Search( ':' ) );
+ sTemp = sEntry;
+ m_xSubmission->setPropertyValue( PN_SUBMISSION_BIND, makeAny( sTemp ) );
+ sTemp = lcl_ReplaceString::get().toAPI( m_aReplaceLB.GetSelectEntry() );
+ m_xSubmission->setPropertyValue( PN_SUBMISSION_REPLACE, makeAny( sTemp ) );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "AddSubmissionDialog::OKHdl(): exception caught" );
+ }
+ }
+
+ EndDialog( RET_OK );
+ return 0;
+ }
+
+ //------------------------------------------------------------------------
+ void AddSubmissionDialog::FillAllBoxes()
+ {
+ // method box
+ m_aMethodLB.InsertEntry( String( SVX_RES( STR_METHOD_POST ) ) );
+ m_aMethodLB.InsertEntry( String( SVX_RES( STR_METHOD_PUT ) ) );
+ m_aMethodLB.InsertEntry( String( SVX_RES( STR_METHOD_GET ) ) );
+ m_aMethodLB.SelectEntryPos(0);
+
+ // binding box
+ Reference< css::xforms::XModel > xModel( m_xUIHelper, UNO_QUERY );
+ if ( xModel.is() )
+ {
+ try
+ {
+ Reference< XEnumerationAccess > xNumAccess( xModel->getBindings(), UNO_QUERY );
+ if ( xNumAccess.is() )
+ {
+ Reference < XEnumeration > xNum = xNumAccess->createEnumeration();
+ if ( xNum.is() && xNum->hasMoreElements() )
+ {
+ String sDelim( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+ while ( xNum->hasMoreElements() )
+ {
+ Reference< XPropertySet > xPropSet;
+ Any aAny = xNum->nextElement();
+ if ( aAny >>= xPropSet )
+ {
+ String sEntry;
+ rtl::OUString sTemp;
+ xPropSet->getPropertyValue( PN_BINDING_ID ) >>= sTemp;
+ sEntry += String( sTemp );
+ sEntry += sDelim;
+ xPropSet->getPropertyValue( PN_BINDING_EXPR ) >>= sTemp;
+ sEntry += String( sTemp );
+ m_aBindLB.InsertEntry( sEntry );
+
+ if ( !m_xTempBinding.is() )
+ m_xTempBinding = xPropSet;
+ }
+ }
+ }
+ }
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "AddSubmissionDialog::FillAllBoxes(): exception caught" );
+ }
+ }
+
+ // #i36342# we need a temporary binding; create one if no existing binding
+ // is found
+ if( !m_xTempBinding.is() )
+ {
+ m_xCreatedBinding = m_xUIHelper->getBindingForNode(
+ Reference<css::xml::dom::XNode>(
+ xModel->getDefaultInstance()->getDocumentElement(),
+ UNO_QUERY_THROW ),
+ sal_True );
+ m_xTempBinding = m_xCreatedBinding;
+ }
+
+ // replace box
+ m_aReplaceLB.InsertEntry( String( SVX_RES( STR_REPLACE_NONE ) ) );
+ m_aReplaceLB.InsertEntry( String( SVX_RES( STR_REPLACE_INST ) ) );
+ m_aReplaceLB.InsertEntry( String( SVX_RES( STR_REPLACE_DOC ) ) );
+
+
+ // init the controls with the values of the submission
+ if ( m_pItemNode && m_pItemNode->m_xPropSet.is() )
+ {
+ m_xSubmission = m_pItemNode->m_xPropSet;
+ rtl::OUString sTemp;
+ try
+ {
+ m_xSubmission->getPropertyValue( PN_SUBMISSION_ID ) >>= sTemp;
+ m_aNameED.SetText( sTemp );
+ m_xSubmission->getPropertyValue( PN_SUBMISSION_ACTION ) >>= sTemp;
+ m_aActionED.SetText( sTemp );
+ m_xSubmission->getPropertyValue( PN_SUBMISSION_REF ) >>= sTemp;
+ m_aRefED.SetText( sTemp );
+
+ m_xSubmission->getPropertyValue( PN_SUBMISSION_METHOD ) >>= sTemp;
+ sTemp = lcl_MethodString::get().toUI( sTemp );
+ sal_uInt16 nPos = m_aMethodLB.GetEntryPos( String( sTemp ) );
+ if ( LISTBOX_ENTRY_NOTFOUND == nPos )
+ nPos = m_aMethodLB.InsertEntry( sTemp );
+ m_aMethodLB.SelectEntryPos( nPos );
+
+ m_xSubmission->getPropertyValue( PN_SUBMISSION_BIND ) >>= sTemp;
+ nPos = m_aBindLB.GetEntryPos( String( sTemp ) );
+ if ( LISTBOX_ENTRY_NOTFOUND == nPos )
+ nPos = m_aBindLB.InsertEntry( sTemp );
+ m_aBindLB.SelectEntryPos( nPos );
+
+ m_xSubmission->getPropertyValue( PN_SUBMISSION_REPLACE ) >>= sTemp;
+ sTemp = lcl_ReplaceString::get().toUI( sTemp );
+ if ( sTemp.getLength() == 0 )
+ sTemp = m_aReplaceLB.GetEntry(0); // first entry == "none"
+ nPos = m_aReplaceLB.GetEntryPos( String( sTemp ) );
+ if ( LISTBOX_ENTRY_NOTFOUND == nPos )
+ nPos = m_aReplaceLB.InsertEntry( sTemp );
+ m_aReplaceLB.SelectEntryPos( nPos );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "AddSubmissionDialog::FillAllBoxes(): exception caught" );
+ }
+ }
+
+ m_aRefBtn.Enable( m_xTempBinding.is() );
+ }
+
+ //========================================================================
+ // class AddModelDialog
+ //========================================================================
+
+ AddModelDialog::AddModelDialog( Window* pParent, bool _bEdit ) :
+
+ ModalDialog( pParent, SVX_RES( RID_SVXDLG_ADD_MODEL ) ),
+
+ m_aModelFL ( this, SVX_RES( FL_MODEL ) ),
+ m_aNameFT ( this, SVX_RES( FT_MODEL_NAME ) ),
+ m_aNameED ( this, SVX_RES( ED_MODEL_NAME ) ),
+ m_aModifyCB ( this, SVX_RES( CB_MODIFIES_DOCUMENT ) ),
+ m_aButtonsFL ( this, SVX_RES( FL_DATANAV_BTN ) ),
+ m_aOKBtn ( this, SVX_RES( BTN_DATANAV_OK ) ),
+ m_aEscBtn ( this, SVX_RES( BTN_DATANAV_ESC ) ),
+ m_aHelpBtn ( this, SVX_RES( BTN_DATANAV_HELP ) )
+
+ {
+ if ( _bEdit )
+ SetText( String( SVX_RES( STR_EDIT_TEXT ) ) );
+
+ FreeResource();
+ }
+
+ AddModelDialog::~AddModelDialog()
+ {
+ }
+
+ //========================================================================
+ // class AddInstanceDialog
+ //========================================================================
+
+ AddInstanceDialog::AddInstanceDialog( Window* pParent, bool _bEdit ) :
+
+ ModalDialog( pParent, SVX_RES( RID_SVXDLG_ADD_INSTANCE ) ),
+
+ m_aInstanceFL ( this, SVX_RES( FL_INSTANCE ) ),
+ m_aNameFT ( this, SVX_RES( FT_INST_NAME ) ),
+ m_aNameED ( this, SVX_RES( ED_INST_NAME ) ),
+ m_aURLFT ( this, SVX_RES( FT_INST_URL ) ),
+ m_aURLED ( this, SVX_RES( ED_INST_URL ) ),
+ m_aFilePickerBtn ( this, SVX_RES( PB_FILEPICKER ) ),
+ m_aLinkInstanceCB ( this, SVX_RES( CB_INST_LINKINST ) ),
+ m_aButtonsFL ( this, SVX_RES( FL_DATANAV_BTN ) ),
+ m_aOKBtn ( this, SVX_RES( BTN_DATANAV_OK ) ),
+ m_aEscBtn ( this, SVX_RES( BTN_DATANAV_ESC ) ),
+ m_aHelpBtn ( this, SVX_RES( BTN_DATANAV_HELP ) )
+
+ {
+ if ( _bEdit )
+ SetText( String( SVX_RES( STR_EDIT_TEXT ) ) );
+
+ FreeResource();
+
+ m_aURLED.DisableHistory();
+ m_aFilePickerBtn.SetClickHdl( LINK( this, AddInstanceDialog, FilePickerHdl ) );
+
+ // load the filter name from fps_office resource
+ m_sAllFilterName = String( ResId( STR_FILTERNAME_ALL, *CREATEVERSIONRESMGR(fps_office) ) );
+ }
+
+ AddInstanceDialog::~AddInstanceDialog()
+ {
+ }
+
+ //------------------------------------------------------------------------
+ IMPL_LINK( AddInstanceDialog, FilePickerHdl, PushButton *, EMPTYARG )
+ {
+ ::sfx2::FileDialogHelper aDlg(
+ css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 );
+ INetURLObject aFile( SvtPathOptions().GetWorkPath() );
+
+ aDlg.AddFilter( m_sAllFilterName, DEFINE_CONST_UNICODE(FILEDIALOG_FILTER_ALL) );
+ String sFilterName( DEFINE_CONST_UNICODE("XML") );
+ aDlg.AddFilter( sFilterName, DEFINE_CONST_UNICODE("*.xml") );
+ aDlg.SetCurrentFilter( sFilterName );
+ aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) );
+
+ if( aDlg.Execute() == ERRCODE_NONE )
+ m_aURLED.SetText( aDlg.GetPath() );
+
+ return 0;
+ }
+
+ //========================================================================
+ // class LinkedInstanceWarningBox
+ //========================================================================
+
+ LinkedInstanceWarningBox::LinkedInstanceWarningBox( Window* pParent ) :
+
+ MessBox( pParent, SVX_RES( RID_QRY_LINK_WARNING ) )
+
+ {
+ SetText( Application::GetDisplayName() );
+ SetImage( QueryBox::GetStandardImage() );
+ AddButton( SVX_RESSTR( RID_STR_DATANAV_LINKWARN_BUTTON ), BUTTONID_OK, BUTTONDIALOG_DEFBUTTON );
+ AddButton( BUTTON_CANCEL, BUTTONID_CANCEL, BUTTONDIALOG_CANCELBUTTON );
+ }
+
+//............................................................................
+} // namespace svxform
+//............................................................................
+
+
diff --git a/svx/source/form/datanavi.src b/svx/source/form/datanavi.src
new file mode 100644
index 000000000000..3dac7faf3a90
--- /dev/null
+++ b/svx/source/form/datanavi.src
@@ -0,0 +1,1195 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "datanavi.hrc"
+#include "globlmn.hrc"
+#include "svx/fmresids.hrc"
+#include "fmhelp.hrc"
+
+#define MASKCOLOR MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
+
+TabPage RID_SVX_XFORMS_TABPAGES
+{
+ HelpID = "svx:TabPage:RID_SVX_XFORMS_TABPAGES";
+ Hide = TRUE ;
+ DialogControl = TRUE;
+ Size = MAP_APPFONT ( 63 , 100 ) ;
+ ToolBox TB_ITEMS
+ {
+ HelpId = HID_XFORMS_TOOLBOX ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ Identifier = TBI_ITEM_ADD ;
+ HelpId = HID_XFORMS_TOOLBOX_ITEM_ADD ;
+ Text [ en-US ] = "Add Item" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_ITEM_ADD_ELEMENT ;
+ HelpId = HID_XFORMS_TOOLBOX_ITEM_ADD_ELEMENT ;
+ Text [ en-US ] = "Add Element" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_ITEM_ADD_ATTRIBUTE ;
+ HelpId = HID_XFORMS_TOOLBOX_ITEM_ADD_ATTRIBUTE ;
+ Text [ en-US ] = "Add Attribute" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_ITEM_EDIT ;
+ HelpId = HID_XFORMS_TOOLBOX_ITEM_EDIT ;
+ Text [ en-US ] = "Edit" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_ITEM_REMOVE ;
+ HelpId = HID_XFORMS_TOOLBOX_ITEM_REMOVE ;
+ Text [ en-US ] = "Delete" ;
+ };
+ };
+ };
+ Control LB_ITEMS
+ {
+ HelpId = HID_XFORMS_ITEMS_LIST ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 63 , 100 ) ;
+ Border = TRUE ;
+ TabStop = TRUE;
+ };
+#define IMG_LST \
+IdList = \
+{ \
+ IID_ITEM_ADD ; \
+ IID_ITEM_ADD_ELEMENT ; \
+ IID_ITEM_ADD_ATTRIBUTE ; \
+ IID_ITEM_EDIT ; \
+ IID_ITEM_REMOVE ; \
+}; \
+IdCount = { 5 ; } ;
+
+ ImageList IL_TBX_BMPS
+ {
+ Prefix = "tb";
+ MASKCOLOR
+ IMG_LST
+ };
+ ImageList IL_TBX_BMPS_HC
+ {
+ Prefix = "tbh";
+ MASKCOLOR
+ IMG_LST
+ };
+#undef IMG_LST
+};
+
+Window RID_SVXWIN_DATANAVIGATOR
+{
+ OutputSize = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ DialogControl = TRUE ;
+ HelpId = HID_DATA_NAVIGATOR_WIN ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 300 , 400 ) ;
+ ListBox LB_MODELS
+ {
+ HelpId = HID_XFORMS_MODELS_LIST ;
+ Pos = MAP_APPFONT ( 3 , 4 ) ;
+ Size = MAP_APPFONT ( 63 , 45 ) ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+ MenuButton MB_MODELS
+ {
+ HelpId = HID_XFORMS_MODELS_MENUBTN ;
+ Pos = MAP_APPFONT ( 69 , 3 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Models";
+ ButtonMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = MID_MODELS_ADD ;
+ HelpId = HID_MN_XFORMS_MODELS_ADD ;
+ Text [ en-US ] = "~Add..." ;
+ };
+ MenuItem
+ {
+ Identifier = MID_MODELS_EDIT ;
+ HelpId = HID_MN_XFORMS_MODELS_EDIT ;
+ Text [ en-US ] = "~Edit..." ;
+ };
+ MenuItem
+ {
+ Identifier = MID_MODELS_REMOVE ;
+ HelpId = HID_MN_XFORMS_MODELS_REMOVE ;
+ Text [ en-US ] = "~Remove" ;
+ };
+ };
+ };
+ };
+ TabControl TC_ITEMS
+ {
+ HelpId = HID_XFORMS_TAB_CONTROL ;
+ Pos = MAP_APPFONT ( 3, 20 ) ;
+ TabStop = TRUE;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = TID_INSTANCE ;
+ Text [ en-US ] = "Instance";
+ };
+ PageItem
+ {
+ Identifier = TID_SUBMISSION ;
+ Text [ en-US ] = "Submissions";
+ };
+ PageItem
+ {
+ Identifier = TID_BINDINGS ;
+ Text [ en-US ] = "Bindings";
+ };
+ };
+ };
+ MenuButton MB_INSTANCES
+ {
+ HelpId = HID_XFORMS_INSTANCES_MENUBTN ;
+ Pos = MAP_APPFONT ( 69 , 133 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Instances";
+ ButtonMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = MID_INSTANCES_ADD ;
+ HelpId = HID_MN_XFORMS_INSTANCES_ADD ;
+ Text [ en-US ] = "~Add..." ;
+ };
+ MenuItem
+ {
+ Identifier = MID_INSTANCES_EDIT ;
+ HelpId = HID_MN_XFORMS_INSTANCES_EDIT ;
+ Text [ en-US ] = "~Edit..." ;
+ };
+ MenuItem
+ {
+ Identifier = MID_INSTANCES_REMOVE ;
+ HelpId = HID_MN_XFORMS_INSTANCES_REMOVE ;
+ Text [ en-US ] = "~Remove" ;
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = MID_SHOW_DETAILS ;
+ HelpId = HID_MN_XFORMS_SHOW_DETAILS ;
+ Text [ en-US ] = "~Show Details" ;
+ };
+ };
+ };
+ };
+
+#define IMG_LST2 \
+IdList = \
+{ \
+ IID_GROUP_CLOSED ; \
+ IID_GROUP_OPEN ; \
+ IID_ELEMENT ; \
+ IID_ATTRIBUTE ; \
+ IID_TEXT ; \
+ IID_OTHER ; \
+}; \
+IdCount = { 6 ; } ;
+
+ ImageList IL_ITEM_BMPS
+ {
+ Prefix = "da";
+ MASKCOLOR
+ IMG_LST2
+ };
+ ImageList IL_ITEM_BMPS_HC
+ {
+ Prefix = "dah";
+ MASKCOLOR
+ IMG_LST2
+ };
+};
+
+QueryBox RID_QRY_REMOVE_MODEL
+{
+ Buttons = WB_YES_NO ;
+ DefButton = WB_DEF_NO ;
+ Message [ en-US ] = "Deleting the model '$MODELNAME' affects all controls currently bound to this model.\nDo you really want to delete this model?" ;
+};
+
+QueryBox RID_QRY_REMOVE_INSTANCE
+{
+ Buttons = WB_YES_NO ;
+ DefButton = WB_DEF_NO ;
+ Message [ en-US ] = "Deleting the instance '$INSTANCENAME' affects all controls currently bound to this instance.\nDo you really want to delete this instance?" ;
+};
+
+QueryBox RID_QRY_REMOVE_ELEMENT
+{
+ Buttons = WB_YES_NO ;
+ DefButton = WB_DEF_NO ;
+ Message [ en-US ] = "Deleting the element '$ELEMENTNAME' affects all controls currently bound to this element.\nDo you really want to delete this element?" ;
+};
+
+QueryBox RID_QRY_REMOVE_ATTRIBUTE
+{
+ Buttons = WB_YES_NO ;
+ DefButton = WB_DEF_NO ;
+ Message [ en-US ] = "Do you really want to delete the attribute '$ATTRIBUTENAME'?" ;
+};
+
+QueryBox RID_QRY_REMOVE_SUBMISSION
+{
+ Buttons = WB_YES_NO ;
+ DefButton = WB_DEF_NO ;
+ Message [ en-US ] = "Deleting the submission '$SUBMISSIONNAME' affects all controls currently bound to this submission.\n\nDo you really want to delete this submission?" ;
+};
+
+QueryBox RID_QRY_REMOVE_BINDING
+{
+ Buttons = WB_YES_NO ;
+ DefButton = WB_DEF_NO ;
+ Message [ en-US ] = "Deleting the binding '$BINDINGNAME' affects all controls currently bound to this binding.\n\nDo you really want to delete this binding?" ;
+};
+
+MessBox RID_QRY_LINK_WARNING
+{
+ Buttons = 0 ;
+ Message [ en-US ] = "This instance is linked with the form.\n\nThe changes you make to this instance will be lost when the form is reloaded.\n\nHow do you want to proceed?" ;
+};
+
+ErrorBox RID_ERR_INVALID_XMLNAME
+{
+ Buttons = WB_OK ;
+ Message [ en-US ] = "The name '%1' is not valid in XML. Please enter a different name." ;
+};
+
+ErrorBox RID_ERR_INVALID_XMLPREFIX
+{
+ Buttons = WB_OK ;
+ Message [ en-US ] = "The prefix '%1' is not valid in XML. Please enter a different prefix." ;
+};
+
+ErrorBox RID_ERR_DOUBLE_MODELNAME
+{
+ Buttons = WB_OK ;
+ Message [ en-US ] = "The name '%1' already exists. Please enter a new name." ;
+};
+
+ErrorBox RID_ERR_EMPTY_SUBMISSIONNAME
+{
+ Buttons = WB_OK ;
+ Message [ en-US ] = "The submission must have a name." ;
+};
+
+ModalDialog RID_SVXDLG_ADD_DATAITEM
+{
+ HelpID = HID_XFORMS_ADDDATAITEM_DLG ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 180 , 186 ) ;
+ Moveable = TRUE ;
+ FixedLine FL_ITEM
+ {
+ Pos = MAP_APPFONT ( 4 , 3 ) ;
+ Size = MAP_APPFONT ( 172 , 8 ) ;
+ Text [ en-US ] = "Item" ;
+ };
+ FixedText FT_NAME
+ {
+ Pos = MAP_APPFONT ( 6 , 15 ) ;
+ Size = MAP_APPFONT ( 69 , 8 ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "~Name" ;
+ };
+ Edit ED_NAME
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_ADD_DATAITEM:ED_NAME";
+ Pos = MAP_APPFONT ( 78 , 14 ) ;
+ Size = MAP_APPFONT ( 96 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_DEFAULT
+ {
+ Pos = MAP_APPFONT ( 6 , 30 ) ;
+ Size = MAP_APPFONT ( 69 , 8 ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "~Default Value" ;
+ };
+ Edit ED_DEFAULT
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_ADD_DATAITEM:ED_DEFAULT";
+ Pos = MAP_APPFONT ( 78 , 29 ) ;
+ Size = MAP_APPFONT ( 96 , 12 ) ;
+ Border = TRUE ;
+ };
+ PushButton PB_DEFAULT
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_ADD_DATAITEM:PB_DEFAULT";
+ Pos = MAP_APPFONT ( 160 , 29 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ Text = "..." ;
+ };
+ FixedLine FL_SETTINGS
+ {
+ Pos = MAP_APPFONT ( 4 , 44 ) ;
+ Size = MAP_APPFONT ( 172 , 8 ) ;
+ Text [ en-US ] = "Settings" ;
+ };
+ FixedText FT_DATATYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 56 ) ;
+ Size = MAP_APPFONT ( 69 , 8 ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "~Data Type" ;
+ };
+ ListBox LB_DATATYPE
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_ADD_DATAITEM:LB_DATATYPE";
+ Pos = MAP_APPFONT ( 78 , 55 ) ;
+ Size = MAP_APPFONT ( 96 , 45 ) ;
+ Border = TRUE ;
+ DropDown = TRUE;
+ };
+ CheckBox CB_REQUIRED
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_ADD_DATAITEM:CB_REQUIRED";
+ Pos = MAP_APPFONT ( 6 , 72 ) ;
+ Size = MAP_APPFONT ( 69 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Required" ;
+ };
+ PushButton PB_REQUIRED
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_ADD_DATAITEM:PB_REQUIRED";
+ Pos = MAP_APPFONT ( 78 , 70 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Condition" ;
+ };
+ CheckBox CB_RELEVANT
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_ADD_DATAITEM:CB_RELEVANT";
+ Pos = MAP_APPFONT ( 6 , 89 ) ;
+ Size = MAP_APPFONT ( 69 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "R~elevant" ;
+ };
+ PushButton PB_RELEVANT
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_ADD_DATAITEM:PB_RELEVANT";
+ Pos = MAP_APPFONT ( 78 , 87 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Condition" ;
+ };
+ CheckBox CB_CONSTRAINT
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_ADD_DATAITEM:CB_CONSTRAINT";
+ Pos = MAP_APPFONT ( 6 , 106 ) ;
+ Size = MAP_APPFONT ( 69 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Constraint" ;
+ };
+ PushButton PB_CONSTRAINT
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_ADD_DATAITEM:PB_CONSTRAINT";
+ Pos = MAP_APPFONT ( 78 , 104 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Condition" ;
+ };
+ CheckBox CB_READONLY
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_ADD_DATAITEM:CB_READONLY";
+ Pos = MAP_APPFONT ( 6 , 123 ) ;
+ Size = MAP_APPFONT ( 69 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Read-~only" ;
+ };
+ PushButton PB_READONLY
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_ADD_DATAITEM:PB_READONLY";
+ Pos = MAP_APPFONT ( 78 , 121 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Condition" ;
+ };
+ CheckBox CB_CALCULATE
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_ADD_DATAITEM:CB_CALCULATE";
+ Pos = MAP_APPFONT ( 6 , 140 ) ;
+ Size = MAP_APPFONT ( 69 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Calc~ulate" ;
+ };
+ PushButton PB_CALCULATE
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_ADD_DATAITEM:PB_CALCULATE";
+ Pos = MAP_APPFONT ( 78 , 138 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Condition" ;
+ };
+ FixedLine FL_DATANAV_BTN
+ {
+ Pos = MAP_APPFONT ( 4 , 155 ) ;
+ Size = MAP_APPFONT ( 172 , 8 ) ;
+ };
+ OKButton BTN_DATANAV_OK
+ {
+ Pos = MAP_APPFONT ( 15 , 166 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_DATANAV_ESC
+ {
+ Pos = MAP_APPFONT ( 68 , 166 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_DATANAV_HELP
+ {
+ Pos = MAP_APPFONT ( 124 , 166 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ String STR_FIXEDLINE_ELEMENT
+ {
+ Text [ en-US ] = "Element" ;
+ };
+ String STR_FIXEDLINE_ATTRIBUTE
+ {
+ Text [ en-US ] = "Attribute" ;
+ };
+ String STR_FIXEDLINE_BINDING
+ {
+ Text [ en-US ] = "Binding" ;
+ };
+ String STR_FIXEDTEXT_BINDING
+ {
+ Text [ en-US ] = "Binding expression" ;
+ };
+};
+
+Menu RID_MENU_DATANAVIGATOR
+{
+ ItemList =
+ {
+ // MID_INSERT_CONTROL not implemented, yet (#i99890#)
+ /*MenuItem
+ {
+ Identifier = MID_INSERT_CONTROL ;
+ HelpId = HID_XFORMS_MID_INSERT_CONTROL ;
+ Text [ en-US ] = "Insert Control" ;
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };*/
+ MenuItem
+ {
+ Identifier = TBI_ITEM_ADD ;
+ HelpId = HID_XFORMS_TOOLBOX_ITEM_ADD ;
+ Text [ en-US ] = "Add Item" ;
+ };
+ MenuItem
+ {
+ Identifier = TBI_ITEM_ADD_ELEMENT ;
+ HelpId = HID_XFORMS_TOOLBOX_ITEM_ADD_ELEMENT ;
+ Text [ en-US ] = "Add Element" ;
+ };
+ MenuItem
+ {
+ Identifier = TBI_ITEM_ADD_ATTRIBUTE ;
+ HelpId = HID_XFORMS_TOOLBOX_ITEM_ADD_ATTRIBUTE ;
+ Text [ en-US ] = "Add Attribute" ;
+ };
+ MenuItem
+ {
+ Identifier = TBI_ITEM_EDIT ;
+ HelpId = HID_XFORMS_TOOLBOX_ITEM_EDIT ;
+ Text [ en-US ] = "Edit" ;
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = TBI_ITEM_REMOVE ;
+ HelpId = HID_XFORMS_TOOLBOX_ITEM_REMOVE ;
+ Text [ en-US ] = "Delete" ;
+ };
+ };
+};
+
+ModalDialog RID_SVXDLG_ADD_CONDITION
+{
+ HelpID = HID_XFORMS_ADDCONDITION_DLG ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 210 , 150 ) ;
+ Text [ en-US ] = "Add Condition" ;
+ Moveable = TRUE ;
+ FixedText FT_CONDITION
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 198 , 8 ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "~Condition" ;
+ };
+ MultiLineEdit ED_CONDITION
+ {
+ HelpID = "svx:MultiLineEdit:RID_SVXDLG_ADD_CONDITION:ED_CONDITION";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 198 , 34 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ IgnoreTab = TRUE;
+ };
+ FixedText FT_RESULT
+ {
+ Pos = MAP_APPFONT ( 6 , 51 ) ;
+ Size = MAP_APPFONT ( 198 , 8 ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "~Result" ;
+ };
+ FixedText FT_RESULT_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 6 , 62 ) ;
+ Size = MAP_APPFONT ( 198 , 34 ) ;
+ Border = TRUE;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ WordBreak = TRUE ;
+ };
+ PushButton PB_EDIT_NAMESPACES
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_ADD_CONDITION:PB_EDIT_NAMESPACES";
+ Pos = MAP_APPFONT ( 132 , 102 ) ;
+ Size = MAP_APPFONT ( 72 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Edit Namespaces..." ;
+ };
+ FixedLine FL_DATANAV_BTN
+ {
+ Pos = MAP_APPFONT ( 4 , 119 ) ;
+ Size = MAP_APPFONT ( 202 , 8 ) ;
+ };
+ OKButton BTN_DATANAV_OK
+ {
+ Pos = MAP_APPFONT ( 45 , 130 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_DATANAV_ESC
+ {
+ Pos = MAP_APPFONT ( 98 , 130 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_DATANAV_HELP
+ {
+ Pos = MAP_APPFONT ( 154 , 130 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
+
+ModalDialog RID_SVXDLG_NAMESPACE_ITEM
+{
+ HelpID = HID_XFORMS_NAMESPACEITEM_DLG ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 240 , 120 ) ;
+ Text [ en-US ] = "Namespaces for Forms" ;
+ Moveable = TRUE ;
+ FixedText FT_NAMESPACES
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 228 , 8 ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "~Namespaces" ;
+ };
+ Control LB_NAMESPACES
+ {
+ HelpId = HID_XFORMS_NAMESPACEITEM_LIST;
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 175 , 72 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_ADD_NAMESPACE
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_NAMESPACE_ITEM:PB_ADD_NAMESPACE";
+ Pos = MAP_APPFONT ( 184 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Add..." ;
+ };
+ PushButton PB_EDIT_NAMESPACE
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_NAMESPACE_ITEM:PB_EDIT_NAMESPACE";
+ Pos = MAP_APPFONT ( 184 , 31 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Edit..." ;
+ };
+ PushButton PB_DELETE_NAMESPACE
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_NAMESPACE_ITEM:PB_DELETE_NAMESPACE";
+ Pos = MAP_APPFONT ( 184 , 48 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Delete" ;
+ };
+ FixedLine FL_DATANAV_BTN
+ {
+ Pos = MAP_APPFONT ( 4 , 89 ) ;
+ Size = MAP_APPFONT ( 232 , 8 ) ;
+ };
+ OKButton BTN_DATANAV_OK
+ {
+ Pos = MAP_APPFONT ( 75 , 100 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_DATANAV_ESC
+ {
+ Pos = MAP_APPFONT ( 128 , 100 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_DATANAV_HELP
+ {
+ Pos = MAP_APPFONT ( 184 , 100 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ String STR_HEADER_PREFIX
+ {
+ Text [ en-US ] = "Prefix" ;
+ };
+ String STR_HEADER_URL
+ {
+ Text [ en-US ] = "URL" ;
+ };
+};
+
+ModalDialog RID_SVXDLG_MANAGE_NAMESPACE
+{
+ HelpID = HID_XFORMS_MANAGENAMESPACE_DLG ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 210 , 60 ) ;
+ Text [ en-US ] = "Add Namespace" ;
+ Moveable = TRUE ;
+ FixedText FT_PREFIX
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 45 , 8 ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "~Prefix" ;
+ };
+ Edit ED_PREFIX
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_MANAGE_NAMESPACE:ED_PREFIX";
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 45 , 12 ) ;
+ Border = TRUE;
+ };
+ FixedText FT_URL
+ {
+ Pos = MAP_APPFONT ( 54 , 3 ) ;
+ Size = MAP_APPFONT ( 150 , 8 ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "~URL" ;
+ };
+ Edit ED_URL
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_MANAGE_NAMESPACE:ED_URL";
+ Pos = MAP_APPFONT ( 54 , 14 ) ;
+ Size = MAP_APPFONT ( 150 , 12 ) ;
+ Border = TRUE;
+ };
+ FixedLine FL_DATANAV_BTN
+ {
+ Pos = MAP_APPFONT ( 4 , 29 ) ;
+ Size = MAP_APPFONT ( 202 , 8 ) ;
+ };
+ OKButton BTN_DATANAV_OK
+ {
+ Pos = MAP_APPFONT ( 45 , 40 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_DATANAV_ESC
+ {
+ Pos = MAP_APPFONT ( 98 , 40 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_DATANAV_HELP
+ {
+ Pos = MAP_APPFONT ( 154 , 40 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ String STR_EDIT_TEXT
+ {
+ Text [ en-US ] = "Edit Namespace" ;
+ };
+};
+
+ModalDialog RID_SVXDLG_ADD_SUBMISSION
+{
+ HelpID = HID_XFORMS_ADDSUBMISSION_DLG ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 180 , 136 ) ;
+ Text [ en-US ] = "Add Submission" ;
+ Moveable = TRUE ;
+ FixedLine FL_SUBMISSION
+ {
+ Pos = MAP_APPFONT ( 4 , 3 ) ;
+ Size = MAP_APPFONT ( 172 , 8 ) ;
+ Text [ en-US ] = "Submission" ;
+ };
+ FixedText FT_SUBMIT_NAME
+ {
+ Pos = MAP_APPFONT ( 6 , 16 ) ;
+ Size = MAP_APPFONT ( 69 , 8 ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "~Name" ;
+ };
+ Edit ED_SUBMIT_NAME
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_ADD_SUBMISSION:ED_SUBMIT_NAME";
+ Pos = MAP_APPFONT ( 78 , 14 ) ;
+ Size = MAP_APPFONT ( 96 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_SUBMIT_ACTION
+ {
+ Pos = MAP_APPFONT ( 6 , 31 ) ;
+ Size = MAP_APPFONT ( 69 , 8 ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "~Action" ;
+ };
+ Edit ED_SUBMIT_ACTION
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_ADD_SUBMISSION:ED_SUBMIT_ACTION";
+ Pos = MAP_APPFONT ( 78 , 29 ) ;
+ Size = MAP_APPFONT ( 96 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_SUBMIT_METHOD
+ {
+ Pos = MAP_APPFONT ( 6 , 46 ) ;
+ Size = MAP_APPFONT ( 69 , 8 ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "~Method" ;
+ };
+ ListBox LB_SUBMIT_METHOD
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_ADD_SUBMISSION:LB_SUBMIT_METHOD";
+ Pos = MAP_APPFONT ( 78 , 44 ) ;
+ Size = MAP_APPFONT ( 96 , 51 ) ;
+ Border = TRUE ;
+ DropDown = TRUE;
+ };
+ FixedText FT_SUBMIT_REF
+ {
+ Pos = MAP_APPFONT ( 6 , 62 ) ;
+ Size = MAP_APPFONT ( 69 , 8 ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "Binding e~xpression" ;
+ };
+ Edit ED_SUBMIT_REF
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_ADD_SUBMISSION:ED_SUBMIT_REF";
+ Pos = MAP_APPFONT ( 78 , 60 ) ;
+ Size = MAP_APPFONT ( 79, 12 ) ;
+ Border = TRUE ;
+ };
+ PushButton PB_SUBMIT_REF
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_ADD_SUBMISSION:PB_SUBMIT_REF";
+ Pos = MAP_APPFONT ( 159 , 59 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~..." ;
+ };
+ FixedText FT_SUBMIT_BIND
+ {
+ Pos = MAP_APPFONT ( 6 , 77 ) ;
+ Size = MAP_APPFONT ( 69 , 8 ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "~Binding" ;
+ };
+ ListBox LB_SUBMIT_BIND
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_ADD_SUBMISSION:LB_SUBMIT_BIND";
+ Pos = MAP_APPFONT ( 78 , 75 ) ;
+ Size = MAP_APPFONT ( 96 , 51 ) ;
+ Border = TRUE ;
+ DropDown = TRUE;
+ };
+ FixedText FT_SUBMIT_REPLACE
+ {
+ Pos = MAP_APPFONT ( 6 , 92 ) ;
+ Size = MAP_APPFONT ( 69 , 8 ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "~Replace" ;
+ };
+ ListBox LB_SUBMIT_REPLACE
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_ADD_SUBMISSION:LB_SUBMIT_REPLACE";
+ Pos = MAP_APPFONT ( 78 , 90 ) ;
+ Size = MAP_APPFONT ( 96 , 51 ) ;
+ Border = TRUE ;
+ DropDown = TRUE;
+ };
+ FixedLine FL_DATANAV_BTN
+ {
+ Pos = MAP_APPFONT ( 4 , 105 ) ;
+ Size = MAP_APPFONT ( 172 , 8 ) ;
+ };
+ OKButton BTN_DATANAV_OK
+ {
+ Pos = MAP_APPFONT ( 15 , 116 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_DATANAV_ESC
+ {
+ Pos = MAP_APPFONT ( 68 , 116 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_DATANAV_HELP
+ {
+ Pos = MAP_APPFONT ( 124 , 116 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+
+ String STR_METHOD_POST
+ {
+ Text [ en-US ] = "Post" ;
+ };
+ String STR_METHOD_PUT
+ {
+ Text [ en-US ] = "Put" ;
+ };
+ String STR_METHOD_GET
+ {
+ Text [ en-US ] = "Get" ;
+ };
+ String STR_REPLACE_NONE
+ {
+ Text [ en-US ] = "None" ;
+ };
+ String STR_REPLACE_INST
+ {
+ Text [ en-US ] = "Instance" ;
+ };
+ String STR_REPLACE_DOC
+ {
+ Text [ en-US ] = "Document" ;
+ };
+};
+
+ModalDialog RID_SVXDLG_ADD_MODEL
+{
+ HelpID = HID_XFORMS_ADDMODEL_DLG ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 180 , 82 ) ;
+ Text [ en-US ] = "Add Model" ;
+ Moveable = TRUE ;
+ FixedLine FL_INSTANCE
+ {
+ Pos = MAP_APPFONT ( 4 , 3 ) ;
+ Size = MAP_APPFONT ( 172 , 8 ) ;
+ Text [ en-US ] = "Model" ;
+ };
+ FixedText FT_INST_NAME
+ {
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 51 , 12 ) ;
+ LeftLabel = TRUE ;
+ VCenter = TRUE;
+ Text [ en-US ] = "~Name" ;
+ };
+ Edit ED_INST_NAME
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_ADD_MODEL:ED_INST_NAME";
+ Pos = MAP_APPFONT ( 60 , 14 ) ;
+ Size = MAP_APPFONT ( 114 , 12 ) ;
+ Border = TRUE ;
+ };
+ CheckBox CB_MODIFIES_DOCUMENT
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_ADD_MODEL:CB_MODIFIES_DOCUMENT";
+ Pos = MAP_APPFONT( 6, 32 );
+ Size = MAP_APPFONT( 168, 16 );
+ Top = TRUE;
+ WordBreak = TRUE;
+
+ Text [ en-US ] = "Model data updates change document's modification status";
+ };
+ FixedLine FL_DATANAV_BTN
+ {
+ Pos = MAP_APPFONT ( 4 , 51 ) ;
+ Size = MAP_APPFONT ( 172 , 8 ) ;
+ };
+ OKButton BTN_DATANAV_OK
+ {
+ Pos = MAP_APPFONT ( 15 , 62 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_DATANAV_ESC
+ {
+ Pos = MAP_APPFONT ( 68 , 62 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_DATANAV_HELP
+ {
+ Pos = MAP_APPFONT ( 124 , 62 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ String STR_EDIT_TEXT
+ {
+ Text [ en-US ] = "Edit Model" ;
+ };
+};
+
+ModalDialog RID_SVXDLG_ADD_INSTANCE
+{
+ HelpID = HID_XFORMS_ADDINSTANCE_DLG ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 210 , 88 ) ;
+ Text [ en-US ] = "Add Instance" ;
+ Moveable = TRUE ;
+ FixedLine FL_INSTANCE
+ {
+ Pos = MAP_APPFONT ( 4 , 3 ) ;
+ Size = MAP_APPFONT ( 202 , 8 ) ;
+ Text [ en-US ] = "Instance" ;
+ };
+ FixedText FT_INST_NAME
+ {
+ Pos = MAP_APPFONT ( 6 , 15 ) ;
+ Size = MAP_APPFONT ( 51 , 8 ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "~Name" ;
+ };
+ Edit ED_INST_NAME
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_ADD_INSTANCE:ED_INST_NAME";
+ Pos = MAP_APPFONT ( 60 , 14 ) ;
+ Size = MAP_APPFONT ( 144 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_INST_URL
+ {
+ Pos = MAP_APPFONT ( 6 , 30 ) ;
+ Size = MAP_APPFONT ( 51 , 8 ) ;
+ LeftLabel = TRUE ;
+ Text [ en-US ] = "~URL" ;
+ };
+ ComboBox ED_INST_URL
+ {
+ HelpID = "svx:ComboBox:RID_SVXDLG_ADD_INSTANCE:ED_INST_URL";
+ Pos = MAP_APPFONT ( 60 , 29 ) ;
+ Size = MAP_APPFONT ( 127 , 48 ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ };
+ PushButton PB_FILEPICKER
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_ADD_INSTANCE:PB_FILEPICKER";
+ Pos = MAP_APPFONT ( 190 , 28 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ TabStop = TRUE ;
+ Text = "~..." ;
+ };
+ CheckBox CB_INST_LINKINST
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_ADD_INSTANCE:CB_INST_LINKINST";
+ Pos = MAP_APPFONT ( 6 , 44 ) ;
+ Size = MAP_APPFONT ( 198 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Link instance" ;
+ };
+ FixedLine FL_DATANAV_BTN
+ {
+ Pos = MAP_APPFONT ( 4 , 57 ) ;
+ Size = MAP_APPFONT ( 202 , 8 ) ;
+ };
+ OKButton BTN_DATANAV_OK
+ {
+ Pos = MAP_APPFONT ( 45 , 68 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_DATANAV_ESC
+ {
+ Pos = MAP_APPFONT ( 98 , 68 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_DATANAV_HELP
+ {
+ Pos = MAP_APPFONT ( 154 , 68 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ String STR_EDIT_TEXT
+ {
+ Text [ en-US ] = "Edit Instance" ;
+ };
+};
+
+String RID_STR_DATANAV_SUBM_PARENT
+{
+ Text [ en-US ] = "Submission: " ;
+};
+String RID_STR_DATANAV_SUBM_ID
+{
+ Text [ en-US ] = "ID: " ;
+};
+String RID_STR_DATANAV_SUBM_BIND
+{
+ Text [ en-US ] = "Binding: " ;
+};
+String RID_STR_DATANAV_SUBM_REF
+{
+ Text [ en-US ] = "Reference: " ;
+};
+String RID_STR_DATANAV_SUBM_ACTION
+{
+ Text [ en-US ] = "Action: " ;
+};
+String RID_STR_DATANAV_SUBM_METHOD
+{
+ Text [ en-US ] = "Method: " ;
+};
+String RID_STR_DATANAV_SUBM_REPLACE
+{
+ Text [ en-US ] = "Replace: " ;
+};
+String RID_STR_DATANAV_ADD_ELEMENT
+{
+ Text [ en-US ] = "Add Element" ;
+};
+String RID_STR_DATANAV_EDIT_ELEMENT
+{
+ Text [ en-US ] = "Edit Element" ;
+};
+String RID_STR_DATANAV_REMOVE_ELEMENT
+{
+ Text [ en-US ] = "Delete Element" ;
+};
+String RID_STR_DATANAV_ADD_ATTRIBUTE
+{
+ Text [ en-US ] = "Add Attribute" ;
+};
+String RID_STR_DATANAV_EDIT_ATTRIBUTE
+{
+ Text [ en-US ] = "Edit Attribute" ;
+};
+String RID_STR_DATANAV_REMOVE_ATTRIBUTE
+{
+ Text [ en-US ] = "Delete Attribute" ;
+};
+String RID_STR_DATANAV_ADD_BINDING
+{
+ Text [ en-US ] = "Add Binding" ;
+};
+String RID_STR_DATANAV_EDIT_BINDING
+{
+ Text [ en-US ] = "Edit Binding" ;
+};
+String RID_STR_DATANAV_REMOVE_BINDING
+{
+ Text [ en-US ] = "Delete Binding" ;
+};
+String RID_STR_DATANAV_ADD_SUBMISSION
+{
+ Text [ en-US ] = "Add Submission" ;
+};
+String RID_STR_DATANAV_EDIT_SUBMISSION
+{
+ Text [ en-US ] = "Edit Submission" ;
+};
+String RID_STR_DATANAV_REMOVE_SUBMISSION
+{
+ Text [ en-US ] = "Delete Submission" ;
+};
+String RID_STR_DATANAV_LINKWARN_BUTTON
+{
+ Text [ en-US ] = "~Edit" ;
+};
+
diff --git a/svx/source/form/dbcharsethelper.cxx b/svx/source/form/dbcharsethelper.cxx
new file mode 100644
index 000000000000..5566493ca264
--- /dev/null
+++ b/svx/source/form/dbcharsethelper.cxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "svx/dbcharsethelper.hxx"
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ //====================================================================
+ //= ODataAccessCharsetHelper
+ //====================================================================
+ //--------------------------------------------------------------------
+ ODataAccessCharsetHelper::ODataAccessCharsetHelper( )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ bool ODataAccessCharsetHelper::ensureLoaded() const
+ {
+ if ( !ODbtoolsClient::ensureLoaded() )
+ return false;
+ m_xCharsetHelper = getFactory()->createCharsetHelper( );
+ return m_xCharsetHelper.is();
+ }
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
+
+
diff --git a/svx/source/form/dbtoolsclient.cxx b/svx/source/form/dbtoolsclient.cxx
new file mode 100644
index 000000000000..6cc874112e94
--- /dev/null
+++ b/svx/source/form/dbtoolsclient.cxx
@@ -0,0 +1,366 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdbc/XDataSource.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/sdb/SQLContext.hpp>
+#include "svx/dbtoolsclient.hxx"
+#include <osl/diagnose.h>
+#include <connectivity/formattedcolumnvalue.hxx>
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ using namespace ::connectivity::simple;
+ using namespace ::com::sun::star::sdbc;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::util;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::sdb;
+ using namespace ::com::sun::star::container;
+
+ //====================================================================
+ //= ODbtoolsClient
+ //====================================================================
+ ::osl::Mutex ODbtoolsClient::s_aMutex;
+ sal_Int32 ODbtoolsClient::s_nClients = 0;
+ oslModule ODbtoolsClient::s_hDbtoolsModule = NULL;
+ createDataAccessToolsFactoryFunction
+ ODbtoolsClient::s_pFactoryCreationFunc = NULL;
+
+ //--------------------------------------------------------------------
+ ODbtoolsClient::ODbtoolsClient()
+ {
+ m_bCreateAlready = sal_False;
+ }
+
+ //--------------------------------------------------------------------
+ bool ODbtoolsClient::ensureLoaded() const
+ {
+ if ( !m_bCreateAlready )
+ {
+ m_bCreateAlready = true;
+
+ registerClient();
+ if ( s_pFactoryCreationFunc )
+ { // loading the lib succeeded
+ void* pUntypedFactory = (*s_pFactoryCreationFunc)();
+ IDataAccessToolsFactory* pDBTFactory = static_cast< IDataAccessToolsFactory* >( pUntypedFactory );
+ OSL_ENSURE( pDBTFactory, "ODbtoolsClient::ODbtoolsClient: no factory returned!" );
+ if ( pDBTFactory )
+ {
+ m_xDataAccessFactory = pDBTFactory;
+ // by definition, the factory was aquired once
+ m_xDataAccessFactory->release();
+ }
+ }
+ }
+ return m_xDataAccessFactory.is();
+ }
+
+ //--------------------------------------------------------------------
+ ODbtoolsClient::~ODbtoolsClient()
+ {
+ // clear the factory _before_ revoking the client
+ // (the revocation may unload the DBT lib)
+ m_xDataAccessFactory = NULL;
+ // revoke the client
+ if ( m_bCreateAlready )
+ revokeClient();
+ }
+
+ //--------------------------------------------------------------------
+ extern "C" { static void SAL_CALL thisModule() {} }
+
+ void ODbtoolsClient::registerClient()
+ {
+ ::osl::MutexGuard aGuard(s_aMutex);
+ if (1 == ++s_nClients)
+ {
+ OSL_ENSURE(NULL == s_hDbtoolsModule, "ODbtoolsClient::registerClient: inconsistence: already have a module!");
+ OSL_ENSURE(NULL == s_pFactoryCreationFunc, "ODbtoolsClient::registerClient: inconsistence: already have a factory function!");
+
+ const ::rtl::OUString sModuleName = ::rtl::OUString::createFromAscii(
+ SVLIBRARY( "dbtools" )
+ );
+
+ // load the dbtools library
+ s_hDbtoolsModule = osl_loadModuleRelative(
+ &thisModule, sModuleName.pData, 0);
+ OSL_ENSURE(NULL != s_hDbtoolsModule, "ODbtoolsClient::registerClient: could not load the dbtools library!");
+ if (NULL != s_hDbtoolsModule)
+ {
+ // get the symbol for the method creating the factory
+ const ::rtl::OUString sFactoryCreationFunc = ::rtl::OUString::createFromAscii("createDataAccessToolsFactory");
+ // reinterpret_cast<createDataAccessToolsFactoryFunction>
+ s_pFactoryCreationFunc = (createDataAccessToolsFactoryFunction)(
+ osl_getFunctionSymbol(s_hDbtoolsModule, sFactoryCreationFunc.pData));
+
+ if (NULL == s_pFactoryCreationFunc)
+ { // did not find the symbol
+ OSL_ENSURE(sal_False, "ODbtoolsClient::registerClient: could not find the symbol for creating the factory!");
+ osl_unloadModule(s_hDbtoolsModule);
+ s_hDbtoolsModule = NULL;
+ }
+ }
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void ODbtoolsClient::revokeClient()
+ {
+ ::osl::MutexGuard aGuard(s_aMutex);
+ if (0 == --s_nClients)
+ {
+ s_pFactoryCreationFunc = NULL;
+ if (s_hDbtoolsModule)
+ osl_unloadModule(s_hDbtoolsModule);
+ s_hDbtoolsModule = NULL;
+ }
+
+ OSL_ENSURE(s_nClients >= 0,"Illegall call of revokeClient()");
+ }
+
+ //====================================================================
+ //= OStaticDataAccessTools
+ //====================================================================
+ //--------------------------------------------------------------------
+ OStaticDataAccessTools::OStaticDataAccessTools()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ //add by BerryJia for fixing Bug97420 Time:2002-9-12-11:00(PRC time)
+ bool OStaticDataAccessTools::ensureLoaded() const
+ {
+ if ( !ODbtoolsClient::ensureLoaded() )
+ return false;
+ m_xDataAccessTools = getFactory()->getDataAccessTools();
+ return m_xDataAccessTools.is();
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XNumberFormatsSupplier > OStaticDataAccessTools::getNumberFormats(const Reference< XConnection>& _rxConn, sal_Bool _bAllowDefault) const
+ {
+ Reference< XNumberFormatsSupplier > xReturn;
+ if ( ensureLoaded() )
+ xReturn = m_xDataAccessTools->getNumberFormats(_rxConn, _bAllowDefault);
+ return xReturn;
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int32 OStaticDataAccessTools::getDefaultNumberFormat( const Reference< XPropertySet >& _xColumn, const Reference< XNumberFormatTypes >& _xTypes, const Locale& _rLocale )
+ {
+ sal_Int32 nReturn = 0;
+ if ( ensureLoaded() )
+ nReturn = m_xDataAccessTools->getDefaultNumberFormat( _xColumn, _xTypes, _rLocale );
+ return nReturn;
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XConnection> OStaticDataAccessTools::getConnection_withFeedback(const ::rtl::OUString& _rDataSourceName,
+ const ::rtl::OUString& _rUser, const ::rtl::OUString& _rPwd, const Reference< XMultiServiceFactory>& _rxFactory) const
+ SAL_THROW ( (SQLException) )
+ {
+ Reference< XConnection > xReturn;
+ if ( ensureLoaded() )
+ xReturn = m_xDataAccessTools->getConnection_withFeedback(_rDataSourceName, _rUser, _rPwd, _rxFactory);
+ return xReturn;
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XConnection > OStaticDataAccessTools::connectRowset( const Reference< XRowSet >& _rxRowSet,
+ const Reference< XMultiServiceFactory >& _rxFactory, sal_Bool _bSetAsActiveConnection ) const
+ SAL_THROW ( ( SQLException, WrappedTargetException, RuntimeException ) )
+ {
+ Reference< XConnection > xReturn;
+ if ( ensureLoaded() )
+ xReturn = m_xDataAccessTools->connectRowset( _rxRowSet, _rxFactory, _bSetAsActiveConnection );
+ return xReturn;
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XConnection > OStaticDataAccessTools::getRowSetConnection(const Reference< XRowSet >& _rxRowSet) const SAL_THROW ( (RuntimeException) )
+ {
+ Reference< XConnection > xReturn;
+ if ( ensureLoaded() )
+ xReturn = m_xDataAccessTools->getRowSetConnection(_rxRowSet);
+ return xReturn;
+ }
+
+ //--------------------------------------------------------------------
+ void OStaticDataAccessTools::TransferFormComponentProperties(const Reference< XPropertySet>& _rxOld,
+ const Reference< XPropertySet>& _rxNew, const Locale& _rLocale) const
+ {
+ if ( ensureLoaded() )
+ m_xDataAccessTools->TransferFormComponentProperties(_rxOld, _rxNew, _rLocale);
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString OStaticDataAccessTools::quoteName(const ::rtl::OUString& _rQuote, const ::rtl::OUString& _rName) const
+ {
+ ::rtl::OUString sReturn;
+ if ( ensureLoaded() )
+ sReturn = m_xDataAccessTools->quoteName(_rQuote, _rName);
+ return sReturn;
+ }
+
+ // ------------------------------------------------
+ ::rtl::OUString OStaticDataAccessTools::composeTableNameForSelect( const Reference< XConnection >& _rxConnection, const Reference< XPropertySet>& _xTable ) const
+ {
+ ::rtl::OUString sReturn;
+ if ( ensureLoaded() )
+ sReturn = m_xDataAccessTools->composeTableNameForSelect( _rxConnection, _xTable );
+ return sReturn;
+ }
+
+ //--------------------------------------------------------------------
+ SQLContext OStaticDataAccessTools::prependContextInfo(SQLException& _rException, const Reference< XInterface >& _rxContext,
+ const ::rtl::OUString& _rContextDescription, const ::rtl::OUString& _rContextDetails) const
+ {
+ SQLContext aReturn;
+ if ( ensureLoaded() )
+ aReturn = m_xDataAccessTools->prependContextInfo(_rException, _rxContext, _rContextDescription, _rContextDetails);
+ return aReturn;
+ }
+
+ //----------------------------------------------------------------
+ Reference< XDataSource > OStaticDataAccessTools::getDataSource( const ::rtl::OUString& _rsRegisteredName, const Reference< XMultiServiceFactory>& _rxFactory ) const
+ {
+ Reference< XDataSource > xReturn;
+ if ( ensureLoaded() )
+ xReturn = m_xDataAccessTools->getDataSource(_rsRegisteredName,_rxFactory);
+ return xReturn;
+ }
+
+ //----------------------------------------------------------------
+ sal_Bool OStaticDataAccessTools::canInsert(const Reference< XPropertySet>& _rxCursorSet) const
+ {
+ sal_Bool bRet = sal_False;
+ if ( ensureLoaded() )
+ bRet = m_xDataAccessTools->canInsert( _rxCursorSet );
+ return bRet;
+ }
+
+ //----------------------------------------------------------------
+ sal_Bool OStaticDataAccessTools::canUpdate(const Reference< XPropertySet>& _rxCursorSet) const
+ {
+ sal_Bool bRet = sal_False;
+ if ( ensureLoaded() )
+ bRet = m_xDataAccessTools->canUpdate( _rxCursorSet );
+ return bRet;
+ }
+
+ //----------------------------------------------------------------
+ sal_Bool OStaticDataAccessTools::canDelete(const Reference< XPropertySet>& _rxCursorSet) const
+ {
+ sal_Bool bRet = sal_False;
+ if ( ensureLoaded() )
+ bRet = m_xDataAccessTools->canDelete( _rxCursorSet );
+ return bRet;
+ }
+
+ //----------------------------------------------------------------
+ Reference< XNameAccess > OStaticDataAccessTools::getFieldsByCommandDescriptor( const Reference< XConnection >& _rxConnection,
+ const sal_Int32 _nCommandType, const ::rtl::OUString& _rCommand,
+ Reference< XComponent >& _rxKeepFieldsAlive, ::dbtools::SQLExceptionInfo* _pErrorInfo ) SAL_THROW( ( ) )
+ {
+ Reference< XNameAccess > aFields;
+ if ( ensureLoaded() )
+ aFields = m_xDataAccessTools->getFieldsByCommandDescriptor( _rxConnection, _nCommandType,
+ _rCommand, _rxKeepFieldsAlive, _pErrorInfo );
+
+ return aFields;
+ }
+
+ //----------------------------------------------------------------
+ Sequence< ::rtl::OUString > OStaticDataAccessTools::getFieldNamesByCommandDescriptor(
+ const Reference< XConnection >& _rxConnection, const sal_Int32 _nCommandType,
+ const ::rtl::OUString& _rCommand, ::dbtools::SQLExceptionInfo* _pErrorInfo ) SAL_THROW( ( ) )
+ {
+ Sequence< ::rtl::OUString > aNames;
+ if ( ensureLoaded() )
+ aNames = m_xDataAccessTools->getFieldNamesByCommandDescriptor( _rxConnection, _nCommandType,
+ _rCommand, _pErrorInfo );
+ return aNames;
+ }
+
+ //----------------------------------------------------------------
+ bool OStaticDataAccessTools::isEmbeddedInDatabase( const Reference< XInterface >& _rxComponent, Reference< XConnection >& _rxActualConnection )
+ {
+ bool bReturn = false;
+ if ( ensureLoaded() )
+ bReturn = m_xDataAccessTools->isEmbeddedInDatabase( _rxComponent, _rxActualConnection );
+ return bReturn;
+ }
+
+ //----------------------------------------------------------------
+ bool OStaticDataAccessTools::isEmbeddedInDatabase( const Reference< XInterface >& _rxComponent )
+ {
+ bool bReturn = false;
+ if ( ensureLoaded() )
+ {
+ Reference< XConnection > xDummy;
+ bReturn = m_xDataAccessTools->isEmbeddedInDatabase( _rxComponent, xDummy );
+ }
+ return bReturn;
+ }
+
+ //====================================================================
+ //= DBToolsObjectFactory
+ //====================================================================
+ //----------------------------------------------------------------
+ DBToolsObjectFactory::DBToolsObjectFactory()
+ {
+ }
+
+ //----------------------------------------------------------------
+ DBToolsObjectFactory::~DBToolsObjectFactory()
+ {
+ }
+
+ //----------------------------------------------------------------
+ ::std::auto_ptr< ::dbtools::FormattedColumnValue > DBToolsObjectFactory::createFormattedColumnValue(
+ const ::comphelper::ComponentContext& _rContext, const Reference< XRowSet >& _rxRowSet, const Reference< XPropertySet >& _rxColumn )
+ {
+ ::std::auto_ptr< ::dbtools::FormattedColumnValue > pValue;
+ if ( ensureLoaded() )
+ pValue = getFactory()->createFormattedColumnValue( _rContext, _rxRowSet, _rxColumn );
+ return pValue;
+ }
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
+
diff --git a/svx/source/form/delayedevent.cxx b/svx/source/form/delayedevent.cxx
new file mode 100644
index 000000000000..630a81fd521e
--- /dev/null
+++ b/svx/source/form/delayedevent.cxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#include "precompiled_svx.hxx"
+
+#include "delayedevent.hxx"
+
+#include <osl/diagnose.h>
+#include <vcl/svapp.hxx>
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ //====================================================================
+ //= DelayedEvent
+ //====================================================================
+ //--------------------------------------------------------------------
+ void DelayedEvent::Call( void* _pArg )
+ {
+ CancelPendingCall();
+ OSL_POSTCOND( m_nEventId == 0, "DelayedEvent::Call: CancelPendingCall did not work!" );
+
+ m_nEventId = Application::PostUserEvent( LINK( this, DelayedEvent, OnCall ), _pArg );
+ }
+
+ //--------------------------------------------------------------------
+ void DelayedEvent::CancelPendingCall()
+ {
+ if ( m_nEventId )
+ Application::RemoveUserEvent( m_nEventId );
+ m_nEventId = 0;
+ }
+
+ //--------------------------------------------------------------------
+ IMPL_LINK( DelayedEvent, OnCall, void*, _pArg )
+ {
+ m_nEventId = 0;
+ return m_aHandler.Call( _pArg );
+ }
+
+//........................................................................
+} // namespace svxform
+//........................................................................
diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
new file mode 100644
index 000000000000..d9f64d068cbb
--- /dev/null
+++ b/svx/source/form/filtnav.cxx
@@ -0,0 +1,2085 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+
+#include "filtnav.hxx"
+#include "fmexch.hxx"
+#include "fmhelp.hrc"
+#include "fmitems.hxx"
+#include "fmprop.hrc"
+#include "svx/fmresids.hrc"
+#include "gridcell.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/form/runtime/XFormController.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/processfactory.hxx>
+#include <svx/fmtools.hxx>
+#include <comphelper/property.hxx>
+#include <comphelper/sequence.hxx>
+#include <comphelper/uno3.hxx>
+#include <connectivity/dbtools.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <fmservs.hxx>
+#include <fmshimp.hxx>
+#include <rtl/logfile.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objitem.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/request.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/fmshell.hxx>
+#include <svx/svxids.hrc>
+#include <tools/shl.hxx>
+#include <vcl/wrkwin.hxx>
+
+#include <functional>
+
+#define SYNC_DELAY 200
+#define DROP_ACTION_TIMER_INITIAL_TICKS 10
+ // solange dauert es, bis das Scrollen anspringt
+#define DROP_ACTION_TIMER_SCROLL_TICKS 3
+ // in diesen Intervallen wird jeweils eine Zeile gescrollt
+#define DROP_ACTION_TIMER_TICK_BASE 10
+ // das ist die Basis, mit der beide Angaben multipliziert werden (in ms)
+
+using namespace ::svxform;
+using namespace ::connectivity::simple;
+using namespace ::connectivity;
+
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::lang::XMultiServiceFactory;
+ using ::com::sun::star::awt::TextEvent;
+ using ::com::sun::star::container::XIndexAccess;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::beans::XPropertySet;
+ using ::com::sun::star::form::runtime::XFormController;
+ using ::com::sun::star::form::runtime::XFilterController;
+ using ::com::sun::star::form::runtime::XFilterControllerListener;
+ using ::com::sun::star::form::runtime::FilterEvent;
+ using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::form::XForm;
+ using ::com::sun::star::container::XChild;
+ using ::com::sun::star::awt::XControl;
+ using ::com::sun::star::sdbc::XConnection;
+ using ::com::sun::star::util::XNumberFormatsSupplier;
+ using ::com::sun::star::beans::XPropertySet;
+ using ::com::sun::star::util::XNumberFormatter;
+ using ::com::sun::star::sdbc::XRowSet;
+ using ::com::sun::star::lang::Locale;
+ using ::com::sun::star::sdb::SQLContext;
+ using ::com::sun::star::uno::XInterface;
+ 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::awt::XTextComponent;
+ using ::com::sun::star::uno::Sequence;
+ /** === end UNO using === **/
+
+//========================================================================
+OFilterItemExchange::OFilterItemExchange()
+{
+}
+
+//------------------------------------------------------------------------
+void OFilterItemExchange::AddSupportedFormats()
+{
+ AddFormat(getFormatId());
+}
+
+//------------------------------------------------------------------------
+sal_uInt32 OFilterItemExchange::getFormatId()
+{
+ static sal_uInt32 s_nFormat = (sal_uInt32)-1;
+ if ((sal_uInt32)-1 == s_nFormat)
+ {
+ s_nFormat = SotExchange::RegisterFormatName(String::CreateFromAscii("application/x-openoffice;windows_formatname=\"form.FilterControlExchange\""));
+ DBG_ASSERT((sal_uInt32)-1 != s_nFormat, "OFilterExchangeHelper::getFormatId: bad exchange id!");
+ }
+ return s_nFormat;
+}
+
+//------------------------------------------------------------------------
+OLocalExchange* OFilterExchangeHelper::createExchange() const
+{
+ return new OFilterItemExchange;
+}
+
+//========================================================================
+TYPEINIT0(FmFilterData);
+Image FmFilterData::GetImage( BmpColorMode /*_eMode*/ ) const
+{
+ return Image();
+}
+
+//========================================================================
+TYPEINIT1(FmParentData, FmFilterData);
+//------------------------------------------------------------------------
+FmParentData::~FmParentData()
+{
+ for (::std::vector<FmFilterData*>::const_iterator i = m_aChildren.begin();
+ i != m_aChildren.end(); i++)
+ delete (*i);
+}
+
+//========================================================================
+TYPEINIT1(FmFormItem, FmParentData);
+//------------------------------------------------------------------------
+Image FmFormItem::GetImage( BmpColorMode _eMode ) const
+{
+ static Image aImage;
+ static Image aImage_HC;
+
+ if (!aImage)
+ {
+ ImageList aNavigatorImages( SVX_RES( RID_SVXIMGLIST_FMEXPL ) );
+ ImageList aNavigatorImages_HC( SVX_RES( RID_SVXIMGLIST_FMEXPL_HC ) );
+
+ aImage = aNavigatorImages.GetImage( RID_SVXIMG_FORM );
+ aImage_HC = aNavigatorImages_HC.GetImage( RID_SVXIMG_FORM );
+ }
+ return ( BMP_COLOR_HIGHCONTRAST == _eMode ) ? aImage_HC : aImage;
+}
+
+//========================================================================
+TYPEINIT1(FmFilterItems, FmParentData);
+//------------------------------------------------------------------------
+FmFilterItem* FmFilterItems::Find( const ::sal_Int32 _nFilterComponentIndex ) const
+{
+ for ( ::std::vector< FmFilterData* >::const_iterator i = m_aChildren.begin();
+ i != m_aChildren.end();
+ ++i
+ )
+ {
+ FmFilterItem* pCondition = PTR_CAST( FmFilterItem, *i );
+ DBG_ASSERT( pCondition, "FmFilterItems::Find: Wrong element in container!" );
+ if ( _nFilterComponentIndex == pCondition->GetComponentIndex() )
+ return pCondition;
+ }
+ return NULL;
+}
+
+//------------------------------------------------------------------------
+Image FmFilterItems::GetImage( BmpColorMode _eMode ) const
+{
+ static Image aImage;
+ static Image aImage_HC;
+
+ if (!aImage)
+ {
+ ImageList aNavigatorImages( SVX_RES( RID_SVXIMGLIST_FMEXPL ) );
+ ImageList aNavigatorImages_HC( SVX_RES( RID_SVXIMGLIST_FMEXPL_HC ) );
+
+ aImage = aNavigatorImages.GetImage( RID_SVXIMG_FILTER );
+ aImage_HC = aNavigatorImages_HC.GetImage( RID_SVXIMG_FILTER );
+ }
+ return ( BMP_COLOR_HIGHCONTRAST == _eMode ) ? aImage_HC : aImage;
+}
+
+//========================================================================
+TYPEINIT1(FmFilterItem, FmFilterData);
+//------------------------------------------------------------------------
+FmFilterItem::FmFilterItem( const Reference< XMultiServiceFactory >& _rxFactory,
+ FmFilterItems* pParent,
+ const ::rtl::OUString& aFieldName,
+ const ::rtl::OUString& aText,
+ const sal_Int32 _nComponentIndex )
+ :FmFilterData(_rxFactory,pParent, aText)
+ ,m_aFieldName(aFieldName)
+ ,m_nComponentIndex( _nComponentIndex )
+{
+}
+
+//------------------------------------------------------------------------
+Image FmFilterItem::GetImage( BmpColorMode _eMode ) const
+{
+ static Image aImage;
+ static Image aImage_HC;
+
+ if (!aImage)
+ {
+ ImageList aNavigatorImages( SVX_RES( RID_SVXIMGLIST_FMEXPL ) );
+ ImageList aNavigatorImages_HC( SVX_RES( RID_SVXIMGLIST_FMEXPL_HC ) );
+
+ aImage = aNavigatorImages.GetImage( RID_SVXIMG_FIELD );
+ aImage_HC = aNavigatorImages_HC.GetImage( RID_SVXIMG_FIELD );
+ }
+ return ( BMP_COLOR_HIGHCONTRAST == _eMode ) ? aImage_HC : aImage;
+}
+
+//========================================================================
+// Hints for communicatition between model and view
+//========================================================================
+class FmFilterHint : public SfxHint
+{
+ FmFilterData* m_pData;
+
+public:
+ TYPEINFO();
+ FmFilterHint(FmFilterData* pData):m_pData(pData){}
+ FmFilterData* GetData() const { return m_pData; }
+};
+TYPEINIT1( FmFilterHint, SfxHint );
+
+//========================================================================
+class FmFilterInsertedHint : public FmFilterHint
+{
+ sal_Int32 m_nPos; // Position relative to the parent of the data
+
+public:
+ TYPEINFO();
+ FmFilterInsertedHint(FmFilterData* pData, sal_Int32 nRelPos)
+ :FmFilterHint(pData)
+ ,m_nPos(nRelPos){}
+
+ sal_Int32 GetPos() const { return m_nPos; }
+};
+TYPEINIT1( FmFilterInsertedHint, FmFilterHint );
+
+//========================================================================
+class FmFilterRemovedHint : public FmFilterHint
+{
+public:
+ TYPEINFO();
+ FmFilterRemovedHint(FmFilterData* pData)
+ :FmFilterHint(pData){}
+
+};
+TYPEINIT1( FmFilterRemovedHint, FmFilterHint );
+
+//========================================================================
+class FmFilterTextChangedHint : public FmFilterHint
+{
+public:
+ TYPEINFO();
+ FmFilterTextChangedHint(FmFilterData* pData)
+ :FmFilterHint(pData){}
+
+};
+TYPEINIT1( FmFilterTextChangedHint, FmFilterHint );
+
+//========================================================================
+class FilterClearingHint : public SfxHint
+{
+public:
+ TYPEINFO();
+ FilterClearingHint(){}
+};
+TYPEINIT1( FilterClearingHint, SfxHint );
+
+//========================================================================
+class FmFilterCurrentChangedHint : public SfxHint
+{
+public:
+ TYPEINFO();
+ FmFilterCurrentChangedHint(){}
+};
+TYPEINIT1( FmFilterCurrentChangedHint, SfxHint );
+
+//========================================================================
+// class FmFilterAdapter, Listener an den FilterControls
+//========================================================================
+class FmFilterAdapter : public ::cppu::WeakImplHelper1< XFilterControllerListener >
+{
+ FmFilterModel* m_pModel;
+ Reference< XIndexAccess > m_xControllers;
+
+public:
+ FmFilterAdapter(FmFilterModel* pModel, const Reference< XIndexAccess >& xControllers);
+
+// XEventListener
+ virtual void SAL_CALL disposing(const EventObject& Source) throw( RuntimeException );
+
+// XFilterControllerListener
+ virtual void SAL_CALL predicateExpressionChanged( const FilterEvent& _Event ) throw (RuntimeException);
+ virtual void SAL_CALL disjunctiveTermRemoved( const FilterEvent& _Event ) throw (RuntimeException);
+ virtual void SAL_CALL disjunctiveTermAdded( const FilterEvent& _Event ) throw (RuntimeException);
+
+// helpers
+ void dispose() throw( RuntimeException );
+
+ void AddOrRemoveListener( const Reference< XIndexAccess >& _rxControllers, const bool _bAdd );
+
+ void setText(sal_Int32 nPos,
+ const FmFilterItem* pFilterItem,
+ const ::rtl::OUString& rText);
+};
+
+//------------------------------------------------------------------------
+FmFilterAdapter::FmFilterAdapter(FmFilterModel* pModel, const Reference< XIndexAccess >& xControllers)
+ :m_pModel( pModel )
+ ,m_xControllers( xControllers )
+{
+ AddOrRemoveListener( m_xControllers, true );
+}
+
+//------------------------------------------------------------------------
+void FmFilterAdapter::dispose() throw( RuntimeException )
+{
+ AddOrRemoveListener( m_xControllers, false );
+}
+
+//------------------------------------------------------------------------
+void FmFilterAdapter::AddOrRemoveListener( const Reference< XIndexAccess >& _rxControllers, const bool _bAdd )
+{
+ for (sal_Int32 i = 0, nLen = _rxControllers->getCount(); i < nLen; ++i)
+ {
+ Reference< XIndexAccess > xElement( _rxControllers->getByIndex(i), UNO_QUERY );
+
+ // step down
+ AddOrRemoveListener( xElement, _bAdd );
+
+ // handle this particular controller
+ Reference< XFilterController > xController( xElement, UNO_QUERY );
+ OSL_ENSURE( xController.is(), "FmFilterAdapter::InsertElements: no XFilterController, cannot sync data!" );
+ if ( xController.is() )
+ {
+ if ( _bAdd )
+ xController->addFilterControllerListener( this );
+ else
+ xController->removeFilterControllerListener( this );
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+void FmFilterAdapter::setText(sal_Int32 nRowPos,
+ const FmFilterItem* pFilterItem,
+ const ::rtl::OUString& rText)
+{
+ FmFormItem* pFormItem = PTR_CAST( FmFormItem, pFilterItem->GetParent()->GetParent() );
+
+ try
+ {
+ Reference< XFilterController > xController( pFormItem->GetController(), UNO_QUERY_THROW );
+ xController->setPredicateExpression( pFilterItem->GetComponentIndex(), nRowPos, rText );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+
+// XEventListener
+//------------------------------------------------------------------------
+void SAL_CALL FmFilterAdapter::disposing(const EventObject& /*e*/) throw( RuntimeException )
+{
+}
+
+//------------------------------------------------------------------------
+namespace
+{
+ ::rtl::OUString lcl_getLabelName_nothrow( const Reference< XControl >& _rxControl )
+ {
+ ::rtl::OUString sLabelName;
+ try
+ {
+ Reference< XControl > xControl( _rxControl, UNO_SET_THROW );
+ Reference< XPropertySet > xModel( xControl->getModel(), UNO_QUERY_THROW );
+ sLabelName = getLabelName( xModel );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return sLabelName;
+ }
+
+ Reference< XPropertySet > lcl_getBoundField_nothrow( const Reference< XControl >& _rxControl )
+ {
+ Reference< XPropertySet > xField;
+ try
+ {
+ Reference< XControl > xControl( _rxControl, UNO_SET_THROW );
+ Reference< XPropertySet > xModelProps( xControl->getModel(), UNO_QUERY_THROW );
+ xField.set( xModelProps->getPropertyValue( FM_PROP_BOUNDFIELD ), UNO_QUERY_THROW );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return xField;
+ }
+}
+
+// XFilterControllerListener
+//------------------------------------------------------------------------
+void FmFilterAdapter::predicateExpressionChanged( const FilterEvent& _Event ) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ if ( !m_pModel )
+ return;
+
+ // the controller which sent the event
+ Reference< XFormController > xController( _Event.Source, UNO_QUERY_THROW );
+ Reference< XFilterController > xFilterController( _Event.Source, UNO_QUERY_THROW );
+ Reference< XForm > xForm( xController->getModel(), UNO_QUERY_THROW );
+
+ FmFormItem* pFormItem = m_pModel->Find( m_pModel->m_aChildren, xForm );
+ OSL_ENSURE( pFormItem, "FmFilterAdapter::predicateExpressionChanged: don't know this form!" );
+ if ( !pFormItem )
+ return;
+
+ const sal_Int32 nActiveTerm( xFilterController->getActiveTerm() );
+
+ FmFilterItems* pFilter = PTR_CAST( FmFilterItems, pFormItem->GetChildren()[ nActiveTerm ] );
+ FmFilterItem* pFilterItem = pFilter->Find( _Event.FilterComponent );
+ if ( pFilterItem )
+ {
+ if ( _Event.PredicateExpression.getLength())
+ {
+ pFilterItem->SetText( _Event.PredicateExpression );
+ // UI benachrichtigen
+ FmFilterTextChangedHint aChangeHint(pFilterItem);
+ m_pModel->Broadcast( aChangeHint );
+ }
+ else
+ {
+ // no text anymore so remove the condition
+ m_pModel->Remove(pFilterItem);
+ }
+ }
+ else
+ {
+ // searching the component by field name
+ ::rtl::OUString aFieldName( lcl_getLabelName_nothrow( xFilterController->getFilterComponent( _Event.FilterComponent ) ) );
+
+ pFilterItem = new FmFilterItem( m_pModel->getORB(), pFilter, aFieldName, _Event.PredicateExpression, _Event.FilterComponent );
+ m_pModel->Insert(pFilter->GetChildren().end(), pFilterItem);
+ }
+
+ // ensure there's one empty term in the filter, just in case the active term was previously empty
+ m_pModel->EnsureEmptyFilterRows( *pFormItem );
+}
+
+//------------------------------------------------------------------------
+void SAL_CALL FmFilterAdapter::disjunctiveTermRemoved( const FilterEvent& _Event ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ Reference< XFormController > xController( _Event.Source, UNO_QUERY_THROW );
+ Reference< XFilterController > xFilterController( _Event.Source, UNO_QUERY_THROW );
+ Reference< XForm > xForm( xController->getModel(), UNO_QUERY_THROW );
+
+ FmFormItem* pFormItem = m_pModel->Find( m_pModel->m_aChildren, xForm );
+ OSL_ENSURE( pFormItem, "FmFilterAdapter::disjunctiveTermRemoved: don't know this form!" );
+ if ( !pFormItem )
+ return;
+
+ ::std::vector< FmFilterData* >& rTermItems = pFormItem->GetChildren();
+ const bool bValidIndex = ( _Event.DisjunctiveTerm >= 0 ) && ( (size_t)_Event.DisjunctiveTerm < rTermItems.size() );
+ OSL_ENSURE( bValidIndex, "FmFilterAdapter::disjunctiveTermRemoved: invalid term index!" );
+ if ( !bValidIndex )
+ return;
+
+ // if the first term was removed, then the to-be first term needs its text updated
+ if ( _Event.DisjunctiveTerm == 0 )
+ {
+ rTermItems[1]->SetText( String( SVX_RES( RID_STR_FILTER_FILTER_FOR ) ) );
+ FmFilterTextChangedHint aChangeHint( rTermItems[1] );
+ m_pModel->Broadcast( aChangeHint );
+ }
+
+ // finally remove the entry from the model
+ m_pModel->Remove( rTermItems.begin() + _Event.DisjunctiveTerm );
+
+ // ensure there's one empty term in the filter, just in case the currently removed one was the last empty one
+ m_pModel->EnsureEmptyFilterRows( *pFormItem );
+}
+
+//------------------------------------------------------------------------
+void SAL_CALL FmFilterAdapter::disjunctiveTermAdded( const FilterEvent& _Event ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ Reference< XFormController > xController( _Event.Source, UNO_QUERY_THROW );
+ Reference< XFilterController > xFilterController( _Event.Source, UNO_QUERY_THROW );
+ Reference< XForm > xForm( xController->getModel(), UNO_QUERY_THROW );
+
+ FmFormItem* pFormItem = m_pModel->Find( m_pModel->m_aChildren, xForm );
+ OSL_ENSURE( pFormItem, "FmFilterAdapter::disjunctiveTermAdded: don't know this form!" );
+ if ( !pFormItem )
+ return;
+
+ const sal_Int32 nInsertPos = _Event.DisjunctiveTerm;
+ bool bValidIndex = ( nInsertPos >= 0 ) && ( (size_t)nInsertPos <= pFormItem->GetChildren().size() );
+ if ( !bValidIndex )
+ {
+ OSL_ENSURE( false, "FmFilterAdapter::disjunctiveTermAdded: invalid index!" );
+ return;
+ }
+
+ const ::std::vector< FmFilterData* >::iterator insertPos = pFormItem->GetChildren().begin() + nInsertPos;
+
+ FmFilterItems* pFilterItems = new FmFilterItems( m_pModel->getORB(), pFormItem, String( SVX_RES( RID_STR_FILTER_FILTER_OR ) ) );
+ m_pModel->Insert( insertPos, pFilterItems );
+}
+
+//========================================================================
+// class FmFilterModel
+//========================================================================
+TYPEINIT1(FmFilterModel, FmParentData);
+//------------------------------------------------------------------------
+FmFilterModel::FmFilterModel(const Reference< XMultiServiceFactory >& _rxFactory)
+ :FmParentData(_rxFactory,NULL, ::rtl::OUString())
+ ,OSQLParserClient(_rxFactory)
+ ,m_xORB(_rxFactory)
+ ,m_pAdapter(NULL)
+ ,m_pCurrentItems(NULL)
+{
+}
+
+//------------------------------------------------------------------------
+FmFilterModel::~FmFilterModel()
+{
+ Clear();
+}
+
+//------------------------------------------------------------------------
+void FmFilterModel::Clear()
+{
+ // notify
+ FilterClearingHint aClearedHint;
+ Broadcast( aClearedHint );
+
+ // loose endings
+ if (m_pAdapter)
+ {
+ m_pAdapter->dispose();
+ m_pAdapter->release();
+ m_pAdapter= NULL;
+ }
+
+ m_pCurrentItems = NULL;
+ m_xController = NULL;
+ m_xControllers = NULL;
+
+ for (::std::vector<FmFilterData*>::const_iterator i = m_aChildren.begin();
+ i != m_aChildren.end(); i++)
+ delete (*i);
+
+ m_aChildren.clear();
+}
+
+//------------------------------------------------------------------------
+void FmFilterModel::Update(const Reference< XIndexAccess > & xControllers, const Reference< XFormController > & xCurrent)
+{
+ if ( xCurrent == m_xController )
+ return;
+
+ if (!xControllers.is())
+ {
+ Clear();
+ return;
+ }
+
+ // there is only a new current controller
+ if ( m_xControllers != xControllers )
+ {
+ Clear();
+
+ m_xControllers = xControllers;
+ Update(m_xControllers, this);
+
+ DBG_ASSERT(xCurrent.is(), "FmFilterModel::Update(...) no current controller");
+
+ // Listening for TextChanges
+ m_pAdapter = new FmFilterAdapter(this, xControllers);
+ m_pAdapter->acquire();
+
+ SetCurrentController(xCurrent);
+ EnsureEmptyFilterRows( *this );
+ }
+ else
+ SetCurrentController(xCurrent);
+}
+
+//------------------------------------------------------------------------
+void FmFilterModel::Update(const Reference< XIndexAccess > & xControllers, FmParentData* pParent)
+{
+ try
+ {
+ sal_Int32 nCount = xControllers->getCount();
+ for ( sal_Int32 i = 0; i < nCount; ++i )
+ {
+ Reference< XFormController > xController( xControllers->getByIndex(i), UNO_QUERY_THROW );
+
+ Reference< XPropertySet > xFormProperties( xController->getModel(), UNO_QUERY_THROW );
+ ::rtl::OUString aName;
+ OSL_VERIFY( xFormProperties->getPropertyValue( FM_PROP_NAME ) >>= aName );
+
+ // Insert a new item for the form
+ FmFormItem* pFormItem = new FmFormItem( m_xORB, pParent, xController, aName );
+ Insert( pParent->GetChildren().end(), pFormItem );
+
+ Reference< XFilterController > xFilterController( pFormItem->GetFilterController(), UNO_SET_THROW );
+
+ // insert the existing filters for the form
+ String aTitle( SVX_RES( RID_STR_FILTER_FILTER_FOR ) );
+
+ Sequence< Sequence< ::rtl::OUString > > aExpressions = xFilterController->getPredicateExpressions();
+ for ( const Sequence< ::rtl::OUString >* pConjunctionTerm = aExpressions.getConstArray();
+ pConjunctionTerm != aExpressions.getConstArray() + aExpressions.getLength();
+ ++pConjunctionTerm
+ )
+ {
+ // we always display one row, even if there's no term to be displayed
+ FmFilterItems* pFilterItems = new FmFilterItems( m_xORB, pFormItem, aTitle );
+ Insert( pFormItem->GetChildren().end(), pFilterItems );
+
+ const Sequence< ::rtl::OUString >& rDisjunction( *pConjunctionTerm );
+ for ( const ::rtl::OUString* pDisjunctiveTerm = rDisjunction.getConstArray();
+ pDisjunctiveTerm != rDisjunction.getConstArray() + rDisjunction.getLength();
+ ++pDisjunctiveTerm
+ )
+ {
+ if ( pDisjunctiveTerm->getLength() == 0 )
+ // no condition for this particular component in this particular conjunction term
+ continue;
+
+ const sal_Int32 nComponentIndex = pDisjunctiveTerm - rDisjunction.getConstArray();
+
+ // determine the display name of the control
+ const Reference< XControl > xFilterControl( xFilterController->getFilterComponent( nComponentIndex ) );
+ const ::rtl::OUString sDisplayName( lcl_getLabelName_nothrow( xFilterControl ) );
+
+ // insert a new entry
+ FmFilterItem* pANDCondition = new FmFilterItem( m_xORB, pFilterItems, sDisplayName, *pDisjunctiveTerm, nComponentIndex );
+ Insert( pFilterItems->GetChildren().end(), pANDCondition );
+ }
+
+ // title for the next conditions
+ aTitle = SVX_RES( RID_STR_FILTER_FILTER_OR );
+ }
+
+ // now add dependent controllers
+ Reference< XIndexAccess > xControllerAsIndex( xController, UNO_QUERY );
+ Update( xControllerAsIndex, pFormItem );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//------------------------------------------------------------------------
+FmFormItem* FmFilterModel::Find(const ::std::vector<FmFilterData*>& rItems, const Reference< XFormController > & xController) const
+{
+ for (::std::vector<FmFilterData*>::const_iterator i = rItems.begin();
+ i != rItems.end(); i++)
+ {
+ FmFormItem* pForm = PTR_CAST(FmFormItem,*i);
+ if (pForm)
+ {
+ if ( xController == pForm->GetController() )
+ return pForm;
+ else
+ {
+ pForm = Find(pForm->GetChildren(), xController);
+ if (pForm)
+ return pForm;
+ }
+ }
+ }
+ return NULL;
+}
+
+//------------------------------------------------------------------------
+FmFormItem* FmFilterModel::Find(const ::std::vector<FmFilterData*>& rItems, const Reference< XForm >& xForm) const
+{
+ for (::std::vector<FmFilterData*>::const_iterator i = rItems.begin();
+ i != rItems.end(); i++)
+ {
+ FmFormItem* pForm = PTR_CAST(FmFormItem,*i);
+ if (pForm)
+ {
+ if (xForm == pForm->GetController()->getModel())
+ return pForm;
+ else
+ {
+ pForm = Find(pForm->GetChildren(), xForm);
+ if (pForm)
+ return pForm;
+ }
+ }
+ }
+ return NULL;
+}
+
+//------------------------------------------------------------------------
+void FmFilterModel::SetCurrentController(const Reference< XFormController > & xCurrent)
+{
+ if ( xCurrent == m_xController )
+ return;
+
+ m_xController = xCurrent;
+
+ FmFormItem* pItem = Find( m_aChildren, xCurrent );
+ if ( !pItem )
+ return;
+
+ try
+ {
+ Reference< XFilterController > xFilterController( m_xController, UNO_QUERY_THROW );
+ const sal_Int32 nActiveTerm( xFilterController->getActiveTerm() );
+ if ( pItem->GetChildren().size() > (size_t)nActiveTerm )
+ {
+ SetCurrentItems( static_cast< FmFilterItems* >( pItem->GetChildren()[ nActiveTerm ] ) );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//------------------------------------------------------------------------
+void FmFilterModel::AppendFilterItems( FmFormItem& _rFormItem )
+{
+ // insert the condition behind the last filter items
+ ::std::vector<FmFilterData*>::reverse_iterator iter;
+ for ( iter = _rFormItem.GetChildren().rbegin();
+ iter != _rFormItem.GetChildren().rend();
+ ++iter
+ )
+ {
+ if ((*iter)->ISA(FmFilterItems))
+ break;
+ }
+
+ sal_Int32 nInsertPos = iter.base() - _rFormItem.GetChildren().begin();
+ // delegate this to the FilterController, it will notify us, which will let us update our model
+ try
+ {
+ Reference< XFilterController > xFilterController( _rFormItem.GetFilterController(), UNO_SET_THROW );
+ if ( nInsertPos >= xFilterController->getDisjunctiveTerms() )
+ xFilterController->appendEmptyDisjunctiveTerm();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//------------------------------------------------------------------------
+void FmFilterModel::Insert(const ::std::vector<FmFilterData*>::iterator& rPos, FmFilterData* pData)
+{
+ ::std::vector<FmFilterData*>& rItems = pData->GetParent()->GetChildren();
+ sal_Int32 nPos = rPos == rItems.end() ? LIST_APPEND : rPos - rItems.begin();
+ rItems.insert(rPos, pData);
+
+ // UI benachrichtigen
+ FmFilterInsertedHint aInsertedHint(pData, nPos);
+ Broadcast( aInsertedHint );
+}
+
+//------------------------------------------------------------------------
+void FmFilterModel::Remove(FmFilterData* pData)
+{
+ FmParentData* pParent = pData->GetParent();
+ ::std::vector<FmFilterData*>& rItems = pParent->GetChildren();
+
+ // erase the item from the model
+ ::std::vector<FmFilterData*>::iterator i = ::std::find(rItems.begin(), rItems.end(), pData);
+ DBG_ASSERT(i != rItems.end(), "FmFilterModel::Remove(): unknown Item");
+ // position within the parent
+ sal_Int32 nPos = i - rItems.begin();
+ if (pData->ISA(FmFilterItems))
+ {
+ FmFormItem* pFormItem = (FmFormItem*)pParent;
+
+ try
+ {
+ Reference< XFilterController > xFilterController( pFormItem->GetFilterController(), UNO_SET_THROW );
+
+ bool bEmptyLastTerm = ( ( nPos == 0 ) && xFilterController->getDisjunctiveTerms() == 1 );
+ if ( bEmptyLastTerm )
+ {
+ // remove all children (by setting an empty predicate expression)
+ ::std::vector< FmFilterData* >& rChildren = ((FmFilterItems*)pData)->GetChildren();
+ while ( !rChildren.empty() )
+ {
+ ::std::vector< FmFilterData* >::iterator removePos = rChildren.end() - 1;
+ FmFilterItem* pFilterItem = PTR_CAST( FmFilterItem, *removePos );
+ m_pAdapter->setText( nPos, pFilterItem, ::rtl::OUString() );
+ Remove( removePos );
+ }
+ }
+ else
+ {
+ xFilterController->removeDisjunctiveTerm( nPos );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ else // FormItems can not be deleted
+ {
+ FmFilterItem* pFilterItem = PTR_CAST(FmFilterItem, pData);
+
+ // if its the last condition remove the parent
+ if (rItems.size() == 1)
+ Remove(pFilterItem->GetParent());
+ else
+ {
+ // find the position of the father within his father
+ ::std::vector<FmFilterData*>& rParentParentItems = pData->GetParent()->GetParent()->GetChildren();
+ ::std::vector<FmFilterData*>::iterator j = ::std::find(rParentParentItems.begin(), rParentParentItems.end(), pFilterItem->GetParent());
+ DBG_ASSERT(j != rParentParentItems.end(), "FmFilterModel::Remove(): unknown Item");
+ sal_Int32 nParentPos = j - rParentParentItems.begin();
+
+ // EmptyText removes the filter
+ m_pAdapter->setText(nParentPos, pFilterItem, ::rtl::OUString());
+ Remove( i );
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+void FmFilterModel::Remove( const ::std::vector<FmFilterData*>::iterator& rPos )
+{
+ // remove from parent's child list
+ FmFilterData* pData = *rPos;
+ pData->GetParent()->GetChildren().erase( rPos );
+
+ // notify the view, this will remove the actual SvLBoxEntry
+ FmFilterRemovedHint aRemoveHint( pData );
+ Broadcast( aRemoveHint );
+
+ delete pData;
+}
+
+//------------------------------------------------------------------------
+sal_Bool FmFilterModel::ValidateText(FmFilterItem* pItem, UniString& rText, UniString& rErrorMsg) const
+{
+ FmFormItem* pFormItem = PTR_CAST( FmFormItem, pItem->GetParent()->GetParent() );
+ try
+ {
+ Reference< XFormController > xFormController( pFormItem->GetController() );
+ // obtain the connection of the form belonging to the controller
+ OStaticDataAccessTools aStaticTools;
+ Reference< XRowSet > xRowSet( xFormController->getModel(), UNO_QUERY_THROW );
+ Reference< XConnection > xConnection( aStaticTools.getRowSetConnection( xRowSet ) );
+
+ // obtain a number formatter for this connection
+ // TODO: shouldn't this be cached?
+ Reference< XNumberFormatsSupplier > xFormatSupplier = aStaticTools.getNumberFormats( xConnection, sal_True );
+ Reference< XNumberFormatter > xFormatter( m_xORB->createInstance( FM_NUMBER_FORMATTER ), UNO_QUERY );
+ xFormatter->attachNumberFormatsSupplier( xFormatSupplier );
+
+ // get the field (database column) which the item is responsible for
+ Reference< XFilterController > xFilterController( xFormController, UNO_QUERY_THROW );
+ Reference< XPropertySet > xField( lcl_getBoundField_nothrow( xFilterController->getFilterComponent( pItem->GetComponentIndex() ) ), UNO_SET_THROW );
+
+ // parse the given text as filter predicate
+ ::rtl::OUString aErr, aTxt( rText );
+ ::rtl::Reference< ISQLParseNode > xParseNode = predicateTree( aErr, aTxt, xFormatter, xField );
+ rErrorMsg = aErr;
+ rText = aTxt;
+ if ( xParseNode.is() )
+ {
+ ::rtl::OUString aPreparedText;
+ Locale aAppLocale = Application::GetSettings().GetUILocale();
+ xParseNode->parseNodeToPredicateStr(
+ aPreparedText, xConnection, xFormatter, xField, aAppLocale, '.', getParseContext() );
+ rText = aPreparedText;
+ return sal_True;
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return sal_False;
+}
+
+//------------------------------------------------------------------------
+void FmFilterModel::Append(FmFilterItems* pItems, FmFilterItem* pFilterItem)
+{
+ Insert(pItems->GetChildren().end(), pFilterItem);
+}
+
+//------------------------------------------------------------------------
+void FmFilterModel::SetTextForItem(FmFilterItem* pItem, const ::rtl::OUString& rText)
+{
+ ::std::vector<FmFilterData*>& rItems = pItem->GetParent()->GetParent()->GetChildren();
+ ::std::vector<FmFilterData*>::iterator i = ::std::find(rItems.begin(), rItems.end(), pItem->GetParent());
+ sal_Int32 nParentPos = i - rItems.begin();
+
+ m_pAdapter->setText(nParentPos, pItem, rText);
+
+ if (!rText)
+ Remove(pItem);
+ else
+ {
+ // Change the text
+ pItem->SetText(rText);
+ FmFilterTextChangedHint aChangeHint(pItem);
+ Broadcast( aChangeHint );
+ }
+}
+
+//------------------------------------------------------------------------
+void FmFilterModel::SetCurrentItems(FmFilterItems* pCurrent)
+{
+ if (m_pCurrentItems == pCurrent)
+ return;
+
+ // search for the condition
+ if (pCurrent)
+ {
+ FmFormItem* pFormItem = (FmFormItem*)pCurrent->GetParent();
+ ::std::vector<FmFilterData*>& rItems = pFormItem->GetChildren();
+ ::std::vector<FmFilterData*>::const_iterator i = ::std::find(rItems.begin(), rItems.end(), pCurrent);
+
+ if (i != rItems.end())
+ {
+ // determine the filter position
+ sal_Int32 nPos = i - rItems.begin();
+ try
+ {
+ Reference< XFilterController > xFilterController( pFormItem->GetFilterController(), UNO_SET_THROW );
+ xFilterController->setActiveTerm( nPos );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ if ( m_xController != pFormItem->GetController() )
+ // calls SetCurrentItems again
+ SetCurrentController( pFormItem->GetController() );
+ else
+ m_pCurrentItems = pCurrent;
+ }
+ else
+ m_pCurrentItems = NULL;
+ }
+ else
+ m_pCurrentItems = NULL;
+
+
+ // UI benachrichtigen
+ FmFilterCurrentChangedHint aHint;
+ Broadcast( aHint );
+}
+
+//------------------------------------------------------------------------
+void FmFilterModel::EnsureEmptyFilterRows( FmParentData& _rItem )
+{
+ // checks whether for each form there's one free level for input
+ ::std::vector< FmFilterData* >& rChildren = _rItem.GetChildren();
+ sal_Bool bAppendLevel = _rItem.ISA( FmFormItem );
+
+ for ( ::std::vector<FmFilterData*>::iterator i = rChildren.begin();
+ i != rChildren.end();
+ ++i
+ )
+ {
+ FmFilterItems* pItems = PTR_CAST(FmFilterItems, *i);
+ if ( pItems && pItems->GetChildren().empty() )
+ {
+ bAppendLevel = sal_False;
+ break;
+ }
+
+ FmFormItem* pFormItem = PTR_CAST(FmFormItem, *i);
+ if (pFormItem)
+ {
+ EnsureEmptyFilterRows( *pFormItem );
+ continue;
+ }
+ }
+
+ if ( bAppendLevel )
+ {
+ FmFormItem* pFormItem = PTR_CAST( FmFormItem, &_rItem );
+ OSL_ENSURE( pFormItem, "FmFilterModel::EnsureEmptyFilterRows: no FmFormItem, but a FmFilterItems child?" );
+ if ( pFormItem )
+ AppendFilterItems( *pFormItem );
+ }
+}
+
+//========================================================================
+// class FmFilterItemsString
+//========================================================================
+class FmFilterItemsString : public SvLBoxString
+{
+public:
+ FmFilterItemsString( SvLBoxEntry* pEntry, sal_uInt16 nFlags, const XubString& rStr )
+ :SvLBoxString(pEntry,nFlags,rStr){}
+
+ virtual void Paint(const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, SvLBoxEntry* pEntry);
+ virtual void InitViewData( SvLBox* pView,SvLBoxEntry* pEntry, SvViewDataItem* pViewData);
+};
+
+const int nxDBmp = 12;
+//------------------------------------------------------------------------
+void FmFilterItemsString::Paint(const Point& rPos, SvLBox& rDev, sal_uInt16 /*nFlags*/, SvLBoxEntry* pEntry )
+{
+ FmFilterItems* pRow = (FmFilterItems*)pEntry->GetUserData();
+ FmFormItem* pForm = (FmFormItem*)pRow->GetParent();
+
+ // current filter is significant painted
+ const bool bIsCurrentFilter = pForm->GetChildren()[ pForm->GetFilterController()->getActiveTerm() ] == pRow;
+ if ( bIsCurrentFilter )
+ {
+ rDev.Push( PUSH_LINECOLOR );
+
+ rDev.SetLineColor( rDev.GetTextColor() );
+
+ Rectangle aRect( rPos, GetSize( &rDev, pEntry ) );
+ Point aFirst( rPos.X(), aRect.Bottom() - 6 );
+ Point aSecond(aFirst .X() + 2, aFirst.Y() + 3 );
+
+ rDev.DrawLine( aFirst, aSecond );
+
+ aFirst = aSecond;
+ aFirst.X() += 1;
+ aSecond.X() += 6;
+ aSecond.Y() -= 5;
+
+ rDev.DrawLine( aFirst, aSecond );
+
+ rDev.Pop();
+ }
+
+ rDev.DrawText( Point(rPos.X() + nxDBmp, rPos.Y()), GetText() );
+}
+
+//------------------------------------------------------------------------
+void FmFilterItemsString::InitViewData( SvLBox* pView,SvLBoxEntry* pEntry, SvViewDataItem* pViewData)
+{
+ if( !pViewData )
+ pViewData = pView->GetViewDataItem( pEntry, this );
+
+ Size aSize(pView->GetTextWidth(GetText()), pView->GetTextHeight());
+ aSize.Width() += nxDBmp;
+ pViewData->aSize = aSize;
+}
+
+//========================================================================
+// class FmFilterString
+//========================================================================
+class FmFilterString : public SvLBoxString
+{
+ UniString m_aName;
+
+public:
+ FmFilterString( SvLBoxEntry* pEntry, sal_uInt16 nFlags, const XubString& rStr, const UniString& aName)
+ :SvLBoxString(pEntry,nFlags,rStr)
+ ,m_aName(aName)
+ {
+ m_aName.AppendAscii(": ");
+ }
+
+ virtual void Paint(const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, SvLBoxEntry* pEntry);
+ virtual void InitViewData( SvLBox* pView,SvLBoxEntry* pEntry, SvViewDataItem* pViewData);
+};
+
+const int nxD = 4;
+
+//------------------------------------------------------------------------
+void FmFilterString::InitViewData( SvLBox* pView,SvLBoxEntry* pEntry, SvViewDataItem* pViewData)
+{
+ if( !pViewData )
+ pViewData = pView->GetViewDataItem( pEntry, this );
+
+ Font aOldFont( pView->GetFont());
+ Font aFont( aOldFont );
+ aFont.SetWeight(WEIGHT_BOLD);
+ pView->SetFont( aFont );
+
+ Size aSize(pView->GetTextWidth(m_aName), pView->GetTextHeight());
+ pView->SetFont( aOldFont );
+ aSize.Width() += pView->GetTextWidth(GetText()) + nxD;
+ pViewData->aSize = aSize;
+}
+
+//------------------------------------------------------------------------
+void FmFilterString::Paint(const Point& rPos, SvLBox& rDev, sal_uInt16 /*nFlags*/, SvLBoxEntry* /*pEntry*/ )
+{
+ Font aOldFont( rDev.GetFont());
+ Font aFont( aOldFont );
+ aFont.SetWeight(WEIGHT_BOLD);
+ rDev.SetFont( aFont );
+
+ Point aPos(rPos);
+ rDev.DrawText( aPos, m_aName );
+
+ // position for the second text
+ aPos.X() += rDev.GetTextWidth(m_aName) + nxD;
+ rDev.SetFont( aOldFont );
+ rDev.DrawText( aPos, GetText() );
+}
+
+//========================================================================
+// class FmFilterNavigator
+//========================================================================
+FmFilterNavigator::FmFilterNavigator( Window* pParent )
+ :SvTreeListBox( pParent, WB_HASBUTTONS|WB_HASLINES|WB_BORDER|WB_HASBUTTONSATROOT )
+ ,m_pModel( NULL )
+ ,m_pEditingCurrently( NULL )
+ ,m_aControlExchange( this )
+ ,m_aTimerCounter( 0 )
+ ,m_aDropActionType( DA_SCROLLUP )
+{
+ SetHelpId( HID_FILTER_NAVIGATOR );
+
+ {
+ {
+ ImageList aNavigatorImages( SVX_RES( RID_SVXIMGLIST_FMEXPL ) );
+ SetNodeBitmaps(
+ aNavigatorImages.GetImage( RID_SVXIMG_COLLAPSEDNODE ),
+ aNavigatorImages.GetImage( RID_SVXIMG_EXPANDEDNODE ),
+ BMP_COLOR_NORMAL
+ );
+ }
+ {
+ ImageList aNavigatorImages( SVX_RES( RID_SVXIMGLIST_FMEXPL_HC ) );
+ SetNodeBitmaps(
+ aNavigatorImages.GetImage( RID_SVXIMG_COLLAPSEDNODE ),
+ aNavigatorImages.GetImage( RID_SVXIMG_EXPANDEDNODE ),
+ BMP_COLOR_HIGHCONTRAST
+ );
+ }
+ }
+
+ m_pModel = new FmFilterModel(comphelper::getProcessServiceFactory());
+ StartListening( *m_pModel );
+
+ EnableInplaceEditing( sal_True );
+ SetSelectionMode(MULTIPLE_SELECTION);
+
+ SetDragDropMode(0xFFFF);
+
+ m_aDropActionTimer.SetTimeoutHdl(LINK(this, FmFilterNavigator, OnDropActionTimer));
+}
+
+//------------------------------------------------------------------------
+FmFilterNavigator::~FmFilterNavigator()
+{
+ EndListening( *m_pModel );
+ delete m_pModel;
+}
+
+//------------------------------------------------------------------------
+void FmFilterNavigator::Clear()
+{
+ m_pModel->Clear();
+}
+
+//------------------------------------------------------------------------
+void FmFilterNavigator::UpdateContent(const Reference< XIndexAccess > & xControllers, const Reference< XFormController > & xCurrent)
+{
+ if (xCurrent == m_pModel->GetCurrentController())
+ return;
+
+ m_pModel->Update(xControllers, xCurrent);
+
+ // expand the filters for the current controller
+ SvLBoxEntry* pEntry = FindEntry(m_pModel->GetCurrentForm());
+ if (pEntry && !IsExpanded(pEntry))
+ {
+ SelectAll(sal_False);
+
+ if (!IsExpanded(pEntry))
+ Expand(pEntry);
+
+ pEntry = FindEntry(m_pModel->GetCurrentItems());
+ if (pEntry)
+ {
+ if (!IsExpanded(pEntry))
+ Expand(pEntry);
+ Select(pEntry, sal_True);
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+sal_Bool FmFilterNavigator::EditingEntry( SvLBoxEntry* pEntry, Selection& rSelection )
+{
+ m_pEditingCurrently = pEntry;
+ if (!SvTreeListBox::EditingEntry( pEntry, rSelection ))
+ return sal_False;
+
+ return pEntry && ((FmFilterData*)pEntry->GetUserData())->ISA(FmFilterItem);
+}
+
+//------------------------------------------------------------------------
+sal_Bool FmFilterNavigator::EditedEntry( SvLBoxEntry* pEntry, const XubString& rNewText )
+{
+ DBG_ASSERT(pEntry == m_pEditingCurrently, "FmFilterNavigator::EditedEntry: suspicious entry!");
+ m_pEditingCurrently = NULL;
+
+ if (EditingCanceled())
+ return sal_True;
+
+ DBG_ASSERT(((FmFilterData*)pEntry->GetUserData())->ISA(FmFilterItem),
+ "FmFilterNavigator::EditedEntry() wrong entry");
+
+ UniString aText(rNewText);
+ aText.EraseTrailingChars();
+ aText.EraseLeadingChars();
+ if (aText.Len() == 0)
+ {
+ // deleting the entry asynchron
+ sal_uLong nEvent;
+ PostUserEvent(nEvent, LINK(this, FmFilterNavigator, OnRemove), pEntry);
+ }
+ else
+ {
+ UniString aErrorMsg;
+
+ if (m_pModel->ValidateText((FmFilterItem*)pEntry->GetUserData(), aText, aErrorMsg))
+ {
+ GrabFocus();
+ // this will set the text at the FmFilterItem, as well as update any filter controls
+ // which are connected to this particular entry
+ m_pModel->SetTextForItem( static_cast< FmFilterItem* >( pEntry->GetUserData() ), aText );
+
+ SetCursor( pEntry, sal_True );
+ SetEntryText( pEntry, aText );
+ }
+ else
+ {
+ // display the error and return sal_False
+ SQLContext aError;
+ aError.Message = String(SVX_RES(RID_STR_SYNTAXERROR));
+ aError.Details = aErrorMsg;
+ displayException(aError, this);
+
+ return sal_False;
+ }
+ }
+ return sal_True;
+}
+
+//------------------------------------------------------------------------
+IMPL_LINK( FmFilterNavigator, OnRemove, SvLBoxEntry*, pEntry )
+{
+ // now remove the entry
+ m_pModel->Remove((FmFilterData*) pEntry->GetUserData());
+ return 0L;
+}
+
+//------------------------------------------------------------------------
+IMPL_LINK( FmFilterNavigator, OnDropActionTimer, void*, EMPTYARG )
+{
+ if (--m_aTimerCounter > 0)
+ return 0L;
+
+ switch (m_aDropActionType)
+ {
+ case DA_SCROLLUP :
+ ScrollOutputArea(1);
+ m_aTimerCounter = DROP_ACTION_TIMER_SCROLL_TICKS;
+ break;
+ case DA_SCROLLDOWN :
+ ScrollOutputArea(-1);
+ m_aTimerCounter = DROP_ACTION_TIMER_SCROLL_TICKS;
+ break;
+ case DA_EXPANDNODE:
+ {
+ SvLBoxEntry* pToExpand = GetEntry(m_aTimerTriggered);
+ if (pToExpand && (GetChildCount(pToExpand) > 0) && !IsExpanded(pToExpand))
+ // tja, eigentlich muesste ich noch testen, ob die Node nicht schon expandiert ist, aber ich
+ // habe dazu weder in den Basisklassen noch im Model eine Methode gefunden ...
+ // aber ich denke, die BK sollte es auch so vertragen
+ Expand(pToExpand);
+
+ // nach dem Expand habe ich im Gegensatz zum Scrollen natuerlich nix mehr zu tun
+ m_aDropActionTimer.Stop();
+ }
+ break;
+ }
+ return 0L;
+}
+
+
+//------------------------------------------------------------------------
+sal_Int8 FmFilterNavigator::AcceptDrop( const AcceptDropEvent& rEvt )
+{
+ Point aDropPos = rEvt.maPosPixel;
+
+ // kuemmern wir uns erst mal um moeglich DropActions (Scrollen und Aufklappen)
+ if (rEvt.mbLeaving)
+ {
+ if (m_aDropActionTimer.IsActive())
+ m_aDropActionTimer.Stop();
+ }
+ else
+ {
+ sal_Bool bNeedTrigger = sal_False;
+ // auf dem ersten Eintrag ?
+ if ((aDropPos.Y() >= 0) && (aDropPos.Y() < GetEntryHeight()))
+ {
+ m_aDropActionType = DA_SCROLLUP;
+ bNeedTrigger = sal_True;
+ }
+ else
+ {
+ // auf dem letzten (bzw. in dem Bereich, den ein Eintrag einnehmen wuerde, wenn er unten genau buendig
+ // abschliessen wuerde) ?
+ if ((aDropPos.Y() < GetSizePixel().Height()) && (aDropPos.Y() >= GetSizePixel().Height() - GetEntryHeight()))
+ {
+ m_aDropActionType = DA_SCROLLDOWN;
+ bNeedTrigger = sal_True;
+ }
+ else
+ { // is it an entry whith children, and not yet expanded?
+ SvLBoxEntry* pDropppedOn = GetEntry(aDropPos);
+ if (pDropppedOn && (GetChildCount(pDropppedOn) > 0) && !IsExpanded(pDropppedOn))
+ {
+ // -> aufklappen
+ m_aDropActionType = DA_EXPANDNODE;
+ bNeedTrigger = sal_True;
+ }
+ }
+ }
+ if (bNeedTrigger && (m_aTimerTriggered != aDropPos))
+ {
+ // neu anfangen zu zaehlen
+ m_aTimerCounter = DROP_ACTION_TIMER_INITIAL_TICKS;
+ // die Pos merken, da ich auch QueryDrops bekomme, wenn sich die Maus gar nicht bewegt hat
+ m_aTimerTriggered = aDropPos;
+ // und den Timer los
+ if (!m_aDropActionTimer.IsActive()) // gibt es den Timer schon ?
+ {
+ m_aDropActionTimer.SetTimeout(DROP_ACTION_TIMER_TICK_BASE);
+ m_aDropActionTimer.Start();
+ }
+ }
+ else if (!bNeedTrigger)
+ m_aDropActionTimer.Stop();
+ }
+
+
+ // Hat das Object das richtige Format?
+ if (!m_aControlExchange.isDragSource())
+ return DND_ACTION_NONE;
+
+ if (!m_aControlExchange->hasFormat(GetDataFlavorExVector()))
+ return DND_ACTION_NONE;
+
+ // do we conain the formitem?
+ if (!FindEntry(m_aControlExchange->getFormItem()))
+ return DND_ACTION_NONE;
+
+ SvLBoxEntry* pDropTarget = GetEntry(aDropPos);
+ if (!pDropTarget)
+ return DND_ACTION_NONE;
+
+ FmFilterData* pData = (FmFilterData*)pDropTarget->GetUserData();
+ FmFormItem* pForm = NULL;
+ if (pData->ISA(FmFilterItem))
+ {
+ pForm = PTR_CAST(FmFormItem,pData->GetParent()->GetParent());
+ if (pForm != m_aControlExchange->getFormItem())
+ return DND_ACTION_NONE;
+ }
+ else if (pData->ISA(FmFilterItems))
+ {
+ pForm = PTR_CAST(FmFormItem,pData->GetParent());
+ if (pForm != m_aControlExchange->getFormItem())
+ return DND_ACTION_NONE;
+ }
+ else
+ return DND_ACTION_NONE;
+
+ return rEvt.mnAction;
+}
+// -----------------------------------------------------------------------------
+namespace
+{
+ FmFilterItems* getTargetItems(SvLBoxEntry* _pTarget)
+ {
+ FmFilterData* pData = static_cast<FmFilterData*>(_pTarget->GetUserData());
+ FmFilterItems* pTargetItems = pData->ISA(FmFilterItems)
+ ?
+ PTR_CAST(FmFilterItems,pData)
+ :
+ PTR_CAST(FmFilterItems,pData->GetParent());
+ return pTargetItems;
+ }
+}
+//------------------------------------------------------------------------
+sal_Int8 FmFilterNavigator::ExecuteDrop( const ExecuteDropEvent& rEvt )
+{
+ // ware schlecht, wenn nach dem Droppen noch gescrollt wird ...
+ if (m_aDropActionTimer.IsActive())
+ m_aDropActionTimer.Stop();
+
+ // Format-Ueberpruefung
+ if (!m_aControlExchange.isDragSource())
+ return DND_ACTION_NONE;
+
+ // das Ziel des Drop sowie einige Daten darueber
+ Point aDropPos = rEvt.maPosPixel;
+ SvLBoxEntry* pDropTarget = GetEntry( aDropPos );
+ if (!pDropTarget)
+ return DND_ACTION_NONE;
+
+ // search the container where to add the items
+ FmFilterItems* pTargetItems = getTargetItems(pDropTarget);
+ SelectAll(sal_False);
+ SvLBoxEntry* pEntry = FindEntry(pTargetItems);
+ Select(pEntry, sal_True);
+ SetCurEntry(pEntry);
+
+ insertFilterItem(m_aControlExchange->getDraggedEntries(),pTargetItems,DND_ACTION_COPY == rEvt.mnAction);
+
+ return sal_True;
+}
+
+//------------------------------------------------------------------------
+void FmFilterNavigator::InitEntry(SvLBoxEntry* pEntry,
+ const XubString& rStr,
+ const Image& rImg1,
+ const Image& rImg2,
+ SvLBoxButtonKind eButtonKind)
+{
+ SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind );
+ SvLBoxString* pString = NULL;
+
+ if (((FmFilterData*)pEntry->GetUserData())->ISA(FmFilterItem))
+ pString = new FmFilterString(pEntry, 0, rStr, ((FmFilterItem*)pEntry->GetUserData())->GetFieldName());
+ else if (((FmFilterData*)pEntry->GetUserData())->ISA(FmFilterItems))
+ pString = new FmFilterItemsString(pEntry, 0, rStr );
+
+ if (pString)
+ pEntry->ReplaceItem( pString, 1 );
+}
+
+//------------------------------------------------------------------------
+sal_Bool FmFilterNavigator::Select( SvLBoxEntry* pEntry, sal_Bool bSelect )
+{
+ if (bSelect == IsSelected(pEntry)) // das passiert manchmal, ich glaube, die Basisklasse geht zu sehr auf Nummer sicher ;)
+ return sal_True;
+
+ if (SvTreeListBox::Select(pEntry, bSelect))
+ {
+ if (bSelect)
+ {
+ FmFormItem* pFormItem = NULL;
+ if (((FmFilterData*)pEntry->GetUserData())->ISA(FmFilterItem))
+ pFormItem = (FmFormItem*)((FmFilterItem*)pEntry->GetUserData())->GetParent()->GetParent();
+ else if (((FmFilterData*)pEntry->GetUserData())->ISA(FmFilterItems))
+ pFormItem = (FmFormItem*)((FmFilterItem*)pEntry->GetUserData())->GetParent()->GetParent();
+ else if (((FmFilterData*)pEntry->GetUserData())->ISA(FmFormItem))
+ pFormItem = (FmFormItem*)pEntry->GetUserData();
+
+ if (pFormItem)
+ {
+ // will the controller be exchanged?
+ if (((FmFilterData*)pEntry->GetUserData())->ISA(FmFilterItem))
+ m_pModel->SetCurrentItems((FmFilterItems*)((FmFilterItem*)pEntry->GetUserData())->GetParent());
+ else if (((FmFilterData*)pEntry->GetUserData())->ISA(FmFilterItems))
+ m_pModel->SetCurrentItems((FmFilterItems*)pEntry->GetUserData());
+ else if (((FmFilterData*)pEntry->GetUserData())->ISA(FmFormItem))
+ m_pModel->SetCurrentController(((FmFormItem*)pEntry->GetUserData())->GetController());
+ }
+ }
+ return sal_True;
+ }
+ else
+ return sal_False;
+}
+
+//------------------------------------------------------------------------
+void FmFilterNavigator::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
+{
+ if (rHint.ISA(FmFilterInsertedHint))
+ {
+ FmFilterInsertedHint* pHint = (FmFilterInsertedHint*)&rHint;
+ Insert(pHint->GetData(), pHint->GetPos());
+ }
+ else if( rHint.ISA(FilterClearingHint) )
+ {
+ SvTreeListBox::Clear();
+ }
+ else if( rHint.ISA(FmFilterRemovedHint) )
+ {
+ FmFilterRemovedHint* pHint = (FmFilterRemovedHint*)&rHint;
+ Remove(pHint->GetData());
+ }
+ else if( rHint.ISA(FmFilterTextChangedHint) )
+ {
+ FmFilterTextChangedHint* pHint = (FmFilterTextChangedHint*)&rHint;
+ SvLBoxEntry* pEntry = FindEntry(pHint->GetData());
+ if (pEntry)
+ SetEntryText( pEntry, pHint->GetData()->GetText());
+ }
+ else if( rHint.ISA(FmFilterCurrentChangedHint) )
+ {
+ // invalidate the entries
+ for (SvLBoxEntry* pEntry = First(); pEntry != NULL;
+ pEntry = Next(pEntry))
+ GetModel()->InvalidateEntry( pEntry );
+ }
+}
+
+//------------------------------------------------------------------------
+SvLBoxEntry* FmFilterNavigator::FindEntry(const FmFilterData* pItem) const
+{
+ SvLBoxEntry* pEntry = NULL;
+ if (pItem)
+ {
+ for (pEntry = First(); pEntry != NULL; pEntry = Next( pEntry ))
+ {
+ FmFilterData* pEntryItem = (FmFilterData*)pEntry->GetUserData();
+ if (pEntryItem == pItem)
+ break;
+ }
+ }
+ return pEntry;
+}
+
+//------------------------------------------------------------------------
+void FmFilterNavigator::Insert(FmFilterData* pItem, sal_Int32 nPos)
+{
+ const FmParentData* pParent = pItem->GetParent() ? pItem->GetParent() : GetFilterModel();
+
+ // insert the item
+ SvLBoxEntry* pParentEntry = FindEntry( pParent );
+ SvLBoxEntry* pNewEntry = InsertEntry(pItem->GetText(), pItem->GetImage(), pItem->GetImage(), pParentEntry, sal_False, nPos, pItem );
+ if ( pNewEntry )
+ {
+ SetExpandedEntryBmp( pNewEntry, pItem->GetImage( BMP_COLOR_HIGHCONTRAST ), BMP_COLOR_HIGHCONTRAST );
+ SetCollapsedEntryBmp( pNewEntry, pItem->GetImage( BMP_COLOR_HIGHCONTRAST ), BMP_COLOR_HIGHCONTRAST );
+ }
+ if ( pParentEntry )
+ Expand( pParentEntry );
+}
+
+//------------------------------------------------------------------------
+void FmFilterNavigator::Remove(FmFilterData* pItem)
+{
+ // der Entry zu den Daten
+ SvLBoxEntry* pEntry = FindEntry(pItem);
+
+ if (pEntry == m_pEditingCurrently)
+ // cancel editing
+ EndEditing(sal_True);
+
+ if (pEntry)
+ GetModel()->Remove( pEntry );
+}
+// -----------------------------------------------------------------------------
+FmFormItem* FmFilterNavigator::getSelectedFilterItems(::std::vector<FmFilterItem*>& _rItemList)
+{
+ // be sure that the data is only used within only one form!
+ FmFormItem* pFirstItem = NULL;
+
+ sal_Bool bHandled = sal_True;
+ sal_Bool bFoundSomething = sal_False;
+ for (SvLBoxEntry* pEntry = FirstSelected();
+ bHandled && pEntry != NULL;
+ pEntry = NextSelected(pEntry))
+ {
+ FmFilterItem* pFilter = PTR_CAST(FmFilterItem, (FmFilterData*)pEntry->GetUserData());
+ if (pFilter)
+ {
+ FmFormItem* pForm = PTR_CAST(FmFormItem,pFilter->GetParent()->GetParent());
+ if (!pForm)
+ bHandled = sal_False;
+ else if (!pFirstItem)
+ pFirstItem = pForm;
+ else if (pFirstItem != pForm)
+ bHandled = sal_False;
+
+ if (bHandled)
+ {
+ _rItemList.push_back(pFilter);
+ bFoundSomething = sal_True;
+ }
+ }
+ }
+ if ( !bHandled || !bFoundSomething )
+ pFirstItem = NULL;
+ return pFirstItem;
+}
+// -----------------------------------------------------------------------------
+void FmFilterNavigator::insertFilterItem(const ::std::vector<FmFilterItem*>& _rFilterList,FmFilterItems* _pTargetItems,sal_Bool _bCopy)
+{
+ ::std::vector<FmFilterItem*>::const_iterator aEnd = _rFilterList.end();
+ for ( ::std::vector< FmFilterItem* >::const_iterator i = _rFilterList.begin();
+ i != aEnd;
+ ++i
+ )
+ {
+ FmFilterItem* pLookupItem( *i );
+ if ( pLookupItem->GetParent() == _pTargetItems )
+ continue;
+
+ FmFilterItem* pFilterItem = _pTargetItems->Find( pLookupItem->GetComponentIndex() );
+ String aText = pLookupItem->GetText();
+ if ( !pFilterItem )
+ {
+ pFilterItem = new FmFilterItem( m_pModel->getORB(), _pTargetItems, pLookupItem->GetFieldName(), aText, pLookupItem->GetComponentIndex() );
+ m_pModel->Append( _pTargetItems, pFilterItem );
+ }
+
+ if ( !_bCopy )
+ m_pModel->Remove( pLookupItem );
+
+ // now set the text for the new dragged item
+ m_pModel->SetTextForItem( pFilterItem, aText );
+ }
+
+ m_pModel->EnsureEmptyFilterRows( *_pTargetItems->GetParent() );
+}
+
+//------------------------------------------------------------------------------
+void FmFilterNavigator::StartDrag( sal_Int8 /*_nAction*/, const Point& /*_rPosPixel*/ )
+{
+ EndSelection();
+
+ // be sure that the data is only used within a only one form!
+ m_aControlExchange.prepareDrag();
+
+ ::std::vector<FmFilterItem*> aItemList;
+ if ( FmFormItem* pFirstItem = getSelectedFilterItems(aItemList) )
+ {
+ m_aControlExchange->setDraggedEntries(aItemList);
+ m_aControlExchange->setFormItem(pFirstItem);
+ m_aControlExchange.startDrag( DND_ACTION_COPYMOVE );
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmFilterNavigator::Command( const CommandEvent& rEvt )
+{
+ sal_Bool bHandled = sal_False;
+ switch (rEvt.GetCommand())
+ {
+ case COMMAND_CONTEXTMENU:
+ {
+ // die Stelle, an der geklickt wurde
+ Point aWhere;
+ SvLBoxEntry* pClicked = NULL;
+ if (rEvt.IsMouseEvent())
+ {
+ aWhere = rEvt.GetMousePosPixel();
+ pClicked = GetEntry(aWhere);
+ if (pClicked == NULL)
+ break;
+
+ if (!IsSelected(pClicked))
+ {
+ SelectAll(sal_False);
+ Select(pClicked, sal_True);
+ SetCurEntry(pClicked);
+ }
+ }
+ else
+ {
+ pClicked = GetCurEntry();
+ if (!pClicked)
+ break;
+ aWhere = GetEntryPosition( pClicked );
+ }
+
+ ::std::vector<FmFilterData*> aSelectList;
+ for (SvLBoxEntry* pEntry = FirstSelected();
+ pEntry != NULL;
+ pEntry = NextSelected(pEntry))
+ {
+ // don't delete forms
+ FmFormItem* pForm = PTR_CAST(FmFormItem, (FmFilterData*)pEntry->GetUserData());
+ if (!pForm)
+ aSelectList.push_back((FmFilterData*)pEntry->GetUserData());
+ }
+ if (aSelectList.size() == 1)
+ {
+ // don't delete the only empty row of a form
+ FmFilterItems* pFilterItems = PTR_CAST(FmFilterItems, aSelectList[0]);
+ if (pFilterItems && pFilterItems->GetChildren().empty()
+ && pFilterItems->GetParent()->GetChildren().size() == 1)
+ aSelectList.clear();
+ }
+
+ PopupMenu aContextMenu(SVX_RES(RID_FM_FILTER_MENU));
+
+ // every condition could be deleted except the first one if its the only one
+ aContextMenu.EnableItem( SID_FM_DELETE, !aSelectList.empty() );
+
+ //
+ sal_Bool bEdit = PTR_CAST(FmFilterItem, (FmFilterData*)pClicked->GetUserData()) != NULL &&
+ IsSelected(pClicked) && GetSelectionCount() == 1;
+
+ aContextMenu.EnableItem( SID_FM_FILTER_EDIT,
+ bEdit );
+ aContextMenu.EnableItem( SID_FM_FILTER_IS_NULL,
+ bEdit );
+ aContextMenu.EnableItem( SID_FM_FILTER_IS_NOT_NULL,
+ bEdit );
+
+ aContextMenu.RemoveDisabledEntries(sal_True, sal_True);
+ sal_uInt16 nSlotId = aContextMenu.Execute( this, aWhere );
+ switch( nSlotId )
+ {
+ case SID_FM_FILTER_EDIT:
+ {
+ EditEntry( pClicked );
+ } break;
+ case SID_FM_FILTER_IS_NULL:
+ case SID_FM_FILTER_IS_NOT_NULL:
+ {
+ UniString aErrorMsg;
+ UniString aText;
+ if (nSlotId == SID_FM_FILTER_IS_NULL)
+ aText.AssignAscii("IS NULL");
+ else
+ aText.AssignAscii("IS NOT NULL");
+
+ m_pModel->ValidateText((FmFilterItem*)pClicked->GetUserData(),
+ aText, aErrorMsg);
+ m_pModel->SetTextForItem((FmFilterItem*)pClicked->GetUserData(), aText);
+ } break;
+ case SID_FM_DELETE:
+ {
+ DeleteSelection();
+ } break;
+ }
+ bHandled = sal_True;
+ } break;
+ }
+
+ if (!bHandled)
+ SvTreeListBox::Command( rEvt );
+}
+// -----------------------------------------------------------------------------
+SvLBoxEntry* FmFilterNavigator::getNextEntry(SvLBoxEntry* _pStartWith)
+{
+ SvLBoxEntry* pEntry = _pStartWith ? _pStartWith : LastSelected();
+ pEntry = Next(pEntry);
+ // we need the next filter entry
+ while( pEntry && GetChildCount( pEntry ) == 0 && pEntry != Last() )
+ pEntry = Next(pEntry);
+ return pEntry;
+}
+// -----------------------------------------------------------------------------
+SvLBoxEntry* FmFilterNavigator::getPrevEntry(SvLBoxEntry* _pStartWith)
+{
+ SvLBoxEntry* pEntry = _pStartWith ? _pStartWith : FirstSelected();
+ pEntry = Prev(pEntry);
+ // check if the previous entry is a filter, if so get the next prev
+ if ( pEntry && GetChildCount( pEntry ) != 0 )
+ {
+ pEntry = Prev(pEntry);
+ // if the entry is still no leaf return
+ if ( pEntry && GetChildCount( pEntry ) != 0 )
+ pEntry = NULL;
+ }
+ return pEntry;
+}
+//------------------------------------------------------------------------
+void FmFilterNavigator::KeyInput(const KeyEvent& rKEvt)
+{
+ const KeyCode& rKeyCode = rKEvt.GetKeyCode();
+
+ switch ( rKeyCode.GetCode() )
+ {
+ case KEY_UP:
+ case KEY_DOWN:
+ {
+ if ( !rKeyCode.IsMod1() || !rKeyCode.IsMod2() || rKeyCode.IsShift() )
+ break;
+
+ ::std::vector<FmFilterItem*> aItemList;
+ if ( !getSelectedFilterItems( aItemList ) )
+ break;
+
+ ::std::mem_fun1_t<SvLBoxEntry*,FmFilterNavigator,SvLBoxEntry*> getter = ::std::mem_fun(&FmFilterNavigator::getNextEntry);
+ if ( rKeyCode.GetCode() == KEY_UP )
+ getter = ::std::mem_fun(&FmFilterNavigator::getPrevEntry);
+
+ SvLBoxEntry* pTarget = getter( this, NULL );
+ if ( !pTarget )
+ break;
+
+ FmFilterItems* pTargetItems = getTargetItems( pTarget );
+ if ( !pTargetItems )
+ break;
+
+ ::std::vector<FmFilterItem*>::const_iterator aEnd = aItemList.end();
+ sal_Bool bNextTargetItem = sal_True;
+ while ( bNextTargetItem )
+ {
+ ::std::vector<FmFilterItem*>::const_iterator i = aItemList.begin();
+ for (; i != aEnd; ++i)
+ {
+ if ( (*i)->GetParent() == pTargetItems )
+ {
+ pTarget = getter(this,pTarget);
+ if ( !pTarget )
+ return;
+ pTargetItems = getTargetItems( pTarget );
+ break;
+ }
+ else
+ {
+ FmFilterItem* pFilterItem = pTargetItems->Find( (*i)->GetComponentIndex() );
+ // we found the text component so jump above
+ if ( pFilterItem )
+ {
+ pTarget = getter( this, pTarget );
+ if ( !pTarget )
+ return;
+
+ pTargetItems = getTargetItems( pTarget );
+ break;
+ }
+ }
+ }
+ bNextTargetItem = i != aEnd && pTargetItems;
+ }
+
+ if ( pTargetItems )
+ {
+ insertFilterItem( aItemList, pTargetItems );
+ return;
+ }
+ }
+ break;
+
+ case KEY_DELETE:
+ {
+ if ( rKeyCode.GetModifier() )
+ break;
+
+ if ( !IsSelected( First() ) || GetEntryCount() > 1 )
+ DeleteSelection();
+ return;
+ }
+ }
+
+ SvTreeListBox::KeyInput(rKEvt);
+}
+
+//------------------------------------------------------------------------------
+void FmFilterNavigator::DeleteSelection()
+{
+ // to avoid the deletion of an entry twice (e.g. deletion of a parent and afterward
+ // the deletion of it's child, i have to shrink the selecton list
+ ::std::vector<SvLBoxEntry*> aEntryList;
+ for (SvLBoxEntry* pEntry = FirstSelected();
+ pEntry != NULL;
+ pEntry = NextSelected(pEntry))
+ {
+ FmFilterItem* pFilterItem = PTR_CAST(FmFilterItem, (FmFilterData*)pEntry->GetUserData());
+ if (pFilterItem && IsSelected(GetParent(pEntry)))
+ continue;
+
+ FmFormItem* pForm = PTR_CAST(FmFormItem, (FmFilterData*)pEntry->GetUserData());
+ if (!pForm)
+ aEntryList.push_back(pEntry);
+ }
+
+ // Remove the selection
+ SelectAll(sal_False);
+
+ for (::std::vector<SvLBoxEntry*>::reverse_iterator i = aEntryList.rbegin();
+ // link problems with operator ==
+ i.base() != aEntryList.rend().base(); i++)
+ {
+ m_pModel->Remove((FmFilterData*)(*i)->GetUserData());
+ }
+}
+// -----------------------------------------------------------------------------
+
+//========================================================================
+// class FmFilterNavigatorWin
+//========================================================================
+FmFilterNavigatorWin::FmFilterNavigatorWin( SfxBindings* _pBindings, SfxChildWindow* _pMgr,
+ Window* _pParent )
+ :SfxDockingWindow( _pBindings, _pMgr, _pParent, WinBits(WB_STDMODELESS|WB_SIZEABLE|WB_ROLLABLE|WB_3DLOOK|WB_DOCKABLE) )
+ ,SfxControllerItem( SID_FM_FILTER_NAVIGATOR_CONTROL, *_pBindings )
+{
+ SetHelpId( HID_FILTER_NAVIGATOR_WIN );
+
+ m_pNavigator = new FmFilterNavigator( this );
+ m_pNavigator->Show();
+ SetText( SVX_RES(RID_STR_FILTER_NAVIGATOR) );
+ SfxDockingWindow::SetFloatingSize( Size(200,200) );
+}
+
+//------------------------------------------------------------------------
+FmFilterNavigatorWin::~FmFilterNavigatorWin()
+{
+ delete m_pNavigator;
+}
+
+//-----------------------------------------------------------------------
+void FmFilterNavigatorWin::UpdateContent(FmFormShell* pFormShell)
+{
+ if (!pFormShell)
+ m_pNavigator->UpdateContent( NULL, NULL );
+ else
+ {
+ Reference< XFormController > xController(pFormShell->GetImpl()->getActiveInternalController());
+ Reference< XIndexAccess > xContainer;
+ if (xController.is())
+ {
+ Reference< XChild > xChild(xController, UNO_QUERY);
+ for (Reference< XInterface > xParent(xChild->getParent());
+ xParent.is();
+ xParent = xChild.is() ? xChild->getParent() : Reference< XInterface > ())
+ {
+ xContainer = Reference< XIndexAccess > (xParent, UNO_QUERY);
+ xChild = Reference< XChild > (xParent, UNO_QUERY);
+ }
+ }
+ m_pNavigator->UpdateContent(xContainer, xController);
+ }
+}
+
+//-----------------------------------------------------------------------
+void FmFilterNavigatorWin::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+{
+ if( !pState || SID_FM_FILTER_NAVIGATOR_CONTROL != nSID )
+ return;
+
+ if( eState >= SFX_ITEM_AVAILABLE )
+ {
+ FmFormShell* pShell = PTR_CAST( FmFormShell,((SfxObjectItem*)pState)->GetShell() );
+ UpdateContent( pShell );
+ }
+ else
+ UpdateContent( NULL );
+}
+
+//-----------------------------------------------------------------------
+sal_Bool FmFilterNavigatorWin::Close()
+{
+ if ( m_pNavigator && m_pNavigator->IsEditingActive() )
+ m_pNavigator->EndEditing();
+
+ if ( m_pNavigator && m_pNavigator->IsEditingActive() )
+ // the EndEditing was vetoed (perhaps of an syntax error or such)
+ return sal_False;
+
+ UpdateContent( NULL );
+ return SfxDockingWindow::Close();
+}
+
+//-----------------------------------------------------------------------
+void FmFilterNavigatorWin::FillInfo( SfxChildWinInfo& rInfo ) const
+{
+ SfxDockingWindow::FillInfo( rInfo );
+ rInfo.bVisible = sal_False;
+}
+
+//-----------------------------------------------------------------------
+Size FmFilterNavigatorWin::CalcDockingSize( SfxChildAlignment eAlign )
+{
+ if ( ( eAlign == SFX_ALIGN_TOP ) || ( eAlign == SFX_ALIGN_BOTTOM ) )
+ return Size();
+
+ return SfxDockingWindow::CalcDockingSize( eAlign );
+}
+
+//-----------------------------------------------------------------------
+SfxChildAlignment FmFilterNavigatorWin::CheckAlignment( SfxChildAlignment eActAlign, SfxChildAlignment eAlign )
+{
+ switch (eAlign)
+ {
+ case SFX_ALIGN_LEFT:
+ case SFX_ALIGN_RIGHT:
+ case SFX_ALIGN_NOALIGNMENT:
+ return (eAlign);
+ default:
+ break;
+ }
+
+ return (eActAlign);
+}
+
+//------------------------------------------------------------------------
+void FmFilterNavigatorWin::Resize()
+{
+ SfxDockingWindow::Resize();
+
+ Size aLogOutputSize = PixelToLogic( GetOutputSizePixel(), MAP_APPFONT );
+ Size aLogExplSize = aLogOutputSize;
+ aLogExplSize.Width() -= 6;
+ aLogExplSize.Height() -= 6;
+
+ Point aExplPos = LogicToPixel( Point(3,3), MAP_APPFONT );
+ Size aExplSize = LogicToPixel( aLogExplSize, MAP_APPFONT );
+
+ m_pNavigator->SetPosSizePixel( aExplPos, aExplSize );
+}
+// -----------------------------------------------------------------------------
+void FmFilterNavigatorWin::GetFocus()
+{
+ // oj #97405#
+ if ( m_pNavigator )
+ m_pNavigator->GrabFocus();
+}
+// -----------------------------------------------------------------------------
+
+
+//========================================================================
+// class FmFilterNavigatorWinMgr
+//========================================================================
+SFX_IMPL_DOCKINGWINDOW( FmFilterNavigatorWinMgr, SID_FM_FILTER_NAVIGATOR )
+
+//-----------------------------------------------------------------------
+FmFilterNavigatorWinMgr::FmFilterNavigatorWinMgr( Window *_pParent, sal_uInt16 _nId,
+ SfxBindings *_pBindings, SfxChildWinInfo* _pInfo )
+ :SfxChildWindow( _pParent, _nId )
+{
+ pWindow = new FmFilterNavigatorWin( _pBindings, this, _pParent );
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+ ((SfxDockingWindow*)pWindow)->Initialize( _pInfo );
+}
+
+//........................................................................
+} // namespace svxform
+//........................................................................
diff --git a/svx/source/form/filtnav.src b/svx/source/form/filtnav.src
new file mode 100644
index 000000000000..3d9eff3de4e8
--- /dev/null
+++ b/svx/source/form/filtnav.src
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svx/svxids.hrc>
+#include "svx/fmresids.hrc"
+#include "fmhelp.hrc"
+
+Menu RID_FM_FILTER_MENU
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = SID_FM_DELETE ;
+ HelpId = HID_FM_DELETE;
+ Text [ en-US ] = "~Delete" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_FILTER_EDIT ;
+ HelpId = HID_FM_FILTER_EDIT;
+ Text [ en-US ] = "~Edit" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_FILTER_IS_NULL ;
+ HelpId = HID_FM_FILTER_IS_NULL;
+ Text [ en-US ] = "~Is Null" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_FILTER_IS_NOT_NULL ;
+ HelpId = HID_FM_FILTER_IS_NOT_NULL;
+ Text [ en-US ] = "I~s not Null" ;
+ };
+ };
+};
+
diff --git a/svx/source/form/fmPropBrw.cxx b/svx/source/form/fmPropBrw.cxx
new file mode 100644
index 000000000000..6768acfbe1f2
--- /dev/null
+++ b/svx/source/form/fmPropBrw.cxx
@@ -0,0 +1,722 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "fmhelp.hrc"
+#include "fmprop.hrc"
+#include "fmPropBrw.hxx"
+#include "svx/fmresids.hrc"
+#include "fmservs.hxx"
+#include "fmshimp.hxx"
+#include "fmpgeimp.hxx"
+
+#include "svx/dialmgr.hxx"
+#include "svx/fmpage.hxx"
+#include "svx/fmshell.hxx"
+#include "svx/sdrpagewindow.hxx"
+#include "svx/svdpagv.hxx"
+#include "svx/svxids.hrc"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/form/XForm.hpp>
+#include <com/sun/star/form/FormComponentType.hpp>
+#include <com/sun/star/awt/XLayoutConstrains.hpp>
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/inspection/ObjectInspector.hpp>
+#include <com/sun/star/inspection/ObjectInspectorModel.hpp>
+#include <com/sun/star/form/inspection/DefaultFormComponentInspectorModel.hpp>
+#include <com/sun/star/inspection/XObjectInspectorUI.hpp>
+#include <com/sun/star/inspection/DefaultHelpProvider.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/processfactory.hxx>
+#include <comphelper/property.hxx>
+#include <cppuhelper/component_context.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/childwin.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objitem.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <toolkit/unohlp.hxx>
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include <tools/shl.hxx>
+#include <unotools/confignode.hxx>
+#include <vcl/stdtext.hxx>
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::inspection;
+using namespace ::com::sun::star::form::inspection;
+using ::com::sun::star::awt::XWindow;
+
+/*************************************************************************/
+//========================================================================
+//= FmPropBrwMgr
+//========================================================================
+//-----------------------------------------------------------------------
+SFX_IMPL_FLOATINGWINDOW(FmPropBrwMgr, SID_FM_SHOW_PROPERTIES)
+
+//-----------------------------------------------------------------------
+FmPropBrwMgr::FmPropBrwMgr( Window* _pParent, sal_uInt16 _nId,
+ SfxBindings* _pBindings, SfxChildWinInfo* _pInfo)
+ :SfxChildWindow(_pParent, _nId)
+{
+ pWindow = new FmPropBrw( ::comphelper::getProcessServiceFactory(), _pBindings, this, _pParent, _pInfo );
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+ ((SfxFloatingWindow*)pWindow)->Initialize( _pInfo );
+}
+
+//========================================================================
+//========================================================================
+const long STD_WIN_SIZE_X = 300;
+const long STD_WIN_SIZE_Y = 350;
+
+const long STD_MIN_SIZE_X = 250;
+const long STD_MIN_SIZE_Y = 250;
+
+const long STD_WIN_POS_X = 50;
+const long STD_WIN_POS_Y = 50;
+const long WIN_BORDER = 2;
+const long MIN_WIN_SIZE_X = 50;
+const long MIN_WIN_SIZE_Y = 50;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::form;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::svxform;
+
+::rtl::OUString GetUIHeadlineName(sal_Int16 nClassId, const Any& aUnoObj)
+{
+ sal_uInt16 nClassNameResourceId = 0;
+
+ switch ( nClassId )
+ {
+ case FormComponentType::TEXTFIELD:
+ {
+ Reference< XInterface > xIFace;
+ aUnoObj >>= xIFace;
+ nClassNameResourceId = RID_STR_PROPTITLE_EDIT;
+ if (xIFace.is())
+ { // we have a chance to check if it's a formatted field model
+ Reference< XServiceInfo > xInfo(xIFace, UNO_QUERY);
+ if (xInfo.is() && (xInfo->supportsService(FM_SUN_COMPONENT_FORMATTEDFIELD)))
+ nClassNameResourceId = RID_STR_PROPTITLE_FORMATTED;
+ else if (!xInfo.is())
+ {
+ // couldn't distinguish between formatted and edit with the service name, so try with the properties
+ Reference< XPropertySet > xProps(xIFace, UNO_QUERY);
+ if (xProps.is())
+ {
+ Reference< XPropertySetInfo > xPropsInfo = xProps->getPropertySetInfo();
+ if (xPropsInfo.is() && xPropsInfo->hasPropertyByName(FM_PROP_FORMATSSUPPLIER))
+ nClassNameResourceId = RID_STR_PROPTITLE_FORMATTED;
+ }
+ }
+ }
+ }
+ break;
+
+ case FormComponentType::COMMANDBUTTON:
+ nClassNameResourceId = RID_STR_PROPTITLE_PUSHBUTTON; break;
+ case FormComponentType::RADIOBUTTON:
+ nClassNameResourceId = RID_STR_PROPTITLE_RADIOBUTTON; break;
+ case FormComponentType::CHECKBOX:
+ nClassNameResourceId = RID_STR_PROPTITLE_CHECKBOX; break;
+ case FormComponentType::LISTBOX:
+ nClassNameResourceId = RID_STR_PROPTITLE_LISTBOX; break;
+ case FormComponentType::COMBOBOX:
+ nClassNameResourceId = RID_STR_PROPTITLE_COMBOBOX; break;
+ case FormComponentType::GROUPBOX:
+ nClassNameResourceId = RID_STR_PROPTITLE_GROUPBOX; break;
+ case FormComponentType::IMAGEBUTTON:
+ nClassNameResourceId = RID_STR_PROPTITLE_IMAGEBUTTON; break;
+ case FormComponentType::FIXEDTEXT:
+ nClassNameResourceId = RID_STR_PROPTITLE_FIXEDTEXT; break;
+ case FormComponentType::GRIDCONTROL:
+ nClassNameResourceId = RID_STR_PROPTITLE_DBGRID; break;
+ case FormComponentType::FILECONTROL:
+ nClassNameResourceId = RID_STR_PROPTITLE_FILECONTROL; break;
+ case FormComponentType::DATEFIELD:
+ nClassNameResourceId = RID_STR_PROPTITLE_DATEFIELD; break;
+ case FormComponentType::TIMEFIELD:
+ nClassNameResourceId = RID_STR_PROPTITLE_TIMEFIELD; break;
+ case FormComponentType::NUMERICFIELD:
+ nClassNameResourceId = RID_STR_PROPTITLE_NUMERICFIELD; break;
+ case FormComponentType::CURRENCYFIELD:
+ nClassNameResourceId = RID_STR_PROPTITLE_CURRENCYFIELD; break;
+ case FormComponentType::PATTERNFIELD:
+ nClassNameResourceId = RID_STR_PROPTITLE_PATTERNFIELD; break;
+ case FormComponentType::IMAGECONTROL:
+ nClassNameResourceId = RID_STR_PROPTITLE_IMAGECONTROL; break;
+ case FormComponentType::HIDDENCONTROL:
+ nClassNameResourceId = RID_STR_PROPTITLE_HIDDEN; break;
+ case FormComponentType::SCROLLBAR:
+ nClassNameResourceId = RID_STR_PROPTITLE_SCROLLBAR; break;
+ case FormComponentType::SPINBUTTON:
+ nClassNameResourceId = RID_STR_PROPTITLE_SPINBUTTON; break;
+ case FormComponentType::NAVIGATIONBAR:
+ nClassNameResourceId = RID_STR_PROPTITLE_NAVBAR; break;
+ case FormComponentType::CONTROL:
+ default:
+ nClassNameResourceId = RID_STR_CONTROL; break;
+ }
+
+ if ( !nClassNameResourceId )
+ return ::rtl::OUString();
+
+ return ::rtl::OUString( String( SVX_RES( nClassNameResourceId ) ) );
+}
+
+//========================================================================
+// class FmPropBrw
+//========================================================================
+DBG_NAME(FmPropBrw);
+//------------------------------------------------------------------------
+FmPropBrw::FmPropBrw( const Reference< XMultiServiceFactory >& _xORB, SfxBindings* _pBindings,
+ SfxChildWindow* _pMgr, Window* _pParent, const SfxChildWinInfo* _pInfo )
+ :SfxFloatingWindow(_pBindings, _pMgr, _pParent, WinBits(WB_STDMODELESS|WB_SIZEABLE|WB_3DLOOK|WB_ROLLABLE) )
+ ,SfxControllerItem(SID_FM_PROPERTY_CONTROL, *_pBindings)
+ ,m_bInitialStateChange(sal_True)
+ ,m_bInStateChange( false )
+ ,m_xORB(_xORB)
+{
+ DBG_CTOR(FmPropBrw,NULL);
+
+ ::Size aPropWinSize(STD_WIN_SIZE_X,STD_WIN_SIZE_Y);
+ SetMinOutputSizePixel(::Size(STD_MIN_SIZE_X,STD_MIN_SIZE_Y));
+ SetOutputSizePixel(aPropWinSize);
+ SetUniqueId(UID_FORMPROPBROWSER_FRAME);
+
+ try
+ {
+ // create a frame wrapper for myself
+ m_xMeAsFrame = Reference< XFrame >(m_xORB->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.Frame")), UNO_QUERY);
+ if (m_xMeAsFrame.is())
+ {
+ // create an intermediate window, which is to be the container window of the frame
+ // Do *not* use |this| as container window for the frame, this would result in undefined
+ // responsiblity for this window (as soon as we initialize a frame with a window, the frame
+ // is responsible for it's life time, but |this| is controlled by the belonging SfxChildWindow)
+ // #i34249# - 2004-09-27 - fs@openoffice.org
+ Window* pContainerWindow = new Window( this );
+ pContainerWindow->Show();
+ m_xFrameContainerWindow = VCLUnoHelper::GetInterface ( pContainerWindow );
+
+ m_xMeAsFrame->initialize( m_xFrameContainerWindow );
+ m_xMeAsFrame->setName(::rtl::OUString::createFromAscii("form property browser"));
+ if ( _pBindings->GetDispatcher() )
+ {
+ ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFramesSupplier >
+ xSupp ( _pBindings->GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY );
+// if ( xSupp.is() )
+// xSupp->getFrames()->append( m_xMeAsFrame );
+ // Don't append frame to frame hierachy to prevent UI_DEACTIVATE messages
+ // #i31834# - 2004-07-27 - cd@openoffice.org
+ }
+ }
+ }
+ catch (Exception&)
+ {
+ DBG_ERROR("FmPropBrw::FmPropBrw: could not create/initialize my frame!");
+ m_xMeAsFrame.clear();
+ }
+
+ if (m_xMeAsFrame.is())
+ _pMgr->SetFrame( m_xMeAsFrame );
+
+
+ if ( m_xBrowserComponentWindow.is() )
+ m_xBrowserComponentWindow->setVisible( sal_True );
+
+ if ( _pInfo )
+ m_sLastActivePage = _pInfo->aExtraString;
+}
+
+//------------------------------------------------------------------------
+void FmPropBrw::Resize()
+{
+ SfxFloatingWindow::Resize();
+
+ if ( m_xFrameContainerWindow.is() )
+ {
+ try
+ {
+ ::Size aOutputSize( GetOutputSizePixel() );
+ m_xFrameContainerWindow->setPosSize( 0, 0, aOutputSize.Width(), aOutputSize.Height(), awt::PosSize::POSSIZE );
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "FmPropBrw::Resize: caught an exception!" );
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+FmPropBrw::~FmPropBrw()
+{
+ if (m_xBrowserController.is())
+ implDetachController();
+ try
+ {
+ // remove our own properties from the component context. We cannot ensure that the component context
+ // is freed (there might be refcount problems :-\), so at least ensure the context itself
+ // does hold the objects anymore
+ Reference<XNameContainer> xName(m_xInspectorContext,uno::UNO_QUERY);
+ if ( xName.is() )
+ {
+ const ::rtl::OUString pProps[] = { ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContextDocument" ) )
+ , ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DialogParentWindow" ) )
+ , ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlContext" ) )
+ , ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlShapeAccess" ) ) };
+ for ( size_t i = 0; i < sizeof(pProps)/sizeof(pProps[0]); ++i )
+ xName->removeByName( pProps[i] );
+ }
+ }
+ catch (const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ DBG_DTOR(FmPropBrw,NULL);
+}
+
+//-----------------------------------------------------------------------
+::rtl::OUString FmPropBrw::getCurrentPage() const
+{
+ ::rtl::OUString sCurrentPage;
+ try
+ {
+ if ( m_xBrowserController.is() )
+ {
+ OSL_VERIFY( m_xBrowserController->getViewData() >>= sCurrentPage );
+ }
+
+ if ( !sCurrentPage.getLength() )
+ sCurrentPage = m_sLastActivePage;
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "FmPropBrw::getCurrentPage: caught an exception while retrieving the current page!" );
+ }
+ return sCurrentPage;
+}
+
+//-----------------------------------------------------------------------
+void FmPropBrw::implDetachController()
+{
+ m_sLastActivePage = getCurrentPage();
+
+ implSetNewSelection( InterfaceBag() );
+
+ if ( m_xMeAsFrame.is() )
+ {
+ try
+ {
+ m_xMeAsFrame->setComponent(NULL, NULL);
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "FmPropBrw::implDetachController: caught an exception while resetting the component!" );
+ }
+ }
+
+ // we attached a frame to the controller manually, so we need to manually tell it that it's detached, too
+ // 96068 - 09.01.2002 - fs@openoffice.org
+ if ( m_xBrowserController.is() )
+ m_xBrowserController->attachFrame( NULL );
+
+ m_xBrowserController.clear();
+ m_xInspectorModel.clear();
+ m_xMeAsFrame.clear();
+}
+
+//-----------------------------------------------------------------------
+sal_Bool FmPropBrw::Close()
+{
+ // suspend the controller (it is allowed to veto)
+ if ( m_xMeAsFrame.is() )
+ {
+ try
+ {
+ Reference< XController > xController( m_xMeAsFrame->getController() );
+ if ( xController.is() && !xController->suspend( sal_True ) )
+ return sal_False;
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "FmPropBrw::Close: caught an exception while asking the controller!" );
+ }
+ }
+
+ implDetachController();
+
+ if( IsRollUp() )
+ RollDown();
+
+ // remember our bindings: while we're closed, we're deleted, too, so accessing the bindings after this
+ // would be deadly
+ // 10/19/00 - 79321 - FS
+ SfxBindings& rBindings = SfxControllerItem::GetBindings();
+
+ sal_Bool bClose = SfxFloatingWindow::Close();
+
+ if (bClose)
+ {
+ rBindings.Invalidate(SID_FM_CTL_PROPERTIES);
+ rBindings.Invalidate(SID_FM_PROPERTIES);
+ }
+
+ return bClose;
+}
+
+//-----------------------------------------------------------------------
+bool FmPropBrw::implIsReadOnlyModel() const
+{
+ try
+ {
+ if ( m_xInspectorModel.is() )
+ return m_xInspectorModel->getIsReadOnly();
+ return false;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return true;
+}
+
+//-----------------------------------------------------------------------
+void FmPropBrw::implSetNewSelection( const InterfaceBag& _rSelection )
+{
+ if ( m_xBrowserController.is() )
+ {
+ try
+ {
+ Reference< XObjectInspector > xInspector( m_xBrowserController, UNO_QUERY_THROW );
+
+ // tell it the objects to inspect
+ Sequence< Reference< XInterface > > aSelection( _rSelection.size() );
+ ::std::copy( _rSelection.begin(), _rSelection.end(), aSelection.getArray() );
+
+ xInspector->inspect( aSelection );
+ }
+ catch( const VetoException& )
+ {
+ return;
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "FmPropBrw::implSetNewSelection: caught an unexpected exception!" );
+ return;
+ }
+
+ // set the new title according to the selected object
+ String sTitle;
+
+ if ( _rSelection.empty() )
+ {
+ sTitle = String( SVX_RES( RID_STR_NO_PROPERTIES ) );
+ }
+ else if ( _rSelection.size() > 1 )
+ {
+ // no form component and (no form or no name) -> Multiselection
+ sTitle = String( SVX_RES( RID_STR_PROPERTIES_CONTROL ) );
+ sTitle += String( SVX_RES( RID_STR_PROPTITLE_MULTISELECT ) );
+ }
+ else
+ {
+ Reference< XPropertySet > xSingleSelection( *_rSelection.begin(), UNO_QUERY);
+ if ( ::comphelper::hasProperty( FM_PROP_CLASSID, xSingleSelection ) )
+ {
+ sal_Int16 nClassID = FormComponentType::CONTROL;
+ xSingleSelection->getPropertyValue( FM_PROP_CLASSID ) >>= nClassID;
+
+ sTitle = String( SVX_RES( RID_STR_PROPERTIES_CONTROL ) );
+ sTitle += String( GetUIHeadlineName( nClassID, makeAny( xSingleSelection ) ) );
+ }
+ else if ( Reference< XForm >( xSingleSelection, UNO_QUERY ).is() )
+ sTitle = String( SVX_RES( RID_STR_PROPERTIES_FORM ) );
+ }
+
+ if ( implIsReadOnlyModel() )
+ sTitle += String( SVX_RES( RID_STR_READONLY_VIEW ) );
+
+ SetText( sTitle );
+
+ // #95343# ---------------------------------
+ Reference< ::com::sun::star::awt::XLayoutConstrains > xLayoutConstrains( m_xBrowserController, UNO_QUERY );
+ if( xLayoutConstrains.is() )
+ {
+ ::Size aConstrainedSize;
+ ::com::sun::star::awt::Size aMinSize = xLayoutConstrains->getMinimumSize();
+
+ sal_Int32 nLeft(0), nTop(0), nRight(0), nBottom(0);
+ GetBorder( nLeft, nTop, nRight, nBottom );
+ aMinSize.Width += nLeft + nRight + 8;
+ aMinSize.Height += nTop + nBottom + 8;
+
+ aConstrainedSize.setHeight( aMinSize.Height );
+ aConstrainedSize.setWidth( aMinSize.Width );
+ SetMinOutputSizePixel( aConstrainedSize );
+ aConstrainedSize = GetOutputSizePixel();
+ sal_Bool bResize = sal_False;
+ if( aConstrainedSize.Width() < aMinSize.Width )
+ {
+ aConstrainedSize.setWidth( aMinSize.Width );
+ bResize = sal_True;
+ }
+ if( aConstrainedSize.Height() < aMinSize.Height )
+ {
+ aConstrainedSize.setHeight( aMinSize.Height );
+ bResize = sal_True;
+ }
+ if( bResize )
+ SetOutputSizePixel( aConstrainedSize );
+ }
+ }
+}
+
+//-----------------------------------------------------------------------
+void FmPropBrw::FillInfo( SfxChildWinInfo& rInfo ) const
+{
+ rInfo.bVisible = sal_False;
+ rInfo.aExtraString = getCurrentPage();
+}
+
+//-----------------------------------------------------------------------
+IMPL_LINK( FmPropBrw, OnAsyncGetFocus, void*, /*NOTINTERESTEDIN*/ )
+{
+ if (m_xBrowserComponentWindow.is())
+ m_xBrowserComponentWindow->setFocus();
+ return 0L;
+}
+
+//-----------------------------------------------------------------------
+namespace
+{
+ static bool lcl_shouldEnableHelpSection( const Reference< XMultiServiceFactory >& _rxFactory )
+ {
+ const ::rtl::OUString sConfigName( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common/Forms/PropertyBrowser/" ) );
+ const ::rtl::OUString sPropertyName( RTL_CONSTASCII_USTRINGPARAM( "DirectHelp" ) );
+
+ ::utl::OConfigurationTreeRoot aConfiguration(
+ ::utl::OConfigurationTreeRoot::createWithServiceFactory( _rxFactory, sConfigName ) );
+
+ bool bEnabled = false;
+ OSL_VERIFY( aConfiguration.getNodeValue( sPropertyName ) >>= bEnabled );
+ return bEnabled;
+ }
+}
+//-----------------------------------------------------------------------
+void FmPropBrw::impl_createPropertyBrowser_throw( FmFormShell* _pFormShell )
+{
+ // the document in which we live
+ Reference< XInterface > xDocument;
+ if ( _pFormShell && _pFormShell->GetObjectShell() )
+ xDocument = _pFormShell->GetObjectShell()->GetModel();
+
+ // the context of the controls in our document
+ Reference< awt::XControlContainer > xControlContext;
+ if ( _pFormShell && _pFormShell->GetFormView() )
+ {
+ SdrPageView* pPageView = _pFormShell->GetFormView()->GetSdrPageView();
+
+ if(pPageView)
+ {
+ SdrPageWindow* pPageWindow = pPageView->GetPageWindow(0L);
+
+ if(pPageWindow)
+ {
+ xControlContext = pPageWindow->GetControlContainer();
+ }
+ }
+ }
+
+ // the default parent window for message boxes
+ Reference< XWindow > xParentWindow( VCLUnoHelper::GetInterface ( this ) );
+
+ // the mapping from control models to control shapes
+ Reference< XMap > xControlMap;
+ FmFormPage* pFormPage = _pFormShell ? _pFormShell->GetCurPage() : NULL;
+ if ( pFormPage )
+ xControlMap = pFormPage->GetImpl().getControlToShapeMap();
+
+ // our own component context
+ Reference< XPropertySet > xFactoryProperties( m_xORB, UNO_QUERY_THROW );
+ Reference< XComponentContext > xOwnContext(
+ xFactoryProperties->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ),
+ UNO_QUERY_THROW );
+
+ // a ComponentContext for the
+ ::cppu::ContextEntry_Init aHandlerContextInfo[] =
+ {
+ ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContextDocument" ) ), makeAny( xDocument ) ),
+ ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DialogParentWindow" ) ), makeAny( xParentWindow ) ),
+ ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlContext" ) ), makeAny( xControlContext ) ),
+ ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlShapeAccess" ) ), makeAny( xControlMap ) )
+ };
+ m_xInspectorContext.set(
+ ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ),
+ xOwnContext ) );
+
+ bool bEnableHelpSection = lcl_shouldEnableHelpSection( m_xORB );
+
+ // an object inspector model
+ m_xInspectorModel =
+ bEnableHelpSection
+ ? DefaultFormComponentInspectorModel::createWithHelpSection( m_xInspectorContext, 3, 5 )
+ : DefaultFormComponentInspectorModel::createDefault( m_xInspectorContext );
+
+ // an object inspector
+ m_xBrowserController = m_xBrowserController.query(
+ ObjectInspector::createWithModel(
+ m_xInspectorContext, m_xInspectorModel
+ ) );
+
+ if ( !m_xBrowserController.is() )
+ {
+ ::rtl::OUString sServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.inspection.ObjectInspector" ) );
+ ShowServiceNotAvailableError( GetParent(), sServiceName, sal_True );
+ }
+ else
+ {
+ m_xBrowserController->attachFrame( m_xMeAsFrame );
+ m_xBrowserComponentWindow = m_xMeAsFrame->getComponentWindow();
+ DBG_ASSERT( m_xBrowserComponentWindow.is(), "FmPropBrw::impl_createPropertyBrowser_throw: attached the controller, but have no component window!" );
+ }
+
+ if ( bEnableHelpSection )
+ {
+ Reference< XObjectInspector > xInspector( m_xBrowserController, UNO_QUERY_THROW );
+ Reference< XObjectInspectorUI > xInspectorUI( xInspector->getInspectorUI() );
+ Reference< XInterface > xDefaultHelpProvider( DefaultHelpProvider::create( m_xInspectorContext, xInspectorUI ) );
+ }
+}
+
+//-----------------------------------------------------------------------
+void FmPropBrw::impl_ensurePropertyBrowser_nothrow( FmFormShell* _pFormShell )
+{
+ // the document in which we live
+ Reference< XInterface > xDocument;
+ SfxObjectShell* pObjectShell = _pFormShell ? _pFormShell->GetObjectShell() : NULL;
+ if ( pObjectShell )
+ xDocument = pObjectShell->GetModel();
+ if ( ( xDocument == m_xLastKnownDocument ) && m_xBrowserController.is() )
+ // nothing to do
+ return;
+
+ try
+ {
+ // clean up any previous instances of the object inspector
+ if ( m_xMeAsFrame.is() )
+ m_xMeAsFrame->setComponent( NULL, NULL );
+ else
+ ::comphelper::disposeComponent( m_xBrowserController );
+ m_xBrowserController.clear();
+ m_xInspectorModel.clear();
+ m_xBrowserComponentWindow.clear();
+
+ // and create a new one
+ impl_createPropertyBrowser_throw( _pFormShell );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ m_xLastKnownDocument = xDocument;
+}
+
+//-----------------------------------------------------------------------
+void FmPropBrw::StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState)
+{
+ if (!pState || SID_FM_PROPERTY_CONTROL != nSID)
+ return;
+
+ m_bInStateChange = true;
+ try
+ {
+ if (eState >= SFX_ITEM_AVAILABLE)
+ {
+ FmFormShell* pShell = PTR_CAST(FmFormShell,((SfxObjectItem*)pState)->GetShell());
+ InterfaceBag aSelection;
+ if ( pShell )
+ pShell->GetImpl()->getCurrentSelection( aSelection );
+
+ impl_ensurePropertyBrowser_nothrow( pShell );
+
+ // set the new object to inspect
+ implSetNewSelection( aSelection );
+
+ // if this is the first time we're here, some additional things need to be done ...
+ if ( m_bInitialStateChange )
+ {
+ // if we're just newly created, we want to have the focus
+ PostUserEvent( LINK( this, FmPropBrw, OnAsyncGetFocus ) );
+
+ // and additionally, we want to show the page which was active during
+ // our previous incarnation
+ if ( m_sLastActivePage.getLength() )
+ {
+ try
+ {
+ if ( m_xBrowserController.is() )
+ m_xBrowserController->restoreViewData( makeAny( m_sLastActivePage ) );
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "FmPropBrw::StateChanged: caught an exception while setting the initial page!" );
+ }
+ }
+
+ m_bInitialStateChange = sal_False;
+ }
+
+ }
+ else
+ {
+ implSetNewSelection( InterfaceBag() );
+ }
+ }
+ catch (Exception&)
+ {
+ DBG_ERROR("FmPropBrw::StateChanged: Exception occured!");
+ }
+ m_bInStateChange = false;
+}
diff --git a/svx/source/form/fmcontrolbordermanager.cxx b/svx/source/form/fmcontrolbordermanager.cxx
new file mode 100644
index 000000000000..28d016e1e146
--- /dev/null
+++ b/svx/source/form/fmcontrolbordermanager.cxx
@@ -0,0 +1,445 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#ifndef SVX_SOURCE_FORM_FMCONTROLBORDERMANAGER_HXX
+#include "fmcontrolbordermanager.hxx"
+#endif
+
+#ifndef _SVX_FMPROP_HRC
+#include "fmprop.hrc"
+#endif
+
+/** === begin UNO includes === **/
+#include <com/sun/star/form/validation/XValidatableFormComponent.hpp>
+#include <com/sun/star/awt/XTextComponent.hpp>
+#include <com/sun/star/awt/XListBox.hpp>
+/** === end UNO includes === **/
+#include <tools/debug.hxx>
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::awt;
+ using namespace ::com::sun::star::form::validation;
+
+ //====================================================================
+ //= helper
+ //====================================================================
+ //--------------------------------------------------------------------
+ static void setUnderline( const Reference< XVclWindowPeer >& _rxPeer, const UnderlineDescriptor& _rUnderline )
+ {
+ OSL_ENSURE( _rxPeer.is(), "setUnderline: invalid peer!" );
+
+ // the underline type is an aspect of the font
+ FontDescriptor aFont;
+ OSL_VERIFY( _rxPeer->getProperty( FM_PROP_FONT ) >>= aFont );
+ aFont.Underline = _rUnderline.nUnderlineType;
+ _rxPeer->setProperty( FM_PROP_FONT, makeAny( aFont ) );
+ // the underline color is a separate property
+ _rxPeer->setProperty( FM_PROP_TEXTLINECOLOR, makeAny( _rUnderline.nUnderlineColor ) );
+ }
+
+ //--------------------------------------------------------------------
+ static void getUnderline( const Reference< XVclWindowPeer >& _rxPeer, UnderlineDescriptor& _rUnderline )
+ {
+ OSL_ENSURE( _rxPeer.is(), "getUnderline: invalid peer!" );
+
+ FontDescriptor aFont;
+ OSL_VERIFY( _rxPeer->getProperty( FM_PROP_FONT ) >>= aFont );
+ _rUnderline.nUnderlineType = aFont.Underline;
+
+ OSL_VERIFY( _rxPeer->getProperty( FM_PROP_TEXTLINECOLOR ) >>= _rUnderline.nUnderlineColor );
+ }
+
+ //--------------------------------------------------------------------
+ static void getBorder( const Reference< XVclWindowPeer >& _rxPeer, BorderDescriptor& _rBoder )
+ {
+ OSL_ENSURE( _rxPeer.is(), "getBorder: invalid peer!" );
+
+ OSL_VERIFY( _rxPeer->getProperty( FM_PROP_BORDER ) >>= _rBoder.nBorderType );
+ OSL_VERIFY( _rxPeer->getProperty( FM_PROP_BORDERCOLOR ) >>= _rBoder.nBorderColor );
+ }
+
+ //--------------------------------------------------------------------
+ static void setBorder( const Reference< XVclWindowPeer >& _rxPeer, const BorderDescriptor& _rBoder )
+ {
+ OSL_ENSURE( _rxPeer.is(), "setBorder: invalid peer!" );
+
+ _rxPeer->setProperty( FM_PROP_BORDER, makeAny( _rBoder.nBorderType ) );
+ _rxPeer->setProperty( FM_PROP_BORDERCOLOR, makeAny( _rBoder.nBorderColor ) );
+ }
+
+ //====================================================================
+ //= ControlBorderManager
+ //====================================================================
+ //--------------------------------------------------------------------
+ ControlBorderManager::ControlBorderManager()
+ :m_nFocusColor ( 0x000000FF )
+ ,m_nMouseHoveColor( 0x007098BE )
+ ,m_nInvalidColor ( 0x00FF0000 )
+ ,m_bDynamicBorderColors( false )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ ControlBorderManager::~ControlBorderManager()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ bool ControlBorderManager::canColorBorder( const Reference< XVclWindowPeer >& _rxPeer )
+ {
+ OSL_PRECOND( _rxPeer.is(), "ControlBorderManager::canColorBorder: invalid peer!" );
+
+ PeerBag::const_iterator aPos = m_aColorableControls.find( _rxPeer );
+ if ( aPos != m_aColorableControls.end() )
+ return true;
+
+ aPos = m_aNonColorableControls.find( _rxPeer );
+ if ( aPos != m_aNonColorableControls.end() )
+ return false;
+
+ // this peer is not yet known
+
+ // no border coloring for controls which are not for text input
+ // #i37434# / 2004-11-19 / frank.schoenheit@sun.com
+ Reference< XTextComponent > xText( _rxPeer, UNO_QUERY );
+ Reference< XListBox > xListBox( _rxPeer, UNO_QUERY );
+ if ( xText.is() || xListBox.is() )
+ {
+ sal_Int16 nBorderStyle = VisualEffect::NONE;
+ OSL_VERIFY( _rxPeer->getProperty( FM_PROP_BORDER ) >>= nBorderStyle );
+ if ( nBorderStyle == VisualEffect::FLAT )
+ // if you change this to also accept LOOK3D, then this would also work, but look ugly
+ {
+ m_aColorableControls.insert( _rxPeer );
+ return true;
+ }
+ }
+
+ m_aNonColorableControls.insert( _rxPeer );
+ return false;
+ }
+
+ //--------------------------------------------------------------------
+ ControlStatus ControlBorderManager::getControlStatus( const Reference< XControl >& _rxControl ) SAL_THROW(())
+ {
+ ControlStatus nStatus = CONTROL_STATUS_NONE;
+
+ if ( _rxControl.get() == m_aFocusControl.xControl.get() )
+ nStatus |= CONTROL_STATUS_FOCUSED;
+
+ if ( _rxControl.get() == m_aMouseHoverControl.xControl.get() )
+ nStatus |= CONTROL_STATUS_MOUSE_HOVER;
+
+ if ( m_aInvalidControls.find( ControlData( _rxControl ) ) != m_aInvalidControls.end() )
+ nStatus |= CONTROL_STATUS_INVALID;
+
+ return nStatus;
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int32 ControlBorderManager::getControlColorByStatus( ControlStatus _nStatus )
+ {
+ // "invalid" is ranked highest
+ if ( _nStatus & CONTROL_STATUS_INVALID )
+ return m_nInvalidColor;
+
+ // then, "focused" is more important than ...
+ if ( _nStatus & CONTROL_STATUS_FOCUSED )
+ return m_nFocusColor;
+
+ // ... "mouse over"
+ if ( _nStatus & CONTROL_STATUS_MOUSE_HOVER )
+ return m_nMouseHoveColor;
+
+ OSL_ENSURE( sal_False, "ControlBorderManager::getControlColorByStatus: invalid status!" );
+ return 0x00000000;
+ }
+
+ //--------------------------------------------------------------------
+ void ControlBorderManager::updateBorderStyle( const Reference< XControl >& _rxControl, const Reference< XVclWindowPeer >& _rxPeer, const BorderDescriptor& _rFallback ) SAL_THROW(())
+ {
+ OSL_PRECOND( _rxControl.is() && _rxPeer.is(), "ControlBorderManager::updateBorderStyle: invalid parameters!" );
+
+ ControlStatus nStatus = getControlStatus( _rxControl );
+ BorderDescriptor aBorder;
+ aBorder.nBorderType = ( nStatus == CONTROL_STATUS_NONE )
+ ? _rFallback.nBorderType
+ : VisualEffect::FLAT;
+ aBorder.nBorderColor = ( nStatus == CONTROL_STATUS_NONE )
+ ? _rFallback.nBorderColor
+ : getControlColorByStatus( nStatus );
+ setBorder( _rxPeer, aBorder );
+ }
+
+ //--------------------------------------------------------------------
+ void ControlBorderManager::determineOriginalBorderStyle( const Reference< XControl >& _rxControl, BorderDescriptor& _rData ) const
+ {
+ _rData = ControlData();
+ if ( m_aFocusControl.xControl.get() == _rxControl.get() )
+ {
+ _rData = m_aFocusControl;
+ }
+ else if ( m_aMouseHoverControl.xControl.get() == _rxControl.get() )
+ {
+ _rData = m_aMouseHoverControl;
+ }
+ else
+ {
+ ControlBag::const_iterator aPos = m_aInvalidControls.find( _rxControl );
+ if ( aPos != m_aInvalidControls.end() )
+ {
+ _rData = *aPos;
+ }
+ else
+ {
+ Reference< XVclWindowPeer > xPeer( _rxControl->getPeer(), UNO_QUERY );
+ getBorder( xPeer, _rData );
+ }
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void ControlBorderManager::controlStatusGained( const Reference< XInterface >& _rxControl, ControlData& _rControlData ) SAL_THROW(())
+ {
+ if ( _rxControl == _rControlData.xControl )
+ // nothing to do - though suspicious
+ return;
+
+ Reference< XControl > xAsControl( _rxControl, UNO_QUERY );
+ DBG_ASSERT( xAsControl.is(), "ControlBorderManager::controlStatusGained: invalid control!" );
+ if ( !xAsControl.is() )
+ return;
+
+ try
+ {
+ Reference< XVclWindowPeer > xPeer( xAsControl->getPeer(), UNO_QUERY );
+ if ( xPeer.is() && canColorBorder( xPeer ) )
+ {
+ // remember the control and it's current border color
+ _rControlData.xControl.clear(); // so determineOriginalBorderStyle doesn't get confused
+
+ determineOriginalBorderStyle( xAsControl, _rControlData );
+
+ _rControlData.xControl = xAsControl;
+
+ updateBorderStyle( xAsControl, xPeer, _rControlData );
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "ControlBorderManager::controlStatusGained: caught an exception!" );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void ControlBorderManager::controlStatusLost( const Reference< XInterface >& _rxControl, ControlData& _rControlData ) SAL_THROW(())
+ {
+ if ( _rxControl != _rControlData.xControl )
+ // nothing to do
+ return;
+
+ OSL_PRECOND( _rControlData.xControl.is(), "ControlBorderManager::controlStatusLost: invalid control data - this will crash!" );
+ try
+ {
+ Reference< XVclWindowPeer > xPeer( _rControlData.xControl->getPeer(), UNO_QUERY );
+ if ( xPeer.is() && canColorBorder( xPeer ) )
+ {
+ ControlData aPreviousStatus( _rControlData );
+ _rControlData = ControlData();
+ updateBorderStyle( aPreviousStatus.xControl, xPeer, aPreviousStatus );
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "ControlBorderManager::controlStatusLost: caught an exception!" );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void ControlBorderManager::enableDynamicBorderColor( )
+ {
+ m_bDynamicBorderColors = true;
+ }
+
+ //--------------------------------------------------------------------
+ void ControlBorderManager::disableDynamicBorderColor( )
+ {
+ m_bDynamicBorderColors = false;
+ restoreAll();
+ }
+
+ //--------------------------------------------------------------------
+ void ControlBorderManager::setStatusColor( ControlStatus _nStatus, sal_Int32 _nColor )
+ {
+ switch ( _nStatus )
+ {
+ case CONTROL_STATUS_FOCUSED:
+ m_nFocusColor = _nColor;
+ break;
+ case CONTROL_STATUS_MOUSE_HOVER:
+ m_nMouseHoveColor = _nColor;
+ break;
+ case CONTROL_STATUS_INVALID:
+ m_nInvalidColor = _nColor;
+ break;
+ default:
+ OSL_ENSURE( sal_False, "ControlBorderManager::setStatusColor: invalid status!" );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void ControlBorderManager::restoreAll()
+ {
+ if ( m_aFocusControl.xControl.is() )
+ controlStatusLost( m_aFocusControl.xControl, m_aFocusControl );
+ if ( m_aMouseHoverControl.xControl.is() )
+ controlStatusLost( m_aMouseHoverControl.xControl, m_aMouseHoverControl );
+
+ ControlBag aInvalidControls;
+ m_aInvalidControls.swap( aInvalidControls );
+
+ for ( ControlBag::const_iterator loop = aInvalidControls.begin();
+ loop != aInvalidControls.end();
+ ++loop
+ )
+ {
+ Reference< XVclWindowPeer > xPeer( loop->xControl->getPeer(), UNO_QUERY );
+ if ( xPeer.is() )
+ {
+ updateBorderStyle( loop->xControl, xPeer, *loop );
+ xPeer->setProperty( FM_PROP_HELPTEXT, makeAny( loop->sOriginalHelpText ) );
+ setUnderline( xPeer, *loop );
+ }
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void ControlBorderManager::focusGained( const Reference< XInterface >& _rxControl ) SAL_THROW(())
+ {
+ if ( m_bDynamicBorderColors )
+ controlStatusGained( _rxControl, m_aFocusControl );
+ }
+
+ //--------------------------------------------------------------------
+ void ControlBorderManager::focusLost( const Reference< XInterface >& _rxControl ) SAL_THROW(())
+ {
+ if ( m_bDynamicBorderColors )
+ controlStatusLost( _rxControl, m_aFocusControl );
+ }
+
+ //--------------------------------------------------------------------
+ void ControlBorderManager::mouseEntered( const Reference< XInterface >& _rxControl ) SAL_THROW(())
+ {
+ if ( m_bDynamicBorderColors )
+ controlStatusGained( _rxControl, m_aMouseHoverControl );
+ }
+
+ //--------------------------------------------------------------------
+ void ControlBorderManager::mouseExited( const Reference< XInterface >& _rxControl ) SAL_THROW(())
+ {
+ if ( m_bDynamicBorderColors )
+ controlStatusLost( _rxControl, m_aMouseHoverControl );
+ }
+
+ //--------------------------------------------------------------------
+ void ControlBorderManager::validityChanged( const Reference< XControl >& _rxControl, const Reference< XValidatableFormComponent >& _rxValidatable ) SAL_THROW(())
+ {
+ try
+ {
+ OSL_ENSURE( _rxControl.is(), "ControlBorderManager::validityChanged: invalid control!" );
+ OSL_ENSURE( _rxValidatable.is(), "ControlBorderManager::validityChanged: invalid validatable!" );
+
+ Reference< XVclWindowPeer > xPeer( _rxControl.is() ? _rxControl->getPeer() : Reference< XWindowPeer >(), UNO_QUERY );
+ if ( !xPeer.is() || !_rxValidatable.is() )
+ return;
+
+ ControlData aData( _rxControl );
+
+ if ( _rxValidatable->isValid() )
+ {
+ ControlBag::iterator aPos = m_aInvalidControls.find( aData );
+ if ( aPos != m_aInvalidControls.end() )
+ { // invalid before, valid now
+ ControlData aOriginalLayout( *aPos );
+ m_aInvalidControls.erase( aPos );
+
+ // restore all the things we used to indicate invalidity
+ if ( m_bDynamicBorderColors )
+ updateBorderStyle( _rxControl, xPeer, aOriginalLayout );
+ xPeer->setProperty( FM_PROP_HELPTEXT, makeAny( aOriginalLayout.sOriginalHelpText ) );
+ setUnderline( xPeer, aOriginalLayout );
+ }
+ return;
+ }
+
+ // we're here in the INVALID case
+ if ( m_aInvalidControls.find( _rxControl ) == m_aInvalidControls.end() )
+ { // valid before, invalid now
+
+ // remember the current border
+ determineOriginalBorderStyle( _rxControl, aData );
+ // and tool tip
+ xPeer->getProperty( FM_PROP_HELPTEXT ) >>= aData.sOriginalHelpText;
+ // and font
+ getUnderline( xPeer, aData );
+
+ m_aInvalidControls.insert( aData );
+
+ // update the border to the new invalidity
+ if ( m_bDynamicBorderColors && canColorBorder( xPeer ) )
+ updateBorderStyle( _rxControl, xPeer, aData );
+ else
+ {
+ // and also the new font
+ setUnderline( xPeer, UnderlineDescriptor( com::sun::star::awt::FontUnderline::WAVE, m_nInvalidColor ) );
+ }
+ }
+
+ // update the explanation for invalidity (this is always done, even if the validity did not change)
+ Reference< XValidator > xValidator = _rxValidatable->getValidator();
+ OSL_ENSURE( xValidator.is(), "ControlBorderManager::validityChanged: invalid, but no validator?" );
+ ::rtl::OUString sExplainInvalidity = xValidator.is() ? xValidator->explainInvalid( _rxValidatable->getCurrentValue() ) : ::rtl::OUString();
+ xPeer->setProperty( FM_PROP_HELPTEXT, makeAny( sExplainInvalidity ) );
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "ControlBorderManager::validityChanged: caught an exception!" );
+ }
+ }
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
diff --git a/svx/source/form/fmcontrollayout.cxx b/svx/source/form/fmcontrollayout.cxx
new file mode 100644
index 000000000000..39454c27324e
--- /dev/null
+++ b/svx/source/form/fmcontrollayout.cxx
@@ -0,0 +1,328 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "fmcontrollayout.hxx"
+#include "fmprop.hrc"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/form/FormComponentType.hpp>
+#include <com/sun/star/awt/VisualEffect.hpp>
+#include <com/sun/star/i18n/ScriptType.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XChild.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/processfactory.hxx>
+#include <i18npool/mslangid.hxx>
+#include <unotools/syslocale.hxx>
+
+#include <toolkit/helper/vclunohelper.hxx>
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include <vcl/outdev.hxx>
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ using namespace ::utl;
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::beans::XPropertySet;
+ using ::com::sun::star::beans::XPropertySetInfo;
+ using ::com::sun::star::lang::Locale;
+ using ::com::sun::star::awt::FontDescriptor;
+ using ::com::sun::star::style::XStyleFamiliesSupplier;
+ using ::com::sun::star::lang::XServiceInfo;
+ using ::com::sun::star::container::XNameAccess;
+ using ::com::sun::star::container::XChild;
+ /** === end UNO using === **/
+ namespace FormComponentType = ::com::sun::star::form::FormComponentType;
+ namespace VisualEffect = ::com::sun::star::awt::VisualEffect;
+ namespace ScriptType = ::com::sun::star::i18n::ScriptType;
+
+ //--------------------------------------------------------------------
+ namespace
+ {
+ //....................................................................
+ template< class INTERFACE_TYPE >
+ Reference< INTERFACE_TYPE > getTypedModelNode( const Reference< XInterface >& _rxModelNode )
+ {
+ Reference< INTERFACE_TYPE > xTypedNode( _rxModelNode, UNO_QUERY );
+ if ( xTypedNode.is() )
+ return xTypedNode;
+ else
+ {
+ Reference< XChild > xChild( _rxModelNode, UNO_QUERY );
+ if ( xChild.is() )
+ return getTypedModelNode< INTERFACE_TYPE >( xChild->getParent() );
+ else
+ return NULL;
+ }
+ }
+
+ //....................................................................
+ static bool lcl_getDocumentDefaultStyleAndFamily( const Reference< XInterface >& _rxDocument, ::rtl::OUString& _rFamilyName, ::rtl::OUString& _rStyleName ) SAL_THROW(( Exception ))
+ {
+ bool bSuccess = true;
+ Reference< XServiceInfo > xDocumentSI( _rxDocument, UNO_QUERY );
+ if ( xDocumentSI.is() )
+ {
+ if ( xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ) )
+ || xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.WebDocument" ) ) )
+ )
+ {
+ _rFamilyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParagraphStyles" ) );
+ _rStyleName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
+ }
+ else if ( xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.SpreadsheetDocument" ) ) ) )
+ {
+ _rFamilyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CellStyles" ) );
+ _rStyleName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Default" ) );
+ }
+ else if ( xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DrawingDocument" ) ) )
+ || xDocumentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) )
+ )
+ {
+ _rFamilyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "graphics" ) );
+ _rStyleName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "standard" ) );
+ }
+ else
+ bSuccess = false;
+ }
+ return bSuccess;
+ }
+
+ //....................................................................
+ static void lcl_initializeControlFont( const Reference< XPropertySet >& _rxModel )
+ {
+ try
+ {
+ Reference< XPropertySet > xStyle( ControlLayouter::getDefaultDocumentTextStyle( _rxModel ), UNO_SET_THROW );
+ Reference< XPropertySetInfo > xStylePSI( xStyle->getPropertySetInfo(), UNO_SET_THROW );
+
+ // determine the script type associated with the system locale
+ const LocaleDataWrapper& rSysLocaleData = SvtSysLocale().GetLocaleData();
+ const sal_Int16 eSysLocaleScriptType = MsLangId::getScriptType( MsLangId::convertLocaleToLanguage( rSysLocaleData.getLocale() ) );
+
+ // depending on this script type, use the right property from the document's style which controls the
+ // default locale for document content
+ const sal_Char* pCharLocalePropertyName = "CharLocale";
+ switch ( eSysLocaleScriptType )
+ {
+ case ScriptType::LATIN:
+ // already defaulted above
+ break;
+ case ScriptType::ASIAN:
+ pCharLocalePropertyName = "CharLocaleAsian";
+ break;
+ case ScriptType::COMPLEX:
+ pCharLocalePropertyName = "CharLocaleComplex";
+ break;
+ default:
+ OSL_ENSURE( false, "lcl_initializeControlFont: unexpected script type for system locale!" );
+ break;
+ }
+
+ ::rtl::OUString sCharLocalePropertyName = ::rtl::OUString::createFromAscii( pCharLocalePropertyName );
+ Locale aDocumentCharLocale;
+ if ( xStylePSI->hasPropertyByName( sCharLocalePropertyName ) )
+ {
+ OSL_VERIFY( xStyle->getPropertyValue( sCharLocalePropertyName ) >>= aDocumentCharLocale );
+ }
+ // fall back to CharLocale property at the style
+ if ( !aDocumentCharLocale.Language.getLength() )
+ {
+ sCharLocalePropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharLocale" ) );
+ if ( xStylePSI->hasPropertyByName( sCharLocalePropertyName ) )
+ {
+ OSL_VERIFY( xStyle->getPropertyValue( sCharLocalePropertyName ) >>= aDocumentCharLocale );
+ }
+ }
+ // fall back to the system locale
+ if ( !aDocumentCharLocale.Language.getLength() )
+ {
+ aDocumentCharLocale = rSysLocaleData.getLocale();
+ }
+
+ // retrieve a default font for this locale, and set it at the control
+ Font aFont = OutputDevice::GetDefaultFont( DEFAULTFONT_SANS, MsLangId::convertLocaleToLanguage( aDocumentCharLocale ), DEFAULTFONT_FLAGS_ONLYONE );
+ FontDescriptor aFontDesc = VCLUnoHelper::CreateFontDescriptor( aFont );
+ _rxModel->setPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontDescriptor" ) ),
+ makeAny( aFontDesc )
+ );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+
+ //====================================================================
+ //= ControlLayouter
+ //====================================================================
+ //--------------------------------------------------------------------
+ Reference< XPropertySet > ControlLayouter::getDefaultDocumentTextStyle( const Reference< XPropertySet >& _rxModel )
+ {
+ // the style family collection
+ Reference< XStyleFamiliesSupplier > xSuppStyleFamilies( getTypedModelNode< XStyleFamiliesSupplier >( _rxModel.get() ), UNO_SET_THROW );
+ Reference< XNameAccess > xStyleFamilies( xSuppStyleFamilies->getStyleFamilies(), UNO_SET_THROW );
+
+ // the names of the family, and the style - depends on the document type we live in
+ ::rtl::OUString sFamilyName, sStyleName;
+ if ( !lcl_getDocumentDefaultStyleAndFamily( xSuppStyleFamilies.get(), sFamilyName, sStyleName ) )
+ throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "unknown document type!" ) ), NULL );
+
+ // the concrete style
+ Reference< XNameAccess > xStyleFamily( xStyleFamilies->getByName( sFamilyName ), UNO_QUERY_THROW );
+ return Reference< XPropertySet >( xStyleFamily->getByName( sStyleName ), UNO_QUERY_THROW );
+ }
+
+ //--------------------------------------------------------------------
+ void ControlLayouter::initializeControlLayout( const Reference< XPropertySet >& _rxControlModel, DocumentType _eDocType )
+ {
+ DBG_ASSERT( _rxControlModel.is(), "ControlLayouter::initializeControlLayout: invalid model!" );
+ if ( !_rxControlModel.is() )
+ return;
+
+ try
+ {
+ Reference< XPropertySetInfo > xPSI( _rxControlModel->getPropertySetInfo(), UNO_SET_THROW );
+
+ // the control type
+ sal_Int16 nClassId = FormComponentType::CONTROL;
+ _rxControlModel->getPropertyValue( FM_PROP_CLASSID ) >>= nClassId;
+
+ // the document type
+ if ( _eDocType == eUnknownDocumentType )
+ _eDocType = DocumentClassification::classifyHostDocument( _rxControlModel.get() );
+
+ // let's see what the configuration says about the visual effect
+ OConfigurationNode aConfig = getLayoutSettings( _eDocType );
+ Any aVisualEffect = aConfig.getNodeValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VisualEffect" ) ) );
+ if ( aVisualEffect.hasValue() )
+ {
+ ::rtl::OUString sVisualEffect;
+ OSL_VERIFY( aVisualEffect >>= sVisualEffect );
+
+ sal_Int16 nVisualEffect = VisualEffect::NONE;
+ if ( sVisualEffect.equalsAscii( "flat" ) )
+ nVisualEffect = VisualEffect::FLAT;
+ else if ( sVisualEffect.equalsAscii( "3D" ) )
+ nVisualEffect = VisualEffect::LOOK3D;
+
+ if ( xPSI->hasPropertyByName( FM_PROP_BORDER ) )
+ {
+ if ( ( nClassId != FormComponentType::COMMANDBUTTON )
+ && ( nClassId != FormComponentType::RADIOBUTTON )
+ && ( nClassId != FormComponentType::CHECKBOX )
+ && ( nClassId != FormComponentType::GROUPBOX )
+ && ( nClassId != FormComponentType::FIXEDTEXT )
+ && ( nClassId != FormComponentType::SCROLLBAR )
+ && ( nClassId != FormComponentType::SPINBUTTON )
+ )
+ {
+ _rxControlModel->setPropertyValue( FM_PROP_BORDER, makeAny( nVisualEffect ) );
+ if ( ( nVisualEffect == VisualEffect::FLAT )
+ && ( xPSI->hasPropertyByName( FM_PROP_BORDERCOLOR ) )
+ )
+ // light gray flat border
+ _rxControlModel->setPropertyValue( FM_PROP_BORDERCOLOR, makeAny( (sal_Int32)0x00C0C0C0 ) );
+ }
+ }
+ if ( xPSI->hasPropertyByName( FM_PROP_VISUALEFFECT ) )
+ _rxControlModel->setPropertyValue( FM_PROP_VISUALEFFECT, makeAny( nVisualEffect ) );
+ }
+
+ // the font (only if we use the document's ref devices for rendering control text, otherwise, the
+ // default font of VCL controls is assumed to be fine)
+ if ( useDocumentReferenceDevice( _eDocType )
+ && xPSI->hasPropertyByName( FM_PROP_FONT )
+ )
+ lcl_initializeControlFont( _rxControlModel );
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "ControlLayouter::initializeControlLayout: caught an exception!" );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ ::utl::OConfigurationNode ControlLayouter::getLayoutSettings( DocumentType _eDocType )
+ {
+ ::rtl::OUString sConfigName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common/Forms/ControlLayout/" ) );
+ sConfigName += DocumentClassification::getModuleIdentifierForDocumentType( _eDocType );
+ return OConfigurationTreeRoot::createWithServiceFactory(
+ ::comphelper::getProcessServiceFactory(), // TODO
+ sConfigName );
+ }
+
+ //--------------------------------------------------------------------
+ bool ControlLayouter::useDynamicBorderColor( DocumentType _eDocType )
+ {
+ OConfigurationNode aConfig = getLayoutSettings( _eDocType );
+ Any aDynamicBorderColor = aConfig.getNodeValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DynamicBorderColors" ) ) );
+ bool bDynamicBorderColor = false;
+ OSL_VERIFY( aDynamicBorderColor >>= bDynamicBorderColor );
+ return bDynamicBorderColor;
+ }
+
+ //--------------------------------------------------------------------
+ bool ControlLayouter::useDocumentReferenceDevice( DocumentType _eDocType )
+ {
+ if ( _eDocType == eUnknownDocumentType )
+ return false;
+ OConfigurationNode aConfig = getLayoutSettings( _eDocType );
+ Any aUseRefDevice = aConfig.getNodeValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseDocumentTextMetrics" ) ) );
+ bool bUseRefDevice = false;
+ OSL_VERIFY( aUseRefDevice >>= bUseRefDevice );
+ return bUseRefDevice;
+ }
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
diff --git a/svx/source/form/fmdmod.cxx b/svx/source/form/fmdmod.cxx
new file mode 100644
index 000000000000..199cc03b59b4
--- /dev/null
+++ b/svx/source/form/fmdmod.cxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/fmdmod.hxx>
+#include "fmservs.hxx"
+#include <fmobj.hxx>
+#include <svx/unoshape.hxx>
+#include <comphelper/processfactory.hxx>
+#include <svx/fmglob.hxx>
+
+using namespace ::svxform;
+
+//-----------------------------------------------------------------------------
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvxFmMSFactory::createInstance(const ::rtl::OUString& ServiceSpecifier) throw( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xRet;
+ if ( ServiceSpecifier.indexOf( ::rtl::OUString::createFromAscii("com.sun.star.form.component.") ) == 0 )
+ {
+ xRet = ::comphelper::getProcessServiceFactory()->createInstance(ServiceSpecifier);
+ }
+ else if ( ServiceSpecifier == ::rtl::OUString( ::rtl::OUString::createFromAscii("com.sun.star.drawing.ControlShape") ) )
+ {
+ SdrObject* pObj = new FmFormObj(OBJ_FM_CONTROL);
+ xRet = *new SvxShapeControl(pObj);
+ }
+ if (!xRet.is())
+ xRet = SvxUnoDrawMSFactory::createInstance(ServiceSpecifier);
+ return xRet;
+}
+
+//-----------------------------------------------------------------------------
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvxFmMSFactory::createInstanceWithArguments(const ::rtl::OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments) throw( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException )
+{
+ return SvxUnoDrawMSFactory::createInstanceWithArguments(ServiceSpecifier, Arguments );
+}
+
+//-----------------------------------------------------------------------------
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL SvxFmMSFactory::getAvailableServiceNames(void) throw( ::com::sun::star::uno::RuntimeException )
+{
+ static const ::rtl::OUString aSvxComponentServiceNameList[] =
+ {
+ FM_SUN_COMPONENT_TEXTFIELD,
+ FM_SUN_COMPONENT_FORM,
+ FM_SUN_COMPONENT_LISTBOX,
+ FM_SUN_COMPONENT_COMBOBOX,
+ FM_SUN_COMPONENT_RADIOBUTTON,
+ FM_SUN_COMPONENT_GROUPBOX,
+ FM_SUN_COMPONENT_FIXEDTEXT,
+ FM_SUN_COMPONENT_COMMANDBUTTON,
+ FM_SUN_COMPONENT_CHECKBOX,
+ FM_SUN_COMPONENT_GRIDCONTROL,
+ FM_SUN_COMPONENT_IMAGEBUTTON,
+ FM_SUN_COMPONENT_FILECONTROL,
+ FM_SUN_COMPONENT_TIMEFIELD,
+ FM_SUN_COMPONENT_DATEFIELD,
+ FM_SUN_COMPONENT_NUMERICFIELD,
+ FM_SUN_COMPONENT_CURRENCYFIELD,
+ FM_SUN_COMPONENT_PATTERNFIELD,
+ FM_SUN_COMPONENT_HIDDENCONTROL,
+ FM_SUN_COMPONENT_IMAGECONTROL
+ };
+
+ static const sal_uInt16 nSvxComponentServiceNameListCount = sizeof(aSvxComponentServiceNameList) / sizeof ( aSvxComponentServiceNameList[0] );
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aSeq( nSvxComponentServiceNameListCount );
+ ::rtl::OUString* pStrings = aSeq.getArray();
+ for( sal_uInt16 nIdx = 0; nIdx < nSvxComponentServiceNameListCount; nIdx++ )
+ pStrings[nIdx] = aSvxComponentServiceNameList[nIdx];
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aParentSeq( SvxUnoDrawMSFactory::getAvailableServiceNames() );
+ return concatServiceNames( aParentSeq, aSeq );
+}
+
+/*
+// XServiceManager
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SvxFmDrawModel::createInstance(const ::rtl::OUString& ServiceName)
+ const throw( ::com::sun::star::lang::ServiceNotRegisteredException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xRet;
+ sal_uInt16 nTokenCount = ServiceName.getTokenCount('.');
+ if (nTokenCount == 5 &&
+ ServiceName.getToken( 0, '.' ) == ::rtl::OUString::createFromAscii("stardiv") &&
+ ServiceName.getToken( 1, '.' ) == ::rtl::OUString::createFromAscii("one") &&
+ ServiceName.getToken( 2, '.' ) == ::rtl::OUString::createFromAscii("form") &&
+ ServiceName.getToken( 3, '.' ) == ::rtl::OUString::createFromAscii("component"))
+ {
+ xRet = ::comphelper::getProcessServiceFactory()->createInstance(ServiceName);
+ }
+ else
+ if (nTokenCount == 4 &&
+ ServiceName.getToken( 0, '.' ) == ::rtl::OUString::createFromAscii("stardiv") &&
+ ServiceName.getToken( 1, '.' ) == ::rtl::OUString::createFromAscii("one") &&
+ ServiceName.getToken( 2, '.' ) == ::rtl::OUString::createFromAscii("drawing") &&
+ ServiceName.getToken( 3, '.' ) == ::rtl::OUString::createFromAscii("ControlShape"))
+ {
+ SdrObject* pObj = new FmFormObj();
+ xRet = *new SvxShapeControl(pObj);
+ }
+ if (!xRet.is())
+ xRet = SvxUnoDrawModel::createInstance(ServiceName);
+ return xRet;
+}
+*/
+
+
diff --git a/svx/source/form/fmdocumentclassification.cxx b/svx/source/form/fmdocumentclassification.cxx
new file mode 100644
index 000000000000..d1ffbc7c0dbe
--- /dev/null
+++ b/svx/source/form/fmdocumentclassification.cxx
@@ -0,0 +1,214 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#ifndef SVX_SOURCE_FORM_FMDOCUMENTCLASSIFICATION_HXX
+#include "fmdocumentclassification.hxx"
+#endif
+#include "svx/dbtoolsclient.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/xforms/XFormsSupplier.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/frame/XModule.hpp>
+/** === end UNO includes === **/
+
+#include <tools/diagnose_ex.h>
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ namespace
+ {
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::container::XChild;
+ using ::com::sun::star::frame::XModel;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::frame::XModule;
+
+ //....................................................................
+ template< class TYPE >
+ Reference< TYPE > getTypedModelNode( const Reference< XInterface >& _rxModelNode )
+ {
+ Reference< TYPE > xTypedNode( _rxModelNode, UNO_QUERY );
+ if ( xTypedNode.is() )
+ return xTypedNode;
+ else
+ {
+ Reference< XChild > xChild( _rxModelNode, UNO_QUERY );
+ if ( xChild.is() )
+ return getTypedModelNode< TYPE >( xChild->getParent() );
+ else
+ return Reference< TYPE >();
+ }
+ }
+
+ //....................................................................
+ Reference< XModel > getDocument( const Reference< XInterface >& _rxModelNode )
+ {
+ return getTypedModelNode< XModel >( _rxModelNode );
+ }
+ }
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::frame;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::xforms;
+ using namespace ::com::sun::star::container;
+ using namespace ::com::sun::star::sdbc;
+
+ //====================================================================
+ //====================================================================
+ namespace
+ {
+ //----------------------------------------------------------------
+ struct ModuleInfo
+ {
+ const sal_Char* pAsciiModuleOrServiceName;
+ DocumentType eType;
+ };
+
+ //----------------------------------------------------------------
+ const ModuleInfo* lcl_getModuleInfo()
+ {
+ static const ModuleInfo aModuleInfo[] =
+ {
+ { "com.sun.star.text.TextDocument", eTextDocument },
+ { "com.sun.star.text.WebDocument", eWebDocument },
+ { "com.sun.star.sheet.SpreadsheetDocument", eSpreadsheetDocument },
+ { "com.sun.star.drawing.DrawingDocument", eDrawingDocument },
+ { "com.sun.star.presentation.PresentationDocument", ePresentationDocument },
+ { "com.sun.star.xforms.XMLFormDocument", eEnhancedForm },
+ { "com.sun.star.sdb.FormDesign", eDatabaseForm },
+ { "com.sun.star.sdb.TextReportDesign", eDatabaseReport },
+ { "com.sun.star.text.GlobalDocument", eTextDocument },
+ { NULL, eUnknownDocumentType }
+ };
+ return aModuleInfo;
+ }
+ }
+
+ //====================================================================
+ //= DocumentClassification
+ //====================================================================
+ //--------------------------------------------------------------------
+ DocumentType DocumentClassification::classifyDocument( const Reference< XModel >& _rxDocumentModel ) SAL_THROW(())
+ {
+ DocumentType eType( eUnknownDocumentType );
+
+ OSL_ENSURE( _rxDocumentModel.is(), "DocumentClassification::classifyDocument: invalid document!" );
+ if ( !_rxDocumentModel.is() )
+ return eType;
+
+ try
+ {
+ // first, check whether the document has a ModuleIdentifier which we know
+ ::rtl::OUString sModuleIdentifier;
+ Reference< XModule > xModule( _rxDocumentModel, UNO_QUERY );
+ if ( xModule.is() )
+ eType = getDocumentTypeForModuleIdentifier( xModule->getIdentifier() );
+ if ( eType != eUnknownDocumentType )
+ return eType;
+
+ // second, check whether it supports one of the services we know
+ Reference< XServiceInfo > xSI( _rxDocumentModel, UNO_QUERY_THROW );
+ const ModuleInfo* pModuleInfo = lcl_getModuleInfo();
+ while ( pModuleInfo->pAsciiModuleOrServiceName )
+ {
+ if ( xSI->supportsService( ::rtl::OUString::createFromAscii( pModuleInfo->pAsciiModuleOrServiceName ) ) )
+ return pModuleInfo->eType;
+ ++pModuleInfo;
+ }
+
+ // last: uhm, there is no last resort
+ OSL_ENSURE( false, "DocumentClassification::classifyDocument: unknown document!" );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return eType;
+ }
+
+ //--------------------------------------------------------------------
+ DocumentType DocumentClassification::classifyHostDocument( const Reference< XInterface >& _rxFormComponent ) SAL_THROW(())
+ {
+ DocumentType eType( eUnknownDocumentType );
+
+ try
+ {
+ Reference< XModel > xDocument( getDocument( _rxFormComponent.get() ) );
+ if ( !xDocument.is() )
+ return eUnknownDocumentType;
+ eType = classifyDocument( xDocument );
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "DocumentClassification::classifyHostDocument: caught an exception!" );
+ }
+
+ return eType;
+ }
+
+ //--------------------------------------------------------------------
+ DocumentType DocumentClassification::getDocumentTypeForModuleIdentifier( const ::rtl::OUString& _rModuleIdentifier )
+ {
+ const ModuleInfo* pModuleInfo = lcl_getModuleInfo();
+ while ( pModuleInfo->pAsciiModuleOrServiceName )
+ {
+ if ( _rModuleIdentifier.equalsAscii( pModuleInfo->pAsciiModuleOrServiceName ) )
+ return pModuleInfo->eType;
+ ++pModuleInfo;
+ }
+ return eUnknownDocumentType;
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString DocumentClassification::getModuleIdentifierForDocumentType( DocumentType _eType )
+ {
+ const ModuleInfo* pModuleInfo = lcl_getModuleInfo();
+ while ( pModuleInfo->pAsciiModuleOrServiceName )
+ {
+ if ( pModuleInfo->eType == _eType )
+ return ::rtl::OUString::createFromAscii( pModuleInfo->pAsciiModuleOrServiceName );
+ ++pModuleInfo;
+ }
+ return ::rtl::OUString();
+ }
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
diff --git a/svx/source/form/fmdpage.cxx b/svx/source/form/fmdpage.cxx
new file mode 100644
index 000000000000..2705afba891e
--- /dev/null
+++ b/svx/source/form/fmdpage.cxx
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/fmpage.hxx>
+#include "fmobj.hxx"
+#include <svx/fmglob.hxx>
+#include <svx/fmdpage.hxx>
+#include <svx/unoshape.hxx>
+#include <cppuhelper/queryinterface.hxx>
+#include <cppuhelper/typeprovider.hxx>
+
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::form::XFormsSupplier2;
+
+DBG_NAME(SvxFmDrawPage)
+SvxFmDrawPage::SvxFmDrawPage( SdrPage* pInPage ) :
+ SvxDrawPage( pInPage )
+{
+ DBG_CTOR(SvxFmDrawPage,NULL);
+}
+
+SvxFmDrawPage::~SvxFmDrawPage() throw ()
+{
+ DBG_DTOR(SvxFmDrawPage,NULL);
+}
+
+::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL SvxFmDrawPage::getImplementationId() throw(::com::sun::star::uno::RuntimeException)
+{
+ static ::cppu::OImplementationId* pId = 0;
+ if (! pId)
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if (! pId)
+ {
+ static ::cppu::OImplementationId aId;
+ pId = &aId;
+ }
+ }
+ return pId->getImplementationId();
+}
+
+Any SAL_CALL SvxFmDrawPage::queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(RuntimeException)
+{
+ Any aRet = ::cppu::queryInterface ( _rType
+ , static_cast< XFormsSupplier2* >( this )
+ , static_cast< XFormsSupplier* >( this )
+ );
+ if ( !aRet.hasValue() )
+ aRet = SvxDrawPage::queryAggregation( _rType );
+
+ return aRet;
+}
+
+/***********************************************************************
+* *
+***********************************************************************/
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL SvxFmDrawPage::getTypes( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypes(SvxDrawPage::getTypes());
+ aTypes.realloc(aTypes.getLength() + 1);
+ ::com::sun::star::uno::Type* pTypes = aTypes.getArray();
+
+ pTypes[aTypes.getLength()-1] = ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormsSupplier>*)0);
+ return aTypes;
+}
+
+SdrObject *SvxFmDrawPage::_CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xDescr ) throw ()
+{
+ ::rtl::OUString aShapeType( xDescr->getShapeType() );
+
+ if ( aShapeType.equalsAscii( "com.sun.star.drawing.ShapeControl" ) // compatibility
+ || aShapeType.equalsAscii( "com.sun.star.drawing.ControlShape" )
+ )
+ return new FmFormObj( OBJ_FM_CONTROL );
+ else
+ return SvxDrawPage::_CreateSdrObject( xDescr );
+
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > SvxFmDrawPage::_CreateShape( SdrObject *pObj ) const throw ()
+{
+ if( FmFormInventor == pObj->GetObjInventor() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape = (SvxShape*)new SvxShapeControl( pObj );
+ return xShape;
+ }
+ else
+ return SvxDrawPage::_CreateShape( pObj );
+}
+
+// XFormsSupplier
+::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL SvxFmDrawPage::getForms(void) throw( ::com::sun::star::uno::RuntimeException )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > xForms;
+
+ FmFormPage *pFmPage = PTR_CAST( FmFormPage, GetSdrPage() );
+ if( pFmPage )
+ xForms = pFmPage->GetForms();
+
+ return xForms;
+}
+
+// XFormsSupplier2
+sal_Bool SAL_CALL SvxFmDrawPage::hasForms(void) throw( ::com::sun::star::uno::RuntimeException )
+{
+ sal_Bool bHas = sal_False;
+ FmFormPage* pFormPage = PTR_CAST( FmFormPage, GetSdrPage() );
+ if ( pFormPage )
+ bHas = pFormPage->GetForms( false ).is();
+ return bHas;
+}
+
+// ::com::sun::star::lang::XServiceInfo
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL SvxFmDrawPage::getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException )
+{
+ return SvxDrawPage::getSupportedServiceNames();
+}
+
+
diff --git a/svx/source/form/fmexch.cxx b/svx/source/form/fmexch.cxx
new file mode 100644
index 000000000000..1481a1846a36
--- /dev/null
+++ b/svx/source/form/fmexch.cxx
@@ -0,0 +1,443 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "fmexch.hxx"
+
+#include <sot/storage.hxx>
+#include <svl/itempool.hxx>
+
+#ifndef _SVX_DBEXCH_HRC
+#include <svx/dbexch.hrc>
+#endif
+#include <sot/formats.hxx>
+#include <svtools/svtreebx.hxx>
+#include <tools/diagnose_ex.h>
+
+#define _SVSTDARR_ULONGS
+#include <svl/svstdarr.hxx>
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::datatransfer;
+
+ //====================================================================
+ //= OLocalExchange
+ //====================================================================
+ //--------------------------------------------------------------------
+ OLocalExchange::OLocalExchange( )
+ :m_bDragging( sal_False )
+ ,m_bClipboardOwner( sal_False )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ void OLocalExchange::copyToClipboard( Window* _pWindow, const GrantAccess& )
+ {
+ if ( m_bClipboardOwner )
+ { // simulate a lostOwnership to notify parties interested in
+ if ( m_aClipboardListener.IsSet() )
+ m_aClipboardListener.Call( this );
+ }
+
+ m_bClipboardOwner = sal_True;
+ CopyToClipboard( _pWindow );
+ }
+
+ //--------------------------------------------------------------------
+ void OLocalExchange::clear()
+ {
+ if ( isClipboardOwner() )
+ {
+ try
+ {
+ Reference< clipboard::XClipboard > xClipBoard( getOwnClipboard() );
+ if ( xClipBoard.is() )
+ xClipBoard->setContents( NULL, NULL );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ m_bClipboardOwner = sal_False;
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL OLocalExchange::lostOwnership( const Reference< clipboard::XClipboard >& _rxClipboard, const Reference< XTransferable >& _rxTrans ) throw(RuntimeException)
+ {
+ TransferableHelper::implCallOwnLostOwnership( _rxClipboard, _rxTrans );
+ m_bClipboardOwner = sal_False;
+
+ if ( m_aClipboardListener.IsSet() )
+ m_aClipboardListener.Call( this );
+ }
+
+ //--------------------------------------------------------------------
+ void OLocalExchange::startDrag( Window* _pWindow, sal_Int8 _nDragSourceActions, const GrantAccess& )
+ {
+ m_bDragging = sal_True;
+ StartDrag( _pWindow, _nDragSourceActions );
+ }
+
+ //--------------------------------------------------------------------
+ void OLocalExchange::DragFinished( sal_Int8 nDropAction )
+ {
+ TransferableHelper::DragFinished( nDropAction );
+ m_bDragging = sal_False;
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool OLocalExchange::hasFormat( const DataFlavorExVector& _rFormats, sal_uInt32 _nFormatId )
+ {
+ DataFlavorExVector::const_iterator aSearch;
+
+ for ( aSearch = _rFormats.begin(); aSearch != _rFormats.end(); ++aSearch )
+ if ( aSearch->mnSotId == _nFormatId )
+ break;
+
+ return aSearch != _rFormats.end();
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool OLocalExchange::GetData( const ::com::sun::star::datatransfer::DataFlavor& /*_rFlavor*/ )
+ {
+ return sal_False; // do not have any formats by default
+ }
+
+ //====================================================================
+ //= OControlTransferData
+ //====================================================================
+ //--------------------------------------------------------------------
+ OControlTransferData::OControlTransferData( )
+ :m_pFocusEntry( NULL )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ OControlTransferData::OControlTransferData( const Reference< XTransferable >& _rxTransferable )
+ :m_pFocusEntry( NULL )
+ {
+ TransferableDataHelper aExchangedData( _rxTransferable );
+
+ // try the formats we know
+ if ( OControlExchange::hasControlPathFormat( aExchangedData.GetDataFlavorExVector() ) )
+ { // paths to the controls, relative to a root
+ Sequence< Any > aControlPathData;
+ if ( aExchangedData.GetAny( OControlExchange::getControlPathFormatId() ) >>= aControlPathData )
+ {
+ DBG_ASSERT( aControlPathData.getLength() >= 2, "OControlTransferData::OControlTransferData: invalid data for the control path format!" );
+ if ( aControlPathData.getLength() >= 2 )
+ {
+ aControlPathData[0] >>= m_xFormsRoot;
+ aControlPathData[1] >>= m_aControlPaths;
+ }
+ }
+ else
+ {
+ DBG_ERROR( "OControlTransferData::OControlTransferData: invalid data for the control path format (2)!" );
+ }
+ }
+ if ( OControlExchange::hasHiddenControlModelsFormat( aExchangedData.GetDataFlavorExVector() ) )
+ { // sequence of models of hidden controls
+ aExchangedData.GetAny( OControlExchange::getHiddenControlModelsFormatId() ) >>= m_aHiddenControlModels;
+ }
+
+ updateFormats( );
+ }
+
+ //--------------------------------------------------------------------
+ static sal_Bool lcl_fillDataFlavorEx( SotFormatStringId nId, DataFlavorEx& _rFlavor )
+ {
+ _rFlavor.mnSotId = nId;
+ return SotExchange::GetFormatDataFlavor( _rFlavor.mnSotId, _rFlavor );
+ }
+
+ //--------------------------------------------------------------------
+ void OControlTransferData::updateFormats( )
+ {
+ m_aCurrentFormats.clear();
+ m_aCurrentFormats.reserve( 3 );
+
+ DataFlavorEx aFlavor;
+
+ if ( m_aHiddenControlModels.getLength() )
+ {
+ if ( lcl_fillDataFlavorEx( OControlExchange::getHiddenControlModelsFormatId(), aFlavor ) )
+ m_aCurrentFormats.push_back( aFlavor );
+ }
+
+ if ( m_xFormsRoot.is() && m_aControlPaths.getLength() )
+ {
+ if ( lcl_fillDataFlavorEx( OControlExchange::getControlPathFormatId(), aFlavor ) )
+ m_aCurrentFormats.push_back( aFlavor );
+ }
+
+ if ( !m_aSelectedEntries.empty() )
+ {
+ if ( lcl_fillDataFlavorEx( OControlExchange::getFieldExchangeFormatId(), aFlavor ) )
+ m_aCurrentFormats.push_back( aFlavor );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ size_t OControlTransferData::onEntryRemoved( SvLBoxEntry* _pEntry )
+ {
+ m_aSelectedEntries.erase( _pEntry );
+ return m_aSelectedEntries.size();
+ }
+
+ //--------------------------------------------------------------------
+ void OControlTransferData::addSelectedEntry( SvLBoxEntry* _pEntry )
+ {
+ m_aSelectedEntries.insert( _pEntry );
+ }
+
+ //--------------------------------------------------------------------
+ void OControlTransferData::setFocusEntry( SvLBoxEntry* _pFocusEntry )
+ {
+ m_pFocusEntry = _pFocusEntry;
+ }
+
+ //------------------------------------------------------------------------
+ void OControlTransferData::addHiddenControlsFormat(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > seqInterfaces)
+ {
+ m_aHiddenControlModels = seqInterfaces;
+ }
+
+ //------------------------------------------------------------------------
+ void OControlTransferData::buildPathFormat(SvTreeListBox* pTreeBox, SvLBoxEntry* pRoot)
+ {
+ m_aControlPaths.realloc(0);
+
+ sal_Int32 nEntryCount = m_aSelectedEntries.size();
+ if (nEntryCount == 0)
+ return;
+
+ m_aControlPaths.realloc(nEntryCount);
+ ::com::sun::star::uno::Sequence<sal_uInt32>* pAllPaths = m_aControlPaths.getArray();
+ for ( ListBoxEntrySet::const_iterator loop = m_aSelectedEntries.begin();
+ loop != m_aSelectedEntries.end();
+ ++loop, ++pAllPaths
+ )
+ {
+ // erst mal sammeln wir den Pfad in einem Array ein
+ ::std::vector< sal_uInt32 > aCurrentPath;
+ SvLBoxEntry* pCurrentEntry = *loop;
+
+ SvLBoxEntry* pLoop = pCurrentEntry;
+ while (pLoop != pRoot)
+ {
+ aCurrentPath.push_back(pLoop->GetChildListPos());
+ pLoop = pTreeBox->GetParent(pLoop);
+ DBG_ASSERT((pLoop != NULL) || (pRoot == 0), "OControlTransferData::buildPathFormat: invalid root or entry !");
+ // pLoop == NULL heisst, dass ich am oberen Ende angelangt bin, dann sollte das Ganze abbrechen, was nur bei pRoot == NULL der Fall sein wird
+ }
+
+ // dann koennen wir ihn in die ::com::sun::star::uno::Sequence uebertragen
+ Sequence<sal_uInt32>& rCurrentPath = *pAllPaths;
+ sal_Int32 nDepth = aCurrentPath.size();
+
+ rCurrentPath.realloc(nDepth);
+ sal_uInt32* pSeq = rCurrentPath.getArray();
+ sal_Int32 j,k;
+ for (j = nDepth - 1, k = 0; k<nDepth; --j, ++k)
+ pSeq[j] = aCurrentPath[k];
+ }
+ }
+
+ //------------------------------------------------------------------------
+ void OControlTransferData::buildListFromPath(SvTreeListBox* pTreeBox, SvLBoxEntry* pRoot)
+ {
+ ListBoxEntrySet aEmpty;
+ m_aSelectedEntries.swap( aEmpty );
+
+ sal_Int32 nControls = m_aControlPaths.getLength();
+ const ::com::sun::star::uno::Sequence<sal_uInt32>* pPaths = m_aControlPaths.getConstArray();
+ for (sal_Int32 i=0; i<nControls; ++i)
+ {
+ sal_Int32 nThisPatLength = pPaths[i].getLength();
+ const sal_uInt32* pThisPath = pPaths[i].getConstArray();
+ SvLBoxEntry* pSearch = pRoot;
+ for (sal_Int32 j=0; j<nThisPatLength; ++j)
+ pSearch = pTreeBox->GetEntry(pSearch, pThisPath[j]);
+
+ m_aSelectedEntries.insert( pSearch );
+ }
+ }
+
+ //====================================================================
+ //= OControlExchange
+ //====================================================================
+ //--------------------------------------------------------------------
+ OControlExchange::OControlExchange( )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool OControlExchange::GetData( const DataFlavor& _rFlavor )
+ {
+ const sal_uInt32 nFormatId = SotExchange::GetFormat( _rFlavor );
+
+ if ( getControlPathFormatId( ) == nFormatId )
+ {
+ // ugly. We have to pack all the info into one object
+ Sequence< Any > aCompleteInfo( 2 );
+ OSL_ENSURE( m_xFormsRoot.is(), "OLocalExchange::GetData: invalid forms root for this format!" );
+ aCompleteInfo.getArray()[ 0 ] <<= m_xFormsRoot;
+ aCompleteInfo.getArray()[ 1 ] <<= m_aControlPaths;
+
+ SetAny( makeAny( aCompleteInfo ), _rFlavor );
+ }
+ else if ( getHiddenControlModelsFormatId() == nFormatId )
+ {
+ // just need to transfer the models
+ SetAny( makeAny( m_aHiddenControlModels ), _rFlavor );
+ }
+ else
+ return OLocalExchange::GetData( _rFlavor );
+
+ return sal_True;
+ }
+
+ //--------------------------------------------------------------------
+ void OControlExchange::AddSupportedFormats()
+ {
+ if (m_pFocusEntry && !m_aSelectedEntries.empty())
+ AddFormat(getFieldExchangeFormatId());
+
+ if (m_aControlPaths.getLength())
+ AddFormat(getControlPathFormatId());
+
+ if (m_aHiddenControlModels.getLength())
+ AddFormat(getHiddenControlModelsFormatId());
+ }
+
+ //--------------------------------------------------------------------
+ sal_uInt32 OControlExchange::getControlPathFormatId()
+ {
+ static sal_uInt32 s_nFormat = (sal_uInt32)-1;
+ if ((sal_uInt32)-1 == s_nFormat)
+ {
+ s_nFormat = SotExchange::RegisterFormatName(String::CreateFromAscii("application/x-openoffice;windows_formatname=\"svxform.ControlPathExchange\""));
+ DBG_ASSERT((sal_uInt32)-1 != s_nFormat, "OControlExchange::getControlPathFormatId: bad exchange id!");
+ }
+ return s_nFormat;
+ }
+
+ //--------------------------------------------------------------------
+ sal_uInt32 OControlExchange::getHiddenControlModelsFormatId()
+ {
+ static sal_uInt32 s_nFormat = (sal_uInt32)-1;
+ if ((sal_uInt32)-1 == s_nFormat)
+ {
+ s_nFormat = SotExchange::RegisterFormatName(String::CreateFromAscii("application/x-openoffice;windows_formatname=\"svxform.HiddenControlModelsExchange\""));
+ DBG_ASSERT((sal_uInt32)-1 != s_nFormat, "OControlExchange::getHiddenControlModelsFormatId: bad exchange id!");
+ }
+ return s_nFormat;
+ }
+
+ //--------------------------------------------------------------------
+ sal_uInt32 OControlExchange::getFieldExchangeFormatId()
+ {
+ static sal_uInt32 s_nFormat = (sal_uInt32)-1;
+ if ((sal_uInt32)-1 == s_nFormat)
+ {
+ s_nFormat = SotExchange::RegisterFormatName(String::CreateFromAscii("application/x-openoffice;windows_formatname=\"svxform.FieldNameExchange\""));
+ DBG_ASSERT((sal_uInt32)-1 != s_nFormat, "OControlExchange::getFieldExchangeFormatId: bad exchange id!");
+ }
+ return s_nFormat;
+ }
+
+ //====================================================================
+ //= OControlExchangeHelper
+ //====================================================================
+ OLocalExchange* OControlExchangeHelper::createExchange() const
+ {
+ return new OControlExchange;
+ }
+
+ //====================================================================
+ //= OLocalExchangeHelper
+ //====================================================================
+ //--------------------------------------------------------------------
+ OLocalExchangeHelper::OLocalExchangeHelper(Window* _pDragSource)
+ :m_pDragSource(_pDragSource)
+ ,m_pTransferable(NULL)
+ {
+ }
+
+ //--------------------------------------------------------------------
+ OLocalExchangeHelper::~OLocalExchangeHelper()
+ {
+ implReset();
+ }
+
+ //--------------------------------------------------------------------
+ void OLocalExchangeHelper::startDrag( sal_Int8 nDragSourceActions )
+ {
+ DBG_ASSERT(m_pTransferable, "OLocalExchangeHelper::startDrag: not prepared!");
+ m_pTransferable->startDrag( m_pDragSource, nDragSourceActions, OLocalExchange::GrantAccess() );
+ }
+
+ //--------------------------------------------------------------------
+ void OLocalExchangeHelper::copyToClipboard( ) const
+ {
+ DBG_ASSERT( m_pTransferable, "OLocalExchangeHelper::copyToClipboard: not prepared!" );
+ m_pTransferable->copyToClipboard( m_pDragSource, OLocalExchange::GrantAccess() );
+ }
+
+ //--------------------------------------------------------------------
+ void OLocalExchangeHelper::implReset()
+ {
+ if (m_pTransferable)
+ {
+ m_pTransferable->setClipboardListener( Link() );
+ m_pTransferable->release();
+ m_pTransferable = NULL;
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void OLocalExchangeHelper::prepareDrag( )
+ {
+ DBG_ASSERT(!m_pTransferable || !m_pTransferable->isDragging(), "OLocalExchangeHelper::prepareDrag: recursive DnD?");
+
+ implReset();
+ m_pTransferable = createExchange();
+ m_pTransferable->acquire();
+ }
+
+//........................................................................
+}
+//........................................................................
+
diff --git a/svx/source/form/fmexpl.cxx b/svx/source/form/fmexpl.cxx
new file mode 100644
index 000000000000..dc6a141e45e9
--- /dev/null
+++ b/svx/source/form/fmexpl.cxx
@@ -0,0 +1,707 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#ifndef _SVX_FMRESIDS_HRC
+#include "svx/fmresids.hrc"
+#endif
+#ifndef _SVX_FMEXPL_HRC
+#include "fmexpl.hrc"
+#endif
+#include "fmexpl.hxx"
+
+#ifndef _SVX_FMHELP_HRC
+#include "fmhelp.hrc"
+#endif
+#include <svx/fmglob.hxx>
+#include "fmservs.hxx"
+#include <svx/fmmodel.hxx>
+#include "fmexch.hxx"
+#include "fmundo.hxx"
+#include "fmpgeimp.hxx"
+
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+
+#ifndef _SVX_FMPROP_HRC
+#include "fmprop.hrc"
+#endif
+#include <svx/dialmgr.hxx>
+#include "svx/svditer.hxx"
+#include <svx/svdouno.hxx>
+#include <fmundo.hxx>
+#include <svx/svdobj.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/form/FormComponentType.hpp>
+#include <com/sun/star/awt/XTabControllerModel.hpp>
+#include <vcl/menu.hxx>
+#include <sfx2/objitem.hxx>
+#include <sfx2/request.hxx>
+#include <tools/shl.hxx>
+
+#ifndef _WRKWIN_HXX //autogen
+#include <vcl/wrkwin.hxx>
+#endif
+#include <vcl/sound.hxx>
+#include <svx/fmshell.hxx>
+#include "fmshimp.hxx"
+#include <svx/fmpage.hxx>
+#include <com/sun/star/io/XPersistObject.hpp>
+#include <com/sun/star/script/XEventAttacherManager.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <comphelper/property.hxx>
+#include <comphelper/processfactory.hxx>
+#include <osl/diagnose.h>
+#include <rtl/logfile.hxx>
+
+using namespace ::svxform;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::form;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+
+//========================================================================
+
+SV_IMPL_PTRARR_SORT( FmEntryDataArray, FmEntryDataPtr )
+SV_IMPL_PTRARR_SORT( SvLBoxEntrySortedArray, SvLBoxEntryPtr )
+
+//========================================================================
+// class FmNavInsertedHint
+//========================================================================
+TYPEINIT1( FmNavInsertedHint, SfxHint );
+DBG_NAME(FmNavInsertedHint);
+//------------------------------------------------------------------------
+FmNavInsertedHint::FmNavInsertedHint( FmEntryData* pInsertedEntryData, sal_uInt32 nRelPos )
+ :pEntryData( pInsertedEntryData )
+ ,nPos( nRelPos )
+
+{
+ DBG_CTOR(FmNavInsertedHint,NULL);
+}
+
+//------------------------------------------------------------------------
+FmNavInsertedHint::~FmNavInsertedHint()
+{
+ DBG_DTOR(FmNavInsertedHint,NULL);
+}
+
+
+//========================================================================
+// class FmNavInsertedHint
+//========================================================================
+TYPEINIT1( FmNavModelReplacedHint, SfxHint );
+DBG_NAME(FmNavModelReplacedHint);
+//------------------------------------------------------------------------
+FmNavModelReplacedHint::FmNavModelReplacedHint( FmEntryData* pAffectedEntryData )
+ :pEntryData( pAffectedEntryData )
+{
+ DBG_CTOR(FmNavModelReplacedHint,NULL);
+}
+
+//------------------------------------------------------------------------
+FmNavModelReplacedHint::~FmNavModelReplacedHint()
+{
+ DBG_DTOR(FmNavModelReplacedHint,NULL);
+}
+
+//========================================================================
+// class FmNavRemovedHint
+//========================================================================
+TYPEINIT1( FmNavRemovedHint, SfxHint );
+DBG_NAME(FmNavRemovedHint);
+//------------------------------------------------------------------------
+FmNavRemovedHint::FmNavRemovedHint( FmEntryData* pRemovedEntryData )
+ :pEntryData( pRemovedEntryData )
+{
+ DBG_CTOR(FmNavRemovedHint,NULL);
+}
+
+//------------------------------------------------------------------------
+FmNavRemovedHint::~FmNavRemovedHint()
+{
+ DBG_DTOR(FmNavRemovedHint,NULL);
+}
+
+
+//========================================================================
+// class FmNavNameChangedHint
+//========================================================================
+TYPEINIT1( FmNavNameChangedHint, SfxHint );
+DBG_NAME(FmNavNameChangedHint);
+//------------------------------------------------------------------------
+FmNavNameChangedHint::FmNavNameChangedHint( FmEntryData* pData, const ::rtl::OUString& rNewName )
+ :pEntryData( pData )
+ ,aNewName( rNewName )
+{
+ DBG_CTOR(FmNavNameChangedHint,NULL);
+}
+
+//------------------------------------------------------------------------
+FmNavNameChangedHint::~FmNavNameChangedHint()
+{
+ DBG_DTOR(FmNavNameChangedHint,NULL);
+}
+
+//========================================================================
+// class FmNavClearedHint
+//========================================================================
+TYPEINIT1( FmNavClearedHint, SfxHint );
+DBG_NAME(FmNavClearedHint);
+//------------------------------------------------------------------------
+FmNavClearedHint::FmNavClearedHint()
+{
+ DBG_CTOR(FmNavClearedHint,NULL);
+}
+
+//------------------------------------------------------------------------
+FmNavClearedHint::~FmNavClearedHint()
+{
+ DBG_DTOR(FmNavClearedHint,NULL);
+}
+
+//========================================================================
+// class FmNavRequestSelectHint
+//========================================================================
+TYPEINIT1(FmNavRequestSelectHint, SfxHint);
+
+//========================================================================
+// class FmNavViewMarksChanged
+//========================================================================
+TYPEINIT1(FmNavViewMarksChanged, SfxHint);
+
+//========================================================================
+// class FmEntryDataList
+//========================================================================
+DBG_NAME(FmEntryDataList);
+//------------------------------------------------------------------------
+FmEntryDataList::FmEntryDataList()
+{
+ DBG_CTOR(FmEntryDataList,NULL);
+}
+
+//------------------------------------------------------------------------
+FmEntryDataList::~FmEntryDataList()
+{
+ DBG_DTOR(FmEntryDataList,NULL);
+}
+
+
+//========================================================================
+// class FmEntryData
+//========================================================================
+TYPEINIT0( FmEntryData );
+DBG_NAME(FmEntryData);
+//------------------------------------------------------------------------
+FmEntryData::FmEntryData( FmEntryData* pParentData, const Reference< XInterface >& _rxIFace )
+ :pParent( pParentData )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmEntryData::FmEntryData" );
+ DBG_CTOR(FmEntryData,NULL);
+ pChildList = new FmEntryDataList();
+
+ newObject( _rxIFace );
+}
+
+//------------------------------------------------------------------------
+FmEntryData::~FmEntryData()
+{
+ Clear();
+ delete pChildList;
+ DBG_DTOR(FmEntryData,NULL);
+}
+
+//------------------------------------------------------------------------
+void FmEntryData::newObject( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxIFace )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmEntryData::newObject" );
+ // do not just copy, normalize it
+ m_xNormalizedIFace = Reference< XInterface >( _rxIFace, UNO_QUERY );
+ m_xProperties = m_xProperties.query( m_xNormalizedIFace );
+ m_xChild = m_xChild.query( m_xNormalizedIFace );
+}
+
+//------------------------------------------------------------------------
+FmEntryData::FmEntryData( const FmEntryData& rEntryData )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmEntryData::FmEntryData" );
+ pChildList = new FmEntryDataList();
+ aText = rEntryData.GetText();
+ m_aNormalImage = rEntryData.GetNormalImage();
+ m_aHCImage = rEntryData.GetHCImage();
+ pParent = rEntryData.GetParent();
+
+ FmEntryData* pChildData;
+ sal_uInt32 nEntryCount = rEntryData.GetChildList()->Count();
+ for( sal_uInt32 i=0; i<nEntryCount; i++ )
+ {
+ pChildData = rEntryData.GetChildList()->GetObject(i);
+ FmEntryData* pNewChildData = pChildData->Clone();
+ pChildList->Insert( pNewChildData, LIST_APPEND );
+ }
+
+ m_xNormalizedIFace = rEntryData.m_xNormalizedIFace;
+ m_xProperties = rEntryData.m_xProperties;
+ m_xChild = rEntryData.m_xChild;
+}
+
+//------------------------------------------------------------------------
+void FmEntryData::Clear()
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmEntryData::Clear" );
+ for (;;)
+ {
+ FmEntryData* pEntryData = GetChildList()->Remove(sal_uLong(0));
+ if (pEntryData == NULL)
+ break;
+ delete pEntryData;
+ }
+}
+
+//------------------------------------------------------------------------
+sal_Bool FmEntryData::IsEqualWithoutChilds( FmEntryData* pEntryData )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmEntryData::IsEqualWithoutChilds" );
+ if(this == pEntryData)
+ return sal_True;
+
+ if( !pEntryData )
+ return sal_False;
+
+ if( !aText.equals(pEntryData->GetText()))
+ return sal_False;
+
+ if( !pEntryData->GetParent() && pParent )
+ return sal_False;
+
+ if( pEntryData->GetParent() && !pParent )
+ return sal_False;
+
+ if( !pEntryData->GetParent() && !pParent )
+ return sal_True;
+
+ if( !pParent->IsEqualWithoutChilds(pEntryData->GetParent()) )
+ return sal_False;
+
+ return sal_True;
+}
+
+
+//========================================================================
+// class FmFormData
+//========================================================================
+TYPEINIT1( FmFormData, FmEntryData );
+DBG_NAME(FmFormData);
+//------------------------------------------------------------------------
+FmFormData::FmFormData( const Reference< XForm >& _rxForm, const ImageList& _rNormalImages, const ImageList& _rHCImages, FmFormData* _pParent )
+ :FmEntryData( _pParent, _rxForm )
+ ,m_xForm( _rxForm )
+{
+ DBG_CTOR(FmEntryData,NULL);
+ //////////////////////////////////////////////////////////////////////
+ // Images setzen
+
+ m_aNormalImage = _rNormalImages.GetImage( RID_SVXIMG_FORM );
+ m_aHCImage = _rHCImages.GetImage( RID_SVXIMG_FORM );
+
+ //////////////////////////////////////////////////////////////////////
+ // Titel setzen
+ if (m_xForm.is())
+ {
+ Reference< XPropertySet > xSet(m_xForm, UNO_QUERY);
+ if (xSet.is())
+ {
+ ::rtl::OUString aEntryName(::comphelper::getString(xSet->getPropertyValue( FM_PROP_NAME )));
+ SetText(aEntryName);
+ }
+ }
+ else
+ SetText( ::rtl::OUString() );
+}
+
+//------------------------------------------------------------------------
+FmFormData::~FmFormData()
+{
+ DBG_DTOR(FmEntryData,NULL);
+}
+
+//------------------------------------------------------------------------
+FmFormData::FmFormData( const FmFormData& rFormData )
+ :FmEntryData( rFormData )
+{
+ DBG_CTOR(FmEntryData,NULL);
+ m_xForm = rFormData.GetFormIface();
+}
+
+//------------------------------------------------------------------------
+FmEntryData* FmFormData::Clone()
+{
+ return new FmFormData( *this );
+}
+
+//------------------------------------------------------------------------
+sal_Bool FmFormData::IsEqualWithoutChilds( FmEntryData* pEntryData )
+{
+ if(this == pEntryData)
+ return sal_True;
+ if( !pEntryData->ISA(FmFormData) )
+ return sal_False;
+ FmFormData* pFormData = (FmFormData*)pEntryData;
+ if( (XForm*)m_xForm.get() != (XForm*)pFormData->GetFormIface().get() )
+ return sal_False;
+
+ return FmEntryData::IsEqualWithoutChilds( pFormData );
+}
+
+
+//========================================================================
+// class FmControlData
+//========================================================================
+TYPEINIT1( FmControlData, FmEntryData );
+DBG_NAME(FmControlData);
+//------------------------------------------------------------------------
+FmControlData::FmControlData( const Reference< XFormComponent >& _rxComponent, const ImageList& _rNormalImages, const ImageList& _rHCImages, FmFormData* _pParent )
+ :FmEntryData( _pParent, _rxComponent )
+ ,m_xFormComponent( _rxComponent )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmControlData::FmControlData" );
+ DBG_CTOR(FmControlData,NULL);
+ //////////////////////////////////////////////////////////////////////
+ // Images setzen
+ m_aNormalImage = GetImage( _rNormalImages );
+ m_aHCImage = GetImage( _rHCImages );
+
+ //////////////////////////////////////////////////////////////////////
+ // Titel setzen
+ Reference< XPropertySet > xSet(m_xFormComponent, UNO_QUERY);
+ if( xSet.is() )
+ {
+#ifdef DBG_UTIL
+ ::rtl::OUString aEntryName = ::comphelper::getString(xSet->getPropertyValue( FM_PROP_NAME ));
+#endif
+ SetText( ::comphelper::getString(xSet->getPropertyValue( FM_PROP_NAME )));
+ }
+}
+
+//------------------------------------------------------------------------
+FmControlData::~FmControlData()
+{
+ DBG_DTOR(FmControlData,NULL);
+}
+
+//------------------------------------------------------------------------
+FmControlData::FmControlData( const FmControlData& rControlData )
+ :FmEntryData( rControlData )
+{
+ DBG_CTOR(FmControlData,NULL);
+ m_xFormComponent = rControlData.GetFormComponent();
+}
+
+//------------------------------------------------------------------------
+FmEntryData* FmControlData::Clone()
+{
+ return new FmControlData( *this );
+}
+
+//------------------------------------------------------------------------
+Image FmControlData::GetImage(const ImageList& ilNavigatorImages) const
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmControlData::FmControlData" );
+ //////////////////////////////////////////////////////////////////////
+ // Default-Image
+ Image aImage = ilNavigatorImages.GetImage( RID_SVXIMG_CONTROL );
+
+ Reference< XServiceInfo > xInfo( m_xFormComponent, UNO_QUERY );
+ if (!m_xFormComponent.is())
+ return aImage;
+
+ //////////////////////////////////////////////////////////////////////
+ // Spezielle Control-Images
+ sal_Int16 nObjectType = getControlTypeByObject(xInfo);
+ switch (nObjectType)
+ {
+ case OBJ_FM_BUTTON:
+ aImage = ilNavigatorImages.GetImage( RID_SVXIMG_BUTTON );
+ break;
+
+ case OBJ_FM_FIXEDTEXT:
+ aImage = ilNavigatorImages.GetImage( RID_SVXIMG_FIXEDTEXT );
+ break;
+
+ case OBJ_FM_EDIT:
+ aImage = ilNavigatorImages.GetImage( RID_SVXIMG_EDIT );
+ break;
+
+ case OBJ_FM_RADIOBUTTON:
+ aImage = ilNavigatorImages.GetImage( RID_SVXIMG_RADIOBUTTON );
+ break;
+
+ case OBJ_FM_CHECKBOX:
+ aImage = ilNavigatorImages.GetImage( RID_SVXIMG_CHECKBOX );
+ break;
+
+ case OBJ_FM_LISTBOX:
+ aImage = ilNavigatorImages.GetImage( RID_SVXIMG_LISTBOX );
+ break;
+
+ case OBJ_FM_COMBOBOX:
+ aImage = ilNavigatorImages.GetImage( RID_SVXIMG_COMBOBOX );
+ break;
+
+ case OBJ_FM_NAVIGATIONBAR:
+ aImage = ilNavigatorImages.GetImage( RID_SVXIMG_NAVIGATIONBAR );
+ break;
+
+ case OBJ_FM_GROUPBOX:
+ aImage = ilNavigatorImages.GetImage( RID_SVXIMG_GROUPBOX );
+ break;
+
+ case OBJ_FM_IMAGEBUTTON:
+ aImage = ilNavigatorImages.GetImage( RID_SVXIMG_IMAGEBUTTON );
+ break;
+
+ case OBJ_FM_FILECONTROL:
+ aImage = ilNavigatorImages.GetImage( RID_SVXIMG_FILECONTROL );
+ break;
+
+ case OBJ_FM_HIDDEN:
+ aImage = ilNavigatorImages.GetImage( RID_SVXIMG_HIDDEN );
+ break;
+
+ case OBJ_FM_DATEFIELD:
+ aImage = ilNavigatorImages.GetImage( RID_SVXIMG_DATEFIELD );
+ break;
+
+ case OBJ_FM_TIMEFIELD:
+ aImage = ilNavigatorImages.GetImage( RID_SVXIMG_TIMEFIELD );
+ break;
+
+ case OBJ_FM_NUMERICFIELD:
+ aImage = ilNavigatorImages.GetImage( RID_SVXIMG_NUMERICFIELD );
+ break;
+
+ case OBJ_FM_CURRENCYFIELD:
+ aImage = ilNavigatorImages.GetImage( RID_SVXIMG_CURRENCYFIELD );
+ break;
+
+ case OBJ_FM_PATTERNFIELD:
+ aImage = ilNavigatorImages.GetImage( RID_SVXIMG_PATTERNFIELD );
+ break;
+
+ case OBJ_FM_IMAGECONTROL:
+ aImage = ilNavigatorImages.GetImage( RID_SVXIMG_IMAGECONTROL );
+ break;
+
+ case OBJ_FM_FORMATTEDFIELD:
+ aImage = ilNavigatorImages.GetImage( RID_SVXIMG_FORMATTEDFIELD );
+ break;
+
+ case OBJ_FM_GRID:
+ aImage = ilNavigatorImages.GetImage( RID_SVXIMG_GRID );
+ break;
+
+ case OBJ_FM_SCROLLBAR:
+ aImage = ilNavigatorImages.GetImage( RID_SVXIMG_SCROLLBAR );
+ break;
+
+ case OBJ_FM_SPINBUTTON:
+ aImage = ilNavigatorImages.GetImage( RID_SVXIMG_SPINBUTTON);
+ break;
+ }
+
+ return aImage;
+}
+
+//------------------------------------------------------------------------
+sal_Bool FmControlData::IsEqualWithoutChilds( FmEntryData* pEntryData )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmControlData::IsEqualWithoutChilds" );
+ if(this == pEntryData)
+ return sal_True;
+
+ if( !pEntryData->ISA(FmControlData) )
+ return sal_False;
+ FmControlData* pControlData = (FmControlData*)pEntryData;
+
+ if( (XFormComponent*)m_xFormComponent.get() != (XFormComponent*)pControlData->GetFormComponent().get() )
+ return sal_False;
+
+ return FmEntryData::IsEqualWithoutChilds( pControlData );
+}
+
+//------------------------------------------------------------------------
+void FmControlData::ModelReplaced( const Reference< XFormComponent >& _rxNew, const ImageList& _rNormalImages, const ImageList& _rHCImages )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmControlData::ModelReplaced" );
+ m_xFormComponent = _rxNew;
+ newObject( m_xFormComponent );
+
+ // Images neu setzen
+ m_aNormalImage = GetImage( _rNormalImages );
+ m_aHCImage = GetImage( _rHCImages );
+}
+
+//............................................................................
+namespace svxform
+{
+//............................................................................
+
+ //========================================================================
+ // class NavigatorFrame
+ //========================================================================
+ DBG_NAME(NavigatorFrame)
+ //------------------------------------------------------------------------
+ NavigatorFrame::NavigatorFrame( SfxBindings* _pBindings, SfxChildWindow* _pMgr,
+ Window* _pParent )
+ :SfxDockingWindow( _pBindings, _pMgr, _pParent, WinBits(WB_STDMODELESS|WB_SIZEABLE|WB_ROLLABLE|WB_3DLOOK|WB_DOCKABLE) )
+ ,SfxControllerItem( SID_FM_FMEXPLORER_CONTROL, *_pBindings )
+ {
+ DBG_CTOR(NavigatorFrame,NULL);
+ SetHelpId( HID_FORM_NAVIGATOR_WIN );
+
+ m_pNavigatorTree = new NavigatorTree(comphelper::getProcessServiceFactory(), this );
+ m_pNavigatorTree->Show();
+ SetText( SVX_RES(RID_STR_FMEXPLORER) );
+ SfxDockingWindow::SetFloatingSize( Size(200,200) );
+ }
+
+ //------------------------------------------------------------------------
+ NavigatorFrame::~NavigatorFrame()
+ {
+ delete m_pNavigatorTree;
+ DBG_DTOR(NavigatorFrame,NULL);
+ }
+
+ //-----------------------------------------------------------------------
+ void NavigatorFrame::UpdateContent( FmFormShell* pFormShell )
+ {
+ m_pNavigatorTree->UpdateContent( pFormShell );
+ }
+
+ //-----------------------------------------------------------------------
+ void NavigatorFrame::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+ {
+ if( !pState || SID_FM_FMEXPLORER_CONTROL != nSID )
+ return;
+
+ if( eState >= SFX_ITEM_AVAILABLE )
+ {
+ FmFormShell* pShell = PTR_CAST( FmFormShell,((SfxObjectItem*)pState)->GetShell() );
+ UpdateContent( pShell );
+ }
+ else
+ UpdateContent( NULL );
+ }
+
+ //-----------------------------------------------------------------------
+ void NavigatorFrame::GetFocus()
+ {
+ if ( m_pNavigatorTree )
+ m_pNavigatorTree->GrabFocus();
+ else
+ SfxDockingWindow::GetFocus();
+ }
+
+ //-----------------------------------------------------------------------
+ sal_Bool NavigatorFrame::Close()
+ {
+ UpdateContent( NULL );
+ return SfxDockingWindow::Close();
+ }
+
+ //-----------------------------------------------------------------------
+ void NavigatorFrame::FillInfo( SfxChildWinInfo& rInfo ) const
+ {
+ SfxDockingWindow::FillInfo( rInfo );
+ rInfo.bVisible = sal_False;
+ }
+
+ //-----------------------------------------------------------------------
+ Size NavigatorFrame::CalcDockingSize( SfxChildAlignment eAlign )
+ {
+ if ( ( eAlign == SFX_ALIGN_TOP ) || ( eAlign == SFX_ALIGN_BOTTOM ) )
+ return Size();
+
+ return SfxDockingWindow::CalcDockingSize( eAlign );
+ }
+
+ //-----------------------------------------------------------------------
+ SfxChildAlignment NavigatorFrame::CheckAlignment( SfxChildAlignment _eActAlign, SfxChildAlignment _eAlign )
+ {
+ if ( ( _eAlign == SFX_ALIGN_LEFT ) || ( _eAlign == SFX_ALIGN_RIGHT ) || ( _eAlign == SFX_ALIGN_NOALIGNMENT ) )
+ return _eAlign;
+ return _eActAlign;
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorFrame::Resize()
+ {
+ SfxDockingWindow::Resize();
+
+ Size aLogOutputSize = PixelToLogic( GetOutputSizePixel(), MAP_APPFONT );
+ Size aLogExplSize = aLogOutputSize;
+ aLogExplSize.Width() -= 6;
+ aLogExplSize.Height() -= 6;
+
+ Point aExplPos = LogicToPixel( Point(3,3), MAP_APPFONT );
+ Size aExplSize = LogicToPixel( aLogExplSize, MAP_APPFONT );
+
+ m_pNavigatorTree->SetPosSizePixel( aExplPos, aExplSize );
+ }
+
+
+ //========================================================================
+ // class NavigatorFrameManager
+ //========================================================================
+
+ //-----------------------------------------------------------------------
+ SFX_IMPL_DOCKINGWINDOW( NavigatorFrameManager, SID_FM_SHOW_FMEXPLORER )
+
+ //-----------------------------------------------------------------------
+ NavigatorFrameManager::NavigatorFrameManager( Window* _pParent, sal_uInt16 _nId,
+ SfxBindings* _pBindings, SfxChildWinInfo* _pInfo )
+ :SfxChildWindow( _pParent, _nId )
+ {
+ pWindow = new NavigatorFrame( _pBindings, this, _pParent );
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+ ((SfxDockingWindow*)pWindow)->Initialize( _pInfo );
+ }
+
+//............................................................................
+} // namespace svxform
+//............................................................................
diff --git a/svx/source/form/fmexpl.src b/svx/source/form/fmexpl.src
new file mode 100644
index 000000000000..8d6866f0ecdb
--- /dev/null
+++ b/svx/source/form/fmexpl.src
@@ -0,0 +1,383 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svx/svxids.hrc>
+#include "svx/fmresids.hrc"
+#include "fmexpl.hrc"
+#include "globlmn.hrc"
+#include <svx/svxcommands.h>
+#include "fmhelp.hrc"
+
+Menu RID_FMEXPLORER_POPUPMENU
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = SID_FM_NEW ;
+ HelpId = HID_FM_NEW ;
+ Text [ en-US ] = "~New" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = SID_FM_NEW_FORM ;
+ HelpId = HID_FM_NEW_FORM ;
+ Text [ en-US ] = "Form" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_NEW_HIDDEN ;
+ HelpId = HID_FM_NEW_HIDDEN ;
+ Text [ en-US ] = "Hidden Control" ;
+ };
+ };
+ };
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_CHANGECONTROLTYPE ;
+ HelpId = CMD_SID_FM_CHANGECONTROLTYPE ;
+ Text [ en-US ] = "Replace with";
+ };
+ MenuItem { ITEM_EDIT_CUT };
+ MenuItem { ITEM_EDIT_COPY };
+ MenuItem { ITEM_EDIT_PASTE };
+ MenuItem
+ {
+ Identifier = SID_FM_DELETE ;
+ HelpId = HID_FM_DELETE ;
+ Text [ en-US ] = "~Delete" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_TAB_DIALOG ;
+ HelpId = CMD_SID_FM_TAB_DIALOG ;
+ Text [ en-US ] = "Tab Order..." ;
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_RENAME_OBJECT ;
+ HelpId = HID_FM_RENAME_OBJECT ;
+ Text [ en-US ] = "~Rename" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_SHOW_PROPERTY_BROWSER ;
+ HelpId = CMD_SID_FM_SHOW_PROPERTY_BROWSER ;
+ Text [ en-US ] = "Propert~ies" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_OPEN_READONLY ;
+ HelpId = CMD_SID_FM_OPEN_READONLY ;
+ Text [ en-US ] = "Open in Design Mode" ;
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_AUTOCONTROLFOCUS ;
+ HelpId = CMD_SID_FM_AUTOCONTROLFOCUS ;
+ Text [ en-US ] = "Automatic Control Focus";
+ };
+ };
+};
+
+Menu RID_FMSHELL_CONVERSIONMENU
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = SID_FM_CONVERTTO_EDIT ;
+ HelpId = CMD_SID_FM_CONVERTTO_EDIT ;
+ Command = ".uno:ConvertToEdit" ;
+ Text [ en-US ] = "~Text Box";
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_CONVERTTO_BUTTON ;
+ HelpId = CMD_SID_FM_CONVERTTO_BUTTON ;
+ Command = ".uno:ConvertToButton" ;
+ Text [ en-US ] = "~Button";
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_CONVERTTO_FIXEDTEXT ;
+ HelpId = CMD_SID_FM_CONVERTTO_FIXEDTEXT ;
+ Command = ".uno:ConvertToFixed" ;
+ Text [ en-US ] = "La~bel field";
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_CONVERTTO_GROUPBOX ;
+ HelpId = CMD_SID_FM_CONVERTTO_GROUPBOX ;
+ Command = ".uno:ConvertToGroup" ;
+ Text [ en-US ] = "G~roup Box";
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_CONVERTTO_LISTBOX ;
+ HelpId = CMD_SID_FM_CONVERTTO_LISTBOX ;
+ Command = ".uno:ConvertToList" ;
+ Text [ en-US ] = "L~ist Box";
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_CONVERTTO_CHECKBOX ;
+ HelpId = CMD_SID_FM_CONVERTTO_CHECKBOX ;
+ Command = ".uno:ConvertToCheckBox" ;
+ Text [ en-US ] = "~Check Box";
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_CONVERTTO_RADIOBUTTON ;
+ HelpId = CMD_SID_FM_CONVERTTO_RADIOBUTTON ;
+ Command = ".uno:ConvertToRadio" ;
+ Text [ en-US ] = "~Radio Button";
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_CONVERTTO_COMBOBOX ;
+ HelpId = CMD_SID_FM_CONVERTTO_COMBOBOX ;
+ Command = ".uno:ConvertToCombo" ;
+ Text [ en-US ] = "Combo Bo~x";
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_CONVERTTO_IMAGEBUTTON ;
+ HelpId = CMD_SID_FM_CONVERTTO_IMAGEBUTTON ;
+ Command = ".uno:ConvertToImageBtn" ;
+ Text [ en-US ] = "I~mage Button";
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_CONVERTTO_FILECONTROL ;
+ HelpId = CMD_SID_FM_CONVERTTO_FILECONTROL ;
+ Command = ".uno:ConvertToFileControl" ;
+ Text [ en-US ] = "~File Selection";
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_CONVERTTO_DATE ;
+ HelpId = CMD_SID_FM_CONVERTTO_DATE ;
+ Command = ".uno:ConvertToDate" ;
+ Text [ en-US ] = "~Date Field";
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_CONVERTTO_TIME ;
+ HelpId = CMD_SID_FM_CONVERTTO_TIME ;
+ Command = ".uno:ConvertToTime" ;
+ Text [ en-US ] = "Tim~e Field";
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_CONVERTTO_NUMERIC ;
+ HelpId = CMD_SID_FM_CONVERTTO_NUMERIC ;
+ Command = ".uno:ConvertToNumeric" ;
+ Text [ en-US ] = "~Numerical Field";
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_CONVERTTO_CURRENCY ;
+ HelpId = CMD_SID_FM_CONVERTTO_CURRENCY ;
+ Command = ".uno:ConvertToCurrency" ;
+ Text [ en-US ] = "C~urrency Field";
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_CONVERTTO_PATTERN ;
+ HelpId = CMD_SID_FM_CONVERTTO_PATTERN ;
+ Command = ".uno:ConvertToPattern" ;
+ Text [ en-US ] = "~Pattern Field";
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_CONVERTTO_IMAGECONTROL ;
+ HelpId = CMD_SID_FM_CONVERTTO_IMAGECONTROL ;
+ Command = ".uno:ConvertToImageControl" ;
+ Text [ en-US ] = "Ima~ge Control";
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_CONVERTTO_FORMATTED ;
+ HelpId = CMD_SID_FM_CONVERTTO_FORMATTED ;
+ Command = ".uno:ConvertToFormatted" ;
+ Text [ en-US ] = "Fo~rmatted Field";
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_CONVERTTO_SCROLLBAR ;
+ HelpId = CMD_SID_FM_CONVERTTO_SCROLLBAR ;
+ Command = ".uno:ConvertToScrollBar" ;
+ Text [ en-US ] = "Scroll bar";
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_CONVERTTO_SPINBUTTON;
+ HelpId = CMD_SID_FM_CONVERTTO_SPINBUTTON;
+ Command = ".uno:ConvertToSpinButton" ;
+ Text [ en-US ] = "Spin Button";
+ };
+ MenuItem
+ {
+ Identifier = SID_FM_CONVERTTO_NAVIGATIONBAR;
+ HelpId = CMD_SID_FM_CONVERTTO_NAVIGATIONBAR;
+ Command = ".uno:ConvertToNavigationBar" ;
+ Text [ en-US ] = "Navigation Bar" ;
+ };
+ };
+};
+
+#define NAVIGATOR_IMAGEIDS \
+ IdList = \
+ { \
+ RID_SVXIMG_BUTTON ; \
+ RID_SVXIMG_RADIOBUTTON ; \
+ RID_SVXIMG_CHECKBOX ; \
+ RID_SVXIMG_FIXEDTEXT ; \
+ RID_SVXIMG_GROUPBOX ; \
+ RID_SVXIMG_EDIT ; \
+ RID_SVXIMG_LISTBOX ; \
+ RID_SVXIMG_COMBOBOX ; \
+ RID_SVXIMG_NAVIGATIONBAR ; \
+ RID_SVXIMG_CONTROL ; \
+ RID_SVXIMG_FORM ; \
+ RID_SVXIMG_FORMS ; \
+ RID_SVXIMG_COLLAPSEDNODE ; \
+ RID_SVXIMG_EXPANDEDNODE ; \
+ RID_SVXIMG_IMAGEBUTTON ; \
+ RID_SVXIMG_FILECONTROL ; \
+ RID_SVXIMG_DATEFIELD ; \
+ RID_SVXIMG_TIMEFIELD ; \
+ RID_SVXIMG_NUMERICFIELD ; \
+ RID_SVXIMG_CURRENCYFIELD ; \
+ RID_SVXIMG_PATTERNFIELD ; \
+ RID_SVXIMG_HIDDEN ; \
+ RID_SVXIMG_IMAGECONTROL ; \
+ RID_SVXIMG_GRID ; \
+ RID_SVXIMG_FILTER ; \
+ RID_SVXIMG_FORMATTEDFIELD ; \
+ RID_SVXIMG_DATE_N_TIME_FIELDS ; \
+ RID_SVXIMG_FIELD ; \
+ RID_SVXIMG_SCROLLBAR; \
+ RID_SVXIMG_SPINBUTTON; \
+ }; \
+ IdCount = 30
+
+ImageList RID_SVXIMGLIST_FMEXPL
+{
+ Prefix = "sx";
+ MaskColor = Color { Red = 0xff00 ; Green = 0x0000 ; Blue = 0xff00 ; };
+ NAVIGATOR_IMAGEIDS;
+};
+
+ImageList RID_SVXIMGLIST_FMEXPL_HC
+{
+ Prefix = "sxh";
+ MaskColor = Color { Red = 0xff00 ; Green = 0x0000 ; Blue = 0xff00 ; };
+ NAVIGATOR_IMAGEIDS;
+};
+
+ModalDialog RID_SVXDLG_SETFORM
+{
+ HelpID = "svx:ModalDialog:RID_SVXDLG_SETFORM";
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 200 , 200 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ GroupBox GB_PATH
+ {
+ Pos = MAP_APPFONT ( 6 , 149 ) ;
+ Size = MAP_APPFONT ( 188 , 25 ) ;
+ Text [ en-US ] = "Path" ;
+ };
+ FixedText FT_PATH
+ {
+ Pos = MAP_APPFONT ( 12 , 155 ) ;
+ Size = MAP_APPFONT ( 156 , 15 ) ;
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 6 , 180 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 59 , 180 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 123 , 180 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ Text [ en-US ] = "Select form" ;
+};
+DockingWindow RID_SVX_FMEXPLORER
+{
+ HelpID = "svx:DockingWindow:RID_SVX_FMEXPLORER";
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 200 , 200 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text [ en-US ] = "Form Navigator" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/form/fmitems.cxx b/svx/source/form/fmitems.cxx
new file mode 100644
index 000000000000..14170f4c56fd
--- /dev/null
+++ b/svx/source/form/fmitems.cxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "fmitems.hxx"
+
+#include <svx/svxids.hrc>
+#include <tools/stream.hxx>
+
+//========================================================================
+// class FmInterfaceItem
+//========================================================================
+TYPEINIT1(FmInterfaceItem, SfxPoolItem);
+
+//------------------------------------------------------------------------------
+int FmInterfaceItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
+ return( xInterface == ((FmInterfaceItem&)rAttr).GetInterface() );
+}
+
+//------------------------------------------------------------------------------
+SfxPoolItem* FmInterfaceItem::Clone( SfxItemPool* ) const
+{
+ return new FmInterfaceItem( *this );
+}
+
+//------------------------------------------------------------------------------
+SvStream& FmInterfaceItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
+{
+ DBG_ERROR( "FmInterfaceItem::Store: not implemented!" );
+ return rStrm;
+}
+
+//------------------------------------------------------------------------------
+SfxPoolItem* FmInterfaceItem::Create( SvStream& /*rStrm*/, sal_uInt16 ) const
+{
+ DBG_ERROR( "FmInterfaceItem::Create: not implemented!" );
+ return new FmInterfaceItem( *this );
+}
+
+
+
+
diff --git a/svx/source/form/fmmodel.cxx b/svx/source/form/fmmodel.cxx
new file mode 100644
index 000000000000..3c4c3debcc82
--- /dev/null
+++ b/svx/source/form/fmmodel.cxx
@@ -0,0 +1,369 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "fmundo.hxx"
+#include "fmdocumentclassification.hxx"
+#include "fmcontrollayout.hxx"
+
+#include <svx/fmmodel.hxx>
+#include <svx/fmpage.hxx>
+#include <svx/svdobj.hxx>
+#include <tools/debug.hxx>
+
+#ifndef SVX_LIGHT
+#include <sfx2/objsh.hxx>
+#else
+class SfxObjectShell;
+#endif
+
+#include <boost/optional.hpp>
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::container::XNameContainer;
+using namespace svxform;
+
+TYPEINIT1(FmFormModel, SdrModel);
+
+struct FmFormModelImplData
+{
+ FmXUndoEnvironment* pUndoEnv;
+ sal_Bool bOpenInDesignIsDefaulted;
+ sal_Bool bMovingPage;
+ ::boost::optional< sal_Bool >
+ aControlsUseRefDevice;
+
+ FmFormModelImplData()
+ :pUndoEnv( NULL )
+ ,bOpenInDesignIsDefaulted( sal_True )
+ ,bMovingPage( sal_False )
+ ,aControlsUseRefDevice()
+ {
+ }
+};
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+FmFormModel::FmFormModel(SfxItemPool* pPool, SfxObjectShell* pPers)
+ :SdrModel(pPool, pPers, LOADREFCOUNTS)
+ ,m_pImpl(NULL)
+ ,m_pObjShell(0)
+ ,m_bOpenInDesignMode(sal_False)
+ ,m_bAutoControlFocus(sal_False)
+{
+#ifndef SVX_LIGHT
+ m_pImpl = new FmFormModelImplData;
+ m_pImpl->pUndoEnv = new FmXUndoEnvironment(*this);
+ m_pImpl->pUndoEnv->acquire();
+#endif
+}
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+FmFormModel::FmFormModel(const XubString& rPath, SfxItemPool* pPool, SfxObjectShell* pPers)
+ :SdrModel(rPath, pPool, pPers)
+ ,m_pImpl(NULL)
+ ,m_pObjShell(0)
+ ,m_bOpenInDesignMode(sal_False)
+ ,m_bAutoControlFocus(sal_False)
+{
+#ifndef SVX_LIGHT
+ m_pImpl = new FmFormModelImplData;
+ m_pImpl->pUndoEnv = new FmXUndoEnvironment(*this);
+ m_pImpl->pUndoEnv->acquire();
+#endif
+}
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+FmFormModel::FmFormModel(SfxItemPool* pPool, SfxObjectShell* pPers,
+ FASTBOOL bUseExtColorTable
+ )
+ :SdrModel(pPool, pPers, bUseExtColorTable, LOADREFCOUNTS)
+ ,m_pImpl(NULL)
+ ,m_pObjShell(0)
+ ,m_bOpenInDesignMode(sal_False)
+ ,m_bAutoControlFocus(sal_False)
+{
+#ifndef SVX_LIGHT
+ m_pImpl = new FmFormModelImplData;
+ m_pImpl->pUndoEnv = new FmXUndoEnvironment(*this);
+ m_pImpl->pUndoEnv->acquire();
+#endif
+}
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+FmFormModel::FmFormModel(const XubString& rPath, SfxItemPool* pPool, SfxObjectShell* pPers,
+ FASTBOOL bUseExtColorTable)
+ :SdrModel(rPath, pPool, pPers, bUseExtColorTable, LOADREFCOUNTS)
+ ,m_pImpl( NULL )
+ ,m_pObjShell(0)
+ ,m_bOpenInDesignMode(sal_False)
+ ,m_bAutoControlFocus(sal_False)
+{
+#ifndef SVX_LIGHT
+ m_pImpl = new FmFormModelImplData;
+ m_pImpl->pUndoEnv = new FmXUndoEnvironment(*this);
+ m_pImpl->pUndoEnv->acquire();
+#endif
+}
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+FmFormModel::~FmFormModel()
+{
+#ifndef SVX_LIGHT
+ if (m_pObjShell && m_pImpl->pUndoEnv->IsListening(*m_pObjShell))
+ SetObjectShell(NULL);
+
+ ClearUndoBuffer();
+ // minimale grenze fuer undos
+ SetMaxUndoActionCount(1);
+
+ m_pImpl->pUndoEnv->release();
+ delete m_pImpl;
+
+#endif
+}
+
+/*************************************************************************
+|*
+|* Erzeugt eine neue Seite
+|*
+\************************************************************************/
+SdrPage* FmFormModel::AllocPage(FASTBOOL bMasterPage)
+{
+ return new FmFormPage(*this, NULL, bMasterPage);
+}
+
+/*************************************************************************
+|*
+|* InsertPage
+|*
+\************************************************************************/
+void FmFormModel::InsertPage(SdrPage* pPage, sal_uInt16 nPos)
+{
+#ifndef SVX_LIGHT
+ // hack solange Methode intern
+ if (m_pObjShell && !m_pImpl->pUndoEnv->IsListening( *m_pObjShell ))
+ SetObjectShell(m_pObjShell);
+#endif
+
+ SdrModel::InsertPage( pPage, nPos );
+}
+
+/*************************************************************************
+|*
+|* MovePage
+|*
+\************************************************************************/
+void FmFormModel::MovePage( sal_uInt16 nPgNum, sal_uInt16 nNewPos )
+{
+#ifndef SVX_LIGHT
+ m_pImpl->bMovingPage = sal_True;
+ // see InsertPage for this
+#endif
+
+ SdrModel::MovePage( nPgNum, nNewPos );
+
+#ifndef SVX_LIGHT
+ m_pImpl->bMovingPage = sal_False;
+#endif
+}
+
+/*************************************************************************
+|*
+|* RemovePage
+|*
+\************************************************************************/
+SdrPage* FmFormModel::RemovePage(sal_uInt16 nPgNum)
+{
+ FmFormPage* pToBeRemovedPage = dynamic_cast< FmFormPage* >( GetPage( nPgNum ) );
+ OSL_ENSURE( pToBeRemovedPage, "FmFormModel::RemovePage: *which page*?" );
+
+#ifndef SVX_LIGHT
+ if ( pToBeRemovedPage )
+ {
+ Reference< XNameContainer > xForms( pToBeRemovedPage->GetForms( false ) );
+ if ( xForms.is() )
+ m_pImpl->pUndoEnv->RemoveForms( xForms );
+ }
+#endif
+
+ FmFormPage* pRemovedPage = (FmFormPage*)SdrModel::RemovePage(nPgNum);
+ OSL_ENSURE( pRemovedPage == pToBeRemovedPage, "FmFormModel::RemovePage: inconsistency!" );
+ return pRemovedPage;
+}
+
+/*************************************************************************
+|*
+|* InsertMasterPage
+|*
+\************************************************************************/
+void FmFormModel::InsertMasterPage(SdrPage* pPage, sal_uInt16 nPos)
+{
+#ifndef SVX_LIGHT
+ // hack solange Methode intern
+ if (m_pObjShell && !m_pImpl->pUndoEnv->IsListening( *m_pObjShell ))
+ SetObjectShell(m_pObjShell);
+#endif
+
+ SdrModel::InsertMasterPage(pPage, nPos);
+}
+
+/*************************************************************************
+|*
+|* RemoveMasterPage
+|*
+\************************************************************************/
+SdrPage* FmFormModel::RemoveMasterPage(sal_uInt16 nPgNum)
+{
+ FmFormPage* pPage = (FmFormPage*)SdrModel::RemoveMasterPage(nPgNum);
+
+#ifndef SVX_LIGHT
+ if ( pPage )
+ {
+ Reference< XNameContainer > xForms( pPage->GetForms( false ) );
+ if ( xForms.is() )
+ m_pImpl->pUndoEnv->RemoveForms( xForms );
+ }
+#endif
+
+ return pPage;
+}
+
+//------------------------------------------------------------------------
+SdrLayerID FmFormModel::GetControlExportLayerId( const SdrObject& rObj ) const
+{
+ return rObj.GetLayer();
+}
+
+//------------------------------------------------------------------------
+void FmFormModel::implSetOpenInDesignMode( sal_Bool _bOpenDesignMode, sal_Bool _bForce )
+{
+ if( ( _bOpenDesignMode != m_bOpenInDesignMode ) || _bForce )
+ {
+ m_bOpenInDesignMode = _bOpenDesignMode;
+
+ if ( m_pObjShell )
+ m_pObjShell->SetModified( sal_True );
+ }
+ // no matter if we really did it or not - from now on, it does not count as defaulted anymore
+ m_pImpl->bOpenInDesignIsDefaulted = sal_False;
+}
+
+//------------------------------------------------------------------------
+void FmFormModel::SetOpenInDesignMode( sal_Bool bOpenDesignMode )
+{
+#ifndef SVX_LIGHT
+ implSetOpenInDesignMode( bOpenDesignMode, sal_False );
+#endif
+}
+
+#ifndef SVX_LIGHT
+//------------------------------------------------------------------------
+sal_Bool FmFormModel::OpenInDesignModeIsDefaulted( )
+{
+ return m_pImpl->bOpenInDesignIsDefaulted;
+}
+#endif
+
+//------------------------------------------------------------------------
+sal_Bool FmFormModel::ControlsUseRefDevice() const
+{
+ if ( !m_pImpl->aControlsUseRefDevice )
+ {
+ DocumentType eDocType = eUnknownDocumentType;
+ if ( m_pObjShell )
+ eDocType = DocumentClassification::classifyHostDocument( m_pObjShell->GetModel() );
+ m_pImpl->aControlsUseRefDevice.reset( ControlLayouter::useDocumentReferenceDevice( eDocType ) );
+ }
+ return *m_pImpl->aControlsUseRefDevice;
+}
+
+//------------------------------------------------------------------------
+void FmFormModel::SetAutoControlFocus( sal_Bool _bAutoControlFocus )
+{
+#ifndef SVX_LIGHT
+ if( _bAutoControlFocus != m_bAutoControlFocus )
+ {
+ m_bAutoControlFocus = _bAutoControlFocus;
+ m_pObjShell->SetModified( sal_True );
+ }
+#endif
+}
+
+//------------------------------------------------------------------------
+void FmFormModel::SetObjectShell( SfxObjectShell* pShell )
+{
+#ifndef SVX_LIGHT
+ if (pShell == m_pObjShell)
+ return;
+
+ if (m_pObjShell)
+ {
+ m_pImpl->pUndoEnv->EndListening( *this );
+ m_pImpl->pUndoEnv->EndListening( *m_pObjShell );
+ }
+
+ m_pObjShell = pShell;
+
+ if (m_pObjShell)
+ {
+ m_pImpl->pUndoEnv->SetReadOnly( m_pObjShell->IsReadOnly() || m_pObjShell->IsReadOnlyUI(), FmXUndoEnvironment::Accessor() );
+
+ if (!m_pImpl->pUndoEnv->IsReadOnly())
+ m_pImpl->pUndoEnv->StartListening(*this);
+
+ m_pImpl->pUndoEnv->StartListening( *m_pObjShell );
+ }
+#endif
+}
+
+//------------------------------------------------------------------------
+FmXUndoEnvironment& FmFormModel::GetUndoEnv()
+{
+ return *m_pImpl->pUndoEnv;
+}
diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx
new file mode 100644
index 000000000000..2b7ad83f7f5f
--- /dev/null
+++ b/svx/source/form/fmobj.cxx
@@ -0,0 +1,736 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "fmobj.hxx"
+#include "fmprop.hrc"
+#include "fmvwimp.hxx"
+#include "fmpgeimp.hxx"
+#include "svx/fmresids.hrc"
+#include "svx/fmview.hxx"
+#include "svx/fmglob.hxx"
+#include "svx/fmpage.hxx"
+#include "editeng/editeng.hxx"
+#include "svx/svdovirt.hxx"
+#include "svx/fmmodel.hxx"
+#include "svx/dialmgr.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/script/XEventAttacherManager.hpp>
+#include <com/sun/star/io/XPersistObject.hpp>
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+/** === end UNO includes === **/
+#include "svx/fmtools.hxx"
+
+#include <tools/shl.hxx>
+#include <comphelper/property.hxx>
+#include <comphelper/processfactory.hxx>
+#include <toolkit/awt/vclxdevice.hxx>
+#include <vcl/svapp.hxx>
+#include <tools/resmgr.hxx>
+#include <tools/diagnose_ex.h>
+
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::form;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::script;
+using namespace ::com::sun::star::container;
+using namespace ::svxform;
+
+TYPEINIT1(FmFormObj, SdrUnoObj);
+DBG_NAME(FmFormObj);
+//------------------------------------------------------------------
+FmFormObj::FmFormObj(const ::rtl::OUString& rModelName,sal_Int32 _nType)
+ :SdrUnoObj ( rModelName )
+ ,m_nPos ( -1 )
+ ,m_nType ( _nType )
+ ,m_pLastKnownRefDevice ( NULL )
+{
+ DBG_CTOR(FmFormObj, NULL);
+
+ // normally, this is done in SetUnoControlModel, but if the call happened in the base class ctor,
+ // then our incarnation of it was not called (since we were not constructed at this time).
+ impl_checkRefDevice_nothrow( true );
+}
+
+//------------------------------------------------------------------
+FmFormObj::FmFormObj( sal_Int32 _nType )
+ :SdrUnoObj ( String() )
+ ,m_nPos ( -1 )
+ ,m_nType ( _nType )
+ ,m_pLastKnownRefDevice ( NULL )
+{
+ DBG_CTOR(FmFormObj, NULL);
+}
+
+//------------------------------------------------------------------
+FmFormObj::~FmFormObj()
+{
+ DBG_DTOR(FmFormObj, NULL);
+
+ Reference< XComponent> xHistory(m_xEnvironmentHistory, UNO_QUERY);
+ if (xHistory.is())
+ xHistory->dispose();
+
+ m_xEnvironmentHistory = NULL;
+ m_aEventsHistory.realloc(0);
+}
+
+//------------------------------------------------------------------
+void FmFormObj::SetObjEnv(const Reference< XIndexContainer > & xForm, const sal_Int32 nIdx,
+ const Sequence< ScriptEventDescriptor >& rEvts)
+{
+ m_xParent = xForm;
+ aEvts = rEvts;
+ m_nPos = nIdx;
+}
+
+//------------------------------------------------------------------
+void FmFormObj::ClearObjEnv()
+{
+ m_xParent.clear();
+ aEvts.realloc( 0 );
+ m_nPos = -1;
+}
+
+//------------------------------------------------------------------
+void FmFormObj::impl_checkRefDevice_nothrow( bool _force )
+{
+ const FmFormModel* pFormModel = PTR_CAST( FmFormModel, GetModel() );
+ if ( !pFormModel || !pFormModel->ControlsUseRefDevice() )
+ return;
+
+ OutputDevice* pCurrentRefDevice = pFormModel ? pFormModel->GetRefDevice() : NULL;
+ if ( ( m_pLastKnownRefDevice == pCurrentRefDevice ) && !_force )
+ return;
+
+ Reference< XControlModel > xControlModel( GetUnoControlModel() );
+ if ( !xControlModel.is() )
+ return;
+
+ m_pLastKnownRefDevice = pCurrentRefDevice;
+ if ( m_pLastKnownRefDevice == NULL )
+ return;
+
+ try
+ {
+ Reference< XPropertySet > xModelProps( GetUnoControlModel(), UNO_QUERY_THROW );
+ Reference< XPropertySetInfo > xPropertyInfo( xModelProps->getPropertySetInfo(), UNO_SET_THROW );
+
+ static const ::rtl::OUString sRefDevicePropName( RTL_CONSTASCII_USTRINGPARAM( "ReferenceDevice" ) );
+ if ( xPropertyInfo->hasPropertyByName( sRefDevicePropName ) )
+ {
+ VCLXDevice* pUnoRefDevice = new VCLXDevice;
+ pUnoRefDevice->SetOutputDevice( m_pLastKnownRefDevice );
+ Reference< XDevice > xRefDevice( pUnoRefDevice );
+ xModelProps->setPropertyValue( sRefDevicePropName, makeAny( xRefDevice ) );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//------------------------------------------------------------------
+void FmFormObj::impl_isolateControlModel_nothrow()
+{
+ try
+ {
+ Reference< XChild > xControlModel( GetUnoControlModel(), UNO_QUERY );
+ if ( xControlModel.is() )
+ {
+ Reference< XIndexContainer> xParent( xControlModel->getParent(), UNO_QUERY );
+ if ( xParent.is() )
+ {
+ sal_Int32 nPos = getElementPos( xParent.get(), xControlModel );
+ xParent->removeByIndex( nPos );
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//------------------------------------------------------------------
+void FmFormObj::SetPage(SdrPage* _pNewPage)
+{
+ if ( GetPage() == _pNewPage )
+ {
+ SdrUnoObj::SetPage(_pNewPage);
+ return;
+ }
+
+ FmFormPage* pOldFormPage = PTR_CAST( FmFormPage, GetPage() );
+ if ( pOldFormPage )
+ pOldFormPage->GetImpl().formObjectRemoved( *this );
+
+ FmFormPage* pNewFormPage = PTR_CAST( FmFormPage, _pNewPage );
+ if ( !pNewFormPage )
+ { // Maybe it makes sense to create an environment history here : if somebody set's our page to NULL, and we have a valid page before,
+ // me may want to remember our place within the old page. For this we could create a new m_xEnvironmentHistory to store it.
+ // So the next SetPage with a valid new page would restore that environment within the new page.
+ // But for the original Bug (#57300#) we don't need that, so I omit it here. Maybe this will be implemented later.
+ impl_isolateControlModel_nothrow();
+ SdrUnoObj::SetPage(_pNewPage);
+ return;
+ }
+
+ Reference< XIndexContainer > xNewPageForms( pNewFormPage->GetForms( true ), UNO_QUERY );
+ Reference< XIndexContainer > xNewParent;
+ Sequence< ScriptEventDescriptor> aNewEvents;
+
+ // calc the new parent for my model (within the new page's forms hierarchy)
+ // do we have a history ? (from :Clone)
+ if ( m_xEnvironmentHistory.is() )
+ {
+ // the element in m_xEnvironmentHistory which is equivalent to my new parent (which (perhaps) has to be created within _pNewPage->GetForms)
+ // is the right-most element in the tree.
+ Reference< XIndexContainer > xRightMostLeaf = m_xEnvironmentHistory;
+ try
+ {
+ while ( xRightMostLeaf->getCount() )
+ {
+ xRightMostLeaf.set(
+ xRightMostLeaf->getByIndex( xRightMostLeaf->getCount() - 1 ),
+ UNO_QUERY_THROW
+ );
+ }
+
+ xNewParent.set( ensureModelEnv( xRightMostLeaf, xNewPageForms ), UNO_QUERY_THROW );
+
+ // we successfully cloned the environment in m_xEnvironmentHistory, so we can use m_aEventsHistory
+ // (which describes the events of our model at the moment m_xEnvironmentHistory was created)
+ aNewEvents = m_aEventsHistory;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ if ( !xNewParent.is() )
+ {
+ // are we a valid part of our current page forms ?
+ Reference< XIndexContainer > xOldForms;
+ if ( pOldFormPage )
+ xOldForms.set( pOldFormPage->GetForms(), UNO_QUERY_THROW );
+
+ if ( xOldForms.is() )
+ {
+ // search (upward from our model) for xOldForms
+ Reference< XChild > xSearch( GetUnoControlModel(), UNO_QUERY );
+ while (xSearch.is())
+ {
+ if ( xSearch == xOldForms )
+ break;
+ xSearch = Reference< XChild >( xSearch->getParent(), UNO_QUERY );
+ }
+ if ( xSearch.is() ) // implies xSearch == xOldForms, which means we're a valid part of our current page forms hierarchy
+ {
+ Reference< XChild > xMeAsChild( GetUnoControlModel(), UNO_QUERY );
+ xNewParent.set( ensureModelEnv( xMeAsChild->getParent(), xNewPageForms ), UNO_QUERY );
+
+ if ( xNewParent.is() )
+ {
+ try
+ {
+ // transfer the events from our (model's) parent to the new (model's) parent, too
+ Reference< XEventAttacherManager > xEventManager(xMeAsChild->getParent(), UNO_QUERY);
+ Reference< XIndexAccess > xManagerAsIndex(xEventManager, UNO_QUERY);
+ if (xManagerAsIndex.is())
+ {
+ sal_Int32 nPos = getElementPos(xManagerAsIndex, xMeAsChild);
+ if (nPos >= 0)
+ aNewEvents = xEventManager->getScriptEvents(nPos);
+ }
+ else
+ aNewEvents = aEvts;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+ }
+ }
+
+ // now set the page
+ SdrUnoObj::SetPage(_pNewPage);
+
+ // place my model within the new parent container
+ if (xNewParent.is())
+ {
+ Reference< XFormComponent > xMeAsFormComp(GetUnoControlModel(), UNO_QUERY);
+ if (xMeAsFormComp.is())
+ {
+ // check if I have another parent (and remove me, if neccessary)
+ Reference< XIndexContainer > xOldParent(xMeAsFormComp->getParent(), UNO_QUERY);
+ if (xOldParent.is())
+ {
+ sal_Int32 nPos = getElementPos(Reference< XIndexAccess > (xOldParent, UNO_QUERY), xMeAsFormComp);
+ if (nPos > -1)
+ xOldParent->removeByIndex(nPos);
+ }
+ // and insert into the new container
+ xNewParent->insertByIndex(xNewParent->getCount(), makeAny(xMeAsFormComp));
+
+ // transfer the events
+ if (aNewEvents.getLength())
+ {
+ try
+ {
+ Reference< XEventAttacherManager > xEventManager(xNewParent, UNO_QUERY);
+ Reference< XIndexAccess > xManagerAsIndex(xEventManager, UNO_QUERY);
+ if (xManagerAsIndex.is())
+ {
+ sal_Int32 nPos = getElementPos(xManagerAsIndex, xMeAsFormComp);
+ DBG_ASSERT(nPos >= 0, "FmFormObj::SetPage : inserted but not present ?");
+ xEventManager->registerScriptEvents(nPos, aNewEvents);
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ }
+ }
+ }
+
+ // delete my history
+ Reference< XComponent> xHistory(m_xEnvironmentHistory, UNO_QUERY);
+ if (xHistory.is())
+ xHistory->dispose();
+
+ m_xEnvironmentHistory = NULL;
+ m_aEventsHistory.realloc(0);
+
+ if ( pNewFormPage )
+ pNewFormPage->GetImpl().formObjectInserted( *this );
+}
+
+//------------------------------------------------------------------
+sal_uInt32 FmFormObj::GetObjInventor() const
+{
+ return FmFormInventor;
+}
+
+//------------------------------------------------------------------
+sal_uInt16 FmFormObj::GetObjIdentifier() const
+{
+ return OBJ_UNO;
+}
+
+//------------------------------------------------------------------
+void FmFormObj::clonedFrom(const FmFormObj* _pSource)
+{
+ DBG_ASSERT(_pSource != NULL, "FmFormObj::clonedFrom : invalid source !");
+ Reference< XComponent> xHistory(m_xEnvironmentHistory, UNO_QUERY);
+ if (xHistory.is())
+ xHistory->dispose();
+
+ m_xEnvironmentHistory = NULL;
+ m_aEventsHistory.realloc(0);
+
+ Reference< XChild > xSourceAsChild(_pSource->GetUnoControlModel(), UNO_QUERY);
+ if (!xSourceAsChild.is())
+ return;
+
+ Reference< XInterface > xSourceContainer = xSourceAsChild->getParent();
+
+ m_xEnvironmentHistory = Reference< XIndexContainer >(
+ ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.form.Forms")),
+ UNO_QUERY);
+ DBG_ASSERT(m_xEnvironmentHistory.is(), "FmFormObj::clonedFrom : could not create a forms collection !");
+
+ if (m_xEnvironmentHistory.is())
+ {
+ ensureModelEnv(xSourceContainer, m_xEnvironmentHistory);
+ m_aEventsHistory = aEvts;
+ // if we we're clone there was a call to operator=, so aEvts are excatly the events we need here ...
+ }
+}
+
+//------------------------------------------------------------------
+SdrObject* FmFormObj::Clone() const
+{
+ SdrObject* pReturn = SdrUnoObj::Clone();
+
+ FmFormObj* pFormObject = PTR_CAST(FmFormObj, pReturn);
+ DBG_ASSERT(pFormObject != NULL, "FmFormObj::Clone : invalid clone !");
+ if (pFormObject)
+ pFormObject->clonedFrom(this);
+
+ return pReturn;
+}
+
+//------------------------------------------------------------------
+void FmFormObj::NbcReformatText()
+{
+ impl_checkRefDevice_nothrow( false );
+ SdrUnoObj::NbcReformatText();
+}
+
+//------------------------------------------------------------------
+void FmFormObj::operator= (const SdrObject& rObj)
+{
+ SdrUnoObj::operator= (rObj);
+
+ FmFormObj* pFormObj = PTR_CAST(FmFormObj, &rObj);
+ if (pFormObj)
+ {
+ // liegt das UnoControlModel in einer Eventumgebung,
+ // dann koennen noch Events zugeordnet sein
+ Reference< XFormComponent > xContent(pFormObj->xUnoControlModel, UNO_QUERY);
+ if (xContent.is())
+ {
+ Reference< XEventAttacherManager > xManager(xContent->getParent(), UNO_QUERY);
+ Reference< XIndexAccess > xManagerAsIndex(xManager, UNO_QUERY);
+ if (xManagerAsIndex.is())
+ {
+ sal_Int32 nPos = getElementPos( xManagerAsIndex, xContent );
+ if ( nPos >= 0 )
+ aEvts = xManager->getScriptEvents( nPos );
+ }
+ }
+ else
+ aEvts = pFormObj->aEvts;
+ }
+}
+
+//------------------------------------------------------------------
+namespace
+{
+ String lcl_getFormComponentAccessPath(const Reference< XInterface >& _xElement, Reference< XInterface >& _rTopLevelElement)
+ {
+ Reference< ::com::sun::star::form::XFormComponent> xChild(_xElement, UNO_QUERY);
+ Reference< ::com::sun::star::container::XIndexAccess> xParent;
+ if (xChild.is())
+ xParent = Reference< ::com::sun::star::container::XIndexAccess>(xChild->getParent(), UNO_QUERY);
+
+ // while the current content is a form
+ String sReturn;
+ String sCurrentIndex;
+ while (xChild.is())
+ {
+ // get the content's relative pos within it's parent container
+ sal_Int32 nPos = getElementPos(xParent, xChild);
+
+ // prepend this current relaive pos
+ sCurrentIndex = String::CreateFromInt32(nPos);
+ if (sReturn.Len() != 0)
+ {
+ sCurrentIndex += '\\';
+ sCurrentIndex += sReturn;
+ }
+
+ sReturn = sCurrentIndex;
+
+ // travel up
+ if (::comphelper::query_interface((Reference< XInterface >)xParent,xChild))
+ xParent = Reference< ::com::sun::star::container::XIndexAccess>(xChild->getParent(), UNO_QUERY);
+ }
+
+ _rTopLevelElement = xParent;
+ return sReturn;
+ }
+}
+
+//------------------------------------------------------------------
+Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface > & _rSourceContainer, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > _rTopLevelDestContainer)
+{
+ Reference< XInterface > xTopLevelSouce;
+ String sAccessPath = lcl_getFormComponentAccessPath(_rSourceContainer, xTopLevelSouce);
+ if (!xTopLevelSouce.is())
+ // somthing went wrong, maybe _rSourceContainer isn't part of a valid forms hierarchy
+ return Reference< XInterface > ();
+
+ Reference< XIndexContainer > xDestContainer(_rTopLevelDestContainer);
+ Reference< XIndexContainer > xSourceContainer(xTopLevelSouce, UNO_QUERY);
+ DBG_ASSERT(xSourceContainer.is(), "FmFormObj::ensureModelEnv : the top level source is invalid !");
+
+ for (xub_StrLen i=0; i<sAccessPath.GetTokenCount('\\'); ++i)
+ {
+ sal_uInt16 nIndex = (sal_uInt16)sAccessPath.GetToken(i, '\\').ToInt32();
+
+ // get the DSS of the source form (we have to find an aquivalent for)
+ DBG_ASSERT(nIndex<xSourceContainer->getCount(), "FmFormObj::ensureModelEnv : invalid access path !");
+ Reference< XPropertySet > xSourceForm;
+ xSourceContainer->getByIndex(nIndex) >>= xSourceForm;
+ DBG_ASSERT(xSourceForm.is(), "FmFormObj::ensureModelEnv : invalid source form !");
+
+ Any aSrcCursorSource, aSrcCursorSourceType, aSrcDataSource;
+ DBG_ASSERT(::comphelper::hasProperty(FM_PROP_COMMAND, xSourceForm) && ::comphelper::hasProperty(FM_PROP_COMMANDTYPE, xSourceForm)
+ && ::comphelper::hasProperty(FM_PROP_DATASOURCE, xSourceForm), "FmFormObj::ensureModelEnv : invalid access path or invalid form (missing props) !");
+ // the parent access path should refer to a row set
+ try
+ {
+ aSrcCursorSource = xSourceForm->getPropertyValue(FM_PROP_COMMAND);
+ aSrcCursorSourceType = xSourceForm->getPropertyValue(FM_PROP_COMMANDTYPE);
+ aSrcDataSource = xSourceForm->getPropertyValue(FM_PROP_DATASOURCE);
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("FmFormObj::ensureModelEnv : could not retrieve a source DSS !");
+ }
+
+
+ // calc the number of (source) form siblings with the same DSS
+ Reference< XPropertySet > xCurrentSourceForm, xCurrentDestForm;
+ sal_Int16 nCurrentSourceIndex = 0, nCurrentDestIndex = 0;
+ while (nCurrentSourceIndex <= nIndex)
+ {
+ sal_Bool bEqualDSS = sal_False;
+ while (!bEqualDSS) // (we don't have to check nCurrentSourceIndex here : it's bound by nIndex)
+ {
+ xSourceContainer->getByIndex(nCurrentSourceIndex) >>= xCurrentSourceForm;
+ DBG_ASSERT(xCurrentSourceForm.is(), "FmFormObj::ensureModelEnv : invalid form ancestor (2) !");
+ bEqualDSS = sal_False;
+ if (::comphelper::hasProperty(FM_PROP_DATASOURCE, xCurrentSourceForm))
+ { // it is a form
+ try
+ {
+ if ( ::comphelper::compare(xCurrentSourceForm->getPropertyValue(FM_PROP_COMMAND), aSrcCursorSource)
+ && ::comphelper::compare(xCurrentSourceForm->getPropertyValue(FM_PROP_COMMANDTYPE), aSrcCursorSourceType)
+ && ::comphelper::compare(xCurrentSourceForm->getPropertyValue(FM_PROP_DATASOURCE), aSrcDataSource)
+ )
+ {
+ bEqualDSS = sal_True;
+ }
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("FmFormObj::ensureModelEnv : exception while getting a sibling's DSS !");
+ }
+
+ }
+ ++nCurrentSourceIndex;
+ }
+
+ DBG_ASSERT(bEqualDSS, "FmFormObj::ensureModelEnv : found no source form !");
+ // ??? at least the nIndex-th one should have been found ???
+
+ // now search the next one with the given DSS (within the destination container)
+ bEqualDSS = sal_False;
+ while (!bEqualDSS && (nCurrentDestIndex < xDestContainer->getCount()))
+ {
+ xDestContainer->getByIndex(nCurrentDestIndex) >>= xCurrentDestForm;
+ DBG_ASSERT(xCurrentDestForm.is(), "FmFormObj::ensureModelEnv : invalid destination form !");
+ bEqualDSS = sal_False;
+ if (::comphelper::hasProperty(FM_PROP_DATASOURCE, xCurrentDestForm))
+ { // it is a form
+ try
+ {
+ if ( ::comphelper::compare(xCurrentDestForm->getPropertyValue(FM_PROP_COMMAND), aSrcCursorSource)
+ && ::comphelper::compare(xCurrentDestForm->getPropertyValue(FM_PROP_COMMANDTYPE), aSrcCursorSourceType)
+ && ::comphelper::compare(xCurrentDestForm->getPropertyValue(FM_PROP_DATASOURCE), aSrcDataSource)
+ )
+ {
+ bEqualDSS = sal_True;
+ }
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("FmFormObj::ensureModelEnv : exception while getting a destination DSS !");
+ }
+
+ }
+ ++nCurrentDestIndex;
+ }
+
+ if (!bEqualDSS)
+ { // There is at least one more source form with the given DSS than destination forms are.
+ // correct this ...
+ try
+ {
+ // create and insert (into the destination) a copy of the form
+ xCurrentDestForm.set(
+ ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.form.component.DataForm" ) ),
+ UNO_QUERY_THROW );
+ ::comphelper::copyProperties( xCurrentSourceForm, xCurrentDestForm );
+
+ DBG_ASSERT(nCurrentDestIndex == xDestContainer->getCount(), "FmFormObj::ensureModelEnv : something went wrong with the numbers !");
+ xDestContainer->insertByIndex(nCurrentDestIndex, makeAny(xCurrentDestForm));
+
+ ++nCurrentDestIndex;
+ // like nCurrentSourceIndex, nCurrentDestIndex now points 'behind' the form it actally means
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("FmFormObj::ensureModelEnv : something went seriously wrong while creating a new form !");
+ // no more options anymore ...
+ return Reference< XInterface > ();
+ }
+
+ }
+ }
+
+ // now xCurrentDestForm is a form equivalent to xSourceForm (which means they have the same DSS and the same number
+ // of left siblings with the same DSS, which counts for all their ancestors, too)
+
+ // go down
+ xDestContainer = Reference< XIndexContainer > (xCurrentDestForm, UNO_QUERY);
+ xSourceContainer = Reference< XIndexContainer > (xSourceForm, UNO_QUERY);
+ DBG_ASSERT(xDestContainer.is() && xSourceContainer.is(), "FmFormObj::ensureModelEnv : invalid container !");
+ }
+
+ return Reference< XInterface > (xDestContainer, UNO_QUERY);
+}
+
+//------------------------------------------------------------------
+void FmFormObj::SetModel( SdrModel* _pNewModel )
+{
+ SdrUnoObj::SetModel( _pNewModel );
+ impl_checkRefDevice_nothrow();
+}
+
+//------------------------------------------------------------------
+FmFormObj* FmFormObj::GetFormObject( SdrObject* _pSdrObject )
+{
+ FmFormObj* pFormObject = dynamic_cast< FmFormObj* >( _pSdrObject );
+ if ( !pFormObject )
+ {
+ SdrVirtObj* pVirtualObject = dynamic_cast< SdrVirtObj* >( _pSdrObject );
+ if ( pVirtualObject )
+ pFormObject = dynamic_cast< FmFormObj* >( &pVirtualObject->ReferencedObj() );
+ }
+ return pFormObject;
+}
+
+//------------------------------------------------------------------
+const FmFormObj* FmFormObj::GetFormObject( const SdrObject* _pSdrObject )
+{
+ const FmFormObj* pFormObject = dynamic_cast< const FmFormObj* >( _pSdrObject );
+ if ( !pFormObject )
+ {
+ const SdrVirtObj* pVirtualObject = dynamic_cast< const SdrVirtObj* >( _pSdrObject );
+ if ( pVirtualObject )
+ pFormObject = dynamic_cast< const FmFormObj* >( &pVirtualObject->GetReferencedObj() );
+ }
+ return pFormObject;
+}
+
+//------------------------------------------------------------------
+void FmFormObj::SetUnoControlModel( const Reference< com::sun::star::awt::XControlModel >& _rxModel )
+{
+ SdrUnoObj::SetUnoControlModel( _rxModel );
+
+ // TODO: call something like formObjectInserted at the form page, to tell it the new model
+
+ impl_checkRefDevice_nothrow( true );
+}
+
+//------------------------------------------------------------------
+FASTBOOL FmFormObj::EndCreate( SdrDragStat& rStat, SdrCreateCmd eCmd )
+{
+ bool bResult = SdrUnoObj::EndCreate(rStat, eCmd);
+ if ( bResult && SDRCREATE_FORCEEND == eCmd && rStat.GetView() )
+ {
+ if ( pPage )
+ {
+ FmFormPage& rPage = dynamic_cast< FmFormPage& >( *pPage );
+
+ try
+ {
+ Reference< XFormComponent > xContent( xUnoControlModel, UNO_QUERY_THROW );
+ Reference< XForm > xParentForm( xContent->getParent(), UNO_QUERY );
+
+ Reference< XIndexContainer > xFormToInsertInto;
+
+ if ( !xParentForm.is() )
+ { // model is not yet part of a form component hierachy
+ xParentForm.set( rPage.GetImpl().findPlaceInFormComponentHierarchy( xContent ), UNO_SET_THROW );
+ xFormToInsertInto.set( xParentForm, UNO_QUERY_THROW );
+ }
+
+ rPage.GetImpl().setUniqueName( xContent, xParentForm );
+
+ if ( xFormToInsertInto.is() )
+ xFormToInsertInto->insertByIndex( xFormToInsertInto->getCount(), makeAny( xContent ) );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ FmFormView* pView( dynamic_cast< FmFormView* >( rStat.GetView() ) );
+ FmXFormView* pViewImpl = pView ? pView->GetImpl() : NULL;
+ OSL_ENSURE( pViewImpl, "FmFormObj::EndCreate: no view!?" );
+ if ( pViewImpl )
+ pViewImpl->onCreatedFormObject( *this );
+ }
+ return bResult;
+}
+
+//------------------------------------------------------------------------------
+void FmFormObj::BrkCreate( SdrDragStat& rStat )
+{
+ SdrUnoObj::BrkCreate( rStat );
+ impl_isolateControlModel_nothrow();
+}
+
+// -----------------------------------------------------------------------------
+sal_Int32 FmFormObj::getType() const
+{
+ return m_nType;
+}
+
+// -----------------------------------------------------------------------------
+// #i70852# overload Layer interface to force to FormColtrol layer
+
+SdrLayerID FmFormObj::GetLayer() const
+{
+ // #i72535#
+ // i70852 was too radical, in SW obects (and thus, FormControls, too)
+ // get moved to invisible layers to hide them (e.g. in hidden sections).
+ // This means that form controls ARE allowed to be on other layers than
+ // the form control layer ATM and that being member of form control layer
+ // is no criteria to find all FormControls of a document.
+ // To fix, use parent functionality
+ return SdrUnoObj::GetLayer();
+}
+
+void FmFormObj::NbcSetLayer(SdrLayerID nLayer)
+{
+ // #i72535#
+ // See above. To fix, use parent functionality
+ return SdrUnoObj::NbcSetLayer(nLayer);
+}
+
+// eof
diff --git a/svx/source/form/fmobjfac.cxx b/svx/source/form/fmobjfac.cxx
new file mode 100644
index 000000000000..2b13f2a90bf0
--- /dev/null
+++ b/svx/source/form/fmobjfac.cxx
@@ -0,0 +1,278 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <comphelper/stl_types.hxx>
+#include <svx/svdobj.hxx>
+#include "svx/fmtools.hxx"
+#include "fmservs.hxx"
+
+#ifndef _FM_FMOBJFAC_HXX
+#include "svx/fmobjfac.hxx"
+#endif
+
+#ifndef _FM_FMGLOB_HXX
+#include <svx/fmglob.hxx>
+#endif
+
+#ifndef _FM_FMOBJ_HXX
+#include "fmobj.hxx"
+#endif
+#include "fmshimp.hxx"
+
+#ifndef _FM_FMSHELL_HXX
+#include <svx/fmshell.hxx>
+#endif
+
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+#include "tbxform.hxx"
+#include <tools/resid.hxx>
+
+#ifndef _SVX_FMRESIDS_HRC
+#include "svx/fmresids.hrc"
+#endif
+#include <tools/shl.hxx>
+#include <svx/dialmgr.hxx>
+#include "fmservs.hxx"
+#include "tabwin.hxx"
+#include "fmexpl.hxx"
+#include "filtnav.hxx"
+
+#ifndef _SVX_FMPROP_HRC
+#include "fmprop.hrc"
+#endif
+#include "fmPropBrw.hxx"
+#include "datanavi.hxx"
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::svxform;
+
+static sal_Bool bInit = sal_False;
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+FmFormObjFactory::FmFormObjFactory()
+{
+ if ( !bInit )
+ {
+ SdrObjFactory::InsertMakeObjectHdl(LINK(this, FmFormObjFactory, MakeObject));
+
+ //////////////////////////////////////////////////////////////////////
+ // Konfigurations-::com::sun::star::frame::Controller und NavigationBar registrieren
+ SvxFmTbxCtlConfig::RegisterControl( SID_FM_CONFIG );
+ SvxFmTbxCtlAbsRec::RegisterControl( SID_FM_RECORD_ABSOLUTE );
+ SvxFmTbxCtlRecText::RegisterControl( SID_FM_RECORD_TEXT );
+ SvxFmTbxCtlRecFromText::RegisterControl( SID_FM_RECORD_FROM_TEXT );
+ SvxFmTbxCtlRecTotal::RegisterControl( SID_FM_RECORD_TOTAL );
+ SvxFmTbxPrevRec::RegisterControl( SID_FM_RECORD_PREV );
+ SvxFmTbxNextRec::RegisterControl( SID_FM_RECORD_NEXT );
+ ControlConversionMenuController::RegisterControl(SID_FM_CHANGECONTROLTYPE);
+
+ // Registrieung von globalen fenstern
+ FmFieldWinMgr::RegisterChildWindow();
+ FmPropBrwMgr::RegisterChildWindow();
+ NavigatorFrameManager::RegisterChildWindow();
+ DataNavigatorManager::RegisterChildWindow();
+ FmFilterNavigatorWinMgr::RegisterChildWindow();
+
+ //////////////////////////////////////////////////////////////////////
+ // Interface fuer die Formshell registrieren
+ FmFormShell::RegisterInterface(0);
+
+ ImplSmartRegisterUnoServices();
+ bInit = sal_True;
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+FmFormObjFactory::~FmFormObjFactory()
+{
+}
+
+
+/*************************************************************************
+|*
+|* ::com::sun::star::form::Form-Objekte erzeugen
+|*
+\************************************************************************/
+namespace
+{
+ void lcl_initProperty( FmFormObj* _pObject, const ::rtl::OUString& _rPropName, const Any& _rValue )
+ {
+ try
+ {
+ Reference< XPropertySet > xModelSet( _pObject->GetUnoControlModel(), UNO_QUERY );
+ if ( xModelSet.is() )
+ xModelSet->setPropertyValue( _rPropName, _rValue );
+ }
+ catch( const Exception& )
+ {
+ DBG_ERROR( "lcl_initProperty: caught an exception!" );
+ }
+ }
+}
+
+IMPL_LINK(FmFormObjFactory, MakeObject, SdrObjFactory*, pObjFactory)
+{
+ if (pObjFactory->nInventor == FmFormInventor)
+ {
+ ::rtl::OUString sServiceSpecifier;
+
+ typedef ::std::vector< ::std::pair< ::rtl::OUString, Any > > PropertyValueArray;
+ PropertyValueArray aInitialProperties;
+
+ switch ( pObjFactory->nIdentifier )
+ {
+ case OBJ_FM_EDIT:
+ sServiceSpecifier = FM_COMPONENT_EDIT;
+ break;
+
+ case OBJ_FM_BUTTON:
+ sServiceSpecifier = FM_COMPONENT_COMMANDBUTTON;
+ break;
+
+ case OBJ_FM_FIXEDTEXT:
+ sServiceSpecifier = FM_COMPONENT_FIXEDTEXT;
+ break;
+
+ case OBJ_FM_LISTBOX:
+ sServiceSpecifier = FM_COMPONENT_LISTBOX;
+ break;
+
+ case OBJ_FM_CHECKBOX:
+ sServiceSpecifier = FM_COMPONENT_CHECKBOX;
+ break;
+
+ case OBJ_FM_RADIOBUTTON:
+ sServiceSpecifier = FM_COMPONENT_RADIOBUTTON;
+ break;
+
+ case OBJ_FM_GROUPBOX:
+ sServiceSpecifier = FM_COMPONENT_GROUPBOX;
+ break;
+
+ case OBJ_FM_COMBOBOX:
+ sServiceSpecifier = FM_COMPONENT_COMBOBOX;
+ break;
+
+ case OBJ_FM_GRID:
+ sServiceSpecifier = FM_COMPONENT_GRID;
+ break;
+
+ case OBJ_FM_IMAGEBUTTON:
+ sServiceSpecifier = FM_COMPONENT_IMAGEBUTTON;
+ break;
+
+ case OBJ_FM_FILECONTROL:
+ sServiceSpecifier = FM_COMPONENT_FILECONTROL;
+ break;
+
+ case OBJ_FM_DATEFIELD:
+ sServiceSpecifier = FM_COMPONENT_DATEFIELD;
+ break;
+
+ case OBJ_FM_TIMEFIELD:
+ sServiceSpecifier = FM_COMPONENT_TIMEFIELD;
+ aInitialProperties.push_back( PropertyValueArray::value_type( FM_PROP_TIMEMAX, makeAny( (sal_Int32)( Time( 23, 59, 59, 99 ).GetTime() ) ) ) );
+ break;
+
+ case OBJ_FM_NUMERICFIELD:
+ sServiceSpecifier = FM_COMPONENT_NUMERICFIELD;
+ break;
+
+ case OBJ_FM_CURRENCYFIELD:
+ sServiceSpecifier = FM_COMPONENT_CURRENCYFIELD;
+ break;
+
+ case OBJ_FM_PATTERNFIELD:
+ sServiceSpecifier = FM_COMPONENT_PATTERNFIELD;
+ break;
+
+ case OBJ_FM_HIDDEN:
+ sServiceSpecifier = FM_COMPONENT_HIDDEN;
+ break;
+
+ case OBJ_FM_IMAGECONTROL:
+ sServiceSpecifier = FM_COMPONENT_IMAGECONTROL;
+ break;
+
+ case OBJ_FM_FORMATTEDFIELD:
+ sServiceSpecifier = FM_COMPONENT_FORMATTEDFIELD;
+ break;
+
+ case OBJ_FM_NAVIGATIONBAR:
+ sServiceSpecifier = FM_SUN_COMPONENT_NAVIGATIONBAR;
+ break;
+
+ case OBJ_FM_SCROLLBAR:
+ sServiceSpecifier = FM_SUN_COMPONENT_SCROLLBAR;
+ aInitialProperties.push_back( PropertyValueArray::value_type( FM_PROP_BORDER, makeAny( (sal_Int16)0 ) ) );
+ break;
+
+ case OBJ_FM_SPINBUTTON:
+ sServiceSpecifier = FM_SUN_COMPONENT_SPINBUTTON;
+ aInitialProperties.push_back( PropertyValueArray::value_type( FM_PROP_BORDER, makeAny( (sal_Int16)0 ) ) );
+ break;
+ }
+
+ // create the actual object
+ if ( sServiceSpecifier.getLength() )
+ pObjFactory->pNewObj = new FmFormObj( sServiceSpecifier, pObjFactory->nIdentifier );
+ else
+ pObjFactory->pNewObj = new FmFormObj( pObjFactory->nIdentifier );
+
+ // initialize some properties which we want to differ from the defaults
+ for ( PropertyValueArray::const_iterator aInitProp = aInitialProperties.begin();
+ aInitProp != aInitialProperties.end();
+ ++aInitProp
+ )
+ {
+ lcl_initProperty(
+ static_cast< FmFormObj* >( pObjFactory->pNewObj ),
+ aInitProp->first,
+ aInitProp->second
+ );
+ }
+ }
+
+ return 0;
+}
+
+
+
diff --git a/svx/source/form/fmpage.cxx b/svx/source/form/fmpage.cxx
new file mode 100644
index 000000000000..480bc5678eaf
--- /dev/null
+++ b/svx/source/form/fmpage.cxx
@@ -0,0 +1,282 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#define ENABLE_BYTESTRING_STREAM_OPERATORS
+#include <svx/fmpage.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+
+
+#include <svx/fmmodel.hxx>
+
+#ifndef SVX_LIGHT
+#ifndef _SVX_FMOBJ_HXX
+#include "fmobj.hxx"
+#endif
+#endif
+
+#ifndef SVX_LIGHT
+#ifndef _SVX_FMRESIDS_HRC
+#include "svx/fmresids.hrc"
+#endif
+#endif
+#include <tools/shl.hxx>
+#include <svx/dialmgr.hxx>
+
+#ifndef SVX_LIGHT
+#ifndef _SVX_FMPGEIMP_HXX
+#include "fmpgeimp.hxx"
+#endif
+#endif
+
+#ifndef SVX_LIGHT
+#ifndef _SFX_OBJSH_HXX //autogen
+#include <sfx2/objsh.hxx>
+#endif
+#endif
+#include "svx/svditer.hxx"
+#include <svx/svdview.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/help.hxx>
+
+
+#ifndef SVX_LIGHT
+#ifndef _SVX_FMGLOB_HXX
+#include <svx/fmglob.hxx>
+#endif
+#ifndef _SVX_FMPROP_HRC
+#include "fmprop.hrc"
+#endif
+#include "fmundo.hxx"
+#include "svx/fmtools.hxx"
+using namespace ::svxform;
+#endif
+#include <comphelper/property.hxx>
+#include <rtl/logfile.hxx>
+
+using com::sun::star::uno::Reference;
+using com::sun::star::uno::UNO_QUERY;
+using com::sun::star::container::XChild;
+using com::sun::star::container::XNameContainer;
+
+TYPEINIT1(FmFormPage, SdrPage);
+
+//------------------------------------------------------------------
+FmFormPage::FmFormPage(FmFormModel& rModel, StarBASIC* _pBasic, FASTBOOL bMasterPage)
+ :SdrPage(rModel, bMasterPage)
+#ifndef SVX_LIGHT
+ ,m_pImpl( new FmFormPageImpl( *this ) )
+#else
+ ,m_pImpl(NULL)
+#endif
+ ,m_pBasic(_pBasic)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmFormPage::FmFormPage" );
+}
+
+//------------------------------------------------------------------
+FmFormPage::FmFormPage(const FmFormPage& rPage)
+ :SdrPage(rPage)
+#ifndef SVX_LIGHT
+ ,m_pImpl(new FmFormPageImpl( *this, rPage.GetImpl() ) )
+#else
+ ,m_pImpl(NULL)
+#endif
+ ,m_pBasic(0)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmFormPage::FmFormPage" );
+ m_sPageName = rPage.m_sPageName;
+}
+
+//------------------------------------------------------------------
+FmFormPage::~FmFormPage()
+{
+#ifndef SVX_LIGHT
+ delete m_pImpl;
+#endif
+}
+
+//------------------------------------------------------------------
+void FmFormPage::SetModel(SdrModel* pNewModel)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmFormPage::SetModel" );
+ /* #35055# */
+ // we want to call the super's "SetModel" method even if the model is the
+ // same, in case code somewhere in the system depends on it. But our code
+ // doesn't, so get the old model to do a check.
+ SdrModel *pOldModel = GetModel();
+
+ SdrPage::SetModel( pNewModel );
+
+ /* #35055# */
+ if ( ( pOldModel != pNewModel ) && m_pImpl )
+ {
+ try
+ {
+ Reference< XNameContainer > xForms( m_pImpl->getForms( false ) );
+ if ( xForms.is() )
+ {
+ // we want to keep the current collection, just reset the model
+ // with which it's associated.
+ Reference< XChild > xAsChild( xForms, UNO_QUERY );
+ if ( xAsChild.is() )
+ {
+ FmFormModel* pDrawModel = (FmFormModel*) GetModel();
+ SfxObjectShell* pObjShell = pDrawModel->GetObjectShell();
+ if ( pObjShell )
+ xAsChild->setParent( pObjShell->GetModel() );
+ }
+ }
+ }
+ catch( ::com::sun::star::uno::Exception ex )
+ {
+ OSL_ENSURE( sal_False, "UNO Exception caught resetting model for m_pImpl (FmFormPageImpl) in FmFormPage::SetModel" );
+ }
+ }
+}
+
+//------------------------------------------------------------------
+SdrPage* FmFormPage::Clone() const
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmFormPage::Clone" );
+ return new FmFormPage(*this);
+ // hier fehlt noch ein kopieren der Objekte
+}
+
+//------------------------------------------------------------------
+void FmFormPage::InsertObject(SdrObject* pObj, sal_uLong nPos,
+ const SdrInsertReason* pReason)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmFormPage::InsertObject" );
+ SdrPage::InsertObject( pObj, nPos, pReason );
+#ifndef SVX_LIGHT
+ if (GetModel() && (!pReason || pReason->GetReason() != SDRREASON_STREAMING))
+ ((FmFormModel*)GetModel())->GetUndoEnv().Inserted(pObj);
+#endif
+}
+
+//------------------------------------------------------------------
+const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & FmFormPage::GetForms( bool _bForceCreate ) const
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmFormPage::GetForms" );
+#ifndef SVX_LIGHT
+ const SdrPage& rMasterPage( *this );
+ const FmFormPage* pFormPage = dynamic_cast< const FmFormPage* >( &rMasterPage );
+ OSL_ENSURE( pFormPage, "FmFormPage::GetForms: referenced page is no FmFormPage - is this allowed?!" );
+ if ( !pFormPage )
+ pFormPage = this;
+
+ return pFormPage->m_pImpl->getForms( _bForceCreate );
+#else
+ static ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > aRef;
+ return aRef;
+#endif
+}
+
+//------------------------------------------------------------------
+sal_Bool FmFormPage::RequestHelp( Window* pWindow, SdrView* pView,
+ const HelpEvent& rEvt )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmFormPage::RequestHelp" );
+#ifndef SVX_LIGHT
+ if( pView->IsAction() )
+ return sal_False;
+
+ Point aPos = rEvt.GetMousePosPixel();
+ aPos = pWindow->ScreenToOutputPixel( aPos );
+ aPos = pWindow->PixelToLogic( aPos );
+
+ SdrObject* pObj = NULL;
+ SdrPageView* pPV = NULL;
+ if ( !pView->PickObj( aPos, 0, pObj, pPV, SDRSEARCH_DEEP ) )
+ return sal_False;
+
+ FmFormObj* pFormObject = FmFormObj::GetFormObject( pObj );
+ if ( !pFormObject )
+ return sal_False;
+
+ UniString aHelpText;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xSet( pFormObject->GetUnoControlModel(), ::com::sun::star::uno::UNO_QUERY );
+ if (xSet.is())
+ {
+ if (::comphelper::hasProperty(FM_PROP_HELPTEXT, xSet))
+ aHelpText = ::comphelper::getString(xSet->getPropertyValue(FM_PROP_HELPTEXT)).getStr();
+
+ if (!aHelpText.Len() && ::comphelper::hasProperty(FM_PROP_TARGET_URL, xSet))
+ {
+ ::rtl::OUString aText = ::comphelper::getString(xSet->getPropertyValue(FM_PROP_TARGET_URL));
+ INetURLObject aUrl(aText);
+
+ // testen, ob es ein Protokoll-Typ ist, den ich anzeigen will
+ INetProtocol aProtocol = aUrl.GetProtocol();
+ static const INetProtocol s_aQuickHelpSupported[] =
+ { INET_PROT_FTP, INET_PROT_HTTP, INET_PROT_FILE, INET_PROT_MAILTO, INET_PROT_NEWS,
+ INET_PROT_HTTPS, INET_PROT_JAVASCRIPT, INET_PROT_IMAP, INET_PROT_POP3,
+ INET_PROT_VIM, INET_PROT_LDAP
+ };
+ for (sal_uInt16 i=0; i<sizeof(s_aQuickHelpSupported)/sizeof(s_aQuickHelpSupported[0]); ++i)
+ if (s_aQuickHelpSupported[i] == aProtocol)
+ {
+ aHelpText = INetURLObject::decode(aUrl.GetURLNoPass(), '%', INetURLObject::DECODE_UNAMBIGUOUS);
+ break;
+ }
+ }
+ }
+ if ( aHelpText.Len() != 0 )
+ {
+ // Hilfe anzeigen
+ Rectangle aItemRect = pObj->GetCurrentBoundRect();
+ aItemRect = pWindow->LogicToPixel( aItemRect );
+ Point aPt = pWindow->OutputToScreenPixel( aItemRect.TopLeft() );
+ aItemRect.Left() = aPt.X();
+ aItemRect.Top() = aPt.Y();
+ aPt = pWindow->OutputToScreenPixel( aItemRect.BottomRight() );
+ aItemRect.Right() = aPt.X();
+ aItemRect.Bottom() = aPt.Y();
+ if( rEvt.GetMode() == HELPMODE_BALLOON )
+ Help::ShowBalloon( pWindow, aItemRect.Center(), aItemRect, aHelpText);
+ else
+ Help::ShowQuickHelp( pWindow, aItemRect, aHelpText );
+ }
+#endif
+ return sal_True;
+}
+
+//------------------------------------------------------------------
+SdrObject* FmFormPage::RemoveObject(sal_uLong nObjNum)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmFormPage::RemoveObject" );
+ SdrObject* pObj = SdrPage::RemoveObject(nObjNum);
+#ifndef SVX_LIGHT
+ if (pObj && GetModel())
+ ((FmFormModel*)GetModel())->GetUndoEnv().Removed(pObj);
+#endif
+ return pObj;
+}
diff --git a/svx/source/form/fmpgeimp.cxx b/svx/source/form/fmpgeimp.cxx
new file mode 100644
index 000000000000..e239e982dd66
--- /dev/null
+++ b/svx/source/form/fmpgeimp.cxx
@@ -0,0 +1,739 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svx/svxerr.hxx"
+#include "fmpgeimp.hxx"
+#include "fmundo.hxx"
+#include "svx/fmtools.hxx"
+#include "fmprop.hrc"
+#include "fmservs.hxx"
+#include "fmobj.hxx"
+#include "formcontrolfactory.hxx"
+#include "svx/svditer.hxx"
+#include "svx/fmresids.hrc"
+#include "svx/dbtoolsclient.hxx"
+#include "treevisitor.hxx"
+
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/container/EnumerableMap.hpp>
+#include <com/sun/star/drawing/XControlShape.hpp>
+
+#include <sfx2/objsh.hxx>
+#include <svx/fmglob.hxx>
+#include <svx/fmpage.hxx>
+#include <svx/fmmodel.hxx>
+#include <tools/resid.hxx>
+#include <tools/diagnose_ex.h>
+#include <tools/shl.hxx>
+#include <vcl/stdtext.hxx>
+#include <svx/dialmgr.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/uno3.hxx>
+#include <comphelper/types.hxx>
+#include <unotools/streamwrap.hxx>
+#include <rtl/logfile.hxx>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::form;
+using ::com::sun::star::util::XCloneable;
+using ::com::sun::star::awt::XControlModel;
+using ::com::sun::star::container::XMap;
+using ::com::sun::star::container::EnumerableMap;
+using ::com::sun::star::drawing::XControlShape;
+using namespace ::svxform;
+
+DBG_NAME(FmFormPageImpl)
+//------------------------------------------------------------------------------
+FmFormPageImpl::FmFormPageImpl( FmFormPage& _rPage )
+ :m_rPage( _rPage )
+ ,m_bFirstActivation( sal_True )
+ ,m_bAttemptedFormCreation( false )
+ ,m_bInFind( false )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmFormPageImpl::FmFormPageImpl" );
+ DBG_CTOR(FmFormPageImpl,NULL);
+}
+
+//------------------------------------------------------------------------------
+namespace
+{
+ typedef Reference< XInterface > FormComponent;
+
+ class FormComponentInfo
+ {
+ public:
+ size_t childCount( const FormComponent& _component ) const
+ {
+ Reference< XIndexAccess > xContainer( _component, UNO_QUERY );
+ if ( xContainer.is() )
+ return xContainer->getCount();
+ return 0;
+ }
+
+ FormComponent getChild( const FormComponent& _component, size_t _index ) const
+ {
+ Reference< XIndexAccess > xContainer( _component, UNO_QUERY_THROW );
+ return FormComponent( xContainer->getByIndex( _index ), UNO_QUERY );
+ }
+ };
+
+ typedef ::std::pair< FormComponent, FormComponent > FormComponentPair;
+
+ class FormHierarchyComparator
+ {
+ public:
+ FormHierarchyComparator()
+ {
+ }
+
+ size_t childCount( const FormComponentPair& _components ) const
+ {
+ size_t lhsCount = m_aComponentInfo.childCount( _components.first );
+ size_t rhsCount = m_aComponentInfo.childCount( _components.second );
+ if ( lhsCount != rhsCount )
+ throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Found inconsistent form component hierarchies (1)!" ) ), NULL );
+ return lhsCount;
+ }
+
+ FormComponentPair getChild( const FormComponentPair& _components, size_t _index ) const
+ {
+ return FormComponentPair(
+ m_aComponentInfo.getChild( _components.first, _index ),
+ m_aComponentInfo.getChild( _components.second, _index )
+ );
+ }
+ private:
+ FormComponentInfo m_aComponentInfo;
+ };
+
+ typedef ::std::map< Reference< XControlModel >, Reference< XControlModel >, ::comphelper::OInterfaceCompare< XControlModel > > MapControlModels;
+
+ class FormComponentAssignment
+ {
+ public:
+ FormComponentAssignment( MapControlModels& _out_controlModelMap )
+ :m_rControlModelMap( _out_controlModelMap )
+ {
+ }
+
+ void process( const FormComponentPair& _component )
+ {
+ Reference< XControlModel > lhsControlModel( _component.first, UNO_QUERY );
+ Reference< XControlModel > rhsControlModel( _component.second, UNO_QUERY );
+ if ( lhsControlModel.is() != rhsControlModel.is() )
+ throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Found inconsistent form component hierarchies (2)!" ) ), NULL );
+
+ if ( lhsControlModel.is() )
+ m_rControlModelMap[ lhsControlModel ] = rhsControlModel;
+ }
+
+ private:
+ MapControlModels& m_rControlModelMap;
+ };
+}
+
+//------------------------------------------------------------------------------
+FmFormPageImpl::FmFormPageImpl( FmFormPage& _rPage, const FmFormPageImpl& rImpl )
+ :m_rPage( _rPage )
+ ,m_bFirstActivation( sal_True )
+ ,m_bAttemptedFormCreation( false )
+{
+ DBG_CTOR(FmFormPageImpl,NULL);
+
+ // clone the Forms collection
+ Reference< XCloneable > xCloneable( const_cast< FmFormPageImpl& >( rImpl ).getForms( false ), UNO_QUERY );
+ if ( !xCloneable.is() )
+ {
+ // great, nothing to do
+ OSL_ENSURE( !const_cast< FmFormPageImpl& >( rImpl ).getForms( false ).is(), "FmFormPageImpl::FmFormPageImpl: a non-cloneable forms container!?" );
+ return;
+ }
+ try
+ {
+ m_xForms.set( xCloneable->createClone(), UNO_QUERY_THROW );
+
+ // create a mapping between the original control models and their clones
+ MapControlModels aModelAssignment;
+
+ typedef TreeVisitor< FormComponentPair, FormHierarchyComparator, FormComponentAssignment > FormComponentVisitor;
+ FormComponentVisitor aVisitor = FormComponentVisitor( FormHierarchyComparator() );
+
+ FormComponentAssignment aAssignmentProcessor( aModelAssignment );
+ aVisitor.process( FormComponentPair( xCloneable, m_xForms ), aAssignmentProcessor );
+
+ // assign the cloned models to their SdrObjects
+ SdrObjListIter aForeignIter( rImpl.m_rPage );
+ SdrObjListIter aOwnIter( m_rPage );
+
+ OSL_ENSURE( aForeignIter.IsMore() == aOwnIter.IsMore(), "FmFormPageImpl::FmFormPageImpl: inconsistent number of objects (1)!" );
+ while ( aForeignIter.IsMore() && aOwnIter.IsMore() )
+ {
+ FmFormObj* pForeignObj = dynamic_cast< FmFormObj* >( aForeignIter.Next() );
+ FmFormObj* pOwnObj = dynamic_cast< FmFormObj* >( aOwnIter.Next() );
+
+ bool bForeignIsForm = pForeignObj && ( pForeignObj->GetObjInventor() == FmFormInventor );
+ bool bOwnIsForm = pOwnObj && ( pOwnObj->GetObjInventor() == FmFormInventor );
+
+ if ( bForeignIsForm != bOwnIsForm )
+ {
+ OSL_ENSURE( false, "FmFormPageImpl::FmFormPageImpl: inconsistent ordering of objects!" );
+ // don't attempt to do further assignments, something's completely messed up
+ break;
+ }
+ if ( !bForeignIsForm )
+ // no form control -> next round
+ continue;
+
+ Reference< XControlModel > xForeignModel( pForeignObj->GetUnoControlModel() );
+ OSL_ENSURE( xForeignModel.is(), "FmFormPageImpl::FmFormPageImpl: control shape without control!" );
+ if ( !xForeignModel.is() )
+ // the SdrObject does not have a UNO Control Model. This is pathological, but well ... So the cloned
+ // SdrObject will also not have a UNO Control Model.
+ continue;
+
+ OSL_ENSURE( !pOwnObj->GetUnoControlModel().is(), "FmFormPageImpl::FmFormPageImpl: there already is a control model for the target object!" );
+
+ MapControlModels::const_iterator assignment = aModelAssignment.find( xForeignModel );
+ OSL_ENSURE( assignment != aModelAssignment.end(), "FmFormPageImpl::FmFormPageImpl: no clone found for this model!" );
+ if ( assignment == aModelAssignment.end() )
+ // the source SdrObject has a model, but it is not part of the model hierarchy in rImpl.getForms().
+ // Pathological, too ...
+ continue;
+
+ pOwnObj->SetUnoControlModel( assignment->second );
+ }
+ OSL_ENSURE( aForeignIter.IsMore() == aOwnIter.IsMore(), "FmFormPageImpl::FmFormPageImpl: inconsistent number of objects (2)!" );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//------------------------------------------------------------------------------
+Reference< XMap > FmFormPageImpl::getControlToShapeMap()
+{
+ Reference< XMap > xControlShapeMap( m_aControlShapeMap.get(), UNO_QUERY );
+ if ( xControlShapeMap.is() )
+ return xControlShapeMap;
+
+ xControlShapeMap = impl_createControlShapeMap_nothrow();
+ m_aControlShapeMap = xControlShapeMap;
+ return xControlShapeMap;
+}
+
+//------------------------------------------------------------------------------
+namespace
+{
+ static void lcl_insertFormObject_throw( const FmFormObj& _object, const Reference< XMap >& _map )
+ {
+ // the control model
+ Reference< XControlModel > xControlModel( _object.GetUnoControlModel(), UNO_QUERY );
+ OSL_ENSURE( xControlModel.is(), "lcl_insertFormObject_throw: suspicious: no control model!" );
+ if ( !xControlModel.is() )
+ return;
+
+ Reference< XControlShape > xControlShape( const_cast< FmFormObj& >( _object ).getUnoShape(), UNO_QUERY );
+ OSL_ENSURE( xControlShape.is(), "lcl_insertFormObject_throw: suspicious: no control shape!" );
+ if ( !xControlShape.is() )
+ return;
+
+ _map->put( makeAny( xControlModel ), makeAny( xControlShape ) );
+ }
+
+ static void lcl_removeFormObject( const FmFormObj& _object, const Reference< XMap >& _map )
+ {
+ // the control model
+ Reference< XControlModel > xControlModel( _object.GetUnoControlModel(), UNO_QUERY );
+ OSL_ENSURE( xControlModel.is(), "lcl_removeFormObject: suspicious: no control model!" );
+ if ( !xControlModel.is() )
+ return;
+
+ #if OSL_DEBUG_LEVEL > 0
+ Any aOldAssignment =
+ #endif
+ _map->remove( makeAny( xControlModel ) );
+ OSL_ENSURE( aOldAssignment == makeAny( Reference< XControlShape >( const_cast< FmFormObj& >( _object ).getUnoShape(), UNO_QUERY ) ),
+ "lcl_removeFormObject: map was inconsistent!" );
+ }
+}
+
+//------------------------------------------------------------------------------
+Reference< XMap > FmFormPageImpl::impl_createControlShapeMap_nothrow()
+{
+ Reference< XMap > xMap;
+
+ try
+ {
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ xMap.set( EnumerableMap::create( aContext.getUNOContext(),
+ ::cppu::UnoType< XControlModel >::get(),
+ ::cppu::UnoType< XControlShape >::get()
+ ).get(), UNO_SET_THROW );
+
+ SdrObjListIter aPageIter( m_rPage );
+ while ( aPageIter.IsMore() )
+ {
+ // only FmFormObjs are what we're interested in
+ FmFormObj* pCurrent = FmFormObj::GetFormObject( aPageIter.Next() );
+ if ( !pCurrent )
+ continue;
+
+ lcl_insertFormObject_throw( *pCurrent, xMap );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return xMap;
+}
+
+//------------------------------------------------------------------------------
+const Reference< XNameContainer >& FmFormPageImpl::getForms( bool _bForceCreate )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmFormPageImpl::getForms" );
+ if ( m_xForms.is() || !_bForceCreate )
+ return m_xForms;
+
+ if ( !m_bAttemptedFormCreation )
+ {
+ m_bAttemptedFormCreation = true;
+
+ const ::rtl::OUString sFormsCollectionServiceName = ::rtl::OUString::createFromAscii("com.sun.star.form.Forms");
+ m_xForms = Reference< XNameContainer > (
+ ::comphelper::getProcessServiceFactory()->createInstance( sFormsCollectionServiceName ),
+ UNO_QUERY
+ );
+ DBG_ASSERT( m_xForms.is(), "FmFormPageImpl::getForms: could not create a forms collection!" );
+
+ if ( m_aFormsCreationHdl.IsSet() )
+ {
+ m_aFormsCreationHdl.Call( this );
+ }
+
+ FmFormModel* pFormsModel = PTR_CAST( FmFormModel, m_rPage.GetModel() );
+
+ // give the newly created collection a place in the universe
+ Reference< XChild > xAsChild( m_xForms, UNO_QUERY );
+ if ( xAsChild.is() )
+ {
+ SfxObjectShell* pObjShell = pFormsModel ? pFormsModel->GetObjectShell() : NULL;
+ if ( pObjShell )
+ xAsChild->setParent( pObjShell->GetModel() );
+ }
+
+ // tell the UNDO environment that we have a new forms collection
+ if ( pFormsModel )
+ pFormsModel->GetUndoEnv().AddForms( m_xForms );
+ }
+ return m_xForms;
+}
+
+//------------------------------------------------------------------------------
+FmFormPageImpl::~FmFormPageImpl()
+{
+ xCurrentForm = NULL;
+
+ ::comphelper::disposeComponent( m_xForms );
+ DBG_DTOR(FmFormPageImpl,NULL);
+}
+
+//------------------------------------------------------------------------------
+bool FmFormPageImpl::validateCurForm()
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmFormPageImpl::validateCurForm" );
+ if ( !xCurrentForm.is() )
+ return false;
+
+ Reference< XChild > xAsChild( xCurrentForm, UNO_QUERY );
+ DBG_ASSERT( xAsChild.is(), "FmFormPageImpl::validateCurForm: a form which is no child??" );
+ if ( !xAsChild.is() || !xAsChild->getParent().is() )
+ xCurrentForm.clear();
+
+ return xCurrentForm.is();
+}
+
+//------------------------------------------------------------------------------
+void FmFormPageImpl::setCurForm(Reference< ::com::sun::star::form::XForm > xForm)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmFormPageImpl::setCurForm" );
+ xCurrentForm = xForm;
+}
+
+//------------------------------------------------------------------------------
+Reference< XForm > FmFormPageImpl::getDefaultForm()
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmFormPageImpl::getDefaultForm" );
+ Reference< XForm > xForm;
+
+ Reference< XNameContainer > xForms( getForms() );
+
+ // by default, we use our "current form"
+ if ( !validateCurForm() )
+ {
+ // check whether there is a "standard" form
+ if ( xForms->hasElements() )
+ {
+ // suche die Standardform
+ ::rtl::OUString sStandardFormname = String( SVX_RES( RID_STR_STDFORMNAME ) );
+
+ try
+ {
+ if ( xForms->hasByName( sStandardFormname ) )
+ xForm.set( xForms->getByName( sStandardFormname ), UNO_QUERY_THROW );
+ else
+ {
+ Reference< XIndexAccess > xFormsByIndex( xForms, UNO_QUERY_THROW );
+ xForm.set( xFormsByIndex->getByIndex(0), UNO_QUERY_THROW );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+ else
+ {
+ xForm = xCurrentForm;
+ }
+
+ // did not find an existing suitable form -> create a new one
+ if ( !xForm.is() )
+ {
+ SdrModel* pModel = m_rPage.GetModel();
+
+ if( pModel->IsUndoEnabled() )
+ {
+ XubString aStr(SVX_RES(RID_STR_FORM));
+ XubString aUndoStr(SVX_RES(RID_STR_UNDO_CONTAINER_INSERT));
+ aUndoStr.SearchAndReplace('#', aStr);
+ pModel->BegUndo(aUndoStr);
+ }
+
+ try
+ {
+ xForm.set( ::comphelper::getProcessServiceFactory()->createInstance( FM_SUN_COMPONENT_FORM ), UNO_QUERY );
+
+ // a form should always have the command type table as default
+ Reference< XPropertySet > xFormProps( xForm, UNO_QUERY_THROW );
+ xFormProps->setPropertyValue( FM_PROP_COMMANDTYPE, makeAny( sal_Int32( CommandType::TABLE ) ) );
+
+ // and the "Standard" name
+ ::rtl::OUString sName = String( SVX_RES( RID_STR_STDFORMNAME ) );
+ xFormProps->setPropertyValue( FM_PROP_NAME, makeAny( sName ) );
+
+ Reference< XIndexContainer > xContainer( xForms, UNO_QUERY );
+ if( pModel->IsUndoEnabled() )
+ {
+ pModel->AddUndo(new FmUndoContainerAction(*(FmFormModel*)pModel,
+ FmUndoContainerAction::Inserted,
+ xContainer,
+ xForm,
+ xContainer->getCount()));
+ }
+ xForms->insertByName( sName, makeAny( xForm ) );
+ xCurrentForm = xForm;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ xForm.clear();
+ }
+
+ if( pModel->IsUndoEnabled() )
+ pModel->EndUndo();
+ }
+
+ return xForm;
+}
+
+//------------------------------------------------------------------------------
+Reference< ::com::sun::star::form::XForm > FmFormPageImpl::findPlaceInFormComponentHierarchy(
+ const Reference< XFormComponent > & rContent, const Reference< XDataSource > & rDatabase,
+ const ::rtl::OUString& rDBTitle, const ::rtl::OUString& rCursorSource, sal_Int32 nCommandType )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmFormPageImpl::findPlaceInFormComponentHierarchy" );
+ // if the control already is child of a form, don't do anything
+ if (!rContent.is() || rContent->getParent().is())
+ return NULL;
+
+ Reference< XForm > xForm;
+
+ // Wenn Datenbank und CursorSource gesetzt sind, dann wird
+ // die Form anhand dieser Kriterien gesucht, ansonsten nur aktuelle
+ // und die StandardForm
+ if (rDatabase.is() && rCursorSource.getLength())
+ {
+ validateCurForm();
+
+ // erst in der aktuellen form suchen
+ xForm = findFormForDataSource( xCurrentForm, rDatabase, rCursorSource, nCommandType );
+
+ Reference< ::com::sun::star::container::XIndexAccess > xFormsByIndex( getForms(), UNO_QUERY );
+ DBG_ASSERT(xFormsByIndex.is(), "FmFormPageImpl::findPlaceInFormComponentHierarchy : no index access for my forms collection !");
+ sal_Int32 nCount = xFormsByIndex->getCount();
+ for (sal_Int32 i = 0; !xForm.is() && i < nCount; i++)
+ {
+ Reference< ::com::sun::star::form::XForm > xToSearch;
+ xFormsByIndex->getByIndex(i) >>= xToSearch;
+ xForm = findFormForDataSource( xToSearch, rDatabase, rCursorSource, nCommandType );
+ }
+
+ // wenn keine ::com::sun::star::form gefunden, dann eine neue erzeugen
+ if (!xForm.is())
+ {
+ SdrModel* pModel = m_rPage.GetModel();
+
+ const bool bUndo = pModel->IsUndoEnabled();
+
+ if( bUndo )
+ {
+ XubString aStr(SVX_RES(RID_STR_FORM));
+ XubString aUndoStr(SVX_RES(RID_STR_UNDO_CONTAINER_INSERT));
+ aUndoStr.SearchAndReplace('#', aStr);
+ pModel->BegUndo(aUndoStr);
+ }
+
+ xForm = Reference< ::com::sun::star::form::XForm >(::comphelper::getProcessServiceFactory()->createInstance(FM_SUN_COMPONENT_FORM), UNO_QUERY);
+ // a form should always have the command type table as default
+ Reference< ::com::sun::star::beans::XPropertySet > xFormProps(xForm, UNO_QUERY);
+ try { xFormProps->setPropertyValue(FM_PROP_COMMANDTYPE, makeAny(sal_Int32(CommandType::TABLE))); }
+ catch(Exception&) { }
+
+ if (rDBTitle.getLength())
+ xFormProps->setPropertyValue(FM_PROP_DATASOURCE,makeAny(rDBTitle));
+ else
+ {
+ Reference< ::com::sun::star::beans::XPropertySet > xDatabaseProps(rDatabase, UNO_QUERY);
+ Any aDatabaseUrl = xDatabaseProps->getPropertyValue(FM_PROP_URL);
+ xFormProps->setPropertyValue(FM_PROP_DATASOURCE, aDatabaseUrl);
+ }
+
+ xFormProps->setPropertyValue(FM_PROP_COMMAND,makeAny(rCursorSource));
+ xFormProps->setPropertyValue(FM_PROP_COMMANDTYPE, makeAny(nCommandType));
+
+ Reference< ::com::sun::star::container::XNameAccess > xNamedSet( getForms(), UNO_QUERY );
+
+ const bool bTableOrQuery = ( CommandType::TABLE == nCommandType ) || ( CommandType::QUERY == nCommandType );
+ ::rtl::OUString sName = FormControlFactory::getUniqueName( xNamedSet,
+ bTableOrQuery ? rCursorSource : ::rtl::OUString( String( SVX_RES( RID_STR_STDFORMNAME ) ) ) );
+
+ xFormProps->setPropertyValue( FM_PROP_NAME, makeAny( sName ) );
+
+ if( bUndo )
+ {
+ Reference< ::com::sun::star::container::XIndexContainer > xContainer( getForms(), UNO_QUERY );
+ pModel->AddUndo(new FmUndoContainerAction(*(FmFormModel*)pModel,
+ FmUndoContainerAction::Inserted,
+ xContainer,
+ xForm,
+ xContainer->getCount()));
+ }
+
+ getForms()->insertByName( sName, makeAny( xForm ) );
+
+ if( bUndo )
+ pModel->EndUndo();
+ }
+ xCurrentForm = xForm;
+ }
+
+ xForm = getDefaultForm();
+ return xForm;
+}
+
+//------------------------------------------------------------------------------
+Reference< XForm > FmFormPageImpl::findFormForDataSource(
+ const Reference< XForm > & rForm, const Reference< XDataSource > & _rxDatabase,
+ const ::rtl::OUString& _rCursorSource, sal_Int32 nCommandType)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmFormPageImpl::findFormForDataSource" );
+ Reference< XForm > xResultForm;
+ Reference< XRowSet > xDBForm(rForm, UNO_QUERY);
+ Reference< XPropertySet > xFormProps(rForm, UNO_QUERY);
+ if (!xDBForm.is() || !xFormProps.is())
+ return xResultForm;
+
+ OSL_ENSURE(_rxDatabase.is(), "FmFormPageImpl::findFormForDataSource: invalid data source!");
+ ::rtl::OUString sLookupName; // the name of the data source we're looking for
+ ::rtl::OUString sFormDataSourceName; // the name of the data source the current connection in the form is based on
+ try
+ {
+ Reference< XPropertySet > xDSProps(_rxDatabase, UNO_QUERY);
+ if (xDSProps.is())
+ xDSProps->getPropertyValue(FM_PROP_NAME) >>= sLookupName;
+
+ xFormProps->getPropertyValue(FM_PROP_DATASOURCE) >>= sFormDataSourceName;
+ // if there's no DataSourceName set at the form, check whether we can deduce one from its
+ // ActiveConnection
+ if (0 == sFormDataSourceName.getLength())
+ {
+ Reference< XConnection > xFormConnection;
+ xFormProps->getPropertyValue( FM_PROP_ACTIVE_CONNECTION ) >>= xFormConnection;
+ if ( !xFormConnection.is() )
+ OStaticDataAccessTools().isEmbeddedInDatabase( xFormProps, xFormConnection );
+ if (xFormConnection.is())
+ {
+ Reference< XChild > xConnAsChild(xFormConnection, UNO_QUERY);
+ if (xConnAsChild.is())
+ {
+ Reference< XDataSource > xFormDS(xConnAsChild->getParent(), UNO_QUERY);
+ if (xFormDS.is())
+ {
+ xDSProps = xDSProps.query(xFormDS);
+ if (xDSProps.is())
+ xDSProps->getPropertyValue(FM_PROP_NAME) >>= sFormDataSourceName;
+ }
+ }
+ }
+ }
+ }
+ catch(const Exception& e)
+ {
+ (void)e;
+ OSL_ENSURE(sal_False, "FmFormPageImpl::findFormForDataSource: caught an exception!");
+ }
+
+ if (sLookupName == sFormDataSourceName)
+ {
+ // jetzt noch ueberpruefen ob CursorSource und Type uebereinstimmen
+ ::rtl::OUString aCursorSource = ::comphelper::getString(xFormProps->getPropertyValue(FM_PROP_COMMAND));
+ sal_Int32 nType = ::comphelper::getINT32(xFormProps->getPropertyValue(FM_PROP_COMMANDTYPE));
+ if (!aCursorSource.getLength() || ((nType == nCommandType) && (aCursorSource == _rCursorSource))) // found the form
+ {
+ xResultForm = rForm;
+ // Ist noch keine Datenquelle gesetzt, wird dieses hier nachgeholt
+ if (!aCursorSource.getLength())
+ {
+ xFormProps->setPropertyValue(FM_PROP_COMMAND, makeAny(_rCursorSource));
+ xFormProps->setPropertyValue(FM_PROP_COMMANDTYPE, makeAny((sal_Int32)nCommandType));
+ }
+ }
+ }
+
+ // as long as xResultForm is NULL, search the child forms of rForm
+ Reference< XIndexAccess > xComponents(rForm, UNO_QUERY);
+ sal_Int32 nCount = xComponents->getCount();
+ for (sal_Int32 i = 0; !xResultForm.is() && i < nCount; ++i)
+ {
+ Reference< ::com::sun::star::form::XForm > xSearchForm;
+ xComponents->getByIndex(i) >>= xSearchForm;
+ // continue searching in the sub form
+ if (xSearchForm.is())
+ xResultForm = findFormForDataSource( xSearchForm, _rxDatabase, _rCursorSource, nCommandType );
+ }
+ return xResultForm;
+}
+
+//------------------------------------------------------------------------------
+::rtl::OUString FmFormPageImpl::setUniqueName(const Reference< XFormComponent > & xFormComponent, const Reference< XForm > & xControls)
+{
+#if OSL_DEBUG_LEVEL > 0
+ try
+ {
+ Reference< XChild > xChild( xFormComponent, UNO_QUERY_THROW );
+ OSL_ENSURE( !xChild->getParent().is(), "FmFormPageImpl::setUniqueName: to be called before insertion!" );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+#endif
+ ::rtl::OUString sName;
+ Reference< ::com::sun::star::beans::XPropertySet > xSet(xFormComponent, UNO_QUERY);
+ if (xSet.is())
+ {
+ sName = ::comphelper::getString( xSet->getPropertyValue( FM_PROP_NAME ) );
+ Reference< ::com::sun::star::container::XNameAccess > xNameAcc(xControls, UNO_QUERY);
+
+ if (!sName.getLength() || xNameAcc->hasByName(sName))
+ {
+ // setzen eines default Namens ueber die ClassId
+ sal_Int16 nClassId( FormComponentType::CONTROL );
+ xSet->getPropertyValue( FM_PROP_CLASSID ) >>= nClassId;
+
+ ::rtl::OUString sDefaultName = FormControlFactory::getDefaultUniqueName_ByComponentType(
+ Reference< XNameAccess >( xControls, UNO_QUERY ), xSet );
+
+ // bei Radiobuttons, die einen Namen haben, diesen nicht ueberschreiben!
+ if (!sName.getLength() || nClassId != ::com::sun::star::form::FormComponentType::RADIOBUTTON)
+ {
+ xSet->setPropertyValue(FM_PROP_NAME, makeAny(sDefaultName));
+ }
+
+ sName = sDefaultName;
+ }
+ }
+ return sName;
+}
+
+//------------------------------------------------------------------
+void FmFormPageImpl::formObjectInserted( const FmFormObj& _object )
+{
+ Reference< XMap > xControlShapeMap( m_aControlShapeMap.get(), UNO_QUERY );
+ if ( !xControlShapeMap.is() )
+ // our map does not exist -> not interested in this event
+ return;
+
+ try
+ {
+ lcl_insertFormObject_throw( _object, xControlShapeMap );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+void FmFormPageImpl::formObjectRemoved( const FmFormObj& _object )
+{
+ Reference< XMap > xControlShapeMap( m_aControlShapeMap.get(), UNO_QUERY );
+ if ( !xControlShapeMap.is() )
+ // our map does not exist -> not interested in this event
+ return;
+
+ try
+ {
+ lcl_removeFormObject( _object, xControlShapeMap );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
diff --git a/svx/source/form/fmscriptingenv.cxx b/svx/source/form/fmscriptingenv.cxx
new file mode 100644
index 000000000000..3e8aa88a2612
--- /dev/null
+++ b/svx/source/form/fmscriptingenv.cxx
@@ -0,0 +1,522 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "fmscriptingenv.hxx"
+#include "svx/fmmodel.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/script/XScriptListener.hpp>
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+/** === end UNO includes === **/
+
+#include <tools/diagnose_ex.h>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/implementationreference.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/processfactory.hxx>
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/app.hxx>
+#include <basic/basmgr.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::script::XEventAttacherManager;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::script::XScriptListener;
+ using ::com::sun::star::script::ScriptEvent;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::reflection::InvocationTargetException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::container::XHierarchicalNameAccess;
+ using ::com::sun::star::reflection::XInterfaceMethodTypeDescription;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::lang::DisposedException;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::XInterface;
+ /** === end UNO using === **/
+
+ class FormScriptingEnvironment;
+
+ //====================================================================
+ //= FormScriptListener
+ //====================================================================
+ typedef ::cppu::WeakImplHelper1 < XScriptListener
+ > FormScriptListener_Base;
+
+ /** implements the XScriptListener interface, is used by FormScriptingEnvironment
+ */
+ class FormScriptListener :public FormScriptListener_Base
+ {
+ private:
+ ::osl::Mutex m_aMutex;
+ ::rtl::Reference< FormScriptingEnvironment > m_pScriptExecutor;
+
+ public:
+ FormScriptListener( const ::rtl::Reference< FormScriptingEnvironment >& _pScriptExecutor );
+
+ // XScriptListener
+ virtual void SAL_CALL firing( const ScriptEvent& aEvent ) throw (RuntimeException);
+ virtual Any SAL_CALL approveFiring( const ScriptEvent& aEvent ) throw (InvocationTargetException, RuntimeException);
+ // XEventListener
+ virtual void SAL_CALL disposing( const EventObject& Source ) throw (RuntimeException);
+
+ // lifetime control
+ void SAL_CALL dispose();
+
+ protected:
+ ~FormScriptListener();
+
+ private:
+ /** determines whether calling a given method at a given listener interface can be done asynchronously
+
+ @param _rListenerType
+ the name of the UNO type whose method is to be checked
+ @param _rMethodName
+ the name of the method at the interface determined by _rListenerType
+
+ @return
+ <TRUE/> if and only if the method is declared <code>oneway</code>, i.e. can be called asynchronously
+ */
+ bool impl_allowAsynchronousCall_nothrow( const ::rtl::OUString& _rListenerType, const ::rtl::OUString& _rMethodName ) const;
+
+ /** determines whether the instance is already disposed
+ */
+ bool impl_isDisposed_nothrow() const { return !m_pScriptExecutor.is(); }
+
+ /** fires the given script event in a thread-safe manner
+
+ This methods calls our script executor's doFireScriptEvent, with previously releasing the given mutex guard,
+ but ensuring that our script executor is not deleted between this release and the actual call.
+
+ @param _rGuard
+ a clearable guard to our mutex. Must be the only active guard to our mutex.
+ @param _rEvent
+ the event to fire
+ @param _pSyncronousResult
+ a place to take a possible result of the script call.
+
+ @precond
+ m_pScriptExecutor is not <NULL/>.
+ */
+ void impl_doFireScriptEvent_nothrow( ::osl::ClearableMutexGuard& _rGuard, const ScriptEvent& _rEvent, Any* _pSyncronousResult );
+
+ private:
+ DECL_LINK( OnAsyncScriptEvent, ScriptEvent* );
+ };
+
+ //====================================================================
+ //= FormScriptingEnvironment
+ //====================================================================
+ class FormScriptingEnvironment : public IFormScriptingEnvironment
+ {
+ private:
+ typedef ::comphelper::ImplementationReference< FormScriptListener, XScriptListener > ListenerImplementation;
+
+ private:
+ ::osl::Mutex m_aMutex;
+ oslInterlockedCount m_refCount;
+ ListenerImplementation m_pScriptListener;
+ FmFormModel& m_rFormModel;
+ bool m_bDisposed;
+
+ public:
+ FormScriptingEnvironment( FmFormModel& _rModel );
+ virtual ~FormScriptingEnvironment();
+
+ // callback for FormScriptListener
+ void doFireScriptEvent( const ScriptEvent& _rEvent, Any* _pSyncronousResult );
+
+ // IFormScriptingEnvironment
+ virtual void registerEventAttacherManager( const Reference< XEventAttacherManager >& _rxManager );
+ virtual void revokeEventAttacherManager( const Reference< XEventAttacherManager >& _rxManager );
+ virtual void dispose();
+
+ // IReference
+ virtual oslInterlockedCount SAL_CALL acquire();
+ virtual oslInterlockedCount SAL_CALL release();
+
+ private:
+ void impl_registerOrRevoke_throw( const Reference< XEventAttacherManager >& _rxManager, bool _bRegister );
+
+ private:
+ FormScriptingEnvironment(); // never implemented
+ FormScriptingEnvironment( const FormScriptingEnvironment& ); // never implemented
+ FormScriptingEnvironment& operator=( const FormScriptingEnvironment& ); // never implemented
+ };
+
+ //====================================================================
+ //= FormScriptListener
+ //====================================================================
+ //--------------------------------------------------------------------
+ FormScriptListener::FormScriptListener( const ::rtl::Reference< FormScriptingEnvironment >& _pScriptExecutor )
+ :m_pScriptExecutor( _pScriptExecutor )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ FormScriptListener::~FormScriptListener()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ bool FormScriptListener::impl_allowAsynchronousCall_nothrow( const ::rtl::OUString& _rListenerType, const ::rtl::OUString& _rMethodName ) const
+ {
+ bool bAllowAsynchronousCall = false;
+ try
+ {
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ Reference< XHierarchicalNameAccess > xTypeDescriptions( aContext.getSingleton( "com.sun.star.reflection.theTypeDescriptionManager" ), UNO_QUERY_THROW );
+
+ ::rtl::OUString sMethodDescription( _rListenerType );
+ sMethodDescription += ::rtl::OUString::createFromAscii( "::" );
+ sMethodDescription += _rMethodName;
+
+ Reference< XInterfaceMethodTypeDescription > xMethod( xTypeDescriptions->getByHierarchicalName( sMethodDescription ), UNO_QUERY_THROW );
+ bAllowAsynchronousCall = xMethod->isOneway();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return bAllowAsynchronousCall;
+ }
+
+ //--------------------------------------------------------------------
+ void FormScriptListener::impl_doFireScriptEvent_nothrow( ::osl::ClearableMutexGuard& _rGuard, const ScriptEvent& _rEvent, Any* _pSyncronousResult )
+ {
+ OSL_PRECOND( m_pScriptExecutor.is(), "FormScriptListener::impl_doFireScriptEvent_nothrow: this will crash!" );
+
+ ::rtl::Reference< FormScriptingEnvironment > pExecutor( m_pScriptExecutor );
+ _rGuard.clear();
+ pExecutor->doFireScriptEvent( _rEvent, _pSyncronousResult );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL FormScriptListener::firing( const ScriptEvent& _rEvent ) throw (RuntimeException)
+ {
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+ static const ::rtl::OUString vbaInterOp =
+ ::rtl::OUString::createFromAscii("VBAInterop");
+ if ( _rEvent.ScriptType.equals(vbaInterOp) )
+ return; // not handled here
+
+ if ( impl_isDisposed_nothrow() )
+ return;
+
+ if ( !impl_allowAsynchronousCall_nothrow( _rEvent.ListenerType.getTypeName(), _rEvent.MethodName ) )
+ {
+ impl_doFireScriptEvent_nothrow( aGuard, _rEvent, NULL );
+ return;
+ }
+
+ acquire();
+ Application::PostUserEvent( LINK( this, FormScriptListener, OnAsyncScriptEvent ), new ScriptEvent( _rEvent ) );
+ }
+
+ //--------------------------------------------------------------------
+ Any SAL_CALL FormScriptListener::approveFiring( const ScriptEvent& _rEvent ) throw (InvocationTargetException, RuntimeException)
+ {
+ Any aResult;
+
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+ if ( !impl_isDisposed_nothrow() )
+ impl_doFireScriptEvent_nothrow( aGuard, _rEvent, &aResult );
+
+ return aResult;
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL FormScriptListener::disposing( const EventObject& /*Source*/ ) throw (RuntimeException)
+ {
+ // not interested in
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL FormScriptListener::dispose()
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ m_pScriptExecutor = NULL;
+ }
+
+ //--------------------------------------------------------------------
+ IMPL_LINK( FormScriptListener, OnAsyncScriptEvent, ScriptEvent*, _pEvent )
+ {
+ OSL_PRECOND( _pEvent != NULL, "FormScriptListener::OnAsyncScriptEvent: invalid event!" );
+ if ( !_pEvent )
+ return 1L;
+
+ {
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+
+ if ( !impl_isDisposed_nothrow() )
+ impl_doFireScriptEvent_nothrow( aGuard, *_pEvent, NULL );
+ }
+
+ delete _pEvent;
+ // we acquired ourself immediately before posting the event
+ release();
+ return 0L;
+ }
+
+ //====================================================================
+ //= FormScriptingEnvironment
+ //====================================================================
+ //--------------------------------------------------------------------
+ FormScriptingEnvironment::FormScriptingEnvironment( FmFormModel& _rModel )
+ :m_refCount( 0 )
+ ,m_pScriptListener( NULL )
+ ,m_rFormModel( _rModel )
+ ,m_bDisposed( false )
+ {
+ m_pScriptListener = ListenerImplementation( new FormScriptListener( this ) );
+ // note that this is a cyclic reference between the FormScriptListener and the FormScriptingEnvironment
+ // This cycle is broken up when our instance is disposed.
+ }
+
+ //--------------------------------------------------------------------
+ FormScriptingEnvironment::~FormScriptingEnvironment()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ void FormScriptingEnvironment::impl_registerOrRevoke_throw( const Reference< XEventAttacherManager >& _rxManager, bool _bRegister )
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !_rxManager.is() )
+ throw IllegalArgumentException();
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ try
+ {
+ if ( _bRegister )
+ _rxManager->addScriptListener( m_pScriptListener.getRef() );
+ else
+ _rxManager->removeScriptListener( m_pScriptListener.getRef() );
+ }
+ catch( const RuntimeException& ) { throw; }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void FormScriptingEnvironment::registerEventAttacherManager( const Reference< XEventAttacherManager >& _rxManager )
+ {
+ impl_registerOrRevoke_throw( _rxManager, true );
+ }
+
+ //--------------------------------------------------------------------
+ void FormScriptingEnvironment::revokeEventAttacherManager( const Reference< XEventAttacherManager >& _rxManager )
+ {
+ impl_registerOrRevoke_throw( _rxManager, false );
+ }
+
+ //--------------------------------------------------------------------
+ oslInterlockedCount SAL_CALL FormScriptingEnvironment::acquire()
+ {
+ return osl_incrementInterlockedCount( &m_refCount );
+ }
+
+ //--------------------------------------------------------------------
+ oslInterlockedCount SAL_CALL FormScriptingEnvironment::release()
+ {
+ if ( 0 == osl_decrementInterlockedCount( &m_refCount ) )
+ {
+ delete this;
+ return 0;
+ }
+ return m_refCount;
+ }
+
+ //--------------------------------------------------------------------
+ IFormScriptingEnvironment::~IFormScriptingEnvironment()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ namespace
+ {
+ //................................................................
+ //. NewStyleUNOScript
+ //................................................................
+ class SAL_NO_VTABLE IScript
+ {
+ public:
+ virtual void invoke( const Sequence< Any >& _rArguments, Any& _rSynchronousResult ) = 0;
+
+ virtual ~IScript() { }
+ };
+ typedef ::boost::shared_ptr< IScript > PScript;
+
+ //................................................................
+ //. NewStyleUNOScript
+ //................................................................
+ class NewStyleUNOScript : public IScript
+ {
+ SfxObjectShell& m_rObjectShell;
+ const ::rtl::OUString m_sScriptCode;
+
+ public:
+ NewStyleUNOScript( SfxObjectShell& _rObjectShell, const ::rtl::OUString& _rScriptCode )
+ :m_rObjectShell( _rObjectShell )
+ ,m_sScriptCode( _rScriptCode )
+ {
+ }
+
+ // IScript
+ virtual void invoke( const Sequence< Any >& _rArguments, Any& _rSynchronousResult );
+ };
+
+ //................................................................
+ void NewStyleUNOScript::invoke( const Sequence< Any >& _rArguments, Any& _rSynchronousResult )
+ {
+ Sequence< sal_Int16 > aOutArgsIndex;
+ Sequence< Any > aOutArgs;
+
+ m_rObjectShell.CallXScript( m_sScriptCode, _rArguments, _rSynchronousResult, aOutArgsIndex, aOutArgs );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void FormScriptingEnvironment::doFireScriptEvent( const ScriptEvent& _rEvent, Any* _pSyncronousResult )
+ {
+ ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+
+ if ( m_bDisposed )
+ return;
+
+ // SfxObjectShellRef is good here since the model controls the lifetime of the object
+ SfxObjectShellRef xObjectShell = m_rFormModel.GetObjectShell();
+ if( !xObjectShell.Is() )
+ return;
+
+ // the script to execute
+ PScript pScript;
+
+ if ( !_rEvent.ScriptType.equalsAscii( "StarBasic" ) )
+ {
+ pScript.reset( new NewStyleUNOScript( *xObjectShell, _rEvent.ScriptCode ) );
+ }
+ else
+ {
+ ::rtl::OUString sScriptCode = _rEvent.ScriptCode;
+ ::rtl::OUString sMacroLocation;
+
+ // is there a location in the script name ("application" or "document")?
+ sal_Int32 nPrefixLen = sScriptCode.indexOf( ':' );
+ DBG_ASSERT( 0 <= nPrefixLen, "FormScriptingEnvironment::doFireScriptEvent: Basic script name in old format encountered!" );
+
+ if ( 0 <= nPrefixLen )
+ {
+ // and it has such a prefix
+ sMacroLocation = sScriptCode.copy( 0, nPrefixLen );
+ DBG_ASSERT( 0 == sMacroLocation.compareToAscii( "document" )
+ || 0 == sMacroLocation.compareToAscii( "application" ),
+ "FormScriptingEnvironment::doFireScriptEvent: invalid (unknown) prefix!" );
+
+ // strip the prefix: the SfxObjectShell::CallScript knows nothing about such prefixes
+ sScriptCode = sScriptCode.copy( nPrefixLen + 1 );
+ }
+
+ if ( !sMacroLocation.getLength() )
+ {
+ // legacy format: use the app-wide Basic, if it has a respective method, otherwise fall back to the doc's Basic
+ if ( SFX_APP()->GetBasicManager()->HasMacro( sScriptCode ) )
+ sMacroLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "application" ) );
+ else
+ sMacroLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "document" ) );
+ }
+
+ ::rtl::OUStringBuffer aScriptURI;
+ aScriptURI.appendAscii( "vnd.sun.star.script:" );
+ aScriptURI.append( sScriptCode );
+ aScriptURI.appendAscii( "?language=Basic" );
+ aScriptURI.appendAscii( "&location=" );
+ aScriptURI.append( sMacroLocation );
+
+ const ::rtl::OUString sScriptURI( aScriptURI.makeStringAndClear() );
+ pScript.reset( new NewStyleUNOScript( *xObjectShell, sScriptURI ) );
+ }
+
+ OSL_ENSURE( pScript.get(), "FormScriptingEnvironment::doFireScriptEvent: no script to execute!" );
+ if ( !pScript.get() )
+ // this is an internal error in the above code
+ throw RuntimeException();
+
+ aGuard.clear();
+ aSolarGuard.clear();
+
+ Any aIgnoreResult;
+ pScript->invoke( _rEvent.Arguments, _pSyncronousResult ? *_pSyncronousResult : aIgnoreResult );
+ pScript.reset();
+
+ {
+ // object shells are not thread safe, so guard the destruction
+ ::vos::OGuard aSolarGuarsReset( Application::GetSolarMutex() );
+ xObjectShell = NULL;
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void FormScriptingEnvironment::dispose()
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ m_bDisposed = true;
+ m_pScriptListener->dispose();
+ }
+
+ //--------------------------------------------------------------------
+ PFormScriptingEnvironment createDefaultFormScriptingEnvironment( FmFormModel& _rModel )
+ {
+ return new FormScriptingEnvironment( _rModel );
+ }
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
diff --git a/svx/source/form/fmservs.cxx b/svx/source/form/fmservs.cxx
new file mode 100644
index 000000000000..1018f0834337
--- /dev/null
+++ b/svx/source/form/fmservs.cxx
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <com/sun/star/container/XSet.hpp>
+#include <cppuhelper/factory.hxx>
+#include <comphelper/processfactory.hxx>
+#include "fmservs.hxx"
+
+// ------------------------------------------------------------------------
+#define DECL_SERVICE(ImplName) \
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ImplName##_NewInstance_Impl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &) throw( ::com::sun::star::uno::Exception );
+
+#define REGISTER_SERVICE(ImplName, ServiceName) \
+ sString = (ServiceName); \
+ xSingleFactory = ::cppu::createSingleFactory(xServiceFactory, \
+ ::rtl::OUString(), ImplName##_NewInstance_Impl, \
+ ::com::sun::star::uno::Sequence< ::rtl::OUString>(&sString, 1)); \
+ if (xSingleFactory.is()) \
+ xSet->insert(::com::sun::star::uno::makeAny(xSingleFactory));
+
+
+ DECL_SERVICE( FmXGridControl )
+ DECL_SERVICE( FormController )
+ DECL_SERVICE( LegacyFormController )
+
+
+// ------------------------------------------------------------------------
+namespace svxform
+{
+
+#define DECL_SELFAWARE_SERVICE( ClassName ) \
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ClassName##_Create( \
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); \
+ ::rtl::OUString SAL_CALL ClassName##_GetImplementationName(); \
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL ClassName##_GetSupportedServiceNames(); \
+
+
+#define REGISTER_SELFAWARE_SERVICE( ClassName ) \
+ xSingleFactory = ::cppu::createSingleFactory( xServiceFactory, \
+ ClassName##_GetImplementationName(), \
+ ClassName##_Create, \
+ ClassName##_GetSupportedServiceNames() \
+ ); \
+ if ( xSingleFactory.is() ) \
+ xSet->insert( ::com::sun::star::uno::makeAny( xSingleFactory ) );
+
+
+ // ------------------------------------------------------------------------
+ DECL_SELFAWARE_SERVICE( OAddConditionDialog )
+
+ // ------------------------------------------------------------------------
+ void ImplSmartRegisterUnoServices()
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory(::comphelper::getProcessServiceFactory(), ::com::sun::star::uno::UNO_QUERY);
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XSet > xSet(xServiceFactory, ::com::sun::star::uno::UNO_QUERY);
+ if (!xSet.is())
+ return;
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aServices;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > xSingleFactory;
+
+ ::rtl::OUString sString;
+
+ // ------------------------------------------------------------------------
+ // FormController
+ REGISTER_SERVICE( FormController, FM_FORM_CONTROLLER );
+ REGISTER_SERVICE( LegacyFormController, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.FormController" ) ) );
+
+ // ------------------------------------------------------------------------
+ // FormController
+ REGISTER_SELFAWARE_SERVICE( OAddConditionDialog );
+
+ // ------------------------------------------------------------------------
+ // DBGridControl
+ REGISTER_SERVICE(FmXGridControl, FM_CONTROL_GRID); // compatibility
+ REGISTER_SERVICE(FmXGridControl, FM_CONTROL_GRIDCONTROL);
+ REGISTER_SERVICE(FmXGridControl, FM_SUN_CONTROL_GRIDCONTROL);
+ };
+
+} // namespace svxform
diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx
new file mode 100644
index 000000000000..112b47b1107e
--- /dev/null
+++ b/svx/source/form/fmshell.cxx
@@ -0,0 +1,1516 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "fmvwimp.hxx"
+#include <svx/fmshell.hxx>
+#include "svx/fmtools.hxx"
+#include "fmservs.hxx"
+#ifndef _SVX_FMPROP_HRC
+#include "fmprop.hrc"
+#endif
+#include "fmpgeimp.hxx"
+#include "fmitems.hxx"
+#include "fmundo.hxx"
+#include <vcl/waitobj.hxx>
+#include <com/sun/star/form/XLoadable.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#ifndef _COM_SUN_STAR_SDDB_PRIVILEGE_HPP_
+#include <com/sun/star/sdbcx/Privilege.hpp>
+#endif
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XFastPropertySet.hpp>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/awt/XTabControllerModel.hpp>
+#include <sfx2/viewfrm.hxx>
+#include <vcl/wrkwin.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/whiter.hxx>
+#include <sfx2/app.hxx>
+#include <svl/intitem.hxx>
+#include <svl/visitem.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <sfx2/objface.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objsh.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/fmpage.hxx>
+#include "svx/svditer.hxx"
+#include "fmobj.hxx"
+
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+
+#ifndef _SVX_FMRESIDS_HRC
+#include "svx/fmresids.hrc"
+#endif
+#include "fmexch.hxx"
+#include <svx/fmglob.hxx>
+#include <svl/eitem.hxx>
+#include <tools/shl.hxx>
+#include <tools/diagnose_ex.h>
+#include <svx/svdpage.hxx>
+#include <svx/fmmodel.hxx>
+#include <svx/dialmgr.hxx>
+#include "fmshimp.hxx"
+#include <svx/svdpagv.hxx>
+#include <sfx2/objitem.hxx>
+#include <sfx2/viewsh.hxx>
+#include <vcl/sound.hxx>
+#include "fmexpl.hxx"
+#include "formcontrolling.hxx"
+#include <svl/numuno.hxx>
+#include <connectivity/dbtools.hxx>
+#include <comphelper/types.hxx>
+#include <comphelper/processfactory.hxx>
+#include "fmdocumentclassification.hxx"
+#include "formtoolbars.hxx"
+
+#include <svx/svxdlg.hxx> //CHINA001
+#include <svx/dialogs.hrc> //CHINA001
+
+#include "svx/sdrobjectfilter.hxx"
+
+#define HANDLE_SQL_ERRORS( action, successflag, context, message ) \
+ try \
+ { \
+ successflag = sal_False; \
+ action; \
+ successflag = sal_True; \
+ } \
+ catch(::com::sun::star::sdbc::SQLException& e) \
+ { \
+ ::com::sun::star::sdb::SQLContext eExtendedInfo = \
+ GetImpl()->prependContextInfo(e, Reference< XInterface > (), context, ::rtl::OUString()); \
+ displayException(eExtendedInfo); \
+ } \
+ catch(Exception&) \
+ { \
+ DBG_ERROR(message); \
+ } \
+
+
+#define DO_SAFE_WITH_ERROR( action, message ) try { action; } catch(Exception&) { DBG_ERROR(message); }
+
+#define FmFormShell
+#include "svxslots.hxx"
+
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+#include "tbxform.hxx"
+#include <comphelper/property.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+// wird fuer Invalidate verwendet -> mitpflegen
+// aufsteigend sortieren !!!!!!
+sal_uInt16 ControllerSlotMap[] = // slots des Controllers
+{
+ SID_FM_CONFIG,
+ SID_FM_PUSHBUTTON,
+ SID_FM_RADIOBUTTON,
+ SID_FM_CHECKBOX,
+ SID_FM_FIXEDTEXT,
+ SID_FM_GROUPBOX,
+ SID_FM_EDIT,
+ SID_FM_LISTBOX,
+ SID_FM_COMBOBOX,
+ SID_FM_DBGRID,
+ SID_FM_IMAGEBUTTON,
+ SID_FM_FILECONTROL,
+ SID_FM_NAVIGATIONBAR,
+ SID_FM_CTL_PROPERTIES,
+ SID_FM_PROPERTIES,
+ SID_FM_TAB_DIALOG,
+ SID_FM_ADD_FIELD,
+ SID_FM_DESIGN_MODE,
+ SID_FM_SHOW_FMEXPLORER,
+ SID_FM_SHOW_PROPERTIES,
+ SID_FM_FMEXPLORER_CONTROL,
+ SID_FM_DATEFIELD,
+ SID_FM_TIMEFIELD,
+ SID_FM_NUMERICFIELD,
+ SID_FM_CURRENCYFIELD,
+ SID_FM_PATTERNFIELD,
+ SID_FM_OPEN_READONLY,
+ SID_FM_IMAGECONTROL,
+ SID_FM_USE_WIZARDS,
+ SID_FM_FORMATTEDFIELD,
+ SID_FM_FILTER_NAVIGATOR,
+ SID_FM_AUTOCONTROLFOCUS,
+ SID_FM_SCROLLBAR,
+ SID_FM_SPINBUTTON,
+ SID_FM_SHOW_DATANAVIGATOR,
+ SID_FM_DATANAVIGATOR_CONTROL,
+
+ 0
+};
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::form;
+using namespace ::com::sun::star::form::runtime;
+using namespace ::com::sun::star::frame;
+using namespace ::svxform;
+
+//========================================================================
+// class FmDesignModeChangedHint
+//========================================================================
+TYPEINIT1( FmDesignModeChangedHint, SfxHint );
+
+//------------------------------------------------------------------------
+FmDesignModeChangedHint::FmDesignModeChangedHint( sal_Bool bDesMode )
+ :m_bDesignMode( bDesMode )
+{
+}
+
+//------------------------------------------------------------------------
+FmDesignModeChangedHint::~FmDesignModeChangedHint()
+{
+}
+
+//========================================================================
+const sal_uInt32 FM_UI_FEATURE_SHOW_DATABASEBAR = 0x00000001;
+const sal_uInt32 FM_UI_FEATURE_SHOW_FIELD = 0x00000002;
+const sal_uInt32 FM_UI_FEATURE_SHOW_PROPERTIES = 0x00000004;
+const sal_uInt32 FM_UI_FEATURE_SHOW_EXPLORER = 0x00000008;
+const sal_uInt32 FM_UI_FEATURE_SHOW_FILTERBAR = 0x00000010;
+const sal_uInt32 FM_UI_FEATURE_SHOW_FILTERNAVIGATOR = 0x00000020;
+const sal_uInt32 FM_UI_FEATURE_SHOW_TEXT_CONTROL_BAR = 0x00000040;
+const sal_uInt32 FM_UI_FEATURE_TB_CONTROLS = 0x00000080;
+const sal_uInt32 FM_UI_FEATURE_TB_MORECONTROLS = 0x00000100;
+const sal_uInt32 FM_UI_FEATURE_TB_FORMDESIGN = 0x00000200;
+const sal_uInt32 FM_UI_FEATURE_SHOW_DATANAVIGATOR = 0x00000400;
+
+SFX_IMPL_INTERFACE(FmFormShell, SfxShell, SVX_RES(RID_STR_FORMSHELL))
+{
+ SFX_FEATURED_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_NAVIGATION|SFX_VISIBILITY_STANDARD|SFX_VISIBILITY_READONLYDOC,
+ SVX_RES(RID_SVXTBX_FORM_NAVIGATION),
+ FM_UI_FEATURE_SHOW_DATABASEBAR );
+
+ SFX_FEATURED_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_NAVIGATION|SFX_VISIBILITY_STANDARD|SFX_VISIBILITY_READONLYDOC,
+ SVX_RES(RID_SVXTBX_FORM_FILTER),
+ FM_UI_FEATURE_SHOW_FILTERBAR );
+
+ SFX_FEATURED_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT | SFX_VISIBILITY_STANDARD | SFX_VISIBILITY_READONLYDOC,
+ SVX_RES( RID_SVXTBX_TEXT_CONTROL_ATTRIBUTES ),
+ FM_UI_FEATURE_SHOW_TEXT_CONTROL_BAR );
+
+ SFX_FEATURED_CHILDWINDOW_REGISTRATION(SID_FM_ADD_FIELD, FM_UI_FEATURE_SHOW_FIELD);
+ SFX_FEATURED_CHILDWINDOW_REGISTRATION(SID_FM_SHOW_PROPERTIES, FM_UI_FEATURE_SHOW_PROPERTIES);
+ SFX_FEATURED_CHILDWINDOW_REGISTRATION(SID_FM_SHOW_FMEXPLORER, FM_UI_FEATURE_SHOW_EXPLORER);
+ SFX_FEATURED_CHILDWINDOW_REGISTRATION(SID_FM_FILTER_NAVIGATOR, FM_UI_FEATURE_SHOW_FILTERNAVIGATOR);
+ SFX_FEATURED_CHILDWINDOW_REGISTRATION(SID_FM_SHOW_DATANAVIGATOR, FM_UI_FEATURE_SHOW_DATANAVIGATOR);
+
+ SFX_FEATURED_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT | SFX_VISIBILITY_STANDARD,
+ SVX_RES( RID_SVXTBX_CONTROLS ),
+ FM_UI_FEATURE_TB_CONTROLS );
+
+ SFX_FEATURED_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT | SFX_VISIBILITY_STANDARD,
+ SVX_RES( RID_SVXTBX_MORECONTROLS ),
+ FM_UI_FEATURE_TB_MORECONTROLS );
+
+ SFX_FEATURED_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT | SFX_VISIBILITY_STANDARD,
+ SVX_RES( RID_SVXTBX_FORMDESIGN ),
+ FM_UI_FEATURE_TB_FORMDESIGN );
+}
+
+//========================================================================
+TYPEINIT1(FmFormShell,SfxShell)
+
+//------------------------------------------------------------------------
+FmFormShell::FmFormShell( SfxViewShell* _pParent, FmFormView* pView )
+ :SfxShell(_pParent)
+ ,m_pImpl(new FmXFormShell(*this, _pParent->GetViewFrame()))
+ ,m_pFormView( pView )
+ ,m_pFormModel( NULL )
+ ,m_pParentShell(_pParent)
+ ,m_nLastSlot( 0 )
+ ,m_bDesignMode( sal_True )
+ ,m_bHasForms(sal_False)
+{
+ m_pImpl->acquire();
+ SetPool( &SFX_APP()->GetPool() );
+ SetName( String::CreateFromAscii( "Form" ) );
+
+ SetView(m_pFormView);
+}
+
+//------------------------------------------------------------------------
+FmFormShell::~FmFormShell()
+{
+ if ( m_pFormView )
+ SetView( NULL );
+
+ m_pImpl->dispose();
+ m_pImpl->release();
+ m_pImpl = NULL;
+}
+
+//------------------------------------------------------------------------
+void FmFormShell::NotifyMarkListChanged(FmFormView* pWhichView)
+{
+ FmNavViewMarksChanged aChangeNotification(pWhichView);
+ Broadcast(aChangeNotification);
+}
+
+//------------------------------------------------------------------------
+sal_uInt16 FmFormShell::PrepareClose(sal_Bool bUI, sal_Bool /*bForBrowsing*/)
+{
+ if ( GetImpl()->didPrepareClose() )
+ // we already did a PrepareClose for the current modifications of the current form
+ // 2002-11-12 #104702# - fs@openoffice.org
+ return sal_True;
+
+ sal_Bool bResult = sal_True;
+ // Save the data records, not in DesignMode and FilterMode
+ if (!m_bDesignMode && !GetImpl()->isInFilterMode() &&
+ m_pFormView && m_pFormView->GetActualOutDev() &&
+ m_pFormView->GetActualOutDev()->GetOutDevType() == OUTDEV_WINDOW)
+ {
+ SdrPageView* pCurPageView = m_pFormView->GetSdrPageView();
+
+ // sal_uInt16 nPos = pCurPageView ? pCurPageView->GetWinList().Find((OutputDevice*)m_pFormView->GetActualOutDev()) : SDRPAGEVIEWWIN_NOTFOUND;
+ SdrPageWindow* pWindow = pCurPageView ? pCurPageView->FindPageWindow(*((OutputDevice*)m_pFormView->GetActualOutDev())) : 0L;
+
+ if(pWindow)
+ {
+ // Zunaechst werden die aktuellen Inhalte der Controls gespeichert
+ // Wenn alles glatt gelaufen ist, werden die modifizierten Datensaetze gespeichert
+ if ( GetImpl()->getActiveController().is() )
+ {
+ const ::svx::ControllerFeatures& rController = GetImpl()->getActiveControllerFeatures();
+ if ( rController->commitCurrentControl() )
+ {
+ sal_Bool bModified = rController->isModifiedRow();
+
+ if ( bModified && bUI )
+ {
+ QueryBox aQry(NULL, SVX_RES(RID_QRY_SAVEMODIFIED));
+ switch (aQry.Execute())
+ {
+ case RET_NO:
+ bModified = sal_False;
+ GetImpl()->didPrepareClose( sal_True );
+ break;
+
+ case RET_CANCEL:
+ return sal_False;
+
+ case RET_NEWTASK:
+ return RET_NEWTASK;
+ }
+
+ if ( bModified )
+ bResult = rController->commitCurrentRecord( );
+ }
+ }
+ }
+ }
+ }
+ return bResult;
+}
+
+//------------------------------------------------------------------------
+void FmFormShell::impl_setDesignMode(sal_Bool bDesign)
+{
+ if (m_pFormView)
+ {
+ if (!bDesign)
+ m_nLastSlot = SID_FM_DESIGN_MODE;
+
+ GetImpl()->SetDesignMode(bDesign);
+ // mein m_bDesignMode wird auch von der Impl gesetzt ...
+ }
+ else
+ {
+ m_bHasForms = sal_False;
+ m_bDesignMode = bDesign;
+ UIFeatureChanged();
+ }
+
+ GetViewShell()->GetViewFrame()->GetBindings().Invalidate(ControllerSlotMap);
+}
+
+//------------------------------------------------------------------------
+sal_Bool FmFormShell::HasUIFeature( sal_uInt32 nFeature )
+{
+ sal_Bool bResult = sal_False;
+ if ((nFeature & FM_UI_FEATURE_SHOW_DATABASEBAR) == FM_UI_FEATURE_SHOW_DATABASEBAR)
+ {
+ // nur wenn auch formulare verfuegbar
+ bResult = !m_bDesignMode && GetImpl()->hasDatabaseBar() && !GetImpl()->isInFilterMode();
+ }
+ else if ((nFeature & FM_UI_FEATURE_SHOW_FILTERBAR) == FM_UI_FEATURE_SHOW_FILTERBAR)
+ {
+ // nur wenn auch formulare verfuegbar
+ bResult = !m_bDesignMode && GetImpl()->hasDatabaseBar() && GetImpl()->isInFilterMode();
+ }
+ else if ((nFeature & FM_UI_FEATURE_SHOW_FILTERNAVIGATOR) == FM_UI_FEATURE_SHOW_FILTERNAVIGATOR)
+ {
+ bResult = !m_bDesignMode && GetImpl()->hasDatabaseBar() && GetImpl()->isInFilterMode();
+ }
+ else if ((nFeature & FM_UI_FEATURE_SHOW_FIELD) == FM_UI_FEATURE_SHOW_FIELD)
+ {
+ bResult = m_bDesignMode && m_pFormView && m_bHasForms;
+ }
+ else if ((nFeature & FM_UI_FEATURE_SHOW_PROPERTIES) == FM_UI_FEATURE_SHOW_PROPERTIES)
+ {
+ bResult = m_bDesignMode && m_pFormView && m_bHasForms;
+ }
+ else if ((nFeature & FM_UI_FEATURE_SHOW_EXPLORER) == FM_UI_FEATURE_SHOW_EXPLORER)
+ {
+ bResult = m_bDesignMode; // OJ #101593# && m_pFormView && m_bHasForms;
+ }
+ else if ( ( nFeature & FM_UI_FEATURE_SHOW_TEXT_CONTROL_BAR ) == FM_UI_FEATURE_SHOW_TEXT_CONTROL_BAR )
+ {
+ bResult = !GetImpl()->IsReadonlyDoc() && m_pImpl->IsActiveControl( true );
+ }
+ else if ((nFeature & FM_UI_FEATURE_SHOW_DATANAVIGATOR) == FM_UI_FEATURE_SHOW_DATANAVIGATOR)
+ {
+ bResult = GetImpl()->isEnhancedForm();
+ }
+ else if ( ( ( nFeature & FM_UI_FEATURE_TB_CONTROLS ) == FM_UI_FEATURE_TB_CONTROLS )
+ || ( ( nFeature & FM_UI_FEATURE_TB_MORECONTROLS ) == FM_UI_FEATURE_TB_MORECONTROLS )
+ || ( ( nFeature & FM_UI_FEATURE_TB_FORMDESIGN ) == FM_UI_FEATURE_TB_FORMDESIGN )
+ )
+ {
+ bResult = sal_True;
+ }
+
+ return bResult;
+}
+
+//------------------------------------------------------------------------
+void FmFormShell::Execute(SfxRequest &rReq)
+{
+ sal_uInt16 nSlot = rReq.GetSlot();
+
+ //////////////////////////////////////////////////////////////////////
+ // MasterSlot setzen
+ switch( nSlot )
+ {
+ case SID_FM_PUSHBUTTON:
+ case SID_FM_RADIOBUTTON:
+ case SID_FM_CHECKBOX:
+ case SID_FM_FIXEDTEXT:
+ case SID_FM_GROUPBOX:
+ case SID_FM_LISTBOX:
+ case SID_FM_COMBOBOX:
+ case SID_FM_NAVIGATIONBAR:
+ case SID_FM_EDIT:
+ case SID_FM_DBGRID:
+ case SID_FM_IMAGEBUTTON:
+ case SID_FM_IMAGECONTROL:
+ case SID_FM_FILECONTROL:
+ case SID_FM_DATEFIELD:
+ case SID_FM_TIMEFIELD:
+ case SID_FM_NUMERICFIELD:
+ case SID_FM_CURRENCYFIELD:
+ case SID_FM_PATTERNFIELD:
+ case SID_FM_FORMATTEDFIELD:
+ case SID_FM_SCROLLBAR:
+ case SID_FM_SPINBUTTON:
+ m_nLastSlot = nSlot;
+ GetViewShell()->GetViewFrame()->GetBindings().Invalidate( SID_FM_CONFIG );
+ break;
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // Identifier und Inventor des Uno-Controls setzen
+ sal_uInt16 nIdentifier = 0;
+ switch( nSlot )
+ {
+ case SID_FM_CHECKBOX:
+ nIdentifier = OBJ_FM_CHECKBOX;
+ break;
+ case SID_FM_PUSHBUTTON:
+ nIdentifier = OBJ_FM_BUTTON;
+ break;
+ case SID_FM_FIXEDTEXT:
+ nIdentifier = OBJ_FM_FIXEDTEXT;
+ break;
+ case SID_FM_LISTBOX:
+ nIdentifier = OBJ_FM_LISTBOX;
+ break;
+ case SID_FM_EDIT:
+ nIdentifier = OBJ_FM_EDIT;
+ break;
+ case SID_FM_RADIOBUTTON:
+ nIdentifier = OBJ_FM_RADIOBUTTON;
+ break;
+ case SID_FM_GROUPBOX:
+ nIdentifier = OBJ_FM_GROUPBOX;
+ break;
+ case SID_FM_COMBOBOX:
+ nIdentifier = OBJ_FM_COMBOBOX;
+ break;
+ case SID_FM_NAVIGATIONBAR:
+ nIdentifier = OBJ_FM_NAVIGATIONBAR;
+ break;
+ case SID_FM_DBGRID:
+ nIdentifier = OBJ_FM_GRID;
+ break;
+ case SID_FM_IMAGEBUTTON:
+ nIdentifier = OBJ_FM_IMAGEBUTTON;
+ break;
+ case SID_FM_IMAGECONTROL:
+ nIdentifier = OBJ_FM_IMAGECONTROL;
+ break;
+ case SID_FM_FILECONTROL:
+ nIdentifier = OBJ_FM_FILECONTROL;
+ break;
+ case SID_FM_DATEFIELD:
+ nIdentifier = OBJ_FM_DATEFIELD;
+ break;
+ case SID_FM_TIMEFIELD:
+ nIdentifier = OBJ_FM_TIMEFIELD;
+ break;
+ case SID_FM_NUMERICFIELD:
+ nIdentifier = OBJ_FM_NUMERICFIELD;
+ break;
+ case SID_FM_CURRENCYFIELD:
+ nIdentifier = OBJ_FM_CURRENCYFIELD;
+ break;
+ case SID_FM_PATTERNFIELD:
+ nIdentifier = OBJ_FM_PATTERNFIELD;
+ break;
+ case SID_FM_FORMATTEDFIELD:
+ nIdentifier = OBJ_FM_FORMATTEDFIELD;
+ break;
+ case SID_FM_SCROLLBAR:
+ nIdentifier = OBJ_FM_SCROLLBAR;
+ break;
+ case SID_FM_SPINBUTTON:
+ nIdentifier = OBJ_FM_SPINBUTTON;
+ break;
+ }
+
+ switch ( nSlot )
+ {
+ case SID_FM_CHECKBOX:
+ case SID_FM_PUSHBUTTON:
+ case SID_FM_FIXEDTEXT:
+ case SID_FM_LISTBOX:
+ case SID_FM_EDIT:
+ case SID_FM_RADIOBUTTON:
+ case SID_FM_COMBOBOX:
+ case SID_FM_NAVIGATIONBAR:
+ case SID_FM_GROUPBOX:
+ case SID_FM_DBGRID:
+ case SID_FM_IMAGEBUTTON:
+ case SID_FM_IMAGECONTROL:
+ case SID_FM_FILECONTROL:
+ case SID_FM_DATEFIELD:
+ case SID_FM_TIMEFIELD:
+ case SID_FM_NUMERICFIELD:
+ case SID_FM_CURRENCYFIELD:
+ case SID_FM_PATTERNFIELD:
+ case SID_FM_FORMATTEDFIELD:
+ case SID_FM_SCROLLBAR:
+ case SID_FM_SPINBUTTON:
+ {
+ SFX_REQUEST_ARG( rReq, pGrabFocusItem, SfxBoolItem, SID_FM_TOGGLECONTROLFOCUS, sal_False );
+ if ( pGrabFocusItem && pGrabFocusItem->GetValue() )
+ { // see below
+ SfxViewShell* pShell = GetViewShell();
+ Window* pShellWnd = pShell ? pShell->GetWindow() : NULL;
+ if ( pShellWnd )
+ pShellWnd->GrabFocus();
+ break;
+ }
+
+ SfxUInt16Item aIdentifierItem( SID_FM_CONTROL_IDENTIFIER, nIdentifier );
+ SfxUInt32Item aInventorItem( SID_FM_CONTROL_INVENTOR, FmFormInventor );
+ const SfxPoolItem* pArgs[] =
+ {
+ &aIdentifierItem, &aInventorItem, NULL
+ };
+ const SfxPoolItem* pInternalArgs[] =
+ {
+ NULL
+ };
+
+ GetViewShell()->GetViewFrame()->GetDispatcher()->Execute( SID_FM_CREATE_CONTROL, SFX_CALLMODE_ASYNCHRON,
+ pArgs, rReq.GetModifier(), pInternalArgs );
+
+ if ( rReq.GetModifier() & KEY_MOD1 )
+ {
+ // #99013# if selected with control key, return focus to current view
+ // do this asynchron, so that the creation can be finished first
+ // reusing the SID_FM_TOGGLECONTROLFOCUS is somewhat hacky ... which it wouldn't if it would have another
+ // name, so I do not really have a big problem with this ....
+ SfxBoolItem aGrabFocusIndicatorItem( SID_FM_TOGGLECONTROLFOCUS, sal_True );
+ GetViewShell()->GetViewFrame()->GetDispatcher()->Execute( nSlot, SFX_CALLMODE_ASYNCHRON,
+ &aGrabFocusIndicatorItem, NULL );
+ }
+
+ rReq.Done();
+ } break;
+ }
+
+ // Individuelle Aktionen
+ switch( nSlot )
+ {
+ case SID_FM_MORE_CONTROLS:
+ case SID_FM_FORM_DESIGN_TOOLS:
+ {
+ FormToolboxes aToolboxAccess( GetImpl()->getHostFrame() );
+ aToolboxAccess.toggleToolbox( nSlot );
+ rReq.Done();
+ }
+ break;
+
+ case SID_FM_TOGGLECONTROLFOCUS:
+ {
+ FmFormView* pFormView = GetFormView();
+ if ( !pFormView )
+ break;
+
+ // if we execute this ourself, then either the application does not implement an own handling for this,
+ // of we're on the top of the dispatcher stack, which means a control has the focus.
+ // In the latter case, we put the focus to the document window, otherwise, we focus the first control
+ const bool bHasControlFocus = GetImpl()->HasControlFocus();
+ if ( bHasControlFocus )
+ {
+ const OutputDevice* pDevice = GetCurrentViewDevice();
+ Window* pWindow = dynamic_cast< Window* >( const_cast< OutputDevice* >( pDevice ) );
+ if ( pWindow )
+ pWindow->GrabFocus();
+ }
+ else
+ {
+ pFormView->GrabFirstControlFocus( );
+ }
+ }
+ break;
+
+ case SID_FM_VIEW_AS_GRID:
+ GetImpl()->CreateExternalView();
+ break;
+ case SID_FM_CONVERTTO_EDIT :
+ case SID_FM_CONVERTTO_BUTTON :
+ case SID_FM_CONVERTTO_FIXEDTEXT :
+ case SID_FM_CONVERTTO_LISTBOX :
+ case SID_FM_CONVERTTO_CHECKBOX :
+ case SID_FM_CONVERTTO_RADIOBUTTON :
+ case SID_FM_CONVERTTO_GROUPBOX :
+ case SID_FM_CONVERTTO_COMBOBOX :
+ case SID_FM_CONVERTTO_IMAGEBUTTON :
+ case SID_FM_CONVERTTO_FILECONTROL :
+ case SID_FM_CONVERTTO_DATE :
+ case SID_FM_CONVERTTO_TIME :
+ case SID_FM_CONVERTTO_NUMERIC :
+ case SID_FM_CONVERTTO_CURRENCY :
+ case SID_FM_CONVERTTO_PATTERN :
+ case SID_FM_CONVERTTO_IMAGECONTROL :
+ case SID_FM_CONVERTTO_FORMATTED :
+ case SID_FM_CONVERTTO_SCROLLBAR :
+ case SID_FM_CONVERTTO_SPINBUTTON :
+ case SID_FM_CONVERTTO_NAVIGATIONBAR :
+ GetImpl()->executeControlConversionSlot( nSlot );
+ // nach dem Konvertieren die Selektion neu bestimmern, da sich ja das selektierte Objekt
+ // geaendert hat
+ GetImpl()->SetSelection(GetFormView()->GetMarkedObjectList());
+ break;
+ case SID_FM_LEAVE_CREATE:
+ m_nLastSlot = 0;
+ GetViewShell()->GetViewFrame()->GetBindings().Invalidate( SID_FM_CONFIG );
+ rReq.Done();
+ break;
+ case SID_FM_SHOW_PROPERTY_BROWSER:
+ {
+ SFX_REQUEST_ARG( rReq, pShowItem, SfxBoolItem, SID_FM_SHOW_PROPERTIES, sal_False );
+ sal_Bool bShow = sal_True;
+ if ( pShowItem )
+ bShow = pShowItem->GetValue();
+ GetImpl()->ShowSelectionProperties( bShow );
+
+ rReq.Done();
+ } break;
+
+ case SID_FM_PROPERTIES:
+ {
+ // PropertyBrowser anzeigen
+ SFX_REQUEST_ARG(rReq, pShowItem, SfxBoolItem, nSlot, sal_False);
+ sal_Bool bShow = pShowItem ? pShowItem->GetValue() : sal_True;
+
+ InterfaceBag aOnlyTheForm;
+ aOnlyTheForm.insert( Reference< XInterface >( GetImpl()->getCurrentForm(), UNO_QUERY ) );
+ GetImpl()->setCurrentSelection( aOnlyTheForm );
+
+ GetImpl()->ShowSelectionProperties( bShow );
+
+ rReq.Done();
+ } break;
+
+ case SID_FM_CTL_PROPERTIES:
+ {
+ SFX_REQUEST_ARG(rReq, pShowItem, SfxBoolItem, nSlot, sal_False);
+ sal_Bool bShow = pShowItem ? pShowItem->GetValue() : sal_True;
+
+ OSL_ENSURE( GetImpl()->onlyControlsAreMarked(), "FmFormShell::Execute: ControlProperties should be disabled!" );
+ if ( bShow )
+ GetImpl()->selectLastMarkedControls();
+ GetImpl()->ShowSelectionProperties( bShow );
+
+ rReq.Done();
+ } break;
+ case SID_FM_SHOW_PROPERTIES:
+ case SID_FM_ADD_FIELD:
+ case SID_FM_FILTER_NAVIGATOR:
+ case SID_FM_SHOW_DATANAVIGATOR :
+ {
+ GetViewShell()->GetViewFrame()->ChildWindowExecute( rReq );
+ rReq.Done();
+ } break;
+ case SID_FM_SHOW_FMEXPLORER:
+ {
+ if (!m_pFormView) // setzen der ::com::sun::star::sdbcx::View Forcieren
+ GetViewShell()->GetViewFrame()->GetDispatcher()->Execute(SID_CREATE_SW_DRAWVIEW);
+
+ GetViewShell()->GetViewFrame()->ChildWindowExecute(rReq);
+ rReq.Done();
+ }
+ break;
+
+ case SID_FM_TAB_DIALOG:
+ {
+ GetImpl()->ExecuteTabOrderDialog( Reference< XTabControllerModel >( GetImpl()->getCurrentForm(), UNO_QUERY ) );
+ rReq.Done();
+ }
+ break;
+
+ case SID_FM_DESIGN_MODE:
+ {
+ SFX_REQUEST_ARG(rReq, pDesignItem, SfxBoolItem, nSlot, sal_False);
+ sal_Bool bDesignMode = pDesignItem ? pDesignItem->GetValue() : !m_bDesignMode;
+ SetDesignMode( bDesignMode );
+ if ( m_bDesignMode == bDesignMode )
+ rReq.Done();
+
+ m_nLastSlot = SID_FM_DESIGN_MODE;
+ GetViewShell()->GetViewFrame()->GetBindings().Invalidate( SID_FM_CONFIG );
+ }
+ break;
+
+ case SID_FM_AUTOCONTROLFOCUS:
+ {
+ FmFormModel* pModel = GetFormModel();
+ DBG_ASSERT(pModel, "FmFormShell::Execute : invalid call !");
+ // should have been disabled in GetState if we don't have a FormModel
+ pModel->SetAutoControlFocus( !pModel->GetAutoControlFocus() );
+ GetViewShell()->GetViewFrame()->GetBindings().Invalidate(SID_FM_AUTOCONTROLFOCUS);
+ }
+ break;
+ case SID_FM_OPEN_READONLY:
+ {
+ FmFormModel* pModel = GetFormModel();
+ DBG_ASSERT(pModel, "FmFormShell::Execute : invalid call !");
+ // should have been disabled in GetState if we don't have a FormModel
+ pModel->SetOpenInDesignMode( !pModel->GetOpenInDesignMode() );
+ GetViewShell()->GetViewFrame()->GetBindings().Invalidate(SID_FM_OPEN_READONLY);
+ }
+ break;
+ case SID_FM_USE_WIZARDS:
+ {
+ GetImpl()->SetWizardUsing(!GetImpl()->GetWizardUsing());
+ GetViewShell()->GetViewFrame()->GetBindings().Invalidate(SID_FM_USE_WIZARDS);
+ }
+ break;
+ case SID_FM_SEARCH:
+ {
+ const ::svx::ControllerFeatures& rController = GetImpl()->getActiveControllerFeatures();
+ if ( rController->commitCurrentControl() && rController->commitCurrentRecord() )
+ GetImpl()->ExecuteSearch();
+ rReq.Done();
+ }
+ break;
+
+ case SID_FM_RECORD_FIRST:
+ case SID_FM_RECORD_PREV:
+ case SID_FM_RECORD_NEXT:
+ case SID_FM_RECORD_LAST:
+ case SID_FM_RECORD_NEW:
+ case SID_FM_REFRESH:
+ case SID_FM_REFRESH_FORM_CONTROL:
+ case SID_FM_RECORD_DELETE:
+ case SID_FM_RECORD_UNDO:
+ case SID_FM_RECORD_SAVE:
+ case SID_FM_REMOVE_FILTER_SORT:
+ case SID_FM_SORTDOWN:
+ case SID_FM_SORTUP:
+ case SID_FM_AUTOFILTER:
+ case SID_FM_ORDERCRIT:
+ case SID_FM_FORM_FILTERED:
+ {
+ GetImpl()->ExecuteFormSlot( nSlot );
+ rReq.Done();
+ }
+ break;
+
+ case SID_FM_RECORD_ABSOLUTE:
+ {
+ const ::svx::ControllerFeatures& rController = GetImpl()->getNavControllerFeatures();
+ sal_Int32 nRecord = -1;
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ if ( pArgs )
+ {
+ const SfxPoolItem* pItem;
+ if ( ( pArgs->GetItemState( FN_PARAM_1, sal_True, &pItem ) ) == SFX_ITEM_SET )
+ {
+ const SfxInt32Item* pTypedItem = PTR_CAST( SfxInt32Item, pItem );
+ if ( pTypedItem )
+ nRecord = Max( pTypedItem->GetValue(), sal_Int32(0) );
+ }
+ }
+ else
+ {
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT( pFact, "no dialog factory!" );
+ if ( pFact )
+ {
+ ::std::auto_ptr< AbstractFmInputRecordNoDialog > dlg( pFact->CreateFmInputRecordNoDialog( NULL ) );
+ DBG_ASSERT( dlg.get(), "Dialogdiet fail!" );
+ dlg->SetValue( rController->getCursor()->getRow() );
+ if ( dlg->Execute() == RET_OK )
+ nRecord = dlg->GetValue();
+
+ rReq.AppendItem( SfxInt32Item( FN_PARAM_1, nRecord ) );
+ }
+ }
+
+ if ( nRecord != -1 )
+ rController->execute( nSlot, ::rtl::OUString::createFromAscii( "Position" ), makeAny( (sal_Int32)nRecord ) );
+
+ rReq.Done();
+ } break;
+ case SID_FM_FILTER_EXECUTE:
+ case SID_FM_FILTER_EXIT:
+ {
+ sal_Bool bCancelled = ( SID_FM_FILTER_EXIT == nSlot );
+ sal_Bool bReopenNavigator = sal_False;
+
+ if ( !bCancelled )
+ {
+ // if the filter navigator is still open, we need to close it, so it can possibly
+ // commit it's most recent changes
+ if ( GetViewShell() && GetViewShell()->GetViewFrame() )
+ if ( GetViewShell()->GetViewFrame()->HasChildWindow( SID_FM_FILTER_NAVIGATOR ) )
+ {
+ GetViewShell()->GetViewFrame()->ToggleChildWindow( SID_FM_FILTER_NAVIGATOR );
+ bReopenNavigator = sal_True;
+ }
+
+ Reference< runtime::XFormController > xController( GetImpl()->getActiveController() );
+
+ if ( GetViewShell()->GetViewFrame()->HasChildWindow( SID_FM_FILTER_NAVIGATOR )
+ // closing the window was denied, for instance because of a invalid criterion
+
+ || ( xController.is()
+ && !GetImpl()->getActiveControllerFeatures()->commitCurrentControl( )
+ )
+ // committing the controller was denied
+ )
+ {
+ rReq.Done();
+ break;
+ }
+ }
+
+ GetImpl()->stopFiltering( !bCancelled );
+ rReq.Done();
+
+ if ( bReopenNavigator )
+ // we closed the navigator only to implicitly commit it (as we do not have another
+ // direct wire to it), but to the user, it should look it it was always open
+ GetViewShell()->GetViewFrame()->ToggleChildWindow( SID_FM_FILTER_NAVIGATOR );
+ }
+ break;
+
+ case SID_FM_FILTER_START:
+ {
+ GetImpl()->startFiltering();
+ rReq.Done();
+
+ // initially open the filter navigator, the whole form based filter is pretty useless without it
+ SfxBoolItem aIdentifierItem( SID_FM_FILTER_NAVIGATOR, sal_True );
+ GetViewShell()->GetViewFrame()->GetDispatcher()->Execute( SID_FM_FILTER_NAVIGATOR, SFX_CALLMODE_ASYNCHRON,
+ &aIdentifierItem, NULL );
+ } break;
+ }
+}
+
+//------------------------------------------------------------------------
+void FmFormShell::GetState(SfxItemSet &rSet)
+{
+ SfxWhichIter aIter( rSet );
+ sal_uInt16 nWhich = aIter.FirstWhich();
+ while ( nWhich )
+ {
+ switch( nWhich )
+ {
+ case SID_FM_MORE_CONTROLS:
+ case SID_FM_FORM_DESIGN_TOOLS:
+ {
+ FormToolboxes aToolboxAccess( GetImpl()->getHostFrame() );
+ rSet.Put( SfxBoolItem( nWhich, aToolboxAccess.isToolboxVisible( nWhich ) ) );
+ }
+ break;
+
+ case SID_FM_FILTER_EXECUTE:
+ case SID_FM_FILTER_EXIT:
+ if (!GetImpl()->isInFilterMode())
+ rSet.DisableItem( nWhich );
+ break;
+
+ case SID_FM_USE_WIZARDS:
+ if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) )
+ rSet.Put( SfxVisibilityItem( nWhich, sal_False ) );
+ else if (!m_bDesignMode || !GetFormModel())
+ rSet.DisableItem( nWhich );
+ else
+ rSet.Put( SfxBoolItem(nWhich, GetImpl()->GetWizardUsing() ) );
+ break;
+ case SID_FM_AUTOCONTROLFOCUS:
+ if (!m_bDesignMode || !GetFormModel())
+ rSet.DisableItem( nWhich );
+ else
+ rSet.Put( SfxBoolItem(nWhich, GetFormModel()->GetAutoControlFocus() ) );
+ break;
+ case SID_FM_OPEN_READONLY:
+ if (!m_bDesignMode || !GetFormModel())
+ rSet.DisableItem( nWhich );
+ else
+ rSet.Put( SfxBoolItem(nWhich, GetFormModel()->GetOpenInDesignMode() ) );
+ break;
+
+ case SID_FM_NAVIGATIONBAR:
+ case SID_FM_DBGRID:
+ if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) )
+ {
+ rSet.Put( SfxVisibilityItem( nWhich, sal_False ) );
+ break;
+ }
+ // NO break!
+
+ case SID_FM_SCROLLBAR:
+ case SID_FM_IMAGECONTROL:
+ case SID_FM_FILECONTROL:
+ case SID_FM_CURRENCYFIELD:
+ case SID_FM_PATTERNFIELD:
+ case SID_FM_IMAGEBUTTON:
+ case SID_FM_RADIOBUTTON:
+ case SID_FM_COMBOBOX:
+ case SID_FM_GROUPBOX:
+ case SID_FM_CHECKBOX:
+ case SID_FM_PUSHBUTTON:
+ case SID_FM_FIXEDTEXT:
+ case SID_FM_LISTBOX:
+ case SID_FM_EDIT:
+ case SID_FM_DATEFIELD:
+ case SID_FM_TIMEFIELD:
+ case SID_FM_NUMERICFIELD:
+ case SID_FM_FORMATTEDFIELD:
+ case SID_FM_SPINBUTTON:
+ if (!m_bDesignMode)
+ rSet.DisableItem( nWhich );
+ else
+ {
+ sal_Bool bLayerLocked = sal_False;
+ if (m_pFormView)
+ {
+ // Ist der ::com::sun::star::drawing::Layer gelocked, so m???ssen die Slots disabled werden. #36897
+ SdrPageView* pPV = m_pFormView->GetSdrPageView();
+ if (pPV != NULL)
+ bLayerLocked = pPV->IsLayerLocked(m_pFormView->GetActiveLayer());
+ }
+ if (bLayerLocked)
+ rSet.DisableItem( nWhich );
+ else
+ rSet.Put( SfxBoolItem(nWhich, (nWhich==m_nLastSlot)) );
+ }
+ break;
+ case SID_FM_FILTER_NAVIGATOR_CONTROL:
+ {
+ if (GetImpl()->isInFilterMode())
+ rSet.Put(SfxObjectItem(nWhich, this));
+ else
+ rSet.Put(SfxObjectItem(nWhich));
+ } break;
+ case SID_FM_FIELDS_CONTROL:
+ case SID_FM_PROPERTY_CONTROL:
+ {
+ if (!m_bDesignMode || !m_pFormView || !m_bHasForms)
+ rSet.Put(SfxObjectItem(nWhich));
+ else
+ rSet.Put(SfxObjectItem(nWhich, this));
+
+ } break;
+ case SID_FM_FMEXPLORER_CONTROL:
+ case SID_FM_DATANAVIGATOR_CONTROL :
+ {
+ if (!m_bDesignMode || !m_pFormView)
+ rSet.Put(SfxObjectItem(nWhich));
+ else
+ rSet.Put(SfxObjectItem(nWhich, this));
+
+ } break;
+ case SID_FM_ADD_FIELD:
+ case SID_FM_SHOW_FMEXPLORER:
+ case SID_FM_SHOW_PROPERTIES:
+ case SID_FM_FILTER_NAVIGATOR:
+ case SID_FM_SHOW_DATANAVIGATOR:
+ {
+ if ( GetViewShell()->GetViewFrame()->KnowsChildWindow(nWhich) )
+ rSet.Put( SfxBoolItem( nWhich, GetViewShell()->GetViewFrame()->HasChildWindow(nWhich)) );
+ else
+ rSet.DisableItem(nWhich);
+ } break;
+
+ case SID_FM_SHOW_PROPERTY_BROWSER:
+ {
+ rSet.Put(SfxBoolItem(GetImpl()->IsPropBrwOpen()));
+ }
+ break;
+
+ case SID_FM_CTL_PROPERTIES:
+ {
+ // der Impl eventuell die Moeglichjkeit geben, ihre an der aktuellen MarkList ausgerichteten Objekte
+ // auf den neuesten Stand zu bringen
+ if (GetImpl()->IsSelectionUpdatePending())
+ GetImpl()->ForceUpdateSelection(sal_False);
+
+ if ( !m_pFormView || !m_bDesignMode || !GetImpl()->onlyControlsAreMarked() )
+ rSet.DisableItem( nWhich );
+ else
+ {
+ sal_Bool bChecked = GetImpl()->IsPropBrwOpen() && !GetImpl()->isSolelySelected( GetImpl()->getCurrentForm() );
+ // if the property browser is open, and only controls are marked, and the current selection
+ // does not consist of only the current form, then the current selection is the (composition of)
+ // the currently marked controls
+ rSet.Put( SfxBoolItem( nWhich, bChecked ) );
+ }
+ } break;
+
+ case SID_FM_PROPERTIES:
+ {
+ // der Impl eventuell die Moeglichjkeit geben, ihre an der aktuellen MarkList ausgerichteten Objekte
+ // auf den neuesten Stand zu bringen
+ if (GetImpl()->IsSelectionUpdatePending())
+ GetImpl()->ForceUpdateSelection(sal_False);
+
+ if ( !m_pFormView || !m_bDesignMode || !GetImpl()->getCurrentForm().is() )
+ rSet.DisableItem( nWhich );
+ else
+ {
+ sal_Bool bChecked = GetImpl()->IsPropBrwOpen() && GetImpl()->isSolelySelected( GetImpl()->getCurrentForm() );
+ rSet.Put(SfxBoolItem(nWhich, bChecked));
+ }
+ } break;
+ case SID_FM_TAB_DIALOG:
+ // der Impl eventuell die Moeglichjkeit geben, ihre an der aktuellen MarkList ausgerichteten Objekte
+ // auf den neuesten Stand zu bringen
+ if (GetImpl()->IsSelectionUpdatePending())
+ GetImpl()->ForceUpdateSelection(sal_False);
+
+ if (!m_pFormView || !m_bDesignMode || !GetImpl()->getCurrentForm().is() )
+ rSet.DisableItem( nWhich );
+ break;
+ case SID_FM_CONFIG:
+ rSet.Put(SfxUInt16Item(nWhich, m_nLastSlot));
+ break;
+ case SID_FM_DESIGN_MODE:
+ if (!m_pFormView || GetImpl()->IsReadonlyDoc() )
+ rSet.DisableItem( nWhich );
+ else
+ rSet.Put( SfxBoolItem(nWhich, m_bDesignMode) );
+ break;
+ case SID_FM_SEARCH:
+ case SID_FM_RECORD_FIRST:
+ case SID_FM_RECORD_NEXT:
+ case SID_FM_RECORD_PREV:
+ case SID_FM_RECORD_LAST:
+ case SID_FM_RECORD_NEW:
+ case SID_FM_RECORD_DELETE:
+ case SID_FM_RECORD_ABSOLUTE:
+ case SID_FM_RECORD_TOTAL:
+ case SID_FM_RECORD_SAVE:
+ case SID_FM_RECORD_UNDO:
+ case SID_FM_FORM_FILTERED:
+ case SID_FM_REMOVE_FILTER_SORT:
+ case SID_FM_SORTUP:
+ case SID_FM_SORTDOWN:
+ case SID_FM_ORDERCRIT:
+ case SID_FM_FILTER_START:
+ case SID_FM_AUTOFILTER:
+ case SID_FM_REFRESH:
+ case SID_FM_REFRESH_FORM_CONTROL:
+ case SID_FM_VIEW_AS_GRID:
+ GetFormState(rSet,nWhich);
+ break;
+
+ case SID_FM_CHANGECONTROLTYPE:
+ {
+ if ( !m_pFormView || !m_bDesignMode )
+ rSet.DisableItem( nWhich );
+ else
+ {
+ if ( !GetImpl()->canConvertCurrentSelectionToControl( OBJ_FM_FIXEDTEXT ) )
+ // if it cannot be converted to a fixed text, it is no single control
+ rSet.DisableItem( nWhich );
+ }
+ } break;
+
+ case SID_FM_CONVERTTO_FILECONTROL :
+ case SID_FM_CONVERTTO_CURRENCY :
+ case SID_FM_CONVERTTO_PATTERN :
+ case SID_FM_CONVERTTO_IMAGECONTROL :
+ case SID_FM_CONVERTTO_SCROLLBAR :
+ case SID_FM_CONVERTTO_NAVIGATIONBAR :
+ case SID_FM_CONVERTTO_IMAGEBUTTON :
+ case SID_FM_CONVERTTO_EDIT :
+ case SID_FM_CONVERTTO_BUTTON :
+ case SID_FM_CONVERTTO_FIXEDTEXT :
+ case SID_FM_CONVERTTO_LISTBOX :
+ case SID_FM_CONVERTTO_CHECKBOX :
+ case SID_FM_CONVERTTO_RADIOBUTTON :
+ case SID_FM_CONVERTTO_GROUPBOX :
+ case SID_FM_CONVERTTO_COMBOBOX :
+ case SID_FM_CONVERTTO_DATE :
+ case SID_FM_CONVERTTO_TIME :
+ case SID_FM_CONVERTTO_NUMERIC :
+ case SID_FM_CONVERTTO_FORMATTED :
+ case SID_FM_CONVERTTO_SPINBUTTON :
+ {
+ if ( !m_pFormView || !m_bDesignMode || !GetImpl()->canConvertCurrentSelectionToControl( nWhich ) )
+ rSet.DisableItem( nWhich );
+ else
+ {
+ rSet.Put( SfxBoolItem( nWhich, sal_False ) );
+ // just to have a defined state (available and not checked)
+ }
+ }
+ break;
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+//------------------------------------------------------------------------
+void FmFormShell::GetFormState(SfxItemSet &rSet, sal_uInt16 nWhich)
+{
+ if ( !GetImpl()->getNavController().is()
+ || !isRowSetAlive(GetImpl()->getNavController()->getModel())
+ || !m_pFormView
+ || m_bDesignMode
+ || !GetImpl()->getActiveForm().is()
+ || GetImpl()->isInFilterMode()
+ )
+ rSet.DisableItem(nWhich);
+ else
+ {
+ sal_Bool bEnable = sal_False;
+ try
+ {
+ switch (nWhich)
+ {
+ case SID_FM_VIEW_AS_GRID:
+ if (GetImpl()->getHostFrame().is() && GetImpl()->getNavController().is())
+ {
+ bEnable = sal_True;
+ sal_Bool bDisplayingCurrent =
+ GetImpl()->getInternalForm(
+ Reference< XForm >( GetImpl()->getNavController()->getModel(), UNO_QUERY )
+ ) == GetImpl()->getExternallyDisplayedForm();
+ rSet.Put(SfxBoolItem(nWhich, bDisplayingCurrent));
+ }
+ break;
+
+ case SID_FM_SEARCH:
+ {
+ Reference< ::com::sun::star::beans::XPropertySet > xNavSet(GetImpl()->getActiveForm(), UNO_QUERY);
+ sal_Int32 nCount = ::comphelper::getINT32(xNavSet->getPropertyValue(FM_PROP_ROWCOUNT));
+ bEnable = nCount != 0;
+ } break;
+ case SID_FM_RECORD_ABSOLUTE:
+ case SID_FM_RECORD_TOTAL:
+ {
+ FeatureState aState;
+ GetImpl()->getNavControllerFeatures()->getState( nWhich, aState );
+ if ( SID_FM_RECORD_ABSOLUTE == nWhich )
+ {
+ sal_Int32 nPosition = 0;
+ aState.State >>= nPosition;
+ rSet.Put( SfxInt32Item( nWhich, nPosition ) );
+ }
+ else if ( SID_FM_RECORD_TOTAL == nWhich )
+ {
+ ::rtl::OUString sTotalCount;
+ aState.State >>= sTotalCount;
+ rSet.Put( SfxStringItem( nWhich, sTotalCount ) );
+ }
+ bEnable = aState.Enabled;
+ }
+ break;
+
+ // first, prev, next, last, and absolute affect the nav controller, not the
+ // active controller
+ case SID_FM_RECORD_FIRST:
+ case SID_FM_RECORD_PREV:
+ case SID_FM_RECORD_NEXT:
+ case SID_FM_RECORD_LAST:
+ case SID_FM_RECORD_NEW:
+ case SID_FM_RECORD_SAVE:
+ case SID_FM_RECORD_UNDO:
+ case SID_FM_RECORD_DELETE:
+ case SID_FM_REFRESH:
+ case SID_FM_REFRESH_FORM_CONTROL:
+ case SID_FM_REMOVE_FILTER_SORT:
+ case SID_FM_SORTUP:
+ case SID_FM_SORTDOWN:
+ case SID_FM_AUTOFILTER:
+ case SID_FM_ORDERCRIT:
+ bEnable = GetImpl()->IsFormSlotEnabled( nWhich );
+ break;
+
+ case SID_FM_FORM_FILTERED:
+ {
+ FeatureState aState;
+ bEnable = GetImpl()->IsFormSlotEnabled( nWhich, &aState );
+
+ rSet.Put( SfxBoolItem( nWhich, ::comphelper::getBOOL( aState.State ) ) );
+ }
+ break;
+
+ case SID_FM_FILTER_START:
+ bEnable = GetImpl()->getActiveControllerFeatures()->canDoFormFilter();
+ break;
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_ERROR( "FmFormShell::GetFormState: caught an exception while determining the state!" );
+ }
+ if (!bEnable)
+ rSet.DisableItem(nWhich);
+ }
+}
+
+//------------------------------------------------------------------------
+FmFormPage* FmFormShell::GetCurPage() const
+{
+ FmFormPage* pP = NULL;
+ if (m_pFormView && m_pFormView->GetSdrPageView())
+ pP = PTR_CAST(FmFormPage,m_pFormView->GetSdrPageView()->GetPage());
+ return pP;
+}
+
+//------------------------------------------------------------------------
+void FmFormShell::SetView( FmFormView* _pView )
+{
+ if ( m_pFormView )
+ {
+ if ( IsActive() )
+ GetImpl()->viewDeactivated( *m_pFormView );
+
+ m_pFormView->SetFormShell( NULL, FmFormView::FormShellAccess() );
+ m_pFormView = NULL;
+ m_pFormModel = NULL;
+ }
+
+ if ( !_pView )
+ return;
+
+ m_pFormView = _pView;
+ m_pFormView->SetFormShell( this, FmFormView::FormShellAccess() );
+ m_pFormModel = (FmFormModel*)m_pFormView->GetModel();
+
+ impl_setDesignMode( m_pFormView->IsDesignMode() );
+
+ // We activate our view if we are activated ourself, but sometimes the Activate precedes the SetView.
+ // But here we know both the view and our activation state so we at least are able to pass the latter
+ // to the former.
+ // FS - 30.06.99 - 67308
+ if ( IsActive() )
+ GetImpl()->viewActivated( *m_pFormView );
+}
+
+//------------------------------------------------------------------------
+void FmFormShell::DetermineForms(sal_Bool bInvalidate)
+{
+ // Existieren Formulare auf der aktuellen Page
+ sal_Bool bForms = GetImpl()->hasForms();
+ if (bForms != m_bHasForms)
+ {
+ m_bHasForms = bForms;
+ if (bInvalidate)
+ UIFeatureChanged();
+ }
+}
+
+//------------------------------------------------------------------------
+sal_Bool FmFormShell::GetY2KState(sal_uInt16& nReturn)
+{
+ return GetImpl()->GetY2KState(nReturn);
+}
+
+//------------------------------------------------------------------------
+void FmFormShell::SetY2KState(sal_uInt16 n)
+{
+ GetImpl()->SetY2KState(n);
+}
+
+//------------------------------------------------------------------------
+void FmFormShell::Activate(sal_Bool bMDI)
+{
+ SfxShell::Activate(bMDI);
+
+ if ( m_pFormView )
+ GetImpl()->viewActivated( *m_pFormView, sal_True );
+}
+
+//------------------------------------------------------------------------
+void FmFormShell::Deactivate(sal_Bool bMDI)
+{
+ SfxShell::Deactivate(bMDI);
+
+ if ( m_pFormView )
+ GetImpl()->viewDeactivated( *m_pFormView, sal_False );
+}
+
+//------------------------------------------------------------------------
+void FmFormShell::ExecuteTextAttribute( SfxRequest& _rReq )
+{
+ m_pImpl->ExecuteTextAttribute( _rReq );
+}
+
+//------------------------------------------------------------------------
+void FmFormShell::GetTextAttributeState( SfxItemSet& _rSet )
+{
+ m_pImpl->GetTextAttributeState( _rSet );
+}
+
+//------------------------------------------------------------------------
+bool FmFormShell::IsActiveControl() const
+{
+ return m_pImpl->IsActiveControl();
+}
+
+//------------------------------------------------------------------------
+void FmFormShell::ForgetActiveControl()
+{
+ m_pImpl->ForgetActiveControl();
+}
+
+//------------------------------------------------------------------------
+void FmFormShell::SetControlActivationHandler( const Link& _rHdl )
+{
+ m_pImpl->SetControlActivationHandler( _rHdl );
+}
+
+//------------------------------------------------------------------------
+namespace
+{
+ SdrUnoObj* lcl_findUnoObject( const SdrObjList& _rObjList, const Reference< XControlModel >& _rxModel )
+ {
+ SdrObjListIter aIter( _rObjList );
+ while ( aIter.IsMore() )
+ {
+ SdrObject* pObject = aIter.Next();
+ SdrUnoObj* pUnoObject = pObject ? PTR_CAST( SdrUnoObj, pObject ) : NULL;
+ if ( !pUnoObject )
+ continue;
+
+ Reference< XControlModel > xControlModel = pUnoObject->GetUnoControlModel();
+ if ( !xControlModel.is() )
+ continue;
+
+ if ( _rxModel == xControlModel )
+ return pUnoObject;
+ }
+ return NULL;
+ }
+}
+
+//------------------------------------------------------------------------
+void FmFormShell::ToggleControlFocus( const SdrUnoObj& i_rUnoObject, const SdrView& i_rView, OutputDevice& i_rDevice ) const
+{
+ try
+ {
+ // check if the focus currently is in a control
+ // Well, okay, do it the other way 'round: Check whether the current control of the active controller
+ // actually has the focus. This should be equivalent.
+ const bool bHasControlFocus = GetImpl()->HasControlFocus();
+
+ if ( bHasControlFocus )
+ {
+ Window* pWindow( dynamic_cast< Window* >( &i_rDevice ) );
+ OSL_ENSURE( pWindow, "FmFormShell::ToggleControlFocus: I need a Window, really!" );
+ if ( pWindow )
+ pWindow->GrabFocus();
+ }
+ else
+ {
+ Reference< XControl > xControl;
+ GetFormControl( i_rUnoObject.GetUnoControlModel(), i_rView, i_rDevice, xControl );
+ Reference< XWindow > xControlWindow( xControl, UNO_QUERY );
+ if ( xControlWindow.is() )
+ xControlWindow->setFocus();
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//------------------------------------------------------------------------
+namespace
+{
+ class FocusableControlsFilter : public ::svx::ISdrObjectFilter
+ {
+ public:
+ FocusableControlsFilter( const SdrView& i_rView, const OutputDevice& i_rDevice )
+ :m_rView( i_rView )
+ ,m_rDevice( i_rDevice )
+ {
+ }
+
+ public:
+ virtual bool includeObject( const SdrObject& i_rObject ) const
+ {
+ const SdrUnoObj* pUnoObj = dynamic_cast< const SdrUnoObj* >( &i_rObject );
+ if ( !pUnoObj )
+ return false;
+
+ Reference< XControl > xControl = pUnoObj->GetUnoControl( m_rView, m_rDevice );
+ return FmXFormView::isFocusable( xControl );
+ }
+
+ private:
+ const SdrView& m_rView;
+ const OutputDevice& m_rDevice;
+ };
+}
+
+//------------------------------------------------------------------------
+::std::auto_ptr< ::svx::ISdrObjectFilter > FmFormShell::CreateFocusableControlFilter( const SdrView& i_rView, const OutputDevice& i_rDevice ) const
+{
+ ::std::auto_ptr< ::svx::ISdrObjectFilter > pFilter;
+
+ if ( !i_rView.IsDesignMode() )
+ pFilter.reset( new FocusableControlsFilter( i_rView, i_rDevice ) );
+
+ return pFilter;
+}
+
+//------------------------------------------------------------------------
+SdrUnoObj* FmFormShell::GetFormControl( const Reference< XControlModel >& _rxModel, const SdrView& _rView, const OutputDevice& _rDevice, Reference< XControl >& _out_rxControl ) const
+{
+ if ( !_rxModel.is() )
+ return NULL;
+
+ // we can only retrieve controls for SdrObjects which belong to page which is actually displayed in the given view
+ SdrPageView* pPageView = _rView.GetSdrPageView();
+ SdrPage* pPage = pPageView ? pPageView->GetPage() : NULL;
+ OSL_ENSURE( pPage, "FmFormShell::GetFormControl: no page displayed in the given view!" );
+ if ( !pPage )
+ return NULL;
+
+ SdrUnoObj* pUnoObject = lcl_findUnoObject( *pPage, _rxModel );
+ if ( pUnoObject )
+ {
+ _out_rxControl = pUnoObject->GetUnoControl( _rView, _rDevice );
+ return pUnoObject;
+ }
+
+#if OSL_DEBUG_LEVEL > 0
+ // perhaps we are fed with a control model which lives on a page other than the one displayed
+ // in the given view. This is worth being reported as error, in non-product builds.
+ FmFormModel* pModel = GetFormModel();
+ if ( pModel )
+ {
+ sal_uInt16 pageCount = pModel->GetPageCount();
+ for ( sal_uInt16 page = 0; page < pageCount; ++page )
+ {
+ pPage = pModel->GetPage( page );
+ OSL_ENSURE( pPage, "FmFormShell::GetFormControl: NULL page encountered!" );
+ if ( !pPage )
+ continue;
+
+ pUnoObject = lcl_findUnoObject( *pPage, _rxModel );
+ OSL_ENSURE( !pUnoObject, "FmFormShell::GetFormControl: the given control model belongs to a wrong page (displayed elsewhere)!" );
+ }
+ }
+#endif
+
+ return NULL;
+}
+
+//------------------------------------------------------------------------
+Reference< runtime::XFormController > FmFormShell::GetFormController( const Reference< XForm >& _rxForm, const SdrView& _rView, const OutputDevice& _rDevice ) const
+{
+ const FmFormView* pFormView = dynamic_cast< const FmFormView* >( &_rView );
+ if ( !pFormView )
+ return NULL;
+
+ return pFormView->GetFormController( _rxForm, _rDevice );
+}
+
+//------------------------------------------------------------------------
+void FmFormShell::SetDesignMode( sal_Bool _bDesignMode )
+{
+ if ( _bDesignMode == m_bDesignMode )
+ return;
+
+ FmFormModel* pModel = GetFormModel();
+ if (pModel)
+ // fuer die Zeit des Uebergangs das Undo-Environment ausschalten, das sichert, dass man dort auch nicht-transiente
+ // Properties mal eben aendern kann (sollte allerdings mit Vorsicht genossen und beim Rueckschalten des Modes
+ // auch immer wieder rueckgaegig gemacht werden. Ein Beispiel ist das Setzen der maximalen Text-Laenge durch das
+ // OEditModel an seinem Control.)
+ pModel->GetUndoEnv().Lock();
+
+ // dann die eigentliche Umschaltung
+ if ( m_bDesignMode || PrepareClose( sal_True ) )
+ impl_setDesignMode(!m_bDesignMode );
+
+ // und mein Undo-Environment wieder an
+ if ( pModel )
+ pModel->GetUndoEnv().UnLock();
+}
diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
new file mode 100644
index 000000000000..2ff40610fa77
--- /dev/null
+++ b/svx/source/form/fmshimp.cxx
@@ -0,0 +1,4259 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "fmitems.hxx"
+#include "fmobj.hxx"
+#include "fmpgeimp.hxx"
+#include "svx/fmtools.hxx"
+#include "fmprop.hrc"
+#include "svx/fmresids.hrc"
+#include "fmservs.hxx"
+#include "fmshimp.hxx"
+#include "fmtextcontrolshell.hxx"
+#include "fmundo.hxx"
+#include "fmurl.hxx"
+#include "fmvwimp.hxx"
+#include "formtoolbars.hxx"
+#include "gridcols.hxx"
+#include "svx/svditer.hxx"
+#include "svx/dialmgr.hxx"
+#include "svx/dialogs.hrc"
+#include "svx/fmglob.hxx"
+#include "svx/fmmodel.hxx"
+#include "svx/fmpage.hxx"
+#include "svx/fmshell.hxx"
+#include "svx/obj3d.hxx"
+#include "svx/sdrpagewindow.hxx"
+#include "svx/svdpagv.hxx"
+#include "svx/svxdlg.hxx"
+#include "svx/svxids.hrc"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/XWindow2.hpp>
+#include <com/sun/star/awt/XCheckBox.hpp>
+#include <com/sun/star/awt/XListBox.hpp>
+#include <com/sun/star/awt/XTextComponent.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/container/XContainer.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/form/ListSourceType.hpp>
+#include <com/sun/star/form/XBoundComponent.hpp>
+#include <com/sun/star/form/XBoundControl.hpp>
+#include <com/sun/star/form/XGrid.hpp>
+#include <com/sun/star/form/XGridPeer.hpp>
+#include <com/sun/star/form/XLoadable.hpp>
+#include <com/sun/star/form/XReset.hpp>
+#include <com/sun/star/form/binding/XBindableValue.hpp>
+#include <com/sun/star/form/binding/XListEntrySink.hpp>
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#include <com/sun/star/script/XEventAttacherManager.hpp>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/util/XCancellable.hpp>
+#include <com/sun/star/util/XModeSelector.hpp>
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/beans/XIntrospection.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/extract.hxx>
+#include <comphelper/evtmethodhelper.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/property.hxx>
+#include <comphelper/stl_types.hxx>
+#include <connectivity/dbtools.hxx>
+#include <cppuhelper/servicefactory.hxx>
+#include <osl/mutex.hxx>
+#include <rtl/logfile.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/frame.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/viewsh.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <tools/color.hxx>
+#include <tools/diagnose_ex.h>
+#include <tools/shl.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/waitobj.hxx>
+#include <vos/mutex.hxx>
+
+#include <algorithm>
+#include <functional>
+
+// wird fuer Invalidate verwendet -> mitpflegen
+sal_uInt16 DatabaseSlotMap[] =
+{
+ SID_FM_RECORD_FIRST,
+ SID_FM_RECORD_NEXT,
+ SID_FM_RECORD_PREV,
+ SID_FM_RECORD_LAST,
+ SID_FM_RECORD_NEW,
+ SID_FM_RECORD_DELETE,
+ SID_FM_RECORD_ABSOLUTE,
+ SID_FM_RECORD_TOTAL,
+ SID_FM_RECORD_SAVE,
+ SID_FM_RECORD_UNDO,
+ SID_FM_REMOVE_FILTER_SORT,
+ SID_FM_SORTUP,
+ SID_FM_SORTDOWN,
+ SID_FM_ORDERCRIT,
+ SID_FM_AUTOFILTER,
+ SID_FM_FORM_FILTERED,
+ SID_FM_REFRESH,
+ SID_FM_REFRESH_FORM_CONTROL,
+ SID_FM_SEARCH,
+ SID_FM_FILTER_START,
+ SID_FM_VIEW_AS_GRID,
+ 0
+};
+
+// wird fuer Invalidate verwendet -> mitpflegen
+// aufsteigend sortieren !!!!!!
+sal_Int16 DlgSlotMap[] = // slots des Controllers
+{
+ SID_FM_CTL_PROPERTIES,
+ SID_FM_PROPERTIES,
+ SID_FM_TAB_DIALOG,
+ SID_FM_ADD_FIELD,
+ SID_FM_SHOW_FMEXPLORER,
+ SID_FM_FIELDS_CONTROL,
+ SID_FM_SHOW_PROPERTIES,
+ SID_FM_PROPERTY_CONTROL,
+ SID_FM_FMEXPLORER_CONTROL,
+ SID_FM_SHOW_DATANAVIGATOR,
+ SID_FM_DATANAVIGATOR_CONTROL,
+ 0
+};
+
+sal_Int16 SelObjectSlotMap[] = // vom SelObject abhaengige Slots
+{
+ SID_FM_CONVERTTO_EDIT,
+ SID_FM_CONVERTTO_BUTTON,
+ SID_FM_CONVERTTO_FIXEDTEXT,
+ SID_FM_CONVERTTO_LISTBOX,
+ SID_FM_CONVERTTO_CHECKBOX,
+ SID_FM_CONVERTTO_RADIOBUTTON,
+ SID_FM_CONVERTTO_GROUPBOX,
+ SID_FM_CONVERTTO_COMBOBOX,
+ SID_FM_CONVERTTO_IMAGEBUTTON,
+ SID_FM_CONVERTTO_FILECONTROL,
+ SID_FM_CONVERTTO_DATE,
+ SID_FM_CONVERTTO_TIME,
+ SID_FM_CONVERTTO_NUMERIC,
+ SID_FM_CONVERTTO_CURRENCY,
+ SID_FM_CONVERTTO_PATTERN,
+ SID_FM_CONVERTTO_IMAGECONTROL,
+ SID_FM_CONVERTTO_FORMATTED,
+ SID_FM_CONVERTTO_SCROLLBAR,
+ SID_FM_CONVERTTO_SPINBUTTON,
+ SID_FM_CONVERTTO_NAVIGATIONBAR,
+
+ SID_FM_FMEXPLORER_CONTROL,
+ SID_FM_DATANAVIGATOR_CONTROL,
+
+ 0
+};
+
+// die folgenden Arrays muessen kosistent sein, also einander entsprechende Eintraege an der selben relativen Position
+// innerhalb ihres jeweiligen Arrays stehen
+sal_Int16 nConvertSlots[] =
+{
+ SID_FM_CONVERTTO_EDIT,
+ SID_FM_CONVERTTO_BUTTON,
+ SID_FM_CONVERTTO_FIXEDTEXT,
+ SID_FM_CONVERTTO_LISTBOX,
+ SID_FM_CONVERTTO_CHECKBOX,
+ SID_FM_CONVERTTO_RADIOBUTTON,
+ SID_FM_CONVERTTO_GROUPBOX,
+ SID_FM_CONVERTTO_COMBOBOX,
+ SID_FM_CONVERTTO_IMAGEBUTTON,
+ SID_FM_CONVERTTO_FILECONTROL,
+ SID_FM_CONVERTTO_DATE,
+ SID_FM_CONVERTTO_TIME,
+ SID_FM_CONVERTTO_NUMERIC,
+ SID_FM_CONVERTTO_CURRENCY,
+ SID_FM_CONVERTTO_PATTERN,
+ SID_FM_CONVERTTO_IMAGECONTROL,
+ SID_FM_CONVERTTO_FORMATTED,
+ SID_FM_CONVERTTO_SCROLLBAR,
+ SID_FM_CONVERTTO_SPINBUTTON,
+ SID_FM_CONVERTTO_NAVIGATIONBAR
+};
+
+sal_Int16 nCreateSlots[] =
+{
+ SID_FM_EDIT,
+ SID_FM_PUSHBUTTON,
+ SID_FM_FIXEDTEXT,
+ SID_FM_LISTBOX,
+ SID_FM_CHECKBOX,
+ SID_FM_RADIOBUTTON,
+ SID_FM_GROUPBOX,
+ SID_FM_COMBOBOX,
+ SID_FM_IMAGEBUTTON,
+ SID_FM_FILECONTROL,
+ SID_FM_DATEFIELD,
+ SID_FM_TIMEFIELD,
+ SID_FM_NUMERICFIELD,
+ SID_FM_CURRENCYFIELD,
+ SID_FM_PATTERNFIELD,
+ SID_FM_IMAGECONTROL,
+ SID_FM_FORMATTEDFIELD,
+ SID_FM_SCROLLBAR,
+ SID_FM_SPINBUTTON,
+ SID_FM_NAVIGATIONBAR
+};
+
+sal_Int16 nObjectTypes[] =
+{
+ OBJ_FM_EDIT,
+ OBJ_FM_BUTTON,
+ OBJ_FM_FIXEDTEXT,
+ OBJ_FM_LISTBOX,
+ OBJ_FM_CHECKBOX,
+ OBJ_FM_RADIOBUTTON,
+ OBJ_FM_GROUPBOX,
+ OBJ_FM_COMBOBOX,
+ OBJ_FM_IMAGEBUTTON,
+ OBJ_FM_FILECONTROL,
+ OBJ_FM_DATEFIELD,
+ OBJ_FM_TIMEFIELD,
+ OBJ_FM_NUMERICFIELD,
+ OBJ_FM_CURRENCYFIELD,
+ OBJ_FM_PATTERNFIELD,
+ OBJ_FM_IMAGECONTROL,
+ OBJ_FM_FORMATTEDFIELD,
+ OBJ_FM_SCROLLBAR,
+ OBJ_FM_SPINBUTTON,
+ OBJ_FM_NAVIGATIONBAR
+};
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::ui;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::form;
+using namespace ::com::sun::star::form::binding;
+using namespace ::com::sun::star::form::runtime;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::view;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::script;
+using namespace ::svxform;
+using namespace ::svx;
+
+//==============================================================================
+//= helper
+//==============================================================================
+namespace
+{
+ //..........................................................................
+ void collectInterfacesFromMarkList( const SdrMarkList& _rMarkList, InterfaceBag& /* [out] */ _rInterfaces )
+ {
+ _rInterfaces.clear();
+
+ sal_uInt32 nMarkCount = _rMarkList.GetMarkCount();
+ for ( sal_uInt32 i = 0; i < nMarkCount; ++i)
+ {
+ SdrObject* pCurrent = _rMarkList.GetMark( i )->GetMarkedSdrObj();
+
+ SdrObjListIter* pGroupIterator = NULL;
+ if ( pCurrent->IsGroupObject() )
+ {
+ pGroupIterator = new SdrObjListIter( *pCurrent->GetSubList() );
+ pCurrent = pGroupIterator->IsMore() ? pGroupIterator->Next() : NULL;
+ }
+
+ while ( pCurrent )
+ {
+ FmFormObj* pAsFormObject = FmFormObj::GetFormObject( pCurrent );
+ // note this will de-reference virtual objects, if necessary/possible
+ if ( pAsFormObject )
+ {
+ Reference< XInterface > xControlModel( pAsFormObject->GetUnoControlModel(), UNO_QUERY );
+ // the UNO_QUERY is important for normalization
+ if ( xControlModel.is() )
+ _rInterfaces.insert( xControlModel );
+ }
+
+ // next element
+ pCurrent = pGroupIterator && pGroupIterator->IsMore() ? pGroupIterator->Next() : NULL;
+ }
+
+ if ( pGroupIterator )
+ delete pGroupIterator;
+ }
+ }
+
+ //..........................................................................
+ sal_Int16 GridView2ModelPos(const Reference< XIndexAccess>& rColumns, sal_Int16 nViewPos)
+ {
+ try
+ {
+ if (rColumns.is())
+ {
+ // loop through all columns
+ sal_Int16 i;
+ Reference< XPropertySet> xCur;
+ for (i=0; i<rColumns->getCount(); ++i)
+ {
+ rColumns->getByIndex(i) >>= xCur;
+ if (!::comphelper::getBOOL(xCur->getPropertyValue(FM_PROP_HIDDEN)))
+ {
+ // for every visible col : if nViewPos is greater zero, decrement it, else we
+ // have found the model position
+ if (!nViewPos)
+ break;
+ else
+ --nViewPos;
+ }
+ }
+ if (i<rColumns->getCount())
+ return i;
+ }
+ }
+ catch(const Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return (sal_Int16)-1;
+ }
+
+ //..........................................................................
+ void TransferEventScripts(const Reference< XControlModel>& xModel, const Reference< XControl>& xControl,
+ const Sequence< ScriptEventDescriptor>& rTransferIfAvailable)
+ {
+ // first check if we have a XEventAttacherManager for the model
+ Reference< XChild> xModelChild(xModel, UNO_QUERY);
+ if (!xModelChild.is())
+ return; // nothing to do
+
+ Reference< XEventAttacherManager> xEventManager(xModelChild->getParent(), UNO_QUERY);
+ if (!xEventManager.is())
+ return; // nothing to do
+
+ if (!rTransferIfAvailable.getLength())
+ return; // nothing to do
+
+ // check for the index of the model within it's parent
+ Reference< XIndexAccess> xParentIndex(xModelChild->getParent(), UNO_QUERY);
+ if (!xParentIndex.is())
+ return; // nothing to do
+ sal_Int32 nIndex = getElementPos(xParentIndex, xModel);
+ if (nIndex<0 || nIndex>=xParentIndex->getCount())
+ return; // nothing to do
+
+ // then we need informations about the listeners supported by the control and the model
+ Sequence< Type> aModelListeners;
+ Sequence< Type> aControlListeners;
+
+ Reference< XIntrospection> xModelIntrospection(::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.beans.Introspection")), UNO_QUERY);
+ Reference< XIntrospection> xControlIntrospection(::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.beans.Introspection")), UNO_QUERY);
+
+ if (xModelIntrospection.is() && xModel.is())
+ {
+ Any aModel(makeAny(xModel));
+ aModelListeners = xModelIntrospection->inspect(aModel)->getSupportedListeners();
+ }
+
+ if (xControlIntrospection.is() && xControl.is())
+ {
+ Any aControl(makeAny(xControl));
+ aControlListeners = xControlIntrospection->inspect(aControl)->getSupportedListeners();
+ }
+
+ sal_Int32 nMaxNewLen = aModelListeners.getLength() + aControlListeners.getLength();
+ if (!nMaxNewLen)
+ return; // the model and the listener don't support any listeners (or we were unable to retrieve these infos)
+
+ Sequence< ScriptEventDescriptor> aTransferable(nMaxNewLen);
+ ScriptEventDescriptor* pTransferable = aTransferable.getArray();
+
+ const ScriptEventDescriptor* pCurrent = rTransferIfAvailable.getConstArray();
+ sal_Int32 i,j,k;
+ for (i=0; i<rTransferIfAvailable.getLength(); ++i, ++pCurrent)
+ {
+ // search the model/control idl classes for the event described by pCurrent
+ for ( Sequence< Type>* pCurrentArray = &aModelListeners;
+ pCurrentArray;
+ pCurrentArray = (pCurrentArray == &aModelListeners) ? &aControlListeners : NULL
+ )
+ {
+ const Type* pCurrentListeners = pCurrentArray->getConstArray();
+ for (j=0; j<pCurrentArray->getLength(); ++j, ++pCurrentListeners)
+ {
+ UniString aListener = (*pCurrentListeners).getTypeName();
+ xub_StrLen nTokens = aListener.GetTokenCount('.');
+ if (nTokens)
+ aListener = aListener.GetToken(nTokens - 1, '.');
+
+ if (aListener == pCurrent->ListenerType.getStr())
+ // the current ScriptEventDescriptor doesn't match the current listeners class
+ continue;
+
+ // now check the methods
+ Sequence< ::rtl::OUString> aMethodsNames = ::comphelper::getEventMethodsForType(*pCurrentListeners);
+
+ const ::rtl::OUString* pMethodsNames = aMethodsNames.getConstArray();
+ for (k=0; k<aMethodsNames.getLength(); ++k, ++pMethodsNames)
+ {
+ if ((*pMethodsNames).compareTo(pCurrent->EventMethod) != COMPARE_EQUAL)
+ // the current ScriptEventDescriptor doesn't match the current listeners current method
+ continue;
+
+ // we can transfer the script event : the model (control) supports it
+ *pTransferable = *pCurrent;
+ ++pTransferable;
+ break;
+ }
+ if (k<aMethodsNames.getLength())
+ break;
+ }
+ }
+ }
+
+ sal_Int32 nRealNewLen = pTransferable - aTransferable.getArray();
+ aTransferable.realloc(nRealNewLen);
+
+ xEventManager->registerScriptEvents(nIndex, aTransferable);
+ }
+
+ //------------------------------------------------------------------------------
+ ::rtl::OUString getServiceNameByControlType(sal_Int16 nType)
+ {
+ switch (nType)
+ {
+ case OBJ_FM_EDIT : return FM_COMPONENT_TEXTFIELD;
+ case OBJ_FM_BUTTON : return FM_COMPONENT_COMMANDBUTTON;
+ case OBJ_FM_FIXEDTEXT : return FM_COMPONENT_FIXEDTEXT;
+ case OBJ_FM_LISTBOX : return FM_COMPONENT_LISTBOX;
+ case OBJ_FM_CHECKBOX : return FM_COMPONENT_CHECKBOX;
+ case OBJ_FM_RADIOBUTTON : return FM_COMPONENT_RADIOBUTTON;
+ case OBJ_FM_GROUPBOX : return FM_COMPONENT_GROUPBOX;
+ case OBJ_FM_COMBOBOX : return FM_COMPONENT_COMBOBOX;
+ case OBJ_FM_GRID : return FM_COMPONENT_GRIDCONTROL;
+ case OBJ_FM_IMAGEBUTTON : return FM_COMPONENT_IMAGEBUTTON;
+ case OBJ_FM_FILECONTROL : return FM_COMPONENT_FILECONTROL;
+ case OBJ_FM_DATEFIELD : return FM_COMPONENT_DATEFIELD;
+ case OBJ_FM_TIMEFIELD : return FM_COMPONENT_TIMEFIELD;
+ case OBJ_FM_NUMERICFIELD : return FM_COMPONENT_NUMERICFIELD;
+ case OBJ_FM_CURRENCYFIELD : return FM_COMPONENT_CURRENCYFIELD;
+ case OBJ_FM_PATTERNFIELD : return FM_COMPONENT_PATTERNFIELD;
+ case OBJ_FM_HIDDEN : return FM_COMPONENT_HIDDENCONTROL;
+ case OBJ_FM_IMAGECONTROL : return FM_COMPONENT_IMAGECONTROL;
+ case OBJ_FM_FORMATTEDFIELD : return FM_COMPONENT_FORMATTEDFIELD;
+ case OBJ_FM_SCROLLBAR : return FM_SUN_COMPONENT_SCROLLBAR;
+ case OBJ_FM_SPINBUTTON : return FM_SUN_COMPONENT_SPINBUTTON;
+ case OBJ_FM_NAVIGATIONBAR : return FM_SUN_COMPONENT_NAVIGATIONBAR;
+ }
+ return ::rtl::OUString();
+ }
+
+}
+
+//------------------------------------------------------------------------------
+// check if the control has one of the interfaces we can use for searching
+// *_pCurrentText will be filled with the current text of the control (as used when searching this control)
+sal_Bool IsSearchableControl( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rxControl,
+ ::rtl::OUString* _pCurrentText )
+{
+ if ( !_rxControl.is() )
+ return sal_False;
+
+ Reference< XTextComponent > xAsText( _rxControl, UNO_QUERY );
+ if ( xAsText.is() )
+ {
+ if ( _pCurrentText )
+ *_pCurrentText = xAsText->getText();
+ return sal_True;
+ }
+
+ Reference< XListBox > xListBox( _rxControl, UNO_QUERY );
+ if ( xListBox.is() )
+ {
+ if ( _pCurrentText )
+ *_pCurrentText = xListBox->getSelectedItem();
+ return sal_True;
+ }
+
+ Reference< XCheckBox > xCheckBox( _rxControl, UNO_QUERY );
+ if ( xCheckBox.is() )
+ {
+ if ( _pCurrentText )
+ {
+ switch ( (TriState)xCheckBox->getState() )
+ {
+ case STATE_NOCHECK: *_pCurrentText = ::rtl::OUString::createFromAscii( "0" ); break;
+ case STATE_CHECK: *_pCurrentText = ::rtl::OUString::createFromAscii( "1" ); break;
+ default: *_pCurrentText = ::rtl::OUString(); break;
+ }
+ }
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+//------------------------------------------------------------------------------
+sal_Bool FmXBoundFormFieldIterator::ShouldStepInto(const Reference< XInterface>& _rContainer) const
+{
+ if (_rContainer == m_xStartingPoint)
+ // would be quite stupid to step over the root ....
+ return sal_True;
+
+ return Reference< XControlModel>(_rContainer, UNO_QUERY).is();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool FmXBoundFormFieldIterator::ShouldHandleElement(const Reference< XInterface>& _rElement)
+{
+ if (!_rElement.is())
+ // NULL element
+ return sal_False;
+
+ if (Reference< XForm>(_rElement, UNO_QUERY).is() || Reference< XGrid>(_rElement, UNO_QUERY).is())
+ // a forms or a grid
+ return sal_False;
+
+ Reference< XPropertySet> xSet(_rElement, UNO_QUERY);
+ if (!xSet.is() || !::comphelper::hasProperty(FM_PROP_BOUNDFIELD, xSet))
+ // no "BoundField" property
+ return sal_False;
+
+ Any aVal( xSet->getPropertyValue(FM_PROP_BOUNDFIELD) );
+ if (aVal.getValueTypeClass() != TypeClass_INTERFACE)
+ // void or invalid property value
+ return sal_False;
+
+ return aVal.hasValue();
+}
+
+//------------------------------------------------------------------------------
+sal_Bool isControlList(const SdrMarkList& rMarkList)
+{
+ // enthaelt die liste nur Controls und mindestens ein control
+ sal_uInt32 nMarkCount = rMarkList.GetMarkCount();
+ sal_Bool bControlList = nMarkCount != 0;
+
+ sal_Bool bHadAnyLeafs = sal_False;
+
+ for (sal_uInt32 i = 0; i < nMarkCount && bControlList; i++)
+ {
+ SdrObject *pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
+ E3dObject* pAs3DObject = PTR_CAST(E3dObject, pObj);
+ // E3dObject's do not contain any 2D-objects (by definition)
+ // we need this extra check here : an E3dObject->IsGroupObject says "YES", but an SdrObjListIter working
+ // with an E3dObject doesn't give me any Nodes (E3dObject has a sub list, but no members in that list,
+ // cause there implementation differs from the one of "normal" SdrObject's. Unfortunally SdrObject::IsGroupObject
+ // doesn't check the element count of the sub list, which is simply a bug in IsGroupObject we can't fix at the moment).
+ // So at the end of this function bControlList would have the same value it was initialized with above : sal_True
+ // And this would be wrong :)
+ // 03.02.00 - 72529 - FS
+ if (!pAs3DObject)
+ {
+ if (pObj->IsGroupObject())
+ {
+ SdrObjListIter aIter(*pObj->GetSubList());
+ while (aIter.IsMore() && bControlList)
+ {
+ bControlList = FmFormInventor == aIter.Next()->GetObjInventor();
+ bHadAnyLeafs = sal_True;
+ }
+ }
+ else
+ {
+ bHadAnyLeafs = sal_True;
+ bControlList = FmFormInventor == pObj->GetObjInventor();
+ }
+ }
+ }
+
+ return bControlList && bHadAnyLeafs;
+}
+
+//------------------------------------------------------------------------
+Reference< XForm > GetForm(const Reference< XInterface>& _rxElement)
+{
+ Reference< XForm > xForm( _rxElement, UNO_QUERY );
+ if ( xForm.is() )
+ return xForm;
+
+ Reference< XChild > xChild( _rxElement, UNO_QUERY );
+ if ( xChild.is() )
+ return GetForm( xChild->getParent() );
+
+ return Reference< XForm >();
+}
+
+//========================================================================
+// class FmXFormShell_Base_Disambiguation
+//========================================================================
+FmXFormShell_Base_Disambiguation::FmXFormShell_Base_Disambiguation( ::osl::Mutex& _rMutex )
+ :FmXFormShell_BD_BASE( _rMutex )
+{
+}
+
+void SAL_CALL FmXFormShell_Base_Disambiguation::disposing()
+{
+ WeakComponentImplHelperBase::disposing();
+ // Note:
+ // This is a HACK.
+ // Normally it should be sufficient to call the "disposing" of our direct
+ // base class, but SUN PRO 5 does not like this and claims there is a conflict
+ // with the XEventListener::disposing(EventObject) of our various listener
+ // base classes.
+}
+
+//========================================================================
+// class FmXFormShell
+//========================================================================
+DBG_NAME(FmXFormShell);
+//------------------------------------------------------------------------
+FmXFormShell::FmXFormShell( FmFormShell& _rShell, SfxViewFrame* _pViewFrame )
+ :FmXFormShell_BASE(m_aMutex)
+ ,FmXFormShell_CFGBASE(::rtl::OUString::createFromAscii("Office.Common/Misc"), CONFIG_MODE_DELAYED_UPDATE)
+ ,m_eNavigate( NavigationBarMode_NONE )
+ ,m_nInvalidationEvent( 0 )
+ ,m_nActivationEvent( 0 )
+ ,m_pShell( &_rShell )
+ ,m_pTextShell( new ::svx::FmTextControlShell( _pViewFrame ) )
+ ,m_aActiveControllerFeatures( ::comphelper::getProcessServiceFactory(), this )
+ ,m_aNavControllerFeatures( ::comphelper::getProcessServiceFactory(), this )
+ ,m_eDocumentType( eUnknownDocumentType )
+ ,m_nLockSlotInvalidation( 0 )
+ ,m_bHadPropertyBrowserInDesignMode( sal_False )
+ ,m_bTrackProperties( sal_True )
+ ,m_bUseWizards( sal_True )
+ ,m_bDatabaseBar( sal_False )
+ ,m_bInActivate( sal_False )
+ ,m_bSetFocus( sal_False )
+ ,m_bFilterMode( sal_False )
+ ,m_bChangingDesignMode( sal_False )
+ ,m_bPreparedClose( sal_False )
+ ,m_bFirstActivation( sal_True )
+{
+ DBG_CTOR(FmXFormShell,NULL);
+ m_aMarkTimer.SetTimeout(100);
+ m_aMarkTimer.SetTimeoutHdl(LINK(this,FmXFormShell,OnTimeOut));
+
+ if ( _pViewFrame )
+ m_xAttachedFrame = _pViewFrame->GetFrame().GetFrameInterface();
+
+ // to prevent deletion of this we acquire our refcounter once
+ ::comphelper::increment(FmXFormShell_BASE::m_refCount);
+
+ // correct the refcounter
+ ::comphelper::decrement(FmXFormShell_BASE::m_refCount);
+
+ // cache the current configuration settings we're interested in
+ implAdjustConfigCache();
+ // and register for changes on this settings
+ Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString::createFromAscii("FormControlPilotsEnabled");
+ EnableNotification(aNames);
+}
+
+//------------------------------------------------------------------------
+FmXFormShell::~FmXFormShell()
+{
+ delete m_pTextShell;
+ DBG_DTOR(FmXFormShell,NULL);
+}
+
+//------------------------------------------------------------------
+Reference< XModel > FmXFormShell::getContextDocument() const
+{
+ Reference< XModel > xModel;
+
+ // determine the type of document we live in
+ try
+ {
+ Reference< XController > xController;
+ if ( m_xAttachedFrame.is() )
+ xController = m_xAttachedFrame->getController();
+ if ( xController.is() )
+ xModel = xController->getModel();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return xModel;
+}
+
+//------------------------------------------------------------------
+bool FmXFormShell::isEnhancedForm() const
+{
+ return getDocumentType() == eEnhancedForm;
+}
+
+//------------------------------------------------------------------
+bool FmXFormShell::impl_checkDisposed() const
+{
+ if ( !m_pShell )
+ {
+ OSL_ENSURE( false, "FmXFormShell::impl_checkDisposed: already disposed!" );
+ return true;
+ }
+ return false;
+}
+
+//------------------------------------------------------------------
+::svxform::DocumentType FmXFormShell::getDocumentType() const
+{
+ if ( m_eDocumentType != eUnknownDocumentType )
+ return m_eDocumentType;
+
+ // determine the type of document we live in
+ Reference< XModel > xModel = getContextDocument();
+ if ( xModel.is() )
+ m_eDocumentType = DocumentClassification::classifyDocument( xModel );
+ else
+ {
+ OSL_ENSURE( sal_False, "FmXFormShell::getDocumentType: can't determine the document type!" );
+ m_eDocumentType = eTextDocument;
+ // fallback, just to have a defined state
+ }
+
+ return m_eDocumentType;
+}
+
+//------------------------------------------------------------------
+bool FmXFormShell::IsReadonlyDoc() const
+{
+ if ( impl_checkDisposed() )
+ return true;
+
+ FmFormModel* pModel = m_pShell->GetFormModel();
+ if ( pModel && pModel->GetObjectShell() )
+ return pModel->GetObjectShell()->IsReadOnly() || pModel->GetObjectShell()->IsReadOnlyUI();
+ return true;
+}
+
+//------------------------------------------------------------------
+Any SAL_CALL FmXFormShell::queryInterface( const Type& type) throw ( RuntimeException )
+{
+ return FmXFormShell_BASE::queryInterface(type);
+}
+//------------------------------------------------------------------------------
+Sequence< Type > SAL_CALL FmXFormShell::getTypes( ) throw(RuntimeException)
+{
+ return FmXFormShell_BASE::getTypes();
+}
+//------------------------------------------------------------------------------
+Sequence< sal_Int8 > SAL_CALL FmXFormShell::getImplementationId() throw(RuntimeException)
+{
+ static ::cppu::OImplementationId* pId = 0;
+ if (! pId)
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if (! pId)
+ {
+ static ::cppu::OImplementationId aId;
+ pId = &aId;
+ }
+ }
+ return pId->getImplementationId();
+}
+// EventListener
+//------------------------------------------------------------------------------
+void SAL_CALL FmXFormShell::disposing(const EventObject& e) throw( RuntimeException )
+{
+ impl_checkDisposed();
+
+ if (m_xActiveController == e.Source)
+ {
+ // wird der Controller freigeben dann alles loslassen
+ stopListening();
+ m_xActiveForm = NULL;
+ m_xActiveController = NULL;
+ m_xNavigationController = NULL;
+
+ m_aActiveControllerFeatures.dispose();
+ m_aNavControllerFeatures.dispose();
+
+ if ( m_pShell )
+ m_pShell->GetViewShell()->GetViewFrame()->GetBindings().InvalidateShell(*m_pShell);
+ }
+
+ if (e.Source == m_xExternalViewController)
+ {
+ Reference< runtime::XFormController > xFormController( m_xExternalViewController, UNO_QUERY );
+ OSL_ENSURE( xFormController.is(), "FmXFormShell::disposing: invalid external view controller!" );
+ if (xFormController.is())
+ xFormController->removeActivateListener((XFormControllerListener*)this);
+
+ Reference< ::com::sun::star::lang::XComponent> xComp(m_xExternalViewController, UNO_QUERY);
+ if (xComp.is())
+ xComp->removeEventListener((XEventListener*)(XPropertyChangeListener*)this);
+
+ m_xExternalViewController = NULL;
+ m_xExternalDisplayedForm = NULL;
+ m_xExtViewTriggerController = NULL;
+
+ InvalidateSlot( SID_FM_VIEW_AS_GRID, sal_False );
+ }
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXFormShell::propertyChange(const PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException)
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ if (evt.PropertyName == FM_PROP_ROWCOUNT)
+ {
+ // Das gleich folgenden Update erzwingt ein Neu-Painten der entsprechenden Slots. Wenn ich mich aber hier nicht
+ // in dem HauptThread der Applikation befinde (weil zum Beispiel ein Cursor gerade Datensaetze zaehlt und mir dabei
+ // immer diese PropertyChanges beschert), kann sich das mit en normalen Paints im HauptThread der Applikation beissen.
+ // (Solche Paints passieren zum Beispiel, wenn man einfach nur eine andere Applikation ueber das Office legt und wieder
+ // zurueckschaltet).
+ // Deshalb die Benutzung des SolarMutex, der sichert das ab.
+ ::vos::IMutex& rSolarSafety = Application::GetSolarMutex();
+ if (rSolarSafety.tryToAcquire())
+ {
+ m_pShell->GetViewShell()->GetViewFrame()->GetBindings().Invalidate(SID_FM_RECORD_TOTAL , sal_True, sal_False);
+ m_pShell->GetViewShell()->GetViewFrame()->GetBindings().Update(SID_FM_RECORD_TOTAL);
+ rSolarSafety.release();
+ }
+ else
+ {
+ // with the following the slot is invalidated asynchron
+ LockSlotInvalidation(sal_True);
+ InvalidateSlot(SID_FM_RECORD_TOTAL, sal_False);
+ LockSlotInvalidation(sal_False);
+ }
+ }
+
+ // this may be called from a non-main-thread so invalidate the shell asynchronously
+ LockSlotInvalidation(sal_True);
+ InvalidateSlot(0, 0); // special meaning : invalidate m_pShell
+ LockSlotInvalidation(sal_False);
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::invalidateFeatures( const ::std::vector< sal_Int32 >& _rFeatures )
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ OSL_ENSURE( _rFeatures.size() > 0, "FmXFormShell::invalidateFeatures: invalid arguments!" );
+
+ if ( m_pShell->GetViewShell() && m_pShell->GetViewShell()->GetViewFrame() )
+ {
+ // unfortunately, SFX requires sal_uInt16
+ ::std::vector< sal_uInt16 > aSlotIds;
+ aSlotIds.reserve( _rFeatures.size() );
+ ::std::copy( _rFeatures.begin(),
+ _rFeatures.end(),
+ ::std::insert_iterator< ::std::vector< sal_uInt16 > >( aSlotIds, aSlotIds.begin() )
+ );
+
+ // furthermore, SFX wants a terminating 0
+ aSlotIds.push_back( 0 );
+
+ // and, last but not least, SFX wants the ids to be sorted
+ ::std::sort( aSlotIds.begin(), aSlotIds.end() - 1 );
+
+ sal_uInt16 *pSlotIds = aSlotIds.empty() ? 0 : &(aSlotIds[0]);
+ m_pShell->GetViewShell()->GetViewFrame()->GetBindings().Invalidate( pSlotIds );
+ }
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXFormShell::formActivated(const EventObject& rEvent) throw( RuntimeException )
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ Reference< runtime::XFormController > xController( rEvent.Source, UNO_QUERY_THROW );
+ m_pTextShell->formActivated( xController );
+ setActiveController( xController );
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXFormShell::formDeactivated(const EventObject& rEvent) throw( RuntimeException )
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ Reference< runtime::XFormController > xController( rEvent.Source, UNO_QUERY_THROW );
+ m_pTextShell->formDeactivated( xController );
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::disposing()
+{
+ impl_checkDisposed();
+
+ FmXFormShell_BASE::disposing();
+
+ if ( m_pShell && !m_pShell->IsDesignMode() )
+ setActiveController( NULL, sal_True );
+ // do NOT save the content of the old form (the second parameter tells this)
+ // if we're here, then we expect that PrepareClose has been called, and thus the user
+ // got a chance to commit or reject any changes. So in case we're here and there
+ // are still uncommitted changes, the user explicitly wanted this.
+ // 2002-11-11 - 104702 - fs@openoffice.org
+
+ m_pTextShell->dispose();
+
+ m_xAttachedFrame = NULL;
+
+ CloseExternalFormViewer();
+
+ while ( m_aLoadingPages.size() )
+ {
+ Application::RemoveUserEvent( m_aLoadingPages.front().nEventId );
+ m_aLoadingPages.pop();
+ }
+
+ {
+ ::osl::MutexGuard aGuard(m_aInvalidationSafety);
+ if (m_nInvalidationEvent)
+ {
+ Application::RemoveUserEvent(m_nInvalidationEvent);
+ m_nInvalidationEvent = 0;
+ }
+ if ( m_nActivationEvent )
+ {
+ Application::RemoveUserEvent( m_nActivationEvent );
+ m_nActivationEvent = 0;
+ }
+ }
+
+ {
+ ::osl::ClearableMutexGuard aGuard(m_aAsyncSafety);
+ aGuard.clear();
+
+ DBG_ASSERT(!m_nInvalidationEvent, "FmXFormShell::~FmXFormShell : still have an invalidation event !");
+ // should habe been deleted while beeing disposed
+
+ m_aMarkTimer.Stop();
+ }
+
+ DisableNotification();
+
+ RemoveElement( m_xForms );
+ m_xForms.clear();
+
+ impl_switchActiveControllerListening( false );
+ m_xActiveController = NULL;
+ m_xActiveForm = NULL;
+
+ m_pShell = NULL;
+ m_xNavigationController = NULL;
+ m_xCurrentForm = NULL;
+ m_xLastGridFound = NULL;
+ m_xAttachedFrame = NULL;
+ m_xExternalViewController = NULL;
+ m_xExtViewTriggerController = NULL;
+ m_xExternalDisplayedForm = NULL;
+ m_xLastGridFound = NULL;
+
+ InterfaceBag aEmpty;
+ m_aCurrentSelection.swap( aEmpty );
+
+ m_aActiveControllerFeatures.dispose();
+ m_aNavControllerFeatures.dispose();
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::UpdateSlot( sal_Int16 _nId )
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ ::osl::MutexGuard aGuard(m_aInvalidationSafety);
+
+ if ( m_nLockSlotInvalidation )
+ {
+ OSL_ENSURE( sal_False, "FmXFormShell::UpdateSlot: cannot update if invalidation is currently locked!" );
+ InvalidateSlot( _nId, sal_False );
+ }
+ else
+ {
+ OSL_ENSURE( _nId, "FmXFormShell::UpdateSlot: can't update the complete shell!" );
+ m_pShell->GetViewShell()->GetViewFrame()->GetBindings().Invalidate( _nId, sal_True, sal_True );
+ m_pShell->GetViewShell()->GetViewFrame()->GetBindings().Update( _nId );
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::InvalidateSlot( sal_Int16 nId, sal_Bool bWithId )
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ ::osl::MutexGuard aGuard(m_aInvalidationSafety);
+ if (m_nLockSlotInvalidation)
+ {
+ m_arrInvalidSlots.Insert(nId, m_arrInvalidSlots.Count());
+ sal_uInt8 nFlags = ( bWithId ? 0x01 : 0 );
+ m_arrInvalidSlots_Flags.push_back(nFlags);
+ }
+ else
+ if (nId)
+ m_pShell->GetViewShell()->GetViewFrame()->GetBindings().Invalidate(nId, sal_True, bWithId);
+ else
+ m_pShell->GetViewShell()->GetViewFrame()->GetBindings().InvalidateShell(*m_pShell);
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::LockSlotInvalidation(sal_Bool bLock)
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ ::osl::MutexGuard aGuard(m_aInvalidationSafety);
+ DBG_ASSERT(bLock || m_nLockSlotInvalidation>0, "FmXFormShell::LockSlotInvalidation : invalid call !");
+
+ if (bLock)
+ ++m_nLockSlotInvalidation;
+ else if (!--m_nLockSlotInvalidation)
+ {
+ // alles, was sich waehrend der gelockten Phase angesammelt hat, (asynchron) invalidieren
+ if (!m_nInvalidationEvent)
+ m_nInvalidationEvent = Application::PostUserEvent(LINK(this, FmXFormShell, OnInvalidateSlots));
+ }
+}
+
+//------------------------------------------------------------------------------
+IMPL_LINK(FmXFormShell, OnInvalidateSlots, void*, EMPTYARG)
+{
+ if ( impl_checkDisposed() )
+ return 0L;
+
+ ::osl::MutexGuard aGuard(m_aInvalidationSafety);
+ m_nInvalidationEvent = 0;
+
+ DBG_ASSERT(m_arrInvalidSlots.Count() == m_arrInvalidSlots_Flags.size(),
+ "FmXFormShell::OnInvalidateSlots : inconsistent slot arrays !");
+ sal_uInt8 nFlags;
+ for (sal_Int16 i=0; i<m_arrInvalidSlots.Count(); ++i)
+ {
+ nFlags = m_arrInvalidSlots_Flags[i];
+
+ if (m_arrInvalidSlots[i])
+ m_pShell->GetViewShell()->GetViewFrame()->GetBindings().Invalidate(m_arrInvalidSlots[i], sal_True, (nFlags & 0x01));
+ else
+ m_pShell->GetViewShell()->GetViewFrame()->GetBindings().InvalidateShell(*m_pShell);
+ }
+
+ m_arrInvalidSlots.Remove(0, m_arrInvalidSlots.Count());
+ m_arrInvalidSlots_Flags.clear();
+ return 0L;
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::ForceUpdateSelection(sal_Bool bAllowInvalidation)
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ if (IsSelectionUpdatePending())
+ {
+ m_aMarkTimer.Stop();
+
+ // die Invalidierung der Slots, die implizit von SetSelection besorgt wird, eventuell abschalten
+ if (!bAllowInvalidation)
+ LockSlotInvalidation(sal_True);
+
+ SetSelection(m_pShell->GetFormView()->GetMarkedObjectList());
+
+ if (!bAllowInvalidation)
+ LockSlotInvalidation(sal_False);
+ }
+}
+
+//------------------------------------------------------------------------------
+PopupMenu* FmXFormShell::GetConversionMenu()
+{
+ const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
+ sal_Bool bIsHiContrastMode = rSettings.GetHighContrastMode();
+
+ PopupMenu* pNewMenu = new PopupMenu(SVX_RES( RID_FMSHELL_CONVERSIONMENU ));
+
+ ImageList aImageList( SVX_RES( bIsHiContrastMode ? RID_SVXIMGLIST_FMEXPL_HC : RID_SVXIMGLIST_FMEXPL) );
+ for ( size_t i = 0; i < sizeof( nConvertSlots ) / sizeof( nConvertSlots[0] ); ++i )
+ {
+ // das entsprechende Image dran
+ pNewMenu->SetItemImage(nConvertSlots[i], aImageList.GetImage(nCreateSlots[i]));
+ }
+
+ return pNewMenu;
+}
+
+//------------------------------------------------------------------------------
+bool FmXFormShell::isControlConversionSlot( sal_uInt16 nSlotId )
+{
+ for ( size_t i = 0; i < sizeof( nConvertSlots ) / sizeof( nConvertSlots[0] ); ++i )
+ if (nConvertSlots[i] == nSlotId)
+ return true;
+ return false;
+}
+
+//------------------------------------------------------------------------------
+bool FmXFormShell::executeControlConversionSlot( sal_uInt16 _nSlotId )
+{
+ OSL_PRECOND( canConvertCurrentSelectionToControl( _nSlotId ), "FmXFormShell::executeControlConversionSlot: illegal call!" );
+ InterfaceBag::const_iterator aSelectedElement = m_aCurrentSelection.begin();
+ if ( aSelectedElement == m_aCurrentSelection.end() )
+ return false;
+
+ return executeControlConversionSlot( Reference< XFormComponent >( *aSelectedElement, UNO_QUERY ), _nSlotId );
+}
+
+//------------------------------------------------------------------------------
+bool FmXFormShell::executeControlConversionSlot( const Reference< XFormComponent >& _rxObject, sal_uInt16 _nSlotId )
+{
+ if ( impl_checkDisposed() )
+ return false;
+
+ OSL_ENSURE( _rxObject.is(), "FmXFormShell::executeControlConversionSlot: invalid object!" );
+ if ( !_rxObject.is() )
+ return false;
+
+ SdrPage* pPage = m_pShell->GetCurPage();
+ FmFormPage* pFormPage = pPage ? dynamic_cast< FmFormPage* >( pPage ) : NULL;
+ OSL_ENSURE( pFormPage, "FmXFormShell::executeControlConversionSlot: no current (form) page!" );
+ if ( !pFormPage )
+ return false;
+
+ OSL_ENSURE( isSolelySelected( _rxObject ),
+ "FmXFormShell::executeControlConversionSlot: hmm ... shouldn't this parameter be redundant?" );
+
+ for ( size_t lookupSlot = 0; lookupSlot < sizeof( nConvertSlots ) / sizeof( nConvertSlots[0] ); ++lookupSlot )
+ {
+ if (nConvertSlots[lookupSlot] == _nSlotId)
+ {
+ Reference< XInterface > xNormalizedObject( _rxObject, UNO_QUERY );
+
+ FmFormObj* pFormObject = NULL;
+ SdrObjListIter aPageIter( *pFormPage );
+ while ( aPageIter.IsMore() )
+ {
+ SdrObject* pCurrent = aPageIter.Next();
+ pFormObject = FmFormObj::GetFormObject( pCurrent );
+ if ( !pFormObject )
+ continue;
+
+ Reference< XInterface > xCurrentNormalized( pFormObject->GetUnoControlModel(), UNO_QUERY );
+ if ( xCurrentNormalized.get() == xNormalizedObject.get() )
+ break;
+
+ pFormObject = NULL;
+ }
+
+ if ( !pFormObject )
+ return false;
+
+ ::rtl::OUString sNewName( getServiceNameByControlType( nObjectTypes[ lookupSlot ] ) );
+ Reference< XControlModel> xNewModel( ::comphelper::getProcessServiceFactory()->createInstance( sNewName ), UNO_QUERY );
+ if (!xNewModel.is())
+ return false;
+
+ Reference< XControlModel> xOldModel( pFormObject->GetUnoControlModel() );
+ Reference< XServiceInfo> xModelInfo(xOldModel, UNO_QUERY);
+
+ // Properties uebertragen
+ Reference< XPropertySet> xOldSet(xOldModel, UNO_QUERY);
+ Reference< XPropertySet> xNewSet(xNewModel, UNO_QUERY);
+
+
+ Locale aNewLanguage = Application::GetSettings().GetUILocale();
+ TransferFormComponentProperties(xOldSet, xNewSet, aNewLanguage);
+
+ Sequence< ::com::sun::star::script::ScriptEventDescriptor> aOldScripts;
+ Reference< XChild> xChild(xOldModel, UNO_QUERY);
+ if (xChild.is())
+ {
+ Reference< XIndexAccess> xParent(xChild->getParent(), UNO_QUERY);
+
+ // remember old script events
+ Reference< ::com::sun::star::script::XEventAttacherManager> xEvManager(xChild->getParent(), UNO_QUERY);
+ if (xParent.is() && xEvManager.is())
+ {
+ sal_Int32 nIndex = getElementPos(xParent, xOldModel);
+ if (nIndex>=0 && nIndex<xParent->getCount())
+ aOldScripts = xEvManager->getScriptEvents(nIndex);
+ }
+
+ // replace the mdoel within the parent container
+ Reference< XIndexContainer> xIndexParent(xChild->getParent(), UNO_QUERY); //Modified by BerryJia for fixing Bug102516 Time(China):2002-9-5 16:00
+ if (xIndexParent.is())
+ {
+ // the form container works with FormComponents
+ Reference< XFormComponent> xComponent(xNewModel, UNO_QUERY);
+ DBG_ASSERT(xComponent.is(), "FmXFormShell::executeControlConversionSlot: the new model is no form component !");
+ Any aNewModel(makeAny(xComponent));
+ try
+ {
+ //Modified by BerryJia for fixing Bug102516 Time(China):2002-9-5 16:00
+ sal_Int32 nIndex = getElementPos(xParent, xOldModel);
+ if (nIndex>=0 && nIndex<xParent->getCount())
+ xIndexParent->replaceByIndex(nIndex, aNewModel);
+ else
+ {
+ DBG_ERROR("FmXFormShell::executeControlConversionSlot: could not replace the model !");
+ Reference< ::com::sun::star::lang::XComponent> xNewComponent(xNewModel, UNO_QUERY);
+ if (xNewComponent.is())
+ xNewComponent->dispose();
+ return false;
+ }
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("FmXFormShell::executeControlConversionSlot: could not replace the model !");
+ Reference< ::com::sun::star::lang::XComponent> xNewComponent(xNewModel, UNO_QUERY);
+ if (xNewComponent.is())
+ xNewComponent->dispose();
+ return false;
+ }
+
+ }
+ }
+
+ // special handling for the LabelControl-property : can only be set when the model is placed
+ // within the forms hierarchy
+ if (::comphelper::hasProperty(FM_PROP_CONTROLLABEL, xOldSet) && ::comphelper::hasProperty(FM_PROP_CONTROLLABEL, xNewSet))
+ {
+ try
+ {
+ xNewSet->setPropertyValue(FM_PROP_CONTROLLABEL, xOldSet->getPropertyValue(FM_PROP_CONTROLLABEL));
+ }
+ catch(Exception&)
+ {
+ }
+
+ }
+
+ // neues Model setzen
+ pFormObject->SetChanged();
+ pFormObject->SetUnoControlModel(xNewModel);
+
+ // transfer script events
+ // (do this _after_ SetUnoControlModel as we need the new (implicitly created) control)
+ if (aOldScripts.getLength())
+ {
+ // das Control zum Model suchen
+ Reference< XControlContainer > xControlContainer( getControlContainerForView() );
+
+ Sequence< Reference< XControl> > aControls( xControlContainer->getControls() );
+ const Reference< XControl>* pControls = aControls.getConstArray();
+
+ sal_uInt32 nLen = aControls.getLength();
+ Reference< XControl> xControl;
+ for (sal_uInt32 i=0 ; i<nLen; ++i)
+ {
+ if (pControls[i]->getModel() == xNewModel)
+ {
+ xControl = pControls[i];
+ break;
+ }
+ }
+ TransferEventScripts(xNewModel, xControl, aOldScripts);
+ }
+
+ // transfer value bindings, if possible
+ {
+ Reference< XBindableValue > xOldBindable( xOldModel, UNO_QUERY );
+ Reference< XBindableValue > xNewBindable( xNewModel, UNO_QUERY );
+ if ( xOldBindable.is() )
+ {
+ try
+ {
+ if ( xNewBindable.is() )
+ xNewBindable->setValueBinding( xOldBindable->getValueBinding() );
+ xOldBindable->setValueBinding( NULL );
+ }
+ catch(const Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+ // same for list entry sources
+ {
+ Reference< XListEntrySink > xOldSink( xOldModel, UNO_QUERY );
+ Reference< XListEntrySink > xNewSink( xNewModel, UNO_QUERY );
+ if ( xOldSink.is() )
+ {
+ try
+ {
+ if ( xNewSink.is() )
+ xNewSink->setListEntrySource( xOldSink->getListEntrySource() );
+ xOldSink->setListEntrySource( NULL );
+ }
+ catch(const Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+
+ // create an undo action
+ FmFormModel* pModel = m_pShell->GetFormModel();
+ DBG_ASSERT(pModel != NULL, "FmXFormShell::executeControlConversionSlot: my shell has no model !");
+ if (pModel && pModel->IsUndoEnabled() )
+ {
+ pModel->AddUndo(new FmUndoModelReplaceAction(*pModel, pFormObject, xOldModel));
+ }
+ else
+ {
+ FmUndoModelReplaceAction::DisposeElement( xOldModel );
+ }
+
+ return true;
+ }
+ }
+ return false;
+}
+
+//------------------------------------------------------------------------------
+bool FmXFormShell::canConvertCurrentSelectionToControl( sal_Int16 nConversionSlot )
+{
+ if ( m_aCurrentSelection.empty() )
+ return false;
+
+ InterfaceBag::const_iterator aCheck = m_aCurrentSelection.begin();
+ Reference< XServiceInfo > xElementInfo( *aCheck, UNO_QUERY );
+ if ( !xElementInfo.is() )
+ // no service info -> cannot determine this
+ return false;
+
+ if ( ++aCheck != m_aCurrentSelection.end() )
+ // more than one element
+ return false;
+
+ if ( Reference< XForm >::query( xElementInfo ).is() )
+ // it's a form
+ return false;
+
+ sal_Int16 nObjectType = getControlTypeByObject( xElementInfo );
+
+ if ( ( OBJ_FM_HIDDEN == nObjectType )
+ || ( OBJ_FM_CONTROL == nObjectType )
+ || ( OBJ_FM_GRID == nObjectType )
+ )
+ return false; // those types cannot be converted
+
+ DBG_ASSERT(sizeof(nConvertSlots)/sizeof(nConvertSlots[0]) == sizeof(nObjectTypes)/sizeof(nObjectTypes[0]),
+ "FmXFormShell::canConvertCurrentSelectionToControl: nConvertSlots & nObjectTypes must have the same size !");
+
+ for ( size_t i = 0; i < sizeof( nConvertSlots ) / sizeof( nConvertSlots[0] ); ++i )
+ if (nConvertSlots[i] == nConversionSlot)
+ return nObjectTypes[i] != nObjectType;
+
+ return sal_True; // all other slots: assume "yes"
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::checkControlConversionSlotsForCurrentSelection( Menu& rMenu )
+{
+ for (sal_Int16 i=0; i<rMenu.GetItemCount(); ++i)
+ // der Context ist schon von einem Typ, der dem Eitnrag entspricht -> disable
+ rMenu.EnableItem( rMenu.GetItemId(i), canConvertCurrentSelectionToControl( rMenu.GetItemId( i ) ) );
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::LoopGrids(sal_Int16 nWhat)
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ Reference< XIndexContainer> xControlModels(m_xActiveForm, UNO_QUERY);
+ if (xControlModels.is())
+ {
+ for (sal_Int16 i=0; i<xControlModels->getCount(); ++i)
+ {
+ Reference< XPropertySet> xModelSet;
+ xControlModels->getByIndex(i) >>= xModelSet;
+ if (!xModelSet.is())
+ continue;
+
+ if (!::comphelper::hasProperty(FM_PROP_CLASSID, xModelSet))
+ continue;
+ sal_Int16 nClassId = ::comphelper::getINT16(xModelSet->getPropertyValue(FM_PROP_CLASSID));
+ if (FormComponentType::GRIDCONTROL != nClassId)
+ continue;
+
+ if (!::comphelper::hasProperty(FM_PROP_CURSORCOLOR, xModelSet) || !::comphelper::hasProperty(FM_PROP_ALWAYSSHOWCURSOR, xModelSet) || !::comphelper::hasProperty(FM_PROP_DISPLAYSYNCHRON, xModelSet))
+ continue;
+
+ switch (nWhat & GA_SYNC_MASK)
+ {
+ case GA_DISABLE_SYNC:
+ {
+ sal_Bool bB(sal_False);
+ xModelSet->setPropertyValue(FM_PROP_DISPLAYSYNCHRON, Any(&bB,getBooleanCppuType()));
+ }
+ break;
+ case GA_FORCE_SYNC:
+ {
+ Any aOldVal( xModelSet->getPropertyValue(FM_PROP_DISPLAYSYNCHRON) );
+ sal_Bool bB(sal_True);
+ xModelSet->setPropertyValue(FM_PROP_DISPLAYSYNCHRON, Any(&bB,getBooleanCppuType()));
+ xModelSet->setPropertyValue(FM_PROP_DISPLAYSYNCHRON, aOldVal);
+ }
+ break;
+ case GA_ENABLE_SYNC:
+ {
+ sal_Bool bB(sal_True);
+ xModelSet->setPropertyValue(FM_PROP_DISPLAYSYNCHRON, Any(&bB,getBooleanCppuType()));
+ }
+ break;
+ }
+
+ if (nWhat & GA_DISABLE_ROCTRLR)
+ {
+ sal_Bool bB(sal_False);
+ xModelSet->setPropertyValue(FM_PROP_ALWAYSSHOWCURSOR, Any(&bB,getBooleanCppuType()));
+ Reference< XPropertyState> xModelPropState(xModelSet, UNO_QUERY);
+ if (xModelPropState.is())
+ xModelPropState->setPropertyToDefault(FM_PROP_CURSORCOLOR);
+ else
+ xModelSet->setPropertyValue(FM_PROP_CURSORCOLOR, Any()); // this should be the default
+ }
+ else if (nWhat & GA_ENABLE_ROCTRLR)
+ {
+ sal_Bool bB(sal_True);
+ xModelSet->setPropertyValue(FM_PROP_ALWAYSSHOWCURSOR, Any(&bB,getBooleanCppuType()));
+ xModelSet->setPropertyValue(FM_PROP_CURSORCOLOR, makeAny(sal_Int32(COL_LIGHTRED)));
+ }
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+Reference< XControlContainer > FmXFormShell::getControlContainerForView()
+{
+ if ( impl_checkDisposed() )
+ return NULL;
+
+ SdrPageView* pPageView = NULL;
+ if ( m_pShell && m_pShell->GetFormView() )
+ pPageView = m_pShell->GetFormView()->GetSdrPageView();
+
+ Reference< XControlContainer> xControlContainer;
+ if ( pPageView )
+ xControlContainer = pPageView->GetPageWindow(0)->GetControlContainer();
+
+ return xControlContainer;
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::ExecuteTabOrderDialog( const Reference< XTabControllerModel >& _rxForForm )
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ OSL_PRECOND( _rxForForm.is(), "FmXFormShell::ExecuteTabOrderDialog: invalid tabbing model!" );
+ if ( !_rxForForm.is() )
+ return;
+
+ try
+ {
+ Sequence< Any > aDialogArgs( 3 );
+ aDialogArgs[0] <<= NamedValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TabbingModel" ) ),
+ makeAny( _rxForForm )
+ );
+ aDialogArgs[1] <<= NamedValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlContext" ) ),
+ makeAny( getControlContainerForView() )
+ );
+
+ Reference< XWindow > xParentWindow;
+ if ( m_pShell->GetViewShell() && m_pShell->GetViewShell()->GetViewFrame() )
+ xParentWindow = VCLUnoHelper::GetInterface ( &m_pShell->GetViewShell()->GetViewFrame()->GetWindow() );
+ aDialogArgs[2] <<= NamedValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" ) ),
+ makeAny( xParentWindow )
+ );
+
+ Reference< dialogs::XExecutableDialog > xDialog(
+ ::comphelper::getProcessServiceFactory()->createInstanceWithArguments(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.ui.TabOrderDialog" ) ),
+ aDialogArgs
+ ),
+ UNO_QUERY
+ );
+ OSL_ENSURE( xDialog.is(), "FmXFormShell::ExecuteTabOrderDialog: could not create the dialog!" );
+
+ if ( xDialog.is() )
+ xDialog->execute();
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "FmXFormShell::ExecuteTabOrderDialog: caught an exception!" );
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::ExecuteSearch()
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ // eine Sammlung aller (logischen) Formulare
+ FmFormArray aEmpty;
+ m_aSearchForms.swap( aEmpty );
+ ::std::vector< String > aContextNames;
+ impl_collectFormSearchContexts_nothrow( m_pShell->GetCurPage()->GetForms(), ::rtl::OUString(), m_aSearchForms, aContextNames );
+ OSL_POSTCOND( m_aSearchForms.size() == aContextNames.size(),
+ "FmXFormShell::ExecuteSearch: nonsense!" );
+ if ( m_aSearchForms.size() != aContextNames.size() )
+ return;
+
+ // filter out the forms which do not contain valid controls at all
+ {
+ FmFormArray aValidForms;
+ ::std::vector< String > aValidContexts;
+ FmFormArray::const_iterator form = m_aSearchForms.begin();
+ ::std::vector< String >::const_iterator contextName = aContextNames.begin();
+ for ( ; form != m_aSearchForms.end(); ++form, ++contextName )
+ {
+ FmSearchContext aTestContext;
+ aTestContext.nContext = static_cast< sal_Int16 >( form - m_aSearchForms.begin() );
+ sal_uInt32 nValidControls = OnSearchContextRequest( &aTestContext );
+ if ( nValidControls > 0 )
+ {
+ aValidForms.push_back( *form );
+ aValidContexts.push_back( *contextName );
+ }
+ }
+
+ m_aSearchForms.swap( aValidForms );
+ aContextNames.swap( aValidContexts );
+ }
+
+ if (m_aSearchForms.size() == 0)
+ { // es gibt keine Controls, die alle Bedingungen fuer eine Suche erfuellen
+ ErrorBox(NULL, WB_OK, SVX_RESSTR(RID_STR_NODATACONTROLS)).Execute();
+ return;
+ }
+
+ // jetzt brauche ich noch einen 'initial context'
+ sal_Int16 nInitialContext = 0;
+ Reference< XForm> xActiveForm( getActiveForm());
+ for ( size_t i=0; i<m_aSearchForms.size(); ++i )
+ {
+ if (m_aSearchForms.at(i) == xActiveForm)
+ {
+ nInitialContext = (sal_Int16)i;
+ break;
+ }
+ }
+
+ // wenn der Dialog initial den Text des aktiven Controls anbieten soll, muss dieses ein XTextComponent-Interface habe,
+ // ausserdem macht das nur Sinn, wenn das aktuelle Feld auch an ein Tabellen- (oder was-auch-immer-)Feld gebunden ist
+ UniString strActiveField;
+ UniString strInitialText;
+ // ... das bekomme ich von meinem FormController
+ DBG_ASSERT(m_xActiveController.is(), "FmXFormShell::ExecuteSearch : no active controller !");
+ Reference< XControl> xActiveControl( m_xActiveController->getCurrentControl());
+ if (xActiveControl.is())
+ {
+ // das Control kann mir sein Model sagen ...
+ Reference< XControlModel> xActiveModel( xActiveControl->getModel());
+ DBG_ASSERT(xActiveModel.is(), "FmXFormShell::ExecuteSearch : active control has no model !");
+
+ // das Model frage ich nach der ControlSource-Eigenschaft ...
+ Reference< XPropertySet> xProperties(xActiveControl->getModel(), UNO_QUERY);
+ if (::comphelper::hasProperty(FM_PROP_CONTROLSOURCE, xProperties) && ::comphelper::hasProperty(FM_PROP_BOUNDFIELD, xProperties))
+ {
+ Reference< XPropertySet> xField;
+ xProperties->getPropertyValue(FM_PROP_BOUNDFIELD) >>= xField;
+ if (xField.is()) // (nur wenn das Ding wirklich gebunden ist)
+ {
+ // und das Control selber nach einem TextComponent-Interface (damit ich mir dort den Text abholen kann)
+ Reference< XTextComponent> xText(xActiveControl, UNO_QUERY);
+ if (xText.is())
+ {
+ strActiveField = getLabelName(xProperties).getStr();
+ strInitialText = xText->getText().getStr();
+ }
+ }
+ }
+ else
+ {
+ // das Control selber hat keine ControlSource, aber vielleicht ist es ein GridControl
+ Reference< XGrid> xGrid(xActiveControl, UNO_QUERY);
+ if (xGrid.is())
+ {
+ // fuer strActiveField brauche ich die die ControlSource der Column, dafuer den Columns-Container, dafuer die
+ // GridPeer
+ Reference< XGridPeer> xGridPeer(xActiveControl->getPeer(), UNO_QUERY);
+ Reference< XIndexAccess> xColumns;
+ if (xGridPeer.is())
+ xColumns = Reference< XIndexAccess>(xGridPeer->getColumns(),UNO_QUERY);
+
+ sal_Int16 nViewCol = xGrid->getCurrentColumnPosition();
+ sal_Int16 nModelCol = GridView2ModelPos(xColumns, nViewCol);
+ Reference< XPropertySet> xCurrentCol;
+ if(xColumns.is())
+ xColumns->getByIndex(nModelCol) >>= xCurrentCol;
+ if (xCurrentCol.is())
+ strActiveField = ::comphelper::getString(xCurrentCol->getPropertyValue(FM_PROP_LABEL)).getStr();
+
+ // the text fo the current column
+ Reference< XIndexAccess> xColControls(xGridPeer, UNO_QUERY);
+ Reference< XInterface> xCurControl;
+ xColControls->getByIndex(nViewCol) >>= xCurControl;
+ ::rtl::OUString sInitialText;
+ if (IsSearchableControl(xCurControl, &sInitialText))
+ strInitialText = sInitialText.getStr();
+ }
+ }
+ }
+
+ // um eventuelle GridControls, die ich kenne, kuemmern
+ LoopGrids(GA_DISABLE_SYNC /*| GA_ENABLE_ROCTRLR*/);
+
+ // jetzt bin ich reif fuer den Dialog
+ // wenn die potentiellen Deadlocks, die durch die Benutzung des Solar-Mutex in MTs VCLX...-Klasen entstehen, irgendwann mal
+ // ausgeraeumt sind, sollte hier ein SM_USETHREAD rein, denn die Suche in einem eigenen Thread ist doch etwas fluessiger
+ // sollte allerdings irgendwie von dem unterliegenden Cursor abhaengig gemacht werden, DAO zum Beispiel ist nicht thread-sicher
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ AbstractFmSearchDialog* pDialog = NULL;
+ if ( pFact )
+ pDialog = pFact->CreateFmSearchDialog( &m_pShell->GetViewShell()->GetViewFrame()->GetWindow(), strInitialText, aContextNames, nInitialContext, LINK( this, FmXFormShell, OnSearchContextRequest ) );
+ DBG_ASSERT( pDialog, "FmXFormShell::ExecuteSearch: could not create the search dialog!" );
+ if ( pDialog )
+ {
+ pDialog->SetActiveField( strActiveField );
+ pDialog->SetFoundHandler( LINK( this, FmXFormShell, OnFoundData ) );
+ pDialog->SetCanceledNotFoundHdl( LINK( this, FmXFormShell, OnCanceledNotFound ) );
+ pDialog->Execute();
+ delete pDialog;
+ }
+
+ // GridControls wieder restaurieren
+ LoopGrids(GA_ENABLE_SYNC | GA_DISABLE_ROCTRLR);
+
+ m_pShell->GetFormView()->UnMarkAll(m_pShell->GetFormView()->GetSdrPageView());
+ // da ich in OnFoundData (fals ich dort war) Controls markiert habe
+}
+
+//------------------------------------------------------------------------------
+sal_Bool FmXFormShell::GetY2KState(sal_uInt16& n)
+{
+ if ( impl_checkDisposed() )
+ return sal_False;
+
+ if (m_pShell->IsDesignMode())
+ // im Design-Modus (ohne aktive Controls) soll sich das Haupt-Dokument darum kuemmern
+ return sal_False;
+
+ Reference< XForm> xForm( getActiveForm());
+ if (!xForm.is())
+ // kein aktuelles Formular (also insbesondere kein aktuelles Control) -> das Haupt-Dokument soll sich kuemmern
+ return sal_False;
+
+ Reference< XRowSet> xDB(xForm, UNO_QUERY);
+ DBG_ASSERT(xDB.is(), "FmXFormShell::GetY2KState : current form has no dbform-interface !");
+
+ Reference< XNumberFormatsSupplier> xSupplier( getNumberFormats(OStaticDataAccessTools().getRowSetConnection(xDB), sal_False));
+ if (xSupplier.is())
+ {
+ Reference< XPropertySet> xSet(xSupplier->getNumberFormatSettings());
+ if (xSet.is())
+ {
+ try
+ {
+ Any aVal( xSet->getPropertyValue(::rtl::OUString::createFromAscii("TwoDigitDateStart")) );
+ aVal >>= n;
+ return sal_True;
+ }
+ catch(Exception&)
+ {
+ }
+
+ }
+ }
+ return sal_False;
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::SetY2KState(sal_uInt16 n)
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ Reference< XForm > xActiveForm( getActiveForm());
+ Reference< XRowSet > xActiveRowSet( xActiveForm, UNO_QUERY );
+ if ( xActiveRowSet.is() )
+ {
+ Reference< XNumberFormatsSupplier > xSupplier( getNumberFormats( getRowSetConnection( xActiveRowSet ), sal_False ) );
+ if (xSupplier.is())
+ {
+ Reference< XPropertySet> xSet(xSupplier->getNumberFormatSettings());
+ if (xSet.is())
+ {
+ try
+ {
+ Any aVal;
+ aVal <<= n;
+ xSet->setPropertyValue(::rtl::OUString::createFromAscii("TwoDigitDateStart"), aVal);
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("FmXFormShell::SetY2KState: Exception occured!");
+ }
+
+ }
+ return;
+ }
+ }
+
+ // kein aktives Formular gefunden -> alle aktuell vorhandenen Formulare durchiterieren
+ Reference< XIndexAccess> xCurrentForms( m_xForms);
+ if (!xCurrentForms.is())
+ { // im alive-Modus sind meine Forms nicht gesetzt, wohl aber die an der Page
+ if (m_pShell->GetCurPage())
+ xCurrentForms = Reference< XIndexAccess>( m_pShell->GetCurPage()->GetForms( false ), UNO_QUERY );
+ }
+ if (!xCurrentForms.is())
+ return;
+
+ ::comphelper::IndexAccessIterator aIter(xCurrentForms);
+ Reference< XInterface> xCurrentElement( aIter.Next());
+ while (xCurrentElement.is())
+ {
+ // ist das aktuelle Element eine DatabaseForm ?
+ Reference< XRowSet> xElementAsRowSet( xCurrentElement, UNO_QUERY );
+ if ( xElementAsRowSet.is() )
+ {
+ Reference< XNumberFormatsSupplier > xSupplier( getNumberFormats( getRowSetConnection( xElementAsRowSet ), sal_False ) );
+ if (!xSupplier.is())
+ continue;
+
+ Reference< XPropertySet> xSet(xSupplier->getNumberFormatSettings());
+ if (xSet.is())
+ {
+ try
+ {
+ Any aVal;
+ aVal <<= n;
+ xSet->setPropertyValue(::rtl::OUString::createFromAscii("TwoDigitDateStart"), aVal);
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("FmXFormShell::SetY2KState: Exception occured!");
+ }
+
+ }
+ }
+ xCurrentElement = aIter.Next();
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::CloseExternalFormViewer()
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ if (!m_xExternalViewController.is())
+ return;
+
+ Reference< ::com::sun::star::frame::XFrame> xExternalViewFrame( m_xExternalViewController->getFrame());
+ Reference< ::com::sun::star::frame::XDispatchProvider> xCommLink(xExternalViewFrame, UNO_QUERY);
+ if (!xCommLink.is())
+ return;
+
+ xExternalViewFrame->setComponent(NULL,NULL);
+ ::comphelper::disposeComponent(xExternalViewFrame);
+ m_xExternalViewController = NULL;
+ m_xExtViewTriggerController = NULL;
+ m_xExternalDisplayedForm = NULL;
+}
+
+//------------------------------------------------------------------------------
+Reference< XResultSet> FmXFormShell::getInternalForm(const Reference< XResultSet>& _xForm) const
+{
+ if ( impl_checkDisposed() )
+ return NULL;
+
+ Reference< runtime::XFormController> xExternalCtrlr(m_xExternalViewController, UNO_QUERY);
+ if (xExternalCtrlr.is() && (_xForm == xExternalCtrlr->getModel()))
+ {
+ DBG_ASSERT(m_xExternalDisplayedForm.is(), "FmXFormShell::getInternalForm : invalid external form !");
+ return m_xExternalDisplayedForm;
+ }
+ return _xForm;
+}
+
+//------------------------------------------------------------------------------
+Reference< XForm> FmXFormShell::getInternalForm(const Reference< XForm>& _xForm) const
+{
+ if ( impl_checkDisposed() )
+ return NULL;
+
+ Reference< runtime::XFormController > xExternalCtrlr(m_xExternalViewController, UNO_QUERY);
+ if (xExternalCtrlr.is() && (_xForm == xExternalCtrlr->getModel()))
+ {
+ DBG_ASSERT(m_xExternalDisplayedForm.is(), "FmXFormShell::getInternalForm : invalid external form !");
+ return Reference< XForm>(m_xExternalDisplayedForm, UNO_QUERY);
+ }
+ return _xForm;
+}
+
+//------------------------------------------------------------------------
+namespace
+{
+ static bool lcl_isNavigationRelevant( sal_Int32 _nWhich )
+ {
+ return ( _nWhich == SID_FM_RECORD_FIRST )
+ || ( _nWhich == SID_FM_RECORD_PREV )
+ || ( _nWhich == SID_FM_RECORD_NEXT )
+ || ( _nWhich == SID_FM_RECORD_LAST )
+ || ( _nWhich == SID_FM_RECORD_NEW );
+ }
+}
+
+//------------------------------------------------------------------------------
+bool FmXFormShell::IsFormSlotEnabled( sal_Int32 _nSlot, FeatureState* _pCompleteState )
+{
+ const ::svx::ControllerFeatures& rController =
+ lcl_isNavigationRelevant( _nSlot )
+ ? getNavControllerFeatures()
+ : getActiveControllerFeatures();
+
+ if ( !_pCompleteState )
+ return rController->isEnabled( _nSlot );
+
+ rController->getState( _nSlot, *_pCompleteState );
+ return _pCompleteState->Enabled;
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::ExecuteFormSlot( sal_Int32 _nSlot )
+{
+ const ::svx::ControllerFeatures& rController =
+ lcl_isNavigationRelevant( _nSlot )
+ ? getNavControllerFeatures()
+ : getActiveControllerFeatures();
+
+ rController->execute( _nSlot );
+
+ if ( _nSlot == SID_FM_RECORD_UNDO )
+ {
+ // if we're doing an UNDO, *and* if the affected form is the form which we also display
+ // as external view, then we need to reset the controls of the external form, too
+ if ( getInternalForm( getActiveForm() ) == m_xExternalDisplayedForm )
+ {
+ Reference< XIndexAccess > xContainer( m_xExternalDisplayedForm, UNO_QUERY );
+ if ( xContainer.is() )
+ {
+ Reference< XReset > xReset;
+ for ( sal_Int32 i = 0; i < xContainer->getCount(); ++i )
+ {
+ if ( ( xContainer->getByIndex( i ) >>= xReset ) && xReset.is() )
+ {
+ // no resets on sub forms
+ Reference< XForm > xAsForm( xReset, UNO_QUERY );
+ if ( !xAsForm.is() )
+ xReset->reset();
+ }
+ }
+ }
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::impl_switchActiveControllerListening( const bool _bListen )
+{
+ Reference< XComponent> xComp( m_xActiveController, UNO_QUERY );
+ if ( !xComp.is() )
+ return;
+
+ if ( _bListen )
+ xComp->addEventListener( (XFormControllerListener*)this );
+ else
+ xComp->removeEventListener( (XFormControllerListener*)this );
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::setActiveController( const Reference< runtime::XFormController >& xController, sal_Bool _bNoSaveOldContent )
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ if (m_bChangingDesignMode)
+ return;
+ DBG_ASSERT(!m_pShell->IsDesignMode(), "nur im alive mode verwenden");
+
+ // Ist die Routine ein zweites Mal gerufen worden,
+ // dann sollte der Focus nicht mehr umgesetzt werden
+ if (m_bInActivate)
+ {
+ m_bSetFocus = xController != m_xActiveController;
+ return;
+ }
+
+ if (xController != m_xActiveController)
+ {
+ ::osl::ClearableMutexGuard aGuard(m_aAsyncSafety);
+ // switch all nav dispatchers belonging to the form of the current nav controller to 'non active'
+ Reference< XResultSet> xNavigationForm;
+ if (m_xNavigationController.is())
+ xNavigationForm = Reference< XResultSet>(m_xNavigationController->getModel(), UNO_QUERY);
+ aGuard.clear();
+
+ m_bInActivate = sal_True;
+
+ // check if the 2 controllers serve different forms
+ Reference< XResultSet> xOldForm;
+ if (m_xActiveController.is())
+ xOldForm = Reference< XResultSet>(m_xActiveController->getModel(), UNO_QUERY);
+ Reference< XResultSet> xNewForm;
+ if (xController.is())
+ xNewForm = Reference< XResultSet>(xController->getModel(), UNO_QUERY);
+ xOldForm = getInternalForm(xOldForm);
+ xNewForm = getInternalForm(xNewForm);
+
+ sal_Bool bDifferentForm = ( xOldForm.get() != xNewForm.get() );
+ sal_Bool bNeedSave = bDifferentForm && !_bNoSaveOldContent;
+ // we save the content of the old form if we move to a new form, and saving old content is allowed
+
+ if ( m_xActiveController.is() && bNeedSave )
+ {
+ // beim Wechsel des Controllers den Inhalt speichern, ein Commit
+ // wurde bereits ausgefuehrt
+ if ( m_aActiveControllerFeatures->commitCurrentControl() )
+ {
+ m_bSetFocus = sal_True;
+ if ( m_aActiveControllerFeatures->isModifiedRow() )
+ {
+ sal_Bool bIsNew = m_aActiveControllerFeatures->isInsertionRow();
+ sal_Bool bResult = m_aActiveControllerFeatures->commitCurrentRecord();
+ if ( !bResult && m_bSetFocus )
+ {
+ // if we couldn't save the current record, set the focus back to the
+ // current control
+ Reference< XWindow > xWindow( m_xActiveController->getCurrentControl(), UNO_QUERY );
+ if ( xWindow.is() )
+ xWindow->setFocus();
+ m_bInActivate = sal_False;
+ return;
+ }
+ else if ( bResult && bIsNew )
+ {
+ Reference< XResultSet > xCursor( m_aActiveControllerFeatures->getCursor().get() );
+ if ( xCursor.is() )
+ {
+ DO_SAFE( xCursor->last(); );
+ }
+ }
+ }
+ }
+ }
+
+ stopListening();
+
+ impl_switchActiveControllerListening( false );
+
+ m_aActiveControllerFeatures.dispose();
+ m_xActiveController = xController;
+ if ( m_xActiveController.is() )
+ m_aActiveControllerFeatures.assign( m_xActiveController );
+
+ impl_switchActiveControllerListening( true );
+
+ if ( m_xActiveController.is() )
+ m_xActiveForm = getInternalForm( Reference< XForm >( m_xActiveController->getModel(), UNO_QUERY ) );
+ else
+ m_xActiveForm = NULL;
+
+ startListening();
+
+ // activate all dispatchers belonging to form of the new navigation controller
+ xNavigationForm = NULL;
+ if (m_xNavigationController.is())
+ xNavigationForm = Reference< XResultSet>(m_xNavigationController->getModel(), UNO_QUERY);
+
+ m_bInActivate = sal_False;
+
+ m_pShell->UIFeatureChanged();
+ m_pShell->GetViewShell()->GetViewFrame()->GetBindings().InvalidateShell(*m_pShell);
+
+ InvalidateSlot(SID_FM_FILTER_NAVIGATOR_CONTROL, sal_True);
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::getCurrentSelection( InterfaceBag& /* [out] */ _rSelection ) const
+{
+ _rSelection = m_aCurrentSelection;
+}
+
+//------------------------------------------------------------------------------
+bool FmXFormShell::setCurrentSelectionFromMark( const SdrMarkList& _rMarkList )
+{
+ m_aLastKnownMarkedControls.clear();
+
+ if ( ( _rMarkList.GetMarkCount() > 0 ) && isControlList( _rMarkList ) )
+ collectInterfacesFromMarkList( _rMarkList, m_aLastKnownMarkedControls );
+
+ return setCurrentSelection( m_aLastKnownMarkedControls );
+}
+
+//------------------------------------------------------------------------------
+bool FmXFormShell::selectLastMarkedControls()
+{
+ return setCurrentSelection( m_aLastKnownMarkedControls );
+}
+
+//------------------------------------------------------------------------------
+bool FmXFormShell::setCurrentSelection( const InterfaceBag& _rSelection )
+{
+ if ( impl_checkDisposed() )
+ return false;
+
+ DBG_ASSERT( m_pShell->IsDesignMode(), "FmXFormShell::setCurrentSelection: only to be used in design mode!" );
+
+ if ( _rSelection.empty() && m_aCurrentSelection.empty() )
+ // nothing to do
+ return false;
+
+ if ( _rSelection.size() == m_aCurrentSelection.size() )
+ {
+ InterfaceBag::const_iterator aNew = _rSelection.begin();
+ InterfaceBag::const_iterator aOld = m_aCurrentSelection.begin();
+ for ( ; aNew != _rSelection.end(); ++aNew, ++aOld )
+ {
+ OSL_ENSURE( Reference< XInterface >( *aNew, UNO_QUERY ).get() == aNew->get(), "FmXFormShell::setCurrentSelection: new interface not normalized!" );
+ OSL_ENSURE( Reference< XInterface >( *aOld, UNO_QUERY ).get() == aOld->get(), "FmXFormShell::setCurrentSelection: old interface not normalized!" );
+
+ if ( aNew->get() != aOld->get() )
+ break;
+ }
+
+ if ( aNew == _rSelection.end() )
+ // both bags equal
+ return false;
+ }
+
+ // the following is some strange code to ensure that when you have two grid controls in a document,
+ // only one of them can have a selected column.
+ // TODO: this should happen elsewhere, but not here - shouldn't it?
+ if ( !m_aCurrentSelection.empty() )
+ {
+ Reference< XChild > xCur; if ( m_aCurrentSelection.size() == 1 ) xCur = xCur.query( *m_aCurrentSelection.begin() );
+ Reference< XChild > xNew; if ( _rSelection.size() == 1 ) xNew = xNew.query( *_rSelection.begin() );
+
+ // is there nothing to be selected, or the parents differ, and the parent of the current object
+ // is a selection supplier, then deselect
+ if ( xCur.is() && ( !xNew.is() || ( xCur->getParent() != xNew->getParent() ) ) )
+ {
+ Reference< XSelectionSupplier > xSel( xCur->getParent(), UNO_QUERY );
+ if ( xSel.is() )
+ xSel->select( Any() );
+ }
+ }
+
+ m_aCurrentSelection = _rSelection;
+
+ // determine the form which all the selected obj�cts belong to, if any
+ Reference< XForm > xNewCurrentForm;
+ for ( InterfaceBag::const_iterator loop = m_aCurrentSelection.begin();
+ loop != m_aCurrentSelection.end();
+ ++loop
+ )
+ {
+ Reference< XForm > xThisRoundsForm( GetForm( *loop ) );
+ OSL_ENSURE( xThisRoundsForm.is(), "FmXFormShell::setCurrentSelection: *everything* should belong to a form!" );
+
+ if ( !xNewCurrentForm.is() )
+ { // the first form we encounterd
+ xNewCurrentForm = xThisRoundsForm;
+ }
+ else if ( xNewCurrentForm != xThisRoundsForm )
+ { // different forms -> no "current form" at all
+ xNewCurrentForm.clear();
+ break;
+ }
+ }
+
+ if ( !m_aCurrentSelection.empty() )
+ impl_updateCurrentForm( xNewCurrentForm );
+
+ // ensure some slots are updated
+ for ( size_t i = 0; i < sizeof( SelObjectSlotMap ) / sizeof( SelObjectSlotMap[0] ); ++i )
+ InvalidateSlot( SelObjectSlotMap[i], sal_False);
+
+ return true;
+}
+
+//------------------------------------------------------------------------------
+bool FmXFormShell::isSolelySelected( const Reference< XInterface >& _rxObject )
+{
+ return ( m_aCurrentSelection.size() == 1 ) && ( *m_aCurrentSelection.begin() == _rxObject );
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::forgetCurrentForm()
+{
+ if ( !m_xCurrentForm.is() )
+ return;
+
+ // reset ...
+ impl_updateCurrentForm( NULL );
+
+ // ... and try finding a new current form
+ // #i88186# / 2008-04-12 / frank.schoenheit@sun.com
+ impl_defaultCurrentForm_nothrow();
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::impl_updateCurrentForm( const Reference< XForm >& _rxNewCurForm )
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ m_xCurrentForm = _rxNewCurForm;
+
+ // propagate to the FormPage(Impl)
+ FmFormPage* pPage = m_pShell->GetCurPage();
+ if ( pPage )
+ pPage->GetImpl().setCurForm( m_xCurrentForm );
+
+ // ensure the UI which depends on the current form is up-to-date
+ for ( size_t i = 0; i < sizeof( DlgSlotMap ) / sizeof( DlgSlotMap[0] ); ++i )
+ InvalidateSlot( DlgSlotMap[i], sal_False );
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::startListening()
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ Reference< XRowSet> xDatabaseForm(m_xActiveForm, UNO_QUERY);
+ if (xDatabaseForm.is() && getRowSetConnection(xDatabaseForm).is())
+ {
+ Reference< XPropertySet> xActiveFormSet(m_xActiveForm, UNO_QUERY);
+ if (xActiveFormSet.is())
+ {
+ // wenn es eine Datenquelle gibt, dann den Listener aufbauen
+ // TODO: this is strange - shouldn't this depend on a isLoaded instead of
+ // a "has command value"? Finally, the command value only means that it was
+ // intended to be loaded, not that it actually *is* loaded
+ ::rtl::OUString aSource = ::comphelper::getString(xActiveFormSet->getPropertyValue(FM_PROP_COMMAND));
+ if (aSource.getLength())
+ {
+ m_bDatabaseBar = sal_True;
+
+ xActiveFormSet->getPropertyValue(FM_PROP_NAVIGATION) >>= m_eNavigate;
+
+ switch (m_eNavigate)
+ {
+ case NavigationBarMode_PARENT:
+ {
+ // suchen des Controllers, ueber den eine Navigation moeglich ist
+ Reference< XChild> xChild(m_xActiveController, UNO_QUERY);
+ Reference< runtime::XFormController > xParent;
+ while (xChild.is())
+ {
+ xChild = Reference< XChild>(xChild->getParent(), UNO_QUERY);
+ xParent = Reference< runtime::XFormController >(xChild, UNO_QUERY);
+ Reference< XPropertySet> xParentSet;
+ if (xParent.is())
+ xParentSet = Reference< XPropertySet>(xParent->getModel(), UNO_QUERY);
+ if (xParentSet.is())
+ {
+ xParentSet->getPropertyValue(FM_PROP_NAVIGATION) >>= m_eNavigate;
+ if (m_eNavigate == NavigationBarMode_CURRENT)
+ break;
+ }
+ }
+ m_xNavigationController = xParent;
+ }
+ break;
+
+ case NavigationBarMode_CURRENT:
+ m_xNavigationController = m_xActiveController;
+ break;
+
+ default:
+ m_xNavigationController = NULL;
+ m_bDatabaseBar = sal_False;
+ }
+
+ m_aNavControllerFeatures.dispose();
+ if ( m_xNavigationController.is() && ( m_xNavigationController != m_xActiveController ) )
+ m_aNavControllerFeatures.assign( m_xNavigationController );
+
+ // an dem Controller, der die Navigation regelt, wg. RecordCount lauschen
+ Reference< XPropertySet> xNavigationSet;
+ if (m_xNavigationController.is())
+ {
+ xNavigationSet = Reference< XPropertySet>(m_xNavigationController->getModel(), UNO_QUERY);
+ if (xNavigationSet.is())
+ xNavigationSet->addPropertyChangeListener(FM_PROP_ROWCOUNT,this);
+ }
+ return;
+ }
+ }
+ }
+
+ m_eNavigate = NavigationBarMode_NONE;
+ m_bDatabaseBar = sal_False;
+ m_xNavigationController = NULL;
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::stopListening()
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ Reference< XRowSet> xDatabaseForm(m_xActiveForm, UNO_QUERY);
+ if ( xDatabaseForm.is() )
+ {
+ if (m_xNavigationController.is())
+ {
+ Reference< XPropertySet> xSet(m_xNavigationController->getModel(), UNO_QUERY);
+ if (xSet.is())
+ xSet->removePropertyChangeListener(FM_PROP_ROWCOUNT, this);
+
+ }
+ }
+
+ m_bDatabaseBar = sal_False;
+ m_eNavigate = NavigationBarMode_NONE;
+ m_xNavigationController = NULL;
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::ShowSelectionProperties( sal_Bool bShow )
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ // if the window is already visible, only update the state
+ sal_Bool bHasChild = m_pShell->GetViewShell()->GetViewFrame()->HasChildWindow( SID_FM_SHOW_PROPERTIES );
+ if ( bHasChild && bShow )
+ UpdateSlot( SID_FM_PROPERTY_CONTROL );
+
+ // else toggle state
+ else
+ m_pShell->GetViewShell()->GetViewFrame()->ToggleChildWindow(SID_FM_SHOW_PROPERTIES);
+
+ InvalidateSlot( SID_FM_PROPERTIES, sal_False );
+ InvalidateSlot( SID_FM_CTL_PROPERTIES, sal_False );
+}
+
+//------------------------------------------------------------------------------
+IMPL_LINK(FmXFormShell, OnFoundData, FmFoundRecordInformation*, pfriWhere)
+{
+ if ( impl_checkDisposed() )
+ return 0;
+
+ DBG_ASSERT((pfriWhere->nContext >= 0) && (pfriWhere->nContext < (sal_Int16)m_aSearchForms.size()),
+ "FmXFormShell::OnFoundData : ungueltiger Kontext !");
+ Reference< XForm> xForm( m_aSearchForms.at(pfriWhere->nContext));
+ DBG_ASSERT(xForm.is(), "FmXFormShell::OnFoundData : ungueltige Form !");
+
+ Reference< XRowLocate> xCursor(xForm, UNO_QUERY);
+ if (!xCursor.is())
+ return 0; // was soll ich da machen ?
+
+ // zum Datensatz
+ try
+ {
+ xCursor->moveToBookmark(pfriWhere->aPosition);
+ }
+ catch(const SQLException&)
+ {
+ OSL_ENSURE(0,"Can position on bookmark!");
+ }
+
+ LoopGrids(GA_FORCE_SYNC);
+
+ // und zum Feld (dazu habe ich vor dem Start des Suchens die XVclComponent-Interfaces eingesammelt)
+ DBG_ASSERT(pfriWhere->nFieldPos < m_arrSearchedControls.Count(), "FmXFormShell::OnFoundData : ungueltige Daten uebergeben !");
+ SdrObject* pObject = m_arrSearchedControls.GetObject(pfriWhere->nFieldPos);
+ DBG_ASSERT(pObject != NULL, "FmXFormShell::OnFoundData : unerwartet : ungueltiges VclControl-Interface");
+
+ m_pShell->GetFormView()->UnMarkAll(m_pShell->GetFormView()->GetSdrPageView());
+ m_pShell->GetFormView()->MarkObj(pObject, m_pShell->GetFormView()->GetSdrPageView());
+
+ FmFormObj* pFormObject = FmFormObj::GetFormObject( pObject );
+ Reference< XControlModel > xControlModel( pFormObject ? pFormObject->GetUnoControlModel() : Reference< XControlModel >() );
+ DBG_ASSERT( xControlModel.is(), "FmXFormShell::OnFoundData: invalid control!" );
+ if ( !xControlModel.is() )
+ return 0;
+
+ // disable the permanent cursor for the last grid we found a record
+ if (m_xLastGridFound.is() && (m_xLastGridFound != xControlModel))
+ {
+ Reference< XPropertySet> xOldSet(m_xLastGridFound, UNO_QUERY);
+ xOldSet->setPropertyValue(FM_PROP_ALWAYSSHOWCURSOR, makeAny( (sal_Bool)sal_False ) );
+ Reference< XPropertyState> xOldSetState(xOldSet, UNO_QUERY);
+ if (xOldSetState.is())
+ xOldSetState->setPropertyToDefault(FM_PROP_CURSORCOLOR);
+ else
+ xOldSet->setPropertyValue(FM_PROP_CURSORCOLOR, Any());
+ }
+
+ // wenn das Feld sich in einem GridControl befindet, muss ich dort noch in die entsprechende Spalte gehen
+ sal_Int32 nGridColumn = m_arrRelativeGridColumn.GetObject(pfriWhere->nFieldPos);
+ if (nGridColumn != -1)
+ { // dummer weise muss ich mir das Control erst wieder besorgen
+ Reference< XControl> xControl( impl_getControl( xControlModel, *pFormObject ) );
+ Reference< XGrid> xGrid(xControl, UNO_QUERY);
+ DBG_ASSERT(xGrid.is(), "FmXFormShell::OnFoundData : ungueltiges Control !");
+ // wenn eine der Asserts anschlaegt, habe ich beim Aufbauen von m_arrSearchedControls wohl was falsch gemacht
+
+ // enable a permanent cursor for the grid so we can see the found text
+ Reference< XPropertySet> xModelSet(xControlModel, UNO_QUERY);
+ DBG_ASSERT(xModelSet.is(), "FmXFormShell::OnFoundData : invalid control model (no property set) !");
+ xModelSet->setPropertyValue( FM_PROP_ALWAYSSHOWCURSOR, makeAny( (sal_Bool)sal_True ) );
+ xModelSet->setPropertyValue( FM_PROP_CURSORCOLOR, makeAny( sal_Int32( COL_LIGHTRED ) ) );
+ m_xLastGridFound = xControlModel;
+
+ if ( xGrid.is() )
+ xGrid->setCurrentColumnPosition((sal_Int16)nGridColumn);
+ }
+
+ // als der Cursor neu positioniert wurde, habe ich (in positioned) meine Formularleisten-Slots invalidiert, aber das greift
+ // hier dummerweise nicht, da i.A. ja der (modale) Suchdialog oben ist ... also Gewalt ...
+ sal_uInt16 nPos = 0;
+ while (DatabaseSlotMap[nPos])
+ m_pShell->GetViewShell()->GetViewFrame()->GetBindings().Update(DatabaseSlotMap[nPos++]);
+ // leider geht das Update im Gegensatz zum Invalidate nur mit einzelnen Slots)
+
+ return 0;
+}
+
+//------------------------------------------------------------------------------
+IMPL_LINK(FmXFormShell, OnCanceledNotFound, FmFoundRecordInformation*, pfriWhere)
+{
+ if ( impl_checkDisposed() )
+ return 0;
+
+ DBG_ASSERT((pfriWhere->nContext >= 0) && (pfriWhere->nContext < (sal_Int16)m_aSearchForms.size()),
+ "FmXFormShell::OnCanceledNotFound : ungueltiger Kontext !");
+ Reference< XForm> xForm( m_aSearchForms.at(pfriWhere->nContext));
+ DBG_ASSERT(xForm.is(), "FmXFormShell::OnCanceledNotFound : ungueltige Form !");
+
+ Reference< XRowLocate> xCursor(xForm, UNO_QUERY);
+ if (!xCursor.is())
+ return 0; // was soll ich da machen ?
+
+ // zum Datensatz
+ try
+ {
+ xCursor->moveToBookmark(pfriWhere->aPosition);
+ }
+ catch(const SQLException&)
+ {
+ OSL_ENSURE(0,"Can position on bookmark!");
+ }
+
+
+ m_pShell->GetFormView()->UnMarkAll(m_pShell->GetFormView()->GetSdrPageView());
+ return 0L;
+}
+
+//------------------------------------------------------------------------------
+IMPL_LINK(FmXFormShell, OnSearchContextRequest, FmSearchContext*, pfmscContextInfo)
+{
+ if ( impl_checkDisposed() )
+ return 0;
+
+ DBG_ASSERT(pfmscContextInfo->nContext < (sal_Int16)m_aSearchForms.size(), "FmXFormShell::OnSearchContextRequest : invalid parameter !");
+ Reference< XForm> xForm( m_aSearchForms.at(pfmscContextInfo->nContext));
+ DBG_ASSERT(xForm.is(), "FmXFormShell::OnSearchContextRequest : unexpected : invalid context !");
+
+ Reference< XResultSet> xIter(xForm, UNO_QUERY);
+ DBG_ASSERT(xIter.is(), "FmXFormShell::OnSearchContextRequest : unexpected : context has no iterator !");
+
+ // --------------------------------------------------------------------------------------------
+ // die Liste der zu involvierenden Felder zusammenstellen (sind die ControlSources aller Felder, die eine solche Eigenschaft habe)
+ UniString strFieldList, sFieldDisplayNames;
+ m_arrSearchedControls.Remove(0, m_arrSearchedControls.Count());
+ m_arrRelativeGridColumn.Remove(0, m_arrRelativeGridColumn.Count());
+
+ // folgendes kleines Problem : Ich brauche, um gefundene Felder zu markieren, SdrObjekte. Um hier festzustellen, welche Controls
+ // ich in die Suche einbeziehen soll, brauche ich Controls (also XControl-Interfaces). Ich muss also ueber eines von beiden
+ // iterieren und mir das jeweils andere besorgen. Dummerweise gibt es keine direkte Verbindung zwischen beiden Welten (abgesehen
+ // von einem GetUnoControl an SdrUnoObject, das aber ein OutputDevice verlangt, womit ich nichts anfangen kann).
+ // Allerdings komme ich sowohl von einem Control als auch von einem SdrObject zum Model, und damit ist mir mit einer doppelten
+ // Schleife die Zuordnung SdrObject<->Control moeglich.
+ // Die Alternative zu dieser (unschoenen und sicher auch nicht ganz fixen) Loesung waere, auf das Cachen der SdrObjects zu
+ // verzichten, was dann aber in OnFoundData zu wesentlicher Mehrarbeit fuehren wuerde (da ich mir dort jedesmal das SdrObject
+ // erst besorgen muesste). Da aber OnFoundData i.d.R. oefter aufgerufen wird als ExecuteSearch, erledige ich das hier.
+
+ Reference< XNameAccess> xValidFormFields;
+ Reference< XColumnsSupplier> xSupplyCols(xIter, UNO_QUERY);
+ DBG_ASSERT(xSupplyCols.is(), "FmXFormShell::OnSearchContextRequest : invalid cursor : no columns supplier !");
+ if (xSupplyCols.is())
+ xValidFormFields = xSupplyCols->getColumns();
+ DBG_ASSERT(xValidFormFields.is(), "FmXFormShell::OnSearchContextRequest : form has no fields !");
+
+ // aktuelle(r) Page/Controller
+ FmFormPage* pCurrentPage = m_pShell->GetCurPage();
+ DBG_ASSERT(pCurrentPage!=NULL, "FmXFormShell::OnSearchContextRequest : no page !");
+ // alle Sdr-Controls dieser Seite durchsuchen ...
+ ::rtl::OUString sControlSource, aName;
+
+ SdrObjListIter aPageIter( *pCurrentPage );
+ while ( aPageIter.IsMore() )
+ {
+ SdrObject* pCurrent = aPageIter.Next();
+ FmFormObj* pFormObject = FmFormObj::GetFormObject( pCurrent );
+ // note that in case pCurrent is a virtual object, pFormObject points to the referenced object
+
+ if ( !pFormObject )
+ continue;
+
+ // the current object's model, in different tastes
+ Reference< XControlModel> xControlModel( pFormObject->GetUnoControlModel() );
+ Reference< XFormComponent > xCurrentFormComponent( xControlModel, UNO_QUERY );
+ DBG_ASSERT( xCurrentFormComponent.is(), "FmXFormShell::OnSearchContextRequest: invalid objects!" );
+ if ( !xCurrentFormComponent.is() )
+ continue;
+
+ // does the component belong to the form which we're interested in?
+ if ( xCurrentFormComponent->getParent() != xForm )
+ continue;
+
+ // ... nach der ControlSource-Eigenschaft fragen
+ SearchableControlIterator iter( xCurrentFormComponent );
+ Reference< XControl> xControl;
+ // das Control, das als Model xControlModel hat
+ // (das folgende while kann mehrmals durchlaufen werden, ohne dass das Control sich aendert, dann muss
+ // ich nicht jedesmal neu suchen)
+
+ Reference< XInterface > xSearchable( iter.Next() );
+ while ( xSearchable.is() )
+ {
+ sControlSource = iter.getCurrentValue();
+ if ( sControlSource.getLength() == 0 )
+ { // das aktuelle Element hat keine ControlSource, also ist es ein GridControl (das ist das einzige, was
+ // der SearchableControlIterator noch zulaesst)
+ xControl = impl_getControl( xControlModel, *pFormObject );
+ DBG_ASSERT(xControl.is(), "FmXFormShell::OnSearchContextRequest : didn't ::std::find a control with requested model !");
+
+ Reference< XGridPeer> xGridPeer;
+ if ( xControl.is() )
+ xGridPeer.set( xControl->getPeer(), UNO_QUERY );
+ do
+ {
+ if (!xGridPeer.is())
+ break;
+
+ Reference< XIndexAccess> xPeerContainer(xGridPeer, UNO_QUERY);
+ if (!xPeerContainer.is())
+ break;
+
+ Reference< XIndexAccess> xModelColumns(xGridPeer->getColumns(), UNO_QUERY);
+ DBG_ASSERT(xModelColumns.is(), "FmXFormShell::OnSearchContextRequest : there is a grid control without columns !");
+ // the case 'no columns' should be indicated with an empty container, I think ...
+ DBG_ASSERT(xModelColumns->getCount() >= xPeerContainer->getCount(), "FmXFormShell::OnSearchContextRequest : impossible : have more view than model columns !");
+
+ Reference< XInterface> xCurrentColumn;
+ for (sal_Int16 nViewPos=0; nViewPos<xPeerContainer->getCount(); ++nViewPos)
+ {
+ xPeerContainer->getByIndex(nViewPos) >>= xCurrentColumn;
+ if (!xCurrentColumn.is())
+ continue;
+
+ // can we use this column control fo searching ?
+ if (!IsSearchableControl(xCurrentColumn))
+ continue;
+
+ sal_Int16 nModelPos = GridView2ModelPos(xModelColumns, nViewPos);
+ Reference< XPropertySet> xCurrentColModel;
+ xModelColumns->getByIndex(nModelPos) >>= xCurrentColModel;
+ aName = ::comphelper::getString(xCurrentColModel->getPropertyValue(FM_PROP_CONTROLSOURCE));
+ // the cursor has a field matching the control source ?
+ if (xValidFormFields->hasByName(aName))
+ {
+ strFieldList += aName.getStr();
+ strFieldList += ';';
+
+ sFieldDisplayNames += ::comphelper::getString(xCurrentColModel->getPropertyValue(FM_PROP_LABEL)).getStr();
+ sFieldDisplayNames += ';';
+
+ pfmscContextInfo->arrFields.push_back(xCurrentColumn);
+
+ // und das SdrObjekt zum Feld
+ m_arrSearchedControls.C40_INSERT(SdrObject, pCurrent, m_arrSearchedControls.Count());
+ // die Nummer der Spalte
+ m_arrRelativeGridColumn.Insert(nViewPos, m_arrRelativeGridColumn.Count());
+ }
+ }
+ } while (sal_False);
+ }
+ else
+ {
+ if (sControlSource.getLength() && xValidFormFields->hasByName(sControlSource))
+ {
+ // jetzt brauche ich das Control zum SdrObject
+ if (!xControl.is())
+ {
+ xControl = impl_getControl( xControlModel, *pFormObject );
+ DBG_ASSERT(xControl.is(), "FmXFormShell::OnSearchContextRequest : didn't ::std::find a control with requested model !");
+ }
+
+ if (IsSearchableControl(xControl))
+ { // alle Tests ueberstanden -> in die Liste mit aufnehmen
+ strFieldList += sControlSource.getStr();
+ strFieldList += ';';
+
+ // the label which should appear for the control :
+ sFieldDisplayNames += getLabelName(Reference< XPropertySet>(xControlModel, UNO_QUERY)).getStr();
+ sFieldDisplayNames += ';';
+
+ // das SdrObjekt merken (beschleunigt die Behandlung in OnFoundData)
+ m_arrSearchedControls.C40_INSERT(SdrObject, pCurrent, m_arrSearchedControls.Count());
+
+ // die Nummer der Spalte (hier ein Dummy, nur fuer GridControls interesant)
+ m_arrRelativeGridColumn.Insert(-1, m_arrRelativeGridColumn.Count());
+
+ // und fuer die formatierte Suche ...
+ pfmscContextInfo->arrFields.push_back(Reference< XInterface>(xControl, UNO_QUERY));
+ }
+ }
+ }
+
+ xSearchable = iter.Next();
+ }
+ }
+
+ strFieldList.EraseTrailingChars(';');
+ sFieldDisplayNames.EraseTrailingChars(';');
+
+ if (!pfmscContextInfo->arrFields.size())
+ {
+ pfmscContextInfo->arrFields.clear();
+ pfmscContextInfo->xCursor = NULL;
+ pfmscContextInfo->strUsedFields.Erase();
+ return 0L;
+ }
+
+ pfmscContextInfo->xCursor = xIter;
+ pfmscContextInfo->strUsedFields = strFieldList;
+ pfmscContextInfo->sFieldDisplayNames = sFieldDisplayNames;
+
+ // 66463 - 31.05.99 - FS
+ // wenn der Cursor sich in einem anderen RecordMode als STANDARD befindet, ruecksetzen
+ Reference< XPropertySet> xCursorSet(pfmscContextInfo->xCursor, UNO_QUERY);
+ Reference< XResultSetUpdate> xUpdateCursor(pfmscContextInfo->xCursor, UNO_QUERY);
+ if (xUpdateCursor.is() && xCursorSet.is() && xCursorSet.is())
+ {
+ if (::comphelper::getBOOL(xCursorSet->getPropertyValue(FM_PROP_ISNEW)))
+ xUpdateCursor->moveToCurrentRow();
+ else if (::comphelper::getBOOL(xCursorSet->getPropertyValue(FM_PROP_ISMODIFIED)))
+ xUpdateCursor->cancelRowUpdates();
+ }
+
+ return pfmscContextInfo->arrFields.size();
+}
+
+ // XContainerListener
+//------------------------------------------------------------------------------
+void FmXFormShell::elementInserted(const ContainerEvent& evt) throw(::com::sun::star::uno::RuntimeException)
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ // neues Object zum lauschen
+ Reference< XInterface> xTemp;
+ evt.Element >>= xTemp;
+ AddElement(xTemp);
+ m_pShell->DetermineForms(sal_True);
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::elementReplaced(const ContainerEvent& evt) throw(::com::sun::star::uno::RuntimeException)
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ Reference< XInterface> xTemp;
+ evt.ReplacedElement >>= xTemp;
+ RemoveElement(xTemp);
+ evt.Element >>= xTemp;
+ AddElement(xTemp);
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::elementRemoved(const ContainerEvent& evt) throw(::com::sun::star::uno::RuntimeException)
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ Reference< XInterface> xTemp;
+ evt.Element >>= xTemp;
+ RemoveElement(xTemp);
+ m_pShell->DetermineForms(sal_True);
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::UpdateForms( sal_Bool _bInvalidate )
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ Reference< XIndexAccess > xForms;
+
+ FmFormPage* pPage = m_pShell->GetCurPage();
+ if ( pPage )
+ {
+ if ( m_pShell->m_bDesignMode )
+ xForms = xForms.query( pPage->GetForms( false ) );
+ }
+
+ if ( m_xForms != xForms )
+ {
+ RemoveElement( m_xForms );
+ m_xForms = xForms;
+ AddElement( m_xForms );
+ }
+
+ m_pShell->DetermineForms( _bInvalidate );
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::AddElement(const Reference< XInterface>& _xElement)
+{
+ if ( impl_checkDisposed() )
+ return;
+ impl_AddElement_nothrow(_xElement);
+}
+// -----------------------------------------------------------------------------
+void FmXFormShell::impl_AddElement_nothrow(const Reference< XInterface>& Element)
+{
+ // am Container horchen
+ const Reference< XIndexContainer> xContainer(Element, UNO_QUERY);
+ if (xContainer.is())
+ {
+ const sal_uInt32 nCount = xContainer->getCount();
+ Reference< XInterface> xElement;
+ for (sal_uInt32 i = 0; i < nCount; ++i)
+ {
+ xElement.set(xContainer->getByIndex(i),UNO_QUERY);
+ impl_AddElement_nothrow(xElement);
+ }
+
+ const Reference< XContainer> xCont(Element, UNO_QUERY);
+ if (xCont.is())
+ xCont->addContainerListener(this);
+ }
+
+ const Reference< ::com::sun::star::view::XSelectionSupplier> xSelSupplier(Element, UNO_QUERY);
+ if (xSelSupplier.is())
+ xSelSupplier->addSelectionChangeListener(this);
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::RemoveElement(const Reference< XInterface>& Element)
+{
+ if ( impl_checkDisposed() )
+ return;
+ impl_RemoveElement_nothrow(Element);
+}
+//------------------------------------------------------------------------------
+void FmXFormShell::impl_RemoveElement_nothrow(const Reference< XInterface>& Element)
+{
+ const Reference< ::com::sun::star::view::XSelectionSupplier> xSelSupplier(Element, UNO_QUERY);
+ if (xSelSupplier.is())
+ xSelSupplier->removeSelectionChangeListener(this);
+
+ // Verbindung zu Kindern aufheben
+ const Reference< XIndexContainer> xContainer(Element, UNO_QUERY);
+ if (xContainer.is())
+ {
+ const Reference< XContainer> xCont(Element, UNO_QUERY);
+ if (xCont.is())
+ xCont->removeContainerListener(this);
+
+ const sal_uInt32 nCount = xContainer->getCount();
+ Reference< XInterface> xElement;
+ for (sal_uInt32 i = 0; i < nCount; i++)
+ {
+ xElement.set(xContainer->getByIndex(i),UNO_QUERY);
+ impl_RemoveElement_nothrow(xElement);
+ }
+ }
+
+ InterfaceBag::iterator wasSelectedPos = m_aCurrentSelection.find( Element );
+ if ( wasSelectedPos != m_aCurrentSelection.end() )
+ m_aCurrentSelection.erase( wasSelectedPos );
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::selectionChanged(const EventObject& rEvent) throw(::com::sun::star::uno::RuntimeException)
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ Reference< XSelectionSupplier > xSupplier( rEvent.Source, UNO_QUERY );
+ Reference< XInterface > xSelObj( xSupplier->getSelection(), UNO_QUERY );
+ // es wurde eine Selektion weggenommen, dieses kann nur durch die Shell vorgenommen werden
+ if ( !xSelObj.is() )
+ return;
+
+ EnableTrackProperties(sal_False);
+
+ sal_Bool bMarkChanged = m_pShell->GetFormView()->checkUnMarkAll(rEvent.Source);
+ Reference< XForm > xNewForm( GetForm( rEvent.Source ) );
+
+ InterfaceBag aNewSelection;
+ aNewSelection.insert( Reference< XInterface >( xSelObj, UNO_QUERY ) );
+
+ if ( setCurrentSelection( aNewSelection ) && IsPropBrwOpen() )
+ ShowSelectionProperties( sal_True );
+
+ EnableTrackProperties(sal_True);
+
+ if ( bMarkChanged )
+ m_pShell->NotifyMarkListChanged( m_pShell->GetFormView() );
+}
+
+//------------------------------------------------------------------------------
+IMPL_LINK(FmXFormShell, OnTimeOut, void*, /*EMPTYTAG*/)
+{
+ if ( impl_checkDisposed() )
+ return 0;
+
+ if (m_pShell->IsDesignMode() && m_pShell->GetFormView())
+ SetSelection(m_pShell->GetFormView()->GetMarkedObjectList());
+
+ return 0;
+}
+
+//------------------------------------------------------------------------
+void FmXFormShell::SetSelectionDelayed()
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ if (m_pShell->IsDesignMode() && IsTrackPropertiesEnabled() && !m_aMarkTimer.IsActive())
+ m_aMarkTimer.Start();
+}
+
+//------------------------------------------------------------------------
+void FmXFormShell::SetSelection(const SdrMarkList& rMarkList)
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ DetermineSelection(rMarkList);
+ m_pShell->NotifyMarkListChanged(m_pShell->GetFormView());
+}
+
+//------------------------------------------------------------------------
+void FmXFormShell::DetermineSelection(const SdrMarkList& rMarkList)
+{
+ if ( setCurrentSelectionFromMark( rMarkList ) && IsPropBrwOpen() )
+ ShowSelectionProperties( sal_True );
+}
+
+//------------------------------------------------------------------------------
+sal_Bool FmXFormShell::IsPropBrwOpen() const
+{
+ if ( impl_checkDisposed() )
+ return sal_False;
+
+ return( ( m_pShell->GetViewShell() && m_pShell->GetViewShell()->GetViewFrame() ) ?
+ m_pShell->GetViewShell()->GetViewFrame()->HasChildWindow(SID_FM_SHOW_PROPERTIES) : sal_False );
+}
+
+//------------------------------------------------------------------------------
+class FmXFormShell::SuspendPropertyTracking
+{
+private:
+ FmXFormShell& m_rShell;
+ sal_Bool m_bEnabled;
+
+public:
+ SuspendPropertyTracking( FmXFormShell& _rShell )
+ :m_rShell( _rShell )
+ ,m_bEnabled( sal_False )
+ {
+ if ( m_rShell.IsTrackPropertiesEnabled() )
+ {
+ m_rShell.EnableTrackProperties( sal_False );
+ m_bEnabled = sal_True;
+ }
+ }
+
+ ~SuspendPropertyTracking( )
+ {
+ if ( m_bEnabled ) // note that ( sal_False != m_bEnabled ) implies ( NULL != m_pShell )
+ m_rShell.EnableTrackProperties( sal_True );
+ }
+};
+
+//------------------------------------------------------------------------------
+void FmXFormShell::SetDesignMode(sal_Bool bDesign)
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ DBG_ASSERT(m_pShell->GetFormView(), "FmXFormShell::SetDesignMode : invalid call (have no shell or no view) !");
+ m_bChangingDesignMode = sal_True;
+
+ // 67506 - 15.07.99 - FS
+ // if we're switching off the design mode we have to force the property browser to be closed
+ // so it can commit it's changes _before_ we load the forms
+ if (!bDesign)
+ {
+ m_bHadPropertyBrowserInDesignMode = m_pShell->GetViewShell()->GetViewFrame()->HasChildWindow(SID_FM_SHOW_PROPERTIES);
+ if (m_bHadPropertyBrowserInDesignMode)
+ m_pShell->GetViewShell()->GetViewFrame()->ToggleChildWindow(SID_FM_SHOW_PROPERTIES);
+ }
+
+ FmFormView* pFormView = m_pShell->GetFormView();
+ if (bDesign)
+ {
+ // we are currently filtering, so stop filtering
+ if (m_bFilterMode)
+ stopFiltering(sal_False);
+
+ // an den Objekten meiner MarkList als Listener abmelden
+ pFormView->GetImpl()->stopMarkListWatching();
+ }
+ else
+ {
+ m_aMarkTimer.Stop();
+
+ SuspendPropertyTracking aSuspend( *this );
+ pFormView->GetImpl()->saveMarkList( sal_True );
+ }
+
+ if (bDesign && m_xExternalViewController.is())
+ CloseExternalFormViewer();
+
+ pFormView->ChangeDesignMode(bDesign);
+
+ // Listener benachrichtigen
+ FmDesignModeChangedHint aChangedHint( bDesign );
+ m_pShell->Broadcast(aChangedHint);
+
+ m_pShell->m_bDesignMode = bDesign;
+ UpdateForms( sal_False );
+
+ m_pTextShell->designModeChanged( m_pShell->m_bDesignMode );
+
+ if (bDesign)
+ {
+ SdrMarkList aList;
+ {
+ // during changing the mark list, don't track the selected objects in the property browser
+ SuspendPropertyTracking aSuspend( *this );
+ // restore the marks
+ pFormView->GetImpl()->restoreMarkList( aList );
+ }
+
+ // synchronize with the restored mark list
+ if ( aList.GetMarkCount() )
+ SetSelection( aList );
+ }
+ else
+ {
+ // am Model der View als Listener anmelden (damit ich mitbekomme, wenn jemand waehrend des Alive-Modus
+ // Controls loescht, die ich eigentlich mit saveMarkList gespeichert habe) (60343)
+ pFormView->GetImpl()->startMarkListWatching();
+ }
+
+ m_pShell->UIFeatureChanged();
+
+ // 67506 - 15.07.99 - FS
+ if (bDesign && m_bHadPropertyBrowserInDesignMode)
+ {
+ // The UIFeatureChanged performes an update (a check of the available features) asynchronously.
+ // So we can't call ShowSelectionProperties directly as the according feature isn't enabled yet.
+ // That's why we use an asynchron execution on the dispatcher.
+ // (And that's why this has to be done AFTER the UIFeatureChanged.)
+ m_pShell->GetViewShell()->GetViewFrame()->GetDispatcher()->Execute( SID_FM_SHOW_PROPERTY_BROWSER, SFX_CALLMODE_ASYNCHRON );
+ }
+ m_bChangingDesignMode = sal_False;
+}
+
+//------------------------------------------------------------------------------
+Reference< XControl> FmXFormShell::impl_getControl( const Reference< XControlModel >& i_rxModel, const FmFormObj& i_rKnownFormObj )
+{
+ if ( impl_checkDisposed() )
+ return NULL;
+
+ Reference< XControl > xControl;
+ try
+ {
+ Reference< XControlContainer> xControlContainer( getControlContainerForView(), UNO_SET_THROW );
+
+ Sequence< Reference< XControl > > seqControls( xControlContainer->getControls() );
+ const Reference< XControl >* pControls = seqControls.getArray();
+ // ... die ich dann durchsuchen kann
+ for (sal_Int32 i=0; i<seqControls.getLength(); ++i)
+ {
+ xControl.set( pControls[i], UNO_SET_THROW );
+ Reference< XControlModel > xCurrentModel( xControl->getModel() );
+ if ( xCurrentModel == i_rxModel )
+ break;
+ xControl.clear();
+ }
+
+ if ( !xControl.is() )
+ {
+ // fallabck (some controls might not have been created, yet, since they were never visible so far)
+ Reference< XControl > xContainerControl( xControlContainer, UNO_QUERY_THROW );
+ const Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerControl->getPeer() );
+ ENSURE_OR_THROW( pContainerWindow, "unexpected control container implementation" );
+
+ const SdrView* pSdrView = m_pShell ? m_pShell->GetFormView() : NULL;
+ ENSURE_OR_THROW( pSdrView, "no current view" );
+
+ xControl.set( i_rKnownFormObj.GetUnoControl( *pSdrView, *pContainerWindow ), UNO_QUERY_THROW );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ OSL_ENSURE( xControl.is(), "FmXFormShell::impl_getControl: no control found!" );
+ return xControl;
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::impl_collectFormSearchContexts_nothrow( const Reference< XInterface>& _rxStartingPoint,
+ const ::rtl::OUString& _rCurrentLevelPrefix, FmFormArray& _out_rForms, ::std::vector< String >& _out_rNames )
+{
+ try
+ {
+ Reference< XIndexAccess> xContainer( _rxStartingPoint, UNO_QUERY );
+ if ( !xContainer.is() )
+ return;
+
+ sal_Int32 nCount( xContainer->getCount() );
+ if ( nCount == 0 )
+ return;
+
+ ::rtl::OUString sCurrentFormName;
+ ::rtl::OUStringBuffer aNextLevelPrefix;
+ for ( sal_Int32 i=0; i<nCount; ++i )
+ {
+ // is the current child a form?
+ Reference< XForm > xCurrentAsForm( xContainer->getByIndex(i), UNO_QUERY );
+ if ( !xCurrentAsForm.is() )
+ continue;
+
+ Reference< XNamed > xNamed( xCurrentAsForm, UNO_QUERY_THROW );
+ sCurrentFormName = xNamed->getName();
+
+ // the name of the current form
+ ::rtl::OUStringBuffer sCompleteCurrentName( sCurrentFormName );
+ if ( _rCurrentLevelPrefix.getLength() )
+ {
+ sCompleteCurrentName.appendAscii( " (" );
+ sCompleteCurrentName.append ( _rCurrentLevelPrefix );
+ sCompleteCurrentName.appendAscii( ")" );
+ }
+
+ // the prefix for the next level
+ aNextLevelPrefix = _rCurrentLevelPrefix;
+ if ( _rCurrentLevelPrefix.getLength() )
+ aNextLevelPrefix.append( (sal_Unicode)'/' );
+ aNextLevelPrefix.append( sCurrentFormName );
+
+ // remember both the form and it's "display name"
+ _out_rForms.push_back( xCurrentAsForm );
+ _out_rNames.push_back( sCompleteCurrentName.makeStringAndClear() );
+
+ // und absteigen
+ impl_collectFormSearchContexts_nothrow( xCurrentAsForm, aNextLevelPrefix.makeStringAndClear(), _out_rForms, _out_rNames );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::startFiltering()
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ // setting all forms in filter mode
+ FmXFormView* pXView = m_pShell->GetFormView()->GetImpl();
+
+ // if the active controller is our external one we have to use the trigger controller
+ Reference< XControlContainer> xContainer;
+ if (getActiveController() == m_xExternalViewController)
+ {
+ DBG_ASSERT(m_xExtViewTriggerController.is(), "FmXFormShell::startFiltering : inconsistent : active external controller, but noone triggered this !");
+ xContainer = m_xExtViewTriggerController->getContainer();
+ }
+ else
+ xContainer = getActiveController()->getContainer();
+
+ PFormViewPageWindowAdapter pAdapter = pXView->findWindow( xContainer );
+ if ( pAdapter.is() )
+ {
+ const ::std::vector< Reference< runtime::XFormController> >& rControllerList = pAdapter->GetList();
+ for ( ::std::vector< Reference< runtime::XFormController> >::const_iterator j = rControllerList.begin();
+ j != rControllerList.end();
+ ++j
+ )
+ {
+ Reference< XModeSelector> xModeSelector(*j, UNO_QUERY);
+ if (xModeSelector.is())
+ xModeSelector->setMode( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterMode" ) ) );
+ }
+ }
+
+ m_bFilterMode = sal_True;
+
+ m_pShell->UIFeatureChanged();
+ SfxViewFrame* pViewFrame = m_pShell->GetViewShell()->GetViewFrame();
+ pViewFrame->GetBindings().InvalidateShell( *m_pShell );
+
+ if ( pViewFrame->KnowsChildWindow( SID_FM_FILTER_NAVIGATOR )
+ && !pViewFrame->HasChildWindow( SID_FM_FILTER_NAVIGATOR )
+ )
+ {
+ pViewFrame->ToggleChildWindow( SID_FM_FILTER_NAVIGATOR );
+ }
+}
+
+//------------------------------------------------------------------------------
+void saveFilter(const Reference< runtime::XFormController >& _rxController)
+{
+ Reference< XPropertySet> xFormAsSet(_rxController->getModel(), UNO_QUERY);
+ Reference< XPropertySet> xControllerAsSet(_rxController, UNO_QUERY);
+ Reference< XIndexAccess> xControllerAsIndex(_rxController, UNO_QUERY);
+
+ // call the subcontroller
+ Reference< runtime::XFormController > xController;
+ for (sal_Int32 i = 0, nCount = xControllerAsIndex->getCount(); i < nCount; ++i)
+ {
+ xControllerAsIndex->getByIndex(i) >>= xController;
+ saveFilter(xController);
+ }
+
+ try
+ {
+
+ xFormAsSet->setPropertyValue(FM_PROP_FILTER, xControllerAsSet->getPropertyValue(FM_PROP_FILTER));
+ xFormAsSet->setPropertyValue(FM_PROP_APPLYFILTER, makeAny( (sal_Bool)sal_True ) );
+ }
+ catch (const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::stopFiltering(sal_Bool bSave)
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ m_bFilterMode = sal_False;
+
+ FmXFormView* pXView = m_pShell->GetFormView()->GetImpl();
+
+ // if the active controller is our external one we have to use the trigger controller
+ Reference< XControlContainer> xContainer;
+ if (getActiveController() == m_xExternalViewController)
+ {
+ DBG_ASSERT(m_xExtViewTriggerController.is(), "FmXFormShell::stopFiltering : inconsistent : active external controller, but noone triggered this !");
+ xContainer = m_xExtViewTriggerController->getContainer();
+ }
+ else
+ xContainer = getActiveController()->getContainer();
+
+ PFormViewPageWindowAdapter pAdapter = pXView->findWindow(xContainer);
+ if ( pAdapter.is() )
+ {
+ const ::std::vector< Reference< runtime::XFormController > >& rControllerList = pAdapter->GetList();
+ ::std::vector < ::rtl::OUString > aOriginalFilters;
+ ::std::vector < sal_Bool > aOriginalApplyFlags;
+
+ if (bSave)
+ {
+ for (::std::vector< Reference< runtime::XFormController > > ::const_iterator j = rControllerList.begin();
+ j != rControllerList.end(); ++j)
+ {
+ if (bSave)
+ { // remember the current filter settings in case we're goin to reload the forms below (which may fail)
+ try
+ {
+ Reference< XPropertySet > xFormAsSet((*j)->getModel(), UNO_QUERY);
+ aOriginalFilters.push_back(::comphelper::getString(xFormAsSet->getPropertyValue(FM_PROP_FILTER)));
+ aOriginalApplyFlags.push_back(::comphelper::getBOOL(xFormAsSet->getPropertyValue(FM_PROP_APPLYFILTER)));
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("FmXFormShell::stopFiltering : could not get the original filter !");
+ // put dummies into the arrays so the they have the right size
+
+ if (aOriginalFilters.size() == aOriginalApplyFlags.size())
+ // the first getPropertyValue failed -> use two dummies
+ aOriginalFilters.push_back( ::rtl::OUString() );
+ aOriginalApplyFlags.push_back( sal_False );
+ }
+ }
+ saveFilter(*j);
+ }
+ }
+ for (::std::vector< Reference< runtime::XFormController > > ::const_iterator j = rControllerList.begin();
+ j != rControllerList.end(); ++j)
+ {
+
+ Reference< XModeSelector> xModeSelector(*j, UNO_QUERY);
+ if (xModeSelector.is())
+ xModeSelector->setMode( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DataMode" ) ) );
+ }
+ if (bSave) // execute the filter
+ {
+ const ::std::vector< Reference< runtime::XFormController > > & rControllers = pAdapter->GetList();
+ for (::std::vector< Reference< runtime::XFormController > > ::const_iterator j = rControllers.begin();
+ j != rControllers.end(); ++j)
+ {
+ Reference< XLoadable> xReload((*j)->getModel(), UNO_QUERY);
+ if (!xReload.is())
+ continue;
+ Reference< XPropertySet > xFormSet(xReload, UNO_QUERY);
+
+ try
+ {
+ xReload->reload();
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("FmXFormShell::stopFiltering: Exception occured!");
+ }
+
+ if (!isRowSetAlive(xFormSet))
+ { // something went wrong -> restore the original state
+ ::rtl::OUString sOriginalFilter = aOriginalFilters[ j - rControllers.begin() ];
+ sal_Bool bOriginalApplyFlag = aOriginalApplyFlags[ j - rControllers.begin() ];
+ try
+ {
+ xFormSet->setPropertyValue(FM_PROP_FILTER, makeAny(sOriginalFilter));
+ xFormSet->setPropertyValue(FM_PROP_APPLYFILTER, makeAny(bOriginalApplyFlag));
+ xReload->reload();
+ }
+ catch(const Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+ }
+ }
+
+ m_pShell->UIFeatureChanged();
+ m_pShell->GetViewShell()->GetViewFrame()->GetBindings().InvalidateShell(*m_pShell);
+}
+
+//------------------------------------------------------------------------------
+void clearFilter(const Reference< runtime::XFormController >& _rxController)
+{
+ Reference< XPropertySet> xControllerAsSet(_rxController, UNO_QUERY);
+ Reference< XIndexAccess> xControllerAsIndex(_rxController, UNO_QUERY);
+
+ // call the subcontroller
+ Reference< runtime::XFormController > xController;
+ for (sal_Int32 i = 0, nCount = xControllerAsIndex->getCount();
+ i < nCount; i++)
+ {
+ xControllerAsIndex->getByIndex(i) >>= xController;
+ clearFilter(xController);
+ }
+
+ // clear the filter
+ Reference< XIndexContainer> xContainer;
+ xControllerAsSet->getPropertyValue(FM_PROP_FILTERSUPPLIER) >>= xContainer;
+ if (xContainer.is())
+ {
+ // clear the current filter
+ Sequence< PropertyValue> aCondition;
+
+ // as there is always an empty row, if we have a filter:
+ if (xContainer->getCount())
+ {
+ xControllerAsSet->setPropertyValue(FM_PROP_CURRENTFILTER, makeAny(sal_Int32(xContainer->getCount() - 1)));
+ while (xContainer->getCount() > 1)
+ xContainer->removeByIndex(0);
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::clearFilter()
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ FmXFormView* pXView = m_pShell->GetFormView()->GetImpl();
+
+ // if the active controller is our external one we have to use the trigger controller
+ Reference< XControlContainer> xContainer;
+ if (getActiveController() == m_xExternalViewController)
+ {
+ DBG_ASSERT(m_xExtViewTriggerController.is(), "FmXFormShell::clearFilter : inconsistent : active external controller, but noone triggered this !");
+ xContainer = m_xExtViewTriggerController->getContainer();
+ }
+ else
+ xContainer = getActiveController()->getContainer();
+
+ PFormViewPageWindowAdapter pAdapter = pXView->findWindow(xContainer);
+ if ( pAdapter.is() )
+ {
+ const ::std::vector< Reference< runtime::XFormController > > & rControllerList = pAdapter->GetList();
+ for ( ::std::vector< Reference< runtime::XFormController > > ::const_iterator j = rControllerList.begin();
+ j != rControllerList.end();
+ ++j
+ )
+ {
+ ::clearFilter(*j);
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::CreateExternalView()
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ DBG_ASSERT(m_xAttachedFrame.is(), "FmXFormShell::CreateExternalView : no frame !");
+
+ // the frame the external view is displayed in
+ sal_Bool bAlreadyExistent = m_xExternalViewController.is();
+ Reference< ::com::sun::star::frame::XFrame> xExternalViewFrame;
+ ::rtl::OUString sFrameName = ::rtl::OUString::createFromAscii("_beamer");
+ sal_Int32 nSearchFlags = ::com::sun::star::frame::FrameSearchFlag::CHILDREN | ::com::sun::star::frame::FrameSearchFlag::CREATE;
+
+ Reference< runtime::XFormController > xCurrentNavController( getNavController());
+ // the creation of the "partwindow" may cause a deactivate of the document which will result in our nav controller to be set to NULL
+
+ // _first_ check if we have any valid fields we can use for the grid view
+ // FS - 21.10.99 - 69219
+ {
+ FmXBoundFormFieldIterator aModelIterator(xCurrentNavController->getModel());
+ Reference< XPropertySet> xCurrentModelSet;
+ sal_Bool bHaveUsableControls = sal_False;
+ while ((xCurrentModelSet = Reference< XPropertySet>(aModelIterator.Next(), UNO_QUERY)).is())
+ {
+ // the FmXBoundFormFieldIterator only supplies controls with a valid control source
+ // so we just have to check the field type
+ sal_Int16 nClassId = ::comphelper::getINT16(xCurrentModelSet->getPropertyValue(FM_PROP_CLASSID));
+ switch (nClassId)
+ {
+ case FormComponentType::IMAGECONTROL:
+ case FormComponentType::CONTROL:
+ continue;
+ }
+ bHaveUsableControls = sal_True;
+ break;
+ }
+
+ if (!bHaveUsableControls)
+ {
+ ErrorBox(NULL, WB_OK, SVX_RESSTR(RID_STR_NOCONTROLS_FOR_EXTERNALDISPLAY)).Execute();
+ return;
+ }
+ }
+
+ // load the component for external form views
+ if (!bAlreadyExistent)
+ {
+ URL aWantToDispatch;
+ aWantToDispatch.Complete = FMURL_COMPONENT_FORMGRIDVIEW;
+
+ Reference< ::com::sun::star::frame::XDispatchProvider> xProv(m_xAttachedFrame, UNO_QUERY);
+ Reference< ::com::sun::star::frame::XDispatch> xDisp;
+ if (xProv.is())
+ xDisp = xProv->queryDispatch(aWantToDispatch, sFrameName, nSearchFlags);
+ if (xDisp.is())
+ {
+ xDisp->dispatch(aWantToDispatch, Sequence< PropertyValue>());
+ }
+
+ // with this the component should be loaded, now search the frame where it resides in
+ xExternalViewFrame = m_xAttachedFrame->findFrame(sFrameName, ::com::sun::star::frame::FrameSearchFlag::CHILDREN);
+ if (xExternalViewFrame.is())
+ {
+ m_xExternalViewController = xExternalViewFrame->getController();
+ Reference< ::com::sun::star::lang::XComponent> xComp(m_xExternalViewController, UNO_QUERY);
+ if (xComp.is())
+ xComp->addEventListener((XEventListener*)(XPropertyChangeListener*)this);
+ }
+ }
+ else
+ {
+ xExternalViewFrame = m_xExternalViewController->getFrame();
+ Reference< ::com::sun::star::frame::XDispatchProvider> xCommLink(xExternalViewFrame, UNO_QUERY);
+
+ // if we display the active form we interpret the slot as "remove it"
+ Reference< XForm> xCurrentModel(xCurrentNavController->getModel(), UNO_QUERY);
+ if ((xCurrentModel == m_xExternalDisplayedForm) || (getInternalForm(xCurrentModel) == m_xExternalDisplayedForm))
+ {
+ if ( m_xExternalViewController == getActiveController() )
+ {
+ Reference< runtime::XFormController > xAsFormController( m_xExternalViewController, UNO_QUERY );
+ ControllerFeatures aHelper( ::comphelper::getProcessServiceFactory(), xAsFormController, NULL );
+ aHelper->commitCurrentControl();
+ }
+
+ Reference< runtime::XFormController > xNewController(m_xExtViewTriggerController);
+ CloseExternalFormViewer();
+ setActiveController(xNewController);
+ return;
+ }
+
+ URL aClearURL;
+ aClearURL.Complete = FMURL_GRIDVIEW_CLEARVIEW;
+
+ Reference< ::com::sun::star::frame::XDispatch> xClear( xCommLink->queryDispatch(aClearURL, ::rtl::OUString::createFromAscii(""), 0));
+ if (xClear.is())
+ xClear->dispatch(aClearURL, Sequence< PropertyValue>());
+ }
+
+ // TODO: We need an interceptor at the xSupplier, which forwards all queryDispatch requests to the FormController
+ // instance for which this "external view" was triggered
+
+ // get the dispatch interface of the frame so we can communicate (interceptable) with the controller
+ Reference< ::com::sun::star::frame::XDispatchProvider> xCommLink(xExternalViewFrame, UNO_QUERY);
+
+ if (m_xExternalViewController.is())
+ {
+ DBG_ASSERT(xCommLink.is(), "FmXFormShell::CreateExternalView : the component doesn't have the necessary interfaces !");
+ // collect the dispatchers we will need
+ URL aAddColumnURL;
+ aAddColumnURL.Complete = FMURL_GRIDVIEW_ADDCOLUMN;
+ Reference< ::com::sun::star::frame::XDispatch> xAddColumnDispatch( xCommLink->queryDispatch(aAddColumnURL, ::rtl::OUString::createFromAscii(""), 0));
+ URL aAttachURL;
+ aAttachURL.Complete = FMURL_GRIDVIEW_ATTACHTOFORM;
+ Reference< ::com::sun::star::frame::XDispatch> xAttachDispatch( xCommLink->queryDispatch(aAttachURL, ::rtl::OUString::createFromAscii(""), 0));
+
+ if (xAddColumnDispatch.is() && xAttachDispatch.is())
+ {
+ DBG_ASSERT(xCurrentNavController.is(), "FmXFormShell::CreateExternalView : invalid call : have no nav controller !");
+ // first : dispatch the descriptions for the columns to add
+ Sequence< Reference< XControl> > aCurrentControls(xCurrentNavController->getControls());
+
+ sal_Int16 nAddedColumns = 0;
+
+ // for radio buttons we need some special structures
+ DECLARE_STL_USTRINGACCESS_MAP(Sequence< ::rtl::OUString>, MapUString2UstringSeq);
+ DECLARE_STL_ITERATORS(MapUString2UstringSeq);
+ DECLARE_STL_USTRINGACCESS_MAP(::rtl::OUString, FmMapUString2UString);
+ DECLARE_STL_USTRINGACCESS_MAP(sal_Int16, FmMapUString2Int16);
+ DECLARE_STL_ITERATORS(FmMapUString2Int16);
+
+ MapUString2UstringSeq aRadioValueLists;
+ MapUString2UstringSeq aRadioListSources;
+ FmMapUString2UString aRadioControlSources;
+ FmMapUString2Int16 aRadioPositions;
+
+ FmXBoundFormFieldIterator aModelIterator(xCurrentNavController->getModel());
+ Reference< XPropertySet> xCurrentModelSet;
+ Any aCurrentBoundField;
+ ::rtl::OUString sColumnType,aGroupName,sControlSource;
+ Sequence< Property> aProps;
+ Reference< XPropertySet> xCurrentBoundField;
+ while ((xCurrentModelSet = Reference< XPropertySet>(aModelIterator.Next(), UNO_QUERY)).is())
+ {
+ xCurrentModelSet->getPropertyValue(FM_PROP_BOUNDFIELD) >>= xCurrentBoundField;
+ OSL_ENSURE(xCurrentModelSet.is(),"xCurrentModelSet is null!");
+ // create a description of the column to be created
+ // first : determine it's type
+
+ sal_Int16 nClassId = ::comphelper::getINT16(xCurrentModelSet->getPropertyValue(FM_PROP_CLASSID));
+ switch (nClassId)
+ {
+ case FormComponentType::RADIOBUTTON:
+ {
+ // get the label of the button (this is the access key for our structures)
+ aGroupName = getLabelName(xCurrentModelSet);
+
+ // add the reference value of the radio button to the list source sequence
+ Sequence< ::rtl::OUString>& aThisGroupLabels = aRadioListSources[aGroupName];
+ sal_Int32 nNewSizeL = aThisGroupLabels.getLength() + 1;
+ aThisGroupLabels.realloc(nNewSizeL);
+ aThisGroupLabels.getArray()[nNewSizeL - 1] = ::comphelper::getString(xCurrentModelSet->getPropertyValue(FM_PROP_REFVALUE));
+
+ // add the label to the value list sequence
+ Sequence< ::rtl::OUString>& aThisGroupControlSources = aRadioValueLists[aGroupName];
+ sal_Int32 nNewSizeC = aThisGroupControlSources.getLength() + 1;
+ aThisGroupControlSources.realloc(nNewSizeC);
+ aThisGroupControlSources.getArray()[nNewSizeC - 1] = ::comphelper::getString(xCurrentModelSet->getPropertyValue(FM_PROP_LABEL));
+
+ // remember the controls source of the radio group
+ sControlSource = ::comphelper::getString(xCurrentModelSet->getPropertyValue(FM_PROP_CONTROLSOURCE));
+ if (aRadioControlSources.find(aGroupName) == aRadioControlSources.end())
+ aRadioControlSources[aGroupName] = sControlSource;
+#ifdef DBG_UTIL
+ else
+ DBG_ASSERT(aRadioControlSources[aGroupName] == sControlSource,
+ "FmXFormShell::CreateExternalView : inconsistent radio buttons detected !");
+ // (radio buttons with the same name should have the same control source)
+#endif
+ // remember the position within the columns
+ if (aRadioPositions.find(aGroupName) == aRadioPositions.end())
+ aRadioPositions[aGroupName] = (sal_Int16)nAddedColumns;
+
+ // any further handling is done below
+ }
+ continue;
+
+ case FormComponentType::IMAGECONTROL:
+ case FormComponentType::CONTROL:
+ // no grid columns for these types (though they have a control source)
+ continue;
+ case FormComponentType::CHECKBOX:
+ sColumnType = FM_COL_CHECKBOX; break;
+ case FormComponentType::LISTBOX:
+ sColumnType = FM_COL_LISTBOX; break;
+ case FormComponentType::COMBOBOX:
+ sColumnType = FM_COL_COMBOBOX; break;
+ case FormComponentType::DATEFIELD:
+ sColumnType = FM_COL_DATEFIELD; break;
+ case FormComponentType::TIMEFIELD:
+ sColumnType = FM_COL_TIMEFIELD; break;
+ case FormComponentType::NUMERICFIELD:
+ sColumnType = FM_COL_NUMERICFIELD; break;
+ case FormComponentType::CURRENCYFIELD:
+ sColumnType = FM_COL_CURRENCYFIELD; break;
+ case FormComponentType::PATTERNFIELD:
+ sColumnType = FM_COL_PATTERNFIELD; break;
+
+ case FormComponentType::TEXTFIELD:
+ {
+ sColumnType = FM_COL_TEXTFIELD;
+ // we know at least two different controls which are TextFields : the basic edit field and the formatted
+ // field. we distinguish them by their service name
+ Reference< XServiceInfo> xInfo(xCurrentModelSet, UNO_QUERY);
+ if (xInfo.is())
+ {
+ sal_Int16 nObjectType = getControlTypeByObject(xInfo);
+ if (OBJ_FM_FORMATTEDFIELD == nObjectType)
+ sColumnType = FM_COL_FORMATTEDFIELD;
+ }
+ }
+ break;
+ default:
+ sColumnType = FM_COL_TEXTFIELD; break;
+ }
+
+ const sal_Int16 nDispatchArgs = 3;
+ Sequence< PropertyValue> aDispatchArgs(nDispatchArgs);
+ PropertyValue* pDispatchArgs = aDispatchArgs.getArray();
+
+ // properties describing "meta data" about the column
+ // the type
+ pDispatchArgs->Name = FMARG_ADDCOL_COLUMNTYPE;
+ pDispatchArgs->Value <<= sColumnType;
+ ++pDispatchArgs;
+
+ // the pos : append the col
+ pDispatchArgs->Name = FMARG_ADDCOL_COLUMNPOS;
+ pDispatchArgs->Value <<= nAddedColumns;
+ ++pDispatchArgs;
+
+ // the properties to forward to the new column
+ Sequence< PropertyValue> aColumnProps(1);
+ PropertyValue* pColumnProps = aColumnProps.getArray();
+
+ // the label
+ pColumnProps->Name = FM_PROP_LABEL;
+ pColumnProps->Value <<= getLabelName(xCurrentModelSet);
+ ++pColumnProps;
+
+ // for all other props : transfer them
+ Reference< XPropertySetInfo> xControlModelInfo( xCurrentModelSet->getPropertySetInfo());
+ DBG_ASSERT(xControlModelInfo.is(), "FmXFormShell::CreateExternalView : the control model has no property info ! This will crash !");
+ aProps = xControlModelInfo->getProperties();
+ const Property* pProps = aProps.getConstArray();
+
+ // realloc the control description sequence
+ sal_Int32 nExistentDescs = pColumnProps - aColumnProps.getArray();
+ aColumnProps.realloc(nExistentDescs + aProps.getLength());
+ pColumnProps = aColumnProps.getArray() + nExistentDescs;
+
+ for (sal_Int32 i=0; i<aProps.getLength(); ++i, ++pProps)
+ {
+ if (pProps->Name.equals(FM_PROP_LABEL))
+ // already set
+ continue;
+ if (pProps->Name.equals(FM_PROP_DEFAULTCONTROL))
+ // allow the column's own "default control"
+ continue;
+ if (pProps->Attributes & PropertyAttribute::READONLY)
+ // assume that properties which are readonly for the control are ro for the column to be created, too
+ continue;
+
+ pColumnProps->Name = pProps->Name;
+ pColumnProps->Value = xCurrentModelSet->getPropertyValue(pProps->Name);
+ ++pColumnProps;
+ }
+ aColumnProps.realloc(pColumnProps - aColumnProps.getArray());
+
+ // columns props are a dispatch argument
+ pDispatchArgs->Name = ::rtl::OUString::createFromAscii("ColumnProperties"); // TODO : fmurl.*
+ pDispatchArgs->Value = makeAny(aColumnProps);
+ ++pDispatchArgs;
+ DBG_ASSERT(nDispatchArgs == (pDispatchArgs - aDispatchArgs.getConstArray()),
+ "FmXFormShell::CreateExternalView : forgot to adjust nDispatchArgs ?");
+
+ // dispatch the "add column"
+ xAddColumnDispatch->dispatch(aAddColumnURL, aDispatchArgs);
+ ++nAddedColumns;
+ }
+
+ // now for the radio button handling
+ sal_Int16 nOffset(0);
+ // properties describing the "direct" column properties
+ const sal_Int16 nListBoxDescription = 6;
+ Sequence< PropertyValue> aListBoxDescription(nListBoxDescription);
+ for ( ConstFmMapUString2UStringIterator aCtrlSource = aRadioControlSources.begin();
+ aCtrlSource != aRadioControlSources.end();
+ ++aCtrlSource, ++nOffset
+ )
+ {
+
+ PropertyValue* pListBoxDescription = aListBoxDescription.getArray();
+ // label
+ pListBoxDescription->Name = FM_PROP_LABEL;
+ pListBoxDescription->Value <<= (*aCtrlSource).first;
+ ++pListBoxDescription;
+
+ // control source
+ pListBoxDescription->Name = FM_PROP_CONTROLSOURCE;
+ pListBoxDescription->Value <<= (*aCtrlSource).second;
+ ++pListBoxDescription;
+
+ // bound column
+ pListBoxDescription->Name = FM_PROP_BOUNDCOLUMN;
+ pListBoxDescription->Value <<= (sal_Int16)1;
+ ++pListBoxDescription;
+
+ // content type
+ pListBoxDescription->Name = FM_PROP_LISTSOURCETYPE;
+ ListSourceType eType = ListSourceType_VALUELIST;
+ pListBoxDescription->Value = makeAny(eType);
+ ++pListBoxDescription;
+
+ // list source
+ MapUString2UstringSeq::const_iterator aCurrentListSource = aRadioListSources.find((*aCtrlSource).first);
+ DBG_ASSERT(aCurrentListSource != aRadioListSources.end(),
+ "FmXFormShell::CreateExternalView : inconsistent radio descriptions !");
+ pListBoxDescription->Name = FM_PROP_LISTSOURCE;
+ pListBoxDescription->Value = makeAny((*aCurrentListSource).second);
+ ++pListBoxDescription;
+
+ // value list
+ MapUString2UstringSeq::const_iterator aCurrentValueList = aRadioValueLists.find((*aCtrlSource).first);
+ DBG_ASSERT(aCurrentValueList != aRadioValueLists.end(),
+ "FmXFormShell::CreateExternalView : inconsistent radio descriptions !");
+ pListBoxDescription->Name = FM_PROP_STRINGITEMLIST;
+ pListBoxDescription->Value = makeAny(((*aCurrentValueList).second));
+ ++pListBoxDescription;
+
+ DBG_ASSERT(nListBoxDescription == (pListBoxDescription - aListBoxDescription.getConstArray()),
+ "FmXFormShell::CreateExternalView : forgot to adjust nListBoxDescription ?");
+
+ // properties describing the column "meta data"
+ const sal_Int16 nDispatchArgs = 3;
+ Sequence< PropertyValue> aDispatchArgs(nDispatchArgs);
+ PropertyValue* pDispatchArgs = aDispatchArgs.getArray();
+
+ // column type : listbox
+ pDispatchArgs->Name = FMARG_ADDCOL_COLUMNTYPE;
+ ::rtl::OUString fColName = FM_COL_LISTBOX;
+ pDispatchArgs->Value <<= fColName;
+// pDispatchArgs->Value <<= (::rtl::OUString)FM_COL_LISTBOX;
+ ++pDispatchArgs;
+
+ // column position
+ pDispatchArgs->Name = FMARG_ADDCOL_COLUMNPOS;
+ FmMapUString2Int16::const_iterator aOffset = aRadioPositions.find((*aCtrlSource).first);
+ DBG_ASSERT(aOffset != aRadioPositions.end(),
+ "FmXFormShell::CreateExternalView : inconsistent radio descriptions !");
+ sal_Int16 nPosition = (*aOffset).second;
+ nPosition = nPosition + nOffset;
+ // we alread inserted nOffset additinal columns ....
+ pDispatchArgs->Value <<= nPosition;
+ ++pDispatchArgs;
+
+ // the
+ pDispatchArgs->Name = ::rtl::OUString::createFromAscii("ColumnProperties"); // TODO : fmurl.*
+ pDispatchArgs->Value = makeAny(aListBoxDescription);
+ ++pDispatchArgs;
+ DBG_ASSERT(nDispatchArgs == (pDispatchArgs - aDispatchArgs.getConstArray()),
+ "FmXFormShell::CreateExternalView : forgot to adjust nDispatchArgs ?");
+
+ // dispatch the "add column"
+ xAddColumnDispatch->dispatch(aAddColumnURL, aDispatchArgs);
+ ++nAddedColumns;
+ }
+
+
+ DBG_ASSERT(nAddedColumns > 0, "FmXFormShell::CreateExternalView : no controls (inconsistent) !");
+ // we should have checked if we have any usable controls (see above).
+
+ // "load" the "form" of the external view
+ PropertyValue aArg;
+ aArg.Name = FMARG_ATTACHTO_MASTERFORM;
+ Reference< XResultSet> xForm(xCurrentNavController->getModel(), UNO_QUERY);
+ aArg.Value <<= xForm;
+
+ m_xExternalDisplayedForm = Reference< XResultSet>(xForm, UNO_QUERY);
+ // do this before dispatching the "attach" command, as the atach may result in a call to our queryDispatch (for the FormSlots)
+ // whichs needs the m_xExternalDisplayedForm
+
+ xAttachDispatch->dispatch(aAttachURL, Sequence< PropertyValue>(&aArg, 1));
+
+ m_xExtViewTriggerController = xCurrentNavController;
+
+ // we want to know modifications done in the external view
+ // if the external controller is a XFormController we can use all our default handlings for it
+ Reference< runtime::XFormController > xFormController( m_xExternalViewController, UNO_QUERY );
+ OSL_ENSURE( xFormController.is(), "FmXFormShell::CreateExternalView:: invalid external view controller!" );
+ if (xFormController.is())
+ xFormController->addActivateListener((XFormControllerListener*)this);
+ }
+ }
+#ifdef DBG_UTIL
+ else
+ {
+ DBG_ERROR("FmXFormShell::CreateExternalView : could not create the external form view !");
+ }
+#endif
+ InvalidateSlot( SID_FM_VIEW_AS_GRID, sal_False );
+}
+
+//------------------------------------------------------------------------
+void FmXFormShell::implAdjustConfigCache()
+{
+ // get (cache) the wizard usage flag
+ Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString::createFromAscii("FormControlPilotsEnabled");
+ Sequence< Any > aFlags = GetProperties(aNames);
+ if (1 == aFlags.getLength())
+ m_bUseWizards = ::cppu::any2bool(aFlags[0]);
+}
+
+//------------------------------------------------------------------------
+void FmXFormShell::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames)
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ const ::rtl::OUString* pSearch = _rPropertyNames.getConstArray();
+ const ::rtl::OUString* pSearchTil = pSearch + _rPropertyNames.getLength();
+ for (;pSearch < pSearchTil; ++pSearch)
+ if (0 == pSearch->compareToAscii("FormControlPilotsEnabled"))
+ {
+ implAdjustConfigCache();
+ InvalidateSlot( SID_FM_USE_WIZARDS, sal_True );
+ }
+}
+
+void FmXFormShell::Commit()
+{
+}
+
+//------------------------------------------------------------------------
+void FmXFormShell::SetWizardUsing(sal_Bool _bUseThem)
+{
+ m_bUseWizards = _bUseThem;
+
+ Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString::createFromAscii("FormControlPilotsEnabled");
+ Sequence< Any > aValues(1);
+ aValues[0] = ::cppu::bool2any(m_bUseWizards);
+ PutProperties(aNames, aValues);
+}
+
+//------------------------------------------------------------------------
+void FmXFormShell::viewDeactivated( FmFormView& _rCurrentView, sal_Bool _bDeactivateController /* = sal_True */ )
+{
+
+ if ( _rCurrentView.GetImpl() && !_rCurrentView.IsDesignMode() )
+ {
+ _rCurrentView.GetImpl()->Deactivate( _bDeactivateController );
+ }
+
+ // if we have an async load operation pending for the 0-th page for this view,
+ // we need to cancel this
+ // 103727 - 2002-09-26 - fs@openoffice.org
+ FmFormPage* pPage = _rCurrentView.GetCurPage();
+ if ( pPage )
+ {
+ // move all events from our queue to a new one, omit the events for the deactivated
+ // page
+ ::std::queue< FmLoadAction > aNewEvents;
+ while ( m_aLoadingPages.size() )
+ {
+ FmLoadAction aAction = m_aLoadingPages.front();
+ m_aLoadingPages.pop();
+ if ( pPage != aAction.pPage )
+ {
+ aNewEvents.push( aAction );
+ }
+ else
+ {
+ Application::RemoveUserEvent( aAction.nEventId );
+ }
+ }
+ m_aLoadingPages = aNewEvents;
+ }
+
+ // remove callbacks at the page
+ if ( pPage )
+ {
+ pPage->GetImpl().SetFormsCreationHdl( Link() );
+ }
+ UpdateForms( sal_True );
+}
+
+//------------------------------------------------------------------------
+IMPL_LINK( FmXFormShell, OnFirstTimeActivation, void*, /*NOTINTERESTEDIN*/ )
+{
+ if ( impl_checkDisposed() )
+ return 0L;
+
+ m_nActivationEvent = 0;
+ SfxObjectShell* pDocument = m_pShell->GetObjectShell();
+
+ if ( pDocument && !pDocument->HasName() )
+ {
+ if ( isEnhancedForm() )
+ {
+ // show the data navigator
+ if ( !m_pShell->GetViewShell()->GetViewFrame()->HasChildWindow( SID_FM_SHOW_DATANAVIGATOR ) )
+ m_pShell->GetViewShell()->GetViewFrame()->ToggleChildWindow( SID_FM_SHOW_DATANAVIGATOR );
+ }
+ }
+
+ return 0L;
+}
+
+//------------------------------------------------------------------------
+IMPL_LINK( FmXFormShell, OnFormsCreated, FmFormPage*, /*_pPage*/ )
+{
+ UpdateForms( sal_True );
+ return 0L;
+}
+
+//------------------------------------------------------------------------
+void FmXFormShell::viewActivated( FmFormView& _rCurrentView, sal_Bool _bSyncAction /* = sal_False */ )
+{
+
+ FmFormPage* pPage = _rCurrentView.GetCurPage();
+
+ // activate our view if we are activated ourself
+ // FS - 30.06.99 - 67308
+ if ( _rCurrentView.GetImpl() && !_rCurrentView.IsDesignMode() )
+ {
+ // load forms for the page the current view belongs to
+ if ( pPage )
+ {
+ if ( !pPage->GetImpl().hasEverBeenActivated() )
+ loadForms( pPage, FORMS_LOAD | ( _bSyncAction ? FORMS_SYNC : FORMS_ASYNC ) );
+ pPage->GetImpl().setHasBeenActivated( );
+ }
+
+ // first-time initializations for the views
+ if ( !_rCurrentView.GetImpl()->hasEverBeenActivated( ) )
+ {
+ _rCurrentView.GetImpl()->onFirstViewActivation( PTR_CAST( FmFormModel, _rCurrentView.GetModel() ) );
+ _rCurrentView.GetImpl()->setHasBeenActivated( );
+ }
+
+ // activate the current view
+ _rCurrentView.GetImpl()->Activate( _bSyncAction );
+ }
+
+ // set callbacks at the page
+ if ( pPage )
+ {
+ pPage->GetImpl().SetFormsCreationHdl( LINK( this, FmXFormShell, OnFormsCreated ) );
+ }
+
+ UpdateForms( sal_True );
+
+ if ( !hasEverBeenActivated() )
+ {
+ m_nActivationEvent = Application::PostUserEvent( LINK( this, FmXFormShell, OnFirstTimeActivation ) );
+ setHasBeenActivated();
+ }
+
+ // find a default "current form", if there is none, yet
+ // #i88186# / 2008-04-12 / frank.schoenheit@sun.com
+ impl_defaultCurrentForm_nothrow();
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::impl_defaultCurrentForm_nothrow()
+{
+ if ( impl_checkDisposed() )
+ return;
+
+ if ( m_xCurrentForm.is() )
+ // no action required
+ return;
+
+ FmFormView* pFormView = m_pShell->GetFormView();
+ FmFormPage* pPage = pFormView ? pFormView->GetCurPage() : NULL;
+ if ( !pPage )
+ return;
+
+ try
+ {
+ Reference< XIndexAccess > xForms( pPage->GetForms( false ), UNO_QUERY );
+ if ( !xForms.is() || !xForms->hasElements() )
+ return;
+
+ Reference< XForm > xNewCurrentForm( xForms->getByIndex(0), UNO_QUERY_THROW );
+ impl_updateCurrentForm( xNewCurrentForm );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXFormShell::smartControlReset( const Reference< XIndexAccess >& _rxModels )
+{
+ if (!_rxModels.is())
+ {
+ DBG_ERROR("FmXFormShell::smartControlReset: invalid container!");
+ return;
+ }
+
+ static const ::rtl::OUString sClassIdPropertyName = FM_PROP_CLASSID;
+ static const ::rtl::OUString sBoundFieldPropertyName = FM_PROP_BOUNDFIELD;
+ sal_Int32 nCount = _rxModels->getCount();
+ Reference< XPropertySet > xCurrent;
+ Reference< XPropertySetInfo > xCurrentInfo;
+ Reference< XPropertySet > xBoundField;
+
+ for (sal_Int32 i=0; i<nCount; ++i)
+ {
+ _rxModels->getByIndex(i) >>= xCurrent;
+ if (xCurrent.is())
+ xCurrentInfo = xCurrent->getPropertySetInfo();
+ else
+ xCurrentInfo.clear();
+ if (!xCurrentInfo.is())
+ continue;
+
+ if (xCurrentInfo->hasPropertyByName(sClassIdPropertyName))
+ { // it's a control model
+
+ // check if this control is bound to a living database field
+ if (xCurrentInfo->hasPropertyByName(sBoundFieldPropertyName))
+ xCurrent->getPropertyValue(sBoundFieldPropertyName) >>= xBoundField;
+ else
+ xBoundField.clear();
+
+ // reset only if it's *not* bound
+ bool bReset = !xBoundField.is();
+
+ // and additionally, check if it has an external value binding
+ Reference< XBindableValue > xBindable( xCurrent, UNO_QUERY );
+ if ( xBindable.is() && xBindable->getValueBinding().is() )
+ bReset = false;
+
+ if ( bReset )
+ {
+ Reference< XReset > xControlReset( xCurrent, UNO_QUERY );
+ if ( xControlReset.is() )
+ xControlReset->reset();
+ }
+ }
+ else
+ {
+ Reference< XIndexAccess > xContainer(xCurrent, UNO_QUERY);
+ if (xContainer.is())
+ smartControlReset(xContainer);
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+IMPL_LINK( FmXFormShell, OnLoadForms, FmFormPage*, /*_pPage*/ )
+{
+ FmLoadAction aAction = m_aLoadingPages.front();
+ m_aLoadingPages.pop();
+
+ loadForms( aAction.pPage, aAction.nFlags & ~FORMS_ASYNC );
+ return 0L;
+}
+
+//------------------------------------------------------------------------------
+namespace
+{
+ sal_Bool lcl_isLoadable( const Reference< XInterface >& _rxLoadable )
+ {
+ // determines whether a form should be loaded or not
+ // if there is no datasource or connection there is no reason to load a form
+ Reference< XPropertySet > xSet( _rxLoadable, UNO_QUERY );
+ if ( !xSet.is() )
+ return sal_False;
+ try
+ {
+ Reference< XConnection > xConn;
+ if ( OStaticDataAccessTools().isEmbeddedInDatabase( _rxLoadable.get(), xConn ) )
+ return sal_True;
+
+ // is there already a active connection
+ xSet->getPropertyValue(FM_PROP_ACTIVE_CONNECTION) >>= xConn;
+ if ( xConn.is() )
+ return sal_True;
+
+ ::rtl::OUString sPropertyValue;
+ OSL_VERIFY( xSet->getPropertyValue( FM_PROP_DATASOURCE ) >>= sPropertyValue );
+ if ( sPropertyValue.getLength() )
+ return sal_True;
+
+ OSL_VERIFY( xSet->getPropertyValue( FM_PROP_URL ) >>= sPropertyValue );
+ if ( sPropertyValue.getLength() )
+ return sal_True;
+ }
+ catch(const Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return sal_False;
+ }
+}
+
+//------------------------------------------------------------------------
+void FmXFormShell::loadForms( FmFormPage* _pPage, const sal_uInt16 _nBehaviour /* FORMS_LOAD | FORMS_SYNC */ )
+{
+ DBG_ASSERT( ( _nBehaviour & ( FORMS_ASYNC | FORMS_UNLOAD ) ) != ( FORMS_ASYNC | FORMS_UNLOAD ),
+ "FmXFormShell::loadForms: async loading not supported - this will heavily fail!" );
+
+ if ( _nBehaviour & FORMS_ASYNC )
+ {
+ m_aLoadingPages.push( FmLoadAction(
+ _pPage,
+ _nBehaviour,
+ Application::PostUserEvent( LINK( this, FmXFormShell, OnLoadForms ), _pPage )
+ ) );
+ return;
+ }
+
+ DBG_ASSERT( _pPage, "FmXFormShell::loadForms: invalid page!" );
+ if ( _pPage )
+ {
+ // lock the undo env so the forms can change non-transient properties while loading
+ // (without this my doc's modified flag would be set)
+ FmFormModel* pModel = PTR_CAST( FmFormModel, _pPage->GetModel() );
+ DBG_ASSERT( pModel, "FmXFormShell::loadForms: invalid model!" );
+ if ( pModel )
+ pModel->GetUndoEnv().Lock();
+
+ // load all forms
+ Reference< XIndexAccess > xForms;
+ xForms = xForms.query( _pPage->GetForms( false ) );
+
+ if ( xForms.is() )
+ {
+ Reference< XLoadable > xForm;
+ sal_Bool bFormWasLoaded = sal_False;
+ for ( sal_Int32 j = 0, nCount = xForms->getCount(); j < nCount; ++j )
+ {
+ xForms->getByIndex( j ) >>= xForm;
+ bFormWasLoaded = sal_False;
+ // a database form must be loaded for
+ try
+ {
+ if ( 0 == ( _nBehaviour & FORMS_UNLOAD ) )
+ {
+ if ( lcl_isLoadable( xForm ) && !xForm->isLoaded() )
+ xForm->load();
+ }
+ else
+ {
+ if ( xForm->isLoaded() )
+ {
+ bFormWasLoaded = sal_True;
+ xForm->unload();
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ // reset the form if it was loaded
+ if ( bFormWasLoaded )
+ {
+ Reference< XIndexAccess > xContainer( xForm, UNO_QUERY );
+ DBG_ASSERT( xContainer.is(), "FmXFormShell::loadForms: the form is no container!" );
+ if ( xContainer.is() )
+ smartControlReset( xContainer );
+ }
+ }
+ }
+
+ if ( pModel )
+ // unlock the environment
+ pModel->GetUndoEnv().UnLock();
+ }
+}
+
+//------------------------------------------------------------------------
+void FmXFormShell::ExecuteTextAttribute( SfxRequest& _rReq )
+{
+ m_pTextShell->ExecuteTextAttribute( _rReq );
+}
+
+//------------------------------------------------------------------------
+void FmXFormShell::GetTextAttributeState( SfxItemSet& _rSet )
+{
+ m_pTextShell->GetTextAttributeState( _rSet );
+}
+
+//------------------------------------------------------------------------
+bool FmXFormShell::IsActiveControl( bool _bCountRichTextOnly ) const
+{
+ return m_pTextShell->IsActiveControl( _bCountRichTextOnly );
+}
+
+//------------------------------------------------------------------------
+void FmXFormShell::ForgetActiveControl()
+{
+ m_pTextShell->ForgetActiveControl();
+}
+
+//------------------------------------------------------------------------
+void FmXFormShell::SetControlActivationHandler( const Link& _rHdl )
+{
+ m_pTextShell->SetControlActivationHandler( _rHdl );
+}
+//------------------------------------------------------------------------
+void FmXFormShell::handleShowPropertiesRequest()
+{
+ if ( onlyControlsAreMarked() )
+ ShowSelectionProperties( sal_True );
+}
+
+//------------------------------------------------------------------------
+void FmXFormShell::handleMouseButtonDown( const SdrViewEvent& _rViewEvent )
+{
+ // catch simple double clicks
+ if ( ( _rViewEvent.nMouseClicks == 2 ) && ( _rViewEvent.nMouseCode == MOUSE_LEFT ) )
+ {
+ if ( _rViewEvent.eHit == SDRHIT_MARKEDOBJECT )
+ {
+ if ( onlyControlsAreMarked() )
+ ShowSelectionProperties( sal_True );
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+bool FmXFormShell::HasControlFocus() const
+{
+ bool bHasControlFocus = false;
+
+ try
+ {
+ Reference< XFormController > xController( getActiveController() );
+ Reference< XControl > xCurrentControl;
+ if ( xController.is() )
+ xCurrentControl.set( xController->getCurrentControl() );
+ if ( xCurrentControl.is() )
+ {
+ Reference< XWindow2 > xPeerWindow( xCurrentControl->getPeer(), UNO_QUERY_THROW );
+ bHasControlFocus = xPeerWindow->hasFocus();
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return bHasControlFocus;
+}
+
+//==============================================================================
+//==============================================================================
+SearchableControlIterator::SearchableControlIterator(Reference< XInterface> xStartingPoint)
+ :IndexAccessIterator(xStartingPoint)
+{
+}
+
+//------------------------------------------------------------------------------
+sal_Bool SearchableControlIterator::ShouldHandleElement(const Reference< XInterface>& xElement)
+{
+ // wenn das Ding eine ControlSource und einen BoundField-Property hat
+ Reference< XPropertySet> xProperties(xElement, UNO_QUERY);
+ if (::comphelper::hasProperty(FM_PROP_CONTROLSOURCE, xProperties) && ::comphelper::hasProperty(FM_PROP_BOUNDFIELD, xProperties))
+ {
+ // und das BoundField gueltig ist
+ Reference< XPropertySet> xField;
+ xProperties->getPropertyValue(FM_PROP_BOUNDFIELD) >>= xField;
+ if (xField.is())
+ {
+ // nehmen wir's
+ m_sCurrentValue = ::comphelper::getString(xProperties->getPropertyValue(FM_PROP_CONTROLSOURCE));
+ return sal_True;
+ }
+ }
+
+ // wenn es ein Grid-Control ist
+ if (::comphelper::hasProperty(FM_PROP_CLASSID, xProperties))
+ {
+ Any aClassId( xProperties->getPropertyValue(FM_PROP_CLASSID) );
+ if (::comphelper::getINT16(aClassId) == FormComponentType::GRIDCONTROL)
+ {
+ m_sCurrentValue = ::rtl::OUString();
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+//------------------------------------------------------------------------------
+sal_Bool SearchableControlIterator::ShouldStepInto(const Reference< XInterface>& /*xContainer*/) const
+{
+ return sal_True;
+}
+
+//==============================================================================
+//==============================================================================
+
+SV_IMPL_PTRARR(StatusForwarderArray, SfxStatusForwarder*)
+
+SFX_IMPL_MENU_CONTROL(ControlConversionMenuController, SfxBoolItem);
+
+//------------------------------------------------------------------------------
+ControlConversionMenuController::ControlConversionMenuController( sal_uInt16 _nId, Menu& _rMenu, SfxBindings& _rBindings )
+ :SfxMenuControl( _nId, _rBindings )
+ ,m_pMainMenu( &_rMenu )
+ ,m_pConversionMenu( NULL )
+{
+ if ( _nId == SID_FM_CHANGECONTROLTYPE )
+ {
+ m_pConversionMenu = FmXFormShell::GetConversionMenu();
+ _rMenu.SetPopupMenu( _nId, m_pConversionMenu );
+
+ for (sal_Int16 i=0; i<m_pConversionMenu->GetItemCount(); ++i)
+ {
+ _rBindings.Invalidate(m_pConversionMenu->GetItemId(i));
+ SfxStatusForwarder* pForwarder = new SfxStatusForwarder(m_pConversionMenu->GetItemId(i), *this);
+ m_aStatusForwarders.C40_INSERT(SfxStatusForwarder, pForwarder, m_aStatusForwarders.Count());
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+ControlConversionMenuController::~ControlConversionMenuController()
+{
+ m_pMainMenu->SetPopupMenu(SID_FM_CHANGECONTROLTYPE, NULL);
+ delete m_pConversionMenu;
+}
+
+//------------------------------------------------------------------------------
+void ControlConversionMenuController::StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState)
+{
+ if (nSID == GetId())
+ SfxMenuControl::StateChanged(nSID, eState, pState);
+ else if (FmXFormShell::isControlConversionSlot(nSID))
+ {
+ if ((m_pConversionMenu->GetItemPos(nSID) != MENU_ITEM_NOTFOUND) && (eState == SFX_ITEM_DISABLED))
+ {
+ m_pConversionMenu->RemoveItem(m_pConversionMenu->GetItemPos(nSID));
+ }
+ else if ((m_pConversionMenu->GetItemPos(nSID) == MENU_ITEM_NOTFOUND) && (eState != SFX_ITEM_DISABLED))
+ {
+ // We can't simply re-insert the item because we have a clear order for all the our items.
+ // So first we have to determine the position of the item to insert.
+ PopupMenu* pSource = FmXFormShell::GetConversionMenu();
+ sal_uInt16 nSourcePos = pSource->GetItemPos(nSID);
+ DBG_ASSERT(nSourcePos != MENU_ITEM_NOTFOUND, "ControlConversionMenuController::StateChanged : FmXFormShell supplied an invalid menu !");
+ sal_uInt16 nPrevInSource = nSourcePos;
+ sal_uInt16 nPrevInConversion = MENU_ITEM_NOTFOUND;
+ while (nPrevInSource>0)
+ {
+ sal_Int16 nPrevId = pSource->GetItemId(--nPrevInSource);
+
+ // do we have the source's predecessor in our conversion menu, too ?
+ nPrevInConversion = m_pConversionMenu->GetItemPos(nPrevId);
+ if (nPrevInConversion != MENU_ITEM_NOTFOUND)
+ break;
+ }
+ if (MENU_ITEM_NOTFOUND == nPrevInConversion)
+ // none of the items which precede the nSID-slot in the source menu are present in our conversion menu
+ nPrevInConversion = sal::static_int_cast< sal_uInt16 >(-1); // put the item at the first position
+ m_pConversionMenu->InsertItem(nSID, pSource->GetItemText(nSID), pSource->GetItemBits(nSID), ++nPrevInConversion);
+ m_pConversionMenu->SetItemImage(nSID, pSource->GetItemImage(nSID));
+ m_pConversionMenu->SetHelpId(nSID, pSource->GetHelpId(nSID));
+
+ delete pSource;
+ }
+ m_pMainMenu->EnableItem(SID_FM_CHANGECONTROLTYPE, m_pConversionMenu->GetItemCount() > 0);
+ }
+ else
+ {
+ DBG_ERROR("ControlConversionMenuController::StateChanged : unknown id !");
+ }
+}
+
+//==============================================================================
diff --git a/svx/source/form/fmsrccfg.cxx b/svx/source/form/fmsrccfg.cxx
new file mode 100644
index 000000000000..dc396feec29f
--- /dev/null
+++ b/svx/source/form/fmsrccfg.cxx
@@ -0,0 +1,363 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "svx/fmsrccfg.hxx"
+#include <svl/filerec.hxx>
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+#include <comphelper/processfactory.hxx>
+
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::i18n;
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ // ====================================================================
+ // = struct FmSearchParams - Parameter einer Suche
+ // ====================================================================
+
+ //---------------------------------------------------------------------
+ //--- 20.08.01 18:17:34 -----------------------------------------------
+
+ FmSearchParams::FmSearchParams()
+ :nTransliterationFlags( 0 )
+ ,nSearchForType ( 0 )
+ ,nPosition ( MATCHING_ANYWHERE )
+ ,nLevOther ( 2 )
+ ,nLevShorter ( 2 )
+ ,nLevLonger ( 2 )
+ ,bLevRelaxed ( sal_True )
+ ,bAllFields ( sal_False )
+ ,bUseFormatter ( sal_True )
+ ,bBackwards ( sal_False )
+ ,bWildcard ( sal_False )
+ ,bRegular ( sal_False )
+ ,bApproxSearch ( sal_False )
+ ,bSoundsLikeCJK ( sal_False )
+ {
+ nTransliterationFlags =
+ TransliterationModules_ignoreSpace_ja_JP
+ | TransliterationModules_ignoreMiddleDot_ja_JP
+ | TransliterationModules_ignoreProlongedSoundMark_ja_JP
+ | TransliterationModules_ignoreSeparator_ja_JP
+ | TransliterationModules_IGNORE_CASE;
+ }
+
+ //---------------------------------------------------------------------
+ //--- 21.08.01 13:31:48 -----------------------------------------------
+
+ sal_Bool FmSearchParams::isIgnoreWidthCJK( ) const
+ {
+ return 0 != (nTransliterationFlags & TransliterationModules_IGNORE_WIDTH);
+ }
+
+ //---------------------------------------------------------------------
+ //--- 21.08.01 13:32:03 -----------------------------------------------
+
+ void FmSearchParams::setIgnoreWidthCJK( sal_Bool _bIgnore )
+ {
+ if ( _bIgnore )
+ nTransliterationFlags |= TransliterationModules_IGNORE_WIDTH;
+ else
+ nTransliterationFlags &= ~TransliterationModules_IGNORE_WIDTH;
+ }
+
+ //---------------------------------------------------------------------
+ //--- 21.08.01 13:47:52 -----------------------------------------------
+
+ sal_Bool FmSearchParams::isCaseSensitive( ) const
+ {
+ return 0 == (nTransliterationFlags & TransliterationModules_IGNORE_CASE);
+ }
+
+ //---------------------------------------------------------------------
+ //--- 21.08.01 13:48:00 -----------------------------------------------
+
+ void FmSearchParams::setCaseSensitive( sal_Bool _bCase )
+ {
+ if ( _bCase )
+ nTransliterationFlags &= ~TransliterationModules_IGNORE_CASE;
+ else
+ nTransliterationFlags |= TransliterationModules_IGNORE_CASE;
+ }
+
+ // ====================================================================
+ // = maps from ascii values to int values
+ // ====================================================================
+
+ struct Ascii2Int16
+ {
+ const sal_Char* pAscii;
+ sal_Int16 nValue;
+ };
+
+ //---------------------------------------------------------------------
+ //--- 20.08.01 18:28:38 -----------------------------------------------
+
+ static const Ascii2Int16* lcl_getSearchForTypeValueMap()
+ {
+ static const Ascii2Int16 s_aSearchForTypeMap[] =
+ {
+ { "text", 0 },
+ { "null", 1 },
+ { "non-null", 2 },
+ { NULL, -1 }
+ };
+ return s_aSearchForTypeMap;
+ }
+
+ //---------------------------------------------------------------------
+ //--- 20.08.01 18:28:38 -----------------------------------------------
+
+ static const Ascii2Int16* lcl_getSearchPositionValueMap()
+ {
+ static const Ascii2Int16 s_aSearchPositionMap[] =
+ {
+ { "anywhere-in-field", MATCHING_ANYWHERE },
+ { "beginning-of-field", MATCHING_BEGINNING },
+ { "end-of-field", MATCHING_END },
+ { "complete-field", MATCHING_WHOLETEXT },
+ { NULL, -1 }
+ };
+ return s_aSearchPositionMap;
+ }
+
+ //---------------------------------------------------------------------
+ //--- 20.08.01 18:30:15 -----------------------------------------------
+
+ static sal_Int16 lcl_implMapAsciiValue( const ::rtl::OUString& _rAsciiValue, const Ascii2Int16* _pMap )
+ {
+ // search the map for the given ascii value
+ const Ascii2Int16* pSearch = _pMap;
+ while ( pSearch && pSearch->pAscii )
+ {
+ if ( 0 == _rAsciiValue.compareToAscii( pSearch->pAscii ) )
+ // found
+ return pSearch->nValue;
+ ++pSearch;
+ }
+
+ DBG_ERROR(
+ ( ::rtl::OString( "lcl_implMapAsciiValue: could not convert the ascii value " )
+ += ::rtl::OString( _rAsciiValue.getStr(), _rAsciiValue.getLength(), RTL_TEXTENCODING_ASCII_US )
+ += ::rtl::OString( " !" )
+ ).getStr()
+ );
+ return -1;
+ }
+
+ //---------------------------------------------------------------------
+ //--- 20.08.01 18:33:06 -----------------------------------------------
+
+ static const sal_Char* lcl_implMapIntValue( const sal_Int16 _nValue, const Ascii2Int16* _pMap )
+ {
+ // search the map for the given integer value
+ const Ascii2Int16* pSearch = _pMap;
+ while ( pSearch && pSearch->pAscii )
+ {
+ if ( _nValue == pSearch->nValue )
+ // found
+ return pSearch->pAscii;
+ ++pSearch;
+ }
+
+ DBG_ERROR(
+ ( ::rtl::OString( "lcl_implMapIntValue: could not convert the integer value " )
+ += ::rtl::OString::valueOf( (sal_Int32)_nValue )
+ += ::rtl::OString( " !" )
+ ).getStr()
+ );
+ static const sal_Char* s_pDummy = "";
+ // just as a fallback ....
+ return s_pDummy;
+ }
+
+ // ====================================================================
+ // = class FmSearchConfigItem - ein ConfigItem, dass sich Suchparameter merkt
+ // ====================================================================
+
+#define TA( c ) &c, getCppuType( &c )
+
+ //---------------------------------------------------------------------
+ //--- 20.08.01 18:19:59 -----------------------------------------------
+
+ FmSearchConfigItem::FmSearchConfigItem()
+ :OConfigurationValueContainer( ::comphelper::getProcessServiceFactory(), m_aMutex, "/org.openoffice.Office.DataAccess/FormSearchOptions", CVC_UPDATE_ACCESS | CVC_LAZY_UPDATE, 2 )
+ {
+ // register our members so the data exchange with the node values is done automatically
+
+ registerExchangeLocation( "SearchHistory", TA( aHistory ) );
+ registerExchangeLocation( "LevenshteinOther", TA( nLevOther ) );
+ registerExchangeLocation( "LevenshteinShorter", TA( nLevShorter ) );
+ registerExchangeLocation( "LevenshteinLonger", TA( nLevLonger ) );
+ registerExchangeLocation( "IsLevenshteinRelaxed", TA( bLevRelaxed ) );
+ registerExchangeLocation( "IsSearchAllFields", TA( bAllFields ) );
+ registerExchangeLocation( "IsUseFormatter", TA( bUseFormatter ) );
+ registerExchangeLocation( "IsBackwards", TA( bBackwards ) );
+ registerExchangeLocation( "IsWildcardSearch", TA( bWildcard ) );
+ registerExchangeLocation( "IsUseRegularExpression", TA( bRegular ) );
+ registerExchangeLocation( "IsSimilaritySearch", TA( bApproxSearch ) );
+ registerExchangeLocation( "IsUseAsianOptions", TA( bSoundsLikeCJK ) );
+
+ // the properties which need to be translated
+ registerExchangeLocation( "SearchType", TA( m_sSearchForType ) );
+ registerExchangeLocation( "SearchPosition", TA( m_sSearchPosition ) );
+
+ registerExchangeLocation( "IsMatchCase", TA( m_bIsMatchCase ) );
+ registerExchangeLocation( "Japanese/IsMatchFullHalfWidthForms", TA( m_bIsMatchFullHalfWidthForms ) );
+ registerExchangeLocation( "Japanese/IsMatchHiraganaKatakana", TA( m_bIsMatchHiraganaKatakana ) );
+ registerExchangeLocation( "Japanese/IsMatchContractions", TA( m_bIsMatchContractions ) );
+ registerExchangeLocation( "Japanese/IsMatchMinusDashCho-on", TA( m_bIsMatchMinusDashCho_on ) );
+ registerExchangeLocation( "Japanese/IsMatchRepeatCharMarks", TA( m_bIsMatchRepeatCharMarks ) );
+ registerExchangeLocation( "Japanese/IsMatchVariantFormKanji", TA( m_bIsMatchVariantFormKanji ) );
+ registerExchangeLocation( "Japanese/IsMatchOldKanaForms", TA( m_bIsMatchOldKanaForms ) );
+ registerExchangeLocation( "Japanese/IsMatch_DiZi_DuZu", TA( m_bIsMatch_DiZi_DuZu ) );
+ registerExchangeLocation( "Japanese/IsMatch_BaVa_HaFa", TA( m_bIsMatch_BaVa_HaFa ) );
+ registerExchangeLocation( "Japanese/IsMatch_TsiThiChi_DhiZi", TA( m_bIsMatch_TsiThiChi_DhiZi ) );
+ registerExchangeLocation( "Japanese/IsMatch_HyuIyu_ByuVyu", TA( m_bIsMatch_HyuIyu_ByuVyu ) );
+ registerExchangeLocation( "Japanese/IsMatch_SeShe_ZeJe", TA( m_bIsMatch_SeShe_ZeJe ) );
+ registerExchangeLocation( "Japanese/IsMatch_IaIya", TA( m_bIsMatch_IaIya ) );
+ registerExchangeLocation( "Japanese/IsMatch_KiKu", TA( m_bIsMatch_KiKu ) );
+ registerExchangeLocation( "Japanese/IsIgnorePunctuation", TA( m_bIsIgnorePunctuation ) );
+ registerExchangeLocation( "Japanese/IsIgnoreWhitespace", TA( m_bIsIgnoreWhitespace ) );
+ registerExchangeLocation( "Japanese/IsIgnoreProlongedSoundMark",TA( m_bIsIgnoreProlongedSoundMark ) );
+ registerExchangeLocation( "Japanese/IsIgnoreMiddleDot", TA( m_bIsIgnoreMiddleDot ) );
+
+ read( );
+ }
+
+ //---------------------------------------------------------------------
+ //--- 20.08.01 18:19:57 -----------------------------------------------
+
+ FmSearchConfigItem::~FmSearchConfigItem()
+ {
+ commit( );
+ }
+
+ //---------------------------------------------------------------------
+ //--- 20.08.01 18:20:48 -----------------------------------------------
+
+ void FmSearchConfigItem::implTranslateFromConfig( )
+ {
+ // the search-for string
+ nSearchForType = lcl_implMapAsciiValue( m_sSearchForType, lcl_getSearchForTypeValueMap() );
+
+ // the search position
+ nPosition = lcl_implMapAsciiValue( m_sSearchPosition, lcl_getSearchPositionValueMap() );
+
+ // the transliteration flags
+ nTransliterationFlags = 0;
+
+ if ( !m_bIsMatchCase ) nTransliterationFlags |= TransliterationModules_IGNORE_CASE;
+ if ( m_bIsMatchFullHalfWidthForms ) nTransliterationFlags |= TransliterationModules_IGNORE_WIDTH;
+ if ( m_bIsMatchHiraganaKatakana ) nTransliterationFlags |= TransliterationModules_IGNORE_KANA;
+ if ( m_bIsMatchContractions ) nTransliterationFlags |= TransliterationModules_ignoreSize_ja_JP;
+ if ( m_bIsMatchMinusDashCho_on ) nTransliterationFlags |= TransliterationModules_ignoreMinusSign_ja_JP;
+ if ( m_bIsMatchRepeatCharMarks ) nTransliterationFlags |= TransliterationModules_ignoreIterationMark_ja_JP;
+ if ( m_bIsMatchVariantFormKanji ) nTransliterationFlags |= TransliterationModules_ignoreTraditionalKanji_ja_JP;
+ if ( m_bIsMatchOldKanaForms ) nTransliterationFlags |= TransliterationModules_ignoreTraditionalKana_ja_JP;
+ if ( m_bIsMatch_DiZi_DuZu ) nTransliterationFlags |= TransliterationModules_ignoreZiZu_ja_JP;
+ if ( m_bIsMatch_BaVa_HaFa ) nTransliterationFlags |= TransliterationModules_ignoreBaFa_ja_JP;
+ if ( m_bIsMatch_TsiThiChi_DhiZi ) nTransliterationFlags |= TransliterationModules_ignoreTiJi_ja_JP;
+ if ( m_bIsMatch_HyuIyu_ByuVyu ) nTransliterationFlags |= TransliterationModules_ignoreHyuByu_ja_JP;
+ if ( m_bIsMatch_SeShe_ZeJe ) nTransliterationFlags |= TransliterationModules_ignoreSeZe_ja_JP;
+ if ( m_bIsMatch_IaIya ) nTransliterationFlags |= TransliterationModules_ignoreIandEfollowedByYa_ja_JP;
+ if ( m_bIsMatch_KiKu ) nTransliterationFlags |= TransliterationModules_ignoreKiKuFollowedBySa_ja_JP;
+
+ if ( m_bIsIgnorePunctuation ) nTransliterationFlags |= TransliterationModules_ignoreSeparator_ja_JP;
+ if ( m_bIsIgnoreWhitespace ) nTransliterationFlags |= TransliterationModules_ignoreSpace_ja_JP;
+ if ( m_bIsIgnoreProlongedSoundMark ) nTransliterationFlags |= TransliterationModules_ignoreProlongedSoundMark_ja_JP;
+ if ( m_bIsIgnoreMiddleDot ) nTransliterationFlags |= TransliterationModules_ignoreMiddleDot_ja_JP;
+ }
+
+ //---------------------------------------------------------------------
+ //--- 20.08.01 18:42:23 -----------------------------------------------
+
+ void FmSearchConfigItem::implTranslateToConfig( )
+ {
+ // the search-for string
+ m_sSearchForType = ::rtl::OUString::createFromAscii( lcl_implMapIntValue( nSearchForType, lcl_getSearchForTypeValueMap() ) );
+
+ // the search position
+ m_sSearchPosition = ::rtl::OUString::createFromAscii( lcl_implMapIntValue( nPosition, lcl_getSearchPositionValueMap() ) );
+
+ // the transliteration flags
+
+ m_bIsMatchCase = ( 0 == ( nTransliterationFlags & TransliterationModules_IGNORE_CASE ) );
+ m_bIsMatchFullHalfWidthForms = ( 0 != ( nTransliterationFlags & TransliterationModules_IGNORE_WIDTH ) );
+ m_bIsMatchHiraganaKatakana = ( 0 != ( nTransliterationFlags & TransliterationModules_IGNORE_KANA ) );
+ m_bIsMatchContractions = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreSize_ja_JP ) );
+ m_bIsMatchMinusDashCho_on = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreMinusSign_ja_JP ) );
+ m_bIsMatchRepeatCharMarks = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreIterationMark_ja_JP ) );
+ m_bIsMatchVariantFormKanji = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreTraditionalKanji_ja_JP ) );
+ m_bIsMatchOldKanaForms = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreTraditionalKana_ja_JP ) );
+ m_bIsMatch_DiZi_DuZu = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreZiZu_ja_JP ) );
+ m_bIsMatch_BaVa_HaFa = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreBaFa_ja_JP ) );
+ m_bIsMatch_TsiThiChi_DhiZi = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreTiJi_ja_JP ) );
+ m_bIsMatch_HyuIyu_ByuVyu = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreHyuByu_ja_JP ) );
+ m_bIsMatch_SeShe_ZeJe = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreSeZe_ja_JP ) );
+ m_bIsMatch_IaIya = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreIandEfollowedByYa_ja_JP ) );
+ m_bIsMatch_KiKu = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreKiKuFollowedBySa_ja_JP ) );
+
+ m_bIsIgnorePunctuation = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreSeparator_ja_JP ) );
+ m_bIsIgnoreWhitespace = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreSpace_ja_JP ) );
+ m_bIsIgnoreProlongedSoundMark = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreProlongedSoundMark_ja_JP ) );
+ m_bIsIgnoreMiddleDot = ( 0 != ( nTransliterationFlags & TransliterationModules_ignoreMiddleDot_ja_JP ) );
+ }
+
+ //---------------------------------------------------------------------
+ //--- 20.08.01 18:20:01 -----------------------------------------------
+
+ const FmSearchParams& FmSearchConfigItem::getParams() const
+ {
+ // ensure that the properties which are not stored directly are up-to-date
+ const_cast< FmSearchConfigItem* >( this )->implTranslateFromConfig( );
+
+ // and return our FmSearchParams part
+ return *this;
+ }
+
+ //---------------------------------------------------------------------
+ //--- 20.08.01 18:41:57 -----------------------------------------------
+
+ void FmSearchConfigItem::setParams( const FmSearchParams& _rParams )
+ {
+ // copy the FmSearchParams part
+ *static_cast< FmSearchParams* >( this ) = _rParams;
+
+ // translate the settings not represented by a direct config value
+ implTranslateToConfig();
+ }
+
+//........................................................................
+} // namespace svxform
+//........................................................................
diff --git a/svx/source/form/fmsrcimp.cxx b/svx/source/form/fmsrcimp.cxx
new file mode 100644
index 000000000000..56957490150d
--- /dev/null
+++ b/svx/source/form/fmsrcimp.cxx
@@ -0,0 +1,1301 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#ifndef _SVX_FMRESIDS_HRC
+#include "svx/fmresids.hrc"
+#endif
+#include "svx/fmtools.hxx"
+#include "svx/fmsrccfg.hxx"
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include <tools/wldcrd.hxx>
+#include <vcl/msgbox.hxx>
+#include <tools/shl.hxx>
+#include <svx/dialmgr.hxx>
+#include <cppuhelper/servicefactory.hxx>
+#include <vcl/svapp.hxx>
+#include <unotools/textsearch.hxx>
+#include <com/sun/star/util/SearchOptions.hpp>
+#include <com/sun/star/util/SearchAlgorithms.hpp>
+#include <com/sun/star/util/SearchResult.hpp>
+#include <com/sun/star/util/SearchFlags.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+#include <com/sun/star/i18n/CollatorOptions.hpp>
+
+#ifndef _COM_SUN_STAR_SDDB_XCOLUMNSSUPPLIER_HPP_
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#endif
+#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/util/NumberFormat.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/util/XNumberFormats.hpp>
+#include <comphelper/processfactory.hxx>
+
+#ifndef _SVX_FMPROP_HRC
+#include "fmprop.hrc"
+#endif
+#include "fmservs.hxx"
+#include "svx/fmsrcimp.hxx"
+#include <svx/fmsearch.hxx>
+
+#include <comphelper/numbers.hxx>
+#include <unotools/syslocale.hxx>
+
+#define EQUAL_BOOKMARKS(a, b) a == b
+
+#define IFACECAST(c) ((const Reference< XInterface >&)c)
+ // SUN C52 has some ambiguities without this cast ....
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::i18n;
+using namespace ::com::sun::star::beans;
+using namespace ::svxform;
+
+
+//========================================================================
+// = FmSearchThread
+//------------------------------------------------------------------------
+void FmSearchThread::run()
+{
+ m_pEngine->SearchNextImpl();
+};
+
+//------------------------------------------------------------------------
+void FmSearchThread::onTerminated()
+{
+ if (m_aTerminationHdl.IsSet())
+ m_aTerminationHdl.Call(this);
+ delete this;
+}
+
+//========================================================================
+// = FmRecordCountListener
+
+// SMART_UNO_IMPLEMENTATION(FmRecordCountListener, UsrObject);
+
+DBG_NAME(FmRecordCountListener);
+//------------------------------------------------------------------------
+FmRecordCountListener::FmRecordCountListener(const Reference< ::com::sun::star::sdbc::XResultSet > & dbcCursor)
+{
+ DBG_CTOR(FmRecordCountListener,NULL);
+
+ m_xListening = Reference< ::com::sun::star::beans::XPropertySet > (dbcCursor, UNO_QUERY);
+ if (!m_xListening.is())
+ return;
+
+ if (::comphelper::getBOOL(m_xListening->getPropertyValue(FM_PROP_ROWCOUNTFINAL)))
+ {
+ m_xListening = NULL;
+ // there's nothing to do as the record count is already known
+ return;
+ }
+
+ m_xListening->addPropertyChangeListener(FM_PROP_ROWCOUNT, (::com::sun::star::beans::XPropertyChangeListener*)this);
+}
+
+//------------------------------------------------------------------------
+Link FmRecordCountListener::SetPropChangeHandler(const Link& lnk)
+{
+ Link lnkReturn = m_lnkWhoWantsToKnow;
+ m_lnkWhoWantsToKnow = lnk;
+
+ if (m_xListening.is())
+ NotifyCurrentCount();
+
+ return lnkReturn;
+}
+
+//------------------------------------------------------------------------
+FmRecordCountListener::~FmRecordCountListener()
+{
+
+ DBG_DTOR(FmRecordCountListener,NULL);
+}
+
+//------------------------------------------------------------------------
+void FmRecordCountListener::DisConnect()
+{
+ if(m_xListening.is())
+ m_xListening->removePropertyChangeListener(FM_PROP_ROWCOUNT, (::com::sun::star::beans::XPropertyChangeListener*)this);
+ m_xListening = NULL;
+}
+
+//------------------------------------------------------------------------
+void SAL_CALL FmRecordCountListener::disposing(const ::com::sun::star::lang::EventObject& /*Source*/) throw( RuntimeException )
+{
+ DBG_ASSERT(m_xListening.is(), "FmRecordCountListener::disposing should never have been called without a propset !");
+ DisConnect();
+}
+
+//------------------------------------------------------------------------
+void FmRecordCountListener::NotifyCurrentCount()
+{
+ if (m_lnkWhoWantsToKnow.IsSet())
+ {
+ DBG_ASSERT(m_xListening.is(), "FmRecordCountListener::NotifyCurrentCount : I have no propset ... !?");
+ void* pTheCount = (void*)::comphelper::getINT32(m_xListening->getPropertyValue(FM_PROP_ROWCOUNT));
+ m_lnkWhoWantsToKnow.Call(pTheCount);
+ }
+}
+
+//------------------------------------------------------------------------
+void FmRecordCountListener::propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& /*evt*/) throw(::com::sun::star::uno::RuntimeException)
+{
+ NotifyCurrentCount();
+}
+
+//========================================================================
+// FmSearchEngine - local classes
+//------------------------------------------------------------------------
+SimpleTextWrapper::SimpleTextWrapper(const Reference< ::com::sun::star::awt::XTextComponent > & _xText)
+ :ControlTextWrapper(_xText.get())
+ ,m_xText(_xText)
+{
+ DBG_ASSERT(m_xText.is(), "FmSearchEngine::SimpleTextWrapper::SimpleTextWrapper : invalid argument !");
+}
+
+//------------------------------------------------------------------------
+::rtl::OUString SimpleTextWrapper::getCurrentText() const
+{
+ return m_xText->getText();
+}
+
+//------------------------------------------------------------------------
+ListBoxWrapper::ListBoxWrapper(const Reference< ::com::sun::star::awt::XListBox > & _xBox)
+ :ControlTextWrapper(_xBox.get())
+ ,m_xBox(_xBox)
+{
+ DBG_ASSERT(m_xBox.is(), "FmSearchEngine::ListBoxWrapper::ListBoxWrapper : invalid argument !");
+}
+
+//------------------------------------------------------------------------
+::rtl::OUString ListBoxWrapper::getCurrentText() const
+{
+ return m_xBox->getSelectedItem();
+}
+
+//------------------------------------------------------------------------
+CheckBoxWrapper::CheckBoxWrapper(const Reference< ::com::sun::star::awt::XCheckBox > & _xBox)
+ :ControlTextWrapper(_xBox.get())
+ ,m_xBox(_xBox)
+{
+ DBG_ASSERT(m_xBox.is(), "FmSearchEngine::CheckBoxWrapper::CheckBoxWrapper : invalid argument !");
+}
+
+//------------------------------------------------------------------------
+::rtl::OUString CheckBoxWrapper::getCurrentText() const
+{
+ switch ((TriState)m_xBox->getState())
+ {
+ case STATE_NOCHECK: return rtl::OUString::createFromAscii("0");
+ case STATE_CHECK: return rtl::OUString::createFromAscii("1");
+ default: break;
+ }
+ return rtl::OUString();
+}
+
+//========================================================================
+// = FmSearchEngine
+//------------------------------------------------------------------------
+sal_Bool FmSearchEngine::MoveCursor()
+{
+ sal_Bool bSuccess = sal_True;
+ try
+ {
+ if (m_bForward)
+ if (m_xSearchCursor.isLast())
+ m_xSearchCursor.first();
+ else
+ m_xSearchCursor.next();
+ else
+ if (m_xSearchCursor.isFirst())
+ {
+ FmRecordCountListener* prclListener = new FmRecordCountListener(m_xSearchCursor);
+ prclListener->acquire();
+ prclListener->SetPropChangeHandler(LINK(this, FmSearchEngine, OnNewRecordCount));
+
+ m_xSearchCursor.last();
+
+ prclListener->DisConnect();
+ prclListener->release();
+ }
+ else
+ m_xSearchCursor.previous();
+ }
+ catch(::com::sun::star::sdbc::SQLException e)
+ {
+#if OSL_DEBUG_LEVEL > 0
+ String sDebugMessage;
+ sDebugMessage.AssignAscii("FmSearchEngine::MoveCursor : catched a DatabaseException (");
+ sDebugMessage += (const sal_Unicode*)e.SQLState;
+ sDebugMessage.AppendAscii(") !");
+ DBG_ERROR(ByteString(sDebugMessage, RTL_TEXTENCODING_ASCII_US).GetBuffer());
+#endif
+ bSuccess = sal_False;
+ }
+ catch(Exception e)
+ {
+#if OSL_DEBUG_LEVEL > 0
+ UniString sDebugMessage;
+ sDebugMessage.AssignAscii("FmSearchEngine::MoveCursor : catched an Exception (");
+ sDebugMessage += (const sal_Unicode*)e.Message;
+ sDebugMessage.AppendAscii(") !");
+ DBG_ERROR(ByteString(sDebugMessage, RTL_TEXTENCODING_ASCII_US).GetBuffer());
+#endif
+ bSuccess = sal_False;
+ }
+ catch(...)
+ {
+ DBG_ERROR("FmSearchEngine::MoveCursor : catched an unknown Exception !");
+ bSuccess = sal_False;
+ }
+
+ return bSuccess;
+}
+
+//------------------------------------------------------------------------
+sal_Bool FmSearchEngine::MoveField(sal_Int32& nPos, FieldCollectionIterator& iter, const FieldCollectionIterator& iterBegin, const FieldCollectionIterator& iterEnd)
+{
+ sal_Bool bSuccess(sal_True);
+ if (m_bForward)
+ {
+ ++iter;
+ ++nPos;
+ if (iter == iterEnd)
+ {
+ bSuccess = MoveCursor();
+ iter = iterBegin;
+ nPos = 0;
+ }
+ } else
+ {
+ if (iter == iterBegin)
+ {
+ bSuccess = MoveCursor();
+ iter = iterEnd;
+ nPos = iter-iterBegin;
+ }
+ --iter;
+ --nPos;
+ }
+ return bSuccess;
+}
+
+//------------------------------------------------------------------------
+void FmSearchEngine::BuildAndInsertFieldInfo(const Reference< ::com::sun::star::container::XIndexAccess > & xAllFields, sal_Int32 nField)
+{
+ DBG_ASSERT( xAllFields.is() && ( nField >= 0 ) && ( nField < xAllFields->getCount() ),
+ "FmSearchEngine::BuildAndInsertFieldInfo: invalid field descriptor!" );
+
+ // das Feld selber
+ Reference< XInterface > xCurrentField;
+ xAllFields->getByIndex(nField) >>= xCurrentField;
+
+ // von dem weiss ich jetzt, dass es den DatabaseRecord-Service unterstuetzt (hoffe ich)
+ // fuer den FormatKey und den Typ brauche ich das PropertySet
+ Reference< ::com::sun::star::beans::XPropertySet > xProperties(xCurrentField, UNO_QUERY);
+
+ // die FieldInfo dazu aufbauen
+ FieldInfo fiCurrent;
+ fiCurrent.xContents = Reference< ::com::sun::star::sdb::XColumn > (xCurrentField, UNO_QUERY);
+ fiCurrent.nFormatKey = ::comphelper::getINT32(xProperties->getPropertyValue(FM_PROP_FORMATKEY));
+ fiCurrent.bDoubleHandling = sal_False;
+ if (m_xFormatSupplier.is())
+ {
+ Reference< ::com::sun::star::util::XNumberFormats > xNumberFormats(m_xFormatSupplier->getNumberFormats());
+
+ sal_Int16 nFormatType = ::comphelper::getNumberFormatType(xNumberFormats, fiCurrent.nFormatKey) & ~((sal_Int16)::com::sun::star::util::NumberFormat::DEFINED);
+ fiCurrent.bDoubleHandling = (nFormatType != ::com::sun::star::util::NumberFormat::TEXT);
+ }
+
+ // und merken
+ m_arrUsedFields.insert(m_arrUsedFields.end(), fiCurrent);
+
+}
+//------------------------------------------------------------------------
+::rtl::OUString FmSearchEngine::FormatField(const FieldInfo& rField)
+{
+ DBG_ASSERT(!m_bUsingTextComponents, "FmSearchEngine::FormatField : im UsingTextComponents-Mode bitte FormatField(sal_Int32) benutzen !");
+
+ if (!m_xFormatter.is())
+ return ::rtl::OUString();
+ // sonst werden Datumsflder zum Beispiel zu irgendeinem Default-Wert formatiert
+
+ ::rtl::OUString sReturn;
+ try
+ {
+ if (rField.bDoubleHandling)
+ {
+ double fValue = rField.xContents->getDouble();
+ if (!rField.xContents->wasNull())
+ sReturn = m_xFormatter->convertNumberToString(rField.nFormatKey, fValue);
+ }
+ else
+ {
+ ::rtl::OUString sValue = rField.xContents->getString();
+ if (!rField.xContents->wasNull())
+ sReturn = m_xFormatter->formatString(rField.nFormatKey, sValue);
+ }
+ }
+ catch(...)
+ {
+ }
+
+
+ return sReturn;
+}
+
+//------------------------------------------------------------------------
+::rtl::OUString FmSearchEngine::FormatField(sal_Int32 nWhich)
+{
+ if (m_bUsingTextComponents)
+ {
+ DBG_ASSERT((sal_uInt32)nWhich < m_aControlTexts.size(), "FmSearchEngine::FormatField(sal_Int32) : invalid position !");
+ DBG_ASSERT(m_aControlTexts[nWhich] != NULL, "FmSearchEngine::FormatField(sal_Int32) : invalid object in array !");
+ DBG_ASSERT(m_aControlTexts[nWhich]->getControl().is(), "FmSearchEngine::FormatField : invalid control !");
+
+ if (m_nCurrentFieldIndex != -1)
+ {
+ DBG_ASSERT((nWhich == 0) || (nWhich == m_nCurrentFieldIndex), "FmSearchEngine::FormatField : Parameter nWhich ist ungueltig");
+ // analoge Situation wie unten
+ nWhich = m_nCurrentFieldIndex;
+ }
+
+ DBG_ASSERT((nWhich >= 0) && ((sal_uInt32)nWhich < m_aControlTexts.size()),
+ "FmSearchEngine::FormatField : invalid argument nWhich !");
+ return m_aControlTexts[m_nCurrentFieldIndex == -1 ? nWhich : m_nCurrentFieldIndex]->getCurrentText();
+ }
+ else
+ {
+ if (m_nCurrentFieldIndex != -1)
+ {
+ DBG_ASSERT((nWhich == 0) || (nWhich == m_nCurrentFieldIndex), "FmSearchEngine::FormatField : Parameter nWhich ist ungueltig");
+ // ich bin im single-field-modus, da ist auch die richtige Feld-Nummer erlaubt, obwohl dann der richtige ::com::sun::star::sdbcx::Index
+ // fuer meinen Array-Zugriff natuerlich 0 ist
+ nWhich = 0;
+ }
+
+ DBG_ASSERT((nWhich>=0) && (nWhich < (m_arrUsedFields.end() - m_arrUsedFields.begin())),
+ "FmSearchEngine::FormatField : Parameter nWhich ist ungueltig");
+ return FormatField(m_arrUsedFields[nWhich]);
+ }
+}
+
+//------------------------------------------------------------------------
+FmSearchEngine::SEARCH_RESULT FmSearchEngine::SearchSpecial(sal_Bool _bSearchForNull, sal_Int32& nFieldPos,
+ FieldCollectionIterator& iterFieldLoop, const FieldCollectionIterator& iterBegin, const FieldCollectionIterator& iterEnd)
+{
+ // die Startposition merken
+ Any aStartMark;
+ try { aStartMark = m_xSearchCursor.getBookmark(); }
+ catch ( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); return SR_ERROR; }
+ FieldCollectionIterator iterInitialField = iterFieldLoop;
+
+ // --------------------------------------------------------------
+ sal_Bool bFound(sal_False);
+ sal_Bool bMovedAround(sal_False);
+ do
+ {
+ if (m_eMode == SM_ALLOWSCHEDULE) //CHINA001 if (m_eMode == FmSearchDialog::SM_ALLOWSCHEDULE)
+ {
+ Application::Reschedule();
+ Application::Reschedule();
+ // do 2 reschedules because of #70226# : some things done within this loop's body may cause an user event
+ // to be posted (deep within vcl), and these user events will be handled before any keyinput or paintings
+ // or anything like that. So within each loop we create one user event and handle one user event (and no
+ // paintings and these), so the office seems to be frozen while searching.
+ // FS - 70226 - 02.12.99
+ }
+
+ // der aktuell zu vergleichende Inhalt
+ iterFieldLoop->xContents->getString(); // needed for wasNull
+ bFound = _bSearchForNull == iterFieldLoop->xContents->wasNull();
+ if (bFound)
+ break;
+
+ // naechstes Feld (implizit naechster Datensatz, wenn noetig)
+ if (!MoveField(nFieldPos, iterFieldLoop, iterBegin, iterEnd))
+ { // beim Bewegen auf das naechste Feld ging was schief ... weitermachen ist nicht drin, da das naechste Mal genau
+ // das selbe bestimmt wieder schief geht, also Abbruch
+ // vorher aber noch, damit das Weitersuchen an der aktuellen Position weitermacht :
+ try { m_aPreviousLocBookmark = m_xSearchCursor.getBookmark(); }
+ catch ( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); }
+ m_iterPreviousLocField = iterFieldLoop;
+ // und wech
+ return SR_ERROR;
+ }
+
+ Any aCurrentBookmark;
+ try { aCurrentBookmark = m_xSearchCursor.getBookmark(); }
+ catch ( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); return SR_ERROR; }
+
+ bMovedAround = EQUAL_BOOKMARKS(aStartMark, aCurrentBookmark) && (iterFieldLoop == iterInitialField);
+
+ if (nFieldPos == 0)
+ // das heisst, ich habe mich auf einen neuen Datensatz bewegt
+ PropagateProgress(bMovedAround);
+ // if we moved to the starting position we don't have to propagate an 'overflow' message
+ // FS - 07.12.99 - 68530
+
+ // abbrechen gefordert ?
+ if (CancelRequested())
+ return SR_CANCELED;
+
+ } while (!bMovedAround);
+
+ return bFound ? SR_FOUND : SR_NOTFOUND;
+}
+
+//------------------------------------------------------------------------
+FmSearchEngine::SEARCH_RESULT FmSearchEngine::SearchWildcard(const ::rtl::OUString& strExpression, sal_Int32& nFieldPos,
+ FieldCollectionIterator& iterFieldLoop, const FieldCollectionIterator& iterBegin, const FieldCollectionIterator& iterEnd)
+{
+ // die Startposition merken
+ Any aStartMark;
+ try { aStartMark = m_xSearchCursor.getBookmark(); }
+ catch ( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); return SR_ERROR; }
+ FieldCollectionIterator iterInitialField = iterFieldLoop;
+
+ WildCard aSearchExpression(strExpression);
+
+ // --------------------------------------------------------------
+ sal_Bool bFound(sal_False);
+ sal_Bool bMovedAround(sal_False);
+ do
+ {
+ if (m_eMode == SM_ALLOWSCHEDULE) //CHINA001 if (m_eMode == FmSearchDialog::SM_ALLOWSCHEDULE)
+ {
+ Application::Reschedule();
+ Application::Reschedule();
+ // do 2 reschedules because of #70226# : some things done within this loop's body may cause an user event
+ // to be posted (deep within vcl), and these user events will be handled before any keyinput or paintings
+ // or anything like that. So within each loop we create one user event and hanel one user event (and no
+ // paintings and these), so the office seems to be frozen while searching.
+ // FS - 70226 - 02.12.99
+ }
+
+ // der aktuell zu vergleichende Inhalt
+ ::rtl::OUString sCurrentCheck;
+ if (m_bFormatter)
+ sCurrentCheck = FormatField(nFieldPos);
+ else
+ sCurrentCheck = iterFieldLoop->xContents->getString();
+
+ if (!GetCaseSensitive())
+ // norm the string
+ m_aCharacterClassficator.toLower_rtl(sCurrentCheck);
+
+ // jetzt ist der Test einfach ...
+ bFound = aSearchExpression.Matches(sCurrentCheck);
+
+ if (bFound)
+ break;
+
+ // naechstes Feld (implizit naechster Datensatz, wenn noetig)
+ if (!MoveField(nFieldPos, iterFieldLoop, iterBegin, iterEnd))
+ { // beim Bewegen auf das naechste Feld ging was schief ... weitermachen ist nicht drin, da das naechste Mal genau
+ // das selbe bestimmt wieder schief geht, also Abbruch
+ // vorher aber noch, damit das Weitersuchen an der aktuellen Position weitermacht :
+ try { m_aPreviousLocBookmark = m_xSearchCursor.getBookmark(); }
+ catch ( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); }
+ m_iterPreviousLocField = iterFieldLoop;
+ // und wech
+ return SR_ERROR;
+ }
+
+ Any aCurrentBookmark;
+ try { aCurrentBookmark = m_xSearchCursor.getBookmark(); }
+ catch ( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); return SR_ERROR; }
+
+ bMovedAround = EQUAL_BOOKMARKS(aStartMark, aCurrentBookmark) && (iterFieldLoop == iterInitialField);
+
+ if (nFieldPos == 0)
+ // das heisst, ich habe mich auf einen neuen Datensatz bewegt
+ PropagateProgress(bMovedAround);
+ // if we moved to the starting position we don't have to propagate an 'overflow' message
+ // FS - 07.12.99 - 68530
+
+ // abbrechen gefordert ?
+ if (CancelRequested())
+ return SR_CANCELED;
+
+ } while (!bMovedAround);
+
+ return bFound ? SR_FOUND : SR_NOTFOUND;
+}
+
+//------------------------------------------------------------------------
+FmSearchEngine::SEARCH_RESULT FmSearchEngine::SearchRegularApprox(const ::rtl::OUString& strExpression, sal_Int32& nFieldPos,
+ FieldCollectionIterator& iterFieldLoop, const FieldCollectionIterator& iterBegin, const FieldCollectionIterator& iterEnd)
+{
+ DBG_ASSERT(m_bLevenshtein || m_bRegular,
+ "FmSearchEngine::SearchRegularApprox : ungueltiger Suchmodus !");
+ DBG_ASSERT(!m_bLevenshtein || !m_bRegular,
+ "FmSearchEngine::SearchRegularApprox : kann nicht nach regulaeren Ausdruecken und nach Aehnlichkeiten gleichzeitig suchen !");
+
+ // Startposition merken
+ Any aStartMark;
+ try { aStartMark = m_xSearchCursor.getBookmark(); }
+ catch ( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); return SR_ERROR; }
+ FieldCollectionIterator iterInitialField = iterFieldLoop;
+
+ // Parameter sammeln
+ SearchOptions aParam;
+ aParam.algorithmType = m_bRegular ? SearchAlgorithms_REGEXP : SearchAlgorithms_APPROXIMATE;
+ aParam.searchFlag = 0;
+ aParam.transliterateFlags = GetTransliterationFlags();
+ if ( !GetTransliteration() )
+ { // if transliteration is not enabled, the only flags which matter are IGNORE_CASE and IGNORE_WIDTH
+ aParam.transliterateFlags &= TransliterationModules_IGNORE_CASE | TransliterationModules_IGNORE_WIDTH;
+ }
+ if (m_bLevenshtein)
+ {
+ if (m_bLevRelaxed)
+ aParam.searchFlag |= SearchFlags::LEV_RELAXED;
+ aParam.changedChars = m_nLevOther;
+ aParam.deletedChars = m_nLevShorter;
+ aParam.insertedChars = m_nLevLonger;
+ }
+ aParam.searchString = strExpression;
+ aParam.Locale = SvtSysLocale().GetLocaleData().getLocale();
+ ::utl::TextSearch aLocalEngine(aParam);
+
+ // --------------------------------------------------------------
+ bool bFound = false;
+ sal_Bool bMovedAround(sal_False);
+ do
+ {
+ if (m_eMode == SM_ALLOWSCHEDULE) //CHINA001 if (m_eMode == FmSearchDialog::SM_ALLOWSCHEDULE)
+ {
+ Application::Reschedule();
+ Application::Reschedule();
+ // do 2 reschedules because of #70226# : some things done within this loop's body may cause an user event
+ // to be posted (deep within vcl), and these user events will be handled before any keyinput or paintings
+ // or anything like that. So within each loop we create one user event and handle one user event (and no
+ // paintings and these), so the office seems to be frozen while searching.
+ // FS - 70226 - 02.12.99
+ }
+
+ // der aktuell zu vergleichende Inhalt
+ ::rtl::OUString sCurrentCheck;
+ if (m_bFormatter)
+ sCurrentCheck = FormatField(nFieldPos);
+ else
+ sCurrentCheck = iterFieldLoop->xContents->getString();
+
+ // (don't care about case here, this is done by the TextSearch object, 'cause we passed our case parameter to it)
+
+ xub_StrLen nStart = 0, nEnd = (xub_StrLen)sCurrentCheck.getLength();
+ bFound = aLocalEngine.SearchFrwrd(sCurrentCheck, &nStart, &nEnd);
+ // das heisst hier 'forward' aber das bezieht sich nur auf die Suche innerhalb von sCurrentCheck, hat also mit
+ // der Richtung meines Datensatz-Durchwanderns nix zu tun (darum kuemmert sich MoveField)
+
+ // checken, ob die Position stimmt
+ if (bFound)
+ {
+ switch (m_nPosition)
+ {
+ case MATCHING_WHOLETEXT :
+ if (nEnd != sCurrentCheck.getLength())
+ {
+ bFound = false;
+ break;
+ }
+ // laeuft in den naechsten Case rein !
+ case MATCHING_BEGINNING :
+ if (nStart != 0)
+ bFound = false;
+ break;
+ case MATCHING_END :
+ if (nEnd != sCurrentCheck.getLength())
+ bFound = false;
+ break;
+ }
+ }
+
+ if (bFound) // immer noch ?
+ break;
+
+ // naechstes Feld (implizit naechster Datensatz, wenn noetig)
+ if (!MoveField(nFieldPos, iterFieldLoop, iterBegin, iterEnd))
+ { // beim Bewegen auf das naechste Feld ging was schief ... weitermachen ist nicht drin, da das naechste Mal genau
+ // das selbe bestimmt wieder schief geht, also Abbruch (ohne Fehlermeldung, von der erwarte ich, dass sie im Move
+ // angezeigt wurde)
+ // vorher aber noch, damit das Weitersuchen an der aktuellen Position weitermacht :
+ try { m_aPreviousLocBookmark = m_xSearchCursor.getBookmark(); }
+ catch ( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); }
+ m_iterPreviousLocField = iterFieldLoop;
+ // und wech
+ return SR_ERROR;
+ }
+
+ Any aCurrentBookmark;
+ try { aCurrentBookmark = m_xSearchCursor.getBookmark(); }
+ catch ( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); return SR_ERROR; }
+ bMovedAround = EQUAL_BOOKMARKS(aStartMark, aCurrentBookmark) && (iterFieldLoop == iterInitialField);
+
+ if (nFieldPos == 0)
+ // das heisst, ich habe mich auf einen neuen Datensatz bewegt
+ PropagateProgress(bMovedAround);
+ // if we moved to the starting position we don't have to propagate an 'overflow' message
+ // FS - 07.12.99 - 68530
+
+ // abbrechen gefordert ?
+ if (CancelRequested())
+ return SR_CANCELED;
+
+ } while (!bMovedAround);
+
+ return bFound ? SR_FOUND : SR_NOTFOUND;
+}
+
+
+DBG_NAME(FmSearchEngine);
+//------------------------------------------------------------------------
+FmSearchEngine::FmSearchEngine(const Reference< XMultiServiceFactory >& _rxORB,
+ const Reference< XResultSet > & xCursor, const ::rtl::OUString& sVisibleFields,
+ const Reference< XNumberFormatsSupplier > & xFormatSupplier, FMSEARCH_MODE eMode)//CHINA001 const Reference< XNumberFormatsSupplier > & xFormatSupplier, FmSearchDialog::SEARCH_MODE eMode)
+ :m_xSearchCursor(xCursor)
+ ,m_xFormatSupplier(xFormatSupplier)
+ ,m_aCharacterClassficator( _rxORB, SvtSysLocale().GetLocaleData().getLocale() )
+ ,m_aStringCompare( _rxORB )
+ ,m_nCurrentFieldIndex(-2) // -1 hat schon eine Bedeutung, also nehme ich -2 fuer 'ungueltig'
+ ,m_bUsingTextComponents(sal_False)
+ ,m_eSearchForType(SEARCHFOR_STRING)
+ ,m_srResult(SR_FOUND)
+ ,m_bSearchingCurrently(sal_False)
+ ,m_bCancelAsynchRequest(sal_False)
+ ,m_eMode(eMode)
+ ,m_bFormatter(sal_False)
+ ,m_bForward(sal_False)
+ ,m_bWildcard(sal_False)
+ ,m_bRegular(sal_False)
+ ,m_bLevenshtein(sal_False)
+ ,m_bTransliteration(sal_False)
+ ,m_bLevRelaxed(sal_False)
+ ,m_nLevOther(0)
+ ,m_nLevShorter(0)
+ ,m_nLevLonger(0)
+ ,m_nPosition(MATCHING_ANYWHERE)
+ ,m_nTransliterationFlags(0)
+{
+ DBG_CTOR(FmSearchEngine,NULL);
+
+ m_xFormatter = Reference< ::com::sun::star::util::XNumberFormatter > (::comphelper::getProcessServiceFactory()
+ ->createInstance(FM_NUMBER_FORMATTER), UNO_QUERY);
+ if (m_xFormatter.is())
+ m_xFormatter->attachNumberFormatsSupplier(m_xFormatSupplier);
+
+ Init(sVisibleFields);
+}
+
+//------------------------------------------------------------------------
+FmSearchEngine::FmSearchEngine(const Reference< XMultiServiceFactory >& _rxORB,
+ const Reference< XResultSet > & xCursor, const ::rtl::OUString& sVisibleFields,
+ const InterfaceArray& arrFields, FMSEARCH_MODE eMode)//CHINA001 const InterfaceArray& arrFields, FmSearchDialog::SEARCH_MODE eMode)
+ :m_xSearchCursor(xCursor)
+ ,m_aCharacterClassficator( _rxORB, SvtSysLocale().GetLocaleData().getLocale() )
+ ,m_aStringCompare( _rxORB )
+ ,m_nCurrentFieldIndex(-2) // -1 hat schon eine Bedeutung, also nehme ich -2 fuer 'ungueltig'
+ ,m_bUsingTextComponents(sal_True)
+ ,m_xOriginalIterator(xCursor)
+ ,m_xClonedIterator(m_xOriginalIterator, sal_True)
+ ,m_eSearchForType(SEARCHFOR_STRING)
+ ,m_srResult(SR_FOUND)
+ ,m_bSearchingCurrently(sal_False)
+ ,m_bCancelAsynchRequest(sal_False)
+ ,m_eMode(eMode)
+ ,m_bFormatter(sal_True) // das muss konsistent sein mit m_xSearchCursor, der i.A. == m_xOriginalIterator ist
+ ,m_bForward(sal_False)
+ ,m_bWildcard(sal_False)
+ ,m_bRegular(sal_False)
+ ,m_bLevenshtein(sal_False)
+ ,m_bTransliteration(sal_False)
+ ,m_bLevRelaxed(sal_False)
+ ,m_nLevOther(0)
+ ,m_nLevShorter(0)
+ ,m_nLevLonger(0)
+ ,m_nPosition(MATCHING_ANYWHERE)
+ ,m_nTransliterationFlags(0)
+{
+ DBG_CTOR(FmSearchEngine,NULL);
+
+ fillControlTexts(arrFields);
+ Init(sVisibleFields);
+}
+
+//------------------------------------------------------------------------
+FmSearchEngine::~FmSearchEngine()
+{
+ clearControlTexts();
+
+ DBG_DTOR(FmSearchEngine,NULL);
+}
+
+//------------------------------------------------------------------------
+void FmSearchEngine::SetIgnoreWidthCJK(sal_Bool bSet)
+{
+ if (bSet)
+ m_nTransliterationFlags |= TransliterationModules_IGNORE_WIDTH;
+ else
+ m_nTransliterationFlags &= ~TransliterationModules_IGNORE_WIDTH;
+}
+
+//------------------------------------------------------------------------
+sal_Bool FmSearchEngine::GetIgnoreWidthCJK() const
+{
+ return 0 != (m_nTransliterationFlags & TransliterationModules_IGNORE_WIDTH);
+}
+
+//------------------------------------------------------------------------
+void FmSearchEngine::SetCaseSensitive(sal_Bool bSet)
+{
+ if (bSet)
+ m_nTransliterationFlags &= ~TransliterationModules_IGNORE_CASE;
+ else
+ m_nTransliterationFlags |= TransliterationModules_IGNORE_CASE;
+}
+
+//------------------------------------------------------------------------
+sal_Bool FmSearchEngine::GetCaseSensitive() const
+{
+ return 0 == (m_nTransliterationFlags & TransliterationModules_IGNORE_CASE);
+}
+
+//------------------------------------------------------------------------
+void FmSearchEngine::clearControlTexts()
+{
+ for ( ControlTextSuppliersIterator aIter = m_aControlTexts.begin();
+ aIter < m_aControlTexts.end();
+ ++aIter
+ )
+ {
+ delete *aIter;
+ }
+ m_aControlTexts.clear();
+}
+
+//------------------------------------------------------------------------
+void FmSearchEngine::fillControlTexts(const InterfaceArray& arrFields)
+{
+ clearControlTexts();
+ Reference< XInterface > xCurrent;
+ for (sal_uInt32 i=0; i<arrFields.size(); ++i)
+ {
+ xCurrent = arrFields.at(i);
+ DBG_ASSERT(xCurrent.is(), "FmSearchEngine::fillControlTexts : invalid field interface !");
+ // check which type of control this is
+ Reference< ::com::sun::star::awt::XTextComponent > xAsText(xCurrent, UNO_QUERY);
+ if (xAsText.is())
+ {
+ m_aControlTexts.insert(m_aControlTexts.end(), new SimpleTextWrapper(xAsText));
+ continue;
+ }
+
+ Reference< ::com::sun::star::awt::XListBox > xAsListBox(xCurrent, UNO_QUERY);
+ if (xAsListBox.is())
+ {
+ m_aControlTexts.insert(m_aControlTexts.end(), new ListBoxWrapper(xAsListBox));
+ continue;
+ }
+
+ Reference< ::com::sun::star::awt::XCheckBox > xAsCheckBox(xCurrent, UNO_QUERY);
+ DBG_ASSERT(xAsCheckBox.is(), "FmSearchEngine::fillControlTexts : invalid field interface (no supported type) !");
+ // we don't have any more options ...
+ m_aControlTexts.insert(m_aControlTexts.end(), new CheckBoxWrapper(xAsCheckBox));
+ }
+}
+
+//------------------------------------------------------------------------
+void FmSearchEngine::Init(const ::rtl::OUString& sVisibleFields)
+{
+ // analyze the fields
+ // additionally, create the mapping: because the list of used columns can be shorter than the list
+ // of columns of the cursor, we need a mapping: "used column numer n" -> "cursor column m"
+ m_arrFieldMapping.clear();
+
+ // important: The case of the columns does not need to be exact - for instance:
+ // - a user created a form which works on a table, for which the driver returns a column name "COLUMN"
+ // - the driver itself works case-insensitve with column names
+ // - a control in the form is bound to "column" - not the different case
+ // In such a scenario, the form and the field would work okay, but we here need to case for the different case
+ // explicitly
+ // 2003-01-09 - #i8755# - fs@openoffice.org
+
+ // so first of all, check if the database handles identifiers case sensitive
+ Reference< XConnection > xConn;
+ Reference< XDatabaseMetaData > xMeta;
+ Reference< XPropertySet > xCursorProps( IFACECAST( m_xSearchCursor ), UNO_QUERY );
+ if ( xCursorProps.is() )
+ {
+ try
+ {
+ xCursorProps->getPropertyValue( FM_PROP_ACTIVE_CONNECTION ) >>= xConn;
+ }
+ catch( Exception& ) { /* silent this - will be asserted below */ }
+ }
+ if ( xConn.is() )
+ xMeta = xConn->getMetaData();
+ OSL_ENSURE( xMeta.is(), "FmSearchEngine::Init: very strange cursor (could not derive connection meta data from it)!" );
+
+ sal_Bool bCaseSensitiveIdentifiers = sal_True; // assume case sensivity
+ if ( xMeta.is() )
+ bCaseSensitiveIdentifiers = xMeta->supportsMixedCaseQuotedIdentifiers();
+
+ // now that we have this information, we need a collator which is able to case (in)sentively compare strings
+ m_aStringCompare.loadDefaultCollator( SvtSysLocale().GetLocaleData().getLocale(),
+ bCaseSensitiveIdentifiers ? 0 : ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE );
+
+ try
+ {
+ // der Cursor kann mir einen Record (als PropertySet) liefern, dieser unterstuetzt den DatabaseRecord-Service
+ Reference< ::com::sun::star::sdbcx::XColumnsSupplier > xSupplyCols(IFACECAST(m_xSearchCursor), UNO_QUERY);
+ DBG_ASSERT(xSupplyCols.is(), "FmSearchEngine::Init : invalid cursor (no columns supplier) !");
+ Reference< ::com::sun::star::container::XNameAccess > xAllFieldNames = xSupplyCols->getColumns();
+ Sequence< ::rtl::OUString > seqFieldNames = xAllFieldNames->getElementNames();
+ ::rtl::OUString* pFieldNames = seqFieldNames.getArray();
+
+
+ ::rtl::OUString sCurrentField;
+ UniString sVis(sVisibleFields.getStr());
+ xub_StrLen nLen = sVis.GetTokenCount();
+ for (xub_StrLen i=0; i<nLen; ++i)
+ {
+ sCurrentField = sVis.GetToken(i);
+
+ // in der Feld-Sammlung suchen
+ sal_Int32 nFoundIndex = -1;
+ for (sal_Int32 j=0; j<seqFieldNames.getLength(); ++j, ++pFieldNames)
+ {
+ if ( 0 == m_aStringCompare.compareString( *pFieldNames, sCurrentField ) )
+ {
+ nFoundIndex = j;
+ break;
+ }
+ }
+ // set the field selection back to the first
+ pFieldNames = seqFieldNames.getArray();;
+ DBG_ASSERT(nFoundIndex != -1, "FmSearchEngine::Init : Invalid field name were given !");
+ m_arrFieldMapping.push_back(nFoundIndex);
+ }
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("Exception occured!");
+ }
+
+}
+
+//------------------------------------------------------------------------
+void FmSearchEngine::SetFormatterUsing(sal_Bool bSet)
+{
+ if (m_bFormatter == bSet)
+ return;
+ m_bFormatter = bSet;
+
+ if (m_bUsingTextComponents)
+ {
+ // ich benutzte keinen Formatter, sondern TextComponents -> der SearchIterator muss angepasst werden
+ try
+ {
+ if (m_bFormatter)
+ {
+ DBG_ASSERT(m_xSearchCursor == m_xClonedIterator, "FmSearchEngine::SetFormatterUsing : inkonsistenter Zustand !");
+ m_xSearchCursor = m_xOriginalIterator;
+ m_xSearchCursor.moveToBookmark(m_xClonedIterator.getBookmark());
+ // damit ich mit dem neuen Iterator wirklich dort weitermache, wo ich vorher aufgehoert habe
+ }
+ else
+ {
+ DBG_ASSERT(m_xSearchCursor == m_xOriginalIterator, "FmSearchEngine::SetFormatterUsing : inkonsistenter Zustand !");
+ m_xSearchCursor = m_xClonedIterator;
+ m_xSearchCursor.moveToBookmark(m_xOriginalIterator.getBookmark());
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ // ich muss die Fields neu binden, da der Textaustausch eventuell ueber diese Fields erfolgt und sich der unterliegende Cursor
+ // geaendert hat
+ RebuildUsedFields(m_nCurrentFieldIndex, sal_True);
+ }
+ else
+ InvalidatePreviousLoc();
+}
+
+//------------------------------------------------------------------------
+void FmSearchEngine::PropagateProgress(sal_Bool _bDontPropagateOverflow)
+{
+ if (m_aProgressHandler.IsSet())
+ {
+ FmSearchProgress aProgress;
+ try
+ {
+ aProgress.aSearchState = FmSearchProgress::STATE_PROGRESS;
+ aProgress.nCurrentRecord = m_xSearchCursor.getRow() - 1;
+ if (m_bForward)
+ aProgress.bOverflow = !_bDontPropagateOverflow && m_xSearchCursor.isFirst();
+ else
+ aProgress.bOverflow = !_bDontPropagateOverflow && m_xSearchCursor.isLast();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ m_aProgressHandler.Call(&aProgress);
+ }
+}
+
+//------------------------------------------------------------------------
+void FmSearchEngine::SearchNextImpl()
+{
+ DBG_ASSERT(!(m_bWildcard && m_bRegular) && !(m_bRegular && m_bLevenshtein) && !(m_bLevenshtein && m_bWildcard),
+ "FmSearchEngine::SearchNextImpl : Suchparameter schliessen sich gegenseitig aus !");
+
+ DBG_ASSERT(m_xSearchCursor.is(), "FmSearchEngine::SearchNextImpl : habe ungueltigen Iterator !");
+
+ // die Parameter der Suche
+ ::rtl::OUString strSearchExpression(m_strSearchExpression); // brauche ich non-const
+ if (!GetCaseSensitive())
+ // norm the string
+ m_aCharacterClassficator.toLower_rtl(strSearchExpression);
+
+ if (!m_bRegular && !m_bLevenshtein)
+ { // 'normale' Suche fuehre ich auf jeden Fall ueber WildCards durch, muss aber vorher je nach Modus den ::rtl::OUString anpassen
+
+ if (!m_bWildcard)
+ { // da natuerlich in allen anderen Faellen auch * und ? im Suchstring erlaubt sind, aber nicht als WildCards zaehlen
+ // sollen, muss ich normieren
+ UniString aTmp(strSearchExpression.getStr());
+ static const UniString s_sStar = UniString::CreateFromAscii("\\*");
+ static const UniString s_sQuotation = UniString::CreateFromAscii("\\?");
+ aTmp.SearchAndReplaceAll('*', s_sStar);
+ aTmp.SearchAndReplaceAll('?', s_sQuotation);
+ strSearchExpression = aTmp;
+
+ switch (m_nPosition)
+ {
+ case MATCHING_ANYWHERE :
+ strSearchExpression = ::rtl::OUString::createFromAscii("*") + strSearchExpression
+ + ::rtl::OUString::createFromAscii("*");
+ break;
+ case MATCHING_BEGINNING :
+ strSearchExpression = strSearchExpression + ::rtl::OUString::createFromAscii("*");
+ break;
+ case MATCHING_END :
+ strSearchExpression = ::rtl::OUString::createFromAscii("*") + strSearchExpression;
+ break;
+ case MATCHING_WHOLETEXT :
+ break;
+ default :
+ DBG_ERROR("FmSearchEngine::SearchNextImpl() : die Methoden-Listbox duerfte nur 4 Eintraege enthalten ...");
+ }
+ }
+ }
+
+ // fuer Arbeit auf Feldliste
+ FieldCollectionIterator iterBegin = m_arrUsedFields.begin();
+ FieldCollectionIterator iterEnd = m_arrUsedFields.end();
+ FieldCollectionIterator iterFieldCheck;
+
+ sal_Int32 nFieldPos;
+
+ if (HasPreviousLoc())
+ {
+ DBG_ASSERT(EQUAL_BOOKMARKS(m_aPreviousLocBookmark, m_xSearchCursor.getBookmark()),
+ "FmSearchEngine::SearchNextImpl : ungueltige Position !");
+ iterFieldCheck = m_iterPreviousLocField;
+ // im Feld nach (oder vor) der letzten Fundstelle weitermachen
+ nFieldPos = iterFieldCheck - iterBegin;
+ MoveField(nFieldPos, iterFieldCheck, iterBegin, iterEnd);
+ }
+ else
+ {
+ if (m_bForward)
+ iterFieldCheck = iterBegin;
+ else
+ {
+ iterFieldCheck = iterEnd;
+ --iterFieldCheck;
+ }
+ nFieldPos = iterFieldCheck - iterBegin;
+ }
+
+ PropagateProgress(sal_True);
+ SEARCH_RESULT srResult;
+ if (m_eSearchForType != SEARCHFOR_STRING)
+ srResult = SearchSpecial(m_eSearchForType == SEARCHFOR_NULL, nFieldPos, iterFieldCheck, iterBegin, iterEnd);
+ else if (!m_bRegular && !m_bLevenshtein)
+ srResult = SearchWildcard(strSearchExpression, nFieldPos, iterFieldCheck, iterBegin, iterEnd);
+ else
+ srResult = SearchRegularApprox(strSearchExpression, nFieldPos, iterFieldCheck, iterBegin, iterEnd);
+
+ m_srResult = srResult;
+
+ if (SR_ERROR == m_srResult)
+ return;
+
+ // gefunden ?
+ if (SR_FOUND == m_srResult)
+ {
+ // die Pos merken
+ try { m_aPreviousLocBookmark = m_xSearchCursor.getBookmark(); }
+ catch ( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); }
+ m_iterPreviousLocField = iterFieldCheck;
+ }
+ else
+ // die "letzte Fundstelle" invalidieren
+ InvalidatePreviousLoc();
+}
+
+//------------------------------------------------------------------------
+IMPL_LINK(FmSearchEngine, OnSearchTerminated, FmSearchThread*, /*pThread*/)
+{
+ if (!m_aProgressHandler.IsSet())
+ return 0L;
+
+ FmSearchProgress aProgress;
+ try
+ {
+ switch (m_srResult)
+ {
+ case SR_ERROR :
+ aProgress.aSearchState = FmSearchProgress::STATE_ERROR;
+ break;
+ case SR_FOUND :
+ aProgress.aSearchState = FmSearchProgress::STATE_SUCCESSFULL;
+ aProgress.aBookmark = m_aPreviousLocBookmark;
+ aProgress.nFieldIndex = m_iterPreviousLocField - m_arrUsedFields.begin();
+ break;
+ case SR_NOTFOUND :
+ aProgress.aSearchState = FmSearchProgress::STATE_NOTHINGFOUND;
+ aProgress.aBookmark = m_xSearchCursor.getBookmark();
+ break;
+ case SR_CANCELED :
+ aProgress.aSearchState = FmSearchProgress::STATE_CANCELED;
+ aProgress.aBookmark = m_xSearchCursor.getBookmark();
+ break;
+ }
+ aProgress.nCurrentRecord = m_xSearchCursor.getRow() - 1;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ // per definitionem muss der Link Thread-sicher sein (das verlange ich einfach), so dass ich mich um so etwas hier nicht kuemmern muss
+ m_aProgressHandler.Call(&aProgress);
+
+ m_bSearchingCurrently = sal_False;
+ return 0L;
+}
+
+//------------------------------------------------------------------------
+IMPL_LINK(FmSearchEngine, OnNewRecordCount, void*, pCounterAsVoid)
+{
+ if (!m_aProgressHandler.IsSet())
+ return 0L;
+
+ FmSearchProgress aProgress;
+ aProgress.nCurrentRecord = (sal_uIntPtr)pCounterAsVoid;
+ aProgress.aSearchState = FmSearchProgress::STATE_PROGRESS_COUNTING;
+ m_aProgressHandler.Call(&aProgress);
+
+ return 0L;
+}
+
+//------------------------------------------------------------------------
+sal_Bool FmSearchEngine::CancelRequested()
+{
+ m_aCancelAsynchAccess.acquire();
+ sal_Bool bReturn = m_bCancelAsynchRequest;
+ m_aCancelAsynchAccess.release();
+ return bReturn;
+}
+
+//------------------------------------------------------------------------
+void FmSearchEngine::CancelSearch()
+{
+ m_aCancelAsynchAccess.acquire();
+ m_bCancelAsynchRequest = sal_True;
+ m_aCancelAsynchAccess.release();
+}
+
+//------------------------------------------------------------------------
+sal_Bool FmSearchEngine::SwitchToContext(const Reference< ::com::sun::star::sdbc::XResultSet > & xCursor, const ::rtl::OUString& sVisibleFields, const InterfaceArray& arrFields,
+ sal_Int32 nFieldIndex)
+{
+ DBG_ASSERT(!m_bSearchingCurrently, "FmSearchEngine::SwitchToContext : please do not call while I'm searching !");
+ if (m_bSearchingCurrently)
+ return sal_False;
+
+ m_xSearchCursor = xCursor;
+ m_xOriginalIterator = xCursor;
+ m_xClonedIterator = CursorWrapper(m_xOriginalIterator, sal_True);
+ m_bUsingTextComponents = sal_True;
+
+ fillControlTexts(arrFields);
+
+ Init(sVisibleFields);
+ RebuildUsedFields(nFieldIndex, sal_True);
+
+ return sal_True;
+}
+
+//------------------------------------------------------------------------
+void FmSearchEngine::ImplStartNextSearch()
+{
+ m_bCancelAsynchRequest = sal_False;
+ m_bSearchingCurrently = sal_True;
+
+ if (m_eMode == SM_USETHREAD)//CHINA001 if (m_eMode == FmSearchDialog::SM_USETHREAD)
+ {
+ FmSearchThread* pSearcher = new FmSearchThread(this);
+ // der loescht sich nach Beendigung selber ...
+ pSearcher->setTerminationHandler(LINK(this, FmSearchEngine, OnSearchTerminated));
+
+ pSearcher->createSuspended();
+ pSearcher->setPriority(::vos::OThread::TPriority_Lowest);
+ pSearcher->resume();
+ }
+ else
+ {
+ SearchNextImpl();
+ LINK(this, FmSearchEngine, OnSearchTerminated).Call(NULL);
+ }
+}
+
+//------------------------------------------------------------------------
+void FmSearchEngine::SearchNext(const ::rtl::OUString& strExpression)
+{
+ m_strSearchExpression = strExpression;
+ m_eSearchForType = SEARCHFOR_STRING;
+ ImplStartNextSearch();
+}
+
+//------------------------------------------------------------------------
+void FmSearchEngine::SearchNextSpecial(sal_Bool _bSearchForNull)
+{
+ m_eSearchForType = _bSearchForNull ? SEARCHFOR_NULL : SEARCHFOR_NOTNULL;
+ ImplStartNextSearch();
+}
+
+//------------------------------------------------------------------------
+void FmSearchEngine::StartOver(const ::rtl::OUString& strExpression)
+{
+ try
+ {
+ if (m_bForward)
+ m_xSearchCursor.first();
+ else
+ m_xSearchCursor.last();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ return;
+ }
+
+ InvalidatePreviousLoc();
+ SearchNext(strExpression);
+}
+
+//------------------------------------------------------------------------
+void FmSearchEngine::StartOverSpecial(sal_Bool _bSearchForNull)
+{
+ try
+ {
+ if (m_bForward)
+ m_xSearchCursor.first();
+ else
+ m_xSearchCursor.last();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ return;
+ }
+
+ InvalidatePreviousLoc();
+ SearchNextSpecial(_bSearchForNull);
+}
+
+//------------------------------------------------------------------------
+void FmSearchEngine::InvalidatePreviousLoc()
+{
+ m_aPreviousLocBookmark.setValue(0,getVoidCppuType());
+ m_iterPreviousLocField = m_arrUsedFields.end();
+}
+
+//------------------------------------------------------------------------
+void FmSearchEngine::RebuildUsedFields(sal_Int32 nFieldIndex, sal_Bool bForce)
+{
+ if (!bForce && (nFieldIndex == m_nCurrentFieldIndex))
+ return;
+ // (da ich keinen Wechsel des Iterators von aussen zulasse, heisst selber ::com::sun::star::sdbcx::Index auch immer selbe Spalte, also habe ich nix zu tun)
+
+ DBG_ASSERT((nFieldIndex == -1) ||
+ ((nFieldIndex >= 0) &&
+ (static_cast<size_t>(nFieldIndex) < m_arrFieldMapping.size())),
+ "FmSearchEngine::RebuildUsedFields : nFieldIndex is invalid!");
+ // alle Felder, die ich durchsuchen muss, einsammeln
+ m_arrUsedFields.clear();
+ if (nFieldIndex == -1)
+ {
+ Reference< ::com::sun::star::container::XIndexAccess > xFields;
+ for (size_t i=0; i<m_arrFieldMapping.size(); ++i)
+ {
+ Reference< ::com::sun::star::sdbcx::XColumnsSupplier > xSupplyCols(IFACECAST(m_xSearchCursor), UNO_QUERY);
+ DBG_ASSERT(xSupplyCols.is(), "FmSearchEngine::RebuildUsedFields : invalid cursor (no columns supplier) !");
+ xFields = Reference< ::com::sun::star::container::XIndexAccess > (xSupplyCols->getColumns(), UNO_QUERY);
+ BuildAndInsertFieldInfo(xFields, m_arrFieldMapping[i]);
+ }
+ }
+ else
+ {
+ Reference< ::com::sun::star::container::XIndexAccess > xFields;
+ Reference< ::com::sun::star::sdbcx::XColumnsSupplier > xSupplyCols(IFACECAST(m_xSearchCursor), UNO_QUERY);
+ DBG_ASSERT(xSupplyCols.is(), "FmSearchEngine::RebuildUsedFields : invalid cursor (no columns supplier) !");
+ xFields = Reference< ::com::sun::star::container::XIndexAccess > (xSupplyCols->getColumns(), UNO_QUERY);
+ BuildAndInsertFieldInfo(xFields, m_arrFieldMapping[static_cast< size_t >(nFieldIndex)]);
+ }
+
+ m_nCurrentFieldIndex = nFieldIndex;
+ // und natuerlich beginne ich die naechste Suche wieder jungfraeulich
+ InvalidatePreviousLoc();
+}
+
diff --git a/svx/source/form/fmstring.src b/svx/source/form/fmstring.src
new file mode 100644
index 000000000000..91b5d28203a0
--- /dev/null
+++ b/svx/source/form/fmstring.src
@@ -0,0 +1,491 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "svx/fmresids.hrc"
+/* Strings fuer Uebersetzung */
+String RID_ERR_CONTEXT_ADDFORM
+{
+ Text [ en-US ] = "Error while creating form";
+};
+String RID_ERR_FIELDREQUIRED
+{
+ Text [ en-US ] = "Input required in field '#'. Please enter a value.";
+};
+String RID_ERR_DUPLICATE_NAME
+{
+ Text [ en-US ] = "Entry already exists.\nPlease choose another name.";
+};
+String RID_STR_FORMS
+{
+ Text [ en-US ] = "Forms";
+};
+String RID_STR_NO_PROPERTIES
+{
+ Text [ en-US ] = "No control selected";
+};
+String RID_STR_PROPERTIES_CONTROL
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Eigenschaften: : Kontrollelement Eigenschaften */
+ Text [ en-US ] = "Properties: ";
+};
+String RID_STR_PROPERTIES_FORM
+{
+ Text [ en-US ] = "Form Properties";
+};
+String RID_STR_FMEXPLORER
+{
+ Text [ en-US ] = "Form Navigator";
+};
+String RID_STR_FORM
+{
+ Text [ en-US ] = "Form";
+};
+Resource RID_RSC_TABWIN_PREFIX
+{
+ String 1
+ {
+ Text [ en-US ] = "Table";
+ };
+ String 2
+ {
+ Text [ en-US ] = "Query";
+ };
+ String 3
+ {
+ Text [ en-US ] = "SQL";
+ };
+};
+String RID_STR_FORMSHELL
+{
+ Text = "Form Shell";
+};
+String RID_STR_STDFORMNAME
+{
+ Text [ en-US ]= "Form";
+};
+String RID_STR_PROPTITLE_HIDDEN
+{
+ Text [ en-US ] = "Hidden Control";
+};
+String RID_STR_CONTROL
+{
+ Text [ en-US ] = "Control";
+};
+String RID_STR_REC_TEXT
+{
+ Text [ en-US ] = "Record";
+};
+String RID_STR_REC_FROM_TEXT
+{
+ Text [ en-US ] = "of";
+};
+String RID_STR_FIELDSELECTION
+{
+ Text [ en-US ] = "Add field:";
+};
+String RID_STR_WRITEERROR
+{
+ Text [ en-US ] = "Error writing data to database";
+};
+
+String RID_STR_SYNTAXERROR
+{
+ Text [ en-US ] = "Syntax error in query expression";
+};
+
+String RID_STR_DELETECONFIRM_RECORD
+{
+ Text [ en-US ] = "You intend to delete 1 record.";
+};
+String RID_STR_DELETECONFIRM_RECORDS
+{
+ Text [ en-US ] = "# records will be deleted.";
+};
+String RID_STR_DELETECONFIRM
+{
+ Text [ en-US ] = "If you click Yes, you won't be able to undo this operation.\nDo you want to continue anyway?";
+};
+
+String RID_ERR_NO_ELEMENT
+{
+ Text [ en-US ] = "Choose an entry from the list or enter a text corresponding to one of the list items.";
+};
+String RID_STR_GROUPBOX
+{
+ Text [ en-US ] = "Frame element";
+};
+String RID_STR_NAVIGATION
+{
+ Text [ en-US ] = "Navigation";
+};
+String RID_STR_NAVIGATIONBAR
+{
+ Text [ en-US ] = "Navigation bar";
+};
+String RID_STR_COLUMN
+{
+ Text [ en-US ] = "Col";
+};
+String RID_STR_UNDO_PROPERTY
+{
+ Text [ en-US ] = "Set property '#'";
+};
+String RID_STR_UNDO_CONTAINER_INSERT
+{
+ Text [ en-US ] = "Insert in container";
+};
+String RID_STR_UNDO_CONTAINER_REMOVE
+{
+ Text [ en-US ] = "Delete #";
+};
+String RID_STR_UNDO_CONTAINER_REMOVE_MULTIPLE
+{
+ Text [ en-US ] = "Delete # objects";
+};
+String RID_STR_UNDO_CONTAINER_REPLACE
+{
+ Text [ en-US ] = "Replace a container element";
+};
+String RID_STR_UNDO_DELETE_LOGICAL
+{
+ Text [ en-US ] = "Delete structure";
+};
+String RID_STR_UNDO_MODEL_REPLACE
+{
+ Text [ en-US ] = "Replace Control";
+};
+String RID_STR_DATE
+{
+ Text [ en-US ] = "Date";
+};
+String RID_STR_TIME
+{
+ Text [ en-US ] = "Time";
+};
+String RID_STR_PROPTITLE_PUSHBUTTON
+{
+ Text [ en-US ] = "Push Button";
+};
+String RID_STR_PROPTITLE_RADIOBUTTON
+{
+ Text [ en-US ] = "Option Button";
+};
+String RID_STR_PROPTITLE_CHECKBOX
+{
+ Text [ en-US ] = "Check Box";
+};
+String RID_STR_PROPTITLE_FIXEDTEXT
+{
+ Text [ en-US ] = "Label Field";
+};
+String RID_STR_PROPTITLE_GROUPBOX
+{
+ Text [ en-US ] = "Group Box";
+};
+String RID_STR_PROPTITLE_EDIT
+{
+ Text [ en-US ] = "Text Box";
+};
+String RID_STR_PROPTITLE_FORMATTED
+{
+ Text [ en-US ] = "Formatted Field";
+};
+String RID_STR_PROPTITLE_LISTBOX
+{
+ Text [ en-US ] = "List Box";
+};
+String RID_STR_PROPTITLE_COMBOBOX
+{
+ Text [ en-US ] = "Combo Box";
+};
+String RID_STR_PROPTITLE_IMAGEBUTTON
+{
+ Text [ en-US ] = "Image Button";
+};
+String RID_STR_PROPTITLE_IMAGECONTROL
+{
+ Text [ en-US ] = "Image Control";
+};
+String RID_STR_PROPTITLE_FILECONTROL
+{
+ Text [ en-US ] = "File Selection";
+};
+String RID_STR_PROPTITLE_DATEFIELD
+{
+ Text [ en-US ] = "Date Field";
+};
+String RID_STR_PROPTITLE_TIMEFIELD
+{
+ Text [ en-US ] = "Time Field";
+};
+String RID_STR_PROPTITLE_NUMERICFIELD
+{
+ Text [ en-US ] = "Numeric Field";
+};
+String RID_STR_PROPTITLE_CURRENCYFIELD
+{
+ Text [ en-US ] = "Currency Field";
+};
+String RID_STR_PROPTITLE_PATTERNFIELD
+{
+ Text [ en-US ] = "Pattern Field";
+};
+String RID_STR_PROPTITLE_DBGRID
+{
+ Text [ en-US ] = "Table Control ";
+};
+String RID_STR_PROPTITLE_SCROLLBAR
+{
+ Text [ en-US ] = "Scrollbar";
+};
+String RID_STR_PROPTITLE_SPINBUTTON
+{
+ Text [ en-US ] = "Spin Button";
+};
+String RID_STR_PROPTITLE_NAVBAR
+{
+ Text [ en-US ] = "Navigation Bar";
+};
+String RID_STR_PROPTITLE_MULTISELECT
+{
+ Text [ en-US ] = "Multiselection";
+};
+String RID_STR_NODATACONTROLS
+{
+ Text [ en-US ] = "No data-related controls in the current form!";
+};
+String RID_STR_POSTFIX_DATE
+{
+ Text [ en-US ] = " (Date)";
+};
+String RID_STR_POSTFIX_TIME
+{
+ Text [ en-US ] = " (Time)";
+};
+String RID_STR_FILTER_NAVIGATOR
+{
+ Text [ en-US ] = "Filter navigator";
+};
+
+String RID_STR_FILTER_FILTER_FOR
+{
+ Text [ en-US ] = "Filter for";
+};
+
+String RID_STR_FILTER_FILTER_OR
+{
+ Text [ en-US ] = "Or";
+};
+
+String RID_STR_NOCONTROLS_FOR_EXTERNALDISPLAY
+{
+ Text [ en-US ] = "Valid bound controls which can be used in the table view do not exist in the current form.";
+};
+String RID_STR_AUTOFIELD
+{
+ Text [ en-US ] = "<AutoField>";
+};
+
+QueryBox RID_QRY_SAVEMODIFIED
+{
+ Buttons = WB_YES_NO_CANCEL ;
+ DefButton = WB_DEF_YES ;
+ Message [ en-US ] = "The content of the current form has been modified.\nDo you want to save your changes?";
+};
+Resource RID_RSC_SQL_INTERNATIONAL
+{
+ String 1
+ {
+ Text [ en-US ] = "LIKE";
+ };
+ String 2
+ {
+ Text [ en-US ] = "NOT";
+ };
+ String 3
+ {
+ Text [ en-US ] = "EMPTY";
+ };
+ String 4
+ {
+ Text [ en-US ] = "TRUE";
+ };
+ String 5
+ {
+ Text [ en-US ] = "FALSE";
+ };
+ String 6
+ {
+ Text [ en-US ] = "IS";
+ };
+ String 7
+ {
+ Text [ en-US ] = "BETWEEN";
+ };
+ String 8
+ {
+ Text [ en-US ] = "OR";
+ };
+ String 9
+ {
+ Text [ en-US ] = "AND";
+ };
+ String 10
+ {
+ Text [ en-US ] = "Average";
+ };
+ String 11
+ {
+ Text [ en-US ] = "Count";
+ };
+ String 12
+ {
+ Text [ en-US ] = "Maximum";
+ };
+ String 13
+ {
+ Text [ en-US ] = "Minimum";
+ };
+ String 14
+ {
+ Text [ en-US ] = "Sum";
+ };
+ String 15
+ {
+ Text [ en-US ] = "Every";
+ };
+ String 16
+ {
+ Text [ en-US ] = "Any";
+ };
+ String 17
+ {
+ Text [ en-US ] = "Some";
+ };
+ String 18
+ {
+ Text [ en-US ] = "STDDEV_POP";
+ };
+ String 19
+ {
+ Text [ en-US ] = "STDDEV_SAMP";
+ };
+ String 20
+ {
+ Text [ en-US ] = "VAR_SAMP";
+ };
+ String 21
+ {
+ Text [ en-US ] = "VAR_POP";
+ };
+ String 22
+ {
+ Text [ en-US ] = "Collect";
+ };
+ String 23
+ {
+ Text [ en-US ] = "Fusion";
+ };
+ String 24
+ {
+ Text [ en-US ] = "Intersection";
+ };
+};
+
+String RID_STR_SVT_SQL_SYNTAX_ERROR
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Syntaxfehler im SQL-Ausdruck : Fehlerhafte Syntax */
+ Text [ en-US ] = "Syntax error in SQL statement";
+};
+
+String RID_STR_SVT_SQL_SYNTAX_VALUE_NO_LIKE
+{
+ Text [ en-US ] = "The value #1 cannot be used with LIKE.";
+};
+
+String RID_STR_SVT_SQL_SYNTAX_FIELD_NO_LIKE
+{
+ Text [ en-US ] = "LIKE cannot be used with this field.";
+};
+
+String RID_STR_SVT_SQL_SYNTAX_ACCESS_DAT_NO_VALID
+{
+ Text [ en-US ] = "The value entered is not a valid date. Please enter a date in a valid format, for example, MM/DD/YY.";
+};
+
+String RID_STR_SVT_SQL_SYNTAX_INT_NO_VALID
+{
+ Text [ en-US ] = "The field cannot be compared with an integer.";
+};
+String RID_STR_SVT_SQL_SYNTAX_TABLE
+{
+ Text [ en-US ] = "The database does not contain a table named \"#\".";
+};
+String RID_STR_SVT_SQL_SYNTAX_TABLE_OR_QUERY
+{
+ Text [ en-US ] = "The database does contain neither a table nor a query named \"#\".";
+};
+String RID_STR_SVT_SQL_SYNTAX_TABLE_EXISTS
+{
+ Text [ en-US ] = "The database already contains a table or view with name \"#\".";
+};
+String RID_STR_SVT_SQL_SYNTAX_QUERY_EXISTS
+{
+ Text [ en-US ] = "The database already contains a query with name \"#\".";
+};
+String RID_STR_SVT_SQL_SYNTAX_COLUMN
+{
+ Text [ en-US ] = "The column \"#1\" is unknown in the table \"#2\".";
+};
+String RID_STR_SVT_SQL_SYNTAX_REAL_NO_VALID
+{
+ Text [ en-US ] = "The field cannot be compared with a floating point number.";
+};
+
+String RID_STR_SVT_SQL_SYNTAX_CRIT_NO_COMPARE
+{
+ Text [ en-US ] = "The entered criterion cannot be compared with this field.";
+};
+
+String RID_STR_DATANAVIGATOR
+{
+ Text [ en-US ] = "Data Navigator";
+};
+
+String RID_STR_READONLY_VIEW
+{
+ Text [ en-US ] = " (read-only)";
+};
+
+String RID_STR_ALREADYEXISTOVERWRITE
+{
+ Text [ en-US ] = "The file already exists. Overwrite?" ;
+};
+String RID_STR_OBJECT_LABEL
+{
+ Text [ en-US ] = "#object# label";
+};
diff --git a/svx/source/form/fmtextcontroldialogs.cxx b/svx/source/form/fmtextcontroldialogs.cxx
new file mode 100644
index 000000000000..9be7d4881f61
--- /dev/null
+++ b/svx/source/form/fmtextcontroldialogs.cxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "fmtextcontroldialogs.hxx"
+#include <svx/dialmgr.hxx>
+#ifndef _SVX_DIALOGS_HRC
+#include <svx/dialogs.hrc>
+#endif
+
+#ifndef _SVX_CHARDLG_HXX
+//#include "chardlg.hxx"
+#endif
+#ifndef _SVX_PARAGRPH_HXX
+//#include "paragrph.hxx"
+#endif
+#include <editeng/eeitem.hxx>
+#ifndef _SVX_TABSTPGE_HXX
+//#include "tabstpge.hxx"
+#endif
+
+#include "svx/flagsdef.hxx"
+#include <svl/intitem.hxx>
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <svl/cjkoptions.hxx>
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ //====================================================================
+ //= TextControlCharAttribDialog
+ //====================================================================
+ //--------------------------------------------------------------------
+ TextControlCharAttribDialog::TextControlCharAttribDialog( Window* pParent, const SfxItemSet& _rCoreSet, const SvxFontListItem& _rFontList )
+ :SfxTabDialog( pParent, SVX_RES( RID_SVXDLG_TEXTCONTROL_CHARATTR ), &_rCoreSet )
+ ,m_aFontList( _rFontList )
+ {
+ FreeResource();
+
+ AddTabPage( RID_SVXPAGE_CHAR_NAME);
+ AddTabPage( RID_SVXPAGE_CHAR_EFFECTS);
+ AddTabPage( RID_SVXPAGE_CHAR_POSITION);
+ }
+
+ //--------------------------------------------------------------------
+ TextControlCharAttribDialog::~TextControlCharAttribDialog()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ void TextControlCharAttribDialog::PageCreated( sal_uInt16 _nId, SfxTabPage& _rPage )
+ {
+ SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
+
+ switch( _nId )
+ {
+ case RID_SVXPAGE_CHAR_NAME:
+ aSet.Put (m_aFontList);
+ _rPage.PageCreated(aSet);
+ break;
+
+ case RID_SVXPAGE_CHAR_EFFECTS:
+ aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP));
+ _rPage.PageCreated(aSet);
+ break;
+
+ case RID_SVXPAGE_CHAR_POSITION:
+ aSet.Put( SfxUInt32Item(SID_FLAG_TYPE, SVX_PREVIEW_CHARACTER) );
+ _rPage.PageCreated(aSet);
+ break;
+ }
+ }
+
+ //====================================================================
+ //= TextControlParaAttribDialog
+ //====================================================================
+ //--------------------------------------------------------------------
+ TextControlParaAttribDialog::TextControlParaAttribDialog( Window* _pParent, const SfxItemSet& _rCoreSet )
+ :SfxTabDialog( _pParent, SVX_RES( RID_SVXDLG_TEXTCONTROL_PARAATTR ), &_rCoreSet )
+ {
+ FreeResource();
+
+ AddTabPage( RID_SVXPAGE_STD_PARAGRAPH );
+ AddTabPage( RID_SVXPAGE_ALIGN_PARAGRAPH );
+
+ SvtCJKOptions aCJKOptions;
+ if( aCJKOptions.IsAsianTypographyEnabled() )
+ AddTabPage( RID_SVXPAGE_PARA_ASIAN );
+ else
+ RemoveTabPage( RID_SVXPAGE_PARA_ASIAN );
+
+ AddTabPage( RID_SVXPAGE_TABULATOR );
+ }
+
+ //--------------------------------------------------------------------
+ TextControlParaAttribDialog::~TextControlParaAttribDialog()
+ {
+ }
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
diff --git a/svx/source/form/fmtextcontrolfeature.cxx b/svx/source/form/fmtextcontrolfeature.cxx
new file mode 100644
index 000000000000..ed5df54f117d
--- /dev/null
+++ b/svx/source/form/fmtextcontrolfeature.cxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "fmtextcontrolfeature.hxx"
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::frame;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::util;
+
+ //====================================================================
+ //= FmTextControlFeature
+ //====================================================================
+ //--------------------------------------------------------------------
+ FmTextControlFeature::FmTextControlFeature( const Reference< XDispatch >& _rxDispatcher, const URL& _rFeatureURL, SfxSlotId _nSlotId, ISlotInvalidator* _pInvalidator )
+ :m_xDispatcher ( _rxDispatcher )
+ ,m_aFeatureURL ( _rFeatureURL )
+ ,m_nSlotId ( _nSlotId )
+ ,m_pInvalidator ( _pInvalidator )
+ ,m_bFeatureEnabled( false )
+ {
+ OSL_ENSURE( _rxDispatcher.is(), "FmTextControlFeature::FmTextControlFeature: invalid dispatcher!" );
+ OSL_ENSURE( m_nSlotId, "FmTextControlFeature::FmTextControlFeature: invalid slot id!" );
+ OSL_ENSURE( m_pInvalidator, "FmTextControlFeature::FmTextControlFeature: invalid invalidator!" );
+
+ osl_incrementInterlockedCount( &m_refCount );
+ try
+ {
+ m_xDispatcher->addStatusListener( this, m_aFeatureURL );
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "FmTextControlFeature::FmTextControlFeature: caught an exception!" );
+ }
+ osl_decrementInterlockedCount( &m_refCount );
+ }
+
+ //--------------------------------------------------------------------
+ FmTextControlFeature::~FmTextControlFeature( )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ void FmTextControlFeature::dispatch() const SAL_THROW(())
+ {
+ dispatch( Sequence< PropertyValue >( ) );
+ }
+
+ //--------------------------------------------------------------------
+ void FmTextControlFeature::dispatch( const Sequence< PropertyValue >& _rArgs ) const SAL_THROW(())
+ {
+ try
+ {
+ if ( m_xDispatcher.is() )
+ m_xDispatcher->dispatch( m_aFeatureURL, _rArgs );
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "FmTextControlFeature::dispatch: caught an exception!" );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL FmTextControlFeature::statusChanged( const FeatureStateEvent& _rState ) throw (RuntimeException)
+ {
+ m_aFeatureState = _rState.State;
+ m_bFeatureEnabled = _rState.IsEnabled;
+
+ if ( m_pInvalidator )
+ m_pInvalidator->Invalidate( m_nSlotId );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL FmTextControlFeature::disposing( const EventObject& /*Source*/ ) throw (RuntimeException)
+ {
+ // nothing to do
+ }
+
+ //--------------------------------------------------------------------
+ void FmTextControlFeature::dispose() SAL_THROW(())
+ {
+ try
+ {
+ m_xDispatcher->removeStatusListener( this, m_aFeatureURL );
+ m_xDispatcher.clear();
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "FmTextControlFeature::dispose: caught an exception!" );
+ }
+ }
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx
new file mode 100644
index 000000000000..e2b959d013eb
--- /dev/null
+++ b/svx/source/form/fmtextcontrolshell.cxx
@@ -0,0 +1,1398 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "fmprop.hrc"
+#include "svx/fmresids.hrc"
+#include "fmtextcontroldialogs.hxx"
+#include "fmtextcontrolfeature.hxx"
+#include "fmtextcontrolshell.hxx"
+#include "editeng/crsditem.hxx"
+#include "svx/dialmgr.hxx"
+#include "editeng/editeng.hxx"
+#include "editeng/eeitem.hxx"
+#include "svx/fmglob.hxx"
+#include "editeng/scriptspaceitem.hxx"
+#include "svx/svxids.hrc"
+#include "editeng/udlnitem.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/form/XForm.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/awt/XFocusListener.hpp>
+#include <com/sun/star/awt/XMouseListener.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/processfactory.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/msgpool.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/sfxuno.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svl/eitem.hxx>
+#include <svl/intitem.hxx>
+#include <svl/itempool.hxx>
+#include <svl/languageoptions.hxx>
+#include <svtools/stringtransfer.hxx>
+#include <svl/whiter.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <tools/diagnose_ex.h>
+#include <vcl/msgbox.hxx>
+#include <vcl/outdev.hxx>
+#include <vos/mutex.hxx>
+
+#include <memory>
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ using namespace ::com::sun::star;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::awt;
+ using namespace ::com::sun::star::form;
+ using namespace ::com::sun::star::form::runtime;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::frame;
+ using namespace ::com::sun::star::util;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::container;
+
+ //====================================================================
+ typedef sal_uInt16 WhichId;
+
+ //====================================================================
+ static SfxSlotId pTextControlSlots[] =
+ {
+ SID_CLIPBOARD_FORMAT_ITEMS,
+ SID_CUT,
+ SID_COPY,
+ SID_PASTE,
+ SID_SELECTALL,
+// SID_ATTR_TABSTOP, /* 2 */
+ SID_ATTR_CHAR_FONT,
+ SID_ATTR_CHAR_POSTURE,
+ SID_ATTR_CHAR_WEIGHT,
+ SID_ATTR_CHAR_SHADOWED,
+ SID_ATTR_CHAR_WORDLINEMODE,
+ SID_ATTR_CHAR_CONTOUR,
+ SID_ATTR_CHAR_STRIKEOUT,
+ SID_ATTR_CHAR_UNDERLINE,
+ SID_ATTR_CHAR_FONTHEIGHT,
+ SID_ATTR_CHAR_COLOR,
+ SID_ATTR_CHAR_KERNING,
+ SID_ATTR_CHAR_LANGUAGE, /* 20 */
+ SID_ATTR_CHAR_ESCAPEMENT,
+ SID_ATTR_PARA_ADJUST, /* 28 */
+ SID_ATTR_PARA_ADJUST_LEFT,
+ SID_ATTR_PARA_ADJUST_RIGHT,
+ SID_ATTR_PARA_ADJUST_CENTER,
+ SID_ATTR_PARA_ADJUST_BLOCK,
+ SID_ATTR_PARA_LINESPACE, /* 33 */
+ SID_ATTR_PARA_LINESPACE_10,
+ SID_ATTR_PARA_LINESPACE_15,
+ SID_ATTR_PARA_LINESPACE_20,
+ SID_ATTR_LRSPACE, /* 48 */
+ SID_ATTR_ULSPACE, /* 49 */
+ SID_ATTR_CHAR_AUTOKERN,
+ SID_SET_SUPER_SCRIPT,
+ SID_SET_SUB_SCRIPT,
+ SID_CHAR_DLG,
+ SID_PARA_DLG,
+// SID_TEXTDIRECTION_LEFT_TO_RIGHT, /* 907 */
+// SID_TEXTDIRECTION_TOP_TO_BOTTOM,
+ SID_ATTR_CHAR_SCALEWIDTH, /* 911 */
+ SID_ATTR_CHAR_RELIEF,
+ SID_ATTR_PARA_LEFT_TO_RIGHT, /* 950 */
+ SID_ATTR_PARA_RIGHT_TO_LEFT,
+ SID_ATTR_CHAR_OVERLINE,
+ 0
+ };
+
+ // slots which we are not responsible for on the SfxShell level, but
+ // need to handle during the "paragraph attributes" and/or "character
+ // attributes" dialogs
+ static SfxSlotId pDialogSlots[] =
+ {
+ SID_ATTR_TABSTOP,
+ SID_ATTR_PARA_HANGPUNCTUATION,
+ SID_ATTR_PARA_FORBIDDEN_RULES,
+ SID_ATTR_PARA_SCRIPTSPACE,
+ SID_ATTR_CHAR_LATIN_LANGUAGE,
+ SID_ATTR_CHAR_CJK_LANGUAGE,
+ SID_ATTR_CHAR_CTL_LANGUAGE,
+ SID_ATTR_CHAR_LATIN_FONT,
+ SID_ATTR_CHAR_CJK_FONT,
+ SID_ATTR_CHAR_CTL_FONT,
+ SID_ATTR_CHAR_LATIN_FONTHEIGHT,
+ SID_ATTR_CHAR_CJK_FONTHEIGHT,
+ SID_ATTR_CHAR_CTL_FONTHEIGHT,
+ SID_ATTR_CHAR_LATIN_WEIGHT,
+ SID_ATTR_CHAR_CJK_WEIGHT,
+ SID_ATTR_CHAR_CTL_WEIGHT,
+ SID_ATTR_CHAR_LATIN_POSTURE,
+ SID_ATTR_CHAR_CJK_POSTURE,
+ SID_ATTR_CHAR_CTL_POSTURE,
+ SID_ATTR_CHAR_EMPHASISMARK,
+ 0
+ };
+
+ //====================================================================
+ //= FmFocusListenerAdapter
+ //====================================================================
+ typedef ::cppu::WeakImplHelper1 < XFocusListener
+ > FmFocusListenerAdapter_Base;
+ class FmFocusListenerAdapter : public FmFocusListenerAdapter_Base
+ {
+ private:
+ IFocusObserver* m_pObserver;
+ Reference< XWindow > m_xWindow;
+
+ public:
+ FmFocusListenerAdapter( const Reference< XControl >& _rxControl, IFocusObserver* _pObserver );
+
+ // clean up the instance
+ void dispose();
+
+ protected:
+ ~FmFocusListenerAdapter();
+
+ protected:
+ virtual void SAL_CALL focusGained( const FocusEvent& e ) throw (RuntimeException);
+ virtual void SAL_CALL focusLost( const FocusEvent& e ) throw (RuntimeException);
+ virtual void SAL_CALL disposing( const EventObject& Source ) throw (RuntimeException);
+ };
+
+ //--------------------------------------------------------------------
+ DBG_NAME( FmFocusListenerAdapter )
+ //--------------------------------------------------------------------
+ FmFocusListenerAdapter::FmFocusListenerAdapter( const Reference< XControl >& _rxControl, IFocusObserver* _pObserver )
+ :m_pObserver( _pObserver )
+ ,m_xWindow( _rxControl, UNO_QUERY )
+ {
+ DBG_CTOR( FmFocusListenerAdapter, NULL );
+
+ DBG_ASSERT( m_xWindow.is(), "FmFocusListenerAdapter::FmFocusListenerAdapter: invalid control!" );
+ osl_incrementInterlockedCount( &m_refCount );
+ {
+ try
+ {
+ if ( m_xWindow.is() )
+ m_xWindow->addFocusListener( this );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ osl_decrementInterlockedCount( &m_refCount );
+ }
+
+ //--------------------------------------------------------------------
+ FmFocusListenerAdapter::~FmFocusListenerAdapter()
+ {
+ acquire();
+ dispose();
+
+ DBG_DTOR( FmFocusListenerAdapter, NULL );
+ }
+
+ //--------------------------------------------------------------------
+ void FmFocusListenerAdapter::dispose()
+ {
+ if ( m_xWindow.is() )
+ {
+ m_xWindow->removeFocusListener( this );
+ m_xWindow.clear();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL FmFocusListenerAdapter::focusGained( const FocusEvent& e ) throw (RuntimeException)
+ {
+ if ( m_pObserver )
+ m_pObserver->focusGained( e );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL FmFocusListenerAdapter::focusLost( const FocusEvent& e ) throw (RuntimeException)
+ {
+ if ( m_pObserver )
+ m_pObserver->focusLost( e );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL FmFocusListenerAdapter::disposing( const EventObject& Source ) throw (RuntimeException)
+ {
+ (void)Source;
+ DBG_ASSERT( Source.Source == m_xWindow, "FmFocusListenerAdapter::disposing: where did this come from?" );
+ m_xWindow.clear();
+ }
+
+ //====================================================================
+ //= FmMouseListenerAdapter
+ //====================================================================
+ typedef ::cppu::WeakImplHelper1 < XMouseListener
+ > FmMouseListenerAdapter_Base;
+ class FmMouseListenerAdapter : public FmMouseListenerAdapter_Base
+ {
+ private:
+ IContextRequestObserver* m_pObserver;
+ Reference< XWindow > m_xWindow;
+
+ public:
+ FmMouseListenerAdapter( const Reference< XControl >& _rxControl, IContextRequestObserver* _pObserver );
+
+ // clean up the instance
+ void dispose();
+
+ protected:
+ ~FmMouseListenerAdapter();
+
+ protected:
+ virtual void SAL_CALL mousePressed( const awt::MouseEvent& e ) throw (RuntimeException);
+ virtual void SAL_CALL mouseReleased( const awt::MouseEvent& e ) throw (RuntimeException);
+ virtual void SAL_CALL mouseEntered( const awt::MouseEvent& e ) throw (RuntimeException);
+ virtual void SAL_CALL mouseExited( const awt::MouseEvent& e ) throw (RuntimeException);
+ virtual void SAL_CALL disposing( const EventObject& Source ) throw (RuntimeException);
+ };
+
+ //====================================================================
+ //= FmMouseListenerAdapter
+ //====================================================================
+ //--------------------------------------------------------------------
+ DBG_NAME( FmMouseListenerAdapter )
+ //--------------------------------------------------------------------
+ FmMouseListenerAdapter::FmMouseListenerAdapter( const Reference< XControl >& _rxControl, IContextRequestObserver* _pObserver )
+ :m_pObserver( _pObserver )
+ ,m_xWindow( _rxControl, UNO_QUERY )
+ {
+ DBG_CTOR( FmMouseListenerAdapter, NULL );
+
+ DBG_ASSERT( m_xWindow.is(), "FmMouseListenerAdapter::FmMouseListenerAdapter: invalid control!" );
+ osl_incrementInterlockedCount( &m_refCount );
+ {
+ try
+ {
+ if ( m_xWindow.is() )
+ m_xWindow->addMouseListener( this );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ osl_decrementInterlockedCount( &m_refCount );
+ }
+
+ //--------------------------------------------------------------------
+ FmMouseListenerAdapter::~FmMouseListenerAdapter()
+ {
+ acquire();
+ dispose();
+
+ DBG_DTOR( FmMouseListenerAdapter, NULL );
+ }
+
+ //--------------------------------------------------------------------
+ void FmMouseListenerAdapter::dispose()
+ {
+ if ( m_xWindow.is() )
+ {
+ m_xWindow->removeMouseListener( this );
+ m_xWindow.clear();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL FmMouseListenerAdapter::mousePressed( const awt::MouseEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ // is this a request for a context menu?
+ if ( _rEvent.PopupTrigger )
+ {
+ if ( m_pObserver )
+ m_pObserver->contextMenuRequested( _rEvent );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL FmMouseListenerAdapter::mouseReleased( const awt::MouseEvent& /*e*/ ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ // not interested in
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL FmMouseListenerAdapter::mouseEntered( const awt::MouseEvent& /*e*/ ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ // not interested in
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL FmMouseListenerAdapter::mouseExited( const awt::MouseEvent& /*e*/ ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ // not interested in
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL FmMouseListenerAdapter::disposing( const EventObject& Source ) throw (RuntimeException)
+ {
+ (void)Source;
+ DBG_ASSERT( Source.Source == m_xWindow, "FmMouseListenerAdapter::disposing: where did this come from?" );
+ m_xWindow.clear();
+ }
+
+ //====================================================================
+ //= FmTextControlShell
+ //====================================================================
+ //------------------------------------------------------------------------
+ namespace
+ {
+ //....................................................................
+ void lcl_translateUnoStateToItem( SfxSlotId _nSlot, const Any& _rUnoState, SfxItemSet& _rSet )
+ {
+ WhichId nWhich = _rSet.GetPool()->GetWhich( _nSlot );
+ if ( !_rUnoState.hasValue() )
+ {
+ if ( ( _nSlot != SID_CUT )
+ && ( _nSlot != SID_COPY )
+ && ( _nSlot != SID_PASTE )
+ )
+ {
+ _rSet.InvalidateItem( nWhich );
+ }
+ }
+ else
+ {
+ switch ( _rUnoState.getValueType().getTypeClass() )
+ {
+ case TypeClass_BOOLEAN:
+ {
+ sal_Bool bState = sal_False;
+ _rUnoState >>= bState;
+ if ( _nSlot == SID_ATTR_PARA_SCRIPTSPACE )
+ _rSet.Put( SvxScriptSpaceItem( bState, nWhich ) );
+ else
+ _rSet.Put( SfxBoolItem( nWhich, bState ) );
+ }
+ break;
+
+ default:
+ {
+ Sequence< PropertyValue > aComplexState;
+ if ( _rUnoState >>= aComplexState )
+ {
+ if ( !aComplexState.getLength() )
+ _rSet.InvalidateItem( nWhich );
+ else
+ {
+ SfxAllItemSet aAllItems( _rSet );
+ TransformParameters( _nSlot, aComplexState, aAllItems );
+ const SfxPoolItem* pTransformed = aAllItems.GetItem( nWhich );
+ OSL_ENSURE( pTransformed, "lcl_translateUnoStateToItem: non-empty parameter sequence leading to empty item?" );
+ if ( pTransformed )
+ _rSet.Put( *pTransformed );
+ else
+ _rSet.InvalidateItem( nWhich );
+ }
+ }
+ else
+ {
+ DBG_ERROR( "lcl_translateUnoStateToItem: invalid state!" );
+ }
+ }
+ }
+ }
+ }
+
+ //....................................................................
+ ::rtl::OUString lcl_getUnoSlotName( SfxApplication&, SfxSlotId _nSlotId )
+ {
+ ::rtl::OUString sSlotUnoName;
+
+ SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool( NULL );
+ const SfxSlot* pSlot = rSlotPool.GetSlot( _nSlotId );
+
+ const sal_Char* pAsciiUnoName = NULL;
+ if ( pSlot )
+ {
+ pAsciiUnoName = pSlot->GetUnoName();
+ }
+ else
+ {
+ // some hard-coded slots, which do not have a UNO name at SFX level, but which
+ // we nevertheless need to transport via UNO mechanisms, so we need a name
+ switch ( _nSlotId )
+ {
+ case SID_ATTR_PARA_HANGPUNCTUATION: pAsciiUnoName = "AllowHangingPunctuation"; break;
+ case SID_ATTR_PARA_FORBIDDEN_RULES: pAsciiUnoName = "ApplyForbiddenCharacterRules"; break;
+ case SID_ATTR_PARA_SCRIPTSPACE: pAsciiUnoName = "UseScriptSpacing"; break;
+ }
+ }
+
+ if ( pAsciiUnoName )
+ {
+ sSlotUnoName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:" ) );
+ sSlotUnoName += ::rtl::OUString::createFromAscii( pAsciiUnoName );
+ }
+#if OSL_DEBUG_LEVEL > 0
+ else
+ {
+ ::rtl::OString sMessage( "lcl_getUnoSlotName: invalid slot id, or invalid slot, or no UNO name!\n" );
+ sMessage += "(slot id: ";
+ sMessage += ::rtl::OString::valueOf( (sal_Int32)_nSlotId );
+ sMessage += ")";
+ DBG_ERROR( sMessage );
+ }
+#endif
+ return sSlotUnoName;
+ }
+
+ //....................................................................
+ bool lcl_determineReadOnly( const Reference< XControl >& _rxControl )
+ {
+ bool bIsReadOnlyModel = true;
+ try
+ {
+ Reference< XPropertySet > xModelProps;
+ if ( _rxControl.is() )
+ xModelProps = xModelProps.query( _rxControl->getModel() );
+ Reference< XPropertySetInfo > xModelPropInfo;
+ if ( xModelProps.is() )
+ xModelPropInfo = xModelProps->getPropertySetInfo();
+
+ if ( !xModelPropInfo.is() || !xModelPropInfo->hasPropertyByName( FM_PROP_READONLY ) )
+ bIsReadOnlyModel = true;
+ else
+ {
+ sal_Bool bReadOnly = sal_True;
+ xModelProps->getPropertyValue( FM_PROP_READONLY ) >>= bReadOnly;
+ bIsReadOnlyModel = bReadOnly;
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return bIsReadOnlyModel;
+ }
+
+ //....................................................................
+ static Window* lcl_getWindow( const Reference< XControl >& _rxControl )
+ {
+ Window* pWindow = NULL;
+ try
+ {
+ Reference< XWindowPeer > xControlPeer;
+ if ( _rxControl.is() )
+ xControlPeer = _rxControl->getPeer();
+ if ( xControlPeer.is() )
+ pWindow = VCLUnoHelper::GetWindow( xControlPeer );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return pWindow;
+ }
+
+ //....................................................................
+ bool lcl_isRichText( const Reference< XControl >& _rxControl )
+ {
+ if ( !_rxControl.is() )
+ return false;
+
+ bool bIsRichText = false;
+ try
+ {
+ Reference< XPropertySet > xModelProps( _rxControl->getModel(), UNO_QUERY );
+ Reference< XPropertySetInfo > xPSI;
+ if ( xModelProps.is() )
+ xPSI = xModelProps->getPropertySetInfo();
+ ::rtl::OUString sRichTextPropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RichText" ) );
+ if ( xPSI.is() && xPSI->hasPropertyByName( sRichTextPropertyName ) )
+ {
+ OSL_VERIFY( xModelProps->getPropertyValue( sRichTextPropertyName ) >>= bIsRichText );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return bIsRichText;
+ }
+ }
+
+ //------------------------------------------------------------------------
+ FmTextControlShell::FmTextControlShell( SfxViewFrame* _pFrame )
+ :m_bActiveControl( false )
+ ,m_bActiveControlIsReadOnly( true )
+ ,m_bActiveControlIsRichText( false )
+ ,m_pViewFrame( _pFrame )
+ ,m_rBindings( _pFrame->GetBindings() )
+ ,m_bNeedClipboardInvalidation( true )
+ {
+ m_aClipboardInvalidation.SetTimeoutHdl( LINK( this, FmTextControlShell, OnInvalidateClipboard ) );
+ m_aClipboardInvalidation.SetTimeout( 200 );
+ }
+
+ //------------------------------------------------------------------------
+ FmTextControlShell::~FmTextControlShell()
+ {
+ dispose();
+ }
+
+ //------------------------------------------------------------------------
+ IMPL_LINK( FmTextControlShell, OnInvalidateClipboard, void*, /*_pNotInterestedIn*/ )
+ {
+ if ( m_bNeedClipboardInvalidation )
+ {
+ DBG_TRACE( "FmTextControlShell::ClipBoard: invalidating clipboard slots" );
+ m_rBindings.Invalidate( SID_CUT );
+ m_rBindings.Invalidate( SID_COPY );
+ m_rBindings.Invalidate( SID_PASTE );
+ m_bNeedClipboardInvalidation = false;
+ }
+ return 0L;
+ }
+
+ //------------------------------------------------------------------------
+ void FmTextControlShell::transferFeatureStatesToItemSet( ControlFeatures& _rDispatchers, SfxAllItemSet& _rSet, bool _bTranslateLatin )
+ {
+ SfxItemPool& rPool = *_rSet.GetPool();
+
+ for ( ControlFeatures::const_iterator aFeature = _rDispatchers.begin();
+ aFeature != _rDispatchers.end();
+ ++aFeature
+ )
+ {
+ SfxSlotId nSlotId( aFeature->first );
+ #if OSL_DEBUG_LEVEL > 0
+ ::rtl::OUString sUnoSlotName;
+ if ( SFX_APP() )
+ sUnoSlotName = lcl_getUnoSlotName( *SFX_APP(), nSlotId );
+ else
+ sUnoSlotName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "<unknown>" ) );
+ ::rtl::OString sUnoSlotNameAscii( "\"" );
+ sUnoSlotNameAscii += ::rtl::OString( sUnoSlotName.getStr(), sUnoSlotName.getLength(), RTL_TEXTENCODING_ASCII_US );
+ sUnoSlotNameAscii += "\"";
+ #endif
+
+ if ( _bTranslateLatin )
+ {
+ // A rich text control offers a dispatcher for the "Font" slot/feature.
+ // Sadly, the semantics of the dispatches is that the feature "Font" depends
+ // on the current cursor position: If it's on latin text, it's the "latin font"
+ // which is set up at the control. If it's on CJK text, it's the "CJK font", and
+ // aequivalent for "CTL font".
+ // The same holds for some other font related features/slots.
+ // Thus, we have separate dispatches for "Latin Font", "Latin Font Size", etc,
+ // which are only "virtual", in a sense that there exist no item with this id.
+ // So when we encounter such a dispatcher for, say, "Latin Font", we need to
+ // put an item into the set which has the "Font" id.
+
+ switch ( nSlotId )
+ {
+ case SID_ATTR_CHAR_LATIN_FONT: nSlotId = SID_ATTR_CHAR_FONT; break;
+ case SID_ATTR_CHAR_LATIN_FONTHEIGHT:nSlotId = SID_ATTR_CHAR_FONTHEIGHT; break;
+ case SID_ATTR_CHAR_LATIN_LANGUAGE: nSlotId = SID_ATTR_CHAR_LANGUAGE; break;
+ case SID_ATTR_CHAR_LATIN_POSTURE: nSlotId = SID_ATTR_CHAR_POSTURE; break;
+ case SID_ATTR_CHAR_LATIN_WEIGHT: nSlotId = SID_ATTR_CHAR_WEIGHT; break;
+ }
+ }
+
+ WhichId nWhich = rPool.GetWhich( nSlotId );
+ bool bIsInPool = rPool.IsInRange( nWhich );
+ if ( bIsInPool )
+ {
+ #if OSL_DEBUG_LEVEL > 0
+ bool bFeatureIsEnabled = aFeature->second->isFeatureEnabled();
+ ::rtl::OString sMessage( "FmTextControlShell::transferFeatureStatesToItemSet: found a feature state for " );
+ sMessage += sUnoSlotNameAscii;
+ if ( !bFeatureIsEnabled )
+ sMessage += " (disabled)";
+ DBG_TRACE( sMessage );
+ #endif
+
+ lcl_translateUnoStateToItem( nSlotId, aFeature->second->getFeatureState(), _rSet );
+ }
+ #if OSL_DEBUG_LEVEL > 0
+ else
+ {
+ ::rtl::OString sMessage( "FmTextControlShell::transferFeatureStatesToItemSet: found a feature state for " );
+ sMessage += sUnoSlotNameAscii;
+ sMessage += ", but could not translate it into an item!";
+ DBG_TRACE( sMessage );
+ }
+ #endif
+ }
+ }
+
+ //------------------------------------------------------------------------
+ void FmTextControlShell::executeAttributeDialog( AttributeSet _eSet, SfxRequest& _rReq )
+ {
+ const SvxFontListItem* pFontList = PTR_CAST( SvxFontListItem, m_pViewFrame->GetObjectShell()->GetItem( SID_ATTR_CHAR_FONTLIST ) );
+ DBG_ASSERT( pFontList, "FmTextControlShell::executeAttributeDialog: no font list item!" );
+ if ( !pFontList )
+ return;
+
+ SfxItemPool* pPool = EditEngine::CreatePool();
+ pPool->FreezeIdRanges();
+ ::std::auto_ptr< SfxItemSet > pPureItems( new SfxItemSet( *pPool ) );
+
+ // put the current states of the items into the set
+ ::std::auto_ptr< SfxAllItemSet > pCurrentItems( new SfxAllItemSet( *pPureItems ) );
+ transferFeatureStatesToItemSet( m_aControlFeatures, *pCurrentItems );
+
+ // additional items, which we are not responsible for at the SfxShell level,
+ // but which need to be forwarded to the dialog, anyway
+ ControlFeatures aAdditionalFestures;
+ fillFeatureDispatchers( m_xActiveControl, pDialogSlots, aAdditionalFestures );
+ transferFeatureStatesToItemSet( aAdditionalFestures, *pCurrentItems, true );
+
+ ::std::auto_ptr< SfxTabDialog > pDialog ( _eSet == eCharAttribs
+ ? static_cast< SfxTabDialog* >( new TextControlCharAttribDialog( NULL, *pCurrentItems, *pFontList ) )
+ : static_cast< SfxTabDialog* >( new TextControlParaAttribDialog( NULL, *pCurrentItems ) ) );
+ if ( RET_OK == pDialog->Execute() )
+ {
+ const SfxItemSet& rModifiedItems = *pDialog->GetOutputItemSet();
+ for ( WhichId nWhich = pPool->GetFirstWhich(); nWhich <= pPool->GetLastWhich(); ++nWhich )
+ {
+ if ( rModifiedItems.GetItemState( nWhich ) == SFX_ITEM_SET )
+ {
+ SfxSlotId nSlotForItemSet = pPool->GetSlotId( nWhich );
+ const SfxPoolItem* pModifiedItem = rModifiedItems.GetItem( nWhich );
+
+
+ SfxSlotId nSlotForDispatcher = nSlotForItemSet;
+ switch ( nSlotForDispatcher )
+ {
+ case SID_ATTR_CHAR_FONT: nSlotForDispatcher = SID_ATTR_CHAR_LATIN_FONT; break;
+ case SID_ATTR_CHAR_FONTHEIGHT:nSlotForDispatcher = SID_ATTR_CHAR_LATIN_FONTHEIGHT; break;
+ case SID_ATTR_CHAR_LANGUAGE: nSlotForDispatcher = SID_ATTR_CHAR_LATIN_LANGUAGE; break;
+ case SID_ATTR_CHAR_POSTURE: nSlotForDispatcher = SID_ATTR_CHAR_LATIN_POSTURE; break;
+ case SID_ATTR_CHAR_WEIGHT: nSlotForDispatcher = SID_ATTR_CHAR_LATIN_WEIGHT; break;
+ }
+
+ // do we already have a dispatcher for this slot/feature?
+ ControlFeatures::const_iterator aFeaturePos = m_aControlFeatures.find( nSlotForDispatcher );
+ bool bFound = aFeaturePos != m_aControlFeatures.end( );
+
+ if ( !bFound )
+ {
+ aFeaturePos = aAdditionalFestures.find( nSlotForDispatcher );
+ bFound = aFeaturePos != aAdditionalFestures.end( );
+ }
+
+ if ( bFound )
+ {
+ Sequence< PropertyValue > aArgs;
+ // temporarily put the modified item into a "clean" set,
+ // and let TransformItems calc the respective UNO parameters
+ pPureItems->Put( *pModifiedItem );
+ TransformItems( nSlotForItemSet, *pPureItems, aArgs );
+ pPureItems->ClearItem( nWhich );
+
+ if ( ( nSlotForItemSet == SID_ATTR_PARA_HANGPUNCTUATION )
+ || ( nSlotForItemSet == SID_ATTR_PARA_FORBIDDEN_RULES )
+ || ( nSlotForItemSet == SID_ATTR_PARA_SCRIPTSPACE )
+ )
+ {
+ // these are no UNO slots, they need special handling since TransformItems cannot
+ // handle them
+ DBG_ASSERT( aArgs.getLength() == 0, "FmTextControlShell::executeAttributeDialog: these are no UNO slots - are they?" );
+
+ const SfxBoolItem* pBoolItem = PTR_CAST( SfxBoolItem, pModifiedItem );
+ DBG_ASSERT( pBoolItem, "FmTextControlShell::executeAttributeDialog: no bool item?!" );
+ if ( pBoolItem )
+ {
+ aArgs.realloc( 1 );
+ aArgs[ 0 ].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enable" ) );
+ aArgs[ 0 ].Value <<= (sal_Bool)pBoolItem->GetValue();
+ }
+ }
+
+ // dispatch this
+ aFeaturePos->second->dispatch( aArgs );
+ }
+ #if OSL_DEBUG_LEVEL > 0
+ else
+ {
+ ::rtl::OString sError( "FmTextControShell::executeAttributeDialog: Could not handle the following item:" );
+ sError += "\n SlotID: "; sError += ::rtl::OString::valueOf( (sal_Int32)nSlotForItemSet );
+ sError += "\n WhichID: "; sError += ::rtl::OString::valueOf( (sal_Int32)nWhich );
+ sError += "\n UNO name: ";
+
+ ::rtl::OUString sUnoSlotName = lcl_getUnoSlotName( *SFX_APP(), nSlotForItemSet );
+ if ( sUnoSlotName.getLength() )
+ sError += ::rtl::OString( sUnoSlotName.getStr(), sUnoSlotName.getLength(), RTL_TEXTENCODING_ASCII_US );
+ else
+ sError += "unknown (no SfxSlot)";
+ DBG_ERROR( sError.getStr() );
+ }
+ #endif
+ }
+ }
+ _rReq.Done( rModifiedItems );
+ }
+
+ pDialog.reset();
+ pCurrentItems.reset();
+ pPureItems.reset();
+ SfxItemPool::Free(pPool);
+ }
+
+ //------------------------------------------------------------------------
+ bool FmTextControlShell::executeSelectAll( )
+ {
+ try
+ {
+ if ( m_xActiveTextComponent.is() )
+ {
+ sal_Int32 nTextLen = m_xActiveTextComponent->getText().getLength();
+ m_xActiveTextComponent->setSelection( awt::Selection( 0, nTextLen ) );
+ return true;
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return false; // not handled
+ }
+
+ //------------------------------------------------------------------------
+ bool FmTextControlShell::executeClipboardSlot( SfxSlotId _nSlot )
+ {
+ try
+ {
+ if ( m_xActiveTextComponent.is() )
+ {
+ switch ( _nSlot )
+ {
+ case SID_COPY:
+ case SID_CUT:
+ {
+ ::rtl::OUString sSelectedText( m_xActiveTextComponent->getSelectedText() );
+ ::svt::OStringTransfer::CopyString( sSelectedText, lcl_getWindow( m_xActiveControl ) );
+ if ( SID_CUT == _nSlot )
+ {
+ awt::Selection aSelection( m_xActiveTextComponent->getSelection() );
+ m_xActiveTextComponent->insertText( aSelection, ::rtl::OUString() );
+ }
+ }
+ break;
+ case SID_PASTE:
+ {
+ ::rtl::OUString sClipboardContent;
+ OSL_VERIFY( ::svt::OStringTransfer::PasteString( sClipboardContent, lcl_getWindow( m_xActiveControl ) ) );
+ awt::Selection aSelection( m_xActiveTextComponent->getSelection() );
+ m_xActiveTextComponent->insertText( aSelection, sClipboardContent );
+ }
+ break;
+ default:
+ OSL_ENSURE( sal_False, "FmTextControlShell::executeClipboardSlot: invalid slot!" );
+ }
+ return true;
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return false; // not handled
+ }
+
+ //------------------------------------------------------------------------
+ void FmTextControlShell::ExecuteTextAttribute( SfxRequest& _rReq )
+ {
+ SfxSlotId nSlot = _rReq.GetSlot();
+
+ ControlFeatures::const_iterator aFeaturePos = m_aControlFeatures.find( nSlot );
+ if ( aFeaturePos == m_aControlFeatures.end() )
+ {
+ // special slots
+ switch ( nSlot )
+ {
+ case SID_CHAR_DLG:
+ executeAttributeDialog( eCharAttribs, _rReq );
+ break;
+
+ case SID_PARA_DLG:
+ executeAttributeDialog( eParaAttribs, _rReq );
+ break;
+
+ case SID_SELECTALL:
+ executeSelectAll();
+ break;
+
+ case SID_CUT:
+ case SID_COPY:
+ case SID_PASTE:
+ executeClipboardSlot( nSlot );
+ break;
+
+ default:
+ DBG_ASSERT( aFeaturePos != m_aControlFeatures.end(), "FmTextControShell::ExecuteTextAttribute: I have no such dispatcher, and cannot handle it at all!" );
+ return;
+ }
+ }
+ else
+ {
+ // slots which are dispatched to the control
+
+ switch ( nSlot )
+ {
+ case SID_ATTR_CHAR_STRIKEOUT:
+ case SID_ATTR_CHAR_UNDERLINE:
+ case SID_ATTR_CHAR_OVERLINE:
+ {
+ SfxItemSet aToggled( *_rReq.GetArgs() );
+
+ lcl_translateUnoStateToItem( nSlot, aFeaturePos->second->getFeatureState(), aToggled );
+ WhichId nWhich = aToggled.GetPool()->GetWhich( nSlot );
+ const SfxPoolItem* pItem = aToggled.GetItem( nWhich );
+ if ( ( SID_ATTR_CHAR_UNDERLINE == nSlot ) || ( SID_ATTR_CHAR_OVERLINE == nSlot ) )
+ {
+ const SvxOverlineItem* pTextLine = PTR_CAST( SvxOverlineItem, pItem );
+ DBG_ASSERT( pTextLine, "FmTextControlShell::ExecuteTextAttribute: ooops - no underline/overline item!" );
+ if ( pTextLine )
+ {
+ FontUnderline eTL = pTextLine->GetLineStyle();
+ if ( SID_ATTR_CHAR_UNDERLINE == nSlot ) {
+ aToggled.Put( SvxUnderlineItem( eTL == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, nWhich ) );
+ } else {
+ aToggled.Put( SvxOverlineItem( eTL == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, nWhich ) );
+ }
+ }
+ }
+ else
+ {
+ const SvxCrossedOutItem* pCrossedOut = PTR_CAST( SvxCrossedOutItem, pItem );
+ DBG_ASSERT( pCrossedOut, "FmTextControlShell::ExecuteTextAttribute: ooops - no CrossedOut item!" );
+ if ( pCrossedOut )
+ {
+ FontStrikeout eFS = pCrossedOut->GetStrikeout();
+ aToggled.Put( SvxCrossedOutItem( eFS == STRIKEOUT_SINGLE ? STRIKEOUT_NONE : STRIKEOUT_SINGLE, nWhich ) );
+ }
+ }
+
+ Sequence< PropertyValue > aArguments;
+ TransformItems( nSlot, aToggled, aArguments );
+ aFeaturePos->second->dispatch( aArguments );
+ }
+ break;
+
+ case SID_ATTR_CHAR_FONTHEIGHT:
+ case SID_ATTR_CHAR_FONT:
+ case SID_ATTR_CHAR_POSTURE:
+ case SID_ATTR_CHAR_WEIGHT:
+ case SID_ATTR_CHAR_SHADOWED:
+ case SID_ATTR_CHAR_CONTOUR:
+ case SID_SET_SUPER_SCRIPT:
+ case SID_SET_SUB_SCRIPT:
+ {
+ const SfxItemSet* pArgs = _rReq.GetArgs();
+ Sequence< PropertyValue > aArgs;
+ if ( pArgs )
+ TransformItems( nSlot, *pArgs, aArgs );
+ aFeaturePos->second->dispatch( aArgs );
+ }
+ break;
+
+ default:
+ if ( aFeaturePos->second->isFeatureEnabled() )
+ aFeaturePos->second->dispatch();
+ break;
+ }
+ }
+ _rReq.Done();
+ }
+
+ //------------------------------------------------------------------------
+ void FmTextControlShell::GetTextAttributeState( SfxItemSet& _rSet )
+ {
+ SfxWhichIter aIter( _rSet );
+ sal_uInt16 nSlot = aIter.FirstWhich();
+ while ( nSlot )
+ {
+ if ( ( nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT )
+ || ( nSlot == SID_ATTR_PARA_RIGHT_TO_LEFT )
+ )
+ {
+ if ( !SvtLanguageOptions().IsCTLFontEnabled() )
+ {
+ _rSet.DisableItem( nSlot );
+ nSlot = aIter.NextWhich();
+ continue;
+ }
+ }
+
+ ControlFeatures::const_iterator aFeaturePos = m_aControlFeatures.find( nSlot );
+ if ( aFeaturePos != m_aControlFeatures.end() )
+ {
+ if ( aFeaturePos->second->isFeatureEnabled() )
+ lcl_translateUnoStateToItem( nSlot, aFeaturePos->second->getFeatureState(), _rSet );
+ else
+ _rSet.DisableItem( nSlot );
+ }
+ else
+ {
+ bool bDisable = false;
+
+ bool bNeedWriteableControl = false;
+ bool bNeedTextComponent = false;
+ bool bNeedSelection = false;
+
+ switch ( nSlot )
+ {
+ case SID_CHAR_DLG:
+ case SID_PARA_DLG:
+ bDisable |= m_aControlFeatures.empty();
+ bNeedWriteableControl = true;
+ break;
+
+ case SID_CUT:
+ bNeedSelection = true;
+ bNeedTextComponent = true;
+ bNeedWriteableControl = true;
+ DBG_TRACE( "FmTextControlShell::ClipBoard: need to invalidate again" );
+ m_bNeedClipboardInvalidation = true;
+ break;
+
+ case SID_PASTE:
+ {
+ Window* pActiveControlVCLWindow = lcl_getWindow( m_xActiveControl );
+ if ( pActiveControlVCLWindow )
+ {
+ TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pActiveControlVCLWindow) );
+ bDisable |= !aDataHelper.HasFormat( SOT_FORMAT_STRING );
+ }
+ else
+ bDisable |= true;
+
+ bNeedTextComponent = true;
+ bNeedWriteableControl = true;
+ }
+ break;
+
+ case SID_COPY:
+ bNeedTextComponent = true;
+ bNeedSelection = true;
+ break;
+
+ case SID_SELECTALL:
+ bNeedTextComponent = true;
+ break;
+
+ default:
+ // slot is unknown at all
+ bDisable |= true;
+ break;
+ }
+ OSL_POSTCOND( !bNeedSelection || bNeedTextComponent, "FmTextControlShell::GetTextAttributeState: bNeedSelection should imply bNeedTextComponent!" );
+
+ if ( !bDisable && bNeedWriteableControl )
+ bDisable |= !IsActiveControl( ) || m_bActiveControlIsReadOnly;
+
+ if ( !bDisable && bNeedTextComponent )
+ bDisable |= !m_xActiveTextComponent.is();
+
+ if ( !bDisable && bNeedSelection )
+ {
+ awt::Selection aSelection = m_xActiveTextComponent->getSelection();
+ bDisable |= aSelection.Min == aSelection.Max;
+ }
+
+ if ( bDisable )
+ _rSet.DisableItem( nSlot );
+ }
+
+ nSlot = aIter.NextWhich();
+ }
+ }
+
+ //------------------------------------------------------------------------
+ bool FmTextControlShell::IsActiveControl( bool _bCountRichTextOnly ) const
+ {
+ if ( _bCountRichTextOnly && !m_bActiveControlIsRichText )
+ return false;
+
+ return m_bActiveControl;
+ }
+
+ //------------------------------------------------------------------------
+ void FmTextControlShell::dispose()
+ {
+ if ( IsActiveControl() )
+ controlDeactivated();
+ if ( isControllerListening() )
+ stopControllerListening();
+ }
+
+ //------------------------------------------------------------------------
+ void FmTextControlShell::designModeChanged( bool /*_bNewDesignMode*/ )
+ {
+ m_rBindings.Invalidate( pTextControlSlots );
+ }
+
+ //------------------------------------------------------------------------
+ void FmTextControlShell::formActivated( const Reference< XFormController >& _rxController )
+ {
+#if OSL_DEBUG_LEVEL > 0
+ ::rtl::OString sTrace( "FmTextControlShell::formActivated: 0x" );
+ sTrace += ::rtl::OString::valueOf( (sal_IntPtr)_rxController.get(), 16 );
+ DBG_TRACE( sTrace );
+#endif
+
+ DBG_ASSERT( _rxController.is(), "FmTextControlShell::formActivated: invalid controller!" );
+ if ( !_rxController.is() )
+ return;
+
+ // sometimes, a form controller notifies activations, even if it's already activated
+ if ( m_xActiveController == _rxController )
+ return;
+
+ try
+ {
+ startControllerListening( _rxController );
+ controlActivated( _rxController->getCurrentControl() );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //------------------------------------------------------------------------
+ void FmTextControlShell::formDeactivated( const Reference< XFormController >& _rxController )
+ {
+#if OSL_DEBUG_LEVEL > 0
+ ::rtl::OString sTrace( "FmTextControlShell::formDeactivated: 0x" );
+ sTrace += ::rtl::OString::valueOf( (sal_IntPtr)_rxController.get(), 16 );
+ DBG_TRACE( sTrace );
+#endif
+ (void)_rxController;
+
+ if ( IsActiveControl() )
+ controlDeactivated();
+ if ( isControllerListening() )
+ stopControllerListening();
+ }
+
+ //------------------------------------------------------------------------
+ void FmTextControlShell::startControllerListening( const Reference< XFormController >& _rxController )
+ {
+ OSL_PRECOND( _rxController.is(), "FmTextControlShell::startControllerListening: invalid controller!" );
+ if ( !_rxController.is() )
+ return;
+
+ OSL_PRECOND( !isControllerListening(), "FmTextControlShell::startControllerListening: already listening!" );
+ if ( isControllerListening() )
+ stopControllerListening( );
+ DBG_ASSERT( !isControllerListening(), "FmTextControlShell::startControllerListening: inconsistence!" );
+
+ try
+ {
+ Sequence< Reference< XControl > > aControls( _rxController->getControls() );
+ m_aControlObservers.resize( 0 );
+ m_aControlObservers.reserve( aControls.getLength() );
+
+ const Reference< XControl >* pControls = aControls.getConstArray();
+ const Reference< XControl >* pControlsEnd = pControls + aControls.getLength();
+ for ( ; pControls != pControlsEnd; ++pControls )
+ {
+ m_aControlObservers.push_back( FocusListenerAdapter( new FmFocusListenerAdapter( *pControls, this ) ) );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ m_xActiveController = _rxController;
+ }
+
+ //------------------------------------------------------------------------
+ void FmTextControlShell::stopControllerListening( )
+ {
+ OSL_PRECOND( isControllerListening(), "FmTextControlShell::stopControllerListening: inconsistence!" );
+
+ // dispose all listeners associated with the controls of the active controller
+ for ( FocusListenerAdapters::iterator aLoop = m_aControlObservers.begin();
+ aLoop != m_aControlObservers.end();
+ ++aLoop
+ )
+ {
+ (*aLoop)->dispose();
+ }
+
+ FocusListenerAdapters aEmpty;
+ m_aControlObservers.swap( aEmpty );
+
+ m_xActiveController.clear();
+ }
+
+ //------------------------------------------------------------------------
+ void FmTextControlShell::implClearActiveControlRef()
+ {
+ // no more features for this control
+ for ( ControlFeatures::iterator aLoop = m_aControlFeatures.begin();
+ aLoop != m_aControlFeatures.end();
+ ++aLoop
+ )
+ {
+ aLoop->second->dispose();
+ }
+
+ ControlFeatures aEmpty;
+ m_aControlFeatures.swap( aEmpty );
+
+ if ( m_aContextMenuObserver.get() )
+ {
+ m_aContextMenuObserver->dispose();
+ m_aContextMenuObserver = MouseListenerAdapter();
+ }
+
+ if ( m_xActiveTextComponent.is() )
+ {
+ DBG_TRACE( "FmTextControlShell::ClipBoard: stopping timer for clipboard invalidation" );
+ m_aClipboardInvalidation.Stop();
+ }
+ // no more active control
+ m_xActiveControl.clear();
+ m_xActiveTextComponent.clear();
+ m_bActiveControlIsReadOnly = true;
+ m_bActiveControlIsRichText = false;
+ m_bActiveControl = false;
+ }
+
+ //------------------------------------------------------------------------
+ void FmTextControlShell::controlDeactivated( )
+ {
+ DBG_ASSERT( IsActiveControl(), "FmTextControlShell::controlDeactivated: no active control!" );
+
+ m_bActiveControl = false;
+
+ m_rBindings.Invalidate( pTextControlSlots );
+ }
+
+ //------------------------------------------------------------------------
+ void FmTextControlShell::controlActivated( const Reference< XControl >& _rxControl )
+ {
+ // ensure that all knittings with the previously active control are lost
+ if ( m_xActiveControl.is() )
+ implClearActiveControlRef();
+ DBG_ASSERT( m_aControlFeatures.empty(), "FmTextControlShell::controlActivated: should have no dispatchers when I'm here!" );
+
+#if OSL_DEBUG_LEVEL > 0
+ {
+ Sequence< Reference< XControl > > aActiveControls;
+ if ( m_xActiveController.is() )
+ aActiveControls = m_xActiveController->getControls();
+
+ bool bFoundThisControl = false;
+
+ const Reference< XControl >* pControls = aActiveControls.getConstArray();
+ const Reference< XControl >* pControlsEnd = pControls + aActiveControls.getLength();
+ for ( ; ( pControls != pControlsEnd ) && !bFoundThisControl; ++pControls )
+ {
+ if ( *pControls == _rxControl )
+ bFoundThisControl = true;
+ }
+ DBG_ASSERT( bFoundThisControl, "FmTextControlShell::controlActivated: only controls which belong to the active controller can be activated!" );
+ }
+#endif
+ // ask the control for dispatchers for our text-related slots
+ fillFeatureDispatchers( _rxControl, pTextControlSlots, m_aControlFeatures );
+
+ // remember this control
+ m_xActiveControl = _rxControl;
+ m_xActiveTextComponent = m_xActiveTextComponent.query( _rxControl );
+ m_bActiveControlIsReadOnly = lcl_determineReadOnly( m_xActiveControl );
+ m_bActiveControlIsRichText = lcl_isRichText( m_xActiveControl );
+
+ // if we found a rich text control, we need context menu support
+ if ( m_bActiveControlIsRichText )
+ {
+ DBG_ASSERT( NULL == m_aContextMenuObserver.get(), "FmTextControlShell::controlActivated: already have an observer!" );
+ m_aContextMenuObserver = MouseListenerAdapter( new FmMouseListenerAdapter( _rxControl, this ) );
+ }
+
+ if ( m_xActiveTextComponent.is() )
+ {
+ DBG_TRACE( "FmTextControlShell::ClipBoard: starting timer for clipboard invalidation" );
+ m_aClipboardInvalidation.Start();
+ }
+
+ m_bActiveControl = true;
+
+ m_rBindings.Invalidate( pTextControlSlots );
+
+ if ( m_pViewFrame )
+ m_pViewFrame->UIFeatureChanged();
+
+ // don't call the activation handler if we don't have any slots we can serve
+ // The activation handler is used to put the shell on the top of the dispatcher stack,
+ // so it's preferred when slots are distributed.
+ // Note that this is a slight hack, to prevent that we grab slots from the SfxDispatcher
+ // which should be served by other shells (e.g. Cut/Copy/Paste).
+ // A real solution would be a forwarding-mechanism for slots: We should be on the top
+ // if we're active, but if we cannot handle the slot, then we need to tell the dispatcher
+ // to skip our shell, and pass the slot to the next one. However, this mechanism is not
+ // not in place in SFX.
+ // Another possibility would be to have dedicated shells for the slots which we might
+ // or might not be able to serve. However, this could probably increase the number of
+ // shells too much (In theory, nearly every slot could have an own shell then).
+ //
+ // #i51621# / 2005-08-19 / frank.schoenheit@sun.com
+ bool bHaveAnyServeableSlots = m_xActiveTextComponent.is() || !m_aControlFeatures.empty();
+ if ( m_aControlActivationHandler.IsSet() && bHaveAnyServeableSlots )
+ m_aControlActivationHandler.Call( NULL );
+
+ m_bNeedClipboardInvalidation = true;
+ }
+
+ //------------------------------------------------------------------------
+ void FmTextControlShell::fillFeatureDispatchers( const Reference< XControl > _rxControl, SfxSlotId* _pZeroTerminatedSlots,
+ ControlFeatures& _rDispatchers )
+ {
+ Reference< XDispatchProvider > xProvider( _rxControl, UNO_QUERY );
+ SfxApplication* pApplication = SFX_APP();
+ DBG_ASSERT( pApplication, "FmTextControlShell::fillFeatureDispatchers: no SfxApplication!" );
+ if ( xProvider.is() && pApplication )
+ {
+ SfxSlotId* pSlots = _pZeroTerminatedSlots;
+ while ( *pSlots )
+ {
+ FmTextControlFeature* pDispatcher = implGetFeatureDispatcher( xProvider, pApplication, *pSlots );
+ if ( pDispatcher )
+ _rDispatchers.insert( ControlFeatures::value_type( *pSlots, ControlFeature( pDispatcher ) ) );
+
+ ++pSlots;
+ }
+ }
+ }
+
+ //------------------------------------------------------------------------
+ void FmTextControlShell::impl_parseURL_nothrow( URL& _rURL )
+ {
+ try
+ {
+ if ( !m_xURLTransformer.is() )
+ {
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ aContext.createComponent( "com.sun.star.util.URLTransformer", m_xURLTransformer );
+ }
+ if ( m_xURLTransformer.is() )
+ m_xURLTransformer->parseStrict( _rURL );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //------------------------------------------------------------------------
+ FmTextControlFeature* FmTextControlShell::implGetFeatureDispatcher( const Reference< XDispatchProvider >& _rxProvider, SfxApplication* _pApplication, SfxSlotId _nSlot )
+ {
+ OSL_PRECOND( _rxProvider.is() && _pApplication, "FmTextControlShell::implGetFeatureDispatcher: invalid arg(s)!" );
+ URL aFeatureURL;
+ aFeatureURL.Complete = lcl_getUnoSlotName( *_pApplication, _nSlot );
+ impl_parseURL_nothrow( aFeatureURL );
+ Reference< XDispatch > xDispatcher = _rxProvider->queryDispatch( aFeatureURL, ::rtl::OUString(), 0xFF );
+ if ( xDispatcher.is() )
+ return new FmTextControlFeature( xDispatcher, aFeatureURL, _nSlot, this );
+ return NULL;
+ }
+
+ //------------------------------------------------------------------------
+ void FmTextControlShell::Invalidate( SfxSlotId _nSlot )
+ {
+ m_rBindings.Invalidate( _nSlot );
+ // despite this method being called "Invalidate", we also update here - this gives more immediate
+ // feedback in the UI
+ m_rBindings.Update( _nSlot );
+ }
+
+ //------------------------------------------------------------------------
+ void FmTextControlShell::focusGained( const ::com::sun::star::awt::FocusEvent& _rEvent )
+ {
+ Reference< XControl > xControl( _rEvent.Source, UNO_QUERY );
+
+#if OSL_DEBUG_LEVEL > 0
+ ::rtl::OString sTrace( "FmTextControlShell::focusGained: 0x" );
+ sTrace += ::rtl::OString::valueOf( (sal_IntPtr)xControl.get(), 16 );
+ DBG_TRACE( sTrace );
+#endif
+
+ DBG_ASSERT( xControl.is(), "FmTextControlShell::focusGained: suspicious focus event!" );
+ if ( xControl.is() )
+ controlActivated( xControl );
+ }
+
+ //------------------------------------------------------------------------
+ void FmTextControlShell::focusLost( const ::com::sun::star::awt::FocusEvent& _rEvent )
+ {
+ Reference< XControl > xControl( _rEvent.Source, UNO_QUERY );
+
+#if OSL_DEBUG_LEVEL > 0
+ ::rtl::OString sTrace( "FmTextControlShell::focusLost: 0x" );
+ sTrace += ::rtl::OString::valueOf( (sal_IntPtr)xControl.get(), 16 );
+ DBG_TRACE( sTrace );
+#endif
+
+ m_bActiveControl = false;
+ }
+
+ //------------------------------------------------------------------------
+ void FmTextControlShell::ForgetActiveControl()
+ {
+ implClearActiveControlRef();
+ }
+
+ //------------------------------------------------------------------------
+ void FmTextControlShell::contextMenuRequested( const awt::MouseEvent& /*_rEvent*/ )
+ {
+ m_rBindings.GetDispatcher()->ExecutePopup( SVX_RES( RID_FM_TEXTATTRIBUTE_MENU ) );
+ }
+
+//........................................................................
+} // namespace svx
+//........................................................................
diff --git a/svx/source/form/fmtools.cxx b/svx/source/form/fmtools.cxx
new file mode 100644
index 000000000000..460d2e1cd787
--- /dev/null
+++ b/svx/source/form/fmtools.cxx
@@ -0,0 +1,496 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "fmprop.hrc"
+#include "fmservs.hxx"
+#include "svx/fmtools.hxx"
+#include "svx/dbtoolsclient.hxx"
+#include "svx/fmglob.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/LineEndFormat.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/beans/XIntrospection.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/form/XForm.hpp>
+#include <com/sun/star/form/XFormComponent.hpp>
+#include <com/sun/star/form/XGridColumnFactory.hpp>
+#include <com/sun/star/io/XActiveDataSink.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/io/XObjectInputStream.hpp>
+#include <com/sun/star/io/XObjectOutputStream.hpp>
+#include <com/sun/star/io/XPersistObject.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/sdb/ErrorCondition.hpp>
+#include <com/sun/star/sdb/SQLContext.hpp>
+#include <com/sun/star/sdb/XCompletedConnection.hpp>
+#include <com/sun/star/sdb/XQueriesSupplier.hpp>
+#include <com/sun/star/sdb/XResultSetAccess.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/XDataSource.hpp>
+#include <com/sun/star/sdbcx/Privilege.hpp>
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/uno/XNamingService.hpp>
+#include <com/sun/star/util/Language.hpp>
+#include <com/sun/star/util/NumberFormat.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/util/XNumberFormatTypes.hpp>
+#include <com/sun/star/util/XNumberFormats.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+/** === end UNO includes === **/
+
+#include <basic/sbxvar.hxx>
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+#include <comphelper/container.hxx>
+#include <comphelper/extract.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/property.hxx>
+#include <comphelper/sequence.hxx>
+#include <comphelper/types.hxx>
+#include <comphelper/uno3.hxx>
+#include <connectivity/dbexception.hxx>
+#include <connectivity/dbtools.hxx>
+#include <cppuhelper/servicefactory.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/logfile.hxx>
+#include <rtl/math.hxx>
+#include <sfx2/bindings.hxx>
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+#include <toolkit/unohlp.hxx>
+#include <tools/debug.hxx>
+#include <tools/string.hxx>
+#include <vcl/stdtext.hxx>
+#include <vcl/svapp.hxx>
+
+#include <algorithm>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::task;
+using namespace ::com::sun::star::form;
+using namespace ::svxform;
+using namespace ::connectivity::simple;
+
+// ------------------------------------------------------------------------------
+namespace
+{
+ static bool lcl_shouldDisplayError( const Any& _rError )
+ {
+ SQLException aError;
+ if ( !( _rError >>= aError ) )
+ return true;
+
+ if ( aError.Message.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "[OOoBase]" ) ) != 0 )
+ // it is an exception *not* thrown by an OOo Base core component
+ return true;
+
+ // the only exception we do not display ATM is a RowSetVetoException, which
+ // has been raised because an XRowSetApprovalListener vetoed a change
+ if ( aError.ErrorCode + ErrorCondition::ROW_SET_OPERATION_VETOED == 0 )
+ return false;
+
+ // everything else is to be displayed
+ return true;
+ }
+}
+
+// ------------------------------------------------------------------------------
+void displayException(const Any& _rExcept, Window* _pParent)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "fmtools::displayException" );
+ // check whether we need to display it
+ if ( !lcl_shouldDisplayError( _rExcept ) )
+ return;
+
+ try
+ {
+ // the parent window
+ Window* pParentWindow = _pParent ? _pParent : GetpApp()->GetDefDialogParent();
+ Reference< XWindow > xParentWindow = VCLUnoHelper::GetInterface(pParentWindow);
+
+ Sequence< Any > aArgs(2);
+ aArgs[0] <<= PropertyValue(::rtl::OUString::createFromAscii("SQLException"), 0, _rExcept, PropertyState_DIRECT_VALUE);
+ aArgs[1] <<= PropertyValue(::rtl::OUString::createFromAscii("ParentWindow"), 0, makeAny(xParentWindow), PropertyState_DIRECT_VALUE);
+
+ static ::rtl::OUString s_sDialogServiceName = ::rtl::OUString::createFromAscii("com.sun.star.sdb.ErrorMessageDialog");
+ Reference< XExecutableDialog > xErrorDialog(
+ ::comphelper::getProcessServiceFactory()->createInstanceWithArguments(s_sDialogServiceName, aArgs), UNO_QUERY);
+ if (xErrorDialog.is())
+ xErrorDialog->execute();
+ else
+ ShowServiceNotAvailableError(pParentWindow, s_sDialogServiceName, sal_True);
+ }
+ catch(Exception&)
+ {
+ OSL_ENSURE(sal_False, "displayException: could not display the error message!");
+ }
+}
+
+// ------------------------------------------------------------------------------
+void displayException(const ::com::sun::star::sdbc::SQLException& _rExcept, Window* _pParent)
+{
+ displayException(makeAny(_rExcept), _pParent);
+}
+
+// ------------------------------------------------------------------------------
+void displayException(const ::com::sun::star::sdbc::SQLWarning& _rExcept, Window* _pParent)
+{
+ displayException(makeAny(_rExcept), _pParent);
+}
+
+// ------------------------------------------------------------------------------
+void displayException(const ::com::sun::star::sdb::SQLContext& _rExcept, Window* _pParent)
+{
+ displayException(makeAny(_rExcept), _pParent);
+}
+
+// ------------------------------------------------------------------------------
+void displayException(const ::com::sun::star::sdb::SQLErrorEvent& _rEvent, Window* _pParent)
+{
+ displayException(_rEvent.Reason, _pParent);
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 getElementPos(const Reference< ::com::sun::star::container::XIndexAccess>& xCont, const Reference< XInterface >& xElement)
+{
+ sal_Int32 nIndex = -1;
+ if (!xCont.is())
+ return nIndex;
+
+
+ Reference< XInterface > xNormalized( xElement, UNO_QUERY );
+ DBG_ASSERT( xNormalized.is(), "getElementPos: invalid element!" );
+ if ( xNormalized.is() )
+ {
+ // Feststellen an welcher Position sich das Kind befindet
+ nIndex = xCont->getCount();
+ while (nIndex--)
+ {
+ try
+ {
+ Reference< XInterface > xCurrent(xCont->getByIndex( nIndex ),UNO_QUERY);
+ DBG_ASSERT( xCurrent.get() == Reference< XInterface >( xCurrent, UNO_QUERY ).get(),
+ "getElementPos: container element not normalized!" );
+ if ( xNormalized.get() == xCurrent.get() )
+ break;
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR( "getElementPos: caught an exception!" );
+ }
+
+ }
+ }
+ return nIndex;
+}
+
+//------------------------------------------------------------------
+::rtl::OUString getLabelName(const Reference< ::com::sun::star::beans::XPropertySet>& xControlModel)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "fmtools::getLabelName" );
+ if (!xControlModel.is())
+ return ::rtl::OUString();
+
+ if (::comphelper::hasProperty(FM_PROP_CONTROLLABEL, xControlModel))
+ {
+ Reference< ::com::sun::star::beans::XPropertySet> xLabelSet;
+ xControlModel->getPropertyValue(FM_PROP_CONTROLLABEL) >>= xLabelSet;
+ if (xLabelSet.is() && ::comphelper::hasProperty(FM_PROP_LABEL, xLabelSet))
+ {
+ Any aLabel( xLabelSet->getPropertyValue(FM_PROP_LABEL) );
+ if ((aLabel.getValueTypeClass() == TypeClass_STRING) && ::comphelper::getString(aLabel).getLength())
+ return ::comphelper::getString(aLabel);
+ }
+ }
+
+ return ::comphelper::getString(xControlModel->getPropertyValue(FM_PROP_CONTROLSOURCE));
+}
+
+//========================================================================
+// = CursorWrapper
+//------------------------------------------------------------------------
+CursorWrapper::CursorWrapper(const Reference< ::com::sun::star::sdbc::XRowSet>& _rxCursor, sal_Bool bUseCloned)
+{
+ ImplConstruct(Reference< ::com::sun::star::sdbc::XResultSet>(_rxCursor, UNO_QUERY), bUseCloned);
+}
+
+//------------------------------------------------------------------------
+CursorWrapper::CursorWrapper(const Reference< ::com::sun::star::sdbc::XResultSet>& _rxCursor, sal_Bool bUseCloned)
+{
+ ImplConstruct(_rxCursor, bUseCloned);
+}
+
+//------------------------------------------------------------------------
+void CursorWrapper::ImplConstruct(const Reference< ::com::sun::star::sdbc::XResultSet>& _rxCursor, sal_Bool bUseCloned)
+{
+ if (bUseCloned)
+ {
+ Reference< ::com::sun::star::sdb::XResultSetAccess> xAccess(_rxCursor, UNO_QUERY);
+ try
+ {
+ m_xMoveOperations = xAccess.is() ? xAccess->createResultSet() : Reference< ::com::sun::star::sdbc::XResultSet>();
+ }
+ catch(Exception&)
+ {
+ }
+ }
+ else
+ m_xMoveOperations = _rxCursor;
+
+ m_xBookmarkOperations = m_xBookmarkOperations.query( m_xMoveOperations );
+ m_xColumnsSupplier = m_xColumnsSupplier.query( m_xMoveOperations );
+ m_xPropertyAccess = m_xPropertyAccess.query( m_xMoveOperations );
+
+ if ( !m_xMoveOperations.is() || !m_xBookmarkOperations.is() || !m_xColumnsSupplier.is() || !m_xPropertyAccess.is() )
+ { // all or nothing !!
+ m_xMoveOperations = NULL;
+ m_xBookmarkOperations = NULL;
+ m_xColumnsSupplier = NULL;
+ }
+ else
+ m_xGeneric = m_xMoveOperations.get();
+}
+
+//------------------------------------------------------------------------
+const CursorWrapper& CursorWrapper::operator=(const Reference< ::com::sun::star::sdbc::XRowSet>& _rxCursor)
+{
+ m_xMoveOperations = Reference< ::com::sun::star::sdbc::XResultSet>(_rxCursor, UNO_QUERY);
+ m_xBookmarkOperations = Reference< ::com::sun::star::sdbcx::XRowLocate>(_rxCursor, UNO_QUERY);
+ m_xColumnsSupplier = Reference< ::com::sun::star::sdbcx::XColumnsSupplier>(_rxCursor, UNO_QUERY);
+ if (!m_xMoveOperations.is() || !m_xBookmarkOperations.is() || !m_xColumnsSupplier.is())
+ { // all or nothing !!
+ m_xMoveOperations = NULL;
+ m_xBookmarkOperations = NULL;
+ m_xColumnsSupplier = NULL;
+ }
+ return *this;
+}
+
+//------------------------------------------------------------------------------
+FmXDisposeListener::~FmXDisposeListener()
+{
+ setAdapter(NULL);
+}
+
+//------------------------------------------------------------------------------
+void FmXDisposeListener::setAdapter(FmXDisposeMultiplexer* pAdapter)
+{
+ if (m_pAdapter)
+ {
+ ::osl::MutexGuard aGuard(m_rMutex);
+ m_pAdapter->release();
+ m_pAdapter = NULL;
+ }
+
+ if (pAdapter)
+ {
+ ::osl::MutexGuard aGuard(m_rMutex);
+ m_pAdapter = pAdapter;
+ m_pAdapter->acquire();
+ }
+}
+
+//==============================================================================
+DBG_NAME(FmXDisposeMultiplexer);
+//------------------------------------------------------------------------------
+FmXDisposeMultiplexer::FmXDisposeMultiplexer(FmXDisposeListener* _pListener, const Reference< ::com::sun::star::lang::XComponent>& _rxObject, sal_Int16 _nId)
+ :m_xObject(_rxObject)
+ ,m_pListener(_pListener)
+ ,m_nId(_nId)
+{
+ DBG_CTOR(FmXDisposeMultiplexer, NULL);
+ m_pListener->setAdapter(this);
+
+ if (m_xObject.is())
+ m_xObject->addEventListener(this);
+}
+
+//------------------------------------------------------------------------------
+FmXDisposeMultiplexer::~FmXDisposeMultiplexer()
+{
+ DBG_DTOR(FmXDisposeMultiplexer, NULL);
+}
+
+// ::com::sun::star::lang::XEventListener
+//------------------------------------------------------------------
+void FmXDisposeMultiplexer::disposing(const ::com::sun::star::lang::EventObject& _Source) throw( RuntimeException )
+{
+ Reference< ::com::sun::star::lang::XEventListener> xPreventDelete(this);
+
+ if (m_pListener)
+ {
+ m_pListener->disposing(_Source, m_nId);
+ m_pListener->setAdapter(NULL);
+ m_pListener = NULL;
+ }
+ m_xObject = NULL;
+}
+
+//------------------------------------------------------------------
+void FmXDisposeMultiplexer::dispose()
+{
+ if (m_xObject.is())
+ {
+ Reference< ::com::sun::star::lang::XEventListener> xPreventDelete(this);
+
+ m_xObject->removeEventListener(this);
+ m_xObject = NULL;
+
+ m_pListener->setAdapter(NULL);
+ m_pListener = NULL;
+ }
+}
+
+//==============================================================================
+//------------------------------------------------------------------------------
+sal_Int16 getControlTypeByObject(const Reference< ::com::sun::star::lang::XServiceInfo>& _rxObject)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "fmtools::getControlTypeByObject" );
+ // ask for the persistent service name
+ Reference< ::com::sun::star::io::XPersistObject> xPersistence(_rxObject, UNO_QUERY);
+ DBG_ASSERT(xPersistence.is(), "::getControlTypeByObject : argument shold be an ::com::sun::star::io::XPersistObject !");
+ if (!xPersistence.is())
+ return OBJ_FM_CONTROL;
+
+ ::rtl::OUString sPersistentServiceName = xPersistence->getServiceName();
+ if (sPersistentServiceName.equals(FM_COMPONENT_EDIT)) // 5.0-Name
+ {
+ // may be a simple edit field or a formatted field, dependent of the supported services
+ if (_rxObject->supportsService(FM_SUN_COMPONENT_FORMATTEDFIELD))
+ return OBJ_FM_FORMATTEDFIELD;
+ return OBJ_FM_EDIT;
+ }
+ if (sPersistentServiceName.equals(FM_COMPONENT_TEXTFIELD))
+ return OBJ_FM_EDIT;
+ if (sPersistentServiceName.equals(FM_COMPONENT_COMMANDBUTTON))
+ return OBJ_FM_BUTTON;
+ if (sPersistentServiceName.equals(FM_COMPONENT_FIXEDTEXT))
+ return OBJ_FM_FIXEDTEXT;
+ if (sPersistentServiceName.equals(FM_COMPONENT_LISTBOX))
+ return OBJ_FM_LISTBOX;
+ if (sPersistentServiceName.equals(FM_COMPONENT_CHECKBOX))
+ return OBJ_FM_CHECKBOX;
+ if (sPersistentServiceName.equals(FM_COMPONENT_RADIOBUTTON))
+ return OBJ_FM_RADIOBUTTON;
+ if (sPersistentServiceName.equals(FM_COMPONENT_GROUPBOX))
+ return OBJ_FM_GROUPBOX;
+ if (sPersistentServiceName.equals(FM_COMPONENT_COMBOBOX))
+ return OBJ_FM_COMBOBOX;
+ if (sPersistentServiceName.equals(FM_COMPONENT_GRID)) // 5.0-Name
+ return OBJ_FM_GRID;
+ if (sPersistentServiceName.equals(FM_COMPONENT_GRIDCONTROL))
+ return OBJ_FM_GRID;
+ if (sPersistentServiceName.equals(FM_COMPONENT_IMAGEBUTTON))
+ return OBJ_FM_IMAGEBUTTON;
+ if (sPersistentServiceName.equals(FM_COMPONENT_FILECONTROL))
+ return OBJ_FM_FILECONTROL;
+ if (sPersistentServiceName.equals(FM_COMPONENT_DATEFIELD))
+ return OBJ_FM_DATEFIELD;
+ if (sPersistentServiceName.equals(FM_COMPONENT_TIMEFIELD))
+ return OBJ_FM_TIMEFIELD;
+ if (sPersistentServiceName.equals(FM_COMPONENT_NUMERICFIELD))
+ return OBJ_FM_NUMERICFIELD;
+ if (sPersistentServiceName.equals(FM_COMPONENT_CURRENCYFIELD))
+ return OBJ_FM_CURRENCYFIELD;
+ if (sPersistentServiceName.equals(FM_COMPONENT_PATTERNFIELD))
+ return OBJ_FM_PATTERNFIELD;
+ if (sPersistentServiceName.equals(FM_COMPONENT_HIDDEN)) // 5.0-Name
+ return OBJ_FM_HIDDEN;
+ if (sPersistentServiceName.equals(FM_COMPONENT_HIDDENCONTROL))
+ return OBJ_FM_HIDDEN;
+ if (sPersistentServiceName.equals(FM_COMPONENT_IMAGECONTROL))
+ return OBJ_FM_IMAGECONTROL;
+ if (sPersistentServiceName.equals(FM_COMPONENT_FORMATTEDFIELD))
+ {
+ DBG_ERROR("::getControlTypeByObject : suspicious persistent service name (formatted field) !");
+ // objects with that service name should exist as they aren't compatible with older versions
+ return OBJ_FM_FORMATTEDFIELD;
+ }
+ if ( sPersistentServiceName.equals( FM_SUN_COMPONENT_SCROLLBAR ) )
+ return OBJ_FM_SCROLLBAR;
+ if ( sPersistentServiceName.equals( FM_SUN_COMPONENT_SPINBUTTON) )
+ return OBJ_FM_SPINBUTTON;
+ if (sPersistentServiceName.equals(FM_SUN_COMPONENT_NAVIGATIONBAR))
+ return OBJ_FM_NAVIGATIONBAR;
+
+ DBG_ERROR("::getControlTypeByObject : unknown object type !");
+ return OBJ_FM_CONTROL;
+}
+
+//------------------------------------------------------------------------------
+void setConnection(const Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet, const Reference< ::com::sun::star::sdbc::XConnection>& _rxConn)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "fmtools::setConnection" );
+ Reference< ::com::sun::star::beans::XPropertySet> xRowSetProps(_rxRowSet, UNO_QUERY);
+ if (xRowSetProps.is())
+ {
+ try
+ {
+ Any aConn(makeAny(_rxConn));
+ xRowSetProps->setPropertyValue(FM_PROP_ACTIVE_CONNECTION, aConn);
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("::setConnection : could not set the connection !");
+ }
+
+ }
+}
+//------------------------------------------------------------------------------
+sal_Bool isRowSetAlive(const Reference< XInterface >& _rxRowSet)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "fmtools::isRowSetAlive" );
+ sal_Bool bIsAlive = sal_False;
+ Reference< ::com::sun::star::sdbcx::XColumnsSupplier> xSupplyCols(_rxRowSet, UNO_QUERY);
+ Reference< ::com::sun::star::container::XIndexAccess> xCols;
+ if (xSupplyCols.is())
+ xCols = Reference< ::com::sun::star::container::XIndexAccess>(xSupplyCols->getColumns(), UNO_QUERY);
+ if (xCols.is() && (xCols->getCount() > 0))
+ bIsAlive = sal_True;
+
+ return bIsAlive;
+}
+
diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx
new file mode 100644
index 000000000000..eee61c5c2dee
--- /dev/null
+++ b/svx/source/form/fmundo.cxx
@@ -0,0 +1,1349 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "fmundo.hxx"
+#include "fmpgeimp.hxx"
+#include "svx/dbtoolsclient.hxx"
+#include "svx/svditer.hxx"
+#include "fmobj.hxx"
+#include "fmprop.hrc"
+#include "svx/fmresids.hrc"
+#include "svx/fmglob.hxx"
+#include "svx/dialmgr.hxx"
+#include "svx/fmmodel.hxx"
+#include "svx/fmpage.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/container/XContainer.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <com/sun/star/script/XEventAttacherManager.hpp>
+#include <com/sun/star/form/binding/XBindableValue.hpp>
+#include <com/sun/star/form/binding/XListEntrySink.hpp>
+#include <com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp>
+/** === end UNO includes === **/
+
+#include "svx/fmtools.hxx"
+#include <rtl/logfile.hxx>
+#include <svl/macitem.hxx>
+#include <tools/shl.hxx>
+#include <tools/diagnose_ex.h>
+#include <sfx2/objsh.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/sfx.hrc>
+#include <sfx2/event.hxx>
+#include <osl/mutex.hxx>
+#include <vos/mutex.hxx>
+#include <comphelper/property.hxx>
+#include <comphelper/uno3.hxx>
+#include <comphelper/stl_types.hxx>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::script;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::form;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::reflection;
+using namespace ::com::sun::star::form::binding;
+using namespace ::svxform;
+
+
+#include <com/sun/star/script/XScriptListener.hdl>
+#include <comphelper/processfactory.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+typedef cppu::WeakImplHelper1< XScriptListener > ScriptEventListener_BASE;
+class ScriptEventListenerWrapper : public ScriptEventListener_BASE
+{
+public:
+ ScriptEventListenerWrapper( FmFormModel& _rModel) throw ( RuntimeException ) : pModel(&_rModel)
+ {
+
+ }
+ // XEventListener
+ virtual void SAL_CALL disposing(const EventObject& ) throw( RuntimeException ){}
+
+ // XScriptListener
+ virtual void SAL_CALL firing(const ScriptEvent& evt) throw(RuntimeException)
+ {
+ setModel();
+ if ( m_vbaListener.is() )
+ {
+ m_vbaListener->firing( evt );
+ }
+ }
+
+ virtual Any SAL_CALL approveFiring(const ScriptEvent& evt) throw( com::sun::star::reflection::InvocationTargetException, RuntimeException)
+ {
+ setModel();
+ if ( m_vbaListener.is() )
+ {
+ return m_vbaListener->approveFiring( evt );
+ }
+ return Any();
+ }
+
+private:
+ void setModel()
+ {
+ if ( !m_vbaListener.is() )
+ {
+ Reference < XPropertySet > xProps(
+ ::comphelper::getProcessServiceFactory(), UNO_QUERY );
+ if ( xProps.is() )
+ {
+ Reference< XComponentContext > xCtx( xProps->getPropertyValue(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY );
+ if ( xCtx.is() )
+ {
+ Reference< XMultiComponentFactory > xMFac(
+ xCtx->getServiceManager(), UNO_QUERY );
+
+ // SfxObjectShellRef is good here since the model controls the lifetime of the shell
+ SfxObjectShellRef xObjSh = pModel->GetObjectShell();
+ Reference< XMultiServiceFactory > xDocFac;
+ if ( xObjSh.Is() )
+ xDocFac.set( xObjSh->GetModel(), UNO_QUERY );
+
+ if ( xMFac.is() )
+ {
+ m_vbaListener.set( xMFac->createInstanceWithContext(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "ooo.vba.EventListener" ) ), xCtx ),
+ UNO_QUERY_THROW );
+ }
+ }
+ }
+ }
+ Reference< XPropertySet > xProps( m_vbaListener, UNO_QUERY );
+ if ( xProps.is() )
+ {
+ try
+ {
+ // SfxObjectShellRef is good here since the model controls the lifetime of the shell
+ SfxObjectShellRef xObjSh = pModel->GetObjectShell();
+ if ( xObjSh.Is() && m_vbaListener.is() )
+ {
+ Any aVal;
+ aVal <<= xObjSh->GetModel();
+ xProps->setPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) ),
+ aVal );
+ }
+ }
+ catch( Exception& )
+ {
+ //swallow any errors
+ }
+ }
+ }
+ FmFormModel* pModel;
+ Reference< XScriptListener > m_vbaListener;
+
+
+};
+
+//------------------------------------------------------------------------------
+// some helper structs for caching property infos
+//------------------------------------------------------------------------------
+struct PropertyInfo
+{
+ sal_Bool bIsTransientOrReadOnly : 1; // the property is transient or read-only, thus we need no undo action for it
+ sal_Bool bIsValueProperty : 1; // the property is the special value property, thus it may be handled
+ // as if it's transient or persistent
+};
+
+struct PropertySetInfo
+{
+ DECLARE_STL_USTRINGACCESS_MAP(PropertyInfo, AllProperties);
+
+ AllProperties aProps; // all properties of this set which we know so far
+ sal_Bool bHasEmptyControlSource; // sal_True -> the set has a DataField property, and the current value is an empty string
+ // sal_False -> the set has _no_ such property or it's value isn't empty
+};
+
+sal_Bool operator < (const Reference< XPropertySet >& lhs,
+ const Reference< XPropertySet >& rhs)
+{
+ return lhs.get() < rhs.get();
+}
+
+DECLARE_STL_STDKEY_MAP(Reference< XPropertySet >, PropertySetInfo, PropertySetInfoCache);
+
+//------------------------------------------------------------------------------
+
+String static_STR_UNDO_PROPERTY;
+//------------------------------------------------------------------------------
+DBG_NAME(FmXUndoEnvironment)
+//------------------------------------------------------------------------------
+FmXUndoEnvironment::FmXUndoEnvironment(FmFormModel& _rModel)
+ :rModel( _rModel )
+ ,m_pPropertySetCache( NULL )
+ ,m_pScriptingEnv( ::svxform::createDefaultFormScriptingEnvironment( _rModel ) )
+ ,m_Locks( 0 )
+ ,bReadOnly( sal_False )
+ ,m_bDisposed( false )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXUndoEnvironment::FmXUndoEnvironment" );
+ DBG_CTOR(FmXUndoEnvironment,NULL);
+ try
+ {
+ m_vbaListener = new ScriptEventListenerWrapper( _rModel );
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+//------------------------------------------------------------------------------
+FmXUndoEnvironment::~FmXUndoEnvironment()
+{
+ DBG_DTOR(FmXUndoEnvironment,NULL);
+ if (m_pPropertySetCache)
+ delete static_cast<PropertySetInfoCache*>(m_pPropertySetCache);
+}
+
+//------------------------------------------------------------------------------
+void FmXUndoEnvironment::dispose()
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXUndoEnvironment::dispose" );
+ OSL_ENSURE( !m_bDisposed, "FmXUndoEnvironment::dispose: disposed twice?" );
+ if ( !m_bDisposed )
+ return;
+
+ Lock();
+
+ sal_uInt16 nCount = rModel.GetPageCount();
+ sal_uInt16 i;
+ for (i = 0; i < nCount; i++)
+ {
+ FmFormPage* pPage = PTR_CAST( FmFormPage, rModel.GetPage(i) );
+ if ( pPage )
+ {
+ Reference< XInterface > xForms = pPage->GetForms( false ).get();
+ if ( xForms.is() )
+ RemoveElement( xForms );
+ }
+ }
+
+ nCount = rModel.GetMasterPageCount();
+ for (i = 0; i < nCount; i++)
+ {
+ FmFormPage* pPage = PTR_CAST( FmFormPage, rModel.GetMasterPage(i) );
+ if ( pPage )
+ {
+ Reference< XInterface > xForms = pPage->GetForms( false ).get();
+ if ( xForms.is() )
+ RemoveElement( xForms );
+ }
+ }
+
+ UnLock();
+
+ OSL_PRECOND( rModel.GetObjectShell(), "FmXUndoEnvironment::dispose: no object shell anymore!" );
+ if ( rModel.GetObjectShell() )
+ EndListening( *rModel.GetObjectShell() );
+
+ if ( IsListening( rModel ) )
+ EndListening( rModel );
+
+ m_pScriptingEnv->dispose();
+
+ m_bDisposed = true;
+}
+
+//------------------------------------------------------------------------------
+void FmXUndoEnvironment::ModeChanged()
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXUndoEnvironment::ModeChanged" );
+ OSL_PRECOND( rModel.GetObjectShell(), "FmXUndoEnvironment::ModeChanged: no object shell anymore!" );
+ if ( !rModel.GetObjectShell() )
+ return;
+
+ if (bReadOnly != (rModel.GetObjectShell()->IsReadOnly() || rModel.GetObjectShell()->IsReadOnlyUI()))
+ {
+ bReadOnly = !bReadOnly;
+
+ sal_uInt16 nCount = rModel.GetPageCount();
+ sal_uInt16 i;
+ for (i = 0; i < nCount; i++)
+ {
+ FmFormPage* pPage = PTR_CAST( FmFormPage, rModel.GetPage(i) );
+ if ( pPage )
+ {
+ Reference< XInterface > xForms = pPage->GetForms( false ).get();
+ if ( xForms.is() )
+ TogglePropertyListening( xForms );
+ }
+ }
+
+ nCount = rModel.GetMasterPageCount();
+ for (i = 0; i < nCount; i++)
+ {
+ FmFormPage* pPage = PTR_CAST( FmFormPage, rModel.GetMasterPage(i) );
+ if ( pPage )
+ {
+ Reference< XInterface > xForms = pPage->GetForms( false ).get();
+ if ( xForms.is() )
+ TogglePropertyListening( xForms );
+ }
+ }
+
+ if (!bReadOnly)
+ StartListening(rModel);
+ else
+ EndListening(rModel);
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXUndoEnvironment::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXUndoEnvironment::Notify" );
+ if (rHint.ISA(SdrHint))
+ {
+ SdrHint* pSdrHint = (SdrHint*)&rHint;
+ switch( pSdrHint->GetKind() )
+ {
+ case HINT_OBJINSERTED:
+ {
+ SdrObject* pSdrObj = (SdrObject*)pSdrHint->GetObject();
+ Inserted( pSdrObj );
+ } break;
+ case HINT_OBJREMOVED:
+ {
+ SdrObject* pSdrObj = (SdrObject*)pSdrHint->GetObject();
+ Removed( pSdrObj );
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ else if (rHint.ISA(SfxSimpleHint))
+ {
+ switch ( ((SfxSimpleHint&)rHint).GetId() )
+ {
+ case SFX_HINT_DYING:
+ dispose();
+ rModel.SetObjectShell( NULL );
+ break;
+ case SFX_HINT_MODECHANGED:
+ ModeChanged();
+ break;
+ }
+ }
+ else if (rHint.ISA(SfxEventHint))
+ {
+ switch (((SfxEventHint&)rHint).GetEventId())
+ {
+ case SFX_EVENT_CREATEDOC:
+ case SFX_EVENT_OPENDOC:
+ ModeChanged();
+ break;
+ }
+ }
+
+}
+
+//------------------------------------------------------------------
+void FmXUndoEnvironment::Inserted(SdrObject* pObj)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXUndoEnvironment::Inserted" );
+ if (pObj->GetObjInventor() == FmFormInventor)
+ {
+ FmFormObj* pFormObj = PTR_CAST(FmFormObj, pObj);
+ Inserted( pFormObj );
+ }
+ else if (pObj->IsGroupObject())
+ {
+ SdrObjListIter aIter(*pObj->GetSubList());
+ while ( aIter.IsMore() )
+ Inserted( aIter.Next() );
+ }
+}
+
+//------------------------------------------------------------------------------
+namespace
+{
+ sal_Bool lcl_searchElement(const Reference< XIndexAccess>& xCont, const Reference< XInterface >& xElement)
+ {
+ if (!xCont.is() || !xElement.is())
+ return sal_False;
+
+ sal_Int32 nCount = xCont->getCount();
+ Reference< XInterface > xComp;
+ for (sal_Int32 i = 0; i < nCount; i++)
+ {
+ try
+ {
+ xCont->getByIndex(i) >>= xComp;
+ if (xComp.is())
+ {
+ if ( xElement == xComp )
+ return sal_True;
+ else
+ {
+ Reference< XIndexAccess> xCont2(xComp, UNO_QUERY);
+ if (xCont2.is() && lcl_searchElement(xCont2, xElement))
+ return sal_True;
+ }
+ }
+ }
+ catch(const Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ return sal_False;
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXUndoEnvironment::Inserted(FmFormObj* pObj)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXUndoEnvironment::Inserted" );
+ DBG_ASSERT( pObj, "FmXUndoEnvironment::Inserted: invalid object!" );
+ if ( !pObj )
+ return;
+
+ // ist das Control noch einer Form zugeordnet
+ Reference< XInterface > xModel(pObj->GetUnoControlModel(), UNO_QUERY);
+ Reference< XFormComponent > xContent(xModel, UNO_QUERY);
+ if (xContent.is() && pObj->GetPage())
+ {
+ // if the component doesn't belong to a form, yet, find one to insert into
+ if (!xContent->getParent().is())
+ {
+ try
+ {
+ Reference< XIndexContainer > xObjectParent = pObj->GetOriginalParent();
+
+ FmFormPage& rPage = dynamic_cast< FmFormPage& >( *pObj->GetPage() );
+ Reference< XIndexAccess > xForms( rPage.GetForms(), UNO_QUERY_THROW );
+
+ Reference< XIndexContainer > xNewParent;
+ Reference< XForm > xForm;
+ sal_Int32 nPos = -1;
+ if ( lcl_searchElement( xForms, xObjectParent ) )
+ {
+ // the form which was the parent of the object when it was removed is still
+ // part of the form component hierachy of the current page
+ xNewParent = xObjectParent;
+ xForm.set( xNewParent, UNO_QUERY_THROW );
+ nPos = ::std::min( pObj->GetOriginalIndex(), xNewParent->getCount() );
+ }
+ else
+ {
+ xForm.set( rPage.GetImpl().findPlaceInFormComponentHierarchy( xContent ), UNO_SET_THROW );
+ xNewParent.set( xForm, UNO_QUERY_THROW );
+ nPos = xNewParent->getCount();
+ }
+
+ rPage.GetImpl().setUniqueName( xContent, xForm );
+ xNewParent->insertByIndex( nPos, makeAny( xContent ) );
+
+ Reference< XEventAttacherManager > xManager( xNewParent, UNO_QUERY_THROW );
+ xManager->registerScriptEvents( nPos, pObj->GetOriginalEvents() );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ // FormObject zuruecksetzen
+ pObj->ClearObjEnv();
+ }
+}
+
+//------------------------------------------------------------------
+void FmXUndoEnvironment::Removed(SdrObject* pObj)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXUndoEnvironment::Removed" );
+ if ( pObj->IsVirtualObj() )
+ // for virtual objects, we've already been notified of the removal of the master
+ // object, which is sufficient here
+ return;
+
+ if (pObj->GetObjInventor() == FmFormInventor)
+ {
+ FmFormObj* pFormObj = PTR_CAST(FmFormObj, pObj);
+ Removed(pFormObj);
+ }
+ else if (pObj->IsGroupObject())
+ {
+ SdrObjListIter aIter(*pObj->GetSubList());
+ while ( aIter.IsMore() )
+ Removed( aIter.Next() );
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXUndoEnvironment::Removed(FmFormObj* pObj)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXUndoEnvironment::Removed" );
+ DBG_ASSERT( pObj, "FmXUndoEnvironment::Removed: invalid object!" );
+ if ( !pObj )
+ return;
+
+ // ist das Control noch einer Form zugeordnet
+ Reference< XFormComponent > xContent(pObj->GetUnoControlModel(), UNO_QUERY);
+ if (xContent.is())
+ {
+ // das Object wird aus einer Liste herausgenommen
+ // existiert ein Vater wird das Object beim beim Vater entfernt und
+ // am FormObject gemerkt!
+
+ // wird das Object wieder eingefuegt und ein Parent existiert, so wird dieser
+ // Parent wiederum gesetzt
+ Reference< XIndexContainer > xForm(xContent->getParent(), UNO_QUERY);
+ if (xForm.is())
+ {
+ Reference< XIndexAccess > xIndexAccess((XIndexContainer*)xForm.get());
+ // Feststellen an welcher Position sich das Kind befunden hat
+ const sal_Int32 nPos = getElementPos(xIndexAccess, xContent);
+ if (nPos >= 0)
+ {
+ Sequence< ScriptEventDescriptor > aEvts;
+ Reference< XEventAttacherManager > xManager(xForm, UNO_QUERY);
+ if (xManager.is())
+ aEvts = xManager->getScriptEvents(nPos);
+
+ try
+ {
+ pObj->SetObjEnv(xForm, nPos, aEvts);
+ xForm->removeByIndex(nPos);
+ }
+ catch(Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ }
+ }
+ }
+}
+
+// XEventListener
+//------------------------------------------------------------------------------
+void SAL_CALL FmXUndoEnvironment::disposing(const EventObject& e) throw( RuntimeException )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXUndoEnvironment::disposing" );
+ // check if it's an object we have cached informations about
+ if (m_pPropertySetCache)
+ {
+ Reference< XPropertySet > xSourceSet(e.Source, UNO_QUERY);
+ if (xSourceSet.is())
+ {
+ PropertySetInfoCache* pCache = static_cast<PropertySetInfoCache*>(m_pPropertySetCache);
+ PropertySetInfoCacheIterator aSetPos = pCache->find(xSourceSet);
+ if (aSetPos != pCache->end())
+ pCache->erase(aSetPos);
+ }
+ }
+}
+
+// XPropertyChangeListener
+//------------------------------------------------------------------------------
+void SAL_CALL FmXUndoEnvironment::propertyChange(const PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXUndoEnvironment::propertyChange" );
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+
+ if (!IsLocked())
+ {
+ Reference< XPropertySet > xSet(evt.Source, UNO_QUERY);
+ if (!xSet.is())
+ return;
+
+ // if it's a "default value" property of a control model, set the according "value" property
+ static ::rtl::OUString pDefaultValueProperties[] = {
+ FM_PROP_DEFAULT_TEXT, FM_PROP_DEFAULTCHECKED, FM_PROP_DEFAULT_DATE, FM_PROP_DEFAULT_TIME,
+ FM_PROP_DEFAULT_VALUE, FM_PROP_DEFAULT_SELECT_SEQ, FM_PROP_EFFECTIVE_DEFAULT
+ };
+ const ::rtl::OUString aValueProperties[] = {
+ FM_PROP_TEXT, FM_PROP_STATE, FM_PROP_DATE, FM_PROP_TIME,
+ FM_PROP_VALUE, FM_PROP_SELECT_SEQ, FM_PROP_EFFECTIVE_VALUE
+ };
+ sal_Int32 nDefaultValueProps = sizeof(pDefaultValueProperties)/sizeof(pDefaultValueProperties[0]);
+ OSL_ENSURE(sizeof(aValueProperties)/sizeof(aValueProperties[0]) == nDefaultValueProps,
+ "FmXUndoEnvironment::propertyChange: inconsistence!");
+ for (sal_Int32 i=0; i<nDefaultValueProps; ++i)
+ {
+ if (0 == evt.PropertyName.compareTo(pDefaultValueProperties[i]))
+ {
+ try
+ {
+ xSet->setPropertyValue(aValueProperties[i], evt.NewValue);
+ }
+ catch(const Exception&)
+ {
+ OSL_ENSURE(sal_False, "FmXUndoEnvironment::propertyChange: could not adjust the value property!");
+ }
+ }
+ }
+
+ // no Undo for transient and readonly props. But unfortunately "transient" is not only that the
+ // "transient" flag is set for the property in question, instead is is somewhat more complex
+ // Transience criterions are:
+ // - the "transient" flag is set for the property
+ // - OR the control has a non-empty COntrolSource property, i.e. is intended to be bound
+ // to a database column. Note that it doesn't matter here whether the control actually
+ // *is* bound to a column
+ // - OR the control is bound to an external value via XBindableValue/XValueBinding
+ // which does not have a "ExternalData" property being <TRUE/>
+
+ if (!m_pPropertySetCache)
+ m_pPropertySetCache = new PropertySetInfoCache;
+ PropertySetInfoCache* pCache = static_cast<PropertySetInfoCache*>(m_pPropertySetCache);
+
+ // let's see if we know something about the set
+ PropertySetInfoCacheIterator aSetPos = pCache->find(xSet);
+ if (aSetPos == pCache->end())
+ {
+ PropertySetInfo aNewEntry;
+ if (!::comphelper::hasProperty(FM_PROP_CONTROLSOURCE, xSet))
+ {
+ aNewEntry.bHasEmptyControlSource = sal_False;
+ }
+ else
+ {
+ try
+ {
+ Any aCurrentControlSource = xSet->getPropertyValue(FM_PROP_CONTROLSOURCE);
+ aNewEntry.bHasEmptyControlSource = !aCurrentControlSource.hasValue() || (::comphelper::getString(aCurrentControlSource).getLength() == 0);
+ }
+ catch(const Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ aSetPos = pCache->insert(PropertySetInfoCache::value_type(xSet,aNewEntry)).first;
+ DBG_ASSERT(aSetPos != pCache->end(), "FmXUndoEnvironment::propertyChange : just inserted it ... why it's not there ?");
+ }
+ else
+ { // is it the DataField property ?
+ if (evt.PropertyName.equals(FM_PROP_CONTROLSOURCE))
+ {
+ aSetPos->second.bHasEmptyControlSource = !evt.NewValue.hasValue() || (::comphelper::getString(evt.NewValue).getLength() == 0);
+ }
+ }
+
+ // now we have access to the cached info about the set
+ // let's see what we know about the property
+ PropertySetInfo::AllProperties& rPropInfos = aSetPos->second.aProps;
+ PropertySetInfo::AllPropertiesIterator aPropertyPos = rPropInfos.find(evt.PropertyName);
+ if (aPropertyPos == rPropInfos.end())
+ { // nothing 'til now ... have to change this ....
+ PropertyInfo aNewEntry;
+
+ // the attributes
+ sal_Int32 nAttributes = xSet->getPropertySetInfo()->getPropertyByName(evt.PropertyName).Attributes;
+ aNewEntry.bIsTransientOrReadOnly = ((nAttributes & PropertyAttribute::READONLY) != 0) || ((nAttributes & PropertyAttribute::TRANSIENT) != 0);
+
+ // check if it is the special "DataFieldProperty"
+ aNewEntry.bIsValueProperty = sal_False;
+ try
+ {
+ if (::comphelper::hasProperty(FM_PROP_CONTROLSOURCEPROPERTY, xSet))
+ {
+ Any aControlSourceProperty = xSet->getPropertyValue(FM_PROP_CONTROLSOURCEPROPERTY);
+ ::rtl::OUString sControlSourceProperty;
+ aControlSourceProperty >>= sControlSourceProperty;
+
+ aNewEntry.bIsValueProperty = (sControlSourceProperty.equals(evt.PropertyName));
+ }
+ }
+ catch(const Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ // insert the new entry
+ aPropertyPos = rPropInfos.insert(PropertySetInfo::AllProperties::value_type(evt.PropertyName,aNewEntry)).first;
+ DBG_ASSERT(aPropertyPos != rPropInfos.end(), "FmXUndoEnvironment::propertyChange : just inserted it ... why it's not there ?");
+ }
+
+ // now we have access to the cached info about the property affected
+ // and are able to decide wether or not we need an undo action
+
+ bool bAddUndoAction = rModel.IsUndoEnabled();
+ // no UNDO for transient/readonly properties
+ if ( bAddUndoAction && aPropertyPos->second.bIsTransientOrReadOnly )
+ bAddUndoAction = false;
+
+ if ( bAddUndoAction && aPropertyPos->second.bIsValueProperty )
+ {
+ // no UNDO when the "value" property changes, but the ControlSource is non-empty
+ // (in this case the control is intended to be bound to a database column)
+ if ( !aSetPos->second.bHasEmptyControlSource )
+ bAddUndoAction = false;
+
+ // no UNDO if the control is currently bound to an external value
+ if ( bAddUndoAction )
+ {
+ Reference< XBindableValue > xBindable( evt.Source, UNO_QUERY );
+ Reference< XValueBinding > xBinding;
+ if ( xBindable.is() )
+ xBinding = xBindable->getValueBinding();
+
+ Reference< XPropertySet > xBindingProps;
+ Reference< XPropertySetInfo > xBindingPropsPSI;
+ if ( xBindable.is() )
+ xBindingProps.set( xBinding, UNO_QUERY );
+ if ( xBindingProps.is() )
+ xBindingPropsPSI = xBindingProps->getPropertySetInfo();
+ // TODO: we should cache all those things, else this might be too expensive.
+ // However, this requires we're notified of changes in the value binding
+
+ static const ::rtl::OUString s_sExternalData( RTL_CONSTASCII_USTRINGPARAM( "ExternalData" ) );
+ if ( xBindingPropsPSI.is() && xBindingPropsPSI->hasPropertyByName( s_sExternalData ) )
+ {
+ sal_Bool bExternalData = sal_True;
+ OSL_VERIFY( xBindingProps->getPropertyValue( s_sExternalData ) >>= bExternalData );
+ bAddUndoAction = !bExternalData;
+ }
+ else
+ bAddUndoAction = !xBinding.is();
+ }
+ }
+
+ if ( bAddUndoAction && ( evt.PropertyName == FM_PROP_STRINGITEMLIST ) )
+ {
+ Reference< XListEntrySink > xSink( evt.Source, UNO_QUERY );
+ if ( xSink.is() && xSink->getListEntrySource().is() )
+ // #i41029# / 2005-01-31 / frank.schoenheit@sun.com
+ bAddUndoAction = false;
+ }
+
+ if ( bAddUndoAction )
+ {
+ aGuard.clear();
+ // TODO: this is a potential race condition: two threads here could in theory
+ // add their undo actions out-of-order
+
+ ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() );
+ rModel.AddUndo(new FmUndoPropertyAction(rModel, evt));
+ }
+ }
+ else
+ {
+ // if it's the DataField property we may have to adjust our cache
+ if (m_pPropertySetCache && evt.PropertyName.equals(FM_PROP_CONTROLSOURCE))
+ {
+ Reference< XPropertySet > xSet(evt.Source, UNO_QUERY);
+ PropertySetInfoCache* pCache = static_cast<PropertySetInfoCache*>(m_pPropertySetCache);
+ PropertySetInfo& rSetInfo = (*pCache)[xSet];
+ rSetInfo.bHasEmptyControlSource = !evt.NewValue.hasValue() || (::comphelper::getString(evt.NewValue).getLength() == 0);
+ }
+ }
+}
+
+// XContainerListener
+//------------------------------------------------------------------------------
+void SAL_CALL FmXUndoEnvironment::elementInserted(const ContainerEvent& evt) throw(::com::sun::star::uno::RuntimeException)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXUndoEnvironment::elementInserted" );
+ ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ // neues Object zum lauschen
+ Reference< XInterface > xIface;
+ evt.Element >>= xIface;
+ OSL_ENSURE(xIface.is(), "FmXUndoEnvironment::elementInserted: invalid container notification!");
+ AddElement(xIface);
+
+ implSetModified();
+}
+
+//------------------------------------------------------------------------------
+void FmXUndoEnvironment::implSetModified()
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXUndoEnvironment::implSetModified" );
+ if ( !IsLocked() && rModel.GetObjectShell() )
+ {
+ rModel.GetObjectShell()->SetModified( sal_True );
+ }
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXUndoEnvironment::elementReplaced(const ContainerEvent& evt) throw(::com::sun::star::uno::RuntimeException)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXUndoEnvironment::elementReplaced" );
+ ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ Reference< XInterface > xIface;
+ evt.ReplacedElement >>= xIface;
+ OSL_ENSURE(xIface.is(), "FmXUndoEnvironment::elementReplaced: invalid container notification!");
+ RemoveElement(xIface);
+
+ evt.Element >>= xIface;
+ AddElement(xIface);
+
+ implSetModified();
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXUndoEnvironment::elementRemoved(const ContainerEvent& evt) throw(::com::sun::star::uno::RuntimeException)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXUndoEnvironment::elementRemoved" );
+ ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ Reference< XInterface > xIface( evt.Element, UNO_QUERY );
+ OSL_ENSURE(xIface.is(), "FmXUndoEnvironment::elementRemoved: invalid container notification!");
+ RemoveElement(xIface);
+
+ implSetModified();
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXUndoEnvironment::modified( const EventObject& /*aEvent*/ ) throw (RuntimeException)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXUndoEnvironment::modified" );
+ implSetModified();
+}
+
+//------------------------------------------------------------------------------
+void FmXUndoEnvironment::AddForms(const Reference< XNameContainer > & rForms)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXUndoEnvironment::AddForms" );
+ Lock();
+ Reference< XInterface > xInt(rForms, UNO_QUERY);
+ AddElement(xInt);
+ UnLock();
+}
+
+//------------------------------------------------------------------------------
+void FmXUndoEnvironment::RemoveForms(const Reference< XNameContainer > & rForms)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXUndoEnvironment::RemoveForms" );
+ Lock();
+ Reference< XInterface > xInt(rForms, UNO_QUERY);
+ RemoveElement(xInt);
+ UnLock();
+}
+
+//------------------------------------------------------------------------------
+void FmXUndoEnvironment::TogglePropertyListening(const Reference< XInterface > & Element)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXUndoEnvironment::TogglePropertyListening" );
+ // am Container horchen
+ Reference< XIndexContainer > xContainer(Element, UNO_QUERY);
+ if (xContainer.is())
+ {
+ sal_uInt32 nCount = xContainer->getCount();
+ Reference< XInterface > xIface;
+ for (sal_uInt32 i = 0; i < nCount; i++)
+ {
+ xContainer->getByIndex(i) >>= xIface;
+ TogglePropertyListening(xIface);
+ }
+ }
+
+ Reference< XPropertySet > xSet(Element, UNO_QUERY);
+ if (xSet.is())
+ {
+ if (!bReadOnly)
+ xSet->addPropertyChangeListener( ::rtl::OUString(), this );
+ else
+ xSet->removePropertyChangeListener( ::rtl::OUString(), this );
+ }
+}
+
+
+//------------------------------------------------------------------------------
+void FmXUndoEnvironment::switchListening( const Reference< XIndexContainer >& _rxContainer, bool _bStartListening ) SAL_THROW(())
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXUndoEnvironment::switchListening" );
+ OSL_PRECOND( _rxContainer.is(), "FmXUndoEnvironment::switchListening: invalid container!" );
+ if ( !_rxContainer.is() )
+ return;
+
+ try
+ {
+ // if it's an EventAttacherManager, then we need to listen for
+ // script events
+ Reference< XEventAttacherManager > xManager( _rxContainer, UNO_QUERY );
+ if ( xManager.is() )
+ {
+ if ( _bStartListening )
+ {
+ m_pScriptingEnv->registerEventAttacherManager( xManager );
+ if ( m_vbaListener.is() )
+ xManager->addScriptListener( m_vbaListener );
+ }
+ else
+ {
+ m_pScriptingEnv->revokeEventAttacherManager( xManager );
+ if ( m_vbaListener.is() )
+ xManager->removeScriptListener( m_vbaListener );
+ }
+ }
+
+ // also handle all children of this element
+ sal_uInt32 nCount = _rxContainer->getCount();
+ Reference< XInterface > xInterface;
+ for ( sal_uInt32 i = 0; i < nCount; ++i )
+ {
+ _rxContainer->getByIndex( i ) >>= xInterface;
+ if ( _bStartListening )
+ AddElement( xInterface );
+ else
+ RemoveElement( xInterface );
+ }
+
+ // be notified of any changes in the container elements
+ Reference< XContainer > xSimpleContainer( _rxContainer, UNO_QUERY );
+ OSL_ENSURE( xSimpleContainer.is(), "FmXUndoEnvironment::switchListening: how are we expected to be notified of changes in the container?" );
+ if ( xSimpleContainer.is() )
+ {
+ if ( _bStartListening )
+ xSimpleContainer->addContainerListener( this );
+ else
+ xSimpleContainer->removeContainerListener( this );
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "FmXUndoEnvironment::switchListening: caught an exception!" );
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXUndoEnvironment::switchListening( const Reference< XInterface >& _rxObject, bool _bStartListening ) SAL_THROW(())
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXUndoEnvironment::switchListening" );
+ OSL_PRECOND( _rxObject.is(), "FmXUndoEnvironment::switchListening: how should I listen at a NULL object?" );
+
+ try
+ {
+ if ( !bReadOnly )
+ {
+ Reference< XPropertySet > xProps( _rxObject, UNO_QUERY );
+ if ( xProps.is() )
+ {
+ if ( _bStartListening )
+ xProps->addPropertyChangeListener( ::rtl::OUString(), this );
+ else
+ xProps->removePropertyChangeListener( ::rtl::OUString(), this );
+ }
+ }
+
+ Reference< XModifyBroadcaster > xBroadcaster( _rxObject, UNO_QUERY );
+ if ( xBroadcaster.is() )
+ {
+ if ( _bStartListening )
+ xBroadcaster->addModifyListener( this );
+ else
+ xBroadcaster->removeModifyListener( this );
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "FmXUndoEnvironment::switchListening: caught an exception!" );
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXUndoEnvironment::AddElement(const Reference< XInterface >& _rxElement )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXUndoEnvironment::AddElement" );
+ OSL_ENSURE( !m_bDisposed, "FmXUndoEnvironment::AddElement: not when I'm already disposed!" );
+
+ // am Container horchen
+ Reference< XIndexContainer > xContainer( _rxElement, UNO_QUERY );
+ if ( xContainer.is() )
+ switchListening( xContainer, true );
+
+ switchListening( _rxElement, true );
+}
+
+//------------------------------------------------------------------------------
+void FmXUndoEnvironment::RemoveElement(const Reference< XInterface >& _rxElement)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXUndoEnvironment::RemoveElement" );
+ if ( m_bDisposed )
+ return;
+
+ switchListening( _rxElement, false );
+
+ if (!bReadOnly)
+ {
+ // reset the ActiveConnection if the form is to be removed. This will (should) free the resources
+ // associated with this connection
+ // 86299 - 05/02/2001 - frank.schoenheit@germany.sun.com
+ Reference< XForm > xForm( _rxElement, UNO_QUERY );
+ Reference< XPropertySet > xFormProperties( xForm, UNO_QUERY );
+ if ( xFormProperties.is() )
+ if ( !::svxform::OStaticDataAccessTools().isEmbeddedInDatabase( _rxElement ) )
+ // (if there is a connection in the context of the component, setting
+ // a new connection would be vetoed, anyway)
+ // #i34196# - 2004-09-21 - fs@openoffice.org
+ xFormProperties->setPropertyValue( FM_PROP_ACTIVE_CONNECTION, Any() );
+ }
+
+ Reference< XIndexContainer > xContainer( _rxElement, UNO_QUERY );
+ if ( xContainer.is() )
+ switchListening( xContainer, false );
+}
+
+
+//------------------------------------------------------------------------------
+FmUndoPropertyAction::FmUndoPropertyAction(FmFormModel& rNewMod, const PropertyChangeEvent& evt)
+ :SdrUndoAction(rNewMod)
+ ,xObj(evt.Source, UNO_QUERY)
+ ,aPropertyName(evt.PropertyName)
+ ,aNewValue(evt.NewValue)
+ ,aOldValue(evt.OldValue)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmUndoPropertyAction::FmUndoPropertyAction" );
+ if (rNewMod.GetObjectShell())
+ rNewMod.GetObjectShell()->SetModified(sal_True);
+ if(static_STR_UNDO_PROPERTY.Len() == 0)
+ static_STR_UNDO_PROPERTY = SVX_RES(RID_STR_UNDO_PROPERTY);
+}
+
+
+//------------------------------------------------------------------------------
+void FmUndoPropertyAction::Undo()
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmUndoPropertyAction::Undo" );
+ FmXUndoEnvironment& rEnv = ((FmFormModel&)rMod).GetUndoEnv();
+
+ if (xObj.is() && !rEnv.IsLocked())
+ {
+ rEnv.Lock();
+ try
+ {
+ xObj->setPropertyValue( aPropertyName, aOldValue );
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "FmUndoPropertyAction::Undo: caught an exception!" );
+ }
+ rEnv.UnLock();
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmUndoPropertyAction::Redo()
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmUndoPropertyAction::Redo" );
+ FmXUndoEnvironment& rEnv = ((FmFormModel&)rMod).GetUndoEnv();
+
+ if (xObj.is() && !rEnv.IsLocked())
+ {
+ rEnv.Lock();
+ try
+ {
+ xObj->setPropertyValue( aPropertyName, aNewValue );
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "FmUndoPropertyAction::Redo: caught an exception!" );
+ }
+ rEnv.UnLock();
+ }
+}
+
+//------------------------------------------------------------------------------
+String FmUndoPropertyAction::GetComment() const
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmUndoPropertyAction::GetComment" );
+ String aStr(static_STR_UNDO_PROPERTY);
+
+ aStr.SearchAndReplace( '#', aPropertyName );
+ return aStr;
+}
+
+
+DBG_NAME(FmUndoContainerAction);
+//------------------------------------------------------------------------------
+FmUndoContainerAction::FmUndoContainerAction(FmFormModel& _rMod,
+ Action _eAction,
+ const Reference< XIndexContainer > & xCont,
+ const Reference< XInterface > & xElem,
+ sal_Int32 nIdx)
+ :SdrUndoAction( _rMod )
+ ,m_xContainer( xCont )
+ ,m_nIndex( nIdx )
+ ,m_eAction( _eAction )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmUndoContainerAction::FmUndoContainerAction" );
+ OSL_ENSURE( nIdx >= 0, "FmUndoContainerAction::FmUndoContainerAction: invalid index!" );
+ // some old code suggested this could be a valid argument. However, this code was
+ // buggy, and it *seemed* that nobody used it - so it was removed.
+
+ DBG_CTOR(FmUndoContainerAction,NULL);
+ if ( xCont.is() && xElem.is() )
+ {
+ // normalize
+ m_xElement = m_xElement.query( xElem );
+ if ( m_eAction == Removed )
+ {
+ if (m_nIndex >= 0)
+ {
+ Reference< XEventAttacherManager > xManager( xCont, UNO_QUERY );
+ if ( xManager.is() )
+ m_aEvents = xManager->getScriptEvents(m_nIndex);
+ }
+ else
+ m_xElement = NULL;
+
+ // we now own the element
+ m_xOwnElement = m_xElement;
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+FmUndoContainerAction::~FmUndoContainerAction()
+{
+ // if we own the object ....
+ DisposeElement( m_xOwnElement );
+ DBG_DTOR(FmUndoContainerAction,NULL);
+}
+
+//------------------------------------------------------------------------------
+
+void FmUndoContainerAction::DisposeElement( const Reference< XInterface > & xElem )
+{
+ Reference< XComponent > xComp( xElem, UNO_QUERY );
+ if ( xComp.is() )
+ {
+ // and the object does not have a parent
+ Reference< XChild > xChild( xElem, UNO_QUERY );
+ if ( xChild.is() && !xChild->getParent().is() )
+ // -> dispose it
+ xComp->dispose();
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmUndoContainerAction::implReInsert( ) SAL_THROW( ( Exception ) )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmUndoContainerAction::implReInsert" );
+ if ( m_xContainer->getCount() >= m_nIndex )
+ {
+ // insert the element
+ Any aVal;
+ if ( m_xContainer->getElementType() == ::getCppuType( static_cast< const Reference< XFormComponent >* >( NULL ) ) )
+ {
+ aVal <<= Reference< XFormComponent >( m_xElement, UNO_QUERY );
+ }
+ else
+ {
+ aVal <<= Reference< XForm >( m_xElement, UNO_QUERY );
+ }
+ m_xContainer->insertByIndex( m_nIndex, aVal );
+
+ OSL_ENSURE( getElementPos( m_xContainer.get(), m_xElement ) == m_nIndex, "FmUndoContainerAction::implReInsert: insertion did not work!" );
+
+ // register the events
+ Reference< XEventAttacherManager > xManager( m_xContainer, UNO_QUERY );
+ if ( xManager.is() )
+ xManager->registerScriptEvents( m_nIndex, m_aEvents );
+
+ // we don't own the object anymore
+ m_xOwnElement = NULL;
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmUndoContainerAction::implReRemove( ) SAL_THROW( ( Exception ) )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmUndoContainerAction::implReRemove" );
+ Reference< XInterface > xElement;
+ if ( ( m_nIndex >= 0 ) && ( m_nIndex < m_xContainer->getCount() ) )
+ m_xContainer->getByIndex( m_nIndex ) >>= xElement;
+
+ if ( xElement != m_xElement )
+ {
+ // the indexes in the container changed. Okay, so go the long way and
+ // manually determine the index
+ m_nIndex = getElementPos( m_xContainer.get(), m_xElement );
+ if ( m_nIndex != -1 )
+ xElement = m_xElement;
+ }
+
+ OSL_ENSURE( xElement == m_xElement, "FmUndoContainerAction::implReRemove: cannot find the element which I'm responsible for!" );
+ if ( xElement == m_xElement )
+ {
+ Reference< XEventAttacherManager > xManager( m_xContainer, UNO_QUERY );
+ if ( xManager.is() )
+ m_aEvents = xManager->getScriptEvents( m_nIndex );
+ m_xContainer->removeByIndex( m_nIndex );
+ // from now on, we own this object
+ m_xOwnElement = m_xElement;
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmUndoContainerAction::Undo()
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmUndoContainerAction::Undo" );
+ FmXUndoEnvironment& rEnv = static_cast< FmFormModel& >( rMod ).GetUndoEnv();
+
+ if ( m_xContainer.is() && !rEnv.IsLocked() && m_xElement.is() )
+ {
+ rEnv.Lock();
+ try
+ {
+ switch ( m_eAction )
+ {
+ case Inserted:
+ implReRemove();
+ break;
+
+ case Removed:
+ implReInsert();
+ break;
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "FmUndoContainerAction::Undo: caught an exception!" );
+ }
+ rEnv.UnLock();
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmUndoContainerAction::Redo()
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmUndoContainerAction::Redo" );
+ FmXUndoEnvironment& rEnv = static_cast< FmFormModel& >( rMod ).GetUndoEnv();
+ if ( m_xContainer.is() && !rEnv.IsLocked() && m_xElement.is() )
+ {
+ rEnv.Lock();
+ try
+ {
+ switch ( m_eAction )
+ {
+ case Inserted:
+ implReInsert();
+ break;
+
+ case Removed:
+ implReRemove();
+ break;
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "FmUndoContainerAction::Redo: caught an exception!" );
+ }
+ rEnv.UnLock();
+ }
+}
+
+//------------------------------------------------------------------------------
+FmUndoModelReplaceAction::FmUndoModelReplaceAction(FmFormModel& _rMod, SdrUnoObj* _pObject, const Reference< XControlModel > & _xReplaced)
+ :SdrUndoAction(_rMod)
+ ,m_xReplaced(_xReplaced)
+ ,m_pObject(_pObject)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmUndoModelReplaceAction::FmUndoModelReplaceAction" );
+}
+
+//------------------------------------------------------------------------------
+FmUndoModelReplaceAction::~FmUndoModelReplaceAction()
+{
+ // dispose our element if nobody else is responsible for
+ DisposeElement(m_xReplaced);
+}
+
+//------------------------------------------------------------------------------
+
+void FmUndoModelReplaceAction::DisposeElement( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel>& xReplaced )
+{
+ Reference< XComponent > xComp(xReplaced, UNO_QUERY);
+ if (xComp.is())
+ {
+ Reference< XChild > xChild(xReplaced, UNO_QUERY);
+ if (!xChild.is() || !xChild->getParent().is())
+ xComp->dispose();
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmUndoModelReplaceAction::Undo()
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmUndoModelReplaceAction::Undo" );
+ try
+ {
+ Reference< XControlModel > xCurrentModel( m_pObject->GetUnoControlModel() );
+
+ // replace the model within the parent
+ Reference< XChild > xCurrentAsChild( xCurrentModel, UNO_QUERY );
+ Reference< XNameContainer > xCurrentsParent;
+ if ( xCurrentAsChild.is() )
+ xCurrentsParent = xCurrentsParent.query( xCurrentAsChild->getParent() );
+ DBG_ASSERT( xCurrentsParent.is(), "FmUndoModelReplaceAction::Undo: invalid current model!" );
+
+ if ( xCurrentsParent.is() )
+ {
+ // the form container works with FormComponents
+ Reference< XFormComponent > xComponent( m_xReplaced, UNO_QUERY );
+ DBG_ASSERT( xComponent.is(), "FmUndoModelReplaceAction::Undo: the new model is no form component !" );
+
+ Reference< XPropertySet > xCurrentAsSet( xCurrentModel, UNO_QUERY );
+ DBG_ASSERT( ::comphelper::hasProperty(FM_PROP_NAME, xCurrentAsSet ), "FmUndoModelReplaceAction::Undo : one of the models is invalid !");
+
+ ::rtl::OUString sName;
+ xCurrentAsSet->getPropertyValue( FM_PROP_NAME ) >>= sName;
+ xCurrentsParent->replaceByName( sName, makeAny( xComponent ) );
+
+ m_pObject->SetUnoControlModel(m_xReplaced);
+ m_pObject->SetChanged();
+
+ m_xReplaced = xCurrentModel;
+ }
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("FmUndoModelReplaceAction::Undo : could not replace the model !");
+ }
+}
+
+//------------------------------------------------------------------------------
+String FmUndoModelReplaceAction::GetComment() const
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmUndoModelReplaceAction::GetComment" );
+ return SVX_RES(RID_STR_UNDO_MODEL_REPLACE);
+}
diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx
new file mode 100644
index 000000000000..3ab15471e4fd
--- /dev/null
+++ b/svx/source/form/fmview.cxx
@@ -0,0 +1,623 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <sfx2/docfile.hxx>
+#ifdef REFERENCE
+#undef REFERENCE
+#endif
+#include <svtools/ehdl.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <com/sun/star/sdb/SQLContext.hpp>
+#include <com/sun/star/uno/XNamingService.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/form/XLoadable.hpp>
+#include <com/sun/star/form/XReset.hpp>
+#include "fmvwimp.hxx"
+#include <sfx2/objsh.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <basic/sbuno.hxx>
+#include <basic/sbx.hxx>
+#include "fmitems.hxx"
+#include "fmobj.hxx"
+#include "svx/svditer.hxx"
+#include <svx/svdpagv.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/fmview.hxx>
+#include <svx/fmmodel.hxx>
+#include <svx/fmpage.hxx>
+#include <svx/fmshell.hxx>
+#include "fmpgeimp.hxx"
+#include "svx/fmtools.hxx"
+#include "fmshimp.hxx"
+#include "fmservs.hxx"
+#include "fmprop.hrc"
+#include "fmundo.hxx"
+#include <svx/dataaccessdescriptor.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <com/sun/star/form/FormComponentType.hpp>
+#include <vcl/svapp.hxx>
+#include <tools/urlobj.hxx>
+#include <tools/diagnose_ex.h>
+#include <vcl/stdtext.hxx>
+#include <svx/fmglob.hxx>
+#include <svx/sdrpagewindow.hxx>
+#include "svx/sdrpaintwindow.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::form;
+using namespace ::com::sun::star::util;
+using namespace ::svxform;
+using namespace ::svx;
+
+//========================================================================
+//------------------------------------------------------------------------
+TYPEINIT1(FmFormView, E3dView);
+
+//------------------------------------------------------------------------
+FmFormView::FmFormView( FmFormModel* pModel, OutputDevice* pOut )
+ :E3dView(pModel,pOut)
+{
+ Init();
+}
+
+//------------------------------------------------------------------------
+void FmFormView::Init()
+{
+ pFormShell = NULL;
+ pImpl = new FmXFormView(::comphelper::getProcessServiceFactory(),this);
+ pImpl->acquire();
+
+ //////////////////////////////////////////////////////////////////////
+ // Model setzen
+ SdrModel* pModel = GetModel();
+
+ DBG_ASSERT( pModel->ISA(FmFormModel), "Falsches Model" );
+ if( !pModel->ISA(FmFormModel) ) return;
+ FmFormModel* pFormModel = (FmFormModel*)pModel;
+
+ //////////////////////////////////////////////////////////////////////
+ // DesignMode vom Model holen
+ sal_Bool bInitDesignMode = pFormModel->GetOpenInDesignMode();
+ if ( pFormModel->OpenInDesignModeIsDefaulted( ) )
+ { // this means that nobody ever explicitly set this on the model, and the model has never
+ // been loaded from a stream.
+ // This means this is a newly created document. This means, we want to have it in design
+ // mode by default (though a newly created model returns true for GetOpenInDesignMode).
+ // We _want_ to have this because it makes a lot of hacks following the original fix
+ // for #94595# unnecessary
+ // #96399# - 2002-10-11 - fs@openoffice.org
+ DBG_ASSERT( !bInitDesignMode, "FmFormView::Init: doesn't the model default to FALSE anymore?" );
+ // if this asserts, either the on-contruction default in the model has changed (then this here
+ // may not be necessary anymore), or we're not dealing with a new document ....
+ bInitDesignMode = sal_True;
+ }
+
+ SfxObjectShell* pObjShell = pFormModel->GetObjectShell();
+ if ( pObjShell && pObjShell->GetMedium() )
+ {
+ const SfxPoolItem *pItem=0;
+ if ( pObjShell->GetMedium()->GetItemSet()->GetItemState( SID_COMPONENTDATA, sal_False, &pItem ) == SFX_ITEM_SET )
+ {
+ ::comphelper::NamedValueCollection aComponentData( ((SfxUnoAnyItem*)pItem)->GetValue() );
+ bInitDesignMode = aComponentData.getOrDefault( "ApplyFormDesignMode", bInitDesignMode );
+ }
+ }
+
+ if( pObjShell && pObjShell->IsReadOnly() )
+ bInitDesignMode = sal_False;
+
+ // dieses wird in der Shell vorgenommen
+ // bDesignMode = !bInitDesignMode; // erzwingt, dass SetDesignMode ausgefuehrt wird
+ SetDesignMode( bInitDesignMode );
+}
+
+//------------------------------------------------------------------------
+FmFormView::~FmFormView()
+{
+ if( pFormShell )
+ pFormShell->SetView( NULL );
+
+ pImpl->notifyViewDying();
+ pImpl->release();
+ pImpl = NULL;
+}
+
+//------------------------------------------------------------------------
+FmFormPage* FmFormView::GetCurPage()
+{
+ SdrPageView* pPageView = GetSdrPageView();
+ FmFormPage* pCurPage = pPageView ? PTR_CAST( FmFormPage, pPageView->GetPage() ) : NULL;
+ return pCurPage;
+}
+
+//------------------------------------------------------------------------
+void FmFormView::MarkListHasChanged()
+{
+ E3dView::MarkListHasChanged();
+
+ if ( pFormShell && IsDesignMode() )
+ {
+ FmFormObj* pObj = getMarkedGrid();
+ if ( pImpl->m_pMarkedGrid && pImpl->m_pMarkedGrid != pObj )
+ {
+ pImpl->m_pMarkedGrid = NULL;
+ if ( pImpl->m_xWindow.is() )
+ {
+ pImpl->m_xWindow->removeFocusListener(pImpl);
+ pImpl->m_xWindow = NULL;
+ }
+ SetMoveOutside(sal_False);
+ //OLMRefreshAllIAOManagers();
+ }
+
+ pFormShell->GetImpl()->SetSelectionDelayed();
+ }
+}
+
+namespace
+{
+ const SdrPageWindow* findPageWindow( const SdrPaintView* _pView, OutputDevice* _pWindow )
+ {
+ SdrPageView* pPageView = _pView->GetSdrPageView();
+ if(pPageView)
+ {
+ for ( sal_uInt32 window = 0; window < pPageView->PageWindowCount(); ++window )
+ {
+ const SdrPageWindow* pPageWindow = pPageView->GetPageWindow( window );
+ if ( !pPageWindow || &pPageWindow->GetPaintWindow().GetOutputDevice() != _pWindow )
+ continue;
+
+ return pPageWindow;
+ }
+ }
+ return NULL;
+ }
+}
+
+//------------------------------------------------------------------------
+void FmFormView::AddWindowToPaintView(OutputDevice* pNewWin)
+{
+ E3dView::AddWindowToPaintView(pNewWin);
+
+ if ( !pNewWin )
+ return;
+
+ // look up the PageViewWindow for the newly inserted window, and care for it
+ // #i39269# / 2004-12-20 / frank.schoenheit@sun.com
+ const SdrPageWindow* pPageWindow = findPageWindow( this, pNewWin );
+ if ( pPageWindow )
+ pImpl->addWindow( *pPageWindow );
+}
+
+//------------------------------------------------------------------------
+void FmFormView::DeleteWindowFromPaintView(OutputDevice* pNewWin)
+{
+ const SdrPageWindow* pPageWindow = findPageWindow( this, pNewWin );
+ if ( pPageWindow )
+ pImpl->removeWindow( pPageWindow->GetControlContainer() );
+
+ E3dView::DeleteWindowFromPaintView(pNewWin);
+}
+
+//------------------------------------------------------------------------
+void FmFormView::ChangeDesignMode(sal_Bool bDesign)
+{
+ if (bDesign == IsDesignMode())
+ return;
+
+ FmFormModel* pModel = PTR_CAST(FmFormModel, GetModel());
+ if (pModel)
+ { // fuer die Zeit des Uebergangs das Undo-Environment ausschalten, das sichert, dass man dort auch nicht-transiente
+ // Properties mal eben aendern kann (sollte allerdings mit Vorsicht genossen und beim Rueckschalten des Modes
+ // auch immer wieder rueckgaegig gemacht werden. Ein Beispiel ist das Setzen der maximalen Text-Laenge durch das
+ // FmXEditModel an seinem Control.)
+ pModel->GetUndoEnv().Lock();
+ }
+
+ // --- 1. deactivate all controls if we are switching to design mode
+ if ( bDesign )
+ DeactivateControls( GetSdrPageView() );
+
+ // --- 2. simulate a deactivation (the shell will handle some things there ...?)
+ if ( pFormShell && pFormShell->GetImpl() )
+ pFormShell->GetImpl()->viewDeactivated( *this, sal_True );
+ else
+ pImpl->Deactivate( sal_True );
+
+ // --- 3. activate all controls, if we're switching to alive mode
+ if ( !bDesign )
+ ActivateControls( GetSdrPageView() );
+
+ // --- 4. load resp. unload the forms
+ FmFormPage* pCurPage = GetCurPage();
+ if ( pCurPage )
+ {
+ if ( pFormShell && pFormShell->GetImpl() )
+ pFormShell->GetImpl()->loadForms( pCurPage, ( bDesign ? FORMS_UNLOAD : FORMS_LOAD ) );
+ }
+
+ // --- 5. base class functionality
+ SetDesignMode( bDesign );
+
+ // --- 6. simulate a activation (the shell will handle some things there ...?)
+ OSL_PRECOND( pFormShell && pFormShell->GetImpl(), "FmFormView::ChangeDesignMode: is this really allowed? No shell?" );
+ if ( pFormShell && pFormShell->GetImpl() )
+ pFormShell->GetImpl()->viewActivated( *this );
+ else
+ pImpl->Activate();
+
+ if ( pCurPage )
+ {
+ if ( bDesign )
+ {
+ if ( GetActualOutDev() && GetActualOutDev()->GetOutDevType() == OUTDEV_WINDOW )
+ {
+ const Window* pWindow = static_cast< const Window* >( GetActualOutDev() );
+ const_cast< Window* >( pWindow )->GrabFocus();
+ }
+
+ // redraw UNO objects
+ if ( GetSdrPageView() )
+ {
+ SdrObjListIter aIter(*pCurPage);
+ while( aIter.IsMore() )
+ {
+ SdrObject* pObj = aIter.Next();
+ if (pObj && pObj->IsUnoObj())
+ {
+ // For redraw just use ActionChanged()
+ // pObj->BroadcastObjectChange();
+ pObj->ActionChanged();
+ }
+ }
+ }
+ }
+ else
+ {
+ // set the auto focus to the first control (if indicated by the model to do so)
+ sal_Bool bForceControlFocus = pModel ? pModel->GetAutoControlFocus() : sal_False;
+ if (bForceControlFocus)
+ pImpl->AutoFocus();
+ }
+ }
+
+ // und mein Undo-Environment wieder an
+ if (pModel)
+ pModel->GetUndoEnv().UnLock();
+}
+
+//------------------------------------------------------------------------
+void FmFormView::GrabFirstControlFocus( sal_Bool _bForceSync )
+{
+ if ( !IsDesignMode() )
+ pImpl->AutoFocus( _bForceSync );
+}
+
+//------------------------------------------------------------------------
+SdrPageView* FmFormView::ShowSdrPage(SdrPage* pPage)
+{
+ SdrPageView* pPV = E3dView::ShowSdrPage(pPage);
+
+ if (pPage)
+ {
+ if (!IsDesignMode())
+ {
+ // creating the controllers
+ ActivateControls(pPV);
+
+ // Alles deselektieren
+ UnmarkAll();
+ }
+ else if ( pFormShell && pFormShell->IsDesignMode() )
+ {
+ FmXFormShell* pFormShellImpl = pFormShell->GetImpl();
+ pFormShellImpl->UpdateForms( sal_True );
+
+ // damit der Formular-Navigator auf den Seitenwechsel reagieren kann
+ pFormShell->GetViewShell()->GetViewFrame()->GetBindings().Invalidate(SID_FM_FMEXPLORER_CONTROL , sal_True, sal_False);
+
+ pFormShellImpl->SetSelection(GetMarkedObjectList());
+ }
+ }
+
+ // notify our shell that we have been activated
+ if ( pFormShell && pFormShell->GetImpl() )
+ pFormShell->GetImpl()->viewActivated( *this );
+ else
+ pImpl->Activate();
+
+ return pPV;
+}
+
+//------------------------------------------------------------------------
+void FmFormView::HideSdrPage()
+{
+ // --- 1. deactivate controls
+ if ( !IsDesignMode() )
+ DeactivateControls(GetSdrPageView());
+
+ // --- 2. tell the shell the view is (going to be) deactivated
+ if ( pFormShell && pFormShell->GetImpl() )
+ pFormShell->GetImpl()->viewDeactivated( *this, sal_True );
+ else
+ pImpl->Deactivate( sal_True );
+
+ // --- 3. base class behavior
+ E3dView::HideSdrPage();
+}
+
+//------------------------------------------------------------------------
+SdrModel* FmFormView::GetMarkedObjModel() const
+{
+ return E3dView::GetMarkedObjModel();
+}
+
+//------------------------------------------------------------------------
+sal_Bool FmFormView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions)
+{
+ return E3dView::Paste(rMod, rPos, pLst, nOptions);
+}
+
+//------------------------------------------------------------------------
+void FmFormView::ActivateControls(SdrPageView* pPageView)
+{
+ if (!pPageView)
+ return;
+
+ for (sal_uInt32 i = 0L; i < pPageView->PageWindowCount(); ++i)
+ {
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(i);
+ pImpl->addWindow(rPageWindow);
+ }
+}
+
+//------------------------------------------------------------------------
+void FmFormView::DeactivateControls(SdrPageView* pPageView)
+{
+ if( !pPageView )
+ return;
+
+ for (sal_uInt32 i = 0L; i < pPageView->PageWindowCount(); ++i)
+ {
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(i);
+ pImpl->removeWindow(rPageWindow.GetControlContainer() );
+ }
+}
+
+//------------------------------------------------------------------------
+SdrObject* FmFormView::CreateFieldControl( const ODataAccessDescriptor& _rColumnDescriptor )
+{
+ return pImpl->implCreateFieldControl( _rColumnDescriptor );
+}
+
+//------------------------------------------------------------------------
+SdrObject* FmFormView::CreateXFormsControl( const OXFormsDescriptor &_rDesc )
+{
+ return pImpl->implCreateXFormsControl(_rDesc);
+}
+
+//------------------------------------------------------------------------
+SdrObject* FmFormView::CreateFieldControl(const UniString& rFieldDesc) const
+{
+ ::rtl::OUString sDataSource = rFieldDesc.GetToken(0,sal_Unicode(11));
+ ::rtl::OUString sObjectName = rFieldDesc.GetToken(1,sal_Unicode(11));
+ sal_uInt16 nObjectType = (sal_uInt16)rFieldDesc.GetToken(2,sal_Unicode(11)).ToInt32();
+ ::rtl::OUString sFieldName = rFieldDesc.GetToken(3,sal_Unicode(11));
+
+ if (!sFieldName.getLength() || !sObjectName.getLength() || !sDataSource.getLength())
+ return NULL;
+
+ ODataAccessDescriptor aColumnDescriptor;
+ aColumnDescriptor.setDataSource(sDataSource);
+ aColumnDescriptor[ daCommand ] <<= sObjectName;
+ aColumnDescriptor[ daCommandType ] <<= nObjectType;
+ aColumnDescriptor[ daColumnName ] <<= sFieldName;
+
+ return pImpl->implCreateFieldControl( aColumnDescriptor );
+}
+
+//------------------------------------------------------------------------
+void FmFormView::InsertControlContainer(const Reference< ::com::sun::star::awt::XControlContainer > & xCC)
+{
+ if( !IsDesignMode() )
+ {
+ SdrPageView* pPageView = GetSdrPageView();
+ if( pPageView )
+ {
+ for( sal_uInt32 i = 0L; i < pPageView->PageWindowCount(); i++ )
+ {
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(i);
+
+ if( rPageWindow.GetControlContainer( false ) == xCC )
+ {
+ pImpl->addWindow(rPageWindow);
+ break;
+ }
+ }
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+void FmFormView::RemoveControlContainer(const Reference< ::com::sun::star::awt::XControlContainer > & xCC)
+{
+ if( !IsDesignMode() )
+ {
+ pImpl->removeWindow( xCC );
+ }
+}
+
+// -----------------------------------------------------------------------------
+SdrPaintWindow* FmFormView::BeginCompleteRedraw(OutputDevice* pOut)
+{
+ SdrPaintWindow* pPaintWindow = E3dView::BeginCompleteRedraw( pOut );
+ pImpl->suspendTabOrderUpdate();
+ return pPaintWindow;
+}
+
+// -----------------------------------------------------------------------------
+void FmFormView::EndCompleteRedraw( SdrPaintWindow& rPaintWindow, bool bPaintFormLayer )
+{
+ E3dView::EndCompleteRedraw( rPaintWindow, bPaintFormLayer );
+ pImpl->resumeTabOrderUpdate();
+}
+
+// -----------------------------------------------------------------------------
+sal_Bool FmFormView::KeyInput(const KeyEvent& rKEvt, Window* pWin)
+{
+ sal_Bool bDone = sal_False;
+ const KeyCode& rKeyCode = rKEvt.GetKeyCode();
+ if ( IsDesignMode()
+ && rKeyCode.GetCode() == KEY_RETURN
+ )
+ {
+ // RETURN alone enters grid controls, for keyboard accessibility
+ if ( pWin
+ && !rKeyCode.IsShift()
+ && !rKeyCode.IsMod1()
+ && !rKeyCode.IsMod2()
+ )
+ {
+ FmFormObj* pObj = getMarkedGrid();
+ if ( pObj )
+ {
+ Reference< awt::XWindow > xWindow( pObj->GetUnoControl( *this, *pWin ), UNO_QUERY );
+ if ( xWindow.is() )
+ {
+ pImpl->m_pMarkedGrid = pObj;
+ pImpl->m_xWindow = xWindow;
+ // add as listener to get notified when ESC will be pressed inside the grid
+ pImpl->m_xWindow->addFocusListener(pImpl);
+ SetMoveOutside(sal_True);
+ //OLMRefreshAllIAOManagers();
+ xWindow->setFocus();
+ bDone = sal_True;
+ }
+ }
+ }
+ // Alt-RETURN alone shows the properties of the selection
+ if ( pFormShell
+ && pFormShell->GetImpl()
+ && !rKeyCode.IsShift()
+ && !rKeyCode.IsMod1()
+ && rKeyCode.IsMod2()
+ )
+ {
+ pFormShell->GetImpl()->handleShowPropertiesRequest();
+ }
+
+ }
+
+ if ( !bDone )
+ bDone = E3dView::KeyInput(rKEvt,pWin);
+ return bDone;
+}
+// -----------------------------------------------------------------------------
+sal_Bool FmFormView::checkUnMarkAll(const Reference< XInterface >& _xSource)
+{
+ Reference< ::com::sun::star::awt::XControl> xControl(pImpl->m_xWindow,UNO_QUERY);
+ sal_Bool bRet = !xControl.is() || !_xSource.is() || _xSource != xControl->getModel();
+ if ( bRet )
+ UnmarkAll();
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+sal_Bool FmFormView::MouseButtonDown( const MouseEvent& _rMEvt, Window* _pWin )
+{
+ sal_Bool bReturn = E3dView::MouseButtonDown( _rMEvt, _pWin );
+
+ if ( pFormShell && pFormShell->GetImpl() )
+ {
+ SdrViewEvent aViewEvent;
+ PickAnything( _rMEvt, SDRMOUSEBUTTONDOWN, aViewEvent );
+ pFormShell->GetImpl()->handleMouseButtonDown( aViewEvent );
+ }
+
+ return bReturn;
+}
+
+// -----------------------------------------------------------------------------
+FmFormObj* FmFormView::getMarkedGrid() const
+{
+ FmFormObj* pFormObject = NULL;
+ const SdrMarkList& rMarkList = GetMarkedObjectList();
+ if ( 1 == rMarkList.GetMarkCount() )
+ {
+ SdrMark* pMark = rMarkList.GetMark(0);
+ if ( pMark )
+ {
+ pFormObject = FmFormObj::GetFormObject( pMark->GetMarkedSdrObj() );
+ if ( pFormObject )
+ {
+ Reference< XServiceInfo > xServInfo( pFormObject->GetUnoControlModel(), UNO_QUERY );
+ if ( !xServInfo.is() || !xServInfo->supportsService( FM_SUN_COMPONENT_GRIDCONTROL ) )
+ pFormObject = NULL;
+ }
+ }
+ }
+ return pFormObject;
+}
+
+// -----------------------------------------------------------------------------
+void FmFormView::createControlLabelPair( OutputDevice* _pOutDev, sal_Int32 _nXOffsetMM, sal_Int32 _nYOffsetMM,
+ const Reference< XPropertySet >& _rxField, const Reference< XNumberFormats >& _rxNumberFormats,
+ sal_uInt16 _nControlObjectID, const ::rtl::OUString& _rFieldPostfix, sal_uInt32 _nInventor, sal_uInt16 _nLabelObjectID,
+ SdrPage* _pLabelPage, SdrPage* _pControlPage, SdrModel* _pModel, SdrUnoObj*& _rpLabel, SdrUnoObj*& _rpControl )
+{
+ FmXFormView::createControlLabelPair(
+ ::comphelper::getProcessServiceFactory(),
+ *_pOutDev, _nXOffsetMM, _nYOffsetMM,
+ _rxField, _rxNumberFormats,
+ _nControlObjectID, _rFieldPostfix, _nInventor, _nLabelObjectID,
+ _pLabelPage, _pControlPage, _pModel,
+ _rpLabel, _rpControl
+ );
+}
+// -----------------------------------------------------------------------------
+Reference< runtime::XFormController > FmFormView::GetFormController( const Reference< XForm >& _rxForm, const OutputDevice& _rDevice ) const
+{
+ return pImpl->getFormController( _rxForm, _rDevice );
+}
+
diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx
new file mode 100644
index 000000000000..d2b6d6cbded4
--- /dev/null
+++ b/svx/source/form/fmvwimp.cxx
@@ -0,0 +1,1918 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "fmdocumentclassification.hxx"
+#include "fmobj.hxx"
+#include "fmpgeimp.hxx"
+#include "fmprop.hrc"
+#include "svx/fmresids.hrc"
+#include "fmservs.hxx"
+#include "fmshimp.hxx"
+#include "svx/fmtools.hxx"
+#include "fmundo.hxx"
+#include "fmvwimp.hxx"
+#include "formcontrolfactory.hxx"
+#include "svx/sdrpaintwindow.hxx"
+#include "svx/svditer.hxx"
+#include "svx/dataaccessdescriptor.hxx"
+#include "svx/dialmgr.hxx"
+#include "svx/fmglob.hxx"
+#include "svx/fmmodel.hxx"
+#include "svx/fmpage.hxx"
+#include "svx/fmshell.hxx"
+#include "svx/fmview.hxx"
+#include "svx/sdrpagewindow.hxx"
+#include "svx/svdogrp.hxx"
+#include "svx/svdpagv.hxx"
+#include "svx/xmlexchg.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#include <com/sun/star/form/XLoadable.hpp>
+#include <com/sun/star/awt/VisualEffect.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/util/XNumberFormats.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+#include <com/sun/star/form/FormComponentType.hpp>
+#include <com/sun/star/form/FormButtonType.hpp>
+#include <com/sun/star/form/XReset.hpp>
+#include <com/sun/star/form/binding/XBindableValue.hpp>
+#include <com/sun/star/form/binding/XValueBinding.hpp>
+#include <com/sun/star/form/submission/XSubmissionSupplier.hpp>
+#include <com/sun/star/awt/XTabControllerModel.hpp>
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include <com/sun/star/awt/XTabController.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#include <com/sun/star/sdbc/XPreparedStatement.hpp>
+#include <com/sun/star/sdb/XQueriesSupplier.hpp>
+#include <com/sun/star/container/XContainer.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/enumhelper.hxx>
+#include <comphelper/extract.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <comphelper/numbers.hxx>
+#include <comphelper/property.hxx>
+#include <cppuhelper/exc_hlp.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <tools/diagnose_ex.h>
+#include <vcl/msgbox.hxx>
+#include <vcl/stdtext.hxx>
+#include <vos/mutex.hxx>
+#include <rtl/logfile.hxx>
+
+#include <algorithm>
+
+using namespace ::comphelper;
+using namespace ::svx;
+using namespace ::svxform;
+
+ using namespace ::com::sun::star;
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::Sequence;
+ 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::Type;
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::style::VerticalAlignment_MIDDLE;
+ using ::com::sun::star::form::FormButtonType_SUBMIT;
+ using ::com::sun::star::form::binding::XValueBinding;
+ using ::com::sun::star::form::binding::XBindableValue;
+ using ::com::sun::star::lang::XComponent;
+ using ::com::sun::star::container::XIndexAccess;
+ using ::com::sun::star::form::XForm;
+ using ::com::sun::star::form::runtime::XFormController;
+ using ::com::sun::star::script::XEventAttacherManager;
+ using ::com::sun::star::awt::XTabControllerModel;
+ using ::com::sun::star::container::XChild;
+ using ::com::sun::star::container::XEnumeration;
+ using ::com::sun::star::task::XInteractionHandler;
+ using ::com::sun::star::lang::XInitialization;
+ using ::com::sun::star::awt::XTabController;
+ using ::com::sun::star::lang::XUnoTunnel;
+ using ::com::sun::star::awt::XControlContainer;
+ using ::com::sun::star::awt::XControl;
+ using ::com::sun::star::form::XFormComponent;
+ using ::com::sun::star::form::XForm;
+ using ::com::sun::star::lang::IndexOutOfBoundsException;
+ using ::com::sun::star::lang::WrappedTargetException;
+ using ::com::sun::star::container::XContainer;
+ using ::com::sun::star::container::ContainerEvent;
+ using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::beans::NamedValue;
+ using ::com::sun::star::sdb::SQLErrorEvent;
+ using ::com::sun::star::sdbc::XRowSet;
+ using ::com::sun::star::beans::XPropertySet;
+ using ::com::sun::star::container::XElementAccess;
+ using ::com::sun::star::awt::XWindow;
+ using ::com::sun::star::awt::FocusEvent;
+ using ::com::sun::star::ui::dialogs::XExecutableDialog;
+ using ::com::sun::star::sdbc::XDataSource;
+ using ::com::sun::star::container::XIndexContainer;
+ using ::com::sun::star::sdbc::XConnection;
+ using ::com::sun::star::container::XNameAccess;
+ using ::com::sun::star::sdb::SQLContext;
+ using ::com::sun::star::sdbc::SQLWarning;
+ using ::com::sun::star::sdbc::SQLException;
+ using ::com::sun::star::util::XNumberFormatsSupplier;
+ using ::com::sun::star::util::XNumberFormats;
+ using ::com::sun::star::beans::XPropertySetInfo;
+ /** === end UNO using === **/
+ namespace FormComponentType = ::com::sun::star::form::FormComponentType;
+ namespace CommandType = ::com::sun::star::sdb::CommandType;
+ namespace DataType = ::com::sun::star::sdbc::DataType;
+
+//------------------------------------------------------------------------------
+class FmXFormView::ObjectRemoveListener : public SfxListener
+{
+ FmXFormView* m_pParent;
+public:
+ ObjectRemoveListener( FmXFormView* pParent );
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+};
+
+//========================================================================
+DBG_NAME(FormViewPageWindowAdapter)
+//------------------------------------------------------------------------
+FormViewPageWindowAdapter::FormViewPageWindowAdapter( const ::comphelper::ComponentContext& _rContext, const SdrPageWindow& _rWindow, FmXFormView* _pViewImpl )
+: m_xControlContainer( _rWindow.GetControlContainer() ),
+ m_aContext( _rContext ),
+ m_pViewImpl( _pViewImpl ),
+ m_pWindow( dynamic_cast< Window* >( &_rWindow.GetPaintWindow().GetOutputDevice() ) )
+{
+ DBG_CTOR(FormViewPageWindowAdapter,NULL);
+
+ // create an XFormController for every form
+ FmFormPage* pFormPage = dynamic_cast< FmFormPage* >( _rWindow.GetPageView().GetPage() );
+ DBG_ASSERT( pFormPage, "FormViewPageWindowAdapter::FormViewPageWindowAdapter: no FmFormPage found!" );
+ if ( pFormPage )
+ {
+ try
+ {
+ Reference< XIndexAccess > xForms( pFormPage->GetForms(), UNO_QUERY_THROW );
+ sal_uInt32 nLength = xForms->getCount();
+ for (sal_uInt32 i = 0; i < nLength; i++)
+ {
+ Reference< XForm > xForm( xForms->getByIndex(i), UNO_QUERY );
+ if ( xForm.is() )
+ setController( xForm, NULL );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+FormViewPageWindowAdapter::~FormViewPageWindowAdapter()
+{
+ DBG_DTOR(FormViewPageWindowAdapter,NULL);
+}
+
+//------------------------------------------------------------------
+void FormViewPageWindowAdapter::dispose()
+{
+ for ( ::std::vector< Reference< XFormController > >::const_iterator i = m_aControllerList.begin();
+ i != m_aControllerList.end();
+ ++i
+ )
+ {
+ try
+ {
+ Reference< XFormController > xController( *i, UNO_QUERY_THROW );
+
+ // detaching the events
+ Reference< XChild > xControllerModel( xController->getModel(), UNO_QUERY );
+ if ( xControllerModel.is() )
+ {
+ Reference< XEventAttacherManager > xEventManager( xControllerModel->getParent(), UNO_QUERY_THROW );
+ Reference< XInterface > xControllerNormalized( xController, UNO_QUERY_THROW );
+ xEventManager->detach( i - m_aControllerList.begin(), xControllerNormalized );
+ }
+
+ // dispose the formcontroller
+ Reference< XComponent > xComp( xController, UNO_QUERY_THROW );
+ xComp->dispose();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ m_aControllerList.clear();
+}
+
+
+//------------------------------------------------------------------------------
+sal_Bool SAL_CALL FormViewPageWindowAdapter::hasElements(void) throw( RuntimeException )
+{
+ return getCount() != 0;
+}
+
+//------------------------------------------------------------------------------
+Type SAL_CALL FormViewPageWindowAdapter::getElementType(void) throw( RuntimeException )
+{
+ return ::getCppuType((const Reference< XFormController>*)0);
+}
+
+// XEnumerationAccess
+//------------------------------------------------------------------------------
+Reference< XEnumeration > SAL_CALL FormViewPageWindowAdapter::createEnumeration(void) throw( RuntimeException )
+{
+ return new ::comphelper::OEnumerationByIndex(this);
+}
+
+// XIndexAccess
+//------------------------------------------------------------------------------
+sal_Int32 SAL_CALL FormViewPageWindowAdapter::getCount(void) throw( RuntimeException )
+{
+ return m_aControllerList.size();
+}
+
+//------------------------------------------------------------------------------
+Any SAL_CALL FormViewPageWindowAdapter::getByIndex(sal_Int32 nIndex) throw( IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
+{
+ if (nIndex < 0 ||
+ nIndex >= getCount())
+ throw IndexOutOfBoundsException();
+
+ Any aElement;
+ aElement <<= m_aControllerList[nIndex];
+ return aElement;
+}
+
+//------------------------------------------------------------------------
+void SAL_CALL FormViewPageWindowAdapter::makeVisible( const Reference< XControl >& _Control ) throw (RuntimeException)
+{
+ ::vos::OGuard aSolarGuard(Application::GetSolarMutex());
+
+ Reference< XWindow > xWindow( _Control, UNO_QUERY );
+ if ( xWindow.is() && m_pViewImpl->getView() && m_pWindow )
+ {
+ awt::Rectangle aRect = xWindow->getPosSize();
+ ::Rectangle aNewRect( aRect.X, aRect.Y, aRect.X + aRect.Width, aRect.Y + aRect.Height );
+ aNewRect = m_pWindow->PixelToLogic( aNewRect );
+ m_pViewImpl->getView()->MakeVisible( aNewRect, *m_pWindow );
+ }
+}
+
+//------------------------------------------------------------------------
+Reference< XFormController > getControllerSearchChilds( const Reference< XIndexAccess > & xIndex, const Reference< XTabControllerModel > & xModel)
+{
+ if (xIndex.is() && xIndex->getCount())
+ {
+ Reference< XFormController > xController;
+
+ for (sal_Int32 n = xIndex->getCount(); n-- && !xController.is(); )
+ {
+ xIndex->getByIndex(n) >>= xController;
+ if ((XTabControllerModel*)xModel.get() == (XTabControllerModel*)xController->getModel().get())
+ return xController;
+ else
+ {
+ xController = getControllerSearchChilds(Reference< XIndexAccess > (xController, UNO_QUERY), xModel);
+ if ( xController.is() )
+ return xController;
+ }
+ }
+ }
+ return Reference< XFormController > ();
+}
+
+// Search the according controller
+//------------------------------------------------------------------------
+Reference< XFormController > FormViewPageWindowAdapter::getController( const Reference< XForm > & xForm ) const
+{
+ Reference< XTabControllerModel > xModel(xForm, UNO_QUERY);
+ for (::std::vector< Reference< XFormController > >::const_iterator i = m_aControllerList.begin();
+ i != m_aControllerList.end(); i++)
+ {
+ if ((XTabControllerModel*)(*i)->getModel().get() == (XTabControllerModel*)xModel.get())
+ return *i;
+
+ // the current-round controller isn't the right one. perhaps one of it's children ?
+ Reference< XFormController > xChildSearch = getControllerSearchChilds(Reference< XIndexAccess > (*i, UNO_QUERY), xModel);
+ if (xChildSearch.is())
+ return xChildSearch;
+ }
+ return Reference< XFormController > ();
+}
+
+//------------------------------------------------------------------------
+void FormViewPageWindowAdapter::setController(const Reference< XForm > & xForm, const Reference< XFormController >& _rxParentController )
+{
+ DBG_ASSERT( xForm.is(), "FormViewPageWindowAdapter::setController: there should be a form!" );
+ Reference< XIndexAccess > xFormCps(xForm, UNO_QUERY);
+ if (!xFormCps.is())
+ return;
+
+ Reference< XTabControllerModel > xTabOrder(xForm, UNO_QUERY);
+
+ // create a form controller
+ Reference< XFormController > xController( m_aContext.createComponent( FM_FORM_CONTROLLER ), UNO_QUERY );
+ if ( !xController.is() )
+ {
+ ShowServiceNotAvailableError( m_pWindow, FM_FORM_CONTROLLER, sal_True );
+ return;
+ }
+
+ Reference< XInteractionHandler > xHandler;
+ if ( _rxParentController.is() )
+ xHandler = _rxParentController->getInteractionHandler();
+ else
+ {
+ // TODO: should we create a default handler? Not really necessary, since the
+ // FormController itself has a default fallback
+ }
+ if ( xHandler.is() )
+ xController->setInteractionHandler( xHandler );
+
+ xController->setContext( this );
+
+ xController->setModel( xTabOrder );
+ xController->setContainer( m_xControlContainer );
+ xController->activateTabOrder();
+ xController->addActivateListener( m_pViewImpl );
+
+ if ( _rxParentController.is() )
+ _rxParentController->addChildController( xController );
+ else
+ {
+ m_aControllerList.push_back(xController);
+
+ xController->setParent( *this );
+
+ // attaching the events
+ Reference< XEventAttacherManager > xEventManager( xForm->getParent(), UNO_QUERY );
+ Reference< XInterface > xIfc(xController, UNO_QUERY);
+ xEventManager->attach(m_aControllerList.size() - 1, xIfc, makeAny(xController) );
+ }
+
+ // jetzt die Subforms durchgehen
+ sal_uInt32 nLength = xFormCps->getCount();
+ Reference< XForm > xSubForm;
+ for (sal_uInt32 i = 0; i < nLength; i++)
+ {
+ if ( xFormCps->getByIndex(i) >>= xSubForm )
+ setController( xSubForm, xController );
+ }
+}
+
+//------------------------------------------------------------------------
+void FormViewPageWindowAdapter::updateTabOrder( const Reference< XForm >& _rxForm )
+{
+ OSL_PRECOND( _rxForm.is(), "FormViewPageWindowAdapter::updateTabOrder: illegal argument!" );
+ if ( !_rxForm.is() )
+ return;
+
+ try
+ {
+ Reference< XTabController > xTabCtrl( getController( _rxForm ).get() );
+ if ( xTabCtrl.is() )
+ { // if there already is a TabController for this form, then delegate the "updateTabOrder" request
+ xTabCtrl->activateTabOrder();
+ }
+ else
+ { // otherwise, create a TabController
+
+ // if it's a sub form, then we must ensure there exist TabControllers
+ // for all its ancestors, too
+ Reference< XForm > xParentForm( _rxForm->getParent(), UNO_QUERY );
+ // there is a parent form -> look for the respective controller
+ Reference< XFormController > xParentController;
+ if ( xParentForm.is() )
+ xParentController.set( getController( xParentForm ), UNO_QUERY );
+
+ setController( _rxForm, xParentController );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//------------------------------------------------------------------------
+FmXFormView::FmXFormView(const ::comphelper::ComponentContext& _rContext, FmFormView* _pView )
+ :m_aContext( _rContext )
+ ,m_pMarkedGrid(NULL)
+ ,m_pView(_pView)
+ ,m_nActivationEvent(0)
+ ,m_nErrorMessageEvent( 0 )
+ ,m_nAutoFocusEvent( 0 )
+ ,m_nControlWizardEvent( 0 )
+ ,m_pWatchStoredList( NULL )
+ ,m_bFirstActivation( true )
+ ,m_isTabOrderUpdateSuspended( false )
+{
+}
+
+//------------------------------------------------------------------------
+void FmXFormView::cancelEvents()
+{
+ if ( m_nActivationEvent )
+ {
+ Application::RemoveUserEvent( m_nActivationEvent );
+ m_nActivationEvent = 0;
+ }
+
+ if ( m_nErrorMessageEvent )
+ {
+ Application::RemoveUserEvent( m_nErrorMessageEvent );
+ m_nErrorMessageEvent = 0;
+ }
+
+ if ( m_nAutoFocusEvent )
+ {
+ Application::RemoveUserEvent( m_nAutoFocusEvent );
+ m_nAutoFocusEvent = 0;
+ }
+
+ if ( m_nControlWizardEvent )
+ {
+ Application::RemoveUserEvent( m_nControlWizardEvent );
+ m_nControlWizardEvent = 0;
+ }
+}
+
+//------------------------------------------------------------------------
+void FmXFormView::notifyViewDying( )
+{
+ DBG_ASSERT( m_pView, "FmXFormView::notifyViewDying: my view already died!" );
+ m_pView = NULL;
+ cancelEvents();
+}
+
+//------------------------------------------------------------------------
+FmXFormView::~FmXFormView()
+{
+ DBG_ASSERT( m_aPageWindowAdapters.empty(), "FmXFormView::~FmXFormView: Window list not empty!" );
+ if ( !m_aPageWindowAdapters.empty() )
+ {
+ for ( PageWindowAdapterList::const_iterator loop = m_aPageWindowAdapters.begin();
+ loop != m_aPageWindowAdapters.end();
+ ++loop
+ )
+ {
+ (*loop)->dispose();
+ }
+ }
+
+ cancelEvents();
+
+ delete m_pWatchStoredList;
+ m_pWatchStoredList = NULL;
+}
+
+// EventListener
+//------------------------------------------------------------------------------
+void SAL_CALL FmXFormView::disposing(const EventObject& Source) throw( RuntimeException )
+{
+ if ( m_xWindow.is() && Source.Source == m_xWindow )
+ removeGridWindowListening();
+}
+
+// XFormControllerListener
+//------------------------------------------------------------------------------
+void SAL_CALL FmXFormView::formActivated(const EventObject& rEvent) throw( RuntimeException )
+{
+ if ( m_pView && m_pView->GetFormShell() && m_pView->GetFormShell()->GetImpl() )
+ m_pView->GetFormShell()->GetImpl()->formActivated( rEvent );
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXFormView::formDeactivated(const EventObject& rEvent) throw( RuntimeException )
+{
+ if ( m_pView && m_pView->GetFormShell() && m_pView->GetFormShell()->GetImpl() )
+ m_pView->GetFormShell()->GetImpl()->formDeactivated( rEvent );
+}
+
+// XContainerListener
+//------------------------------------------------------------------------------
+void SAL_CALL FmXFormView::elementInserted(const ContainerEvent& evt) throw( RuntimeException )
+{
+ try
+ {
+ Reference< XControlContainer > xControlContainer( evt.Source, UNO_QUERY_THROW );
+ Reference< XControl > xControl( evt.Element, UNO_QUERY_THROW );
+ Reference< XFormComponent > xControlModel( xControl->getModel(), UNO_QUERY_THROW );
+ Reference< XForm > xForm( xControlModel->getParent(), UNO_QUERY_THROW );
+
+ if ( m_isTabOrderUpdateSuspended )
+ {
+ // remember the container and the control, so we can update the tab order on resumeTabOrderUpdate
+ m_aNeedTabOrderUpdate[ xControlContainer ].insert( xForm );
+ }
+ else
+ {
+ PFormViewPageWindowAdapter pAdapter = findWindow( xControlContainer );
+ if ( pAdapter.is() )
+ pAdapter->updateTabOrder( xForm );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXFormView::elementReplaced(const ContainerEvent& evt) throw( RuntimeException )
+{
+ elementInserted(evt);
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FmXFormView::elementRemoved(const ContainerEvent& /*evt*/) throw( RuntimeException )
+{
+}
+
+//------------------------------------------------------------------------------
+PFormViewPageWindowAdapter FmXFormView::findWindow( const Reference< XControlContainer >& _rxCC ) const
+{
+ for ( PageWindowAdapterList::const_iterator i = m_aPageWindowAdapters.begin();
+ i != m_aPageWindowAdapters.end();
+ ++i
+ )
+ {
+ if ( _rxCC == (*i)->getControlContainer() )
+ return *i;
+ }
+ return NULL;
+}
+
+//------------------------------------------------------------------------------
+void FmXFormView::addWindow(const SdrPageWindow& rWindow)
+{
+ FmFormPage* pFormPage = PTR_CAST( FmFormPage, rWindow.GetPageView().GetPage() );
+ if ( !pFormPage )
+ return;
+
+ Reference< XControlContainer > xCC = rWindow.GetControlContainer();
+ if ( xCC.is()
+ && ( !findWindow( xCC ).is() )
+ )
+ {
+ PFormViewPageWindowAdapter pAdapter = new FormViewPageWindowAdapter( m_aContext, rWindow, this );
+ m_aPageWindowAdapters.push_back( pAdapter );
+
+ // Am ControlContainer horchen um Aenderungen mitzbekommen
+ Reference< XContainer > xContainer( xCC, UNO_QUERY );
+ if ( xContainer.is() )
+ xContainer->addContainerListener( this );
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXFormView::removeWindow( const Reference< XControlContainer >& _rxCC )
+{
+ // Wird gerufen, wenn
+ // - in den Design-Modus geschaltet wird
+ // - ein Window geloescht wird, waehrend man im Design-Modus ist
+ // - der Control-Container fuer ein Window entfernt wird, waehrend
+ // der aktive Modus eingeschaltet ist.
+
+ for ( PageWindowAdapterList::iterator i = m_aPageWindowAdapters.begin();
+ i != m_aPageWindowAdapters.end();
+ ++i
+ )
+ {
+ if ( _rxCC != (*i)->getControlContainer() )
+ continue;
+
+ Reference< XContainer > xContainer( _rxCC, UNO_QUERY );
+ if ( xContainer.is() )
+ xContainer->removeContainerListener( this );
+
+ (*i)->dispose();
+ m_aPageWindowAdapters.erase( i );
+ break;
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXFormView::displayAsyncErrorMessage( const SQLErrorEvent& _rEvent )
+{
+ DBG_ASSERT( 0 == m_nErrorMessageEvent, "FmXFormView::displayAsyncErrorMessage: not too fast, please!" );
+ // This should not happen - usually, the PostUserEvent is faster than any possible user
+ // interaction which could trigger a new error. If it happens, we need a queue for the events.
+ m_aAsyncError = _rEvent;
+ m_nErrorMessageEvent = Application::PostUserEvent( LINK( this, FmXFormView, OnDelayedErrorMessage ) );
+}
+
+//------------------------------------------------------------------------------
+IMPL_LINK(FmXFormView, OnDelayedErrorMessage, void*, /*EMPTYTAG*/)
+{
+ m_nErrorMessageEvent = 0;
+ displayException( m_aAsyncError );
+ return 0L;
+}
+
+//------------------------------------------------------------------------------
+void FmXFormView::onFirstViewActivation( const FmFormModel* _pDocModel )
+{
+ if ( _pDocModel && _pDocModel->GetAutoControlFocus() )
+ m_nAutoFocusEvent = Application::PostUserEvent( LINK( this, FmXFormView, OnAutoFocus ) );
+}
+
+//------------------------------------------------------------------------------
+void FmXFormView::suspendTabOrderUpdate()
+{
+ OSL_ENSURE( !m_isTabOrderUpdateSuspended, "FmXFormView::suspendTabOrderUpdate: nesting not allowed!" );
+ m_isTabOrderUpdateSuspended = true;
+}
+
+//------------------------------------------------------------------------------
+void FmXFormView::resumeTabOrderUpdate()
+{
+ OSL_ENSURE( m_isTabOrderUpdateSuspended, "FmXFormView::resumeTabOrderUpdate: not suspended!" );
+ m_isTabOrderUpdateSuspended = false;
+
+ // update the tab orders for all components which were collected since the suspendTabOrderUpdate call.
+ for ( MapControlContainerToSetOfForms::const_iterator container = m_aNeedTabOrderUpdate.begin();
+ container != m_aNeedTabOrderUpdate.end();
+ ++container
+ )
+ {
+ PFormViewPageWindowAdapter pAdapter = findWindow( container->first );
+ if ( !pAdapter.is() )
+ continue;
+
+ for ( SetOfForms::const_iterator form = container->second.begin();
+ form != container->second.end();
+ ++form
+ )
+ {
+ pAdapter->updateTabOrder( *form );
+ }
+ }
+ m_aNeedTabOrderUpdate.clear();
+}
+
+//------------------------------------------------------------------------------
+IMPL_LINK(FmXFormView, OnActivate, void*, /*EMPTYTAG*/)
+{
+ m_nActivationEvent = 0;
+
+ if ( !m_pView )
+ {
+ DBG_ERROR( "FmXFormView::OnActivate: well .... seems we have a timing problem (the view already died)!" );
+ return 0;
+ }
+
+ // setting the controller to activate
+ if (m_pView->GetFormShell() && m_pView->GetActualOutDev() && m_pView->GetActualOutDev()->GetOutDevType() == OUTDEV_WINDOW)
+ {
+ Window* pWindow = const_cast<Window*>(static_cast<const Window*>(m_pView->GetActualOutDev()));
+ PFormViewPageWindowAdapter pAdapter = m_aPageWindowAdapters.empty() ? NULL : m_aPageWindowAdapters[0];
+ for ( PageWindowAdapterList::const_iterator i = m_aPageWindowAdapters.begin();
+ i != m_aPageWindowAdapters.end();
+ ++i
+ )
+ {
+ if ( pWindow == (*i)->getWindow() )
+ pAdapter =*i;
+ }
+
+ if ( pAdapter.get() )
+ {
+ for ( ::std::vector< Reference< XFormController > >::const_iterator i = pAdapter->GetList().begin();
+ i != pAdapter->GetList().end();
+ ++i
+ )
+ {
+ const Reference< XFormController > & xController = *i;
+ if ( !xController.is() )
+ continue;
+
+ // only database forms are to be activated
+ Reference< XRowSet > xForm(xController->getModel(), UNO_QUERY);
+ if ( !xForm.is() || !OStaticDataAccessTools().getRowSetConnection( xForm ).is() )
+ continue;
+
+ Reference< XPropertySet > xFormSet( xForm, UNO_QUERY );
+ ENSURE_OR_CONTINUE( xFormSet.is(), "FmXFormView::OnActivate: a form which does not have properties?" );
+
+ const ::rtl::OUString aSource = ::comphelper::getString( xFormSet->getPropertyValue( FM_PROP_COMMAND ) );
+ if ( aSource.getLength() )
+ {
+ FmXFormShell* pShImpl = m_pView->GetFormShell()->GetImpl();
+ if ( pShImpl )
+ pShImpl->setActiveController( xController );
+ break;
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+//------------------------------------------------------------------------------
+void FmXFormView::Activate(sal_Bool bSync)
+{
+ if (m_nActivationEvent)
+ {
+ Application::RemoveUserEvent(m_nActivationEvent);
+ m_nActivationEvent = 0;
+ }
+
+ if (bSync)
+ {
+ LINK(this,FmXFormView,OnActivate).Call(NULL);
+ }
+ else
+ m_nActivationEvent = Application::PostUserEvent(LINK(this,FmXFormView,OnActivate));
+}
+
+//------------------------------------------------------------------------------
+void FmXFormView::Deactivate(sal_Bool bDeactivateController)
+{
+ if (m_nActivationEvent)
+ {
+ Application::RemoveUserEvent(m_nActivationEvent);
+ m_nActivationEvent = 0;
+ }
+
+ FmXFormShell* pShImpl = m_pView->GetFormShell() ? m_pView->GetFormShell()->GetImpl() : NULL;
+ if (pShImpl && bDeactivateController)
+ pShImpl->setActiveController( NULL );
+}
+
+//------------------------------------------------------------------------------
+FmFormShell* FmXFormView::GetFormShell() const
+{
+ return m_pView ? m_pView->GetFormShell() : NULL;
+}
+// -----------------------------------------------------------------------------
+void FmXFormView::AutoFocus( sal_Bool _bSync )
+{
+ if (m_nAutoFocusEvent)
+ Application::RemoveUserEvent(m_nAutoFocusEvent);
+
+ if ( _bSync )
+ OnAutoFocus( NULL );
+ else
+ m_nAutoFocusEvent = Application::PostUserEvent(LINK(this, FmXFormView, OnAutoFocus));
+}
+
+// -----------------------------------------------------------------------------
+bool FmXFormView::isFocusable( const Reference< XControl >& i_rControl )
+{
+ if ( !i_rControl.is() )
+ return false;
+
+ try
+ {
+ Reference< XPropertySet > xModelProps( i_rControl->getModel(), UNO_QUERY_THROW );
+
+ // only enabled controls are allowed to participate
+ sal_Bool bEnabled = sal_False;
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_ENABLED ) >>= bEnabled );
+ if ( !bEnabled )
+ return false;
+
+ // check the class id of the control model
+ sal_Int16 nClassId = FormComponentType::CONTROL;
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_CLASSID ) >>= nClassId );
+
+ // controls which are not focussable
+ if ( ( FormComponentType::CONTROL != nClassId )
+ && ( FormComponentType::IMAGEBUTTON != nClassId )
+ && ( FormComponentType::GROUPBOX != nClassId )
+ && ( FormComponentType::FIXEDTEXT != nClassId )
+ && ( FormComponentType::HIDDENCONTROL != nClassId )
+ && ( FormComponentType::IMAGECONTROL != nClassId )
+ && ( FormComponentType::SCROLLBAR != nClassId )
+ && ( FormComponentType::SPINBUTTON!= nClassId )
+ )
+ {
+ return true;
+ }
+ }
+ catch( const Exception& e )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+static Reference< XControl > lcl_firstFocussableControl( const Sequence< Reference< XControl > >& _rControls )
+{
+ Reference< XControl > xReturn;
+
+ // loop through all the controls
+ const Reference< XControl >* pControls = _rControls.getConstArray();
+ const Reference< XControl >* pControlsEnd = _rControls.getConstArray() + _rControls.getLength();
+ for ( ; pControls != pControlsEnd; ++pControls )
+ {
+ if ( !pControls->is() )
+ continue;
+
+ if ( FmXFormView::isFocusable( *pControls ) )
+ {
+ xReturn = *pControls;
+ break;
+ }
+ }
+
+ if ( !xReturn.is() && _rControls.getLength() )
+ xReturn = _rControls[0];
+
+ return xReturn;
+}
+
+// -----------------------------------------------------------------------------
+namespace
+{
+ // .........................................................................
+ void lcl_ensureControlsOfFormExist_nothrow( const SdrPage& _rPage, const SdrView& _rView, const Window& _rWindow, const Reference< XForm >& _rxForm )
+ {
+ try
+ {
+ Reference< XInterface > xNormalizedForm( _rxForm, UNO_QUERY_THROW );
+
+ SdrObjListIter aSdrObjectLoop( _rPage, IM_DEEPNOGROUPS );
+ while ( aSdrObjectLoop.IsMore() )
+ {
+ FmFormObj* pFormObject = FmFormObj::GetFormObject( aSdrObjectLoop.Next() );
+ if ( !pFormObject )
+ continue;
+
+ Reference< XChild > xModel( pFormObject->GetUnoControlModel(), UNO_QUERY_THROW );
+ Reference< XInterface > xModelParent( xModel->getParent(), UNO_QUERY_THROW );
+
+ if ( xNormalizedForm.get() != xModelParent.get() )
+ continue;
+
+ pFormObject->GetUnoControl( _rView, _rWindow );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+Reference< XFormController > FmXFormView::getFormController( const Reference< XForm >& _rxForm, const OutputDevice& _rDevice ) const
+{
+ Reference< XFormController > xController;
+
+ for ( PageWindowAdapterList::const_iterator pos = m_aPageWindowAdapters.begin();
+ pos != m_aPageWindowAdapters.end();
+ ++pos
+ )
+ {
+ const PFormViewPageWindowAdapter pAdapter( *pos );
+ ENSURE_OR_CONTINUE( pAdapter.get(), "FmXFormView::getFormController: invalid page window adapter!" );
+ if ( pAdapter->getWindow() != &_rDevice )
+ // wrong device
+ continue;
+
+ xController = pAdapter->getController( _rxForm );
+ if ( xController.is() )
+ break;
+ }
+ return xController;
+}
+
+// -----------------------------------------------------------------------------
+IMPL_LINK(FmXFormView, OnAutoFocus, void*, /*EMPTYTAG*/)
+{
+ m_nAutoFocusEvent = 0;
+
+ // go to the first form of our page, examine it's TabController, go to it's first (in terms of the tab order)
+ // control, give it the focus
+
+ do
+ {
+
+ // get the forms collection of the page we belong to
+ FmFormPage* pPage = m_pView ? PTR_CAST( FmFormPage, m_pView->GetSdrPageView()->GetPage() ) : NULL;
+ Reference< XIndexAccess > xForms( pPage ? Reference< XIndexAccess >( pPage->GetForms(), UNO_QUERY ) : Reference< XIndexAccess >() );
+
+ const PFormViewPageWindowAdapter pAdapter = m_aPageWindowAdapters.empty() ? NULL : m_aPageWindowAdapters[0];
+ const Window* pWindow = pAdapter.get() ? pAdapter->getWindow() : NULL;
+
+ ENSURE_OR_RETURN( xForms.is() && pWindow, "FmXFormView::OnAutoFocus: could not collect all essentials!", 0L );
+
+ try
+ {
+ // go for the tab controller of the first form
+ if ( !xForms->getCount() )
+ break;
+ Reference< XForm > xForm( xForms->getByIndex( 0 ), UNO_QUERY_THROW );
+ Reference< XTabController > xTabController( pAdapter->getController( xForm ), UNO_QUERY_THROW );
+
+ // go for the first control of the controller
+ Sequence< Reference< XControl > > aControls( xTabController->getControls() );
+ if ( aControls.getLength() == 0 )
+ {
+ Reference< XElementAccess > xFormElementAccess( xForm, UNO_QUERY_THROW );
+ if ( xFormElementAccess->hasElements() )
+ {
+ // there are control models in the form, but no controls, yet.
+ // Well, since some time controls are created on demand only. In particular,
+ // they're normally created when they're first painted.
+ // Unfortunately, the FormController does not have any way to
+ // trigger the creation itself, so we must hack this ...
+ lcl_ensureControlsOfFormExist_nothrow( *pPage, *m_pView, *pWindow, xForm );
+ aControls = xTabController->getControls();
+ OSL_ENSURE( aControls.getLength(), "FmXFormView::OnAutoFocus: no controls at all!" );
+ }
+ }
+
+ // set the focus to this first control
+ Reference< XWindow > xControlWindow( lcl_firstFocussableControl( aControls ), UNO_QUERY );
+ if ( !xControlWindow.is() )
+ break;
+
+ xControlWindow->setFocus();
+
+ // ensure that the control is visible
+ // 80210 - 12/07/00 - FS
+ const Window* pCurrentWindow = dynamic_cast< const Window* >( m_pView->GetActualOutDev() );
+ if ( pCurrentWindow )
+ {
+ awt::Rectangle aRect = xControlWindow->getPosSize();
+ ::Rectangle aNonUnoRect( aRect.X, aRect.Y, aRect.X + aRect.Width, aRect.Y + aRect.Height );
+ m_pView->MakeVisible( pCurrentWindow->PixelToLogic( aNonUnoRect ), *const_cast< Window* >( pCurrentWindow ) );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ } // do
+ while ( false );
+
+ return 1L;
+}
+
+// -----------------------------------------------------------------------------
+void FmXFormView::onCreatedFormObject( FmFormObj& _rFormObject )
+{
+ FmFormShell* pShell = m_pView ? m_pView->GetFormShell() : NULL;
+ FmXFormShell* pShellImpl = pShell ? pShell->GetImpl() : NULL;
+ OSL_ENSURE( pShellImpl, "FmXFormView::onCreatedFormObject: no form shell!" );
+ if ( !pShellImpl )
+ return;
+
+ // it is valid that the form shell's forms collection is not initialized, yet
+ pShellImpl->UpdateForms( sal_True );
+
+ m_xLastCreatedControlModel.set( _rFormObject.GetUnoControlModel(), UNO_QUERY );
+ if ( !m_xLastCreatedControlModel.is() )
+ return;
+
+ // some initial property defaults
+ FormControlFactory aControlFactory( m_aContext );
+ aControlFactory.initializeControlModel( pShellImpl->getDocumentType(), _rFormObject );
+
+ if ( !pShellImpl->GetWizardUsing() )
+ return;
+
+ // #i31958# don't call wizards in XForms mode
+ if ( pShellImpl->isEnhancedForm() )
+ return;
+
+ // #i46898# no wizards if there is no Base installed - currently, all wizards are
+ // database related
+ if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) )
+ return;
+
+ if ( m_nControlWizardEvent )
+ Application::RemoveUserEvent( m_nControlWizardEvent );
+ m_nControlWizardEvent = Application::PostUserEvent( LINK( this, FmXFormView, OnStartControlWizard ) );
+}
+
+// -----------------------------------------------------------------------------
+IMPL_LINK( FmXFormView, OnStartControlWizard, void*, /**/ )
+{
+ m_nControlWizardEvent = 0;
+ OSL_PRECOND( m_xLastCreatedControlModel.is(), "FmXFormView::OnStartControlWizard: illegal call!" );
+ if ( !m_xLastCreatedControlModel.is() )
+ return 0L;
+
+ sal_Int16 nClassId = FormComponentType::CONTROL;
+ try
+ {
+ OSL_VERIFY( m_xLastCreatedControlModel->getPropertyValue( FM_PROP_CLASSID ) >>= nClassId );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ const sal_Char* pWizardAsciiName = NULL;
+ switch ( nClassId )
+ {
+ case FormComponentType::GRIDCONTROL:
+ pWizardAsciiName = "com.sun.star.sdb.GridControlAutoPilot";
+ break;
+ case FormComponentType::LISTBOX:
+ case FormComponentType::COMBOBOX:
+ pWizardAsciiName = "com.sun.star.sdb.ListComboBoxAutoPilot";
+ break;
+ case FormComponentType::GROUPBOX:
+ pWizardAsciiName = "com.sun.star.sdb.GroupBoxAutoPilot";
+ break;
+ }
+
+ if ( pWizardAsciiName )
+ {
+ // build the argument list
+ ::comphelper::NamedValueCollection aWizardArgs;
+ aWizardArgs.put( "ObjectModel", m_xLastCreatedControlModel );
+
+ // create the wizard object
+ Reference< XExecutableDialog > xWizard;
+ try
+ {
+ m_aContext.createComponentWithArguments( pWizardAsciiName, aWizardArgs.getWrappedPropertyValues(), xWizard );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ if ( !xWizard.is() )
+ {
+ ShowServiceNotAvailableError( NULL, String::CreateFromAscii( pWizardAsciiName ), sal_True );
+ }
+ else
+ {
+ // execute the wizard
+ try
+ {
+ xWizard->execute();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+
+ m_xLastCreatedControlModel.clear();
+ return 1L;
+}
+
+// -----------------------------------------------------------------------------
+namespace
+{
+ void lcl_insertIntoFormComponentHierarchy_throw( const FmFormView& _rView, const SdrUnoObj& _rSdrObj,
+ const Reference< XDataSource >& _rxDataSource = NULL, const ::rtl::OUString& _rDataSourceName = ::rtl::OUString(),
+ const ::rtl::OUString& _rCommand = ::rtl::OUString(), const sal_Int32 _nCommandType = -1 )
+ {
+ FmFormPage& rPage = static_cast< FmFormPage& >( *_rView.GetSdrPageView()->GetPage() );
+
+ Reference< XFormComponent > xFormComponent( _rSdrObj.GetUnoControlModel(), UNO_QUERY_THROW );
+ Reference< XForm > xTargetForm(
+ rPage.GetImpl().findPlaceInFormComponentHierarchy( xFormComponent, _rxDataSource, _rDataSourceName, _rCommand, _nCommandType ),
+ UNO_SET_THROW );
+
+ rPage.GetImpl().setUniqueName( xFormComponent, xTargetForm );
+
+ Reference< XIndexContainer > xFormAsContainer( xTargetForm, UNO_QUERY_THROW );
+ xFormAsContainer->insertByIndex( xFormAsContainer->getCount(), makeAny( xFormComponent ) );
+ }
+}
+
+// -----------------------------------------------------------------------------
+SdrObject* FmXFormView::implCreateFieldControl( const ::svx::ODataAccessDescriptor& _rColumnDescriptor )
+{
+ // not if we're in design mode
+ if ( !m_pView->IsDesignMode() )
+ return NULL;
+
+ ::rtl::OUString sCommand, sFieldName;
+ sal_Int32 nCommandType = CommandType::COMMAND;
+ SharedConnection xConnection;
+
+ ::rtl::OUString sDataSource = _rColumnDescriptor.getDataSource();
+ _rColumnDescriptor[ daCommand ] >>= sCommand;
+ _rColumnDescriptor[ daColumnName ] >>= sFieldName;
+ _rColumnDescriptor[ daCommandType ] >>= nCommandType;
+ {
+ Reference< XConnection > xExternalConnection;
+ _rColumnDescriptor[ daConnection ] >>= xExternalConnection;
+ xConnection.reset( xExternalConnection, SharedConnection::NoTakeOwnership );
+ }
+
+ if ( !sCommand.getLength()
+ || !sFieldName.getLength()
+ || ( !sDataSource.getLength()
+ && !xConnection.is()
+ )
+ )
+ {
+ DBG_ERROR( "FmXFormView::implCreateFieldControl: nonsense!" );
+ }
+
+ Reference< XDataSource > xDataSource;
+ SQLErrorEvent aError;
+ try
+ {
+ if ( xConnection.is() && !xDataSource.is() && !sDataSource.getLength() )
+ {
+ Reference< XChild > xChild( xConnection, UNO_QUERY );
+ if ( xChild.is() )
+ xDataSource = xDataSource.query( xChild->getParent() );
+ }
+
+ // obtain the data source
+ if ( !xDataSource.is() )
+ xDataSource = OStaticDataAccessTools().getDataSource( sDataSource, m_aContext.getLegacyServiceFactory() );
+
+ // and the connection, if necessary
+ if ( !xConnection.is() )
+ xConnection.reset( OStaticDataAccessTools().getConnection_withFeedback(
+ sDataSource,
+ ::rtl::OUString(),
+ ::rtl::OUString(),
+ m_aContext.getLegacyServiceFactory()
+ ) );
+ }
+ catch ( const SQLException& )
+ {
+ aError.Reason = ::cppu::getCaughtException();
+ }
+ catch( const Exception& ) { /* will be asserted below */ }
+ if (aError.Reason.hasValue())
+ {
+ displayAsyncErrorMessage( aError );
+ return NULL;
+ }
+
+ // need a data source and a connection here
+ if (!xDataSource.is() || !xConnection.is())
+ {
+ DBG_ERROR("FmXFormView::implCreateFieldControl : could not retrieve the data source or the connection!");
+ return NULL;
+ }
+
+ OStaticDataAccessTools aDBATools;
+ Reference< XComponent > xKeepFieldsAlive;
+ // go
+ try
+ {
+ // determine the table/query field which we should create a control for
+ Reference< XPropertySet > xField;
+
+ Reference< XNameAccess > xFields = aDBATools.getFieldsByCommandDescriptor(
+ xConnection, nCommandType, sCommand, xKeepFieldsAlive );
+
+ if (xFields.is() && xFields->hasByName(sFieldName))
+ xFields->getByName(sFieldName) >>= xField;
+ if ( !xField.is() )
+ return NULL;
+
+ Reference< XNumberFormatsSupplier > xSupplier( aDBATools.getNumberFormats( xConnection, sal_False ), UNO_SET_THROW );
+ Reference< XNumberFormats > xNumberFormats( xSupplier->getNumberFormats(), UNO_SET_THROW );
+
+ ::rtl::OUString sLabelPostfix;
+
+ ////////////////////////////////////////////////////////////////
+ // nur fuer Textgroesse
+ OutputDevice* pOutDev = NULL;
+ if (m_pView->GetActualOutDev() && m_pView->GetActualOutDev()->GetOutDevType() == OUTDEV_WINDOW)
+ pOutDev = const_cast<OutputDevice*>(m_pView->GetActualOutDev());
+ else
+ {// OutDev suchen
+ SdrPageView* pPageView = m_pView->GetSdrPageView();
+ if( pPageView && !pOutDev )
+ {
+ // const SdrPageViewWinList& rWinList = pPageView->GetWinList();
+ // const SdrPageViewWindows& rPageViewWindows = pPageView->GetPageViewWindows();
+
+ for( sal_uInt32 i = 0L; i < pPageView->PageWindowCount(); i++ )
+ {
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(i);
+
+ if( rPageWindow.GetPaintWindow().OutputToWindow())
+ {
+ pOutDev = &rPageWindow.GetPaintWindow().GetOutputDevice();
+ break;
+ }
+ }
+ }
+ }
+
+ if ( !pOutDev )
+ return NULL;
+
+ sal_Int32 nDataType = ::comphelper::getINT32(xField->getPropertyValue(FM_PROP_FIELDTYPE));
+ if ((DataType::BINARY == nDataType) || (DataType::VARBINARY == nDataType))
+ return NULL;
+
+ //////////////////////////////////////////////////////////////////////
+ // determine the control type by examining the data type of the bound column
+ sal_uInt16 nOBJID = 0;
+ sal_Bool bDateNTimeField = sal_False;
+
+ sal_Bool bIsCurrency = sal_False;
+ if (::comphelper::hasProperty(FM_PROP_ISCURRENCY, xField))
+ bIsCurrency = ::comphelper::getBOOL(xField->getPropertyValue(FM_PROP_ISCURRENCY));
+
+ if (bIsCurrency)
+ nOBJID = OBJ_FM_CURRENCYFIELD;
+ else
+ switch (nDataType)
+ {
+ case DataType::BLOB:
+ case DataType::LONGVARBINARY:
+ nOBJID = OBJ_FM_IMAGECONTROL;
+ break;
+ case DataType::LONGVARCHAR:
+ case DataType::CLOB:
+ nOBJID = OBJ_FM_EDIT;
+ break;
+ case DataType::BINARY:
+ case DataType::VARBINARY:
+ return NULL;
+ case DataType::BIT:
+ case DataType::BOOLEAN:
+ nOBJID = OBJ_FM_CHECKBOX;
+ break;
+ case DataType::TINYINT:
+ case DataType::SMALLINT:
+ case DataType::INTEGER:
+ nOBJID = OBJ_FM_NUMERICFIELD;
+ break;
+ case DataType::REAL:
+ case DataType::DOUBLE:
+ case DataType::NUMERIC:
+ case DataType::DECIMAL:
+ nOBJID = OBJ_FM_FORMATTEDFIELD;
+ break;
+ case DataType::TIMESTAMP:
+ bDateNTimeField = sal_True;
+ sLabelPostfix = String( SVX_RES( RID_STR_POSTFIX_DATE ) );
+ // DON'T break !
+ case DataType::DATE:
+ nOBJID = OBJ_FM_DATEFIELD;
+ break;
+ case DataType::TIME:
+ nOBJID = OBJ_FM_TIMEFIELD;
+ break;
+ case DataType::CHAR:
+ case DataType::VARCHAR:
+ default:
+ nOBJID = OBJ_FM_EDIT;
+ break;
+ }
+ if (!nOBJID)
+ return NULL;
+
+ SdrUnoObj* pLabel( NULL );
+ SdrUnoObj* pControl( NULL );
+ if ( !createControlLabelPair( *pOutDev, 0, 0, xField, xNumberFormats, nOBJID, sLabelPostfix,
+ pLabel, pControl, xDataSource, sDataSource, sCommand, nCommandType )
+ )
+ {
+ return NULL;
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // group objects
+ bool bCheckbox = ( OBJ_FM_CHECKBOX == nOBJID );
+ OSL_ENSURE( !bCheckbox || !pLabel, "FmXFormView::implCreateFieldControl: why was there a label created for a check box?" );
+ if ( bCheckbox )
+ return pControl;
+
+ SdrObjGroup* pGroup = new SdrObjGroup();
+ SdrObjList* pObjList = pGroup->GetSubList();
+ pObjList->InsertObject( pLabel );
+ pObjList->InsertObject( pControl );
+
+ if ( bDateNTimeField )
+ { // so far we created a date field only, but we also need a time field
+ pLabel = pControl = NULL;
+ if ( createControlLabelPair( *pOutDev, 0, 1000, xField, xNumberFormats, OBJ_FM_TIMEFIELD,
+ String( SVX_RES( RID_STR_POSTFIX_TIME ) ), pLabel, pControl,
+ xDataSource, sDataSource, sCommand, nCommandType )
+ )
+ {
+ pObjList->InsertObject( pLabel );
+ pObjList->InsertObject( pControl );
+ }
+ }
+
+ return pGroup; // und fertig
+ }
+ catch(const Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------------
+SdrObject* FmXFormView::implCreateXFormsControl( const ::svx::OXFormsDescriptor &_rDesc )
+{
+ // not if we're in design mode
+ if ( !m_pView->IsDesignMode() )
+ return NULL;
+
+ Reference< XComponent > xKeepFieldsAlive;
+
+ // go
+ try
+ {
+ // determine the table/query field which we should create a control for
+ Reference< XNumberFormats > xNumberFormats;
+ ::rtl::OUString sLabelPostfix = _rDesc.szName;
+
+ ////////////////////////////////////////////////////////////////
+ // nur fuer Textgroesse
+ OutputDevice* pOutDev = NULL;
+ if (m_pView->GetActualOutDev() && m_pView->GetActualOutDev()->GetOutDevType() == OUTDEV_WINDOW)
+ pOutDev = const_cast<OutputDevice*>(m_pView->GetActualOutDev());
+ else
+ {// OutDev suchen
+ SdrPageView* pPageView = m_pView->GetSdrPageView();
+ if( pPageView && !pOutDev )
+ {
+ // const SdrPageViewWinList& rWinList = pPageView->GetWinList();
+ // const SdrPageViewWindows& rPageViewWindows = pPageView->GetPageViewWindows();
+
+ for( sal_uInt32 i = 0L; i < pPageView->PageWindowCount(); i++ )
+ {
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(i);
+
+ if( rPageWindow.GetPaintWindow().GetOutputDevice().GetOutDevType() == OUTDEV_WINDOW)
+ {
+ pOutDev = &rPageWindow.GetPaintWindow().GetOutputDevice();
+ break;
+ }
+ }
+ }
+ }
+
+ if ( !pOutDev )
+ return NULL;
+
+ //////////////////////////////////////////////////////////////////////
+ // The service name decides which control should be created
+ sal_uInt16 nOBJID = OBJ_FM_EDIT;
+ if(::rtl::OUString(_rDesc.szServiceName).equals((::rtl::OUString)FM_SUN_COMPONENT_NUMERICFIELD))
+ nOBJID = OBJ_FM_NUMERICFIELD;
+ if(::rtl::OUString(_rDesc.szServiceName).equals((::rtl::OUString)FM_SUN_COMPONENT_CHECKBOX))
+ nOBJID = OBJ_FM_CHECKBOX;
+ if(::rtl::OUString(_rDesc.szServiceName).equals((::rtl::OUString)FM_COMPONENT_COMMANDBUTTON))
+ nOBJID = OBJ_FM_BUTTON;
+
+ typedef ::com::sun::star::form::submission::XSubmission XSubmission_t;
+ Reference< XSubmission_t > xSubmission(_rDesc.xPropSet, UNO_QUERY);
+
+ // xform control or submission button?
+ if ( !xSubmission.is() )
+ {
+ SdrUnoObj* pLabel( NULL );
+ SdrUnoObj* pControl( NULL );
+ if ( !createControlLabelPair( *pOutDev, 0, 0, NULL, xNumberFormats, nOBJID, sLabelPostfix,
+ pLabel, pControl )
+ )
+ {
+ return NULL;
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // Now build the connection between the control and the data item.
+ Reference< XValueBinding > xValueBinding(_rDesc.xPropSet,UNO_QUERY);
+ Reference< XBindableValue > xBindableValue(pControl->GetUnoControlModel(),UNO_QUERY);
+
+ DBG_ASSERT( xBindableValue.is(), "FmXFormView::implCreateXFormsControl: control's not bindable!" );
+ if ( xBindableValue.is() )
+ xBindableValue->setValueBinding(xValueBinding);
+
+ bool bCheckbox = ( OBJ_FM_CHECKBOX == nOBJID );
+ OSL_ENSURE( !bCheckbox || !pLabel, "FmXFormView::implCreateXFormsControl: why was there a label created for a check box?" );
+ if ( bCheckbox )
+ return pControl;
+
+ //////////////////////////////////////////////////////////////////////
+ // group objects
+ SdrObjGroup* pGroup = new SdrObjGroup();
+ SdrObjList* pObjList = pGroup->GetSubList();
+ pObjList->InsertObject(pLabel);
+ pObjList->InsertObject(pControl);
+
+ return pGroup;
+ }
+ else {
+
+ // create a button control
+ const MapMode eTargetMode( pOutDev->GetMapMode() );
+ const MapMode eSourceMode(MAP_100TH_MM);
+ const sal_uInt16 nObjID = OBJ_FM_BUTTON;
+ ::Size controlSize(4000, 500);
+ FmFormObj *pControl = static_cast<FmFormObj*>(SdrObjFactory::MakeNewObject( FmFormInventor, nObjID, NULL, NULL ));
+ controlSize.Width() = Fraction(controlSize.Width(), 1) * eTargetMode.GetScaleX();
+ controlSize.Height() = Fraction(controlSize.Height(), 1) * eTargetMode.GetScaleY();
+ ::Point controlPos( pOutDev->LogicToLogic( ::Point( controlSize.Width(), 0 ), eSourceMode, eTargetMode ) );
+ ::Rectangle controlRect( controlPos, pOutDev->LogicToLogic( controlSize, eSourceMode, eTargetMode ) );
+ pControl->SetLogicRect(controlRect);
+
+ // set the button label
+ Reference< XPropertySet > xControlSet(pControl->GetUnoControlModel(), UNO_QUERY);
+ xControlSet->setPropertyValue(FM_PROP_LABEL, makeAny(::rtl::OUString(_rDesc.szName)));
+
+ // connect the submission with the submission supplier (aka the button)
+ xControlSet->setPropertyValue( FM_PROP_BUTTON_TYPE,
+ makeAny( FormButtonType_SUBMIT ) );
+ typedef ::com::sun::star::form::submission::XSubmissionSupplier XSubmissionSupplier_t;
+ Reference< XSubmissionSupplier_t > xSubmissionSupplier(pControl->GetUnoControlModel(), UNO_QUERY);
+ xSubmissionSupplier->setSubmission(xSubmission);
+
+ return pControl;
+ }
+ }
+ catch(const Exception&)
+ {
+ DBG_ERROR("FmXFormView::implCreateXFormsControl: caught an exception while creating the control !");
+ }
+
+
+ return NULL;
+}
+
+//------------------------------------------------------------------------
+bool FmXFormView::createControlLabelPair( OutputDevice& _rOutDev, sal_Int32 _nXOffsetMM, sal_Int32 _nYOffsetMM,
+ const Reference< XPropertySet >& _rxField, const Reference< XNumberFormats >& _rxNumberFormats,
+ sal_uInt16 _nControlObjectID, const ::rtl::OUString& _rFieldPostfix,
+ SdrUnoObj*& _rpLabel, SdrUnoObj*& _rpControl,
+ const Reference< XDataSource >& _rxDataSource, const ::rtl::OUString& _rDataSourceName,
+ const ::rtl::OUString& _rCommand, const sal_Int32 _nCommandType )
+{
+ if ( !createControlLabelPair( m_aContext, _rOutDev, _nXOffsetMM, _nYOffsetMM,
+ _rxField, _rxNumberFormats, _nControlObjectID, _rFieldPostfix, FmFormInventor, OBJ_FM_FIXEDTEXT,
+ NULL, NULL, NULL, _rpLabel, _rpControl )
+ )
+ return false;
+
+ // insert the control model(s) into the form component hierachy
+ if ( _rpLabel )
+ lcl_insertIntoFormComponentHierarchy_throw( *m_pView, *_rpLabel, _rxDataSource, _rDataSourceName, _rCommand, _nCommandType );
+ lcl_insertIntoFormComponentHierarchy_throw( *m_pView, *_rpControl, _rxDataSource, _rDataSourceName, _rCommand, _nCommandType );
+
+ // some context-dependent initializations
+ FormControlFactory aControlFactory( m_aContext );
+ if ( _rpLabel )
+ aControlFactory.initializeControlModel( impl_getDocumentType(), *_rpLabel );
+ aControlFactory.initializeControlModel( impl_getDocumentType(), *_rpControl );
+
+ return true;
+}
+
+//------------------------------------------------------------------------
+bool FmXFormView::createControlLabelPair( const ::comphelper::ComponentContext& _rContext,
+ OutputDevice& _rOutDev, sal_Int32 _nXOffsetMM, sal_Int32 _nYOffsetMM, const Reference< XPropertySet >& _rxField,
+ const Reference< XNumberFormats >& _rxNumberFormats, sal_uInt16 _nControlObjectID,
+ const ::rtl::OUString& _rFieldPostfix, sal_uInt32 _nInventor, sal_uInt16 _nLabelObjectID,
+ SdrPage* _pLabelPage, SdrPage* _pControlPage, SdrModel* _pModel, SdrUnoObj*& _rpLabel, SdrUnoObj*& _rpControl)
+{
+ sal_Int32 nDataType = 0;
+ ::rtl::OUString sFieldName;
+ Any aFieldName;
+ if ( _rxField.is() )
+ {
+ nDataType = ::comphelper::getINT32(_rxField->getPropertyValue(FM_PROP_FIELDTYPE));
+ aFieldName = Any(_rxField->getPropertyValue(FM_PROP_NAME));
+ aFieldName >>= sFieldName;
+ }
+
+ // calculate the positions, respecting the settings of the target device
+ ::Size aTextSize( _rOutDev.GetTextWidth(sFieldName + _rFieldPostfix), _rOutDev.GetTextHeight() );
+
+ MapMode eTargetMode( _rOutDev.GetMapMode() ),
+ eSourceMode( MAP_100TH_MM );
+
+ // Textbreite ist mindestens 4cm
+ // Texthoehe immer halber cm
+ ::Size aDefTxtSize(4000, 500);
+ ::Size aDefSize(4000, 500);
+ ::Size aDefImageSize(4000, 4000);
+
+ ::Size aRealSize = _rOutDev.LogicToLogic(aTextSize, eTargetMode, eSourceMode);
+ aRealSize.Width() = std::max(aRealSize.Width(), aDefTxtSize.Width());
+ aRealSize.Height()= aDefSize.Height();
+
+ // adjust to scaling of the target device (#53523#)
+ aRealSize.Width() = long(Fraction(aRealSize.Width(), 1) * eTargetMode.GetScaleX());
+ aRealSize.Height() = long(Fraction(aRealSize.Height(), 1) * eTargetMode.GetScaleY());
+
+ // for boolean fields, we do not create a label, but just a checkbox
+ bool bNeedLabel = ( _nControlObjectID != OBJ_FM_CHECKBOX );
+
+ // the label
+ ::std::auto_ptr< SdrUnoObj > pLabel;
+ Reference< XPropertySet > xLabelModel;
+ if ( bNeedLabel )
+ {
+ pLabel.reset( dynamic_cast< SdrUnoObj* >(
+ SdrObjFactory::MakeNewObject( _nInventor, _nLabelObjectID, _pLabelPage, _pModel ) ) );
+ OSL_ENSURE( pLabel.get(), "FmXFormView::createControlLabelPair: could not create the label!" );
+ if ( !pLabel.get() )
+ return false;
+
+ xLabelModel.set( pLabel->GetUnoControlModel(), UNO_QUERY );
+ if ( xLabelModel.is() )
+ {
+ ::rtl::OUString sLabel;
+ if ( _rxField.is() && _rxField->getPropertySetInfo()->hasPropertyByName(FM_PROP_LABEL) )
+ _rxField->getPropertyValue(FM_PROP_LABEL) >>= sLabel;
+ if ( !sLabel.getLength() )
+ sLabel = sFieldName;
+
+ xLabelModel->setPropertyValue( FM_PROP_LABEL, makeAny( sLabel + _rFieldPostfix ) );
+ String sObjectLabel( SVX_RES( RID_STR_OBJECT_LABEL ) );
+ sObjectLabel.SearchAndReplaceAllAscii( "#object#", sFieldName );
+ xLabelModel->setPropertyValue( FM_PROP_NAME, makeAny( ::rtl::OUString( sObjectLabel ) ) );
+ }
+
+ pLabel->SetLogicRect( ::Rectangle(
+ _rOutDev.LogicToLogic( ::Point( _nXOffsetMM, _nYOffsetMM ), eSourceMode, eTargetMode ),
+ _rOutDev.LogicToLogic( aRealSize, eSourceMode, eTargetMode )
+ ) );
+ }
+
+ // the control
+ ::std::auto_ptr< SdrUnoObj > pControl( dynamic_cast< SdrUnoObj* >(
+ SdrObjFactory::MakeNewObject( _nInventor, _nControlObjectID, _pControlPage, _pModel ) ) );
+ OSL_ENSURE( pControl.get(), "FmXFormView::createControlLabelPair: could not create the control!" );
+ if ( !pControl.get() )
+ return false;
+
+ Reference< XPropertySet > xControlSet( pControl->GetUnoControlModel(), UNO_QUERY );
+ if ( !xControlSet.is() )
+ return false;
+
+ // size of the control
+ ::Size aControlSize( aDefSize );
+ switch ( nDataType )
+ {
+ case DataType::BIT:
+ case DataType::BOOLEAN:
+ aControlSize = aDefSize;
+ break;
+ case DataType::LONGVARCHAR:
+ case DataType::CLOB:
+ case DataType::LONGVARBINARY:
+ case DataType::BLOB:
+ aControlSize = aDefImageSize;
+ break;
+ }
+
+ if ( OBJ_FM_IMAGECONTROL == _nControlObjectID )
+ aControlSize = aDefImageSize;
+
+ aControlSize.Width() = long(Fraction(aControlSize.Width(), 1) * eTargetMode.GetScaleX());
+ aControlSize.Height() = long(Fraction(aControlSize.Height(), 1) * eTargetMode.GetScaleY());
+
+ pControl->SetLogicRect( ::Rectangle(
+ _rOutDev.LogicToLogic( ::Point( aRealSize.Width() + _nXOffsetMM, _nYOffsetMM ), eSourceMode, eTargetMode ),
+ _rOutDev.LogicToLogic( aControlSize, eSourceMode, eTargetMode )
+ ) );
+
+ // some initializations
+ Reference< XPropertySetInfo > xControlPropInfo = xControlSet->getPropertySetInfo();
+
+ if ( aFieldName.hasValue() )
+ {
+ xControlSet->setPropertyValue( FM_PROP_CONTROLSOURCE, aFieldName );
+ xControlSet->setPropertyValue( FM_PROP_NAME, aFieldName );
+ if ( !bNeedLabel )
+ {
+ // no dedicated label control => use the label property
+ if ( xControlPropInfo->hasPropertyByName( FM_PROP_LABEL ) )
+ xControlSet->setPropertyValue( FM_PROP_LABEL, makeAny( sFieldName + _rFieldPostfix ) );
+ else
+ OSL_ENSURE( false, "FmXFormView::createControlLabelPair: can't set a label for the control!" );
+ }
+ }
+
+ if ( (nDataType == DataType::LONGVARCHAR || nDataType == DataType::CLOB) && xControlPropInfo->hasPropertyByName( FM_PROP_MULTILINE ) )
+ {
+ xControlSet->setPropertyValue( FM_PROP_MULTILINE, makeAny( sal_Bool( sal_True ) ) );
+ }
+
+ // announce the label to the control
+ if ( xControlPropInfo->hasPropertyByName( FM_PROP_CONTROLLABEL ) && xLabelModel.is() )
+ {
+ try
+ {
+ xControlSet->setPropertyValue( FM_PROP_CONTROLLABEL, makeAny( xLabelModel ) );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ if ( _rxField.is() )
+ {
+ FormControlFactory aControlFactory( _rContext );
+ aControlFactory.initializeFieldDependentProperties( _rxField, xControlSet, _rxNumberFormats );
+ }
+
+ _rpLabel = pLabel.release();
+ _rpControl = pControl.release();
+ return true;
+}
+
+//------------------------------------------------------------------------------
+FmXFormView::ObjectRemoveListener::ObjectRemoveListener( FmXFormView* pParent )
+ :m_pParent( pParent )
+{
+}
+
+//------------------------------------------------------------------------------
+void FmXFormView::ObjectRemoveListener::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
+{
+ if (rHint.ISA(SdrHint) && (((SdrHint&)rHint).GetKind() == HINT_OBJREMOVED))
+ m_pParent->ObjectRemovedInAliveMode(((SdrHint&)rHint).GetObject());
+}
+
+//------------------------------------------------------------------------------
+void FmXFormView::ObjectRemovedInAliveMode( const SdrObject* pObject )
+{
+ // wenn das entfernte Objekt in meiner MarkList, die ich mir beim Umschalten in den Alive-Mode gemerkt habe, steht,
+ // muss ich es jetzt da rausnehmen, da ich sonst beim Zurueckschalten versuche, die Markierung wieder zu setzen
+ // (interesanterweise geht das nur bei gruppierten Objekten schief (beim Zugriff auf deren ObjList GPF), nicht bei einzelnen)
+
+ sal_uIntPtr nCount = m_aMark.GetMarkCount();
+ for (sal_uIntPtr i = 0; i < nCount; ++i)
+ {
+ SdrMark* pMark = m_aMark.GetMark(i);
+ SdrObject* pCurrent = pMark->GetMarkedSdrObj();
+ if (pObject == pCurrent)
+ {
+ m_aMark.DeleteMark(i);
+ return;
+ }
+ // ich brauche nicht in GroupObjects absteigen : wenn dort unten ein Objekt geloescht wird, dann bleibt der
+ // Zeiger auf das GroupObject, den ich habe, trotzdem weiter gueltig bleibt ...
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXFormView::stopMarkListWatching()
+{
+ if ( m_pWatchStoredList )
+ {
+ m_pWatchStoredList->EndListeningAll();
+ delete m_pWatchStoredList;
+ m_pWatchStoredList = NULL;
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXFormView::startMarkListWatching()
+{
+ if ( !m_pWatchStoredList )
+ {
+ m_pWatchStoredList = new ObjectRemoveListener( this );
+ FmFormModel* pModel = GetFormShell() ? GetFormShell()->GetFormModel() : NULL;
+ DBG_ASSERT( pModel != NULL, "FmXFormView::startMarkListWatching: shell has no model!" );
+ m_pWatchStoredList->StartListening( *static_cast< SfxBroadcaster* >( pModel ) );
+ }
+ else
+ {
+ DBG_ERROR( "FmXFormView::startMarkListWatching: already listening!" );
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXFormView::saveMarkList( sal_Bool _bSmartUnmark )
+{
+ if ( m_pView )
+ {
+ m_aMark = m_pView->GetMarkedObjectList();
+ if ( _bSmartUnmark )
+ {
+ sal_uIntPtr nCount = m_aMark.GetMarkCount( );
+ for ( sal_uIntPtr i = 0; i < nCount; ++i )
+ {
+ SdrMark* pMark = m_aMark.GetMark(i);
+ SdrObject* pObj = pMark->GetMarkedSdrObj();
+
+ if ( m_pView->IsObjMarked( pObj ) )
+ {
+ if ( pObj->IsGroupObject() )
+ {
+ SdrObjListIter aIter( *pObj->GetSubList() );
+ sal_Bool bMixed = sal_False;
+ while ( aIter.IsMore() && !bMixed )
+ bMixed = ( aIter.Next()->GetObjInventor() != FmFormInventor );
+
+ if ( !bMixed )
+ {
+ // all objects in the group are form objects
+ m_pView->MarkObj( pMark->GetMarkedSdrObj(), pMark->GetPageView(), sal_True /* unmark! */ );
+ }
+ }
+ else
+ {
+ if ( pObj->GetObjInventor() == FmFormInventor )
+ { // this is a form layer object
+ m_pView->MarkObj( pMark->GetMarkedSdrObj(), pMark->GetPageView(), sal_True /* unmark! */ );
+ }
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ DBG_ERROR( "FmXFormView::saveMarkList: invalid view!" );
+ m_aMark = SdrMarkList();
+ }
+}
+
+//--------------------------------------------------------------------------
+static sal_Bool lcl_hasObject( SdrObjListIter& rIter, SdrObject* pObj )
+{
+ sal_Bool bFound = sal_False;
+ while (rIter.IsMore() && !bFound)
+ bFound = pObj == rIter.Next();
+
+ rIter.Reset();
+ return bFound;
+}
+
+//------------------------------------------------------------------------------
+void FmXFormView::restoreMarkList( SdrMarkList& _rRestoredMarkList )
+{
+ if ( !m_pView )
+ return;
+
+ _rRestoredMarkList.Clear();
+
+ const SdrMarkList& rCurrentList = m_pView->GetMarkedObjectList();
+ FmFormPage* pPage = GetFormShell() ? GetFormShell()->GetCurPage() : NULL;
+ if (pPage)
+ {
+ if (rCurrentList.GetMarkCount())
+ { // there is a current mark ... hmm. Is it a subset of the mark we remembered in saveMarkList?
+ sal_Bool bMisMatch = sal_False;
+
+ // loop through all current marks
+ sal_uIntPtr nCurrentCount = rCurrentList.GetMarkCount();
+ for ( sal_uIntPtr i=0; i<nCurrentCount&& !bMisMatch; ++i )
+ {
+ const SdrObject* pCurrentMarked = rCurrentList.GetMark( i )->GetMarkedSdrObj();
+
+ // loop through all saved marks, check for equality
+ sal_Bool bFound = sal_False;
+ sal_uIntPtr nSavedCount = m_aMark.GetMarkCount();
+ for ( sal_uIntPtr j=0; j<nSavedCount && !bFound; ++j )
+ {
+ if ( m_aMark.GetMark( j )->GetMarkedSdrObj() == pCurrentMarked )
+ bFound = sal_True;
+ }
+
+ // did not find a current mark in the saved marks
+ if ( !bFound )
+ bMisMatch = sal_True;
+ }
+
+ if ( bMisMatch )
+ {
+ m_aMark.Clear();
+ _rRestoredMarkList = rCurrentList;
+ return;
+ }
+ }
+ // wichtig ist das auf die Objecte der markliste nicht zugegriffen wird
+ // da diese bereits zerstoert sein koennen
+ SdrPageView* pCurPageView = m_pView->GetSdrPageView();
+ SdrObjListIter aPageIter( *pPage );
+ sal_Bool bFound = sal_True;
+
+ // gibt es noch alle Objecte
+ sal_uIntPtr nCount = m_aMark.GetMarkCount();
+ for (sal_uIntPtr i = 0; i < nCount && bFound; i++)
+ {
+ SdrMark* pMark = m_aMark.GetMark(i);
+ SdrObject* pObj = pMark->GetMarkedSdrObj();
+ if (pObj->IsGroupObject())
+ {
+ SdrObjListIter aIter(*pObj->GetSubList());
+ while (aIter.IsMore() && bFound)
+ bFound = lcl_hasObject(aPageIter, aIter.Next());
+ }
+ else
+ bFound = lcl_hasObject(aPageIter, pObj);
+
+ bFound = bFound && pCurPageView == pMark->GetPageView();
+ }
+
+ if (bFound)
+ {
+ // Das LastObject auswerten
+ if (nCount) // Objecte jetzt Markieren
+ {
+ for (sal_uIntPtr i = 0; i < nCount; i++)
+ {
+ SdrMark* pMark = m_aMark.GetMark(i);
+ SdrObject* pObj = pMark->GetMarkedSdrObj();
+ if ( pObj->GetObjInventor() == FmFormInventor )
+ if ( !m_pView->IsObjMarked( pObj ) )
+ m_pView->MarkObj( pObj, pMark->GetPageView() );
+ }
+
+ _rRestoredMarkList = m_aMark;
+ }
+ }
+ m_aMark.Clear();
+ }
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL FmXFormView::focusGained( const FocusEvent& /*e*/ ) throw (RuntimeException)
+{
+ if ( m_xWindow.is() && m_pView )
+ {
+ m_pView->SetMoveOutside( sal_True, FmFormView::ImplAccess() );
+ }
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL FmXFormView::focusLost( const FocusEvent& /*e*/ ) throw (RuntimeException)
+{
+ // when switch the focus outside the office the mark didn't change
+ // so we can not remove us as focus listener
+ if ( m_xWindow.is() && m_pView )
+ {
+ m_pView->SetMoveOutside( sal_False, FmFormView::ImplAccess() );
+ }
+}
+// -----------------------------------------------------------------------------
+void FmXFormView::removeGridWindowListening()
+{
+ if ( m_xWindow.is() )
+ {
+ m_xWindow->removeFocusListener(this);
+ if ( m_pView )
+ {
+ m_pView->SetMoveOutside( sal_False, FmFormView::ImplAccess() );
+ }
+ m_xWindow = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------------
+DocumentType FmXFormView::impl_getDocumentType() const
+{
+ if ( GetFormShell() && GetFormShell()->GetImpl() )
+ return GetFormShell()->GetImpl()->getDocumentType();
+ return eUnknownDocumentType;
+}
diff --git a/svx/source/form/formcontrolfactory.cxx b/svx/source/form/formcontrolfactory.cxx
new file mode 100644
index 000000000000..857bdc1b2647
--- /dev/null
+++ b/svx/source/form/formcontrolfactory.cxx
@@ -0,0 +1,733 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svx/dbtoolsclient.hxx"
+#include "formcontrolfactory.hxx"
+#include "fmcontrollayout.hxx"
+#include "fmprop.hrc"
+#include "svx/fmresids.hrc"
+#include "fmservs.hxx"
+#include "svx/dialmgr.hxx"
+#include "svx/svdouno.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/form/XFormComponent.hpp>
+#include <com/sun/star/form/FormComponentType.hpp>
+#include <com/sun/star/awt/ScrollBarOrientation.hpp>
+#include <com/sun/star/awt/MouseWheelBehavior.hpp>
+#include <com/sun/star/form/XGridColumnFactory.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <com/sun/star/awt/LineEndFormat.hpp>
+#include <com/sun/star/awt/ImageScaleMode.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/util/XNumberFormatTypes.hpp>
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+#include <com/sun/star/text/WritingMode2.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/numbers.hxx>
+#include <unotools/syslocale.hxx>
+#include <tools/gen.hxx>
+#include <tools/diagnose_ex.h>
+
+#include <set>
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::beans::XPropertySet;
+ using ::com::sun::star::awt::XControlModel;
+ using ::com::sun::star::form::XFormComponent;
+ using ::com::sun::star::container::XIndexAccess;
+ using ::com::sun::star::beans::XPropertySetInfo;
+ using ::com::sun::star::beans::PropertyValue;
+ using ::com::sun::star::container::XChild;
+ using ::com::sun::star::form::XGridColumnFactory;
+ using ::com::sun::star::style::VerticalAlignment_MIDDLE;
+ using ::com::sun::star::beans::Property;
+ using ::com::sun::star::uno::TypeClass_DOUBLE;
+ using ::com::sun::star::uno::TypeClass_LONG;
+ using ::com::sun::star::util::XNumberFormats;
+ using ::com::sun::star::util::XNumberFormatTypes;
+ using ::com::sun::star::awt::FontDescriptor;
+ using ::com::sun::star::lang::Locale;
+ using ::com::sun::star::lang::XServiceInfo;
+ using ::com::sun::star::container::XNameAccess;
+ /** === end UNO using === **/
+ namespace FormComponentType = ::com::sun::star::form::FormComponentType;
+ namespace ScrollBarOrientation = ::com::sun::star::awt::ScrollBarOrientation;
+ namespace MouseWheelBehavior = ::com::sun::star::awt::MouseWheelBehavior;
+ namespace LineEndFormat = ::com::sun::star::awt::LineEndFormat;
+ namespace ImageScaleMode = ::com::sun::star::awt::ImageScaleMode;
+ namespace DataType = ::com::sun::star::sdbc::DataType;
+ namespace ColumnValue = ::com::sun::star::sdbc::ColumnValue;
+ namespace WritingMode2 = ::com::sun::star::text::WritingMode2;
+
+ //====================================================================
+ //= FormControlFactory_Data
+ //====================================================================
+ struct FormControlFactory_Data
+ {
+ ::comphelper::ComponentContext m_aContext;
+
+ FormControlFactory_Data( const ::comphelper::ComponentContext& _rContext )
+ :m_aContext( _rContext )
+ {
+ }
+ };
+
+ //====================================================================
+ //= FormControlFactory
+ //====================================================================
+ //--------------------------------------------------------------------
+ FormControlFactory::FormControlFactory( const ::comphelper::ComponentContext& _rContext )
+ :m_pData( new FormControlFactory_Data( _rContext ) )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ FormControlFactory::~FormControlFactory()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int16 FormControlFactory::initializeControlModel( const DocumentType _eDocType, const SdrUnoObj& _rObject )
+ {
+ return initializeControlModel(
+ _eDocType,
+ Reference< XPropertySet >( _rObject.GetUnoControlModel(), UNO_QUERY ),
+ _rObject.GetCurrentBoundRect()
+ );
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int16 FormControlFactory::initializeControlModel( const DocumentType _eDocType, const Reference< XPropertySet >& _rxControlModel )
+ {
+ return initializeControlModel(
+ _eDocType, _rxControlModel, Rectangle()
+ );
+ }
+
+ // -----------------------------------------------------------------------------
+ namespace
+ {
+ //....................................................................
+ static ::rtl::OUString lcl_getUniqueLabel_nothrow( const Reference< XPropertySet >& _rxControlModel, const ::rtl::OUString& _rBaseLabel )
+ {
+ ::rtl::OUString sLabel( _rBaseLabel );
+ try
+ {
+ typedef ::std::set< ::rtl::OUString > StringBag;
+ StringBag aUsedLabels;
+
+ Reference< XFormComponent > xFormComponent( _rxControlModel, UNO_QUERY_THROW );
+ Reference< XIndexAccess > xContainer( xFormComponent->getParent(), UNO_QUERY_THROW );
+ // loop through all siblings of the control model, and collect their labels
+ for ( sal_Int32 index=xContainer->getCount(); index>0; )
+ {
+ Reference< XPropertySet > xElement( xContainer->getByIndex( --index ), UNO_QUERY_THROW );
+ if ( xElement == _rxControlModel )
+ continue;
+
+ Reference< XPropertySetInfo > xPSI( xElement->getPropertySetInfo(), UNO_SET_THROW );
+ if ( !xPSI->hasPropertyByName( FM_PROP_LABEL ) )
+ continue;
+
+ ::rtl::OUString sElementLabel;
+ OSL_VERIFY( xElement->getPropertyValue( FM_PROP_LABEL ) >>= sElementLabel );
+ aUsedLabels.insert( sElementLabel );
+ }
+
+ // now find a free label
+ sal_Int32 i=2;
+ while ( aUsedLabels.find( sLabel ) != aUsedLabels.end() )
+ {
+ ::rtl::OUStringBuffer aBuffer( _rBaseLabel );
+ aBuffer.appendAscii( " " );
+ aBuffer.append( (sal_Int32)i++ );
+ sLabel = aBuffer.makeStringAndClear();
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return sLabel;
+ }
+
+ //....................................................................
+ static Sequence< PropertyValue > lcl_getDataSourceIndirectProperties( const Reference< XPropertySet >& _rxControlModel,
+ const ::comphelper::ComponentContext& _rContext )
+ {
+ OSL_PRECOND( _rxControlModel.is(), "lcl_getDataSourceIndirectProperties: invalid model!" );
+
+ Sequence< PropertyValue > aInfo;
+ try
+ {
+ Reference< XChild > xChild( _rxControlModel, UNO_QUERY );
+ Reference< XPropertySet > xForm;
+ if ( xChild.is() )
+ xForm = xForm.query( xChild->getParent() );
+
+ if ( Reference< XGridColumnFactory >( xForm, UNO_QUERY ).is() )
+ { // hmm. the model is a grid column, in real
+ xChild = xChild.query( xForm );
+ xForm = xForm.query( xChild->getParent() );
+ }
+
+ OSL_ENSURE( xForm.is(), "lcl_getDataSourceIndirectProperties: could not determine the form!" );
+ if ( !xForm.is() )
+ return aInfo;
+ ::rtl::OUString sDataSourceName;
+ xForm->getPropertyValue( FM_PROP_DATASOURCE ) >>= sDataSourceName;
+
+ Reference< XPropertySet > xDsProperties;
+ if ( sDataSourceName.getLength() )
+ xDsProperties = xDsProperties.query( OStaticDataAccessTools().getDataSource( sDataSourceName, _rContext.getLegacyServiceFactory() ) );
+ if ( xDsProperties.is() )
+ xDsProperties->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Info" ) ) ) >>= aInfo;
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "lcl_getDataSourceIndirectProperties: caught an exception!" );
+ }
+ return aInfo;
+ }
+
+ //....................................................................
+ static const sal_Char* aCharacterAndParagraphProperties[] =
+ {
+ "CharFontName",
+ "CharFontStyleName",
+ "CharFontFamily",
+ "CharFontCharSet",
+ "CharFontPitch",
+ "CharColor",
+ "CharEscapement",
+ "CharHeight",
+ "CharUnderline",
+ "CharWeight",
+ "CharPosture",
+ "CharAutoKerning",
+ "CharBackColor",
+ "CharBackTransparent",
+ "CharCaseMap",
+ "CharCrossedOut",
+ "CharFlash",
+ "CharStrikeout",
+ "CharWordMode",
+ "CharKerning",
+ "CharLocale",
+ "CharKeepTogether",
+ "CharNoLineBreak",
+ "CharShadowed",
+ "CharFontType",
+ "CharStyleName",
+ "CharContoured",
+ "CharCombineIsOn",
+ "CharCombinePrefix",
+ "CharCombineSuffix",
+ "CharEmphasize",
+ "CharRelief",
+ "RubyText",
+ "RubyAdjust",
+ "RubyCharStyleName",
+ "RubyIsAbove",
+ "CharRotation",
+ "CharRotationIsFitToLine",
+ "CharScaleWidth",
+ "HyperLinkURL",
+ "HyperLinkTarget",
+ "HyperLinkName",
+ "VisitedCharStyleName",
+ "UnvisitedCharStyleName",
+ "CharEscapementHeight",
+ "CharNoHyphenation",
+ "CharUnderlineColor",
+ "CharUnderlineHasColor",
+ "CharStyleNames",
+ "CharHeightAsian",
+ "CharWeightAsian",
+ "CharFontNameAsian",
+ "CharFontStyleNameAsian",
+ "CharFontFamilyAsian",
+ "CharFontCharSetAsian",
+ "CharFontPitchAsian",
+ "CharPostureAsian",
+ "CharLocaleAsian",
+ "ParaIsCharacterDistance",
+ "ParaIsForbiddenRules",
+ "ParaIsHangingPunctuation",
+ "CharHeightComplex",
+ "CharWeightComplex",
+ "CharFontNameComplex",
+ "CharFontStyleNameComplex",
+ "CharFontFamilyComplex",
+ "CharFontCharSetComplex",
+ "CharFontPitchComplex",
+ "CharPostureComplex",
+ "CharLocaleComplex",
+ "ParaAdjust",
+ "ParaLineSpacing",
+ "ParaBackColor",
+ "ParaBackTransparent",
+ "ParaBackGraphicURL",
+ "ParaBackGraphicFilter",
+ "ParaBackGraphicLocation",
+ "ParaLastLineAdjust",
+ "ParaExpandSingleWord",
+ "ParaLeftMargin",
+ "ParaRightMargin",
+ "ParaTopMargin",
+ "ParaBottomMargin",
+ "ParaLineNumberCount",
+ "ParaLineNumberStartValue",
+ "PageDescName",
+ "PageNumberOffset",
+ "ParaRegisterModeActive",
+ "ParaTabStops",
+ "ParaStyleName",
+ "DropCapFormat",
+ "DropCapWholeWord",
+ "ParaKeepTogether",
+ "Setting",
+ "ParaSplit",
+ "Setting",
+ "NumberingLevel",
+ "NumberingRules",
+ "NumberingStartValue",
+ "ParaIsNumberingRestart",
+ "NumberingStyleName",
+ "ParaOrphans",
+ "ParaWidows",
+ "ParaShadowFormat",
+ "LeftBorder",
+ "RightBorder",
+ "TopBorder",
+ "BottomBorder",
+ "BorderDistance",
+ "LeftBorderDistance",
+ "RightBorderDistance",
+ "TopBorderDistance",
+ "BottomBorderDistance",
+ "BreakType",
+ "DropCapCharStyleName",
+ "ParaFirstLineIndent",
+ "ParaIsAutoFirstLineIndent",
+ "ParaIsHyphenation",
+ "ParaHyphenationMaxHyphens",
+ "ParaHyphenationMaxLeadingChars",
+ "ParaHyphenationMaxTrailingChars",
+ "ParaVertAlignment",
+ "ParaUserDefinedAttributes",
+ "NumberingIsNumber",
+ "ParaIsConnectBorder",
+ NULL
+ };
+
+ //....................................................................
+ static void lcl_initializeCharacterAttributes( const Reference< XPropertySet >& _rxModel )
+ {
+ try
+ {
+ Reference< XPropertySet > xStyle( ControlLayouter::getDefaultDocumentTextStyle( _rxModel ), UNO_SET_THROW );
+
+ // transfer all properties which are described by the style
+ Reference< XPropertySetInfo > xSourcePropInfo( xStyle->getPropertySetInfo(), UNO_SET_THROW );
+ Reference< XPropertySetInfo > xDestPropInfo( _rxModel->getPropertySetInfo(), UNO_SET_THROW );
+
+ ::rtl::OUString sPropertyName;
+ const sal_Char** pCharacterProperty = aCharacterAndParagraphProperties;
+ while ( *pCharacterProperty )
+ {
+ sPropertyName = ::rtl::OUString::createFromAscii( *pCharacterProperty );
+
+ if ( xSourcePropInfo->hasPropertyByName( sPropertyName ) && xDestPropInfo->hasPropertyByName( sPropertyName ) )
+ _rxModel->setPropertyValue( sPropertyName, xStyle->getPropertyValue( sPropertyName ) );
+
+ ++pCharacterProperty;
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int16 FormControlFactory::initializeControlModel( const DocumentType _eDocType, const Reference< XPropertySet >& _rxControlModel,
+ const Rectangle& _rControlBoundRect )
+ {
+ sal_Int16 nClassId = FormComponentType::CONTROL;
+
+ OSL_ENSURE( _rxControlModel.is(), "FormControlFactory::initializeControlModel: invalid model!" );
+ if ( !_rxControlModel.is() )
+ return nClassId;
+
+ try
+ {
+ ControlLayouter::initializeControlLayout( _rxControlModel, _eDocType );
+
+ _rxControlModel->getPropertyValue( FM_PROP_CLASSID ) >>= nClassId;
+ Reference< XPropertySetInfo > xPSI( _rxControlModel->getPropertySetInfo(), UNO_SET_THROW );
+ switch ( nClassId )
+ {
+ case FormComponentType::SCROLLBAR:
+ _rxControlModel->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LiveScroll" ) ), makeAny( (sal_Bool)sal_True ) );
+ // NO break!
+ case FormComponentType::SPINBUTTON:
+ {
+ sal_Int32 eOrientation = ScrollBarOrientation::HORIZONTAL;
+ if ( !_rControlBoundRect.IsEmpty() && ( _rControlBoundRect.GetWidth() < _rControlBoundRect.GetHeight() ) )
+ eOrientation = ScrollBarOrientation::VERTICAL;
+ _rxControlModel->setPropertyValue( FM_PROP_ORIENTATION, makeAny( eOrientation ) );
+ }
+ break;
+
+ case FormComponentType::LISTBOX:
+ case FormComponentType::COMBOBOX:
+ {
+ sal_Bool bDropDown = !_rControlBoundRect.IsEmpty() && ( _rControlBoundRect.GetWidth() >= 3 * _rControlBoundRect.GetHeight() );
+ if ( xPSI->hasPropertyByName( FM_PROP_DROPDOWN ) )
+ _rxControlModel->setPropertyValue( FM_PROP_DROPDOWN, makeAny( (sal_Bool)bDropDown ) );
+ _rxControlModel->setPropertyValue( FM_PROP_LINECOUNT, makeAny( sal_Int16( 20 ) ) );
+ }
+ break;
+
+ case FormComponentType::TEXTFIELD:
+ {
+ initializeTextFieldLineEnds( _rxControlModel );
+ lcl_initializeCharacterAttributes( _rxControlModel );
+
+ if ( !_rControlBoundRect.IsEmpty()
+ && !( _rControlBoundRect.GetWidth() > 4 * _rControlBoundRect.GetHeight() )
+ )
+ {
+ if ( xPSI->hasPropertyByName( FM_PROP_MULTILINE ) )
+ _rxControlModel->setPropertyValue( FM_PROP_MULTILINE, makeAny( (sal_Bool)sal_True ) );
+ }
+ }
+ break;
+
+ case FormComponentType::RADIOBUTTON:
+ case FormComponentType::CHECKBOX:
+ case FormComponentType::FIXEDTEXT:
+ {
+ ::rtl::OUString sVertAlignPropertyName( RTL_CONSTASCII_USTRINGPARAM( "VerticalAlign" ) );
+ if ( xPSI->hasPropertyByName( sVertAlignPropertyName ) )
+ _rxControlModel->setPropertyValue( sVertAlignPropertyName, makeAny( VerticalAlignment_MIDDLE ) );
+ }
+ break;
+
+ case FormComponentType::IMAGEBUTTON:
+ case FormComponentType::IMAGECONTROL:
+ {
+ const ::rtl::OUString sScaleModeProperty( RTL_CONSTASCII_USTRINGPARAM( "ScaleMode" ) );
+ if ( xPSI->hasPropertyByName( sScaleModeProperty ) )
+ _rxControlModel->setPropertyValue( sScaleModeProperty, makeAny( ImageScaleMode::Isotropic ) );
+ }
+ break;
+ }
+
+ // initial default label for the control
+ if ( xPSI->hasPropertyByName( FM_PROP_LABEL ) )
+ {
+ ::rtl::OUString sExistingLabel;
+ OSL_VERIFY( _rxControlModel->getPropertyValue( FM_PROP_LABEL ) >>= sExistingLabel );
+ if ( !sExistingLabel.getLength() )
+ {
+ ::rtl::OUString sInitialLabel;
+ OSL_VERIFY( _rxControlModel->getPropertyValue( FM_PROP_NAME ) >>= sInitialLabel );
+
+ sal_uInt16 nTitleResId = 0;
+ switch ( nClassId )
+ {
+ case FormComponentType::COMMANDBUTTON: nTitleResId = RID_STR_PROPTITLE_PUSHBUTTON; break;
+ case FormComponentType::RADIOBUTTON: nTitleResId = RID_STR_PROPTITLE_RADIOBUTTON; break;
+ case FormComponentType::CHECKBOX: nTitleResId = RID_STR_PROPTITLE_CHECKBOX; break;
+ case FormComponentType::GROUPBOX: nTitleResId = RID_STR_PROPTITLE_GROUPBOX; break;
+ case FormComponentType::FIXEDTEXT: nTitleResId = RID_STR_PROPTITLE_FIXEDTEXT; break;
+ }
+
+ if ( nTitleResId )
+ sInitialLabel = String( SVX_RES( nTitleResId ) );
+
+ _rxControlModel->setPropertyValue(
+ FM_PROP_LABEL,
+ makeAny( lcl_getUniqueLabel_nothrow( _rxControlModel, sInitialLabel ) )
+ );
+ }
+ }
+
+ // strict format = yes is the default (i93467)
+ if ( xPSI->hasPropertyByName( FM_PROP_STRICTFORMAT ) )
+ {
+ _rxControlModel->setPropertyValue( FM_PROP_STRICTFORMAT, makeAny( sal_Bool( sal_True ) ) );
+ }
+
+ // mouse wheel: don't use it for scrolling by default (i110036)
+ if ( xPSI->hasPropertyByName( FM_PROP_MOUSE_WHEEL_BEHAVIOR ) )
+ {
+ _rxControlModel->setPropertyValue( FM_PROP_MOUSE_WHEEL_BEHAVIOR, makeAny( MouseWheelBehavior::SCROLL_DISABLED ) );
+ }
+
+ if ( xPSI->hasPropertyByName( FM_PROP_WRITING_MODE ) )
+ _rxControlModel->setPropertyValue( FM_PROP_WRITING_MODE, makeAny( WritingMode2::CONTEXT ) );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return nClassId;
+ }
+
+ //------------------------------------------------------------------------------
+ void FormControlFactory::initializeTextFieldLineEnds( const Reference< XPropertySet >& _rxModel )
+ {
+ OSL_PRECOND( _rxModel.is(), "initializeTextFieldLineEnds: invalid model!" );
+ if ( !_rxModel.is() )
+ return;
+
+ try
+ {
+ Reference< XPropertySetInfo > xInfo = _rxModel->getPropertySetInfo();
+ if ( !xInfo.is() || !xInfo->hasPropertyByName( FM_PROP_LINEENDFORMAT ) )
+ return;
+
+ // let's see if the data source which the form belongs to (if any)
+ // has a setting for the preferred line end format
+ sal_Bool bDosLineEnds = sal_False;
+ Sequence< PropertyValue > aInfo = lcl_getDataSourceIndirectProperties( _rxModel, m_pData->m_aContext );
+ const PropertyValue* pInfo = aInfo.getConstArray();
+ const PropertyValue* pInfoEnd = pInfo + aInfo.getLength();
+ for ( ; pInfo != pInfoEnd; ++pInfo )
+ {
+ if ( pInfo->Name.equalsAscii( "PreferDosLikeLineEnds" ) )
+ {
+ pInfo->Value >>= bDosLineEnds;
+ break;
+ }
+ }
+
+ sal_Int16 nLineEndFormat = bDosLineEnds ? LineEndFormat::CARRIAGE_RETURN_LINE_FEED : LineEndFormat::LINE_FEED;
+ _rxModel->setPropertyValue( FM_PROP_LINEENDFORMAT, makeAny( nLineEndFormat ) );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //------------------------------------------------------------------------------
+ void FormControlFactory::initializeFieldDependentProperties( const Reference< XPropertySet >& _rxDatabaseField,
+ const Reference< XPropertySet >& _rxControlModel, const Reference< XNumberFormats >& _rxNumberFormats )
+ {
+ OSL_PRECOND( _rxDatabaseField.is() && _rxControlModel.is(),
+ "FormControlFactory::initializeFieldDependentProperties: illegal params!" );
+ if ( !_rxDatabaseField.is() || !_rxControlModel.is() )
+ return;
+
+ try
+ {
+ ////////////////////////////////////////////////////////////////////////
+ // if the field has a numeric format, and the model has a "Scale" property, sync it
+ Reference< XPropertySetInfo > xFieldPSI( _rxDatabaseField->getPropertySetInfo(), UNO_SET_THROW );
+ Reference< XPropertySetInfo > xModelPSI( _rxControlModel->getPropertySetInfo(), UNO_SET_THROW );
+
+ if ( xModelPSI->hasPropertyByName( FM_PROP_DECIMAL_ACCURACY ) )
+ {
+ sal_Int32 nFormatKey = 0;
+ if ( xFieldPSI->hasPropertyByName( FM_PROP_FORMATKEY ) )
+ {
+ _rxDatabaseField->getPropertyValue( FM_PROP_FORMATKEY ) >>= nFormatKey;
+ }
+ else
+ {
+ nFormatKey = OStaticDataAccessTools().getDefaultNumberFormat(
+ _rxDatabaseField,
+ Reference< XNumberFormatTypes >( _rxNumberFormats, UNO_QUERY ),
+ SvtSysLocale().GetLocaleData().getLocale()
+ );
+ }
+
+ Any aScaleVal( ::comphelper::getNumberFormatDecimals( _rxNumberFormats, nFormatKey ) );
+ _rxControlModel->setPropertyValue( FM_PROP_DECIMAL_ACCURACY, aScaleVal );
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // minimum and maximum of the control according to the type of the database field
+ sal_Int32 nDataType = DataType::OTHER;
+ OSL_VERIFY( _rxDatabaseField->getPropertyValue( FM_PROP_FIELDTYPE ) >>= nDataType );
+
+ if ( xModelPSI->hasPropertyByName( FM_PROP_VALUEMIN )
+ && xModelPSI->hasPropertyByName( FM_PROP_VALUEMAX )
+ )
+ {
+ sal_Int32 nMinValue = -1000000000, nMaxValue = 1000000000;
+ switch ( nDataType )
+ {
+ case DataType::TINYINT : nMinValue = 0; nMaxValue = 255; break;
+ case DataType::SMALLINT : nMinValue = -32768; nMaxValue = 32767; break;
+ case DataType::INTEGER : nMinValue = 0x80000000; nMaxValue = 0x7FFFFFFF; break;
+ // double and singles are ignored
+ }
+
+ Any aValue;
+
+ // both the minimum and the maximum value properties can be either Long or Double
+ Property aProperty = xModelPSI->getPropertyByName( FM_PROP_VALUEMIN );
+ if ( aProperty.Type.getTypeClass() == TypeClass_DOUBLE )
+ aValue <<= (double)nMinValue;
+ else if ( aProperty.Type.getTypeClass() == TypeClass_LONG )
+ aValue <<= (sal_Int32)nMinValue;
+ else
+ {
+ DBG_ERROR( "FormControlFactory::initializeFieldDependentProperties: unexpected property type (MinValue)!" );
+ }
+ _rxControlModel->setPropertyValue( FM_PROP_VALUEMIN, aValue );
+
+ // both the minimum and the maximum value properties can be either Long or Double
+ aProperty = xModelPSI->getPropertyByName( FM_PROP_VALUEMAX );
+ if ( aProperty.Type.getTypeClass() == TypeClass_DOUBLE )
+ aValue <<= (double)nMaxValue;
+ else if ( aProperty.Type.getTypeClass() == TypeClass_LONG )
+ aValue <<= (sal_Int32)nMaxValue;
+ else
+ {
+ DBG_ERROR( "FormControlFactory::initializeFieldDependentProperties: unexpected property type (MaxValue)!" );
+ }
+ _rxControlModel->setPropertyValue( FM_PROP_VALUEMAX, aValue );
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // a check box can be tristate if and only if the column it is bound to is nullable
+ sal_Int16 nClassId = FormComponentType::CONTROL;
+ OSL_VERIFY( _rxControlModel->getPropertyValue( FM_PROP_CLASSID ) >>= nClassId );
+ if ( nClassId == FormComponentType::CHECKBOX )
+ {
+ sal_Int32 nNullable = ColumnValue::NULLABLE_UNKNOWN;
+ OSL_VERIFY( _rxDatabaseField->getPropertyValue( FM_PROP_ISNULLABLE ) >>= nNullable );
+ _rxControlModel->setPropertyValue( FM_PROP_TRISTATE, makeAny( sal_Bool( ColumnValue::NO_NULLS != nNullable ) ) );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //------------------------------------------------------------------------------
+ ::rtl::OUString FormControlFactory::getDefaultName( sal_Int16 _nClassId, const Reference< XServiceInfo >& _rxObject )
+ {
+ sal_uInt16 nResId(0);
+
+ switch ( _nClassId )
+ {
+ case FormComponentType::COMMANDBUTTON: nResId = RID_STR_PROPTITLE_PUSHBUTTON; break;
+ case FormComponentType::RADIOBUTTON: nResId = RID_STR_PROPTITLE_RADIOBUTTON; break;
+ case FormComponentType::CHECKBOX: nResId = RID_STR_PROPTITLE_CHECKBOX; break;
+ case FormComponentType::LISTBOX: nResId = RID_STR_PROPTITLE_LISTBOX; break;
+ case FormComponentType::COMBOBOX: nResId = RID_STR_PROPTITLE_COMBOBOX; break;
+ case FormComponentType::GROUPBOX: nResId = RID_STR_PROPTITLE_GROUPBOX; break;
+ case FormComponentType::IMAGEBUTTON: nResId = RID_STR_PROPTITLE_IMAGEBUTTON; break;
+ case FormComponentType::FIXEDTEXT: nResId = RID_STR_PROPTITLE_FIXEDTEXT; break;
+ case FormComponentType::GRIDCONTROL: nResId = RID_STR_PROPTITLE_DBGRID; break;
+ case FormComponentType::FILECONTROL: nResId = RID_STR_PROPTITLE_FILECONTROL; break;
+ case FormComponentType::DATEFIELD: nResId = RID_STR_PROPTITLE_DATEFIELD; break;
+ case FormComponentType::TIMEFIELD: nResId = RID_STR_PROPTITLE_TIMEFIELD; break;
+ case FormComponentType::NUMERICFIELD: nResId = RID_STR_PROPTITLE_NUMERICFIELD; break;
+ case FormComponentType::CURRENCYFIELD: nResId = RID_STR_PROPTITLE_CURRENCYFIELD; break;
+ case FormComponentType::PATTERNFIELD: nResId = RID_STR_PROPTITLE_PATTERNFIELD; break;
+ case FormComponentType::IMAGECONTROL: nResId = RID_STR_PROPTITLE_IMAGECONTROL; break;
+ case FormComponentType::HIDDENCONTROL: nResId = RID_STR_PROPTITLE_HIDDEN; break;
+ case FormComponentType::SCROLLBAR: nResId = RID_STR_PROPTITLE_SCROLLBAR; break;
+ case FormComponentType::SPINBUTTON: nResId = RID_STR_PROPTITLE_SPINBUTTON; break;
+ case FormComponentType::NAVIGATIONBAR: nResId = RID_STR_PROPTITLE_NAVBAR; break;
+
+ case FormComponentType::TEXTFIELD:
+ nResId = RID_STR_PROPTITLE_EDIT;
+ if ( _rxObject.is() && _rxObject->supportsService( FM_SUN_COMPONENT_FORMATTEDFIELD ) )
+ nResId = RID_STR_PROPTITLE_FORMATTED;
+ break;
+
+ default:
+ nResId = RID_STR_CONTROL; break;
+ }
+
+ return String( SVX_RES( nResId ) );
+ }
+
+ //------------------------------------------------------------------------------
+ ::rtl::OUString FormControlFactory::getDefaultUniqueName_ByComponentType( const Reference< XNameAccess >& _rxContainer,
+ const Reference< XPropertySet >& _rxObject )
+ {
+ sal_Int16 nClassId = FormComponentType::CONTROL;
+ OSL_VERIFY( _rxObject->getPropertyValue( FM_PROP_CLASSID ) >>= nClassId );
+ ::rtl::OUString sBaseName = getDefaultName( nClassId, Reference< XServiceInfo >( _rxObject, UNO_QUERY ) );
+
+ return getUniqueName( _rxContainer, sBaseName );
+ }
+
+ //------------------------------------------------------------------------------
+ ::rtl::OUString FormControlFactory::getUniqueName( const Reference< XNameAccess >& _rxContainer, const ::rtl::OUString& _rBaseName )
+ {
+ sal_Int32 n = 0;
+ ::rtl::OUString sName;
+ do
+ {
+ ::rtl::OUStringBuffer aBuf( _rBaseName );
+ aBuf.appendAscii( " " );
+ aBuf.append( ++n );
+ sName = aBuf.makeStringAndClear();
+ }
+ while ( _rxContainer->hasByName( sName ) );
+
+ return sName;
+ }
+
+//........................................................................
+} // namespace svxform
+//........................................................................
diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx
new file mode 100644
index 000000000000..528661d2abe4
--- /dev/null
+++ b/svx/source/form/formcontroller.cxx
@@ -0,0 +1,4334 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "fmcontrolbordermanager.hxx"
+#include "fmcontrollayout.hxx"
+#include "formcontroller.hxx"
+#include "formfeaturedispatcher.hxx"
+#include "fmdocumentclassification.hxx"
+#include "formcontrolling.hxx"
+#include "fmprop.hrc"
+#include "svx/dialmgr.hxx"
+#include "svx/fmresids.hrc"
+#include "fmservs.hxx"
+#include "svx/fmtools.hxx"
+#include "fmurl.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/FocusChangeReason.hpp>
+#include <com/sun/star/awt/XCheckBox.hpp>
+#include <com/sun/star/awt/XComboBox.hpp>
+#include <com/sun/star/awt/XListBox.hpp>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/container/XIdentifierReplace.hpp>
+#include <com/sun/star/form/TabulatorCycle.hpp>
+#include <com/sun/star/form/validation/XValidatableFormComponent.hpp>
+#include <com/sun/star/form/XBoundComponent.hpp>
+#include <com/sun/star/form/XBoundControl.hpp>
+#include <com/sun/star/form/XGridControl.hpp>
+#include <com/sun/star/form/XLoadable.hpp>
+#include <com/sun/star/form/XReset.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/sdb/ParametersRequest.hpp>
+#include <com/sun/star/sdb/RowChangeAction.hpp>
+#include <com/sun/star/sdb/XInteractionSupplyParameters.hpp>
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/form/runtime/FormOperations.hpp>
+#include <com/sun/star/form/runtime/FormFeature.hpp>
+#include <com/sun/star/container/XContainer.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/sdb/SQLContext.hpp>
+#include <com/sun/star/sdb/XColumn.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/enumhelper.hxx>
+#include <comphelper/extract.hxx>
+#include <comphelper/interaction.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <comphelper/propagg.hxx>
+#include <comphelper/property.hxx>
+#include <comphelper/sequence.hxx>
+#include <comphelper/uno3.hxx>
+#include <comphelper/flagguard.hxx>
+#include <cppuhelper/queryinterface.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <toolkit/controls/unocontrol.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include <tools/shl.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <rtl/logfile.hxx>
+
+#include <algorithm>
+#include <functional>
+
+using namespace ::com::sun::star;
+using namespace ::comphelper;
+using namespace ::connectivity;
+using namespace ::connectivity::simple;
+
+//------------------------------------------------------------------
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ FormController_NewInstance_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & _rxORB )
+{
+ return *( new ::svxform::FormController( _rxORB ) );
+}
+
+namespace svxform
+{
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::sdb::XColumn;
+ using ::com::sun::star::awt::XControl;
+ using ::com::sun::star::awt::XTabController;
+ using ::com::sun::star::awt::XToolkit;
+ using ::com::sun::star::awt::XWindowPeer;
+ using ::com::sun::star::form::XGrid;
+ using ::com::sun::star::beans::XPropertySet;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::container::XIndexAccess;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::beans::XPropertySetInfo;
+ using ::com::sun::star::beans::PropertyValue;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::lang::IndexOutOfBoundsException;
+ using ::com::sun::star::sdb::XInteractionSupplyParameters;
+ using ::com::sun::star::awt::XTextComponent;
+ using ::com::sun::star::awt::XTextListener;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::frame::XDispatch;
+ using ::com::sun::star::lang::XMultiServiceFactory;
+ using ::com::sun::star::uno::XAggregation;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::sdbc::XConnection;
+ using ::com::sun::star::sdbc::XRowSet;
+ using ::com::sun::star::sdbc::XDatabaseMetaData;
+ using ::com::sun::star::util::XNumberFormatsSupplier;
+ using ::com::sun::star::util::XNumberFormatter;
+ using ::com::sun::star::sdbcx::XColumnsSupplier;
+ using ::com::sun::star::container::XNameAccess;
+ using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::beans::Property;
+ using ::com::sun::star::container::XEnumeration;
+ using ::com::sun::star::form::XFormComponent;
+ using ::com::sun::star::form::runtime::XFormOperations;
+ using ::com::sun::star::form::runtime::FilterEvent;
+ using ::com::sun::star::form::runtime::XFilterControllerListener;
+ using ::com::sun::star::awt::XControlContainer;
+ using ::com::sun::star::container::XIdentifierReplace;
+ using ::com::sun::star::lang::WrappedTargetException;
+ using ::com::sun::star::form::XFormControllerListener;
+ using ::com::sun::star::awt::XWindow;
+ using ::com::sun::star::sdbc::XResultSet;
+ using ::com::sun::star::awt::XControlModel;
+ using ::com::sun::star::awt::XTabControllerModel;
+ using ::com::sun::star::beans::PropertyChangeEvent;
+ using ::com::sun::star::form::validation::XValidatableFormComponent;
+ using ::com::sun::star::form::XLoadable;
+ using ::com::sun::star::script::XEventAttacherManager;
+ using ::com::sun::star::form::XBoundControl;
+ using ::com::sun::star::beans::XPropertyChangeListener;
+ using ::com::sun::star::awt::TextEvent;
+ using ::com::sun::star::form::XBoundComponent;
+ using ::com::sun::star::awt::XCheckBox;
+ using ::com::sun::star::awt::XComboBox;
+ using ::com::sun::star::awt::XListBox;
+ using ::com::sun::star::awt::ItemEvent;
+ using ::com::sun::star::util::XModifyListener;
+ using ::com::sun::star::form::XReset;
+ using ::com::sun::star::frame::XDispatchProviderInterception;
+ using ::com::sun::star::form::XGridControl;
+ using ::com::sun::star::awt::XVclWindowPeer;
+ using ::com::sun::star::form::validation::XValidator;
+ using ::com::sun::star::awt::FocusEvent;
+ using ::com::sun::star::sdb::SQLContext;
+ using ::com::sun::star::container::XChild;
+ using ::com::sun::star::form::TabulatorCycle_RECORDS;
+ using ::com::sun::star::container::ContainerEvent;
+ using ::com::sun::star::lang::DisposedException;
+ using ::com::sun::star::lang::Locale;
+ using ::com::sun::star::beans::NamedValue;
+ using ::com::sun::star::lang::NoSupportException;
+ using ::com::sun::star::sdb::RowChangeEvent;
+ using ::com::sun::star::frame::XStatusListener;
+ using ::com::sun::star::frame::XDispatchProviderInterceptor;
+ using ::com::sun::star::sdb::SQLErrorEvent;
+ using ::com::sun::star::form::DatabaseParameterEvent;
+ using ::com::sun::star::sdb::ParametersRequest;
+ using ::com::sun::star::task::XInteractionRequest;
+ using ::com::sun::star::util::URL;
+ using ::com::sun::star::frame::FeatureStateEvent;
+ using ::com::sun::star::form::runtime::XFormControllerContext;
+ using ::com::sun::star::task::XInteractionHandler;
+ using ::com::sun::star::form::runtime::FormOperations;
+ using ::com::sun::star::container::XContainer;
+ using ::com::sun::star::sdbc::SQLWarning;
+ /** === end UNO using === **/
+ namespace ColumnValue = ::com::sun::star::sdbc::ColumnValue;
+ namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute;
+ namespace FocusChangeReason = ::com::sun::star::awt::FocusChangeReason;
+ namespace RowChangeAction = ::com::sun::star::sdb::RowChangeAction;
+ namespace FormFeature = ::com::sun::star::form::runtime::FormFeature;
+ namespace DataType = ::com::sun::star::sdbc::DataType;
+
+//==============================================================================
+// ColumnInfo
+//==============================================================================
+struct ColumnInfo
+{
+ // information about the column itself
+ Reference< XColumn > xColumn;
+ sal_Int32 nNullable;
+ sal_Bool bAutoIncrement;
+ sal_Bool bReadOnly;
+ ::rtl::OUString sName;
+
+ // information about the control(s) bound to this column
+
+ /// the first control which is bound to the given column, and which requires input
+ Reference< XControl > xFirstControlWithInputRequired;
+ /** the first grid control which contains a column which is bound to the given database column, and requires
+ input
+ */
+ Reference< XGrid > xFirstGridWithInputRequiredColumn;
+ /** if xFirstControlWithInputRequired is a grid control, then nRequiredGridColumn specifies the position
+ of the grid column which is actually bound
+ */
+ sal_Int32 nRequiredGridColumn;
+
+ ColumnInfo()
+ :xColumn()
+ ,nNullable( ColumnValue::NULLABLE_UNKNOWN )
+ ,bAutoIncrement( sal_False )
+ ,bReadOnly( sal_False )
+ ,sName()
+ ,xFirstControlWithInputRequired()
+ ,xFirstGridWithInputRequiredColumn()
+ ,nRequiredGridColumn( -1 )
+ {
+ }
+};
+
+//==============================================================================
+//= ColumnInfoCache
+//==============================================================================
+class ColumnInfoCache
+{
+public:
+ ColumnInfoCache( const Reference< XColumnsSupplier >& _rxColSupplier );
+
+ size_t getColumnCount() const { return m_aColumns.size(); }
+ const ColumnInfo& getColumnInfo( size_t _pos );
+
+ bool controlsInitialized() const { return m_bControlsInitialized; }
+ void initializeControls( const Sequence< Reference< XControl > >& _rControls );
+ void deinitializeControls();
+
+private:
+ typedef ::std::vector< ColumnInfo > ColumnInfos;
+ ColumnInfos m_aColumns;
+ bool m_bControlsInitialized;
+};
+
+//------------------------------------------------------------------------------
+ColumnInfoCache::ColumnInfoCache( const Reference< XColumnsSupplier >& _rxColSupplier )
+ :m_aColumns()
+ ,m_bControlsInitialized( false )
+{
+ try
+ {
+ m_aColumns.clear();
+
+ Reference< XColumnsSupplier > xSupplyCols( _rxColSupplier, UNO_SET_THROW );
+ Reference< XIndexAccess > xColumns( xSupplyCols->getColumns(), UNO_QUERY_THROW );
+ sal_Int32 nColumnCount = xColumns->getCount();
+ m_aColumns.reserve( nColumnCount );
+
+ Reference< XPropertySet > xColumnProps;
+ for ( sal_Int32 i = 0; i < nColumnCount; ++i )
+ {
+ ColumnInfo aColInfo;
+ aColInfo.xColumn.set( xColumns->getByIndex(i), UNO_QUERY_THROW );
+
+ xColumnProps.set( aColInfo.xColumn, UNO_QUERY_THROW );
+ OSL_VERIFY( xColumnProps->getPropertyValue( FM_PROP_ISNULLABLE ) >>= aColInfo.nNullable );
+ OSL_VERIFY( xColumnProps->getPropertyValue( FM_PROP_AUTOINCREMENT ) >>= aColInfo.bAutoIncrement );
+ OSL_VERIFY( xColumnProps->getPropertyValue( FM_PROP_NAME ) >>= aColInfo.sName );
+ OSL_VERIFY( xColumnProps->getPropertyValue( FM_PROP_ISREADONLY ) >>= aColInfo.bReadOnly );
+
+ m_aColumns.push_back( aColInfo );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//------------------------------------------------------------------------------
+namespace
+{
+ bool lcl_isBoundTo( const Reference< XPropertySet >& _rxControlModel, const Reference< XInterface >& _rxNormDBField )
+ {
+ Reference< XInterface > xNormBoundField( _rxControlModel->getPropertyValue( FM_PROP_BOUNDFIELD ), UNO_QUERY );
+ return ( xNormBoundField.get() == _rxNormDBField.get() );
+ }
+
+ bool lcl_isInputRequired( const Reference< XPropertySet >& _rxControlModel )
+ {
+ sal_Bool bInputRequired = sal_True;
+ OSL_VERIFY( _rxControlModel->getPropertyValue( FM_PROP_INPUT_REQUIRED ) >>= bInputRequired );
+ return ( bInputRequired != sal_False );
+ }
+
+ void lcl_resetColumnControlInfo( ColumnInfo& _rColInfo )
+ {
+ _rColInfo.xFirstControlWithInputRequired.clear();
+ _rColInfo.xFirstGridWithInputRequiredColumn.clear();
+ _rColInfo.nRequiredGridColumn = -1;
+ }
+}
+
+//------------------------------------------------------------------------------
+void ColumnInfoCache::deinitializeControls()
+{
+ for ( ColumnInfos::iterator col = m_aColumns.begin();
+ col != m_aColumns.end();
+ ++col
+ )
+ {
+ lcl_resetColumnControlInfo( *col );
+ }
+}
+
+//------------------------------------------------------------------------------
+void ColumnInfoCache::initializeControls( const Sequence< Reference< XControl > >& _rControls )
+{
+ try
+ {
+ // for every of our known columns, find the controls which are bound to this column
+ for ( ColumnInfos::iterator col = m_aColumns.begin();
+ col != m_aColumns.end();
+ ++col
+ )
+ {
+ OSL_ENSURE( !col->xFirstControlWithInputRequired.is() && !col->xFirstGridWithInputRequiredColumn.is()
+ && ( col->nRequiredGridColumn == -1 ), "ColumnInfoCache::initializeControls: called me twice?" );
+
+ lcl_resetColumnControlInfo( *col );
+
+ Reference< XInterface > xNormColumn( col->xColumn, UNO_QUERY_THROW );
+
+ const Reference< XControl >* pControl( _rControls.getConstArray() );
+ const Reference< XControl >* pControlEnd( pControl + _rControls.getLength() );
+ for ( ; pControl != pControlEnd; ++pControl )
+ {
+ if ( !pControl->is() )
+ continue;
+
+ Reference< XPropertySet > xModel( (*pControl)->getModel(), UNO_QUERY_THROW );
+ Reference< XPropertySetInfo > xModelPSI( xModel->getPropertySetInfo(), UNO_SET_THROW );
+
+ // special handling for grid controls
+ Reference< XGrid > xGrid( *pControl, UNO_QUERY );
+ if ( xGrid.is() )
+ {
+ Reference< XIndexAccess > xGridColAccess( xModel, UNO_QUERY_THROW );
+ sal_Int32 gridColCount = xGridColAccess->getCount();
+ sal_Int32 gridCol = 0;
+ for ( gridCol = 0; gridCol < gridColCount; ++gridCol )
+ {
+ Reference< XPropertySet > xGridColumnModel( xGridColAccess->getByIndex( gridCol ), UNO_QUERY_THROW );
+
+ if ( !lcl_isBoundTo( xGridColumnModel, xNormColumn )
+ || !lcl_isInputRequired( xGridColumnModel )
+ )
+ continue; // with next grid column
+
+ break;
+ }
+
+ if ( gridCol < gridColCount )
+ {
+ // found a grid column which is bound to the given
+ col->xFirstGridWithInputRequiredColumn = xGrid;
+ col->nRequiredGridColumn = gridCol;
+ break;
+ }
+
+ continue; // with next control
+ }
+
+ if ( !xModelPSI->hasPropertyByName( FM_PROP_BOUNDFIELD )
+ || !lcl_isBoundTo( xModel, xNormColumn )
+ || !lcl_isInputRequired( xModel )
+ )
+ continue; // with next control
+
+ break;
+ }
+
+ if ( pControl == pControlEnd )
+ // did not find a control which is bound to this particular column, and for which the input is required
+ continue; // with next DB column
+
+ col->xFirstControlWithInputRequired = *pControl;
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ m_bControlsInitialized = true;
+}
+
+//------------------------------------------------------------------------------
+const ColumnInfo& ColumnInfoCache::getColumnInfo( size_t _pos )
+{
+ if ( _pos >= m_aColumns.size() )
+ throw IndexOutOfBoundsException();
+
+ return m_aColumns[ _pos ];
+}
+
+//==================================================================
+// OParameterContinuation
+//==================================================================
+class OParameterContinuation : public OInteraction< XInteractionSupplyParameters >
+{
+ Sequence< PropertyValue > m_aValues;
+
+public:
+ OParameterContinuation() { }
+
+ Sequence< PropertyValue > getValues() const { return m_aValues; }
+
+// XInteractionSupplyParameters
+ virtual void SAL_CALL setParameters( const Sequence< PropertyValue >& _rValues ) throw(RuntimeException);
+};
+
+//------------------------------------------------------------------
+void SAL_CALL OParameterContinuation::setParameters( const Sequence< PropertyValue >& _rValues ) throw(RuntimeException)
+{
+ m_aValues = _rValues;
+}
+
+//==================================================================
+// FmXAutoControl
+//==================================================================
+struct FmFieldInfo
+{
+ rtl::OUString aFieldName;
+ Reference< XPropertySet > xField;
+ Reference< XTextComponent > xText;
+
+ FmFieldInfo(const Reference< XPropertySet >& _xField, const Reference< XTextComponent >& _xText)
+ :xField(_xField)
+ ,xText(_xText)
+ {xField->getPropertyValue(FM_PROP_NAME) >>= aFieldName;}
+};
+
+//==================================================================
+// FmXAutoControl
+//==================================================================
+class FmXAutoControl: public UnoControl
+
+{
+ friend Reference< XInterface > SAL_CALL FmXAutoControl_NewInstance_Impl();
+
+public:
+ FmXAutoControl(){}
+
+ virtual ::rtl::OUString GetComponentServiceName() {return ::rtl::OUString::createFromAscii("Edit");}
+ virtual void SAL_CALL createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw( RuntimeException );
+
+protected:
+ virtual void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const Any& rVal );
+};
+
+//------------------------------------------------------------------------------
+void FmXAutoControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw( RuntimeException )
+{
+ UnoControl::createPeer( rxToolkit, rParentPeer );
+
+ Reference< XTextComponent > xText(getPeer() , UNO_QUERY);
+ if (xText.is())
+ {
+ xText->setText(::rtl::OUString(String(SVX_RES(RID_STR_AUTOFIELD))));
+ xText->setEditable(sal_False);
+ }
+}
+
+//------------------------------------------------------------------------------
+void FmXAutoControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const Any& rVal )
+{
+ // these properties are ignored
+ if (rPropName == FM_PROP_TEXT)
+ return;
+
+ UnoControl::ImplSetPeerProperty( rPropName, rVal );
+}
+
+//------------------------------------------------------------------------------
+IMPL_LINK( FormController, OnActivateTabOrder, void*, /*EMPTYTAG*/ )
+{
+ activateTabOrder();
+ return 1;
+}
+
+//------------------------------------------------------------------------------
+struct UpdateAllListeners : public ::std::unary_function< Reference< XDispatch >, bool >
+{
+ bool operator()( const Reference< XDispatch >& _rxDispatcher ) const
+ {
+ static_cast< ::svx::OSingleFeatureDispatcher* >( _rxDispatcher.get() )->updateAllListeners();
+ // the return is a dummy only so we can use this struct in a std::compose1 call
+ return true;
+ }
+};
+//..............................................................................
+IMPL_LINK( FormController, OnInvalidateFeatures, void*, /*_pNotInterestedInThisParam*/ )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ for ( ::std::set< sal_Int16 >::const_iterator aLoop = m_aInvalidFeatures.begin();
+ aLoop != m_aInvalidFeatures.end();
+ ++aLoop
+ )
+ {
+ DispatcherContainer::const_iterator aDispatcherPos = m_aFeatureDispatchers.find( *aLoop );
+ if ( aDispatcherPos != m_aFeatureDispatchers.end() )
+ {
+ // TODO: for the real and actual listener notifications, we should release
+ // our mutex
+ UpdateAllListeners( )( aDispatcherPos->second );
+ }
+ }
+ return 1;
+}
+
+/*************************************************************************/
+
+DBG_NAME( FormController )
+//------------------------------------------------------------------
+FormController::FormController(const Reference< XMultiServiceFactory > & _rxORB )
+ :FormController_BASE( m_aMutex )
+ ,OPropertySetHelper( FormController_BASE::rBHelper )
+ ,OSQLParserClient( _rxORB )
+ ,m_aContext( _rxORB )
+ ,m_aActivateListeners(m_aMutex)
+ ,m_aModifyListeners(m_aMutex)
+ ,m_aErrorListeners(m_aMutex)
+ ,m_aDeleteListeners(m_aMutex)
+ ,m_aRowSetApproveListeners(m_aMutex)
+ ,m_aParameterListeners(m_aMutex)
+ ,m_aFilterListeners(m_aMutex)
+ ,m_pControlBorderManager( new ::svxform::ControlBorderManager )
+ ,m_xFormOperations()
+ ,m_aMode( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DataMode" ) ) )
+ ,m_aLoadEvent( LINK( this, FormController, OnLoad ) )
+ ,m_aToggleEvent( LINK( this, FormController, OnToggleAutoFields ) )
+ ,m_aActivationEvent( LINK( this, FormController, OnActivated ) )
+ ,m_aDeactivationEvent( LINK( this, FormController, OnDeactivated ) )
+ ,m_nCurrentFilterPosition(-1)
+ ,m_bCurrentRecordModified(sal_False)
+ ,m_bCurrentRecordNew(sal_False)
+ ,m_bLocked(sal_False)
+ ,m_bDBConnection(sal_False)
+ ,m_bCycle(sal_False)
+ ,m_bCanInsert(sal_False)
+ ,m_bCanUpdate(sal_False)
+ ,m_bCommitLock(sal_False)
+ ,m_bModified(sal_False)
+ ,m_bControlsSorted(sal_False)
+ ,m_bFiltering(sal_False)
+ ,m_bAttachEvents(sal_True)
+ ,m_bDetachEvents(sal_True)
+ ,m_bAttemptedHandlerCreation( false )
+ ,m_bSuspendFilterTextListening( false )
+{
+ DBG_CTOR( FormController, NULL );
+
+ ::comphelper::increment(m_refCount);
+ {
+ {
+ m_xAggregate = Reference< XAggregation >(
+ m_aContext.createComponent( "com.sun.star.awt.TabController" ),
+ UNO_QUERY
+ );
+ DBG_ASSERT( m_xAggregate.is(), "FormController::FormController : could not create my aggregate !" );
+ m_xTabController = Reference< XTabController >( m_xAggregate, UNO_QUERY );
+ }
+
+ if ( m_xAggregate.is() )
+ m_xAggregate->setDelegator( *this );
+ }
+ ::comphelper::decrement(m_refCount);
+
+ m_aTabActivationTimer.SetTimeout( 500 );
+ m_aTabActivationTimer.SetTimeoutHdl( LINK( this, FormController, OnActivateTabOrder ) );
+
+ m_aFeatureInvalidationTimer.SetTimeout( 200 );
+ m_aFeatureInvalidationTimer.SetTimeoutHdl( LINK( this, FormController, OnInvalidateFeatures ) );
+}
+
+//------------------------------------------------------------------
+FormController::~FormController()
+{
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ m_aLoadEvent.CancelPendingCall();
+ m_aToggleEvent.CancelPendingCall();
+ m_aActivationEvent.CancelPendingCall();
+ m_aDeactivationEvent.CancelPendingCall();
+
+ if ( m_aTabActivationTimer.IsActive() )
+ m_aTabActivationTimer.Stop();
+ }
+
+ if ( m_aFeatureInvalidationTimer.IsActive() )
+ m_aFeatureInvalidationTimer.Stop();
+
+ disposeAllFeaturesAndDispatchers();
+
+ if ( m_xFormOperations.is() )
+ m_xFormOperations->dispose();
+ m_xFormOperations.clear();
+
+ // Freigeben der Aggregation
+ if ( m_xAggregate.is() )
+ {
+ m_xAggregate->setDelegator( NULL );
+ m_xAggregate.clear();
+ }
+
+ DELETEZ( m_pControlBorderManager );
+
+ DBG_DTOR( FormController, NULL );
+}
+
+// -----------------------------------------------------------------------------
+void SAL_CALL FormController::acquire() throw ()
+{
+ FormController_BASE::acquire();
+}
+
+// -----------------------------------------------------------------------------
+void SAL_CALL FormController::release() throw ()
+{
+ FormController_BASE::release();
+}
+
+//------------------------------------------------------------------
+Any SAL_CALL FormController::queryInterface( const Type& _rType ) throw(RuntimeException)
+{
+ Any aRet = FormController_BASE::queryInterface( _rType );
+ if ( !aRet.hasValue() )
+ aRet = OPropertySetHelper::queryInterface( _rType );
+ if ( !aRet.hasValue() )
+ aRet = m_xAggregate->queryAggregation( _rType );
+ return aRet;
+}
+
+//------------------------------------------------------------------------------
+Sequence< sal_Int8 > SAL_CALL FormController::getImplementationId() throw( RuntimeException )
+{
+ static ::cppu::OImplementationId* pId = NULL;
+ if ( !pId )
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if ( !pId )
+ {
+ static ::cppu::OImplementationId aId;
+ pId = &aId;
+ }
+ }
+ return pId->getImplementationId();
+}
+
+//------------------------------------------------------------------------------
+Sequence< Type > SAL_CALL FormController::getTypes( ) throw(RuntimeException)
+{
+ return comphelper::concatSequences(
+ FormController_BASE::getTypes(),
+ ::cppu::OPropertySetHelper::getTypes()
+ );
+}
+
+// XServiceInfo
+//------------------------------------------------------------------------------
+sal_Bool SAL_CALL FormController::supportsService(const ::rtl::OUString& ServiceName) throw( RuntimeException )
+{
+ Sequence< ::rtl::OUString> aSNL(getSupportedServiceNames());
+ const ::rtl::OUString * pArray = aSNL.getConstArray();
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == ServiceName )
+ return sal_True;
+ return sal_False;
+}
+
+//------------------------------------------------------------------------------
+::rtl::OUString SAL_CALL FormController::getImplementationName() throw( RuntimeException )
+{
+ return ::rtl::OUString::createFromAscii( "org.openoffice.comp.svx.FormController" );
+}
+
+//------------------------------------------------------------------------------
+Sequence< ::rtl::OUString> SAL_CALL FormController::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ // service names which are supported only, but cannot be used to created an
+ // instance at a service factory
+ Sequence< ::rtl::OUString > aNonCreatableServiceNames( 1 );
+ aNonCreatableServiceNames[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.FormControllerDispatcher" ) );
+
+ // services which can be used to created an instance at a service factory
+ Sequence< ::rtl::OUString > aCreatableServiceNames( getSupportedServiceNames_Static() );
+ return ::comphelper::concatSequences( aCreatableServiceNames, aNonCreatableServiceNames );
+}
+
+//------------------------------------------------------------------------------
+sal_Bool SAL_CALL FormController::approveReset(const EventObject& /*rEvent*/) throw( RuntimeException )
+{
+ return sal_True;
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::resetted(const EventObject& rEvent) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ if (getCurrentControl().is() && (getCurrentControl()->getModel() == rEvent.Source))
+ m_bModified = sal_False;
+}
+
+//------------------------------------------------------------------------------
+Sequence< ::rtl::OUString> FormController::getSupportedServiceNames_Static(void)
+{
+ static Sequence< ::rtl::OUString> aServices;
+ if (!aServices.getLength())
+ {
+ aServices.realloc(2);
+ aServices.getArray()[0] = FM_FORM_CONTROLLER;
+ aServices.getArray()[1] = ::rtl::OUString::createFromAscii("com.sun.star.awt.control.TabController");
+ }
+ return aServices;
+}
+
+// -----------------------------------------------------------------------------
+namespace
+{
+ struct ResetComponentText : public ::std::unary_function< Reference< XTextComponent >, void >
+ {
+ void operator()( const Reference< XTextComponent >& _rxText )
+ {
+ _rxText->setText( ::rtl::OUString() );
+ }
+ };
+
+ struct RemoveComponentTextListener : public ::std::unary_function< Reference< XTextComponent >, void >
+ {
+ RemoveComponentTextListener( const Reference< XTextListener >& _rxListener )
+ :m_xListener( _rxListener )
+ {
+ }
+
+ void operator()( const Reference< XTextComponent >& _rxText )
+ {
+ _rxText->removeTextListener( m_xListener );
+ }
+
+ private:
+ Reference< XTextListener > m_xListener;
+ };
+}
+
+// -----------------------------------------------------------------------------
+void FormController::impl_setTextOnAllFilter_throw()
+{
+ m_bSuspendFilterTextListening = true;
+ ::comphelper::FlagGuard aResetFlag( m_bSuspendFilterTextListening );
+
+ // reset the text for all controls
+ ::std::for_each( m_aFilterComponents.begin(), m_aFilterComponents.end(), ResetComponentText() );
+
+ if ( m_aFilterRows.empty() )
+ // nothing to do anymore
+ return;
+
+ if ( m_nCurrentFilterPosition < 0 )
+ return;
+
+ // set the text for all filters
+ OSL_ENSURE( m_aFilterRows.size() > (size_t)m_nCurrentFilterPosition,
+ "FormController::impl_setTextOnAllFilter_throw: m_nCurrentFilterPosition too big" );
+
+ if ( (size_t)m_nCurrentFilterPosition < m_aFilterRows.size() )
+ {
+ FmFilterRow& rRow = m_aFilterRows[ m_nCurrentFilterPosition ];
+ for ( FmFilterRow::const_iterator iter2 = rRow.begin();
+ iter2 != rRow.end();
+ ++iter2
+ )
+ {
+ iter2->first->setText( iter2->second );
+ }
+ }
+}
+// OPropertySetHelper
+//------------------------------------------------------------------------------
+sal_Bool FormController::convertFastPropertyValue( Any & /*rConvertedValue*/, Any & /*rOldValue*/,
+ sal_Int32 /*nHandle*/, const Any& /*rValue*/ )
+ throw( IllegalArgumentException )
+{
+ return sal_False;
+}
+
+//------------------------------------------------------------------------------
+void FormController::setFastPropertyValue_NoBroadcast( sal_Int32 /*nHandle*/, const Any& /*rValue*/ )
+ throw( Exception )
+{
+}
+
+//------------------------------------------------------------------------------
+void FormController::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
+{
+ switch (nHandle)
+ {
+ case FM_ATTR_FILTER:
+ {
+ ::rtl::OUStringBuffer aFilter;
+ OStaticDataAccessTools aStaticTools;
+ Reference<XConnection> xConnection(aStaticTools.getRowSetConnection(Reference< XRowSet>(m_xModelAsIndex, UNO_QUERY)));
+ if (xConnection.is())
+ {
+ Reference< XDatabaseMetaData> xMetaData(xConnection->getMetaData());
+ Reference< XNumberFormatsSupplier> xFormatSupplier( aStaticTools.getNumberFormats( xConnection, sal_True ) );
+ Reference< XNumberFormatter> xFormatter( m_aContext.createComponent( "com.sun.star.util.NumberFormatter" ), UNO_QUERY_THROW );
+ xFormatter->attachNumberFormatsSupplier(xFormatSupplier);
+
+ Reference< XColumnsSupplier> xSupplyCols(m_xModelAsIndex, UNO_QUERY);
+ Reference< XNameAccess> xFields(xSupplyCols->getColumns(), UNO_QUERY);
+
+ ::rtl::OUString aQuote( xMetaData->getIdentifierQuoteString() );
+
+ // now add the filter rows
+ try
+ {
+ for ( FmFilterRows::const_iterator row = m_aFilterRows.begin(); row != m_aFilterRows.end(); ++row )
+ {
+ const FmFilterRow& rRow = *row;
+
+ if ( rRow.empty() )
+ continue;
+
+ ::rtl::OUStringBuffer aRowFilter;
+ for ( FmFilterRow::const_iterator condition = rRow.begin(); condition != rRow.end(); ++condition )
+ {
+ // get the field of the controls map
+ Reference< XControl > xControl( condition->first, UNO_QUERY_THROW );
+ Reference< XPropertySet > xModelProps( xControl->getModel(), UNO_QUERY_THROW );
+ Reference< XPropertySet > xField( xModelProps->getPropertyValue( FM_PROP_BOUNDFIELD ), UNO_QUERY_THROW );
+
+ ::rtl::OUString sFilterValue( condition->second );
+
+ ::rtl::OUString sErrorMsg, sCriteria;
+ const ::rtl::Reference< ISQLParseNode > xParseNode =
+ predicateTree( sErrorMsg, sFilterValue, xFormatter, xField );
+ OSL_ENSURE( xParseNode.is(), "FormController::getFastPropertyValue: could not parse the field value predicate!" );
+ if ( xParseNode.is() )
+ {
+ // don't use a parse context here, we need it unlocalized
+ xParseNode->parseNodeToStr( sCriteria, xConnection, NULL );
+ if ( condition != rRow.begin() )
+ aRowFilter.appendAscii( " AND " );
+ aRowFilter.append( sCriteria );
+ }
+ }
+ if ( aRowFilter.getLength() > 0 )
+ {
+ if ( aFilter.getLength() )
+ aFilter.appendAscii( " OR " );
+
+ aFilter.appendAscii( "( " );
+ aFilter.append( aRowFilter.makeStringAndClear() );
+ aFilter.appendAscii( " )" );
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ aFilter.setLength(0);
+ }
+ }
+ rValue <<= aFilter.makeStringAndClear();
+ }
+ break;
+
+ case FM_ATTR_FORM_OPERATIONS:
+ rValue <<= m_xFormOperations;
+ break;
+ }
+}
+
+//------------------------------------------------------------------------------
+Reference< XPropertySetInfo > FormController::getPropertySetInfo() throw( RuntimeException )
+{
+ static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+//------------------------------------------------------------------------------
+#define DECL_PROP_CORE(varname, type) \
+pDesc[nPos++] = Property(FM_PROP_##varname, FM_ATTR_##varname, ::getCppuType((const type*)0),
+
+
+#define DECL_PROP1(varname, type, attrib1) \
+ DECL_PROP_CORE(varname, type) PropertyAttribute::attrib1)
+
+//------------------------------------------------------------------------------
+void FormController::fillProperties(
+ Sequence< Property >& /* [out] */ _rProps,
+ Sequence< Property >& /* [out] */ /*_rAggregateProps*/
+ ) const
+{
+ _rProps.realloc(2);
+ sal_Int32 nPos = 0;
+ Property* pDesc = _rProps.getArray();
+ DECL_PROP1(FILTER, rtl::OUString, READONLY);
+ DECL_PROP1(FORM_OPERATIONS, Reference< XFormOperations >, READONLY);
+}
+
+//------------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper& FormController::getInfoHelper()
+{
+ return *getArrayHelper();
+}
+
+// XFilterController
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::addFilterControllerListener( const Reference< XFilterControllerListener >& _Listener ) throw( RuntimeException )
+{
+ m_aFilterListeners.addInterface( _Listener );
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::removeFilterControllerListener( const Reference< XFilterControllerListener >& _Listener ) throw( RuntimeException )
+{
+ m_aFilterListeners.removeInterface( _Listener );
+}
+
+//------------------------------------------------------------------------------
+::sal_Int32 SAL_CALL FormController::getFilterComponents() throw( ::com::sun::star::uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ return m_aFilterComponents.size();
+}
+
+//------------------------------------------------------------------------------
+::sal_Int32 SAL_CALL FormController::getDisjunctiveTerms() throw( ::com::sun::star::uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ return m_aFilterRows.size();
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::setPredicateExpression( ::sal_Int32 _Component, ::sal_Int32 _Term, const ::rtl::OUString& _PredicateExpression ) throw( RuntimeException, IndexOutOfBoundsException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ if ( ( _Component < 0 ) || ( _Component >= getFilterComponents() ) || ( _Term < 0 ) || ( _Term >= getDisjunctiveTerms() ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
+
+ Reference< XTextComponent > xText( m_aFilterComponents[ _Component ] );
+ xText->setText( _PredicateExpression );
+
+ FmFilterRow& rFilterRow = m_aFilterRows[ _Term ];
+ if ( _PredicateExpression.getLength() )
+ rFilterRow[ xText ] = _PredicateExpression;
+ else
+ rFilterRow.erase( xText );
+}
+
+//------------------------------------------------------------------------------
+Reference< XControl > FormController::getFilterComponent( ::sal_Int32 _Component ) throw( RuntimeException, IndexOutOfBoundsException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ if ( ( _Component < 0 ) || ( _Component >= getFilterComponents() ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
+
+ return Reference< XControl >( m_aFilterComponents[ _Component ], UNO_QUERY );
+}
+
+//------------------------------------------------------------------------------
+Sequence< Sequence< ::rtl::OUString > > FormController::getPredicateExpressions() throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ Sequence< Sequence< ::rtl::OUString > > aExpressions( m_aFilterRows.size() );
+ sal_Int32 termIndex = 0;
+ for ( FmFilterRows::const_iterator row = m_aFilterRows.begin();
+ row != m_aFilterRows.end();
+ ++row, ++termIndex
+ )
+ {
+ const FmFilterRow& rRow( *row );
+
+ Sequence< ::rtl::OUString > aConjunction( m_aFilterComponents.size() );
+ sal_Int32 componentIndex = 0;
+ for ( FilterComponents::const_iterator comp = m_aFilterComponents.begin();
+ comp != m_aFilterComponents.end();
+ ++comp, ++componentIndex
+ )
+ {
+ FmFilterRow::const_iterator predicate = rRow.find( *comp );
+ if ( predicate != rRow.end() )
+ aConjunction[ componentIndex ] = predicate->second;
+ }
+
+ aExpressions[ termIndex ] = aConjunction;
+ }
+
+ return aExpressions;
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::removeDisjunctiveTerm( ::sal_Int32 _Term ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ // SYNCHRONIZED -->
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ if ( ( _Term < 0 ) || ( _Term >= getDisjunctiveTerms() ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
+
+ // if the to-be-deleted row is our current row, we need to shift
+ if ( _Term == m_nCurrentFilterPosition )
+ {
+ if ( m_nCurrentFilterPosition < sal_Int32( m_aFilterRows.size() - 1 ) )
+ ++m_nCurrentFilterPosition;
+ else
+ --m_nCurrentFilterPosition;
+ }
+
+ FmFilterRows::iterator pos = m_aFilterRows.begin() + _Term;
+ m_aFilterRows.erase( pos );
+
+ // adjust m_nCurrentFilterPosition if the removed row preceeded it
+ if ( _Term < m_nCurrentFilterPosition )
+ --m_nCurrentFilterPosition;
+
+ OSL_POSTCOND( ( m_nCurrentFilterPosition < 0 ) == ( m_aFilterRows.empty() ),
+ "FormController::removeDisjunctiveTerm: inconsistency!" );
+
+ // update the texts in the filter controls
+ impl_setTextOnAllFilter_throw();
+
+ FilterEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.DisjunctiveTerm = _Term;
+ aGuard.clear();
+ // <-- SYNCHRONIZED
+
+ m_aFilterListeners.notifyEach( &XFilterControllerListener::disjunctiveTermRemoved, aEvent );
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::appendEmptyDisjunctiveTerm() throw (RuntimeException)
+{
+ // SYNCHRONIZED -->
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ impl_appendEmptyFilterRow( aGuard );
+ // <-- SYNCHRONIZED
+}
+
+//------------------------------------------------------------------------------
+::sal_Int32 SAL_CALL FormController::getActiveTerm() throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ return m_nCurrentFilterPosition;
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::setActiveTerm( ::sal_Int32 _ActiveTerm ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ if ( ( _ActiveTerm < 0 ) || ( _ActiveTerm >= getDisjunctiveTerms() ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
+
+ if ( _ActiveTerm == getActiveTerm() )
+ return;
+
+ m_nCurrentFilterPosition = _ActiveTerm;
+ impl_setTextOnAllFilter_throw();
+}
+
+// XElementAccess
+//------------------------------------------------------------------------------
+sal_Bool SAL_CALL FormController::hasElements(void) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ return !m_aChilds.empty();
+}
+
+//------------------------------------------------------------------------------
+Type SAL_CALL FormController::getElementType(void) throw( RuntimeException )
+{
+ return ::getCppuType((const Reference< XFormController>*)0);
+
+}
+
+// XEnumerationAccess
+//------------------------------------------------------------------------------
+Reference< XEnumeration > SAL_CALL FormController::createEnumeration(void) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ return new ::comphelper::OEnumerationByIndex(this);
+}
+
+// XIndexAccess
+//------------------------------------------------------------------------------
+sal_Int32 SAL_CALL FormController::getCount(void) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ return m_aChilds.size();
+}
+
+//------------------------------------------------------------------------------
+Any SAL_CALL FormController::getByIndex(sal_Int32 Index) throw( IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if (Index < 0 ||
+ Index >= (sal_Int32)m_aChilds.size())
+ throw IndexOutOfBoundsException();
+
+ return makeAny( m_aChilds[ Index ] );
+}
+
+// EventListener
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::disposing(const EventObject& e) throw( RuntimeException )
+{
+ // Ist der Container disposed worden
+ ::osl::MutexGuard aGuard( m_aMutex );
+ Reference< XControlContainer > xContainer(e.Source, UNO_QUERY);
+ if (xContainer.is())
+ {
+ setContainer(Reference< XControlContainer > ());
+ }
+ else
+ {
+ // ist ein Control disposed worden
+ Reference< XControl > xControl(e.Source, UNO_QUERY);
+ if (xControl.is())
+ {
+ if (getContainer().is())
+ removeControl(xControl);
+ }
+ }
+}
+
+// OComponentHelper
+//-----------------------------------------------------------------------------
+void FormController::disposeAllFeaturesAndDispatchers() SAL_THROW(())
+{
+ for ( DispatcherContainer::iterator aDispatcher = m_aFeatureDispatchers.begin();
+ aDispatcher != m_aFeatureDispatchers.end();
+ ++aDispatcher
+ )
+ {
+ try
+ {
+ ::comphelper::disposeComponent( aDispatcher->second );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ m_aFeatureDispatchers.clear();
+}
+
+//-----------------------------------------------------------------------------
+void FormController::disposing(void)
+{
+ EventObject aEvt( *this );
+
+ // if we're still active, simulate a "deactivated" event
+ if ( m_xActiveControl.is() )
+ m_aActivateListeners.notifyEach( &XFormControllerListener::formDeactivated, aEvt );
+
+ // notify all our listeners
+ m_aActivateListeners.disposeAndClear(aEvt);
+ m_aModifyListeners.disposeAndClear(aEvt);
+ m_aErrorListeners.disposeAndClear(aEvt);
+ m_aDeleteListeners.disposeAndClear(aEvt);
+ m_aRowSetApproveListeners.disposeAndClear(aEvt);
+ m_aParameterListeners.disposeAndClear(aEvt);
+ m_aFilterListeners.disposeAndClear(aEvt);
+
+ removeBoundFieldListener();
+ stopFiltering();
+
+ m_pControlBorderManager->restoreAll();
+
+ m_aFilterRows.clear();
+
+ ::osl::MutexGuard aGuard( m_aMutex );
+ m_xActiveControl = NULL;
+ implSetCurrentControl( NULL );
+
+ // clean up our children
+ for (FmFormControllers::const_iterator i = m_aChilds.begin();
+ i != m_aChilds.end(); i++)
+ {
+ // search the position of the model within the form
+ Reference< XFormComponent > xForm((*i)->getModel(), UNO_QUERY);
+ sal_uInt32 nPos = m_xModelAsIndex->getCount();
+ Reference< XFormComponent > xTemp;
+ for( ; nPos; )
+ {
+
+ m_xModelAsIndex->getByIndex( --nPos ) >>= xTemp;
+ if ( xForm.get() == xTemp.get() )
+ {
+ Reference< XInterface > xIfc( *i, UNO_QUERY );
+ m_xModelAsManager->detach( nPos, xIfc );
+ break;
+ }
+ }
+
+ Reference< XComponent > (*i, UNO_QUERY)->dispose();
+ }
+ m_aChilds.clear();
+
+ disposeAllFeaturesAndDispatchers();
+
+ if ( m_xFormOperations.is() )
+ m_xFormOperations->dispose();
+ m_xFormOperations.clear();
+
+ if (m_bDBConnection)
+ unload();
+
+ setContainer( NULL );
+ setModel( NULL );
+ setParent( NULL );
+
+ ::comphelper::disposeComponent( m_xComposer );
+
+ m_bDBConnection = sal_False;
+}
+
+//------------------------------------------------------------------------------
+namespace
+{
+ static bool lcl_shouldUseDynamicControlBorder( const Reference< XInterface >& _rxForm, const Any& _rDynamicColorProp )
+ {
+ bool bDoUse = false;
+ if ( !( _rDynamicColorProp >>= bDoUse ) )
+ {
+ DocumentType eDocType = DocumentClassification::classifyHostDocument( _rxForm );
+ return ControlLayouter::useDynamicBorderColor( eDocType );
+ }
+ return bDoUse;
+ }
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::propertyChange(const PropertyChangeEvent& evt) throw( RuntimeException )
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+ if ( evt.PropertyName == FM_PROP_BOUNDFIELD )
+ {
+ Reference<XPropertySet> xOldBound;
+ evt.OldValue >>= xOldBound;
+ if ( !xOldBound.is() && evt.NewValue.hasValue() )
+ {
+ Reference< XControlModel > xControlModel(evt.Source,UNO_QUERY);
+ Reference< XControl > xControl = findControl(m_aControls,xControlModel,sal_False,sal_False);
+ if ( xControl.is() )
+ {
+ startControlModifyListening( xControl );
+ Reference<XPropertySet> xProp(xControlModel,UNO_QUERY);
+ if ( xProp.is() )
+ xProp->removePropertyChangeListener(FM_PROP_BOUNDFIELD, this);
+ }
+ }
+ }
+ else
+ {
+ sal_Bool bModifiedChanged = (evt.PropertyName == FM_PROP_ISMODIFIED);
+ sal_Bool bNewChanged = (evt.PropertyName == FM_PROP_ISNEW);
+ if (bModifiedChanged || bNewChanged)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if (bModifiedChanged)
+ m_bCurrentRecordModified = ::comphelper::getBOOL(evt.NewValue);
+ else
+ m_bCurrentRecordNew = ::comphelper::getBOOL(evt.NewValue);
+
+ // toggle the locking
+ if (m_bLocked != determineLockState())
+ {
+ m_bLocked = !m_bLocked;
+ setLocks();
+ if (isListeningForChanges())
+ startListening();
+ else
+ stopListening();
+ }
+
+ if ( bNewChanged )
+ m_aToggleEvent.Call();
+
+ if (!m_bCurrentRecordModified)
+ m_bModified = sal_False;
+ }
+ else if ( evt.PropertyName == FM_PROP_DYNAMIC_CONTROL_BORDER )
+ {
+ bool bEnable = lcl_shouldUseDynamicControlBorder( evt.Source, evt.NewValue );
+ if ( bEnable )
+ {
+ m_pControlBorderManager->enableDynamicBorderColor();
+ if ( m_xActiveControl.is() )
+ m_pControlBorderManager->focusGained( m_xActiveControl.get() );
+ }
+ else
+ {
+ m_pControlBorderManager->disableDynamicBorderColor();
+ }
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+bool FormController::replaceControl( const Reference< XControl >& _rxExistentControl, const Reference< XControl >& _rxNewControl )
+{
+ bool bSuccess = false;
+ try
+ {
+ Reference< XIdentifierReplace > xContainer( getContainer(), UNO_QUERY );
+ DBG_ASSERT( xContainer.is(), "FormController::replaceControl: yes, it's not required by the service description, but XItentifierReplaces would be nice!" );
+ if ( xContainer.is() )
+ {
+ // look up the ID of _rxExistentControl
+ Sequence< sal_Int32 > aIdentifiers( xContainer->getIdentifiers() );
+ const sal_Int32* pIdentifiers = aIdentifiers.getConstArray();
+ const sal_Int32* pIdentifiersEnd = aIdentifiers.getConstArray() + aIdentifiers.getLength();
+ for ( ; pIdentifiers != pIdentifiersEnd; ++pIdentifiers )
+ {
+ Reference< XControl > xCheck( xContainer->getByIdentifier( *pIdentifiers ), UNO_QUERY );
+ if ( xCheck == _rxExistentControl )
+ break;
+ }
+ DBG_ASSERT( pIdentifiers != pIdentifiersEnd, "FormController::replaceControl: did not find the control in the container!" );
+ if ( pIdentifiers != pIdentifiersEnd )
+ {
+ bool bReplacedWasActive = ( m_xActiveControl.get() == _rxExistentControl.get() );
+ bool bReplacedWasCurrent = ( m_xCurrentControl.get() == _rxExistentControl.get() );
+
+ if ( bReplacedWasActive )
+ {
+ m_xActiveControl = NULL;
+ implSetCurrentControl( NULL );
+ }
+ else if ( bReplacedWasCurrent )
+ {
+ implSetCurrentControl( _rxNewControl );
+ }
+
+ // carry over the model
+ _rxNewControl->setModel( _rxExistentControl->getModel() );
+
+ xContainer->replaceByIdentifer( *pIdentifiers, makeAny( _rxNewControl ) );
+ bSuccess = true;
+
+ if ( bReplacedWasActive )
+ {
+ Reference< XWindow > xControlWindow( _rxNewControl, UNO_QUERY );
+ if ( xControlWindow.is() )
+ xControlWindow->setFocus();
+ }
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ Reference< XControl > xDisposeIt( bSuccess ? _rxExistentControl : _rxNewControl );
+ ::comphelper::disposeComponent( xDisposeIt );
+ return bSuccess;
+}
+
+//------------------------------------------------------------------------------
+void FormController::toggleAutoFields(sal_Bool bAutoFields)
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+
+
+ Sequence< Reference< XControl > > aControlsCopy( m_aControls );
+ const Reference< XControl >* pControls = aControlsCopy.getConstArray();
+ sal_Int32 nControls = aControlsCopy.getLength();
+
+ if (bAutoFields)
+ {
+ // as we don't want new controls to be attached to the scripting environment
+ // we change attach flags
+ m_bAttachEvents = sal_False;
+ for (sal_Int32 i = nControls; i > 0;)
+ {
+ Reference< XControl > xControl = pControls[--i];
+ if (xControl.is())
+ {
+ Reference< XPropertySet > xSet(xControl->getModel(), UNO_QUERY);
+ if (xSet.is() && ::comphelper::hasProperty(FM_PROP_BOUNDFIELD, xSet))
+ {
+ // does the model use a bound field ?
+ Reference< XPropertySet > xField;
+ xSet->getPropertyValue(FM_PROP_BOUNDFIELD) >>= xField;
+
+ // is it a autofield?
+ if ( xField.is()
+ && ::comphelper::hasProperty( FM_PROP_AUTOINCREMENT, xField )
+ && ::comphelper::getBOOL( xField->getPropertyValue( FM_PROP_AUTOINCREMENT ) )
+ )
+ {
+ replaceControl( xControl, new FmXAutoControl );
+ }
+ }
+ }
+ }
+ m_bAttachEvents = sal_True;
+ }
+ else
+ {
+ m_bDetachEvents = sal_False;
+ for (sal_Int32 i = nControls; i > 0;)
+ {
+ Reference< XControl > xControl = pControls[--i];
+ if (xControl.is())
+ {
+ Reference< XPropertySet > xSet(xControl->getModel(), UNO_QUERY);
+ if (xSet.is() && ::comphelper::hasProperty(FM_PROP_BOUNDFIELD, xSet))
+ {
+ // does the model use a bound field ?
+ Reference< XPropertySet > xField;
+ xSet->getPropertyValue(FM_PROP_BOUNDFIELD) >>= xField;
+
+ // is it a autofield?
+ if ( xField.is()
+ && ::comphelper::hasProperty( FM_PROP_AUTOINCREMENT, xField )
+ && ::comphelper::getBOOL( xField->getPropertyValue(FM_PROP_AUTOINCREMENT ) )
+ )
+ {
+ ::rtl::OUString sServiceName;
+ OSL_VERIFY( xSet->getPropertyValue( FM_PROP_DEFAULTCONTROL ) >>= sServiceName );
+ Reference< XControl > xNewControl( m_aContext.createComponent( sServiceName ), UNO_QUERY );
+ replaceControl( xControl, xNewControl );
+ }
+ }
+ }
+ }
+ m_bDetachEvents = sal_True;
+ }
+}
+
+//------------------------------------------------------------------------------
+IMPL_LINK(FormController, OnToggleAutoFields, void*, EMPTYARG)
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+
+ toggleAutoFields(m_bCurrentRecordNew);
+ return 1L;
+}
+
+// XTextListener
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::textChanged(const TextEvent& e) throw( RuntimeException )
+{
+ // SYNCHRONIZED -->
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+ if ( !m_bFiltering )
+ {
+ impl_onModify();
+ return;
+ }
+
+ if ( m_bSuspendFilterTextListening )
+ return;
+
+ Reference< XTextComponent > xText(e.Source,UNO_QUERY);
+ ::rtl::OUString aText = xText->getText();
+
+ if ( m_aFilterRows.empty() )
+ appendEmptyDisjunctiveTerm();
+
+ // Suchen der aktuellen Row
+ if ( ( (size_t)m_nCurrentFilterPosition >= m_aFilterRows.size() ) || ( m_nCurrentFilterPosition < 0 ) )
+ {
+ OSL_ENSURE( false, "FormController::textChanged: m_nCurrentFilterPosition is wrong!" );
+ return;
+ }
+
+ FmFilterRow& rRow = m_aFilterRows[ m_nCurrentFilterPosition ];
+
+ // do we have a new filter
+ if (aText.getLength())
+ rRow[xText] = aText;
+ else
+ {
+ // do we have the control in the row
+ FmFilterRow::iterator iter = rRow.find(xText);
+ // erase the entry out of the row
+ if (iter != rRow.end())
+ rRow.erase(iter);
+ }
+
+ // multiplex the event to our FilterControllerListeners
+ FilterEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.FilterComponent = ::std::find( m_aFilterComponents.begin(), m_aFilterComponents.end(), xText ) - m_aFilterComponents.begin();
+ aEvent.DisjunctiveTerm = getActiveTerm();
+ aEvent.PredicateExpression = aText;
+
+ aGuard.clear();
+ // <-- SYNCHRONIZED
+
+ // notify the changed filter expression
+ m_aFilterListeners.notifyEach( &XFilterControllerListener::predicateExpressionChanged, aEvent );
+}
+
+// XItemListener
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::itemStateChanged(const ItemEvent& /*rEvent*/) throw( RuntimeException )
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+ impl_onModify();
+}
+
+// XModificationBroadcaster
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::addModifyListener(const Reference< XModifyListener > & l) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+ m_aModifyListeners.addInterface( l );
+}
+
+//------------------------------------------------------------------------------
+void FormController::removeModifyListener(const Reference< XModifyListener > & l) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+ m_aModifyListeners.removeInterface( l );
+}
+
+// XModificationListener
+//------------------------------------------------------------------------------
+void FormController::modified( const EventObject& _rEvent ) throw( RuntimeException )
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+
+ try
+ {
+ if ( _rEvent.Source != m_xActiveControl )
+ { // let this control grab the focus
+ // (this case may happen if somebody moves the scroll wheel of the mouse over a control
+ // which does not have the focus)
+ // 85511 - 29.05.2001 - frank.schoenheit@germany.sun.com
+ //
+ // also, it happens when an image control gets a new image by double-clicking it
+ // #i88458# / 2009-01-12 / frank.schoenheit@sun.com
+ Reference< XWindow > xControlWindow( _rEvent.Source, UNO_QUERY_THROW );
+ xControlWindow->setFocus();
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ impl_onModify();
+}
+
+//------------------------------------------------------------------------------
+void FormController::impl_checkDisposed_throw() const
+{
+ if ( impl_isDisposed_nofail() )
+ throw DisposedException( ::rtl::OUString(), *const_cast< FormController* >( this ) );
+}
+
+//------------------------------------------------------------------------------
+void FormController::impl_onModify()
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_bModified )
+ m_bModified = sal_True;
+ }
+
+ EventObject aEvt(static_cast<cppu::OWeakObject*>(this));
+ m_aModifyListeners.notifyEach( &XModifyListener::modified, aEvt );
+}
+
+//------------------------------------------------------------------------------
+void FormController::impl_addFilterRow( const FmFilterRow& _row )
+{
+ m_aFilterRows.push_back( _row );
+
+ if ( m_aFilterRows.size() == 1 )
+ { // that's the first row ever
+ OSL_ENSURE( m_nCurrentFilterPosition == -1, "FormController::impl_addFilterRow: inconsistency!" );
+ m_nCurrentFilterPosition = 0;
+ }
+}
+
+//------------------------------------------------------------------------------
+void FormController::impl_appendEmptyFilterRow( ::osl::ClearableMutexGuard& _rClearBeforeNotify )
+{
+ // SYNCHRONIZED -->
+ impl_addFilterRow( FmFilterRow() );
+
+ // notify the listeners
+ FilterEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.DisjunctiveTerm = (sal_Int32)m_aFilterRows.size() - 1;
+ _rClearBeforeNotify.clear();
+ // <-- SYNCHRONIZED
+ m_aFilterListeners.notifyEach( &XFilterControllerListener::disjunctiveTermAdded, aEvent );
+}
+
+//------------------------------------------------------------------------------
+sal_Bool FormController::determineLockState() const
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+ // a.) in filter mode we are always locked
+ // b.) if we have no valid model or our model (a result set) is not alive -> we're locked
+ // c.) if we are inserting everything is OK and we are not locked
+ // d.) if are not updatable or on invalid position
+ Reference< XResultSet > xResultSet(m_xModelAsIndex, UNO_QUERY);
+ if (m_bFiltering || !xResultSet.is() || !isRowSetAlive(xResultSet))
+ return sal_True;
+ else
+ return (m_bCanInsert && m_bCurrentRecordNew) ? sal_False
+ : xResultSet->isBeforeFirst() || xResultSet->isAfterLast() || xResultSet->rowDeleted() || !m_bCanUpdate;
+}
+
+// FocusListener
+//------------------------------------------------------------------------------
+void FormController::focusGained(const FocusEvent& e) throw( RuntimeException )
+{
+ // SYNCHRONIZED -->
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ m_pControlBorderManager->focusGained( e.Source );
+
+ Reference< XControl > xControl(e.Source, UNO_QUERY);
+ if (m_bDBConnection)
+ {
+ // do we need to keep the locking of the commit
+ // we hold the lock as long as the control differs from the current
+ // otherwhise we disabled the lock
+ m_bCommitLock = m_bCommitLock && (XControl*)xControl.get() != (XControl*)m_xCurrentControl.get();
+ if (m_bCommitLock)
+ return;
+
+ // when do we have to commit a value to form or a filter
+ // a.) if the current value is modified
+ // b.) there must be a current control
+ // c.) and it must be different from the new focus owning control or
+ // d.) the focus is moving around (so we have only one control)
+
+ if ( ( m_bModified || m_bFiltering )
+ && m_xCurrentControl.is()
+ && ( ( xControl.get() != m_xCurrentControl.get() )
+ || ( ( e.FocusFlags & FocusChangeReason::AROUND )
+ && ( m_bCycle || m_bFiltering )
+ )
+ )
+ )
+ {
+ // check the old control if the content is ok
+#if (OSL_DEBUG_LEVEL > 1) || defined DBG_UTIL
+ Reference< XBoundControl > xLockingTest(m_xCurrentControl, UNO_QUERY);
+ sal_Bool bControlIsLocked = xLockingTest.is() && xLockingTest->getLock();
+ OSL_ENSURE(!bControlIsLocked, "FormController::Gained: I'm modified and the current control is locked ? How this ?");
+ // normalerweise sollte ein gelocktes Control nicht modified sein, also muss wohl mein bModified aus einem anderen Kontext
+ // gesetzt worden sein, was ich nicht verstehen wuerde ...
+#endif
+ DBG_ASSERT(m_xCurrentControl.is(), "kein CurrentControl gesetzt");
+ // zunaechst das Control fragen ob es das IFace unterstuetzt
+ Reference< XBoundComponent > xBound(m_xCurrentControl, UNO_QUERY);
+ if (!xBound.is() && m_xCurrentControl.is())
+ xBound = Reference< XBoundComponent > (m_xCurrentControl->getModel(), UNO_QUERY);
+
+ // lock if we lose the focus during commit
+ m_bCommitLock = sal_True;
+
+ // Commit nicht erfolgreich, Focus zuruecksetzen
+ if (xBound.is() && !xBound->commit())
+ {
+ // the commit failed and we don't commit again until the current control
+ // which couldn't be commit gains the focus again
+ Reference< XWindow > xWindow(m_xCurrentControl, UNO_QUERY);
+ if (xWindow.is())
+ xWindow->setFocus();
+ return;
+ }
+ else
+ {
+ m_bModified = sal_False;
+ m_bCommitLock = sal_False;
+ }
+ }
+
+ if (!m_bFiltering && m_bCycle && (e.FocusFlags & FocusChangeReason::AROUND) && m_xCurrentControl.is())
+ {
+ SQLErrorEvent aErrorEvent;
+ OSL_ENSURE( m_xFormOperations.is(), "FormController::focusGained: hmm?" );
+ // should have been created in setModel
+ try
+ {
+ if ( e.FocusFlags & FocusChangeReason::FORWARD )
+ {
+ if ( m_xFormOperations.is() && m_xFormOperations->isEnabled( FormFeature::MoveToNext ) )
+ m_xFormOperations->execute( FormFeature::MoveToNext );
+ }
+ else // backward
+ {
+ if ( m_xFormOperations.is() && m_xFormOperations->isEnabled( FormFeature::MoveToPrevious ) )
+ m_xFormOperations->execute( FormFeature::MoveToPrevious );
+ }
+ }
+ catch ( const Exception& )
+ {
+ // don't handle this any further. That's an ... admissible error.
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+
+ // Immer noch ein und dasselbe Control
+ if ( ( m_xActiveControl == xControl )
+ && ( xControl == m_xCurrentControl )
+ )
+ {
+ DBG_ASSERT(m_xCurrentControl.is(), "Kein CurrentControl selektiert");
+ return;
+ }
+
+ sal_Bool bActivated = !m_xActiveControl.is() && xControl.is();
+
+ m_xActiveControl = xControl;
+
+ implSetCurrentControl( xControl );
+ OSL_POSTCOND( m_xCurrentControl.is(), "implSetCurrentControl did nonsense!" );
+
+ if ( bActivated )
+ {
+ // (asynchronously) call activation handlers
+ m_aActivationEvent.Call();
+
+ // call modify listeners
+ if ( m_bModified )
+ m_aModifyListeners.notifyEach( &XModifyListener::modified, EventObject( *this ) );
+ }
+
+ // invalidate all features which depend on the currently focused control
+ if ( m_bDBConnection && !m_bFiltering )
+ implInvalidateCurrentControlDependentFeatures();
+
+ if ( !m_xCurrentControl.is() )
+ return;
+
+ // Control erhaelt Focus, dann eventuell in den sichtbaren Bereich
+ Reference< XFormControllerContext > xContext( m_xContext );
+ Reference< XControl > xCurrentControl( m_xCurrentControl );
+ aGuard.clear();
+ // <-- SYNCHRONIZED
+
+ if ( xContext.is() )
+ xContext->makeVisible( xCurrentControl );
+}
+
+//------------------------------------------------------------------------------
+IMPL_LINK( FormController, OnActivated, void*, /**/ )
+{
+ EventObject aEvent;
+ aEvent.Source = *this;
+ m_aActivateListeners.notifyEach( &XFormControllerListener::formActivated, aEvent );
+
+ return 0L;
+}
+
+//------------------------------------------------------------------------------
+IMPL_LINK( FormController, OnDeactivated, void*, /**/ )
+{
+ EventObject aEvent;
+ aEvent.Source = *this;
+ m_aActivateListeners.notifyEach( &XFormControllerListener::formDeactivated, aEvent );
+
+ return 0L;
+}
+
+//------------------------------------------------------------------------------
+void FormController::focusLost(const FocusEvent& e) throw( RuntimeException )
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+
+ m_pControlBorderManager->focusLost( e.Source );
+
+ Reference< XControl > xControl(e.Source, UNO_QUERY);
+ Reference< XWindowPeer > xNext(e.NextFocus, UNO_QUERY);
+ Reference< XControl > xNextControl = isInList(xNext);
+ if (!xNextControl.is())
+ {
+ m_xActiveControl = NULL;
+ m_aDeactivationEvent.Call();
+ }
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL FormController::mousePressed( const awt::MouseEvent& /*_rEvent*/ ) throw (RuntimeException)
+{
+ // not interested in
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL FormController::mouseReleased( const awt::MouseEvent& /*_rEvent*/ ) throw (RuntimeException)
+{
+ // not interested in
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL FormController::mouseEntered( const awt::MouseEvent& _rEvent ) throw (RuntimeException)
+{
+ m_pControlBorderManager->mouseEntered( _rEvent.Source );
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL FormController::mouseExited( const awt::MouseEvent& _rEvent ) throw (RuntimeException)
+{
+ m_pControlBorderManager->mouseExited( _rEvent.Source );
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL FormController::componentValidityChanged( const EventObject& _rSource ) throw (RuntimeException)
+{
+ Reference< XControl > xControl( findControl( m_aControls, Reference< XControlModel >( _rSource.Source, UNO_QUERY ), sal_False, sal_False ) );
+ Reference< XValidatableFormComponent > xValidatable( _rSource.Source, UNO_QUERY );
+
+ OSL_ENSURE( xControl.is() && xValidatable.is(), "FormController::componentValidityChanged: huh?" );
+
+ if ( xControl.is() && xValidatable.is() )
+ m_pControlBorderManager->validityChanged( xControl, xValidatable );
+}
+
+//--------------------------------------------------------------------
+void FormController::setModel(const Reference< XTabControllerModel > & Model) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ DBG_ASSERT(m_xTabController.is(), "FormController::setModel : invalid aggregate !");
+
+ try
+ {
+ // disconnect from the old model
+ if (m_xModelAsIndex.is())
+ {
+ if (m_bDBConnection)
+ {
+ // we are currently working on the model
+ EventObject aEvt(m_xModelAsIndex);
+ unloaded(aEvt);
+ }
+
+ Reference< XLoadable > xForm(m_xModelAsIndex, UNO_QUERY);
+ if (xForm.is())
+ xForm->removeLoadListener(this);
+
+ Reference< XSQLErrorBroadcaster > xBroadcaster(m_xModelAsIndex, UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->removeSQLErrorListener(this);
+
+ Reference< XDatabaseParameterBroadcaster > xParamBroadcaster(m_xModelAsIndex, UNO_QUERY);
+ if (xParamBroadcaster.is())
+ xParamBroadcaster->removeParameterListener(this);
+
+ }
+
+ disposeAllFeaturesAndDispatchers();
+
+ if ( m_xFormOperations.is() )
+ m_xFormOperations->dispose();
+ m_xFormOperations.clear();
+
+ // set the new model wait for the load event
+ if (m_xTabController.is())
+ m_xTabController->setModel(Model);
+ m_xModelAsIndex = Reference< XIndexAccess > (Model, UNO_QUERY);
+ m_xModelAsManager = Reference< XEventAttacherManager > (Model, UNO_QUERY);
+
+ // only if both ifaces exit, the controller will work successful
+ if (!m_xModelAsIndex.is() || !m_xModelAsManager.is())
+ {
+ m_xModelAsManager = NULL;
+ m_xModelAsIndex = NULL;
+ }
+
+ if (m_xModelAsIndex.is())
+ {
+ // re-create m_xFormOperations
+ m_xFormOperations.set( FormOperations::createWithFormController( m_aContext.getUNOContext(), this ), UNO_SET_THROW );
+ m_xFormOperations->setFeatureInvalidation( this );
+
+ // adding load and ui interaction listeners
+ Reference< XLoadable > xForm(Model, UNO_QUERY);
+ if (xForm.is())
+ xForm->addLoadListener(this);
+
+ Reference< XSQLErrorBroadcaster > xBroadcaster(Model, UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->addSQLErrorListener(this);
+
+ Reference< XDatabaseParameterBroadcaster > xParamBroadcaster(Model, UNO_QUERY);
+ if (xParamBroadcaster.is())
+ xParamBroadcaster->addParameterListener(this);
+
+ // well, is the database already loaded?
+ // then we have to simulate a load event
+ Reference< XLoadable > xCursor(m_xModelAsIndex, UNO_QUERY);
+ if (xCursor.is() && xCursor->isLoaded())
+ {
+ EventObject aEvt(xCursor);
+ loaded(aEvt);
+ }
+
+ Reference< XPropertySet > xModelProps( m_xModelAsIndex, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropInfo( xModelProps->getPropertySetInfo() );
+ if ( xPropInfo.is()
+ && xPropInfo->hasPropertyByName( FM_PROP_DYNAMIC_CONTROL_BORDER )
+ && xPropInfo->hasPropertyByName( FM_PROP_CONTROL_BORDER_COLOR_FOCUS )
+ && xPropInfo->hasPropertyByName( FM_PROP_CONTROL_BORDER_COLOR_MOUSE )
+ && xPropInfo->hasPropertyByName( FM_PROP_CONTROL_BORDER_COLOR_INVALID )
+ )
+ {
+ bool bEnableDynamicControlBorder = lcl_shouldUseDynamicControlBorder(
+ xModelProps.get(), xModelProps->getPropertyValue( FM_PROP_DYNAMIC_CONTROL_BORDER ) );
+ if ( bEnableDynamicControlBorder )
+ m_pControlBorderManager->enableDynamicBorderColor();
+ else
+ m_pControlBorderManager->disableDynamicBorderColor();
+
+ sal_Int32 nColor = 0;
+ if ( xModelProps->getPropertyValue( FM_PROP_CONTROL_BORDER_COLOR_FOCUS ) >>= nColor )
+ m_pControlBorderManager->setStatusColor( CONTROL_STATUS_FOCUSED, nColor );
+ if ( xModelProps->getPropertyValue( FM_PROP_CONTROL_BORDER_COLOR_MOUSE ) >>= nColor )
+ m_pControlBorderManager->setStatusColor( CONTROL_STATUS_MOUSE_HOVER, nColor );
+ if ( xModelProps->getPropertyValue( FM_PROP_CONTROL_BORDER_COLOR_INVALID ) >>= nColor )
+ m_pControlBorderManager->setStatusColor( CONTROL_STATUS_INVALID, nColor );
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//------------------------------------------------------------------------------
+Reference< XTabControllerModel > FormController::getModel() throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ DBG_ASSERT(m_xTabController.is(), "FormController::getModel : invalid aggregate !");
+ if (!m_xTabController.is())
+ return Reference< XTabControllerModel > ();
+ return m_xTabController->getModel();
+}
+
+//------------------------------------------------------------------------------
+void FormController::addToEventAttacher(const Reference< XControl > & xControl)
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+ OSL_ENSURE( xControl.is(), "FormController::addToEventAttacher: invalid control - how did you reach this?" );
+ if ( !xControl.is() )
+ return; /* throw IllegalArgumentException(); */
+
+ // anmelden beim Eventattacher
+ Reference< XFormComponent > xComp(xControl->getModel(), UNO_QUERY);
+ if (xComp.is() && m_xModelAsIndex.is())
+ {
+ // Und die Position des ControlModel darin suchen
+ sal_uInt32 nPos = m_xModelAsIndex->getCount();
+ Reference< XFormComponent > xTemp;
+ for( ; nPos; )
+ {
+ m_xModelAsIndex->getByIndex(--nPos) >>= xTemp;
+ if ((XFormComponent*)xComp.get() == (XFormComponent*)xTemp.get())
+ {
+ Reference< XInterface > xIfc(xControl, UNO_QUERY);
+ m_xModelAsManager->attach( nPos, xIfc, makeAny(xControl) );
+ break;
+ }
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void FormController::removeFromEventAttacher(const Reference< XControl > & xControl)
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+ OSL_ENSURE( xControl.is(), "FormController::removeFromEventAttacher: invalid control - how did you reach this?" );
+ if ( !xControl.is() )
+ return; /* throw IllegalArgumentException(); */
+
+ // abmelden beim Eventattacher
+ Reference< XFormComponent > xComp(xControl->getModel(), UNO_QUERY);
+ if ( xComp.is() && m_xModelAsIndex.is() )
+ {
+ // Und die Position des ControlModel darin suchen
+ sal_uInt32 nPos = m_xModelAsIndex->getCount();
+ Reference< XFormComponent > xTemp;
+ for( ; nPos; )
+ {
+ m_xModelAsIndex->getByIndex(--nPos) >>= xTemp;
+ if ((XFormComponent*)xComp.get() == (XFormComponent*)xTemp.get())
+ {
+ Reference< XInterface > xIfc(xControl, UNO_QUERY);
+ m_xModelAsManager->detach( nPos, xIfc );
+ break;
+ }
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void FormController::setContainer(const Reference< XControlContainer > & xContainer) throw( RuntimeException )
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+ Reference< XTabControllerModel > xTabModel(getModel());
+ DBG_ASSERT(xTabModel.is() || !xContainer.is(), "No Model defined");
+ // if we have a new container we need a model
+ DBG_ASSERT(m_xTabController.is(), "FormController::setContainer : invalid aggregate !");
+
+ ::osl::MutexGuard aGuard( m_aMutex );
+ Reference< XContainer > xCurrentContainer;
+ if (m_xTabController.is())
+ xCurrentContainer = Reference< XContainer > (m_xTabController->getContainer(), UNO_QUERY);
+ if (xCurrentContainer.is())
+ {
+ xCurrentContainer->removeContainerListener(this);
+
+ if ( m_aTabActivationTimer.IsActive() )
+ m_aTabActivationTimer.Stop();
+
+ // clear the filter map
+ ::std::for_each( m_aFilterComponents.begin(), m_aFilterComponents.end(), RemoveComponentTextListener( this ) );
+ m_aFilterComponents.clear();
+
+ // einsammeln der Controls
+ const Reference< XControl >* pControls = m_aControls.getConstArray();
+ const Reference< XControl >* pControlsEnd = pControls + m_aControls.getLength();
+ while ( pControls != pControlsEnd )
+ implControlRemoved( *pControls++, true );
+
+ // Datenbank spezifische Dinge vornehmen
+ if (m_bDBConnection && isListeningForChanges())
+ stopListening();
+
+ m_aControls.realloc( 0 );
+ }
+
+ if (m_xTabController.is())
+ m_xTabController->setContainer(xContainer);
+
+ // Welche Controls gehoeren zum Container ?
+ if (xContainer.is() && xTabModel.is())
+ {
+ Sequence< Reference< XControlModel > > aModels = xTabModel->getControlModels();
+ const Reference< XControlModel > * pModels = aModels.getConstArray();
+ Sequence< Reference< XControl > > aAllControls = xContainer->getControls();
+
+ sal_Int32 nCount = aModels.getLength();
+ m_aControls = Sequence< Reference< XControl > >( nCount );
+ Reference< XControl > * pControls = m_aControls.getArray();
+
+ // einsammeln der Controls
+ sal_Int32 i, j;
+ for (i = 0, j = 0; i < nCount; ++i, ++pModels )
+ {
+ Reference< XControl > xControl = findControl( aAllControls, *pModels, sal_False, sal_True );
+ if ( xControl.is() )
+ {
+ pControls[j++] = xControl;
+ implControlInserted( xControl, true );
+ }
+ }
+
+ // not every model had an associated control
+ if (j != i)
+ m_aControls.realloc(j);
+
+ // am Container horchen
+ Reference< XContainer > xNewContainer(xContainer, UNO_QUERY);
+ if (xNewContainer.is())
+ xNewContainer->addContainerListener(this);
+
+ // Datenbank spezifische Dinge vornehmen
+ if (m_bDBConnection)
+ {
+ m_bLocked = determineLockState();
+ setLocks();
+ if (!isLocked())
+ startListening();
+ }
+ }
+ // befinden sich die Controls in der richtigen Reihenfolge
+ m_bControlsSorted = sal_True;
+}
+
+//------------------------------------------------------------------------------
+Reference< XControlContainer > FormController::getContainer() throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ DBG_ASSERT(m_xTabController.is(), "FormController::getContainer : invalid aggregate !");
+ if (!m_xTabController.is())
+ return Reference< XControlContainer > ();
+ return m_xTabController->getContainer();
+}
+
+//------------------------------------------------------------------------------
+Sequence< Reference< XControl > > FormController::getControls(void) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ if (!m_bControlsSorted)
+ {
+ Reference< XTabControllerModel > xModel = getModel();
+ if (!xModel.is())
+ return m_aControls;
+
+ Sequence< Reference< XControlModel > > aControlModels = xModel->getControlModels();
+ const Reference< XControlModel > * pModels = aControlModels.getConstArray();
+ sal_Int32 nModels = aControlModels.getLength();
+
+ Sequence< Reference< XControl > > aNewControls(nModels);
+
+ Reference< XControl > * pControls = aNewControls.getArray();
+ Reference< XControl > xControl;
+
+ // Umsortieren der Controls entsprechend der TabReihenfolge
+ sal_Int32 j = 0;
+ for (sal_Int32 i = 0; i < nModels; ++i, ++pModels )
+ {
+ xControl = findControl( m_aControls, *pModels, sal_True, sal_True );
+ if ( xControl.is() )
+ pControls[j++] = xControl;
+ }
+
+ // not every model had an associated control
+ if ( j != nModels )
+ aNewControls.realloc( j );
+
+ m_aControls = aNewControls;
+ m_bControlsSorted = sal_True;
+ }
+ return m_aControls;
+}
+
+//------------------------------------------------------------------------------
+void FormController::autoTabOrder() throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ DBG_ASSERT(m_xTabController.is(), "FormController::autoTabOrder : invalid aggregate !");
+ if (m_xTabController.is())
+ m_xTabController->autoTabOrder();
+}
+
+//------------------------------------------------------------------------------
+void FormController::activateTabOrder() throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ DBG_ASSERT(m_xTabController.is(), "FormController::activateTabOrder : invalid aggregate !");
+ if (m_xTabController.is())
+ m_xTabController->activateTabOrder();
+}
+
+//------------------------------------------------------------------------------
+void FormController::setControlLock(const Reference< XControl > & xControl)
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+ sal_Bool bLocked = isLocked();
+
+ // es wird gelockt
+ // a.) wenn der ganze Datensatz gesperrt ist
+ // b.) wenn das zugehoerige Feld gespeert ist
+ Reference< XBoundControl > xBound(xControl, UNO_QUERY);
+ if (xBound.is() && (( (bLocked && bLocked != xBound->getLock()) ||
+ !bLocked))) // beim entlocken immer einzelne Felder ueberprüfen
+ {
+ // gibt es eine Datenquelle
+ Reference< XPropertySet > xSet(xControl->getModel(), UNO_QUERY);
+ if (xSet.is() && ::comphelper::hasProperty(FM_PROP_BOUNDFIELD, xSet))
+ {
+ // wie sieht mit den Properties ReadOnly und Enable aus
+ sal_Bool bTouch = sal_True;
+ if (::comphelper::hasProperty(FM_PROP_ENABLED, xSet))
+ bTouch = ::comphelper::getBOOL(xSet->getPropertyValue(FM_PROP_ENABLED));
+ if (::comphelper::hasProperty(FM_PROP_READONLY, xSet))
+ bTouch = !::comphelper::getBOOL(xSet->getPropertyValue(FM_PROP_READONLY));
+
+ if (bTouch)
+ {
+ Reference< XPropertySet > xField;
+ xSet->getPropertyValue(FM_PROP_BOUNDFIELD) >>= xField;
+ if (xField.is())
+ {
+ if (bLocked)
+ xBound->setLock(bLocked);
+ else
+ {
+ try
+ {
+ Any aVal = xField->getPropertyValue(FM_PROP_ISREADONLY);
+ if (aVal.hasValue() && ::comphelper::getBOOL(aVal))
+ xBound->setLock(sal_True);
+ else
+ xBound->setLock(bLocked);
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ }
+ }
+ }
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void FormController::setLocks()
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+ // alle Controls, die mit einer Datenquelle verbunden sind locken/unlocken
+ const Reference< XControl >* pControls = m_aControls.getConstArray();
+ const Reference< XControl >* pControlsEnd = pControls + m_aControls.getLength();
+ while ( pControls != pControlsEnd )
+ setControlLock( *pControls++ );
+}
+
+//------------------------------------------------------------------------------
+namespace
+{
+ bool lcl_shouldListenForModifications( const Reference< XControl >& _rxControl, const Reference< XPropertyChangeListener >& _rxBoundFieldListener )
+ {
+ bool bShould = false;
+
+ Reference< XBoundComponent > xBound( _rxControl, UNO_QUERY );
+ if ( xBound.is() )
+ {
+ bShould = true;
+ }
+ else if ( _rxControl.is() )
+ {
+ Reference< XPropertySet > xModelProps( _rxControl->getModel(), UNO_QUERY );
+ if ( xModelProps.is() && ::comphelper::hasProperty( FM_PROP_BOUNDFIELD, xModelProps ) )
+ {
+ Reference< XPropertySet > xField;
+ xModelProps->getPropertyValue( FM_PROP_BOUNDFIELD ) >>= xField;
+ bShould = xField.is();
+
+ if ( !bShould && _rxBoundFieldListener.is() )
+ xModelProps->addPropertyChangeListener( FM_PROP_BOUNDFIELD, _rxBoundFieldListener );
+ }
+ }
+
+ return bShould;
+ }
+}
+
+//------------------------------------------------------------------------------
+void FormController::startControlModifyListening(const Reference< XControl > & xControl)
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+
+ bool bModifyListening = lcl_shouldListenForModifications( xControl, this );
+
+ // artificial while
+ while ( bModifyListening )
+ {
+ Reference< XModifyBroadcaster > xMod(xControl, UNO_QUERY);
+ if (xMod.is())
+ {
+ xMod->addModifyListener(this);
+ break;
+ }
+
+ // alle die Text um vorzeitig ein modified zu erkennen
+ Reference< XTextComponent > xText(xControl, UNO_QUERY);
+ if (xText.is())
+ {
+ xText->addTextListener(this);
+ break;
+ }
+
+ Reference< XCheckBox > xBox(xControl, UNO_QUERY);
+ if (xBox.is())
+ {
+ xBox->addItemListener(this);
+ break;
+ }
+
+ Reference< XComboBox > xCbBox(xControl, UNO_QUERY);
+ if (xCbBox.is())
+ {
+ xCbBox->addItemListener(this);
+ break;
+ }
+
+ Reference< XListBox > xListBox(xControl, UNO_QUERY);
+ if (xListBox.is())
+ {
+ xListBox->addItemListener(this);
+ break;
+ }
+ break;
+ }
+}
+
+//------------------------------------------------------------------------------
+void FormController::stopControlModifyListening(const Reference< XControl > & xControl)
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+
+ bool bModifyListening = lcl_shouldListenForModifications( xControl, NULL );
+
+ // kuenstliches while
+ while (bModifyListening)
+ {
+ Reference< XModifyBroadcaster > xMod(xControl, UNO_QUERY);
+ if (xMod.is())
+ {
+ xMod->removeModifyListener(this);
+ break;
+ }
+ // alle die Text um vorzeitig ein modified zu erkennen
+ Reference< XTextComponent > xText(xControl, UNO_QUERY);
+ if (xText.is())
+ {
+ xText->removeTextListener(this);
+ break;
+ }
+
+ Reference< XCheckBox > xBox(xControl, UNO_QUERY);
+ if (xBox.is())
+ {
+ xBox->removeItemListener(this);
+ break;
+ }
+
+ Reference< XComboBox > xCbBox(xControl, UNO_QUERY);
+ if (xCbBox.is())
+ {
+ xCbBox->removeItemListener(this);
+ break;
+ }
+
+ Reference< XListBox > xListBox(xControl, UNO_QUERY);
+ if (xListBox.is())
+ {
+ xListBox->removeItemListener(this);
+ break;
+ }
+ break;
+ }
+}
+
+//------------------------------------------------------------------------------
+void FormController::startListening()
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+ m_bModified = sal_False;
+
+ // jetzt anmelden bei gebundenen feldern
+ const Reference< XControl >* pControls = m_aControls.getConstArray();
+ const Reference< XControl >* pControlsEnd = pControls + m_aControls.getLength();
+ while ( pControls != pControlsEnd )
+ startControlModifyListening( *pControls++ );
+}
+
+//------------------------------------------------------------------------------
+void FormController::stopListening()
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+ m_bModified = sal_False;
+
+ // jetzt anmelden bei gebundenen feldern
+ const Reference< XControl >* pControls = m_aControls.getConstArray();
+ const Reference< XControl >* pControlsEnd = pControls + m_aControls.getLength();
+ while ( pControls != pControlsEnd )
+ stopControlModifyListening( *pControls++ );
+}
+
+
+//------------------------------------------------------------------------------
+Reference< XControl > FormController::findControl(Sequence< Reference< XControl > >& _rControls, const Reference< XControlModel > & xCtrlModel ,sal_Bool _bRemove,sal_Bool _bOverWrite) const
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+ DBG_ASSERT( xCtrlModel.is(), "findControl - welches ?!" );
+
+ Reference< XControl >* pControls = _rControls.getArray();
+ Reference< XControlModel > xModel;
+ for ( sal_Int32 i = 0, nCount = _rControls.getLength(); i < nCount; ++i, ++pControls )
+ {
+ if ( pControls->is() )
+ {
+ xModel = (*pControls)->getModel();
+ if ( xModel.get() == xCtrlModel.get() )
+ {
+ Reference< XControl > xControl( *pControls );
+ if ( _bRemove )
+ ::comphelper::removeElementAt( _rControls, i );
+ else if ( _bOverWrite )
+ *pControls = Reference< XControl >();
+ return xControl;
+ }
+ }
+ }
+ return Reference< XControl > ();
+}
+
+//------------------------------------------------------------------------------
+void FormController::implControlInserted( const Reference< XControl>& _rxControl, bool _bAddToEventAttacher )
+{
+ Reference< XWindow > xWindow( _rxControl, UNO_QUERY );
+ if ( xWindow.is() )
+ {
+ xWindow->addFocusListener( this );
+ xWindow->addMouseListener( this );
+
+ if ( _bAddToEventAttacher )
+ addToEventAttacher( _rxControl );
+ }
+
+ // add a dispatch interceptor to the control (if supported)
+ Reference< XDispatchProviderInterception > xInterception( _rxControl, UNO_QUERY );
+ if ( xInterception.is() )
+ createInterceptor( xInterception );
+
+ if ( _rxControl.is() )
+ {
+ Reference< XControlModel > xModel( _rxControl->getModel() );
+
+ // we want to know about the reset of the the model of our controls
+ // (for correctly resetting m_bModified)
+ Reference< XReset > xReset( xModel, UNO_QUERY );
+ if ( xReset.is() )
+ xReset->addResetListener( this );
+
+ // and we want to know about the validity, to visually indicate it
+ Reference< XValidatableFormComponent > xValidatable( xModel, UNO_QUERY );
+ if ( xValidatable.is() )
+ {
+ xValidatable->addFormComponentValidityListener( this );
+ m_pControlBorderManager->validityChanged( _rxControl, xValidatable );
+ }
+ }
+
+}
+
+//------------------------------------------------------------------------------
+void FormController::implControlRemoved( const Reference< XControl>& _rxControl, bool _bRemoveFromEventAttacher )
+{
+ Reference< XWindow > xWindow( _rxControl, UNO_QUERY );
+ if ( xWindow.is() )
+ {
+ xWindow->removeFocusListener( this );
+ xWindow->removeMouseListener( this );
+
+ if ( _bRemoveFromEventAttacher )
+ removeFromEventAttacher( _rxControl );
+ }
+
+ Reference< XDispatchProviderInterception > xInterception( _rxControl, UNO_QUERY);
+ if ( xInterception.is() )
+ deleteInterceptor( xInterception );
+
+ if ( _rxControl.is() )
+ {
+ Reference< XControlModel > xModel( _rxControl->getModel() );
+
+ Reference< XReset > xReset( xModel, UNO_QUERY );
+ if ( xReset.is() )
+ xReset->removeResetListener( this );
+
+ Reference< XValidatableFormComponent > xValidatable( xModel, UNO_QUERY );
+ if ( xValidatable.is() )
+ xValidatable->removeFormComponentValidityListener( this );
+ }
+}
+
+//------------------------------------------------------------------------------
+void FormController::implSetCurrentControl( const Reference< XControl >& _rxControl )
+{
+ if ( m_xCurrentControl.get() == _rxControl.get() )
+ return;
+
+ Reference< XGridControl > xGridControl( m_xCurrentControl, UNO_QUERY );
+ if ( xGridControl.is() )
+ xGridControl->removeGridControlListener( this );
+
+ m_xCurrentControl = _rxControl;
+
+ xGridControl.set( m_xCurrentControl, UNO_QUERY );
+ if ( xGridControl.is() )
+ xGridControl->addGridControlListener( this );
+}
+
+//------------------------------------------------------------------------------
+void FormController::insertControl(const Reference< XControl > & xControl)
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+ m_bControlsSorted = sal_False;
+ m_aControls.realloc(m_aControls.getLength() + 1);
+ m_aControls.getArray()[m_aControls.getLength() - 1] = xControl;
+
+ if ( m_pColumnInfoCache.get() )
+ m_pColumnInfoCache->deinitializeControls();
+
+ implControlInserted( xControl, m_bAttachEvents );
+
+ if (m_bDBConnection && !m_bFiltering)
+ setControlLock(xControl);
+
+ if (isListeningForChanges() && m_bAttachEvents)
+ startControlModifyListening( xControl );
+}
+
+//------------------------------------------------------------------------------
+void FormController::removeControl(const Reference< XControl > & xControl)
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+ const Reference< XControl >* pControls = m_aControls.getConstArray();
+ const Reference< XControl >* pControlsEnd = pControls + m_aControls.getLength();
+ while ( pControls != pControlsEnd )
+ {
+ if ( xControl.get() == (*pControls++).get() )
+ {
+ ::comphelper::removeElementAt( m_aControls, pControls - m_aControls.getConstArray() - 1 );
+ break;
+ }
+ }
+
+ FilterComponents::iterator componentPos = ::std::find( m_aFilterComponents.begin(), m_aFilterComponents.end(), xControl );
+ if ( componentPos != m_aFilterComponents.end() )
+ m_aFilterComponents.erase( componentPos );
+
+ implControlRemoved( xControl, m_bDetachEvents );
+
+ if ( isListeningForChanges() && m_bDetachEvents )
+ stopControlModifyListening( xControl );
+}
+
+// XLoadListener
+//------------------------------------------------------------------------------
+void FormController::loaded(const EventObject& rEvent) throw( RuntimeException )
+{
+ OSL_ENSURE( rEvent.Source == m_xModelAsIndex, "FormController::loaded: where did this come from?" );
+
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+ ::osl::MutexGuard aGuard( m_aMutex );
+ Reference< XRowSet > xForm(rEvent.Source, UNO_QUERY);
+ // do we have a connected data source
+ OStaticDataAccessTools aStaticTools;
+ if (xForm.is() && aStaticTools.getRowSetConnection(xForm).is())
+ {
+ Reference< XPropertySet > xSet(xForm, UNO_QUERY);
+ if (xSet.is())
+ {
+ Any aVal = xSet->getPropertyValue(FM_PROP_CYCLE);
+ sal_Int32 aVal2 = 0;
+ ::cppu::enum2int(aVal2,aVal);
+ m_bCycle = !aVal.hasValue() || aVal2 == TabulatorCycle_RECORDS;
+ m_bCanUpdate = aStaticTools.canUpdate(xSet);
+ m_bCanInsert = aStaticTools.canInsert(xSet);
+ m_bCurrentRecordModified = ::comphelper::getBOOL(xSet->getPropertyValue(FM_PROP_ISMODIFIED));
+ m_bCurrentRecordNew = ::comphelper::getBOOL(xSet->getPropertyValue(FM_PROP_ISNEW));
+
+ startFormListening( xSet, sal_False );
+
+ // set the locks for the current controls
+ if (getContainer().is())
+ {
+ m_aLoadEvent.Call();
+ }
+ }
+ else
+ {
+ m_bCanInsert = m_bCanUpdate = m_bCycle = sal_False;
+ m_bCurrentRecordModified = sal_False;
+ m_bCurrentRecordNew = sal_False;
+ m_bLocked = sal_False;
+ }
+ m_bDBConnection = sal_True;
+ }
+ else
+ {
+ m_bDBConnection = sal_False;
+ m_bCanInsert = m_bCanUpdate = m_bCycle = sal_False;
+ m_bCurrentRecordModified = sal_False;
+ m_bCurrentRecordNew = sal_False;
+ m_bLocked = sal_False;
+ }
+
+ Reference< XColumnsSupplier > xFormColumns( xForm, UNO_QUERY );
+ m_pColumnInfoCache.reset( xFormColumns.is() ? new ColumnInfoCache( xFormColumns ) : NULL );
+
+ updateAllDispatchers();
+}
+
+//------------------------------------------------------------------------------
+void FormController::updateAllDispatchers() const
+{
+ ::std::for_each(
+ m_aFeatureDispatchers.begin(),
+ m_aFeatureDispatchers.end(),
+ ::std::compose1(
+ UpdateAllListeners(),
+ ::std::select2nd< DispatcherContainer::value_type >()
+ )
+ );
+}
+
+//------------------------------------------------------------------------------
+IMPL_LINK(FormController, OnLoad, void*, EMPTYARG)
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+ m_bLocked = determineLockState();
+
+ setLocks();
+
+ if (!m_bLocked)
+ startListening();
+
+ // just one exception toggle the auto values
+ if (m_bCurrentRecordNew)
+ toggleAutoFields(sal_True);
+
+ return 1L;
+}
+
+//------------------------------------------------------------------------------
+void FormController::unloaded(const EventObject& /*rEvent*/) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ updateAllDispatchers();
+}
+
+//------------------------------------------------------------------------------
+void FormController::reloading(const EventObject& /*aEvent*/) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ // do the same like in unloading
+ // just one exception toggle the auto values
+ m_aToggleEvent.CancelPendingCall();
+ unload();
+}
+
+//------------------------------------------------------------------------------
+void FormController::reloaded(const EventObject& aEvent) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ loaded(aEvent);
+}
+
+//------------------------------------------------------------------------------
+void FormController::unloading(const EventObject& /*aEvent*/) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ unload();
+}
+
+//------------------------------------------------------------------------------
+void FormController::unload() throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ m_aLoadEvent.CancelPendingCall();
+
+ // be sure not to have autofields
+ if (m_bCurrentRecordNew)
+ toggleAutoFields(sal_False);
+
+ // remove bound field listing again
+ removeBoundFieldListener();
+
+ if (m_bDBConnection && isListeningForChanges())
+ stopListening();
+
+ Reference< XPropertySet > xSet( m_xModelAsIndex, UNO_QUERY );
+ if ( m_bDBConnection && xSet.is() )
+ stopFormListening( xSet, sal_False );
+
+ m_bDBConnection = sal_False;
+ m_bCanInsert = m_bCanUpdate = m_bCycle = sal_False;
+ m_bCurrentRecordModified = m_bCurrentRecordNew = m_bLocked = sal_False;
+
+ m_pColumnInfoCache.reset( NULL );
+}
+
+// -----------------------------------------------------------------------------
+void FormController::removeBoundFieldListener()
+{
+ const Reference< XControl >* pControls = m_aControls.getConstArray();
+ const Reference< XControl >* pControlsEnd = pControls + m_aControls.getLength();
+ while ( pControls != pControlsEnd )
+ {
+ Reference< XPropertySet > xProp( *pControls++, UNO_QUERY );
+ if ( xProp.is() )
+ xProp->removePropertyChangeListener( FM_PROP_BOUNDFIELD, this );
+ }
+}
+
+//------------------------------------------------------------------------------
+void FormController::startFormListening( const Reference< XPropertySet >& _rxForm, sal_Bool _bPropertiesOnly )
+{
+ try
+ {
+ if ( m_bCanInsert || m_bCanUpdate ) // form can be modified
+ {
+ _rxForm->addPropertyChangeListener( FM_PROP_ISNEW, this );
+ _rxForm->addPropertyChangeListener( FM_PROP_ISMODIFIED, this );
+
+ if ( !_bPropertiesOnly )
+ {
+ // set the Listener for UI interaction
+ Reference< XRowSetApproveBroadcaster > xApprove( _rxForm, UNO_QUERY );
+ if ( xApprove.is() )
+ xApprove->addRowSetApproveListener( this );
+
+ // listener for row set changes
+ Reference< XRowSet > xRowSet( _rxForm, UNO_QUERY );
+ if ( xRowSet.is() )
+ xRowSet->addRowSetListener( this );
+ }
+ }
+
+ Reference< XPropertySetInfo > xInfo = _rxForm->getPropertySetInfo();
+ if ( xInfo.is() && xInfo->hasPropertyByName( FM_PROP_DYNAMIC_CONTROL_BORDER ) )
+ _rxForm->addPropertyChangeListener( FM_PROP_DYNAMIC_CONTROL_BORDER, this );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//------------------------------------------------------------------------------
+void FormController::stopFormListening( const Reference< XPropertySet >& _rxForm, sal_Bool _bPropertiesOnly )
+{
+ try
+ {
+ if ( m_bCanInsert || m_bCanUpdate )
+ {
+ _rxForm->removePropertyChangeListener( FM_PROP_ISNEW, this );
+ _rxForm->removePropertyChangeListener( FM_PROP_ISMODIFIED, this );
+
+ if ( !_bPropertiesOnly )
+ {
+ Reference< XRowSetApproveBroadcaster > xApprove( _rxForm, UNO_QUERY );
+ if (xApprove.is())
+ xApprove->removeRowSetApproveListener(this);
+
+ Reference< XRowSet > xRowSet( _rxForm, UNO_QUERY );
+ if ( xRowSet.is() )
+ xRowSet->removeRowSetListener( this );
+ }
+ }
+
+ Reference< XPropertySetInfo > xInfo = _rxForm->getPropertySetInfo();
+ if ( xInfo.is() && xInfo->hasPropertyByName( FM_PROP_DYNAMIC_CONTROL_BORDER ) )
+ _rxForm->removePropertyChangeListener( FM_PROP_DYNAMIC_CONTROL_BORDER, this );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+// com::sun::star::sdbc::XRowSetListener
+//------------------------------------------------------------------------------
+void FormController::cursorMoved(const EventObject& /*event*/) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ // toggle the locking ?
+ if (m_bLocked != determineLockState())
+ {
+ m_bLocked = !m_bLocked;
+ setLocks();
+ if (isListeningForChanges())
+ startListening();
+ else
+ stopListening();
+ }
+
+ // neither the current control nor the current record are modified anymore
+ m_bCurrentRecordModified = m_bModified = sal_False;
+}
+
+//------------------------------------------------------------------------------
+void FormController::rowChanged(const EventObject& /*event*/) throw( RuntimeException )
+{
+ // not interested in ...
+}
+//------------------------------------------------------------------------------
+void FormController::rowSetChanged(const EventObject& /*event*/) throw( RuntimeException )
+{
+ // not interested in ...
+}
+
+
+// XContainerListener
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::elementInserted(const ContainerEvent& evt) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ Reference< XControl > xControl( evt.Element, UNO_QUERY );
+ if ( !xControl.is() )
+ return;
+
+ Reference< XFormComponent > xModel(xControl->getModel(), UNO_QUERY);
+ if (xModel.is() && m_xModelAsIndex == xModel->getParent())
+ {
+ insertControl(xControl);
+
+ if ( m_aTabActivationTimer.IsActive() )
+ m_aTabActivationTimer.Stop();
+
+ m_aTabActivationTimer.Start();
+ }
+ // are we in filtermode and a XModeSelector has inserted an element
+ else if (m_bFiltering && Reference< XModeSelector > (evt.Source, UNO_QUERY).is())
+ {
+ xModel = Reference< XFormComponent > (evt.Source, UNO_QUERY);
+ if (xModel.is() && m_xModelAsIndex == xModel->getParent())
+ {
+ Reference< XPropertySet > xSet(xControl->getModel(), UNO_QUERY);
+ if (xSet.is() && ::comphelper::hasProperty(FM_PROP_BOUNDFIELD, xSet))
+ {
+ // does the model use a bound field ?
+ Reference< XPropertySet > xField;
+ xSet->getPropertyValue(FM_PROP_BOUNDFIELD) >>= xField;
+
+ Reference< XTextComponent > xText(xControl, UNO_QUERY);
+ // may we filter the field?
+ if (xText.is() && xField.is() && ::comphelper::hasProperty(FM_PROP_SEARCHABLE, xField) &&
+ ::comphelper::getBOOL(xField->getPropertyValue(FM_PROP_SEARCHABLE)))
+ {
+ m_aFilterComponents.push_back( xText );
+ xText->addTextListener( this );
+ }
+ }
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::elementReplaced(const ContainerEvent& evt) throw( RuntimeException )
+{
+ // simulate an elementRemoved
+ ContainerEvent aRemoveEvent( evt );
+ aRemoveEvent.Element = evt.ReplacedElement;
+ aRemoveEvent.ReplacedElement = Any();
+ elementRemoved( aRemoveEvent );
+
+ // simulate an elementInserted
+ ContainerEvent aInsertEvent( evt );
+ aInsertEvent.ReplacedElement = Any();
+ elementInserted( aInsertEvent );
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::elementRemoved(const ContainerEvent& evt) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ Reference< XControl > xControl;
+ evt.Element >>= xControl;
+ if (!xControl.is())
+ return;
+
+ Reference< XFormComponent > xModel(xControl->getModel(), UNO_QUERY);
+ if (xModel.is() && m_xModelAsIndex == xModel->getParent())
+ {
+ removeControl(xControl);
+ // TabOrder nicht neu berechnen, da das intern schon funktionieren muß!
+ }
+ // are we in filtermode and a XModeSelector has inserted an element
+ else if (m_bFiltering && Reference< XModeSelector > (evt.Source, UNO_QUERY).is())
+ {
+ FilterComponents::iterator componentPos = ::std::find(
+ m_aFilterComponents.begin(), m_aFilterComponents.end(), xControl );
+ if ( componentPos != m_aFilterComponents.end() )
+ m_aFilterComponents.erase( componentPos );
+ }
+}
+
+//------------------------------------------------------------------------------
+Reference< XControl > FormController::isInList(const Reference< XWindowPeer > & xPeer) const
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+ const Reference< XControl >* pControls = m_aControls.getConstArray();
+
+ sal_uInt32 nCtrls = m_aControls.getLength();
+ for ( sal_uInt32 n = 0; n < nCtrls && xPeer.is(); ++n, ++pControls )
+ {
+ if ( pControls->is() )
+ {
+ Reference< XVclWindowPeer > xCtrlPeer( (*pControls)->getPeer(), UNO_QUERY);
+ if ( ( xCtrlPeer.get() == xPeer.get() ) || xCtrlPeer->isChild( xPeer ) )
+ return *pControls;
+ }
+ }
+ return Reference< XControl > ();
+}
+
+//------------------------------------------------------------------------------
+void FormController::activateFirst() throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ DBG_ASSERT(m_xTabController.is(), "FormController::activateFirst : invalid aggregate !");
+ if (m_xTabController.is())
+ m_xTabController->activateFirst();
+}
+
+//------------------------------------------------------------------------------
+void FormController::activateLast() throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ DBG_ASSERT(m_xTabController.is(), "FormController::activateLast : invalid aggregate !");
+ if (m_xTabController.is())
+ m_xTabController->activateLast();
+}
+
+// XFormController
+//------------------------------------------------------------------------------
+Reference< XFormOperations > SAL_CALL FormController::getFormOperations() throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ return m_xFormOperations;
+}
+
+//------------------------------------------------------------------------------
+Reference< XControl> SAL_CALL FormController::getCurrentControl(void) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+ return m_xCurrentControl;
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::addActivateListener(const Reference< XFormControllerListener > & l) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+ m_aActivateListeners.addInterface(l);
+}
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::removeActivateListener(const Reference< XFormControllerListener > & l) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+ m_aActivateListeners.removeInterface(l);
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::addChildController( const Reference< XFormController >& _ChildController ) throw( RuntimeException, IllegalArgumentException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ if ( !_ChildController.is() )
+ throw IllegalArgumentException( ::rtl::OUString(), *this, 1 );
+ // TODO: (localized) error message
+
+ // the parent of our (to-be-)child must be our own model
+ Reference< XFormComponent > xFormOfChild( _ChildController->getModel(), UNO_QUERY );
+ if ( !xFormOfChild.is() )
+ throw IllegalArgumentException( ::rtl::OUString(), *this, 1 );
+ // TODO: (localized) error message
+
+ if ( xFormOfChild->getParent() != m_xModelAsIndex )
+ throw IllegalArgumentException( ::rtl::OUString(), *this, 1 );
+ // TODO: (localized) error message
+
+ m_aChilds.push_back( _ChildController );
+ _ChildController->setParent( *this );
+
+ // search the position of the model within the form
+ sal_uInt32 nPos = m_xModelAsIndex->getCount();
+ Reference< XFormComponent > xTemp;
+ for( ; nPos; )
+ {
+ m_xModelAsIndex->getByIndex(--nPos) >>= xTemp;
+ if ( xFormOfChild == xTemp )
+ {
+ Reference< XInterface > xIfc( _ChildController, UNO_QUERY );
+ m_xModelAsManager->attach( nPos, xIfc, makeAny( _ChildController) );
+ break;
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+Reference< XFormControllerContext > SAL_CALL FormController::getContext() throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+ return m_xContext;
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::setContext( const Reference< XFormControllerContext >& _context ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+ m_xContext = _context;
+}
+
+//------------------------------------------------------------------------------
+Reference< XInteractionHandler > SAL_CALL FormController::getInteractionHandler() throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+ return m_xInteractionHandler;
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::setInteractionHandler( const Reference< XInteractionHandler >& _interactionHandler ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+ m_xInteractionHandler = _interactionHandler;
+}
+
+//------------------------------------------------------------------------------
+void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos)
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+ // create the composer
+ Reference< XRowSet > xForm(m_xModelAsIndex, UNO_QUERY);
+ Reference< XConnection > xConnection(OStaticDataAccessTools().getRowSetConnection(xForm));
+ if (xForm.is())
+ {
+ try
+ {
+ Reference< XMultiServiceFactory > xFactory( xConnection, UNO_QUERY_THROW );
+ m_xComposer.set(
+ xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.SingleSelectQueryComposer" ) ) ),
+ UNO_QUERY_THROW );
+
+ Reference< XPropertySet > xSet( xForm, UNO_QUERY );
+ ::rtl::OUString sStatement = ::comphelper::getString( xSet->getPropertyValue( FM_PROP_ACTIVECOMMAND ) );
+ ::rtl::OUString sFilter = ::comphelper::getString( xSet->getPropertyValue( FM_PROP_FILTER ) );
+ m_xComposer->setElementaryQuery( sStatement );
+ m_xComposer->setFilter( sFilter );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ if (m_xComposer.is())
+ {
+ Sequence < PropertyValue> aLevel;
+ Sequence< Sequence < PropertyValue > > aFilterRows = m_xComposer->getStructuredFilter();
+
+ // ok, we recieve the list of filters as sequence of fieldnames, value
+ // now we have to transform the fieldname into UI names, that could be a label of the field or
+ // a aliasname or the fieldname itself
+
+ // first adjust the field names if necessary
+ Reference< XNameAccess > xQueryColumns =
+ Reference< XColumnsSupplier >( m_xComposer, UNO_QUERY_THROW )->getColumns();
+
+ for (::std::vector<FmFieldInfo>::iterator iter = rFieldInfos.begin();
+ iter != rFieldInfos.end(); iter++)
+ {
+ if ( xQueryColumns->hasByName((*iter).aFieldName) )
+ {
+ if ( (xQueryColumns->getByName((*iter).aFieldName) >>= (*iter).xField) && (*iter).xField.is() )
+ (*iter).xField->getPropertyValue(FM_PROP_REALNAME) >>= (*iter).aFieldName;
+ }
+ }
+
+ Reference< XDatabaseMetaData> xMetaData(xConnection->getMetaData());
+ // now transfer the filters into Value/TextComponent pairs
+ ::comphelper::UStringMixEqual aCompare(xMetaData->storesMixedCaseQuotedIdentifiers());
+
+ // need to parse criteria localized
+ OStaticDataAccessTools aStaticTools;
+ Reference< XNumberFormatsSupplier> xFormatSupplier( aStaticTools.getNumberFormats(xConnection, sal_True));
+ Reference< XNumberFormatter> xFormatter( m_aContext.createComponent( "com.sun.star.util.NumberFormatter" ), UNO_QUERY );
+ xFormatter->attachNumberFormatsSupplier(xFormatSupplier);
+ Locale aAppLocale = Application::GetSettings().GetUILocale();
+ LocaleDataWrapper aLocaleWrapper( m_aContext.getLegacyServiceFactory(), aAppLocale );
+
+ // retrieving the filter
+ const Sequence < PropertyValue >* pRow = aFilterRows.getConstArray();
+ for (sal_Int32 i = 0, nLen = aFilterRows.getLength(); i < nLen; ++i)
+ {
+ FmFilterRow aRow;
+
+ // search a field for the given name
+ const PropertyValue* pRefValues = pRow[i].getConstArray();
+ for (sal_Int32 j = 0, nLen1 = pRow[i].getLength(); j < nLen1; j++)
+ {
+ // look for the text component
+ Reference< XPropertySet > xField;
+ try
+ {
+ Reference< XPropertySet > xSet;
+ ::rtl::OUString aRealName;
+
+ // first look with the given name
+ if (xQueryColumns->hasByName(pRefValues[j].Name))
+ {
+ xQueryColumns->getByName(pRefValues[j].Name) >>= xSet;
+
+ // get the RealName
+ xSet->getPropertyValue(::rtl::OUString::createFromAscii("RealName")) >>= aRealName;
+
+ // compare the condition field name and the RealName
+ if (aCompare(aRealName, pRefValues[j].Name))
+ xField = xSet;
+ }
+ if (!xField.is())
+ {
+ // no we have to check every column to find the realname
+ Reference< XIndexAccess > xColumnsByIndex(xQueryColumns, UNO_QUERY);
+ for (sal_Int32 n = 0, nCount = xColumnsByIndex->getCount(); n < nCount; n++)
+ {
+ xColumnsByIndex->getByIndex(n) >>= xSet;
+ xSet->getPropertyValue(::rtl::OUString::createFromAscii("RealName")) >>= aRealName;
+ if (aCompare(aRealName, pRefValues[j].Name))
+ {
+ // get the column by its alias
+ xField = xSet;
+ break;
+ }
+ }
+ }
+ if (!xField.is())
+ continue;
+ }
+ catch (const Exception&)
+ {
+ continue;
+ }
+
+ // find the text component
+ for (::std::vector<FmFieldInfo>::iterator iter = rFieldInfos.begin();
+ iter != rFieldInfos.end(); iter++)
+ {
+ // we found the field so insert a new entry to the filter row
+ if ((*iter).xField == xField)
+ {
+ // do we already have the control ?
+ if (aRow.find((*iter).xText) != aRow.end())
+ {
+ ::rtl::OUString aCompText = aRow[(*iter).xText];
+ aCompText += ::rtl::OUString::createFromAscii(" ");
+ ::rtl::OString aVal = m_xParser->getContext().getIntlKeywordAscii(OParseContext::KEY_AND);
+ aCompText += ::rtl::OUString(aVal.getStr(),aVal.getLength(),RTL_TEXTENCODING_ASCII_US);
+ aCompText += ::rtl::OUString::createFromAscii(" ");
+ aCompText += ::comphelper::getString(pRefValues[j].Value);
+ aRow[(*iter).xText] = aCompText;
+ }
+ else
+ {
+ ::rtl::OUString sPredicate,sErrorMsg;
+ pRefValues[j].Value >>= sPredicate;
+ ::rtl::Reference< ISQLParseNode > xParseNode = predicateTree(sErrorMsg, sPredicate, xFormatter, xField);
+ if ( xParseNode.is() )
+ {
+ ::rtl::OUString sCriteria;
+ xParseNode->parseNodeToPredicateStr( sCriteria
+ ,xConnection
+ ,xFormatter
+ ,xField
+ ,aAppLocale
+ ,(sal_Char)aLocaleWrapper.getNumDecimalSep().GetChar(0)
+ ,getParseContext());
+ aRow[(*iter).xText] = sCriteria;
+ }
+ }
+ }
+ }
+ }
+
+ if (aRow.empty())
+ continue;
+
+ impl_addFilterRow( aRow );
+ }
+ }
+
+ // now set the filter controls
+ for ( ::std::vector<FmFieldInfo>::iterator field = rFieldInfos.begin();
+ field != rFieldInfos.end();
+ ++field
+ )
+ {
+ m_aFilterComponents.push_back( field->xText );
+ }
+}
+
+//------------------------------------------------------------------------------
+void FormController::startFiltering()
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+
+ OStaticDataAccessTools aStaticTools;
+ Reference< XConnection > xConnection( aStaticTools.getRowSetConnection( Reference< XRowSet >( m_xModelAsIndex, UNO_QUERY ) ) );
+ if ( !xConnection.is() )
+ // nothing to do - can't filter a form which is not connected
+ // 98023 - 19.03.2002 - fs@openoffice.org
+ return;
+
+ // stop listening for controls
+ if (isListeningForChanges())
+ stopListening();
+
+ m_bFiltering = sal_True;
+
+ // as we don't want new controls to be attached to the scripting environment
+ // we change attach flags
+ m_bAttachEvents = sal_False;
+
+ // Austauschen der Kontrols fuer das aktuelle Formular
+ Sequence< Reference< XControl > > aControlsCopy( m_aControls );
+ const Reference< XControl >* pControls = aControlsCopy.getConstArray();
+ sal_Int32 nControlCount = aControlsCopy.getLength();
+
+ // the control we have to activate after replacement
+ Reference< XDatabaseMetaData > xMetaData(xConnection->getMetaData());
+ Reference< XNumberFormatsSupplier > xFormatSupplier = aStaticTools.getNumberFormats(xConnection, sal_True);
+ Reference< XNumberFormatter > xFormatter( m_aContext.createComponent( "com.sun.star.util.NumberFormatter" ), UNO_QUERY );
+ xFormatter->attachNumberFormatsSupplier(xFormatSupplier);
+
+ // structure for storing the field info
+ ::std::vector<FmFieldInfo> aFieldInfos;
+
+ for (sal_Int32 i = nControlCount; i > 0;)
+ {
+ Reference< XControl > xControl = pControls[--i];
+ if (xControl.is())
+ {
+ // no events for the control anymore
+ removeFromEventAttacher(xControl);
+
+ // do we have a mode selector
+ Reference< XModeSelector > xSelector(xControl, UNO_QUERY);
+ if (xSelector.is())
+ {
+ xSelector->setMode( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterMode" ) ) );
+
+ // listening for new controls of the selector
+ Reference< XContainer > xContainer(xSelector, UNO_QUERY);
+ if (xContainer.is())
+ xContainer->addContainerListener(this);
+
+ Reference< XEnumerationAccess > xElementAccess(xSelector, UNO_QUERY);
+ if (xElementAccess.is())
+ {
+ Reference< XEnumeration > xEnumeration(xElementAccess->createEnumeration());
+ Reference< XControl > xSubControl;
+ while (xEnumeration->hasMoreElements())
+ {
+ xEnumeration->nextElement() >>= xSubControl;
+ if (xSubControl.is())
+ {
+ Reference< XPropertySet > xSet(xSubControl->getModel(), UNO_QUERY);
+ if (xSet.is() && ::comphelper::hasProperty(FM_PROP_BOUNDFIELD, xSet))
+ {
+ // does the model use a bound field ?
+ Reference< XPropertySet > xField;
+ xSet->getPropertyValue(FM_PROP_BOUNDFIELD) >>= xField;
+
+ Reference< XTextComponent > xText(xSubControl, UNO_QUERY);
+ // may we filter the field?
+ if (xText.is() && xField.is() && ::comphelper::hasProperty(FM_PROP_SEARCHABLE, xField) &&
+ ::comphelper::getBOOL(xField->getPropertyValue(FM_PROP_SEARCHABLE)))
+ {
+ aFieldInfos.push_back(FmFieldInfo(xField, xText));
+ xText->addTextListener(this);
+ }
+ }
+ }
+ }
+ }
+ continue;
+ }
+
+ Reference< XPropertySet > xModel( xControl->getModel(), UNO_QUERY );
+ if (xModel.is() && ::comphelper::hasProperty(FM_PROP_BOUNDFIELD, xModel))
+ {
+ // does the model use a bound field ?
+ Any aVal = xModel->getPropertyValue(FM_PROP_BOUNDFIELD);
+ Reference< XPropertySet > xField;
+ aVal >>= xField;
+
+ // may we filter the field?
+
+ if ( xField.is()
+ && ::comphelper::hasProperty( FM_PROP_SEARCHABLE, xField )
+ && ::comphelper::getBOOL( xField->getPropertyValue( FM_PROP_SEARCHABLE ) )
+ )
+ {
+ // create a filter control
+ Sequence< Any > aCreationArgs( 3 );
+ aCreationArgs[ 0 ] <<= NamedValue( ::rtl::OUString::createFromAscii( "MessageParent" ), makeAny( VCLUnoHelper::GetInterface( getDialogParentWindow() ) ) );
+ aCreationArgs[ 1 ] <<= NamedValue( ::rtl::OUString::createFromAscii( "NumberFormatter" ), makeAny( xFormatter ) );
+ aCreationArgs[ 2 ] <<= NamedValue( ::rtl::OUString::createFromAscii( "ControlModel" ), makeAny( xModel ) );
+ Reference< XControl > xFilterControl(
+ m_aContext.createComponentWithArguments( "com.sun.star.form.control.FilterControl", aCreationArgs ),
+ UNO_QUERY
+ );
+ DBG_ASSERT( xFilterControl.is(), "FormController::startFiltering: could not create a filter control!" );
+
+ if ( replaceControl( xControl, xFilterControl ) )
+ {
+ Reference< XTextComponent > xFilterText( xFilterControl, UNO_QUERY );
+ aFieldInfos.push_back( FmFieldInfo( xField, xFilterText ) );
+ xFilterText->addTextListener(this);
+ }
+ }
+ }
+ else
+ {
+ // abmelden vom EventManager
+ }
+ }
+ }
+
+ // we have all filter controls now, so the next step is to read the filters from the form
+ // resolve all aliases and set the current filter to the according structure
+ setFilter(aFieldInfos);
+
+ Reference< XPropertySet > xSet( m_xModelAsIndex, UNO_QUERY );
+ if ( xSet.is() )
+ stopFormListening( xSet, sal_True );
+
+ impl_setTextOnAllFilter_throw();
+
+ // lock all controls which are not used for filtering
+ m_bLocked = determineLockState();
+ setLocks();
+ m_bAttachEvents = sal_True;
+}
+
+//------------------------------------------------------------------------------
+void FormController::stopFiltering()
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+ if ( !m_bFiltering ) // #104693# OJ
+ { // nothing to do
+ return;
+ }
+
+ m_bFiltering = sal_False;
+ m_bDetachEvents = sal_False;
+
+ ::comphelper::disposeComponent(m_xComposer);
+
+ // Austauschen der Kontrols fuer das aktuelle Formular
+ Sequence< Reference< XControl > > aControlsCopy( m_aControls );
+ const Reference< XControl > * pControls = aControlsCopy.getConstArray();
+ sal_Int32 nControlCount = aControlsCopy.getLength();
+
+ // clear the filter control map
+ ::std::for_each( m_aFilterComponents.begin(), m_aFilterComponents.end(), RemoveComponentTextListener( this ) );
+ m_aFilterComponents.clear();
+
+ for ( sal_Int32 i = nControlCount; i > 0; )
+ {
+ Reference< XControl > xControl = pControls[--i];
+ if (xControl.is())
+ {
+ // now enable eventhandling again
+ addToEventAttacher(xControl);
+
+ Reference< XModeSelector > xSelector(xControl, UNO_QUERY);
+ if (xSelector.is())
+ {
+ xSelector->setMode( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DataMode" ) ) );
+
+ // listening for new controls of the selector
+ Reference< XContainer > xContainer(xSelector, UNO_QUERY);
+ if (xContainer.is())
+ xContainer->removeContainerListener(this);
+ continue;
+ }
+
+ Reference< XPropertySet > xSet(xControl->getModel(), UNO_QUERY);
+ if (xSet.is() && ::comphelper::hasProperty(FM_PROP_BOUNDFIELD, xSet))
+ {
+ // does the model use a bound field ?
+ Reference< XPropertySet > xField;
+ xSet->getPropertyValue(FM_PROP_BOUNDFIELD) >>= xField;
+
+ // may we filter the field?
+ if ( xField.is()
+ && ::comphelper::hasProperty( FM_PROP_SEARCHABLE, xField )
+ && ::comphelper::getBOOL( xField->getPropertyValue( FM_PROP_SEARCHABLE ) )
+ )
+ {
+ ::rtl::OUString sServiceName;
+ OSL_VERIFY( xSet->getPropertyValue( FM_PROP_DEFAULTCONTROL ) >>= sServiceName );
+ Reference< XControl > xNewControl( m_aContext.createComponent( sServiceName ), UNO_QUERY );
+ replaceControl( xControl, xNewControl );
+ }
+ }
+ }
+ }
+
+ Reference< XPropertySet > xSet( m_xModelAsIndex, UNO_QUERY );
+ if ( xSet.is() )
+ startFormListening( xSet, sal_True );
+
+ m_bDetachEvents = sal_True;
+
+ m_aFilterRows.clear();
+ m_nCurrentFilterPosition = -1;
+
+ // release the locks if possible
+ // lock all controls which are not used for filtering
+ m_bLocked = determineLockState();
+ setLocks();
+
+ // restart listening for control modifications
+ if (isListeningForChanges())
+ startListening();
+}
+
+// XModeSelector
+//------------------------------------------------------------------------------
+void FormController::setMode(const ::rtl::OUString& Mode) throw( NoSupportException, RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ if (!supportsMode(Mode))
+ throw NoSupportException();
+
+ if (Mode == m_aMode)
+ return;
+
+ m_aMode = Mode;
+
+ if ( Mode.equalsAscii( "FilterMode" ) )
+ startFiltering();
+ else
+ stopFiltering();
+
+ for (FmFormControllers::const_iterator i = m_aChilds.begin();
+ i != m_aChilds.end(); ++i)
+ {
+ Reference< XModeSelector > xMode(*i, UNO_QUERY);
+ if ( xMode.is() )
+ xMode->setMode(Mode);
+ }
+}
+
+//------------------------------------------------------------------------------
+::rtl::OUString SAL_CALL FormController::getMode(void) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ return m_aMode;
+}
+
+//------------------------------------------------------------------------------
+Sequence< ::rtl::OUString > SAL_CALL FormController::getSupportedModes(void) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ static Sequence< ::rtl::OUString > aModes;
+ if (!aModes.getLength())
+ {
+ aModes.realloc(2);
+ ::rtl::OUString* pModes = aModes.getArray();
+ pModes[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DataMode" ) );
+ pModes[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterMode" ) );
+ }
+ return aModes;
+}
+
+//------------------------------------------------------------------------------
+sal_Bool SAL_CALL FormController::supportsMode(const ::rtl::OUString& Mode) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ Sequence< ::rtl::OUString > aModes(getSupportedModes());
+ const ::rtl::OUString* pModes = aModes.getConstArray();
+ for (sal_Int32 i = aModes.getLength(); i > 0; )
+ {
+ if (pModes[--i] == Mode)
+ return sal_True;
+ }
+ return sal_False;
+}
+
+//------------------------------------------------------------------------------
+Window* FormController::getDialogParentWindow()
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+ Window* pParentWindow = NULL;
+ try
+ {
+ Reference< XControl > xContainerControl( getContainer(), UNO_QUERY_THROW );
+ Reference< XWindowPeer > xContainerPeer( xContainerControl->getPeer(), UNO_QUERY_THROW );
+ pParentWindow = VCLUnoHelper::GetWindow( xContainerPeer );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return pParentWindow;
+}
+//------------------------------------------------------------------------------
+bool FormController::checkFormComponentValidity( ::rtl::OUString& /* [out] */ _rFirstInvalidityExplanation, Reference< XControlModel >& /* [out] */ _rxFirstInvalidModel ) SAL_THROW(())
+{
+ try
+ {
+ Reference< XEnumerationAccess > xControlEnumAcc( getModel(), UNO_QUERY );
+ Reference< XEnumeration > xControlEnumeration;
+ if ( xControlEnumAcc.is() )
+ xControlEnumeration = xControlEnumAcc->createEnumeration();
+ OSL_ENSURE( xControlEnumeration.is(), "FormController::checkFormComponentValidity: cannot enumerate the controls!" );
+ if ( !xControlEnumeration.is() )
+ // assume all valid
+ return true;
+
+ Reference< XValidatableFormComponent > xValidatable;
+ while ( xControlEnumeration->hasMoreElements() )
+ {
+ if ( !( xControlEnumeration->nextElement() >>= xValidatable ) )
+ // control does not support validation
+ continue;
+
+ if ( xValidatable->isValid() )
+ continue;
+
+ Reference< XValidator > xValidator( xValidatable->getValidator() );
+ OSL_ENSURE( xValidator.is(), "FormController::checkFormComponentValidity: invalid, but no validator?" );
+ if ( !xValidator.is() )
+ // this violates the interface definition of css.form.validation.XValidatableFormComponent ...
+ continue;
+
+ _rFirstInvalidityExplanation = xValidator->explainInvalid( xValidatable->getCurrentValue() );
+ _rxFirstInvalidModel = _rxFirstInvalidModel.query( xValidatable );
+ return false;
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return true;
+}
+
+//------------------------------------------------------------------------------
+Reference< XControl > FormController::locateControl( const Reference< XControlModel >& _rxModel ) SAL_THROW(())
+{
+ try
+ {
+ Sequence< Reference< XControl > > aControls( getControls() );
+ const Reference< XControl >* pControls = aControls.getConstArray();
+ const Reference< XControl >* pControlsEnd = aControls.getConstArray() + aControls.getLength();
+
+ for ( ; pControls != pControlsEnd; ++pControls )
+ {
+ OSL_ENSURE( pControls->is(), "FormController::locateControl: NULL-control?" );
+ if ( pControls->is() )
+ {
+ if ( ( *pControls)->getModel() == _rxModel )
+ return *pControls;
+ }
+ }
+ OSL_ENSURE( sal_False, "FormController::locateControl: did not find a control for this model!" );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return NULL;
+}
+
+//------------------------------------------------------------------------------
+namespace
+{
+ void displayErrorSetFocus( const String& _rMessage, const Reference< XControl >& _rxFocusControl, Window* _pDialogParent )
+ {
+ SQLContext aError;
+ aError.Message = String( SVX_RES( RID_STR_WRITEERROR ) );
+ aError.Details = _rMessage;
+ displayException( aError, _pDialogParent );
+
+ if ( _rxFocusControl.is() )
+ {
+ Reference< XWindow > xControlWindow( _rxFocusControl, UNO_QUERY );
+ OSL_ENSURE( xControlWindow.is(), "displayErrorSetFocus: invalid control!" );
+ if ( xControlWindow.is() )
+ xControlWindow->setFocus();
+ }
+ }
+
+ sal_Bool lcl_shouldValidateRequiredFields_nothrow( const Reference< XInterface >& _rxForm )
+ {
+ try
+ {
+ static ::rtl::OUString s_sFormsCheckRequiredFields( RTL_CONSTASCII_USTRINGPARAM( "FormsCheckRequiredFields" ) );
+
+ // first, check whether the form has a property telling us the answer
+ // this allows people to use the XPropertyContainer interface of a form to control
+ // the behaviour on a per-form basis.
+ Reference< XPropertySet > xFormProps( _rxForm, UNO_QUERY_THROW );
+ Reference< XPropertySetInfo > xPSI( xFormProps->getPropertySetInfo() );
+ if ( xPSI->hasPropertyByName( s_sFormsCheckRequiredFields ) )
+ {
+ sal_Bool bShouldValidate = true;
+ OSL_VERIFY( xFormProps->getPropertyValue( s_sFormsCheckRequiredFields ) >>= bShouldValidate );
+ return bShouldValidate;
+ }
+
+ // next, check the data source which created the connection
+ Reference< XChild > xConnectionAsChild( xFormProps->getPropertyValue( FM_PROP_ACTIVE_CONNECTION ), UNO_QUERY_THROW );
+ Reference< XPropertySet > xDataSource( xConnectionAsChild->getParent(), UNO_QUERY );
+ if ( !xDataSource.is() )
+ // seldom (but possible): this is not a connection created by a data source
+ return sal_True;
+
+ Reference< XPropertySet > xDataSourceSettings(
+ xDataSource->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Settings" ) ) ),
+ UNO_QUERY_THROW );
+
+ sal_Bool bShouldValidate = true;
+ OSL_VERIFY( xDataSourceSettings->getPropertyValue( s_sFormsCheckRequiredFields ) >>= bShouldValidate );
+ return bShouldValidate;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return sal_True;
+ }
+}
+
+// XRowSetApproveListener
+//------------------------------------------------------------------------------
+sal_Bool SAL_CALL FormController::approveRowChange(const RowChangeEvent& _rEvent) throw( RuntimeException )
+{
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ ::cppu::OInterfaceIteratorHelper aIter(m_aRowSetApproveListeners);
+ sal_Bool bValid = sal_True;
+ if (aIter.hasMoreElements())
+ {
+ RowChangeEvent aEvt( _rEvent );
+ aEvt.Source = *this;
+ bValid = ((XRowSetApproveListener*)aIter.next())->approveRowChange(aEvt);
+ }
+
+ if ( !bValid )
+ return bValid;
+
+ if ( ( _rEvent.Action != RowChangeAction::INSERT )
+ && ( _rEvent.Action != RowChangeAction::UPDATE )
+ )
+ return bValid;
+
+ // if some of the control models are bound to validators, check them
+ ::rtl::OUString sInvalidityExplanation;
+ Reference< XControlModel > xInvalidModel;
+ if ( !checkFormComponentValidity( sInvalidityExplanation, xInvalidModel ) )
+ {
+ Reference< XControl > xControl( locateControl( xInvalidModel ) );
+ aGuard.clear();
+ displayErrorSetFocus( sInvalidityExplanation, xControl, getDialogParentWindow() );
+ return false;
+ }
+
+ // check values on NULL and required flag
+ if ( !lcl_shouldValidateRequiredFields_nothrow( _rEvent.Source ) )
+ return sal_True;
+
+ OSL_ENSURE( m_pColumnInfoCache.get(), "FormController::approveRowChange: no column infos!" );
+ if ( !m_pColumnInfoCache.get() )
+ return sal_True;
+
+ try
+ {
+ if ( !m_pColumnInfoCache->controlsInitialized() )
+ m_pColumnInfoCache->initializeControls( getControls() );
+
+ size_t colCount = m_pColumnInfoCache->getColumnCount();
+ for ( size_t col = 0; col < colCount; ++col )
+ {
+ const ColumnInfo& rColInfo = m_pColumnInfoCache->getColumnInfo( col );
+ if ( rColInfo.nNullable != ColumnValue::NO_NULLS )
+ continue;
+
+ if ( rColInfo.bAutoIncrement )
+ continue;
+
+ if ( rColInfo.bReadOnly )
+ continue;
+
+ if ( !rColInfo.xFirstControlWithInputRequired.is() && !rColInfo.xFirstGridWithInputRequiredColumn.is() )
+ continue;
+
+ // TODO: in case of binary fields, this "getString" below is extremely expensive
+ if ( rColInfo.xColumn->getString().getLength() || !rColInfo.xColumn->wasNull() )
+ continue;
+
+ String sMessage( SVX_RES( RID_ERR_FIELDREQUIRED ) );
+ sMessage.SearchAndReplace( '#', rColInfo.sName );
+
+ // the control to focus
+ Reference< XControl > xControl( rColInfo.xFirstControlWithInputRequired );
+ if ( !xControl.is() )
+ xControl.set( rColInfo.xFirstGridWithInputRequiredColumn, UNO_QUERY );
+
+ aGuard.clear();
+ displayErrorSetFocus( sMessage, rColInfo.xFirstControlWithInputRequired, getDialogParentWindow() );
+ return sal_False;
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return true;
+}
+
+//------------------------------------------------------------------------------
+sal_Bool SAL_CALL FormController::approveCursorMove(const EventObject& event) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ ::cppu::OInterfaceIteratorHelper aIter(m_aRowSetApproveListeners);
+ if (aIter.hasMoreElements())
+ {
+ EventObject aEvt(event);
+ aEvt.Source = *this;
+ return ((XRowSetApproveListener*)aIter.next())->approveCursorMove(aEvt);
+ }
+
+ return sal_True;
+}
+
+//------------------------------------------------------------------------------
+sal_Bool SAL_CALL FormController::approveRowSetChange(const EventObject& event) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ ::cppu::OInterfaceIteratorHelper aIter(m_aRowSetApproveListeners);
+ if (aIter.hasMoreElements())
+ {
+ EventObject aEvt(event);
+ aEvt.Source = *this;
+ return ((XRowSetApproveListener*)aIter.next())->approveRowSetChange(aEvt);
+ }
+
+ return sal_True;
+}
+
+// XRowSetApproveBroadcaster
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::addRowSetApproveListener(const Reference< XRowSetApproveListener > & _rxListener) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ m_aRowSetApproveListeners.addInterface(_rxListener);
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::removeRowSetApproveListener(const Reference< XRowSetApproveListener > & _rxListener) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ m_aRowSetApproveListeners.removeInterface(_rxListener);
+}
+
+// XErrorListener
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::errorOccured(const SQLErrorEvent& aEvent) throw( RuntimeException )
+{
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ ::cppu::OInterfaceIteratorHelper aIter(m_aErrorListeners);
+ if (aIter.hasMoreElements())
+ {
+ SQLErrorEvent aEvt(aEvent);
+ aEvt.Source = *this;
+ ((XSQLErrorListener*)aIter.next())->errorOccured(aEvt);
+ }
+ else
+ {
+ aGuard.clear();
+ displayException( aEvent );
+ }
+}
+
+// XErrorBroadcaster
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::addSQLErrorListener(const Reference< XSQLErrorListener > & aListener) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ m_aErrorListeners.addInterface(aListener);
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::removeSQLErrorListener(const Reference< XSQLErrorListener > & aListener) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ m_aErrorListeners.removeInterface(aListener);
+}
+
+// XDatabaseParameterBroadcaster2
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::addDatabaseParameterListener(const Reference< XDatabaseParameterListener > & aListener) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ m_aParameterListeners.addInterface(aListener);
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::removeDatabaseParameterListener(const Reference< XDatabaseParameterListener > & aListener) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ m_aParameterListeners.removeInterface(aListener);
+}
+
+// XDatabaseParameterBroadcaster
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::addParameterListener(const Reference< XDatabaseParameterListener > & aListener) throw( RuntimeException )
+{
+ FormController::addDatabaseParameterListener( aListener );
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::removeParameterListener(const Reference< XDatabaseParameterListener > & aListener) throw( RuntimeException )
+{
+ FormController::removeDatabaseParameterListener( aListener );
+}
+
+// XDatabaseParameterListener
+//------------------------------------------------------------------------------
+sal_Bool SAL_CALL FormController::approveParameter(const DatabaseParameterEvent& aEvent) throw( RuntimeException )
+{
+ ::vos::OGuard aSolarGuard(Application::GetSolarMutex());
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ ::cppu::OInterfaceIteratorHelper aIter(m_aParameterListeners);
+ if (aIter.hasMoreElements())
+ {
+ DatabaseParameterEvent aEvt(aEvent);
+ aEvt.Source = *this;
+ return ((XDatabaseParameterListener*)aIter.next())->approveParameter(aEvt);
+ }
+ else
+ {
+ // default handling: instantiate an interaction handler and let it handle the parameter request
+ try
+ {
+ if ( !ensureInteractionHandler() )
+ return sal_False;
+
+ // two continuations allowed: OK and Cancel
+ OParameterContinuation* pParamValues = new OParameterContinuation;
+ OInteractionAbort* pAbort = new OInteractionAbort;
+ // the request
+ ParametersRequest aRequest;
+ aRequest.Parameters = aEvent.Parameters;
+ aRequest.Connection = OStaticDataAccessTools().getRowSetConnection(Reference< XRowSet >(aEvent.Source, UNO_QUERY));
+ OInteractionRequest* pParamRequest = new OInteractionRequest(makeAny(aRequest));
+ Reference< XInteractionRequest > xParamRequest(pParamRequest);
+ // some knittings
+ pParamRequest->addContinuation(pParamValues);
+ pParamRequest->addContinuation(pAbort);
+
+ // handle the request
+ m_xInteractionHandler->handle(xParamRequest);
+
+ if (!pParamValues->wasSelected())
+ // canceled
+ return sal_False;
+
+ // transfer the values into the parameter supplier
+ Sequence< PropertyValue > aFinalValues = pParamValues->getValues();
+ if (aFinalValues.getLength() != aRequest.Parameters->getCount())
+ {
+ DBG_ERROR("FormController::approveParameter: the InteractionHandler returned nonsense!");
+ return sal_False;
+ }
+ const PropertyValue* pFinalValues = aFinalValues.getConstArray();
+ for (sal_Int32 i=0; i<aFinalValues.getLength(); ++i, ++pFinalValues)
+ {
+ Reference< XPropertySet > xParam;
+ ::cppu::extractInterface(xParam, aRequest.Parameters->getByIndex(i));
+ if (xParam.is())
+ {
+#ifdef DBG_UTIL
+ ::rtl::OUString sName;
+ xParam->getPropertyValue(FM_PROP_NAME) >>= sName;
+ DBG_ASSERT(sName.equals(pFinalValues->Name), "FormController::approveParameter: suspicious value names!");
+#endif
+ try { xParam->setPropertyValue(FM_PROP_VALUE, pFinalValues->Value); }
+ catch(Exception&)
+ {
+ DBG_ERROR("FormController::approveParameter: setting one of the properties failed!");
+ }
+ }
+ }
+ }
+ catch(Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ return sal_True;
+}
+
+// XConfirmDeleteBroadcaster
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::addConfirmDeleteListener(const Reference< XConfirmDeleteListener > & aListener) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ m_aDeleteListeners.addInterface(aListener);
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::removeConfirmDeleteListener(const Reference< XConfirmDeleteListener > & aListener) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ m_aDeleteListeners.removeInterface(aListener);
+}
+
+// XConfirmDeleteListener
+//------------------------------------------------------------------------------
+sal_Bool SAL_CALL FormController::confirmDelete(const RowChangeEvent& aEvent) throw( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_checkDisposed_throw();
+
+ ::cppu::OInterfaceIteratorHelper aIter(m_aDeleteListeners);
+ if (aIter.hasMoreElements())
+ {
+ RowChangeEvent aEvt(aEvent);
+ aEvt.Source = *this;
+ return ((XConfirmDeleteListener*)aIter.next())->confirmDelete(aEvt);
+ }
+ // default handling: instantiate an interaction handler and let it handle the request
+
+ String sTitle;
+ sal_Int32 nLength = aEvent.Rows;
+ if ( nLength > 1 )
+ {
+ sTitle = SVX_RES( RID_STR_DELETECONFIRM_RECORDS );
+ sTitle.SearchAndReplace( '#', String::CreateFromInt32( nLength ) );
+ }
+ else
+ sTitle = SVX_RES( RID_STR_DELETECONFIRM_RECORD );
+
+ try
+ {
+ if ( !ensureInteractionHandler() )
+ return sal_False;
+
+ // two continuations allowed: Yes and No
+ OInteractionApprove* pApprove = new OInteractionApprove;
+ OInteractionDisapprove* pDisapprove = new OInteractionDisapprove;
+
+ // the request
+ SQLWarning aWarning;
+ aWarning.Message = sTitle;
+ SQLWarning aDetails;
+ aDetails.Message = String( SVX_RES( RID_STR_DELETECONFIRM ) );
+ aWarning.NextException <<= aDetails;
+
+ OInteractionRequest* pRequest = new OInteractionRequest( makeAny( aWarning ) );
+ Reference< XInteractionRequest > xRequest( pRequest );
+
+ // some knittings
+ pRequest->addContinuation( pApprove );
+ pRequest->addContinuation( pDisapprove );
+
+ // handle the request
+ m_xInteractionHandler->handle( xRequest );
+
+ if ( pApprove->wasSelected() )
+ return sal_True;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return sal_False;
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::invalidateFeatures( const Sequence< ::sal_Int16 >& _Features ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ // for now, just copy the ids of the features, because ....
+ ::std::copy( _Features.getConstArray(), _Features.getConstArray() + _Features.getLength(),
+ ::std::insert_iterator< ::std::set< sal_Int16 > >( m_aInvalidFeatures, m_aInvalidFeatures.begin() )
+ );
+
+ // ... we will do the real invalidation asynchronously
+ if ( !m_aFeatureInvalidationTimer.IsActive() )
+ m_aFeatureInvalidationTimer.Start();
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::invalidateAllFeatures( ) throw (RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+
+ Sequence< sal_Int16 > aInterceptedFeatures( m_aFeatureDispatchers.size() );
+ ::std::transform(
+ m_aFeatureDispatchers.begin(),
+ m_aFeatureDispatchers.end(),
+ aInterceptedFeatures.getArray(),
+ ::std::select1st< DispatcherContainer::value_type >()
+ );
+
+ aGuard.clear();
+ if ( aInterceptedFeatures.getLength() )
+ invalidateFeatures( aInterceptedFeatures );
+}
+
+//------------------------------------------------------------------------------
+Reference< XDispatch >
+FormController::interceptedQueryDispatch( const URL& aURL,
+ const ::rtl::OUString& /*aTargetFrameName*/, sal_Int32 /*nSearchFlags*/)
+ throw( RuntimeException )
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+ Reference< XDispatch > xReturn;
+ // dispatches handled by ourself
+ if ( ( aURL.Complete == FMURL_CONFIRM_DELETION )
+ || ( ( aURL.Complete.equalsAscii( "private:/InteractionHandler" ) )
+ && ensureInteractionHandler()
+ )
+ )
+ xReturn = static_cast< XDispatch* >( this );
+
+ // dispatches of FormSlot-URLs we have to translate
+ if ( !xReturn.is() && m_xFormOperations.is() )
+ {
+ // find the slot id which corresponds to the URL
+ sal_Int32 nFeatureSlotId = ::svx::FeatureSlotTranslation::getControllerFeatureSlotIdForURL( aURL.Main );
+ sal_Int16 nFormFeature = ( nFeatureSlotId != -1 ) ? ::svx::FeatureSlotTranslation::getFormFeatureForSlotId( nFeatureSlotId ) : -1;
+ if ( nFormFeature > 0 )
+ {
+ // get the dispatcher for this feature, create if necessary
+ DispatcherContainer::const_iterator aDispatcherPos = m_aFeatureDispatchers.find( nFormFeature );
+ if ( aDispatcherPos == m_aFeatureDispatchers.end() )
+ {
+ aDispatcherPos = m_aFeatureDispatchers.insert(
+ DispatcherContainer::value_type( nFormFeature, new ::svx::OSingleFeatureDispatcher( aURL, nFormFeature, m_xFormOperations, m_aMutex ) )
+ ).first;
+ }
+
+ OSL_ENSURE( aDispatcherPos->second.is(), "FormController::interceptedQueryDispatch: should have a dispatcher by now!" );
+ return aDispatcherPos->second;
+ }
+ }
+
+ // no more to offer
+ return xReturn;
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::dispatch( const URL& _rURL, const Sequence< PropertyValue >& _rArgs ) throw (RuntimeException)
+{
+ if ( _rArgs.getLength() != 1 )
+ {
+ DBG_ERROR( "FormController::dispatch: no arguments -> no dispatch!" );
+ return;
+ }
+
+ if ( _rURL.Complete.equalsAscii( "private:/InteractionHandler" ) )
+ {
+ Reference< XInteractionRequest > xRequest;
+ OSL_VERIFY( _rArgs[0].Value >>= xRequest );
+ if ( xRequest.is() )
+ handle( xRequest );
+ return;
+ }
+
+ if ( _rURL.Complete == FMURL_CONFIRM_DELETION )
+ {
+ DBG_ERROR( "FormController::dispatch: How do you expect me to return something via this call?" );
+ // confirmDelete has a return value - dispatch hasn't
+ return;
+ }
+
+ DBG_ERROR( "FormController::dispatch: unknown URL!" );
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::addStatusListener( const Reference< XStatusListener >& _rxListener, const URL& _rURL ) throw (RuntimeException)
+{
+ if (_rURL.Complete == FMURL_CONFIRM_DELETION)
+ {
+ if (_rxListener.is())
+ { // send an initial statusChanged event
+ FeatureStateEvent aEvent;
+ aEvent.FeatureURL = _rURL;
+ aEvent.IsEnabled = sal_True;
+ _rxListener->statusChanged(aEvent);
+ // and don't add the listener at all (the status will never change)
+ }
+ }
+ else
+ OSL_ENSURE(sal_False, "FormController::addStatusListener: invalid (unsupported) URL!");
+}
+
+//------------------------------------------------------------------------------
+Reference< XInterface > SAL_CALL FormController::getParent() throw( RuntimeException )
+{
+ return m_xParent;
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::setParent( const Reference< XInterface >& Parent) throw( NoSupportException, RuntimeException )
+{
+ m_xParent = Parent;
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::removeStatusListener( const Reference< XStatusListener >& /*_rxListener*/, const URL& _rURL ) throw (RuntimeException)
+{
+ (void)_rURL;
+ OSL_ENSURE(_rURL.Complete == FMURL_CONFIRM_DELETION, "FormController::removeStatusListener: invalid (unsupported) URL!");
+ // we never really added the listener, so we don't need to remove it
+}
+
+//------------------------------------------------------------------------------
+Reference< XDispatchProviderInterceptor > FormController::createInterceptor(const Reference< XDispatchProviderInterception > & _xInterception)
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+#ifdef DBG_UTIL
+ // check if we already have a interceptor for the given object
+ for ( ConstInterceptorsIterator aIter = m_aControlDispatchInterceptors.begin();
+ aIter != m_aControlDispatchInterceptors.end();
+ ++aIter
+ )
+ {
+ if ((*aIter)->getIntercepted() == _xInterception)
+ DBG_ERROR("FormController::createInterceptor : we already do intercept this objects dispatches !");
+ }
+#endif
+
+ DispatchInterceptionMultiplexer* pInterceptor = new DispatchInterceptionMultiplexer( _xInterception, this );
+ pInterceptor->acquire();
+ m_aControlDispatchInterceptors.insert( m_aControlDispatchInterceptors.end(), pInterceptor );
+
+ return pInterceptor;
+}
+
+//------------------------------------------------------------------------------
+bool FormController::ensureInteractionHandler()
+{
+ if ( m_xInteractionHandler.is() )
+ return true;
+ if ( m_bAttemptedHandlerCreation )
+ return false;
+ m_bAttemptedHandlerCreation = true;
+
+ m_xInteractionHandler.set( m_aContext.createComponent( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ), UNO_QUERY );
+ OSL_ENSURE( m_xInteractionHandler.is(), "FormController::ensureInteractionHandler: could not create an interaction handler!" );
+ return m_xInteractionHandler.is();
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL FormController::handle( const Reference< XInteractionRequest >& _rRequest ) throw (RuntimeException)
+{
+ if ( !ensureInteractionHandler() )
+ return;
+ m_xInteractionHandler->handle( _rRequest );
+}
+
+//------------------------------------------------------------------------------
+void FormController::deleteInterceptor(const Reference< XDispatchProviderInterception > & _xInterception)
+{
+ OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
+ // search the interceptor responsible for the given object
+ InterceptorsIterator aIter;
+ for ( aIter = m_aControlDispatchInterceptors.begin();
+ aIter != m_aControlDispatchInterceptors.end();
+ ++aIter
+ )
+ {
+ if ((*aIter)->getIntercepted() == _xInterception)
+ break;
+ }
+ if (aIter == m_aControlDispatchInterceptors.end())
+ {
+ return;
+ }
+
+ // log off the interception from it's interception object
+ DispatchInterceptionMultiplexer* pInterceptorImpl = *aIter;
+ pInterceptorImpl->dispose();
+ pInterceptorImpl->release();
+
+ // remove the interceptor from our array
+ m_aControlDispatchInterceptors.erase(aIter);
+}
+
+//--------------------------------------------------------------------
+void FormController::implInvalidateCurrentControlDependentFeatures()
+{
+ Sequence< sal_Int16 > aCurrentControlDependentFeatures(4);
+
+ aCurrentControlDependentFeatures[0] = FormFeature::SortAscending;
+ aCurrentControlDependentFeatures[1] = FormFeature::SortDescending;
+ aCurrentControlDependentFeatures[2] = FormFeature::AutoFilter;
+ aCurrentControlDependentFeatures[3] = FormFeature::RefreshCurrentControl;
+
+ invalidateFeatures( aCurrentControlDependentFeatures );
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL FormController::columnChanged( const EventObject& /*_event*/ ) throw (RuntimeException)
+{
+ implInvalidateCurrentControlDependentFeatures();
+}
+
+} // namespace svxform
diff --git a/svx/source/form/formcontrolling.cxx b/svx/source/form/formcontrolling.cxx
new file mode 100644
index 000000000000..a1f2059f3dfb
--- /dev/null
+++ b/svx/source/form/formcontrolling.cxx
@@ -0,0 +1,604 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "formcontrolling.hxx"
+#include "fmurl.hxx"
+#include "svx/svxids.hrc"
+#include "fmprop.hrc"
+#include "svx/fmtools.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/form/runtime/FormOperations.hpp>
+#include <com/sun/star/form/runtime/FormFeature.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdb/XSQLErrorBroadcaster.hpp>
+/** === end UNO includes === **/
+
+#include <tools/diagnose_ex.h>
+#include <comphelper/anytostring.hxx>
+#include <cppuhelper/exc_hlp.hxx>
+#include <osl/diagnose.h>
+
+#include <functional>
+#include <algorithm>
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::lang::XMultiServiceFactory;
+ using ::com::sun::star::form::runtime::XFormController;
+ using ::com::sun::star::form::XForm;
+ using ::com::sun::star::form::runtime::FormOperations;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::sdbc::XRowSet;
+ using ::com::sun::star::form::runtime::FeatureState;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::beans::NamedValue;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::beans::XPropertySet;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::sdbc::SQLException;
+ using ::com::sun::star::sdb::XSQLErrorBroadcaster;
+ using ::com::sun::star::sdb::SQLErrorEvent;
+ using ::com::sun::star::lang::EventObject;
+ /** === end UNO using === **/
+ namespace FormFeature = ::com::sun::star::form::runtime::FormFeature;
+
+ //====================================================================
+ //= FeatureSlotTranslation
+ //====================================================================
+ namespace
+ {
+ struct FeatureDescription
+ {
+ ::rtl::OUString sURL; // the URL
+ sal_Int32 nSlotId; // the SFX-compatible slot ID
+ sal_Int16 nFormFeature; // the css.form.runtime.FormFeature ID
+ };
+ typedef ::std::vector< FeatureDescription > FeatureDescriptions;
+
+ //................................................................
+ const FeatureDescriptions& getFeatureDescriptions()
+ {
+ static FeatureDescriptions s_aFeatureDescriptions;
+ if ( s_aFeatureDescriptions.empty() )
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if ( s_aFeatureDescriptions.empty() )
+ {
+ FeatureDescription aDescriptions[] = {
+ { FMURL_FORM_POSITION, SID_FM_RECORD_ABSOLUTE, FormFeature::MoveAbsolute },
+ { FMURL_FORM_RECORDCOUNT, SID_FM_RECORD_TOTAL, FormFeature::TotalRecords },
+ { FMURL_RECORD_MOVEFIRST, SID_FM_RECORD_FIRST, FormFeature::MoveToFirst },
+ { FMURL_RECORD_MOVEPREV, SID_FM_RECORD_PREV, FormFeature::MoveToPrevious },
+ { FMURL_RECORD_MOVENEXT, SID_FM_RECORD_NEXT, FormFeature::MoveToNext },
+ { FMURL_RECORD_MOVELAST, SID_FM_RECORD_LAST, FormFeature::MoveToLast },
+ { FMURL_RECORD_MOVETONEW, SID_FM_RECORD_NEW, FormFeature::MoveToInsertRow },
+ { FMURL_RECORD_SAVE, SID_FM_RECORD_SAVE, FormFeature::SaveRecordChanges },
+ { FMURL_RECORD_DELETE, SID_FM_RECORD_DELETE, FormFeature::DeleteRecord },
+ { FMURL_FORM_REFRESH, SID_FM_REFRESH, FormFeature::ReloadForm },
+ { FMURL_FORM_REFRESH_CURRENT_CONTROL,
+ SID_FM_REFRESH_FORM_CONTROL,FormFeature::RefreshCurrentControl },
+ { FMURL_RECORD_UNDO, SID_FM_RECORD_UNDO, FormFeature::UndoRecordChanges },
+ { FMURL_FORM_SORT_UP, SID_FM_SORTUP, FormFeature::SortAscending },
+ { FMURL_FORM_SORT_DOWN, SID_FM_SORTDOWN, FormFeature::SortDescending },
+ { FMURL_FORM_SORT, SID_FM_ORDERCRIT, FormFeature::InteractiveSort },
+ { FMURL_FORM_AUTO_FILTER, SID_FM_AUTOFILTER, FormFeature::AutoFilter },
+ { FMURL_FORM_FILTER, SID_FM_FILTERCRIT, FormFeature::InteractiveFilter },
+ { FMURL_FORM_APPLY_FILTER, SID_FM_FORM_FILTERED, FormFeature::ToggleApplyFilter },
+ { FMURL_FORM_REMOVE_FILTER, SID_FM_REMOVE_FILTER_SORT, FormFeature::RemoveFilterAndSort }
+ };
+ for ( size_t i=0; i<sizeof(aDescriptions)/sizeof(aDescriptions[0]); ++i )
+ s_aFeatureDescriptions.push_back( aDescriptions[i] );
+ }
+ };
+ return s_aFeatureDescriptions;
+ }
+ }
+
+ //--------------------------------------------------------------------
+ namespace
+ {
+ //................................................................
+ struct MatchFeatureDescriptionByURL : public ::std::unary_function< FeatureDescription, bool >
+ {
+ const ::rtl::OUString& m_rURL;
+ MatchFeatureDescriptionByURL( const ::rtl::OUString& _rURL ) :m_rURL( _rURL ) { }
+
+ bool operator()( const FeatureDescription& _compare )
+ {
+ return m_rURL == _compare.sURL;
+ }
+ };
+
+ //................................................................
+ struct MatchFeatureDescriptionBySlotId : public ::std::unary_function< FeatureDescription, bool >
+ {
+ sal_Int32 m_nSlotId;
+ MatchFeatureDescriptionBySlotId( sal_Int32 _nSlotId ) :m_nSlotId( _nSlotId ) { }
+
+ bool operator()( const FeatureDescription& _compare )
+ {
+ return m_nSlotId == _compare.nSlotId;
+ }
+ };
+
+ //................................................................
+ struct MatchFeatureDescriptionByFormFeature : public ::std::unary_function< FeatureDescription, bool >
+ {
+ sal_Int32 m_nFormFeature;
+ MatchFeatureDescriptionByFormFeature( sal_Int32 _nFormFeature ) :m_nFormFeature( _nFormFeature ) { }
+
+ bool operator()( const FeatureDescription& _compare )
+ {
+ return m_nFormFeature == _compare.nFormFeature;
+ }
+ };
+
+ //................................................................
+ struct FormFeatureToSlotId : public ::std::unary_function< sal_Int16, sal_Int32 >
+ {
+ sal_Int32 operator()( sal_Int16 _FormFeature )
+ {
+ return FeatureSlotTranslation::getSlotIdForFormFeature( _FormFeature );
+ }
+ };
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int32 FeatureSlotTranslation::getControllerFeatureSlotIdForURL( const ::rtl::OUString& _rMainURL )
+ {
+ const FeatureDescriptions& rDescriptions( getFeatureDescriptions() );
+ FeatureDescriptions::const_iterator pos = ::std::find_if( rDescriptions.begin(), rDescriptions.end(), MatchFeatureDescriptionByURL( _rMainURL ) );
+ return ( pos != rDescriptions.end() ) ? pos->nSlotId : -1;
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString FeatureSlotTranslation::getControllerFeatureURLForSlotId( sal_Int32 _nSlotId )
+ {
+ const FeatureDescriptions& rDescriptions( getFeatureDescriptions() );
+ FeatureDescriptions::const_iterator pos = ::std::find_if( rDescriptions.begin(), rDescriptions.end(), MatchFeatureDescriptionBySlotId( _nSlotId ) );
+ OSL_ENSURE( pos != rDescriptions.end(), "FeatureSlotTranslation::getControllerFeatureURLForSlotId: not found!" );
+ return ( pos != rDescriptions.end() ) ? pos->sURL : ::rtl::OUString();
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool FeatureSlotTranslation::isFeatureURL( const ::rtl::OUString& _rMainURL )
+ {
+ return ( _rMainURL.indexOf( FMURL_FORMSLOTS_PREFIX ) == 0 );
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int16 FeatureSlotTranslation::getFormFeatureForSlotId( sal_Int32 _nSlotId )
+ {
+ const FeatureDescriptions& rDescriptions( getFeatureDescriptions() );
+ FeatureDescriptions::const_iterator pos = ::std::find_if( rDescriptions.begin(), rDescriptions.end(), MatchFeatureDescriptionBySlotId( _nSlotId ) );
+ OSL_ENSURE( pos != rDescriptions.end(), "FeatureSlotTranslation::getFormFeatureForSlotId: not found!" );
+ return ( pos != rDescriptions.end() ) ? pos->nFormFeature : -1;
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int32 FeatureSlotTranslation::getSlotIdForFormFeature( sal_Int16 _nFormFeature )
+ {
+ const FeatureDescriptions& rDescriptions( getFeatureDescriptions() );
+ FeatureDescriptions::const_iterator pos = ::std::find_if( rDescriptions.begin(), rDescriptions.end(), MatchFeatureDescriptionByFormFeature( _nFormFeature ) );
+ OSL_ENSURE( pos != rDescriptions.end(), "FeatureSlotTranslation::getSlotIdForFormFeature: not found!" );
+ return ( pos != rDescriptions.end() ) ? pos->nSlotId : -1;
+ }
+
+ //====================================================================
+ //= ControllerFeatures
+ //====================================================================
+ //--------------------------------------------------------------------
+ ControllerFeatures::ControllerFeatures( const Reference< XMultiServiceFactory >& _rxORB, IControllerFeatureInvalidation* _pInvalidationCallback )
+ :m_aContext( _rxORB )
+ ,m_pInvalidationCallback( _pInvalidationCallback )
+ ,m_pImpl( NULL )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ ControllerFeatures::ControllerFeatures( const Reference< XMultiServiceFactory >& _rxORB,
+ const Reference< XFormController >& _rxController, IControllerFeatureInvalidation* _pInvalidationCallback )
+ :m_aContext( _rxORB )
+ ,m_pInvalidationCallback( _pInvalidationCallback )
+ ,m_pImpl( NULL )
+ {
+ assign( _rxController );
+ }
+
+ //--------------------------------------------------------------------
+ ControllerFeatures::ControllerFeatures( const Reference< XMultiServiceFactory >& _rxORB,
+ const Reference< XForm >& _rxForm, IControllerFeatureInvalidation* _pInvalidationCallback )
+ :m_aContext( _rxORB )
+ ,m_pInvalidationCallback( _pInvalidationCallback )
+ ,m_pImpl( NULL )
+ {
+ assign( _rxForm );
+ }
+
+ //--------------------------------------------------------------------
+ void ControllerFeatures::assign( const Reference< XFormController >& _rxController )
+ {
+ dispose();
+ m_pImpl = new FormControllerHelper( m_aContext, _rxController, m_pInvalidationCallback );
+ m_pImpl->acquire();
+ }
+
+ //--------------------------------------------------------------------
+ void ControllerFeatures::assign( const Reference< XForm >& _rxForm )
+ {
+ dispose();
+ m_pImpl = new FormControllerHelper( m_aContext, _rxForm, m_pInvalidationCallback );
+ m_pImpl->acquire();
+ }
+
+ //--------------------------------------------------------------------
+ ControllerFeatures::~ControllerFeatures()
+ {
+ dispose();
+ }
+
+ //--------------------------------------------------------------------
+ void ControllerFeatures::dispose()
+ {
+ if ( m_pImpl )
+ {
+ m_pImpl->dispose();
+ m_pImpl->release();
+ m_pImpl = NULL;
+ }
+ }
+
+ //====================================================================
+ //= FormControllerHelper
+ //====================================================================
+ //--------------------------------------------------------------------
+ FormControllerHelper::FormControllerHelper( const ::comphelper::ComponentContext& _rContext,
+ const Reference< XFormController >& _rxController, IControllerFeatureInvalidation* _pInvalidationCallback )
+ :m_aContext( _rContext )
+ ,m_pInvalidationCallback( _pInvalidationCallback )
+ {
+ osl_incrementInterlockedCount( &m_refCount );
+ try
+ {
+ m_xFormOperations = FormOperations::createWithFormController( m_aContext.getUNOContext(), _rxController );
+ if ( m_xFormOperations.is() )
+ m_xFormOperations->setFeatureInvalidation( this );
+
+ // to prevent the controller from displaying any error messages which happen while we operate on it,
+ // we add ourself as XSQLErrorListener. By contract, a FormController displays errors if and only if
+ // no SQLErrorListeners are registered.
+ Reference< XSQLErrorBroadcaster > xErrorBroadcast( _rxController, UNO_QUERY_THROW );
+ xErrorBroadcast->addSQLErrorListener( this );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ osl_decrementInterlockedCount( &m_refCount );
+ }
+
+ //--------------------------------------------------------------------
+ FormControllerHelper::FormControllerHelper( const ::comphelper::ComponentContext& _rContext,
+ const Reference< XForm >& _rxForm, IControllerFeatureInvalidation* _pInvalidationCallback )
+ :m_aContext( _rContext )
+ ,m_pInvalidationCallback( _pInvalidationCallback )
+ {
+ osl_incrementInterlockedCount( &m_refCount );
+ try
+ {
+ m_xFormOperations = FormOperations::createWithForm( m_aContext.getUNOContext(), _rxForm );
+ if ( m_xFormOperations.is() )
+ m_xFormOperations->setFeatureInvalidation( this );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ osl_decrementInterlockedCount( &m_refCount );
+ }
+
+ //--------------------------------------------------------------------
+ FormControllerHelper::~FormControllerHelper( )
+ {
+ try
+ {
+ acquire();
+ dispose();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void FormControllerHelper::dispose()
+ {
+ if ( m_xFormOperations.is() )
+ m_xFormOperations->dispose();
+ m_xFormOperations.clear();
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool FormControllerHelper::isEnabled( sal_Int32 _nSlotId ) const
+ {
+ if ( !m_xFormOperations.is() )
+ return sal_False;
+ return m_xFormOperations->isEnabled( FeatureSlotTranslation::getFormFeatureForSlotId( _nSlotId ) );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XRowSet > FormControllerHelper::getCursor() const
+ {
+ Reference< XRowSet > xCursor;
+ if ( m_xFormOperations.is() )
+ xCursor = m_xFormOperations->getCursor();
+ return xCursor;
+ }
+
+ //--------------------------------------------------------------------
+ void FormControllerHelper::getState( sal_Int32 _nSlotId, FeatureState& _rState ) const
+ {
+ if ( m_xFormOperations.is() )
+ _rState = m_xFormOperations->getState( FeatureSlotTranslation::getFormFeatureForSlotId( _nSlotId ) );
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool FormControllerHelper::commitCurrentControl( ) const
+ {
+ return impl_operateForm_nothrow( COMMIT_CONTROL );
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool FormControllerHelper::commitCurrentRecord() const
+ {
+ return impl_operateForm_nothrow( COMMIT_RECORD );
+ }
+
+ //--------------------------------------------------------------------
+ bool FormControllerHelper::moveRight( ) const
+ {
+ return impl_operateForm_nothrow( FormFeature::MoveToNext );
+ }
+
+ //--------------------------------------------------------------------
+ bool FormControllerHelper::moveLeft( ) const
+ {
+ return impl_operateForm_nothrow( FormFeature::MoveToPrevious );
+ }
+
+ //--------------------------------------------------------------------
+ void FormControllerHelper::execute( sal_Int32 _nSlotId, const ::rtl::OUString& _rParamName, const Any& _rParamValue ) const
+ {
+ Sequence< NamedValue > aArguments(1);
+ aArguments[0].Name = _rParamName;
+ aArguments[0].Value = _rParamValue;
+
+ impl_operateForm_nothrow( EXECUTE_ARGS, FeatureSlotTranslation::getFormFeatureForSlotId( _nSlotId ), aArguments );
+ }
+
+ //--------------------------------------------------------------------
+ bool FormControllerHelper::impl_operateForm_nothrow( const FormOperation _eWhat, const sal_Int16 _nFeature,
+ const Sequence< NamedValue >& _rArguments ) const
+ {
+ if ( !m_xFormOperations.is() )
+ return false;
+
+ Any aError;
+ bool bSuccess = false;
+ const_cast< FormControllerHelper* >( this )->m_aOperationError.clear();
+ try
+ {
+ switch ( _eWhat )
+ {
+ case COMMIT_CONTROL:
+ bSuccess = m_xFormOperations->commitCurrentControl();
+ break;
+
+ case COMMIT_RECORD:
+ {
+ sal_Bool bDummy( sal_False );
+ bSuccess = m_xFormOperations->commitCurrentRecord( bDummy );
+ }
+ break;
+
+ case EXECUTE:
+ m_xFormOperations->execute( _nFeature );
+ bSuccess = true;
+ break;
+
+ case EXECUTE_ARGS:
+ m_xFormOperations->executeWithArguments( _nFeature, _rArguments );
+ bSuccess = true;
+ break;
+ }
+ }
+ catch ( const SQLException& )
+ {
+ aError = ::cppu::getCaughtException();
+ }
+ catch( const Exception& )
+ {
+ SQLException aFallbackError;
+ aFallbackError.Message = ::comphelper::anyToString( ::cppu::getCaughtException() );
+ aError <<= aFallbackError;
+ }
+
+ if ( bSuccess )
+ return true;
+
+ // display the error. Prefer the one reported in errorOccured over the one caught.
+ if ( m_aOperationError.hasValue() )
+ displayException( m_aOperationError );
+ else if ( aError.hasValue() )
+ displayException( aError );
+ else
+ OSL_ENSURE( false, "FormControllerHelper::impl_operateForm_nothrow: no success, but no error?" );
+
+ return false;
+ }
+
+ //--------------------------------------------------------------------
+ void FormControllerHelper::execute( sal_Int32 _nSlotId ) const
+ {
+ impl_operateForm_nothrow( EXECUTE, FeatureSlotTranslation::getFormFeatureForSlotId( _nSlotId ),
+ Sequence< NamedValue >() );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL FormControllerHelper::invalidateFeatures( const Sequence< ::sal_Int16 >& _Features ) throw (RuntimeException)
+ {
+ if ( !m_pInvalidationCallback )
+ // nobody's interested in ...
+ return;
+
+ ::std::vector< sal_Int32 > aFeatures( _Features.getLength() );
+ ::std::transform(
+ _Features.getConstArray(),
+ _Features.getConstArray() + _Features.getLength(),
+ aFeatures.begin(),
+ FormFeatureToSlotId()
+ );
+
+ m_pInvalidationCallback->invalidateFeatures( aFeatures );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL FormControllerHelper::invalidateAllFeatures() throw (RuntimeException)
+ {
+ if ( !m_pInvalidationCallback )
+ // nobody's interested in ...
+ return;
+
+ // actually, it's a little bit more than the supported features,
+ // but on the medium term, we are to support everything listed
+ // here
+ ::std::vector< sal_Int32 > aSupportedFeatures;
+ sal_Int32 pSupportedFeatures[] =
+ {
+ SID_FM_RECORD_FIRST,
+ SID_FM_RECORD_NEXT,
+ SID_FM_RECORD_PREV,
+ SID_FM_RECORD_LAST,
+ SID_FM_RECORD_NEW,
+ SID_FM_RECORD_DELETE,
+ SID_FM_RECORD_ABSOLUTE,
+ SID_FM_RECORD_TOTAL,
+ SID_FM_RECORD_SAVE,
+ SID_FM_RECORD_UNDO,
+ SID_FM_REMOVE_FILTER_SORT,
+ SID_FM_SORTUP,
+ SID_FM_SORTDOWN,
+ SID_FM_ORDERCRIT,
+ SID_FM_AUTOFILTER,
+ SID_FM_FILTERCRIT,
+ SID_FM_FORM_FILTERED,
+ SID_FM_REFRESH,
+ SID_FM_REFRESH_FORM_CONTROL,
+ SID_FM_SEARCH,
+ SID_FM_FILTER_START,
+ SID_FM_VIEW_AS_GRID
+ };
+ sal_Int32 nFeatureCount = sizeof( pSupportedFeatures ) / sizeof( pSupportedFeatures[ 0 ] );
+ aSupportedFeatures.resize( nFeatureCount );
+ ::std::copy( pSupportedFeatures, pSupportedFeatures + nFeatureCount, aSupportedFeatures.begin() );
+
+ m_pInvalidationCallback->invalidateFeatures( aSupportedFeatures );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL FormControllerHelper::errorOccured( const SQLErrorEvent& _Event ) throw (RuntimeException)
+ {
+ OSL_ENSURE( !m_aOperationError.hasValue(), "FormControllerHelper::errorOccured: two errors during one operation?" );
+ m_aOperationError = _Event.Reason;
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL FormControllerHelper::disposing( const EventObject& /*_Source*/ ) throw (RuntimeException)
+ {
+ // not interested in
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool FormControllerHelper::isInsertionRow() const
+ {
+ sal_Bool bIs = sal_False;
+ if ( m_xFormOperations.is() )
+ bIs = m_xFormOperations->isInsertionRow();
+ return bIs;
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool FormControllerHelper::isModifiedRow() const
+ {
+ sal_Bool bIs = sal_False;
+ if ( m_xFormOperations.is() )
+ bIs = m_xFormOperations->isModifiedRow();
+ return bIs;
+ }
+ //--------------------------------------------------------------------
+ bool FormControllerHelper::canDoFormFilter() const
+ {
+ if ( !m_xFormOperations.is() )
+ return false;
+
+ bool bCanDo = false;
+ try
+ {
+ Reference< XPropertySet > xCursorProperties( m_xFormOperations->getCursor(), UNO_QUERY_THROW );
+
+ bool bEscapeProcessing( false );
+ OSL_VERIFY( xCursorProperties->getPropertyValue( FM_PROP_ESCAPE_PROCESSING ) >>= bEscapeProcessing );
+
+ ::rtl::OUString sActiveCommand;
+ OSL_VERIFY( xCursorProperties->getPropertyValue( FM_PROP_ACTIVECOMMAND ) >>= sActiveCommand );
+
+ bool bInsertOnlyForm( false );
+ OSL_VERIFY( xCursorProperties->getPropertyValue( FM_PROP_INSERTONLY ) >>= bInsertOnlyForm );
+
+ bCanDo = bEscapeProcessing && ( sActiveCommand.getLength() > 0 ) && !bInsertOnlyForm;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return bCanDo;
+ }
+
+//........................................................................
+} // namespace svx
+//........................................................................
diff --git a/svx/source/form/formdispatchinterceptor.cxx b/svx/source/form/formdispatchinterceptor.cxx
new file mode 100644
index 000000000000..f14a82d8c7ee
--- /dev/null
+++ b/svx/source/form/formdispatchinterceptor.cxx
@@ -0,0 +1,214 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "formdispatchinterceptor.hxx"
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+#include <tools/debug.hxx>
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::frame::XDispatchProviderInterception;
+ using ::com::sun::star::frame::XDispatchProviderInterceptor;
+ using ::com::sun::star::lang::XComponent;
+ using ::com::sun::star::util::URL;
+ using ::com::sun::star::frame::XDispatch;
+ using ::com::sun::star::frame::DispatchDescriptor;
+ using ::com::sun::star::frame::XDispatchProvider;
+ using ::com::sun::star::lang::EventObject;
+ /** === end UNO using === **/
+
+ //========================================================================
+ //= DispatchInterceptionMultiplexer
+ //========================================================================
+
+ DBG_NAME(DispatchInterceptionMultiplexer)
+ //------------------------------------------------------------------------
+ DispatchInterceptionMultiplexer::DispatchInterceptionMultiplexer(
+ const Reference< XDispatchProviderInterception >& _rxToIntercept, DispatchInterceptor* _pMaster )
+ :DispatchInterceptionMultiplexer_BASE(_pMaster && _pMaster->getInterceptorMutex() ? *_pMaster->getInterceptorMutex() : m_aFallback)
+ ,m_aFallback()
+ ,m_pMutex( _pMaster && _pMaster->getInterceptorMutex() ? _pMaster->getInterceptorMutex() : &m_aFallback )
+ ,m_xIntercepted(_rxToIntercept)
+ ,m_bListening(sal_False)
+ ,m_pMaster(_pMaster)
+ {
+ DBG_CTOR(DispatchInterceptionMultiplexer,NULL);
+
+ ::osl::MutexGuard aGuard( *m_pMutex );
+ ::comphelper::increment(m_refCount);
+ if (_rxToIntercept.is())
+ {
+ _rxToIntercept->registerDispatchProviderInterceptor((XDispatchProviderInterceptor*)this);
+ // this should make us the top-level dispatch-provider for the component, via a call to our
+ // setDispatchProvider we should have got an fallback for requests we (i.e. our master) cannot fullfill
+ Reference< XComponent> xInterceptedComponent(_rxToIntercept, UNO_QUERY);
+ if (xInterceptedComponent.is())
+ {
+ xInterceptedComponent->addEventListener(this);
+ m_bListening = sal_True;
+ }
+ }
+ ::comphelper::decrement(m_refCount);
+ }
+
+ //------------------------------------------------------------------------
+ DispatchInterceptionMultiplexer::~DispatchInterceptionMultiplexer()
+ {
+ if (!rBHelper.bDisposed)
+ dispose();
+
+ DBG_DTOR(DispatchInterceptionMultiplexer,NULL);
+ }
+
+ //------------------------------------------------------------------------------
+ Reference< XDispatch > SAL_CALL DispatchInterceptionMultiplexer::queryDispatch( const URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags ) throw(RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( *m_pMutex );
+ Reference< XDispatch> xResult;
+ // ask our 'real' interceptor
+ if (m_pMaster)
+ xResult = m_pMaster->interceptedQueryDispatch( aURL, aTargetFrameName, nSearchFlags);
+
+ // ask our slave provider
+ if (!xResult.is() && m_xSlaveDispatcher.is())
+ xResult = m_xSlaveDispatcher->queryDispatch(aURL, aTargetFrameName, nSearchFlags);
+
+ return xResult;
+ }
+
+ //------------------------------------------------------------------------------
+ Sequence< Reference< XDispatch > > SAL_CALL
+ DispatchInterceptionMultiplexer::queryDispatches( const Sequence< DispatchDescriptor >& aDescripts ) throw(RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( *m_pMutex );
+ Sequence< Reference< XDispatch> > aReturn(aDescripts.getLength());
+ Reference< XDispatch>* pReturn = aReturn.getArray();
+ const DispatchDescriptor* pDescripts = aDescripts.getConstArray();
+ for (sal_Int16 i=0; i<aDescripts.getLength(); ++i, ++pReturn, ++pDescripts)
+ {
+ *pReturn = queryDispatch(pDescripts->FeatureURL, pDescripts->FrameName, pDescripts->SearchFlags);
+ }
+ return aReturn;
+ }
+
+ //------------------------------------------------------------------------------
+ Reference< XDispatchProvider > SAL_CALL DispatchInterceptionMultiplexer::getSlaveDispatchProvider( ) throw(RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( *m_pMutex );
+ return m_xSlaveDispatcher;
+ }
+
+ //------------------------------------------------------------------------------
+ void SAL_CALL DispatchInterceptionMultiplexer::setSlaveDispatchProvider(const Reference< XDispatchProvider>& xNewDispatchProvider) throw( RuntimeException )
+ {
+ ::osl::MutexGuard aGuard( *m_pMutex );
+ m_xSlaveDispatcher = xNewDispatchProvider;
+ }
+
+ //------------------------------------------------------------------------------
+ Reference< XDispatchProvider> SAL_CALL DispatchInterceptionMultiplexer::getMasterDispatchProvider(void) throw( RuntimeException )
+ {
+ ::osl::MutexGuard aGuard( *m_pMutex );
+ return m_xMasterDispatcher;
+ }
+
+ //------------------------------------------------------------------------------
+ void SAL_CALL DispatchInterceptionMultiplexer::setMasterDispatchProvider(const Reference< XDispatchProvider>& xNewSupplier) throw( RuntimeException )
+ {
+ ::osl::MutexGuard aGuard( *m_pMutex );
+ m_xMasterDispatcher = xNewSupplier;
+ }
+
+ //------------------------------------------------------------------------------
+ void SAL_CALL DispatchInterceptionMultiplexer::disposing(const EventObject& Source) throw( RuntimeException )
+ {
+ if (m_bListening)
+ {
+ Reference< XDispatchProviderInterception > xIntercepted(m_xIntercepted.get(), UNO_QUERY);
+ if (Source.Source == xIntercepted)
+ ImplDetach();
+ }
+ }
+
+ //------------------------------------------------------------------------------
+ void DispatchInterceptionMultiplexer::ImplDetach()
+ {
+ ::osl::MutexGuard aGuard( *m_pMutex );
+ OSL_ENSURE(m_bListening, "DispatchInterceptionMultiplexer::ImplDetach: invalid call!");
+
+ // deregister ourself from the interception component
+ Reference< XDispatchProviderInterception > xIntercepted(m_xIntercepted.get(), UNO_QUERY);
+ if (xIntercepted.is())
+ xIntercepted->releaseDispatchProviderInterceptor(static_cast<XDispatchProviderInterceptor*>(this));
+
+ // m_xIntercepted = Reference< XDispatchProviderInterception >();
+ // Don't reset m_xIntercepted: It may be needed by our owner to check for which object we were
+ // responsible. As we hold the object with a weak reference only, this should be no problem.
+ // 88936 - 23.07.2001 - frank.schoenheit@sun.com
+ m_pMaster = NULL;
+ m_pMutex = &m_aFallback;
+ m_bListening = sal_False;
+ }
+
+ //------------------------------------------------------------------------------
+ void DispatchInterceptionMultiplexer::disposing()
+ {
+ // remove ourself as event listener from the interception component
+ if (m_bListening)
+ {
+ Reference< XComponent> xInterceptedComponent(m_xIntercepted.get(), UNO_QUERY);
+ if (xInterceptedComponent.is())
+ xInterceptedComponent->removeEventListener(static_cast<XEventListener*>(this));
+
+ // detach from the interception component
+ ImplDetach();
+ }
+ }
+
+//........................................................................
+} // namespace svxform
+//........................................................................
diff --git a/svx/source/form/formfeaturedispatcher.cxx b/svx/source/form/formfeaturedispatcher.cxx
new file mode 100644
index 000000000000..03db6dcb07bb
--- /dev/null
+++ b/svx/source/form/formfeaturedispatcher.cxx
@@ -0,0 +1,241 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "formfeaturedispatcher.hxx"
+
+#include <comphelper/namedvaluecollection.hxx>
+#include <tools/diagnose_ex.h>
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::frame;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::util;
+ using namespace ::com::sun::star::form::runtime;
+
+ //====================================================================
+ //= OSingleFeatureDispatcher
+ //====================================================================
+ //--------------------------------------------------------------------
+ OSingleFeatureDispatcher::OSingleFeatureDispatcher( const URL& _rFeatureURL, const sal_Int16 _nFormFeature,
+ const Reference< XFormOperations >& _rxFormOperations, ::osl::Mutex& _rMutex )
+ :m_rMutex( _rMutex )
+ ,m_aStatusListeners( _rMutex )
+ ,m_xFormOperations( _rxFormOperations )
+ ,m_aFeatureURL( _rFeatureURL )
+ ,m_nFormFeature( _nFormFeature )
+ ,m_bLastKnownEnabled( sal_False )
+ ,m_bDisposed( sal_False )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ void OSingleFeatureDispatcher::dispose()
+ {
+ {
+ ::osl::MutexGuard aGuard( m_rMutex );
+ if ( m_bDisposed )
+ return;
+ }
+
+ EventObject aDisposeEvent( *this );
+ m_aStatusListeners.disposeAndClear( aDisposeEvent );
+
+ {
+ ::osl::MutexGuard aGuard( m_rMutex );
+ m_bDisposed = sal_True;
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void OSingleFeatureDispatcher::getUnoState( FeatureStateEvent& /* [out] */ _rState ) const
+ {
+ _rState.Source = *const_cast< OSingleFeatureDispatcher* >( this );
+
+ FeatureState aState( m_xFormOperations->getState( m_nFormFeature ) );
+
+ _rState.FeatureURL = m_aFeatureURL;
+ _rState.IsEnabled = aState.Enabled;
+ _rState.Requery = sal_False;
+ _rState.State = aState.State;
+ }
+
+ //--------------------------------------------------------------------
+ void OSingleFeatureDispatcher::updateAllListeners()
+ {
+ ::osl::ClearableMutexGuard aGuard( m_rMutex );
+
+ FeatureStateEvent aUnoState;
+ getUnoState( aUnoState );
+
+ if ( ( m_aLastKnownState == aUnoState.State ) && ( m_bLastKnownEnabled == aUnoState.IsEnabled ) )
+ return;
+
+ m_aLastKnownState = aUnoState.State;
+ m_bLastKnownEnabled = aUnoState.IsEnabled;
+
+ notifyStatus( NULL, aGuard );
+ }
+
+ //--------------------------------------------------------------------
+ void OSingleFeatureDispatcher::notifyStatus( const Reference< XStatusListener >& _rxListener, ::osl::ClearableMutexGuard& _rFreeForNotification )
+ {
+ FeatureStateEvent aUnoState;
+ getUnoState( aUnoState );
+
+ if ( _rxListener.is() )
+ {
+ try
+ {
+ _rFreeForNotification.clear();
+ _rxListener->statusChanged( aUnoState );
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "OSingleFeatureDispatcher::notifyStatus: caught an exception!" );
+ }
+ }
+ else
+ {
+ ::cppu::OInterfaceIteratorHelper aIter( m_aStatusListeners );
+ _rFreeForNotification.clear();
+
+ while ( aIter.hasMoreElements() )
+ {
+ try
+ {
+ static_cast< XStatusListener* >( aIter.next() )->statusChanged( aUnoState );
+ }
+ catch( const DisposedException& )
+ {
+ OSL_ENSURE( sal_False, "OSingleFeatureDispatcher::notifyStatus: caught a DisposedException - removing the listener!" );
+ aIter.remove( );
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "OSingleFeatureDispatcher::notifyStatus: caught a generic exception while notifying a single listener!" );
+ }
+ }
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL OSingleFeatureDispatcher::dispatch( const URL& _rURL, const Sequence< PropertyValue >& _rArguments ) throw (RuntimeException)
+ {
+ ::osl::ClearableMutexGuard aGuard( m_rMutex );
+ checkAlive();
+
+ OSL_ENSURE( _rURL.Complete == m_aFeatureURL.Complete, "OSingleFeatureDispatcher::dispatch: not responsible for this URL!" );
+ (void)_rURL;
+
+ if ( !m_xFormOperations->isEnabled( m_nFormFeature ) )
+ return;
+
+ // release our mutex before executing the command
+ sal_Int16 nFormFeature( m_nFormFeature );
+ Reference< XFormOperations > xFormOperations( m_xFormOperations );
+ aGuard.clear();
+
+ try
+ {
+ if ( !_rArguments.getLength() )
+ {
+ xFormOperations->execute( nFormFeature );
+ }
+ else
+ { // at the moment we only support one parameter
+ ::comphelper::NamedValueCollection aArgs( _rArguments );
+ xFormOperations->executeWithArguments( nFormFeature, aArgs.getNamedValues() );
+ }
+ }
+ catch( const RuntimeException& )
+ {
+ throw;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL OSingleFeatureDispatcher::addStatusListener( const Reference< XStatusListener >& _rxControl, const URL& _rURL ) throw (RuntimeException)
+ {
+ (void)_rURL;
+ OSL_ENSURE( _rURL.Complete == m_aFeatureURL.Complete, "OSingleFeatureDispatcher::addStatusListener: unexpected URL!" );
+ OSL_ENSURE( _rxControl.is(), "OSingleFeatureDispatcher::addStatusListener: senseless call!" );
+ if ( !_rxControl.is() )
+ return;
+
+ ::osl::ClearableMutexGuard aGuard( m_rMutex );
+ if ( m_bDisposed )
+ {
+ EventObject aDisposeEvent( *this );
+ aGuard.clear();
+ _rxControl->disposing( aDisposeEvent );
+ return;
+ }
+
+ m_aStatusListeners.addInterface( _rxControl );
+
+ // initially update the status
+ notifyStatus( _rxControl, aGuard );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL OSingleFeatureDispatcher::removeStatusListener( const Reference< XStatusListener >& _rxControl, const URL& _rURL ) throw (RuntimeException)
+ {
+ (void)_rURL;
+ OSL_ENSURE( _rURL.Complete == m_aFeatureURL.Complete, "OSingleFeatureDispatcher::removeStatusListener: unexpected URL!" );
+ OSL_ENSURE( _rxControl.is(), "OSingleFeatureDispatcher::removeStatusListener: senseless call!" );
+ if ( !_rxControl.is() )
+ return;
+
+ ::osl::MutexGuard aGuard( m_rMutex );
+ checkAlive();
+
+ m_aStatusListeners.removeInterface( _rxControl );
+ }
+
+ //--------------------------------------------------------------------
+ void OSingleFeatureDispatcher::checkAlive() const SAL_THROW((DisposedException))
+ {
+ if ( m_bDisposed )
+ throw DisposedException( ::rtl::OUString(), *const_cast< OSingleFeatureDispatcher* >( this ) );
+ }
+
+//........................................................................
+} // namespace svx
+//........................................................................
diff --git a/svx/source/form/formshell.src b/svx/source/form/formshell.src
new file mode 100644
index 000000000000..287f60a277a7
--- /dev/null
+++ b/svx/source/form/formshell.src
@@ -0,0 +1,228 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "svx/fmresids.hrc"
+#include <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+#include <sfx2/sfxsids.hrc>
+#include "globlmn.hrc"
+#include "helpid.hrc"
+#include "fmhelp.hrc"
+
+Menu RID_FM_TEXTATTRIBUTE_MENU
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_FONT
+ };
+ MenuItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_FONTHEIGHT
+ };
+ MenuItem
+ {
+ Identifier = MENU_FM_TEXTATTRIBITES_STYLE;
+ HelpID = HID_MENU_FM_TEXTATTRIBUTES_STYLE;
+ Text [ en-US ] = "St~yle";
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_WEIGHT
+ };
+ MenuItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_POSTURE
+ };
+ MenuItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_OVERLINE
+ };
+ MenuItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_UNDERLINE
+ };
+ MenuItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_STRIKEOUT
+ };
+ MenuItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_SHADOWED
+ };
+ MenuItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_CONTOUR
+ };
+ MenuItem { Separator = TRUE; };
+ MenuItem
+ {
+ ITEM_FORMAT_SET_SUPER_SCRIPT
+ };
+ MenuItem
+ {
+ ITEM_FORMAT_SET_SUB_SCRIPT
+ };
+ };
+ };
+ };
+ MenuItem
+ {
+ Identifier = MENU_FM_TEXTATTRIBITES_ALIGNMENT;
+ HelpID = HID_MENU_FM_TEXTATTRIBUTES_ALIGNMENT;
+ Text [ en-US ] = "~Alignment";
+ RadioCheck = TRUE;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ RadioCheck = TRUE;
+ ITEM_FORMAT_ATTR_PARA_ADJUST_LEFT
+ };
+ MenuItem
+ {
+ RadioCheck = TRUE;
+ ITEM_FORMAT_ATTR_PARA_ADJUST_RIGHT
+ };
+ MenuItem
+ {
+ RadioCheck = TRUE;
+ ITEM_FORMAT_ATTR_PARA_ADJUST_CENTER
+ };
+ MenuItem
+ {
+ ITEM_FORMAT_ATTR_PARA_ADJUST_BLOCK
+ RadioCheck = TRUE;
+ };
+ };
+ };
+ };
+ MenuItem
+ {
+ Identifier = MENU_FM_TEXTATTRIBITES_SPACING;
+ HelpID = HID_MENU_FM_TEXTATTRIBUTES_SPACING;
+ Text [ en-US ] = "~Line Spacing";
+ _MenuItemFlags = MIB_RADIOCHECK;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ RadioCheck = TRUE;
+ ITEM_FORMAT_PARA_LINESPACE_10
+ };
+ MenuItem
+ {
+ RadioCheck = TRUE;
+ ITEM_FORMAT_PARA_LINESPACE_15
+ };
+ MenuItem
+ {
+ RadioCheck = TRUE;
+ ITEM_FORMAT_PARA_LINESPACE_20
+ };
+ };
+ };
+ };
+ };
+};
+
+TabDialog RID_SVXDLG_TEXTCONTROL_CHARATTR
+{
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Moveable = TRUE;
+
+ Text [ en-US ] = "Character";
+
+ TabControl 1
+ {
+ OutputSize = TRUE;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_CHAR_NAME;
+ Text [ en-US ] = "Font";
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_CHAR_EFFECTS;
+ Text [ en-US ] = "Font Effects";
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_CHAR_POSITION;
+ Text [ en-US ] = "Position";
+ };
+ };
+ };
+};
+
+TabDialog RID_SVXDLG_TEXTCONTROL_PARAATTR
+{
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Moveable = TRUE;
+
+ Text [ en-US ] = "Paragraph";
+
+ TabControl 1
+ {
+ OutputSize = TRUE;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_STD_PARAGRAPH;
+ Text [ en-US ] = "Indents & Spacing";
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_ALIGN_PARAGRAPH;
+ Text [ en-US ] = "Alignment";
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_PARA_ASIAN;
+ Text [ en-US ] = "Asian Typography";
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_TABULATOR;
+ Text [ en-US ] = "Tabs";
+ };
+ };
+ };
+};
diff --git a/svx/source/form/formtoolbars.cxx b/svx/source/form/formtoolbars.cxx
new file mode 100644
index 000000000000..739e9788c64b
--- /dev/null
+++ b/svx/source/form/formtoolbars.cxx
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "formtoolbars.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/beans/XPropertySet.hpp>
+/** === end UNO includes === **/
+
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::frame;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::frame;
+
+ //====================================================================
+ //= FormToolboxes
+ //====================================================================
+ //--------------------------------------------------------------------
+ FormToolboxes::FormToolboxes( const Reference< XFrame >& _rxFrame )
+ {
+ // the layout manager
+ Reference< XPropertySet > xFrameProps( _rxFrame, UNO_QUERY );
+ if ( xFrameProps.is() )
+ xFrameProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ) ) ) >>= m_xLayouter;
+ }
+
+ //--------------------------------------------------------------------
+ void FormToolboxes::toggleToolbox( sal_uInt16 _nSlotId ) const
+ {
+ try
+ {
+ Reference< XLayoutManager > xManager( m_xLayouter );
+ OSL_ENSURE( xManager. is(), "FormToolboxes::toggleToolbox: couldn't obtain the layout manager!" );
+ if ( xManager. is() )
+ {
+ ::rtl::OUString sToolboxResource( getToolboxResourceName( _nSlotId ) );
+ if ( xManager->isElementVisible( sToolboxResource ) )
+ {
+ xManager->hideElement( sToolboxResource );
+ xManager->destroyElement( sToolboxResource );
+ }
+ else
+ {
+ xManager->createElement( sToolboxResource );
+ xManager->showElement( sToolboxResource );
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "FormToolboxes::toggleToolbox: caught an exception!" );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ bool FormToolboxes::isToolboxVisible( sal_uInt16 _nSlotId ) const
+ {
+ return m_xLayouter.is() && m_xLayouter->isElementVisible(
+ getToolboxResourceName( _nSlotId ) );
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString FormToolboxes::getToolboxResourceName( sal_uInt16 _nSlotId ) const
+ {
+ OSL_ENSURE( ( _nSlotId == SID_FM_MORE_CONTROLS ) || ( _nSlotId == SID_FM_FORM_DESIGN_TOOLS ) || ( _nSlotId == SID_FM_CONFIG ),
+ "FormToolboxes::getToolboxResourceName: unsupported slot!" );
+
+ const sal_Char* pToolBarName = "formcontrols";
+ if ( _nSlotId == SID_FM_MORE_CONTROLS )
+ pToolBarName = "moreformcontrols";
+ else if ( _nSlotId == SID_FM_FORM_DESIGN_TOOLS )
+ pToolBarName = "formdesign";
+
+ ::rtl::OUString aToolBarResStr( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/" ));
+ aToolBarResStr += ::rtl::OUString::createFromAscii( pToolBarName );
+ return aToolBarResStr;
+ }
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
diff --git a/svx/source/form/legacyformcontroller.cxx b/svx/source/form/legacyformcontroller.cxx
new file mode 100644
index 000000000000..0908ae8af953
--- /dev/null
+++ b/svx/source/form/legacyformcontroller.cxx
@@ -0,0 +1,226 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "fmservs.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/form/XFormController.hpp>
+#include <com/sun/star/form/runtime/XFormController.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/implbase2.hxx>
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::lang::XMultiServiceFactory;
+ using ::com::sun::star::awt::XControl;
+ using ::com::sun::star::awt::XTabControllerModel;
+ using ::com::sun::star::awt::XControlContainer;
+ using ::com::sun::star::lang::XServiceInfo;
+ /** === end UNO using === **/
+
+ using namespace ::com::sun::star;
+
+ //====================================================================
+ //= LegacyFormController
+ //====================================================================
+ typedef ::cppu::WeakImplHelper2 < form::XFormController
+ , XServiceInfo
+ > LegacyFormController_Base;
+ /** is an implementation of the legacy form controller service, namely css.form.FormController, supporting the
+ css.form.XFormController interface.
+
+ This legacy API is superseded by css.form.runtime.(X)FormController, and though we migrated all OOo-internal
+ usage of this old API, their might be clients external to OOo still using it (though this is rather unlikely).
+ */
+ class LegacyFormController : public LegacyFormController_Base
+ {
+ public:
+ static Reference< XInterface > Create( const Reference< XMultiServiceFactory >& _rxFactory )
+ {
+ return *( new LegacyFormController( _rxFactory ) );
+ }
+
+ protected:
+ LegacyFormController( const Reference< XMultiServiceFactory >& _rxFactory )
+ :m_xDelegator( _rxFactory->createInstance( FM_FORM_CONTROLLER ), UNO_QUERY_THROW )
+ {
+ }
+
+ // form::XFormController
+ virtual Reference< XControl > SAL_CALL getCurrentControl( ) throw (RuntimeException);
+ virtual void SAL_CALL addActivateListener( const Reference< form::XFormControllerListener >& l ) throw (RuntimeException);
+ virtual void SAL_CALL removeActivateListener( const Reference< form::XFormControllerListener >& l ) throw (RuntimeException);
+
+ // awt::XTabController
+ virtual void SAL_CALL setModel( const Reference< XTabControllerModel >& Model ) throw (RuntimeException);
+ virtual Reference< XTabControllerModel > SAL_CALL getModel( ) throw (RuntimeException);
+ virtual void SAL_CALL setContainer( const Reference< XControlContainer >& Container ) throw (RuntimeException);
+ virtual Reference< XControlContainer > SAL_CALL getContainer( ) throw (RuntimeException);
+ virtual Sequence< Reference< XControl > > SAL_CALL getControls( ) throw (RuntimeException);
+ virtual void SAL_CALL autoTabOrder( ) throw (RuntimeException);
+ virtual void SAL_CALL activateTabOrder( ) throw (RuntimeException);
+ virtual void SAL_CALL activateFirst( ) throw (RuntimeException);
+ virtual void SAL_CALL activateLast( ) throw (RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (RuntimeException);
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException);
+ virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException);
+
+ private:
+ const Reference< form::runtime::XFormController > m_xDelegator;
+ };
+
+ //--------------------------------------------------------------------
+ Reference< XControl > SAL_CALL LegacyFormController::getCurrentControl( ) throw (RuntimeException)
+ {
+ return m_xDelegator->getCurrentControl();
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL LegacyFormController::addActivateListener( const Reference< form::XFormControllerListener >& _listener ) throw (RuntimeException)
+ {
+ m_xDelegator->addActivateListener( _listener );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL LegacyFormController::removeActivateListener( const Reference< form::XFormControllerListener >& _listener ) throw (RuntimeException)
+ {
+ m_xDelegator->removeActivateListener( _listener );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL LegacyFormController::setModel( const Reference< XTabControllerModel >& _model ) throw (RuntimeException)
+ {
+ m_xDelegator->setModel( _model );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XTabControllerModel > SAL_CALL LegacyFormController::getModel( ) throw (RuntimeException)
+ {
+ return m_xDelegator->getModel();
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL LegacyFormController::setContainer( const Reference< XControlContainer >& _container ) throw (RuntimeException)
+ {
+ m_xDelegator->setContainer( _container );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XControlContainer > SAL_CALL LegacyFormController::getContainer( ) throw (RuntimeException)
+ {
+ return m_xDelegator->getContainer();
+ }
+
+ //--------------------------------------------------------------------
+ Sequence< Reference< XControl > > SAL_CALL LegacyFormController::getControls( ) throw (RuntimeException)
+ {
+ return m_xDelegator->getControls();
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL LegacyFormController::autoTabOrder( ) throw (RuntimeException)
+ {
+ m_xDelegator->autoTabOrder();
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL LegacyFormController::activateTabOrder( ) throw (RuntimeException)
+ {
+ m_xDelegator->activateTabOrder();
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL LegacyFormController::activateFirst( ) throw (RuntimeException)
+ {
+ m_xDelegator->activateFirst();
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL LegacyFormController::activateLast( ) throw (RuntimeException)
+ {
+ m_xDelegator->activateLast();
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL LegacyFormController::getImplementationName( ) throw (RuntimeException)
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.svx.LegacyFormController" ) );
+ }
+
+ //--------------------------------------------------------------------
+ ::sal_Bool SAL_CALL LegacyFormController::supportsService( const ::rtl::OUString& _serviceName ) throw (RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aServices( getSupportedServiceNames() );
+ const ::rtl::OUString* pServices = aServices.getConstArray();
+ for ( sal_Int32 i = 0; i < aServices.getLength(); ++i, ++pServices )
+ if( pServices->equals( _serviceName ) )
+ return sal_True;
+ return sal_False;
+ }
+
+ //--------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL LegacyFormController::getSupportedServiceNames( ) throw (RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aServices(2);
+ aServices.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.FormController" ) );
+ aServices.getArray()[1] = ::rtl::OUString::createFromAscii("com.sun.star.awt.control.TabController");
+ return aServices;
+ }
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
+//------------------------------------------------------------------
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ LegacyFormController_NewInstance_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & _rxORB )
+{
+ return ::svxform::LegacyFormController::Create( _rxORB );
+}
+
diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx
new file mode 100644
index 000000000000..362b4bba0faf
--- /dev/null
+++ b/svx/source/form/navigatortree.cxx
@@ -0,0 +1,2322 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/dialmgr.hxx>
+#include <svx/fmshell.hxx>
+#include <svx/fmmodel.hxx>
+#include <svx/fmpage.hxx>
+#include <svx/svdpagv.hxx>
+#include "svx/svditer.hxx"
+
+#include "fmhelp.hrc"
+#include "fmexpl.hrc"
+#include "fmexpl.hxx"
+#include "svx/fmresids.hrc"
+#include "fmshimp.hxx"
+#include "fmservs.hxx"
+#include "fmundo.hxx"
+#include "fmpgeimp.hxx"
+#include "fmitems.hxx"
+#include "fmobj.hxx"
+#include "fmprop.hrc"
+#include <vcl/wrkwin.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/property.hxx>
+#include <com/sun/star/form/FormComponentType.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/script/XEventAttacherManager.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
+#include <com/sun/star/datatransfer/XTransferable.hpp>
+#include <svx/sdrpaintwindow.hxx>
+
+#include <svx/svxdlg.hxx> //CHINA001
+#include <svx/dialogs.hrc> //CHINA001
+#include <rtl/logfile.hxx>
+//............................................................................
+namespace svxform
+{
+//............................................................................
+
+ #define DROP_ACTION_TIMER_INITIAL_TICKS 10
+ // solange dauert es, bis das Scrollen anspringt
+ #define DROP_ACTION_TIMER_SCROLL_TICKS 3
+ // in diesen Intervallen wird jeweils eine Zeile gescrollt
+ #define DROP_ACTION_TIMER_TICK_BASE 10
+ // das ist die Basis, mit der beide Angaben multipliziert werden (in ms)
+
+ #define EXPLORER_SYNC_DELAY 200
+ // dieser Betrag an Millisekunden wird gewartet, ehe der Explorer nach einem Select oder Deselect die ::com::sun::star::sdbcx::View synchronisiert
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::form;
+ using namespace ::com::sun::star::awt;
+ using namespace ::com::sun::star::container;
+ using namespace ::com::sun::star::script;
+ using namespace ::com::sun::star::datatransfer;
+ using namespace ::com::sun::star::datatransfer::clipboard;
+ using namespace ::com::sun::star::sdb;
+
+ //========================================================================
+ // helper
+ //========================================================================
+
+ typedef ::std::map< Reference< XInterface >, SdrObject*, ::comphelper::OInterfaceCompare< XInterface > >
+ MapModelToShape;
+ typedef MapModelToShape::value_type ModelShapePair;
+
+ //------------------------------------------------------------------------
+ void collectShapeModelMapping( SdrPage* _pPage, MapModelToShape& _rMapping )
+ {
+ OSL_ENSURE( _pPage, "collectShapeModelMapping: invalid arg!" );
+
+ _rMapping.clear();
+
+ SdrObjListIter aIter( *_pPage );
+ while ( aIter.IsMore() )
+ {
+ SdrObject* pSdrObject = aIter.Next();
+ FmFormObj* pFormObject = FmFormObj::GetFormObject( pSdrObject );
+ if ( !pFormObject )
+ continue;
+
+ Reference< XInterface > xNormalizedModel( pFormObject->GetUnoControlModel(), UNO_QUERY );
+ // note that this is normalized (i.e. queried for XInterface explicitly)
+
+#ifdef DBG_UTIL
+ ::std::pair< MapModelToShape::iterator, bool > aPos =
+#endif
+ _rMapping.insert( ModelShapePair( xNormalizedModel, pSdrObject ) );
+ DBG_ASSERT( aPos.second, "collectShapeModelMapping: model was already existent!" );
+ // if this asserts, this would mean we have 2 shapes pointing to the same model
+ }
+ }
+
+ //------------------------------------------------------------------------
+ sal_Bool isModelShapeMarked( FmEntryData* _pEntry, const MapModelToShape& _rModelMap, SdrMarkView* _pView )
+ {
+ DBG_ASSERT( _pEntry && _pView, "isModelShapeMarked: invalid arguments!" );
+ if ( !_pEntry || !_pView )
+ return sal_False;
+
+ DBG_ASSERT( _pEntry->GetElement().get() == Reference< XInterface >( _pEntry->GetElement(), UNO_QUERY ).get(),
+ "isModelShapeMarked: element of the FmEntryData is not normalized!" );
+ // normalization of the XInterface is a prerequisite for properly finding it in the map
+
+ sal_Bool bIsMarked = sal_False;
+
+ MapModelToShape::const_iterator aPos = _rModelMap.find( _pEntry->GetElement() );
+ if ( _rModelMap.end() != aPos )
+ { // there is a shape for this model ....
+ bIsMarked = _pView->IsObjMarked( aPos->second );
+ if ( !bIsMarked )
+ {
+ // IsObjMarked does not step down grouped objects, so the sal_False we
+ // have is not really reliable (while a sal_True would have been)
+ // Okay, travel the mark list, and see if there is a group marked, and our shape
+ // is a part of this group
+ sal_uInt32 nMarked = _pView->GetMarkedObjectList().GetMarkCount();
+ for ( sal_uInt32 i = 0; (i<nMarked ) && !bIsMarked; ++i )
+ {
+ SdrMark* pMark = _pView->GetMarkedObjectList().GetMark( i );
+ SdrObject* pObj = pMark ? pMark->GetMarkedSdrObj() : NULL;
+ if ( pObj && pObj->IsGroupObject() )
+ { // the i-th marked shape is a group shape
+ SdrObjListIter aIter( *pObj );
+ while ( aIter.IsMore() )
+ {
+ if ( aIter.Next() == aPos->second )
+ {
+ bIsMarked = sal_True;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return bIsMarked;
+ }
+
+ //========================================================================
+ // class NavigatorTree
+ //========================================================================
+
+ //------------------------------------------------------------------------
+ NavigatorTree::NavigatorTree( const Reference< XMultiServiceFactory >& _xORB,
+ Window* pParent )
+ :SvTreeListBox( pParent, WB_HASBUTTONS|WB_HASLINES|WB_BORDER|WB_HSCROLL ) // #100258# OJ WB_HSCROLL added
+ ,m_aControlExchange(this)
+ ,m_xORB(_xORB)
+ ,m_pNavModel( NULL )
+ ,m_pRootEntry(NULL)
+ ,m_pEditEntry(NULL)
+ ,nEditEvent(0)
+ ,m_sdiState(SDI_DIRTY)
+ ,m_aTimerTriggered(-1,-1)
+ ,m_aDropActionType( DA_SCROLLUP )
+ ,m_nSelectLock(0)
+ ,m_nFormsSelected(0)
+ ,m_nControlsSelected(0)
+ ,m_nHiddenControls(0)
+ ,m_aTimerCounter( DROP_ACTION_TIMER_INITIAL_TICKS )
+ ,m_bDragDataDirty(sal_False)
+ ,m_bPrevSelectionMixed(sal_False)
+ ,m_bMarkingObjects(sal_False)
+ ,m_bRootSelected(sal_False)
+ ,m_bInitialUpdate(sal_True)
+ ,m_bKeyboardCut( sal_False )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::NavigatorTree" );
+ SetHelpId( HID_FORM_NAVIGATOR );
+
+ m_aNavigatorImages = ImageList( SVX_RES( RID_SVXIMGLIST_FMEXPL ) );
+ m_aNavigatorImagesHC = ImageList( SVX_RES( RID_SVXIMGLIST_FMEXPL_HC ) );
+
+ SetNodeBitmaps(
+ m_aNavigatorImages.GetImage( RID_SVXIMG_COLLAPSEDNODE ),
+ m_aNavigatorImages.GetImage( RID_SVXIMG_EXPANDEDNODE ),
+ BMP_COLOR_NORMAL
+ );
+ SetNodeBitmaps(
+ m_aNavigatorImagesHC.GetImage( RID_SVXIMG_COLLAPSEDNODE ),
+ m_aNavigatorImagesHC.GetImage( RID_SVXIMG_EXPANDEDNODE ),
+ BMP_COLOR_HIGHCONTRAST
+ );
+
+ SetDragDropMode(0xFFFF);
+ EnableInplaceEditing( sal_True );
+ SetSelectionMode(MULTIPLE_SELECTION);
+
+ m_pNavModel = new NavigatorTreeModel( m_aNavigatorImages, m_aNavigatorImagesHC );
+ Clear();
+
+ StartListening( *m_pNavModel );
+
+ m_aDropActionTimer.SetTimeoutHdl(LINK(this, NavigatorTree, OnDropActionTimer));
+
+ m_aSynchronizeTimer.SetTimeoutHdl(LINK(this, NavigatorTree, OnSynchronizeTimer));
+ SetSelectHdl(LINK(this, NavigatorTree, OnEntrySelDesel));
+ SetDeselectHdl(LINK(this, NavigatorTree, OnEntrySelDesel));
+ }
+
+ //------------------------------------------------------------------------
+ NavigatorTree::~NavigatorTree()
+ {
+ if( nEditEvent )
+ Application::RemoveUserEvent( nEditEvent );
+
+ if (m_aSynchronizeTimer.IsActive())
+ m_aSynchronizeTimer.Stop();
+
+ DBG_ASSERT(GetNavModel() != NULL, "NavigatorTree::~NavigatorTree : unerwartet : kein ExplorerModel");
+ EndListening( *m_pNavModel );
+ Clear();
+ delete m_pNavModel;
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTree::Clear()
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::Clear" );
+ m_pNavModel->Clear();
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTree::UpdateContent( FmFormShell* pFormShell )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::UpdateContent" );
+ if (m_bInitialUpdate)
+ {
+ GrabFocus();
+ m_bInitialUpdate = sal_False;
+ }
+
+ FmFormShell* pOldShell = GetNavModel()->GetFormShell();
+ FmFormPage* pOldPage = GetNavModel()->GetFormPage();
+ FmFormPage* pNewPage = pFormShell ? pFormShell->GetCurPage() : NULL;
+
+ if ((pOldShell != pFormShell) || (pOldPage != pNewPage))
+ {
+ // neue Shell, waehrend ich gerade editiere ?
+ if (IsEditingActive())
+ CancelTextEditing();
+
+ m_bDragDataDirty = sal_True; // sicherheitshalber, auch wenn ich gar nicht dragge
+ }
+ GetNavModel()->UpdateContent( pFormShell );
+
+ // wenn es eine Form gibt, die Root expandieren
+ if (m_pRootEntry && !IsExpanded(m_pRootEntry))
+ Expand(m_pRootEntry);
+ // wenn es GENAU eine Form gibt, auch diese expandieren
+ if (m_pRootEntry)
+ {
+ SvLBoxEntry* pFirst = FirstChild(m_pRootEntry);
+ if (pFirst && !NextSibling(pFirst))
+ Expand(pFirst);
+ }
+ }
+
+ //------------------------------------------------------------------------------
+ sal_Bool NavigatorTree::implAllowExchange( sal_Int8 _nAction, sal_Bool* _pHasNonHidden )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::implAllowExchange" );
+ SvLBoxEntry* pCurEntry = GetCurEntry();
+ if (!pCurEntry)
+ return sal_False;
+
+ // die Informationen fuer das AcceptDrop und ExecuteDrop
+ CollectSelectionData(SDI_ALL);
+ if (!m_arrCurrentSelection.Count())
+ // nothing to do
+ return sal_False;
+
+ // testen, ob es sich vielleicht ausschliesslich um hidden controls handelt (dann koennte ich pCtrlExch noch ein
+ // zusaetzliches Format geben)
+ sal_Bool bHasNonHidden = sal_False;
+ for (sal_Int32 i=0; i<m_arrCurrentSelection.Count(); i++)
+ {
+ FmEntryData* pCurrent = static_cast< FmEntryData* >( m_arrCurrentSelection[(sal_uInt16)i]->GetUserData() );
+ if ( IsHiddenControl( pCurrent ) )
+ continue;
+ bHasNonHidden = sal_True;
+ break;
+ }
+
+ if ( bHasNonHidden && ( 0 == ( _nAction & DND_ACTION_MOVE ) ) )
+ // non-hidden controls need to be moved
+ return sal_False;
+
+ if ( _pHasNonHidden )
+ *_pHasNonHidden = bHasNonHidden;
+
+ return sal_True;
+ }
+
+ //------------------------------------------------------------------------------
+ sal_Bool NavigatorTree::implPrepareExchange( sal_Int8 _nAction )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::implPrepareExchange" );
+ sal_Int32 i;
+
+ EndSelection();
+
+ sal_Bool bHasNonHidden = sal_False;
+ if ( !implAllowExchange( _nAction, &bHasNonHidden ) )
+ return sal_False;
+
+ m_aControlExchange.prepareDrag();
+ m_aControlExchange->setFocusEntry( GetCurEntry() );
+
+ for ( i = 0; i < m_arrCurrentSelection.Count(); ++i )
+ m_aControlExchange->addSelectedEntry(m_arrCurrentSelection[(sal_uInt16)i]);
+
+ m_aControlExchange->setFormsRoot( GetNavModel()->GetFormPage()->GetForms() );
+ m_aControlExchange->buildPathFormat( this, m_pRootEntry );
+
+ if (!bHasNonHidden)
+ {
+ // eine entsprechende Sequenz aufbauen
+ Sequence< Reference< XInterface > > seqIFaces(m_arrCurrentSelection.Count());
+ Reference< XInterface >* pArray = seqIFaces.getArray();
+ for (i=0; i<m_arrCurrentSelection.Count(); ++i, ++pArray)
+ *pArray = static_cast< FmEntryData* >( m_arrCurrentSelection[(sal_uInt16)i]->GetUserData() )->GetElement();
+
+ // und das neue Format
+ m_aControlExchange->addHiddenControlsFormat(seqIFaces);
+ }
+
+ m_bDragDataDirty = sal_False;
+ return sal_True;
+ }
+
+ //------------------------------------------------------------------------------
+ void NavigatorTree::StartDrag( sal_Int8 /*nAction*/, const ::Point& /*rPosPixel*/ )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::StartDrag" );
+ EndSelection();
+
+ if ( !implPrepareExchange( DND_ACTION_COPYMOVE ) )
+ // nothing to do or something went wrong
+ return;
+
+ // jetzt haben wir alle in der aktuelle Situation moeglichen Formate eingesammelt, es kann also losgehen ...
+ m_aControlExchange.startDrag( DND_ACTION_COPYMOVE );
+ }
+
+ //------------------------------------------------------------------------------
+ void NavigatorTree::Command( const CommandEvent& rEvt )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::Command" );
+ sal_Bool bHandled = sal_False;
+ switch( rEvt.GetCommand() )
+ {
+ case COMMAND_CONTEXTMENU:
+ {
+ // die Stelle, an der geklickt wurde
+ ::Point ptWhere;
+ if (rEvt.IsMouseEvent())
+ {
+ ptWhere = rEvt.GetMousePosPixel();
+ SvLBoxEntry* ptClickedOn = GetEntry(ptWhere);
+ if (ptClickedOn == NULL)
+ break;
+ if ( !IsSelected(ptClickedOn) )
+ {
+ SelectAll(sal_False);
+ Select(ptClickedOn, sal_True);
+ SetCurEntry(ptClickedOn);
+ }
+ }
+ else
+ {
+ if (m_arrCurrentSelection.Count() == 0) // kann nur bei Kontextmenue ueber Tastatur passieren
+ break;
+
+ SvLBoxEntry* pCurrent = GetCurEntry();
+ if (!pCurrent)
+ break;
+ ptWhere = GetEntryPosition(pCurrent);
+ }
+
+ // meine Selektionsdaten auf den aktuellen Stand
+ CollectSelectionData(SDI_ALL);
+
+ // wenn mindestens ein Nicht-Root-Eintrag selektiert ist und die Root auch, dann nehme ich letztere aus der Selektion
+ // fix wieder raus
+ if ( (m_arrCurrentSelection.Count() > 1) && m_bRootSelected )
+ {
+ Select( m_pRootEntry, sal_False );
+ SetCursor( m_arrCurrentSelection.GetObject(0), sal_True);
+ }
+ sal_Bool bSingleSelection = (m_arrCurrentSelection.Count() == 1);
+
+
+ DBG_ASSERT( (m_arrCurrentSelection.Count() > 0) || m_bRootSelected, "keine Eintraege selektiert" );
+ // solte nicht passieren, da ich oben bei der IsSelected-Abfrage auf jeden Fall einen selektiert haette,
+ // wenn das vorher nicht der Fall gewesen waere
+
+
+ // das Menue zusammenbasteln
+ FmFormShell* pFormShell = GetNavModel()->GetFormShell();
+ FmFormModel* pFormModel = pFormShell ? pFormShell->GetFormModel() : NULL;
+ if( pFormShell && pFormModel )
+ {
+ PopupMenu aContextMenu(SVX_RES(RID_FMEXPLORER_POPUPMENU));
+ PopupMenu* pSubMenuNew = aContextMenu.GetPopupMenu( SID_FM_NEW );
+
+ // das 'Neu'-Untermenue gibt es nur, wenn genau die Root oder genau ein Formular selektiert sind
+ aContextMenu.EnableItem( SID_FM_NEW, bSingleSelection && (m_nFormsSelected || m_bRootSelected) );
+
+ // 'Neu'\'Formular' unter genau den selben Bedingungen
+ pSubMenuNew->EnableItem( SID_FM_NEW_FORM, bSingleSelection && (m_nFormsSelected || m_bRootSelected) );
+ pSubMenuNew->SetItemImage(SID_FM_NEW_FORM, m_aNavigatorImages.GetImage(RID_SVXIMG_FORM));
+ pSubMenuNew->SetItemImage(SID_FM_NEW_HIDDEN, m_aNavigatorImages.GetImage(RID_SVXIMG_HIDDEN));
+
+ // 'Neu'\'verstecktes...', wenn genau ein Formular selektiert ist
+ pSubMenuNew->EnableItem( SID_FM_NEW_HIDDEN, bSingleSelection && m_nFormsSelected );
+
+ // 'Delete': everything which is not root can be removed
+ aContextMenu.EnableItem( SID_FM_DELETE, !m_bRootSelected );
+
+ // 'Cut', 'Copy' and 'Paste'
+ aContextMenu.EnableItem( SID_CUT, !m_bRootSelected && implAllowExchange( DND_ACTION_MOVE ) );
+ aContextMenu.EnableItem( SID_COPY, !m_bRootSelected && implAllowExchange( DND_ACTION_COPY ) );
+ aContextMenu.EnableItem( SID_PASTE, implAcceptPaste( ) );
+
+ // der TabDialog, wenn es genau ein Formular ist ...
+ aContextMenu.EnableItem( SID_FM_TAB_DIALOG, bSingleSelection && m_nFormsSelected );
+
+ // in XML forms, we don't allow for the properties of a form
+ // #i36484# / 2004-11-04 /- fs@openoffice.org
+ if ( pFormShell->GetImpl()->isEnhancedForm() && !m_nControlsSelected )
+ aContextMenu.RemoveItem( aContextMenu.GetItemPos( SID_FM_SHOW_PROPERTY_BROWSER ) );
+
+ // if the property browser is already open, we don't allow for the properties, too
+ if( pFormShell->GetImpl()->IsPropBrwOpen() )
+ aContextMenu.RemoveItem( aContextMenu.GetItemPos( SID_FM_SHOW_PROPERTY_BROWSER ) );
+ // and finally, if there's a mixed selection of forms and controls, disable the entry, too
+ else
+ aContextMenu.EnableItem( SID_FM_SHOW_PROPERTY_BROWSER,
+ (m_nControlsSelected && !m_nFormsSelected) || (!m_nControlsSelected && m_nFormsSelected) );
+
+ // Umbenennen gdw wenn ein Element und nicht die Root
+ aContextMenu.EnableItem( SID_FM_RENAME_OBJECT, bSingleSelection && !m_bRootSelected );
+
+ // der Reandonly-Eintrag ist nur auf der Root erlaubt
+ aContextMenu.EnableItem( SID_FM_OPEN_READONLY, m_bRootSelected );
+ // the same for automatic control focus
+ aContextMenu.EnableItem( SID_FM_AUTOCONTROLFOCUS, m_bRootSelected );
+
+ // die ConvertTo-Slots sind enabled, wenn genau ein Control selektiert ist, der
+ // dem Control entsprechende Slot ist disabled
+ if (!m_bRootSelected && !m_nFormsSelected && (m_nControlsSelected == 1))
+ {
+ aContextMenu.SetPopupMenu( SID_FM_CHANGECONTROLTYPE, FmXFormShell::GetConversionMenu() );
+#if OSL_DEBUG_LEVEL > 0
+ FmControlData* pCurrent = (FmControlData*)(m_arrCurrentSelection[0]->GetUserData());
+ OSL_ENSURE( pFormShell->GetImpl()->isSolelySelected( pCurrent->GetFormComponent() ),
+ "NavigatorTree::Command: inconsistency between the navigator selection, and the selection as the shell knows it!" );
+#endif
+
+ pFormShell->GetImpl()->checkControlConversionSlotsForCurrentSelection( *aContextMenu.GetPopupMenu( SID_FM_CHANGECONTROLTYPE ) );
+ }
+ else
+ aContextMenu.EnableItem( SID_FM_CHANGECONTROLTYPE, sal_False );
+
+ // jetzt alles, was disabled wurde, wech
+ aContextMenu.RemoveDisabledEntries(sal_True, sal_True);
+ //////////////////////////////////////////////////////////
+ // OpenReadOnly setzen
+
+ aContextMenu.CheckItem( SID_FM_OPEN_READONLY, pFormModel->GetOpenInDesignMode() );
+ aContextMenu.CheckItem( SID_FM_AUTOCONTROLFOCUS, pFormModel->GetAutoControlFocus() );
+
+ sal_uInt16 nSlotId = aContextMenu.Execute( this, ptWhere );
+ switch( nSlotId )
+ {
+ case SID_FM_NEW_FORM:
+ {
+ XubString aStr(SVX_RES(RID_STR_FORM));
+ XubString aUndoStr(SVX_RES(RID_STR_UNDO_CONTAINER_INSERT));
+ aUndoStr.SearchAndReplace('#', aStr);
+
+ pFormModel->BegUndo(aUndoStr);
+ // der Slot war nur verfuegbar, wenn es genau einen selektierten Eintrag gibt und dieser die Root
+ // oder ein Formular ist
+ NewForm( m_arrCurrentSelection.GetObject(0) );
+ pFormModel->EndUndo();
+
+ } break;
+ case SID_FM_NEW_HIDDEN:
+ {
+ XubString aStr(SVX_RES(RID_STR_CONTROL));
+ XubString aUndoStr(SVX_RES(RID_STR_UNDO_CONTAINER_INSERT));
+ aUndoStr.SearchAndReplace('#', aStr);
+
+ pFormModel->BegUndo(aUndoStr);
+ // dieser Slot war guletig bei (genau) einem selektierten Formular
+ rtl::OUString fControlName = FM_COMPONENT_HIDDEN;
+ NewControl( fControlName, m_arrCurrentSelection.GetObject(0) );
+ pFormModel->EndUndo();
+
+ } break;
+
+ case SID_CUT:
+ doCut();
+ break;
+
+ case SID_COPY:
+ doCopy();
+ break;
+
+ case SID_PASTE:
+ doPaste();
+ break;
+
+ case SID_FM_DELETE:
+ {
+ DeleteSelection();
+ }
+ break;
+ case SID_FM_TAB_DIALOG:
+ {
+ // dieser Slot galt bei genau einem selektierten Formular
+ SvLBoxEntry* pSelectedForm = m_arrCurrentSelection.GetObject(0);
+ DBG_ASSERT( IsFormEntry(pSelectedForm), "NavigatorTree::Command: Dieser Eintrag muss ein FormEntry sein." );
+
+ FmFormData* pFormData = (FmFormData*)pSelectedForm->GetUserData();
+ Reference< XForm > xForm( pFormData->GetFormIface());
+
+ Reference< XTabControllerModel > xTabController(xForm, UNO_QUERY);
+ if( !xTabController.is() )
+ break;
+ GetNavModel()->GetFormShell()->GetImpl()->ExecuteTabOrderDialog( xTabController );
+ }
+ break;
+
+ case SID_FM_SHOW_PROPERTY_BROWSER:
+ {
+ ShowSelectionProperties(sal_True);
+ }
+ break;
+ case SID_FM_RENAME_OBJECT:
+ {
+ // das war bei genau einem Nicht-Root-Eintrag erlaubt
+ EditEntry( m_arrCurrentSelection.GetObject(0) );
+ }
+ break;
+ case SID_FM_OPEN_READONLY:
+ {
+ pFormModel->SetOpenInDesignMode( !pFormModel->GetOpenInDesignMode() );
+ pFormShell->GetViewShell()->GetViewFrame()->GetBindings().Invalidate(SID_FM_OPEN_READONLY);
+ }
+ break;
+ case SID_FM_AUTOCONTROLFOCUS:
+ {
+ pFormModel->SetAutoControlFocus( !pFormModel->GetAutoControlFocus() );
+ pFormShell->GetViewShell()->GetViewFrame()->GetBindings().Invalidate(SID_FM_AUTOCONTROLFOCUS);
+ }
+ break;
+ default:
+ if (pFormShell->GetImpl()->isControlConversionSlot(nSlotId))
+ {
+ FmControlData* pCurrent = (FmControlData*)(m_arrCurrentSelection[0]->GetUserData());
+ if ( pFormShell->GetImpl()->executeControlConversionSlot( pCurrent->GetFormComponent(), nSlotId ) )
+ ShowSelectionProperties();
+ }
+ }
+ }
+ bHandled = sal_True;
+ } break;
+ }
+
+ if (!bHandled)
+ SvTreeListBox::Command( rEvt );
+ }
+
+ //------------------------------------------------------------------------
+ sal_Bool NavigatorTree::IsDeleteAllowed()
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::IsDeleteAllowed" );
+ //////////////////////////////////////////////////////////////////////
+ // Haben wir eine Form...
+ SvLBoxEntry* pCurEntry = GetCurEntry();
+ sal_uInt32 nCurEntryPos = GetModel()->GetAbsPos( pCurEntry );
+
+ if( nCurEntryPos==0 ) // Root kann nicht geloescht werden
+ return sal_False;
+ else
+ return IsFormEntry(pCurEntry) || IsFormComponentEntry(pCurEntry);
+ }
+
+ //------------------------------------------------------------------------
+ SvLBoxEntry* NavigatorTree::FindEntry( FmEntryData* pEntryData )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::FindEntry" );
+ if( !pEntryData ) return NULL;
+ SvLBoxEntry* pCurEntry = First();
+ FmEntryData* pCurEntryData;
+ while( pCurEntry )
+ {
+ pCurEntryData = (FmEntryData*)pCurEntry->GetUserData();
+ if( pCurEntryData && pCurEntryData->IsEqualWithoutChilds(pEntryData) )
+ return pCurEntry;
+
+ pCurEntry = Next( pCurEntry );
+ }
+
+ return NULL;
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTree::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::Notify" );
+ if( rHint.ISA(FmNavRemovedHint) )
+ {
+ FmNavRemovedHint* pRemovedHint = (FmNavRemovedHint*)&rHint;
+ FmEntryData* pEntryData = pRemovedHint->GetEntryData();
+ Remove( pEntryData );
+ }
+
+ else if( rHint.ISA(FmNavInsertedHint) )
+ {
+ FmNavInsertedHint* pInsertedHint = (FmNavInsertedHint*)&rHint;
+ FmEntryData* pEntryData = pInsertedHint->GetEntryData();
+ sal_uInt32 nRelPos = pInsertedHint->GetRelPos();
+ Insert( pEntryData, nRelPos );
+ }
+
+ else if( rHint.ISA(FmNavModelReplacedHint) )
+ {
+ FmEntryData* pData = ((FmNavModelReplacedHint*)&rHint)->GetEntryData();
+ SvLBoxEntry* pEntry = FindEntry( pData );
+ if (pEntry)
+ { // das Image neu setzen
+ SetCollapsedEntryBmp( pEntry, pData->GetNormalImage(), BMP_COLOR_NORMAL );
+ SetExpandedEntryBmp( pEntry, pData->GetNormalImage(), BMP_COLOR_NORMAL );
+
+ SetCollapsedEntryBmp( pEntry, pData->GetHCImage(), BMP_COLOR_HIGHCONTRAST );
+ SetExpandedEntryBmp( pEntry, pData->GetHCImage(), BMP_COLOR_HIGHCONTRAST );
+ }
+ }
+
+ else if( rHint.ISA(FmNavNameChangedHint) )
+ {
+ FmNavNameChangedHint* pNameChangedHint = (FmNavNameChangedHint*)&rHint;
+ SvLBoxEntry* pEntry = FindEntry( pNameChangedHint->GetEntryData() );
+ SetEntryText( pEntry, pNameChangedHint->GetNewName() );
+ }
+
+ else if( rHint.ISA(FmNavClearedHint) )
+ {
+ SvTreeListBox::Clear();
+
+ //////////////////////////////////////////////////////////////////////
+ // Default-Eintrag "Formulare"
+ Image aRootImage( m_aNavigatorImages.GetImage( RID_SVXIMG_FORMS ) );
+ m_pRootEntry = InsertEntry( SVX_RES(RID_STR_FORMS), aRootImage, aRootImage,
+ NULL, sal_False, 0, NULL );
+
+ if ( m_pRootEntry )
+ {
+ Image aHCRootImage( m_aNavigatorImagesHC.GetImage( RID_SVXIMG_FORMS ) );
+ SetExpandedEntryBmp( m_pRootEntry, aHCRootImage, BMP_COLOR_HIGHCONTRAST );
+ SetCollapsedEntryBmp( m_pRootEntry, aHCRootImage, BMP_COLOR_HIGHCONTRAST );
+ }
+ }
+ else if (!m_bMarkingObjects && rHint.ISA(FmNavRequestSelectHint))
+ { // wenn m_bMarkingObjects sal_True ist, markiere ich gerade selber Objekte, und da der ganze Mechanismus dahinter synchron ist,
+ // ist das genau der Hint, der durch mein Markieren ausgeloest wird, also kann ich ihn ignorieren
+ FmNavRequestSelectHint* pershHint = (FmNavRequestSelectHint*)&rHint;
+ FmEntryDataArray& arredToSelect = pershHint->GetItems();
+ SynchronizeSelection(arredToSelect);
+
+ if (pershHint->IsMixedSelection())
+ // in diesem Fall habe ich alles deselektiert, obwohl die View u.U. eine gemischte Markierung hatte
+ // ich muss also im naechsten Select den Navigator an die View anpassen
+ m_bPrevSelectionMixed = sal_True;
+ }
+ }
+
+ //------------------------------------------------------------------------
+ SvLBoxEntry* NavigatorTree::Insert( FmEntryData* pEntryData, sal_uIntPtr nRelPos )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::Insert" );
+ //////////////////////////////////////////////////////////////////////
+ // Aktuellen Eintrag einfuegen
+ SvLBoxEntry* pParentEntry = FindEntry( pEntryData->GetParent() );
+ SvLBoxEntry* pNewEntry;
+
+ if( !pParentEntry )
+ pNewEntry = InsertEntry( pEntryData->GetText(),
+ pEntryData->GetNormalImage(), pEntryData->GetNormalImage(),
+ m_pRootEntry, sal_False, nRelPos, pEntryData );
+
+ else
+ pNewEntry = InsertEntry( pEntryData->GetText(),
+ pEntryData->GetNormalImage(), pEntryData->GetNormalImage(),
+ pParentEntry, sal_False, nRelPos, pEntryData );
+
+ if ( pNewEntry )
+ {
+ SetExpandedEntryBmp( pNewEntry, pEntryData->GetHCImage(), BMP_COLOR_HIGHCONTRAST );
+ SetCollapsedEntryBmp( pNewEntry, pEntryData->GetHCImage(), BMP_COLOR_HIGHCONTRAST );
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // Wenn Root-Eintrag Root expandieren
+ if( !pParentEntry )
+ Expand( m_pRootEntry );
+
+ //////////////////////////////////////////////////////////////////////
+ // Childs einfuegen
+ FmEntryDataList* pChildList = pEntryData->GetChildList();
+ sal_uInt32 nChildCount = pChildList->Count();
+ FmEntryData* pChildData;
+ for( sal_uInt32 i=0; i<nChildCount; i++ )
+ {
+ pChildData = pChildList->GetObject(i);
+ Insert( pChildData, LIST_APPEND );
+ }
+
+ return pNewEntry;
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTree::Remove( FmEntryData* pEntryData )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::Remove" );
+ if( !pEntryData )
+ return;
+
+ // der Entry zu den Daten
+ SvLBoxEntry* pEntry = FindEntry( pEntryData );
+ if (!pEntry)
+ return;
+
+ // Eintrag aus TreeListBox entfernen
+ // ich darf das Select, das ich ausloese, nicht behandeln :
+ // Select aendert die MarkList der View, wenn das gerade auch jemand anders macht und dabei ein Remove
+ // triggert, haben wir mit ziemlicher Sicherheit ein Problem - Paradebeispiel war das Gruppieren von Controls mit
+ // offenem Navigator ...)
+ LockSelectionHandling();
+
+ // ein kleines Problem : ich merke mir meine selektierten Daten, wenn mir jetzt jemand einen selektierten Eintrag
+ // unter dem Hintern wegschiesst, werde ich inkonsistent ... was schlecht waere
+ Select(pEntry, sal_False);
+
+ // beim eigentlichen Entfernen kann die Selection geaendert werden, da ich aber das SelectionHandling abgeschaltet
+ // habe, muss ich mich hinterher darum kuemmern
+ sal_uIntPtr nExpectedSelectionCount = GetSelectionCount();
+
+ if( pEntry )
+ GetModel()->Remove( pEntry );
+
+ if (nExpectedSelectionCount != GetSelectionCount())
+ SynchronizeSelection();
+
+ // und standardmaessig behandle ich das Select natuerlich
+ UnlockSelectionHandling();
+ }
+
+ //------------------------------------------------------------------------
+ sal_Bool NavigatorTree::IsFormEntry( SvLBoxEntry* pEntry )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::IsFormEntry" );
+ FmEntryData* pEntryData = (FmEntryData*)pEntry->GetUserData();
+ return !pEntryData || pEntryData->ISA(FmFormData);
+ }
+
+ //------------------------------------------------------------------------
+ sal_Bool NavigatorTree::IsFormComponentEntry( SvLBoxEntry* pEntry )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::IsFormComponentEntry" );
+ FmEntryData* pEntryData = (FmEntryData*)pEntry->GetUserData();
+ return pEntryData && pEntryData->ISA(FmControlData);
+ }
+
+ //------------------------------------------------------------------------
+ sal_Bool NavigatorTree::implAcceptPaste( )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::implAcceptPaste" );
+ SvLBoxEntry* pFirstSelected = FirstSelected();
+ if ( !pFirstSelected || NextSelected( pFirstSelected ) )
+ // no selected entry, or at least two selected entries
+ return sal_False;
+
+ // get the clipboard
+ TransferableDataHelper aClipboardContent( TransferableDataHelper::CreateFromSystemClipboard( this ) );
+
+ sal_Int8 nAction = m_aControlExchange.isClipboardOwner() && doingKeyboardCut( ) ? DND_ACTION_MOVE : DND_ACTION_COPY;
+ return ( nAction == implAcceptDataTransfer( aClipboardContent.GetDataFlavorExVector(), nAction, pFirstSelected, sal_False ) );
+ }
+
+ //------------------------------------------------------------------------
+ sal_Int8 NavigatorTree::implAcceptDataTransfer( const DataFlavorExVector& _rFlavors, sal_Int8 _nAction, const ::Point& _rDropPos, sal_Bool _bDnD )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::implAcceptDataTransfer" );
+ return implAcceptDataTransfer( _rFlavors, _nAction, GetEntry( _rDropPos ), _bDnD );
+ }
+
+ //------------------------------------------------------------------------
+ sal_Int8 NavigatorTree::implAcceptDataTransfer( const DataFlavorExVector& _rFlavors, sal_Int8 _nAction, SvLBoxEntry* _pTargetEntry, sal_Bool _bDnD )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::implAcceptDataTransfer" );
+ // no target -> no drop
+ if (!_pTargetEntry)
+ return DND_ACTION_NONE;
+
+ // format check
+ sal_Bool bHasDefControlFormat = OControlExchange::hasFieldExchangeFormat( _rFlavors );
+ sal_Bool bHasControlPathFormat = OControlExchange::hasControlPathFormat( _rFlavors );
+ sal_Bool bHasHiddenControlsFormat = OControlExchange::hasHiddenControlModelsFormat( _rFlavors );
+ if (!bHasDefControlFormat && !bHasControlPathFormat && !bHasHiddenControlsFormat)
+ return DND_ACTION_NONE;
+
+ sal_Bool bSelfSource = _bDnD ? m_aControlExchange.isDragSource() : m_aControlExchange.isClipboardOwner();
+
+ if ( bHasHiddenControlsFormat )
+ { // bHasHiddenControlsFormat means that only hidden controls are part of the data
+
+ // hidden controls can be copied to a form only
+ if ( !_pTargetEntry || ( _pTargetEntry == m_pRootEntry ) || !IsFormEntry( _pTargetEntry ) )
+ return DND_ACTION_NONE;
+
+ return bSelfSource ? ( DND_ACTION_COPYMOVE & _nAction ) : DND_ACTION_COPY;
+ }
+
+ if ( !bSelfSource )
+ {
+ // DnD or CnP crossing navigator boundaries
+ // The main problem here is that the current API does not allow us to sneak into the content which
+ // is to be inserted. So we have to allow it for the moment, but maybe reject later on (in the real drop).
+
+ // TODO: this smart behaviour later on ... at the moment, we disallow data transfer crossing navigator
+ // boundaries.
+
+ return DND_ACTION_NONE;
+ }
+
+ DBG_ASSERT( _bDnD ? m_aControlExchange.isDragSource() : m_aControlExchange.isClipboardOwner(),
+ "NavigatorTree::implAcceptDataTransfer: here only with source=dest!" );
+ // somebody changed the logic of this method ...
+
+ // from here on, I can work with m_aControlExchange instead of _rData!
+
+ sal_Bool bForeignCollection = m_aControlExchange->getFormsRoot().get() != GetNavModel()->GetFormPage()->GetForms().get();
+ if ( bForeignCollection )
+ {
+ // crossing shell/page boundaries, we can exchange hidden controls only
+ // But if we survived the checks above, we do not have hidden controls.
+ // -> no data transfer
+ DBG_ASSERT( !bHasHiddenControlsFormat, "NavigatorTree::implAcceptDataTransfer: still hidden controls format!" );
+ // somebody changed the logic of this method ...
+
+ return DND_ACTION_COPY;
+ }
+
+ if (DND_ACTION_MOVE != _nAction) // 'normal' controls within a shell are moved only (never copied)
+ return DND_ACTION_NONE;
+
+ if ( m_bDragDataDirty || !bHasDefControlFormat )
+ {
+ if (!bHasControlPathFormat)
+ // ich befinde mich zwar in der Shell/Page, aus der die Controls stammen, habe aber kein Format, das den stattgefundenen
+ // Shell-Wechsel ueberlebt hat (SVX_FM_CONTROLS_AS_PATH)
+ return DND_ACTION_NONE;
+
+ // da die Shell waehrend des Draggens umgeschaltet wude, muss ich die Liste des ExchangeObjektes wieder neu aufbauen
+ // (dort stehen SvLBoxEntries drin, und die sind bei der Umschaltung floeten gegangen)
+ m_aControlExchange->buildListFromPath(this, m_pRootEntry);
+ m_bDragDataDirty = sal_False;
+ }
+
+ // die Liste der gedroppten Eintraege aus dem DragServer
+ const ListBoxEntrySet& aDropped = m_aControlExchange->selected();
+ DBG_ASSERT(aDropped.size() >= 1, "NavigatorTree::implAcceptDataTransfer: keine Eintraege !");
+
+ sal_Bool bDropTargetIsComponent = IsFormComponentEntry( _pTargetEntry );
+ //SvLBoxEntry* pDropTargetParent = GetParent( _pTargetEntry );
+
+ // conditions to disallow the drop
+ // 0) the root entry is part of the list (can't DnD the root!)
+ // 1) one of the draged entries is to be dropped onto it's own parent
+ // 2) - " - is to be dropped onto itself
+ // 3) - " - is a Form and to be dropped onto one of it's descendants
+ // 4) one of the entries is a control and to be dropped onto the root
+ // 5) a control or form will be dropped onto a control which is _not_ a sibling (dropping onto a sibling
+ // means moving the control)
+
+ // collect the ancestors of the drop targte (speeds up 3)
+ SvLBoxEntrySortedArray arrDropAnchestors;
+ SvLBoxEntry* pLoop = _pTargetEntry;
+ while (pLoop)
+ {
+ arrDropAnchestors.Insert(pLoop);
+ pLoop = GetParent(pLoop);
+ }
+
+ for ( ListBoxEntrySet::const_iterator dropped = aDropped.begin();
+ dropped != aDropped.end();
+ ++dropped
+ )
+ {
+ SvLBoxEntry* pCurrent = *dropped;
+ SvLBoxEntry* pCurrentParent = GetParent(pCurrent);
+
+ // test for 0)
+ if (pCurrent == m_pRootEntry)
+ return DND_ACTION_NONE;
+
+ // test for 1)
+ if ( _pTargetEntry == pCurrentParent )
+ return DND_ACTION_NONE;
+
+ // test for 2)
+ if (pCurrent == _pTargetEntry)
+ return DND_ACTION_NONE;
+
+ // test for 5)
+ // if ( bDropTargetIsComponent && (pDropTargetParent != pCurrentParent) )
+ if ( bDropTargetIsComponent ) // TODO : die obige Zeile wieder rein, dann muss aber ExecuteDrop das Vertauschen auch beherrschen
+ return DND_ACTION_NONE;
+
+ // test for 3)
+ if ( IsFormEntry(pCurrent) )
+ {
+ sal_uInt16 nPosition;
+ if ( arrDropAnchestors.Seek_Entry(pCurrent, &nPosition) )
+ return DND_ACTION_NONE;
+ } else if ( IsFormComponentEntry(pCurrent) )
+ {
+ // test for 4)
+ if (_pTargetEntry == m_pRootEntry)
+ return DND_ACTION_NONE;
+ }
+ }
+
+ return DND_ACTION_MOVE;
+ }
+
+ //------------------------------------------------------------------------
+ sal_Int8 NavigatorTree::AcceptDrop( const AcceptDropEvent& rEvt )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::AcceptDrop" );
+ ::Point aDropPos = rEvt.maPosPixel;
+
+ // kuemmern wir uns erst mal um moeglich DropActions (Scrollen und Aufklappen)
+ if (rEvt.mbLeaving)
+ {
+ if (m_aDropActionTimer.IsActive())
+ m_aDropActionTimer.Stop();
+ } else
+ {
+ sal_Bool bNeedTrigger = sal_False;
+ // auf dem ersten Eintrag ?
+ if ((aDropPos.Y() >= 0) && (aDropPos.Y() < GetEntryHeight()))
+ {
+ m_aDropActionType = DA_SCROLLUP;
+ bNeedTrigger = sal_True;
+ } else
+ // auf dem letzten (bzw. in dem Bereich, den ein Eintrag einnehmen wuerde, wenn er unten genau buendig
+ // abschliessen wuerde) ?
+ if ((aDropPos.Y() < GetSizePixel().Height()) && (aDropPos.Y() >= GetSizePixel().Height() - GetEntryHeight()))
+ {
+ m_aDropActionType = DA_SCROLLDOWN;
+ bNeedTrigger = sal_True;
+ } else
+ { // auf einem Entry mit Childs, der nicht aufgeklappt ist ?
+ SvLBoxEntry* pDropppedOn = GetEntry(aDropPos);
+ if (pDropppedOn && (GetChildCount(pDropppedOn) > 0) && !IsExpanded(pDropppedOn))
+ {
+ // -> aufklappen
+ m_aDropActionType = DA_EXPANDNODE;
+ bNeedTrigger = sal_True;
+ }
+ }
+
+ if (bNeedTrigger && (m_aTimerTriggered != aDropPos))
+ {
+ // neu anfangen zu zaehlen
+ m_aTimerCounter = DROP_ACTION_TIMER_INITIAL_TICKS;
+ // die Pos merken, da ich auch AcceptDrops bekomme, wenn sich die Maus gar nicht bewegt hat
+ m_aTimerTriggered = aDropPos;
+ // und den Timer los
+ if (!m_aDropActionTimer.IsActive()) // gibt es den Timer schon ?
+ {
+ m_aDropActionTimer.SetTimeout(DROP_ACTION_TIMER_TICK_BASE);
+ m_aDropActionTimer.Start();
+ }
+ } else if (!bNeedTrigger)
+ m_aDropActionTimer.Stop();
+ }
+
+ return implAcceptDataTransfer( GetDataFlavorExVector(), rEvt.mnAction, aDropPos, sal_True );
+ }
+
+ //------------------------------------------------------------------------
+ sal_Int8 NavigatorTree::implExecuteDataTransfer( const OControlTransferData& _rData, sal_Int8 _nAction, const ::Point& _rDropPos, sal_Bool _bDnD )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::implExecuteDataTransfer" );
+ return implExecuteDataTransfer( _rData, _nAction, GetEntry( _rDropPos ), _bDnD );
+ }
+
+ //------------------------------------------------------------------------
+ sal_Int8 NavigatorTree::implExecuteDataTransfer( const OControlTransferData& _rData, sal_Int8 _nAction, SvLBoxEntry* _pTargetEntry, sal_Bool _bDnD )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::implExecuteDataTransfer" );
+ const DataFlavorExVector& rDataFlavors = _rData.GetDataFlavorExVector();
+
+ if ( DND_ACTION_NONE == implAcceptDataTransfer( rDataFlavors, _nAction, _pTargetEntry, _bDnD ) )
+ // under some platforms, it may happen that ExecuteDrop is called though AcceptDrop returned DND_ACTION_NONE
+ return DND_ACTION_NONE;
+
+ // ware schlecht, wenn nach dem Droppen noch gescrollt wird ...
+ if (m_aDropActionTimer.IsActive())
+ m_aDropActionTimer.Stop();
+
+ if (!_pTargetEntry)
+ // no target -> no drop
+ return DND_ACTION_NONE;
+
+ // format checks
+#ifdef DBG_UTIL
+ sal_Bool bHasHiddenControlsFormat = OControlExchange::hasHiddenControlModelsFormat( rDataFlavors );
+ sal_Bool bForeignCollection = _rData.getFormsRoot().get() != GetNavModel()->GetFormPage()->GetForms().get();
+ DBG_ASSERT(!bForeignCollection || bHasHiddenControlsFormat, "NavigatorTree::implExecuteDataTransfer: invalid format (AcceptDrop shouldn't have let this pass) !");
+ DBG_ASSERT(bForeignCollection || !m_bDragDataDirty, "NavigatorTree::implExecuteDataTransfer: invalid state (shell changed since last exchange resync) !");
+ // das sollte in AcceptDrop erledigt worden sein : dort wird in _rData die Liste der Controls aufgebaut und m_bDragDataDirty
+ // zurueckgesetzt
+#endif
+
+ if ( DND_ACTION_COPY == _nAction )
+ { // bHasHiddenControlsFormat means that only hidden controls are part of the data
+ DBG_ASSERT( bHasHiddenControlsFormat, "NavigatorTree::implExecuteDataTransfer: copy allowed for hidden controls only!" );
+ DBG_ASSERT( _pTargetEntry && ( _pTargetEntry != m_pRootEntry ) && IsFormEntry( _pTargetEntry ),
+ "NavigatorTree::implExecuteDataTransfer: should not be here!" );
+ // implAcceptDataTransfer should have caught both cases
+
+ DBG_ASSERT(bHasHiddenControlsFormat, "NavigatorTree::implExecuteDataTransfer: only copying of hidden controls is supported !");
+ // das sollte das AcceptDrop abgefangen haben
+
+ // da ich gleich die Zielobjekte alle selektieren will (und nur die)
+ SelectAll(sal_False);
+
+ Sequence< Reference< XInterface > > aControls = _rData.hiddenControls();
+ sal_Int32 nCount = aControls.getLength();
+ const Reference< XInterface >* pControls = aControls.getConstArray();
+
+ FmFormShell* pFormShell = GetNavModel()->GetFormShell();
+ FmFormModel* pFormModel = pFormShell ? pFormShell->GetFormModel() : NULL;
+
+ // innerhalb eines Undo ...
+ if (pFormModel)
+ {
+ XubString aStr(SVX_RES(RID_STR_CONTROL));
+ XubString aUndoStr(SVX_RES(RID_STR_UNDO_CONTAINER_INSERT));
+ aUndoStr.SearchAndReplace('#', aStr);
+ pFormModel->BegUndo(aUndoStr);
+ }
+
+ // die Conrtols kopieren
+ for (sal_Int32 i=0; i<nCount; ++i)
+ {
+ // neues Control anlegen
+ rtl::OUString fControlName = FM_COMPONENT_HIDDEN;
+ FmControlData* pNewControlData = NewControl( fControlName, _pTargetEntry, sal_False);
+ Reference< XPropertySet > xNewPropSet( pNewControlData->GetPropertySet() );
+
+ // und die Properties des alten in das neue kopieren
+ Reference< XPropertySet > xCurrent(pControls[i], UNO_QUERY);
+#if (OSL_DEBUG_LEVEL > 1) || defined DBG_UTIL
+ // nur mal eben sehen, ob das Ding tatsaechlich ein hidden control ist
+ sal_Int16 nClassId = ::comphelper::getINT16(xCurrent->getPropertyValue(FM_PROP_CLASSID));
+ OSL_ENSURE(nClassId == FormComponentType::HIDDENCONTROL, "NavigatorTree::implExecuteDataTransfer: invalid control in drop list !");
+ // wenn das SVX_FM_HIDDEN_CONTROLS-Format vorhanden ist, dann sollten wirklich nur hidden controls in der Sequenz
+ // stecken
+#endif // (OSL_DEBUG_LEVEL > 1) || DBG_UTIL
+ Reference< XPropertySetInfo > xPropInfo( xCurrent->getPropertySetInfo());
+ Sequence< Property> seqAllCurrentProps = xPropInfo->getProperties();
+ Property* pAllCurrentProps = seqAllCurrentProps.getArray();
+ for (sal_Int32 j=0; j<seqAllCurrentProps.getLength(); ++j)
+ {
+ ::rtl::OUString sCurrentProp = pAllCurrentProps[j].Name;
+ if (((pAllCurrentProps[j].Attributes & PropertyAttribute::READONLY) == 0) && (sCurrentProp != FM_PROP_NAME))
+ { // (read-only attribs werden natuerlich nicht gesetzt, dito der Name, den hat das NewControl schon eindeutig
+ // festgelegt)
+ xNewPropSet->setPropertyValue(sCurrentProp, xCurrent->getPropertyValue(sCurrentProp));
+ }
+ }
+
+ SvLBoxEntry* pToSelect = FindEntry(pNewControlData);
+ Select(pToSelect, sal_True);
+ if (i == 0)
+ SetCurEntry(pToSelect);
+ }
+
+ if (pFormModel)
+ pFormModel->EndUndo();
+
+ return _nAction;
+ }
+
+ if ( !OControlExchange::hasFieldExchangeFormat( _rData.GetDataFlavorExVector() ) )
+ {
+ // can't do anything without the internal format here ... usually happens when doing DnD or CnP
+ // over navigator boundaries
+ return DND_ACTION_NONE;
+ }
+
+ // some data for the target
+ sal_Bool bDropTargetIsForm = IsFormEntry(_pTargetEntry);
+ FmFormData* pTargetData = bDropTargetIsForm ? (FmFormData*)_pTargetEntry->GetUserData() : NULL;
+
+ DBG_ASSERT( DND_ACTION_COPY != _nAction, "NavigatorTree::implExecuteDataTransfer: somebody changed the logics!" );
+
+ // die Liste der gedraggten Eintraege
+ ListBoxEntrySet aDropped = _rData.selected();
+ DBG_ASSERT(aDropped.size() >= 1, "NavigatorTree::implExecuteDataTransfer: no entries!");
+
+ // die Shell und das Model
+ FmFormShell* pFormShell = GetNavModel()->GetFormShell();
+ FmFormModel* pFormModel = pFormShell ? pFormShell->GetFormModel() : NULL;
+ if (!pFormModel)
+ return DND_ACTION_NONE;
+
+ // fuer's Undo
+ const bool bUndo = pFormModel->IsUndoEnabled();
+
+ if( bUndo )
+ {
+ XubString strUndoDescription(SVX_RES(RID_STR_UNDO_CONTAINER_REPLACE));
+ pFormModel->BegUndo(strUndoDescription);
+ }
+
+ // ich nehme vor dem Einfuegen eines Eintrages seine Selection raus, damit die Markierung dabei nicht flackert
+ // -> das Handeln des Select locken
+ LockSelectionHandling();
+
+ // jetzt durch alle gedroppten Eintraege ...
+ for ( ListBoxEntrySet::const_iterator dropped = aDropped.begin();
+ dropped != aDropped.end();
+ ++dropped
+ )
+ {
+ // ein paar Daten zum aktuellen Element
+ SvLBoxEntry* pCurrent = *dropped;
+ DBG_ASSERT(pCurrent != NULL, "NavigatorTree::implExecuteDataTransfer: ungueltiger Eintrag");
+ DBG_ASSERT(GetParent(pCurrent) != NULL, "NavigatorTree::implExecuteDataTransfer: ungueltiger Eintrag");
+ // die Root darf nicht gedraggt werden
+
+ FmEntryData* pCurrentUserData = (FmEntryData*)pCurrent->GetUserData();
+
+ Reference< XChild > xCurrentChild(pCurrentUserData->GetChildIFace(), UNO_QUERY);
+ Reference< XIndexContainer > xContainer(xCurrentChild->getParent(), UNO_QUERY);
+
+ FmFormData* pCurrentParentUserData = (FmFormData*)pCurrentUserData->GetParent();
+ DBG_ASSERT(pCurrentParentUserData == NULL || pCurrentParentUserData->ISA(FmFormData), "NavigatorTree::implExecuteDataTransfer: ungueltiges Parent");
+
+ // beim Vater austragen
+ if (pCurrentParentUserData)
+ pCurrentParentUserData->GetChildList()->Remove(pCurrentUserData);
+ else
+ GetNavModel()->GetRootList()->Remove(pCurrentUserData);
+
+ // aus dem Container entfernen
+ sal_Int32 nIndex = getElementPos(Reference< XIndexAccess > (xContainer, UNO_QUERY), xCurrentChild);
+ GetNavModel()->m_pPropChangeList->Lock();
+ // die Undo-Action fuer das Rausnehmen
+ if ( bUndo && GetNavModel()->m_pPropChangeList->CanUndo())
+ {
+ pFormModel->AddUndo(new FmUndoContainerAction(*pFormModel, FmUndoContainerAction::Removed,
+ xContainer, xCurrentChild, nIndex));
+ }
+ else if( !GetNavModel()->m_pPropChangeList->CanUndo() )
+ {
+ FmUndoContainerAction::DisposeElement( xCurrentChild );
+ }
+
+ // Events mitkopieren
+ Reference< XEventAttacherManager > xManager(xContainer, UNO_QUERY);
+ Sequence< ScriptEventDescriptor > aEvts;
+
+ if (xManager.is() && nIndex >= 0)
+ aEvts = xManager->getScriptEvents(nIndex);
+ xContainer->removeByIndex(nIndex);
+
+ // die Selection raus
+ Select(pCurrent, sal_False);
+ // und weg
+ Remove(pCurrentUserData);
+
+ // die Stelle innerhalb des DropParents, an der ich die gedroppten Eintraege einfuegen muss
+ if (pTargetData)
+ xContainer = Reference< XIndexContainer > (pTargetData->GetElement(), UNO_QUERY);
+ else
+ xContainer = Reference< XIndexContainer > (GetNavModel()->GetForms(), UNO_QUERY);
+
+ // immer ganz hinten einfuegen
+ nIndex = xContainer->getCount();
+
+ // UndoAction fuer das Einfuegen
+ if ( bUndo && GetNavModel()->m_pPropChangeList->CanUndo())
+ pFormModel->AddUndo(new FmUndoContainerAction(*pFormModel, FmUndoContainerAction::Inserted,
+ xContainer, xCurrentChild, nIndex));
+
+ // einfuegen im neuen Container
+ if (pTargetData)
+ {
+ // es wird in eine Form eingefuegt, dann brauche ich eine FormComponent
+ xContainer->insertByIndex( nIndex,
+ makeAny( Reference< XFormComponent >( xCurrentChild, UNO_QUERY ) ) );
+ }
+ else
+ {
+ xContainer->insertByIndex( nIndex,
+ makeAny( Reference< XForm >( xCurrentChild, UNO_QUERY ) ) );
+ }
+
+ if (aEvts.getLength())
+ {
+ xManager = Reference< XEventAttacherManager > (xContainer, UNO_QUERY);
+ if (xManager.is())
+ xManager->registerScriptEvents(nIndex, aEvts);
+ }
+
+ GetNavModel()->m_pPropChangeList->UnLock();
+
+ // zuerst dem Eintrag das neue Parent
+ pCurrentUserData->SetParent(pTargetData);
+
+ // dann dem Parent das neue Child
+ if (pTargetData)
+ pTargetData->GetChildList()->Insert(pCurrentUserData, nIndex);
+ else
+ GetNavModel()->GetRootList()->Insert(pCurrentUserData, nIndex);
+
+ // dann bei mir selber bekanntgeben und neu selektieren
+ SvLBoxEntry* pNew = Insert( pCurrentUserData, nIndex );
+ if ( ( aDropped.begin() == dropped ) && pNew )
+ {
+ SvLBoxEntry* pParent = GetParent( pNew );
+ if ( pParent )
+ Expand( pParent );
+ }
+ }
+
+ UnlockSelectionHandling();
+
+ if( bUndo )
+ pFormModel->EndUndo();
+
+ // During the move, the markings of the underlying view did not change (because the view is not affected by the logical
+ // hierarchy of the form/control models. But my selection changed - which means I have to adjust it according to the
+ // view marks, again.
+ SynchronizeSelection();
+
+ // in addition, with the move of controls such things as "the current form" may have changed - force the shell
+ // to update itself accordingly
+ if( pFormShell && pFormShell->GetImpl() && pFormShell->GetFormView() )
+ pFormShell->GetImpl()->DetermineSelection( pFormShell->GetFormView()->GetMarkedObjectList() );
+
+ if ( m_aControlExchange.isClipboardOwner() && ( DND_ACTION_MOVE == _nAction ) )
+ m_aControlExchange->clear();
+
+ return _nAction;
+ }
+
+ //------------------------------------------------------------------------
+ sal_Int8 NavigatorTree::ExecuteDrop( const ExecuteDropEvent& rEvt )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::ExecuteDrop" );
+ sal_Int8 nResult( DND_ACTION_NONE );
+
+ if ( m_aControlExchange.isDragSource() )
+ nResult = implExecuteDataTransfer( *m_aControlExchange, rEvt.mnAction, rEvt.maPosPixel, sal_True );
+ else
+ {
+ OControlTransferData aDroppedData( rEvt.maDropEvent.Transferable );
+ nResult = implExecuteDataTransfer( aDroppedData, rEvt.mnAction, rEvt.maPosPixel, sal_True );
+ }
+
+ return nResult;
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTree::doPaste()
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::doPaste" );
+ try
+ {
+ if ( m_aControlExchange.isClipboardOwner() )
+ {
+ implExecuteDataTransfer( *m_aControlExchange, doingKeyboardCut( ) ? DND_ACTION_MOVE : DND_ACTION_COPY, FirstSelected(), sal_False );
+ }
+ else
+ {
+ // the clipboard content
+ Reference< XClipboard > xClipboard( GetClipboard() );
+ Reference< XTransferable > xTransferable;
+ if ( xClipboard.is() )
+ xTransferable = xClipboard->getContents();
+
+ OControlTransferData aClipboardContent( xTransferable );
+ implExecuteDataTransfer( aClipboardContent, DND_ACTION_COPY, FirstSelected(), sal_False );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_ERROR( "NavigatorTree::doPaste: caught an exception!" );
+ }
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTree::doCopy()
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::doCopy" );
+ if ( implPrepareExchange( DND_ACTION_COPY ) )
+ {
+ m_aControlExchange.setClipboardListener( LINK( this, NavigatorTree, OnClipboardAction ) );
+ m_aControlExchange.copyToClipboard( );
+ }
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTree::ModelHasRemoved( SvListEntry* _pEntry )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::ModelHasRemoved" );
+ SvLBoxEntry* pTypedEntry = static_cast< SvLBoxEntry* >( _pEntry );
+ if ( doingKeyboardCut() )
+ m_aCutEntries.erase( pTypedEntry );
+
+ if ( m_aControlExchange.isDataExchangeActive() )
+ {
+ if ( 0 == m_aControlExchange->onEntryRemoved( pTypedEntry ) )
+ {
+ // last of the entries which we put into the clipboard has been deleted from the tree.
+ // Give up the clipboard ownership.
+ m_aControlExchange.clear();
+ }
+ }
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTree::doCut()
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::doCut" );
+ if ( implPrepareExchange( DND_ACTION_MOVE ) )
+ {
+ m_aControlExchange.setClipboardListener( LINK( this, NavigatorTree, OnClipboardAction ) );
+ m_aControlExchange.copyToClipboard( );
+ m_bKeyboardCut = sal_True;
+
+ // mark all the entries we just "cut" into the clipboard as "nearly moved"
+ for ( sal_Int32 i=0; i<m_arrCurrentSelection.Count(); ++i )
+ {
+ SvLBoxEntry* pEntry = m_arrCurrentSelection[ (sal_uInt16)i ];
+ if ( pEntry )
+ {
+ m_aCutEntries.insert( pEntry );
+ pEntry->SetFlags( pEntry->GetFlags() | SV_ENTRYFLAG_SEMITRANSPARENT );
+ InvalidateEntry( pEntry );
+ }
+ }
+ }
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTree::KeyInput(const ::KeyEvent& rKEvt)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::KeyInput" );
+ const KeyCode& rCode = rKEvt.GetKeyCode();
+
+ // delete?
+ if (rKEvt.GetKeyCode().GetCode() == KEY_DELETE && !rKEvt.GetKeyCode().GetModifier())
+ {
+ DeleteSelection();
+ return;
+ }
+
+ // copy'n'paste?
+ switch ( rCode.GetFunction() )
+ {
+ case KEYFUNC_CUT:
+ doCut();
+ break;
+
+ case KEYFUNC_PASTE:
+ if ( implAcceptPaste() )
+ doPaste();
+ break;
+
+ case KEYFUNC_COPY:
+ doCopy();
+ break;
+
+ default:
+ break;
+ }
+
+ SvTreeListBox::KeyInput(rKEvt);
+ }
+
+ //------------------------------------------------------------------------
+ sal_Bool NavigatorTree::EditingEntry( SvLBoxEntry* pEntry, Selection& rSelection )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::EditingEntry" );
+ if (!SvTreeListBox::EditingEntry( pEntry, rSelection ))
+ return sal_False;
+
+ return (pEntry && (pEntry->GetUserData() != NULL));
+ // die Wurzel, die ich nicht umbenennen darf, hat als UserData NULL
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTree::NewForm( SvLBoxEntry* pParentEntry )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::NewForm" );
+ //////////////////////////////////////////////////////////////////////
+ // ParentFormData holen
+ if( !IsFormEntry(pParentEntry) )
+ return;
+
+ FmFormData* pParentFormData = (FmFormData*)pParentEntry->GetUserData();
+
+ //////////////////////////////////////////////////////////////////////
+ // Neue Form erzeugen
+ Reference< XForm > xNewForm(m_xORB->createInstance(FM_SUN_COMPONENT_FORM), UNO_QUERY);
+ if (!xNewForm.is())
+ return;
+
+ FmFormData* pNewFormData = new FmFormData( xNewForm, m_aNavigatorImages, m_aNavigatorImagesHC, pParentFormData );
+
+ //////////////////////////////////////////////////////////////////////
+ // Namen setzen
+ ::rtl::OUString aName = GenerateName(pNewFormData);
+ pNewFormData->SetText(aName);
+
+ Reference< XPropertySet > xPropertySet(xNewForm, UNO_QUERY);
+ if (!xPropertySet.is())
+ return;
+ try
+ {
+ xPropertySet->setPropertyValue( FM_PROP_NAME, makeAny(aName) );
+ // a form should always have the command type table as default
+ xPropertySet->setPropertyValue( FM_PROP_COMMANDTYPE, makeAny(sal_Int32(CommandType::TABLE)));
+ }
+ catch ( const Exception& )
+ {
+ DBG_ERROR("NavigatorTree::NewForm : could not set esssential properties !");
+ }
+
+
+ //////////////////////////////////////////////////////////////////////
+ // Form einfuegen
+ GetNavModel()->Insert( pNewFormData, LIST_APPEND, sal_True );
+
+ //////////////////////////////////////////////////////////////////////
+ // Neue Form als aktive Form setzen
+ FmFormShell* pFormShell = GetNavModel()->GetFormShell();
+ if( pFormShell )
+ {
+ InterfaceBag aSelection;
+ aSelection.insert( Reference< XInterface >( xNewForm, UNO_QUERY ) );
+ pFormShell->GetImpl()->setCurrentSelection( aSelection );
+
+ pFormShell->GetViewShell()->GetViewFrame()->GetBindings().Invalidate(SID_FM_PROPERTIES,sal_True,sal_True);
+ }
+ GetNavModel()->SetModified();
+
+ //////////////////////////////////////////////////////////////////////
+ // In EditMode schalten
+ SvLBoxEntry* pNewEntry = FindEntry( pNewFormData );
+ EditEntry( pNewEntry );
+ }
+
+ //------------------------------------------------------------------------
+ FmControlData* NavigatorTree::NewControl( const ::rtl::OUString& rServiceName, SvLBoxEntry* pParentEntry, sal_Bool bEditName )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::NewControl" );
+ //////////////////////////////////////////////////////////////////////
+ // ParentForm holen
+ if (!GetNavModel()->GetFormShell())
+ return NULL;
+ if (!IsFormEntry(pParentEntry))
+ return NULL;
+
+ FmFormData* pParentFormData = (FmFormData*)pParentEntry->GetUserData();;
+ Reference< XForm > xParentForm( pParentFormData->GetFormIface());
+
+ //////////////////////////////////////////////////////////////////////
+ // Neue Component erzeugen
+ Reference< XFormComponent > xNewComponent(::comphelper::getProcessServiceFactory()->createInstance(rServiceName), UNO_QUERY);
+ if (!xNewComponent.is())
+ return NULL;
+
+ FmControlData* pNewFormControlData = new FmControlData( xNewComponent, m_aNavigatorImages, m_aNavigatorImagesHC, pParentFormData );
+
+ //////////////////////////////////////////////////////////////////////
+ // Namen setzen
+ FmFormView* pFormView = GetNavModel()->GetFormShell()->GetFormView();
+ SdrPageView* pPageView = pFormView->GetSdrPageView();
+ FmFormPage* pPage = (FmFormPage*)pPageView->GetPage();
+
+ ::rtl::OUString sName = pPage->GetImpl().setUniqueName( xNewComponent, xParentForm );
+
+ pNewFormControlData->SetText( sName );
+
+ //////////////////////////////////////////////////////////////////////
+ // FormComponent einfuegen
+ GetNavModel()->Insert( pNewFormControlData, LIST_APPEND, sal_True );
+ GetNavModel()->SetModified();
+
+ if (bEditName)
+ {
+ //////////////////////////////////////////////////////////////////////
+ // In EditMode schalten
+ SvLBoxEntry* pNewEntry = FindEntry( pNewFormControlData );
+ Select( pNewEntry, sal_True );
+ EditEntry( pNewEntry );
+ }
+
+ return pNewFormControlData;
+ }
+
+ //------------------------------------------------------------------------
+ ::rtl::OUString NavigatorTree::GenerateName( FmEntryData* pEntryData )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::GenerateName" );
+ const sal_uInt16 nMaxCount = 99;
+ ::rtl::OUString aNewName;
+
+ //////////////////////////////////////////////////////////////////////
+ // BasisNamen erzeugen
+ UniString aBaseName;
+ if( pEntryData->ISA(FmFormData) )
+ aBaseName = SVX_RES( RID_STR_STDFORMNAME );
+
+ else if( pEntryData->ISA(FmControlData) )
+ aBaseName = SVX_RES( RID_STR_CONTROL );
+
+ //////////////////////////////////////////////////////////////////////
+ // Neuen Namen erstellen
+ FmFormData* pFormParentData = (FmFormData*)pEntryData->GetParent();
+
+ for( sal_Int32 i=0; i<nMaxCount; i++ )
+ {
+ aNewName = aBaseName;
+ if( i>0 )
+ {
+ aNewName += ::rtl::OUString::createFromAscii(" ");
+ aNewName += ::rtl::OUString::valueOf(i).getStr();
+ }
+
+ if( GetNavModel()->FindData(aNewName, pFormParentData,sal_False) == NULL )
+ break;
+ }
+
+ return aNewName;
+ }
+
+ //------------------------------------------------------------------------
+ sal_Bool NavigatorTree::EditedEntry( SvLBoxEntry* pEntry, const XubString& rNewText )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::EditedEntry" );
+ if (EditingCanceled())
+ return sal_True;
+
+ GrabFocus();
+ FmEntryData* pEntryData = (FmEntryData*)pEntry->GetUserData();
+ sal_Bool bRes = GetNavModel()->Rename( pEntryData, rNewText);
+ if( !bRes )
+ {
+ m_pEditEntry = pEntry;
+ nEditEvent = Application::PostUserEvent( LINK(this, NavigatorTree, OnEdit) );
+ } else
+ SetCursor(pEntry, sal_True);
+
+ return bRes;
+ }
+
+ //------------------------------------------------------------------------
+ IMPL_LINK( NavigatorTree, OnEdit, void*, EMPTYARG )
+ {
+ nEditEvent = 0;
+ EditEntry( m_pEditEntry );
+ m_pEditEntry = NULL;
+
+ return 0L;
+ }
+
+ //------------------------------------------------------------------------
+ IMPL_LINK( NavigatorTree, OnDropActionTimer, void*, EMPTYARG )
+ {
+ if (--m_aTimerCounter > 0)
+ return 0L;
+
+ switch ( m_aDropActionType )
+ {
+ case DA_EXPANDNODE:
+ {
+ SvLBoxEntry* pToExpand = GetEntry(m_aTimerTriggered);
+ if (pToExpand && (GetChildCount(pToExpand) > 0) && !IsExpanded(pToExpand))
+ // tja, eigentlich muesste ich noch testen, ob die Node nicht schon expandiert ist, aber ich
+ // habe dazu weder in den Basisklassen noch im Model eine Methode gefunden ...
+ // aber ich denke, die BK sollte es auch so vertragen
+ Expand(pToExpand);
+
+ // nach dem Expand habe ich im Gegensatz zum Scrollen natuerlich nix mehr zu tun
+ m_aDropActionTimer.Stop();
+ }
+ break;
+
+ case DA_SCROLLUP :
+ ScrollOutputArea( 1 );
+ m_aTimerCounter = DROP_ACTION_TIMER_SCROLL_TICKS;
+ break;
+
+ case DA_SCROLLDOWN :
+ ScrollOutputArea( -1 );
+ m_aTimerCounter = DROP_ACTION_TIMER_SCROLL_TICKS;
+ break;
+
+ }
+
+ return 0L;
+ }
+
+ //------------------------------------------------------------------------
+ IMPL_LINK(NavigatorTree, OnEntrySelDesel, NavigatorTree*, /*pThis*/)
+ {
+ m_sdiState = SDI_DIRTY;
+
+ if (IsSelectionHandlingLocked())
+ return 0L;
+
+ if (m_aSynchronizeTimer.IsActive())
+ m_aSynchronizeTimer.Stop();
+
+ m_aSynchronizeTimer.SetTimeout(EXPLORER_SYNC_DELAY);
+ m_aSynchronizeTimer.Start();
+
+ return 0L;
+ }
+
+ //------------------------------------------------------------------------
+ IMPL_LINK(NavigatorTree, OnSynchronizeTimer, void*, EMPTYARG)
+ {
+ SynchronizeMarkList();
+ return 0L;
+ }
+
+
+ //------------------------------------------------------------------------
+ IMPL_LINK( NavigatorTree, OnClipboardAction, void*, EMPTYARG )
+ {
+ if ( !m_aControlExchange.isClipboardOwner() )
+ {
+ if ( doingKeyboardCut() )
+ {
+ for ( ListBoxEntrySet::const_iterator i = m_aCutEntries.begin();
+ i != m_aCutEntries.end();
+ ++i
+ )
+ {
+ SvLBoxEntry* pEntry = *i;
+ if ( !pEntry )
+ continue;
+
+ pEntry->SetFlags( pEntry->GetFlags() & ~SV_ENTRYFLAG_SEMITRANSPARENT );
+ InvalidateEntry( pEntry );
+ }
+ ListBoxEntrySet aEmpty;
+ m_aCutEntries.swap( aEmpty );
+
+ m_bKeyboardCut = sal_False;
+ }
+ }
+ return 0L;
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTree::ShowSelectionProperties(sal_Bool bForce)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::ShowSelectionProperties" );
+ // zuerst brauche ich die FormShell
+ FmFormShell* pFormShell = GetNavModel()->GetFormShell();
+ if (!pFormShell)
+ // keine Shell -> ich koennte kein curObject setzen -> raus
+ return;
+
+ CollectSelectionData(SDI_ALL);
+ DBG_ASSERT( m_nFormsSelected + m_nControlsSelected + (m_bRootSelected ? 1 : 0) == m_arrCurrentSelection.Count(),
+ "NavigatorTree::ShowSelectionProperties : selection meta data invalid !");
+
+
+ InterfaceBag aSelection;
+ sal_Bool bSetSelectionAsMarkList = sal_False;
+
+ if (m_bRootSelected)
+ ; // no properties for the root, neither for single nor for multi selection
+ else if ( m_nFormsSelected + m_nControlsSelected == 0 ) // none of the two should be less 0
+ ; // no selection -> no properties
+ else if ( m_nFormsSelected * m_nControlsSelected != 0 )
+ ; // mixed selection -> no properties
+ else
+ { // either only forms, or only controls are selected
+ if (m_arrCurrentSelection.Count() == 1)
+ {
+ if (m_nFormsSelected > 0)
+ { // es ist genau eine Form selektiert
+ FmFormData* pFormData = (FmFormData*)m_arrCurrentSelection.GetObject(0)->GetUserData();
+ aSelection.insert( Reference< XInterface >( pFormData->GetFormIface(), UNO_QUERY ) );
+ }
+ else
+ { // es ist genau ein Control selektiert (egal ob hidden oder normal)
+ FmEntryData* pEntryData = (FmEntryData*)m_arrCurrentSelection.GetObject(0)->GetUserData();
+
+ aSelection.insert( Reference< XInterface >( pEntryData->GetElement(), UNO_QUERY ) );
+ }
+ }
+ else
+ { // wir haben eine MultiSelection, also muessen wir ein MultiSet dafuer aufbauen
+ if (m_nFormsSelected > 0)
+ { // ... nur Forms
+ // erstmal die PropertySet-Interfaces der Forms einsammeln
+ for ( sal_Int32 i = 0; i < m_nFormsSelected; ++i )
+ {
+ FmFormData* pFormData = (FmFormData*)m_arrCurrentSelection.GetObject((sal_uInt16)i)->GetUserData();
+ aSelection.insert( pFormData->GetPropertySet().get() );
+ }
+ }
+ else
+ { // ... nur Controls
+ if (m_nHiddenControls == m_nControlsSelected)
+ { // ein MultiSet fuer die Properties der hidden controls
+ for ( sal_Int32 i = 0; i < m_nHiddenControls; ++i )
+ {
+ FmEntryData* pEntryData = (FmEntryData*)m_arrCurrentSelection.GetObject((sal_uInt16)i)->GetUserData();
+ aSelection.insert( pEntryData->GetPropertySet().get() );
+ }
+ }
+ else if (m_nHiddenControls == 0)
+ { // nur normale Controls
+ bSetSelectionAsMarkList = sal_True;
+ }
+ }
+ }
+
+ }
+
+ // und dann meine Form und mein SelObject
+ if ( bSetSelectionAsMarkList )
+ pFormShell->GetImpl()->setCurrentSelectionFromMark( pFormShell->GetFormView()->GetMarkedObjectList() );
+ else
+ pFormShell->GetImpl()->setCurrentSelection( aSelection );
+
+ if ( pFormShell->GetImpl()->IsPropBrwOpen() || bForce )
+ {
+ // und jetzt kann ich das Ganze dem PropertyBrowser uebergeben
+ pFormShell->GetViewShell()->GetViewFrame()->GetDispatcher()->Execute( SID_FM_SHOW_PROPERTY_BROWSER, SFX_CALLMODE_ASYNCHRON );
+ }
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTree::DeleteSelection()
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::DeleteSelection" );
+ // die Root darf ich natuerlich nicht mitloeschen
+ sal_Bool bRootSelected = IsSelected(m_pRootEntry);
+ sal_uIntPtr nSelectedEntries = GetSelectionCount();
+ if (bRootSelected && (nSelectedEntries > 1)) // die Root plus andere Elemente ?
+ Select(m_pRootEntry, sal_False); // ja -> die Root raus
+
+ if ((nSelectedEntries == 0) || bRootSelected) // immer noch die Root ?
+ return; // -> sie ist das einzige selektierte -> raus
+
+ DBG_ASSERT(!m_bPrevSelectionMixed, "NavigatorTree::DeleteSelection() : loeschen nicht erlaubt wenn Markierung und Selektion nciht konsistent");
+
+ // ich brauche unten das FormModel ...
+ FmFormShell* pFormShell = GetNavModel()->GetFormShell();
+ if (!pFormShell)
+ return;
+ FmFormModel* pFormModel = pFormShell ? pFormShell->GetFormModel() : NULL;
+ if (!pFormModel)
+ return;
+
+ // jetzt muss ich noch die DeleteList etwas absichern : wenn man ein Formular und ein abhaengiges
+ // Element loescht - und zwar in dieser Reihenfolge - dann ist der SvLBoxEntryPtr des abhaengigen Elementes
+ // natuerlich schon ungueltig, wenn es geloescht werden soll ... diesen GPF, den es dann mit Sicherheit gibt,
+ // gilt es zu verhindern, also die 'normalisierte' Liste
+ CollectSelectionData( SDI_NORMALIZED );
+
+ // see below for why we need this mapping from models to shapes
+ FmFormView* pFormView = pFormShell->GetFormView();
+ SdrPageView* pPageView = pFormView ? pFormView->GetSdrPageView() : NULL;
+ SdrPage* pPage = pPageView ? pPageView->GetPage() : NULL;
+ DBG_ASSERT( pPage, "NavigatorTree::DeleteSelection: invalid form page!" );
+
+ MapModelToShape aModelShapes;
+ if ( pPage )
+ collectShapeModelMapping( pPage, aModelShapes );
+
+ // problem: we have to use ExplorerModel::Remove, since only this one properly deletes Form objects.
+ // But, the controls themself must be deleted via DeleteMarked (else, the Writer has some problems
+ // somewhere). In case I'd first delete the structure, then the controls, the UNDO would not work
+ // (since UNDO then would mean to first restore the controls, then the structure, means their parent
+ // form). The other way round, the EntryDatas would be invalid, if I'd first delete the controls and
+ // then go on to the strucure. This means I have to delete the forms *after* the normal controls, so
+ // that during UNDO, they're restored in the proper order.
+ pFormShell->GetImpl()->EnableTrackProperties(sal_False);
+ sal_uInt16 i;
+ for (i = m_arrCurrentSelection.Count(); i>0; --i)
+ {
+ FmEntryData* pCurrent = (FmEntryData*)(m_arrCurrentSelection.GetObject(i - 1)->GetUserData());
+
+ // eine Form ?
+ sal_Bool bIsForm = pCurrent->ISA(FmFormData);
+
+ // da ich das Loeschen im folgenden der View ueberlasse und dabei auf deren MarkList aufbaue, im Normalfall aber bei
+ // einem makierten Formular nur die direkt, nicht die indirekt abhaengigen Controls markiert werden, muss ich das hier
+ // noch nachholen
+ if (bIsForm)
+ MarkViewObj((FmFormData*)pCurrent, sal_True, sal_True); // das zweite sal_True heisst "deep"
+
+ // ein hidden control ?
+ sal_Bool bIsHidden = IsHiddenControl(pCurrent);
+
+ // Forms und hidden Controls muss ich behalten, alles andere nicht
+ if (!bIsForm && !bIsHidden)
+ {
+ // well, no form and no hidden control -> we can remove it from m_arrCurrentSelection, as it will
+ // be deleted automatically. This is because for every model (except forms and hidden control models)
+ // there exist a shape, which is marked _if_and_only_if_ the model is selected in our tree.
+ if ( aModelShapes.find( pCurrent->GetElement() ) != aModelShapes.end() )
+ {
+ // if there's a shape for the current entry, then either it is marked or it is in a
+ // hidden layer (#i28502#), or something like this.
+ // In the first case, it will be deleted below, in the second case, we currently don't
+ // delete it, as there's no real (working!) API for this, neither in UNO nor in non-UNO.
+ m_arrCurrentSelection.Remove( i - 1, 1 );
+ }
+ // In case there is no shape for the current entry, we keep the entry in m_arrCurrentSelection,
+ // since then we can definately remove it.
+ // #103597#
+ }
+ }
+ pFormShell->GetImpl()->EnableTrackProperties(sal_True);
+
+ // let the view delete the marked controls
+ pFormShell->GetFormView()->DeleteMarked();
+
+ // start UNDO at this point. Unfortunately, this results in 2 UNDO actions, since DeleteMarked is
+ // creating an own one. However, if we'd move it before DeleteMarked, Writer does not really like
+ // this ... :(
+ // 2004-07-05 - #i31038# - fs@openoffice.org
+ {
+ // ---------------
+ // initialize UNDO
+ String aUndoStr;
+ if ( m_arrCurrentSelection.Count() == 1 )
+ {
+ aUndoStr = SVX_RES(RID_STR_UNDO_CONTAINER_REMOVE);
+ if (m_nFormsSelected)
+ aUndoStr.SearchAndReplaceAscii( "#", SVX_RES( RID_STR_FORM ) );
+ else
+ // it must be a control (else the root would be selected, but it cannot be deleted)
+ aUndoStr.SearchAndReplaceAscii( "#", SVX_RES( RID_STR_CONTROL ) );
+ }
+ else
+ {
+ aUndoStr = SVX_RES(RID_STR_UNDO_CONTAINER_REMOVE_MULTIPLE);
+ aUndoStr.SearchAndReplaceAscii( "#", String::CreateFromInt32( m_arrCurrentSelection.Count() ) );
+ }
+ pFormModel->BegUndo(aUndoStr);
+ }
+
+ // remove remaining structure
+ for (i=0; i<m_arrCurrentSelection.Count(); ++i)
+ {
+ FmEntryData* pCurrent = (FmEntryData*)(m_arrCurrentSelection.GetObject(i)->GetUserData());
+
+ // if the entry still has children, we skipped deletion of one of those children.
+ // This may for instance be because the shape is in a hidden layer, where we're unable
+ // to remove it
+ if ( pCurrent->GetChildList()->Count() )
+ continue;
+
+ // noch ein kleines Problem, bevor ich das ganz loesche : wenn es eine Form ist und die Shell diese als CurrentObject
+ // kennt, dann muss ich ihr das natuerlich ausreden
+ if (pCurrent->ISA(FmFormData))
+ {
+ Reference< XForm > xCurrentForm( static_cast< FmFormData* >( pCurrent )->GetFormIface() );
+ if ( pFormShell->GetImpl()->getCurrentForm() == xCurrentForm ) // die Shell kennt die zu loeschende Form ?
+ pFormShell->GetImpl()->forgetCurrentForm(); // -> wegnehmen ...
+ }
+ GetNavModel()->Remove(pCurrent, sal_True);
+ }
+ pFormModel->EndUndo();
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTree::CollectSelectionData(SELDATA_ITEMS sdiHow)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::CollectSelectionData" );
+ DBG_ASSERT(sdiHow != SDI_DIRTY, "NavigatorTree::CollectSelectionData : ever thought about your parameter ? DIRTY ?");
+ if (sdiHow == m_sdiState)
+ return;
+
+ m_arrCurrentSelection.Remove((sal_uInt16)0, m_arrCurrentSelection.Count());
+ m_nFormsSelected = m_nControlsSelected = m_nHiddenControls = 0;
+ m_bRootSelected = sal_False;
+
+ SvLBoxEntry* pSelectionLoop = FirstSelected();
+ while (pSelectionLoop)
+ {
+ // erst mal die Zaehlung der verschiedenen Elemente
+ if (pSelectionLoop == m_pRootEntry)
+ m_bRootSelected = sal_True;
+ else
+ {
+ if (IsFormEntry(pSelectionLoop))
+ ++m_nFormsSelected;
+ else
+ {
+ ++m_nControlsSelected;
+ if (IsHiddenControl((FmEntryData*)(pSelectionLoop->GetUserData())))
+ ++m_nHiddenControls;
+ }
+ }
+
+ if (sdiHow == SDI_NORMALIZED)
+ {
+ // alles, was schon einen selektierten Vorfahr hat, nicht mitnehmen
+ if (pSelectionLoop == m_pRootEntry)
+ m_arrCurrentSelection.Insert(pSelectionLoop);
+ else
+ {
+ SvLBoxEntry* pParentLoop = GetParent(pSelectionLoop);
+ while (pParentLoop)
+ {
+ // eigentlich muesste ich testen, ob das Parent in der m_arrCurrentSelection steht ...
+ // Aber wenn es selektiert ist, dann steht es in m_arrCurrentSelection, oder wenigstens einer seiner Vorfahren,
+ // wenn der auch schon selektiert war. In beiden Faellen reicht also die Abfrage IsSelected
+ if (IsSelected(pParentLoop))
+ break;
+ else
+ {
+ if (m_pRootEntry == pParentLoop)
+ {
+ // bis (exclusive) zur Root gab es kein selektiertes Parent -> der Eintrag gehoert in die normalisierte Liste
+ m_arrCurrentSelection.Insert(pSelectionLoop);
+ break;
+ }
+ else
+ pParentLoop = GetParent(pParentLoop);
+ }
+ }
+ }
+ }
+ else if (sdiHow == SDI_NORMALIZED_FORMARK)
+ {
+ SvLBoxEntry* pParent = GetParent(pSelectionLoop);
+ if (!pParent || !IsSelected(pParent) || IsFormEntry(pSelectionLoop))
+ m_arrCurrentSelection.Insert(pSelectionLoop);
+ }
+ else
+ m_arrCurrentSelection.Insert(pSelectionLoop);
+
+
+ pSelectionLoop = NextSelected(pSelectionLoop);
+ }
+
+ m_sdiState = sdiHow;
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTree::SynchronizeSelection(FmEntryDataArray& arredToSelect)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::SynchronizeSelection" );
+ LockSelectionHandling();
+ if (arredToSelect.Count() == 0)
+ {
+ SelectAll(sal_False);
+ }
+ else
+ {
+ // erst mal gleiche ich meine aktuelle Selektion mit der geforderten SelectList ab
+ SvLBoxEntry* pSelection = FirstSelected();
+ while (pSelection)
+ {
+ FmEntryData* pCurrent = (FmEntryData*)pSelection->GetUserData();
+ if (pCurrent != NULL)
+ {
+ sal_uInt16 nPosition;
+ if ( arredToSelect.Seek_Entry(pCurrent, &nPosition) )
+ { // der Entry ist schon selektiert, steht aber auch in der SelectList -> er kann aus letzterer
+ // raus
+ arredToSelect.Remove(nPosition, 1);
+ } else
+ { // der Entry ist selektiert, aber steht nicht in der SelectList -> Selektion rausnehmen
+ Select(pSelection, sal_False);
+ // und sichtbar machen (kann ja sein, dass das die einzige Modifikation ist, die ich hier in dem
+ // ganzen Handler mache, dann sollte das zu sehen sein)
+ MakeVisible(pSelection);
+ }
+ }
+ else
+ Select(pSelection, sal_False);
+
+ pSelection = NextSelected(pSelection);
+ }
+
+ // jetzt habe ich in der SelectList genau die Eintraege, die noch selektiert werden muessen
+ // zwei Moeglichkeiten : 1) ich gehe durch die SelectList, besorge mir zu jedem Eintrag meinen SvLBoxEntry
+ // und selektiere diesen (waere irgendwie intuitiver ;)) 2) ich gehe durch alle meine SvLBoxEntries und selektiere
+ // genau die, die ich in der SelectList finde
+ // 1) braucht O(k*n) (k=Laenge der SelectList, n=Anzahl meiner Entries), plus den Fakt, dass FindEntry nicht den
+ // Pointer auf die UserDaten vergleicht, sondern ein aufwendigeres IsEqualWithoutChilds durchfuehrt
+ // 2) braucht O(n*log k), dupliziert aber etwas Code (naemlich den aus FindEntry)
+ // da das hier eine relativ oft aufgerufenen Stelle sein koennte (bei jeder Aenderung in der Markierung in der View !),
+ // nehme ich doch lieber letzteres
+ SvLBoxEntry* pLoop = First();
+ while( pLoop )
+ {
+ FmEntryData* pCurEntryData = (FmEntryData*)pLoop->GetUserData();
+ sal_uInt16 nPosition;
+ if ( arredToSelect.Seek_Entry(pCurEntryData, &nPosition) )
+ {
+ Select(pLoop, sal_True);
+ MakeVisible(pLoop);
+ SetCursor(pLoop, sal_True);
+ }
+
+ pLoop = Next( pLoop );
+ }
+ }
+ UnlockSelectionHandling();
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTree::SynchronizeSelection()
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::SynchronizeSelection" );
+ // Shell und View
+ FmFormShell* pFormShell = GetNavModel()->GetFormShell();
+ if(!pFormShell) return;
+
+ FmFormView* pFormView = pFormShell->GetFormView();
+ if (!pFormView) return;
+
+ GetNavModel()->BroadcastMarkedObjects(pFormView->GetMarkedObjectList());
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTree::SynchronizeMarkList()
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::SynchronizeMarkList" );
+ // die Shell werde ich brauchen ...
+ FmFormShell* pFormShell = GetNavModel()->GetFormShell();
+ if (!pFormShell) return;
+
+ CollectSelectionData(SDI_NORMALIZED_FORMARK);
+
+ // Die View soll jetzt kein Notify bei einer Aenderung der MarkList rauslassen
+ pFormShell->GetImpl()->EnableTrackProperties(sal_False);
+
+ UnmarkAllViewObj();
+
+ for (sal_uInt32 i=0; i<m_arrCurrentSelection.Count(); ++i)
+ {
+ SvLBoxEntry* pSelectionLoop = m_arrCurrentSelection.GetObject((sal_uInt16)i);
+ // Bei Formselektion alle Controls dieser Form markieren
+ if (IsFormEntry(pSelectionLoop) && (pSelectionLoop != m_pRootEntry))
+ MarkViewObj((FmFormData*)pSelectionLoop->GetUserData(), sal_True, sal_False);
+
+ // Bei Controlselektion Control-SdrObjects markieren
+ else if (IsFormComponentEntry(pSelectionLoop))
+ {
+ FmControlData* pControlData = (FmControlData*)pSelectionLoop->GetUserData();
+ if (pControlData)
+ {
+ /////////////////////////////////////////////////////////////////
+ // Beim HiddenControl kann kein Object selektiert werden
+ Reference< XFormComponent > xFormComponent( pControlData->GetFormComponent());
+ if (!xFormComponent.is())
+ continue;
+ Reference< XPropertySet > xSet(xFormComponent, UNO_QUERY);
+ if (!xSet.is())
+ continue;
+
+ sal_uInt16 nClassId = ::comphelper::getINT16(xSet->getPropertyValue(FM_PROP_CLASSID));
+ if (nClassId != FormComponentType::HIDDENCONTROL)
+ MarkViewObj(pControlData, sal_True, sal_True);
+ }
+ }
+ }
+
+ // wenn der PropertyBrowser offen ist, muss ich den entsprechend meiner Selektion anpassen
+ // (NICHT entsprechend der MarkList der View : wenn ich ein Formular selektiert habe, sind in der
+ // View alle zugehoerigen Controls markiert, trotzdem moechte ich natuerlich die Formular-Eigenschaften
+ // sehen)
+ ShowSelectionProperties(sal_False);
+
+ // Flag an View wieder zuruecksetzen
+ pFormShell->GetImpl()->EnableTrackProperties(sal_True);
+
+ // wenn jetzt genau eine Form selektiert ist, sollte die Shell das als CurrentForm mitbekommen
+ // (wenn SelectionHandling nicht locked ist, kuemmert sich die View eigentlich in MarkListHasChanged drum,
+ // aber der Mechanismus greift zum Beispiel nicht, wenn die Form leer ist)
+ if ((m_arrCurrentSelection.Count() == 1) && (m_nFormsSelected == 1))
+ {
+ FmFormData* pSingleSelectionData = PTR_CAST( FmFormData, static_cast< FmEntryData* >( FirstSelected()->GetUserData() ) );
+ DBG_ASSERT( pSingleSelectionData, "NavigatorTree::SynchronizeMarkList: invalid selected form!" );
+ if ( pSingleSelectionData )
+ {
+ InterfaceBag aSelection;
+ aSelection.insert( Reference< XInterface >( pSingleSelectionData->GetFormIface(), UNO_QUERY ) );
+ pFormShell->GetImpl()->setCurrentSelection( aSelection );
+ }
+ }
+ }
+
+ //------------------------------------------------------------------------
+ sal_Bool NavigatorTree::IsHiddenControl(FmEntryData* pEntryData)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::IsHiddenControl" );
+ if (pEntryData == NULL) return sal_False;
+
+ Reference< XPropertySet > xProperties( pEntryData->GetPropertySet() );
+ if (::comphelper::hasProperty(FM_PROP_CLASSID, xProperties))
+ {
+ Any aClassID = xProperties->getPropertyValue( FM_PROP_CLASSID );
+ return (::comphelper::getINT16(aClassID) == FormComponentType::HIDDENCONTROL);
+ }
+ return sal_False;
+ }
+
+ //------------------------------------------------------------------------
+ sal_Bool NavigatorTree::Select( SvLBoxEntry* pEntry, sal_Bool bSelect )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::Select" );
+ if (bSelect == IsSelected(pEntry)) // das passiert manchmal, ich glaube, die Basisklasse geht zu sehr auf Nummer sicher ;)
+ return sal_True;
+
+ return SvTreeListBox::Select(pEntry, bSelect );
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTree::UnmarkAllViewObj()
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::UnmarkAllViewObj" );
+ FmFormShell* pFormShell = GetNavModel()->GetFormShell();
+ if( !pFormShell )
+ return;
+ FmFormView* pFormView = pFormShell->GetFormView();
+ pFormView->UnMarkAll();
+ }
+ //------------------------------------------------------------------------
+ void NavigatorTree::MarkViewObj(FmFormData* pFormData, sal_Bool bMark, sal_Bool bDeep )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::MarkViewObjects" );
+ FmFormShell* pFormShell = GetNavModel()->GetFormShell();
+ if( !pFormShell )
+ return;
+
+ // first collect all sdrobjects
+ ::std::set< Reference< XFormComponent > > aObjects;
+ CollectObjects(pFormData,bDeep,aObjects);
+
+ //////////////////////////////////////////////////////////////////////
+ // In der Page das entsprechende SdrObj finden und selektieren
+ FmFormView* pFormView = pFormShell->GetFormView();
+ SdrPageView* pPageView = pFormView->GetSdrPageView();
+ SdrPage* pPage = pPageView->GetPage();
+ //FmFormPage* pFormPage = dynamic_cast< FmFormPage* >( pPage );
+
+ SdrObjListIter aIter( *pPage );
+ while ( aIter.IsMore() )
+ {
+ SdrObject* pSdrObject = aIter.Next();
+ FmFormObj* pFormObject = FmFormObj::GetFormObject( pSdrObject );
+ if ( !pFormObject )
+ continue;
+
+ Reference< XFormComponent > xControlModel( pFormObject->GetUnoControlModel(),UNO_QUERY );
+ if ( xControlModel.is() && aObjects.find(xControlModel) != aObjects.end() && bMark != pFormView->IsObjMarked( pSdrObject ) )
+ {
+ // unfortunately, the writer doesn't like marking an already-marked object, again, so reset the mark first
+ pFormView->MarkObj( pSdrObject, pPageView, !bMark, sal_False );
+ }
+ } // while ( aIter.IsMore() )
+ if ( bMark )
+ {
+ // make the mark visible
+ ::Rectangle aMarkRect( pFormView->GetAllMarkedRect());
+ for ( sal_uInt32 i = 0; i < pFormView->PaintWindowCount(); ++i )
+ {
+ SdrPaintWindow* pPaintWindow = pFormView->GetPaintWindow( i );
+ OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
+ if ( ( OUTDEV_WINDOW == rOutDev.GetOutDevType() ) && !aMarkRect.IsEmpty() )
+ {
+ pFormView->MakeVisible( aMarkRect, (Window&)rOutDev );
+ }
+ } // for ( sal_uInt32 i = 0; i < pFormView->PaintWindowCount(); ++i )
+ }
+ }
+ //------------------------------------------------------------------------
+ void NavigatorTree::CollectObjects(FmFormData* pFormData, sal_Bool bDeep, ::std::set< Reference< XFormComponent > >& _rObjects)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::MarkViewObjects" );
+ FmEntryDataList* pChildList = pFormData->GetChildList();
+ FmEntryData* pEntryData;
+ FmControlData* pControlData;
+ for( sal_uInt32 i=0; i < pChildList->Count(); ++i )
+ {
+ pEntryData = pChildList->GetObject(i);
+ if( pEntryData->ISA(FmControlData) )
+ {
+ pControlData = (FmControlData*)pEntryData;
+ _rObjects.insert(pControlData->GetFormComponent());
+ } // if( pEntryData->ISA(FmControlData) )
+ else if (bDeep && (pEntryData->ISA(FmFormData)))
+ CollectObjects((FmFormData*)pEntryData,bDeep,_rObjects);
+ } // for( sal_uInt32 i=0; i<pChildList->Count(); i++ )
+ }
+ //------------------------------------------------------------------------
+ void NavigatorTree::MarkViewObj( FmControlData* pControlData, sal_Bool bMarkHandles, sal_Bool bMark)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTree::MarkViewObj" );
+ if( !pControlData )
+ return;
+ FmFormShell* pFormShell = GetNavModel()->GetFormShell();
+ if( !pFormShell )
+ return;
+
+ //////////////////////////////////////////////////////////////////////
+ // In der Page das entsprechende SdrObj finden und selektieren
+ FmFormView* pFormView = pFormShell->GetFormView();
+ Reference< XFormComponent > xFormComponent( pControlData->GetFormComponent());
+ SdrPageView* pPageView = pFormView->GetSdrPageView();
+ SdrPage* pPage = pPageView->GetPage();
+
+ bool bPaint = false;
+ SdrObjListIter aIter( *pPage );
+ while ( aIter.IsMore() )
+ {
+ SdrObject* pSdrObject = aIter.Next();
+ FmFormObj* pFormObject = FmFormObj::GetFormObject( pSdrObject );
+ if ( !pFormObject )
+ continue;
+
+ Reference< XInterface > xControlModel( pFormObject->GetUnoControlModel() );
+ if ( xControlModel != xFormComponent )
+ continue;
+
+ // mark the object
+ if ( bMark != pFormView->IsObjMarked( pSdrObject ) )
+ // unfortunately, the writer doesn't like marking an already-marked object, again, so reset the mark first
+ pFormView->MarkObj( pSdrObject, pPageView, !bMark, sal_False );
+
+ if ( !bMarkHandles || !bMark )
+ continue;
+
+ bPaint = true;
+
+ } // while ( aIter.IsMore() )
+ if ( bPaint )
+ {
+ // make the mark visible
+ ::Rectangle aMarkRect( pFormView->GetAllMarkedRect());
+ for ( sal_uInt32 i = 0; i < pFormView->PaintWindowCount(); ++i )
+ {
+ SdrPaintWindow* pPaintWindow = pFormView->GetPaintWindow( i );
+ OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
+ if ( OUTDEV_WINDOW == rOutDev.GetOutDevType() )
+ {
+ pFormView->MakeVisible( aMarkRect, (Window&)rOutDev );
+ }
+ } // for ( sal_uInt32 i = 0; i < pFormView->PaintWindowCount(); ++i )
+ }
+ }
+
+//............................................................................
+} // namespace svxform
+//............................................................................
+
+
diff --git a/svx/source/form/navigatortreemodel.cxx b/svx/source/form/navigatortreemodel.cxx
new file mode 100644
index 000000000000..bd788b731280
--- /dev/null
+++ b/svx/source/form/navigatortreemodel.cxx
@@ -0,0 +1,1126 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/dialmgr.hxx>
+#include <svx/fmshell.hxx>
+#include <svx/fmmodel.hxx>
+#include <svx/fmpage.hxx>
+#include <svx/fmglob.hxx>
+#include "svx/svditer.hxx"
+#include <svx/svdogrp.hxx>
+#include <svx/svdpagv.hxx>
+
+#include "fmprop.hrc"
+
+#include "fmundo.hxx"
+#include "fmhelp.hrc"
+#include "fmexpl.hrc"
+#include "fmexpl.hxx"
+#include "svx/fmresids.hrc"
+#include "fmshimp.hxx"
+#include "fmobj.hxx"
+#include <sfx2/objsh.hxx>
+#include <tools/diagnose_ex.h>
+#include <rtl/logfile.hxx>
+#include <com/sun/star/container/XContainer.hpp>
+
+//............................................................................
+namespace svxform
+{
+//............................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::form;
+ using namespace ::com::sun::star::awt;
+ using namespace ::com::sun::star::container;
+ using namespace ::com::sun::star::script;
+ using namespace ::com::sun::star::sdb;
+
+ //========================================================================
+ // class OFormComponentObserver
+ //========================================================================
+ //------------------------------------------------------------------------
+ OFormComponentObserver::OFormComponentObserver(NavigatorTreeModel* _pModel)
+ :m_pNavModel(_pModel)
+ ,m_nLocks(0)
+ ,m_bCanUndo(sal_True)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "OFormComponentObserver::OFormComponentObserver" );
+ }
+
+ // XPropertyChangeListener
+ //------------------------------------------------------------------------
+ void SAL_CALL OFormComponentObserver::disposing(const EventObject& Source) throw( RuntimeException )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "OFormComponentObserver::disposing" );
+ Remove( Source.Source );
+ }
+
+ //------------------------------------------------------------------------
+ void SAL_CALL OFormComponentObserver::propertyChange(const PropertyChangeEvent& evt) throw(RuntimeException)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "OFormComponentObserver::propertyChange" );
+ if( !m_pNavModel ) return;
+ if( evt.PropertyName != FM_PROP_NAME ) return;
+
+ Reference< XFormComponent > xFormComponent(evt.Source, UNO_QUERY);
+ Reference< XForm > xForm(evt.Source, UNO_QUERY);
+
+ FmEntryData* pEntryData( NULL );
+ if( xForm.is() )
+ pEntryData = m_pNavModel->FindData( xForm, m_pNavModel->GetRootList() );
+ else if( xFormComponent.is() )
+ pEntryData = m_pNavModel->FindData( xFormComponent, m_pNavModel->GetRootList() );
+
+ if( pEntryData )
+ {
+ ::rtl::OUString aNewName = ::comphelper::getString(evt.NewValue);
+ pEntryData->SetText( aNewName );
+ FmNavNameChangedHint aNameChangedHint( pEntryData, aNewName );
+ m_pNavModel->Broadcast( aNameChangedHint );
+ }
+ }
+
+ // XContainerListener
+ //------------------------------------------------------------------------------
+ void SAL_CALL OFormComponentObserver::elementInserted(const ContainerEvent& evt) throw(RuntimeException)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "OFormComponentObserver::elementInserted" );
+ if (IsLocked() || !m_pNavModel)
+ return;
+
+ // keine Undoaction einfuegen
+ m_bCanUndo = sal_False;
+
+ Reference< XInterface > xTemp;
+ evt.Element >>= xTemp;
+ Insert(xTemp, ::comphelper::getINT32(evt.Accessor));
+
+ m_bCanUndo = sal_True;
+ }
+
+ //------------------------------------------------------------------------------
+ void OFormComponentObserver::Insert(const Reference< XInterface > & xIface, sal_Int32 nIndex)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "OFormComponentObserver::Insert" );
+ Reference< XForm > xForm(xIface, UNO_QUERY);
+ if (xForm.is())
+ {
+ m_pNavModel->InsertForm(xForm, sal_uInt32(nIndex));
+ Reference< XIndexContainer > xContainer(xForm, UNO_QUERY);
+ Reference< XInterface > xTemp;
+ for (sal_Int32 i = 0; i < xContainer->getCount(); i++)
+ {
+ xContainer->getByIndex(i) >>= xTemp;
+ Insert(xTemp, i);
+ }
+ }
+ else
+ {
+ Reference< XFormComponent > xFormComp(xIface, UNO_QUERY);
+ if (xFormComp.is())
+ m_pNavModel->InsertFormComponent(xFormComp, sal_uInt32(nIndex));
+ }
+ }
+
+ //------------------------------------------------------------------------------
+ void SAL_CALL OFormComponentObserver::elementReplaced(const ContainerEvent& evt) throw(RuntimeException)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "OFormComponentObserver::elementReplaced" );
+ if (IsLocked() || !m_pNavModel)
+ return;
+
+ m_bCanUndo = sal_False;
+
+ // EntryData loeschen
+ Reference< XFormComponent > xReplaced;
+ evt.ReplacedElement >>= xReplaced;
+ FmEntryData* pEntryData = m_pNavModel->FindData(xReplaced, m_pNavModel->GetRootList(), sal_True);
+ if (pEntryData)
+ {
+ if (pEntryData->ISA(FmControlData))
+ {
+ Reference< XFormComponent > xComp;
+ evt.Element >>= xComp;
+ DBG_ASSERT(xComp.is(), "OFormComponentObserver::elementReplaced : invalid argument !");
+ // an einer FmControlData sollte eine XFormComponent haengen
+ m_pNavModel->ReplaceFormComponent(xReplaced, xComp);
+ }
+ else if (pEntryData->ISA(FmFormData))
+ {
+ DBG_ERROR("replacing forms not implemented yet !");
+ }
+ }
+
+ m_bCanUndo = sal_True;
+ }
+
+ //------------------------------------------------------------------------------
+ void OFormComponentObserver::Remove( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "OFormComponentObserver::Remove" );
+ if (IsLocked() || !m_pNavModel)
+ return;
+
+ m_bCanUndo = sal_False;
+
+ //////////////////////////////////////////////////////////
+ // EntryData loeschen
+ FmEntryData* pEntryData = m_pNavModel->FindData( _rxElement, m_pNavModel->GetRootList(), sal_True );
+ if (pEntryData)
+ m_pNavModel->Remove(pEntryData);
+
+ m_bCanUndo = sal_True;
+ }
+
+ //------------------------------------------------------------------------------
+ void SAL_CALL OFormComponentObserver::elementRemoved(const ContainerEvent& evt) throw(RuntimeException)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "OFormComponentObserver::elementRemoved" );
+ Reference< XInterface > xElement;
+ evt.Element >>= xElement;
+ Remove( xElement );
+ }
+
+ //========================================================================
+ // class NavigatorTreeModel
+ //========================================================================
+
+ //------------------------------------------------------------------------
+ NavigatorTreeModel::NavigatorTreeModel( const ImageList& _rNormalImages, const ImageList& _rHCImages )
+ :m_pFormShell(NULL)
+ ,m_pFormPage(NULL)
+ ,m_pFormModel(NULL)
+ ,m_aNormalImages( _rNormalImages )
+ ,m_aHCImages( _rHCImages )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::NavigatorTreeModel" );
+ m_pPropChangeList = new OFormComponentObserver(this);
+ m_pPropChangeList->acquire();
+ m_pRootList = new FmEntryDataList();
+ }
+
+ //------------------------------------------------------------------------
+ NavigatorTreeModel::~NavigatorTreeModel()
+ {
+ //////////////////////////////////////////////////////////////////////
+ // Als Listener abmelden
+ if( m_pFormShell)
+ {
+ FmFormModel* pFormModel = m_pFormShell->GetFormModel();
+ if( pFormModel && IsListening(*pFormModel))
+ EndListening( *pFormModel );
+
+ if (IsListening(*m_pFormShell))
+ EndListening(*m_pFormShell);
+ }
+
+ Clear();
+ delete m_pRootList;
+ m_pPropChangeList->ReleaseModel();
+ m_pPropChangeList->release();
+ }
+
+
+ //------------------------------------------------------------------------
+ void NavigatorTreeModel::SetModified( sal_Bool bMod )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::SetModified" );
+ if( !m_pFormShell ) return;
+ SfxObjectShell* pObjShell = m_pFormShell->GetFormModel()->GetObjectShell();
+ if( !pObjShell ) return;
+ pObjShell->SetModified( bMod );
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTreeModel::Clear()
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::Clear" );
+ Reference< XNameContainer > xForms( GetForms());
+ Reference< XContainer > xContainer(xForms, UNO_QUERY);
+ if (xContainer.is())
+ xContainer->removeContainerListener((XContainerListener*)m_pPropChangeList);
+
+ //////////////////////////////////////////////////////////////////////
+ // RootList loeschen
+ FmEntryData* pChildData;
+ FmEntryDataList* pRootList = GetRootList();
+
+ for( sal_uInt32 i=pRootList->Count(); i>0; i-- )
+ {
+ pChildData = pRootList->GetObject(i-1);
+ pRootList->Remove( pChildData );
+ delete pChildData;
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // UI benachrichtigen
+ FmNavClearedHint aClearedHint;
+ Broadcast( aClearedHint );
+ }
+
+ //------------------------------------------------------------------------
+ Reference< XNameContainer > NavigatorTreeModel::GetForms() const
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::GetForms" );
+ if( !m_pFormShell || !m_pFormShell->GetCurPage())
+ return NULL;
+ else
+ return m_pFormShell->GetCurPage()->GetForms();
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTreeModel::Insert(FmEntryData* pEntry, sal_uLong nRelPos, sal_Bool bAlterModel)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::Insert" );
+ if (IsListening(*m_pFormModel))
+ EndListening(*m_pFormModel);
+
+ m_pPropChangeList->Lock();
+ FmFormData* pFolder = (FmFormData*) pEntry->GetParent();
+ Reference< XChild > xElement( pEntry->GetChildIFace() );
+ if (bAlterModel)
+ {
+ XubString aStr;
+ if (pEntry->ISA(FmFormData))
+ aStr = SVX_RES(RID_STR_FORM);
+ else
+ aStr = SVX_RES(RID_STR_CONTROL);
+
+ Reference< XIndexContainer > xContainer;
+ if (pFolder)
+ xContainer = Reference< XIndexContainer > (pFolder->GetFormIface(), UNO_QUERY);
+ else
+ xContainer = Reference< XIndexContainer > (GetForms(), UNO_QUERY);
+
+ bool bUndo = m_pFormModel->IsUndoEnabled();
+
+ if( bUndo )
+ {
+ XubString aUndoStr(SVX_RES(RID_STR_UNDO_CONTAINER_INSERT));
+ aUndoStr.SearchAndReplace('#', aStr);
+ m_pFormModel->BegUndo(aUndoStr);
+ }
+
+ if (nRelPos >= (sal_uInt32)xContainer->getCount())
+ nRelPos = (sal_uInt32)xContainer->getCount();
+
+ // UndoAction
+ if ( bUndo && m_pPropChangeList->CanUndo())
+ {
+ m_pFormModel->AddUndo(new FmUndoContainerAction(*m_pFormModel,
+ FmUndoContainerAction::Inserted,
+ xContainer,
+ xElement,
+ nRelPos));
+ }
+
+ // das Element muss den Typ haben, den der Container erwartet
+ if (xContainer->getElementType() ==
+ ::getCppuType((const Reference< XForm>*)0))
+
+ {
+ Reference< XForm > xElementAsForm(xElement, UNO_QUERY);
+ xContainer->insertByIndex(nRelPos, makeAny(xElementAsForm));
+ }
+ else if (xContainer->getElementType() ==
+ ::getCppuType((const Reference< XFormComponent>*)0))
+
+ {
+ Reference< XFormComponent > xElementAsComponent(xElement, UNO_QUERY);
+ xContainer->insertByIndex(nRelPos, makeAny(xElementAsComponent));
+ }
+ else
+ {
+ DBG_ERROR("NavigatorTreeModel::Insert : the parent container needs an elementtype I don't know !");
+ }
+
+ if( bUndo )
+ m_pFormModel->EndUndo();
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // Als PropertyChangeListener anmelden
+ Reference< XPropertySet > xSet(xElement, UNO_QUERY);
+ if( xSet.is() )
+ xSet->addPropertyChangeListener( FM_PROP_NAME, m_pPropChangeList );
+
+ //////////////////////////////////////////////////////////////////////
+ // Daten aus Model entfernen
+ if (pEntry->ISA(FmFormData))
+ {
+ Reference< XContainer > xContainer(xElement, UNO_QUERY);
+ if (xContainer.is())
+ xContainer->addContainerListener((XContainerListener*)m_pPropChangeList);
+ }
+
+ if (pFolder)
+ pFolder->GetChildList()->Insert( pEntry, nRelPos );
+ else
+ GetRootList()->Insert( pEntry, nRelPos );
+
+ //////////////////////////////////////////////////////////////////////
+ // UI benachrichtigen
+ FmNavInsertedHint aInsertedHint( pEntry, nRelPos );
+ Broadcast( aInsertedHint );
+
+ m_pPropChangeList->UnLock();
+ if (IsListening(*m_pFormModel))
+ StartListening(*m_pFormModel);
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTreeModel::Remove(FmEntryData* pEntry, sal_Bool bAlterModel)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::Remove" );
+ //////////////////////////////////////////////////////////////////////
+ // Form und Parent holen
+ if (!pEntry || !m_pFormModel)
+ return;
+
+ if (IsListening(*m_pFormModel))
+ EndListening(*m_pFormModel);
+
+ const bool bUndo = m_pFormModel->IsUndoEnabled();
+
+ m_pPropChangeList->Lock();
+ FmFormData* pFolder = (FmFormData*) pEntry->GetParent();
+ Reference< XChild > xElement ( pEntry->GetChildIFace() );
+ if (bAlterModel)
+ {
+ XubString aStr;
+ if (pEntry->ISA(FmFormData))
+ aStr = SVX_RES(RID_STR_FORM);
+ else
+ aStr = SVX_RES(RID_STR_CONTROL);
+
+ if( bUndo )
+ {
+ XubString aUndoStr(SVX_RES(RID_STR_UNDO_CONTAINER_REMOVE));
+ aUndoStr.SearchAndReplace('#', aStr);
+ m_pFormModel->BegUndo(aUndoStr);
+ }
+ }
+
+ // jetzt die eigentliche Entfernung der Daten aus dem Model
+ if (pEntry->ISA(FmFormData))
+ RemoveForm((FmFormData*)pEntry);
+ else
+ RemoveFormComponent((FmControlData*)pEntry);
+
+
+ if (bAlterModel)
+ {
+ Reference< XIndexContainer > xContainer(xElement->getParent(), UNO_QUERY);
+ // aus dem Container entfernen
+ sal_Int32 nContainerIndex = getElementPos(xContainer.get(), xElement);
+ // UndoAction
+ if (nContainerIndex >= 0)
+ {
+ if ( bUndo && m_pPropChangeList->CanUndo())
+ {
+ m_pFormModel->AddUndo(new FmUndoContainerAction(*m_pFormModel,
+ FmUndoContainerAction::Removed,
+ xContainer,
+ xElement, nContainerIndex ));
+ }
+ else if( !m_pPropChangeList->CanUndo() )
+ {
+ FmUndoContainerAction::DisposeElement( xElement );
+ }
+
+ xContainer->removeByIndex(nContainerIndex );
+ }
+
+ if( bUndo )
+ m_pFormModel->EndUndo();
+ }
+
+ // beim Vater austragen
+ if (pFolder)
+ pFolder->GetChildList()->Remove(pEntry);
+ else
+ {
+ GetRootList()->Remove(pEntry);
+ //////////////////////////////////////////////////////////////////////
+ // Wenn keine Form mehr in der Root, an der Shell CurForm zuruecksetzen
+ if (!GetRootList()->Count())
+ m_pFormShell->GetImpl()->forgetCurrentForm();
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // UI benachrichtigen
+ FmNavRemovedHint aRemovedHint( pEntry );
+ Broadcast( aRemovedHint );
+
+ // Eintrag loeschen
+ delete pEntry;
+
+ m_pPropChangeList->UnLock();
+ StartListening(*m_pFormModel);
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTreeModel::RemoveForm(FmFormData* pFormData)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::RemoveForm" );
+ //////////////////////////////////////////////////////////////////////
+ // Form und Parent holen
+ if (!pFormData || !m_pFormModel)
+ return;
+
+ FmEntryDataList* pChildList = pFormData->GetChildList();
+ sal_uInt32 nCount = pChildList->Count();
+ for (sal_uInt32 i = nCount; i > 0; i--)
+ {
+ FmEntryData* pEntryData = pChildList->GetObject(i - 1);
+
+ //////////////////////////////////////////////////////////////////////
+ // Child ist Form -> rekursiver Aufruf
+ if( pEntryData->ISA(FmFormData) )
+ RemoveForm( (FmFormData*)pEntryData);
+ else if( pEntryData->ISA(FmControlData) )
+ RemoveFormComponent((FmControlData*) pEntryData);
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // Als PropertyChangeListener abmelden
+ Reference< XPropertySet > xSet( pFormData->GetPropertySet() );
+ if ( xSet.is() )
+ xSet->removePropertyChangeListener( FM_PROP_NAME, m_pPropChangeList );
+
+ Reference< XContainer > xContainer( pFormData->GetContainer() );
+ if (xContainer.is())
+ xContainer->removeContainerListener((XContainerListener*)m_pPropChangeList);
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTreeModel::RemoveFormComponent(FmControlData* pControlData)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::RemoveFormComponent" );
+ //////////////////////////////////////////////////////////////////////
+ // Control und Parent holen
+ if (!pControlData)
+ return;
+
+ //////////////////////////////////////////////////////////////////////
+ // Als PropertyChangeListener abmelden
+ Reference< XPropertySet > xSet( pControlData->GetPropertySet() );
+ if (xSet.is())
+ xSet->removePropertyChangeListener( FM_PROP_NAME, m_pPropChangeList);
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTreeModel::ClearBranch( FmFormData* pParentData )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::ClearBranch" );
+ //////////////////////////////////////////////////////////////////////
+ // Alle Eintraege dieses Zweiges loeschen
+ FmEntryDataList* pChildList = pParentData->GetChildList();
+ FmEntryData* pChildData;
+
+ for( sal_uInt32 i=pChildList->Count(); i>0; i-- )
+ {
+ pChildData = pChildList->GetObject(i-1);
+ if( pChildData->ISA(FmFormData) )
+ ClearBranch( (FmFormData*)pChildData );
+
+ pChildList->Remove( pChildData );
+ }
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTreeModel::FillBranch( FmFormData* pFormData )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::FillBranch" );
+ //////////////////////////////////////////////////////////////
+ // Forms aus der Root einfuegen
+ if( pFormData == NULL )
+ {
+ Reference< XIndexContainer > xForms(GetForms(), UNO_QUERY);
+ if (!xForms.is())
+ return;
+
+ Reference< XForm > xSubForm;
+ FmFormData* pSubFormData;
+ for (sal_Int32 i=0; i<xForms->getCount(); ++i)
+ {
+ DBG_ASSERT( xForms->getByIndex(i).getValueType() == ::getCppuType((const Reference< XForm>*)NULL),
+ "NavigatorTreeModel::FillBranch : the root container should supply only elements of type XForm");
+
+ xForms->getByIndex(i) >>= xSubForm;
+ pSubFormData = new FmFormData( xSubForm, m_aNormalImages, m_aHCImages, pFormData );
+ Insert( pSubFormData, LIST_APPEND );
+
+ //////////////////////////////////////////////////////////////
+ // Neuer Branch, wenn SubForm wiederum Subforms enthaelt
+ FillBranch( pSubFormData );
+ }
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Componenten einfuegen
+ else
+ {
+ Reference< XIndexContainer > xComponents( GetFormComponents(pFormData));
+ if( !xComponents.is() ) return;
+
+ ::rtl::OUString aControlName;
+ Reference< XInterface > xInterface;
+ Reference< XPropertySet > xSet;
+ FmControlData* pNewControlData;
+ FmFormData* pSubFormData;
+
+ Reference< XFormComponent > xCurrentComponent;
+ for (sal_Int32 j=0; j<xComponents->getCount(); ++j)
+ {
+ xComponents->getByIndex(j) >>= xCurrentComponent;
+ Reference< XForm > xSubForm(xCurrentComponent, UNO_QUERY);
+
+ if (xSubForm.is())
+ { // die aktuelle Component ist eine Form
+ pSubFormData = new FmFormData(xSubForm, m_aNormalImages, m_aHCImages, pFormData);
+ Insert(pSubFormData, LIST_APPEND);
+
+ //////////////////////////////////////////////////////////////
+ // Neuer Branch, wenn SubForm wiederum Subforms enthaelt
+ FillBranch(pSubFormData);
+ }
+ else
+ {
+ pNewControlData = new FmControlData(xCurrentComponent, m_aNormalImages, m_aHCImages, pFormData);
+ Insert(pNewControlData, LIST_APPEND);
+ }
+ }
+ }
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTreeModel::InsertForm(const Reference< XForm > & xForm, sal_uInt32 nRelPos)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::InsertForm" );
+ FmFormData* pFormData = (FmFormData*)FindData( xForm, GetRootList() );
+ if (pFormData)
+ return;
+
+ //////////////////////////////////////////////////////////
+ // ParentData setzen
+ Reference< XInterface > xIFace( xForm->getParent());
+ Reference< XForm > xParentForm(xIFace, UNO_QUERY);
+ FmFormData* pParentData = NULL;
+ if (xParentForm.is())
+ pParentData = (FmFormData*)FindData( xParentForm, GetRootList() );
+
+ pFormData = new FmFormData( xForm, m_aNormalImages, m_aHCImages, pParentData );
+ Insert( pFormData, nRelPos );
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTreeModel::InsertFormComponent(const Reference< XFormComponent > & xComp, sal_uInt32 nRelPos)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::InsertFormComponent" );
+ //////////////////////////////////////////////////////////
+ // ParentData setzen
+ Reference< XInterface > xIFace( xComp->getParent());
+ Reference< XForm > xForm(xIFace, UNO_QUERY);
+ if (!xForm.is())
+ return;
+
+ FmFormData* pParentData = (FmFormData*)FindData( xForm, GetRootList() );
+ if( !pParentData )
+ {
+ pParentData = new FmFormData( xForm, m_aNormalImages, m_aHCImages, NULL );
+ Insert( pParentData, LIST_APPEND );
+ }
+
+ if (!FindData(xComp, pParentData->GetChildList(),sal_False))
+ {
+ //////////////////////////////////////////////////////////
+ // Neue EntryData setzen
+ FmEntryData* pNewEntryData = new FmControlData( xComp, m_aNormalImages, m_aHCImages, pParentData );
+
+ //////////////////////////////////////////////////////////
+ // Neue EntryData einfuegen
+ Insert( pNewEntryData, nRelPos );
+ }
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTreeModel::ReplaceFormComponent(const Reference< XFormComponent > & xOld, const Reference< XFormComponent > & xNew)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::ReplaceFormComponent" );
+ FmEntryData* pData = FindData(xOld, GetRootList(), sal_True);
+ DBG_ASSERT(pData && pData->ISA(FmControlData), "NavigatorTreeModel::ReplaceFormComponent : invalid argument !");
+ ((FmControlData*)pData)->ModelReplaced( xNew, m_aNormalImages, m_aHCImages );
+
+ FmNavModelReplacedHint aReplacedHint( pData );
+ Broadcast( aReplacedHint );
+ }
+
+ //------------------------------------------------------------------------
+ FmEntryData* NavigatorTreeModel::FindData(const Reference< XInterface > & xElement, FmEntryDataList* pDataList, sal_Bool bRecurs)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::FindData" );
+ // normalize
+ Reference< XInterface > xIFace( xElement, UNO_QUERY );
+
+ for (sal_uInt16 i=0; i < pDataList->Count(); i++)
+ {
+ FmEntryData* pEntryData = pDataList->GetObject(i);
+ if ( pEntryData->GetElement().get() == xIFace.get() )
+ return pEntryData;
+ else if (bRecurs)
+ {
+ pEntryData = FindData( xElement, pEntryData->GetChildList() );
+ if (pEntryData)
+ return pEntryData;
+ }
+ }
+ return NULL;
+ }
+
+ //------------------------------------------------------------------------
+ FmEntryData* NavigatorTreeModel::FindData( const ::rtl::OUString& rText, FmFormData* pParentData, sal_Bool bRecurs )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::FindData" );
+ FmEntryDataList* pDataList;
+ if( !pParentData )
+ pDataList = GetRootList();
+ else
+ pDataList = pParentData->GetChildList();
+
+ ::rtl::OUString aEntryText;
+ FmEntryData* pEntryData;
+ FmEntryData* pChildData;
+
+ for( sal_uInt16 i=0; i<pDataList->Count(); i++ )
+ {
+ pEntryData = pDataList->GetObject(i);
+ aEntryText = pEntryData->GetText();
+
+ if (rText == aEntryText)
+ return pEntryData;
+
+ if( bRecurs && pEntryData->ISA(FmFormData) )
+ {
+ pChildData = FindData( rText, (FmFormData*)pEntryData );
+ if( pChildData )
+ return pChildData;
+ }
+ }
+
+ return NULL;
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTreeModel::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::Notify" );
+ if( rHint.ISA(SdrHint) )
+ {
+ SdrHint* pSdrHint = (SdrHint*)&rHint;
+ switch( pSdrHint->GetKind() )
+ {
+ case HINT_OBJINSERTED:
+ InsertSdrObj(pSdrHint->GetObject());
+ break;
+ case HINT_OBJREMOVED:
+ RemoveSdrObj(pSdrHint->GetObject());
+ break;
+ default:
+ break;
+ }
+ }
+ // hat sich die shell verabschiedet?
+ else if ( rHint.ISA(SfxSimpleHint) && ((SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING)
+ UpdateContent((FmFormShell*)NULL);
+
+ // hat sich die Markierung der Controls veraendert ?
+ else if (rHint.ISA(FmNavViewMarksChanged))
+ {
+ FmNavViewMarksChanged* pvmcHint = (FmNavViewMarksChanged*)&rHint;
+ BroadcastMarkedObjects( pvmcHint->GetAffectedView()->GetMarkedObjectList() );
+ }
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTreeModel::InsertSdrObj( const SdrObject* pObj )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::InsertSdrObj" );
+ const FmFormObj* pFormObject = FmFormObj::GetFormObject( pObj );
+ if ( pFormObject )
+ {
+ try
+ {
+ Reference< XFormComponent > xFormComponent( pFormObject->GetUnoControlModel(), UNO_QUERY_THROW );
+ Reference< XIndexAccess > xContainer( xFormComponent->getParent(), UNO_QUERY_THROW );
+
+ sal_Int32 nPos = getElementPos( xContainer, xFormComponent );
+ InsertFormComponent( xFormComponent, nPos );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ else if ( pObj->IsGroupObject() )
+ {
+ SdrObjListIter aIter( *pObj->GetSubList() );
+ while ( aIter.IsMore() )
+ InsertSdrObj( aIter.Next() );
+ }
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTreeModel::RemoveSdrObj( const SdrObject* pObj )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::RemoveSdrObj" );
+ const FmFormObj* pFormObject = FmFormObj::GetFormObject( pObj );
+ if ( pFormObject )
+ {
+ try
+ {
+ Reference< XFormComponent > xFormComponent( pFormObject->GetUnoControlModel(), UNO_QUERY_THROW );
+ FmEntryData* pEntryData = FindData( xFormComponent, GetRootList(), sal_True );
+ if ( pEntryData )
+ Remove( pEntryData );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ else if ( pObj->IsGroupObject() )
+ {
+ SdrObjListIter aIter( *pObj->GetSubList() );
+ while ( aIter.IsMore() )
+ RemoveSdrObj( aIter.Next() );
+ }
+ }
+
+ sal_Bool NavigatorTreeModel::InsertFormComponent(FmNavRequestSelectHint& rHint, SdrObject* pObject)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::InsertFormComponent" );
+ if ( pObject->ISA(SdrObjGroup) )
+ { // rekursiv absteigen
+ const SdrObjList *pChilds = ((SdrObjGroup*)pObject)->GetSubList();
+ for ( sal_uInt16 i=0; i<pChilds->GetObjCount(); ++i )
+ {
+ SdrObject* pCurrent = pChilds->GetObj(i);
+ if (!InsertFormComponent(rHint, pCurrent))
+ return sal_False;
+ }
+ }
+ else
+ {
+ FmFormObj* pFormObject = FmFormObj::GetFormObject( pObject );
+ if ( !pFormObject )
+ return sal_False;
+
+ try
+ {
+ Reference< XFormComponent > xFormViewControl( pFormObject->GetUnoControlModel(), UNO_QUERY_THROW );
+ FmEntryData* pControlData = FindData( xFormViewControl, GetRootList() );
+ if ( !pControlData )
+ return sal_False;
+
+ rHint.AddItem( pControlData );
+ return sal_True;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ return sal_False;
+ }
+ }
+
+ return sal_True;
+ }
+
+ void NavigatorTreeModel::BroadcastMarkedObjects(const SdrMarkList& mlMarked)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::BroadcastMarkedObjects" );
+ // gehen wir durch alle markierten Objekte und suchen wir die raus, mit denen ich was anfangen kann
+ FmNavRequestSelectHint rshRequestSelection;
+ sal_Bool bIsMixedSelection = sal_False;
+
+ for (sal_uLong i=0; (i<mlMarked.GetMarkCount()) && !bIsMixedSelection; i++)
+ {
+ SdrObject* pobjCurrent = mlMarked.GetMark(i)->GetMarkedSdrObj();
+ bIsMixedSelection |= !InsertFormComponent(rshRequestSelection, pobjCurrent);
+ // bei einem Nicht-Form-Control liefert InsertFormComponent sal_False !
+ }
+
+ rshRequestSelection.SetMixedSelection(bIsMixedSelection);
+ if (bIsMixedSelection)
+ rshRequestSelection.ClearItems();
+
+ Broadcast(rshRequestSelection);
+ // eine leere Liste interpretiert der NavigatorTree so, dass er seine Selektion komplett rausnimmt
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTreeModel::UpdateContent( const Reference< XNameContainer > & xForms )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::UpdateContent" );
+ //////////////////////////////////////////////////////////////////////
+ // Model von der Root aufwaerts neu fuellen
+ Clear();
+ if (xForms.is())
+ {
+ Reference< XContainer > xFormContainer(xForms, UNO_QUERY);
+ if (xFormContainer.is())
+ xFormContainer->addContainerListener((XContainerListener*)m_pPropChangeList);
+
+ FillBranch(NULL);
+
+ // jetzt in meinem Tree genau die das in meiner View markierte Control selektieren
+ // (bzw alle solchen), falls es eines gibt ...
+ if(!m_pFormShell) return; // keine Shell -> wech
+
+ FmFormView* pFormView = m_pFormShell->GetFormView();
+ DBG_ASSERT(pFormView != NULL, "NavigatorTreeModel::UpdateContent : keine FormView");
+ BroadcastMarkedObjects(pFormView->GetMarkedObjectList());
+ }
+ }
+
+ //------------------------------------------------------------------------
+ void NavigatorTreeModel::UpdateContent( FmFormShell* pShell )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::UpdateContent" );
+ //////////////////////////////////////////////////////////////////////
+ // Wenn Shell sich nicht veraendert hat, nichts machen
+ FmFormPage* pNewPage = pShell ? pShell->GetCurPage() : NULL;
+ if ((pShell == m_pFormShell) && (m_pFormPage == pNewPage))
+ return;
+
+ //////////////////////////////////////////////////////////////////////
+ // Als Listener abmelden
+ if( m_pFormShell )
+ {
+ if (m_pFormModel)
+ EndListening( *m_pFormModel );
+ m_pFormModel = NULL;
+ EndListening( *m_pFormShell );
+ Clear();
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // Vollupdate
+ m_pFormShell = pShell;
+ if (m_pFormShell)
+ {
+ m_pFormPage = pNewPage;
+ UpdateContent(m_pFormPage->GetForms());
+ } else
+ m_pFormPage = NULL;
+
+ //////////////////////////////////////////////////////////////////////
+ // Als Listener neu anmelden
+ if( m_pFormShell )
+ {
+ StartListening( *m_pFormShell );
+ m_pFormModel = m_pFormShell->GetFormModel();
+ if( m_pFormModel )
+ StartListening( *m_pFormModel );
+ }
+ }
+
+ //------------------------------------------------------------------------
+ Reference< XIndexContainer > NavigatorTreeModel::GetFormComponents( FmFormData* pFormData )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::GetFormComponents" );
+ //////////////////////////////////////////////////////////////////////
+ // Von der Form Components holen
+ if (pFormData)
+ return Reference< XIndexContainer > (pFormData->GetFormIface(), UNO_QUERY);
+
+ return Reference< XIndexContainer > ();
+ }
+
+ //------------------------------------------------------------------------
+ sal_Bool NavigatorTreeModel::CheckEntry( FmEntryData* pEntryData )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::CheckEntry" );
+ //////////////////////////////////////////////////////////////////////
+ // Nur Forms duerfen auf Doppeldeutigkeit untersucht werden
+ if( !pEntryData->ISA(FmFormData) ) return sal_True;
+
+ //////////////////////////////////////////////////////////////////////
+ // ChildListe des Parents holen
+ FmFormData* pParentData = (FmFormData*)pEntryData->GetParent();
+ FmEntryDataList* pChildList;
+ if( !pParentData )
+ pChildList = GetRootList();
+ else
+ pChildList = pParentData->GetChildList();
+
+ //////////////////////////////////////////////////////////////////////
+ // In ChildListe nach doppelten Namen suchen
+ ::rtl::OUString aChildText;
+ FmEntryData* pChildData;
+
+ for( sal_uInt16 i=0; i<pChildList->Count(); i++ )
+ {
+ pChildData = pChildList->GetObject(i);
+ aChildText = pChildData->GetText();
+
+ //////////////////////////////////////////////////////////////////////
+ // Gleichen Eintrag gefunden
+ if ( (aChildText == pEntryData->GetText())
+ && (pEntryData!=pChildData)
+ )
+ {
+
+
+ SQLContext aError;
+ aError.Message = String(SVX_RES(RID_ERR_CONTEXT_ADDFORM));
+ aError.Details = String(SVX_RES(RID_ERR_DUPLICATE_NAME));
+ displayException(aError);
+
+ return sal_False;
+ }
+ }
+
+ return sal_True;
+ }
+
+ //------------------------------------------------------------------------
+ sal_Bool NavigatorTreeModel::Rename( FmEntryData* pEntryData, const ::rtl::OUString& rNewText )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::Rename" );
+ //////////////////////////////////////////////////////////////////////
+ // Wenn Name schon vorhanden, Fehlermeldung
+ pEntryData->SetText( rNewText );
+
+ //////////////////////////////////////////////////////////////////////
+ // PropertySet besorgen
+ Reference< XFormComponent > xFormComponent;
+
+ if( pEntryData->ISA(FmFormData) )
+ {
+ FmFormData* pFormData = (FmFormData*)pEntryData;
+ Reference< XForm > xForm( pFormData->GetFormIface());
+ xFormComponent = Reference< XFormComponent > (xForm, UNO_QUERY);
+ }
+
+ if( pEntryData->ISA(FmControlData) )
+ {
+ FmControlData* pControlData = (FmControlData*)pEntryData;
+ xFormComponent = pControlData->GetFormComponent();
+ }
+
+ if( !xFormComponent.is() ) return sal_False;
+ Reference< XPropertySet > xSet(xFormComponent, UNO_QUERY);
+ if( !xSet.is() ) return sal_False;
+
+ //////////////////////////////////////////////////////////////////////
+ // Namen setzen
+ xSet->setPropertyValue( FM_PROP_NAME, makeAny(rNewText) );
+
+ return sal_True;
+ }
+
+ //------------------------------------------------------------------------
+ sal_Bool NavigatorTreeModel::IsNameAlreadyDefined( const ::rtl::OUString& rName, FmFormData* pParentData )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::IsNameAlreadyDefined" );
+ //////////////////////////////////////////////////////////////////////
+ // Form in der Root
+ if( !pParentData )
+ {
+ if (GetForms()->hasByName(rName))
+ return sal_True;
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // Restliche Components
+ else
+ {
+ Reference< XNameContainer > xFormComponents(GetFormComponents(pParentData), UNO_QUERY);
+ if (xFormComponents.is() && xFormComponents->hasByName(rName))
+ return sal_True;
+ }
+
+ return sal_False;
+ }
+
+ //------------------------------------------------------------------------
+ SdrObject* NavigatorTreeModel::GetSdrObj( FmControlData* pControlData )
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::GetSdrObj" );
+ if (!pControlData || !m_pFormShell)
+ return NULL;
+
+ //////////////////////////////////////////////////////////////////////
+ // In der Page das entsprechende SdrObj finden und selektieren
+ Reference< XFormComponent > xFormComponent( pControlData->GetFormComponent());
+ if (!xFormComponent.is())
+ return NULL;
+
+ FmFormView* pFormView = m_pFormShell->GetFormView();
+ SdrPageView* pPageView = pFormView->GetSdrPageView();
+ SdrPage* pPage = pPageView->GetPage();
+
+ SdrObjListIter aIter( *pPage );
+ return Search(aIter, xFormComponent);
+ }
+
+ //------------------------------------------------------------------
+ SdrObject* NavigatorTreeModel::Search(SdrObjListIter& rIter, const Reference< XFormComponent > & xComp)
+ {
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "NavigatorTreeModel::Search" );
+ while (rIter.IsMore())
+ {
+ SdrObject* pObj = rIter.Next();
+ FmFormObj* pFormObject = FmFormObj::GetFormObject( pObj );
+ if ( pFormObject )
+ {
+ Reference< XFormComponent > xFormViewControl( pFormObject->GetUnoControlModel(), UNO_QUERY );
+ if ( xFormViewControl == xComp )
+ return pObj;
+ }
+ else if ( pObj->IsGroupObject() )
+ {
+ SdrObjListIter aIter( *pObj->GetSubList() );
+ pObj = Search( aIter, xComp );
+ if ( pObj )
+ return pObj;
+ }
+ }
+ return NULL;
+ }
+
+//............................................................................
+} // namespace svxform
+//............................................................................
+
+
diff --git a/svx/source/form/sdbdatacolumn.cxx b/svx/source/form/sdbdatacolumn.cxx
new file mode 100644
index 000000000000..a3fa90d9e0c5
--- /dev/null
+++ b/svx/source/form/sdbdatacolumn.cxx
@@ -0,0 +1,287 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "sdbdatacolumn.hxx"
+
+//..............................................................................
+namespace svxform
+{
+//..............................................................................
+
+ 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::util;
+ using namespace ::com::sun::star::io;
+ using namespace ::com::sun::star::container;
+
+ //==========================================================================
+ //= DataColumn - a class wrapping an object implementing a sdb::DataColumn service
+ //==========================================================================
+ DataColumn::DataColumn(const Reference< ::com::sun::star::beans::XPropertySet>& _rxIFace)
+ {
+ m_xPropertySet = _rxIFace;
+ m_xColumn = Reference< ::com::sun::star::sdb::XColumn>(_rxIFace, UNO_QUERY);
+ m_xColumnUpdate = Reference< ::com::sun::star::sdb::XColumnUpdate>(_rxIFace, UNO_QUERY);
+
+ if (!m_xPropertySet.is() || !m_xColumn.is())
+ {
+ m_xPropertySet = NULL;
+ m_xColumn = NULL;
+ m_xColumnUpdate = NULL;
+ }
+ }
+
+ // Reference< XPropertySet>
+ Reference< XPropertySetInfo> DataColumn::getPropertySetInfo() const throw( RuntimeException )
+ {
+ return m_xPropertySet->getPropertySetInfo();
+ }
+
+ void DataColumn::setPropertyValue(const ::rtl::OUString& aPropertyName, const Any& aValue) throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException )
+ {
+ m_xPropertySet->setPropertyValue(aPropertyName, aValue);
+ }
+
+ Any DataColumn::getPropertyValue(const ::rtl::OUString& PropertyName) const throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+ {
+ return m_xPropertySet->getPropertyValue(PropertyName);
+ }
+
+ void DataColumn::addPropertyChangeListener(const ::rtl::OUString& aPropertyName, const Reference< XPropertyChangeListener>& xListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+ {
+ m_xPropertySet->addPropertyChangeListener(aPropertyName, xListener);
+ }
+
+ void DataColumn::removePropertyChangeListener(const ::rtl::OUString& aPropertyName, const Reference< XPropertyChangeListener>& aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+ {
+ m_xPropertySet->removePropertyChangeListener(aPropertyName, aListener);
+ }
+
+ void DataColumn::addVetoableChangeListener(const ::rtl::OUString& PropertyName, const Reference< XVetoableChangeListener>& aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+ {
+ m_xPropertySet->addVetoableChangeListener(PropertyName, aListener);
+ }
+
+ void DataColumn::removeVetoableChangeListener(const ::rtl::OUString& PropertyName, const Reference< XVetoableChangeListener>& aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+ {
+ m_xPropertySet->removeVetoableChangeListener(PropertyName, aListener);
+ }
+
+ // XColumn
+ sal_Bool DataColumn::wasNull() throw( SQLException, RuntimeException )
+ {
+ return m_xColumn->wasNull();
+ }
+
+ ::rtl::OUString DataColumn::getString() throw( SQLException, RuntimeException )
+ {
+ return m_xColumn->getString();
+ }
+
+ sal_Bool DataColumn::getBoolean() throw( SQLException, RuntimeException )
+ {
+ return m_xColumn->getBoolean();
+ }
+
+ sal_Int8 DataColumn::getByte() throw( SQLException, RuntimeException )
+ {
+ return m_xColumn->getByte();
+ }
+
+ sal_Int16 DataColumn::getShort() throw( SQLException, RuntimeException )
+ {
+ return m_xColumn->getShort();
+ }
+
+ sal_Int32 DataColumn::getInt() throw( SQLException, RuntimeException )
+ {
+ return m_xColumn->getInt();
+ }
+
+ sal_Int64 DataColumn::getLong() throw( SQLException, RuntimeException )
+ {
+ return m_xColumn->getLong();
+ }
+
+ float DataColumn::getFloat() throw( SQLException, RuntimeException )
+ {
+ return m_xColumn->getFloat();
+ }
+
+ double DataColumn::getDouble() throw( SQLException, RuntimeException )
+ {
+ return m_xColumn->getDouble();
+ }
+
+ Sequence< sal_Int8 > DataColumn::getBytes() throw( SQLException, RuntimeException )
+ {
+ return m_xColumn->getBytes();
+ }
+
+ com::sun::star::util::Date DataColumn::getDate() throw( SQLException, RuntimeException )
+ {
+ return m_xColumn->getDate();
+ }
+
+ com::sun::star::util::Time DataColumn::getTime() throw( SQLException, RuntimeException )
+ {
+ return m_xColumn->getTime();
+ }
+
+ com::sun::star::util::DateTime DataColumn::getTimestamp() throw( SQLException, RuntimeException )
+ {
+ return m_xColumn->getTimestamp();
+ }
+
+ Reference< XInputStream> DataColumn::getBinaryStream() throw( SQLException, RuntimeException )
+ {
+ return m_xColumn->getBinaryStream();
+ }
+
+ Reference< XInputStream> DataColumn::getCharacterStream() throw( SQLException, RuntimeException )
+ {
+ return m_xColumn->getCharacterStream();
+ }
+
+ Any DataColumn::getObject(const Reference< XNameAccess>& typeMap) throw( SQLException, RuntimeException )
+ {
+ return m_xColumn->getObject(typeMap);
+ }
+
+ Reference< XRef> DataColumn::getRef() throw( SQLException, RuntimeException )
+ {
+ return m_xColumn->getRef();
+ }
+
+ Reference< XBlob> DataColumn::getBlob() throw( SQLException, RuntimeException )
+ {
+ return m_xColumn->getBlob();
+ }
+
+ Reference< XClob> DataColumn::getClob() throw( SQLException, RuntimeException )
+ {
+ return m_xColumn->getClob();
+ }
+
+ Reference< XArray> DataColumn::getArray() throw( SQLException, RuntimeException )
+ {
+ return m_xColumn->getArray();
+ }
+
+ // XColumnUpdate
+ void DataColumn::updateNull() throw( SQLException, RuntimeException )
+ {
+ m_xColumnUpdate->updateNull();
+ }
+
+ void DataColumn::updateBoolean(sal_Bool x) throw( SQLException, RuntimeException )
+ {
+ m_xColumnUpdate->updateBoolean(x);
+ }
+
+ void DataColumn::updateByte(sal_Int8 x) throw( SQLException, RuntimeException )
+ {
+ m_xColumnUpdate->updateByte(x);
+ }
+
+ void DataColumn::updateShort(sal_Int16 x) throw( SQLException, RuntimeException )
+ {
+ m_xColumnUpdate->updateShort(x);
+ }
+
+ void DataColumn::updateInt(sal_Int32 x) throw( SQLException, RuntimeException )
+ {
+ m_xColumnUpdate->updateInt(x);
+ }
+
+ void DataColumn::updateLong(sal_Int64 x) throw( SQLException, RuntimeException )
+ {
+ m_xColumnUpdate->updateLong(x);
+ }
+
+ void DataColumn::updateFloat(float x) throw( SQLException, RuntimeException )
+ {
+ m_xColumnUpdate->updateFloat(x);
+ }
+
+ void DataColumn::updateDouble(double x) throw( SQLException, RuntimeException )
+ {
+ m_xColumnUpdate->updateDouble(x);
+ }
+
+ void DataColumn::updateString(const ::rtl::OUString& x) throw( SQLException, RuntimeException )
+ {
+ m_xColumnUpdate->updateString(x);
+ }
+
+ void DataColumn::updateBytes(const Sequence< sal_Int8 >& x) throw( SQLException, RuntimeException )
+ {
+ m_xColumnUpdate->updateBytes(x);
+ }
+
+ void DataColumn::updateDate(const com::sun::star::util::Date& x) throw( SQLException, RuntimeException )
+ {
+ m_xColumnUpdate->updateDate(x);
+ }
+
+ void DataColumn::updateTime(const com::sun::star::util::Time& x) throw( SQLException, RuntimeException )
+ {
+ m_xColumnUpdate->updateTime(x);
+ }
+
+ void DataColumn::updateTimestamp(const com::sun::star::util::DateTime& x) throw( SQLException, RuntimeException )
+ {
+ m_xColumnUpdate->updateTimestamp(x);
+ }
+
+ void DataColumn::updateBinaryStream(const Reference< XInputStream>& x, sal_Int32 length) throw( SQLException, RuntimeException )
+ {
+ m_xColumnUpdate->updateBinaryStream(x, length);
+ }
+
+ void DataColumn::updateCharacterStream(const Reference< XInputStream>& x, sal_Int32 length) throw( SQLException, RuntimeException )
+ {
+ m_xColumnUpdate->updateCharacterStream(x, length);
+ }
+
+ void DataColumn::updateObject(const Any& x) throw( SQLException, RuntimeException )
+ {
+ m_xColumnUpdate->updateObject(x);
+ }
+
+ void DataColumn::updateNumericObject(const Any& x, sal_Int32 scale) throw( SQLException, RuntimeException )
+ {
+ m_xColumnUpdate->updateNumericObject(x, scale);
+ }
+
+ //..............................................................................
+} // namespace svxform
+//..............................................................................
diff --git a/svx/source/form/sqlparserclient.cxx b/svx/source/form/sqlparserclient.cxx
new file mode 100644
index 000000000000..a63db6e96d62
--- /dev/null
+++ b/svx/source/form/sqlparserclient.cxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "sqlparserclient.hxx"
+#include "svx/ParseContext.hxx"
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+
+ //====================================================================
+ //= OSQLParserClient
+ //====================================================================
+ //--------------------------------------------------------------------
+ OSQLParserClient::OSQLParserClient(const Reference< XMultiServiceFactory >& _rxORB)
+ {
+ m_xORB = _rxORB;
+ }
+ //--------------------------------------------------------------------
+ bool OSQLParserClient::ensureLoaded() const
+ {
+ if ( !ODbtoolsClient::ensureLoaded() )
+ return false;
+ m_xParser = getFactory()->createSQLParser(m_xORB,getParseContext());
+ return m_xParser.is();
+ }
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
+
diff --git a/svx/source/form/stringlistresource.cxx b/svx/source/form/stringlistresource.cxx
new file mode 100644
index 000000000000..06f8814a9721
--- /dev/null
+++ b/svx/source/form/stringlistresource.cxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "stringlistresource.hxx"
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+#include <tools/rcid.h>
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ /** === begin UNO using === **/
+ /** === end UNO using === **/
+
+ //====================================================================
+ //= StringListResource
+ //====================================================================
+ //--------------------------------------------------------------------
+ StringListResource::StringListResource( const ResId& _rResId )
+ :Resource( _rResId )
+ {
+ sal_uInt16 nLocalID = 1;
+ ResId aLocalID( nLocalID, *_rResId.GetResMgr() );
+ while ( IsAvailableRes( aLocalID.SetRT( RSC_STRING ) ) )
+ {
+ String sLocalString( aLocalID );
+ m_aStrings.push_back( sLocalString );
+ aLocalID = ResId( ++nLocalID, *_rResId.GetResMgr() );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ StringListResource::~StringListResource()
+ {
+ FreeResource();
+ }
+
+//........................................................................
+} // namespace svx
+//........................................................................
diff --git a/svx/source/form/tabwin.cxx b/svx/source/form/tabwin.cxx
new file mode 100644
index 000000000000..d8bff05bf599
--- /dev/null
+++ b/svx/source/form/tabwin.cxx
@@ -0,0 +1,476 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "tabwin.hxx"
+#include "svx/fmtools.hxx"
+#include "fmservs.hxx"
+#include "stringlistresource.hxx"
+
+#include <svx/svxids.hrc>
+#include <svx/dbaexchange.hxx>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#include <com/sun/star/sdb/XQueriesSupplier.hpp>
+#include <com/sun/star/sdbc/XPreparedStatement.hpp>
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include <com/sun/star/util/XLocalizedAliases.hpp>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/stl_types.hxx>
+
+#ifndef _SVX_FMHELP_HRC
+#include "fmhelp.hrc"
+#endif
+#include <svx/fmshell.hxx>
+#include "fmshimp.hxx"
+#include "svx/dbtoolsclient.hxx"
+#include <svx/fmpage.hxx>
+
+#ifndef _SVX_FMPGEIMP_HXX
+#include "fmpgeimp.hxx"
+#endif
+
+#ifndef _SVX_FMPROP_HRC
+#include "fmprop.hrc"
+#endif
+
+#ifndef _SVX_FMRESIDS_HRC
+#include "svx/fmresids.hrc"
+#endif
+#include <svx/dialmgr.hxx>
+#include <tools/shl.hxx>
+#include <svx/svdpagv.hxx>
+#include <sfx2/objitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <comphelper/property.hxx>
+#include <sfx2/frame.hxx>
+#include <svx/dataaccessdescriptor.hxx>
+
+const long STD_WIN_POS_X = 50;
+const long STD_WIN_POS_Y = 50;
+
+const long STD_WIN_SIZE_X = 120;
+const long STD_WIN_SIZE_Y = 150;
+
+const long MIN_WIN_SIZE_X = 50;
+const long MIN_WIN_SIZE_Y = 50;
+
+const long LISTBOX_BORDER = 2;
+
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::datatransfer;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::form;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star;
+using namespace ::svxform;
+using namespace ::svx;
+
+
+struct ColumnInfo
+{
+ ::rtl::OUString sColumnName;
+ ::rtl::OUString sLabel;
+ bool bColumn;
+ ColumnInfo(const ::rtl::OUString& i_sColumnName,const ::rtl::OUString& i_sLabel)
+ : sColumnName(i_sColumnName)
+ , sLabel(i_sLabel)
+ , bColumn(true)
+ {
+ }
+ ColumnInfo(const ::rtl::OUString& i_sColumnName)
+ : sColumnName(i_sColumnName)
+ , bColumn(false)
+ {
+ }
+};
+
+void lcl_addToList( SvTreeListBox& _rListBox, const uno::Reference< container::XNameAccess>& i_xColumns )
+{
+ uno::Sequence< ::rtl::OUString > aEntries = i_xColumns->getElementNames();
+ const ::rtl::OUString* pEntries = aEntries.getConstArray();
+ sal_Int32 nEntries = aEntries.getLength();
+ for ( sal_Int32 i = 0; i < nEntries; ++i, ++pEntries )
+ {
+ uno::Reference< beans::XPropertySet> xColumn(i_xColumns->getByName(*pEntries),UNO_QUERY_THROW);
+ ::rtl::OUString sLabel;
+ if ( xColumn->getPropertySetInfo()->hasPropertyByName(FM_PROP_LABEL) )
+ xColumn->getPropertyValue(FM_PROP_LABEL) >>= sLabel;
+ if ( sLabel.getLength() )
+ _rListBox.InsertEntry( sLabel,NULL,sal_False,LIST_APPEND,new ColumnInfo(*pEntries,sLabel) );
+ else
+ _rListBox.InsertEntry( *pEntries,NULL,sal_False,LIST_APPEND,new ColumnInfo(*pEntries,sLabel) );
+ }
+}
+//==================================================================
+// class FmFieldWinListBox
+//==================================================================
+DBG_NAME(FmFieldWinListBox)
+//------------------------------------------------------------------------------
+FmFieldWinListBox::FmFieldWinListBox( FmFieldWin* pParent )
+ :SvTreeListBox( pParent, WB_HASBUTTONS|WB_BORDER )
+ ,pTabWin( pParent )
+{
+ DBG_CTOR(FmFieldWinListBox,NULL);
+ SetHelpId( HID_FIELD_SEL );
+
+ SetHighlightRange( );
+}
+
+//------------------------------------------------------------------------------
+FmFieldWinListBox::~FmFieldWinListBox()
+{
+ DBG_DTOR(FmFieldWinListBox,NULL);
+}
+
+//------------------------------------------------------------------------------
+sal_Int8 FmFieldWinListBox::AcceptDrop( const AcceptDropEvent& /*rEvt*/ )
+{
+ return DND_ACTION_NONE;
+}
+
+//------------------------------------------------------------------------------
+sal_Int8 FmFieldWinListBox::ExecuteDrop( const ExecuteDropEvent& /*rEvt*/ )
+{
+ return DND_ACTION_NONE;
+}
+
+//------------------------------------------------------------------------------
+sal_Bool FmFieldWinListBox::DoubleClickHdl()
+{
+ if ( pTabWin->createSelectionControls() )
+ return sal_True;
+
+ return SvTreeListBox::DoubleClickHdl();
+}
+
+//------------------------------------------------------------------------------
+void FmFieldWinListBox::StartDrag( sal_Int8 /*_nAction*/, const Point& /*_rPosPixel*/ )
+{
+ SvLBoxEntry* pSelected = FirstSelected();
+ if (!pSelected)
+ // no drag without a field
+ return;
+
+ ::svx::ODataAccessDescriptor aDescriptor;
+ aDescriptor[ daDataSource ] <<= pTabWin->GetDatabaseName();
+ aDescriptor[ daConnection ] <<= pTabWin->GetConnection().getTyped();
+ aDescriptor[ daCommand ] <<= pTabWin->GetObjectName();
+ aDescriptor[ daCommandType ]<<= pTabWin->GetObjectType();
+ ColumnInfo* pInfo = static_cast<ColumnInfo*>(pSelected->GetUserData());
+ aDescriptor[ daColumnName ] <<= pInfo->sColumnName;
+
+ TransferableHelper* pTransferColumn = new OColumnTransferable(
+ aDescriptor, CTF_FIELD_DESCRIPTOR | CTF_CONTROL_EXCHANGE | CTF_COLUMN_DESCRIPTOR
+ );
+ Reference< XTransferable> xEnsureDelete = pTransferColumn;
+ if (pTransferColumn)
+ {
+ EndSelection();
+ pTransferColumn->StartDrag( this, DND_ACTION_COPY );
+ }
+}
+
+//========================================================================
+// class FmFieldWinData
+//========================================================================
+DBG_NAME(FmFieldWinData);
+//-----------------------------------------------------------------------
+FmFieldWinData::FmFieldWinData()
+{
+ DBG_CTOR(FmFieldWinData,NULL);
+}
+
+//-----------------------------------------------------------------------
+FmFieldWinData::~FmFieldWinData()
+{
+ DBG_DTOR(FmFieldWinData,NULL);
+}
+
+//========================================================================
+// class FmFieldWin
+//========================================================================
+DBG_NAME(FmFieldWin);
+//-----------------------------------------------------------------------
+FmFieldWin::FmFieldWin(SfxBindings* _pBindings, SfxChildWindow* _pMgr, Window* _pParent)
+ :SfxFloatingWindow(_pBindings, _pMgr, _pParent, WinBits(WB_STDMODELESS|WB_SIZEABLE))
+ ,SfxControllerItem(SID_FM_FIELDS_CONTROL, *_pBindings)
+ ,::comphelper::OPropertyChangeListener(m_aMutex)
+ ,pData(new FmFieldWinData)
+ ,m_nObjectType(0)
+ ,m_pChangeListener(NULL)
+{
+ DBG_CTOR(FmFieldWin,NULL);
+ SetHelpId( HID_FIELD_SEL_WIN );
+
+ SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor()) );
+ pListBox = new FmFieldWinListBox( this );
+ pListBox->Show();
+ UpdateContent(NULL);
+ SetSizePixel(Size(STD_WIN_SIZE_X,STD_WIN_SIZE_Y));
+}
+
+//-----------------------------------------------------------------------
+FmFieldWin::~FmFieldWin()
+{
+ if (m_pChangeListener)
+ {
+ m_pChangeListener->dispose();
+ m_pChangeListener->release();
+ // delete m_pChangeListener;
+ }
+ delete pListBox;
+ delete pData;
+ DBG_DTOR(FmFieldWin,NULL);
+}
+
+//-----------------------------------------------------------------------
+void FmFieldWin::GetFocus()
+{
+ if ( pListBox )
+ pListBox->GrabFocus();
+ else
+ SfxFloatingWindow::GetFocus();
+}
+
+//-----------------------------------------------------------------------
+sal_Bool FmFieldWin::createSelectionControls( )
+{
+ SvLBoxEntry* pSelected = pListBox->FirstSelected();
+ if ( pSelected )
+ {
+ // build a descriptor for the currently selected field
+ ODataAccessDescriptor aDescr;
+ aDescr.setDataSource(GetDatabaseName());
+
+ aDescr[ daConnection ] <<= GetConnection().getTyped();
+
+ aDescr[ daCommand ] <<= GetObjectName();
+ aDescr[ daCommandType ] <<= GetObjectType();
+ ColumnInfo* pInfo = static_cast<ColumnInfo*>(pSelected->GetUserData());
+ aDescr[ daColumnName ] <<= pInfo->sColumnName;//::rtl::OUString( pListBox->GetEntryText( pSelected) );
+
+ // transfer this to the SFX world
+ SfxUnoAnyItem aDescriptorItem( SID_FM_DATACCESS_DESCRIPTOR, makeAny( aDescr.createPropertyValueSequence() ) );
+ const SfxPoolItem* pArgs[] =
+ {
+ &aDescriptorItem, NULL
+ };
+
+ // execute the create slot
+ GetBindings().Execute( SID_FM_CREATE_FIELDCONTROL, pArgs );
+ }
+
+ return NULL != pSelected;
+}
+
+//-----------------------------------------------------------------------
+long FmFieldWin::PreNotify( NotifyEvent& _rNEvt )
+{
+ if ( EVENT_KEYINPUT == _rNEvt.GetType() )
+ {
+ const KeyCode& rKeyCode = _rNEvt.GetKeyEvent()->GetKeyCode();
+ if ( ( 0 == rKeyCode.GetModifier() ) && ( KEY_RETURN == rKeyCode.GetCode() ) )
+ {
+ if ( createSelectionControls() )
+ return 1;
+ }
+ }
+
+ return SfxFloatingWindow::PreNotify( _rNEvt );
+}
+
+//-----------------------------------------------------------------------
+sal_Bool FmFieldWin::Close()
+{
+ return SfxFloatingWindow::Close();
+}
+
+//-----------------------------------------------------------------------
+void FmFieldWin::_propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw( ::com::sun::star::uno::RuntimeException )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > xForm(evt.Source, ::com::sun::star::uno::UNO_QUERY);
+ UpdateContent(xForm);
+}
+
+//-----------------------------------------------------------------------
+void FmFieldWin::StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState)
+{
+ if (!pState || SID_FM_FIELDS_CONTROL != nSID)
+ return;
+
+ if (eState >= SFX_ITEM_AVAILABLE)
+ {
+ FmFormShell* pShell = PTR_CAST(FmFormShell,((SfxObjectItem*)pState)->GetShell());
+ UpdateContent(pShell);
+ }
+ else
+ UpdateContent(NULL);
+}
+
+//-----------------------------------------------------------------------
+void FmFieldWin::UpdateContent(FmFormShell* pShell)
+{
+ pListBox->Clear();
+ String aTitle( SVX_RES( RID_STR_FIELDSELECTION ) );
+ SetText( aTitle );
+
+ if (!pShell || !pShell->GetImpl())
+ return;
+
+ Reference< XForm > xForm = pShell->GetImpl()->getCurrentForm();
+ if ( xForm.is() )
+ UpdateContent( xForm );
+}
+
+//-----------------------------------------------------------------------
+void FmFieldWin::UpdateContent(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > & xForm)
+{
+ try
+ {
+ // ListBox loeschen
+ pListBox->Clear();
+ UniString aTitle(SVX_RES(RID_STR_FIELDSELECTION));
+ SetText(aTitle);
+
+ if (!xForm.is())
+ return;
+
+ Reference< XPreparedStatement > xStatement;
+ Reference< XPropertySet > xSet(xForm, UNO_QUERY);
+
+ m_aObjectName = ::comphelper::getString(xSet->getPropertyValue(FM_PROP_COMMAND));
+ m_aDatabaseName = ::comphelper::getString(xSet->getPropertyValue(FM_PROP_DATASOURCE));
+ m_nObjectType = ::comphelper::getINT32(xSet->getPropertyValue(FM_PROP_COMMANDTYPE));
+
+ // get the connection of the form
+ OStaticDataAccessTools aTools;
+ m_aConnection.reset(
+ aTools.connectRowset( Reference< XRowSet >( xForm, UNO_QUERY ), ::comphelper::getProcessServiceFactory(), sal_True ),
+ SharedConnection::NoTakeOwnership
+ );
+ // TODO: When incompatible changes (such as extending the "virtualdbtools" interface by ensureRowSetConnection)
+ // are allowed, again, we should change this: dbtools should consistently use SharedConnection all over
+ // the place, and connectRowset should be replaced with ensureRowSetConnection
+
+ // get the fields of the object
+
+ if ( m_aConnection.is() && m_aObjectName.getLength() )
+ {
+ Reference< XComponent > xKeepFieldsAlive;
+ Reference< XNameAccess > xColumns = getFieldsByCommandDescriptor( m_aConnection, m_nObjectType, m_aObjectName,xKeepFieldsAlive );
+ if ( xColumns.is() )
+ lcl_addToList(*pListBox,xColumns);
+ }
+
+ // Prefix setzen
+ UniString aPrefix;
+ StringListResource aPrefixes( SVX_RES( RID_RSC_TABWIN_PREFIX ) );
+
+ switch (m_nObjectType)
+ {
+ case CommandType::TABLE:
+ aPrefix = aPrefixes[0];
+ break;
+ case CommandType::QUERY:
+ aPrefix = aPrefixes[1];
+ break;
+ default:
+ aPrefix = aPrefixes[2];
+ break;
+ }
+
+ // an dem PropertySet nach Aenderungen der ControlSource lauschen
+ if (m_pChangeListener)
+ {
+ m_pChangeListener->dispose();
+ m_pChangeListener->release();
+ }
+ m_pChangeListener = new ::comphelper::OPropertyChangeMultiplexer(this, xSet);
+ m_pChangeListener->acquire();
+ m_pChangeListener->addProperty(FM_PROP_DATASOURCE);
+ m_pChangeListener->addProperty(FM_PROP_COMMAND);
+ m_pChangeListener->addProperty(FM_PROP_COMMANDTYPE);
+
+ // Titel setzen
+ aTitle.AppendAscii(" ");
+ aTitle += aPrefix;
+ aTitle.AppendAscii(" ");
+ aTitle += m_aObjectName.getStr();
+ SetText( aTitle );
+ }
+ catch( const Exception& )
+ {
+ DBG_ERROR( "FmTabWin::UpdateContent: caught an exception!" );
+ }
+}
+
+//-----------------------------------------------------------------------
+void FmFieldWin::Resize()
+{
+ SfxFloatingWindow::Resize();
+
+ Point aPos(GetPosPixel());
+ Size aOutputSize( GetOutputSizePixel() );
+
+ //////////////////////////////////////////////////////////////////////
+
+ // Groesse der ::com::sun::star::form::ListBox anpassen
+ Point aLBPos( LISTBOX_BORDER, LISTBOX_BORDER );
+ Size aLBSize( aOutputSize );
+ aLBSize.Width() -= (2*LISTBOX_BORDER);
+ aLBSize.Height() -= (2*LISTBOX_BORDER);
+
+ pListBox->SetPosSizePixel( aLBPos, aLBSize );
+}
+
+//-----------------------------------------------------------------------
+void FmFieldWin::FillInfo( SfxChildWinInfo& rInfo ) const
+{
+ rInfo.bVisible = sal_False;
+}
+
+//-----------------------------------------------------------------------
+SFX_IMPL_FLOATINGWINDOW(FmFieldWinMgr, SID_FM_ADD_FIELD)
+
+//-----------------------------------------------------------------------
+FmFieldWinMgr::FmFieldWinMgr(Window* _pParent, sal_uInt16 _nId,
+ SfxBindings* _pBindings, SfxChildWinInfo* _pInfo)
+ :SfxChildWindow(_pParent, _nId)
+{
+ pWindow = new FmFieldWin(_pBindings, this, _pParent);
+ SetHideNotDelete(sal_True);
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+ ((SfxFloatingWindow*)pWindow)->Initialize( _pInfo );
+}
+
+
diff --git a/svx/source/form/tbxform.cxx b/svx/source/form/tbxform.cxx
new file mode 100644
index 000000000000..0bad14631355
--- /dev/null
+++ b/svx/source/form/tbxform.cxx
@@ -0,0 +1,477 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <string> // HACK: prevent conflict between STLPORT and Workshop headers
+#include <tools/ref.hxx>
+#include <tools/shl.hxx>
+#include <svl/intitem.hxx>
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/fixed.hxx>
+#include "fmitems.hxx"
+#include "formtoolbars.hxx"
+
+
+#include <vcl/sound.hxx>
+#include <svx/dialmgr.hxx>
+#ifndef _SVX_DIALOGS_HRC
+#include <svx/dialogs.hrc>
+#endif
+#include "svx/tbxctl.hxx"
+#include "svx/tbxdraw.hxx"
+#include "tbxform.hxx"
+#ifndef _SVX_FMRESIDS_HRC
+#include "svx/fmresids.hrc"
+#endif
+#include "fmitems.hxx"
+#ifndef _SVX_FMHELP_HRC
+#include "fmhelp.hrc"
+#endif
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/imagemgr.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::frame;
+using ::com::sun::star::beans::XPropertySet;
+
+
+//========================================================================
+// class SvxFmAbsRecWin
+//========================================================================
+
+// -----------------------------------------------------------------------
+SvxFmAbsRecWin::SvxFmAbsRecWin( Window* _pParent, SfxToolBoxControl* _pController )
+ :NumericField( _pParent, WB_BORDER )
+ ,m_pController(_pController)
+{
+ SetMin(1);
+ SetFirst(1);
+ SetSpinSize(1);
+ SetSizePixel( Size(70,19) );
+
+ SetDecimalDigits(0);
+ SetStrictFormat(sal_True);
+}
+
+// -----------------------------------------------------------------------
+SvxFmAbsRecWin::~SvxFmAbsRecWin()
+{
+}
+
+// -----------------------------------------------------------------------
+void SvxFmAbsRecWin::FirePosition( sal_Bool _bForce )
+{
+ if ( _bForce || ( GetText() != GetSavedValue() ) )
+ {
+ sal_Int64 nRecord = GetValue();
+ if (nRecord < GetMin() || nRecord > GetMax())
+ {
+ Sound::Beep();
+ return;
+ }
+
+ SfxInt32Item aPositionParam( FN_PARAM_1, static_cast<sal_Int32>(nRecord) );
+
+ Any a;
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Position" ));
+ aPositionParam.QueryValue( a );
+ aArgs[0].Value = a;
+ m_pController->Dispatch( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AbsoluteRecord" )),
+ aArgs );
+ m_pController->updateStatus();
+
+ SaveValue();
+ }
+}
+
+// -----------------------------------------------------------------------
+void SvxFmAbsRecWin::LoseFocus()
+{
+ FirePosition( sal_False );
+}
+
+// -----------------------------------------------------------------------
+void SvxFmAbsRecWin::KeyInput( const KeyEvent& rKeyEvent )
+{
+ if( rKeyEvent.GetKeyCode() == KEY_RETURN && GetText().Len() )
+ FirePosition( sal_True );
+ else
+ NumericField::KeyInput( rKeyEvent );
+}
+
+//========================================================================
+// class SvxFmTbxCtlConfig
+//========================================================================
+
+struct MapSlotToCmd
+{
+ sal_uInt16 nSlotId;
+ const char* pCommand;
+};
+
+static MapSlotToCmd SlotToCommands[] =
+{
+ { SID_FM_PUSHBUTTON, ".uno:Pushbutton" },
+ { SID_FM_RADIOBUTTON, ".uno:RadioButton" },
+ { SID_FM_CHECKBOX, ".uno:CheckBox" },
+ { SID_FM_FIXEDTEXT, ".uno:Label" },
+ { SID_FM_GROUPBOX, ".uno:GroupBox" },
+ { SID_FM_LISTBOX, ".uno:ListBox" },
+ { SID_FM_COMBOBOX, ".uno:ComboBox" },
+ { SID_FM_EDIT, ".uno:Edit" },
+ { SID_FM_DBGRID, ".uno:Grid" },
+ { SID_FM_IMAGEBUTTON, ".uno:Imagebutton" },
+ { SID_FM_IMAGECONTROL, ".uno:ImageControl" },
+ { SID_FM_FILECONTROL, ".uno:FileControl" },
+ { SID_FM_DATEFIELD, ".uno:DateField" },
+ { SID_FM_TIMEFIELD, ".uno:TimeField" },
+ { SID_FM_NUMERICFIELD, ".uno:NumericField" },
+ { SID_FM_CURRENCYFIELD, ".uno:CurrencyField" },
+ { SID_FM_PATTERNFIELD, ".uno:PatternField" },
+ { SID_FM_DESIGN_MODE, ".uno:SwitchControlDesignMode" },
+ { SID_FM_FORMATTEDFIELD, ".uno:FormattedField" },
+ { SID_FM_SCROLLBAR, ".uno:ScrollBar" },
+ { SID_FM_SPINBUTTON, ".uno:SpinButton" },
+ { 0, "" }
+};
+
+SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlConfig, SfxUInt16Item );
+
+//-----------------------------------------------------------------------
+SvxFmTbxCtlConfig::SvxFmTbxCtlConfig( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
+ : SfxToolBoxControl( nSlotId, nId, rTbx )
+ ,nLastSlot( 0 )
+{
+ rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) );
+}
+
+//-----------------------------------------------------------------------
+void SvxFmTbxCtlConfig::StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+{
+ if (nSID == SID_FM_CONFIG)
+ {
+ sal_uInt16 nSlot = 0;
+ if (eState >= SFX_ITEM_AVAILABLE)
+ nSlot = ((SfxUInt16Item*)pState)->GetValue();
+
+ switch( nSlot )
+ {
+ case SID_FM_PUSHBUTTON:
+ case SID_FM_RADIOBUTTON:
+ case SID_FM_CHECKBOX:
+ case SID_FM_FIXEDTEXT:
+ case SID_FM_GROUPBOX:
+ case SID_FM_LISTBOX:
+ case SID_FM_COMBOBOX:
+ case SID_FM_NAVIGATIONBAR:
+ case SID_FM_EDIT:
+ case SID_FM_DBGRID:
+ case SID_FM_IMAGEBUTTON:
+ case SID_FM_IMAGECONTROL:
+ case SID_FM_FILECONTROL:
+ case SID_FM_DATEFIELD:
+ case SID_FM_TIMEFIELD:
+ case SID_FM_NUMERICFIELD:
+ case SID_FM_CURRENCYFIELD:
+ case SID_FM_PATTERNFIELD:
+ case SID_FM_DESIGN_MODE:
+ case SID_FM_FORMATTEDFIELD:
+ case SID_FM_SCROLLBAR:
+ case SID_FM_SPINBUTTON:
+ { // set a new image, matching to this slot
+ rtl::OUString aSlotURL( RTL_CONSTASCII_USTRINGPARAM( "slot:" ));
+ aSlotURL += rtl::OUString::valueOf( sal_Int32( nSlot ));
+ Image aImage = GetImage( m_xFrame,
+ aSlotURL,
+ hasBigImages(),
+ GetToolBox().GetSettings().GetStyleSettings().GetHighContrastMode() );
+
+ GetToolBox().SetItemImage( GetId(), aImage );
+ nLastSlot = nSlot;
+ }
+ break;
+ }
+ }
+ SfxToolBoxControl::StateChanged( nSID, eState,pState );
+}
+
+//-----------------------------------------------------------------------
+SfxPopupWindowType SvxFmTbxCtlConfig::GetPopupWindowType() const
+{
+ return( nLastSlot == 0 ? SFX_POPUPWINDOW_ONCLICK : SFX_POPUPWINDOW_ONTIMEOUT );
+}
+
+//-----------------------------------------------------------------------
+SfxPopupWindow* SvxFmTbxCtlConfig::CreatePopupWindow()
+{
+ if ( GetSlotId() == SID_FM_CONFIG )
+ {
+ ::svxform::FormToolboxes aToolboxes( m_xFrame );
+ createAndPositionSubToolBar( aToolboxes.getToolboxResourceName( SID_FM_CONFIG ) );
+ }
+ return NULL;
+}
+
+//-----------------------------------------------------------------------
+void SvxFmTbxCtlConfig::Select( sal_uInt16 /*nModifier*/ )
+{
+ //////////////////////////////////////////////////////////////////////
+ // Click auf den Button SID_FM_CONFIG in der ObjectBar
+ if ( nLastSlot )
+ {
+ sal_uInt16 n = 0;
+ while( SlotToCommands[n].nSlotId > 0 )
+ {
+ if ( SlotToCommands[n].nSlotId == nLastSlot )
+ break;
+ n++;
+ }
+
+ if ( SlotToCommands[n].nSlotId > 0 )
+ {
+ Sequence< PropertyValue > aArgs;
+ Dispatch( rtl::OUString::createFromAscii( SlotToCommands[n].pCommand ),
+ aArgs );
+ }
+ }
+}
+
+
+//========================================================================
+// class SvxFmTbxCtlAbsRec
+//========================================================================
+
+SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlAbsRec, SfxInt32Item );
+DBG_NAME(SvxFmTbxCtlAbsRec);
+//-----------------------------------------------------------------------
+SvxFmTbxCtlAbsRec::SvxFmTbxCtlAbsRec( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
+ :SfxToolBoxControl( nSlotId, nId, rTbx )
+{
+ DBG_CTOR(SvxFmTbxCtlAbsRec,NULL);
+}
+
+//-----------------------------------------------------------------------
+SvxFmTbxCtlAbsRec::~SvxFmTbxCtlAbsRec()
+{
+ DBG_DTOR(SvxFmTbxCtlAbsRec,NULL);
+}
+
+//-----------------------------------------------------------------------
+void SvxFmTbxCtlAbsRec::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+{
+ sal_uInt16 nId = GetId();
+ ToolBox* pToolBox = &GetToolBox();
+ SvxFmAbsRecWin* pWin = (SvxFmAbsRecWin*)( pToolBox->GetItemWindow(nId) );
+
+ DBG_ASSERT( pWin, "Control not found!" );
+
+ if (pState)
+ {
+ const SfxInt32Item* pItem = PTR_CAST( SfxInt32Item, pState );
+ DBG_ASSERT( pItem, "SvxFmTbxCtlAbsRec::StateChanged: invalid item!" );
+ pWin->SetValue( pItem ? pItem->GetValue() : -1 );
+ }
+
+ sal_Bool bEnable = SFX_ITEM_DISABLED != eState && pState;
+ if (!bEnable)
+ pWin->SetText(String());
+
+ //////////////////////////////////////////////////////////////////////
+ // Enablen/disablen des Fensters
+ pToolBox->EnableItem(nId, bEnable);
+ SfxToolBoxControl::StateChanged( nSID, eState,pState );
+}
+
+//-----------------------------------------------------------------------
+Window* SvxFmTbxCtlAbsRec::CreateItemWindow( Window* pParent )
+{
+ SvxFmAbsRecWin* pWin = new SvxFmAbsRecWin( pParent, this );
+ pWin->SetUniqueId( UID_ABSOLUTE_RECORD_WINDOW );
+ return pWin;
+}
+
+
+//========================================================================
+// SvxFmTbxCtlRecText
+//========================================================================
+
+SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlRecText, SfxBoolItem );
+DBG_NAME(SvxFmTbxCtlRecText);
+//-----------------------------------------------------------------------
+SvxFmTbxCtlRecText::SvxFmTbxCtlRecText( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
+ :SfxToolBoxControl( nSlotId, nId, rTbx )
+{
+ DBG_CTOR(SvxFmTbxCtlRecText,NULL);
+}
+
+//-----------------------------------------------------------------------
+SvxFmTbxCtlRecText::~SvxFmTbxCtlRecText()
+{
+ DBG_DTOR(SvxFmTbxCtlRecText,NULL);
+}
+
+//-----------------------------------------------------------------------
+Window* SvxFmTbxCtlRecText::CreateItemWindow( Window* pParent )
+{
+ XubString aText( SVX_RES(RID_STR_REC_TEXT) );
+ FixedText* pFixedText = new FixedText( pParent );
+ Size aSize( pFixedText->GetTextWidth( aText ), pFixedText->GetTextHeight( ) );
+ pFixedText->SetText( aText );
+ aSize.Width() += 6;
+ pFixedText->SetSizePixel( aSize );
+ pFixedText->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
+
+ return pFixedText;
+}
+
+
+//========================================================================
+// SvxFmTbxCtlRecFromText
+//========================================================================
+
+SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlRecFromText, SfxBoolItem );
+DBG_NAME(SvxFmTbxCtlRecFromText);
+//-----------------------------------------------------------------------
+SvxFmTbxCtlRecFromText::SvxFmTbxCtlRecFromText( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
+ :SfxToolBoxControl( nSlotId, nId, rTbx )
+{
+ DBG_CTOR(SvxFmTbxCtlRecFromText,NULL);
+}
+
+//-----------------------------------------------------------------------
+SvxFmTbxCtlRecFromText::~SvxFmTbxCtlRecFromText()
+{
+ DBG_DTOR(SvxFmTbxCtlRecFromText,NULL);
+}
+
+//-----------------------------------------------------------------------
+Window* SvxFmTbxCtlRecFromText::CreateItemWindow( Window* pParent )
+{
+ XubString aText( SVX_RES(RID_STR_REC_FROM_TEXT) );
+ FixedText* pFixedText = new FixedText( pParent, WB_CENTER );
+ Size aSize( pFixedText->GetTextWidth( aText ), pFixedText->GetTextHeight( ) );
+ aSize.Width() += 12;
+ pFixedText->SetText( aText );
+ pFixedText->SetSizePixel( aSize );
+ pFixedText->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
+ return pFixedText;
+}
+
+
+//========================================================================
+// SvxFmTbxCtlRecTotal
+//========================================================================
+DBG_NAME(SvxFmTbxCtlRecTotal);
+SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlRecTotal, SfxStringItem );
+
+//-----------------------------------------------------------------------
+SvxFmTbxCtlRecTotal::SvxFmTbxCtlRecTotal( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
+ :SfxToolBoxControl( nSlotId, nId, rTbx )
+ ,pFixedText( NULL )
+{
+ DBG_CTOR(SvxFmTbxCtlRecTotal,NULL);
+}
+
+//-----------------------------------------------------------------------
+SvxFmTbxCtlRecTotal::~SvxFmTbxCtlRecTotal()
+{
+ DBG_DTOR(SvxFmTbxCtlRecTotal,NULL);
+}
+
+//-----------------------------------------------------------------------
+Window* SvxFmTbxCtlRecTotal::CreateItemWindow( Window* pParent )
+{
+ pFixedText = new FixedText( pParent );
+ String aSample( "123456", sizeof( "123456" ) - 1 );
+ Size aSize( pFixedText->GetTextWidth( aSample ), pFixedText->GetTextHeight( ) );
+ aSize.Width() += 12;
+ pFixedText->SetSizePixel( aSize );
+ pFixedText->SetBackground();
+ pFixedText->SetPaintTransparent(sal_True);
+ return pFixedText;
+}
+
+//-----------------------------------------------------------------------
+void SvxFmTbxCtlRecTotal::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+{
+ //////////////////////////////////////////////////////////////////////
+ // Setzen des FixedTextes
+ if (GetSlotId() != SID_FM_RECORD_TOTAL)
+ return;
+
+ XubString aText;
+ if (pState)
+ aText = ((SfxStringItem*)pState)->GetValue();
+ else
+ aText = '?';
+
+ pFixedText->SetText( aText );
+ pFixedText->Update();
+ pFixedText->Flush();
+
+ SfxToolBoxControl::StateChanged( nSID, eState,pState );
+}
+
+//========================================================================
+// SvxFmTbxNextRec
+//========================================================================
+SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxNextRec, SfxBoolItem );
+
+//-----------------------------------------------------------------------
+SvxFmTbxNextRec::SvxFmTbxNextRec( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
+ :SfxToolBoxControl( nSlotId, nId, rTbx )
+{
+ rTbx.SetItemBits(nId, rTbx.GetItemBits(nId) | TIB_REPEAT);
+
+ AllSettings aSettings = rTbx.GetSettings();
+ MouseSettings aMouseSettings = aSettings.GetMouseSettings();
+ aMouseSettings.SetButtonRepeat(aMouseSettings.GetButtonRepeat() / 4);
+ aSettings.SetMouseSettings(aMouseSettings);
+ rTbx.SetSettings(aSettings, sal_True);
+}
+
+//========================================================================
+// SvxFmTbxPrevRec
+//========================================================================
+SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxPrevRec, SfxBoolItem );
+
+//-----------------------------------------------------------------------
+SvxFmTbxPrevRec::SvxFmTbxPrevRec( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
+ :SfxToolBoxControl( nSlotId, nId, rTbx )
+{
+ rTbx.SetItemBits(nId, rTbx.GetItemBits(nId) | TIB_REPEAT);
+}
+
+
diff --git a/svx/source/form/typeconversionclient.cxx b/svx/source/form/typeconversionclient.cxx
new file mode 100644
index 000000000000..9c76a8005e68
--- /dev/null
+++ b/svx/source/form/typeconversionclient.cxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "typeconversionclient.hxx"
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ //====================================================================
+ //= OTypeConversionClient
+ //====================================================================
+ //--------------------------------------------------------------------
+ OTypeConversionClient::OTypeConversionClient()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ bool OTypeConversionClient::ensureLoaded() const
+ {
+ if ( !ODbtoolsClient::ensureLoaded() )
+ return false;
+ m_xTypeConversion = getFactory()->getTypeConversionHelper();
+ return m_xTypeConversion.is();
+ }
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
+
diff --git a/svx/source/form/typemap.cxx b/svx/source/form/typemap.cxx
new file mode 100644
index 000000000000..c12bb313f862
--- /dev/null
+++ b/svx/source/form/typemap.cxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <sfx2/objitem.hxx>
+#include <sfx2/msg.hxx>
+#include <svl/stritem.hxx>
+#include <svl/intitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/crsditem.hxx>
+#include <editeng/cntritem.hxx>
+#include <editeng/shdditem.hxx>
+#include <editeng/postitem.hxx>
+#ifndef _SVX_CLIPBOARDCTL_HXX_
+#include "svx/clipfmtitem.hxx"
+#endif
+#include <editeng/fhgtitem.hxx>
+#include "editeng/fontitem.hxx"
+#include <editeng/charreliefitem.hxx>
+#include <editeng/escpitem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/wrlmitem.hxx>
+#include <editeng/charscaleitem.hxx>
+#include <editeng/akrnitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/lspcitem.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/kernitem.hxx>
+#include <editeng/tstpitem.hxx>
+#include <editeng/adjitem.hxx>
+#ifndef _SVX_EMPHITEM_HXX
+#include <editeng/emphitem.hxx>
+#endif
+
+#include <editeng/memberids.hrc>
+#define SFX_TYPEMAP
+#include "svxslots.hxx"
+
diff --git a/svx/source/form/xfm_addcondition.cxx b/svx/source/form/xfm_addcondition.cxx
new file mode 100644
index 000000000000..078e555cfe25
--- /dev/null
+++ b/svx/source/form/xfm_addcondition.cxx
@@ -0,0 +1,193 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#ifndef SVX_SOURCE_FORM_XFM_ADDCONDITION_HXX
+#include "xfm_addcondition.hxx"
+#endif
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+#include <cppuhelper/typeprovider.hxx>
+#include "datanavi.hxx"
+#include <vcl/msgbox.hxx>
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+#define PROPERTY_ID_BINDING 5724
+#define PROPERTY_ID_FORM_MODEL 5725
+#define PROPERTY_ID_FACET_NAME 5726
+#define PROPERTY_ID_CONDITION_VALUE 5727
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::xforms;
+
+ //====================================================================
+ //= OAddConditionDialog
+ //====================================================================
+ //--------------------------------------------------------------------
+ Reference< XInterface > SAL_CALL OAddConditionDialog_Create( const Reference< XMultiServiceFactory > & _rxORB )
+ {
+ return OAddConditionDialog::Create( _rxORB );
+ }
+
+ //--------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL OAddConditionDialog_GetSupportedServiceNames()
+ {
+ ::comphelper::StringSequence aSupported( 1 );
+ aSupported.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xforms.ui.dialogs.AddCondition" ) );
+ return aSupported;
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL OAddConditionDialog_GetImplementationName()
+ {
+ return ::rtl::OUString::createFromAscii( "org.openoffice.comp.svx.OAddConditionDialog" );
+ }
+
+ //====================================================================
+ //= OAddConditionDialog
+ //====================================================================
+ //--------------------------------------------------------------------
+ OAddConditionDialog::OAddConditionDialog( const Reference< XMultiServiceFactory >& _rxORB )
+ :OAddConditionDialogBase( _rxORB )
+ {
+ registerProperty(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Binding" ) ),
+ PROPERTY_ID_BINDING,
+ PropertyAttribute::TRANSIENT,
+ &m_xBinding,
+ ::getCppuType( &m_xBinding )
+ );
+
+ registerProperty(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FacetName" ) ),
+ PROPERTY_ID_FACET_NAME,
+ PropertyAttribute::TRANSIENT,
+ &m_sFacetName,
+ ::getCppuType( &m_sFacetName )
+ );
+
+ registerProperty(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ConditionValue" ) ),
+ PROPERTY_ID_CONDITION_VALUE,
+ PropertyAttribute::TRANSIENT,
+ &m_sConditionValue,
+ ::getCppuType( &m_sConditionValue )
+ );
+
+ registerProperty(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FormModel" ) ),
+ PROPERTY_ID_FORM_MODEL,
+ PropertyAttribute::TRANSIENT,
+ &m_xWorkModel,
+ ::getCppuType( &m_xWorkModel )
+ );
+ }
+
+ //-------------------------------------------------------------------------
+ Sequence<sal_Int8> SAL_CALL OAddConditionDialog::getImplementationId( ) throw(RuntimeException)
+ {
+ static ::cppu::OImplementationId * pId = 0;
+ if (! pId)
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if (! pId)
+ {
+ static ::cppu::OImplementationId aId;
+ pId = &aId;
+ }
+ }
+ return pId->getImplementationId();
+ }
+
+ //-------------------------------------------------------------------------
+ Reference< XInterface > SAL_CALL OAddConditionDialog::Create( const Reference< XMultiServiceFactory >& _rxFactory )
+ {
+ return *( new OAddConditionDialog( _rxFactory ) );
+ }
+
+ //-------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL OAddConditionDialog::getImplementationName() throw(RuntimeException)
+ {
+ return OAddConditionDialog_GetImplementationName();
+ }
+
+ //-------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL OAddConditionDialog::getSupportedServiceNames() throw(RuntimeException)
+ {
+ return OAddConditionDialog_GetSupportedServiceNames();
+ }
+
+ //-------------------------------------------------------------------------
+ Reference<XPropertySetInfo> SAL_CALL OAddConditionDialog::getPropertySetInfo() throw(RuntimeException)
+ {
+ return createPropertySetInfo( getInfoHelper() );
+ }
+
+ //-------------------------------------------------------------------------
+ ::cppu::IPropertyArrayHelper& OAddConditionDialog::getInfoHelper()
+ {
+ return *const_cast< OAddConditionDialog* >( this )->getArrayHelper();
+ }
+
+ //------------------------------------------------------------------------------
+ ::cppu::IPropertyArrayHelper* OAddConditionDialog::createArrayHelper( ) const
+ {
+ Sequence< Property > aProperties;
+ describeProperties( aProperties );
+ return new ::cppu::OPropertyArrayHelper( aProperties );
+ }
+
+ //------------------------------------------------------------------------------
+ Dialog* OAddConditionDialog::createDialog(Window* _pParent)
+ {
+ if ( !m_xBinding.is() || !m_sFacetName.getLength() )
+ throw RuntimeException( ::rtl::OUString(), *this );
+
+ return new AddConditionDialog( _pParent, m_sFacetName, m_xBinding );
+ }
+
+ //------------------------------------------------------------------------------
+ void OAddConditionDialog::executedDialog( sal_Int16 _nExecutionResult )
+ {
+ OAddConditionDialogBase::executedDialog( _nExecutionResult );
+ if ( _nExecutionResult == RET_OK )
+ m_sConditionValue = static_cast< AddConditionDialog* >( m_pDialog )->GetCondition();
+ }
+
+//........................................................................
+} // namespace svxformv
+//........................................................................
+
diff --git a/svx/source/gallery2/codec.cxx b/svx/source/gallery2/codec.cxx
new file mode 100644
index 000000000000..3306e7896c5d
--- /dev/null
+++ b/svx/source/gallery2/codec.cxx
@@ -0,0 +1,173 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <tools/stream.hxx>
+#include <tools/zcodec.hxx>
+#include "codec.hxx"
+
+// ----------------
+// - GalleryCodec -
+// ----------------
+
+GalleryCodec::GalleryCodec( SvStream& rIOStm ) :
+ rStm( rIOStm )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+GalleryCodec::~GalleryCodec()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool GalleryCodec::IsCoded( SvStream& rStm, sal_uInt32& rVersion )
+{
+ const sal_uIntPtr nPos = rStm.Tell();
+ sal_Bool bRet;
+ sal_uInt8 cByte1, cByte2, cByte3, cByte4, cByte5, cByte6;
+
+ rStm >> cByte1 >> cByte2 >> cByte3 >> cByte4 >> cByte5 >> cByte6;
+
+ if ( cByte1 == 'S' && cByte2 == 'V' && cByte3 == 'R' && cByte4 == 'L' && cByte5 == 'E' && ( cByte6 == '1' || cByte6 == '2' ) )
+ {
+ rVersion = ( ( cByte6 == '1' ) ? 1 : 2 );
+ bRet = sal_True;
+ }
+ else
+ {
+ rVersion = 0;
+ bRet = sal_False;
+ }
+
+ rStm.Seek( nPos );
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryCodec::Write( SvStream& rStmToWrite )
+{
+ sal_uInt32 nPos, nCompSize;
+
+ rStmToWrite.Seek( STREAM_SEEK_TO_END );
+ const sal_uInt32 nSize = rStmToWrite.Tell();
+ rStmToWrite.Seek( 0UL );
+
+ rStm << 'S' << 'V' << 'R' << 'L' << 'E' << '2';
+ rStm << nSize;
+
+ nPos = rStm.Tell();
+ rStm.SeekRel( 4UL );
+
+ ZCodec aCodec;
+ aCodec.BeginCompression();
+ aCodec.Compress( rStmToWrite, rStm );
+ aCodec.EndCompression();
+
+ nCompSize = rStm.Tell() - nPos - 4UL;
+ rStm.Seek( nPos );
+ rStm << nCompSize;
+ rStm.Seek( STREAM_SEEK_TO_END );
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryCodec::Read( SvStream& rStmToRead )
+{
+ sal_uInt32 nVersion = 0;
+
+ if( IsCoded( rStm, nVersion ) )
+ {
+ sal_uInt32 nCompressedSize, nUnCompressedSize;
+
+ rStm.SeekRel( 6 );
+ rStm >> nUnCompressedSize >> nCompressedSize;
+
+ // decompress
+ if( 1 == nVersion )
+ {
+ sal_uInt8* pCompressedBuffer = new sal_uInt8[ nCompressedSize ]; rStm.Read( pCompressedBuffer, nCompressedSize );
+ sal_uInt8* pInBuf = pCompressedBuffer;
+ sal_uInt8* pOutBuf = new sal_uInt8[ nUnCompressedSize ];
+ sal_uInt8* pTmpBuf = pOutBuf;
+ sal_uInt8* pLast = pOutBuf + nUnCompressedSize - 1;
+ sal_uIntPtr nIndex = 0UL, nCountByte, nRunByte;
+ sal_Bool bEndDecoding = sal_False;
+
+ do
+ {
+ nCountByte = *pInBuf++;
+
+ if ( !nCountByte )
+ {
+ nRunByte = *pInBuf++;
+
+ if ( nRunByte > 2 )
+ {
+ // absolutes Fuellen
+ memcpy( &pTmpBuf[ nIndex ], pInBuf, nRunByte );
+ pInBuf += nRunByte;
+ nIndex += nRunByte;
+
+ // WORD-Alignment beachten
+ if ( nRunByte & 1 )
+ pInBuf++;
+ }
+ else if ( nRunByte == 1 ) // Ende des Bildes
+ bEndDecoding = sal_True;
+ }
+ else
+ {
+ const sal_uInt8 cVal = *pInBuf++;
+
+ memset( &pTmpBuf[ nIndex ], cVal, nCountByte );
+ nIndex += nCountByte;
+ }
+ }
+ while ( !bEndDecoding && ( pTmpBuf <= pLast ) );
+
+ rStmToRead.Write( pOutBuf, nUnCompressedSize );
+
+ delete[] pOutBuf;
+ delete[] pCompressedBuffer;
+ }
+ else if( 2 == nVersion )
+ {
+ ZCodec aCodec;
+
+ aCodec.BeginCompression();
+ aCodec.Decompress( rStm, rStmToRead );
+ aCodec.EndCompression();
+ }
+ }
+}
diff --git a/svx/source/gallery2/codec.hxx b/svx/source/gallery2/codec.hxx
new file mode 100644
index 000000000000..ca7ee5d3adbf
--- /dev/null
+++ b/svx/source/gallery2/codec.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <tools/gen.hxx>
+
+// ----------------
+// - GalleryCodec -
+// ----------------
+
+class SvStream;
+class SvMemoryStreamStream;
+
+class GalleryCodec
+{
+private:
+
+ SvStream& rStm;
+
+public:
+ GalleryCodec( SvStream& rIOStm );
+ ~GalleryCodec();
+
+ void Write( SvStream& rStmToWrite );
+ void Read( SvStream& rStmToRead );
+
+ static sal_Bool IsCoded( SvStream& rStm, sal_uInt32& rVersion );
+};
diff --git a/svx/source/gallery2/galbrws.cxx b/svx/source/gallery2/galbrws.cxx
new file mode 100644
index 000000000000..5d4e4297f0a4
--- /dev/null
+++ b/svx/source/gallery2/galbrws.cxx
@@ -0,0 +1,285 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <vcl/split.hxx>
+#include <vcl/ctrl.hxx>
+#include <unotools/pathoptions.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/sfxsids.hrc>
+#include "gallery.hrc"
+#include "svx/galmisc.hxx"
+#include "svx/gallery1.hxx"
+#include "galbrws1.hxx"
+#include "galbrws2.hxx"
+#include "svx/galbrws.hxx"
+
+// -------------------
+// - GallerySplitter -
+// -------------------
+
+class GallerySplitter : public Splitter
+{
+protected:
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+public:
+
+ GallerySplitter( Window* pParent, const ResId& rResId );
+ virtual ~GallerySplitter();
+};
+
+// -----------------------------------------------------------------------------
+
+GallerySplitter::GallerySplitter( Window* pParent, const ResId& rResId ) :
+ Splitter( pParent, rResId )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+GallerySplitter::~GallerySplitter()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void GallerySplitter::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Splitter::DataChanged( rDCEvt );
+ static_cast< GalleryBrowser* >( GetParent() )->InitSettings();
+}
+
+// -------------------------
+// - SvxGalleryChildWindow -
+// -------------------------
+
+GalleryChildWindow::GalleryChildWindow( Window* _pParent, sal_uInt16 nId, SfxBindings* pBindings, SfxChildWinInfo* pInfo ) :
+ SfxChildWindow( _pParent, nId )
+{
+ pWindow = new GalleryBrowser( pBindings, this, _pParent, GAL_RESID( RID_SVXDLG_GALLERYBROWSER ) );
+ eChildAlignment = SFX_ALIGN_TOP;
+ ( (GalleryBrowser*) pWindow )->Initialize( pInfo );
+};
+
+// -----------------------------------------------------------------------------
+
+GalleryChildWindow::~GalleryChildWindow()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+SFX_IMPL_DOCKINGWINDOW( GalleryChildWindow, SID_GALLERY )
+
+// ------------------
+// - GalleryBrowser -
+// ------------------
+
+GalleryBrowser::GalleryBrowser( SfxBindings* _pBindings, SfxChildWindow* pCW,
+ Window* pParent, const ResId& rResId ) :
+ SfxDockingWindow( _pBindings, pCW, pParent, rResId )
+{
+ mpGallery = Gallery::GetGalleryInstance();
+ mpBrowser1 = new GalleryBrowser1( this, GAL_RESID( GALLERY_BROWSER1 ), mpGallery );
+ mpSplitter = new GallerySplitter( this, GAL_RESID( GALLERY_SPLITTER ) );
+ mpBrowser2 = new GalleryBrowser2( this, GAL_RESID( GALLERY_BROWSER2 ), mpGallery );
+
+ FreeResource();
+ SetMinOutputSizePixel( maLastSize = GetOutputSizePixel() );
+
+ mpBrowser1->SelectTheme( 0 );
+ mpBrowser1->Show( sal_True );
+ mpBrowser2->Show( sal_True );
+
+ mpSplitter->SetSplitHdl( LINK( this, GalleryBrowser, SplitHdl ) );
+ mpSplitter->Show( sal_True );
+
+ InitSettings();
+}
+
+// -----------------------------------------------------------------------------
+
+GalleryBrowser::~GalleryBrowser()
+{
+ delete mpBrowser2;
+ delete mpSplitter;
+ delete mpBrowser1;
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser::InitSettings()
+{
+ SetBackground( Wallpaper( GALLERY_DLG_COLOR ) );
+ SetControlBackground( GALLERY_DLG_COLOR );
+ SetControlForeground( GALLERY_DLG_COLOR );
+
+ mpSplitter->SetBackground( Wallpaper( GALLERY_DLG_COLOR ) );
+ mpSplitter->SetControlBackground( GALLERY_DLG_COLOR );
+ mpSplitter->SetControlForeground( GALLERY_DLG_COLOR );
+
+ mpBrowser1->SetBackground( Wallpaper( GALLERY_DLG_COLOR ) );
+ mpBrowser1->SetControlBackground( GALLERY_DLG_COLOR );
+ mpBrowser1->SetControlForeground( GALLERY_DLG_COLOR );
+
+ mpBrowser2->SetBackground( Wallpaper( GALLERY_DLG_COLOR ) );
+ mpBrowser2->SetControlBackground( GALLERY_DLG_COLOR );
+ mpBrowser2->SetControlForeground( GALLERY_DLG_COLOR );
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser::Resize()
+{
+ SfxDockingWindow::Resize();
+
+ const long nFrameWidth = LogicToPixel( Size( 3, 0 ), MAP_APPFONT ).Width();
+ const long nFrameWidth2 = nFrameWidth << 1;
+ Size aMinSize( GetMinOutputSizePixel() );
+ Size aNewSize( GetOutputSizePixel() );
+ Point aSplitPos( mpSplitter->GetPosPixel() );
+ const Size aSplitSize( mpSplitter->GetOutputSizePixel() );
+
+ mpBrowser1->SetPosSizePixel( Point( nFrameWidth, nFrameWidth ),
+ Size( aSplitPos.X() - nFrameWidth, aNewSize.Height() - nFrameWidth2 ) );
+
+ mpSplitter->SetPosSizePixel( aSplitPos, Size( aSplitSize.Width(), aNewSize.Height() ) );
+ mpSplitter->SetDragRectPixel( Rectangle( Point( nFrameWidth2, 0 ), Size( aNewSize.Width() - ( nFrameWidth2 << 1 ) - aSplitSize.Width(), aNewSize.Height() ) ) );
+
+ mpBrowser2->SetPosSizePixel( Point( aSplitPos.X() + aSplitSize.Width(), nFrameWidth ),
+ Size( aNewSize.Width() - aSplitSize.Width() - aSplitPos.X() - nFrameWidth, aNewSize.Height() - nFrameWidth2 ) );
+
+ maLastSize = aNewSize;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool GalleryBrowser::KeyInput( const KeyEvent& rKEvt, Window* )
+{
+ const sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
+ sal_Bool bRet = ( !rKEvt.GetKeyCode().IsMod1() &&
+ ( ( KEY_TAB == nCode ) || ( KEY_F6 == nCode && rKEvt.GetKeyCode().IsMod2() ) ) );
+
+ if( bRet )
+ {
+ if( !rKEvt.GetKeyCode().IsShift() )
+ {
+ if( mpBrowser1->mpThemes->HasChildPathFocus( sal_True ) )
+ mpBrowser2->GetViewWindow()->GrabFocus();
+ else if( mpBrowser2->GetViewWindow()->HasFocus() )
+ mpBrowser2->maViewBox.GrabFocus();
+ else if( mpBrowser2->maViewBox.HasFocus() )
+ mpBrowser1->maNewTheme.GrabFocus();
+ else
+ mpBrowser1->mpThemes->GrabFocus();
+ }
+ else
+ {
+ if( mpBrowser1->mpThemes->HasChildPathFocus( sal_True ) )
+ mpBrowser1->maNewTheme.GrabFocus();
+ else if( mpBrowser1->maNewTheme.HasFocus() )
+ mpBrowser2->maViewBox.GrabFocus();
+ else if( mpBrowser2->maViewBox.HasFocus() )
+ mpBrowser2->GetViewWindow()->GrabFocus();
+ else
+ mpBrowser1->mpThemes->GrabFocus();
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool GalleryBrowser::Close()
+{
+ return SfxDockingWindow::Close();
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser::GetFocus()
+{
+ SfxDockingWindow::GetFocus();
+ mpBrowser1->GrabFocus();
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser::ThemeSelectionHasChanged()
+{
+ mpBrowser2->SelectTheme( mpBrowser1->GetSelectedTheme() );
+}
+
+// -----------------------------------------------------------------------------
+
+INetURLObject GalleryBrowser::GetURL() const
+{
+ return mpBrowser2->GetURL();
+}
+
+// -----------------------------------------------------------------------------
+
+String GalleryBrowser::GetFilterName() const
+{
+ return mpBrowser2->GetFilterName();
+}
+
+// -----------------------------------------------------------------------------
+
+Graphic GalleryBrowser::GetGraphic() const
+{
+ return mpBrowser2->GetGraphic();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool GalleryBrowser::GetVCDrawModel( FmFormModel& rModel ) const
+{
+ return mpBrowser2->GetVCDrawModel( rModel );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool GalleryBrowser::IsLinkage() const
+{
+ return mpBrowser2->IsLinkage();
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( GalleryBrowser, SplitHdl, void*, EMPTYARG )
+{
+ mpSplitter->SetPosPixel( Point( mpSplitter->GetSplitPosPixel(), mpSplitter->GetPosPixel().Y() ) );
+ Resize();
+
+ return 0L;
+}
diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx
new file mode 100644
index 000000000000..dfa4eaad4a9d
--- /dev/null
+++ b/svx/source/gallery2/galbrws1.cxx
@@ -0,0 +1,715 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <tools/datetime.hxx>
+#include <unotools/datetime.hxx>
+#include <vcl/msgbox.hxx>
+#include <ucbhelper/content.hxx>
+#include <sfx2/app.hxx>
+#include "helpid.hrc"
+#include "svx/gallery1.hxx"
+#include "svx/galtheme.hxx"
+#include "svx/galmisc.hxx"
+#include "galbrws1.hxx"
+#include <com/sun/star/util/DateTime.hpp>
+#include "gallery.hrc"
+#include <algorithm>
+
+#include <svx/svxdlg.hxx> //CHINA001
+//CHINA001 #include <svx/dialogs.hrc> //CHINA001
+
+// --------------
+// - Namespaces -
+// --------------
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+// -----------------
+// - GalleryButton -
+// -----------------
+
+GalleryButton::GalleryButton( GalleryBrowser1* pParent, WinBits nWinBits ) :
+ PushButton( pParent, nWinBits )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+GalleryButton::~GalleryButton()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryButton::KeyInput( const KeyEvent& rKEvt )
+{
+ if( !static_cast< GalleryBrowser1* >( GetParent() )->KeyInput( rKEvt, this ) )
+ PushButton::KeyInput( rKEvt );
+}
+
+// -----------------------
+// - GalleryThemeListBox -
+// -----------------------
+
+GalleryThemeListBox::GalleryThemeListBox( GalleryBrowser1* pParent, WinBits nWinBits ) :
+ ListBox( pParent, nWinBits )
+{
+ InitSettings();
+}
+
+// -----------------------------------------------------------------------------
+
+GalleryThemeListBox::~GalleryThemeListBox()
+{
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryThemeListBox::InitSettings()
+{
+ SetBackground( Wallpaper( GALLERY_BG_COLOR ) );
+ SetControlBackground( GALLERY_BG_COLOR );
+ SetControlForeground( GALLERY_FG_COLOR );
+}
+
+// -----------------------------------------------------------------------
+
+void GalleryThemeListBox::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
+ InitSettings();
+ else
+ ListBox::DataChanged( rDCEvt );
+}
+
+// -----------------------------------------------------------------------------
+
+long GalleryThemeListBox::PreNotify( NotifyEvent& rNEvt )
+{
+ long nDone = 0;
+
+ if( rNEvt.GetType() == EVENT_COMMAND )
+ {
+ const CommandEvent* pCEvt = rNEvt.GetCommandEvent();
+
+ if( pCEvt && pCEvt->GetCommand() == COMMAND_CONTEXTMENU )
+ static_cast< GalleryBrowser1* >( GetParent() )->ShowContextMenu();
+ }
+ else if( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+
+ if( pKEvt )
+ nDone = static_cast< GalleryBrowser1* >( GetParent() )->KeyInput( *pKEvt, this );
+ }
+
+ return( nDone ? nDone : ListBox::PreNotify( rNEvt ) );
+}
+
+// -------------------
+// - GalleryBrowser1 -
+// -------------------
+
+GalleryBrowser1::GalleryBrowser1( GalleryBrowser* pParent, const ResId& rResId, Gallery* pGallery ) :
+ Control ( pParent, rResId ),
+ maNewTheme ( this, WB_3DLOOK ),
+ mpThemes ( new GalleryThemeListBox( this, WB_TABSTOP | WB_3DLOOK | WB_BORDER | WB_HSCROLL | WB_VSCROLL | WB_AUTOHSCROLL | WB_SORT ) ),
+ mpGallery ( pGallery ),
+ mpExchangeData ( new ExchangeData ),
+ mpThemePropsDlgItemSet( NULL ),
+ aImgNormal ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_NORMAL ) ),
+ aImgDefault ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_DEFAULT ) ),
+ aImgReadOnly ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_READONLY ) ),
+ aImgImported ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_IMPORTED ) )
+{
+ StartListening( *mpGallery );
+
+ maNewTheme.SetHelpId( HID_GALLERY_NEWTHEME );
+ maNewTheme.SetText( String( GAL_RESID( RID_SVXSTR_GALLERY_CREATETHEME ) ) );
+ maNewTheme.SetClickHdl( LINK( this, GalleryBrowser1, ClickNewThemeHdl ) );
+
+ // disable creation of new themes if a writable directory is not available
+ if( mpGallery->GetUserURL().GetProtocol() == INET_PROT_NOT_VALID )
+ maNewTheme.Disable();
+
+ mpThemes->SetHelpId( HID_GALLERY_THEMELIST );
+ mpThemes->SetSelectHdl( LINK( this, GalleryBrowser1, SelectThemeHdl ) );
+
+ for( sal_uIntPtr i = 0, nCount = mpGallery->GetThemeCount(); i < nCount; i++ )
+ ImplInsertThemeEntry( mpGallery->GetThemeInfo( i ) );
+
+ ImplAdjustControls();
+ maNewTheme.Show( sal_True );
+ mpThemes->Show( sal_True );
+}
+
+// -----------------------------------------------------------------------------
+
+GalleryBrowser1::~GalleryBrowser1()
+{
+ EndListening( *mpGallery );
+ delete mpThemes;
+ mpThemes = NULL;
+ delete mpExchangeData;
+ mpExchangeData = NULL;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_uIntPtr GalleryBrowser1::ImplInsertThemeEntry( const GalleryThemeEntry* pEntry )
+{
+ static const sal_Bool bShowHiddenThemes = ( getenv( "GALLERY_SHOW_HIDDEN_THEMES" ) != NULL );
+
+ sal_uIntPtr nRet = LISTBOX_ENTRY_NOTFOUND;
+
+ if( pEntry && ( !pEntry->IsHidden() || bShowHiddenThemes ) )
+ {
+ const Image* pImage;
+
+ if( pEntry->IsImported() )
+ pImage = &aImgImported;
+ else if( pEntry->IsReadOnly() )
+ pImage = &aImgReadOnly;
+ else if( pEntry->IsDefault() )
+ pImage = &aImgDefault;
+ else
+ pImage = &aImgNormal;
+
+ nRet = mpThemes->InsertEntry( pEntry->GetThemeName(), *pImage );
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser1::ImplAdjustControls()
+{
+ const Size aOutSize( GetOutputSizePixel() );
+ const long nNewThemeHeight = LogicToPixel( Size( 0, 14 ), MAP_APPFONT ).Height();
+ const long nStartY = nNewThemeHeight + 4;
+
+ maNewTheme.SetPosSizePixel( Point(),
+ Size( aOutSize.Width(), nNewThemeHeight ) );
+
+ mpThemes->SetPosSizePixel( Point( 0, nStartY ),
+ Size( aOutSize.Width(), aOutSize.Height() - nStartY ) );
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser1::ImplFillExchangeData( const GalleryTheme* pThm, ExchangeData& rData )
+{
+ rData.pTheme = (GalleryTheme*) pThm;
+ rData.aEditedTitle = pThm->GetName();
+
+ try
+ {
+ ::ucbhelper::Content aCnt( pThm->GetThmURL().GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment >() );
+ util::DateTime aDateTimeModified;
+ DateTime aDateTime;
+
+ aCnt.getPropertyValue( OUString::createFromAscii( "DateModified" ) ) >>= aDateTimeModified;
+ ::utl::typeConvert( aDateTimeModified, aDateTime );
+ rData.aThemeChangeDate = aDateTime;
+ rData.aThemeChangeTime = aDateTime;
+ }
+ catch( const ucb::ContentCreationException& )
+ {
+ }
+ catch( const uno::RuntimeException& )
+ {
+ }
+ catch( const uno::Exception& )
+ {
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+::std::vector< sal_uInt16 > GalleryBrowser1::ImplGetExecuteVector()
+{
+ ::std::vector< sal_uInt16 > aExecVector;
+ GalleryTheme* pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), *this );
+
+ if( pTheme )
+ {
+ sal_Bool bUpdateAllowed, bRenameAllowed, bRemoveAllowed;
+ static const sal_Bool bIdDialog = ( getenv( "GALLERY_ENABLE_ID_DIALOG" ) != NULL );
+
+ if( pTheme->IsReadOnly() )
+ bUpdateAllowed = bRenameAllowed = bRemoveAllowed = sal_False;
+ else if( pTheme->IsImported() )
+ {
+ bUpdateAllowed = sal_False;
+ bRenameAllowed = bRemoveAllowed = sal_True;
+ }
+ else if( pTheme->IsDefault() )
+ {
+ bUpdateAllowed = bRenameAllowed = sal_True;
+ bRemoveAllowed = sal_False;
+ }
+ else
+ bUpdateAllowed = bRenameAllowed = bRemoveAllowed = sal_True;
+
+ if( bUpdateAllowed && pTheme->GetObjectCount() )
+ aExecVector.push_back( MN_ACTUALIZE );
+
+ if( bRenameAllowed )
+ aExecVector.push_back( MN_RENAME );
+
+ if( bRemoveAllowed )
+ aExecVector.push_back( MN_DELETE );
+
+ if( bIdDialog && !pTheme->IsReadOnly() && !pTheme->IsImported() )
+ aExecVector.push_back( MN_ASSIGN_ID );
+
+ aExecVector.push_back( MN_PROPERTIES );
+
+ mpGallery->ReleaseTheme( pTheme, *this );
+ }
+
+ return aExecVector;
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser1::ImplGalleryThemeProperties( const String & rThemeName, bool bCreateNew )
+{
+ DBG_ASSERT(!mpThemePropsDlgItemSet, "mpThemePropsDlgItemSet already set!");
+ mpThemePropsDlgItemSet = new SfxItemSet( SFX_APP()->GetPool() );
+ GalleryTheme* pTheme = mpGallery->AcquireTheme( rThemeName, *this );
+
+ ImplFillExchangeData( pTheme, *mpExchangeData );
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Got no AbstractDialogFactory!");
+ VclAbstractDialog2* pThemeProps = pFact->CreateGalleryThemePropertiesDialog( NULL, mpExchangeData, mpThemePropsDlgItemSet );
+ DBG_ASSERT(pThemeProps, "Got no GalleryThemePropertiesDialog!");
+
+ if ( bCreateNew )
+ {
+ pThemeProps->StartExecuteModal(
+ LINK( this, GalleryBrowser1, EndNewThemePropertiesDlgHdl ) );
+ }
+ else
+ {
+ pThemeProps->StartExecuteModal(
+ LINK( this, GalleryBrowser1, EndThemePropertiesDlgHdl ) );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser1::ImplEndGalleryThemeProperties( VclAbstractDialog2* pDialog, bool bCreateNew )
+{
+ long nRet = pDialog->GetResult();
+
+ if( nRet == RET_OK )
+ {
+ String aName( mpExchangeData->pTheme->GetName() );
+
+ if( mpExchangeData->aEditedTitle.Len() && aName != mpExchangeData->aEditedTitle )
+ {
+ const String aOldName( aName );
+ String aTitle( mpExchangeData->aEditedTitle );
+ sal_uInt16 nCount = 0;
+
+ while( mpGallery->HasTheme( aTitle ) && ( nCount++ < 16000 ) )
+ {
+ aTitle = mpExchangeData->aEditedTitle;
+ aTitle += ' ';
+ aTitle += String::CreateFromInt32( nCount );
+ }
+
+ mpGallery->RenameTheme( aOldName, aTitle );
+ }
+
+ if ( bCreateNew )
+ {
+ mpThemes->SelectEntry( mpExchangeData->pTheme->GetName() );
+ SelectThemeHdl( NULL );
+ }
+ }
+
+ String aThemeName( mpExchangeData->pTheme->GetName() );
+ mpGallery->ReleaseTheme( mpExchangeData->pTheme, *this );
+
+ if ( bCreateNew && ( nRet != RET_OK ) )
+ {
+ mpGallery->RemoveTheme( aThemeName );
+ }
+
+ // destroy mpThemeProps asynchronously
+ Application::PostUserEvent( LINK( this, GalleryBrowser1, DestroyThemePropertiesDlgHdl ) );
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( GalleryBrowser1, EndNewThemePropertiesDlgHdl, VclAbstractDialog2*, pDialog )
+{
+ ImplEndGalleryThemeProperties( pDialog, true );
+ return 0L;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( GalleryBrowser1, EndThemePropertiesDlgHdl, VclAbstractDialog2*, pDialog )
+{
+ ImplEndGalleryThemeProperties( pDialog, false );
+ return 0L;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( GalleryBrowser1, DestroyThemePropertiesDlgHdl, VclAbstractDialog2*, pDialog )
+{
+ delete pDialog;
+ delete mpThemePropsDlgItemSet;
+ mpThemePropsDlgItemSet = 0;
+ return 0L;
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser1::ImplExecute( sal_uInt16 nId )
+{
+ switch( nId )
+ {
+ case( MN_ACTUALIZE ):
+ {
+ GalleryTheme* pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), *this );
+ //CHINA001 ActualizeProgress aActualizeProgress( this, pTheme );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ VclAbstractRefreshableDialog* aActualizeProgress = pFact->CreateActualizeProgressDialog( this, pTheme );
+ DBG_ASSERT(aActualizeProgress, "Dialogdiet fail!");//CHINA001
+
+ aActualizeProgress->Update(); //CHINA001 aActualizeProgress.Update();
+ aActualizeProgress->Execute(); //CHINA001 aActualizeProgress.Execute();
+ mpGallery->ReleaseTheme( pTheme, *this );
+ delete aActualizeProgress; //add CHINA001
+ }
+ }
+ break;
+
+ case( MN_DELETE ):
+ {
+ if( QueryBox( NULL, WB_YES_NO, String( GAL_RESID( RID_SVXSTR_GALLERY_DELETETHEME ) ) ).Execute() == RET_YES )
+ mpGallery->RemoveTheme( mpThemes->GetSelectEntry() );
+ }
+ break;
+
+ case( MN_RENAME ):
+ {
+ GalleryTheme* pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), *this );
+ const String aOldName( pTheme->GetName() );
+ //CHINA001 TitleDialog aDlg( this, aOldName );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
+ AbstractTitleDialog* aDlg = pFact->CreateTitleDialog( this, aOldName );
+ DBG_ASSERT(aDlg, "Dialogdiet fail!");//CHINA001
+
+ if( aDlg->Execute() == RET_OK ) //CHINA001 if( aDlg.Execute() == RET_OK )
+ {
+ const String aNewName( aDlg->GetTitle() ); //CHINA001 aDlg.GetTitle() );
+
+ if( aNewName.Len() && ( aNewName != aOldName ) )
+ {
+ String aName( aNewName );
+ sal_uInt16 nCount = 0;
+
+ while( mpGallery->HasTheme( aName ) && ( nCount++ < 16000 ) )
+ {
+ aName = aNewName;
+ aName += ' ';
+ aName += String::CreateFromInt32( nCount );
+ }
+
+ mpGallery->RenameTheme( aOldName, aName );
+ }
+ }
+ mpGallery->ReleaseTheme( pTheme, *this );
+ delete aDlg; //add CHINA001
+ }
+ break;
+
+ case( MN_ASSIGN_ID ):
+ {
+ GalleryTheme* pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), *this );
+
+ if( pTheme && !pTheme->IsReadOnly() && !pTheme->IsImported() )
+ {
+ //CHINA001 GalleryIdDialog aDlg( this, pTheme );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ AbstractGalleryIdDialog* aDlg = pFact->CreateGalleryIdDialog( this, pTheme );
+ DBG_ASSERT(aDlg, "Dialogdiet fail!");//CHINA001
+
+ if( aDlg->Execute() == RET_OK ) //CHINA001 if( aDlg.Execute() == RET_OK )
+ pTheme->SetId( aDlg->GetId(), sal_True ); //CHINA001 pTheme->SetId( aDlg.GetId(), sal_True );
+ delete aDlg; //add CHINA001
+ }
+ }
+
+ mpGallery->ReleaseTheme( pTheme, *this );
+ }
+ break;
+
+ case( MN_PROPERTIES ):
+ {
+ ImplGalleryThemeProperties( GetSelectedTheme(), false );
+ }
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser1::Resize()
+{
+ Control::Resize();
+ ImplAdjustControls();
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser1::GetFocus()
+{
+ Control::GetFocus();
+ if( mpThemes )
+ mpThemes->GrabFocus();
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser1::Notify( SfxBroadcaster&, const SfxHint& rHint )
+{
+ const GalleryHint& rGalleryHint = (const GalleryHint&) rHint;
+
+ switch( rGalleryHint.GetType() )
+ {
+ case( GALLERY_HINT_THEME_CREATED ):
+ ImplInsertThemeEntry( mpGallery->GetThemeInfo( rGalleryHint.GetThemeName() ) );
+ break;
+
+ case( GALLERY_HINT_THEME_RENAMED ):
+ {
+ const sal_uInt16 nCurSelectPos = mpThemes->GetSelectEntryPos();
+ const sal_uInt16 nRenameEntryPos = mpThemes->GetEntryPos( rGalleryHint.GetThemeName() );
+
+ mpThemes->RemoveEntry( rGalleryHint.GetThemeName() );
+ ImplInsertThemeEntry( mpGallery->GetThemeInfo( rGalleryHint.GetStringData() ) );
+
+ if( nCurSelectPos == nRenameEntryPos )
+ {
+ mpThemes->SelectEntry( rGalleryHint.GetStringData() );
+ SelectThemeHdl( NULL );
+ }
+ }
+ break;
+
+ case( GALLERY_HINT_THEME_REMOVED ):
+ {
+ mpThemes->RemoveEntry( rGalleryHint.GetThemeName() );
+ }
+ break;
+
+ case( GALLERY_HINT_CLOSE_THEME ):
+ {
+ const sal_uInt16 nCurSelectPos = mpThemes->GetSelectEntryPos();
+ const sal_uInt16 nCloseEntryPos = mpThemes->GetEntryPos( rGalleryHint.GetThemeName() );
+
+ if( nCurSelectPos == nCloseEntryPos )
+ {
+ if( nCurSelectPos < ( mpThemes->GetEntryCount() - 1 ) )
+ mpThemes->SelectEntryPos( nCurSelectPos + 1 );
+ else if( nCurSelectPos )
+ mpThemes->SelectEntryPos( nCurSelectPos - 1 );
+ else
+ mpThemes->SetNoSelection();
+
+ SelectThemeHdl( NULL );
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser1::ShowContextMenu()
+{
+ Application::PostUserEvent( LINK( this, GalleryBrowser1, ShowContextMenuHdl ), this );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool GalleryBrowser1::KeyInput( const KeyEvent& rKEvt, Window* pWindow )
+{
+ sal_Bool bRet = static_cast< GalleryBrowser* >( GetParent() )->KeyInput( rKEvt, pWindow );
+
+ if( !bRet )
+ {
+ ::std::vector< sal_uInt16 > aExecVector( ImplGetExecuteVector() );
+ sal_uInt16 nExecuteId = 0;
+ sal_Bool bMod1 = rKEvt.GetKeyCode().IsMod1();
+
+ switch( rKEvt.GetKeyCode().GetCode() )
+ {
+ case( KEY_INSERT ):
+ ClickNewThemeHdl( NULL );
+ break;
+
+ case( KEY_I ):
+ {
+ if( bMod1 )
+ ClickNewThemeHdl( NULL );
+ }
+ break;
+
+ case( KEY_U ):
+ {
+ if( bMod1 )
+ nExecuteId = MN_ACTUALIZE;
+ }
+ break;
+
+ case( KEY_DELETE ):
+ nExecuteId = MN_DELETE;
+ break;
+
+ case( KEY_D ):
+ {
+ if( bMod1 )
+ nExecuteId = MN_DELETE;
+ }
+ break;
+
+ case( KEY_R ):
+ {
+ if( bMod1 )
+ nExecuteId = MN_RENAME;
+ }
+ break;
+
+ case( KEY_RETURN ):
+ {
+ if( bMod1 )
+ nExecuteId = MN_PROPERTIES;
+ }
+ break;
+ }
+
+ if( nExecuteId && ( ::std::find( aExecVector.begin(), aExecVector.end(), nExecuteId ) != aExecVector.end() ) )
+ {
+ ImplExecute( nExecuteId );
+ bRet = sal_True;
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( GalleryBrowser1, ShowContextMenuHdl, void*, EMPTYARG )
+{
+ ::std::vector< sal_uInt16 > aExecVector( ImplGetExecuteVector() );
+
+ if( aExecVector.size() )
+ {
+ PopupMenu aMenu( GAL_RESID( RID_SVXMN_GALLERY1 ) );
+
+ aMenu.EnableItem( MN_ACTUALIZE, ::std::find( aExecVector.begin(), aExecVector.end(), MN_ACTUALIZE ) != aExecVector.end() );
+ aMenu.EnableItem( MN_RENAME, ::std::find( aExecVector.begin(), aExecVector.end(), MN_RENAME ) != aExecVector.end() );
+ aMenu.EnableItem( MN_DELETE, ::std::find( aExecVector.begin(), aExecVector.end(), MN_DELETE ) != aExecVector.end() );
+ aMenu.EnableItem( MN_ASSIGN_ID, ::std::find( aExecVector.begin(), aExecVector.end(), MN_ASSIGN_ID ) != aExecVector.end() );
+ aMenu.EnableItem( MN_PROPERTIES, ::std::find( aExecVector.begin(), aExecVector.end(), MN_PROPERTIES ) != aExecVector.end() );
+ aMenu.SetSelectHdl( LINK( this, GalleryBrowser1, PopupMenuHdl ) );
+ aMenu.RemoveDisabledEntries();
+
+ const Rectangle aThemesRect( mpThemes->GetPosPixel(), mpThemes->GetOutputSizePixel() );
+ Point aSelPos( mpThemes->GetBoundingRectangle( mpThemes->GetSelectEntryPos() ).Center() );
+
+ aSelPos.X() = Max( Min( aSelPos.X(), aThemesRect.Right() ), aThemesRect.Left() );
+ aSelPos.Y() = Max( Min( aSelPos.Y(), aThemesRect.Bottom() ), aThemesRect.Top() );
+
+ aMenu.Execute( this, aSelPos );
+ }
+
+ return 0L;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( GalleryBrowser1, PopupMenuHdl, Menu*, pMenu )
+{
+ ImplExecute( pMenu->GetCurItemId() );
+ return 0L;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( GalleryBrowser1, SelectThemeHdl, void*, EMPTYARG )
+{
+ ( (GalleryBrowser*) GetParent() )->ThemeSelectionHasChanged();
+ return 0L;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( GalleryBrowser1, ClickNewThemeHdl, void*, EMPTYARG )
+{
+ String aNewTheme( GAL_RESID( RID_SVXSTR_GALLERY_NEWTHEME ) );
+ String aName( aNewTheme );
+ sal_uIntPtr nCount = 0;
+
+ while( mpGallery->HasTheme( aName ) && ( nCount++ < 16000 ) )
+ {
+ aName = aNewTheme;
+ aName += ' ';
+ aName += String::CreateFromInt32( nCount );
+ }
+
+ if( !mpGallery->HasTheme( aName ) && mpGallery->CreateTheme( aName ) )
+ {
+ ImplGalleryThemeProperties( aName, true );
+ }
+
+ return 0L;
+}
+
diff --git a/svx/source/gallery2/galbrws1.hxx b/svx/source/gallery2/galbrws1.hxx
new file mode 100644
index 000000000000..d05187d4c856
--- /dev/null
+++ b/svx/source/gallery2/galbrws1.hxx
@@ -0,0 +1,135 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <vcl/lstbox.hxx>
+#include <vcl/button.hxx>
+#include <vcl/menu.hxx>
+#include <svl/lstner.hxx>
+#include <vector>
+#include "svx/galbrws.hxx"
+
+// -----------------
+// - GalleryButton -
+// -----------------
+
+class GalleryButton : public PushButton
+{
+private:
+
+ virtual void KeyInput( const KeyEvent& rKEvt );
+
+public:
+
+ GalleryButton( GalleryBrowser1* pParent, WinBits nWinBits );
+ ~GalleryButton();
+};
+
+// -----------------------
+// - GalleryThemeListBox -
+// -----------------------
+
+class GalleryThemeListBox : public ListBox
+{
+protected:
+
+ void InitSettings();
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ virtual long PreNotify( NotifyEvent& rNEvt );
+
+public:
+
+ GalleryThemeListBox( GalleryBrowser1* pParent, WinBits nWinBits );
+ ~GalleryThemeListBox();
+};
+
+// -------------------
+// - GalleryBrowser1 -
+// -------------------
+
+class Gallery;
+class GalleryThemeEntry;
+class GalleryTheme;
+class VclAbstractDialog2;
+struct ExchangeData;
+class SfxItemSet;
+
+class GalleryBrowser1 : public Control, SfxListener
+{
+ friend class GalleryBrowser;
+ friend class GalleryThemeListBox;
+ using Control::Notify;
+ using Window::KeyInput;
+
+private:
+
+ GalleryButton maNewTheme;
+ GalleryThemeListBox* mpThemes;
+ Gallery* mpGallery;
+ ExchangeData* mpExchangeData;
+ SfxItemSet* mpThemePropsDlgItemSet;
+
+ Image aImgNormal;
+ Image aImgDefault;
+ Image aImgReadOnly;
+ Image aImgImported;
+
+ void ImplAdjustControls();
+ sal_uIntPtr ImplInsertThemeEntry( const GalleryThemeEntry* pEntry );
+ void ImplFillExchangeData( const GalleryTheme* pThm, ExchangeData& rData );
+ ::std::vector< sal_uInt16 > ImplGetExecuteVector();
+ void ImplExecute( sal_uInt16 nId );
+ void ImplGalleryThemeProperties( const String & rThemeName, bool bCreateNew );
+ void ImplEndGalleryThemeProperties( VclAbstractDialog2* pDialog, bool bCreateNew );
+
+ // Control
+ virtual void Resize();
+ virtual void GetFocus();
+
+ // SfxListener
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ DECL_LINK( ClickNewThemeHdl, void* );
+ DECL_LINK( SelectThemeHdl, void* );
+ DECL_LINK( ShowContextMenuHdl, void* );
+ DECL_LINK( PopupMenuHdl, Menu* );
+ DECL_LINK( EndNewThemePropertiesDlgHdl, VclAbstractDialog2* );
+ DECL_LINK( EndThemePropertiesDlgHdl, VclAbstractDialog2* );
+ DECL_LINK( DestroyThemePropertiesDlgHdl, VclAbstractDialog2* );
+
+public:
+
+ GalleryBrowser1( GalleryBrowser* pParent, const ResId& rResId, Gallery* pGallery );
+ ~GalleryBrowser1();
+
+ void SelectTheme( const String& rThemeName ) { mpThemes->SelectEntry( rThemeName ); SelectThemeHdl( NULL ); }
+ void SelectTheme( sal_uIntPtr nThemePos ) { mpThemes->SelectEntryPos( (sal_uInt16) nThemePos ); SelectThemeHdl( NULL ); }
+ String GetSelectedTheme() { return mpThemes->GetEntryCount() ? mpThemes->GetEntry( mpThemes->GetSelectEntryPos() ) : String(); }
+
+ void ShowContextMenu();
+ sal_Bool KeyInput( const KeyEvent& rKEvt, Window* pWindow );
+};
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
new file mode 100644
index 000000000000..98e4d69ee84e
--- /dev/null
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -0,0 +1,1253 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+
+#include <sot/formats.hxx>
+#include <vcl/msgbox.hxx>
+#include <svtools/valueset.hxx>
+#include <svl/urlbmk.hxx>
+#include <svl/stritem.hxx>
+#include <svl/intitem.hxx>
+#include <svl/eitem.hxx>
+#include <svtools/transfer.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/sfxsids.hrc>
+#include "svtools/filter.hxx"
+#include <editeng/brshitem.hxx>
+#include "helpid.hrc"
+#include "svx/gallery.hxx"
+#include "galobj.hxx"
+#include "svx/gallery1.hxx"
+#include "svx/galtheme.hxx"
+#include "svx/galctrl.hxx"
+#include "svx/galmisc.hxx"
+#include "galbrws2.hxx"
+#include "gallery.hrc"
+#include <vcl/svapp.hxx>
+#include <svx/fmmodel.hxx>
+#include <svx/svxdlg.hxx> //CHINA001
+//CHINA001 #include <svx/dialogs.hrc> //CHINA001
+
+// -----------
+// - Defines -
+// -----------
+
+#undef GALLERY_USE_CLIPBOARD
+
+#define TBX_ID_ICON 1
+#define TBX_ID_LIST 2
+
+// -----------
+// - statics -
+// -----------
+
+GalleryBrowserMode GalleryBrowser2::meInitMode = GALLERYBROWSERMODE_ICON;
+
+// --------------------------
+// - GalleryBackgroundPopup -
+// --------------------------
+
+class GalleryBackgroundPopup : public PopupMenu, public SfxControllerItem
+{
+ const GalleryTheme* mpTheme;
+ sal_uIntPtr mnObjectPos;
+
+ virtual void Select();
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+
+public:
+
+ GalleryBackgroundPopup( const GalleryTheme* pTheme, sal_uIntPtr nObjectPos );
+ ~GalleryBackgroundPopup();
+};
+
+// ------------------------------------------------------------------------
+
+GalleryBackgroundPopup::GalleryBackgroundPopup( const GalleryTheme* pTheme, sal_uIntPtr nObjectPos ) :
+ SfxControllerItem ( SID_GALLERY_BG_BRUSH, SfxViewFrame::Current()->GetBindings() ),
+ mpTheme ( pTheme ),
+ mnObjectPos ( nObjectPos )
+{
+ SfxViewFrame::Current()->GetBindings().Update( SID_GALLERY_BG_BRUSH );
+ RemoveDisabledEntries();
+}
+
+// ------------------------------------------------------------------------
+
+GalleryBackgroundPopup::~GalleryBackgroundPopup()
+{
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryBackgroundPopup::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pItem )
+{
+ if ( ( nSID == SID_GALLERY_BG_BRUSH ) && pItem && ( eState != SFX_ITEM_DISABLED ) )
+ {
+ SfxStringListItem* pStrLstItem;
+ SfxStringItem* pStrItem;
+
+ PopupMenu::Clear();
+
+ if( ( pStrLstItem = PTR_CAST( SfxStringListItem, pItem ) ) != NULL )
+ {
+ List* pList = pStrLstItem->GetList();
+
+ if( pList )
+ for ( sal_uIntPtr i = 0, nCount = pList->Count(); i < nCount; i++ )
+ InsertItem( (sal_uInt16) i + 1, *(String*) pList->GetObject( i ) );
+ }
+ else if( ( pStrItem = PTR_CAST( SfxStringItem, pItem ) ) != NULL )
+ InsertItem( 1, pStrItem->GetValue() );
+ else
+ {
+ DBG_ERROR( "SgaBGPopup::StateChanged(...): Wrong item type!" );
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryBackgroundPopup::Select()
+{
+ Menu::Select();
+
+ const INetURLObject aURL( mpTheme->GetObjectURL( mnObjectPos ) );
+ const SvxBrushItem aBrushItem( aURL.GetMainURL( INetURLObject::NO_DECODE ), String(), GPOS_TILED, SID_GALLERY_BG_BRUSH );
+ const SfxUInt16Item aPosItem( SID_GALLERY_BG_POS, GetCurItemId() - 1 );
+ const SfxStringItem aPathItem( SID_FILE_NAME, aURL.GetMainURL( INetURLObject::NO_DECODE ) );
+
+ SfxViewFrame::Current()->GetBindings().GetDispatcher()->Execute( SID_GALLERY_BG_BRUSH,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aBrushItem, &aPosItem, &aPathItem, 0L );
+}
+
+// ---------------------
+// - GalleryThemePopup -
+// ---------------------
+
+class GalleryThemePopup : public PopupMenu, public SfxControllerItem
+{
+ GalleryBackgroundPopup maBackgroundPopup;
+ const GalleryTheme* mpTheme;
+ sal_uIntPtr mnObjectPos;
+ sal_Bool mbPreview;
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+
+public:
+
+ GalleryThemePopup( const GalleryTheme* pTheme, sal_uIntPtr nObjectPos, sal_Bool bPreview );
+ ~GalleryThemePopup();
+};
+
+// ------------------------------------------------------------------------
+
+GalleryThemePopup::GalleryThemePopup( const GalleryTheme* pTheme, sal_uIntPtr nObjectPos, sal_Bool bPreview ) :
+ PopupMenu ( GAL_RESID( RID_SVXMN_GALLERY2 ) ),
+ SfxControllerItem ( SID_GALLERY_ENABLE_ADDCOPY, SfxViewFrame::Current()->GetBindings() ),
+ maBackgroundPopup ( pTheme, nObjectPos ),
+ mpTheme ( pTheme ),
+ mnObjectPos ( nObjectPos ),
+ mbPreview ( bPreview )
+{
+ const SgaObjKind eObjKind = mpTheme->GetObjectKind( mnObjectPos );
+ PopupMenu* pAddMenu = GetPopupMenu( MN_ADDMENU );
+ SfxBindings& rBindings = SfxViewFrame::Current()->GetBindings();
+ INetURLObject aURL;
+
+ const_cast< GalleryTheme* >( mpTheme )->GetURL( mnObjectPos, aURL );
+ const sal_Bool bValidURL = ( aURL.GetProtocol() != INET_PROT_NOT_VALID );
+
+ pAddMenu->EnableItem( MN_ADD, bValidURL && SGA_OBJ_SOUND != eObjKind );
+ pAddMenu->EnableItem( MN_ADD_LINK, bValidURL && SGA_OBJ_SVDRAW != eObjKind );
+
+ EnableItem( MN_ADDMENU, pAddMenu->IsItemEnabled( MN_ADD ) || pAddMenu->IsItemEnabled( MN_ADD_LINK ) );
+ EnableItem( MN_PREVIEW, bValidURL );
+
+ CheckItem( MN_PREVIEW, mbPreview );
+
+ if( mpTheme->IsReadOnly() || !mpTheme->GetObjectCount() )
+ {
+ EnableItem( MN_DELETE, sal_False );
+ EnableItem( MN_TITLE, sal_False );
+
+ if( mpTheme->IsReadOnly() )
+ EnableItem( MN_PASTECLIPBOARD, sal_False );
+
+ if( !mpTheme->GetObjectCount() )
+ EnableItem( MN_COPYCLIPBOARD, sal_False );
+ }
+ else
+ {
+ EnableItem( MN_DELETE, !bPreview );
+ EnableItem( MN_TITLE, sal_True );
+ EnableItem( MN_COPYCLIPBOARD, sal_True );
+ EnableItem( MN_PASTECLIPBOARD, sal_True );
+ }
+
+#ifdef GALLERY_USE_CLIPBOARD
+ if( IsItemEnabled( MN_PASTECLIPBOARD ) )
+ {
+ TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( this ) );
+ sal_Bool bEnable = sal_False;
+
+ if( aDataHelper.GetFormatCount() )
+ {
+ if( aDataHelper.HasFormat( SOT_FORMATSTR_ID_DRAWING ) ||
+ aDataHelper.HasFormat( SOT_FORMAT_FILE_LIST ) ||
+ aDataHelper.HasFormat( FORMAT_FILE ) ||
+ aDataHelper.HasFormat( SOT_FORMATSTR_ID_SVXB ) ||
+ aDataHelper.HasFormat( FORMAT_GDIMETAFILE ) ||
+ aDataHelper.HasFormat( FORMAT_BITMAP ) )
+ {
+ bEnable = sal_True;
+ }
+ }
+
+ if( !bEnable )
+ EnableItem( MN_PASTECLIPBOARD, sal_False );
+ }
+#else
+ EnableItem( MN_COPYCLIPBOARD, sal_False );
+ EnableItem( MN_PASTECLIPBOARD, sal_False );
+#endif
+
+ if( !maBackgroundPopup.GetItemCount() || ( eObjKind == SGA_OBJ_SVDRAW ) || ( eObjKind == SGA_OBJ_SOUND ) )
+ pAddMenu->EnableItem( MN_BACKGROUND, sal_False );
+ else
+ {
+ pAddMenu->EnableItem( MN_BACKGROUND, sal_True );
+ pAddMenu->SetPopupMenu( MN_BACKGROUND, &maBackgroundPopup );
+ }
+
+ rBindings.Update( SID_GALLERY_ENABLE_ADDCOPY );
+ RemoveDisabledEntries();
+}
+
+// ------------------------------------------------------------------------
+
+GalleryThemePopup::~GalleryThemePopup()
+{
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryThemePopup::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pItem )
+{
+ if( ( nSID == SID_GALLERY_ENABLE_ADDCOPY ) && pItem && ( eState != SFX_ITEM_DISABLED ) )
+ {
+ SfxBoolItem* pBoolItem = PTR_CAST( SfxBoolItem, pItem );
+ const SgaObjKind eObjKind = mpTheme->GetObjectKind( mnObjectPos );
+
+ DBG_ASSERT( pBoolItem || pBoolItem == 0, "SfxBoolItem erwartet!");
+
+ GetPopupMenu( MN_ADDMENU )->EnableItem( MN_ADD, pBoolItem->GetValue() && ( eObjKind != SGA_OBJ_SOUND ) );
+ }
+}
+
+// ------------------
+// - GalleryToolBox -
+// ------------------
+
+GalleryToolBox::GalleryToolBox( GalleryBrowser2* pParent ) :
+ ToolBox( pParent, WB_TABSTOP )
+{
+}
+
+// ------------------------------------------------------------------------
+
+GalleryToolBox::~GalleryToolBox()
+{
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryToolBox::KeyInput( const KeyEvent& rKEvt )
+{
+ if( !static_cast< GalleryBrowser2* >( GetParent() )->KeyInput( rKEvt, this ) )
+ ToolBox::KeyInput( rKEvt );
+}
+
+// -------------------
+// - GalleryBrowser2 -
+// -------------------
+
+GalleryBrowser2::GalleryBrowser2( GalleryBrowser* pParent, const ResId& rResId, Gallery* pGallery ) :
+ Control ( pParent, rResId ),
+ mpGallery ( pGallery ),
+ mpCurTheme ( NULL ),
+ mpIconView ( new GalleryIconView( this, NULL ) ),
+ mpListView ( new GalleryListView( this, NULL ) ),
+ mpPreview ( new GalleryPreview( this, NULL ) ),
+ maViewBox ( this ),
+ maSeparator ( this, WB_VERT ),
+ maInfoBar ( this, WB_LEFT | WB_VCENTER ),
+ mnCurActionPos ( 0xffffffff ),
+ meMode ( GALLERYBROWSERMODE_NONE ),
+ meLastMode ( GALLERYBROWSERMODE_NONE ),
+ mbCurActionIsLinkage( sal_False )
+{
+ Image aDummyImage;
+ const Link aSelectHdl( LINK( this, GalleryBrowser2, SelectObjectHdl ) );
+ Font aInfoFont( maInfoBar.GetControlFont() );
+
+ maMiscOptions.AddListenerLink( LINK( this, GalleryBrowser2, MiscHdl ) );
+
+ maViewBox.InsertItem( TBX_ID_ICON, aDummyImage );
+ maViewBox.SetItemBits( TBX_ID_ICON, TIB_RADIOCHECK | TIB_AUTOCHECK );
+ maViewBox.SetHelpId( TBX_ID_ICON, HID_GALLERY_ICONVIEW );
+ maViewBox.SetQuickHelpText( TBX_ID_ICON, String( GAL_RESID( RID_SVXSTR_GALLERY_ICONVIEW ) ) );
+
+ maViewBox.InsertItem( TBX_ID_LIST, aDummyImage );
+ maViewBox.SetItemBits( TBX_ID_LIST, TIB_RADIOCHECK | TIB_AUTOCHECK );
+ maViewBox.SetHelpId( TBX_ID_LIST, HID_GALLERY_LISTVIEW );
+ maViewBox.SetQuickHelpText( TBX_ID_LIST, String( GAL_RESID( RID_SVXSTR_GALLERY_LISTVIEW ) ) );
+
+ maViewBox.SetBorder( 0, 1 );
+ MiscHdl( NULL );
+ maViewBox.SetSelectHdl( LINK( this, GalleryBrowser2, SelectTbxHdl ) );
+ maViewBox.Show();
+
+ maInfoBar.Show();
+ maSeparator.Show();
+
+ mpIconView->SetSelectHdl( aSelectHdl );
+ mpListView->SetSelectHdl( aSelectHdl );
+
+ InitSettings();
+
+ SetMode( ( GALLERYBROWSERMODE_PREVIEW != GalleryBrowser2::meInitMode ) ? GalleryBrowser2::meInitMode : GALLERYBROWSERMODE_ICON );
+}
+
+// -----------------------------------------------------------------------------
+
+GalleryBrowser2::~GalleryBrowser2()
+{
+ maMiscOptions.RemoveListenerLink( LINK( this, GalleryBrowser2, MiscHdl ) );
+
+ delete mpPreview;
+ delete mpListView;
+ delete mpIconView;
+
+ if( mpCurTheme )
+ mpGallery->ReleaseTheme( mpCurTheme, *this );
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser2::InitSettings()
+{
+ Font aInfoFont( maInfoBar.GetControlFont() );
+
+ aInfoFont.SetWeight( WEIGHT_BOLD );
+ aInfoFont.SetColor( GALLERY_FG_COLOR );
+ maInfoBar.SetControlFont( aInfoFont );
+
+ maInfoBar.SetBackground( Wallpaper( GALLERY_DLG_COLOR ) );
+ maInfoBar.SetControlBackground( GALLERY_DLG_COLOR );
+
+ maSeparator.SetBackground( Wallpaper( GALLERY_BG_COLOR ) );
+ maSeparator.SetControlBackground( GALLERY_BG_COLOR );
+ maSeparator.SetControlForeground( GALLERY_FG_COLOR );
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser2::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
+ InitSettings();
+ else
+ Control::DataChanged( rDCEvt );
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser2::Resize()
+{
+ Control::Resize();
+
+ mpIconView->Hide();
+ mpListView->Hide();
+ mpPreview->Hide();
+
+ const Size aOutSize( GetOutputSizePixel() );
+ const Size aBoxSize( maViewBox.GetOutputSizePixel() );
+ const long nOffset = 2, nSepWidth = 2;
+ const long nInfoBarX = aBoxSize.Width() + ( nOffset * 3 ) + nSepWidth;
+ const Point aPt( 0, aBoxSize.Height() + 3 );
+ const Size aSz( aOutSize.Width(), aOutSize.Height() - aPt.Y() );
+
+ maSeparator.SetPosSizePixel( Point( aBoxSize.Width() + nOffset, 0 ), Size( nSepWidth, aBoxSize.Height() ) );
+ maInfoBar.SetPosSizePixel( Point( nInfoBarX, 0 ), Size( aOutSize.Width() - nInfoBarX, aBoxSize.Height() ) );
+
+ mpIconView->SetPosSizePixel( aPt, aSz );
+ mpListView->SetPosSizePixel( aPt, aSz );
+ mpPreview->SetPosSizePixel( aPt, aSz );
+
+ switch( GetMode() )
+ {
+ case( GALLERYBROWSERMODE_ICON ): mpIconView->Show(); break;
+ case( GALLERYBROWSERMODE_LIST ): mpListView->Show(); break;
+ case( GALLERYBROWSERMODE_PREVIEW ): mpPreview->Show(); break;
+
+ default:
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser2::Notify( SfxBroadcaster&, const SfxHint& rHint )
+{
+ const GalleryHint& rGalleryHint = (const GalleryHint&) rHint;
+
+ switch( rGalleryHint.GetType() )
+ {
+ case( GALLERY_HINT_THEME_UPDATEVIEW ):
+ {
+ if( GALLERYBROWSERMODE_PREVIEW == GetMode() )
+ SetMode( meLastMode );
+
+ ImplUpdateViews( (sal_uInt16) rGalleryHint.GetData1() + 1 );
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int8 GalleryBrowser2::AcceptDrop( DropTargetHelper& rTarget, const AcceptDropEvent& )
+{
+ sal_Int8 nRet = DND_ACTION_NONE;
+
+ if( mpCurTheme && !mpCurTheme->IsReadOnly() && !mpCurTheme ->IsImported() )
+ {
+ if( !mpCurTheme->IsDragging() )
+ {
+ if( rTarget.IsDropFormatSupported( SOT_FORMATSTR_ID_DRAWING ) ||
+ rTarget.IsDropFormatSupported( SOT_FORMAT_FILE_LIST ) ||
+ rTarget.IsDropFormatSupported( FORMAT_FILE ) ||
+ rTarget.IsDropFormatSupported( SOT_FORMATSTR_ID_SVXB ) ||
+ rTarget.IsDropFormatSupported( FORMAT_GDIMETAFILE ) ||
+ rTarget.IsDropFormatSupported( FORMAT_BITMAP ) )
+ {
+ nRet = DND_ACTION_COPY;
+ }
+ }
+ else
+ nRet = DND_ACTION_COPY;
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int8 GalleryBrowser2::ExecuteDrop( DropTargetHelper&, const ExecuteDropEvent& rEvt )
+{
+ sal_Int8 nRet = DND_ACTION_NONE;
+
+ if( mpCurTheme )
+ {
+ Point aSelPos;
+ const sal_uIntPtr nItemId = ImplGetSelectedItemId( &rEvt.maPosPixel, aSelPos );
+ const sal_uIntPtr nInsertPos = ( nItemId ? ( nItemId - 1 ) : LIST_APPEND );
+
+ if( mpCurTheme->IsDragging() )
+ mpCurTheme->ChangeObjectPos( mpCurTheme->GetDragPos(), nInsertPos );
+ else
+ nRet = mpCurTheme->InsertTransferable( rEvt.maDropEvent.Transferable, nInsertPos );
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser2::StartDrag( Window*, const Point* pDragPoint )
+{
+ if( mpCurTheme )
+ {
+ Point aSelPos;
+ const sal_uIntPtr nItemId = ImplGetSelectedItemId( pDragPoint, aSelPos );
+
+ if( nItemId )
+ mpCurTheme->StartDrag( this, nItemId - 1 );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser2::TogglePreview( Window*, const Point* )
+{
+ SetMode( ( GALLERYBROWSERMODE_PREVIEW != GetMode() ) ? GALLERYBROWSERMODE_PREVIEW : meLastMode );
+ GetViewWindow()->GrabFocus();
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser2::ShowContextMenu( Window*, const Point* pContextPoint )
+{
+ Point aSelPos;
+ const sal_uIntPtr nItemId = ImplGetSelectedItemId( pContextPoint, aSelPos );
+
+ if( mpCurTheme && nItemId && ( nItemId <= mpCurTheme->GetObjectCount() ) )
+ {
+ ImplSelectItemId( nItemId );
+
+ SfxViewFrame* pCurrentViewFrame = SfxViewFrame::Current();
+ if ( pCurrentViewFrame )
+ {
+ SfxBindings& rBindings = pCurrentViewFrame->GetBindings();
+ rBindings.ENTERREGISTRATIONS();
+ GalleryThemePopup aMenu( mpCurTheme, nItemId - 1, GALLERYBROWSERMODE_PREVIEW == GetMode() );
+ rBindings.LEAVEREGISTRATIONS();
+ aMenu.SetSelectHdl( LINK( this, GalleryBrowser2, MenuSelectHdl ) );
+ aMenu.Execute( this, aSelPos );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool GalleryBrowser2::KeyInput( const KeyEvent& rKEvt, Window* pWindow )
+{
+ Point aSelPos;
+ const sal_uIntPtr nItemId = ImplGetSelectedItemId( NULL, aSelPos );
+ sal_Bool bRet = static_cast< GalleryBrowser* >( GetParent() )->KeyInput( rKEvt, pWindow );
+
+ if( !bRet && !maViewBox.HasFocus() && nItemId && mpCurTheme )
+ {
+ sal_uInt16 nExecuteId = 0;
+ const SgaObjKind eObjKind = mpCurTheme->GetObjectKind( nItemId - 1 );
+ INetURLObject aURL;
+
+ const_cast< GalleryTheme* >( mpCurTheme )->GetURL( nItemId - 1, aURL );
+
+ const sal_Bool bValidURL = ( aURL.GetProtocol() != INET_PROT_NOT_VALID );
+ sal_Bool bPreview = bValidURL;
+ sal_Bool bAdd = bValidURL;
+ sal_Bool bAddLink = ( bValidURL && SGA_OBJ_SVDRAW != eObjKind );
+ sal_Bool bDelete = sal_False;
+ sal_Bool bTitle = sal_False;
+
+ if( !mpCurTheme->IsReadOnly() && mpCurTheme->GetObjectCount() )
+ {
+ bDelete = ( GALLERYBROWSERMODE_PREVIEW != GetMode() );
+ bTitle = sal_True;
+ }
+
+ switch( rKEvt.GetKeyCode().GetCode() )
+ {
+ case( KEY_SPACE ):
+ case( KEY_RETURN ):
+ case( KEY_P ):
+ {
+ if( bPreview )
+ {
+ TogglePreview( pWindow );
+ bRet = sal_True;
+ }
+ }
+ break;
+
+ case( KEY_INSERT ):
+ case( KEY_I ):
+ {
+ if( bAddLink && rKEvt.GetKeyCode().IsShift() && rKEvt.GetKeyCode().IsMod1() )
+ nExecuteId = MN_ADD_LINK;
+ else if( bAdd )
+ nExecuteId = MN_ADD;
+ }
+ break;
+
+ case( KEY_DELETE ):
+ case( KEY_D ):
+ {
+ if( bDelete )
+ nExecuteId = MN_DELETE;
+ }
+ break;
+
+ case( KEY_T ):
+ {
+ if( bTitle )
+ nExecuteId = MN_TITLE;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if( nExecuteId )
+ {
+ ImplExecute( nExecuteId );
+ bRet = sal_True;
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser2::SelectTheme( const String& rThemeName )
+{
+ delete mpIconView, mpIconView = NULL;
+ delete mpListView, mpListView = NULL;
+ delete mpPreview, mpPreview = NULL;
+
+ if( mpCurTheme )
+ mpGallery->ReleaseTheme( mpCurTheme, *this );
+
+ mpCurTheme = mpGallery->AcquireTheme( rThemeName, *this );
+
+ mpIconView = new GalleryIconView( this, mpCurTheme );
+ mpListView = new GalleryListView( this, mpCurTheme );
+ mpPreview = new GalleryPreview( this, mpCurTheme );
+
+ const Link aSelectHdl( LINK( this, GalleryBrowser2, SelectObjectHdl ) );
+
+ mpIconView->SetSelectHdl( aSelectHdl );
+ mpListView->SetSelectHdl( aSelectHdl );
+
+ if( GALLERYBROWSERMODE_PREVIEW == GetMode() )
+ meMode = meLastMode;
+
+ Resize();
+ ImplUpdateViews( 1 );
+
+ maViewBox.EnableItem( TBX_ID_ICON, sal_True );
+ maViewBox.EnableItem( TBX_ID_LIST, sal_True );
+ maViewBox.CheckItem( ( GALLERYBROWSERMODE_ICON == GetMode() ) ? TBX_ID_ICON : TBX_ID_LIST, sal_True );
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser2::SetMode( GalleryBrowserMode eMode )
+{
+ if( GetMode() != eMode )
+ {
+ meLastMode = GetMode();
+
+ switch( eMode )
+ {
+ case( GALLERYBROWSERMODE_ICON ):
+ {
+ mpListView->Hide();
+
+ mpPreview->Hide();
+ mpPreview->SetGraphic( Graphic() );
+ mpPreview->PreviewMedia( INetURLObject() );
+
+ mpIconView->Show();
+
+ maViewBox.EnableItem( TBX_ID_ICON, sal_True );
+ maViewBox.EnableItem( TBX_ID_LIST, sal_True );
+
+ maViewBox.CheckItem( TBX_ID_ICON, sal_True );
+ maViewBox.CheckItem( TBX_ID_LIST, sal_False );
+ }
+ break;
+
+ case( GALLERYBROWSERMODE_LIST ):
+ {
+ mpIconView->Hide();
+
+ mpPreview->Hide();
+ mpPreview->SetGraphic( Graphic() );
+ mpPreview->PreviewMedia( INetURLObject() );
+
+ mpListView->Show();
+
+ maViewBox.EnableItem( TBX_ID_ICON, sal_True );
+ maViewBox.EnableItem( TBX_ID_LIST, sal_True );
+
+ maViewBox.CheckItem( TBX_ID_ICON, sal_False );
+ maViewBox.CheckItem( TBX_ID_LIST, sal_True );
+ }
+ break;
+
+ case( GALLERYBROWSERMODE_PREVIEW ):
+ {
+ Graphic aGraphic;
+ Point aSelPos;
+ const sal_uIntPtr nItemId = ImplGetSelectedItemId( NULL, aSelPos );
+
+ if( nItemId )
+ {
+ const sal_uIntPtr nPos = nItemId - 1;
+
+ mpIconView->Hide();
+ mpListView->Hide();
+
+ if( mpCurTheme )
+ mpCurTheme->GetGraphic( nPos, aGraphic );
+
+ mpPreview->SetGraphic( aGraphic );
+ mpPreview->Show();
+
+ if( mpCurTheme && mpCurTheme->GetObjectKind( nPos ) == SGA_OBJ_SOUND )
+ mpPreview->PreviewMedia( mpCurTheme->GetObjectURL( nPos ) );
+
+ maViewBox.EnableItem( TBX_ID_ICON, sal_False );
+ maViewBox.EnableItem( TBX_ID_LIST, sal_False );
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ GalleryBrowser2::meInitMode = meMode = eMode;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+Window* GalleryBrowser2::GetViewWindow() const
+{
+ Window* pRet;
+
+ switch( GetMode() )
+ {
+ case( GALLERYBROWSERMODE_LIST ): pRet = mpListView; break;
+ case( GALLERYBROWSERMODE_PREVIEW ): pRet = mpPreview; break;
+
+ default:
+ pRet = mpIconView;
+ break;
+ }
+
+ return pRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser2::Travel( GalleryBrowserTravel eTravel )
+{
+ if( mpCurTheme )
+ {
+ Point aSelPos;
+ const sal_uIntPtr nItemId = ImplGetSelectedItemId( NULL, aSelPos );
+
+ if( nItemId )
+ {
+ sal_uIntPtr nNewItemId = nItemId;
+
+ switch( eTravel )
+ {
+ case( GALLERYBROWSERTRAVEL_FIRST ): nNewItemId = 1; break;
+ case( GALLERYBROWSERTRAVEL_LAST ): nNewItemId = mpCurTheme->GetObjectCount(); break;
+ case( GALLERYBROWSERTRAVEL_PREVIOUS ): nNewItemId--; break;
+ case( GALLERYBROWSERTRAVEL_NEXT ): nNewItemId++; break;
+ default:
+ break;
+ }
+
+ if( nNewItemId < 1 )
+ nNewItemId = 1;
+ else if( nNewItemId > mpCurTheme->GetObjectCount() )
+ nNewItemId = mpCurTheme->GetObjectCount();
+
+ if( nNewItemId != nItemId )
+ {
+ ImplSelectItemId( nNewItemId );
+ ImplUpdateInfoBar();
+
+ if( GALLERYBROWSERMODE_PREVIEW == GetMode() )
+ {
+ Graphic aGraphic;
+ const sal_uIntPtr nPos = nNewItemId - 1;
+
+ mpCurTheme->GetGraphic( nPos, aGraphic );
+ mpPreview->SetGraphic( aGraphic );
+
+ if( SGA_OBJ_SOUND == mpCurTheme->GetObjectKind( nPos ) )
+ mpPreview->PreviewMedia( mpCurTheme->GetObjectURL( nPos ) );
+
+ mpPreview->Invalidate();
+ }
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser2::ImplUpdateViews( sal_uInt16 nSelectionId )
+{
+ mpIconView->Hide();
+ mpListView->Hide();
+ mpPreview->Hide();
+
+ mpIconView->Clear();
+ mpListView->Clear();
+
+ if( mpCurTheme )
+ {
+ for( sal_uIntPtr i = 0, nCount = mpCurTheme->GetObjectCount(); i < nCount; )
+ {
+ mpListView->RowInserted( i++ );
+ mpIconView->InsertItem( (sal_uInt16) i );
+ }
+
+ ImplSelectItemId( ( ( nSelectionId > mpCurTheme->GetObjectCount() ) ? mpCurTheme->GetObjectCount() : nSelectionId ) );
+ }
+
+ switch( GetMode() )
+ {
+ case( GALLERYBROWSERMODE_ICON ): mpIconView->Show(); break;
+ case( GALLERYBROWSERMODE_LIST ): mpListView->Show(); break;
+ case( GALLERYBROWSERMODE_PREVIEW ): mpPreview->Show(); break;
+
+ default:
+ break;
+ }
+
+ ImplUpdateInfoBar();
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser2::ImplUpdateInfoBar()
+{
+ String aInfoText;
+
+ if( mpCurTheme )
+ {
+ Point aSelPos;
+ const sal_uIntPtr nItemId = ImplGetSelectedItemId( NULL, aSelPos );
+
+ if( nItemId )
+ {
+ const sal_uIntPtr nPos = nItemId - 1;
+
+ aInfoText = mpCurTheme->GetName();
+
+ if( nPos < mpCurTheme->GetObjectCount() )
+ {
+ SgaObject* pObj = mpCurTheme->AcquireObject( nPos );
+
+ if( pObj )
+ {
+ aInfoText = GetItemText( *mpCurTheme, *pObj, GALLERY_ITEM_THEMENAME | GALLERY_ITEM_TITLE | GALLERY_ITEM_PATH );
+ mpCurTheme->ReleaseObject( pObj );
+ }
+ }
+ }
+ }
+
+ maInfoBar.SetText( aInfoText );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_uIntPtr GalleryBrowser2::ImplGetSelectedItemId( const Point* pSelPos, Point& rSelPos )
+{
+ const Size aOutputSizePixel( GetOutputSizePixel() );
+ sal_uIntPtr nRet = 0;
+
+ if( GALLERYBROWSERMODE_PREVIEW == GetMode() )
+ {
+ nRet = ( ( GALLERYBROWSERMODE_ICON == meLastMode ) ? mpIconView->GetSelectItemId() : ( mpListView->FirstSelectedRow() + 1 ) );
+
+ if( pSelPos )
+ rSelPos = GetPointerPosPixel();
+ else
+ rSelPos = Point( aOutputSizePixel.Width() >> 1, aOutputSizePixel.Height() >> 1 );
+ }
+ else if( GALLERYBROWSERMODE_ICON == GetMode() )
+ {
+ if( pSelPos )
+ {
+ nRet = mpIconView->GetItemId( *pSelPos );
+ rSelPos = GetPointerPosPixel();
+ }
+ else
+ {
+ nRet = mpIconView->GetSelectItemId();
+ rSelPos = mpIconView->GetItemRect( (sal_uInt16) nRet ).Center();
+ }
+ }
+ else
+ {
+ if( pSelPos )
+ {
+ nRet = mpListView->GetRowAtYPosPixel( pSelPos->Y() ) + 1;
+ rSelPos = GetPointerPosPixel();
+ }
+ else
+ {
+ nRet = mpListView->FirstSelectedRow() + 1;
+ rSelPos = mpListView->GetFieldRectPixel( (sal_uInt16) nRet, 1 ).Center();
+ }
+ }
+
+ rSelPos.X() = Max( Min( rSelPos.X(), aOutputSizePixel.Width() - 1L ), 0L );
+ rSelPos.Y() = Max( Min( rSelPos.Y(), aOutputSizePixel.Height() - 1L ), 0L );
+
+ if( nRet && ( !mpCurTheme || ( nRet > mpCurTheme->GetObjectCount() ) ) )
+ {
+ nRet = 0;
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser2::ImplSelectItemId( sal_uIntPtr nItemId )
+{
+ if( nItemId )
+ {
+
+ mpIconView->SelectItem( (sal_uInt16) nItemId );
+ mpListView->SelectRow( nItemId - 1 );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryBrowser2::ImplExecute( sal_uInt16 nId )
+{
+ Point aSelPos;
+ const sal_uIntPtr nItemId = ImplGetSelectedItemId( NULL, aSelPos );
+
+ if( mpCurTheme && nItemId )
+ {
+ mnCurActionPos = nItemId - 1;
+
+ switch( nId )
+ {
+ case( MN_ADD ):
+ case( MN_ADD_LINK ):
+ {
+ sal_uInt32 nFormat = 0;
+
+ mbCurActionIsLinkage = ( MN_ADD_LINK == nId );
+
+ switch( mpCurTheme->GetObjectKind( mnCurActionPos ) )
+ {
+ case( SGA_OBJ_BMP ):
+ case( SGA_OBJ_ANIM ):
+ case( SGA_OBJ_INET ):
+ nFormat = SGA_FORMAT_GRAPHIC | SGA_FORMAT_STRING;
+ break;
+
+ case ( SGA_OBJ_SOUND ) :
+ nFormat = SGA_FORMAT_SOUND | SGA_FORMAT_STRING;
+ break;
+
+ case( SGA_OBJ_SVDRAW ):
+ nFormat = SGA_FORMAT_GRAPHIC | SGA_FORMAT_SVDRAW | SGA_FORMAT_STRING;
+ break;
+
+ default :
+ break;
+ }
+
+ const SfxUInt32Item aItem( SID_GALLERY_FORMATS, nFormat );
+ SfxViewFrame::Current()->GetBindings().GetDispatcher()->Execute(
+ SID_GALLERY_FORMATS, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
+ }
+ break;
+
+ case( MN_PREVIEW ):
+ SetMode( ( GALLERYBROWSERMODE_PREVIEW != GetMode() ) ? GALLERYBROWSERMODE_PREVIEW : meLastMode );
+ break;
+
+ case( MN_DELETE ):
+ {
+ if( !mpCurTheme->IsReadOnly() &&
+ QueryBox( NULL, WB_YES_NO, String( GAL_RESID( RID_SVXSTR_GALLERY_DELETEOBJ ) ) ).Execute() == RET_YES )
+ {
+ mpCurTheme->RemoveObject( mnCurActionPos );
+ }
+ }
+ break;
+
+ case( MN_TITLE ):
+ {
+ SgaObject* pObj = mpCurTheme->AcquireObject( mnCurActionPos );
+
+ if( pObj )
+ {
+ const String aOldTitle( GetItemText( *mpCurTheme, *pObj, GALLERY_ITEM_TITLE ) );
+ //CHINA001 TitleDialog aDlg( this, aOldTitle );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ AbstractTitleDialog* aDlg = pFact->CreateTitleDialog( this, aOldTitle );
+ DBG_ASSERT(aDlg, "Dialogdiet fail!");//CHINA001
+ if( aDlg->Execute() == RET_OK )//CHINA001 if( aDlg.Execute() == RET_OK )
+ {
+ String aNewTitle( aDlg->GetTitle() );//CHINA001 String aNewTitle( aDlg.GetTitle() );
+
+ if( ( !aNewTitle.Len() && pObj->GetTitle().Len() ) || ( aNewTitle != aOldTitle ) )
+ {
+ if( !aNewTitle.Len() )
+ aNewTitle = String( RTL_CONSTASCII_USTRINGPARAM( "__<empty>__" ) );
+
+ pObj->SetTitle( aNewTitle );
+ mpCurTheme->InsertObject( *pObj );
+ }
+ }
+
+ mpCurTheme->ReleaseObject( pObj );
+ delete aDlg; //add CHINA001
+ }
+ }
+ }
+ break;
+
+ case( MN_COPYCLIPBOARD ):
+ {
+ Window* pWindow;
+
+ switch( GetMode() )
+ {
+ case( GALLERYBROWSERMODE_ICON ): pWindow = (Window*) mpIconView; break;
+ case( GALLERYBROWSERMODE_LIST ): pWindow = (Window*) mpListView; break;
+ case( GALLERYBROWSERMODE_PREVIEW ): pWindow = (Window*) mpPreview; break;
+
+ default:
+ pWindow = NULL;
+ break;
+ }
+
+ mpCurTheme->CopyToClipboard( pWindow, mnCurActionPos );
+ }
+ break;
+
+ case( MN_PASTECLIPBOARD ):
+ {
+ if( !mpCurTheme->IsReadOnly() )
+ {
+ TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( this ) );
+ mpCurTheme->InsertTransferable( aDataHelper.GetTransferable(), mnCurActionPos );
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+String GalleryBrowser2::GetItemText( const GalleryTheme& rTheme, const SgaObject& rObj, sal_uIntPtr nItemTextFlags )
+{
+ INetURLObject aURL;
+ String aRet;
+
+ if( rTheme.IsImported() )
+ {
+ aURL = rTheme.GetParent()->GetImportURL( rTheme.GetName() );
+
+ aURL.removeSegment();
+ aURL.Append( rObj.GetURL().GetName() );
+ }
+ else
+ aURL = rObj.GetURL();
+
+ if( nItemTextFlags & GALLERY_ITEM_THEMENAME )
+ {
+ aRet += rTheme.GetName();
+ aRet += String( RTL_CONSTASCII_USTRINGPARAM( " - " ) );
+ }
+
+ if( nItemTextFlags & GALLERY_ITEM_TITLE )
+ {
+ String aTitle( rObj.GetTitle() );
+
+ if( !aTitle.Len() )
+ aTitle = aURL.getBase( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_UNAMBIGUOUS );
+
+ if( !aTitle.Len() )
+ {
+ aTitle = aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS );
+ aTitle = aTitle.GetToken( aTitle.GetTokenCount( '/' ) - 1, '/' );
+ }
+
+ aRet += aTitle;
+ }
+
+ if( nItemTextFlags & GALLERY_ITEM_PATH )
+ {
+ const String aPath( aURL.getFSysPath( INetURLObject::FSYS_DETECT ) );
+
+ if( aPath.Len() && ( nItemTextFlags & GALLERY_ITEM_TITLE ) )
+ aRet += String( RTL_CONSTASCII_USTRINGPARAM( " (" ) );
+
+ aRet += String(aURL.getFSysPath( INetURLObject::FSYS_DETECT ));
+
+ if( aPath.Len() && ( nItemTextFlags & GALLERY_ITEM_TITLE ) )
+ aRet += ')';
+ }
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+INetURLObject GalleryBrowser2::GetURL() const
+{
+ INetURLObject aURL;
+
+ if( mpCurTheme && mnCurActionPos != 0xffffffff )
+ aURL = mpCurTheme->GetObjectURL( mnCurActionPos );
+
+ return aURL;
+}
+
+// -----------------------------------------------------------------------------
+
+String GalleryBrowser2::GetFilterName() const
+{
+ String aFilterName;
+
+ if( mpCurTheme && mnCurActionPos != 0xffffffff )
+ {
+ const SgaObjKind eObjKind = mpCurTheme->GetObjectKind( mnCurActionPos );
+
+ if( ( SGA_OBJ_BMP == eObjKind ) || ( SGA_OBJ_ANIM == eObjKind ) )
+ {
+ GraphicFilter* pFilter = GraphicFilter::GetGraphicFilter();
+ INetURLObject aURL; mpCurTheme->GetURL( mnCurActionPos, aURL );
+ sal_uInt16 nFilter = pFilter->GetImportFormatNumberForShortName( aURL.GetExtension() );
+
+ if( GRFILTER_FORMAT_DONTKNOW != nFilter )
+ aFilterName = pFilter->GetImportFormatName( nFilter );
+ }
+ }
+
+ return aFilterName;
+}
+
+// -----------------------------------------------------------------------------
+
+Graphic GalleryBrowser2::GetGraphic() const
+{
+ Graphic aGraphic;
+
+ if( mpCurTheme && mnCurActionPos != 0xffffffff )
+ mpCurTheme->GetGraphic( mnCurActionPos, aGraphic );
+
+ return aGraphic;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool GalleryBrowser2::GetVCDrawModel( FmFormModel& rModel ) const
+{
+ sal_Bool bRet = sal_False;
+
+ if( mpCurTheme && mnCurActionPos != 0xffffffff )
+ bRet = mpCurTheme->GetModel( mnCurActionPos, rModel );
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool GalleryBrowser2::IsLinkage() const
+{
+ return mbCurActionIsLinkage;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( GalleryBrowser2, MenuSelectHdl, Menu*, pMenu )
+{
+ if( pMenu )
+ ImplExecute( pMenu->GetCurItemId() );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( GalleryBrowser2, SelectObjectHdl, void*, EMPTYARG )
+{
+ ImplUpdateInfoBar();
+ return 0L;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( GalleryBrowser2, SelectTbxHdl, ToolBox*, pBox )
+{
+ if( pBox->GetCurItemId() == TBX_ID_ICON )
+ SetMode( GALLERYBROWSERMODE_ICON );
+ else if( pBox->GetCurItemId() == TBX_ID_LIST )
+ SetMode( GALLERYBROWSERMODE_LIST );
+
+ return 0L;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( GalleryBrowser2, MiscHdl, void*, EMPTYARG )
+{
+ const sal_Bool bHC = maViewBox.GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ maViewBox.SetOutStyle( maMiscOptions.GetToolboxStyle() );
+
+ BitmapEx aIconBmpEx = BitmapEx( Image( GAL_RESID( bHC? RID_SVXIMG_GALLERY_VIEW_ICON_HC : RID_SVXIMG_GALLERY_VIEW_ICON ) ).GetBitmapEx() );
+ BitmapEx aListBmpEx = BitmapEx( Image( GAL_RESID( bHC? RID_SVXIMG_GALLERY_VIEW_LIST_HC : RID_SVXIMG_GALLERY_VIEW_LIST ) ).GetBitmapEx() );
+
+ if( maMiscOptions.AreCurrentSymbolsLarge() )
+ {
+ const Size aLargeSize( 24, 24);
+
+ aIconBmpEx.Scale( aLargeSize );
+ aListBmpEx.Scale( aLargeSize );
+ }
+
+ maViewBox.SetItemImage( TBX_ID_ICON, aIconBmpEx );
+ maViewBox.SetItemImage( TBX_ID_LIST, aListBmpEx );
+ maViewBox.SetSizePixel( maViewBox.CalcWindowSizePixel() );
+
+ Resize();
+
+ return 0L;
+}
diff --git a/svx/source/gallery2/galctrl.cxx b/svx/source/gallery2/galctrl.cxx
new file mode 100644
index 000000000000..6dca7b050e01
--- /dev/null
+++ b/svx/source/gallery2/galctrl.cxx
@@ -0,0 +1,723 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <vcl/svapp.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
+#include <avmedia/mediaplayer.hxx>
+#include "helpid.hrc"
+#include "galbrws2.hxx"
+#include "svx/galtheme.hxx"
+#include "svx/galmisc.hxx"
+#include "svx/galctrl.hxx"
+#include "editeng/AccessibleStringWrap.hxx"
+#include <editeng/svxfont.hxx>
+#include "galobj.hxx"
+#include <avmedia/mediawindow.hxx>
+#include "gallery.hrc"
+#include <svtools/filter.hxx>
+
+// -----------
+// - Defines -
+// -----------
+
+#define GALLERY_BRWBOX_TITLE 1
+#define GALLERY_BRWBOX_PATH 2
+
+// ------------------
+// - GalleryPreview -
+// ------------------
+
+GalleryPreview::GalleryPreview( GalleryBrowser2* pParent, GalleryTheme* pTheme ) :
+ Window( pParent, WB_TABSTOP | WB_BORDER ),
+ DropTargetHelper( this ),
+ DragSourceHelper( this ),
+ mpTheme( pTheme )
+{
+ SetHelpId( HID_GALLERY_WINDOW );
+ InitSettings();
+}
+
+// ------------------------------------------------------------------------
+
+GalleryPreview::GalleryPreview( Window* pParent, const ResId & rResId ) :
+ Window( pParent, rResId ),
+ DropTargetHelper( this ),
+ DragSourceHelper( this ),
+ mpTheme( NULL )
+{
+ SetHelpId( HID_GALLERY_PREVIEW );
+ InitSettings();
+}
+
+// ------------------------------------------------------------------------
+
+GalleryPreview::~GalleryPreview()
+{
+}
+
+
+bool GalleryPreview::SetGraphic( const INetURLObject& _aURL )
+{
+ bool bRet = true;
+ Graphic aGraphic;
+ if( ::avmedia::MediaWindow::isMediaURL( _aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ) )
+ {
+ aGraphic = BitmapEx( GAL_RESID( RID_SVXBMP_GALLERY_MEDIA ) );
+ }
+ else
+ {
+ GraphicFilter* pFilter = GraphicFilter::GetGraphicFilter();
+ GalleryProgress aProgress( pFilter );
+ if( pFilter->ImportGraphic( aGraphic, _aURL, GRFILTER_FORMAT_DONTKNOW ) )
+ bRet = false;
+ }
+
+ SetGraphic( aGraphic );
+ Invalidate();
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryPreview::InitSettings()
+{
+ SetBackground( Wallpaper( GALLERY_BG_COLOR ) );
+ SetControlBackground( GALLERY_BG_COLOR );
+ SetControlForeground( GALLERY_FG_COLOR );
+}
+
+// -----------------------------------------------------------------------
+
+void GalleryPreview::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
+ InitSettings();
+ else
+ Window::DataChanged( rDCEvt );
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryPreview::ImplGetGraphicCenterRect( const Graphic& rGraphic, Rectangle& rResultRect ) const
+{
+ const Size aWinSize( GetOutputSizePixel() );
+ Size aNewSize( LogicToPixel( rGraphic.GetPrefSize(), rGraphic.GetPrefMapMode() ) );
+ sal_Bool bRet = sal_False;
+
+ if( aNewSize.Width() && aNewSize.Height() )
+ {
+ // scale to fit window
+ const double fGrfWH = (double) aNewSize.Width() / aNewSize.Height();
+ const double fWinWH = (double) aWinSize.Width() / aWinSize.Height();
+
+ if ( fGrfWH < fWinWH )
+ {
+ aNewSize.Width() = (long) ( aWinSize.Height() * fGrfWH );
+ aNewSize.Height()= aWinSize.Height();
+ }
+ else
+ {
+ aNewSize.Width() = aWinSize.Width();
+ aNewSize.Height()= (long) ( aWinSize.Width() / fGrfWH);
+ }
+
+ const Point aNewPos( ( aWinSize.Width() - aNewSize.Width() ) >> 1,
+ ( aWinSize.Height() - aNewSize.Height() ) >> 1 );
+
+ rResultRect = Rectangle( aNewPos, aNewSize );
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryPreview::Paint( const Rectangle& rRect )
+{
+ Window::Paint( rRect );
+
+ if( ImplGetGraphicCenterRect( aGraphicObj.GetGraphic(), aPreviewRect ) )
+ {
+ const Point aPos( aPreviewRect.TopLeft() );
+ const Size aSize( aPreviewRect.GetSize() );
+
+ if( aGraphicObj.IsAnimated() )
+ aGraphicObj.StartAnimation( this, aPos, aSize );
+ else
+ aGraphicObj.Draw( this, aPos, aSize );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryPreview::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if( mpTheme && ( rMEvt.GetClicks() == 2 ) )
+ ( (GalleryBrowser2*) GetParent() )->TogglePreview( this );
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryPreview::Command(const CommandEvent& rCEvt )
+{
+ Window::Command( rCEvt );
+
+ if( mpTheme && ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ) )
+ ( (GalleryBrowser2*) GetParent() )->ShowContextMenu( this,
+ ( rCEvt.IsMouseEvent() ? &rCEvt.GetMousePosPixel() : NULL ) );
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryPreview::KeyInput( const KeyEvent& rKEvt )
+{
+ if( mpTheme )
+ {
+ GalleryBrowser2* pBrowser = static_cast< GalleryBrowser2* >( GetParent() );
+
+ switch( rKEvt.GetKeyCode().GetCode() )
+ {
+ case( KEY_BACKSPACE ):
+ pBrowser->TogglePreview( this );
+ break;
+
+ case( KEY_HOME ):
+ pBrowser->Travel( GALLERYBROWSERTRAVEL_FIRST );
+ break;
+
+ case( KEY_END ):
+ pBrowser->Travel( GALLERYBROWSERTRAVEL_LAST );
+ break;
+
+ case( KEY_LEFT ):
+ case( KEY_UP ):
+ pBrowser->Travel( GALLERYBROWSERTRAVEL_PREVIOUS );
+ break;
+
+ case( KEY_RIGHT ):
+ case( KEY_DOWN ):
+ pBrowser->Travel( GALLERYBROWSERTRAVEL_NEXT );
+ break;
+
+ default:
+ {
+ if( !pBrowser->KeyInput( rKEvt, this ) )
+ Window::KeyInput( rKEvt );
+ }
+ break;
+ }
+ }
+ else
+ Window::KeyInput( rKEvt );
+}
+
+// ------------------------------------------------------------------------
+
+sal_Int8 GalleryPreview::AcceptDrop( const AcceptDropEvent& rEvt )
+{
+ sal_Int8 nRet;
+
+ if( mpTheme )
+ nRet = ( (GalleryBrowser2*) GetParent() )->AcceptDrop( *this, rEvt );
+ else
+ nRet = DND_ACTION_NONE;
+
+ return nRet;
+}
+
+// ------------------------------------------------------------------------
+
+sal_Int8 GalleryPreview::ExecuteDrop( const ExecuteDropEvent& rEvt )
+{
+ sal_Int8 nRet;
+
+ if( mpTheme )
+ nRet = ( (GalleryBrowser2*) GetParent() )->ExecuteDrop( *this, rEvt );
+ else
+ nRet = DND_ACTION_NONE;
+
+ return nRet;
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryPreview::StartDrag( sal_Int8, const Point& )
+{
+ if( mpTheme )
+ ( (GalleryBrowser2*) GetParent() )->StartDrag( this );
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryPreview::PreviewMedia( const INetURLObject& rURL )
+{
+ if( rURL.GetProtocol() != INET_PROT_NOT_VALID )
+ {
+ ::avmedia::MediaFloater* pFloater = AVMEDIA_MEDIAWINDOW();
+
+ if( !pFloater )
+ {
+ SfxViewFrame::Current()->GetBindings().GetDispatcher()->Execute( SID_AVMEDIA_PLAYER, SFX_CALLMODE_SYNCHRON );
+ pFloater = AVMEDIA_MEDIAWINDOW();
+ }
+
+ if( pFloater )
+ pFloater->setURL( rURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ), true );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+// -------------------
+// - GalleryIconView -
+// -------------------
+
+GalleryIconView::GalleryIconView( GalleryBrowser2* pParent, GalleryTheme* pTheme ) :
+ ValueSet( pParent, WB_TABSTOP | WB_3DLOOK | WB_BORDER | WB_ITEMBORDER | WB_DOUBLEBORDER | WB_VSCROLL | WB_FLATVALUESET ),
+ DropTargetHelper( this ),
+ DragSourceHelper( this ),
+ mpTheme ( pTheme )
+{
+ EnableFullItemMode( sal_False );
+
+ SetHelpId( HID_GALLERY_WINDOW );
+ InitSettings();
+ SetExtraSpacing( 2 );
+ SetItemWidth( S_THUMB + 6 );
+ SetItemHeight( S_THUMB + 6 );
+}
+
+// ------------------------------------------------------------------------
+
+GalleryIconView::~GalleryIconView()
+{
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryIconView::InitSettings()
+{
+ SetBackground( Wallpaper( GALLERY_BG_COLOR ) );
+ SetControlBackground( GALLERY_BG_COLOR );
+ SetControlForeground( GALLERY_FG_COLOR );
+ SetColor( GALLERY_BG_COLOR );
+}
+
+// -----------------------------------------------------------------------
+
+void GalleryIconView::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
+ InitSettings();
+ else
+ ValueSet::DataChanged( rDCEvt );
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryIconView::UserDraw( const UserDrawEvent& rUDEvt )
+{
+ const sal_uInt16 nId = rUDEvt.GetItemId();
+
+ if( nId && mpTheme )
+ {
+ SgaObject* pObj = mpTheme->AcquireObject( nId - 1 );
+
+ if( pObj )
+ {
+ const Rectangle& rRect = rUDEvt.GetRect();
+ OutputDevice* pDev = rUDEvt.GetDevice();
+ Graphic aGraphic;
+
+ if( pObj->IsThumbBitmap() )
+ {
+ Bitmap aBmp( pObj->GetThumbBmp() );
+
+ if( pObj->GetObjKind() == SGA_OBJ_SOUND )
+ aBmp.Replace( COL_LIGHTMAGENTA, COL_WHITE );
+
+ if( ( pDev->GetBitCount() <= 8 ) && ( aBmp.GetBitCount() >= 8 ) )
+ aBmp.Dither( BMP_DITHER_FLOYD );
+
+ aGraphic = aBmp;
+ }
+ else
+ aGraphic = pObj->GetThumbMtf();
+
+ Size aSize( aGraphic.GetSizePixel( pDev ) );
+
+ if ( aSize.Width() && aSize.Height() )
+ {
+ if( ( aSize.Width() > rRect.GetWidth() ) || ( aSize.Height() > rRect.GetHeight() ) )
+ {
+ Point aNewPos;
+ const double fBmpWH = (double) aSize.Width() / aSize.Height();
+ const double fThmpWH = (double) rRect.GetWidth() / rRect.GetHeight();
+
+ // Bitmap an Thumbgroesse anpassen
+ if ( fBmpWH < fThmpWH )
+ {
+ aSize.Width() = (long) ( rRect.GetHeight() * fBmpWH );
+ aSize.Height()= rRect.GetHeight();
+ }
+ else
+ {
+ aSize.Width() = rRect.GetWidth();
+ aSize.Height()= (long) ( rRect.GetWidth() / fBmpWH );
+ }
+ }
+
+ const Point aPos( ( ( rRect.GetWidth() - aSize.Width() ) >> 1 ) + rRect.Left(),
+ ( ( rRect.GetHeight() - aSize.Height() ) >> 1 ) + rRect.Top() );
+
+ aGraphic.Draw( pDev, aPos, aSize );
+ }
+
+ SetItemText( nId, GalleryBrowser2::GetItemText( *mpTheme, *pObj, GALLERY_ITEM_THEMENAME | GALLERY_ITEM_TITLE | GALLERY_ITEM_PATH ) );
+ mpTheme->ReleaseObject( pObj );
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryIconView::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ ValueSet::MouseButtonDown( rMEvt );
+
+ if( rMEvt.GetClicks() == 2 )
+ ( (GalleryBrowser2*) GetParent() )->TogglePreview( this, &rMEvt.GetPosPixel() );
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryIconView::Command( const CommandEvent& rCEvt )
+{
+ ValueSet::Command( rCEvt );
+
+ if( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
+ {
+ ( (GalleryBrowser2*) GetParent() )->ShowContextMenu( this,
+ ( rCEvt.IsMouseEvent() ? &rCEvt.GetMousePosPixel() : NULL ) );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryIconView::KeyInput( const KeyEvent& rKEvt )
+{
+ if( !mpTheme || !static_cast< GalleryBrowser2* >( GetParent() )->KeyInput( rKEvt, this ) )
+ ValueSet::KeyInput( rKEvt );
+}
+
+// ------------------------------------------------------------------------
+
+sal_Int8 GalleryIconView::AcceptDrop( const AcceptDropEvent& rEvt )
+{
+ return( static_cast< GalleryBrowser2* >( GetParent() )->AcceptDrop( *this, rEvt ) );
+}
+
+// ------------------------------------------------------------------------
+
+sal_Int8 GalleryIconView::ExecuteDrop( const ExecuteDropEvent& rEvt )
+{
+ return( static_cast< GalleryBrowser2* >( GetParent() )->ExecuteDrop( *this, rEvt ) );
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryIconView::StartDrag( sal_Int8, const Point& )
+{
+ const CommandEvent aEvt( GetPointerPosPixel(), COMMAND_STARTDRAG, sal_True );
+ Region aRegion;
+
+ // call this to initiate dragging for ValueSet
+ ValueSet::StartDrag( aEvt, aRegion );
+ static_cast< GalleryBrowser2* >( GetParent() )->StartDrag( this );
+}
+
+// -------------------
+// - GalleryListView -
+// -------------------
+
+GalleryListView::GalleryListView( GalleryBrowser2* pParent, GalleryTheme* pTheme ) :
+ BrowseBox( pParent, WB_TABSTOP | WB_3DLOOK | WB_BORDER ),
+ mpTheme( pTheme ),
+ mnCurRow( 0 ),
+ mbInit( sal_False )
+{
+ SetHelpId( HID_GALLERY_WINDOW );
+
+ InitSettings();
+
+ SetMode( BROWSER_AUTO_VSCROLL | BROWSER_AUTOSIZE_LASTCOL );
+ SetDataRowHeight( 28 );
+ InsertDataColumn( GALLERY_BRWBOX_TITLE, String( GAL_RESID( RID_SVXSTR_GALLERY_TITLE ) ), 256 );
+ InsertDataColumn( GALLERY_BRWBOX_PATH, String( GAL_RESID( RID_SVXSTR_GALLERY_PATH ) ), 256 );
+}
+
+// ------------------------------------------------------------------------
+
+GalleryListView::~GalleryListView()
+{
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryListView::InitSettings()
+{
+ SetBackground( Wallpaper( GALLERY_BG_COLOR ) );
+ SetControlBackground( GALLERY_BG_COLOR );
+ SetControlForeground( GALLERY_FG_COLOR );
+}
+
+// -----------------------------------------------------------------------
+
+void GalleryListView::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
+ InitSettings();
+ else
+ BrowseBox::DataChanged( rDCEvt );
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryListView::SeekRow( long nRow )
+{
+ mnCurRow = nRow;
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------------
+
+String GalleryListView::GetCellText(long _nRow, sal_uInt16 nColumnId) const
+{
+ String sRet;
+ if( mpTheme && ( _nRow < static_cast< long >( mpTheme->GetObjectCount() ) ) )
+ {
+ SgaObject* pObj = mpTheme->AcquireObject( _nRow );
+
+ if( pObj )
+ {
+ sRet = GalleryBrowser2::GetItemText( *mpTheme, *pObj,
+ ( GALLERY_BRWBOX_TITLE == nColumnId ) ? GALLERY_ITEM_TITLE : GALLERY_ITEM_PATH );
+
+ mpTheme->ReleaseObject( pObj );
+ }
+ }
+
+ return sRet;;
+}
+
+// -----------------------------------------------------------------------------
+
+Rectangle GalleryListView::GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex)
+{
+ DBG_ASSERT(_nColumnPos >= 0 && _nColumnPos <= USHRT_MAX, "GalleryListView::GetFieldCharacterBounds: _nColumnId overflow");
+ Rectangle aRect;
+ if ( SeekRow(_nRow) )
+ {
+ SvxFont aFont( GetFont() );
+ AccessibleStringWrap aStringWrap( *this, aFont, GetCellText(_nRow, sal::static_int_cast<sal_uInt16>( GetColumnId( sal::static_int_cast<sal_uInt16>(_nColumnPos) ) ) ) );
+
+ // get the bounds inside the string
+ aStringWrap.GetCharacterBounds(nIndex, aRect);
+
+ // offset to
+ }
+ return aRect;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 GalleryListView::GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint)
+{
+ DBG_ASSERT(_nColumnPos >= 0 && _nColumnPos <= USHRT_MAX, "GalleryListView::GetFieldIndexAtPoint: _nColumnId overflow");
+ sal_Int32 nRet = -1;
+ if ( SeekRow(_nRow) )
+ {
+ SvxFont aFont( GetFont() );
+ AccessibleStringWrap aStringWrap( *this, aFont, GetCellText(_nRow, sal::static_int_cast<sal_uInt16>(GetColumnId(sal::static_int_cast<sal_uInt16>(_nColumnPos)))) );
+ nRet = aStringWrap.GetIndexAtPoint(_rPoint);
+ }
+ return nRet;
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryListView::PaintField( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId ) const
+{
+ rDev.Push( PUSH_CLIPREGION );
+ rDev.IntersectClipRegion( rRect );
+
+ if( mpTheme && ( mnCurRow < mpTheme->GetObjectCount() ) )
+ {
+ SgaObject* pObj = mpTheme->AcquireObject( mnCurRow );
+
+ if( pObj )
+ {
+ const long nTextPosY = rRect.Top() + ( ( rRect.GetHeight() - rDev.GetTextHeight() ) >> 1 );
+
+ if( GALLERY_BRWBOX_TITLE == nColumnId )
+ {
+ Rectangle aOutputRect( rRect.TopLeft(), Size( rRect.GetHeight(), rRect.GetHeight() ) );
+ GraphicObject aGrfObj;
+
+ if( pObj->GetObjKind() == SGA_OBJ_SOUND )
+ aGrfObj = Graphic( BitmapEx( GAL_RESID( RID_SVXBMP_GALLERY_MEDIA ) ) );
+ else if( pObj->IsThumbBitmap() )
+ aGrfObj = Graphic( pObj->GetThumbBmp() );
+ else
+ aGrfObj = Graphic( pObj->GetThumbMtf() );
+
+ Size aSize( rDev.LogicToPixel( aGrfObj.GetPrefSize(), aGrfObj.GetPrefMapMode() ) );
+
+ if( aSize.Width() && aSize.Height() )
+ {
+ if( ( aSize.Width() > aOutputRect.GetWidth() ) || ( aSize.Height() > aOutputRect.GetHeight() ) )
+ {
+ Point aNewPos;
+ const double fBmpWH = (double) aSize.Width() / aSize.Height();
+ const double fThmpWH = (double) aOutputRect.GetWidth() / aOutputRect.GetHeight();
+
+ // Bitmap an Thumbgroesse anpassen
+ if ( fBmpWH < fThmpWH )
+ {
+ aSize.Width() = (long) ( aOutputRect.GetHeight() * fBmpWH );
+ aSize.Height()= aOutputRect.GetHeight();
+ }
+ else
+ {
+ aSize.Width() = aOutputRect.GetWidth();
+ aSize.Height()= (long) ( aOutputRect.GetWidth() / fBmpWH );
+ }
+ }
+
+ aSize.Width() = Max( aSize.Width(), 4L );
+ aSize.Height() = Max( aSize.Height(), 4L );
+
+ const Point aPos( ( ( aOutputRect.GetWidth() - aSize.Width() ) >> 1 ) + aOutputRect.Left(),
+ ( ( aOutputRect.GetHeight() - aSize.Height() ) >> 1 ) + aOutputRect.Top() );
+
+ aGrfObj.Draw( &rDev, aPos, aSize );
+ }
+
+ rDev.DrawText( Point( aOutputRect.Right() + 6, nTextPosY ), GalleryBrowser2::GetItemText( *mpTheme, *pObj, GALLERY_ITEM_TITLE ) );
+ }
+ else if( GALLERY_BRWBOX_PATH == nColumnId )
+ rDev.DrawText( Point( rRect.Left(), nTextPosY ), GalleryBrowser2::GetItemText( *mpTheme, *pObj, GALLERY_ITEM_PATH ) );
+
+ mpTheme->ReleaseObject( pObj );
+ }
+ }
+
+ rDev.Pop();
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryListView::Command( const CommandEvent& rCEvt )
+{
+ BrowseBox::Command( rCEvt );
+
+ if( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
+ {
+ const Point* pPos = NULL;
+
+ if( rCEvt.IsMouseEvent() && ( GetRowAtYPosPixel( rCEvt.GetMousePosPixel().Y() ) != BROWSER_ENDOFSELECTION ) )
+ pPos = &rCEvt.GetMousePosPixel();
+
+ ( (GalleryBrowser2*) GetParent() )->ShowContextMenu( this, pPos );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryListView::KeyInput( const KeyEvent& rKEvt )
+{
+ if( !mpTheme || !static_cast< GalleryBrowser2* >( GetParent() )->KeyInput( rKEvt, this ) )
+ BrowseBox::KeyInput( rKEvt );
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryListView::DoubleClick( const BrowserMouseEvent& rEvt )
+{
+ BrowseBox::DoubleClick( rEvt );
+
+ if( rEvt.GetRow() != BROWSER_ENDOFSELECTION )
+ ( (GalleryBrowser2*) GetParent() )->TogglePreview( this, &rEvt.GetPosPixel() );
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryListView::Select()
+{
+ if( maSelectHdl.IsSet() )
+ maSelectHdl.Call( this );
+}
+
+// ------------------------------------------------------------------------
+
+sal_Int8 GalleryListView::AcceptDrop( const BrowserAcceptDropEvent& )
+{
+ sal_Int8 nRet = DND_ACTION_NONE;
+
+ if( mpTheme && !mpTheme->IsReadOnly() && !mpTheme ->IsImported() )
+ {
+ if( !mpTheme->IsDragging() )
+ nRet = DND_ACTION_COPY;
+ else
+ nRet = DND_ACTION_COPY;
+ }
+
+ return nRet;
+}
+
+// ------------------------------------------------------------------------
+
+sal_Int8 GalleryListView::ExecuteDrop( const BrowserExecuteDropEvent& rEvt )
+{
+ ExecuteDropEvent aEvt( rEvt );
+
+ aEvt.maPosPixel.Y() += GetTitleHeight();
+
+ return( ( (GalleryBrowser2*) GetParent() )->ExecuteDrop( *this, aEvt ) );
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryListView::StartDrag( sal_Int8, const Point& rPosPixel )
+{
+ ( (GalleryBrowser2*) GetParent() )->StartDrag( this, &rPosPixel );
+}
diff --git a/svx/source/gallery2/galexpl.cxx b/svx/source/gallery2/galexpl.cxx
new file mode 100644
index 000000000000..84f62fc795e7
--- /dev/null
+++ b/svx/source/gallery2/galexpl.cxx
@@ -0,0 +1,515 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <unotools/pathoptions.hxx>
+#include <sfx2/viewfrm.hxx>
+#include "svx/gallery1.hxx"
+#include "svx/galtheme.hxx"
+#include "svx/galbrws.hxx"
+#include "svx/gallery.hxx"
+#include "galobj.hxx"
+
+// -----------
+// - Statics -
+// -----------
+
+static SfxListener aLockListener;
+
+// -------------------
+// - GalleryExplorer -
+// -------------------
+
+Gallery* GalleryExplorer::ImplGetGallery()
+{
+ static Gallery* pGallery = NULL;
+
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+
+ if( !pGallery )
+ pGallery = Gallery::GetGalleryInstance();
+
+ return pGallery;
+}
+
+// ------------------------------------------------------------------------
+
+GalleryExplorer* GalleryExplorer::GetGallery()
+{
+ static GalleryExplorer* pThis = NULL;
+
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+
+ // only create a dummy object which can be accessed
+ if( !pThis )
+ pThis = new GalleryExplorer;
+
+ return pThis;
+}
+
+// ------------------------------------------------------------------------
+
+INetURLObject GalleryExplorer::GetURL() const
+{
+ return GALLERYBROWSER()->GetURL();
+}
+
+String GalleryExplorer::GetFilterName() const
+{
+ return GALLERYBROWSER()->GetFilterName();
+}
+
+// ------------------------------------------------------------------------
+
+Graphic GalleryExplorer::GetGraphic() const
+{
+ return GALLERYBROWSER()->GetGraphic();
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryExplorer::GetVCDrawModel( FmFormModel& rModel ) const
+{
+ return GALLERYBROWSER()->GetVCDrawModel( rModel );
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryExplorer::IsLinkage() const
+{
+ return GALLERYBROWSER()->IsLinkage();
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryExplorer::FillThemeList( List& rThemeList )
+{
+ Gallery* pGal = ImplGetGallery();
+
+ if( pGal )
+ {
+ for( sal_uIntPtr i = 0, nCount = pGal->GetThemeCount(); i < nCount; i++ )
+ {
+ const GalleryThemeEntry* pEntry = pGal->GetThemeInfo( i );
+
+ if( pEntry && !pEntry->IsReadOnly() && !pEntry->IsHidden() )
+ rThemeList.Insert( new String( pEntry->GetThemeName() ), LIST_APPEND );
+ }
+ }
+
+ return( rThemeList.Count() > 0 );
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryExplorer::FillObjList( const String& rThemeName, List& rObjList )
+{
+ Gallery* pGal = ImplGetGallery();
+
+ if( pGal )
+ {
+ SfxListener aListener;
+ GalleryTheme* pTheme = pGal->AcquireTheme( rThemeName, aListener );
+
+ if( pTheme )
+ {
+ for( sal_uIntPtr i = 0, nCount = pTheme->GetObjectCount(); i < nCount; i++ )
+ rObjList.Insert( new String( pTheme->GetObjectURL( i ).GetMainURL( INetURLObject::NO_DECODE ) ), LIST_APPEND );
+
+ pGal->ReleaseTheme( pTheme, aListener );
+ }
+ }
+
+ return( rObjList.Count() > 0 );
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryExplorer::FillObjList( sal_uIntPtr nThemeId, List& rObjList )
+{
+ Gallery* pGal = ImplGetGallery();
+ return( pGal ? FillObjList( pGal->GetThemeName( nThemeId ), rObjList ) : sal_False );
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryExplorer::FillObjListTitle( const sal_uInt32 nThemeId, std::vector< rtl::OUString >& rList )
+{
+ Gallery* pGal = ImplGetGallery();
+ if( pGal )
+ {
+ SfxListener aListener;
+ GalleryTheme* pTheme = pGal->AcquireTheme( pGal->GetThemeName( nThemeId ), aListener );
+
+ if( pTheme )
+ {
+ for( sal_uIntPtr i = 0, nCount = pTheme->GetObjectCount(); i < nCount; i++ )
+ {
+ SgaObject* pObj = pTheme->AcquireObject( i );
+ if ( pObj )
+ {
+ rtl::OUString aTitle( pObj->GetTitle() );
+ rList.push_back( aTitle );
+ pTheme->ReleaseObject( pObj );
+ }
+ }
+ pGal->ReleaseTheme( pTheme, aListener );
+ }
+ }
+ return( rList.size() > 0 );
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryExplorer::InsertURL( const String& rThemeName, const String& rURL )
+{
+ return InsertURL( rThemeName, rURL, SGA_FORMAT_ALL );
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryExplorer::InsertURL( sal_uIntPtr nThemeId, const String& rURL )
+{
+ return InsertURL( nThemeId, rURL, SGA_FORMAT_ALL );
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryExplorer::InsertURL( const String& rThemeName, const String& rURL, const sal_uIntPtr )
+{
+ Gallery* pGal = ImplGetGallery();
+ sal_Bool bRet = sal_False;
+
+ if( pGal )
+ {
+ SfxListener aListener;
+ GalleryTheme* pTheme = pGal->AcquireTheme( rThemeName, aListener );
+
+ if( pTheme )
+ {
+ INetURLObject aURL( rURL );
+ DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+ bRet = pTheme->InsertURL( aURL );
+ pGal->ReleaseTheme( pTheme, aListener );
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryExplorer::InsertURL( sal_uIntPtr nThemeId, const String& rURL, const sal_uIntPtr nSgaFormat )
+{
+ Gallery* pGal = ImplGetGallery();
+ return( pGal ? InsertURL( pGal->GetThemeName( nThemeId ), rURL, nSgaFormat ) : sal_False );
+}
+
+// ------------------------------------------------------------------------
+
+sal_uIntPtr GalleryExplorer::GetObjCount( const String& rThemeName )
+{
+ Gallery* pGal = ImplGetGallery();
+ sal_uIntPtr nRet = 0;
+
+ if( pGal )
+ {
+ SfxListener aListener;
+ GalleryTheme* pTheme = pGal->AcquireTheme( rThemeName, aListener );
+
+ if( pTheme )
+ {
+ nRet = pTheme->GetObjectCount();
+ pGal->ReleaseTheme( pTheme, aListener );
+ }
+ }
+
+ return nRet;
+}
+
+// ------------------------------------------------------------------------
+
+sal_uIntPtr GalleryExplorer::GetObjCount( sal_uIntPtr nThemeId )
+{
+ Gallery* pGal = ImplGetGallery();
+ return( pGal ? GetObjCount( pGal->GetThemeName( nThemeId ) ) : sal_False );
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryExplorer::GetGraphicObj( const String& rThemeName, sal_uIntPtr nPos,
+ Graphic* pGraphic, Bitmap* pThumb,
+ sal_Bool bProgress )
+{
+ Gallery* pGal = ImplGetGallery();
+ sal_Bool bRet = sal_False;
+
+ if( pGal )
+ {
+ SfxListener aListener;
+ GalleryTheme* pTheme = pGal->AcquireTheme( rThemeName, aListener );
+
+ if( pTheme )
+ {
+ if( pGraphic )
+ bRet = bRet || pTheme->GetGraphic( nPos, *pGraphic, bProgress );
+
+ if( pThumb )
+ bRet = bRet || pTheme->GetThumb( nPos, *pThumb, bProgress );
+
+ pGal->ReleaseTheme( pTheme, aListener );
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryExplorer::GetGraphicObj( sal_uIntPtr nThemeId, sal_uIntPtr nPos,
+ Graphic* pGraphic, Bitmap* pThumb,
+ sal_Bool bProgress )
+{
+ Gallery* pGal = ImplGetGallery();
+ return( pGal ? GetGraphicObj( pGal->GetThemeName( nThemeId ), nPos, pGraphic, pThumb, bProgress ) : sal_False );
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryExplorer::InsertGraphicObj( const String& rThemeName, const Graphic& rGraphic )
+{
+ Gallery* pGal = ImplGetGallery();
+ sal_Bool bRet = sal_False;
+
+ if( pGal )
+ {
+ SfxListener aListener;
+ GalleryTheme* pTheme = pGal->AcquireTheme( rThemeName, aListener );
+
+ if( pTheme )
+ {
+ bRet = pTheme->InsertGraphic( rGraphic );
+ pGal->ReleaseTheme( pTheme, aListener );
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryExplorer::InsertGraphicObj( sal_uIntPtr nThemeId, const Graphic& rGraphic )
+{
+ Gallery* pGal = ImplGetGallery();
+ return( pGal ? InsertGraphicObj( pGal->GetThemeName( nThemeId ), rGraphic ) : sal_False );
+}
+
+// ------------------------------------------------------------------------
+
+sal_uIntPtr GalleryExplorer::GetSdrObjCount( const String& rThemeName )
+{
+ Gallery* pGal = ImplGetGallery();
+ sal_uIntPtr nRet = 0;
+
+ if( pGal )
+ {
+ SfxListener aListener;
+ GalleryTheme* pTheme = pGal->AcquireTheme( rThemeName, aListener );
+
+ if( pTheme )
+ {
+ for( sal_uIntPtr i = 0, nCount = pTheme->GetObjectCount(); i < nCount; i++ )
+ if( SGA_OBJ_SVDRAW == pTheme->GetObjectKind( i ) )
+ nRet++;
+
+ pGal->ReleaseTheme( pTheme, aListener );
+ }
+ }
+
+ return nRet;
+}
+
+// ------------------------------------------------------------------------
+
+sal_uIntPtr GalleryExplorer::GetSdrObjCount( sal_uIntPtr nThemeId )
+{
+ Gallery* pGal = ImplGetGallery();
+ return( pGal ? GetSdrObjCount( pGal->GetThemeName( nThemeId ) ) : sal_False );
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryExplorer::GetSdrObj( const String& rThemeName, sal_uIntPtr nSdrModelPos,
+ SdrModel* pModel, Bitmap* pThumb )
+{
+ Gallery* pGal = ImplGetGallery();
+ sal_Bool bRet = sal_False;
+
+ if( pGal )
+ {
+ SfxListener aListener;
+ GalleryTheme* pTheme = pGal->AcquireTheme( rThemeName, aListener );
+
+ if( pTheme )
+ {
+ for( sal_uIntPtr i = 0, nCount = pTheme->GetObjectCount(), nActPos = 0; ( i < nCount ) && !bRet; i++ )
+ {
+ if( SGA_OBJ_SVDRAW == pTheme->GetObjectKind( i ) )
+ {
+ if( nActPos++ == nSdrModelPos )
+ {
+ if( pModel )
+ bRet = bRet || pTheme->GetModel( i, *pModel, sal_False );
+
+ if( pThumb )
+ bRet = bRet || pTheme->GetThumb( i, *pThumb );
+ }
+ }
+ }
+
+ pGal->ReleaseTheme( pTheme, aListener );
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryExplorer::GetSdrObj( sal_uIntPtr nThemeId, sal_uIntPtr nSdrModelPos,
+ SdrModel* pModel, Bitmap* pThumb )
+{
+ Gallery* pGal = ImplGetGallery();
+ return( pGal ? GetSdrObj( pGal->GetThemeName( nThemeId ), nSdrModelPos, pModel, pThumb ) : sal_False );
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryExplorer::InsertSdrObj( const String& rThemeName, FmFormModel& rModel )
+{
+ Gallery* pGal = ImplGetGallery();
+ sal_Bool bRet = sal_False;
+
+ if( pGal )
+ {
+ SfxListener aListener;
+ GalleryTheme* pTheme = pGal->AcquireTheme( rThemeName, aListener );
+
+ if( pTheme )
+ {
+ bRet = pTheme->InsertModel( rModel );
+ pGal->ReleaseTheme( pTheme, aListener );
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryExplorer::InsertSdrObj( sal_uIntPtr nThemeId, FmFormModel& rModel )
+{
+ Gallery* pGal = ImplGetGallery();
+ return( pGal ? InsertSdrObj( pGal->GetThemeName( nThemeId ), rModel ) : sal_False );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool GalleryExplorer::BeginLocking( const String& rThemeName )
+{
+ Gallery* pGal = ImplGetGallery();
+ sal_Bool bRet = sal_False;
+
+ if( pGal )
+ {
+ GalleryTheme* pTheme = pGal->AcquireTheme( rThemeName, aLockListener );
+
+ if( pTheme )
+ {
+ pTheme->LockTheme();
+ bRet = sal_True;
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool GalleryExplorer::BeginLocking( sal_uIntPtr nThemeId )
+{
+ Gallery* pGal = ImplGetGallery();
+ return( pGal ? BeginLocking( pGal->GetThemeName( nThemeId ) ) : sal_False );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool GalleryExplorer::EndLocking( const String& rThemeName )
+{
+ Gallery* pGal = ImplGetGallery();
+ sal_Bool bRet = sal_False;
+
+ if( pGal )
+ {
+ SfxListener aListener;
+ GalleryTheme* pTheme = pGal->AcquireTheme( rThemeName, aListener );
+
+ if( pTheme )
+ {
+ const sal_Bool bReleaseLockedTheme = pTheme->UnlockTheme();
+
+ // release acquired theme
+ pGal->ReleaseTheme( pTheme, aListener );
+
+ if( bReleaseLockedTheme )
+ {
+ // release locked theme
+ pGal->ReleaseTheme( pTheme, aLockListener );
+ bRet = sal_True;
+ }
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool GalleryExplorer::EndLocking( sal_uIntPtr nThemeId )
+{
+ Gallery* pGal = ImplGetGallery();
+ return( pGal ? EndLocking( pGal->GetThemeName( nThemeId ) ) : sal_False );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool GalleryExplorer::DrawCentered( OutputDevice* pOut, const FmFormModel& rModel )
+{
+ return SgaObjectSvDraw::DrawCentered( pOut, rModel );
+}
diff --git a/svx/source/gallery2/gallery.src b/svx/source/gallery2/gallery.src
new file mode 100644
index 000000000000..39ee6e0e6b1b
--- /dev/null
+++ b/svx/source/gallery2/gallery.src
@@ -0,0 +1,493 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <sfx2/sfxsids.hrc>
+#include "helpid.hrc"
+#include "gallery.hrc"
+
+/******************************************************************************/
+
+#define MASKCOLOR MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
+
+DockingWindow RID_SVXDLG_GALLERYBROWSER
+{
+ HelpId = "SVX_HID_GALLERY_BROWSER" ;
+ OutputSize = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 211, 100 ) ;
+ Text [ en-US ] = "Gallery";
+ Sizeable = TRUE;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+ Dockable = TRUE ;
+ EnableResizing = TRUE ;
+
+ Control GALLERY_BROWSER1
+ {
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 69, 150 ) ;
+ Border = FALSE;
+ };
+
+ Splitter GALLERY_SPLITTER
+ {
+ Pos = MAP_APPFONT ( 70 , 0 ) ;
+ Size = MAP_APPFONT ( 3, 150 ) ;
+ HScroll = TRUE;
+ };
+
+ Control GALLERY_BROWSER2
+ {
+ Pos = MAP_APPFONT ( 73, 0 ) ;
+ Size = MAP_APPFONT ( 138, 150 ) ;
+ Border = FALSE;
+ };
+};
+
+/******************************************************************************/
+
+String RID_SVXSTR_GALLERY_ACTUALIZE_PROGRESS
+{
+ Text [ en-US ] = "Update";
+};
+String RID_SVXSTR_GALLERY_FOPENERROR
+{
+ Text [ en-US ] = "This file cannot be opened" ;
+};
+String RID_SVXSTR_GALLERY_NOTHEME
+{
+ Text [ en-US ] = "Invalid Theme Name!" ;
+};
+String RID_SVXSTR_GALLERY_DELETEOBJ
+{
+ Text [ en-US ] = "Do you really want to\ndelete this object?" ;
+};
+String RID_SVXSTR_GALLERY_DELETETHEME
+{
+ Text [ en-US ] = "Do you really want to\ndelete this theme?" ;
+};
+String RID_SVXSTR_EXTFORMAT1_SYS
+{
+ Text = "wav" ;
+};
+String RID_SVXSTR_EXTFORMAT1_UI
+{
+ Text [ en-US ] = "Wave - Sound File" ;
+};
+String RID_SVXSTR_EXTFORMAT2_SYS
+{
+ Text = "aif" ;
+};
+String RID_SVXSTR_EXTFORMAT2_UI
+{
+ Text [ en-US ] = "Audio Interchange File Format" ;
+};
+String RID_SVXSTR_EXTFORMAT3_SYS
+{
+ Text = "au" ;
+};
+String RID_SVXSTR_EXTFORMAT3_UI
+{
+ Text [ en-US ] = "AU - Sound File" ;
+};
+String RID_SVXSTR_GALLERY_FILTER
+{
+ Text [ en-US ] = "Graphics filter" ;
+};
+String RID_SVXSTR_GALLERY_LENGTH
+{
+ Text [ en-US ] = "Length:" ;
+};
+String RID_SVXSTR_GALLERY_SIZE
+{
+ Text [ en-US ] = "Size:" ;
+};
+String RID_SVXSTR_GALLERY_DELETEDD
+{
+ Text [ en-US ] = "Do you want to delete the linked file?" ;
+};
+String RID_SVXSTR_GALLERY_SGIERROR
+{
+ Text [ en-US ] = "This file cannot be opened.\nDo you want to enter a different search path? " ;
+};
+String RID_SVXSTR_GALLERY_NEWTHEME
+{
+ Text [ en-US ] = "New Theme" ;
+};
+String RID_SVXSTR_GALLERY_BROWSER
+{
+ Text [ en-US ] = "~Organizer..." ;
+};
+String RID_SVXSTR_GALLERY_THEMEERR
+{
+ Text [ en-US ] = "This theme name already exists.\nPlease choose a different one." ;
+};
+String RID_SVXSTR_GALLERY_IMPORTTHEME
+{
+ Text [ en-US ] = "I~mport..." ;
+};
+String RID_SVXSTR_GALLERY_CREATETHEME
+{
+ Text [ en-US ] = "New Theme..." ;
+};
+String RID_SVXSTR_GALLERY_DIALOGID
+{
+ Text [ en-US ] = "Assign ID" ;
+};
+String RID_SVXSTR_GALLERY_TITLE
+{
+ Text [ en-US ] = "Title" ;
+};
+String RID_SVXSTR_GALLERY_PATH
+{
+ Text [ en-US ] = "Path" ;
+};
+String RID_SVXSTR_GALLERY_ICONVIEW
+{
+ Text [ en-US ] = "Icon View";
+};
+String RID_SVXSTR_GALLERY_LISTVIEW
+{
+ Text [ en-US ] = "Detailed View";
+};
+
+/******************************************************************************/
+
+Bitmap RID_SVXBMP_GALLERY
+{
+ File = "lx03135.bmp" ;
+};
+
+Bitmap RID_SVXBMP_THEME_NORMAL
+{
+ File = "galnors.bmp" ;
+};
+
+Bitmap RID_SVXBMP_THEME_IMPORTED
+{
+ File = "galimps.bmp" ;
+};
+
+Bitmap RID_SVXBMP_THEME_READONLY
+{
+ File = "galrdos.bmp" ;
+};
+
+Bitmap RID_SVXBMP_THEME_DEFAULT
+{
+ File = "galdefs.bmp" ;
+};
+
+Bitmap RID_SVXBMP_GALLERY_MEDIA
+{
+ File = "galmedia.bmp";
+};
+
+Bitmap RID_SVXBMP_GALLERY_SOUND_1
+{
+ File = "galsnd1.bmp";
+};
+
+Bitmap RID_SVXBMP_GALLERY_SOUND_2
+{
+ File = "galsnd2.bmp";
+};
+
+Bitmap RID_SVXBMP_GALLERY_SOUND_3
+{
+ File = "galsnd3.bmp";
+};
+
+Bitmap RID_SVXBMP_GALLERY_SOUND_4
+{
+ File = "galsnd4.bmp";
+};
+
+Bitmap RID_SVXBMP_GALLERY_SOUND_5
+{
+ File = "galsnd5.bmp";
+};
+
+Bitmap RID_SVXBMP_GALLERY_SOUND_6
+{
+ File = "galsnd6.bmp";
+};
+
+Bitmap RID_SVXBMP_GALLERY_SOUND_7
+{
+ File = "galsnd7.bmp";
+};
+
+Image RID_SVXIMG_GALLERY_VIEW_ICON
+{
+ ImageBitmap = Bitmap { File = "galicon.bmp"; };
+ MASKCOLOR
+};
+
+Image RID_SVXIMG_GALLERY_VIEW_LIST
+{
+ ImageBitmap = Bitmap { File = "gallist.bmp"; };
+ MASKCOLOR
+};
+
+Image RID_SVXIMG_GALLERY_VIEW_ICON_HC
+{
+ ImageBitmap = Bitmap { File = "galicon_h.bmp"; };
+ MASKCOLOR
+};
+
+Image RID_SVXIMG_GALLERY_VIEW_LIST_HC
+{
+ ImageBitmap = Bitmap { File = "gallist_h.bmp"; };
+ MASKCOLOR
+};
+
+
+/******************************************************************************/
+
+Menu RID_SVXMN_GALLERY1
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = MN_ACTUALIZE;
+ HelpId = HID_GALLERY_ACTUALIZE;
+ Text [ en-US ] = "Update";
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = MN_DELETE ;
+ HelpId = HID_GALLERY_MN_DELETE ;
+ Text [ en-US ] = "~Delete" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_RENAME;
+ HelpId = HID_GALLERY_RENAME;
+ Text [ en-US ] = "~Rename" ;
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = MN_ASSIGN_ID;
+ Text [ en-US ] = "Assign ~ID" ;
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = MN_PROPERTIES;
+ HelpId = HID_GALLERY_PROPERTIES;
+ Text [ en-US ] = "Propert~ies..." ;
+ };
+ };
+};
+
+/******************************************************************************/
+
+Menu RID_SVXMN_GALLERY2
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = MN_ADDMENU ;
+ HelpId = HID_GALLERY_MN_ADDMENU ;
+ Text [ en-US ] = "~Insert" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = MN_ADD ;
+ HelpId = HID_GALLERY_MN_ADD ;
+ Text [ en-US ] = "~Copy" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_ADD_LINK ;
+ HelpId = HID_GALLERY_MN_ADD_LINK ;
+ Text [ en-US ] = "Link" ;
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = MN_BACKGROUND ;
+ HelpId = HID_GALLERY_MN_BACKGROUND ;
+ Text [ en-US ] = "Bac~kground" ;
+ };
+ };
+ };
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = MN_PREVIEW ;
+ HelpId = HID_GALLERY_MN_PREVIEW ;
+ Text [ en-US ] = "~Preview" ;
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = MN_TITLE ;
+ HelpId = HID_GALLERY_TITLE;
+ Text [ en-US ] = "~Title" ;
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = MN_DELETE ;
+ HelpId = HID_GALLERY_MN_DELETE ;
+ Text [ en-US ] = "~Delete" ;
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = MN_COPYCLIPBOARD;
+ HelpId = HID_GALLERY_MN_COPYCLIPBOARD;
+ Text [ en-US ] = "~Copy" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_PASTECLIPBOARD;
+ HelpId = HID_GALLERY_MN_PASTECLIPBOARD;
+ Text [ en-US ] = "~Insert" ;
+ };
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx
new file mode 100644
index 000000000000..eee9f46953c4
--- /dev/null
+++ b/svx/source/gallery2/gallery1.cxx
@@ -0,0 +1,923 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#define ENABLE_BYTESTRING_STREAM_OPERATORS
+
+#include <tools/vcompat.hxx>
+#include <ucbhelper/content.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <unotools/pathoptions.hxx>
+#include <sfx2/docfile.hxx>
+#include "svx/gallery.hxx"
+#include "gallery.hrc"
+#include "svx/galmisc.hxx"
+#include "svx/galtheme.hxx"
+#include "svx/gallery1.hxx"
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#include <com/sun/star/ucb/XContentAccess.hpp>
+
+#define ENABLE_BYTESTRING_STREAM_OPERATORS
+
+// --------------
+// - Namespaces -
+// --------------
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+// ---------------------
+// - GalleryThemeEntry -
+// ---------------------
+
+GalleryThemeEntry::GalleryThemeEntry( const INetURLObject& rBaseURL, const String& rName,
+ sal_uInt32 _nFileNumber, sal_Bool _bReadOnly, sal_Bool _bImported,
+ sal_Bool _bNewFile, sal_uInt32 _nId, sal_Bool _bThemeNameFromResource ) :
+ nFileNumber ( _nFileNumber ),
+ nId ( _nId ),
+ bReadOnly ( _bReadOnly || _bImported ),
+ bImported ( _bImported ),
+ bThemeNameFromResource ( _bThemeNameFromResource )
+{
+ INetURLObject aURL( rBaseURL );
+ DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+ String aFileName( String( RTL_CONSTASCII_USTRINGPARAM( "sg" ) ) );
+
+ aURL.Append( ( aFileName += String::CreateFromInt32( nFileNumber ) ) += String( RTL_CONSTASCII_USTRINGPARAM( ".thm" ) ) );
+ aThmURL = ImplGetURLIgnoreCase( aURL );
+
+ aURL.setExtension( String( RTL_CONSTASCII_USTRINGPARAM( "sdg" ) ) );
+ aSdgURL = ImplGetURLIgnoreCase( aURL );
+
+ aURL.setExtension( String( RTL_CONSTASCII_USTRINGPARAM( "sdv" ) ) );
+ aSdvURL = ImplGetURLIgnoreCase( aURL );
+
+ SetModified( _bNewFile );
+
+ if( nId && bThemeNameFromResource )
+ aName = String( GAL_RESID( RID_GALLERYSTR_THEME_START + (sal_uInt16) nId ) );
+
+ if( !aName.Len() )
+ aName = rName;
+}
+
+// -----------------------------------------------------------------------------
+
+INetURLObject GalleryThemeEntry::ImplGetURLIgnoreCase( const INetURLObject& rURL ) const
+{
+ INetURLObject aURL( rURL );
+ String aFileName;
+ sal_Bool bExists = sal_False;
+
+ // check original file name
+ if( FileExists( aURL ) )
+ bExists = sal_True;
+ else
+ {
+ // check upper case file name
+ aURL.setName( aURL.getName().toAsciiUpperCase() );
+
+ if( FileExists( aURL ) )
+ bExists = sal_True;
+ else
+ {
+ // check lower case file name
+ aURL.setName( aURL.getName().toAsciiLowerCase() );
+
+ if( FileExists( aURL ) )
+ bExists = sal_True;
+ }
+ }
+
+ return aURL;
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryThemeEntry::SetName( const String& rNewName )
+{
+ if( aName != rNewName )
+ {
+ aName = rNewName;
+ SetModified( sal_True );
+ bThemeNameFromResource = sal_False;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryThemeEntry::SetId( sal_uInt32 nNewId, sal_Bool bResetThemeName )
+{
+ nId = nNewId;
+ SetModified( sal_True );
+ bThemeNameFromResource = ( nId && bResetThemeName );
+}
+
+// ---------------------------
+// - GalleryImportThemeEntry -
+// ---------------------------
+
+SvStream& operator<<( SvStream& rOut, const GalleryImportThemeEntry& rEntry )
+{
+ ByteString aDummy;
+
+ rOut << ByteString( rEntry.aThemeName, RTL_TEXTENCODING_UTF8 ) <<
+ ByteString( rEntry.aUIName, RTL_TEXTENCODING_UTF8 ) <<
+ ByteString( String(rEntry.aURL.GetMainURL( INetURLObject::NO_DECODE )), RTL_TEXTENCODING_UTF8 ) <<
+ ByteString( rEntry.aImportName, RTL_TEXTENCODING_UTF8 ) <<
+ aDummy;
+
+ return rOut;
+}
+
+// ------------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIn, GalleryImportThemeEntry& rEntry )
+{
+ ByteString aTmpStr;
+
+ rIn >> aTmpStr; rEntry.aThemeName = String( aTmpStr, RTL_TEXTENCODING_UTF8 );
+ rIn >> aTmpStr; rEntry.aUIName = String( aTmpStr, RTL_TEXTENCODING_UTF8 );
+ rIn >> aTmpStr; rEntry.aURL = INetURLObject( String( aTmpStr, RTL_TEXTENCODING_UTF8 ) );
+ rIn >> aTmpStr; rEntry.aImportName = String( aTmpStr, RTL_TEXTENCODING_UTF8 );
+ rIn >> aTmpStr;
+
+ return rIn;
+}
+
+// --------------------------
+// - GalleryThemeCacheEntry -
+// --------------------------
+
+class GalleryThemeCacheEntry
+{
+private:
+
+ const GalleryThemeEntry* mpThemeEntry;
+ GalleryTheme* mpTheme;
+
+public:
+
+ GalleryThemeCacheEntry( const GalleryThemeEntry* pThemeEntry, GalleryTheme* pTheme ) :
+ mpThemeEntry( pThemeEntry ), mpTheme( pTheme ) {}
+ ~GalleryThemeCacheEntry() { delete mpTheme; }
+
+ const GalleryThemeEntry* GetThemeEntry() const { return mpThemeEntry; }
+ GalleryTheme* GetTheme() const { return mpTheme; }
+};
+
+// -----------
+// - Gallery -
+// -----------
+
+Gallery::Gallery( const String& rMultiPath )
+: nReadTextEncoding ( gsl_getSystemTextEncoding() )
+, nLastFileNumber ( 0 )
+, bMultiPath ( sal_False )
+{
+ ImplLoad( rMultiPath );
+}
+
+// ------------------------------------------------------------------------
+
+Gallery::~Gallery()
+{
+ // Themen-Liste loeschen
+ for( GalleryThemeEntry* pThemeEntry = aThemeList.First(); pThemeEntry; pThemeEntry = aThemeList.Next() )
+ delete pThemeEntry;
+
+ // Import-Liste loeschen
+ for( GalleryImportThemeEntry* pImportEntry = aImportList.First(); pImportEntry; pImportEntry = aImportList.Next() )
+ delete pImportEntry;
+}
+
+// ------------------------------------------------------------------------
+
+Gallery* Gallery::GetGalleryInstance()
+{
+ static Gallery* pGallery = NULL;
+
+ if( !pGallery )
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !pGallery )
+ {
+ pGallery = new Gallery( SvtPathOptions().GetGalleryPath() );
+ }
+ }
+
+ return pGallery;
+}
+
+// ------------------------------------------------------------------------
+
+void Gallery::ImplLoad( const String& rMultiPath )
+{
+ const sal_uInt16 nTokenCount = rMultiPath.GetTokenCount( ';' );
+ sal_Bool bIsReadOnlyDir;
+
+ bMultiPath = ( nTokenCount > 0 );
+
+ INetURLObject aCurURL(SvtPathOptions().GetConfigPath());
+ ImplLoadSubDirs( aCurURL, bIsReadOnlyDir );
+
+ if( !bIsReadOnlyDir )
+ aUserURL = aCurURL;
+
+ if( bMultiPath )
+ {
+ aRelURL = INetURLObject( rMultiPath.GetToken( 0, ';' ) );
+
+ for( sal_uInt16 i = 0UL; i < nTokenCount; i++ )
+ {
+ aCurURL = INetURLObject(rMultiPath.GetToken( i, ';' ));
+
+ ImplLoadSubDirs( aCurURL, bIsReadOnlyDir );
+
+ if( !bIsReadOnlyDir )
+ aUserURL = aCurURL;
+ }
+ }
+ else
+ aRelURL = INetURLObject( rMultiPath );
+
+ DBG_ASSERT( aUserURL.GetProtocol() != INET_PROT_NOT_VALID, "no writable Gallery user directory available" );
+ DBG_ASSERT( aRelURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ ImplLoadImports();
+}
+
+// ------------------------------------------------------------------------
+
+void Gallery::ImplLoadSubDirs( const INetURLObject& rBaseURL, sal_Bool& rbDirIsReadOnly )
+{
+ rbDirIsReadOnly = sal_False;
+
+ try
+ {
+ uno::Reference< ucb::XCommandEnvironment > xEnv;
+ ::ucbhelper::Content aCnt( rBaseURL.GetMainURL( INetURLObject::NO_DECODE ), xEnv );
+
+ uno::Sequence< OUString > aProps( 1 );
+ aProps.getArray()[ 0 ] = OUString::createFromAscii( "Url" );
+
+ uno::Reference< sdbc::XResultSet > xResultSet( aCnt.createCursor( aProps, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY ) );
+
+ try
+ {
+ // check readonlyness the very hard way
+ INetURLObject aTestURL( rBaseURL );
+ String aTestFile( RTL_CONSTASCII_USTRINGPARAM( "cdefghij.klm" ) );
+
+ aTestURL.Append( aTestFile );
+ SvStream* pTestStm = ::utl::UcbStreamHelper::CreateStream( aTestURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE );
+
+ if( pTestStm )
+ {
+ *pTestStm << 1;
+
+ if( pTestStm->GetError() )
+ rbDirIsReadOnly = sal_True;
+
+ delete pTestStm;
+ KillFile( aTestURL );
+ }
+ else
+ rbDirIsReadOnly = sal_True;
+ }
+ catch( const ucb::ContentCreationException& )
+ {
+ }
+ catch( const uno::RuntimeException& )
+ {
+ }
+ catch( const uno::Exception& )
+ {
+ }
+
+ if( xResultSet.is() )
+ {
+ uno::Reference< ucb::XContentAccess > xContentAccess( xResultSet, uno::UNO_QUERY );
+
+ if( xContentAccess.is() )
+ {
+ while( xResultSet->next() )
+ {
+ INetURLObject aThmURL( xContentAccess->queryContentIdentifierString() );
+
+ if(aThmURL.GetExtension().equalsIgnoreAsciiCaseAscii("thm"))
+ {
+ INetURLObject aSdgURL( aThmURL); aSdgURL.SetExtension( OUString::createFromAscii( "sdg" ) );
+ INetURLObject aSdvURL( aThmURL ); aSdvURL.SetExtension( OUString::createFromAscii( "sdv" ) );
+ const OUString aTitleProp( OUString::createFromAscii( "Title" ) );
+ const OUString aReadOnlyProp( OUString::createFromAscii( "IsReadOnly" ) );
+ OUString aTitle;
+ sal_Bool bReadOnly = sal_False;
+
+ try
+ {
+ ::ucbhelper::Content aThmCnt( aThmURL.GetMainURL( INetURLObject::NO_DECODE ), xEnv );
+ ::ucbhelper::Content aSdgCnt( aSdgURL.GetMainURL( INetURLObject::NO_DECODE ), xEnv );
+ ::ucbhelper::Content aSdvCnt( aSdvURL.GetMainURL( INetURLObject::NO_DECODE ), xEnv );
+
+ try
+ {
+ aThmCnt.getPropertyValue( aTitleProp ) >>= aTitle;
+ }
+ catch( const uno::RuntimeException& )
+ {
+ }
+ catch( const uno::Exception& )
+ {
+ }
+
+ if( aTitle.getLength() )
+ {
+ try
+ {
+ aThmCnt.getPropertyValue( aReadOnlyProp ) >>= bReadOnly;
+ }
+ catch( const uno::RuntimeException& )
+ {
+ }
+ catch( const uno::Exception& )
+ {
+ }
+
+ if( !bReadOnly )
+ {
+ try
+ {
+ aSdgCnt.getPropertyValue( aTitleProp ) >>= aTitle;
+ }
+ catch( const ::com::sun::star::uno::RuntimeException& )
+ {
+ }
+ catch( const ::com::sun::star::uno::Exception& )
+ {
+ }
+
+ if( aTitle.getLength() )
+ {
+ try
+ {
+ aSdgCnt.getPropertyValue( aReadOnlyProp ) >>= bReadOnly;
+ }
+ catch( const uno::RuntimeException& )
+ {
+ }
+ catch( const uno::Exception& )
+ {
+ }
+ }
+ }
+
+ if( !bReadOnly )
+ {
+ try
+ {
+ aSdvCnt.getPropertyValue( aTitleProp ) >>= aTitle;
+ }
+ catch( const ::com::sun::star::uno::RuntimeException& )
+ {
+ }
+ catch( const ::com::sun::star::uno::Exception& )
+ {
+ }
+
+ if( aTitle.getLength() )
+ {
+ try
+ {
+ aSdvCnt.getPropertyValue( aReadOnlyProp ) >>= bReadOnly;
+ }
+ catch( const uno::RuntimeException& )
+ {
+ }
+ catch( const uno::Exception& )
+ {
+ }
+ }
+ }
+
+ GalleryThemeEntry* pEntry = GalleryTheme::CreateThemeEntry( aThmURL, rbDirIsReadOnly || bReadOnly );
+
+ if( pEntry )
+ {
+ const sal_uIntPtr nFileNumber = (sal_uIntPtr) String(aThmURL.GetBase()).Erase( 0, 2 ).Erase( 6 ).ToInt32();
+
+ aThemeList.Insert( pEntry, LIST_APPEND );
+
+ if( nFileNumber > nLastFileNumber )
+ nLastFileNumber = nFileNumber;
+ }
+ }
+ }
+ catch( const ucb::ContentCreationException& )
+ {
+ }
+ catch( const uno::RuntimeException& )
+ {
+ }
+ catch( const uno::Exception& )
+ {
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( const ucb::ContentCreationException& )
+ {
+ }
+ catch( const uno::RuntimeException& )
+ {
+ }
+ catch( const uno::Exception& )
+ {
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void Gallery::ImplLoadImports()
+{
+ INetURLObject aURL( GetUserURL() );
+
+ aURL.Append( String( RTL_CONSTASCII_USTRINGPARAM( "gallery.sdi" ) ) );
+
+ if( FileExists( aURL ) )
+ {
+ SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ );
+
+ if( pIStm )
+ {
+ GalleryThemeEntry* pThemeEntry;
+ GalleryImportThemeEntry* pImportEntry;
+ INetURLObject aFile;
+ sal_uInt32 nInventor;
+ sal_uInt32 nCount;
+ sal_uInt16 nId;
+ sal_uInt16 i;
+ sal_uInt16 nTempCharSet;
+
+ for( pImportEntry = aImportList.First(); pImportEntry; pImportEntry = aImportList.Next() )
+ delete pImportEntry;
+
+ aImportList.Clear();
+ *pIStm >> nInventor;
+
+ if( nInventor == COMPAT_FORMAT( 'S', 'G', 'A', '3' ) )
+ {
+ *pIStm >> nId >> nCount >> nTempCharSet;
+
+ for( i = 0; i < nCount; i++ )
+ {
+ pImportEntry = new GalleryImportThemeEntry;
+
+ *pIStm >> *pImportEntry;
+ aImportList.Insert( pImportEntry, LIST_APPEND );
+ aFile = INetURLObject( pImportEntry->aURL );
+ pThemeEntry = new GalleryThemeEntry( aFile,
+ pImportEntry->aUIName,
+ String(aFile.GetBase()).Erase( 0, 2 ).Erase( 6 ).ToInt32(),
+ sal_True, sal_True, sal_False, 0, sal_False );
+
+ aThemeList.Insert( pThemeEntry, LIST_APPEND );
+ }
+ }
+
+ delete pIStm;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void Gallery::ImplWriteImportList()
+{
+ INetURLObject aURL( GetUserURL() );
+ aURL.Append( ( String( "gallery.sdi", RTL_TEXTENCODING_UTF8 ) ) );
+ SvStream* pOStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE | STREAM_TRUNC );
+
+ if( pOStm )
+ {
+ const sal_uInt32 nInventor = (sal_uInt32) COMPAT_FORMAT( 'S', 'G', 'A', '3' );
+ const sal_uInt16 nId = 0x0004;
+
+ *pOStm << nInventor << nId << (sal_uInt32) aImportList.Count() << (sal_uInt16) gsl_getSystemTextEncoding();
+
+ for( GalleryImportThemeEntry* pImportEntry = aImportList.First(); pImportEntry; pImportEntry = aImportList.Next() )
+ *pOStm << *pImportEntry;
+
+ if( pOStm->GetError() )
+ ErrorHandler::HandleError( ERRCODE_IO_GENERAL );
+
+ delete pOStm;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+GalleryThemeEntry* Gallery::ImplGetThemeEntry( const String& rThemeName )
+{
+ GalleryThemeEntry* pFound = NULL;
+
+ if( rThemeName.Len() )
+ for( GalleryThemeEntry* pEntry = aThemeList.First(); pEntry && !pFound; pEntry = aThemeList.Next() )
+ if( rThemeName == pEntry->GetThemeName() )
+ pFound = pEntry;
+
+ return pFound;
+}
+
+// ------------------------------------------------------------------------
+
+GalleryImportThemeEntry* Gallery::ImplGetImportThemeEntry( const String& rImportName )
+{
+ GalleryImportThemeEntry* pFound = NULL;
+
+ for( GalleryImportThemeEntry* pImportEntry = aImportList.First(); pImportEntry && !pFound; pImportEntry = aImportList.Next() )
+ if ( rImportName == pImportEntry->aUIName )
+ pFound = pImportEntry;
+
+ return pFound;
+}
+
+// ------------------------------------------------------------------------
+
+String Gallery::GetThemeName( sal_uIntPtr nThemeId ) const
+{
+ GalleryThemeEntry* pFound = NULL;
+
+ for( sal_uIntPtr n = 0, nCount = aThemeList.Count(); n < nCount; n++ )
+ {
+ GalleryThemeEntry* pEntry = aThemeList.GetObject( n );
+
+ if( nThemeId == pEntry->GetId() )
+ pFound = pEntry;
+ }
+
+ // try fallback, if no entry was found
+ if( !pFound )
+ {
+ ByteString aFallback;
+
+ switch( nThemeId )
+ {
+ case( GALLERY_THEME_3D ): aFallback = "3D"; break;
+ case( GALLERY_THEME_BULLETS ): aFallback = "Bullets"; break;
+ case( GALLERY_THEME_HOMEPAGE ): aFallback = "Homepage"; break;
+ case( GALLERY_THEME_HTMLBUTTONS ): aFallback = "private://gallery/hidden/HtmlExportButtons"; break;
+ case( GALLERY_THEME_POWERPOINT ): aFallback = "private://gallery/hidden/imgppt"; break;
+ case( GALLERY_THEME_FONTWORK ): aFallback = "private://gallery/hidden/fontwork"; break;
+ case( GALLERY_THEME_FONTWORK_VERTICAL ): aFallback = "private://gallery/hidden/fontworkvertical"; break;
+ case( GALLERY_THEME_RULERS ): aFallback = "Rulers"; break;
+ case( GALLERY_THEME_SOUNDS ): aFallback = "Sounds"; break;
+
+ default:
+ break;
+ }
+
+ pFound = ( (Gallery*) this )->ImplGetThemeEntry( String::CreateFromAscii( aFallback.GetBuffer() ) );
+ }
+
+ return( pFound ? pFound->GetThemeName() : String() );
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool Gallery::HasTheme( const String& rThemeName )
+{
+ return( ImplGetThemeEntry( rThemeName ) != NULL );
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool Gallery::CreateTheme( const String& rThemeName, sal_uInt32 nNumFrom )
+{
+ sal_Bool bRet = sal_False;
+
+ if( !HasTheme( rThemeName ) && ( GetUserURL().GetProtocol() != INET_PROT_NOT_VALID ) )
+ {
+ nLastFileNumber = nNumFrom > nLastFileNumber ? nNumFrom : nLastFileNumber + 1;
+ GalleryThemeEntry* pNewEntry = new GalleryThemeEntry( GetUserURL(), rThemeName,
+ nLastFileNumber,
+ sal_False, sal_False, sal_True, 0, sal_False );
+
+ aThemeList.Insert( pNewEntry, LIST_APPEND );
+ delete( new GalleryTheme( this, pNewEntry ) );
+ Broadcast( GalleryHint( GALLERY_HINT_THEME_CREATED, rThemeName ) );
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool Gallery::CreateImportTheme( const INetURLObject& rURL, const String& rImportName )
+{
+ INetURLObject aURL( rURL );
+ sal_Bool bRet = sal_False;
+
+ DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ if( FileExists( aURL ) )
+ {
+ SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ );
+
+ if( pIStm )
+ {
+ sal_uIntPtr nStmErr;
+ sal_uInt16 nId;
+
+ *pIStm >> nId;
+
+ if( nId > 0x0004 )
+ ErrorHandler::HandleError( ERRCODE_IO_GENERAL );
+ else
+ {
+ ByteString aTmpStr;
+ String aThemeName; *pIStm >> aTmpStr; aThemeName = String( aTmpStr, RTL_TEXTENCODING_UTF8 );
+ GalleryThemeEntry* pThemeEntry = new GalleryThemeEntry( aURL, rImportName,
+ String(aURL.GetBase()).Erase( 0, 2 ).Erase( 6 ).ToInt32(),
+ sal_True, sal_True, sal_True, 0, sal_False );
+ GalleryTheme* pImportTheme = new GalleryTheme( this, pThemeEntry );
+
+ pIStm->Seek( STREAM_SEEK_TO_BEGIN );
+ *pIStm >> *pImportTheme;
+ nStmErr = pIStm->GetError();
+
+ if( nStmErr )
+ {
+ delete pThemeEntry;
+ ErrorHandler::HandleError( ERRCODE_IO_GENERAL );
+ }
+ else
+ {
+ String aName( rImportName );
+ String aNewName( aName );
+ sal_uIntPtr nCount = 0;
+
+ aName += ' ';
+
+ while ( HasTheme( aNewName ) && ( nCount++ < 16000 ) )
+ {
+ aNewName = aName;
+ aNewName += String::CreateFromInt32( nCount );
+ }
+
+ pImportTheme->SetImportName( aNewName );
+ aThemeList.Insert( pThemeEntry, LIST_APPEND );
+
+ // Thema in Import-Liste eintragen und Import-Liste speichern
+ GalleryImportThemeEntry* pImportEntry = new GalleryImportThemeEntry;
+ pImportEntry->aThemeName = pImportEntry->aUIName = aNewName;
+ pImportEntry->aURL = rURL;
+ pImportEntry->aImportName = rImportName;
+ aImportList.Insert( pImportEntry, LIST_APPEND );
+ ImplWriteImportList();
+ bRet = sal_True;
+ }
+
+ delete pImportTheme;
+ }
+
+ delete pIStm;
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool Gallery::RenameTheme( const String& rOldName, const String& rNewName )
+{
+ GalleryThemeEntry* pThemeEntry = ImplGetThemeEntry( rOldName );
+ sal_Bool bRet = sal_False;
+
+ // Ueberpruefen, ob neuer Themenname schon vorhanden ist
+ if( pThemeEntry && !HasTheme( rNewName ) && ( !pThemeEntry->IsReadOnly() || pThemeEntry->IsImported() ) )
+ {
+ SfxListener aListener;
+ GalleryTheme* pThm = AcquireTheme( rOldName, aListener );
+
+ if( pThm )
+ {
+ const String aOldName( rOldName );
+
+ pThemeEntry->SetName( rNewName );
+ pThm->ImplWrite();
+
+ if( pThemeEntry->IsImported() )
+ {
+ pThm->SetImportName( rNewName );
+
+ GalleryImportThemeEntry* pImportEntry = ImplGetImportThemeEntry( rOldName );
+
+ if( pImportEntry )
+ {
+ pImportEntry->aUIName = rNewName;
+ ImplWriteImportList();
+ }
+ }
+
+ Broadcast( GalleryHint( GALLERY_HINT_THEME_RENAMED, aOldName, pThm->GetName() ) );
+ ReleaseTheme( pThm, aListener );
+ bRet = sal_True;
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool Gallery::RemoveTheme( const String& rThemeName )
+{
+ GalleryThemeEntry* pThemeEntry = ImplGetThemeEntry( rThemeName );
+ sal_Bool bRet = sal_False;
+
+ if( pThemeEntry && ( !pThemeEntry->IsReadOnly() || pThemeEntry->IsImported() ) )
+ {
+ Broadcast( GalleryHint( GALLERY_HINT_CLOSE_THEME, rThemeName ) );
+
+ if( pThemeEntry->IsImported() )
+ {
+ GalleryImportThemeEntry* pImportEntry = ImplGetImportThemeEntry( rThemeName );
+
+ if( pImportEntry )
+ {
+ delete aImportList.Remove( pImportEntry );
+ ImplWriteImportList();
+ }
+ }
+ else
+ {
+ SfxListener aListener;
+ GalleryTheme* pThm = AcquireTheme( rThemeName, aListener );
+
+ if( pThm )
+ {
+ INetURLObject aThmURL( pThm->GetThmURL() );
+ INetURLObject aSdgURL( pThm->GetSdgURL() );
+ INetURLObject aSdvURL( pThm->GetSdvURL() );
+
+ ReleaseTheme( pThm, aListener );
+
+ KillFile( aThmURL );
+ KillFile( aSdgURL );
+ KillFile( aSdvURL );
+ }
+ }
+
+ delete aThemeList.Remove( pThemeEntry );
+ Broadcast( GalleryHint( GALLERY_HINT_THEME_REMOVED, rThemeName ) );
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+INetURLObject Gallery::GetImportURL( const String& rThemeName )
+{
+ INetURLObject aURL;
+ GalleryImportThemeEntry* pImportEntry = ImplGetImportThemeEntry( rThemeName );
+
+ if( pImportEntry )
+ {
+ aURL = pImportEntry->aURL;
+ DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+ }
+
+ return aURL;
+}
+
+// ------------------------------------------------------------------------
+
+GalleryTheme* Gallery::ImplGetCachedTheme( const GalleryThemeEntry* pThemeEntry )
+{
+ GalleryTheme* pTheme = NULL;
+
+ if( pThemeEntry )
+ {
+ GalleryThemeCacheEntry* pEntry;
+
+ for( pEntry = (GalleryThemeCacheEntry*) aThemeCache.First(); pEntry && !pTheme; pEntry = (GalleryThemeCacheEntry*) aThemeCache.Next() )
+ if( pThemeEntry == pEntry->GetThemeEntry() )
+ pTheme = pEntry->GetTheme();
+
+ if( !pTheme )
+ {
+ INetURLObject aURL;
+
+ if( !pThemeEntry->IsImported() )
+ aURL = pThemeEntry->GetThmURL();
+ else
+ aURL = GetImportURL( pThemeEntry->GetThemeName() );
+
+ DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ if( FileExists( aURL ) )
+ {
+ SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ );
+
+ if( pIStm )
+ {
+ pTheme = new GalleryTheme( this, (GalleryThemeEntry*) pThemeEntry );
+ *pIStm >> *pTheme;
+
+ if( pIStm->GetError() )
+ delete pTheme, pTheme = NULL;
+ else if( pThemeEntry->IsImported() )
+ pTheme->SetImportName( pThemeEntry->GetThemeName() );
+
+ delete pIStm;
+ }
+ }
+
+ if( pTheme )
+ aThemeCache.Insert( new GalleryThemeCacheEntry( pThemeEntry, pTheme ), LIST_APPEND );
+ }
+ }
+
+ return pTheme;
+}
+
+// ------------------------------------------------------------------------
+
+void Gallery::ImplDeleteCachedTheme( GalleryTheme* pTheme )
+{
+ GalleryThemeCacheEntry* pEntry;
+ sal_Bool bDone = sal_False;
+
+ for( pEntry = (GalleryThemeCacheEntry*) aThemeCache.First(); pEntry && !bDone; pEntry = (GalleryThemeCacheEntry*) aThemeCache.Next() )
+ {
+ if( pTheme == pEntry->GetTheme() )
+ {
+ delete (GalleryThemeCacheEntry*) aThemeCache.Remove( pEntry );
+ bDone = sal_True;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+GalleryTheme* Gallery::AcquireTheme( const String& rThemeName, SfxListener& rListener )
+{
+ GalleryTheme* pTheme = NULL;
+ GalleryThemeEntry* pThemeEntry = ImplGetThemeEntry( rThemeName );
+
+ if( pThemeEntry && ( ( pTheme = ImplGetCachedTheme( pThemeEntry ) ) != NULL ) )
+ rListener.StartListening( *pTheme );
+
+ return pTheme;
+}
+
+// ------------------------------------------------------------------------
+
+void Gallery::ReleaseTheme( GalleryTheme* pTheme, SfxListener& rListener )
+{
+ if( pTheme )
+ {
+ rListener.EndListening( *pTheme );
+
+ if( !pTheme->HasListeners() )
+ ImplDeleteCachedTheme( pTheme );
+ }
+}
+
+sal_Bool GalleryThemeEntry::IsDefault() const
+{ return( ( nId > 0 ) && ( nId != ( RID_GALLERYSTR_THEME_MYTHEME - RID_GALLERYSTR_THEME_START ) ) ); }
+
diff --git a/svx/source/gallery2/gallerydrawmodel.hxx b/svx/source/gallery2/gallerydrawmodel.hxx
new file mode 100644
index 000000000000..7221565dffc5
--- /dev/null
+++ b/svx/source/gallery2/gallerydrawmodel.hxx
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <sfx2/objsh.hxx>
+
+class FmFormModel;
+
+class SvxGalleryDrawModel
+{
+public:
+ SvxGalleryDrawModel();
+ ~SvxGalleryDrawModel();
+
+ FmFormModel* GetModel() const { return mpFormModel; }
+
+private:
+ SfxObjectShellLock mxDoc;
+ FmFormModel* mpFormModel;
+};
+
diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx
new file mode 100644
index 000000000000..da5375423b56
--- /dev/null
+++ b/svx/source/gallery2/galmisc.cxx
@@ -0,0 +1,669 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <unotools/streamwrap.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <unotools/processfactory.hxx>
+#include <ucbhelper/content.hxx>
+#include <tools/resmgr.hxx>
+#include <tools/urlobj.hxx>
+#include <svl/solar.hrc>
+#include <svl/urihelper.hxx>
+#include <svtools/filter.hxx>
+#include <svl/itempool.hxx>
+#include <sfx2/docfile.hxx>
+#include <avmedia/mediawindow.hxx>
+#include <vcl/svapp.hxx>
+
+#include "svtools/filter.hxx"
+#include <svx/svdpage.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/fmmodel.hxx>
+#include <svx/fmview.hxx>
+#include <svx/unomodel.hxx>
+#include "codec.hxx"
+#include "gallery.hrc"
+#include "svx/gallery1.hxx"
+#include "svx/galtheme.hxx"
+#include "svx/galmisc.hxx"
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#include <com/sun/star/ucb/XContentAccess.hpp>
+#include <com/sun/star/ucb/TransferInfo.hpp>
+#include <com/sun/star/ucb/NameClash.hpp>
+
+// --------------
+// - Namespaces -
+// --------------
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+// ----------
+// - ResMgr -
+// ----------
+
+ResMgr* GetGalleryResMgr()
+{
+ static ResMgr* pGalleryResMgr = NULL;
+
+ if( !pGalleryResMgr )
+ {
+ ByteString aResMgrName( "gal" );
+ pGalleryResMgr = ResMgr::CreateResMgr(
+ aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() );
+ }
+
+ return pGalleryResMgr;
+}
+
+// -------------------------
+// - GalleryResGetBitmapEx -
+// -------------------------
+
+BitmapEx GalleryResGetBitmapEx( sal_uInt32 nId )
+{
+ BitmapEx aBmpEx( GAL_RESID( nId ) );
+
+ if( !aBmpEx.IsTransparent() )
+ aBmpEx = BitmapEx( aBmpEx.GetBitmap(), COL_LIGHTMAGENTA );
+
+ return aBmpEx;
+}
+
+// ----------------------
+// - SgaUserDataFactory -
+// ----------------------
+
+IMPL_LINK( SgaUserDataFactory, MakeUserData, SdrObjFactory*, pObjFactory )
+{
+ if ( pObjFactory->nInventor == IV_IMAPINFO && pObjFactory->nIdentifier == ID_IMAPINFO )
+ pObjFactory->pNewData = new SgaIMapInfo;
+
+ return 0L;
+}
+
+// ------------------------
+// - GalleryGraphicImport -
+// ------------------------
+
+sal_uInt16 GalleryGraphicImport( const INetURLObject& rURL, Graphic& rGraphic,
+ String& rFilterName, sal_Bool bShowProgress )
+{
+ sal_uInt16 nRet = SGA_IMPORT_NONE;
+ SfxMedium aMedium( rURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ, sal_True );
+ String aFilterName;
+
+ aMedium.DownLoad();
+
+ SvStream* pIStm = aMedium.GetInStream();
+
+ if( pIStm )
+ {
+ GraphicFilter* pGraphicFilter = GraphicFilter::GetGraphicFilter();
+ GalleryProgress* pProgress = bShowProgress ? new GalleryProgress( pGraphicFilter ) : NULL;
+ sal_uInt16 nFormat;
+
+ if( !pGraphicFilter->ImportGraphic( rGraphic, rURL.GetMainURL( INetURLObject::NO_DECODE ), *pIStm, GRFILTER_FORMAT_DONTKNOW, &nFormat ) )
+ {
+ rFilterName = pGraphicFilter->GetImportFormatName( nFormat );
+ nRet = SGA_IMPORT_FILE;
+ }
+
+ delete pProgress;
+ }
+
+ return nRet;
+}
+
+// -----------------------
+// - GallerySvDrawImport -
+// -----------------------
+
+sal_Bool GallerySvDrawImport( SvStream& rIStm, SdrModel& rModel )
+{
+ sal_uInt32 nVersion;
+ sal_Bool bRet = sal_False;
+
+ if( GalleryCodec::IsCoded( rIStm, nVersion ) )
+ {
+ SvMemoryStream aMemStm( 65535, 65535 );
+ GalleryCodec aCodec( rIStm );
+
+ aCodec.Read( aMemStm );
+ aMemStm.Seek( 0UL );
+
+ if( 1 == nVersion )
+ {
+ DBG_ERROR( "staroffice binary file formats are no longer supported inside the gallery!" );
+ bRet = false;
+ }
+ else if( 2 == nVersion )
+ {
+ // recall to read as XML
+ bRet = GallerySvDrawImport( aMemStm, rModel );
+ }
+ }
+ else
+ {
+ // read as XML
+ uno::Reference< io::XInputStream > xInputStream( new utl::OInputStreamWrapper( rIStm ) );
+
+ rModel.GetItemPool().SetDefaultMetric( SFX_MAPUNIT_100TH_MM );
+ uno::Reference< lang::XComponent > xComponent;
+
+ bRet = SvxDrawingLayerImport( &rModel, xInputStream, xComponent, "com.sun.star.comp.Draw.XMLOasisImporter" );
+ if( !bRet || (rModel.GetPageCount() == 0) )
+ {
+ rIStm.Seek(0);
+ bRet = SvxDrawingLayerImport( &rModel, xInputStream, xComponent, "com.sun.star.comp.Draw.XMLImporter" );
+ }
+
+ }
+
+ return bRet;
+}
+
+// ---------------------
+// - CreateIMapGraphic -
+// ---------------------
+
+sal_Bool CreateIMapGraphic( const FmFormModel& rModel, Graphic& rGraphic, ImageMap& rImageMap )
+{
+ sal_Bool bRet = sal_False;
+
+ if ( rModel.GetPageCount() )
+ {
+ const SdrPage* pPage = rModel.GetPage( 0 );
+ const SdrObject* pObj = pPage->GetObj( 0 );
+
+ if ( pPage->GetObjCount() == 1 && pObj->ISA( SdrGrafObj ) )
+ {
+ const sal_uInt16 nCount = pObj->GetUserDataCount();
+
+ // gibt es in den User-Daten eine IMap-Information?
+ for ( sal_uInt16 i = 0; i < nCount; i++ )
+ {
+ const SdrObjUserData* pUserData = pObj->GetUserData( i );
+
+ if ( ( pUserData->GetInventor() == IV_IMAPINFO ) && ( pUserData->GetId() == ID_IMAPINFO ) )
+ {
+ rGraphic = ( (SdrGrafObj*) pObj )->GetGraphic();
+ rImageMap = ( (SgaIMapInfo*) pUserData )->GetImageMap();
+ bRet = sal_True;
+ break;
+ }
+ }
+ }
+ }
+
+ return bRet;
+}
+
+// --------------------
+// - GetReducedString -
+// --------------------
+
+String GetReducedString( const INetURLObject& rURL, sal_uIntPtr nMaxLen )
+{
+ String aReduced( rURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) );
+
+ aReduced = aReduced.GetToken( aReduced.GetTokenCount( '/' ) - 1, '/' );
+
+ if( INET_PROT_PRIV_SOFFICE != rURL.GetProtocol() )
+ {
+ sal_Unicode aDelimiter;
+ const String aPath( rURL.getFSysPath( INetURLObject::FSYS_DETECT, &aDelimiter ) );
+ const String aName( aReduced );
+
+ if( aPath.Len() > nMaxLen )
+ {
+ aReduced = aPath.Copy( 0, (sal_uInt16)( nMaxLen - aName.Len() - 4 ) );
+ aReduced += String( RTL_CONSTASCII_USTRINGPARAM( "..." ) );
+ aReduced += aDelimiter;
+ aReduced += aName;
+ }
+ else
+ aReduced = aPath;
+ }
+
+ return aReduced;
+}
+
+// -----------------------------------------------------------------------------
+
+String GetSvDrawStreamNameFromURL( const INetURLObject& rSvDrawObjURL )
+{
+ String aRet;
+
+ if( rSvDrawObjURL.GetProtocol() == INET_PROT_PRIV_SOFFICE &&
+ String(rSvDrawObjURL.GetMainURL( INetURLObject::NO_DECODE )).GetTokenCount( '/' ) == 3 )
+ {
+ aRet = String(rSvDrawObjURL.GetMainURL( INetURLObject::NO_DECODE )).GetToken( 2, '/' );
+ }
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool FileExists( const INetURLObject& rURL )
+{
+ sal_Bool bRet = sal_False;
+
+ if( rURL.GetProtocol() != INET_PROT_NOT_VALID )
+ {
+ try
+ {
+ ::ucbhelper::Content aCnt( rURL.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment >() );
+ OUString aTitle;
+
+ aCnt.getPropertyValue( OUString::createFromAscii( "Title" ) ) >>= aTitle;
+ bRet = ( aTitle.getLength() > 0 );
+ }
+ catch( const ucb::ContentCreationException& )
+ {
+ }
+ catch( const uno::RuntimeException& )
+ {
+ }
+ catch( const uno::Exception& )
+ {
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool CreateDir( const INetURLObject& rURL )
+{
+ sal_Bool bRet = FileExists( rURL );
+
+ if( !bRet )
+ {
+ try
+ {
+ uno::Reference< ucb::XCommandEnvironment > aCmdEnv;
+ INetURLObject aNewFolderURL( rURL );
+ INetURLObject aParentURL( aNewFolderURL ); aParentURL.removeSegment();
+ ::ucbhelper::Content aParent( aParentURL.GetMainURL( INetURLObject::NO_DECODE ), aCmdEnv );
+ uno::Sequence< OUString > aProps( 1 );
+ uno::Sequence< uno::Any > aValues( 1 );
+
+ aProps.getArray()[ 0 ] = OUString::createFromAscii( "Title" );
+ aValues.getArray()[ 0 ] = uno::makeAny( OUString( aNewFolderURL.GetName() ) );
+
+ ::ucbhelper::Content aContent( aNewFolderURL.GetMainURL( INetURLObject::NO_DECODE ), aCmdEnv );
+ bRet = aParent.insertNewContent( OUString::createFromAscii( "application/vnd.sun.staroffice.fsys-folder" ), aProps, aValues, aContent );
+ }
+ catch( const ucb::ContentCreationException& )
+ {
+ }
+ catch( const uno::RuntimeException& )
+ {
+ }
+ catch( const uno::Exception& )
+ {
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool CopyFile( const INetURLObject& rSrcURL, const INetURLObject& rDstURL )
+{
+ sal_Bool bRet = sal_False;
+
+ try
+ {
+ ::ucbhelper::Content aDestPath( rDstURL.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment >() );
+
+ aDestPath.executeCommand( OUString::createFromAscii( "transfer" ),
+ uno::makeAny( ucb::TransferInfo( sal_False, rSrcURL.GetMainURL( INetURLObject::NO_DECODE ),
+ rDstURL.GetName(), ucb::NameClash::OVERWRITE ) ) );
+ bRet = sal_True;
+ }
+ catch( const ucb::ContentCreationException& )
+ {
+ }
+ catch( const uno::RuntimeException& )
+ {
+ }
+ catch( const uno::Exception& )
+ {
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool KillFile( const INetURLObject& rURL )
+{
+ sal_Bool bRet = FileExists( rURL );
+
+ if( bRet )
+ {
+ try
+ {
+ ::ucbhelper::Content aCnt( rURL.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment >() );
+ aCnt.executeCommand( OUString::createFromAscii( "delete" ), uno::makeAny( sal_Bool( sal_True ) ) );
+ }
+ catch( const ucb::ContentCreationException& )
+ {
+ bRet = sal_False;
+ }
+ catch( const uno::RuntimeException& )
+ {
+ bRet = sal_False;
+ }
+ catch( const uno::Exception& )
+ {
+ bRet = sal_False;
+ }
+ }
+
+ return bRet;
+}
+
+// -------------------
+// - GalleryProgress -
+// -------------------
+
+GalleryProgress::GalleryProgress( GraphicFilter* pFilter ) :
+ mpFilter( pFilter )
+{
+ uno::Reference< lang::XMultiServiceFactory > xMgr( ::utl::getProcessServiceFactory() );
+
+ if( xMgr.is() )
+ {
+ uno::Reference< awt::XProgressMonitor > xMonitor( xMgr->createInstance(
+ ::rtl::OUString::createFromAscii( "com.sun.star.awt.XProgressMonitor" ) ),
+ uno::UNO_QUERY );
+
+ if ( xMonitor.is() )
+ {
+ mxProgressBar = uno::Reference< awt::XProgressBar >( xMonitor, uno::UNO_QUERY );
+
+ if( mxProgressBar.is() )
+ {
+ String aProgressText;
+
+ if( mpFilter )
+ {
+ aProgressText = String( GAL_RESID( RID_SVXSTR_GALLERY_FILTER ) );
+// mpFilter->SetUpdatePercentHdl( LINK( this, GalleryProgress, Update ) ); // sj: progress wasn't working up from SO7 at all
+// // so I am removing this. The gallery progress should
+// // be changed to use the XStatusIndicator instead of XProgressMonitor
+ }
+ else
+ aProgressText = String( RTL_CONSTASCII_USTRINGPARAM( "Gallery" ) );
+
+ xMonitor->addText( String( RTL_CONSTASCII_USTRINGPARAM( "Gallery" ) ), aProgressText, sal_False ) ;
+ mxProgressBar->setRange( 0, GALLERY_PROGRESS_RANGE );
+ }
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+GalleryProgress::~GalleryProgress()
+{
+// if( mpFilter )
+// mpFilter->SetUpdatePercentHdl( Link() );
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryProgress::Update( sal_uIntPtr nVal, sal_uIntPtr nMaxVal )
+{
+ if( mxProgressBar.is() && nMaxVal )
+ mxProgressBar->setValue( Min( (sal_uIntPtr)( (double) nVal / nMaxVal * GALLERY_PROGRESS_RANGE ), (sal_uIntPtr) GALLERY_PROGRESS_RANGE ) );
+}
+
+// -----------------------
+// - GalleryTransferable -
+// -----------------------
+
+GalleryTransferable::GalleryTransferable( GalleryTheme* pTheme, sal_uIntPtr nObjectPos, bool bLazy ) :
+ mpTheme( pTheme ),
+ meObjectKind( mpTheme->GetObjectKind( nObjectPos ) ),
+ mnObjectPos( nObjectPos ),
+ mpGraphicObject( NULL ),
+ mpImageMap( NULL ),
+ mpURL( NULL )
+{
+ InitData( bLazy );
+}
+
+// ------------------------------------------------------------------------
+
+GalleryTransferable::~GalleryTransferable()
+{
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryTransferable::InitData( bool bLazy )
+{
+ switch( meObjectKind )
+ {
+ case( SGA_OBJ_SVDRAW ):
+ {
+ if( !bLazy )
+ {
+ if( !mpGraphicObject )
+ {
+ Graphic aGraphic;
+
+ if( mpTheme->GetGraphic( mnObjectPos, aGraphic ) )
+ mpGraphicObject = new GraphicObject( aGraphic );
+ }
+
+ if( !mxModelStream.Is() )
+ {
+ mxModelStream = new SotStorageStream( String() );
+ mxModelStream->SetBufferSize( 16348 );
+
+ if( !mpTheme->GetModelStream( mnObjectPos, mxModelStream ) )
+ mxModelStream.Clear();
+ else
+ mxModelStream->Seek( 0 );
+ }
+ }
+ }
+ break;
+
+ case( SGA_OBJ_ANIM ):
+ case( SGA_OBJ_BMP ):
+ case( SGA_OBJ_INET ):
+ case( SGA_OBJ_SOUND ):
+ {
+ if( !mpURL )
+ {
+ mpURL = new INetURLObject;
+
+ if( !mpTheme->GetURL( mnObjectPos, *mpURL ) )
+ delete mpURL, mpURL = NULL;
+ }
+
+ if( ( SGA_OBJ_SOUND != meObjectKind ) && !mpGraphicObject )
+ {
+ Graphic aGraphic;
+
+ if( mpTheme->GetGraphic( mnObjectPos, aGraphic ) )
+ mpGraphicObject = new GraphicObject( aGraphic );
+ }
+ }
+ break;
+
+ default:
+ DBG_ERROR( "GalleryTransferable::GalleryTransferable: invalid object type" );
+ break;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryTransferable::AddSupportedFormats()
+{
+ if( SGA_OBJ_SVDRAW == meObjectKind )
+ {
+ AddFormat( SOT_FORMATSTR_ID_DRAWING );
+ AddFormat( SOT_FORMATSTR_ID_SVXB );
+ AddFormat( FORMAT_GDIMETAFILE );
+ AddFormat( FORMAT_BITMAP );
+ }
+ else
+ {
+ if( mpURL )
+ AddFormat( FORMAT_FILE );
+
+ if( mpGraphicObject )
+ {
+ AddFormat( SOT_FORMATSTR_ID_SVXB );
+
+ if( mpGraphicObject->GetType() == GRAPHIC_GDIMETAFILE )
+ {
+ AddFormat( FORMAT_GDIMETAFILE );
+ AddFormat( FORMAT_BITMAP );
+ }
+ else
+ {
+ AddFormat( FORMAT_BITMAP );
+ AddFormat( FORMAT_GDIMETAFILE );
+ }
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryTransferable::GetData( const datatransfer::DataFlavor& rFlavor )
+{
+ sal_uInt32 nFormat = SotExchange::GetFormat( rFlavor );
+ sal_Bool bRet = sal_False;
+
+ InitData( false );
+
+ if( ( SOT_FORMATSTR_ID_DRAWING == nFormat ) && ( SGA_OBJ_SVDRAW == meObjectKind ) )
+ {
+ bRet = ( mxModelStream.Is() && SetObject( &mxModelStream, 0, rFlavor ) );
+ }
+ else if( ( SOT_FORMATSTR_ID_SVIM == nFormat ) && mpImageMap )
+ {
+ // TODO/MBA: do we need a BaseURL here?!
+ bRet = SetImageMap( *mpImageMap, rFlavor );
+ }
+ else if( ( FORMAT_FILE == nFormat ) && mpURL )
+ {
+ bRet = SetString( mpURL->GetMainURL( INetURLObject::NO_DECODE ), rFlavor );
+ }
+ else if( ( SOT_FORMATSTR_ID_SVXB == nFormat ) && mpGraphicObject )
+ {
+ bRet = SetGraphic( mpGraphicObject->GetGraphic(), rFlavor );
+ }
+ else if( ( FORMAT_GDIMETAFILE == nFormat ) && mpGraphicObject )
+ {
+ bRet = SetGDIMetaFile( mpGraphicObject->GetGraphic().GetGDIMetaFile(), rFlavor );
+ }
+ else if( ( FORMAT_BITMAP == nFormat ) && mpGraphicObject )
+ {
+ bRet = SetBitmap( mpGraphicObject->GetGraphic().GetBitmap(), rFlavor );
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryTransferable::WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject,
+ sal_uInt32, const datatransfer::DataFlavor& )
+{
+ sal_Bool bRet = sal_False;
+
+ if( pUserObject )
+ {
+ *rxOStm << *static_cast< SotStorageStream* >( pUserObject );
+ bRet = ( rxOStm->GetError() == ERRCODE_NONE );
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryTransferable::DragFinished( sal_Int8 nDropAction )
+{
+ mpTheme->SetDragging( sal_False );
+ mpTheme->SetDragPos( 0 );
+ if ( nDropAction )
+ {
+ Window *pFocusWindow = Application::GetFocusWindow();
+ if ( pFocusWindow )
+ pFocusWindow->GrabFocusToDocument();
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryTransferable::ObjectReleased()
+{
+ mxModelStream.Clear();
+ delete mpGraphicObject, mpGraphicObject = NULL;
+ delete mpImageMap, mpImageMap = NULL;
+ delete mpURL, mpURL = NULL;
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryTransferable::CopyToClipboard( Window* pWindow )
+{
+ TransferableHelper::CopyToClipboard( pWindow );
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryTransferable::StartDrag( Window* pWindow, sal_Int8 nDragSourceActions,
+ sal_Int32 nDragPointer, sal_Int32 nDragImage )
+{
+ INetURLObject aURL;
+
+ if( mpTheme->GetURL( mnObjectPos, aURL ) && ( aURL.GetProtocol() != INET_PROT_NOT_VALID ) )
+ {
+ mpTheme->SetDragging( sal_True );
+ mpTheme->SetDragPos( mnObjectPos );
+ TransferableHelper::StartDrag( pWindow, nDragSourceActions, nDragPointer, nDragImage );
+ }
+}
diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx
new file mode 100644
index 000000000000..9ba9cff068a3
--- /dev/null
+++ b/svx/source/gallery2/galobj.cxx
@@ -0,0 +1,607 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#define ENABLE_BYTESTRING_STREAM_OPERATORS
+
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <sfx2/objsh.hxx>
+#include <sfx2/docfac.hxx>
+
+#include <comphelper/classids.hxx>
+#include <unotools/pathoptions.hxx>
+
+#include <tools/rcid.h>
+#include <tools/vcompat.hxx>
+#include <vcl/virdev.hxx>
+#include <svl/itempool.hxx>
+#include <svx/fmmodel.hxx>
+#include <svx/fmview.hxx>
+#include <svx/fmpage.hxx>
+#include "gallery.hrc"
+#include "svx/galmisc.hxx"
+#include "galobj.hxx"
+#include <vcl/salbtype.hxx> // FRound
+#include <vcl/svapp.hxx>
+
+#include "gallerydrawmodel.hxx"
+
+using namespace ::com::sun::star;
+
+// -------------
+// - SgaObject -
+// -------------
+
+SgaObject::SgaObject() :
+ bIsValid ( sal_False ),
+ bIsThumbBmp ( sal_True )
+{
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool SgaObject::CreateThumb( const Graphic& rGraphic )
+{
+ sal_Bool bRet = sal_False;
+
+ if( rGraphic.GetType() == GRAPHIC_BITMAP )
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+ Size aBmpSize( aBmpEx.GetSizePixel() );
+
+ if( aBmpSize.Width() && aBmpSize.Height() )
+ {
+ const Color aWhite( COL_WHITE );
+
+ if( aBmpEx.GetPrefMapMode().GetMapUnit() != MAP_PIXEL &&
+ aBmpEx.GetPrefSize().Width() > 0 &&
+ aBmpEx.GetPrefSize().Height() > 0 )
+ {
+ Size aLogSize( OutputDevice::LogicToLogic( aBmpEx.GetPrefSize(), aBmpEx.GetPrefMapMode(), MAP_100TH_MM ) );
+
+ if( aLogSize.Width() > 0 && aLogSize.Height() > 0 )
+ {
+ double fFactorLog = static_cast< double >( aLogSize.Width() ) / aLogSize.Height();
+ double fFactorPix = static_cast< double >( aBmpSize.Width() ) / aBmpSize.Height();
+
+ if( fFactorPix > fFactorLog )
+ aBmpSize.Width() = FRound( aBmpSize.Height() * fFactorLog );
+ else
+ aBmpSize.Height() = FRound( aBmpSize.Width() / fFactorLog );
+
+ aBmpEx.SetSizePixel( aBmpSize );
+ }
+ }
+
+ aThumbBmp = aBmpEx.GetBitmap( &aWhite );
+
+ if( ( aBmpSize.Width() <= S_THUMB ) && ( aBmpSize.Height() <= S_THUMB ) )
+ {
+ aThumbBmp.Convert( BMP_CONVERSION_8BIT_COLORS );
+ bRet = sal_True;
+ }
+ else
+ {
+ const float fFactor = (float) aBmpSize.Width() / aBmpSize.Height();
+ const Size aNewSize( Max( (long) (fFactor < 1. ? S_THUMB * fFactor : S_THUMB), 8L ),
+ Max( (long) (fFactor < 1. ? S_THUMB : S_THUMB / fFactor), 8L ) );
+
+ if( aThumbBmp.Scale( (double) aNewSize.Width() / aBmpSize.Width(),
+ (double) aNewSize.Height() / aBmpSize.Height(), BMP_SCALE_INTERPOLATE ) )
+ {
+ aThumbBmp.Convert( BMP_CONVERSION_8BIT_COLORS );
+ bRet = sal_True;
+ }
+ }
+ }
+ }
+ else if( rGraphic.GetType() == GRAPHIC_GDIMETAFILE )
+ {
+ const Size aPrefSize( rGraphic.GetPrefSize() );
+ const double fFactor = (double)aPrefSize.Width() / (double)aPrefSize.Height();
+ Size aSize( S_THUMB, S_THUMB );
+ if ( fFactor < 1.0 )
+ aSize.Width() = (sal_Int32)( S_THUMB * fFactor );
+ else
+ aSize.Height() = (sal_Int32)( S_THUMB / fFactor );
+
+ const GraphicConversionParameters aParameters(aSize);
+ aThumbBmp = rGraphic.GetBitmap(aParameters);
+
+ if( !aThumbBmp.IsEmpty() )
+ {
+ aThumbBmp.Convert( BMP_CONVERSION_8BIT_COLORS );
+ bRet = sal_True;
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+void SgaObject::WriteData( SvStream& rOut, const String& rDestDir ) const
+{
+ static const sal_uInt32 nInventor = COMPAT_FORMAT( 'S', 'G', 'A', '3' );
+
+ rOut << nInventor << (sal_uInt16) 0x0004 << GetVersion() << (sal_uInt16) GetObjKind();
+ rOut << bIsThumbBmp;
+
+ if( bIsThumbBmp )
+ {
+ const sal_uInt16 nOldCompressMode = rOut.GetCompressMode();
+ const sal_uIntPtr nOldVersion = rOut.GetVersion();
+
+ rOut.SetCompressMode( COMPRESSMODE_ZBITMAP );
+ rOut.SetVersion( SOFFICE_FILEFORMAT_50 );
+
+ rOut << aThumbBmp;
+
+ rOut.SetVersion( nOldVersion );
+ rOut.SetCompressMode( nOldCompressMode );
+ }
+ else
+ rOut << aThumbMtf;
+
+ String aURLWithoutDestDir = String(aURL.GetMainURL( INetURLObject::NO_DECODE ));
+ aURLWithoutDestDir.SearchAndReplace(rDestDir, String());
+ rOut << ByteString( aURLWithoutDestDir, RTL_TEXTENCODING_UTF8 );
+}
+
+// ------------------------------------------------------------------------
+
+void SgaObject::ReadData(SvStream& rIn, sal_uInt16& rReadVersion )
+{
+ ByteString aTmpStr;
+ sal_uInt32 nTmp32;
+ sal_uInt16 nTmp16;
+
+ rIn >> nTmp32 >> nTmp16 >> rReadVersion >> nTmp16 >> bIsThumbBmp;
+
+ if( bIsThumbBmp )
+ rIn >> aThumbBmp;
+ else
+ rIn >> aThumbMtf;
+
+ rIn >> aTmpStr; aURL = INetURLObject( String( aTmpStr.GetBuffer(), RTL_TEXTENCODING_UTF8 ) );
+}
+
+// ------------------------------------------------------------------------
+
+const String SgaObject::GetTitle() const
+{
+ String aReturnValue( aTitle );
+ if ( !getenv( "GALLERY_SHOW_PRIVATE_TITLE" ) )
+ {
+ if ( aReturnValue.GetTokenCount( ':' ) == 3 )
+ {
+ String aPrivateInd ( aReturnValue.GetToken( 0, ':' ) );
+ String aResourceName( aReturnValue.GetToken( 1, ':' ) );
+ sal_Int32 nResId ( aReturnValue.GetToken( 2, ':' ).ToInt32() );
+ if ( aReturnValue.GetToken( 0, ':' ).EqualsAscii( "private" ) &&
+ aResourceName.Len() && ( nResId > 0 ) && ( nResId < 0x10000 ) )
+ {
+ ByteString aMgrName( aResourceName, RTL_TEXTENCODING_UTF8 );
+ ResMgr* pResMgr = ResMgr::CreateResMgr( aMgrName.GetBuffer(),
+ Application::GetSettings().GetUILocale() );
+ if ( pResMgr )
+ {
+ ResId aResId( (sal_uInt16)nResId, *pResMgr );
+ aResId.SetRT( RSC_STRING );
+ if ( pResMgr->IsAvailable( aResId ) )
+ {
+ aReturnValue = String( aResId );
+ }
+ delete pResMgr;
+ }
+ }
+ }
+ }
+ return aReturnValue;
+}
+
+// ------------------------------------------------------------------------
+
+void SgaObject::SetTitle( const String& rTitle )
+{
+ aTitle = rTitle;
+}
+
+// ------------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOut, const SgaObject& rObj )
+{
+ rObj.WriteData( rOut, String() );
+ return rOut;
+}
+
+// ------------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIn, SgaObject& rObj )
+{
+ sal_uInt16 nReadVersion;
+
+ rObj.ReadData( rIn, nReadVersion );
+ rObj.bIsValid = ( rIn.GetError() == ERRCODE_NONE );
+
+ return rIn;
+}
+
+// ----------------
+// - SgaObjectBmp -
+// ----------------
+
+SgaObjectBmp::SgaObjectBmp()
+{
+}
+
+// ------------------------------------------------------------------------
+
+SgaObjectBmp::SgaObjectBmp( const INetURLObject& rURL )
+{
+ Graphic aGraphic;
+ String aFilter;
+
+ if ( SGA_IMPORT_NONE != GalleryGraphicImport( rURL, aGraphic, aFilter ) )
+ Init( aGraphic, rURL );
+}
+
+// ------------------------------------------------------------------------
+
+SgaObjectBmp::SgaObjectBmp( const Graphic& rGraphic, const INetURLObject& rURL, const String& )
+{
+ if( FileExists( rURL ) )
+ Init( rGraphic, rURL );
+}
+
+// ------------------------------------------------------------------------
+
+void SgaObjectBmp::Init( const Graphic& rGraphic, const INetURLObject& rURL )
+{
+ aURL = rURL;
+ bIsValid = CreateThumb( rGraphic );
+}
+
+// ------------------------------------------------------------------------
+
+void SgaObjectBmp::WriteData( SvStream& rOut, const String& rDestDir ) const
+{
+ String aDummyStr;
+ char aDummy[ 10 ];
+
+ // Version setzen
+ SgaObject::WriteData( rOut, rDestDir );
+ rOut.Write( aDummy, 10 );
+ rOut << ByteString( aDummyStr, RTL_TEXTENCODING_UTF8 ) << ByteString( aTitle, RTL_TEXTENCODING_UTF8 );
+}
+
+// ------------------------------------------------------------------------
+
+void SgaObjectBmp::ReadData( SvStream& rIn, sal_uInt16& rReadVersion )
+{
+ ByteString aTmpStr;
+
+ SgaObject::ReadData( rIn, rReadVersion );
+ rIn.SeekRel( 10 ); // 16, 16, 32, 16
+ rIn >> aTmpStr; // dummy
+
+ if( rReadVersion >= 5 )
+ {
+ rIn >> aTmpStr; aTitle = String( aTmpStr.GetBuffer(), RTL_TEXTENCODING_UTF8 );
+ }
+}
+
+// ------------------
+// - SgaObjectSound -
+// ------------------
+
+SgaObjectSound::SgaObjectSound() :
+ eSoundType( SOUND_STANDARD )
+{
+}
+
+// ------------------------------------------------------------------------
+
+SgaObjectSound::SgaObjectSound( const INetURLObject& rURL ) :
+ eSoundType( SOUND_STANDARD )
+{
+ if( FileExists( rURL ) )
+ {
+ aURL = rURL;
+ aThumbBmp = Bitmap( Size( 1, 1 ), 1 );
+ bIsValid = sal_True;
+ }
+ else
+ bIsValid = sal_False;
+}
+
+// ------------------------------------------------------------------------
+
+SgaObjectSound::~SgaObjectSound()
+{
+}
+
+// ------------------------------------------------------------------------
+
+Bitmap SgaObjectSound::GetThumbBmp() const
+{
+ sal_uInt16 nId;
+
+ switch( eSoundType )
+ {
+ case( SOUND_COMPUTER ): nId = RID_SVXBMP_GALLERY_SOUND_1; break;
+ case( SOUND_MISC ): nId = RID_SVXBMP_GALLERY_SOUND_2; break;
+ case( SOUND_MUSIC ): nId = RID_SVXBMP_GALLERY_SOUND_3; break;
+ case( SOUND_NATURE ): nId = RID_SVXBMP_GALLERY_SOUND_4; break;
+ case( SOUND_SPEECH ): nId = RID_SVXBMP_GALLERY_SOUND_5; break;
+ case( SOUND_TECHNIC ): nId = RID_SVXBMP_GALLERY_SOUND_6; break;
+ case( SOUND_ANIMAL ): nId = RID_SVXBMP_GALLERY_SOUND_7; break;
+
+ // standard
+ default:
+ nId = RID_SVXBMP_GALLERY_MEDIA;
+ break;
+ }
+
+ const BitmapEx aBmpEx( GAL_RESID( nId ) );
+ const Color aTransColor( COL_WHITE );
+
+ return aBmpEx.GetBitmap( &aTransColor );
+}
+
+// ------------------------------------------------------------------------
+
+void SgaObjectSound::WriteData( SvStream& rOut, const String& rDestDir ) const
+{
+ SgaObject::WriteData( rOut, rDestDir );
+ rOut << (sal_uInt16) eSoundType << ByteString( aTitle, RTL_TEXTENCODING_UTF8 );
+}
+
+// ------------------------------------------------------------------------
+
+void SgaObjectSound::ReadData( SvStream& rIn, sal_uInt16& rReadVersion )
+{
+ SgaObject::ReadData( rIn, rReadVersion );
+
+ if( rReadVersion >= 5 )
+ {
+ ByteString aTmpStr;
+ sal_uInt16 nTmp16;
+
+ rIn >> nTmp16; eSoundType = (GalSoundType) nTmp16;
+
+ if( rReadVersion >= 6 )
+ {
+ rIn >> aTmpStr; aTitle = String( aTmpStr.GetBuffer(), RTL_TEXTENCODING_UTF8 );
+ }
+ }
+}
+
+// -----------------
+// - SgaObjectAnim -
+// -----------------
+
+SgaObjectAnim::SgaObjectAnim()
+{
+}
+
+// ------------------------------------------------------------------------
+
+SgaObjectAnim::SgaObjectAnim( const Graphic& rGraphic,
+ const INetURLObject& rURL,
+ const String& )
+{
+ aURL = rURL;
+ bIsValid = CreateThumb( rGraphic );
+}
+
+// -----------------
+// - SgaObjectINet -
+// -----------------
+
+SgaObjectINet::SgaObjectINet()
+{
+}
+
+// ------------------------------------------------------------------------
+
+SgaObjectINet::SgaObjectINet( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormatName ) :
+ SgaObjectAnim ( rGraphic, rURL, rFormatName )
+{
+}
+
+// -------------------
+// - SgaObjectSvDraw -
+// -------------------
+
+SgaObjectSvDraw::SgaObjectSvDraw()
+{
+}
+
+// ------------------------------------------------------------------------
+
+SgaObjectSvDraw::SgaObjectSvDraw( const FmFormModel& rModel, const INetURLObject& rURL )
+{
+ aURL = rURL;
+ bIsValid = CreateThumb( rModel );
+}
+
+// ------------------------------------------------------------------------
+
+SvxGalleryDrawModel::SvxGalleryDrawModel()
+: mpFormModel( 0 )
+{
+ const String sFactoryURL(RTL_CONSTASCII_USTRINGPARAM("sdraw"));
+
+ mxDoc = SfxObjectShell::CreateObjectByFactoryName( sFactoryURL );
+
+ if( mxDoc.Is() )
+ {
+ mxDoc->DoInitNew(0);
+
+ uno::Reference< lang::XUnoTunnel > xTunnel( mxDoc->GetModel(), uno::UNO_QUERY );
+ if( xTunnel.is() )
+ {
+ mpFormModel = dynamic_cast< FmFormModel* >(
+ reinterpret_cast<SdrModel*>(xTunnel->getSomething(SdrModel::getUnoTunnelImplementationId())));
+ if( mpFormModel )
+ {
+ mpFormModel->InsertPage( mpFormModel->AllocPage( false ) );
+ }
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+SvxGalleryDrawModel::~SvxGalleryDrawModel()
+{
+ if( mxDoc.Is() )
+ mxDoc->DoClose();
+}
+
+// ------------------------------------------------------------------------
+
+SgaObjectSvDraw::SgaObjectSvDraw( SvStream& rIStm, const INetURLObject& rURL )
+{
+ SvxGalleryDrawModel aModel;
+
+ if( aModel.GetModel() )
+ {
+ if( GallerySvDrawImport( rIStm, *aModel.GetModel() ) )
+ {
+ aURL = rURL;
+ bIsValid = CreateThumb( *aModel.GetModel() );
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool SgaObjectSvDraw::CreateThumb( const FmFormModel& rModel )
+{
+ Graphic aGraphic;
+ ImageMap aImageMap;
+ sal_Bool bRet = sal_False;
+
+ if ( CreateIMapGraphic( rModel, aGraphic, aImageMap ) )
+ bRet = SgaObject::CreateThumb( aGraphic );
+ else
+ {
+ VirtualDevice aVDev;
+
+ aVDev.SetOutputSizePixel( Size( S_THUMB*2, S_THUMB*2 ) );
+
+ bRet = DrawCentered( &aVDev, rModel );
+ if( bRet )
+ {
+ aThumbBmp = aVDev.GetBitmap( Point(), aVDev.GetOutputSizePixel() );
+
+ Size aMS( 2, 2 );
+ BmpFilterParam aParam( aMS );
+ aThumbBmp.Filter( BMP_FILTER_MOSAIC, &aParam );
+ aThumbBmp.Scale( Size( S_THUMB, S_THUMB ) );
+
+ aThumbBmp.Convert( BMP_CONVERSION_8BIT_COLORS );
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool SgaObjectSvDraw::DrawCentered( OutputDevice* pOut, const FmFormModel& rModel )
+{
+ const FmFormPage* pPage = static_cast< const FmFormPage* >( rModel.GetPage( 0 ) );
+ sal_Bool bRet = sal_False;
+
+ if( pOut && pPage )
+ {
+ const Rectangle aObjRect( pPage->GetAllObjBoundRect() );
+ const Size aOutSizePix( pOut->GetOutputSizePixel() );
+
+ if( aObjRect.GetWidth() && aObjRect.GetHeight() && aOutSizePix.Width() > 2 && aOutSizePix.Height() > 2 )
+ {
+ FmFormView aView( const_cast< FmFormModel* >( &rModel ), pOut );
+ MapMode aMap( rModel.GetScaleUnit() );
+ Rectangle aDrawRectPix( Point( 1, 1 ), Size( aOutSizePix.Width() - 2, aOutSizePix.Height() - 2 ) );
+ const double fFactor = (double) aObjRect.GetWidth() / aObjRect.GetHeight();
+ Fraction aFrac( FRound( fFactor < 1. ? aDrawRectPix.GetWidth() * fFactor : aDrawRectPix.GetWidth() ),
+ pOut->LogicToPixel( aObjRect.GetSize(), aMap ).Width() );
+
+ aMap.SetScaleX( aFrac );
+ aMap.SetScaleY( aFrac );
+
+ const Size aDrawSize( pOut->PixelToLogic( aDrawRectPix.GetSize(), aMap ) );
+ Point aOrigin( pOut->PixelToLogic( aDrawRectPix.TopLeft(), aMap ) );
+
+ aOrigin.X() += ( ( aDrawSize.Width() - aObjRect.GetWidth() ) >> 1 ) - aObjRect.Left();
+ aOrigin.Y() += ( ( aDrawSize.Height() - aObjRect.GetHeight() ) >> 1 ) - aObjRect.Top();
+ aMap.SetOrigin( aOrigin );
+
+ aView.SetPageVisible( sal_False );
+ aView.SetBordVisible( sal_False );
+ aView.SetGridVisible( sal_False );
+ aView.SetHlplVisible( sal_False );
+ aView.SetGlueVisible( sal_False );
+
+ pOut->Push();
+ pOut->SetMapMode( aMap );
+ aView.ShowSdrPage( const_cast< FmFormPage* >( pPage ));
+ aView.CompleteRedraw( pOut, Rectangle( pOut->PixelToLogic( Point() ), pOut->GetOutputSize() ) );
+ pOut->Pop();
+
+ bRet = sal_True;
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+void SgaObjectSvDraw::WriteData( SvStream& rOut, const String& rDestDir ) const
+{
+ SgaObject::WriteData( rOut, rDestDir );
+ rOut << ByteString( aTitle, RTL_TEXTENCODING_UTF8 );
+}
+
+// ------------------------------------------------------------------------
+
+void SgaObjectSvDraw::ReadData( SvStream& rIn, sal_uInt16& rReadVersion )
+{
+ SgaObject::ReadData( rIn, rReadVersion );
+
+ if( rReadVersion >= 5 )
+ {
+ ByteString aTmpStr;
+ rIn >> aTmpStr; aTitle = String( aTmpStr.GetBuffer(), RTL_TEXTENCODING_UTF8 );
+ }
+}
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
new file mode 100644
index 000000000000..bd1ae10cd746
--- /dev/null
+++ b/svx/source/gallery2/galtheme.cxx
@@ -0,0 +1,1599 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#define ENABLE_BYTESTRING_STREAM_OPERATORS
+
+#include <tools/urlobj.hxx>
+#include <tools/vcompat.hxx>
+#include <unotools/streamwrap.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <unotools/tempfile.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <ucbhelper/content.hxx>
+#include <sot/storage.hxx>
+#include <sot/formats.hxx>
+#include <sot/filelist.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/cvtgrf.hxx>
+#include <svl/itempool.hxx>
+#include <sfx2/docfile.hxx>
+#include <avmedia/mediawindow.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/fmpage.hxx>
+#include "codec.hxx"
+#include <svx/unomodel.hxx>
+#include <svx/fmmodel.hxx>
+#include <svx/fmview.hxx>
+#include "svx/galmisc.hxx"
+#include "svx/galtheme.hxx"
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#include <com/sun/star/ucb/XContentAccess.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include "galobj.hxx"
+#include <svx/gallery1.hxx>
+#include "galtheme.hrc"
+#include <vcl/lstbox.hxx>
+#include "gallerydrawmodel.hxx"
+
+// --------------
+// - Namespaces -
+// --------------
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+// ------------
+// - SgaTheme -
+// ------------
+
+GalleryTheme::GalleryTheme( Gallery* pGallery, GalleryThemeEntry* pThemeEntry ) :
+ pParent ( pGallery ),
+ pThm ( pThemeEntry ),
+ mnThemeLockCount ( 0 ),
+ mnBroadcasterLockCount( 0 ),
+ nDragPos ( 0 ),
+ bDragging ( sal_False )
+{
+ ImplCreateSvDrawStorage();
+
+ if( pThm->IsImported() )
+ aImportName = pThm->GetThemeName();
+}
+
+// ------------------------------------------------------------------------
+
+GalleryTheme::~GalleryTheme()
+{
+ ImplWrite();
+
+ for( GalleryObject* pEntry = aObjectList.First(); pEntry; pEntry = aObjectList.Next() )
+ {
+ Broadcast( GalleryHint( GALLERY_HINT_CLOSE_OBJECT, GetName(), reinterpret_cast< sal_uIntPtr >( pEntry ) ) );
+ delete pEntry;
+ Broadcast( GalleryHint( GALLERY_HINT_OBJECT_REMOVED, GetName(), reinterpret_cast< sal_uIntPtr >( pEntry ) ) );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryTheme::ImplCreateSvDrawStorage()
+{
+ if( !pThm->IsImported() )
+ {
+ aSvDrawStorageRef = new SvStorage( sal_False, GetSdvURL().GetMainURL( INetURLObject::NO_DECODE ), pThm->IsReadOnly() ? STREAM_READ : STREAM_STD_READWRITE );
+ // #i50423# ReadOnly may not been set though the file can't be written (because of security reasons)
+ if ( ( aSvDrawStorageRef->GetError() != ERRCODE_NONE ) && !pThm->IsReadOnly() )
+ aSvDrawStorageRef = new SvStorage( sal_False, GetSdvURL().GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ );
+ }
+ else
+ aSvDrawStorageRef.Clear();
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryTheme::ImplWriteSgaObject( const SgaObject& rObj, sal_uIntPtr nPos, GalleryObject* pExistentEntry )
+{
+ SvStream* pOStm = ::utl::UcbStreamHelper::CreateStream( GetSdgURL().GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE );
+ sal_Bool bRet = sal_False;
+
+ if( pOStm )
+ {
+ const sal_uInt32 nOffset = pOStm->Seek( STREAM_SEEK_TO_END );
+
+ rObj.WriteData( *pOStm, m_aDestDir );
+
+ if( !pOStm->GetError() )
+ {
+ GalleryObject* pEntry;
+
+ if( !pExistentEntry )
+ {
+ pEntry = new GalleryObject;
+ aObjectList.Insert( pEntry, nPos );
+ }
+ else
+ pEntry = pExistentEntry;
+
+ pEntry->aURL = rObj.GetURL();
+ pEntry->nOffset = nOffset;
+ pEntry->eObjKind = rObj.GetObjKind();
+ bRet = sal_True;
+ }
+
+ delete pOStm;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+SgaObject* GalleryTheme::ImplReadSgaObject( GalleryObject* pEntry )
+{
+ SgaObject* pSgaObj = NULL;
+
+ if( pEntry )
+ {
+ SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( GetSdgURL().GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ );
+
+ if( pIStm )
+ {
+ sal_uInt32 nInventor;
+
+ // Ueberpruefen, ob das File ein gueltiges SGA-File ist
+ pIStm->Seek( pEntry->nOffset );
+ *pIStm >> nInventor;
+
+ if( nInventor == COMPAT_FORMAT( 'S', 'G', 'A', '3' ) )
+ {
+ pIStm->Seek( pEntry->nOffset );
+
+ switch( pEntry->eObjKind )
+ {
+ case( SGA_OBJ_BMP ): pSgaObj = new SgaObjectBmp(); break;
+ case( SGA_OBJ_ANIM ): pSgaObj = new SgaObjectAnim(); break;
+ case( SGA_OBJ_INET ): pSgaObj = new SgaObjectINet(); break;
+ case( SGA_OBJ_SVDRAW ): pSgaObj = new SgaObjectSvDraw(); break;
+ case( SGA_OBJ_SOUND ): pSgaObj = new SgaObjectSound(); break;
+
+ default:
+ break;
+ }
+
+ if( pSgaObj )
+ {
+ *pIStm >> *pSgaObj;
+ pSgaObj->ImplUpdateURL( pEntry->aURL );
+ }
+ }
+
+ delete pIStm;
+ }
+ }
+
+ return pSgaObj;
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryTheme::ImplRead()
+{
+ SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( GetThmURL().GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ );
+
+ if( pIStm )
+ {
+ *pIStm >> *this;
+ delete pIStm;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryTheme::ImplWrite()
+{
+ if( IsModified() )
+ {
+ INetURLObject aPathURL( GetThmURL() );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+
+ DBG_ASSERT( aPathURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ if( FileExists( aPathURL ) || CreateDir( aPathURL ) )
+ {
+#ifdef UNX
+ SvStream* pOStm = ::utl::UcbStreamHelper::CreateStream( GetThmURL().GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE | STREAM_COPY_ON_SYMLINK | STREAM_TRUNC );
+#else
+ SvStream* pOStm = ::utl::UcbStreamHelper::CreateStream( GetThmURL().GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE | STREAM_TRUNC );
+#endif
+
+ if( pOStm )
+ {
+ *pOStm << *this;
+ delete pOStm;
+ }
+
+ ImplSetModified( sal_False );
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+const GalleryObject* GalleryTheme::ImplGetGalleryObject( const INetURLObject& rURL )
+{
+ GalleryObject* pEntry = aObjectList.First();
+ GalleryObject* pFoundEntry = NULL;
+
+ for( ; pEntry && !pFoundEntry; pEntry = aObjectList.Next() )
+ if( pEntry->aURL == rURL )
+ pFoundEntry = pEntry;
+
+ return pFoundEntry;
+}
+
+// ------------------------------------------------------------------------
+
+INetURLObject GalleryTheme::ImplGetURL( const GalleryObject* pObject ) const
+{
+ INetURLObject aURL;
+
+ if( pObject )
+ {
+ if( IsImported() )
+ {
+ INetURLObject aPathURL( GetParent()->GetImportURL( GetName() ) );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+ aPathURL.Append( pObject->aURL.GetName() );
+ aURL = aPathURL;
+ }
+ else
+ aURL = pObject->aURL;
+ }
+
+ return aURL;
+}
+
+// ------------------------------------------------------------------------
+
+INetURLObject GalleryTheme::ImplCreateUniqueURL( SgaObjKind eObjKind, sal_uIntPtr nFormat )
+{
+ INetURLObject aDir( GetParent()->GetUserURL() );
+ INetURLObject aInfoFileURL( GetParent()->GetUserURL() );
+ INetURLObject aNewURL;
+ sal_uInt32 nNextNumber = 1999;
+ sal_Char const* pExt = NULL;
+ sal_Bool bExists;
+
+ aDir.Append( String( RTL_CONSTASCII_USTRINGPARAM( "dragdrop" ) ) );
+ CreateDir( aDir );
+
+ aInfoFileURL.Append( String( RTL_CONSTASCII_USTRINGPARAM( "sdddndx1" ) ) );
+
+ // read next possible number
+ if( FileExists( aInfoFileURL ) )
+ {
+ SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aInfoFileURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ );
+
+ if( pIStm )
+ {
+ *pIStm >> nNextNumber;
+ delete pIStm;
+ }
+ }
+
+ // create extension
+ if( nFormat )
+ {
+ switch( nFormat )
+ {
+ case( CVT_BMP ): pExt = ".bmp"; break;
+ case( CVT_GIF ): pExt = ".gif"; break;
+ case( CVT_JPG ): pExt = ".jpg"; break;
+ case( CVT_MET ): pExt = ".met"; break;
+ case( CVT_PCT ): pExt = ".pct"; break;
+ case( CVT_PNG ): pExt = ".png"; break;
+ case( CVT_SVM ): pExt = ".svm"; break;
+ case( CVT_TIF ): pExt = ".tif"; break;
+ case( CVT_WMF ): pExt = ".wmf"; break;
+ case( CVT_EMF ): pExt = ".emf"; break;
+
+ default:
+ pExt = ".grf";
+ break;
+ }
+ }
+
+ do
+ {
+ // get URL
+ if( SGA_OBJ_SVDRAW == eObjKind )
+ {
+ String aFileName( RTL_CONSTASCII_USTRINGPARAM( "gallery/svdraw/dd" ) );
+ aNewURL = INetURLObject( aFileName += String::CreateFromInt32( ++nNextNumber % 99999999 ), INET_PROT_PRIV_SOFFICE );
+
+ bExists = sal_False;
+
+ for( GalleryObject* pEntry = aObjectList.First(); pEntry && !bExists; pEntry = aObjectList.Next() )
+ if( pEntry->aURL == aNewURL )
+ bExists = sal_True;
+ }
+ else
+ {
+ String aFileName( RTL_CONSTASCII_USTRINGPARAM( "dd" ) );
+
+ aFileName += String::CreateFromInt32( ++nNextNumber % 999999 );
+ aFileName += String( pExt, RTL_TEXTENCODING_ASCII_US );
+
+ aNewURL = aDir;
+ aNewURL.Append( aFileName );
+
+ bExists = FileExists( aNewURL );
+ }
+ }
+ while( bExists );
+
+ // write updated number
+ SvStream* pOStm = ::utl::UcbStreamHelper::CreateStream( aInfoFileURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE );
+
+ if( pOStm )
+ {
+ *pOStm << nNextNumber;
+ delete pOStm;
+ }
+
+ return aNewURL;
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryTheme::ImplBroadcast( sal_uIntPtr nUpdatePos )
+{
+ if( !IsBroadcasterLocked() )
+ {
+ if( GetObjectCount() && ( nUpdatePos >= GetObjectCount() ) )
+ nUpdatePos = GetObjectCount() - 1;
+
+ Broadcast( GalleryHint( GALLERY_HINT_THEME_UPDATEVIEW, GetName(), nUpdatePos ) );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryTheme::UnlockTheme()
+{
+ DBG_ASSERT( mnThemeLockCount, "Theme is not locked" );
+
+ sal_Bool bRet = sal_False;
+
+ if( mnThemeLockCount )
+ {
+ --mnThemeLockCount;
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryTheme::UnlockBroadcaster( sal_uIntPtr nUpdatePos )
+{
+ DBG_ASSERT( mnBroadcasterLockCount, "Broadcaster is not locked" );
+
+ if( mnBroadcasterLockCount && !--mnBroadcasterLockCount )
+ ImplBroadcast( nUpdatePos );
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryTheme::InsertObject( const SgaObject& rObj, sal_uIntPtr nInsertPos )
+{
+ sal_Bool bRet = sal_False;
+
+ if( rObj.IsValid() )
+ {
+ GalleryObject* pEntry = aObjectList.First();
+ GalleryObject* pFoundEntry = NULL;
+
+ for( ; pEntry && !pFoundEntry; pEntry = aObjectList.Next() )
+ if( pEntry->aURL == rObj.GetURL() )
+ pFoundEntry = pEntry;
+
+ if( pFoundEntry )
+ {
+ GalleryObject aNewEntry;
+
+ // update title of new object if neccessary
+ if( !rObj.GetTitle().Len() )
+ {
+ SgaObject* pOldObj = ImplReadSgaObject( pFoundEntry );
+
+ if( pOldObj )
+ {
+ ( (SgaObject&) rObj ).SetTitle( pOldObj->GetTitle() );
+ delete pOldObj;
+ }
+ }
+ else if( rObj.GetTitle() == String( RTL_CONSTASCII_USTRINGPARAM( "__<empty>__" ) ) )
+ ( (SgaObject&) rObj ).SetTitle( String() );
+
+ ImplWriteSgaObject( rObj, nInsertPos, &aNewEntry );
+ pFoundEntry->nOffset = aNewEntry.nOffset;
+ }
+ else
+ ImplWriteSgaObject( rObj, nInsertPos, NULL );
+
+ ImplSetModified( bRet = sal_True );
+ ImplBroadcast( pFoundEntry ? aObjectList.GetPos( pFoundEntry ) : nInsertPos );
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+SgaObject* GalleryTheme::AcquireObject( sal_uIntPtr nPos )
+{
+ return ImplReadSgaObject( aObjectList.GetObject( nPos ) );
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryTheme::ReleaseObject( SgaObject* pObject )
+{
+ delete pObject;
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryTheme::RemoveObject( sal_uIntPtr nPos )
+{
+ GalleryObject* pEntry = aObjectList.Remove( nPos );
+
+ if( !aObjectList.Count() )
+ KillFile( GetSdgURL() );
+
+ if( pEntry )
+ {
+ if( SGA_OBJ_SVDRAW == pEntry->eObjKind )
+ aSvDrawStorageRef->Remove( pEntry->aURL.GetMainURL( INetURLObject::NO_DECODE ) );
+
+ Broadcast( GalleryHint( GALLERY_HINT_CLOSE_OBJECT, GetName(), reinterpret_cast< sal_uIntPtr >( pEntry ) ) );
+ delete pEntry;
+ Broadcast( GalleryHint( GALLERY_HINT_OBJECT_REMOVED, GetName(), reinterpret_cast< sal_uIntPtr >( pEntry ) ) );
+
+ ImplSetModified( sal_True );
+ ImplBroadcast( nPos );
+ }
+
+ return( pEntry != NULL );
+}
+
+// ------------------------------------------------------------------------
+
+sal_Bool GalleryTheme::ChangeObjectPos( sal_uIntPtr nOldPos, sal_uIntPtr nNewPos )
+{
+ sal_Bool bRet = sal_False;
+
+ if( nOldPos != nNewPos )
+ {
+ GalleryObject* pEntry = aObjectList.GetObject( nOldPos );
+
+ if( pEntry )
+ {
+ aObjectList.Insert( pEntry, nNewPos );
+
+ if( nNewPos < nOldPos )
+ nOldPos++;
+
+ aObjectList.Remove( nOldPos );
+ ImplSetModified( bRet = sal_True );
+ ImplBroadcast( ( nNewPos < nOldPos ) ? nNewPos : ( nNewPos - 1 ) );
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+void GalleryTheme::Actualize( const Link& rActualizeLink, GalleryProgress* pProgress )
+{
+ if( !IsReadOnly() && !IsImported() )
+ {
+ Graphic aGraphic;
+ String aFormat;
+ GalleryObject* pEntry;
+ const sal_uIntPtr nCount = aObjectList.Count();
+ sal_uIntPtr i;
+
+ LockBroadcaster();
+ bAbortActualize = sal_False;
+
+ // LoeschFlag zuruecksetzen
+ for ( i = 0; i < nCount; i++ )
+ aObjectList.GetObject( i )->bDummy = sal_False;
+
+ for( i = 0; ( i < nCount ) && !bAbortActualize; i++ )
+ {
+ if( pProgress )
+ pProgress->Update( i, nCount - 1 );
+
+ pEntry = aObjectList.GetObject( i );
+
+ const INetURLObject aURL( pEntry->aURL );
+
+ rActualizeLink.Call( (void*) &aURL );
+
+ // SvDraw-Objekte werden spaeter aktualisiert
+ if( pEntry->eObjKind != SGA_OBJ_SVDRAW )
+ {
+ // Hier muss noch etwas eingebaut werden,
+ // das Files auf den ensprechenden Eintrag matched
+ // Grafiken als Grafik-Objekte in die Gallery aufnehmen
+ if( pEntry->eObjKind == SGA_OBJ_SOUND )
+ {
+ SgaObjectSound aObjSound( aURL );
+ if( !InsertObject( aObjSound ) )
+ pEntry->bDummy = sal_True;
+ }
+ else
+ {
+ aGraphic.Clear();
+
+ if ( GalleryGraphicImport( aURL, aGraphic, aFormat ) )
+ {
+ SgaObject* pNewObj;
+
+ if ( SGA_OBJ_INET == pEntry->eObjKind )
+ pNewObj = (SgaObject*) new SgaObjectINet( aGraphic, aURL, aFormat );
+ else if ( aGraphic.IsAnimated() )
+ pNewObj = (SgaObject*) new SgaObjectAnim( aGraphic, aURL, aFormat );
+ else
+ pNewObj = (SgaObject*) new SgaObjectBmp( aGraphic, aURL, aFormat );
+
+ if( !InsertObject( *pNewObj ) )
+ pEntry->bDummy = sal_True;
+
+ delete pNewObj;
+ }
+ else
+ pEntry->bDummy = sal_True; // Loesch-Flag setzen
+ }
+ }
+ else
+ {
+ if ( aSvDrawStorageRef.Is() )
+ {
+ const String aStmName( GetSvDrawStreamNameFromURL( pEntry->aURL ) );
+ SvStorageStreamRef pIStm = aSvDrawStorageRef->OpenSotStream( aStmName, STREAM_READ );
+
+ if( pIStm && !pIStm->GetError() )
+ {
+ pIStm->SetBufferSize( 16384 );
+
+ SgaObjectSvDraw aNewObj( *pIStm, pEntry->aURL );
+
+ if( !InsertObject( aNewObj ) )
+ pEntry->bDummy = sal_True;
+
+ pIStm->SetBufferSize( 0L );
+ }
+ }
+ }
+ }
+
+ // remove all entries with set flag
+ pEntry = aObjectList.First();
+ while( pEntry )
+ {
+ if( pEntry->bDummy )
+ {
+ Broadcast( GalleryHint( GALLERY_HINT_CLOSE_OBJECT, GetName(), reinterpret_cast< sal_uIntPtr >( pEntry ) ) );
+ delete aObjectList.Remove( pEntry );
+ Broadcast( GalleryHint( GALLERY_HINT_OBJECT_REMOVED, GetName(), reinterpret_cast< sal_uIntPtr >( pEntry ) ) );
+
+ pEntry = aObjectList.GetCurObject();
+ }
+ else
+ pEntry = aObjectList.Next();
+ }
+
+ // update theme
+ ::utl::TempFile aTmp;
+ INetURLObject aInURL( GetSdgURL() );
+ INetURLObject aTmpURL( aTmp.GetURL() );
+
+ DBG_ASSERT( aInURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+ DBG_ASSERT( aTmpURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aInURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ );
+ SvStream* pTmpStm = ::utl::UcbStreamHelper::CreateStream( aTmpURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE | STREAM_TRUNC );
+
+ if( pIStm && pTmpStm )
+ {
+ pEntry = aObjectList.First();
+
+ while( pEntry )
+ {
+ SgaObject* pObj;
+
+ switch( pEntry->eObjKind )
+ {
+ case( SGA_OBJ_BMP ): pObj = new SgaObjectBmp(); break;
+ case( SGA_OBJ_ANIM ): pObj = new SgaObjectAnim(); break;
+ case( SGA_OBJ_INET ): pObj = new SgaObjectINet(); break;
+ case( SGA_OBJ_SVDRAW ): pObj = new SgaObjectSvDraw(); break;
+ case (SGA_OBJ_SOUND): pObj = new SgaObjectSound(); break;
+
+ default:
+ pObj = NULL;
+ break;
+ }
+
+ if( pObj )
+ {
+ pIStm->Seek( pEntry->nOffset );
+ *pIStm >> *pObj;
+ pEntry->nOffset = pTmpStm->Tell();
+ *pTmpStm << *pObj;
+ delete pObj;
+ }
+
+ pEntry = aObjectList.Next();
+ }
+ }
+ else
+ {
+ DBG_ERROR( "File(s) could not be opened" );
+ }
+
+ delete pIStm;
+ delete pTmpStm;
+
+ CopyFile( aTmpURL, aInURL );
+ KillFile( aTmpURL );
+
+ sal_uIntPtr nStorErr = 0;
+
+ {
+ SvStorageRef aTempStorageRef( new SvStorage( sal_False, aTmpURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_STD_READWRITE ) );
+ aSvDrawStorageRef->CopyTo( aTempStorageRef );
+ nStorErr = aSvDrawStorageRef->GetError();
+ }
+
+ if( !nStorErr )
+ {
+ aSvDrawStorageRef.Clear();
+ CopyFile( aTmpURL, GetSdvURL() );
+ ImplCreateSvDrawStorage();
+ }
+
+ KillFile( aTmpURL );
+ ImplSetModified( sal_True );
+ ImplWrite();
+ UnlockBroadcaster();
+ }
+}
+
+// ------------------------------------------------------------------------
+
+GalleryThemeEntry* GalleryTheme::CreateThemeEntry( const INetURLObject& rURL, sal_Bool bReadOnly )
+{
+ DBG_ASSERT( rURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ GalleryThemeEntry* pRet = NULL;
+
+ if( FileExists( rURL ) )
+ {
+ SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( rURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ );
+
+ if( pIStm )
+ {
+ String aThemeName;
+ sal_uInt32 nThemeId = 0;
+ sal_uInt16 nVersion;
+ sal_Bool bThemeNameFromResource = sal_False;
+
+ *pIStm >> nVersion;
+
+ if( nVersion <= 0x00ff )
+ {
+ ByteString aTmpStr;
+
+ *pIStm >> aTmpStr; aThemeName = String( aTmpStr.GetBuffer(), RTL_TEXTENCODING_UTF8 );
+
+ // Charakterkonvertierung durchfuehren
+ if( nVersion >= 0x0004 )
+ {
+ sal_uInt32 nCount;
+ sal_uInt16 nTemp16;
+
+ *pIStm >> nCount >> nTemp16;
+ pIStm->Seek( STREAM_SEEK_TO_END );
+
+ // pruefen, ob es sich um eine neuere Version handelt;
+ // daher um 520Bytes (8Bytes Kennung + 512Bytes Reserverpuffer ) zurueckspringen,
+ // falls dies ueberhaupt moeglich ist
+ if( pIStm->Tell() >= 520 )
+ {
+ sal_uInt32 nId1, nId2;
+
+ pIStm->SeekRel( -520 );
+ *pIStm >> nId1 >> nId2;
+
+ if( nId1 == COMPAT_FORMAT( 'G', 'A', 'L', 'R' ) &&
+ nId2 == COMPAT_FORMAT( 'E', 'S', 'R', 'V' ) )
+ {
+ VersionCompat* pCompat = new VersionCompat( *pIStm, STREAM_READ );
+
+ *pIStm >> nThemeId;
+
+ if( pCompat->GetVersion() >= 2 )
+ {
+ *pIStm >> bThemeNameFromResource;
+ }
+
+ delete pCompat;
+ }
+ }
+ }
+
+ INetURLObject aPathURL( rURL );
+
+ aPathURL.removeSegment();
+ aPathURL.removeFinalSlash();
+ pRet = new GalleryThemeEntry( aPathURL, aThemeName,
+ String(rURL.GetBase()).Copy( 2, 6 ).ToInt32(),
+ bReadOnly, sal_False, sal_False, nThemeId,
+ bThemeNameFromResource );
+ }
+
+ delete pIStm;
+ }
+ }
+
+ return pRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool GalleryTheme::GetThumb( sal_uIntPtr nPos, Bitmap& rBmp, sal_Bool )
+{
+ SgaObject* pObj = AcquireObject( nPos );
+ sal_Bool bRet = sal_False;
+
+ if( pObj )
+ {
+ rBmp = pObj->GetThumbBmp();
+ ReleaseObject( pObj );
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool GalleryTheme::GetGraphic( sal_uIntPtr nPos, Graphic& rGraphic, sal_Bool bProgress )
+{
+ const GalleryObject* pObject = ImplGetGalleryObject( nPos );
+ sal_Bool bRet = sal_False;
+
+ if( pObject )
+ {
+ const INetURLObject aURL( ImplGetURL( pObject ) );
+
+ switch( pObject->eObjKind )
+ {
+ case( SGA_OBJ_BMP ):
+ case( SGA_OBJ_ANIM ):
+ case( SGA_OBJ_INET ):
+ {
+ String aFilterDummy;
+ bRet = ( GalleryGraphicImport( aURL, rGraphic, aFilterDummy, bProgress ) != SGA_IMPORT_NONE );
+ }
+ break;
+
+ case( SGA_OBJ_SVDRAW ):
+ {
+ SvxGalleryDrawModel aModel;
+
+ if( aModel.GetModel() )
+ {
+ if( GetModel( nPos, *aModel.GetModel(), bProgress ) )
+ {
+ ImageMap aIMap;
+
+ if( CreateIMapGraphic( *aModel.GetModel(), rGraphic, aIMap ) )
+ bRet = sal_True;
+ else
+ {
+ VirtualDevice aVDev;
+ aVDev.SetMapMode( MapMode( MAP_100TH_MM ) );
+ FmFormView aView( aModel.GetModel(), &aVDev );
+
+ aView.hideMarkHandles();
+ aView.ShowSdrPage(aView.GetModel()->GetPage(0));
+ aView.MarkAll();
+ rGraphic = aView.GetAllMarkedGraphic();
+ bRet = sal_True;
+ }
+ }
+ }
+ }
+ break;
+
+ case( SGA_OBJ_SOUND ):
+ {
+ SgaObject* pObj = AcquireObject( nPos );
+
+ if( pObj )
+ {
+ Bitmap aBmp( pObj->GetThumbBmp() );
+ aBmp.Replace( COL_LIGHTMAGENTA, COL_WHITE );
+ rGraphic = aBmp;
+ ReleaseObject( pObj );
+ bRet = sal_True;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool GalleryTheme::InsertGraphic( const Graphic& rGraphic, sal_uIntPtr nInsertPos )
+{
+ sal_Bool bRet = sal_False;
+
+ if( rGraphic.GetType() != GRAPHIC_NONE )
+ {
+ sal_uIntPtr nExportFormat = CVT_UNKNOWN;
+ const GfxLink aGfxLink( ( (Graphic&) rGraphic ).GetLink() );
+
+ if( aGfxLink.GetDataSize() )
+ {
+ switch( aGfxLink.GetType() )
+ {
+ case( GFX_LINK_TYPE_EPS_BUFFER ): nExportFormat = CVT_SVM; break;
+ case( GFX_LINK_TYPE_NATIVE_GIF ): nExportFormat = CVT_GIF; break;
+ case( GFX_LINK_TYPE_NATIVE_JPG ): nExportFormat = CVT_JPG; break;
+ case( GFX_LINK_TYPE_NATIVE_PNG ): nExportFormat = CVT_PNG; break;
+ case( GFX_LINK_TYPE_NATIVE_TIF ): nExportFormat = CVT_TIF; break;
+ case( GFX_LINK_TYPE_NATIVE_WMF ): nExportFormat = CVT_WMF; break;
+ case( GFX_LINK_TYPE_NATIVE_MET ): nExportFormat = CVT_MET; break;
+ case( GFX_LINK_TYPE_NATIVE_PCT ): nExportFormat = CVT_PCT; break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ if( rGraphic.GetType() == GRAPHIC_BITMAP )
+ {
+ if( rGraphic.IsAnimated() )
+ nExportFormat = CVT_GIF;
+ else
+ nExportFormat = CVT_PNG;
+ }
+ else
+ nExportFormat = CVT_SVM;
+ }
+
+ const INetURLObject aURL( ImplCreateUniqueURL( SGA_OBJ_BMP, nExportFormat ) );
+ SvStream* pOStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE | STREAM_TRUNC );
+
+ if( pOStm )
+ {
+ pOStm->SetVersion( SOFFICE_FILEFORMAT_50 );
+
+ if( CVT_SVM == nExportFormat )
+ {
+ GDIMetaFile aMtf( rGraphic.GetGDIMetaFile() );
+
+ aMtf.Write( *pOStm );
+ bRet = ( pOStm->GetError() == ERRCODE_NONE );
+ }
+ else
+ {
+ if( aGfxLink.GetDataSize() && aGfxLink.GetData() )
+ {
+ pOStm->Write( aGfxLink.GetData(), aGfxLink.GetDataSize() );
+ bRet = ( pOStm->GetError() == ERRCODE_NONE );
+ }
+ else
+ bRet = ( GraphicConverter::Export( *pOStm, rGraphic, nExportFormat ) == ERRCODE_NONE );
+ }
+
+ delete pOStm;
+ }
+
+ if( bRet )
+ {
+ const SgaObjectBmp aObjBmp( aURL.GetMainURL( INetURLObject::NO_DECODE ) );
+ InsertObject( aObjBmp, nInsertPos );
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool GalleryTheme::GetModel( sal_uIntPtr nPos, SdrModel& rModel, sal_Bool )
+{
+ const GalleryObject* pObject = ImplGetGalleryObject( nPos );
+ sal_Bool bRet = sal_False;
+
+ if( pObject && ( SGA_OBJ_SVDRAW == pObject->eObjKind ) )
+ {
+ const INetURLObject aURL( ImplGetURL( pObject ) );
+ SvStorageRef xStor( GetSvDrawStorage() );
+
+ if( xStor.Is() )
+ {
+ const String aStmName( GetSvDrawStreamNameFromURL( aURL ) );
+ SvStorageStreamRef xIStm( xStor->OpenSotStream( aStmName, STREAM_READ ) );
+
+ if( xIStm.Is() && !xIStm->GetError() )
+ {
+ xIStm->SetBufferSize( STREAMBUF_SIZE );
+ bRet = GallerySvDrawImport( *xIStm, rModel );
+ xIStm->SetBufferSize( 0L );
+ }
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool GalleryTheme::InsertModel( const FmFormModel& rModel, sal_uIntPtr nInsertPos )
+{
+ INetURLObject aURL( ImplCreateUniqueURL( SGA_OBJ_SVDRAW ) );
+ SvStorageRef xStor( GetSvDrawStorage() );
+ sal_Bool bRet = sal_False;
+
+ if( xStor.Is() )
+ {
+ const String aStmName( GetSvDrawStreamNameFromURL( aURL ) );
+ SvStorageStreamRef xOStm( xStor->OpenSotStream( aStmName, STREAM_WRITE | STREAM_TRUNC ) );
+
+ if( xOStm.Is() && !xOStm->GetError() )
+ {
+ SvMemoryStream aMemStm( 65535, 65535 );
+ FmFormModel* pFormModel = (FmFormModel*) &rModel;
+
+ pFormModel->BurnInStyleSheetAttributes();
+
+ {
+ uno::Reference< io::XOutputStream > xDocOut( new utl::OOutputStreamWrapper( aMemStm ) );
+
+ if( xDocOut.is() )
+ SvxDrawingLayerExport( pFormModel, xDocOut );
+ }
+
+ aMemStm.Seek( 0 );
+
+ xOStm->SetBufferSize( 16348 );
+ GalleryCodec aCodec( *xOStm );
+ aCodec.Write( aMemStm );
+
+ if( !xOStm->GetError() )
+ {
+ SgaObjectSvDraw aObjSvDraw( rModel, aURL );
+ bRet = InsertObject( aObjSvDraw, nInsertPos );
+ }
+
+ xOStm->SetBufferSize( 0L );
+ xOStm->Commit();
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool GalleryTheme::GetModelStream( sal_uIntPtr nPos, SotStorageStreamRef& rxModelStream, sal_Bool )
+{
+ const GalleryObject* pObject = ImplGetGalleryObject( nPos );
+ sal_Bool bRet = sal_False;
+
+ if( pObject && ( SGA_OBJ_SVDRAW == pObject->eObjKind ) )
+ {
+ const INetURLObject aURL( ImplGetURL( pObject ) );
+ SvStorageRef xStor( GetSvDrawStorage() );
+
+ if( xStor.Is() )
+ {
+ const String aStmName( GetSvDrawStreamNameFromURL( aURL ) );
+ SvStorageStreamRef xIStm( xStor->OpenSotStream( aStmName, STREAM_READ ) );
+
+ if( xIStm.Is() && !xIStm->GetError() )
+ {
+ sal_uInt32 nVersion = 0;
+
+ xIStm->SetBufferSize( 16348 );
+
+ if( GalleryCodec::IsCoded( *xIStm, nVersion ) )
+ {
+ SvxGalleryDrawModel aModel;
+
+ if( aModel.GetModel() )
+ {
+ if( GallerySvDrawImport( *xIStm, *aModel.GetModel() ) )
+ {
+ aModel.GetModel()->BurnInStyleSheetAttributes();
+
+ {
+ uno::Reference< io::XOutputStream > xDocOut( new utl::OOutputStreamWrapper( *rxModelStream ) );
+
+ if( SvxDrawingLayerExport( aModel.GetModel(), xDocOut ) )
+ rxModelStream->Commit();
+ }
+ }
+
+ bRet = ( rxModelStream->GetError() == ERRCODE_NONE );
+ }
+ }
+
+ xIStm->SetBufferSize( 0 );
+ }
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool GalleryTheme::InsertModelStream( const SotStorageStreamRef& rxModelStream, sal_uIntPtr nInsertPos )
+{
+ INetURLObject aURL( ImplCreateUniqueURL( SGA_OBJ_SVDRAW ) );
+ SvStorageRef xStor( GetSvDrawStorage() );
+ sal_Bool bRet = sal_False;
+
+ if( xStor.Is() )
+ {
+ const String aStmName( GetSvDrawStreamNameFromURL( aURL ) );
+ SvStorageStreamRef xOStm( xStor->OpenSotStream( aStmName, STREAM_WRITE | STREAM_TRUNC ) );
+
+ if( xOStm.Is() && !xOStm->GetError() )
+ {
+ GalleryCodec aCodec( *xOStm );
+ SvMemoryStream aMemStm( 65535, 65535 );
+
+ xOStm->SetBufferSize( 16348 );
+ aCodec.Write( *rxModelStream );
+
+ if( !xOStm->GetError() )
+ {
+ xOStm->Seek( 0 );
+ SgaObjectSvDraw aObjSvDraw( *xOStm, aURL );
+ bRet = InsertObject( aObjSvDraw, nInsertPos );
+ }
+
+ xOStm->SetBufferSize( 0L );
+ xOStm->Commit();
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool GalleryTheme::GetURL( sal_uIntPtr nPos, INetURLObject& rURL, sal_Bool )
+{
+ const GalleryObject* pObject = ImplGetGalleryObject( nPos );
+ sal_Bool bRet = sal_False;
+
+ if( pObject )
+ {
+ rURL = INetURLObject( ImplGetURL( pObject ) );
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool GalleryTheme::InsertURL( const INetURLObject& rURL, sal_uIntPtr nInsertPos )
+{
+ Graphic aGraphic;
+ String aFormat;
+ SgaObject* pNewObj = NULL;
+ const sal_uInt16 nImportRet = GalleryGraphicImport( rURL, aGraphic, aFormat );
+ sal_Bool bRet = sal_False;
+
+ if( nImportRet != SGA_IMPORT_NONE )
+ {
+ if ( SGA_IMPORT_INET == nImportRet )
+ pNewObj = (SgaObject*) new SgaObjectINet( aGraphic, rURL, aFormat );
+ else if ( aGraphic.IsAnimated() )
+ pNewObj = (SgaObject*) new SgaObjectAnim( aGraphic, rURL, aFormat );
+ else
+ pNewObj = (SgaObject*) new SgaObjectBmp( aGraphic, rURL, aFormat );
+ }
+ else if( ::avmedia::MediaWindow::isMediaURL( rURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ) )
+ pNewObj = (SgaObject*) new SgaObjectSound( rURL );
+
+ if( pNewObj && InsertObject( *pNewObj, nInsertPos ) )
+ bRet = sal_True;
+
+ delete pNewObj;
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool GalleryTheme::InsertFileOrDirURL( const INetURLObject& rFileOrDirURL, sal_uIntPtr nInsertPos )
+{
+ INetURLObject aURL;
+ ::std::vector< INetURLObject > aURLVector;
+ sal_Bool bRet = sal_False;
+
+ try
+ {
+ ::ucbhelper::Content aCnt( rFileOrDirURL.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment >() );
+ sal_Bool bFolder = false;
+
+ aCnt.getPropertyValue( OUString::createFromAscii( "IsFolder" ) ) >>= bFolder;
+
+ if( bFolder )
+ {
+ uno::Sequence< OUString > aProps( 1 );
+ aProps.getArray()[ 0 ] = OUString::createFromAscii( "Url" );
+ uno::Reference< sdbc::XResultSet > xResultSet( aCnt.createCursor( aProps, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY ) );
+
+ if( xResultSet.is() )
+ {
+ uno::Reference< ucb::XContentAccess > xContentAccess( xResultSet, uno::UNO_QUERY );
+
+ if( xContentAccess.is() )
+ {
+ while( xResultSet->next() )
+ {
+ aURL.SetSmartURL( xContentAccess->queryContentIdentifierString() );
+ aURLVector.push_back( aURL );
+ }
+ }
+ }
+ }
+ else
+ aURLVector.push_back( rFileOrDirURL );
+ }
+ catch( const ucb::ContentCreationException& )
+ {
+ }
+ catch( const uno::RuntimeException& )
+ {
+ }
+ catch( const uno::Exception& )
+ {
+ }
+
+ ::std::vector< INetURLObject >::const_iterator aIter( aURLVector.begin() ), aEnd( aURLVector.end() );
+
+ while( aIter != aEnd )
+ bRet = bRet || InsertURL( *aIter++, nInsertPos );
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool GalleryTheme::InsertTransferable( const uno::Reference< datatransfer::XTransferable >& rxTransferable, sal_uIntPtr nInsertPos )
+{
+ sal_Bool bRet = sal_False;
+
+ if( rxTransferable.is() )
+ {
+ TransferableDataHelper aDataHelper( rxTransferable );
+ Graphic* pGraphic = NULL;
+
+ if( aDataHelper.HasFormat( SOT_FORMATSTR_ID_DRAWING ) )
+ {
+ SotStorageStreamRef xModelStm;
+
+ if( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_DRAWING, xModelStm ) )
+ bRet = InsertModelStream( xModelStm, nInsertPos );
+ }
+ else if( aDataHelper.HasFormat( SOT_FORMAT_FILE_LIST ) ||
+ aDataHelper.HasFormat( FORMAT_FILE ) )
+ {
+ FileList aFileList;
+
+ if( aDataHelper.HasFormat( SOT_FORMAT_FILE_LIST ) )
+ aDataHelper.GetFileList( SOT_FORMAT_FILE_LIST, aFileList );
+ else
+ {
+ String aFile;
+
+ aDataHelper.GetString( FORMAT_FILE, aFile );
+
+ if( aFile.Len() )
+ aFileList.AppendFile( aFile );
+ }
+
+ for( sal_uInt32 i = 0, nCount = aFileList.Count(); i < nCount; ++i )
+ {
+ const String aFile( aFileList.GetFile( i ) );
+ INetURLObject aURL( aFile );
+
+ if( aURL.GetProtocol() == INET_PROT_NOT_VALID )
+ {
+ String aLocalURL;
+
+ if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aFile, aLocalURL ) )
+ aURL = INetURLObject( aLocalURL );
+ }
+
+ if( aURL.GetProtocol() != INET_PROT_NOT_VALID )
+ bRet = InsertFileOrDirURL( aURL, nInsertPos );
+ }
+ }
+ else
+ {
+ Graphic aGraphic;
+ sal_uIntPtr nFormat = 0;
+
+ if( aDataHelper.HasFormat( SOT_FORMATSTR_ID_SVXB ) )
+ nFormat = SOT_FORMATSTR_ID_SVXB;
+ else if( aDataHelper.HasFormat( FORMAT_GDIMETAFILE ) )
+ nFormat = FORMAT_GDIMETAFILE;
+ else if( aDataHelper.HasFormat( FORMAT_BITMAP ) )
+ nFormat = FORMAT_BITMAP;
+
+ if( nFormat && aDataHelper.GetGraphic( nFormat, aGraphic ) )
+ pGraphic = new Graphic( aGraphic );
+ }
+
+ if( pGraphic )
+ {
+ bRet = sal_False;
+
+ if( aDataHelper.HasFormat( SOT_FORMATSTR_ID_SVIM ) )
+ {
+
+ ImageMap aImageMap;
+
+ // according to KA we don't need a BaseURL here
+ if( aDataHelper.GetImageMap( SOT_FORMATSTR_ID_SVIM, aImageMap ) )
+ {
+ SvxGalleryDrawModel aModel;
+
+ if( aModel.GetModel() )
+ {
+ SgaUserDataFactory aFactory;
+
+ SdrPage* pPage = aModel.GetModel()->GetPage(0);
+ SdrGrafObj* pGrafObj = new SdrGrafObj( *pGraphic );
+
+ pGrafObj->InsertUserData( new SgaIMapInfo( aImageMap ) );
+ pPage->InsertObject( pGrafObj );
+ bRet = InsertModel( *aModel.GetModel(), nInsertPos );
+ }
+ }
+ }
+
+ if( !bRet )
+ bRet = InsertGraphic( *pGraphic, nInsertPos );
+
+ delete pGraphic;
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryTheme::CopyToClipboard( Window* pWindow, sal_uIntPtr nPos )
+{
+ GalleryTransferable* pTransferable = new GalleryTransferable( this, nPos, false );
+ pTransferable->CopyToClipboard( pWindow );
+}
+
+// -----------------------------------------------------------------------------
+
+void GalleryTheme::StartDrag( Window* pWindow, sal_uIntPtr nPos )
+{
+ GalleryTransferable* pTransferable = new GalleryTransferable( this, nPos, true );
+ pTransferable->StartDrag( pWindow, DND_ACTION_COPY | DND_ACTION_LINK );
+}
+
+// -----------------------------------------------------------------------------
+
+SvStream& GalleryTheme::WriteData( SvStream& rOStm ) const
+{
+ const INetURLObject aRelURL1( GetParent()->GetRelativeURL() );
+ const INetURLObject aRelURL2( GetParent()->GetUserURL() );
+ INetURLObject aNewURL, aTempURL;
+ sal_uInt32 nCount = GetObjectCount();
+ sal_Bool bRel;
+
+ rOStm << (sal_uInt16) 0x0004;
+ rOStm << ByteString( GetRealName(), RTL_TEXTENCODING_UTF8 );
+ rOStm << nCount << (sal_uInt16) gsl_getSystemTextEncoding();
+
+ for( sal_uInt32 i = 0; i < nCount; i++ )
+ {
+ const GalleryObject* pObj = ImplGetGalleryObject( i );
+ String aPath;
+
+ if( SGA_OBJ_SVDRAW == pObj->eObjKind )
+ {
+ aPath = GetSvDrawStreamNameFromURL( pObj->aURL );
+ bRel = sal_False;
+ }
+ else
+ {
+ aPath = pObj->aURL.GetMainURL( INetURLObject::NO_DECODE );
+ bRel = ( ( aPath.Erase( sal::static_int_cast< xub_StrLen >( aRelURL1.GetMainURL( INetURLObject::NO_DECODE ).getLength() ) ) ) == String(aRelURL1.GetMainURL( INetURLObject::NO_DECODE ) ));
+
+ if( bRel && ( pObj->aURL.GetMainURL( INetURLObject::NO_DECODE ).getLength() > ( aRelURL1.GetMainURL( INetURLObject::NO_DECODE ).getLength() + 1 ) ) )
+ {
+ aPath = pObj->aURL.GetMainURL( INetURLObject::NO_DECODE );
+ aPath = aPath.Erase( 0, sal::static_int_cast< xub_StrLen >( aRelURL1.GetMainURL( INetURLObject::NO_DECODE ).getLength() ) );
+ }
+ else
+ {
+ aPath = pObj->aURL.GetMainURL( INetURLObject::NO_DECODE );
+ bRel = ( ( aPath.Erase( sal::static_int_cast< xub_StrLen >( aRelURL2.GetMainURL( INetURLObject::NO_DECODE ).getLength() ) ) ) == String(aRelURL2.GetMainURL( INetURLObject::NO_DECODE ) ));
+
+ if( bRel && ( pObj->aURL.GetMainURL( INetURLObject::NO_DECODE ).getLength() > ( aRelURL2.GetMainURL( INetURLObject::NO_DECODE ).getLength() + 1 ) ) )
+ {
+ aPath = pObj->aURL.GetMainURL( INetURLObject::NO_DECODE );
+ aPath = aPath.Erase( 0, sal::static_int_cast< xub_StrLen >( aRelURL2.GetMainURL( INetURLObject::NO_DECODE ).getLength() ) );
+ }
+ else
+ aPath = pObj->aURL.GetMainURL( INetURLObject::NO_DECODE );
+ }
+ }
+
+ aPath.SearchAndReplace(m_aDestDir, String());
+ rOStm << bRel << ByteString( aPath, RTL_TEXTENCODING_UTF8 ) << pObj->nOffset << (sal_uInt16) pObj->eObjKind;
+ }
+
+ // neuerdings wird ein 512-Byte-Reservepuffer gechrieben;
+ // um diesen zu erkennen werden zwei sal_uIntPtr-Ids geschrieben
+ rOStm << COMPAT_FORMAT( 'G', 'A', 'L', 'R' ) << COMPAT_FORMAT( 'E', 'S', 'R', 'V' );
+
+ const long nReservePos = rOStm.Tell();
+ VersionCompat* pCompat = new VersionCompat( rOStm, STREAM_WRITE, 2 );
+
+ rOStm << (sal_uInt32) GetId() << IsThemeNameFromResource(); // ab Version 2
+
+ delete pCompat;
+
+ // Rest des Puffers auffuellen
+ const long nRest = Max( 512L - ( (long) rOStm.Tell() - nReservePos ), 0L );
+
+ if( nRest )
+ {
+ char* pReserve = new char[ nRest ];
+ memset( pReserve, 0, nRest );
+ rOStm.Write( pReserve, nRest );
+ delete[] pReserve;
+ }
+
+ return rOStm;
+}
+
+// ------------------------------------------------------------------------
+
+SvStream& GalleryTheme::ReadData( SvStream& rIStm )
+{
+ sal_uInt32 nCount;
+ sal_uInt16 nVersion;
+ ByteString aTmpStr;
+ String aThemeName;
+ rtl_TextEncoding nTextEncoding;
+
+ aImportName = String();
+ rIStm >> nVersion >> aTmpStr >> nCount;
+
+ if( nVersion >= 0x0004 )
+ {
+ sal_uInt16 nTmp16;
+ rIStm >> nTmp16;
+ nTextEncoding = (rtl_TextEncoding) nTmp16;
+ }
+ else
+ nTextEncoding = RTL_TEXTENCODING_UTF8;
+
+ aThemeName = String( aTmpStr.GetBuffer(), nTextEncoding );
+
+ if( nCount <= ( 1L << 14 ) )
+ {
+ GalleryObject* pObj;
+ INetURLObject aRelURL1( GetParent()->GetRelativeURL() );
+ INetURLObject aRelURL2( GetParent()->GetUserURL() );
+ sal_uInt32 nId1, nId2;
+ sal_Bool bRel;
+
+ for( pObj = aObjectList.First(); pObj; pObj = aObjectList.Next() )
+ {
+ Broadcast( GalleryHint( GALLERY_HINT_CLOSE_OBJECT, GetName(), reinterpret_cast< sal_uIntPtr >( pObj ) ) );
+ delete pObj;
+ Broadcast( GalleryHint( GALLERY_HINT_OBJECT_REMOVED, GetName(), reinterpret_cast< sal_uIntPtr >( pObj ) ) );
+ }
+
+ aObjectList.Clear();
+
+ for( sal_uInt32 i = 0; i < nCount; i++ )
+ {
+ pObj = new GalleryObject;
+
+ ByteString aTempFileName;
+ String aFileName;
+ String aPath;
+ sal_uInt16 nTemp;
+
+ rIStm >> bRel >> aTempFileName >> pObj->nOffset;
+ rIStm >> nTemp; pObj->eObjKind = (SgaObjKind) nTemp;
+
+ aFileName = String( aTempFileName.GetBuffer(), gsl_getSystemTextEncoding() );
+
+ if( bRel )
+ {
+ aFileName.SearchAndReplaceAll( '\\', '/' );
+ aPath = aRelURL1.GetMainURL( INetURLObject::NO_DECODE );
+
+ if( aFileName.GetChar( 0 ) != '/' )
+ aPath += '/';
+
+ aPath += aFileName;
+
+ pObj->aURL = INetURLObject( aPath );
+
+ if( !FileExists( pObj->aURL ) )
+ {
+ aPath = aRelURL2.GetMainURL( INetURLObject::NO_DECODE );
+
+ if( aFileName.GetChar( 0 ) != '/' )
+ aPath += '/';
+
+ aPath += aFileName;
+
+ // assign this URL, even in the case it is not valid (#94482)
+ pObj->aURL = INetURLObject( aPath );
+ }
+ }
+ else
+ {
+ if( SGA_OBJ_SVDRAW == pObj->eObjKind )
+ {
+ const static String aBaseURLStr( RTL_CONSTASCII_USTRINGPARAM( "gallery/svdraw/" ) );
+
+ String aDummyURL( aBaseURLStr );
+ pObj->aURL = INetURLObject( aDummyURL += aFileName, INET_PROT_PRIV_SOFFICE );
+ }
+ else
+ {
+ String aLocalURL;
+
+ pObj->aURL = INetURLObject( aFileName );
+
+ if( ( pObj->aURL.GetProtocol() == INET_PROT_NOT_VALID ) &&
+ ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aFileName, aLocalURL ) )
+ {
+ pObj->aURL = INetURLObject( aLocalURL );
+ }
+ }
+ }
+
+ aObjectList.Insert( pObj, LIST_APPEND );
+ }
+
+ rIStm >> nId1 >> nId2;
+
+ // in neueren Versionen befindet sich am Ende ein 512-Byte-Reservepuffer;
+ // die Daten befinden sich am Anfang dieses Puffers und
+ // sind durch eine VersionCompat geklammert
+ if( !rIStm.IsEof() &&
+ nId1 == COMPAT_FORMAT( 'G', 'A', 'L', 'R' ) &&
+ nId2 == COMPAT_FORMAT( 'E', 'S', 'R', 'V' ) )
+ {
+ VersionCompat* pCompat = new VersionCompat( rIStm, STREAM_READ );
+ sal_uInt32 nTemp32;
+ sal_Bool bThemeNameFromResource = sal_False;
+
+ rIStm >> nTemp32;
+
+ if( pCompat->GetVersion() >= 2 )
+ {
+ rIStm >> bThemeNameFromResource;
+ }
+
+ SetId( nTemp32, bThemeNameFromResource );
+ delete pCompat;
+ }
+ }
+ else
+ rIStm.SetError( SVSTREAM_READ_ERROR );
+
+ ImplSetModified( sal_False );
+
+ return rIStm;
+}
+
+// ------------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOut, const GalleryTheme& rTheme )
+{
+ return rTheme.WriteData( rOut );
+}
+
+// ------------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIn, GalleryTheme& rTheme )
+{
+ return rTheme.ReadData( rIn );
+}
+
+void GalleryTheme::ImplSetModified( sal_Bool bModified )
+{ pThm->SetModified( bModified ); }
+
+const String& GalleryTheme::GetRealName() const { return pThm->GetThemeName(); }
+const INetURLObject& GalleryTheme::GetThmURL() const { return pThm->GetThmURL(); }
+const INetURLObject& GalleryTheme::GetSdgURL() const { return pThm->GetSdgURL(); }
+const INetURLObject& GalleryTheme::GetSdvURL() const { return pThm->GetSdvURL(); }
+sal_uInt32 GalleryTheme::GetId() const { return pThm->GetId(); }
+void GalleryTheme::SetId( sal_uInt32 nNewId, sal_Bool bResetThemeName ) { pThm->SetId( nNewId, bResetThemeName ); }
+sal_Bool GalleryTheme::IsThemeNameFromResource() const { return pThm->IsNameFromResource(); }
+sal_Bool GalleryTheme::IsImported() const { return pThm->IsImported(); }
+sal_Bool GalleryTheme::IsReadOnly() const { return pThm->IsReadOnly(); }
+sal_Bool GalleryTheme::IsDefault() const { return pThm->IsDefault(); }
+sal_Bool GalleryTheme::IsModified() const { return pThm->IsModified(); }
+const String& GalleryTheme::GetName() const { return IsImported() ? aImportName : pThm->GetThemeName(); }
+
+void GalleryTheme::InsertAllThemes( ListBox& rListBox )
+{
+ for( sal_uInt16 i = RID_GALLERYSTR_THEME_FIRST; i <= RID_GALLERYSTR_THEME_LAST; i++ )
+ rListBox.InsertEntry( String( GAL_RESID( i ) ) );
+}
+
diff --git a/svx/source/gallery2/galtheme.src b/svx/source/gallery2/galtheme.src
new file mode 100644
index 000000000000..bfb1f65d0340
--- /dev/null
+++ b/svx/source/gallery2/galtheme.src
@@ -0,0 +1,341 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "gallery.hrc"
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_3D
+{
+ Text [ en-US ] = "3D Effects";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_ANIMATIONS
+{
+ Text [ en-US ] = "Animations";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_BULLETS
+{
+ Text [ en-US ] = "Bullets";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_OFFICE
+{
+ Text [ en-US ] = "Office";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_FLAGS
+{
+ Text [ en-US ] = "Flags";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_FLOWCHARTS
+{
+ Text [ en-US ] = "Flow Charts";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_EMOTICONS
+{
+ Text [ en-US ] = "Emoticons";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_PHOTOS
+{
+ Text [ en-US ] = "Pictures";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_BACKGROUNDS
+{
+ Text [ en-US ] = "Backgrounds";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_HOMEPAGE
+{
+ Text [ en-US ] = "Homepage";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_INTERACTION
+{
+ Text [ en-US ] = "Interaction";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_MAPS
+{
+ Text [ en-US ] = "Maps";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_PEOPLE
+{
+ Text [ en-US ] = "People";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_SURFACES
+{
+ Text [ en-US ] = "Surfaces";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_HTMLBUTTONS
+{
+ // !!! Don't translate, please !!!
+ Text = "private://gallery/hidden/HtmlExportButtons";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_POWERPOINT
+{
+ // !!! Don't translate, please !!!
+ Text = "private://gallery/hidden/imgppt";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_RULERS
+{
+ Text [ en-US ] = "Rulers";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_SOUNDS
+{
+ Text [ en-US ] = "Sounds";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_SYMBOLS
+{
+ Text [ en-US ] = "Symbols";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_MYTHEME
+{
+ Text [ en-US ] = "My Theme";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_USERSOUNDS
+{
+ // !!! Don't translate, please !!!
+ Text = "private://gallery/hidden/usersounds";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_ARROWS
+{
+ Text [ en-US ] = "Arrows";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_BALLOONS
+{
+ Text [ en-US ] = "Balloons";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_KEYBOARD
+{
+ Text [ en-US ] = "Keyboard";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_TIME
+{
+ Text [ en-US ] = "Time";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_PRESENTATION
+{
+ Text [ en-US ] = "Presentation";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_CALENDAR
+{
+ Text [ en-US ] = "Calendar";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_NAVIGATION
+{
+ Text [ en-US ] = "Navigation";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_COMMUNICATION
+{
+ Text [ en-US ] = "Communication";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_FINANCES
+{
+ Text [ en-US ] = "Finances";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_COMPUTER
+{
+ Text [ en-US ] = "Computers";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_CLIMA
+{
+ Text [ en-US ] = "Climate";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_EDUCATION
+{
+ Text [ en-US ] = "School & University";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_TROUBLE
+{
+ Text [ en-US ] = "Problem Solving";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_SCREENBEANS
+{
+ Text [ en-US ] = "Screen Beans";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_FONTWORK
+{
+ // !!! Don't translate, please !!!
+ Text = "private://gallery/hidden/fontwork";
+};
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_FONTWORK_VERTICAL
+{
+ // !!! Don't translate, please !!!
+ Text = "private://gallery/hidden/fontworkvertical";
+};
+
+
+// -----------------------------------------------------------------------------
+
+String RID_GALLERYSTR_THEME_DUMMY5
+{
+ // !!! Don't translate, please !!!
+ Text = "Dummy 5";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/inc/AccessibleFrameSelector.hxx b/svx/source/inc/AccessibleFrameSelector.hxx
new file mode 100644
index 000000000000..745cd7c627ba
--- /dev/null
+++ b/svx/source/inc/AccessibleFrameSelector.hxx
@@ -0,0 +1,149 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_ACCESSIBLEFRAMESELECTOR_HXX
+#define SVX_ACCESSIBLEFRAMESELECTOR_HXX
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/awt/XFocusListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <tools/resary.hxx>
+#include <cppuhelper/implbase5.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <comphelper/accessibleeventnotifier.hxx>
+#include <svx/framebordertype.hxx>
+
+class VclSimpleEvent;
+class VclWindowEvent;
+
+namespace svx {
+
+class FrameSelector;
+
+namespace a11y {
+
+// ============================================================================
+
+class AccFrameSelector :
+ public ::cppu::WeakImplHelper5<
+ ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleComponent,
+ ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+ ::com::sun::star::lang::XServiceInfo
+ >,
+ public Resource
+{
+public:
+ explicit AccFrameSelector( FrameSelector& rFrameSel, FrameBorderType eBorder );
+
+ virtual ~AccFrameSelector();
+
+ //XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ //XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ //XAccessibleComponent
+ virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isShowing( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isVisible( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isFocusTraversable( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleEventBroadcaster
+ virtual void SAL_CALL addEventListener ( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener ( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener) throw (::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
+
+ void Invalidate();
+ void NotifyFocusListeners(sal_Bool bGetFocus);
+
+protected:
+ DECL_LINK( WindowEventListener, VclSimpleEvent* );
+
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+
+ void NotifyAccessibleEvent( const sal_Int16 _nEventId,
+ const ::com::sun::star::uno::Any& _rOldValue,
+ const ::com::sun::star::uno::Any& _rNewValue );
+
+private:
+ void IsValid() throw (::com::sun::star::uno::RuntimeException);
+
+ FrameSelector* mpFrameSel;
+ ::osl::Mutex maFocusMutex;
+ ::osl::Mutex maPropertyMutex;
+
+ FrameBorderType meBorder;
+
+ ::cppu::OInterfaceContainerHelper maFocusListeners;
+ ::cppu::OInterfaceContainerHelper maPropertyListeners;
+
+ ResStringArray maNames;
+ ResStringArray maDescriptions;
+
+ ::comphelper::AccessibleEventNotifier::TClientId mnClientId;
+};
+
+// ============================================================================
+
+} // namespace a11y
+} // namespace svx
+
+#endif
+
diff --git a/svx/source/inc/DGColorNameLookUp.hxx b/svx/source/inc/DGColorNameLookUp.hxx
new file mode 100644
index 000000000000..1b8c6ac8abe1
--- /dev/null
+++ b/svx/source/inc/DGColorNameLookUp.hxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_ACCESSIBILITY_DG_COLOR_NAME_LOOK_UP_HXX
+#define _SVX_ACCESSIBILITY_DG_COLOR_NAME_LOOK_UP_HXX
+
+#include <rtl/ustrbuf.hxx>
+#include <hash_map>
+
+namespace accessibility {
+
+/** This is a color name lookup targeted to be used by the accessibility
+ <type>DescriptionGenerator</type> class (hence the DG prefix). It
+ encapsulates a <type>com.sun.star.drawing.ColorTable</type> and provides
+ an inverse look up of color names for given a numerical color
+ descriptions--the RGB values encoded as integer.
+
+ <p>The class itself is designed as singleton so that the
+ <type>com.sun.star.drawing.ColorTable</type> object needs to be created
+ only once.</p>
+
+ <p>The singleton instance of this class lives at the moment until the
+ application terminates. However, the color table from which it takes
+ its values may change during this time. Reacting to these changes
+ remains a task for the future.</p>
+*/
+class DGColorNameLookUp
+{
+public:
+ /** Return the single instance of this class. Use this to look up
+ color names with the <member>LookUpColor()</member> method.
+ */
+ static DGColorNameLookUp& Instance (void);
+
+ /** Return the color name of the color expressed by the given integer.
+ @param nColor
+ This integer is the sum of the 8 Bit red value shifted left 16
+ Bits, the green value shifted left 8 Bits, and the unshifted
+ blue value.
+ @return
+ The returned string is either the color name of the specified
+ color or, when no name exists, a string of the form "#RRGGBB"
+ with two hexadecimal digits for each color component.
+ */
+ ::rtl::OUString LookUpColor (long int nColor) const;
+
+private:
+ /// Define hash map type to convert numerical color values to names.
+ typedef std::hash_map<long int, ::rtl::OUString>
+ tColorValueToNameMap;
+
+ /// This ma translates from numerical color values to names.
+ tColorValueToNameMap maColorValueToNameMap;
+
+ /** The pointer to the only instance of this class. It is NULL until
+ the <member>Instance</member> is called for the first time.
+ */
+ static DGColorNameLookUp* mpInstance;
+
+ /// Create a new (the only) instance of this class.
+ DGColorNameLookUp (void);
+
+ /// The destructor is never called.
+ ~DGColorNameLookUp (void);
+
+ /// The copy constructor is not implemented.
+ DGColorNameLookUp (const DGColorNameLookUp&);
+
+ /// The assignment operator is not implemented.
+ DGColorNameLookUp& operator= (const DGColorNameLookUp&);
+};
+
+} // end of namespace accessibility
+
+#endif
diff --git a/svx/source/inc/GraphCtlAccessibleContext.hxx b/svx/source/inc/GraphCtlAccessibleContext.hxx
new file mode 100644
index 000000000000..1d29cba30c8c
--- /dev/null
+++ b/svx/source/inc/GraphCtlAccessibleContext.hxx
@@ -0,0 +1,281 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _SVXGRAPHACCESSIBLECONTEXT_HXX
+#define _SVXGRAPHACCESSIBLECONTEXT_HXX
+
+#ifndef _CPPUHELPER_IMPLBASE7_HXX_
+#include <cppuhelper/compbase7.hxx>
+#endif
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_IllegalAccessibleComponentStateException_HPP_
+#include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp>
+#endif
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <cppuhelper/weak.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XServiceName.hpp>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <vos/mutex.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <svl/lstner.hxx>
+
+#include <set>
+#include <map>
+
+#include <comphelper/servicehelper.hxx>
+#include <svx/rectenum.hxx>
+#include <svx/AccessibleShapeTreeInfo.hxx>
+#include <svx/IAccessibleViewForwarder.hxx>
+#include <svx/AccessibleShape.hxx>
+
+namespace com { namespace sun { namespace star { namespace awt {
+ struct Point;
+ struct Rectangle;
+ struct Size;
+ class XFocusListener;
+} } } }
+
+class Rectangle;
+class GraphCtrl;
+class Window;
+class SdrObject;
+class SdrModel;
+class SdrPage;
+class SdrView;
+
+/** @descr
+ This base class provides an implementation of the
+ <code>AccessibleContext</code> service.
+*/
+
+typedef ::cppu::WeakAggComponentImplHelper7<
+ ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleComponent,
+ ::com::sun::star::accessibility::XAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+ ::com::sun::star::accessibility::XAccessibleSelection,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XServiceName >
+ SvxGraphCtrlAccessibleContext_Base;
+
+class SvxGraphCtrlAccessibleContext : public SvxGraphCtrlAccessibleContext_Base, ::comphelper::OBaseMutex, SfxListener, ::accessibility::IAccessibleViewForwarder
+{
+public:
+ friend class GraphCtrl;
+
+ //===== internal ========================================================
+ SvxGraphCtrlAccessibleContext(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>& rxParent,
+ GraphCtrl& rRepresentation,
+ const ::rtl::OUString* pName = NULL,
+ const ::rtl::OUString* pDescription = NULL );
+
+ void Notify( SfxBroadcaster& aBC, const SfxHint& aHint );
+
+protected:
+ virtual ~SvxGraphCtrlAccessibleContext();
+public:
+ //===== XAccessible =====================================================
+
+ /// Return the XAccessibleContext.
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL
+ getAccessibleContext (void) throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XAccessibleComponent ============================================
+
+ virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& rPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding() throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int32 SAL_CALL getForeground (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int32 SAL_CALL getBackground (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //===== XAccessibleContext ==============================================
+
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount (void) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL getAccessibleChild (sal_Int32 nIndex) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL getAccessibleParent (void) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent (void) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole (void) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription (void) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL getAccessibleRelationSet (void) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL getAccessibleStateSet (void) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale (void) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::accessibility::IllegalAccessibleComponentStateException);
+// virtual void SAL_CALL addPropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) {}
+// virtual void SAL_CALL removePropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) {}
+
+ //===== XComponent ========================================================
+
+ using ::cppu::WeakAggComponentImplHelperBase::addEventListener;
+ using ::cppu::WeakAggComponentImplHelperBase::removeEventListener;
+
+ //===== XAccessibleEventBroadcaster =====================================
+
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener>& xListener) throw (com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener>& xListener) throw (com::sun::star::uno::RuntimeException);
+
+ //===== XServiceInfo ====================================================
+
+ virtual ::rtl::OUString SAL_CALL getImplementationName (void) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService (const ::rtl::OUString& sServiceName) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames (void) throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XTypeProvider ===================================================
+
+ virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId (void) throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XServiceName ====================================================
+
+ virtual ::rtl::OUString SAL_CALL getServiceName (void) throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XAccessibleSelection =============================================
+
+ virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL clearAccessibleSelection() throw (::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL selectAllAccessibleChildren() throw (::com::sun::star::uno::RuntimeException );
+ virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException );
+
+ //===== IAccessibleViewforwarder ========================================
+
+ virtual sal_Bool IsValid (void) const;
+ virtual Rectangle GetVisibleArea() const;
+ virtual Point LogicToPixel (const Point& rPoint) const;
+ virtual Size LogicToPixel (const Size& rSize) const;
+ virtual Point PixelToLogic (const Point& rPoint) const;
+ virtual Size PixelToLogic (const Size& rSize) const;
+
+protected:
+ //===== internals ========================================================
+
+ void checkChildIndex( long nIndexOfChild ) throw (::com::sun::star::lang::IndexOutOfBoundsException );
+ void checkChildIndexOnSelection( long nIndexOfChild ) throw (::com::sun::star::lang::IndexOutOfBoundsException );
+
+public:
+
+ /// Sets the name
+ void setName( const ::rtl::OUString& rName );
+
+ /// Sets the description
+ void setDescription( const ::rtl::OUString& rDescr );
+
+ /** This method is used by the graph control to tell the
+ accessibility object about a new model and view.
+ */
+ void setModelAndView (SdrModel* pModel, SdrView* pView);
+
+private:
+ static ::com::sun::star::uno::Sequence< sal_Int8 > getUniqueId( void );
+protected:
+
+ /** Return the object's current bounding box relative to the desktop,
+ i.e in absolute pixel coordinates.
+ @return
+ The returned rectangle is a bounding box of the object given in
+ absolute screen coordinates.
+ @raise DisposedException
+ When the object is already disposed then a
+ <type>DisposedException</type> is thrown.
+ */
+ virtual Rectangle GetBoundingBoxOnScreen(void) throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the object's current bounding box relative to the parent object.
+ virtual Rectangle GetBoundingBox(void) throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL disposing();
+
+private:
+ SdrObject* getSdrObject( sal_Int32 nIndex )
+ throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException );
+
+ void CommitChange (sal_Int16 aEventId, const ::com::sun::star::uno::Any& rNewValue, const ::com::sun::star::uno::Any& rOldValue);
+ void FireEvent (const ::com::sun::star::accessibility::AccessibleEventObject& aEvent);
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessible( const SdrObject* pObj );
+
+ accessibility::AccessibleShapeTreeInfo maTreeInfo;
+
+ /// Reference to the parent object.
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> mxParent;
+
+ /** Description of this object. This is not a constant because it can
+ be set from the outside.
+ */
+ ::rtl::OUString msDescription;
+
+ /** Name of this object.
+ */
+ ::rtl::OUString msName;
+
+ /// map of accessible shapes
+ struct SdrObjectCompareLess
+ {
+ bool operator()(const SdrObject* p1, const SdrObject* p2) const
+ {
+ return p1 < p2;
+ }
+ };
+ typedef ::std::map< const SdrObject*, ::accessibility::AccessibleShape*, SdrObjectCompareLess > ShapesMapType;
+ ShapesMapType mxShapes;
+
+ GraphCtrl* mpControl;
+
+ SdrModel* mpModel;
+ SdrPage* mpPage;
+ SdrView* mpView;
+
+ /// client id in the AccessibleEventNotifier queue
+ sal_uInt32 mnClientId;
+
+ sal_Bool mbDisposed;
+};
+
+#endif
+
diff --git a/svx/source/inc/charmapacc.hxx b/svx/source/inc/charmapacc.hxx
new file mode 100644
index 000000000000..5bd5714b8039
--- /dev/null
+++ b/svx/source/inc/charmapacc.hxx
@@ -0,0 +1,278 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <vos/mutex.hxx>
+#include <tools/list.hxx>
+#include <tools/color.hxx>
+#include <tools/string.hxx>
+#ifndef _IMAGE_HXX
+#include <vcl/image.hxx>
+#endif
+#include <rtl/uuid.h>
+#include <comphelper/accessibleselectionhelper.hxx>
+#include <com/sun/star/accessibility/XAccessibleTable.hpp>
+
+#include <vector>
+class SvxShowCharSet;
+
+namespace svx
+{
+ typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessible
+ > OAccessibleHelper_Base_2;
+
+ class SvxShowCharSetAcc;
+ /** The class SvxShowCharSetVirtualAcc is used as a virtual class which contains the table and the scrollbar.
+ In the vcl control, the table and the scrollbar exists in one class. This is not feasible for the accessibility api.
+ */
+ class SvxShowCharSetVirtualAcc : public ::comphelper::OAccessibleComponentHelper,
+ public OAccessibleHelper_Base_2
+ {
+ SvxShowCharSet* mpParent; // the vcl control
+ SvxShowCharSetAcc* m_pTable; // the table, which holds the characters shown by the vcl control
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xAcc; // the ref to the table
+ protected:
+ virtual ~SvxShowCharSetVirtualAcc();
+
+ virtual void SAL_CALL disposing();
+
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException);
+ public:
+ SvxShowCharSetVirtualAcc( SvxShowCharSet* pParent );
+
+ // XInterface
+ DECLARE_XINTERFACE( )
+ DECLARE_XTYPEPROVIDER( )
+
+ // XAccessibleComponent
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ //OAccessibleContextHelper
+ // XAccessibleContext - still waiting to be overwritten
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException) { return this; }
+ virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+
+
+ // call the fireEvent method from the table when it exists.
+ void SAL_CALL fireEvent(
+ const sal_Int16 _nEventId,
+ const ::com::sun::star::uno::Any& _rOldValue,
+ const ::com::sun::star::uno::Any& _rNewValue
+ );
+
+ // simple access methods
+ inline SvxShowCharSetAcc* getTable() const { return m_pTable; }
+ inline SvxShowCharSet* getCharSetControl() const { return mpParent; }
+ };
+
+
+ class SvxShowCharSetItemAcc;
+ // ----------------
+ // - SvxShowCharSetItem -
+ // ----------------
+ /** Simple struct to hold some information about the single items of the table.
+ */
+ struct SvxShowCharSetItem
+ {
+ SvxShowCharSet& mrParent;
+ sal_uInt16 mnId;
+ XubString maText;
+ Rectangle maRect;
+ SvxShowCharSetItemAcc* m_pItem;
+ SvxShowCharSetAcc* m_pParent;
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xAcc;
+
+ SvxShowCharSetItem( SvxShowCharSet& rParent,SvxShowCharSetAcc* _pParent,sal_uInt16 _nPos );
+ ~SvxShowCharSetItem();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetAccessible();
+ void ClearAccessible();
+ };
+
+ // -----------------------------------------------------------------------------
+
+ typedef ::cppu::ImplHelper2 < ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleTable
+ > OAccessibleHelper_Base;
+ // ---------------
+ // - SvxShowCharSetAcc -
+ // ---------------
+ /** The table implemtentation of the vcl control.
+ */
+
+ class SvxShowCharSetAcc : public ::comphelper::OAccessibleSelectionHelper,
+ public OAccessibleHelper_Base
+ {
+ ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > m_aChildren;
+ SvxShowCharSetVirtualAcc* m_pParent; // the virtual parent
+ protected:
+ virtual void SAL_CALL disposing();
+ public:
+ SvxShowCharSetAcc( SvxShowCharSetVirtualAcc* _pParent );
+
+ DECLARE_XINTERFACE( )
+ DECLARE_XTYPEPROVIDER( )
+
+ // XAccessibleComponent
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+
+ //OAccessibleContextHelper
+ // XAccessibleContext - still waiting to be overwritten
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException) { return this; }
+ virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleTable
+ virtual sal_Int32 SAL_CALL getAccessibleRowCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleColumnCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleRowDescription( sal_Int32 nRow ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleColumnDescription( sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL getAccessibleRowHeaders( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL getAccessibleColumnHeaders( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleRows( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleColumns( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleCaption( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleSummary( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleRow( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+
+ inline void SAL_CALL fireEvent(
+ const sal_Int16 _nEventId,
+ const ::com::sun::star::uno::Any& _rOldValue,
+ const ::com::sun::star::uno::Any& _rNewValue
+ )
+ {
+ NotifyAccessibleEvent(_nEventId,_rOldValue,_rNewValue);
+ }
+ protected:
+
+ virtual ~SvxShowCharSetAcc();
+
+ // OCommonAccessibleSelection
+ // return if the specified child is visible => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
+ virtual sal_Bool
+ implIsSelected( sal_Int32 nAccessibleChildIndex )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
+ virtual void
+ implSelect( sal_Int32 nAccessibleChildIndex, sal_Bool bSelect )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // OCommonAccessibleComponent
+ /// implements the calculation of the bounding rectangle - still waiting to be overwritten
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException);
+ };
+
+ // ----------------
+ // - SvxShowCharSetItemAcc -
+ // ----------------
+ /** The child implementation of the table.
+ */
+ class SvxShowCharSetItemAcc : public ::comphelper::OAccessibleComponentHelper,
+ public OAccessibleHelper_Base_2
+ {
+ private:
+ SvxShowCharSetItem* mpParent;
+ protected:
+ virtual ~SvxShowCharSetItemAcc();
+
+ // OCommonAccessibleComponent
+ /// implements the calculation of the bounding rectangle - still waiting to be overwritten
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException);
+ public:
+
+ // XInterface
+ DECLARE_XINTERFACE( )
+ DECLARE_XTYPEPROVIDER( )
+
+ SvxShowCharSetItemAcc( SvxShowCharSetItem* pParent );
+
+ void ParentDestroyed();
+
+ // XAccessibleComponent
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+
+ //OAccessibleContextHelper
+ // XAccessibleContext - still waiting to be overwritten
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException) { return this; }
+
+ virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException) { return mpParent->m_pParent->getForeground(); }
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException) { return mpParent->m_pParent->getBackground(); }
+
+ inline void SAL_CALL fireEvent(
+ const sal_Int16 _nEventId,
+ const ::com::sun::star::uno::Any& _rOldValue,
+ const ::com::sun::star::uno::Any& _rNewValue
+ )
+ {
+ NotifyAccessibleEvent(_nEventId,_rOldValue,_rNewValue);
+ }
+ };
+}
+
+
diff --git a/svx/source/inc/clonelist.hxx b/svx/source/inc/clonelist.hxx
new file mode 100644
index 000000000000..424c592805ba
--- /dev/null
+++ b/svx/source/inc/clonelist.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CLONELIST_HXX_
+#define _CLONELIST_HXX_
+
+#include <sal/types.h>
+#include <tools/list.hxx>
+
+// predeclarations
+class SdrObject;
+
+// #i13033#
+// New mechanism to hold a ist of all original and cloned objects for later
+// re-creating the connections for contained connectors
+class CloneList
+{
+ List maOriginalList;
+ List maCloneList;
+
+public:
+ CloneList();
+ ~CloneList();
+
+ void AddPair(const SdrObject* pOriginal, SdrObject* pClone);
+ sal_uInt32 Count() const;
+
+ const SdrObject* GetOriginal(sal_uInt32 nIndex) const;
+ SdrObject* GetClone(sal_uInt32 nIndex) const;
+
+ void CopyConnections() const;
+};
+
+#endif // _CLONELIST_HXX_
diff --git a/svx/source/inc/datalistener.hxx b/svx/source/inc/datalistener.hxx
new file mode 100644
index 000000000000..1807aeb0a730
--- /dev/null
+++ b/svx/source/inc/datalistener.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_DATALISTENER_HXX
+#define _SVX_DATALISTENER_HXX
+
+#include <cppuhelper/implbase3.hxx>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <com/sun/star/frame/XFrameActionListener.hpp>
+#include <com/sun/star/xml/dom/events/XEventListener.hpp>
+
+//............................................................................
+namespace svxform
+{
+//............................................................................
+
+ class DataNavigatorWindow;
+
+ typedef cppu::WeakImplHelper3<
+ com::sun::star::container::XContainerListener,
+ com::sun::star::frame::XFrameActionListener,
+ com::sun::star::xml::dom::events::XEventListener > DataListener_t;
+
+ class DataListener : public DataListener_t
+ {
+ private:
+ DataNavigatorWindow* m_pNaviWin;
+
+ public:
+ DataListener( DataNavigatorWindow* pNaviWin );
+
+ protected:
+ ~DataListener();
+
+ public:
+ // XContainerListener
+ virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XFrameActionListener
+ virtual void SAL_CALL frameAction( const ::com::sun::star::frame::FrameActionEvent& Action ) throw (::com::sun::star::uno::RuntimeException);
+
+ // xml::dom::events::XEventListener
+ virtual void SAL_CALL handleEvent( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::dom::events::XEvent >& evt ) throw (::com::sun::star::uno::RuntimeException);
+
+ // lang::XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+ };
+
+//............................................................................
+} // namespace svxform
+//............................................................................
+
+#endif // #ifndef _SVX_DATALISTENER_HXX
+
diff --git a/svx/source/inc/datanavi.hrc b/svx/source/inc/datanavi.hrc
new file mode 100644
index 000000000000..a77485db399a
--- /dev/null
+++ b/svx/source/inc/datanavi.hrc
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_DATANAVI_HRC
+#define _SVX_DATANAVI_HRC
+
+// global
+#define FL_DATANAV_BTN 100
+#define BTN_DATANAV_OK 101
+#define BTN_DATANAV_ESC 102
+#define BTN_DATANAV_HELP 103
+
+// class XFormsInstancePage
+// Controls
+#define TB_ITEMS 10
+#define LB_ITEMS 11
+// Menu items
+#define MID_INSERT_CONTROL 100
+// ToolBox items
+#define TBI_ITEM_ADD 10
+#define TBI_ITEM_ADD_ELEMENT 11
+#define TBI_ITEM_ADD_ATTRIBUTE 12
+#define TBI_ITEM_EDIT 13
+#define TBI_ITEM_REMOVE 14
+// ImageLists
+#define IL_TBX_BMPS 20
+#define IL_TBX_BMPS_HC 21
+// ImageIndexes
+#define IID_ITEM_ADD 1
+#define IID_ITEM_ADD_ELEMENT 2
+#define IID_ITEM_ADD_ATTRIBUTE 3
+#define IID_ITEM_EDIT 4
+#define IID_ITEM_REMOVE 5
+
+// class DataNavigatorWindow
+// Controls
+#define LB_MODELS 10
+#define MB_MODELS 11
+#define TC_ITEMS 12
+#define MB_INSTANCES 13
+// MenuItems
+#define MID_MODELS_ADD 10
+#define MID_MODELS_EDIT 11
+#define MID_MODELS_REMOVE 12
+#define MID_INSTANCES_ADD 20
+#define MID_INSTANCES_EDIT 21
+#define MID_INSTANCES_REMOVE 22
+#define MID_SHOW_DETAILS 30
+// TabPage Ids
+#define TID_SUBMISSION 10
+#define TID_BINDINGS 11
+#define TID_INSTANCE 12
+// ImageLists
+#define IL_ITEM_BMPS 30
+#define IL_ITEM_BMPS_HC 31
+// ImageIndexes
+#define IID_GROUP_CLOSED 1
+#define IID_GROUP_OPEN 2
+#define IID_ELEMENT 3
+#define IID_ATTRIBUTE 4
+#define IID_TEXT 5
+#define IID_OTHER 6
+
+// class AddDataItemDialog
+#define FL_ITEM 10
+#define FT_NAME 11
+#define ED_NAME 12
+#define FT_DEFAULT 13
+#define ED_DEFAULT 14
+#define PB_DEFAULT 15
+#define FL_SETTINGS 16
+#define FT_DATATYPE 17
+#define LB_DATATYPE 18
+#define CB_REQUIRED 19
+#define PB_REQUIRED 20
+#define CB_RELEVANT 21
+#define PB_RELEVANT 22
+#define CB_CONSTRAINT 23
+#define PB_CONSTRAINT 24
+#define CB_READONLY 25
+#define PB_READONLY 26
+#define CB_CALCULATE 27
+#define PB_CALCULATE 28
+
+#define STR_FIXEDLINE_ELEMENT 10
+#define STR_FIXEDLINE_ATTRIBUTE 11
+#define STR_FIXEDLINE_BINDING 12
+#define STR_FIXEDTEXT_BINDING 13
+
+// class AddConditionDialog
+#define FT_CONDITION 10
+#define ED_CONDITION 11
+#define FT_RESULT 12
+#define FT_RESULT_PREVIEW 13
+#define PB_EDIT_NAMESPACES 14
+
+// class NamespaceItemDialog
+#define FT_NAMESPACES 10
+#define LB_NAMESPACES 11
+#define PB_ADD_NAMESPACE 12
+#define PB_EDIT_NAMESPACE 13
+#define PB_DELETE_NAMESPACE 14
+
+#define STR_HEADER_PREFIX 10
+#define STR_HEADER_URL 11
+
+// class ManageNamespaceDialog
+#define FT_PREFIX 10
+#define ED_PREFIX 11
+#define FT_URL 12
+#define ED_URL 13
+
+#define STR_EDIT_TEXT 10
+
+// class AddSubmissionDialog
+#define FL_SUBMISSION 10
+#define FT_SUBMIT_NAME 11
+#define ED_SUBMIT_NAME 12
+#define FT_SUBMIT_ACTION 13
+#define ED_SUBMIT_ACTION 14
+#define FT_SUBMIT_METHOD 15
+#define LB_SUBMIT_METHOD 16
+#define FT_SUBMIT_REF 17
+#define ED_SUBMIT_REF 18
+#define PB_SUBMIT_REF 19
+#define FT_SUBMIT_BIND 20
+#define LB_SUBMIT_BIND 21
+#define FT_SUBMIT_REPLACE 22
+#define LB_SUBMIT_REPLACE 23
+
+#define STR_METHOD_POST 10
+#define STR_METHOD_PUT 11
+#define STR_METHOD_GET 12
+#define STR_REPLACE_NONE 13
+#define STR_REPLACE_INST 14
+#define STR_REPLACE_DOC 15
+
+// class AddModelDialog
+#define FL_MODEL 10
+#define FT_MODEL_NAME 11
+#define ED_MODEL_NAME 12
+
+// class AddInstanceDialog
+#define FL_INSTANCE 10
+#define FT_INST_NAME 11
+#define ED_INST_NAME 12
+#define FT_INST_URL 13
+#define ED_INST_URL 14
+#define PB_FILEPICKER 15
+#define CB_INST_LINKINST 16
+
+// class AddModelDialog
+#define CB_MODIFIES_DOCUMENT 1
+
+#endif //_SVX_DATANAVI_HRC
+
diff --git a/svx/source/inc/datanavi.hxx b/svx/source/inc/datanavi.hxx
new file mode 100644
index 000000000000..a8bfad89090b
--- /dev/null
+++ b/svx/source/inc/datanavi.hxx
@@ -0,0 +1,601 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_DATANAVI_HXX
+#define _SVX_DATANAVI_HXX
+
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/menubtn.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/tabctrl.hxx>
+#include <vcl/tabpage.hxx>
+#include <vcl/toolbox.hxx>
+#include <svtools/inettbc.hxx>
+#include <svtools/svmedit.hxx>
+#include <svtools/svtreebx.hxx>
+#include <sfx2/dockwin.hxx>
+#include <sfx2/ctrlitem.hxx>
+#include <svx/simptabl.hxx>
+#include <rtl/ref.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XContainer.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/xforms/XFormsUIHelper1.hpp>
+#include <com/sun/star/xforms/XModel.hpp>
+#include <com/sun/star/xforms/XSubmission.hpp>
+#include <com/sun/star/xml/dom/XNode.hpp>
+#include <com/sun/star/xml/dom/events/XEventTarget.hpp>
+
+#include "datalistener.hxx"
+#include <vector>
+
+// forward ---------------------------------------------------------------
+
+class FmFormShell;
+
+//========================================================================
+//............................................................................
+namespace svxform
+{
+//............................................................................
+
+ enum DataGroupType
+ {
+ DGTUnknown = 0,
+ DGTInstance,
+ DGTSubmission,
+ DGTBinding
+ };
+
+ enum DataItemType
+ {
+ DITNone = 0,
+ DITText,
+ DITAttribute,
+ DITElement,
+ DITBinding
+ };
+
+ struct ItemNode;
+ class XFormsPage;
+ class DataNavigatorWindow;
+ class AddInstanceDialog;
+
+ typedef ::com::sun::star::uno::Reference<
+ ::com::sun::star::xforms::XFormsUIHelper1 > XFormsUIHelper1_ref;
+ typedef ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XNode > XNode_ref;
+ typedef ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > XPropertySet_ref;
+ typedef ::com::sun::star::uno::Reference<
+ ::com::sun::star::xforms::XModel > XModel_ref;
+ typedef ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XContainer > XContainer_ref;
+ typedef ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameContainer > XNameContainer_ref;
+ typedef ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XFrame > XFrame_ref;
+ typedef ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > XFrameModel_ref;
+ typedef ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::events::XEventTarget > XEventTarget_ref;
+ typedef ::com::sun::star::uno::Reference<
+ ::com::sun::star::xforms::XSubmission > XSubmission_ref;
+
+ typedef ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue > PropertyValue_seq;
+
+ typedef std::vector< XContainer_ref > ContainerList;
+ typedef std::vector< XEventTarget_ref > EventTargetList;
+
+ //========================================================================
+ class DataTreeListBox : public SvTreeListBox
+ {
+ private:
+ XFormsPage* m_pXFormsPage;
+ DataGroupType m_eGroup;
+
+ protected:
+ using SvTreeListBox::ExecuteDrop;
+
+ public:
+ DataTreeListBox( XFormsPage* pPage, DataGroupType _eGroup, const ResId& rResId );
+ ~DataTreeListBox();
+
+ virtual PopupMenu* CreateContextMenu( void );
+ virtual void ExcecuteContextMenuAction( sal_uInt16 _nSelectedPopupEntry );
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+
+ void DeleteAndClear();
+ void RemoveEntry( SvLBoxEntry* _pEntry );
+ };
+
+ //========================================================================
+ class XFormsPage : public TabPage
+ {
+ private:
+ ToolBox m_aToolBox;
+ DataTreeListBox m_aItemList;
+
+ XFormsUIHelper1_ref m_xUIHelper;
+
+ DataNavigatorWindow* m_pNaviWin;
+ bool m_bHasModel;
+ DataGroupType m_eGroup;
+ ImageList m_TbxImageList;
+ ImageList m_TbxHCImageList;
+ // these strings are not valid on the Submission and Binding Page
+ // mb: furthermore these are properties of an instance, thus
+ // it would be much better to get/set them through the UIHelper
+ // interface.
+ String m_sInstanceName;
+ String m_sInstanceURL;
+ bool m_bLinkOnce;
+
+ DECL_LINK( TbxSelectHdl, ToolBox * );
+ DECL_LINK( ItemSelectHdl, DataTreeListBox * );
+
+ void AddChildren( SvLBoxEntry* _pParent,
+ const ImageList& _rImgLst,
+ const XNode_ref& _xNode );
+ bool DoToolBoxAction( sal_uInt16 _nToolBoxID );
+ SvLBoxEntry* AddEntry( ItemNode* _pNewNode, bool _bIsElement );
+ SvLBoxEntry* AddEntry( const XPropertySet_ref& _rPropSet );
+ void EditEntry( const XPropertySet_ref& _rPropSet );
+ bool RemoveEntry();
+
+ protected:
+ virtual long Notify( NotifyEvent& rNEvt );
+
+ public:
+ XFormsPage( Window* pParent, DataNavigatorWindow* _pNaviWin, DataGroupType _eGroup );
+ ~XFormsPage();
+
+ virtual void Resize();
+
+ inline bool HasModel() const { return m_bHasModel; }
+ String SetModel( const XModel_ref& _xModel, sal_uInt16 _nPagePos );
+ void ClearModel();
+ String LoadInstance( const PropertyValue_seq& _xPropSeq,
+ const ImageList& _rImgLst );
+
+ bool DoMenuAction( sal_uInt16 _nMenuID );
+ void EnableMenuItems( Menu* _pMenu );
+
+ inline SvLBoxEntry* GetSelectedItem() const { return m_aItemList.FirstSelected(); }
+ inline const String& GetInstanceName() const { return m_sInstanceName; }
+ inline const String& GetInstanceURL() const { return m_sInstanceURL; }
+ inline bool GetLinkOnce() const { return m_bLinkOnce; }
+ inline void SetInstanceName( const String &name ) { m_sInstanceName=name; }
+ inline void SetInstanceURL( const String &url ) { m_sInstanceURL=url; }
+ inline void SetLinkOnce( bool bLinkOnce ) { m_bLinkOnce=bLinkOnce; }
+
+ typedef com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> XPropertySet_t;
+ typedef com::sun::star::uno::Reference<com::sun::star::xml::dom::XNode> XNode_t;
+
+ inline XPropertySet_t GetBindingForNode( const XNode_t &xNode ) { return m_xUIHelper->getBindingForNode(xNode,true); }
+ inline String GetServiceNameForNode( const XNode_t &xNode ) { return m_xUIHelper->getDefaultServiceNameForNode(xNode); }
+ inline XFormsUIHelper1_ref GetXFormsHelper( void ) const { return m_xUIHelper; }
+ };
+
+ //========================================================================
+
+ typedef std::vector< XFormsPage* > PageList;
+ typedef ::rtl::Reference < DataListener > DataListener_ref;
+
+ class DataNavigatorWindow : public Window
+ {
+ private:
+
+ ListBox m_aModelsBox;
+ MenuButton m_aModelBtn;
+ TabControl m_aTabCtrl;
+ MenuButton m_aInstanceBtn;
+
+ XFormsPage* m_pInstPage;
+ XFormsPage* m_pSubmissionPage;
+ XFormsPage* m_pBindingPage;
+
+ long m_nMinWidth;
+ long m_nMinHeight;
+ long m_nBorderHeight;
+ sal_uInt16 m_nLastSelectedPos;
+ bool m_bShowDetails;
+ bool m_bIsNotifyDisabled;
+ Size m_a2Size;
+ Size m_a3Size;
+ ImageList m_aItemImageList;
+ ImageList m_aItemHCImageList;
+ PageList m_aPageList;
+ ContainerList m_aContainerList;
+ EventTargetList m_aEventTargetList;
+ Timer m_aUpdateTimer;
+
+ DataListener_ref m_xDataListener;
+ XNameContainer_ref m_xDataContainer;
+ XFrame_ref m_xFrame;
+ XFrameModel_ref m_xFrameModel;
+
+ DECL_LINK( ModelSelectHdl, ListBox * );
+ DECL_LINK( MenuSelectHdl, MenuButton * );
+ DECL_LINK( MenuActivateHdl, MenuButton * );
+ DECL_LINK( ActivatePageHdl, TabControl* );
+ DECL_LINK( UpdateHdl, Timer* );
+
+ XFormsPage* GetCurrentPage( sal_uInt16& rCurId );
+ void LoadModels();
+ void SetPageModel();
+ void ClearAllPageModels( bool bClearPages );
+ void InitPages();
+ void CreateInstancePage( const PropertyValue_seq& _xPropSeq );
+ bool HasFirstInstancePage() const;
+ sal_uInt16 GetNewPageId() const;
+
+ protected:
+ virtual void Resize();
+
+ public:
+ DataNavigatorWindow( Window* pParent, SfxBindings* pBindings );
+ ~DataNavigatorWindow();
+
+ void SetDocModified();
+ void NotifyChanges( bool _bLoadAll = false );
+ void AddContainerBroadcaster( const XContainer_ref& xContainer );
+ void AddEventBroadcaster( const XEventTarget_ref& xTarget );
+ void RemoveBroadcaster();
+
+ inline const ImageList& GetItemImageList() const { return m_aItemImageList; }
+ inline const ImageList& GetItemHCImageList() const { return m_aItemHCImageList; }
+ inline bool IsShowDetails() const { return m_bShowDetails; }
+ inline void DisableNotify( bool _bDisable ) { m_bIsNotifyDisabled = _bDisable; }
+ };
+
+ //========================================================================
+ class DataNavigator : public SfxDockingWindow, public SfxControllerItem
+ {
+ private:
+ DataNavigatorWindow m_aDataWin;
+
+ protected:
+ virtual void Resize();
+ virtual sal_Bool Close();
+ virtual void GetFocus();
+ virtual Size CalcDockingSize( SfxChildAlignment );
+ virtual SfxChildAlignment CheckAlignment( SfxChildAlignment, SfxChildAlignment );
+
+ public:
+ DataNavigator( SfxBindings* pBindings, SfxChildWindow* pMgr, Window* pParent );
+ virtual ~DataNavigator();
+
+ using Window::Update;
+ using SfxDockingWindow::StateChanged;
+
+ void Update( FmFormShell* pFormShell );
+ void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ };
+
+ //========================================================================
+ class SVX_DLLPUBLIC DataNavigatorManager : public SfxChildWindow
+ {
+ public:
+ SVX_DLLPRIVATE DataNavigatorManager( Window* pParent, sal_uInt16 nId,
+ SfxBindings* pBindings, SfxChildWinInfo* pInfo );
+ SFX_DECL_CHILDWINDOW( DataNavigatorManager );
+ };
+
+ //========================================================================
+ class AddDataItemDialog : public ModalDialog
+ {
+ private:
+
+ FixedLine m_aItemFL;
+ FixedText m_aNameFT;
+ Edit m_aNameED;
+ FixedText m_aDefaultFT;
+ Edit m_aDefaultED;
+ PushButton m_aDefaultBtn;
+
+ FixedLine m_aSettingsFL;
+ FixedText m_aDataTypeFT;
+ ListBox m_aDataTypeLB;
+
+ CheckBox m_aRequiredCB;
+ PushButton m_aRequiredBtn;
+ CheckBox m_aRelevantCB;
+ PushButton m_aRelevantBtn;
+ CheckBox m_aConstraintCB;
+ PushButton m_aConstraintBtn;
+ CheckBox m_aReadonlyCB;
+ PushButton m_aReadonlyBtn;
+ CheckBox m_aCalculateCB;
+ PushButton m_aCalculateBtn;
+
+ FixedLine m_aButtonsFL;
+ OKButton m_aOKBtn;
+ CancelButton m_aEscBtn;
+ HelpButton m_aHelpBtn;
+
+ XFormsUIHelper1_ref m_xUIHelper;
+ XPropertySet_ref m_xBinding;
+ XPropertySet_ref m_xTempBinding;
+
+ ItemNode* m_pItemNode;
+ DataItemType m_eItemType;
+ String m_sFL_Element;
+ String m_sFL_Attribute;
+ String m_sFL_Binding;
+ String m_sFT_BindingExp;
+
+ DECL_LINK( CheckHdl, CheckBox * );
+ DECL_LINK( ConditionHdl, PushButton * );
+ DECL_LINK( OKHdl, OKButton * );
+
+ void InitDialog();
+ void InitFromNode();
+ void InitDataTypeBox();
+
+ public:
+ AddDataItemDialog(
+ Window* pParent, ItemNode* _pNode, const XFormsUIHelper1_ref& _rUIHelper );
+ ~AddDataItemDialog();
+
+ void InitText( DataItemType _eType );
+ };
+
+ //========================================================================
+ class AddConditionDialog : public ModalDialog
+ {
+ private:
+ FixedText m_aConditionFT;
+ MultiLineEdit m_aConditionED;
+ FixedText m_aResultFT;
+ FixedText m_aResultWin;
+ PushButton m_aEditNamespacesBtn;
+ FixedLine m_aButtonsFL;
+ OKButton m_aOKBtn;
+ CancelButton m_aEscBtn;
+ HelpButton m_aHelpBtn;
+
+ Timer m_aResultTimer;
+ ::rtl::OUString m_sPropertyName;
+
+ XFormsUIHelper1_ref m_xUIHelper;
+ XPropertySet_ref m_xBinding;
+
+ DECL_LINK( ModifyHdl, MultiLineEdit * );
+ DECL_LINK( ResultHdl, Timer * );
+ DECL_LINK( EditHdl, PushButton * );
+ DECL_LINK( OKHdl, OKButton * );
+
+ public:
+ AddConditionDialog( Window* pParent,
+ const ::rtl::OUString& _rPropertyName, const XPropertySet_ref& _rBinding );
+ ~AddConditionDialog();
+
+ inline XFormsUIHelper1_ref GetUIHelper() const { return m_xUIHelper; }
+ inline String GetCondition() const { return m_aConditionED.GetText(); }
+ inline void SetCondition( const String& _rCondition );
+ };
+
+ inline void AddConditionDialog::SetCondition( const String& _rCondition )
+ {
+ m_aConditionED.SetText( _rCondition );
+ m_aResultTimer.Start();
+ }
+
+ //========================================================================
+ class NamespaceItemDialog : public ModalDialog
+ {
+ private:
+ typedef std::vector< ::rtl::OUString > PrefixList;
+
+ FixedText m_aNamespacesFT;
+ SvxSimpleTable m_aNamespacesList;
+ PushButton m_aAddNamespaceBtn;
+ PushButton m_aEditNamespaceBtn;
+ PushButton m_aDeleteNamespaceBtn;
+ FixedLine m_aButtonsFL;
+ OKButton m_aOKBtn;
+ CancelButton m_aEscBtn;
+ HelpButton m_aHelpBtn;
+
+ AddConditionDialog* m_pConditionDlg;
+ PrefixList m_aRemovedList;
+
+ XNameContainer_ref& m_rNamespaces;
+
+ DECL_LINK( SelectHdl, SvxSimpleTable * );
+ DECL_LINK( ClickHdl, PushButton * );
+ DECL_LINK( OKHdl, OKButton * );
+
+ void LoadNamespaces();
+
+ public:
+ NamespaceItemDialog( AddConditionDialog* pParent, XNameContainer_ref& _rContainer );
+ ~NamespaceItemDialog();
+ };
+
+ //========================================================================
+ class ManageNamespaceDialog : public ModalDialog
+ {
+ private:
+ FixedText m_aPrefixFT;
+ Edit m_aPrefixED;
+ FixedText m_aUrlFT;
+ Edit m_aUrlED;
+ FixedLine m_aButtonsFL;
+ OKButton m_aOKBtn;
+ CancelButton m_aEscBtn;
+ HelpButton m_aHelpBtn;
+
+ AddConditionDialog* m_pConditionDlg;
+
+ DECL_LINK( OKHdl, OKButton * );
+
+ public:
+ ManageNamespaceDialog( Window* pParent, AddConditionDialog* _pCondDlg, bool _bIsEdit );
+ ~ManageNamespaceDialog();
+
+ inline void SetNamespace( const String& _rPrefix, const String& _rURL );
+ inline String GetPrefix() const { return m_aPrefixED.GetText(); }
+ inline String GetURL() const { return m_aUrlED.GetText(); }
+ };
+
+ void ManageNamespaceDialog::SetNamespace( const String& _rPrefix, const String& _rURL )
+ {
+ m_aPrefixED.SetText( _rPrefix );
+ m_aUrlED.SetText( _rURL );
+ }
+
+ //========================================================================
+ class AddSubmissionDialog : public ModalDialog
+ {
+ private:
+ FixedLine m_aSubmissionFL;
+ FixedText m_aNameFT;
+ Edit m_aNameED;
+ FixedText m_aActionFT;
+ Edit m_aActionED;
+ FixedText m_aMethodFT;
+ ListBox m_aMethodLB;
+ FixedText m_aRefFT;
+ Edit m_aRefED;
+ PushButton m_aRefBtn;
+ FixedText m_aBindFT;
+ ListBox m_aBindLB;
+ FixedText m_aReplaceFT;
+ ListBox m_aReplaceLB;
+
+ FixedLine m_aButtonsFL;
+ OKButton m_aOKBtn;
+ CancelButton m_aEscBtn;
+ HelpButton m_aHelpBtn;
+
+ ItemNode* m_pItemNode;
+
+ XFormsUIHelper1_ref m_xUIHelper;
+ XSubmission_ref m_xNewSubmission;
+ XPropertySet_ref m_xSubmission;
+ XPropertySet_ref m_xTempBinding;
+ XPropertySet_ref m_xCreatedBinding;
+
+ DECL_LINK( RefHdl, PushButton * );
+ DECL_LINK( OKHdl, OKButton * );
+
+ void FillAllBoxes();
+
+ public:
+ AddSubmissionDialog( Window* pParent, ItemNode* _pNode,
+ const XFormsUIHelper1_ref& _rUIHelper );
+ ~AddSubmissionDialog();
+
+ inline const XSubmission_ref& GetNewSubmission() const { return m_xNewSubmission; }
+ };
+
+ //========================================================================
+ class AddModelDialog : public ModalDialog
+ {
+ private:
+ FixedLine m_aModelFL;
+ FixedText m_aNameFT;
+ Edit m_aNameED;
+ CheckBox m_aModifyCB;
+ FixedLine m_aButtonsFL;
+ OKButton m_aOKBtn;
+ CancelButton m_aEscBtn;
+ HelpButton m_aHelpBtn;
+
+ public:
+ AddModelDialog( Window* pParent, bool _bEdit );
+ ~AddModelDialog();
+
+ inline String GetName() const { return m_aNameED.GetText(); }
+ inline void SetName( const String& _rName ) { m_aNameED.SetText( _rName );}
+
+ inline bool GetModifyDoc() const { return bool( m_aModifyCB.IsChecked() ); }
+ inline void SetModifyDoc( const bool _bModify ) { m_aModifyCB.Check( _bModify ); }
+ };
+
+ //========================================================================
+ class AddInstanceDialog : public ModalDialog
+ {
+ private:
+ FixedLine m_aInstanceFL;
+ FixedText m_aNameFT;
+ Edit m_aNameED;
+ FixedText m_aURLFT;
+ SvtURLBox m_aURLED;
+ PushButton m_aFilePickerBtn;
+ CheckBox m_aLinkInstanceCB;
+ FixedLine m_aButtonsFL;
+ OKButton m_aOKBtn;
+ CancelButton m_aEscBtn;
+ HelpButton m_aHelpBtn;
+
+ String m_sAllFilterName;
+
+ DECL_LINK( FilePickerHdl, PushButton * );
+
+ public:
+ AddInstanceDialog( Window* pParent, bool _bEdit );
+ ~AddInstanceDialog();
+
+ inline void SetRenameMode();
+ inline String GetName() const { return m_aNameED.GetText(); }
+ inline void SetName( const String& _rName ) { m_aNameED.SetText( _rName );}
+ inline String GetURL() const { return m_aURLED.GetText(); }
+ inline void SetURL( const String& _rURL ) { m_aURLED.SetText( _rURL );}
+ inline bool IsLinkInstance() const { return ( m_aLinkInstanceCB.IsChecked() != sal_False ); }
+ inline void SetLinkInstance( bool _bLink ) { m_aLinkInstanceCB.Check( _bLink != false ); }
+ };
+
+ inline void AddInstanceDialog::SetRenameMode()
+ {
+ m_aURLFT.Disable();
+ m_aURLED.Disable();
+ m_aFilePickerBtn.Disable();
+ m_aLinkInstanceCB.Disable();
+ }
+
+ //========================================================================
+ class LinkedInstanceWarningBox : public MessBox
+ {
+ public:
+ LinkedInstanceWarningBox( Window* pParent );
+ };
+
+//............................................................................
+} // namespace svxform
+//............................................................................
+
+#endif // _SVX_DATANAVI_HXX
+
diff --git a/svx/source/inc/delayedevent.hxx b/svx/source/inc/delayedevent.hxx
new file mode 100644
index 000000000000..5dd531de8090
--- /dev/null
+++ b/svx/source/inc/delayedevent.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef SVX_DELAYEDLINK_HXX
+#define SVX_DELAYEDLINK_HXX
+
+#include <tools/link.hxx>
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ //====================================================================
+ //= DelayedEvent
+ //====================================================================
+ /** small class which encapsulates posting a Link instance as ApplicationUserEvent
+
+ No thread safety at all here, just a little saving of code to type multiple times
+ */
+ class DelayedEvent
+ {
+ public:
+ DelayedEvent( const Link& _rHandler )
+ :m_aHandler( _rHandler )
+ ,m_nEventId( 0 )
+ {
+ }
+
+ ~DelayedEvent()
+ {
+ CancelPendingCall();
+ }
+
+ /** calls the handler asynchronously
+
+ If there's already a call pending, this previous call is cancelled.
+ */
+ void Call( void* _pArg = NULL );
+
+ /** cancels a call which is currently pending
+
+ If no call is currently pending, then this is ignored.
+ */
+ void CancelPendingCall();
+
+ private:
+ Link m_aHandler;
+ sal_uLong m_nEventId;
+
+ private:
+ DECL_LINK( OnCall, void* );
+
+ private:
+ DelayedEvent(); // never implemented
+ DelayedEvent( const DelayedEvent& ); // never implemented
+ DelayedEvent& operator=( const DelayedEvent& ); // never implemented
+ };
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
+#endif // SVX_DELAYEDLINK_HXX
diff --git a/svx/source/inc/docrecovery.hxx b/svx/source/inc/docrecovery.hxx
new file mode 100644
index 000000000000..ebe104058509
--- /dev/null
+++ b/svx/source/inc/docrecovery.hxx
@@ -0,0 +1,973 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_DOCRECOVERY_HXX
+#define _SVX_DOCRECOVERY_HXX
+
+#include <vcl/tabpage.hxx>
+#ifndef _SV_TABDIALOG_HXX
+#include <vcl/tabdlg.hxx>
+#endif
+#include <vcl/dialog.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/fixed.hxx>
+#include <svtools/svmedit2.hxx>
+#include <svtools/svtreebx.hxx>
+#include <svx/simptabl.hxx>
+
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+
+//===============================================
+// const
+
+#define RECOVERY_CMDPART_PROTOCOL ::rtl::OUString::createFromAscii("vnd.sun.star.autorecovery:")
+
+#define RECOVERY_CMDPART_DO_PREPARE_EMERGENCY_SAVE ::rtl::OUString::createFromAscii("/doPrepareEmergencySave" )
+#define RECOVERY_CMDPART_DO_EMERGENCY_SAVE ::rtl::OUString::createFromAscii("/doEmergencySave" )
+#define RECOVERY_CMDPART_DO_RECOVERY ::rtl::OUString::createFromAscii("/doAutoRecovery" )
+#define RECOVERY_CMDPART_DO_CRASHREPORT ::rtl::OUString::createFromAscii("/doCrashReport" )
+#define RECOVERY_CMDPART_DO_ENTRY_BACKUP ::rtl::OUString::createFromAscii("/doEntryBackup" )
+#define RECOVERY_CMDPART_DO_ENTRY_CLEANUP ::rtl::OUString::createFromAscii("/doEntryCleanUp" )
+
+#define RECOVERY_CMD_DO_PREPARE_EMERGENCY_SAVE ::rtl::OUString::createFromAscii("vnd.sun.star.autorecovery:/doPrepareEmergencySave")
+#define RECOVERY_CMD_DO_EMERGENCY_SAVE ::rtl::OUString::createFromAscii("vnd.sun.star.autorecovery:/doEmergencySave" )
+#define RECOVERY_CMD_DO_RECOVERY ::rtl::OUString::createFromAscii("vnd.sun.star.autorecovery:/doAutoRecovery" )
+#define RECOVERY_CMD_DO_CRASHREPORT ::rtl::OUString::createFromAscii("vnd.sun.star.autorecovery:/doCrashReport" )
+#define RECOVERY_CMD_DO_ENTRY_BACKUP ::rtl::OUString::createFromAscii("vnd.sun.star.autorecovery:/doEntryBackup" )
+#define RECOVERY_CMD_DO_ENTRY_CLEANUP ::rtl::OUString::createFromAscii("vnd.sun.star.autorecovery:/doEntryCleanUp" )
+
+#define SERVICENAME_PROGRESSFACTORY ::rtl::OUString::createFromAscii("com.sun.star.task.StatusIndicatorFactory")
+#define SERVICENAME_URLTRANSFORMER ::rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )
+#define SERVICENAME_RECOVERYCORE ::rtl::OUString::createFromAscii("com.sun.star.frame.AutoRecovery" )
+#define SERVICENAME_FOLDERPICKER ::rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.FolderPicker" )
+#define SERVICENAME_DESKTOP ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop" )
+
+#define PROP_PARENTWINDOW ::rtl::OUString::createFromAscii("Window" )
+#define PROP_STATUSINDICATOR ::rtl::OUString::createFromAscii("StatusIndicator" )
+#define PROP_DISPATCHASYNCHRON ::rtl::OUString::createFromAscii("DispatchAsynchron")
+#define PROP_SAVEPATH ::rtl::OUString::createFromAscii("SavePath" )
+#define PROP_ENTRYID ::rtl::OUString::createFromAscii("EntryID" )
+#define PROP_ALLOWPARENTSHOW ::rtl::OUString::createFromAscii("AllowParentShow" )
+
+#define STATEPROP_ID ::rtl::OUString::createFromAscii("ID" )
+#define STATEPROP_STATE ::rtl::OUString::createFromAscii("DocumentState")
+#define STATEPROP_ORGURL ::rtl::OUString::createFromAscii("OriginalURL" )
+#define STATEPROP_TEMPURL ::rtl::OUString::createFromAscii("TempURL" )
+#define STATEPROP_FACTORYURL ::rtl::OUString::createFromAscii("FactoryURL" )
+#define STATEPROP_TEMPLATEURL ::rtl::OUString::createFromAscii("TemplateURL" )
+#define STATEPROP_TITLE ::rtl::OUString::createFromAscii("Title" )
+#define STATEPROP_MODULE ::rtl::OUString::createFromAscii("Module" )
+
+#define RECOVERY_OPERATIONSTATE_START ::rtl::OUString::createFromAscii("start" )
+#define RECOVERY_OPERATIONSTATE_STOP ::rtl::OUString::createFromAscii("stop" )
+#define RECOVERY_OPERATIONSTATE_UPDATE ::rtl::OUString::createFromAscii("update")
+
+#define DLG_RET_UNKNOWN -1
+#define DLG_RET_OK 1
+#define DLG_RET_CANCEL 0
+#define DLG_RET_BACK 100
+#define DLG_RET_OK_AUTOLUNCH 101
+
+//===============================================
+// namespace
+
+namespace svx{
+ namespace DocRecovery{
+
+#ifdef css
+# error "Who uses css? I need it as temp. namespace alias!"
+#else
+# define css ::com::sun::star
+#endif
+
+//===============================================
+enum EDocStates
+{
+ /* TEMP STATES */
+
+ /// default state, if a document was new created or loaded
+ E_UNKNOWN = 0,
+ /// modified against the original file
+ E_MODIFIED = 1,
+ /// an active document can be postponed to be saved later.
+ E_POSTPONED = 2,
+ /// was already handled during one AutoSave/Recovery session.
+ E_HANDLED = 4,
+ /** an action was started (saving/loading) ... Can be interesting later if the process may be was interrupted by an exception. */
+ E_TRY_SAVE = 8,
+ E_TRY_LOAD_BACKUP = 16,
+ E_TRY_LOAD_ORIGINAL = 32,
+
+ /* FINAL STATES */
+
+ /// the Auto/Emergency saved document isnt useable any longer
+ E_DAMAGED = 64,
+ /// the Auto/Emergency saved document isnt realy up-to-date (some changes can be missing)
+ E_INCOMPLETE = 128,
+ /// the Auto/Emergency saved document was processed successfully
+ E_SUCCEDED = 512
+};
+
+//===============================================
+enum ERecoveryState
+{
+ E_SUCCESSFULLY_RECOVERED,
+ E_ORIGINAL_DOCUMENT_RECOVERED,
+ E_RECOVERY_FAILED,
+ E_RECOVERY_IS_IN_PROGRESS,
+ E_NOT_RECOVERED_YET
+};
+
+//===============================================
+struct TURLInfo
+{
+ public:
+
+ /// unique ID, which is specified by the underlying autorecovery core!
+ sal_Int32 ID;
+
+ /// the full qualified document URL
+ ::rtl::OUString OrgURL;
+
+ /// the full qualified URL of the temp. file (if it's exists)
+ ::rtl::OUString TempURL;
+
+ /// a may be existing factory URL (e.g. for untitled documents)
+ ::rtl::OUString FactoryURL;
+
+ /// may be the document base on a template file !?
+ ::rtl::OUString TemplateURL;
+
+ /// the pure file name, without path, disc etcpp.
+ ::rtl::OUString DisplayName;
+
+ /// the application module, where this document was loaded
+ ::rtl::OUString Module;
+
+ /// state info as e.g. VALID, CORRUPTED, NON EXISTING ...
+ sal_Int32 DocState;
+
+ /// ui representation for DocState!
+ ERecoveryState RecoveryState;
+
+ /// standard icon
+ Image StandardImage;
+
+ /// high contrast icon
+ Image HCImage;
+
+ public:
+
+ TURLInfo()
+ : ID (-1 )
+ , DocState (E_UNKNOWN )
+ , RecoveryState(E_NOT_RECOVERED_YET)
+ {}
+};
+
+//===============================================
+typedef ::std::vector< TURLInfo > TURLList;
+
+//===============================================
+class IRecoveryUpdateListener
+{
+ public:
+
+ // inform listener about changed items, which should be refreshed
+ virtual void updateItems() = 0;
+
+ // inform listener about starting of the asynchronous recovery operation
+ virtual void start() = 0;
+
+ // inform listener about ending of the asynchronous recovery operation
+ virtual void end() = 0;
+
+ // TODO
+ virtual void stepNext(TURLInfo* pItem) = 0;
+};
+
+//===============================================
+class RecoveryCore : public ::cppu::WeakImplHelper1< css::frame::XStatusListener >
+{
+ //-------------------------------------------
+ // types, const
+ public:
+
+ //-------------------------------------------
+ // member
+ private:
+
+ /// TODO
+ css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
+
+ /// TODO
+ css::uno::Reference< css::frame::XDispatch > m_xRealCore;
+
+ /// TODO
+ css::uno::Reference< css::task::XStatusIndicator > m_xProgress;
+
+ /// TODO
+ TURLList m_lURLs;
+
+ /// TODO
+ IRecoveryUpdateListener* m_pListener;
+
+ /** @short knows the reason, why we listen on our internal m_xRealCore
+ member.
+
+ @descr Because we listen for different operations
+ on the core dispatch implementation, we must know,
+ which URL we have to use for deregistration!
+ */
+ sal_Bool m_bListenForSaving;
+
+ //-------------------------------------------
+ // native interface
+ public:
+
+ //---------------------------------------
+ /** @short TODO */
+ RecoveryCore(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
+ sal_Bool bUsedForSaving);
+
+ //---------------------------------------
+ /** @short TODO */
+ virtual ~RecoveryCore();
+
+ //---------------------------------------
+ /** @short TODO */
+ virtual css::uno::Reference< css::lang::XMultiServiceFactory > getSMGR();
+
+ //---------------------------------------
+ /** @short TODO */
+ virtual TURLList* getURLListAccess();
+
+ //---------------------------------------
+ /** @short TODO */
+ virtual sal_Bool existsBrokenTempEntries();
+ virtual sal_Bool existsNonRecoveredEntries();
+ static sal_Bool isBrokenTempEntry(const TURLInfo& rInfo);
+ virtual void saveBrokenTempEntries(const ::rtl::OUString& sSaveDir);
+ virtual void saveAllTempEntries(const ::rtl::OUString& sSaveDir);
+ virtual void forgetBrokenTempEntries();
+ virtual void forgetAllRecoveryEntries();
+ void forgetBrokenRecoveryEntries();
+
+ //---------------------------------------
+ /** @short TODO */
+ virtual void setProgressHandler(const css::uno::Reference< css::task::XStatusIndicator >& xProgress);
+
+ //---------------------------------------
+ /** @short TODO */
+ virtual void setUpdateListener(IRecoveryUpdateListener* pListener);
+
+ //---------------------------------------
+ /** @short TODO */
+ virtual void doEmergencySavePrepare();
+ virtual void doEmergencySave();
+ virtual void doRecovery();
+
+ //---------------------------------------
+ /** @short TODO */
+ static ERecoveryState mapDocState2RecoverState(sal_Int32 eDocState);
+
+ //-------------------------------------------
+ // uno interface
+ public:
+
+ // css.frame.XStatusListener
+ virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& aEvent)
+ throw(css::uno::RuntimeException);
+
+ // css.lang.XEventListener
+ virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent)
+ throw(css::uno::RuntimeException);
+
+ //-------------------------------------------
+ // helper
+ private:
+
+ //---------------------------------------
+ /** @short starts listening on the internal EmergencySave/AutoRecovery core.
+ */
+ void impl_startListening();
+
+ //---------------------------------------
+ /** @short stop listening on the internal EmergencySave/AutoRecovery core.
+ */
+ void impl_stopListening();
+
+ //---------------------------------------
+ /** @short TODO */
+ css::util::URL impl_getParsedURL(const ::rtl::OUString& sURL);
+};
+
+//===============================================
+class PluginProgressWindow : public Window
+{
+ private:
+
+ css::uno::Reference< css::lang::XComponent > m_xProgress;
+
+ public:
+
+ PluginProgressWindow( Window* pParent ,
+ const css::uno::Reference< css::lang::XComponent >& xProgress);
+ ~PluginProgressWindow();
+};
+
+class PluginProgress : public ::cppu::WeakImplHelper2< css::task::XStatusIndicator ,
+ css::lang::XComponent >
+{
+
+ //-------------------------------------------
+ // member
+ private:
+
+ /** @short TODO */
+ css::uno::Reference< css::task::XStatusIndicatorFactory > m_xProgressFactory;
+
+ css::uno::Reference< css::task::XStatusIndicator > m_xProgress;
+
+ PluginProgressWindow* m_pPlugProgressWindow;
+
+ //-------------------------------------------
+ // native interface
+ public:
+
+ //---------------------------------------
+ /** @short TODO */
+ PluginProgress( Window* pParent,
+ const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR );
+
+ //---------------------------------------
+ /** @short TODO */
+ virtual ~PluginProgress();
+
+ //---------------------------------------
+ /** @short TODO */
+ Window* getPlugWindow();
+
+ //-------------------------------------------
+ // uno interface
+ public:
+
+ //---------------------------------------
+ // XStatusIndicator
+ virtual void SAL_CALL start(const ::rtl::OUString& sText ,
+ sal_Int32 nRange)
+ throw(css::uno::RuntimeException);
+
+ virtual void SAL_CALL end()
+ throw(css::uno::RuntimeException);
+
+ virtual void SAL_CALL setText(const ::rtl::OUString& sText)
+ throw(css::uno::RuntimeException);
+
+ virtual void SAL_CALL setValue(sal_Int32 nValue)
+ throw(css::uno::RuntimeException);
+
+ virtual void SAL_CALL reset()
+ throw(css::uno::RuntimeException);
+
+ //---------------------------------------
+ // XComponent
+ virtual void SAL_CALL dispose()
+ throw(css::uno::RuntimeException);
+
+ virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener >& xListener)
+ throw(css::uno::RuntimeException);
+
+ virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener)
+ throw(css::uno::RuntimeException);
+};
+
+//===============================================
+class IExtendedTabPage : public TabPage
+{
+ //-------------------------------------------
+ // member
+ protected:
+
+ short m_nResult;
+
+ //-------------------------------------------
+ // interface
+ public:
+
+ IExtendedTabPage( Window* pParent, WinBits nStyle = 0 )
+ : TabPage( pParent, nStyle )
+ , m_nResult(DLG_RET_UNKNOWN)
+ {}
+
+ IExtendedTabPage( Window* pParent, const ResId& rResId )
+ : TabPage( pParent, rResId )
+ , m_nResult(DLG_RET_UNKNOWN)
+ {}
+
+ virtual ~IExtendedTabPage()
+ {}
+
+ virtual short execute() = 0;
+ virtual void setDefButton() = 0;
+};
+
+typedef ::std::vector< IExtendedTabPage* > TTabPageList;
+
+//===============================================
+class TabDialog4Recovery : public TabDialog
+{
+ //-------------------------------------------
+ // member
+ private:
+
+ TTabPageList m_lTabPages;
+ TTabPageList::iterator m_pActualPage;
+
+ //-------------------------------------------
+ // interface
+ public:
+
+ TabDialog4Recovery(Window* pParent);
+ virtual ~TabDialog4Recovery();
+
+ virtual void addTabPage(IExtendedTabPage* pPage);
+ virtual short Execute();
+};
+
+//===============================================
+class SaveDialog : public IExtendedTabPage
+{
+ //-------------------------------------------
+ // member
+ private:
+
+ Window m_aTitleWin;
+ FixedText m_aTitleFT;
+ FixedLine m_aTitleFL;
+ FixedText m_aDescrFT;
+ FixedText m_aFileListFT;
+ ListBox m_aFileListLB;
+ FixedLine m_aBottomFL;
+ OKButton m_aOkBtn;
+
+ RecoveryCore* m_pCore;
+
+ //-------------------------------------------
+ // interface
+ public:
+
+ //---------------------------------------
+ /** @short create all child controls of this dialog.
+
+ @descr The dialog isnt shown nor it starts any
+ action by itself!
+
+ @param pParent
+ can point to a parent window.
+ If its set to 0, the defmodal-dialog-parent
+ is used automaticly.
+
+ @param pCore
+ provides access to the recovery core service
+ and the current list of open documents,
+ which should be shown inside this dialog.
+ */
+ SaveDialog(Window* pParent,
+ RecoveryCore* pCore );
+
+ //---------------------------------------
+ /** @short free all controls and used memory. */
+ virtual ~SaveDialog();
+
+ //---------------------------------------
+ /** @short TODO*/
+ virtual short execute();
+
+ //---------------------------------------
+ /** @short TODO*/
+ virtual void setDefButton();
+
+ DECL_LINK(OKButtonHdl, void*);
+};
+
+//===============================================
+class SaveProgressDialog : public ModalDialog
+ , public IRecoveryUpdateListener
+{
+ //-------------------------------------------
+ // member
+ private:
+
+ FixedText m_aHintFT;
+ FixedText m_aProgrFT;
+ String m_aProgrBaseTxt;
+ Window m_aProgrParent;
+
+ // @short TODO
+ RecoveryCore* m_pCore;
+
+ // @short TODO
+ css::uno::Reference< css::task::XStatusIndicator > m_xProgress;
+
+ //-------------------------------------------
+ // interface
+ public:
+
+ //---------------------------------------
+ /** @short create all child controls of this dialog.
+
+ @descr The dialog isnt shown nor it starts any
+ action by itself!
+
+ @param pParent
+ can point to a parent window.
+ If its set to 0, the defmodal-dialog-parent
+ is used automaticly.
+
+ @param pCore
+ used to start emegrency save.
+ */
+ SaveProgressDialog(Window* pParent,
+ RecoveryCore* pCore );
+
+ //---------------------------------------
+ /** @short free all controls and used memory. */
+ virtual ~SaveProgressDialog();
+
+ //---------------------------------------
+ /** @short start the emergency save operation. */
+ virtual short Execute();
+
+ // IRecoveryUpdateListener
+ virtual void updateItems();
+ virtual void stepNext(TURLInfo* pItem);
+ virtual void start();
+ virtual void end();
+};
+
+//===============================================
+class RecovDocListEntry : public SvLBoxString
+{
+ //-------------------------------------------
+ // interface
+ private:
+
+ //-------------------------------------------
+ // interface
+ public:
+
+ //---------------------------------------
+ /** @short TODO */
+ RecovDocListEntry( SvLBoxEntry* pEntry,
+ sal_uInt16 nFlags,
+ const String& sText );
+
+ //---------------------------------------
+ /** @short TODO */
+ virtual void Paint(const Point& aPos ,
+ SvLBox& aDevice,
+ sal_uInt16 nFlags ,
+ SvLBoxEntry* pEntry );
+};
+
+//===============================================
+class RecovDocList : public SvxSimpleTable
+{
+ //-------------------------------------------
+ // member
+ public:
+
+ Image m_aGreenCheckImg;
+ Image m_aYellowCheckImg;
+ Image m_aRedCrossImg;
+ Image m_aGreenCheckImgHC;
+ Image m_aYellowCheckImgHC;
+ Image m_aRedCrossImgHC;
+
+ String m_aSuccessRecovStr;
+ String m_aOrigDocRecovStr;
+ String m_aRecovFailedStr;
+ String m_aRecovInProgrStr;
+ String m_aNotRecovYetStr;
+
+ //-------------------------------------------
+ // interface
+ public:
+
+ //---------------------------------------
+ /** @short TODO */
+ RecovDocList( Window* pParent,
+ const ResId& rResId );
+
+ //---------------------------------------
+ /** @short TODO */
+ virtual ~RecovDocList();
+
+ //---------------------------------------
+ /** @short TODO */
+ virtual void InitEntry( SvLBoxEntry* pEntry ,
+ const XubString& sText ,
+ const Image& aImage1,
+ const Image& aImage2,
+ SvLBoxButtonKind eButtonKind);
+};
+
+//===============================================
+class RecoveryDialog : public IExtendedTabPage
+ , public IRecoveryUpdateListener
+{
+ //-------------------------------------------
+ // member
+ private:
+ Window m_aTitleWin;
+ FixedText m_aTitleFT;
+ FixedLine m_aTitleFL;
+ FixedText m_aDescrFT;
+ FixedText m_aProgressFT;
+ Window m_aProgrParent;
+ FixedText m_aFileListFT;
+ RecovDocList m_aFileListLB;
+ FixedLine m_aBottomFL;
+ PushButton m_aNextBtn;
+ CancelButton m_aCancelBtn;
+ String m_aNextStr;
+ String m_aTitleRecoveryInProgress;
+ String m_aTitleRecoveryReport;
+ String m_aRecoveryOnlyFinish;
+ String m_aRecoveryOnlyFinishDescr;
+
+ PushButton* m_pDefButton;
+ RecoveryCore* m_pCore;
+ css::uno::Reference< css::task::XStatusIndicator > m_xProgress;
+ enum EInternalRecoveryState
+ {
+ E_RECOVERY_PREPARED, // dialog started ... recovery prepared
+ E_RECOVERY_IN_PROGRESS, // recovery core still in progress
+ E_RECOVERY_CORE_DONE, // recovery core finished it's task
+ E_RECOVERY_DONE, // user clicked "next" button
+ E_RECOVERY_CANCELED, // user clicked "cancel" button
+ E_RECOVERY_CANCELED_BEFORE, // user clicked "cancel" button before recovery was started
+ E_RECOVERY_CANCELED_AFTERWARDS, // user clicked "cancel" button after reovery was finished
+ E_RECOVERY_HANDLED // the recovery wizard page was shown already ... and will be shown now again ...
+ };
+ sal_Int32 m_eRecoveryState;
+ sal_Bool m_bWaitForUser;
+ sal_Bool m_bWaitForCore;
+ sal_Bool m_bUserDecideNext;
+ sal_Bool m_bWasRecoveryStarted;
+ sal_Bool m_bRecoveryOnly;
+
+ //-------------------------------------------
+ // member
+ public:
+
+ //---------------------------------------
+ /** @short TODO */
+ RecoveryDialog(Window* pParent,
+ RecoveryCore* pCore );
+
+ //---------------------------------------
+ /** @short TODO */
+ virtual ~RecoveryDialog();
+
+ //---------------------------------------
+ // IRecoveryUpdateListener
+ virtual void updateItems();
+ virtual void stepNext(TURLInfo* pItem);
+ virtual void start();
+ virtual void end();
+
+ //---------------------------------------
+ /** @short TODO */
+ virtual short execute();
+
+ //---------------------------------------
+ /** @short TODO*/
+ virtual void setDefButton();
+
+ //-------------------------------------------
+ // helper
+ private:
+
+ //---------------------------------------
+ /** @short TODO */
+ DECL_LINK(NextButtonHdl, void*);
+ DECL_LINK(CancelButtonHdl, void*);
+
+ //---------------------------------------
+ /** @short TODO */
+ void impl_refreshDocList();
+
+ //---------------------------------------
+ /** @short TODO */
+ String impl_getStatusString( const TURLInfo& rInfo ) const;
+};
+
+//===============================================
+class BrokenRecoveryDialog : public ModalDialog
+{
+ //-------------------------------------------
+ // member
+ private:
+ FixedText m_aDescrFT;
+ FixedText m_aFileListFT;
+ ListBox m_aFileListLB;
+ FixedText m_aSaveDirFT;
+ Edit m_aSaveDirED;
+ PushButton m_aSaveDirBtn;
+ FixedLine m_aBottomFL;
+ OKButton m_aOkBtn;
+ CancelButton m_aCancelBtn;
+
+ ::rtl::OUString m_sSavePath;
+ RecoveryCore* m_pCore;
+ sal_Bool m_bBeforeRecovery;
+ sal_Bool m_bExecutionNeeded;
+
+ //-------------------------------------------
+ // interface
+ public:
+
+ //---------------------------------------
+ /** @short TODO */
+ BrokenRecoveryDialog(Window* pParent ,
+ RecoveryCore* pCore ,
+ sal_Bool bBeforeRecovery);
+
+ //---------------------------------------
+ /** @short TODO */
+ virtual ~BrokenRecoveryDialog();
+
+ //---------------------------------------
+ /** @short TODO */
+ virtual sal_Bool isExecutionNeeded();
+
+ //---------------------------------------
+ /** @short TODO */
+ virtual ::rtl::OUString getSaveDirURL();
+
+ //-------------------------------------------
+ // helper
+ private:
+
+ //---------------------------------------
+ /** @short TODO */
+ void impl_refresh();
+
+ //---------------------------------------
+ /** @short TODO */
+ DECL_LINK(SaveButtonHdl, void*);
+
+ //---------------------------------------
+ /** @short TODO */
+ DECL_LINK(OkButtonHdl, void*);
+
+ //---------------------------------------
+ /** @short TODO */
+ DECL_LINK(CancelButtonHdl, void*);
+
+ //---------------------------------------
+ /** @short TODO */
+ void impl_askForSavePath();
+};
+
+
+
+ class ErrorRepWelcomeDialog : public IExtendedTabPage
+ {
+ private:
+ Window maTitleWin;
+ FixedText maTitleFT;
+ FixedLine maTitleFL;
+ FixedText maDescrFT;
+
+ FixedLine maBottomFL;
+ PushButton maPrevBtn;
+ OKButton maNextBtn;
+ CancelButton maCancelBtn;
+
+ DECL_LINK( PrevBtnHdl, void* );
+ DECL_LINK( NextBtnHdl, void* );
+ DECL_LINK( CancelBtnHdl, void* );
+ public:
+ ErrorRepWelcomeDialog( Window* _pParent, sal_Bool _bAllowBack = sal_True );
+ virtual ~ErrorRepWelcomeDialog();
+ /** @short TODO*/
+ virtual short execute();
+
+ //---------------------------------------
+ /** @short TODO*/
+ virtual void setDefButton();
+ };
+
+ struct ErrorRepParams
+ {
+ ErrorRepParams()
+#ifdef WNT
+ : miHTTPConnectionType( 0 )
+#else
+ : miHTTPConnectionType( 1 )
+#endif
+ , mbAllowContact( false )
+ {}
+
+ String maHTTPProxyServer;
+ String maHTTPProxyPort;
+ int miHTTPConnectionType;
+ bool mbAllowContact;
+ String maReturnAddress;
+ String maSubject;
+ String maBody;
+ };
+
+ class ErrorDescriptionEdit : public MultiLineEdit
+ {
+ private:
+ DECL_LINK( ModifyHdl, void* );
+
+ public:
+ ErrorDescriptionEdit( Window* pParent, const ResId& rResId );
+ virtual ~ErrorDescriptionEdit();
+ };
+
+ class ErrorRepSendDialog : public IExtendedTabPage
+ {
+ private:
+ Window maTitleWin;
+ FixedText maTitleFT;
+ FixedLine maTitleFL;
+ FixedText maDescrFT;
+
+ FixedText maDocTypeFT;
+ Edit maDocTypeED;
+ FixedText maUsingFT;
+ ErrorDescriptionEdit maUsingML;
+ PushButton maShowRepBtn;
+ PushButton maOptBtn;
+ CheckBox maContactCB;
+ FixedText maEMailAddrFT;
+ Edit maEMailAddrED;
+
+ FixedLine maBottomFL;
+ PushButton maPrevBtn;
+ OKButton maNextBtn;
+ CancelButton maCancelBtn;
+
+ ErrorRepParams maParams;
+
+ DECL_LINK( ShowRepBtnHdl, void* );
+ DECL_LINK( OptBtnHdl, void* );
+ DECL_LINK( ContactCBHdl, void* );
+ DECL_LINK( PrevBtnHdl, void* );
+ DECL_LINK( SendBtnHdl, void* );
+ DECL_LINK( CancelBtnHdl, void* );
+
+ void initControls();
+
+ public:
+ ErrorRepSendDialog( Window* _pParent );
+ virtual ~ErrorRepSendDialog();
+
+ String GetDocType( void ) const;
+ String GetUsing( void ) const;
+ bool IsContactAllowed( void ) const;
+ String GetEMailAddress( void ) const;
+
+ bool ReadParams();
+ bool SaveParams();
+ bool SendReport();
+
+ /** @short TODO*/
+ virtual short execute();
+
+ //---------------------------------------
+ /** @short TODO*/
+ virtual void setDefButton();
+ };
+
+ class ErrorRepOptionsDialog : public ModalDialog
+ {
+ private:
+ FixedLine maProxyFL;
+ RadioButton maSystemBtn;
+ RadioButton maDirectBtn;
+ RadioButton maManualBtn;
+ FixedText maProxyServerFT;
+ Edit maProxyServerEd;
+ FixedText maProxyPortFT;
+ Edit maProxyPortEd;
+ FixedText maDescriptionFT;
+ FixedLine maButtonsFL;
+ OKButton maOKBtn;
+ CancelButton maCancelBtn;
+
+ ErrorRepParams& mrParams;
+
+ DECL_LINK( CancelBtnHdl, void* );
+ DECL_LINK( OKBtnHdl, void * );
+ DECL_LINK( ManualBtnHdl, void * );
+
+ public:
+ ErrorRepOptionsDialog( Window* _pParent, ErrorRepParams& rParams );
+ virtual ~ErrorRepOptionsDialog();
+ };
+
+ class ErrorRepEdit : public ExtMultiLineEdit
+ {
+ public:
+ ErrorRepEdit( Window* pParent, const ResId& rResId );
+ virtual ~ErrorRepEdit();
+ };
+
+ class ErrorRepPreviewDialog : public ModalDialog
+ {
+ private:
+ ErrorRepEdit maContentML;
+ OKButton maOKBtn;
+
+ long mnMinHeight;
+
+ public:
+ ErrorRepPreviewDialog( Window* _pParent );
+ virtual ~ErrorRepPreviewDialog();
+
+ virtual void Resize();
+ };
+ } // namespace DocRecovery
+} // namespace svx
+
+#undef css
+
+#endif
diff --git a/svx/source/inc/filtnav.hxx b/svx/source/inc/filtnav.hxx
new file mode 100644
index 000000000000..df4e2b8559a6
--- /dev/null
+++ b/svx/source/inc/filtnav.hxx
@@ -0,0 +1,372 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FILTNAV_HXX
+#define _SVX_FILTNAV_HXX
+
+#include <com/sun/star/form/XForm.hpp>
+#include <com/sun/star/form/runtime/XFormController.hpp>
+#include <com/sun/star/form/runtime/XFilterController.hpp>
+#include <svl/lstner.hxx>
+#include <svl/brdcst.hxx>
+
+#include <vcl/window.hxx>
+#include <sfx2/childwin.hxx>
+#include <svl/poolitem.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dockwin.hxx>
+#include <sfx2/ctrlitem.hxx>
+#include <vcl/image.hxx>
+#include <svtools/svtreebx.hxx>
+
+#include <vcl/dialog.hxx>
+#include <vcl/group.hxx>
+#include <vcl/dockwin.hxx>
+#include "svx/fmtools.hxx"
+#include "fmexch.hxx"
+#include <connectivity/sqlparse.hxx>
+#include "fmexch.hxx"
+#include "sqlparserclient.hxx"
+
+class FmFormShell;
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+class FmFilterItem;
+class FmFilterItems;
+class FmParentData;
+class FmFilterAdapter;
+
+//========================================================================
+// data structure for the filter model
+//========================================================================
+class FmFilterData
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB;
+ FmParentData* m_pParent;
+ ::rtl::OUString m_aText;
+
+public:
+ TYPEINFO();
+ FmFilterData(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory,FmParentData* pParent = NULL, const ::rtl::OUString& rText = ::rtl::OUString())
+ :m_xORB( _rxFactory )
+ ,m_pParent( pParent )
+ ,m_aText( rText )
+ {}
+ virtual ~FmFilterData(){}
+
+ void SetText( const ::rtl::OUString& rText ){ m_aText = rText; }
+ ::rtl::OUString GetText() const { return m_aText; }
+ FmParentData* GetParent() const {return m_pParent;}
+
+ virtual Image GetImage( BmpColorMode _eMode = BMP_COLOR_NORMAL ) const;
+};
+
+//========================================================================
+class FmParentData : public FmFilterData
+{
+protected:
+ ::std::vector< FmFilterData* > m_aChildren;
+
+public:
+ TYPEINFO();
+ FmParentData(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory,FmParentData* pParent, const ::rtl::OUString& rText)
+ : FmFilterData(_rxFactory,pParent, rText)
+ {}
+ virtual ~FmParentData();
+
+ ::std::vector< FmFilterData* >& GetChildren() { return m_aChildren; }
+};
+
+//========================================================================
+// Item representing the forms and subforms
+class FmFormItem : public FmParentData
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > m_xController;
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFilterController > m_xFilterController;
+
+public:
+ TYPEINFO();
+
+ FmFormItem( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory,FmParentData* _pParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > & _xController,
+ const ::rtl::OUString& _rText)
+ :FmParentData( _rxFactory, _pParent, _rText )
+ ,m_xController( _xController )
+ ,m_xFilterController( _xController, ::com::sun::star::uno::UNO_QUERY_THROW )
+ {
+ }
+
+ inline const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >&
+ GetController() { return m_xController; }
+
+ inline const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFilterController >&
+ GetFilterController() { return m_xFilterController; }
+
+ virtual Image GetImage( BmpColorMode _eMode = BMP_COLOR_NORMAL ) const;
+};
+
+//========================================================================
+class FmFilterItems : public FmParentData
+{
+public:
+ TYPEINFO();
+ FmFilterItems(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory):FmParentData(_rxFactory,NULL, ::rtl::OUString()){}
+ FmFilterItems(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory,FmFormItem* pParent, const ::rtl::OUString& rText ):FmParentData(_rxFactory,pParent, rText){}
+
+ FmFilterItem* Find( const ::sal_Int32 _nFilterComponentIndex ) const;
+ virtual Image GetImage( BmpColorMode _eMode = BMP_COLOR_NORMAL ) const;
+};
+
+//========================================================================
+class FmFilterItem : public FmFilterData
+{
+ ::rtl::OUString m_aFieldName;
+ const sal_Int32 m_nComponentIndex;
+
+public:
+ TYPEINFO();
+ FmFilterItem(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory,
+ FmFilterItems* pParent,
+ const ::rtl::OUString& aFieldName,
+ const ::rtl::OUString& aCondition,
+ const sal_Int32 _nComponentIndex
+ );
+
+ const ::rtl::OUString& GetFieldName() const {return m_aFieldName;}
+ sal_Int32 GetComponentIndex() const { return m_nComponentIndex; }
+
+ virtual Image GetImage( BmpColorMode _eMode = BMP_COLOR_NORMAL ) const;
+};
+
+//========================================================================
+class FmFilterModel : public FmParentData
+ ,public SfxBroadcaster
+ ,public ::svxform::OSQLParserClient
+{
+ friend class FmFilterAdapter;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > m_xControllers;
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > m_xController;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB;
+ FmFilterAdapter* m_pAdapter;
+ FmFilterItems* m_pCurrentItems;
+
+public:
+ TYPEINFO();
+ FmFilterModel(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory);
+ virtual ~FmFilterModel();
+
+ void Update(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > & xControllers, const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > & xCurrent);
+ void Clear();
+ sal_Bool ValidateText(FmFilterItem* pItem, UniString& rText, UniString& rErrorMsg) const;
+ void Append(FmFilterItems* pItems, FmFilterItem* pFilterItem);
+ void SetTextForItem(FmFilterItem* pItem, const ::rtl::OUString& rText);
+
+ FmFormItem* GetCurrentForm() const {return m_pCurrentItems ? (FmFormItem*)m_pCurrentItems->GetParent() : NULL;}
+ FmFilterItems* GetCurrentItems() const {return m_pCurrentItems;}
+ void SetCurrentItems(FmFilterItems* pCurrent);
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const { return m_xORB; }
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > & GetControllers() const {return m_xControllers;}
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > & GetCurrentController() const {return m_xController;}
+ void SetCurrentController(const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > & xController);
+
+ void Remove(FmFilterData* pFilterItem);
+ void AppendFilterItems( FmFormItem& _rItem );
+ void EnsureEmptyFilterRows( FmParentData& _rItem );
+
+protected:
+ void Insert(const ::std::vector<FmFilterData*>::iterator& rPos, FmFilterData* pFilterItem);
+ void Remove( const ::std::vector<FmFilterData*>::iterator& rPos );
+ FmFormItem* Find(const ::std::vector<FmFilterData*>& rItems, const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > & xController) const;
+ FmFormItem* Find(const ::std::vector<FmFilterData*>& rItems, const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& xForm) const;
+ void Update(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > & xControllers, FmParentData* pParent);
+};
+
+//========================================================================
+//========================================================================
+class OFilterItemExchange : public OLocalExchange
+{
+ ::std::vector<FmFilterItem*> m_aDraggedEntries;
+ FmFormItem* m_pFormItem; // ensure that we drop on the same form
+
+public:
+ OFilterItemExchange();
+
+ static sal_uInt32 getFormatId( );
+ inline static sal_Bool hasFormat( const DataFlavorExVector& _rFormats );
+
+ const ::std::vector<FmFilterItem*>& getDraggedEntries() const { return m_aDraggedEntries; }
+ void setDraggedEntries(const ::std::vector<FmFilterItem*>& _rList) { m_aDraggedEntries = _rList; }
+ FmFormItem* getFormItem() const { return m_pFormItem; }
+
+ void setFormItem( FmFormItem* _pItem ) { m_pFormItem = _pItem; }
+ void addSelectedItem( FmFilterItem* _pItem) { m_aDraggedEntries.push_back(_pItem); }
+
+protected:
+ virtual void AddSupportedFormats();
+};
+
+inline sal_Bool OFilterItemExchange::hasFormat( const DataFlavorExVector& _rFormats )
+{
+ return OLocalExchange::hasFormat( _rFormats, getFormatId() );
+}
+
+//====================================================================
+//= OFilterExchangeHelper
+//====================================================================
+class OFilterExchangeHelper : public OLocalExchangeHelper
+{
+public:
+ OFilterExchangeHelper(Window* _pDragSource) : OLocalExchangeHelper(_pDragSource) { }
+
+ OFilterItemExchange* operator->() const { return static_cast<OFilterItemExchange*>(m_pTransferable); }
+
+protected:
+ virtual OLocalExchange* createExchange() const;
+};
+
+//========================================================================
+class FmFilterNavigator : public SvTreeListBox, public SfxListener
+{
+ enum DROP_ACTION{ DA_SCROLLUP, DA_SCROLLDOWN, DA_EXPANDNODE };
+
+ FmFilterModel* m_pModel;
+ SvLBoxEntry* m_pEditingCurrently;
+ OFilterExchangeHelper m_aControlExchange;
+
+
+ AutoTimer m_aDropActionTimer;
+ unsigned short m_aTimerCounter;
+ Point m_aTimerTriggered; // die Position, an der der DropTimer angeschaltet wurde
+ DROP_ACTION m_aDropActionType;
+
+public:
+ FmFilterNavigator( Window* pParent );
+ virtual ~FmFilterNavigator();
+
+ void UpdateContent(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > & xControllers,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > & xCurrent
+ );
+ const FmFilterModel* GetFilterModel() const {return m_pModel;}
+
+protected:
+ using Control::Notify;
+
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void Command( const CommandEvent& rEvt );
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+ virtual void InitEntry(SvLBoxEntry* pEntry, const XubString& rStr, const Image& rImg1, const Image& rImg2, SvLBoxButtonKind eButtonKind);
+ virtual sal_Bool Select( SvLBoxEntry* pEntry, sal_Bool bSelect=sal_True );
+ virtual sal_Bool EditingEntry( SvLBoxEntry* pEntry, Selection& rSelection );
+ virtual sal_Bool EditedEntry( SvLBoxEntry* pEntry, const XubString& rNewText );
+
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+
+ void DeleteSelection();
+ void Clear();
+ SvLBoxEntry* FindEntry(const FmFilterData* pItem) const;
+ void Insert(FmFilterData* pItem, sal_Int32 nPos);
+ void Remove(FmFilterData* pItem);
+
+ DECL_LINK(OnRemove, SvLBoxEntry*);
+ DECL_LINK(OnEdited, SvLBoxEntry*);
+ DECL_LINK(OnDropActionTimer, void*);
+
+private:
+ /** returns the first form item and the selected FilterItems in the vector
+ @param _rItemList
+ Is filled inside. <OUT/>
+ @return
+ The first form item.
+ */
+ FmFormItem* getSelectedFilterItems(::std::vector<FmFilterItem*>& _rItemList);
+ /* inserts the filter items into the tree model and creates new FilterItems if needed.
+ @param _rFilterList
+ The items which should be inserted.
+ @param _pTargetItems
+ The target where to insert the items.
+ @param _bCopy
+ If <TRUE/> the items will not be removed from the model, otherwise they will.
+ */
+ void insertFilterItem(const ::std::vector<FmFilterItem*>& _rFilterList,FmFilterItems* _pTargetItems,sal_Bool _bCopy = sal_False);
+ SvLBoxEntry* getPrevEntry(SvLBoxEntry* _pStartWith = NULL);
+ SvLBoxEntry* getNextEntry(SvLBoxEntry* _pStartWith = NULL);
+
+ using SvTreeListBox::Select;
+ using SvTreeListBox::ExecuteDrop;
+ using SvTreeListBox::Insert;
+};
+
+//========================================================================
+class FmFilterNavigatorWin : public SfxDockingWindow, public SfxControllerItem
+{
+private:
+ FmFilterNavigator* m_pNavigator;
+
+protected:
+ virtual void Resize();
+ virtual sal_Bool Close();
+ virtual Size CalcDockingSize( SfxChildAlignment );
+ virtual SfxChildAlignment CheckAlignment( SfxChildAlignment, SfxChildAlignment );
+
+public:
+ FmFilterNavigatorWin( SfxBindings *pBindings, SfxChildWindow *pMgr,
+ Window* pParent );
+ virtual ~FmFilterNavigatorWin();
+
+ void UpdateContent( FmFormShell* pFormShell );
+ void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+ void FillInfo( SfxChildWinInfo& rInfo ) const;
+
+ using SfxDockingWindow::StateChanged;
+
+ virtual void GetFocus();
+};
+
+//========================================================================
+class FmFilterNavigatorWinMgr : public SfxChildWindow
+{
+public:
+ FmFilterNavigatorWinMgr( Window *pParent, sal_uInt16 nId, SfxBindings *pBindings,
+ SfxChildWinInfo *pInfo );
+ SFX_DECL_CHILDWINDOW( FmFilterNavigatorWinMgr );
+};
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
+#endif // _SVX_FILTNAV_HXX
+
diff --git a/svx/source/inc/fmPropBrw.hxx b/svx/source/inc/fmPropBrw.hxx
new file mode 100644
index 000000000000..963a5beb0dff
--- /dev/null
+++ b/svx/source/inc/fmPropBrw.hxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SVX_FMPROPBRW_HXX
+#define SVX_FMPROPBRW_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/inspection/XObjectInspectorModel.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+/** === end UNO includes === **/
+
+#include <sfx2/basedlgs.hxx>
+#include <sfx2/ctrlitem.hxx>
+#include <sfx2/childwin.hxx>
+#include "svx/fmtools.hxx"
+
+//========================================================================
+class FmPropBrwMgr : public SfxChildWindow
+{
+public:
+ FmPropBrwMgr(Window *pParent, sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo *pInfo);
+ SFX_DECL_CHILDWINDOW(FmPropBrwMgr);
+};
+
+class FmPropControl;
+class SfxBindings;
+class FmFormShell;
+//========================================================================
+class FmPropBrw : public SfxFloatingWindow, public SfxControllerItem
+{
+ sal_Bool m_bInitialStateChange;
+ bool m_bInStateChange;
+ ::rtl::OUString m_sLastActivePage;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ m_xInspectorContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ m_xORB;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
+ m_xMeAsFrame;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ m_xLastKnownDocument;
+ ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorModel >
+ m_xInspectorModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >
+ m_xBrowserController;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >
+ m_xBrowserComponentWindow;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >
+ m_xFrameContainerWindow;
+
+protected:
+ virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState);
+ virtual void FillInfo( SfxChildWinInfo& rInfo ) const;
+ virtual sal_Bool Close();
+
+ DECL_LINK( OnAsyncGetFocus, void* );
+
+ void implSetNewSelection( const InterfaceBag& _rSelection );
+ void implDetachController();
+ bool implIsReadOnlyModel() const;
+ ::rtl::OUString getCurrentPage() const;
+
+public:
+ FmPropBrw(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB,
+ SfxBindings* pBindings,
+ SfxChildWindow* pMgr,
+ Window* pParent,
+ const SfxChildWinInfo* _pInfo
+ );
+ virtual ~FmPropBrw();
+
+ using SfxFloatingWindow::StateChanged;
+
+protected:
+ virtual void Resize();
+
+private:
+ /** creates the PropertyBrowser (aka ObjectInspector) and plugs it into our frame
+
+ This method ensures that a new component is created every time the XModel which
+ we're working for changed. This is necessary since this model is part of the
+ ComponentContext we use to create the ObjectInspector.
+ */
+ void impl_ensurePropertyBrowser_nothrow( FmFormShell* _pFormShell );
+
+ /** creates a property browser
+
+ After this method returns, m_xBrowserController and m_xBrowserComponentWindow are
+ not <NULL/>.
+
+ @precond
+ we don't have an ObjectInspector, yet, i.e. m_xBrowserController and m_xBrowserComponentWindow
+ are <NULL/>.
+ */
+ void impl_createPropertyBrowser_throw( FmFormShell* _pFormShell );
+};
+#endif //SVX_FMPROPBRW_HXX
diff --git a/svx/source/inc/fmcontrolbordermanager.hxx b/svx/source/inc/fmcontrolbordermanager.hxx
new file mode 100644
index 000000000000..2c8a62e56a89
--- /dev/null
+++ b/svx/source/inc/fmcontrolbordermanager.hxx
@@ -0,0 +1,268 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_SOURCE_INC_FMCONTROLBORDERMANAGER_HXX
+#define SVX_SOURCE_INC_FMCONTROLBORDERMANAGER_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/VisualEffect.hpp>
+#include <com/sun/star/awt/FontUnderline.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+/** === end UNO includes === **/
+#include <comphelper/stl_types.hxx>
+#include <comphelper/stl_types.hxx>
+
+#include <set>
+
+namespace com { namespace sun { namespace star { namespace form { namespace validation {
+ class XValidatableFormComponent;
+} } } } }
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ typedef sal_Int16 ControlStatus;
+
+ #define CONTROL_STATUS_NONE 0x00
+ #define CONTROL_STATUS_FOCUSED 0x01
+ #define CONTROL_STATUS_MOUSE_HOVER 0x02
+ #define CONTROL_STATUS_INVALID 0x04
+
+ //====================================================================
+ //= BorderDescriptor
+ //====================================================================
+ struct BorderDescriptor
+ {
+ sal_Int16 nBorderType;
+ sal_Int32 nBorderColor;
+
+ BorderDescriptor()
+ :nBorderType( ::com::sun::star::awt::VisualEffect::FLAT )
+ ,nBorderColor( 0x00000000 )
+ {
+ }
+ inline void clear()
+ {
+ nBorderType = ::com::sun::star::awt::VisualEffect::FLAT;
+ nBorderColor = 0x00000000;
+ }
+ };
+
+ //====================================================================
+ //= UnderlineDescriptor
+ //====================================================================
+ struct UnderlineDescriptor
+ {
+ sal_Int16 nUnderlineType;
+ sal_Int32 nUnderlineColor;
+
+ UnderlineDescriptor()
+ :nUnderlineType( ::com::sun::star::awt::FontUnderline::NONE )
+ ,nUnderlineColor( 0x00000000 )
+ {
+ }
+
+ UnderlineDescriptor( sal_Int16 _nUnderlineType, sal_Int32 _nUnderlineColor )
+ :nUnderlineType( _nUnderlineType )
+ ,nUnderlineColor( _nUnderlineColor )
+ {
+ }
+
+ inline void clear()
+ {
+ nUnderlineType = ::com::sun::star::awt::FontUnderline::NONE;
+ nUnderlineColor = 0x00000000;
+ }
+ };
+
+ //====================================================================
+ //= ControlData
+ //====================================================================
+ struct ControlData : public BorderDescriptor, UnderlineDescriptor
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xControl;
+ ::rtl::OUString sOriginalHelpText;
+
+ ControlData() : BorderDescriptor() { }
+ ControlData( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl )
+ :xControl( _rxControl )
+ {
+ }
+ void clear()
+ {
+ BorderDescriptor::clear();
+ UnderlineDescriptor::clear();
+ xControl.clear();
+ sOriginalHelpText = ::rtl::OUString();
+ }
+ };
+
+ //====================================================================
+ //= ControlBorderManager
+ //====================================================================
+ /** manages the dynamic border color for form controls
+
+ Used by the <type>FormController</type>, this class manages the dynamic changes in the
+ border color of form controls. For this a set of events have to be forwarded to the manager
+ instance, which then will switch the border color depending on the mouse and focus status
+ of the controls.
+ */
+ class ControlBorderManager
+ {
+ private:
+ struct ControlDataCompare : public ::std::binary_function< ControlData, ControlData, bool >
+ {
+ bool operator()( const ControlData& _rLHS, const ControlData& _rRHS ) const
+ {
+ return _rLHS.xControl.get() < _rRHS.xControl.get();
+ }
+ };
+
+ typedef ::std::set< ControlData, ControlDataCompare > ControlBag;
+ typedef ::com::sun::star::awt::XVclWindowPeer WindowPeer;
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer > WindowPeerRef;
+ typedef ::std::set< WindowPeerRef, ::comphelper::OInterfaceCompare< WindowPeer > > PeerBag;
+
+ PeerBag m_aColorableControls;
+ PeerBag m_aNonColorableControls;
+
+ ControlData m_aFocusControl;
+ ControlData m_aMouseHoverControl;
+ ControlBag m_aInvalidControls;
+
+ // ----------------
+ // attributes
+ sal_Int32 m_nFocusColor;
+ sal_Int32 m_nMouseHoveColor;
+ sal_Int32 m_nInvalidColor;
+ bool m_bDynamicBorderColors;
+
+ public:
+ ControlBorderManager();
+ ~ControlBorderManager();
+
+ public:
+ void focusGained( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxControl ) SAL_THROW(());
+ void focusLost( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxControl ) SAL_THROW(());
+ void mouseEntered( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxControl ) SAL_THROW(());
+ void mouseExited( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxControl ) SAL_THROW(());
+
+ void validityChanged(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::validation::XValidatableFormComponent >& _rxValidatable
+ ) SAL_THROW(());
+
+ /// enables dynamic border color for the controls
+ void enableDynamicBorderColor( );
+ /// disables dynamic border color for the controls
+ void disableDynamicBorderColor( );
+
+ /** sets a color to be used for a given status
+ @param _nStatus
+ the status which the color should be applied for. Must not be CONTROL_STATUS_NONE
+ @param _nColor
+ the color to apply for the given status
+ */
+ void setStatusColor( ControlStatus _nStatus, sal_Int32 _nColor );
+
+ /** restores all colors of all controls where we possibly changed them
+ */
+ void restoreAll();
+
+ private:
+ /** called when a control got one of the two possible stati (focused, and hovered with the mouse)
+ @param _rxControl
+ the control which gained the status
+ @param _rControlData
+ the control's status data, as a reference to our respective member
+ */
+ void controlStatusGained(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxControl,
+ ControlData& _rControlData
+ ) SAL_THROW(());
+
+ /** called when a control lost one of the two possible stati (focused, and hovered with the mouse)
+ @param _rxControl
+ the control which lost the status
+ @param _rControlData
+ the control's status data, as a reference to our respective member
+ */
+ void controlStatusLost( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxControl, ControlData& _rControlData ) SAL_THROW(());
+
+ /** determines whether the border of a given peer can be colored
+ @param _rxPeer
+ the peer to examine. Must not be <NULL/>
+ */
+ bool canColorBorder( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer >& _rxPeer );
+
+ /** determines the status of the given control
+ */
+ ControlStatus getControlStatus( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl ) SAL_THROW(());
+
+ /** retrieves the color associated with a given ControlStatus
+ @param _eStatus
+ the status of the control. Must not be <member>ControlStatus::none</member>
+ */
+ sal_Int32 getControlColorByStatus( ControlStatus _eStatus );
+
+ /** sets the border color for a given control, depending on its status
+ @param _rxControl
+ the control to set the border color for. Must not be <NULL/>
+ @param _rxPeer
+ the peer of the control, to be passed herein for optimization the caller usually needs it, anyway).
+ Must not be <NULL/>
+ @param _rFallback
+ the color/type to use when the control has the status CONTROL_STATUS_NONE
+ */
+ void updateBorderStyle(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer >& _rxPeer,
+ const BorderDescriptor& _rFallback
+ ) SAL_THROW(());
+
+ /** determines the to-be-remembered original border color and type for a control
+
+ The method also takes into account that the control may currently have an overwritten
+ border style
+
+ @param _rxControl
+ the control to examine. Must not be <NULL/>, and have a non-<NULL/> peer
+ */
+ void determineOriginalBorderStyle(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl,
+ BorderDescriptor& _rData
+ ) const;
+ };
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
+#endif // SVX_SOURCE_INC_FMCONTROLBORDERMANAGER_HXX
diff --git a/svx/source/inc/fmcontrollayout.hxx b/svx/source/inc/fmcontrollayout.hxx
new file mode 100644
index 000000000000..0cff5f6282cd
--- /dev/null
+++ b/svx/source/inc/fmcontrollayout.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_SOURCE_INC_FMCONTROLLAYOUT_HXX
+#define SVX_SOURCE_INC_FMCONTROLLAYOUT_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/beans/XPropertySet.hpp>
+/** === end UNO includes === **/
+
+#ifndef SVX_SOURCE_FORM_FMDOCUMENTCLASSIFICATION_HXX
+#include "fmdocumentclassification.hxx"
+#endif
+#include <unotools/confignode.hxx>
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ //====================================================================
+ //= ControlLayouter
+ //====================================================================
+ class ControlLayouter
+ {
+ public:
+ /** initializes the layout of a newly created form control (model)
+ */
+ static void initializeControlLayout(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
+ DocumentType _eDocType
+ );
+
+ /** determines whether for the given document type, dynamic control border coloring is enabled
+ */
+ static bool useDynamicBorderColor( DocumentType _eDocType );
+
+ /** determines whether for the given document type, form controls should use the document's reference device
+ for text rendering
+ */
+ static bool useDocumentReferenceDevice( DocumentType _eDocType );
+
+ /** gets the "default" style in a document which can be used if some default text format is needed
+
+ It depends on the type document type which concrete kind of style is returned, but it is expected to support
+ the css.style.CharacterProperties service.
+
+ @param _rxModel
+ a form component.
+ */
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ getDefaultDocumentTextStyle( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel );
+
+ private:
+ ControlLayouter(); // never implemented
+
+ private:
+ static ::utl::OConfigurationNode
+ getLayoutSettings(
+ DocumentType _eDocType
+ );
+ };
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
+#endif // SVX_SOURCE_INC_FMCONTROLLAYOUT_HXX
+
diff --git a/svx/source/inc/fmdocumentclassification.hxx b/svx/source/inc/fmdocumentclassification.hxx
new file mode 100644
index 000000000000..d3e766338a16
--- /dev/null
+++ b/svx/source/inc/fmdocumentclassification.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_SOURCE_INC_FMDOCUMENTCLASSIFICATION_HXX
+#define SVX_SOURCE_INC_FMDOCUMENTCLASSIFICATION_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/frame/XModel.hpp>
+/** === end UNO includes === **/
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ //====================================================================
+ //= DocumentType
+ //====================================================================
+ enum DocumentType
+ {
+ eTextDocument,
+ eWebDocument,
+ eSpreadsheetDocument,
+ eDrawingDocument,
+ ePresentationDocument,
+ eEnhancedForm,
+ eDatabaseForm,
+ eDatabaseReport,
+
+ eUnknownDocumentType
+ };
+
+ //====================================================================
+ //= DocumentClassification
+ //====================================================================
+ class DocumentClassification
+ {
+ public:
+ /** classifies a document model
+ */
+ static DocumentType classifyDocument(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxDocumentModel
+ ) SAL_THROW(());
+
+ static DocumentType classifyHostDocument(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxFormComponent
+ ) SAL_THROW(());
+
+ static DocumentType getDocumentTypeForModuleIdentifier(
+ const ::rtl::OUString& _rModuleIdentifier
+ );
+
+ static ::rtl::OUString getModuleIdentifierForDocumentType(
+ DocumentType _eType
+ );
+ };
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
+#endif // SVX_SOURCE_INC_FMDOCUMENTCLASSIFICATION_HXX
+
diff --git a/svx/source/inc/fmexch.hxx b/svx/source/inc/fmexch.hxx
new file mode 100644
index 000000000000..b805ebf452d1
--- /dev/null
+++ b/svx/source/inc/fmexch.hxx
@@ -0,0 +1,283 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FMEXCH_HXX
+#define _SVX_FMEXCH_HXX
+
+#include <comphelper/stl_types.hxx>
+#include <svtools/transfer.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <tools/link.hxx>
+
+#include <svx/svxdllapi.h>
+
+class FmFormShell;
+class FmFormPage;
+class SvLBoxEntry;
+
+//========================================================================
+// Exchange types
+#define SVX_FM_FIELD_EXCH String("SvxFormFieldExch", sizeof("SvxFormFieldExch"))
+#define SVX_FM_CONTROL_EXCH String("SvxFormExplCtrlExch", sizeof("SvxFormExplCtrlExch"))
+#define SVX_FM_CONTROLS_AS_PATH String("SvxFormControlsAsPathExchange", sizeof("SvxFormControlsAsPathExchange"))
+#define SVX_FM_HIDDEN_CONTROLS String("SvxFormHiddenControlsExchange", sizeof("SvxFormHiddenControlsExchange"))
+#define SVX_FM_FILTER_FIELDS String("SvxFilterFieldExchange", sizeof("SvxFilterFieldExchange"))
+
+//========================================================================
+class SvTreeListBox;
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ //====================================================================
+
+ typedef ::std::set< SvLBoxEntry* > ListBoxEntrySet;
+
+ //====================================================================
+ //= OLocalExchange
+ //====================================================================
+ class SVX_DLLPUBLIC OLocalExchange : public TransferableHelper
+ {
+ private:
+ Link m_aClipboardListener;
+ sal_Bool m_bDragging : 1;
+ sal_Bool m_bClipboardOwner : 1;
+
+ public:
+ class GrantAccess
+ {
+ friend class OLocalExchangeHelper;
+ };
+
+ public:
+ OLocalExchange( );
+
+ sal_Bool isDragging() const { return m_bDragging; }
+ sal_Bool isClipboardOwner() const { return m_bClipboardOwner; }
+
+ void startDrag( Window* pWindow, sal_Int8 nDragSourceActions, const GrantAccess& );
+ void copyToClipboard( Window* _pWindow, const GrantAccess& );
+
+ void setClipboardListener( const Link& _rListener ) { m_aClipboardListener = _rListener; }
+
+ void clear();
+
+ static sal_Bool hasFormat( const DataFlavorExVector& _rFormats, sal_uInt32 _nFormatId );
+
+ protected:
+ // XClipboardOwner
+ virtual void SAL_CALL lostOwnership( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& _rxClipboard, const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& _rxTrans ) throw(::com::sun::star::uno::RuntimeException);
+
+ // TransferableHelper
+ virtual void DragFinished( sal_Int8 nDropAction );
+ virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+
+ private:
+ void StartDrag( Window* pWindow, sal_Int8 nDragSourceActions, sal_Int32 nDragPointer = DND_POINTER_NONE, sal_Int32 nDragImage = DND_IMAGE_NONE )
+ { // don't allow this base class method to be called from outside
+ TransferableHelper::StartDrag(pWindow, nDragSourceActions, nDragPointer, nDragImage);
+ }
+ };
+
+ //====================================================================
+ //= OLocalExchangeHelper
+ //====================================================================
+ /// a helper for navigator windows (SvTreeListBox'es) which allow DnD within themself
+ class SVX_DLLPUBLIC OLocalExchangeHelper
+ {
+ protected:
+ Window* m_pDragSource;
+ OLocalExchange* m_pTransferable;
+
+ public:
+ OLocalExchangeHelper( Window* _pDragSource );
+ virtual ~OLocalExchangeHelper();
+
+ void prepareDrag( );
+
+ void startDrag( sal_Int8 nDragSourceActions );
+ void copyToClipboard( ) const;
+
+ inline sal_Bool isDragSource() const { return m_pTransferable && m_pTransferable->isDragging(); }
+ inline sal_Bool isClipboardOwner() const { return m_pTransferable && m_pTransferable->isClipboardOwner(); }
+ inline sal_Bool isDataExchangeActive( ) const { return isDragSource() || isClipboardOwner(); }
+ inline void clear() { if ( isDataExchangeActive() ) m_pTransferable->clear(); }
+
+ SVX_DLLPRIVATE void setClipboardListener( const Link& _rListener ) { if ( m_pTransferable ) m_pTransferable->setClipboardListener( _rListener ); }
+
+ protected:
+ SVX_DLLPRIVATE virtual OLocalExchange* createExchange() const = 0;
+
+ protected:
+ SVX_DLLPRIVATE void implReset();
+ };
+
+ //====================================================================
+ //= OControlTransferData
+ //====================================================================
+ class OControlTransferData
+ {
+ private:
+ typedef ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_uInt32 > > ControlPaths;
+
+ private:
+ DataFlavorExVector m_aCurrentFormats;
+
+ protected:
+ ListBoxEntrySet m_aSelectedEntries;
+ ControlPaths m_aControlPaths;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >
+ m_aHiddenControlModels;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ m_xFormsRoot; // the root of the forms collection where the entries we represent reside
+ // this uniquely identifies the page and the document
+
+ SvLBoxEntry* m_pFocusEntry;
+
+ protected:
+ // updates m_aCurrentFormats with all formats we currently could supply
+ void updateFormats( );
+
+ public:
+ OControlTransferData( );
+
+ // ctor to construct the data from an arbitrary Transferable (usually clipboard data)
+ OControlTransferData(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& _rxTransferable
+ );
+
+ inline const DataFlavorExVector& GetDataFlavorExVector() const;
+
+ void addSelectedEntry( SvLBoxEntry* _pEntry );
+ void setFocusEntry( SvLBoxEntry* _pFocusEntry );
+
+ /** notifies the data transfer object that a certain entry has been removed from the owning tree
+
+ In case the removed entry is part of the transfer object's selection, the entry is removed from
+ the selection.
+
+ @param _pEntry
+ @return the number of entries remaining in the selection.
+ */
+ size_t onEntryRemoved( SvLBoxEntry* _pEntry );
+
+ void setFormsRoot(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxFormsRoot
+ ) { m_xFormsRoot = _rxFormsRoot; }
+
+ void buildPathFormat(SvTreeListBox* pTreeBox, SvLBoxEntry* pRoot);
+ // baut aus m_aSelectedEntries m_aControlPaths auf
+ // (es wird davon ausgegangen, dass die Eintraege in m_aSelectedEntries sortiert sind in Bezug auf die Nachbar-Beziehung)
+
+
+ void buildListFromPath(SvTreeListBox* pTreeBox, SvLBoxEntry* pRoot);
+ // der umgekehrte Weg : wirft alles aus m_aSelectedEntries weg und baut es mittels m_aControlPaths neu auf
+
+ void addHiddenControlsFormat(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > seqInterfaces);
+ // fuegt ein SVX_FML_HIDDEN_CONTROLS-Format hinzu und merk sich dafuer die uebergebenen Interfaces
+ // (es erfolgt KEINE Ueberpruefung, ob dadurch auch tatsaechlich nur hidden Controls bezeichnet werden, dass muss der
+ // Aufrufer sicherstellen)
+
+ SvLBoxEntry* focused() const { return m_pFocusEntry; }
+ const ListBoxEntrySet& selected() const { return m_aSelectedEntries; }
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >
+ hiddenControls() const { return m_aHiddenControlModels; }
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ getFormsRoot() const { return m_xFormsRoot; }
+ };
+
+ //====================================================================
+ inline const DataFlavorExVector& OControlTransferData::GetDataFlavorExVector() const
+ {
+ const_cast< OControlTransferData* >( this )->updateFormats( );
+ return m_aCurrentFormats;
+ }
+
+ //====================================================================
+ //= OControlExchange
+ //====================================================================
+ class OControlExchange : public OLocalExchange, public OControlTransferData
+ {
+ public:
+ OControlExchange( );
+
+ public:
+ static sal_uInt32 getFieldExchangeFormatId( );
+ static sal_uInt32 getControlPathFormatId( );
+ static sal_uInt32 getHiddenControlModelsFormatId( );
+
+ inline static sal_Bool hasFieldExchangeFormat( const DataFlavorExVector& _rFormats );
+ inline static sal_Bool hasControlPathFormat( const DataFlavorExVector& _rFormats );
+ inline static sal_Bool hasHiddenControlModelsFormat( const DataFlavorExVector& _rFormats );
+
+ protected:
+ virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ virtual void AddSupportedFormats();
+ };
+
+ //====================================================================
+ //= OControlExchangeHelper
+ //====================================================================
+ class OControlExchangeHelper : public OLocalExchangeHelper
+ {
+ public:
+ OControlExchangeHelper(Window* _pDragSource) : OLocalExchangeHelper(_pDragSource) { }
+
+ OControlExchange* operator->() const { return static_cast< OControlExchange* >( m_pTransferable ); }
+ OControlExchange& operator*() const { return *static_cast< OControlExchange* >( m_pTransferable ); }
+
+ protected:
+ virtual OLocalExchange* createExchange() const;
+ };
+
+ //====================================================================
+ //====================================================================
+ inline sal_Bool OControlExchange::hasFieldExchangeFormat( const DataFlavorExVector& _rFormats )
+ {
+ return hasFormat( _rFormats, getFieldExchangeFormatId() );
+ }
+
+ inline sal_Bool OControlExchange::hasControlPathFormat( const DataFlavorExVector& _rFormats )
+ {
+ return hasFormat( _rFormats, getControlPathFormatId() );
+ }
+
+ inline sal_Bool OControlExchange::hasHiddenControlModelsFormat( const DataFlavorExVector& _rFormats )
+ {
+ return hasFormat( _rFormats, getHiddenControlModelsFormatId() );
+ }
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
+#endif
+
diff --git a/svx/source/inc/fmexpl.hrc b/svx/source/inc/fmexpl.hrc
new file mode 100644
index 000000000000..be8db7b71e49
--- /dev/null
+++ b/svx/source/inc/fmexpl.hrc
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_FMEXPL_HRC
+#define _SVX_FMEXPL_HRC
+
+#define FT_PATH 1
+
+#define GB_PATH 1
+
+#define PB_OK 1
+#define PB_CANCEL 2
+#define PB_HELP 3
+
+#endif //_SVX_FMEXPL_HRC
+
diff --git a/svx/source/inc/fmexpl.hxx b/svx/source/inc/fmexpl.hxx
new file mode 100644
index 000000000000..598e9d61196a
--- /dev/null
+++ b/svx/source/inc/fmexpl.hxx
@@ -0,0 +1,612 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FMEXPL_HXX
+#define _SVX_FMEXPL_HXX
+
+#include <svl/lstner.hxx>
+#include <svl/brdcst.hxx>
+#include <vcl/window.hxx>
+#include <sfx2/childwin.hxx>
+#include <svl/poolitem.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dockwin.hxx>
+#include <sfx2/ctrlitem.hxx>
+#include <vcl/image.hxx>
+
+/** === begin UNO includes === **/
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/form/XForm.hpp>
+#include <com/sun/star/form/XFormComponent.hpp>
+#include <com/sun/star/beans/PropertyChangeEvent.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <com/sun/star/container/XContainer.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+/** === end UNO includes === **/
+
+#include <svtools/svtreebx.hxx>
+
+#include <vcl/dialog.hxx>
+#include <vcl/group.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/dockwin.hxx>
+#include <svx/fmview.hxx>
+
+#include "fmexch.hxx"
+
+class SdrObjListIter;
+class FmFormShell;
+class SdrObject;
+class FmFormModel;
+class FmFormView;
+class SdrMarkList;
+
+//========================================================================
+class FmEntryData;
+class FmNavInsertedHint : public SfxHint
+{
+ FmEntryData* pEntryData;
+ sal_uInt32 nPos;
+
+public:
+ TYPEINFO();
+ FmNavInsertedHint( FmEntryData* pInsertedEntryData, sal_uInt32 nRelPos );
+ virtual ~FmNavInsertedHint();
+
+ FmEntryData* GetEntryData() const { return pEntryData; }
+ sal_uInt32 GetRelPos() const { return nPos; }
+};
+
+//========================================================================
+class FmNavModelReplacedHint : public SfxHint
+{
+ FmEntryData* pEntryData; // die Daten des Eintrages, der ein neues Model bekommen hat
+
+public:
+ TYPEINFO();
+ FmNavModelReplacedHint( FmEntryData* pAffectedEntryData );
+ virtual ~FmNavModelReplacedHint();
+
+ FmEntryData* GetEntryData() const { return pEntryData; }
+};
+
+//========================================================================
+class FmNavRemovedHint : public SfxHint
+{
+ FmEntryData* pEntryData;
+
+public:
+ TYPEINFO();
+ FmNavRemovedHint( FmEntryData* pInsertedEntryData );
+ virtual ~FmNavRemovedHint();
+
+ FmEntryData* GetEntryData() const { return pEntryData; }
+};
+
+//========================================================================
+class FmNavNameChangedHint : public SfxHint
+{
+ FmEntryData* pEntryData;
+ ::rtl::OUString aNewName;
+
+public:
+ TYPEINFO();
+ FmNavNameChangedHint( FmEntryData* pData, const ::rtl::OUString& rNewName );
+ virtual ~FmNavNameChangedHint();
+
+ FmEntryData* GetEntryData() const { return pEntryData; }
+ ::rtl::OUString GetNewName() const { return aNewName; }
+};
+
+//========================================================================
+class FmNavClearedHint : public SfxHint
+{
+public:
+ TYPEINFO();
+ FmNavClearedHint();
+ virtual ~FmNavClearedHint();
+};
+
+//========================================================================
+class FmNavViewMarksChanged : public SfxHint
+{
+ FmFormView* pView;
+public:
+ TYPEINFO();
+ FmNavViewMarksChanged(FmFormView* pWhichView) { pView = pWhichView; }
+ virtual ~FmNavViewMarksChanged() {}
+
+ FmFormView* GetAffectedView() { return pView; }
+};
+
+//========================================================================
+class FmEntryDataList;
+class FmEntryData
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xNormalizedIFace;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xProperties;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild > m_xChild;
+
+protected:
+ Image m_aNormalImage;
+ Image m_aHCImage;
+ ::rtl::OUString aText;
+
+ FmEntryDataList* pChildList;
+ FmEntryData* pParent;
+
+protected:
+ void newObject( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxIFace );
+
+public:
+ TYPEINFO();
+
+ FmEntryData( FmEntryData* pParentData, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rIFace );
+ FmEntryData( const FmEntryData& rEntryData );
+ virtual ~FmEntryData();
+
+ void Clear();
+ void SetText( const ::rtl::OUString& rText ){ aText = rText; }
+ void SetParent( FmEntryData* pParentData ){ pParent = pParentData; }
+
+ const Image& GetNormalImage() const { return m_aNormalImage; }
+ const Image& GetHCImage() const { return m_aHCImage; }
+
+ ::rtl::OUString GetText() const { return aText; }
+ FmEntryData* GetParent() const { return pParent; }
+ FmEntryDataList* GetChildList() const { return pChildList; }
+
+ virtual sal_Bool IsEqualWithoutChilds( FmEntryData* pEntryData );
+ virtual FmEntryData* Clone() = 0;
+
+ // note that the interface returned is normalized, i.e. querying the given XInterface of the object
+ // for XInterface must return the interface itself.
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& GetElement() const
+ {
+ return m_xNormalizedIFace;
+ }
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& GetPropertySet() const
+ {
+ return m_xProperties;
+ }
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild >& GetChildIFace() const
+ {
+ return m_xChild;
+ }
+};
+
+//========================================================================
+DECLARE_LIST( FmEntryDataBaseList, FmEntryData* )
+
+class FmEntryDataList : public FmEntryDataBaseList
+{
+public:
+ FmEntryDataList();
+ virtual ~FmEntryDataList();
+};
+
+//========================================================================
+// FmNavRequestSelectHint - jemand teilt dem NavigatorTree mit, dass er bestimmte Eintraege selektieren soll
+
+typedef FmEntryData* FmEntryDataPtr;
+SV_DECL_PTRARR_SORT( FmEntryDataArray, FmEntryDataPtr, 16, 16 )
+
+class FmNavRequestSelectHint : public SfxHint
+{
+ FmEntryDataArray m_arredToSelect;
+ sal_Bool m_bMixedSelection;
+public:
+ TYPEINFO();
+ FmNavRequestSelectHint() { }
+ virtual ~FmNavRequestSelectHint() {}
+
+ void SetMixedSelection(sal_Bool bMixedSelection) { m_bMixedSelection = bMixedSelection; }
+ sal_Bool IsMixedSelection() { return m_bMixedSelection; }
+ void AddItem(FmEntryData* pEntry) { m_arredToSelect.Insert(pEntry); }
+ void ClearItems() { m_arredToSelect.Remove(sal_uInt16(0), m_arredToSelect.Count()); }
+ FmEntryDataArray& GetItems() { return m_arredToSelect; }
+};
+
+//========================================================================
+class FmFormData : public FmEntryData
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > m_xForm;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer > m_xContainer;
+
+public:
+ TYPEINFO();
+
+ FmFormData(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm,
+ const ImageList& _rNormalImages,
+ const ImageList& _rHCImages,
+ FmFormData* _pParent = NULL
+ );
+
+ FmFormData( const FmFormData& rFormData );
+ virtual ~FmFormData();
+
+ void SetForm( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& xForm )
+ {
+ m_xForm = xForm;
+ m_xContainer = m_xContainer.query( m_xForm );
+ newObject( m_xForm );
+ }
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& GetFormIface() const { return m_xForm; }
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer >& GetContainer() const { return m_xContainer; }
+
+ virtual sal_Bool IsEqualWithoutChilds( FmEntryData* pEntryData );
+ virtual FmEntryData* Clone();
+};
+
+
+//========================================================================
+class FmControlData : public FmEntryData
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > m_xFormComponent;
+
+ Image GetImage(const ImageList& ilNavigatorImages) const;
+
+public:
+ TYPEINFO();
+
+ FmControlData(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& _rxComponent,
+ const ImageList& _rNormalImages,
+ const ImageList& _rHCImages,
+ FmFormData* _pParent
+ );
+ FmControlData( const FmControlData& rControlData );
+ virtual ~FmControlData();
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& GetFormComponent() const { return m_xFormComponent; }
+ virtual sal_Bool IsEqualWithoutChilds( FmEntryData* pEntryData );
+ virtual FmEntryData* Clone();
+
+ void ModelReplaced(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& _rxNew,
+ const ImageList& _rNormalImages,
+ const ImageList& _rHCImages
+ );
+};
+
+
+//========================================================================
+//............................................................................
+namespace svxform
+{
+//............................................................................
+
+ class NavigatorTreeModel;
+ //========================================================================
+ // class OFormComponentObserver
+ //========================================================================
+ class OFormComponentObserver
+ :public ::cppu::WeakImplHelper2 < ::com::sun::star::beans::XPropertyChangeListener
+ , ::com::sun::star::container::XContainerListener
+ >
+ {
+ ::svxform::NavigatorTreeModel* m_pNavModel;
+ sal_uInt32 m_nLocks;
+ sal_Bool m_bCanUndo;
+
+ public:
+ OFormComponentObserver( ::svxform::NavigatorTreeModel* pModel );
+
+ // XEventListenerListener
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XPropertyChangeListener
+ virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XContainerListener
+
+ virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
+
+ void Lock() { m_nLocks++; }
+ void UnLock() { m_nLocks--; }
+ sal_Bool IsLocked() const { return m_nLocks != 0; }
+ sal_Bool CanUndo() const { return m_bCanUndo; }
+ void ReleaseModel() { m_pNavModel = NULL; }
+ protected:
+ void Insert(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xIface, sal_Int32 nIndex);
+ void Remove( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement );
+ };
+
+ //========================================================================
+ //= NavigatorTreeModel
+ //========================================================================
+ class NavigatorTreeModel : public SfxBroadcaster
+ ,public SfxListener
+ {
+ friend class NavigatorTree;
+ friend class OFormComponentObserver;
+
+ FmEntryDataList* m_pRootList;
+ FmFormShell* m_pFormShell;
+ FmFormPage* m_pFormPage;
+ FmFormModel* m_pFormModel;
+ OFormComponentObserver* m_pPropChangeList;
+
+ ImageList m_aNormalImages;
+ ImageList m_aHCImages;
+
+ void UpdateContent( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xForms );
+ FmControlData* CreateControlData( ::com::sun::star::form::XFormComponent* pFormComponent );
+
+ void InsertForm(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& xForm, sal_uInt32 nRelPos);
+ void RemoveForm(FmFormData* pFormData);
+
+ void InsertFormComponent(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& xComp, sal_uInt32 nRelPos);
+ void RemoveFormComponent(FmControlData* pControlData);
+ void InsertSdrObj(const SdrObject* pSdrObj);
+ void RemoveSdrObj(const SdrObject* pSdrObj);
+
+ void ReplaceFormComponent(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& xOld, const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& xNew);
+
+ void BroadcastMarkedObjects(const SdrMarkList& mlMarked);
+ // einen RequestSelectHint mit den aktuell markierten Objekten broadcasten
+ sal_Bool InsertFormComponent(FmNavRequestSelectHint& rHint, SdrObject* pObject);
+ // ist ein Helper fuer vorherige, managet das Abteigen in SdrObjGroups
+ // Rueckgabe sal_True, wenn das Objekt eine FormComponent ist (oder rekursiv nur aus solchen besteht)
+
+ public:
+ NavigatorTreeModel( const ImageList& _rNormalImages, const ImageList& _rHCImages );
+ virtual ~NavigatorTreeModel();
+
+ void FillBranch( FmFormData* pParentData );
+ void ClearBranch( FmFormData* pParentData );
+ void UpdateContent( FmFormShell* pNewShell );
+
+ void Insert( FmEntryData* pEntryData, sal_uLong nRelPos = LIST_APPEND,
+ sal_Bool bAlterModel = sal_False );
+ void Remove( FmEntryData* pEntryData, sal_Bool bAlterModel = sal_False );
+
+ sal_Bool Rename( FmEntryData* pEntryData, const ::rtl::OUString& rNewText );
+ sal_Bool IsNameAlreadyDefined( const ::rtl::OUString& rName, FmFormData* pParentData );
+ void Clear();
+ sal_Bool CheckEntry( FmEntryData* pEntryData );
+ void SetModified( sal_Bool bMod=sal_True );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > GetForms() const;
+ FmFormShell* GetFormShell() const { return m_pFormShell; }
+ FmFormPage* GetFormPage() const { return m_pFormPage; }
+ FmEntryData* FindData( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xElement, FmEntryDataList* pDataList, sal_Bool bRecurs=sal_True );
+ FmEntryData* FindData( const ::rtl::OUString& rText, FmFormData* pParentData, sal_Bool bRecurs=sal_True );
+ FmEntryDataList* GetRootList() const { return m_pRootList; }
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > GetFormComponents( FmFormData* pParentFormData );
+ SdrObject* GetSdrObj( FmControlData* pControlData );
+ SdrObject* Search(SdrObjListIter& rIter, const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& xComp);
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+ };
+
+ //========================================================================
+ typedef SvLBoxEntry* SvLBoxEntryPtr;
+ SV_DECL_PTRARR_SORT( SvLBoxEntrySortedArray, SvLBoxEntryPtr, 16, 16 )
+
+ class NavigatorTree : public SvTreeListBox, public SfxListener
+ {
+ enum DROP_ACTION { DA_SCROLLUP, DA_SCROLLDOWN, DA_EXPANDNODE };
+ enum SELDATA_ITEMS { SDI_DIRTY, SDI_ALL, SDI_NORMALIZED, SDI_NORMALIZED_FORMARK };
+
+ // beim Droppen will ich scrollen und Folder aufklappen koennen, dafuer :
+ AutoTimer m_aDropActionTimer;
+ Timer m_aSynchronizeTimer;
+ // die Meta-Daten ueber meine aktuelle Selektion
+ SvLBoxEntrySortedArray m_arrCurrentSelection;
+ // the entries which, in the view, are currently marked as "cut" (painted semi-transparent)
+ ListBoxEntrySet m_aCutEntries;
+ // die Images, die ich brauche (und an FormDatas und EntryDatas weiterreiche)
+ ImageList m_aNavigatorImages;
+ ImageList m_aNavigatorImagesHC;
+
+ ::svxform::OControlExchangeHelper m_aControlExchange;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB;
+ NavigatorTreeModel* m_pNavModel;
+ SvLBoxEntry* m_pRootEntry;
+ SvLBoxEntry* m_pEditEntry;
+
+ sal_uLong nEditEvent;
+
+ SELDATA_ITEMS m_sdiState;
+ Point m_aTimerTriggered; // die Position, an der der DropTimer angeschaltet wurde
+ DROP_ACTION m_aDropActionType;
+
+ sal_uInt16 m_nSelectLock;
+ sal_uInt16 m_nFormsSelected;
+ sal_uInt16 m_nControlsSelected;
+ sal_uInt16 m_nHiddenControls; // (die Zahl geht in m_nControlsSelected mit ein)
+
+ unsigned short m_aTimerCounter;
+
+ sal_Bool m_bDragDataDirty : 1; // dito
+ sal_Bool m_bPrevSelectionMixed : 1;
+ sal_Bool m_bMarkingObjects : 1; // wenn das sal_True ist, brauche ich auf die RequestSelectHints nicht reagieren
+ sal_Bool m_bRootSelected : 1;
+ sal_Bool m_bInitialUpdate : 1; // bin ich das erste Mal im UpdateContent ?
+ sal_Bool m_bKeyboardCut : 1;
+
+
+ void UpdateContent();
+ sal_Bool IsDeleteAllowed();
+ FmControlData* NewControl( const ::rtl::OUString& rServiceName, SvLBoxEntry* pParentEntry, sal_Bool bEditName = sal_True );
+ void NewForm( SvLBoxEntry* pParentEntry );
+ SvLBoxEntry* Insert( FmEntryData* pEntryData, sal_uLong nRelPos=LIST_APPEND );
+ void Remove( FmEntryData* pEntryData );
+
+
+ void CollectSelectionData(SELDATA_ITEMS sdiHow);
+ // sammelt in m_arrCurrentSelection die aktuell selektierten Eintraege, normalisiert die Liste wenn verlangt
+ // SDI_NORMALIZED bedeutet einfach, dass alle Eintraege, die schon einen selektierten Vorfahren haben, nicht mit gesammelt
+ // werden.
+ // SDI_NORMALIZED_FORMARK bedeutet, dass wie bei SDI_NORMALIZED verfahren wird, aber Eintraege, deren direktes Elter nicht
+ // selektiert ist, aufgenommen werden (unabhaengig vom Status weiterer Vorfahren), desgleichen Formulare, die selektiert sind,
+ // unabhaengig vom Status irgendwelcher Vorfahren
+ // Bei beiden Normalized-Modi enthalten die m_nFormsSelected, ... die richtige Anzahl, auch wenn nicht alle dieser Eintraege
+ // in m_arrCurrentSelection landen.
+ // SDI_DIRTY ist natuerlich nicht erlaubt als Parameter
+
+ // ein einziges Interface fuer alle selektierten Eintraege zusammensetzen
+ void ShowSelectionProperties(sal_Bool bForce = sal_False);
+ // alle selektierten Elemnte loeschen
+ void DeleteSelection();
+
+ void SynchronizeSelection(FmEntryDataArray& arredToSelect);
+ // nach dem Aufruf dieser Methode sind genau die Eintraege selektiert, die in dem Array bezeichnet sind
+ void SynchronizeSelection();
+ // macht das selbe, nimmt die MarkList der ::com::sun::star::sdbcx::View
+ void SynchronizeMarkList();
+ // umgekehrte Richtung von SynchronizeMarkList : markiert in der ::com::sun::star::sdbcx::View alle der aktuellen Selektion entsprechenden Controls
+
+ void CollectObjects(FmFormData* pFormData, sal_Bool bDeep, ::std::set< ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > >& _rObjects);
+
+ // im Select aktualisiere ich normalerweise die Marklist der zugehoerigen ::com::sun::star::sdbcx::View, mit folgenden Funktionen
+ // kann ich das Locking dieses Verhaltens steuern
+ void LockSelectionHandling() { ++m_nSelectLock; }
+ void UnlockSelectionHandling() { --m_nSelectLock; }
+ sal_Bool IsSelectionHandlingLocked() const { return m_nSelectLock>0; }
+
+ sal_Bool IsHiddenControl(FmEntryData* pEntryData);
+
+ DECL_LINK( OnEdit, void* );
+ DECL_LINK( OnDropActionTimer, void* );
+
+ DECL_LINK(OnEntrySelDesel, NavigatorTree*);
+ DECL_LINK(OnSynchronizeTimer, void*);
+
+ DECL_LINK( OnClipboardAction, void* );
+
+ protected:
+ virtual void Command( const CommandEvent& rEvt );
+
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+
+ public:
+ NavigatorTree(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB, Window* pParent );
+ virtual ~NavigatorTree();
+
+ void Clear();
+ void UpdateContent( FmFormShell* pFormShell );
+ void MarkViewObj( FmFormData* pFormData, sal_Bool bMark, sal_Bool bDeep = sal_False );
+ void MarkViewObj( FmControlData* pControlData, sal_Bool bMarkHandles, sal_Bool bMark );
+ void UnmarkAllViewObj();
+
+ sal_Bool IsFormEntry( SvLBoxEntry* pEntry );
+ sal_Bool IsFormComponentEntry( SvLBoxEntry* pEntry );
+
+ ::rtl::OUString GenerateName( FmEntryData* pEntryData );
+
+ NavigatorTreeModel* GetNavModel() const { return m_pNavModel; }
+ SvLBoxEntry* FindEntry( FmEntryData* pEntryData );
+
+ virtual sal_Bool EditedEntry( SvLBoxEntry* pEntry, const XubString& rNewText );
+ virtual sal_Bool Select( SvLBoxEntry* pEntry, sal_Bool bSelect=sal_True );
+ virtual sal_Bool EditingEntry( SvLBoxEntry* pEntry, Selection& );
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+ virtual void KeyInput( const KeyEvent& rKEvt );
+
+ virtual void ModelHasRemoved( SvListEntry* _pEntry );
+
+ using SvTreeListBox::Insert;
+ using SvTreeListBox::ExecuteDrop;
+ using SvTreeListBox::Select;
+ using SvTreeListBox::Notify;
+
+ private:
+ sal_Int8 implAcceptDataTransfer( const DataFlavorExVector& _rFlavors, sal_Int8 _nAction, const Point& _rDropPos, sal_Bool _bDnD );
+ sal_Int8 implAcceptDataTransfer( const DataFlavorExVector& _rFlavors, sal_Int8 _nAction, SvLBoxEntry* _pTargetEntry, sal_Bool _bDnD );
+
+ sal_Int8 implExecuteDataTransfer( const OControlTransferData& _rData, sal_Int8 _nAction, const Point& _rDropPos, sal_Bool _bDnD );
+ sal_Int8 implExecuteDataTransfer( const OControlTransferData& _rData, sal_Int8 _nAction, SvLBoxEntry* _pTargetEntry, sal_Bool _bDnD );
+
+ // check if a cut, copy, or drag operation can be started in the current situation
+ sal_Bool implAllowExchange( sal_Int8 _nAction, sal_Bool* _pHasNonHidden = NULL );
+ // check if a paste with the current clipboard content can be accepted
+ sal_Bool implAcceptPaste( );
+
+ // fills m_aControlExchange in preparation of a DnD or clipboard operation
+ sal_Bool implPrepareExchange( sal_Int8 _nAction );
+
+ void doPaste();
+ void doCopy();
+ void doCut();
+
+ sal_Bool doingKeyboardCut( ) const { return m_bKeyboardCut; }
+ };
+
+ //========================================================================
+ class NavigatorFrame : public SfxDockingWindow, public SfxControllerItem
+ {
+ private:
+ ::svxform::NavigatorTree* m_pNavigatorTree;
+
+ protected:
+ virtual void Resize();
+ virtual sal_Bool Close();
+ virtual void GetFocus();
+ virtual Size CalcDockingSize( SfxChildAlignment );
+ virtual SfxChildAlignment CheckAlignment( SfxChildAlignment, SfxChildAlignment );
+
+ using SfxDockingWindow::StateChanged;
+
+ public:
+ NavigatorFrame( SfxBindings *pBindings, SfxChildWindow *pMgr,
+ Window* pParent );
+ virtual ~NavigatorFrame();
+
+ void UpdateContent( FmFormShell* pFormShell );
+ void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+ void FillInfo( SfxChildWinInfo& rInfo ) const;
+ };
+
+ //========================================================================
+ class SVX_DLLPUBLIC NavigatorFrameManager : public SfxChildWindow
+ {
+ public:
+ SVX_DLLPRIVATE NavigatorFrameManager( Window *pParent, sal_uInt16 nId, SfxBindings *pBindings,
+ SfxChildWinInfo *pInfo );
+ SFX_DECL_CHILDWINDOW( NavigatorFrameManager );
+ };
+
+//............................................................................
+} // namespace svxform
+//............................................................................
+
+#endif // _SVX_FMEXPL_HXX
+
diff --git a/svx/source/inc/fmgroup.hxx b/svx/source/inc/fmgroup.hxx
new file mode 100644
index 000000000000..5cad571dee7b
--- /dev/null
+++ b/svx/source/inc/fmgroup.hxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FMGROUP_HXX
+#define _SVX_FMGROUP_HXX
+
+#ifndef _SVX_FMCPONT_HXX
+#include "fmcpont.hxx"
+#endif
+
+#ifndef __DBFORM_HXX
+#include <dbform.hxx>
+#endif
+
+DECLARE_LIST( FmCtrlModelList, XInterface* );
+
+struct FmXGroupModel_Impl;
+
+//==================================================================
+// FmXGroupModel
+//==================================================================
+class FmXGroupModel : public XBoundControl,
+ public XLoadListener,
+ public XPropertyChangeListener,
+ public XGroup,
+ public FmXControlModel
+{
+ FmFormControlMap aControlMap;
+
+ friend Reflection* FmXGroupModel_getReflection();
+ FmXGroupModel_Impl* pGroupModelData; // Properties
+
+public:
+ FmXGroupModel();
+ virtual ~FmXGroupModel();
+
+ // UNO Anbindung
+ SMART_UNO_DECLARATION( FmXGroupModel, FmXControlModel );
+ virtual XInterface* queryInterface(UsrUik);
+ virtual XIdlClassRef getIdlClass();
+
+ // XGroup
+ virtual sal_Int32 getFormControlCount();
+ virtual XFormControlRef getFormControlByName( const XubString& sName ) const;
+ virtual XFormControlRef getFormControlByIndex( sal_Int32 Index ) const;
+ virtual void appendFormControl( const XFormControlRef& FormControl );
+ virtual XFormControlRef removeFormControl( const XFormControlRef& FormControl );
+
+ // XFormControl
+ virtual void setParent( const XFormRef& Parent );
+
+ // XEventListener
+ virtual void disposing( const EventObject& Source );
+
+ // XPropertiesChangeListener
+ virtual void propertyChange( const PropertyChangeEvent& evt );
+
+ // XLoadListener
+ virtual void loaded( const EventObject& rEvent );
+ virtual void unloaded( const EventObject& rEvent );
+
+ // XBoundControl
+ virtual void addBoundControlListener( const XBoundControlListenerRef& l );
+ virtual void removeBoundControlListener( const XBoundControlListenerRef& l );
+
+ // XPersistObject
+ virtual XubString getServiceName( void ) const;
+ virtual void write( const XObjectOutputStreamRef& OutStream );
+ virtual void read( const XObjectInputStreamRef& InStream );
+
+ // PropertySetInterface
+ virtual FmXPropertySetInfo* createPropertySetInfo() const;
+ virtual sal_Bool setPropertyValue( sal_uInt16 nId, const XubString& aPropertyName,
+ const UsrAny& aValue,
+ PropertyChangeEventSequence* pSeq,
+ sal_Int32 nIndex );
+ virtual UsrAny getPropertyValue( sal_uInt16 nId, const XubString& aPropertyName ) const;
+ virtual void addPropertyChangeListener( const XubString& aPropertyName, const XPropertyChangeListenerRef& aListener );
+ virtual void removePropertyChangeListener( const XubString& aPropertyName, const XPropertyChangeListenerRef& aListener );
+};
+
+//==================================================================
+// FmXGroupModelInfo
+// Properties:
+//==================================================================
+class FmXGroupModelInfo : public FmXControlModelInfo
+{
+ friend class FmXGroupModel;
+
+protected:
+ FmXGroupModelInfo( const FmXGroupModel* pCp );
+ virtual void fillProperties( sal_uInt32& nIndex, PropertySequence& aSeq ) const;
+};
+
+
+#endif // _SVX_FMGROUP_HXX
+
diff --git a/svx/source/inc/fmhlpids.hrc b/svx/source/inc/fmhlpids.hrc
new file mode 100644
index 000000000000..7df02cdfec7d
--- /dev/null
+++ b/svx/source/inc/fmhlpids.hrc
@@ -0,0 +1,36 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FMHLPIDS_HRC
+#define _SVX_FMHLPIDS_HRC
+
+// include -----------------------------------------------------------
+#ifndef _SVX_FMHELP_HRC
+#include "fmhelp.hrc"
+#endif
+
+#endif
+
diff --git a/svx/source/inc/fmitems.hxx b/svx/source/inc/fmitems.hxx
new file mode 100644
index 000000000000..1031163b3765
--- /dev/null
+++ b/svx/source/inc/fmitems.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FMITEMS_HXX
+#define _SVX_FMITEMS_HXX
+
+
+#include <svl/poolitem.hxx>
+#include <comphelper/uno3.hxx>
+// FORWARD_DECLARE_INTERFACE(awt,XControlContainer)
+FORWARD_DECLARE_INTERFACE(uno,Any)
+// class ::com::sun::star::uno::Any;
+
+//==================================================================
+class FmInterfaceItem : public SfxPoolItem
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xInterface;
+
+public:
+ TYPEINFO();
+
+ FmInterfaceItem( const sal_uInt16 nId, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxInterface )
+ :SfxPoolItem( nId )
+ ,xInterface( rxInterface )
+ {}
+
+ inline FmInterfaceItem& operator=( const FmInterfaceItem &rCpy );
+
+ // "pure virtual Methoden" vom SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > GetInterface() const { return xInterface; }
+};
+
+inline FmInterfaceItem& FmInterfaceItem::operator=( const FmInterfaceItem &rCpy )
+{
+ xInterface = rCpy.xInterface;
+
+ return *this;
+}
+
+
+
+#endif // _SVX_FMITEMS_HXX
+
diff --git a/svx/source/inc/fmobj.hxx b/svx/source/inc/fmobj.hxx
new file mode 100644
index 000000000000..fae15aeb18df
--- /dev/null
+++ b/svx/source/inc/fmobj.hxx
@@ -0,0 +1,134 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FMOBJ_HXX
+#define _SVX_FMOBJ_HXX
+
+#include <svx/svdouno.hxx>
+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+
+class FmFormView;
+
+//==================================================================
+// FmFormObj
+//==================================================================
+class FmXForms;
+class FmFormObj: public SdrUnoObj
+{
+ ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor > aEvts; // events des Objects
+ ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor> m_aEventsHistory;
+ // valid if and only if m_pEnvironmentHistory != NULL, this are the events which we're set when
+ // m_pEnvironmentHistory was created
+
+ FmFormView* m_pControlCreationView;
+ sal_uLong m_nControlCreationEvent;
+
+ // Informationen fuer die Controlumgebung
+ // werden nur vorgehalten, wenn ein Object sich nicht in einer Objectliste befindet
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer> m_xParent;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > m_xEnvironmentHistory;
+ sal_Int32 m_nPos;
+ sal_Int32 m_nType;
+
+ OutputDevice* m_pLastKnownRefDevice;
+ // the last ref device we know, as set at the model
+ // only to be used for comparison with the current ref device!
+
+public:
+ SVX_DLLPUBLIC FmFormObj(const ::rtl::OUString& rModelName,sal_Int32 _nType);
+ SVX_DLLPUBLIC FmFormObj(sal_Int32 _nType);
+
+ TYPEINFO();
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer>&
+ GetOriginalParent() const { return m_xParent; }
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >&
+ GetOriginalEvents() const { return aEvts; }
+ sal_Int32
+ GetOriginalIndex() const { return m_nPos; }
+
+ void SetObjEnv(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer>& xForm,
+ const sal_Int32 nIdx,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& rEvts );
+ void ClearObjEnv();
+
+public:
+ virtual ~FmFormObj();
+ virtual void SetPage(SdrPage* pNewPage);
+
+ virtual sal_uInt32 GetObjInventor() const;
+ virtual sal_uInt16 GetObjIdentifier() const;
+ virtual void NbcReformatText();
+
+ virtual SdrObject* Clone() const;
+ // #116235# virtual SdrObject* Clone(SdrPage* pPage, SdrModel* pModel) const;
+ virtual void operator= (const SdrObject& rObj);
+
+ virtual void SetModel(SdrModel* pNewModel);
+
+ virtual void clonedFrom(const FmFormObj* _pSource);
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> ensureModelEnv(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rSourceContainer, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer> _rTopLevelDestContainer);
+
+ /** returns the FmFormObj behind the given SdrObject
+
+ In case the SdrObject *is* an FmFormObject, this is a simple cast. In case the SdrObject
+ is a virtual object whose referenced object is an FmFormObj, then this referenced
+ object is returned. In all other cases, NULL is returned.
+ */
+ static FmFormObj* GetFormObject( SdrObject* _pSdrObject );
+ static const FmFormObj* GetFormObject( const SdrObject* _pSdrObject );
+
+ /** returns the type of this form object. See fmglob.hxx
+ */
+ sal_Int32 getType() const;
+
+ virtual void SetUnoControlModel( const ::com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >& _rxModel );
+
+protected:
+ virtual FASTBOOL EndCreate( SdrDragStat& rStat, SdrCreateCmd eCmd );
+ virtual void BrkCreate( SdrDragStat& rStat );
+
+ // #i70852# overload Layer interface to force to FormColtrol layer
+ virtual SdrLayerID GetLayer() const;
+ virtual void NbcSetLayer(SdrLayerID nLayer);
+
+private:
+ /** isolates the control model from its form component hierarchy, i.e. removes it from
+ its parent.
+ */
+ void impl_isolateControlModel_nothrow();
+
+ /** forwards the reference device of our SdrModel to the control model
+ */
+ void impl_checkRefDevice_nothrow( bool _force = false );
+};
+
+
+#endif // _FM_FMOBJ_HXX
+
diff --git a/svx/source/inc/fmpgeimp.hxx b/svx/source/inc/fmpgeimp.hxx
new file mode 100644
index 000000000000..755c754853dc
--- /dev/null
+++ b/svx/source/inc/fmpgeimp.hxx
@@ -0,0 +1,170 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FMUNOPGE_HXX
+#define _SVX_FMUNOPGE_HXX
+
+#include <com/sun/star/sdbc/XDataSource.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/form/XFormComponent.hpp>
+#include <com/sun/star/form/XForm.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XMap.hpp>
+
+#include <tools/list.hxx>
+#include <tools/link.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/weakref.hxx>
+
+#include "svx/svxdllapi.h"
+#include <map>
+
+class SvStream;
+class FmFormObj;
+class FmFormPage;
+class SdrObject;
+
+//FORWARD_DECLARE_INTERFACE(uno,Reference)
+FORWARD_DECLARE_INTERFACE(io,XObjectOutputStream)
+FORWARD_DECLARE_INTERFACE(io,XObjectInputStream)
+FORWARD_DECLARE_INTERFACE(container,XIndexContainer)
+
+class SdrObjList;
+
+//==================================================================
+// FmFormPageImpl
+// lauscht an allen Containern, um festzustellen, wann Objecte
+// eingefuegt worden sind und wann diese entfernt wurden
+//==================================================================
+
+class SVX_DLLPRIVATE FmFormPageImpl
+{
+ ::std::map< ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >,SdrObject* > m_aComponentMap;
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > xCurrentForm;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xForms;
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::container::XMap > m_aControlShapeMap;
+
+ FmFormPage& m_rPage;
+ Link m_aFormsCreationHdl;
+
+ sal_Bool m_bFirstActivation;
+ bool m_bAttemptedFormCreation;
+ bool m_bInFind;
+
+protected:
+ void Init();
+
+public:
+ FmFormPageImpl( FmFormPage& _rPage );
+ FmFormPageImpl( FmFormPage& _rPage, const FmFormPageImpl& rImpl );
+ ~FmFormPageImpl();
+
+ // nur wichtig fuer den DesignMode
+ void setCurForm(::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> xForm);
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> getDefaultForm();
+
+ /** finds a place in the form component hierarchy where to insert the given component
+
+ Note that no actual insertion happens, this is the responsibility of the caller (as
+ the caller might decide on a suitable place where in the returned container the insertion
+ should happen).
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> findPlaceInFormComponentHierarchy(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent>& rContent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>& rDatabase = ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>(),
+ const ::rtl::OUString& rDBTitle = ::rtl::OUString(),
+ const ::rtl::OUString& rCursorSource = ::rtl::OUString(),
+ sal_Int32 nCommandType = 0
+ );
+
+ // activation handling
+ inline sal_Bool hasEverBeenActivated( ) const { return !m_bFirstActivation; }
+ inline void setHasBeenActivated( ) { m_bFirstActivation = sal_False; }
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& getForms( bool _bForceCreate = true );
+
+ void SetFormsCreationHdl( const Link& _rFormsCreationHdl ) { m_aFormsCreationHdl = _rFormsCreationHdl; }
+ const Link& GetFormsCreationHdl() const { return m_aFormsCreationHdl; }
+
+protected:
+ /** finds a form with a given data source signature
+ @param rForm
+ the form to start the search with. This form, including all possible sub forms,
+ will be examined
+ @param rDatabase
+ the data source which to which the found form must be bound
+ @param rCommand
+ the desired Command property value of the sought-after form
+ @param nCommandType
+ the desired CommandType property value of the sought-after form
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> findFormForDataSource(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>& rForm,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>& rDatabase,
+ const ::rtl::OUString& rCommand,
+ sal_Int32 nCommandType
+ );
+
+public:
+ ::rtl::OUString setUniqueName(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent>& xFormComponent, const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>& xControls);
+
+ void formObjectInserted( const FmFormObj& _object );
+ void formObjectRemoved( const FmFormObj& _object );
+
+ /** returns an object mapping from control models to drawing shapes.
+ */
+ SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::container::XMap > getControlToShapeMap();
+
+private:
+ /** validates whether <member>xCurrentForm</member> is still valid and to be used
+
+ There are situations where our current form becomes invalid, without us noticing this. Thus,
+ every method which accesses <member>xCurrentForm</member> should beforehand validate the current
+ form by calling this method.
+
+ If <member>xCurrentForm</member> is not valid anymore, it is reset to <NULL/>.
+
+ @return
+ <TRUE/> if and only if xCurrentForm is valid.
+
+ @since #i40086#
+ */
+ bool validateCurForm();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XMap >
+ impl_createControlShapeMap_nothrow();
+
+private:
+ FmFormPageImpl(); // never implemented
+ FmFormPageImpl( const FmFormPageImpl& ); // never implemented
+ FmFormPageImpl& operator=( const FmFormPageImpl& ); // never implemented
+};
+
+
+#endif // _SVX_FMUNOPGE_HXX
+
diff --git a/svx/source/inc/fmprop.hrc b/svx/source/inc/fmprop.hrc
new file mode 100644
index 000000000000..a0592c80b90b
--- /dev/null
+++ b/svx/source/inc/fmprop.hrc
@@ -0,0 +1,179 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FMPROP_HRC
+#define _SVX_FMPROP_HRC
+
+// PropertyId's, welche eine Zuordnung zu einen PropertyName haben, das koennten
+// auch in Zukunft WhichIds sein -> Itemset
+#define FM_ATTR_START 0
+
+#define FM_ATTR_FILTER ( FM_ATTR_START + 1 )
+#define FM_ATTR_FORM_OPERATIONS ( FM_ATTR_START + 2 )
+
+#define FM_PROP_NAME rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) )
+#define FM_PROP_CLASSID rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ClassId" ) )
+#define FM_PROP_ALIGN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Align" ) )
+#define FM_PROP_ROWCOUNT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RowCount" ) )
+#define FM_PROP_ROWCOUNTFINAL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsRowCountFinal" ) )
+#define FM_PROP_FETCHSIZE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FetchSize" ) )
+#define FM_PROP_VALUE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Value" ) )
+#define FM_PROP_VALUEMIN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ValueMin" ) )
+#define FM_PROP_VALUEMAX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ValueMax" ) )
+#define FM_PROP_VALUESTEP rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ValueStep" ) )
+#define FM_PROP_TEXT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) )
+#define FM_PROP_LABEL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Label" ) )
+#define FM_PROP_NAVIGATION rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NavigationBarMode" ) )
+#define FM_PROP_CYCLE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cycle" ) )
+#define FM_PROP_CONTROLSOURCE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DataField" ) )
+#define FM_PROP_ENABLED rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ) )
+#define FM_PROP_SPIN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Spin" ) )
+#define FM_PROP_READONLY rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ReadOnly" ) )
+#define FM_PROP_FILTER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Filter" ) )
+#define FM_PROP_AUTOINCREMENT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsAutoIncrement" ) )
+#define FM_PROP_WIDTH rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) )
+#define FM_PROP_SEARCHABLE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsSearchable" ) )
+#define FM_PROP_MULTILINE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiLine" ) )
+#define FM_PROP_TARGET_URL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetURL" ) )
+#define FM_PROP_DEFAULTCONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultControl" ) )
+#define FM_PROP_MAXTEXTLEN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxTextLen" ) )
+#define FM_PROP_DATE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Date" ) )
+#define FM_PROP_TIME rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Time" ) )
+#define FM_PROP_STATE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "State" ) )
+#define FM_PROP_TRISTATE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TriState" ) )
+#define FM_PROP_STRINGITEMLIST rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StringItemList" ) )
+#define FM_PROP_DEFAULT_TEXT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultText" ) )
+#define FM_PROP_DEFAULTCHECKED rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultState" ) )
+#define FM_PROP_DEFAULT_DATE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultDate" ) )
+#define FM_PROP_DEFAULT_TIME rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultTime" ) )
+#define FM_PROP_DEFAULT_VALUE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultValue" ) )
+#define FM_PROP_FORMATKEY rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FormatKey" ) )
+#define FM_PROP_FORMATSSUPPLIER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FormatsSupplier" ) )
+#define FM_PROP_LISTSOURCETYPE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ListSourceType" ) )
+#define FM_PROP_LISTSOURCE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ListSource" ) )
+#define FM_PROP_SELECT_SEQ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectedItems" ) )
+#define FM_PROP_VALUE_SEQ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ValueItemList" ) )
+#define FM_PROP_DEFAULT_SELECT_SEQ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultSelection" ) )
+#define FM_PROP_DECIMAL_ACCURACY rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DecimalAccuracy" ) )
+#define FM_PROP_EDITMASK rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EditMask" ) )
+#define FM_PROP_ISREADONLY rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) )
+#define FM_PROP_FIELDTYPE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Type" ) )
+#define FM_PROP_REFVALUE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RefValue" ) )
+#define FM_PROP_STRICTFORMAT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StrictFormat" ) )
+#define FM_PROP_DATASOURCE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DataSourceName" ) )
+#define FM_PROP_LITERALMASK rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LiteralMask" ) )
+#define FM_PROP_SHOWTHOUSANDSEP rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ShowThousandsSeparator" ) )
+#define FM_PROP_CURRENCYSYMBOL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CurrencySymbol" ) )
+#define FM_PROP_DATEFORMAT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateFormat" ) )
+#define FM_PROP_DATEMIN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateMin" ) )
+#define FM_PROP_DATEMAX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateMax" ) )
+#define FM_PROP_DATE_SHOW_CENTURY rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateShowCentury" ) )
+#define FM_PROP_TIMEFORMAT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TimeFormat" ) )
+#define FM_PROP_TIMEMIN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TimeMin" ) )
+#define FM_PROP_TIMEMAX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TimeMax" ) )
+#define FM_PROP_LINECOUNT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LineCount" ) )
+#define FM_PROP_BOUNDCOLUMN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BoundColumn" ) )
+#define FM_PROP_HASNAVIGATION rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HasNavigationBar" ) )
+#define FM_PROP_FONT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontDescriptor" ) )
+#define FM_PROP_BACKGROUNDCOLOR rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BackgroundColor" ) )
+#define FM_PROP_TEXTCOLOR rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextColor" ) )
+#define FM_PROP_BORDER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Border" ) )
+#define FM_PROP_DROPDOWN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Dropdown" ) )
+#define FM_PROP_ROWHEIGHT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RowHeight" ) )
+#define FM_PROP_HELPTEXT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpText" ) )
+#define FM_PROP_HELPURL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpURL" ) )
+#define FM_PROP_RECORDMARKER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HasRecordMarker" ) )
+#define FM_PROP_BOUNDFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BoundField" ) )
+#define FM_PROP_EFFECTIVE_VALUE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EffectiveValue" ) )
+#define FM_PROP_EFFECTIVE_DEFAULT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EffectiveDefault" ) )
+#define FM_PROP_EFFECTIVE_MIN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EffectiveMin" ) )
+#define FM_PROP_EFFECTIVE_MAX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EffectiveMax" ) )
+#define FM_PROP_HIDDEN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Hidden" ) )
+#define FM_PROP_FILTERPROPOSAL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseFilterValueProposal" ) )
+#define FM_PROP_FIELDSOURCE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FieldSource" ) )
+#define FM_PROP_TABLENAME rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TableName" ) )
+#define FM_PROP_FILTERSUPPLIER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterSupplier" ) )
+#define FM_PROP_CURRENTFILTER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CurrentFilter" ) )
+#define FM_PROP_SELECTED_FIELDS rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectedFields" ) )
+#define FM_PROP_SELECTED_TABLES rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectedTables" ) )
+#define FM_PROP_THREADSAFE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ThreadSafe" ) )
+#define FM_PROP_CONTROLLABEL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LabelControl" ) )
+#define FM_PROP_CURSORCOLOR rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CursorColor" ) )
+#define FM_PROP_ALWAYSSHOWCURSOR rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AlwaysShowCursor" ) )
+#define FM_PROP_DISPLAYSYNCHRON rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisplayIsSynchron" ) )
+#define FM_PROP_ISMODIFIED rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsModified" ) )
+#define FM_PROP_ISNEW rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsNew" ) )
+#define FM_PROP_PRIVILEGES rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Privileges" ) )
+#define FM_PROP_COMMAND rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Command" ) )
+#define FM_PROP_COMMANDTYPE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CommandType" ) )
+#define FM_PROP_RESULTSET_CONCURRENCY rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResultSetConcurrency" ) )
+#define FM_PROP_INSERTONLY rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IgnoreResult" ) )
+#define FM_PROP_RESULTSET_TYPE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResultSetType" ) )
+#define FM_PROP_ESCAPE_PROCESSING rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EscapeProcessing" ) )
+#define FM_PROP_APPLYFILTER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ApplyFilter" ) )
+#define FM_PROP_ISNULLABLE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsNullable" ) )
+#define FM_PROP_ACTIVECOMMAND rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ActiveCommand" ) )
+#define FM_PROP_ISCURRENCY rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsCurrency" ) )
+#define FM_PROP_URL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) )
+#define FM_PROP_ACTIVE_CONNECTION rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ActiveConnection" ) )
+#define FM_PROP_SORT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Order" ) )
+#define FM_PROP_CONTROLSOURCEPROPERTY rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DataFieldProperty" ) )
+#define FM_PROP_REALNAME rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RealName" ) )
+#define FM_PROP_TEXTLINECOLOR rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextLineColor" ) )
+#define FM_PROP_FONTEMPHASISMARK rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontEmphasisMark" ) )
+#define FM_PROP_FONTRELIEF rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontRelief" ) )
+#define FM_PROP_SCROLLVALUE_MIN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ScrollValueMin" ) )
+#define FM_PROP_SCROLLVALUE_MAX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ScrollValueMax" ) )
+#define FM_PROP_DEFAULT_SCROLLVALUE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultScrollValue" ) )
+#define FM_PROP_LINEINCREMENT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LineIncrement" ) )
+#define FM_PROP_BLOCKINCREMENT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BlockIncrement" ) )
+#define FM_PROP_ORIENTATION rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Orientation" ) )
+#define FM_PROP_REPEAT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Repeat" ) )
+#define FM_PROP_REPEATDELAY rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RepeatDelay" ) )
+#define FM_PROP_SYMBOLCOLOR rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SymbolColor" ) )
+#define FM_PROP_VISIBILESIZE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VisibleSize" ) )
+#define FM_PROP_SPINVALUE_MIN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SpinValueMin" ) )
+#define FM_PROP_SPINVALUE_MAX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SpinValueMax" ) )
+#define FM_PROP_DEFAULT_SPINVALUE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultSpinValue" ) )
+#define FM_PROP_SPININCREMENT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SpinIncrement" ) )
+#define FM_PROP_LINEENDFORMAT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LineEndFormat" ) )
+#define FM_PROP_TOGGLE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Toggle" ) )
+#define FM_PROP_FOCUSONCLICK rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FocusOnClick" ) )
+#define FM_PROP_HIDEINACTIVESELECTION rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HideInactiveSelection" ) )
+#define FM_PROP_VISUALEFFECT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VisualEffect" ) )
+#define FM_PROP_BORDERCOLOR rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BorderColor" ) )
+#define FM_PROP_DYNAMIC_CONTROL_BORDER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DynamicControlBorder" ) )
+#define FM_PROP_CONTROL_BORDER_COLOR_FOCUS rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlBorderColorOnFocus" ) )
+#define FM_PROP_CONTROL_BORDER_COLOR_MOUSE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlBorderColorOnHover" ) )
+#define FM_PROP_CONTROL_BORDER_COLOR_INVALID rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlBorderColorOnInvalid" ) )
+#define FM_PROP_BUTTON_TYPE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ButtonType" ) )
+#define FM_PROP_FORM_OPERATIONS rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FormOperations" ) )
+#define FM_PROP_INPUT_REQUIRED rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InputRequired" ) )
+#define FM_PROP_WRITING_MODE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "WritingMode" ) )
+#define FM_PROP_MOUSE_WHEEL_BEHAVIOR rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MouseWheelBehavior" ) )
+#define FM_PROP_DESCRIPTION rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Description" ) )
+
+#endif // _SVX_FMPROP_HRC
diff --git a/svx/source/inc/fmscriptingenv.hxx b/svx/source/inc/fmscriptingenv.hxx
new file mode 100644
index 000000000000..5834c43713ff
--- /dev/null
+++ b/svx/source/inc/fmscriptingenv.hxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_FMSCRIPTINGENV_HXX
+#define SVX_FMSCRIPTINGENV_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/script/XEventAttacherManager.hpp>
+/** === end UNO includes === **/
+#include <rtl/ref.hxx>
+
+class FmFormModel;
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ //====================================================================
+ //= IFormScriptingEnvironment
+ //====================================================================
+ /** describes the interface implemented by a component which handles scripting requirements
+ in a form/control environment.
+ */
+ class SAL_NO_VTABLE IFormScriptingEnvironment : public ::rtl::IReference
+ {
+ public:
+ /** registers an XEventAttacherManager whose events should be monitored and handled
+
+ @param _rxManager
+ the XEventAttacherManager to monitor. Must not be <NULL/>.
+
+ @throws ::com::sun::star::lang::IllegalArgumentException
+ if <arg>_rxManager</arg> is <NULL/>
+ @throws ::com::sun::star::lang::DisposedException
+ if the instance is already disposed
+ @throws ::com::sun::star::uno::RuntimeException
+ if attaching as script listener to the manager fails with a RuntimeException itself
+ */
+ virtual void registerEventAttacherManager(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::script::XEventAttacherManager >& _rxManager ) = 0;
+
+ /** registers an XEventAttacherManager whose events should not be monitored and handled anymore
+
+ @param _rxManager
+ the XEventAttacherManager which was previously registered. Must not ne <NULL/>.
+
+ @throws ::com::sun::star::lang::IllegalArgumentException
+ if <arg>_rxManager</arg> is <NULL/>
+ @throws ::com::sun::star::lang::DisposedException
+ if the instance is already disposed
+ @throws ::com::sun::star::uno::RuntimeException
+ if removing as script listener from the manager fails with a RuntimeException itself
+ */
+ virtual void revokeEventAttacherManager(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::script::XEventAttacherManager >& _rxManager ) = 0;
+
+ /** disposes the scripting environment instance
+ */
+ virtual void dispose() = 0;
+
+ virtual ~IFormScriptingEnvironment();
+ };
+ typedef ::rtl::Reference< IFormScriptingEnvironment > PFormScriptingEnvironment;
+
+ //====================================================================
+ /** creates a default component implementing the IFormScriptingEnvironment interface
+ */
+ PFormScriptingEnvironment createDefaultFormScriptingEnvironment( FmFormModel& _rFormModel );
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
+#endif // SVX_FMSCRIPTINGENV_HXX
+
diff --git a/svx/source/inc/fmservs.hxx b/svx/source/inc/fmservs.hxx
new file mode 100644
index 000000000000..d90774cea4ee
--- /dev/null
+++ b/svx/source/inc/fmservs.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FMSERVS_HXX
+#define _SVX_FMSERVS_HXX
+
+#include <svx/svxdllapi.h>
+
+#define FM_NUMBER_FORMATTER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.NumberFormatter" ) )
+#define FM_COMPONENT_EDIT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.Edit" ) )
+#define FM_COMPONENT_TEXTFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.TextField" ) )
+#define FM_COMPONENT_LISTBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.ListBox" ) )
+#define FM_COMPONENT_COMBOBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.ComboBox" ) )
+#define FM_COMPONENT_RADIOBUTTON rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.RadioButton" ) )
+#define FM_COMPONENT_GROUPBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.GroupBox" ) )
+#define FM_COMPONENT_FIXEDTEXT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.FixedText" ) )
+#define FM_COMPONENT_COMMANDBUTTON rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.CommandButton" ) )
+#define FM_COMPONENT_CHECKBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.CheckBox" ) )
+#define FM_COMPONENT_GRID rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.Grid" ) )
+#define FM_COMPONENT_GRIDCONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.GridControl" ) )
+#define FM_COMPONENT_IMAGEBUTTON rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.ImageButton" ) )
+#define FM_COMPONENT_FILECONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.FileControl" ) )
+#define FM_COMPONENT_TIMEFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.TimeField" ) )
+#define FM_COMPONENT_DATEFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.DateField" ) )
+#define FM_COMPONENT_NUMERICFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.NumericField" ) )
+#define FM_COMPONENT_CURRENCYFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.CurrencyField" ) )
+#define FM_COMPONENT_PATTERNFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.PatternField" ) )
+#define FM_COMPONENT_FORMATTEDFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.FormattedField" ) )
+#define FM_COMPONENT_HIDDEN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.Hidden" ) )
+#define FM_COMPONENT_HIDDENCONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.HiddenControl" ) )
+#define FM_COMPONENT_IMAGECONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.component.ImageControl" ) )
+#define FM_CONTROL_GRID rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.control.Grid" ) )
+#define FM_CONTROL_GRIDCONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.control.GridControl" ) )
+#define FM_FORM_CONTROLLER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.runtime.FormController" ) )
+#define SRV_SDB_CONNECTION rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.Connection" ) )
+#define FM_SUN_COMPONENT_FORM rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.Form" ) )
+#define FM_SUN_COMPONENT_TEXTFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.TextField" ) )
+#define FM_SUN_COMPONENT_LISTBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.ListBox" ) )
+#define FM_SUN_COMPONENT_COMBOBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.ComboBox" ) )
+#define FM_SUN_COMPONENT_RADIOBUTTON rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.RadioButton" ) )
+#define FM_SUN_COMPONENT_GROUPBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.GroupBox" ) )
+#define FM_SUN_COMPONENT_FIXEDTEXT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.FixedText" ) )
+#define FM_SUN_COMPONENT_COMMANDBUTTON rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.CommandButton" ) )
+#define FM_SUN_COMPONENT_CHECKBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.CheckBox" ) )
+#define FM_SUN_COMPONENT_GRIDCONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.GridControl" ) )
+#define FM_SUN_COMPONENT_IMAGEBUTTON rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.ImageButton" ) )
+#define FM_SUN_COMPONENT_FILECONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.FileControl" ) )
+#define FM_SUN_COMPONENT_TIMEFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.TimeField" ) )
+#define FM_SUN_COMPONENT_DATEFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.DateField" ) )
+#define FM_SUN_COMPONENT_NUMERICFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.NumericField" ) )
+#define FM_SUN_COMPONENT_CURRENCYFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.CurrencyField" ) )
+#define FM_SUN_COMPONENT_PATTERNFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.PatternField" ) )
+#define FM_SUN_COMPONENT_HIDDENCONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.HiddenControl" ) )
+#define FM_SUN_COMPONENT_IMAGECONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.DatabaseImageControl" ) )
+#define FM_SUN_COMPONENT_FORMATTEDFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.FormattedField" ) )
+#define FM_SUN_COMPONENT_SCROLLBAR rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.ScrollBar" ) )
+#define FM_SUN_COMPONENT_SPINBUTTON rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.SpinButton" ) )
+#define FM_SUN_COMPONENT_NAVIGATIONBAR rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.NavigationToolBar" ) )
+#define FM_SUN_CONTROL_GRIDCONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.control.GridControl" ) )
+
+namespace svxform
+{
+ SVX_DLLPUBLIC void ImplSmartRegisterUnoServices();
+} // namespace svxform
+
+#endif // _SVX_FMSERVS_HXX
+
diff --git a/svx/source/inc/fmshimp.hxx b/svx/source/inc/fmshimp.hxx
new file mode 100644
index 000000000000..73fe666c3528
--- /dev/null
+++ b/svx/source/inc/fmshimp.hxx
@@ -0,0 +1,608 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FMSHIMP_HXX
+#define _SVX_FMSHIMP_HXX
+
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#include <com/sun/star/sdb/XSQLQueryComposer.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/container/ContainerEvent.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/form/XForm.hpp>
+#include <com/sun/star/form/runtime/XFormController.hpp>
+#include <com/sun/star/form/XFormComponent.hpp>
+#include <com/sun/star/form/NavigationBarMode.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/view/XSelectionChangeListener.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XFastPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/beans/PropertyChangeEvent.hpp>
+#include <com/sun/star/form/runtime/FeatureState.hpp>
+#include <vcl/timer.hxx>
+#include <sfx2/app.hxx>
+#include <svx/svdmark.hxx>
+#include <svx/fmsearch.hxx>
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+#include <svl/svarray.hxx>
+#include <svl/lstner.hxx>
+
+#define _SVSTDARR_BOOLS
+#define _SVSTDARR_BYTES
+#define _SVSTDARR_LONGS
+#define _SVSTDARR_ULONGS
+#define _SVSTDARR_USHORTS
+#include <svl/svstdarr.hxx>
+#include <sfx2/mnuitem.hxx>
+#include "svx/fmtools.hxx"
+#include "svx/fmsrccfg.hxx"
+#include <osl/mutex.hxx>
+#include <vos/thread.hxx>
+#include <tools/debug.hxx>
+#include <cppuhelper/component.hxx>
+#include <comphelper/stl_types.hxx>
+#include <comphelper/container.hxx>
+#include <cppuhelper/compbase4.hxx>
+#include <cppuhelper/compbase6.hxx>
+#include <unotools/configitem.hxx>
+#include "svx/dbtoolsclient.hxx"
+#include "formcontrolling.hxx"
+#include "fmdocumentclassification.hxx"
+
+#include <queue>
+#include <set>
+#include <vector>
+
+SV_DECL_PTRARR(SdrObjArray, SdrObject*, 32, 16)
+// SV_DECL_OBJARR(FmFormArray, ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>, 32, 16);
+DECLARE_STL_VECTOR( ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > ,FmFormArray);
+
+// catch databse exceptions if occur
+#define DO_SAFE(statement) try { statement; } catch( const Exception& ) { DBG_ERROR("unhandled exception (I tried to move a cursor (or something like that).)"); }
+
+#define GA_DISABLE_SYNC 1
+#define GA_FORCE_SYNC 2
+#define GA_ENABLE_SYNC 3
+#define GA_SYNC_MASK 3
+#define GA_DISABLE_ROCTRLR 4
+#define GA_ENABLE_ROCTRLR 8
+
+
+// flags for controlling the behaviour when calling loadForms
+#define FORMS_LOAD 0x0000 // default: simply load
+#define FORMS_SYNC 0x0000 // default: do in synchronous
+
+#define FORMS_UNLOAD 0x0001 // unload
+#define FORMS_ASYNC 0x0002 // do this async
+
+//==============================================================================
+// a class iterating through all fields of a form which are bound to a field
+// sub forms are ignored, grid columns (where the grid is a direct child of the form) are included
+class SAL_DLLPRIVATE FmXBoundFormFieldIterator : public ::comphelper::IndexAccessIterator
+{
+public:
+ FmXBoundFormFieldIterator(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rStartingPoint) : ::comphelper::IndexAccessIterator(_rStartingPoint) { }
+
+protected:
+ virtual sal_Bool ShouldHandleElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rElement);
+ virtual sal_Bool ShouldStepInto(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rContainer) const;
+};
+
+class FmFormPage;
+//========================================================================
+struct SAL_DLLPRIVATE FmLoadAction
+{
+ FmFormPage* pPage;
+ sal_uLong nEventId;
+ sal_uInt16 nFlags;
+
+ FmLoadAction( ) : pPage( NULL ), nEventId( 0 ), nFlags( 0 ) { }
+ FmLoadAction( FmFormPage* _pPage, sal_uInt16 _nFlags, sal_uLong _nEventId )
+ :pPage( _pPage ), nEventId( _nEventId ), nFlags( _nFlags )
+ {
+ }
+};
+
+//========================================================================
+class SfxViewFrame;
+typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::beans::XPropertyChangeListener
+ , ::com::sun::star::container::XContainerListener
+ , ::com::sun::star::view::XSelectionChangeListener
+ , ::com::sun::star::form::XFormControllerListener
+ > FmXFormShell_BD_BASE;
+
+//========================================================================
+class SAL_DLLPRIVATE FmXFormShell_Base_Disambiguation : public FmXFormShell_BD_BASE
+{
+ using ::com::sun::star::beans::XPropertyChangeListener::disposing;
+protected:
+ FmXFormShell_Base_Disambiguation( ::osl::Mutex& _rMutex );
+ virtual void SAL_CALL disposing();
+};
+
+//========================================================================
+namespace svx
+{
+ class FmTextControlShell;
+}
+
+//========================================================================
+typedef FmXFormShell_Base_Disambiguation FmXFormShell_BASE;
+typedef ::utl::ConfigItem FmXFormShell_CFGBASE;
+
+struct SdrViewEvent;
+class FmFormShell;
+class FmFormView;
+class FmFormObj;
+class SAL_DLLPRIVATE FmXFormShell :public FmXFormShell_BASE
+ ,public FmXFormShell_CFGBASE
+ ,public ::svxform::OStaticDataAccessTools
+ ,public ::svx::IControllerFeatureInvalidation
+{
+ friend class FmFormView;
+ friend class FmXFormView;
+ friend class WizardUsageConfigItem;
+
+ class SuspendPropertyTracking;
+ friend class SuspendPropertyTracking;
+
+ // Timer um verzoegerte Markierung vorzunehmen
+ Timer m_aMarkTimer;
+ SdrObjArray m_arrSearchedControls;
+ // We enable a permanent cursor for the grid we found a searched text, it's disabled in the next "found" event.
+ FmFormArray m_aSearchForms;
+
+ SvUShorts m_arrInvalidSlots;
+ SvBytes m_arrInvalidSlots_Flags;
+ // we explicitly switch off the propbrw before leaving the design mode
+ // this flag tells us if we have to switch it on again when reentering
+
+ ::osl::Mutex m_aAsyncSafety;
+ // secure the access to our thread related members
+ ::osl::Mutex m_aInvalidationSafety;
+ // secure the access to all our slot invalidation related members
+
+ ::com::sun::star::form::NavigationBarMode m_eNavigate; // Art der Navigation
+
+ // da ich beim Suchen fuer die Behandlung des "gefunden" ein SdrObject markieren will, besorge ich mir vor dem
+ // Hochreissen des Suchen-Dialoges alle relevanten Objekte
+ // (das Array ist damit auch nur waehrend des Suchvorganges gueltig)
+ SvLongs m_arrRelativeGridColumn;
+
+ ::osl::Mutex m_aMutex;
+ sal_uLong m_nInvalidationEvent;
+ sal_uLong m_nActivationEvent;
+ ::std::queue< FmLoadAction >
+ m_aLoadingPages;
+
+ FmFormShell* m_pShell;
+ ::svx::FmTextControlShell* m_pTextShell;
+
+ ::svx::ControllerFeatures m_aActiveControllerFeatures;
+ ::svx::ControllerFeatures m_aNavControllerFeatures;
+
+ // aktuelle Form, Controller
+ // nur im alive mode verfuegbar
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > m_xActiveController;
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > m_xNavigationController;
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > m_xActiveForm;
+
+ // Aktueller container einer Page
+ // nur im designmode verfuegbar
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> m_xForms;
+
+ // the currently selected objects, as to be displayed in the property browser
+ InterfaceBag m_aCurrentSelection;
+ /// the currently selected form, or the form which all currently selected controls belong to, or <NULL/>
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > m_xCurrentForm;
+ /// the last selection/marking of controls only. Necessary to implement the "Control properties" slot
+ InterfaceBag m_aLastKnownMarkedControls;
+
+
+ // und das ist ebenfalls fuer's 'gefunden' : Beim Finden in GridControls brauche ich die Spalte, bekomme aber
+ // nur die Nummer des Feldes, die entspricht der Nummer der Spalte + <offset>, wobei der Offset von der Position
+ // des GridControls im Formular abhaengt. Also hier eine Umrechnung.
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel> m_xLastGridFound;
+ // the frame we live in
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame> m_xAttachedFrame;
+ // Administration of external form views (see the SID_FM_VIEW_AS_GRID-slot)
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > m_xExternalViewController; // the controller for the external form view
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > m_xExtViewTriggerController; // the nav controller at the time the external display was triggered
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > m_xExternalDisplayedForm; // the form which the external view is based on
+
+ mutable ::svxform::DocumentType
+ m_eDocumentType; /// the type of document we're living in
+ sal_Int16 m_nLockSlotInvalidation;
+ sal_Bool m_bHadPropertyBrowserInDesignMode : 1;
+
+ sal_Bool m_bTrackProperties : 1;
+ // soll ich (bzw. der Owner diese Impl-Klasse) mich um die Aktualisierung des ::com::sun::star::beans::Property-Browsers kuemmern ?
+
+ sal_Bool m_bUseWizards : 1;
+
+ sal_Bool m_bDatabaseBar : 1; // Gibt es eine Datenbankleiste
+ sal_Bool m_bInActivate : 1; // Wird ein Controller aktiviert
+ sal_Bool m_bSetFocus : 1; // Darf der Focus umgesetzt werden
+ sal_Bool m_bFilterMode : 1; // Wird gerade ein Filter auf die Controls angesetzt
+ sal_Bool m_bChangingDesignMode:1; // sal_True within SetDesignMode
+ sal_Bool m_bPreparedClose : 1; // for the current modification state of the current form
+ // PrepareClose had been called and the user denied to save changes
+ sal_Bool m_bFirstActivation : 1; // has the shell ever been activated?
+
+public:
+ // attribute access
+ inline const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >&
+ getHostFrame() const { return m_xAttachedFrame; }
+ inline const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >&
+ getExternallyDisplayedForm() const { return m_xExternalDisplayedForm; }
+
+ inline sal_Bool
+ didPrepareClose() const { return m_bPreparedClose; }
+ inline void
+ didPrepareClose( sal_Bool _bDid ) { m_bPreparedClose = _bDid; }
+
+public:
+ FmXFormShell(FmFormShell& _rShell, SfxViewFrame* _pViewFrame);
+
+ // UNO Anbindung
+ DECLARE_UNO3_DEFAULTS(FmXFormShell, FmXFormShell_BASE);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& type) throw ( ::com::sun::star::uno::RuntimeException );
+
+protected:
+ ~FmXFormShell();
+
+// XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+
+// EventListener
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException );
+
+// ::com::sun::star::container::XContainerListener
+ virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException );
+
+// XSelectionChangeListener
+ virtual void SAL_CALL selectionChanged(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException );
+
+// ::com::sun::star::beans::XPropertyChangeListener
+ virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw( ::com::sun::star::uno::RuntimeException );
+
+// ::com::sun::star::form::XFormControllerListener
+ virtual void SAL_CALL formActivated(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL formDeactivated(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException );
+
+// OComponentHelper
+ virtual void SAL_CALL disposing();
+
+public:
+ void EnableTrackProperties( sal_Bool bEnable) { m_bTrackProperties = bEnable; }
+ sal_Bool IsTrackPropertiesEnabled() {return m_bTrackProperties;}
+
+ // activation handling
+ void viewActivated( FmFormView& _rCurrentView, sal_Bool _bSyncAction = sal_False );
+ void viewDeactivated( FmFormView& _rCurrentView, sal_Bool _bDeactivateController = sal_True );
+
+ // IControllerFeatureInvalidation
+ virtual void invalidateFeatures( const ::std::vector< sal_Int32 >& _rFeatures );
+
+ void ExecuteTabOrderDialog( // execute SID_FM_TAB_DIALOG
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel >& _rxForForm
+ );
+
+ // stuff
+ void AddElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
+ void RemoveElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
+
+ /** updates m_xForms, to be either <NULL/>, if we're in alive mode, or our current page's forms collection,
+ if in design mode
+ */
+ void UpdateForms( sal_Bool _bInvalidate );
+
+ void ExecuteSearch(); // execute SID_FM_SEARCH
+ void CreateExternalView(); // execute SID_FM_VIEW_AS_GRID
+
+ sal_Bool GetY2KState(sal_uInt16& n);
+ void SetY2KState(sal_uInt16 n);
+
+protected:
+ // activation handling
+ inline sal_Bool hasEverBeenActivated( ) const { return !m_bFirstActivation; }
+ inline void setHasBeenActivated( ) { m_bFirstActivation = sal_False; }
+
+ // form handling
+ /// load or unload the forms on a page
+ void loadForms( FmFormPage* _pPage, const sal_uInt16 _nBehaviour = FORMS_LOAD | FORMS_SYNC );
+ void smartControlReset( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& _rxModels );
+
+
+ void startListening();
+ void stopListening();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >
+ impl_getControl(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel>& i_rxModel,
+ const FmFormObj& i_rKnownFormObj
+ );
+
+ // sammelt in strNames die Namen aller Formulare
+ static void impl_collectFormSearchContexts_nothrow(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rxStartingPoint,
+ const ::rtl::OUString& _rCurrentLevelPrefix,
+ FmFormArray& _out_rForms,
+ ::std::vector< String >& _out_rNames );
+
+ /** checks whether the instance is already disposed, if so, this is reported as assertion error (debug
+ builds only) and <TRUE/> is returned.
+ */
+ bool impl_checkDisposed() const;
+
+public:
+ // methode fuer nicht designmode (alive mode)
+ void setActiveController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController>& _xController, sal_Bool _bNoSaveOldContent = sal_False );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController>& getActiveController() const {return m_xActiveController;}
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController>& getActiveInternalController() const { return m_xActiveController == m_xExternalViewController ? m_xExtViewTriggerController : m_xActiveController; }
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>& getActiveForm() const {return m_xActiveForm;}
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController>& getNavController() const {return m_xNavigationController;}
+
+ inline const ::svx::ControllerFeatures& getActiveControllerFeatures() const
+ { return m_aActiveControllerFeatures; }
+ inline const ::svx::ControllerFeatures& getNavControllerFeatures() const
+ { return m_aNavControllerFeatures.isAssigned() ? m_aNavControllerFeatures : m_aActiveControllerFeatures; }
+
+ /** announces a new "current selection"
+ @return
+ <TRUE/> if and only if the to-bet-set selection was different from the previous selection
+ */
+ bool setCurrentSelection( const InterfaceBag& _rSelection );
+
+ /** sets the new selection to the last known marked controls
+ */
+ bool selectLastMarkedControls();
+
+ /** retrieves the current selection
+ */
+ SVX_DLLPUBLIC void getCurrentSelection( InterfaceBag& /* [out] */ _rSelection ) const;
+
+ /** sets a new current selection as indicated by a mark list
+ @return
+ <TRUE/> if and only if the to-bet-set selection was different from the previous selection
+ */
+ bool setCurrentSelectionFromMark(const SdrMarkList& rMarkList);
+
+ /// returns the currently selected form, or the form which all currently selected controls belong to, or <NULL/>
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >
+ getCurrentForm() const { return m_xCurrentForm; }
+ void forgetCurrentForm();
+ /// returns whether the last known marking contained only controls
+ sal_Bool onlyControlsAreMarked() const { return !m_aLastKnownMarkedControls.empty(); }
+
+ /// determines whether the current selection consists of exactly the given object
+ bool isSolelySelected(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxObject
+ );
+
+ /// handles a MouseButtonDown event of the FmFormView
+ void handleMouseButtonDown( const SdrViewEvent& _rViewEvent );
+ /// handles the request for showing the "Properties"
+ void handleShowPropertiesRequest();
+
+ sal_Bool hasForms() const {return m_xForms.is() && m_xForms->getCount() != 0;}
+ sal_Bool hasDatabaseBar() const {return m_bDatabaseBar;}
+ sal_Bool canNavigate() const {return m_xNavigationController.is();}
+
+ void ShowSelectionProperties( sal_Bool bShow );
+ sal_Bool IsPropBrwOpen() const;
+
+ void DetermineSelection(const SdrMarkList& rMarkList);
+ void SetSelection(const SdrMarkList& rMarkList);
+ void SetSelectionDelayed();
+
+ void SetDesignMode(sal_Bool bDesign);
+
+ sal_Bool GetWizardUsing() const { return m_bUseWizards; }
+ void SetWizardUsing(sal_Bool _bUseThem);
+
+ // Setzen des Filtermodus
+ sal_Bool isInFilterMode() const {return m_bFilterMode;}
+ void startFiltering();
+ void stopFiltering(sal_Bool bSave);
+ void clearFilter();
+
+ static PopupMenu* GetConversionMenu();
+ // ein Menue, das alle ControlConversion-Eintraege enthaelt
+
+ /// checks whethere a given control conversion slot can be applied to the current selection
+ bool canConvertCurrentSelectionToControl( sal_Int16 nConversionSlot );
+ /// enables or disables all conversion slots in a menu, according to the current selection
+ void checkControlConversionSlotsForCurrentSelection( Menu& rMenu );
+ /// executes a control conversion slot for a given object
+ bool executeControlConversionSlot( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& _rxObject, sal_uInt16 _nSlotId );
+ /** executes a control conversion slot for the current selection
+ @precond canConvertCurrentSelectionToControl( <arg>_nSlotId</arg> ) must return <TRUE/>
+ */
+ bool executeControlConversionSlot( sal_uInt16 _nSlotId );
+ /// checks whether the given slot id denotes a control conversion slot
+ static bool isControlConversionSlot( sal_uInt16 _nSlotId );
+
+ void ExecuteTextAttribute( SfxRequest& _rReq );
+ void GetTextAttributeState( SfxItemSet& _rSet );
+ bool IsActiveControl( bool _bCountRichTextOnly = false ) const;
+ void ForgetActiveControl();
+ void SetControlActivationHandler( const Link& _rHdl );
+
+ /// classifies our host document
+ ::svxform::DocumentType
+ getDocumentType() const;
+ bool isEnhancedForm() const;
+
+ /// determines whether our host document is currently read-only
+ bool IsReadonlyDoc() const;
+
+ // das Setzen des curObject/selObject/curForm erfolgt verzoegert (SetSelectionDelayed), mit den folgenden
+ // Funktionen laesst sich das abfragen/erzwingen
+ inline sal_Bool IsSelectionUpdatePending();
+ void ForceUpdateSelection(sal_Bool bLockInvalidation);
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel> getContextDocument() const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> getInternalForm(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>& _xForm) const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> getInternalForm(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xForm) const;
+ // if the form belongs to the controller (extern) displaying a grid, the according internal form will
+ // be displayed, _xForm else
+
+ // check if the current control of the active controler has the focus
+ bool HasControlFocus() const;
+
+private:
+ DECL_LINK(OnFoundData, FmFoundRecordInformation*);
+ DECL_LINK(OnCanceledNotFound, FmFoundRecordInformation*);
+ DECL_LINK(OnSearchContextRequest, FmSearchContext*);
+ DECL_LINK(OnTimeOut, void*);
+ DECL_LINK(OnFirstTimeActivation, void*);
+ DECL_LINK(OnFormsCreated, FmFormPage*);
+
+ void LoopGrids(sal_Int16 nWhat);
+
+ // Invalidierung von Slots
+ void InvalidateSlot( sal_Int16 nId, sal_Bool bWithId );
+ void UpdateSlot( sal_Int16 nId );
+ // Locking der Invalidierung - wenn der interne Locking-Counter auf 0 geht, werden alle aufgelaufenen Slots
+ // (asynchron) invalidiert
+ void LockSlotInvalidation(sal_Bool bLock);
+
+ DECL_LINK(OnInvalidateSlots, void*);
+
+ void CloseExternalFormViewer();
+ // closes the task-local beamer displaying a grid view for a form
+
+ // ConfigItem related stuff
+ virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames);
+ virtual void Commit();
+ void implAdjustConfigCache();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >
+ getControlContainerForView();
+
+ /** finds and sets a default for m_xCurrentForm, if it is currently NULL
+ */
+ void impl_defaultCurrentForm_nothrow();
+
+ /** sets m_xCurrentForm to the provided form, and udpates everything which
+ depends on the current form
+ */
+ void impl_updateCurrentForm( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxNewCurForm );
+
+ /** adds or removes ourself as XEventListener at m_xActiveController
+ */
+ void impl_switchActiveControllerListening( const bool _bListen );
+
+ /** add an element
+ */
+ void impl_AddElement_nothrow(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
+
+ /** remove an element
+ */
+ void impl_RemoveElement_nothrow(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
+
+ // ---------------------------------------------------
+ // asyncronous cursor actions/navigation slot handling
+
+public:
+ /** execute the given form slot
+ <p>Warning. Only a small set of slots implemented currently.</p>
+ @param _nSlot
+ the slot to execute
+ */
+ void ExecuteFormSlot( sal_Int32 _nSlot );
+
+ /** determines whether the current form slot is currently enabled
+ */
+ bool IsFormSlotEnabled( sal_Int32 _nSlot, ::com::sun::star::form::runtime::FeatureState* _pCompleteState = NULL );
+
+protected:
+ DECL_LINK( OnLoadForms, FmFormPage* );
+};
+
+//------------------------------------------------------------------------------
+inline sal_Bool FmXFormShell::IsSelectionUpdatePending()
+{
+ return m_aMarkTimer.IsActive();
+}
+
+// ========================================================================
+// = ein Iterator, der ausgehend von einem Interface ein Objekt sucht, dessen
+// = ::com::sun::star::beans::Property-Set eine ControlSource- sowie eine BoundField-Eigenschaft hat,
+// = wobei letztere einen Wert ungleich NULL haben muss.
+// = Wenn das Interface selber diese Bedingung nicht erfuellt, wird getestet,
+// = ob es ein Container ist (also ueber eine ::com::sun::star::container::XIndexAccess verfuegt), dann
+// = wird dort abgestiegen und fuer jedes Element des Containers das selbe
+// = versucht (wiederum eventuell mit Abstieg).
+// = Wenn irgendein Objekt dabei die geforderte Eigenschaft hat, entfaellt
+// = der Teil mit dem Container-Test fuer dieses Objekt.
+// =
+
+class SAL_DLLPRIVATE SearchableControlIterator : public ::comphelper::IndexAccessIterator
+{
+ ::rtl::OUString m_sCurrentValue;
+ // der aktuelle Wert der ControlSource-::com::sun::star::beans::Property
+
+public:
+ ::rtl::OUString getCurrentValue() const { return m_sCurrentValue; }
+
+public:
+ SearchableControlIterator(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> xStartingPoint);
+
+ virtual sal_Bool ShouldHandleElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& rElement);
+ virtual sal_Bool ShouldStepInto(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& xContainer) const;
+ virtual void Invalidate() { IndexAccessIterator::Invalidate(); m_sCurrentValue = ::rtl::OUString(); }
+};
+
+// ========================================================================
+SV_DECL_PTRARR_DEL(StatusForwarderArray, SfxStatusForwarder*, 16, 0)
+class SVX_DLLPUBLIC ControlConversionMenuController : public SfxMenuControl
+{
+protected:
+ StatusForwarderArray m_aStatusForwarders;
+ Menu* m_pMainMenu;
+ PopupMenu* m_pConversionMenu;
+
+public:
+ SVX_DLLPRIVATE ControlConversionMenuController(sal_uInt16 nId, Menu& rMenu, SfxBindings& rBindings);
+ SVX_DLLPRIVATE virtual ~ControlConversionMenuController();
+ SFX_DECL_MENU_CONTROL();
+
+ SVX_DLLPRIVATE virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState);
+};
+
+#endif // _SVX_FMSHIMP_HXX
diff --git a/svx/source/inc/fmslotinvalidator.hxx b/svx/source/inc/fmslotinvalidator.hxx
new file mode 100644
index 000000000000..d37099f40cf4
--- /dev/null
+++ b/svx/source/inc/fmslotinvalidator.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_SOURCE_INC_FMSLOTINVALIDATOR_HXX
+#define SVX_SOURCE_INC_FMSLOTINVALIDATOR_HXX
+
+#include <tools/solar.h>
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ typedef sal_uInt16 SfxSlotId;
+
+ //====================================================================
+ //= ISlotInvalidator
+ //====================================================================
+ class ISlotInvalidator
+ {
+ public:
+ virtual void Invalidate( SfxSlotId _nSlot ) = 0;
+ };
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+#endif // SVX_SOURCE_INC_FMSLOTINVALIDATOR_HXX
+
+
diff --git a/svx/source/inc/fmtextcontroldialogs.hxx b/svx/source/inc/fmtextcontroldialogs.hxx
new file mode 100644
index 000000000000..2b6ccb09d89d
--- /dev/null
+++ b/svx/source/inc/fmtextcontroldialogs.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_SOURCE_FORM_FMTEXTCONTROLDIALOGS_HXX
+#define SVX_SOURCE_FORM_FMTEXTCONTROLDIALOGS_HXX
+
+#include <sfx2/sfxsids.hrc>
+#include <sfx2/tabdlg.hxx>
+#include <editeng/flstitem.hxx>
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ //====================================================================
+ //= TextControlCharAttribDialog
+ //====================================================================
+ class TextControlCharAttribDialog : public SfxTabDialog
+ {
+ private:
+ SvxFontListItem m_aFontList;
+
+ public:
+ TextControlCharAttribDialog( Window* pParent, const SfxItemSet& _rCoreSet, const SvxFontListItem& _rFontList );
+ ~TextControlCharAttribDialog();
+
+ protected:
+ virtual void PageCreated( sal_uInt16 _nId, SfxTabPage& _rPage );
+ };
+
+ //====================================================================
+ //= TextControlParaAttribDialog
+ //====================================================================
+ class TextControlParaAttribDialog : public SfxTabDialog
+ {
+ public:
+ TextControlParaAttribDialog( Window* _pParent, const SfxItemSet& _rCoreSet );
+ ~TextControlParaAttribDialog();
+ };
+//........................................................................
+} // namespace svx
+//........................................................................
+
+#endif // SVX_SOURCE_FORM_FMTEXTCONTROLDIALOGS_HXX
+
diff --git a/svx/source/inc/fmtextcontrolfeature.hxx b/svx/source/inc/fmtextcontrolfeature.hxx
new file mode 100644
index 000000000000..6b557d4b9840
--- /dev/null
+++ b/svx/source/inc/fmtextcontrolfeature.hxx
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_SOURCE_INC_FMTEXTCONTROLFEATURE_HXX
+#define SVX_SOURCE_INC_FMTEXTCONTROLFEATURE_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/util/URL.hpp>
+/** === end UNO includes === **/
+#include <cppuhelper/implbase1.hxx>
+#include "fmslotinvalidator.hxx"
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ //====================================================================
+ //= FmTextControlFeature
+ //====================================================================
+ typedef ::cppu::WeakImplHelper1 < ::com::sun::star::frame::XStatusListener
+ > FmTextControlFeature_Base;
+
+ class FmTextControlFeature : public FmTextControlFeature_Base
+ {
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >
+ m_xDispatcher;
+ ::com::sun::star::util::URL m_aFeatureURL;
+ ::com::sun::star::uno::Any m_aFeatureState;
+ SfxSlotId m_nSlotId;
+ ISlotInvalidator* m_pInvalidator;
+ bool m_bFeatureEnabled;
+
+ public:
+ /** constructs an FmTextControlFeature object
+ @param _rxDispatcher
+ the dispatcher which the instance should work with
+ @param _rFeatureURL
+ the URL which the instance should be responsible for
+ */
+ FmTextControlFeature(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _rxDispatcher,
+ const ::com::sun::star::util::URL& _rFeatureURL,
+ SfxSlotId _nId,
+ ISlotInvalidator* _pInvalidator
+ );
+
+ /// determines whether the feature we're responsible for is currently enabled
+ inline bool isFeatureEnabled( ) const { return m_bFeatureEnabled; }
+ inline const ::com::sun::star::uno::Any& getFeatureState( ) const { return m_aFeatureState; }
+
+ /** dispatches the feature URL to the dispatcher
+ */
+ void dispatch() const SAL_THROW(());
+
+ /** dispatches the feature URL to the dispatcher, with passing the given arguments
+ */
+ void dispatch( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArgs ) const SAL_THROW(());
+
+ /// releases any resources associated with this instance
+ void dispose() SAL_THROW(());
+
+ protected:
+ ~FmTextControlFeature();
+
+ protected:
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& State ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+ };
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+#endif // SVX_SOURCE_INC_FMTEXTCONTROLFEATURE_HXX
+
diff --git a/svx/source/inc/fmtextcontrolshell.hxx b/svx/source/inc/fmtextcontrolshell.hxx
new file mode 100644
index 000000000000..0eb0d3020ce3
--- /dev/null
+++ b/svx/source/inc/fmtextcontrolshell.hxx
@@ -0,0 +1,224 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SVX_SOURCE_INC_FMTEXTCONTROLSHELL_HXX
+#define SVX_SOURCE_INC_FMTEXTCONTROLSHELL_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/awt/XTextComponent.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/awt/XFocusListener.hpp>
+#include <com/sun/star/awt/XMouseListener.hpp>
+#include <com/sun/star/form/runtime/XFormController.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+/** === end UNO includes === **/
+#include <comphelper/implementationreference.hxx>
+#include <tools/link.hxx>
+#include <vcl/timer.hxx>
+#include "fmslotinvalidator.hxx"
+
+#include <vector>
+#include <map>
+
+class SfxRequest;
+class SfxItemSet;
+class SfxAllItemSet;
+class SfxBindings;
+class SfxViewFrame;
+class Window;
+class SfxApplication;
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ class FmFocusListenerAdapter;
+ class FmTextControlFeature;
+ class FmMouseListenerAdapter;
+
+ //====================================================================
+ //= IFocusObserver
+ //====================================================================
+ class IFocusObserver
+ {
+ public:
+ virtual void focusGained( const ::com::sun::star::awt::FocusEvent& _rEvent ) = 0;
+ virtual void focusLost( const ::com::sun::star::awt::FocusEvent& _rEvent ) = 0;
+ };
+
+ //====================================================================
+ //= IFocusObserver
+ //====================================================================
+ class IContextRequestObserver
+ {
+ public:
+ virtual void contextMenuRequested( const ::com::sun::star::awt::MouseEvent& _rEvent ) = 0;
+ };
+
+ //====================================================================
+ //= FmTextControlShell
+ //====================================================================
+ class FmTextControlShell :public IFocusObserver
+ ,public ISlotInvalidator
+ ,public IContextRequestObserver
+ {
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > m_xActiveControl;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent > m_xActiveTextComponent;
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > m_xActiveController;
+#ifndef DONT_REMEMBER_LAST_CONTROL
+ // without this define, m_xActiveControl remembers the *last* active control, even
+ // if it, in the meantime, already lost the focus
+ bool m_bActiveControl;
+ // so we need an additional boolean flag telling whether the active cotrol
+ // is really focused
+#endif
+ bool m_bActiveControlIsReadOnly;
+ bool m_bActiveControlIsRichText;
+
+ // listening at all controls of the active controller for focus changes
+ typedef ::comphelper::ImplementationReference< FmFocusListenerAdapter, ::com::sun::star::awt::XFocusListener >
+ FocusListenerAdapter;
+ typedef ::std::vector< FocusListenerAdapter > FocusListenerAdapters;
+ FocusListenerAdapters m_aControlObservers;
+
+ typedef ::comphelper::ImplementationReference< FmMouseListenerAdapter, ::com::sun::star::awt::XMouseListener >
+ MouseListenerAdapter;
+ MouseListenerAdapter m_aContextMenuObserver;
+
+ // translating between "slots" of the framework and "features" of the active control
+ typedef ::comphelper::ImplementationReference< FmTextControlFeature, ::com::sun::star::frame::XStatusListener >
+ ControlFeature;
+ typedef ::std::map< SfxSlotId, ControlFeature, ::std::less< SfxSlotId > > ControlFeatures;
+ ControlFeatures m_aControlFeatures;
+
+ SfxViewFrame* m_pViewFrame;
+ // invalidating slots
+ SfxBindings& m_rBindings;
+ Link m_aControlActivationHandler;
+ AutoTimer m_aClipboardInvalidation;
+ bool m_bNeedClipboardInvalidation;
+
+ public:
+ FmTextControlShell( SfxViewFrame* _pFrame );
+ virtual ~FmTextControlShell();
+
+ // clean up any resources associated with this instance
+ void dispose();
+
+ void ExecuteTextAttribute( SfxRequest& _rReq );
+ void GetTextAttributeState( SfxItemSet& _rSet );
+ bool IsActiveControl( bool _bCountRichTextOnly = false ) const;
+ void ForgetActiveControl();
+ void SetControlActivationHandler( const Link& _rHdl ) { m_aControlActivationHandler = _rHdl; }
+
+ /** to be called when a form in our document has been activated
+ */
+ void formActivated( const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >& _rxController );
+ /** to be called when a form in our document has been deactivated
+ */
+ void formDeactivated( const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >& _rxController );
+
+ /** notifies the instance that the design mode has changed
+ */
+ void designModeChanged( bool _bNewDesignMode );
+
+ protected:
+ // IFocusObserver
+ virtual void focusGained( const ::com::sun::star::awt::FocusEvent& _rEvent );
+ virtual void focusLost( const ::com::sun::star::awt::FocusEvent& _rEvent );
+
+ // IContextRequestObserver
+ virtual void contextMenuRequested( const ::com::sun::star::awt::MouseEvent& _rEvent );
+
+ // ISlotInvalidator
+ virtual void Invalidate( SfxSlotId _nSlot );
+
+ protected:
+ enum AttributeSet { eCharAttribs, eParaAttribs };
+ void executeAttributeDialog( AttributeSet _eSet, SfxRequest& _rReq );
+ bool executeSelectAll( );
+ bool executeClipboardSlot( SfxSlotId _nSlot );
+
+ private:
+ inline bool isControllerListening() const { return !m_aControlObservers.empty(); }
+
+ FmTextControlFeature*
+ implGetFeatureDispatcher(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& _rxProvider,
+ SfxApplication* _pApplication,
+ SfxSlotId _nSlot
+ );
+
+ // fills the given structure with dispatchers for the given slots, for the given control
+ void fillFeatureDispatchers(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > _rxControl,
+ SfxSlotId* _pZeroTerminatedSlots,
+ ControlFeatures& _rDispatchers
+ );
+
+ /// creates SfxPoolItes for all features in the given set, and puts them into the given SfxAllItemSet
+ void transferFeatureStatesToItemSet(
+ ControlFeatures& _rDispatchers,
+ SfxAllItemSet& _rSet,
+ bool _bTranslateLatin = false
+ );
+
+ /// to be called when a control has been activated
+ void controlActivated( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
+ /// to be called when the currently active control has been deactivated
+ void controlDeactivated( );
+
+ void implClearActiveControlRef();
+
+ /** starts listening at all controls of the given controller for focus events
+ @precond
+ we don't have an active controller currently
+ */
+ void startControllerListening( const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >& _rxController );
+ /** stops listening at the active controller
+ @precond
+ we have an active controller currently
+ */
+ void stopControllerListening( );
+
+ /** parses the given URL's Complete member, by calling XURLTransformer::parseString
+ */
+ void impl_parseURL_nothrow( ::com::sun::star::util::URL& _rURL );
+
+ DECL_LINK( OnInvalidateClipboard, void* );
+ };
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+#endif // SVX_SOURCE_INC_FMTEXTCONTROLSHELL_HXX
+
diff --git a/svx/source/inc/fmundo.hxx b/svx/source/inc/fmundo.hxx
new file mode 100644
index 000000000000..fb82f02ca4b8
--- /dev/null
+++ b/svx/source/inc/fmundo.hxx
@@ -0,0 +1,230 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_FMUNDO_HXX
+#define _SVX_FMUNDO_HXX
+
+#include <svx/svdundo.hxx>
+#include <svx/svdouno.hxx>
+#include "fmscriptingenv.hxx"
+
+
+/** === begin UNO includes === **/
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/beans/PropertyChangeEvent.hpp>
+#include <com/sun/star/script/ScriptEvent.hpp>
+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <com/sun/star/container/ContainerEvent.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+/** === end UNO includes === **/
+#include <cppuhelper/implbase3.hxx>
+
+
+#include <svl/lstner.hxx>
+#include <comphelper/uno3.hxx>
+
+class FmFormModel;
+class FmFormObj;
+class SdrObject;
+class FmXFormView;
+
+FORWARD_DECLARE_INTERFACE(awt,XControl)
+FORWARD_DECLARE_INTERFACE(awt,XControlContainer)
+//FORWARD_DECLARE_INTERFACE(uno,Reference)
+
+//==================================================================
+// FmUndoPropertyAction
+//==================================================================
+class FmUndoPropertyAction: public SdrUndoAction
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xObj;
+ ::rtl::OUString aPropertyName;
+ ::com::sun::star::uno::Any aNewValue;
+ ::com::sun::star::uno::Any aOldValue;
+
+public:
+ FmUndoPropertyAction(FmFormModel& rMod, const ::com::sun::star::beans::PropertyChangeEvent& evt);
+
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual String GetComment() const;
+
+};
+
+//==================================================================
+// FmUndoContainerAction
+//==================================================================
+class FmUndoContainerAction: public SdrUndoAction
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >
+ m_xContainer; // container which the action applies to
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ m_xElement; // object not owned by the action
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ m_xOwnElement; // object owned by the action
+ sal_Int32 m_nIndex; // index of the object within it's container
+ ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >
+ m_aEvents; // events of the object
+
+public:
+ enum Action
+ {
+ Inserted = 1,
+ Removed = 2
+ };
+
+private:
+ Action m_eAction;
+
+public:
+ FmUndoContainerAction(FmFormModel& rMod,
+ Action _eAction,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& xCont,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xElem,
+ sal_Int32 nIdx = -1);
+ ~FmUndoContainerAction();
+
+ virtual void Undo();
+ virtual void Redo();
+
+ static void DisposeElement( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xElem );
+
+protected:
+ void implReInsert( ) SAL_THROW( ( ::com::sun::star::uno::Exception ) );
+ void implReRemove( ) SAL_THROW( ( ::com::sun::star::uno::Exception ) );
+};
+
+//==================================================================
+// FmUndoModelReplaceAction
+//==================================================================
+class FmUndoModelReplaceAction : public SdrUndoAction
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel> m_xReplaced;
+ SdrUnoObj* m_pObject;
+
+public:
+ FmUndoModelReplaceAction(FmFormModel& rMod, SdrUnoObj* pObject, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel>& xReplaced);
+ ~FmUndoModelReplaceAction();
+
+ virtual void Undo();
+ virtual void Redo() { Undo(); }
+
+ virtual String GetComment() const;
+
+ static void DisposeElement( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel>& xReplaced );
+};
+
+//========================================================================
+class SVX_DLLPRIVATE FmXUndoEnvironment
+ : public ::cppu::WeakImplHelper3< ::com::sun::star::beans::XPropertyChangeListener
+ , ::com::sun::star::container::XContainerListener
+ , ::com::sun::star::util::XModifyListener
+ >
+ , public SfxListener
+ // public ::cppu::OWeakObject
+{
+ FmFormModel& rModel;
+
+ void* m_pPropertySetCache;
+ ::svxform::PFormScriptingEnvironment m_pScriptingEnv;
+ oslInterlockedCount m_Locks;
+ ::osl::Mutex m_aMutex;
+ sal_Bool bReadOnly;
+ bool m_bDisposed;
+
+public:
+ FmXUndoEnvironment(FmFormModel& _rModel);
+ ~FmXUndoEnvironment();
+
+ // UNO Anbindung
+ // SMART_UNO_DECLARATION(FmXUndoEnvironment, ::cppu::OWeakObject);
+ // virtual sal_Bool queryInterface(UsrUik, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>&);
+ // virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlClass>> getIdlClasses(void);
+
+ void Lock() { osl_incrementInterlockedCount( &m_Locks ); }
+ void UnLock() { osl_decrementInterlockedCount( &m_Locks ); }
+ sal_Bool IsLocked() const { return m_Locks != 0; }
+
+ // access control
+ struct Accessor { friend class FmFormModel; private: Accessor() { } };
+
+ // addition and removal of form collections
+ void AddForms( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& rForms );
+ void RemoveForms( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& rForms );
+
+ // readonly-ness
+ void SetReadOnly( sal_Bool bRead, const Accessor& ) { bReadOnly = bRead; }
+ sal_Bool IsReadOnly() const {return bReadOnly;}
+
+protected:
+ // XEventListener
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XPropertyChangeListener
+ virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException);
+
+ // XContainerListener
+ virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
+
+ // XModifyListener
+ virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ void ModeChanged();
+ void dispose();
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+private:
+ void AddElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
+ void RemoveElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
+ void TogglePropertyListening(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
+
+ void implSetModified();
+
+ void switchListening( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& _rxContainer, bool _bStartListening ) SAL_THROW(());
+ void switchListening( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxObject, bool _bStartListening ) SAL_THROW(());
+ ::com::sun::star::uno::Reference< com::sun::star::script::XScriptListener > m_vbaListener;
+public:
+ // Methoden zur Zuordnung von Controls zu Forms,
+ // werden von der Seite und der UndoUmgebung genutzt
+ void Inserted(SdrObject* pObj);
+ void Removed(SdrObject* pObj);
+
+ void Inserted(FmFormObj* pObj);
+ void Removed(FmFormObj* pObj);
+};
+
+
+#endif //_SVX_FMUNDO_HXX
+
diff --git a/svx/source/inc/fmurl.hxx b/svx/source/inc/fmurl.hxx
new file mode 100644
index 000000000000..4bbfe25dfe91
--- /dev/null
+++ b/svx/source/inc/fmurl.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_FMURL_HXX
+#define _SVX_FMURL_HXX
+
+#define FMURL_FORMSLOTS_PREFIX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/" ) )
+#define FMURL_FORM_POSITION rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/positionForm" ) )
+#define FMURL_FORM_RECORDCOUNT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/RecordCount" ) )
+#define FMURL_RECORD_MOVEFIRST rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/moveToFirst" ) )
+#define FMURL_RECORD_MOVEPREV rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/moveToPrev" ) )
+#define FMURL_RECORD_MOVENEXT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/moveToNext" ) )
+#define FMURL_RECORD_MOVELAST rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/moveToLast" ) )
+#define FMURL_RECORD_MOVETONEW rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/moveToNew" ) )
+#define FMURL_RECORD_UNDO rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/undoRecord" ) )
+#define FMURL_RECORD_SAVE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/saveRecord" ) )
+#define FMURL_RECORD_DELETE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/deleteRecord" ) )
+#define FMURL_FORM_REFRESH rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/refreshForm" ) )
+#define FMURL_FORM_REFRESH_CURRENT_CONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/refreshCurrentControl" ) )
+#define FMURL_FORM_SORT_UP rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/sortUp" ) )
+#define FMURL_FORM_SORT_DOWN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/sortDown" ) )
+#define FMURL_FORM_SORT rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/sort" ) )
+#define FMURL_FORM_AUTO_FILTER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/autoFilter" ) )
+#define FMURL_FORM_FILTER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/filter" ) )
+#define FMURL_FORM_APPLY_FILTER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/applyFilter" ) )
+#define FMURL_FORM_REMOVE_FILTER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormController/removeFilterOrder" ) )
+#define FMURL_CONFIRM_DELETION rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormSlots/ConfirmDeletion" ) )
+#define FMURL_COMPONENT_FORMGRIDVIEW rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".component:DB/FormGridView" ) )
+#define FMURL_GRIDVIEW_CLEARVIEW rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormSlots/ClearView" ) )
+#define FMURL_GRIDVIEW_ADDCOLUMN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormSlots/AddGridColumn" ) )
+#define FMURL_GRIDVIEW_ATTACHTOFORM rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormSlots/AttachToForm" ) )
+#define FMARG_ATTACHTO_MASTERFORM rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MasterForm" ) )
+#define FMARG_ADDCOL_COLUMNTYPE rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnType" ) )
+#define FMARG_ADDCOL_COLUMNPOS rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnPosition" ) )
+
+#endif // _SVX_FMURL_HXX
diff --git a/svx/source/inc/fmvwimp.hxx b/svx/source/inc/fmvwimp.hxx
new file mode 100644
index 000000000000..9641db8c8a19
--- /dev/null
+++ b/svx/source/inc/fmvwimp.hxx
@@ -0,0 +1,316 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FMVWIMP_HXX
+#define _SVX_FMVWIMP_HXX
+
+#include "svx/svdmark.hxx"
+#include "fmdocumentclassification.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/form/XForm.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/form/runtime/XFormController.hpp>
+#include <com/sun/star/form/runtime/XFormControllerContext.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <com/sun/star/container/ContainerEvent.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/awt/XFocusListener.hpp>
+#include <com/sun/star/sdb/SQLErrorEvent.hpp>
+#include <com/sun/star/sdbc/XDataSource.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/stl_types.hxx>
+#include <tools/link.hxx>
+#include <tools/string.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <comphelper/uno3.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <rtl/ref.hxx>
+
+//class SdrPageViewWinRec;
+class SdrPageWindow;
+
+class SdrPageView;
+class SdrObject;
+class FmFormObj;
+class FmFormModel;
+class FmFormView;
+class FmFormShell;
+class Window;
+class OutputDevice;
+class SdrUnoObj;
+class SdrView;
+
+FORWARD_DECLARE_INTERFACE(awt,XControl)
+FORWARD_DECLARE_INTERFACE(awt,XWindow)
+FORWARD_DECLARE_INTERFACE(beans,XPropertySet)
+FORWARD_DECLARE_INTERFACE(util,XNumberFormats)
+
+class FmXFormView;
+
+namespace svx {
+ class ODataAccessDescriptor;
+ struct OXFormsDescriptor;
+}
+
+//==================================================================
+// FormViewPageWindowAdapter
+//==================================================================
+typedef ::cppu::WeakImplHelper2 < ::com::sun::star::container::XIndexAccess
+ , ::com::sun::star::form::runtime::XFormControllerContext
+ > FormViewPageWindowAdapter_Base;
+
+class FormViewPageWindowAdapter : public FormViewPageWindowAdapter_Base
+{
+ friend class FmXFormView;
+
+ ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > > m_aControllerList;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > m_xControlContainer;
+ ::comphelper::ComponentContext m_aContext;
+ FmXFormView* m_pViewImpl;
+ Window* m_pWindow;
+
+protected:
+ ~FormViewPageWindowAdapter();
+
+public:
+ FormViewPageWindowAdapter( const ::comphelper::ComponentContext& _rContext,
+ const SdrPageWindow&, FmXFormView* pView);
+ //const SdrPageViewWinRec*, FmXFormView* pView);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
+
+ // XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration() throw(::com::sun::star::uno::RuntimeException);
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 _Index) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XFormControllerContext
+ virtual void SAL_CALL makeVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _Control ) throw (::com::sun::star::uno::RuntimeException);
+
+ const ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > >& GetList() {return m_aControllerList;}
+
+protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > getController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& xForm ) const;
+ void setController(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& xForm,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >& _rxParentController );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > getControlContainer() const { return m_xControlContainer; }
+ void updateTabOrder( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm );
+ void dispose();
+ Window* getWindow() const {return m_pWindow;}
+};
+
+typedef ::rtl::Reference< FormViewPageWindowAdapter > PFormViewPageWindowAdapter;
+typedef ::std::vector< PFormViewPageWindowAdapter > PageWindowAdapterList;
+typedef ::std::set < ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >
+ , ::comphelper::OInterfaceCompare< ::com::sun::star::form::XForm >
+ > SetOfForms;
+typedef ::std::map < ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >
+ , SetOfForms
+ , ::comphelper::OInterfaceCompare< ::com::sun::star::awt::XControlContainer >
+ > MapControlContainerToSetOfForms;
+class SdrModel;
+//==================================================================
+// FmXFormView
+//==================================================================
+class FmXFormView : public ::cppu::WeakImplHelper3<
+ ::com::sun::star::form::XFormControllerListener,
+ ::com::sun::star::awt::XFocusListener,
+ ::com::sun::star::container::XContainerListener>
+{
+ friend class FmFormView;
+ friend class FmFormShell;
+ friend class FmXFormShell;
+ friend class FormViewPageWindowAdapter;
+ class ObjectRemoveListener;
+ friend class ObjectRemoveListener;
+
+ ::comphelper::ComponentContext m_aContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> m_xWindow;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xLastCreatedControlModel;
+
+ FmFormObj* m_pMarkedGrid;
+ FmFormView* m_pView;
+ sal_uIntPtr m_nActivationEvent;
+ sal_uIntPtr m_nErrorMessageEvent; // event for an asynchronous error message. See also m_aAsyncError
+ sal_uIntPtr m_nAutoFocusEvent; // event for asynchronously setting the focus to a control
+ sal_uIntPtr m_nControlWizardEvent; // event for asynchronously setting the focus to a control
+
+ ::com::sun::star::sdb::SQLErrorEvent
+ m_aAsyncError; // error event which is to be displayed asyn. See m_nErrorMessageEvent.
+
+ PageWindowAdapterList
+ m_aPageWindowAdapters; // to be filled in alive mode only
+ MapControlContainerToSetOfForms
+ m_aNeedTabOrderUpdate;
+
+ // Liste der markierten Object, dient zur Restauration beim Umschalten von Alive in DesignMode
+ SdrMarkList m_aMark;
+ ObjectRemoveListener* m_pWatchStoredList;
+
+ bool m_bFirstActivation;
+ bool m_isTabOrderUpdateSuspended;
+
+ FmFormShell* GetFormShell() const;
+
+ void removeGridWindowListening();
+
+protected:
+ FmXFormView( const ::comphelper::ComponentContext& _rContext, FmFormView* _pView );
+ ~FmXFormView();
+
+ void saveMarkList( sal_Bool _bSmartUnmark = sal_True );
+ void restoreMarkList( SdrMarkList& _rRestoredMarkList );
+ void stopMarkListWatching();
+ void startMarkListWatching();
+
+ void notifyViewDying( );
+ // notifies this impl class that the anti-impl instance (m_pView) is going to die
+
+public:
+ // UNO Anbindung
+
+// ::com::sun::star::lang::XEventListener
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::container::XContainerListener
+ virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
+
+// ::com::sun::star::form::XFormControllerListener
+ virtual void SAL_CALL formActivated(const ::com::sun::star::lang::EventObject& rEvent) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL formDeactivated(const ::com::sun::star::lang::EventObject& rEvent) throw(::com::sun::star::uno::RuntimeException);
+
+ // XFocusListener
+ virtual void SAL_CALL focusGained( const ::com::sun::star::awt::FocusEvent& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL focusLost( const ::com::sun::star::awt::FocusEvent& e ) throw (::com::sun::star::uno::RuntimeException);
+
+ FmFormView* getView() const {return m_pView;}
+ PFormViewPageWindowAdapter findWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& _rxCC ) const;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >
+ getFormController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm, const OutputDevice& _rDevice ) const;
+
+ // activation handling
+ inline bool hasEverBeenActivated( ) const { return !m_bFirstActivation; }
+ inline void setHasBeenActivated( ) { m_bFirstActivation = false; }
+
+ void onFirstViewActivation( const FmFormModel* _pDocModel );
+
+ /** suspends the calls to activateTabOrder, which normally happen whenever for any ControlContainer of the view,
+ new controls are inserted. Cannot be nested, i.e. you need to call resumeTabOrderUpdate before calling
+ suspendTabOrderUpdate, again.
+ */
+ void suspendTabOrderUpdate();
+
+ /** resumes calls to activateTabOrder, and also does all pending calls which were collected since the last
+ suspendTabOrderUpdate call.
+ */
+ void resumeTabOrderUpdate();
+
+ void onCreatedFormObject( FmFormObj& _rFormObject );
+
+ static bool
+ isFocusable(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& i_rControl
+ );
+
+private:
+ //void addWindow(const SdrPageViewWinRec*);
+ void addWindow(const SdrPageWindow&);
+ void removeWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& _rxCC );
+ void Activate(sal_Bool bSync = sal_False);
+ void Deactivate(sal_Bool bDeactivateController = sal_True);
+
+ SdrObject* implCreateFieldControl( const ::svx::ODataAccessDescriptor& _rColumnDescriptor );
+ SdrObject* implCreateXFormsControl( const ::svx::OXFormsDescriptor &_rDesc );
+
+ static bool createControlLabelPair(
+ const ::comphelper::ComponentContext& _rContext,
+ OutputDevice& _rOutDev,
+ sal_Int32 _nXOffsetMM,
+ sal_Int32 _nYOffsetMM,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats >& _rxNumberFormats,
+ sal_uInt16 _nControlObjectID,
+ const ::rtl::OUString& _rFieldPostfix,
+ sal_uInt32 _nInventor,
+ sal_uInt16 _nLabelObjectID,
+ SdrPage* _pLabelPage,
+ SdrPage* _pControlPage,
+ SdrModel* _pModel,
+ SdrUnoObj*& _rpLabel,
+ SdrUnoObj*& _rpControl
+ );
+
+ bool createControlLabelPair(
+ OutputDevice& _rOutDev,
+ sal_Int32 _nXOffsetMM,
+ sal_Int32 _nYOffsetMM,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats >& _rxNumberFormats,
+ sal_uInt16 _nControlObjectID,
+ const ::rtl::OUString& _rFieldPostfix,
+ SdrUnoObj*& _rpLabel,
+ SdrUnoObj*& _rpControl,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource >& _rxDataSource = NULL,
+ const ::rtl::OUString& _rDataSourceName = ::rtl::OUString(),
+ const ::rtl::OUString& _rCommand= ::rtl::OUString(),
+ const sal_Int32 _nCommandType = -1
+ );
+
+ void ObjectRemovedInAliveMode(const SdrObject* pObject);
+
+ // asynchronously displays an error message. See also OnDelayedErrorMessage.
+ void displayAsyncErrorMessage( const ::com::sun::star::sdb::SQLErrorEvent& _rEvent );
+
+ // cancels all pending async events
+ void cancelEvents();
+
+ /// the the auto focus to the first (in terms of the tab order) control
+ void AutoFocus( sal_Bool _bSync = sal_False );
+ DECL_LINK( OnActivate, void* );
+ DECL_LINK( OnAutoFocus, void* );
+ DECL_LINK( OnDelayedErrorMessage, void* );
+ DECL_LINK( OnStartControlWizard, void* );
+
+private:
+ ::svxform::DocumentType impl_getDocumentType() const;
+};
+
+
+
+#endif // _SVX_FMVWIMP_HXX
+
diff --git a/svx/source/inc/formcontrolfactory.hxx b/svx/source/inc/formcontrolfactory.hxx
new file mode 100644
index 000000000000..e2b32acc0ca2
--- /dev/null
+++ b/svx/source/inc/formcontrolfactory.hxx
@@ -0,0 +1,119 @@
+
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef SVX_FORMCONTROLMANAGER_HXX
+#define SVX_FORMCONTROLMANAGER_HXX
+
+#include "fmdocumentclassification.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/util/XNumberFormats.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+/** === end UNO includes === **/
+
+#include <memory>
+
+class SdrUnoObj;
+class Rectangle;
+
+namespace comphelper {
+ class ComponentContext;
+}
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ //====================================================================
+ //= FormControlFactory
+ //====================================================================
+ struct FormControlFactory_Data;
+
+ class FormControlFactory
+ {
+ public:
+ FormControlFactory( const ::comphelper::ComponentContext& _rContext );
+ ~FormControlFactory();
+
+ /** initializes the given control model which is to be newly inserted into a document
+
+ @param _eDocType
+ the type of the document which the control is to be inserted into
+ @param _rxControlModel
+ the control model to be inserted
+ @param _rControlBoundRect
+ the bound rect of the control, if applicable
+ @return
+ the class ID of the control
+ */
+ sal_Int16 initializeControlModel(
+ const DocumentType _eDocType,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
+ const Rectangle& _rControlBoundRect
+ );
+
+ sal_Int16 initializeControlModel( const DocumentType _eDocType, const SdrUnoObj& _rObject );
+ sal_Int16 initializeControlModel( const DocumentType _eDocType, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel );
+
+ void initializeTextFieldLineEnds(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel
+ );
+
+ void initializeFieldDependentProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDatabaseField,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats >& _rxNumberFormats
+ );
+
+ static ::rtl::OUString getDefaultName(
+ const sal_Int16 nClassId,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo >& _rxObject
+ );
+
+ static ::rtl::OUString getDefaultUniqueName_ByComponentType(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxContainer,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject
+ );
+
+ static ::rtl::OUString getUniqueName(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxContainer,
+ const ::rtl::OUString& _rBaseName
+ );
+
+ private:
+ ::std::auto_ptr< FormControlFactory_Data > m_pData;
+ };
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
+#endif // SVX_FORMCONTROLMANAGER_HXX
diff --git a/svx/source/inc/formcontroller.hxx b/svx/source/inc/formcontroller.hxx
new file mode 100644
index 000000000000..b0f42a0e97ea
--- /dev/null
+++ b/svx/source/inc/formcontroller.hxx
@@ -0,0 +1,593 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_FMCTRLER_HXX
+#define _SVX_FMCTRLER_HXX
+
+#include "delayedevent.hxx"
+#include "formdispatchinterceptor.hxx"
+#include "sqlparserclient.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/awt/XFocusListener.hpp>
+#include <com/sun/star/awt/XItemListener.hpp>
+#include <com/sun/star/awt/XMouseListener.hpp>
+#include <com/sun/star/awt/XTabController.hpp>
+#include <com/sun/star/awt/XTextComponent.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/form/DatabaseDeleteEvent.hpp>
+#include <com/sun/star/form/DatabaseParameterEvent.hpp>
+#include <com/sun/star/form/ErrorEvent.hpp>
+#include <com/sun/star/form/validation/XFormComponentValidityListener.hpp>
+#include <com/sun/star/form/XConfirmDeleteBroadcaster.hpp>
+#include <com/sun/star/form/XConfirmDeleteListener.hpp>
+#include <com/sun/star/form/XDatabaseParameterBroadcaster2.hpp>
+#include <com/sun/star/form/XDatabaseParameterListener.hpp>
+#include <com/sun/star/form/runtime/XFormController.hpp>
+#include <com/sun/star/form/runtime/XFilterController.hpp>
+#include <com/sun/star/form/XFormControllerListener.hpp>
+#include <com/sun/star/form/XGridControlListener.hpp>
+#include <com/sun/star/form/XLoadListener.hpp>
+#include <com/sun/star/form/XResetListener.hpp>
+#include <com/sun/star/frame/DispatchDescriptor.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XDispatchProviderInterception.hpp>
+#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/script/XEventAttacherManager.hpp>
+#include <com/sun/star/sdb/XRowSetApproveBroadcaster.hpp>
+#include <com/sun/star/sdb/XRowSetApproveListener.hpp>
+#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
+#include <com/sun/star/sdb/XSQLErrorBroadcaster.hpp>
+#include <com/sun/star/sdb/XSQLErrorListener.hpp>
+#include <com/sun/star/sdbc/XRowSetListener.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <com/sun/star/util/XModeSelector.hpp>
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/broadcasthelper.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/proparrhlp.hxx>
+#include <comphelper/stl_types.hxx>
+#include <connectivity/sqlparse.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <tools/debug.hxx>
+#include <vcl/timer.hxx>
+
+#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_22)
+#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_22
+#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 22
+#include <comphelper/implbase_var.hxx>
+#endif
+
+struct FmXTextComponentLess : public ::std::binary_function< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent >, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent> , sal_Bool>
+{
+ sal_Bool operator() (const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent >& x, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent >& y) const
+ {
+ return reinterpret_cast<sal_Int64>(x.get()) < reinterpret_cast<sal_Int64>(y.get());
+ }
+};
+
+typedef ::std::map< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent >, ::rtl::OUString, FmXTextComponentLess> FmFilterRow;
+typedef ::std::vector< FmFilterRow > FmFilterRows;
+typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > > FmFormControllers;
+
+class FmFormView;
+class Window;
+
+namespace svxform
+{
+ typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent > > FilterComponents;
+ class ControlBorderManager;
+ struct FmFieldInfo;
+
+ typedef ::comphelper::WeakComponentImplHelper22 < ::com::sun::star::form::runtime::XFormController
+ , ::com::sun::star::form::runtime::XFilterController
+ , ::com::sun::star::awt::XFocusListener
+ , ::com::sun::star::form::XLoadListener
+ , ::com::sun::star::beans::XPropertyChangeListener
+ , ::com::sun::star::awt::XTextListener
+ , ::com::sun::star::awt::XItemListener
+ , ::com::sun::star::container::XContainerListener
+ , ::com::sun::star::util::XModifyListener
+ , ::com::sun::star::form::XConfirmDeleteListener
+ , ::com::sun::star::sdb::XSQLErrorListener
+ , ::com::sun::star::sdbc::XRowSetListener
+ , ::com::sun::star::sdb::XRowSetApproveListener
+ , ::com::sun::star::form::XDatabaseParameterListener
+ , ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::form::XResetListener
+ , ::com::sun::star::frame::XDispatch
+ , ::com::sun::star::awt::XMouseListener
+ , ::com::sun::star::form::validation::XFormComponentValidityListener
+ , ::com::sun::star::task::XInteractionHandler
+ , ::com::sun::star::form::XGridControlListener
+ , ::com::sun::star::form::runtime::XFeatureInvalidation
+ > FormController_BASE;
+
+ //==================================================================
+ // FormController
+ //==================================================================
+ class ColumnInfoCache;
+ class SAL_DLLPRIVATE FormController :public ::comphelper::OBaseMutex
+ ,public FormController_BASE
+ ,public ::cppu::OPropertySetHelper
+ ,public DispatchInterceptor
+ ,public ::comphelper::OAggregationArrayUsageHelper< FormController >
+ ,public ::svxform::OSQLParserClient
+ {
+ typedef ::std::map < sal_Int16,
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >
+ > DispatcherContainer;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation> m_xAggregate;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController> m_xTabController;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> m_xActiveControl, m_xCurrentControl;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> m_xModelAsIndex;
+ ::com::sun::star::uno::Reference< ::com::sun::star::script::XEventAttacherManager> m_xModelAsManager;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xParent;
+ ::comphelper::ComponentContext m_aContext;
+ // Composer used for checking filter conditions
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer > m_xComposer;
+ ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > m_xInteractionHandler;
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormControllerContext > m_xContext;
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> > m_aControls;
+ ::cppu::OInterfaceContainerHelper
+ m_aActivateListeners,
+ m_aModifyListeners,
+ m_aErrorListeners,
+ m_aDeleteListeners,
+ m_aRowSetApproveListeners,
+ m_aParameterListeners,
+ m_aFilterListeners;
+
+ FmFormControllers m_aChilds;
+ FilterComponents m_aFilterComponents;
+ FmFilterRows m_aFilterRows;
+
+ Timer m_aTabActivationTimer;
+ Timer m_aFeatureInvalidationTimer;
+
+ ::svxform::ControlBorderManager*
+ m_pControlBorderManager;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations >
+ m_xFormOperations;
+ DispatcherContainer m_aFeatureDispatchers;
+ ::std::set< sal_Int16 > m_aInvalidFeatures; // for asynchronous feature invalidation
+
+ ::rtl::OUString m_aMode;
+
+ ::svxform::DelayedEvent m_aLoadEvent;
+ ::svxform::DelayedEvent m_aToggleEvent;
+ ::svxform::DelayedEvent m_aActivationEvent;
+ ::svxform::DelayedEvent m_aDeactivationEvent;
+
+ ::std::auto_ptr< ColumnInfoCache >
+ m_pColumnInfoCache;
+
+ sal_Int32 m_nCurrentFilterPosition; // current level for filtering (or-criteria)
+
+ sal_Bool m_bCurrentRecordModified : 1;
+ sal_Bool m_bCurrentRecordNew : 1;
+ sal_Bool m_bLocked : 1;
+ sal_Bool m_bDBConnection : 1; // Focuslistener nur fuer Datenbankformulare
+ sal_Bool m_bCycle : 1;
+ sal_Bool m_bCanInsert : 1;
+ sal_Bool m_bCanUpdate : 1;
+ sal_Bool m_bCommitLock : 1; // lock the committing of controls see focusGained
+ sal_Bool m_bModified : 1; // ist der Inhalt eines Controls modifiziert ?
+ sal_Bool m_bControlsSorted : 1;
+ sal_Bool m_bFiltering : 1;
+ sal_Bool m_bAttachEvents : 1;
+ sal_Bool m_bDetachEvents : 1;
+ bool m_bAttemptedHandlerCreation : 1;
+ bool m_bSuspendFilterTextListening; // no bit field, passed around as reference
+
+ // as we want to intercept dispatches of _all_ controls we're responsible for, and an object implementing
+ // the ::com::sun::star::frame::XDispatchProviderInterceptor interface can intercept only _one_ objects dispatches, we need a helper class
+ DECLARE_STL_VECTOR(DispatchInterceptionMultiplexer*, Interceptors);
+ Interceptors m_aControlDispatchInterceptors;
+
+ public:
+ FormController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & _rxORB );
+
+ protected:
+ ~FormController();
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& type) 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< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XDispatch
+ virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& _rURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArgs ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& _rxListener, const ::com::sun::star::util::URL& _rURL ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& _rxListener, const ::com::sun::star::util::URL& _rURL ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XChild
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> SAL_CALL getParent(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setParent(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Parent) throw( ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException );
+
+ // ::com::sun::star::lang::XEventListener
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException );
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+ // OPropertySetHelper
+ virtual sal_Bool SAL_CALL convertFastPropertyValue( ::com::sun::star::uno::Any & rConvertedValue, ::com::sun::star::uno::Any & rOldValue,
+ sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
+ throw( ::com::sun::star::lang::IllegalArgumentException );
+
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw( ::com::sun::star::uno::Exception );
+ virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ using OPropertySetHelper::getFastPropertyValue;
+
+ // XFilterController
+ virtual ::sal_Int32 SAL_CALL getFilterComponents() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getDisjunctiveTerms() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addFilterControllerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFilterControllerListener >& _Listener ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeFilterControllerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFilterControllerListener >& _Listener ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setPredicateExpression( ::sal_Int32 _Component, ::sal_Int32 _Term, const ::rtl::OUString& _PredicateExpression ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > SAL_CALL getFilterComponent( ::sal_Int32 _Component ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL getPredicateExpressions() throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeDisjunctiveTerm( ::sal_Int32 _Term ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL appendEmptyDisjunctiveTerm() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getActiveTerm() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setActiveTerm( ::sal_Int32 _ActiveTerm ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL hasElements(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ // ::com::sun::star::container::XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration> SAL_CALL createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ // ::com::sun::star::container::XContainerListener
+ virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XLoadListener
+ virtual void SAL_CALL loaded(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL unloaded(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL unloading(const ::com::sun::star::lang::EventObject& aEvent) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL reloading(const ::com::sun::star::lang::EventObject& aEvent) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL reloaded(const ::com::sun::star::lang::EventObject& aEvent) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XModeSelector
+ virtual void SAL_CALL setMode(const ::rtl::OUString& Mode) throw( ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException );
+ virtual ::rtl::OUString SAL_CALL getMode(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedModes(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsMode(const ::rtl::OUString& Mode) throw( ::com::sun::star::uno::RuntimeException );
+
+ // ::com::sun::star::container::XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 Index) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ // XModifyBroadcaster
+ virtual void SAL_CALL addModifyListener(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener>& l) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeModifyListener(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener>& l) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XFocusListener
+ virtual void SAL_CALL focusGained(const ::com::sun::star::awt::FocusEvent& e) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL focusLost(const ::com::sun::star::awt::FocusEvent& e) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XMouseListener
+ virtual void SAL_CALL mousePressed( const ::com::sun::star::awt::MouseEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL mouseReleased( const ::com::sun::star::awt::MouseEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL mouseEntered( const ::com::sun::star::awt::MouseEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL mouseExited( const ::com::sun::star::awt::MouseEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XFormComponentValidityListener
+ virtual void SAL_CALL componentValidityChanged( const ::com::sun::star::lang::EventObject& _rSource ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XInteractionHandler
+ virtual void SAL_CALL handle( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& Request ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XGridControlListener
+ virtual void SAL_CALL columnChanged( const ::com::sun::star::lang::EventObject& _event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XPropertyChangeListener -> aenderung der stati
+ virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XTextListener -> modify setzen
+ virtual void SAL_CALL textChanged(const ::com::sun::star::awt::TextEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XItemListener -> modify setzen
+ virtual void SAL_CALL itemStateChanged(const ::com::sun::star::awt::ItemEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XModifyListener -> modify setzen
+ virtual void SAL_CALL modified(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XFormController
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations > SAL_CALL getFormOperations() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> SAL_CALL getCurrentControl(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL addActivateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormControllerListener>& l) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeActivateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormControllerListener>& l) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL addChildController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >& _ChildController ) throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormControllerContext > SAL_CALL getContext() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setContext( const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormControllerContext >& _context ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > SAL_CALL getInteractionHandler() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setInteractionHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _interactionHandler ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XTabController
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> > SAL_CALL getControls(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel>& Model) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel> SAL_CALL getModel() throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL setContainer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer>& Container) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer> SAL_CALL getContainer() throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL autoTabOrder() throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL activateTabOrder() throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL activateFirst() throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL activateLast() throw( ::com::sun::star::uno::RuntimeException );
+
+ // com::sun::star::sdbc::XRowSetListener
+ virtual void SAL_CALL cursorMoved(const ::com::sun::star::lang::EventObject& event) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL rowChanged(const ::com::sun::star::lang::EventObject& event) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL rowSetChanged(const ::com::sun::star::lang::EventObject& event) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XRowSetApproveListener
+ virtual sal_Bool SAL_CALL approveCursorMove(const ::com::sun::star::lang::EventObject& event) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL approveRowChange(const ::com::sun::star::sdb::RowChangeEvent& event) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL approveRowSetChange(const ::com::sun::star::lang::EventObject& event) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XRowSetApproveBroadcaster
+ virtual void SAL_CALL addRowSetApproveListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetApproveListener>& listener) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeRowSetApproveListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetApproveListener>& listener) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XSQLErrorBroadcaster
+ virtual void SAL_CALL errorOccured(const ::com::sun::star::sdb::SQLErrorEvent& aEvent) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XSQLErrorListener
+ virtual void SAL_CALL addSQLErrorListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLErrorListener>& _rListener) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeSQLErrorListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLErrorListener>& _rListener) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XDatabaseParameterBroadcaster2
+ virtual void SAL_CALL addDatabaseParameterListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener>& aListener) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeDatabaseParameterListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener>& aListener) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XDatabaseParameterBroadcaster
+ virtual void SAL_CALL addParameterListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener>& aListener) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeParameterListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener>& aListener) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XDatabaseParameterListener
+ virtual sal_Bool SAL_CALL approveParameter(const ::com::sun::star::form::DatabaseParameterEvent& aEvent) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XConfirmDeleteBroadcaster
+ virtual void SAL_CALL addConfirmDeleteListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XConfirmDeleteListener>& aListener) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeConfirmDeleteListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XConfirmDeleteListener>& aListener) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XConfirmDeleteListener
+ virtual sal_Bool SAL_CALL confirmDelete(const ::com::sun::star::sdb::RowChangeEvent& aEvent) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XServiceInfo
+ virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw(::com::sun::star::uno::RuntimeException);
+
+ // XResetListener
+ virtual sal_Bool SAL_CALL approveReset(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL resetted(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XFeatureInvalidation
+ virtual void SAL_CALL invalidateFeatures( const ::com::sun::star::uno::Sequence< ::sal_Int16 >& Features ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL invalidateAllFeatures( ) throw (::com::sun::star::uno::RuntimeException);
+
+// method for registration
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void);
+
+ // comphelper::OPropertyArrayUsageHelper
+ virtual void fillProperties(
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps
+ ) const;
+
+ protected:
+ // DispatchInterceptor
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch>
+ interceptedQueryDispatch(
+ const ::com::sun::star::util::URL& aURL,
+ const ::rtl::OUString& aTargetFrameName,
+ sal_Int32 nSearchFlags
+ ) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::osl::Mutex* getInterceptorMutex() { return &m_aMutex; }
+
+ /// update all our dispatchers
+ void updateAllDispatchers() const;
+
+ /** disposes all dispatchers in m_aFeatureDispatchers, and empties m_aFeatureDispatchers
+ */
+ void disposeAllFeaturesAndDispatchers() SAL_THROW(());
+
+ void startFiltering();
+ void stopFiltering();
+ void setFilter(::std::vector<FmFieldInfo>&);
+ void startListening();
+ void stopListening();
+
+ /** ensures that we have an interaction handler, if possible
+
+ If an interaction handler was provided at creation time (<member>initialize</member>), this
+ one will be used. Else, an attempt is made to create an <type scope="com::sun::star::sdb">InteractionHandler</type>
+ is made.
+
+ @return <TRUE/>
+ if and only if <member>m_xInteractionHandler</member> is valid when the method returns
+ */
+ bool ensureInteractionHandler();
+
+ /** replaces one of our controls with another one
+
+ Upon successful replacing, the old control will be disposed. Also, internal members pointing
+ to the current or active control will be adjusted. Yet more, if the replaced control was
+ the active control, the new control will be made active.
+
+ @param _rxExistentControl
+ The control to replace. Must be one of the controls in our ControlContainer.
+ @param _rxNewControl
+ The control which should replace the existent control.
+ @return
+ <TRUE/> if and only if the control was successfully replaced
+ */
+ bool replaceControl(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxExistentControl,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxNewControl
+ );
+
+ // we're listening at all bound controls for modifications
+ void startControlModifyListening(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl);
+ void stopControlModifyListening(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl);
+
+ void setLocks();
+ void setControlLock(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl);
+ void addToEventAttacher(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl);
+ void removeFromEventAttacher(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl);
+ void toggleAutoFields(sal_Bool bAutoFields);
+ void unload() throw( ::com::sun::star::uno::RuntimeException );
+ void removeBoundFieldListener();
+
+ void startFormListening( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForm, sal_Bool _bPropertiesOnly );
+ void stopFormListening( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForm, sal_Bool _bPropertiesOnly );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> findControl( ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> >& rCtrls, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel>& rxCtrlModel, sal_Bool _bRemove, sal_Bool _bOverWrite ) const;
+
+ void insertControl(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl);
+ void removeControl(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl);
+
+ /// called when a new control is to be handled by the controller
+ void implControlInserted( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& _rxControl, bool _bAddToEventAttacher );
+ /// called when a control is not to be handled by the controller anymore
+ void implControlRemoved( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& _rxControl, bool _bRemoveFromEventAttacher );
+
+ /** sets m_xCurrentControl, plus does administrative tasks depending on it
+ */
+ void implSetCurrentControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
+
+ /** invalidates the FormFeatures which depend on the current control
+ */
+ void implInvalidateCurrentControlDependentFeatures();
+
+ bool impl_isDisposed_nofail() const { return FormController_BASE::rBHelper.bDisposed; }
+ void impl_checkDisposed_throw() const;
+
+ void impl_onModify();
+
+ /** adds the given filter row to m_aFilterRows, setting m_nCurrentFilterPosition to 0 if the newly added
+ row is the first one.
+
+ @precond
+ our mutex is locked
+ */
+ void impl_addFilterRow( const FmFilterRow& _row );
+
+ /** adds an empty filter row to m_aFilterRows, and notifies our listeners
+ */
+ void impl_appendEmptyFilterRow( ::osl::ClearableMutexGuard& _rClearBeforeNotify );
+
+ sal_Bool isLocked() const {return m_bLocked;}
+ sal_Bool determineLockState() const;
+
+ Window* getDialogParentWindow();
+ // returns the window which should be used as parent window for dialogs
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor> createInterceptor(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception>& _xInterception);
+ // create a new interceptor, register it on the given object
+ void deleteInterceptor(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception>& _xInterception);
+ // if createInterceptor was called for the given object the according interceptor will be removed
+ // from the objects interceptor chain and released
+
+ /** checks all form controls belonging to our form for validity
+
+ If a form control supports the XValidatableFormComponent interface, this is used to determine
+ the validity of the control. If the interface is not supported, the control is supposed to be
+ valid.
+
+ @param _rFirstInvalidityExplanation
+ if the method returns <FALSE/> (i.e. if there is an invalid control), this string contains
+ the explanation for the invalidity, as obtained from the validator.
+
+ @param _rxFirstInvalidModel
+ if the method returns <FALSE/> (i.e. if there is an invalid control), this contains
+ the control model
+
+ @return
+ <TRUE/> if and only if all controls belonging to our form are valid
+ */
+ bool checkFormComponentValidity(
+ ::rtl::OUString& /* [out] */ _rFirstInvalidityExplanation,
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& /* [out] */ _rxFirstInvalidModel
+ ) SAL_THROW(());
+
+ /** locates the control which belongs to a given model
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >
+ locateControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxModel ) SAL_THROW(());
+
+ // set the text for all filters
+ void impl_setTextOnAllFilter_throw();
+
+ // in filter mode we do not listen for changes
+ sal_Bool isListeningForChanges() const {return m_bDBConnection && !m_bFiltering && !isLocked();}
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl> isInList(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& xPeer) const;
+
+ DECL_LINK( OnActivateTabOrder, void* );
+ DECL_LINK( OnInvalidateFeatures, void* );
+ DECL_LINK( OnLoad, void* );
+ DECL_LINK( OnToggleAutoFields, void* );
+ DECL_LINK( OnActivated, void* );
+ DECL_LINK( OnDeactivated, void* );
+ };
+
+} // namespace svxform
+
+#endif // _SVX_FMCTRLER_HXX
+
diff --git a/svx/source/inc/formcontrolling.hxx b/svx/source/inc/formcontrolling.hxx
new file mode 100644
index 000000000000..571e0a6a80f0
--- /dev/null
+++ b/svx/source/inc/formcontrolling.hxx
@@ -0,0 +1,308 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_FORMCONTROLLING_HXX
+#define SVX_FORMCONTROLLING_HXX
+
+#include <com/sun/star/form/runtime/XFormController.hpp>
+#include <com/sun/star/form/XForm.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/form/runtime/FeatureState.hpp>
+#include <com/sun/star/form/runtime/XFormOperations.hpp>
+#include <com/sun/star/sdb/XSQLErrorListener.hpp>
+
+#include <cppuhelper/implbase2.hxx>
+#include <comphelper/componentcontext.hxx>
+
+#include <vector>
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ //====================================================================
+ //= FeatureSlotTranslation
+ //====================================================================
+ class FeatureSlotTranslation
+ {
+ public:
+ /// retrieves the feature id for a given feature URL
+ static sal_Int32 getControllerFeatureSlotIdForURL( const ::rtl::OUString& _rMainURL );
+
+ /// retrieves the feature URL for a given feature id
+ static ::rtl::OUString getControllerFeatureURLForSlotId( sal_Int32 _nSlotId );
+
+ /// determines whether the given URL is a controller feature URL
+ static sal_Bool isFeatureURL( const ::rtl::OUString& _rMainURL );
+
+ /// retrieves the css.form.runtime.FormFeature ID for a given slot ID
+ static sal_Int16 getFormFeatureForSlotId( sal_Int32 _nSlotId );
+
+ /// retrieves the slot id for a given css.form.runtime.FormFeature ID
+ static sal_Int32 getSlotIdForFormFeature( sal_Int16 _nFormFeature );
+ };
+
+ //====================================================================
+ //= IControllerFeatureInvalidation
+ //====================================================================
+ class IControllerFeatureInvalidation
+ {
+ public:
+ /** invalidates the given features
+
+ Invalidation means that any user interface representation (such as toolbox buttons), or
+ any dispatches associated with the features in question are potentially out-of-date, and
+ need to be updated
+
+ @param _rFeatures
+ Ids of the features to be invalidated.
+ */
+ virtual void invalidateFeatures( const ::std::vector< sal_Int32 >& _rFeatures ) = 0;
+ };
+
+ //====================================================================
+ //= ControllerFeatures
+ //====================================================================
+ class FormControllerHelper;
+ /** easier access to an FormControllerHelper instance
+ */
+ class ControllerFeatures
+ {
+ protected:
+ ::comphelper::ComponentContext m_aContext;
+ IControllerFeatureInvalidation* m_pInvalidationCallback; // necessary as long as m_pImpl is not yet constructed
+ FormControllerHelper* m_pImpl;
+
+ public:
+ /** standard ctor
+
+ The instance is not functional until <method>assign</method> is used.
+
+ @param _rxORB
+ a multi service factory for creating various needed components
+
+ @param _pInvalidationCallback
+ the callback for invalidating feature states
+ */
+ ControllerFeatures(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
+ IControllerFeatureInvalidation* _pInvalidationCallback
+ );
+
+ /** constructs the instance from a <type scope="com::sun::star::form::runtime">XFormController<type> instance
+
+ @param _rxORB
+ a multi service factory for creating various needed components
+
+ @param _rxController
+ The form controller which the helper should be responsible for. Must not
+ be <NULL/>, and must have a valid model (form).
+
+ @param _pInvalidationCallback
+ the callback for invalidating feature states
+ */
+ ControllerFeatures(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >& _rxController,
+ IControllerFeatureInvalidation* _pInvalidationCallback
+ );
+
+ /** constructs the helper form a <type scope="com::sun::star::form">XForm<type> instance
+
+ Any functionality which depends on a controller will not be available.
+
+ @param _rxORB
+ a multi service factory for creating various needed components
+
+ @param _rxForm
+ The form which the helper should be responsible for. Must not be <NULL/>.
+
+ @param _pInvalidationCallback
+ the callback for invalidating feature states
+ */
+ ControllerFeatures(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm,
+ IControllerFeatureInvalidation* _pInvalidationCallback
+ );
+
+ /// dtor
+ ~ControllerFeatures();
+
+ /// checks whether the instance is properly assigned to a form and/or controller
+ inline bool isAssigned( ) const { return m_pImpl != NULL; }
+
+ /** assign to a controller
+ */
+ void assign(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >& _rxController
+ );
+
+ /** assign to a controller
+ */
+ void assign(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm
+ );
+
+ /// clears the instance so that it cannot be used afterwards
+ void dispose();
+
+ // access to the instance which implements the functionality. Not to be used when not assigned
+ inline const FormControllerHelper* operator->() const { return m_pImpl; }
+ inline FormControllerHelper* operator->() { return m_pImpl; }
+ inline const FormControllerHelper& operator*() const { return *m_pImpl; }
+ inline FormControllerHelper& operator*() { return *m_pImpl; }
+ };
+
+ //====================================================================
+ //= FormControllerHelper
+ //====================================================================
+ typedef ::cppu::WeakImplHelper2 < ::com::sun::star::form::runtime::XFeatureInvalidation
+ , ::com::sun::star::sdb::XSQLErrorListener
+ > FormControllerHelper_Base;
+ /** is a helper class which manages form controller functionality (such as moveNext etc.).
+
+ <p>The class helps implementing form controller functionality, by providing
+ methods to determine the state of, and execute, various common form features.<br/>
+ A <em>feature</em> is for instance moving the form associated with the controller
+ to a certain position, or reloading the form, and so on.</p>
+ */
+ class FormControllerHelper : public FormControllerHelper_Base
+ {
+ protected:
+ ::comphelper::ComponentContext m_aContext;
+ IControllerFeatureInvalidation* m_pInvalidationCallback;
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations >
+ m_xFormOperations;
+
+ ::com::sun::star::uno::Any m_aOperationError;
+
+ public:
+ /** constructs the helper from a <type scope="com::sun::star::form::runtime">XFormController<type> instance
+
+ @param _rContext
+ the context the component lives in
+ @param _rxController
+ The form controller which the helper should be responsible for. Must not
+ be <NULL/>, and must have a valid model (form).
+ @param _pInvalidationCallback
+ the callback for invalidating feature states
+ */
+ FormControllerHelper(
+ const ::comphelper::ComponentContext& _rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >& _rxController,
+ IControllerFeatureInvalidation* _pInvalidationCallback
+ );
+
+ /** constructs the helper form a <type scope="com::sun::star::form">XForm<type> instance
+
+ Any functionality which depends on a controller will not be available.
+
+ @param _rContext
+ the context the component lives in
+ @param _rxForm
+ The form which the helper should be responsible for. Must not be <NULL/>.
+ @param _pInvalidationCallback
+ the callback for invalidating feature states
+ */
+ FormControllerHelper(
+ const ::comphelper::ComponentContext& _rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm,
+ IControllerFeatureInvalidation* _pInvalidationCallback
+ );
+
+ // forwards to the XFormOperations implementation
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >
+ getCursor() const;
+ void getState(
+ sal_Int32 _nSlotId,
+ ::com::sun::star::form::runtime::FeatureState& _out_rState
+ ) const;
+ sal_Bool isEnabled( sal_Int32 _nSlotId ) const;
+ void execute( sal_Int32 _nSlotId ) const;
+ void execute( sal_Int32 _nSlotId, const ::rtl::OUString& _rParamName, const ::com::sun::star::uno::Any& _rParamValue ) const;
+ sal_Bool commitCurrentRecord() const;
+ sal_Bool commitCurrentControl( ) const;
+ sal_Bool isInsertionRow() const;
+ sal_Bool isModifiedRow() const;
+
+ bool moveLeft( ) const;
+ bool moveRight( ) const;
+
+ bool canDoFormFilter() const;
+
+ /** disposes this instance.
+
+ After this method has been called, the instance is not functional anymore
+ */
+ void dispose();
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations >&
+ getFormOperations() const { return m_xFormOperations; }
+ protected:
+ /// dtor
+ ~FormControllerHelper();
+
+ // XFeatureInvalidation
+ virtual void SAL_CALL invalidateFeatures( const ::com::sun::star::uno::Sequence< ::sal_Int16 >& Features ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL invalidateAllFeatures() throw (::com::sun::star::uno::RuntimeException);
+
+ // XSQLErrorListener
+ virtual void SAL_CALL errorOccured( const ::com::sun::star::sdb::SQLErrorEvent& _Event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ private:
+ enum FormOperation { EXECUTE, EXECUTE_ARGS, COMMIT_CONTROL, COMMIT_RECORD };
+
+ bool impl_operateForm_nothrow(
+ const FormOperation _eWhat,
+ const sal_Int16 _nFeature, /* ignore for COMMIT_* */
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rArguments /* ignore except for EXECUTE_ARGS */
+ ) const;
+ bool impl_operateForm_nothrow( const FormOperation _eWhat ) const
+ {
+ return impl_operateForm_nothrow( _eWhat, 0, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >() );
+ }
+ bool impl_operateForm_nothrow( const sal_Int16 _nFeature ) const
+ {
+ return impl_operateForm_nothrow( EXECUTE, _nFeature, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >() );
+ }
+
+ private:
+ FormControllerHelper(); // never implemented
+ FormControllerHelper( const FormControllerHelper& ); // never implemented
+ FormControllerHelper& operator=( const FormControllerHelper& ); // never implemented
+ };
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+#endif // SVX_FORMCONTROLLING_HXX
diff --git a/svx/source/inc/formdispatchinterceptor.hxx b/svx/source/inc/formdispatchinterceptor.hxx
new file mode 100644
index 000000000000..e542d4a1090a
--- /dev/null
+++ b/svx/source/inc/formdispatchinterceptor.hxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef SVX_FORMDISPATCHINTERCEPTOR_HXX
+#define SVX_FORMDISPATCHINTERCEPTOR_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
+#include <com/sun/star/frame/XDispatchProviderInterception.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/compbase2.hxx>
+#include <comphelper/uno3.hxx>
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ //====================================================================
+ //= DispatchInterceptor
+ //====================================================================
+ class DispatchInterceptor
+ {
+ public:
+ DispatchInterceptor() { }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch> interceptedQueryDispatch(
+ const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags) throw( ::com::sun::star::uno::RuntimeException ) = 0;
+
+ virtual ::osl::Mutex* getInterceptorMutex() = 0;
+ };
+
+ //====================================================================
+ //=
+ //====================================================================
+ typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::frame::XDispatchProviderInterceptor
+ , ::com::sun::star::lang::XEventListener
+ > DispatchInterceptionMultiplexer_BASE;
+
+ class DispatchInterceptionMultiplexer : public DispatchInterceptionMultiplexer_BASE
+ {
+ ::osl::Mutex m_aFallback;
+ ::osl::Mutex* m_pMutex;
+
+ // the component which's dispatches we're intercepting
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XDispatchProviderInterception >
+ m_xIntercepted;
+ sal_Bool m_bListening;
+
+ // the real interceptor
+ DispatchInterceptor* m_pMaster;
+
+ // chaining
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider> m_xSlaveDispatcher;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider> m_xMasterDispatcher;
+
+ virtual ~DispatchInterceptionMultiplexer();
+
+ public:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception> getIntercepted() const { return m_xIntercepted; }
+
+ public:
+ DispatchInterceptionMultiplexer(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception>& _rToIntercept,
+ DispatchInterceptor* _pMaster
+ );
+
+ // UNO
+ DECLARE_UNO3_DEFAULTS(DispatchInterceptionMultiplexer, DispatchInterceptionMultiplexer_BASE);
+
+ // ::com::sun::star::frame::XDispatchProvider
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::frame::XDispatchProviderInterceptor
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getSlaveDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSlaveDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewDispatchProvider ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getMasterDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMasterDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewSupplier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+ protected:
+ void ImplDetach();
+ };
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
+#endif // SVX_FORMDISPATCHINTERCEPTOR_HXX
diff --git a/svx/source/inc/formfeaturedispatcher.hxx b/svx/source/inc/formfeaturedispatcher.hxx
new file mode 100644
index 000000000000..4b75a95d2bc9
--- /dev/null
+++ b/svx/source/inc/formfeaturedispatcher.hxx
@@ -0,0 +1,157 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_FMDISPATCH_HXX
+#define SVX_FMDISPATCH_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/form/runtime/XFormOperations.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ //====================================================================
+ //= OSingleFeatureDispatcher
+ //====================================================================
+ typedef ::cppu::WeakImplHelper1 < ::com::sun::star::frame::XDispatch
+ > OSingleFeatureDispatcher_Base;
+
+ class OSingleFeatureDispatcher : public OSingleFeatureDispatcher_Base
+ {
+ private:
+ ::osl::Mutex& m_rMutex;
+ ::cppu::OInterfaceContainerHelper m_aStatusListeners;
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations >
+ m_xFormOperations;
+ const ::com::sun::star::util::URL m_aFeatureURL;
+ ::com::sun::star::uno::Any m_aLastKnownState;
+ const sal_Int16 m_nFormFeature;
+ sal_Bool m_bLastKnownEnabled;
+ sal_Bool m_bDisposed;
+
+ public:
+ /** constructs the dispatcher
+
+ @param _rFeatureURL
+ the URL of the feature which this instance is responsible for
+
+ @param _nFeatureId
+ the feature which this instance is responsible for
+
+ @param _rController
+ the controller which is responsible for providing the state of feature of this instance,
+ and for executing it. After disposing the dispatcher instance, the controller will
+ not be accessed anymore
+
+ @see dispose
+ */
+ OSingleFeatureDispatcher(
+ const ::com::sun::star::util::URL& _rFeatureURL,
+ const sal_Int16 _nFormFeature,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations >& _rxFormOperations,
+ ::osl::Mutex& _rMutex
+ );
+
+ /** disposes the dispatcher instance
+
+ All status listeners will, after receiving an <member scope="com::sun::star::lang">XEventListener::disposing</member>
+ call, be released.
+
+ The controller provided in the in constructor will not be used anymore after returning from this call.
+
+ No further requests to dispatch slots will be accepted.
+
+ Multiple calls are allowed: if the object already was disposed, then subsequent calls are
+ silently ignored.
+ */
+ void dispose();
+
+ /** notifies all our listeners of the current state
+ */
+ void updateAllListeners();
+
+ protected:
+ // XDispatch
+ virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& _rURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArguments ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& _rxControl, const ::com::sun::star::util::URL& _rURL ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& _rxControl, const ::com::sun::star::util::URL& _rURL ) throw (::com::sun::star::uno::RuntimeException);
+
+ protected:
+ /** notifies our current state to one or all listeners
+
+ @param _rxListener
+ the listener to notify. May be NULL, in this case all our listeners will be
+ notified with the current state
+
+ @param _rFreeForNotification
+ a guard which currently locks our mutex, and which is to be cleared
+ for actually doing the notification(s)
+ */
+ void notifyStatus(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& _rxListener,
+ ::osl::ClearableMutexGuard& _rFreeForNotification
+ );
+
+ private:
+ /** checks whether our instance is alive
+
+ If the instance already received a <member>dispose</member> call, then a
+ <type scope="com::sun::star::lang">DisposedException</type> is thrown.
+
+ @precond
+ our Mutex is locked - else calling the method would not make sense, since
+ it's result could be out-of-date as soon as it's returned to the caller.
+ */
+ void checkAlive() const SAL_THROW((::com::sun::star::lang::DisposedException));
+
+ /** retrieves the current status of our feature, in a format which can be used
+ for UNO notifications
+
+ @precond
+ our mutex is locked
+ */
+ void getUnoState( ::com::sun::star::frame::FeatureStateEvent& /* [out] */ _rState ) const;
+
+ private:
+ OSingleFeatureDispatcher(); // never implemented
+ OSingleFeatureDispatcher( const OSingleFeatureDispatcher& ); // never implemented
+ OSingleFeatureDispatcher& operator=( const OSingleFeatureDispatcher& ); // never implemented
+ };
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+#endif
diff --git a/svx/source/inc/formtoolbars.hxx b/svx/source/inc/formtoolbars.hxx
new file mode 100644
index 000000000000..db21979ab756
--- /dev/null
+++ b/svx/source/inc/formtoolbars.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_SOURCE_INC_FORMTOOLBARS_HXX
+#define SVX_SOURCE_INC_FORMTOOLBARS_HXX
+
+#include "fmdocumentclassification.hxx"
+#include <com/sun/star/frame/XLayoutManager.hpp>
+
+#include <tools/solar.h>
+
+#include <svx/svxdllapi.h>
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ //====================================================================
+ //= FormToolboxes
+ //====================================================================
+ class FormToolboxes
+ {
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >
+ m_xLayouter;
+
+ public:
+ /** constructs an instance
+ @param _rxFrame
+ the frame to analyze
+ */
+ SVX_DLLPUBLIC FormToolboxes(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame
+ );
+
+ public:
+ /** retrieves the URI for the toolbox associated with the given slot, depending
+ on the type of our document
+ */
+ SVX_DLLPUBLIC ::rtl::OUString
+ getToolboxResourceName( sal_uInt16 _nSlotId ) const;
+
+ /** toggles the toolbox associated with the given slot
+ */
+ SVX_DLLPUBLIC void toggleToolbox( sal_uInt16 _nSlotId ) const;
+
+ /** determines whether the toolbox associated with the given slot is currently visible
+ */
+ SVX_DLLPUBLIC bool isToolboxVisible( sal_uInt16 _nSlotId ) const;
+
+ /** ensures that a given toolbox is visible
+ */
+ inline void showToolbox( sal_uInt16 _SlotId ) const
+ {
+ if ( !isToolboxVisible( _SlotId ) )
+ toggleToolbox( _SlotId );
+ }
+ };
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
+#endif // SVX_SOURCE_INC_FORMTOOLBARS_HXX
+
diff --git a/svx/source/inc/frmsel.hrc b/svx/source/inc/frmsel.hrc
new file mode 100644
index 000000000000..b0b7bc01fceb
--- /dev/null
+++ b/svx/source/inc/frmsel.hrc
@@ -0,0 +1,38 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_FRMSEL_HRC
+#define SVX_FRMSEL_HRC
+
+#define ARR_TEXTS 1
+#define ARR_DESCRIPTIONS 2
+
+// image: arrows and markers
+#define BMP_FRMSEL_ARROWS 3
+
+#endif
+
diff --git a/svx/source/inc/frmselimpl.hxx b/svx/source/inc/frmselimpl.hxx
new file mode 100644
index 000000000000..77554da2587e
--- /dev/null
+++ b/svx/source/inc/frmselimpl.hxx
@@ -0,0 +1,305 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_FRMSELIMPL_HXX
+#define SVX_FRMSELIMPL_HXX
+
+#include <vcl/virdev.hxx>
+#include <vcl/image.hxx>
+#include <svx/frmsel.hxx>
+#include <svx/framelinkarray.hxx>
+#include <editeng/borderline.hxx>
+
+namespace svx {
+
+namespace a11y { class AccFrameSelector; }
+
+// ============================================================================
+
+class FrameBorder
+{
+public:
+ explicit FrameBorder( FrameBorderType eType );
+
+ inline FrameBorderType GetType() const { return meType; }
+
+ inline bool IsEnabled() const { return mbEnabled; }
+ void Enable( FrameSelFlags nFlags );
+
+ inline FrameBorderState GetState() const { return meState; }
+ void SetState( FrameBorderState eState );
+
+ inline bool IsSelected() const { return mbSelected; }
+ inline void Select( bool bSelect ) { mbSelected = bSelect; }
+
+ const SvxBorderLine& GetCoreStyle() const { return maCoreStyle; }
+ void SetCoreStyle( const SvxBorderLine* pStyle );
+
+ inline void SetUIColor( const Color& rColor ) {maUIStyle.SetColor( rColor ); }
+ inline const frame::Style& GetUIStyle() const { return maUIStyle; }
+
+ inline void ClearFocusArea() { maFocusArea.Clear(); }
+ void AddFocusPolygon( const Polygon& rFocus );
+ void MergeFocusToPolyPolygon( PolyPolygon& rPPoly ) const;
+
+ inline void ClearClickArea() { maClickArea.Clear(); }
+ void AddClickRect( const Rectangle& rRect );
+ bool ContainsClickPoint( const Point& rPos ) const;
+ void MergeClickAreaToPolyPolygon( PolyPolygon& rPPoly ) const;
+ Rectangle GetClickBoundRect() const;
+
+ void SetKeyboardNeighbors(
+ FrameBorderType eLeft, FrameBorderType eRight,
+ FrameBorderType eTop, FrameBorderType eBottom );
+ FrameBorderType GetKeyboardNeighbor( sal_uInt16 nKeyCode ) const;
+
+private:
+ const FrameBorderType meType; /// Frame border type (position in control).
+ FrameBorderState meState; /// Frame border state (on/off/don't care).
+ SvxBorderLine maCoreStyle; /// Core style from application.
+ frame::Style maUIStyle; /// Internal style to draw lines.
+ FrameBorderType meKeyLeft; /// Left neighbor for keyboard control.
+ FrameBorderType meKeyRight; /// Right neighbor for keyboard control.
+ FrameBorderType meKeyTop; /// Upper neighbor for keyboard control.
+ FrameBorderType meKeyBottom; /// Lower neighbor for keyboard control.
+ PolyPolygon maFocusArea; /// Focus drawing areas.
+ PolyPolygon maClickArea; /// Mouse click areas.
+ bool mbEnabled; /// true = Border enabled in control.
+ bool mbSelected; /// true = Border selected in control.
+};
+
+// ============================================================================
+
+typedef std::vector< FrameBorder* > FrameBorderPtrVec;
+
+struct FrameSelectorImpl : public Resource
+{
+ typedef ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > XAccessibleRef;
+ typedef std::vector< a11y::AccFrameSelector* > AccessibleImplVec;
+ typedef std::vector< XAccessibleRef > XAccessibleRefVec;
+
+ FrameSelector& mrFrameSel; /// The control itself.
+ VirtualDevice maVirDev; /// For all buffered drawing operations.
+ ImageList maILArrows; /// Arrows in current system colors.
+ Color maBackCol; /// Background color.
+ Color maArrowCol; /// Selection arrow color.
+ Color maMarkCol; /// Selection marker color.
+ Color maHCLineCol; /// High contrast line color.
+ Point maVirDevPos; /// Position of virtual device in the control.
+ Point maMousePos; /// Last mouse pointer position.
+
+ FrameBorder maLeft; /// All data of left frame border.
+ FrameBorder maRight; /// All data of right frame border.
+ FrameBorder maTop; /// All data of top frame border.
+ FrameBorder maBottom; /// All data of bottom frame border.
+ FrameBorder maHor; /// All data of inner horizontal frame border.
+ FrameBorder maVer; /// All data of inner vertical frame border.
+ FrameBorder maTLBR; /// All data of top-left to bottom-right frame border.
+ FrameBorder maBLTR; /// All data of bottom-left to top-right frame border.
+ SvxBorderLine maCurrStyle; /// Current style and color for new borders.
+ frame::Array maArray; /// Frame link array to draw an array of frame borders.
+
+ FrameSelFlags mnFlags; /// Flags for enabled frame borders.
+ FrameBorderPtrVec maAllBorders; /// Pointers to all frame borders.
+ FrameBorderPtrVec maEnabBorders; /// Pointers to enables frame borders.
+ Link maSelectHdl; /// Selection handler.
+
+ long mnCtrlSize; /// Size of the control (always square).
+ long mnArrowSize; /// Size of an arrow image.
+ long mnLine1; /// Middle of left/top frame borders.
+ long mnLine2; /// Middle of inner frame borders.
+ long mnLine3; /// Middle of right/bottom frame borders.
+ long mnFocusOffs; /// Offset from frame border middle to draw focus.
+
+ bool mbHor; /// true = Inner horizontal frame border enabled.
+ bool mbVer; /// true = Inner vertical frame border enabled.
+ bool mbTLBR; /// true = Top-left to bottom-right frame border enabled.
+ bool mbBLTR; /// true = Bottom-left to top-right frame border enabled.
+ bool mbFullRepaint; /// Used for repainting (false = only copy virtual device).
+ bool mbAutoSelect; /// true = Auto select a frame border, if focus reaches control.
+ bool mbClicked; /// true = The control has been clicked at least one time.
+ bool mbHCMode; /// true = High contrast mode.
+
+ a11y::AccFrameSelector* mpAccess; /// Pointer to accessibility object of the control.
+ XAccessibleRef mxAccess; /// Reference to accessibility object of the control.
+ AccessibleImplVec maChildVec; /// Pointers to accessibility objects for frame borders.
+ XAccessibleRefVec mxChildVec; /// References to accessibility objects for frame borders.
+
+ explicit FrameSelectorImpl( FrameSelector& rFrameSel );
+ ~FrameSelectorImpl();
+
+ // initialization ---------------------------------------------------------
+
+ /** Initializes the control, enables/disables frame borders according to flags. */
+ void Initialize( FrameSelFlags nFlags );
+
+ /** Fills all color members from current style settings. */
+ void InitColors();
+ /** Creates the image list with selection arrows regarding current style settings. */
+ void InitArrowImageList();
+ /** Initializes global coordinates. */
+ void InitGlobalGeometry();
+ /** Initializes coordinates of all frame borders. */
+ void InitBorderGeometry();
+ /** Initializes click areas of all enabled frame borders. */
+ void InitClickAreas();
+ /** Draws the entire control into the internal virtual device. */
+ void InitVirtualDevice();
+
+ // frame border access ----------------------------------------------------
+
+ /** Returns the object representing the specified frame border. */
+ const FrameBorder& GetBorder( FrameBorderType eBorder ) const;
+ /** Returns the object representing the specified frame border (write access). */
+ FrameBorder& GetBorderAccess( FrameBorderType eBorder );
+
+ // drawing ----------------------------------------------------------------
+
+ /** Draws the background of the entire control (the gray areas between borders). */
+ void DrawBackground();
+
+ /** Draws selection arrows for the specified frame border. */
+ void DrawArrows( const FrameBorder& rBorder );
+ /** Draws arrows in current selection state for all enabled frame borders. */
+ void DrawAllArrows();
+
+ /** Returns the color that has to be used to draw a frame border. */
+ Color GetDrawLineColor( const Color& rColor ) const;
+ /** Draws all frame borders. */
+ void DrawAllFrameBorders();
+
+ /** Draws all contents of the control. */
+ void DrawVirtualDevice();
+ /** Copies contents of the virtual device to the control. */
+ void CopyVirDevToControl();
+
+ /** Draws tracking rectangles for all selected frame borders. */
+ void DrawAllTrackingRects();
+
+ /** Converts a mouse position to the virtual device position. */
+ Point GetDevPosFromMousePos( const Point& rMousePos ) const;
+
+ /** Invalidates the control.
+ @param bFullRepaint true = Full repaint; false = update selection only. */
+ void DoInvalidate( bool bFullRepaint );
+
+ // frame border state and style -------------------------------------------
+
+ /** Sets the state of the specified frame border. */
+ void SetBorderState( FrameBorder& rBorder, FrameBorderState eState );
+ /** Sets the core style of the specified frame border, or hides the frame border, if pStyle is 0. */
+ void SetBorderCoreStyle( FrameBorder& rBorder, const SvxBorderLine* pStyle );
+ /** Sets the color of the specified frame border. */
+ void SetBorderColor( FrameBorder& rBorder, const Color& rColor );
+
+ /** Changes the state of a frame border after a control event (mouse/keyboard). */
+ void ToggleBorderState( FrameBorder& rBorder );
+
+ // frame border selection -------------------------------------------------
+
+ /** Selects a frame border and schedules redraw. */
+ void SelectBorder( FrameBorder& rBorder, bool bSelect );
+ /** Grabs focus without auto-selection of a frame border, if no border selected. */
+ void SilentGrabFocus();
+
+ /** Returns true, if all selected frame borders are equal (or if nothing is selected). */
+ bool SelectedBordersEqual() const;
+};
+
+// ============================================================================
+
+/** Dummy predicate for frame border iterators to use all borders in a container. */
+struct FrameBorderDummy_Pred
+{
+ inline bool operator()( const FrameBorder* ) const { return true; }
+};
+
+/** Predicate for frame border iterators to use only visible borders in a container. */
+struct FrameBorderVisible_Pred
+{
+ inline bool operator()( const FrameBorder* pBorder ) const { return pBorder->GetState() == FRAMESTATE_SHOW; }
+};
+
+/** Predicate for frame border iterators to use only selected borders in a container. */
+struct FrameBorderSelected_Pred
+{
+ inline bool operator()( const FrameBorder* pBorder ) const { return pBorder->IsSelected(); }
+};
+
+/** Template class for all types of frame border iterators. */
+template< typename Cont, typename Iter, typename Pred >
+class FrameBorderIterBase
+{
+public:
+ typedef Cont container_type;
+ typedef Iter iterator_type;
+ typedef Pred predicate_type;
+ typedef typename Cont::value_type value_type;
+ typedef FrameBorderIterBase< Cont, Iter, Pred > this_type;
+
+ explicit FrameBorderIterBase( container_type& rCont );
+ inline bool Is() const { return maIt != maEnd; }
+ this_type& operator++();
+ inline value_type operator*() const { return *maIt; }
+
+private:
+ iterator_type maIt;
+ iterator_type maEnd;
+ predicate_type maPred;
+};
+
+/** Iterator for constant svx::FrameBorder containers, iterates over all borders. */
+typedef FrameBorderIterBase< const FrameBorderPtrVec, FrameBorderPtrVec::const_iterator, FrameBorderDummy_Pred >
+ FrameBorderCIter;
+
+/** Iterator for mutable svx::FrameBorder containers, iterates over all borders. */
+typedef FrameBorderIterBase< FrameBorderPtrVec, FrameBorderPtrVec::iterator, FrameBorderDummy_Pred >
+ FrameBorderIter;
+
+/** Iterator for constant svx::FrameBorder containers, iterates over visible borders. */
+typedef FrameBorderIterBase< const FrameBorderPtrVec, FrameBorderPtrVec::const_iterator, FrameBorderVisible_Pred >
+ VisFrameBorderCIter;
+
+/** Iterator for mutable svx::FrameBorder containers, iterates over visible borders. */
+typedef FrameBorderIterBase< FrameBorderPtrVec, FrameBorderPtrVec::iterator, FrameBorderVisible_Pred >
+ VisFrameBorderIter;
+
+/** Iterator for constant svx::FrameBorder containers, iterates over selected borders. */
+typedef FrameBorderIterBase< const FrameBorderPtrVec, FrameBorderPtrVec::const_iterator, FrameBorderSelected_Pred >
+ SelFrameBorderCIter;
+
+/** Iterator for mutable svx::FrameBorder containers, iterates over selected borders. */
+typedef FrameBorderIterBase< FrameBorderPtrVec, FrameBorderPtrVec::iterator, FrameBorderSelected_Pred >
+ SelFrameBorderIter;
+
+// ============================================================================
+
+} // namespace svx
+
+#endif
+
diff --git a/svx/source/inc/gridcell.hxx b/svx/source/inc/gridcell.hxx
new file mode 100644
index 000000000000..cde1533eca46
--- /dev/null
+++ b/svx/source/inc/gridcell.hxx
@@ -0,0 +1,1156 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_GRIDCELL_HXX
+#define _SVX_GRIDCELL_HXX
+
+#include <svx/gridctrl.hxx>
+
+#include "sqlparserclient.hxx"
+#include "typeconversionclient.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/sdb/XColumn.hpp>
+#include <com/sun/star/form/XBoundControl.hpp>
+#include <com/sun/star/awt/XTextComponent.hpp>
+#include <com/sun/star/awt/XListBox.hpp>
+#include <com/sun/star/awt/XComboBox.hpp>
+#include <com/sun/star/awt/TextAlign.hpp>
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/awt/XCheckBox.hpp>
+#include <com/sun/star/awt/XButton.hpp>
+#include <com/sun/star/beans/XFastPropertySet.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/form/XChangeBroadcaster.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/propmultiplex.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <cppuhelper/component.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <tools/diagnose_ex.h>
+#include <tools/rtti.hxx>
+
+class DbCellControl;
+class Edit;
+class FmXGridCell;
+
+//==================================================================
+// FmMutexHelper
+//==================================================================
+class FmMutexHelper
+{
+protected:
+ ::osl::Mutex m_aMutex;
+};
+
+//==================================================================
+// DbGridColumn, Spaltenbeschreibung
+//==================================================================
+class DbGridColumn
+{
+ friend class DbGridControl;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xField; // Verbindung zum Datenbankfeld
+ ::svt::CellControllerRef m_xController; // Struktur zum Verwalten der Controls fuer eine Spalte
+ // diese wird von der DbBrowseBox auf die jeweiligen Zellen
+ // einer Spalte positioniert
+ FmXGridCell* m_pCell;
+
+protected:
+ DbGridControl& m_rParent;
+
+private:
+ sal_Int32 m_nLastVisibleWidth; // nur gueltig, wenn m_bHidden == sal_True
+ sal_Int32 m_nFormatKey;
+ sal_Int16 m_nFieldType;
+ sal_Int16 m_nTypeId;
+ sal_uInt16 m_nId;
+ sal_Int16 m_nFieldPos;
+ sal_Int16 m_nAlign; // wird mit TXT_ALIGN_LEFT .... angegeben
+ sal_Bool m_bReadOnly : 1;
+ sal_Bool m_bAutoValue : 1;
+ sal_Bool m_bInSave : 1;
+ sal_Bool m_bNumeric : 1;
+ sal_Bool m_bObject : 1; // Verweist die Column auf ein Object Datentyp?
+ sal_Bool m_bHidden : 1;
+ sal_Bool m_bLocked : 1;
+ sal_Bool m_bDateTime : 1;
+
+ static ::svt::CellControllerRef s_xEmptyController;
+ // used by locked columns
+public:
+ DbGridColumn(sal_uInt16 _nId, DbGridControl& rParent)
+ :m_pCell(NULL)
+ ,m_rParent(rParent)
+ ,m_nLastVisibleWidth(-1)
+ ,m_nFormatKey(0)
+ ,m_nFieldType(0)
+ ,m_nTypeId(0)
+ ,m_nId(_nId)
+ ,m_nFieldPos(-1)
+ ,m_nAlign(::com::sun::star::awt::TextAlign::LEFT)
+ ,m_bReadOnly(sal_False)
+ ,m_bAutoValue(sal_False)
+ ,m_bInSave(sal_False)
+ ,m_bNumeric(sal_False)
+ ,m_bObject(sal_False)
+ ,m_bHidden(sal_False)
+ ,m_bLocked(sal_False)
+ ,m_bDateTime(sal_False)
+ {
+ }
+
+ ~DbGridColumn();
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& getModel() const { return m_xModel; }
+ void setModel(::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _xModel);
+
+
+ sal_uInt16 GetId() const {return m_nId;}
+ sal_Bool IsReadOnly() const {return m_bReadOnly;}
+ sal_Bool IsAutoValue() const {return m_bAutoValue;}
+ sal_Bool IsUpdating() const {return m_bInSave;}
+ sal_Int16 GetAlignment() const {return m_nAlign;}
+ sal_Int16 GetType() const {return m_nFieldType;}
+ sal_Int16 GetFieldPos() const {return m_nFieldPos; }
+ sal_Bool IsNumeric() const {return m_bNumeric;}
+ sal_Bool IsDateTime() const {return m_bDateTime;}
+ sal_Bool IsObject() const {return m_bObject;}
+ sal_Bool IsHidden() const {return m_bHidden;}
+ sal_Int32 GetKey() const {return m_nFormatKey;}
+ const ::svt::CellControllerRef& GetController() const {return m_bLocked ? s_xEmptyController : m_xController;}
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& GetField() const {return m_xField;}
+ DbGridControl& GetParent() const {return m_rParent;}
+ FmXGridCell* GetCell() const {return m_pCell;}
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn > GetCurrentFieldValue() const;
+
+ // Zeichnen eines Feldes an einer Position, ist ein ::com::sun::star::sdbcx::View gesetzt
+ // uebernimmt dieser das Zeichnen, z.B. fuer CheckBoxen
+ void Paint(OutputDevice& rDev,
+ const Rectangle& rRect,
+ const DbGridRow* pRow,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
+
+
+ // Inititialierung im alive mode
+ // Ist kein ColumnController gesetzt, wird eine DefaultInitialisierung
+ // vorgenommen
+ void CreateControl(sal_Int32 _nFieldPos, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xField, sal_Int32 nTypeId);
+ void UpdateControl()
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xField(m_xField);
+ CreateControl(m_nFieldPos, xField, m_nTypeId);
+ }
+
+ // Editieren einer Zelle
+ void UpdateFromField(const DbGridRow* pRow, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
+ sal_Bool Commit();
+
+ // freigeben aller Daten, die fuer den AliveMode noetig sind
+ void Clear();
+
+ XubString GetCellText(const DbGridRow* pRow, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter) const;
+ XubString GetCellText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& xField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter) const;
+
+ void SetReadOnly(sal_Bool bRead){m_bReadOnly = bRead;}
+ void SetObject(sal_Int16 nPos) {m_bObject = m_bReadOnly = sal_True; m_nFieldPos = nPos;}
+
+ void ImplInitWindow( Window& rParent, const InitWindowFacet _eInitWhat );
+
+ // Properties, die auf den ::com::sun::star::frame::Controller durchschlagen koennen
+ sal_Int16 SetAlignment(sal_Int16 _nAlign);
+ // if _nAlign is -1, the alignment is calculated from the type of the field we are bound to
+ // the value really set is returned
+ sal_Int16 SetAlignmentFromModel(sal_Int16 nStandardAlign);
+ // set the alignment according to the "Align"-property of m_xModel, use the given standard
+ // alignment if the property if void, return the really set alignment
+
+ // column locking
+ sal_Bool isLocked() const { return m_bLocked; }
+ void setLock(sal_Bool _bLock);
+
+private:
+ /** attaches or detaches our cell object to the SctriptEventAttacherManager implemented
+ by our model's parent
+ */
+ void impl_toggleScriptManager_nothrow( bool _bAttach );
+};
+
+//==================================================================
+// DbCellControl, liefert die Daten fuer einen CellController
+// wird in der Regel nur für komplexe Controls wie z.B ComboBoxen
+// benoetigt
+//==================================================================
+class DbCellControl
+ :public ::svxform::OTypeConversionClient
+ ,public ::svxform::OStaticDataAccessTools
+ ,public FmMutexHelper // _before_ the listener, so the listener is to be destroyed first!
+ ,public ::comphelper::OPropertyChangeListener
+{
+private:
+ ::comphelper::OPropertyChangeMultiplexer* m_pModelChangeBroadcaster;
+ ::comphelper::OPropertyChangeMultiplexer* m_pFieldChangeBroadcaster;
+
+private:
+ sal_Bool m_bTransparent : 1;
+ sal_Bool m_bAlignedController : 1;
+ sal_Bool m_bAccessingValueProperty : 1;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >
+ m_xCursor;
+
+protected:
+ DbGridColumn& m_rColumn;
+ Window* m_pPainter;
+ Window* m_pWindow;
+
+protected:
+ // attribute access
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& getCursor() const { return m_xCursor; }
+
+ // control transparency
+ inline sal_Bool isTransparent( ) const { return m_bTransparent; }
+ inline void setTransparent( sal_Bool _bSet ) { m_bTransparent = _bSet; }
+
+ // control alignment
+ inline void setAlignedController( sal_Bool _bAlign = sal_True ) { m_bAlignedController = _bAlign; }
+
+
+ /** determined whether or not the value property is locked
+ @see lockValueProperty
+ */
+ inline sal_Bool isValuePropertyLocked() const;
+
+ /** locks the listening at the value property.
+ <p>This means that every subsequent change now done on the value property of the model ("Text", or "Value",
+ or whatever) is then ignored.<br/>
+ This base class uses this setting in <method>Commit</method>.</p>
+ @precond
+ Value locking can't be nested
+ @see unlockValueProperty
+ */
+ inline void lockValueProperty();
+ /** unlocks the listening at the value property
+ @see lockValueProperty
+ */
+ inline void unlockValueProperty();
+
+protected:
+ // adds the given property to the list of properties which we listen for
+ void doPropertyListening( const ::rtl::OUString& _rPropertyName );
+
+ // called whenever a property which affects field settings in general is called
+ // you should overwrite this method for every property you add yourself as listener to
+ // with doPropertyListening
+ virtual void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel );
+
+ // called by _propertyChanged if a property which denotes the column value has changed
+ void implValuePropertyChanged( );
+
+
+public:
+ TYPEINFO();
+ DbCellControl(DbGridColumn& _rColumn, sal_Bool _bText = sal_True);
+ virtual ~DbCellControl();
+
+
+ Window& GetWindow() const
+ {
+ ENSURE_OR_THROW( m_pWindow, "no window" );
+ return *m_pWindow;
+ }
+
+ // control alignment
+ inline sal_Bool isAlignedController() const { return m_bAlignedController; }
+ void AlignControl(sal_Int16 nAlignment);
+
+ void SetTextLineColor();
+ void SetTextLineColor(const Color& _rColor);
+
+ // Initialisieren bevor ein Control angezeigt wird
+ virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xCursor );
+ virtual ::svt::CellControllerRef CreateController() const = 0;
+
+ // Schreiben des Wertes in das Model
+ sal_Bool Commit();
+
+ // Formatting the field data to output text
+ virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL) = 0;
+
+ virtual void Update(){}
+ // Refresh the control by the field data
+ virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter) = 0;
+
+ // Painten eines Zellinhalts im vorgegeben Rechteck
+ virtual void PaintFieldToCell( OutputDevice& rDev, const Rectangle& rRect, const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
+ virtual void PaintCell( OutputDevice& _rDev, const Rectangle& _rRect );
+
+ void ImplInitWindow( Window& rParent, const InitWindowFacet _eInitWhat );
+
+ double GetValue(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter) const;
+
+protected:
+ void invalidatedController();
+
+ /** commits the content of the control (e.g. the text of an edit field) into the column model
+ (e.g. the "Text" property of the model).
+ <p>To be overwritten in derived classes.</p>
+ @see updateFromModel
+ */
+ virtual sal_Bool commitControl( ) = 0;
+
+ /** updates the current content of the control (e.g. the text of an edit field) from the column model
+ (e.g. the "Text" property of the model).
+ <p>To be overwritten in derived classes.</p>
+ @precond
+ NULL != _rxModel
+ @precond
+ NULL != m_pWindow
+
+ @see commitControl
+ */
+ virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel ) = 0;
+
+protected:
+// OPropertyChangeListener
+ virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException);
+
+private:
+ void implDoPropertyListening( const ::rtl::OUString& _rPropertyName, sal_Bool _bWarnIfNotExistent = sal_True );
+
+ /// updates the "readonly" setting on m_pWindow, according to the respective property value in the given model
+ void implAdjustReadOnly( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel,bool i_bReadOnly );
+
+ /// updates the "enabled" setting on m_pWindow, according to the respective property value in the given model
+ void implAdjustEnabled( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel );
+};
+
+//==================================================================
+//------------------------------------------------------------------
+inline sal_Bool DbCellControl::isValuePropertyLocked() const
+{
+ return m_bAccessingValueProperty;
+}
+
+//------------------------------------------------------------------
+inline void DbCellControl::lockValueProperty()
+{
+ OSL_ENSURE( !isValuePropertyLocked(), "DbCellControl::lockValueProperty: not to be nested!" );
+ m_bAccessingValueProperty = sal_True;
+}
+
+//------------------------------------------------------------------
+inline void DbCellControl::unlockValueProperty()
+{
+ OSL_ENSURE( isValuePropertyLocked(), "DbCellControl::lockValueProperty: not locked so far!" );
+ m_bAccessingValueProperty = sal_False;
+}
+
+//==================================================================
+/** a field which is bound to a column which supports the MaxTextLen property
+*/
+class DbLimitedLengthField : public DbCellControl
+{
+public:
+ TYPEINFO();
+
+protected:
+ DbLimitedLengthField( DbGridColumn& _rColumn );
+
+protected:
+ // DbCellControl
+ virtual void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel );
+
+protected:
+ inline void implSetMaxTextLen( sal_Int16 _nMaxLen )
+ {
+ implSetEffectiveMaxTextLen( _nMaxLen ? _nMaxLen : EDIT_NOLIMIT );
+ }
+ virtual void implSetEffectiveMaxTextLen( sal_Int16 _nMaxLen );
+};
+
+//==================================================================
+class DbTextField : public DbLimitedLengthField
+{
+ ::svt::IEditImplementation* m_pEdit;
+ ::svt::IEditImplementation* m_pPainterImplementation;
+ sal_Int16 m_nKeyType;
+ sal_Bool m_bIsSimpleEdit;
+
+protected:
+ ~DbTextField( );
+
+public:
+ TYPEINFO();
+ DbTextField(DbGridColumn& _rColumn);
+
+ ::svt::IEditImplementation* GetEditImplementation() { return m_pEdit; }
+ sal_Bool IsSimpleEdit() const { return m_bIsSimpleEdit; }
+
+ virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xCursor );
+ virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL);
+ virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
+ virtual ::svt::CellControllerRef CreateController() const;
+ virtual void PaintFieldToCell( OutputDevice& _rDev, const Rectangle& _rRect,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter );
+
+protected:
+ // DbCellControl
+ virtual sal_Bool commitControl( );
+ virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel );
+ // DbLimitedLengthField
+ virtual void implSetEffectiveMaxTextLen( sal_Int16 _nMaxLen );
+};
+
+//==================================================================
+class DbFormattedField : public DbLimitedLengthField
+{
+protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > m_xSupplier;
+ sal_Int16 m_nKeyType;
+
+
+public:
+ TYPEINFO();
+ DbFormattedField(DbGridColumn& _rColumn);
+ virtual ~DbFormattedField();
+
+
+ virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xCursor );
+ virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL);
+ virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
+ virtual ::svt::CellControllerRef CreateController() const;
+
+protected:
+ // DbCellControl
+ virtual sal_Bool commitControl( );
+ virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel );
+
+ // OPropertyChangeListener
+ virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException);
+};
+
+//==================================================================
+class DbCheckBox : public DbCellControl
+{
+public:
+ TYPEINFO();
+ DbCheckBox(DbGridColumn& _rColumn);
+
+ virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xCursor );
+ virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
+ virtual ::svt::CellControllerRef CreateController() const;
+ virtual void PaintFieldToCell(OutputDevice& rDev, const Rectangle& rRect,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
+ virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL);
+
+protected:
+ // DbCellControl
+ virtual sal_Bool commitControl( );
+ virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel );
+};
+
+//==================================================================
+class DbComboBox : public DbCellControl
+{
+ sal_Int16 m_nKeyType;
+
+public:
+ TYPEINFO();
+ DbComboBox(DbGridColumn& _rColumn);
+
+ virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xCursor );
+ virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL);
+ virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
+ virtual ::svt::CellControllerRef CreateController() const;
+
+ void SetList(const ::com::sun::star::uno::Any& rItems);
+
+protected:
+ // DbCellControl
+ virtual sal_Bool commitControl( );
+ virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel );
+
+ virtual void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel );
+
+ // OPropertyChangeListener
+ virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException);
+};
+
+//==================================================================
+class DbListBox :public DbCellControl
+{
+ sal_Bool m_bBound : 1;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aValueList;
+
+public:
+ TYPEINFO();
+ DbListBox(DbGridColumn& _rColumn);
+
+ virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xCursor );
+ virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL);
+ virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
+ virtual ::svt::CellControllerRef CreateController() const;
+
+ void SetList(const ::com::sun::star::uno::Any& rItems);
+
+protected:
+ // DbCellControl
+ virtual sal_Bool commitControl( );
+ virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel );
+
+ virtual void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel );
+
+ // OPropertyChangeListener
+ virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException);
+};
+
+//==================================================================
+class DbPatternField : public DbCellControl
+{
+public:
+ TYPEINFO();
+ DbPatternField( DbGridColumn& _rColumn, const ::comphelper::ComponentContext& _rContext );
+ virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xCursor );
+ virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL);
+ virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
+ virtual ::svt::CellControllerRef CreateController() const;
+
+protected:
+ /// DbCellControl
+ virtual sal_Bool commitControl( );
+ virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel );
+
+ virtual void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel );
+
+private:
+ String impl_formatText( const String& _rText );
+
+private:
+ ::std::auto_ptr< ::dbtools::FormattedColumnValue > m_pValueFormatter;
+ ::std::auto_ptr< ::dbtools::FormattedColumnValue > m_pPaintFormatter;
+ ::comphelper::ComponentContext m_aContext;
+};
+
+//==================================================================
+class DbSpinField : public DbCellControl
+{
+private:
+ sal_Int16 m_nStandardAlign;
+
+public:
+ TYPEINFO();
+
+protected:
+ DbSpinField( DbGridColumn& _rColumn, sal_Int16 _nStandardAlign = com::sun::star::awt::TextAlign::RIGHT );
+
+public:
+ virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& _rxCursor );
+ virtual ::svt::CellControllerRef CreateController() const;
+
+protected:
+ virtual SpinField* createField(
+ Window* _pParent,
+ WinBits _nFieldStyle,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel
+ ) = 0;
+};
+
+//==================================================================
+class DbDateField : public DbSpinField
+{
+public:
+ TYPEINFO();
+ DbDateField(DbGridColumn& _rColumn);
+ virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL);
+ virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
+
+protected:
+ // DbCellControl
+ virtual sal_Bool commitControl( );
+ virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel );
+
+ // DbSpinField
+ virtual SpinField* createField(
+ Window* _pParent,
+ WinBits _nFieldStyle,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel
+ );
+
+ /// initializes everything which relates to the properties describing the numeric behaviour
+ virtual void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel );
+};
+
+//==================================================================
+class DbTimeField : public DbSpinField
+{
+public:
+ TYPEINFO();
+ DbTimeField(DbGridColumn& _rColumn);
+ virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL);
+ virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
+
+protected:
+ // DbCellControl
+ virtual sal_Bool commitControl( );
+ virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel );
+
+ // DbSpinField
+ virtual SpinField* createField(
+ Window* _pParent,
+ WinBits _nFieldStyle,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel
+ );
+
+ /// initializes everything which relates to the properties describing the numeric behaviour
+ virtual void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel );
+};
+
+//==================================================================
+class DbCurrencyField : public DbSpinField
+{
+ sal_Int16 m_nScale;
+
+public:
+ TYPEINFO();
+ DbCurrencyField(DbGridColumn& _rColumn);
+ virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL);
+ virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
+
+ double GetCurrency(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter) const;
+
+protected:
+ // DbCellControl
+ virtual sal_Bool commitControl( );
+ virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel );
+
+ // DbSpinField
+ virtual SpinField* createField(
+ Window* _pParent,
+ WinBits _nFieldStyle,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel
+ );
+
+ /// initializes everything which relates to the properties describing the numeric behaviour
+ virtual void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel );
+};
+
+//==================================================================
+class DbNumericField : public DbSpinField
+{
+public:
+ TYPEINFO();
+ DbNumericField(DbGridColumn& _rColumn);
+ virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL);
+ virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
+
+protected:
+ // DbCellControl
+ virtual sal_Bool commitControl( );
+ virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel );
+
+ // DbSpinField
+ virtual SpinField* createField(
+ Window* _pParent,
+ WinBits _nFieldStyle,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel
+ );
+
+ /// initializes everything which relates to the properties describing the numeric behaviour
+ void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel );
+};
+
+//==================================================================
+class DbFilterField
+ :public DbCellControl
+ ,public ::svxform::OSQLParserClient
+{
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aValueList;
+ XubString m_aText;
+ Link m_aCommitLink;
+ sal_Int16 m_nControlClass;
+ sal_Bool m_bFilterList : 1;
+ sal_Bool m_bFilterListFilled : 1;
+ sal_Bool m_bBound : 1;
+
+public:
+ TYPEINFO();
+ DbFilterField(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,DbGridColumn& _rColumn);
+ virtual ~DbFilterField();
+
+ virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xCursor );
+ virtual ::svt::CellControllerRef CreateController() const;
+ virtual void PaintCell(OutputDevice& rDev, const Rectangle& rRect);
+ virtual void Update();
+ virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL);
+ virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
+
+ const XubString& GetText() const {return m_aText;}
+ void SetText(const XubString& rText);
+
+ void SetCommitHdl( const Link& rLink ) { m_aCommitLink = rLink; }
+ const Link& GetCommitHdl() const { return m_aCommitLink; }
+
+protected:
+
+ // DbCellControl
+ virtual sal_Bool commitControl( );
+ virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel );
+
+protected:
+ void SetList(const ::com::sun::star::uno::Any& rItems, sal_Bool bComboBox);
+ void CreateControl(Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xModel);
+ DECL_LINK( OnClick, void* );
+};
+
+//==================================================================
+// Base class providing the access to a grid cell
+//==================================================================
+typedef ::cppu::ImplHelper2 < ::com::sun::star::awt::XControl
+ , ::com::sun::star::form::XBoundControl
+ > FmXGridCell_Base;
+typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XWindow
+ > FmXGridCell_WindowBase;
+class FmXGridCell :public ::cppu::OComponentHelper
+ ,public FmXGridCell_Base
+ ,public FmXGridCell_WindowBase
+{
+protected:
+ ::osl::Mutex m_aMutex;
+ DbGridColumn* m_pColumn;
+ DbCellControl* m_pCellControl;
+
+private:
+ ::cppu::OInterfaceContainerHelper m_aWindowListeners;
+ ::cppu::OInterfaceContainerHelper m_aFocusListeners;
+ ::cppu::OInterfaceContainerHelper m_aKeyListeners;
+ ::cppu::OInterfaceContainerHelper m_aMouseListeners;
+ ::cppu::OInterfaceContainerHelper m_aMouseMotionListeners;
+
+protected:
+ virtual ~FmXGridCell();
+
+public:
+ TYPEINFO();
+ FmXGridCell( DbGridColumn* pColumn, DbCellControl* pControl );
+ void init();
+
+ DECLARE_UNO3_AGG_DEFAULTS(FmXGridCell, OComponentHelper);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException);
+
+ void SetTextLineColor();
+ void SetTextLineColor(const Color& _rColor);
+
+// XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+// OComponentHelper
+ virtual void SAL_CALL disposing();
+
+// ::com::sun::star::lang::XComponent
+ virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException){OComponentHelper::dispose();}
+ virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener)throw(::com::sun::star::uno::RuntimeException) { OComponentHelper::addEventListener(aListener);}
+ virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener)throw(::com::sun::star::uno::RuntimeException) { OComponentHelper::removeEventListener(aListener);}
+
+// ::com::sun::star::awt::XControl
+ virtual void SAL_CALL setContext(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& /*Context*/) throw(::com::sun::star::uno::RuntimeException){}
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getContext() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL createPeer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& /*Toolkit*/, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& /*Parent*/) throw(::com::sun::star::uno::RuntimeException){}
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > SAL_CALL getPeer() throw (::com::sun::star::uno::RuntimeException) {return ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > ();}
+ virtual sal_Bool SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& /*Model*/) throw (::com::sun::star::uno::RuntimeException) {return sal_False;}
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > SAL_CALL getModel() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView > SAL_CALL getView() throw (::com::sun::star::uno::RuntimeException) {return ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView > ();}
+ virtual void SAL_CALL setDesignMode(sal_Bool /*bOn*/) throw (::com::sun::star::uno::RuntimeException) {}
+ virtual sal_Bool SAL_CALL isDesignMode() throw (::com::sun::star::uno::RuntimeException) {return sal_False;}
+ virtual sal_Bool SAL_CALL isTransparent() throw (::com::sun::star::uno::RuntimeException) {return sal_False;}
+
+// ::com::sun::star::form::XBoundControl
+ virtual sal_Bool SAL_CALL getLock() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setLock(sal_Bool _bLock) throw(::com::sun::star::uno::RuntimeException);
+
+ // XWindow
+ virtual void SAL_CALL setPosSize( ::sal_Int32 X, ::sal_Int32 Y, ::sal_Int32 Width, ::sal_Int32 Height, ::sal_Int16 Flags ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getPosSize( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setVisible( ::sal_Bool Visible ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setEnable( ::sal_Bool Enable ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ sal_Bool Commit() {return m_pCellControl->Commit();}
+ void ImplInitWindow( Window& rParent, const InitWindowFacet _eInitWhat )
+ { m_pCellControl->ImplInitWindow( rParent, _eInitWhat ); }
+
+ sal_Bool isAlignedController() const { return m_pCellControl->isAlignedController(); }
+ void AlignControl(sal_Int16 nAlignment)
+ { m_pCellControl->AlignControl(nAlignment);}
+
+protected:
+ virtual Window* getEventWindow() const;
+ virtual void onWindowEvent( const sal_uLong _nEventId, const Window& _rWindow, const void* _pEventData );
+
+ // default implementations call our focus listeners, don't forget to call them if you override this
+ virtual void onFocusGained( const ::com::sun::star::awt::FocusEvent& _rEvent );
+ virtual void onFocusLost( const ::com::sun::star::awt::FocusEvent& _rEvent );
+
+private:
+ DECL_LINK( OnWindowEvent, VclWindowEvent* );
+};
+
+//==================================================================
+class FmXDataCell : public FmXGridCell
+{
+public:
+ TYPEINFO();
+ FmXDataCell( DbGridColumn* pColumn, DbCellControl& _rControl )
+ :FmXGridCell( pColumn, &_rControl )
+ {
+ }
+
+ virtual void PaintFieldToCell(OutputDevice& rDev,
+ const Rectangle& rRect,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& xField,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
+
+ void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& xField,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter)
+ { m_pCellControl->UpdateFromField(xField, xFormatter); }
+
+protected:
+ void UpdateFromColumn();
+};
+
+//==================================================================
+class FmXTextCell : public FmXDataCell
+{
+protected:
+ /** determines whether the text of this cell can be painted directly, without
+ using the painter control
+
+ If this is <TRUE/>, the <member>PaintCell</member> method will simply use the text as returned
+ by <member>GetText</member>, and draw it onto the device passed to <member>PaintFieldToCell</member>,
+ while respecting the current alignment settings.
+
+ If this is <FALSE/>, the <member>PaintFieldToCell</member> request will be forwarded to the painter
+ control (<member>m_pPainter</member>). This is more expensive, but the only option
+ if your painting involves more that a simple DrawText.
+
+ This member is <TRUE/> by default, and can be modified by derived classes.
+ */
+ sal_Bool m_bFastPaint;
+
+public:
+ TYPEINFO();
+ FmXTextCell( DbGridColumn* pColumn, DbCellControl& _rControl );
+
+ virtual void PaintFieldToCell(OutputDevice& rDev,
+ const Rectangle& rRect,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& xField,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
+
+ XubString GetText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter,
+ Color** ppColor = NULL)
+ {return m_pCellControl->GetFormatText(_rxField, xFormatter, ppColor);}
+};
+
+//==================================================================
+typedef ::cppu::ImplHelper2 < ::com::sun::star::awt::XTextComponent
+ , ::com::sun::star::form::XChangeBroadcaster
+ > FmXEditCell_Base;
+class FmXEditCell : public FmXTextCell,
+ public FmXEditCell_Base
+{
+private:
+ ::rtl::OUString m_sValueOnEnter;
+
+protected:
+ ::cppu::OInterfaceContainerHelper m_aTextListeners;
+ ::cppu::OInterfaceContainerHelper m_aChangeListeners;
+ ::svt::IEditImplementation* m_pEditImplementation;
+ bool m_bOwnEditImplementation;
+
+ virtual ~FmXEditCell();
+public:
+ FmXEditCell( DbGridColumn* pColumn, DbCellControl& _rControl );
+
+ DECLARE_UNO3_AGG_DEFAULTS(FmXEditCell, FmXTextCell);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( 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 ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+// OComponentHelper
+ virtual void SAL_CALL disposing();
+
+// ::com::sun::star::awt::XTextComponent
+ virtual void SAL_CALL addTextListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener >& l) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeTextListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener >& l) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setText(const ::rtl::OUString& aText) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertText(const ::com::sun::star::awt::Selection& Sel, const ::rtl::OUString& Text) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getText() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSelectedText() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSelection(const ::com::sun::star::awt::Selection& aSelection) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Selection SAL_CALL getSelection() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isEditable() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setEditable(sal_Bool bEditable) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMaxTextLen(sal_Int16 nLen) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getMaxTextLen() throw(::com::sun::star::uno::RuntimeException);
+
+ // XChangeBroadcaster
+ virtual void SAL_CALL addChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XChangeListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XChangeListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ virtual void onWindowEvent( const sal_uLong _nEventId, const Window& _rWindow, const void* _pEventData );
+
+ virtual void onFocusGained( const ::com::sun::star::awt::FocusEvent& _rEvent );
+ virtual void onFocusLost( const ::com::sun::star::awt::FocusEvent& _rEvent );
+
+private:
+ void onTextChanged();
+};
+
+//==================================================================
+typedef ::cppu::ImplHelper2 < ::com::sun::star::awt::XCheckBox
+ , ::com::sun::star::awt::XButton
+ > FmXCheckBoxCell_Base;
+class FmXCheckBoxCell : public FmXDataCell,
+ public FmXCheckBoxCell_Base
+{
+ ::cppu::OInterfaceContainerHelper m_aItemListeners;
+ ::cppu::OInterfaceContainerHelper m_aActionListeners;
+ ::rtl::OUString m_aActionCommand;
+ CheckBox* m_pBox;
+
+protected:
+ virtual ~FmXCheckBoxCell();
+
+public:
+ FmXCheckBoxCell( DbGridColumn* pColumn, DbCellControl& _rControl );
+
+// UNO
+ DECLARE_UNO3_AGG_DEFAULTS(FmXCheckBoxCell, FmXDataCell);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+// OComponentHelper
+ virtual void SAL_CALL disposing();
+
+// ::com::sun::star::awt::XCheckBox
+ virtual void SAL_CALL addItemListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeItemListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getState() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setState(sal_Int16 n) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setLabel(const ::rtl::OUString& Label) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL enableTriState(sal_Bool b) throw(::com::sun::star::uno::RuntimeException);
+
+ // XButton
+ virtual void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw (::com::sun::star::uno::RuntimeException);
+ //virtual void SAL_CALL setLabel( const ::rtl::OUString& Label ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setActionCommand( const ::rtl::OUString& Command ) throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ virtual Window* getEventWindow() const;
+ virtual void onWindowEvent( const sal_uLong _nEventId, const Window& _rWindow, const void* _pEventData );
+};
+
+//==================================================================
+typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XListBox
+ > FmXListBoxCell_Base;
+class FmXListBoxCell :public FmXTextCell
+ ,public FmXListBoxCell_Base
+{
+ ::cppu::OInterfaceContainerHelper m_aItemListeners,
+ m_aActionListeners;
+ ListBox* m_pBox;
+
+protected:
+ virtual ~FmXListBoxCell();
+
+public:
+ FmXListBoxCell( DbGridColumn* pColumn, DbCellControl& _rControl );
+
+ DECLARE_UNO3_AGG_DEFAULTS(FmXListBoxCell, FmXTextCell);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+// OComponentHelper
+ virtual void SAL_CALL disposing();
+
+// ::com::sun::star::awt::XListBox
+ virtual void SAL_CALL addItemListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeItemListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addActionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeActionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addItem(const ::rtl::OUString& aItem, sal_Int16 nPos) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addItems(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aItems, sal_Int16 nPos) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeItems(sal_Int16 nPos, sal_Int16 nCount) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getItemCount() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getItem(sal_Int16 nPos) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getItems() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getSelectedItemPos() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSelectedItemsPos() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSelectedItem() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSelectedItems() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL SAL_CALL selectItemPos(sal_Int16 nPos, sal_Bool bSelect) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL SAL_CALL selectItemsPos(const ::com::sun::star::uno::Sequence< sal_Int16 >& aPositions, sal_Bool bSelect) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL SAL_CALL selectItem(const ::rtl::OUString& aItem, sal_Bool bSelect) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isMutipleMode() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL SAL_CALL setMultipleMode(sal_Bool bMulti) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getDropDownLineCount() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL SAL_CALL setDropDownLineCount(sal_Int16 nLines) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL SAL_CALL makeVisible(sal_Int16 nEntry) throw(::com::sun::star::uno::RuntimeException);
+
+protected:
+ virtual void onWindowEvent( const sal_uLong _nEventId, const Window& _rWindow, const void* _pEventData );
+
+ DECL_LINK( OnDoubleClick, void* );
+};
+
+//==================================================================
+typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XComboBox
+ > FmXComboBoxCell_Base;
+class FmXComboBoxCell :public FmXTextCell
+ ,public FmXComboBoxCell_Base
+{
+private:
+ ::cppu::OInterfaceContainerHelper m_aItemListeners,
+ m_aActionListeners;
+ ComboBox* m_pComboBox;
+
+protected:
+ virtual ~FmXComboBoxCell();
+
+public:
+ FmXComboBoxCell( DbGridColumn* pColumn, DbCellControl& _rControl );
+
+ DECLARE_UNO3_AGG_DEFAULTS(FmXListBoxCell, FmXTextCell);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+ // XComboBox
+ virtual void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& _Listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& _Listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& _Listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& _Listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addItem( const ::rtl::OUString& _Item, ::sal_Int16 _Pos ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _Items, ::sal_Int16 _Pos ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeItems( ::sal_Int16 nPos, ::sal_Int16 nCount ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int16 SAL_CALL getItemCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getItem( ::sal_Int16 _Pos ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getItems( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int16 SAL_CALL getDropDownLineCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDropDownLineCount( ::sal_Int16 _Lines ) throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ virtual void onWindowEvent( const sal_uLong _nEventId, const Window& _rWindow, const void* _pEventData );
+};
+
+//==================================================================
+typedef ::cppu::ImplHelper2 < ::com::sun::star::awt::XTextComponent
+ , ::com::sun::star::lang::XUnoTunnel
+ > FmXFilterCell_Base;
+class FmXFilterCell :public FmXGridCell
+ ,public FmXFilterCell_Base
+{
+ ::cppu::OInterfaceContainerHelper m_aTextListeners;
+protected:
+ virtual ~FmXFilterCell();
+public:
+ TYPEINFO();
+ FmXFilterCell(DbGridColumn* pColumn = NULL, DbCellControl* pControl = NULL);
+
+
+ DECLARE_UNO3_AGG_DEFAULTS(FmXFilterCell, FmXGridCell);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+// XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+// helpers for XUnoTunnel
+ static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
+ static FmXFilterCell* getImplementation(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxObject);
+
+// painting the filter text
+ virtual void PaintCell(OutputDevice& rDev, const Rectangle& rRect);
+ void Update(){m_pCellControl->Update();}
+
+// OComponentHelper
+ virtual void SAL_CALL disposing();
+
+// ::com::sun::star::awt::XTextComponent
+ virtual void SAL_CALL addTextListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener >& l) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeTextListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener >& l) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setText(const ::rtl::OUString& aText) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertText(const ::com::sun::star::awt::Selection& Sel, const ::rtl::OUString& Text) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getText() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSelectedText() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSelection(const ::com::sun::star::awt::Selection& aSelection) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Selection SAL_CALL getSelection() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isEditable() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setEditable(sal_Bool bEditable) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMaxTextLen(sal_Int16 nLen) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getMaxTextLen() throw(::com::sun::star::uno::RuntimeException);
+
+protected:
+ DECL_LINK( OnCommit, void* );
+};
+
+#endif // _SVX_GRIDCELL_HXX
+
diff --git a/svx/source/inc/gridcols.hxx b/svx/source/inc/gridcols.hxx
new file mode 100644
index 000000000000..29390d64a59a
--- /dev/null
+++ b/svx/source/inc/gridcols.hxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_GRIDCOLS_HXX
+#define _SVX_GRIDCOLS_HXX
+
+#include <sal/types.h>
+
+namespace rtl { class OUString; }
+
+#define FM_COL_TEXTFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextField" ) )
+#define FM_COL_COMBOBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ComboBox" ) )
+#define FM_COL_CHECKBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CheckBox" ) )
+#define FM_COL_TIMEFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TimeField" ) )
+#define FM_COL_DATEFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateField" ) )
+#define FM_COL_NUMERICFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NumericField" ) )
+#define FM_COL_CURRENCYFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CurrencyField" ) )
+#define FM_COL_PATTERNFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PatternField" ) )
+#define FM_COL_LISTBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ListBox" ) )
+#define FM_COL_FORMATTEDFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FormattedField" ) )
+
+// column type ids
+#define TYPE_CHECKBOX 0
+#define TYPE_COMBOBOX 1
+#define TYPE_CURRENCYFIELD 2
+#define TYPE_DATEFIELD 3
+#define TYPE_FORMATTEDFIELD 4
+#define TYPE_LISTBOX 5
+#define TYPE_NUMERICFIELD 6
+#define TYPE_PATTERNFIELD 7
+#define TYPE_TEXTFIELD 8
+#define TYPE_TIMEFIELD 9
+
+//------------------------------------------------------------------------------
+sal_Int32 getColumnTypeByModelName(const ::rtl::OUString& aModelName);
+
+
+#endif // _SVX_GRIDCOLS_HXX
+
diff --git a/svx/source/inc/linectrl.hrc b/svx/source/inc/linectrl.hrc
new file mode 100644
index 000000000000..59c224f4240c
--- /dev/null
+++ b/svx/source/inc/linectrl.hrc
@@ -0,0 +1,28 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define RID_SVXCTRL_LINECTRL 257
+
diff --git a/svx/source/inc/recoveryui.hxx b/svx/source/inc/recoveryui.hxx
new file mode 100644
index 000000000000..f0af19699afb
--- /dev/null
+++ b/svx/source/inc/recoveryui.hxx
@@ -0,0 +1,155 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _RECOVERYUI_HXX
+#define _RECOVERYUI_HXX
+
+//===============================================
+// includes
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/frame/XSynchronousDispatch.hpp>
+#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <vcl/window.hxx>
+#include "docrecovery.hxx"
+
+//===============================================
+// namespace
+
+namespace svx
+{
+
+// Dont export this header ... Otherwise you have to remove this namespace alias!
+namespace css = ::com::sun::star;
+namespace svxdr = ::svx::DocRecovery;
+
+//===============================================
+// declarations
+
+class RecoveryUI : public ::cppu::WeakImplHelper2< css::lang::XServiceInfo ,
+ css::frame::XSynchronousDispatch > // => XDispatch!
+{
+ //-------------------------------------------
+ // const, types, etcpp.
+ private:
+
+ /** @short TODO */
+ enum EJob
+ {
+ E_JOB_UNKNOWN,
+ E_DO_EMERGENCY_SAVE,
+ E_DO_RECOVERY,
+ E_DO_CRASHREPORT
+ };
+
+ //-------------------------------------------
+ // member
+ private:
+
+ /** @short TODO */
+ css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
+
+ /** @short TODO */
+ Window* m_pParentWindow;
+
+ /** @short TODO */
+ RecoveryUI::EJob m_eJob;
+
+ /** @short TODO */
+ css::uno::Reference< css::task::XStatusIndicatorFactory > m_xProgressFactory;
+
+ //-------------------------------------------
+ // interface
+ public:
+
+ //---------------------------------------
+ /** @short TODO */
+ RecoveryUI(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
+
+ //---------------------------------------
+ /** @short TODO */
+ virtual ~RecoveryUI();
+
+ //---------------------------------------
+ // css.lang.XServiceInfo
+
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw(css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& sServiceName)
+ throw(css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
+ throw(css::uno::RuntimeException);
+
+ //---------------------------------------
+ virtual com::sun::star::uno::Any SAL_CALL dispatchWithReturnValue(const css::util::URL& aURL,
+ const css::uno::Sequence< css::beans::PropertyValue >& lArguments )
+ throw(css::uno::RuntimeException);
+
+ //---------------------------------------
+ // css.frame.XDispatch
+
+ virtual void SAL_CALL dispatch(const css::util::URL& aURL ,
+ const css::uno::Sequence< css::beans::PropertyValue >& lArguments)
+ throw(css::uno::RuntimeException);
+
+ virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener >& xListener,
+ const css::util::URL& aURL )
+ throw(css::uno::RuntimeException);
+ virtual void SAL_CALL removeStatusListener(const css::uno::Reference< css::frame::XStatusListener >& xListener,
+ const css::util::URL& aURL )
+ throw(css::uno::RuntimeException);
+
+ //---------------------------------------
+ // XServiceInfo helper
+
+ static ::rtl::OUString st_getImplementationName();
+ static css::uno::Sequence< ::rtl::OUString > st_getSupportedServiceNames();
+ static css::uno::Reference< css::uno::XInterface > SAL_CALL st_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
+
+ //-------------------------------------------
+ // helper
+ private:
+
+ EJob impl_classifyJob(const css::util::URL& aURL);
+
+ sal_Bool impl_doEmergencySave();
+
+ void impl_doRecovery();
+
+ void impl_showAllRecoveredDocs();
+
+ void impl_doCrashReport();
+
+};
+
+} // namespace svx
+
+#endif // _RECOVERYUI_HXX
diff --git a/svx/source/inc/sdbdatacolumn.hxx b/svx/source/inc/sdbdatacolumn.hxx
new file mode 100644
index 000000000000..cb108cb2c08c
--- /dev/null
+++ b/svx/source/inc/sdbdatacolumn.hxx
@@ -0,0 +1,140 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_FORM_SDBDATACOLUMN_HXX
+#define SVX_FORM_SDBDATACOLUMN_HXX
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdb/XColumn.hpp>
+#include <com/sun/star/sdb/XColumnUpdate.hpp>
+#include <osl/diagnose.h>
+
+//..............................................................................
+namespace svxform
+{
+//..............................................................................
+
+ //==========================================================================
+ //= DataColumn - a class wrapping an object implementing a sdb::DataColumn service
+ //==========================================================================
+ class DataColumn
+ {
+ // interfaces needed for sddb::Column
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xPropertySet;
+ // interfaces needed for sdb::DataColumn
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn> m_xColumn;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumnUpdate> m_xColumnUpdate;
+
+ public:
+ DataColumn() { };
+ DataColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxIFace);
+ // if the object behind _rxIFace doesn't fully support the DataColumn service,
+ // (which is checked via the supported interfaces) _all_ members will be set to
+ // void !, even if the object has some of the needed interfaces.
+
+ sal_Bool is() const { return m_xColumn.is(); }
+ sal_Bool Is() const { return m_xColumn.is(); }
+ sal_Bool supportsUpdate() const { return m_xColumnUpdate.is(); }
+
+ DataColumn* operator ->() { return this; }
+ operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> () const{ return m_xColumn.get(); }
+
+ // 'conversions'
+ inline const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& getPropertySet() const
+ {
+ return m_xPropertySet;
+ }
+ inline const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn>& getColumn() const
+ {
+ return m_xColumn;
+ }
+ inline const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumnUpdate>& getColumnUpdate() const
+ {
+ OSL_ENSURE(m_xColumnUpdate.is() , "DataColumn::getColumnUpdate: NULL!");
+ return m_xColumnUpdate;
+ }
+
+ // das normale queryInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& type) throw ( ::com::sun::star::uno::RuntimeException )
+ { return m_xColumn->queryInterface(type); }
+
+ // ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> getPropertySetInfo() const throw( ::com::sun::star::uno::RuntimeException );
+ inline void setPropertyValue(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+ inline ::com::sun::star::uno::Any getPropertyValue(const ::rtl::OUString& PropertyName) const throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+ inline void addPropertyChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener>& xListener) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+ inline void removePropertyChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener>& aListener) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+ inline void addVetoableChangeListener(const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener>& aListener) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+ inline void removeVetoableChangeListener(const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener>& aListener) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ // ::com::sun::star::sdb::XColumn
+ inline sal_Bool wasNull() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline ::rtl::OUString getString() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline sal_Bool getBoolean() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline sal_Int8 getByte() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline sal_Int16 getShort() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline sal_Int32 getInt() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline sal_Int64 getLong() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline float getFloat() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline double getDouble() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline ::com::sun::star::uno::Sequence< sal_Int8 > getBytes() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline ::com::sun::star::util::Date getDate() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline ::com::sun::star::util::Time getTime() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline ::com::sun::star::util::DateTime getTimestamp() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream> getBinaryStream() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream> getCharacterStream() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline ::com::sun::star::uno::Any getObject(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& typeMap) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef> getRef() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob> getBlob() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob> getClob() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray> getArray() throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+
+ // XColumnUpdate
+ inline void updateNull(void) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline void updateBoolean(sal_Bool x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline void updateByte(sal_Int8 x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline void updateShort(sal_Int16 x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline void updateInt(sal_Int32 x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline void updateLong(sal_Int64 x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline void updateFloat(float x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline void updateDouble(double x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline void updateString(const ::rtl::OUString& x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline void updateBytes(const ::com::sun::star::uno::Sequence< sal_Int8 >& x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline void updateDate(const com::sun::star::util::Date& x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline void updateTime(const ::com::sun::star::util::Time& x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline void updateTimestamp(const ::com::sun::star::util::DateTime& x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline void updateBinaryStream(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>& x, sal_Int32 length) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline void updateCharacterStream(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>& x, sal_Int32 length) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline void updateObject(const ::com::sun::star::uno::Any& x) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ inline void updateNumericObject(const ::com::sun::star::uno::Any& x, sal_Int32 scale) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
+ };
+
+#endif // SVX_FORM_SDBDATACOLUMN_HXX
+
+//..............................................................................
+} // namespace svxform
+//..............................................................................
diff --git a/svx/source/inc/sqlparserclient.hxx b/svx/source/inc/sqlparserclient.hxx
new file mode 100644
index 000000000000..01e175d51e4e
--- /dev/null
+++ b/svx/source/inc/sqlparserclient.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_SQLPARSERCLIENT_HXX
+#define SVX_SQLPARSERCLIENT_HXX
+
+#include "svx/dbtoolsclient.hxx"
+#include "svx/ParseContext.hxx"
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ //====================================================================
+ //= OSQLParserClient
+ //====================================================================
+ class SVX_DLLPUBLIC OSQLParserClient : public ODbtoolsClient
+ ,public ::svxform::OParseContextClient
+ {
+ private:
+ //add by BerryJia for fixing Bug97420 Time:2002-9-12-11:00(PRC time)
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB;
+
+ protected:
+ mutable ::rtl::Reference< ::connectivity::simple::ISQLParser > m_xParser;
+
+ protected:
+ OSQLParserClient(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB);
+ virtual bool ensureLoaded() const;
+
+ protected:
+ inline ::rtl::Reference< ::connectivity::simple::ISQLParseNode > predicateTree(
+ ::rtl::OUString& _rErrorMessage,
+ const ::rtl::OUString& _rStatement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField
+ ) const
+ {
+ ::rtl::Reference< ::connectivity::simple::ISQLParseNode > xReturn;
+ if ( ensureLoaded() )
+ xReturn = m_xParser->predicateTree(_rErrorMessage, _rStatement, _rxFormatter, _rxField);
+ return xReturn;
+ }
+ };
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
+#endif // SVX_SQLPARSERCLIENT_HXX
+
+
diff --git a/svx/source/inc/stringlistresource.hxx b/svx/source/inc/stringlistresource.hxx
new file mode 100644
index 000000000000..5fdcfb320443
--- /dev/null
+++ b/svx/source/inc/stringlistresource.hxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_STRINGLISTRESOURCE_HXX
+#define SVX_STRINGLISTRESOURCE_HXX
+
+#include <tools/rc.hxx>
+
+#include <svx/svxdllapi.h>
+
+#include <memory>
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ //====================================================================
+ //= StringListResource
+ //====================================================================
+ /** loads a list of strings from a resource, where the resource is of type RSC_RESOURCE,
+ and has sub resources of type string, numbered from 1 to n
+ */
+ class StringListResource : public Resource
+ {
+ public:
+ SVX_DLLPUBLIC StringListResource( const ResId& _rResId );
+ SVX_DLLPUBLIC ~StringListResource();
+
+ inline void get( ::std::vector< String >& _rStrings )
+ {
+ _rStrings = m_aStrings;
+ }
+
+
+ /** returns the String with a given local resource id
+
+ @param _nResId
+ The resource id. It will not be checked if this id exists.
+
+ @return String
+ The string.
+ */
+ String getString( sal_uInt16 _nResId )
+ {
+ return String( ResId( _nResId, *m_pResMgr ) );
+ }
+
+ size_t size() const { return m_aStrings.size(); }
+ bool empty() const { return m_aStrings.empty(); }
+
+ const String& operator[]( size_t _index ) const { return m_aStrings[ _index ]; }
+
+ private:
+ ::std::vector< String > m_aStrings;
+ };
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
+#endif // SVX_STRINGLISTRESOURCE_HXX
diff --git a/svx/source/inc/svdoimp.hxx b/svx/source/inc/svdoimp.hxx
new file mode 100644
index 000000000000..91add6aaa48e
--- /dev/null
+++ b/svx/source/inc/svdoimp.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_SVDOIMP_HXX
+#define _SVX_SVDOIMP_HXX
+
+#include <vcl/mapmod.hxx>
+
+//#include <svl/lstner.hxx>
+//#include <vcl/timer.hxx>
+//#include <svx/svdsob.hxx>
+//#include <svx/svdtypes.hxx> // fuer SdrLayerID
+//#include <svx/svdglue.hxx> // Klebepunkte
+//#include <svx/xdash.hxx>
+//#include <svx/xpoly.hxx>
+//#include <svx/xenum.hxx>
+//#include <basegfx/vector/b2dvector.hxx>
+#include <svx/rectenum.hxx>
+//#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+class Bitmap;
+
+///////////////////////////////////////////////////////////////////////////////
+
+// #104609# Extracted from old XOutDev's ImpCalcBmpFillStartValues
+
+/** Calc offset and size for bitmap fill
+
+ This method calculates the size and the offset from the left, top
+ position of a shape in logical coordinates
+
+ @param rStartOffset
+ The offset from the left, top position of the output rectangle is returned
+
+ @param rBmpOutputSize
+ The output size of the bitmap is returned herein
+
+ @param rOutputRect
+ Specifies the output rectangle into which the bitmap should be tiled into
+
+ @param rOutputMapMode
+ Specifies the logical coordinate system the output rectangle is in
+
+ @param rFillBitmap
+ Specifies the bitmap to fill with
+
+ @param rBmpSize
+ The desired destination bitmap size. If null, size is taken from the bitmap
+
+ @param rBmpPerCent
+ Percentage of bitmap size, relative to the output rectangle
+
+ @param rBmpOffPerCent
+ Offset for bitmap tiling, in percentage relative to bitmap output size
+
+ @param bBmpLogSize
+ True when using the preferred bitmap size, False when using the percentage value
+
+ @param bBmpTile
+ True for tiling. False only paints one instance of the bitmap
+
+ @param bBmpStretch
+ True if bitmap should be stretched to output rect dimension
+
+ @param eBmpRectPoint
+ Position of the start point relative to the bitmap
+
+ */
+void ImpCalcBmpFillSizes( Size& rStartOffset,
+ Size& rBmpOutputSize,
+ const Rectangle& rOutputRect,
+ const MapMode& rOutputMapMode,
+ const Bitmap& rFillBitmap,
+ const Size& rBmpSize,
+ const Size& rBmpPerCent,
+ const Size& rBmpOffPerCent,
+ sal_Bool bBmpLogSize,
+ sal_Bool bBmpTile,
+ sal_Bool bBmpStretch,
+ RECT_POINT eBmpRectPoint );
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif // _SVX_SVDOIMP_HXX
+
+// eof
diff --git a/svx/source/inc/svdoutlinercache.hxx b/svx/source/inc/svdoutlinercache.hxx
new file mode 100644
index 000000000000..356011d41cfa
--- /dev/null
+++ b/svx/source/inc/svdoutlinercache.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_SDROUTLINER_HXX
+#define _SVX_SDROUTLINER_HXX
+
+#include <sal/types.h>
+
+class SdrModel;
+class SdrOutliner;
+
+
+class SdrOutlinerCache
+{
+private:
+ SdrModel* mpModel;
+
+ SdrOutliner* mpModeOutline;
+ SdrOutliner* mpModeText;
+public:
+ SdrOutlinerCache( SdrModel* pModel );
+ ~SdrOutlinerCache();
+
+ SdrOutliner* createOutliner( sal_uInt16 nOutlinerMode );
+ void disposeOutliner( SdrOutliner* pOutliner );
+};
+
+#endif
+
+
diff --git a/svx/source/inc/svxrectctaccessiblecontext.hxx b/svx/source/inc/svxrectctaccessiblecontext.hxx
new file mode 100644
index 000000000000..be1265cb0c98
--- /dev/null
+++ b/svx/source/inc/svxrectctaccessiblecontext.hxx
@@ -0,0 +1,566 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _SVXRECTACCESSIBLECONTEXT_HXX
+#define _SVXRECTACCESSIBLECONTEXT_HXX
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <cppuhelper/weak.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XServiceName.hpp>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <vos/mutex.hxx>
+#include <cppuhelper/interfacecontainer.h>
+#include <cppuhelper/compbase6.hxx>
+//#ifndef _CPPUHELPER_COMPBASE7_HXX_
+//#include <cppuhelper/compbase7.hxx>
+//#endif
+#include <comphelper/broadcasthelper.hxx>
+#include <cppuhelper/implbase6.hxx>
+#include <comphelper/servicehelper.hxx>
+#include <svx/rectenum.hxx>
+
+namespace com { namespace sun { namespace star { namespace awt {
+ struct Point;
+ struct Rectangle;
+ struct Size;
+ class XFocusListener;
+} } } }
+
+class Rectangle;
+class SvxRectCtl;
+class SvxRectCtlChildAccessibleContext;
+class Window;
+
+
+typedef ::cppu::WeakAggComponentImplHelper6<
+ ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleComponent,
+ ::com::sun::star::accessibility::XAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+ ::com::sun::star::accessibility::XAccessibleSelection,
+ ::com::sun::star::lang::XServiceInfo >
+ SvxRectCtlAccessibleContext_Base;
+
+class SvxRectCtlAccessibleContext : public ::comphelper::OBaseMutex, public SvxRectCtlAccessibleContext_Base
+{
+public:
+ //===== internal ========================================================
+ SvxRectCtlAccessibleContext(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>& rxParent,
+ SvxRectCtl& rRepresentation,
+ const ::rtl::OUString* pName = NULL,
+ const ::rtl::OUString* pDescription = NULL );
+protected:
+ virtual ~SvxRectCtlAccessibleContext();
+public:
+ //===== XAccessible =====================================================
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL
+ getAccessibleContext( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+ //===== XAccessibleComponent ============================================
+
+ virtual sal_Bool SAL_CALL
+ containsPoint( const ::com::sun::star::awt::Point& rPoint ) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL
+ getBounds() throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::awt::Point SAL_CALL
+ getLocation() throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::awt::Point SAL_CALL
+ getLocationOnScreen() throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::awt::Size SAL_CALL
+ getSize() throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL
+ isShowing() throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL
+ isVisible() throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL
+ isFocusTraversable() throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL
+ addFocusListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL
+ removeFocusListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL
+ grabFocus() throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Any SAL_CALL
+ getAccessibleKeyBinding() throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Int32 SAL_CALL
+ getForeground( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL
+ getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XAccessibleContext ==============================================
+
+ virtual sal_Int32 SAL_CALL
+ getAccessibleChildCount( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
+ getAccessibleChild( sal_Int32 nIndex )
+ throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
+ getAccessibleParent( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Int32 SAL_CALL
+ getAccessibleIndexInParent( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Int16 SAL_CALL
+ getAccessibleRole( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleDescription( void ) throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleName( void ) throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL
+ getAccessibleRelationSet( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL
+ getAccessibleStateSet( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::lang::Locale SAL_CALL
+ getLocale( void )
+ throw( ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::accessibility::IllegalAccessibleComponentStateException );
+
+ //===== XComponent =====================================================
+
+ using ::cppu::WeakAggComponentImplHelperBase::addEventListener;
+ using ::cppu::WeakAggComponentImplHelperBase::removeEventListener;
+
+ //===== XAccessibleEventBroadcaster =====================================
+
+ virtual void SAL_CALL
+ addEventListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
+ throw( com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL
+ removeEventListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
+ throw( com::sun::star::uno::RuntimeException );
+
+ //===== XServiceInfo ====================================================
+
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL
+ supportsService( const ::rtl::OUString& sServiceName ) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ getSupportedServiceNames( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+ //===== XTypeProvider ===================================================
+
+ virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
+ getImplementationId( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+ //===== XAccessibleSelection =============================================
+
+ virtual void SAL_CALL
+ selectAccessibleChild( sal_Int32 nChildIndex )
+ throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL
+ isAccessibleChildSelected( sal_Int32 nChildIndex )
+ throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL
+ clearAccessibleSelection() throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL
+ selectAllAccessibleChildren() throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Int32 SAL_CALL
+ getSelectedAccessibleChildCount() throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
+ throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL
+ deselectAccessibleChild( sal_Int32 nSelectedChildIndex )
+ throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException );
+
+
+protected:
+ //===== internals ========================================================
+
+ void checkChildIndex( long nIndexOfChild ) throw( ::com::sun::star::lang::IndexOutOfBoundsException );
+
+ void checkChildIndexOnSelection( long nIndexOfChild ) throw( ::com::sun::star::lang::IndexOutOfBoundsException );
+
+ /** Selects a new child by index.
+
+ <p>If the child was not selected before, the state of the child will
+ be updated. If the index is invalid, the index will internaly set to NOCHILDSELECTED</p>
+
+ @param nIndexOfChild
+ Index of the new child which should be selected.
+ */
+ void selectChild( long nIndexOfChild );
+
+public:
+ /** Selects a new child by point.
+
+ <p>If the child was not selected before, the state of the child will
+ be updated. If the point is not invalid, the index will internaly set to NOCHILDSELECTED</p>
+
+ @param eButton
+ Button which belongs to the child which should be selected.
+ */
+ void selectChild( RECT_POINT ePoint );
+
+ /// Sets the name
+ void setName( const ::rtl::OUString& rName );
+
+ /// Sets the description
+ void setDescription( const ::rtl::OUString& rDescr );
+private:
+ static ::com::sun::star::uno::Sequence< sal_Int8 > getUniqueId( void );
+protected:
+
+ /// @Return the object's current bounding box relative to the desktop.
+ virtual Rectangle GetBoundingBoxOnScreen( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+ /// @Return the object's current bounding box relative to the parent object.
+ virtual Rectangle GetBoundingBox( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+ /// Calls all Listener to tell they the change.
+ void CommitChange( const com::sun::star::accessibility::AccessibleEventObject& rEvent );
+
+ virtual void SAL_CALL disposing();
+
+ /// @returns true if it's disposed or in disposing
+ inline sal_Bool IsAlive( void ) const;
+
+ /// @returns true if it's not disposed and no in disposing
+ inline sal_Bool IsNotAlive( void ) const;
+
+ /// throws the exception DisposedException if it's not alive
+ void ThrowExceptionIfNotAlive( void ) throw( ::com::sun::star::lang::DisposedException );
+
+private:
+ /** Description of this object. This is not a constant because it can
+ be set from the outside.
+ */
+ ::rtl::OUString msDescription;
+
+ /** Name of this object.
+ */
+ ::rtl::OUString msName;
+
+ /// Reference to the parent object.
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ mxParent;
+
+ /// pointer to internal representation
+ SvxRectCtl* mpRepr;
+
+ /// array for all possible childs
+ SvxRectCtlChildAccessibleContext** mpChilds;
+
+ /// client id in the AccessibleEventNotifier queue
+ sal_uInt32 mnClientId;
+
+ /// actual selected child
+ long mnSelectedChild;
+
+ /// mode of control (true -> 8 points, false -> 9 points)
+ sal_Bool mbAngleMode;
+};
+
+inline sal_Bool SvxRectCtlAccessibleContext::IsAlive( void ) const
+{
+ return !rBHelper.bDisposed && !rBHelper.bInDispose;
+}
+
+inline sal_Bool SvxRectCtlAccessibleContext::IsNotAlive( void ) const
+{
+ return rBHelper.bDisposed || rBHelper.bInDispose;
+}
+
+
+typedef ::cppu::WeakAggComponentImplHelper6<
+ ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleComponent,
+ ::com::sun::star::accessibility::XAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+ ::com::sun::star::accessibility::XAccessibleValue,
+ ::com::sun::star::lang::XServiceInfo >
+ SvxRectCtlChildAccessibleContext_Base;
+
+
+class SvxRectCtlChildAccessibleContext : public SvxRectCtlChildAccessibleContext_Base
+{
+public:
+ SvxRectCtlChildAccessibleContext(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>& rxParent,
+ const Window& rParentWindow,
+ const ::rtl::OUString& rName, const ::rtl::OUString& rDescription,
+ const Rectangle& rBoundingBox,
+ long nIndexInParent );
+protected:
+ virtual ~SvxRectCtlChildAccessibleContext();
+public:
+ //===== XAccessible =====================================================
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL
+ getAccessibleContext( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+ //===== XAccessibleComponent ============================================
+
+ virtual sal_Bool SAL_CALL
+ containsPoint( const ::com::sun::star::awt::Point& rPoint ) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL
+ getBounds() throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::awt::Point SAL_CALL
+ getLocation() throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::awt::Point SAL_CALL
+ getLocationOnScreen() throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::awt::Size SAL_CALL
+ getSize() throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL
+ isShowing() throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL
+ isVisible() throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL
+ isFocusTraversable() throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL
+ addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL
+ removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ grabFocus() throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Any SAL_CALL
+ getAccessibleKeyBinding() throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Int32 SAL_CALL
+ getForeground( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL
+ getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XAccessibleContext ==============================================
+
+ virtual sal_Int32 SAL_CALL
+ getAccessibleChildCount( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleChild( sal_Int32 nIndex )
+ throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleParent( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Int32 SAL_CALL
+ getAccessibleIndexInParent( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Int16 SAL_CALL
+ getAccessibleRole( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleDescription( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleName( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL
+ getAccessibleRelationSet( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL
+ getAccessibleStateSet( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::lang::Locale SAL_CALL
+ getLocale( void )
+ throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::accessibility::IllegalAccessibleComponentStateException );
+
+ //===== XComponent =====================================================
+
+ using ::cppu::WeakAggComponentImplHelperBase::addEventListener;
+ using ::cppu::WeakAggComponentImplHelperBase::removeEventListener;
+
+ //===== XAccessibleEventBroadcaster =====================================
+
+ virtual void SAL_CALL
+ addEventListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL
+ removeEventListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
+ throw( com::sun::star::uno::RuntimeException );
+
+ //===== XAccessibleValue ================================================
+
+ virtual ::com::sun::star::uno::Any SAL_CALL
+ getCurrentValue() throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL
+ setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Any SAL_CALL
+ getMaximumValue() throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Any SAL_CALL
+ getMinimumValue() throw( ::com::sun::star::uno::RuntimeException );
+
+ //===== XServiceInfo ====================================================
+
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL
+ supportsService( const ::rtl::OUString& sServiceName ) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+ getSupportedServiceNames( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+
+ //===== XTypeProvider ===================================================
+
+ virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
+ getImplementationId( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+ //===== internal ==========================================================
+
+ /// Sets the checked status
+ void setStateChecked( sal_Bool bChecked );
+
+protected:
+ virtual Rectangle GetBoundingBoxOnScreen( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual Rectangle GetBoundingBox( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+ void CommitChange( const com::sun::star::accessibility::AccessibleEventObject& rEvent );
+
+ virtual void SAL_CALL disposing();
+
+ /// @returns true if it's disposed or in disposing
+ inline sal_Bool IsAlive( void ) const;
+
+ /// @returns true if it's not disposed and no in disposing
+ inline sal_Bool IsNotAlive( void ) const;
+
+ /// throws the exception DisposedException if it's not alive
+ void ThrowExceptionIfNotAlive( void ) throw( ::com::sun::star::lang::DisposedException );
+
+ /// Mutex guarding this object.
+ ::osl::Mutex maMutex;
+
+private:
+
+ /** Description of this object. This is not a constant because it can
+ be set from the outside. Furthermore, it changes according the the
+ draw page's display mode.
+ */
+ ::rtl::OUString msDescription;
+
+ /** Name of this object. It changes according the the draw page's
+ display mode.
+ */
+ ::rtl::OUString msName;
+
+ /// Reference to the parent object.
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ mxParent;
+
+ /// Bounding box
+ Rectangle* mpBoundingBox;
+
+ /// window of parent
+ const Window& mrParentWindow;
+
+ /// client id in the AccessibleEventNotifier queue
+ sal_uInt32 mnClientId;
+
+ /// index of child in parent
+ long mnIndexInParent;
+
+ /// Indicates, if object is checked
+ sal_Bool mbIsChecked;
+};
+
+inline sal_Bool SvxRectCtlChildAccessibleContext::IsAlive( void ) const
+{
+ return !rBHelper.bDisposed && !rBHelper.bInDispose;
+}
+
+inline sal_Bool SvxRectCtlChildAccessibleContext::IsNotAlive( void ) const
+{
+ return rBHelper.bDisposed || rBHelper.bInDispose;
+}
+
+
+#endif
diff --git a/svx/source/inc/tabwin.hxx b/svx/source/inc/tabwin.hxx
new file mode 100644
index 000000000000..bbb5cb261b46
--- /dev/null
+++ b/svx/source/inc/tabwin.hxx
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_TABWIN_HXX
+#define _SVX_TABWIN_HXX
+
+#include <svtools/svtreebx.hxx>
+#include <vcl/floatwin.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <sfx2/childwin.hxx>
+#include <sfx2/ctrlitem.hxx>
+#include <com/sun/star/form/XForm.hpp>
+
+#include <comphelper/propmultiplex.hxx>
+#include <svtools/transfer.hxx>
+#include "svx/dbtoolsclient.hxx"
+
+//==================================================================
+class FmFieldWin;
+class SAL_DLLPRIVATE FmFieldWinListBox
+ :public SvTreeListBox
+{
+ FmFieldWin* pTabWin;
+
+protected:
+// virtual void Command( const CommandEvent& rEvt );
+
+public:
+ FmFieldWinListBox( FmFieldWin* pParent );
+ virtual ~FmFieldWinListBox();
+
+ sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+
+protected:
+ // DragSourceHelper
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+
+ // SvLBox
+ virtual sal_Bool DoubleClickHdl();
+
+ using SvLBox::ExecuteDrop;
+};
+
+//========================================================================
+class FmFormShell;
+class SAL_DLLPRIVATE FmFieldWinData
+{
+public:
+ FmFieldWinData();
+ ~FmFieldWinData();
+};
+
+//========================================================================
+class SAL_DLLPRIVATE FmFieldWin :public SfxFloatingWindow
+ ,public SfxControllerItem
+ ,public ::comphelper::OPropertyChangeListener
+ ,public ::svxform::OStaticDataAccessTools
+{
+ ::osl::Mutex m_aMutex;
+ FmFieldWinListBox* pListBox;
+ FmFieldWinData* pData;
+ ::svxform::SharedConnection
+ m_aConnection;
+ ::rtl::OUString m_aDatabaseName,
+ m_aObjectName;
+ sal_Int32 m_nObjectType;
+
+ ::comphelper::OPropertyChangeMultiplexer* m_pChangeListener;
+
+public:
+ FmFieldWin(SfxBindings *pBindings,
+ SfxChildWindow *pMgr, Window* pParent);
+
+ virtual ~FmFieldWin();
+ virtual void Resize();
+ virtual sal_Bool Close();
+ virtual void GetFocus();
+ virtual long PreNotify( NotifyEvent& _rNEvt );
+ virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState);
+
+ FmFieldWinData* GetData() const {return pData;}
+
+ void UpdateContent(FmFormShell*);
+ void UpdateContent(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > &);
+ void FillInfo( SfxChildWinInfo& rInfo ) const;
+
+ const ::rtl::OUString& GetDatabaseName() const { return m_aDatabaseName; }
+ ::svxform::SharedConnection GetConnection() const { return m_aConnection; }
+ const ::rtl::OUString& GetObjectName() const { return m_aObjectName; }
+ sal_Int32 GetObjectType() const { return m_nObjectType; }
+
+ sal_Bool createSelectionControls( );
+
+protected:
+ // FmXChangeListener
+ virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw( ::com::sun::star::uno::RuntimeException );
+
+protected:
+ inline SfxBindings& GetBindings() { return SfxControllerItem::GetBindings(); }
+ inline const SfxBindings& GetBindings() const { return SfxControllerItem::GetBindings(); }
+
+ using SfxFloatingWindow::StateChanged;
+};
+
+//========================================================================
+class SAL_DLLPRIVATE FmFieldWinMgr : public SfxChildWindow
+{
+public:
+ FmFieldWinMgr(Window *pParent, sal_uInt16 nId,
+ SfxBindings *pBindings, SfxChildWinInfo *pInfo);
+ SFX_DECL_CHILDWINDOW(FmFieldWinMgr);
+};
+
+
+#endif
+
diff --git a/svx/source/inc/tbxform.hxx b/svx/source/inc/tbxform.hxx
new file mode 100644
index 000000000000..774e786b80f7
--- /dev/null
+++ b/svx/source/inc/tbxform.hxx
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_TBXFORM_HXX
+#define _SVX_TBXFORM_HXX
+
+#include <sfx2/tbxctrl.hxx>
+#include <vcl/field.hxx>
+#include <vcl/dialog.hxx>
+
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+//========================================================================
+class SvxFmAbsRecWin : public NumericField
+{
+ SfxToolBoxControl* m_pController;
+ // for invalidating our content whe losing the focus
+public:
+ SvxFmAbsRecWin( Window* _pParent, SfxToolBoxControl* _pController );
+ ~SvxFmAbsRecWin();
+
+ virtual void KeyInput( const KeyEvent& rKeyEvt );
+ virtual void LoseFocus();
+
+protected:
+ virtual void FirePosition( sal_Bool _bForce );
+};
+
+
+//========================================================================
+class SvxFmConfigWin : public SfxPopupWindow
+{
+private:
+ DECL_LINK( TbxSelectHdl, ToolBox* );
+
+public:
+ SvxFmConfigWin( sal_uInt16 nId, ResId aRIdWin, ResId aRIdTbx );
+ ~SvxFmConfigWin();
+
+ void Update();
+ virtual void PopupModeEnd();
+};
+
+
+//========================================================================
+class SvxFmTbxCtlConfig : public SfxToolBoxControl
+{
+private:
+ sal_uInt16 nLastSlot;
+
+protected:
+ using SfxToolBoxControl::Select;
+
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SvxFmTbxCtlConfig( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxFmTbxCtlConfig() {}
+
+ virtual void Select( sal_uInt16 nModifier );
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ virtual SfxPopupWindowType GetPopupWindowType() const;
+ virtual SfxPopupWindow* CreatePopupWindow();
+};
+
+//========================================================================
+class FixedText;
+class SvxFmTbxCtlAbsRec : public SfxToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SvxFmTbxCtlAbsRec( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxFmTbxCtlAbsRec();
+
+ virtual Window* CreateItemWindow( Window* pParent );
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+};
+
+//========================================================================
+class SvxFmTbxCtlRecText : public SfxToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SvxFmTbxCtlRecText( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxFmTbxCtlRecText();
+
+ virtual Window* CreateItemWindow( Window* pParent );
+};
+
+//========================================================================
+class SvxFmTbxCtlRecFromText : public SfxToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SvxFmTbxCtlRecFromText( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxFmTbxCtlRecFromText();
+
+ virtual Window* CreateItemWindow( Window* pParent );
+};
+
+//========================================================================
+class SvxFmTbxCtlRecTotal : public SfxToolBoxControl
+{
+ FixedText* pFixedText;
+
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SvxFmTbxCtlRecTotal( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ ~SvxFmTbxCtlRecTotal();
+
+ virtual Window* CreateItemWindow( Window* pParent );
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+};
+
+//========================================================================
+class SvxFmTbxNextRec : public SfxToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxFmTbxNextRec( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+};
+
+//========================================================================
+class SvxFmTbxPrevRec : public SfxToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+ SvxFmTbxPrevRec( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+};
+
+
+#endif
+
diff --git a/svx/source/inc/trace.hxx b/svx/source/inc/trace.hxx
new file mode 100644
index 000000000000..8de8af5f7cf1
--- /dev/null
+++ b/svx/source/inc/trace.hxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TRACE_HXX_
+#define _TRACE_HXX_
+
+#if defined(DBG_UTIL)
+
+#include <tools/string.hxx>
+#include <vos/thread.hxx>
+#include <vos/mutex.hxx>
+#include <comphelper/stl_types.hxx>
+
+
+class Tracer
+{
+ ByteString m_sBlockDescription;
+
+ DECLARE_STL_STDKEY_MAP( ::vos::OThread::TThreadIdentifier, sal_Int32, MapThreadId2Int );
+ static MapThreadId2Int s_aThreadIndents;
+
+ static ::vos::OMutex s_aMapSafety;
+
+public:
+ Tracer(const char* _pBlockDescription);
+ ~Tracer();
+
+ void TraceString(const char* _pMessage);
+ void TraceString1StringParam(const char* _pMessage, const char* _pParam);
+};
+
+
+#define TRACE_RANGE(range_description) Tracer aTrace(range_description);
+#define TRACE_RANGE_MESSAGE(message) { aTrace.TraceString(message); }
+#define TRACE_RANGE_MESSAGE1(message, param) { aTrace.TraceString1StringParam(message, param); }
+
+#else
+
+#define TRACE_RANGE(range_description) ;
+#define TRACE_RANGE_MESSAGE(message) ;
+#define TRACE_RANGE_MESSAGE1(message, param) ;
+
+#endif
+
+#endif // _TRACE_HXX_
diff --git a/svx/source/inc/treevisitor.hxx b/svx/source/inc/treevisitor.hxx
new file mode 100644
index 000000000000..b089c524789b
--- /dev/null
+++ b/svx/source/inc/treevisitor.hxx
@@ -0,0 +1,109 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef SVX_TREE_VISITOR_HXX
+#define SVX_TREE_VISITOR_HXX
+
+#include <stack>
+
+template< class ELEMENT, class NODEINFO, class PROCESSOR >
+class TreeVisitor
+{
+public:
+ TreeVisitor( NODEINFO _nodeInfo )
+ :m_visitedRoot( false )
+ ,m_root()
+ ,m_current()
+ ,m_nodeInfo( _nodeInfo )
+ {
+ }
+
+ void process( const ELEMENT& _root, PROCESSOR& _processor )
+ {
+ m_root = _root;
+ m_visitedRoot = false;
+
+ while ( do_step() )
+ _processor.process( m_current );
+ }
+
+private:
+ bool do_step();
+
+private:
+ bool m_visitedRoot;
+ ELEMENT m_root;
+ ELEMENT m_current;
+ const NODEINFO m_nodeInfo;
+
+ ::std::stack< size_t > m_pathToCurrent;
+ ::std::stack< ELEMENT > m_currentAncestors;
+};
+
+template< class ELEMENT, class NODEINFO, class PROCESSOR >
+bool TreeVisitor< ELEMENT, NODEINFO, PROCESSOR >::do_step()
+{
+ if ( !m_visitedRoot )
+ {
+ m_current = m_root;
+ m_visitedRoot = true;
+ return true;
+ }
+
+ // can we step down from the current node?
+ size_t childCount = m_nodeInfo.childCount( m_current );
+ if ( childCount )
+ {
+ m_currentAncestors.push( m_current );
+ m_current = m_nodeInfo.getChild( m_current, 0 );
+ m_pathToCurrent.push( 0 );
+ return true;
+ }
+
+ // is there a right sibling of the current node?
+ while ( !m_pathToCurrent.empty() )
+ {
+ const ELEMENT& currentParent = m_currentAncestors.top();
+ childCount = m_nodeInfo.childCount( currentParent );
+
+ size_t currentChildPos = m_pathToCurrent.top();
+ if ( ++currentChildPos < childCount )
+ {
+ // yes there is
+ m_pathToCurrent.top() = currentChildPos;
+ m_current = m_nodeInfo.getChild( currentParent, currentChildPos );
+ return true;
+ }
+
+ // no there isn't => step up
+ m_currentAncestors.pop();
+ m_pathToCurrent.pop();
+ }
+
+ return false;
+}
+
+#endif // SVX_TREE_VISITOR_HXX
diff --git a/svx/source/inc/typeconversionclient.hxx b/svx/source/inc/typeconversionclient.hxx
new file mode 100644
index 000000000000..9ff7e12fe4d0
--- /dev/null
+++ b/svx/source/inc/typeconversionclient.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_TYPECONVERSION_CLIENT_HXX
+#define SVX_TYPECONVERSION_CLIENT_HXX
+
+#include "svx/dbtoolsclient.hxx"
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ //====================================================================
+ //= OTypeConversionClient
+ //====================================================================
+ class OTypeConversionClient : public ODbtoolsClient
+ {
+ protected:
+ mutable ::rtl::Reference< ::connectivity::simple::IDataAccessTypeConversion >
+ m_xTypeConversion;
+ virtual bool ensureLoaded() const;
+
+ public:
+ OTypeConversionClient();
+
+ // --------------------------------------------------------
+ inline ::com::sun::star::util::Date getStandardDate() const
+ {
+ ::com::sun::star::util::Date aReturn;
+ if ( ensureLoaded() )
+ aReturn = m_xTypeConversion->getStandardDate();
+ return aReturn;
+ }
+
+ // --------------------------------------------------------
+ inline double getValue(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn>& _rxVariant,
+ const ::com::sun::star::util::Date& _rNullDate ) const
+ {
+ double nReturn(0);
+ if ( ensureLoaded() )
+ nReturn = m_xTypeConversion->getValue( _rxVariant, _rNullDate );
+ return nReturn;
+ }
+
+ // --------------------------------------------------------
+ inline ::rtl::OUString getFormattedValue(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter,
+ const ::com::sun::star::util::Date& _rNullDate,
+ sal_Int32 _nKey,
+ sal_Int16 _nKeyType) const
+ {
+ ::rtl::OUString sReturn;
+ if ( ensureLoaded() )
+ sReturn = m_xTypeConversion->getFormattedValue(_rxColumn, _rxFormatter, _rNullDate, _nKey, _nKeyType);
+ return sReturn;
+ }
+ };
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
+#endif // SVX_TYPECONVERSION_CLIENT_HXX
+
+
diff --git a/svx/source/inc/unogalthemeprovider.hxx b/svx/source/inc/unogalthemeprovider.hxx
new file mode 100644
index 000000000000..e5d1e7dd1bf5
--- /dev/null
+++ b/svx/source/inc/unogalthemeprovider.hxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_UNOGALTHEMEPROVIDER_HXX
+#define _SVX_UNOGALTHEMEPROVIDER_HXX
+
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/gallery/XGalleryThemeProvider.hpp>
+
+#include <svx/svxdllapi.h>
+
+class Gallery;
+
+namespace unogallery {
+
+// -------------------------
+// - some helper functions -
+// -------------------------
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL GalleryThemeProvider_createInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr) throw( ::com::sun::star::uno::Exception );
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL GalleryThemeProvider_getSupportedServiceNames() throw();
+::rtl::OUString SAL_CALL GalleryThemeProvider_getImplementationName() throw();
+
+// -----------------
+// - GalleryThemes -
+// -----------------
+
+class GalleryThemeProvider : public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XInitialization,
+ ::com::sun::star::gallery::XGalleryThemeProvider >
+{
+public:
+
+ GalleryThemeProvider();
+ ~GalleryThemeProvider();
+
+ SVX_DLLPUBLIC static ::rtl::OUString getImplementationName_Static() throw();
+ SVX_DLLPUBLIC static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw();
+
+protected:
+
+ // XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
+
+ // XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasElements() throw (::com::sun::star::uno::RuntimeException);
+
+ // XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw ( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException );
+
+ // XGalleryThemeProvider
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::gallery::XGalleryTheme > SAL_CALL insertNewByName( const ::rtl::OUString& ThemeName ) throw (::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeByName( const ::rtl::OUString& ThemeName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ Gallery* mpGallery;
+ sal_Bool mbHiddenThemes;
+};
+
+}
+
+#endif
diff --git a/svx/source/inc/unopolyhelper.hxx b/svx/source/inc/unopolyhelper.hxx
new file mode 100644
index 000000000000..feb501a52d82
--- /dev/null
+++ b/svx/source/inc/unopolyhelper.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_UNOPOLYHELPER_HXX
+#define _SVX_UNOPOLYHELPER_HXX
+
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+
+#include <svx/svxdllapi.h>
+
+namespace com { namespace sun { namespace star { namespace drawing {
+ struct PolyPolygonBezierCoords;
+} } } }
+
+namespace basegfx {
+ class B2DPolyPolygon;
+}
+
+/** convert a drawing::PolyPolygonBezierCoords to a B2DPolyPolygon
+*/
+basegfx::B2DPolyPolygon SvxConvertPolyPolygonBezierToB2DPolyPolygon( const com::sun::star::drawing::PolyPolygonBezierCoords* pSourcePolyPolygon)
+ throw( com::sun::star::lang::IllegalArgumentException );
+
+/** convert a B2DPolyPolygon to a drawing::PolyPolygonBezierCoords
+*/
+SVX_DLLPUBLIC void SvxConvertB2DPolyPolygonToPolyPolygonBezier( const basegfx::B2DPolyPolygon& rPolyPoly, com::sun::star::drawing::PolyPolygonBezierCoords& rRetval );
+
+
+#endif
+
+
diff --git a/svx/source/inc/xfm_addcondition.hxx b/svx/source/inc/xfm_addcondition.hxx
new file mode 100644
index 000000000000..81387b78fe0c
--- /dev/null
+++ b/svx/source/inc/xfm_addcondition.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_SOURCE_INC_XFM_ADDCONDITION_HXX
+#define SVX_SOURCE_INC_XFM_ADDCONDITION_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/xforms/XModel.hpp>
+/** === end UNO includes === **/
+#include <svtools/genericunodialog.hxx>
+#include <comphelper/proparrhlp.hxx>
+
+//........................................................................
+namespace svxform
+{
+//........................................................................
+
+ //====================================================================
+ //= OAddConditionDialog
+ //====================================================================
+ typedef ::svt::OGenericUnoDialog OAddConditionDialogBase;
+ class OAddConditionDialog
+ :public OAddConditionDialogBase
+ ,public ::comphelper::OPropertyArrayUsageHelper< OAddConditionDialog >
+ {
+ private:
+ // <properties>
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ m_xBinding;
+ ::rtl::OUString m_sFacetName;
+ ::rtl::OUString m_sConditionValue;
+ ::com::sun::star::uno::Reference< ::com::sun::star::xforms::XModel >
+ m_xWorkModel;
+ // </properties>
+
+ public:
+ static ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
+ SAL_CALL Create( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+
+ protected:
+ OAddConditionDialog( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB );
+
+ // XTypeProvider
+ virtual com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) throw(com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
+ virtual com::sun::star::uno::Reference<com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(com::sun::star::uno::RuntimeException);
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+
+ protected:
+ // OGenericUnoDialog overridables
+ virtual Dialog* createDialog(Window* _pParent);
+ virtual void executedDialog(sal_Int16 _nExecutionResult);
+ };
+
+//........................................................................
+} // namespace svxform
+//........................................................................
+
+#endif // SVX_SOURCE_INC_XFM_ADDCONDITION_HXX
+
diff --git a/svx/source/inc/xmlxtexp.hxx b/svx/source/inc/xmlxtexp.hxx
new file mode 100644
index 000000000000..fcb72b691b00
--- /dev/null
+++ b/svx/source/inc/xmlxtexp.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XMLXTEXP_HXX
+#define _SVX_XMLXTEXP_HXX
+
+#include "xmloff/xmlexp.hxx"
+
+namespace rtl { class OUString; }
+namespace com { namespace sun { namespace star {
+ namespace frame { class XModel; }
+ namespace uno { template<class X> class Reference; }
+ namespace uno { class XInterface; }
+ namespace container { class XNameContainer; }
+ namespace document { class XGraphicObjectResolver; }
+ namespace xml { namespace sax { class XDocumentHandler; } }
+} } }
+
+class SvxXMLXTableExportComponent : public SvXMLExport
+{
+public:
+ // #110680#
+ SvxXMLXTableExportComponent(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
+ const rtl::OUString& rFileName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > & xHandler,
+ const com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > & xTable,
+ com::sun::star::uno::Reference< com::sun::star::document::XGraphicObjectResolver >& xGrfResolver);
+
+ ~SvxXMLXTableExportComponent();
+
+ static sal_Bool save( const rtl::OUString& rURL, const com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xTable ) throw();
+
+ sal_Bool exportTable() throw();
+
+ // methods without content:
+ virtual void _ExportAutoStyles();
+ virtual void _ExportMasterStyles();
+ virtual void _ExportContent();
+
+private:
+ const com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > & mxTable;
+};
+
+#endif
+
diff --git a/svx/source/inc/xmlxtimp.hxx b/svx/source/inc/xmlxtimp.hxx
new file mode 100644
index 000000000000..85fddbeef005
--- /dev/null
+++ b/svx/source/inc/xmlxtimp.hxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_XMLXTIMP_HXX
+#define _SVX_XMLXTIMP_HXX
+
+#include <xmloff/xmlimp.hxx>
+
+namespace rtl { class OUString; }
+namespace com { namespace sun { namespace star {
+ namespace uno { template<class X> class Reference; }
+ namespace uno { class XInterface; }
+ namespace document { class XGraphicObjectResolver; }
+ namespace container { class XNameContainer; }
+
+} } }
+
+class SvxXMLXTableImport : public SvXMLImport
+{
+public:
+ // #110680#
+ SvxXMLXTableImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & rTable,
+ com::sun::star::uno::Reference< com::sun::star::document::XGraphicObjectResolver >& xGrfResolver);
+
+ virtual ~SvxXMLXTableImport() throw ();
+
+ static sal_Bool load( const rtl::OUString& rUrl, const com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >& xTable ) throw();
+protected:
+ virtual SvXMLImportContext *CreateContext( sal_uInt16 nPrefix,
+ const ::rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+
+private:
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & mrTable;
+};
+
+#endif
+
diff --git a/svx/source/intro/about_ooo.hrc b/svx/source/intro/about_ooo.hrc
new file mode 100644
index 000000000000..2d81fff3b454
--- /dev/null
+++ b/svx/source/intro/about_ooo.hrc
@@ -0,0 +1,1083 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define OOO_CONTRIBUTOR_LIST \
+ItemList = \
+{ \
+ < "" ; > ; \
+ < "Esben Aaberg" ; > ; \
+ < "Craig A. Adams" ; > ; \
+ < "Agenda d.o.o." ; > ; \
+ < "Claus Agerskov" ; > ; \
+ < "Tesfamicael Adhanom" ; > ; \
+ < "Agile Interactions, Inc." ; > ; \
+ < "Volker Ahrendt" ; > ; \
+ < "Christian Ahrenkiel" ; > ; \
+ < "Kai Ahrens" ; > ; \
+ < "Ralph Aichinger" ; > ; \
+ < "Takamichi Akiyama" ; > ; \
+ < "Rail Aliev" ; > ; \
+ < "Florence Allizon-Juillet" ; > ; \
+ < "Benoit Altenbourger" ; > ; \
+ < "Ahmet Altin" ; > ; \
+ < "Jesus Bravo Alvarez" ; > ; \
+ < "Michal Ambroz" ; > ; \
+ < "Aryan Ameri" ; > ; \
+ < "Brian M. Ames" ; > ; \
+ < "Jost Ammon" ; > ; \
+ < "Paolo Amodio" ; > ; \
+ < "Abdullah Anar" ; > ; \
+ < "Gene Anaya" ; > ; \
+ < "Christian Andersen" ; > ; \
+ < "Frank J. Andersen" ; > ; \
+ < "Jan Moller Andersen" ; > ; \
+ < "Jorn Skifter Andersen" ; > ; \
+ < "Susanne Anderson" ; > ; \
+ < "Joost Andrae" ; > ; \
+ < "Timar Andras" ; > ; \
+ < "Michael Arbon" ; > ; \
+ < "Magosanhi Ardho" ; > ; \
+ < "Sakari Aro" ; > ; \
+ < "Magosanyi Arpad" ; > ; \
+ < "Peter Arnold" ; > ; \
+ < "Takashi Asari" ; > ; \
+ < "Travis Athougies " ; > ; \
+ < "Kosa Attila" ; > ; \
+ < "Ativiras Kodas Lietuvai (Open Source for Lithuania)" ; > ; \
+ < "Peter Babco" ; > ; \
+ < "Natalia Babkina" ; > ; \
+ < "Eric Bachard" ; > ; \
+ < "Jeffrey G. Backes" ; > ; \
+ < "Monica Badia" ; > ; \
+ < "Sanlig Badral" ; > ; \
+ < "Michele Baldessari" ; > ; \
+ < "Dwayne Bailey" ; > ; \
+ < "Ilyas Bakirov " ; > ; \
+ < "Omer Bar-or" ; > ; \
+ < "Danial Ferreira Balieiro" ; > ; \
+ < "Athur Barret" ; > ; \
+ < "Rodrigo Pedroso Barbosa" ; > ; \
+ < "Gildecio E. Barboza" ; > ; \
+ < "Joerg Barfurth" ; > ; \
+ < "Yvan Barthelemy " ; > ; \
+ < "David Bartlett" ; > ; \
+ < "Sascha Ballach" ; > ; \
+ < "Stefan Baltzer" ; > ; \
+ < "Jayant Balraj Madavi" ; > ; \
+ < "Claudio Bandaloukas" ; > ; \
+ < "Omar Bar-or" ; > ; \
+ < "Hrega Basu" ; > ; \
+ < "Mathias Bauer" ; > ; \
+ < "Martin Baulig" ; > ; \
+ < "Martin Bayer" ; > ; \
+ < "Gwenole Beauchesne" ; > ; \
+ < "Youssef Beghi" ; > ; \
+ < "Juraj Bednar" ; > ; \
+ < "Brian Behlendorf" ; > ; \
+ < "Thorsten Behrens" ; > ; \
+ < "Lars Behrmann" ; > ; \
+ < "Kyle Begol" ; > ; \
+ < "Beijing Co-Create Open Source Software Co. Ltd." ; > ; \
+ < "Beijing Redflag Chinese 2000 Software Co. Ltd." ; > ; \
+ < "Andero Belov" ; > ; \
+ < "Michael Bemmer" ; > ; \
+ < "Boldizsar Bencsath" ; > ; \
+ < "Thomas Benisch" ; > ; \
+ < "Stephan Bergmann" ; > ; \
+ < "Josh Berkus" ; > ; \
+ < "Armin Besirovic" ; > ; \
+ < "beunited.org Littleton, USA" ; > ; \
+ < "Zaheda Bhorat" ; > ; \
+ < "Andreas Bille" ; > ; \
+ < "Oliver Bietzer" ; > ; \
+ < "Eric Bischoff" ; > ; \
+ < "Marissa Bishop" ; > ; \
+ < "Torkil Bladt" ; > ; \
+ < "Martin Blapp" ; > ; \
+ < "Nick Blievers" ; > ; \
+ < "Peter Bodnar" ; > ; \
+ < "Daniel Boelzle" ; > ; \
+ < "Marco Boerries" ; > ; \
+ < "Michael Bohn" ; > ; \
+ < "Myrzaliyer Bolat" ; > ; \
+ < "Oliver Bolte" ; > ; \
+ < "Berit Bonde" ; > ; \
+ < "Alexander Bootman" ; > ; \
+ < "Csaba Borbola" ; > ; \
+ < "Gregor Bornemann" ; > ; \
+ < "Thorsten Bosbach" ; > ; \
+ < "Eric Bosdonnat" ; > ; \
+ < "Daniel Boss" ; > ; \
+ < "David Boswell" ; > ; \
+ < "Freddy Boswell" ; > ; \
+ < "J.David Boyd" ; > ; \
+ < "Oisin Boydell" ; > ; \
+ < "Rafaella Braconi" ; > ; \
+ < "Cristovad Braga" ; > ; \
+ < "Tanovic Branko" ; > ; \
+ < "Michael Brauer" ; > ; \
+ < "Oliver Braun" ; > ; \
+ < "Andreas Bregas" ; > ; \
+ < "Matthias Breuer" ; > ; \
+ < "Marek Brezina" ; > ; \
+ < "Henning Brinkmann" ; > ; \
+ < "Simon Brouwer" ; > ; \
+ < "Andrew Brown" ; > ; \
+ < "Joerg Brunsmann" ; > ; \
+ < "Joerg Budischewski" ; > ; \
+ < "Nicolae Buculei" ; > ; \
+ < "Ronny Buelund" ; > ; \
+ < "Michael Buettner" ; > ; \
+ < "Edwin Burdak" ; > ; \
+ < "Hans-Peter Burow" ; > ; \
+ < "Aidan Butler" ; > ; \
+ < "Richard Bywater" ; > ; \
+ < "Josef Cacek" ; > ; \
+ < "Guy Capra" ; > ; \
+ < "Gabriele Carcassi" ; > ; \
+ < "Anders Carlsson" ; > ; \
+ < "Brian Cameron" ; > ; \
+ < "Scott Carr" ; > ; \
+ < "Christina L. Carr" ; > ; \
+ < "Mauro Catarzi" ; > ; \
+ < "Daniel Carrera" ; > ; \
+ < "Giuseppe Castagno" ; > ; \
+ < "Centre for Development of Advanced Computing" ; > ; \
+ < "Ales Cernosek" ; > ; \
+ < "Goerkem Cetin" ; > ; \
+ < "Peter Chabada" ; > ; \
+ < "David Chan" ; > ; \
+ < "Tak-Shing Chan of Aleph One Limited" ; > ; \
+ < "Colin Charles" ; > ; \
+ < "Kimmy Chen" ; > ; \
+ < "Robert Chen" ; > ; \
+ < "Yu Aaron Cheng" ; > ; \
+ < "Jian Hong Cheng" ; > ; \
+ < "Xiuzhi Cheng" ; > ; \
+ < "Allan B. Christensen" ; > ; \
+ < "Steen Christensen" ; > ; \
+ < "Marco Ciampa" ; > ; \
+ < "Henrik R. Clausen" ; > ; \
+ < "James Cleere" ; > ; \
+ < "Justin Clift" ; > ; \
+ < "David Cobb" ; > ; \
+ < "Oliver Craemer" ; > ; \
+ < "Vicky Chan" ; > ; \
+ < "Michael J. Cole" ; > ; \
+ < "Urska Colner" ; > ; \
+ < "Alexandro Colorado" ; > ; \
+ < "Compaq Computer Corperation" ; > ; \
+ < "Karen Conatser" ; > ; \
+ < "Confucian Pro. Technology" ; > ; \
+ < "Danese Cooper" ; > ; \
+ < "Lee Corbin" ; > ; \
+ < "Dietmar Cordes" ; > ; \
+ < "Berend Cornelius" ; > ; \
+ < "Clayton Cornell" ; > ; \
+ < "Jesus Corrius" ; > ; \
+ < "Martin Coxall" ; > ; \
+ < "Joszef Csongradi" ; > ; \
+ < "Alessandro Cumin" ; > ; \
+ < "Johannes Czerwinski" ; > ; \
+ < "Michael Cziebalski" ; > ; \
+ < "Valentina Dagiene" ; > ; \
+ < "Richard Daley" ; > ; \
+ < "Viktoras Dagys" ; > ; \
+ < "Dimitrios Dalossis" ; > ; \
+ < "Martin Damboldt" ; > ; \
+ < "Johan Dahlin" ; > ; \
+ < "Goto Daichi" ; > ; \
+ < "Robert Dargaud" ; > ; \
+ < "Yuri Dario" ; > ; \
+ < "Akshay Dayal" ; > ; \
+ < "Simon Dean" ; > ; \
+ < "Denice C. Deatrich" ; > ; \
+ < "Blaise Drayer" ; > ; \
+ < "Francois Dechelle" ; > ; \
+ < "Andrea Decorte" ; > ; \
+ < "Martijn Dekkers" ; > ; \
+ < "Andrew Dent" ; > ; \
+ < "Westley Alan Dent" ; > ; \
+ < "Luiz Augusto Von Dentz" ; > ; \
+ < "Helge Delfs" ; > ; \
+ < "Naren Devaiah" ; > ; \
+ < "Frederic Juan Diaz" ; > ; \
+ < "Scott Dietrich" ; > ; \
+ < "Frederik Dietz" ; > ; \
+ < "Marcel Diki-Kidiri" ; > ; \
+ < "Marian Diklic" ; > ; \
+ < "Sebastian Docktor" ; > ; \
+ < "Vitor Domingos" ; > ; \
+ < "Jean-Francois Donikian" ; > ; \
+ < "Simford Dong" ; > ; \
+ < "Nitri Dongre" ; > ; \
+ < "Thomas Doru" ; > ; \
+ < "Willem van Dorp" ; > ; \
+ < "Radek Doulik" ; > ; \
+ < "Davide Dozza" ; > ; \
+ < "Derek Dreger" ; > ; \
+ < "Carsten Driesner" ; > ; \
+ < "Cristian Driga" ; > ; \
+ < "Petr Dudacek" ; > ; \
+ < "Herbert Duerr" ; > ; \
+ < "Marc Durdin" ; > ; \
+ < "Damien Duportal" ; > ; \
+ < "Dolores Eccles" ; > ; \
+ < "Craig Eddy" ; > ; \
+ < "Florian Effenberger" ; > ; \
+ < "Aleksander Ehrlich" ; > ; \
+ < "Bernd Eilers" ; > ; \
+ < "Terry Ellison" ; > ; \
+ < "Rene Engelhard" ; > ; \
+ < "Mina Erickson" ; > ; \
+ < "Peter Eriksen" ; > ; \
+ < "Per Eriksson" ; > ; \
+ < "Alberto Escudero-Pascual" ; > ; \
+ < "Fabalabs Software GmbH" ; > ; \
+ < "Charles Anthony Fannan" ; > ; \
+ < "Jean-Baptiste Faure" ; > ; \
+ < "Ralf-Michael Fehr" ; > ; \
+ < "Vladimir Fedak" ; > ; \
+ < "Zoltan Fekete" ; > ; \
+ < "Olaf Felka" ; > ; \
+ < "Carlos Fernando" ; > ; \
+ < "Ramon Garcia Fernandez" ; > ; \
+ < "Claudio Ferreira" ; > ; \
+ < "Raquel Fares Ferreira" ; > ; \
+ < "Marco Fiemozzi" ; > ; \
+ < "Claudio F Filho" ; > ; \
+ < "Pierre de Filippis" ; > ; \
+ < "Jan Firich" ; > ; \
+ < "Andre Fischer" ; > ; \
+ < "Helga Fischer" ; > ; \
+ < "Uwe Fischer" ; > ; \
+ < "Darin Fisher" ; > ; \
+ < "Nicole M. Follet-Dunn" ; > ; \
+ < "Kenneth Foskey" ; > ; \
+ < "Duncan Foster" ; > ; \
+ < "Tim Foster" ; > ; \
+ < "David Franser" ; > ; \
+ < "Peter Frandsen" ; > ; \
+ < "Gary Frederick" ; > ; \
+ < "Nils Fuhrmann" ; > ; \
+ < "Jan Funken" ; > ; \
+ < "Bruno Gallart" ; > ; \
+ < "Roberto Galoppini" ; > ; \
+ < "Tom Garland" ; > ; \
+ < "Wolfram Garten" ; > ; \
+ < "Martin Gallwey" ; > ; \
+ < "Pierre-Andre Galmes" ; > ; \
+ < "Roberto Galoppini" ; > ; \
+ < "Tony Galmiche" ; > ; \
+ < "Sunil Gandhi" ; > ; \
+ < "Zemin Gao" ; > ; \
+ < "Sophie Gautier" ; > ; \
+ < "Kathy Gavin" ; > ; \
+ < "Alexander Gelfenbain" ; > ; \
+ < "Genicorp" ; > ; \
+ < "Radim Gelner" ; > ; \
+ < "R.R. Gerbrands" ; > ; \
+ < "Vytautas Germanavicius" ; > ; \
+ < "Berthold Gerdes" ; > ; \
+ < "Gorken Getin" ; > ; \
+ < "Adriana Geurts" ; > ; \
+ < "Marco Giorgetti" ; > ; \
+ < "Thomas Girard" ; > ; \
+ < "Serkan Girgin" ; > ; \
+ < "Vladimir Glazounov" ; > ; \
+ < "Laurent Godard" ; > ; \
+ < "M. Godec" ; > ; \
+ < "Angelika Goeszler" ; > ; \
+ < "Xabier Arrieta Goiri" ; > ; \
+ < "Adam Golebiowski" ; > ; \
+ < "Good Day, Inc. - Seiya Maeda, CEO" ; > ; \
+ < "Ajey Y. Gore" ; > ; \
+ < "Adam Gould" ; > ; \
+ < "Brigitte Le Grand" ; > ; \
+ < "GravityZoo" ; > ; \
+ < "Paul Gress" ; > ; \
+ < "Gintautas Grigas" ; > ; \
+ < "Dirk Grobler" ; > ; \
+ < "Steffen Grund" ; > ; \
+ < "Christian Guenther" ; > ; \
+ < "Marko Gronroos" ; > ; \
+ < "Wojciech Gryc" ; > ; \
+ < "Stefano Guidetti" ; > ; \
+ < "Wilson Guo" ; > ; \
+ < "Brant Langer Gurganus" ; > ; \
+ < "Richard Guziewicz" ; > ; \
+ < "Szabo Gyoergi" ; > ; \
+ < "Bettina Haberer" ; > ; \
+ < "Thomas Hackert" ; > ; \
+ < "David Hackler" ; > ; \
+ < "Fredrik Haegg" ; > ; \
+ < "Ingrid Halama" ; > ; \
+ < "William Neil Hall" ; > ; \
+ < "Chris Halls" ; > ; \
+ < "Arne Christian Harseth" ; > ; \
+ < "Syamsul Anuar Abdul Hamid" ; > ; \
+ < "Bo Han" ; > ; \
+ < "Ove Hanebring" ; > ; \
+ < "Jens K. Hansen" ; > ; \
+ < "Martin Willemoes Hansen" ; > ; \
+ < "Rune Piil Hansen" ; > ; \
+ < "Jeff Hanson" ; > ; \
+ < "Paul Eugene Hanson" ; > ; \
+ < "Christian Hardy" ; > ; \
+ < "Alexey Harlamenkov" ; > ; \
+ < "Taska Harnischfeger" ; > ; \
+ < "Gregor Hartmann" ; > ; \
+ < "Peter Hartmann" ; > ; \
+ < "Andreas Hausmann" ; > ; \
+ < "Bustamam Harun" ; > ; \
+ < "Soren Hauberg" ; > ; \
+ < "Andreas Hausmann" ; > ; \
+ < "Mike Hayes" ; > ; \
+ < "John Heard" ; > ; \
+ < "Florian Heckl" ; > ; \
+ < "Will Heid" ; > ; \
+ < "Reimar Heider" ; > ; \
+ < "Joerg Heilig" ; > ; \
+ < "Lars Jorgen Helbo" ; > ; \
+ < "Bill Heiser" ; > ; \
+ < "Frank Heitbrock" ; > ; \
+ < "Brian Hemstedt" ; > ; \
+ < "Kevin B. Hendricks" ; > ; \
+ < "C.P. Hennessy" ; > ; \
+ < "Gregor Herrman" ; > ; \
+ < "Chris Herrnberger" ; > ; \
+ < "Sven Herzberg" ; > ; \
+ < "Uwe Heth" ; > ; \
+ < "Ariya Hidayat" ; > ; \
+ < "Bernd Hilgenberg" ; > ; \
+ < "Michelle Hills" ; > ; \
+ < "Kazunari Hirano" ; > ; \
+ < "Samual W. Hiser" ; > ; \
+ < "Ivo Hinkelmann" ; > ; \
+ < "Theresa Hinkelman" ; > ; \
+ < "Eric Hoch" ; > ; \
+ < "Lutz Hoeger" ; > ; \
+ < "Michael Hoennig" ; > ; \
+ < "Ilko Hoepping" ; > ; \
+ < "Axel Hoernke" ; > ; \
+ < "Ralf Hofmann" ; > ; \
+ < "Jakob Hojgaard" ; > ; \
+ < "Janos Holanyi" ; > ; \
+ < "Jan Holesovsky" ; > ; \
+ < "Martin Hollmichel" ; > ; \
+ < "Richard Holt" ; > ; \
+ < "Sei Honda" ; > ; \
+ < "Karl Hong" ; > ; \
+ < "Alan Horkan" ; > ; \
+ < "Alexandre Horst" ; > ; \
+ < "Horst" ; > ; \
+ < "Thomas Hosemann" ; > ; \
+ < "Chris Hoypoy" ; > ; \
+ < "Radovan Hrabak" ; > ; \
+ < "Hristo Simeonov Hristov" ; > ; \
+ < "Stanislav Huba" ; > ; \
+ < "Bert Hubert" ; > ; \
+ < "Ralf Hueskes" ; > ; \
+ < "Matthias Huetsch" ; > ; \
+ < "Marco Huggenberger" ; > ; \
+ < "Humboldt-Universitaet zu Berlin" ; > ; \
+ < "James R Hunt" ; > ; \
+ < "Jason Hunter" ; > ; \
+ < "Isabelle Hurbain" ; > ; \
+ < "Gabriel Hurley" ; > ; \
+ < "Emin Huseynov" ; > ; \
+ < "Scott Hutinger" ; > ; \
+ < "Hungarian Linux Users, Association of" ; > ; \
+ < "Thomas Hygum" ; > ; \
+ < "Andreas Hyballa" ; > ; \
+ < "Hasan Ilter" ; > ; \
+ < "Intel Corp." ; > ; \
+ < "International Business Machines" ; > ; \
+ < "Intersol SRL" ; > ; \
+ < "Michael Irion" ; > ; \
+ < "Naoyuki Ishimura" ; > ; \
+ < "Baurzhan Ismagulov" ; > ; \
+ < "Fumihiko Iwabuchi" ; > ; \
+ < "Issendis Alain Curt" ; > ; \
+ < "Pavel Janik" ; > ; \
+ < "Sunil Amitkumar Janki" ; > ; \
+ < "Sven Jacobi" ; > ; \
+ < "Yvonne Jacoby" ; > ; \
+ < "Denis Jacquerye" ; > ; \
+ < "Egle Jasutiene" ; > ; \
+ < "Joerg Jahnke" ; > ; \
+ < "Christian Jansen" ; > ; \
+ < "Ocke Janssen" ; > ; \
+ < "Amer Javaid" ; > ; \
+ < "Andrew T. Jensen" ; > ; \
+ < "Byrial Ole Jensen" ; > ; \
+ < "Ricky Hugh Jensen" ; > ; \
+ < "Tatjiana Jevsikova" ; > ; \
+ < "Berry Jia" ; > ; \
+ < "Mingfei Jia" ; > ; \
+ < "Chuang Jiang" ; > ; \
+ < "Jiao Jianhua" ; > ; \
+ < "Gary Johnston" ; > ; \
+ < "Dewi Jones" ; > ; \
+ < "Henrik Jordt" ; > ; \
+ < "Anders Colding Jorgesen" ; > ; \
+ < "Peter Junge" ; > ; \
+ < "Christian Junker" ; > ; \
+ < "Pascal Junck" ; > ; \
+ < "Henrik Just" ; > ; \
+ < "Christian Kaas" ; > ; \
+ < "Yukata Kachi" ; > ; \
+ < "Natsu Kadoya" ; > ; \
+ < "Szalai Kalman" ; > ; \
+ < "masahisa kamataki" ; > ; \
+ < "Tim Kampa" ; > ; \
+ < "Petr Kania" ; > ; \
+ < "Mick Kappenburg" ; > ; \
+ < "Etsushi Kato" ; > ; \
+ < "Yosuke Kato" ; > ; \
+ < "Hirano Kazunari" ; > ; \
+ < "Mihaela Kedikova" ; > ; \
+ < "Juergen Keil" ; > ; \
+ < "Lina Kemmel" ; > ; \
+ < "Darren Kenny" ; > ; \
+ < "Dhanajay Keskar" ; > ; \
+ < "Ilja Ketris" ; > ; \
+ < "Philipp Kewisch Ketris" ; > ; \
+ < "Ossama Khayat" ; > ; \
+ < "Volodymyr Khrystynych" ; > ; \
+ < "Ilja Ketris" ; > ; \
+ < "Hermann Kienlein" ; > ; \
+ < "Artem Khvat" ; > ; \
+ < "Aijin Kim" ; > ; \
+ < "Jeongkyu Kim" ; > ; \
+ < "Jung-uk Kim" ; > ; \
+ < "Bevis Robert Wearing King" ; > ; \
+ < "Bo Kiersgaard" ; > ; \
+ < "Robert Kinsella" ; > ; \
+ < "Lazsio Kishalmi" ; > ; \
+ < "Andre Kitzing" ; > ; \
+ < "Thomas Klarhoefer" ; > ; \
+ < "Sven Klawitter" ; > ; \
+ < "Branislav Klocok" ; > ; \
+ < "Matthias Klose" ; > ; \
+ < "Halfdan Holger Knudsen" ; > ; \
+ < "Rune Tendal Kock" ; > ; \
+ < "Magdy Samuel Abdel Koddous" ; > ; \
+ < "Charles Peter Koerner" ; > ; \
+ < "Kay Koll" ; > ; \
+ < "Masataka Kondo" ; > ; \
+ < "Soren Kongstad" ; > ; \
+ < "Dimitris Korbetis" ; > ; \
+ < "Uros Kositer" ; > ; \
+ < "Peter Kosmalla" ; > ; \
+ < "Nobuhiro Koura" ; > ; \
+ < "Lazlo Kovacs" ; > ; \
+ < "Martin Kretzchmar" ; > ; \
+ < "Ramesh Krishnamagaru" ; > ; \
+ < "Jayamohan Krishnasamy" ; > ; \
+ < "Erik Kristiansen" ; > ; \
+ < "Jesper Krogh" ; > ; \
+ < "Oliver Krapp" ; > ; \
+ < "Andrey Krutak" ; > ; \
+ < "Andreas Krause" ; > ; \
+ < "Tobias Krause" ; > ; \
+ < "Nigel Kukard" ; > ; \
+ < "Andre Kuemmel" ; > ; \
+ < "Jorma Kuha" ; > ; \
+ < "Mashrab Kuvatov" ; > ; \
+ < "Thorsten Koerner" ; > ; \
+ < "Ralf Kuhnert" ; > ; \
+ < "Gaute Hvoslef Kvalnes" ; > ; \
+ < "Kabrianis & Sia O.E." ; > ; \
+ < "William Rikard Lachance" ; > ; \
+ < "Dominic Lachoucz" ; > ; \
+ < "Sandra Lain" ; > ; \
+ < "Alexandre Lahiniriko" ; > ; \
+ < "Denis Lakcovic" ; > ; \
+ < "Dr. Swapnil Vishnu Lale" ; > ; \
+ < "Antti Lampinen/Kongo Group" ; > ; \
+ < "Massimo Lanfranconi" ; > ; \
+ < "Marcus Lange" ; > ; \
+ < "Peter Lange" ; > ; \
+ < "Thomas Lange" ; > ; \
+ < "Lars Langhans" ; > ; \
+ < "Vance Lankhaar" ; > ; \
+ < "Sébastien Lanteigne" ; > ; \
+ < "Finn Gruwier Larsen" ; > ; \
+ < "Rune S. Larsen" ; > ; \
+ < "Pavel Lastovicka" ; > ; \
+ < "Rimgaudus Laucius" ; > ; \
+ < "Jesper Laugesen" ; > ; \
+ < "David Laurent" ; > ; \
+ < "Thorsten Laux" ; > ; \
+ < "Nemeth Laszlo" ; > ; \
+ < "Hans-Joachim Lankenau (Ause)" ; > ; \
+ < "Athanasios Lefteris" ; > ; \
+ < "Ely Levy" ; > ; \
+ < "Learning and Teaching Scotland" ; > ; \
+ < "Yoann Le Bars" ; > ; \
+ < "Armin Le Grand" ; > ; \
+ < "Brigitte Le Grand" ; > ; \
+ < "Jakob Lechner" ; > ; \
+ < "Michael Leibowitz" ; > ; \
+ < "Serge Le Louarne" ; > ; \
+ < "Dong Lee" ; > ; \
+ < "Kenneth Lee" ; > ; \
+ < "Gregory Leffler" ; > ; \
+ < "Hercule Li" ; > ; \
+ < "Hui Li" ; > ; \
+ < "Jian Li" ; > ; \
+ < "Tommy C. Li" ; > ; \
+ < "Wind Li" ; > ; \
+ < "Xing Li" ; > ; \
+ < "Ping Liao" ; > ; \
+ < "Xin Liao" ; > ; \
+ < "Weike Liang" ; > ; \
+ < "Rony Liemmukda" ; > ; \
+ < "Tor Lillqvist" ; > ; \
+ < "Patranun Limudomporn" ; > ; \
+ < "Archie Lin" ; > ; \
+ < "Fong Lin" ; > ; \
+ < "Martha J. Lindeman" ; > ; \
+ < "Joachim Lingner" ; > ; \
+ < "Christian Lippka" ; > ; \
+ < "Chen Liu" ; > ; \
+ < "Jianli Liu" ; > ; \
+ < "Mindy Liu" ; > ; \
+ < "Tao Liu" ; > ; \
+ < "YiSong Liu" ; > ; \
+ < "Yu Liu" ; > ; \
+ < "Yuhua Liu" ; > ; \
+ < "ALT Linux Russia" ; > ; \
+ < "Jonathan S. Lister" ; > ; \
+ < "Vedran Ljubovic" ; > ; \
+ < "Frank Loehmann" ; > ; \
+ < "Dieter Loeschky" ; > ; \
+ < "Philipp Lohmann" ; > ; \
+ < "Christian Lohmaier" ; > ; \
+ < "Michel Loiseleur" ; > ; \
+ < "Anthony Long" ; > ; \
+ < "Roberto Loprieno" ; > ; \
+ < "Riccardo Losselli" ; > ; \
+ < "Jackson Low" ; > ; \
+ < "Patrick Luby" ; > ; \
+ < "Christoph Lukasiak" ; > ; \
+ < "Robert Ludvik" ; > ; \
+ < "Uwe Luebbers" ; > ; \
+ < "Edgardo Lugaresi" ; > ; \
+ < "Gavin Lu" ; > ; \
+ < "Morton Lund" ; > ; \
+ < "Jingrong Luo" ; > ; \
+ < "Zaoliang Luo" ; > ; \
+ < "Ian Lynch" ; > ; \
+ < "Jun Ma" ; > ; \
+ < "Thomas J.L. MacDermott" ; > ; \
+ < "Marcio A. Macendo" ; > ; \
+ < "George Machitidze" ; > ; \
+ < "Diane Mackay" ; > ; \
+ < "Prasad Madhav" ; > ; \
+ < "Jorgen Madsen" ; > ; \
+ < "Ove Madsen" ; > ; \
+ < "Martin Maher" ; > ; \
+ < "Babak Mahbod" ; > ; \
+ < "Nakata Maho " ; > ; \
+ < "Wad Mahsckoff" ; > ; \
+ < "Milena Majorosova" ; > ; \
+ < "Yonggang Mao" ; > ; \
+ < "Libor Maly" ; > ; \
+ < "Mandrake Soft S.A." ; > ; \
+ < "Libor Maly" ; > ; \
+ < "Mohammed Mamdouh" ; > ; \
+ < "Andreas Mantke" ; > ; \
+ < "Paolo Mantovani" ; > ; \
+ < "Chris Manuh" ; > ; \
+ < "Luisa Della Marina" ; > ; \
+ < "Christian Markgraf" ; > ; \
+ < "John Marmion" ; > ; \
+ < "Adam Marks" ; > ; \
+ < "Dirk Marquardt" ; > ; \
+ < "Tam Marshall" ; > ; \
+ < "Andreas Martens" ; > ; \
+ < "Thorsten Martens" ; > ; \
+ < "Bartosz Maruszewski" ; > ; \
+ < "Jordi Mas" ; > ; \
+ < "Nishida Masanori" ; > ; \
+ < "Yoshiyuki Masutomi" ; > ; \
+ < "Ivan Masar" ; > ; \
+ < "Nishida Masanori" ; > ; \
+ < "Shane M. Mathews" ; > ; \
+ < "Yoshiyuki Masutomi" ; > ; \
+ < "Akira Matsumiya" ; > ; \
+ < "Yoshihiso Matsutani" ; > ; \
+ < "Shinobu Matsuzuka" ; > ; \
+ < "Elizabeth Matthis" ; > ; \
+ < "Michael Maurier, Publishing Power, Inc." ; > ; \
+ < "Frank Mau" ; > ; \
+ < "Izumi Mazur" ; > ; \
+ < "John McCreesh" ; > ; \
+ < "Shaun McDonald" ; > ; \
+ < "Ian McDonnell" ; > ; \
+ < "Caolan McNamara" ; > ; \
+ < "Jacqueline McNally" ; > ; \
+ < "Aaron R. Meck" ; > ; \
+ < "Nirav Mehta" ; > ; \
+ < "Michael Meeks" ; > ; \
+ < "Frederico Mena-Quintero" ; > ; \
+ < "James Meng" ; > ; \
+ < "Frank Meies" ; > ; \
+ < "Antonius Tjipke Meinen" ; > ; \
+ < "Ismael Merzaq" ; > ; \
+ < "Andreas Meyer" ; > ; \
+ < "Markus Meyer" ; > ; \
+ < "Rolf Meyer" ; > ; \
+ < "Djapparova Meruert" ; > ; \
+ < "Ismael Merzaq" ; > ; \
+ < "Michael Mi" ; > ; \
+ < "Bjoern Michaelsen" ; > ; \
+ < "Boris Michelsz" ; > ; \
+ < "Bjoern Milcke" ; > ; \
+ < "Marcin Milkowski" ; > ; \
+ < "Michelle Milledge" ; > ; \
+ < "Aleksander Mikhailov-Erlich" ; > ; \
+ < "Paul A. Miller" ; > ; \
+ < "Arkadiusz Miskiewicz" ; > ; \
+ < "Petr Mladek" ; > ; \
+ < "Erica Modena" ; > ; \
+ < "Filip Molcan" ; > ; \
+ < "Tadeusz Mollun" ; > ; \
+ < "Carl De Monbrun" ; > ; \
+ < "Volker Moneke" ; > ; \
+ < "Takayuki Morisawa" ; > ; \
+ < "Jan Morgils" ; > ; \
+ < "Tim Morley" ; > ; \
+ < "Tomas Mraz" ; > ; \
+ < "Cyrille Moureaux" ; > ; \
+ < "S. Muguntharaj" ; > ; \
+ < "Matthias Mueller-Prove" ; > ; \
+ < "Inaki Larranaga Murgoitio" ; > ; \
+ < "Mark Murnane" ; > ; \
+ < "Jack Murphy" ; > ; \
+ < "Steven Michael Murphy" ; > ; \
+ < "Kris Nackaerts" ; > ; \
+ < "Hiroyuki Nakaji" ; > ; \
+ < "Takashi Nakamoto" ; > ; \
+ < "Maho Nakata" ; > ; \
+ < "National Centre for Software Technology, India" ; > ; \
+ < "Takamichi Nara" ; > ; \
+ < "Peter Naulls" ; > ; \
+ < "Jan Navratil" ; > ; \
+ < "Niklas Nebel" ; > ; \
+ < "Ales Nehyba" ; > ; \
+ < "Christoph Neumann" ; > ; \
+ < "Frank Neumann" ; > ; \
+ < "Marc Neumann" ; > ; \
+ < "Net Integration Technologies, Inc." ; > ; \
+ < "Scott Ng" ; > ; \
+ < "Nam T. Nguyen" ; > ; \
+ < "Jan Normann Nielsen" ; > ; \
+ < "Ko-haw Nieh" ; > ; \
+ < "Peter Van Nieuwenhoven" ; > ; \
+ < "Jan Nieuwenhuizen" ; > ; \
+ < "Dhiraj Nilange" ; > ; \
+ < "Sofia Nilsson" ; > ; \
+ < "Kazutoshi Nimura" ; > ; \
+ < "Jes Drost Nissen" ; > ; \
+ < "Sofia Nilsson" ; > ; \
+ < "Christoph Noack" ; > ; \
+ < "Bertram Nolte" ; > ; \
+ < "Niels Nordmann" ; > ; \
+ < "Michael Novati" ; > ; \
+ < "Novell, Inc.," ; > ; \
+ < "Rodrigo Parra Novo" ; > ; \
+ < "Peter Novodvorsky" ; > ; \
+ < "O3Spaces (C.B Hoeflake)" ; > ; \
+ < "Tomas O'Connor" ; > ; \
+ < "Munzir Taha Obeid" ; > ; \
+ < "Eivind Odegard" ; > ; \
+ < "Maximilian Odendahl" ; > ; \
+ < "Kaoru Oguru" ; > ; \
+ < "Dan Ohnesorg" ; > ; \
+ < "Akira Ohsone" ; > ; \
+ < "Takashi Ono" ; > ; \
+ < "Lars Oppermann" ; > ; \
+ < "Michael Opsahl" ; > ; \
+ < "Anmar Oueja" ; > ; \
+ < "Dana Oliver" ; > ; \
+ < "Shane Owenby" ; > ; \
+ < "Marcin Orowski" ; > ; \
+ < "Takeshi Otsuki" ; > ; \
+ < "Jan-Hendrick Palic" ; > ; \
+ < "Assis Paniago" ; > ; \
+ < "Carlos F.A. Paniago" ; > ; \
+ < "Subiaco Paola" ; > ; \
+ < "Kannada Ganaka Parishat" ; > ; \
+ < "Anna Parovel" ; > ; \
+ < "Pierre Pasteau" ; > ; \
+ < "Shripad Patki" ; > ; \
+ < "Andreas Pauley" ; > ; \
+ < "Viktorija Paulikaite" ; > ; \
+ < "Soren Thing Pedersen" ; > ; \
+ < "Pablo F. Pena IV" ; > ; \
+ < "Mattia Penati" ; > ; \
+ < "Pentaho - James Dixon - " ; > ; \
+ < "Damien Persohn" ; > ; \
+ < "Andrea Pescetti" ; > ; \
+ < "Edward Peterlin" ; > ; \
+ < "Allan Juhl Peterson" ; > ; \
+ < "Frank Peters" ; > ; \
+ < "Bryan Petty" ; > ; \
+ < "John Pfersich" ; > ; \
+ < "Wilhelm Pfluger" ; > ; \
+ < "Thomas Pfohe" ; > ; \
+ < "Yashwant Phatak" ; > ; \
+ < "Nusorn Photpipat" ; > ; \
+ < "Dao-Duy Pierre" ; > ; \
+ < "Juergen Pingel" ; > ; \
+ < "Christof Pintaske" ; > ; \
+ < "Guido Pinkernell" ; > ; \
+ < "Pedro Pinto" ; > ; \
+ < "Saso Pirnat" ; > ; \
+ < "Sebastien Plisson" ; > ; \
+ < "Aurelien Pocheville" ; > ; \
+ < "Pvabhas Pokhavel" ; > ; \
+ < "Ravi Poluri" ; > ; \
+ < "Rastislav Poruban" ; > ; \
+ < "Noel Power" ; > ; \
+ < "Ashwanth Premchandran" ; > ; \
+ < "Marco Pratesi" ; > ; \
+ < "Nikolai Pretzell" ; > ; \
+ < "Nicola Previati" ; > ; \
+ < "Rhoslyn Prys" ; > ; \
+ < "Jaroslaw Jan Pyszny" ; > ; \
+ < "Jonathan Pryor" ; > ; \
+ < "Zhang Qingbin" ; > ; \
+ < "Canghua Qu" ; > ; \
+ < "Volker Quetschke" ; > ; \
+ < "Tino Rachui" ; > ; \
+ < "Radostin Radnev" ; > ; \
+ < "Pramod Raghavendra" ; > ; \
+ < "Adam Rambousek" ; > ; \
+ < "Jacqueline Rahemipour" ; > ; \
+ < "Goran Rakic" ; > ; \
+ < "Adam Rambousek" ; > ; \
+ < "Kay Ramme" ; > ; \
+ < "Klaus Ramstock" ; > ; \
+ < "Scott Rankin" ; > ; \
+ < "Samphan Raruenrom" ; > ; \
+ < "Michael Rasch" ; > ; \
+ < "Ejnar Zacho Rath" ; > ; \
+ < "Eike Rathke" ; > ; \
+ < "Michael Rauch" ; > ; \
+ < "Jens-Heiner Rechtien" ; > ; \
+ < "Red Hat, Inc." ; > ; \
+ < "Itzchack Rehberg" ; > ; \
+ < "Frank Rehberger" ; > ; \
+ < "Michael Reichow" ; > ; \
+ < "Manfred Reiter" ; > ; \
+ < "Eric Renaud" ; > ; \
+ < "Peyronnet Remi" ; > ; \
+ < "Daniel Rentz" ; > ; \
+ < "Florian Reuter" ; > ; \
+ < "Kjell Arne Rekaa" ; > ; \
+ < "Frco. Javier Rial" ; > ; \
+ < "Nicholas Richards" ; > ; \
+ < "Georg Richter" ; > ; \
+ < "Jozef Riha" ; > ; \
+ < "Michael Lee Rilee" ; > ; \
+ < "Modestas Rimkus" ; > ; \
+ < "Jose Ariel Rios" ; > ; \
+ < "Jorge Rivas" ; > ; \
+ < "William Robinson" ; > ; \
+ < "Donald Evan Rogers" ; > ; \
+ < "Willy Sudiarto Rohorjo" ; > ; \
+ < "Hennes Rohling" ; > ; \
+ < "Richard Rolston" ; > ; \
+ < "Christian Romanini" ; > ; \
+ < "Lin Rongheng" ; > ; \
+ < "Dimitri Roschowski" ; > ; \
+ < "Eddie Roosenmaallen" ; > ; \
+ < "Dimitri Roschkowski" ; > ; \
+ < "Bernard Rosenkraenzer" ; > ; \
+ < "Cark Rosschou" ; > ; \
+ < "Thomas Roswall" ; > ; \
+ < "Werner Roth" ; > ; \
+ < "Christian Roy" ; > ; \
+ < "Doug Royer" ; > ; \
+ < "Bill Roth" ; > ; \
+ < "rPath, Inc. (Erik W. Troan)" ; > ; \
+ < "Saverio Rubini" ; > ; \
+ < "Klaus Ruehl" ; > ; \
+ < "Verena Ruff" ; > ; \
+ < "Michael Ruess" ; > ; \
+ < "Peeter Russak" ; > ; \
+ < "Stasys Rutkauskas" ; > ; \
+ < "Frederick K. Saalbach" ; > ; \
+ < "Tobias Sager" ; > ; \
+ < "Enn Saar" ; > ; \
+ < "Reshat Sabiq" ; > ; \
+ < "Amit Kumar Saha" ; > ; \
+ < "Bibek Sahu" ; > ; \
+ < "Reiko Saito" ; > ; \
+ < "Bruno Sant'Anna" ; > ; \
+ < "Roberto Figueiredo Salomon" ; > ; \
+ < "Shkumbim Saneja" ; > ; \
+ < "Janus Sandsgaard" ; > ; \
+ < "Pablo Sarataga" ; > ; \
+ < "Juraj Sarinay" ; > ; \
+ < "Nobuyuki Sasaki" ; > ; \
+ < "Eric Savary" ; > ; \
+ < "Stephan Schaefer" ; > ; \
+ < "Kathryn L. Schenk" ; > ; \
+ < "Harald Schilly" ; > ; \
+ < "Tom Schindl" ; > ; \
+ < "Andreas Schluens" ; > ; \
+ < "Ingo Schmidt-Rosbiegal" ; > ; \
+ < "Juergen Schmidt" ; > ; \
+ < "Andre Schnabel" ; > ; \
+ < "Frank Schoenheit" ; > ; \
+ < "Timon Schroeter" ; > ; \
+ < "Maik Schroeder" ; > ; \
+ < "Sabine Schroeder" ; > ; \
+ < "Admar Schoonen" ; > ; \
+ < "Svante Schubert" ; > ; \
+ < "Friedemann Schuetz" ; > ; \
+ < "Dietrich Schulten" ; > ; \
+ < "Charles Henri Schulz" ; > ; \
+ < "Christoph Schultz" ; > ; \
+ < "Thorsten Schulz" ; > ; \
+ < "Stella Schulze" ; > ; \
+ < "Martin Seelhofer" ; > ; \
+ < "Daniel Seibert" ; > ; \
+ < "Marcella Semboli" ; > ; \
+ < "Julian Seward" ; > ; \
+ < "Shanmugam Senthil" ; > ; \
+ < "Giovanni Sgnaolin" ; > ; \
+ < "Charles Sharp" ; > ; \
+ < "Syed Ahmad Shazali" ; > ; \
+ < "Darragh Sherwin" ; > ; \
+ < "Gia Shervashidze" ; > ; \
+ < "Wei Guo Shi" ; > ; \
+ < "Norikatsu Shigemura" ; > ; \
+ < "Bernhard Siaud" ; > ; \
+ < "Joerg Sievers" ; > ; \
+ < "Silicon Graphic, Inc." ; > ; \
+ < "Maria Augusta Marques da Silva" ; > ; \
+ < "Keld Jorn Simonsen" ; > ; \
+ < "Michael Sicotte" ; > ; \
+ < "Clytie Ann Siddall" ; > ; \
+ < "Raul Siddahartha" ; > ; \
+ < "SIL International (Freddy Boswell)" ; > ; \
+ < "Mukund Sivaraman" ; > ; \
+ < "Manoranjan Kr. Singh" ; > ; \
+ < "G. Roderick Singleton" ; > ; \
+ < "Joerg Skottke" ; > ; \
+ < "Sarah Smith" ; > ; \
+ < "Timothy P. Smith" ; > ; \
+ < "Colm Smyth" ; > ; \
+ < "Javier Sola" ; > ; \
+ < "Inga Solyte" ; > ; \
+ < "Peter Somlo" ; > ; \
+ < "Kai Sommerfeld" ; > ; \
+ < "Young Joo Song" ; > ; \
+ < "Claus Soerensen" ; > ; \
+ < "Sbarnea Sorin" ; > ; \
+ < "Anousak Souphavank" ; > ; \
+ < "Caio Tiago Oliveira de Sousa" ; > ; \
+ < "Oliver Specht" ; > ; \
+ < "Laure Spilker-Four" ; > ; \
+ < "Michael Stahl" ; > ; \
+ < "Irina Stamatoiu" ; > ; \
+ < "Joseph James John Stanford" ; > ; \
+ < "Frank Stecher" ; > ; \
+ < "Boris Steiner" ; > ; \
+ < "Jason Stewart" ; > ; \
+ < "Konrad Stobiecki" ; > ; \
+ < "Arthit Suriyawongkul" ; > ; \
+ < "Lili Sun" ; > ; \
+ < "Erik William Strack" ; > ; \
+ < "Daniel Strome" ; > ; \
+ < "Fridrich Strba" ; > ; \
+ < "Keith Stribley" ; > ; \
+ < "Ulf Stroehler" ; > ; \
+ < "Daniel Strome" ; > ; \
+ < "Louis Suarez-Potts" ; > ; \
+ < "Muthu Subramanian" ; > ; \
+ < "Matthias Suess" ; > ; \
+ < "Tae Hoon Suk of Intellikorea Ca., Ltd." ; > ; \
+ < "Arthit Suriyawongkul" ; > ; \
+ < "SuSE CR, s.r.o" ; > ; \
+ < "Steve Swales" ; > ; \
+ < "Ethan Baggett Swint" ; > ; \
+ < "Kaupo Suviste" ; > ; \
+ < "TK Open Systems Ltd." ; > ; \
+ < "TTC Telecom" ; > ; \
+ < "E. A. Tacao" ; > ; \
+ < "Munzir Taha" ; > ; \
+ < "Hidetoshi Tajima" ; > ; \
+ < "Kazuhiro Hatake Takabatake " ; > ; \
+ < "Taigo Takeda" ; > ; \
+ < "Christina Taliaferro" ; > ; \
+ < "Makoto Takizawa" ; > ; \
+ < "Masaki Tamakoshi" ; > ; \
+ < "Quanfa Tang" ; > ; \
+ < "Alberto Di Taranto" ; > ; \
+ < "David Tardon" ; > ; \
+ < "Uday K. Tashildar" ; > ; \
+ < "Stefan Taxhet" ; > ; \
+ < "William Terry" ; > ; \
+ < "Michal Touzin" ; > ; \
+ < "Techmaprojekt Sp. z.o.o." ; > ; \
+ < "Erwin Tenhumberg" ; > ; \
+ < "William Terry" ; > ; \
+ < "Pietro Emilio Teofilatto" ; > ; \
+ < "Falko Tesch" ; > ; \
+ < "Armin Theissen" ; > ; \
+ < "Christophe Thibierge" ; > ; \
+ < "Michael Thiessne" ; > ; \
+ < "James M. Thompson" ; > ; \
+ < "Holger Thon" ; > ; \
+ < "Alexander Thurgood" ; > ; \
+ < "Caio Tiago Oliveira" ; > ; \
+ < "Lukas Tinkl" ; > ; \
+ < "Gerhard Tonn" ; > ; \
+ < "Istvan Torda" ; > ; \
+ < "Robert J. Townley" ; > ; \
+ < "Christian Treldal" ; > ; \
+ < "Trees for Life, Inc." ; > ; \
+ < "Christian Treldal" ; > ; \
+ < "James Treleaven" ; > ; \
+ < "Tim Tretyak" ; > ; \
+ < "Andreas Treumann" ; > ; \
+ < "Claus Dieter Thoele" ; > ; \
+ < "Filippo Trianni" ; > ; \
+ < "Joshua A. Triplett" ; > ; \
+ < "John Trowbridge" ; > ; \
+ < "Dang Minh Tuan" ; > ; \
+ < "Gianluca Turconi" ; > ; \
+ < "Gunnar Timm" ; > ; \
+ < "Ruediger Timm" ; > ; \
+ < "Malte Timmermann" ; > ; \
+ < "Ralf Unger" ; > ; \
+ < "Manu Unni" ; > ; \
+ < "Iulian Ursache" ; > ; \
+ < "UITE Open Source Armenia" ; > ; \
+ < "John Vandenberg" ; > ; \
+ < "Ain Vagula" ; > ; \
+ < "Mura Valter" ; > ; \
+ < "Elanjelian Venugopal" ; > ; \
+ < "Sven Vermeulen" ; > ; \
+ < "Tom Verbeek" ; > ; \
+ < "Sven Vermeulen" ; > ; \
+ < "Tomas Vesely" ; > ; \
+ < "Kim Viktoriya" ; > ; \
+ < "Sander Vesik" ; > ; \
+ < "Aridane Vilardaga-Viera" ; > ; \
+ < "Adriano Del Vigna" ; > ; \
+ < "Dirk Voelzke" ; > ; \
+ < "Robert Vojta" ; > ; \
+ < "Daniel Vogelheim" ; > ; \
+ < "Mikhail Voitenko" ; > ; \
+ < "Vladimir Vuksan" ; > ; \
+ < "Erno Vuori" ; > ; \
+ < "Radek Vybiral" ; > ; \
+ < "Robert Don Wadley" ; > ; \
+ < "Robert Wagy" ; > ; \
+ < "Martina Waller" ; > ; \
+ < "William Wan" ; > ; \
+ < "Funda Wang" ; > ; \
+ < "Polly Wang" ; > ; \
+ < "Xu Ming Wang" ; > ; \
+ < "Yi Wang" ; > ; \
+ < "Sangay Wangchuk" ; > ; \
+ < "Matthew Wardrop" ; > ; \
+ < "Catherine Waterman" ; > ; \
+ < "Jim Watson" ; > ; \
+ < "Joerg Wartenberg" ; > ; \
+ < "Jean Hollis Weber" ; > ; \
+ < "Martin Webermann" ; > ; \
+ < "Donata Wegener" ; > ; \
+ < "Law Yee Wei" ; > ; \
+ < "Zhao Wei" ; > ; \
+ < "Michel Weimerskirch" ; > ; \
+ < "Prof. Dr. Eduard Werner" ; > ; \
+ < "Michael Wever" ; > ; \
+ < "Brendan Whelan" ; > ; \
+ < "Martin Whitaker" ; > ; \
+ < "Arnulf Wiedemann" ; > ; \
+ < "Franz Wieser" ; > ; \
+ < "Dan Williams" ; > ; \
+ < "Deirdre Williams" ; > ; \
+ < "Michelle C. Williams" ; > ; \
+ < "Miljenko Williams" ; > ; \
+ < "David Noel Wilson" ; > ; \
+ < "Jennifer Winger" ; > ; \
+ < "Oliver-Rainer Wittmann" ; > ; \
+ < "Hans Witvliet" ; > ; \
+ < "Goetz Wohlberg" ; > ; \
+ < "Luciano Miguel Wolf" ; > ; \
+ < "Eugene T.S. Wong" ; > ; \
+ < "Pui Lam Wong" ; > ; \
+ < "Minna Wu" ; > ; \
+ < "Yan Wu" ; > ; \
+ < "Stephan Wunderlich" ; > ; \
+ < "Simos Xenitellis" ; > ; \
+ < "Shun Min Serena Xiao" ; > ; \
+ < "Nat Friedman for Ximian" ; > ; \
+ < "Antonio Xu" ; > ; \
+ < "Dehua Xu" ; > ; \
+ < "Gary Yang" ; > ; \
+ < "Yukiharu Yabuki" ; > ; \
+ < "Kliment Pavlov Yanev" ; > ; \
+ < "Taniguchi Yasuaki" ; > ; \
+ < "Oleg Yegorov" ; > ; \
+ < "Steve Yin" ; > ; \
+ < "Kunihiko Yokota" ; > ; \
+ < "Kim Il Yong" ; > ; \
+ < "Kohei Yoshida" ; > ; \
+ < "Deltasoft Yu" ; > ; \
+ < "Guoqiang Yu" ; > ; \
+ < "Xiaoyang Yu" ; > ; \
+ < "Gary Yuen" ; > ; \
+ < "Christian Zagrodnick" ; > ; \
+ < "George Zahopulos" ; > ; \
+ < "Aidas Zandaris" ; > ; \
+ < "Ernedin Zajko" ; > ; \
+ < "Kurt Zenker" ; > ; \
+ < "Fuxin Zhang" ; > ; \
+ < "Joy Zhang" ; > ; \
+ < "Lei Phill Zhang" ; > ; \
+ < "Xiaofei Zhang" ; > ; \
+ < "Jianwei Zhao" ; > ; \
+ < "May Zhang" ; > ; \
+ < "Jeremy Zheng" ; > ; \
+ < "Thorsten Ziehm" ; > ; \
+ < "Stefan Ziel" ; > ; \
+ < "Jan Zitniak" ; > ; \
+ < "Stefan Zimmermann" ; > ; \
+ < "Mattia Zuliani" ; > ; \
+};
+
diff --git a/svx/source/intro/about_ooo.src b/svx/source/intro/about_ooo.src
new file mode 100644
index 000000000000..b49a0ff927cf
--- /dev/null
+++ b/svx/source/intro/about_ooo.src
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svtools/svtools.hrc>
+#include "about_ooo.hrc"
+
+String ABOUT_STR_COPYRIGHT
+{
+ Text[ en-US ] = "Copyright © 2000, 2010 Oracle and/or its affiliates. All rights reserved.\nThis product was created by %OOOVENDOR, based on OpenOffice.org.\nOpenOffice.org acknowledges all community members, especially those mentioned at\n http://www.openoffice.org/welcome/credits.html.";
+};
+
+StringArray ABOUT_STR_DEVELOPER_ARY
+{
+ OOO_CONTRIBUTOR_LIST
+};
+
diff --git a/svx/source/items/SmartTagItem.cxx b/svx/source/items/SmartTagItem.cxx
new file mode 100644
index 000000000000..ba100a2e2ab0
--- /dev/null
+++ b/svx/source/items/SmartTagItem.cxx
@@ -0,0 +1,123 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <svx/SmartTagItem.hxx>
+
+#ifndef _COM_SUN_STAR_SMARTTAGS_XSMARTTAGPROPERTIES_HPP_
+#include <com/sun/star/container/XStringKeyMap.hpp>
+#endif
+
+
+//#include <svl/memberid.hrc>
+//#include "svxids.hrc"
+//#include "svxitems.hrc"
+
+using namespace ::com::sun::star;
+
+TYPEINIT1(SvxSmartTagItem, SfxPoolItem);
+
+// class SvxFontItem -----------------------------------------------------
+
+SvxSmartTagItem::SvxSmartTagItem( const sal_uInt16 nId,
+ const com::sun::star::uno::Sequence < com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > > >& rActionComponentsSequence,
+ const com::sun::star::uno::Sequence < com::sun::star::uno::Sequence< sal_Int32 > >& rActionIndicesSequence,
+ const com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > >& rStringKeyMaps,
+ const com::sun::star::uno::Reference<com::sun::star::text::XTextRange> rRange,
+ const com::sun::star::uno::Reference<com::sun::star::frame::XController> rController,
+ const com::sun::star::lang::Locale rLocale,
+ const rtl::OUString& rApplicationName,
+ const rtl::OUString& rRangeText ) :
+ SfxPoolItem( nId ),
+ maActionComponentsSequence( rActionComponentsSequence ),
+ maActionIndicesSequence( rActionIndicesSequence ),
+ maStringKeyMaps( rStringKeyMaps ),
+ mxRange( rRange ),
+ mxController( rController ),
+ maLocale( rLocale ),
+ maApplicationName( rApplicationName ),
+ maRangeText( rRangeText )
+{
+}
+
+// -----------------------------------------------------------------------
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxSmartTagItem::QueryValue( uno::Any& /* rVal */, sal_uInt8 /* nMemberId */ ) const
+{
+ return sal_False;
+}
+// -----------------------------------------------------------------------
+sal_Bool SvxSmartTagItem::PutValue( const uno::Any& /*rVal*/, sal_uInt8 /* nMemberId */)
+{
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------
+
+int SvxSmartTagItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
+
+ const SvxSmartTagItem& rItem = static_cast<const SvxSmartTagItem&>(rAttr);
+
+ int bRet = maActionComponentsSequence == rItem.maActionComponentsSequence &&
+ maActionIndicesSequence == rItem.maActionIndicesSequence &&
+ maStringKeyMaps == rItem.maStringKeyMaps &&
+ mxRange == rItem.mxRange &&
+ mxController == rItem.mxController &&
+ maApplicationName == rItem.maApplicationName &&
+ maRangeText == rItem.maRangeText;
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxSmartTagItem::Clone( SfxItemPool * ) const
+{
+ return new SvxSmartTagItem( *this );
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SvxSmartTagItem::Store( SvStream& rStream, sal_uInt16 /*nItemVersion*/ ) const
+{
+ return rStream;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxSmartTagItem::Create(SvStream& , sal_uInt16) const
+{
+ return 0;
+}
diff --git a/svx/source/items/algitem.cxx b/svx/source/items/algitem.cxx
new file mode 100644
index 000000000000..b5f399f2b88f
--- /dev/null
+++ b/svx/source/items/algitem.cxx
@@ -0,0 +1,765 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svxitems.hrc>
+
+
+#include <tools/stream.hxx>
+#include <com/sun/star/table/BorderLine.hpp>
+#include <com/sun/star/table/CellVertJustify.hpp>
+#include <com/sun/star/table/ShadowLocation.hpp>
+#include <com/sun/star/table/TableBorder.hpp>
+#include <com/sun/star/table/ShadowFormat.hpp>
+#include <com/sun/star/table/CellRangeAddress.hpp>
+#include <com/sun/star/table/CellContentType.hpp>
+#include <com/sun/star/table/TableOrientation.hpp>
+#include <com/sun/star/table/CellHoriJustify.hpp>
+#include <com/sun/star/style/ParagraphAdjust.hpp>
+#include "com/sun/star/style/VerticalAlignment.hpp"
+#include <com/sun/star/util/SortField.hpp>
+#include <com/sun/star/util/SortFieldType.hpp>
+#include <com/sun/star/table/CellOrientation.hpp>
+#include <com/sun/star/table/CellAddress.hpp>
+
+#include <svx/algitem.hxx>
+#include <svx/dialmgr.hxx>
+#include <editeng/itemtype.hxx>
+#include <svx/unomid.hxx>
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+// Konvertierung fuer UNO
+#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
+#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L))
+
+// STATIC DATA -----------------------------------------------------------
+
+//TYPEINIT1_AUTOFACTORY( SvxHorJustifyItem, SfxEnumItem );
+TYPEINIT1_FACTORY( SvxHorJustifyItem, SfxEnumItem, new SvxHorJustifyItem(SVX_HOR_JUSTIFY_STANDARD, 0))
+TYPEINIT1_FACTORY( SvxVerJustifyItem, SfxEnumItem, new SvxVerJustifyItem(SVX_VER_JUSTIFY_STANDARD, 0) );
+TYPEINIT1_FACTORY( SvxOrientationItem, SfxEnumItem, new SvxOrientationItem(SVX_ORIENTATION_STANDARD, 0) );
+TYPEINIT1_FACTORY( SvxMarginItem, SfxPoolItem, new SvxMarginItem(0) );
+
+// class SvxHorJustifyItem -----------------------------------------------
+
+
+SvxHorJustifyItem::SvxHorJustifyItem( const sal_uInt16 nId ) :
+ SfxEnumItem( nId, (sal_uInt16)SVX_HOR_JUSTIFY_STANDARD )
+{
+}
+
+SvxHorJustifyItem::SvxHorJustifyItem( const SvxCellHorJustify eJustify,
+ const sal_uInt16 nId ) :
+ SfxEnumItem( nId, (sal_uInt16)eJustify )
+{
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxHorJustifyItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText = GetValueText( GetValue() );
+ return SFX_ITEM_PRESENTATION_COMPLETE;
+ default: ; //prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool SvxHorJustifyItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ case MID_HORJUST_HORJUST:
+ {
+ table::CellHoriJustify eUno = table::CellHoriJustify_STANDARD;
+ switch ( (SvxCellHorJustify)GetValue() )
+ {
+ case SVX_HOR_JUSTIFY_STANDARD: eUno = table::CellHoriJustify_STANDARD; break;
+ case SVX_HOR_JUSTIFY_LEFT: eUno = table::CellHoriJustify_LEFT; break;
+ case SVX_HOR_JUSTIFY_CENTER: eUno = table::CellHoriJustify_CENTER; break;
+ case SVX_HOR_JUSTIFY_RIGHT: eUno = table::CellHoriJustify_RIGHT; break;
+ case SVX_HOR_JUSTIFY_BLOCK: eUno = table::CellHoriJustify_BLOCK; break;
+ case SVX_HOR_JUSTIFY_REPEAT: eUno = table::CellHoriJustify_REPEAT; break;
+ }
+ rVal <<= eUno;
+ }
+ break;
+ case MID_HORJUST_ADJUST:
+ {
+ // ParagraphAdjust values, as in SvxAdjustItem
+ // (same value for ParaAdjust and ParaLastLineAdjust)
+
+ sal_Int16 nAdjust = style::ParagraphAdjust_LEFT;
+ switch ( (SvxCellHorJustify)GetValue() )
+ {
+ // ParagraphAdjust_LEFT is used for STANDARD and REPEAT
+ case SVX_HOR_JUSTIFY_STANDARD:
+ case SVX_HOR_JUSTIFY_REPEAT:
+ case SVX_HOR_JUSTIFY_LEFT: nAdjust = style::ParagraphAdjust_LEFT; break;
+ case SVX_HOR_JUSTIFY_CENTER: nAdjust = style::ParagraphAdjust_CENTER; break;
+ case SVX_HOR_JUSTIFY_RIGHT: nAdjust = style::ParagraphAdjust_RIGHT; break;
+ case SVX_HOR_JUSTIFY_BLOCK: nAdjust = style::ParagraphAdjust_BLOCK; break;
+ }
+ rVal <<= nAdjust; // as sal_Int16
+ }
+ break;
+ }
+ return sal_True;
+}
+
+sal_Bool SvxHorJustifyItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
+{
+// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ case MID_HORJUST_HORJUST:
+ {
+ table::CellHoriJustify eUno;
+ if(!(rVal >>= eUno))
+ {
+ sal_Int32 nValue = 0;
+ if(!(rVal >>= nValue))
+ return sal_False;
+ eUno = (table::CellHoriJustify)nValue;
+ }
+ SvxCellHorJustify eSvx = SVX_HOR_JUSTIFY_STANDARD;
+ switch (eUno)
+ {
+ case table::CellHoriJustify_STANDARD: eSvx = SVX_HOR_JUSTIFY_STANDARD; break;
+ case table::CellHoriJustify_LEFT: eSvx = SVX_HOR_JUSTIFY_LEFT; break;
+ case table::CellHoriJustify_CENTER: eSvx = SVX_HOR_JUSTIFY_CENTER; break;
+ case table::CellHoriJustify_RIGHT: eSvx = SVX_HOR_JUSTIFY_RIGHT; break;
+ case table::CellHoriJustify_BLOCK: eSvx = SVX_HOR_JUSTIFY_BLOCK; break;
+ case table::CellHoriJustify_REPEAT: eSvx = SVX_HOR_JUSTIFY_REPEAT; break;
+ default: ; //prevent warning
+ }
+ SetValue( (sal_uInt16)eSvx );
+ }
+ break;
+ case MID_HORJUST_ADJUST:
+ {
+ // property contains ParagraphAdjust values as sal_Int16
+ sal_Int16 nVal = sal_Int16();
+ if(!(rVal >>= nVal))
+ return sal_False;
+
+ SvxCellHorJustify eSvx = SVX_HOR_JUSTIFY_STANDARD;
+ switch (nVal)
+ {
+ // STRETCH is treated as BLOCK
+ case style::ParagraphAdjust_LEFT: eSvx = SVX_HOR_JUSTIFY_LEFT; break;
+ case style::ParagraphAdjust_RIGHT: eSvx = SVX_HOR_JUSTIFY_RIGHT; break;
+ case style::ParagraphAdjust_STRETCH:
+ case style::ParagraphAdjust_BLOCK: eSvx = SVX_HOR_JUSTIFY_BLOCK; break;
+ case style::ParagraphAdjust_CENTER: eSvx = SVX_HOR_JUSTIFY_CENTER; break;
+ }
+ SetValue( (sal_uInt16)eSvx );
+ }
+ }
+ return sal_True;
+}
+
+//------------------------------------------------------------------------
+
+XubString SvxHorJustifyItem::GetValueText( sal_uInt16 nVal ) const
+{
+ DBG_ASSERT( nVal <= SVX_HOR_JUSTIFY_REPEAT, "enum overflow!" );
+ return SVX_RESSTR(RID_SVXITEMS_HORJUST_STANDARD + nVal);
+}
+
+//------------------------------------------------------------------------
+
+SfxPoolItem* SvxHorJustifyItem::Clone( SfxItemPool* ) const
+{
+ return new SvxHorJustifyItem( *this );
+}
+
+//------------------------------------------------------------------------
+
+SfxPoolItem* SvxHorJustifyItem::Create( SvStream& rStream, sal_uInt16 ) const
+{
+ sal_uInt16 nVal;
+ rStream >> nVal;
+ return new SvxHorJustifyItem( (SvxCellHorJustify)nVal, Which() );
+}
+//------------------------------------------------------------------------
+
+sal_uInt16 SvxHorJustifyItem::GetValueCount() const
+{
+ return SVX_HOR_JUSTIFY_REPEAT + 1; // letzter Enum-Wert + 1
+}
+
+// class SvxVerJustifyItem -----------------------------------------------
+
+SvxVerJustifyItem::SvxVerJustifyItem( const sal_uInt16 nId ) :
+ SfxEnumItem( nId, (sal_uInt16)SVX_VER_JUSTIFY_STANDARD )
+{
+}
+
+SvxVerJustifyItem::SvxVerJustifyItem( const SvxCellVerJustify eJustify,
+ const sal_uInt16 nId ) :
+ SfxEnumItem( nId, (sal_uInt16)eJustify )
+{
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxVerJustifyItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText,
+ const IntlWrapper * ) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText = GetValueText( GetValue() );
+ return SFX_ITEM_PRESENTATION_COMPLETE;
+ default: ; //prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool SvxVerJustifyItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ case MID_HORJUST_ADJUST:
+ {
+ style::VerticalAlignment eUno = style::VerticalAlignment_TOP;
+ switch ( (SvxCellVerJustify)GetValue() )
+ {
+ case SVX_VER_JUSTIFY_TOP: eUno = style::VerticalAlignment_TOP; break;
+ case SVX_VER_JUSTIFY_CENTER: eUno = style::VerticalAlignment_MIDDLE; break;
+ case SVX_VER_JUSTIFY_BOTTOM: eUno = style::VerticalAlignment_BOTTOM; break;
+ default: ; //prevent warning
+ }
+ rVal <<= eUno;
+ break;
+ }
+ default:
+ {
+ table::CellVertJustify eUno = table::CellVertJustify_STANDARD;
+ switch ( (SvxCellVerJustify)GetValue() )
+ {
+ case SVX_VER_JUSTIFY_STANDARD: eUno = table::CellVertJustify_STANDARD; break;
+ case SVX_VER_JUSTIFY_TOP: eUno = table::CellVertJustify_TOP; break;
+ case SVX_VER_JUSTIFY_CENTER: eUno = table::CellVertJustify_CENTER; break;
+ case SVX_VER_JUSTIFY_BOTTOM: eUno = table::CellVertJustify_BOTTOM; break;
+ default: ; //prevent warning
+ }
+ rVal <<= eUno;
+ break;
+ }
+ }
+ return sal_True;
+}
+
+sal_Bool SvxVerJustifyItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
+{
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ case MID_HORJUST_ADJUST:
+ {
+ // property contains ParagraphAdjust values as sal_Int16
+ style::VerticalAlignment nVal = style::VerticalAlignment_TOP;
+ if(!(rVal >>= nVal))
+ return sal_False;
+
+ SvxCellVerJustify eSvx = SVX_VER_JUSTIFY_STANDARD;
+ switch (nVal)
+ {
+ case style::VerticalAlignment_TOP: eSvx = SVX_VER_JUSTIFY_TOP; break;
+ case style::VerticalAlignment_MIDDLE: eSvx = SVX_VER_JUSTIFY_CENTER; break;
+ case style::VerticalAlignment_BOTTOM: eSvx = SVX_VER_JUSTIFY_BOTTOM; break;
+ default:;
+ }
+ SetValue( (sal_uInt16)eSvx );
+ break;
+ }
+ default:
+ {
+ table::CellVertJustify eUno;
+ if(!(rVal >>= eUno))
+ {
+ sal_Int32 nValue = 0;
+ if(!(rVal >>= nValue))
+ return sal_False;
+ eUno = (table::CellVertJustify)nValue;
+ }
+
+ SvxCellVerJustify eSvx = SVX_VER_JUSTIFY_STANDARD;
+ switch (eUno)
+ {
+ case table::CellVertJustify_STANDARD: eSvx = SVX_VER_JUSTIFY_STANDARD; break;
+ case table::CellVertJustify_TOP: eSvx = SVX_VER_JUSTIFY_TOP; break;
+ case table::CellVertJustify_CENTER: eSvx = SVX_VER_JUSTIFY_CENTER; break;
+ case table::CellVertJustify_BOTTOM: eSvx = SVX_VER_JUSTIFY_BOTTOM; break;
+ default: ; //prevent warning
+ }
+ SetValue( (sal_uInt16)eSvx );
+ break;
+ }
+ }
+
+ return sal_True;
+}
+
+//------------------------------------------------------------------------
+
+XubString SvxVerJustifyItem::GetValueText( sal_uInt16 nVal ) const
+{
+ DBG_ASSERT( nVal <= SVX_VER_JUSTIFY_BOTTOM, "enum overflow!" );
+ return SVX_RESSTR(RID_SVXITEMS_VERJUST_STANDARD + nVal);
+}
+
+//------------------------------------------------------------------------
+
+SfxPoolItem* SvxVerJustifyItem::Clone( SfxItemPool* ) const
+{
+ return new SvxVerJustifyItem( *this );
+}
+
+//------------------------------------------------------------------------
+
+SfxPoolItem* SvxVerJustifyItem::Create( SvStream& rStream, sal_uInt16 ) const
+{
+ sal_uInt16 nVal;
+ rStream >> nVal;
+ return new SvxVerJustifyItem( (SvxCellVerJustify)nVal, Which() );
+}
+
+//------------------------------------------------------------------------
+
+sal_uInt16 SvxVerJustifyItem::GetValueCount() const
+{
+ return SVX_VER_JUSTIFY_BOTTOM + 1; // letzter Enum-Wert + 1
+}
+
+// class SvxOrientationItem ----------------------------------------------
+
+SvxOrientationItem::SvxOrientationItem( const SvxCellOrientation eOrientation,
+ const sal_uInt16 nId):
+ SfxEnumItem( nId, (sal_uInt16)eOrientation )
+{
+}
+
+SvxOrientationItem::SvxOrientationItem( sal_Int32 nRotation, sal_Bool bStacked, const sal_uInt16 nId ) :
+ SfxEnumItem( nId )
+{
+ SetFromRotation( nRotation, bStacked );
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxOrientationItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper * ) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText = GetValueText( GetValue() );
+ return SFX_ITEM_PRESENTATION_COMPLETE;
+ default: ; //prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool SvxOrientationItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
+{
+ table::CellOrientation eUno = table::CellOrientation_STANDARD;
+ switch ( (SvxCellOrientation)GetValue() )
+ {
+ case SVX_ORIENTATION_STANDARD: eUno = table::CellOrientation_STANDARD; break;
+ case SVX_ORIENTATION_TOPBOTTOM: eUno = table::CellOrientation_TOPBOTTOM; break;
+ case SVX_ORIENTATION_BOTTOMTOP: eUno = table::CellOrientation_BOTTOMTOP; break;
+ case SVX_ORIENTATION_STACKED: eUno = table::CellOrientation_STACKED; break;
+ }
+ rVal <<= eUno;
+ return sal_True;
+}
+
+sal_Bool SvxOrientationItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
+{
+ table::CellOrientation eOrient;
+ if(!(rVal >>= eOrient))
+ {
+ sal_Int32 nValue = 0;
+ if(!(rVal >>= nValue))
+ return sal_False;
+ eOrient = (table::CellOrientation)nValue;
+ }
+ SvxCellOrientation eSvx = SVX_ORIENTATION_STANDARD;
+ switch (eOrient)
+ {
+ case table::CellOrientation_STANDARD: eSvx = SVX_ORIENTATION_STANDARD; break;
+ case table::CellOrientation_TOPBOTTOM: eSvx = SVX_ORIENTATION_TOPBOTTOM; break;
+ case table::CellOrientation_BOTTOMTOP: eSvx = SVX_ORIENTATION_BOTTOMTOP; break;
+ case table::CellOrientation_STACKED: eSvx = SVX_ORIENTATION_STACKED; break;
+ default: ; //prevent warning
+ }
+ SetValue( (sal_uInt16)eSvx );
+ return sal_True;
+}
+
+//------------------------------------------------------------------------
+
+XubString SvxOrientationItem::GetValueText( sal_uInt16 nVal ) const
+{
+ DBG_ASSERT( nVal <= SVX_ORIENTATION_STACKED, "enum overflow!" );
+ return SVX_RESSTR(RID_SVXITEMS_ORI_STANDARD + nVal);
+}
+
+//------------------------------------------------------------------------
+
+SfxPoolItem* SvxOrientationItem::Clone( SfxItemPool* ) const
+{
+ return new SvxOrientationItem( *this );
+}
+
+//------------------------------------------------------------------------
+
+SfxPoolItem* SvxOrientationItem::Create( SvStream& rStream, sal_uInt16 ) const
+{
+ sal_uInt16 nVal;
+ rStream >> nVal;
+ return new SvxOrientationItem( (SvxCellOrientation)nVal, Which() );
+}
+
+//------------------------------------------------------------------------
+
+sal_uInt16 SvxOrientationItem::GetValueCount() const
+{
+ return SVX_ORIENTATION_STACKED + 1; // letzter Enum-Wert + 1
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool SvxOrientationItem::IsStacked() const
+{
+ return static_cast< SvxCellOrientation >( GetValue() ) == SVX_ORIENTATION_STACKED;
+}
+
+sal_Int32 SvxOrientationItem::GetRotation( sal_Int32 nStdAngle ) const
+{
+ sal_Int32 nAngle = nStdAngle;
+ switch( static_cast< SvxCellOrientation >( GetValue() ) )
+ {
+ case SVX_ORIENTATION_BOTTOMTOP: nAngle = 9000;
+ case SVX_ORIENTATION_TOPBOTTOM: nAngle = 27000;
+ default: ; //prevent warning
+ }
+ return nAngle;
+}
+
+void SvxOrientationItem::SetFromRotation( sal_Int32 nRotation, sal_Bool bStacked )
+{
+ if( bStacked )
+ {
+ SetValue( SVX_ORIENTATION_STACKED );
+ }
+ else switch( nRotation )
+ {
+ case 9000: SetValue( SVX_ORIENTATION_BOTTOMTOP ); break;
+ case 27000: SetValue( SVX_ORIENTATION_TOPBOTTOM ); break;
+ default: SetValue( SVX_ORIENTATION_STANDARD );
+ }
+}
+
+// class SvxMarginItem ---------------------------------------------------
+
+SvxMarginItem::SvxMarginItem( const sal_uInt16 nId ) :
+
+ SfxPoolItem( nId ),
+
+ nLeftMargin ( 20 ),
+ nTopMargin ( 20 ),
+ nRightMargin ( 20 ),
+ nBottomMargin( 20 )
+{
+}
+
+//------------------------------------------------------------------------
+
+SvxMarginItem::SvxMarginItem( sal_Int16 nLeft,
+ sal_Int16 nTop,
+ sal_Int16 nRight,
+ sal_Int16 nBottom,
+ const sal_uInt16 nId ) :
+ SfxPoolItem( nId ),
+
+ nLeftMargin ( nLeft ),
+ nTopMargin ( nTop ),
+ nRightMargin ( nRight ),
+ nBottomMargin( nBottom )
+{
+}
+
+
+//------------------------------------------------------------------------
+
+SvxMarginItem::SvxMarginItem( const SvxMarginItem& rItem ) :
+
+ SfxPoolItem( rItem.Which() )
+{
+ nLeftMargin = rItem.nLeftMargin;
+ nTopMargin = rItem.nTopMargin;
+ nRightMargin = rItem.nRightMargin;
+ nBottomMargin = rItem.nBottomMargin;
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxMarginItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit eCoreUnit,
+ SfxMapUnit ePresUnit,
+ XubString& rText, const IntlWrapper *pIntl
+) const
+{
+#ifndef SVX_LIGHT
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ {
+ rText = GetMetricText( (long)nLeftMargin, eCoreUnit, ePresUnit, pIntl );
+ rText += cpDelim;
+ rText += GetMetricText( (long)nTopMargin, eCoreUnit, ePresUnit, pIntl );
+ rText += cpDelim;
+ rText += GetMetricText( (long)nRightMargin, eCoreUnit, ePresUnit, pIntl );
+ rText += cpDelim;
+ rText += GetMetricText( (long)nBottomMargin, eCoreUnit, ePresUnit, pIntl );
+ return SFX_ITEM_PRESENTATION_NAMELESS;
+ }
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ rText = SVX_RESSTR(RID_SVXITEMS_MARGIN_LEFT);
+ rText += GetMetricText( (long)nLeftMargin, eCoreUnit, ePresUnit, pIntl );
+ rText += SVX_RESSTR(GetMetricId(ePresUnit));
+ rText += cpDelim;
+ rText += SVX_RESSTR(RID_SVXITEMS_MARGIN_TOP);
+ rText += GetMetricText( (long)nTopMargin, eCoreUnit, ePresUnit, pIntl );
+ rText += SVX_RESSTR(GetMetricId(ePresUnit));
+ rText += cpDelim;
+ rText += SVX_RESSTR(RID_SVXITEMS_MARGIN_RIGHT);
+ rText += GetMetricText( (long)nRightMargin, eCoreUnit, ePresUnit, pIntl );
+ rText += SVX_RESSTR(GetMetricId(ePresUnit));
+ rText += cpDelim;
+ rText += SVX_RESSTR(RID_SVXITEMS_MARGIN_BOTTOM);
+ rText += GetMetricText( (long)nBottomMargin, eCoreUnit, ePresUnit, pIntl );
+ rText += SVX_RESSTR(GetMetricId(ePresUnit));
+ return SFX_ITEM_PRESENTATION_COMPLETE;
+ }
+ default: ; //prevent warning
+ }
+#endif
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//------------------------------------------------------------------------
+
+int SvxMarginItem::operator==( const SfxPoolItem& rItem ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
+
+ return ( ( nLeftMargin == ( (SvxMarginItem&)rItem ).nLeftMargin ) &&
+ ( nTopMargin == ( (SvxMarginItem&)rItem ).nTopMargin ) &&
+ ( nRightMargin == ( (SvxMarginItem&)rItem ).nRightMargin ) &&
+ ( nBottomMargin == ( (SvxMarginItem&)rItem ).nBottomMargin ) );
+}
+
+//------------------------------------------------------------------------
+
+SfxPoolItem* SvxMarginItem::Clone( SfxItemPool* ) const
+{
+ return new SvxMarginItem(*this);
+}
+
+//------------------------------------------------------------------------
+
+SfxPoolItem* SvxMarginItem::Create( SvStream& rStream, sal_uInt16 ) const
+{
+ sal_Int16 nLeft;
+ sal_Int16 nTop;
+ sal_Int16 nRight;
+ sal_Int16 nBottom;
+ rStream >> nLeft;
+ rStream >> nTop;
+ rStream >> nRight;
+ rStream >> nBottom;
+ return new SvxMarginItem( nLeft, nTop, nRight, nBottom, Which() );
+}
+
+//------------------------------------------------------------------------
+
+SvStream& SvxMarginItem::Store( SvStream &rStream, sal_uInt16 /*nItemVersion*/) const
+{
+ rStream << nLeftMargin;
+ rStream << nTopMargin;
+ rStream << nRightMargin;
+ rStream << nBottomMargin;
+ return rStream;
+}
+
+
+//------------------------------------------------------------------------
+
+sal_Bool SvxMarginItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+ sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ // jetzt alles signed
+ case MID_MARGIN_L_MARGIN:
+ rVal <<= (sal_Int32)( bConvert ? TWIP_TO_MM100(nLeftMargin) : nLeftMargin );
+ break;
+ case MID_MARGIN_R_MARGIN:
+ rVal <<= (sal_Int32)( bConvert ? TWIP_TO_MM100(nRightMargin) : nRightMargin );
+ break;
+ case MID_MARGIN_UP_MARGIN:
+ rVal <<= (sal_Int32)( bConvert ? TWIP_TO_MM100(nTopMargin) : nTopMargin );
+ break;
+ case MID_MARGIN_LO_MARGIN:
+ rVal <<= (sal_Int32)( bConvert ? TWIP_TO_MM100(nBottomMargin) : nBottomMargin );
+ break;
+ default:
+ DBG_ERROR("unknown MemberId");
+ return sal_False;
+ }
+ return sal_True;
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool SvxMarginItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
+{
+ sal_Bool bConvert = ( ( nMemberId & CONVERT_TWIPS ) != 0 );
+ long nMaxVal = bConvert ? TWIP_TO_MM100(SHRT_MAX) : SHRT_MAX; // Members sind sal_Int16
+ sal_Int32 nVal = 0;
+ if(!(rVal >>= nVal) || (nVal > nMaxVal))
+ return sal_False;
+
+ switch ( nMemberId & ~CONVERT_TWIPS )
+ {
+ case MID_MARGIN_L_MARGIN:
+ nLeftMargin = (sal_Int16)( bConvert ? MM100_TO_TWIP(nVal) : nVal );
+ break;
+ case MID_MARGIN_R_MARGIN:
+ nRightMargin = (sal_Int16)( bConvert ? MM100_TO_TWIP(nVal) : nVal );
+ break;
+ case MID_MARGIN_UP_MARGIN:
+ nTopMargin = (sal_Int16)( bConvert ? MM100_TO_TWIP(nVal) : nVal );
+ break;
+ case MID_MARGIN_LO_MARGIN:
+ nBottomMargin = (sal_Int16)( bConvert ? MM100_TO_TWIP(nVal) : nVal );
+ break;
+ default:
+ DBG_ERROR("unknown MemberId");
+ return sal_False;
+ }
+ return sal_True;
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool SvxMarginItem::SetLeftMargin( sal_Int16 nLeft )
+{
+ nLeftMargin = nLeft;
+ return sal_True;
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool SvxMarginItem::SetTopMargin( sal_Int16 nTop )
+{
+ nTopMargin = nTop;
+ return sal_True;
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool SvxMarginItem::SetRightMargin( sal_Int16 nRight )
+{
+ nRightMargin = nRight;
+ return sal_True;
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool SvxMarginItem::SetBottomMargin( sal_Int16 nBottom )
+{
+ nBottomMargin = nBottom;
+ return sal_True;
+}
+
+
diff --git a/svx/source/items/chrtitem.cxx b/svx/source/items/chrtitem.cxx
new file mode 100644
index 000000000000..114ce405bb69
--- /dev/null
+++ b/svx/source/items/chrtitem.cxx
@@ -0,0 +1,538 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/stream.hxx>
+#ifndef __SBX_SBXVARIABLE_HXX
+#include <basic/sbxvar.hxx>
+#endif
+#if defined UNX && !defined LINUX
+#include <wchar.h>
+#endif
+#include <rtl/math.hxx>
+#include <unotools/intlwrapper.hxx>
+#include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp>
+
+#include <stdio.h>
+#include <float.h>
+#include <rtl/math.hxx>
+
+#include "svx/chrtitem.hxx"
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+// -----------------------------------------------------------------------
+
+TYPEINIT1_FACTORY(SvxChartStyleItem, SfxEnumItem, new SvxChartStyleItem(CHSTYLE_2D_LINE, 0));
+TYPEINIT1(SvxChartDataDescrItem, SfxEnumItem);
+TYPEINIT1(SvxChartLegendPosItem, SfxEnumItem);
+TYPEINIT1(SvxChartTextOrderItem, SfxEnumItem);
+TYPEINIT1(SvxChartTextOrientItem, SfxEnumItem);
+TYPEINIT1(SvxChartIndicateItem, SfxEnumItem);
+TYPEINIT1(SvxChartKindErrorItem, SfxEnumItem);
+TYPEINIT1(SvxChartRegressItem, SfxEnumItem);
+TYPEINIT1_FACTORY(SvxDoubleItem, SfxPoolItem, new SvxDoubleItem(0.0, 0));
+
+/*************************************************************************
+|*
+|* SvxChartStyleItem
+|*
+*************************************************************************/
+
+SvxChartStyleItem::SvxChartStyleItem(SvxChartStyle eStyle, sal_uInt16 nId) :
+ SfxEnumItem(nId, (sal_uInt16)eStyle)
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxChartStyleItem::SvxChartStyleItem(SvStream& rIn, sal_uInt16 nId) :
+ SfxEnumItem(nId, rIn)
+{
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxChartStyleItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new SvxChartStyleItem(*this);
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxChartStyleItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new SvxChartStyleItem(rIn, Which());
+}
+
+/*************************************************************************
+|*
+|* SvxChartDataDescrItem
+|*
+*************************************************************************/
+
+SvxChartDataDescrItem::SvxChartDataDescrItem(SvxChartDataDescr eDataDescr,
+ sal_uInt16 nId) :
+ SfxEnumItem(nId, (sal_uInt16)eDataDescr)
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxChartDataDescrItem::SvxChartDataDescrItem(SvStream& rIn, sal_uInt16 nId) :
+ SfxEnumItem(nId, rIn)
+{
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxChartDataDescrItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new SvxChartDataDescrItem(*this);
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxChartDataDescrItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new SvxChartDataDescrItem(rIn, Which());
+}
+
+/*************************************************************************
+|*
+|* SvxChartLegendPosItem
+|*
+*************************************************************************/
+
+SvxChartLegendPosItem::SvxChartLegendPosItem(SvxChartLegendPos eLegendPos,
+ sal_uInt16 nId) :
+ SfxEnumItem(nId, (sal_uInt16)eLegendPos)
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxChartLegendPosItem::SvxChartLegendPosItem(SvStream& rIn, sal_uInt16 nId) :
+ SfxEnumItem(nId, rIn)
+{
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxChartLegendPosItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new SvxChartLegendPosItem(*this);
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxChartLegendPosItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new SvxChartLegendPosItem(rIn, Which());
+}
+
+/*************************************************************************
+|*
+|* SvxChartTextOrderItem
+|*
+*************************************************************************/
+
+SvxChartTextOrderItem::SvxChartTextOrderItem(SvxChartTextOrder eOrder,
+ sal_uInt16 nId) :
+ SfxEnumItem(nId, (sal_uInt16)eOrder)
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxChartTextOrderItem::SvxChartTextOrderItem(SvStream& rIn, sal_uInt16 nId) :
+ SfxEnumItem(nId, rIn)
+{
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxChartTextOrderItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new SvxChartTextOrderItem(*this);
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxChartTextOrderItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new SvxChartTextOrderItem(rIn, Which());
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxChartTextOrderItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
+{
+ // the order of the two enums is not equal, so a mapping is required
+ ::com::sun::star::chart::ChartAxisArrangeOrderType eAO;
+ SvxChartTextOrder eOrder( GetValue());
+
+ switch( eOrder )
+ {
+ case CHTXTORDER_SIDEBYSIDE:
+ eAO = ::com::sun::star::chart::ChartAxisArrangeOrderType_SIDE_BY_SIDE; break;
+ case CHTXTORDER_UPDOWN:
+ eAO = ::com::sun::star::chart::ChartAxisArrangeOrderType_STAGGER_ODD; break;
+ case CHTXTORDER_DOWNUP:
+ eAO = ::com::sun::star::chart::ChartAxisArrangeOrderType_STAGGER_EVEN; break;
+ case CHTXTORDER_AUTO:
+ eAO = ::com::sun::star::chart::ChartAxisArrangeOrderType_AUTO; break;
+ }
+
+ rVal <<= eAO;
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxChartTextOrderItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
+{
+ // the order of the two enums is not equal, so a mapping is required
+ ::com::sun::star::chart::ChartAxisArrangeOrderType eAO;
+ SvxChartTextOrder eOrder;
+
+ if(!(rVal >>= eAO))
+ {
+ // also try an int (for Basic)
+ sal_Int32 nAO = 0;
+ if(!(rVal >>= nAO))
+ return sal_False;
+ eAO = static_cast< ::com::sun::star::chart::ChartAxisArrangeOrderType >( nAO );
+ }
+
+ switch( eAO )
+ {
+ case ::com::sun::star::chart::ChartAxisArrangeOrderType_SIDE_BY_SIDE:
+ eOrder = CHTXTORDER_SIDEBYSIDE; break;
+ case ::com::sun::star::chart::ChartAxisArrangeOrderType_STAGGER_ODD:
+ eOrder = CHTXTORDER_UPDOWN; break;
+ case ::com::sun::star::chart::ChartAxisArrangeOrderType_STAGGER_EVEN:
+ eOrder = CHTXTORDER_DOWNUP; break;
+ case ::com::sun::star::chart::ChartAxisArrangeOrderType_AUTO:
+ eOrder = CHTXTORDER_AUTO; break;
+ default:
+ return sal_False;
+ }
+
+ SetValue( (sal_uInt16)eOrder );
+
+ return sal_True;
+}
+
+/*************************************************************************
+|*
+|* SvxChartTextOrientItem
+|*
+*************************************************************************/
+
+SvxChartTextOrientItem::SvxChartTextOrientItem(SvxChartTextOrient eOrient,
+ sal_uInt16 nId) :
+ SfxEnumItem(nId, (sal_uInt16)eOrient)
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxChartTextOrientItem::SvxChartTextOrientItem(SvStream& rIn, sal_uInt16 nId) :
+ SfxEnumItem(nId, rIn)
+{
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxChartTextOrientItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new SvxChartTextOrientItem(*this);
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxChartTextOrientItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new SvxChartTextOrientItem(rIn, Which());
+}
+
+/*************************************************************************
+|*
+|* SvxDoubleItem
+|*
+*************************************************************************/
+
+SvxDoubleItem::SvxDoubleItem(double fValue, sal_uInt16 nId) :
+ SfxPoolItem(nId),
+ fVal(fValue)
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxDoubleItem::SvxDoubleItem(SvStream& rIn, sal_uInt16 nId) :
+ SfxPoolItem(nId)
+{
+ rIn >> fVal;
+}
+
+// -----------------------------------------------------------------------
+
+SvxDoubleItem::SvxDoubleItem(const SvxDoubleItem& rItem) :
+ SfxPoolItem(rItem),
+ fVal(rItem.fVal)
+{
+}
+
+// -----------------------------------------------------------------------
+
+XubString SvxDoubleItem::GetValueText() const
+{
+ rtl::OString aOStr( rtl::math::doubleToString( fVal, rtl_math_StringFormat_E, 4, '.', false ) );
+ return String( aOStr.getStr(), (sal_uInt16)aOStr.getLength() );
+}
+
+// -----------------------------------------------------------------------
+
+SfxItemPresentation SvxDoubleItem::GetPresentation
+ ( SfxItemPresentation /*ePresentation*/, SfxMapUnit /*eCoreMetric*/,
+ SfxMapUnit /*ePresentationMetric*/, XubString& rText,
+ const IntlWrapper * pIntlWrapper) const
+{
+ DBG_ASSERT( pIntlWrapper, "SvxDoubleItem::GetPresentation: no IntlWrapper" );
+ if ( pIntlWrapper )
+ {
+ rText = ::rtl::math::doubleToUString( fVal, rtl_math_StringFormat_E, 4,
+ pIntlWrapper->getLocaleData()->getNumDecimalSep().GetChar(0), true );
+ }
+ else
+ rText = GetValueText();
+ return SFX_ITEM_PRESENTATION_NAMELESS;
+}
+
+// -----------------------------------------------------------------------
+
+int SvxDoubleItem::operator == (const SfxPoolItem& rItem) const
+{
+ return (((SvxDoubleItem&)rItem).fVal == fVal);
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxDoubleItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new SvxDoubleItem(*this);
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxDoubleItem::Create(SvStream& rIn, sal_uInt16 /*nVersion*/) const
+{
+ double _fVal;
+ rIn >> _fVal;
+ return new SvxDoubleItem(_fVal, Which());
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SvxDoubleItem::Store(SvStream& rOut, sal_uInt16 /*nItemVersion*/) const
+{
+ rOut << fVal;
+ return rOut;
+}
+
+// -----------------------------------------------------------------------
+
+double SvxDoubleItem::GetMin() const
+{
+ return DBL_MIN;
+}
+
+// -----------------------------------------------------------------------
+
+double SvxDoubleItem::GetMax() const
+{
+ return DBL_MAX;
+}
+
+// -----------------------------------------------------------------------
+
+SfxFieldUnit SvxDoubleItem::GetUnit() const
+{
+ return SFX_FUNIT_NONE;
+}
+
+
+
+
+// -----------------------------------------------------------------------
+sal_Bool SvxDoubleItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
+{
+ rVal <<= fVal;
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------
+sal_Bool SvxDoubleItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
+{
+ return rVal >>= fVal;
+}
+
+
+
+/*************************************************************************
+|*
+|* SvxChartKindErrorItem
+|*
+*************************************************************************/
+
+SvxChartKindErrorItem::SvxChartKindErrorItem(SvxChartKindError eOrient,
+ sal_uInt16 nId) :
+ SfxEnumItem(nId, (sal_uInt16)eOrient)
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxChartKindErrorItem::SvxChartKindErrorItem(SvStream& rIn, sal_uInt16 nId) :
+ SfxEnumItem(nId, rIn)
+{
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxChartKindErrorItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new SvxChartKindErrorItem(*this);
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxChartKindErrorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new SvxChartKindErrorItem(rIn, Which());
+}
+
+// -----------------------------------------------------------------------
+
+sal_uInt16 SvxChartKindErrorItem::GetVersion (sal_uInt16 nFileFormatVersion) const
+{
+ return (nFileFormatVersion == SOFFICE_FILEFORMAT_31)
+ ? USHRT_MAX
+ : 0;
+}
+
+/*************************************************************************
+|*
+|* SvxChartIndicateItem
+|*
+*************************************************************************/
+
+SvxChartIndicateItem::SvxChartIndicateItem(SvxChartIndicate eOrient,
+ sal_uInt16 nId) :
+ SfxEnumItem(nId, (sal_uInt16)eOrient)
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxChartIndicateItem::SvxChartIndicateItem(SvStream& rIn, sal_uInt16 nId) :
+ SfxEnumItem(nId, rIn)
+{
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxChartIndicateItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new SvxChartIndicateItem(*this);
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxChartIndicateItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new SvxChartIndicateItem(rIn, Which());
+}
+
+// -----------------------------------------------------------------------
+
+sal_uInt16 SvxChartIndicateItem::GetVersion (sal_uInt16 nFileFormatVersion) const
+{
+ return (nFileFormatVersion == SOFFICE_FILEFORMAT_31)
+ ? USHRT_MAX
+ : 0;
+}
+
+/*************************************************************************
+|*
+|* SvxChartRegressItem
+|*
+*************************************************************************/
+
+SvxChartRegressItem::SvxChartRegressItem(SvxChartRegress eOrient,
+ sal_uInt16 nId) :
+ SfxEnumItem(nId, (sal_uInt16)eOrient)
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxChartRegressItem::SvxChartRegressItem(SvStream& rIn, sal_uInt16 nId) :
+ SfxEnumItem(nId, rIn)
+{
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxChartRegressItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new SvxChartRegressItem(*this);
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxChartRegressItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new SvxChartRegressItem(rIn, Which());
+}
+
+// -----------------------------------------------------------------------
+
+sal_uInt16 SvxChartRegressItem::GetVersion (sal_uInt16 nFileFormatVersion) const
+{
+ return (nFileFormatVersion == SOFFICE_FILEFORMAT_31)
+ ? USHRT_MAX
+ : 0;
+}
+
+
diff --git a/svx/source/items/clipfmtitem.cxx b/svx/source/items/clipfmtitem.cxx
new file mode 100644
index 000000000000..f65c9bbf6df4
--- /dev/null
+++ b/svx/source/items/clipfmtitem.cxx
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#define _SVSTDARR_ULONGS
+#define _SVSTDARR_STRINGSDTOR
+
+#include <svl/svstdarr.hxx>
+#include <svx/clipfmtitem.hxx>
+#include <com/sun/star/frame/status/ClipboardFormats.hpp>
+
+struct SvxClipboardFmtItem_Impl
+{
+ SvStringsDtor aFmtNms;
+ SvULongs aFmtIds;
+ static String sEmptyStr;
+
+ SvxClipboardFmtItem_Impl() : aFmtNms( 8, 8 ), aFmtIds( 8, 8 ) {}
+ SvxClipboardFmtItem_Impl( const SvxClipboardFmtItem_Impl& );
+};
+
+String SvxClipboardFmtItem_Impl::sEmptyStr;
+
+TYPEINIT1_FACTORY( SvxClipboardFmtItem, SfxPoolItem , new SvxClipboardFmtItem(0));
+
+SvxClipboardFmtItem_Impl::SvxClipboardFmtItem_Impl(
+ const SvxClipboardFmtItem_Impl& rCpy )
+{
+ aFmtIds.Insert( &rCpy.aFmtIds, 0 );
+ for( sal_uInt16 n = 0, nEnd = rCpy.aFmtNms.Count(); n < nEnd; ++n )
+ {
+ String* pStr = rCpy.aFmtNms[ n ];
+ if( pStr )
+ pStr = new String( *pStr );
+ aFmtNms.Insert( pStr, n );
+ }
+}
+
+SvxClipboardFmtItem::SvxClipboardFmtItem( sal_uInt16 nId )
+ : SfxPoolItem( nId ), pImpl( new SvxClipboardFmtItem_Impl )
+{
+}
+
+SvxClipboardFmtItem::SvxClipboardFmtItem( const SvxClipboardFmtItem& rCpy )
+ : SfxPoolItem( rCpy.Which() ),
+ pImpl( new SvxClipboardFmtItem_Impl( *rCpy.pImpl ) )
+{
+}
+
+SvxClipboardFmtItem::~SvxClipboardFmtItem()
+{
+ delete pImpl;
+}
+
+sal_Bool SvxClipboardFmtItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
+{
+ sal_uInt16 nCount = Count();
+
+ ::com::sun::star::frame::status::ClipboardFormats aClipFormats;
+
+ aClipFormats.Identifiers.realloc( nCount );
+ aClipFormats.Names.realloc( nCount );
+ for ( sal_uInt16 n=0; n < nCount; n++ )
+ {
+ aClipFormats.Identifiers[n] = (sal_Int64)GetClipbrdFormatId( n );
+ aClipFormats.Names[n] = GetClipbrdFormatName( n );
+ }
+
+ rVal <<= aClipFormats;
+ return sal_True;
+}
+
+sal_Bool SvxClipboardFmtItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
+{
+ ::com::sun::star::frame::status::ClipboardFormats aClipFormats;
+ if ( rVal >>= aClipFormats )
+ {
+ sal_uInt16 nCount = sal_uInt16( aClipFormats.Identifiers.getLength() );
+
+ pImpl->aFmtIds.Remove( 0, pImpl->aFmtIds.Count() );
+ pImpl->aFmtNms.Remove( 0, pImpl->aFmtNms.Count() );
+ for ( sal_uInt16 n=0; n < nCount; n++ )
+ AddClipbrdFormat( sal_uIntPtr( aClipFormats.Identifiers[n] ), aClipFormats.Names[n], n );
+
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+int SvxClipboardFmtItem::operator==( const SfxPoolItem& rComp ) const
+{
+ int nRet = 0;
+ const SvxClipboardFmtItem& rCmp = (SvxClipboardFmtItem&)rComp;
+ if( rCmp.pImpl->aFmtNms.Count() == pImpl->aFmtNms.Count() )
+ {
+ nRet = 1;
+ const String* pStr1, *pStr2;
+ for( sal_uInt16 n = 0, nEnd = rCmp.pImpl->aFmtNms.Count(); n < nEnd; ++n )
+ {
+ if( pImpl->aFmtIds[ n ] != rCmp.pImpl->aFmtIds[ n ] ||
+ ( (0 == ( pStr1 = pImpl->aFmtNms[ n ] )) ^
+ (0 == ( pStr2 = rCmp.pImpl->aFmtNms[ n ] ) )) ||
+ ( pStr1 && *pStr1 != *pStr2 ))
+ {
+ nRet = 0;
+ break;
+ }
+ }
+ }
+ return nRet;
+}
+
+SfxPoolItem* SvxClipboardFmtItem::Clone( SfxItemPool * /*pPool*/ ) const
+{
+ return new SvxClipboardFmtItem( *this );
+}
+
+void SvxClipboardFmtItem::AddClipbrdFormat( sal_uIntPtr nId, sal_uInt16 nPos )
+{
+ if( nPos > pImpl->aFmtNms.Count() )
+ nPos = pImpl->aFmtNms.Count();
+ String* pStr = 0;
+ pImpl->aFmtNms.Insert( pStr, nPos );
+ pImpl->aFmtIds.Insert( nId, nPos );
+}
+
+void SvxClipboardFmtItem::AddClipbrdFormat( sal_uIntPtr nId, const String& rName,
+ sal_uInt16 nPos )
+{
+ if( nPos > pImpl->aFmtNms.Count() )
+ nPos = pImpl->aFmtNms.Count();
+ String* pStr = new String( rName );
+ pImpl->aFmtNms.Insert( pStr, nPos );
+ pImpl->aFmtIds.Insert( nId, nPos );
+}
+
+sal_uInt16 SvxClipboardFmtItem::Count() const
+{
+ return pImpl->aFmtIds.Count();
+}
+
+sal_uIntPtr SvxClipboardFmtItem::GetClipbrdFormatId( sal_uInt16 nPos ) const
+{
+ return pImpl->aFmtIds[ nPos ];
+}
+
+const String& SvxClipboardFmtItem::GetClipbrdFormatName( sal_uInt16 nPos ) const
+{
+ const String* pS = pImpl->aFmtNms[ nPos ];
+ return pS ? *pS : SvxClipboardFmtItem_Impl::sEmptyStr;
+}
+
+
diff --git a/svx/source/items/customshapeitem.cxx b/svx/source/items/customshapeitem.cxx
new file mode 100644
index 000000000000..b6d24a16ee55
--- /dev/null
+++ b/svx/source/items/customshapeitem.cxx
@@ -0,0 +1,386 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdasitm.hxx>
+#include <svx/svdattr.hxx>
+
+using namespace ::std;
+using namespace com::sun::star;
+
+SdrCustomShapeEngineItem::SdrCustomShapeEngineItem()
+: SfxStringItem( SDRATTR_CUSTOMSHAPE_ENGINE, String() )
+{}
+SdrCustomShapeEngineItem::SdrCustomShapeEngineItem( const String& rVal )
+: SfxStringItem( SDRATTR_CUSTOMSHAPE_ENGINE, rVal )
+{}
+
+SdrCustomShapeDataItem::SdrCustomShapeDataItem()
+: SfxStringItem( SDRATTR_CUSTOMSHAPE_DATA, String() )
+{}
+SdrCustomShapeDataItem::SdrCustomShapeDataItem( const String& rVal )
+: SfxStringItem( SDRATTR_CUSTOMSHAPE_DATA, rVal )
+{}
+
+bool SdrCustomShapeGeometryItem::PropertyEq::operator()( const rtl::OUString& r1, const rtl::OUString& r2 ) const
+{
+ return r1.equals( r2 );
+}
+bool SdrCustomShapeGeometryItem::PropertyPairEq::operator()( const SdrCustomShapeGeometryItem::PropertyPair& r1, const SdrCustomShapeGeometryItem::PropertyPair& r2 ) const
+{
+ return ( r1.first.equals( r2.first ) ) && ( r1.second.equals( r2.second ) );
+}
+size_t SdrCustomShapeGeometryItem::PropertyPairHash::operator()( const SdrCustomShapeGeometryItem::PropertyPair &r1 ) const
+{
+ return (size_t)r1.first.hashCode() + r1.second.hashCode();
+};
+
+TYPEINIT1_FACTORY( SdrCustomShapeGeometryItem, SfxPoolItem , new SdrCustomShapeGeometryItem);
+SdrCustomShapeGeometryItem::SdrCustomShapeGeometryItem()
+: SfxPoolItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )
+{}
+SdrCustomShapeGeometryItem::SdrCustomShapeGeometryItem( const uno::Sequence< beans::PropertyValue >& rVal )
+: SfxPoolItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )
+{
+ sal_Int32 i, j;
+ aPropSeq = rVal;
+
+ // hashing property values
+// beans::PropertyValue* pPropValues = aPropSeq.getArray();
+// const rtl::OUString* pPtr = NULL;
+ for ( i = 0; i < aPropSeq.getLength(); i++ )
+ {
+ beans::PropertyValue& rPropVal = aPropSeq[ i ];
+ aPropHashMap[ rPropVal.Name ] = i;
+ if ( rPropVal.Value.getValueType() == ::getCppuType((const ::com::sun::star::uno::Sequence < beans::PropertyValue >*)0) )
+ {
+ uno::Sequence< beans::PropertyValue >& rPropSeq = *( uno::Sequence< beans::PropertyValue >*)rPropVal.Value.getValue();
+ for ( j = 0; j < rPropSeq.getLength(); j++ )
+ {
+ beans::PropertyValue& rPropVal2 = rPropSeq[ j ];
+ aPropPairHashMap[ PropertyPair( rPropVal.Name, rPropVal2.Name ) ] = j;
+ }
+ }
+ }
+}
+
+com::sun::star::uno::Any* SdrCustomShapeGeometryItem::GetPropertyValueByName( const rtl::OUString& rPropName )
+{
+ com::sun::star::uno::Any* pRet = NULL;
+ PropertyHashMap::iterator aHashIter( aPropHashMap.find( rPropName ) );
+ if ( aHashIter != aPropHashMap.end() )
+ pRet = &aPropSeq[ (*aHashIter).second ].Value;
+ return pRet;
+}
+
+com::sun::star::uno::Any* SdrCustomShapeGeometryItem::GetPropertyValueByName( const rtl::OUString& rSequenceName, const rtl::OUString& rPropName )
+{
+ com::sun::star::uno::Any* pRet = NULL;
+ com::sun::star::uno::Any* pSeqAny = GetPropertyValueByName( rSequenceName );
+ if ( pSeqAny )
+ {
+ if ( pSeqAny->getValueType() == ::getCppuType((const ::com::sun::star::uno::Sequence < beans::PropertyValue >*)0) )
+ {
+ PropertyPairHashMap::iterator aHashIter( aPropPairHashMap.find( PropertyPair( rSequenceName, rPropName ) ) );
+ if ( aHashIter != aPropPairHashMap.end() )
+ {
+ ::com::sun::star::uno::Sequence < beans::PropertyValue >& rSecSequence =
+ *((::com::sun::star::uno::Sequence < beans::PropertyValue >*)pSeqAny->getValue());
+ pRet = &rSecSequence[ (*aHashIter).second ].Value;
+ }
+ }
+ }
+ return pRet;
+}
+
+void SdrCustomShapeGeometryItem::SetPropertyValue( const com::sun::star::beans::PropertyValue& rPropVal )
+{
+ com::sun::star::uno::Any* pAny = GetPropertyValueByName( rPropVal.Name );
+ if ( pAny )
+ { // property is already available
+ sal_Int32 i;
+ if ( pAny->getValueType() == ::getCppuType((const ::com::sun::star::uno::Sequence < beans::PropertyValue >*)0) )
+ { // old property is a sequence->each entry has to be removed from the HashPairMap
+ ::com::sun::star::uno::Sequence < beans::PropertyValue >& rSecSequence =
+ *((::com::sun::star::uno::Sequence < beans::PropertyValue >*)pAny->getValue());
+ for ( i = 0; i < rSecSequence.getLength(); i++ )
+ {
+ PropertyPairHashMap::iterator aHashIter( aPropPairHashMap.find( PropertyPair( rPropVal.Name, rSecSequence[ i ].Name ) ) );
+ if ( aHashIter != aPropPairHashMap.end() )
+ aPropPairHashMap.erase( aHashIter );
+ }
+ }
+ *pAny = rPropVal.Value;
+ if ( rPropVal.Value.getValueType() == ::getCppuType((const ::com::sun::star::uno::Sequence < beans::PropertyValue >*)0) )
+ { // the new property is a sequence->each entry has to be inserted into the HashPairMap
+ ::com::sun::star::uno::Sequence < beans::PropertyValue >& rSecSequence =
+ *((::com::sun::star::uno::Sequence < beans::PropertyValue >*)pAny->getValue());
+ for ( i = 0; i < rSecSequence.getLength(); i++ )
+ {
+ beans::PropertyValue& rPropVal2 = rSecSequence[ i ];
+ aPropPairHashMap[ PropertyPair( rPropVal.Name, rPropVal2.Name ) ] = i;
+ }
+ }
+ }
+ else
+ { // its a new property
+ sal_uInt32 nIndex = aPropSeq.getLength();
+ aPropSeq.realloc( nIndex + 1 );
+ aPropSeq[ nIndex ] = rPropVal ;
+
+ aPropHashMap[ rPropVal.Name ] = nIndex;
+ }
+}
+
+void SdrCustomShapeGeometryItem::SetPropertyValue( const rtl::OUString& rSequenceName, const com::sun::star::beans::PropertyValue& rPropVal )
+{
+ com::sun::star::uno::Any* pAny = GetPropertyValueByName( rSequenceName, rPropVal.Name );
+ if ( pAny ) // just replacing
+ *pAny = rPropVal.Value;
+ else
+ {
+ com::sun::star::uno::Any* pSeqAny = GetPropertyValueByName( rSequenceName );
+ if( pSeqAny == NULL )
+ {
+ ::com::sun::star::uno::Sequence < beans::PropertyValue > aSeq;
+ beans::PropertyValue aValue;
+ aValue.Name = rSequenceName;
+ aValue.Value = ::com::sun::star::uno::makeAny( aSeq );
+
+ sal_uInt32 nIndex = aPropSeq.getLength();
+ aPropSeq.realloc( nIndex + 1 );
+ aPropSeq[ nIndex ] = aValue;
+ aPropHashMap[ rSequenceName ] = nIndex;
+
+ pSeqAny = &aPropSeq[ nIndex ].Value;
+ }
+
+ DBG_ASSERT( pSeqAny, "SdrCustomShapeGeometryItem::SetPropertyValue() - No Value??" );
+
+ if( pSeqAny )
+ {
+ if ( pSeqAny->getValueType() == ::getCppuType((const ::com::sun::star::uno::Sequence < beans::PropertyValue >*)0) )
+ {
+ PropertyPairHashMap::iterator aHashIter( aPropPairHashMap.find( PropertyPair( rSequenceName, rPropVal.Name ) ) );
+ if ( aHashIter != aPropPairHashMap.end() )
+ {
+ ::com::sun::star::uno::Sequence < beans::PropertyValue >& rSecSequence =
+ *((::com::sun::star::uno::Sequence < beans::PropertyValue >*)pSeqAny->getValue());
+ rSecSequence[ (*aHashIter).second ].Value = rPropVal.Value;
+ }
+ else
+ {
+ ::com::sun::star::uno::Sequence < beans::PropertyValue >& rSecSequence =
+ *((::com::sun::star::uno::Sequence < beans::PropertyValue >*)pSeqAny->getValue());
+
+ sal_Int32 nCount = rSecSequence.getLength();
+ rSecSequence.realloc( nCount + 1 );
+ rSecSequence[ nCount ] = rPropVal;
+
+ aPropPairHashMap[ PropertyPair( rSequenceName, rPropVal.Name ) ] = nCount;
+ }
+ }
+ }
+ }
+}
+
+void SdrCustomShapeGeometryItem::ClearPropertyValue( const rtl::OUString& rPropName )
+{
+ if ( aPropSeq.getLength() )
+ {
+ PropertyHashMap::iterator aHashIter( aPropHashMap.find( rPropName ) );
+ if ( aHashIter != aPropHashMap.end() )
+ {
+ com::sun::star::uno::Any* pSeqAny = &aPropSeq[ (*aHashIter).second ].Value;
+ if ( pSeqAny )
+ {
+ if ( pSeqAny->getValueType() == ::getCppuType((const ::com::sun::star::uno::Sequence < beans::PropertyValue >*)0) )
+ {
+ ::com::sun::star::uno::Sequence < beans::PropertyValue >& rSecSequence =
+ *((::com::sun::star::uno::Sequence < beans::PropertyValue >*)pSeqAny->getValue());
+
+ sal_Int32 i;
+ for ( i = 0; i < rSecSequence.getLength(); i++ )
+ {
+ PropertyPairHashMap::iterator _aHashIter( aPropPairHashMap.find( PropertyPair( rPropName, rSecSequence[ i ].Name ) ) );
+ if ( _aHashIter != aPropPairHashMap.end() )
+ aPropPairHashMap.erase( _aHashIter ); // removing property from pair hashmap
+ }
+ }
+ }
+ sal_Int32 nLength = aPropSeq.getLength();
+ if ( nLength )
+ {
+ sal_Int32 nIndex = (*aHashIter).second;
+ if ( nIndex != ( nLength - 1 ) ) // resizing sequence
+ {
+ PropertyHashMap::iterator aHashIter2( aPropHashMap.find( aPropSeq[ nLength - 1 ].Name ) );
+ (*aHashIter2).second = nIndex;
+ aPropSeq[ (*aHashIter).second ] = aPropSeq[ aPropSeq.getLength() - 1 ];
+ }
+ aPropSeq.realloc( aPropSeq.getLength() - 1 );
+ }
+ aPropHashMap.erase( aHashIter ); // removing property from hashmap
+ }
+ }
+}
+
+void SdrCustomShapeGeometryItem::ClearPropertyValue( const rtl::OUString& rSequenceName, const rtl::OUString& rPropName )
+{
+ com::sun::star::uno::Any* pSeqAny = GetPropertyValueByName( rSequenceName );
+ if ( pSeqAny )
+ {
+ if ( pSeqAny->getValueType() == ::getCppuType((const ::com::sun::star::uno::Sequence < beans::PropertyValue >*)0) )
+ {
+ PropertyPairHashMap::iterator aHashIter( aPropPairHashMap.find( PropertyPair( rSequenceName, rPropName ) ) );
+ if ( aHashIter != aPropPairHashMap.end() )
+ {
+ ::com::sun::star::uno::Sequence < beans::PropertyValue >& rSecSequence =
+ *((::com::sun::star::uno::Sequence < beans::PropertyValue >*)pSeqAny->getValue());
+
+ sal_Int32 nLength = rSecSequence.getLength();
+ if ( nLength )
+ {
+ sal_Int32 nIndex = (*aHashIter).second;
+ if ( nIndex != ( nLength - 1 ) ) // resizing sequence
+ {
+ PropertyPairHashMap::iterator aHashIter2( aPropPairHashMap.find( PropertyPair( rSequenceName, rSecSequence[ nLength - 1 ].Name ) ) );
+ (*aHashIter2).second = nIndex;
+ rSecSequence[ nIndex ] = rSecSequence[ nLength - 1 ];
+ }
+ rSecSequence.realloc( aPropSeq.getLength() - 1 );
+ }
+ aPropPairHashMap.erase( aHashIter );
+ }
+ }
+ }
+}
+
+SdrCustomShapeGeometryItem::~SdrCustomShapeGeometryItem()
+{
+}
+SdrCustomShapeGeometryItem::SdrCustomShapeGeometryItem( SvStream& /*rIn*/, sal_uInt16 nVersion ):
+ SfxPoolItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )
+{
+ if ( nVersion )
+ {
+
+ }
+}
+int __EXPORT SdrCustomShapeGeometryItem::operator==( const SfxPoolItem& rCmp ) const
+{
+ int bRet = SfxPoolItem::operator==( rCmp );
+ if ( bRet )
+ bRet = ((SdrCustomShapeGeometryItem&)rCmp).aPropSeq == aPropSeq;
+ return bRet;
+}
+
+SfxItemPresentation __EXPORT SdrCustomShapeGeometryItem::GetPresentation(
+ SfxItemPresentation ePresentation, SfxMapUnit /*eCoreMetric*/,
+ SfxMapUnit /*ePresentationMetric*/, XubString &rText, const IntlWrapper *) const
+{
+ rText += sal_Unicode( ' ' );
+ if ( ePresentation == SFX_ITEM_PRESENTATION_COMPLETE )
+ {
+ XubString aStr;
+// SdrItemPool::TakeItemName( Which(), aStr );
+ aStr += sal_Unicode( ' ' );
+ rText.Insert( aStr, 0 );
+ }
+ return ePresentation;
+}
+
+SfxPoolItem* __EXPORT SdrCustomShapeGeometryItem::Create( SvStream& rIn, sal_uInt16 nItemVersion ) const
+{
+ return new SdrCustomShapeGeometryItem( rIn, nItemVersion );
+}
+
+SvStream& __EXPORT SdrCustomShapeGeometryItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
+{
+ if ( nItemVersion )
+ {
+
+ }
+ return rOut;
+}
+
+SfxPoolItem* __EXPORT SdrCustomShapeGeometryItem::Clone( SfxItemPool * /*pPool*/ ) const
+{
+ SdrCustomShapeGeometryItem* pItem = new SdrCustomShapeGeometryItem( GetGeometry() );
+// SdrCustomShapeGeometryItem* pItem = new SdrCustomShapeGeometryItem( *this );
+
+/*
+ for ( i = 0; i < GetCount(); i++ )
+ {
+ const SdrCustomShapeAdjustmentValue& rVal = GetValue( i );
+ pItem->SetValue( i, rVal );
+ }
+*/
+ return pItem;
+}
+
+#ifdef SDR_ISPOOLABLE
+int __EXPORT SdrCustomShapeGeometryItem::IsPoolable() const
+{
+ sal_uInt16 nId=Which();
+ return nId < SDRATTR_NOTPERSIST_FIRST || nId > SDRATTR_NOTPERSIST_LAST;
+}
+#endif
+sal_uInt16 SdrCustomShapeGeometryItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/ ) const
+{
+ return 1;
+}
+sal_Bool SdrCustomShapeGeometryItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
+{
+ rVal <<= aPropSeq;
+ return sal_True;
+}
+sal_Bool SdrCustomShapeGeometryItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
+{
+ if ( ! ( rVal >>= aPropSeq ) )
+ return sal_False;
+ else
+ return sal_True;
+}
+const uno::Sequence< beans::PropertyValue >& SdrCustomShapeGeometryItem::GetGeometry() const
+{
+ return aPropSeq;
+}
+/*
+const uno::Any* GetValueByName( const rtl::OUString& rProperty ) const
+{
+
+}
+*/
+SdrCustomShapeReplacementURLItem::SdrCustomShapeReplacementURLItem()
+: SfxStringItem( SDRATTR_CUSTOMSHAPE_REPLACEMENT_URL, String() )
+{}
+SdrCustomShapeReplacementURLItem::SdrCustomShapeReplacementURLItem( const String& rVal )
+: SfxStringItem( SDRATTR_CUSTOMSHAPE_REPLACEMENT_URL, rVal )
+{}
+
diff --git a/svx/source/items/drawitem.cxx b/svx/source/items/drawitem.cxx
new file mode 100644
index 000000000000..d2048a0f2644
--- /dev/null
+++ b/svx/source/items/drawitem.cxx
@@ -0,0 +1,557 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <svx/svxids.hrc>
+
+
+#include "svx/drawitem.hxx"
+#include <svx/xtable.hxx>
+
+using namespace ::com::sun::star;
+
+// -----------------------------------------------------------------------
+
+TYPEINIT1_FACTORY( SvxColorTableItem, SfxPoolItem , new SvxColorTableItem);
+TYPEINIT1_FACTORY( SvxGradientListItem, SfxPoolItem , new SvxGradientListItem);
+TYPEINIT1_FACTORY( SvxHatchListItem, SfxPoolItem , new SvxHatchListItem);
+TYPEINIT1_FACTORY( SvxBitmapListItem, SfxPoolItem , new SvxBitmapListItem);
+TYPEINIT1_FACTORY( SvxDashListItem, SfxPoolItem , new SvxDashListItem);
+TYPEINIT1_FACTORY( SvxLineEndListItem, SfxPoolItem , new SvxLineEndListItem);
+
+//==================================================================
+//
+// SvxColorTableItem
+//
+//==================================================================
+
+SvxColorTableItem::SvxColorTableItem()
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxColorTableItem::SvxColorTableItem( XColorTable* pTable, sal_uInt16 nW ) :
+ SfxPoolItem( nW ),
+ pColorTable( pTable )
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxColorTableItem::SvxColorTableItem( const SvxColorTableItem& rItem ) :
+ SfxPoolItem( rItem ),
+ pColorTable( rItem.pColorTable )
+{
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxColorTableItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+// -----------------------------------------------------------------------
+
+int SvxColorTableItem::operator==( const SfxPoolItem& rItem ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
+ return ( ( SvxColorTableItem& ) rItem).pColorTable == pColorTable;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxColorTableItem::Clone( SfxItemPool * ) const
+{
+ return new SvxColorTableItem( *this );
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxColorTableItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
+{
+ // This is only a quick helper to have UI support for these list items. Don't use
+ // this method to query for a valid UNO representation.
+ // Please ask CD if you want to change this.
+ sal_Int64 aValue = sal_Int64( (sal_uLong)pColorTable );
+ rVal = uno::makeAny( aValue );
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxColorTableItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
+{
+ // This is only a quick helper to have UI support for these list items. Don't use
+ // this method to query for a valid UNO representation.
+ // Please ask CD if you want to change this.
+ sal_Int64 aValue = 0;
+ if ( rVal >>= aValue )
+ {
+ pColorTable = (XColorTable *)(sal_uLong)aValue;
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+//==================================================================
+//
+// SvxGradientListItem
+//
+//==================================================================
+
+SvxGradientListItem::SvxGradientListItem()
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxGradientListItem::SvxGradientListItem( XGradientList* pList, sal_uInt16 nW ) :
+ SfxPoolItem( nW ),
+ pGradientList( pList )
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxGradientListItem::SvxGradientListItem( const SvxGradientListItem& rItem ) :
+ SfxPoolItem( rItem ),
+ pGradientList( rItem.pGradientList )
+{
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxGradientListItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+// -----------------------------------------------------------------------
+
+int SvxGradientListItem::operator==( const SfxPoolItem& rItem ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
+ return ( ( SvxGradientListItem& ) rItem).pGradientList == pGradientList;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxGradientListItem::Clone( SfxItemPool * ) const
+{
+ return new SvxGradientListItem( *this );
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxGradientListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
+{
+ // This is only a quick helper to have UI support for these list items. Don't use
+ // this method to query for a valid UNO representation.
+ // Please ask CD if you want to change this.
+ sal_Int64 aValue = sal_Int64( (sal_uLong)pGradientList );
+ rVal = uno::makeAny( aValue );
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxGradientListItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
+{
+ // This is only a quick helper to have UI support for these list items. Don't use
+ // this method to query for a valid UNO representation.
+ // Please ask CD if you want to change this.
+ sal_Int64 aValue = 0;
+ if ( rVal >>= aValue )
+ {
+ pGradientList = (XGradientList *)(sal_uLong)aValue;
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+//==================================================================
+//
+// SvxHatchListItem
+//
+//==================================================================
+
+SvxHatchListItem::SvxHatchListItem()
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxHatchListItem::SvxHatchListItem( XHatchList* pList, sal_uInt16 nW ) :
+ SfxPoolItem( nW ),
+ pHatchList( pList )
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxHatchListItem::SvxHatchListItem( const SvxHatchListItem& rItem ) :
+ SfxPoolItem( rItem ),
+ pHatchList( rItem.pHatchList )
+{
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxHatchListItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+// -----------------------------------------------------------------------
+
+int SvxHatchListItem::operator==( const SfxPoolItem& rItem ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
+ return ( ( SvxHatchListItem& ) rItem).pHatchList == pHatchList;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxHatchListItem::Clone( SfxItemPool * ) const
+{
+ return new SvxHatchListItem( *this );
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxHatchListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
+{
+ // This is only a quick helper to have UI support for these list items. Don't use
+ // this method to query for a valid UNO representation.
+ // Please ask CD if you want to change this.
+ sal_Int64 aValue = sal_Int64( (sal_uLong)pHatchList );
+ rVal = uno::makeAny( aValue );
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxHatchListItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
+{
+ // This is only a quick helper to have UI support for these list items. Don't use
+ // this method to query for a valid UNO representation.
+ // Please ask CD if you want to change this.
+ sal_Int64 aValue = 0;
+ if ( rVal >>= aValue )
+ {
+ pHatchList = (XHatchList *)(sal_uLong)aValue;
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+//==================================================================
+//
+// SvxBitmapListItem
+//
+//==================================================================
+
+SvxBitmapListItem::SvxBitmapListItem()
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxBitmapListItem::SvxBitmapListItem( XBitmapList* pList, sal_uInt16 nW ) :
+ SfxPoolItem( nW ),
+ pBitmapList( pList )
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxBitmapListItem::SvxBitmapListItem( const SvxBitmapListItem& rItem ) :
+ SfxPoolItem( rItem ),
+ pBitmapList( rItem.pBitmapList )
+{
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxBitmapListItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+// -----------------------------------------------------------------------
+
+int SvxBitmapListItem::operator==( const SfxPoolItem& rItem ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
+ return ( ( SvxBitmapListItem& ) rItem).pBitmapList == pBitmapList;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxBitmapListItem::Clone( SfxItemPool * ) const
+{
+ return new SvxBitmapListItem( *this );
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxBitmapListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
+{
+ // This is only a quick helper to have UI support for these list items. Don't use
+ // this method to query for a valid UNO representation.
+ // Please ask CD if you want to change this.
+ sal_Int64 aValue = sal_Int64( (sal_uLong)pBitmapList );
+ rVal = uno::makeAny( aValue );
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxBitmapListItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
+{
+ // This is only a quick helper to have UI support for these list items. Don't use
+ // this method to query for a valid UNO representation.
+ // Please ask CD if you want to change this.
+ sal_Int64 aValue = 0;
+ if ( rVal >>= aValue )
+ {
+ pBitmapList = (XBitmapList *)(sal_uLong)aValue;
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+
+//==================================================================
+//
+// SvxDashListItem
+//
+//==================================================================
+
+SvxDashListItem::SvxDashListItem() :
+ pDashList( 0 )
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxDashListItem::SvxDashListItem( XDashList* pList, sal_uInt16 nW ) :
+ SfxPoolItem( nW ),
+ pDashList( pList )
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxDashListItem::SvxDashListItem( const SvxDashListItem& rItem ) :
+ SfxPoolItem( rItem ),
+ pDashList( rItem.pDashList )
+{
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxDashListItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+// -----------------------------------------------------------------------
+
+int SvxDashListItem::operator==( const SfxPoolItem& rItem ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
+ return ( ( SvxDashListItem& ) rItem).pDashList == pDashList;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxDashListItem::Clone( SfxItemPool * ) const
+{
+ return new SvxDashListItem( *this );
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxDashListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
+{
+ // This is only a quick helper to have UI support for these list items. Don't use
+ // this method to query for a valid UNO representation.
+ sal_Int64 aValue = sal_Int64( (sal_uLong)pDashList );
+ rVal = uno::makeAny( aValue );
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxDashListItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
+{
+ // This is only a quick helper to have UI support for these list items. Don't use
+ // this method to query for a valid UNO representation.
+ sal_Int64 aValue = 0;
+ if ( rVal >>= aValue )
+ {
+ pDashList = (XDashList *)(sal_uLong)aValue;
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxDashListItem::SetDashList( XDashList* pList )
+{
+ pDashList = pList;
+}
+
+//==================================================================
+//
+// SvxLineEndListItem
+//
+//==================================================================
+
+SvxLineEndListItem::SvxLineEndListItem()
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxLineEndListItem::SvxLineEndListItem( XLineEndList* pList, sal_uInt16 nW ) :
+ SfxPoolItem( nW ),
+ pLineEndList( pList )
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxLineEndListItem::SvxLineEndListItem( const SvxLineEndListItem& rItem ) :
+ SfxPoolItem( rItem ),
+ pLineEndList( rItem.pLineEndList )
+{
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxLineEndListItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+// -----------------------------------------------------------------------
+
+int SvxLineEndListItem::operator==( const SfxPoolItem& rItem ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
+ return ( ( SvxLineEndListItem& ) rItem).pLineEndList == pLineEndList;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxLineEndListItem::Clone( SfxItemPool * ) const
+{
+ return new SvxLineEndListItem( *this );
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxLineEndListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
+{
+ // This is only a quick helper to have UI support for these list items. Don't use
+ // this method to query for a valid UNO representation.
+ sal_Int64 aValue = sal_Int64( (sal_uLong)pLineEndList );
+ rVal = uno::makeAny( aValue );
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxLineEndListItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
+{
+ // This is only a quick helper to have UI support for these list items. Don't use
+ // this method to query for a valid UNO representation.
+ sal_Int64 aValue = 0;
+ if ( rVal >>= aValue )
+ {
+ pLineEndList = (XLineEndList *)(sal_uLong)aValue;
+ return sal_True;
+ }
+
+ return sal_False;
+}
diff --git a/svx/source/items/e3ditem.cxx b/svx/source/items/e3ditem.cxx
new file mode 100644
index 000000000000..67c87606e04e
--- /dev/null
+++ b/svx/source/items/e3ditem.cxx
@@ -0,0 +1,170 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <tools/stream.hxx>
+
+#include <svx/e3ditem.hxx>
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+// STATIC DATA -----------------------------------------------------------
+
+DBG_NAMEEX(SvxB3DVectorItem)
+DBG_NAME(SvxB3DVectorItem)
+
+// -----------------------------------------------------------------------
+
+TYPEINIT1_FACTORY(SvxB3DVectorItem, SfxPoolItem, new SvxB3DVectorItem);
+
+// -----------------------------------------------------------------------
+
+SvxB3DVectorItem::SvxB3DVectorItem()
+{
+ DBG_CTOR(SvxB3DVectorItem, 0);
+}
+
+SvxB3DVectorItem::~SvxB3DVectorItem()
+{
+ DBG_DTOR(SvxB3DVectorItem, 0);
+}
+
+// -----------------------------------------------------------------------
+
+SvxB3DVectorItem::SvxB3DVectorItem( sal_uInt16 _nWhich, const basegfx::B3DVector& rVal ) :
+ SfxPoolItem( _nWhich ),
+ aVal( rVal )
+{
+ DBG_CTOR(SvxB3DVectorItem, 0);
+}
+
+// -----------------------------------------------------------------------
+
+SvxB3DVectorItem::SvxB3DVectorItem( sal_uInt16 _nWhich, SvStream& rStream ) :
+ SfxPoolItem( _nWhich )
+{
+ DBG_CTOR(SvxB3DVectorItem, 0);
+ double fValue;
+ rStream >> fValue; aVal.setX(fValue);
+ rStream >> fValue; aVal.setY(fValue);
+ rStream >> fValue; aVal.setZ(fValue);
+}
+
+// -----------------------------------------------------------------------
+
+SvxB3DVectorItem::SvxB3DVectorItem( const SvxB3DVectorItem& rItem ) :
+ SfxPoolItem( rItem ),
+ aVal( rItem.aVal )
+{
+ DBG_CTOR(SvxB3DVectorItem, 0);
+}
+
+// -----------------------------------------------------------------------
+
+int SvxB3DVectorItem::operator==( const SfxPoolItem &rItem ) const
+{
+ DBG_CHKTHIS(SvxB3DVectorItem, 0);
+ DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
+ return ((SvxB3DVectorItem&)rItem).aVal == aVal;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxB3DVectorItem::Clone( SfxItemPool* /*pPool*/ ) const
+{
+ DBG_CHKTHIS(SvxB3DVectorItem, 0);
+ return new SvxB3DVectorItem( *this );
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxB3DVectorItem::Create(SvStream &rStream, sal_uInt16 /*nVersion*/) const
+{
+ DBG_CHKTHIS(SvxB3DVectorItem, 0);
+ basegfx::B3DVector aStr;
+ double fValue;
+ rStream >> fValue; aStr.setX(fValue);
+ rStream >> fValue; aStr.setY(fValue);
+ rStream >> fValue; aStr.setZ(fValue);
+ return new SvxB3DVectorItem(Which(), aStr);
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SvxB3DVectorItem::Store(SvStream &rStream, sal_uInt16 /*nItemVersion*/) const
+{
+ DBG_CHKTHIS(SvxB3DVectorItem, 0);
+
+ // ## if (nItemVersion)
+ double fValue;
+ fValue = aVal.getX(); rStream << fValue;
+ fValue = aVal.getY(); rStream << fValue;
+ fValue = aVal.getZ(); rStream << fValue;
+
+ return rStream;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxB3DVectorItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
+{
+ drawing::Direction3D aDirection;
+
+ // Werte eintragen
+ aDirection.DirectionX = aVal.getX();
+ aDirection.DirectionY = aVal.getY();
+ aDirection.DirectionZ = aVal.getZ();
+
+ rVal <<= aDirection;
+ return( sal_True );
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxB3DVectorItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
+{
+ drawing::Direction3D aDirection;
+ if(!(rVal >>= aDirection))
+ return sal_False;
+
+ aVal.setX(aDirection.DirectionX);
+ aVal.setY(aDirection.DirectionY);
+ aVal.setZ(aDirection.DirectionZ);
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------
+
+sal_uInt16 SvxB3DVectorItem::GetVersion (sal_uInt16 nFileFormatVersion) const
+{
+ return (nFileFormatVersion == SOFFICE_FILEFORMAT_31) ? USHRT_MAX : 0;
+}
+
+// eof
diff --git a/svx/source/items/grfitem.cxx b/svx/source/items/grfitem.cxx
new file mode 100644
index 000000000000..50af1f8f9609
--- /dev/null
+++ b/svx/source/items/grfitem.cxx
@@ -0,0 +1,197 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+
+#include <tools/stream.hxx>
+#include <svx/grfcrop.hxx>
+#include <editeng/itemtype.hxx>
+#include <com/sun/star/text/GraphicCrop.hpp>
+
+using namespace ::com::sun::star;
+
+#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
+#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L))
+//TYPEINIT1_FACTORY( SvxGrfCrop, SfxPoolItem , new SvxGrfCrop(0))
+
+/******************************************************************************
+ * Implementierung class SwCropGrf
+ ******************************************************************************/
+
+SvxGrfCrop::SvxGrfCrop( sal_uInt16 nItemId )
+ : SfxPoolItem( nItemId ),
+ nLeft( 0 ), nRight( 0 ), nTop( 0 ), nBottom( 0 )
+{}
+
+SvxGrfCrop::SvxGrfCrop( sal_Int32 nL, sal_Int32 nR,
+ sal_Int32 nT, sal_Int32 nB, sal_uInt16 nItemId )
+ : SfxPoolItem( nItemId ),
+ nLeft( nL ), nRight( nR ), nTop( nT ), nBottom( nB )
+{}
+
+SvxGrfCrop::~SvxGrfCrop()
+{
+}
+
+int SvxGrfCrop::operator==( const SfxPoolItem& rAttr ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==( rAttr ), "not equal attributes" );
+ return nLeft == ((const SvxGrfCrop&)rAttr).GetLeft() &&
+ nRight == ((const SvxGrfCrop&)rAttr).GetRight() &&
+ nTop == ((const SvxGrfCrop&)rAttr).GetTop() &&
+ nBottom == ((const SvxGrfCrop&)rAttr).GetBottom();
+}
+
+/*
+SfxPoolItem* SvxGrfCrop::Clone( SfxItemPool* ) const
+{
+ return new SvxGrfCrop( *this );
+}
+*/
+
+/*
+sal_uInt16 SvxGrfCrop::GetVersion( sal_uInt16 nFFVer ) const
+{
+ DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+ SOFFICE_FILEFORMAT_40==nFFVer ||
+ SOFFICE_FILEFORMAT_NOW==nFFVer,
+ "SvxGrfCrop: exist a new fileformat?" );
+ return GRFCROP_VERSION_SWDEFAULT;
+}
+*/
+
+SfxPoolItem* SvxGrfCrop::Create( SvStream& rStrm, sal_uInt16 nVersion ) const
+{
+ sal_Int32 top, left, right, bottom;
+ rStrm >> top >> left >> right >> bottom;
+
+ if( GRFCROP_VERSION_SWDEFAULT == nVersion )
+ top = -top, bottom = -bottom, left = -left, right = -right;
+
+ SvxGrfCrop* pNew = (SvxGrfCrop*)Clone();
+ pNew->SetLeft( left );
+ pNew->SetRight( right );
+ pNew->SetTop( top );
+ pNew->SetBottom( bottom );
+ return pNew;
+}
+
+
+SvStream& SvxGrfCrop::Store( SvStream& rStrm, sal_uInt16 nVersion ) const
+{
+ sal_Int32 left = GetLeft(), right = GetRight(),
+ top = GetTop(), bottom = GetBottom();
+ if( GRFCROP_VERSION_SWDEFAULT == nVersion )
+ top = -top, bottom = -bottom, left = -left, right = -right;
+
+ rStrm << top << left << right << bottom;
+
+ return rStrm;
+}
+
+
+
+sal_Bool SvxGrfCrop::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+ sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+ text::GraphicCrop aRet;
+ aRet.Left = nLeft;
+ aRet.Right = nRight;
+ aRet.Top = nTop;
+ aRet.Bottom = nBottom;
+
+ if( bConvert )
+ {
+ aRet.Right = TWIP_TO_MM100(aRet.Right );
+ aRet.Top = TWIP_TO_MM100(aRet.Top );
+ aRet.Left = TWIP_TO_MM100(aRet.Left );
+ aRet.Bottom = TWIP_TO_MM100(aRet.Bottom);
+ }
+
+
+ rVal <<= aRet;
+ return sal_True;
+}
+
+sal_Bool SvxGrfCrop::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
+{
+ sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+ text::GraphicCrop aVal;
+
+ if(!(rVal >>= aVal))
+ return sal_False;
+ if( bConvert )
+ {
+ aVal.Right = MM100_TO_TWIP(aVal.Right );
+ aVal.Top = MM100_TO_TWIP(aVal.Top );
+ aVal.Left = MM100_TO_TWIP(aVal.Left );
+ aVal.Bottom = MM100_TO_TWIP(aVal.Bottom);
+ }
+
+ nLeft = aVal.Left ;
+ nRight = aVal.Right ;
+ nTop = aVal.Top ;
+ nBottom = aVal.Bottom;
+ return sal_True;
+}
+
+SfxItemPresentation SvxGrfCrop::GetPresentation(
+ SfxItemPresentation ePres, SfxMapUnit eCoreUnit, SfxMapUnit /*ePresUnit*/,
+ String &rText, const IntlWrapper* pIntl ) const
+{
+ rText.Erase();
+ switch( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ if( SFX_ITEM_PRESENTATION_COMPLETE == ePres )
+ {
+ ( rText.AssignAscii( "L: " )) += ::GetMetricText( GetLeft(),
+ eCoreUnit, SFX_MAPUNIT_MM, pIntl );
+ ( rText.AppendAscii( " R: " )) += ::GetMetricText( GetRight(),
+ eCoreUnit, SFX_MAPUNIT_MM, pIntl );
+ ( rText.AppendAscii( " T: " )) += ::GetMetricText( GetTop(),
+ eCoreUnit, SFX_MAPUNIT_MM, pIntl );
+ ( rText.AppendAscii( " B: " )) += ::GetMetricText( GetBottom(),
+ eCoreUnit, SFX_MAPUNIT_MM, pIntl );
+ }
+ break;
+
+ default:
+ ePres = SFX_ITEM_PRESENTATION_NONE;
+ break;
+ }
+ return ePres;
+}
+
+
+
+
diff --git a/svx/source/items/hlnkitem.cxx b/svx/source/items/hlnkitem.cxx
new file mode 100644
index 000000000000..8b4c36ab5eac
--- /dev/null
+++ b/svx/source/items/hlnkitem.cxx
@@ -0,0 +1,430 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#define _SVX_HLNKITEM_CXX
+
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+#include <tools/stream.hxx>
+
+#ifndef _MEMBERID_HRC
+#include <svx/memberid.hrc>
+#endif
+
+#ifndef __SBX_SBXVARIABLE_HXX
+#include <basic/sbxvar.hxx>
+#endif
+
+#include "svx/hlnkitem.hxx"
+
+// -----------------------------------------------------------------------
+
+TYPEINIT1_FACTORY(SvxHyperlinkItem, SfxPoolItem, new SvxHyperlinkItem(0));
+
+// class SvxHyperlinkItem ------------------------------------------------
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+#define HYPERLINKFF_MARKER 0x599401FE
+
+SvStream& SvxHyperlinkItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const
+{
+ // store 'simple' data
+ // UNICODE: rStrm << sName;
+ rStrm.WriteByteString(sName);
+
+ // UNICODE: rStrm << sURL;
+ rStrm.WriteByteString(sURL);
+
+ // UNICODE: rStrm << sTarget;
+ rStrm.WriteByteString(sTarget);
+
+ rStrm << (sal_uInt32) eType;
+
+ // marker for versioninfo
+ rStrm << (sal_uInt32) HYPERLINKFF_MARKER;
+
+ // new data
+ // UNICODE: rStrm << sIntName;
+ rStrm.WriteByteString(sIntName);
+
+ // macro-events
+ rStrm << nMacroEvents;
+
+ // store macros
+ sal_uInt16 nCnt = pMacroTable ? (sal_uInt16)pMacroTable->Count() : 0;
+ sal_uInt16 nMax = nCnt;
+ if( nCnt )
+ {
+ for( SvxMacro* pMac = pMacroTable->First(); pMac; pMac = pMacroTable->Next() )
+ if( STARBASIC != pMac->GetScriptType() )
+ --nCnt;
+ }
+
+ rStrm << nCnt;
+
+ if( nCnt )
+ {
+ // 1. StarBasic-Macros
+ for( SvxMacro* pMac = pMacroTable->First(); pMac; pMac = pMacroTable->Next() )
+ {
+ if( STARBASIC == pMac->GetScriptType() )
+ {
+ rStrm << (sal_uInt16)pMacroTable->GetCurKey();
+
+ // UNICODE: rStrm << pMac->GetLibName();
+ rStrm.WriteByteString(pMac->GetLibName());
+
+ // UNICODE: rStrm << pMac->GetMacName();
+ rStrm.WriteByteString(pMac->GetMacName());
+ }
+ }
+ }
+
+ nCnt = nMax - nCnt;
+ rStrm << nCnt;
+ if( nCnt )
+ {
+ // 2. ::com::sun::star::script::JavaScript-Macros
+ for( SvxMacro* pMac = pMacroTable->First(); pMac; pMac = pMacroTable->Next() )
+ {
+ if( STARBASIC != pMac->GetScriptType() )
+ {
+ rStrm << (sal_uInt16)pMacroTable->GetCurKey();
+
+ // UNICODE: rStrm << pMac->GetLibName();
+ rStrm.WriteByteString(pMac->GetLibName());
+
+ // UNICODE: rStrm << pMac->GetMacName();
+ rStrm.WriteByteString(pMac->GetMacName());
+
+ rStrm << (sal_uInt16)pMac->GetScriptType();
+ }
+ }
+ }
+
+ return rStrm;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxPoolItem* SvxHyperlinkItem::Create( SvStream &rStrm, sal_uInt16 /*nItemVersion*/ ) const
+{
+ SvxHyperlinkItem* pNew = new SvxHyperlinkItem( Which() );
+ sal_uInt32 nType;
+
+ // simple data-types
+ // UNICODE: rStrm >> pNew->sName;
+ rStrm.ReadByteString(pNew->sName);
+
+ // UNICODE: rStrm >> pNew->sURL;
+ rStrm.ReadByteString(pNew->sURL);
+
+ // UNICODE: rStrm >> pNew->sTarget;
+ rStrm.ReadByteString(pNew->sTarget);
+
+ rStrm >> nType;
+ pNew->eType = (SvxLinkInsertMode) nType;
+
+ sal_uInt32 nPos = rStrm.Tell();
+ sal_uInt32 nMarker;
+ rStrm >> nMarker;
+ if ( nMarker == HYPERLINKFF_MARKER )
+ {
+ // new data
+ // UNICODE: rStrm >> pNew->sIntName;
+ rStrm.ReadByteString(pNew->sIntName);
+
+ // macro-events
+ rStrm >> pNew->nMacroEvents;
+
+ // macros
+ sal_uInt16 nCnt;
+ rStrm >> nCnt;
+ while( nCnt-- )
+ {
+ sal_uInt16 nCurKey;
+ String aLibName, aMacName;
+
+ rStrm >> nCurKey;
+ // UNICODE: rStrm >> aLibName;
+ rStrm.ReadByteString(aLibName);
+
+ // UNICODE: rStrm >> aMacName;
+ rStrm.ReadByteString(aMacName);
+
+ pNew->SetMacro( nCurKey, SvxMacro( aMacName, aLibName, STARBASIC ) );
+ }
+
+ rStrm >> nCnt;
+ while( nCnt-- )
+ {
+ sal_uInt16 nCurKey, nScriptType;
+ String aLibName, aMacName;
+
+ rStrm >> nCurKey;
+
+ // UNICODE: rStrm >> aLibName;
+ rStrm.ReadByteString(aLibName);
+
+ // UNICODE: rStrm >> aMacName;
+ rStrm.ReadByteString(aMacName);
+
+ rStrm >> nScriptType;
+
+ pNew->SetMacro( nCurKey, SvxMacro( aMacName, aLibName,
+ (ScriptType)nScriptType ) );
+ }
+ }
+ else
+ rStrm.Seek( nPos );
+
+ return pNew;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SvxHyperlinkItem::SvxHyperlinkItem( const SvxHyperlinkItem& rHyperlinkItem ):
+ SfxPoolItem(rHyperlinkItem)
+{
+ sName = rHyperlinkItem.sName;
+ sURL = rHyperlinkItem.sURL;
+ sTarget = rHyperlinkItem.sTarget;
+ eType = rHyperlinkItem.eType;
+ sIntName = rHyperlinkItem.sIntName;
+ nMacroEvents = rHyperlinkItem.nMacroEvents;
+
+ if( rHyperlinkItem.GetMacroTbl() )
+ pMacroTable = new SvxMacroTableDtor( *rHyperlinkItem.GetMacroTbl() );
+ else
+ pMacroTable=NULL;
+
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SvxHyperlinkItem::SvxHyperlinkItem( sal_uInt16 _nWhich, String& rName, String& rURL,
+ String& rTarget, String& rIntName, SvxLinkInsertMode eTyp,
+ sal_uInt16 nEvents, SvxMacroTableDtor *pMacroTbl ):
+ SfxPoolItem (_nWhich),
+ sName (rName),
+ sURL (rURL),
+ sTarget (rTarget),
+ eType (eTyp),
+ sIntName (rIntName),
+ nMacroEvents (nEvents)
+{
+ if (pMacroTbl)
+ pMacroTable = new SvxMacroTableDtor ( *pMacroTbl );
+ else
+ pMacroTable=NULL;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxPoolItem* SvxHyperlinkItem::Clone( SfxItemPool* ) const
+{
+ return new SvxHyperlinkItem( *this );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+int SvxHyperlinkItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unterschiedliche Typen" );
+
+ const SvxHyperlinkItem& rItem = (const SvxHyperlinkItem&) rAttr;
+
+ sal_Bool bRet = ( sName == rItem.sName &&
+ sURL == rItem.sURL &&
+ sTarget == rItem.sTarget &&
+ eType == rItem.eType &&
+ sIntName == rItem.sIntName &&
+ nMacroEvents == rItem.nMacroEvents);
+ if (!bRet)
+ return sal_False;
+
+ const SvxMacroTableDtor* pOther = ((SvxHyperlinkItem&)rAttr).pMacroTable;
+ if( !pMacroTable )
+ return ( !pOther || !pOther->Count() );
+ if( !pOther )
+ return 0 == pMacroTable->Count();
+
+ const SvxMacroTableDtor& rOwn = *pMacroTable;
+ const SvxMacroTableDtor& rOther = *pOther;
+
+ // Anzahl unterschiedlich => auf jeden Fall ungleich
+ if( rOwn.Count() != rOther.Count() )
+ return sal_False;
+
+ // einzeln vergleichen; wegen Performance ist die Reihenfolge wichtig
+ for( sal_uInt16 nNo = 0; nNo < rOwn.Count(); ++nNo )
+ {
+ const SvxMacro *pOwnMac = rOwn.GetObject(nNo);
+ const SvxMacro *pOtherMac = rOther.GetObject(nNo);
+ if ( rOwn.GetKey(pOwnMac) != rOther.GetKey(pOtherMac) ||
+ pOwnMac->GetLibName() != pOtherMac->GetLibName() ||
+ pOwnMac->GetMacName() != pOtherMac->GetMacName() )
+ return sal_False;
+ }
+
+ return sal_True;
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SvxHyperlinkItem::SetMacro( sal_uInt16 nEvent, const SvxMacro& rMacro )
+{
+ if( nEvent < EVENT_SFX_START )
+ {
+ switch( nEvent )
+ {
+ case HYPERDLG_EVENT_MOUSEOVER_OBJECT:
+ nEvent = SFX_EVENT_MOUSEOVER_OBJECT;
+ break;
+ case HYPERDLG_EVENT_MOUSECLICK_OBJECT:
+ nEvent = SFX_EVENT_MOUSECLICK_OBJECT;
+ break;
+ case HYPERDLG_EVENT_MOUSEOUT_OBJECT:
+ nEvent = SFX_EVENT_MOUSEOUT_OBJECT;
+ break;
+ }
+ }
+
+ if( !pMacroTable )
+ pMacroTable = new SvxMacroTableDtor;
+
+ SvxMacro *pOldMacro;
+ if( 0 != ( pOldMacro = pMacroTable->Get( nEvent )) )
+ {
+ delete pOldMacro;
+ pMacroTable->Replace( nEvent, new SvxMacro( rMacro ) );
+ }
+ else
+ pMacroTable->Insert( nEvent, new SvxMacro( rMacro ) );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SvxHyperlinkItem::SetMacroTable( const SvxMacroTableDtor& rTbl )
+{
+ if ( pMacroTable )
+ delete pMacroTable;
+
+ pMacroTable = new SvxMacroTableDtor ( rTbl );
+}
+
+sal_Bool SvxHyperlinkItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+ switch(nMemberId)
+ {
+ case MID_HLINK_NAME :
+ rVal <<= ::rtl::OUString(sIntName.GetBuffer());
+ break;
+ case MID_HLINK_TEXT :
+ rVal <<= ::rtl::OUString(sName.GetBuffer());
+ break;
+ case MID_HLINK_URL:
+ rVal <<= ::rtl::OUString(sURL.GetBuffer());
+ break;
+ case MID_HLINK_TARGET:
+ rVal <<= ::rtl::OUString(sTarget.GetBuffer());
+ break;
+ case MID_HLINK_TYPE:
+ rVal <<= (sal_Int32) eType;
+ break;
+ default:
+ return sal_False;
+ }
+
+ return sal_True;
+}
+
+sal_Bool SvxHyperlinkItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
+{
+// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+ ::rtl::OUString aStr;
+ sal_Int32 nVal = 0;
+ switch(nMemberId)
+ {
+ case MID_HLINK_NAME :
+ if(!(rVal >>= aStr))
+ return sal_False;
+ sIntName = aStr.getStr();
+ break;
+ case MID_HLINK_TEXT :
+ if(!(rVal >>= aStr))
+ return sal_False;
+ sName = aStr.getStr();
+ break;
+ case MID_HLINK_URL:
+ if(!(rVal >>= aStr))
+ return sal_False;
+ sURL = aStr.getStr();
+ break;
+ case MID_HLINK_TARGET:
+ if(!(rVal >>= aStr))
+ return sal_False;
+ sTarget = aStr.getStr();
+ break;
+ case MID_HLINK_TYPE:
+ if(!(rVal >>= nVal))
+ return sal_False;
+ eType = (SvxLinkInsertMode) (sal_uInt16) nVal;
+ break;
+ default:
+ return sal_False;
+ }
+
+ return sal_True;
+}
+
diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx
new file mode 100644
index 000000000000..95722e3144c9
--- /dev/null
+++ b/svx/source/items/numfmtsh.cxx
@@ -0,0 +1,1869 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/color.hxx>
+
+#define _SVX_NUMFMTSH_CXX
+#define _SVSTDARR_STRINGSDTOR
+#include <tools/debug.hxx>
+#include <i18npool/mslangid.hxx>
+
+#define _ZFORLIST_DECLARE_TABLE
+#include <svl/zforlist.hxx>
+#include <svl/zformat.hxx>
+
+#include <svtools/langtab.hxx>
+#include <vcl/svapp.hxx>
+#include <comphelper/processfactory.hxx>
+
+#include <svx/numfmtsh.hxx>
+// class SvxNumberFormatShell --------------------------------------------
+
+const double SvxNumberFormatShell::DEFAULT_NUMVALUE = 1234.56789;
+
+SV_IMPL_PTRARR( NfShCurrencyEntries, NfCurrencyEntry* );
+
+// -----------------------------------------------------------------------
+
+
+
+SvxNumberFormatShell* SvxNumberFormatShell::Create( SvNumberFormatter* pNumFormatter,
+ sal_uInt32 nFormatKey,
+ SvxNumberValueType eNumValType,
+ const String& rNumStr )
+{
+ return new SvxNumberFormatShell(pNumFormatter,nFormatKey,
+ eNumValType,rNumStr );
+}
+
+SvxNumberFormatShell* SvxNumberFormatShell::Create( SvNumberFormatter* pNumFormatter,
+ sal_uInt32 nFormatKey,
+ SvxNumberValueType eNumValType,
+ double nNumVal,
+ const String* pNumStr )
+{
+ return new SvxNumberFormatShell(pNumFormatter,nFormatKey,
+ eNumValType,nNumVal,pNumStr );
+}
+
+// -----------------------------------------------------------------------
+
+#define _INIT \
+ pFormatter ( pNumFormatter ), \
+ pCurFmtTable ( NULL ), \
+ eValType ( eNumValType ), \
+ bUndoAddList ( sal_True ), \
+ nInitFormatKey ( nFormatKey ), \
+ nCurFormatKey ( nFormatKey ), \
+ pCurCurrencyEntry(NULL), \
+ bBankingSymbol (sal_False), \
+ nCurCurrencyEntryPos((sal_uInt16) SELPOS_NONE)
+
+// -----------------------------------------------------------------------
+
+SvxNumberFormatShell::SvxNumberFormatShell( SvNumberFormatter* pNumFormatter,
+ sal_uInt32 nFormatKey,
+ SvxNumberValueType eNumValType,
+ const String& rNumStr )
+ : _INIT
+{
+ nValNum = DEFAULT_NUMVALUE;
+
+ switch ( eValType )
+ {
+ case SVX_VALUE_TYPE_STRING:
+ aValStr = rNumStr;
+ break;
+ case SVX_VALUE_TYPE_NUMBER:
+ case SVX_VALUE_TYPE_UNDEFINED:
+ default:
+ aValStr.Erase();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SvxNumberFormatShell::SvxNumberFormatShell( SvNumberFormatter* pNumFormatter,
+ sal_uInt32 nFormatKey,
+ SvxNumberValueType eNumValType,
+ double nNumVal,
+ const String* pNumStr )
+ : _INIT
+{
+ // #50441# When used in Writer, the SvxNumberInfoItem contains the
+ // original string in addition to the value
+
+ if ( pNumStr )
+ aValStr = *pNumStr;
+
+ switch ( eValType )
+ {
+ case SVX_VALUE_TYPE_NUMBER:
+ nValNum = nNumVal;
+ break;
+ case SVX_VALUE_TYPE_STRING:
+ case SVX_VALUE_TYPE_UNDEFINED:
+ default:
+ nValNum = DEFAULT_NUMVALUE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SvxNumberFormatShell::~SvxNumberFormatShell()
+{
+ /*
+ * An dieser Stelle wird abhaengig davon, ob die
+ * hinzugefuegten, benutzerdefinierten als gueltig
+ * erklaert wurden (ValidateNewEntries()), die
+ * Add-Liste wieder aus dem Zahlenformatierer entfernt.
+ *
+ * Loeschen von Formaten aus dem Formatierer passiert
+ * aus Undo-Gruenden nur in der aufrufenden Instanz.
+ */
+
+ if ( bUndoAddList )
+ {
+ // Hinzugefuegte Formate sind nicht gueltig:
+ // => wieder entfernen:
+
+ for ( sal_uInt16 i = 0; i < aAddList.Count(); ++i )
+ pFormatter->DeleteEntry( aAddList[i] );
+ }
+
+ //--------------------------------
+ // Add-/Remove-Listen leerraeumen:
+ //--------------------------------
+ aAddList.Remove( 0, aAddList.Count() );
+ aDelList.Remove( 0, aAddList.Count() );
+
+ if(aCurrencyFormatList.Count()>0)
+ aCurrencyFormatList.DeleteAndDestroy(0,aCurrencyFormatList.Count());
+}
+
+// -----------------------------------------------------------------------
+
+sal_uInt32 SvxNumberFormatShell::GetUpdateDataCount() const
+{
+ return aDelList.Count();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxNumberFormatShell::GetUpdateData( sal_uInt32* pDelArray, const sal_uInt32 nSize )
+{
+ const sal_uInt32 nCount = aDelList.Count();
+
+ DBG_ASSERT( pDelArray && ( nSize == nCount ), "Array nicht initialisiert!" );
+
+ if ( pDelArray && ( nSize == nCount ) )
+ for ( sal_uInt16 i = 0; i < aDelList.Count(); ++i )
+ *pDelArray++ = aDelList[i];
+}
+
+// -----------------------------------------------------------------------
+
+void SvxNumberFormatShell::CategoryChanged( sal_uInt16 nCatLbPos,
+ short& rFmtSelPos,
+ SvStrings& rFmtEntries )
+{
+ short nOldCategory = nCurCategory;
+ PosToCategory_Impl( nCatLbPos, nCurCategory );
+ pCurFmtTable = &( pFormatter->GetEntryTable( nCurCategory,
+ nCurFormatKey,
+ eCurLanguage ) );
+ // reinitialize currency if category newly entered
+ if ( nCurCategory == NUMBERFORMAT_CURRENCY && nOldCategory != nCurCategory )
+ pCurCurrencyEntry = NULL;
+ rFmtSelPos = FillEntryList_Impl( rFmtEntries );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxNumberFormatShell::LanguageChanged( LanguageType eLangType,
+ short& rFmtSelPos,
+ SvStrings& rFmtEntries )
+{
+ eCurLanguage = eLangType;
+ pCurFmtTable = &(pFormatter->ChangeCL( nCurCategory,
+ nCurFormatKey,
+ eCurLanguage ) );
+ rFmtSelPos = FillEntryList_Impl( rFmtEntries );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxNumberFormatShell::FormatChanged( sal_uInt16 nFmtLbPos,
+ String& rPreviewStr,
+ Color*& rpFontColor )
+{
+ //nCurFormatKey = pCurFmtTable->GetKey( pCurFmtTable->GetObject( nFmtLbPos ) );
+
+ if(nFmtLbPos<aCurEntryList.Count())
+ {
+ nCurFormatKey=aCurEntryList[nFmtLbPos];
+
+ if(nCurFormatKey!=NUMBERFORMAT_ENTRY_NOT_FOUND)
+ {
+ GetPreviewString_Impl( rPreviewStr, rpFontColor );
+ }
+ else if(nCurCategory==NUMBERFORMAT_CURRENCY)
+ {
+ if(nFmtLbPos<aCurrencyFormatList.Count())
+ {
+ //nCurFormatKey=nFmtLbPos;
+ MakePrevStringFromVal(*aCurrencyFormatList[nFmtLbPos],
+ rPreviewStr,rpFontColor,nValNum);
+ }
+ }
+ }
+}
+// -----------------------------------------------------------------------
+
+sal_Bool SvxNumberFormatShell::AddFormat( String& rFormat, xub_StrLen& rErrPos,
+ sal_uInt16& rCatLbSelPos, short& rFmtSelPos,
+ SvStrings& rFmtEntries )
+{
+ sal_Bool bInserted = sal_False;
+ sal_uInt32 nAddKey = pFormatter->GetEntryKey( rFormat, eCurLanguage );
+
+ if ( nAddKey != NUMBERFORMAT_ENTRY_NOT_FOUND ) // bereits vorhanden?
+ {
+ if ( IsRemoved_Impl( nAddKey ) )
+ {
+ // Key suchen und loeschen
+ sal_Bool bFound = sal_False;
+ sal_uInt16 nAt = 0;
+
+ for ( sal_uInt16 i = 0; !bFound && i < aDelList.Count(); ++i )
+ {
+ if ( aDelList[i] == nAddKey )
+ {
+ bFound = sal_True;
+ nAt = i;
+ }
+ }
+ DBG_ASSERT( bFound, "Key not found" );
+ aDelList.Remove( nAt );
+ bInserted = sal_True;
+ }
+ else
+ {
+ DBG_ERROR( "Doppeltes Format!" );
+ }
+ }
+ else // neues Format
+ {
+ bInserted = pFormatter->PutEntry( rFormat, rErrPos,
+ nCurCategory, nAddKey,
+ eCurLanguage );
+ }
+
+ if ( bInserted ) // eingefuegt
+ {
+ nCurFormatKey = nAddKey;
+ DBG_ASSERT( !IsAdded_Impl( nCurFormatKey ), "Doppeltes Format!" );
+ aAddList.Insert( nCurFormatKey, aAddList.Count() );
+
+ // aktuelle Tabelle holen
+ pCurFmtTable = &(pFormatter->GetEntryTable( nCurCategory,
+ nCurFormatKey,
+ eCurLanguage ));
+ nCurCategory=pFormatter->GetType(nAddKey); //@@ ???
+ CategoryToPos_Impl( nCurCategory, rCatLbSelPos );
+ rFmtSelPos = FillEntryList_Impl( rFmtEntries );
+ }
+ else if ( rErrPos != 0 ) // Syntaxfehler
+ {
+ ;
+ }
+ else // Doppelt einfuegen nicht moeglich
+ {
+ DBG_ERROR( "Doppeltes Format!" ); // oder doch?
+ }
+
+ return bInserted;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxNumberFormatShell::RemoveFormat( const String& rFormat,
+ sal_uInt16& rCatLbSelPos,
+ short& rFmtSelPos,
+ SvStrings& rFmtEntries )
+{
+ sal_uInt32 nDelKey = pFormatter->GetEntryKey( rFormat, eCurLanguage );
+
+ DBG_ASSERT( nDelKey != NUMBERFORMAT_ENTRY_NOT_FOUND, "Eintrag nicht gefunden!" );
+ DBG_ASSERT( !IsRemoved_Impl( nDelKey ), "Eintrag bereits geloescht!" );
+
+ if ( (nDelKey != NUMBERFORMAT_ENTRY_NOT_FOUND) && !IsRemoved_Impl( nDelKey ) )
+ {
+ aDelList.Insert( nDelKey, aDelList.Count() );
+
+ if ( IsAdded_Impl( nDelKey ) )
+ {
+ // Key suchen und loeschen
+ sal_Bool bFound = sal_False;
+ sal_uInt16 nAt = 0;
+
+ for ( sal_uInt16 i = 0; !bFound && i < aAddList.Count(); ++i )
+ {
+ if ( aAddList[i] == nDelKey )
+ {
+ bFound = sal_True;
+ nAt = i;
+ }
+ }
+ DBG_ASSERT( bFound, "Key not found" );
+ aAddList.Remove( nAt );
+ }
+
+ nCurCategory=pFormatter->GetType(nDelKey); //@@ 01.10.97
+ pCurFmtTable = &(pFormatter->GetEntryTable( nCurCategory,
+ nCurFormatKey,
+ eCurLanguage ));
+
+ nCurFormatKey=pFormatter->GetStandardFormat(nCurCategory,
+ eCurLanguage );
+
+ CategoryToPos_Impl( nCurCategory, rCatLbSelPos );
+ rFmtSelPos = FillEntryList_Impl( rFmtEntries );
+ //rFmtSelPos = (short) nCurFormatKey; //@@ 01.10.97
+ }
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxNumberFormatShell::MakeFormat( String& rFormat,
+ sal_Bool bThousand, sal_Bool bNegRed,
+ sal_uInt16 nPrecision, sal_uInt16 nLeadingZeroes,
+ sal_uInt16 nCurrencyPos)
+{
+ if(aCurrencyFormatList.Count()>nCurrencyPos)
+ {
+ xub_StrLen rErrPos=0;
+ sal_uInt16 rCatLbSelPos=0;
+ short rFmtSelPos=0;
+ SvStrings aFmtEList;
+
+ sal_uInt32 nFound = pFormatter->TestNewString( *aCurrencyFormatList[nCurrencyPos], eCurLanguage );
+
+ if ( nFound == NUMBERFORMAT_ENTRY_NOT_FOUND )
+ {
+ AddFormat( *aCurrencyFormatList[nCurrencyPos],rErrPos,rCatLbSelPos,
+ rFmtSelPos,aFmtEList);
+ }
+
+ if(rErrPos==0)
+ {
+ pFormatter->GenerateFormat( rFormat, nCurFormatKey,
+ eCurLanguage,
+ bThousand, bNegRed,
+ nPrecision, nLeadingZeroes );
+ }
+ aFmtEList.DeleteAndDestroy(0,aFmtEList.Count());
+ }
+ else
+ {
+ pFormatter->GenerateFormat( rFormat, nCurFormatKey,
+ eCurLanguage,
+ bThousand, bNegRed,
+ nPrecision, nLeadingZeroes );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxNumberFormatShell::GetOptions( const String& rFormat,
+ sal_Bool& rThousand,
+ sal_Bool& rNegRed,
+ sal_uInt16& rPrecision,
+ sal_uInt16& rLeadingZeroes,
+ sal_uInt16& rCatLbPos )
+{
+
+ sal_uInt32 nFmtKey = pFormatter->GetEntryKey( rFormat, eCurLanguage );
+
+ if(nFmtKey != NUMBERFORMAT_ENTRY_NOT_FOUND)
+ {
+ if ( nFmtKey != NUMBERFORMAT_ENTRY_NOT_FOUND )
+ {
+ pFormatter->GetFormatSpecialInfo( nFmtKey,
+ rThousand, rNegRed,
+ rPrecision, rLeadingZeroes );
+
+ CategoryToPos_Impl( pFormatter->GetType( nFmtKey ), rCatLbPos );
+ }
+ else
+ rCatLbPos = CAT_USERDEFINED;
+ }
+ else
+ {
+ sal_Bool bTestBanking=sal_False;
+ sal_uInt16 nPos=FindCurrencyTableEntry(rFormat, bTestBanking );
+
+ if(IsInTable(nPos,bTestBanking,rFormat) &&
+ pFormatter->GetFormatSpecialInfo( rFormat,rThousand, rNegRed,
+ rPrecision, rLeadingZeroes,eCurLanguage)==0)
+ {
+ rCatLbPos = CAT_CURRENCY;
+ }
+ else
+ rCatLbPos = CAT_USERDEFINED;
+ }
+
+}
+
+// -----------------------------------------------------------------------
+
+void SvxNumberFormatShell::MakePreviewString( const String& rFormatStr,
+ String& rPreviewStr,
+ Color*& rpFontColor )
+{
+ rpFontColor = NULL;
+
+ sal_uIntPtr nExistingFormat = pFormatter->GetEntryKey( rFormatStr, eCurLanguage );
+ if ( nExistingFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
+ {
+ // real preview - not implemented in NumberFormatter for text formats
+
+ pFormatter->GetPreviewString( rFormatStr, nValNum, rPreviewStr,
+ &rpFontColor, eCurLanguage );
+ }
+ else
+ {
+ // format exists
+
+ // #50441# if a string was set in addition to the value, use it for text formats
+ sal_Bool bUseText = ( eValType == SVX_VALUE_TYPE_STRING ||
+ ( aValStr.Len() && ( pFormatter->GetType(nExistingFormat) & NUMBERFORMAT_TEXT ) ) );
+ if ( bUseText )
+ pFormatter->GetOutputString( aValStr, nExistingFormat,
+ rPreviewStr, &rpFontColor );
+ else
+ pFormatter->GetOutputString( nValNum, nExistingFormat,
+ rPreviewStr, &rpFontColor );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxNumberFormatShell::IsUserDefined( const String& rFmtString )
+{
+ sal_uInt32 nFound = pFormatter->GetEntryKey( rFmtString, eCurLanguage );
+
+ sal_Bool bFlag=sal_False;
+ if ( nFound != NUMBERFORMAT_ENTRY_NOT_FOUND )
+ {
+ bFlag=pFormatter->IsUserDefined( rFmtString, eCurLanguage );
+
+ if(bFlag)
+ {
+ const SvNumberformat* pNumEntry = pFormatter->GetEntry(nFound);
+
+ if(pNumEntry!=NULL && pNumEntry->HasNewCurrency())
+ {
+ sal_Bool bTestBanking;
+ sal_uInt16 nPos=FindCurrencyTableEntry(rFmtString,bTestBanking);
+ bFlag=!IsInTable(nPos,bTestBanking,rFmtString);
+ }
+ }
+ }
+ return bFlag;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxNumberFormatShell::FindEntry( const String& rFmtString, sal_uInt32* pAt /* = NULL */ )
+{
+ sal_Bool bRes=sal_False;
+ sal_uInt32 nFound = pFormatter->TestNewString( rFmtString, eCurLanguage );
+
+ if ( nFound == NUMBERFORMAT_ENTRY_NOT_FOUND )
+ {
+ sal_Bool bTestBanking=sal_False;
+ sal_uInt16 nPos=FindCurrencyTableEntry(rFmtString, bTestBanking );
+
+ if(IsInTable(nPos,bTestBanking,rFmtString))
+ {
+ nFound=NUMBERFORMAT_ENTRY_NEW_CURRENCY;
+ bRes=sal_True;
+ }
+ }
+ else
+ {
+ bRes=!IsRemoved_Impl( nFound );
+ }
+
+ if ( pAt )
+ *pAt = nFound;
+
+ return bRes;
+}
+
+
+// -----------------------------------------------------------------------
+
+void SvxNumberFormatShell::GetInitSettings(
+ sal_uInt16& nCatLbPos,
+ LanguageType& rLangType,
+ sal_uInt16& nFmtLbSelPos,
+ SvStrings& rFmtEntries,
+ String& rPrevString,
+ Color*& rpPrevColor )
+{
+ // -------------------------------------------------------------------
+ // Vorbedingung: Zahlenformatierer gefunden
+ DBG_ASSERT( pFormatter != NULL, "Zahlenformatierer nicht gefunden!" );
+
+// sal_uInt16 nCount = 0;
+ short nSelPos = SELPOS_NONE;
+// SvNumberFormatTable* pFmtTable = NULL;
+
+ // Sonderbehandlung fuer undefiniertes Zahlenformat:
+ if ( (eValType == SVX_VALUE_TYPE_UNDEFINED) && (nCurFormatKey == 0) )
+ PosToCategory_Impl( CAT_ALL, nCurCategory ); // Kategorie = Alle
+ else
+ nCurCategory = NUMBERFORMAT_UNDEFINED; // Kategorie = Undefiniert
+
+ pCurFmtTable = &(pFormatter->GetFirstEntryTable( nCurCategory,
+ nCurFormatKey,
+ eCurLanguage ));
+
+
+
+ CategoryToPos_Impl( nCurCategory, nCatLbPos );
+ rLangType = eCurLanguage;
+
+ nSelPos = FillEntryList_Impl( rFmtEntries );
+
+ DBG_ASSERT( nSelPos != SELPOS_NONE, "Leere Formatliste!" );
+
+ nFmtLbSelPos = (nSelPos != SELPOS_NONE) ? (sal_uInt16)nSelPos : 0;
+ GetPreviewString_Impl( rPrevString, rpPrevColor );
+}
+
+// -----------------------------------------------------------------------
+
+short SvxNumberFormatShell::FillEntryList_Impl( SvStrings& rList )
+{
+ /* Erstellen einer aktuellen Liste von Format-Eintraegen.
+ * Rueckgabewert ist die Listenposition des aktuellen Formates.
+ * Ist die Liste leer oder gibt es kein aktuelles Format,
+ * so wird SELPOS_NONE geliefert.
+ */
+ short nSelPos=0;
+ aCurEntryList.Remove(nSelPos,aCurEntryList.Count());
+ sal_uInt16 nPrivCat = CAT_CURRENCY;
+ nSelPos=SELPOS_NONE;
+
+ if(nCurCategory==NUMBERFORMAT_ALL)
+ {
+ FillEListWithStd_Impl(rList,CAT_NUMBER,nSelPos);
+ FillEListWithStd_Impl(rList,CAT_PERCENT,nSelPos);
+ FillEListWithStd_Impl(rList,CAT_CURRENCY,nSelPos);
+ FillEListWithStd_Impl(rList,CAT_DATE,nSelPos);
+ FillEListWithStd_Impl(rList,CAT_TIME,nSelPos);
+ FillEListWithStd_Impl(rList,CAT_SCIENTIFIC,nSelPos);
+ FillEListWithStd_Impl(rList,CAT_FRACTION,nSelPos);
+ FillEListWithStd_Impl(rList,CAT_BOOLEAN,nSelPos);
+ FillEListWithStd_Impl(rList,CAT_TEXT,nSelPos);
+ }
+ else
+ {
+ CategoryToPos_Impl(nCurCategory, nPrivCat);
+ FillEListWithStd_Impl(rList,nPrivCat,nSelPos);
+ }
+
+ if( nPrivCat!=CAT_CURRENCY)
+ nSelPos=FillEListWithUsD_Impl(rList,nPrivCat,nSelPos);
+
+ return nSelPos;
+}
+
+void SvxNumberFormatShell::FillEListWithStd_Impl( SvStrings& rList,sal_uInt16 nPrivCat,short &nSelPos )
+{
+ /* Erstellen einer aktuellen Liste von Format-Eintraegen.
+ * Rueckgabewert ist die Listenposition des aktuellen Formates.
+ * Ist die Liste leer oder gibt es kein aktuelles Format,
+ * so wird SELPOS_NONE geliefert.
+ */
+ DBG_ASSERT( pCurFmtTable != NULL, "Unbekanntes Zahlenformat!" );
+
+ if(aCurrencyFormatList.Count()>0)
+ aCurrencyFormatList.DeleteAndDestroy(0,aCurrencyFormatList.Count());
+
+ if(nPrivCat==CAT_CURRENCY)
+ {
+ nSelPos=FillEListWithCurrency_Impl(rList,nSelPos);
+ }
+ else
+ {
+ NfIndexTableOffset eOffsetStart;
+ NfIndexTableOffset eOffsetEnd;
+
+ switch(nPrivCat)
+ {
+ case CAT_NUMBER :eOffsetStart=NF_NUMBER_START;
+ eOffsetEnd=NF_NUMBER_END;
+ break;
+ case CAT_PERCENT :eOffsetStart=NF_PERCENT_START;
+ eOffsetEnd=NF_PERCENT_END;
+ break;
+ case CAT_CURRENCY :eOffsetStart=NF_CURRENCY_START;
+ eOffsetEnd=NF_CURRENCY_END;
+ break;
+ case CAT_DATE :eOffsetStart=NF_DATE_START;
+ eOffsetEnd=NF_DATE_END;
+ break;
+ case CAT_TIME :eOffsetStart=NF_TIME_START;
+ eOffsetEnd=NF_TIME_END;
+ break;
+ case CAT_SCIENTIFIC :eOffsetStart=NF_SCIENTIFIC_START;
+ eOffsetEnd=NF_SCIENTIFIC_END;
+ break;
+ case CAT_FRACTION :eOffsetStart=NF_FRACTION_START;
+ eOffsetEnd=NF_FRACTION_END;
+ break;
+ case CAT_BOOLEAN :eOffsetStart=NF_BOOLEAN;
+ eOffsetEnd=NF_BOOLEAN;
+ break;
+ case CAT_TEXT :eOffsetStart=NF_TEXT;
+ eOffsetEnd=NF_TEXT;
+ break;
+ default :return;
+ }
+
+ nSelPos=FillEListWithFormats_Impl(rList,nSelPos,eOffsetStart,eOffsetEnd);
+
+ if(nPrivCat==CAT_DATE || nPrivCat==CAT_TIME)
+ {
+ nSelPos=FillEListWithDateTime_Impl(rList,nSelPos);
+ //if(nSelPos!=SELPOS_NONE) nSelPos=nTmpPos;
+ }
+ }
+}
+
+short SvxNumberFormatShell::FillEListWithFormats_Impl( SvStrings& rList,short nSelPos,
+ NfIndexTableOffset eOffsetStart,
+ NfIndexTableOffset eOffsetEnd)
+{
+ /* Erstellen einer aktuellen Liste von Format-Eintraegen.
+ * Rueckgabewert ist die Listenposition des aktuellen Formates.
+ * Ist die Liste leer oder gibt es kein aktuelles Format,
+ * so wird SELPOS_NONE geliefert.
+ */
+ sal_uInt16 nMyType;
+
+ DBG_ASSERT( pCurFmtTable != NULL, "Unbekanntes Zahlenformat!" );
+
+ const SvNumberformat* pNumEntry = pCurFmtTable->First();
+// sal_uInt16 nCount = 0;
+ sal_uInt32 nNFEntry;
+ String aStrComment;
+ String aNewFormNInfo;
+ String aPrevString;
+ String a2PrevString;
+
+ short nMyCat = SELPOS_NONE;
+// short nIq=0;
+
+ long nIndex;
+
+ for(nIndex=eOffsetStart;nIndex<=eOffsetEnd;nIndex++)
+ {
+ nNFEntry=pFormatter->GetFormatIndex((NfIndexTableOffset)nIndex,eCurLanguage);
+
+ pNumEntry = pFormatter->GetEntry(nNFEntry);
+
+ if(pNumEntry==NULL) continue;
+
+ nMyCat=pNumEntry->GetType() & ~NUMBERFORMAT_DEFINED;
+ aStrComment=pNumEntry->GetComment();
+ CategoryToPos_Impl(nMyCat,nMyType);
+ aNewFormNInfo= pNumEntry->GetFormatstring();
+
+ const StringPtr pStr = new String(aNewFormNInfo);
+
+ if ( nNFEntry == nCurFormatKey )
+ {
+ nSelPos = ( !IsRemoved_Impl( nNFEntry ) ) ? aCurEntryList.Count() : SELPOS_NONE;
+ }
+
+ rList.Insert( pStr,rList.Count());
+ aCurEntryList.Insert( nNFEntry, aCurEntryList.Count() );
+ }
+
+ return nSelPos;
+}
+
+short SvxNumberFormatShell::FillEListWithDateTime_Impl( SvStrings& rList,short nSelPos)
+{
+ sal_uInt16 nMyType;
+
+ DBG_ASSERT( pCurFmtTable != NULL, "Unbekanntes Zahlenformat!" );
+
+ const SvNumberformat* pNumEntry = pCurFmtTable->First();
+// sal_uInt16 nCount = 0;
+ sal_uInt32 nNFEntry;
+ String aStrComment;
+ String aNewFormNInfo;
+ String aPrevString;
+ String a2PrevString;
+
+ short nMyCat = SELPOS_NONE;
+// short nIq=0;
+
+ long nIndex;
+
+ for(nIndex=NF_DATETIME_START;nIndex<=NF_DATETIME_END;nIndex++)
+ {
+ nNFEntry=pFormatter->GetFormatIndex((NfIndexTableOffset)nIndex,eCurLanguage);
+
+ pNumEntry = pFormatter->GetEntry(nNFEntry);
+ if(pNumEntry!=NULL)
+ {
+ nMyCat=pNumEntry->GetType() & ~NUMBERFORMAT_DEFINED;
+ aStrComment=pNumEntry->GetComment();
+ CategoryToPos_Impl(nMyCat,nMyType);
+ aNewFormNInfo= pNumEntry->GetFormatstring();
+
+ const StringPtr pStr = new String(aNewFormNInfo);
+
+ if ( nNFEntry == nCurFormatKey )
+ {
+ nSelPos = ( !IsRemoved_Impl( nNFEntry ) ) ? aCurEntryList.Count() : SELPOS_NONE;
+ }
+
+ rList.Insert( pStr,rList.Count());
+ aCurEntryList.Insert( nNFEntry, aCurEntryList.Count() );
+ }
+ }
+
+ return nSelPos;
+}
+
+short SvxNumberFormatShell::FillEListWithCurrency_Impl( SvStrings& rList,short nSelPos)
+{
+ /* Erstellen einer aktuellen Liste von Format-Eintraegen.
+ * Rueckgabewert ist die Listenposition des aktuellen Formates.
+ * Ist die Liste leer oder gibt es kein aktuelles Format,
+ * so wird SELPOS_NONE geliefert.
+ */
+ DBG_ASSERT( pCurFmtTable != NULL, "Unbekanntes Zahlenformat!" );
+
+ const NfCurrencyEntry* pTmpCurrencyEntry;
+ sal_Bool bTmpBanking;
+ XubString rSymbol;
+
+ sal_Bool bFlag=pFormatter->GetNewCurrencySymbolString(nCurFormatKey,rSymbol,
+ &pTmpCurrencyEntry,&bTmpBanking);
+
+ if((!bFlag && pCurCurrencyEntry==NULL) ||
+ (bFlag && pTmpCurrencyEntry==NULL && !rSymbol.Len()) ||
+ nCurCategory==NUMBERFORMAT_ALL)
+ {
+ if ( nCurCategory == NUMBERFORMAT_ALL )
+ FillEListWithUserCurrencys(rList,nSelPos);
+ nSelPos=FillEListWithSysCurrencys(rList,nSelPos);
+ }
+ else
+ {
+ nSelPos=FillEListWithUserCurrencys(rList,nSelPos);
+ }
+
+ return nSelPos;
+}
+
+
+short SvxNumberFormatShell::FillEListWithSysCurrencys( SvStrings& rList,short nSelPos)
+{
+ /* Erstellen einer aktuellen Liste von Format-Eintraegen.
+ * Rueckgabewert ist die Listenposition des aktuellen Formates.
+ * Ist die Liste leer oder gibt es kein aktuelles Format,
+ * so wird SELPOS_NONE geliefert.
+ */
+ sal_uInt16 nMyType;
+
+ DBG_ASSERT( pCurFmtTable != NULL, "Unbekanntes Zahlenformat!" );
+
+ const SvNumberformat* pNumEntry = pCurFmtTable->First();
+ sal_uInt16 nCount = 0;
+ sal_uInt32 nNFEntry;
+ String aStrComment;
+ String aNewFormNInfo;
+ String aPrevString;
+ String a2PrevString;
+
+ nCurCurrencyEntryPos=0;
+
+ short nMyCat = SELPOS_NONE;
+// short nIq=0;
+
+ NfIndexTableOffset eOffsetStart=NF_CURRENCY_START;
+ NfIndexTableOffset eOffsetEnd=NF_CURRENCY_END;;
+ long nIndex;
+
+ for(nIndex=eOffsetStart;nIndex<=eOffsetEnd;nIndex++)
+ {
+ nNFEntry=pFormatter->GetFormatIndex((NfIndexTableOffset)nIndex,eCurLanguage);
+
+ pNumEntry = pFormatter->GetEntry(nNFEntry);
+
+ if(pNumEntry==NULL) continue;
+
+ nMyCat=pNumEntry->GetType() & ~NUMBERFORMAT_DEFINED;
+ aStrComment=pNumEntry->GetComment();
+ CategoryToPos_Impl(nMyCat,nMyType);
+ aNewFormNInfo= pNumEntry->GetFormatstring();
+
+ const StringPtr pStr = new String(aNewFormNInfo);
+
+ if ( nNFEntry == nCurFormatKey )
+ {
+ nSelPos = ( !IsRemoved_Impl( nNFEntry ) ) ? aCurEntryList.Count() : SELPOS_NONE;
+ }
+
+ rList.Insert( pStr,rList.Count());
+ aCurEntryList.Insert( nNFEntry, aCurEntryList.Count() );
+ }
+
+ if(nCurCategory!=NUMBERFORMAT_ALL)
+ {
+ pNumEntry = pCurFmtTable->First();
+ nCount = 0;
+ while ( pNumEntry )
+ {
+ sal_uInt32 nKey = pCurFmtTable->GetCurKey();
+
+ nCount++;
+
+ if ( !IsRemoved_Impl( nKey ))
+ {
+ sal_Bool bUserNewCurrency=sal_False;
+ if(pNumEntry->HasNewCurrency())
+ {
+ const NfCurrencyEntry* pTmpCurrencyEntry;
+ sal_Bool bTmpBanking;
+ XubString rSymbol;
+
+ pFormatter->GetNewCurrencySymbolString(nKey,rSymbol,
+ &pTmpCurrencyEntry,&bTmpBanking);
+
+ bUserNewCurrency=(pTmpCurrencyEntry!=NULL);
+ }
+
+ if(!bUserNewCurrency &&(pNumEntry->GetType() & NUMBERFORMAT_DEFINED))
+ {
+ nMyCat=pNumEntry->GetType() & ~NUMBERFORMAT_DEFINED;
+ aStrComment=pNumEntry->GetComment();
+ CategoryToPos_Impl(nMyCat,nMyType);
+ aNewFormNInfo= pNumEntry->GetFormatstring();
+
+ const StringPtr pStr = new String(aNewFormNInfo);
+
+ if ( nKey == nCurFormatKey ) nSelPos =aCurEntryList.Count();
+ rList.Insert( pStr,rList.Count());
+ aCurEntryList.Insert( nKey, aCurEntryList.Count() );
+ }
+ }
+ pNumEntry = pCurFmtTable->Next();
+ }
+ }
+ return nSelPos;
+}
+
+short SvxNumberFormatShell::FillEListWithUserCurrencys( SvStrings& rList,short nSelPos)
+{
+ /* Erstellen einer aktuellen Liste von Format-Eintraegen.
+ * Rueckgabewert ist die Listenposition des aktuellen Formates.
+ * Ist die Liste leer oder gibt es kein aktuelles Format,
+ * so wird SELPOS_NONE geliefert.
+ */
+ sal_uInt16 nMyType;
+
+ DBG_ASSERT( pCurFmtTable != NULL, "Unbekanntes Zahlenformat!" );
+
+ sal_uInt16 nCount = 0;
+ String aStrComment;
+ String aNewFormNInfo;
+ String aPrevString;
+ String a2PrevString;
+ short nMyCat = SELPOS_NONE;
+// short nIq=0;
+
+ const NfCurrencyEntry* pTmpCurrencyEntry;
+ sal_Bool bTmpBanking, bAdaptSelPos;
+ XubString rSymbol;
+ XubString rBankSymbol;
+
+ SvStrings aList;
+ SvULongs aKeyList;
+
+ /*sal_Bool bFlag=*/pFormatter->GetNewCurrencySymbolString(nCurFormatKey,rSymbol,
+ &pTmpCurrencyEntry,&bTmpBanking);
+
+ XubString rShortSymbol;
+
+ if(pCurCurrencyEntry==NULL)
+ {
+ // #110398# If no currency format was previously selected (we're not
+ // about to add another currency), try to select the initial currency
+ // format (nCurFormatKey) that was set in FormatChanged() after
+ // matching the format string entered in the dialog.
+ bAdaptSelPos = sal_True;
+ pCurCurrencyEntry=(NfCurrencyEntry*)pTmpCurrencyEntry;
+ bBankingSymbol=bTmpBanking;
+ nCurCurrencyEntryPos=FindCurrencyFormat(pTmpCurrencyEntry,bTmpBanking);
+ }
+ else
+ {
+ if (pTmpCurrencyEntry == pCurCurrencyEntry)
+ bAdaptSelPos = sal_True;
+ else
+ {
+ bAdaptSelPos = sal_False;
+ pTmpCurrencyEntry = pCurCurrencyEntry;
+ }
+ bTmpBanking=bBankingSymbol;
+ }
+
+ if(pTmpCurrencyEntry!=NULL)
+ {
+ pTmpCurrencyEntry->BuildSymbolString(rSymbol,sal_False);
+ pTmpCurrencyEntry->BuildSymbolString(rBankSymbol,sal_True);
+ pTmpCurrencyEntry->BuildSymbolString(rShortSymbol,bTmpBanking,sal_True);
+ }
+
+ const SvNumberformat* pNumEntry = pCurFmtTable->First();
+
+ while ( pNumEntry )
+ {
+ sal_uInt32 nKey = pCurFmtTable->GetCurKey();
+
+ nCount++;
+
+ if ( !IsRemoved_Impl( nKey ) )
+ {
+ if( pNumEntry->GetType() & NUMBERFORMAT_DEFINED ||
+ pNumEntry->IsAdditionalStandardDefined() )
+ {
+ nMyCat=pNumEntry->GetType() & ~NUMBERFORMAT_DEFINED;
+ aStrComment=pNumEntry->GetComment();
+ CategoryToPos_Impl(nMyCat,nMyType);
+ aNewFormNInfo= pNumEntry->GetFormatstring();
+
+ sal_Bool bInsFlag=sal_False;
+ if ( pNumEntry->HasNewCurrency() )
+ bInsFlag = sal_True; // merge locale formats into currency selection
+ else if( (!bTmpBanking && aNewFormNInfo.Search(rSymbol)!=STRING_NOTFOUND) ||
+ (bTmpBanking && aNewFormNInfo.Search(rBankSymbol)!=STRING_NOTFOUND) )
+ {
+ bInsFlag=sal_True;
+ }
+ else if(aNewFormNInfo.Search(rShortSymbol)!=STRING_NOTFOUND)
+ {
+ XubString rTstSymbol;
+ const NfCurrencyEntry* pTstCurrencyEntry;
+ sal_Bool bTstBanking;
+
+ /*sal_Bool bTstFlag=*/pFormatter->GetNewCurrencySymbolString(nKey,rTstSymbol,
+ &pTstCurrencyEntry,&bTstBanking);
+
+ if(pTmpCurrencyEntry==pTstCurrencyEntry && bTstBanking==bTmpBanking)
+ {
+ bInsFlag=sal_True;
+ }
+
+ }
+
+ if(bInsFlag)
+ {
+ const StringPtr pStr = new String(aNewFormNInfo);
+
+ aList.Insert( pStr,aList.Count());
+ aKeyList.Insert( nKey, aKeyList.Count() );
+ }
+ }
+ }
+ pNumEntry = pCurFmtTable->Next();
+ }
+
+ NfWSStringsDtor aWSStringsDtor;
+ sal_uInt16 nDefault;
+ if ( pTmpCurrencyEntry && nCurCategory != NUMBERFORMAT_ALL )
+ {
+ nDefault = pFormatter->GetCurrencyFormatStrings(
+ aWSStringsDtor, *pTmpCurrencyEntry, bTmpBanking );
+ if ( !bTmpBanking )
+ pFormatter->GetCurrencyFormatStrings(
+ aWSStringsDtor, *pTmpCurrencyEntry, sal_True );
+ }
+ else
+ nDefault = 0;
+ if ( !bTmpBanking && nCurCategory != NUMBERFORMAT_ALL )
+ { // append formats for all currencies defined in the current I18N locale
+ const NfCurrencyTable& rCurrencyTable = SvNumberFormatter::GetTheCurrencyTable();
+ sal_uInt16 nCurrCount = rCurrencyTable.Count();
+ LanguageType eLang = MsLangId::getRealLanguage( eCurLanguage );
+ for ( sal_uInt16 i=0; i < nCurrCount; ++i )
+ {
+ const NfCurrencyEntry* pCurr = rCurrencyTable[i];
+ if ( pCurr->GetLanguage() == eLang && pTmpCurrencyEntry != pCurr )
+ {
+ pFormatter->GetCurrencyFormatStrings( aWSStringsDtor, *pCurr, sal_False );
+ pFormatter->GetCurrencyFormatStrings( aWSStringsDtor, *pCurr, sal_True );
+ }
+ }
+ }
+
+ sal_uInt16 i,nPos;
+ sal_uInt16 nOldListCount = rList.Count();
+ for( i=0, nPos=nOldListCount; i<aWSStringsDtor.Count(); i++)
+ {
+ sal_Bool bFlag=sal_True;
+ String aInsStr(*aWSStringsDtor[i]);
+ sal_uInt16 j;
+ for(j=0;j<aList.Count();j++)
+ {
+ const StringPtr pTestStr=aList[j];
+
+ if(*pTestStr==aInsStr)
+ {
+ bFlag=sal_False;
+ break;
+ }
+ }
+ if(bFlag)
+ {
+ rList.Insert(new String(aInsStr),nPos);
+ aCurEntryList.Insert( NUMBERFORMAT_ENTRY_NOT_FOUND, nPos++);
+ }
+ else
+ {
+ rList.Insert(aList[j],nPos);
+ aList.Remove(j);
+ aCurEntryList.Insert( aKeyList[j],nPos++);
+ aKeyList.Remove(j);
+ }
+ }
+
+ for(i=0;i<aKeyList.Count();i++)
+ {
+ if(aKeyList[i]!=NUMBERFORMAT_ENTRY_NOT_FOUND)
+ {
+ rList.Insert(aList[i],rList.Count());
+ aCurEntryList.Insert( aKeyList[i],aCurEntryList.Count());
+ }
+ }
+
+ for(i=nOldListCount;i<rList.Count();i++)
+ {
+ aCurrencyFormatList.Insert(new String(*rList[i]),aCurrencyFormatList.Count());
+
+ if ( nSelPos == SELPOS_NONE && bAdaptSelPos && aCurEntryList[i] == nCurFormatKey )
+ nSelPos = i;
+ }
+
+ if ( nSelPos == SELPOS_NONE && nCurCategory != NUMBERFORMAT_ALL )
+ nSelPos = nDefault;
+
+ return nSelPos;
+}
+
+
+short SvxNumberFormatShell::FillEListWithUsD_Impl( SvStrings& rList, sal_uInt16 nPrivCat, short nSelPos)
+{
+ /* Erstellen einer aktuellen Liste von Format-Eintraegen.
+ * Rueckgabewert ist die Listenposition des aktuellen Formates.
+ * Ist die Liste leer oder gibt es kein aktuelles Format,
+ * so wird SELPOS_NONE geliefert.
+ */
+ sal_uInt16 nMyType;
+
+ DBG_ASSERT( pCurFmtTable != NULL, "Unbekanntes Zahlenformat!" );
+
+ const SvNumberformat* pNumEntry = pCurFmtTable->First();
+ sal_uInt16 nCount = 0;
+ String aStrComment;
+ String aNewFormNInfo;
+ String aPrevString;
+ String a2PrevString;
+
+ short nMyCat = SELPOS_NONE;
+// short nIq=0;
+ sal_Bool bAdditional = (nPrivCat != CAT_USERDEFINED &&
+ nCurCategory != NUMBERFORMAT_ALL);
+
+ while ( pNumEntry )
+ {
+ sal_uInt32 nKey = pCurFmtTable->GetCurKey();
+
+ nCount++;
+
+ if ( !IsRemoved_Impl( nKey ) )
+ {
+ if( (pNumEntry->GetType() & NUMBERFORMAT_DEFINED) ||
+ (bAdditional && pNumEntry->IsAdditionalStandardDefined()) )
+ {
+ nMyCat=pNumEntry->GetType() & ~NUMBERFORMAT_DEFINED;
+ aStrComment=pNumEntry->GetComment();
+ CategoryToPos_Impl(nMyCat,nMyType);
+ aNewFormNInfo= pNumEntry->GetFormatstring();
+
+ sal_Bool bFlag=sal_True;
+ if(pNumEntry->HasNewCurrency())
+ {
+ sal_Bool bTestBanking;
+ sal_uInt16 nPos=FindCurrencyTableEntry(aNewFormNInfo,bTestBanking);
+ bFlag=!IsInTable(nPos,bTestBanking,aNewFormNInfo);
+ }
+ if(bFlag)
+ {
+ const StringPtr pStr = new String(aNewFormNInfo);
+
+ if ( nKey == nCurFormatKey ) nSelPos =aCurEntryList.Count();
+ rList.Insert( pStr,rList.Count());
+ aCurEntryList.Insert( nKey, aCurEntryList.Count() );
+ }
+ }
+ }
+ pNumEntry = pCurFmtTable->Next();
+ }
+ return nSelPos;
+}
+
+
+// -----------------------------------------------------------------------
+
+void SvxNumberFormatShell::GetPreviewString_Impl( String& rString, Color*& rpColor )
+{
+ rpColor = NULL;
+
+ // #50441# if a string was set in addition to the value, use it for text formats
+ sal_Bool bUseText = ( eValType == SVX_VALUE_TYPE_STRING ||
+ ( aValStr.Len() && ( pFormatter->GetType(nCurFormatKey) & NUMBERFORMAT_TEXT ) ) );
+
+ if ( bUseText )
+ pFormatter->GetOutputString( aValStr, nCurFormatKey, rString, &rpColor );
+ else
+ pFormatter->GetOutputString( nValNum, nCurFormatKey, rString, &rpColor );
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxNumberFormatShell::IsRemoved_Impl( sal_uInt32 nKey )
+{
+ sal_Bool bFound = sal_False;
+ for ( sal_uInt16 i = 0; !bFound && i < aDelList.Count(); ++i )
+ if ( aDelList[i] == nKey )
+ bFound = sal_True;
+ return bFound;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxNumberFormatShell::IsAdded_Impl( sal_uInt32 nKey )
+{
+ sal_Bool bFound = sal_False;
+ for ( sal_uInt16 i = 0; !bFound && i < aAddList.Count(); ++i )
+ if ( aAddList[i] == nKey )
+ bFound = sal_True;
+ return bFound;
+}
+
+// -----------------------------------------------------------------------
+// Konvertierungs-Routinen:
+// ------------------------
+
+void SvxNumberFormatShell::PosToCategory_Impl( sal_uInt16 nPos, short& rCategory )
+{
+ // Kategorie ::com::sun::star::form-Positionen abbilden (->Resource)
+ switch ( nPos )
+ {
+ case CAT_USERDEFINED: rCategory = NUMBERFORMAT_DEFINED; break;
+ case CAT_NUMBER: rCategory = NUMBERFORMAT_NUMBER; break;
+ case CAT_PERCENT: rCategory = NUMBERFORMAT_PERCENT; break;
+ case CAT_CURRENCY: rCategory = NUMBERFORMAT_CURRENCY; break;
+ case CAT_DATE: rCategory = NUMBERFORMAT_DATE; break;
+ case CAT_TIME: rCategory = NUMBERFORMAT_TIME; break;
+ case CAT_SCIENTIFIC: rCategory = NUMBERFORMAT_SCIENTIFIC; break;
+ case CAT_FRACTION: rCategory = NUMBERFORMAT_FRACTION; break;
+ case CAT_BOOLEAN: rCategory = NUMBERFORMAT_LOGICAL; break;
+ case CAT_TEXT: rCategory = NUMBERFORMAT_TEXT; break;
+ case CAT_ALL:
+ default: rCategory = NUMBERFORMAT_ALL; break;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxNumberFormatShell::CategoryToPos_Impl( short nCategory, sal_uInt16& rPos )
+{
+ // Kategorie auf ::com::sun::star::form-Positionen abbilden (->Resource)
+ switch ( nCategory )
+ {
+ case NUMBERFORMAT_DEFINED: rPos = CAT_USERDEFINED; break;
+ case NUMBERFORMAT_NUMBER: rPos = CAT_NUMBER; break;
+ case NUMBERFORMAT_PERCENT: rPos = CAT_PERCENT; break;
+ case NUMBERFORMAT_CURRENCY: rPos = CAT_CURRENCY; break;
+ case NUMBERFORMAT_DATETIME:
+ case NUMBERFORMAT_DATE: rPos = CAT_DATE; break;
+ case NUMBERFORMAT_TIME: rPos = CAT_TIME; break;
+ case NUMBERFORMAT_SCIENTIFIC: rPos = CAT_SCIENTIFIC; break;
+ case NUMBERFORMAT_FRACTION: rPos = CAT_FRACTION; break;
+ case NUMBERFORMAT_LOGICAL: rPos = CAT_BOOLEAN; break;
+ case NUMBERFORMAT_TEXT: rPos = CAT_TEXT; break;
+ case NUMBERFORMAT_ALL:
+ default: rPos = CAT_ALL;
+ }
+}
+
+
+/*************************************************************************
+#* Member: MakePrevStringFromVal Datum:19.09.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberFormatShell
+#*
+#* Funktion: Formatiert die Zahl nValue abhaengig von rFormatStr
+#* und speichert das Ergebnis in rPreviewStr.
+#*
+#* Input: FormatString, Farbe, zu formatierende Zahl
+#*
+#* Output: Ausgabestring rPreviewStr
+#*
+#************************************************************************/
+
+void SvxNumberFormatShell::MakePrevStringFromVal(
+ const String& rFormatStr,
+ String& rPreviewStr,
+ Color*& rpFontColor,
+ double nValue)
+{
+ rpFontColor = NULL;
+ pFormatter->GetPreviewString( rFormatStr, nValue, rPreviewStr, &rpFontColor, eCurLanguage );
+}
+
+/*************************************************************************
+#* Member: GetComment4Entry Datum:30.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberFormatShell
+#*
+#* Funktion: Liefert den Kommentar fuer einen gegebenen
+#* Eintrag zurueck.
+#*
+#* Input: Nummer des Eintrags
+#*
+#* Output: Kommentar-String
+#*
+#************************************************************************/
+
+void SvxNumberFormatShell::SetComment4Entry(short nEntry,String aEntStr)
+{
+ SvNumberformat *pNumEntry;
+ if(nEntry<0) return;
+ sal_uInt32 nMyNfEntry=aCurEntryList[nEntry];
+ pNumEntry = (SvNumberformat*)pFormatter->GetEntry(nMyNfEntry);
+ if(pNumEntry!=NULL) pNumEntry->SetComment(aEntStr);
+}
+
+/*************************************************************************
+#* Member: GetComment4Entry Datum:30.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberFormatShell
+#*
+#* Funktion: Liefert den Kommentar fuer einen gegebenen
+#* Eintrag zurueck.
+#*
+#* Input: Nummer des Eintrags
+#*
+#* Output: Kommentar-String
+#*
+#************************************************************************/
+
+String SvxNumberFormatShell::GetComment4Entry(short nEntry)
+{
+ const SvNumberformat *pNumEntry;
+
+ if(nEntry < 0)
+ return String();
+
+ if(nEntry<aCurEntryList.Count())
+ {
+ sal_uInt32 nMyNfEntry=aCurEntryList[nEntry];
+ pNumEntry = pFormatter->GetEntry(nMyNfEntry);
+ if(pNumEntry!=NULL)
+ return pNumEntry->GetComment();
+ }
+
+ return String();
+}
+
+/*************************************************************************
+#* Member: GetCategory4Entry Datum:30.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberFormatShell
+#*
+#* Funktion: Liefert die Kategorie- Nummer fuer einen gegebenen
+#* Eintrag zurueck.
+#*
+#* Input: Nummer des Eintrags
+#*
+#* Output: Kategorie- Nummer
+#*
+#************************************************************************/
+
+short SvxNumberFormatShell::GetCategory4Entry(short nEntry)
+{
+ const SvNumberformat *pNumEntry;
+ if(nEntry<0) return 0;
+
+ if(nEntry<aCurEntryList.Count())
+ {
+ sal_uInt32 nMyNfEntry=aCurEntryList[nEntry];
+
+ if(nMyNfEntry!=NUMBERFORMAT_ENTRY_NOT_FOUND)
+ {
+ pNumEntry = pFormatter->GetEntry(nMyNfEntry);
+ sal_uInt16 nMyCat,nMyType;
+ if(pNumEntry!=NULL)
+ {
+ nMyCat=pNumEntry->GetType() & ~NUMBERFORMAT_DEFINED;
+ CategoryToPos_Impl(nMyCat,nMyType);
+
+ return (short) nMyType;
+ }
+ return 0;
+ }
+ else if(aCurrencyFormatList.Count()>0)
+ {
+ return CAT_CURRENCY;
+ }
+ }
+ return 0;
+
+}
+
+/*************************************************************************
+#* Member: GetUserDefined4Entry Datum:31.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberFormatShell
+#*
+#* Funktion: Liefert die Information, ob ein Eintrag
+#* benutzerspezifisch ist zurueck.
+#*
+#* Input: Nummer des Eintrags
+#*
+#* Output: Benutzerspezifisch?
+#*
+#************************************************************************/
+
+sal_Bool SvxNumberFormatShell::GetUserDefined4Entry(short nEntry)
+{
+ const SvNumberformat *pNumEntry;
+ if(nEntry<0) return 0;
+ if(nEntry<aCurEntryList.Count())
+ {
+ sal_uInt32 nMyNfEntry=aCurEntryList[nEntry];
+ pNumEntry = pFormatter->GetEntry(nMyNfEntry);
+
+ if(pNumEntry!=NULL)
+ {
+ if((pNumEntry->GetType() & NUMBERFORMAT_DEFINED)>0)
+ {
+ return sal_True;
+ }
+ }
+ }
+ return sal_False;
+}
+
+
+/*************************************************************************
+#* Member: GetFormat4Entry Datum:30.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberFormatShell
+#*
+#* Funktion: Liefert den Format- String fuer einen gegebenen
+#* Eintrag zurueck.
+#*
+#* Input: Nummer des Eintrags
+#*
+#* Output: Format- String
+#*
+#************************************************************************/
+
+String SvxNumberFormatShell::GetFormat4Entry(short nEntry)
+{
+ const SvNumberformat *pNumEntry;
+
+ if(nEntry < 0)
+ return String();
+
+ if(aCurrencyFormatList.Count()>0)
+ {
+ if(aCurrencyFormatList.Count()>nEntry)
+ return *aCurrencyFormatList[nEntry];
+ }
+ else
+ {
+ sal_uInt32 nMyNfEntry=aCurEntryList[nEntry];
+ pNumEntry = pFormatter->GetEntry(nMyNfEntry);
+
+ if(pNumEntry!=NULL)
+ return pNumEntry->GetFormatstring();
+ }
+ return String();
+}
+
+/*************************************************************************
+#* Member: GetListPos4Entry Datum:31.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvxNumberFormatShell
+#*
+#* Funktion: Liefert die Listen- Nummer fuer einen gegebenen
+#* Formatindex zurueck.
+#*
+#* Input: Nummer des Eintrags
+#*
+#* Output: Kategorie- Nummer
+#*
+#************************************************************************/
+
+short SvxNumberFormatShell::GetListPos4Entry(sal_uInt32 nIdx)
+{
+ short nSelP=SELPOS_NONE;
+ if( aCurEntryList.Count() <= 0x7fff )
+ {
+ for(short i=0;i<aCurEntryList.Count();i++)
+ {
+ if(aCurEntryList[i]==nIdx)
+ {
+ nSelP=i;
+ break;
+ }
+ }
+ }
+ else
+ {
+ DBG_ERROR("svx::SvxNumberFormatShell::GetListPos4Entry(), list got to large!" );
+ }
+ return nSelP;
+}
+
+short SvxNumberFormatShell::GetListPos4Entry( const String& rFmtString )
+{
+ sal_uInt32 nAt=0;
+ short nSelP=SELPOS_NONE;
+ if(FindEntry(rFmtString, &nAt))
+ {
+ if(NUMBERFORMAT_ENTRY_NOT_FOUND!=nAt && NUMBERFORMAT_ENTRY_NEW_CURRENCY!=nAt)
+ {
+ nSelP=GetListPos4Entry(nAt);
+ }
+ else
+ {
+ if(aCurrencyFormatList.Count()>0)
+ {
+ for(sal_uInt16 i=0;i<aCurrencyFormatList.Count();i++)
+ {
+ if (rFmtString==*aCurrencyFormatList[i])
+ {
+ nSelP=i;
+ break;
+ }
+ }
+ }
+ }
+ }
+ return nSelP;
+}
+
+String SvxNumberFormatShell::GetStandardName() const
+{
+ return pFormatter->GetStandardName( eCurLanguage);
+}
+
+void SvxNumberFormatShell::GetCurrencySymbols( SvStringsDtor& rList, sal_uInt16* pPos )
+{
+
+ const NfCurrencyEntry* pTmpCurrencyEntry=SvNumberFormatter::MatchSystemCurrency();
+
+ sal_Bool bFlag=(pTmpCurrencyEntry==NULL);
+
+ GetCurrencySymbols( rList, bFlag);
+
+ if(pPos!=NULL)
+ {
+ const NfCurrencyTable& rCurrencyTable=SvNumberFormatter::GetTheCurrencyTable();
+ sal_uInt16 nTableCount=rCurrencyTable.Count();
+
+ *pPos=0;
+ sal_uInt16 nCount=aCurCurrencyList.Count();
+
+ if(bFlag)
+ {
+ *pPos=1;
+ nCurCurrencyEntryPos=1;
+ }
+ else
+ {
+ for(sal_uInt16 i=1;i<nCount;i++)
+ {
+ const sal_uInt16 j = aCurCurrencyList[i];
+ if (j != (sal_uInt16)-1 && j < nTableCount &&
+ pTmpCurrencyEntry == rCurrencyTable[j])
+ {
+ *pPos=i;
+ nCurCurrencyEntryPos=i;
+ break;
+ }
+ }
+ }
+ }
+
+}
+
+void SvxNumberFormatShell::GetCurrencySymbols( SvStringsDtor& rList, sal_Bool bFlag )
+{
+ aCurCurrencyList.Remove(0,aCurCurrencyList.Count());
+
+ const NfCurrencyTable& rCurrencyTable=SvNumberFormatter::GetTheCurrencyTable();
+ sal_uInt16 nCount=rCurrencyTable.Count();
+
+ SvtLanguageTable* pLanguageTable=new SvtLanguageTable;
+
+ sal_uInt16 nStart=1;
+ sal_uInt16 i,j;
+
+ XubString aString( ApplyLreOrRleEmbedding( rCurrencyTable[0]->GetSymbol()));
+ aString += sal_Unicode(' ');
+ aString += ApplyLreOrRleEmbedding( pLanguageTable->GetString( rCurrencyTable[0]->GetLanguage()));
+
+ WSStringPtr pStr = new XubString(aString);
+ rList.Insert( pStr,rList.Count());
+ sal_uInt16 nAuto=(sal_uInt16)-1;
+ aCurCurrencyList.Insert(nAuto,aCurCurrencyList.Count());
+
+ if(bFlag)
+ {
+ pStr = new XubString(aString);
+ rList.Insert( pStr,rList.Count());
+ aCurCurrencyList.Insert((sal_uInt16)0,aCurCurrencyList.Count());
+ ++nStart;
+ }
+
+ CollatorWrapper aCollator( ::comphelper::getProcessServiceFactory());
+ aCollator.loadDefaultCollator( Application::GetSettings().GetLocale(), 0);
+
+ const String aTwoSpace( RTL_CONSTASCII_USTRINGPARAM( " "));
+
+ for(i=1;i<nCount;i++)
+ {
+ XubString aStr( ApplyLreOrRleEmbedding( rCurrencyTable[i]->GetBankSymbol()));
+ aStr += aTwoSpace;
+ aStr += ApplyLreOrRleEmbedding( rCurrencyTable[i]->GetSymbol());
+ aStr += aTwoSpace;
+ aStr += ApplyLreOrRleEmbedding( pLanguageTable->GetString( rCurrencyTable[i]->GetLanguage()));
+
+ pStr = new XubString(aStr);
+#if 0
+ fprintf( stderr, "currency entry: %s\n", ByteString( *pStr, RTL_TEXTENCODING_UTF8).GetBuffer());
+#endif
+ for(j=nStart;j<rList.Count();j++)
+ {
+ const StringPtr pTestStr=rList[j];
+ if (aCollator.compareString( *pStr, *pTestStr) < 0)
+ break; // insert before first greater than
+ }
+ rList.Insert( pStr,j);
+ aCurCurrencyList.Insert(i,j);
+ }
+
+ // Append ISO codes to symbol list.
+ // XXX If this is to be changed, various other places would had to be
+ // adapted that assume this order!
+ sal_uInt16 nCont = rList.Count();
+
+ for(i=1;i<nCount;i++)
+ {
+ bool bInsert = true;
+ pStr = new XubString( ApplyLreOrRleEmbedding( rCurrencyTable[i]->GetBankSymbol()));
+
+ for (j = nCont; j < rList.Count() && bInsert; ++j)
+ {
+ const StringPtr pTestStr=rList[j];
+
+ if(*pTestStr==*pStr)
+ bInsert = false;
+ else
+ if (aCollator.compareString( *pStr, *pTestStr) < 0)
+ break; // insert before first greater than
+ }
+ if(bInsert)
+ {
+ rList.Insert( pStr,j);
+ aCurCurrencyList.Insert(i,j);
+ }
+ }
+
+ delete pLanguageTable;
+}
+
+void SvxNumberFormatShell::GetCurrencyFormats(SvStrings& aListDtor)
+{
+ if(pCurCurrencyEntry!=NULL)
+ {
+ NfWSStringsDtor aWSStringsDtor;
+ /*sal_uInt16 nDefault = */pFormatter->GetCurrencyFormatStrings( aWSStringsDtor,
+ *pCurCurrencyEntry, bBankingSymbol );
+
+ for(sal_uInt16 i=0;i<aWSStringsDtor.Count();i++)
+ {
+ aListDtor.Insert(new String(*aWSStringsDtor[i]),aListDtor.Count());
+ }
+ }
+}
+
+sal_Bool SvxNumberFormatShell::IsBankingSymbol(sal_uInt16 nPos)
+{
+ const NfCurrencyTable& rCurrencyTable=SvNumberFormatter::GetTheCurrencyTable();
+ sal_uInt16 nCount=rCurrencyTable.Count();
+
+ return (nPos>nCount);
+}
+
+void SvxNumberFormatShell::SetCurrencySymbol(sal_uInt16 nPos)
+{
+ const NfCurrencyTable& rCurrencyTable=SvNumberFormatter::GetTheCurrencyTable();
+ sal_uInt16 nCount=rCurrencyTable.Count();
+
+ bBankingSymbol=(nPos>=nCount);
+
+ if(nPos<aCurCurrencyList.Count())
+ {
+ sal_uInt16 nCurrencyPos=aCurCurrencyList[nPos];
+ if(nCurrencyPos!=(sal_uInt16)-1)
+ {
+ pCurCurrencyEntry=rCurrencyTable[nCurrencyPos];
+ nCurCurrencyEntryPos=nPos;
+ }
+ else
+ {
+ pCurCurrencyEntry=NULL;
+ nCurCurrencyEntryPos=0;
+ nCurFormatKey=pFormatter->GetFormatIndex(
+ NF_CURRENCY_1000DEC2_RED, eCurLanguage);
+ }
+ }
+}
+
+sal_uInt32 SvxNumberFormatShell::GetCurrencySymbol()
+{
+ return nCurCurrencyEntryPos;
+}
+
+NfCurrencyEntry* SvxNumberFormatShell::GetCurCurrencyEntry()
+{
+ return pCurCurrencyEntry;
+}
+
+void SvxNumberFormatShell::SetCurCurrencyEntry(NfCurrencyEntry* pCEntry)
+{
+ pCurCurrencyEntry=pCEntry;
+}
+
+sal_Bool SvxNumberFormatShell::IsTmpCurrencyFormat( const String& rFmtString )
+{
+ sal_uInt32 nFound;
+ /*sal_Bool bRes=*/FindEntry(rFmtString, &nFound);
+
+ if(nFound==NUMBERFORMAT_ENTRY_NEW_CURRENCY)
+ {
+ return sal_True;
+ }
+ return sal_False;
+}
+
+sal_uInt16 SvxNumberFormatShell::FindCurrencyFormat( const String& rFmtString )
+{
+ const NfCurrencyTable& rCurrencyTable=SvNumberFormatter::GetTheCurrencyTable();
+ sal_uInt16 nCount=rCurrencyTable.Count();
+
+ sal_Bool bTestBanking=sal_False;
+
+ sal_uInt16 nPos=FindCurrencyTableEntry(rFmtString, bTestBanking);
+
+ sal_uInt16 nStart=0;
+
+ if(nPos!=(sal_uInt16)-1)
+ {
+ if(bTestBanking && aCurCurrencyList.Count()>nPos)
+ {
+ nStart=nCount;
+ }
+ for(sal_uInt16 j=nStart;j<aCurCurrencyList.Count();j++)
+ {
+ if(aCurCurrencyList[j]==nPos) return j;
+ }
+ }
+ return (sal_uInt16) -1;
+}
+
+sal_uInt16 SvxNumberFormatShell::FindCurrencyTableEntry( const String& rFmtString, sal_Bool &bTestBanking )
+{
+ sal_uInt16 nPos=(sal_uInt16) -1;
+
+ const NfCurrencyTable& rCurrencyTable=SvNumberFormatter::GetTheCurrencyTable();
+ sal_uInt16 nCount=rCurrencyTable.Count();
+
+ const SvNumberformat* pFormat;
+ String aSymbol, aExtension;
+ sal_uInt32 nFound = pFormatter->TestNewString( rFmtString, eCurLanguage );
+ if ( nFound != NUMBERFORMAT_ENTRY_NOT_FOUND &&
+ ((pFormat = pFormatter->GetEntry( nFound )) != 0) &&
+ pFormat->GetNewCurrencySymbol( aSymbol, aExtension ) )
+ { // eventually match with format locale
+ const NfCurrencyEntry* pTmpCurrencyEntry =
+ SvNumberFormatter::GetCurrencyEntry( bTestBanking, aSymbol, aExtension,
+ pFormat->GetLanguage() );
+ if ( pTmpCurrencyEntry )
+ {
+ for(sal_uInt16 i=0;i<nCount;i++)
+ {
+ if(pTmpCurrencyEntry==rCurrencyTable[i])
+ {
+ nPos=i;
+ break;
+ }
+ }
+ }
+ }
+ else
+ { // search symbol string only
+ for(sal_uInt16 i=0;i<nCount;i++)
+ {
+ const NfCurrencyEntry* pTmpCurrencyEntry=rCurrencyTable[i];
+ XubString _aSymbol, aBankSymbol;
+ pTmpCurrencyEntry->BuildSymbolString(_aSymbol,sal_False);
+ pTmpCurrencyEntry->BuildSymbolString(aBankSymbol,sal_True);
+
+ if(rFmtString.Search(_aSymbol)!=STRING_NOTFOUND)
+ {
+ bTestBanking=sal_False;
+ nPos=i;
+ break;
+ }
+ else if(rFmtString.Search(aBankSymbol)!=STRING_NOTFOUND)
+ {
+ bTestBanking=sal_True;
+ nPos=i;
+ break;
+ }
+ }
+ }
+
+ return nPos;
+}
+
+sal_uInt16 SvxNumberFormatShell::FindCurrencyFormat(const NfCurrencyEntry* pTmpCurrencyEntry,sal_Bool bTmpBanking)
+{
+ const NfCurrencyTable& rCurrencyTable=SvNumberFormatter::GetTheCurrencyTable();
+ sal_uInt16 nCount=rCurrencyTable.Count();
+
+// sal_Bool bTestBanking=sal_False;
+ sal_uInt16 nPos=0;
+ for(sal_uInt16 i=0;i<nCount;i++)
+ {
+ if(pTmpCurrencyEntry==rCurrencyTable[i])
+ {
+ nPos=i;
+ break;
+ }
+ }
+
+ sal_uInt16 nStart=0;
+ if(bTmpBanking && aCurCurrencyList.Count()>nPos)
+ {
+ nStart=nCount;
+ }
+ for(sal_uInt16 j=nStart;j<aCurCurrencyList.Count();j++)
+ {
+ if(aCurCurrencyList[j]==nPos) return j;
+ }
+ return (sal_uInt16) -1;
+}
+
+sal_Bool SvxNumberFormatShell::IsInTable(sal_uInt16 nPos,sal_Bool bTmpBanking,const String &rFmtString)
+{
+ sal_Bool bFlag=sal_False;
+
+ if(nPos!=(sal_uInt16)-1)
+ {
+ const NfCurrencyTable& rCurrencyTable=SvNumberFormatter::GetTheCurrencyTable();
+ sal_uInt16 nCount=rCurrencyTable.Count();
+
+ if(nPos<nCount)
+ {
+ NfWSStringsDtor aWSStringsDtor;
+ sal_uInt16 nDefault;
+
+ const NfCurrencyEntry* pTmpCurrencyEntry=rCurrencyTable[nPos];
+
+ if ( pTmpCurrencyEntry!=NULL)
+ {
+ nDefault = pFormatter->GetCurrencyFormatStrings( aWSStringsDtor,
+ *pTmpCurrencyEntry, bTmpBanking );
+
+ for(sal_uInt16 i=0;i<aWSStringsDtor.Count();i++)
+ {
+ if(*aWSStringsDtor[i]==rFmtString)
+ {
+ bFlag=sal_True;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return bFlag;
+}
+
diff --git a/svx/source/items/numinf.cxx b/svx/source/items/numinf.cxx
new file mode 100644
index 000000000000..b57bad8f2707
--- /dev/null
+++ b/svx/source/items/numinf.cxx
@@ -0,0 +1,250 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#define _SVX_NUMINF_CXX
+
+#include <svx/numinf.hxx>
+
+// -----------------------------------------------------------------------
+
+TYPEINIT1(SvxNumberInfoItem, SfxPoolItem);
+
+// class SvxNumberInfoItem -----------------------------------------------
+
+#define INIT(pNum,eVal,nDouble,rStr) \
+ SfxPoolItem ( nId ), \
+ \
+ pFormatter ( pNum ), \
+ eValueType ( eVal ), \
+ aStringVal ( rStr ), \
+ nDoubleVal ( nDouble ), \
+ pDelFormatArr ( NULL ), \
+ nDelCount ( 0 )
+
+SvxNumberInfoItem::SvxNumberInfoItem( const sal_uInt16 nId ) :
+
+ INIT( NULL, SVX_VALUE_TYPE_UNDEFINED, 0, String() )
+
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxNumberInfoItem::SvxNumberInfoItem( SvNumberFormatter* pNumFormatter,
+ const sal_uInt16 nId ) :
+
+ INIT( pNumFormatter, SVX_VALUE_TYPE_UNDEFINED, 0, String() )
+
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxNumberInfoItem::SvxNumberInfoItem( SvNumberFormatter* pNumFormatter,
+ const String& rVal, const sal_uInt16 nId ) :
+
+ INIT( pNumFormatter, SVX_VALUE_TYPE_STRING, 0, rVal )
+
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxNumberInfoItem::SvxNumberInfoItem( SvNumberFormatter* pNumFormatter,
+ const double& rVal, const sal_uInt16 nId ) :
+
+ INIT( pNumFormatter, SVX_VALUE_TYPE_NUMBER, rVal, String() )
+
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxNumberInfoItem::SvxNumberInfoItem( SvNumberFormatter* pNumFormatter,
+ const double& rVal, const String& rValueStr,
+ const sal_uInt16 nId ) :
+
+ INIT( pNumFormatter, SVX_VALUE_TYPE_NUMBER, rVal, rValueStr )
+
+{
+}
+
+#undef INIT
+
+// -----------------------------------------------------------------------
+
+SvxNumberInfoItem::SvxNumberInfoItem( const SvxNumberInfoItem& rItem ) :
+
+ SfxPoolItem( rItem.Which() ),
+
+ pFormatter ( rItem.pFormatter ),
+ eValueType ( rItem.eValueType ),
+ aStringVal ( rItem.aStringVal ),
+ nDoubleVal ( rItem.nDoubleVal ),
+ pDelFormatArr( NULL ),
+ nDelCount ( rItem.nDelCount )
+
+{
+ if ( rItem.nDelCount > 0 )
+ {
+ pDelFormatArr = new sal_uInt32[ rItem.nDelCount ];
+
+ for ( sal_uInt16 i = 0; i < rItem.nDelCount; ++i )
+ pDelFormatArr[i] = rItem.pDelFormatArr[i];
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SvxNumberInfoItem::~SvxNumberInfoItem()
+{
+ if ( pDelFormatArr )
+ delete []pDelFormatArr;
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxNumberInfoItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& rText, const IntlWrapper *
+) const
+{
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+// -----------------------------------------------------------------------
+
+int SvxNumberInfoItem::operator==( const SfxPoolItem& rItem ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal which or type" );
+
+ SvxNumberInfoItem& rOther = (SvxNumberInfoItem&)rItem;
+
+ sal_Bool bEqual = sal_False;
+
+ if ( nDelCount == rOther.nDelCount )
+ {
+ if ( nDelCount > 0 )
+ {
+ if ( pDelFormatArr != NULL && rOther.pDelFormatArr != NULL )
+ {
+ bEqual = sal_True;
+
+ for ( sal_uInt16 i = 0; i < nDelCount && bEqual; ++i )
+ bEqual = ( pDelFormatArr[i] == rOther.pDelFormatArr[i] );
+ }
+ }
+ else if ( nDelCount == 0 )
+ bEqual = ( pDelFormatArr == NULL && rOther.pDelFormatArr == NULL );
+
+ bEqual = bEqual &&
+ pFormatter == rOther.pFormatter &&
+ eValueType == rOther.eValueType &&
+ nDoubleVal == rOther.nDoubleVal &&
+ aStringVal == rOther.aStringVal;
+ }
+ return bEqual;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxNumberInfoItem::Clone( SfxItemPool * ) const
+{
+ return new SvxNumberInfoItem( *this );
+}
+
+// Laden/Speichern wird nicht gebraucht!
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxNumberInfoItem::Create( SvStream& /*rStream*/, sal_uInt16 ) const
+{
+ return new SvxNumberInfoItem( *this );
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SvxNumberInfoItem::Store( SvStream &rStream, sal_uInt16 /*nItemVersion*/ ) const
+{
+ return rStream;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxNumberInfoItem::SetNumberFormatter( SvNumberFormatter* pNumFormatter )
+{
+ pFormatter = pNumFormatter;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxNumberInfoItem::SetStringValue( const String& rNewVal )
+{
+ aStringVal = rNewVal;
+ eValueType = SVX_VALUE_TYPE_STRING;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxNumberInfoItem::SetDoubleValue( const double& rNewVal )
+{
+ nDoubleVal = rNewVal;
+ eValueType = SVX_VALUE_TYPE_NUMBER;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxNumberInfoItem::SetDelFormatArray( const sal_uInt32* pData,
+ const sal_uInt32 nCount )
+{
+ if ( pDelFormatArr )
+ {
+ delete []pDelFormatArr;
+ pDelFormatArr = NULL;
+ }
+
+ nDelCount = nCount;
+
+ if ( nCount > 0 )
+ {
+ pDelFormatArr = new sal_uInt32[ nCount ];
+
+ if ( pData != NULL )
+ {
+ for ( sal_uInt16 i = 0; i < nCount; ++i )
+ pDelFormatArr[i] = pData[i];
+ }
+ }
+}
+
+
diff --git a/svx/source/items/ofaitem.cxx b/svx/source/items/ofaitem.cxx
new file mode 100644
index 000000000000..75fc574be3b7
--- /dev/null
+++ b/svx/source/items/ofaitem.cxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svx/ofaitem.hxx"
+
+OfaPtrItem::OfaPtrItem( sal_uInt16 _nWhich, void *_pPtr )
+ : SfxPoolItem( _nWhich ), pPtr( _pPtr )
+{
+
+}
+OfaPtrItem::OfaPtrItem( const OfaPtrItem& rItem)
+ : SfxPoolItem( rItem.Which() ), pPtr( rItem.pPtr )
+{
+}
+
+int OfaPtrItem::operator==( const SfxPoolItem& rItem) const
+{
+ return ((OfaPtrItem&)rItem).pPtr == pPtr;
+}
+
+SfxPoolItem* OfaPtrItem::Clone( SfxItemPool * ) const
+{
+ return new OfaPtrItem( *this );
+}
+
+//---------------------------------------------------------------------------
+/*
+TYPEINIT1_FACTORY(DashListPtrItem, SvxDashListPtrItem, new DashListPtrItem(0));
+
+DashListPtrItem::DashListPtrItem( sal_uInt16 nWhich, SvxDashListItem* pPtr )
+ : OfaPtrItem( nWhich ), pPtr( pPtr )
+{
+}
+
+DashListPtrItem::DashListPtrItem( const DashListPtrItem& )
+ : OfaPtrItem( rItem.Which() ), pPtr( rItem.pPtr )
+{
+}
+
+int DashListPtrItem::operator==( const SfxPoolItem& rItem ) const
+{
+ return ((DashListPtrItem&)rItem).GetValue() == GetValue();
+}
+
+SfxPoolItem* DashListPtrItem::Clone( SfxItemPool *pPool ) const
+{
+ return new DashListPtrItem( *this );
+}
+
+sal_Bool DashListPtrItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const
+{
+}
+
+sal_Bool DashListPtrItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 )
+{
+ sal_Int64 nHyper;
+ if ( rVal >>= nHyper )
+ {
+ SetValue( (SvxDash
+ }
+
+ return sal_False;
+}
+*/
diff --git a/svx/source/items/pageitem.cxx b/svx/source/items/pageitem.cxx
new file mode 100644
index 000000000000..e05fee56ad52
--- /dev/null
+++ b/svx/source/items/pageitem.cxx
@@ -0,0 +1,338 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/stream.hxx>
+
+
+#include <svx/pageitem.hxx>
+#include <editeng/itemtype.hxx>
+#include <svx/unomid.hxx>
+#include <com/sun/star/style/PageStyleLayout.hpp>
+#include <com/sun/star/style/BreakType.hpp>
+#include <svl/itemset.hxx>
+#include <svx/svxitems.hrc>
+#include <svx/dialmgr.hxx>
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+// STATIC DATA -----------------------------------------------------------
+
+TYPEINIT1_FACTORY( SvxPageItem, SfxPoolItem , new SvxPageItem(0));
+
+/*--------------------------------------------------------------------
+ Beschreibung: Konstruktor
+ --------------------------------------------------------------------*/
+
+SvxPageItem::SvxPageItem( const sal_uInt16 nId ) : SfxPoolItem( nId ),
+
+ eNumType ( SVX_ARABIC ),
+ bLandscape ( sal_False ),
+ eUse ( SVX_PAGE_ALL )
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Copy-Konstruktor
+ --------------------------------------------------------------------*/
+
+SvxPageItem::SvxPageItem( const SvxPageItem& rItem )
+ : SfxPoolItem( rItem )
+{
+ eNumType = rItem.eNumType;
+ bLandscape = rItem.bLandscape;
+ eUse = rItem.eUse;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Clonen
+ --------------------------------------------------------------------*/
+
+SfxPoolItem* SvxPageItem::Clone( SfxItemPool * ) const
+{
+ return new SvxPageItem( *this );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Abfrage auf Gleichheit
+ --------------------------------------------------------------------*/
+
+int SvxPageItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
+ const SvxPageItem& rItem = (SvxPageItem&)rAttr;
+ return ( eNumType == rItem.eNumType &&
+ bLandscape == rItem.bLandscape &&
+ eUse == rItem.eUse );
+}
+
+inline XubString GetUsageText( const sal_uInt16 eU )
+{
+ if ( eU & SVX_PAGE_LEFT )
+ return SVX_RESSTR(RID_SVXITEMS_PAGE_USAGE_LEFT);
+ if ( eU & SVX_PAGE_RIGHT )
+ return SVX_RESSTR(RID_SVXITEMS_PAGE_USAGE_RIGHT);
+ if ( eU & SVX_PAGE_ALL )
+ return SVX_RESSTR(RID_SVXITEMS_PAGE_USAGE_ALL);
+ if ( eU & SVX_PAGE_MIRROR )
+ return SVX_RESSTR(RID_SVXITEMS_PAGE_USAGE_MIRROR);
+ return String();
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxPageItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ rText.Erase();
+
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ return SFX_ITEM_PRESENTATION_NONE;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ {
+ if ( aDescName.Len() )
+ {
+ rText = aDescName;
+ rText += cpDelim;
+ }
+ DBG_ASSERT( eNumType <= SVX_NUMBER_NONE, "enum overflow" );
+ rText += SVX_RESSTR(RID_SVXITEMS_PAGE_NUM_BEGIN + eNumType);
+ rText += cpDelim;
+ if ( bLandscape )
+ rText += SVX_RESSTR(RID_SVXITEMS_PAGE_LAND_TRUE);
+ else
+ rText += SVX_RESSTR(RID_SVXITEMS_PAGE_LAND_FALSE);
+ rText += GetUsageText( eUse );
+ return SFX_ITEM_PRESENTATION_NAMELESS;
+ }
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ rText += SVX_RESSTR(RID_SVXITEMS_PAGE_COMPLETE);
+ if ( aDescName.Len() )
+ {
+ rText += aDescName;
+ rText += cpDelim;
+ }
+ DBG_ASSERT( eNumType <= SVX_NUMBER_NONE, "enum overflow" );
+ rText += SVX_RESSTR(RID_SVXITEMS_PAGE_NUM_BEGIN + eNumType);
+ rText += cpDelim;
+ if ( bLandscape )
+ rText += SVX_RESSTR(RID_SVXITEMS_PAGE_LAND_TRUE);
+ else
+ rText += SVX_RESSTR(RID_SVXITEMS_PAGE_LAND_FALSE);
+ rText += GetUsageText( eUse );
+ return SFX_ITEM_PRESENTATION_COMPLETE;
+ }
+ default: ;//prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//------------------------------------------------------------------------
+sal_Bool SvxPageItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+ switch( nMemberId )
+ {
+ case MID_PAGE_NUMTYPE:
+ {
+ //! die Konstanten sind nicht mehr in den IDLs ?!?
+ rVal <<= (sal_Int16)( eNumType );
+ }
+ break;
+ case MID_PAGE_ORIENTATION:
+ //Landscape= sal_True
+ rVal = Bool2Any(bLandscape);
+ break;
+ case MID_PAGE_LAYOUT :
+ {
+ style::PageStyleLayout eRet;
+ switch(eUse & 0x0f)
+ {
+ case SVX_PAGE_LEFT : eRet = style::PageStyleLayout_LEFT; break;
+ case SVX_PAGE_RIGHT : eRet = style::PageStyleLayout_RIGHT; break;
+ case SVX_PAGE_ALL : eRet = style::PageStyleLayout_ALL; break;
+ case SVX_PAGE_MIRROR: eRet = style::PageStyleLayout_MIRRORED; break;
+ default:
+ DBG_ERROR("was fuer ein Layout ist das?");
+ return sal_False;
+ }
+ rVal <<= eRet;
+ }
+ break;
+ }
+
+ return sal_True;
+}
+//------------------------------------------------------------------------
+sal_Bool SvxPageItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
+{
+ switch( nMemberId )
+ {
+ case MID_PAGE_NUMTYPE:
+ {
+ sal_Int32 nValue = 0;
+ if(!(rVal >>= nValue))
+ return sal_False;
+
+ eNumType = (SvxNumType)nValue;
+ }
+ break;
+ case MID_PAGE_ORIENTATION:
+ bLandscape = Any2Bool(rVal);
+ break;
+ case MID_PAGE_LAYOUT :
+ {
+ style::PageStyleLayout eLayout;
+ if(!(rVal >>= eLayout))
+ {
+ sal_Int32 nValue = 0;
+ if(!(rVal >>= nValue))
+ return sal_False;
+ eLayout = (style::PageStyleLayout)nValue;
+ }
+ eUse &= 0xfff0;
+ switch( eLayout )
+ {
+ case style::PageStyleLayout_LEFT : eUse |= SVX_PAGE_LEFT ; break;
+ case style::PageStyleLayout_RIGHT : eUse |= SVX_PAGE_RIGHT; break;
+ case style::PageStyleLayout_ALL : eUse |= SVX_PAGE_ALL ; break;
+ case style::PageStyleLayout_MIRRORED: eUse |= SVX_PAGE_MIRROR;break;
+ default: ;//prevent warning
+ }
+ }
+ break;
+ }
+ return sal_True;
+}
+
+//------------------------------------------------------------------------
+
+SfxPoolItem* SvxPageItem::Create( SvStream& rStream, sal_uInt16 ) const
+{
+ XubString sStr;
+ sal_uInt8 eType;
+ sal_Bool bLand;
+ sal_uInt16 nUse;
+
+ // UNICODE: rStream >> sStr;
+ rStream.ReadByteString( sStr );
+
+ rStream >> eType;
+ rStream >> bLand;
+ rStream >> nUse;
+
+ SvxPageItem* pPage = new SvxPageItem( Which() );
+ pPage->SetDescName( sStr );
+ pPage->SetNumType( (SvxNumType)eType );
+ pPage->SetLandscape( bLand );
+ pPage->SetPageUsage( nUse );
+ return pPage;
+}
+
+//------------------------------------------------------------------------
+
+SvStream& SvxPageItem::Store( SvStream &rStrm, sal_uInt16 /*nItemVersion*/ ) const
+{
+ // UNICODE: rStrm << aDescName;
+ rStrm.WriteByteString(aDescName);
+
+ rStrm << (sal_uInt8)eNumType << bLandscape << eUse;
+ return rStrm;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: HeaderFooterSet
+ --------------------------------------------------------------------*/
+
+SvxSetItem::SvxSetItem( const sal_uInt16 nId, const SfxItemSet& rSet ) :
+
+ SfxSetItem( nId, rSet )
+{
+}
+
+SvxSetItem::SvxSetItem( const SvxSetItem& rItem ) :
+
+ SfxSetItem( rItem )
+{
+}
+
+SvxSetItem::SvxSetItem( const sal_uInt16 nId, SfxItemSet* _pSet ) :
+
+ SfxSetItem( nId, _pSet )
+{
+}
+
+SfxPoolItem* SvxSetItem::Clone( SfxItemPool * ) const
+{
+ return new SvxSetItem(*this);
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxSetItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+SfxPoolItem* SvxSetItem::Create(SvStream &rStrm, sal_uInt16 /*nVersion*/) const
+{
+ SfxItemSet* _pSet = new SfxItemSet( *GetItemSet().GetPool(),
+ GetItemSet().GetRanges() );
+
+ _pSet->Load( rStrm );
+
+ return new SvxSetItem( Which(), *_pSet );
+}
+
+SvStream& SvxSetItem::Store(SvStream &rStrm, sal_uInt16 nItemVersion) const
+{
+ GetItemSet().Store( rStrm, nItemVersion );
+
+ return rStrm;
+}
+
+
diff --git a/svx/source/items/postattr.cxx b/svx/source/items/postattr.cxx
new file mode 100644
index 000000000000..cab4207d56c5
--- /dev/null
+++ b/svx/source/items/postattr.cxx
@@ -0,0 +1,192 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#define _SVX_POSTATTR_CXX
+#include "svx/postattr.hxx"
+#include <editeng/itemtype.hxx>
+#include <svx/svxitems.hrc>
+#include <svx/dialmgr.hxx>
+
+// -----------------------------------------------------------------------
+
+TYPEINIT1_FACTORY(SvxPostItAuthorItem, SfxStringItem, new SvxPostItAuthorItem(0));
+TYPEINIT1_FACTORY(SvxPostItDateItem, SfxStringItem, new SvxPostItDateItem(0));
+TYPEINIT1_FACTORY(SvxPostItTextItem, SfxStringItem, new SvxPostItTextItem(0));
+
+// class SvxPostItAuthorItem ---------------------------------------------
+
+SvxPostItAuthorItem::SvxPostItAuthorItem( sal_uInt16 _nWhich )
+{
+ SetWhich( _nWhich );
+}
+
+// -----------------------------------------------------------------------
+
+SvxPostItAuthorItem::SvxPostItAuthorItem( const XubString& rAuthor,
+ sal_uInt16 _nWhich ) :
+ SfxStringItem( _nWhich, rAuthor )
+{
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxPostItAuthorItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ rText = GetValue();
+ return SFX_ITEM_PRESENTATION_NAMELESS;
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText = SVX_RESSTR(RID_SVXITEMS_AUTHOR_COMPLETE);
+ rText += GetValue();
+ return SFX_ITEM_PRESENTATION_COMPLETE;
+ default: ;//prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* __EXPORT SvxPostItAuthorItem::Clone( SfxItemPool * ) const
+{
+ return new SvxPostItAuthorItem( *this );
+}
+
+// class SvxPostItDateItem -----------------------------------------------
+
+SvxPostItDateItem::SvxPostItDateItem( sal_uInt16 _nWhich )
+{
+ SetWhich( _nWhich );
+}
+
+// -----------------------------------------------------------------------
+
+SvxPostItDateItem::SvxPostItDateItem( const XubString& rDate, sal_uInt16 _nWhich ) :
+
+ SfxStringItem( _nWhich, rDate )
+{
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxPostItDateItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ rText = GetValue();
+ return SFX_ITEM_PRESENTATION_NAMELESS;
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText = SVX_RESSTR(RID_SVXITEMS_DATE_COMPLETE);
+ rText += GetValue();
+ return SFX_ITEM_PRESENTATION_COMPLETE;
+ default: ;//prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* __EXPORT SvxPostItDateItem::Clone( SfxItemPool * ) const
+{
+ return new SvxPostItDateItem( *this );
+}
+
+// class SvxPostItTextItem -----------------------------------------------
+
+SvxPostItTextItem::SvxPostItTextItem( sal_uInt16 _nWhich )
+{
+ SetWhich( _nWhich );
+}
+
+// -----------------------------------------------------------------------
+
+SvxPostItTextItem::SvxPostItTextItem( const XubString& rText, sal_uInt16 _nWhich ) :
+
+ SfxStringItem( _nWhich, rText )
+{
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxPostItTextItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ rText = GetValue();
+ return SFX_ITEM_PRESENTATION_NAMELESS;
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText = SVX_RESSTR(RID_SVXITEMS_TEXT_COMPLETE);
+ rText += GetValue();
+ return SFX_ITEM_PRESENTATION_COMPLETE;
+ default: ;//prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* __EXPORT SvxPostItTextItem::Clone( SfxItemPool * ) const
+{
+ return new SvxPostItTextItem( *this );
+}
+
+
diff --git a/svx/source/items/rotmodit.cxx b/svx/source/items/rotmodit.cxx
new file mode 100644
index 000000000000..84f2853d9196
--- /dev/null
+++ b/svx/source/items/rotmodit.cxx
@@ -0,0 +1,178 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <tools/stream.hxx>
+#include <com/sun/star/table/BorderLine.hpp>
+#include <com/sun/star/table/CellVertJustify.hpp>
+#include <com/sun/star/table/ShadowLocation.hpp>
+#include <com/sun/star/table/TableBorder.hpp>
+#include <com/sun/star/table/ShadowFormat.hpp>
+#include <com/sun/star/table/CellRangeAddress.hpp>
+#include <com/sun/star/table/CellContentType.hpp>
+#include <com/sun/star/table/TableOrientation.hpp>
+#include <com/sun/star/table/CellHoriJustify.hpp>
+#include <com/sun/star/util/SortField.hpp>
+#include <com/sun/star/util/SortFieldType.hpp>
+#include <com/sun/star/table/CellOrientation.hpp>
+#include <com/sun/star/table/CellAddress.hpp>
+
+#include "svx/rotmodit.hxx"
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+// STATIC DATA -----------------------------------------------------------
+
+TYPEINIT1_FACTORY(SvxRotateModeItem, SfxEnumItem, new SvxRotateModeItem(SVX_ROTATE_MODE_STANDARD, 0));
+
+
+//-----------------------------------------------------------------------
+// SvxRotateModeItem - Ausrichtung bei gedrehtem Text
+//-----------------------------------------------------------------------
+
+SvxRotateModeItem::SvxRotateModeItem( SvxRotateMode eMode, sal_uInt16 _nWhich )
+ : SfxEnumItem( _nWhich, (sal_uInt16)eMode )
+{
+}
+
+SvxRotateModeItem::SvxRotateModeItem( const SvxRotateModeItem& rItem )
+ : SfxEnumItem( rItem )
+{
+}
+
+__EXPORT SvxRotateModeItem::~SvxRotateModeItem()
+{
+}
+
+SfxPoolItem* __EXPORT SvxRotateModeItem::Create( SvStream& rStream, sal_uInt16 ) const
+{
+ sal_uInt16 nVal;
+ rStream >> nVal;
+ return new SvxRotateModeItem( (SvxRotateMode) nVal,Which() );
+}
+
+SfxItemPresentation __EXPORT SvxRotateModeItem::GetPresentation(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/, SfxMapUnit /*ePresUnit*/,
+ String& rText, const IntlWrapper * ) const
+{
+ rText.Erase();
+
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText.AppendAscii("...");
+ rText.AppendAscii(": ");
+// break; // DURCHFALLEN!!!
+
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ rText += UniString::CreateFromInt32( GetValue() );
+ break;
+ default: ;//prevent warning
+ }
+
+ return ePres;
+}
+
+String __EXPORT SvxRotateModeItem::GetValueText( sal_uInt16 nVal ) const
+{
+ String aText;
+
+ switch ( nVal )
+ {
+ case SVX_ROTATE_MODE_STANDARD:
+ case SVX_ROTATE_MODE_TOP:
+ case SVX_ROTATE_MODE_CENTER:
+ case SVX_ROTATE_MODE_BOTTOM:
+ aText.AppendAscii("...");
+ break;
+ default:
+ DBG_ERROR("SvxRotateModeItem: falscher enum");
+ break;
+ }
+ return aText;
+}
+
+sal_uInt16 __EXPORT SvxRotateModeItem::GetValueCount() const
+{
+ return 4; // STANDARD, TOP, CENTER, BOTTOM
+}
+
+SfxPoolItem* __EXPORT SvxRotateModeItem::Clone( SfxItemPool* ) const
+{
+ return new SvxRotateModeItem( *this );
+}
+
+sal_uInt16 __EXPORT SvxRotateModeItem::GetVersion( sal_uInt16 /*nFileVersion*/ ) const
+{
+ return 0;
+}
+
+// QueryValue/PutValue: Der ::com::sun::star::table::CellVertJustify enum wird mitbenutzt...
+
+sal_Bool SvxRotateModeItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
+{
+ table::CellVertJustify eUno = table::CellVertJustify_STANDARD;
+ switch ( (SvxRotateMode)GetValue() )
+ {
+ case SVX_ROTATE_MODE_STANDARD: eUno = table::CellVertJustify_STANDARD; break;
+ case SVX_ROTATE_MODE_TOP: eUno = table::CellVertJustify_TOP; break;
+ case SVX_ROTATE_MODE_CENTER: eUno = table::CellVertJustify_CENTER; break;
+ case SVX_ROTATE_MODE_BOTTOM: eUno = table::CellVertJustify_BOTTOM; break;
+ }
+ rVal <<= eUno;
+ return sal_True;
+}
+
+sal_Bool SvxRotateModeItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
+{
+ table::CellVertJustify eUno;
+ if(!(rVal >>= eUno))
+ {
+ sal_Int32 nValue = 0;
+ if(!(rVal >>= nValue))
+ return sal_False;
+ eUno = (table::CellVertJustify)nValue;
+ }
+
+ SvxRotateMode eSvx = SVX_ROTATE_MODE_STANDARD;
+ switch (eUno)
+ {
+ case table::CellVertJustify_STANDARD: eSvx = SVX_ROTATE_MODE_STANDARD; break;
+ case table::CellVertJustify_TOP: eSvx = SVX_ROTATE_MODE_TOP; break;
+ case table::CellVertJustify_CENTER: eSvx = SVX_ROTATE_MODE_CENTER; break;
+ case table::CellVertJustify_BOTTOM: eSvx = SVX_ROTATE_MODE_BOTTOM; break;
+ default: ;//prevent warning
+ }
+ SetValue( (sal_uInt16)eSvx );
+ return sal_True;
+}
+
+
+
diff --git a/svx/source/items/svxempty.cxx b/svx/source/items/svxempty.cxx
new file mode 100644
index 000000000000..6d5d07184898
--- /dev/null
+++ b/svx/source/items/svxempty.cxx
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svxempty.hxx"
+
+// Statischer Empty-String -----------------------------------------------
+
+static XubString aImplSVXEmptyStr;
+XubString& rImplEmptyStr = aImplSVXEmptyStr;
+static String aImplSVXEmptySStr;
+String& rImplEmptySStr = aImplSVXEmptySStr;
+
+
diff --git a/svx/source/items/svxerr.cxx b/svx/source/items/svxerr.cxx
new file mode 100644
index 000000000000..89b4266a1339
--- /dev/null
+++ b/svx/source/items/svxerr.cxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+
+#include "svx/svxerr.hxx"
+#include <svx/dialmgr.hxx>
+
+#include <svx/dialogs.hrc>
+
+static SvxErrorHandler* pHandler=NULL;
+
+SvxErrorHandler::SvxErrorHandler() :
+
+ SfxErrorHandler(
+ RID_SVXERRCODE, ERRCODE_AREA_SVX, ERRCODE_AREA_SVX_END, &DIALOG_MGR() )
+{
+ pHandler = this;
+}
+
+void SvxErrorHandler::Get()
+{
+ if ( !pHandler )
+ new SvxErrorHandler;
+}
+
diff --git a/svx/source/items/svxerr.src b/svx/source/items/svxerr.src
new file mode 100644
index 000000000000..890e5687021d
--- /dev/null
+++ b/svx/source/items/svxerr.src
@@ -0,0 +1,174 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ---------------------------------------------------------------
+#define __RSC
+#include "svx/svxerr.hxx"
+#include <svx/dialogs.hrc>
+#include <editeng/editerr.hxx>
+
+ // pragma ----------------------------------------------------------------
+
+ // Error-Context ---------------------------------------------------------
+Resource RID_SVXERRCTX
+{
+ String ERRCTX_SVX_LINGU_THESAURUS&ERRCODE_RES_MASK
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? $(ERR) beim Ausführen des Thesaurus. : $(ERR) beim Ausf³hren des Thesaurus. */
+ /* ### ACHTUNG: Neuer Text in Resource? $(ERR) beim Ausführen des Thesaurus. : $(ERR) beim Ausf³hren des Thesaurus. */
+ Text [ en-US ] = "$(ERR) executing the thesaurus." ;
+ };
+ String ERRCTX_SVX_LINGU_SPELLING&ERRCODE_RES_MASK
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? $(ERR) bei der Ausführung der Rechtschreibprüfung. : $(ERR) bei der Ausf³hrung der Rechtschreibpr³fung. */
+ /* ### ACHTUNG: Neuer Text in Resource? $(ERR) bei der Ausführung der Rechtschreibprüfung. : $(ERR) bei der Ausf³hrung der Rechtschreibpr³fung. */
+ Text [ en-US ] = "$(ERR) executing the spellcheck." ;
+ };
+ String ERRCTX_SVX_LINGU_HYPHENATION&ERRCODE_RES_MASK
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? $(ERR) bei der Ausführung der Trennhilfe. : $(ERR) bei der Ausf³hrung der Trennhilfe. */
+ /* ### ACHTUNG: Neuer Text in Resource? $(ERR) bei der Ausführung der Trennhilfe. : $(ERR) bei der Ausf³hrung der Trennhilfe. */
+ Text [ en-US ] = "$(ERR) executing the hyphenation." ;
+ };
+ String ERRCTX_SVX_LINGU_DICTIONARY&ERRCODE_RES_MASK
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? $(ERR) beim Anlegen eines Wörterbuches. : $(ERR) beim Anlegen eines W÷rterbuches. */
+ /* ### ACHTUNG: Neuer Text in Resource? $(ERR) beim Anlegen eines Wörterbuches. : $(ERR) beim Anlegen eines W÷rterbuches. */
+ Text [ en-US ] = "$(ERR) creating a dictionary." ;
+ };
+ String ERRCTX_SVX_BACKGROUND&ERRCODE_RES_MASK
+ {
+ Text [ en-US ] = "$(ERR) setting background attribute." ;
+ };
+ String ERRCTX_SVX_IMPORT_GRAPHIC&ERRCODE_RES_MASK
+ {
+ Text [ en-US ] = "$(ERR) loading the graphics." ;
+ };
+};
+ // Error-Code ------------------------------------------------------------
+Resource RID_SVXERRCODE
+{
+ String ERRCODE_SVX_LINGU_THESAURUSNOTEXISTS&ERRCODE_RES_MASK
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Ein Thesaurus für die eingestellte Sprache ist nicht verfügbar.\nÜberprüfen Sie bitte Ihre Installation und installieren Sie gegebenenfalls die gewünschte Sprache : Ein Thesaurus f³r die eingestellte Sprache ist nicht verf³gbar.\nšberpr³fen Sie bitte Ihre Installation und installieren Sie gegebenenfalls die gew³nschte Sprache */
+ /* ### ACHTUNG: Neuer Text in Resource? Ein Thesaurus für die eingestellte Sprache ist nicht verfügbar.\nÜberprüfen Sie bitte Ihre Installation und installieren Sie gegebenenfalls die gewünschte Sprache : Ein Thesaurus f³r die eingestellte Sprache ist nicht verf³gbar.\nšberpr³fen Sie bitte Ihre Installation und installieren Sie gegebenenfalls die gew³nschte Sprache */
+ Text [ en-US ] = "No thesaurus available for the current language.\nPlease check your installation and install the desired language." ;
+ };
+ String ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS&ERRCODE_RES_MASK
+ {
+ Text [ en-US ] = "$(ARG1) is not supported by the spellcheck function or is not presently active.\nPlease check your installation and, if necessary, install the required language module\n or activate it under 'Tools - Options - Language Settings - Writing Aids'.";
+ };
+ String ERRCODE_SVX_LINGU_LINGUNOTEXISTS&ERRCODE_RES_MASK
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Die Rechtschreibprüfung ist nicht verfügbar. : Die Rechtschreibpr³fung ist nicht verf³gbar. */
+ /* ### ACHTUNG: Neuer Text in Resource? Die Rechtschreibprüfung ist nicht verfügbar. : Die Rechtschreibpr³fung ist nicht verf³gbar. */
+ Text [ en-US ] = "Spellcheck is not available." ;
+ };
+ String ERRCODE_SVX_LINGU_HYPHENNOTEXISTS&ERRCODE_RES_MASK
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Die Trennhilfe ist nicht verfügbar. : Die Trennhilfe ist nicht verf³gbar. */
+ /* ### ACHTUNG: Neuer Text in Resource? Die Trennhilfe ist nicht verfügbar. : Die Trennhilfe ist nicht verf³gbar. */
+ Text [ en-US ] = "Hyphenation not available." ;
+ };
+ String ERRCODE_SVX_LINGU_DICT_NOTREADABLE&ERRCODE_RES_MASK
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Das persönliche Wörterbuch $(ARG1) kann nicht gelesen werden. : Das pers÷nliche W÷rterbuch $(ARG1) kann nicht gelesen werden. */
+ /* ### ACHTUNG: Neuer Text in Resource? Das persönliche Wörterbuch $(ARG1) kann nicht gelesen werden. : Das pers÷nliche W÷rterbuch $(ARG1) kann nicht gelesen werden. */
+ Text [ en-US ] = "The custom dictionary $(ARG1) cannot be read." ;
+ };
+ String ERRCODE_SVX_LINGU_DICT_NOTWRITEABLE&ERRCODE_RES_MASK
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Das persönliche Wörterbuch $(ARG1) kann nicht angelegt werden. : Das pers÷nliche W÷rterbuch $(ARG1) kann nicht angelegt werden. */
+ /* ### ACHTUNG: Neuer Text in Resource? Das persönliche Wörterbuch $(ARG1) kann nicht angelegt werden. : Das pers÷nliche W÷rterbuch $(ARG1) kann nicht angelegt werden. */
+ Text [ en-US ] = "The custom dictionary $(ARG1) cannot be created." ;
+ };
+ String ERRCODE_SVX_GRAPHIC_NOTREADABLE&ERRCODE_RES_MASK
+ {
+ Text [ en-US ] = "The graphic $(ARG1) could not be found." ;
+ };
+ String ERRCODE_SVX_GRAPHIC_WRONG_FILEFORMAT&ERRCODE_RES_MASK
+ {
+ Text [ en-US ] = "An unlinked graphic could not be loaded.";
+ };
+ String ERRCODE_SVX_LINGU_NOLANGUAGE&ERRCODE_RES_MASK
+ {
+ Text [ en-US ] = "A language has not been fixed for the selected term.";
+ };
+ String (ERRCODE_SVX_FORMS_NOIOSERVICES | ERRCODE_CLASS_READ) & ERRCODE_RES_MASK
+ {
+ Text [ en-US ] = "The form layer wasn't loaded as the required IO-services (stardiv.uno.io.*) could not be instantiated.";
+ };
+ String (ERRCODE_SVX_FORMS_NOIOSERVICES | ERRCODE_CLASS_WRITE) & ERRCODE_RES_MASK
+ {
+ Text [ en-US ] = "The form layer wasn't written as the required IO services (stardiv.uno.io.*) could not be instantiated.";
+ };
+ String (ERRCODE_SVX_FORMS_READWRITEFAILED | ERRCODE_CLASS_READ) & ERRCODE_RES_MASK
+ {
+ Text [ en-US ] = "An error occurred while reading the form controls. The form layer has not been loaded.";
+ };
+ String (ERRCODE_SVX_FORMS_READWRITEFAILED | ERRCODE_CLASS_WRITE) & ERRCODE_RES_MASK
+ {
+ Text [ en-US ] = "An error occurred while writing the form controls. The form layer has not been saved.";
+ };
+ String (ERRCODE_SVX_BULLETITEM_NOBULLET | ERRCODE_CLASS_READ) & ERRCODE_RES_MASK
+ {
+ Text [ en-US ] = "An error occurred while reading one of the bullets. Not all of the bullets were loaded.";
+ };
+
+ String ERRCODE_SVX_MODIFIED_VBASIC_STORAGE & ERRCODE_RES_MASK
+ {
+// TEXT = "Der Basic-Code wurde verändert und kann somit nicht mehr als Original gespeichert werden." ;
+// TEXT [ English ] = "The Basic-Code is modified and so it can not be saved as original." ;
+ Text [ en-US ] = "All changes to the Basic Code are lost.The original VBA Macro Code is saved instead.";
+ };
+
+ String ERRCODE_SVX_VBASIC_STORAGE_EXIST & ERRCODE_RES_MASK
+ {
+ Text [ en-US ] = "The original VBA Basic Code contained in the document will not be saved.";
+ };
+
+ String ERRCODE_SVX_WRONGPASS & ERRCODE_RES_MASK
+ {
+ Text [ en-US ] = "The password is incorrect. The document cannot be opened.";
+ };
+
+ String ERRCODE_SVX_READ_FILTER_CRYPT & ERRCODE_RES_MASK
+ {
+ Text [ en-US ] = "The encryption method used in this document is not supported. Only Microsoft Office 97/2000 compatible password encryption is supported.";
+ };
+
+ String ERRCODE_SVX_READ_FILTER_PPOINT & ERRCODE_RES_MASK
+ {
+ Text [ en-US ] = "The loading of password-encrypted Microsoft PowerPoint presentations is not supported.";
+ };
+
+ String ERRCODE_SVX_EXPORT_FILTER_CRYPT & ERRCODE_RES_MASK
+ {
+ Text [ en-US ] = "Password protection is not supported when documents are saved in a Microsoft Office format.\nDo you want to save the document without password protection?";
+ };
+};
+ // ********************************************************************** EOF
+
diff --git a/svx/source/items/svxitems.src b/svx/source/items/svxitems.src
new file mode 100644
index 000000000000..d80f871d8b3c
--- /dev/null
+++ b/svx/source/items/svxitems.src
@@ -0,0 +1,393 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ------------------------------------------------------------------
+
+#include "svx/svxitems.hrc"
+#include "svx/svxids.hrc"
+#include <editeng/editids.hrc>
+
+StringArray RID_ATTR_NAMES
+{
+ ItemList [ en-US ] =
+ {
+ < "Scale" ; SID_ATTR_ZOOM ; > ;
+ < "Brush" ; SID_ATTR_BRUSH ; > ;
+ < "Tab stops" ; SID_ATTR_TABSTOP ; > ;
+ < "Character" ; SID_ATTR_CHAR ; > ;
+ < "Font" ; SID_ATTR_CHAR_FONT ; > ;
+ < "Font posture" ; SID_ATTR_CHAR_POSTURE ; > ;
+ < "Font weight" ; SID_ATTR_CHAR_WEIGHT ; > ;
+ < "Shadowed" ; SID_ATTR_CHAR_SHADOWED ; > ;
+ < "Individual words" ; SID_ATTR_CHAR_WORDLINEMODE ; > ;
+ < "Outline" ; SID_ATTR_CHAR_CONTOUR ; > ;
+ < "Strikethrough" ; SID_ATTR_CHAR_STRIKEOUT ; > ;
+ < "Underline" ; SID_ATTR_CHAR_UNDERLINE ; > ;
+ < "Font size" ; SID_ATTR_CHAR_FONTHEIGHT ; > ;
+ < "Rel. Font size" ; SID_ATTR_CHAR_PROPSIZE ; > ;
+ < "Font color" ; SID_ATTR_CHAR_COLOR ; > ;
+ < "Kerning" ; SID_ATTR_CHAR_KERNING ; > ;
+ < "Effects" ; SID_ATTR_CHAR_CASEMAP ; > ;
+ < "Language"; SID_ATTR_CHAR_LANGUAGE ; > ;
+ < "Position" ; SID_ATTR_CHAR_ESCAPEMENT ; > ;
+ < "Blinking" ; SID_ATTR_CHAR_AUTOKERN ; > ;
+ < "Character set color" ; SID_ATTR_CHAR_CHARSETCOLOR ; > ;
+ < "Overline" ; SID_ATTR_CHAR_OVERLINE ; > ;
+ < "Paragraph" ; SID_ATTR_PARA ; > ;
+ < "Alignment" ; SID_ATTR_PARA_ADJUST ; > ;
+ < "Line spacing" ; SID_ATTR_PARA_LINESPACE ; > ;
+ < "Page Break" ; SID_ATTR_PARA_PAGEBREAK ; > ;
+ < "Hyphenation" ; SID_ATTR_PARA_HYPHENZONE ; > ;
+ < "Do not split paragraph"; SID_ATTR_PARA_SPLIT ; > ;
+ < "Orphans" ; SID_ATTR_PARA_ORPHANS ; > ;
+ < "Widows" ; SID_ATTR_PARA_WIDOWS ; > ;
+ < "Spacing" ; SID_ATTR_PARA_ULSPACE ; > ;
+ < "Indent" ; SID_ATTR_PARA_LRSPACE ; > ;
+ < "Indent" ; SID_ATTR_LRSPACE ; > ;
+ < "Spacing" ; SID_ATTR_ULSPACE ; > ;
+ < "Page" ; SID_ATTR_PAGE ; > ;
+ < "Page Style" ; SID_ATTR_PARA_MODEL ; > ;
+ < "Keep with next paragraph"; SID_ATTR_PARA_KEEP ; > ;
+ < "Blinking" ; SID_ATTR_FLASH ; > ;
+ < "Register-true" ; SID_ATTR_PARA_REGISTER ; > ;
+ < "Character background" ; SID_ATTR_BRUSH_CHAR ; > ;
+ < "Asian font" ; SID_ATTR_CHAR_CJK_FONT ; > ;
+ < "Size of Asian font" ; SID_ATTR_CHAR_CJK_FONTHEIGHT ; > ;
+ < "Language of Asian font"; SID_ATTR_CHAR_CJK_LANGUAGE ; > ;
+ < "Posture of Asian font" ; SID_ATTR_CHAR_CJK_POSTURE ; > ;
+ < "Weight of Asian font" ; SID_ATTR_CHAR_CJK_WEIGHT ; > ;
+ < "CTL" ; SID_ATTR_CHAR_CTL_FONT ; > ;
+ < "Size of complex scripts" ; SID_ATTR_CHAR_CTL_FONTHEIGHT ; > ;
+ < "Language of complex scripts";SID_ATTR_CHAR_CTL_LANGUAGE ; > ;
+ < "Posture of complex scripts"; SID_ATTR_CHAR_CTL_POSTURE ; > ;
+ < "Weight of complex scripts"; SID_ATTR_CHAR_CTL_WEIGHT ; > ;
+ < "Double-lined" ; SID_ATTR_CHAR_TWO_LINES ; > ;
+ < "Emphasis mark" ; SID_ATTR_CHAR_EMPHASISMARK ; > ;
+ < "Text spacing" ; SID_ATTR_PARA_SCRIPTSPACE ; > ;
+ < "Hanging punctuation" ; SID_ATTR_PARA_HANGPUNCTUATION ; > ;
+ < "Forbidden characters" ; SID_ATTR_PARA_FORBIDDEN_RULES ; > ;
+ < "Rotation" ; SID_ATTR_CHAR_ROTATED ; > ;
+ < "Scale" ; SID_ATTR_CHAR_SCALEWIDTH ; > ;
+ < "Relief" ; SID_ATTR_CHAR_RELIEF ; > ;
+ < "Vertical text alignment" ; SID_PARA_VERTALIGN ; > ;
+ };
+};
+
+
+String RID_SVXITEMS_EXTRAS_CHARCOLOR
+{
+ Text [ en-US ] = "Font color" ;
+};
+ // SvxSearchItem ------------------------------------------------------------
+ // Kommando
+String RID_SVXITEMS_SEARCHCMD_FIND
+{
+ Text [ en-US ] = "Search" ;
+};
+String RID_SVXITEMS_SEARCHCMD_FIND_ALL
+{
+ Text [ en-US ] = "Find All" ;
+};
+String RID_SVXITEMS_SEARCHCMD_REPLACE
+{
+ Text [ en-US ] = "Replace" ;
+};
+String RID_SVXITEMS_SEARCHCMD_REPLACE_ALL
+{
+ Text [ en-US ] = "Replace all" ;
+};
+ // Vorlagen
+String RID_SVXITEMS_SEARCHSTYL_CHAR
+{
+ Text [ en-US ] = "Character Style" ;
+};
+String RID_SVXITEMS_SEARCHSTYL_PARA
+{
+ Text [ en-US ] = "Paragraph Style" ;
+};
+String RID_SVXITEMS_SEARCHSTYL_FRAME
+{
+ Text [ en-US ] = "Frame Style" ;
+};
+String RID_SVXITEMS_SEARCHSTYL_PAGE
+{
+ Text [ en-US ] = "Page Style" ;
+};
+ // Zellen-Typ
+String RID_SVXITEMS_SEARCHIN_FORMULA
+{
+ Text [ en-US ] = "Formula" ;
+};
+String RID_SVXITEMS_SEARCHIN_VALUE
+{
+ Text [ en-US ] = "Value" ;
+};
+String RID_SVXITEMS_SEARCHIN_NOTE
+{
+ Text [ en-US ] = "Note" ;
+};
+ // Applikation
+String RID_SVXITEMS_SEARCHAPP_WRITER
+{
+ Text = "StarWriter" ;
+};
+String RID_SVXITEMS_SEARCHAPP_CALC
+{
+ Text = "StarCalc" ;
+};
+String RID_SVXITEMS_SEARCHAPP_DRAW
+{
+ Text = "StarDraw" ;
+};
+String RID_SVXITEMS_SEARCHAPP_BASE
+{
+ Text = "StarBase" ;
+};
+ // enum BrushStyle ----------------------------------------------------------
+String RID_SVXITEMS_BRUSHSTYLE_NULL
+{
+ Text [ en-US ] = "None" ;
+};
+String RID_SVXITEMS_BRUSHSTYLE_SOLID
+{
+ Text [ en-US ] = "Solid" ;
+};
+String RID_SVXITEMS_BRUSHSTYLE_HORZ
+{
+ Text [ en-US ] = "Horizontal" ;
+};
+String RID_SVXITEMS_BRUSHSTYLE_VERT
+{
+ Text [ en-US ] = "Vertical" ;
+};
+String RID_SVXITEMS_BRUSHSTYLE_CROSS
+{
+ Text [ en-US ] = "Grid" ;
+};
+String RID_SVXITEMS_BRUSHSTYLE_DIAGCROSS
+{
+ Text [ en-US ] = "Diamond" ;
+};
+String RID_SVXITEMS_BRUSHSTYLE_UPDIAG
+{
+ Text [ en-US ] = "Diagonal up" ;
+};
+String RID_SVXITEMS_BRUSHSTYLE_DOWNDIAG
+{
+ Text [ en-US ] = "Diagonal down" ;
+};
+String RID_SVXITEMS_BRUSHSTYLE_25
+{
+ Text = "25%" ;
+};
+String RID_SVXITEMS_BRUSHSTYLE_50
+{
+ Text = "50%" ;
+};
+String RID_SVXITEMS_BRUSHSTYLE_75
+{
+ Text = "75%" ;
+};
+String RID_SVXITEMS_BRUSHSTYLE_BITMAP
+{
+ Text [ en-US ] = "Image" ;
+};
+
+String RID_SVXITEMS_HORJUST_STANDARD
+{
+ Text [ en-US ] = "Horizontal alignment default" ;
+};
+String RID_SVXITEMS_HORJUST_LEFT
+{
+ Text [ en-US ] = "Align left" ;
+};
+String RID_SVXITEMS_HORJUST_CENTER
+{
+ Text [ en-US ] = "Centered horizontally" ;
+};
+String RID_SVXITEMS_HORJUST_RIGHT
+{
+ Text [ en-US ] = "Align right" ;
+};
+String RID_SVXITEMS_HORJUST_BLOCK
+{
+ Text [ en-US ] = "Justify" ;
+};
+String RID_SVXITEMS_HORJUST_REPEAT
+{
+ Text [ en-US ] = "Repeat alignment" ;
+};
+String RID_SVXITEMS_VERJUST_STANDARD
+{
+ Text [ en-US ] = "Vertical alignment default" ;
+};
+String RID_SVXITEMS_VERJUST_TOP
+{
+ Text [ en-US ] = "Align to top" ;
+};
+String RID_SVXITEMS_VERJUST_CENTER
+{
+ Text [ en-US ] = "Centered vertically" ;
+};
+String RID_SVXITEMS_VERJUST_BOTTOM
+{
+ Text [ en-US ] = "Align to bottom" ;
+};
+String RID_SVXITEMS_ORI_STANDARD
+{
+ Text [ en-US ] = "Default orientation" ;
+};
+String RID_SVXITEMS_ORI_TOPBOTTOM
+{
+ Text [ en-US ] = "From top to bottom" ;
+};
+String RID_SVXITEMS_ORI_BOTTOMTOP
+{
+ Text [ en-US ] = "Bottom to Top" ;
+};
+String RID_SVXITEMS_ORI_STACKED
+{
+ Text [ en-US ] = "Stacked" ;
+};
+ // GetValueText von BoolItems
+String RID_SVXITEMS_BOXINF_TABLE_TRUE
+{
+ Text [ en-US ] = "Table" ;
+};
+String RID_SVXITEMS_BOXINF_TABLE_FALSE
+{
+ Text [ en-US ] = "Not Table" ;
+};
+String RID_SVXITEMS_BOXINF_DIST_TRUE
+{
+ Text [ en-US ] = "Spacing enabled" ;
+};
+String RID_SVXITEMS_BOXINF_DIST_FALSE
+{
+ Text [ en-US ] = "Spacing disabled" ;
+};
+String RID_SVXITEMS_BOXINF_MDIST_TRUE
+{
+ Text [ en-US ] = "Keep spacing interval" ;
+};
+String RID_SVXITEMS_BOXINF_MDIST_FALSE
+{
+ Text [ en-US ] = "Allowed to fall short of spacing interval" ;
+};
+String RID_SVXITEMS_MARGIN_LEFT
+{
+ Text [ en-US ] = "Left margin: " ;
+};
+String RID_SVXITEMS_MARGIN_TOP
+{
+ Text [ en-US ] = "Top margin: " ;
+};
+String RID_SVXITEMS_MARGIN_RIGHT
+{
+ Text [ en-US ] = "Right margin: " ;
+};
+String RID_SVXITEMS_MARGIN_BOTTOM
+{
+ Text [ en-US ] = "Bottom margin: " ;
+};
+String RID_SVXITEMS_PAGE_COMPLETE
+{
+ Text [ en-US ] = "Page Description: " ;
+};
+String RID_SVXITEMS_PAGE_NUM_CHR_UPPER
+{
+ Text [ en-US ] = "Capitals" ;
+};
+String RID_SVXITEMS_PAGE_NUM_CHR_LOWER
+{
+ Text [ en-US ] = "Lowercase" ;
+};
+String RID_SVXITEMS_PAGE_NUM_ROM_UPPER
+{
+ Text [ en-US ] = "Uppercase Roman" ;
+};
+String RID_SVXITEMS_PAGE_NUM_ROM_LOWER
+{
+ Text [ en-US ] = "Lowercase Roman" ;
+};
+String RID_SVXITEMS_PAGE_NUM_ARABIC
+{
+ Text [ en-US ] = "Arabic" ;
+};
+String RID_SVXITEMS_PAGE_NUM_NONE
+{
+ Text [ en-US ] = "None" ;
+};
+String RID_SVXITEMS_PAGE_LAND_TRUE
+{
+ Text [ en-US ] = "Landscape" ;
+};
+String RID_SVXITEMS_PAGE_LAND_FALSE
+{
+ Text [ en-US ] = "Portrait" ;
+};
+String RID_SVXITEMS_PAGE_USAGE_LEFT
+{
+ Text [ en-US ] = "Left" ;
+};
+String RID_SVXITEMS_PAGE_USAGE_RIGHT
+{
+ Text [ en-US ] = "Right" ;
+};
+String RID_SVXITEMS_PAGE_USAGE_ALL
+{
+ Text [ en-US ] = "All" ;
+};
+String RID_SVXITEMS_PAGE_USAGE_MIRROR
+{
+ Text [ en-US ] = "Mirrored" ;
+};
+String RID_SVXITEMS_AUTHOR_COMPLETE
+{
+ Text [ en-US ] = "Author: " ;
+};
+String RID_SVXITEMS_DATE_COMPLETE
+{
+ Text [ en-US ] = "Date: " ;
+};
+String RID_SVXITEMS_TEXT_COMPLETE
+{
+ Text [ en-US ] = "Text: " ;
+};
+String RID_SVXITEMS_BACKGROUND_COLOR
+{
+ Text [ en-US ] = "Background color: " ;
+};
+String RID_SVXITEMS_PATTERN_COLOR
+{
+ Text [ en-US ] = "Pattern color: " ;
+};
+String RID_SVXITEMS_BRUSH_CHAR
+{
+ Text [ en-US ] = "Character background";
+};
+ // ********************************************************************** EOF
+
diff --git a/svx/source/items/viewlayoutitem.cxx b/svx/source/items/viewlayoutitem.cxx
new file mode 100644
index 000000000000..7f8dd5854e3b
--- /dev/null
+++ b/svx/source/items/viewlayoutitem.cxx
@@ -0,0 +1,211 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <tools/stream.hxx>
+
+#include <svx/viewlayoutitem.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+// -----------------------------------------------------------------------
+
+TYPEINIT1_FACTORY(SvxViewLayoutItem,SfxUInt16Item, new SvxViewLayoutItem);
+
+#define VIEWLAYOUT_PARAM_COLUMNS "Columns"
+#define VIEWLAYOUT_PARAM_BOOKMODE "BookMode"
+#define VIEWLAYOUT_PARAMS 2
+
+// -----------------------------------------------------------------------
+
+SvxViewLayoutItem::SvxViewLayoutItem
+(
+ sal_uInt16 nColumns,
+ bool bBookMode,
+ sal_uInt16 _nWhich
+)
+: SfxUInt16Item( _nWhich, nColumns ),
+ mbBookMode( bBookMode )
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxViewLayoutItem::SvxViewLayoutItem( const SvxViewLayoutItem& rOrig )
+: SfxUInt16Item( rOrig.Which(), rOrig.GetValue() ),
+ mbBookMode( rOrig.IsBookMode() )
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxViewLayoutItem::~SvxViewLayoutItem()
+{
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxViewLayoutItem::Clone( SfxItemPool * /*pPool*/ ) const
+{
+ return new SvxViewLayoutItem( *this );
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxViewLayoutItem::Create( SvStream& /*rStrm*/, sal_uInt16 /*nVersion*/ ) const
+{
+/* sal_uInt16 nValue;
+ sal_uInt16 nValSet;
+ sal_Int8 nType;
+ rStrm >> nValue >> nValSet >> nType;
+ SvxZoomItem* pNew = new SvxZoomItem( (SvxZoomType)nType, nValue, Which() );
+ pNew->SetValueSet( nValSet );
+ return pNew;*/
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SvxViewLayoutItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const
+{
+/* rStrm << (sal_uInt16)GetValue()
+ << nValueSet
+ << (sal_Int8)eType;*/
+ return rStrm;
+}
+
+// -----------------------------------------------------------------------
+
+int SvxViewLayoutItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
+
+ SvxViewLayoutItem& rItem = (SvxViewLayoutItem&)rAttr;
+
+ return ( GetValue() == rItem.GetValue() &&
+ mbBookMode == rItem.IsBookMode() );
+}
+
+sal_Bool SvxViewLayoutItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ case 0 :
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aSeq( VIEWLAYOUT_PARAMS );
+ aSeq[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VIEWLAYOUT_PARAM_COLUMNS ));
+ aSeq[0].Value <<= sal_Int32( GetValue() );
+ aSeq[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( VIEWLAYOUT_PARAM_BOOKMODE ));
+ aSeq[1].Value <<= sal_Bool( mbBookMode );
+ rVal <<= aSeq;
+ }
+ break;
+
+ case MID_VIEWLAYOUT_COLUMNS : rVal <<= (sal_Int32) GetValue(); break;
+ case MID_VIEWLAYOUT_BOOKMODE: rVal <<= (sal_Bool) mbBookMode; break;
+ default:
+ DBG_ERROR("svx::SvxViewLayoutItem::QueryValue(), Wrong MemberId!");
+ return sal_False;
+ }
+
+ return sal_True;
+}
+
+sal_Bool SvxViewLayoutItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
+{
+// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ case 0 :
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aSeq;
+ if (( rVal >>= aSeq ) && ( aSeq.getLength() == VIEWLAYOUT_PARAMS ))
+ {
+ sal_Int32 nColumns( 0 );
+ sal_Bool bBookMode = sal_False;
+ sal_Bool bAllConverted( sal_True );
+ sal_Int16 nConvertedCount( 0 );
+ for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
+ {
+ if ( aSeq[i].Name.equalsAscii( VIEWLAYOUT_PARAM_COLUMNS ))
+ {
+ bAllConverted &= ( aSeq[i].Value >>= nColumns );
+ ++nConvertedCount;
+ }
+ else if ( aSeq[i].Name.equalsAscii( VIEWLAYOUT_PARAM_BOOKMODE ))
+ {
+ bAllConverted &= ( aSeq[i].Value >>= bBookMode );
+ ++nConvertedCount;
+ }
+ }
+
+ if ( bAllConverted && nConvertedCount == VIEWLAYOUT_PARAMS )
+ {
+ SetValue( (sal_uInt16)nColumns );
+ mbBookMode = bBookMode;
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+ }
+
+ case MID_VIEWLAYOUT_COLUMNS:
+ {
+ sal_Int32 nVal = 0;
+ if ( rVal >>= nVal )
+ {
+ SetValue( (sal_uInt16)nVal );
+ return sal_True;
+ }
+ else
+ return sal_False;
+ }
+
+ case MID_VIEWLAYOUT_BOOKMODE:
+ {
+ sal_Bool bBookMode = sal_False;
+ if ( rVal >>= bBookMode )
+ {
+ mbBookMode = bBookMode;
+ return sal_True;
+ }
+ else
+ return sal_False;
+ }
+
+ default:
+ DBG_ERROR("svx::SvxViewLayoutItem::PutValue(), Wrong MemberId!");
+ return sal_False;
+ }
+
+ return sal_True;
+}
+
diff --git a/svx/source/items/zoomitem.cxx b/svx/source/items/zoomitem.cxx
new file mode 100644
index 000000000000..38ad3f6d9e7b
--- /dev/null
+++ b/svx/source/items/zoomitem.cxx
@@ -0,0 +1,231 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <tools/stream.hxx>
+#ifndef __SBX_SBXVARIABLE_HXX
+#include <basic/sbxvar.hxx>
+#endif
+
+#include <svx/zoomitem.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+// -----------------------------------------------------------------------
+
+TYPEINIT1_FACTORY(SvxZoomItem,SfxUInt16Item, new SvxZoomItem);
+
+#define ZOOM_PARAM_VALUE "Value"
+#define ZOOM_PARAM_VALUESET "ValueSet"
+#define ZOOM_PARAM_TYPE "Type"
+#define ZOOM_PARAMS 3
+
+// -----------------------------------------------------------------------
+
+SvxZoomItem::SvxZoomItem
+(
+ SvxZoomType eZoomType,
+ sal_uInt16 nVal,
+ sal_uInt16 _nWhich
+)
+: SfxUInt16Item( _nWhich, nVal ),
+ nValueSet( SVX_ZOOM_ENABLE_ALL ),
+ eType( eZoomType )
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxZoomItem::SvxZoomItem( const SvxZoomItem& rOrig )
+: SfxUInt16Item( rOrig.Which(), rOrig.GetValue() ),
+ nValueSet( rOrig.GetValueSet() ),
+ eType( rOrig.GetType() )
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxZoomItem::~SvxZoomItem()
+{
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxZoomItem::Clone( SfxItemPool * /*pPool*/ ) const
+{
+ return new SvxZoomItem( *this );
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxZoomItem::Create( SvStream& rStrm, sal_uInt16 /*nVersion*/ ) const
+{
+ sal_uInt16 nValue;
+ sal_uInt16 nValSet;
+ sal_Int8 nType;
+ rStrm >> nValue >> nValSet >> nType;
+ SvxZoomItem* pNew = new SvxZoomItem( (SvxZoomType)nType, nValue, Which() );
+ pNew->SetValueSet( nValSet );
+ return pNew;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SvxZoomItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const
+{
+ rStrm << (sal_uInt16)GetValue()
+ << nValueSet
+ << (sal_Int8)eType;
+ return rStrm;
+}
+
+// -----------------------------------------------------------------------
+
+int SvxZoomItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
+
+ SvxZoomItem& rItem = (SvxZoomItem&)rAttr;
+
+ return ( GetValue() == rItem.GetValue() &&
+ nValueSet == rItem.GetValueSet() &&
+ eType == rItem.GetType() );
+}
+
+sal_Bool SvxZoomItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ case 0 :
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aSeq( ZOOM_PARAMS );
+ aSeq[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ZOOM_PARAM_VALUE ));
+ aSeq[0].Value <<= sal_Int32( GetValue() );
+ aSeq[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ZOOM_PARAM_VALUESET ));
+ aSeq[1].Value <<= sal_Int16( nValueSet );
+ aSeq[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ZOOM_PARAM_TYPE ));
+ aSeq[2].Value <<= sal_Int16( eType );
+ rVal <<= aSeq;
+ }
+ break;
+
+ case MID_VALUE: rVal <<= (sal_Int32) GetValue(); break;
+ case MID_VALUESET: rVal <<= (sal_Int16) nValueSet; break;
+ case MID_TYPE: rVal <<= (sal_Int16) eType; break;
+ default:
+ DBG_ERROR("svx::SvxZoomItem::QueryValue(), Wrong MemberId!");
+ return sal_False;
+ }
+
+ return sal_True;
+}
+
+sal_Bool SvxZoomItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
+{
+// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ case 0 :
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aSeq;
+ if (( rVal >>= aSeq ) && ( aSeq.getLength() == ZOOM_PARAMS ))
+ {
+ sal_Int32 nValueTmp( 0 );
+ sal_Int16 nValueSetTmp( 0 );
+ sal_Int16 nTypeTmp( 0 );
+ sal_Bool bAllConverted( sal_True );
+ sal_Int16 nConvertedCount( 0 );
+ for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
+ {
+ if ( aSeq[i].Name.equalsAscii( ZOOM_PARAM_VALUE ))
+ {
+ bAllConverted &= ( aSeq[i].Value >>= nValueTmp );
+ ++nConvertedCount;
+ }
+ else if ( aSeq[i].Name.equalsAscii( ZOOM_PARAM_VALUESET ))
+ {
+ bAllConverted &= ( aSeq[i].Value >>= nValueSetTmp );
+ ++nConvertedCount;
+ }
+ else if ( aSeq[i].Name.equalsAscii( ZOOM_PARAM_TYPE ))
+ {
+ bAllConverted &= ( aSeq[i].Value >>= nTypeTmp );
+ ++nConvertedCount;
+ }
+ }
+
+ if ( bAllConverted && nConvertedCount == ZOOM_PARAMS )
+ {
+ SetValue( (sal_uInt16)nValueTmp );
+ nValueSet = nValueSetTmp;
+ eType = SvxZoomType( nTypeTmp );
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+ }
+
+ case MID_VALUE:
+ {
+ sal_Int32 nVal = 0;
+ if ( rVal >>= nVal )
+ {
+ SetValue( (sal_uInt16)nVal );
+ return sal_True;
+ }
+ else
+ return sal_False;
+ }
+
+ case MID_VALUESET:
+ case MID_TYPE:
+ {
+ sal_Int16 nVal = sal_Int16();
+ if ( rVal >>= nVal )
+ {
+ if ( nMemberId == MID_VALUESET )
+ nValueSet = (sal_Int16) nVal;
+ else if ( nMemberId == MID_TYPE )
+ eType = SvxZoomType( (sal_Int16) nVal );
+ return sal_True;
+ }
+ else
+ return sal_False;
+ }
+
+ default:
+ DBG_ERROR("svx::SvxZoomItem::PutValue(), Wrong MemberId!");
+ return sal_False;
+ }
+
+ return sal_True;
+}
diff --git a/svx/source/items/zoomslideritem.cxx b/svx/source/items/zoomslideritem.cxx
new file mode 100644
index 000000000000..c66432c5b0d4
--- /dev/null
+++ b/svx/source/items/zoomslideritem.cxx
@@ -0,0 +1,280 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <tools/stream.hxx>
+
+#include <svx/zoomslideritem.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+// -----------------------------------------------------------------------
+
+TYPEINIT1_FACTORY(SvxZoomSliderItem,SfxUInt16Item, new SvxZoomSliderItem);
+
+#define ZOOMSLIDER_PARAM_CURRENTZOOM "Columns"
+#define ZOOMSLIDER_PARAM_SNAPPINGPOINTS "SnappingPoints"
+#define ZOOMSLIDER_PARAM_MINZOOM "MinValue"
+#define ZOOMSLIDER_PARAM_MAXZOOM "MaxValue"
+#define ZOOMSLIDER_PARAMS 4
+
+// -----------------------------------------------------------------------
+
+SvxZoomSliderItem::SvxZoomSliderItem( sal_uInt16 nCurrentZoom, sal_uInt16 nMinZoom, sal_uInt16 nMaxZoom, sal_uInt16 _nWhich )
+: SfxUInt16Item( _nWhich, nCurrentZoom ), mnMinZoom( nMinZoom ), mnMaxZoom( nMaxZoom )
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxZoomSliderItem::SvxZoomSliderItem( const SvxZoomSliderItem& rOrig )
+: SfxUInt16Item( rOrig.Which(), rOrig.GetValue() )
+, maValues( rOrig.maValues )
+, mnMinZoom( rOrig.mnMinZoom )
+, mnMaxZoom( rOrig.mnMaxZoom )
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxZoomSliderItem::~SvxZoomSliderItem()
+{
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxZoomSliderItem::Clone( SfxItemPool * /*pPool*/ ) const
+{
+ return new SvxZoomSliderItem( *this );
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SvxZoomSliderItem::Create( SvStream& /*rStrm*/, sal_uInt16 /*nVersion*/ ) const
+{
+/* sal_uInt16 nValue;
+ sal_uInt16 nValSet;
+ sal_Int8 nType;
+ rStrm >> nValue >> nValSet >> nType;
+ SvxZoomItem* pNew = new SvxZoomItem( (SvxZoomType)nType, nValue, Which() );
+ pNew->SetValueSet( nValSet );
+ return pNew;*/
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SvxZoomSliderItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const
+{
+/* rStrm << (sal_uInt16)GetValue()
+ << nValueSet
+ << (sal_Int8)eType;*/
+ return rStrm;
+}
+
+// -----------------------------------------------------------------------
+
+int SvxZoomSliderItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
+
+ SvxZoomSliderItem& rItem = (SvxZoomSliderItem&)rAttr;
+
+ return ( GetValue() == rItem.GetValue() && maValues == rItem.maValues &&
+ mnMinZoom == rItem.mnMinZoom && mnMaxZoom == rItem.mnMaxZoom );
+}
+
+sal_Bool SvxZoomSliderItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ case 0 :
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aSeq( ZOOMSLIDER_PARAMS );
+ aSeq[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ZOOMSLIDER_PARAM_CURRENTZOOM ));
+ aSeq[0].Value <<= sal_Int32( GetValue() );
+ aSeq[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ZOOMSLIDER_PARAM_SNAPPINGPOINTS ));
+ aSeq[1].Value <<= maValues;
+ aSeq[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ZOOMSLIDER_PARAM_MINZOOM ) );
+ aSeq[2].Value <<= mnMinZoom;
+ aSeq[3].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ZOOMSLIDER_PARAM_MAXZOOM ) );
+ aSeq[3].Value <<= mnMaxZoom;
+ rVal <<= aSeq;
+ }
+ break;
+
+ case MID_ZOOMSLIDER_CURRENTZOOM :
+ {
+ rVal <<= (sal_Int32) GetValue();
+ }
+ break;
+ case MID_ZOOMSLIDER_SNAPPINGPOINTS:
+ {
+ rVal <<= maValues;
+ }
+ break;
+ case MID_ZOOMSLIDER_MINZOOM:
+ {
+ rVal <<= mnMinZoom;
+ }
+ break;
+ case MID_ZOOMSLIDER_MAXZOOM:
+ {
+ rVal <<= mnMaxZoom;
+ }
+ break;
+ default:
+ DBG_ERROR("svx::SvxZoomSliderItem::QueryValue(), Wrong MemberId!");
+ return sal_False;
+ }
+
+ return sal_True;
+}
+
+sal_Bool SvxZoomSliderItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
+{
+// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ case 0 :
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aSeq;
+ if (( rVal >>= aSeq ) && ( aSeq.getLength() == ZOOMSLIDER_PARAMS ))
+ {
+ sal_Int32 nCurrentZoom( 0 );
+ com::sun::star::uno::Sequence < sal_Int32 > aValues;
+
+ sal_Bool bAllConverted( sal_True );
+ sal_Int16 nConvertedCount( 0 );
+ sal_Int32 nMinZoom( 0 ), nMaxZoom( 0 );
+
+ for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
+ {
+ if ( aSeq[i].Name.equalsAscii( ZOOMSLIDER_PARAM_CURRENTZOOM ))
+ {
+ bAllConverted &= ( aSeq[i].Value >>= nCurrentZoom );
+ ++nConvertedCount;
+ }
+ else if ( aSeq[i].Name.equalsAscii( ZOOMSLIDER_PARAM_SNAPPINGPOINTS ))
+ {
+ bAllConverted &= ( aSeq[i].Value >>= aValues );
+ ++nConvertedCount;
+ }
+ else if( aSeq[i].Name.equalsAscii( ZOOMSLIDER_PARAM_MINZOOM ) )
+ {
+ bAllConverted &= ( aSeq[i].Value >>= nMinZoom );
+ ++nConvertedCount;
+ }
+ else if( aSeq[i].Name.equalsAscii( ZOOMSLIDER_PARAM_MAXZOOM ) )
+ {
+ bAllConverted &= ( aSeq[i].Value >>= nMaxZoom );
+ ++nConvertedCount;
+ }
+ }
+
+ if ( bAllConverted && nConvertedCount == ZOOMSLIDER_PARAMS )
+ {
+ SetValue( (sal_uInt16)nCurrentZoom );
+ maValues = aValues;
+ mnMinZoom = sal::static_int_cast< sal_uInt16 >( nMinZoom );
+ mnMaxZoom = sal::static_int_cast< sal_uInt16 >( nMaxZoom );
+
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+ }
+
+ case MID_ZOOMSLIDER_CURRENTZOOM:
+ {
+ sal_Int32 nVal = 0;
+ if ( rVal >>= nVal )
+ {
+ SetValue( (sal_uInt16)nVal );
+ return sal_True;
+ }
+ else
+ return sal_False;
+ }
+
+ case MID_ZOOMSLIDER_SNAPPINGPOINTS:
+ {
+ com::sun::star::uno::Sequence < sal_Int32 > aValues;
+ if ( rVal >>= aValues )
+ {
+ maValues = aValues;
+ return sal_True;
+ }
+ else
+ return sal_False;
+ }
+ case MID_ZOOMSLIDER_MINZOOM:
+ {
+ sal_Int32 nVal = 0;
+ if( rVal >>= nVal )
+ {
+ mnMinZoom = (sal_uInt16)nVal;
+ return sal_True;
+ }
+ else
+ return sal_False;
+ }
+ case MID_ZOOMSLIDER_MAXZOOM:
+ {
+ sal_Int32 nVal = 0;
+ if( rVal >>= nVal )
+ {
+ mnMaxZoom = (sal_uInt16)nVal;
+ return sal_True;
+ }
+ else
+ return sal_False;
+ }
+ default:
+ DBG_ERROR("svx::SvxZoomSliderItem::PutValue(), Wrong MemberId!");
+ return sal_False;
+ }
+
+ return sal_True;
+}
+
+void SvxZoomSliderItem::AddSnappingPoint( sal_Int32 nNew )
+{
+ const sal_Int32 nValues = maValues.getLength();
+ maValues.realloc( nValues + 1 );
+ sal_Int32* pValues = maValues.getArray();
+ pValues[ nValues ] = nNew;
+}
+
+const com::sun::star::uno::Sequence < sal_Int32 >& SvxZoomSliderItem::GetSnappingPoints() const
+{
+ return maValues;
+}
+
diff --git a/svx/source/mnuctrls/SmartTagCtl.cxx b/svx/source/mnuctrls/SmartTagCtl.cxx
new file mode 100644
index 000000000000..471146daf00b
--- /dev/null
+++ b/svx/source/mnuctrls/SmartTagCtl.cxx
@@ -0,0 +1,225 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/SmartTagCtl.hxx>
+#include <com/sun/star/smarttags/XSmartTagAction.hpp>
+#ifndef _COM_SUN_STAR_SMARTTAGS_XSTRINGKEYMAP_HPP_
+#include <com/sun/star/container/XStringKeyMap.hpp>
+#endif
+#include <svtools/stdmenu.hxx>
+#include <svl/eitem.hxx>
+#include <sfx2/dispatch.hxx>
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+
+#include <svx/SmartTagItem.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+#define C2U(cChar) rtl::OUString::createFromAscii(cChar)
+
+// STATIC DATA -----------------------------------------------------------
+
+SFX_IMPL_MENU_CONTROL(SvxSmartTagsControl, SvxSmartTagItem);
+
+//--------------------------------------------------------------------
+
+SvxSmartTagsControl::SvxSmartTagsControl
+(
+ sal_uInt16 _nId,
+ Menu& rMenu,
+ SfxBindings& /*rBindings*/
+) :
+ mpMenu ( new PopupMenu ),
+ mrParent ( rMenu ),
+ mpSmartTagItem( 0 )
+{
+ rMenu.SetPopupMenu( _nId, mpMenu );
+}
+
+//--------------------------------------------------------------------
+
+const sal_uInt16 MN_ST_INSERT_START = 500;
+
+void SvxSmartTagsControl::FillMenu()
+{
+ if ( !mpSmartTagItem )
+ return;
+
+ sal_uInt16 nMenuPos = 0;
+ sal_uInt16 nSubMenuPos = 0;
+ sal_uInt16 nMenuId = 1;
+ sal_uInt16 nSubMenuId = MN_ST_INSERT_START;
+
+ const Sequence < Sequence< Reference< smarttags::XSmartTagAction > > >& rActionComponentsSequence = mpSmartTagItem->GetActionComponentsSequence();
+ const Sequence < Sequence< sal_Int32 > >& rActionIndicesSequence = mpSmartTagItem->GetActionIndicesSequence();
+ const Sequence< Reference< container::XStringKeyMap > >& rStringKeyMaps = mpSmartTagItem->GetStringKeyMaps();
+ const lang::Locale& rLocale = mpSmartTagItem->GetLocale();
+ const rtl::OUString aApplicationName = mpSmartTagItem->GetApplicationName();
+ const rtl::OUString aRangeText = mpSmartTagItem->GetRangeText();
+ const Reference<text::XTextRange>& xTextRange = mpSmartTagItem->GetTextRange();
+ const Reference<frame::XController>& xController = mpSmartTagItem->GetController();
+
+ for ( sal_uInt16 j = 0; j < rActionComponentsSequence.getLength(); ++j )
+ {
+ Reference< container::XStringKeyMap > xSmartTagProperties = rStringKeyMaps[j];
+
+ // Get all actions references associated with the current smart tag type:
+ const Sequence< Reference< smarttags::XSmartTagAction > >& rActionComponents = rActionComponentsSequence[j];
+ const Sequence< sal_Int32 >& rActionIndices = rActionIndicesSequence[j];
+
+ if ( 0 == rActionComponents.getLength() || 0 == rActionIndices.getLength() )
+ continue;
+
+ // Ask first entry for the smart tag type caption:
+ Reference< smarttags::XSmartTagAction > xAction = rActionComponents[0];
+
+ if ( !xAction.is() )
+ continue;
+
+ const sal_Int32 nSmartTagIndex = rActionIndices[0];
+ const rtl::OUString aSmartTagType = xAction->getSmartTagName( nSmartTagIndex );
+ const rtl::OUString aSmartTagCaption = xAction->getSmartTagCaption( nSmartTagIndex, rLocale );
+
+ // no sub-menues if there's only one smart tag type listed:
+ PopupMenu* pSbMenu = mpMenu;
+ if ( 1 < rActionComponentsSequence.getLength() )
+ {
+ mpMenu->InsertItem( nMenuId, aSmartTagCaption, 0, nMenuPos++);
+ pSbMenu = new PopupMenu;
+ mpMenu->SetPopupMenu( nMenuId++, pSbMenu );
+ }
+ pSbMenu->SetSelectHdl( LINK( this, SvxSmartTagsControl, MenuSelect ) );
+
+ // sub-menu starts with smart tag caption and separator
+ const rtl::OUString aSmartTagCaption2 = aSmartTagCaption + C2U(": ") + aRangeText;
+ nSubMenuPos = 0;
+ pSbMenu->InsertItem( nMenuId++, aSmartTagCaption2, MIB_NOSELECT, nSubMenuPos++ );
+ pSbMenu->InsertSeparator( nSubMenuPos++ );
+
+ // Add subitem for every action reference for the current smart tag type:
+ for ( sal_uInt16 i = 0; i < rActionComponents.getLength(); ++i )
+ {
+ xAction = rActionComponents[i];
+
+ for ( sal_Int32 k = 0; k < xAction->getActionCount( aSmartTagType, xController ); ++k )
+ {
+ const sal_uInt32 nActionID = xAction->getActionID( aSmartTagType, k, xController );
+ rtl::OUString aActionCaption = xAction->getActionCaptionFromID( nActionID,
+ aApplicationName,
+ rLocale,
+ xSmartTagProperties,
+ aRangeText,
+ rtl::OUString(),
+ xController,
+ xTextRange );
+
+ pSbMenu->InsertItem( nSubMenuId++, aActionCaption, 0, nSubMenuPos++ );
+ InvokeAction aEntry( xAction, xSmartTagProperties, nActionID );
+ maInvokeActions.push_back( aEntry );
+ }
+ }
+ }
+}
+
+//--------------------------------------------------------------------
+
+void SvxSmartTagsControl::StateChanged( sal_uInt16, SfxItemState eState, const SfxPoolItem* pState )
+
+{
+ mrParent.EnableItem( GetId(), SFX_ITEM_DISABLED != eState );
+
+ if ( SFX_ITEM_AVAILABLE == eState )
+ {
+ const SvxSmartTagItem* pSmartTagItem = PTR_CAST( SvxSmartTagItem, pState );
+ if ( 0 != pSmartTagItem )
+ {
+ delete mpSmartTagItem;
+ mpSmartTagItem = new SvxSmartTagItem( *pSmartTagItem );
+ FillMenu();
+ }
+ }
+}
+
+//--------------------------------------------------------------------
+
+IMPL_LINK_INLINE_START( SvxSmartTagsControl, MenuSelect, PopupMenu *, pMen )
+{
+ if ( !mpSmartTagItem )
+ return 0;
+
+ sal_uInt16 nMyId = pMen->GetCurItemId();
+
+ if ( nMyId < MN_ST_INSERT_START) return 0;
+ nMyId -= MN_ST_INSERT_START;
+
+ // compute smarttag lib index and action index
+ Reference< smarttags::XSmartTagAction > xSmartTagAction = maInvokeActions[ nMyId ].mxAction;
+
+ // execute action
+ if ( xSmartTagAction.is() )
+ {
+ xSmartTagAction->invokeAction( maInvokeActions[ nMyId ].mnActionID,
+ mpSmartTagItem->GetApplicationName(),
+ mpSmartTagItem->GetController(),
+ mpSmartTagItem->GetTextRange(),
+ maInvokeActions[ nMyId ].mxSmartTagProperties,
+ mpSmartTagItem->GetRangeText(),
+ rtl::OUString(),
+ mpSmartTagItem->GetLocale() );
+ }
+
+ // ohne dispatcher!!!
+ // GetBindings().Execute( GetId(), SFX_CALLMODE_RECORD,meine beiden items, 0L );*/
+ //SfxBoolItem aBool(SID_OPEN_SMARTTAGOPTIONS, sal_True);
+ //GetBindings().GetDispatcher()->Execute( SID_AUTO_CORRECT_DLG, SFX_CALLMODE_ASYNCHRON, &aBool, 0L );
+
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvxSmartTagsControl, MenuSelect, PopupMenu *, pMen )
+
+//--------------------------------------------------------------------
+
+SvxSmartTagsControl::~SvxSmartTagsControl()
+{
+ delete mpSmartTagItem;
+ delete mpMenu;
+}
+
+//--------------------------------------------------------------------
+
+PopupMenu* SvxSmartTagsControl::GetPopup() const
+{
+ return mpMenu;
+}
+
+
diff --git a/svx/source/mnuctrls/clipboardctl.cxx b/svx/source/mnuctrls/clipboardctl.cxx
new file mode 100644
index 000000000000..52c468d0bda5
--- /dev/null
+++ b/svx/source/mnuctrls/clipboardctl.cxx
@@ -0,0 +1,163 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <sfx2/app.hxx>
+#include <sfx2/tbxctrl.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <tools/gen.hxx>
+#include <svl/intitem.hxx>
+#include <sot/exchange.hxx>
+#include <svl/eitem.hxx>
+#include <vcl/toolbox.hxx>
+#include <svx/clipboardctl.hxx>
+#include <svx/clipfmtitem.hxx>
+
+#include <svtools/insdlg.hxx>
+#include <svx/svxids.hrc>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+
+/////////////////////////////////////////////////////////////////
+
+SFX_IMPL_TOOLBOX_CONTROL( SvxClipBoardControl, SfxVoidItem /*SfxUInt16Item*/ );
+
+
+SvxClipBoardControl::SvxClipBoardControl(
+ sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
+
+ SfxToolBoxControl( nSlotId, nId, rTbx ),
+ pClipboardFmtItem( 0 ),
+ pPopup (0),
+ nItemId (nId),
+ bDisabled( sal_False )
+{
+ addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ClipboardFormatItems" )));
+ ToolBox& rBox = GetToolBox();
+ rBox.SetItemBits( nId, TIB_DROPDOWN | rBox.GetItemBits( nId ) );
+ rBox.Invalidate();
+}
+
+
+SvxClipBoardControl::~SvxClipBoardControl()
+{
+ DelPopup();
+ delete pClipboardFmtItem;
+}
+
+
+SfxPopupWindow* SvxClipBoardControl::CreatePopupWindow()
+{
+ const SvxClipboardFmtItem* pFmtItem = PTR_CAST( SvxClipboardFmtItem, pClipboardFmtItem );
+ if ( pFmtItem )
+ {
+ if (pPopup)
+ pPopup->Clear();
+ else
+ pPopup = new PopupMenu;
+
+ sal_uInt16 nCount = pFmtItem->Count();
+ for (sal_uInt16 i = 0; i < nCount; ++i)
+ {
+ sal_uIntPtr nFmtID = pFmtItem->GetClipbrdFormatId( i );
+ String aFmtStr( pFmtItem->GetClipbrdFormatName( i ) );
+ if (!aFmtStr.Len())
+ aFmtStr = SvPasteObjectHelper::GetSotFormatUIName( nFmtID );
+ pPopup->InsertItem( (sal_uInt16)nFmtID, aFmtStr );
+ }
+
+ ToolBox& rBox = GetToolBox();
+ sal_uInt16 nId = GetId();
+ rBox.SetItemDown( nId, sal_True );
+
+ pPopup->Execute( &rBox, rBox.GetItemRect( nId ),
+ (rBox.GetAlign() == WINDOWALIGN_TOP || rBox.GetAlign() == WINDOWALIGN_BOTTOM) ?
+ POPUPMENU_EXECUTE_DOWN : POPUPMENU_EXECUTE_RIGHT );
+
+ rBox.SetItemDown( nId, sal_False );
+
+ SfxUInt32Item aItem( SID_CLIPBOARD_FORMAT_ITEMS, pPopup->GetCurItemId() );
+
+ Any a;
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectedFormat" ));
+ aItem.QueryValue( a );
+ aArgs[0].Value = a;
+ Dispatch( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ClipboardFormatItems" )),
+ aArgs );
+ }
+
+ GetToolBox().EndSelection();
+ DelPopup();
+ return 0;
+}
+
+
+SfxPopupWindowType SvxClipBoardControl::GetPopupWindowType() const
+{
+ return SFX_POPUPWINDOW_ONTIMEOUT;
+}
+
+
+void SvxClipBoardControl::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+{
+ if ( SID_CLIPBOARD_FORMAT_ITEMS == nSID )
+ {
+ DELETEZ( pClipboardFmtItem );
+ if ( eState >= SFX_ITEM_AVAILABLE )
+ {
+ pClipboardFmtItem = pState->Clone();
+ GetToolBox().SetItemBits( GetId(), GetToolBox().GetItemBits( GetId() ) | TIB_DROPDOWN );
+ }
+ else if ( !bDisabled )
+ GetToolBox().SetItemBits( GetId(), GetToolBox().GetItemBits( GetId() ) & ~TIB_DROPDOWN );
+ GetToolBox().Invalidate( GetToolBox().GetItemRect( GetId() ) );
+ }
+ else
+ {
+ // enable the item as a whole
+ bDisabled = (GetItemState(pState) == SFX_ITEM_DISABLED);
+ GetToolBox().EnableItem( GetId(), (GetItemState(pState) != SFX_ITEM_DISABLED) );
+ }
+}
+
+
+void SvxClipBoardControl::DelPopup()
+{
+ if(pPopup)
+ {
+ delete pPopup;
+ pPopup = 0;
+ }
+}
+
+
+/////////////////////////////////////////////////////////////////
+
diff --git a/svx/source/mnuctrls/fntctl.cxx b/svx/source/mnuctrls/fntctl.cxx
new file mode 100644
index 000000000000..4f51e111c2c3
--- /dev/null
+++ b/svx/source/mnuctrls/fntctl.cxx
@@ -0,0 +1,182 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <string> // HACK: prevent conflict between STLPORT and Workshop headern
+#include <svtools/stdmenu.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/dispatch.hxx>
+
+#include <svx/fntctl.hxx> //
+#include <svx/svxids.hrc>
+#include "editeng/flstitem.hxx"
+#include "editeng/fontitem.hxx"
+
+// STATIC DATA -----------------------------------------------------------
+
+SFX_IMPL_MENU_CONTROL(SvxFontMenuControl, SvxFontItem);
+
+//--------------------------------------------------------------------
+
+/* [Beschreibung]
+
+ Ctor; setzt den Select-Handler am Men"u und tr"agt das Men"u
+ in seinen Parent ein.
+*/
+
+SvxFontMenuControl::SvxFontMenuControl
+(
+ sal_uInt16 _nId,
+ Menu& rMenu,
+ SfxBindings& rBindings
+) :
+ pMenu ( new FontNameMenu ),
+ rParent ( rMenu )
+{
+ rMenu.SetPopupMenu( _nId, pMenu );
+ pMenu->SetSelectHdl( LINK( this, SvxFontMenuControl, MenuSelect ) );
+ StartListening( rBindings );
+ FillMenu();
+}
+
+//--------------------------------------------------------------------
+
+/* [Beschreibung]
+
+ F"ullt das Men"u mit den aktuellen Fonts aus der Fontlist
+ der DocumentShell.
+*/
+
+void SvxFontMenuControl::FillMenu()
+{
+ SfxObjectShell *pDoc = SfxObjectShell::Current();
+
+ if ( pDoc )
+ {
+ const SvxFontListItem* pFonts =
+ (const SvxFontListItem*)pDoc->GetItem( SID_ATTR_CHAR_FONTLIST );
+ const FontList* pList = pFonts ? pFonts->GetFontList(): 0;
+ DBG_ASSERT( pList, "Kein Fonts gefunden" );
+ pMenu->Fill( pList );
+ }
+}
+
+//--------------------------------------------------------------------
+
+/* [Beschreibung]
+
+ Statusbenachrichtigung;
+ f"ullt ggf. das Men"u mit den aktuellen Fonts aus der Fontlist
+ der DocumentShell.
+ Ist die Funktionalit"at disabled, wird der entsprechende
+ Men"ueintrag im Parentmen"u disabled, andernfalls wird er enabled.
+ Der aktuelle Font wird mit einer Checkmark versehen.
+*/
+
+void SvxFontMenuControl::StateChanged(
+
+ sal_uInt16, SfxItemState eState, const SfxPoolItem* pState )
+
+{
+ rParent.EnableItem( GetId(), SFX_ITEM_DISABLED != eState );
+
+ if ( SFX_ITEM_AVAILABLE == eState )
+ {
+ if ( !pMenu->GetItemCount() )
+ FillMenu();
+ const SvxFontItem* pFontItem = PTR_CAST( SvxFontItem, pState );
+ String aFont;
+
+ if ( pFontItem )
+ aFont = pFontItem->GetFamilyName();
+ pMenu->SetCurName( aFont );
+ }
+}
+
+//--------------------------------------------------------------------
+
+/* [Beschreibung]
+
+ Statusbenachrichtigung "uber Bindings; bei DOCCHANGED
+ wird das Men"u mit den aktuellen Fonts aus der Fontlist
+ der DocumentShell gef"ullt.
+*/
+
+void SvxFontMenuControl::Notify( SfxBroadcaster&, const SfxHint& rHint )
+{
+ if ( rHint.Type() != TYPE(SfxSimpleHint) &&
+ ( (SfxSimpleHint&)rHint ).GetId() == SFX_HINT_DOCCHANGED )
+ FillMenu();
+}
+
+//--------------------------------------------------------------------
+
+/* [Beschreibung]
+
+ Select-Handler des Men"us; der Name des selektierten Fonts
+ wird in einem SvxFontItem verschickt. Das F"ullen mit den
+ weiteren Fontinformationen mu\s durch die Applikation geschehen.
+*/
+
+IMPL_LINK_INLINE_START( SvxFontMenuControl, MenuSelect, FontNameMenu *, pMen )
+{
+ SvxFontItem aItem( GetId() );
+ aItem.GetFamilyName() = pMen->GetCurName();
+ GetBindings().GetDispatcher()->Execute( GetId(), SFX_CALLMODE_RECORD, &aItem, 0L );
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvxFontMenuControl, MenuSelect, FontNameMenu *, pMen )
+
+//--------------------------------------------------------------------
+
+/* [Beschreibung]
+
+ Dtor; gibt das Men"u frei.
+*/
+
+SvxFontMenuControl::~SvxFontMenuControl()
+{
+ delete pMenu;
+}
+
+//--------------------------------------------------------------------
+
+/* [Beschreibung]
+
+ Gibt das Men"u zur"uck
+*/
+
+PopupMenu* SvxFontMenuControl::GetPopup() const
+{
+ return pMenu;
+}
+
+
+
diff --git a/svx/source/mnuctrls/fntszctl.cxx b/svx/source/mnuctrls/fntszctl.cxx
new file mode 100644
index 000000000000..32933ae8b716
--- /dev/null
+++ b/svx/source/mnuctrls/fntszctl.cxx
@@ -0,0 +1,211 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <string> // HACK: prevent conflict between STLPORT and Workshop headern
+#include <svl/itempool.hxx>
+#include <svtools/stdmenu.hxx>
+#include <svtools/ctrltool.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
+
+#include <svx/fntszctl.hxx> //
+#include <svx/dialogs.hrc>
+#include <editeng/fhgtitem.hxx>
+#include "editeng/fontitem.hxx"
+#include "editeng/flstitem.hxx"
+
+#include "svx/dlgutil.hxx"
+#include <svx/dialmgr.hxx>
+
+#define LOGIC OutputDevice::LogicToLogic
+
+SFX_IMPL_MENU_CONTROL(SvxFontSizeMenuControl, SvxFontHeightItem);
+
+//--------------------------------------------------------------------
+
+/* [Beschreibung]
+
+ Select-Handler des Men"us; die aktuelle Fontgr"o\se
+ wird in einem SvxFontHeightItem verschickt.
+*/
+
+IMPL_LINK( SvxFontSizeMenuControl, MenuSelect, FontSizeMenu*, pMen )
+{
+ SfxViewFrame* pFrm = SfxViewFrame::Current();
+ SfxShell* pSh = pFrm ? pFrm->GetDispatcher()->GetShell( 0 ) : NULL;
+
+ if ( !pSh )
+ return 0;
+
+ const SfxItemPool& rPool = pSh->GetPool();
+ sal_uInt16 nWhich = rPool.GetWhich( SID_ATTR_CHAR_FONTHEIGHT );
+ const SfxMapUnit eUnit = rPool.GetMetric( nWhich );
+ long nH = LOGIC( pMen->GetCurHeight(), MAP_POINT, (MapUnit)eUnit ) / 10;
+ SvxFontHeightItem aItem( nH, 100, GetId() );
+ GetBindings().GetDispatcher()->Execute( GetId(), SFX_CALLMODE_RECORD, &aItem, 0L );
+ return 1;
+}
+
+//--------------------------------------------------------------------
+
+/* [Beschreibung]
+
+ Statusbenachrichtigung;
+ Ist die Funktionalit"at disabled, wird der entsprechende
+ Men"ueintrag im Parentmenu disabled, andernfalls wird er enabled.
+ die aktuelle Fontgr"o\se wird mit einer Checkmark versehen.
+*/
+
+void SvxFontSizeMenuControl::StateChanged(
+
+ sal_uInt16, SfxItemState eState, const SfxPoolItem* pState )
+
+{
+ rParent.EnableItem( GetId(), SFX_ITEM_DISABLED != eState );
+
+ if ( SFX_ITEM_AVAILABLE == eState )
+ {
+ if ( pState->ISA(SvxFontHeightItem) )
+ {
+ const SvxFontHeightItem* pItem =
+ PTR_CAST( SvxFontHeightItem, pState );
+ long nVal = 0;
+
+ if ( pItem )
+ {
+ SfxViewFrame* pFrm = SfxViewFrame::Current();
+ SfxShell* pSh = pFrm ? pFrm->GetDispatcher()->GetShell( 0 )
+ : NULL;
+
+ if ( !pSh )
+ return;
+
+ const SfxItemPool& rPool = pSh->GetPool();
+ sal_uInt16 nWhich = rPool.GetWhich( SID_ATTR_CHAR_FONTHEIGHT );
+ const SfxMapUnit eUnit = rPool.GetMetric( nWhich );
+ long nH = pItem->GetHeight() * 10;
+ nVal = LOGIC( nH, (MapUnit)eUnit, MAP_POINT );
+ }
+ pMenu->SetCurHeight( nVal );
+ }
+ else if ( pState->ISA(SvxFontItem) )
+ {
+ const SvxFontItem* pItem = PTR_CAST( SvxFontItem, pState );
+
+ if ( pItem )
+ {
+ SfxObjectShell *pDoc = SfxObjectShell::Current();
+
+ if ( pDoc )
+ {
+ const SvxFontListItem* pFonts = (const SvxFontListItem*)
+ pDoc->GetItem( SID_ATTR_CHAR_FONTLIST );
+ const FontList* pList = pFonts ? pFonts->GetFontList(): 0;
+
+ if ( pList )
+ {
+ FontInfo aFntInf = pList->Get( pItem->GetFamilyName(),
+ pItem->GetStyleName() );
+ pMenu->Fill( aFntInf, pList );
+ }
+ // else manche Shells haben keine Fontliste (z.B. Image)
+ }
+ }
+ }
+ }
+ else
+ {
+ // irgendwie muss man ja das Men"u f"ullen
+ SfxObjectShell* pSh = SfxObjectShell::Current();
+
+ if ( pSh )
+ {
+ // daf"ur von der Shell eine Fontliste besorgen
+ const SvxFontListItem* pFonts =
+ (const SvxFontListItem*)pSh->GetItem( SID_ATTR_CHAR_FONTLIST );
+ const FontList* pList = pFonts ? pFonts->GetFontList(): NULL;
+ if ( pList )
+ pMenu->Fill( pList->GetFontName(0), pList );
+ }
+ }
+}
+
+//--------------------------------------------------------------------
+
+/* [Beschreibung]
+
+ Ctor; setzt den Select-Handler am Men"u und tr"agt Men"u
+ in seinen Parent ein.
+*/
+
+SvxFontSizeMenuControl::SvxFontSizeMenuControl
+(
+ sal_uInt16 _nId,
+ Menu& rMenu,
+ SfxBindings& rBindings
+) :
+ SfxMenuControl( _nId, rBindings ),
+
+ pMenu ( new FontSizeMenu ),
+ rParent ( rMenu ),
+ aFontNameForwarder( SID_ATTR_CHAR_FONT, *this )
+
+{
+ rMenu.SetPopupMenu( _nId, pMenu );
+ pMenu->SetSelectHdl( LINK( this, SvxFontSizeMenuControl, MenuSelect ) );
+}
+
+//--------------------------------------------------------------------
+
+/* [Beschreibung]
+
+ Dtor; gibt das Men"u frei.
+*/
+
+SvxFontSizeMenuControl::~SvxFontSizeMenuControl()
+{
+ delete pMenu;
+}
+
+//--------------------------------------------------------------------
+
+/* [Beschreibung]
+
+ Gibt das Men"u zur"uck
+*/
+
+PopupMenu* SvxFontSizeMenuControl::GetPopup() const
+{
+ return pMenu;
+}
+
+
diff --git a/svx/source/mnuctrls/mnuctrls.src b/svx/source/mnuctrls/mnuctrls.src
new file mode 100644
index 000000000000..e973ea249fa4
--- /dev/null
+++ b/svx/source/mnuctrls/mnuctrls.src
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svx/dialogs.hrc>
+
+Menu RID_MN_FONTSIZE {
+ ItemList = {
+ MenuItem {
+ Text = "6";
+ Identifier = 6;
+ };
+ MenuItem {
+ Text = "8";
+ Identifier = 8;
+ };
+ MenuItem {
+ Text = "10";
+ Identifier = 10;
+ };
+ MenuItem {
+ Text = "12";
+ Identifier = 12;
+ };
+ MenuItem {
+ Text = "14";
+ Identifier = 14;
+ };
+ MenuItem {
+ Text = "18";
+ Identifier = 18;
+ };
+ MenuItem {
+ Text = "24";
+ Identifier = 24;
+ };
+ MenuItem {
+ Text = "36";
+ Identifier = 36;
+ };
+ MenuItem {
+ Text = "48";
+ Identifier = 48;
+ };
+ MenuItem {
+ Text = "60";
+ Identifier = 60;
+ };
+ MenuItem {
+ Text = "72";
+ Identifier = 72;
+ };
+ };
+};
+
+
+
+
diff --git a/svx/source/sdr/animation/animationstate.cxx b/svx/source/sdr/animation/animationstate.cxx
new file mode 100644
index 000000000000..2fe1bcf9a235
--- /dev/null
+++ b/svx/source/sdr/animation/animationstate.cxx
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/animation/animationstate.hxx>
+#include <tools/debug.hxx>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <svx/sdr/animation/objectanimator.hxx>
+#include <svx/sdr/contact/objectcontact.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+#include <drawinglayer/primitive2d/animatedprimitive2d.hxx>
+#include <drawinglayer/animation/animationtiming.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace animation
+ {
+ double PrimitiveAnimation::getSmallestNextTime(double fCurrentTime)
+ {
+ double fRetval(0.0);
+
+ if(maAnimatedPrimitives.hasElements())
+ {
+ const sal_Int32 nCount(maAnimatedPrimitives.getLength());
+
+ for(sal_Int32 a(0L); a < nCount; a++)
+ {
+ const drawinglayer::primitive2d::Primitive2DReference xRef(maAnimatedPrimitives[a]);
+ const drawinglayer::primitive2d::AnimatedSwitchPrimitive2D* pCandidate = dynamic_cast< const drawinglayer::primitive2d::AnimatedSwitchPrimitive2D* >(xRef.get());
+ OSL_ENSURE(pCandidate, "PrimitiveAnimation::getSmallestNextTime: wrong primitive in animated list (!)");
+
+ if(pCandidate)
+ {
+ const drawinglayer::animation::AnimationEntry& rAnimEntry = pCandidate->getAnimationEntry();
+ const double fNextTime(rAnimEntry.getNextEventTime(fCurrentTime));
+
+ if(!::basegfx::fTools::equalZero(fNextTime))
+ {
+ if(::basegfx::fTools::equalZero(fRetval))
+ {
+ fRetval = fNextTime;
+ }
+ else if(::basegfx::fTools::less(fNextTime, fRetval))
+ {
+ fRetval = fNextTime;
+ }
+ }
+ }
+ }
+ }
+
+ return fRetval;
+ }
+
+ void PrimitiveAnimation::prepareNextEvent()
+ {
+ const double fCurrentTime(mrVOContact.GetObjectContact().getPrimitiveAnimator().GetTime());
+ const double fNextTime(getSmallestNextTime(fCurrentTime));
+
+ // getSmallestNextTime will be zero when animation ended. If not zero, a next step
+ // exists
+ if(!::basegfx::fTools::equalZero(fNextTime))
+ {
+ // next time point exists, use it
+ sal_uInt32 nNextTime;
+
+ if(fNextTime >= (double)0xffffff00)
+ {
+ // take care for very late points in time, e.g. when a text animation stops
+ // in a defined AnimationEntryFixed with endless (0xffffffff) duration
+ nNextTime = GetTime() + (1000 * 60 * 60); // one hour, works with vcl timers, 0xffffff00 was too much...
+ }
+ else
+ {
+ nNextTime = (sal_uInt32)fNextTime;
+ }
+
+ // ensure step forward in integer timing, the floating step difference maybe smaller than 1.0. Use
+ // at least 25ms for next step
+ const sal_uInt32 nMinimumStepTime((sal_uInt32)fCurrentTime + 25L);
+
+ if(nNextTime <= nMinimumStepTime)
+ {
+ nNextTime = nMinimumStepTime;
+ }
+
+ // set time and reactivate by re-adding to the scheduler
+ SetTime(nNextTime);
+ mrVOContact.GetObjectContact().getPrimitiveAnimator().InsertEvent(this);
+ }
+ }
+
+ PrimitiveAnimation::PrimitiveAnimation(sdr::contact::ViewObjectContact& rVOContact, const drawinglayer::primitive2d::Primitive2DSequence& rAnimatedPrimitives)
+ : Event(0L),
+ mrVOContact(rVOContact),
+ maAnimatedPrimitives(rAnimatedPrimitives)
+ {
+ // setup initially
+ prepareNextEvent();
+ }
+
+ PrimitiveAnimation::~PrimitiveAnimation()
+ {
+ // ensure that Event member is removed from PrimitiveAnimator
+ mrVOContact.GetObjectContact().getPrimitiveAnimator().RemoveEvent(this);
+ }
+
+ // execute event, from base class Event
+ void PrimitiveAnimation::Trigger(sal_uInt32 /*nTime*/)
+ {
+ // schedule a repaint of associated object
+ mrVOContact.ActionChanged();
+
+ // re-setup
+ prepareNextEvent();
+ }
+ } // end of namespace animation
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/animation/objectanimator.cxx b/svx/source/sdr/animation/objectanimator.cxx
new file mode 100644
index 000000000000..2dc7d514fdeb
--- /dev/null
+++ b/svx/source/sdr/animation/objectanimator.cxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/animation/objectanimator.hxx>
+#include <tools/debug.hxx>
+#include <svx/sdr/animation/animationstate.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace animation
+ {
+ primitiveAnimator::primitiveAnimator()
+ : Scheduler()
+ {
+ }
+
+ primitiveAnimator::~primitiveAnimator()
+ {
+ }
+ } // end of namespace animation
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/animation/scheduler.cxx b/svx/source/sdr/animation/scheduler.cxx
new file mode 100644
index 000000000000..50441f010fdb
--- /dev/null
+++ b/svx/source/sdr/animation/scheduler.cxx
@@ -0,0 +1,315 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/animation/scheduler.hxx>
+
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+// event class
+
+namespace sdr
+{
+ namespace animation
+ {
+ Event::Event(sal_uInt32 nTime)
+ : mnTime(nTime),
+ mpNext(0L)
+ {
+ }
+
+ Event::~Event()
+ {
+ }
+
+ Event* Event::GetNext() const
+ {
+ return mpNext;
+ }
+
+ void Event::SetNext(Event* pNew)
+ {
+ if(pNew != mpNext)
+ {
+ mpNext = pNew;
+ }
+ }
+
+ sal_uInt32 Event::GetTime() const
+ {
+ return mnTime;
+ }
+
+ void Event::SetTime(sal_uInt32 nNew)
+ {
+ if(mnTime != nNew)
+ {
+ mnTime = nNew;
+ }
+ }
+ } // end of namespace animation
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eventlist class
+
+namespace sdr
+{
+ namespace animation
+ {
+ EventList::EventList()
+ : mpHead(0L)
+ {
+ }
+
+ EventList::~EventList()
+ {
+ Clear();
+ }
+
+ void EventList::Insert(Event* pNew)
+ {
+ if(pNew)
+ {
+ Event* pCurrent = mpHead;
+ Event* pPrev = 0L;
+
+ while(pCurrent && pCurrent->GetTime() < pNew->GetTime())
+ {
+ pPrev = pCurrent;
+ pCurrent = pCurrent->GetNext();
+ }
+
+ if(pPrev)
+ {
+ pNew->SetNext(pPrev->GetNext());
+ pPrev->SetNext(pNew);
+ }
+ else
+ {
+ pNew->SetNext(mpHead);
+ mpHead = pNew;
+ }
+ }
+ }
+
+ void EventList::Remove(Event* pOld)
+ {
+ if(pOld && mpHead)
+ {
+ Event* pCurrent = mpHead;
+ Event* pPrev = 0L;
+
+ while(pCurrent && pCurrent != pOld)
+ {
+ pPrev = pCurrent;
+ pCurrent = pCurrent->GetNext();
+ }
+
+ if(pPrev)
+ {
+ pPrev->SetNext(pOld->GetNext());
+ }
+ else
+ {
+ mpHead = pOld->GetNext();
+ }
+
+ pOld->SetNext(0L);
+ }
+ }
+
+ void EventList::Clear()
+ {
+ while(mpHead)
+ {
+ Event* pNext = mpHead->GetNext();
+ mpHead->SetNext(0L);
+ mpHead = pNext;
+ }
+ }
+
+ Event* EventList::GetFirst()
+ {
+ return mpHead;
+ }
+ } // end of namespace animation
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// scheduler class
+
+namespace sdr
+{
+ namespace animation
+ {
+ Scheduler::Scheduler()
+ : mnTime(0L),
+ mnDeltaTime(0L),
+ mbIsPaused(false)
+ {
+ }
+
+ Scheduler::~Scheduler()
+ {
+ Stop();
+ }
+
+ void Scheduler::Timeout()
+ {
+ // stop timer and add time
+ Stop();
+ mnTime += mnDeltaTime;
+
+ // execute events
+ triggerEvents();
+
+ // re-start or stop timer according to event list
+ checkTimeout();
+ }
+
+ void Scheduler::triggerEvents()
+ {
+ Event* pNextEvent = maList.GetFirst();
+
+ if(pNextEvent)
+ {
+ // copy events which need to be executed to a vector. Remove them from
+ // the scheduler
+ ::std::vector< Event* > EventPointerVector;
+
+ while(pNextEvent && pNextEvent->GetTime() <= mnTime)
+ {
+ maList.Remove(pNextEvent);
+ EventPointerVector.push_back(pNextEvent);
+ pNextEvent = maList.GetFirst();
+ }
+
+ // execute events from the vector
+ for(::std::vector< Event* >::iterator aCandidate = EventPointerVector.begin();
+ aCandidate != EventPointerVector.end(); aCandidate++)
+ {
+ // trigger event. This may re-insert the event to the scheduler again
+ (*aCandidate)->Trigger(mnTime);
+ }
+ }
+ }
+
+ void Scheduler::checkTimeout()
+ {
+ // re-start or stop timer according to event list
+ if(!IsPaused() && maList.GetFirst())
+ {
+ mnDeltaTime = maList.GetFirst()->GetTime() - mnTime;
+
+ if(0L != mnDeltaTime)
+ {
+ SetTimeout(mnDeltaTime);
+ Start();
+ }
+ }
+ else
+ {
+ Stop();
+ }
+ }
+
+ sal_uInt32 Scheduler::GetTime()
+ {
+ return mnTime;
+ }
+
+ // #i38135#
+ void Scheduler::SetTime(sal_uInt32 nTime)
+ {
+ // reset time
+ Stop();
+ mnTime = nTime;
+
+ // get event pointer
+ Event* pEvent = maList.GetFirst();
+
+ if(pEvent)
+ {
+ // retet event time points
+ while(pEvent)
+ {
+ pEvent->SetTime(nTime);
+ pEvent = pEvent->GetNext();
+ }
+
+ if(!IsPaused())
+ {
+ // without delta time, init events by triggering them. This will invalidate
+ // painted objects and add them to the scheduler again
+ mnDeltaTime = 0L;
+ triggerEvents();
+ checkTimeout();
+ }
+ }
+ }
+
+ void Scheduler::Reset(sal_uInt32 nTime)
+ {
+ mnTime = nTime;
+ mnDeltaTime = 0L;
+ maList.Clear();
+ }
+
+ void Scheduler::InsertEvent(Event* pNew)
+ {
+ if(pNew)
+ {
+ maList.Insert(pNew);
+ checkTimeout();
+ }
+ }
+
+ void Scheduler::RemoveEvent(Event* pOld)
+ {
+ if(pOld && maList.GetFirst())
+ {
+ maList.Remove(pOld);
+ checkTimeout();
+ }
+ }
+
+ void Scheduler::SetPaused(bool bNew)
+ {
+ if(bNew != mbIsPaused)
+ {
+ mbIsPaused = bNew;
+ checkTimeout();
+ }
+ }
+ } // end of namespace animation
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/attribute/sdrfilltextattribute.cxx b/svx/source/sdr/attribute/sdrfilltextattribute.cxx
new file mode 100644
index 000000000000..e281c77068c5
--- /dev/null
+++ b/svx/source/sdr/attribute/sdrfilltextattribute.cxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * 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: sdrallattribute.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/sdrfilltextattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ SdrFillTextAttribute::SdrFillTextAttribute(
+ const SdrFillAttribute& rFill,
+ const FillGradientAttribute& rFillFloatTransGradient,
+ const SdrTextAttribute& rTextAttribute)
+ : maFill(rFill),
+ maFillFloatTransGradient(rFillFloatTransGradient),
+ maTextAttribute(rTextAttribute)
+ {
+ }
+
+ SdrFillTextAttribute::SdrFillTextAttribute()
+ : maFill(),
+ maFillFloatTransGradient(),
+ maTextAttribute()
+ {
+ }
+
+ SdrFillTextAttribute::SdrFillTextAttribute(const SdrFillTextAttribute& rCandidate)
+ : maFill(rCandidate.getFill()),
+ maFillFloatTransGradient(rCandidate.getFillFloatTransGradient()),
+ maTextAttribute(rCandidate.getText())
+ {
+ }
+
+ SdrFillTextAttribute& SdrFillTextAttribute::operator=(const SdrFillTextAttribute& rCandidate)
+ {
+ maFill = rCandidate.getFill();
+ maFillFloatTransGradient = rCandidate.getFillFloatTransGradient();
+ maTextAttribute = rCandidate.getText();
+
+ return *this;
+ }
+
+ bool SdrFillTextAttribute::isDefault() const
+ {
+ return(getFill().isDefault()
+ && getFillFloatTransGradient().isDefault()
+ && getText().isDefault());
+ }
+
+ bool SdrFillTextAttribute::operator==(const SdrFillTextAttribute& rCandidate) const
+ {
+ return(getFill() == rCandidate.getFill()
+ && getFillFloatTransGradient() == rCandidate.getFillFloatTransGradient()
+ && getText() == rCandidate.getText());
+ }
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/attribute/sdrformtextattribute.cxx b/svx/source/sdr/attribute/sdrformtextattribute.cxx
new file mode 100644
index 000000000000..39037faa5031
--- /dev/null
+++ b/svx/source/sdr/attribute/sdrformtextattribute.cxx
@@ -0,0 +1,423 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/attribute/sdrformtextattribute.hxx>
+#include <basegfx/vector/b2enums.hxx>
+#include <svl/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 <svx/sdshcitm.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svx/xlinjoit.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/xdash.hxx>
+#include <svx/xlndsit.hxx>
+#include <drawinglayer/attribute/lineattribute.hxx>
+#include <drawinglayer/attribute/strokeattribute.hxx>
+#include <svx/sdr/attribute/sdrformtextoutlineattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// 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
+ {
+ class ImpSdrFormTextAttribute
+ {
+ public:
+ // refcounter
+ sal_uInt32 mnRefCount;
+
+ // 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 maOutline;
+ SdrFormTextOutlineAttribute maShadowOutline;
+
+ // bitfield
+ unsigned mbFormTextMirror : 1; // change orientation
+ unsigned mbFormTextOutline : 1; // show contour of objects
+
+ ImpSdrFormTextAttribute(const SfxItemSet& rSet)
+ : mnRefCount(0),
+ 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()),
+ maOutline(),
+ maShadowOutline(),
+ 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));
+
+ maOutline = 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));
+
+ maShadowOutline = SdrFormTextOutlineAttribute(
+ aLineAttribute, aStrokeAttribute, nTransparence);
+ }
+ }
+ }
+
+ ImpSdrFormTextAttribute()
+ : mnRefCount(0),
+ mnFormTextDistance(0),
+ mnFormTextStart(0),
+ mnFormTextShdwXVal(0),
+ mnFormTextShdwYVal(0),
+ mnFormTextShdwTransp(0),
+ meFormTextStyle(XFT_NONE),
+ meFormTextAdjust(XFT_CENTER),
+ meFormTextShadow(XFTSHADOW_NONE),
+ maFormTextShdwColor(),
+ maOutline(),
+ maShadowOutline(),
+ mbFormTextMirror(false),
+ mbFormTextOutline(false)
+ {
+ }
+
+ // data read 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 maOutline; }
+ const SdrFormTextOutlineAttribute& getShadowOutline() const { return maShadowOutline; }
+ bool getFormTextMirror() const { return mbFormTextMirror; }
+ bool getFormTextOutline() const { return mbFormTextOutline; }
+
+ // compare operator
+ bool operator==(const ImpSdrFormTextAttribute& 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()
+ && getOutline() == rCandidate.getOutline()
+ && getShadowOutline() == rCandidate.getShadowOutline()
+ && getFormTextMirror() == rCandidate.getFormTextMirror()
+ && getFormTextOutline() == rCandidate.getFormTextOutline());
+ }
+
+ static ImpSdrFormTextAttribute* get_global_default()
+ {
+ static ImpSdrFormTextAttribute* pDefault = 0;
+
+ if(!pDefault)
+ {
+ pDefault = new ImpSdrFormTextAttribute();
+
+ // never delete; start with RefCount 1, not 0
+ pDefault->mnRefCount++;
+ }
+
+ return pDefault;
+ }
+ };
+
+ SdrFormTextAttribute::SdrFormTextAttribute(const SfxItemSet& rSet)
+ : mpSdrFormTextAttribute(new ImpSdrFormTextAttribute(rSet))
+ {
+ }
+
+ SdrFormTextAttribute::SdrFormTextAttribute()
+ : mpSdrFormTextAttribute(ImpSdrFormTextAttribute::get_global_default())
+ {
+ mpSdrFormTextAttribute->mnRefCount++;
+ }
+
+ SdrFormTextAttribute::SdrFormTextAttribute(const SdrFormTextAttribute& rCandidate)
+ : mpSdrFormTextAttribute(rCandidate.mpSdrFormTextAttribute)
+ {
+ mpSdrFormTextAttribute->mnRefCount++;
+ }
+
+ SdrFormTextAttribute::~SdrFormTextAttribute()
+ {
+ if(mpSdrFormTextAttribute->mnRefCount)
+ {
+ mpSdrFormTextAttribute->mnRefCount--;
+ }
+ else
+ {
+ delete mpSdrFormTextAttribute;
+ }
+ }
+
+ bool SdrFormTextAttribute::isDefault() const
+ {
+ return mpSdrFormTextAttribute == ImpSdrFormTextAttribute::get_global_default();
+ }
+
+ SdrFormTextAttribute& SdrFormTextAttribute::operator=(const SdrFormTextAttribute& rCandidate)
+ {
+ if(rCandidate.mpSdrFormTextAttribute != mpSdrFormTextAttribute)
+ {
+ if(mpSdrFormTextAttribute->mnRefCount)
+ {
+ mpSdrFormTextAttribute->mnRefCount--;
+ }
+ else
+ {
+ delete mpSdrFormTextAttribute;
+ }
+
+ mpSdrFormTextAttribute = rCandidate.mpSdrFormTextAttribute;
+ mpSdrFormTextAttribute->mnRefCount++;
+ }
+
+ return *this;
+ }
+
+ bool SdrFormTextAttribute::operator==(const SdrFormTextAttribute& rCandidate) const
+ {
+ if(rCandidate.mpSdrFormTextAttribute == mpSdrFormTextAttribute)
+ {
+ return true;
+ }
+
+ if(rCandidate.isDefault() != isDefault())
+ {
+ return false;
+ }
+
+ return (*rCandidate.mpSdrFormTextAttribute == *mpSdrFormTextAttribute);
+ }
+
+ sal_Int32 SdrFormTextAttribute::getFormTextDistance() const
+ {
+ return mpSdrFormTextAttribute->getFormTextDistance();
+ }
+
+ sal_Int32 SdrFormTextAttribute::getFormTextStart() const
+ {
+ return mpSdrFormTextAttribute->getFormTextStart();
+ }
+
+ sal_Int32 SdrFormTextAttribute::getFormTextShdwXVal() const
+ {
+ return mpSdrFormTextAttribute->getFormTextShdwXVal();
+ }
+
+ sal_Int32 SdrFormTextAttribute::getFormTextShdwYVal() const
+ {
+ return mpSdrFormTextAttribute->getFormTextShdwYVal();
+ }
+
+ sal_uInt16 SdrFormTextAttribute::getFormTextShdwTransp() const
+ {
+ return mpSdrFormTextAttribute->getFormTextShdwTransp();
+ }
+
+ XFormTextStyle SdrFormTextAttribute::getFormTextStyle() const
+ {
+ return mpSdrFormTextAttribute->getFormTextStyle();
+ }
+
+ XFormTextAdjust SdrFormTextAttribute::getFormTextAdjust() const
+ {
+ return mpSdrFormTextAttribute->getFormTextAdjust();
+ }
+
+ XFormTextShadow SdrFormTextAttribute::getFormTextShadow() const
+ {
+ return mpSdrFormTextAttribute->getFormTextShadow();
+ }
+
+ Color SdrFormTextAttribute::getFormTextShdwColor() const
+ {
+ return mpSdrFormTextAttribute->getFormTextShdwColor();
+ }
+
+ const SdrFormTextOutlineAttribute& SdrFormTextAttribute::getOutline() const
+ {
+ return mpSdrFormTextAttribute->getOutline();
+ }
+
+ const SdrFormTextOutlineAttribute& SdrFormTextAttribute::getShadowOutline() const
+ {
+ return mpSdrFormTextAttribute->getShadowOutline();
+ }
+
+ bool SdrFormTextAttribute::getFormTextMirror() const
+ {
+ return mpSdrFormTextAttribute->getFormTextMirror();
+ }
+
+ bool SdrFormTextAttribute::getFormTextOutline() const
+ {
+ return mpSdrFormTextAttribute->getFormTextOutline();
+ }
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx b/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx
new file mode 100644
index 000000000000..6f1925f1f5a8
--- /dev/null
+++ b/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx
@@ -0,0 +1,185 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/attribute/sdrformtextoutlineattribute.hxx>
+#include <drawinglayer/attribute/lineattribute.hxx>
+#include <drawinglayer/attribute/strokeattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class ImpSdrFormTextOutlineAttribute
+ {
+ public:
+ // refcounter
+ sal_uInt32 mnRefCount;
+
+ // one set of attributes for FormText (FontWork) outline visualisation
+ LineAttribute maLineAttribute;
+ StrokeAttribute maStrokeAttribute;
+ sal_uInt8 mnTransparence;
+
+ ImpSdrFormTextOutlineAttribute(
+ const LineAttribute& rLineAttribute,
+ const StrokeAttribute& rStrokeAttribute,
+ sal_uInt8 nTransparence)
+ : mnRefCount(0),
+ maLineAttribute(rLineAttribute),
+ maStrokeAttribute(rStrokeAttribute),
+ mnTransparence(nTransparence)
+ {
+ }
+
+ // data read access
+ const LineAttribute& getLineAttribute() const { return maLineAttribute; }
+ const StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; }
+ sal_uInt8 getTransparence() const { return mnTransparence; }
+
+ // compare operator
+ bool operator==(const ImpSdrFormTextOutlineAttribute& rCandidate) const
+ {
+ return (getLineAttribute() == rCandidate.getLineAttribute()
+ && getStrokeAttribute() == rCandidate.getStrokeAttribute()
+ && getTransparence() == rCandidate.getTransparence());
+ }
+
+ static ImpSdrFormTextOutlineAttribute* get_global_default()
+ {
+ static ImpSdrFormTextOutlineAttribute* pDefault = 0;
+
+ if(!pDefault)
+ {
+ pDefault = new ImpSdrFormTextOutlineAttribute(
+ LineAttribute(),
+ StrokeAttribute(),
+ 0);
+
+ // never delete; start with RefCount 1, not 0
+ pDefault->mnRefCount++;
+ }
+
+ return pDefault;
+ }
+ };
+
+ SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute(
+ const LineAttribute& rLineAttribute,
+ const StrokeAttribute& rStrokeAttribute,
+ sal_uInt8 nTransparence)
+ : mpSdrFormTextOutlineAttribute(new ImpSdrFormTextOutlineAttribute(
+ rLineAttribute, rStrokeAttribute, nTransparence))
+ {
+ }
+
+ SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute()
+ : mpSdrFormTextOutlineAttribute(ImpSdrFormTextOutlineAttribute::get_global_default())
+ {
+ mpSdrFormTextOutlineAttribute->mnRefCount++;
+ }
+
+ SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute(const SdrFormTextOutlineAttribute& rCandidate)
+ : mpSdrFormTextOutlineAttribute(rCandidate.mpSdrFormTextOutlineAttribute)
+ {
+ mpSdrFormTextOutlineAttribute->mnRefCount++;
+ }
+
+ SdrFormTextOutlineAttribute::~SdrFormTextOutlineAttribute()
+ {
+ if(mpSdrFormTextOutlineAttribute->mnRefCount)
+ {
+ mpSdrFormTextOutlineAttribute->mnRefCount--;
+ }
+ else
+ {
+ delete mpSdrFormTextOutlineAttribute;
+ }
+ }
+
+ bool SdrFormTextOutlineAttribute::isDefault() const
+ {
+ return mpSdrFormTextOutlineAttribute == ImpSdrFormTextOutlineAttribute::get_global_default();
+ }
+
+ SdrFormTextOutlineAttribute& SdrFormTextOutlineAttribute::operator=(const SdrFormTextOutlineAttribute& rCandidate)
+ {
+ if(rCandidate.mpSdrFormTextOutlineAttribute != mpSdrFormTextOutlineAttribute)
+ {
+ if(mpSdrFormTextOutlineAttribute->mnRefCount)
+ {
+ mpSdrFormTextOutlineAttribute->mnRefCount--;
+ }
+ else
+ {
+ delete mpSdrFormTextOutlineAttribute;
+ }
+
+ mpSdrFormTextOutlineAttribute = rCandidate.mpSdrFormTextOutlineAttribute;
+ mpSdrFormTextOutlineAttribute->mnRefCount++;
+ }
+
+ return *this;
+ }
+
+ bool SdrFormTextOutlineAttribute::operator==(const SdrFormTextOutlineAttribute& rCandidate) const
+ {
+ if(rCandidate.mpSdrFormTextOutlineAttribute == mpSdrFormTextOutlineAttribute)
+ {
+ return true;
+ }
+
+ if(rCandidate.isDefault() != isDefault())
+ {
+ return false;
+ }
+
+ return (*rCandidate.mpSdrFormTextOutlineAttribute == *mpSdrFormTextOutlineAttribute);
+ }
+
+ const LineAttribute& SdrFormTextOutlineAttribute::getLineAttribute() const
+ {
+ return mpSdrFormTextOutlineAttribute->getLineAttribute();
+ }
+
+ const StrokeAttribute& SdrFormTextOutlineAttribute::getStrokeAttribute() const
+ {
+ return mpSdrFormTextOutlineAttribute->getStrokeAttribute();
+ }
+
+ sal_uInt8 SdrFormTextOutlineAttribute::getTransparence() const
+ {
+ return mpSdrFormTextOutlineAttribute->getTransparence();
+ }
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/attribute/sdrlinefillshadowtextattribute.cxx b/svx/source/sdr/attribute/sdrlinefillshadowtextattribute.cxx
new file mode 100644
index 000000000000..6d8356833829
--- /dev/null
+++ b/svx/source/sdr/attribute/sdrlinefillshadowtextattribute.cxx
@@ -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: sdrallattribute.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/sdrlinefillshadowtextattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute(
+ const SdrLineAttribute& rLine,
+ const SdrFillAttribute& rFill,
+ const SdrLineStartEndAttribute& rLineStartEnd,
+ const SdrShadowAttribute& rShadow,
+ const FillGradientAttribute& rFillFloatTransGradient,
+ const SdrTextAttribute& rTextAttribute)
+ : SdrLineShadowTextAttribute(rLine, rLineStartEnd, rShadow, rTextAttribute),
+ maFill(rFill),
+ maFillFloatTransGradient(rFillFloatTransGradient)
+ {
+ }
+
+ SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute()
+ : SdrLineShadowTextAttribute(),
+ maFill(),
+ maFillFloatTransGradient()
+ {
+ }
+
+ SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute(const SdrLineFillShadowTextAttribute& rCandidate)
+ : SdrLineShadowTextAttribute(rCandidate),
+ maFill(rCandidate.getFill()),
+ maFillFloatTransGradient(rCandidate.getFillFloatTransGradient())
+ {
+ }
+
+ SdrLineFillShadowTextAttribute& SdrLineFillShadowTextAttribute::operator=(const SdrLineFillShadowTextAttribute& rCandidate)
+ {
+ SdrLineShadowTextAttribute::operator=(rCandidate);
+ maFill = rCandidate.getFill();
+ maFillFloatTransGradient = rCandidate.getFillFloatTransGradient();
+
+ return *this;
+ }
+
+ bool SdrLineFillShadowTextAttribute::isDefault() const
+ {
+ return (SdrLineShadowTextAttribute::isDefault()
+ && getFill().isDefault()
+ && getFillFloatTransGradient().isDefault());
+ }
+
+ bool SdrLineFillShadowTextAttribute::operator==(const SdrLineFillShadowTextAttribute& rCandidate) const
+ {
+ return(SdrLineShadowTextAttribute::operator==(rCandidate)
+ && getFill() == rCandidate.getFill()
+ && getFillFloatTransGradient() == rCandidate.getFillFloatTransGradient());
+ }
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/attribute/sdrlineshadowtextattribute.cxx b/svx/source/sdr/attribute/sdrlineshadowtextattribute.cxx
new file mode 100644
index 000000000000..6b863a11aa03
--- /dev/null
+++ b/svx/source/sdr/attribute/sdrlineshadowtextattribute.cxx
@@ -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: sdrallattribute.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/sdrlineshadowtextattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ SdrLineShadowTextAttribute::SdrLineShadowTextAttribute(
+ const SdrLineAttribute& rLine,
+ const SdrLineStartEndAttribute& rLineStartEnd,
+ const SdrShadowAttribute& rShadow,
+ const SdrTextAttribute& rTextAttribute)
+ : SdrShadowTextAttribute(rShadow, rTextAttribute),
+ maLine(rLine),
+ maLineStartEnd(rLineStartEnd)
+ {
+ }
+
+ SdrLineShadowTextAttribute::SdrLineShadowTextAttribute()
+ : SdrShadowTextAttribute(),
+ maLine(),
+ maLineStartEnd()
+ {
+ }
+
+ SdrLineShadowTextAttribute::SdrLineShadowTextAttribute(const SdrLineShadowTextAttribute& rCandidate)
+ : SdrShadowTextAttribute(rCandidate),
+ maLine(rCandidate.getLine()),
+ maLineStartEnd(rCandidate.getLineStartEnd())
+ {
+ }
+
+ SdrLineShadowTextAttribute& SdrLineShadowTextAttribute::operator=(const SdrLineShadowTextAttribute& rCandidate)
+ {
+ SdrShadowTextAttribute::operator=(rCandidate);
+ maLine = rCandidate.getLine();
+ maLineStartEnd = rCandidate.getLineStartEnd();
+
+ return *this;
+ }
+
+ bool SdrLineShadowTextAttribute::isDefault() const
+ {
+ return(SdrShadowTextAttribute::isDefault()
+ && getLine().isDefault()
+ && getLineStartEnd().isDefault());
+ }
+
+ bool SdrLineShadowTextAttribute::operator==(const SdrLineShadowTextAttribute& rCandidate) const
+ {
+ return(SdrShadowTextAttribute::operator==(rCandidate)
+ && getLine() == rCandidate.getLine()
+ && getLineStartEnd() == rCandidate.getLineStartEnd());
+ }
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/attribute/sdrshadowtextattribute.cxx b/svx/source/sdr/attribute/sdrshadowtextattribute.cxx
new file mode 100644
index 000000000000..34485b57399c
--- /dev/null
+++ b/svx/source/sdr/attribute/sdrshadowtextattribute.cxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * 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: sdrallattribute.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/sdrshadowtextattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ SdrShadowTextAttribute::SdrShadowTextAttribute(
+ const SdrShadowAttribute& rShadow,
+ const SdrTextAttribute& rTextAttribute)
+ : maShadow(rShadow),
+ maTextAttribute(rTextAttribute)
+ {
+ }
+
+ SdrShadowTextAttribute::SdrShadowTextAttribute()
+ : maShadow(),
+ maTextAttribute()
+ {
+ }
+
+ SdrShadowTextAttribute::SdrShadowTextAttribute(const SdrShadowTextAttribute& rCandidate)
+ : maShadow(rCandidate.getShadow()),
+ maTextAttribute(rCandidate.getText())
+ {
+ }
+
+ SdrShadowTextAttribute& SdrShadowTextAttribute::operator=(const SdrShadowTextAttribute& rCandidate)
+ {
+ maShadow = rCandidate.getShadow();
+ maTextAttribute = rCandidate.getText();
+
+ return *this;
+ }
+
+ bool SdrShadowTextAttribute::isDefault() const
+ {
+ return (getShadow().isDefault()
+ && getText().isDefault());
+ }
+
+ bool SdrShadowTextAttribute::operator==(const SdrShadowTextAttribute& rCandidate) const
+ {
+ return (getShadow() == rCandidate.getShadow()
+ && getText() == rCandidate.getText());
+ }
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/attribute/sdrtextattribute.cxx b/svx/source/sdr/attribute/sdrtextattribute.cxx
new file mode 100644
index 000000000000..a28430f127c1
--- /dev/null
+++ b/svx/source/sdr/attribute/sdrtextattribute.cxx
@@ -0,0 +1,461 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/attribute/sdrtextattribute.hxx>
+#include <svx/sdr/attribute/sdrformtextattribute.hxx>
+#include <svx/svdotext.hxx>
+#include <editeng/outlobj.hxx>
+#include <editeng/editobj.hxx>
+#include <editeng/flditem.hxx>
+#include <svx/sdr/properties/properties.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class ImpSdrTextAttribute
+ {
+ public:
+ // refcounter
+ sal_uInt32 mnRefCount;
+
+ // all-text attributes. The SdrText itself and a copy
+ // of te OPO
+ const SdrText* mpSdrText;
+ const OutlinerParaObject* mpOutlinerParaObject;
+
+ // Set when it's a FormText; contains all FormText attributes
+ SdrFormTextAttribute maSdrFormTextAttribute;
+
+ // 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;
+
+ // text alignments
+ SdrTextHorzAdjust maSdrTextHorzAdjust;
+ SdrTextVertAdjust maSdrTextVertAdjust;
+
+ // bitfield
+ unsigned mbContour : 1;
+ unsigned mbFitToSize : 1;
+ unsigned mbHideContour : 1;
+ unsigned mbBlink : 1;
+ unsigned mbScroll : 1;
+ unsigned mbInEditMode : 1;
+ unsigned mbFixedCellHeight : 1;
+ unsigned mbWrongSpell : 1;
+
+ public:
+ ImpSdrTextAttribute(
+ const SdrText* pSdrText,
+ const OutlinerParaObject& rOutlinerParaObject,
+ XFormTextStyle eFormTextStyle,
+ sal_Int32 aTextLeftDistance,
+ sal_Int32 aTextUpperDistance,
+ sal_Int32 aTextRightDistance,
+ sal_Int32 aTextLowerDistance,
+ SdrTextHorzAdjust aSdrTextHorzAdjust,
+ SdrTextVertAdjust aSdrTextVertAdjust,
+ bool bContour,
+ bool bFitToSize,
+ bool bHideContour,
+ bool bBlink,
+ bool bScroll,
+ bool bInEditMode,
+ bool bFixedCellHeight,
+ bool bWrongSpell)
+ : mnRefCount(0),
+ mpSdrText(pSdrText),
+ mpOutlinerParaObject(new OutlinerParaObject(rOutlinerParaObject)),
+ maSdrFormTextAttribute(),
+ maTextLeftDistance(aTextLeftDistance),
+ maTextUpperDistance(aTextUpperDistance),
+ maTextRightDistance(aTextRightDistance),
+ maTextLowerDistance(aTextLowerDistance),
+ maPropertiesVersion(0),
+ maSdrTextHorzAdjust(aSdrTextHorzAdjust),
+ maSdrTextVertAdjust(aSdrTextVertAdjust),
+ mbContour(bContour),
+ mbFitToSize(bFitToSize),
+ mbHideContour(bHideContour),
+ mbBlink(bBlink),
+ mbScroll(bScroll),
+ mbInEditMode(bInEditMode),
+ mbFixedCellHeight(bFixedCellHeight),
+ mbWrongSpell(bWrongSpell)
+ {
+ if(pSdrText)
+ {
+ if(XFT_NONE != eFormTextStyle)
+ {
+ // text on path. Create FormText attribute
+ const SfxItemSet& rSet = pSdrText->GetItemSet();
+ maSdrFormTextAttribute = 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 = pSdrText->GetObject().GetProperties().getVersion();
+ }
+ }
+
+ ImpSdrTextAttribute()
+ : mnRefCount(0),
+ mpSdrText(0),
+ mpOutlinerParaObject(0),
+ maSdrFormTextAttribute(),
+ maTextLeftDistance(0),
+ maTextUpperDistance(0),
+ maTextRightDistance(0),
+ maTextLowerDistance(0),
+ maPropertiesVersion(0),
+ maSdrTextHorzAdjust(SDRTEXTHORZADJUST_LEFT),
+ maSdrTextVertAdjust(SDRTEXTVERTADJUST_TOP),
+ mbContour(false),
+ mbFitToSize(false),
+ mbHideContour(false),
+ mbBlink(false),
+ mbScroll(false),
+ mbInEditMode(false),
+ mbFixedCellHeight(false),
+ mbWrongSpell(false)
+ {
+ }
+
+ ~ImpSdrTextAttribute()
+ {
+ if(mpOutlinerParaObject)
+ {
+ delete mpOutlinerParaObject;
+ }
+ }
+
+ // data read access
+ const SdrText& getSdrText() const
+ {
+ OSL_ENSURE(mpSdrText, "Access to text of default version of ImpSdrTextAttribute (!)");
+ return *mpSdrText;
+ }
+ const OutlinerParaObject& getOutlinerParaObject() const
+ {
+ OSL_ENSURE(mpOutlinerParaObject, "Access to OutlinerParaObject of default version of ImpSdrTextAttribute (!)");
+ return *mpOutlinerParaObject;
+ }
+ bool isContour() const { return mbContour; }
+ 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; }
+ bool isFixedCellHeight() const { return mbFixedCellHeight; }
+ bool isWrongSpell() const { return mbWrongSpell; }
+ const SdrFormTextAttribute& getSdrFormTextAttribute() const { return maSdrFormTextAttribute; }
+ 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; }
+ SdrTextHorzAdjust getSdrTextHorzAdjust() const { return maSdrTextHorzAdjust; }
+ SdrTextVertAdjust getSdrTextVertAdjust() const { return maSdrTextVertAdjust; }
+
+ // compare operator
+ bool operator==(const ImpSdrTextAttribute& rCandidate) const
+ {
+ if(mpOutlinerParaObject != rCandidate.mpOutlinerParaObject)
+ {
+ if(mpOutlinerParaObject && rCandidate.mpOutlinerParaObject)
+ {
+ // compares OPO and it's contents, but traditionally not the RedLining
+ // which is not seen as model, but as temporary information
+ if(!(getOutlinerParaObject() == rCandidate.getOutlinerParaObject()))
+ {
+ return false;
+ }
+
+ // #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)
+ if(!(getOutlinerParaObject().isWrongListEqual(rCandidate.getOutlinerParaObject())))
+ {
+ return false;
+ }
+ }
+ else
+ {
+ // only one is zero; not equal
+ return false;
+ }
+ }
+
+ return (
+ getSdrFormTextAttribute() == rCandidate.getSdrFormTextAttribute()
+ && getTextLeftDistance() == rCandidate.getTextLeftDistance()
+ && getTextUpperDistance() == rCandidate.getTextUpperDistance()
+ && getTextRightDistance() == rCandidate.getTextRightDistance()
+ && getTextLowerDistance() == rCandidate.getTextLowerDistance()
+ && getPropertiesVersion() == rCandidate.getPropertiesVersion()
+
+ && getSdrTextHorzAdjust() == rCandidate.getSdrTextHorzAdjust()
+ && getSdrTextVertAdjust() == rCandidate.getSdrTextVertAdjust()
+
+ && isContour() == rCandidate.isContour()
+ && isFitToSize() == rCandidate.isFitToSize()
+ && isHideContour() == rCandidate.isHideContour()
+ && isBlink() == rCandidate.isBlink()
+ && isScroll() == rCandidate.isScroll()
+ && isInEditMode() == rCandidate.isInEditMode()
+ && isFixedCellHeight() == rCandidate.isFixedCellHeight()
+ && isWrongSpell() == rCandidate.isWrongSpell());
+ }
+
+ static ImpSdrTextAttribute* get_global_default()
+ {
+ static ImpSdrTextAttribute* pDefault = 0;
+
+ if(!pDefault)
+ {
+ // use default constructor
+ pDefault = new ImpSdrTextAttribute();
+
+ // never delete; start with RefCount 1, not 0
+ pDefault->mnRefCount++;
+ }
+
+ return pDefault;
+ }
+ };
+
+ SdrTextAttribute::SdrTextAttribute(
+ const SdrText& rSdrText,
+ const OutlinerParaObject& rOutlinerParaObject,
+ XFormTextStyle eFormTextStyle,
+ sal_Int32 aTextLeftDistance,
+ sal_Int32 aTextUpperDistance,
+ sal_Int32 aTextRightDistance,
+ sal_Int32 aTextLowerDistance,
+ SdrTextHorzAdjust aSdrTextHorzAdjust,
+ SdrTextVertAdjust aSdrTextVertAdjust,
+ bool bContour,
+ bool bFitToSize,
+ bool bHideContour,
+ bool bBlink,
+ bool bScroll,
+ bool bInEditMode,
+ bool bFixedCellHeight,
+ bool bWrongSpell)
+ : mpSdrTextAttribute(new ImpSdrTextAttribute(
+ &rSdrText, rOutlinerParaObject, eFormTextStyle, aTextLeftDistance, aTextUpperDistance,
+ aTextRightDistance, aTextLowerDistance, aSdrTextHorzAdjust, aSdrTextVertAdjust, bContour,
+ bFitToSize, bHideContour, bBlink, bScroll, bInEditMode, bFixedCellHeight, bWrongSpell))
+ {
+ }
+
+ SdrTextAttribute::SdrTextAttribute()
+ : mpSdrTextAttribute(ImpSdrTextAttribute::get_global_default())
+ {
+ mpSdrTextAttribute->mnRefCount++;
+ }
+
+ SdrTextAttribute::SdrTextAttribute(const SdrTextAttribute& rCandidate)
+ : mpSdrTextAttribute(rCandidate.mpSdrTextAttribute)
+ {
+ mpSdrTextAttribute->mnRefCount++;
+ }
+
+ SdrTextAttribute::~SdrTextAttribute()
+ {
+ if(mpSdrTextAttribute->mnRefCount)
+ {
+ mpSdrTextAttribute->mnRefCount--;
+ }
+ else
+ {
+ delete mpSdrTextAttribute;
+ }
+ }
+
+ bool SdrTextAttribute::isDefault() const
+ {
+ return mpSdrTextAttribute == ImpSdrTextAttribute::get_global_default();
+ }
+
+ SdrTextAttribute& SdrTextAttribute::operator=(const SdrTextAttribute& rCandidate)
+ {
+ if(rCandidate.mpSdrTextAttribute != mpSdrTextAttribute)
+ {
+ if(mpSdrTextAttribute->mnRefCount)
+ {
+ mpSdrTextAttribute->mnRefCount--;
+ }
+ else
+ {
+ delete mpSdrTextAttribute;
+ }
+
+ mpSdrTextAttribute = rCandidate.mpSdrTextAttribute;
+ mpSdrTextAttribute->mnRefCount++;
+ }
+
+ return *this;
+ }
+
+ bool SdrTextAttribute::operator==(const SdrTextAttribute& rCandidate) const
+ {
+ if(rCandidate.mpSdrTextAttribute == mpSdrTextAttribute)
+ {
+ return true;
+ }
+
+ if(rCandidate.isDefault() != isDefault())
+ {
+ return false;
+ }
+
+ return (*rCandidate.mpSdrTextAttribute == *mpSdrTextAttribute);
+ }
+
+ const SdrText& SdrTextAttribute::getSdrText() const
+ {
+ return mpSdrTextAttribute->getSdrText();
+ }
+
+ const OutlinerParaObject& SdrTextAttribute::getOutlinerParaObject() const
+ {
+ return mpSdrTextAttribute->getOutlinerParaObject();
+ }
+
+ bool SdrTextAttribute::isContour() const
+ {
+ return mpSdrTextAttribute->isContour();
+ }
+
+ bool SdrTextAttribute::isFitToSize() const
+ {
+ return mpSdrTextAttribute->isFitToSize();
+ }
+
+ bool SdrTextAttribute::isHideContour() const
+ {
+ return mpSdrTextAttribute->isHideContour();
+ }
+
+ bool SdrTextAttribute::isBlink() const
+ {
+ return mpSdrTextAttribute->isBlink();
+ }
+
+ bool SdrTextAttribute::isScroll() const
+ {
+ return mpSdrTextAttribute->isScroll();
+ }
+
+ bool SdrTextAttribute::isInEditMode() const
+ {
+ return mpSdrTextAttribute->isInEditMode();
+ }
+
+ bool SdrTextAttribute::isFixedCellHeight() const
+ {
+ return mpSdrTextAttribute->isFixedCellHeight();
+ }
+
+ bool SdrTextAttribute::isWrongSpell() const
+ {
+ return mpSdrTextAttribute->isWrongSpell();
+ }
+
+ const SdrFormTextAttribute& SdrTextAttribute::getSdrFormTextAttribute() const
+ {
+ return mpSdrTextAttribute->getSdrFormTextAttribute();
+ }
+
+ sal_Int32 SdrTextAttribute::getTextLeftDistance() const
+ {
+ return mpSdrTextAttribute->getTextLeftDistance();
+ }
+
+ sal_Int32 SdrTextAttribute::getTextUpperDistance() const
+ {
+ return mpSdrTextAttribute->getTextUpperDistance();
+ }
+
+ sal_Int32 SdrTextAttribute::getTextRightDistance() const
+ {
+ return mpSdrTextAttribute->getTextRightDistance();
+ }
+
+ sal_Int32 SdrTextAttribute::getTextLowerDistance() const
+ {
+ return mpSdrTextAttribute->getTextLowerDistance();
+ }
+
+ sal_uInt32 SdrTextAttribute::getPropertiesVersion() const
+ {
+ return mpSdrTextAttribute->getPropertiesVersion();
+ }
+
+ SdrTextHorzAdjust SdrTextAttribute::getSdrTextHorzAdjust() const
+ {
+ return mpSdrTextAttribute->getSdrTextHorzAdjust();
+ }
+
+ SdrTextVertAdjust SdrTextAttribute::getSdrTextVertAdjust() const
+ {
+ return mpSdrTextAttribute->getSdrTextVertAdjust();
+ }
+
+ void SdrTextAttribute::getBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const
+ {
+ if(isBlink())
+ {
+ getSdrText().GetObject().impGetBlinkTextTiming(rAnimList);
+ }
+ }
+
+ void SdrTextAttribute::getScrollTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList, double fFrameLength, double fTextLength) const
+ {
+ if(isScroll())
+ {
+ getSdrText().GetObject().impGetScrollTextTiming(rAnimList, fFrameLength, fTextLength);
+ }
+ }
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/displayinfo.cxx b/svx/source/sdr/contact/displayinfo.cxx
new file mode 100644
index 000000000000..d964611c59a0
--- /dev/null
+++ b/svx/source/sdr/contact/displayinfo.cxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/svapp.hxx>
+#include <svx/svdobj.hxx>
+#include <vcl/gdimtf.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdview.hxx>
+
+#define ALL_GHOSTED_DRAWMODES (DRAWMODE_GHOSTEDLINE|DRAWMODE_GHOSTEDFILL|DRAWMODE_GHOSTEDTEXT|DRAWMODE_GHOSTEDBITMAP|DRAWMODE_GHOSTEDGRADIENT)
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ DisplayInfo::DisplayInfo()
+ : maProcessLayers(true), // init layer info with all bits set to draw everything on default
+ maRedrawArea(),
+ mbControlLayerProcessingActive(false),
+ mbPageProcessingActive(true),
+ mbGhostedDrawModeActive(false),
+ mbSubContentActive(false)
+ {
+ }
+
+ DisplayInfo::~DisplayInfo()
+ {
+ }
+
+ // Access to LayerInfos (which layers to proccess)
+ void DisplayInfo::SetProcessLayers(const SetOfByte& rSet)
+ {
+ maProcessLayers = rSet;
+ }
+
+ // access to RedrawArea
+ void DisplayInfo::SetRedrawArea(const Region& rRegion)
+ {
+ maRedrawArea = rRegion;
+ }
+
+ void DisplayInfo::SetControlLayerProcessingActive(bool bDoProcess)
+ {
+ if((bool)mbControlLayerProcessingActive != bDoProcess)
+ {
+ mbControlLayerProcessingActive = bDoProcess;
+ }
+ }
+
+ void DisplayInfo::SetPageProcessingActive(bool bDoProcess)
+ {
+ if((bool)mbPageProcessingActive != bDoProcess)
+ {
+ mbPageProcessingActive = bDoProcess;
+ }
+ }
+
+ void DisplayInfo::ClearGhostedDrawMode()
+ {
+ mbGhostedDrawModeActive = false;
+ }
+
+ void DisplayInfo::SetGhostedDrawMode()
+ {
+ mbGhostedDrawModeActive = true;
+ }
+
+ void DisplayInfo::SetSubContentActive(bool bNew)
+ {
+ if((bool)mbSubContentActive != bNew)
+ {
+ mbSubContentActive = bNew;
+ }
+ }
+
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/objectcontact.cxx b/svx/source/sdr/contact/objectcontact.cxx
new file mode 100644
index 000000000000..bda2e1529988
--- /dev/null
+++ b/svx/source/sdr/contact/objectcontact.cxx
@@ -0,0 +1,322 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/contact/objectcontact.hxx>
+#include <tools/debug.hxx>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/sdr/event/eventhandler.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/animation/objectanimator.hxx>
+#include <svx/sdr/event/eventhandler.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ObjectContact::ObjectContact()
+ : maViewObjectContactVector(),
+ maPrimitiveAnimator(),
+ mpEventHandler(0),
+ mpViewObjectContactRedirector(0),
+ maViewInformation2D(uno::Sequence< beans::PropertyValue >()),
+ mbIsPreviewRenderer(false)
+ {
+ }
+
+ ObjectContact::~ObjectContact()
+ {
+ // get rid of all registered contacts
+ // #i84257# To avoid that each 'delete pCandidate' again uses
+ // the local RemoveViewObjectContact with a search and removal in the
+ // vector, simply copy and clear local vector.
+ std::vector< ViewObjectContact* > aLocalVOCList(maViewObjectContactVector);
+ maViewObjectContactVector.clear();
+
+ while(aLocalVOCList.size())
+ {
+ ViewObjectContact* pCandidate = aLocalVOCList.back();
+ aLocalVOCList.pop_back();
+ DBG_ASSERT(pCandidate, "Corrupted ViewObjectContactList (!)");
+
+ // ViewObjectContacts only make sense with View and Object contacts.
+ // When the contact to the SdrObject is deleted like in this case,
+ // all ViewObjectContacts can be deleted, too.
+ delete pCandidate;
+ }
+
+ // assert when there were new entries added during deletion
+ DBG_ASSERT(maViewObjectContactVector.empty(), "Corrupted ViewObjectContactList (!)");
+
+ // delete the EventHandler. This will destroy all still contained events.
+ DeleteEventHandler();
+ }
+
+ // LazyInvalidate request. Default implementation directly handles
+ // this by calling back triggerLazyInvalidate() at the VOC
+ void ObjectContact::setLazyInvalidate(ViewObjectContact& rVOC)
+ {
+ rVOC.triggerLazyInvalidate();
+ }
+
+ // call this to support evtl. preparations for repaint. Default does nothing
+ void ObjectContact::PrepareProcessDisplay()
+ {
+ }
+
+ // A new ViewObjectContact was created and shall be remembered.
+ void ObjectContact::AddViewObjectContact(ViewObjectContact& rVOContact)
+ {
+ maViewObjectContactVector.push_back(&rVOContact);
+ }
+
+ // A ViewObjectContact was deleted and shall be forgotten.
+ void ObjectContact::RemoveViewObjectContact(ViewObjectContact& rVOContact)
+ {
+ std::vector< ViewObjectContact* >::iterator aFindResult = std::find(maViewObjectContactVector.begin(), maViewObjectContactVector.end(), &rVOContact);
+
+ if(aFindResult != maViewObjectContactVector.end())
+ {
+ maViewObjectContactVector.erase(aFindResult);
+ }
+ }
+
+ // Process the whole displaying
+ void ObjectContact::ProcessDisplay(DisplayInfo& /*rDisplayInfo*/)
+ {
+ // default does nothing
+ }
+
+ // test if visualizing of entered groups is switched on at all
+ bool ObjectContact::DoVisualizeEnteredGroup() const
+ {
+ // Don not do that as default
+ return false;
+ }
+
+ // get active group's (the entered group) ViewContact
+ const ViewContact* ObjectContact::getActiveViewContact() const
+ {
+ // default has no active VC
+ return 0;
+ }
+
+ // Invalidate given rectangle at the window/output which is represented by
+ // this ObjectContact.
+ void ObjectContact::InvalidatePartOfView(const basegfx::B2DRange& /*rRange*/) const
+ {
+ // nothing to do here in the default version
+ }
+
+ // Get info if given Rectangle is visible in this view
+ bool ObjectContact::IsAreaVisible(const basegfx::B2DRange& /*rRange*/) const
+ {
+ // always visible in default version
+ return true;
+ }
+
+ // Get info about the need to visualize GluePoints
+ bool ObjectContact::AreGluePointsVisible() const
+ {
+ return false;
+ }
+
+ // method to create a EventHandler. Needs to give a result.
+ sdr::event::TimerEventHandler* ObjectContact::CreateEventHandler()
+ {
+ // Create and return a new EventHandler
+ return new sdr::event::TimerEventHandler();
+ }
+
+ // method to get the primitiveAnimator
+ sdr::animation::primitiveAnimator& ObjectContact::getPrimitiveAnimator()
+ {
+ return maPrimitiveAnimator;
+ }
+
+ // method to get the EventHandler. It will
+ // return a existing one or create a new one using CreateEventHandler().
+ sdr::event::TimerEventHandler& ObjectContact::GetEventHandler() const
+ {
+ if(!HasEventHandler())
+ {
+ const_cast< ObjectContact* >(this)->mpEventHandler = const_cast< ObjectContact* >(this)->CreateEventHandler();
+ DBG_ASSERT(mpEventHandler, "ObjectContact::GetEventHandler(): Got no EventHandler (!)");
+ }
+
+ return *mpEventHandler;
+ }
+
+ // delete the EventHandler
+ void ObjectContact::DeleteEventHandler()
+ {
+ if(mpEventHandler)
+ {
+ // If there are still Events registered, something has went wrong
+ delete mpEventHandler;
+ mpEventHandler = 0L;
+ }
+ }
+
+ // test if there is an EventHandler without creating one on demand
+ bool ObjectContact::HasEventHandler() const
+ {
+ return (0L != mpEventHandler);
+ }
+
+ // check if text animation is allowed. Default is sal_true.
+ bool ObjectContact::IsTextAnimationAllowed() const
+ {
+ return true;
+ }
+
+ // check if graphic animation is allowed. Default is sal_true.
+ bool ObjectContact::IsGraphicAnimationAllowed() const
+ {
+ return true;
+ }
+
+ // check if asynchronious graphis loading is allowed. Default is false.
+ bool ObjectContact::IsAsynchronGraphicsLoadingAllowed() const
+ {
+ return false;
+ }
+
+ // access to ViewObjectContactRedirector
+ ViewObjectContactRedirector* ObjectContact::GetViewObjectContactRedirector() const
+ {
+ return mpViewObjectContactRedirector;
+ }
+
+ void ObjectContact::SetViewObjectContactRedirector(ViewObjectContactRedirector* pNew)
+ {
+ if(mpViewObjectContactRedirector != pNew)
+ {
+ mpViewObjectContactRedirector = pNew;
+ }
+ }
+
+ // check if buffering of MasterPages is allowed. Default is false.
+ bool ObjectContact::IsMasterPageBufferingAllowed() const
+ {
+ return false;
+ }
+
+ // print? Default is false
+ bool ObjectContact::isOutputToPrinter() const
+ {
+ return false;
+ }
+
+ // window? Default is true
+ bool ObjectContact::isOutputToWindow() const
+ {
+ return true;
+ }
+
+ // VirtualDevice? Default is false
+ bool ObjectContact::isOutputToVirtualDevice() const
+ {
+ return false;
+ }
+
+ // recording MetaFile? Default is false
+ bool ObjectContact::isOutputToRecordingMetaFile() const
+ {
+ return false;
+ }
+
+ // pdf export? Default is false
+ bool ObjectContact::isOutputToPDFFile() const
+ {
+ return false;
+ }
+
+ // gray display mode
+ bool ObjectContact::isDrawModeGray() const
+ {
+ return false;
+ }
+
+ // gray display mode
+ bool ObjectContact::isDrawModeBlackWhite() const
+ {
+ return false;
+ }
+
+ // high contrast display mode
+ bool ObjectContact::isDrawModeHighContrast() const
+ {
+ return false;
+ }
+
+ // access to SdrPageView. Default implementation returns NULL
+ SdrPageView* ObjectContact::TryToGetSdrPageView() const
+ {
+ return 0;
+ }
+
+ // access to OutputDevice. Default implementation returns NULL
+ OutputDevice* ObjectContact::TryToGetOutputDevice() const
+ {
+ return 0;
+ }
+
+ void ObjectContact::resetViewPort()
+ {
+ const drawinglayer::geometry::ViewInformation2D& rCurrentVI2D = getViewInformation2D();
+
+ if(!rCurrentVI2D.getViewport().isEmpty())
+ {
+ const basegfx::B2DRange aEmptyRange;
+
+ drawinglayer::geometry::ViewInformation2D aNewVI2D(
+ rCurrentVI2D.getObjectTransformation(),
+ rCurrentVI2D.getViewTransformation(),
+ aEmptyRange,
+ rCurrentVI2D.getVisualizedPage(),
+ rCurrentVI2D.getViewTime(),
+ rCurrentVI2D.getExtendedInformationSequence());
+
+ updateViewInformation2D(aNewVI2D);
+ }
+ }
+
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx b/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx
new file mode 100644
index 000000000000..5d4e6d71fbe9
--- /dev/null
+++ b/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx
@@ -0,0 +1,226 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/svdmodel.hxx>
+#include <drawinglayer/processor2d/vclprocessor2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/contact/objectcontacttools.hxx>
+#include <svx/unoapi.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ObjectContactPainter::ObjectContactPainter()
+ {
+ }
+
+ // The destructor.
+ ObjectContactPainter::~ObjectContactPainter()
+ {
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ sal_uInt32 ObjectContactOfObjListPainter::GetPaintObjectCount() const
+ {
+ return maStartObjects.size();
+ }
+
+ ViewContact& ObjectContactOfObjListPainter::GetPaintObjectViewContact(sal_uInt32 nIndex) const
+ {
+ const SdrObject* pObj = maStartObjects[nIndex];
+ DBG_ASSERT(pObj, "ObjectContactOfObjListPainter: Corrupt SdrObjectVector (!)");
+ return pObj->GetViewContact();
+ }
+
+ ObjectContactOfObjListPainter::ObjectContactOfObjListPainter(
+ OutputDevice& rTargetDevice,
+ const SdrObjectVector& rObjects,
+ const SdrPage* pProcessedPage)
+ : ObjectContactPainter(),
+ mrTargetOutputDevice(rTargetDevice),
+ maStartObjects(rObjects),
+ mpProcessedPage(pProcessedPage)
+ {
+ }
+
+ ObjectContactOfObjListPainter::~ObjectContactOfObjListPainter()
+ {
+ }
+
+ // Process the whole displaying
+ void ObjectContactOfObjListPainter::ProcessDisplay(DisplayInfo& rDisplayInfo)
+ {
+ const sal_uInt32 nCount(GetPaintObjectCount());
+
+ if(nCount)
+ {
+ OutputDevice* pTargetDevice = TryToGetOutputDevice();
+
+ if(pTargetDevice)
+ {
+ // update current ViewInformation2D at the ObjectContact
+ const GDIMetaFile* pMetaFile = pTargetDevice->GetConnectMetaFile();
+ const bool bOutputToRecordingMetaFile(pMetaFile && pMetaFile->IsRecord() && !pMetaFile->IsPause());
+ basegfx::B2DRange aViewRange;
+
+ // create ViewRange
+ if(!bOutputToRecordingMetaFile)
+ {
+ // use visible pixels, but transform to world coordinates
+ const Size aOutputSizePixel(pTargetDevice->GetOutputSizePixel());
+ aViewRange = ::basegfx::B2DRange(0.0, 0.0, aOutputSizePixel.getWidth(), aOutputSizePixel.getHeight());
+ aViewRange.transform(pTargetDevice->GetInverseViewTransformation());
+ }
+
+ // upate local ViewInformation2D
+ const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D(
+ basegfx::B2DHomMatrix(),
+ pTargetDevice->GetViewTransformation(),
+ aViewRange,
+ GetXDrawPageForSdrPage(const_cast< SdrPage* >(mpProcessedPage)),
+ 0.0,
+ com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>());
+ updateViewInformation2D(aNewViewInformation2D);
+
+ // collect primitive data in a sequence; this will already use the updated ViewInformation2D
+ drawinglayer::primitive2d::Primitive2DSequence xPrimitiveSequence;
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ const ViewObjectContact& rViewObjectContact = GetPaintObjectViewContact(a).GetViewObjectContact(*this);
+
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xPrimitiveSequence,
+ rViewObjectContact.getPrimitive2DSequenceHierarchy(rDisplayInfo));
+ }
+
+ // if there is something to show, use a vclProcessor to render it
+ if(xPrimitiveSequence.hasElements())
+ {
+ drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = createBaseProcessor2DFromOutputDevice(
+ *pTargetDevice, getViewInformation2D());
+
+ if(pProcessor2D)
+ {
+ pProcessor2D->process(xPrimitiveSequence);
+ delete pProcessor2D;
+ }
+ }
+ }
+ }
+ }
+
+ // VirtualDevice?
+ bool ObjectContactOfObjListPainter::isOutputToVirtualDevice() const
+ {
+ return (OUTDEV_VIRDEV == mrTargetOutputDevice.GetOutDevType());
+ }
+
+ // recording MetaFile?
+ bool ObjectContactOfObjListPainter::isOutputToRecordingMetaFile() const
+ {
+ GDIMetaFile* pMetaFile = mrTargetOutputDevice.GetConnectMetaFile();
+ return (pMetaFile && pMetaFile->IsRecord() && !pMetaFile->IsPause());
+ }
+
+ // pdf export?
+ bool ObjectContactOfObjListPainter::isOutputToPDFFile() const
+ {
+ return (0 != mrTargetOutputDevice.GetPDFWriter());
+ }
+
+ OutputDevice* ObjectContactOfObjListPainter::TryToGetOutputDevice() const
+ {
+ return &mrTargetOutputDevice;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ sal_uInt32 ObjectContactOfPagePainter::GetPaintObjectCount() const
+ {
+ return (GetStartPage() ? 1L : 0L);
+ }
+
+ ViewContact& ObjectContactOfPagePainter::GetPaintObjectViewContact(sal_uInt32 /*nIndex*/) const
+ {
+ DBG_ASSERT(GetStartPage(), "ObjectContactOfPagePainter::GetPaintObjectViewContact: no StartPage set (!)");
+ return GetStartPage()->GetViewContact();
+ }
+
+ ObjectContactOfPagePainter::ObjectContactOfPagePainter(
+ const SdrPage* pPage,
+ ObjectContact& rOriginalObjectContact)
+ : ObjectContactPainter(),
+ mrOriginalObjectContact(rOriginalObjectContact),
+ mxStartPage(const_cast< SdrPage* >(pPage)) // no SdrPageWeakRef available to hold a const SdrPage*
+ {
+ }
+
+ ObjectContactOfPagePainter::~ObjectContactOfPagePainter()
+ {
+ }
+
+ void ObjectContactOfPagePainter::SetStartPage(const SdrPage* pPage)
+ {
+ if(pPage != GetStartPage())
+ {
+ mxStartPage.reset(const_cast< SdrPage* >(pPage)); // no SdrPageWeakRef available to hold a const SdrPage*
+ }
+ }
+
+ OutputDevice* ObjectContactOfPagePainter::TryToGetOutputDevice() const
+ {
+ return mrOriginalObjectContact.TryToGetOutputDevice();
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx b/svx/source/sdr/contact/objectcontactofpageview.cxx
new file mode 100644
index 000000000000..d804cce575a1
--- /dev/null
+++ b/svx/source/sdr/contact/objectcontactofpageview.cxx
@@ -0,0 +1,485 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/contact/objectcontactofpageview.hxx>
+#include <svx/sdr/contact/viewobjectcontactofunocontrol.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <svx/svdview.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/sdr/animation/objectanimator.hxx>
+#include <svx/sdr/event/eventhandler.hxx>
+#include <svx/sdrpagewindow.hxx>
+#include <svx/sdrpaintwindow.hxx>
+#include <drawinglayer/processor2d/vclprocessor2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
+#include <svx/sdr/contact/objectcontacttools.hxx>
+#include <com/sun/star/rendering/XSpriteCanvas.hpp>
+#include <svx/unoapi.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ // internal access to SdrPage of SdrPageView
+ SdrPage* ObjectContactOfPageView::GetSdrPage() const
+ {
+ return GetPageWindow().GetPageView().GetPage();
+ }
+
+ ObjectContactOfPageView::ObjectContactOfPageView(SdrPageWindow& rPageWindow)
+ : ObjectContact(),
+ mrPageWindow(rPageWindow)
+ {
+ // init PreviewRenderer flag
+ setPreviewRenderer(((SdrPaintView&)rPageWindow.GetPageView().GetView()).IsPreviewRenderer());
+
+ // init timer
+ SetTimeout(1);
+ Stop();
+ }
+
+ ObjectContactOfPageView::~ObjectContactOfPageView()
+ {
+ // execute missing LazyInvalidates and stop timer
+ Timeout();
+ }
+
+ // LazyInvalidate request. Take action.
+ void ObjectContactOfPageView::setLazyInvalidate(ViewObjectContact& /*rVOC*/)
+ {
+ // do NOT call parent, but remember that something is to do by
+ // starting the LazyInvalidateTimer
+ Start();
+ }
+
+ // call this to support evtl. preparations for repaint
+ void ObjectContactOfPageView::PrepareProcessDisplay()
+ {
+ if(IsActive())
+ {
+ static bool bInvalidateDuringPaint(true);
+
+ if(bInvalidateDuringPaint)
+ {
+ // there are still non-triggered LazyInvalidate events, trigger these
+ Timeout();
+ }
+ }
+ }
+
+ // From baseclass Timer, the timeout call triggered by te LazyInvalidate mechanism
+ void ObjectContactOfPageView::Timeout()
+ {
+ // stop the timer
+ Stop();
+
+ // invalidate all LazyInvalidate VOCs new situations
+ const sal_uInt32 nVOCCount(getViewObjectContactCount());
+
+ for(sal_uInt32 a(0); a < nVOCCount; a++)
+ {
+ ViewObjectContact* pCandidate = getViewObjectContact(a);
+ pCandidate->triggerLazyInvalidate();
+ }
+ }
+
+ // Process the whole displaying
+ void ObjectContactOfPageView::ProcessDisplay(DisplayInfo& rDisplayInfo)
+ {
+ const SdrPage* pStartPage = GetSdrPage();
+
+ if(pStartPage && !rDisplayInfo.GetProcessLayers().IsEmpty())
+ {
+ const ViewContact& rDrawPageVC = pStartPage->GetViewContact();
+
+ if(rDrawPageVC.GetObjectCount())
+ {
+ DoProcessDisplay(rDisplayInfo);
+ }
+ }
+
+ // after paint take care of the evtl. scheduled asynchronious commands.
+ // Do this by resetting the timer contained there. Thus, after the paint
+ // that timer will be triggered and the events will be executed.
+ if(HasEventHandler())
+ {
+ sdr::event::TimerEventHandler& rEventHandler = GetEventHandler();
+
+ if(!rEventHandler.IsEmpty())
+ {
+ rEventHandler.Restart();
+ }
+ }
+ }
+
+ // Process the whole displaying. Only use given DsiplayInfo, do not access other
+ // OutputDevices then the given ones.
+ void ObjectContactOfPageView::DoProcessDisplay(DisplayInfo& rDisplayInfo)
+ {
+ // visualize entered group when that feature is switched on and it's not
+ // a print output. #i29129# No ghosted display for printing.
+ sal_Bool bVisualizeEnteredGroup(DoVisualizeEnteredGroup() && !isOutputToPrinter());
+
+ // Visualize entered groups: Set to ghosted as default
+ // start. Do this only for the DrawPage, not for MasterPages
+ if(bVisualizeEnteredGroup)
+ {
+ rDisplayInfo.SetGhostedDrawMode();
+ }
+
+ // #114359# save old and set clip region
+ OutputDevice* pOutDev = TryToGetOutputDevice();
+ OSL_ENSURE(0 != pOutDev, "ObjectContactOfPageView without OutDev, someone has overloaded TryToGetOutputDevice wrong (!)");
+ sal_Bool bClipRegionPushed(sal_False);
+ const Region& rRedrawArea(rDisplayInfo.GetRedrawArea());
+
+ if(!rRedrawArea.IsEmpty())
+ {
+ bClipRegionPushed = sal_True;
+ pOutDev->Push(PUSH_CLIPREGION);
+ pOutDev->IntersectClipRegion(rRedrawArea);
+ }
+
+ // Get start node and process DrawPage contents
+ const ViewObjectContact& rDrawPageVOContact = GetSdrPage()->GetViewContact().GetViewObjectContact(*this);
+
+ // update current ViewInformation2D at the ObjectContact
+ const double fCurrentTime(getPrimitiveAnimator().GetTime());
+ OutputDevice& rTargetOutDev = GetPageWindow().GetPaintWindow().GetTargetOutputDevice();
+ basegfx::B2DRange aViewRange;
+
+ // create ViewRange
+ if(isOutputToRecordingMetaFile())
+ {
+ if(isOutputToPDFFile() || isOutputToPrinter())
+ {
+ // #i98402# if it's a PDF export, set the ClipRegion as ViewRange. This is
+ // mainly because SW does not use DrawingLayer Page-Oriented and if not doing this,
+ // all existing objects will be collected as primitives and processed.
+ // OD 2009-03-05 #i99876# perform the same also for SW on printing.
+ const Rectangle aLogicClipRectangle(rDisplayInfo.GetRedrawArea().GetBoundRect());
+
+ aViewRange = basegfx::B2DRange(
+ aLogicClipRectangle.Left(), aLogicClipRectangle.Top(),
+ aLogicClipRectangle.Right(), aLogicClipRectangle.Bottom());
+ }
+ }
+ else
+ {
+ // use visible pixels, but transform to world coordinates
+ const Size aOutputSizePixel(rTargetOutDev.GetOutputSizePixel());
+ aViewRange = basegfx::B2DRange(0.0, 0.0, aOutputSizePixel.getWidth(), aOutputSizePixel.getHeight());
+
+ // if a clip region is set, use it
+ if(!rDisplayInfo.GetRedrawArea().IsEmpty())
+ {
+ // get logic clip range and create discrete one
+ const Rectangle aLogicClipRectangle(rDisplayInfo.GetRedrawArea().GetBoundRect());
+ basegfx::B2DRange aLogicClipRange(
+ aLogicClipRectangle.Left(), aLogicClipRectangle.Top(),
+ aLogicClipRectangle.Right(), aLogicClipRectangle.Bottom());
+ basegfx::B2DRange aDiscreteClipRange(aLogicClipRange);
+ aDiscreteClipRange.transform(rTargetOutDev.GetViewTransformation());
+
+ // align the discrete one to discrete boundaries (pixel bounds). Also
+ // expand X and Y max by one due to Rectangle definition source
+ aDiscreteClipRange.expand(basegfx::B2DTuple(
+ floor(aDiscreteClipRange.getMinX()),
+ floor(aDiscreteClipRange.getMinY())));
+ aDiscreteClipRange.expand(basegfx::B2DTuple(
+ 1.0 + ceil(aDiscreteClipRange.getMaxX()),
+ 1.0 + ceil(aDiscreteClipRange.getMaxY())));
+
+ // intersect current ViewRange with ClipRange
+ aViewRange.intersect(aDiscreteClipRange);
+ }
+
+ // transform to world coordinates
+ aViewRange.transform(rTargetOutDev.GetInverseViewTransformation());
+ }
+
+ // update local ViewInformation2D
+ const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D(
+ basegfx::B2DHomMatrix(),
+ rTargetOutDev.GetViewTransformation(),
+ aViewRange,
+ GetXDrawPageForSdrPage(GetSdrPage()),
+ fCurrentTime,
+ uno::Sequence<beans::PropertyValue>());
+ updateViewInformation2D(aNewViewInformation2D);
+
+ // get whole Primitive2DSequence; this will already make use of updated ViewInformation2D
+ // and may use the MapMode from the Target OutDev in the DisplayInfo
+ drawinglayer::primitive2d::Primitive2DSequence xPrimitiveSequence(rDrawPageVOContact.getPrimitive2DSequenceHierarchy(rDisplayInfo));
+
+ // if there is something to show, use a primitive processor to render it. There
+ // is a choice between VCL and Canvas processors currently. The decision is made in
+ // createBaseProcessor2DFromOutputDevice and takes into accout things like the
+ // Target is a MetaFile, a VDev or something else. The Canvas renderer is triggered
+ // currently using the shown boolean. Canvas is not yet the default.
+ if(xPrimitiveSequence.hasElements())
+ {
+ // prepare OutputDevice (historical stuff, maybe soon removed)
+ rDisplayInfo.ClearGhostedDrawMode(); // reset, else the VCL-paint with the processor will not do the right thing
+ pOutDev->SetLayoutMode(0); // reset, default is no BiDi/RTL
+
+ // create renderer
+ drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = createBaseProcessor2DFromOutputDevice(
+ rTargetOutDev, getViewInformation2D());
+
+ if(pProcessor2D)
+ {
+ pProcessor2D->process(xPrimitiveSequence);
+ delete pProcessor2D;
+ }
+ }
+
+ // #114359# restore old ClipReghion
+ if(bClipRegionPushed)
+ {
+ pOutDev->Pop();
+ }
+
+ // Visualize entered groups: Reset to original DrawMode
+ if(bVisualizeEnteredGroup)
+ {
+ rDisplayInfo.ClearGhostedDrawMode();
+ }
+ }
+
+ // test if visualizing of entered groups is switched on at all
+ bool ObjectContactOfPageView::DoVisualizeEnteredGroup() const
+ {
+ SdrView& rView = GetPageWindow().GetPageView().GetView();
+ return rView.DoVisualizeEnteredGroup();
+ }
+
+ // get active group's (the entered group) ViewContact
+ const ViewContact* ObjectContactOfPageView::getActiveViewContact() const
+ {
+ SdrObjList* pActiveGroupList = GetPageWindow().GetPageView().GetObjList();
+
+ if(pActiveGroupList)
+ {
+ if(pActiveGroupList->ISA(SdrPage))
+ {
+ // It's a Page itself
+ return &(((SdrPage*)pActiveGroupList)->GetViewContact());
+ }
+ else if(pActiveGroupList->GetOwnerObj())
+ {
+ // Group object
+ return &(pActiveGroupList->GetOwnerObj()->GetViewContact());
+ }
+ }
+ else if(GetSdrPage())
+ {
+ // use page of associated SdrPageView
+ return &(GetSdrPage()->GetViewContact());
+ }
+
+ return 0;
+ }
+
+ // Invalidate given rectangle at the window/output which is represented by
+ // this ObjectContact.
+ void ObjectContactOfPageView::InvalidatePartOfView(const basegfx::B2DRange& rRange) const
+ {
+ // invalidate at associated PageWindow
+ GetPageWindow().InvalidatePageWindow(rRange);
+ }
+
+ // Get info if given Rectangle is visible in this view
+ bool ObjectContactOfPageView::IsAreaVisible(const basegfx::B2DRange& rRange) const
+ {
+ // compare with the visible rectangle
+ if(rRange.isEmpty())
+ {
+ // no range -> not visible
+ return false;
+ }
+ else
+ {
+ const OutputDevice& rTargetOutDev = GetPageWindow().GetPaintWindow().GetTargetOutputDevice();
+ const Size aOutputSizePixel(rTargetOutDev.GetOutputSizePixel());
+ basegfx::B2DRange aLogicViewRange(0.0, 0.0, aOutputSizePixel.getWidth(), aOutputSizePixel.getHeight());
+
+ aLogicViewRange.transform(rTargetOutDev.GetInverseViewTransformation());
+
+ if(!aLogicViewRange.isEmpty() && !aLogicViewRange.overlaps(rRange))
+ {
+ return false;
+ }
+ }
+
+ // call parent
+ return ObjectContact::IsAreaVisible(rRange);
+ }
+
+ // Get info about the need to visualize GluePoints
+ bool ObjectContactOfPageView::AreGluePointsVisible() const
+ {
+ return GetPageWindow().GetPageView().GetView().ImpIsGlueVisible();
+ }
+
+ // check if text animation is allowed.
+ bool ObjectContactOfPageView::IsTextAnimationAllowed() const
+ {
+ SdrView& rView = GetPageWindow().GetPageView().GetView();
+ const SvtAccessibilityOptions& rOpt = rView.getAccessibilityOptions();
+ return rOpt.GetIsAllowAnimatedText();
+ }
+
+ // check if graphic animation is allowed.
+ bool ObjectContactOfPageView::IsGraphicAnimationAllowed() const
+ {
+ SdrView& rView = GetPageWindow().GetPageView().GetView();
+ const SvtAccessibilityOptions& rOpt = rView.getAccessibilityOptions();
+ return rOpt.GetIsAllowAnimatedGraphics();
+ }
+
+ // check if asynchronious graphis loading is allowed. Default is sal_False.
+ bool ObjectContactOfPageView::IsAsynchronGraphicsLoadingAllowed() const
+ {
+ SdrView& rView = GetPageWindow().GetPageView().GetView();
+ return rView.IsSwapAsynchron();
+ }
+
+ // check if buffering of MasterPages is allowed. Default is sal_False.
+ bool ObjectContactOfPageView::IsMasterPageBufferingAllowed() const
+ {
+ SdrView& rView = GetPageWindow().GetPageView().GetView();
+ return rView.IsMasterPagePaintCaching();
+ }
+
+ // print?
+ bool ObjectContactOfPageView::isOutputToPrinter() const
+ {
+ return (OUTDEV_PRINTER == mrPageWindow.GetPaintWindow().GetOutputDevice().GetOutDevType());
+ }
+
+ // window?
+ bool ObjectContactOfPageView::isOutputToWindow() const
+ {
+ return (OUTDEV_WINDOW == mrPageWindow.GetPaintWindow().GetOutputDevice().GetOutDevType());
+ }
+
+ // VirtualDevice?
+ bool ObjectContactOfPageView::isOutputToVirtualDevice() const
+ {
+ return (OUTDEV_VIRDEV == mrPageWindow.GetPaintWindow().GetOutputDevice().GetOutDevType());
+ }
+
+ // recording MetaFile?
+ bool ObjectContactOfPageView::isOutputToRecordingMetaFile() const
+ {
+ GDIMetaFile* pMetaFile = mrPageWindow.GetPaintWindow().GetOutputDevice().GetConnectMetaFile();
+ return (pMetaFile && pMetaFile->IsRecord() && !pMetaFile->IsPause());
+ }
+
+ // pdf export?
+ bool ObjectContactOfPageView::isOutputToPDFFile() const
+ {
+ return (0 != mrPageWindow.GetPaintWindow().GetOutputDevice().GetPDFWriter());
+ }
+
+ // gray display mode
+ bool ObjectContactOfPageView::isDrawModeGray() const
+ {
+ const sal_uInt32 nDrawMode(mrPageWindow.GetPaintWindow().GetOutputDevice().GetDrawMode());
+ return (nDrawMode == (DRAWMODE_GRAYLINE|DRAWMODE_GRAYFILL|DRAWMODE_BLACKTEXT|DRAWMODE_GRAYBITMAP|DRAWMODE_GRAYGRADIENT));
+ }
+
+ // gray display mode
+ bool ObjectContactOfPageView::isDrawModeBlackWhite() const
+ {
+ const sal_uInt32 nDrawMode(mrPageWindow.GetPaintWindow().GetOutputDevice().GetDrawMode());
+ return (nDrawMode == (DRAWMODE_BLACKLINE|DRAWMODE_BLACKTEXT|DRAWMODE_WHITEFILL|DRAWMODE_GRAYBITMAP|DRAWMODE_WHITEGRADIENT));
+ }
+
+ // high contrast display mode
+ bool ObjectContactOfPageView::isDrawModeHighContrast() const
+ {
+ const sal_uInt32 nDrawMode(mrPageWindow.GetPaintWindow().GetOutputDevice().GetDrawMode());
+ return (nDrawMode == (DRAWMODE_SETTINGSLINE|DRAWMODE_SETTINGSFILL|DRAWMODE_SETTINGSTEXT|DRAWMODE_SETTINGSGRADIENT));
+ }
+
+ // access to SdrPageView
+ SdrPageView* ObjectContactOfPageView::TryToGetSdrPageView() const
+ {
+ return &(mrPageWindow.GetPageView());
+ }
+
+
+ // access to OutputDevice
+ OutputDevice* ObjectContactOfPageView::TryToGetOutputDevice() const
+ {
+ SdrPreRenderDevice* pPreRenderDevice = mrPageWindow.GetPaintWindow().GetPreRenderDevice();
+
+ if(pPreRenderDevice)
+ {
+ return &(pPreRenderDevice->GetPreRenderDevice());
+ }
+ else
+ {
+ return &(mrPageWindow.GetPaintWindow().GetOutputDevice());
+ }
+ }
+
+ // set all UNO controls displayed in the view to design/alive mode
+ void ObjectContactOfPageView::SetUNOControlsDesignMode( bool _bDesignMode ) const
+ {
+ const sal_uInt32 nCount(getViewObjectContactCount());
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ const ViewObjectContact* pVOC = getViewObjectContact(a);
+ const ViewObjectContactOfUnoControl* pUnoObjectVOC = dynamic_cast< const ViewObjectContactOfUnoControl* >(pVOC);
+
+ if(pUnoObjectVOC)
+ {
+ pUnoObjectVOC->setControlDesignMode(_bDesignMode);
+ }
+ }
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/objectcontacttools.cxx b/svx/source/sdr/contact/objectcontacttools.cxx
new file mode 100644
index 000000000000..5776bd8847ce
--- /dev/null
+++ b/svx/source/sdr/contact/objectcontacttools.cxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/objectcontacttools.hxx>
+#include <vcl/outdev.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <vcl/gdimtf.hxx>
+#include <basegfx/tools/canvastools.hxx>
+#include <drawinglayer/processor2d/vclmetafileprocessor2d.hxx>
+#include <drawinglayer/processor2d/vclpixelprocessor2d.hxx>
+#include <drawinglayer/processor2d/canvasprocessor.hxx>
+#include <vcl/window.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ drawinglayer::processor2d::BaseProcessor2D* createBaseProcessor2DFromOutputDevice(
+ OutputDevice& rTargetOutDev,
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation2D)
+ {
+ const GDIMetaFile* pMetaFile = rTargetOutDev.GetConnectMetaFile();
+ const bool bOutputToRecordingMetaFile(pMetaFile && pMetaFile->IsRecord() && !pMetaFile->IsPause());
+
+ if(bOutputToRecordingMetaFile)
+ {
+ // create MetaFile Vcl-Processor and process
+ return new drawinglayer::processor2d::VclMetafileProcessor2D(rViewInformation2D, rTargetOutDev);
+ }
+ else
+ {
+#ifdef WIN32
+ // for a first AA incarnation VCL-PixelRenderer will be okay since
+ // simple (and fast) GDIPlus support over VCL will be used.
+ // Leaving the code below as a hint for what to do when we will
+ // use canvas renderers in the future
+
+ //static SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
+
+ //if(false && aSvtOptionsDrawinglayer.IsAntiAliasing())
+ //{
+ // // for WIN32 AA, create cairo canvas processor
+ // return new drawinglayer::processor2d::canvasProcessor2D(rViewInformation2D, rTargetOutDev);
+ //}
+ //else
+ //{
+ // create Pixel Vcl-Processor
+ return new drawinglayer::processor2d::VclPixelProcessor2D(rViewInformation2D, rTargetOutDev);
+ //}
+#else
+ static bool bTryTestCanvas(false);
+
+ if(bTryTestCanvas)
+ {
+ // create test-cancas-Processor
+ return new drawinglayer::processor2d::canvasProcessor2D(rViewInformation2D, rTargetOutDev);
+ }
+ else
+ {
+ // create Pixel Vcl-Processor
+ return new drawinglayer::processor2d::VclPixelProcessor2D(rViewInformation2D, rTargetOutDev);
+ }
+#endif
+ }
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/sdrmediawindow.cxx b/svx/source/sdr/contact/sdrmediawindow.cxx
new file mode 100644
index 000000000000..f380a4b8a022
--- /dev/null
+++ b/svx/source/sdr/contact/sdrmediawindow.cxx
@@ -0,0 +1,193 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "sdrmediawindow.hxx"
+#include <svtools/transfer.hxx>
+
+#include <svx/sdr/contact/viewobjectcontactofsdrmediaobj.hxx>
+#include <vcl/window.hxx>
+
+namespace sdr { namespace contact {
+
+// ------------------
+// - SdrMediaWindow -
+// ------------------
+
+SdrMediaWindow::SdrMediaWindow( Window* pParent, ViewObjectContactOfSdrMediaObj& rViewObjContact ) :
+ ::avmedia::MediaWindow( pParent, false ),
+ mrViewObjectContactOfSdrMediaObj( rViewObjContact )
+{
+}
+
+// ------------------------------------------------------------------------------
+
+SdrMediaWindow::~SdrMediaWindow()
+{
+}
+
+// ------------------------------------------------------------------------------
+
+void SdrMediaWindow::MouseMove( const MouseEvent& rMEvt )
+{
+ Window* pWindow = mrViewObjectContactOfSdrMediaObj.getWindow();
+
+ if( pWindow && getWindow() )
+ {
+ const MouseEvent aTransformedEvent( pWindow->ScreenToOutputPixel( getWindow()->OutputToScreenPixel( rMEvt.GetPosPixel() ) ),
+ rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() );
+
+ pWindow->MouseMove( aTransformedEvent );
+ setPointer( pWindow->GetPointer() );
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+void SdrMediaWindow::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ Window* pWindow = mrViewObjectContactOfSdrMediaObj.getWindow();
+
+ if( pWindow && getWindow() )
+ {
+ const MouseEvent aTransformedEvent( pWindow->ScreenToOutputPixel( getWindow()->OutputToScreenPixel( rMEvt.GetPosPixel() ) ),
+ rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() );
+
+ pWindow->MouseButtonDown( aTransformedEvent );
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+void SdrMediaWindow::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ Window* pWindow = mrViewObjectContactOfSdrMediaObj.getWindow();
+
+ if( pWindow && getWindow() )
+ {
+ const MouseEvent aTransformedEvent( pWindow->ScreenToOutputPixel( getWindow()->OutputToScreenPixel( rMEvt.GetPosPixel() ) ),
+ rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() );
+
+ pWindow->MouseButtonUp( aTransformedEvent );
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+void SdrMediaWindow::KeyInput( const KeyEvent& rKEvt )
+{
+ Window* pWindow = mrViewObjectContactOfSdrMediaObj.getWindow();
+
+ if( pWindow )
+ pWindow->KeyInput( rKEvt );
+}
+
+// ------------------------------------------------------------------------------
+
+void SdrMediaWindow::KeyUp( const KeyEvent& rKEvt )
+{
+ Window* pWindow = mrViewObjectContactOfSdrMediaObj.getWindow();
+
+ if( pWindow )
+ pWindow->KeyUp( rKEvt );
+}
+
+// ------------------------------------------------------------------------------
+
+void SdrMediaWindow::Command( const CommandEvent& rCEvt )
+{
+ Window* pWindow = mrViewObjectContactOfSdrMediaObj.getWindow();
+
+ if( pWindow && getWindow() )
+ {
+ const CommandEvent aTransformedEvent( pWindow->ScreenToOutputPixel( getWindow()->OutputToScreenPixel( rCEvt.GetMousePosPixel() ) ),
+ rCEvt.GetCommand(), rCEvt.IsMouseEvent(), rCEvt.GetData() );
+
+ pWindow->Command( aTransformedEvent );
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+sal_Int8 SdrMediaWindow::AcceptDrop( const AcceptDropEvent& rEvt )
+{
+ Window* pWindow = mrViewObjectContactOfSdrMediaObj.getWindow();
+ sal_Int8 nRet = DND_ACTION_NONE;
+
+ if( pWindow )
+ {
+ DropTargetHelper* pDropTargetHelper = dynamic_cast< DropTargetHelper* >( pWindow );
+
+ if( pDropTargetHelper )
+ {
+ nRet = pDropTargetHelper->AcceptDrop( rEvt );
+ }
+ }
+
+ return( nRet );
+}
+
+// ------------------------------------------------------------------------------
+
+sal_Int8 SdrMediaWindow::ExecuteDrop( const ExecuteDropEvent& rEvt )
+{
+ Window* pWindow = mrViewObjectContactOfSdrMediaObj.getWindow();
+ sal_Int8 nRet = DND_ACTION_NONE;
+
+ if( pWindow )
+ {
+ DropTargetHelper* pDropTargetHelper = dynamic_cast< DropTargetHelper* >( pWindow );
+
+ if( pDropTargetHelper )
+ {
+ nRet = pDropTargetHelper->ExecuteDrop( rEvt );
+ }
+ }
+
+ return( nRet );
+}
+
+// ------------------------------------------------------------------------------
+
+void SdrMediaWindow::StartDrag( sal_Int8 nAction, const Point& rPosPixel )
+{
+ Window* pWindow = mrViewObjectContactOfSdrMediaObj.getWindow();
+
+ if( pWindow )
+ {
+ DragSourceHelper* pDragSourceHelper = dynamic_cast< DragSourceHelper* >( pWindow );
+
+ if( pDragSourceHelper )
+ {
+ pDragSourceHelper->StartDrag( nAction, rPosPixel );
+ }
+ }
+}
+
+} }
diff --git a/svx/source/sdr/contact/sdrmediawindow.hxx b/svx/source/sdr/contact/sdrmediawindow.hxx
new file mode 100644
index 000000000000..0b9c42cdb615
--- /dev/null
+++ b/svx/source/sdr/contact/sdrmediawindow.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_SDRMEDIAWIMNDOW_HXX
+
+#include <avmedia/mediawindow.hxx>
+
+namespace sdr { namespace contact {
+
+// ------------------
+// - SdrMediaWindow -
+// ------------------
+
+class ViewObjectContactOfSdrMediaObj;
+
+class SdrMediaWindow : public ::avmedia::MediaWindow
+{
+public:
+
+ SdrMediaWindow( Window* pParent, ViewObjectContactOfSdrMediaObj& rViewObjContact );
+ ~SdrMediaWindow();
+
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void KeyUp( const KeyEvent& rKEvt );
+
+ virtual void Command( const CommandEvent& rCEvt );
+
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+
+private:
+
+ ViewObjectContactOfSdrMediaObj& mrViewObjectContactOfSdrMediaObj;
+};
+
+} }
+
+#endif
+
diff --git a/svx/source/sdr/contact/viewcontact.cxx b/svx/source/sdr/contact/viewcontact.cxx
new file mode 100644
index 000000000000..3057acf55df1
--- /dev/null
+++ b/svx/source/sdr/contact/viewcontact.cxx
@@ -0,0 +1,329 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <svx/sdr/contact/objectcontact.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/contact/objectcontactofpageview.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ // Create a Object-Specific ViewObjectContact, set ViewContact and
+ // ObjectContact. Always needs to return something. Default is to create
+ // a standard ViewObjectContact containing the given ObjectContact and *this
+ ViewObjectContact& ViewContact::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
+ {
+ return *(new ViewObjectContact(rObjectContact, *this));
+ }
+
+ ViewContact::ViewContact()
+ : maViewObjectContactVector(),
+ mxViewIndependentPrimitive2DSequence()
+ {
+ }
+
+ // Methods to react on start getting viewed or stop getting
+ // viewed. This info is derived from the count of members of
+ // registered ViewObjectContacts. Default does nothing.
+ void ViewContact::StartGettingViewed()
+ {
+ }
+
+ void ViewContact::StopGettingViewed()
+ {
+ }
+
+ ViewContact::~ViewContact()
+ {
+ deleteAllVOCs();
+ }
+
+ void ViewContact::deleteAllVOCs()
+ {
+ // get rid of all VOCs
+ // #i84257# To avoid that each 'delete pCandidate' again uses
+ // the local RemoveViewObjectContact with a search and removal in the
+ // vector, simply copy and clear local vector.
+ std::vector< ViewObjectContact* > aLocalVOCList(maViewObjectContactVector);
+ maViewObjectContactVector.clear();
+
+ while(aLocalVOCList.size())
+ {
+ ViewObjectContact* pCandidate = aLocalVOCList.back();
+ aLocalVOCList.pop_back();
+ DBG_ASSERT(pCandidate, "Corrupted ViewObjectContactList in VC (!)");
+
+ // ViewObjectContacts only make sense with View and Object contacts.
+ // When the contact to the SdrObject is deleted like in this case,
+ // all ViewObjectContacts can be deleted, too.
+ delete pCandidate;
+ }
+
+ // assert when there were new entries added during deletion
+ DBG_ASSERT(maViewObjectContactVector.empty(), "Corrupted ViewObjectContactList in VC (!)");
+ }
+
+ // get a Object-specific ViewObjectContact for a specific
+ // ObjectContact (->View). Always needs to return something.
+ ViewObjectContact& ViewContact::GetViewObjectContact(ObjectContact& rObjectContact)
+ {
+ ViewObjectContact* pRetval = 0L;
+ const sal_uInt32 nCount(maViewObjectContactVector.size());
+
+ // first search if there exists a VOC for the given OC
+ for(sal_uInt32 a(0); !pRetval && a < nCount; a++)
+ {
+ ViewObjectContact* pCandidate = maViewObjectContactVector[a];
+ DBG_ASSERT(pCandidate, "Corrupted ViewObjectContactList (!)");
+
+ if(&(pCandidate->GetObjectContact()) == &rObjectContact)
+ {
+ pRetval = pCandidate;
+ }
+ }
+
+ if(!pRetval)
+ {
+ // create a new one. It's inserted to the local list from the
+ // VieObjectContact constructor via AddViewObjectContact()
+ pRetval = &CreateObjectSpecificViewObjectContact(rObjectContact);
+ }
+
+ return *pRetval;
+ }
+
+ // A new ViewObjectContact was created and shall be remembered.
+ void ViewContact::AddViewObjectContact(ViewObjectContact& rVOContact)
+ {
+ maViewObjectContactVector.push_back(&rVOContact);
+
+ if(1L == maViewObjectContactVector.size())
+ {
+ StartGettingViewed();
+ }
+ }
+
+ // A ViewObjectContact was deleted and shall be forgotten.
+ void ViewContact::RemoveViewObjectContact(ViewObjectContact& rVOContact)
+ {
+ std::vector< ViewObjectContact* >::iterator aFindResult = std::find(maViewObjectContactVector.begin(), maViewObjectContactVector.end(), &rVOContact);
+
+ if(aFindResult != maViewObjectContactVector.end())
+ {
+ maViewObjectContactVector.erase(aFindResult);
+
+ if(0 == maViewObjectContactVector.size())
+ {
+ // This may need to get asynchron later since it eventually triggers
+ // deletes of OCs where the VOC is still added.
+ StopGettingViewed();
+ }
+ }
+ }
+
+ // Test if this ViewContact has ViewObjectContacts at all. This can
+ // be used to test if this ViewContact is visualized ATM or not
+ bool ViewContact::HasViewObjectContacts(bool bExcludePreviews) const
+ {
+ const sal_uInt32 nCount(maViewObjectContactVector.size());
+
+ if(bExcludePreviews)
+ {
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ if(!maViewObjectContactVector[a]->GetObjectContact().IsPreviewRenderer())
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+ else
+ {
+ return (0L != nCount);
+ }
+ }
+
+ // Test if this ViewContact has ViewObjectContacts at all. This can
+ // be used to test if this ViewContact is visualized ATM or not
+ bool ViewContact::isAnimatedInAnyViewObjectContact() const
+ {
+ const sal_uInt32 nCount(maViewObjectContactVector.size());
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ if(maViewObjectContactVector[a]->isAnimated())
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ // Access to possible sub-hierarchy and parent. GetObjectCount() default is 0L
+ // and GetViewContact default pops up an assert since it's an error if
+ // GetObjectCount has a result != 0 and it's not overloaded.
+ sal_uInt32 ViewContact::GetObjectCount() const
+ {
+ // no sub-objects
+ return 0;
+ }
+
+ ViewContact& ViewContact::GetViewContact(sal_uInt32 /*nIndex*/) const
+ {
+ // This is the default implementation; call would be an error
+ DBG_ERROR("ViewContact::GetViewContact: This call needs to be overloaded when GetObjectCount() can return results != 0 (!)");
+ return (ViewContact&)(*this);
+ }
+
+ ViewContact* ViewContact::GetParentContact() const
+ {
+ // default has no parent
+ return 0;
+ }
+
+ void ViewContact::ActionChildInserted(ViewContact& rChild)
+ {
+ // propagate change to all exsisting visualisations which
+ // will force a VOC for the new child and invalidate it's range
+ const sal_uInt32 nCount(maViewObjectContactVector.size());
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ ViewObjectContact* pCandidate = maViewObjectContactVector[a];
+ DBG_ASSERT(pCandidate, "ViewContact::GetViewObjectContact() invalid ViewObjectContactList (!)");
+
+ // take action at all VOCs. At the VOCs ObjectContact the initial
+ // rectangle will be invalidated at the associated OutputDevice.
+ pCandidate->ActionChildInserted(rChild);
+ }
+ }
+
+ // React on changes of the object of this ViewContact
+ void ViewContact::ActionChanged()
+ {
+ // propagate change to all existing VOCs. This will invalidate
+ // all drawn visualisations in all known views
+ const sal_uInt32 nCount(maViewObjectContactVector.size());
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ ViewObjectContact* pCandidate = maViewObjectContactVector[a];
+ DBG_ASSERT(pCandidate, "ViewContact::GetViewObjectContact() invalid ViewObjectContactList (!)");
+
+ pCandidate->ActionChanged();
+ }
+ }
+
+ // access to SdrObject and/or SdrPage. May return 0L like the default
+ // implementations do. Needs to be overloaded as needed.
+ SdrObject* ViewContact::TryToGetSdrObject() const
+ {
+ return 0L;
+ }
+
+ SdrPage* ViewContact::TryToGetSdrPage() const
+ {
+ return 0L;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////
+ // primitive stuff
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContact::createViewIndependentPrimitive2DSequence() const
+ {
+ // This is the default impelemtation and should never be called (see header). If this is called,
+ // someone implemented a ViewContact (VC) visualisation object without defining the visualisation by
+ // providing a seqence of primitives -> which cannot be correct.
+ // Since we have no access to any known model data here, the default implementation creates a yellow placeholder
+ // hairline polygon with a default size of (1000, 1000, 5000, 3000)
+ DBG_ERROR("ViewContact::createViewIndependentPrimitive2DSequence(): Never call the fallback base implementation, this is always an error (!)");
+ const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(1000.0, 1000.0, 5000.0, 3000.0)));
+ const basegfx::BColor aYellow(1.0, 1.0, 0.0);
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aYellow));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContact::getViewIndependentPrimitive2DSequence() const
+ {
+ // local up-to-date checks. Create new list and compare.
+ const drawinglayer::primitive2d::Primitive2DSequence xNew(createViewIndependentPrimitive2DSequence());
+
+ if(!drawinglayer::primitive2d::arePrimitive2DSequencesEqual(mxViewIndependentPrimitive2DSequence, xNew))
+ {
+ // has changed, copy content
+ const_cast< ViewContact* >(this)->mxViewIndependentPrimitive2DSequence = xNew;
+ }
+
+ // return current Primitive2DSequence
+ return mxViewIndependentPrimitive2DSequence;
+ }
+
+ // add Gluepoints (if available)
+ drawinglayer::primitive2d::Primitive2DSequence ViewContact::createGluePointPrimitive2DSequence() const
+ {
+ // default returns empty reference
+ return drawinglayer::primitive2d::Primitive2DSequence();
+ }
+
+ void ViewContact::flushViewObjectContacts(bool bWithHierarchy)
+ {
+ if(bWithHierarchy)
+ {
+ // flush DrawingLayer hierarchy
+ const sal_uInt32 nCount(GetObjectCount());
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ ViewContact& rChild = GetViewContact(a);
+ rChild.flushViewObjectContacts(bWithHierarchy);
+ }
+ }
+
+ // delete local VOCs
+ deleteAllVOCs();
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewcontactofe3d.cxx b/svx/source/sdr/contact/viewcontactofe3d.cxx
new file mode 100644
index 000000000000..9d6b253a676a
--- /dev/null
+++ b/svx/source/sdr/contact/viewcontactofe3d.cxx
@@ -0,0 +1,227 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/viewcontactofe3d.hxx>
+#include <svx/sdr/contact/viewobjectcontactofe3d.hxx>
+#include <svx/obj3d.hxx>
+#include <drawinglayer/primitive2d/embedded3dprimitive2d.hxx>
+#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
+#include <svx/scene3d.hxx>
+#include <drawinglayer/primitive3d/transformprimitive3d.hxx>
+#include <drawinglayer/attribute/sdrsceneattribute3d.hxx>
+#include <drawinglayer/attribute/sdrlightingattribute3d.hxx>
+#include <drawinglayer/attribute/sdrlightattribute3d.hxx>
+#include <drawinglayer/attribute/sdrlineattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace
+{
+ const sdr::contact::ViewContactOfE3dScene* tryToFindVCOfE3DScene(
+ const sdr::contact::ViewContact& rCandidate,
+ basegfx::B3DHomMatrix& o_rInBetweenObjectTransform)
+ {
+ const sdr::contact::ViewContactOfE3dScene* pSceneParent =
+ dynamic_cast< const sdr::contact::ViewContactOfE3dScene* >(rCandidate.GetParentContact());
+
+ if(pSceneParent)
+ {
+ // each 3d object (including in-between scenes) should have a scene as parent
+ const sdr::contact::ViewContactOfE3dScene* pSceneParentParent =
+ dynamic_cast< const sdr::contact::ViewContactOfE3dScene* >(pSceneParent->GetParentContact());
+
+ if(pSceneParentParent)
+ {
+ // the parent scene of rCandidate is a in-between scene, call recursively and collect
+ // the in-between scene's object transformation part in o_rInBetweenObjectTransform
+ const basegfx::B3DHomMatrix& rSceneParentTransform = pSceneParent->GetE3dScene().GetTransform();
+ o_rInBetweenObjectTransform = rSceneParentTransform * o_rInBetweenObjectTransform;
+ return tryToFindVCOfE3DScene(*pSceneParent, o_rInBetweenObjectTransform);
+ }
+ else
+ {
+ // the parent scene is the outmost scene
+ return pSceneParent;
+ }
+ }
+
+ // object hierarchy structure is incorrect; no result
+ return 0;
+ }
+} // end of anonymous namespace
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfE3d::impCreateWithGivenPrimitive3DSequence(
+ const drawinglayer::primitive3d::Primitive3DSequence& rxContent3D) const
+ {
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+
+ if(rxContent3D.hasElements())
+ {
+ // try to get the outmost ViewObjectContactOfE3dScene for this single 3d object,
+ // the ones on the way there are grouping scenes. Collect the in-between scene's
+ // transformations to build a correct object transformation for the embedded
+ // object
+ basegfx::B3DHomMatrix aInBetweenObjectTransform;
+ const ViewContactOfE3dScene* pVCOfE3DScene = tryToFindVCOfE3DScene(*this, aInBetweenObjectTransform);
+
+ if(pVCOfE3DScene)
+ {
+ basegfx::B3DVector aLightNormal;
+ const double fShadowSlant(pVCOfE3DScene->getSdrSceneAttribute().getShadowSlant());
+ const basegfx::B3DRange& rAllContentRange = pVCOfE3DScene->getAllContentRange3D();
+ drawinglayer::geometry::ViewInformation3D aViewInformation3D(pVCOfE3DScene->getViewInformation3D());
+
+ if(pVCOfE3DScene->getSdrLightingAttribute().getLightVector().size())
+ {
+ // get light normal from first light and normalize
+ aLightNormal = pVCOfE3DScene->getSdrLightingAttribute().getLightVector()[0].getDirection();
+ aLightNormal.normalize();
+ }
+
+ if(!aInBetweenObjectTransform.isIdentity())
+ {
+ // if aInBetweenObjectTransform is used, create combined ViewInformation3D which
+ // contains the correct object transformation for the embedded 3d object
+ aViewInformation3D = drawinglayer::geometry::ViewInformation3D(
+ aViewInformation3D.getObjectTransformation() * aInBetweenObjectTransform,
+ aViewInformation3D.getOrientation(),
+ aViewInformation3D.getProjection(),
+ aViewInformation3D.getDeviceToView(),
+ aViewInformation3D.getViewTime(),
+ aViewInformation3D.getExtendedInformationSequence());
+ }
+
+ // create embedded 2d primitive and add. LightNormal and ShadowSlant are needed for evtl.
+ // 3D shadow extraction for correct B2DRange calculation (shadow is part of the object)
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::Embedded3DPrimitive2D(
+ rxContent3D,
+ pVCOfE3DScene->getObjectTransformation(),
+ aViewInformation3D,
+ aLightNormal,
+ fShadowSlant,
+ rAllContentRange));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+ }
+
+ return xRetval;
+ }
+
+ ViewContactOfE3d::ViewContactOfE3d(E3dObject& rSdrObject)
+ : ViewContactOfSdrObj(rSdrObject)
+ {
+ }
+
+ ViewContactOfE3d::~ViewContactOfE3d()
+ {
+ }
+
+ drawinglayer::primitive3d::Primitive3DSequence ViewContactOfE3d::getVIP3DSWithoutObjectTransform() const
+ {
+ // local up-to-date checks. Create new list and compare.
+ drawinglayer::primitive3d::Primitive3DSequence xNew(createViewIndependentPrimitive3DSequence());
+
+ if(!drawinglayer::primitive3d::arePrimitive3DSequencesEqual(mxViewIndependentPrimitive3DSequence, xNew))
+ {
+ // has changed, copy content
+ const_cast< ViewContactOfE3d* >(this)->mxViewIndependentPrimitive3DSequence = xNew;
+ }
+
+ // return current Primitive2DSequence
+ return mxViewIndependentPrimitive3DSequence;
+ }
+
+ drawinglayer::primitive3d::Primitive3DSequence ViewContactOfE3d::getViewIndependentPrimitive3DSequence() const
+ {
+ // get sequence without object transform
+ drawinglayer::primitive3d::Primitive3DSequence xRetval(getVIP3DSWithoutObjectTransform());
+
+ if(xRetval.hasElements())
+ {
+ // add object transform if it's used
+ const basegfx::B3DHomMatrix& rObjectTransform(GetE3dObject().GetTransform());
+
+ if(!rObjectTransform.isIdentity())
+ {
+ const drawinglayer::primitive3d::Primitive3DReference xReference(
+ new drawinglayer::primitive3d::TransformPrimitive3D(
+ rObjectTransform,
+ xRetval));
+
+ xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1);
+ }
+ }
+
+ // return current Primitive2DSequence
+ return xRetval;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfE3d::createViewIndependentPrimitive2DSequence() const
+ {
+ // also need to create a 2D embedding when the view-independent part is requested,
+ // see view-dependent part in ViewObjectContactOfE3d::createPrimitive2DSequence
+ // get 3d primitive vector, isPrimitiveVisible() is done in 3d creator
+ return impCreateWithGivenPrimitive3DSequence(getViewIndependentPrimitive3DSequence());
+ }
+
+ ViewObjectContact& ViewContactOfE3d::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
+ {
+ ViewObjectContact* pRetval = new ViewObjectContactOfE3d(rObjectContact, *this);
+ DBG_ASSERT(pRetval, "ViewContactOfE3d::CreateObjectSpecificViewObjectContact() failed (!)");
+
+ return *pRetval;
+ }
+
+ drawinglayer::attribute::SdrLineAttribute* ViewContactOfE3d::impCreateFallbackLineAttribute(const basegfx::BColor& rBColor) const
+ {
+ static bool bFallbackToCreateAsLineForTest(false);
+
+ if(bFallbackToCreateAsLineForTest)
+ {
+ return new drawinglayer::attribute::SdrLineAttribute(rBColor);
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewcontactofe3dcube.cxx b/svx/source/sdr/contact/viewcontactofe3dcube.cxx
new file mode 100644
index 000000000000..84d456a7a430
--- /dev/null
+++ b/svx/source/sdr/contact/viewcontactofe3dcube.cxx
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/viewcontactofe3dcube.hxx>
+#include <svx/cube3d.hxx>
+#include <drawinglayer/primitive3d/sdrcubeprimitive3d.hxx>
+#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <svx/sdr/primitive3d/sdrattributecreator3d.hxx>
+#include <basegfx/range/b3drange.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewContactOfE3dCube::ViewContactOfE3dCube(E3dCubeObj& rCubeObj)
+ : ViewContactOfE3d(rCubeObj)
+ {
+ }
+
+ ViewContactOfE3dCube::~ViewContactOfE3dCube()
+ {
+ }
+
+ drawinglayer::primitive3d::Primitive3DSequence ViewContactOfE3dCube::createViewIndependentPrimitive3DSequence() const
+ {
+ drawinglayer::primitive3d::Primitive3DSequence xRetval;
+ const SfxItemSet& rItemSet = GetE3dCubeObj().GetMergedItemSet();
+ const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false));
+
+ // get cube geometry and use as traslation and scaling for unit cube
+ basegfx::B3DRange aCubeRange;
+ const basegfx::B3DVector aCubeSize(GetE3dCubeObj().GetCubeSize());
+ const basegfx::B3DPoint aCubePosition(GetE3dCubeObj().GetCubePos());
+ basegfx::B3DHomMatrix aWorldTransform;
+
+ if(GetE3dCubeObj().GetPosIsCenter())
+ {
+ const basegfx::B3DVector aHalfCubeSize(aCubeSize / 2.0);
+ aCubeRange.expand(aCubePosition - aHalfCubeSize);
+ aCubeRange.expand(aCubePosition + aHalfCubeSize);
+ }
+ else
+ {
+ aCubeRange.expand(aCubePosition);
+ aCubeRange.expand(aCubePosition + aCubeSize);
+ }
+
+ // add scale and translate to world transformation
+ const basegfx::B3DVector abjectRange(aCubeRange.getRange());
+ aWorldTransform.scale(abjectRange.getX(), abjectRange.getY(), abjectRange.getZ());
+ aWorldTransform.translate(aCubeRange.getMinX(), aCubeRange.getMinY(), aCubeRange.getMinZ());
+
+ // get 3D Object Attributes
+ drawinglayer::attribute::Sdr3DObjectAttribute* pSdr3DObjectAttribute = drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet);
+
+ // calculate texture size to get a perfect mapping for
+ // the front/back sides
+ const basegfx::B2DVector aTextureSize(aCubeSize.getX(), aCubeSize.getY());
+
+ // create primitive and add
+ const drawinglayer::primitive3d::Primitive3DReference xReference(
+ new drawinglayer::primitive3d::SdrCubePrimitive3D(
+ aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute));
+ xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1);
+
+ // delete 3D Object Attributes
+ delete pSdr3DObjectAttribute;
+
+ return xRetval;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewcontactofe3dextrude.cxx b/svx/source/sdr/contact/viewcontactofe3dextrude.cxx
new file mode 100644
index 000000000000..1ff1d81c827c
--- /dev/null
+++ b/svx/source/sdr/contact/viewcontactofe3dextrude.cxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/viewcontactofe3dextrude.hxx>
+#include <svx/extrud3d.hxx>
+#include <drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx>
+#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <svx/sdr/primitive3d/sdrattributecreator3d.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewContactOfE3dExtrude::ViewContactOfE3dExtrude(E3dExtrudeObj& rExtrude)
+ : ViewContactOfE3d(rExtrude)
+ {
+ }
+
+ ViewContactOfE3dExtrude::~ViewContactOfE3dExtrude()
+ {
+ }
+
+ drawinglayer::primitive3d::Primitive3DSequence ViewContactOfE3dExtrude::createViewIndependentPrimitive3DSequence() const
+ {
+ drawinglayer::primitive3d::Primitive3DSequence xRetval;
+ const SfxItemSet& rItemSet = GetE3dExtrudeObj().GetMergedItemSet();
+ const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false));
+
+ // get extrude geometry
+ const basegfx::B2DPolyPolygon aPolyPolygon(GetE3dExtrudeObj().GetExtrudePolygon());
+
+ // get 3D Object Attributes
+ drawinglayer::attribute::Sdr3DObjectAttribute* pSdr3DObjectAttribute = drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet);
+
+ // calculate texture size; use size of top/bottom cap to get a perfect mapping
+ // for the caps. The in-between geometry will get a stretched size with a
+ // relative factor size of caps to extrude depth
+ const basegfx::B2DRange aRange(basegfx::tools::getRange(aPolyPolygon));
+ const basegfx::B2DVector aTextureSize(aRange.getWidth(), aRange.getHeight());
+
+ // get more data
+ const double fDepth((double)GetE3dExtrudeObj().GetExtrudeDepth());
+ const double fDiagonal((double)GetE3dExtrudeObj().GetPercentDiagonal() / 100.0);
+ const double fBackScale((double)GetE3dExtrudeObj().GetPercentBackScale() / 100.0);
+ const bool bSmoothNormals(GetE3dExtrudeObj().GetSmoothNormals()); // Plane itself
+ const bool bSmoothLids(GetE3dExtrudeObj().GetSmoothLids()); // Front/back
+ const bool bCharacterMode(GetE3dExtrudeObj().GetCharacterMode());
+ const bool bCloseFront(GetE3dExtrudeObj().GetCloseFront());
+ const bool bCloseBack(GetE3dExtrudeObj().GetCloseBack());
+
+ // create primitive and add
+ const basegfx::B3DHomMatrix aWorldTransform;
+ const drawinglayer::primitive3d::Primitive3DReference xReference(
+ new drawinglayer::primitive3d::SdrExtrudePrimitive3D(
+ aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute,
+ aPolyPolygon, fDepth, fDiagonal, fBackScale, bSmoothNormals, true, bSmoothLids,
+ bCharacterMode, bCloseFront, bCloseBack));
+ xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1);
+
+ // delete 3D Object Attributes
+ delete pSdr3DObjectAttribute;
+
+ return xRetval;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewcontactofe3dlathe.cxx b/svx/source/sdr/contact/viewcontactofe3dlathe.cxx
new file mode 100644
index 000000000000..3cd55fcde828
--- /dev/null
+++ b/svx/source/sdr/contact/viewcontactofe3dlathe.cxx
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/viewcontactofe3dlathe.hxx>
+#include <svx/lathe3d.hxx>
+#include <drawinglayer/primitive3d/sdrlatheprimitive3d.hxx>
+#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <svx/sdr/primitive3d/sdrattributecreator3d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewContactOfE3dLathe::ViewContactOfE3dLathe(E3dLatheObj& rLathe)
+ : ViewContactOfE3d(rLathe)
+ {
+ }
+
+ ViewContactOfE3dLathe::~ViewContactOfE3dLathe()
+ {
+ }
+
+ drawinglayer::primitive3d::Primitive3DSequence ViewContactOfE3dLathe::createViewIndependentPrimitive3DSequence() const
+ {
+ drawinglayer::primitive3d::Primitive3DSequence xRetval;
+ const SfxItemSet& rItemSet = GetE3dLatheObj().GetMergedItemSet();
+ const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false));
+
+ // get extrude geometry
+ const basegfx::B2DPolyPolygon aPolyPolygon(GetE3dLatheObj().GetPolyPoly2D());
+
+ // get 3D Object Attributes
+ drawinglayer::attribute::Sdr3DObjectAttribute* pSdr3DObjectAttribute = drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet);
+
+ // calculate texture size. Use the polygon length of the longest polygon for
+ // height and the rotated radius for width (using polygon center) to get a good
+ // texture mapping
+ const sal_uInt32 nPolygonCount(aPolyPolygon.count());
+ double fPolygonMaxLength(0.0);
+
+ for(sal_uInt32 a(0); a < nPolygonCount; a++)
+ {
+ const basegfx::B2DPolygon aCandidate(aPolyPolygon.getB2DPolygon(a));
+ const double fPolygonLength(basegfx::tools::getLength(aCandidate));
+ fPolygonMaxLength = std::max(fPolygonMaxLength, fPolygonLength);
+ }
+
+ const basegfx::B2DRange aPolyPolygonRange(basegfx::tools::getRange(aPolyPolygon));
+ const basegfx::B2DVector aTextureSize(
+ F_PI * fabs(aPolyPolygonRange.getCenter().getX()), // PI * d
+ fPolygonMaxLength);
+
+ // get more data
+ const sal_uInt32 nHorizontalSegments(GetE3dLatheObj().GetHorizontalSegments());
+ const sal_uInt32 nVerticalSegments(GetE3dLatheObj().GetVerticalSegments());
+ const double fDiagonal((double)GetE3dLatheObj().GetPercentDiagonal() / 100.0);
+ const double fBackScale((double)GetE3dLatheObj().GetBackScale() / 100.0);
+ const double fRotation(((double)GetE3dLatheObj().GetEndAngle() / 1800.0) * F_PI);
+ const bool bSmoothNormals(GetE3dLatheObj().GetSmoothNormals()); // Plane itself
+ const bool bSmoothLids(GetE3dLatheObj().GetSmoothLids()); // Front/back
+ const bool bCharacterMode(GetE3dLatheObj().GetCharacterMode());
+ const bool bCloseFront(GetE3dLatheObj().GetCloseFront());
+ const bool bCloseBack(GetE3dLatheObj().GetCloseBack());
+
+ // create primitive and add
+ const basegfx::B3DHomMatrix aWorldTransform;
+ const drawinglayer::primitive3d::Primitive3DReference xReference(
+ new drawinglayer::primitive3d::SdrLathePrimitive3D(
+ aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute,
+ aPolyPolygon, nHorizontalSegments, nVerticalSegments,
+ fDiagonal, fBackScale, fRotation,
+ bSmoothNormals, true, bSmoothLids, bCharacterMode, bCloseFront, bCloseBack));
+ xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1);
+
+ // delete 3D Object Attributes
+ delete pSdr3DObjectAttribute;
+
+ return xRetval;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
new file mode 100644
index 000000000000..ee6943bccd4a
--- /dev/null
+++ b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
@@ -0,0 +1,186 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/viewcontactofe3dpolygon.hxx>
+#include <svx/polygn3d.hxx>
+#include <drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx>
+#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <svx/sdr/primitive3d/sdrattributecreator3d.hxx>
+#include <basegfx/polygon/b3dpolygon.hxx>
+#include <basegfx/polygon/b3dpolypolygontools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewContactOfE3dPolygon::ViewContactOfE3dPolygon(E3dPolygonObj& rPolygon)
+ : ViewContactOfE3d(rPolygon)
+ {
+ }
+
+ ViewContactOfE3dPolygon::~ViewContactOfE3dPolygon()
+ {
+ }
+
+ drawinglayer::primitive3d::Primitive3DSequence ViewContactOfE3dPolygon::createViewIndependentPrimitive3DSequence() const
+ {
+ drawinglayer::primitive3d::Primitive3DSequence xRetval;
+ const SfxItemSet& rItemSet = GetE3dPolygonObj().GetMergedItemSet();
+ const bool bSuppressFill(GetE3dPolygonObj().GetLineOnly());
+ const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, bSuppressFill));
+
+ // get extrude geometry
+ basegfx::B3DPolyPolygon aPolyPolygon3D(GetE3dPolygonObj().GetPolyPolygon3D());
+ const basegfx::B3DPolyPolygon aPolyNormals3D(GetE3dPolygonObj().GetPolyNormals3D());
+ const basegfx::B2DPolyPolygon aPolyTexture2D(GetE3dPolygonObj().GetPolyTexture2D());
+ const bool bNormals(aPolyNormals3D.count() && aPolyNormals3D.count() == aPolyPolygon3D.count());
+ const bool bTexture(aPolyTexture2D.count() && aPolyTexture2D.count() == aPolyPolygon3D.count());
+
+ if(bNormals || bTexture)
+ {
+ for(sal_uInt32 a(0L); a < aPolyPolygon3D.count(); a++)
+ {
+ basegfx::B3DPolygon aCandidate3D(aPolyPolygon3D.getB3DPolygon(a));
+ basegfx::B3DPolygon aNormals3D;
+ basegfx::B2DPolygon aTexture2D;
+
+ if(bNormals)
+ {
+ aNormals3D = aPolyNormals3D.getB3DPolygon(a);
+ }
+
+ if(bTexture)
+ {
+ aTexture2D = aPolyTexture2D.getB2DPolygon(a);
+ }
+
+ for(sal_uInt32 b(0L); b < aCandidate3D.count(); b++)
+ {
+ if(bNormals)
+ {
+ 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)
+ {
+ sal_uInt32 nTextureCount = aTexture2D.count();
+ if( b < nTextureCount )
+ aCandidate3D.setTextureCoordinate(b, aTexture2D.getB2DPoint(b));
+ else if( nTextureCount > 0 )
+ aCandidate3D.setTextureCoordinate(b, aTexture2D.getB2DPoint(0));
+ }
+ }
+
+ aPolyPolygon3D.setB3DPolygon(a, aCandidate3D);
+ }
+ }
+
+ // get 3D Object Attributes
+ drawinglayer::attribute::Sdr3DObjectAttribute* pSdr3DObjectAttribute = drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet);
+
+ // calculate texture size
+ basegfx::B2DVector aTextureSize(1.0, 1.0);
+
+ if(bTexture)
+ {
+ // #i98314#
+ // create texture size from object's size
+ const basegfx::B3DRange aObjectRange(basegfx::tools::getRange(aPolyPolygon3D));
+
+ double fWidth(0.0);
+ double fHeight(0.0);
+
+ // this is a polygon object, so Width/Height and/or Depth may be zero (e.g. left
+ // wall of chart). Take this into account
+ if(basegfx::fTools::equalZero(aObjectRange.getWidth()))
+ {
+ // width is zero, use height and depth
+ fWidth = aObjectRange.getHeight();
+ fHeight = aObjectRange.getDepth();
+ }
+ else if(basegfx::fTools::equalZero(aObjectRange.getHeight()))
+ {
+ // height is zero, use width and depth
+ fWidth = aObjectRange.getWidth();
+ fHeight = aObjectRange.getDepth();
+ }
+ else
+ {
+ // use width and height
+ fWidth = aObjectRange.getWidth();
+ fHeight = aObjectRange.getHeight();
+ }
+
+ if(basegfx::fTools::lessOrEqual(fWidth, 0.0) ||basegfx::fTools::lessOrEqual(fHeight, 0.0))
+ {
+ // no texture; fallback to very small size
+ aTextureSize.setX(0.01);
+ aTextureSize.setY(0.01);
+ }
+ else
+ {
+ aTextureSize.setX(fWidth);
+ aTextureSize.setY(fHeight);
+ }
+ }
+
+ // #i98295#
+ // unfortunately, this SdrObject type which allows a free 3d geometry definition was defined
+ // wrong topologically in relation to it's plane normal and 3D visibility when it was invented
+ // a long time ago. Since the API allows creation of this SDrObject type, it is not possible to
+ // simply change this definition. Only the chart should use it, and at least this object type
+ // only exists at Runtime (is not saved and/or loaded in any FileFormat). Still someone external
+ // may have used it in it's API. To not risk wrong 3D lightings, i have to switch the orientation
+ // of the polygon here
+ aPolyPolygon3D.flip();
+
+ // create primitive and add
+ const basegfx::B3DHomMatrix aWorldTransform;
+ const drawinglayer::primitive3d::Primitive3DReference xReference(
+ new drawinglayer::primitive3d::SdrPolyPolygonPrimitive3D(
+ aPolyPolygon3D, aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute));
+ xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1);
+
+ // delete 3D Object Attributes
+ delete pSdr3DObjectAttribute;
+
+ return xRetval;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewcontactofe3dscene.cxx b/svx/source/sdr/contact/viewcontactofe3dscene.cxx
new file mode 100644
index 000000000000..8a7d7694a315
--- /dev/null
+++ b/svx/source/sdr/contact/viewcontactofe3dscene.cxx
@@ -0,0 +1,478 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
+#include <svx/polysc3d.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <svx/sdr/contact/viewobjectcontactofe3dscene.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/range/b3drange.hxx>
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+#include <svx/sdr/contact/viewcontactofe3d.hxx>
+#include <drawinglayer/primitive2d/sceneprimitive2d.hxx>
+#include <drawinglayer/primitive3d/transformprimitive3d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace
+{
+ // pActiveVC is only true if ghosted is still activated and maybe needs to be switched off in this path
+ void createSubPrimitive3DVector(
+ const sdr::contact::ViewContact& rCandidate,
+ drawinglayer::primitive3d::Primitive3DSequence& o_rAllTarget,
+ drawinglayer::primitive3d::Primitive3DSequence* o_pVisibleTarget,
+ const SetOfByte* pVisibleLayerSet,
+ const bool bTestSelectedVisibility)
+ {
+ const sdr::contact::ViewContactOfE3dScene* pViewContactOfE3dScene = dynamic_cast< const sdr::contact::ViewContactOfE3dScene* >(&rCandidate);
+
+ if(pViewContactOfE3dScene)
+ {
+ const sal_uInt32 nChildrenCount(rCandidate.GetObjectCount());
+
+ if(nChildrenCount)
+ {
+ // provide new collection sequences
+ drawinglayer::primitive3d::Primitive3DSequence aNewAllTarget;
+ drawinglayer::primitive3d::Primitive3DSequence aNewVisibleTarget;
+
+ // add children recursively
+ for(sal_uInt32 a(0L); a < nChildrenCount; a++)
+ {
+ createSubPrimitive3DVector(
+ rCandidate.GetViewContact(a),
+ aNewAllTarget,
+ o_pVisibleTarget ? &aNewVisibleTarget : 0,
+ pVisibleLayerSet,
+ bTestSelectedVisibility);
+ }
+
+ // create transform primitive for the created content combining content and transformtion
+ const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::TransformPrimitive3D(
+ pViewContactOfE3dScene->GetE3dScene().GetTransform(),
+ aNewAllTarget));
+
+ // add created content to all target
+ drawinglayer::primitive3d::appendPrimitive3DReferenceToPrimitive3DSequence(o_rAllTarget, xReference);
+
+ // add created content to visibiel target if exists
+ if(o_pVisibleTarget)
+ {
+ drawinglayer::primitive3d::appendPrimitive3DReferenceToPrimitive3DSequence(*o_pVisibleTarget, xReference);
+ }
+ }
+ }
+ else
+ {
+ // access view independent representation of rCandidate
+ const sdr::contact::ViewContactOfE3d* pViewContactOfE3d = dynamic_cast< const sdr::contact::ViewContactOfE3d* >(&rCandidate);
+
+ if(pViewContactOfE3d)
+ {
+ drawinglayer::primitive3d::Primitive3DSequence xPrimitive3DSeq(pViewContactOfE3d->getViewIndependentPrimitive3DSequence());
+
+ if(xPrimitive3DSeq.hasElements())
+ {
+ // add to all target vector
+ drawinglayer::primitive3d::appendPrimitive3DSequenceToPrimitive3DSequence(o_rAllTarget, xPrimitive3DSeq);
+
+ if(o_pVisibleTarget)
+ {
+ // test visibility. Primitive is visible when both tests are true (AND)
+ bool bVisible(true);
+
+ if(pVisibleLayerSet)
+ {
+ // test layer visibility
+ const E3dObject& rE3dObject = pViewContactOfE3d->GetE3dObject();
+ const SdrLayerID aLayerID(rE3dObject.GetLayer());
+
+ bVisible = pVisibleLayerSet->IsSet(aLayerID);
+ }
+
+ if(bVisible && bTestSelectedVisibility)
+ {
+ // test selected visibility (see 3D View's DrawMarkedObj implementation)
+ const E3dObject& rE3dObject = pViewContactOfE3d->GetE3dObject();
+
+ bVisible = rE3dObject.GetSelected();
+ }
+
+ if(bVisible && o_pVisibleTarget)
+ {
+ // add to visible target vector
+ drawinglayer::primitive3d::appendPrimitive3DSequenceToPrimitive3DSequence(*o_pVisibleTarget, xPrimitive3DSeq);
+ }
+ }
+ }
+ }
+ }
+ }
+} // end of anonymous namespace
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ // Create a Object-Specific ViewObjectContact, set ViewContact and
+ // ObjectContact. Always needs to return something.
+ ViewObjectContact& ViewContactOfE3dScene::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
+ {
+ ViewObjectContact* pRetval = new ViewObjectContactOfE3dScene(rObjectContact, *this);
+ DBG_ASSERT(pRetval, "ViewContactOfE3dScene::CreateObjectSpecificViewObjectContact() failed (!)");
+
+ return *pRetval;
+ }
+
+ ViewContactOfE3dScene::ViewContactOfE3dScene(E3dScene& rScene)
+ : ViewContactOfSdrObj(rScene),
+ maViewInformation3D(),
+ maObjectTransformation(),
+ maSdrSceneAttribute(),
+ maSdrLightingAttribute()
+ {
+ }
+
+ void ViewContactOfE3dScene::createViewInformation3D(const basegfx::B3DRange& rContentRange)
+ {
+ basegfx::B3DHomMatrix aTransformation;
+ basegfx::B3DHomMatrix aOrientation;
+ basegfx::B3DHomMatrix aProjection;
+ basegfx::B3DHomMatrix aDeviceToView;
+
+ // create transformation (scene as group's transformation)
+ // For historical reasons, the outmost scene's transformation is handles as part of the
+ // view transformation. This means that the BoundRect of the contained 3D Objects is
+ // without that transformation and makes it necessary to NOT add the first scene to the
+ // Primitive3DSequence of contained objects.
+ {
+ aTransformation = GetE3dScene().GetTransform();
+ }
+
+ // create orientation (world to camera coordinate system)
+ {
+ // calculate orientation from VRP, VPN and VUV
+ const B3dCamera& rSceneCamera = GetE3dScene().GetCameraSet();
+ const basegfx::B3DPoint aVRP(rSceneCamera.GetVRP());
+ const basegfx::B3DVector aVPN(rSceneCamera.GetVRP());
+ const basegfx::B3DVector aVUV(rSceneCamera.GetVUV());
+
+ aOrientation.orientation(aVRP, aVPN, aVUV);
+ }
+
+ // create projection (camera coordinate system to relative 2d where X,Y and Z are [0.0 .. 1.0])
+ {
+ const basegfx::B3DHomMatrix aWorldToCamera(aOrientation * aTransformation);
+ basegfx::B3DRange aCameraRange(rContentRange);
+ aCameraRange.transform(aWorldToCamera);
+
+ // remember Z-Values, but change orientation
+ const double fMinZ(-aCameraRange.getMaxZ());
+ const double fMaxZ(-aCameraRange.getMinZ());
+
+ // construct temorary matrix from world to device. Use unit values here to measure expansion
+ basegfx::B3DHomMatrix aWorldToDevice(aWorldToCamera);
+ const drawinglayer::attribute::SdrSceneAttribute& rSdrSceneAttribute = getSdrSceneAttribute();
+
+ if(::com::sun::star::drawing::ProjectionMode_PERSPECTIVE == rSdrSceneAttribute.getProjectionMode())
+ {
+ aWorldToDevice.frustum(-1.0, 1.0, -1.0, 1.0, fMinZ, fMaxZ);
+ }
+ else
+ {
+ aWorldToDevice.ortho(-1.0, 1.0, -1.0, 1.0, fMinZ, fMaxZ);
+ }
+
+ // create B3DRange in device. This will create the real used ranges
+ // in camera space. Do not use the Z-Values, though.
+ basegfx::B3DRange aDeviceRange(rContentRange);
+ aDeviceRange.transform(aWorldToDevice);
+
+ // set projection
+ if(::com::sun::star::drawing::ProjectionMode_PERSPECTIVE == rSdrSceneAttribute.getProjectionMode())
+ {
+ aProjection.frustum(
+ aDeviceRange.getMinX(), aDeviceRange.getMaxX(),
+ aDeviceRange.getMinY(), aDeviceRange.getMaxY(),
+ fMinZ, fMaxZ);
+ }
+ else
+ {
+ aProjection.ortho(
+ aDeviceRange.getMinX(), aDeviceRange.getMaxX(),
+ aDeviceRange.getMinY(), aDeviceRange.getMaxY(),
+ fMinZ, fMaxZ);
+ }
+ }
+
+ // create device to view transform
+ {
+ // create standard deviceToView projection for geometry
+ // input is [-1.0 .. 1.0] in X,Y and Z. bring to [0.0 .. 1.0]. Also
+ // necessary to flip Y due to screen orientation
+ // Z is not needed, but will also be brought to [0.0 .. 1.0]
+ aDeviceToView.scale(0.5, -0.5, 0.5);
+ aDeviceToView.translate(0.5, 0.5, 0.5);
+ }
+
+ const uno::Sequence< beans::PropertyValue > aEmptyProperties;
+ maViewInformation3D = drawinglayer::geometry::ViewInformation3D(
+ aTransformation, aOrientation, aProjection,
+ aDeviceToView, 0.0, aEmptyProperties);
+ }
+
+ void ViewContactOfE3dScene::createObjectTransformation()
+ {
+ // create 2d Object Transformation from relative point in 2d scene to world
+ const Rectangle& rRectangle = GetE3dScene().GetSnapRect();
+
+ maObjectTransformation.set(0, 0, rRectangle.getWidth());
+ maObjectTransformation.set(1, 1, rRectangle.getHeight());
+ maObjectTransformation.set(0, 2, rRectangle.Left());
+ maObjectTransformation.set(1, 2, rRectangle.Top());
+ }
+
+ void ViewContactOfE3dScene::createSdrSceneAttribute()
+ {
+ const SfxItemSet& rItemSet = GetE3dScene().GetMergedItemSet();
+ maSdrSceneAttribute = drawinglayer::primitive2d::createNewSdrSceneAttribute(rItemSet);
+ }
+
+ void ViewContactOfE3dScene::createSdrLightingAttribute()
+ {
+ const SfxItemSet& rItemSet = GetE3dScene().GetMergedItemSet();
+ maSdrLightingAttribute = drawinglayer::primitive2d::createNewSdrLightingAttribute(rItemSet);
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfE3dScene::createScenePrimitive2DSequence(
+ const SetOfByte* pLayerVisibility) const
+ {
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+ const sal_uInt32 nChildrenCount(GetObjectCount());
+
+ if(nChildrenCount)
+ {
+ // create 3d scene primitive with visible content tested against rLayerVisibility
+ drawinglayer::primitive3d::Primitive3DSequence aAllSequence;
+ drawinglayer::primitive3d::Primitive3DSequence aVisibleSequence;
+ const bool bTestLayerVisibility(0 != pLayerVisibility);
+ const bool bTestSelectedVisibility(GetE3dScene().GetDrawOnlySelected());
+ const bool bTestVisibility(bTestLayerVisibility || bTestSelectedVisibility);
+
+ // add children recursively. Do NOT start with (*this), this would create
+ // a 3D transformPrimitive for the start scene. While this is theoretically not
+ // a bad thing, for historical reasons the transformation of the outmost scene
+ // is seen as part of the ViewTransformation (see text in createViewInformation3D)
+ for(sal_uInt32 a(0L); a < nChildrenCount; a++)
+ {
+ createSubPrimitive3DVector(
+ GetViewContact(a),
+ aAllSequence,
+ bTestLayerVisibility ? &aVisibleSequence : 0,
+ bTestLayerVisibility ? pLayerVisibility : 0,
+ bTestSelectedVisibility);
+ }
+
+ const sal_uInt32 nAllSize(aAllSequence.hasElements() ? aAllSequence.getLength() : 0);
+ const sal_uInt32 nVisibleSize(aVisibleSequence.hasElements() ? aVisibleSequence.getLength() : 0);
+
+ if((bTestVisibility && nVisibleSize) || nAllSize)
+ {
+ // for getting the 3D range using getB3DRangeFromPrimitive3DSequence a ViewInformation3D
+ // needs to be given for evtl. decompositions. At the same time createViewInformation3D
+ // currently is based on creating the target-ViewInformation3D using a given range. To
+ // get the true range, use a neutral ViewInformation3D here. This leaves all matrices
+ // on identity and the time on 0.0.
+ const uno::Sequence< beans::PropertyValue > aEmptyProperties;
+ const drawinglayer::geometry::ViewInformation3D aNeutralViewInformation3D(aEmptyProperties);
+ const basegfx::B3DRange aContentRange(
+ drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence(aAllSequence, aNeutralViewInformation3D));
+
+ // create 2d primitive 3dscene with generated sub-list from collector
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::ScenePrimitive2D(
+ bTestVisibility ? aVisibleSequence : aAllSequence,
+ getSdrSceneAttribute(),
+ getSdrLightingAttribute(),
+ getObjectTransformation(),
+ getViewInformation3D(aContentRange)));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+ }
+
+ // always append an invisible outline for the cases where no visible content exists
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval,
+ drawinglayer::primitive2d::createHiddenGeometryPrimitives2D(
+ false, getObjectTransformation()));
+
+ return xRetval;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfE3dScene::createViewIndependentPrimitive2DSequence() const
+ {
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+
+ if(GetObjectCount())
+ {
+ // create a default ScenePrimitive2D (without visibility test of members)
+ xRetval = createScenePrimitive2DSequence(0);
+ }
+
+ return xRetval;
+ }
+
+ void ViewContactOfE3dScene::ActionChanged()
+ {
+ // call parent
+ ViewContactOfSdrObj::ActionChanged();
+
+ // mark locally cached values as invalid
+ maViewInformation3D = drawinglayer::geometry::ViewInformation3D();
+ maObjectTransformation.identity();
+ maSdrSceneAttribute = drawinglayer::attribute::SdrSceneAttribute();
+ maSdrLightingAttribute = drawinglayer::attribute::SdrLightingAttribute();
+ }
+
+ const drawinglayer::geometry::ViewInformation3D& ViewContactOfE3dScene::getViewInformation3D() const
+ {
+ if(maViewInformation3D.isDefault())
+ {
+ // this version will create the content range on demand locally and thus is less
+ // performant than the other one. Since the information is buffered the planned
+ // behaviour is that the version with the given range is used initially.
+ basegfx::B3DRange aContentRange(getAllContentRange3D());
+
+ if(aContentRange.isEmpty())
+ {
+ // empty scene, no 3d action should be necessary. Prepare some
+ // fallback size
+ OSL_ENSURE(false, "No need to get ViewInformation3D from an empty scene (!)");
+ aContentRange.expand(basegfx::B3DPoint(-100.0, -100.0, -100.0));
+ aContentRange.expand(basegfx::B3DPoint( 100.0, 100.0, 100.0));
+ }
+
+ const_cast < ViewContactOfE3dScene* >(this)->createViewInformation3D(aContentRange);
+ }
+
+ return maViewInformation3D;
+ }
+
+ const drawinglayer::geometry::ViewInformation3D& ViewContactOfE3dScene::getViewInformation3D(const basegfx::B3DRange& rContentRange) const
+ {
+ if(maViewInformation3D.isDefault())
+ {
+ const_cast < ViewContactOfE3dScene* >(this)->createViewInformation3D(rContentRange);
+ }
+
+ return maViewInformation3D;
+ }
+
+ const basegfx::B2DHomMatrix& ViewContactOfE3dScene::getObjectTransformation() const
+ {
+ if(maObjectTransformation.isIdentity())
+ {
+ const_cast < ViewContactOfE3dScene* >(this)->createObjectTransformation();
+ }
+
+ return maObjectTransformation;
+ }
+
+ const drawinglayer::attribute::SdrSceneAttribute& ViewContactOfE3dScene::getSdrSceneAttribute() const
+ {
+ if(maSdrSceneAttribute.isDefault())
+ {
+ const_cast < ViewContactOfE3dScene* >(this)->createSdrSceneAttribute();
+ }
+
+ return maSdrSceneAttribute;
+ }
+
+ const drawinglayer::attribute::SdrLightingAttribute& ViewContactOfE3dScene::getSdrLightingAttribute() const
+ {
+ if(maSdrLightingAttribute.isDefault())
+ {
+ const_cast < ViewContactOfE3dScene* >(this)->createSdrLightingAttribute();
+ }
+
+ return maSdrLightingAttribute;
+ }
+
+ drawinglayer::primitive3d::Primitive3DSequence ViewContactOfE3dScene::getAllPrimitive3DSequence() const
+ {
+ drawinglayer::primitive3d::Primitive3DSequence aAllPrimitive3DSequence;
+ const sal_uInt32 nChildrenCount(GetObjectCount());
+
+ // add children recursively. Do NOT start with (*this), this would create
+ // a 3D transformPrimitive for the start scene. While this is theoretically not
+ // a bad thing, for historical reasons the transformation of the outmost scene
+ // is seen as part of the ViewTransformation (see text in createViewInformation3D)
+ for(sal_uInt32 a(0L); a < nChildrenCount; a++)
+ {
+ createSubPrimitive3DVector(GetViewContact(a), aAllPrimitive3DSequence, 0, 0, false);
+ }
+
+ return aAllPrimitive3DSequence;
+ }
+
+ basegfx::B3DRange ViewContactOfE3dScene::getAllContentRange3D() const
+ {
+ const drawinglayer::primitive3d::Primitive3DSequence xAllSequence(getAllPrimitive3DSequence());
+ basegfx::B3DRange aAllContentRange3D;
+
+ if(xAllSequence.hasElements())
+ {
+ // for getting the 3D range using getB3DRangeFromPrimitive3DSequence a ViewInformation3D
+ // needs to be given for evtl. decompositions. Use a neutral ViewInformation3D here. This
+ // leaves all matrices on identity and the time on 0.0.
+ const uno::Sequence< beans::PropertyValue > aEmptyProperties;
+ const drawinglayer::geometry::ViewInformation3D aNeutralViewInformation3D(aEmptyProperties);
+
+ aAllContentRange3D = drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence(xAllSequence, aNeutralViewInformation3D);
+ }
+
+ return aAllContentRange3D;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewcontactofe3dsphere.cxx b/svx/source/sdr/contact/viewcontactofe3dsphere.cxx
new file mode 100644
index 000000000000..c16633f7f2c9
--- /dev/null
+++ b/svx/source/sdr/contact/viewcontactofe3dsphere.cxx
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/viewcontactofe3dsphere.hxx>
+#include <svx/sphere3d.hxx>
+#include <drawinglayer/primitive3d/sdrsphereprimitive3d.hxx>
+#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <svx/sdr/primitive3d/sdrattributecreator3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewContactOfE3dSphere::ViewContactOfE3dSphere(E3dSphereObj& rSphere)
+ : ViewContactOfE3d(rSphere)
+ {
+ }
+
+ ViewContactOfE3dSphere::~ViewContactOfE3dSphere()
+ {
+ }
+
+ drawinglayer::primitive3d::Primitive3DSequence ViewContactOfE3dSphere::createViewIndependentPrimitive3DSequence() const
+ {
+ drawinglayer::primitive3d::Primitive3DSequence xRetval;
+ const SfxItemSet& rItemSet = GetE3dSphereObj().GetMergedItemSet();
+ const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false));
+
+ // get sphere center and size for geometry
+ basegfx::B3DRange aSphereRange;
+ const basegfx::B3DPoint aSpherePosition(GetE3dSphereObj().Center());
+ const basegfx::B3DVector aSphereSize(GetE3dSphereObj().Size());
+ basegfx::B3DHomMatrix aWorldTransform;
+
+ aWorldTransform.translate(-0.5, -0.5, -0.5);
+ aWorldTransform.scale(aSphereSize.getX(), aSphereSize.getY(), aSphereSize.getZ());
+ aWorldTransform.translate(aSpherePosition.getX(), aSpherePosition.getY(), aSpherePosition.getZ());
+
+ // get 3D Object Attributes
+ drawinglayer::attribute::Sdr3DObjectAttribute* pSdr3DObjectAttribute = drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet);
+
+ // get segment count
+ const sal_uInt32 nHorizontalSegments(GetE3dSphereObj().GetHorizontalSegments());
+ const sal_uInt32 nVerticalSegments(GetE3dSphereObj().GetVerticalSegments());
+
+ // calculate texture size, use radii for (2 * PI * r) to get a perfect
+ // mapping on the sphere
+ const basegfx::B2DVector aTextureSize(
+ F_PI * ((aSphereSize.getX() + aSphereSize.getZ()) / 2.0), // PI * d
+ F_PI2 * aSphereSize.getY()); // half outline, (PI * d)/2 -> PI/2 * d
+
+ // create primitive and add
+ const drawinglayer::primitive3d::Primitive3DReference xReference(
+ new drawinglayer::primitive3d::SdrSpherePrimitive3D(
+ aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute,
+ nHorizontalSegments, nVerticalSegments));
+ xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1);
+
+ // delete 3D Object Attributes
+ delete pSdr3DObjectAttribute;
+
+ return xRetval;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx
new file mode 100644
index 000000000000..1ba774ba378f
--- /dev/null
+++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx
@@ -0,0 +1,463 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/contact/viewcontactofgraphic.hxx>
+#include <svx/sdr/contact/viewobjectcontactofgraphic.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <svl/itemset.hxx>
+
+#ifndef ITEMID_GRF_CROP
+#define ITEMID_GRF_CROP 0
+#endif
+
+#include <svx/sdgcpitm.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <svx/sdr/contact/objectcontact.hxx>
+#include <svx/sdr/event/eventhandler.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/primitive2d/sdrgrafprimitive2d.hxx>
+#include "svx/svdstr.hrc"
+#include <svx/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 <editeng/eeitem.hxx>
+#include <editeng/colritem.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ // Create a Object-Specific ViewObjectContact, set ViewContact and
+ // ObjectContact. Always needs to return something.
+ ViewObjectContact& ViewContactOfGraphic::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
+ {
+ ViewObjectContact* pRetval = new ViewObjectContactOfGraphic(rObjectContact, *this);
+ DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
+
+ return *pRetval;
+ }
+
+ ViewContactOfGraphic::ViewContactOfGraphic(SdrGrafObj& rGrafObj)
+ : ViewContactOfTextObj(rGrafObj)
+ {
+ }
+
+ ViewContactOfGraphic::~ViewContactOfGraphic()
+ {
+ }
+
+ 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 = basegfx::tools::createScaleTranslateB2DHomMatrix(aPrefSize.getWidth(), aPrefSize.getHeight(), fOffsetX, fOffsetY);
+ aSmallerMatrix = basegfx::tools::createShearXRotateTranslateB2DHomMatrix(fShearX, fRotate, aTranslate)
+ * aSmallerMatrix;
+
+ const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false);
+ const drawinglayer::primitive2d::Primitive2DReference xReferenceB(new drawinglayer::primitive2d::SdrGrafPrimitive2D(
+ aSmallerMatrix,
+ drawinglayer::attribute::SdrLineFillShadowTextAttribute(),
+ 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().isDefault())
+ {
+ // create a surrounding frame when no linestyle given
+ const Color aColor(Application::GetSettings().GetStyleSettings().GetShadowColor());
+ const basegfx::BColor aBColor(aColor.getBColor());
+ basegfx::B2DPolygon aOutline(basegfx::tools::createUnitPolygon());
+ 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()))
+ {
+ const basegfx::B2DHomMatrix aBitmapMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ fWidth, fHeight, fShearX, fRotate, 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
+ const basegfx::B2DHomMatrix aTextRangeTransform(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ aScale, fShearX, fRotate, aTranslate));
+
+ // directly create temp SdrBlockTextPrimitive2D
+ drawinglayer::primitive2d::SdrBlockTextPrimitive2D aBlockTextPrimitive(
+ pSdrText,
+ *pOPO,
+ aTextRangeTransform,
+ SDRTEXTHORZADJUST_LEFT,
+ SDRTEXTVERTADJUST_TOP,
+ false,
+ false,
+ false,
+ false,
+ false);
+
+ // decompose immediately with neutral ViewInformation. This will
+ // layout the text to more simple TextPrimitives from drawinglayer
+ const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
+
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(
+ xRetval,
+ aBlockTextPrimitive.get2DDecomposition(aViewInformation2D));
+ }
+ }
+
+ return xRetval;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGraphic::createViewIndependentPrimitive2DSequence() const
+ {
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+ const SfxItemSet& rItemSet = GetGrafObject().GetMergedItemSet();
+ drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
+ rItemSet,
+ GetGrafObject().getText(0)));
+
+ // create and fill GraphicAttr
+ GraphicAttr aLocalGrafInfo;
+ const sal_uInt16 nTrans(((SdrGrafTransparenceItem&)rItemSet.Get(SDRATTR_GRAFTRANSPARENCE)).GetValue());
+ const SdrGrafCropItem& rCrop((const SdrGrafCropItem&)rItemSet.Get(SDRATTR_GRAFCROP));
+ aLocalGrafInfo.SetLuminance(((SdrGrafLuminanceItem&)rItemSet.Get(SDRATTR_GRAFLUMINANCE)).GetValue());
+ aLocalGrafInfo.SetContrast(((SdrGrafContrastItem&)rItemSet.Get(SDRATTR_GRAFCONTRAST)).GetValue());
+ aLocalGrafInfo.SetChannelR(((SdrGrafRedItem&)rItemSet.Get(SDRATTR_GRAFRED)).GetValue());
+ aLocalGrafInfo.SetChannelG(((SdrGrafGreenItem&)rItemSet.Get(SDRATTR_GRAFGREEN)).GetValue());
+ aLocalGrafInfo.SetChannelB(((SdrGrafBlueItem&)rItemSet.Get(SDRATTR_GRAFBLUE)).GetValue());
+ aLocalGrafInfo.SetGamma(((SdrGrafGamma100Item&)rItemSet.Get(SDRATTR_GRAFGAMMA)).GetValue() * 0.01);
+ aLocalGrafInfo.SetTransparency((sal_uInt8)::basegfx::fround(Min(nTrans, (sal_uInt16)100) * 2.55));
+ aLocalGrafInfo.SetInvert(((SdrGrafInvertItem&)rItemSet.Get(SDRATTR_GRAFINVERT)).GetValue());
+ aLocalGrafInfo.SetDrawMode(((SdrGrafModeItem&)rItemSet.Get(SDRATTR_GRAFMODE)).GetValue());
+ aLocalGrafInfo.SetCrop(rCrop.GetLeft(), rCrop.GetTop(), rCrop.GetRight(), rCrop.GetBottom());
+
+ if(aAttribute.isDefault() && 255L != aLocalGrafInfo.GetTransparency())
+ {
+ // no fill, no line, no text (invisible), but the graphic content is visible.
+ // Create evtl. shadow for content which was not created by createNewSdrLineFillShadowTextAttribute yet
+ const drawinglayer::attribute::SdrShadowAttribute aShadow(
+ drawinglayer::primitive2d::createNewSdrShadowAttribute(rItemSet));
+
+ if(!aShadow.isDefault())
+ {
+ // create new attribute set if indeed shadow is used
+ aAttribute = drawinglayer::attribute::SdrLineFillShadowTextAttribute(
+ aAttribute.getLine(),
+ aAttribute.getFill(),
+ aAttribute.getLineStartEnd(),
+ aShadow,
+ aAttribute.getFillFloatTransGradient(),
+ aAttribute.getText());
+ }
+ }
+
+ // take unrotated snap rect for position and size. Directly use model data, not getBoundRect() or getSnapRect()
+ // 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());
+
+ // look for mirroring
+ const GeoStat& rGeoStat(GetGrafObject().GetGeoStat());
+ const sal_Int32 nDrehWink(rGeoStat.nDrehWink);
+ const bool bRota180(18000 == nDrehWink);
+ const bool bMirrored(GetGrafObject().IsMirrored());
+ const sal_uInt16 nMirrorCase(bRota180 ? (bMirrored ? 3 : 4) : (bMirrored ? 2 : 1));
+ bool bHMirr((2 == nMirrorCase ) || (4 == nMirrorCase));
+ bool bVMirr((3 == nMirrorCase ) || (4 == nMirrorCase));
+
+ // set mirror flags at LocalGrafInfo. Take into account that the geometry in
+ // aObjectRange is already changed and rotated when bRota180 is used. To rebuild
+ // that old behaviour (as long as part of the model data), correct the H/V flags
+ // accordingly. The created bitmapPrimitive WILL use the rotation, too.
+ if(bRota180)
+ {
+ // if bRota180 which is used for vertical mirroring, the graphic will already be rotated
+ // by 180 degrees. To correct, switch off VMirror and invert HMirroring.
+ bHMirr = !bHMirr;
+ bVMirr = false;
+ }
+
+ if(bHMirr || bVMirr)
+ {
+ aLocalGrafInfo.SetMirrorFlags((bHMirr ? BMP_MIRROR_HORZ : 0)|(bVMirr ? BMP_MIRROR_VERT : 0));
+ }
+
+ // fill object matrix
+ const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0);
+ const double fRotate(nDrehWink ? (36000 - nDrehWink) * F_PI18000 : 0.0);
+ const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ aObjectRange.getWidth(), aObjectRange.getHeight(),
+ fShearX, fRotate,
+ aObjectRange.getMinX(), aObjectRange.getMinY()));
+
+ // get the current, unchenged graphic obect from SdrGrafObj
+ const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false);
+
+ if(visualisationUsesPresObj())
+ {
+ // it's an EmptyPresObj, create the SdrGrafPrimitive2D without content and another scaled one
+ // with the content which is the placeholder graphic
+ xRetval = createVIP2DSForPresObj(aObjectMatrix, aAttribute, 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, aAttribute);
+ }
+ else
+ {
+ // 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,
+ aAttribute,
+ rGraphicObject,
+ aLocalGrafInfo));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+
+ // always append an invisible outline for the cases where no visible content exists
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval,
+ drawinglayer::primitive2d::createHiddenGeometryPrimitives2D(
+ false, aObjectMatrix));
+
+ 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
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewcontactofgroup.cxx b/svx/source/sdr/contact/viewcontactofgroup.cxx
new file mode 100644
index 000000000000..6252811d32a3
--- /dev/null
+++ b/svx/source/sdr/contact/viewcontactofgroup.cxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/contact/viewcontactofgroup.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <svx/sdr/contact/viewobjectcontactofgroup.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ // Create a Object-Specific ViewObjectContact, set ViewContact and
+ // ObjectContact. Always needs to return something.
+ ViewObjectContact& ViewContactOfGroup::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
+ {
+ ViewObjectContact* pRetval = new ViewObjectContactOfGroup(rObjectContact, *this);
+ DBG_ASSERT(pRetval, "ViewContactOfGroup::CreateObjectSpecificViewObjectContact() failed (!)");
+
+ return *pRetval;
+ }
+
+ ViewContactOfGroup::ViewContactOfGroup(SdrObjGroup& rGroup)
+ : ViewContactOfSdrObj(rGroup)
+ {
+ }
+
+ ViewContactOfGroup::~ViewContactOfGroup()
+ {
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGroup::createViewIndependentPrimitive2DSequence() const
+ {
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+ const sal_uInt32 nObjectCount(GetObjectCount());
+
+ if(nObjectCount)
+ {
+ // collect all sub-primitives
+ for(sal_uInt32 a(0); a < nObjectCount; a++)
+ {
+ const ViewContact& rCandidate(GetViewContact(a));
+ const drawinglayer::primitive2d::Primitive2DSequence aCandSeq(rCandidate.getViewIndependentPrimitive2DSequence());
+
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, aCandSeq);
+ }
+ }
+ else
+ {
+ // append an invisible outline for the cases where no visible content exists
+ const Rectangle aCurrentBoundRect(GetSdrObjGroup().GetLastBoundRect());
+ const basegfx::B2DRange aCurrentRange(
+ aCurrentBoundRect.Left(), aCurrentBoundRect.Top(),
+ aCurrentBoundRect.Right(), aCurrentBoundRect.Bottom());
+
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ drawinglayer::primitive2d::createHiddenGeometryPrimitives2D(
+ false, aCurrentRange));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+
+ return xRetval;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx
new file mode 100644
index 000000000000..6ca5f1c4d172
--- /dev/null
+++ b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/contact/viewcontactofmasterpagedescriptor.hxx>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
+#include <vcl/timer.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdview.hxx>
+#include <svx/sdr/contact/viewcontactofsdrpage.hxx>
+#include <svx/sdr/contact/viewobjectcontactofmasterpagedescriptor.hxx>
+#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
+#include <svx/svdpage.hxx>
+#include <drawinglayer/attribute/sdrfillattribute.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewObjectContact& ViewContactOfMasterPageDescriptor::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
+ {
+ return *(new ViewObjectContactOfMasterPageDescriptor(rObjectContact, *this));
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfMasterPageDescriptor::createViewIndependentPrimitive2DSequence() const
+ {
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+ drawinglayer::attribute::SdrFillAttribute aFill;
+ const SdrPageProperties* pCorrectProperties = GetMasterPageDescriptor().getCorrectSdrPageProperties();
+
+ if(pCorrectProperties)
+ {
+ // create page fill attributes when correct properties were identified
+ aFill = drawinglayer::primitive2d::createNewSdrFillAttribute(pCorrectProperties->GetItemSet());
+ }
+
+ if(!aFill.isDefault())
+ {
+ // direct model data is the page size, get and use it
+ const SdrPage& rOwnerPage = GetMasterPageDescriptor().GetOwnerPage();
+ const basegfx::B2DRange aInnerRange(
+ rOwnerPage.GetLftBorder(), rOwnerPage.GetUppBorder(),
+ rOwnerPage.GetWdt() - rOwnerPage.GetRgtBorder(),
+ rOwnerPage.GetHgt() - rOwnerPage.GetLwrBorder());
+ const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange));
+ const basegfx::B2DHomMatrix aEmptyTransform;
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
+ basegfx::B2DPolyPolygon(aInnerPolgon),
+ aEmptyTransform,
+ aFill,
+ drawinglayer::attribute::FillGradientAttribute()));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+
+ return xRetval;
+ }
+
+ // basic constructor
+ ViewContactOfMasterPageDescriptor::ViewContactOfMasterPageDescriptor(sdr::MasterPageDescriptor& rDescriptor)
+ : ViewContact(),
+ mrMasterPageDescriptor(rDescriptor)
+ {
+ }
+
+ // The destructor.
+ ViewContactOfMasterPageDescriptor::~ViewContactOfMasterPageDescriptor()
+ {
+ }
+
+ sal_uInt32 ViewContactOfMasterPageDescriptor::GetObjectCount() const
+ {
+ return GetMasterPageDescriptor().GetUsedPage().GetObjCount();
+ }
+
+ ViewContact& ViewContactOfMasterPageDescriptor::GetViewContact(sal_uInt32 nIndex) const
+ {
+ return GetMasterPageDescriptor().GetUsedPage().GetObj(nIndex)->GetViewContact();
+ }
+
+ ViewContact* ViewContactOfMasterPageDescriptor::GetParentContact() const
+ {
+ return &(GetMasterPageDescriptor().GetOwnerPage().GetViewContact());
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewcontactofpageobj.cxx b/svx/source/sdr/contact/viewcontactofpageobj.cxx
new file mode 100644
index 000000000000..3740ec27bdb5
--- /dev/null
+++ b/svx/source/sdr/contact/viewcontactofpageobj.cxx
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/contact/viewcontactofpageobj.hxx>
+#include <svx/svdopage.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <vcl/outdev.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <svx/sdr/contact/viewobjectcontactofpageobj.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewObjectContact& ViewContactOfPageObj::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
+ {
+ ViewObjectContact* pRetval = new ViewObjectContactOfPageObj(rObjectContact, *this);
+ return *pRetval;
+ }
+
+ // Access to referenced page
+ const SdrPage* ViewContactOfPageObj::GetReferencedPage() const
+ {
+ return GetPageObj().GetReferencedPage();
+ }
+
+ ViewContactOfPageObj::ViewContactOfPageObj(SdrPageObj& rPageObj)
+ : ViewContactOfSdrObj(rPageObj)
+ {
+ }
+
+ ViewContactOfPageObj::~ViewContactOfPageObj()
+ {
+ }
+
+ // #i35972# React on changes of the object of this ViewContact
+ void ViewContactOfPageObj::ActionChanged()
+ {
+ static bool bIsInActionChange(false);
+
+ if(!bIsInActionChange)
+ {
+ // set recursion flag, see description in *.hxx
+ bIsInActionChange = true;
+
+ // call parent
+ ViewContactOfSdrObj::ActionChanged();
+
+ // reset recursion flag, see description in *.hxx
+ bIsInActionChange = false;
+ }
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageObj::createViewIndependentPrimitive2DSequence() const
+ {
+ // ceate graphical visualisation data. Since this is the view-independent version which should not be used,
+ // create a replacement graphic visualisation here. Use GetLastBoundRect to access the model data directly
+ // which is aOutRect for SdrPageObj.
+ const Rectangle aModelRectangle(GetPageObj().GetLastBoundRect());
+ const basegfx::B2DRange aModelRange(aModelRectangle.Left(), aModelRectangle.Top(), aModelRectangle.Right(), aModelRectangle.Bottom());
+ const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aModelRange));
+ const basegfx::BColor aYellow(1.0, 1.0, 0.0);
+ const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aYellow));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx
new file mode 100644
index 000000000000..84e60392a88f
--- /dev/null
+++ b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx
@@ -0,0 +1,179 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/viewcontactofsdrcaptionobj.hxx>
+#include <svx/svdocapt.hxx>
+#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// includes for special text box shadow (SC)
+
+#include <svl/itemset.hxx>
+#include <svx/xhatch.hxx>
+#include <svx/xflhtit.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xfltrit.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewContactOfSdrCaptionObj::ViewContactOfSdrCaptionObj(SdrCaptionObj& rCaptionObj)
+ : ViewContactOfSdrRectObj(rCaptionObj)
+ {
+ }
+
+ ViewContactOfSdrCaptionObj::~ViewContactOfSdrCaptionObj()
+ {
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrCaptionObj::createViewIndependentPrimitive2DSequence() const
+ {
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+ const SdrCaptionObj& rCaptionObj(GetCaptionObj());
+ const SfxItemSet& rItemSet = rCaptionObj.GetMergedItemSet();
+ const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
+ rItemSet,
+ rCaptionObj.getText(0)));
+
+ // take unrotated snap rect (direct model data) for position and size
+ const Rectangle& rRectangle = rCaptionObj.GetGeoRect();
+ const ::basegfx::B2DRange aObjectRange(
+ rRectangle.Left(), rRectangle.Top(),
+ rRectangle.Right(), rRectangle.Bottom());
+ const GeoStat& rGeoStat(rCaptionObj.GetGeoStat());
+
+ // fill object matrix
+ basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ aObjectRange.getWidth(), aObjectRange.getHeight(),
+ rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0,
+ rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0,
+ aObjectRange.getMinX(), aObjectRange.getMinY()));
+
+ // calculate corner radius
+ double fCornerRadiusX;
+ double fCornerRadiusY;
+ drawinglayer::primitive2d::calculateRelativeCornerRadius(
+ rCaptionObj.GetEckenradius(), aObjectRange, fCornerRadiusX, fCornerRadiusY);
+
+ // create primitive. Always create one (even if invisible) to let the decomposition
+ // of SdrCaptionPrimitive2D create needed invisible elements for HitTest and BoundRect
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::SdrCaptionPrimitive2D(
+ aObjectMatrix,
+ aAttribute,
+ rCaptionObj.getTailPolygon(),
+ fCornerRadiusX,
+ fCornerRadiusY));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+
+ if(!aAttribute.isDefault() && rCaptionObj.GetSpecialTextBoxShadow())
+ {
+ // for SC, the caption object may have a specialized shadow. The usual object shadow is off
+ // and a specialized shadow gets created here (see old paint)
+ const SdrShadowColorItem& rShadColItem = (SdrShadowColorItem&)(rItemSet.Get(SDRATTR_SHADOWCOLOR));
+ const sal_uInt16 nTransp(((SdrShadowTransparenceItem&)(rItemSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue());
+ const Color aShadCol(rShadColItem.GetColorValue());
+ const XFillStyle eStyle = ((XFillStyleItem&)(rItemSet.Get(XATTR_FILLSTYLE))).GetValue();
+
+ // Create own ItemSet and modify as needed
+ // Always hide lines for special calc shadow
+ SfxItemSet aSet(rItemSet);
+ aSet.Put(XLineStyleItem(XLINE_NONE));
+
+ if(XFILL_HATCH == eStyle)
+ {
+ // #41666# Hatch color is set hard to shadow color
+ XHatch aHatch = ((XFillHatchItem&)(rItemSet.Get(XATTR_FILLHATCH))).GetHatchValue();
+ aHatch.SetColor(aShadCol);
+ aSet.Put(XFillHatchItem(String(),aHatch));
+ }
+ else
+ {
+ if(XFILL_NONE != eStyle && XFILL_SOLID != eStyle)
+ {
+ // force fill to solid (for Gradient and Bitmap)
+ aSet.Put(XFillStyleItem(XFILL_SOLID));
+ }
+
+ aSet.Put(XFillColorItem(String(),aShadCol));
+ aSet.Put(XFillTransparenceItem(nTransp));
+ }
+
+ // crete FillAttribute from modified ItemSet
+ const drawinglayer::attribute::SdrFillAttribute aFill(
+ drawinglayer::primitive2d::createNewSdrFillAttribute(aSet));
+ drawinglayer::primitive2d::Primitive2DReference xSpecialShadow;
+
+ if(!aFill.isDefault() && 1.0 != aFill.getTransparence())
+ {
+ // add shadow offset to object matrix
+ const sal_uInt32 nXDist(((SdrShadowXDistItem&)(rItemSet.Get(SDRATTR_SHADOWXDIST))).GetValue());
+ const sal_uInt32 nYDist(((SdrShadowYDistItem&)(rItemSet.Get(SDRATTR_SHADOWYDIST))).GetValue());
+ aObjectMatrix.translate(nXDist, nYDist);
+
+ // create unit outline polygon as geometry (see SdrCaptionPrimitive2D::create2DDecomposition)
+ basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(
+ basegfx::B2DRange(0.0, 0.0, 1.0, 1.0), fCornerRadiusX, fCornerRadiusY));
+
+ // create the specialized shadow primitive
+ xSpecialShadow = drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ aObjectMatrix,
+ aFill,
+ drawinglayer::attribute::FillGradientAttribute());
+ }
+
+ if(xSpecialShadow.is())
+ {
+ // if we really got a special shadow, create a two-element retval with the shadow
+ // behind the standard object's geometry
+ xRetval.realloc(2);
+
+ xRetval[0] = xSpecialShadow;
+ xRetval[1] = xReference;
+ }
+ }
+
+ return xRetval;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx
new file mode 100644
index 000000000000..f6f2f094001b
--- /dev/null
+++ b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/viewcontactofsdrcircobj.hxx>
+#include <svx/svdocirc.hxx>
+#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <svx/sdr/primitive2d/sdrellipseprimitive2d.hxx>
+#include <svl/itemset.hxx>
+#include <svx/sxciaitm.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewContactOfSdrCircObj::ViewContactOfSdrCircObj(SdrCircObj& rCircObj)
+ : ViewContactOfSdrRectObj(rCircObj)
+ {
+ }
+
+ ViewContactOfSdrCircObj::~ViewContactOfSdrCircObj()
+ {
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrCircObj::createViewIndependentPrimitive2DSequence() const
+ {
+ const SfxItemSet& rItemSet = GetCircObj().GetMergedItemSet();
+ const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
+ rItemSet,
+ GetCircObj().getText(0)));
+
+ // take unrotated snap rect (direct model data) for position and size
+ const Rectangle& rRectangle = GetCircObj().GetGeoRect();
+ const basegfx::B2DRange aObjectRange(
+ rRectangle.Left(), rRectangle.Top(),
+ rRectangle.Right(), rRectangle.Bottom());
+ const GeoStat& rGeoStat(GetCircObj().GetGeoStat());
+
+ // fill object matrix
+ const basegfx::B2DHomMatrix aObjectMatrix(
+ basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ aObjectRange.getWidth(), aObjectRange.getHeight(),
+ rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0,
+ rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0,
+ aObjectRange.getMinX(), aObjectRange.getMinY()));
+
+ // create primitive data
+ const sal_uInt16 nIdentifier(GetCircObj().GetObjIdentifier());
+
+ // always create primitives to allow the decomposition of SdrEllipsePrimitive2D
+ // or SdrEllipseSegmentPrimitive2D to create needed invisible elements for HitTest
+ // and/or BoundRect
+ if(OBJ_CIRC == nIdentifier)
+ {
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::SdrEllipsePrimitive2D(
+ aObjectMatrix,
+ aAttribute));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+ else
+ {
+ const sal_Int32 nNewStart(((SdrCircStartAngleItem&)rItemSet.Get(SDRATTR_CIRCSTARTANGLE)).GetValue());
+ const sal_Int32 nNewEnd(((SdrCircEndAngleItem&)rItemSet.Get(SDRATTR_CIRCENDANGLE)).GetValue());
+ const double fStart(((36000 - nNewEnd) % 36000) * F_PI18000);
+ const double fEnd(((36000 - nNewStart) % 36000) * F_PI18000);
+ const bool bCloseSegment(OBJ_CARC != nIdentifier);
+ const bool bCloseUsingCenter(OBJ_SECT == nIdentifier);
+
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::SdrEllipseSegmentPrimitive2D(
+ aObjectMatrix,
+ aAttribute,
+ fStart,
+ fEnd,
+ bCloseSegment,
+ bCloseUsingCenter));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx b/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx
new file mode 100644
index 000000000000..7b4ec93afb38
--- /dev/null
+++ b/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/viewcontactofsdredgeobj.hxx>
+#include <svx/svdoedge.hxx>
+#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewContactOfSdrEdgeObj::ViewContactOfSdrEdgeObj(SdrEdgeObj& rEdgeObj)
+ : ViewContactOfTextObj(rEdgeObj)
+ {
+ }
+
+ ViewContactOfSdrEdgeObj::~ViewContactOfSdrEdgeObj()
+ {
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrEdgeObj::createViewIndependentPrimitive2DSequence() const
+ {
+ const basegfx::B2DPolygon& rEdgeTrack = GetEdgeObj().getEdgeTrack();
+
+ // what to do when no EdgeTrack is provided (HitTest and selectability) ?
+ OSL_ENSURE(0 != rEdgeTrack.count(), "Connectors with no geometry are not allowed (!)");
+
+ // ckeck attributes
+ const SfxItemSet& rItemSet = GetEdgeObj().GetMergedItemSet();
+ const drawinglayer::attribute::SdrLineShadowTextAttribute aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineShadowTextAttribute(
+ rItemSet,
+ GetEdgeObj().getText(0)));
+
+ // create primitive. Always create primitives to allow the decomposition of
+ // SdrConnectorPrimitive2D to create needed invisible elements for HitTest
+ // and/or BoundRect
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::SdrConnectorPrimitive2D(
+ aAttribute,
+ rEdgeTrack));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx b/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx
new file mode 100644
index 000000000000..9d0d38f688eb
--- /dev/null
+++ b/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/viewcontactofsdrmeasureobj.hxx>
+#include <svx/svdomeas.hxx>
+#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <svl/itemset.hxx>
+#include <svx/sxmbritm.hxx>
+#include <svx/sxmlhitm.hxx>
+#include <svx/sxmtritm.hxx>
+#include <svx/sxmtaitm.hxx>
+#include <svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx>
+#include <svx/sxmtpitm.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewContactOfSdrMeasureObj::ViewContactOfSdrMeasureObj(SdrMeasureObj& rMeasureObj)
+ : ViewContactOfTextObj(rMeasureObj)
+ {
+ }
+
+ ViewContactOfSdrMeasureObj::~ViewContactOfSdrMeasureObj()
+ {
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrMeasureObj::createViewIndependentPrimitive2DSequence() const
+ {
+ const SfxItemSet& rItemSet = GetMeasureObj().GetMergedItemSet();
+ const drawinglayer::attribute::SdrLineShadowTextAttribute aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineShadowTextAttribute(
+ rItemSet,
+ GetMeasureObj().getText(0)));
+
+ // take properties which are the model data.
+ const ::basegfx::B2DPoint aStart(GetMeasureObj().GetPoint(0).X(), GetMeasureObj().GetPoint(0).Y());
+ const ::basegfx::B2DPoint aEnd(GetMeasureObj().GetPoint(1).X(), GetMeasureObj().GetPoint(1).Y());
+ const double fDistance(((SdrMeasureLineDistItem&)rItemSet.Get(SDRATTR_MEASURELINEDIST)).GetValue());
+ const double fUpperDistance(((SdrMeasureHelplineOverhangItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEOVERHANG)).GetValue());
+ const double fLowerDistance(((SdrMeasureHelplineDistItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEDIST)).GetValue());
+ const double fLeftDelta(((SdrMeasureHelpline1LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE1LEN)).GetValue());
+ const double fRightDelta(((SdrMeasureHelpline2LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE2LEN)).GetValue());
+ const bool bBelow(((SdrMeasureBelowRefEdgeItem&)rItemSet.Get(SDRATTR_MEASUREBELOWREFEDGE)).GetValue());
+ const bool bTextRotation(((SdrMeasureTextRota90Item&)rItemSet.Get(SDRATTR_MEASURETEXTROTA90)).GetValue());
+ const bool bTextAutoAngle(((SdrMeasureTextAutoAngleItem&)rItemSet.Get(SDRATTR_MEASURETEXTAUTOANGLE)).GetValue());
+ drawinglayer::primitive2d::MeasureTextPosition aMTPHor(drawinglayer::primitive2d::MEASURETEXTPOSITION_AUTOMATIC);
+ drawinglayer::primitive2d::MeasureTextPosition aMTPVer(drawinglayer::primitive2d::MEASURETEXTPOSITION_AUTOMATIC);
+
+ switch(((SdrMeasureTextHPosItem&)rItemSet.Get(SDRATTR_MEASURETEXTHPOS)).GetValue())
+ {
+ case SDRMEASURE_TEXTLEFTOUTSIDE :
+ {
+ aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE;
+ break;
+ }
+ case SDRMEASURE_TEXTINSIDE :
+ {
+ aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED;
+ break;
+ }
+ case SDRMEASURE_TEXTRIGHTOUTSIDE :
+ {
+ aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE;
+ break;
+ }
+ default : // SDRMEASURE_TEXTHAUTO
+ {
+ break;
+ }
+ }
+
+ switch(((SdrMeasureTextVPosItem&)rItemSet.Get(SDRATTR_MEASURETEXTVPOS)).GetValue())
+ {
+ case SDRMEASURE_ABOVE :
+ {
+ aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE;
+ break;
+ }
+ case SDRMEASURETEXT_BREAKEDLINE :
+ case SDRMEASURETEXT_VERTICALCENTERED :
+ {
+ aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED;
+ break;
+ }
+ case SDRMEASURE_BELOW :
+ {
+ aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE;
+ break;
+ }
+ default : // SDRMEASURE_TEXTVAUTO
+ {
+ break;
+ }
+ }
+
+ // create primitive with the model data. Always create primitives to allow the
+ // decomposition of SdrMeasurePrimitive2D to create needed invisible elements for HitTest
+ // and/or BoundRect
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::SdrMeasurePrimitive2D(
+ aAttribute, aStart, aEnd,
+ aMTPHor, aMTPVer, fDistance,
+ fUpperDistance, fLowerDistance,
+ fLeftDelta, fRightDelta, bBelow,
+ bTextRotation, bTextAutoAngle));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx b/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx
new file mode 100644
index 000000000000..ab6598840a8e
--- /dev/null
+++ b/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx
@@ -0,0 +1,184 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx>
+#include <svx/svdomedia.hxx>
+#include <svx/sdr/contact/viewobjectcontactofsdrmediaobj.hxx>
+#include <drawinglayer/primitive2d/mediaprimitive2d.hxx>
+
+namespace sdr { namespace contact {
+
+// ----------------------------
+// - ViewContactOfSdrMediaObj -
+// ----------------------------
+
+ViewContactOfSdrMediaObj::ViewContactOfSdrMediaObj( SdrMediaObj& rMediaObj ) :
+ ViewContactOfSdrObj( rMediaObj )
+{
+}
+
+// ------------------------------------------------------------------------------
+
+ViewContactOfSdrMediaObj::~ViewContactOfSdrMediaObj()
+{
+}
+
+// ------------------------------------------------------------------------------
+
+ViewObjectContact& ViewContactOfSdrMediaObj::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
+{
+ return *( new ViewObjectContactOfSdrMediaObj( rObjectContact, *this, static_cast< SdrMediaObj& >( GetSdrObject() ).getMediaProperties() ) );
+}
+
+// ------------------------------------------------------------------------------
+
+bool ViewContactOfSdrMediaObj::hasPreferredSize() const
+{
+ // #i71805# Since we may have a whole bunch of VOCs here, make a loop
+ // return true if all have their preferred size
+ const sal_uInt32 nCount(getViewObjectContactCount());
+ bool bRetval(true);
+
+ for(sal_uInt32 a(0); bRetval && a < nCount; a++)
+ {
+ ViewObjectContact* pCandidate = getViewObjectContact(a);
+
+ if(pCandidate && !static_cast< ViewObjectContactOfSdrMediaObj* >(pCandidate)->hasPreferredSize())
+ {
+ bRetval = false;
+ }
+ }
+
+ return bRetval;
+}
+
+// ------------------------------------------------------------------------------
+
+Size ViewContactOfSdrMediaObj::getPreferredSize() const
+{
+ // #i71805# Since we may have a whole bunch of VOCs here, make a loop
+ // return first useful size -> the size from the first which is visualized as a window
+ const sal_uInt32 nCount(getViewObjectContactCount());
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ ViewObjectContact* pCandidate = getViewObjectContact(a);
+ Size aSize(pCandidate ? static_cast< ViewObjectContactOfSdrMediaObj* >(pCandidate)->getPreferredSize() : Size());
+
+ if(0 != aSize.getWidth() || 0 != aSize.getHeight())
+ {
+ return aSize;
+ }
+ }
+
+ return Size();
+}
+
+// ------------------------------------------------------------------------------
+
+void ViewContactOfSdrMediaObj::updateMediaItem( ::avmedia::MediaItem& rItem ) const
+{
+ // #i71805# Since we may have a whole bunch of VOCs here, make a loop
+ const sal_uInt32 nCount(getViewObjectContactCount());
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ ViewObjectContact* pCandidate = getViewObjectContact(a);
+
+ if(pCandidate)
+ {
+ static_cast< ViewObjectContactOfSdrMediaObj* >(pCandidate)->updateMediaItem(rItem);
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+void ViewContactOfSdrMediaObj::executeMediaItem( const ::avmedia::MediaItem& rItem )
+{
+ const sal_uInt32 nCount(getViewObjectContactCount());
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ ViewObjectContact* pCandidate = getViewObjectContact(a);
+
+ if(pCandidate)
+ {
+ static_cast< ViewObjectContactOfSdrMediaObj* >(pCandidate)->executeMediaItem(rItem);
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+void ViewContactOfSdrMediaObj::mediaPropertiesChanged( const ::avmedia::MediaItem& rNewState )
+{
+ static_cast< SdrMediaObj& >(GetSdrObject()).mediaPropertiesChanged(rNewState);
+}
+
+}} // end of namespace sdr::contact
+
+namespace sdr
+{
+ namespace contact
+ {
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrMediaObj::createViewIndependentPrimitive2DSequence() const
+ {
+ // create range using the model data directly. This is in SdrTextObj::aRect which i will access using
+ // GetGeoRect() to not trigger any calculations. It's the unrotated geometry which is okay for MediaObjects ATM.
+ const Rectangle& rRectangle(GetSdrMediaObj().GetGeoRect());
+ const basegfx::B2DRange aRange(
+ rRectangle.Left(), rRectangle.Top(),
+ rRectangle.Right(), rRectangle.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 media primitive. Always create primitives to allow the
+ // decomposition of MediaPrimitive2D to create needed invisible elements for HitTest
+ // and/or BoundRect
+ const basegfx::BColor aBackgroundColor(67.0 / 255.0, 67.0 / 255.0, 67.0 / 255.0);
+ const rtl::OUString& rURL(GetSdrMediaObj().getURL());
+ const sal_uInt32 nPixelBorder(4L);
+ const drawinglayer::primitive2d::Primitive2DReference xRetval(
+ new drawinglayer::primitive2d::MediaPrimitive2D(
+ aTransform, rURL, aBackgroundColor, nPixelBorder));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1);
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewcontactofsdrobj.cxx b/svx/source/sdr/contact/viewcontactofsdrobj.cxx
new file mode 100644
index 000000000000..3b002e406be1
--- /dev/null
+++ b/svx/source/sdr/contact/viewcontactofsdrobj.cxx
@@ -0,0 +1,194 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/contact/viewcontactofsdrobj.hxx>
+#include <svx/sdr/contact/viewobjectcontactofsdrobj.hxx>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <vcl/outdev.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/sdr/contact/objectcontact.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <drawinglayer/primitive2d/markerarrayprimitive2d.hxx>
+#include <svx/sdr/contact/objectcontactofpageview.hxx>
+#include <svx/sdrpagewindow.hxx>
+#include <svx/sdrpaintwindow.hxx>
+#include <svx/sdr/primitive2d/sdrprimitivetools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ // Create a Object-Specific ViewObjectContact, set ViewContact and
+ // ObjectContact. Always needs to return something.
+ ViewObjectContact& ViewContactOfSdrObj::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
+ {
+ ViewObjectContact* pRetval = new ViewObjectContactOfSdrObj(rObjectContact, *this);
+ DBG_ASSERT(pRetval, "ViewContactOfSdrObj::CreateObjectSpecificViewObjectContact() failed (!)");
+
+ return *pRetval;
+ }
+
+ ViewContactOfSdrObj::ViewContactOfSdrObj(SdrObject& rObj)
+ : ViewContact(),
+ mrObject(rObj),
+ meRememberedAnimationKind(SDRTEXTANI_NONE)
+ {
+ // init AnimationKind
+ if(GetSdrObject().ISA(SdrTextObj))
+ {
+ SdrTextObj& rTextObj = (SdrTextObj&)GetSdrObject();
+ meRememberedAnimationKind = rTextObj.GetTextAniKind();
+ }
+ }
+
+ ViewContactOfSdrObj::~ViewContactOfSdrObj()
+ {
+ }
+
+ // Access to possible sub-hierarchy
+ sal_uInt32 ViewContactOfSdrObj::GetObjectCount() const
+ {
+ if(GetSdrObject().GetSubList())
+ {
+ return GetSdrObject().GetSubList()->GetObjCount();
+ }
+
+ return 0L;
+ }
+
+ ViewContact& ViewContactOfSdrObj::GetViewContact(sal_uInt32 nIndex) const
+ {
+ DBG_ASSERT(GetSdrObject().GetSubList(),
+ "ViewContactOfSdrObj::GetViewContact: Access to non-existent Sub-List (!)");
+ SdrObject* pObj = GetSdrObject().GetSubList()->GetObj(nIndex);
+ DBG_ASSERT(pObj, "ViewContactOfSdrObj::GetViewContact: Corrupt SdrObjList (!)");
+ return pObj->GetViewContact();
+ }
+
+ ViewContact* ViewContactOfSdrObj::GetParentContact() const
+ {
+ ViewContact* pRetval = 0L;
+ SdrObjList* pObjList = GetSdrObject().GetObjList();
+
+ if(pObjList)
+ {
+ if(pObjList->ISA(SdrPage))
+ {
+ // Is a page
+ pRetval = &(((SdrPage*)pObjList)->GetViewContact());
+ }
+ else
+ {
+ // Is a group?
+ if(pObjList->GetOwnerObj())
+ {
+ pRetval = &(pObjList->GetOwnerObj()->GetViewContact());
+ }
+ }
+ }
+
+ return pRetval;
+ }
+
+ // React on changes of the object of this ViewContact
+ void ViewContactOfSdrObj::ActionChanged()
+ {
+ // look for own changes
+ if(GetSdrObject().ISA(SdrTextObj))
+ {
+ SdrTextObj& rTextObj = (SdrTextObj&)GetSdrObject();
+
+ if(rTextObj.GetTextAniKind() != meRememberedAnimationKind)
+ {
+ // #i38135# now remember new type
+ meRememberedAnimationKind = rTextObj.GetTextAniKind();
+ }
+ }
+
+ // call parent
+ ViewContact::ActionChanged();
+ }
+
+ // overload for acessing the SdrObject
+ SdrObject* ViewContactOfSdrObj::TryToGetSdrObject() const
+ {
+ return &GetSdrObject();
+ }
+
+ //////////////////////////////////////////////////////////////////////////////
+ // primitive stuff
+
+ // add Gluepoints (if available)
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrObj::createGluePointPrimitive2DSequence() const
+ {
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+ const SdrGluePointList* pGluePointList = GetSdrObject().GetGluePointList();
+
+ if(pGluePointList)
+ {
+ const sal_uInt32 nCount(pGluePointList->GetCount());
+
+ if(nCount)
+ {
+ // prepare point vector
+ std::vector< basegfx::B2DPoint > aGluepointVector;
+
+ // create GluePoint primitives. ATM these are relative to the SnapRect
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ const SdrGluePoint& rCandidate = (*pGluePointList)[(sal_uInt16)a];
+ const Point aPosition(rCandidate.GetAbsolutePos(GetSdrObject()));
+
+ aGluepointVector.push_back(basegfx::B2DPoint(aPosition.X(), aPosition.Y()));
+ }
+
+ if(aGluepointVector.size())
+ {
+ const basegfx::BColor aBackPen(1.0, 1.0, 1.0);
+ const basegfx::BColor aRGBFrontColor(0.0, 0.0, 1.0); // COL_LIGHTBLUE
+ const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::MarkerArrayPrimitive2D(
+ aGluepointVector,
+ drawinglayer::primitive2d::createDefaultGluepoint_7x7(aBackPen, aRGBFrontColor)));
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+ }
+ }
+
+ return xRetval;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
new file mode 100644
index 000000000000..5ddd74004461
--- /dev/null
+++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
@@ -0,0 +1,241 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/contact/viewcontactofsdrobjcustomshape.hxx>
+#include <svx/svdoashp.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <svx/svditer.hxx>
+#include <svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <svx/obj3d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewContactOfSdrObjCustomShape::ViewContactOfSdrObjCustomShape(SdrObjCustomShape& rCustomShape)
+ : ViewContactOfTextObj(rCustomShape)
+ {
+ }
+
+ ViewContactOfSdrObjCustomShape::~ViewContactOfSdrObjCustomShape()
+ {
+ }
+
+ 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;
+ const SfxItemSet& rItemSet = GetCustomShapeObj().GetMergedItemSet();
+
+ // #i98072# Get shandow and text; eventually suppress the text if it's
+ // a TextPath FontworkGallery object
+ const drawinglayer::attribute::SdrShadowTextAttribute aAttribute(
+ drawinglayer::primitive2d::createNewSdrShadowTextAttribute(
+ rItemSet,
+ GetCustomShapeObj().getText(0),
+ GetCustomShapeObj().IsTextPath()));
+ drawinglayer::primitive2d::Primitive2DSequence xGroup;
+ bool bHasText(!aAttribute.getText().isDefault());
+
+ // create Primitive2DSequence from sub-geometry
+ const SdrObject* pSdrObjRepresentation = GetCustomShapeObj().GetSdrObjectFromCustomShape();
+ bool b3DShape(false);
+
+ if(pSdrObjRepresentation)
+ {
+ SdrObjListIter aIterator(*pSdrObjRepresentation);
+
+ while(aIterator.IsMore())
+ {
+ SdrObject& rCandidate = *aIterator.Next();
+
+ if(!b3DShape && dynamic_cast< E3dObject* >(&rCandidate))
+ {
+ b3DShape = true;
+ }
+
+ const drawinglayer::primitive2d::Primitive2DSequence xNew(rCandidate.GetViewContact().getViewIndependentPrimitive2DSequence());
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xGroup, xNew);
+ }
+ }
+
+ if(bHasText || xGroup.hasElements())
+ {
+ // prepare text box geometry
+ 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
+ const Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect());
+ const basegfx::B2DRange aObjectRange(aObjectBound.Left(), aObjectBound.Top(), aObjectBound.Right(), aObjectBound.Bottom());
+
+ // #i101684# get the text range unrotated and absolute to the object range
+ const basegfx::B2DRange aTextRange(getCorrectedTextBoundRect());
+
+ // 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(aObjectRange != aTextRange)
+ {
+ // move relative to unrotated object range
+ aTextBoxMatrix.translate(
+ aTextRange.getMinX() - aObjectRange.getMinimum().getX(),
+ aTextRange.getMinY() - aObjectRange.getMinimum().getY());
+ }
+
+ if(!basegfx::fTools::equalZero(fExtraTextRotation))
+ {
+ basegfx::B2DVector aTranslation(
+ ( aTextRange.getWidth() / 2 ) + ( aTextRange.getMinX() - aObjectRange.getMinimum().getX() ),
+ ( aTextRange.getHeight() / 2 ) + ( aTextRange.getMinY() - aObjectRange.getMinimum().getY() ) );
+ aTextBoxMatrix.translate( -aTranslation.getX(), -aTranslation.getY() );
+ aTextBoxMatrix.rotate((360.0 - fExtraTextRotation) * F_PI180);
+ aTextBoxMatrix.translate( aTranslation.getX(), aTranslation.getY() );
+ }
+
+ if(rGeoStat.nShearWink)
+ {
+ aTextBoxMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000));
+ }
+
+ if(rGeoStat.nDrehWink)
+ {
+ aTextBoxMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000);
+ }
+
+ // give text it's target position
+ aTextBoxMatrix.translate(aObjectRange.getMinimum().getX(), aObjectRange.getMinimum().getY());
+ }
+ else
+ {
+ aTextBoxMatrix.translate(aTextRange.getMinX(), aTextRange.getMinY());
+ }
+
+ // check if SdrTextWordWrapItem is set
+ bWordWrap = ((SdrTextWordWrapItem&)(GetCustomShapeObj().GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue();
+ }
+
+ // create primitive
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::SdrCustomShapePrimitive2D(
+ aAttribute,
+ xGroup,
+ aTextBoxMatrix,
+ bWordWrap,
+ b3DShape,
+ false)); // #SJ# New parameter to force to clipped BlockText for SC
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+
+ // always append an invisible outline for the cases where no visible content exists
+ const Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect());
+ const basegfx::B2DRange aObjectRange(
+ aObjectBound.Left(), aObjectBound.Top(),
+ aObjectBound.Right(), aObjectBound.Bottom());
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval,
+ drawinglayer::primitive2d::createHiddenGeometryPrimitives2D(
+ false, aObjectRange));
+
+ return xRetval;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
new file mode 100644
index 000000000000..b88578113c5d
--- /dev/null
+++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
@@ -0,0 +1,130 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/viewcontactofsdrole2obj.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/sdr/contact/viewobjectcontactofsdrole2obj.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/primitive2d/sdrole2primitive2d.hxx>
+#include <drawinglayer/primitive2d/graphicprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
+#include <svtools/colorcfg.hxx>
+#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <vcl/svapp.hxx>
+#include <svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ // Create a Object-Specific ViewObjectContact, set ViewContact and
+ // ObjectContact. Always needs to return something.
+ ViewObjectContact& ViewContactOfSdrOle2Obj::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
+ {
+ ViewObjectContact* pRetval = new ViewObjectContactOfSdrOle2Obj(rObjectContact, *this);
+ DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
+
+ return *pRetval;
+ }
+
+ ViewContactOfSdrOle2Obj::ViewContactOfSdrOle2Obj(SdrOle2Obj& rOle2Obj)
+ : ViewContactOfSdrRectObj(rOle2Obj)
+ {
+ }
+
+ ViewContactOfSdrOle2Obj::~ViewContactOfSdrOle2Obj()
+ {
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createPrimitive2DSequenceWithParameters(
+ bool bHighContrast) const
+ {
+ // take unrotated snap rect (direct model data) for position and size
+ const Rectangle& rRectangle = GetOle2Obj().GetGeoRect();
+ const basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom());
+
+ // create object matrix
+ const GeoStat& rGeoStat(GetOle2Obj().GetGeoStat());
+ const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0);
+ const double fRotate(rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0);
+ const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ aObjectRange.getWidth(), aObjectRange.getHeight(), fShearX, fRotate,
+ aObjectRange.getMinX(), aObjectRange.getMinY()));
+
+ // Prepare attribute settings, will be used soon anyways
+ const SfxItemSet& rItemSet = GetOle2Obj().GetMergedItemSet();
+ const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
+ rItemSet,
+ GetOle2Obj().getText(0)));
+
+ // #i102063# embed OLE content in an own primitive; this will be able to decompose accessing
+ // the weak SdrOle2 reference and will also implement getB2DRange() for fast BoundRect
+ // calculations without OLE Graphic access (which may trigger e.g. chart recalculation).
+ // It will also take care of HighContrast and ScaleContent
+ const drawinglayer::primitive2d::Primitive2DReference xOleContent(
+ new drawinglayer::primitive2d::SdrOleContentPrimitive2D(
+ GetOle2Obj(),
+ aObjectMatrix,
+
+ // #i104867# add GraphicVersion number to be able to check for
+ // content change in the primitive later
+ GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion(),
+
+ bHighContrast));
+
+ // create primitive. Use Ole2 primitive here. Prepare attribute settings, will
+ // be used soon anyways. Always create primitives to allow the decomposition of
+ // SdrOle2Primitive2D to create needed invisible elements for HitTest and/or BoundRect
+ const drawinglayer::primitive2d::Primitive2DSequence xOLEContent(&xOleContent, 1);
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::SdrOle2Primitive2D(
+ xOLEContent,
+ aObjectMatrix,
+ aAttribute));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createViewIndependentPrimitive2DSequence() const
+ {
+ // do as if no HC and call standard creator
+ return createPrimitive2DSequenceWithParameters(false);
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx
new file mode 100644
index 000000000000..abe30839aa43
--- /dev/null
+++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx
@@ -0,0 +1,726 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/contact/viewcontactofsdrpage.hxx>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/sdr/contact/viewobjectcontactofsdrpage.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdview.hxx>
+#include <vcl/svapp.hxx>
+#include <svx/sdr/contact/objectcontact.hxx>
+#include <drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
+#include <vcl/lazydelete.hxx>
+#include <svx/svdstr.hrc>
+#include <svx/svdglob.hxx>
+#include <drawinglayer/primitive2d/discreteshadowprimitive2d.hxx>
+#include <drawinglayer/attribute/sdrfillattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+#define PAPER_SHADOW(SIZE) (SIZE >> 8)
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewContactOfPageSubObject::ViewContactOfPageSubObject(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
+ : mrParentViewContactOfSdrPage(rParentViewContactOfSdrPage)
+ {
+ }
+
+ ViewContactOfPageSubObject::~ViewContactOfPageSubObject()
+ {
+ }
+
+ ViewContact* ViewContactOfPageSubObject::GetParentContact() const
+ {
+ return &mrParentViewContactOfSdrPage;
+ }
+
+ const SdrPage& ViewContactOfPageSubObject::getPage() const
+ {
+ return mrParentViewContactOfSdrPage.GetSdrPage();
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewObjectContact& ViewContactOfPageBackground::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
+ {
+ ViewObjectContact* pRetval = new ViewObjectContactOfPageBackground(rObjectContact, *this);
+ DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
+
+ return *pRetval;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageBackground::createViewIndependentPrimitive2DSequence() const
+ {
+ // We have only the page information, not the view information. Use the
+ // svtools::DOCCOLOR color for initialisation
+ const svtools::ColorConfig aColorConfig;
+ const Color aInitColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
+ const basegfx::BColor aRGBColor(aInitColor.getBColor());
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+
+ ViewContactOfPageBackground::ViewContactOfPageBackground(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
+ : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
+ {
+ }
+
+ ViewContactOfPageBackground::~ViewContactOfPageBackground()
+ {
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewObjectContact& ViewContactOfPageShadow::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
+ {
+ ViewObjectContact* pRetval = new ViewObjectContactOfPageShadow(rObjectContact, *this);
+ DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
+
+ return *pRetval;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageShadow::createViewIndependentPrimitive2DSequence() const
+ {
+ static bool bUseOldPageShadow(false);
+ const SdrPage& rPage = getPage();
+ basegfx::B2DHomMatrix aPageMatrix;
+ aPageMatrix.set(0, 0, (double)rPage.GetWdt());
+ aPageMatrix.set(1, 1, (double)rPage.GetHgt());
+
+ if(bUseOldPageShadow)
+ {
+ // create page shadow polygon
+ const double fPageBorderFactor(1.0 / 256.0);
+ basegfx::B2DPolygon aPageShadowPolygon;
+ aPageShadowPolygon.append(basegfx::B2DPoint(1.0, fPageBorderFactor));
+ aPageShadowPolygon.append(basegfx::B2DPoint(1.0 + fPageBorderFactor, fPageBorderFactor));
+ aPageShadowPolygon.append(basegfx::B2DPoint(1.0 + fPageBorderFactor, 1.0 + fPageBorderFactor));
+ aPageShadowPolygon.append(basegfx::B2DPoint(fPageBorderFactor, 1.0 + fPageBorderFactor));
+ aPageShadowPolygon.append(basegfx::B2DPoint(fPageBorderFactor, 1.0));
+ aPageShadowPolygon.append(basegfx::B2DPoint(1.0, 1.0));
+ aPageShadowPolygon.setClosed(true);
+ aPageShadowPolygon.transform(aPageMatrix);
+
+ // We have only the page information, not the view information. Use the
+ // svtools::FONTCOLOR color for initialisation
+ const svtools::ColorConfig aColorConfig;
+ const Color aShadowColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
+ const basegfx::BColor aRGBShadowColor(aShadowColor.getBColor());
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
+ basegfx::B2DPolyPolygon(aPageShadowPolygon),
+ aRGBShadowColor));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+ else
+ {
+ static vcl::DeleteOnDeinit<drawinglayer::primitive2d::DiscreteShadow>
+ aDiscreteShadow(new drawinglayer::primitive2d::DiscreteShadow(
+ BitmapEx(ResId(SIP_SA_PAGESHADOW35X35, *ImpGetResMgr()))));
+ if (aDiscreteShadow.get() != NULL)
+ {
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::DiscreteShadowPrimitive2D(
+ aPageMatrix,
+ *aDiscreteShadow.get()));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+ return drawinglayer::primitive2d::Primitive2DSequence();
+ }
+ }
+
+ ViewContactOfPageShadow::ViewContactOfPageShadow(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
+ : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
+ {
+ }
+
+ ViewContactOfPageShadow::~ViewContactOfPageShadow()
+ {
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewObjectContact& ViewContactOfMasterPage::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
+ {
+ ViewObjectContact* pRetval = new ViewObjectContactOfMasterPage(rObjectContact, *this);
+ DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
+
+ return *pRetval;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfMasterPage::createViewIndependentPrimitive2DSequence() const
+ {
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+
+ // this class is used when the page is a MasterPage and is responsible to
+ // create a visualisation for the MPBGO, if exists. This needs to be suppressed
+ // when a SdrPage which uses a MasterPage creates it's output. Suppression
+ // is done in the corresponding VOC since DisplayInfo data is needed
+ const SdrPage& rPage = getPage();
+
+ if(rPage.IsMasterPage())
+ {
+ if(0 == rPage.GetPageNum())
+ {
+ // #i98063#
+ // filter MasterPage 0 since it's the HandoutPage. Thus, it's a
+ // MasterPage, but has no MPBGO, so there is nothing to do here.
+ }
+ else
+ {
+ drawinglayer::attribute::SdrFillAttribute aFill;
+
+ // #i110846# Suppress SdrPage FillStyle for MasterPages without StyleSheets,
+ // else the PoolDefault (XFILL_COLOR and Blue8) will be used. Normally, all
+ // MasterPages should have a StyleSheet excactly for this reason, but historically
+ // e.g. the Notes MasterPage has no StyleSheet set (and there maybe others).
+ if(rPage.getSdrPageProperties().GetStyleSheet())
+ {
+ // create page fill attributes with correct properties
+ aFill = drawinglayer::primitive2d::createNewSdrFillAttribute(
+ rPage.getSdrPageProperties().GetItemSet());
+ }
+
+ if(!aFill.isDefault())
+ {
+ // direct model data is the page size, get and use it
+ const basegfx::B2DRange aInnerRange(
+ rPage.GetLftBorder(), rPage.GetUppBorder(),
+ rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder());
+ const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange));
+ const basegfx::B2DHomMatrix aEmptyTransform;
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
+ basegfx::B2DPolyPolygon(aInnerPolgon),
+ aEmptyTransform,
+ aFill,
+ drawinglayer::attribute::FillGradientAttribute()));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+ }
+ }
+
+ return xRetval;
+ }
+
+ ViewContactOfMasterPage::ViewContactOfMasterPage(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
+ : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
+ {
+ }
+
+ ViewContactOfMasterPage::~ViewContactOfMasterPage()
+ {
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewObjectContact& ViewContactOfPageFill::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
+ {
+ ViewObjectContact* pRetval = new ViewObjectContactOfPageFill(rObjectContact, *this);
+ DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
+
+ return *pRetval;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageFill::createViewIndependentPrimitive2DSequence() const
+ {
+ const SdrPage& rPage = getPage();
+ const basegfx::B2DRange aPageFillRange(0.0, 0.0, (double)rPage.GetWdt(), (double)rPage.GetHgt());
+ const basegfx::B2DPolygon aPageFillPolygon(basegfx::tools::createPolygonFromRect(aPageFillRange));
+
+ // We have only the page information, not the view information. Use the
+ // svtools::DOCCOLOR color for initialisation
+ const svtools::ColorConfig aColorConfig;
+ const Color aPageFillColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
+
+ // create and add primitive
+ const basegfx::BColor aRGBColor(aPageFillColor.getBColor());
+ const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPageFillPolygon), aRGBColor));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+
+ ViewContactOfPageFill::ViewContactOfPageFill(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
+ : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
+ {
+ }
+
+ ViewContactOfPageFill::~ViewContactOfPageFill()
+ {
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewObjectContact& ViewContactOfOuterPageBorder::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
+ {
+ ViewObjectContact* pRetval = new ViewObjectContactOfOuterPageBorder(rObjectContact, *this);
+ DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
+
+ return *pRetval;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfOuterPageBorder::createViewIndependentPrimitive2DSequence() const
+ {
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+ const SdrPage& rPage = getPage();
+ const basegfx::B2DRange aPageBorderRange(0.0, 0.0, (double)rPage.GetWdt(), (double)rPage.GetHgt());
+
+ // Changed to 0x949599 for renaissance, before svtools::FONTCOLOR was used.
+ // Added old case as fallback for HighContrast.
+ basegfx::BColor aRGBBorderColor(0x94 / (double)0xff, 0x95 / (double)0xff, 0x99 / (double)0xff);
+
+ if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
+ {
+ const svtools::ColorConfig aColorConfig;
+ const Color aBorderColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
+
+ aRGBBorderColor = aBorderColor.getBColor();
+ }
+
+ if(rPage.getPageBorderOnlyLeftRight())
+ {
+ // #i93597# for Report Designer, the page border shall be only displayed right and left,
+ // but not top and bottom. Create simplified geometry.
+ basegfx::B2DPolygon aLeft, aRight;
+
+ aLeft.append(basegfx::B2DPoint(aPageBorderRange.getMinX(), aPageBorderRange.getMinY()));
+ aLeft.append(basegfx::B2DPoint(aPageBorderRange.getMinX(), aPageBorderRange.getMaxY()));
+
+ aRight.append(basegfx::B2DPoint(aPageBorderRange.getMaxX(), aPageBorderRange.getMinY()));
+ aRight.append(basegfx::B2DPoint(aPageBorderRange.getMaxX(), aPageBorderRange.getMaxY()));
+
+ xRetval.realloc(2);
+ xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aLeft, aRGBBorderColor));
+ xRetval[1] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aRight, aRGBBorderColor));
+ }
+ else
+ {
+ xRetval.realloc(1);
+ const basegfx::B2DPolygon aPageBorderPolygon(basegfx::tools::createPolygonFromRect(aPageBorderRange));
+ xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aPageBorderPolygon, aRGBBorderColor));
+ }
+
+ return xRetval;
+ }
+
+ ViewContactOfOuterPageBorder::ViewContactOfOuterPageBorder(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
+ : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
+ {
+ }
+
+ ViewContactOfOuterPageBorder::~ViewContactOfOuterPageBorder()
+ {
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewObjectContact& ViewContactOfInnerPageBorder::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
+ {
+ ViewObjectContact* pRetval = new ViewObjectContactOfInnerPageBorder(rObjectContact, *this);
+ DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
+
+ return *pRetval;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfInnerPageBorder::createViewIndependentPrimitive2DSequence() const
+ {
+ const SdrPage& rPage = getPage();
+ const basegfx::B2DRange aPageBorderRange(
+ (double)rPage.GetLftBorder(), (double)rPage.GetUppBorder(),
+ (double)(rPage.GetWdt() - rPage.GetRgtBorder()), (double)(rPage.GetHgt() - rPage.GetLwrBorder()));
+ const basegfx::B2DPolygon aPageBorderPolygon(basegfx::tools::createPolygonFromRect(aPageBorderRange));
+
+ // We have only the page information, not the view information. Use the
+ // svtools::FONTCOLOR or svtools::DOCBOUNDARIES color for initialisation
+ const svtools::ColorConfig aColorConfig;
+ Color aBorderColor;
+
+ if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
+ {
+ aBorderColor = aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor;
+ }
+ else
+ {
+ aBorderColor = aColorConfig.GetColorValue(svtools::DOCBOUNDARIES).nColor;
+ }
+
+ // create page outer border primitive
+ const basegfx::BColor aRGBBorderColor(aBorderColor.getBColor());
+ const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aPageBorderPolygon, aRGBBorderColor));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+
+ ViewContactOfInnerPageBorder::ViewContactOfInnerPageBorder(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
+ : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
+ {
+ }
+
+ ViewContactOfInnerPageBorder::~ViewContactOfInnerPageBorder()
+ {
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewObjectContact& ViewContactOfPageHierarchy::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
+ {
+ ViewObjectContact* pRetval = new ViewObjectContactOfPageHierarchy(rObjectContact, *this);
+ DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
+
+ return *pRetval;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageHierarchy::createViewIndependentPrimitive2DSequence() const
+ {
+ // collect sub-hierarchy
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+ const sal_uInt32 nObjectCount(GetObjectCount());
+
+ // collect all sub-primitives
+ for(sal_uInt32 a(0); a < nObjectCount; a++)
+ {
+ const ViewContact& rCandidate(GetViewContact(a));
+ const drawinglayer::primitive2d::Primitive2DSequence aCandSeq(rCandidate.getViewIndependentPrimitive2DSequence());
+
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, aCandSeq);
+ }
+
+ return xRetval;
+ }
+
+ ViewContactOfPageHierarchy::ViewContactOfPageHierarchy(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
+ : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
+ {
+ }
+
+ ViewContactOfPageHierarchy::~ViewContactOfPageHierarchy()
+ {
+ }
+
+ sal_uInt32 ViewContactOfPageHierarchy::GetObjectCount() const
+ {
+ return getPage().GetObjCount();
+ }
+
+ ViewContact& ViewContactOfPageHierarchy::GetViewContact(sal_uInt32 nIndex) const
+ {
+ SdrObject* pObj = getPage().GetObj(nIndex);
+ DBG_ASSERT(pObj, "ViewContactOfPageHierarchy::GetViewContact: Corrupt SdrObjList (!)");
+ return pObj->GetViewContact();
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewObjectContact& ViewContactOfGrid::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
+ {
+ ViewObjectContact* pRetval = new ViewObjectContactOfPageGrid(rObjectContact, *this);
+ DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
+
+ return *pRetval;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGrid::createViewIndependentPrimitive2DSequence() const
+ {
+ // We have only the page information, not the view information and thus no grid settings. Create empty
+ // default. For the view-dependent implementation, see ViewObjectContactOfPageGrid::createPrimitive2DSequence
+ return drawinglayer::primitive2d::Primitive2DSequence();
+ }
+
+ ViewContactOfGrid::ViewContactOfGrid(ViewContactOfSdrPage& rParentViewContactOfSdrPage, bool bFront)
+ : ViewContactOfPageSubObject(rParentViewContactOfSdrPage),
+ mbFront(bFront)
+ {
+ }
+
+ ViewContactOfGrid::~ViewContactOfGrid()
+ {
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewObjectContact& ViewContactOfHelplines::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
+ {
+ ViewObjectContact* pRetval = new ViewObjectContactOfPageHelplines(rObjectContact, *this);
+ DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
+
+ return *pRetval;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfHelplines::createViewIndependentPrimitive2DSequence() const
+ {
+ // We have only the page information, not the view information and thus no helplines. Create empty
+ // default. For the view-dependent implementation, see ViewObjectContactOfPageHelplines::createPrimitive2DSequence
+ return drawinglayer::primitive2d::Primitive2DSequence();
+ }
+
+ ViewContactOfHelplines::ViewContactOfHelplines(ViewContactOfSdrPage& rParentViewContactOfSdrPage, bool bFront)
+ : ViewContactOfPageSubObject(rParentViewContactOfSdrPage),
+ mbFront(bFront)
+ {
+ }
+
+ ViewContactOfHelplines::~ViewContactOfHelplines()
+ {
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ // Create a Object-Specific ViewObjectContact, set ViewContact and
+ // ObjectContact. Always needs to return something.
+ ViewObjectContact& ViewContactOfSdrPage::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
+ {
+ ViewObjectContact* pRetval = new ViewObjectContactOfSdrPage(rObjectContact, *this);
+ DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
+
+ return *pRetval;
+ }
+
+ ViewContactOfSdrPage::ViewContactOfSdrPage(SdrPage& rPage)
+ : ViewContact(),
+ mrPage(rPage),
+ maViewContactOfPageBackground(*this),
+ maViewContactOfPageShadow(*this),
+ maViewContactOfPageFill(*this),
+ maViewContactOfMasterPage(*this),
+ maViewContactOfOuterPageBorder(*this),
+ maViewContactOfInnerPageBorder(*this),
+ maViewContactOfGridBack(*this, false),
+ maViewContactOfHelplinesBack(*this, false),
+ maViewContactOfPageHierarchy(*this),
+ maViewContactOfGridFront(*this, true),
+ maViewContactOfHelplinesFront(*this, true)
+ {
+ }
+
+ ViewContactOfSdrPage::~ViewContactOfSdrPage()
+ {
+ }
+
+ // Access to possible sub-hierarchy
+ sal_uInt32 ViewContactOfSdrPage::GetObjectCount() const
+ {
+ // Fixed count of content. It contains PageBackground (Wiese), PageShadow, PageFill,
+ // then - depending on if the page has a MasterPage - either MasterPage Hierarchy
+ // or MPBGO. Also OuterPageBorder, InnerPageBorder and two pairs of Grid and Helplines
+ // (for front and back) which internally are visible or not depending on the current
+ // front/back setting for those.
+ return 11;
+ }
+
+ ViewContact& ViewContactOfSdrPage::GetViewContact(sal_uInt32 nIndex) const
+ {
+ switch(nIndex)
+ {
+ case 0: return (ViewContact&)maViewContactOfPageBackground;
+ case 1: return (ViewContact&)maViewContactOfPageShadow;
+ case 2: return (ViewContact&)maViewContactOfPageFill;
+ case 3:
+ {
+ const SdrPage& rPage = GetSdrPage();
+
+ if(rPage.TRG_HasMasterPage())
+ {
+ return rPage.TRG_GetMasterPageDescriptorViewContact();
+ }
+ else
+ {
+ return (ViewContact&)maViewContactOfMasterPage;
+ }
+ }
+ case 4: return (ViewContact&)maViewContactOfOuterPageBorder;
+ case 5: return (ViewContact&)maViewContactOfInnerPageBorder;
+ case 6: return (ViewContact&)maViewContactOfGridBack;
+ case 7: return (ViewContact&)maViewContactOfHelplinesBack;
+ case 8: return (ViewContact&)maViewContactOfPageHierarchy;
+ case 9: return (ViewContact&)maViewContactOfGridFront;
+ default: return (ViewContact&)maViewContactOfHelplinesFront;
+ }
+ }
+
+ // React on changes of the object of this ViewContact
+ void ViewContactOfSdrPage::ActionChanged()
+ {
+ // call parent
+ ViewContact::ActionChanged();
+
+ // apply to local viewContacts, they all rely on page information. Exception
+ // is the sub hierarchy; this will not be influenced by the change
+ maViewContactOfPageBackground.ActionChanged();
+ maViewContactOfPageShadow.ActionChanged();
+ maViewContactOfPageFill.ActionChanged();
+
+ const SdrPage& rPage = GetSdrPage();
+
+ if(rPage.TRG_HasMasterPage())
+ {
+ rPage.TRG_GetMasterPageDescriptorViewContact().ActionChanged();
+ }
+ else if(rPage.IsMasterPage())
+ {
+ maViewContactOfMasterPage.ActionChanged();
+ }
+
+ maViewContactOfOuterPageBorder.ActionChanged();
+ maViewContactOfInnerPageBorder.ActionChanged();
+ maViewContactOfGridBack.ActionChanged();
+ maViewContactOfHelplinesBack.ActionChanged();
+ maViewContactOfGridFront.ActionChanged();
+ maViewContactOfHelplinesFront.ActionChanged();
+ }
+
+ // overload for acessing the SdrPage
+ SdrPage* ViewContactOfSdrPage::TryToGetSdrPage() const
+ {
+ return &GetSdrPage();
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrPage::createViewIndependentPrimitive2DSequence() const
+ {
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+
+ // collect all sub-sequences including sub hierarchy.
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageBackground.getViewIndependentPrimitive2DSequence());
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageShadow.getViewIndependentPrimitive2DSequence());
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageFill.getViewIndependentPrimitive2DSequence());
+
+ const SdrPage& rPage = GetSdrPage();
+
+ if(rPage.TRG_HasMasterPage())
+ {
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval,
+ rPage.TRG_GetMasterPageDescriptorViewContact().getViewIndependentPrimitive2DSequence());
+ }
+ else if(rPage.IsMasterPage())
+ {
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval,
+ maViewContactOfMasterPage.getViewIndependentPrimitive2DSequence());
+ }
+
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfOuterPageBorder.getViewIndependentPrimitive2DSequence());
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfInnerPageBorder.getViewIndependentPrimitive2DSequence());
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageHierarchy.getViewIndependentPrimitive2DSequence());
+
+ // Only add front versions of grid and helplines since no visibility test is done,
+ // so adding the back incarnations is not necessary. This makes the Front
+ // visualisation the default when no visibility tests are done.
+ //
+ // Since we have no view here, no grid and helpline definitions are available currently. The used
+ // methods at ViewContactOfHelplines and ViewContactOfGrid return only empty sequences and
+ // do not need to be called ATM. This may change later if grid or helpline info gets
+ // model data (it should not). Keeping the lines commented to hold this hint.
+ //
+ // drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfGridFront.getViewIndependentPrimitive2DSequence());
+ // drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfHelplinesFront.getViewIndependentPrimitive2DSequence());
+
+ return xRetval;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
new file mode 100644
index 000000000000..bc4c500ff155
--- /dev/null
+++ b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/viewcontactofsdrpathobj.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <svx/sdr/primitive2d/sdrpathprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewContactOfSdrPathObj::ViewContactOfSdrPathObj(SdrPathObj& rPathObj)
+ : ViewContactOfTextObj(rPathObj)
+ {
+ }
+
+ ViewContactOfSdrPathObj::~ViewContactOfSdrPathObj()
+ {
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrPathObj::createViewIndependentPrimitive2DSequence() const
+ {
+ const SfxItemSet& rItemSet = GetPathObj().GetMergedItemSet();
+ const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
+ rItemSet,
+ GetPathObj().getText(0)));
+ basegfx::B2DPolyPolygon aUnitPolyPolygon(GetPathObj().GetPathPoly());
+ sal_uInt32 nPolyCount(aUnitPolyPolygon.count());
+ sal_uInt32 nPointCount(0);
+
+ for(sal_uInt32 a(0); a < nPolyCount; a++)
+ {
+ nPointCount += aUnitPolyPolygon.getB2DPolygon(a).count();
+ }
+
+ if(!nPointCount)
+ {
+ OSL_ENSURE(false, "PolyPolygon object without geometry detected, this should not be created (!)");
+ basegfx::B2DPolygon aFallbackLine;
+ aFallbackLine.append(basegfx::B2DPoint(0.0, 0.0));
+ aFallbackLine.append(basegfx::B2DPoint(1000.0, 1000.0));
+ aUnitPolyPolygon = basegfx::B2DPolyPolygon(aFallbackLine);
+
+ nPolyCount = 1;
+ }
+
+ // 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 = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ aLine.getLength(), 1.0,
+ 0.0,
+ atan2(aLine.getY(), aLine.getX()),
+ 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());
+ const double fScaleX(basegfx::fTools::equalZero(fWidth) ? 1.0 : fWidth);
+ const double fScaleY(basegfx::fTools::equalZero(fHeight) ? 1.0 : fHeight);
+
+ aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ fScaleX, fScaleY,
+ rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0,
+ rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0,
+ aObjectRange.getMinX(), aObjectRange.getMinY());
+
+ // ceate unit polygon from object's absolute path
+ basegfx::B2DHomMatrix aInverse(aObjectMatrix);
+ aInverse.invert();
+ aUnitPolyPolygon.transform(aInverse);
+ }
+
+ // create primitive. Always create primitives to allow the decomposition of
+ // SdrPathPrimitive2D to create needed invisible elements for HitTest and/or BoundRect
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::SdrPathPrimitive2D(
+ aObjectMatrix,
+ aAttribute,
+ aUnitPolyPolygon));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx
new file mode 100644
index 000000000000..fdbfa16dd584
--- /dev/null
+++ b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/viewcontactofsdrrectobj.hxx>
+#include <svx/svdorect.hxx>
+#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx>
+#include <svl/itemset.hxx>
+#include <svx/sdr/primitive2d/sdrprimitivetools.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <svx/svdmodel.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewContactOfSdrRectObj::ViewContactOfSdrRectObj(SdrRectObj& rRectObj)
+ : ViewContactOfTextObj(rRectObj)
+ {
+ }
+
+ ViewContactOfSdrRectObj::~ViewContactOfSdrRectObj()
+ {
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrRectObj::createViewIndependentPrimitive2DSequence() const
+ {
+ const SfxItemSet& rItemSet = GetRectObj().GetMergedItemSet();
+ const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute(
+ drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
+ rItemSet,
+ GetRectObj().getText(0)));
+
+ // take unrotated snap rect (direct model data) for position and size
+ const Rectangle& rRectangle = GetRectObj().GetGeoRect();
+ const ::basegfx::B2DRange aObjectRange(
+ rRectangle.Left(), rRectangle.Top(),
+ rRectangle.Right(), rRectangle.Bottom());
+ const GeoStat& rGeoStat(GetRectObj().GetGeoStat());
+
+ // fill object matrix
+ basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ aObjectRange.getWidth(), aObjectRange.getHeight(),
+ rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0,
+ rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0,
+ aObjectRange.getMinX(), aObjectRange.getMinY()));
+
+ // calculate corner radius
+ sal_uInt32 nCornerRadius(((SdrEckenradiusItem&)(rItemSet.Get(SDRATTR_ECKENRADIUS))).GetValue());
+ double fCornerRadiusX;
+ double fCornerRadiusY;
+ drawinglayer::primitive2d::calculateRelativeCornerRadius(nCornerRadius, aObjectRange, fCornerRadiusX, fCornerRadiusY);
+
+ // #i105856# use knowledge about pickthrough from the model
+ const bool bPickThroughTransparentTextFrames(
+ GetRectObj().GetModel() && GetRectObj().GetModel()->IsPickThroughTransparentTextFrames());
+
+ // create primitive. Always create primitives to allow the decomposition of
+ // SdrRectanglePrimitive2D to create needed invisible elements for HitTest and/or BoundRect
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::SdrRectanglePrimitive2D(
+ aObjectMatrix,
+ aAttribute,
+ fCornerRadiusX,
+ fCornerRadiusY,
+ // #i105856# use fill for HitTest when TextFrame and not PickThrough
+ GetRectObj().IsTextFrame() && !bPickThroughTransparentTextFrames));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewcontactoftextobj.cxx b/svx/source/sdr/contact/viewcontactoftextobj.cxx
new file mode 100644
index 000000000000..bfa7aa41565c
--- /dev/null
+++ b/svx/source/sdr/contact/viewcontactoftextobj.cxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/contact/viewcontactoftextobj.hxx>
+#include <svx/svdotext.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewContactOfTextObj::ViewContactOfTextObj(SdrTextObj& rTextObj)
+ : ViewContactOfSdrObj(rTextObj)
+ {
+ }
+
+ ViewContactOfTextObj::~ViewContactOfTextObj()
+ {
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewcontactofunocontrol.cxx b/svx/source/sdr/contact/viewcontactofunocontrol.cxx
new file mode 100644
index 000000000000..fb57864903d1
--- /dev/null
+++ b/svx/source/sdr/contact/viewcontactofunocontrol.cxx
@@ -0,0 +1,181 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/viewcontactofunocontrol.hxx>
+#include <svx/sdr/contact/viewobjectcontactofunocontrol.hxx>
+#include <svx/sdr/contact/objectcontactofpageview.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/svdouno.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdview.hxx>
+#include <svx/sdrpagewindow.hxx>
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/XWindow2.hpp>
+/** === end UNO includes === **/
+
+#include "svx/sdrpaintwindow.hxx"
+#include <tools/diagnose_ex.h>
+#include <vcl/pdfextoutdevdata.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <drawinglayer/primitive2d/controlprimitive2d.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+
+//........................................................................
+namespace sdr { namespace contact {
+//........................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::awt::XControl;
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::awt::XControlContainer;
+ using ::com::sun::star::awt::XControlModel;
+ using ::com::sun::star::awt::XWindow2;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::Exception;
+ /** === end UNO using === **/
+
+ //====================================================================
+ //= ViewContactOfUnoControl
+ //====================================================================
+ class ViewContactOfUnoControl_Impl
+ {
+ public:
+ ViewContactOfUnoControl_Impl();
+ ~ViewContactOfUnoControl_Impl();
+
+ private:
+ ViewContactOfUnoControl_Impl( const ViewContactOfUnoControl_Impl& ); // never implemented
+ ViewContactOfUnoControl_Impl& operator=( const ViewContactOfUnoControl_Impl& ); // never implemented
+ };
+
+ //--------------------------------------------------------------------
+ ViewContactOfUnoControl_Impl::ViewContactOfUnoControl_Impl()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ ViewContactOfUnoControl_Impl::~ViewContactOfUnoControl_Impl()
+ {
+ }
+
+ //====================================================================
+ //= ViewContactOfUnoControl
+ //====================================================================
+ DBG_NAME( ViewContactOfUnoControl )
+ //--------------------------------------------------------------------
+ ViewContactOfUnoControl::ViewContactOfUnoControl( SdrUnoObj& _rUnoObject )
+ :ViewContactOfSdrObj( _rUnoObject )
+ ,m_pImpl( new ViewContactOfUnoControl_Impl )
+ {
+ DBG_CTOR( ViewContactOfUnoControl, NULL );
+ }
+
+ //--------------------------------------------------------------------
+ ViewContactOfUnoControl::~ViewContactOfUnoControl()
+ {
+ DBG_DTOR( ViewContactOfUnoControl, NULL );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XControl > ViewContactOfUnoControl::getTemporaryControlForWindow(
+ const Window& _rWindow, Reference< XControlContainer >& _inout_ControlContainer ) const
+ {
+ SdrUnoObj* pUnoObject = dynamic_cast< SdrUnoObj* >( TryToGetSdrObject() );
+ OSL_ENSURE( pUnoObject, "ViewContactOfUnoControl::getTemporaryControlForDevice: no SdrUnoObj!" );
+ if ( !pUnoObject )
+ return NULL;
+ return ViewObjectContactOfUnoControl::getTemporaryControlForWindow( _rWindow, _inout_ControlContainer, *pUnoObject );
+ }
+
+ //--------------------------------------------------------------------
+ ViewObjectContact& ViewContactOfUnoControl::CreateObjectSpecificViewObjectContact( ObjectContact& _rObjectContact )
+ {
+ // print or print preview requires special handling
+ const OutputDevice* pDevice = _rObjectContact.TryToGetOutputDevice();
+ bool bPrintOrPreview = ( pDevice != NULL ) && ( pDevice->GetOutDevType() == OUTDEV_PRINTER );
+
+ ObjectContactOfPageView* pPageViewContact = dynamic_cast< ObjectContactOfPageView* >( &_rObjectContact );
+ bPrintOrPreview |= ( pPageViewContact != NULL ) && pPageViewContact->GetPageWindow().GetPageView().GetView().IsPrintPreview();
+
+ if ( bPrintOrPreview )
+ return *new UnoControlPrintOrPreviewContact( *pPageViewContact, *this );
+
+ // all others are nowadays served by the same implementation
+ return *new ViewObjectContactOfUnoControl( _rObjectContact, *this );
+ }
+
+ //--------------------------------------------------------------------
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfUnoControl::createViewIndependentPrimitive2DSequence() const
+ {
+ // create range. Use model data directly, not getBoundRect()/getSnapRect; these will use
+ // the primitive data themselves in the long run. Use SdrUnoObj's (which is a SdrRectObj)
+ // call to GetGeoRect() to access SdrTextObj::aRect directly and without executing anything
+ const Rectangle& rRectangle(GetSdrUnoObj().GetGeoRect());
+ const basegfx::B2DRange aRange(
+ rRectangle.Left(), rRectangle.Top(),
+ rRectangle.Right(), rRectangle.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());
+
+ Reference< XControlModel > xControlModel = GetSdrUnoObj().GetUnoControlModel();
+
+ if(xControlModel.is())
+ {
+ // create control primitive WITHOUT possibly existing XControl; this would be done in
+ // the VOC in createPrimitive2DSequence()
+ const drawinglayer::primitive2d::Primitive2DReference xRetval(
+ new drawinglayer::primitive2d::ControlPrimitive2D(
+ aTransform,
+ xControlModel));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1);
+ }
+ else
+ {
+ // always append an invisible outline for the cases where no visible content exists
+ const drawinglayer::primitive2d::Primitive2DReference xRetval(
+ drawinglayer::primitive2d::createHiddenGeometryPrimitives2D(
+ false, aTransform));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1);
+ }
+ }
+
+//........................................................................
+} } // namespace sdr::contact
+//........................................................................
diff --git a/svx/source/sdr/contact/viewcontactofvirtobj.cxx b/svx/source/sdr/contact/viewcontactofvirtobj.cxx
new file mode 100644
index 000000000000..54d7e6ddae97
--- /dev/null
+++ b/svx/source/sdr/contact/viewcontactofvirtobj.cxx
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/contact/viewcontactofvirtobj.hxx>
+#include <svx/svdovirt.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
+#include <vcl/outdev.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ SdrVirtObj& ViewContactOfVirtObj::GetVirtObj() const
+ {
+ return (SdrVirtObj&)mrObject;
+ }
+
+ ViewContactOfVirtObj::ViewContactOfVirtObj(SdrVirtObj& rObj)
+ : ViewContactOfSdrObj(rObj)
+ {
+ }
+
+ ViewContactOfVirtObj::~ViewContactOfVirtObj()
+ {
+ }
+
+ // Access to possible sub-hierarchy
+ sal_uInt32 ViewContactOfVirtObj::GetObjectCount() const
+ {
+ // Here, SdrVirtObj's need to return 0L to show that they have no
+ // sub-hierarchy, even when they are group objects. This is necessary
+ // to avoid that the same VOCs will be added to the draw hierarchy
+ // twice which leads to problems.
+ //
+ // This solution is only a first solution to get things running. Later
+ // this needs to be replaced with creating real VOCs for the objects
+ // referenced by virtual objects to avoid the 'trick' of setting the
+ // offset for painting at the destination OutputDevive.
+ //
+ // As can be seen, with primitives, the problem will be solved using
+ // a transformPrimitive, so this solution can stay with primitives.
+ return 0L;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfVirtObj::createViewIndependentPrimitive2DSequence() const
+ {
+ // create displacement transformation if we have content
+ basegfx::B2DHomMatrix aObjectMatrix;
+ Point aAnchor(GetVirtObj().GetAnchorPos());
+
+ if(aAnchor.X() || aAnchor.Y())
+ {
+ aObjectMatrix.set(0, 2, aAnchor.X());
+ aObjectMatrix.set(1, 2, aAnchor.Y());
+ }
+
+ // use method from referenced object to get the Primitive2DSequence
+ const drawinglayer::primitive2d::Primitive2DSequence xSequenceVirtual(
+ GetVirtObj().GetReferencedObj().GetViewContact().getViewIndependentPrimitive2DSequence());
+
+ if(xSequenceVirtual.hasElements())
+ {
+ // create transform primitive
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::TransformPrimitive2D(
+ aObjectMatrix,
+ xSequenceVirtual));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+ else
+ {
+ // always append an invisible outline for the cases where no visible content exists
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ drawinglayer::primitive2d::createHiddenGeometryPrimitives2D(
+ false, aObjectMatrix));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewobjectcontact.cxx b/svx/source/sdr/contact/viewobjectcontact.cxx
new file mode 100644
index 000000000000..73e4c12e5066
--- /dev/null
+++ b/svx/source/sdr/contact/viewobjectcontact.cxx
@@ -0,0 +1,438 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/sdr/contact/objectcontact.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <vcl/region.hxx>
+#include <svx/sdr/animation/objectanimator.hxx>
+#include <svx/sdr/animation/animationstate.hxx>
+#include <svx/sdr/contact/viewobjectcontactredirector.hxx>
+#include <basegfx/numeric/ftools.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx>
+#include <basegfx/tools/canvastools.hxx>
+#include <drawinglayer/primitive2d/animatedprimitive2d.hxx>
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
+#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
+#include <svx/sdr/contact/viewobjectcontactredirector.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace
+{
+ // animated extractor
+
+ // Necessary to filter a sequence of animated primitives from
+ // a sequence of primitives to find out if animated or not. The decision for
+ // what to decompose is hard-coded and only done for knowingly animated primitives
+ // to not decompose too deeply and unnecessarily. This implies that the list
+ // which is view-specific needs to be expanded by hand when new animated objects
+ // are added. This may eventually be changed to a dynamically configurable approach
+ // if necessary.
+ class AnimatedExtractingProcessor2D : public drawinglayer::processor2d::BaseProcessor2D
+ {
+ protected:
+ // the found animated primitives
+ drawinglayer::primitive2d::Primitive2DSequence maPrimitive2DSequence;
+
+ // bitfield
+ // text animation allowed?
+ unsigned mbTextAnimationAllowed : 1;
+
+ // graphic animation allowed?
+ unsigned mbGraphicAnimationAllowed : 1;
+
+ // as tooling, the process() implementation takes over API handling and calls this
+ // virtual render method when the primitive implementation is BasePrimitive2D-based.
+ virtual void processBasePrimitive2D(const drawinglayer::primitive2d::BasePrimitive2D& rCandidate);
+
+ public:
+ AnimatedExtractingProcessor2D(
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation,
+ bool bTextAnimationAllowed,
+ bool bGraphicAnimationAllowed);
+ virtual ~AnimatedExtractingProcessor2D();
+
+ // data access
+ const drawinglayer::primitive2d::Primitive2DSequence& getPrimitive2DSequence() const { return maPrimitive2DSequence; }
+ bool isTextAnimationAllowed() const { return mbTextAnimationAllowed; }
+ bool isGraphicAnimationAllowed() const { return mbGraphicAnimationAllowed; }
+ };
+
+ AnimatedExtractingProcessor2D::AnimatedExtractingProcessor2D(
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation,
+ bool bTextAnimationAllowed,
+ bool bGraphicAnimationAllowed)
+ : drawinglayer::processor2d::BaseProcessor2D(rViewInformation),
+ maPrimitive2DSequence(),
+ mbTextAnimationAllowed(bTextAnimationAllowed),
+ mbGraphicAnimationAllowed(bGraphicAnimationAllowed)
+ {
+ }
+
+ AnimatedExtractingProcessor2D::~AnimatedExtractingProcessor2D()
+ {
+ }
+
+ void AnimatedExtractingProcessor2D::processBasePrimitive2D(const drawinglayer::primitive2d::BasePrimitive2D& rCandidate)
+ {
+ // known implementation, access directly
+ switch(rCandidate.getPrimitive2DID())
+ {
+ // add and accept animated primitives directly, no need to decompose
+ case PRIMITIVE2D_ID_ANIMATEDSWITCHPRIMITIVE2D :
+ case PRIMITIVE2D_ID_ANIMATEDBLINKPRIMITIVE2D :
+ case PRIMITIVE2D_ID_ANIMATEDINTERPOLATEPRIMITIVE2D :
+ {
+ const drawinglayer::primitive2d::AnimatedSwitchPrimitive2D& rSwitchPrimitive = static_cast< const drawinglayer::primitive2d::AnimatedSwitchPrimitive2D& >(rCandidate);
+
+ if((rSwitchPrimitive.isTextAnimation() && isTextAnimationAllowed())
+ || (rSwitchPrimitive.isGraphicAnimation() && isGraphicAnimationAllowed()))
+ {
+ const drawinglayer::primitive2d::Primitive2DReference xReference(const_cast< drawinglayer::primitive2d::BasePrimitive2D* >(&rCandidate));
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(maPrimitive2DSequence, xReference);
+ }
+ break;
+ }
+
+ // decompose animated gifs where SdrGrafPrimitive2D produces a GraphicPrimitive2D
+ // which then produces the animation infos (all when used/needed)
+ case PRIMITIVE2D_ID_SDRGRAFPRIMITIVE2D :
+ case PRIMITIVE2D_ID_GRAPHICPRIMITIVE2D :
+
+ // decompose SdrObjects with evtl. animated text
+ case PRIMITIVE2D_ID_SDRCAPTIONPRIMITIVE2D :
+ case PRIMITIVE2D_ID_SDRCONNECTORPRIMITIVE2D :
+ case PRIMITIVE2D_ID_SDRCUSTOMSHAPEPRIMITIVE2D :
+ case PRIMITIVE2D_ID_SDRELLIPSEPRIMITIVE2D :
+ case PRIMITIVE2D_ID_SDRELLIPSESEGMENTPRIMITIVE2D :
+ case PRIMITIVE2D_ID_SDRMEASUREPRIMITIVE2D :
+ case PRIMITIVE2D_ID_SDRPATHPRIMITIVE2D :
+ case PRIMITIVE2D_ID_SDRRECTANGLEPRIMITIVE2D :
+
+ // decompose evtl. animated text contained in MaskPrimitive2D
+ // or group rimitives
+ case PRIMITIVE2D_ID_MASKPRIMITIVE2D :
+ case PRIMITIVE2D_ID_GROUPPRIMITIVE2D :
+ {
+ process(rCandidate.get2DDecomposition(getViewInformation2D()));
+ break;
+ }
+
+ default :
+ {
+ // nothing to do for the rest
+ break;
+ }
+ }
+ }
+} // end of anonymous namespace
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewObjectContact::ViewObjectContact(ObjectContact& rObjectContact, ViewContact& rViewContact)
+ : mrObjectContact(rObjectContact),
+ mrViewContact(rViewContact),
+ maObjectRange(),
+ mxPrimitive2DSequence(),
+ mpPrimitiveAnimation(0),
+ mbLazyInvalidate(false)
+ {
+ // make the ViewContact remember me
+ mrViewContact.AddViewObjectContact(*this);
+
+ // make the ObjectContact remember me
+ mrObjectContact.AddViewObjectContact(*this);
+ }
+
+ ViewObjectContact::~ViewObjectContact()
+ {
+ // invalidate in view
+ if(!maObjectRange.isEmpty())
+ {
+ GetObjectContact().InvalidatePartOfView(maObjectRange);
+ }
+
+ // delete PrimitiveAnimation
+ if(mpPrimitiveAnimation)
+ {
+ delete mpPrimitiveAnimation;
+ mpPrimitiveAnimation = 0;
+ }
+
+ // take care of remebered ObjectContact. Remove from
+ // OC first. The VC removal (below) CAN trigger a StopGettingViewed()
+ // which (depending of it's implementation) may destroy other OCs. This
+ // can trigger the deletion of the helper OC of a page visualising object
+ // which IS the OC of this object. Eventually StopGettingViewed() needs
+ // to get asynchron later
+ GetObjectContact().RemoveViewObjectContact(*this);
+
+ // take care of remebered ViewContact
+ GetViewContact().RemoveViewObjectContact(*this);
+ }
+
+ const basegfx::B2DRange& ViewObjectContact::getObjectRange() const
+ {
+ if(maObjectRange.isEmpty())
+ {
+ // if range is not computed (new or LazyInvalidate objects), force it
+ const DisplayInfo aDisplayInfo;
+ const drawinglayer::primitive2d::Primitive2DSequence xSequence(getPrimitive2DSequence(aDisplayInfo));
+
+ if(xSequence.hasElements())
+ {
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
+ const_cast< ViewObjectContact* >(this)->maObjectRange =
+ drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xSequence, rViewInformation2D);
+ }
+ }
+
+ return maObjectRange;
+ }
+
+ void ViewObjectContact::ActionChanged()
+ {
+ if(!mbLazyInvalidate)
+ {
+ // set local flag
+ mbLazyInvalidate = true;
+
+ // force ObjectRange
+ getObjectRange();
+
+ if(!maObjectRange.isEmpty())
+ {
+ // invalidate current valid range
+ GetObjectContact().InvalidatePartOfView(maObjectRange);
+
+ // reset ObjectRange, it needs to be recalculated
+ maObjectRange.reset();
+ }
+
+ // register at OC for lazy invalidate
+ GetObjectContact().setLazyInvalidate(*this);
+ }
+ }
+
+ void ViewObjectContact::triggerLazyInvalidate()
+ {
+ if(mbLazyInvalidate)
+ {
+ // reset flag
+ mbLazyInvalidate = false;
+
+ // force ObjectRange
+ getObjectRange();
+
+ if(!maObjectRange.isEmpty())
+ {
+ // invalidate current valid range
+ GetObjectContact().InvalidatePartOfView(maObjectRange);
+ }
+ }
+ }
+
+ // Take some action when new objects are inserted
+ void ViewObjectContact::ActionChildInserted(ViewContact& rChild)
+ {
+ // force creation of the new VOC and trigger it's refresh, so it
+ // will take part in LazyInvalidate immediately
+ rChild.GetViewObjectContact(GetObjectContact()).ActionChanged();
+
+ // forward action to ObjectContact
+ // const ViewObjectContact& rChildVOC = rChild.GetViewObjectContact(GetObjectContact());
+ // GetObjectContact().InvalidatePartOfView(rChildVOC.getObjectRange());
+ }
+
+ void ViewObjectContact::checkForPrimitive2DAnimations()
+ {
+ // remove old one
+ if(mpPrimitiveAnimation)
+ {
+ delete mpPrimitiveAnimation;
+ mpPrimitiveAnimation = 0;
+ }
+
+ // check for animated primitives
+ if(mxPrimitive2DSequence.hasElements())
+ {
+ const bool bTextAnimationAllowed(GetObjectContact().IsTextAnimationAllowed());
+ const bool bGraphicAnimationAllowed(GetObjectContact().IsGraphicAnimationAllowed());
+
+ if(bTextAnimationAllowed || bGraphicAnimationAllowed)
+ {
+ AnimatedExtractingProcessor2D aAnimatedExtractor(GetObjectContact().getViewInformation2D(),
+ bTextAnimationAllowed, bGraphicAnimationAllowed);
+ aAnimatedExtractor.process(mxPrimitive2DSequence);
+
+ if(aAnimatedExtractor.getPrimitive2DSequence().hasElements())
+ {
+ // dervied primitiveList is animated, setup new PrimitiveAnimation
+ mpPrimitiveAnimation = new sdr::animation::PrimitiveAnimation(*this, aAnimatedExtractor.getPrimitive2DSequence());
+ }
+ }
+ }
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewObjectContact::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const
+ {
+ // get the view-independent Primitive from the viewContact
+ drawinglayer::primitive2d::Primitive2DSequence xRetval(GetViewContact().getViewIndependentPrimitive2DSequence());
+
+ if(xRetval.hasElements())
+ {
+ // handle GluePoint
+ if(!GetObjectContact().isOutputToPrinter() && GetObjectContact().AreGluePointsVisible())
+ {
+ const drawinglayer::primitive2d::Primitive2DSequence xGlue(GetViewContact().createGluePointPrimitive2DSequence());
+
+ if(xGlue.hasElements())
+ {
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, xGlue);
+ }
+ }
+
+ // handle ghosted
+ if(isPrimitiveGhosted(rDisplayInfo))
+ {
+ const basegfx::BColor aRGBWhite(1.0, 1.0, 1.0);
+ const basegfx::BColorModifier aBColorModifier(aRGBWhite, 0.5, basegfx::BCOLORMODIFYMODE_INTERPOLATE);
+ const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::ModifiedColorPrimitive2D(xRetval, aBColorModifier));
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+ }
+
+ return xRetval;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewObjectContact::getPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const
+ {
+ drawinglayer::primitive2d::Primitive2DSequence xNewPrimitiveSequence;
+
+ // take care of redirectors and create new list
+ ViewObjectContactRedirector* pRedirector = GetObjectContact().GetViewObjectContactRedirector();
+
+ if(pRedirector)
+ {
+ xNewPrimitiveSequence = pRedirector->createRedirectedPrimitive2DSequence(*this, rDisplayInfo);
+ }
+ else
+ {
+ xNewPrimitiveSequence = createPrimitive2DSequence(rDisplayInfo);
+ }
+
+ // local up-to-date checks. New list different from local one?
+ if(!drawinglayer::primitive2d::arePrimitive2DSequencesEqual(mxPrimitive2DSequence, xNewPrimitiveSequence))
+ {
+ // has changed, copy content
+ const_cast< ViewObjectContact* >(this)->mxPrimitive2DSequence = xNewPrimitiveSequence;
+
+ // check for animated stuff
+ const_cast< ViewObjectContact* >(this)->checkForPrimitive2DAnimations();
+
+ // always update object range when PrimitiveSequence changes
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
+ const_cast< ViewObjectContact* >(this)->maObjectRange =
+ drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(mxPrimitive2DSequence, rViewInformation2D);
+ }
+
+ // return current Primitive2DSequence
+ return mxPrimitive2DSequence;
+ }
+
+ bool ViewObjectContact::isPrimitiveVisible(const DisplayInfo& /*rDisplayInfo*/) const
+ {
+ // default: always visible
+ return true;
+ }
+
+ bool ViewObjectContact::isPrimitiveGhosted(const DisplayInfo& rDisplayInfo) const
+ {
+ // default: standard check
+ return (GetObjectContact().DoVisualizeEnteredGroup() && !GetObjectContact().isOutputToPrinter() && rDisplayInfo.IsGhostedDrawModeActive());
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewObjectContact::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const
+ {
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+
+ // check model-view visibility
+ if(isPrimitiveVisible(rDisplayInfo))
+ {
+ xRetval = getPrimitive2DSequence(rDisplayInfo);
+
+ if(xRetval.hasElements())
+ {
+ // get ranges
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
+ const basegfx::B2DRange aObjectRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xRetval, rViewInformation2D));
+ const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport());
+
+ // check geometrical visibility
+ if(!aViewRange.isEmpty() && !aViewRange.overlaps(aObjectRange))
+ {
+ // not visible, release
+ xRetval.realloc(0);
+ }
+ }
+ }
+
+ return xRetval;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewObjectContact::getPrimitive2DSequenceSubHierarchy(DisplayInfo& rDisplayInfo) const
+ {
+ const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount());
+ drawinglayer::primitive2d::Primitive2DSequence xSeqRetval;
+
+ for(sal_uInt32 a(0); a < nSubHierarchyCount; a++)
+ {
+ const ViewObjectContact& rCandidate(GetViewContact().GetViewContact(a).GetViewObjectContact(GetObjectContact()));
+
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xSeqRetval, rCandidate.getPrimitive2DSequenceHierarchy(rDisplayInfo));
+ }
+
+ return xSeqRetval;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewobjectcontactofe3d.cxx b/svx/source/sdr/contact/viewobjectcontactofe3d.cxx
new file mode 100644
index 000000000000..ec8cdb4ef5ba
--- /dev/null
+++ b/svx/source/sdr/contact/viewobjectcontactofe3d.cxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/viewobjectcontactofe3d.hxx>
+#include <svx/sdr/contact/viewcontactofe3d.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx>
+#include <svx/sdr/contact/viewobjectcontactofe3dscene.hxx>
+#include <drawinglayer/primitive2d/embedded3dprimitive2d.hxx>
+#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewObjectContactOfE3d::ViewObjectContactOfE3d(ObjectContact& rObjectContact, ViewContact& rViewContact)
+ : ViewObjectContactOfSdrObj(rObjectContact, rViewContact)
+ {
+ }
+
+ ViewObjectContactOfE3d::~ViewObjectContactOfE3d()
+ {
+ }
+
+ drawinglayer::primitive3d::Primitive3DSequence ViewObjectContactOfE3d::createPrimitive3DSequence(const DisplayInfo& rDisplayInfo) const
+ {
+ // get the view-independent Primitive from the viewContact
+ const ViewContactOfE3d& rViewContactOfE3d(dynamic_cast< const ViewContactOfE3d& >(GetViewContact()));
+ drawinglayer::primitive3d::Primitive3DSequence xRetval(rViewContactOfE3d.getViewIndependentPrimitive3DSequence());
+
+ // handle ghosted
+ if(isPrimitiveGhosted(rDisplayInfo))
+ {
+ const ::basegfx::BColor aRGBWhite(1.0, 1.0, 1.0);
+ const ::basegfx::BColorModifier aBColorModifier(aRGBWhite, 0.5, ::basegfx::BCOLORMODIFYMODE_INTERPOLATE);
+ const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::ModifiedColorPrimitive3D(xRetval, aBColorModifier));
+ xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1);
+ }
+
+ return xRetval;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfE3d::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const
+ {
+ const ViewContactOfE3d& rViewContact = static_cast< const ViewContactOfE3d& >(GetViewContact());
+
+ // get 3d primitive vector, isPrimitiveVisible() is done in 3d creator
+ return rViewContact.impCreateWithGivenPrimitive3DSequence(getPrimitive3DSequence(rDisplayInfo));
+ }
+
+ drawinglayer::primitive3d::Primitive3DSequence ViewObjectContactOfE3d::getPrimitive3DSequence(const DisplayInfo& rDisplayInfo) const
+ {
+ drawinglayer::primitive3d::Primitive3DSequence xNewPrimitive3DSeq(createPrimitive3DSequence(rDisplayInfo));
+
+ // local up-to-date checks. New list different from local one?
+ if(!drawinglayer::primitive3d::arePrimitive3DSequencesEqual(mxPrimitive3DSequence, xNewPrimitive3DSeq))
+ {
+ // has changed, copy content
+ const_cast< ViewObjectContactOfE3d* >(this)->mxPrimitive3DSequence = xNewPrimitive3DSeq;
+ }
+
+ // return current Primitive2DSequence
+ return mxPrimitive3DSequence;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx b/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx
new file mode 100644
index 000000000000..a549b1db1233
--- /dev/null
+++ b/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/viewobjectcontactofe3dscene.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/sdr/contact/objectcontact.hxx>
+#include <svx/sdr/contact/viewcontactofe3dscene.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <drawinglayer/primitive3d/transformprimitive3d.hxx>
+#include <basegfx/color/bcolormodifier.hxx>
+#include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx>
+#include <svx/sdr/contact/viewobjectcontactofe3d.hxx>
+#include <basegfx/tools/canvastools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace
+{
+ // Helper method to recursively travel the DrawHierarchy for 3D objects contained in
+ // the 2D Scene. This will chreate all VOCs for the currenbt OC which are needed
+ // for ActionChanged() functionality
+ void impInternalSubHierarchyTraveller(const sdr::contact::ViewObjectContact& rVOC)
+ {
+ const sdr::contact::ViewContact& rVC = rVOC.GetViewContact();
+ const sal_uInt32 nSubHierarchyCount(rVC.GetObjectCount());
+
+ for(sal_uInt32 a(0); a < nSubHierarchyCount; a++)
+ {
+ const sdr::contact::ViewObjectContact& rCandidate(rVC.GetViewContact(a).GetViewObjectContact(rVOC.GetObjectContact()));
+ impInternalSubHierarchyTraveller(rCandidate);
+ }
+ }
+} // end of anonymous namespace
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewObjectContactOfE3dScene::ViewObjectContactOfE3dScene(ObjectContact& rObjectContact, ViewContact& rViewContact)
+ : ViewObjectContactOfSdrObj(rObjectContact, rViewContact)
+ {
+ }
+
+ ViewObjectContactOfE3dScene::~ViewObjectContactOfE3dScene()
+ {
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfE3dScene::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const
+ {
+ // handle ghosted, else the whole 3d group will be encapsulated to a ghosted primitive set (see below)
+ const bool bHandleGhostedDisplay(GetObjectContact().DoVisualizeEnteredGroup() && !GetObjectContact().isOutputToPrinter() && rDisplayInfo.IsGhostedDrawModeActive());
+ const bool bIsActiveVC(bHandleGhostedDisplay && GetObjectContact().getActiveViewContact() == &GetViewContact());
+
+ if(bIsActiveVC)
+ {
+ // switch off ghosted, display contents normal
+ const_cast< DisplayInfo& >(rDisplayInfo).ClearGhostedDrawMode();
+ }
+
+ // create 2d primitive with content, use layer visibility test
+ // this uses no ghosted mode, so scenes in scenes and entering them will not
+ // support ghosted for now. This is no problem currently but would need to be
+ // added when sub-groups in 3d will be added one day.
+ const ViewContactOfE3dScene& rViewContact = dynamic_cast< ViewContactOfE3dScene& >(GetViewContact());
+ const SetOfByte& rVisibleLayers = rDisplayInfo.GetProcessLayers();
+ drawinglayer::primitive2d::Primitive2DSequence xRetval(rViewContact.createScenePrimitive2DSequence(&rVisibleLayers));
+
+ if(xRetval.hasElements())
+ {
+ // handle GluePoint
+ if(!GetObjectContact().isOutputToPrinter() && GetObjectContact().AreGluePointsVisible())
+ {
+ const drawinglayer::primitive2d::Primitive2DSequence xGlue(GetViewContact().createGluePointPrimitive2DSequence());
+
+ if(xGlue.hasElements())
+ {
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, xGlue);
+ }
+ }
+
+ // handle ghosted
+ if(isPrimitiveGhosted(rDisplayInfo))
+ {
+ const ::basegfx::BColor aRGBWhite(1.0, 1.0, 1.0);
+ const ::basegfx::BColorModifier aBColorModifier(aRGBWhite, 0.5, ::basegfx::BCOLORMODIFYMODE_INTERPOLATE);
+ const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::ModifiedColorPrimitive2D(xRetval, aBColorModifier));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+ }
+
+ if(bIsActiveVC)
+ {
+ // set back, display ghosted again
+ const_cast< DisplayInfo& >(rDisplayInfo).SetGhostedDrawMode();
+ }
+
+ return xRetval;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfE3dScene::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const
+ {
+ // To get the VOCs for the contained 3D objects created to get the correct
+ // Draw hierarchy and ActionChanged() working properly, travel the DrawHierarchy
+ // using a local tooling method
+ impInternalSubHierarchyTraveller(*this);
+
+ // call parent
+ return ViewObjectContactOfSdrObj::getPrimitive2DSequenceHierarchy(rDisplayInfo);
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
new file mode 100644
index 000000000000..110186d41bf4
--- /dev/null
+++ b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
@@ -0,0 +1,333 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/viewobjectcontactofgraphic.hxx>
+#include <svx/sdr/contact/viewcontactofgraphic.hxx>
+#include <svx/sdr/event/eventhandler.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/sdr/contact/objectcontact.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdpage.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace event
+ {
+ class AsynchGraphicLoadingEvent : public BaseEvent
+ {
+ // the ViewContactOfGraphic to work with
+ sdr::contact::ViewObjectContactOfGraphic& mrVOCOfGraphic;
+
+ public:
+ // basic constructor.
+ AsynchGraphicLoadingEvent(EventHandler& rEventHandler, sdr::contact::ViewObjectContactOfGraphic& rVOCOfGraphic);
+
+ // destructor
+ virtual ~AsynchGraphicLoadingEvent();
+
+ // the called method if the event is triggered
+ virtual void ExecuteEvent();
+ };
+
+ AsynchGraphicLoadingEvent::AsynchGraphicLoadingEvent(
+ EventHandler& rEventHandler, sdr::contact::ViewObjectContactOfGraphic& rVOCOfGraphic)
+ : BaseEvent(rEventHandler),
+ mrVOCOfGraphic(rVOCOfGraphic)
+ {
+ }
+
+ AsynchGraphicLoadingEvent::~AsynchGraphicLoadingEvent()
+ {
+ mrVOCOfGraphic.forgetAsynchGraphicLoadingEvent(this);
+ }
+
+ void AsynchGraphicLoadingEvent::ExecuteEvent()
+ {
+ mrVOCOfGraphic.doAsynchGraphicLoading();
+ }
+ } // end of namespace event
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ // Test graphics state and eventually trigger a SwapIn event or an Asynchronous
+ // load event. Return value gives info if SwapIn was triggered or not
+ bool ViewObjectContactOfGraphic::impPrepareGraphicWithAsynchroniousLoading()
+ {
+ bool bRetval(false);
+ SdrGrafObj& rGrafObj = getSdrGrafObj();
+
+ if(rGrafObj.IsSwappedOut())
+ {
+ if(rGrafObj.IsLinkedGraphic())
+ {
+ // update graphic link
+ rGrafObj.ImpUpdateGraphicLink();
+ }
+ else
+ {
+ // SwapIn needs to be done. Decide if it can be done asynchronious.
+ bool bSwapInAsynchronious(false);
+ ObjectContact& rObjectContact = GetObjectContact();
+
+ // only when allowed from configuration
+ if(rObjectContact.IsAsynchronGraphicsLoadingAllowed())
+ {
+ // direct output or vdev output (PageView buffering)
+ if(rObjectContact.isOutputToWindow() || rObjectContact.isOutputToVirtualDevice())
+ {
+ // only when no metafile recording
+ if(!rObjectContact.isOutputToRecordingMetaFile())
+ {
+ // allow asynchronious loading
+ bSwapInAsynchronious = true;
+ }
+ }
+ }
+
+ if(bSwapInAsynchronious)
+ {
+ // maybe it's on the way, then do nothing
+ if(!mpAsynchLoadEvent)
+ {
+ // Trigger asynchronious SwapIn.
+ sdr::event::TimerEventHandler& rEventHandler = rObjectContact.GetEventHandler();
+
+ mpAsynchLoadEvent = new sdr::event::AsynchGraphicLoadingEvent(rEventHandler, *this);
+ }
+ }
+ else
+ {
+ if(rObjectContact.isOutputToPrinter())
+ {
+ // #i76395# preview mechanism is only active if
+ // swapin is called from inside paint preparation, so mbInsidePaint
+ // has to be false to be able to print with high resolution
+ rGrafObj.ForceSwapIn();
+ }
+ else
+ {
+ // SwapIn direct
+ rGrafObj.mbInsidePaint = sal_True;
+ rGrafObj.ForceSwapIn();
+ rGrafObj.mbInsidePaint = sal_False;
+ }
+
+ bRetval = true;
+ }
+ }
+ }
+ else
+ {
+ // it is not swapped out, somehow it was loaded. In that case, forget
+ // about an existing triggered event
+ if(mpAsynchLoadEvent)
+ {
+ // just delete it, this will remove it from the EventHandler and
+ // will trigger forgetAsynchGraphicLoadingEvent from the destructor
+ delete mpAsynchLoadEvent;
+ }
+ }
+
+ return bRetval;
+ }
+
+ // Test graphics state and eventually trigger a SwapIn event. Return value
+ // gives info if SwapIn was triggered or not
+ bool ViewObjectContactOfGraphic::impPrepareGraphicWithSynchroniousLoading()
+ {
+ bool bRetval(false);
+ SdrGrafObj& rGrafObj = getSdrGrafObj();
+
+ if(rGrafObj.IsSwappedOut())
+ {
+ if(rGrafObj.IsLinkedGraphic())
+ {
+ // update graphic link
+ rGrafObj.ImpUpdateGraphicLink( sal_False );
+ }
+ else
+ {
+ ObjectContact& rObjectContact = GetObjectContact();
+
+ if(rObjectContact.isOutputToPrinter())
+ {
+ // #i76395# preview mechanism is only active if
+ // swapin is called from inside paint preparation, so mbInsidePaint
+ // has to be false to be able to print with high resolution
+ rGrafObj.ForceSwapIn();
+ }
+ else
+ {
+ // SwapIn direct
+ rGrafObj.mbInsidePaint = sal_True;
+ rGrafObj.ForceSwapIn();
+ rGrafObj.mbInsidePaint = sal_False;
+ }
+
+ bRetval = true;
+ }
+ }
+
+ return bRetval;
+ }
+
+ // This is the call from the asynch graphic loading. This may only be called from
+ // AsynchGraphicLoadingEvent::ExecuteEvent(). Do load the graphics. The event will
+ // be deleted (consumed) and forgetAsynchGraphicLoadingEvent will be called.
+ void ViewObjectContactOfGraphic::doAsynchGraphicLoading()
+ {
+ DBG_ASSERT(mpAsynchLoadEvent, "ViewObjectContactOfGraphic::doAsynchGraphicLoading: I did not trigger a event, why am i called (?)");
+
+ // swap it in
+ SdrGrafObj& rGrafObj = getSdrGrafObj();
+ rGrafObj.ForceSwapIn();
+
+ // #i103720# forget event to avoid possible deletion by the following ActionChanged call
+ // which may use createPrimitive2DSequence/impPrepareGraphicWithAsynchroniousLoading again.
+ // Deletion is actally done by the scheduler who leaded to coming here
+ mpAsynchLoadEvent = 0;
+
+ // Invalidate all paint areas and check existing animation (which may have changed).
+ GetViewContact().ActionChanged();
+ }
+
+ // This is the call from the destructor of the asynch graphic loading event.
+ // No one else has to call this. It is needed to let this object forget about
+ // the event. The parameter allows checking for the correct event.
+ void ViewObjectContactOfGraphic::forgetAsynchGraphicLoadingEvent(sdr::event::AsynchGraphicLoadingEvent* pEvent)
+ {
+ (void) pEvent; // suppress warning
+
+ if(mpAsynchLoadEvent)
+ {
+ OSL_ENSURE(!pEvent || mpAsynchLoadEvent == pEvent,
+ "ViewObjectContactOfGraphic::forgetAsynchGraphicLoadingEvent: Forced to forget another event then i have scheduled (?)");
+
+ // forget event
+ mpAsynchLoadEvent = 0;
+ }
+ }
+
+ SdrGrafObj& ViewObjectContactOfGraphic::getSdrGrafObj()
+ {
+ return static_cast< ViewContactOfGraphic& >(GetViewContact()).GetGrafObject();
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfGraphic::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const
+ {
+ // prepare primitive generation with evtl. loading the graphic when it's swapped out
+ SdrGrafObj& rGrafObj = const_cast< ViewObjectContactOfGraphic* >(this)->getSdrGrafObj();
+ bool bDoAsynchronGraphicLoading(rGrafObj.GetModel() && rGrafObj.GetModel()->IsSwapGraphics());
+ bool bSwapInDone(false);
+ bool bSwapInExclusive(false);
+
+ if( bDoAsynchronGraphicLoading && rGrafObj.IsSwappedOut() )
+ {
+ // sometimes it is needed that each graphic is completely available and swapped in
+ // for these cases a ForceSwapIn is called later at the graphic object
+ if ( rGrafObj.GetPage() && rGrafObj.GetPage()->IsMasterPage() )
+ {
+ // #i102380# force Swap-In for GraphicObjects on MasterPage to have a nicer visualisation
+ bDoAsynchronGraphicLoading = false;
+ }
+ else if ( GetObjectContact().isOutputToPrinter()
+ || GetObjectContact().isOutputToRecordingMetaFile()
+ || GetObjectContact().isOutputToPDFFile() )
+ {
+ bDoAsynchronGraphicLoading = false;
+ bSwapInExclusive = true;
+ }
+ }
+ if( bDoAsynchronGraphicLoading )
+ {
+ bSwapInDone = const_cast< ViewObjectContactOfGraphic* >(this)->impPrepareGraphicWithAsynchroniousLoading();
+ }
+ else
+ {
+ bSwapInDone = const_cast< ViewObjectContactOfGraphic* >(this)->impPrepareGraphicWithSynchroniousLoading();
+ }
+
+ // 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 metafile and pdf, swap out again
+ if( bSwapInDone && bSwapInExclusive )
+ {
+ rGrafObj.ForceSwapOut();
+ }
+
+ return xRetval;
+ }
+
+ ViewObjectContactOfGraphic::ViewObjectContactOfGraphic(ObjectContact& rObjectContact, ViewContact& rViewContact)
+ : ViewObjectContactOfSdrObj(rObjectContact, rViewContact),
+ mpAsynchLoadEvent(0)
+ {
+ }
+
+ ViewObjectContactOfGraphic::~ViewObjectContactOfGraphic()
+ {
+ // evtl. delete the asynch loading event
+ if(mpAsynchLoadEvent)
+ {
+ // just delete it, this will remove it from the EventHandler and
+ // will trigger forgetAsynchGraphicLoadingEvent from the destructor
+ delete mpAsynchLoadEvent;
+ }
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewobjectcontactofgroup.cxx b/svx/source/sdr/contact/viewobjectcontactofgroup.cxx
new file mode 100644
index 000000000000..392b8e923212
--- /dev/null
+++ b/svx/source/sdr/contact/viewobjectcontactofgroup.cxx
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/viewobjectcontactofgroup.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/sdr/contact/objectcontact.hxx>
+#include <basegfx/numeric/ftools.hxx>
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <basegfx/tools/canvastools.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewObjectContactOfGroup::ViewObjectContactOfGroup(ObjectContact& rObjectContact, ViewContact& rViewContact)
+ : ViewObjectContactOfSdrObj(rObjectContact, rViewContact)
+ {
+ }
+
+ ViewObjectContactOfGroup::~ViewObjectContactOfGroup()
+ {
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfGroup::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const
+ {
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+
+ // check model-view visibility
+ if(isPrimitiveVisible(rDisplayInfo))
+ {
+ const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount());
+
+ if(nSubHierarchyCount)
+ {
+ const sal_Bool bDoGhostedDisplaying(
+ GetObjectContact().DoVisualizeEnteredGroup()
+ && !GetObjectContact().isOutputToPrinter()
+ && GetObjectContact().getActiveViewContact() == &GetViewContact());
+
+ if(bDoGhostedDisplaying)
+ {
+ rDisplayInfo.ClearGhostedDrawMode();
+ }
+
+ // create object hierarchy
+ xRetval = getPrimitive2DSequenceSubHierarchy(rDisplayInfo);
+
+ if(xRetval.hasElements())
+ {
+ // get ranges
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
+ const ::basegfx::B2DRange aObjectRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xRetval, rViewInformation2D));
+ const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport());
+
+ // check geometrical visibility
+ if(!aViewRange.isEmpty() && !aViewRange.overlaps(aObjectRange))
+ {
+ // not visible, release
+ xRetval.realloc(0);
+ }
+ }
+
+ if(bDoGhostedDisplaying)
+ {
+ rDisplayInfo.SetGhostedDrawMode();
+ }
+ }
+ else
+ {
+ // draw replacement object for group. This will use ViewContactOfGroup::createViewIndependentPrimitive2DSequence
+ // which creates the replacement primitives for an empty group
+ xRetval = ViewObjectContactOfSdrObj::getPrimitive2DSequenceHierarchy(rDisplayInfo);
+ }
+ }
+ return xRetval;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx
new file mode 100644
index 000000000000..e779cac4151e
--- /dev/null
+++ b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx
@@ -0,0 +1,153 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/viewobjectcontactofmasterpagedescriptor.hxx>
+#include <svx/sdr/contact/viewcontactofmasterpagedescriptor.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/sdr/contact/objectcontact.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdpage.hxx>
+#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewObjectContactOfMasterPageDescriptor::ViewObjectContactOfMasterPageDescriptor(ObjectContact& rObjectContact, ViewContact& rViewContact)
+ : ViewObjectContact(rObjectContact, rViewContact)
+ {
+ }
+
+ ViewObjectContactOfMasterPageDescriptor::~ViewObjectContactOfMasterPageDescriptor()
+ {
+ }
+
+ sdr::MasterPageDescriptor& ViewObjectContactOfMasterPageDescriptor::GetMasterPageDescriptor() const
+ {
+ return static_cast< ViewContactOfMasterPageDescriptor& >(GetViewContact()).GetMasterPageDescriptor();
+ }
+
+ bool ViewObjectContactOfMasterPageDescriptor::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
+ {
+ if(rDisplayInfo.GetControlLayerProcessingActive())
+ {
+ return false;
+ }
+
+ if(!rDisplayInfo.GetPageProcessingActive())
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfMasterPageDescriptor::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const
+ {
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+ drawinglayer::primitive2d::Primitive2DSequence xMasterPageSequence;
+ const sdr::MasterPageDescriptor& rDescriptor = GetMasterPageDescriptor();
+
+ // used range (retval) is fixed here, it's the MasterPage fill range
+ const SdrPage& rOwnerPage = rDescriptor.GetOwnerPage();
+ const basegfx::B2DRange aPageFillRange(
+ rOwnerPage.GetLftBorder(), rOwnerPage.GetUppBorder(),
+ rOwnerPage.GetWdt() - rOwnerPage.GetRgtBorder(), rOwnerPage.GetHgt() - rOwnerPage.GetLwrBorder());
+
+ // Modify DisplayInfo for MasterPageContent collection; remember original layers and
+ // set combined LayerSet; set MasterPagePaint flag
+ const SetOfByte aRememberedLayers(rDisplayInfo.GetProcessLayers());
+ SetOfByte aPreprocessedLayers(aRememberedLayers);
+ aPreprocessedLayers &= rDescriptor.GetVisibleLayers();
+ rDisplayInfo.SetProcessLayers(aPreprocessedLayers);
+ rDisplayInfo.SetSubContentActive(true);
+
+ // check layer visibility (traditionally was member of layer 1)
+ if(aPreprocessedLayers.IsSet(1))
+ {
+ // hide PageBackground for special DrawModes; historical reasons
+ if(!GetObjectContact().isDrawModeGray() && !GetObjectContact().isDrawModeHighContrast())
+ {
+ // if visible, create the default background primitive sequence
+ xRetval = static_cast< ViewContactOfMasterPageDescriptor& >(GetViewContact()).getViewIndependentPrimitive2DSequence();
+ }
+ }
+
+ // hide MasterPage content? Test self here for hierarchy
+ if(isPrimitiveVisible(rDisplayInfo))
+ {
+ // get the VOC of the Master-SdrPage and get it's object hierarchy
+ ViewContact& rViewContactOfMasterPage(rDescriptor.GetUsedPage().GetViewContact());
+ ViewObjectContact& rVOCOfMasterPage(rViewContactOfMasterPage.GetViewObjectContact(GetObjectContact()));
+
+ xMasterPageSequence = rVOCOfMasterPage.getPrimitive2DSequenceHierarchy(rDisplayInfo);
+ }
+
+ // reset DisplayInfo changes for MasterPage paint
+ rDisplayInfo.SetProcessLayers(aRememberedLayers);
+ rDisplayInfo.SetSubContentActive(false);
+
+ if(xMasterPageSequence.hasElements())
+ {
+ // get range of MasterPage sub hierarchy
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
+ const basegfx::B2DRange aSubHierarchyRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xMasterPageSequence, rViewInformation2D));
+
+ if(aPageFillRange.isInside(aSubHierarchyRange))
+ {
+ // completely inside, just render MasterPage content. Add to target
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, xMasterPageSequence);
+ }
+ else if(aPageFillRange.overlaps(aSubHierarchyRange))
+ {
+ // overlapping, compute common area
+ basegfx::B2DRange aCommonArea(aPageFillRange);
+ aCommonArea.intersect(aSubHierarchyRange);
+
+ // need to create a clip primitive, add clipped list to target
+ const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::MaskPrimitive2D(
+ basegfx::B2DPolyPolygon(basegfx::tools::createPolygonFromRect(aCommonArea)), xMasterPageSequence));
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xReference);
+ }
+ }
+
+ // return grouped primitive
+ return xRetval;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
new file mode 100644
index 000000000000..945d5ff982b1
--- /dev/null
+++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
@@ -0,0 +1,352 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/viewobjectcontactofpageobj.hxx>
+#include <svx/sdr/contact/viewcontactofpageobj.hxx>
+#include <svx/svdopage.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/unoapi.hxx>
+#include <drawinglayer/primitive2d/pagepreviewprimitive2d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ class PagePrimitiveExtractor : public ObjectContactOfPagePainter, public Timer
+ {
+ private:
+ // the ViewObjectContactOfPageObj using this painter
+ ViewObjectContactOfPageObj& mrViewObjectContactOfPageObj;
+
+ public:
+ // basic constructor/destructor
+ PagePrimitiveExtractor(ViewObjectContactOfPageObj& rVOC);
+ virtual ~PagePrimitiveExtractor();
+
+ // LazyInvalidate request. Supported here to not automatically
+ // invalidate the second interaction state all the time at the
+ // original OC
+ virtual void setLazyInvalidate(ViewObjectContact& rVOC);
+
+ // From baseclass Timer, the timeout call triggered by te LazyInvalidate mechanism
+ virtual void Timeout();
+
+ // get primitive visualization
+ drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequenceForPage(const DisplayInfo& rDisplayInfo);
+
+ // Own reaction on changes which will be forwarded to the OC of the owner-VOC
+ virtual void InvalidatePartOfView(const basegfx::B2DRange& rRange) const;
+
+ // forward access to SdrPageView of ViewObjectContactOfPageObj
+ virtual bool isOutputToPrinter() const;
+ virtual bool isOutputToWindow() const;
+ virtual bool isOutputToVirtualDevice() const;
+ virtual bool isOutputToRecordingMetaFile() const;
+ virtual bool isOutputToPDFFile() const;
+ virtual bool isDrawModeGray() const;
+ virtual bool isDrawModeBlackWhite() const;
+ virtual bool isDrawModeHighContrast() const;
+ virtual SdrPageView* TryToGetSdrPageView() const;
+ virtual OutputDevice* TryToGetOutputDevice() const;
+ };
+
+ PagePrimitiveExtractor::PagePrimitiveExtractor(
+ ViewObjectContactOfPageObj& rVOC)
+ : ObjectContactOfPagePainter(0, rVOC.GetObjectContact()),
+ mrViewObjectContactOfPageObj(rVOC)
+ {
+ // make this renderer a preview renderer
+ setPreviewRenderer(true);
+
+ // init timer
+ SetTimeout(1);
+ Stop();
+ }
+
+ PagePrimitiveExtractor::~PagePrimitiveExtractor()
+ {
+ // execute missing LazyInvalidates and stop timer
+ Timeout();
+ }
+
+ void PagePrimitiveExtractor::setLazyInvalidate(ViewObjectContact& /*rVOC*/)
+ {
+ // do NOT call parent, but remember that something is to do by
+ // starting the LazyInvalidateTimer
+ Start();
+ }
+
+ // From baseclass Timer, the timeout call triggered by te LazyInvalidate mechanism
+ void PagePrimitiveExtractor::Timeout()
+ {
+ // stop the timer
+ Stop();
+
+ // invalidate all LazyInvalidate VOCs new situations
+ const sal_uInt32 nVOCCount(getViewObjectContactCount());
+
+ for(sal_uInt32 a(0); a < nVOCCount; a++)
+ {
+ ViewObjectContact* pCandidate = getViewObjectContact(a);
+ pCandidate->triggerLazyInvalidate();
+ }
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence PagePrimitiveExtractor::createPrimitive2DSequenceForPage(const DisplayInfo& /*rDisplayInfo*/)
+ {
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+ const SdrPage* pStartPage = GetStartPage();
+
+ if(pStartPage)
+ {
+ // update own ViewInformation2D for visualized page
+ const drawinglayer::geometry::ViewInformation2D& rOriginalViewInformation = mrViewObjectContactOfPageObj.GetObjectContact().getViewInformation2D();
+ const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D(
+ rOriginalViewInformation.getObjectTransformation(),
+ rOriginalViewInformation.getViewTransformation(),
+
+ // #i101075# use empty range for page content here to force
+ // the content not to be physically clipped in any way. This
+ // would be possible, but would require the internal transformation
+ // which maps between the page visualisation object and the page
+ // content, including the aspect ratios (for details see in
+ // PagePreviewPrimitive2D::create2DDecomposition)
+ basegfx::B2DRange(),
+
+ GetXDrawPageForSdrPage(const_cast< SdrPage* >(pStartPage)),
+ 0.0, // no time; page previews are not animated
+ rOriginalViewInformation.getExtendedInformationSequence());
+ updateViewInformation2D(aNewViewInformation2D);
+
+ // create copy of DisplayInfo to set PagePainting
+ DisplayInfo aDisplayInfo;
+
+ // get page's VOC
+ ViewObjectContact& rDrawPageVOContact = pStartPage->GetViewContact().GetViewObjectContact(*this);
+
+ // get whole Primitive2DSequence
+ xRetval = rDrawPageVOContact.getPrimitive2DSequenceHierarchy(aDisplayInfo);
+ }
+
+ return xRetval;
+ }
+
+ void PagePrimitiveExtractor::InvalidatePartOfView(const basegfx::B2DRange& rRange) const
+ {
+ // an invalidate is called at this view, this needs to be translated to an invalidate
+ // for the using VOC. Coordinates are in page coordinate system.
+ const SdrPage* pStartPage = GetStartPage();
+
+ if(pStartPage && !rRange.isEmpty())
+ {
+ const basegfx::B2DRange aPageRange(0.0, 0.0, (double)pStartPage->GetWdt(), (double)pStartPage->GetHgt());
+
+ if(rRange.overlaps(aPageRange))
+ {
+ // if object on the page is inside or overlapping with page, create ActionChanged() for
+ // involved VOC
+ mrViewObjectContactOfPageObj.ActionChanged();
+ }
+ }
+ }
+
+ // forward access to SdrPageView to VOCOfPageObj
+ bool PagePrimitiveExtractor::isOutputToPrinter() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToPrinter(); }
+ bool PagePrimitiveExtractor::isOutputToWindow() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToWindow(); }
+ bool PagePrimitiveExtractor::isOutputToVirtualDevice() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToVirtualDevice(); }
+ bool PagePrimitiveExtractor::isOutputToRecordingMetaFile() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToRecordingMetaFile(); }
+ bool PagePrimitiveExtractor::isOutputToPDFFile() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToPDFFile(); }
+ bool PagePrimitiveExtractor::isDrawModeGray() const { return mrViewObjectContactOfPageObj.GetObjectContact().isDrawModeGray(); }
+ bool PagePrimitiveExtractor::isDrawModeBlackWhite() const { return mrViewObjectContactOfPageObj.GetObjectContact().isDrawModeBlackWhite(); }
+ bool PagePrimitiveExtractor::isDrawModeHighContrast() const { return mrViewObjectContactOfPageObj.GetObjectContact().isDrawModeHighContrast(); }
+ SdrPageView* PagePrimitiveExtractor::TryToGetSdrPageView() const { return mrViewObjectContactOfPageObj.GetObjectContact().TryToGetSdrPageView(); }
+ OutputDevice* PagePrimitiveExtractor::TryToGetOutputDevice() const { return mrViewObjectContactOfPageObj.GetObjectContact().TryToGetOutputDevice(); }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfPageObj::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const
+ {
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+ const SdrPageObj& rPageObject((static_cast< ViewContactOfPageObj& >(GetViewContact())).GetPageObj());
+ const SdrPage* pPage = rPageObject.GetReferencedPage();
+ const svtools::ColorConfig aColorConfig;
+
+ // get PageObject's geometry
+ basegfx::B2DHomMatrix aPageObjectTransform;
+ {
+ const Rectangle aPageObjectModelData(rPageObject.GetLastBoundRect());
+ const basegfx::B2DRange aPageObjectBound(
+ aPageObjectModelData.Left(), aPageObjectModelData.Top(),
+ aPageObjectModelData.Right(), aPageObjectModelData.Bottom());
+
+ aPageObjectTransform.set(0, 0, aPageObjectBound.getWidth());
+ aPageObjectTransform.set(1, 1, aPageObjectBound.getHeight());
+ aPageObjectTransform.set(0, 2, aPageObjectBound.getMinX());
+ aPageObjectTransform.set(1, 2, aPageObjectBound.getMinY());
+ }
+
+ // #i102637# add gray frame also when printing and page exists (handout pages)
+ const bool bCreateGrayFrame(!GetObjectContact().isOutputToPrinter() || pPage);
+
+ // get displayed page's content. This is the uscaled page content
+ if(mpExtractor && pPage)
+ {
+ // get displayed page's geometry
+ drawinglayer::primitive2d::Primitive2DSequence xPageContent;
+ const Size aPageSize(pPage->GetSize());
+ const double fPageWidth(aPageSize.getWidth());
+ const double fPageHeight(aPageSize.getHeight());
+
+ // The case that a PageObject contains another PageObject which visualizes the
+ // same page again would lead to a recursion. Limit that recursion depth to one
+ // by using a local static bool
+ static bool bInCreatePrimitive2D(false);
+
+ if(bInCreatePrimitive2D)
+ {
+ // Recursion is possible. Create a replacement primitive
+ xPageContent.realloc(2);
+ const Color aDocColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
+ const Color aBorderColor(aColorConfig.GetColorValue(svtools::DOCBOUNDARIES).nColor);
+ const basegfx::B2DRange aPageBound(0.0, 0.0, fPageWidth, fPageHeight);
+ const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aPageBound));
+
+ // add replacement fill
+ xPageContent[0L] = drawinglayer::primitive2d::Primitive2DReference(
+ new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aOutline), aDocColor.getBColor()));
+
+ // add replacement border
+ xPageContent[1L] = drawinglayer::primitive2d::Primitive2DReference(
+ new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aBorderColor.getBColor()));
+ }
+ else
+ {
+ // set recursion flag
+ bInCreatePrimitive2D = true;
+
+ // init extractor, guarantee existance, set page there
+ mpExtractor->SetStartPage(pPage);
+
+ // #i105548# also need to copy the VOCRedirector for sub-content creation
+ mpExtractor->SetViewObjectContactRedirector(GetObjectContact().GetViewObjectContactRedirector());
+
+ // create page content
+ xPageContent = mpExtractor->createPrimitive2DSequenceForPage(rDisplayInfo);
+
+ // #i105548# reset VOCRedirector to not accidentially have a pointer to a
+ // temporary class, so calls to it are avoided safely
+ mpExtractor->SetViewObjectContactRedirector(0);
+
+ // reset recursion flag
+ bInCreatePrimitive2D = false;
+ }
+
+ // prepare retval
+ if(xPageContent.hasElements())
+ {
+ const uno::Reference< drawing::XDrawPage > xDrawPage(GetXDrawPageForSdrPage(const_cast< SdrPage*>(pPage)));
+ const drawinglayer::primitive2d::Primitive2DReference xPagePreview(new drawinglayer::primitive2d::PagePreviewPrimitive2D(
+ xDrawPage, aPageObjectTransform, fPageWidth, fPageHeight, xPageContent, true));
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xPagePreview, 1);
+ }
+ }
+ else if(bCreateGrayFrame)
+ {
+ // #i105146# no content, but frame display. To make hitting the page preview objects
+ // on the handout page more simple, add hidden fill geometry
+ const drawinglayer::primitive2d::Primitive2DReference xFrameHit(
+ drawinglayer::primitive2d::createHiddenGeometryPrimitives2D(
+ false,
+ aPageObjectTransform));
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xFrameHit, 1);
+ }
+
+ // add a gray outline frame, except not when printing
+ if(bCreateGrayFrame)
+ {
+ const Color aFrameColor(aColorConfig.GetColorValue(svtools::OBJECTBOUNDARIES).nColor);
+ basegfx::B2DPolygon aOwnOutline(basegfx::tools::createUnitPolygon());
+ aOwnOutline.transform(aPageObjectTransform);
+
+ const drawinglayer::primitive2d::Primitive2DReference xGrayFrame(
+ new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOwnOutline, aFrameColor.getBColor()));
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xGrayFrame);
+ }
+
+ return xRetval;
+ }
+
+ ViewObjectContactOfPageObj::ViewObjectContactOfPageObj(ObjectContact& rObjectContact, ViewContact& rViewContact)
+ : ViewObjectContactOfSdrObj(rObjectContact, rViewContact),
+ mpExtractor(new PagePrimitiveExtractor(*this))
+ {
+ }
+
+ ViewObjectContactOfPageObj::~ViewObjectContactOfPageObj()
+ {
+ // delete the helper OC
+ if(mpExtractor)
+ {
+ // remember candidate and reset own pointer to avoid action when createPrimitive2DSequence()
+ // would be called for any reason
+ PagePrimitiveExtractor* pCandidate = mpExtractor;
+ mpExtractor = 0;
+
+ // also reset the StartPage to avoid ActionChanged() forwardings in the
+ // PagePrimitiveExtractor::InvalidatePartOfView() implementation
+ pCandidate->SetStartPage(0);
+ delete pCandidate;
+ }
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx
new file mode 100644
index 000000000000..6785f69f556b
--- /dev/null
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx
@@ -0,0 +1,176 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/objectcontactofpageview.hxx>
+#include <svx/sdr/contact/viewobjectcontactofsdrmediaobj.hxx>
+#include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/svdomedia.hxx>
+#include <svx/svdpagv.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/window.hxx>
+#include <avmedia/mediaitem.hxx>
+#include "sdrmediawindow.hxx"
+#include <svx/sdrpagewindow.hxx>
+#include <svx/sdrpaintwindow.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr { namespace contact {
+
+// ----------------------------------
+// - ViewObjectContactOfSdrMediaObj -
+// ----------------------------------
+
+ViewObjectContactOfSdrMediaObj::ViewObjectContactOfSdrMediaObj( ObjectContact& rObjectContact,
+ ViewContact& rViewContact,
+ const ::avmedia::MediaItem& rMediaItem ) :
+ ViewObjectContactOfSdrObj( rObjectContact, rViewContact ),
+ mpMediaWindow( NULL )
+{
+ Window* pWindow = getWindow();
+
+ if( pWindow )
+ {
+ mpMediaWindow = new SdrMediaWindow( pWindow, *this );
+ mpMediaWindow->hide();
+ executeMediaItem( rMediaItem );
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+ViewObjectContactOfSdrMediaObj::~ViewObjectContactOfSdrMediaObj()
+{
+ delete mpMediaWindow;
+ mpMediaWindow = NULL;
+}
+
+// ------------------------------------------------------------------------------
+
+Window* ViewObjectContactOfSdrMediaObj::getWindow() const
+{
+ Window* pRetval = 0;
+
+ const ObjectContactOfPageView* pObjectContactOfPageView = dynamic_cast< const ObjectContactOfPageView* >(&GetObjectContact());
+
+ if(pObjectContactOfPageView)
+ {
+ const SdrPageWindow& rPageWindow = pObjectContactOfPageView->GetPageWindow();
+ const SdrPaintWindow* pPaintWindow = &rPageWindow.GetPaintWindow();
+
+ if(rPageWindow.GetOriginalPaintWindow())
+ {
+ // #i83183# prefer OriginalPaintWindow if set; this is
+ // the real target device. GetPaintWindow() may return
+ // the current buffer device instead
+ pPaintWindow = rPageWindow.GetOriginalPaintWindow();
+ }
+
+ OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
+
+ if(OUTDEV_WINDOW == rOutDev.GetOutDevType())
+ {
+ pRetval = static_cast< Window* >(&rOutDev);
+ }
+ }
+
+ return pRetval;
+}
+
+// ------------------------------------------------------------------------------
+
+bool ViewObjectContactOfSdrMediaObj::hasPreferredSize() const
+{
+ return( mpMediaWindow != NULL && mpMediaWindow->hasPreferredSize() );
+}
+
+// ------------------------------------------------------------------------------
+
+Size ViewObjectContactOfSdrMediaObj::getPreferredSize() const
+{
+ Size aRet;
+
+ if( mpMediaWindow )
+ aRet = mpMediaWindow->getPreferredSize();
+
+ return aRet;
+}
+
+// ------------------------------------------------------------------------------
+
+void ViewObjectContactOfSdrMediaObj::updateMediaItem( ::avmedia::MediaItem& rItem ) const
+{
+ if( mpMediaWindow )
+ {
+ mpMediaWindow->updateMediaItem( rItem );
+
+ // show/hide is now dependent of play state
+ if(avmedia::MEDIASTATE_STOP == rItem.getState())
+ {
+ mpMediaWindow->hide();
+ }
+ else
+ {
+ basegfx::B2DRange aViewRange(getObjectRange());
+ aViewRange.transform(GetObjectContact().getViewInformation2D().getViewTransformation());
+
+ const Rectangle aViewRectangle(
+ (sal_Int32)floor(aViewRange.getMinX()), (sal_Int32)floor(aViewRange.getMinY()),
+ (sal_Int32)ceil(aViewRange.getMaxX()), (sal_Int32)ceil(aViewRange.getMaxY()));
+
+ mpMediaWindow->setPosSize(aViewRectangle);
+ mpMediaWindow->show();
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+void ViewObjectContactOfSdrMediaObj::executeMediaItem( const ::avmedia::MediaItem& rItem )
+{
+ if( mpMediaWindow )
+ {
+ ::avmedia::MediaItem aUpdatedItem;
+
+ mpMediaWindow->executeMediaItem( rItem );
+
+ // query new properties after trying to set the new properties
+ updateMediaItem( aUpdatedItem );
+ static_cast< ViewContactOfSdrMediaObj& >( GetViewContact() ).mediaPropertiesChanged( aUpdatedItem );
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+}} // end of namespace sdr::contact
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx
new file mode 100755
index 000000000000..485afe35f9c1
--- /dev/null
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrobj.cxx
@@ -0,0 +1,152 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/viewobjectcontactofsdrobj.hxx>
+#include <svx/sdr/contact/viewcontactofsdrobj.hxx>
+#include <svx/sdr/contact/objectcontact.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/svdview.hxx>
+
+#include "fmobj.hxx"
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ const SdrObject& ViewObjectContactOfSdrObj::getSdrObject() const
+ {
+ return static_cast< ViewContactOfSdrObj& >(GetViewContact()).GetSdrObject();
+ }
+
+ ViewObjectContactOfSdrObj::ViewObjectContactOfSdrObj(ObjectContact& rObjectContact, ViewContact& rViewContact)
+ : ViewObjectContact(rObjectContact, rViewContact)
+ {
+ }
+
+ ViewObjectContactOfSdrObj::~ViewObjectContactOfSdrObj()
+ {
+ }
+
+ bool ViewObjectContactOfSdrObj::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
+ {
+ const SdrObject& rObject = getSdrObject();
+
+ // Test layer visibility
+ if(!rDisplayInfo.GetProcessLayers().IsSet(rObject.GetLayer()))
+ {
+ return false;
+ }
+
+ if(GetObjectContact().isOutputToPrinter() )
+ {
+ // Test if print output but not printable
+ if( !rObject.IsPrintable())
+ return false;
+ }
+ else
+ {
+ // test is object is not visible on screen
+ if( !rObject.IsVisible() )
+ return false;
+ }
+
+ // Test for hidden object on MasterPage
+ if(rDisplayInfo.GetSubContentActive() && rObject.IsNotVisibleAsMaster())
+ {
+ return false;
+ }
+
+ // Test for Calc object hiding (for OLE and Graphic it's extra, see there)
+ const SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView();
+
+ if(pSdrPageView)
+ {
+ const SdrView& rSdrView = pSdrPageView->GetView();
+ const bool bHideOle(rSdrView.getHideOle());
+ const bool bHideChart(rSdrView.getHideChart());
+ const bool bHideDraw(rSdrView.getHideDraw());
+ const bool bHideFormControl(rSdrView.getHideFormControl());
+
+ if(bHideOle || bHideChart || bHideDraw || bHideFormControl)
+ {
+ if(OBJ_OLE2 == rObject.GetObjIdentifier())
+ {
+ if(((SdrOle2Obj&)rObject).IsChart())
+ {
+ // chart
+ if(bHideChart)
+ {
+ return false;
+ }
+ }
+ else
+ {
+ // OLE
+ if(bHideOle)
+ {
+ return false;
+ }
+ }
+ }
+ else if(OBJ_GRAF == rObject.GetObjIdentifier())
+ {
+ // graphic handled like OLE
+ if(bHideOle)
+ {
+ return false;
+ }
+ }
+ else
+ {
+ const bool bIsFormControl = dynamic_cast< const FmFormObj * >( &rObject ) != 0;
+ if(bIsFormControl && bHideFormControl)
+ {
+ return false;
+ }
+ // any other draw object
+ if(!bIsFormControl && bHideDraw)
+ {
+ return false;
+ }
+ }
+ }
+ }
+
+ return true;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
new file mode 100644
index 000000000000..b1a4826609f9
--- /dev/null
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
@@ -0,0 +1,243 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/viewobjectcontactofsdrole2obj.hxx>
+#include <svx/sdr/contact/viewobjectcontactofsdrobj.hxx>
+#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/primitive2d/polypolygonprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <com/sun/star/embed/EmbedMisc.hpp>
+#include <com/sun/star/embed/EmbedStates.hpp>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ const SdrOle2Obj& ViewObjectContactOfSdrOle2Obj::getSdrOle2Object() const
+ {
+ return static_cast< ViewContactOfSdrOle2Obj& >(GetViewContact()).GetOle2Obj();
+ }
+
+ 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();
+ sal_Int32 nState(-1);
+
+ {
+ const svt::EmbeddedObjectRef& xObjRef = rSdrOle2.getEmbeddedObjectRef();
+ if ( xObjRef.is() )
+ nState = xObjRef->getCurrentState();
+ }
+
+ 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());
+ bool bDone(false);
+
+ if(!bDone && bIsInplaceActive)
+ {
+ if( !GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile() )
+ {
+ //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!
+ bDone = true;
+ }
+ }
+
+ if( !bDone )
+ {
+ 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)
+ {
+ //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;
+ }
+ }
+
+ if( !bDone )
+ {
+ //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()));
+
+ // 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
+
+ // create OLE primitive stuff directly at VC with HC as parameter
+ const ViewContactOfSdrOle2Obj& rVC = static_cast< const ViewContactOfSdrOle2Obj& >(GetViewContact());
+ xRetval = rVC.createPrimitive2DSequenceWithParameters(GetObjectContact().isDrawModeHighContrast());
+ }
+
+ 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::createUnitPolygon());
+ 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;
+ }
+
+ ViewObjectContactOfSdrOle2Obj::ViewObjectContactOfSdrOle2Obj(ObjectContact& rObjectContact, ViewContact& rViewContact)
+ : ViewObjectContactOfSdrObj(rObjectContact, rViewContact)
+ {
+ }
+
+ ViewObjectContactOfSdrOle2Obj::~ViewObjectContactOfSdrOle2Obj()
+ {
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx
new file mode 100644
index 000000000000..f7145dcd9d73
--- /dev/null
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx
@@ -0,0 +1,729 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/viewobjectcontactofsdrpage.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/sdr/contact/viewcontactofsdrpage.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/sdr/contact/objectcontact.hxx>
+#include <drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/gridprimitive2d.hxx>
+#include <drawinglayer/primitive2d/helplineprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <svx/sdr/primitive2d/sdrprimitivetools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ const SdrPage& ViewObjectContactOfPageSubObject::getPage() const
+ {
+ return static_cast< ViewContactOfPageSubObject& >(GetViewContact()).getPage();
+ }
+
+ ViewObjectContactOfPageSubObject::ViewObjectContactOfPageSubObject(ObjectContact& rObjectContact, ViewContact& rViewContact)
+ : ViewObjectContact(rObjectContact, rViewContact)
+ {
+ }
+
+ ViewObjectContactOfPageSubObject::~ViewObjectContactOfPageSubObject()
+ {
+ }
+
+ bool ViewObjectContactOfPageSubObject::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
+ {
+ if(rDisplayInfo.GetSubContentActive())
+ {
+ return false;
+ }
+
+ if(rDisplayInfo.GetControlLayerProcessingActive())
+ {
+ return false;
+ }
+
+ if(!rDisplayInfo.GetPageProcessingActive())
+ {
+ return false;
+ }
+
+ if(GetObjectContact().isOutputToPrinter())
+ {
+ return false;
+ }
+
+ if(!GetObjectContact().TryToGetSdrPageView())
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ bool ViewObjectContactOfPageSubObject::isPrimitiveGhosted(const DisplayInfo& /*rDisplayInfo*/) const
+ {
+ // suppress ghosted for page parts
+ return false;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewObjectContactOfPageBackground::ViewObjectContactOfPageBackground(ObjectContact& rObjectContact, ViewContact& rViewContact)
+ : ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
+ {
+ }
+
+ ViewObjectContactOfPageBackground::~ViewObjectContactOfPageBackground()
+ {
+ }
+
+ bool ViewObjectContactOfPageBackground::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
+ {
+ if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo))
+ {
+ return false;
+ }
+
+ // no page background for preview renderers
+ if(GetObjectContact().IsPreviewRenderer())
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfPageBackground::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/) const
+ {
+ // Initialize background. Dependent of IsPageVisible, use ApplicationBackgroundColor or ApplicationDocumentColor. Most
+ // old renderers for export (html, pdf, gallery, ...) set the page to not visible (SetPageVisible(false)). They expect the
+ // given OutputDevice to be initialized with the ApplicationDocumentColor then.
+ const SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView();
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+
+ if(pPageView)
+ {
+ const SdrView& rView = pPageView->GetView();
+ Color aInitColor;
+
+ if(rView.IsPageVisible())
+ {
+ aInitColor = pPageView->GetApplicationBackgroundColor();
+ }
+ else
+ {
+ aInitColor = pPageView->GetApplicationDocumentColor();
+
+ if(Color(COL_AUTO) == aInitColor)
+ {
+ const svtools::ColorConfig aColorConfig;
+ aInitColor = aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor;
+ }
+ }
+
+ // init background with InitColor
+ xRetval.realloc(1);
+ const basegfx::BColor aRGBColor(aInitColor.getBColor());
+ xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor));
+ }
+
+ return xRetval;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewObjectContactOfMasterPage::ViewObjectContactOfMasterPage(ObjectContact& rObjectContact, ViewContact& rViewContact)
+ : ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
+ {
+ }
+
+ ViewObjectContactOfMasterPage::~ViewObjectContactOfMasterPage()
+ {
+ }
+
+ bool ViewObjectContactOfMasterPage::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
+ {
+ if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo))
+ {
+ return false;
+ }
+
+ // this object is only used for MasterPages. When not the MasterPage is
+ // displayed as a page, but another page is using it as sub-object, the
+ // geometry needs to be hidden
+ if(rDisplayInfo.GetSubContentActive())
+ {
+ return false;
+ }
+
+ return true;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewObjectContactOfPageFill::ViewObjectContactOfPageFill(ObjectContact& rObjectContact, ViewContact& rViewContact)
+ : ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
+ {
+ }
+
+ ViewObjectContactOfPageFill::~ViewObjectContactOfPageFill()
+ {
+ }
+
+ bool ViewObjectContactOfPageFill::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
+ {
+ if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo))
+ {
+ return false;
+ }
+
+ SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView();
+
+ if(!pSdrPageView)
+ {
+ return false;
+ }
+
+ if(!pSdrPageView->GetView().IsPageVisible())
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfPageFill::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/) const
+ {
+ const SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView();
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+
+ if(pPageView)
+ {
+ const SdrPage& rPage = getPage();
+
+ const basegfx::B2DRange aPageFillRange(0.0, 0.0, (double)rPage.GetWdt(), (double)rPage.GetHgt());
+ const basegfx::B2DPolygon aPageFillPolygon(basegfx::tools::createPolygonFromRect(aPageFillRange));
+ Color aPageFillColor;
+
+ if(pPageView->GetApplicationDocumentColor() != COL_AUTO)
+ {
+ aPageFillColor = pPageView->GetApplicationDocumentColor();
+ }
+ else
+ {
+ const svtools::ColorConfig aColorConfig;
+ aPageFillColor = aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor;
+ }
+
+ // create and add primitive
+ xRetval.realloc(1);
+ const basegfx::BColor aRGBColor(aPageFillColor.getBColor());
+ xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPageFillPolygon), aRGBColor));
+ }
+
+ return xRetval;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewObjectContactOfPageShadow::ViewObjectContactOfPageShadow(ObjectContact& rObjectContact, ViewContact& rViewContact)
+ : ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
+ {
+ }
+
+ ViewObjectContactOfPageShadow::~ViewObjectContactOfPageShadow()
+ {
+ }
+
+ bool ViewObjectContactOfPageShadow::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
+ {
+ if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo))
+ {
+ return false;
+ }
+
+ SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView();
+
+ if(!pSdrPageView)
+ {
+ return false;
+ }
+
+ if(!pSdrPageView->GetView().IsPageVisible())
+ {
+ return false;
+ }
+
+ // no page shadow for preview renderers
+ if(GetObjectContact().IsPreviewRenderer())
+ {
+ return false;
+ }
+
+ // no page shadow for high contrast mode
+ if(GetObjectContact().isDrawModeHighContrast())
+ {
+ return false;
+ }
+
+ return true;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewObjectContactOfOuterPageBorder::ViewObjectContactOfOuterPageBorder(ObjectContact& rObjectContact, ViewContact& rViewContact)
+ : ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
+ {
+ }
+
+ ViewObjectContactOfOuterPageBorder::~ViewObjectContactOfOuterPageBorder()
+ {
+ }
+
+ bool ViewObjectContactOfOuterPageBorder::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
+ {
+ if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo))
+ {
+ return false;
+ }
+
+ SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView();
+
+ if(!pSdrPageView)
+ {
+ return false;
+ }
+
+ const SdrView& rView = pSdrPageView->GetView();
+
+ if(!rView.IsPageVisible() && rView.IsPageBorderVisible())
+ {
+ return false;
+ }
+
+ return true;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewObjectContactOfInnerPageBorder::ViewObjectContactOfInnerPageBorder(ObjectContact& rObjectContact, ViewContact& rViewContact)
+ : ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
+ {
+ }
+
+ ViewObjectContactOfInnerPageBorder::~ViewObjectContactOfInnerPageBorder()
+ {
+ }
+
+ bool ViewObjectContactOfInnerPageBorder::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
+ {
+ if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo))
+ {
+ return false;
+ }
+
+ SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView();
+
+ if(!pSdrPageView)
+ {
+ return false;
+ }
+
+ if(!pSdrPageView->GetView().IsBordVisible())
+ {
+ return false;
+ }
+
+ const SdrPage& rPage = getPage();
+
+ if(!rPage.GetLftBorder() && !rPage.GetUppBorder() && !rPage.GetRgtBorder() && !rPage.GetLwrBorder())
+ {
+ return false;
+ }
+
+ // no inner page border for preview renderers
+ if(GetObjectContact().IsPreviewRenderer())
+ {
+ return false;
+ }
+
+ return true;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewObjectContactOfPageHierarchy::ViewObjectContactOfPageHierarchy(ObjectContact& rObjectContact, ViewContact& rViewContact)
+ : ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
+ {
+ }
+
+ ViewObjectContactOfPageHierarchy::~ViewObjectContactOfPageHierarchy()
+ {
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfPageHierarchy::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const
+ {
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+
+ // process local sub-hierarchy
+ const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount());
+
+ if(nSubHierarchyCount)
+ {
+ xRetval = getPrimitive2DSequenceSubHierarchy(rDisplayInfo);
+
+ if(xRetval.hasElements())
+ {
+ // get ranges
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
+ const basegfx::B2DRange aObjectRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xRetval, rViewInformation2D));
+ const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport());
+
+ // check geometrical visibility
+ if(!aViewRange.isEmpty() && !aViewRange.overlaps(aObjectRange))
+ {
+ // not visible, release
+ xRetval.realloc(0);
+ }
+ }
+ }
+
+ return xRetval;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewObjectContactOfPageGrid::ViewObjectContactOfPageGrid(ObjectContact& rObjectContact, ViewContact& rViewContact)
+ : ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
+ {
+ }
+
+ ViewObjectContactOfPageGrid::~ViewObjectContactOfPageGrid()
+ {
+ }
+
+ bool ViewObjectContactOfPageGrid::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
+ {
+ if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo))
+ {
+ return false;
+ }
+
+ SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView();
+
+ if(!pSdrPageView)
+ {
+ return false;
+ }
+
+ const SdrView& rView = pSdrPageView->GetView();
+
+ if(!rView.IsGridVisible())
+ {
+ return false;
+ }
+
+ // no page grid for preview renderers
+ if(GetObjectContact().IsPreviewRenderer())
+ {
+ return false;
+ }
+
+ if(static_cast< ViewContactOfGrid& >(GetViewContact()).getFront() != (bool)rView.IsGridFront())
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfPageGrid::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/) const
+ {
+ const SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView();
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+
+ if(pPageView)
+ {
+ const SdrView& rView = pPageView->GetView();
+ const SdrPage& rPage = getPage();
+ const Color aGridColor(rView.GetGridColor());
+ const basegfx::BColor aRGBGridColor(aGridColor.getBColor());
+
+ basegfx::B2DHomMatrix aGridMatrix;
+ aGridMatrix.set(0, 0, (double)(rPage.GetWdt() - (rPage.GetRgtBorder() + rPage.GetLftBorder())));
+ aGridMatrix.set(1, 1, (double)(rPage.GetHgt() - (rPage.GetLwrBorder() + rPage.GetUppBorder())));
+ aGridMatrix.set(0, 2, (double)rPage.GetLftBorder());
+ aGridMatrix.set(1, 2, (double)rPage.GetUppBorder());
+
+ const Size aRaw(rView.GetGridCoarse());
+ const Size aFine(rView.GetGridFine());
+ const double fWidthX(aRaw.getWidth());
+ const double fWidthY(aRaw.getHeight());
+ const sal_uInt32 nSubdivisionsX(aFine.getWidth() ? aRaw.getWidth() / aFine.getWidth() : 0L);
+ const sal_uInt32 nSubdivisionsY(aFine.getHeight() ? aRaw.getHeight() / aFine.getHeight() : 0L);
+
+ xRetval.realloc(1);
+ xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::GridPrimitive2D(
+ aGridMatrix, fWidthX, fWidthY, 10.0, 3.0, nSubdivisionsX, nSubdivisionsY, aRGBGridColor,
+ drawinglayer::primitive2d::createDefaultCross_3x3(aRGBGridColor)));
+ }
+
+ return xRetval;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewObjectContactOfPageHelplines::ViewObjectContactOfPageHelplines(ObjectContact& rObjectContact, ViewContact& rViewContact)
+ : ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
+ {
+ }
+
+ ViewObjectContactOfPageHelplines::~ViewObjectContactOfPageHelplines()
+ {
+ }
+
+ bool ViewObjectContactOfPageHelplines::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
+ {
+ if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo))
+ {
+ return false;
+ }
+
+ SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView();
+
+ if(!pSdrPageView)
+ {
+ return false;
+ }
+
+ const SdrView& rView = pSdrPageView->GetView();
+
+ if(!rView.IsHlplVisible())
+ {
+ return false;
+ }
+
+ // no helplines for preview renderers
+ if(GetObjectContact().IsPreviewRenderer())
+ {
+ return false;
+ }
+
+ if(static_cast< ViewContactOfHelplines& >(GetViewContact()).getFront() != (bool)rView.IsHlplFront())
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfPageHelplines::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/) const
+ {
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+ const SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView();
+
+ if(pPageView)
+ {
+ const SdrHelpLineList& rHelpLineList = pPageView->GetHelpLines();
+ const sal_uInt32 nCount(rHelpLineList.GetCount());
+
+ if(nCount)
+ {
+ const basegfx::BColor aRGBColorA(1.0, 1.0, 1.0);
+ const basegfx::BColor aRGBColorB(0.0, 0.0, 0.0);
+ xRetval.realloc(nCount);
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ const SdrHelpLine& rHelpLine = rHelpLineList[(sal_uInt16)a];
+ const basegfx::B2DPoint aPosition((double)rHelpLine.GetPos().X(), (double)rHelpLine.GetPos().Y());
+ const double fDiscreteDashLength(4.0);
+
+ switch(rHelpLine.GetKind())
+ {
+ default : // SDRHELPLINE_POINT
+ {
+ xRetval[a] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::HelplinePrimitive2D(
+ aPosition, basegfx::B2DVector(1.0, 0.0), drawinglayer::primitive2d::HELPLINESTYLE2D_POINT,
+ aRGBColorA, aRGBColorB, fDiscreteDashLength));
+ break;
+ }
+ case SDRHELPLINE_VERTICAL :
+ {
+ xRetval[a] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::HelplinePrimitive2D(
+ aPosition, basegfx::B2DVector(0.0, 1.0), drawinglayer::primitive2d::HELPLINESTYLE2D_LINE,
+ aRGBColorA, aRGBColorB, fDiscreteDashLength));
+ break;
+ }
+ case SDRHELPLINE_HORIZONTAL :
+ {
+ xRetval[a] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::HelplinePrimitive2D(
+ aPosition, basegfx::B2DVector(1.0, 0.0), drawinglayer::primitive2d::HELPLINESTYLE2D_LINE,
+ aRGBColorA, aRGBColorB, fDiscreteDashLength));
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return xRetval;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ ViewObjectContactOfSdrPage::ViewObjectContactOfSdrPage(ObjectContact& rObjectContact, ViewContact& rViewContact)
+ : ViewObjectContact(rObjectContact, rViewContact)
+ {
+ }
+
+ ViewObjectContactOfSdrPage::~ViewObjectContactOfSdrPage()
+ {
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfSdrPage::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const
+ {
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+
+ // process local sub-hierarchy
+ const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount());
+
+ if(nSubHierarchyCount)
+ {
+ const sal_Bool bDoGhostedDisplaying(
+ GetObjectContact().DoVisualizeEnteredGroup()
+ && !GetObjectContact().isOutputToPrinter()
+ && GetObjectContact().getActiveViewContact() == &GetViewContact());
+
+ if(bDoGhostedDisplaying)
+ {
+ rDisplayInfo.ClearGhostedDrawMode();
+ }
+
+ // create object hierarchy
+ xRetval = getPrimitive2DSequenceSubHierarchy(rDisplayInfo);
+
+ if(xRetval.hasElements())
+ {
+ // get ranges
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
+ const basegfx::B2DRange aObjectRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xRetval, rViewInformation2D));
+ const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport());
+
+ // check geometrical visibility
+ if(!aViewRange.isEmpty() && !aViewRange.overlaps(aObjectRange))
+ {
+ // not visible, release
+ xRetval.realloc(0);
+ }
+ }
+
+ if(bDoGhostedDisplaying)
+ {
+ rDisplayInfo.SetGhostedDrawMode();
+ }
+ }
+
+ return xRetval;
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
new file mode 100755
index 000000000000..5e225e626175
--- /dev/null
+++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
@@ -0,0 +1,1937 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/contact/viewobjectcontactofunocontrol.hxx>
+#include <svx/sdr/contact/viewcontactofunocontrol.hxx>
+#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>
+#include <svx/svdouno.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdview.hxx>
+#include <svx/sdrpagewindow.hxx>
+#include "svx/sdrpaintwindow.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include <com/sun/star/awt/XWindow2.hpp>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/awt/XView.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/awt/InvalidateStyle.hpp>
+#include <com/sun/star/util/XModeChangeListener.hpp>
+#include <com/sun/star/util/XModeChangeBroadcaster.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <com/sun/star/container/XContainer.hpp>
+/** === end UNO includes === **/
+
+#include <toolkit/helper/formpdfexport.hxx>
+#include <vcl/pdfextoutdevdata.hxx>
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/scopeguard.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <tools/diagnose_ex.h>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <drawinglayer/primitive2d/controlprimitive2d.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/bind.hpp>
+
+/*
+
+Form controls (more precise: UNO Controls) in the drawing layer are ... prone to breakage, since they have some
+specialities which the drawing layer currently doesn't capture too well. In particular, having a living VCL
+window as child of the document window, and coupling this Window to a drawing layer object, makes things
+difficult sometimes.
+
+Below is a list of issues which existed in the past. Whenever you change code here, you're encouraged to
+verify those issues are still fixed. (Whenever you have some additional time, you're encouraged to write
+an automatic test for one or more of those issues for which this is possible :)
+
+http://www.openoffice.org/issues/show_bug.cgi?id=105992
+zooming documents containg (alive) form controls improperly positions the controls
+
+http://www.openoffice.org/issues/show_bug.cgi?id=104362
+crash when copy a control
+
+http://www.openoffice.org/issues/show_bug.cgi?id=104544
+Gridcontrol duplicated after design view on/off
+
+http://www.openoffice.org/issues/show_bug.cgi?id=102089
+print preview shows control elements with property printable=false
+
+http://www.openoffice.org/issues/show_bug.cgi?id=102090
+problem with setVisible on TextControl
+
+http://www.openoffice.org/issues/show_bug.cgi?id=103138
+loop when insert a control in draw
+
+http://www.openoffice.org/issues/show_bug.cgi?id=101398
+initially-displaying a document with many controls is very slow
+
+http://www.openoffice.org/issues/show_bug.cgi?id=72429
+repaint error in form wizard in bugdoc database
+
+http://www.openoffice.org/issues/show_bug.cgi?id=72694
+form control artifacts when scrolling a text fast
+
+
+issues in the old (Sun-internal) bug tracking system:
+
+#110592#
+form controls being in redlining or in hidden section are visible in alive-mode
+
+*/
+
+//........................................................................
+namespace sdr { namespace contact {
+//........................................................................
+
+ /** === begin UNO using === **/
+ using namespace ::com::sun::star::awt::InvalidateStyle;
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::awt::XControl;
+ using ::com::sun::star::lang::XMultiServiceFactory;
+ using ::com::sun::star::awt::XControlModel;
+ using ::com::sun::star::awt::XControlContainer;
+ using ::com::sun::star::awt::XWindow;
+ using ::com::sun::star::awt::XWindow2;
+ using ::com::sun::star::awt::XWindowListener;
+ using ::com::sun::star::awt::PosSize::POSSIZE;
+ using ::com::sun::star::awt::XView;
+ using ::com::sun::star::awt::XGraphics;
+ using ::com::sun::star::awt::WindowEvent;
+ using ::com::sun::star::beans::XPropertySet;
+ using ::com::sun::star::beans::XPropertySetInfo;
+ using ::com::sun::star::lang::XComponent;
+ using ::com::sun::star::awt::XWindowPeer;
+ using ::com::sun::star::beans::XPropertyChangeListener;
+ using ::com::sun::star::util::XModeChangeListener;
+ using ::com::sun::star::util::XModeChangeBroadcaster;
+ using ::com::sun::star::util::ModeChangeEvent;
+ using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::beans::PropertyChangeEvent;
+ using ::com::sun::star::lang::XComponent;
+ using ::com::sun::star::container::XContainerListener;
+ using ::com::sun::star::container::XContainer;
+ using ::com::sun::star::container::ContainerEvent;
+ using ::com::sun::star::uno::Any;
+ /** === end UNO using === **/
+
+ //====================================================================
+ //= ControlHolder
+ //====================================================================
+ class ControlHolder
+ {
+ private:
+ Reference< XControl > m_xControl;
+ Reference< XWindow2 > m_xControlWindow;
+ Reference< XView > m_xControlView;
+
+ public:
+ ControlHolder()
+ :m_xControl()
+ ,m_xControlWindow()
+ ,m_xControlView()
+ {
+ }
+
+ explicit ControlHolder( const Reference< XControl >& _rxControl )
+ :m_xControl()
+ ,m_xControlWindow()
+ ,m_xControlView()
+ {
+ *this = _rxControl;
+ }
+
+ ControlHolder& operator=( const Reference< XControl >& _rxControl )
+ {
+ clear();
+
+ m_xControl = _rxControl;
+ if ( m_xControl.is() )
+ {
+ m_xControlWindow.set( m_xControl, UNO_QUERY );
+ m_xControlView.set( m_xControl, UNO_QUERY );
+ if ( !m_xControlWindow.is() || !m_xControlView.is() )
+ {
+ OSL_ENSURE( false, "ControlHolder::operator=: invalid XControl, missing required interfaces!" );
+ clear();
+ }
+ }
+
+ return *this;
+ }
+
+ public:
+ inline bool is() const { return m_xControl.is() && m_xControlWindow.is() && m_xControlView.is(); }
+ inline void clear() { m_xControl.clear(); m_xControlWindow.clear(); m_xControlView.clear(); }
+
+ // delegators for the methods of the UNO interfaces
+ // Note all those will crash if called for a NULL object.
+ inline bool isDesignMode() const { return m_xControl->isDesignMode(); }
+ inline void setDesignMode( const bool _bDesign ) const { m_xControl->setDesignMode( _bDesign ); }
+ inline bool isVisible() const { return m_xControlWindow->isVisible(); }
+ inline void setVisible( const bool _bVisible ) const { m_xControlWindow->setVisible( _bVisible ); }
+ inline Reference< XControlModel >
+ getModel() const { return m_xControl->getModel(); }
+ inline void setModel( const Reference< XControlModel >& _m ) const { m_xControl->setModel( _m ); }
+ inline bool isTransparent() const { return m_xControl->isTransparent(); }
+ inline Reference< XWindowPeer >
+ getPeer() const { return m_xControl->getPeer(); }
+
+ 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;
+ 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 >
+ getGraphics() const { return m_xControlView->getGraphics(); }
+ inline void draw( const Point& _rTopLeft ) const { m_xControlView->draw( _rTopLeft.X(), _rTopLeft.Y() ); }
+
+ void invalidate() const;
+
+ public:
+ inline const Reference< XControl >& getControl() const { return m_xControl; }
+ };
+
+ //--------------------------------------------------------------------
+ bool operator==( const ControlHolder& _rControl, const Reference< XInterface >& _rxCompare )
+ {
+ return _rControl.getControl() == _rxCompare;
+ }
+
+ //--------------------------------------------------------------------
+ bool operator==( const Reference< XInterface >& _rxCompare, const ControlHolder& _rControl )
+ {
+ return _rxCompare == _rControl.getControl();
+ }
+
+ //--------------------------------------------------------------------
+ bool operator==( const ControlHolder& _rControl, const Any& _rxCompare )
+ {
+ return _rControl == Reference< XInterface >( _rxCompare, UNO_QUERY );
+ }
+
+ //--------------------------------------------------------------------
+ bool operator==( const Any& _rxCompare, const ControlHolder& _rControl )
+ {
+ return Reference< XInterface >( _rxCompare, UNO_QUERY ) == _rControl;
+ }
+
+ //--------------------------------------------------------------------
+ void ControlHolder::setPosSize( const Rectangle& _rPosSize ) const
+ {
+ // no check whether we're valid, this is the responsibility of the caller
+
+ // don't call setPosSize when pos/size did not change
+ // #i104181# / 2009-08-18 / frank.schoenheit@sun.com
+ ::Rectangle aCurrentRect( getPosSize() );
+ if ( aCurrentRect != _rPosSize )
+ {
+ m_xControlWindow->setPosSize(
+ _rPosSize.Left(), _rPosSize.Top(), _rPosSize.GetWidth(), _rPosSize.GetHeight(),
+ POSSIZE
+ );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ ::Rectangle ControlHolder::getPosSize() const
+ {
+ // no check whether we're valid, this is the responsibility of the caller
+ 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() );
+ }
+
+ //--------------------------------------------------------------------
+ void ControlHolder::invalidate() const
+ {
+ Reference< XWindowPeer > xPeer( m_xControl->getPeer() );
+ if ( xPeer.is() )
+ {
+ Window* pWindow = VCLUnoHelper::GetWindow( xPeer );
+ OSL_ENSURE( pWindow, "ControlHolder::invalidate: no implementation access!" );
+ if ( pWindow )
+ pWindow->Invalidate();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ ::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_xControl->getPeer() );
+ OSL_ENSURE( pWindow, "ControlHolder::getZoom: 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;
+ }
+
+ //====================================================================
+ //= UnoControlContactHelper
+ //====================================================================
+ class UnoControlContactHelper
+ {
+ public:
+ /** positions a control, and sets its zoom mode, using a given transformation and output device
+ */
+ static void adjustControlGeometry_throw(
+ const ControlHolder& _rControl,
+ const Rectangle& _rLogicBoundingRect,
+ const ::basegfx::B2DHomMatrix& _rViewTransformation,
+ const ::basegfx::B2DHomMatrix& _rZoomLevelNormalization
+ );
+
+ /** disposes the given control
+ */
+ static void disposeAndClearControl_nothrow(
+ ControlHolder& _rControl
+ );
+
+ private:
+ UnoControlContactHelper(); // never implemented
+ UnoControlContactHelper( const UnoControlContactHelper& ); // never implemented
+ UnoControlContactHelper& operator=( const UnoControlContactHelper& ); // never implemented
+ };
+
+ //--------------------------------------------------------------------
+ void UnoControlContactHelper::adjustControlGeometry_throw( const ControlHolder& _rControl, const Rectangle& _rLogicBoundingRect,
+ const basegfx::B2DHomMatrix& _rViewTransformation, const ::basegfx::B2DHomMatrix& _rZoomLevelNormalization )
+ {
+ OSL_PRECOND( _rControl.is(), "UnoControlContactHelper::adjustControlGeometry_throw: illegal control!" );
+ if ( !_rControl.is() )
+ return;
+
+ #if OSL_DEBUG_LEVEL > 0
+ ::basegfx::B2DTuple aViewScale, aViewTranslate;
+ double nViewRotate(0), nViewShearX(0);
+ _rViewTransformation.decompose( aViewScale, aViewTranslate, nViewRotate, nViewShearX );
+
+ ::basegfx::B2DTuple aZoomScale, aZoomTranslate;
+ double nZoomRotate(0), nZoomShearX(0);
+ _rZoomLevelNormalization.decompose( aZoomScale, aZoomTranslate, nZoomRotate, nZoomShearX );
+ #endif
+
+ // 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 );
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlContactHelper::disposeAndClearControl_nothrow( ControlHolder& _rControl )
+ {
+ try
+ {
+ Reference< XComponent > xControlComp( _rControl.getControl(), UNO_QUERY );
+ if ( xControlComp.is() )
+ xControlComp->dispose();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ _rControl.clear();
+ }
+
+ //====================================================================
+ //= IPageViewAccess
+ //====================================================================
+ /** interface encapsulating access to an SdrPageView, stripped down to the methods we really need
+ */
+ class IPageViewAccess
+ {
+ public:
+ /** determines whether the view is currently in design mode
+ */
+ virtual bool isDesignMode() const = 0;
+
+ /** retrieves the control container for a given output device
+ */
+ virtual Reference< XControlContainer >
+ getControlContainer( const OutputDevice& _rDevice ) const = 0;
+
+ /** determines whether a given layer is visible
+ */
+ virtual bool isLayerVisible( SdrLayerID _nLayerID ) const = 0;
+ };
+
+ //====================================================================
+ //= SdrPageViewAccess
+ //====================================================================
+ /** is a ->IPageViewAccess implementation based on a real ->SdrPageView instance
+ */
+ class SdrPageViewAccess : public IPageViewAccess
+ {
+ const SdrPageView& m_rPageView;
+ public:
+ SdrPageViewAccess( const SdrPageView& _rPageView ) : m_rPageView( _rPageView ) { }
+
+ virtual bool isDesignMode() const;
+ virtual Reference< XControlContainer >
+ getControlContainer( const OutputDevice& _rDevice ) const;
+ virtual bool isLayerVisible( SdrLayerID _nLayerID ) const;
+ };
+
+ //--------------------------------------------------------------------
+ bool SdrPageViewAccess::isDesignMode() const
+ {
+ return m_rPageView.GetView().IsDesignMode();
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XControlContainer > SdrPageViewAccess::getControlContainer( const OutputDevice& _rDevice ) const
+ {
+ Reference< XControlContainer > xControlContainer = m_rPageView.GetControlContainer( _rDevice );
+ DBG_ASSERT( xControlContainer.is() || NULL == m_rPageView.FindPageWindow( ( const_cast< OutputDevice& >( _rDevice ) ) ),
+ "SdrPageViewAccess::getControlContainer: the output device is known, but there is no control container for it?" );
+ return xControlContainer;
+ }
+
+ //--------------------------------------------------------------------
+ bool SdrPageViewAccess::isLayerVisible( SdrLayerID _nLayerID ) const
+ {
+ return m_rPageView.GetVisibleLayers().IsSet( _nLayerID );
+ }
+
+ //====================================================================
+ //= InvisibleControlViewAccess
+ //====================================================================
+ /** is a ->IPageViewAccess implementation which can be used to create an invisble control for
+ an arbitrary window
+ */
+ class InvisibleControlViewAccess : public IPageViewAccess
+ {
+ private:
+ Reference< XControlContainer >& m_rControlContainer;
+ public:
+ InvisibleControlViewAccess( Reference< XControlContainer >& _inout_ControlContainer )
+ :m_rControlContainer( _inout_ControlContainer )
+ {
+ }
+
+ virtual bool isDesignMode() const;
+ virtual Reference< XControlContainer >
+ getControlContainer( const OutputDevice& _rDevice ) const;
+ virtual bool isLayerVisible( SdrLayerID _nLayerID ) const;
+ };
+
+ //--------------------------------------------------------------------
+ bool InvisibleControlViewAccess::isDesignMode() const
+ {
+ return true;
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XControlContainer > InvisibleControlViewAccess::getControlContainer( const OutputDevice& _rDevice ) const
+ {
+ if ( !m_rControlContainer.is() )
+ {
+ const Window* pWindow = dynamic_cast< const Window* >( &_rDevice );
+ OSL_ENSURE( pWindow, "InvisibleControlViewAccess::getControlContainer: expected to be called for a window only!" );
+ if ( pWindow )
+ m_rControlContainer = VCLUnoHelper::CreateControlContainer( const_cast< Window* >( pWindow ) );
+ }
+ return m_rControlContainer;
+ }
+
+ //--------------------------------------------------------------------
+ bool InvisibleControlViewAccess::isLayerVisible( SdrLayerID /*_nLayerID*/ ) const
+ {
+ return false;
+ }
+
+ //====================================================================
+ //= DummyPageViewAccess
+ //====================================================================
+ /** is a ->IPageViewAccess implementation which can be used to create a control for an arbitrary
+ non-Window device
+
+ The implementation will report the "PageView" as being in design mode, all layers to be visible,
+ and will not return any ControlContainer, so all control container related features (notifications etc)
+ are not available.
+ */
+ class DummyPageViewAccess : public IPageViewAccess
+ {
+ public:
+ DummyPageViewAccess()
+ {
+ }
+
+ 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 NULL;
+ }
+
+ //--------------------------------------------------------------------
+ bool DummyPageViewAccess::isLayerVisible( SdrLayerID /*_nLayerID*/ ) const
+ {
+ return true;
+ }
+
+ //====================================================================
+ //= ViewObjectContactOfUnoControl_Impl
+ //====================================================================
+ typedef ::cppu::WeakImplHelper4 < XWindowListener
+ , XPropertyChangeListener
+ , XContainerListener
+ , XModeChangeListener
+ > ViewObjectContactOfUnoControl_Impl_Base;
+
+ class SVX_DLLPRIVATE ViewObjectContactOfUnoControl_Impl : public ViewObjectContactOfUnoControl_Impl_Base
+ {
+ private:
+ /// the instance whose IMPL we are
+ ViewObjectContactOfUnoControl* m_pAntiImpl;
+
+ /// are we currently inside impl_ensureControl_nothrow?
+ bool m_bCreatingControl;
+
+ /** thread safety
+
+ (not really. ATM only our X* implementations are guarded with this, but not
+ the object as a whole.)
+ */
+ mutable ::osl::Mutex m_aMutex;
+
+ /// the control we're responsible for
+ ControlHolder m_aControl;
+
+ /// the ControlContainer where we inserted our control
+ Reference< XContainer > m_xContainer;
+
+ /// the output device for which the control was created
+ const OutputDevice* m_pOutputDeviceForWindow;
+
+ /// flag indicating whether the control is currently visible
+ bool m_bControlIsVisible;
+
+ /// are we currently listening at a design mode control?
+ bool m_bIsDesignModeListening;
+
+ enum ViewControlMode
+ {
+ eDesign,
+ eAlive,
+ eUnknown
+ };
+ /// is the control currently in design mode?
+ mutable ViewControlMode m_eControlDesignMode;
+
+ ::basegfx::B2DHomMatrix m_aZoomLevelNormalization;
+
+ public:
+ ViewObjectContactOfUnoControl_Impl( ViewObjectContactOfUnoControl* _pAntiImpl );
+
+ /** disposes the instance, which is nonfunctional afterwards
+ */
+ void dispose();
+
+ /** determines whether the instance is disposed
+ */
+ bool isDisposed() const { return impl_isDisposed_nofail(); }
+
+ /** determines whether the instance is alive
+ */
+ bool isAlive() const { return !isDisposed(); }
+
+ /** returns the SdrUnoObject associated with the ViewContact
+
+ @precond
+ We're not disposed.
+ */
+ bool getUnoObject( SdrUnoObj*& _out_rpObject ) const;
+
+ /** 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 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.
+ */
+ bool ensureControl( const basegfx::B2DHomMatrix* _pInitialViewTransformationOrNULL );
+
+ /** returns our XControl, if it already has been created
+
+ If you want to ensure that the control exists before accessing it, use ->ensureControl
+ */
+ inline const ControlHolder&
+ getExistentControl() const { return m_aControl; }
+
+ 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/>
+ */
+ void positionAndZoomControl( const basegfx::B2DHomMatrix& _rViewTransformation ) const;
+
+ /** determines whether or not our control is printable
+
+ Effectively, this method returns the value of the "Printable" property
+ of the control's model. If we have no control, <FALSE/> is returned.
+ */
+ bool isPrintableControl() const;
+
+ /** sets the design mode on the control, or at least remembers the flag for the
+ time the control is created
+ */
+ void setControlDesignMode( bool _bDesignMode ) const;
+
+ /** determines whether our control is currently visible
+ @nofail
+ */
+ bool isControlVisible() const { return impl_isControlVisible_nofail(); }
+
+ /// creates an XControl for the given device and SdrUnoObj
+ static bool
+ createControlForDevice(
+ IPageViewAccess& _rPageView,
+ const OutputDevice& _rDevice,
+ const SdrUnoObj& _rUnoObject,
+ const basegfx::B2DHomMatrix& _rInitialViewTransformation,
+ const basegfx::B2DHomMatrix& _rInitialZoomNormalization,
+ ControlHolder& _out_rControl
+ );
+
+ 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();
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const EventObject& Source ) throw(RuntimeException);
+
+ // XWindowListener
+ virtual void SAL_CALL windowResized( const WindowEvent& e ) throw(RuntimeException);
+ virtual void SAL_CALL windowMoved( const WindowEvent& e ) throw(RuntimeException);
+ virtual void SAL_CALL windowShown( const EventObject& e ) throw(RuntimeException);
+ virtual void SAL_CALL windowHidden( const EventObject& e ) throw(RuntimeException);
+
+ // XPropertyChangeListener
+ virtual void SAL_CALL propertyChange( const PropertyChangeEvent& evt ) throw(RuntimeException);
+
+ // XModeChangeListener
+ virtual void SAL_CALL modeChanged( const ModeChangeEvent& _rSource ) throw (RuntimeException);
+
+ // XContainerListener
+ virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+
+ private:
+ /** retrieves the SdrPageView which our associated SdrPageViewWindow belongs to
+
+ @param out_rpPageView
+ a reference to a pointer holding, upon return, the desired SdrPageView
+
+ @return
+ <TRUE/> if and only if a ->SdrPageView could be obtained
+
+ @precond
+ We really belong to an SdrPageViewWindow. Perhaps (I'm not sure ATM :)
+ there are instance for which this might not be true, but those instances
+ should never have a need to call this method.
+
+ @precond
+ We're not disposed.
+
+ @postcond
+ The method expects success, if it returns with <FALSE/>, this will have been
+ asserted.
+
+ @nothrow
+ */
+ bool impl_getPageView_nothrow( SdrPageView*& _out_rpPageView );
+
+ /** adjusts the control visibility so it respects its layer's visibility
+
+ @param _bForce
+ set to <TRUE/> if you want to force a ->XWindow::setVisible call,
+ no matter if the control visibility is already correct
+
+ @precond
+ ->m_aControl is not <NULL/>
+
+ @precond
+ We're not disposed.
+
+ @precond
+ We really belong to an SdrPageViewWindow. There are instance for which this
+ might not be true, but those instances should never have a need to call
+ this method.
+ */
+ void impl_adjustControlVisibilityToLayerVisibility_throw( bool _bForce );
+
+ /** adjusts the control visibility so it respects its layer's visibility
+
+ The control must never be visibile if it's in design mode.
+ In alive mode, it must be visibility if and only it's on a visible layer.
+
+ @param _rxControl
+ the control whose visibility is to be adjusted
+
+ @param _rPageView
+ provides access to the attributes of the SdrPageView which the control finally belongs to
+
+ @param _rUnoObject
+ our SdrUnoObj
+
+ @param _bIsCurrentlyVisible
+ determines whether the control is currently visible. Note that this is only a shortcut for
+ querying _rxControl for the XWindow2 interface, and calling isVisible at this interface.
+ This shortcut has been chosen since the caller usually already has this information.
+ If _bForce is <TRUE/>, _bIsCurrentlyVisible is ignored.
+
+ @param _bForce
+ set to <TRUE/> if you want to force a ->XWindow::setVisible call,
+ no matter if the control visibility is already correct
+
+ @precond
+ We're not disposed.
+ */
+ static void impl_adjustControlVisibilityToLayerVisibility_throw( const ControlHolder& _rxControl, const SdrUnoObj& _rUnoObject,
+ IPageViewAccess& _rPageView, bool _bIsCurrentlyVisible, bool _bForce );
+
+ /** starts or stops listening at various aspects of our control
+
+ @precond
+ ->m_aControl is not <NULL/>
+ */
+ void impl_switchControlListening_nothrow( bool _bStart );
+
+ /** starts or stops listening at our control container
+
+ @precond
+ ->m_xContainer is not <NULL/>
+ */
+ void impl_switchContainerListening_nothrow( bool _bStart );
+
+ /** starts or stops listening at the control for design-mode relevant facets
+ */
+ void impl_switchDesignModeListening_nothrow( bool _bStart );
+
+ /** starts or stops listening for all properties at our control
+
+ @param _bStart
+ determines whether to start or to stop listening
+
+ @precond
+ ->m_aControl is not <NULL/>
+ */
+ void impl_switchPropertyListening_nothrow( bool _bStart );
+
+ /** disposes the instance
+ @param _bAlsoDisposeControl
+ determines whether the XControl should be disposed, too
+ */
+ void impl_dispose_nothrow( bool _bAlsoDisposeControl );
+
+ /** determines whether the instance is disposed
+ @nofail
+ */
+ bool impl_isDisposed_nofail() const { return m_pAntiImpl == NULL; }
+
+ /** determines whether our control is currently visible
+ @nofail
+ */
+ bool impl_isControlVisible_nofail() const { return m_bControlIsVisible; }
+
+ /** determines whether we are currently a listener at the control for desgin-mode relevant facets
+ @nofail
+ */
+ bool impl_isDesignModeListening_nofail() const { return m_bIsDesignModeListening; }
+
+ /** determines whether the control currently is in design mode
+
+ @precond
+ The design mode must already be known. It is known when we first had access to
+ an SdrPageView (which carries this flag), or somebody explicitly set it from
+ outside.
+ */
+ inline bool impl_isControlDesignMode_nothrow() const
+ {
+ DBG_ASSERT( m_eControlDesignMode != eUnknown, "ViewObjectContactOfUnoControl_Impl::impl_isControlDesignMode_nothrow: mode is still unknown!" );
+ return m_eControlDesignMode == eDesign;
+ }
+
+ /** ensures that we have a control for the given PageView/OutputDevice
+ */
+ bool impl_ensureControl_nothrow(
+ IPageViewAccess& _rPageView,
+ const OutputDevice& _rDevice,
+ const basegfx::B2DHomMatrix& _rInitialViewTransformation
+ );
+
+ /** retrieves the device which a PageView belongs to, starting from its ObjectContactOfPageView
+
+ Since #i72752#, the PaintWindow (and thus the OutputDevice) associated with a PageView is not
+ constant over its lifetime. Instead, during some paint operations, the PaintWindow/OutputDevice
+ might be temporarily patched.
+
+ This method cares for this, by retrieving the very original OutputDevice.
+ */
+ static const OutputDevice& impl_getPageViewOutputDevice_nothrow( const ObjectContactOfPageView& _rObjectContact );
+
+ const OutputDevice& impl_getOutputDevice_throw() const;
+
+ private:
+ ViewObjectContactOfUnoControl_Impl(); // never implemented
+ ViewObjectContactOfUnoControl_Impl( const ViewObjectContactOfUnoControl_Impl& ); // never implemented
+ ViewObjectContactOfUnoControl_Impl& operator=( const ViewObjectContactOfUnoControl_Impl& ); // never implemented
+ };
+
+ //====================================================================
+ //= VOCGuard
+ //====================================================================
+ /** class for guarding a ViewObjectContactOfUnoControl_Impl method
+ */
+ class VOCGuard
+ {
+ private:
+ ::osl::MutexGuard m_aMutexGuard;
+
+ public:
+ VOCGuard( const ViewObjectContactOfUnoControl_Impl& _rImpl )
+ :m_aMutexGuard( _rImpl.getMutex( ViewObjectContactOfUnoControl_Impl::GuardAccess() ) )
+ {
+ }
+ };
+
+ //====================================================================
+ //= LazyControlCreationPrimitive2D
+ //====================================================================
+ class LazyControlCreationPrimitive2D : public ::drawinglayer::primitive2d::BufferedDecompositionPrimitive2D
+ {
+ private:
+ typedef ::drawinglayer::primitive2d::BufferedDecompositionPrimitive2D BufferedDecompositionPrimitive2D;
+
+ protected:
+ virtual ::drawinglayer::primitive2d::Primitive2DSequence
+ get2DDecomposition(
+ const ::drawinglayer::geometry::ViewInformation2D& rViewInformation
+ ) const;
+
+ virtual ::drawinglayer::primitive2d::Primitive2DSequence
+ create2DDecomposition(
+ 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:
+ void impl_positionAndZoomControl( const ::drawinglayer::geometry::ViewInformation2D& _rViewInformation ) const
+ {
+ if ( !_rViewInformation.getViewport().isEmpty() )
+ m_pVOCImpl->positionAndZoomControl( _rViewInformation.getObjectToViewTransformation() );
+ }
+
+ 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 )
+ //--------------------------------------------------------------------
+ ViewObjectContactOfUnoControl_Impl::ViewObjectContactOfUnoControl_Impl( ViewObjectContactOfUnoControl* _pAntiImpl )
+ :m_pAntiImpl( _pAntiImpl )
+ ,m_bCreatingControl( false )
+ ,m_pOutputDeviceForWindow( NULL )
+ ,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( impl_getOutputDevice_throw() );
+ m_aZoomLevelNormalization = rPageViewDevice.GetInverseViewTransformation();
+
+ #if OSL_DEBUG_LEVEL > 1
+ ::basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ m_aZoomLevelNormalization.decompose( aScale, aTranslate, fRotate, fShearX );
+ #endif
+
+ ::basegfx::B2DHomMatrix aScaleNormalization;
+ MapMode aCurrentDeviceMapMode( rPageViewDevice.GetMapMode() );
+ aScaleNormalization.set( 0, 0, (double)aCurrentDeviceMapMode.GetScaleX() );
+ aScaleNormalization.set( 1, 1, (double)aCurrentDeviceMapMode.GetScaleY() );
+ m_aZoomLevelNormalization *= aScaleNormalization;
+
+ #if OSL_DEBUG_LEVEL > 1
+ m_aZoomLevelNormalization.decompose( aScale, aTranslate, fRotate, fShearX );
+ #endif
+ }
+
+ //--------------------------------------------------------------------
+ ViewObjectContactOfUnoControl_Impl::~ViewObjectContactOfUnoControl_Impl()
+ {
+ if ( !impl_isDisposed_nofail() )
+ {
+ acquire();
+ dispose();
+ }
+
+ DBG_DTOR( ViewObjectContactOfUnoControl_Impl, NULL );
+ }
+
+ //--------------------------------------------------------------------
+ void ViewObjectContactOfUnoControl_Impl::impl_dispose_nothrow( bool _bAlsoDisposeControl )
+ {
+ if ( impl_isDisposed_nofail() )
+ return;
+
+ if ( m_aControl.is() )
+ impl_switchControlListening_nothrow( false );
+
+ if ( m_xContainer.is() )
+ impl_switchContainerListening_nothrow( false );
+
+ // dispose the control
+ if ( _bAlsoDisposeControl )
+ UnoControlContactHelper::disposeAndClearControl_nothrow( m_aControl );
+
+ m_aControl.clear();
+ m_xContainer.clear();
+ m_pOutputDeviceForWindow = NULL;
+ m_bControlIsVisible = false;
+
+ m_pAntiImpl = NULL;
+ }
+
+ //--------------------------------------------------------------------
+ void ViewObjectContactOfUnoControl_Impl::dispose()
+ {
+ VOCGuard aGuard( *this );
+ impl_dispose_nothrow( true );
+ }
+
+ //--------------------------------------------------------------------
+ bool ViewObjectContactOfUnoControl_Impl::getUnoObject( SdrUnoObj*& _out_rpObject ) const
+ {
+ OSL_PRECOND( !impl_isDisposed_nofail(), "ViewObjectContactOfUnoControl_Impl::getUnoObject: already disposed()" );
+ if ( impl_isDisposed_nofail() )
+ _out_rpObject = NULL;
+ else
+ {
+ _out_rpObject = dynamic_cast< SdrUnoObj* >( m_pAntiImpl->GetViewContact().TryToGetSdrObject() );
+ DBG_ASSERT( _out_rpObject || !m_pAntiImpl->GetViewContact().TryToGetSdrObject(),
+ "ViewObjectContactOfUnoControl_Impl::getUnoObject: invalid SdrObject!" );
+ }
+ return ( _out_rpObject != NULL );
+ }
+
+ //--------------------------------------------------------------------
+ void ViewObjectContactOfUnoControl_Impl::positionAndZoomControl( const basegfx::B2DHomMatrix& _rViewTransformation ) const
+ {
+ OSL_PRECOND( m_aControl.is(), "ViewObjectContactOfUnoControl_Impl::positionAndZoomControl: no output device or no control!" );
+ if ( !m_aControl.is() )
+ return;
+
+ try
+ {
+ SdrUnoObj* pUnoObject( NULL );
+ if ( getUnoObject( pUnoObject ) )
+ {
+ UnoControlContactHelper::adjustControlGeometry_throw( m_aControl, pUnoObject->GetLogicRect(), _rViewTransformation, m_aZoomLevelNormalization );
+ }
+ else
+ OSL_ENSURE( false, "ViewObjectContactOfUnoControl_Impl::positionAndZoomControl: no SdrUnoObj!" );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ bool ViewObjectContactOfUnoControl_Impl::ensureControl( const basegfx::B2DHomMatrix* _pInitialViewTransformationOrNULL )
+ {
+ OSL_PRECOND( !impl_isDisposed_nofail(), "ViewObjectContactOfUnoControl_Impl::ensureControl: already disposed()" );
+ if ( impl_isDisposed_nofail() )
+ return false;
+
+ ObjectContactOfPageView* pPageViewContact = dynamic_cast< ObjectContactOfPageView* >( &m_pAntiImpl->GetObjectContact() );
+ if ( pPageViewContact )
+ {
+ SdrPageViewAccess aPVAccess( pPageViewContact->GetPageWindow().GetPageView() );
+ const OutputDevice& rDevice( impl_getPageViewOutputDevice_nothrow( *pPageViewContact ) );
+ return impl_ensureControl_nothrow(
+ aPVAccess,
+ rDevice,
+ _pInitialViewTransformationOrNULL ? *_pInitialViewTransformationOrNULL : rDevice.GetViewTransformation()
+ );
+ }
+
+ DummyPageViewAccess aNoPageView;
+ const OutputDevice& rDevice( impl_getOutputDevice_throw() );
+ return impl_ensureControl_nothrow(
+ aNoPageView,
+ rDevice,
+ _pInitialViewTransformationOrNULL ? *_pInitialViewTransformationOrNULL : rDevice.GetViewTransformation()
+ );
+ }
+
+ //--------------------------------------------------------------------
+ const OutputDevice& ViewObjectContactOfUnoControl_Impl::impl_getOutputDevice_throw() const
+ {
+ ObjectContactOfPageView* pPageViewContact = dynamic_cast< ObjectContactOfPageView* >( &m_pAntiImpl->GetObjectContact() );
+ if ( pPageViewContact )
+ {
+ // do not use ObjectContact::TryToGetOutputDevice here, it would not care for the PageWindow's
+ // OriginalPaintWindow
+ return impl_getPageViewOutputDevice_nothrow( *pPageViewContact );
+ }
+
+ const OutputDevice* pDevice = m_pAntiImpl->GetObjectContact().TryToGetOutputDevice();
+ ENSURE_OR_THROW( pDevice, "no output device -> no control" );
+ return *pDevice;
+ }
+
+ //--------------------------------------------------------------------
+ const OutputDevice& ViewObjectContactOfUnoControl_Impl::impl_getPageViewOutputDevice_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
+ SdrPageWindow& rPageWindow( _rObjectContact.GetPageWindow() );
+ if ( rPageWindow.GetOriginalPaintWindow() )
+ return rPageWindow.GetOriginalPaintWindow()->GetOutputDevice();
+
+ return rPageWindow.GetPaintWindow().GetOutputDevice();
+ }
+
+ namespace
+ {
+ static void lcl_resetFlag( bool& rbFlag )
+ {
+ rbFlag = false;
+ }
+ }
+
+ //--------------------------------------------------------------------
+ bool ViewObjectContactOfUnoControl_Impl::impl_ensureControl_nothrow( IPageViewAccess& _rPageView, const OutputDevice& _rDevice,
+ const basegfx::B2DHomMatrix& _rInitialViewTransformation )
+ {
+ if ( m_bCreatingControl )
+ {
+ OSL_ENSURE( false, "ViewObjectContactOfUnoControl_Impl::impl_ensureControl_nothrow: reentrance is not really good here!" );
+ // We once had a situation where this was called reentrantly, which lead to all kind of strange effects. All
+ // those affected the grid control, which is the only control so far which is visible in design mode (and
+ // not only in alive mode).
+ // Creating the control triggered an Window::Update on some of its child windows, which triggered a
+ // Paint on parent of the grid control (e.g. the SwEditWin), which triggered a reentrant call to this method,
+ // which it is not really prepared for.
+ //
+ // /me thinks that re-entrance should be caught on a higher level, i.e. the Drawing Layer should not allow
+ // reentrant paint requests. For the moment, until /me can discuss this with AW, catch it here.
+ // 2009-08-27 / #i104544# frank.schoenheit@sun.com
+ return false;
+ }
+
+ m_bCreatingControl = true;
+ ::comphelper::ScopeGuard aGuard( ::boost::bind( lcl_resetFlag, ::boost::ref( m_bCreatingControl ) ) );
+
+ if ( m_aControl.is() )
+ {
+ if ( m_pOutputDeviceForWindow == &_rDevice )
+ return true;
+
+ // 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
+ // 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
+ if ( m_xContainer.is() )
+ impl_switchContainerListening_nothrow( false );
+ impl_switchControlListening_nothrow( false );
+ UnoControlContactHelper::disposeAndClearControl_nothrow( m_aControl );
+ }
+
+ SdrUnoObj* pUnoObject( NULL );
+ if ( !getUnoObject( pUnoObject ) )
+ return false;
+
+ ControlHolder aControl;
+ if ( !createControlForDevice( _rPageView, _rDevice, *pUnoObject, _rInitialViewTransformation, m_aZoomLevelNormalization, aControl ) )
+ return false;
+
+ m_pOutputDeviceForWindow = &_rDevice;
+ m_aControl = aControl;
+ m_xContainer = m_xContainer.query( _rPageView.getControlContainer( _rDevice ) );
+ DBG_ASSERT( ( m_xContainer.is() // either have a XControlContainer
+ || ( ( !_rPageView.getControlContainer( _rDevice ).is() ) // or don't have any container,
+ && ( dynamic_cast< const Window* >( &_rDevice ) == NULL ) // which is allowed for non-Window instances only
+ )
+ ),
+ "ViewObjectContactOfUnoControl_Impl::impl_ensureControl_nothrow: no XContainer at the ControlContainer!" );
+
+ try
+ {
+ m_eControlDesignMode = m_aControl.isDesignMode() ? eDesign : eAlive;
+ m_bControlIsVisible = m_aControl.isVisible();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ // start listening at all aspects of the control which are interesting to us ...
+ impl_switchControlListening_nothrow( true );
+
+ // start listening at the control container, in case somebody tampers with our control
+ if ( m_xContainer.is() )
+ impl_switchContainerListening_nothrow( true );
+
+ return m_aControl.is();
+ }
+
+ //--------------------------------------------------------------------
+ bool ViewObjectContactOfUnoControl_Impl::createControlForDevice( IPageViewAccess& _rPageView,
+ const OutputDevice& _rDevice, const SdrUnoObj& _rUnoObject, const basegfx::B2DHomMatrix& _rInitialViewTransformation,
+ const basegfx::B2DHomMatrix& _rInitialZoomNormalization, ControlHolder& _out_rControl )
+ {
+ _out_rControl.clear();
+
+ Reference< XControlModel > xControlModel( _rUnoObject.GetUnoControlModel() );
+ DBG_ASSERT( xControlModel.is(), "ViewObjectContactOfUnoControl_Impl::createControlForDevice: no control model at the SdrUnoObject!?" );
+ if ( !xControlModel.is() )
+ return false;
+
+ bool bSuccess = false;
+ try
+ {
+ const ::rtl::OUString sControlServiceName( _rUnoObject.GetUnoControlTypeName() );
+
+ 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 );
+
+ // proper geometry
+ UnoControlContactHelper::adjustControlGeometry_throw(
+ _out_rControl,
+ _rUnoObject.GetLogicRect(),
+ _rInitialViewTransformation,
+ _rInitialZoomNormalization
+ );
+
+ // #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 );
+
+ // 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;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ if ( !bSuccess )
+ {
+ // delete the control which might have been created already
+ UnoControlContactHelper::disposeAndClearControl_nothrow( _out_rControl );
+ }
+
+ return _out_rControl.is();
+ }
+
+ //--------------------------------------------------------------------
+ bool ViewObjectContactOfUnoControl_Impl::impl_getPageView_nothrow( SdrPageView*& _out_rpPageView )
+ {
+ OSL_PRECOND( !impl_isDisposed_nofail(), "ViewObjectContactOfUnoControl_Impl::impl_getPageView_nothrow: already disposed!" );
+
+ _out_rpPageView = NULL;
+ if ( impl_isDisposed_nofail() )
+ return false;
+
+ ObjectContactOfPageView* pPageViewContact = dynamic_cast< ObjectContactOfPageView* >( &m_pAntiImpl->GetObjectContact() );
+ if ( pPageViewContact )
+ _out_rpPageView = &pPageViewContact->GetPageWindow().GetPageView();
+
+ DBG_ASSERT( _out_rpPageView != NULL, "ViewObjectContactOfUnoControl_Impl::impl_getPageView_nothrow: this method is expected to always have success!" );
+ return ( _out_rpPageView != NULL );
+ }
+
+ //--------------------------------------------------------------------
+ void ViewObjectContactOfUnoControl_Impl::impl_adjustControlVisibilityToLayerVisibility_throw( bool _bForce )
+ {
+ OSL_PRECOND( m_aControl.is(),
+ "ViewObjectContactOfUnoControl_Impl::impl_adjustControlVisibilityToLayerVisibility_throw: only valid if we have a control!" );
+
+ SdrPageView* pPageView( NULL );
+ if ( !impl_getPageView_nothrow( pPageView ) )
+ return;
+
+ SdrUnoObj* pUnoObject( NULL );
+ if ( !getUnoObject( pUnoObject ) )
+ return;
+
+ SdrPageViewAccess aPVAccess( *pPageView );
+ impl_adjustControlVisibilityToLayerVisibility_throw( m_aControl, *pUnoObject, aPVAccess, impl_isControlVisible_nofail(), _bForce );
+ }
+
+ //--------------------------------------------------------------------
+ void ViewObjectContactOfUnoControl_Impl::impl_adjustControlVisibilityToLayerVisibility_throw( const ControlHolder& _rControl,
+ const SdrUnoObj& _rUnoObject, IPageViewAccess& _rPageView, bool _bIsCurrentlyVisible, bool _bForce )
+ {
+ // in design mode, there is no problem with the visibility: The XControl is hidden by
+ // default, and the Drawing Layer will simply not call our paint routine, if we're in
+ // a hidden layer. So, only alive mode matters.
+ if ( !_rControl.isDesignMode() )
+ {
+ // the layer of our object
+ SdrLayerID nObjectLayer = _rUnoObject.GetLayer();
+ // is the object we're residing in visible in this view?
+ bool bIsObjectVisible = _rUnoObject.IsVisible() && _rPageView.isLayerVisible( nObjectLayer );
+
+ if ( _bForce || ( bIsObjectVisible != _bIsCurrentlyVisible ) )
+ {
+ _rControl.setVisible( bIsObjectVisible );
+ }
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void ViewObjectContactOfUnoControl_Impl::impl_switchContainerListening_nothrow( bool _bStart )
+ {
+ OSL_PRECOND( m_xContainer.is(), "ViewObjectContactOfUnoControl_Impl::impl_switchContainerListening_nothrow: no control container!" );
+ if ( !m_xContainer.is() )
+ return;
+
+ try
+ {
+ if ( _bStart )
+ m_xContainer->addContainerListener( this );
+ else
+ m_xContainer->removeContainerListener( this );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void ViewObjectContactOfUnoControl_Impl::impl_switchControlListening_nothrow( bool _bStart )
+ {
+ OSL_PRECOND( m_aControl.is(), "ViewObjectContactOfUnoControl_Impl::impl_switchControlListening_nothrow: invalid control!" );
+ if ( !m_aControl.is() )
+ return;
+
+ try
+ {
+ // listen for visibility changes
+ if ( _bStart )
+ m_aControl.addWindowListener( this );
+ else
+ m_aControl.removeWindowListener( this );
+
+ // in design mode, listen for some more aspects
+ impl_switchDesignModeListening_nothrow( impl_isControlDesignMode_nothrow() && _bStart );
+
+ // listen for design mode changes
+ Reference< XModeChangeBroadcaster > xDesignModeChanges( m_aControl.getControl(), UNO_QUERY_THROW );
+ if ( _bStart )
+ xDesignModeChanges->addModeChangeListener( this );
+ else
+ xDesignModeChanges->removeModeChangeListener( this );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void ViewObjectContactOfUnoControl_Impl::impl_switchDesignModeListening_nothrow( bool _bStart )
+ {
+ if ( impl_isDesignModeListening_nofail() != _bStart )
+ {
+ m_bIsDesignModeListening = _bStart;
+ impl_switchPropertyListening_nothrow( _bStart );
+ }
+ }
+
+ //------------------------------------------------------------------------------
+ void ViewObjectContactOfUnoControl_Impl::impl_switchPropertyListening_nothrow( bool _bStart )
+ {
+ OSL_PRECOND( m_aControl.is(), "ViewObjectContactOfUnoControl_Impl::impl_switchPropertyListening_nothrow: no control!" );
+ if ( !m_aControl.is() )
+ return;
+
+ try
+ {
+ Reference< XPropertySet > xModelProperties( m_aControl.getModel(), UNO_QUERY_THROW );
+ if ( _bStart )
+ xModelProperties->addPropertyChangeListener( ::rtl::OUString(), this );
+ else
+ xModelProperties->removePropertyChangeListener( ::rtl::OUString(), this );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ bool ViewObjectContactOfUnoControl_Impl::isPrintableControl() const
+ {
+ SdrUnoObj* pUnoObject( NULL );
+ if ( !getUnoObject( pUnoObject ) )
+ return false;
+
+ bool bIsPrintable = false;
+ try
+ {
+ 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& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return bIsPrintable;
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL ViewObjectContactOfUnoControl_Impl::disposing( const EventObject& Source ) throw(RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ // some code below - in particular our disposal - might trigger actions which require the
+ // SolarMutex. In particular, in our disposal, we remove ourself as listener from the control,
+ // which alone needs the SolarMutex. Of course this - a removeFooListener needed the SolarMutex -
+ // is the real bug. Toolkit really is infested with solar mutex usage ... :(
+ // #i82169# / 2007-11-14 / frank.schoenheit@sun.com
+ VOCGuard aGuard( *this );
+
+ if ( !m_aControl.is() )
+ return;
+
+ if ( ( m_aControl == Source.Source )
+ || ( m_aControl.getModel() == Source.Source )
+ )
+ {
+ // the model or the control is dying ... hmm, not much sense in that we ourself continue
+ // living
+ impl_dispose_nothrow( false );
+ return;
+ }
+
+ DBG_ASSERT( Source.Source == m_xContainer, "ViewObjectContactOfUnoControl_Impl::disposing: Who's this?" );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL ViewObjectContactOfUnoControl_Impl::windowResized( const WindowEvent& /*e*/ ) throw(RuntimeException)
+ {
+ // not interested in
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL ViewObjectContactOfUnoControl_Impl::windowMoved( const WindowEvent& /*e*/ ) throw(RuntimeException)
+ {
+ // not interested in
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL ViewObjectContactOfUnoControl_Impl::windowShown( const EventObject& /*e*/ ) throw(RuntimeException)
+ {
+ VOCGuard aGuard( *this );
+ m_bControlIsVisible = true;
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL ViewObjectContactOfUnoControl_Impl::windowHidden( const EventObject& /*e*/ ) throw(RuntimeException)
+ {
+ VOCGuard aGuard( *this );
+ m_bControlIsVisible = false;
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL ViewObjectContactOfUnoControl_Impl::propertyChange( const PropertyChangeEvent& /*_rEvent*/ ) throw(RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ // (re)painting might require VCL operations, which need the SolarMutex
+
+ OSL_PRECOND( !impl_isDisposed_nofail(), "ViewObjectContactOfUnoControl_Impl::propertyChange: already disposed()" );
+ if ( impl_isDisposed_nofail() )
+ return;
+
+ VOCGuard aGuard( *this );
+ DBG_ASSERT( m_aControl.is(), "ViewObjectContactOfUnoControl_Impl::propertyChange: " );
+ if ( !m_aControl.is() )
+ return;
+
+ // a generic property changed. If we're in design mode, we need to repaint the control
+ if ( impl_isControlDesignMode_nothrow() )
+ {
+ m_pAntiImpl->propertyChange();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL ViewObjectContactOfUnoControl_Impl::modeChanged( const ModeChangeEvent& _rSource ) throw (RuntimeException)
+ {
+ VOCGuard aGuard( *this );
+
+ DBG_ASSERT( _rSource.NewMode.equalsAscii( "design" ) || _rSource.NewMode.equalsAscii( "alive" ),
+ "ViewObjectContactOfUnoControl_Impl::modeChanged: unexpected mode!" );
+
+ m_eControlDesignMode = _rSource.NewMode.equalsAscii( "design" ) ? eDesign : eAlive;
+
+ impl_switchDesignModeListening_nothrow( impl_isControlDesignMode_nothrow() );
+
+ try
+ {
+ // if the control is part of a invisible layer, we need to explicitly hide it in alive mode
+ // 2003-06-03 - #110592# - fs@openoffice.org
+ impl_adjustControlVisibilityToLayerVisibility_throw( false );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL ViewObjectContactOfUnoControl_Impl::elementInserted( const ContainerEvent& /*_Event*/ ) throw (RuntimeException)
+ {
+ // not interested in
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL ViewObjectContactOfUnoControl_Impl::elementRemoved( const ContainerEvent& Event ) throw (RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ // some code below - in particular our disposal - might trigger actions which require the
+ // SolarMutex. In particular, in our disposal, we remove ourself as listener from the control,
+ // which alone needs the SolarMutex. Of course this - a removeFooListener needed the SolarMutex -
+ // is the real bug. Toolkit really is infested with solar mutex usage ... :(
+ // #i82169# / 2007-11-14 / frank.schoenheit@sun.com
+ VOCGuard aGuard( *this );
+ DBG_ASSERT( Event.Source == m_xContainer, "ViewObjectContactOfUnoControl_Impl::elementRemoved: where did this come from?" );
+
+ if ( m_aControl == Event.Element )
+ impl_dispose_nothrow( false );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL ViewObjectContactOfUnoControl_Impl::elementReplaced( const ContainerEvent& Event ) throw (RuntimeException)
+ {
+ VOCGuard aGuard( *this );
+ DBG_ASSERT( Event.Source == m_xContainer, "ViewObjectContactOfUnoControl_Impl::elementReplaced: where did this come from?" );
+
+ if ( ! ( m_aControl == Event.ReplacedElement ) )
+ return;
+
+ Reference< XControl > xNewControl( Event.Element, UNO_QUERY );
+ DBG_ASSERT( xNewControl.is(), "ViewObjectContactOfUnoControl_Impl::elementReplaced: invalid new control!" );
+ 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;
+ m_bControlIsVisible = m_aControl.isVisible();
+
+ impl_switchControlListening_nothrow( true );
+
+ m_pAntiImpl->onControlChangedOrModified( ViewObjectContactOfUnoControl::ImplAccess() );
+ }
+
+ //--------------------------------------------------------------------
+ void ViewObjectContactOfUnoControl_Impl::setControlDesignMode( bool _bDesignMode ) const
+ {
+ if ( ( m_eControlDesignMode != eUnknown ) && ( _bDesignMode == impl_isControlDesignMode_nothrow() ) )
+ // nothing to do
+ return;
+ m_eControlDesignMode = _bDesignMode ? eDesign : eAlive;
+
+ if ( !m_aControl.is() )
+ // nothing to do, the setting will be respected as soon as the control
+ // is created
+ return;
+
+ try
+ {
+ m_aControl.setDesignMode( _bDesignMode );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //====================================================================
+ //= LazyControlCreationPrimitive2D
+ //====================================================================
+ //--------------------------------------------------------------------
+ bool LazyControlCreationPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if ( !BufferedDecompositionPrimitive2D::operator==( rPrimitive ) )
+ return false;
+
+ const LazyControlCreationPrimitive2D* pRHS = dynamic_cast< const LazyControlCreationPrimitive2D* >( &rPrimitive );
+ if ( !pRHS )
+ return false;
+
+ if ( m_pVOCImpl != pRHS->m_pVOCImpl )
+ return false;
+
+ if ( m_aTransformation != pRHS->m_aTransformation )
+ 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 OSL_DEBUG_LEVEL > 1
+ ::basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ _rViewInformation.getObjectToViewTransformation().decompose( aScale, aTranslate, fRotate, fShearX );
+ #endif
+ if ( m_pVOCImpl->hasControl() )
+ impl_positionAndZoomControl( _rViewInformation );
+ return BufferedDecompositionPrimitive2D::get2DDecomposition( _rViewInformation );
+ }
+
+ //--------------------------------------------------------------------
+ ::drawinglayer::primitive2d::Primitive2DSequence LazyControlCreationPrimitive2D::create2DDecomposition( const ::drawinglayer::geometry::ViewInformation2D& _rViewInformation ) const
+ {
+ #if OSL_DEBUG_LEVEL > 1
+ ::basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ _rViewInformation.getObjectToViewTransformation().decompose( aScale, aTranslate, fRotate, fShearX );
+ #endif
+ const bool bHadControl = m_pVOCImpl->getExistentControl().is();
+
+ // force control here to make it a VCL ChildWindow. Will be fetched
+ // and used below by getExistentControl()
+ m_pVOCImpl->ensureControl( &_rViewInformation.getObjectToViewTransformation() );
+ impl_positionAndZoomControl( _rViewInformation );
+
+ // get needed data
+ const ViewContactOfUnoControl& rViewContactOfUnoControl( m_pVOCImpl->getViewContact() );
+ Reference< XControlModel > xControlModel( rViewContactOfUnoControl.GetSdrUnoObj().GetUnoControlModel() );
+ const ControlHolder& rControl( m_pVOCImpl->getExistentControl() );
+
+ if ( !bHadControl && rControl.is() && rControl.isVisible() )
+ rControl.invalidate();
+
+ if ( !bHadControl && rControl.is() && rControl.isVisible() )
+ rControl.invalidate();
+
+ // 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
+ //====================================================================
+ DBG_NAME( ViewObjectContactOfUnoControl )
+ //--------------------------------------------------------------------
+ ViewObjectContactOfUnoControl::ViewObjectContactOfUnoControl( ObjectContact& _rObjectContact, ViewContactOfUnoControl& _rViewContact )
+ :ViewObjectContactOfSdrObj( _rObjectContact, _rViewContact )
+ ,m_pImpl( new ViewObjectContactOfUnoControl_Impl( this ) )
+ {
+ DBG_CTOR( ViewObjectContactOfUnoControl, NULL );
+ }
+
+ //--------------------------------------------------------------------
+ ViewObjectContactOfUnoControl::~ViewObjectContactOfUnoControl()
+ {
+ m_pImpl->dispose();
+ m_pImpl = NULL;
+
+ DBG_DTOR( ViewObjectContactOfUnoControl, NULL );
+ }
+
+ //--------------------------------------------------------------------
+ bool ViewObjectContactOfUnoControl::isControlVisible() const
+ {
+ VOCGuard aGuard( *m_pImpl );
+ const ControlHolder& rControl( m_pImpl->getExistentControl() );
+ return rControl.is() && rControl.isVisible();
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XControl > ViewObjectContactOfUnoControl::getControl()
+ {
+ VOCGuard aGuard( *m_pImpl );
+ m_pImpl->ensureControl( NULL );
+ return m_pImpl->getExistentControl().getControl();
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XControl > ViewObjectContactOfUnoControl::getTemporaryControlForWindow(
+ const Window& _rWindow, Reference< XControlContainer >& _inout_ControlContainer, const SdrUnoObj& _rUnoObject )
+ {
+ ControlHolder aControl;
+
+ InvisibleControlViewAccess aSimulatePageView( _inout_ControlContainer );
+ OSL_VERIFY( ViewObjectContactOfUnoControl_Impl::createControlForDevice( aSimulatePageView, _rWindow, _rUnoObject,
+ _rWindow.GetViewTransformation(), _rWindow.GetInverseViewTransformation(), aControl ) );
+ return aControl.getControl();
+ }
+
+ //--------------------------------------------------------------------
+ void ViewObjectContactOfUnoControl::ensureControlVisibility( bool _bVisible ) const
+ {
+ VOCGuard aGuard( *m_pImpl );
+
+ try
+ {
+ const ControlHolder& rControl( m_pImpl->getExistentControl() );
+ if ( !rControl.is() )
+ return;
+
+ // only need to care for alive mode
+ if ( rControl.isDesignMode() )
+ return;
+
+ // is the visibility correct?
+ if ( m_pImpl->isControlVisible() == _bVisible )
+ return;
+
+ // no -> adjust it
+ rControl.setVisible( _bVisible );
+ DBG_ASSERT( m_pImpl->isControlVisible() == _bVisible, "ViewObjectContactOfUnoControl::ensureControlVisibility: this didn't work!" );
+ // now this would mean that either isControlVisible is not reliable,
+ // or that showing/hiding the window did not work as intended.
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void ViewObjectContactOfUnoControl::setControlDesignMode( bool _bDesignMode ) const
+ {
+ VOCGuard aGuard( *m_pImpl );
+ m_pImpl->setControlDesignMode( _bDesignMode );
+
+ if(!_bDesignMode)
+ {
+ // when live mode is switched on, a refresh is needed. The edit mode visualisation
+ // needs to be repainted and the now used VCL-Window needs to be positioned and
+ // sized. Both is done from the repant refresh.
+ const_cast< ViewObjectContactOfUnoControl* >(this)->ActionChanged();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfUnoControl::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/) const
+ {
+ 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();
+
+ if ( GetObjectContact().getViewInformation2D().getViewTransformation().isIdentity() )
+ // remove this when #i115754# is fixed
+ return drawinglayer::primitive2d::Primitive2DSequence();
+
+ // ignore existing controls which are in alive mode and manually switched to "invisible"
+ // #102090# / 2009-06-05 / frank.schoenheit@sun.com
+ const ControlHolder& rControl( m_pImpl->getExistentControl() );
+ if ( rControl.is() && !rControl.isDesignMode() && !rControl.isVisible() )
+ return drawinglayer::primitive2d::Primitive2DSequence();
+
+ ::drawinglayer::primitive2d::Primitive2DReference xPrimitive( new LazyControlCreationPrimitive2D( m_pImpl ) );
+ return ::drawinglayer::primitive2d::Primitive2DSequence( &xPrimitive, 1 );
+ }
+
+ //--------------------------------------------------------------------
+ bool ViewObjectContactOfUnoControl::isPrimitiveVisible( const DisplayInfo& _rDisplayInfo ) const
+ {
+ VOCGuard aGuard( *m_pImpl );
+
+ if ( m_pImpl->hasControl() )
+ {
+ const ::drawinglayer::geometry::ViewInformation2D& rViewInformation( GetObjectContact().getViewInformation2D() );
+ #if OSL_DEBUG_LEVEL > 1
+ ::basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ rViewInformation.getObjectToViewTransformation().decompose( aScale, aTranslate, fRotate, fShearX );
+ #endif
+
+ if ( !rViewInformation.getViewport().isEmpty() )
+ m_pImpl->positionAndZoomControl( rViewInformation.getObjectToViewTransformation() );
+ }
+
+ return ViewObjectContactOfSdrObj::isPrimitiveVisible( _rDisplayInfo );
+ }
+
+ //--------------------------------------------------------------------
+ void ViewObjectContactOfUnoControl::propertyChange()
+ {
+ impl_onControlChangedOrModified();
+ }
+
+ //--------------------------------------------------------------------
+ void ViewObjectContactOfUnoControl::ActionChanged()
+ {
+ // call parent
+ ViewObjectContactOfSdrObj::ActionChanged();
+ const ControlHolder& rControl(m_pImpl->getExistentControl());
+
+ if(rControl.is() && !rControl.isDesignMode())
+ {
+ // #i93180# if layer visibility has changed and control is in live mode, it is necessary
+ // to correct visibility to make those control vanish on SdrObject LayerID changes
+ const SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView();
+
+ if(pSdrPageView)
+ {
+ const SdrObject& rObject = getSdrObject();
+ const bool bIsLayerVisible( rObject.IsVisible() && pSdrPageView->GetVisibleLayers().IsSet(rObject.GetLayer()));
+
+ if(rControl.isVisible() != bIsLayerVisible)
+ {
+ rControl.setVisible(bIsLayerVisible);
+ }
+ }
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void ViewObjectContactOfUnoControl::impl_onControlChangedOrModified()
+ {
+ // 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 possibly no
+ // longer valid. Unfortunately this is not detected from ControlPrimitive2D::operator==
+ // since it only has a uno reference to the XControlModel
+ flushPrimitive2DSequence();
+ }
+
+ //====================================================================
+ //= UnoControlPrintOrPreviewContact
+ //====================================================================
+ DBG_NAME( UnoControlPrintOrPreviewContact )
+ //--------------------------------------------------------------------
+ UnoControlPrintOrPreviewContact::UnoControlPrintOrPreviewContact( ObjectContactOfPageView& _rObjectContact, ViewContactOfUnoControl& _rViewContact )
+ :ViewObjectContactOfUnoControl( _rObjectContact, _rViewContact )
+ {
+ DBG_CTOR( UnoControlPrintOrPreviewContact, NULL );
+ }
+
+ //--------------------------------------------------------------------
+ UnoControlPrintOrPreviewContact::~UnoControlPrintOrPreviewContact()
+ {
+ 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 );
+ }
+
+//........................................................................
+} } // namespace sdr::contact
+//........................................................................
+
diff --git a/svx/source/sdr/contact/viewobjectcontactredirector.cxx b/svx/source/sdr/contact/viewobjectcontactredirector.cxx
new file mode 100644
index 000000000000..8d96b17f0a58
--- /dev/null
+++ b/svx/source/sdr/contact/viewobjectcontactredirector.cxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/contact/viewobjectcontactredirector.hxx>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ // basic constructor.
+ ViewObjectContactRedirector::ViewObjectContactRedirector()
+ {
+ }
+
+ // The destructor.
+ ViewObjectContactRedirector::~ViewObjectContactRedirector()
+ {
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(
+ const sdr::contact::ViewObjectContact& rOriginal,
+ const sdr::contact::DisplayInfo& rDisplayInfo)
+ {
+ return rOriginal.createPrimitive2DSequence(rDisplayInfo);
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/event/eventhandler.cxx b/svx/source/sdr/event/eventhandler.cxx
new file mode 100644
index 000000000000..967b6fefe949
--- /dev/null
+++ b/svx/source/sdr/event/eventhandler.cxx
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/event/eventhandler.hxx>
+
+// for SOLARIS compiler include of algorithm part of _STL is necesary to
+// get access to basic algos like ::std::find
+#include <algorithm>
+#include <tools/debug.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace event
+ {
+ BaseEvent::BaseEvent(EventHandler& rEventHandler)
+ : mrEventHandler(rEventHandler)
+ {
+ mrEventHandler.AddEvent(*this);
+ }
+
+ BaseEvent::~BaseEvent()
+ {
+ mrEventHandler.RemoveEvent(*this);
+ }
+ } // end of namespace mixer
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace event
+ {
+ void EventHandler::AddEvent(BaseEvent& rBaseEvent)
+ {
+ maVector.push_back(&rBaseEvent);
+ }
+
+ void EventHandler::RemoveEvent(BaseEvent& rBaseEvent)
+ {
+ if(maVector.back() == &rBaseEvent)
+ {
+ // the one to remove is the last, pop
+ maVector.pop_back();
+ }
+ else
+ {
+ const BaseEventVector::iterator aFindResult = ::std::find(
+ maVector.begin(), maVector.end(), &rBaseEvent);
+ DBG_ASSERT(aFindResult != maVector.end(),
+ "EventHandler::RemoveEvent: Event to be removed not found (!)");
+ maVector.erase(aFindResult);
+ }
+ }
+
+ BaseEvent* EventHandler::GetEvent()
+ {
+ if(maVector.size())
+ {
+ // get the last event, that one is fastest to be removed
+ return maVector.back();
+ }
+ else
+ {
+ return 0L;
+ }
+ }
+
+ EventHandler::EventHandler()
+ {
+ }
+
+ EventHandler::~EventHandler()
+ {
+ while(maVector.size())
+ {
+ delete GetEvent();
+ }
+ }
+
+ // Trigger and consume the events
+ void EventHandler::ExecuteEvents()
+ {
+ for(;;)
+ {
+ BaseEvent* pEvent = GetEvent();
+ if(pEvent == NULL)
+ break;
+ pEvent->ExecuteEvent();
+ delete pEvent;
+ }
+ }
+
+ // for control
+ sal_Bool EventHandler::IsEmpty() const
+ {
+ return (0L == maVector.size());
+ }
+ } // end of namespace mixer
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace event
+ {
+ TimerEventHandler::TimerEventHandler(sal_uInt32 nTimeout)
+ {
+ SetTimeout(nTimeout);
+ Stop();
+ }
+
+ TimerEventHandler::~TimerEventHandler()
+ {
+ Stop();
+ }
+
+ // The timer when it is triggered; from class Timer
+ void TimerEventHandler::Timeout()
+ {
+ ExecuteEvents();
+ }
+
+ // reset the timer
+ void TimerEventHandler::Restart()
+ {
+ Start();
+ }
+ } // end of namespace mixer
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx b/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx
new file mode 100644
index 000000000000..6fbd294a6559
--- /dev/null
+++ b/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx
@@ -0,0 +1,217 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/overlay/overlayanimatedbitmapex.hxx>
+#include <vcl/salbtype.hxx>
+#include <vcl/outdev.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/overlay/overlaytools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ // #i53216# check blink time value range
+ void OverlayAnimatedBitmapEx::impCheckBlinkTimeValueRange()
+ {
+ if(mnBlinkTime < 25)
+ {
+ mnBlinkTime = 25;
+ }
+ else if(mnBlinkTime > 10000)
+ {
+ mnBlinkTime = 10000;
+ }
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence OverlayAnimatedBitmapEx::createOverlayObjectPrimitive2DSequence()
+ {
+ 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(
+ const basegfx::B2DPoint& rBasePos,
+ const BitmapEx& rBitmapEx1,
+ const BitmapEx& rBitmapEx2,
+ sal_uInt32 nBlinkTime,
+ sal_uInt16 nCenX1,
+ sal_uInt16 nCenY1,
+ sal_uInt16 nCenX2,
+ sal_uInt16 nCenY2)
+ : OverlayObjectWithBasePosition(rBasePos, Color(COL_WHITE)),
+ maBitmapEx1(rBitmapEx1),
+ maBitmapEx2(rBitmapEx2),
+ mnCenterX1(nCenX1), mnCenterY1(nCenY1),
+ mnCenterX2(nCenX2), mnCenterY2(nCenY2),
+ mnBlinkTime(nBlinkTime),
+ mbOverlayState(false)
+ {
+ // set AllowsAnimation flag to mark this object as animation capable
+ mbAllowsAnimation = true;
+
+ // #i53216# check blink time value range
+ impCheckBlinkTimeValueRange();
+ }
+
+ OverlayAnimatedBitmapEx::~OverlayAnimatedBitmapEx()
+ {
+ }
+
+ void OverlayAnimatedBitmapEx::setBitmapEx1(const BitmapEx& rNew)
+ {
+ if(rNew != maBitmapEx1)
+ {
+ // remember new Bitmap
+ maBitmapEx1 = rNew;
+
+ // register change (after change)
+ objectChange();
+ }
+ }
+
+ void OverlayAnimatedBitmapEx::setBitmapEx2(const BitmapEx& rNew)
+ {
+ if(rNew != maBitmapEx2)
+ {
+ // remember new Bitmap
+ maBitmapEx2 = rNew;
+
+ // register change (after change)
+ objectChange();
+ }
+ }
+
+ void OverlayAnimatedBitmapEx::setCenterXY1(sal_uInt16 nNewX, sal_uInt16 nNewY)
+ {
+ if(nNewX != mnCenterX1 || nNewY != mnCenterY1)
+ {
+ // remember new values
+ if(nNewX != mnCenterX1)
+ {
+ mnCenterX1 = nNewX;
+ }
+
+ if(nNewY != mnCenterY1)
+ {
+ mnCenterY1 = nNewY;
+ }
+
+ // register change (after change)
+ objectChange();
+ }
+ }
+
+ void OverlayAnimatedBitmapEx::setCenterXY2(sal_uInt16 nNewX, sal_uInt16 nNewY)
+ {
+ if(nNewX != mnCenterX2 || nNewY != mnCenterY2)
+ {
+ // remember new values
+ if(nNewX != mnCenterX2)
+ {
+ mnCenterX2 = nNewX;
+ }
+
+ if(nNewY != mnCenterY2)
+ {
+ mnCenterY2 = nNewY;
+ }
+
+ // register change (after change)
+ objectChange();
+ }
+ }
+
+ void OverlayAnimatedBitmapEx::setBlinkTime(sal_uInt32 nNew)
+ {
+ if(mnBlinkTime != nNew)
+ {
+ // remember new value
+ mnBlinkTime = nNew;
+
+ // #i53216# check blink time value range
+ impCheckBlinkTimeValueRange();
+
+ // register change (after change)
+ objectChange();
+ }
+ }
+
+ void OverlayAnimatedBitmapEx::Trigger(sal_uInt32 nTime)
+ {
+ if(getOverlayManager())
+ {
+ // #i53216# produce event after nTime + x
+ SetTime(nTime + mnBlinkTime);
+
+ // switch state
+ if(mbOverlayState)
+ {
+ mbOverlayState = false;
+ }
+ else
+ {
+ mbOverlayState = true;
+ }
+
+ // re-insert me as event
+ getOverlayManager()->InsertEvent(this);
+
+ // register change (after change)
+ objectChange();
+ }
+ }
+ } // 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
new file mode 100644
index 000000000000..2a3a00b25b99
--- /dev/null
+++ b/svx/source/sdr/overlay/overlaybitmapex.cxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
+#include <svx/sdr/overlay/overlaybitmapex.hxx>
+#include <vcl/salbtype.hxx>
+#include <vcl/outdev.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/overlay/overlaytools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ drawinglayer::primitive2d::Primitive2DSequence OverlayBitmapEx::createOverlayObjectPrimitive2DSequence()
+ {
+ drawinglayer::primitive2d::Primitive2DReference aReference(
+ new drawinglayer::primitive2d::OverlayBitmapExPrimitive(
+ getBitmapEx(),
+ getBasePosition(),
+ getCenterX(),
+ getCenterY()));
+
+ if(basegfx::fTools::more(mfAlpha, 0.0))
+ {
+ const drawinglayer::primitive2d::Primitive2DSequence aNewTransPrimitiveVector(&aReference, 1L);
+ aReference = drawinglayer::primitive2d::Primitive2DReference(
+ new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(aNewTransPrimitiveVector, mfAlpha));
+ }
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
+ }
+
+ OverlayBitmapEx::OverlayBitmapEx(
+ const basegfx::B2DPoint& rBasePos,
+ const BitmapEx& rBitmapEx,
+ sal_uInt16 nCenX, sal_uInt16 nCenY, double fAlpha)
+ : OverlayObjectWithBasePosition(rBasePos, Color(COL_WHITE)),
+ maBitmapEx(rBitmapEx),
+ mnCenterX(nCenX),
+ mnCenterY(nCenY),
+ mfAlpha(fAlpha)
+ {
+ }
+
+ OverlayBitmapEx::~OverlayBitmapEx()
+ {
+ }
+
+ void OverlayBitmapEx::setBitmapEx(const BitmapEx& rNew)
+ {
+ if(rNew != maBitmapEx)
+ {
+ // remember new Bitmap
+ maBitmapEx = rNew;
+
+ // register change (after change)
+ objectChange();
+ }
+ }
+
+ void OverlayBitmapEx::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();
+ }
+ }
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/overlay/overlaycrosshair.cxx b/svx/source/sdr/overlay/overlaycrosshair.cxx
new file mode 100644
index 000000000000..cf1c4c4a3c88
--- /dev/null
+++ b/svx/source/sdr/overlay/overlaycrosshair.cxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/overlay/overlaycrosshair.hxx>
+#include <tools/gen.hxx>
+#include <vcl/salbtype.hxx>
+#include <vcl/outdev.hxx>
+#include <svx/sdr/overlay/overlaytools.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ drawinglayer::primitive2d::Primitive2DSequence OverlayCrosshairStriped::createOverlayObjectPrimitive2DSequence()
+ {
+ 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());
+
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new drawinglayer::primitive2d::OverlayCrosshairPrimitive(
+ getBasePosition(),
+ aRGBColorA,
+ aRGBColorB,
+ fStripeLengthPixel));
+
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
+ }
+
+ return aRetval;
+ }
+
+ void OverlayCrosshairStriped::stripeDefinitionHasChanged()
+ {
+ // react on OverlayManager's stripe definition change
+ objectChange();
+ }
+
+ OverlayCrosshairStriped::OverlayCrosshairStriped(const basegfx::B2DPoint& rBasePos)
+ : OverlayObjectWithBasePosition(rBasePos, Color(COL_BLACK))
+ {
+ }
+
+ OverlayCrosshairStriped::~OverlayCrosshairStriped()
+ {
+ }
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/overlay/overlayhatchrect.cxx b/svx/source/sdr/overlay/overlayhatchrect.cxx
new file mode 100644
index 000000000000..64bd9e11b31f
--- /dev/null
+++ b/svx/source/sdr/overlay/overlayhatchrect.cxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/overlay/overlayhatchrect.hxx>
+#include <vcl/hatch.hxx>
+#include <vcl/outdev.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/numeric/ftools.hxx>
+#include <svx/sdr/overlay/overlaytools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ drawinglayer::primitive2d::Primitive2DSequence OverlayHatchRect::createOverlayObjectPrimitive2DSequence()
+ {
+ 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 fDiscreteGrow,
+ double fDiscreteShrink,
+ double fHatchRotation,
+ double fRotation)
+ : OverlayObjectWithBasePosition(rBasePosition, rHatchColor),
+ maSecondPosition(rSecondPosition),
+ mfDiscreteGrow(fDiscreteGrow),
+ mfDiscreteShrink(fDiscreteShrink),
+ mfHatchRotation(fHatchRotation),
+ mfRotation(fRotation)
+ {
+ }
+
+ void OverlayHatchRect::setSecondPosition(const basegfx::B2DPoint& rNew)
+ {
+ if(rNew != maSecondPosition)
+ {
+ // remember new value
+ maSecondPosition = rNew;
+
+ // register change (after change)
+ objectChange();
+ }
+ }
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/overlay/overlayhelpline.cxx b/svx/source/sdr/overlay/overlayhelpline.cxx
new file mode 100644
index 000000000000..3417cc4a651f
--- /dev/null
+++ b/svx/source/sdr/overlay/overlayhelpline.cxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/overlay/overlayhelpline.hxx>
+#include <tools/gen.hxx>
+#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>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ drawinglayer::primitive2d::Primitive2DSequence OverlayHelplineStriped::createOverlayObjectPrimitive2DSequence()
+ {
+ 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());
+ 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::stripeDefinitionHasChanged()
+ {
+ // react on OverlayManager's stripe definition change
+ objectChange();
+ }
+
+ OverlayHelplineStriped::OverlayHelplineStriped(
+ const basegfx::B2DPoint& rBasePos,
+ SdrHelpLineKind eNewKind)
+ : OverlayObjectWithBasePosition(rBasePos, Color(COL_BLACK)),
+ meKind(eNewKind)
+ {
+ }
+
+ OverlayHelplineStriped::~OverlayHelplineStriped()
+ {
+ }
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/overlay/overlayline.cxx b/svx/source/sdr/overlay/overlayline.cxx
new file mode 100644
index 000000000000..4d53ac480241
--- /dev/null
+++ b/svx/source/sdr/overlay/overlayline.cxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/overlay/overlayline.hxx>
+#include <tools/gen.hxx>
+#include <vcl/salbtype.hxx>
+#include <vcl/outdev.hxx>
+#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>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ drawinglayer::primitive2d::Primitive2DSequence OverlayLineStriped::createOverlayObjectPrimitive2DSequence()
+ {
+ 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::stripeDefinitionHasChanged()
+ {
+ // react on OverlayManager's stripe definition change
+ objectChange();
+ }
+
+ OverlayLineStriped::OverlayLineStriped(
+ const basegfx::B2DPoint& rBasePos,
+ const basegfx::B2DPoint& rSecondPos)
+ : OverlayObjectWithBasePosition(rBasePos, Color(COL_BLACK)),
+ maSecondPosition(rSecondPos)
+ {
+ }
+
+ OverlayLineStriped::~OverlayLineStriped()
+ {
+ }
+
+ void OverlayLineStriped::setSecondPosition(const basegfx::B2DPoint& rNew)
+ {
+ if(rNew != maSecondPosition)
+ {
+ // remember new value
+ maSecondPosition = rNew;
+
+ // register change (after change)
+ objectChange();
+ }
+ }
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx
new file mode 100644
index 000000000000..93e3b03d072d
--- /dev/null
+++ b/svx/source/sdr/overlay/overlaymanager.cxx
@@ -0,0 +1,393 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <tools/gen.hxx>
+#include <vcl/salbtype.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/window.hxx>
+#include <svx/sdr/overlay/overlayobject.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
+#include <svx/sdr/contact/objectcontacttools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ void OverlayManager::ImpDrawMembers(const basegfx::B2DRange& rRange, OutputDevice& rDestinationDevice) const
+ {
+ const sal_uInt32 nSize(maOverlayObjects.size());
+
+ if(nSize)
+ {
+ const sal_uInt16 nOriginalAA(rDestinationDevice.GetAntialiasing());
+ const bool bIsAntiAliasing(getDrawinglayerOpt().IsAntiAliasing());
+
+ // create processor
+ drawinglayer::processor2d::BaseProcessor2D* pProcessor = ::sdr::contact::createBaseProcessor2DFromOutputDevice(
+ rDestinationDevice,
+ getCurrentViewInformation2D());
+
+ if(pProcessor)
+ {
+ for(OverlayObjectVector::const_iterator aIter(maOverlayObjects.begin()); aIter != maOverlayObjects.end(); aIter++)
+ {
+ OSL_ENSURE(*aIter, "Corrupted OverlayObject List (!)");
+ const OverlayObject& rCandidate = **aIter;
+
+ if(rCandidate.isVisible())
+ {
+ 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);
+ }
+ }
+ }
+ }
+
+ delete pProcessor;
+ }
+
+ // restore AA settings
+ rDestinationDevice.SetAntialiasing(nOriginalAA);
+ }
+ }
+
+ void OverlayManager::ImpStripeDefinitionChanged()
+ {
+ 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;
+ rCandidate.stripeDefinitionHasChanged();
+ }
+ }
+ }
+
+ double OverlayManager::getDiscreteOne() const
+ {
+ if(basegfx::fTools::equalZero(mfDiscreteOne))
+ {
+ const basegfx::B2DVector aDiscreteInLogic(getOutputDevice().GetInverseViewTransformation() * basegfx::B2DVector(1.0, 0.0));
+ const_cast< OverlayManager* >(this)->mfDiscreteOne = aDiscreteInLogic.getLength();
+ }
+
+ return mfDiscreteOne;
+ }
+
+ OverlayManager::OverlayManager(
+ OutputDevice& rOutputDevice,
+ OverlayManager* pOldOverlayManager)
+ : Scheduler(),
+ rmOutputDevice(rOutputDevice),
+ maOverlayObjects(),
+ maStripeColorA(Color(COL_BLACK)),
+ maStripeColorB(Color(COL_WHITE)),
+ mnStripeLengthPixel(5),
+ maDrawinglayerOpt(),
+ maViewTransformation(),
+ maViewInformation2D(),
+ mfDiscreteOne(0.0)
+ {
+ // set Property 'ReducedDisplayQuality' to true to allow simpler interaction
+ // visualisations
+ static bool bUseReducedDisplayQualityForDrag(true);
+
+ if(bUseReducedDisplayQualityForDrag)
+ {
+ uno::Sequence< beans::PropertyValue > xProperties(1);
+ xProperties[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedDisplayQuality"));
+ xProperties[0].Value <<= true;
+ maViewInformation2D = drawinglayer::geometry::ViewInformation2D(xProperties);
+ }
+
+ 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. Profit here
+ // from knowing that all will be removed
+ 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;
+ impApplyRemoveActions(rCandidate);
+ }
+
+ // erase vector
+ maOverlayObjects.clear();
+ }
+ }
+
+ void OverlayManager::completeRedraw(const Region& rRegion, OutputDevice* pPreRenderDevice) const
+ {
+ if(!rRegion.IsEmpty() && maOverlayObjects.size())
+ {
+ // check for changed MapModes. That may influence the
+ // logical size of pixel based OverlayObjects (like BitmapHandles)
+ //ImpCheckMapModeChange();
+
+ // paint members
+ const Rectangle aRegionBoundRect(rRegion.GetBoundRect());
+ const basegfx::B2DRange aRegionRange(
+ aRegionBoundRect.Left(), aRegionBoundRect.Top(),
+ aRegionBoundRect.Right(), aRegionBoundRect.Bottom());
+
+ OutputDevice& rTarget = (pPreRenderDevice) ? *pPreRenderDevice : getOutputDevice();
+ ImpDrawMembers(aRegionRange, rTarget);
+ }
+ }
+
+ void OverlayManager::flush()
+ {
+ // default has nothing to do
+ }
+
+ // #i68597# part of content gets copied, react on it
+ void OverlayManager::copyArea(const Point& /*rDestPt*/, const Point& /*rSrcPt*/, const Size& /*rSrcSize*/)
+ {
+ // unbuffered versions do nothing here
+ }
+
+ void OverlayManager::restoreBackground(const Region& /*rRegion*/) const
+ {
+ // unbuffered versions do nothing here
+ }
+
+ void OverlayManager::add(OverlayObject& rOverlayObject)
+ {
+ OSL_ENSURE(0 == rOverlayObject.mpOverlayManager, "OverlayObject is added twice to an OverlayManager (!)");
+
+ // add to the end of chain to preserve display order in paint
+ maOverlayObjects.push_back(&rOverlayObject);
+
+ // execute add actions
+ impApplyAddActions(rOverlayObject);
+ }
+
+ void OverlayManager::remove(OverlayObject& rOverlayObject)
+ {
+ OSL_ENSURE(rOverlayObject.mpOverlayManager == this, "OverlayObject is removed from wrong OverlayManager (!)");
+
+ // execute remove actions
+ impApplyRemoveActions(rOverlayObject);
+
+ // 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(bFound)
+ {
+ maOverlayObjects.erase(aFindResult);
+ }
+ }
+
+ void OverlayManager::invalidateRange(const basegfx::B2DRange& rRange)
+ {
+ if(OUTDEV_WINDOW == getOutputDevice().GetOutDevType())
+ {
+ if(getDrawinglayerOpt().IsAntiAliasing())
+ {
+ // assume AA needs one pixel more and invalidate one pixel more
+ const double fDiscreteOne(getDiscreteOne());
+ const Rectangle aInvalidateRectangle(
+ (sal_Int32)floor(rRange.getMinX() - fDiscreteOne),
+ (sal_Int32)floor(rRange.getMinY() - fDiscreteOne),
+ (sal_Int32)ceil(rRange.getMaxX() + fDiscreteOne),
+ (sal_Int32)ceil(rRange.getMaxY() + fDiscreteOne));
+
+ // simply invalidate
+ ((Window&)getOutputDevice()).Invalidate(aInvalidateRectangle, INVALIDATE_NOERASE);
+ }
+ else
+ {
+ // #i77674# transform to rectangle. Use floor/ceil to get all covered
+ // discrete pixels, see #i75163# and OverlayManagerBuffered::invalidateRange
+ const Rectangle aInvalidateRectangle(
+ (sal_Int32)floor(rRange.getMinX()), (sal_Int32)floor(rRange.getMinY()),
+ (sal_Int32)ceil(rRange.getMaxX()), (sal_Int32)ceil(rRange.getMaxY()));
+
+ // simply invalidate
+ ((Window&)getOutputDevice()).Invalidate(aInvalidateRectangle, INVALIDATE_NOERASE);
+ }
+ }
+ }
+
+ // stripe support ColA
+ void OverlayManager::setStripeColorA(Color aNew)
+ {
+ if(aNew != maStripeColorA)
+ {
+ maStripeColorA = aNew;
+ ImpStripeDefinitionChanged();
+ }
+ }
+
+ // stripe support ColB
+ void OverlayManager::setStripeColorB(Color aNew)
+ {
+ if(aNew != maStripeColorB)
+ {
+ maStripeColorB = aNew;
+ ImpStripeDefinitionChanged();
+ }
+ }
+
+ // stripe support StripeLengthPixel
+ void OverlayManager::setStripeLengthPixel(sal_uInt32 nNew)
+ {
+ if(nNew != mnStripeLengthPixel)
+ {
+ mnStripeLengthPixel = nNew;
+ ImpStripeDefinitionChanged();
+ }
+ }
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
new file mode 100644
index 000000000000..dcbf12991d30
--- /dev/null
+++ b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
@@ -0,0 +1,538 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/overlay/overlaymanagerbuffered.hxx>
+#include <vcl/outdev.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <vcl/salbtype.hxx>
+#include <vcl/window.hxx>
+#include <vcl/bitmap.hxx>
+#include <tools/stream.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <vcl/cursor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ void OverlayManagerBuffered::ImpPrepareBufferDevice()
+ {
+ // compare size of maBufferDevice with size of visible area
+ if(maBufferDevice.GetOutputSizePixel() != getOutputDevice().GetOutputSizePixel())
+ {
+ // set new buffer size, copy as much content as possible (use bool parameter for vcl).
+ // Newly uncovered regions will be repainted.
+ maBufferDevice.SetOutputSizePixel(getOutputDevice().GetOutputSizePixel(), false);
+ }
+
+ // compare the MapModes for zoom/scroll changes
+ if(maBufferDevice.GetMapMode() != getOutputDevice().GetMapMode())
+ {
+ const bool bZoomed(
+ maBufferDevice.GetMapMode().GetScaleX() != getOutputDevice().GetMapMode().GetScaleX()
+ || maBufferDevice.GetMapMode().GetScaleY() != getOutputDevice().GetMapMode().GetScaleY());
+
+ if(!bZoomed)
+ {
+ const Point& rOriginOld = maBufferDevice.GetMapMode().GetOrigin();
+ const Point& rOriginNew = getOutputDevice().GetMapMode().GetOrigin();
+ const bool bScrolled(rOriginOld != rOriginNew);
+
+ if(bScrolled)
+ {
+ // get pixel bounds
+ const Point aOriginOldPixel(maBufferDevice.LogicToPixel(rOriginOld));
+ const Point aOriginNewPixel(maBufferDevice.LogicToPixel(rOriginNew));
+ const Size aOutputSizePixel(maBufferDevice.GetOutputSizePixel());
+
+ // remember and switch off MapMode
+ const bool bMapModeWasEnabled(maBufferDevice.IsMapModeEnabled());
+ maBufferDevice.EnableMapMode(false);
+
+ // scroll internally buffered stuff
+ const Point aDestinationOffsetPixel(aOriginNewPixel - aOriginOldPixel);
+ maBufferDevice.DrawOutDev(
+ aDestinationOffsetPixel, aOutputSizePixel, // destination
+ Point(), aOutputSizePixel); // source
+
+ // restore MapMode
+ maBufferDevice.EnableMapMode(bMapModeWasEnabled);
+
+ // scroll remembered region, too.
+ if(!maBufferRememberedRangePixel.isEmpty())
+ {
+ const basegfx::B2IPoint aIPointDestinationOffsetPixel(aDestinationOffsetPixel.X(), aDestinationOffsetPixel.Y());
+ const basegfx::B2IPoint aNewMinimum(maBufferRememberedRangePixel.getMinimum() + aIPointDestinationOffsetPixel);
+ const basegfx::B2IPoint aNewMaximum(maBufferRememberedRangePixel.getMaximum() + aIPointDestinationOffsetPixel);
+ maBufferRememberedRangePixel = basegfx::B2IRange(aNewMinimum, aNewMaximum);
+ }
+ }
+ }
+
+ // copy new MapMode
+ maBufferDevice.SetMapMode(getOutputDevice().GetMapMode());
+ }
+
+ // #i29186#
+ maBufferDevice.SetDrawMode(getOutputDevice().GetDrawMode());
+ maBufferDevice.SetSettings(getOutputDevice().GetSettings());
+ maBufferDevice.SetAntialiasing(getOutputDevice().GetAntialiasing());
+ }
+
+ void OverlayManagerBuffered::ImpRestoreBackground() const
+ {
+ const Rectangle aRegionRectanglePixel(
+ maBufferRememberedRangePixel.getMinX(), maBufferRememberedRangePixel.getMinY(),
+ maBufferRememberedRangePixel.getMaxX(), maBufferRememberedRangePixel.getMaxY());
+ const Region aRegionPixel(aRegionRectanglePixel);
+
+ ImpRestoreBackground(aRegionPixel);
+ }
+
+ void OverlayManagerBuffered::ImpRestoreBackground(const Region& rRegionPixel) const
+ {
+ // local region
+ Region aRegionPixel(rRegionPixel);
+ RegionHandle aRegionHandle(aRegionPixel.BeginEnumRects());
+ Rectangle aRegionRectanglePixel;
+
+ // MapModes off
+ const bool bMapModeWasEnabledDest(getOutputDevice().IsMapModeEnabled());
+ const bool bMapModeWasEnabledSource(maBufferDevice.IsMapModeEnabled());
+ getOutputDevice().EnableMapMode(false);
+ ((OverlayManagerBuffered*)this)->maBufferDevice.EnableMapMode(false);
+
+ while(aRegionPixel.GetEnumRects(aRegionHandle, aRegionRectanglePixel))
+ {
+#ifdef DBG_UTIL
+ // #i72754# possible graphical region test only with non-pro
+ static bool bDoPaintForVisualControl(false);
+ if(bDoPaintForVisualControl)
+ {
+ getOutputDevice().SetLineColor(COL_LIGHTGREEN);
+ getOutputDevice().SetFillColor();
+ getOutputDevice().DrawRect(aRegionRectanglePixel);
+ }
+#endif
+
+ // restore the area
+ const Point aTopLeft(aRegionRectanglePixel.TopLeft());
+ const Size aSize(aRegionRectanglePixel.GetSize());
+
+ getOutputDevice().DrawOutDev(
+ aTopLeft, aSize, // destination
+ aTopLeft, aSize, // source
+ maBufferDevice);
+ }
+
+ aRegionPixel.EndEnumRects(aRegionHandle);
+
+ // restore MapModes
+ getOutputDevice().EnableMapMode(bMapModeWasEnabledDest);
+ ((OverlayManagerBuffered*)this)->maBufferDevice.EnableMapMode(bMapModeWasEnabledSource);
+ }
+
+ void OverlayManagerBuffered::ImpSaveBackground(const Region& rRegion, OutputDevice* pPreRenderDevice)
+ {
+ // prepare source
+ OutputDevice& rSource = (pPreRenderDevice) ? *pPreRenderDevice : getOutputDevice();
+
+ // Ensure buffer is valid
+ ImpPrepareBufferDevice();
+
+ // build region which needs to be copied
+ Region aRegion(rSource.LogicToPixel(rRegion));
+
+ // limit to PaintRegion if it's a window. This will be evtl. the expanded one,
+ // but always the exact redraw area
+ if(OUTDEV_WINDOW == rSource.GetOutDevType())
+ {
+ Window& rWindow = (Window&)rSource;
+ Region aPaintRegionPixel = rWindow.LogicToPixel(rWindow.GetPaintRegion());
+ aRegion.Intersect(aPaintRegionPixel);
+
+ // #i72754# Make sure content is completetly rendered, the window
+ // will be used as source of a DrawOutDev soon
+ rWindow.Flush();
+ }
+
+ // also limit to buffer size
+ const Rectangle aBufferDeviceRectanglePixel = Rectangle(Point(), maBufferDevice.GetOutputSizePixel());
+ aRegion.Intersect(aBufferDeviceRectanglePixel);
+
+ // prepare to iterate over the rectangles from the region in pixels
+ RegionHandle aRegionHandle(aRegion.BeginEnumRects());
+ Rectangle aRegionRectanglePixel;
+
+ // MapModes off
+ const bool bMapModeWasEnabledDest(rSource.IsMapModeEnabled());
+ const bool bMapModeWasEnabledSource(maBufferDevice.IsMapModeEnabled());
+ rSource.EnableMapMode(false);
+ maBufferDevice.EnableMapMode(false);
+
+ while(aRegion.GetEnumRects(aRegionHandle, aRegionRectanglePixel))
+ {
+ // for each rectangle, save the area
+ Point aTopLeft(aRegionRectanglePixel.TopLeft());
+ Size aSize(aRegionRectanglePixel.GetSize());
+
+ maBufferDevice.DrawOutDev(
+ aTopLeft, aSize, // destination
+ aTopLeft, aSize, // source
+ rSource);
+
+#ifdef DBG_UTIL
+ // #i72754# possible graphical region test only with non-pro
+ static bool bDoPaintForVisualControl(false);
+ if(bDoPaintForVisualControl)
+ {
+ const bool bMapModeWasEnabledTest(getOutputDevice().IsMapModeEnabled());
+ getOutputDevice().EnableMapMode(false);
+ getOutputDevice().SetLineColor(COL_LIGHTRED);
+ getOutputDevice().SetFillColor();
+ getOutputDevice().DrawRect(aRegionRectanglePixel);
+ getOutputDevice().EnableMapMode(bMapModeWasEnabledTest);
+ }
+
+ static bool bDoSaveForVisualControl(false);
+ if(bDoSaveForVisualControl)
+ {
+ const Bitmap aBitmap(maBufferDevice.GetBitmap(aTopLeft, aSize));
+ SvFileStream aNew((const String&)String(ByteString( "c:\\test.bmp" ), RTL_TEXTENCODING_UTF8), STREAM_WRITE|STREAM_TRUNC);
+ aNew << aBitmap;
+ }
+#endif
+ }
+
+ aRegion.EndEnumRects(aRegionHandle);
+
+ // restore MapModes
+ rSource.EnableMapMode(bMapModeWasEnabledDest);
+ maBufferDevice.EnableMapMode(bMapModeWasEnabledSource);
+ }
+
+ IMPL_LINK(OverlayManagerBuffered, ImpBufferTimerHandler, AutoTimer*, /*pTimer*/)
+ {
+ // stop timer
+ maBufferTimer.Stop();
+
+ if(!maBufferRememberedRangePixel.isEmpty())
+ {
+ // logic size for impDrawMember call
+ basegfx::B2DRange aBufferRememberedRangeLogic(
+ maBufferRememberedRangePixel.getMinX(), maBufferRememberedRangePixel.getMinY(),
+ maBufferRememberedRangePixel.getMaxX(), maBufferRememberedRangePixel.getMaxY());
+ aBufferRememberedRangeLogic.transform(getOutputDevice().GetInverseViewTransformation());
+
+ // prepare cursor handling
+ const bool bTargetIsWindow(OUTDEV_WINDOW == rmOutputDevice.GetOutDevType());
+ bool bCursorWasEnabled(false);
+
+ // #i80730# switch off VCL cursor during overlay refresh
+ if(bTargetIsWindow)
+ {
+ Window& rWindow = static_cast< Window& >(rmOutputDevice);
+ Cursor* pCursor = rWindow.GetCursor();
+
+ if(pCursor && pCursor->IsVisible())
+ {
+ pCursor->Hide();
+ bCursorWasEnabled = true;
+ }
+ }
+
+ if(DoRefreshWithPreRendering())
+ {
+ // #i73602# ensure valid and sized maOutputBufferDevice
+ const Size aDestinationSizePixel(maBufferDevice.GetOutputSizePixel());
+ const Size aOutputBufferSizePixel(maOutputBufferDevice.GetOutputSizePixel());
+
+ if(aDestinationSizePixel != aOutputBufferSizePixel)
+ {
+ maOutputBufferDevice.SetOutputSizePixel(aDestinationSizePixel);
+ }
+
+ maOutputBufferDevice.SetMapMode(getOutputDevice().GetMapMode());
+ maOutputBufferDevice.EnableMapMode(false);
+ maOutputBufferDevice.SetDrawMode(maBufferDevice.GetDrawMode());
+ maOutputBufferDevice.SetSettings(maBufferDevice.GetSettings());
+ maOutputBufferDevice.SetAntialiasing(maBufferDevice.GetAntialiasing());
+
+ // calculate sizes
+ Rectangle aRegionRectanglePixel(
+ maBufferRememberedRangePixel.getMinX(), maBufferRememberedRangePixel.getMinY(),
+ maBufferRememberedRangePixel.getMaxX(), maBufferRememberedRangePixel.getMaxY());
+
+ // truncate aRegionRectanglePixel to destination pixel size, more does
+ // not need to be prepared since destination is a buffer for a window. So,
+ // maximum size indirectly shall be limited to getOutputDevice().GetOutputSizePixel()
+ if(aRegionRectanglePixel.Left() < 0L)
+ {
+ aRegionRectanglePixel.Left() = 0L;
+ }
+
+ if(aRegionRectanglePixel.Top() < 0L)
+ {
+ aRegionRectanglePixel.Top() = 0L;
+ }
+
+ if(aRegionRectanglePixel.Right() > aDestinationSizePixel.getWidth())
+ {
+ aRegionRectanglePixel.Right() = aDestinationSizePixel.getWidth();
+ }
+
+ if(aRegionRectanglePixel.Bottom() > aDestinationSizePixel.getHeight())
+ {
+ aRegionRectanglePixel.Bottom() = aDestinationSizePixel.getHeight();
+ }
+
+ // get sizes
+ const Point aTopLeft(aRegionRectanglePixel.TopLeft());
+ const Size aSize(aRegionRectanglePixel.GetSize());
+
+ {
+ const bool bMapModeWasEnabledDest(maBufferDevice.IsMapModeEnabled());
+ maBufferDevice.EnableMapMode(false);
+
+ maOutputBufferDevice.DrawOutDev(
+ aTopLeft, aSize, // destination
+ aTopLeft, aSize, // source
+ maBufferDevice);
+
+ // restore MapModes
+ maBufferDevice.EnableMapMode(bMapModeWasEnabledDest);
+ }
+
+ // paint overlay content for remembered region, use
+ // method from base class directly
+ maOutputBufferDevice.EnableMapMode(true);
+ OverlayManager::ImpDrawMembers(aBufferRememberedRangeLogic, maOutputBufferDevice);
+ maOutputBufferDevice.EnableMapMode(false);
+
+ // copy to output
+ {
+ const bool bMapModeWasEnabledDest(getOutputDevice().IsMapModeEnabled());
+ getOutputDevice().EnableMapMode(false);
+
+ getOutputDevice().DrawOutDev(
+ aTopLeft, aSize, // destination
+ aTopLeft, aSize, // source
+ maOutputBufferDevice);
+
+ // debug
+ /*getOutputDevice().SetLineColor(COL_RED);
+ getOutputDevice().SetFillColor();
+ getOutputDevice().DrawRect(Rectangle(aTopLeft, aSize));*/
+
+ // restore MapModes
+ getOutputDevice().EnableMapMode(bMapModeWasEnabledDest);
+ }
+ }
+ else
+ {
+ // Restore all rectangles for remembered region from buffer
+ ImpRestoreBackground();
+
+ // paint overlay content for remembered region, use
+ // method from base class directly
+ OverlayManager::ImpDrawMembers(aBufferRememberedRangeLogic, getOutputDevice());
+ }
+
+ // VCL hack for transparent child windows
+ // Problem is e.g. a radiobuttion form control in life mode. The used window
+ // is a transparence vcl childwindow. This flag only allows the parent window to
+ // paint into the child windows area, but there is no mechanism which takes
+ // care for a repaint of the child window. A transparent child window is NOT
+ // a window which always keeps it's content consistent over the parent, but it's
+ // more like just a paint flag for the parent.
+ // To get the update, the windows in question are updated manulally here.
+ if(bTargetIsWindow)
+ {
+ Window& rWindow = static_cast< Window& >(rmOutputDevice);
+
+ if(rWindow.IsChildTransparentModeEnabled() && rWindow.GetChildCount())
+ {
+ const Rectangle aRegionRectanglePixel(
+ maBufferRememberedRangePixel.getMinX(), maBufferRememberedRangePixel.getMinY(),
+ maBufferRememberedRangePixel.getMaxX(), maBufferRememberedRangePixel.getMaxY());
+
+ for(sal_uInt16 a(0); a < rWindow.GetChildCount(); a++)
+ {
+ Window* pCandidate = rWindow.GetChild(a);
+
+ if(pCandidate && pCandidate->IsPaintTransparent())
+ {
+ const Rectangle aCandidatePosSizePixel(pCandidate->GetPosPixel(), pCandidate->GetSizePixel());
+
+ if(aCandidatePosSizePixel.IsOver(aRegionRectanglePixel))
+ {
+ pCandidate->Invalidate(INVALIDATE_NOTRANSPARENT|INVALIDATE_CHILDREN);
+ pCandidate->Update();
+ }
+ }
+ }
+ }
+ }
+
+ // #i80730# restore visibility of VCL cursor
+ if(bCursorWasEnabled)
+ {
+ Window& rWindow = static_cast< Window& >(rmOutputDevice);
+ Cursor* pCursor = rWindow.GetCursor();
+
+ if(pCursor)
+ {
+ // check if cursor still exists. It may have been deleted from someone
+ pCursor->Show();
+ }
+ }
+
+ // forget remembered Region
+ maBufferRememberedRangePixel.reset();
+ }
+
+ return 0;
+ }
+
+ OverlayManagerBuffered::OverlayManagerBuffered(
+ OutputDevice& rOutputDevice,
+ OverlayManager* pOldOverlayManager,
+ bool bRefreshWithPreRendering)
+ : OverlayManager(rOutputDevice, pOldOverlayManager),
+ mbRefreshWithPreRendering(bRefreshWithPreRendering)
+ {
+ // Init timer
+ maBufferTimer.SetTimeout(1);
+ maBufferTimer.SetTimeoutHdl(LINK(this, OverlayManagerBuffered, ImpBufferTimerHandler));
+ }
+
+ OverlayManagerBuffered::~OverlayManagerBuffered()
+ {
+ // Clear timer
+ maBufferTimer.Stop();
+
+ if(!maBufferRememberedRangePixel.isEmpty())
+ {
+ // Restore all rectangles for remembered region from buffer
+ ImpRestoreBackground();
+ }
+ }
+
+ void OverlayManagerBuffered::completeRedraw(const Region& rRegion, OutputDevice* pPreRenderDevice) const
+ {
+ if(!rRegion.IsEmpty())
+ {
+ // save new background
+ ((OverlayManagerBuffered*)this)->ImpSaveBackground(rRegion, pPreRenderDevice);
+ }
+
+ // call parent
+ OverlayManager::completeRedraw(rRegion, pPreRenderDevice);
+ }
+
+ void OverlayManagerBuffered::flush()
+ {
+ // call timer handler direct
+ ImpBufferTimerHandler(0);
+ }
+
+ // #i68597# part of content gets copied, react on it
+ void OverlayManagerBuffered::copyArea(const Point& rDestPt, const Point& rSrcPt, const Size& rSrcSize)
+ {
+ // scroll local buffered area
+ maBufferDevice.CopyArea(rDestPt, rSrcPt, rSrcSize);
+ }
+
+ void OverlayManagerBuffered::restoreBackground(const Region& rRegion) const
+ {
+ // restore
+ const Region aRegionPixel(getOutputDevice().LogicToPixel(rRegion));
+ ImpRestoreBackground(aRegionPixel);
+
+ // call parent
+ OverlayManager::restoreBackground(rRegion);
+ }
+
+ void OverlayManagerBuffered::invalidateRange(const basegfx::B2DRange& rRange)
+ {
+ if(!rRange.isEmpty())
+ {
+ // buffered output, do not invalidate but use the timer
+ // to trigger a timer event for refresh
+ maBufferTimer.Start();
+
+ // add the discrete range to the remembered region
+ // #i75163# use double precision and floor/ceil rounding to get overlapped pixel region, even
+ // when the given logic region has a width/height of 0.0. This does NOT work with LogicToPixel
+ // since it just transforms the top left and bottom right points equally without taking
+ // discrete pixel coverage into account. An empty B2DRange and thus empty logic Rectangle translated
+ // to an also empty discrete pixel rectangle - what is wrong.
+ basegfx::B2DRange aDiscreteRange(rRange);
+ aDiscreteRange.transform(getOutputDevice().GetViewTransformation());
+
+ if(maDrawinglayerOpt.IsAntiAliasing())
+ {
+ // assume AA needs one pixel more and invalidate one pixel more
+ const double fDiscreteOne(getDiscreteOne());
+ const basegfx::B2IPoint aTopLeft(
+ (sal_Int32)floor(aDiscreteRange.getMinX() - fDiscreteOne),
+ (sal_Int32)floor(aDiscreteRange.getMinY() - fDiscreteOne));
+ const basegfx::B2IPoint aBottomRight(
+ (sal_Int32)ceil(aDiscreteRange.getMaxX() + fDiscreteOne),
+ (sal_Int32)ceil(aDiscreteRange.getMaxY() + fDiscreteOne));
+
+ maBufferRememberedRangePixel.expand(aTopLeft);
+ maBufferRememberedRangePixel.expand(aBottomRight);
+ }
+ else
+ {
+ const basegfx::B2IPoint aTopLeft((sal_Int32)floor(aDiscreteRange.getMinX()), (sal_Int32)floor(aDiscreteRange.getMinY()));
+ const basegfx::B2IPoint aBottomRight((sal_Int32)ceil(aDiscreteRange.getMaxX()), (sal_Int32)ceil(aDiscreteRange.getMaxY()));
+
+ maBufferRememberedRangePixel.expand(aTopLeft);
+ maBufferRememberedRangePixel.expand(aBottomRight);
+ }
+ }
+ }
+
+ void OverlayManagerBuffered::SetRefreshWithPreRendering(bool bNew)
+ {
+ if((bool)mbRefreshWithPreRendering != bNew)
+ {
+ mbRefreshWithPreRendering = bNew;
+ }
+ }
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/overlay/overlayobject.cxx b/svx/source/sdr/overlay/overlayobject.cxx
new file mode 100644
index 000000000000..049dfe2ecc4c
--- /dev/null
+++ b/svx/source/sdr/overlay/overlayobject.cxx
@@ -0,0 +1,216 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/overlay/overlayobject.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <tools/debug.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/salbtype.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <svx/sdr/contact/objectcontacttools.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ void OverlayObject::objectChange()
+ {
+ const basegfx::B2DRange aPreviousRange(maBaseRange);
+ maBaseRange.reset();
+ setPrimitive2DSequence(drawinglayer::primitive2d::Primitive2DSequence());
+
+ if(getOverlayManager() && !aPreviousRange.isEmpty())
+ {
+ getOverlayManager()->invalidateRange(aPreviousRange);
+ }
+
+ const basegfx::B2DRange& rCurrentRange = getBaseRange();
+
+ if(getOverlayManager() && rCurrentRange != aPreviousRange && !rCurrentRange.isEmpty())
+ {
+ getOverlayManager()->invalidateRange(rCurrentRange);
+ }
+ }
+
+ // OverlayObject implementations.
+ drawinglayer::primitive2d::Primitive2DSequence OverlayObject::createOverlayObjectPrimitive2DSequence()
+ {
+ // 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::allowAntiAliase(bool bNew)
+ {
+ if(bNew != (bool)mbAllowsAntiAliase)
+ {
+ // remember new value
+ mbAllowsAntiAliase = bNew;
+
+ // register change (after change)
+ objectChange();
+ }
+ }
+
+ OverlayObject::OverlayObject(Color aBaseColor)
+ : Event(0),
+ mpOverlayManager(0),
+ maBaseColor(aBaseColor),
+ mbIsVisible(true),
+ mbIsHittable(true),
+ mbAllowsAnimation(false),
+ mbAllowsAntiAliase(true)
+ {
+ }
+
+ OverlayObject::~OverlayObject()
+ {
+ OSL_ENSURE(0 == getOverlayManager(), "OverlayObject is destructed which is still registered at OverlayManager (!)");
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence OverlayObject::getOverlayObjectPrimitive2DSequence() const
+ {
+ if(!getPrimitive2DSequence().hasElements())
+ {
+ // no existing sequence; create one
+ const_cast< OverlayObject* >(this)->setPrimitive2DSequence(
+ const_cast< OverlayObject* >(this)->createOverlayObjectPrimitive2DSequence());
+ }
+
+ return getPrimitive2DSequence();
+ }
+
+ const basegfx::B2DRange& OverlayObject::getBaseRange() const
+ {
+ if(getOverlayManager() && maBaseRange.isEmpty())
+ {
+ const drawinglayer::primitive2d::Primitive2DSequence& rSequence = getOverlayObjectPrimitive2DSequence();
+
+ if(rSequence.hasElements())
+ {
+ const drawinglayer::geometry::ViewInformation2D aViewInformation2D(getOverlayManager()->getCurrentViewInformation2D());
+
+ const_cast< sdr::overlay::OverlayObject* >(this)->maBaseRange =
+ drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(rSequence, aViewInformation2D);
+ }
+ }
+
+ return maBaseRange;
+ }
+
+ void OverlayObject::setVisible(bool bNew)
+ {
+ if(bNew != (bool)mbIsVisible)
+ {
+ // remember new value
+ mbIsVisible = bNew;
+
+ // register change (after change)
+ objectChange();
+ }
+ }
+
+ void OverlayObject::setHittable(bool bNew)
+ {
+ if(bNew != (bool)mbIsHittable)
+ {
+ // remember new value
+ mbIsHittable = bNew;
+
+ // register change (after change)
+ objectChange();
+ }
+ }
+
+ void OverlayObject::setBaseColor(Color aNew)
+ {
+ if(aNew != maBaseColor)
+ {
+ // remember new value
+ maBaseColor = aNew;
+
+ // register change (after change)
+ objectChange();
+ }
+ }
+
+ void OverlayObject::Trigger(sal_uInt32 /*nTime*/)
+ {
+ // default does not register again
+ }
+
+ void OverlayObject::stripeDefinitionHasChanged()
+ {
+ // default does not need to do anything
+ }
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ OverlayObjectWithBasePosition::OverlayObjectWithBasePosition(const basegfx::B2DPoint& rBasePos, Color aBaseColor)
+ : OverlayObject(aBaseColor),
+ maBasePosition(rBasePos)
+ {
+ }
+
+ OverlayObjectWithBasePosition::~OverlayObjectWithBasePosition()
+ {
+ }
+
+ void OverlayObjectWithBasePosition::setBasePosition(const basegfx::B2DPoint& rNew)
+ {
+ if(rNew != maBasePosition)
+ {
+ // remember new value
+ maBasePosition = rNew;
+
+ // register change (after change)
+ objectChange();
+ }
+ }
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/overlay/overlayobjectcell.cxx b/svx/source/sdr/overlay/overlayobjectcell.cxx
new file mode 100644
index 000000000000..dbf38a8cd0f1
--- /dev/null
+++ b/svx/source/sdr/overlay/overlayobjectcell.cxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <basegfx/numeric/ftools.hxx>
+#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/unifiedtransparenceprimitive2d.hxx>
+#include <drawinglayer/primitive2d/invertprimitive2d.hxx>
+
+using namespace ::basegfx;
+
+// #114409#
+namespace sdr
+{
+ namespace overlay
+ {
+ OverlayObjectCell::OverlayObjectCell( CellOverlayType eType, const Color& rColor, const RangeVector& rRects )
+ : OverlayObject( rColor ),
+ mePaintType( eType ),
+ maRectangles( rRects )
+ {
+ // no AA for selection overlays
+ allowAntiAliase(false);
+ }
+
+ OverlayObjectCell::~OverlayObjectCell()
+ {
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence OverlayObjectCell::createOverlayObjectPrimitive2DSequence()
+ {
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
+ const sal_uInt32 nCount(maRectangles.size());
+
+ if(nCount)
+ {
+ const basegfx::BColor aRGBColor(getBaseColor().getBColor());
+ aRetval.realloc(nCount);
+
+ // create primitives for all ranges
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ const basegfx::B2DRange& rRange(maRectangles[a]);
+ const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(rRange));
+
+ aRetval[a] = drawinglayer::primitive2d::Primitive2DReference(
+ new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
+ basegfx::B2DPolyPolygon(aPolygon),
+ aRGBColor));
+ }
+
+
+ if(mePaintType == CELL_OVERLAY_TRANSPARENT)
+ {
+ // embed in 50% transparent paint
+ const drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparence(
+ new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(
+ aRetval,
+ 0.5));
+
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparence, 1);
+ }
+ else // CELL_OVERLAY_INVERT
+ {
+ // embed in invert primitive
+ const drawinglayer::primitive2d::Primitive2DReference aInvert(
+ new drawinglayer::primitive2d::InvertPrimitive2D(
+ aRetval));
+
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aInvert, 1);
+ }
+ }
+
+ return aRetval;
+ }
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/overlay/overlayobjectlist.cxx b/svx/source/sdr/overlay/overlayobjectlist.cxx
new file mode 100644
index 000000000000..e9464bdee09b
--- /dev/null
+++ b/svx/source/sdr/overlay/overlayobjectlist.cxx
@@ -0,0 +1,184 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/overlay/overlayobjectlist.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <tools/debug.hxx>
+#include <vcl/outdev.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+// for SOLARIS compiler include of algorithm part of _STL is necesary to
+// get access to basic algos like ::std::find
+#include <algorithm>
+
+#include <drawinglayer/processor2d/hittestprocessor2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ OverlayObjectList::~OverlayObjectList()
+ {
+ clear();
+ }
+
+ void OverlayObjectList::clear()
+ {
+ OverlayObjectVector::iterator aStart(maVector.begin());
+
+ for(; aStart != maVector.end(); aStart++)
+ {
+ ::sdr::overlay::OverlayObject* pCandidate = *aStart;
+
+ if(pCandidate->getOverlayManager())
+ {
+ pCandidate->getOverlayManager()->remove(*pCandidate);
+ }
+
+ delete pCandidate;
+ }
+
+ maVector.clear();
+ }
+
+ void OverlayObjectList::remove(OverlayObject& rOverlayObject)
+ {
+ const OverlayObjectVector::iterator aFindResult = ::std::find(maVector.begin(), maVector.end(), &rOverlayObject);
+ const bool bFound(aFindResult != maVector.end());
+ OSL_ENSURE(bFound, "Could not find given object in list (!)");
+
+ if(bFound)
+ {
+ maVector.erase(aFindResult);
+ }
+ }
+
+ 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(pManager)
+ {
+ if(0.0 == fLogicTolerance)
+ {
+ const Size aSizeLogic(pManager->getOutputDevice().PixelToLogic(
+ Size(DEFAULT_VALUE_FOR_HITTEST_PIXEL, DEFAULT_VALUE_FOR_HITTEST_PIXEL)));
+ fLogicTolerance = aSizeLogic.Width();
+ }
+
+ const drawinglayer::geometry::ViewInformation2D aViewInformation2D(pManager->getCurrentViewInformation2D());
+ drawinglayer::processor2d::HitTestProcessor2D aHitTestProcessor2D(
+ aViewInformation2D,
+ rLogicPosition,
+ fLogicTolerance,
+ false);
+
+ for(; aStart != maVector.end(); aStart++)
+ {
+ 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 false;
+ }
+
+ bool OverlayObjectList::isHitPixel(const Point& rDiscretePosition, sal_uInt32 nDiscreteTolerance) const
+ {
+ if(maVector.size())
+ {
+ OverlayObjectVector::const_iterator aStart(maVector.begin());
+ sdr::overlay::OverlayObject* pCandidate = *aStart;
+ OverlayManager* pManager = pCandidate->getOverlayManager();
+
+ if(pManager)
+ {
+ const Point aPosLogic(pManager->getOutputDevice().PixelToLogic(rDiscretePosition));
+ const basegfx::B2DPoint aPosition(aPosLogic.X(), aPosLogic.Y());
+
+ if(nDiscreteTolerance)
+ {
+ const Size aSizeLogic(pManager->getOutputDevice().PixelToLogic(Size(nDiscreteTolerance, nDiscreteTolerance)));
+ return isHitLogic(aPosition, (double)aSizeLogic.Width());
+ }
+ else
+ {
+ return isHitLogic(aPosition);
+ }
+ }
+ }
+
+ return false;
+ }
+
+ basegfx::B2DRange OverlayObjectList::getBaseRange() const
+ {
+ basegfx::B2DRange aRetval;
+
+ if(maVector.size())
+ {
+ OverlayObjectVector::const_iterator aStart(maVector.begin());
+
+ for(; aStart != maVector.end(); aStart++)
+ {
+ ::sdr::overlay::OverlayObject* pCandidate = *aStart;
+ aRetval.expand(pCandidate->getBaseRange());
+ }
+ }
+
+ return aRetval;
+ }
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/overlay/overlaypolypolygon.cxx b/svx/source/sdr/overlay/overlaypolypolygon.cxx
new file mode 100644
index 000000000000..a8476854ae13
--- /dev/null
+++ b/svx/source/sdr/overlay/overlaypolypolygon.cxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/overlay/overlaypolypolygon.hxx>
+#include <vcl/salbtype.hxx>
+#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>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ drawinglayer::primitive2d::Primitive2DSequence OverlayPolyPolygonStriped::createOverlayObjectPrimitive2DSequence()
+ {
+ 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());
+
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new drawinglayer::primitive2d::PolyPolygonMarkerPrimitive2D(
+ getPolyPolygon(),
+ aRGBColorA,
+ aRGBColorB,
+ fStripeLengthPixel));
+
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
+ }
+
+ return aRetval;
+ }
+
+ void OverlayPolyPolygonStriped::stripeDefinitionHasChanged()
+ {
+ // react on OverlayManager's stripe definition change
+ objectChange();
+ }
+
+ OverlayPolyPolygonStriped::OverlayPolyPolygonStriped(
+ const basegfx::B2DPolyPolygon& rPolyPolygon)
+ : OverlayObject(Color(COL_BLACK)),
+ maPolyPolygon(rPolyPolygon)
+ {
+ }
+
+ OverlayPolyPolygonStriped::~OverlayPolyPolygonStriped()
+ {
+ }
+
+ void OverlayPolyPolygonStriped::setPolyPolygon(const basegfx::B2DPolyPolygon& rNew)
+ {
+ if(rNew != maPolyPolygon)
+ {
+ // remember new value
+ maPolyPolygon = rNew;
+
+ // register change (after change)
+ objectChange();
+ }
+ }
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/overlay/overlayprimitive2dsequenceobject.cxx b/svx/source/sdr/overlay/overlayprimitive2dsequenceobject.cxx
new file mode 100644
index 000000000000..52f43084c664
--- /dev/null
+++ b/svx/source/sdr/overlay/overlayprimitive2dsequenceobject.cxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx>
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+#include <drawinglayer/processor2d/vclpixelprocessor2d.hxx>
+#include <svx/sdr/contact/objectcontacttools.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ drawinglayer::primitive2d::Primitive2DSequence OverlayPrimitive2DSequenceObject::createOverlayObjectPrimitive2DSequence()
+ {
+ return getSequence();
+ }
+
+ OverlayPrimitive2DSequenceObject::OverlayPrimitive2DSequenceObject(const drawinglayer::primitive2d::Primitive2DSequence& rSequence)
+ : OverlayObjectWithBasePosition(basegfx::B2DPoint(), Color(COL_BLACK)),
+ maSequence(rSequence)
+ {
+ }
+
+ OverlayPrimitive2DSequenceObject::~OverlayPrimitive2DSequenceObject()
+ {
+ }
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/overlay/overlayrollingrectangle.cxx b/svx/source/sdr/overlay/overlayrollingrectangle.cxx
new file mode 100644
index 000000000000..1b09df2ca60e
--- /dev/null
+++ b/svx/source/sdr/overlay/overlayrollingrectangle.cxx
@@ -0,0 +1,150 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/overlay/overlayrollingrectangle.hxx>
+#include <tools/gen.hxx>
+#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>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ drawinglayer::primitive2d::Primitive2DSequence OverlayRollingRectangleStriped::createOverlayObjectPrimitive2DSequence()
+ {
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
+
+ if(getOverlayManager() && (getShowBounds() || getExtendedLines()))
+ {
+ 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());
+
+ 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);
+ }
+
+ 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::stripeDefinitionHasChanged()
+ {
+ // react on OverlayManager's stripe definition change
+ objectChange();
+ }
+
+ OverlayRollingRectangleStriped::OverlayRollingRectangleStriped(
+ const basegfx::B2DPoint& rBasePos,
+ const basegfx::B2DPoint& rSecondPos,
+ bool bExtendedLines,
+ bool bShowBounds)
+ : OverlayObjectWithBasePosition(rBasePos, Color(COL_BLACK)),
+ maSecondPosition(rSecondPos),
+ mbExtendedLines(bExtendedLines),
+ mbShowBounds(bShowBounds)
+ {
+ }
+
+ OverlayRollingRectangleStriped::~OverlayRollingRectangleStriped()
+ {
+ }
+
+ void OverlayRollingRectangleStriped::setSecondPosition(const basegfx::B2DPoint& rNew)
+ {
+ if(rNew != maSecondPosition)
+ {
+ // remember new value
+ maSecondPosition = rNew;
+
+ // register change (after change)
+ objectChange();
+ }
+ }
+
+ void OverlayRollingRectangleStriped::setExtendedLines(bool bNew)
+ {
+ if(bNew != (bool)mbExtendedLines)
+ {
+ // remember new value
+ mbExtendedLines = bNew;
+
+ // register change (after change)
+ objectChange();
+ }
+ }
+
+ void OverlayRollingRectangleStriped::setShowBounds(bool bNew)
+ {
+ if(bNew != (bool)mbShowBounds)
+ {
+ // remember new value
+ mbShowBounds = bNew;
+
+ // register change (after change)
+ objectChange();
+ }
+ }
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/overlay/overlayselection.cxx b/svx/source/sdr/overlay/overlayselection.cxx
new file mode 100644
index 000000000000..2115d3c63120
--- /dev/null
+++ b/svx/source/sdr/overlay/overlayselection.cxx
@@ -0,0 +1,237 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/overlay/overlayselection.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <svtools/optionsdrawinglayer.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/outdev.hxx>
+#include <drawinglayer/primitive2d/invertprimitive2d.hxx>
+#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ // combine rages geometrically to a single, ORed polygon
+ basegfx::B2DPolyPolygon impCombineRangesToPolyPolygon(const std::vector< basegfx::B2DRange >& rRanges)
+ {
+ const sal_uInt32 nCount(rRanges.size());
+ basegfx::B2DPolyPolygon aRetval;
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ const basegfx::B2DPolygon aDiscretePolygon(basegfx::tools::createPolygonFromRect(rRanges[a]));
+
+ if(0 == a)
+ {
+ aRetval.append(aDiscretePolygon);
+ }
+ else
+ {
+ aRetval = basegfx::tools::solvePolygonOperationOr(aRetval, basegfx::B2DPolyPolygon(aDiscretePolygon));
+ }
+ }
+
+ return aRetval;
+ }
+
+ // check if wanted type OVERLAY_TRANSPARENT or OVERLAY_SOLID
+ // is possible. If not, fallback to invert mode (classic mode)
+ OverlayType impCheckPossibleOverlayType(OverlayType aOverlayType)
+ {
+ if(OVERLAY_INVERT != aOverlayType)
+ {
+ const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
+
+ if(!aSvtOptionsDrawinglayer.IsTransparentSelection())
+ {
+ // not possible when switched off by user
+ return OVERLAY_INVERT;
+ }
+ else
+ {
+ const OutputDevice *pOut = Application::GetDefaultDevice();
+
+ if(pOut->GetSettings().GetStyleSettings().GetHighContrastMode())
+ {
+ // not possible when in high contrast mode
+ return OVERLAY_INVERT;
+ }
+
+ if(!pOut->supportsOperation(OutDevSupport_TransparentRect))
+ {
+ // not possible when no fast transparence paint is supported on the system
+ return OVERLAY_INVERT;
+ }
+ }
+ }
+
+ return aOverlayType;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence OverlaySelection::createOverlayObjectPrimitive2DSequence()
+ {
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
+ const sal_uInt32 nCount(getRanges().size());
+
+ if(nCount)
+ {
+ // create range primitives
+ const bool bInvert(OVERLAY_INVERT == maLastOverlayType);
+ basegfx::BColor aRGBColor(getBaseColor().getBColor());
+ aRetval.realloc(nCount);
+
+ if(bInvert)
+ {
+ // force color to white for invert to get a full invert
+ aRGBColor = basegfx::BColor(1.0, 1.0, 1.0);
+ }
+
+ for(sal_uInt32 a(0);a < nCount; a++)
+ {
+ const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(maRanges[a]));
+ aRetval[a] = drawinglayer::primitive2d::Primitive2DReference(
+ new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
+ basegfx::B2DPolyPolygon(aPolygon),
+ aRGBColor));
+ }
+
+ if(bInvert)
+ {
+ // embed all in invert primitive
+ const drawinglayer::primitive2d::Primitive2DReference aInvert(
+ new drawinglayer::primitive2d::InvertPrimitive2D(
+ aRetval));
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aInvert, 1);
+ }
+ else if(OVERLAY_TRANSPARENT == maLastOverlayType)
+ {
+ // embed all rectangles in transparent paint
+ const double fTransparence(mnLastTransparence / 100.0);
+ const drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparence(
+ new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(
+ aRetval,
+ fTransparence));
+
+ if(getBorder())
+ {
+ const basegfx::B2DPolyPolygon aPolyPolygon(impCombineRangesToPolyPolygon(getRanges()));
+ const drawinglayer::primitive2d::Primitive2DReference aSelectionOutline(
+ new drawinglayer::primitive2d::PolyPolygonHairlinePrimitive2D(
+ aPolyPolygon,
+ aRGBColor));
+
+ // add both to result
+ aRetval.realloc(2);
+ aRetval[0] = aUnifiedTransparence;
+ aRetval[1] = aSelectionOutline;
+ }
+ else
+ {
+ // just add transparent part
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparence, 1);
+ }
+ }
+ }
+
+ return aRetval;
+ }
+
+ OverlaySelection::OverlaySelection(
+ OverlayType eType,
+ const Color& rColor,
+ const std::vector< basegfx::B2DRange >& rRanges,
+ bool bBorder)
+ : OverlayObject(rColor),
+ meOverlayType(eType),
+ maRanges(rRanges),
+ maLastOverlayType(eType),
+ mnLastTransparence(0),
+ mbBorder(bBorder)
+ {
+ // no AA for selection overlays
+ allowAntiAliase(false);
+ }
+
+ OverlaySelection::~OverlaySelection()
+ {
+ if(getOverlayManager())
+ {
+ getOverlayManager()->remove(*this);
+ }
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence OverlaySelection::getOverlayObjectPrimitive2DSequence() const
+ {
+ // get current values
+ const OverlayType aNewOverlayType(impCheckPossibleOverlayType(meOverlayType));
+ const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
+ const sal_uInt16 nNewTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent());
+
+ if(getPrimitive2DSequence().hasElements())
+ {
+ if(aNewOverlayType != maLastOverlayType
+ || nNewTransparence != mnLastTransparence)
+ {
+ // conditions of last local decomposition have changed, delete
+ const_cast< OverlaySelection* >(this)->setPrimitive2DSequence(drawinglayer::primitive2d::Primitive2DSequence());
+ }
+ }
+
+ if(!getPrimitive2DSequence().hasElements())
+ {
+ // remember new values
+ const_cast< OverlaySelection* >(this)->maLastOverlayType = aNewOverlayType;
+ const_cast< OverlaySelection* >(this)->mnLastTransparence = nNewTransparence;
+ }
+
+ // call base implementation
+ return OverlayObject::getOverlayObjectPrimitive2DSequence();
+ }
+
+ void OverlaySelection::setRanges(const std::vector< basegfx::B2DRange >& rNew)
+ {
+ if(rNew != maRanges)
+ {
+ maRanges = rNew;
+ objectChange();
+ }
+ }
+ } // 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..215b8484d5bf
--- /dev/null
+++ b/svx/source/sdr/overlay/overlaytools.cxx
@@ -0,0 +1,493 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_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>
+#include <basegfx/matrix/b2dhommatrixtools.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::create2DDecomposition(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::create2DDecomposition(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::create2DDecomposition(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()))
+ {
+ const basegfx::B2DHomMatrix aTransform(basegfx::tools::createRotateAroundPoint(
+ getObjectRange().getMinX(), getObjectRange().getMinY(), getRotation()));
+
+ 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::create2DDecomposition(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::create2DDecomposition(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
new file mode 100644
index 000000000000..ecf1cf5866e5
--- /dev/null
+++ b/svx/source/sdr/overlay/overlaytriangle.cxx
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/overlay/overlaytriangle.hxx>
+#include <tools/poly.hxx>
+#include <vcl/salbtype.hxx>
+#include <vcl/outdev.hxx>
+#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>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace overlay
+ {
+ drawinglayer::primitive2d::Primitive2DSequence OverlayTriangle::createOverlayObjectPrimitive2DSequence()
+ {
+ basegfx::B2DPolygon aPolygon;
+
+ aPolygon.append(getBasePosition());
+ aPolygon.append(getSecondPosition());
+ aPolygon.append(getThirdPosition());
+ aPolygon.setClosed(true);
+
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
+ basegfx::B2DPolyPolygon(aPolygon),
+ getBaseColor().getBColor()));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
+ }
+
+ OverlayTriangle::OverlayTriangle(
+ const basegfx::B2DPoint& rBasePos,
+ const basegfx::B2DPoint& rSecondPos,
+ const basegfx::B2DPoint& rThirdPos,
+ Color aTriangleColor)
+ : OverlayObjectWithBasePosition(rBasePos, aTriangleColor),
+ maSecondPosition(rSecondPos),
+ maThirdPosition(rThirdPos)
+ {
+ }
+
+ OverlayTriangle::~OverlayTriangle()
+ {
+ }
+
+ void OverlayTriangle::setSecondPosition(const basegfx::B2DPoint& rNew)
+ {
+ if(rNew != maSecondPosition)
+ {
+ // remember new value
+ maSecondPosition = rNew;
+
+ // register change (after change)
+ objectChange();
+ }
+ }
+
+ void OverlayTriangle::setThirdPosition(const basegfx::B2DPoint& rNew)
+ {
+ if(rNew != maThirdPosition)
+ {
+ // remember new value
+ maThirdPosition = rNew;
+
+ // register change (after change)
+ objectChange();
+ }
+ }
+ } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/primitive2d/primitivefactory2d.cxx b/svx/source/sdr/primitive2d/primitivefactory2d.cxx
new file mode 100644
index 000000000000..d148f76576aa
--- /dev/null
+++ b/svx/source/sdr/primitive2d/primitivefactory2d.cxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svx.hxx"
+#include <svx/sdr/primitive2d/primitiveFactory2d.hxx>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/unoapi.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+// UNO API helper methods
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ uno::Reference< uno::XInterface > SAL_CALL XPrimitiveFactory2DProvider_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory >& /*rSMgr*/) throw( uno::Exception )
+ {
+ return *(new PrimitiveFactory2D());
+ }
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// UNO API helper methods
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ PrimitiveFactory2D::PrimitiveFactory2D()
+ : PrimitiveFactory2DImplBase(m_aMutex)
+ {
+ }
+
+ Primitive2DSequence SAL_CALL PrimitiveFactory2D::createPrimitivesFromXShape(
+ const uno::Reference< drawing::XShape >& xShape,
+ const uno::Sequence< beans::PropertyValue >& /*aParms*/ ) throw (uno::RuntimeException)
+ {
+ Primitive2DSequence aRetval;
+
+ if(xShape.is())
+ {
+ SdrObject* pSource = GetSdrObjectFromXShape(xShape);
+
+ if(pSource)
+ {
+ const sdr::contact::ViewContact& rSource(pSource->GetViewContact());
+ aRetval = rSource.getViewIndependentPrimitive2DSequence();
+ }
+ }
+
+ return aRetval;
+ }
+
+ Primitive2DSequence SAL_CALL PrimitiveFactory2D::createPrimitivesFromXDrawPage(
+ const uno::Reference< drawing::XDrawPage >& xDrawPage,
+ const uno::Sequence< beans::PropertyValue >& /*aParms*/ ) throw (uno::RuntimeException)
+ {
+ Primitive2DSequence aRetval;
+
+ if(xDrawPage.is())
+ {
+ SdrPage* pSource = GetSdrPageFromXDrawPage(xDrawPage);
+
+ if(pSource)
+ {
+ const sdr::contact::ViewContact& rSource(pSource->GetViewContact());
+
+ aRetval = rSource.getViewIndependentPrimitive2DSequence();
+ }
+ }
+
+ return aRetval;
+ }
+
+ rtl::OUString PrimitiveFactory2D::getImplementationName_Static()
+ {
+ static rtl::OUString aRetval(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.graphic.PrimitiveFactory2D"));
+ return aRetval;
+ }
+
+ uno::Sequence< rtl::OUString > PrimitiveFactory2D::getSupportedServiceNames_Static()
+ {
+ static uno::Sequence< rtl::OUString > aSeq;
+ osl::Mutex aMutex;
+ osl::MutexGuard aGuard( aMutex );
+
+ if(!aSeq.getLength())
+ {
+ aSeq.realloc(1L);
+ aSeq.getArray()[0L] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.graphic.PrimitiveFactory2D"));
+ }
+
+ return aSeq;
+ }
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
new file mode 100644
index 000000000000..8b86f9dec9ce
--- /dev/null
+++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
@@ -0,0 +1,1028 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svx.hxx"
+#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <svl/itemset.hxx>
+#include <svx/xdef.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xlntrit.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svx/xlinjoit.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xlnstwit.hxx>
+#include <svx/xlnedwit.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/xlnstcit.hxx>
+#include <svx/xlnedit.hxx>
+#include <svx/xlnedcit.hxx>
+#include <svx/xdash.hxx>
+#include <svx/xlndsit.hxx>
+#include <svx/xfltrit.hxx>
+#include <svx/xflftrit.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xgrscit.hxx>
+#include <svx/xflhtit.hxx>
+#include <svx/xflbckit.hxx>
+#include <svx/sdshitm.hxx>
+#include <svx/sdsxyitm.hxx>
+#include <svx/sdshcitm.hxx>
+#include <svx/sdshtitm.hxx>
+#include <drawinglayer/attribute/sdrfillbitmapattribute.hxx>
+#include <basegfx/polygon/b2dlinegeometry.hxx>
+#include <svx/svdotext.hxx>
+#include <drawinglayer/attribute/fillbitmapattribute.hxx>
+#include <svx/sdr/attribute/sdrtextattribute.hxx>
+#include <svx/xbtmpit.hxx>
+#include <svl/itempool.hxx>
+#include <vcl/svapp.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <svx/svx3ditems.hxx>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <drawinglayer/attribute/sdrallattribute3d.hxx>
+#include <svx/rectenum.hxx>
+#include <svx/sdtfchim.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/svdmodel.hxx>
+#include <editeng/editstat.hxx>
+#include <drawinglayer/attribute/fillhatchattribute.hxx>
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
+#include <svx/sdr/attribute/sdrshadowtextattribute.hxx>
+#include <svx/sdr/attribute/sdrlineshadowtextattribute.hxx>
+#include <svx/sdr/attribute/sdrformtextattribute.hxx>
+#include <svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx>
+#include <drawinglayer/attribute/sdrsceneattribute3d.hxx>
+#include <drawinglayer/attribute/sdrlightingattribute3d.hxx>
+#include <drawinglayer/attribute/sdrlightattribute3d.hxx>
+#include <svx/sdr/attribute/sdrfilltextattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace
+ {
+ attribute::GradientStyle XGradientStyleToGradientStyle(XGradientStyle eStyle)
+ {
+ switch(eStyle)
+ {
+ case XGRAD_LINEAR :
+ {
+ return attribute::GRADIENTSTYLE_LINEAR;
+ }
+ case XGRAD_AXIAL :
+ {
+ return attribute::GRADIENTSTYLE_AXIAL;
+ }
+ case XGRAD_RADIAL :
+ {
+ return attribute::GRADIENTSTYLE_RADIAL;
+ }
+ case XGRAD_ELLIPTICAL :
+ {
+ return attribute::GRADIENTSTYLE_ELLIPTICAL;
+ }
+ case XGRAD_SQUARE :
+ {
+ return attribute::GRADIENTSTYLE_SQUARE;
+ }
+ default :
+ {
+ return attribute::GRADIENTSTYLE_RECT; // XGRAD_RECT
+ }
+ }
+ }
+
+ attribute::HatchStyle XHatchStyleToHatchStyle(XHatchStyle eStyle)
+ {
+ switch(eStyle)
+ {
+ case XHATCH_SINGLE :
+ {
+ return attribute::HATCHSTYLE_SINGLE;
+ }
+ case XHATCH_DOUBLE :
+ {
+ return attribute::HATCHSTYLE_DOUBLE;
+ }
+ default :
+ {
+ return attribute::HATCHSTYLE_TRIPLE; // XHATCH_TRIPLE
+ }
+ }
+ }
+
+ basegfx::B2DLineJoin XLineJointtoB2DLineJoin(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
+ }
+ }
+ }
+
+ basegfx::B2DVector RectPointToB2DVector(RECT_POINT eRectPoint)
+ {
+ basegfx::B2DVector aRetval(0.0, 0.0);
+
+ // position changes X
+ switch(eRectPoint)
+ {
+ case RP_LT: case RP_LM: case RP_LB:
+ {
+ aRetval.setX(-1.0);
+ break;
+ }
+
+ case RP_RT: case RP_RM: case RP_RB:
+ {
+ aRetval.setX(1.0);
+ break;
+ }
+
+ default :
+ {
+ break;
+ }
+ }
+
+ // position changes Y
+ switch(eRectPoint)
+ {
+ case RP_LT: case RP_MT: case RP_RT:
+ {
+ aRetval.setY(-1.0);
+ break;
+ }
+
+ case RP_LB: case RP_MB: case RP_RB:
+ {
+ aRetval.setY(1.0);
+ break;
+ }
+
+ default :
+ {
+ break;
+ }
+ }
+
+ return aRetval;
+ }
+ } // end of anonymous namespace
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ attribute::SdrLineAttribute createNewSdrLineAttribute(const SfxItemSet& rSet)
+ {
+ const XLineStyle eStyle(((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue());
+
+ if(XLINE_NONE != eStyle)
+ {
+ sal_uInt16 nTransparence(((const XLineTransparenceItem&)(rSet.Get(XATTR_LINETRANSPARENCE))).GetValue());
+
+ if(nTransparence > 100)
+ {
+ nTransparence = 100;
+ }
+
+ if(100 != nTransparence)
+ {
+ const sal_uInt32 nWidth(((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue());
+ const Color aColor(((const XLineColorItem&)(rSet.Get(XATTR_LINECOLOR))).GetColorValue());
+ const XLineJoint eJoint(((const XLineJointItem&)(rSet.Get(XATTR_LINEJOINT))).GetValue());
+ ::std::vector< double > aDotDashArray;
+ double fFullDotDashLen(0.0);
+
+ if(XLINE_DASH == eStyle)
+ {
+ const XDash& rDash = ((const XLineDashItem&)(rSet.Get(XATTR_LINEDASH))).GetDashValue();
+
+ if(rDash.GetDots() || rDash.GetDashes())
+ {
+ fFullDotDashLen = rDash.CreateDotDashArray(aDotDashArray, (double)nWidth);
+ }
+ }
+
+ return attribute::SdrLineAttribute(
+ XLineJointtoB2DLineJoin(eJoint),
+ (double)nWidth,
+ (double)nTransparence * 0.01,
+ aColor.getBColor(),
+ aDotDashArray,
+ fFullDotDashLen);
+ }
+ }
+
+ return attribute::SdrLineAttribute();
+ }
+
+ attribute::SdrLineStartEndAttribute createNewSdrLineStartEndAttribute(
+ const SfxItemSet& rSet,
+ double fWidth)
+ {
+ const sal_Int32 nTempStartWidth(((const XLineStartWidthItem&)(rSet.Get(XATTR_LINESTARTWIDTH))).GetValue());
+ const sal_Int32 nTempEndWidth(((const XLineEndWidthItem&)(rSet.Get(XATTR_LINEENDWIDTH))).GetValue());
+ basegfx::B2DPolyPolygon aStartPolyPolygon;
+ basegfx::B2DPolyPolygon aEndPolyPolygon;
+ double fStartWidth(0.0);
+ double fEndWidth(0.0);
+ bool bStartActive(false);
+ bool bEndActive(false);
+ bool bStartCentered(true);
+ bool bEndCentered(true);
+
+ if(nTempStartWidth)
+ {
+ if(nTempStartWidth < 0L)
+ {
+ fStartWidth = ((double)(-nTempStartWidth) * fWidth) * 0.01;
+ }
+ else
+ {
+ fStartWidth = (double)nTempStartWidth;
+ }
+
+ if(0.0 != fStartWidth)
+ {
+ aStartPolyPolygon = basegfx::B2DPolyPolygon(((const XLineStartItem&)(rSet.Get(XATTR_LINESTART))).GetLineStartValue());
+
+ if(aStartPolyPolygon.count() && aStartPolyPolygon.getB2DPolygon(0L).count())
+ {
+ bStartActive = true;
+ bStartCentered = ((const XLineStartCenterItem&)(rSet.Get(XATTR_LINESTARTCENTER))).GetValue();
+ }
+ }
+ }
+
+ if(nTempEndWidth)
+ {
+ if(nTempEndWidth < 0L)
+ {
+ fEndWidth = ((double)(-nTempEndWidth) * fWidth) * 0.01;
+ }
+ else
+ {
+ fEndWidth = (double)nTempEndWidth;
+ }
+
+ if(0.0 != fEndWidth)
+ {
+ aEndPolyPolygon = basegfx::B2DPolyPolygon(((const XLineEndItem&)(rSet.Get(XATTR_LINEEND))).GetLineEndValue());
+
+ if(aEndPolyPolygon.count() && aEndPolyPolygon.getB2DPolygon(0L).count())
+ {
+ bEndActive = true;
+ bEndCentered = ((const XLineEndCenterItem&)(rSet.Get(XATTR_LINEENDCENTER))).GetValue();
+ }
+ }
+ }
+
+ if(bStartActive || bEndActive)
+ {
+ return attribute::SdrLineStartEndAttribute(
+ aStartPolyPolygon, aEndPolyPolygon, fStartWidth, fEndWidth,
+ bStartActive, bEndActive, bStartCentered, bEndCentered);
+ }
+
+ return attribute::SdrLineStartEndAttribute();
+ }
+
+ attribute::SdrShadowAttribute createNewSdrShadowAttribute(const SfxItemSet& rSet)
+ {
+ const bool bShadow(((SdrShadowItem&)rSet.Get(SDRATTR_SHADOW)).GetValue());
+
+ if(bShadow)
+ {
+ sal_uInt16 nTransparence(((SdrShadowTransparenceItem&)(rSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue());
+
+ if(nTransparence > 100)
+ {
+ nTransparence = 100;
+ }
+
+ if(nTransparence)
+ {
+ sal_uInt16 nFillTransparence(((const XFillTransparenceItem&)(rSet.Get(XATTR_FILLTRANSPARENCE))).GetValue());
+
+ if(nFillTransparence > 100)
+ {
+ nFillTransparence = 100;
+ }
+
+ if(nTransparence == nFillTransparence)
+ {
+ // shadow does not really have an own transparence, but the application
+ // sets the shadow transparence equal to the object transparence for
+ // convenience. This is not useful for primitive creation, so take
+ // this as no shadow transparence
+ nTransparence = 0;
+ }
+ }
+
+ if(100 != nTransparence)
+ {
+ const basegfx::B2DVector aOffset(
+ (double)((SdrShadowXDistItem&)(rSet.Get(SDRATTR_SHADOWXDIST))).GetValue(),
+ (double)((SdrShadowYDistItem&)(rSet.Get(SDRATTR_SHADOWYDIST))).GetValue());
+ const Color aColor(((SdrShadowColorItem&)(rSet.Get(SDRATTR_SHADOWCOLOR))).GetColorValue());
+
+ return attribute::SdrShadowAttribute(aOffset, (double)nTransparence * 0.01, aColor.getBColor());
+ }
+ }
+
+ return attribute::SdrShadowAttribute();
+ }
+
+ attribute::SdrFillAttribute createNewSdrFillAttribute(const SfxItemSet& rSet)
+ {
+ const XFillStyle eStyle(((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue());
+
+ if(XFILL_NONE != eStyle)
+ {
+ sal_uInt16 nTransparence(((const XFillTransparenceItem&)(rSet.Get(XATTR_FILLTRANSPARENCE))).GetValue());
+
+ if(nTransparence > 100)
+ {
+ nTransparence = 100;
+ }
+
+ if(100 != nTransparence)
+ {
+ const Color aColor(((const XFillColorItem&)(rSet.Get(XATTR_FILLCOLOR))).GetColorValue());
+ attribute::FillGradientAttribute aGradient;
+ attribute::FillHatchAttribute aHatch;
+ attribute::SdrFillBitmapAttribute aBitmap;
+
+ switch(eStyle)
+ {
+ case XFILL_NONE : // for warnings
+ case XFILL_SOLID :
+ {
+ // nothing to do, color is defined
+ break;
+ }
+ case XFILL_GRADIENT :
+ {
+ XGradient aXGradient(((XFillGradientItem&)(rSet.Get(XATTR_FILLGRADIENT))).GetGradientValue());
+
+ const Color aStartColor(aXGradient.GetStartColor());
+ const sal_uInt16 nStartIntens(aXGradient.GetStartIntens());
+ basegfx::BColor aStart(aStartColor.getBColor());
+
+ if(nStartIntens != 100)
+ {
+ const basegfx::BColor aBlack;
+ aStart = interpolate(aBlack, aStart, (double)nStartIntens * 0.01);
+ }
+
+ const Color aEndColor(aXGradient.GetEndColor());
+ const sal_uInt16 nEndIntens(aXGradient.GetEndIntens());
+ basegfx::BColor aEnd(aEndColor.getBColor());
+
+ if(nEndIntens != 100)
+ {
+ const basegfx::BColor aBlack;
+ aEnd = interpolate(aBlack, aEnd, (double)nEndIntens * 0.01);
+ }
+
+ aGradient = attribute::FillGradientAttribute(
+ XGradientStyleToGradientStyle(aXGradient.GetGradientStyle()),
+ (double)aXGradient.GetBorder() * 0.01,
+ (double)aXGradient.GetXOffset() * 0.01,
+ (double)aXGradient.GetYOffset() * 0.01,
+ (double)aXGradient.GetAngle() * F_PI1800,
+ aStart,
+ aEnd,
+ ((const XGradientStepCountItem&)rSet.Get(XATTR_GRADIENTSTEPCOUNT)).GetValue());
+
+ break;
+ }
+ case XFILL_HATCH :
+ {
+ const XHatch& rHatch(((XFillHatchItem&)(rSet.Get(XATTR_FILLHATCH))).GetHatchValue());
+ const Color aColorB(rHatch.GetColor());
+
+ aHatch = attribute::FillHatchAttribute(
+ XHatchStyleToHatchStyle(rHatch.GetHatchStyle()),
+ (double)rHatch.GetDistance(),
+ (double)rHatch.GetAngle() * F_PI1800,
+ aColorB.getBColor(),
+ ((const XFillBackgroundItem&)(rSet.Get(XATTR_FILLBACKGROUND))).GetValue());
+
+ break;
+ }
+ case XFILL_BITMAP :
+ {
+ aBitmap = createNewSdrFillBitmapAttribute(rSet);
+ break;
+ }
+ }
+
+ return attribute::SdrFillAttribute(
+ (double)nTransparence * 0.01,
+ aColor.getBColor(),
+ aGradient,
+ aHatch,
+ aBitmap);
+ }
+ }
+
+ return attribute::SdrFillAttribute();
+ }
+
+ // #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)
+ {
+ const SdrTextObj& rTextObj = rText.GetObject();
+
+ if(rText.GetOutlinerParaObject() && rText.GetModel())
+ {
+ // added TextEdit text suppression
+ bool bInEditMode(false);
+
+ if(rText.GetObject().getTextCount() > 1)
+ {
+ bInEditMode = rTextObj.IsInEditMode() && rText.GetObject().getActiveText() == &rText;
+ }
+ else
+ {
+ bInEditMode = rTextObj.IsInEditMode();
+ }
+
+ OutlinerParaObject aOutlinerParaObject(*rText.GetOutlinerParaObject());
+
+ if(bInEditMode)
+ {
+ OutlinerParaObject* pTempObj = rTextObj.GetEditOutlinerParaObject();
+
+ if(pTempObj)
+ {
+ aOutlinerParaObject = *pTempObj;
+ delete pTempObj;
+ }
+ else
+ {
+ // #i100537#
+ // GetEditOutlinerParaObject() returning no object does not mean that
+ // text edit mode is not active. Do not reset the flag here
+ // bInEditMode = false;
+ }
+ }
+
+ const SdrFitToSizeType eFit(rTextObj.GetFitToSize());
+ const SdrTextAniKind eAniKind(rTextObj.GetTextAniKind());
+
+ // #i107346#
+ const SdrOutliner& rDrawTextOutliner = rText.GetModel()->GetDrawOutliner(&rTextObj);
+ const bool bWrongSpell(rDrawTextOutliner.GetControlWord() & EE_CNTRL_ONLINESPELLING);
+
+ return attribute::SdrTextAttribute(
+ rText,
+ aOutlinerParaObject,
+ ((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue(),
+ pLeft ? *pLeft : rTextObj.GetTextLeftDistance(),
+ pUpper ? *pUpper : rTextObj.GetTextUpperDistance(),
+ pRight ? *pRight : rTextObj.GetTextRightDistance(),
+ pLower ? *pLower : rTextObj.GetTextLowerDistance(),
+ rTextObj.GetTextHorizontalAdjust(rSet),
+ rTextObj.GetTextVerticalAdjust(rSet),
+ ((const SdrTextContourFrameItem&)rSet.Get(SDRATTR_TEXT_CONTOURFRAME)).GetValue(),
+ (SDRTEXTFIT_PROPORTIONAL == eFit || SDRTEXTFIT_ALLLINES == eFit),
+ ((const XFormTextHideFormItem&)rSet.Get(XATTR_FORMTXTHIDEFORM)).GetValue(),
+ SDRTEXTANI_BLINK == eAniKind,
+ SDRTEXTANI_SCROLL == eAniKind || SDRTEXTANI_ALTERNATE == eAniKind || SDRTEXTANI_SLIDE == eAniKind,
+ bInEditMode,
+ ((const SdrTextFixedCellHeightItem&)rSet.Get(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue(),
+ bWrongSpell);
+ }
+
+ return attribute::SdrTextAttribute();
+ }
+
+ attribute::FillGradientAttribute createNewTransparenceGradientAttribute(const SfxItemSet& rSet)
+ {
+ const SfxPoolItem* pGradientItem;
+
+ if(SFX_ITEM_SET == rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, sal_True, &pGradientItem)
+ && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled())
+ {
+ // test if float transparence is completely transparent
+ const XGradient& rGradient = ((XFillFloatTransparenceItem*)pGradientItem)->GetGradientValue();
+ const sal_uInt8 nStartLuminance(rGradient.GetStartColor().GetLuminance());
+ const sal_uInt8 nEndLuminance(rGradient.GetEndColor().GetLuminance());
+ const bool bCompletelyTransparent(0xff == nStartLuminance && 0xff == nEndLuminance);
+
+ if(!bCompletelyTransparent)
+ {
+ const double fStartLum(nStartLuminance / 255.0);
+ const double fEndLum(nEndLuminance / 255.0);
+
+ return attribute::FillGradientAttribute(
+ XGradientStyleToGradientStyle(rGradient.GetGradientStyle()),
+ (double)rGradient.GetBorder() * 0.01,
+ (double)rGradient.GetXOffset() * 0.01,
+ (double)rGradient.GetYOffset() * 0.01,
+ (double)rGradient.GetAngle() * F_PI1800,
+ basegfx::BColor(fStartLum, fStartLum, fStartLum),
+ basegfx::BColor(fEndLum, fEndLum, fEndLum),
+ 0);
+ }
+ }
+
+ return attribute::FillGradientAttribute();
+ }
+
+ attribute::SdrFillBitmapAttribute createNewSdrFillBitmapAttribute(const SfxItemSet& rSet)
+ {
+ Bitmap aBitmap((((const XFillBitmapItem&)(rSet.Get(XATTR_FILLBITMAP))).GetBitmapValue()).GetBitmap());
+
+ // make sure it's not empty, use default instead
+ if(aBitmap.IsEmpty())
+ {
+ aBitmap = Bitmap(Size(4,4), 8);
+ }
+
+ // if there is no logical size, create a size from pixel size and set MapMode accordingly
+ if(0L == aBitmap.GetPrefSize().Width() || 0L == aBitmap.GetPrefSize().Height())
+ {
+ aBitmap.SetPrefSize(aBitmap.GetSizePixel());
+ aBitmap.SetPrefMapMode(MAP_PIXEL);
+ }
+
+ // convert size and MapMode to destination logical size and MapMode. The created
+ // bitmap must have a valid logical size (PrefSize)
+ const MapUnit aDestinationMapUnit((MapUnit)rSet.GetPool()->GetMetric(0));
+
+ if(aBitmap.GetPrefMapMode() != 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
+ const basegfx::B2DVector aSize(
+ (double)((const SfxMetricItem&)(rSet.Get(XATTR_FILLBMP_SIZEX))).GetValue(),
+ (double)((const SfxMetricItem&)(rSet.Get(XATTR_FILLBMP_SIZEY))).GetValue());
+ const basegfx::B2DVector aOffset(
+ (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_TILEOFFSETX))).GetValue(),
+ (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_TILEOFFSETY))).GetValue());
+ const basegfx::B2DVector aOffsetPosition(
+ (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_POSOFFSETX))).GetValue(),
+ (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_POSOFFSETY))).GetValue());
+
+ return attribute::SdrFillBitmapAttribute(
+ aBitmap,
+ aSize,
+ aOffset,
+ aOffsetPosition,
+ RectPointToB2DVector((RECT_POINT)((const SfxEnumItem&)(rSet.Get(XATTR_FILLBMP_POS))).GetValue()),
+ ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_TILE))).GetValue(),
+ ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_STRETCH))).GetValue(),
+ ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_SIZELOG))).GetValue());
+ }
+
+ attribute::SdrShadowTextAttribute createNewSdrShadowTextAttribute(
+ const SfxItemSet& rSet,
+ const SdrText* pText,
+ bool bSuppressText)
+ {
+ attribute::SdrTextAttribute aText;
+
+ // #i98072# added option to suppress text
+ // look for text first
+ if(!bSuppressText && pText)
+ {
+ aText = createNewSdrTextAttribute(rSet, *pText);
+ }
+
+ // try shadow
+ const attribute::SdrShadowAttribute aShadow(createNewSdrShadowAttribute(rSet));
+
+ return attribute::SdrShadowTextAttribute(aShadow, aText);
+ }
+
+ attribute::SdrLineShadowTextAttribute createNewSdrLineShadowTextAttribute(
+ const SfxItemSet& rSet,
+ const SdrText* pText)
+ {
+ attribute::SdrLineAttribute aLine;
+ attribute::SdrLineStartEndAttribute aLineStartEnd;
+ attribute::SdrTextAttribute aText;
+ bool bFontworkHideContour(false);
+
+ // look for text first
+ if(pText)
+ {
+ aText = createNewSdrTextAttribute(rSet, *pText);
+
+ // when object has text and text is fontwork and hide contour is set for fontwork, force
+ // line and fill style to empty
+ if(!aText.isDefault()
+ && !aText.getSdrFormTextAttribute().isDefault()
+ && aText.isHideContour())
+ {
+ bFontworkHideContour = true;
+ }
+ }
+
+ // try line style
+ if(!bFontworkHideContour)
+ {
+ aLine = createNewSdrLineAttribute(rSet);
+
+ if(!aLine.isDefault())
+ {
+ // try LineStartEnd
+ aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth());
+ }
+ }
+
+ if(!aLine.isDefault() || !aText.isDefault())
+ {
+ // try shadow
+ const attribute::SdrShadowAttribute aShadow(createNewSdrShadowAttribute(rSet));
+
+ return attribute::SdrLineShadowTextAttribute(aLine, aLineStartEnd, aShadow, aText);
+ }
+
+ return attribute::SdrLineShadowTextAttribute();
+ }
+
+ attribute::SdrLineFillShadowTextAttribute createNewSdrLineFillShadowTextAttribute(
+ const SfxItemSet& rSet,
+ const SdrText* pText)
+ {
+ attribute::SdrLineAttribute aLine;
+ attribute::SdrFillAttribute aFill;
+ attribute::SdrLineStartEndAttribute aLineStartEnd;
+ attribute::SdrShadowAttribute aShadow;
+ attribute::FillGradientAttribute aFillFloatTransGradient;
+ attribute::SdrTextAttribute aText;
+ bool bFontworkHideContour(false);
+
+ // look for text first
+ if(pText)
+ {
+ aText = createNewSdrTextAttribute(rSet, *pText);
+
+ // when object has text and text is fontwork and hide contour is set for fontwork, force
+ // line and fill style to empty
+ if(!aText.getSdrFormTextAttribute().isDefault() && aText.isHideContour())
+ {
+ bFontworkHideContour = true;
+ }
+ }
+
+ if(!bFontworkHideContour)
+ {
+ // try line style
+ aLine = createNewSdrLineAttribute(rSet);
+
+ if(!aLine.isDefault())
+ {
+ // try LineStartEnd
+ aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth());
+ }
+
+ // try fill style
+ aFill = createNewSdrFillAttribute(rSet);
+
+ if(!aFill.isDefault())
+ {
+ // try fillfloattransparence
+ aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet);
+ }
+ }
+
+ if(!aLine.isDefault() || !aFill.isDefault() || !aText.isDefault())
+ {
+ // try shadow
+ aShadow = createNewSdrShadowAttribute(rSet);
+
+ return attribute::SdrLineFillShadowTextAttribute(
+ aLine, aFill, aLineStartEnd, aShadow, aFillFloatTransGradient, aText);
+ }
+
+ return attribute::SdrLineFillShadowTextAttribute();
+ }
+
+ attribute::SdrLineFillShadowAttribute3D createNewSdrLineFillShadowAttribute(const SfxItemSet& rSet, bool bSuppressFill)
+ {
+ attribute::SdrFillAttribute aFill;
+ attribute::SdrLineStartEndAttribute aLineStartEnd;
+ attribute::SdrShadowAttribute aShadow;
+ attribute::FillGradientAttribute aFillFloatTransGradient;
+
+ // try line style
+ const attribute::SdrLineAttribute aLine(createNewSdrLineAttribute(rSet));
+
+ if(!aLine.isDefault())
+ {
+ // try LineStartEnd
+ aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth());
+ }
+
+ // try fill style
+ if(!bSuppressFill)
+ {
+ aFill = createNewSdrFillAttribute(rSet);
+
+ if(!aFill.isDefault())
+ {
+ // try fillfloattransparence
+ aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet);
+ }
+ }
+
+ if(!aLine.isDefault() || !aFill.isDefault())
+ {
+ // try shadow
+ aShadow = createNewSdrShadowAttribute(rSet);
+
+ return attribute::SdrLineFillShadowAttribute3D(
+ aLine, aFill, aLineStartEnd, aShadow, aFillFloatTransGradient);
+ }
+
+ return attribute::SdrLineFillShadowAttribute3D();
+ }
+
+ attribute::SdrSceneAttribute createNewSdrSceneAttribute(const SfxItemSet& rSet)
+ {
+ // get perspective
+ ::com::sun::star::drawing::ProjectionMode aProjectionMode(::com::sun::star::drawing::ProjectionMode_PARALLEL);
+ const sal_uInt16 nProjectionValue(((const Svx3DPerspectiveItem&)rSet.Get(SDRATTR_3DSCENE_PERSPECTIVE)).GetValue());
+
+ if(1L == nProjectionValue)
+ {
+ aProjectionMode = ::com::sun::star::drawing::ProjectionMode_PERSPECTIVE;
+ }
+
+ // get distance
+ const double fDistance(((const Svx3DDistanceItem&)rSet.Get(SDRATTR_3DSCENE_DISTANCE)).GetValue());
+
+ // get shadow slant
+ const double fShadowSlant(F_PI180 * ((const Svx3DShadowSlantItem&)rSet.Get(SDRATTR_3DSCENE_SHADOW_SLANT)).GetValue());
+
+ // get shade mode
+ ::com::sun::star::drawing::ShadeMode aShadeMode(::com::sun::star::drawing::ShadeMode_FLAT);
+ const sal_uInt16 nShadeValue(((const Svx3DShadeModeItem&)rSet.Get(SDRATTR_3DSCENE_SHADE_MODE)).GetValue());
+
+ if(1L == nShadeValue)
+ {
+ aShadeMode = ::com::sun::star::drawing::ShadeMode_PHONG;
+ }
+ else if(2L == nShadeValue)
+ {
+ aShadeMode = ::com::sun::star::drawing::ShadeMode_SMOOTH;
+ }
+ else if(3L == nShadeValue)
+ {
+ aShadeMode = ::com::sun::star::drawing::ShadeMode_DRAFT;
+ }
+
+ // get two sided lighting
+ const bool bTwoSidedLighting(((const Svx3DTwoSidedLightingItem&)rSet.Get(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING)).GetValue());
+
+ return attribute::SdrSceneAttribute(fDistance, fShadowSlant, aProjectionMode, aShadeMode, bTwoSidedLighting);
+ }
+
+ attribute::SdrLightingAttribute createNewSdrLightingAttribute(const SfxItemSet& rSet)
+ {
+ // extract lights from given SfxItemSet (from scene)
+ ::std::vector< attribute::Sdr3DLightAttribute > aLightVector;
+
+ if(((const Svx3DLightOnOff1Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_1)).GetValue())
+ {
+ const basegfx::BColor aColor(((const Svx3DLightcolor1Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1)).GetValue().getBColor());
+ const basegfx::B3DVector aDirection(((const Svx3DLightDirection1Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1)).GetValue());
+ aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, true));
+ }
+
+ if(((const Svx3DLightOnOff2Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_2)).GetValue())
+ {
+ const basegfx::BColor aColor(((const Svx3DLightcolor2Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_2)).GetValue().getBColor());
+ const basegfx::B3DVector aDirection(((const Svx3DLightDirection2Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2)).GetValue());
+ aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
+ }
+
+ if(((const Svx3DLightOnOff3Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_3)).GetValue())
+ {
+ const basegfx::BColor aColor(((const Svx3DLightcolor3Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_3)).GetValue().getBColor());
+ const basegfx::B3DVector aDirection(((const Svx3DLightDirection3Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3)).GetValue());
+ aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
+ }
+
+ if(((const Svx3DLightOnOff4Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_4)).GetValue())
+ {
+ const basegfx::BColor aColor(((const Svx3DLightcolor4Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_4)).GetValue().getBColor());
+ const basegfx::B3DVector aDirection(((const Svx3DLightDirection4Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4)).GetValue());
+ aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
+ }
+
+ if(((const Svx3DLightOnOff5Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_5)).GetValue())
+ {
+ const basegfx::BColor aColor(((const Svx3DLightcolor5Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_5)).GetValue().getBColor());
+ const basegfx::B3DVector aDirection(((const Svx3DLightDirection5Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5)).GetValue());
+ aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
+ }
+
+ if(((const Svx3DLightOnOff6Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_6)).GetValue())
+ {
+ const basegfx::BColor aColor(((const Svx3DLightcolor6Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_6)).GetValue().getBColor());
+ const basegfx::B3DVector aDirection(((const Svx3DLightDirection6Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6)).GetValue());
+ aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
+ }
+
+ if(((const Svx3DLightOnOff7Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_7)).GetValue())
+ {
+ const basegfx::BColor aColor(((const Svx3DLightcolor7Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_7)).GetValue().getBColor());
+ const basegfx::B3DVector aDirection(((const Svx3DLightDirection7Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7)).GetValue());
+ aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
+ }
+
+ if(((const Svx3DLightOnOff8Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_8)).GetValue())
+ {
+ const basegfx::BColor aColor(((const Svx3DLightcolor8Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_8)).GetValue().getBColor());
+ const basegfx::B3DVector aDirection(((const Svx3DLightDirection8Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8)).GetValue());
+ aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
+ }
+
+ // get ambient color
+ const Color aAmbientValue(((const Svx3DAmbientcolorItem&)rSet.Get(SDRATTR_3DSCENE_AMBIENTCOLOR)).GetValue());
+ const basegfx::BColor aAmbientLight(aAmbientValue.getBColor());
+
+ return attribute::SdrLightingAttribute(aAmbientLight, aLightVector);
+ }
+
+ void calculateRelativeCornerRadius(sal_Int32 nRadius, const basegfx::B2DRange& rObjectRange, double& rfCornerRadiusX, double& rfCornerRadiusY)
+ {
+ rfCornerRadiusX = rfCornerRadiusY = (double)nRadius;
+
+ if(0.0 != rfCornerRadiusX)
+ {
+ const double fHalfObjectWidth(rObjectRange.getWidth() * 0.5);
+
+ if(0.0 != fHalfObjectWidth)
+ {
+ if(rfCornerRadiusX < 0.0)
+ {
+ rfCornerRadiusX = 0.0;
+ }
+
+ if(rfCornerRadiusX > fHalfObjectWidth)
+ {
+ rfCornerRadiusX = fHalfObjectWidth;
+ }
+
+ rfCornerRadiusX /= fHalfObjectWidth;
+ }
+ else
+ {
+ rfCornerRadiusX = 0.0;
+ }
+ }
+
+ if(0.0 != rfCornerRadiusY)
+ {
+ const double fHalfObjectHeight(rObjectRange.getHeight() * 0.5);
+
+ if(0.0 != fHalfObjectHeight)
+ {
+ if(rfCornerRadiusY < 0.0)
+ {
+ rfCornerRadiusY = 0.0;
+ }
+
+ if(rfCornerRadiusY > fHalfObjectHeight)
+ {
+ rfCornerRadiusY = fHalfObjectHeight;
+ }
+
+ rfCornerRadiusY /= fHalfObjectHeight;
+ }
+ else
+ {
+ rfCornerRadiusY = 0.0;
+ }
+ }
+ }
+
+ // #i101508# Support handing over given text-to-border distances
+ attribute::SdrFillTextAttribute createNewSdrFillTextAttribute(
+ const SfxItemSet& rSet,
+ const SdrText* pText,
+ const sal_Int32* pLeft,
+ const sal_Int32* pUpper,
+ const sal_Int32* pRight,
+ const sal_Int32* pLower)
+ {
+ attribute::SdrFillAttribute aFill;
+ attribute::FillGradientAttribute aFillFloatTransGradient;
+ attribute::SdrTextAttribute aText;
+ bool bFontworkHideContour(false);
+
+ // look for text first
+ if(pText)
+ {
+ aText = createNewSdrTextAttribute(rSet, *pText, 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(!aText.getSdrFormTextAttribute().isDefault() && aText.isHideContour())
+ {
+ bFontworkHideContour = true;
+ }
+ }
+
+ if(!bFontworkHideContour)
+ {
+ // try fill style
+ aFill = createNewSdrFillAttribute(rSet);
+
+ if(!aFill.isDefault())
+ {
+ // try fillfloattransparence
+ aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet);
+ }
+ }
+
+ if(!aFill.isDefault() || !aText.isDefault())
+ {
+ return attribute::SdrFillTextAttribute(aFill, aFillFloatTransGradient, aText);
+ }
+
+ return attribute::SdrFillTextAttribute();
+ }
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx
new file mode 100644
index 000000000000..3757d60a3d27
--- /dev/null
+++ b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx
@@ -0,0 +1,177 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svx.hxx"
+#include <svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence SdrCaptionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const
+ {
+ Primitive2DSequence aRetval;
+
+ // create unit outline polygon
+ const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(
+ basegfx::B2DRange(0.0, 0.0, 1.0, 1.0),
+ getCornerRadiusX(),
+ getCornerRadiusY()));
+
+ // add fill
+ if(getSdrLFSTAttribute().getFill().isDefault())
+ {
+ // create invisible fill for HitTest
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createHiddenGeometryPrimitives2D(
+ true,
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform()));
+ }
+ else
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolyPolygonFillPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getFill(),
+ getSdrLFSTAttribute().getFillFloatTransGradient()));
+ }
+
+ // add line
+ if(getSdrLFSTAttribute().getLine().isDefault())
+ {
+ // create invisible line for HitTest/BoundRect
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createHiddenGeometryPrimitives2D(
+ false,
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform()));
+
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createHiddenGeometryPrimitives2D(
+ false,
+ basegfx::B2DPolyPolygon(getTail()),
+ getTransform()));
+ }
+ else
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolygonLinePrimitive(
+ aUnitOutline,
+ getTransform(),
+ getSdrLFSTAttribute().getLine(),
+ attribute::SdrLineStartEndAttribute()));
+
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolygonLinePrimitive(
+ getTail(),
+ getTransform(),
+ getSdrLFSTAttribute().getLine(),
+ getSdrLFSTAttribute().getLineStartEnd()));
+ }
+
+ // add text
+ if(!getSdrLFSTAttribute().getText().isDefault())
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createTextPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getText(),
+ getSdrLFSTAttribute().getLine(),
+ false,
+ false,
+ false));
+ }
+
+ // add shadow
+ if(!getSdrLFSTAttribute().getShadow().isDefault())
+ {
+ aRetval = createEmbeddedShadowPrimitive(aRetval, getSdrLFSTAttribute().getShadow());
+ }
+
+ return aRetval;
+ }
+
+ SdrCaptionPrimitive2D::SdrCaptionPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute,
+ const basegfx::B2DPolygon& rTail,
+ double fCornerRadiusX,
+ double fCornerRadiusY)
+ : BufferedDecompositionPrimitive2D(),
+ maTransform(rTransform),
+ maSdrLFSTAttribute(rSdrLFSTAttribute),
+ maTail(rTail),
+ mfCornerRadiusX(fCornerRadiusX),
+ mfCornerRadiusY(fCornerRadiusY)
+ {
+ // transform maTail to unit polygon
+ if(getTail().count())
+ {
+ basegfx::B2DHomMatrix aInverse(getTransform());
+ aInverse.invert();
+ maTail.transform(aInverse);
+ }
+ }
+
+ bool SdrCaptionPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+ {
+ const SdrCaptionPrimitive2D& rCompare = (SdrCaptionPrimitive2D&)rPrimitive;
+
+ return (getCornerRadiusX() == rCompare.getCornerRadiusX()
+ && getCornerRadiusY() == rCompare.getCornerRadiusY()
+ && getTail() == rCompare.getTail()
+ && getTransform() == rCompare.getTransform()
+ && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute());
+ }
+
+ return false;
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(SdrCaptionPrimitive2D, PRIMITIVE2D_ID_SDRCAPTIONPRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx
new file mode 100644
index 000000000000..6b52837c3eca
--- /dev/null
+++ b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svx.hxx"
+#include <svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx>
+#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence SdrConnectorPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const
+ {
+ Primitive2DSequence aRetval;
+
+ // add line
+ if(getSdrLSTAttribute().getLine().isDefault())
+ {
+ // create invisible line for HitTest/BoundRect
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createHiddenGeometryPrimitives2D(
+ false,
+ basegfx::B2DPolyPolygon(getUnitPolygon())));
+ }
+ else
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolygonLinePrimitive(
+ getUnitPolygon(),
+ basegfx::B2DHomMatrix(),
+ getSdrLSTAttribute().getLine(),
+ getSdrLSTAttribute().getLineStartEnd()));
+ }
+
+ // add text
+ if(!getSdrLSTAttribute().getText().isDefault())
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createTextPrimitive(
+ basegfx::B2DPolyPolygon(getUnitPolygon()),
+ basegfx::B2DHomMatrix(),
+ getSdrLSTAttribute().getText(),
+ getSdrLSTAttribute().getLine(),
+ false,
+ false,
+ false));
+ }
+
+ // add shadow
+ if(!getSdrLSTAttribute().getShadow().isDefault())
+ {
+ aRetval = createEmbeddedShadowPrimitive(
+ aRetval,
+ getSdrLSTAttribute().getShadow());
+ }
+
+ return aRetval;
+ }
+
+ SdrConnectorPrimitive2D::SdrConnectorPrimitive2D(
+ const attribute::SdrLineShadowTextAttribute& rSdrLSTAttribute,
+ const ::basegfx::B2DPolygon& rUnitPolygon)
+ : BufferedDecompositionPrimitive2D(),
+ maSdrLSTAttribute(rSdrLSTAttribute),
+ maUnitPolygon(rUnitPolygon)
+ {
+ }
+
+ bool SdrConnectorPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+ {
+ const SdrConnectorPrimitive2D& rCompare = (SdrConnectorPrimitive2D&)rPrimitive;
+
+ return (getUnitPolygon() == rCompare.getUnitPolygon()
+ && getSdrLSTAttribute() == rCompare.getSdrLSTAttribute());
+ }
+
+ return false;
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(SdrConnectorPrimitive2D, PRIMITIVE2D_ID_SDRCONNECTORPRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx
new file mode 100644
index 000000000000..710beeb444f2
--- /dev/null
+++ b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx
@@ -0,0 +1,130 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svx.hxx"
+#include <svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
+#include <drawinglayer/attribute/sdrlineattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence SdrCustomShapePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const
+ {
+ Primitive2DSequence aRetval(getSubPrimitives());
+
+ // add text
+ if(!getSdrSTAttribute().getText().isDefault())
+ {
+ const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon());
+
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createTextPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTextBox(),
+ getSdrSTAttribute().getText(),
+ attribute::SdrLineAttribute(),
+ false,
+ getWordWrap(),
+ isForceTextClipToTextRange()));
+ }
+
+ // add shadow
+ if(aRetval.hasElements() && !getSdrSTAttribute().getShadow().isDefault())
+ {
+ // #i105323# add generic shadow only for 2D shapes. For
+ // 3D shapes shadow will be set at the individual created
+ // visualisation objects and be visualized by the 3d renderer
+ // as a single shadow.
+ //
+ // The shadow for AutoShapes could be handled uniformely by not setting any
+ // shadow items at the helper model objects and only adding shadow here for
+ // 2D and 3D (and it works, too), but this would lead to two 3D scenes for
+ // the 3D object; one for the shadow aond one for the content. The one for the
+ // shadow will be correct (using ColorModifierStack), but expensive.
+ if(!get3DShape())
+ {
+ aRetval = createEmbeddedShadowPrimitive(aRetval, getSdrSTAttribute().getShadow());
+ }
+ }
+
+ return aRetval;
+ }
+
+ SdrCustomShapePrimitive2D::SdrCustomShapePrimitive2D(
+ const attribute::SdrShadowTextAttribute& rSdrSTAttribute,
+ const Primitive2DSequence& rSubPrimitives,
+ const basegfx::B2DHomMatrix& rTextBox,
+ bool bWordWrap,
+ bool b3DShape,
+ bool bForceTextClipToTextRange)
+ : BufferedDecompositionPrimitive2D(),
+ maSdrSTAttribute(rSdrSTAttribute),
+ maSubPrimitives(rSubPrimitives),
+ maTextBox(rTextBox),
+ mbWordWrap(bWordWrap),
+ mb3DShape(b3DShape),
+ mbForceTextClipToTextRange(bForceTextClipToTextRange)
+ {
+ }
+
+ bool SdrCustomShapePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+ {
+ const SdrCustomShapePrimitive2D& rCompare = (SdrCustomShapePrimitive2D&)rPrimitive;
+
+ return (getSdrSTAttribute() == rCompare.getSdrSTAttribute()
+ && getSubPrimitives() == rCompare.getSubPrimitives()
+ && getTextBox() == rCompare.getTextBox()
+ && getWordWrap() == rCompare.getWordWrap()
+ && get3DShape() == rCompare.get3DShape()
+ && isForceTextClipToTextRange() == rCompare.isForceTextClipToTextRange());
+ }
+
+ return false;
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(SdrCustomShapePrimitive2D, PRIMITIVE2D_ID_SDRCUSTOMSHAPEPRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
new file mode 100644
index 000000000000..76e6d81bb252
--- /dev/null
+++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
@@ -0,0 +1,486 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svx.hxx"
+#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
+#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx>
+#include <drawinglayer/attribute/strokeattribute.hxx>
+#include <drawinglayer/attribute/linestartendattribute.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/attribute/sdrfillbitmapattribute.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <drawinglayer/primitive2d/shadowprimitive2d.hxx>
+#include <svx/sdr/attribute/sdrtextattribute.hxx>
+#include <svx/sdr/primitive2d/sdrtextprimitive2d.hxx>
+#include <svx/svdotext.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <drawinglayer/primitive2d/animatedprimitive2d.hxx>
+#include <drawinglayer/animation/animationtiming.hxx>
+#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
+#include <basegfx/tools/canvastools.hxx>
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+#include <drawinglayer/primitive2d/texthierarchyprimitive2d.hxx>
+#include <drawinglayer/attribute/sdrfillattribute.hxx>
+#include <drawinglayer/attribute/sdrlineattribute.hxx>
+#include <drawinglayer/attribute/sdrlinestartendattribute.hxx>
+#include <drawinglayer/attribute/sdrshadowattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DReference createPolyPolygonFillPrimitive(
+ const basegfx::B2DPolyPolygon& rUnitPolyPolygon,
+ const basegfx::B2DHomMatrix& rObjectTransform,
+ const attribute::SdrFillAttribute& rFill,
+ const attribute::FillGradientAttribute& rFillGradient)
+ {
+ // prepare fully scaled polygon
+ basegfx::B2DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon);
+ aScaledPolyPolygon.transform(rObjectTransform);
+ BasePrimitive2D* pNewFillPrimitive = 0;
+
+ if(!rFill.getGradient().isDefault())
+ {
+ pNewFillPrimitive = new PolyPolygonGradientPrimitive2D(aScaledPolyPolygon, rFill.getGradient());
+ }
+ else if(!rFill.getHatch().isDefault())
+ {
+ pNewFillPrimitive = new PolyPolygonHatchPrimitive2D(aScaledPolyPolygon, rFill.getColor(), rFill.getHatch());
+ }
+ else if(!rFill.getBitmap().isDefault())
+ {
+ const basegfx::B2DRange aRange(basegfx::tools::getRange(aScaledPolyPolygon));
+ pNewFillPrimitive = new PolyPolygonBitmapPrimitive2D(aScaledPolyPolygon, rFill.getBitmap().getFillBitmapAttribute(aRange));
+ }
+ else
+ {
+ pNewFillPrimitive = new PolyPolygonColorPrimitive2D(aScaledPolyPolygon, rFill.getColor());
+ }
+
+ if(0.0 != rFill.getTransparence())
+ {
+ // create simpleTransparencePrimitive, add created fill primitive
+ const Primitive2DReference xRefA(pNewFillPrimitive);
+ const Primitive2DSequence aContent(&xRefA, 1L);
+ return Primitive2DReference(new UnifiedTransparencePrimitive2D(aContent, rFill.getTransparence()));
+ }
+ else if(!rFillGradient.isDefault())
+ {
+ // create sequence with created fill primitive
+ const Primitive2DReference xRefA(pNewFillPrimitive);
+ const Primitive2DSequence aContent(&xRefA, 1L);
+
+ // create FillGradientPrimitive2D for transparence and add to new sequence
+ // fillGradientPrimitive is enough here (compared to PolyPolygonGradientPrimitive2D) since float transparence will be masked anyways
+ const basegfx::B2DRange aRange(basegfx::tools::getRange(aScaledPolyPolygon));
+ const Primitive2DReference xRefB(new FillGradientPrimitive2D(aRange, rFillGradient));
+ const Primitive2DSequence aAlpha(&xRefB, 1L);
+
+ // create TransparencePrimitive2D using alpha and content
+ return Primitive2DReference(new TransparencePrimitive2D(aContent, aAlpha));
+ }
+ else
+ {
+ // add to decomposition
+ return Primitive2DReference(pNewFillPrimitive);
+ }
+ }
+
+ Primitive2DReference createPolygonLinePrimitive(
+ const basegfx::B2DPolygon& rUnitPolygon,
+ const basegfx::B2DHomMatrix& rObjectTransform,
+ const attribute::SdrLineAttribute& rLine,
+ const attribute::SdrLineStartEndAttribute& rStroke)
+ {
+ // prepare fully scaled polygon
+ basegfx::B2DPolygon aScaledPolygon(rUnitPolygon);
+ aScaledPolygon.transform(rObjectTransform);
+
+ // create line and stroke attribute
+ const attribute::LineAttribute aLineAttribute(rLine.getColor(), rLine.getWidth(), rLine.getJoin());
+ const attribute::StrokeAttribute aStrokeAttribute(rLine.getDotDashArray(), rLine.getFullDotDashLen());
+ BasePrimitive2D* pNewLinePrimitive = 0L;
+
+ if(!rUnitPolygon.isClosed() && !rStroke.isDefault())
+ {
+ attribute::LineStartEndAttribute aStart(rStroke.getStartWidth(), rStroke.getStartPolyPolygon(), rStroke.isStartCentered());
+ attribute::LineStartEndAttribute aEnd(rStroke.getEndWidth(), rStroke.getEndPolyPolygon(), rStroke.isEndCentered());
+
+ // create data
+ pNewLinePrimitive = new PolygonStrokeArrowPrimitive2D(aScaledPolygon, aLineAttribute, aStrokeAttribute, aStart, aEnd);
+ }
+ else
+ {
+ // create data
+ pNewLinePrimitive = new PolygonStrokePrimitive2D(aScaledPolygon, aLineAttribute, aStrokeAttribute);
+ }
+
+ if(0.0 != rLine.getTransparence())
+ {
+ // create simpleTransparencePrimitive, add created fill primitive
+ const Primitive2DReference xRefA(pNewLinePrimitive);
+ const Primitive2DSequence aContent(&xRefA, 1L);
+ return Primitive2DReference(new UnifiedTransparencePrimitive2D(aContent, rLine.getTransparence()));
+ }
+ else
+ {
+ // add to decomposition
+ return Primitive2DReference(pNewLinePrimitive);
+ }
+ }
+
+ Primitive2DReference createTextPrimitive(
+ const basegfx::B2DPolyPolygon& rUnitPolyPolygon,
+ const basegfx::B2DHomMatrix& rObjectTransform,
+ const attribute::SdrTextAttribute& rText,
+ const attribute::SdrLineAttribute& rStroke,
+ bool bCellText,
+ bool bWordWrap,
+ bool bClipOnBounds)
+ {
+ basegfx::B2DHomMatrix aAnchorTransform(rObjectTransform);
+ SdrTextPrimitive2D* pNew = 0;
+
+ if(rText.isContour())
+ {
+ // contour text
+ if(!rStroke.isDefault() && 0.0 != rStroke.getWidth())
+ {
+ // take line width into account and shrink contour polygon accordingly
+ // decompose to get scale
+ basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ rObjectTransform.decompose(aScale, aTranslate, fRotate, fShearX);
+
+ // scale outline to object's size to allow growing with value relative to that size
+ // and also to keep aspect ratio
+ basegfx::B2DPolyPolygon aScaledUnitPolyPolygon(rUnitPolyPolygon);
+ aScaledUnitPolyPolygon.transform(basegfx::tools::createScaleB2DHomMatrix(
+ fabs(aScale.getX()), fabs(aScale.getY())));
+
+ // grow the polygon. To shrink, use negative value (half width)
+ aScaledUnitPolyPolygon = basegfx::tools::growInNormalDirection(aScaledUnitPolyPolygon, -(rStroke.getWidth() * 0.5));
+
+ // scale back to unit polygon
+ aScaledUnitPolyPolygon.transform(basegfx::tools::createScaleB2DHomMatrix(
+ 0.0 != aScale.getX() ? 1.0 / aScale.getX() : 1.0,
+ 0.0 != aScale.getY() ? 1.0 / aScale.getY() : 1.0));
+
+ // create with unit polygon
+ pNew = new SdrContourTextPrimitive2D(
+ &rText.getSdrText(),
+ rText.getOutlinerParaObject(),
+ aScaledUnitPolyPolygon,
+ rObjectTransform);
+ }
+ else
+ {
+ // create with unit polygon
+ pNew = new SdrContourTextPrimitive2D(
+ &rText.getSdrText(),
+ rText.getOutlinerParaObject(),
+ rUnitPolyPolygon,
+ rObjectTransform);
+ }
+ }
+ else if(!rText.getSdrFormTextAttribute().isDefault())
+ {
+ // text on path, use scaled polygon
+ basegfx::B2DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon);
+ aScaledPolyPolygon.transform(rObjectTransform);
+ pNew = new SdrPathTextPrimitive2D(
+ &rText.getSdrText(),
+ rText.getOutlinerParaObject(),
+ aScaledPolyPolygon,
+ rText.getSdrFormTextAttribute());
+ }
+ else
+ {
+ // rObjectTransform is the whole SdrObject transformation from unit rectangle
+ // to it's size and position. Decompose to allow working with single values.
+ basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ rObjectTransform.decompose(aScale, aTranslate, fRotate, fShearX);
+
+ // extract mirroring
+ const bool bMirrorX(basegfx::fTools::less(aScale.getX(), 0.0));
+ const bool bMirrorY(basegfx::fTools::less(aScale.getY(), 0.0));
+ aScale = basegfx::absolute(aScale);
+
+ // Get the real size, since polygon ountline and scale
+ // from the object transformation may vary (e.g. ellipse segments)
+ basegfx::B2DHomMatrix aJustScaleTransform;
+ aJustScaleTransform.set(0, 0, aScale.getX());
+ aJustScaleTransform.set(1, 1, aScale.getY());
+ basegfx::B2DPolyPolygon aScaledUnitPolyPolygon(rUnitPolyPolygon);
+ aScaledUnitPolyPolygon.transform(aJustScaleTransform);
+ const basegfx::B2DRange aSnapRange(basegfx::tools::getRange(aScaledUnitPolyPolygon));
+
+ // create a range describing the wanted text position and size (aTextAnchorRange). This
+ // means to use the text distance values here
+ const basegfx::B2DPoint aTopLeft(aSnapRange.getMinX() + rText.getTextLeftDistance(), aSnapRange.getMinY() + rText.getTextUpperDistance());
+ const basegfx::B2DPoint aBottomRight(aSnapRange.getMaxX() - rText.getTextRightDistance(), aSnapRange.getMaxY() - rText.getTextLowerDistance());
+ basegfx::B2DRange aTextAnchorRange;
+ aTextAnchorRange.expand(aTopLeft);
+ aTextAnchorRange.expand(aBottomRight);
+
+ // now create a transformation from this basic range (aTextAnchorRange)
+ aAnchorTransform = basegfx::tools::createScaleTranslateB2DHomMatrix(
+ aTextAnchorRange.getWidth(), aTextAnchorRange.getHeight(),
+ aTextAnchorRange.getMinX(), aTextAnchorRange.getMinY());
+
+ // apply mirroring
+ aAnchorTransform.scale(bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0);
+
+ // apply object's other transforms
+ aAnchorTransform = basegfx::tools::createShearXRotateTranslateB2DHomMatrix(fShearX, fRotate, aTranslate)
+ * aAnchorTransform;
+
+ if(rText.isFitToSize())
+ {
+ // streched text in range
+ pNew = new SdrStretchTextPrimitive2D(
+ &rText.getSdrText(),
+ rText.getOutlinerParaObject(),
+ aAnchorTransform,
+ rText.isFixedCellHeight());
+ }
+ else // text in range
+ {
+ // build new primitive
+ pNew = new SdrBlockTextPrimitive2D(
+ &rText.getSdrText(),
+ rText.getOutlinerParaObject(),
+ aAnchorTransform,
+ rText.getSdrTextHorzAdjust(),
+ rText.getSdrTextVertAdjust(),
+ rText.isFixedCellHeight(),
+ rText.isScroll(),
+ bCellText,
+ bWordWrap,
+ bClipOnBounds);
+ }
+ }
+
+ OSL_ENSURE(pNew != 0, "createTextPrimitive: no text primitive created (!)");
+
+ if(rText.isBlink())
+ {
+ // prepare animation and primitive list
+ drawinglayer::animation::AnimationEntryList aAnimationList;
+ rText.getBlinkTextTiming(aAnimationList);
+
+ if(0.0 != aAnimationList.getDuration())
+ {
+ // create content sequence
+ const Primitive2DReference xRefA(pNew);
+ const Primitive2DSequence aContent(&xRefA, 1L);
+
+ // create and add animated switch primitive
+ return Primitive2DReference(new AnimatedBlinkPrimitive2D(aAnimationList, aContent, true));
+ }
+ else
+ {
+ // add to decomposition
+ return Primitive2DReference(pNew);
+ }
+ }
+
+ if(rText.isScroll())
+ {
+ // suppress scroll when FontWork
+ if(rText.getSdrFormTextAttribute().isDefault())
+ {
+ // 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
+ const basegfx::B2DHomMatrix aSRT(basegfx::tools::createShearXRotateTranslateB2DHomMatrix(
+ fShearX, fRotate, aTranslate));
+ 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);
+ }
+ }
+ }
+
+ 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);
+ }
+ }
+
+ Primitive2DSequence createEmbeddedShadowPrimitive(
+ const Primitive2DSequence& rContent,
+ const attribute::SdrShadowAttribute& rShadow)
+ {
+ if(rContent.hasElements())
+ {
+ Primitive2DSequence aRetval(2);
+ basegfx::B2DHomMatrix aShadowOffset;
+
+ // prepare shadow offset
+ aShadowOffset.set(0, 2, rShadow.getOffset().getX());
+ aShadowOffset.set(1, 2, rShadow.getOffset().getY());
+
+ // create shadow primitive and add content
+ aRetval[0] = Primitive2DReference(
+ new ShadowPrimitive2D(
+ aShadowOffset,
+ rShadow.getColor(),
+ rContent));
+
+ if(0.0 != rShadow.getTransparence())
+ {
+ // create SimpleTransparencePrimitive2D
+ const Primitive2DSequence aTempContent(&aRetval[0], 1);
+
+ aRetval[0] = Primitive2DReference(
+ new UnifiedTransparencePrimitive2D(
+ aTempContent,
+ rShadow.getTransparence()));
+ }
+
+ aRetval[1] = Primitive2DReference(new GroupPrimitive2D(rContent));
+ return aRetval;
+ }
+ else
+ {
+ return rContent;
+ }
+ }
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx
new file mode 100644
index 000000000000..02de307bee77
--- /dev/null
+++ b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx
@@ -0,0 +1,278 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svx.hxx"
+#include <svx/sdr/primitive2d/sdrellipseprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence SdrEllipsePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const
+ {
+ Primitive2DSequence aRetval;
+
+ // create unit outline polygon
+ // Do use createPolygonFromUnitCircle, but let create from first quadrant to mimic old geometry creation.
+ // This is needed to have the same look when stroke is used since the polygon start point defines the
+ // stroke start, too.
+ basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromUnitCircle(1));
+
+ // scale and move UnitEllipse to UnitObject (-1,-1 1,1) -> (0,0 1,1)
+ const basegfx::B2DHomMatrix aUnitCorrectionMatrix(
+ basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5));
+
+ // apply to the geometry
+ aUnitOutline.transform(aUnitCorrectionMatrix);
+
+ // add fill
+ if(!getSdrLFSTAttribute().getFill().isDefault())
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolyPolygonFillPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getFill(),
+ getSdrLFSTAttribute().getFillFloatTransGradient()));
+ }
+
+ // add line
+ if(getSdrLFSTAttribute().getLine().isDefault())
+ {
+ // create invisible line for HitTest/BoundRect
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createHiddenGeometryPrimitives2D(
+ false,
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform()));
+ }
+ else
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolygonLinePrimitive(
+ aUnitOutline,
+ getTransform(),
+ getSdrLFSTAttribute().getLine(),
+ attribute::SdrLineStartEndAttribute()));
+ }
+
+ // add text
+ if(!getSdrLFSTAttribute().getText().isDefault())
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createTextPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getText(),
+ getSdrLFSTAttribute().getLine(),
+ false,
+ false,
+ false));
+ }
+
+ // add shadow
+ if(!getSdrLFSTAttribute().getShadow().isDefault())
+ {
+ aRetval = createEmbeddedShadowPrimitive(
+ aRetval,
+ getSdrLFSTAttribute().getShadow());
+ }
+
+ return aRetval;
+ }
+
+ SdrEllipsePrimitive2D::SdrEllipsePrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute)
+ : BufferedDecompositionPrimitive2D(),
+ maTransform(rTransform),
+ maSdrLFSTAttribute(rSdrLFSTAttribute)
+ {
+ }
+
+ bool SdrEllipsePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+ {
+ const SdrEllipsePrimitive2D& rCompare = (SdrEllipsePrimitive2D&)rPrimitive;
+
+ return (getTransform() == rCompare.getTransform()
+ && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute());
+ }
+
+ return false;
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(SdrEllipsePrimitive2D, PRIMITIVE2D_ID_SDRELLIPSEPRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence SdrEllipseSegmentPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const
+ {
+ Primitive2DSequence aRetval;
+
+ // create unit outline polygon
+ basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromUnitEllipseSegment(mfStartAngle, mfEndAngle));
+
+ if(mbCloseSegment)
+ {
+ if(mbCloseUsingCenter)
+ {
+ // for compatibility, insert the center point at polygon start to get the same
+ // line stroking pattern as the old painting mechanisms.
+ aUnitOutline.insert(0L, basegfx::B2DPoint(0.0, 0.0));
+ }
+
+ aUnitOutline.setClosed(true);
+ }
+
+ // move and scale UnitEllipse to UnitObject (-1,-1 1,1) -> (0,0 1,1)
+ const basegfx::B2DHomMatrix aUnitCorrectionMatrix(
+ basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5));
+
+ // apply to the geometry
+ aUnitOutline.transform(aUnitCorrectionMatrix);
+
+ // add fill
+ if(!getSdrLFSTAttribute().getFill().isDefault() && aUnitOutline.isClosed())
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolyPolygonFillPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getFill(),
+ getSdrLFSTAttribute().getFillFloatTransGradient()));
+ }
+
+ // add line
+ if(getSdrLFSTAttribute().getLine().isDefault())
+ {
+ // create invisible line for HitTest/BoundRect
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createHiddenGeometryPrimitives2D(
+ false,
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform()));
+ }
+ else
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolygonLinePrimitive(
+ aUnitOutline,
+ getTransform(),
+ getSdrLFSTAttribute().getLine(),
+ getSdrLFSTAttribute().getLineStartEnd()));
+ }
+
+ // add text
+ if(!getSdrLFSTAttribute().getText().isDefault())
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createTextPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getText(),
+ getSdrLFSTAttribute().getLine(),
+ false,
+ false,
+ false));
+ }
+
+ // add shadow
+ if(!getSdrLFSTAttribute().getShadow().isDefault())
+ {
+ aRetval = createEmbeddedShadowPrimitive(
+ aRetval,
+ getSdrLFSTAttribute().getShadow());
+ }
+
+ return aRetval;
+ }
+
+ SdrEllipseSegmentPrimitive2D::SdrEllipseSegmentPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute,
+ double fStartAngle,
+ double fEndAngle,
+ bool bCloseSegment,
+ bool bCloseUsingCenter)
+ : SdrEllipsePrimitive2D(rTransform, rSdrLFSTAttribute),
+ mfStartAngle(fStartAngle),
+ mfEndAngle(fEndAngle),
+ mbCloseSegment(bCloseSegment),
+ mbCloseUsingCenter(bCloseUsingCenter)
+ {
+ }
+
+ bool SdrEllipseSegmentPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(SdrEllipsePrimitive2D::operator==(rPrimitive))
+ {
+ const SdrEllipseSegmentPrimitive2D& rCompare = (SdrEllipseSegmentPrimitive2D&)rPrimitive;
+
+ if( mfStartAngle == rCompare.mfStartAngle
+ && mfEndAngle == rCompare.mfEndAngle
+ && mbCloseSegment == rCompare.mbCloseSegment
+ && mbCloseUsingCenter == rCompare.mbCloseUsingCenter)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(SdrEllipseSegmentPrimitive2D, PRIMITIVE2D_ID_SDRELLIPSESEGMENTPRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
new file mode 100644
index 000000000000..e981af91896b
--- /dev/null
+++ b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
@@ -0,0 +1,177 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svx.hxx"
+#include <svx/sdr/primitive2d/sdrgrafprimitive2d.hxx>
+#include <drawinglayer/primitive2d/graphicprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence SdrGrafPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const
+ {
+ Primitive2DSequence aRetval;
+
+ // create unit outline polygon
+ basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon());
+
+ // add fill, but only when graphic ist transparent
+ if(!getSdrLFSTAttribute().getFill().isDefault() && isTransparent())
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolyPolygonFillPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getFill(),
+ getSdrLFSTAttribute().getFillFloatTransGradient()));
+ }
+
+ // add line
+ if(!getSdrLFSTAttribute().getLine().isDefault())
+ {
+ // if line width is given, polygon needs to be grown by half of it to make the
+ // outline to be outside of the bitmap
+ if(0.0 != getSdrLFSTAttribute().getLine().getWidth())
+ {
+ // decompose to get scale
+ basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ getTransform().decompose(aScale, aTranslate, fRotate, fShearX);
+
+ // create expanded range (add relative half line width to unit rectangle)
+ double fHalfLineWidth(getSdrLFSTAttribute().getLine().getWidth() * 0.5);
+ double fScaleX(0.0 != aScale.getX() ? fHalfLineWidth / fabs(aScale.getX()) : 1.0);
+ double fScaleY(0.0 != aScale.getY() ? fHalfLineWidth / fabs(aScale.getY()) : 1.0);
+ const basegfx::B2DRange aExpandedRange(-fScaleX, -fScaleY, 1.0 + fScaleX, 1.0 + fScaleY);
+ basegfx::B2DPolygon aExpandedUnitOutline(basegfx::tools::createPolygonFromRect(aExpandedRange));
+
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolygonLinePrimitive(
+ aExpandedUnitOutline,
+ getTransform(),
+ getSdrLFSTAttribute().getLine(),
+ attribute::SdrLineStartEndAttribute()));
+ }
+ else
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolygonLinePrimitive(
+ aUnitOutline, getTransform(),
+ getSdrLFSTAttribute().getLine(),
+ attribute::SdrLineStartEndAttribute()));
+ }
+ }
+
+ // add graphic content
+ if(255L != getGraphicAttr().GetTransparency())
+ {
+ const Primitive2DReference xGraphicContentPrimitive(
+ new GraphicPrimitive2D(
+ getTransform(),
+ getGraphicObject(),
+ getGraphicAttr()));
+
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, xGraphicContentPrimitive);
+ }
+
+ // add text
+ if(!getSdrLFSTAttribute().getText().isDefault())
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createTextPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getText(),
+ getSdrLFSTAttribute().getLine(),
+ false,
+ false,
+ false));
+ }
+
+ // add shadow
+ if(!getSdrLFSTAttribute().getShadow().isDefault())
+ {
+ aRetval = createEmbeddedShadowPrimitive(
+ aRetval,
+ getSdrLFSTAttribute().getShadow());
+ }
+
+ return aRetval;
+ }
+
+ SdrGrafPrimitive2D::SdrGrafPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute,
+ const GraphicObject& rGraphicObject,
+ const GraphicAttr& rGraphicAttr)
+ : BufferedDecompositionPrimitive2D(),
+ maTransform(rTransform),
+ maSdrLFSTAttribute(rSdrLFSTAttribute),
+ maGraphicObject(rGraphicObject),
+ maGraphicAttr(rGraphicAttr)
+ {
+ // reset some values from GraphicAttr which are part of transformation already
+ maGraphicAttr.SetRotation(0L);
+ }
+
+ bool SdrGrafPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+ {
+ const SdrGrafPrimitive2D& rCompare = (SdrGrafPrimitive2D&)rPrimitive;
+
+ return (getTransform() == rCompare.getTransform()
+ && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute()
+ && getGraphicObject() == rCompare.getGraphicObject()
+ && getGraphicAttr() == rCompare.getGraphicAttr());
+ }
+
+ return false;
+ }
+
+ bool SdrGrafPrimitive2D::isTransparent() const
+ {
+ return ((0L != getGraphicAttr().GetTransparency()) || (getGraphicObject().IsTransparent()));
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(SdrGrafPrimitive2D, PRIMITIVE2D_ID_SDRGRAFPRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
new file mode 100644
index 000000000000..e4403cd6df49
--- /dev/null
+++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
@@ -0,0 +1,510 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svx.hxx"
+#include <svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx>
+#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/primitive2d/sdrtextprimitive2d.hxx>
+#include <svx/sdr/attribute/sdrtextattribute.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <basegfx/tools/canvastools.hxx>
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DReference SdrMeasurePrimitive2D::impCreatePart(
+ const attribute::SdrLineAttribute& rLineAttribute,
+ const basegfx::B2DHomMatrix& rObjectMatrix,
+ const basegfx::B2DPoint& rStart,
+ const basegfx::B2DPoint& rEnd,
+ bool bLeftActive,
+ bool bRightActive) const
+ {
+ const attribute::SdrLineStartEndAttribute& rLineStartEnd = getSdrLSTAttribute().getLineStartEnd();
+ basegfx::B2DPolygon aPolygon;
+
+ aPolygon.append(rStart);
+ aPolygon.append(rEnd);
+
+ if(rLineStartEnd.isDefault() || (!bLeftActive && !bRightActive))
+ {
+ return createPolygonLinePrimitive(
+ aPolygon,
+ rObjectMatrix,
+ rLineAttribute,
+ attribute::SdrLineStartEndAttribute());
+ }
+
+ if(bLeftActive && bRightActive)
+ {
+ return createPolygonLinePrimitive(
+ aPolygon,
+ rObjectMatrix,
+ rLineAttribute,
+ rLineStartEnd);
+ }
+
+ const basegfx::B2DPolyPolygon aEmpty;
+ const attribute::SdrLineStartEndAttribute aLineStartEnd(
+ bLeftActive ? rLineStartEnd.getStartPolyPolygon() : aEmpty, bRightActive ? rLineStartEnd.getEndPolyPolygon() : aEmpty,
+ bLeftActive ? rLineStartEnd.getStartWidth() : 0.0, bRightActive ? rLineStartEnd.getEndWidth() : 0.0,
+ bLeftActive ? rLineStartEnd.isStartActive() : false, bRightActive ? rLineStartEnd.isEndActive() : false,
+ bLeftActive ? rLineStartEnd.isStartCentered() : false, bRightActive? rLineStartEnd.isEndCentered() : false);
+
+ return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, aLineStartEnd);
+ }
+
+ Primitive2DSequence SdrMeasurePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const
+ {
+ Primitive2DSequence aRetval;
+ SdrBlockTextPrimitive2D* pBlockText = 0;
+ basegfx::B2DRange aTextRange;
+ double fTextX((getStart().getX() + getEnd().getX()) * 0.5);
+ double fTextY((getStart().getX() + getEnd().getX()) * 0.5);
+ const basegfx::B2DVector aLine(getEnd() - getStart());
+ const double fDistance(aLine.getLength());
+ const double fAngle(atan2(aLine.getY(), aLine.getX()));
+ bool bAutoUpsideDown(false);
+ const attribute::SdrTextAttribute rTextAttribute = getSdrLSTAttribute().getText();
+ const basegfx::B2DHomMatrix aObjectMatrix(
+ basegfx::tools::createShearXRotateTranslateB2DHomMatrix(0.0, fAngle, getStart()));
+
+ // preapare text, but do not add yet; it needs to be aligned to
+ // the line geometry
+ if(!rTextAttribute.isDefault())
+ {
+ basegfx::B2DHomMatrix aTextMatrix;
+ double fTestAngle(fAngle);
+
+ if(getTextRotation())
+ {
+ aTextMatrix.rotate(-90.0 * F_PI180);
+ fTestAngle -= (90.0 * F_PI180);
+
+ if(getTextAutoAngle() && fTestAngle < -F_PI)
+ {
+ fTestAngle += F_2PI;
+ }
+ }
+
+ if(getTextAutoAngle())
+ {
+ if(fTestAngle > (F_PI / 4.0) || fTestAngle < (-F_PI * (3.0 / 4.0)))
+ {
+ bAutoUpsideDown = true;
+ }
+ }
+
+ // create primitive and get text range
+ pBlockText = new SdrBlockTextPrimitive2D(
+ &rTextAttribute.getSdrText(),
+ rTextAttribute.getOutlinerParaObject(),
+ aTextMatrix,
+ SDRTEXTHORZADJUST_CENTER,
+ SDRTEXTVERTADJUST_CENTER,
+ rTextAttribute.isScroll(),
+ false,
+ false,
+ false,
+ false);
+
+ aTextRange = pBlockText->getB2DRange(aViewInformation);
+ }
+
+ // prepare line attribute and result
+ {
+ const attribute::SdrLineAttribute rLineAttribute(getSdrLSTAttribute().getLine());
+ bool bArrowsOutside(false);
+ bool bMainLineSplitted(false);
+ const attribute::SdrLineStartEndAttribute& rLineStartEnd = getSdrLSTAttribute().getLineStartEnd();
+ double fStartArrowW(0.0);
+ double fStartArrowH(0.0);
+ double fEndArrowW(0.0);
+ double fEndArrowH(0.0);
+
+ if(!rLineStartEnd.isDefault())
+ {
+ if(rLineStartEnd.isStartActive())
+ {
+ const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(rLineStartEnd.getStartPolyPolygon()));
+ fStartArrowW = rLineStartEnd.getStartWidth();
+ fStartArrowH = aArrowRange.getHeight() * fStartArrowW / aArrowRange.getWidth();
+
+ if(rLineStartEnd.isStartCentered())
+ {
+ fStartArrowH *= 0.5;
+ }
+ }
+
+ if(rLineStartEnd.isEndActive())
+ {
+ const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(rLineStartEnd.getEndPolyPolygon()));
+ fEndArrowW = rLineStartEnd.getEndWidth();
+ fEndArrowH = aArrowRange.getHeight() * fEndArrowW / aArrowRange.getWidth();
+
+ if(rLineStartEnd.isEndCentered())
+ {
+ fEndArrowH *= 0.5;
+ }
+ }
+ }
+
+ const double fSpaceNeededByArrows(fStartArrowH + fEndArrowH + ((fStartArrowW + fEndArrowW) * 0.5));
+ const double fArrowsOutsideLen((fStartArrowH + fEndArrowH + fStartArrowW + fEndArrowW) * 0.5);
+ const double fHalfLineWidth(rLineAttribute.getWidth() * 0.5);
+
+ if(fSpaceNeededByArrows > fDistance)
+ {
+ bArrowsOutside = true;
+ }
+
+ MeasureTextPosition eHorizontal(getHorizontal());
+ MeasureTextPosition eVertical(getVertical());
+
+ if(MEASURETEXTPOSITION_AUTOMATIC == eVertical)
+ {
+ eVertical = MEASURETEXTPOSITION_NEGATIVE;
+ }
+
+ if(MEASURETEXTPOSITION_CENTERED == eVertical)
+ {
+ bMainLineSplitted = true;
+ }
+
+ if(MEASURETEXTPOSITION_AUTOMATIC == eHorizontal)
+ {
+ if(aTextRange.getWidth() > fDistance)
+ {
+ eHorizontal = MEASURETEXTPOSITION_NEGATIVE;
+ }
+ else
+ {
+ eHorizontal = MEASURETEXTPOSITION_CENTERED;
+ }
+
+ if(bMainLineSplitted)
+ {
+ if(aTextRange.getWidth() + fSpaceNeededByArrows > fDistance)
+ {
+ bArrowsOutside = true;
+ }
+ }
+ else
+ {
+ const double fSmallArrowNeed(fStartArrowH + fEndArrowH + ((fStartArrowW + fEndArrowW) * 0.125));
+
+ if(aTextRange.getWidth() + fSmallArrowNeed > fDistance)
+ {
+ bArrowsOutside = true;
+ }
+ }
+ }
+
+ if(MEASURETEXTPOSITION_CENTERED != eHorizontal)
+ {
+ bArrowsOutside = true;
+ }
+
+ // switch text above/below?
+ if(getBelow() || (bAutoUpsideDown && !getTextRotation()))
+ {
+ if(MEASURETEXTPOSITION_NEGATIVE == eVertical)
+ {
+ eVertical = MEASURETEXTPOSITION_POSITIVE;
+ }
+ else if(MEASURETEXTPOSITION_POSITIVE == eVertical)
+ {
+ eVertical = MEASURETEXTPOSITION_NEGATIVE;
+ }
+ }
+
+ const double fMainLineOffset(getBelow() ? getDistance() : -getDistance());
+ const basegfx::B2DPoint aMainLeft(0.0, fMainLineOffset);
+ const basegfx::B2DPoint aMainRight(fDistance, fMainLineOffset);
+
+ // main line
+ if(bArrowsOutside)
+ {
+ double fLenLeft(fArrowsOutsideLen);
+ double fLenRight(fArrowsOutsideLen);
+
+ if(!bMainLineSplitted)
+ {
+ if(MEASURETEXTPOSITION_NEGATIVE == eHorizontal)
+ {
+ fLenLeft = fStartArrowH + aTextRange.getWidth();
+ }
+ else if(MEASURETEXTPOSITION_POSITIVE == eHorizontal)
+ {
+ fLenRight = fEndArrowH + aTextRange.getWidth();
+ }
+ }
+
+ const basegfx::B2DPoint aMainLeftLeft(aMainLeft.getX() - fLenLeft, aMainLeft.getY());
+ const basegfx::B2DPoint aMainRightRight(aMainRight.getX() + fLenRight, aMainRight.getY());
+
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeftLeft, aMainLeft, false, true));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainRight, aMainRightRight, true, false));
+
+ if(!bMainLineSplitted || MEASURETEXTPOSITION_CENTERED != eHorizontal)
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainRight, false, false));
+ }
+ }
+ else
+ {
+ if(bMainLineSplitted)
+ {
+ const double fHalfLength((fDistance - (aTextRange.getWidth() + (fStartArrowH + fEndArrowH) * 0.25)) * 0.5);
+ const basegfx::B2DPoint aMainInnerLeft(aMainLeft.getX() + fHalfLength, aMainLeft.getY());
+ const basegfx::B2DPoint aMainInnerRight(aMainRight.getX() - fHalfLength, aMainRight.getY());
+
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainInnerLeft, true, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainInnerRight, aMainRight, false, true));
+ }
+ else
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainRight, true, true));
+ }
+ }
+
+ // left/right help line value preparation
+ const double fTopEdge(getBelow() ? getUpper() + getDistance() : -getUpper() - getDistance());
+ const double fBottomLeft(getBelow() ? getLower() - getLeftDelta() : getLeftDelta() - getLower());
+ const double fBottomRight(getBelow() ? getLower() - getRightDelta() : getRightDelta() - getLower());
+
+ // left help line
+ const basegfx::B2DPoint aLeftUp(0.0, fTopEdge);
+ const basegfx::B2DPoint aLeftDown(0.0, fBottomLeft);
+
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aLeftDown, aLeftUp, false, false));
+
+ // right help line
+ const basegfx::B2DPoint aRightUp(fDistance, fTopEdge);
+ const basegfx::B2DPoint aRightDown(fDistance, fBottomRight);
+
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aRightDown, aRightUp, false, false));
+
+ // text horizontal position
+ if(MEASURETEXTPOSITION_NEGATIVE == eHorizontal)
+ {
+ // left
+ const double fSmall(fArrowsOutsideLen * 0.18);
+ fTextX = aMainLeft.getX() - (fStartArrowH + aTextRange.getWidth() + fSmall + fHalfLineWidth);
+
+ if(bMainLineSplitted)
+ {
+ fTextX -= (fArrowsOutsideLen - fStartArrowH);
+ }
+
+ if(!rTextAttribute.isDefault())
+ {
+ fTextX -= rTextAttribute.getTextRightDistance();
+ }
+ }
+ else if(MEASURETEXTPOSITION_POSITIVE == eHorizontal)
+ {
+ // right
+ const double fSmall(fArrowsOutsideLen * 0.18);
+ fTextX = aMainRight.getX() + (fEndArrowH + fSmall + fHalfLineWidth);
+
+ if(bMainLineSplitted)
+ {
+ fTextX += (fArrowsOutsideLen - fEndArrowH);
+ }
+
+ if(!rTextAttribute.isDefault())
+ {
+ fTextX += rTextAttribute.getTextLeftDistance();
+ }
+ }
+ else // MEASURETEXTPOSITION_CENTERED
+ {
+ // centered
+ fTextX = aMainLeft.getX() + ((fDistance - aTextRange.getWidth()) * 0.5);
+
+ if(!rTextAttribute.isDefault())
+ {
+ fTextX += (rTextAttribute.getTextLeftDistance() - rTextAttribute.getTextRightDistance()) / 2L;
+ }
+ }
+
+ // text vertical position
+ if(MEASURETEXTPOSITION_NEGATIVE == eVertical)
+ {
+ // top
+ const double fSmall(fArrowsOutsideLen * 0.10);
+ fTextY = aMainLeft.getY() - (aTextRange.getHeight() + fSmall + fHalfLineWidth);
+
+ if(!rTextAttribute.isDefault())
+ {
+ fTextY -= rTextAttribute.getTextLowerDistance();
+ }
+ }
+ else if(MEASURETEXTPOSITION_POSITIVE == eVertical)
+ {
+ // bottom
+ const double fSmall(fArrowsOutsideLen * 0.10);
+ fTextY = aMainLeft.getY() + (fSmall + fHalfLineWidth);
+
+ if(!rTextAttribute.isDefault())
+ {
+ fTextY += rTextAttribute.getTextUpperDistance();
+ }
+ }
+ else // MEASURETEXTPOSITION_CENTERED
+ {
+ // centered
+ fTextY = aMainLeft.getY() - (aTextRange.getHeight() * 0.5);
+
+ if(!rTextAttribute.isDefault())
+ {
+ fTextY += (rTextAttribute.getTextUpperDistance() - rTextAttribute.getTextLowerDistance()) / 2L;
+ }
+ }
+ }
+
+ if(getSdrLSTAttribute().getLine().isDefault())
+ {
+ // embed line geometry to invisible (100% transparent) line group for HitTest
+ const Primitive2DReference xHiddenLines(new HiddenGeometryPrimitive2D(aRetval));
+
+ aRetval = Primitive2DSequence(&xHiddenLines, 1);
+ }
+
+ if(pBlockText)
+ {
+ // create transformation to text primitive end position
+ basegfx::B2DHomMatrix aChange;
+
+ // handle auto text rotation
+ if(bAutoUpsideDown)
+ {
+ aChange.rotate(F_PI);
+ }
+
+ // move from aTextRange.TopLeft to fTextX, fTextY
+ aChange.translate(fTextX - aTextRange.getMinX(), fTextY - aTextRange.getMinY());
+
+ // apply object matrix
+ aChange *= aObjectMatrix;
+
+ // apply to existing text primitive
+ SdrTextPrimitive2D* pNewBlockText = pBlockText->createTransformedClone(aChange);
+ OSL_ENSURE(pNewBlockText, "SdrMeasurePrimitive2D::create2DDecomposition: Could not create transformed clone of text primitive (!)");
+ delete pBlockText;
+
+ // add to local primitives
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(pNewBlockText));
+ }
+
+ // add shadow
+ if(!getSdrLSTAttribute().getShadow().isDefault())
+ {
+ aRetval = createEmbeddedShadowPrimitive(
+ aRetval,
+ getSdrLSTAttribute().getShadow());
+ }
+
+ return aRetval;
+ }
+
+ SdrMeasurePrimitive2D::SdrMeasurePrimitive2D(
+ const attribute::SdrLineShadowTextAttribute& rSdrLSTAttribute,
+ const basegfx::B2DPoint& rStart,
+ const basegfx::B2DPoint& rEnd,
+ MeasureTextPosition eHorizontal,
+ MeasureTextPosition eVertical,
+ double fDistance,
+ double fUpper,
+ double fLower,
+ double fLeftDelta,
+ double fRightDelta,
+ bool bBelow,
+ bool bTextRotation,
+ bool bTextAutoAngle)
+ : BufferedDecompositionPrimitive2D(),
+ maSdrLSTAttribute(rSdrLSTAttribute),
+ maStart(rStart),
+ maEnd(rEnd),
+ meHorizontal(eHorizontal),
+ meVertical(eVertical),
+ mfDistance(fDistance),
+ mfUpper(fUpper),
+ mfLower(fLower),
+ mfLeftDelta(fLeftDelta),
+ mfRightDelta(fRightDelta),
+ mbBelow(bBelow),
+ mbTextRotation(bTextRotation),
+ mbTextAutoAngle(bTextAutoAngle)
+ {
+ }
+
+ bool SdrMeasurePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+ {
+ const SdrMeasurePrimitive2D& rCompare = (SdrMeasurePrimitive2D&)rPrimitive;
+
+ return (getStart() == rCompare.getStart()
+ && getEnd() == rCompare.getEnd()
+ && getHorizontal() == rCompare.getHorizontal()
+ && getVertical() == rCompare.getVertical()
+ && getDistance() == rCompare.getDistance()
+ && getUpper() == rCompare.getUpper()
+ && getLower() == rCompare.getLower()
+ && getLeftDelta() == rCompare.getLeftDelta()
+ && getRightDelta() == rCompare.getRightDelta()
+ && getBelow() == rCompare.getBelow()
+ && getTextRotation() == rCompare.getTextRotation()
+ && getTextAutoAngle() == rCompare.getTextAutoAngle()
+ && getSdrLSTAttribute() == rCompare.getSdrLSTAttribute());
+ }
+
+ return false;
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(SdrMeasurePrimitive2D, PRIMITIVE2D_ID_SDRMEASUREPRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx
new file mode 100644
index 000000000000..43e3cf72ffbb
--- /dev/null
+++ b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx
@@ -0,0 +1,190 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svx.hxx"
+#include <svx/sdr/primitive2d/sdrole2primitive2d.hxx>
+#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ SdrOle2Primitive2D::SdrOle2Primitive2D(
+ const Primitive2DSequence& rOLEContent,
+ const basegfx::B2DHomMatrix& rTransform,
+ const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute)
+ : BasePrimitive2D(),
+ maOLEContent(rOLEContent),
+ maTransform(rTransform),
+ maSdrLFSTAttribute(rSdrLFSTAttribute)
+ {
+ }
+
+ bool SdrOle2Primitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(BasePrimitive2D::operator==(rPrimitive))
+ {
+ const SdrOle2Primitive2D& rCompare = (SdrOle2Primitive2D&)rPrimitive;
+
+ // #i108636# The standard operator== on two UNO sequences did not work as i
+ // would have expected; it just checks the .is() states and the data type
+ // of the sequence. What i need here is detection of equality of the whole
+ // sequence content, thus i need to use the arePrimitive2DSequencesEqual helper
+ // here instead of the operator== which lead to always returning false and thus
+ // always re-decompositions of the subcontent.
+ if(arePrimitive2DSequencesEqual(getOLEContent(), rCompare.getOLEContent())
+ && getTransform() == rCompare.getTransform()
+ && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute())
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ Primitive2DSequence SdrOle2Primitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const
+ {
+ // to take care of getSdrLFSTAttribute() later, the same as in SdrGrafPrimitive2D::create2DDecomposition
+ // should happen. For the moment we only need the OLE itself
+ // Added complete primitive preparation using getSdrLFSTAttribute() now. To not do stuff which is not needed now, it
+ // may be supressed by using a static bool. The paint version only supported text.
+ static bool bBehaveCompatibleToPaintVersion(true);
+ Primitive2DSequence aRetval;
+
+ // create unit outline polygon
+ const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon());
+
+ // add fill
+ if(!bBehaveCompatibleToPaintVersion
+ && !getSdrLFSTAttribute().getFill().isDefault())
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolyPolygonFillPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getFill(),
+ getSdrLFSTAttribute().getFillFloatTransGradient()));
+ }
+
+ // add line
+ // #i97981# condition was inverse to purpose. When being compatible to paint version,
+ // border needs to be suppressed
+ if(!bBehaveCompatibleToPaintVersion
+ && !getSdrLFSTAttribute().getLine().isDefault())
+ {
+ // if line width is given, polygon needs to be grown by half of it to make the
+ // outline to be outside of the bitmap
+ if(0.0 != getSdrLFSTAttribute().getLine().getWidth())
+ {
+ // decompose to get scale
+ basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ getTransform().decompose(aScale, aTranslate, fRotate, fShearX);
+
+ // create expanded range (add relative half line width to unit rectangle)
+ double fHalfLineWidth(getSdrLFSTAttribute().getLine().getWidth() * 0.5);
+ double fScaleX(0.0 != aScale.getX() ? fHalfLineWidth / fabs(aScale.getX()) : 1.0);
+ double fScaleY(0.0 != aScale.getY() ? fHalfLineWidth / fabs(aScale.getY()) : 1.0);
+ const basegfx::B2DRange aExpandedRange(-fScaleX, -fScaleY, 1.0 + fScaleX, 1.0 + fScaleY);
+ basegfx::B2DPolygon aExpandedUnitOutline(basegfx::tools::createPolygonFromRect(aExpandedRange));
+
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolygonLinePrimitive(
+ aExpandedUnitOutline,
+ getTransform(),
+ getSdrLFSTAttribute().getLine(),
+ attribute::SdrLineStartEndAttribute()));
+ }
+ else
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolygonLinePrimitive(
+ aUnitOutline,
+ getTransform(),
+ getSdrLFSTAttribute().getLine(),
+ attribute::SdrLineStartEndAttribute()));
+ }
+ }
+ else
+ {
+ // if initially no line is defined, create one for HitTest and BoundRect
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createHiddenGeometryPrimitives2D(
+ false,
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform()));
+ }
+
+ // add graphic content
+ appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, getOLEContent());
+
+ // add text, no need to supress to stay compatible since text was
+ // always supported by the old paints, too
+ if(!getSdrLFSTAttribute().getText().isDefault())
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createTextPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getText(),
+ getSdrLFSTAttribute().getLine(),
+ false,
+ false,
+ false));
+ }
+
+ // add shadow
+ if(!bBehaveCompatibleToPaintVersion
+ && !getSdrLFSTAttribute().getShadow().isDefault())
+ {
+ aRetval = createEmbeddedShadowPrimitive(
+ aRetval,
+ getSdrLFSTAttribute().getShadow());
+ }
+
+ return aRetval;
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(SdrOle2Primitive2D, PRIMITIVE2D_ID_SDROLE2PRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx
new file mode 100644
index 000000000000..70c1feda75a8
--- /dev/null
+++ b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx
@@ -0,0 +1,201 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svx.hxx"
+#include <svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx>
+#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
+#include <svx/svdoole2.hxx>
+#include <vcl/svapp.hxx>
+#include <drawinglayer/primitive2d/graphicprimitive2d.hxx>
+#include <svtools/colorcfg.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence SdrOleContentPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const
+ {
+ Primitive2DSequence aRetval;
+ const SdrOle2Obj* pSource = (mpSdrOle2Obj.is() ? static_cast< SdrOle2Obj* >(mpSdrOle2Obj.get()) : 0);
+ bool bScaleContent(false);
+ Graphic aGraphic;
+
+ if(pSource)
+ {
+ Graphic* pOLEGraphic = (getHighContrast())
+ ? pSource->getEmbeddedObjectRef().GetHCGraphic()
+ : pSource->GetGraphic();
+
+ if(pOLEGraphic)
+ {
+ aGraphic = *pOLEGraphic;
+ bScaleContent = pSource->IsEmptyPresObj();
+ }
+ }
+
+ if(GRAPHIC_NONE == aGraphic.GetType())
+ {
+ // no source, use fallback ressource emty OLE graphic
+ const Bitmap aEmptyOLEBitmap(SdrOle2Obj::GetEmtyOLEReplacementBitmap());
+ aGraphic = Graphic(aEmptyOLEBitmap);
+ bScaleContent = true;
+ }
+
+ if(GRAPHIC_NONE != aGraphic.GetType())
+ {
+ const GraphicObject aGraphicObject(aGraphic);
+ const GraphicAttr aGraphicAttr;
+ drawinglayer::primitive2d::Primitive2DSequence xOLEContent;
+
+ if(bScaleContent)
+ {
+ // get transformation atoms
+ basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ getObjectTransform().decompose(aScale, aTranslate, fRotate, fShearX);
+
+ // get PrefSize from the graphic in 100th mm
+ Size aPrefSize(aGraphic.GetPrefSize());
+
+ if(MAP_PIXEL == aGraphic.GetPrefMapMode().GetMapUnit())
+ {
+ aPrefSize = Application::GetDefaultDevice()->PixelToLogic(aPrefSize, MAP_100TH_MM);
+ }
+ else
+ {
+ aPrefSize = Application::GetDefaultDevice()->LogicToLogic(aPrefSize, aGraphic.GetPrefMapMode(), MAP_100TH_MM);
+ }
+
+ 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))
+ {
+ // if content fits into frame, create it
+ basegfx::B2DHomMatrix aInnerObjectMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix(
+ aPrefSize.getWidth(), aPrefSize.getHeight(), fOffsetX, fOffsetY));
+ aInnerObjectMatrix = basegfx::tools::createShearXRotateTranslateB2DHomMatrix(fShearX, fRotate, aTranslate)
+ * aInnerObjectMatrix;
+
+ const drawinglayer::primitive2d::Primitive2DReference aGraphicPrimitive(
+ new drawinglayer::primitive2d::GraphicPrimitive2D(
+ aInnerObjectMatrix,
+ aGraphicObject,
+ aGraphicAttr));
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aGraphicPrimitive);
+ }
+ }
+ else
+ {
+ // create graphic primitive for content
+ const drawinglayer::primitive2d::Primitive2DReference aGraphicPrimitive(
+ new drawinglayer::primitive2d::GraphicPrimitive2D(
+ getObjectTransform(),
+ aGraphicObject,
+ aGraphicAttr));
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aGraphicPrimitive);
+ }
+
+ // a standard gray outline is created for scaled content
+ if(bScaleContent)
+ {
+ const svtools::ColorConfig aColorConfig;
+ const svtools::ColorConfigValue aColor(aColorConfig.GetColorValue(svtools::OBJECTBOUNDARIES));
+
+ if(aColor.bIsVisible)
+ {
+ basegfx::B2DPolygon aOutline(basegfx::tools::createUnitPolygon());
+ const Color aVclColor(aColor.nColor);
+ aOutline.transform(getObjectTransform());
+ const drawinglayer::primitive2d::Primitive2DReference xOutline(
+ new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aVclColor.getBColor()));
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, xOutline);
+ }
+ }
+ }
+
+ // get graphic and check scale content state
+ return aRetval;
+ }
+
+ SdrOleContentPrimitive2D::SdrOleContentPrimitive2D(
+ const SdrOle2Obj& rSdrOle2Obj,
+ const basegfx::B2DHomMatrix& rObjectTransform,
+ sal_uInt32 nGraphicVersion,
+ bool bHighContrast)
+ : BufferedDecompositionPrimitive2D(),
+ mpSdrOle2Obj(const_cast< SdrOle2Obj* >(&rSdrOle2Obj)),
+ maObjectTransform(rObjectTransform),
+ mnGraphicVersion(nGraphicVersion),
+ mbHighContrast(bHighContrast)
+ {
+ }
+
+ bool SdrOleContentPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+ {
+ const SdrOleContentPrimitive2D& rCompare = (SdrOleContentPrimitive2D&)rPrimitive;
+ const bool bBothNot(!mpSdrOle2Obj.is() && !rCompare.mpSdrOle2Obj.is());
+ const bool bBothAndEqual(mpSdrOle2Obj.is() && rCompare.mpSdrOle2Obj.is()
+ && mpSdrOle2Obj.get() == rCompare.mpSdrOle2Obj.get());
+
+ return ((bBothNot || bBothAndEqual)
+ && getObjectTransform() == rCompare.getObjectTransform()
+
+ // #i104867# to find out if the Graphic content of the
+ // OLE has changed, use GraphicVersion number
+ && getGraphicVersion() == rCompare.getGraphicVersion()
+
+ && getHighContrast() == rCompare.getHighContrast());
+ }
+
+ return false;
+ }
+
+ basegfx::B2DRange SdrOleContentPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ {
+ basegfx::B2DRange aRange(0.0, 0.0, 1.0, 1.0);
+ aRange.transform(getObjectTransform());
+
+ return aRange;
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(SdrOleContentPrimitive2D, PRIMITIVE2D_ID_SDROLECONTENTPRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx
new file mode 100644
index 000000000000..2ceea2c69b7d
--- /dev/null
+++ b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svx.hxx"
+#include <svx/sdr/primitive2d/sdrpathprimitive2d.hxx>
+#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence SdrPathPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const
+ {
+ Primitive2DSequence aRetval;
+
+ // add fill
+ if(!getSdrLFSTAttribute().getFill().isDefault()
+ && getUnitPolyPolygon().isClosed())
+ {
+ // #i108255# no need to use correctOrientations here; target is
+ // straight visualisation
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolyPolygonFillPrimitive(
+ getUnitPolyPolygon(),
+ getTransform(),
+ getSdrLFSTAttribute().getFill(),
+ getSdrLFSTAttribute().getFillFloatTransGradient()));
+ }
+
+ // add line
+ if(getSdrLFSTAttribute().getLine().isDefault())
+ {
+ // if initially no line is defined, create one for HitTest and BoundRect
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createHiddenGeometryPrimitives2D(
+ false,
+ getUnitPolyPolygon(),
+ getTransform()));
+ }
+ else
+ {
+ Primitive2DSequence aTemp(getUnitPolyPolygon().count());
+
+ for(sal_uInt32 a(0); a < getUnitPolyPolygon().count(); a++)
+ {
+ aTemp[a] = createPolygonLinePrimitive(
+ getUnitPolyPolygon().getB2DPolygon(a),
+ getTransform(),
+ getSdrLFSTAttribute().getLine(),
+ getSdrLFSTAttribute().getLineStartEnd());
+ }
+
+ appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, aTemp);
+ }
+
+ // add text
+ if(!getSdrLFSTAttribute().getText().isDefault())
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createTextPrimitive(
+ getUnitPolyPolygon(),
+ getTransform(),
+ getSdrLFSTAttribute().getText(),
+ getSdrLFSTAttribute().getLine(),
+ false,
+ false,
+ false));
+ }
+
+ // add shadow
+ if(!getSdrLFSTAttribute().getShadow().isDefault())
+ {
+ aRetval = createEmbeddedShadowPrimitive(
+ aRetval,
+ getSdrLFSTAttribute().getShadow());
+ }
+
+ return aRetval;
+ }
+
+ SdrPathPrimitive2D::SdrPathPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute,
+ const basegfx::B2DPolyPolygon& rUnitPolyPolygon)
+ : BufferedDecompositionPrimitive2D(),
+ maTransform(rTransform),
+ maSdrLFSTAttribute(rSdrLFSTAttribute),
+ maUnitPolyPolygon(rUnitPolyPolygon)
+ {
+ }
+
+ bool SdrPathPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+ {
+ const SdrPathPrimitive2D& rCompare = (SdrPathPrimitive2D&)rPrimitive;
+
+ return (getUnitPolyPolygon() == rCompare.getUnitPolyPolygon()
+ && getTransform() == rCompare.getTransform()
+ && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute());
+ }
+
+ return false;
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(SdrPathPrimitive2D, PRIMITIVE2D_ID_SDRPATHPRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx
new file mode 100644
index 000000000000..8f188e9fcf6f
--- /dev/null
+++ b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx
@@ -0,0 +1,176 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svx.hxx"
+#include <svx/sdr/primitive2d/sdrprimitivetools.hxx>
+#include <vcl/bmpacc.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/lazydelete.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// helper methods
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ BitmapEx createDefaultCross_3x3(const basegfx::BColor& rBColor)
+ {
+ static vcl::DeleteOnDeinit< BitmapEx > aRetVal(0);
+ static basegfx::BColor aColor;
+ ::osl::Mutex m_mutex;
+
+ if(!aRetVal.get() || rBColor != aColor)
+ {
+ // copy values
+ aColor = rBColor;
+
+ // create bitmap
+ Bitmap aContent(Size(3, 3), 24);
+ Bitmap aMask(Size(3, 3), 1);
+ BitmapWriteAccess* pWContent = aContent.AcquireWriteAccess();
+ BitmapWriteAccess* pWMask = aMask.AcquireWriteAccess();
+ OSL_ENSURE(pWContent && pWMask, "No WriteAccess to bitmap (!)");
+ const Color aVCLColor(aColor);
+ const BitmapColor aPixColor(aVCLColor);
+ const BitmapColor aMaskColor(0x01);
+
+ // Y,X unusual order (!)
+ pWContent->SetPixel(0, 1, aPixColor);
+ pWContent->SetPixel(1, 0, aPixColor);
+ pWContent->SetPixel(1, 1, aPixColor);
+ pWContent->SetPixel(1, 2, aPixColor);
+ pWContent->SetPixel(2, 1, aPixColor);
+
+ pWMask->SetPixel(0, 0, aMaskColor);
+ pWMask->SetPixel(0, 2, aMaskColor);
+ pWMask->SetPixel(2, 0, aMaskColor);
+ pWMask->SetPixel(2, 2, aMaskColor);
+
+ aContent.ReleaseAccess(pWContent);
+ aMask.ReleaseAccess(pWMask);
+
+ // create and exchange at aRetVal
+ delete aRetVal.set(new BitmapEx(aContent, aMask));
+ }
+
+ return aRetVal.get() ? *aRetVal.get() : BitmapEx();
+ }
+
+ BitmapEx createDefaultGluepoint_7x7(const basegfx::BColor& rBColorA, const basegfx::BColor& rBColorB)
+ {
+ static vcl::DeleteOnDeinit< BitmapEx > aRetVal(0);
+ static basegfx::BColor aColorA;
+ static basegfx::BColor aColorB;
+ ::osl::Mutex m_mutex;
+
+ if(!aRetVal.get() || rBColorA != aColorA || rBColorB != aColorB)
+ {
+ // copy values
+ aColorA = rBColorA;
+ aColorB = rBColorB;
+
+ // create bitmap
+ Bitmap aContent(Size(7, 7), 24);
+ Bitmap aMask(Size(7, 7), 1);
+ BitmapWriteAccess* pWContent = aContent.AcquireWriteAccess();
+ BitmapWriteAccess* pWMask = aMask.AcquireWriteAccess();
+ OSL_ENSURE(pWContent && pWMask, "No WriteAccess to bitmap (!)");
+ const Color aColA(aColorA);
+ const Color aColB(aColorB);
+ const BitmapColor aPixColorA(aColA);
+ const BitmapColor aPixColorB(aColB);
+ const BitmapColor aMaskColor(0x01);
+
+ // Y,X unusual order (!)
+ pWContent->SetPixel(0, 1, aPixColorA);
+ pWContent->SetPixel(0, 5, aPixColorA);
+ pWContent->SetPixel(1, 0, aPixColorA);
+ pWContent->SetPixel(1, 2, aPixColorA);
+ pWContent->SetPixel(1, 4, aPixColorA);
+ pWContent->SetPixel(1, 6, aPixColorA);
+ pWContent->SetPixel(2, 1, aPixColorA);
+ pWContent->SetPixel(2, 3, aPixColorA);
+ pWContent->SetPixel(2, 5, aPixColorA);
+ pWContent->SetPixel(3, 2, aPixColorA);
+ pWContent->SetPixel(3, 4, aPixColorA);
+ pWContent->SetPixel(4, 1, aPixColorA);
+ pWContent->SetPixel(4, 3, aPixColorA);
+ pWContent->SetPixel(4, 5, aPixColorA);
+ pWContent->SetPixel(5, 0, aPixColorA);
+ pWContent->SetPixel(5, 2, aPixColorA);
+ pWContent->SetPixel(5, 4, aPixColorA);
+ pWContent->SetPixel(5, 6, aPixColorA);
+ pWContent->SetPixel(6, 1, aPixColorA);
+ pWContent->SetPixel(6, 5, aPixColorA);
+
+ pWContent->SetPixel(1, 1, aPixColorB);
+ pWContent->SetPixel(1, 5, aPixColorB);
+ pWContent->SetPixel(2, 2, aPixColorB);
+ pWContent->SetPixel(2, 4, aPixColorB);
+ pWContent->SetPixel(3, 3, aPixColorB);
+ pWContent->SetPixel(4, 2, aPixColorB);
+ pWContent->SetPixel(4, 4, aPixColorB);
+ pWContent->SetPixel(5, 1, aPixColorB);
+ pWContent->SetPixel(5, 5, aPixColorB);
+
+ pWMask->SetPixel(0, 0, aMaskColor);
+ pWMask->SetPixel(0, 2, aMaskColor);
+ pWMask->SetPixel(0, 3, aMaskColor);
+ pWMask->SetPixel(0, 4, aMaskColor);
+ pWMask->SetPixel(0, 6, aMaskColor);
+ pWMask->SetPixel(1, 3, aMaskColor);
+ pWMask->SetPixel(2, 0, aMaskColor);
+ pWMask->SetPixel(2, 6, aMaskColor);
+ pWMask->SetPixel(3, 0, aMaskColor);
+ pWMask->SetPixel(3, 1, aMaskColor);
+ pWMask->SetPixel(3, 5, aMaskColor);
+ pWMask->SetPixel(3, 6, aMaskColor);
+ pWMask->SetPixel(4, 0, aMaskColor);
+ pWMask->SetPixel(4, 6, aMaskColor);
+ pWMask->SetPixel(5, 3, aMaskColor);
+ pWMask->SetPixel(6, 0, aMaskColor);
+ pWMask->SetPixel(6, 2, aMaskColor);
+ pWMask->SetPixel(6, 3, aMaskColor);
+ pWMask->SetPixel(6, 4, aMaskColor);
+ pWMask->SetPixel(6, 6, aMaskColor);
+
+ aContent.ReleaseAccess(pWContent);
+ aMask.ReleaseAccess(pWMask);
+
+ // create and exchange at aRetVal
+ delete aRetVal.set(new BitmapEx(aContent, aMask));
+ }
+
+ return aRetVal.get() ? *aRetVal.get() : BitmapEx();
+ }
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx
new file mode 100644
index 000000000000..60b8ca1c7817
--- /dev/null
+++ b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svx.hxx"
+#include <svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence SdrRectanglePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const
+ {
+ Primitive2DSequence aRetval;
+
+ // create unit outline polygon
+ const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(
+ basegfx::B2DRange(0.0, 0.0, 1.0, 1.0),
+ getCornerRadiusX(),
+ getCornerRadiusY()));
+
+ // add fill
+ if(!getSdrLFSTAttribute().getFill().isDefault())
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolyPolygonFillPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getFill(),
+ getSdrLFSTAttribute().getFillFloatTransGradient()));
+ }
+ else if(getForceFillForHitTest())
+ {
+ // if no fill and it's a text frame, create a fill for HitTest and
+ // BoundRect fallback
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createHiddenGeometryPrimitives2D(
+ true,
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform()));
+ }
+
+ // add line
+ if(!getSdrLFSTAttribute().getLine().isDefault())
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolygonLinePrimitive(
+ aUnitOutline,
+ getTransform(),
+ getSdrLFSTAttribute().getLine(),
+ attribute::SdrLineStartEndAttribute()));
+ }
+ else if(!getForceFillForHitTest())
+ {
+ // if initially no line is defined and it's not a text frame, create
+ // a line for HitTest and BoundRect
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createHiddenGeometryPrimitives2D(
+ false,
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform()));
+ }
+
+ // add text
+ if(!getSdrLFSTAttribute().getText().isDefault())
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createTextPrimitive(
+ basegfx::B2DPolyPolygon(aUnitOutline),
+ getTransform(),
+ getSdrLFSTAttribute().getText(),
+ getSdrLFSTAttribute().getLine(),
+ false,
+ false,
+ false));
+ }
+
+ // add shadow
+ if(!getSdrLFSTAttribute().getShadow().isDefault())
+ {
+ aRetval = createEmbeddedShadowPrimitive(
+ aRetval,
+ getSdrLFSTAttribute().getShadow());
+ }
+
+ return aRetval;
+ }
+
+ SdrRectanglePrimitive2D::SdrRectanglePrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute,
+ double fCornerRadiusX,
+ double fCornerRadiusY,
+ bool bForceFillForHitTest)
+ : BufferedDecompositionPrimitive2D(),
+ maTransform(rTransform),
+ maSdrLFSTAttribute(rSdrLFSTAttribute),
+ mfCornerRadiusX(fCornerRadiusX),
+ mfCornerRadiusY(fCornerRadiusY),
+ mbForceFillForHitTest(bForceFillForHitTest)
+ {
+ }
+
+ bool SdrRectanglePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+ {
+ const SdrRectanglePrimitive2D& rCompare = (SdrRectanglePrimitive2D&)rPrimitive;
+
+ return (getCornerRadiusX() == rCompare.getCornerRadiusX()
+ && getCornerRadiusY() == rCompare.getCornerRadiusY()
+ && getTransform() == rCompare.getTransform()
+ && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute()
+ && getForceFillForHitTest() == rCompare.getForceFillForHitTest());
+ }
+
+ return false;
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(SdrRectanglePrimitive2D, PRIMITIVE2D_ID_SDRRECTANGLEPRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
new file mode 100644
index 000000000000..cf34f3345e0a
--- /dev/null
+++ b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
@@ -0,0 +1,497 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_svx.hxx"
+#include <svx/sdr/primitive2d/sdrtextprimitive2d.hxx>
+#include <svx/svdotext.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/texthierarchyprimitive2d.hxx>
+#include <editeng/outlobj.hxx>
+#include <editeng/editobj.hxx>
+#include <editeng/flditem.hxx>
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+#include <svx/unoapi.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdoutl.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+//////////////////////////////////////////////////////////////////////////////
+
+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())
+ {
+ if( (pPage->GetPageNum() == 0) && !pPage->IsMasterPage() )
+ {
+ // handout page!
+ return pPage->GetModel()->getHandoutPageCount();
+ }
+ else
+ {
+ const sal_uInt16 nPageCount(pPage->GetModel()->GetPageCount());
+ nRetval = ((sal_Int16)nPageCount - 1) / 2;
+ }
+ }
+
+ return nRetval;
+ }
+} // end of anonymous namespace
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ // support for XTEXT_PAINTSHAPE_BEGIN/XTEXT_PAINTSHAPE_END Metafile comments
+ // for slideshow. This uses TextHierarchyBlockPrimitive2D to mark a text block.
+ // ATM there is only one text block per SdrObject, this may get more in the future
+ Primitive2DSequence SdrTextPrimitive2D::encapsulateWithTextHierarchyBlockPrimitive2D(const Primitive2DSequence& rCandidate) const
+ {
+ Primitive2DReference xReference(new TextHierarchyBlockPrimitive2D(rCandidate));
+ Primitive2DSequence xRetval(&xReference, 1);
+
+ return xRetval;
+ }
+
+ SdrTextPrimitive2D::SdrTextPrimitive2D(
+ const SdrText* pSdrText,
+ const OutlinerParaObject& rOutlinerParaObject)
+ : BufferedDecompositionPrimitive2D(),
+ mrSdrText(const_cast< SdrText* >(pSdrText)),
+ maOutlinerParaObject(rOutlinerParaObject),
+ mxLastVisualizingPage(),
+ mnLastPageNumber(0),
+ mnLastPageCount(0),
+ maLastTextBackgroundColor(),
+ mbContainsPageField(false),
+ mbContainsPageCountField(false),
+ mbContainsOtherFields(false)
+ {
+ const EditTextObject& rETO = maOutlinerParaObject.GetTextObject();
+
+ 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
+ {
+ if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+ {
+ const SdrTextPrimitive2D& rCompare = (SdrTextPrimitive2D&)rPrimitive;
+
+ return (
+
+ // compare OPO and content, but not WrongList
+ getOutlinerParaObject() == rCompare.getOutlinerParaObject()
+
+ // also compare WrongList (not-persistent data, but visualized)
+ && getOutlinerParaObject().isWrongListEqual(rCompare.getOutlinerParaObject()));
+ }
+
+ return false;
+ }
+
+ Primitive2DSequence SdrTextPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const
+ {
+ uno::Reference< drawing::XDrawPage > xCurrentlyVisualizingPage;
+ bool bCurrentlyVisualizingPageIsSet(false);
+ Color aNewTextBackgroundColor;
+ bool bNewTextBackgroundColorIsSet(false);
+ sal_Int16 nCurrentlyValidPageNumber(0);
+ sal_Int16 nCurrentlyValidPageCount(0);
+
+ if(getBuffered2DDecomposition().hasElements())
+ {
+ bool bDoDelete(false);
+
+ // check visualized page
+ if(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)
+ {
+ const_cast< SdrTextPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence());
+ }
+ }
+
+ if(!getBuffered2DDecomposition().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)->mxLastVisualizingPage = xCurrentlyVisualizingPage;
+ const_cast< SdrTextPrimitive2D* >(this)->mnLastPageNumber = nCurrentlyValidPageNumber;
+ const_cast< SdrTextPrimitive2D* >(this)->mnLastPageCount = nCurrentlyValidPageCount;
+ const_cast< SdrTextPrimitive2D* >(this)->maLastTextBackgroundColor = aNewTextBackgroundColor;
+ }
+
+ // call parent
+ return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation);
+ }
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence SdrContourTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const
+ {
+ Primitive2DSequence aRetval;
+ getSdrText()->GetObject().impDecomposeContourTextPrimitive(aRetval, *this, aViewInformation);
+
+ return encapsulateWithTextHierarchyBlockPrimitive2D(aRetval);
+ }
+
+ SdrContourTextPrimitive2D::SdrContourTextPrimitive2D(
+ const SdrText* pSdrText,
+ const OutlinerParaObject& rOutlinerParaObject,
+ const basegfx::B2DPolyPolygon& rUnitPolyPolygon,
+ const basegfx::B2DHomMatrix& rObjectTransform)
+ : SdrTextPrimitive2D(pSdrText, rOutlinerParaObject),
+ maUnitPolyPolygon(rUnitPolyPolygon),
+ maObjectTransform(rObjectTransform)
+ {
+ }
+
+ bool SdrContourTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(SdrTextPrimitive2D::operator==(rPrimitive))
+ {
+ const SdrContourTextPrimitive2D& rCompare = (SdrContourTextPrimitive2D&)rPrimitive;
+
+ return (getUnitPolyPolygon() == rCompare.getUnitPolyPolygon()
+ && getObjectTransform() == rCompare.getObjectTransform());
+ }
+
+ return false;
+ }
+
+ SdrTextPrimitive2D* SdrContourTextPrimitive2D::createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const
+ {
+ return new SdrContourTextPrimitive2D(
+ getSdrText(),
+ getOutlinerParaObject(),
+ getUnitPolyPolygon(),
+ rTransform * getObjectTransform());
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(SdrContourTextPrimitive2D, PRIMITIVE2D_ID_SDRCONTOURTEXTPRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence SdrPathTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const
+ {
+ Primitive2DSequence aRetval;
+ getSdrText()->GetObject().impDecomposePathTextPrimitive(aRetval, *this, aViewInformation);
+
+ return encapsulateWithTextHierarchyBlockPrimitive2D(aRetval);
+ }
+
+ SdrPathTextPrimitive2D::SdrPathTextPrimitive2D(
+ const SdrText* pSdrText,
+ const OutlinerParaObject& rOutlinerParaObject,
+ const basegfx::B2DPolyPolygon& rPathPolyPolygon,
+ const attribute::SdrFormTextAttribute& rSdrFormTextAttribute)
+ : SdrTextPrimitive2D(pSdrText, rOutlinerParaObject),
+ maPathPolyPolygon(rPathPolyPolygon),
+ maSdrFormTextAttribute(rSdrFormTextAttribute)
+ {
+ }
+
+ bool SdrPathTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(SdrTextPrimitive2D::operator==(rPrimitive))
+ {
+ const SdrPathTextPrimitive2D& rCompare = (SdrPathTextPrimitive2D&)rPrimitive;
+
+ return (getPathPolyPolygon() == rCompare.getPathPolyPolygon()
+ && getSdrFormTextAttribute() == rCompare.getSdrFormTextAttribute());
+ }
+
+ return false;
+ }
+
+ SdrTextPrimitive2D* SdrPathTextPrimitive2D::createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const
+ {
+ basegfx::B2DPolyPolygon aNewPolyPolygon(getPathPolyPolygon());
+ aNewPolyPolygon.transform(rTransform);
+
+ return new SdrPathTextPrimitive2D(
+ getSdrText(),
+ getOutlinerParaObject(),
+ aNewPolyPolygon,
+ getSdrFormTextAttribute());
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(SdrPathTextPrimitive2D, PRIMITIVE2D_ID_SDRPATHTEXTPRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence SdrBlockTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const
+ {
+ Primitive2DSequence aRetval;
+ getSdrText()->GetObject().impDecomposeBlockTextPrimitive(aRetval, *this, aViewInformation);
+
+ return encapsulateWithTextHierarchyBlockPrimitive2D(aRetval);
+ }
+
+ SdrBlockTextPrimitive2D::SdrBlockTextPrimitive2D(
+ const SdrText* pSdrText,
+ const OutlinerParaObject& rOutlinerParaObject,
+ const basegfx::B2DHomMatrix& rTextRangeTransform,
+ SdrTextHorzAdjust aSdrTextHorzAdjust,
+ SdrTextVertAdjust aSdrTextVertAdjust,
+ bool bFixedCellHeight,
+ bool bUnlimitedPage,
+ bool bCellText,
+ bool bWordWrap,
+ bool bClipOnBounds)
+ : SdrTextPrimitive2D(pSdrText, rOutlinerParaObject),
+ maTextRangeTransform(rTextRangeTransform),
+ maSdrTextHorzAdjust(aSdrTextHorzAdjust),
+ maSdrTextVertAdjust(aSdrTextVertAdjust),
+ mbFixedCellHeight(bFixedCellHeight),
+ mbUnlimitedPage(bUnlimitedPage),
+ mbCellText(bCellText),
+ mbWordWrap(bWordWrap),
+ mbClipOnBounds(bClipOnBounds)
+ {
+ }
+
+ bool SdrBlockTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(SdrTextPrimitive2D::operator==(rPrimitive))
+ {
+ const SdrBlockTextPrimitive2D& rCompare = (SdrBlockTextPrimitive2D&)rPrimitive;
+
+ return (getTextRangeTransform() == rCompare.getTextRangeTransform()
+ && getSdrTextHorzAdjust() == rCompare.getSdrTextHorzAdjust()
+ && getSdrTextVertAdjust() == rCompare.getSdrTextVertAdjust()
+ && isFixedCellHeight() == rCompare.isFixedCellHeight()
+ && getUnlimitedPage() == rCompare.getUnlimitedPage()
+ && getCellText() == rCompare.getCellText()
+ && getWordWrap() == rCompare.getWordWrap()
+ && getClipOnBounds() == rCompare.getClipOnBounds());
+ }
+
+ return false;
+ }
+
+ SdrTextPrimitive2D* SdrBlockTextPrimitive2D::createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const
+ {
+ return new SdrBlockTextPrimitive2D(
+ getSdrText(),
+ getOutlinerParaObject(),
+ rTransform * getTextRangeTransform(),
+ getSdrTextHorzAdjust(),
+ getSdrTextVertAdjust(),
+ isFixedCellHeight(),
+ getUnlimitedPage(),
+ getCellText(),
+ getWordWrap(),
+ getClipOnBounds());
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(SdrBlockTextPrimitive2D, PRIMITIVE2D_ID_SDRBLOCKTEXTPRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ Primitive2DSequence SdrStretchTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const
+ {
+ Primitive2DSequence aRetval;
+ getSdrText()->GetObject().impDecomposeStretchTextPrimitive(aRetval, *this, aViewInformation);
+
+ return encapsulateWithTextHierarchyBlockPrimitive2D(aRetval);
+ }
+
+ SdrStretchTextPrimitive2D::SdrStretchTextPrimitive2D(
+ const SdrText* pSdrText,
+ const OutlinerParaObject& rOutlinerParaObject,
+ const basegfx::B2DHomMatrix& rTextRangeTransform,
+ bool bFixedCellHeight)
+ : SdrTextPrimitive2D(pSdrText, rOutlinerParaObject),
+ maTextRangeTransform(rTextRangeTransform),
+ mbFixedCellHeight(bFixedCellHeight)
+ {
+ }
+
+ bool SdrStretchTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(SdrTextPrimitive2D::operator==(rPrimitive))
+ {
+ const SdrStretchTextPrimitive2D& rCompare = (SdrStretchTextPrimitive2D&)rPrimitive;
+
+ return (getTextRangeTransform() == rCompare.getTextRangeTransform()
+ && isFixedCellHeight() == rCompare.isFixedCellHeight());
+ }
+
+ return false;
+ }
+
+ SdrTextPrimitive2D* SdrStretchTextPrimitive2D::createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const
+ {
+ return new SdrStretchTextPrimitive2D(
+ getSdrText(),
+ getOutlinerParaObject(),
+ rTransform * getTextRangeTransform(),
+ isFixedCellHeight());
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(SdrStretchTextPrimitive2D, PRIMITIVE2D_ID_SDRSTRETCHTEXTPRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx b/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx
new file mode 100644
index 000000000000..3a15c3a392d9
--- /dev/null
+++ b/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx
@@ -0,0 +1,158 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svx/sdr/primitive3d/sdrattributecreator3d.hxx>
+#include <svx/svx3ditems.hxx>
+#include <svl/itemset.hxx>
+#include <com/sun/star/drawing/NormalsKind.hpp>
+#include <com/sun/star/drawing/TextureProjectionMode.hpp>
+#include <com/sun/star/drawing/TextureKind2.hpp>
+#include <com/sun/star/drawing/TextureMode.hpp>
+#include <svx/xflclit.hxx>
+#include <drawinglayer/attribute/materialattribute3d.hxx>
+#include <drawinglayer/attribute/sdrobjectattribute3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ attribute::Sdr3DObjectAttribute* createNewSdr3DObjectAttribute(const SfxItemSet& rSet)
+ {
+ // get NormalsKind
+ ::com::sun::star::drawing::NormalsKind aNormalsKind(::com::sun::star::drawing::NormalsKind_SPECIFIC);
+ const sal_uInt16 nNormalsValue(((const Svx3DNormalsKindItem&)rSet.Get(SDRATTR_3DOBJ_NORMALS_KIND)).GetValue());
+
+ if(1L == nNormalsValue)
+ {
+ aNormalsKind = ::com::sun::star::drawing::NormalsKind_FLAT;
+ }
+ else if(2L == nNormalsValue)
+ {
+ aNormalsKind = ::com::sun::star::drawing::NormalsKind_SPHERE;
+ }
+
+ // get NoermalsInvert flag
+ const bool bInvertNormals(((const Svx3DNormalsInvertItem&)rSet.Get(SDRATTR_3DOBJ_NORMALS_INVERT)).GetValue());
+
+ // get TextureProjectionX
+ ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionX(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC);
+ const sal_uInt16 nTextureValueX(((const Svx3DTextureProjectionXItem&)rSet.Get(SDRATTR_3DOBJ_TEXTURE_PROJ_X)).GetValue());
+
+ if(1L == nTextureValueX)
+ {
+ aTextureProjectionX = ::com::sun::star::drawing::TextureProjectionMode_PARALLEL;
+ }
+ else if(2L == nTextureValueX)
+ {
+ aTextureProjectionX = ::com::sun::star::drawing::TextureProjectionMode_SPHERE;
+ }
+
+ // get TextureProjectionY
+ ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionY(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC);
+ const sal_uInt16 nTextureValueY(((const Svx3DTextureProjectionYItem&)rSet.Get(SDRATTR_3DOBJ_TEXTURE_PROJ_Y)).GetValue());
+
+ if(1L == nTextureValueY)
+ {
+ aTextureProjectionY = ::com::sun::star::drawing::TextureProjectionMode_PARALLEL;
+ }
+ else if(2L == nTextureValueY)
+ {
+ aTextureProjectionY = ::com::sun::star::drawing::TextureProjectionMode_SPHERE;
+ }
+
+ // get DoubleSided flag
+ const bool bDoubleSided(((const Svx3DDoubleSidedItem&)rSet.Get(SDRATTR_3DOBJ_DOUBLE_SIDED)).GetValue());
+
+ // get Shadow3D flag
+ const bool bShadow3D(((const Svx3DShadow3DItem&)rSet.Get(SDRATTR_3DOBJ_SHADOW_3D)).GetValue());
+
+ // get TextureFilter flag
+ const bool bTextureFilter(((const Svx3DTextureFilterItem&)rSet.Get(SDRATTR_3DOBJ_TEXTURE_FILTER)).GetValue());
+
+ // get texture kind
+ // TextureKind: 1 == Base3DTextureLuminance, 2 == Base3DTextureIntensity, 3 == Base3DTextureColor
+ ::com::sun::star::drawing::TextureKind2 aTextureKind(::com::sun::star::drawing::TextureKind2_LUMINANCE);
+ const sal_uInt16 nTextureKind(((const Svx3DTextureKindItem&)rSet.Get(SDRATTR_3DOBJ_TEXTURE_KIND)).GetValue());
+
+ if(2 == nTextureKind)
+ {
+ aTextureKind = ::com::sun::star::drawing::TextureKind2_INTENSITY;
+ }
+ else if(3 == nTextureKind)
+ {
+ aTextureKind = ::com::sun::star::drawing::TextureKind2_COLOR;
+ }
+
+ // get texture mode
+ // TextureMode: 1 == Base3DTextureReplace, 2 == Base3DTextureModulate, 3 == Base3DTextureBlend
+ ::com::sun::star::drawing::TextureMode aTextureMode(::com::sun::star::drawing::TextureMode_REPLACE);
+ const sal_uInt16 nTextureMode(((const Svx3DTextureModeItem&)rSet.Get(SDRATTR_3DOBJ_TEXTURE_MODE)).GetValue());
+
+ if(2 == nTextureMode)
+ {
+ aTextureMode = ::com::sun::star::drawing::TextureMode_MODULATE;
+ }
+ else if(3 == nTextureMode)
+ {
+ aTextureMode = ::com::sun::star::drawing::TextureMode_BLEND;
+ }
+
+ // get object color
+ const ::basegfx::BColor aObjectColor(((const XFillColorItem&)rSet.Get(XATTR_FILLCOLOR)).GetColorValue().getBColor());
+
+ // get specular color
+ const ::basegfx::BColor aSpecular(((const Svx3DMaterialSpecularItem&)rSet.Get(SDRATTR_3DOBJ_MAT_SPECULAR)).GetValue().getBColor());
+
+ // get emissive color
+ const ::basegfx::BColor aEmission(((const Svx3DMaterialEmissionItem&)rSet.Get(SDRATTR_3DOBJ_MAT_EMISSION)).GetValue().getBColor());
+
+ // get specular intensity
+ sal_uInt16 nSpecularIntensity(((const Svx3DMaterialSpecularIntensityItem&)rSet.Get(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY)).GetValue());
+
+ if(nSpecularIntensity > 128)
+ {
+ nSpecularIntensity = 128;
+ }
+
+ // get reduced line geometry
+ const bool bReducedLineGeometry(((const Svx3DReducedLineGeometryItem&)rSet.Get(SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY)).GetValue());
+
+ // prepare material
+ attribute::MaterialAttribute3D aMaterial(aObjectColor, aSpecular, aEmission, nSpecularIntensity);
+
+ return new attribute::Sdr3DObjectAttribute(
+ aNormalsKind, aTextureProjectionX, aTextureProjectionY,
+ aTextureKind, aTextureMode, aMaterial,
+ bInvertNormals, bDoubleSided, bShadow3D, bTextureFilter, bReducedLineGeometry);
+ }
+ } // end of namespace primitive2d
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx
new file mode 100644
index 000000000000..39b78849ad7e
--- /dev/null
+++ b/svx/source/sdr/properties/attributeproperties.cxx
@@ -0,0 +1,628 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/attributeproperties.hxx>
+#include <svx/sdr/properties/itemsettools.hxx>
+#include <tools/debug.hxx>
+#include <svl/itemset.hxx>
+#include <svl/style.hxx>
+#include <svl/whiter.hxx>
+#include <svl/poolitem.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svddef.hxx>
+#include <svx/xit.hxx>
+#include <svx/xbtmpit.hxx>
+#include <svx/xlndsit.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/xlnedit.hxx>
+#include <svx/xflgrit.hxx>
+#include <svx/xflftrit.hxx>
+#include <svx/xflhtit.hxx>
+#include <svx/xlnasit.hxx>
+#include <svx/xflasit.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdtrans.hxx>
+#include <svx/svdpage.hxx>
+
+// #114265#
+#include <svl/smplhint.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ void AttributeProperties::ImpAddStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ // test if old StyleSheet is cleared, else it would be lost
+ // after this method -> memory leak (!)
+ DBG_ASSERT(!mpStyleSheet, "Old style sheet not deleted before setting new one (!)");
+
+ if(pNewStyleSheet)
+ {
+ mpStyleSheet = pNewStyleSheet;
+
+ // local ItemSet is needed here, force it
+ GetObjectItemSet();
+
+ // register as listener
+ StartListening(pNewStyleSheet->GetPool());
+ StartListening(*pNewStyleSheet);
+
+ // Delete hard attributes where items are set in the style sheet
+ if(!bDontRemoveHardAttr)
+ {
+ const SfxItemSet& rStyle = pNewStyleSheet->GetItemSet();
+ SfxWhichIter aIter(rStyle);
+ sal_uInt16 nWhich = aIter.FirstWhich();
+
+ while(nWhich)
+ {
+ if(SFX_ITEM_SET == rStyle.GetItemState(nWhich))
+ {
+ mpItemSet->ClearItem(nWhich);
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+ }
+
+ // set new stylesheet as parent
+ mpItemSet->SetParent(&pNewStyleSheet->GetItemSet());
+ }
+ }
+
+ void AttributeProperties::ImpRemoveStyleSheet()
+ {
+ // Check type since it is destroyed when the type is deleted
+ if(GetStyleSheet() && HAS_BASE(SfxStyleSheet, mpStyleSheet))
+ {
+ EndListening(*mpStyleSheet);
+ EndListening(mpStyleSheet->GetPool());
+
+ // reset parent of ItemSet
+ if(mpItemSet)
+ {
+ mpItemSet->SetParent(0L);
+ }
+
+ SdrObject& rObj = GetSdrObject();
+ rObj.SetBoundRectDirty();
+ rObj.SetRectsDirty(sal_True);
+ }
+
+ mpStyleSheet = 0L;
+ }
+
+ // create a new itemset
+ SfxItemSet& AttributeProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return *(new SfxItemSet(rPool,
+
+ // ranges from SdrAttrObj
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+
+ // end
+ 0, 0));
+ }
+
+ AttributeProperties::AttributeProperties(SdrObject& rObj)
+ : DefaultProperties(rObj),
+ mpStyleSheet(0L)
+ {
+ }
+
+ AttributeProperties::AttributeProperties(const AttributeProperties& rProps, SdrObject& rObj)
+ : DefaultProperties(rProps, rObj),
+ mpStyleSheet(0L)
+ {
+ if(rProps.GetStyleSheet())
+ {
+ ImpAddStyleSheet(rProps.GetStyleSheet(), sal_True);
+ }
+ }
+
+ AttributeProperties::~AttributeProperties()
+ {
+ ImpRemoveStyleSheet();
+ }
+
+ BaseProperties& AttributeProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new AttributeProperties(*this, rObj));
+ }
+
+ void AttributeProperties::ItemSetChanged(const SfxItemSet& /*rSet*/)
+ {
+ // own modifications
+ SdrObject& rObj = GetSdrObject();
+
+ rObj.SetBoundRectDirty();
+ rObj.SetRectsDirty(sal_True);
+ rObj.SetChanged();
+ }
+
+ void AttributeProperties::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem)
+ {
+ if(pNewItem)
+ {
+ const SfxPoolItem* pItem = pNewItem;
+ SdrModel* pModel = GetSdrObject().GetModel();
+
+ switch( nWhich )
+ {
+ case XATTR_FILLBITMAP:
+ {
+ pItem = ((XFillBitmapItem*)pItem)->checkForUniqueItem( pModel );
+ break;
+ }
+ case XATTR_LINEDASH:
+ {
+ pItem = ((XLineDashItem*)pItem)->checkForUniqueItem( pModel );
+ break;
+ }
+ case XATTR_LINESTART:
+ {
+ pItem = ((XLineStartItem*)pItem)->checkForUniqueItem( pModel );
+ break;
+ }
+ case XATTR_LINEEND:
+ {
+ pItem = ((XLineEndItem*)pItem)->checkForUniqueItem( pModel );
+ break;
+ }
+ case XATTR_FILLGRADIENT:
+ {
+ pItem = ((XFillGradientItem*)pItem)->checkForUniqueItem( pModel );
+ break;
+ }
+ case XATTR_FILLFLOATTRANSPARENCE:
+ {
+ // #85953# allow all kinds of XFillFloatTransparenceItem to be set
+ pItem = ((XFillFloatTransparenceItem*)pItem)->checkForUniqueItem( pModel );
+ break;
+ }
+ case XATTR_FILLHATCH:
+ {
+ pItem = ((XFillHatchItem*)pItem)->checkForUniqueItem( pModel );
+ break;
+ }
+ }
+
+ // set item
+ if(pItem)
+ {
+ // force ItemSet
+ GetObjectItemSet();
+ mpItemSet->Put(*pItem);
+
+ // delete item if it was a generated one
+ if(pItem != pNewItem)
+ {
+ delete (SfxPoolItem*)pItem;
+ }
+ }
+ }
+ else
+ {
+ // clear item if ItemSet exists
+ if(mpItemSet)
+ {
+ mpItemSet->ClearItem(nWhich);
+ }
+ }
+ }
+
+ void AttributeProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ ImpRemoveStyleSheet();
+ ImpAddStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+
+ SdrObject& rObj = GetSdrObject();
+ rObj.SetBoundRectDirty();
+ rObj.SetRectsDirty(sal_True);
+ }
+
+ SfxStyleSheet* AttributeProperties::GetStyleSheet() const
+ {
+ return mpStyleSheet;
+ }
+
+ void AttributeProperties::MoveToItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel)
+ {
+ OSL_ASSERT(pNewModel!=NULL);
+
+ if(pSrcPool && pDestPool && (pSrcPool != pDestPool))
+ {
+ if(mpItemSet)
+ {
+ // migrate ItemSet to new pool. Scaling is NOT necessary
+ // because this functionality is used by UNDO only. Thus
+ // objects and ItemSets would be moved back to their original
+ // pool before usage.
+ SfxItemSet* pOldSet = mpItemSet;
+ SfxStyleSheet* pStySheet = GetStyleSheet();
+
+ if(pStySheet)
+ {
+ ImpRemoveStyleSheet();
+ }
+
+ mpItemSet = mpItemSet->Clone(sal_False, pDestPool);
+ GetSdrObject().GetModel()->MigrateItemSet(pOldSet, mpItemSet, pNewModel);
+
+ // set stylesheet (if used)
+ if(pStySheet)
+ {
+ // #i109515#
+ SfxItemPool* pStyleSheetPool = &pStySheet->GetPool().GetPool();
+
+ if(pStyleSheetPool == pDestPool)
+ {
+ // just re-set stylesheet
+ ImpAddStyleSheet(pStySheet, sal_True);
+ }
+ else
+ {
+ // StyleSheet is NOT from the correct pool.
+ // Look one up in the right pool with the same
+ // name or use the default.
+
+ // Look up the style in the new document.
+ OSL_ASSERT(pNewModel->GetStyleSheetPool() != NULL);
+ SfxStyleSheet* pNewStyleSheet = dynamic_cast<SfxStyleSheet*>(
+ pNewModel->GetStyleSheetPool()->Find(
+ pStySheet->GetName(),
+ SFX_STYLE_FAMILY_ALL));
+ if (pNewStyleSheet == NULL
+ || &pNewStyleSheet->GetPool().GetPool() != pDestPool)
+ {
+ // There is no copy of the style in the new
+ // document. Use the default as a fallback.
+ pNewStyleSheet = pNewModel->GetDefaultStyleSheet();
+ }
+ ImpAddStyleSheet(pNewStyleSheet, sal_True);
+ }
+ }
+
+ delete pOldSet;
+ }
+ }
+ }
+
+ void AttributeProperties::SetModel(SdrModel* pOldModel, SdrModel* pNewModel)
+ {
+ if(pOldModel != pNewModel && pNewModel && !pNewModel->IsLoading())
+ {
+ // For a living model move the items from one pool to the other
+ if(pOldModel)
+ {
+ // If metric has changed, scale items.
+ MapUnit aOldUnit(pOldModel->GetScaleUnit());
+ MapUnit aNewUnit(pNewModel->GetScaleUnit());
+ sal_Bool bScaleUnitChanged(aNewUnit != aOldUnit);
+ Fraction aMetricFactor;
+
+ if(bScaleUnitChanged)
+ {
+ aMetricFactor = GetMapFactor(aOldUnit, aNewUnit).X();
+ Scale(aMetricFactor);
+ }
+
+ // Move all styles which are used by the object to the new
+ // StyleSheet pool
+ SfxStyleSheet* pOldStyleSheet = GetStyleSheet();
+
+ if(pOldStyleSheet)
+ {
+ SfxStyleSheetBase* pSheet = pOldStyleSheet;
+ SfxStyleSheetBasePool* pOldPool = pOldModel->GetStyleSheetPool();
+ SfxStyleSheetBasePool* pNewPool = pNewModel->GetStyleSheetPool();
+ DBG_ASSERT(pOldPool, "Properties::SetModel(): Object has StyleSheet but no StyleSheetPool (!)");
+
+ if(pOldPool && pNewPool)
+ {
+ // build a list of to-be-copied Styles
+ List aList;
+ SfxStyleSheetBase* pAnchor = 0L;
+
+ while(pSheet)
+ {
+ pAnchor = pNewPool->Find(pSheet->GetName(), pSheet->GetFamily());
+
+ if(!pAnchor)
+ {
+ aList.Insert(pSheet, LIST_APPEND);
+ pSheet = pOldPool->Find(pSheet->GetParent(), pSheet->GetFamily());
+ }
+ else
+ {
+ // the style does exist
+ pSheet = 0L;
+ }
+ }
+
+ // copy and set the parents
+ pSheet = (SfxStyleSheetBase*)aList.First();
+ SfxStyleSheetBase* pNewSheet = 0L;
+ SfxStyleSheetBase* pLastSheet = 0L;
+ SfxStyleSheetBase* pForThisObject = 0L;
+
+ while(pSheet)
+ {
+ pNewSheet = &pNewPool->Make(pSheet->GetName(), pSheet->GetFamily(), pSheet->GetMask());
+ pNewSheet->GetItemSet().Put(pSheet->GetItemSet(), sal_False);
+
+ if(bScaleUnitChanged)
+ {
+ sdr::properties::ScaleItemSet(pNewSheet->GetItemSet(), aMetricFactor);
+ }
+
+ if(pLastSheet)
+ {
+ pLastSheet->SetParent(pNewSheet->GetName());
+ }
+
+ if(!pForThisObject)
+ {
+ pForThisObject = pNewSheet;
+ }
+
+ pLastSheet = pNewSheet;
+ pSheet = (SfxStyleSheetBase*)aList.Next();
+ }
+
+ // Set link to the Style found in the Pool
+ if(pAnchor && pLastSheet)
+ {
+ pLastSheet->SetParent(pAnchor->GetName());
+ }
+
+ // if list was empty (all Styles exist in destination pool)
+ // pForThisObject is not yet set
+ if(!pForThisObject && pAnchor)
+ {
+ pForThisObject = pAnchor;
+ }
+
+ // De-register at old and register at new Style
+ if(GetStyleSheet() != pForThisObject)
+ {
+ ImpRemoveStyleSheet();
+ ImpAddStyleSheet((SfxStyleSheet*)pForThisObject, sal_True);
+ }
+ }
+ else
+ {
+ // there is no StyleSheetPool in the new model, thus set
+ // all items as hard items in the object
+ List aList;
+ const SfxItemSet* pItemSet = &pOldStyleSheet->GetItemSet();
+
+ while(pItemSet)
+ {
+ aList.Insert((void*)pItemSet, CONTAINER_APPEND);
+ pItemSet = pItemSet->GetParent();
+ }
+
+ SfxItemSet* pNewSet = &CreateObjectSpecificItemSet(pNewModel->GetItemPool());
+ pItemSet = (SfxItemSet*)aList.Last();
+
+ while(pItemSet)
+ {
+ pNewSet->Put(*pItemSet);
+ pItemSet = (SfxItemSet*)aList.Prev();
+ }
+
+ // Items which were hard attributes before need to stay
+ if(mpItemSet)
+ {
+ SfxWhichIter aIter(*mpItemSet);
+ sal_uInt16 nWhich = aIter.FirstWhich();
+
+ while(nWhich)
+ {
+ if(mpItemSet->GetItemState(nWhich, sal_False) == SFX_ITEM_SET)
+ {
+ pNewSet->Put(mpItemSet->Get(nWhich));
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+ }
+
+ if(bScaleUnitChanged)
+ {
+ ScaleItemSet(*pNewSet, aMetricFactor);
+ }
+
+ if(mpItemSet)
+ {
+ if(GetStyleSheet())
+ {
+ ImpRemoveStyleSheet();
+ }
+
+ delete mpItemSet;
+ mpItemSet = 0L;
+ }
+
+ mpItemSet = pNewSet;
+ }
+ }
+ }
+
+ // each object gets the default Style if there is none set yet.
+ if(mpItemSet && !GetStyleSheet() && pNewModel && !pNewModel->IsLoading())
+ {
+ SetStyleSheet(pNewModel->GetDefaultStyleSheet(), sal_True);
+ }
+ }
+ }
+
+ void AttributeProperties::ForceStyleToHardAttributes()
+ {
+ if(GetStyleSheet() && HAS_BASE(SfxStyleSheet, mpStyleSheet))
+ {
+ // prepare copied, new itemset, but WITHOUT parent
+ GetObjectItemSet();
+ SfxItemSet* pDestItemSet = new SfxItemSet(*mpItemSet);
+ pDestItemSet->SetParent(0L);
+
+ // pepare forgetting the current stylesheet like in RemoveStyleSheet()
+ EndListening(*mpStyleSheet);
+ EndListening(mpStyleSheet->GetPool());
+
+ // prepare the iter; use the mpObjectItemSet which may have less
+ // WhichIDs than the style.
+ SfxWhichIter aIter(*pDestItemSet);
+ sal_uInt16 nWhich(aIter.FirstWhich());
+ const SfxPoolItem *pItem = NULL;
+
+ // now set all hard attributes of the current at the new itemset
+ while(nWhich)
+ {
+ // #i61284# use mpItemSet with parents, makes things easier and reduces to
+ // one loop
+ if(SFX_ITEM_SET == mpItemSet->GetItemState(nWhich, true, &pItem))
+ {
+ pDestItemSet->Put(*pItem);
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+
+ // replace itemsets
+ delete mpItemSet;
+ mpItemSet = pDestItemSet;
+
+ // set necessary changes like in RemoveStyleSheet()
+ GetSdrObject().SetBoundRectDirty();
+ GetSdrObject().SetRectsDirty(sal_True);
+
+ mpStyleSheet = NULL;
+ }
+ }
+
+ void AttributeProperties::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
+ {
+ sal_Bool bHintUsed(sal_False);
+
+ SfxStyleSheetHint *pStyleHint = PTR_CAST(SfxStyleSheetHint, &rHint);
+
+ if(pStyleHint && pStyleHint->GetStyleSheet() == GetStyleSheet())
+ {
+ SdrObject& rObj = GetSdrObject();
+ //SdrPage* pPage = rObj.GetPage();
+
+ switch(pStyleHint->GetHint())
+ {
+ case SFX_STYLESHEET_CREATED :
+ {
+ // cannot happen, nothing to do
+ break;
+ }
+ case SFX_STYLESHEET_MODIFIED :
+ case SFX_STYLESHEET_CHANGED :
+ {
+ // notify change
+ break;
+ }
+ case SFX_STYLESHEET_ERASED :
+ case SFX_STYLESHEET_INDESTRUCTION :
+ {
+ // Style needs to be exchanged
+ SfxStyleSheet* pNewStSh = 0L;
+ SdrModel* pModel = rObj.GetModel();
+
+ // #111111#
+ // Do nothing if object is in destruction, else a StyleSheet may be found from
+ // a StyleSheetPool which is just being deleted itself. and thus it would be fatal
+ // to register as listener to that new StyleSheet.
+ if(pModel && !rObj.IsInDestruction())
+ {
+ if(HAS_BASE(SfxStyleSheet, GetStyleSheet()))
+ {
+ pNewStSh = (SfxStyleSheet*)pModel->GetStyleSheetPool()->Find(
+ GetStyleSheet()->GetParent(), GetStyleSheet()->GetFamily());
+ }
+
+ if(!pNewStSh)
+ {
+ pNewStSh = pModel->GetDefaultStyleSheet();
+ }
+ }
+
+ // remove used style, it's erased or in destruction
+ ImpRemoveStyleSheet();
+
+ if(pNewStSh)
+ {
+ ImpAddStyleSheet(pNewStSh, sal_True);
+ }
+
+ break;
+ }
+ }
+
+ // Get old BoundRect. Do this after the style change is handled
+ // in the ItemSet parts because GetBoundRect() may calculate a new
+ Rectangle aBoundRect = rObj.GetLastBoundRect();
+
+ rObj.SetRectsDirty(sal_True);
+
+ // tell the object about the change
+ rObj.SetChanged();
+ rObj.BroadcastObjectChange();
+
+ //if(pPage && pPage->IsInserted())
+ //{
+ // rObj.BroadcastObjectChange();
+ //}
+
+ rObj.SendUserCall(SDRUSERCALL_CHGATTR, aBoundRect);
+
+ bHintUsed = sal_True;
+ }
+
+ if(!bHintUsed)
+ {
+ // forward to SdrObject ATM. Not sure if this will be necessary
+ // in the future.
+ GetSdrObject().Notify(rBC, rHint);
+ }
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/captionproperties.cxx b/svx/source/sdr/properties/captionproperties.cxx
new file mode 100644
index 000000000000..e08bf5516f03
--- /dev/null
+++ b/svx/source/sdr/properties/captionproperties.cxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/captionproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svl/style.hxx>
+#include <svx/svddef.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/svdocapt.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ // create a new itemset
+ SfxItemSet& CaptionProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return *(new SfxItemSet(rPool,
+
+ // range from SdrAttrObj
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+
+ // range from SdrCaptionObj
+ SDRATTR_CAPTION_FIRST, SDRATTR_CAPTION_LAST,
+
+ // range from SdrTextObj
+ EE_ITEMS_START, EE_ITEMS_END,
+
+ // end
+ 0, 0));
+ }
+
+ CaptionProperties::CaptionProperties(SdrObject& rObj)
+ : RectangleProperties(rObj)
+ {
+ }
+
+ CaptionProperties::CaptionProperties(const CaptionProperties& rProps, SdrObject& rObj)
+ : RectangleProperties(rProps, rObj)
+ {
+ }
+
+ CaptionProperties::~CaptionProperties()
+ {
+ }
+
+ BaseProperties& CaptionProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new CaptionProperties(*this, rObj));
+ }
+
+ void CaptionProperties::ItemSetChanged(const SfxItemSet& rSet)
+ {
+ SdrCaptionObj& rObj = (SdrCaptionObj&)GetSdrObject();
+
+ // local changes
+ rObj.ImpRecalcTail();
+
+ // call parent
+ RectangleProperties::ItemSetChanged(rSet);
+ }
+
+ void CaptionProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ SdrCaptionObj& rObj = (SdrCaptionObj&)GetSdrObject();
+
+ // call parent
+ RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+
+ // local changes
+ rObj.ImpRecalcTail();
+ }
+
+ void CaptionProperties::ForceDefaultAttributes()
+ {
+ // call parent
+ RectangleProperties::ForceDefaultAttributes();
+
+ // force ItemSet
+ GetObjectItemSet();
+
+ // this was set by TextProperties::ForceDefaultAttributes(),
+ // retet to default
+ mpItemSet->ClearItem(XATTR_LINESTYLE);
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/circleproperties.cxx b/svx/source/sdr/properties/circleproperties.cxx
new file mode 100644
index 000000000000..9dc37cb6b760
--- /dev/null
+++ b/svx/source/sdr/properties/circleproperties.cxx
@@ -0,0 +1,157 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/circleproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svl/style.hxx>
+#include <svx/svddef.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/svdocirc.hxx>
+#include <svx/sxcikitm.hxx>
+#include <svx/sxciaitm.hxx>
+#include <svx/sxciaitm.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ // create a new itemset
+ SfxItemSet& CircleProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return *(new SfxItemSet(rPool,
+
+ // range from SdrAttrObj
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+
+ // range from SdrCircObj
+ SDRATTR_CIRC_FIRST, SDRATTR_CIRC_LAST,
+
+ // range from SdrTextObj
+ EE_ITEMS_START, EE_ITEMS_END,
+
+ // end
+ 0, 0));
+ }
+
+ CircleProperties::CircleProperties(SdrObject& rObj)
+ : RectangleProperties(rObj)
+ {
+ }
+
+ CircleProperties::CircleProperties(const CircleProperties& rProps, SdrObject& rObj)
+ : RectangleProperties(rProps, rObj)
+ {
+ }
+
+ CircleProperties::~CircleProperties()
+ {
+ }
+
+ BaseProperties& CircleProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new CircleProperties(*this, rObj));
+ }
+
+ void CircleProperties::ItemSetChanged(const SfxItemSet& rSet)
+ {
+ SdrCircObj& rObj = (SdrCircObj&)GetSdrObject();
+
+ // call parent
+ RectangleProperties::ItemSetChanged(rSet);
+
+ // local changes
+ rObj.ImpSetAttrToCircInfo();
+ }
+
+ void CircleProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ SdrCircObj& rObj = (SdrCircObj&)GetSdrObject();
+
+ // local changes
+ rObj.SetXPolyDirty();
+
+ // call parent
+ RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+
+ // local changes
+ rObj.ImpSetAttrToCircInfo();
+ }
+
+ void CircleProperties::ForceDefaultAttributes()
+ {
+ SdrCircObj& rObj = (SdrCircObj&)GetSdrObject();
+ SdrCircKind eKindA = SDRCIRC_FULL;
+ SdrObjKind eKind = rObj.GetCircleKind();
+
+ if(eKind == OBJ_SECT)
+ {
+ eKindA = SDRCIRC_SECT;
+ }
+ else if(eKind == OBJ_CARC)
+ {
+ eKindA = SDRCIRC_ARC;
+ }
+ else if(eKind == OBJ_CCUT)
+ {
+ eKindA = SDRCIRC_CUT;
+ }
+
+ if(eKindA != SDRCIRC_FULL)
+ {
+ // force ItemSet
+ GetObjectItemSet();
+
+ mpItemSet->Put(SdrCircKindItem(eKindA));
+
+ if(rObj.GetStartWink())
+ {
+ mpItemSet->Put(SdrCircStartAngleItem(rObj.GetStartWink()));
+ }
+
+ if(rObj.GetEndWink() != 36000)
+ {
+ mpItemSet->Put(SdrCircEndAngleItem(rObj.GetEndWink()));
+ }
+ }
+
+ // call parent after SetObjectItem(SdrCircKindItem())
+ // because ForceDefaultAttr() will call
+ // ImpSetAttrToCircInfo() which needs a correct
+ // SdrCircKindItem
+ RectangleProperties::ForceDefaultAttributes();
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/connectorproperties.cxx b/svx/source/sdr/properties/connectorproperties.cxx
new file mode 100644
index 000000000000..963a541a73c1
--- /dev/null
+++ b/svx/source/sdr/properties/connectorproperties.cxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/connectorproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svl/style.hxx>
+#include <svx/svddef.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/svdoedge.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ // create a new itemset
+ SfxItemSet& ConnectorProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return *(new SfxItemSet(rPool,
+
+ // range from SdrAttrObj
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+
+ // range from SdrEdgeObj
+ SDRATTR_EDGE_FIRST, SDRATTR_EDGE_LAST,
+
+ // range from SdrTextObj
+ EE_ITEMS_START, EE_ITEMS_END,
+
+ // end
+ 0, 0));
+ }
+
+ ConnectorProperties::ConnectorProperties(SdrObject& rObj)
+ : TextProperties(rObj)
+ {
+ }
+
+ ConnectorProperties::ConnectorProperties(const ConnectorProperties& rProps, SdrObject& rObj)
+ : TextProperties(rProps, rObj)
+ {
+ }
+
+ ConnectorProperties::~ConnectorProperties()
+ {
+ }
+
+ BaseProperties& ConnectorProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new ConnectorProperties(*this, rObj));
+ }
+
+ void ConnectorProperties::ItemSetChanged(const SfxItemSet& rSet)
+ {
+ SdrEdgeObj& rObj = (SdrEdgeObj&)GetSdrObject();
+
+ // call parent
+ TextProperties::ItemSetChanged(rSet);
+
+ // local changes
+ rObj.ImpSetAttrToEdgeInfo();
+ }
+
+ void ConnectorProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ SdrEdgeObj& rObj = (SdrEdgeObj&)GetSdrObject();
+
+ // call parent
+ TextProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+
+ // local changes
+ rObj.ImpSetAttrToEdgeInfo();
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/customshapeproperties.cxx b/svx/source/sdr/properties/customshapeproperties.cxx
new file mode 100644
index 000000000000..6146dc66e417
--- /dev/null
+++ b/svx/source/sdr/properties/customshapeproperties.cxx
@@ -0,0 +1,239 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/customshapeproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svl/style.hxx>
+#include <svx/svdoashp.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/sdtagitm.hxx>
+#include <svl/whiter.hxx>
+#include <svl/itemset.hxx>
+#include <svl/smplhint.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ void CustomShapeProperties::UpdateTextFrameStatus()
+ {
+ SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
+ SdrTextAutoGrowHeightItem& rAutoGrowHeightItem =
+ (SdrTextAutoGrowHeightItem&)rObj.GetMergedItem( SDRATTR_TEXT_AUTOGROWHEIGHT );
+ rObj.bTextFrame = rAutoGrowHeightItem.GetValue() != 0;
+
+ if ( rObj.bTextFrame )
+ rObj.NbcAdjustTextFrameWidthAndHeight();
+ }
+
+ SfxItemSet& CustomShapeProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return *(new SfxItemSet(rPool,
+
+ // ranges from SdrAttrObj
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+
+ // Graphic Attributes
+ SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST,
+
+ // 3d Properties
+ SDRATTR_3D_FIRST, SDRATTR_3D_LAST,
+
+ // CustomShape properties
+ SDRATTR_CUSTOMSHAPE_FIRST, SDRATTR_CUSTOMSHAPE_LAST,
+
+ // range from SdrTextObj
+ EE_ITEMS_START, EE_ITEMS_END,
+
+ // end
+ 0, 0));
+ }
+ sal_Bool CustomShapeProperties::AllowItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem ) const
+ {
+ sal_Bool bAllowItemChange = sal_True;
+ if ( !pNewItem )
+ {
+ if ( ( nWhich >= SDRATTR_CUSTOMSHAPE_FIRST ) && ( nWhich <= SDRATTR_CUSTOMSHAPE_LAST ) )
+ bAllowItemChange = sal_False;
+ }
+ if ( bAllowItemChange )
+ bAllowItemChange = TextProperties::AllowItemChange( nWhich, pNewItem );
+ return bAllowItemChange;
+ }
+ void CustomShapeProperties::ClearObjectItem(const sal_uInt16 nWhich)
+ {
+ if ( !nWhich )
+ {
+ SfxWhichIter aIter( *mpItemSet );
+ sal_uInt16 nWhich2 = aIter.FirstWhich();
+ while( nWhich2 )
+ {
+ TextProperties::ClearObjectItemDirect( nWhich2 );
+ nWhich2 = aIter.NextWhich();
+ }
+ SfxItemSet aSet((SfxItemPool&)(*GetSdrObject().GetObjectItemPool()));
+ ItemSetChanged(aSet);
+ }
+ else
+ TextProperties::ClearObjectItem( nWhich );
+ }
+ void CustomShapeProperties::ClearObjectItemDirect(const sal_uInt16 nWhich)
+ {
+ if ( !nWhich )
+ {
+ SfxWhichIter aIter( *mpItemSet );
+ sal_uInt16 nWhich2 = aIter.FirstWhich();
+ while( nWhich2 )
+ {
+ TextProperties::ClearObjectItemDirect( nWhich2 );
+ nWhich2 = aIter.NextWhich();
+ }
+ }
+ else
+ TextProperties::ClearObjectItemDirect( nWhich );
+ }
+ void CustomShapeProperties::ItemSetChanged(const SfxItemSet& rSet)
+ {
+ SdrObjCustomShape& rObj = (SdrObjCustomShape&)GetSdrObject();
+
+ if( SFX_ITEM_SET == rSet.GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT ) )
+ {
+ rObj.bTextFrame = ((SdrTextAutoGrowHeightItem&)rSet.Get( SDRATTR_TEXT_AUTOGROWHEIGHT )).GetValue() != 0;
+ }
+
+ // call parent
+ TextProperties::ItemSetChanged(rSet);
+
+ // local changes, removing cached objects
+ rObj.InvalidateRenderGeometry();
+ }
+ void CustomShapeProperties::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem)
+ {
+ SdrObjCustomShape& rObj = (SdrObjCustomShape&)GetSdrObject();
+ //OutlinerParaObject* pParaObj = rObj.GetOutlinerParaObject();
+
+ if( pNewItem && ( SDRATTR_TEXT_AUTOGROWHEIGHT == nWhich ) )
+ {
+ rObj.bTextFrame = ((SdrTextAutoGrowHeightItem*)pNewItem)->GetValue() != 0;
+ }
+ // call parent
+ TextProperties::ItemChange( nWhich, pNewItem );
+
+ rObj.InvalidateRenderGeometry();
+ }
+ void CustomShapeProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ TextProperties::SetStyleSheet( pNewStyleSheet, bDontRemoveHardAttr );
+ UpdateTextFrameStatus();
+ }
+ void CustomShapeProperties::ForceDefaultAttributes()
+ {
+ UpdateTextFrameStatus();
+
+/* SJ: Following is no good if creating customshapes, leading to objects that are white after loading via xml
+
+ SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
+ sal_Bool bTextFrame(rObj.IsTextFrame());
+
+ // force ItemSet
+ GetObjectItemSet();
+
+ if(bTextFrame)
+ {
+ mpItemSet->Put(XLineStyleItem(XLINE_NONE));
+ mpItemSet->Put(XFillColorItem(String(), Color(COL_WHITE)));
+ mpItemSet->Put(XFillStyleItem(XFILL_NONE));
+ }
+ else
+ {
+ mpItemSet->Put(SvxAdjustItem(SVX_ADJUST_CENTER));
+ mpItemSet->Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER));
+ mpItemSet->Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER));
+ }
+*/
+ }
+ CustomShapeProperties::CustomShapeProperties(SdrObject& rObj)
+ : TextProperties(rObj)
+ {
+ }
+
+ CustomShapeProperties::CustomShapeProperties(const CustomShapeProperties& rProps, SdrObject& rObj)
+ : TextProperties(rProps, rObj)
+ {
+ }
+
+ CustomShapeProperties::~CustomShapeProperties()
+ {
+ }
+
+ BaseProperties& CustomShapeProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new CustomShapeProperties(*this, rObj));
+ }
+ void CustomShapeProperties::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
+ {
+ TextProperties::Notify( rBC, rHint );
+
+ sal_Bool bRemoveRenderGeometry = sal_False;
+
+ const SfxStyleSheetHint *pStyleHint = PTR_CAST( SfxStyleSheetHint, &rHint );
+ const SfxSimpleHint *pSimpleHint = PTR_CAST( SfxSimpleHint, &rHint );
+ if ( pStyleHint && pStyleHint->GetStyleSheet() == GetStyleSheet() )
+ {
+ switch( pStyleHint->GetHint() )
+ {
+ case SFX_STYLESHEET_MODIFIED :
+ case SFX_STYLESHEET_CHANGED :
+ bRemoveRenderGeometry = sal_True;
+ break;
+ };
+ }
+ else if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DATACHANGED )
+ {
+ bRemoveRenderGeometry = sal_True;
+ }
+ if ( bRemoveRenderGeometry )
+ {
+ UpdateTextFrameStatus();
+
+ // local changes, removing cached objects
+ SdrObjCustomShape& rObj = (SdrObjCustomShape&)GetSdrObject();
+ rObj.InvalidateRenderGeometry();
+ }
+
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/defaultproperties.cxx b/svx/source/sdr/properties/defaultproperties.cxx
new file mode 100644
index 000000000000..7d51b26a0051
--- /dev/null
+++ b/svx/source/sdr/properties/defaultproperties.cxx
@@ -0,0 +1,237 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/defaultproperties.hxx>
+#include <svx/sdr/properties/itemsettools.hxx>
+#include <svl/itemset.hxx>
+#include <svl/whiter.hxx>
+
+#include <vector>
+#include <svx/svdobj.hxx>
+#include <svx/svddef.hxx>
+#include <svx/svdpool.hxx>
+#include <editeng/eeitem.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ SfxItemSet& DefaultProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ // Basic implementation; Basic object has NO attributes
+ return *(new SfxItemSet(rPool));
+ }
+
+ DefaultProperties::DefaultProperties(SdrObject& rObj)
+ : BaseProperties(rObj),
+ mpItemSet(0L)
+ {
+ }
+
+ DefaultProperties::DefaultProperties(const DefaultProperties& rProps, SdrObject& rObj)
+ : BaseProperties(rObj),
+ mpItemSet(0L)
+ {
+ if(rProps.mpItemSet)
+ {
+ mpItemSet = rProps.mpItemSet->Clone(sal_True);
+
+ // do not keep parent info, this may be changed by later construrtors.
+ // This class just copies the ItemSet, ignore parent.
+ if(mpItemSet && mpItemSet->GetParent())
+ {
+ mpItemSet->SetParent(0L);
+ }
+ }
+ }
+
+ BaseProperties& DefaultProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new DefaultProperties(*this, rObj));
+ }
+
+ DefaultProperties::~DefaultProperties()
+ {
+ if(mpItemSet)
+ {
+ delete mpItemSet;
+ mpItemSet = 0L;
+ }
+ }
+
+ const SfxItemSet& DefaultProperties::GetObjectItemSet() const
+ {
+ if(!mpItemSet)
+ {
+ ((DefaultProperties*)this)->mpItemSet = &(((DefaultProperties*)this)->CreateObjectSpecificItemSet(*GetSdrObject().GetObjectItemPool()));
+ ((DefaultProperties*)this)->ForceDefaultAttributes();
+ }
+
+ DBG_ASSERT(mpItemSet, "Could not create an SfxItemSet(!)");
+
+ return *mpItemSet;
+ }
+
+ void DefaultProperties::SetObjectItem(const SfxPoolItem& rItem)
+ {
+ const sal_uInt16 nWhichID(rItem.Which());
+
+ if(AllowItemChange(nWhichID, &rItem))
+ {
+ ItemChange(nWhichID, &rItem);
+ PostItemChange(nWhichID);
+
+ SfxItemSet aSet(*GetSdrObject().GetObjectItemPool(), nWhichID, nWhichID);
+ aSet.Put(rItem);
+ ItemSetChanged(aSet);
+ }
+ }
+
+ void DefaultProperties::SetObjectItemDirect(const SfxPoolItem& rItem)
+ {
+ const sal_uInt16 nWhichID(rItem.Which());
+
+ if(AllowItemChange(nWhichID, &rItem))
+ {
+ ItemChange(nWhichID, &rItem);
+ }
+ }
+
+ void DefaultProperties::ClearObjectItem(const sal_uInt16 nWhich)
+ {
+ if(AllowItemChange(nWhich))
+ {
+ ItemChange(nWhich);
+ PostItemChange(nWhich);
+
+ if(nWhich)
+ {
+ SfxItemSet aSet(*GetSdrObject().GetObjectItemPool(), nWhich, nWhich, 0, 0);
+ ItemSetChanged(aSet);
+ }
+ }
+ }
+
+ void DefaultProperties::ClearObjectItemDirect(const sal_uInt16 nWhich)
+ {
+ if(AllowItemChange(nWhich))
+ {
+ ItemChange(nWhich);
+ }
+ }
+
+ void DefaultProperties::SetObjectItemSet(const SfxItemSet& rSet)
+ {
+ SfxWhichIter aWhichIter(rSet);
+ sal_uInt16 nWhich(aWhichIter.FirstWhich());
+ const SfxPoolItem *pPoolItem;
+ std::vector< sal_uInt16 > aPostItemChangeList;
+ sal_Bool bDidChange(sal_False);
+ SfxItemSet aSet(*GetSdrObject().GetObjectItemPool(), SDRATTR_START, EE_ITEMS_END, 0, 0);
+
+ // give a hint to STL_Vector
+ aPostItemChangeList.reserve(rSet.Count());
+
+ while(nWhich)
+ {
+ if(SFX_ITEM_SET == rSet.GetItemState(nWhich, sal_False, &pPoolItem))
+ {
+ if(AllowItemChange(nWhich, pPoolItem))
+ {
+ bDidChange = sal_True;
+ ItemChange(nWhich, pPoolItem);
+ aPostItemChangeList.push_back( nWhich );
+ aSet.Put(*pPoolItem);
+ }
+ }
+
+ nWhich = aWhichIter.NextWhich();
+ }
+
+ if(bDidChange)
+ {
+ std::vector< sal_uInt16 >::iterator aIter = aPostItemChangeList.begin();
+ const std::vector< sal_uInt16 >::iterator aEnd = aPostItemChangeList.end();
+
+ while(aIter != aEnd)
+ {
+ PostItemChange(*aIter);
+ aIter++;
+ }
+
+ ItemSetChanged(aSet);
+ }
+ }
+
+ void DefaultProperties::ItemSetChanged(const SfxItemSet& /*rSet*/)
+ {
+ }
+
+ sal_Bool DefaultProperties::AllowItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/) const
+ {
+ return sal_True;
+ }
+
+ void DefaultProperties::ItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/)
+ {
+ }
+
+ void DefaultProperties::PostItemChange(const sal_uInt16 /*nWhich*/)
+ {
+ }
+
+ void DefaultProperties::SetStyleSheet(SfxStyleSheet* /*pNewStyleSheet*/, sal_Bool /*bDontRemoveHardAttr*/)
+ {
+ // no StyleSheet in DefaultProperties
+ }
+
+ SfxStyleSheet* DefaultProperties::GetStyleSheet() const
+ {
+ // no StyleSheet in DefaultProperties
+ return 0L;
+ }
+
+ void DefaultProperties::ForceDefaultAttributes()
+ {
+ }
+
+ void DefaultProperties::Scale(const Fraction& rScale)
+ {
+ if(mpItemSet)
+ {
+ ScaleItemSet(*mpItemSet, rScale);
+ }
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/e3dcompoundproperties.cxx b/svx/source/sdr/properties/e3dcompoundproperties.cxx
new file mode 100644
index 000000000000..a939ed664a8d
--- /dev/null
+++ b/svx/source/sdr/properties/e3dcompoundproperties.cxx
@@ -0,0 +1,165 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/e3dcompoundproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svx/obj3d.hxx>
+#include <svx/scene3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ E3dCompoundProperties::E3dCompoundProperties(SdrObject& rObj)
+ : E3dProperties(rObj)
+ {
+ }
+
+ E3dCompoundProperties::E3dCompoundProperties(const E3dCompoundProperties& rProps, SdrObject& rObj)
+ : E3dProperties(rProps, rObj)
+ {
+ }
+
+ E3dCompoundProperties::~E3dCompoundProperties()
+ {
+ }
+
+ BaseProperties& E3dCompoundProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new E3dCompoundProperties(*this, rObj));
+ }
+
+ const SfxItemSet& E3dCompoundProperties::GetObjectItemSet() const
+ {
+ //DBG_ASSERT(sal_False, "E3dCompoundProperties::GetObjectItemSet() maybe the wrong call (!)");
+ return E3dProperties::GetObjectItemSet();
+ }
+
+ const SfxItemSet& E3dCompoundProperties::GetMergedItemSet() const
+ {
+ // include Items of scene this object belongs to
+ E3dCompoundObject& rObj = (E3dCompoundObject&)GetSdrObject();
+ E3dScene* pScene = rObj.GetScene();
+
+ if(pScene)
+ {
+ // force ItemSet
+ GetObjectItemSet();
+
+ // add filtered scene properties (SDRATTR_3DSCENE_) to local itemset
+ SfxItemSet aSet(*mpItemSet->GetPool(), SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST);
+ aSet.Put(pScene->GetProperties().GetObjectItemSet());
+ mpItemSet->Put(aSet);
+ }
+
+ // call parent
+ return E3dProperties::GetMergedItemSet();
+ }
+
+ void E3dCompoundProperties::SetMergedItemSet(const SfxItemSet& rSet, sal_Bool bClearAllItems)
+ {
+ // Set scene specific items at scene
+ E3dCompoundObject& rObj = (E3dCompoundObject&)GetSdrObject();
+ E3dScene* pScene = rObj.GetScene();
+
+ if(pScene)
+ {
+ // force ItemSet
+ GetObjectItemSet();
+
+ // Generate filtered scene properties (SDRATTR_3DSCENE_) itemset
+ SfxItemSet aSet(*mpItemSet->GetPool(), SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST);
+ aSet.Put(rSet);
+
+ if(bClearAllItems)
+ {
+ pScene->GetProperties().ClearObjectItem();
+ }
+
+ if(aSet.Count())
+ {
+ pScene->GetProperties().SetObjectItemSet(aSet);
+ }
+ }
+
+ // call parent. This will set items on local object, too.
+ E3dProperties::SetMergedItemSet(rSet, bClearAllItems);
+ }
+
+ void E3dCompoundProperties::PostItemChange(const sal_uInt16 nWhich)
+ {
+ // call parent
+ E3dProperties::PostItemChange(nWhich);
+
+ // handle value change
+ E3dCompoundObject& rObj = (E3dCompoundObject&)GetSdrObject();
+
+ switch(nWhich)
+ {
+ // #i28528#
+ // Added extra Item (Bool) for chart2 to be able to show reduced line geometry
+ case SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_DOUBLE_SIDED:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_NORMALS_KIND:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_NORMALS_INVERT:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_TEXTURE_PROJ_X:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_TEXTURE_PROJ_Y:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ }
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/e3dextrudeproperties.cxx b/svx/source/sdr/properties/e3dextrudeproperties.cxx
new file mode 100644
index 000000000000..91b86551339c
--- /dev/null
+++ b/svx/source/sdr/properties/e3dextrudeproperties.cxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/e3dextrudeproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svx/extrud3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ E3dExtrudeProperties::E3dExtrudeProperties(SdrObject& rObj)
+ : E3dCompoundProperties(rObj)
+ {
+ }
+
+ E3dExtrudeProperties::E3dExtrudeProperties(const E3dExtrudeProperties& rProps, SdrObject& rObj)
+ : E3dCompoundProperties(rProps, rObj)
+ {
+ }
+
+ E3dExtrudeProperties::~E3dExtrudeProperties()
+ {
+ }
+
+ BaseProperties& E3dExtrudeProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new E3dExtrudeProperties(*this, rObj));
+ }
+
+ void E3dExtrudeProperties::PostItemChange(const sal_uInt16 nWhich)
+ {
+ // call parent
+ E3dCompoundProperties::PostItemChange(nWhich);
+
+ // handle value change
+ E3dExtrudeObj& rObj = (E3dExtrudeObj&)GetSdrObject();
+
+ switch(nWhich)
+ {
+ case SDRATTR_3DOBJ_PERCENT_DIAGONAL:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_BACKSCALE:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_DEPTH:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ }
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/e3dlatheproperties.cxx b/svx/source/sdr/properties/e3dlatheproperties.cxx
new file mode 100644
index 000000000000..135104abab32
--- /dev/null
+++ b/svx/source/sdr/properties/e3dlatheproperties.cxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/e3dlatheproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svx/lathe3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ E3dLatheProperties::E3dLatheProperties(SdrObject& rObj)
+ : E3dCompoundProperties(rObj)
+ {
+ }
+
+ E3dLatheProperties::E3dLatheProperties(const E3dLatheProperties& rProps, SdrObject& rObj)
+ : E3dCompoundProperties(rProps, rObj)
+ {
+ }
+
+ E3dLatheProperties::~E3dLatheProperties()
+ {
+ }
+
+ BaseProperties& E3dLatheProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new E3dLatheProperties(*this, rObj));
+ }
+
+ void E3dLatheProperties::PostItemChange(const sal_uInt16 nWhich)
+ {
+ // call parent
+ E3dCompoundProperties::PostItemChange(nWhich);
+
+ // handle value change
+ E3dLatheObj& rObj = (E3dLatheObj&)GetSdrObject();
+
+ switch(nWhich)
+ {
+ case SDRATTR_3DOBJ_HORZ_SEGS:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_VERT_SEGS:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_PERCENT_DIAGONAL:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_BACKSCALE:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_END_ANGLE:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ }
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/e3dproperties.cxx b/svx/source/sdr/properties/e3dproperties.cxx
new file mode 100644
index 000000000000..9ae3e2565a78
--- /dev/null
+++ b/svx/source/sdr/properties/e3dproperties.cxx
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/e3dproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svx/svddef.hxx>
+#include <svx/obj3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ // create a new itemset
+ SfxItemSet& E3dProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return *(new SfxItemSet(rPool,
+
+ // ranges from SdrAttrObj
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+
+ // ranges from E3dObject, contains object and scene because of GetMergedItemSet()
+ SDRATTR_3D_FIRST, SDRATTR_3D_LAST,
+
+ // end
+ 0, 0));
+ }
+
+ E3dProperties::E3dProperties(SdrObject& rObj)
+ : AttributeProperties(rObj)
+ {
+ }
+
+ E3dProperties::E3dProperties(const E3dProperties& rProps, SdrObject& rObj)
+ : AttributeProperties(rProps, rObj)
+ {
+ }
+
+ E3dProperties::~E3dProperties()
+ {
+ }
+
+ BaseProperties& E3dProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new E3dProperties(*this, rObj));
+ }
+
+ void E3dProperties::ItemSetChanged(const SfxItemSet& rSet)
+ {
+ E3dObject& rObj = (E3dObject&)GetSdrObject();
+
+ // call parent
+ AttributeProperties::ItemSetChanged(rSet);
+
+ // local changes
+ rObj.StructureChanged();
+ }
+
+ void E3dProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ // call parent
+ AttributeProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+
+ // propagate call to contained objects
+ const SdrObjList* pSub = ((const E3dObject&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ pSub->GetObj(a)->GetProperties().SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+ }
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/e3dsceneproperties.cxx b/svx/source/sdr/properties/e3dsceneproperties.cxx
new file mode 100644
index 000000000000..6fbf34968f3c
--- /dev/null
+++ b/svx/source/sdr/properties/e3dsceneproperties.cxx
@@ -0,0 +1,334 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/e3dsceneproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svl/whiter.hxx>
+#include <svx/svddef.hxx>
+#include <svx/scene3d.hxx>
+#include <svx/svditer.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ E3dSceneProperties::E3dSceneProperties(SdrObject& rObj)
+ : E3dProperties(rObj)
+ {
+ }
+
+ E3dSceneProperties::E3dSceneProperties(const E3dSceneProperties& rProps, SdrObject& rObj)
+ : E3dProperties(rProps, rObj)
+ {
+ }
+
+ E3dSceneProperties::~E3dSceneProperties()
+ {
+ }
+
+ BaseProperties& E3dSceneProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new E3dSceneProperties(*this, rObj));
+ }
+
+ const SfxItemSet& E3dSceneProperties::GetObjectItemSet() const
+ {
+ //DBG_ASSERT(sal_False, "E3dSceneProperties::GetObjectItemSet() maybe the wrong call (!)");
+ return E3dProperties::GetObjectItemSet();
+ }
+
+ const SfxItemSet& E3dSceneProperties::GetMergedItemSet() const
+ {
+ // prepare ItemSet
+ if(mpItemSet)
+ {
+ // filter for SDRATTR_3DSCENE_ items, only keep those items
+ SfxItemSet aNew(*mpItemSet->GetPool(), SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST);
+ aNew.Put(*mpItemSet);
+ mpItemSet->ClearItem();
+ mpItemSet->Put(aNew);
+ }
+ else
+ {
+ // No ItemSet yet, force local ItemSet
+ GetObjectItemSet();
+ }
+
+ // collect all ItemSets of contained 3d objects
+ const SdrObjList* pSub = ((const E3dScene&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ SdrObject* pObj = pSub->GetObj(a);
+
+ if(pObj && pObj->ISA(E3dCompoundObject))
+ {
+ const SfxItemSet& rSet = pObj->GetMergedItemSet();
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich(aIter.FirstWhich());
+
+ while(nWhich)
+ {
+ // Leave out the SDRATTR_3DSCENE_ range, this would only be double
+ // and always equal.
+ if(nWhich <= SDRATTR_3DSCENE_FIRST || nWhich >= SDRATTR_3DSCENE_LAST)
+ {
+ if(SFX_ITEM_DONTCARE == rSet.GetItemState(nWhich, sal_False))
+ {
+ mpItemSet->InvalidateItem(nWhich);
+ }
+ else
+ {
+ mpItemSet->MergeValue(rSet.Get(nWhich), sal_True);
+ }
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+ }
+ }
+
+ // call parent
+ return E3dProperties::GetMergedItemSet();
+ }
+
+ void E3dSceneProperties::SetMergedItemSet(const SfxItemSet& rSet, sal_Bool bClearAllItems)
+ {
+ // Set SDRATTR_3DOBJ_ range at contained objects.
+ const SdrObjList* pSub = ((const E3dScene&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ if(nCount)
+ {
+ // Generate filtered ItemSet which contains all but the SDRATTR_3DSCENE items.
+ // #i50808# Leak fix, Clone produces a new instance and we get ownership here
+ SfxItemSet* pNewSet = rSet.Clone(sal_True);
+ DBG_ASSERT(pNewSet, "E3dSceneProperties::SetMergedItemSet(): Could not clone ItemSet (!)");
+
+ for(sal_uInt16 b(SDRATTR_3DSCENE_FIRST); b <= SDRATTR_3DSCENE_LAST; b++)
+ {
+ pNewSet->ClearItem(b);
+ }
+
+ if(pNewSet->Count())
+ {
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ SdrObject* pObj = pSub->GetObj(a);
+
+ if(pObj && pObj->ISA(E3dCompoundObject))
+ {
+ // set merged ItemSet at contained 3d object.
+ pObj->SetMergedItemSet(*pNewSet, bClearAllItems);
+ }
+ }
+ }
+
+ delete pNewSet;
+ }
+
+ // call parent. This will set items on local object, too.
+ E3dProperties::SetMergedItemSet(rSet, bClearAllItems);
+ }
+
+ void E3dSceneProperties::SetMergedItem(const SfxPoolItem& rItem)
+ {
+ const SdrObjList* pSub = ((const E3dScene&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ pSub->GetObj(a)->SetMergedItem(rItem);
+ }
+
+ // #i43809# call parent. This will set items on local object, too.
+ E3dProperties::SetMergedItem(rItem);
+ }
+
+ void E3dSceneProperties::ClearMergedItem(const sal_uInt16 nWhich)
+ {
+ const SdrObjList* pSub = ((const E3dScene&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ pSub->GetObj(a)->ClearMergedItem(nWhich);
+ }
+
+ // #i43809# call parent. This will clear items on local object, too.
+ E3dProperties::ClearMergedItem(nWhich);
+ }
+
+ void E3dSceneProperties::PostItemChange(const sal_uInt16 nWhich)
+ {
+ // call parent
+ E3dProperties::PostItemChange(nWhich);
+
+ // local changes
+ E3dScene& rObj = (E3dScene&)GetSdrObject();
+ rObj.StructureChanged();
+
+ switch(nWhich)
+ {
+ case SDRATTR_3DSCENE_PERSPECTIVE :
+ case SDRATTR_3DSCENE_DISTANCE :
+ case SDRATTR_3DSCENE_FOCAL_LENGTH :
+ {
+ // #83387#, #83391#
+ // one common function for the camera attributes
+ // since SetCamera() sets all three back to the ItemSet
+ Camera3D aSceneCam(rObj.GetCamera());
+ sal_Bool bChange(sal_False);
+
+ // for SDRATTR_3DSCENE_PERSPECTIVE:
+ if(aSceneCam.GetProjection() != rObj.GetPerspective())
+ {
+ aSceneCam.SetProjection(rObj.GetPerspective());
+ bChange = sal_True;
+ }
+
+ // for SDRATTR_3DSCENE_DISTANCE:
+ basegfx::B3DPoint aActualPosition(aSceneCam.GetPosition());
+ double fNew = rObj.GetDistance();
+
+ if(fNew != aActualPosition.getZ())
+ {
+ aSceneCam.SetPosition(basegfx::B3DPoint(aActualPosition.getX(), aActualPosition.getY(), fNew));
+ bChange = sal_True;
+ }
+
+ // for SDRATTR_3DSCENE_FOCAL_LENGTH:
+ fNew = rObj.GetFocalLength() / 100.0;
+
+ if(aSceneCam.GetFocalLength() != fNew)
+ {
+ aSceneCam.SetFocalLength(fNew);
+ bChange = sal_True;
+ }
+
+ // for all
+ if(bChange)
+ {
+ rObj.SetCamera(aSceneCam);
+ }
+
+ break;
+ }
+ }
+ }
+
+ void E3dSceneProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ const SdrObjList* pSub = ((const E3dScene&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ pSub->GetObj(a)->SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+ }
+ }
+
+ SfxStyleSheet* E3dSceneProperties::GetStyleSheet() const
+ {
+ SfxStyleSheet* pRetval = 0L;
+
+ const SdrObjList* pSub = ((const E3dScene&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ SfxStyleSheet* pCandidate = pSub->GetObj(a)->GetStyleSheet();
+
+ if(pRetval)
+ {
+ if(pCandidate != pRetval)
+ {
+ // different StyleSheelts, return none
+ return 0L;
+ }
+ }
+ else
+ {
+ pRetval = pCandidate;
+ }
+ }
+
+ return pRetval;
+ }
+
+ void E3dSceneProperties::MoveToItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel)
+ {
+ if(pSrcPool && pDestPool && (pSrcPool != pDestPool))
+ {
+ // call parent
+ E3dProperties::MoveToItemPool(pSrcPool, pDestPool, pNewModel);
+
+ // own reaction, but only with outmost scene
+ E3dScene& rObj = (E3dScene&)GetSdrObject();
+ const SdrObjList* pSubList = rObj.GetSubList();
+
+ if(pSubList && rObj.GetScene() == &rObj)
+ {
+ SdrObjListIter a3DIterator(*pSubList, IM_DEEPWITHGROUPS);
+
+ while(a3DIterator.IsMore())
+ {
+ E3dObject* pObj = (E3dObject*)a3DIterator.Next();
+ DBG_ASSERT(pObj->ISA(E3dObject), "In scenes there are only 3D objects allowed (!)");
+ pObj->GetProperties().MoveToItemPool(pSrcPool, pDestPool, pNewModel);
+ }
+ }
+ }
+ }
+
+ void E3dSceneProperties::SetSceneItemsFromCamera()
+ {
+ // force ItemSet
+ GetObjectItemSet();
+
+ E3dScene& rObj = (E3dScene&)GetSdrObject();
+ Camera3D aSceneCam(rObj.GetCamera());
+
+ // ProjectionType
+ mpItemSet->Put(Svx3DPerspectiveItem((sal_uInt16)aSceneCam.GetProjection()));
+
+ // CamPos
+ mpItemSet->Put(Svx3DDistanceItem((sal_uInt32)(aSceneCam.GetPosition().getZ() + 0.5)));
+
+ // FocalLength
+ mpItemSet->Put(Svx3DFocalLengthItem((sal_uInt32)((aSceneCam.GetFocalLength() * 100.0) + 0.5)));
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/e3dsphereproperties.cxx b/svx/source/sdr/properties/e3dsphereproperties.cxx
new file mode 100644
index 000000000000..589a5e639d0a
--- /dev/null
+++ b/svx/source/sdr/properties/e3dsphereproperties.cxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/e3dsphereproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svx/sphere3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ E3dSphereProperties::E3dSphereProperties(SdrObject& rObj)
+ : E3dCompoundProperties(rObj)
+ {
+ }
+
+ E3dSphereProperties::E3dSphereProperties(const E3dSphereProperties& rProps, SdrObject& rObj)
+ : E3dCompoundProperties(rProps, rObj)
+ {
+ }
+
+ E3dSphereProperties::~E3dSphereProperties()
+ {
+ }
+
+ BaseProperties& E3dSphereProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new E3dSphereProperties(*this, rObj));
+ }
+
+ void E3dSphereProperties::PostItemChange(const sal_uInt16 nWhich)
+ {
+ // call parent
+ E3dCompoundProperties::PostItemChange(nWhich);
+
+ // handle value change
+ E3dSphereObj& rObj = (E3dSphereObj&)GetSdrObject();
+
+ switch(nWhich)
+ {
+ case SDRATTR_3DOBJ_HORZ_SEGS:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_VERT_SEGS:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ }
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/emptyproperties.cxx b/svx/source/sdr/properties/emptyproperties.cxx
new file mode 100644
index 000000000000..a33d5b23f84d
--- /dev/null
+++ b/svx/source/sdr/properties/emptyproperties.cxx
@@ -0,0 +1,153 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/emptyproperties.hxx>
+#include <tools/debug.hxx>
+#include <svl/itemset.hxx>
+#include <svx/svddef.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdpool.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ // create a new itemset
+ SfxItemSet& EmptyProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ // Basic implementation; Basic object has NO attributes
+ DBG_ASSERT(sal_False, "EmptyProperties::CreateObjectSpecificItemSet() should never be called");
+ return *(new SfxItemSet(rPool));
+ }
+
+ EmptyProperties::EmptyProperties(SdrObject& rObj)
+ : BaseProperties(rObj),
+ mpEmptyItemSet(0L)
+ {
+ }
+
+ EmptyProperties::EmptyProperties(const EmptyProperties& rProps, SdrObject& rObj)
+ : BaseProperties(rProps, rObj),
+ mpEmptyItemSet(0L)
+ {
+ // #115593#
+ // do not gererate an assert, else derivations like PageProperties will generate an assert
+ // using the Clone() operator path.
+ }
+
+ EmptyProperties::~EmptyProperties()
+ {
+ if(mpEmptyItemSet)
+ {
+ delete mpEmptyItemSet;
+ mpEmptyItemSet = 0L;
+ }
+ }
+
+ BaseProperties& EmptyProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new EmptyProperties(*this, rObj));
+ }
+
+ const SfxItemSet& EmptyProperties::GetObjectItemSet() const
+ {
+ if(!mpEmptyItemSet)
+ {
+ ((EmptyProperties*)this)->mpEmptyItemSet = &(((EmptyProperties*)this)->CreateObjectSpecificItemSet(*GetSdrObject().GetObjectItemPool()));
+ }
+
+ DBG_ASSERT(mpEmptyItemSet, "Could not create an SfxItemSet(!)");
+ DBG_ASSERT(sal_False, "EmptyProperties::GetObjectItemSet() should never be called (!)");
+
+ return *mpEmptyItemSet;
+ }
+
+ void EmptyProperties::SetObjectItem(const SfxPoolItem& /*rItem*/)
+ {
+ DBG_ASSERT(sal_False, "EmptyProperties::SetObjectItem() should never be called (!)");
+ }
+
+ void EmptyProperties::SetObjectItemDirect(const SfxPoolItem& /*rItem*/)
+ {
+ DBG_ASSERT(sal_False, "EmptyProperties::SetObjectItemDirect() should never be called (!)");
+ }
+
+ void EmptyProperties::ClearObjectItem(const sal_uInt16 /*nWhich*/)
+ {
+ DBG_ASSERT(sal_False, "EmptyProperties::ClearObjectItem() should never be called (!)");
+ }
+
+ void EmptyProperties::ClearObjectItemDirect(const sal_uInt16 /*nWhich*/)
+ {
+ DBG_ASSERT(sal_False, "EmptyProperties::ClearObjectItemDirect() should never be called (!)");
+ }
+
+ void EmptyProperties::SetObjectItemSet(const SfxItemSet& /*rSet*/)
+ {
+ DBG_ASSERT(sal_False, "EmptyProperties::SetObjectItemSet() should never be called (!)");
+ }
+
+ void EmptyProperties::ItemSetChanged(const SfxItemSet& /*rSet*/)
+ {
+ DBG_ASSERT(sal_False, "EmptyProperties::ItemSetChanged() should never be called (!)");
+ }
+
+ sal_Bool EmptyProperties::AllowItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/) const
+ {
+ DBG_ASSERT(sal_False, "EmptyProperties::AllowItemChange() should never be called (!)");
+ return sal_True;
+ }
+
+ void EmptyProperties::ItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/)
+ {
+ DBG_ASSERT(sal_False, "EmptyProperties::ItemChange() should never be called (!)");
+ }
+
+ void EmptyProperties::PostItemChange(const sal_uInt16 /*nWhich*/)
+ {
+ DBG_ASSERT(sal_False, "EmptyProperties::PostItemChange() should never be called (!)");
+ }
+
+ void EmptyProperties::SetStyleSheet(SfxStyleSheet* /*pNewStyleSheet*/, sal_Bool /*bDontRemoveHardAttr*/)
+ {
+ DBG_ASSERT(sal_False, "EmptyProperties::SetStyleSheet() should never be called (!)");
+ }
+
+ SfxStyleSheet* EmptyProperties::GetStyleSheet() const
+ {
+ DBG_ASSERT(sal_False, "EmptyProperties::GetStyleSheet() should never be called (!)");
+ return 0L;
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/graphicproperties.cxx b/svx/source/sdr/properties/graphicproperties.cxx
new file mode 100644
index 000000000000..3afdb66c6daf
--- /dev/null
+++ b/svx/source/sdr/properties/graphicproperties.cxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/graphicproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svl/style.hxx>
+#include <svx/svddef.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/sdgcpitm.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ // create a new itemset
+ SfxItemSet& GraphicProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return *(new SfxItemSet(rPool,
+
+ // range from SdrAttrObj
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+
+ // range from SdrGrafObj
+ SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST,
+
+ // range from SdrTextObj
+ EE_ITEMS_START, EE_ITEMS_END,
+
+ // end
+ 0, 0));
+ }
+
+ GraphicProperties::GraphicProperties(SdrObject& rObj)
+ : RectangleProperties(rObj)
+ {
+ }
+
+ GraphicProperties::GraphicProperties(const GraphicProperties& rProps, SdrObject& rObj)
+ : RectangleProperties(rProps, rObj)
+ {
+ }
+
+ GraphicProperties::~GraphicProperties()
+ {
+ }
+
+ BaseProperties& GraphicProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new GraphicProperties(*this, rObj));
+ }
+
+ void GraphicProperties::ItemSetChanged(const SfxItemSet& rSet)
+ {
+ SdrGrafObj& rObj = (SdrGrafObj&)GetSdrObject();
+
+ // local changes
+ rObj.SetXPolyDirty();
+
+ // #i29367# Update GraphicAttr, too. This was formerly
+ // triggered by SdrGrafObj::Notify, which is no longer
+ // called nowadays. BTW: strictly speaking, the whole
+ // ImpSetAttrToGrafInfo/ImpSetGrafInfoToAttr stuff could
+ // be dumped, when SdrGrafObj::aGrafInfo is removed and
+ // always created on the fly for repaint.
+ rObj.ImpSetAttrToGrafInfo();
+
+ // call parent
+ RectangleProperties::ItemSetChanged(rSet);
+ }
+
+ void GraphicProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ SdrGrafObj& rObj = (SdrGrafObj&)GetSdrObject();
+
+ // local changes
+ rObj.SetXPolyDirty();
+
+ // call parent
+ RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+
+ // local changes
+ rObj.ImpSetAttrToGrafInfo();
+ }
+
+ void GraphicProperties::ForceDefaultAttributes()
+ {
+ // call parent
+ RectangleProperties::ForceDefaultAttributes();
+
+ // force ItemSet
+ GetObjectItemSet();
+
+ mpItemSet->Put( SdrGrafLuminanceItem( 0 ) );
+ mpItemSet->Put( SdrGrafContrastItem( 0 ) );
+ mpItemSet->Put( SdrGrafRedItem( 0 ) );
+ mpItemSet->Put( SdrGrafGreenItem( 0 ) );
+ mpItemSet->Put( SdrGrafBlueItem( 0 ) );
+ mpItemSet->Put( SdrGrafGamma100Item( 100 ) );
+ mpItemSet->Put( SdrGrafTransparenceItem( 0 ) );
+ mpItemSet->Put( SdrGrafInvertItem( sal_False ) );
+ mpItemSet->Put( SdrGrafModeItem( GRAPHICDRAWMODE_STANDARD ) );
+ mpItemSet->Put( SdrGrafCropItem( 0, 0, 0, 0 ) );
+
+ // #i25616#
+ mpItemSet->Put( XFillStyleItem(XFILL_NONE) );
+ mpItemSet->Put( XLineStyleItem(XLINE_NONE) );
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/groupproperties.cxx b/svx/source/sdr/properties/groupproperties.cxx
new file mode 100644
index 000000000000..d55d8dcb1a16
--- /dev/null
+++ b/svx/source/sdr/properties/groupproperties.cxx
@@ -0,0 +1,298 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/groupproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svl/whiter.hxx>
+#include <svx/svddef.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdpool.hxx>
+#include <svx/svdpage.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ // create a new itemset
+ SfxItemSet& GroupProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ // Groups have in principle no ItemSet. To support methods like
+ // GetMergedItemSet() the local one is used. Thus, all items in the pool
+ // may be used and a pool itemset is created.
+ return *(new SfxItemSet(rPool));
+ }
+
+ GroupProperties::GroupProperties(SdrObject& rObj)
+ : DefaultProperties(rObj)
+ {
+ }
+
+ GroupProperties::GroupProperties(const GroupProperties& rProps, SdrObject& rObj)
+ : DefaultProperties(rProps, rObj)
+ {
+ }
+
+ GroupProperties::~GroupProperties()
+ {
+ }
+
+ BaseProperties& GroupProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new GroupProperties(*this, rObj));
+ }
+
+ const SfxItemSet& GroupProperties::GetObjectItemSet() const
+ {
+ DBG_ASSERT(sal_False, "GroupProperties::GetObjectItemSet() should never be called (!)");
+ return DefaultProperties::GetObjectItemSet();
+ }
+
+ const SfxItemSet& GroupProperties::GetMergedItemSet() const
+ {
+ // prepare ItemSet
+ if(mpItemSet)
+ {
+ // clear local itemset for merge
+ mpItemSet->ClearItem();
+ }
+ else
+ {
+ // force local itemset
+ DefaultProperties::GetObjectItemSet();
+ }
+
+ // collect all ItemSets in mpItemSet
+ const SdrObjList* pSub = ((const SdrObjGroup&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ const SfxItemSet& rSet = pSub->GetObj(a)->GetMergedItemSet();
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich(aIter.FirstWhich());
+
+ while(nWhich)
+ {
+ if(SFX_ITEM_DONTCARE == rSet.GetItemState(nWhich, sal_False))
+ {
+ mpItemSet->InvalidateItem(nWhich);
+ }
+ else
+ {
+ mpItemSet->MergeValue(rSet.Get(nWhich), sal_True);
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+ }
+
+ // For group proerties, do not call parent since groups do
+ // not have local ItemSets.
+ return *mpItemSet;
+ }
+
+ void GroupProperties::SetMergedItemSet(const SfxItemSet& rSet, sal_Bool bClearAllItems)
+ {
+ // iterate over contained SdrObjects
+ const SdrObjList* pSub = ((const SdrObjGroup&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ SdrObject* pObj = pSub->GetObj(a);
+
+ if(pObj)
+ {
+ // Set merged ItemSet at contained object
+ pObj->SetMergedItemSet(rSet, bClearAllItems);
+ }
+ }
+
+ // Do not call parent here. Group objects do not have local ItemSets
+ // where items need to be set.
+ // DefaultProperties::SetMergedItemSet(rSet, bClearAllItems);
+ }
+
+ void GroupProperties::SetObjectItem(const SfxPoolItem& /*rItem*/)
+ {
+ DBG_ASSERT(sal_False, "GroupProperties::SetObjectItem() should never be called (!)");
+ }
+
+ void GroupProperties::SetObjectItemDirect(const SfxPoolItem& /*rItem*/)
+ {
+ DBG_ASSERT(sal_False, "GroupProperties::SetObjectItemDirect() should never be called (!)");
+ }
+
+ void GroupProperties::ClearObjectItem(const sal_uInt16 /*nWhich*/)
+ {
+ DBG_ASSERT(sal_False, "GroupProperties::ClearObjectItem() should never be called (!)");
+ }
+
+ void GroupProperties::ClearObjectItemDirect(const sal_uInt16 /*nWhich*/)
+ {
+ DBG_ASSERT(sal_False, "GroupProperties::ClearObjectItemDirect() should never be called (!)");
+ }
+
+ void GroupProperties::SetMergedItem(const SfxPoolItem& rItem)
+ {
+ const SdrObjList* pSub = ((const SdrObjGroup&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ pSub->GetObj(a)->GetProperties().SetMergedItem(rItem);
+ }
+ }
+
+ void GroupProperties::ClearMergedItem(const sal_uInt16 nWhich)
+ {
+ const SdrObjList* pSub = ((const SdrObjGroup&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ pSub->GetObj(a)->GetProperties().ClearMergedItem(nWhich);
+ }
+ }
+
+ void GroupProperties::SetObjectItemSet(const SfxItemSet& /*rSet*/)
+ {
+ DBG_ASSERT(sal_False, "GroupProperties::SetObjectItemSet() should never be called (!)");
+ }
+
+ void GroupProperties::ItemSetChanged(const SfxItemSet& /*rSet*/)
+ {
+ DBG_ASSERT(sal_False, "GroupProperties::ItemSetChanged() should never be called (!)");
+ }
+
+ sal_Bool GroupProperties::AllowItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/) const
+ {
+ DBG_ASSERT(sal_False, "GroupProperties::AllowItemChange() should never be called (!)");
+ return sal_False;
+ }
+
+ void GroupProperties::ItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/)
+ {
+ DBG_ASSERT(sal_False, "GroupProperties::ItemChange() should never be called (!)");
+ }
+
+ void GroupProperties::PostItemChange(const sal_uInt16 /*nWhich*/)
+ {
+ DBG_ASSERT(sal_False, "GroupProperties::PostItemChange() should never be called (!)");
+ }
+
+ SfxStyleSheet* GroupProperties::GetStyleSheet() const
+ {
+ SfxStyleSheet* pRetval = 0L;
+
+ const SdrObjList* pSub = ((const SdrObjGroup&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ SfxStyleSheet* pCandidate = pSub->GetObj(a)->GetStyleSheet();
+
+ if(pRetval)
+ {
+ if(pCandidate != pRetval)
+ {
+ // different StyleSheelts, return none
+ return 0L;
+ }
+ }
+ else
+ {
+ pRetval = pCandidate;
+ }
+ }
+
+ return pRetval;
+ }
+
+ void GroupProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ const SdrObjList* pSub = ((const SdrObjGroup&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ pSub->GetObj(a)->SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+ }
+ }
+
+ void GroupProperties::ForceDefaultAttributes()
+ {
+ // nothing to do here, groups have no items and thus no default items, too.
+ }
+
+ void GroupProperties::MoveToItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel)
+ {
+ if(pSrcPool && pDestPool && (pSrcPool != pDestPool))
+ {
+ const SdrObjList* pSub = ((const SdrObjGroup&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ pSub->GetObj(a)->GetProperties().MoveToItemPool(pSrcPool, pDestPool, pNewModel);
+ }
+
+ // also clear local ItemSet, it's only temporary for group objects anyways.
+ if(mpItemSet)
+ {
+ // #121905#
+ // copy/paste is still using clone operators and MoveToItemPool functionality.
+ // Since SfxItemSet contains a pool pointer, ClearItem is not enough here.
+ // The ItemSet for merge is constructed on demand, so it's enough here to
+ // just delete it and set to 0L.
+ // mpItemSet->ClearItem();
+ delete mpItemSet;
+ mpItemSet = 0L;
+ }
+ }
+ }
+
+ void GroupProperties::ForceStyleToHardAttributes()
+ {
+ const SdrObjList* pSub = ((const SdrObjGroup&)GetSdrObject()).GetSubList();
+ const sal_uInt32 nCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ pSub->GetObj(a)->GetProperties().ForceStyleToHardAttributes();
+ }
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/itemsettools.cxx b/svx/source/sdr/properties/itemsettools.cxx
new file mode 100644
index 000000000000..1e804b9716df
--- /dev/null
+++ b/svx/source/sdr/properties/itemsettools.cxx
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/itemsettools.hxx>
+#include <tools/debug.hxx>
+#include <svl/itemset.hxx>
+#include <svl/whiter.hxx>
+
+#include <vector>
+#include <svx/svdogrp.hxx>
+#include <svx/svditer.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// class to remember broadcast start positions
+
+namespace sdr
+{
+ namespace properties
+ {
+ // helper vector to remember rectangles
+ typedef ::std::vector< Rectangle > RectangleVector;
+
+ ItemChangeBroadcaster::ItemChangeBroadcaster(const SdrObject& rObj)
+ {
+ if(rObj.ISA(SdrObjGroup))
+ {
+ SdrObjListIter aIter((const SdrObjGroup&)rObj, IM_DEEPNOGROUPS);
+ mpData = new RectangleVector;
+ DBG_ASSERT(mpData, "ItemChangeBroadcaster: No memory (!)");
+ ((RectangleVector*)mpData)->reserve(aIter.Count());
+
+ while(aIter.IsMore())
+ {
+ SdrObject* pObj = aIter.Next();
+
+ if(pObj)
+ {
+ ((RectangleVector*)mpData)->push_back(pObj->GetLastBoundRect());
+ }
+ }
+
+ mnCount = ((RectangleVector*)mpData)->size();
+ }
+ else
+ {
+ mpData = new Rectangle(rObj.GetLastBoundRect());
+ mnCount = 1L;
+ }
+ }
+
+ ItemChangeBroadcaster::~ItemChangeBroadcaster()
+ {
+ if(mnCount > 1)
+ {
+ delete ((RectangleVector*)mpData);
+ }
+ else
+ {
+ delete ((Rectangle*)mpData);
+ }
+ }
+
+ sal_uInt32 ItemChangeBroadcaster::GetRectangleCount() const
+ {
+ return mnCount;
+ }
+
+ const Rectangle& ItemChangeBroadcaster::GetRectangle(sal_uInt32 nIndex) const
+ {
+ if(mnCount > 1)
+ {
+ return (*((RectangleVector*)mpData))[nIndex];
+ }
+ else
+ {
+ return *((Rectangle*)mpData);
+ }
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ void ScaleItemSet(SfxItemSet& rSet, const Fraction& rScale)
+ {
+ sal_Int32 nMul(rScale.GetNumerator());
+ sal_Int32 nDiv(rScale.GetDenominator());
+
+ if(!rScale.IsValid() || !nDiv)
+ {
+ return;
+ }
+
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich(aIter.FirstWhich());
+ const SfxPoolItem *pItem = NULL;
+
+ while(nWhich)
+ {
+ if(SFX_ITEM_SET == rSet.GetItemState(nWhich, sal_False, &pItem))
+ {
+ if(pItem->HasMetrics())
+ {
+ SfxPoolItem* pNewItem = pItem->Clone();
+ pNewItem->ScaleMetrics(nMul, nDiv);
+ rSet.Put(*pNewItem);
+ }
+ }
+ nWhich = aIter.NextWhich();
+ }
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/measureproperties.cxx b/svx/source/sdr/properties/measureproperties.cxx
new file mode 100644
index 000000000000..522f3e44e686
--- /dev/null
+++ b/svx/source/sdr/properties/measureproperties.cxx
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/measureproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svl/style.hxx>
+#include <svx/svddef.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/svdomeas.hxx>
+#include <svx/sxmsuitm.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/xlnstwit.hxx>
+#include <svx/xlnedit.hxx>
+#include <svx/xlnedwit.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ // create a new itemset
+ SfxItemSet& MeasureProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return *(new SfxItemSet(rPool,
+
+ // range from SdrAttrObj
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+
+ // range from SdrMeasureObj
+ SDRATTR_MEASURE_FIRST, SDRATTR_MEASURE_LAST,
+
+ // range from SdrTextObj
+ EE_ITEMS_START, EE_ITEMS_END,
+
+ // end
+ 0, 0));
+ }
+
+ MeasureProperties::MeasureProperties(SdrObject& rObj)
+ : TextProperties(rObj)
+ {
+ }
+
+ MeasureProperties::MeasureProperties(const MeasureProperties& rProps, SdrObject& rObj)
+ : TextProperties(rProps, rObj)
+ {
+ }
+
+ MeasureProperties::~MeasureProperties()
+ {
+ }
+
+ BaseProperties& MeasureProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new MeasureProperties(*this, rObj));
+ }
+
+ void MeasureProperties::ItemSetChanged(const SfxItemSet& rSet)
+ {
+ SdrMeasureObj& rObj = (SdrMeasureObj&)GetSdrObject();
+
+ // call parent
+ TextProperties::ItemSetChanged(rSet);
+
+ // local changes
+ rObj.SetTextDirty();
+ }
+
+ void MeasureProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ SdrMeasureObj& rObj = (SdrMeasureObj&)GetSdrObject();
+
+ // local changes
+ rObj.SetTextDirty();
+
+ // call parent
+ TextProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+ }
+
+ void MeasureProperties::ForceDefaultAttributes()
+ {
+ // call parent
+ TextProperties::ForceDefaultAttributes();
+
+ // force ItemSet
+ GetObjectItemSet();
+
+ //#71958# by default, the show units Bool-Item is set as hard
+ // attribute to sal_True to aviod confusion when copying SdrMeasureObj's
+ // from one application to another
+ mpItemSet->Put(SdrMeasureShowUnitItem(sal_True));
+
+ basegfx::B2DPolygon aNewPolygon;
+ aNewPolygon.append(basegfx::B2DPoint(100.0, 0.0));
+ aNewPolygon.append(basegfx::B2DPoint(200.0, 400.0));
+ aNewPolygon.append(basegfx::B2DPoint(0.0, 400.0));
+ aNewPolygon.setClosed(true);
+
+ mpItemSet->Put(XLineStartItem(String(), basegfx::B2DPolyPolygon(aNewPolygon)));
+ mpItemSet->Put(XLineStartWidthItem(200));
+ mpItemSet->Put(XLineEndItem(String(), basegfx::B2DPolyPolygon(aNewPolygon)));
+ mpItemSet->Put(XLineEndWidthItem(200));
+ mpItemSet->Put(XLineStyleItem(XLINE_SOLID));
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+// eof
diff --git a/svx/source/sdr/properties/oleproperties.cxx b/svx/source/sdr/properties/oleproperties.cxx
new file mode 100644
index 000000000000..b2a103bd8cfc
--- /dev/null
+++ b/svx/source/sdr/properties/oleproperties.cxx
@@ -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: graphicproperties.cxx,v $
+ * $Revision: 1.12.76.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_svx.hxx"
+
+#include <svx/sdr/properties/oleproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xlineit0.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ OleProperties::OleProperties(SdrObject& rObj)
+ : RectangleProperties(rObj)
+ {
+ }
+
+ OleProperties::OleProperties(const OleProperties& rProps, SdrObject& rObj)
+ : RectangleProperties(rProps, rObj)
+ {
+ }
+
+ OleProperties::~OleProperties()
+ {
+ }
+
+ BaseProperties& OleProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new OleProperties(*this, rObj));
+ }
+
+ void OleProperties::ForceDefaultAttributes()
+ {
+ // call parent
+ RectangleProperties::ForceDefaultAttributes();
+
+ // force ItemSet
+ GetObjectItemSet();
+
+ // #i108221#
+ mpItemSet->Put( XFillStyleItem(XFILL_NONE) );
+ mpItemSet->Put( XLineStyleItem(XLINE_NONE) );
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/pageproperties.cxx b/svx/source/sdr/properties/pageproperties.cxx
new file mode 100644
index 000000000000..2fc92633b953
--- /dev/null
+++ b/svx/source/sdr/properties/pageproperties.cxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/pageproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdpool.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ // create a new itemset
+ SfxItemSet& PageProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ // overloaded to legally return a valid ItemSet
+ return *(new SfxItemSet(rPool));
+ }
+
+ PageProperties::PageProperties(SdrObject& rObj)
+ : EmptyProperties(rObj)
+ {
+ }
+
+ PageProperties::PageProperties(const PageProperties& rProps, SdrObject& rObj)
+ : EmptyProperties(rProps, rObj)
+ {
+ }
+
+ PageProperties::~PageProperties()
+ {
+ }
+
+ BaseProperties& PageProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new PageProperties(*this, rObj));
+ }
+
+ // get itemset. Overloaded here to allow creating the empty itemset
+ // without asserting
+ const SfxItemSet& PageProperties::GetObjectItemSet() const
+ {
+ if(!mpEmptyItemSet)
+ {
+ ((PageProperties*)this)->mpEmptyItemSet = &(((PageProperties*)this)->CreateObjectSpecificItemSet(*GetSdrObject().GetObjectItemPool()));
+ }
+
+ DBG_ASSERT(mpEmptyItemSet, "Could not create an SfxItemSet(!)");
+
+ return *mpEmptyItemSet;
+ }
+
+ void PageProperties::ItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/)
+ {
+ // #86481# simply ignore item setting on page objects
+ }
+
+ SfxStyleSheet* PageProperties::GetStyleSheet() const
+ {
+ // overloaded to legally return a 0L pointer here
+ return 0L;
+ }
+
+ void PageProperties::ClearObjectItem(const sal_uInt16 /*nWhich*/)
+ {
+ // simply ignore item clearing on page objects
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+// eof
diff --git a/svx/source/sdr/properties/properties.cxx b/svx/source/sdr/properties/properties.cxx
new file mode 100644
index 000000000000..f8c307f26309
--- /dev/null
+++ b/svx/source/sdr/properties/properties.cxx
@@ -0,0 +1,189 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/properties.hxx>
+#include <svx/sdr/properties/itemsettools.hxx>
+#include <svl/itemset.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svditer.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ BaseProperties::BaseProperties(SdrObject& rObj)
+ : mrObject(rObj)
+ {
+ }
+
+ BaseProperties::BaseProperties(const BaseProperties& /*rProps*/, SdrObject& rObj)
+ : mrObject(rObj)
+ {
+ }
+
+ BaseProperties::~BaseProperties()
+ {
+ }
+
+ const SfxItemSet& BaseProperties::GetMergedItemSet() const
+ {
+ // default implementation falls back to GetObjectItemSet()
+ return GetObjectItemSet();
+ }
+
+ void BaseProperties::SetMergedItemSet(const SfxItemSet& rSet, sal_Bool bClearAllItems)
+ {
+ // clear items if requested
+ if(bClearAllItems)
+ {
+ ClearObjectItem();
+ }
+
+ // default implementation falls back to SetObjectItemSet()
+ SetObjectItemSet(rSet);
+ }
+
+ void BaseProperties::SetMergedItem(const SfxPoolItem& rItem)
+ {
+ // default implementation falls back to SetObjectItem()
+ SetObjectItem(rItem);
+ }
+
+ void BaseProperties::ClearMergedItem(const sal_uInt16 nWhich)
+ {
+ // default implementation falls back to ClearObjectItem()
+ ClearObjectItem(nWhich);
+ }
+
+ void BaseProperties::Scale(const Fraction& /*rScale*/)
+ {
+ // default implementation does nothing; overload where
+ // an ItemSet is implemented.
+ }
+
+ void BaseProperties::MoveToItemPool(SfxItemPool* /*pSrcPool*/, SfxItemPool* /*pDestPool*/, SdrModel* /*pNewModel*/)
+ {
+ // Move properties to a new ItemPool. Default implementation does nothing.
+ // Overload where an ItemSet is implemented.
+ }
+
+ void BaseProperties::SetModel(SdrModel* /*pOldModel*/, SdrModel* /*pNewModel*/)
+ {
+ // Set new model. Default implementation does nothing.
+ // Overload where an ItemSet is implemented.
+ }
+
+ void BaseProperties::ForceStyleToHardAttributes()
+ {
+ // force all attributes which come from styles to hard attributes
+ // to be able to live without the style. Default implementation does nothing.
+ // Overload where an ItemSet is implemented.
+ }
+
+ //void BaseProperties::SetItemAndBroadcast(const SfxPoolItem& rItem)
+ //{
+ // ItemChangeBroadcaster aC(GetSdrObject());
+ // SetObjectItem(rItem);
+ // BroadcastItemChange(aC);
+ //}
+
+ //void BaseProperties::ClearItemAndBroadcast(const sal_uInt16 nWhich)
+ //{
+ // ItemChangeBroadcaster aC(GetSdrObject());
+ // ClearObjectItem(nWhich);
+ // BroadcastItemChange(aC);
+ //}
+
+ void BaseProperties::SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, sal_Bool bClearAllItems)
+ {
+ ItemChangeBroadcaster aC(GetSdrObject());
+
+ if(bClearAllItems)
+ {
+ ClearObjectItem();
+ }
+
+ SetMergedItemSet(rSet);
+ BroadcastItemChange(aC);
+ }
+
+ const SfxPoolItem& BaseProperties::GetItem(const sal_uInt16 nWhich) const
+ {
+ return GetObjectItemSet().Get(nWhich);
+ }
+
+ void BaseProperties::BroadcastItemChange(const ItemChangeBroadcaster& rChange)
+ {
+ const sal_uInt32 nCount(rChange.GetRectangleCount());
+
+ // #110094#-14 Reduce to do only second change
+ //// invalidate all remembered rectangles
+ //for(sal_uInt32 a(0); a < nCount; a++)
+ //{
+ // GetSdrObject().BroadcastObjectChange(rChange.GetRectangle(a));
+ //}
+
+ // invalidate all new rectangles
+ if(GetSdrObject().ISA(SdrObjGroup))
+ {
+ SdrObjListIter aIter((SdrObjGroup&)GetSdrObject(), IM_DEEPNOGROUPS);
+
+ while(aIter.IsMore())
+ {
+ SdrObject* pObj = aIter.Next();
+ // This is done with ItemSetChanged
+ // pObj->SetChanged();
+ pObj->BroadcastObjectChange();
+ }
+ }
+ else
+ {
+ // This is done with ItemSetChanged
+ // GetSdrObject().SetChanged();
+ GetSdrObject().BroadcastObjectChange();
+ }
+
+ // also send the user calls
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ GetSdrObject().SendUserCall(SDRUSERCALL_CHGATTR, rChange.GetRectangle(a));
+ }
+ }
+
+ sal_uInt32 BaseProperties::getVersion() const
+ {
+ return 0;
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/rectangleproperties.cxx b/svx/source/sdr/properties/rectangleproperties.cxx
new file mode 100644
index 000000000000..21907df0018d
--- /dev/null
+++ b/svx/source/sdr/properties/rectangleproperties.cxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/rectangleproperties.hxx>
+#include <svx/svdorect.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ RectangleProperties::RectangleProperties(SdrObject& rObj)
+ : TextProperties(rObj)
+ {
+ }
+
+ RectangleProperties::RectangleProperties(const RectangleProperties& rProps, SdrObject& rObj)
+ : TextProperties(rProps, rObj)
+ {
+ }
+
+ RectangleProperties::~RectangleProperties()
+ {
+ }
+
+ BaseProperties& RectangleProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new RectangleProperties(*this, rObj));
+ }
+
+ void RectangleProperties::ItemSetChanged(const SfxItemSet& rSet)
+ {
+ SdrRectObj& rObj = (SdrRectObj&)GetSdrObject();
+
+ // call parent
+ TextProperties::ItemSetChanged(rSet);
+
+ // local changes
+ rObj.SetXPolyDirty();
+ }
+
+ // set a new StyleSheet and broadcast
+ void RectangleProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ SdrRectObj& rObj = (SdrRectObj&)GetSdrObject();
+
+ // call parent
+ TextProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+
+ // local changes
+ rObj.SetXPolyDirty();
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx
new file mode 100644
index 000000000000..b7f2cc5474e6
--- /dev/null
+++ b/svx/source/sdr/properties/textproperties.cxx
@@ -0,0 +1,638 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/properties/textproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svl/style.hxx>
+#include <svl/itemiter.hxx>
+#include <svl/smplhint.hxx>
+#include <svx/svddef.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/svdoutl.hxx>
+#include <editeng/writingmodeitem.hxx>
+#include <svx/svdmodel.hxx>
+#include <editeng/outlobj.hxx>
+#include <svx/xflclit.hxx>
+#include <editeng/adjitem.hxx>
+#include <svx/svdetc.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/flditem.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svx/svdpool.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace properties
+ {
+ SfxItemSet& TextProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return *(new SfxItemSet(rPool,
+
+ // range from SdrAttrObj
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+
+ // range from SdrTextObj
+ EE_ITEMS_START, EE_ITEMS_END,
+
+ // end
+ 0, 0));
+ }
+
+ TextProperties::TextProperties(SdrObject& rObj)
+ : AttributeProperties(rObj),
+ maVersion(0)
+ {
+ }
+
+ TextProperties::TextProperties(const TextProperties& rProps, SdrObject& rObj)
+ : AttributeProperties(rProps, rObj),
+ maVersion(rProps.getVersion())
+ {
+ }
+
+ TextProperties::~TextProperties()
+ {
+ }
+
+ BaseProperties& TextProperties::Clone(SdrObject& rObj) const
+ {
+ return *(new TextProperties(*this, rObj));
+ }
+
+ 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 );
+
+ OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : 0;
+
+ if(pParaObj)
+ {
+ const bool bTextEdit = rObj.IsTextEditActive() && (rObj.getActiveText() == pText);
+
+ // handle outliner attributes
+ GetObjectItemSet();
+ Outliner* pOutliner = rObj.GetTextEditOutliner();
+
+ if(!bTextEdit)
+ {
+ pOutliner = &rObj.ImpGetDrawOutliner();
+ pOutliner->SetText(*pParaObj);
+ }
+
+ sal_uInt32 nParaCount(pOutliner->GetParagraphCount());
+
+ for(sal_uInt16 nPara = 0; nPara < nParaCount; nPara++)
+ {
+ SfxItemSet aSet(pOutliner->GetParaAttribs(nPara));
+ aSet.Put(rSet);
+ pOutliner->SetParaAttribs(nPara, aSet);
+ }
+
+ if(!bTextEdit)
+ {
+ if(nParaCount)
+ {
+ // force ItemSet
+ GetObjectItemSet();
+
+ SfxItemSet aNewSet(pOutliner->GetParaAttribs(0L));
+ mpItemSet->Put(aNewSet);
+ }
+
+ OutlinerParaObject* pTemp = pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount);
+ pOutliner->Clear();
+
+ rObj.NbcSetOutlinerParaObjectForText(pTemp,pText);
+ }
+ }
+ }
+
+ // Extra-Repaint for radical layout changes (#43139#)
+ if(SFX_ITEM_SET == rSet.GetItemState(SDRATTR_TEXT_CONTOURFRAME))
+ {
+ // Here only repaint wanted
+ rObj.ActionChanged();
+ //rObj.BroadcastObjectChange();
+ }
+
+ // call parent
+ AttributeProperties::ItemSetChanged(rSet);
+ }
+
+ void TextProperties::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem)
+ {
+ SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
+
+ // #i25616#
+ sal_Int32 nOldLineWidth(0L);
+
+ if(XATTR_LINEWIDTH == nWhich && rObj.DoesSupportTextIndentingOnLineWidthChange())
+ {
+ nOldLineWidth = ((const XLineWidthItem&)GetItem(XATTR_LINEWIDTH)).GetValue();
+ }
+
+ if(pNewItem && (SDRATTR_TEXTDIRECTION == nWhich))
+ {
+ sal_Bool bVertical(com::sun::star::text::WritingMode_TB_RL == ((SvxWritingModeItem*)pNewItem)->GetValue());
+ rObj.SetVerticalWriting(bVertical);
+ }
+
+ // #95501# reset to default
+ if(!pNewItem && !nWhich && rObj.HasText() )
+ {
+ SdrOutliner& rOutliner = rObj.ImpGetDrawOutliner();
+
+ sal_Int32 nCount = rObj.getTextCount();
+ while( nCount-- )
+ {
+ SdrText* pText = rObj.getText( nCount );
+ OutlinerParaObject* pParaObj = pText->GetOutlinerParaObject();
+ if( pParaObj )
+ {
+ rOutliner.SetText(*pParaObj);
+ sal_uInt32 nParaCount(rOutliner.GetParagraphCount());
+
+ if(nParaCount)
+ {
+ ESelection aSelection( 0, 0, EE_PARA_ALL, EE_PARA_ALL);
+ rOutliner.RemoveAttribs(aSelection, sal_True, 0);
+
+ OutlinerParaObject* pTemp = rOutliner.CreateParaObject(0, (sal_uInt16)nParaCount);
+ rOutliner.Clear();
+
+ rObj.NbcSetOutlinerParaObjectForText( pTemp, pText );
+ }
+ }
+ }
+ }
+
+ // call parent
+ AttributeProperties::ItemChange( nWhich, pNewItem );
+
+ // #i25616#
+ if(XATTR_LINEWIDTH == nWhich && rObj.DoesSupportTextIndentingOnLineWidthChange())
+ {
+ const sal_Int32 nNewLineWidth(((const XLineWidthItem&)GetItem(XATTR_LINEWIDTH)).GetValue());
+ const sal_Int32 nDifference((nNewLineWidth - nOldLineWidth) / 2);
+
+ if(nDifference)
+ {
+ const sal_Bool bLineVisible(XLINE_NONE != ((const XLineStyleItem&)(GetItem(XATTR_LINESTYLE))).GetValue());
+
+ if(bLineVisible)
+ {
+ const sal_Int32 nLeftDist(((const SdrTextLeftDistItem&)GetItem(SDRATTR_TEXT_LEFTDIST)).GetValue());
+ const sal_Int32 nRightDist(((const SdrTextRightDistItem&)GetItem(SDRATTR_TEXT_RIGHTDIST)).GetValue());
+ const sal_Int32 nUpperDist(((const SdrTextUpperDistItem&)GetItem(SDRATTR_TEXT_UPPERDIST)).GetValue());
+ const sal_Int32 nLowerDist(((const SdrTextLowerDistItem&)GetItem(SDRATTR_TEXT_LOWERDIST)).GetValue());
+
+ SetObjectItemDirect(SdrTextLeftDistItem(nLeftDist + nDifference));
+ SetObjectItemDirect(SdrTextRightDistItem(nRightDist + nDifference));
+ SetObjectItemDirect(SdrTextUpperDistItem(nUpperDist + nDifference));
+ SetObjectItemDirect(SdrTextLowerDistItem(nLowerDist + nDifference));
+ }
+ }
+ }
+ }
+
+ void TextProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
+
+ // call parent
+ AttributeProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+
+ // #i101556# StyleSheet has changed -> new version
+ maVersion++;
+
+ if( rObj.GetModel() /*&& !rObj.IsTextEditActive()*/ && !rObj.IsLinkedText() )
+ {
+ SdrOutliner& rOutliner = rObj.ImpGetDrawOutliner();
+
+ sal_Int32 nText = rObj.getTextCount();
+
+ while( --nText >= 0 )
+ {
+ SdrText* pText = rObj.getText( nText );
+
+ OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : 0;
+ if( !pParaObj )
+ continue;
+
+ // apply StyleSheet to all paragraphs
+ rOutliner.SetText(*pParaObj);
+ sal_uInt32 nParaCount(rOutliner.GetParagraphCount());
+
+ if(nParaCount)
+ {
+ for(sal_uInt16 nPara = 0; nPara < nParaCount; nPara++)
+ {
+ SfxItemSet* pTempSet = 0L;
+
+ // since setting the stylesheet removes all para attributes
+ if(bDontRemoveHardAttr)
+ {
+ // we need to remember them if we want to keep them
+ pTempSet = new SfxItemSet(rOutliner.GetParaAttribs(nPara));
+ }
+
+ if(GetStyleSheet())
+ {
+ if((OBJ_OUTLINETEXT == rObj.GetTextKind()) && (SdrInventor == rObj.GetObjInventor()))
+ {
+ String aNewStyleSheetName(GetStyleSheet()->GetName());
+ aNewStyleSheetName.Erase(aNewStyleSheetName.Len() - 1, 1);
+ sal_Int16 nDepth = rOutliner.GetDepth((sal_uInt16)nPara);
+ aNewStyleSheetName += String::CreateFromInt32( nDepth <= 0 ? 1 : nDepth + 1);
+
+ SdrModel* pModel = rObj.GetModel();
+ SfxStyleSheetBasePool* pStylePool = (pModel != NULL) ? pModel->GetStyleSheetPool() : 0L;
+ SfxStyleSheet* pNewStyle = (SfxStyleSheet*)pStylePool->Find(aNewStyleSheetName, GetStyleSheet()->GetFamily());
+ DBG_ASSERT( pNewStyle, "AutoStyleSheetName - Style not found!" );
+
+ if(pNewStyle)
+ {
+ rOutliner.SetStyleSheet(nPara, pNewStyle);
+ }
+ }
+ else
+ {
+ rOutliner.SetStyleSheet(nPara, GetStyleSheet());
+ }
+ }
+ else
+ {
+ // remove StyleSheet
+ rOutliner.SetStyleSheet(nPara, 0L);
+ }
+
+ if(bDontRemoveHardAttr)
+ {
+ if(pTempSet)
+ {
+ // restore para attributes
+ rOutliner.SetParaAttribs(nPara, *pTempSet);
+ }
+ }
+ else
+ {
+ if(pNewStyleSheet)
+ {
+ // remove all hard paragraph attributes
+ // which occur in StyleSheet, take care of
+ // parents (!)
+ SfxItemIter aIter(pNewStyleSheet->GetItemSet());
+ const SfxPoolItem* pItem = aIter.FirstItem();
+
+ while(pItem)
+ {
+ if(!IsInvalidItem(pItem))
+ {
+ sal_uInt16 nW(pItem->Which());
+
+ if(nW >= EE_ITEMS_START && nW <= EE_ITEMS_END)
+ {
+ rOutliner.QuickRemoveCharAttribs((sal_uInt16)nPara, nW);
+ }
+ }
+ pItem = aIter.NextItem();
+ }
+ }
+ }
+
+ if(pTempSet)
+ {
+ delete pTempSet;
+ }
+ }
+
+ OutlinerParaObject* pTemp = rOutliner.CreateParaObject(0, (sal_uInt16)nParaCount);
+ rOutliner.Clear();
+ rObj.NbcSetOutlinerParaObjectForText(pTemp, pText);
+ }
+ }
+ }
+
+ if(rObj.IsTextFrame())
+ {
+ rObj.NbcAdjustTextFrameWidthAndHeight();
+ }
+ }
+
+ void TextProperties::ForceDefaultAttributes()
+ {
+ SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
+
+ if( rObj.GetObjInventor() == SdrInventor )
+ {
+ const sal_uInt16 nSdrObjKind = rObj.GetObjIdentifier();
+
+ if( nSdrObjKind == OBJ_TITLETEXT || nSdrObjKind == OBJ_OUTLINETEXT )
+ return; // no defaults for presentation objects
+ }
+
+ bool bTextFrame(rObj.IsTextFrame());
+
+ // force ItemSet
+ GetObjectItemSet();
+
+ if(bTextFrame)
+ {
+ mpItemSet->Put(XLineStyleItem(XLINE_NONE));
+ mpItemSet->Put(XFillColorItem(String(), Color(COL_WHITE)));
+ mpItemSet->Put(XFillStyleItem(XFILL_NONE));
+ }
+ else
+ {
+ mpItemSet->Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST));
+ mpItemSet->Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER));
+ mpItemSet->Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER));
+ }
+ }
+
+ void TextProperties::ForceStyleToHardAttributes()
+ {
+ // #i61284# call parent first to get the hard ObjectItemSet
+ AttributeProperties::ForceStyleToHardAttributes();
+
+ // #i61284# push hard ObjectItemSet to OutlinerParaObject attributes
+ // using existing functionality
+ GetObjectItemSet(); // force ItemSet
+ ItemSetChanged(*mpItemSet);
+
+ // now the standard TextProperties stuff
+ SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
+
+ if(rObj.GetModel()
+ && !rObj.IsTextEditActive()
+ && !rObj.IsLinkedText())
+ {
+ Outliner* pOutliner = SdrMakeOutliner(OUTLINERMODE_OUTLINEOBJECT, rObj.GetModel());
+ sal_Int32 nText = rObj.getTextCount();
+
+ while( --nText >= 0 )
+ {
+ SdrText* pText = rObj.getText( nText );
+
+ OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : 0;
+ if( !pParaObj )
+ continue;
+
+ pOutliner->SetText(*pParaObj);
+
+ sal_uInt32 nParaCount(pOutliner->GetParagraphCount());
+
+ if(nParaCount)
+ {
+ sal_Bool bBurnIn(sal_False);
+
+ for(sal_uInt16 nPara = 0; nPara < nParaCount; nPara++)
+ {
+ SfxStyleSheet* pSheet = pOutliner->GetStyleSheet(nPara);
+
+ if(pSheet)
+ {
+ SfxItemSet aParaSet(pOutliner->GetParaAttribs(nPara));
+ SfxItemSet aSet(*aParaSet.GetPool());
+ aSet.Put(pSheet->GetItemSet());
+
+ /** the next code handles a special case for paragraphs that contain a
+ url field. The color for URL fields is either the system color for
+ urls or the char color attribute that formats the portion in which the
+ url field is contained.
+ When we set a char color attribute to the paragraphs item set from the
+ styles item set, we would have this char color attribute as an attribute
+ that is spanned over the complete paragraph after xml import due to some
+ problems in the xml import (using a XCursor on import so it does not know
+ the paragraphs and can't set char attributes to paragraphs ).
+
+ To avoid this, as soon as we try to set a char color attribute from the style
+ we
+ 1. check if we have at least one url field in this paragraph
+ 2. if we found at least one url field, we span the char color attribute over
+ all portions that are not url fields and remove the char color attribute
+ from the paragraphs item set
+ */
+
+ sal_Bool bHasURL(sal_False);
+
+ if(aSet.GetItemState(EE_CHAR_COLOR) == SFX_ITEM_SET)
+ {
+ EditEngine* pEditEngine = const_cast<EditEngine*>(&(pOutliner->GetEditEngine()));
+ EECharAttribArray aAttribs;
+ pEditEngine->GetCharAttribs((sal_uInt16)nPara, aAttribs);
+ sal_uInt16 nAttrib;
+
+ for(nAttrib = 0; nAttrib < aAttribs.Count(); nAttrib++)
+ {
+ struct EECharAttrib aAttrib(aAttribs.GetObject(nAttrib));
+
+ if(EE_FEATURE_FIELD == aAttrib.pAttr->Which())
+ {
+ if(aAttrib.pAttr)
+ {
+ SvxFieldItem* pFieldItem = (SvxFieldItem*)aAttrib.pAttr;
+
+ if(pFieldItem)
+ {
+ const SvxFieldData* pData = pFieldItem->GetField();
+
+ if(pData && pData->ISA(SvxURLField))
+ {
+ bHasURL = sal_True;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if(bHasURL)
+ {
+ SfxItemSet aColorSet(*aSet.GetPool(), EE_CHAR_COLOR, EE_CHAR_COLOR );
+ aColorSet.Put(aSet, sal_False);
+
+ ESelection aSel((sal_uInt16)nPara, 0);
+
+ for(nAttrib = 0; nAttrib < aAttribs.Count(); nAttrib++)
+ {
+ struct EECharAttrib aAttrib(aAttribs.GetObject(nAttrib));
+
+ if(EE_FEATURE_FIELD == aAttrib.pAttr->Which())
+ {
+ aSel.nEndPos = aAttrib.nStart;
+
+ if(aSel.nStartPos != aSel.nEndPos)
+ {
+ pEditEngine->QuickSetAttribs(aColorSet, aSel);
+ }
+
+ aSel.nStartPos = aAttrib.nEnd;
+ }
+ }
+
+ aSel.nEndPos = pEditEngine->GetTextLen((sal_uInt16)nPara);
+
+ if(aSel.nStartPos != aSel.nEndPos)
+ {
+ pEditEngine->QuickSetAttribs( aColorSet, aSel );
+ }
+ }
+
+ }
+
+ aSet.Put(aParaSet, sal_False);
+
+ if(bHasURL)
+ {
+ aSet.ClearItem(EE_CHAR_COLOR);
+ }
+
+ pOutliner->SetParaAttribs(nPara, aSet);
+ bBurnIn = sal_True; // #i51163# Flag was set wrong
+ }
+ }
+
+ if(bBurnIn)
+ {
+ OutlinerParaObject* pTemp = pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount);
+ rObj.NbcSetOutlinerParaObjectForText(pTemp,pText);
+ }
+ }
+
+ pOutliner->Clear();
+ }
+ delete pOutliner;
+ }
+ }
+
+ void TextProperties::SetObjectItemNoBroadcast(const SfxPoolItem& rItem)
+ {
+ GetObjectItemSet();
+ mpItemSet->Put(rItem);
+ }
+
+
+ void TextProperties::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
+ {
+ // call parent
+ AttributeProperties::Notify(rBC, rHint);
+
+ SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
+ if(rObj.HasText())
+ {
+ if(HAS_BASE(SfxStyleSheet, &rBC))
+ {
+ SfxSimpleHint* pSimple = PTR_CAST(SfxSimpleHint, &rHint);
+ sal_uInt32 nId(pSimple ? pSimple->GetId() : 0L);
+
+ if(SFX_HINT_DATACHANGED == nId)
+ {
+ rObj.SetPortionInfoChecked(sal_False);
+
+ sal_Int32 nText = rObj.getTextCount();
+ while( --nText > 0 )
+ {
+ OutlinerParaObject* pParaObj = rObj.getText(nText )->GetOutlinerParaObject();
+ if( pParaObj )
+ pParaObj->ClearPortionInfo();
+ }
+ rObj.SetTextSizeDirty();
+
+ if(rObj.IsTextFrame() && rObj.NbcAdjustTextFrameWidthAndHeight())
+ {
+ // here only repaint wanted
+ rObj.ActionChanged();
+ //rObj.BroadcastObjectChange();
+ }
+
+ // #i101556# content of StyleSheet has changed -> new version
+ maVersion++;
+ }
+
+ if(SFX_HINT_DYING == nId)
+ {
+ rObj.SetPortionInfoChecked(sal_False);
+ sal_Int32 nText = rObj.getTextCount();
+ while( --nText > 0 )
+ {
+ OutlinerParaObject* pParaObj = rObj.getText(nText )->GetOutlinerParaObject();
+ if( pParaObj )
+ pParaObj->ClearPortionInfo();
+ }
+ }
+ }
+ else if(HAS_BASE(SfxStyleSheetBasePool, &rBC))
+ {
+ SfxStyleSheetHintExtended* pExtendedHint = PTR_CAST(SfxStyleSheetHintExtended, &rHint);
+
+ if(pExtendedHint
+ && SFX_STYLESHEET_MODIFIED == pExtendedHint->GetHint())
+ {
+ String aOldName(pExtendedHint->GetOldName());
+ String aNewName(pExtendedHint->GetStyleSheet()->GetName());
+ SfxStyleFamily eFamily = pExtendedHint->GetStyleSheet()->GetFamily();
+
+ if(!aOldName.Equals(aNewName))
+ {
+ sal_Int32 nText = rObj.getTextCount();
+ while( --nText > 0 )
+ {
+ OutlinerParaObject* pParaObj = rObj.getText(nText )->GetOutlinerParaObject();
+ if( pParaObj )
+ pParaObj->ChangeStyleSheetName(eFamily, aOldName, aNewName);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // #i101556# Handout version information
+ sal_uInt32 TextProperties::getVersion() const
+ {
+ return maVersion;
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/smarttags/SmartTagMgr.cxx b/svx/source/smarttags/SmartTagMgr.cxx
new file mode 100644
index 000000000000..dabb4e21231e
--- /dev/null
+++ b/svx/source/smarttags/SmartTagMgr.cxx
@@ -0,0 +1,552 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// SMARTTAGS
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/SmartTagMgr.hxx>
+
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <com/sun/star/smarttags/XSmartTagRecognizer.hpp>
+#include <com/sun/star/smarttags/XSmartTagAction.hpp>
+#include <com/sun/star/deployment/ExtensionManager.hpp>
+#include <com/sun/star/text/XTextMarkup.hpp>
+#include <com/sun/star/smarttags/SmartTagRecognizerMode.hpp>
+#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/lang/EventObject.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XSingleComponentFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XContentEnumerationAccess.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/util/XChangesBatch.hpp>
+#include <com/sun/star/util/XChangesNotifier.hpp>
+#include <comphelper/processfactory.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/string.hxx>
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+#define C2U(cChar) rtl::OUString::createFromAscii(cChar)
+
+
+SmartTagMgr::SmartTagMgr( const rtl::OUString& rApplicationName )
+ : maApplicationName( rApplicationName ),
+ maRecognizerList(),
+ maActionList(),
+ maDisabledSmartTagTypes(),
+ maSmartTagMap(),
+ mxMSF( ::comphelper::getProcessServiceFactory() ),
+ mbLabelTextWithSmartTags(true)
+{
+}
+
+SmartTagMgr::~SmartTagMgr()
+{
+}
+
+void SmartTagMgr::Init( const rtl::OUString& rConfigurationGroupName )
+{
+ // get component context to pass to components:
+ if ( mxMSF.is() )
+ {
+ Reference< beans::XPropertySet > xPropSet = Reference< beans::XPropertySet>( mxMSF, UNO_QUERY);
+ const Any aAny = xPropSet->getPropertyValue( C2U("DefaultContext"));
+ aAny >>= mxContext;
+
+ if ( mxContext.is() )
+ {
+ PrepareConfiguration( rConfigurationGroupName );
+ ReadConfiguration( true, true );
+ RegisterListener();
+ LoadLibraries();
+ }
+ }
+}
+void SmartTagMgr::CreateBreakIterator() const
+{
+ if ( !mxBreakIter.is() && mxMSF.is() && mxContext.is() )
+ {
+ // get the break iterator
+ mxBreakIter.set(mxMSF->createInstance( C2U( "com.sun.star.i18n.BreakIterator" ) ), UNO_QUERY);
+ }
+}
+
+/** Dispatches the recognize call to all installed smart tag recognizers
+*/
+void SmartTagMgr::Recognize( const rtl::OUString& rText,
+ const Reference< text::XTextMarkup > xMarkup,
+ const Reference< frame::XController > xController,
+ const lang::Locale& rLocale,
+ sal_uInt32 nStart, sal_uInt32 nLen ) const
+{
+ for ( sal_uInt32 i = 0; i < maRecognizerList.size(); i++ )
+ {
+ Reference < smarttags::XSmartTagRecognizer > xRecognizer = maRecognizerList[i];
+
+ // if all smart tag types supported by this recognizer have been
+ // disabled, we do not have to call the recognizer:
+ bool bCallRecognizer = false;
+ const sal_uInt32 nSmartTagCount = xRecognizer->getSmartTagCount();
+ for ( sal_uInt32 j = 0; j < nSmartTagCount && !bCallRecognizer; ++j )
+ {
+ const rtl::OUString aSmartTagName = xRecognizer->getSmartTagName(j);
+ if ( IsSmartTagTypeEnabled( aSmartTagName ) )
+ bCallRecognizer = true;
+ }
+
+ if ( bCallRecognizer )
+ {
+ CreateBreakIterator();
+ maRecognizerList[i]->recognize( rText, nStart, nLen,
+ smarttags::SmartTagRecognizerMode_PARAGRAPH,
+ rLocale, xMarkup, maApplicationName, xController,
+ mxBreakIter );
+ }
+ }
+}
+
+typedef std::multimap < rtl::OUString, ActionReference >::const_iterator SmartTagMapIter;
+
+void SmartTagMgr::GetActionSequences( Sequence < rtl::OUString >& rSmartTagTypes,
+ Sequence < Sequence< Reference< smarttags::XSmartTagAction > > >& rActionComponentsSequence,
+ Sequence < Sequence< sal_Int32 > >& rActionIndicesSequence ) const
+{
+ rActionComponentsSequence.realloc( rSmartTagTypes.getLength() );
+ rActionIndicesSequence.realloc( rSmartTagTypes.getLength() );
+
+ for ( sal_uInt16 j = 0; j < rSmartTagTypes.getLength(); ++j )
+ {
+ const rtl::OUString& rSmartTagType = rSmartTagTypes[j];
+
+ const sal_Int32 nNumberOfActionRefs = maSmartTagMap.count( rSmartTagType );
+
+ Sequence< Reference< smarttags::XSmartTagAction > > aActions( nNumberOfActionRefs );
+ Sequence< sal_Int32 > aIndices( nNumberOfActionRefs );
+
+ sal_uInt16 i = 0;
+ SmartTagMapIter aActionsIter;
+ SmartTagMapIter aEnd = maSmartTagMap.upper_bound( rSmartTagType );
+
+ for ( aActionsIter = maSmartTagMap.lower_bound( rSmartTagType ); aActionsIter != aEnd; ++aActionsIter )
+ {
+ aActions[ i ] = (*aActionsIter).second.mxSmartTagAction;
+ aIndices[ i++ ] = (*aActionsIter).second.mnSmartTagIndex;
+ }
+
+ rActionComponentsSequence[ j ] = aActions;
+ rActionIndicesSequence[ j ] = aIndices;
+ }
+}
+
+/** Returns the caption for a smart tag type.
+*/
+rtl::OUString SmartTagMgr::GetSmartTagCaption( const rtl::OUString& rSmartTagType, const com::sun::star::lang::Locale& rLocale ) const
+{
+ rtl::OUString aRet;
+
+ SmartTagMapIter aLower = maSmartTagMap.lower_bound( rSmartTagType );
+
+ if ( aLower != maSmartTagMap.end() )
+ {
+ const ActionReference& rActionRef = (*aLower).second;
+ Reference< smarttags::XSmartTagAction > xAction = rActionRef.mxSmartTagAction;
+
+ if ( xAction.is() )
+ {
+ const sal_Int32 nSmartTagIndex = rActionRef.mnSmartTagIndex;
+ aRet = xAction->getSmartTagCaption( nSmartTagIndex, rLocale );
+ }
+ }
+
+ return aRet;
+}
+
+
+/** Returns true if the given smart tag type is enabled.
+*/
+bool SmartTagMgr::IsSmartTagTypeEnabled( const rtl::OUString& rSmartTagType ) const
+{
+ return maDisabledSmartTagTypes.end() == maDisabledSmartTagTypes.find( rSmartTagType );
+}
+
+/** Writes currently disabled smart tag types to configuration.
+*/
+void SmartTagMgr::WriteConfiguration( const bool* pIsLabelTextWithSmartTags,
+ const std::vector< rtl::OUString >* pDisabledTypes ) const
+{
+ if ( mxConfigurationSettings.is() )
+ {
+ bool bCommit = false;
+
+ if ( pIsLabelTextWithSmartTags )
+ {
+ const Any aEnabled = makeAny( *pIsLabelTextWithSmartTags );
+
+ try
+ {
+ mxConfigurationSettings->setPropertyValue( C2U("RecognizeSmartTags"), aEnabled );
+ bCommit = true;
+ }
+ catch ( ::com::sun::star::uno::Exception& )
+ {
+ }
+ }
+
+ if ( pDisabledTypes )
+ {
+ const sal_Int32 nNumberOfDisabledSmartTagTypes = pDisabledTypes->size();
+ Sequence< rtl::OUString > aTypes( nNumberOfDisabledSmartTagTypes );
+
+ std::vector< rtl::OUString >::const_iterator aIter;
+ sal_Int32 nCount = 0;
+ for ( aIter = pDisabledTypes->begin(); aIter != pDisabledTypes->end(); ++aIter )
+ aTypes[ nCount++ ] = *aIter;
+
+ const Any aNewTypes = makeAny( aTypes );
+
+ try
+ {
+ mxConfigurationSettings->setPropertyValue( C2U("ExcludedSmartTagTypes"), aNewTypes );
+ bCommit = true;
+ }
+ catch ( ::com::sun::star::uno::Exception& )
+ {
+ }
+ }
+
+ if ( bCommit )
+ {
+ try
+ {
+ Reference< util::XChangesBatch >( mxConfigurationSettings, UNO_QUERY_THROW )->commitChanges();
+ }
+ catch ( ::com::sun::star::uno::Exception& )
+ {
+ }
+ }
+ }
+}
+
+// ::com::sun::star::util::XModifyListener
+void SmartTagMgr::modified( const lang::EventObject& ) throw( RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ maRecognizerList.clear();
+ maActionList.clear();
+ maSmartTagMap.clear();
+
+ LoadLibraries();
+}
+
+// ::com::sun::star::lang::XEventListener
+void SmartTagMgr::disposing( const lang::EventObject& rEvent ) throw( RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ uno::Reference< frame::XModel > xModel( rEvent.Source, uno::UNO_QUERY );
+ uno::Reference< util::XModifyBroadcaster > xMB(xModel, uno::UNO_QUERY);
+ uno::Reference< util::XChangesNotifier > xCN(xModel, uno::UNO_QUERY);
+
+ try
+ {
+ if( xMB.is() )
+ {
+ uno::Reference< util::XModifyListener > xListener( this );
+ xMB->removeModifyListener( xListener );
+ }
+ else if ( xCN.is() )
+ {
+ uno::Reference< util::XChangesListener > xListener( this );
+ xCN->removeChangesListener( xListener );
+ }
+ }
+ catch(Exception& )
+ {
+ }
+}
+
+// ::com::sun::star::util::XChangesListener
+void SmartTagMgr::changesOccurred( const util::ChangesEvent& rEvent ) throw( RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ const util::ElementChange* pElementChanges = rEvent.Changes.getConstArray();
+ const sal_Int32 nNumberOfChanges = rEvent.Changes.getLength();
+ bool bExcludedTypes = false;
+ bool bRecognize = false;
+
+ for( sal_Int32 i = 0; i < nNumberOfChanges; ++i)
+ {
+ rtl::OUString sTemp;
+ pElementChanges[i].Accessor >>= sTemp;
+
+ if ( sTemp == C2U( "ExcludedSmartTagTypes" ) )
+ bExcludedTypes = true;
+ else if ( sTemp == C2U( "RecognizeSmartTags" ) )
+ bRecognize = true;
+ }
+
+ ReadConfiguration( bExcludedTypes, bRecognize );
+}
+
+//------------- PRIVATE -----------------------------------------------
+
+/**
+*/
+void SmartTagMgr::LoadLibraries()
+{
+ Reference< container::XContentEnumerationAccess > rContent( mxMSF , UNO_QUERY );
+ if ( !rContent.is() )
+ return;
+
+ // load recognizers: No recognizers -> nothing to do.
+ Reference < container::XEnumeration > rEnum = rContent->createContentEnumeration( C2U("com.sun.star.smarttags.SmartTagRecognizer"));
+ if ( !rEnum.is() || !rEnum->hasMoreElements() )
+ return;
+
+ // iterate over all implementations of the smart tag recognizer service:
+ while( rEnum->hasMoreElements())
+ {
+ const Any a = rEnum->nextElement();
+ Reference< lang::XSingleComponentFactory > xSCF;
+ Reference< lang::XServiceInfo > xsInfo;
+
+ if (a >>= xsInfo)
+ xSCF = Reference< lang::XSingleComponentFactory >(xsInfo, UNO_QUERY);
+ else
+ continue;
+
+ Reference< smarttags::XSmartTagRecognizer > xLib ( xSCF->
+ createInstanceWithContext(mxContext), UNO_QUERY );
+
+ if (!xLib.is())
+ continue;
+
+ xLib->initialize( Sequence< Any >() );
+ maRecognizerList.push_back(xLib);
+ }
+
+ // load actions: No actions -> nothing to do.
+ rEnum = rContent->createContentEnumeration( C2U("com.sun.star.smarttags.SmartTagAction"));
+ if ( !rEnum.is() )
+ return;
+
+ // iterate over all implementations of the smart tag action service:
+ while( rEnum->hasMoreElements())
+ {
+ const Any a = rEnum->nextElement();
+ Reference< lang::XServiceInfo > xsInfo;
+ Reference< lang::XSingleComponentFactory > xSCF;
+
+ if (a >>= xsInfo)
+ xSCF = Reference< lang::XSingleComponentFactory >(xsInfo, UNO_QUERY);
+ else
+ continue;
+
+ Reference< smarttags::XSmartTagAction > xLib ( xSCF->
+ createInstanceWithContext(mxContext), UNO_QUERY );
+
+ if (!xLib.is())
+ continue;
+
+ xLib->initialize( Sequence< Any >() );
+ maActionList.push_back(xLib);
+ }
+
+ AssociateActionsWithRecognizers();
+
+}
+
+/**
+*/
+void SmartTagMgr::PrepareConfiguration( const rtl::OUString& rConfigurationGroupName )
+{
+ Any aAny = makeAny( C2U( "/org.openoffice.Office.Common/SmartTags/" ) + rConfigurationGroupName );
+ beans::PropertyValue aPathArgument;
+ aPathArgument.Name = C2U( "nodepath" );
+ aPathArgument.Value = aAny;
+ Sequence< Any > aArguments( 1 );
+ aArguments[ 0 ] <<= aPathArgument;
+ Reference< lang::XMultiServiceFactory > xConfProv( mxMSF->createInstance(C2U ("com.sun.star.configuration.ConfigurationProvider")), UNO_QUERY );
+
+ if ( !xConfProv.is() )
+ return;
+
+ // try to get read-write access to configuration:
+ Reference< XInterface > xConfigurationAccess;
+ try
+ {
+ xConfigurationAccess = xConfProv->createInstanceWithArguments(
+ C2U("com.sun.star.configuration.ConfigurationUpdateAccess" ), aArguments );
+ }
+ catch ( uno::Exception& )
+ {
+ }
+
+ // fallback: try read-only access to configuration:
+ if ( !xConfigurationAccess.is() )
+ {
+ try
+ {
+ xConfigurationAccess = xConfProv->createInstanceWithArguments(
+ C2U("com.sun.star.configuration.ConfigurationAccess" ), aArguments );
+ }
+ catch ( uno::Exception& )
+ {
+ }
+ }
+
+ if ( xConfigurationAccess.is() )
+ {
+ mxConfigurationSettings = Reference< beans::XPropertySet >( xConfigurationAccess, UNO_QUERY );
+ }
+}
+
+
+void SmartTagMgr::ReadConfiguration( bool bExcludedTypes, bool bRecognize )
+{
+ if ( mxConfigurationSettings.is() )
+ {
+ if ( bExcludedTypes )
+ {
+ maDisabledSmartTagTypes.clear();
+
+ Any aAny = mxConfigurationSettings->getPropertyValue( C2U("ExcludedSmartTagTypes") );
+ Sequence< rtl::OUString > aValues;
+ aAny >>= aValues;
+
+ const sal_Int32 nValues = aValues.getLength();
+
+ for ( sal_Int32 nI = 0; nI < nValues; ++nI )
+ maDisabledSmartTagTypes.insert( aValues[nI] );
+ }
+
+ if ( bRecognize )
+ {
+ Any aAny = mxConfigurationSettings->getPropertyValue( C2U("RecognizeSmartTags") );
+ sal_Bool bValue = sal_True;
+ aAny >>= bValue;
+
+ mbLabelTextWithSmartTags = bValue;
+ }
+ }
+}
+
+/**
+*/
+void SmartTagMgr::RegisterListener()
+{
+ // register as listener at package manager
+ try
+ {
+ Reference<deployment::XExtensionManager> xExtensionManager(
+ deployment::ExtensionManager::get( mxContext ) );
+ Reference< util::XModifyBroadcaster > xMB ( xExtensionManager, UNO_QUERY_THROW );
+
+ Reference< util::XModifyListener > xListener( this );
+ xMB->addModifyListener( xListener );
+ }
+ catch ( uno::Exception& )
+ {
+ }
+
+ // register as listener at configuration
+ try
+ {
+ Reference<util::XChangesNotifier> xCN( mxConfigurationSettings, UNO_QUERY_THROW );
+ Reference< util::XChangesListener > xListener( this );
+ xCN->addChangesListener( xListener );
+ }
+ catch ( uno::Exception& )
+ {
+ }
+}
+
+typedef std::pair < const rtl::OUString, ActionReference > SmartTagMapElement;
+
+/** Sets up a map that maps smart tag type names to actions references.
+*/
+void SmartTagMgr::AssociateActionsWithRecognizers()
+{
+ const sal_uInt32 nActionLibCount = maActionList.size();
+ const sal_uInt32 nRecognizerCount = maRecognizerList.size();
+
+ for ( sal_uInt32 i = 0; i < nRecognizerCount; ++i )
+ {
+ Reference < smarttags::XSmartTagRecognizer > xRecognizer = maRecognizerList[i];
+ const sal_uInt32 nSmartTagCount = xRecognizer->getSmartTagCount();
+ for ( sal_uInt32 j = 0; j < nSmartTagCount; ++j )
+ {
+ const rtl::OUString aSmartTagName = xRecognizer->getSmartTagName(j);
+
+ // check if smart tag type has already been processed:
+ if ( maSmartTagMap.find( aSmartTagName ) != maSmartTagMap.end() )
+ continue;
+
+ bool bFound = false;
+ for ( sal_uInt32 k = 0; k < nActionLibCount; ++k )
+ {
+ Reference< smarttags::XSmartTagAction > xActionLib = maActionList[k];
+ const sal_uInt32 nSmartTagCountInActionLib = xActionLib->getSmartTagCount();
+ for ( sal_uInt32 l = 0; l < nSmartTagCountInActionLib; ++l )
+ {
+ const rtl::OUString aSmartTagNameInActionLib = xActionLib->getSmartTagName(l);
+ if ( aSmartTagName.equals( aSmartTagNameInActionLib ) )
+ {
+ // found actions and recognizer for same smarttag
+ ActionReference aActionRef( xActionLib, l );
+
+ // add recognizer/action pair to map
+ maSmartTagMap.insert( SmartTagMapElement( aSmartTagName, aActionRef ));
+
+ bFound = true;
+ }
+ }
+ }
+
+ if ( !bFound )
+ {
+ // insert 'empty' action reference if there is no action associated with
+ // the current smart tag type:
+ Reference< smarttags::XSmartTagAction > xActionLib;
+ ActionReference aActionRef( xActionLib, 0 );
+
+ // add recognizer/action pair to map
+ maSmartTagMap.insert( SmartTagMapElement( aSmartTagName, aActionRef ));
+ }
+ }
+ }
+}
+
diff --git a/svx/source/src/app.hrc b/svx/source/src/app.hrc
new file mode 100644
index 000000000000..a1fa24179dc4
--- /dev/null
+++ b/svx/source/src/app.hrc
@@ -0,0 +1,441 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// Resource-Id's for OFA
+
+#ifndef _OFF_APP_HRC
+#define _OFF_APP_HRC
+
+// include ---------------------------------------------------------------
+
+#include <svl/solar.hrc>
+#include <sfx2/sfxsids.hrc>
+
+// Ranges ----------------------------------------------------------------
+
+// PB: Vorsicht diesen Bereich hier im app.hrc nicht mehr benutzen!
+#define RID_OFA_LDAP_START (RID_OFA_START + 300)
+#define RID_OFA_LDAP_END (RID_OFA_START + 349)
+
+// defines ---------------------------------------------------------------
+
+#define RID_QRY_SELECTMAILADDR (RID_OFA_START + 0)
+#define RID_QRY_NEWMAILADDR (RID_OFA_START + 1)
+#define RID_QRY_SELECTBRWADDR (RID_OFA_START + 2)
+#define RID_QRY_NEWBRWADDR (RID_OFA_START + 3)
+#define RID_QRY_NO_URL (RID_OFA_START + 4)
+#define RID_QRY_NO_MAILADDR (RID_OFA_START + 5)
+#define RID_QRY_NO_NAME (RID_OFA_START + 6)
+#define RID_QRY_INVALID_URL (RID_OFA_START + 7)
+#define RID_QRY_DEL_MAIL (RID_OFA_START + 8)
+#define RID_QRY_ADDRESSBOOK (RID_OFA_START + 9)
+#define RID_QRY_NO_ADDR (RID_OFA_START + 10)
+
+ // String und ToolBox
+#define RID_MAILTOOLBOX (RID_OFA_START + 112)
+#define RID_QRY_SELECTADDR (RID_OFA_START + 13)
+
+#define RID_ICO_MSGVIEW (RID_OFA_START + 20)
+#define RID_WIN_MAILHEADER (RID_OFA_START + 21)
+#define RID_WIN_MAILATTACH (RID_OFA_START + 22)
+#define RID_IMG_MAILTEXT (RID_OFA_START + 23)
+#define RID_MSGDOC_MENU (RID_OFA_START + 24)
+#define RID_ATTACH_MENU (RID_OFA_START + 25)
+#define RID_HEADER_MENU (RID_OFA_START + 26)
+#define RID_CALENDAR_WIN (RID_OFA_START + 27)
+#define RID_STA_NEWSWIN_TITEL (RID_OFA_START + 28)
+#define RID_SEND_MENU (RID_OFA_START + 29)
+
+
+// Icons and Images ------------------------------------------------------
+
+#define RID_ICO_TABLES (RID_OFA_START + 30)
+#define RID_ICO_QUERIES (RID_OFA_START + 31)
+#define RID_ICO_FORMS (RID_OFA_START + 32)
+#define RID_ICO_REPORTS (RID_OFA_START + 33)
+#define RID_ICO_DATABASE (RID_OFA_START + 34)
+#define RID_IMG_ALTFOLDER_CLOSE (RID_OFA_START + 35)
+#define RID_IMG_ALTFOLDER_OPEN (RID_OFA_START + 36)
+#define RID_IMG_ALTFOLDER_PLUS (RID_OFA_START + 37)
+#define RID_IMG_ALTFOLDER_MINUS (RID_OFA_START + 38)
+#define RID_IMGLIST_PGP (RID_OFA_START + 39)
+#define RID_IMGLIST_LARGE_PGP (RID_OFA_START + 40)
+
+// Errors ----------------------------------------------------------------
+
+#define RID_ERR_OUTBOX (RID_OFA_START + 50)
+#define RID_ERR_DB_OPENPROPERTIES (RID_OFA_START + 51)
+#define RID_ERR_NO_EMAILADDRESS (RID_OFA_START + 52)
+#define RID_QBOX_NOSUBJECT (RID_OFA_START + 53)
+#define RID_ERRBOX_NORECIPIENTS (RID_OFA_START + 54)
+#define RID_ERRBOX_NOSETTINGS (RID_OFA_START + 55)
+#define RID_QBOX_ADDADDRESS (RID_OFA_START + 56)
+#define RID_ERR_NO_DD_FOR_ADDRESSBOOK (RID_OFA_START + 57)
+#define RID_QBOX_NORCPTS (RID_OFA_START + 58)
+#define RID_QBOX_FORMATS (RID_OFA_START + 59)
+#define RID_ERRBOX_NOVALIDRCPTS (RID_OFA_START + 60)
+#define RID_QBOX_SAVEMAIL (RID_OFA_START + 61)
+#define RID_WARNBOX_LOCKEDFILE (RID_OFA_START + 62)
+#define RID_QBOX_COMPRESS (RID_OFA_START + 63)
+#define RID_ERRBOX_APPENDADDRESS (RID_OFA_START + 64)
+#define RID_QBOX_DELETEATTACHMENT (RID_OFA_START + 65)
+#define RID_ERRBOX_NO_OUTBOX (RID_OFA_START + 66)
+#define RID_WARNDLG_ONLY_ASCII (RID_OFA_START + 67)
+#define RID_ERR_TABLE_LOCKED (RID_OFA_START + 68)
+#define RID_ERR_OBJECT_LOCKED (RID_OFA_START + 69)
+#define RID_ERR_NAME_INVALID (RID_OFA_START + 70)
+#define RID_INFO_TABLE_NO_SELECT (RID_OFA_START + 71)
+#define RID_ERRBOX_MODULENOTINSTALLED (RID_OFA_START + 72)
+
+// Dialoge ---------------------------------------------------------------
+
+#define RID_OFAPAGE_HTMLOPT (RID_OFA_START + 100)
+#define RID_OFA_AUTOCORR_DLG (RID_OFA_START + 101)
+#define RID_OFAPAGE_AUTOCORR_OPTIONS (RID_OFA_START + 102)
+#define RID_OFAPAGE_AUTOCORR_REPLACE (RID_OFA_START + 103)
+#define RID_OFAPAGE_AUTOCORR_EXCEPT (RID_OFA_START + 104)
+#define RID_OFA_GENERAL_OPTIONS_DLG (RID_OFA_START + 105)
+#define RID_OFADLG_INTERNET (RID_OFA_START + 106)
+#define RID_OFA_TABNEW_DLG (RID_OFA_START + 107)
+#define RID_OFADLG_BROWSER (RID_OFA_START + 108)
+#define RID_OFAPAGE_AUTOCORR_QUOTE (RID_OFA_START + 109)
+#define RID_OFAPAGE_AUTOFMT_APPLY (RID_OFA_START + 110)
+#define RID_OFADLG_PRCNT_SET (RID_OFA_START + 111)
+#define RID_OFA_FORMNEW_DLG (RID_OFA_START + 112)
+#define RID_OFA_TABPROPERTIES (RID_OFA_START + 113)
+#define RID_OFADLG_REGISTRATION (RID_OFA_START + 114)
+#define RID_OFADLG_OPTIONS_TREE (RID_OFA_START + 115)
+#define RID_OFADLG_OPTIONS_TREE_PAGES (RID_OFA_START + 116)
+#define RID_OFADLG_AWCP_VALUES (RID_OFA_START + 117)
+#define RID_OFAPAGE_AUTOCOMPLETE_OPTIONS (RID_OFA_START + 119)
+#define RID_OFAPAGE_MSFILTEROPT (RID_OFA_START + 120)
+#define RID_OFAPAGE_MSFILTEROPT2 (RID_OFA_START + 121)
+#define RID_OFAPAGE_CONNPOOLOPTIONS (RID_OFA_START + 122)
+
+// TabPages --------------------------------------------------------------
+
+#define OFA_TP_MISC (RID_OFA_START + 200)
+
+#define OFA_TP_VIEW (RID_OFA_START + 202)
+#define OFA_TP_APPEARANCE (RID_OFA_START + 203)
+#define OFA_TP_TABPROPERTIES_GENERAL (RID_OFA_START + 204)
+#define OFA_TP_LANGUAGES (RID_OFA_START + 205)
+
+//die RID_??_TP_* stehen nochmal im offids.hrc
+#define RID_SW_TP_CONTENT_OPT (RID_OFA_START + 206)
+#define RID_SW_TP_LAYOUT_OPT (RID_OFA_START + 207)
+#define RID_SW_TP_STD_FONT (RID_OFA_START + 208)
+#define RID_SW_TP_OPTPRINT_PAGE (RID_OFA_START + 209)
+#define RID_SW_TP_OPTTABLE_PAGE (RID_OFA_START + 210)
+#define RID_SW_TP_OPTSHDWCRSR (RID_OFA_START + 211)
+#define RID_SW_TP_REDLINE_OPT (RID_OFA_START + 212)
+#define RID_SW_TP_OPTINSERT_PAGE (RID_OFA_START + 213)
+#define RID_SW_TP_OPTLOAD_PAGE (RID_OFA_START + 214)
+#define RID_SW_TP_OPTTEST_PAGE (RID_OFA_START + 215)
+#define RID_SW_TP_OPTSRCVIEW (RID_OFA_START + 216)
+#define RID_SW_TP_BACKGROUND (RID_OFA_START + 217)
+#define SID_SC_TP_LAYOUT (RID_OFA_START + 218)
+#define SID_SC_TP_CONTENT (RID_OFA_START + 219)
+#define SID_SC_TP_INPUT (RID_OFA_START + 220)
+#define SID_SC_TP_GRID (RID_OFA_START + 221)
+#define SID_SC_TP_USERLISTS (RID_OFA_START + 222)
+#define SID_SC_TP_CALC (RID_OFA_START + 223)
+#define SID_SC_TP_CHANGES (RID_OFA_START + 224)
+#define SID_SD_TP_CONTENTS (RID_OFA_START + 225)
+#define SID_SD_TP_LAYOUT (RID_OFA_START + 226)
+#define SID_SD_TP_SNAP (RID_OFA_START + 227)
+#define SID_SD_TP_SCALE (RID_OFA_START + 228)
+#define SID_SD_TP_GRID (RID_OFA_START + 229)
+#define SID_SD_TP_PRINT (RID_OFA_START + 220)
+#define SID_SD_TP_MISC (RID_OFA_START + 231)
+#define SID_SI_TP_CONTENTS (RID_OFA_START + 232)
+#define SID_SI_TP_LAYOUT (RID_OFA_START + 233)
+#define SID_SI_TP_SNAP (RID_OFA_START + 234)
+#define SID_SI_TP_GRID (RID_OFA_START + 235)
+#define SID_SI_TP_PRINT (RID_OFA_START + 236)
+#define SID_SI_TP_MISC (RID_OFA_START + 237)
+#define RID_SW_TP_OPTINSERT_HTML_PAGE (RID_OFA_START + 238)
+#define SID_SC_TP_MISC (RID_OFA_START + 239)
+#define RID_SW_TP_HTML_CONTENT_OPT (RID_OFA_START + 240)
+#define RID_SW_TP_HTML_LAYOUT_OPT (RID_OFA_START + 241)
+#define RID_SW_TP_HTML_OPTPRINT_PAGE (RID_OFA_START + 242)
+#define RID_SW_TP_HTML_OPTTABLE_PAGE (RID_OFA_START + 243)
+#define RID_SW_TP_HTML_OPTGRID_PAGE (RID_OFA_START + 244)
+#define OFA_TP_TABPROPERTIES_TEXT (RID_OFA_START + 245)
+#define RID_SW_TP_HTML_OPTSHDWCRSR (RID_OFA_START + 246)
+#define RID_SW_TP_STD_FONT_CJK (RID_OFA_START + 247)
+#define RID_SC_TP_PRINT (RID_OFA_START + 248)
+#define OFA_TP_HELPERPROG (RID_OFA_START + 249)
+#define OFA_TP_MEMORY (RID_OFA_START + 250)
+#define RID_SW_TP_STD_FONT_CTL (RID_OFA_START + 251)
+#define RID_OFA_TP_INTERNATIONAL (RID_OFA_START + 252) // 4 SC & ID 4 resource
+#define RID_OFA_TP_INTERNATIONAL_SD (RID_OFA_START + 253) // 4 SD
+#define RID_OFA_TP_INTERNATIONAL_IMPR (RID_OFA_START + 254) // 4 impress
+#define RID_SW_TP_OPTCOMPATIBILITY_PAGE (RID_OFA_START + 255)
+#define RID_SW_TP_OPTCAPTION_PAGE (RID_OFA_START + 256)
+
+// Strings ------------------------------------------
+
+#define RID_STR_ROLE_TO (RID_OFA_START + 0)
+#define RID_STR_ROLE_CC (RID_OFA_START + 1)
+#define RID_STR_ROLE_BCC (RID_OFA_START + 2)
+#define RID_STR_NEWMAIL (RID_OFA_START + 3)
+#define RID_STR_MAIL (RID_OFA_START + 4)
+#define RID_STR_DETACH (RID_OFA_START + 5)
+#define RID_STR_SUBJECT (RID_OFA_START + 6)
+#define RID_STR_AUTHOR (RID_OFA_START + 7)
+#define RID_STR_DATE (RID_OFA_START + 108)
+#define RID_DESKTOP (RID_OFA_START + 109)
+#define RID_STR_ROLE_VIM (RID_OFA_START + 110)
+
+#define RID_RIDER_SLL_SITE (RID_OFA_START + 100)
+#define RID_RIDER_SLL_PERSONAL (RID_OFA_START + 101)
+
+// Bitmaps ---------------------------------------------------------------
+
+#define RID_BMP_DB_DATABASE_S (RID_OFA_START + 150)
+#define RID_BMP_DB_DATABASE_L (RID_OFA_START + 151)
+#define RID_BMP_DB_TABLEFOLDER_S (RID_OFA_START + 152)
+#define RID_BMP_DB_TABLEFOLDER_L (RID_OFA_START + 153)
+#define RID_BMP_DB_TABLE_S (RID_OFA_START + 154)
+#define RID_BMP_DB_TABLE_L (RID_OFA_START + 155)
+#define RID_BMP_DB_QUERYFOLDER_S (RID_OFA_START + 156)
+#define RID_BMP_DB_QUERYFOLDER_L (RID_OFA_START + 157)
+#define RID_BMP_DB_QUERY_S (RID_OFA_START + 158)
+#define RID_BMP_DB_QUERY_L (RID_OFA_START + 159)
+#define RID_BMP_DB_FORMFOLDER_S (RID_OFA_START + 160)
+#define RID_BMP_DB_FORMFOLDER_L (RID_OFA_START + 161)
+#define RID_BMP_DB_FORM_S (RID_OFA_START + 162)
+#define RID_BMP_DB_FORM_L (RID_OFA_START + 163)
+#define RID_BMP_DB_REPORTFOLDER_S (RID_OFA_START + 164)
+#define RID_BMP_DB_REPORTFOLDER_L (RID_OFA_START + 165)
+#define RID_BMP_DB_REPORT_S (RID_OFA_START + 166)
+#define RID_BMP_DB_REPORT_L (RID_OFA_START + 167)
+#define RID_BMP_DB_STATEMENT_S (RID_OFA_START + 168)
+#define RID_BMP_DB_STATEMENT_L (RID_OFA_START + 169)
+#define RID_BMP_DB_VIEW_S (RID_OFA_START + 170)
+#define RID_BMP_DB_VIEW_L (RID_OFA_START + 171)
+#define RID_BMP_DB_RELATIONS_S (RID_OFA_START + 172)
+#define RID_BMP_DB_RELATIONS_L (RID_OFA_START + 173)
+#define RID_IMGLIST_TREEOPT (RID_OFA_START + 174)
+#define RID_IMGLIST_TREEOPT_HC (RID_OFA_START + 175)
+
+ // 12 und 13 nicht benutzen!!!
+// ..._BEGIN kann nochmal benutzt werden, nur zum Iterieren
+#define RID_STR_PRIO_BEGIN (RID_OFA_START + 17)
+#define RID_STR_PRIO_HIGHEST (RID_OFA_START + 18)
+#define RID_STR_PRIO_HIGH (RID_OFA_START + 19)
+#define RID_STR_PRIO_NORMAL (RID_OFA_START + 20)
+#define RID_STR_PRIO_LOW (RID_OFA_START + 21)
+#define RID_STR_PRIO_LOWEST (RID_OFA_START + 22)
+
+// Datenbank / Explorer
+
+#define RID_STR_NAME_DATABASE (RID_OFA_START + 23)
+#define RID_STR_NAME_TABLES (RID_OFA_START + 24)
+#define RID_STR_NAME_TABLE (RID_OFA_START + 25)
+#define RID_STR_NAME_QUERIES (RID_OFA_START + 26)
+#define RID_STR_NAME_QUERIE (RID_OFA_START + 27)
+#define RID_STR_NAME_ADDRESSBOOK (RID_OFA_START + 28)
+#define RID_STR_QRY_DESIGNVIEW (RID_OFA_START + 29)
+#define RID_STR_QRY_SQLVIEW (RID_OFA_START + 30)
+#define RID_STR_NAME_DATABASECONTENT (RID_OFA_START + 31)
+#define RID_STR_TBL_DESIGNVIEW (RID_OFA_START + 32)
+#define RID_STR_NAME_FORMS (RID_OFA_START + 33)
+#define RID_STR_NAME_FORM (RID_OFA_START + 34)
+#define RID_STR_NAME_REPORTS (RID_OFA_START + 35)
+#define RID_STR_NAME_REPORT (RID_OFA_START + 36)
+#define RID_STR_RPT_DESIGNVIEW (RID_OFA_START + 37)
+#define RID_STR_FRM_DESIGNVIEW (RID_OFA_START + 38)
+#define RID_STR_TBL_COMPRESS (RID_OFA_START + 39)
+#define RID_STR_NAME_VIEW (RID_OFA_START + 40)
+#define RID_STR_NAME_RELATIONS (RID_OFA_START + 41)
+#define RID_STR_NAME_MANUAL_SQL (RID_OFA_START + 42)
+#define RID_STR_ACTUALIZE (RID_OFA_START + 43)
+#define RID_STR_NEW (RID_OFA_START + 44)
+#define RID_STR_WIZARD (RID_OFA_START + 45)
+#define RID_STR_IMPORTVCARD (RID_OFA_START + 46)
+#define RID_STR_EXPORTVCARD (RID_OFA_START + 47)
+#define RID_STR_ASK_COPY_REMAINING (RID_OFA_START + 48)
+#define RID_STR_ASK_MOVE_REMAINING (RID_OFA_START + 49)
+#define RID_STR_FRM_NEW_TEXTDOC (RID_OFA_START + 50)
+#define RID_STR_FRM_NEW_CALCDOC (RID_OFA_START + 51)
+#define RID_STR_FRM_NEW_IMPRESSDOC (RID_OFA_START + 52)
+#define RID_STR_FRM_NEW_AUTODOC (RID_OFA_START + 53)
+#define RID_STR_DB_REORGANIZE (RID_OFA_START + 54)
+#define RID_STR_FRM_NEW_TEMPLATE (RID_OFA_START + 55)
+
+#define RID_STR_NEWSGROUP (RID_OFA_START + 61)
+
+
+#define RID_STR_MESSAGE (RID_OFA_START + 64)
+#define RID_STR_PRINTMSG_DOC (RID_OFA_START + 66)
+#define RID_STR_PRINTMSG_SUBJECT (RID_OFA_START + 67)
+#define RID_STR_PRINTMSG_DATE (RID_OFA_START + 68)
+#define RID_STR_PRINTMSG_FROM (RID_OFA_START + 69)
+#define RID_STR_PRINTMSG_TO (RID_OFA_START + 70)
+#define RID_ERR_OPENNEWSSERVER (RID_OFA_START + 71)
+#define RID_ERR_SENDNEWS (RID_OFA_START + 72)
+#define RID_ERR_SENDMAIL (RID_OFA_START + 73)
+#define RID_ERR_NOPRINTDOC (RID_OFA_START + 74)
+#define RID_STR_ROLE_REPLY_TO (RID_OFA_START + 75)
+#define RID_STR_ROLE_FOLLOWUP_TO (RID_OFA_START + 76)
+#define RID_STR_BUTTON_SEND (RID_OFA_START + 77)
+#define RID_STR_BUTTON_SAVE (RID_OFA_START + 78)
+#define RID_STR_BUTTON_REJECT (RID_OFA_START + 79)
+#define RID_STR_CLOSE_MESSAGE (RID_OFA_START + 80)
+#define RID_STR_BUTTON_BACKTOMSG (RID_OFA_START + 81)
+#define RID_STR_CLOSE_TITLE (RID_OFA_START + 82)
+#define RID_STR_ASCII_FORMAT (RID_OFA_START + 83)
+
+// The following eight RIDs replace the message in RID_ERRBOX_NOSETTINGS:
+#define RID_ERRSTR_SMTP_NO_SERVER (RID_OFA_START + 84)
+#define RID_ERRSTR_NNTP_NO_SERVER (RID_OFA_START + 85)
+#define RID_ERRSTR_VIM_PRIV_NO_USER (RID_OFA_START + 86)
+#define RID_ERRSTR_VIM_PRIV_NO_USER_PWD (RID_OFA_START + 87)
+#define RID_ERRSTR_VIM_PUB_NO_USER (RID_OFA_START + 88)
+#define RID_ERRSTR_VIM_PUB_NO_USER_PWD (RID_OFA_START + 89)
+#define RID_ERRSTR_CREATE_OUTBOX (RID_OFA_START + 90)
+#define RID_ERRSTR_EDIT_OUTBOX (RID_OFA_START + 91)
+#define RID_ERRSTR_EDIT_ACCOUNT_PRIV (RID_OFA_START + 92)
+#define RID_ERRSTR_EDIT_ACCOUNT_PUB (RID_OFA_START + 93)
+
+#define RID_STR_NAME_USER_SETTINGS (RID_OFA_START + 94)
+#define RID_STR_FRMORREP_NAMETOLONG (RID_OFA_START + 95)
+#define RID_STR_TBL_CREATE_BACKUP (RID_OFA_START + 96)
+#define RID_STR_DB_SWITCH_FAVORITE (RID_OFA_START + 97)
+#define RID_STR_DB_FAVORITE_TTILE (RID_OFA_START + 98)
+
+
+// unnamed resources ----------------------------------------------------
+#define OFA_RES_UNNAMED_START (RID_OFA_START + 200)
+
+#define RID_RES_SBACHAOS_ERR_CONTEXTS (OFA_RES_UNNAMED_START + 1)
+
+// HelpIds ---------------------------------------------------------------
+/*
+#define HID_AUTOCORR_DLG (HID_OFA_START + 0)
+#define HID_OFAPAGE_AUTOCORR_OPTIONS (HID_OFA_START + 1)
+#define HID_OFAPAGE_AUTOCORR_REPLACE (HID_OFA_START + 2)
+#define HID_OFAPAGE_AUTOCORR_EXCEPT (HID_OFA_START + 3)
+#define HID_OFACTL_AUTOCORR_REPLACE (HID_OFA_START + 4)
+#define HID_OFAWIN_MAIL_HEADER (HID_OFA_START + 5)
+#define HID_OFAWIN_MAIL_ATTACH (HID_OFA_START + 6)
+#define HID_OFACTL_MAIL_ATTACH (HID_OFA_START + 7)
+#define HID_OFA_TP_MISC (HID_OFA_START + 8)
+#define HID_OFA_HYPERLINK (HID_OFA_START + 10)
+#define HID_OFA_DLGTABNEW (HID_OFA_START + 11)
+#define HID_OFA_HYPERLINK_DLG (HID_OFA_START + 12)
+#define HID_OFA_MAILHEAD_ROLE_LB (HID_OFA_START + 13)
+#define HID_OFA_MAILHEAD_RCPT_ED (HID_OFA_START + 14)
+#define HID_OFA_MAILHEAD_RCPT_LB (HID_OFA_START + 15)
+#define HID_OFA_MAILHEAD_SUBJECT_ED (HID_OFA_START + 16)
+#define HID_OFA_MAILHEAD_RECEIPT_CB (HID_OFA_START + 17)
+#define HID_OFA_MAILHEAD_PRIORITY_LB (HID_OFA_START + 18)
+#define HID_OFA_MAILHEAD_HEAD_WIN (HID_OFA_START + 19)
+#define HID_OFA_MAILATTACH_ATTACH_LB (HID_OFA_START + 20)
+#define HID_OFA_MAILATTACH_ASCII_CB (HID_OFA_START + 21)
+#define HID_OFA_MAILATTACH_HTML_CB (HID_OFA_START + 22)
+#define HID_OFA_MAILATTACH_RTF_CB (HID_OFA_START + 23)
+#define HID_OFA_MAILATTACH_OFFICE_CB (HID_OFA_START + 24)
+#define HID_OFA_HYPERLINK_TARGET (HID_OFA_START + 25)
+#define HID_OFA_HYPERLINK_SEARCH (HID_OFA_START + 26)
+#define HID_OFA_MAILTOOLBOX (HID_OFA_START + 27)
+#define HID_OFAPAGE_AUTOCORR_QUOTE (HID_OFA_START + 28)
+#define HID_OFA_TP_VIEW (HID_OFA_START + 29)
+#define HID_OFA_MAILMENU_OPEN (HID_OFA_START + 30)
+#define HID_OFA_MAILMENU_DELETE (HID_OFA_START + 31)
+#define HID_OFA_MAILMENU_RENAME (HID_OFA_START + 32)
+#define HID_OFA_MAILMENU_SAVEAS (HID_OFA_START + 33)
+#define HID_OFA_MAILMENU_ADDADDRESS (HID_OFA_START + 34)
+#define HID_OFA_MAILMENU_COPYLINK (HID_OFA_START + 35)
+#define HID_OFA_MAILMENU_SIG1 (HID_OFA_START + 36)
+#define HID_OFA_MAILMENU_SIG2 (HID_OFA_START + 37)
+#define HID_OFA_MAILMENU_SIG3 (HID_OFA_START + 38)
+#define HID_OFA_MAILMENU_SIG4 (HID_OFA_START + 39)
+#define HID_OFA_MAILHEAD_PROTOCOL_LB (HID_OFA_START + 42)
+#define HID_OFA_MAILATTACH_RECEIPT_CB (HID_OFA_START + 43)
+#define HID_OFA_MAILATTACH_PRIORITY_LB (HID_OFA_START + 44)
+#define HID_OFA_MAILATTACH_TABBAR (HID_OFA_START + 45)
+#define HID_OFAPAGE_AUTOCORR_CLB (HID_OFA_START + 46)
+#define HID_OFAPAGE_AUTOFORMAT_CLB (HID_OFA_START + 47)
+#define HID_OFAPAGE_AUTOFMT_OPTIONS (HID_OFA_START + 48)
+#define HID_OFA_DLGFORMNEW (HID_OFA_START + 49)
+#define HID_OFA_TP_APPEARANCE (HID_OFA_START + 50)
+#define HID_OFA_HYPERLINK_NAME (HID_OFA_START + 51)
+#define HID_OFA_HYPERLINK_URL_TXT (HID_OFA_START + 52)
+#define HID_OFA_HYPERLINK_URL (HID_OFA_START + 53)
+#define HID_OFA_MAILMENU_FILE (HID_OFA_START + 54)
+#define HID_OFA_FONT_SUBSTITUTION (HID_OFA_START + 55)
+#define HID_OFA_FONT_SUBST_CLB (HID_OFA_START + 56)
+#define HID_OFA_SUBST_APPLY (HID_OFA_START + 57)
+#define HID_OFA_SUBST_DELETE (HID_OFA_START + 58)
+#define HID_OFADLG_REGISTRATION (HID_OFA_START + 59)
+#define HID_OFA_TP_DESKTOP (HID_OFA_START + 60)
+#define HID_REGISTRATION_REGISTER (HID_OFA_START + 61)
+#define HID_REGISTRATION_ENABLE_KEY (HID_OFA_START + 62)
+#define HID_AUTOCORR_LANGUAGE (HID_OFA_START + 63)
+#define HID_OFA_MAILHEAD_RCPT_CB (HID_OFA_START + 64)
+#define HID_OFA_SENDMENU_PLAIN (HID_OFA_START + 65)
+#define HID_OFA_SENDMENU_ENCRYPT (HID_OFA_START + 66)
+#define HID_OFA_SENDMENU_SIGN (HID_OFA_START + 67)
+#define HID_OFA_SENDMENU_SIGNANDENCRYPT (HID_OFA_START + 68)
+#define HID_OFADLG_OPTIONS_TREE (HID_OFA_START + 69)
+#define HID_OFADLG_TREELISTBOX (HID_OFA_START + 70)
+#define HID_OFADLG_TREE_GENERAL (HID_OFA_START + 71)
+#define HID_OFADLG_TREE_INTERNET (HID_OFA_START + 72)
+#define HID_OFADLG_TREE_BROWSER (HID_OFA_START + 73)
+#define HID_OFADLG_TREE_TEXT (HID_OFA_START + 74)
+#define HID_OFADLG_TREE_HTML (HID_OFA_START + 75)
+#define HID_OFADLG_TREE_CALC (HID_OFA_START + 76)
+#define HID_OFADLG_TREE_PRESENTATION (HID_OFA_START + 77)
+#define HID_OFADLG_TREE_DRAWING (HID_OFA_START + 78)
+#define HID_OFADLG_TREE_IMAGE (HID_OFA_START + 79)
+#define HID_OFADLG_TREE_FORMULA (HID_OFA_START + 80)
+#define HID_OFAPAGE_AUTOCOMPLETE_OPTIONS (HID_OFA_START + 113)
+#define HID_OFADLG_TREE_CHART (HID_OFA_START + 115)
+#define HID_OFADLG_TREE_BASE (HID_OFA_START + 116)
+#define HID_OFADLG_TREE_FILTER (HID_OFA_START + 117)
+#define HID_OFAPAGE_MSFLTR2_CLB (HID_OFA_START + 118)
+#define HID_OFA_TP_LANGUAGES (HID_OFA_START + 119)
+#define HID_OFADLG_TREE_LANGUAGE (HID_OFA_START + 120)
+#define HID_OFA_CONNPOOL_DRIVERLIST (HID_OFA_START + 121)
+#define UID_OFA_CONNPOOL_DRIVERLIST_BACK (HID_OFA_START + 122)
+#define HID_OFA_TP_HELPERPROG (HID_OFA_START + 123)
+#define HID_OFA_TP_MEMORY (HID_OFA_START + 124)
+*/
+// "Uberlaufkontrolle der HID's
+#define ACT_HID_END HID_OFA_TP_MEMORY
+#if ACT_HID_END > HID_OFA_END
+#error Resource-Ueberlauf bei den HIDs der OFA
+#endif
+
+#define STR_SD_STAROFFICE_XML_DRAW (RID_OFA_START + 245)
+#define STR_SD_STAROFFICE_XML_IMPRESS (RID_OFA_START + 246)
+
+#endif
+
diff --git a/svx/source/src/app.src b/svx/source/src/app.src
new file mode 100644
index 000000000000..2fea800b4a00
--- /dev/null
+++ b/svx/source/src/app.src
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svx/svxids.hrc>
+#include "app.hrc"
+
+ //----------------------------------------------------------------------------
+String RID_APPTITLE
+{
+ Text = "%PRODUCTNAME %PRODUCTVERSION %PRODUCTEXTENSION" ;
+};
+
+#define MASKCOLOR MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; };
+
+ErrorBox RID_ERRBOX_MODULENOTINSTALLED
+{
+ Buttons = WB_OK ;
+ Message [ en-US ] = "The action could not be executed. The %PRODUCTNAME program module needed for this action is currently not installed.";
+};
+
+#define IMAGE_ID_LIST\
+ IdList = {\
+ SID_HLINKBAR_LINK; \
+ SID_HLINKBAR_SEARCH; \
+ SID_HLINKBAR_TARGET; \
+ SID_HYPERLINK_DIALOG; \
+ };\
+ IdCount = {\
+ 4;\
+ };
+
+ImageList RID_DEFAULTIMAGELIST_SC
+{
+ Prefix = "sc";
+ MASKCOLOR
+ IMAGE_ID_LIST
+};
+
+ImageList RID_DEFAULTIMAGELIST_LC
+{
+ Prefix = "lc";
+ MASKCOLOR
+ IMAGE_ID_LIST
+};
+
+ImageList RID_DEFAULTIMAGELIST_SCH
+{
+ Prefix = "sch";
+ MASKCOLOR
+ IMAGE_ID_LIST
+};
+
+ImageList RID_DEFAULTIMAGELIST_LCH
+{
+ Prefix = "lch";
+ MASKCOLOR
+ IMAGE_ID_LIST
+};
+
+// Strings ---------------------------------------------------------------
+
+String RID_DESKTOP
+{
+ Text = "%PRODUCTNAME" ;
+};
+
diff --git a/svx/source/src/errtxt.src b/svx/source/src/errtxt.src
new file mode 100644
index 000000000000..004885c45150
--- /dev/null
+++ b/svx/source/src/errtxt.src
@@ -0,0 +1,515 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define __RSC
+#include <svtools/svtools.hrc>
+#include <svtools/sfxecode.hxx>
+
+// pragma ----------------------------------------------------------------
+Resource RID_ERRCTX
+{
+ String ERRCTX_ERROR
+ {
+ Text [ en-US ] = "Error" ;
+ };
+ String ERRCTX_WARNING
+ {
+ Text [ en-US ] = "Warning" ;
+ };
+ String ERRCTX_SFX_LOADTEMPLATE
+ {
+ Text [ en-US ] = "$(ERR) loading the template $(ARG1)" ;
+ };
+ String ERRCTX_SFX_SAVEDOC
+ {
+ Text [ en-US ] = "$(ERR) saving the document $(ARG1)";
+ };
+ String ERRCTX_SFX_SAVEASDOC
+ {
+ Text [ en-US ] = "$(ERR) saving the document $(ARG1)";
+ };
+ String ERRCTX_SFX_DOCINFO
+ {
+ Text [ en-US ] = "$(ERR) displaying doc. information for document $(ARG1)" ;
+ };
+ String ERRCTX_SFX_DOCTEMPLATE
+ {
+ Text [ en-US ] = "$(ERR) writing document $(ARG1) as template" ;
+ };
+ String ERRCTX_SFX_MOVEORCOPYCONTENTS
+ {
+ Text [ en-US ] = "$(ERR) copying or moving document contents" ;
+ };
+ String ERRCTX_SFX_DOCMANAGER
+ {
+ Text [ en-US ] = "$(ERR) starting the Document Manager" ;
+ };
+ String ERRCTX_SFX_OPENDOC
+ {
+ Text [ en-US ] = "$(ERR) loading document $(ARG1)" ;
+ };
+ String ERRCTX_SFX_NEWDOCDIRECT
+ {
+ Text [ en-US ] = "$(ERR) creating a new document" ;
+ };
+ String ERRCTX_SFX_NEWDOC
+ {
+ Text [ en-US ] = "$(ERR) creating a new document" ;
+ };
+ String ERRCTX_SFX_CREATEOBJSH
+ {
+ Text [ en-US ] = "$(ERR) expanding entry" ;
+ };
+ String ERRCTX_SFX_LOADBASIC
+ {
+ Text [ en-US ] = "$(ERR) loading BASIC of document $(ARG1)" ;
+ };
+ String ERRCTX_SFX_SEARCHADDRESS
+ {
+ Text [ en-US ] = "$(ERR) searching for an address";
+ };
+};
+Resource RID_ERRHDL
+{
+ String ERRCODE_CLASS_ABORT
+ {
+ Text [ en-US ] = "Abort" ;
+ };
+ String ERRCODE_CLASS_NOTEXISTS
+ {
+ Text [ en-US ] = "Nonexistent object" ;
+ };
+ String ERRCODE_CLASS_ALREADYEXISTS
+ {
+ Text [ en-US ] = "Object already exists" ;
+ };
+ String ERRCODE_CLASS_ACCESS
+ {
+ Text [ en-US ] = "Object not accessible" ;
+ };
+ String ERRCODE_CLASS_PATH
+ {
+ Text [ en-US ] = "Inadmissible path" ;
+ };
+ String ERRCODE_CLASS_LOCKING
+ {
+ Text [ en-US ] = "Locking problem" ;
+ };
+ String ERRCODE_CLASS_PARAMETER
+ {
+ Text [ en-US ] = "Wrong parameter" ;
+ };
+ String ERRCODE_CLASS_SPACE
+ {
+ Text [ en-US ] = "Resource exhausted" ;
+ };
+ String ERRCODE_CLASS_NOTSUPPORTED
+ {
+ Text [ en-US ] = "Action not supported" ;
+ };
+ String ERRCODE_CLASS_READ
+ {
+ Text [ en-US ] = "Read-Error" ;
+ };
+ String ERRCODE_CLASS_WRITE
+ {
+ Text [ en-US ] = "Write Error" ;
+ };
+ String ERRCODE_CLASS_UNKNOWN
+ {
+ Text [ en-US ] = "unknown" ;
+ };
+ String ERRCODE_CLASS_VERSION
+ {
+ Text [ en-US ] = "Version Incompatibility" ;
+ };
+ String ERRCODE_CLASS_GENERAL
+ {
+ Text [ en-US ] = "General Error" ;
+ };
+ String ERRCODE_CLASS_FORMAT
+ {
+ Text [ en-US ] = "Incorrect format" ;
+ };
+ String ERRCODE_CLASS_CREATE
+ {
+ Text [ en-US ] = "Error creating object" ;
+ };
+ String ERRCODE_CLASS_SBX
+ {
+ Text [ en-US ] = "Inadmissible value or data type" ;
+ };
+ String ERRCODE_CLASS_RUNTIME
+ {
+ Text [ en-US ] = "BASIC runtime error" ;
+ };
+ String ERRCODE_CLASS_COMPILER
+ {
+ Text [ en-US ] = "BASIC syntax error" ;
+ };
+ String 1
+ {
+ Text [ en-US ] = "General Error" ;
+ };
+ String ERRCODE_IO_GENERAL
+ {
+ Text [ en-US ] = "General input/output error." ;
+ };
+ String ERRCODE_IO_MISPLACEDCHAR
+ {
+ Text [ en-US ] = "Invalid file name." ;
+ };
+ String ERRCODE_IO_NOTEXISTS
+ {
+ Text [ en-US ] = "Nonexistent file." ;
+ };
+ String ERRCODE_IO_ALREADYEXISTS
+ {
+ Text [ en-US ] = "File already exists." ;
+ };
+ String ERRCODE_IO_NOTADIRECTORY
+ {
+ Text [ en-US ] = "The object is not a directory." ;
+ };
+ String ERRCODE_IO_NOTAFILE
+ {
+ Text [ en-US ] = "The object is not a file." ;
+ };
+ String ERRCODE_IO_INVALIDDEVICE
+ {
+ Text [ en-US ] = "The specified device is invalid." ;
+ };
+ String ERRCODE_IO_ACCESSDENIED
+ {
+ Text [ en-US ] = "The object cannot be accessed\ndue to insufficient user rights." ;
+ };
+ String ERRCODE_IO_LOCKVIOLATION
+ {
+ Text [ en-US ] = "Sharing violation while accessing the object." ;
+ };
+ String ERRCODE_IO_OUTOFSPACE
+ {
+ Text [ en-US ] = "No more space on device." ;
+ };
+ String ERRCODE_IO_ISWILDCARD
+ {
+ Text [ en-US ] = "This operation cannot be run on\nfiles containing wildcards." ;
+ };
+ String ERRCODE_IO_NOTSUPPORTED
+ {
+ Text [ en-US ] = "This operation is not supported on this operating system." ;
+ };
+ String ERRCODE_IO_TOOMANYOPENFILES
+ {
+ Text [ en-US ] = "There are too many files open." ;
+ };
+ String ERRCODE_IO_CANTREAD
+ {
+ Text [ en-US ] = "Data could not be read from the file." ;
+ };
+ String ERRCODE_IO_CANTWRITE
+ {
+ Text [ en-US ] = "The file could not be written." ;
+ };
+ String ERRCODE_IO_OUTOFMEMORY
+ {
+ Text [ en-US ] = "The operation could not be run due to insufficient memory." ;
+ };
+ String ERRCODE_IO_CANTSEEK
+ {
+ Text [ en-US ] = "The seek operation could not be run." ;
+ };
+ String ERRCODE_IO_CANTTELL
+ {
+ Text [ en-US ] = "The tell operation could not be run." ;
+ };
+ String ERRCODE_IO_WRONGVERSION
+ {
+ Text [ en-US ] = "Incorrect file version." ;
+ };
+ String ERRCODE_IO_WRONGFORMAT
+ {
+ Text [ en-US ] = "Incorrect file format." ;
+ };
+ String ERRCODE_IO_INVALIDCHAR
+ {
+ Text [ en-US ] = "The file name contains invalid characters." ;
+ };
+ String ERRCODE_IO_UNKNOWN
+ {
+ Text [ en-US ] = "An unknown I/O error has occurred." ;
+ };
+ String ERRCODE_IO_INVALIDACCESS
+ {
+ Text [ en-US ] = "An invalid attempt was made to access the file." ;
+ };
+ String ERRCODE_IO_CANTCREATE
+ {
+ Text [ en-US ] = "The file could not be created." ;
+ };
+ String ERRCODE_IO_INVALIDPARAMETER
+ {
+ Text [ en-US ] = "The operation was started under an invalid parameter." ;
+ };
+ String ERRCODE_IO_ABORT
+ {
+ Text [ en-US ] = "The operation on the file was aborted." ;
+ };
+ String ERRCODE_IO_NOTEXISTSPATH
+ {
+ Text [ en-US ] = "Path to the file does not exist." ;
+ };
+ String ERRCODE_IO_RECURSIVE
+ {
+ Text [ en-US ] = "An object cannot be copied into itself." ;
+ };
+ String ERRCODE_SFX_NOSTDTEMPLATE
+ {
+ Text [ en-US ] = "The default template could not be opened." ;
+ };
+ String ERRCODE_SFX_TEMPLATENOTFOUND
+ {
+ Text [ en-US ] = "The specified template could not be found." ;
+ };
+ String ERRCODE_SFX_NOTATEMPLATE
+ {
+ Text [ en-US ] = "The file cannot be used as template." ;
+ };
+ String ERRCODE_SFX_CANTREADDOCINFO
+ {
+ Text [ en-US ] = "Document information could not be read from the file because\nthe document information format is unknown or because document information does not\nexist." ;
+ };
+ String ERRCODE_SFX_ALREADYOPEN
+ {
+ Text [ en-US ] = "This document has already been opened for editing." ;
+ };
+ String ERRCODE_SFX_WRONGPASSWORD
+ {
+ Text [ en-US ] = "The wrong password has been entered." ;
+ };
+ String ERRCODE_SFX_DOLOADFAILED
+ {
+ Text [ en-US ] = "Error reading file." ;
+ };
+ String ERRCODE_SFX_DOCUMENTREADONLY
+ {
+ Text [ en-US ] = "The document was opened as read-only." ;
+ };
+ String ERRCODE_SFX_OLEGENERAL
+ {
+ Text [ en-US ] = "General OLE Error." ;
+ };
+ String ERRCODE_INET_NAME_RESOLVE
+ {
+ Text [ en-US ] = "The host name $(ARG1) could not be resolved." ;
+ };
+ String ERRCODE_INET_CONNECT
+ {
+ Text [ en-US ] = "Could not establish Internet connection to $(ARG1)." ;
+ };
+ String ERRCODE_INET_READ
+ {
+ Text [ en-US ] = "Error reading data from the Internet.\nServer error message: $(ARG1)." ;
+ };
+ String ERRCODE_INET_WRITE
+ {
+ Text [ en-US ] = "Error transferring data to the Internet.\nServer error message: $(ARG1)." ;
+ };
+ String ERRCODE_INET_GENERAL
+ {
+ Text [ en-US ] = "General Internet error has occurred." ;
+ };
+ String ERRCODE_INET_OFFLINE
+ {
+ Text [ en-US ] = "The requested Internet data is not available in the cache and cannot be transmitted as the Online mode has not be activated." ;
+ };
+ String ERRCODE_SFXMSG_STYLEREPLACE
+ {
+ ExtraData = ERRCODE_MSG_ERROR | ERRCODE_BUTTON_OK_CANCEL ;
+ Text [ en-US ] = "Should the $(ARG1) Style be replaced?" ;
+ };
+ String ERRCODE_SFX_NOFILTER
+ {
+ Text [ en-US ] = "A filter has not been found." ;
+ };
+ String ERRCODE_SFX_CANTFINDORIGINAL
+ {
+ Text [ en-US ] = "The original could not be determined." ;
+ };
+ String ERRCODE_SFX_CANTCREATECONTENT
+ {
+ Text [ en-US ] = "The contents could not be created." ;
+ };
+ String ERRCODE_SFX_CANTCREATELINK
+ {
+ Text [ en-US ] = "The link could not be created." ;
+ };
+ String ERRCODE_SFX_WRONGBMKFORMAT
+ {
+ Text [ en-US ] = "The link format is invalid." ;
+ };
+ String ERRCODE_SFX_WRONGICONFILE
+ {
+ Text [ en-US ] = "The configuration of the icon display is invalid." ;
+ };
+ String ERRCODE_SFX_CANTWRITEICONFILE
+ {
+ Text [ en-US ] = "The configuration of the icon display can not be saved." ;
+ };
+ String ERRCODE_SFX_CANTDELICONFILE
+ {
+ Text [ en-US ] = "The configuration of the icon display could not be deleted." ;
+ };
+ String ERRCODE_SFX_CANTRENAMECONTENT
+ {
+ Text [ en-US ] = "Contents cannot be renamed." ;
+ };
+ String ERRCODE_SFX_INVALIDBMKPATH
+ {
+ Text [ en-US ] = "The bookmark folder is invalid." ;
+ };
+ String ERRCODE_SFX_CANTWRITEURLCFGFILE
+ {
+ Text [ en-US ] = "The configuration of the URLs to be saved locally could not be saved." ;
+ };
+ String ERRCODE_SFX_WRONGURLCFGFORMAT
+ {
+ Text [ en-US ] = "The configuration format of the URLs to be saved locally is invalid." ;
+ };
+ String ERRCODE_SFX_NODOCUMENT
+ {
+ Text [ en-US ] = "This action cannot be applied to a document that does not exist." ;
+ };
+ String ERRCODE_SFX_INVALIDLINK
+ {
+ Text [ en-US ] = "The link refers to an invalid target." ;
+ };
+ String ERRCODE_SFX_INVALIDTRASHPATH
+ {
+ Text [ en-US ] = "The Recycle Bin path is invalid." ;
+ };
+ String ERRCODE_SFX_NOTRESTORABLE
+ {
+ Text [ en-US ] = "The entry could not be restored." ;
+ };
+ String ERRCODE_IO_NAMETOOLONG
+ {
+ Text [ en-US ] = "The file name is too long for the target file system." ;
+ };
+ String ERRCODE_SFX_CONSULTUSER
+ {
+ Text [ en-US ] = "The details for running the function are incomplete." ;
+ };
+ String ERRCODE_SFX_INVALIDSYNTAX
+ {
+ Text [ en-US ] = "The input syntax is invalid." ;
+ };
+ String ERRCODE_SFX_CANTCREATEFOLDER
+ {
+ Text [ en-US ] = "The input syntax is invalid." ;
+ };
+ String ERRCODE_SFX_CANTRENAMEFOLDER
+ {
+ Text [ en-US ] = "The input syntax is invalid." ;
+ };
+ String ERRCODE_SFX_WRONG_CDF_FORMAT
+ {
+ Text [ en-US ] = "The channel document has an invalid format." ;
+ };
+ String ERRCODE_SFX_EMPTY_SERVER
+ {
+ Text [ en-US ] = "The server must not be empty." ;
+ };
+ String ERRCODE_SFX_NO_ABOBOX
+ {
+ Text [ en-US ] = "A subscription folder is required to install a Channel." ;
+ };
+ String ERRCODE_IO_NOTSTORABLEINBINARYFORMAT
+ {
+ Text [ en-US ] = "This document contains attributes that cannot be saved in the selected format.\nPlease save the document in a %PRODUCTNAME %PRODUCTVERSION file format.";
+ };
+ String ERRCODE_SFX_TARGETFILECORRUPTED
+ {
+ Text [ en-US ] = "The file $(FILENAME) cannot be saved. Please check your system settings. You can find an automatically generated backup copy of this file in folder $(PATH) named $(BACKUPNAME).";
+ };
+ String ERRCODE_SFX_NOMOREDOCUMENTSALLOWED
+ {
+ Text [ en-US ] = "The maximum number of documents that can be opened at the same time has been reached. You need to close one or more documents before you can open a new document.";
+ };
+ String ERRCODE_SFX_CANTCREATEBACKUP
+ {
+ Text [ en-US ] = "Could not create backup copy." ;
+ };
+ String ERRCODE_SFX_MACROS_SUPPORT_DISABLED
+ {
+ Text [ en-US ] = "An attempt was made to execute a macro.\nFor security reasons, macro support is disabled.";
+ };
+ String ERRCODE_SFX_DOCUMENT_MACRO_DISABLED
+ {
+ Text [ en-US ] = "This document contains macros.\n\nMacros may contain viruses. Execution of macros is disabled due to the current macro security setting in Tools - Options - %PRODUCTNAME - Security.\n\nTherefore, some functionality may not be available." ;
+ };
+ String ERRCODE_SFX_BROKENSIGNATURE
+ {
+ Text [ en-US ] = "The digitally signed document content and/or macros do not match the current document signature.\n\nThis could be the result of document manipulation or of structural document damage due to data transmission.\n\nWe recommend that you do not trust the content of the current document.\nExecution of macros is disabled for this document.\n " ;
+ };
+ String ERRCODE_SFX_INCOMPLETE_ENCRYPTION
+ {
+ Text [ en-US ] = "The encrypted document contains unexpected non-encrypted streams.\n\nThis could be the result of document manipulation.\n\nWe recommend that you do not trust the content of the current document.\nExecution of macros is disabled for this document.\n " ;
+ };
+
+ String ERRCODE_IO_INVALIDLENGTH
+ {
+ Text [ en-US ] = "Invalid data length." ;
+ };
+ String ERRCODE_IO_CURRENTDIR
+ {
+ Text [ en-US ] = "Function not possible: path contains current directory." ;
+ };
+ String ERRCODE_IO_NOTSAMEDEVICE
+ {
+ Text [ en-US ] = "Function not possible: device (drive) not identical." ;
+ };
+ String ERRCODE_IO_DEVICENOTREADY
+ {
+ Text [ en-US ] = "Device (drive) not ready." ;
+ };
+ String ERRCODE_IO_BADCRC
+ {
+ Text [ en-US ] = "Wrong check amount." ;
+ };
+ String ERRCODE_IO_WRITEPROTECTED
+ {
+ Text [ en-US ] = "Function not possible: write protected." ;
+ };
+ String ERRCODE_SFX_SHARED_NOPASSWORDCHANGE
+ {
+ Text [ en-US ] = "The password of a shared spreadsheet cannot be set or changed.\nDeactivate sharing mode first.";
+ };
+};
+
+// eof ------------------------------------------------------------------------
+
diff --git a/svx/source/src/hidgen.hrc b/svx/source/src/hidgen.hrc
new file mode 100644
index 000000000000..38bea9afca11
--- /dev/null
+++ b/svx/source/src/hidgen.hrc
@@ -0,0 +1,33 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define MN_EDIT 20
+#define MN_VIEW 21
+#define MN_EXTRA 22
+#define MN_WIN 30
+#define MN_HELP 31
+
diff --git a/svx/source/stbctrls/insctrl.cxx b/svx/source/stbctrls/insctrl.cxx
new file mode 100644
index 000000000000..34952b1deea9
--- /dev/null
+++ b/svx/source/stbctrls/insctrl.cxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#ifndef _STATUS_HXX //autogen
+#include <vcl/status.hxx>
+#endif
+#include <svl/eitem.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/dispatch.hxx>
+
+#define _SVX_INSCTRL_CXX
+
+#include <svx/dialogs.hrc>
+
+#include "svx/insctrl.hxx"
+#include <svx/dialmgr.hxx>
+
+#define PAINT_OFFSET 5
+
+SFX_IMPL_STATUSBAR_CONTROL(SvxInsertStatusBarControl, SfxBoolItem);
+
+// class SvxInsertStatusBarControl ---------------------------------------
+
+SvxInsertStatusBarControl::SvxInsertStatusBarControl( sal_uInt16 _nSlotId,
+ sal_uInt16 _nId,
+ StatusBar& rStb ) :
+
+ SfxStatusBarControl( _nSlotId, _nId, rStb ),
+ bInsert( sal_True )
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxInsertStatusBarControl::~SvxInsertStatusBarControl()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SvxInsertStatusBarControl::StateChanged( sal_uInt16 , SfxItemState eState,
+ const SfxPoolItem* pState )
+{
+ if ( SFX_ITEM_AVAILABLE != eState )
+ GetStatusBar().SetItemText( GetId(), String() );
+ else
+ {
+ DBG_ASSERT( pState->ISA( SfxBoolItem ), "invalid item type" );
+ SfxBoolItem* pItem = (SfxBoolItem*)pState;
+ bInsert = pItem->GetValue();
+ DrawItemText_Impl();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxInsertStatusBarControl::Click()
+{
+ if ( !GetStatusBar().GetItemText( GetId() ).Len() )
+ return;
+ bInsert = !bInsert;
+ SfxBoolItem aIns( GetSlotId(), bInsert );
+
+ ::com::sun::star::uno::Any a;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs( 1 );
+ aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InsertMode" ));
+ aIns.QueryValue( a );
+ aArgs[0].Value = a;
+
+ execute( aArgs );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxInsertStatusBarControl::Paint( const UserDrawEvent& )
+{
+ DrawItemText_Impl();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxInsertStatusBarControl::DrawItemText_Impl()
+{
+ sal_uInt16 _nId = RID_SVXSTR_OVERWRITE_TEXT;
+
+ if ( bInsert )
+ _nId = RID_SVXSTR_INSERT_TEXT;
+ GetStatusBar().SetItemText( GetId(), SVX_RESSTR( _nId ) );
+}
+
+sal_uIntPtr SvxInsertStatusBarControl::GetDefItemWidth(const StatusBar& rStb)
+{
+ long nWidth1 = rStb.GetTextWidth(SVX_RESSTR(RID_SVXSTR_OVERWRITE_TEXT));
+ long nWidth2 = rStb.GetTextWidth(SVX_RESSTR(RID_SVXSTR_INSERT_TEXT));
+
+ if(nWidth1<nWidth2)
+ nWidth1=nWidth2;
+
+ return nWidth1+PAINT_OFFSET;
+}
+
+
diff --git a/svx/source/stbctrls/modctrl.cxx b/svx/source/stbctrls/modctrl.cxx
new file mode 100644
index 000000000000..87dce0e942df
--- /dev/null
+++ b/svx/source/stbctrls/modctrl.cxx
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#ifndef _STATUS_HXX //autogen
+#include <vcl/status.hxx>
+#endif
+#include <svl/eitem.hxx>
+#include <sfx2/app.hxx>
+
+#define _SVX_MODCTRL_CXX
+
+#include <svx/dialogs.hrc>
+
+#include "svx/modctrl.hxx"
+#include <svx/dialmgr.hxx>
+
+SFX_IMPL_STATUSBAR_CONTROL(SvxModifyControl, SfxBoolItem);
+
+// class SvxModifyControl ------------------------------------------------
+
+SvxModifyControl::SvxModifyControl( sal_uInt16 _nSlotId,
+ sal_uInt16 _nId,
+ StatusBar& rStb ) :
+
+ SfxStatusBarControl( _nSlotId, _nId, rStb ),
+ bState( sal_True )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SvxModifyControl::StateChanged( sal_uInt16, SfxItemState eState,
+ const SfxPoolItem* pState )
+{
+ if ( SFX_ITEM_AVAILABLE != eState )
+ GetStatusBar().SetItemText( GetId(), String() );
+ else
+ {
+ DBG_ASSERT( pState->ISA( SfxBoolItem ), "invalid item type" );
+ SfxBoolItem* pItem = (SfxBoolItem*)pState;
+ bState = pItem->GetValue();
+ DrawItemText_Impl();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxModifyControl::Paint( const UserDrawEvent& )
+{
+ DrawItemText_Impl();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxModifyControl::DrawItemText_Impl()
+{
+ String sMode;
+
+ if ( bState )
+ sMode = '*';
+ GetStatusBar().SetItemText( GetId(), sMode );
+}
+
+sal_uIntPtr SvxModifyControl::GetDefItemWidth(const StatusBar& rStb)
+{
+ return rStb.GetTextWidth(String::CreateFromAscii("XX"));
+}
+
+
diff --git a/svx/source/stbctrls/pszctrl.cxx b/svx/source/stbctrls/pszctrl.cxx
new file mode 100644
index 000000000000..094cfbd96ee5
--- /dev/null
+++ b/svx/source/stbctrls/pszctrl.cxx
@@ -0,0 +1,447 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <limits.h>
+#include <tools/shl.hxx>
+#include <vcl/status.hxx>
+#include <vcl/menu.hxx>
+#include <vcl/image.hxx>
+#include <svl/stritem.hxx>
+#include <svl/ptitem.hxx>
+#include <svl/itempool.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/module.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objsh.hxx>
+#include <svl/intitem.hxx>
+#define _SVX_PSZCTRL_CXX
+
+#include "svx/pszctrl.hxx"
+
+#define PAINT_OFFSET 5
+
+#include <editeng/sizeitem.hxx>
+#include <svx/dialmgr.hxx>
+#include "svx/dlgutil.hxx"
+#include "stbctrls.h"
+#include "sfx2/module.hxx"
+
+#include <svx/dialogs.hrc>
+#include <unotools/localedatawrapper.hxx>
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX
+#include <comphelper/processfactory.hxx>
+#endif
+
+// -----------------------------------------------------------------------
+
+/* [Beschreibung]
+
+ Funktion, mit der ein metrischer Wert in textueller Darstellung
+ umgewandelt wird.
+
+ nVal ist hier der metrische Wert in der Einheit eUnit.
+
+ [Querverweise]
+
+ <SvxPosSizeStatusBarControl::Paint(const UserDrawEvent&)>
+*/
+
+String SvxPosSizeStatusBarControl::GetMetricStr_Impl( long nVal )
+{
+ // Applikations-Metrik besorgen und setzen
+ FieldUnit eOutUnit = SfxModule::GetCurrentFieldUnit();
+ FieldUnit eInUnit = FUNIT_100TH_MM;
+
+ String sMetric;
+ const sal_Unicode cSep = Application::GetSettings().GetLocaleDataWrapper().getNumDecimalSep().GetChar(0);
+ sal_Int64 nConvVal = MetricField::ConvertValue( nVal * 100, 0L, 0, eInUnit, eOutUnit );
+
+ if ( nConvVal < 0 && ( nConvVal / 100 == 0 ) )
+ sMetric += '-';
+ sMetric += String::CreateFromInt64( nConvVal / 100 );
+
+ if( FUNIT_NONE != eOutUnit )
+ {
+ sMetric += cSep;
+ sal_Int64 nFract = nConvVal % 100;
+
+ if ( nFract < 0 )
+ nFract *= -1;
+ if ( nFract < 10 )
+ sMetric += '0';
+ sMetric += String::CreateFromInt64( nFract );
+ }
+
+ return sMetric;
+}
+
+// -----------------------------------------------------------------------
+
+SFX_IMPL_STATUSBAR_CONTROL(SvxPosSizeStatusBarControl, SvxSizeItem);
+
+// class FunctionPopup_Impl ----------------------------------------------
+
+class FunctionPopup_Impl : public PopupMenu
+{
+public:
+ FunctionPopup_Impl( sal_uInt16 nCheck );
+
+ sal_uInt16 GetSelected() const { return nSelected; }
+
+private:
+ sal_uInt16 nSelected;
+
+ virtual void Select();
+};
+
+// -----------------------------------------------------------------------
+
+FunctionPopup_Impl::FunctionPopup_Impl( sal_uInt16 nCheck ) :
+ PopupMenu( ResId( RID_SVXMNU_PSZ_FUNC, DIALOG_MGR() ) ),
+ nSelected( 0 )
+{
+ if (nCheck)
+ CheckItem( nCheck );
+}
+
+// -----------------------------------------------------------------------
+
+void FunctionPopup_Impl::Select()
+{
+ nSelected = GetCurItemId();
+}
+
+// struct SvxPosSizeStatusBarControl_Impl --------------------------------
+
+struct SvxPosSizeStatusBarControl_Impl
+
+/* [Beschreibung]
+
+ Diese Implementations-Struktur der Klasse SvxPosSizeStatusBarControl
+ dient der Entkopplung von "Anderungen vom exportierten Interface sowie
+ der Verringerung von extern sichtbaren Symbolen.
+
+ Eine Instanz exisitiert pro SvxPosSizeStatusBarControl-Instanz
+ f"ur deren Laufzeit.
+*/
+
+{
+ Point aPos; // g"ultig, wenn eine Position angezeigt wird
+ Size aSize; // g"ultig, wenn eine Gr"o/se angezeigt wird
+ String aStr; // g"ultig, wenn ein Text angezeigt wird
+ sal_Bool bPos; // show position
+ sal_Bool bSize; // Gr"o/se anzeigen?
+ sal_Bool bTable; // Tabellenindex anzeigen?
+ sal_Bool bHasMenu; // StarCalc Popup-Menue anzeigen?
+ sal_uInt16 nFunction; // selektierte StarCalc Funktion
+ Image aPosImage; // Image f"ur die Positionsanzeige
+ Image aSizeImage; // Image f"ur die Gr"o/senanzeige
+};
+
+// class SvxPosSizeStatusBarControl ------------------------------------------
+
+/* [Beschreibung]
+
+ Ctor():
+ Anlegen einer Impl-Klassen-Instanz, Default die Zeitanzeige enablen,
+ Images fu"r die Position und Gro"sse laden.
+*/
+
+#define STR_POSITION ".uno:Position"
+#define STR_TABLECELL ".uno:StateTableCell"
+#define STR_FUNC ".uno:StatusBarFunc"
+
+SvxPosSizeStatusBarControl::SvxPosSizeStatusBarControl( sal_uInt16 _nSlotId,
+ sal_uInt16 _nId,
+ StatusBar& rStb ) :
+ SfxStatusBarControl( _nSlotId, _nId, rStb ),
+ pImp( new SvxPosSizeStatusBarControl_Impl )
+{
+ pImp->bPos = sal_False;
+ pImp->bSize = sal_False;
+ pImp->bTable = sal_False;
+ pImp->bHasMenu = sal_False;
+ pImp->nFunction = 0;
+ pImp->aPosImage = Image( ResId( RID_SVXBMP_POSITION, DIALOG_MGR() ) );
+ pImp->aSizeImage = Image( ResId( RID_SVXBMP_SIZE, DIALOG_MGR() ) );
+
+ addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( STR_POSITION ))); // SID_ATTR_POSITION
+ addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( STR_TABLECELL ))); // SID_TABLE_CELL
+ addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( STR_FUNC ))); // SID_PSZ_FUNCTION
+}
+
+// -----------------------------------------------------------------------
+
+/* [Beschreibung]
+
+ Dtor():
+ Pointer auf die Impl-Klasse lo"schen, damit der Timer gestoppt wird.
+*/
+
+SvxPosSizeStatusBarControl::~SvxPosSizeStatusBarControl()
+{
+ delete pImp;
+}
+
+// -----------------------------------------------------------------------
+
+/* [Beschreibung]
+
+ SID_PSZ_FUNCTION aktiviert das Popup-Menue fuer Calc, ansonsten:
+
+ Statusbenachrichtigung;
+ Je nach Item-Typ wird eine bestimmte Anzeige enabled, die anderen disabled.
+
+ NULL/Void SfxPointItem SvxSizeItem SfxStringItem
+ ------------------------------------------------------------------------
+ Zeit sal_True sal_False sal_False FALSE
+ Position sal_False FALSE
+ Gro"sse FALSE TRUE FALSE
+ Text sal_False sal_False TRUE
+
+ Ein anderes Item bewirkt einen Assert, die Zeitanzeige wird enabled.
+*/
+
+void SvxPosSizeStatusBarControl::StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState )
+{
+ // da Kombi-Controller, immer die aktuelle Id als HelpId setzen
+ // gecachten HelpText vorher l"oschen
+ GetStatusBar().SetHelpText( GetId(), String() );
+
+ switch ( nSID )
+ {
+ case SID_ATTR_POSITION : GetStatusBar().SetHelpId( GetId(), STR_POSITION ); break;
+ case SID_TABLE_CELL: GetStatusBar().SetHelpId( GetId(), STR_TABLECELL ); break;
+ case SID_PSZ_FUNCTION: GetStatusBar().SetHelpId( GetId(), STR_FUNC ); break;
+ default: break;
+ }
+
+ if ( nSID == SID_PSZ_FUNCTION )
+ {
+ if ( eState == SFX_ITEM_AVAILABLE )
+ {
+ pImp->bHasMenu = sal_True;
+ if ( pState && pState->ISA(SfxUInt16Item) )
+ pImp->nFunction = ((const SfxUInt16Item*)pState)->GetValue();
+ }
+ else
+ pImp->bHasMenu = sal_False;
+ }
+ else if ( SFX_ITEM_AVAILABLE != eState )
+ {
+ // #i34458# don't switch to empty display before an empty state was
+ // notified for all display types
+
+ if ( nSID == SID_TABLE_CELL )
+ pImp->bTable = sal_False;
+ else if ( nSID == SID_ATTR_POSITION )
+ pImp->bPos = sal_False;
+ else if ( nSID == GetSlotId() ) // controller is registered for SID_ATTR_SIZE
+ pImp->bSize = sal_False;
+ else
+ {
+ DBG_ERRORFILE("unknown slot id");
+ }
+ }
+ else if ( pState->ISA( SfxPointItem ) )
+ {
+ // Position anzeigen
+ pImp->aPos = ( (SfxPointItem*)pState )->GetValue();
+ pImp->bPos = sal_True;
+ pImp->bTable = sal_False;
+ }
+ else if ( pState->ISA( SvxSizeItem ) )
+ {
+ // Groesse anzeigen
+ pImp->aSize = ( (SvxSizeItem*)pState )->GetSize();
+ pImp->bSize = sal_True;
+ pImp->bTable = sal_False;
+ }
+ else if ( pState->ISA( SfxStringItem ) )
+ {
+ // String anzeigen (Tabellen-Zelle oder anderes)
+ pImp->aStr = ( (SfxStringItem*)pState )->GetValue();
+ pImp->bTable = sal_True;
+ pImp->bPos = sal_False;
+ pImp->bSize = sal_False;
+ }
+ else
+ {
+ DBG_ERRORFILE( "invalid item type" );
+ // trotzdem Datum und Zeit anzeigen
+ pImp->bPos = sal_False;
+ pImp->bSize = sal_False;
+ pImp->bTable = sal_False;
+ }
+
+ if ( GetStatusBar().AreItemsVisible() )
+ GetStatusBar().SetItemData( GetId(), 0 );
+
+ // nur Strings auch als Text an der StatusBar setzen, damit Tip-Hilfe
+ // funktioniert, wenn der Text zu lang ist.
+ String aText;
+ if ( pImp->bTable )
+ aText = pImp->aStr;
+ GetStatusBar().SetItemText( GetId(), aText );
+}
+
+// -----------------------------------------------------------------------
+
+/* [Beschreibung]
+
+ Popup-Menue ausfuehren, wenn per Status enabled
+*/
+
+void SvxPosSizeStatusBarControl::Command( const CommandEvent& rCEvt )
+{
+ if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU && pImp->bHasMenu )
+ {
+ sal_uInt16 nSelect = pImp->nFunction;
+ if (!nSelect)
+ nSelect = PSZ_FUNC_NONE;
+ FunctionPopup_Impl aMenu( nSelect );
+ if ( aMenu.Execute( &GetStatusBar(), rCEvt.GetMousePosPixel() ) )
+ {
+ nSelect = aMenu.GetSelected();
+ if (nSelect)
+ {
+ if (nSelect == PSZ_FUNC_NONE)
+ nSelect = 0;
+
+ ::com::sun::star::uno::Any a;
+ SfxUInt16Item aItem( SID_PSZ_FUNCTION, nSelect );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs( 1 );
+ aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StatusBarFunc" ));
+ aItem.QueryValue( a );
+ aArgs[0].Value = a;
+
+ execute( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:StatusBarFunc" )), aArgs );
+// GetBindings().GetDispatcher()->Execute( SID_PSZ_FUNCTION, SFX_CALLMODE_RECORD, &aItem, 0L );
+ }
+ }
+ }
+ else
+ SfxStatusBarControl::Command( rCEvt );
+}
+
+// -----------------------------------------------------------------------
+
+/* [Beschreibung]
+
+ Je nach enableden Anzeigentyp, wird der Wert angezeigt. Vorher wird
+ das Rectangle u"bermalt (gelo"scht).
+*/
+
+void SvxPosSizeStatusBarControl::Paint( const UserDrawEvent& rUsrEvt )
+{
+ OutputDevice* pDev = rUsrEvt.GetDevice();
+ DBG_ASSERT( pDev, "no OutputDevice on UserDrawEvent" );
+ const Rectangle& rRect = rUsrEvt.GetRect();
+ StatusBar& rBar = GetStatusBar();
+ Point aItemPos = rBar.GetItemTextPos( GetId() );
+ Color aOldLineColor = pDev->GetLineColor();
+ Color aOldFillColor = pDev->GetFillColor();
+ pDev->SetLineColor();
+ pDev->SetFillColor( pDev->GetBackground().GetColor() );
+
+ if ( pImp->bPos || pImp->bSize )
+ {
+ // Position fuer Size-Anzeige berechnen
+ long nSizePosX =
+ rRect.Left() + rRect.GetWidth() / 2 + PAINT_OFFSET;
+ // Position zeichnen
+ Point aPnt = rRect.TopLeft();
+ aPnt.Y() = aItemPos.Y();
+ aPnt.X() += PAINT_OFFSET;
+ pDev->DrawImage( aPnt, pImp->aPosImage );
+ aPnt.X() += pImp->aPosImage.GetSizePixel().Width();
+ aPnt.X() += PAINT_OFFSET;
+ String aStr = GetMetricStr_Impl( pImp->aPos.X());
+ aStr.AppendAscii(" / ");
+ aStr += GetMetricStr_Impl( pImp->aPos.Y());
+ pDev->DrawRect(
+ Rectangle( aPnt, Point( nSizePosX, rRect.Bottom() ) ) );
+ pDev->DrawText( aPnt, aStr );
+
+ // falls verf"ugbar, Gr"osse zeichnen
+ aPnt.X() = nSizePosX;
+
+ if ( pImp->bSize )
+ {
+ pDev->DrawImage( aPnt, pImp->aSizeImage );
+ aPnt.X() += pImp->aSizeImage.GetSizePixel().Width();
+ Point aDrwPnt = aPnt;
+ aPnt.X() += PAINT_OFFSET;
+ aStr = GetMetricStr_Impl( pImp->aSize.Width() );
+ aStr.AppendAscii(" x ");
+ aStr += GetMetricStr_Impl( pImp->aSize.Height() );
+ pDev->DrawRect( Rectangle( aDrwPnt, rRect.BottomRight() ) );
+ pDev->DrawText( aPnt, aStr );
+ }
+ else
+ pDev->DrawRect( Rectangle( aPnt, rRect.BottomRight() ) );
+ }
+ else if ( pImp->bTable )
+ {
+ pDev->DrawRect( rRect );
+ pDev->DrawText( Point(
+ rRect.Left() + rRect.GetWidth() / 2 - pDev->GetTextWidth( pImp->aStr ) / 2,
+ aItemPos.Y() ), pImp->aStr );
+ }
+ else
+ {
+ // Empty display if neither size nor table position are available.
+ // Date/Time are no longer used (#65302#).
+ pDev->DrawRect( rRect );
+ }
+
+ pDev->SetLineColor( aOldLineColor );
+ pDev->SetFillColor( aOldFillColor );
+}
+
+// -----------------------------------------------------------------------
+
+sal_uIntPtr SvxPosSizeStatusBarControl::GetDefItemWidth(const StatusBar& rStb)
+{
+ Image aTmpPosImage( ResId( RID_SVXBMP_POSITION, DIALOG_MGR() ) );
+ Image aTmpSizeImage( ResId( RID_SVXBMP_SIZE, DIALOG_MGR() ) );
+
+ sal_uIntPtr nWidth=PAINT_OFFSET+aTmpPosImage.GetSizePixel().Width();
+ nWidth+=PAINT_OFFSET+aTmpSizeImage.GetSizePixel().Width();
+ nWidth+=2*(PAINT_OFFSET+rStb.GetTextWidth(String::CreateFromAscii("XXXX,XX / XXXX,XX")));
+
+ return nWidth;
+}
+
+
diff --git a/svx/source/stbctrls/selctrl.cxx b/svx/source/stbctrls/selctrl.cxx
new file mode 100644
index 000000000000..e216a4c204ba
--- /dev/null
+++ b/svx/source/stbctrls/selctrl.cxx
@@ -0,0 +1,154 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#ifndef _STATUS_HXX //autogen
+#include <vcl/status.hxx>
+#endif
+#include <svl/intitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <tools/urlobj.hxx>
+
+#define _SVX_SELCTRL_CXX
+
+#include "svx/selctrl.hxx"
+#include <svx/dialmgr.hxx>
+
+#include <svx/dialogs.hrc>
+
+#define PAINT_OFFSET 5
+
+SFX_IMPL_STATUSBAR_CONTROL(SvxSelectionModeControl, SfxUInt16Item);
+
+// class SvxSelectionModeControl -----------------------------------------
+
+SvxSelectionModeControl::SvxSelectionModeControl( sal_uInt16 _nSlotId,
+ sal_uInt16 _nId,
+ StatusBar& rStb ) :
+ SfxStatusBarControl( _nSlotId, _nId, rStb ),
+ nState( 0 )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSelectionModeControl::StateChanged( sal_uInt16, SfxItemState eState,
+ const SfxPoolItem* pState )
+{
+ if ( SFX_ITEM_AVAILABLE != eState )
+ GetStatusBar().SetItemText( GetId(), String() );
+ else
+ {
+ DBG_ASSERT( pState->ISA( SfxUInt16Item ), "invalid item type" );
+ SfxUInt16Item* pItem = (SfxUInt16Item*)pState;
+ nState = pItem->GetValue();
+ DrawItemText_Impl();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSelectionModeControl::Click()
+{
+ if ( !GetStatusBar().GetItemText( GetId() ).Len() )
+ return;
+ nState++;
+ if ( nState > 3 )
+ nState = 0;
+
+ ::com::sun::star::uno::Any a;
+ SfxUInt16Item aState( GetSlotId(), nState );
+ INetURLObject aObj( m_aCommandURL );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs( 1 );
+ aArgs[0].Name = aObj.GetURLPath();
+ aState.QueryValue( a );
+ aArgs[0].Value = a;
+
+ execute( aArgs );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSelectionModeControl::Paint( const UserDrawEvent& )
+{
+ DrawItemText_Impl();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSelectionModeControl::DrawItemText_Impl()
+{
+ String sTxt;
+ sal_uInt16 _nId = 0;
+
+ switch ( nState )
+ {
+ case 0:
+ _nId = RID_SVXSTR_SELMODE_STD;
+ break;
+ case 1:
+ _nId = RID_SVXSTR_SELMODE_ER;
+ break;
+ case 2:
+ _nId = RID_SVXSTR_SELMODE_ERG;
+ break;
+ case 3:
+ _nId = RID_SVXSTR_SELMODE_BLK;
+ break;
+ default: DBG_ERROR( "invalid selection mode!" );
+ }
+
+ if ( _nId )
+ sTxt = SVX_RESSTR( _nId );
+ GetStatusBar().SetItemText( GetId(), sTxt );
+}
+
+sal_uIntPtr SvxSelectionModeControl::GetDefItemWidth(const StatusBar& rStb)
+{
+ long nWidth1 = rStb.GetTextWidth(SVX_RESSTR(RID_SVXSTR_SELMODE_STD));
+ long nWidth2 = rStb.GetTextWidth(SVX_RESSTR(RID_SVXSTR_SELMODE_ER));
+ long nWidth3 = rStb.GetTextWidth(SVX_RESSTR(RID_SVXSTR_SELMODE_ERG));
+ long nWidth4 = rStb.GetTextWidth(SVX_RESSTR(RID_SVXSTR_SELMODE_BLK));
+
+ if(nWidth1<nWidth2)
+ nWidth1=nWidth2;
+
+ if(nWidth1<nWidth3)
+ nWidth1=nWidth3;
+
+ if(nWidth1<nWidth4)
+ nWidth1=nWidth4;
+
+ return nWidth1+PAINT_OFFSET;
+}
+
+
diff --git a/svx/source/stbctrls/stbctrls.h b/svx/source/stbctrls/stbctrls.h
new file mode 100644
index 000000000000..5a201d7a7bc7
--- /dev/null
+++ b/svx/source/stbctrls/stbctrls.h
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_STBCTRLS_H
+#define _SVX_STBCTRLS_H
+
+// defines ------------------------------------------------------------------
+
+#define ZOOM_200 1
+#define ZOOM_150 2
+#define ZOOM_100 3
+#define ZOOM_75 4
+#define ZOOM_50 5
+
+#define ZOOM_OPTIMAL 6
+#define ZOOM_PAGE_WIDTH 7
+#define ZOOM_WHOLE_PAGE 8
+
+// IDs wie SUBTOTAL_FUNC im Calc
+
+#define PSZ_FUNC_AVG 1
+#define PSZ_FUNC_COUNT2 3
+#define PSZ_FUNC_COUNT 2
+#define PSZ_FUNC_MAX 4
+#define PSZ_FUNC_MIN 5
+#define PSZ_FUNC_SUM 9
+#define PSZ_FUNC_NONE 16
+
+#define XMLSEC_CALL 1
+
+#endif
+
diff --git a/svx/source/stbctrls/stbctrls.src b/svx/source/stbctrls/stbctrls.src
new file mode 100644
index 000000000000..c6f466955254
--- /dev/null
+++ b/svx/source/stbctrls/stbctrls.src
@@ -0,0 +1,327 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ---------------------------------------------------------------
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+#include "stbctrls.h"
+ // pragma ----------------------------------------------------------------
+
+ // Strings ---------------------------------------------------------------
+String RID_SVXSTR_INSERT_TEXT
+{
+ // 'Einf"ugen' bzw. 'Insert' abgek"urzt auf h"ochstens 5 Zeichen
+ Text [ en-US ] = "INSRT" ;
+};
+String RID_SVXSTR_OVERWRITE_TEXT
+{
+ // '"Uberschreiben' bzw. 'Overwrite' abgek"urzt auf h"ochstens 5 Zeichen
+ Text [ en-US ] = "OVER" ;
+};
+String RID_SVXSTR_SELMODE_STD
+{
+ // 'Standard' abgek"urzt auf h"ochstens 3 Zeichen
+ Text [ en-US ] = "STD" ;
+};
+String RID_SVXSTR_SELMODE_ER
+{
+ // 'Erweitert' bzw. 'Extended' abgek"urzt auf h"ochstens 3 Zeichen
+ Text [ en-US ] = "EXT" ;
+};
+String RID_SVXSTR_SELMODE_ERG
+{
+ // 'Erg"anzend' bzw. 'Added' abgek"urzt auf h"ochstens 3 Zeichen
+ Text [ en-US ] = "ADD" ;
+};
+
+String RID_SVXSTR_SELMODE_BLK
+{
+ // 'Block' shortened to max. 3 chararcters
+ Text [ en-US ] = "BLK" ;
+ Text [ x-comment ] = " ";
+};
+
+String RID_SVXSTR_XMLSEC_SIG_OK
+{
+ Text [ en-US ] = "Digital Signature: The document signature is OK.";
+};
+
+String RID_SVXSTR_XMLSEC_SIG_OK_NO_VERIFY
+{
+ Text [ en-US ] = "Digital Signature: The document signature is OK, but the certificates could not be validated.";
+};
+
+String RID_SVXSTR_XMLSEC_SIG_NOT_OK
+{
+ Text [ en-US ] = "Digital Signature: The document signature does not match the document content. We strongly recommend you to do not trust this document.";
+};
+
+String RID_SVXSTR_XMLSEC_NO_SIG
+{
+ Text [ en-US ] = "Digital Signature: The document is not signed.";
+};
+
+String RID_SVXSTR_XMLSEC_SIG_CERT_OK_PARTIAL_SIG
+{
+ Text [ en-US ] = "Digital Signature: The document signature and the certificate are OK, but not all parts of the document are signed.";
+};
+
+ // PopupMenu -------------------------------------------------------------
+Menu RID_SVXMNU_ZOOM
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = ZOOM_200 ;
+ HelpId = HID_MNU_ZOOM_200 ;
+ Text = "200%" ;
+ };
+ MenuItem
+ {
+ Identifier = ZOOM_150 ;
+ HelpId = HID_MNU_ZOOM_150 ;
+ Text = "150%" ;
+ };
+ MenuItem
+ {
+ Identifier = ZOOM_100 ;
+ HelpId = HID_MNU_ZOOM_100 ;
+ Text = "100%" ;
+ };
+ MenuItem
+ {
+ Identifier = ZOOM_75 ;
+ HelpId = HID_MNU_ZOOM_75 ;
+ Text = "75%" ;
+ };
+ MenuItem
+ {
+ Identifier = ZOOM_50 ;
+ HelpId = HID_MNU_ZOOM_50 ;
+ Text = "50%" ;
+ };
+ MenuItem
+ {
+ Identifier = ZOOM_OPTIMAL ;
+ HelpId = HID_MNU_ZOOM_OPTIMAL ;
+ Text [ en-US ] = "Optimal" ;
+ };
+ MenuItem
+ {
+ Identifier = ZOOM_PAGE_WIDTH ;
+ HelpId = HID_MNU_ZOOM_PAGE_WIDTH ;
+ Text [ en-US ] = "Page Width" ;
+ };
+ MenuItem
+ {
+ Identifier = ZOOM_WHOLE_PAGE ;
+ HelpId = HID_MNU_ZOOM_WHOLE_PAGE ;
+ Text [ en-US ] = "Entire Page" ;
+ };
+ };
+};
+ // Funktionsauswahl auf dem SvxPosSizeStatusBarControl fuer Calc
+Menu RID_SVXMNU_PSZ_FUNC
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = PSZ_FUNC_AVG ;
+ HelpId = HID_MNU_FUNC_AVG ;
+ Text [ en-US ] = "Average" ;
+ };
+ MenuItem
+ {
+ Identifier = PSZ_FUNC_COUNT2 ;
+ HelpId = HID_MNU_FUNC_COUNT2 ;
+ Text [ en-US ] = "CountA" ;
+ };
+ MenuItem
+ {
+ Identifier = PSZ_FUNC_COUNT ;
+ HelpId = HID_MNU_FUNC_COUNT ;
+ Text [ en-US ] = "Count" ;
+ };
+ MenuItem
+ {
+ Identifier = PSZ_FUNC_MAX ;
+ HelpId = HID_MNU_FUNC_MAX ;
+ Text [ en-US ] = "Maximum" ;
+ };
+ MenuItem
+ {
+ Identifier = PSZ_FUNC_MIN ;
+ HelpId = HID_MNU_FUNC_MIN ;
+ Text [ en-US ] = "Minimum" ;
+ };
+ MenuItem
+ {
+ Identifier = PSZ_FUNC_SUM ;
+ HelpId = HID_MNU_FUNC_SUM ;
+ Text [ en-US ] = "Sum" ;
+ };
+ MenuItem
+ {
+ Identifier = PSZ_FUNC_NONE ;
+ HelpId = HID_MNU_FUNC_NONE ;
+ Text [ en-US ] = "None" ;
+ };
+ };
+};
+Menu RID_SVXMNU_XMLSECSTATBAR
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = XMLSEC_CALL ;
+ HelpId = HID_XMLSEC_CALL ;
+ Text [ en-US ] = "Digital Signatures..." ;
+ };
+ };
+};
+
+// Images ----------------------------------------------------------------
+
+#define STD_MASKCOLOR Color{Red=0xffff;Green=0x0000;Blue=0xffff;}
+
+Image RID_SVXBMP_POSITION
+{
+ ImageBitmap = Bitmap
+ {
+ File = "sc10223.bmp" ;
+ };
+ MaskColor = STD_MASKCOLOR;
+};
+Image RID_SVXBMP_SIZE
+{
+ ImageBitmap = Bitmap
+ {
+ File = "sc10224.bmp" ;
+ };
+ MaskColor = STD_MASKCOLOR;
+};
+Image RID_SVXBMP_SIGNET
+{
+ ImageBitmap = Bitmap
+ {
+ File = "signet_11x16.png" ;
+ };
+ MaskColor = STD_MASKCOLOR;
+};
+Image RID_SVXBMP_SIGNET_BROKEN
+{
+ ImageBitmap = Bitmap
+ {
+ File = "caution_11x16.png" ;
+ };
+ MaskColor = STD_MASKCOLOR;
+};
+Image RID_SVXBMP_SIGNET_NOTVALIDATED
+{
+ ImageBitmap = Bitmap
+ {
+ File = "notcertificate_16.png" ;
+ };
+ MaskColor = STD_MASKCOLOR;
+};
+Image RID_SVXBMP_SIGNET_H
+{
+ ImageBitmap = Bitmap
+ {
+ File = "signet_11x16_h.png" ;
+ };
+ MaskColor = STD_MASKCOLOR;
+};
+Image RID_SVXBMP_SIGNET_BROKEN_H
+{
+ ImageBitmap = Bitmap
+ {
+ File = "caution_11x16_h.png" ;
+ };
+ MaskColor = STD_MASKCOLOR;
+};
+Image RID_SVXBMP_SIGNET_NOTVALIDATED_H
+{
+ ImageBitmap = Bitmap
+ {
+ File = "notcertificate_16_h.png" ;
+ };
+ MaskColor = STD_MASKCOLOR;
+};
+
+
+Image RID_SVXBMP_SLIDERBUTTON
+{
+ ImageBitmap = Bitmap
+ {
+ File = "navigationball_10.png" ;
+ };
+ MaskColor = STD_MASKCOLOR;
+};
+Image RID_SVXBMP_SLIDERDECREASE
+{
+ ImageBitmap = Bitmap
+ {
+ File = "slidezoomout_11.png" ;
+ };
+ MaskColor = STD_MASKCOLOR;
+};
+Image RID_SVXBMP_SLIDERINCREASE
+{
+ ImageBitmap = Bitmap
+ {
+ File = "slidezoomin_11.png" ;
+ };
+ MaskColor = STD_MASKCOLOR;
+};
+Image RID_SVXBMP_SLIDERBUTTON_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "navigationball_10_h.png" ;
+ };
+ MaskColor = STD_MASKCOLOR;
+};
+Image RID_SVXBMP_SLIDERDECREASE_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "slidezoomout_11_h.png" ;
+ };
+ MaskColor = STD_MASKCOLOR;
+};
+Image RID_SVXBMP_SLIDERINCREASE_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "slidezoomin_11_h.png" ;
+ };
+ MaskColor = STD_MASKCOLOR;
+};
+
diff --git a/svx/source/stbctrls/xmlsecctrl.cxx b/svx/source/stbctrls/xmlsecctrl.cxx
new file mode 100644
index 000000000000..4a5062cc6645
--- /dev/null
+++ b/svx/source/stbctrls/xmlsecctrl.cxx
@@ -0,0 +1,208 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#ifndef _STATUS_HXX //autogen
+#include <vcl/status.hxx>
+#endif
+#ifndef _MENU_HXX //autogen
+#include <vcl/menu.hxx>
+#endif
+#include <vcl/image.hxx>
+//#ifndef _SFXITEMPOOL_HXX
+//#include <svl/itempool.hxx>
+//#endif
+#include <sfx2/signaturestate.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/module.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/sfxsids.hrc>
+
+#include <svl/intitem.hxx>
+
+#include <svl/eitem.hxx>
+
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include "svx/xmlsecctrl.hxx"
+#include <tools/urlobj.hxx>
+
+#define PAINT_OFFSET 5
+
+//#include <editeng/sizeitem.hxx>
+//#include <svx/dialmgr.hxx>
+//#include "svx/dlgutil.hxx"
+//#include "stbctrls.h"
+
+//#include <svx/dialogs.hrc>
+
+/*#ifndef _UNOTOOLS_LOCALEDATAWRAPPER_HXX
+#include <unotools/localedatawrapper.hxx>
+#endif
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX
+#include <comphelper/processfactory.hxx>
+#endif*/
+
+
+
+SFX_IMPL_STATUSBAR_CONTROL( XmlSecStatusBarControl, SfxUInt16Item );
+
+struct XmlSecStatusBarControl::XmlSecStatusBarControl_Impl
+{
+ Point maPos;
+ Size maSize;
+ sal_uInt16 mnState;
+ Image maImage;
+ Image maImageBroken;
+ Image maImageNotValidated;
+};
+
+
+XmlSecStatusBarControl::XmlSecStatusBarControl( sal_uInt16 _nSlotId, sal_uInt16 _nId, StatusBar& _rStb )
+ :SfxStatusBarControl( _nSlotId, _nId, _rStb )
+
+ ,mpImpl( new XmlSecStatusBarControl_Impl )
+{
+ mpImpl->mnState = (sal_uInt16)SIGNATURESTATE_UNKNOWN;
+
+ sal_Bool bHC = GetStatusBar().GetSettings().GetStyleSettings().GetHighContrastMode();
+ mpImpl->maImage = Image( SVX_RES( bHC ? RID_SVXBMP_SIGNET_H : RID_SVXBMP_SIGNET ) );
+ mpImpl->maImageBroken =
+ Image( SVX_RES( bHC ? RID_SVXBMP_SIGNET_BROKEN_H : RID_SVXBMP_SIGNET_BROKEN ) );
+ mpImpl->maImageNotValidated =
+ Image( SVX_RES( bHC ? RID_SVXBMP_SIGNET_NOTVALIDATED_H : RID_SVXBMP_SIGNET_NOTVALIDATED ) );
+}
+
+XmlSecStatusBarControl::~XmlSecStatusBarControl()
+{
+ delete mpImpl;
+}
+
+void XmlSecStatusBarControl::StateChanged( sal_uInt16, SfxItemState eState, const SfxPoolItem* pState )
+{
+ if( SFX_ITEM_AVAILABLE != eState )
+ {
+ mpImpl->mnState = (sal_uInt16)SIGNATURESTATE_UNKNOWN;
+ }
+ else if( pState->ISA( SfxUInt16Item ) )
+ {
+// mpImpl->mbSigned = ( ( SfxUInt16Item* ) pState )->GetValue() == 1 /* SIGNED*/ ;
+ mpImpl->mnState = ( ( SfxUInt16Item* ) pState )->GetValue();
+ }
+ else
+ {
+ DBG_ERRORFILE( "+XmlSecStatusBarControl::StateChanged(): invalid item type" );
+ mpImpl->mnState = (sal_uInt16)SIGNATURESTATE_UNKNOWN;
+ }
+
+ if( GetStatusBar().AreItemsVisible() ) // necessary ?
+ GetStatusBar().SetItemData( GetId(), 0 );
+
+ GetStatusBar().SetItemText( GetId(), String() ); // necessary ?
+
+ sal_uInt16 nResId = RID_SVXSTR_XMLSEC_NO_SIG;
+ if ( mpImpl->mnState == SIGNATURESTATE_SIGNATURES_OK )
+ nResId = RID_SVXSTR_XMLSEC_SIG_OK;
+ else if ( mpImpl->mnState == SIGNATURESTATE_SIGNATURES_BROKEN )
+ nResId = RID_SVXSTR_XMLSEC_SIG_NOT_OK;
+ else if ( mpImpl->mnState == SIGNATURESTATE_SIGNATURES_NOTVALIDATED )
+ nResId = RID_SVXSTR_XMLSEC_SIG_OK_NO_VERIFY;
+ else if ( mpImpl->mnState == SIGNATURESTATE_SIGNATURES_PARTIAL_OK )
+ nResId = RID_SVXSTR_XMLSEC_SIG_CERT_OK_PARTIAL_SIG;
+
+ GetStatusBar().SetQuickHelpText( GetId(), SVX_RESSTR( nResId ) );
+}
+
+void XmlSecStatusBarControl::Command( const CommandEvent& rCEvt )
+{
+ if( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
+ {
+ PopupMenu aPopupMenu( ResId( RID_SVXMNU_XMLSECSTATBAR, DIALOG_MGR() ) );
+ if( aPopupMenu.Execute( &GetStatusBar(), rCEvt.GetMousePosPixel() ) )
+ {
+ ::com::sun::star::uno::Any a;
+ SfxUInt16Item aState( GetSlotId(), 0 );
+ INetURLObject aObj( m_aCommandURL );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs( 1 );
+ aArgs[0].Name = aObj.GetURLPath();
+ aState.QueryValue( a );
+ aArgs[0].Value = a;
+
+ execute( aArgs );
+ }
+ }
+ else
+ SfxStatusBarControl::Command( rCEvt );
+}
+
+void XmlSecStatusBarControl::Paint( const UserDrawEvent& rUsrEvt )
+{
+ OutputDevice* pDev = rUsrEvt.GetDevice();
+ DBG_ASSERT( pDev, "-XmlSecStatusBarControl::Paint(): no Output Device... this will lead to nirvana..." );
+ Rectangle aRect = rUsrEvt.GetRect();
+ StatusBar& rBar = GetStatusBar();
+ Point aItemPos = rBar.GetItemTextPos( GetId() );
+ Color aOldLineColor = pDev->GetLineColor();
+ Color aOldFillColor = pDev->GetFillColor();
+
+ pDev->SetLineColor();
+ pDev->SetFillColor( pDev->GetBackground().GetColor() );
+
+ if( mpImpl->mnState == SIGNATURESTATE_SIGNATURES_OK )
+ {
+ ++aRect.Top();
+ pDev->DrawImage( aRect.TopLeft(), mpImpl->maImage );
+ }
+ else if( mpImpl->mnState == SIGNATURESTATE_SIGNATURES_BROKEN )
+ {
+ ++aRect.Top();
+ pDev->DrawImage( aRect.TopLeft(), mpImpl->maImageBroken );
+ }
+ else if( mpImpl->mnState == SIGNATURESTATE_SIGNATURES_NOTVALIDATED
+ || mpImpl->mnState == SIGNATURESTATE_SIGNATURES_PARTIAL_OK)
+ {
+ ++aRect.Top();
+ pDev->DrawImage( aRect.TopLeft(), mpImpl->maImageNotValidated );
+ }
+ else
+ pDev->DrawRect( aRect );
+
+ pDev->SetLineColor( aOldLineColor );
+ pDev->SetFillColor( aOldFillColor );
+}
+
+long XmlSecStatusBarControl::GetDefItemWidth( StatusBar& )
+{
+ return 16;
+}
+
diff --git a/svx/source/stbctrls/zoomctrl.cxx b/svx/source/stbctrls/zoomctrl.cxx
new file mode 100644
index 000000000000..9439df87d8b9
--- /dev/null
+++ b/svx/source/stbctrls/zoomctrl.cxx
@@ -0,0 +1,223 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <tools/shl.hxx>
+#ifndef _STATUS_HXX //autogen
+#include <vcl/status.hxx>
+#endif
+#ifndef _MENU_HXX //autogen
+#include <vcl/menu.hxx>
+#endif
+#include <sfx2/dispatch.hxx>
+#include <tools/urlobj.hxx>
+
+#include <svx/dialogs.hrc>
+
+#include "svx/zoomctrl.hxx"
+//CHINA001 #include "zoom.hxx"
+#include <svx/zoomitem.hxx>
+#include "stbctrls.h"
+#include <svx/dialmgr.hxx>
+
+SFX_IMPL_STATUSBAR_CONTROL(SvxZoomStatusBarControl,SvxZoomItem);
+
+// class ZoomPopup_Impl --------------------------------------------------
+
+class ZoomPopup_Impl : public PopupMenu
+{
+public:
+ ZoomPopup_Impl( sal_uInt16 nZ, sal_uInt16 nValueSet );
+
+ sal_uInt16 GetZoom() const { return nZoom; }
+ sal_uInt16 GetCurId() const { return nCurId; }
+
+private:
+ sal_uInt16 nZoom;
+ sal_uInt16 nCurId;
+
+ virtual void Select();
+};
+
+// -----------------------------------------------------------------------
+
+ZoomPopup_Impl::ZoomPopup_Impl( sal_uInt16 nZ, sal_uInt16 nValueSet )
+
+: PopupMenu( ResId( RID_SVXMNU_ZOOM, DIALOG_MGR() ) ),
+
+ nZoom( nZ )
+{
+ static sal_uInt16 aTable[] =
+ {
+ SVX_ZOOM_ENABLE_50, ZOOM_50,
+ SVX_ZOOM_ENABLE_100, ZOOM_100,
+ SVX_ZOOM_ENABLE_150, ZOOM_150,
+ SVX_ZOOM_ENABLE_200, ZOOM_200,
+ SVX_ZOOM_ENABLE_OPTIMAL, ZOOM_OPTIMAL,
+ SVX_ZOOM_ENABLE_WHOLEPAGE, ZOOM_WHOLE_PAGE,
+ SVX_ZOOM_ENABLE_PAGEWIDTH, ZOOM_PAGE_WIDTH
+ };
+
+ for ( sal_uInt16 nPos = 0; nPos < sizeof(aTable) / sizeof(sal_uInt16); nPos += 2 )
+ if ( ( aTable[nPos] != ( aTable[nPos] & nValueSet ) ) )
+ EnableItem( aTable[nPos+1], sal_False );
+}
+
+// -----------------------------------------------------------------------
+
+void ZoomPopup_Impl::Select()
+{
+ nCurId = GetCurItemId();
+
+ switch ( nCurId )
+ {
+ case ZOOM_200: nZoom = 200; break;
+ case ZOOM_150: nZoom = 150; break;
+ case ZOOM_100: nZoom = 100; break;
+ case ZOOM_75: nZoom = 75; break;
+ case ZOOM_50: nZoom = 50; break;
+
+ case ZOOM_OPTIMAL:
+ case ZOOM_PAGE_WIDTH:
+ case ZOOM_WHOLE_PAGE: nZoom = 0; break;
+
+ }
+}
+
+// class SvxZoomStatusBarControl ------------------------------------------
+
+SvxZoomStatusBarControl::SvxZoomStatusBarControl( sal_uInt16 _nSlotId,
+ sal_uInt16 _nId,
+ StatusBar& rStb ) :
+
+ SfxStatusBarControl( _nSlotId, _nId, rStb ),
+ nZoom( 100 ),
+ nValueSet( SVX_ZOOM_ENABLE_ALL )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SvxZoomStatusBarControl::StateChanged( sal_uInt16, SfxItemState eState,
+ const SfxPoolItem* pState )
+{
+ if( SFX_ITEM_AVAILABLE != eState )
+ {
+ GetStatusBar().SetItemText( GetId(), String() );
+ nValueSet = 0;
+ }
+ else if ( pState->ISA( SfxUInt16Item) )
+ {
+ const SfxUInt16Item* pItem = (const SfxUInt16Item*)pState;
+ nZoom = pItem->GetValue();
+ String aStr( String::CreateFromInt32(nZoom) );
+ aStr += '%';
+ GetStatusBar().SetItemText( GetId(), aStr );
+
+ if ( pState->ISA(SvxZoomItem) )
+ {
+ nValueSet = ((const SvxZoomItem*)pState)->GetValueSet();
+/*!!!
+ SvxZoomType eType = ((const SvxZoomItem*)pState)->GetType();
+
+ switch ( eType )
+ {
+ case SVX_ZOOM_OPTIMAL:
+ GetStatusBar().SetItemText( GetId(), "Opt." );
+ break;
+ case SVX_ZOOM_WHOLEPAGE:
+ GetStatusBar().SetItemText( GetId(), "Page" );
+ break;
+ case SVX_ZOOM_PAGEWIDTH:
+ GetStatusBar().SetItemText( GetId(), "Width" );
+ break;
+ }
+*/
+ }
+ else
+ {
+ DBG_WARNING( "use SfxZoomItem for SID_ATTR_ZOOM" );
+ nValueSet = SVX_ZOOM_ENABLE_ALL;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxZoomStatusBarControl::Paint( const UserDrawEvent& )
+{
+ String aStr( String::CreateFromInt32( nZoom ));
+ aStr += '%';
+ GetStatusBar().SetItemText( GetId(), aStr );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxZoomStatusBarControl::Command( const CommandEvent& rCEvt )
+{
+ if ( COMMAND_CONTEXTMENU & rCEvt.GetCommand() && 0 != nValueSet )
+ {
+ CaptureMouse();
+ ZoomPopup_Impl aPop( nZoom, nValueSet );
+ StatusBar& rStatusbar = GetStatusBar();
+
+ if ( aPop.Execute( &rStatusbar, rCEvt.GetMousePosPixel() ) && ( nZoom != aPop.GetZoom() || !nZoom ) )
+ {
+ nZoom = aPop.GetZoom();
+ SvxZoomItem aZoom( SVX_ZOOM_PERCENT, nZoom, GetId() );
+
+ switch( aPop.GetCurId() )
+ {
+ case ZOOM_OPTIMAL: aZoom.SetType( SVX_ZOOM_OPTIMAL ); break;
+ case ZOOM_PAGE_WIDTH: aZoom.SetType( SVX_ZOOM_PAGEWIDTH ); break;
+ case ZOOM_WHOLE_PAGE: aZoom.SetType( SVX_ZOOM_WHOLEPAGE ); break;
+ }
+
+ ::com::sun::star::uno::Any a;
+ INetURLObject aObj( m_aCommandURL );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs( 1 );
+ aArgs[0].Name = aObj.GetURLPath();
+ aZoom.QueryValue( a );
+ aArgs[0].Value = a;
+
+ execute( aArgs );
+ }
+ ReleaseMouse();
+ }
+ else
+ SfxStatusBarControl::Command( rCEvt );
+}
+
+sal_uIntPtr SvxZoomStatusBarControl::GetDefItemWidth(const StatusBar& rStb)
+{
+ long nWidth1 = rStb.GetTextWidth(String::CreateFromAscii("XXXXX%"));
+ return nWidth1;
+}
+
+
diff --git a/svx/source/stbctrls/zoomsliderctrl.cxx b/svx/source/stbctrls/zoomsliderctrl.cxx
new file mode 100644
index 000000000000..a957482405c4
--- /dev/null
+++ b/svx/source/stbctrls/zoomsliderctrl.cxx
@@ -0,0 +1,448 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <svx/zoomsliderctrl.hxx>
+#ifndef _STATUS_HXX //autogen
+#include <vcl/status.hxx>
+#endif
+#ifndef _MENU_HXX //autogen
+#include <vcl/menu.hxx>
+#endif
+#include <vcl/image.hxx>
+#include <svx/zoomslideritem.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+
+#include <set>
+
+// -----------------------------------------------------------------------
+
+SFX_IMPL_STATUSBAR_CONTROL( SvxZoomSliderControl, SvxZoomSliderItem );
+
+// -----------------------------------------------------------------------
+
+struct SvxZoomSliderControl::SvxZoomSliderControl_Impl
+{
+ sal_uInt16 mnCurrentZoom;
+ sal_uInt16 mnMinZoom;
+ sal_uInt16 mnMaxZoom;
+ sal_uInt16 mnSliderCenter;
+ std::vector< long > maSnappingPointOffsets;
+ std::vector< sal_uInt16 > maSnappingPointZooms;
+ Image maSliderButton;
+ Image maIncreaseButton;
+ Image maDecreaseButton;
+ bool mbValuesSet;
+ bool mbOmitPaint;
+
+ SvxZoomSliderControl_Impl() :
+ mnCurrentZoom( 0 ),
+ mnMinZoom( 0 ),
+ mnMaxZoom( 0 ),
+ mnSliderCenter( 0 ),
+ maSnappingPointOffsets(),
+ maSnappingPointZooms(),
+ maSliderButton(),
+ maIncreaseButton(),
+ maDecreaseButton(),
+ mbValuesSet( false ),
+ mbOmitPaint( false ) {}
+};
+
+// -----------------------------------------------------------------------
+
+const long nButtonWidth = 10;
+const long nButtonHeight = 10;
+const long nIncDecWidth = 11;
+const long nIncDecHeight = 11;
+const long nSliderHeight = 2;
+const long nSnappingHeight = 4;
+const long nSliderXOffset = 20;
+const long nSnappingEpsilon = 5; // snapping epsilon in pixels
+const long nSnappingPointsMinDist = nSnappingEpsilon; // minimum distance of two adjacent snapping points
+
+// -----------------------------------------------------------------------
+
+// nOffset referes to the origin of the control:
+// + ----------- -
+sal_uInt16 SvxZoomSliderControl::Offset2Zoom( long nOffset ) const
+{
+ const long nControlWidth = getControlRect().GetWidth();
+ sal_uInt16 nRet = 0;
+
+ if ( nOffset < nSliderXOffset )
+ return mpImpl->mnMinZoom;;
+
+ if ( nOffset > nControlWidth - nSliderXOffset )
+ return mpImpl->mnMaxZoom;
+
+ // check for snapping points:
+ sal_uInt16 nCount = 0;
+ std::vector< long >::iterator aSnappingPointIter;
+ for ( aSnappingPointIter = mpImpl->maSnappingPointOffsets.begin();
+ aSnappingPointIter != mpImpl->maSnappingPointOffsets.end();
+ ++aSnappingPointIter )
+ {
+ const long nCurrent = *aSnappingPointIter;
+ if ( Abs(nCurrent - nOffset) < nSnappingEpsilon )
+ {
+ nOffset = nCurrent;
+ nRet = mpImpl->maSnappingPointZooms[ nCount ];
+ break;
+ }
+ ++nCount;
+ }
+
+ if ( 0 == nRet )
+ {
+ if ( nOffset < nControlWidth / 2 )
+ {
+ // first half of slider
+ const long nFirstHalfRange = mpImpl->mnSliderCenter - mpImpl->mnMinZoom;
+ const long nHalfSliderWidth = nControlWidth/2 - nSliderXOffset;
+ const long nZoomPerSliderPixel = (1000 * nFirstHalfRange) / nHalfSliderWidth;
+ const long nOffsetToSliderLeft = nOffset - nSliderXOffset;
+ nRet = mpImpl->mnMinZoom + sal_uInt16( nOffsetToSliderLeft * nZoomPerSliderPixel / 1000 );
+ }
+ else
+ {
+ // second half of slider
+ const long nSecondHalfRange = mpImpl->mnMaxZoom - mpImpl->mnSliderCenter;
+ const long nHalfSliderWidth = nControlWidth/2 - nSliderXOffset;
+ const long nZoomPerSliderPixel = 1000 * nSecondHalfRange / nHalfSliderWidth;
+ const long nOffsetToSliderCenter = nOffset - nControlWidth/2;
+ nRet = mpImpl->mnSliderCenter + sal_uInt16( nOffsetToSliderCenter * nZoomPerSliderPixel / 1000 );
+ }
+ }
+
+ if ( nRet < mpImpl->mnMinZoom )
+ nRet = mpImpl->mnMinZoom;
+ else if ( nRet > mpImpl->mnMaxZoom )
+ nRet = mpImpl->mnMaxZoom;
+
+ return nRet;
+}
+
+// returns the offset to the left control border
+long SvxZoomSliderControl::Zoom2Offset( sal_uInt16 nCurrentZoom ) const
+{
+ const long nControlWidth = getControlRect().GetWidth();
+ long nRet = nSliderXOffset;
+
+ const long nHalfSliderWidth = nControlWidth/2 - nSliderXOffset;
+
+ if ( nCurrentZoom <= mpImpl->mnSliderCenter )
+ {
+ nCurrentZoom = nCurrentZoom - mpImpl->mnMinZoom;
+ const long nFirstHalfRange = mpImpl->mnSliderCenter - mpImpl->mnMinZoom;
+ const long nSliderPixelPerZoomPercent = 1000 * nHalfSliderWidth / nFirstHalfRange;
+ const long nOffset = (nSliderPixelPerZoomPercent * nCurrentZoom) / 1000;
+ nRet += nOffset;
+ }
+ else
+ {
+ nCurrentZoom = nCurrentZoom - mpImpl->mnSliderCenter;
+ const long nSecondHalfRange = mpImpl->mnMaxZoom - mpImpl->mnSliderCenter;
+ const long nSliderPixelPerZoomPercent = 1000 * nHalfSliderWidth / nSecondHalfRange;
+ const long nOffset = (nSliderPixelPerZoomPercent * nCurrentZoom) / 1000;
+ nRet += nHalfSliderWidth + nOffset;
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+SvxZoomSliderControl::SvxZoomSliderControl( sal_uInt16 _nSlotId, sal_uInt16 _nId, StatusBar& _rStb ) :
+ SfxStatusBarControl( _nSlotId, _nId, _rStb ),
+ mpImpl( new SvxZoomSliderControl_Impl )
+{
+ const sal_Bool bHC = GetStatusBar().GetSettings().GetStyleSettings().GetHighContrastMode();
+ mpImpl->maSliderButton = Image( SVX_RES( bHC ? RID_SVXBMP_SLIDERBUTTON_HC : RID_SVXBMP_SLIDERBUTTON ) );
+ mpImpl->maIncreaseButton = Image( SVX_RES( bHC ? RID_SVXBMP_SLIDERINCREASE_HC : RID_SVXBMP_SLIDERINCREASE ) );
+ mpImpl->maDecreaseButton = Image( SVX_RES( bHC ? RID_SVXBMP_SLIDERDECREASE_HC : RID_SVXBMP_SLIDERDECREASE ) );
+}
+
+// -----------------------------------------------------------------------
+
+SvxZoomSliderControl::~SvxZoomSliderControl()
+{
+ delete mpImpl;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxZoomSliderControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState )
+{
+ if ( (SFX_ITEM_AVAILABLE != eState) || pState->ISA( SfxVoidItem ) )
+ {
+ GetStatusBar().SetItemText( GetId(), String() );
+ mpImpl->mbValuesSet = false;
+ }
+ else
+ {
+ OSL_ENSURE( pState->ISA( SvxZoomSliderItem ), "invalid item type: should be a SvxZoomSliderItem" );
+ mpImpl->mnCurrentZoom = static_cast<const SvxZoomSliderItem*>( pState )->GetValue();
+ mpImpl->mnMinZoom = static_cast<const SvxZoomSliderItem*>( pState )->GetMinZoom();
+ mpImpl->mnMaxZoom = static_cast<const SvxZoomSliderItem*>( pState )->GetMaxZoom();
+ mpImpl->mnSliderCenter= 100;
+ mpImpl->mbValuesSet = true;
+
+ if ( mpImpl->mnSliderCenter == mpImpl->mnMaxZoom )
+ mpImpl->mnSliderCenter = mpImpl->mnMinZoom + (sal_uInt16)((mpImpl->mnMaxZoom - mpImpl->mnMinZoom) * 0.5);
+
+
+ DBG_ASSERT( mpImpl->mnMinZoom <= mpImpl->mnCurrentZoom &&
+ mpImpl->mnMinZoom < mpImpl->mnSliderCenter &&
+ mpImpl->mnMaxZoom >= mpImpl->mnCurrentZoom &&
+ mpImpl->mnMaxZoom > mpImpl->mnSliderCenter,
+ "Looks like the zoom slider item is corrupted" );
+
+ const com::sun::star::uno::Sequence < sal_Int32 > rSnappingPoints = static_cast<const SvxZoomSliderItem*>( pState )->GetSnappingPoints();
+ mpImpl->maSnappingPointOffsets.clear();
+ mpImpl->maSnappingPointZooms.clear();
+
+ // get all snapping points:
+ std::set< sal_uInt16 > aTmpSnappingPoints;
+ for ( sal_uInt16 j = 0; j < rSnappingPoints.getLength(); ++j )
+ {
+ const sal_Int32 nSnappingPoint = rSnappingPoints[j];
+ aTmpSnappingPoints.insert( (sal_uInt16)nSnappingPoint );
+ }
+
+ // remove snapping points that are to close to each other:
+ std::set< sal_uInt16 >::iterator aSnappingPointIter;
+ long nLastOffset = 0;
+
+ for ( aSnappingPointIter = aTmpSnappingPoints.begin(); aSnappingPointIter != aTmpSnappingPoints.end(); ++aSnappingPointIter )
+ {
+ const sal_uInt16 nCurrent = *aSnappingPointIter;
+ const long nCurrentOffset = Zoom2Offset( nCurrent );
+
+ if ( nCurrentOffset - nLastOffset >= nSnappingPointsMinDist )
+ {
+ mpImpl->maSnappingPointOffsets.push_back( nCurrentOffset );
+ mpImpl->maSnappingPointZooms.push_back( nCurrent );
+ nLastOffset = nCurrentOffset;
+ }
+ }
+ }
+
+ if ( !mpImpl->mbOmitPaint && GetStatusBar().AreItemsVisible() )
+ GetStatusBar().SetItemData( GetId(), 0 ); // force repaint
+}
+
+// -----------------------------------------------------------------------
+
+void SvxZoomSliderControl::Paint( const UserDrawEvent& rUsrEvt )
+{
+ if ( !mpImpl->mbValuesSet || mpImpl->mbOmitPaint )
+ return;
+
+ const Rectangle aControlRect = getControlRect();
+ OutputDevice* pDev = rUsrEvt.GetDevice();
+ Rectangle aRect = rUsrEvt.GetRect();
+ Rectangle aSlider = aRect;
+
+ aSlider.Top() += (aControlRect.GetHeight() - nSliderHeight)/2 - 1;
+ aSlider.Bottom() = aSlider.Top() + nSliderHeight;
+ aSlider.Left() += nSliderXOffset;
+ aSlider.Right() -= nSliderXOffset;
+
+ Color aOldLineColor = pDev->GetLineColor();
+ Color aOldFillColor = pDev->GetFillColor();
+
+ pDev->SetLineColor( Color( COL_GRAY ) );
+ pDev->SetFillColor( Color( COL_GRAY ) );
+
+ // draw snapping points:
+ std::vector< long >::iterator aSnappingPointIter;
+ for ( aSnappingPointIter = mpImpl->maSnappingPointOffsets.begin();
+ aSnappingPointIter != mpImpl->maSnappingPointOffsets.end();
+ ++aSnappingPointIter )
+ {
+ Rectangle aSnapping( aRect );
+ aSnapping.Bottom() = aSlider.Top();
+ aSnapping.Top() = aSnapping.Bottom() - nSnappingHeight;
+ aSnapping.Left() += *aSnappingPointIter;
+ aSnapping.Right() = aSnapping.Left();
+ pDev->DrawRect( aSnapping );
+
+ aSnapping.Top() += nSnappingHeight + nSliderHeight;
+ aSnapping.Bottom() += nSnappingHeight + nSliderHeight;
+ pDev->DrawRect( aSnapping );
+ }
+
+ // draw slider
+ Rectangle aFirstLine( aSlider );
+ aFirstLine.Bottom() = aFirstLine.Top();
+
+ Rectangle aSecondLine( aSlider );
+ aSecondLine.Top() = aSecondLine.Bottom();
+
+ Rectangle aLeft( aSlider );
+ aLeft.Right() = aLeft.Left();
+
+ Rectangle aRight( aSlider );
+ aRight.Left() = aRight.Right();
+
+ pDev->SetLineColor( Color ( COL_WHITE ) );
+ pDev->SetFillColor( Color ( COL_WHITE ) );
+ pDev->DrawRect( aSecondLine );
+ pDev->DrawRect( aRight );
+
+ pDev->SetLineColor( Color( COL_GRAY ) );
+ pDev->SetFillColor( Color( COL_GRAY ) );
+ pDev->DrawRect( aFirstLine );
+ pDev->DrawRect( aLeft );
+
+ // draw slider button
+ Point aImagePoint = aRect.TopLeft();
+ aImagePoint.X() += Zoom2Offset( mpImpl->mnCurrentZoom );
+ aImagePoint.X() -= nButtonWidth/2;
+ aImagePoint.Y() += (aControlRect.GetHeight() - nButtonHeight)/2;
+ pDev->DrawImage( aImagePoint, mpImpl->maSliderButton );
+
+ // draw decrease button
+ aImagePoint = aRect.TopLeft();
+ aImagePoint.X() += (nSliderXOffset - nIncDecWidth)/2;
+ aImagePoint.Y() += (aControlRect.GetHeight() - nIncDecHeight)/2;
+ pDev->DrawImage( aImagePoint, mpImpl->maDecreaseButton );
+
+ // draw increase button
+ aImagePoint.X() = aRect.TopLeft().X() + aControlRect.GetWidth() - nIncDecWidth - (nSliderXOffset - nIncDecWidth)/2;
+ pDev->DrawImage( aImagePoint, mpImpl->maIncreaseButton );
+
+ pDev->SetLineColor( aOldLineColor );
+ pDev->SetFillColor( aOldFillColor );
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxZoomSliderControl::MouseButtonDown( const MouseEvent & rEvt )
+{
+ if ( !mpImpl->mbValuesSet )
+ return sal_True;;
+
+ const Rectangle aControlRect = getControlRect();
+ const Point aPoint = rEvt.GetPosPixel();
+ const sal_Int32 nXDiff = aPoint.X() - aControlRect.Left();
+
+ const long nButtonLeftOffset = (nSliderXOffset - nIncDecWidth)/2;
+ const long nButtonRightOffset = (nSliderXOffset + nIncDecWidth)/2;
+
+ const long nOldZoom = mpImpl->mnCurrentZoom;
+
+ // click to - button
+ if ( nXDiff >= nButtonLeftOffset && nXDiff <= nButtonRightOffset )
+ mpImpl->mnCurrentZoom = mpImpl->mnCurrentZoom - 5;
+ // click to + button
+ else if ( nXDiff >= aControlRect.GetWidth() - nSliderXOffset + nButtonLeftOffset &&
+ nXDiff <= aControlRect.GetWidth() - nSliderXOffset + nButtonRightOffset )
+ mpImpl->mnCurrentZoom = mpImpl->mnCurrentZoom + 5;
+ // click to slider
+ else if( nXDiff >= nSliderXOffset && nXDiff <= aControlRect.GetWidth() - nSliderXOffset )
+ mpImpl->mnCurrentZoom = Offset2Zoom( nXDiff );
+
+ if ( mpImpl->mnCurrentZoom < mpImpl->mnMinZoom )
+ mpImpl->mnCurrentZoom = mpImpl->mnMinZoom;
+ else if ( mpImpl->mnCurrentZoom > mpImpl->mnMaxZoom )
+ mpImpl->mnCurrentZoom = mpImpl->mnMaxZoom;
+
+ if ( nOldZoom == mpImpl->mnCurrentZoom )
+ return sal_True;
+
+ if ( GetStatusBar().AreItemsVisible() )
+ GetStatusBar().SetItemData( GetId(), 0 ); // force repaint
+
+ mpImpl->mbOmitPaint = true; // optimization: paint before executing command,
+ // then omit painting which is triggered by the execute function
+
+ SvxZoomSliderItem aZoomSliderItem( mpImpl->mnCurrentZoom );
+
+ ::com::sun::star::uno::Any a;
+ aZoomSliderItem.QueryValue( a );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs( 1 );
+ aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ZoomSlider" ));
+ aArgs[0].Value = a;
+
+ execute( aArgs );
+
+ mpImpl->mbOmitPaint = false;
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxZoomSliderControl::MouseMove( const MouseEvent & rEvt )
+{
+ if ( !mpImpl->mbValuesSet )
+ return sal_True;;
+
+ const short nButtons = rEvt.GetButtons();
+
+ // check mouse move with button pressed
+ if ( 1 == nButtons )
+ {
+ const Rectangle aControlRect = getControlRect();
+ const Point aPoint = rEvt.GetPosPixel();
+ const sal_Int32 nXDiff = aPoint.X() - aControlRect.Left();
+
+ if ( nXDiff >= nSliderXOffset && nXDiff <= aControlRect.GetWidth() - nSliderXOffset )
+ {
+ mpImpl->mnCurrentZoom = Offset2Zoom( nXDiff );
+
+ if ( GetStatusBar().AreItemsVisible() )
+ GetStatusBar().SetItemData( GetId(), 0 ); // force repaint
+
+ mpImpl->mbOmitPaint = true; // optimization: paint before executing command,
+ // then omit painting which is triggered by the execute function
+
+ // commit state change
+ SvxZoomSliderItem aZoomSliderItem( mpImpl->mnCurrentZoom );
+
+ ::com::sun::star::uno::Any a;
+ aZoomSliderItem.QueryValue( a );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs( 1 );
+ aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ZoomSlider" ));
+ aArgs[0].Value = a;
+
+ execute( aArgs );
+
+ mpImpl->mbOmitPaint = false;
+ }
+ }
+
+ return sal_True;
+}
diff --git a/svx/source/svdraw/ActionDescriptionProvider.cxx b/svx/source/svdraw/ActionDescriptionProvider.cxx
new file mode 100644
index 000000000000..d6805fb24ee3
--- /dev/null
+++ b/svx/source/svdraw/ActionDescriptionProvider.cxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svx/ActionDescriptionProvider.hxx"
+#include "svx/svdglob.hxx"
+#include "svx/svdstr.hrc"
+
+::rtl::OUString ActionDescriptionProvider::createDescription( ActionType eActionType
+ , const ::rtl::OUString& rObjectName )
+{
+ sal_uInt16 nResID=0;
+ switch( eActionType )
+ {
+ case INSERT:
+ nResID=STR_UndoInsertObj;
+ break;
+ case DELETE:
+ nResID= STR_EditDelete;
+ break;
+ case CUT:
+ nResID= STR_ExchangeClpCut;
+ break;
+ case MOVE:
+ nResID= STR_EditMove;
+ break;
+ case RESIZE:
+ nResID= STR_EditResize;
+ break;
+ case ROTATE:
+ nResID= STR_EditRotate;
+ break;
+ case TRANSFORM:
+ nResID= STR_EditTransform;
+ break;
+ case FORMAT:
+ nResID= STR_EditSetAttributes;
+ break;
+ case MOVE_TOTOP:
+ nResID= STR_EditMovToTop;
+ break;
+ case MOVE_TOBOTTOM:
+ nResID= STR_EditMovToBtm;
+ break;
+ case POS_SIZE:
+ nResID = STR_EditPosSize;
+ break;
+ }
+ if(!nResID)
+ return rtl::OUString();
+
+ XubString aStr(ImpGetResStr(nResID));
+ XubString aName(rObjectName);
+ aStr.SearchAndReplaceAscii("%1", aName);
+ return rtl::OUString(aStr);
+}
diff --git a/svx/source/svdraw/clonelist.cxx b/svx/source/svdraw/clonelist.cxx
new file mode 100644
index 000000000000..b09b7de83c18
--- /dev/null
+++ b/svx/source/svdraw/clonelist.cxx
@@ -0,0 +1,134 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// #i13033#
+// New mechanism to hold a ist of all original and cloned objects for later
+// re-creating the connections for contained connectors
+#include <clonelist.hxx>
+#include <svx/svdoedge.hxx>
+#include <svx/scene3d.hxx>
+
+CloneList::CloneList()
+{
+}
+
+CloneList::~CloneList()
+{
+}
+
+void CloneList::AddPair(const SdrObject* pOriginal, SdrObject* pClone)
+{
+ maOriginalList.Insert((SdrObject*)pOriginal, LIST_APPEND);
+ maCloneList.Insert(pClone, LIST_APPEND);
+
+ // look for subobjects, too.
+ sal_Bool bOriginalIsGroup(pOriginal->IsGroupObject());
+ sal_Bool bCloneIsGroup(pClone->IsGroupObject());
+
+ if(bOriginalIsGroup && pOriginal->ISA(E3dObject) && !pOriginal->ISA(E3dScene))
+ bOriginalIsGroup = sal_False;
+
+ if(bCloneIsGroup && pClone->ISA(E3dObject) && !pClone->ISA(E3dScene))
+ bCloneIsGroup = sal_False;
+
+ if(bOriginalIsGroup && bCloneIsGroup)
+ {
+ const SdrObjList* pOriginalList = pOriginal->GetSubList();
+ SdrObjList* pCloneList = pClone->GetSubList();
+
+ if(pOriginalList && pCloneList
+ && pOriginalList->GetObjCount() == pCloneList->GetObjCount())
+ {
+ for(sal_uInt32 a(0); a < pOriginalList->GetObjCount(); a++)
+ {
+ // recursive call
+ AddPair(pOriginalList->GetObj(a), pCloneList->GetObj(a));
+ }
+ }
+ }
+}
+
+sal_uInt32 CloneList::Count() const
+{
+ return maOriginalList.Count();
+}
+
+const SdrObject* CloneList::GetOriginal(sal_uInt32 nIndex) const
+{
+ return (SdrObject*)maOriginalList.GetObject(nIndex);
+}
+
+SdrObject* CloneList::GetClone(sal_uInt32 nIndex) const
+{
+ return (SdrObject*)maCloneList.GetObject(nIndex);
+}
+
+void CloneList::CopyConnections() const
+{
+ for(sal_uInt32 a(0); a < maOriginalList.Count(); a++)
+ {
+ const SdrEdgeObj* pOriginalEdge = PTR_CAST(SdrEdgeObj, GetOriginal(a));
+ SdrEdgeObj* pCloneEdge = PTR_CAST(SdrEdgeObj, GetClone(a));
+
+ if(pOriginalEdge && pCloneEdge)
+ {
+ SdrObject* pOriginalNode1 = pOriginalEdge->GetConnectedNode(sal_True);
+ SdrObject* pOriginalNode2 = pOriginalEdge->GetConnectedNode(sal_False);
+
+ if(pOriginalNode1)
+ {
+ sal_uLong nPos(maOriginalList.GetPos(pOriginalNode1));
+
+ if(LIST_ENTRY_NOTFOUND != nPos)
+ {
+ if(pOriginalEdge->GetConnectedNode(sal_True) != GetClone(nPos))
+ {
+ pCloneEdge->ConnectToNode(sal_True, GetClone(nPos));
+ }
+ }
+ }
+
+ if(pOriginalNode2)
+ {
+ sal_uLong nPos(maOriginalList.GetPos(pOriginalNode2));
+
+ if(LIST_ENTRY_NOTFOUND != nPos)
+ {
+ if(pOriginalEdge->GetConnectedNode(sal_False) != GetClone(nPos))
+ {
+ pCloneEdge->ConnectToNode(sal_False, GetClone(nPos));
+ }
+ }
+ }
+ }
+ }
+}
+
+// eof
diff --git a/svx/source/svdraw/gradtrns.cxx b/svx/source/svdraw/gradtrns.cxx
new file mode 100644
index 000000000000..57f6270c4f91
--- /dev/null
+++ b/svx/source/svdraw/gradtrns.cxx
@@ -0,0 +1,538 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "gradtrns.hxx"
+#include <svx/svdobj.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <vcl/salbtype.hxx> // FRound
+
+//////////////////////////////////////////////////////////////////////////////
+
+void GradTransformer::GradToVec(GradTransGradient& rG, GradTransVector& rV, const SdrObject* pObj)
+{
+ // handle start color
+ rV.aCol1 = rG.aGradient.GetStartColor();
+ if(100 != rG.aGradient.GetStartIntens())
+ {
+ const double fFact((double)rG.aGradient.GetStartIntens() / 100.0);
+ rV.aCol1 = Color(rV.aCol1.getBColor() * fFact);
+ }
+
+ // handle end color
+ rV.aCol2 = rG.aGradient.GetEndColor();
+ if(100 != rG.aGradient.GetEndIntens())
+ {
+ const double fFact((double)rG.aGradient.GetEndIntens() / 100.0);
+ rV.aCol2 = Color(rV.aCol2.getBColor() * fFact);
+ }
+
+ // calc the basic positions
+ const Rectangle aObjectSnapRectangle(pObj->GetSnapRect());
+ const basegfx::B2DRange aRange(aObjectSnapRectangle.Left(), aObjectSnapRectangle.Top(), aObjectSnapRectangle.Right(), aObjectSnapRectangle.Bottom());
+ const basegfx::B2DPoint aCenter(aRange.getCenter());
+ basegfx::B2DPoint aStartPos, aEndPos;
+
+ switch(rG.aGradient.GetGradientStyle())
+ {
+ case XGRAD_LINEAR :
+ {
+ aStartPos = basegfx::B2DPoint(aCenter.getX(), aRange.getMinY());
+ aEndPos = basegfx::B2DPoint(aCenter.getX(), aRange.getMaximum().getY());
+
+ if(rG.aGradient.GetBorder())
+ {
+ basegfx::B2DVector aFullVec(aStartPos - aEndPos);
+ const double fLen = (aFullVec.getLength() * (100.0 - (double)rG.aGradient.GetBorder())) / 100.0;
+ aFullVec.normalize();
+ aStartPos = aEndPos + (aFullVec * fLen);
+ }
+
+ if(rG.aGradient.GetAngle())
+ {
+ const double fAngle = (double)rG.aGradient.GetAngle() * (F_PI180 / 10.0);
+ const basegfx::B2DHomMatrix aTransformation(basegfx::tools::createRotateAroundPoint(aCenter, -fAngle));
+
+ aStartPos *= aTransformation;
+ aEndPos *= aTransformation;
+ }
+ break;
+ }
+ case XGRAD_AXIAL :
+ {
+ aStartPos = aCenter;
+ aEndPos = basegfx::B2DPoint(aCenter.getX(), aRange.getMaximum().getY());
+
+ if(rG.aGradient.GetBorder())
+ {
+ basegfx::B2DVector aFullVec(aEndPos - aStartPos);
+ const double fLen = (aFullVec.getLength() * (100.0 - (double)rG.aGradient.GetBorder())) / 100.0;
+ aFullVec.normalize();
+ aEndPos = aStartPos + (aFullVec * fLen);
+ }
+
+ if(rG.aGradient.GetAngle())
+ {
+ const double fAngle = (double)rG.aGradient.GetAngle() * (F_PI180 / 10.0);
+ const basegfx::B2DHomMatrix aTransformation(basegfx::tools::createRotateAroundPoint(aCenter, -fAngle));
+
+ aStartPos *= aTransformation;
+ aEndPos *= aTransformation;
+ }
+ break;
+ }
+ case XGRAD_RADIAL :
+ case XGRAD_SQUARE :
+ {
+ aStartPos = basegfx::B2DPoint(aRange.getMinX(), aRange.getMaximum().getY());
+ aEndPos = basegfx::B2DPoint(aRange.getMinX(), aRange.getMinY());
+
+ if(rG.aGradient.GetBorder())
+ {
+ basegfx::B2DVector aFullVec(aStartPos - aEndPos);
+ const double fLen = (aFullVec.getLength() * (100.0 - (double)rG.aGradient.GetBorder())) / 100.0;
+ aFullVec.normalize();
+ aStartPos = aEndPos + (aFullVec * fLen);
+ }
+
+ if(rG.aGradient.GetAngle())
+ {
+ const double fAngle = (double)rG.aGradient.GetAngle() * (F_PI180 / 10.0);
+ const basegfx::B2DHomMatrix aTransformation(basegfx::tools::createRotateAroundPoint(aEndPos, -fAngle));
+
+ aStartPos *= aTransformation;
+ aEndPos *= aTransformation;
+ }
+
+ if(rG.aGradient.GetXOffset() || rG.aGradient.GetYOffset())
+ {
+ basegfx::B2DPoint aOffset(
+ (aRange.getWidth() * rG.aGradient.GetXOffset()) / 100.0,
+ (aRange.getHeight() * rG.aGradient.GetYOffset()) / 100.0);
+
+ aStartPos += aOffset;
+ aEndPos += aOffset;
+ }
+
+ break;
+ }
+ case XGRAD_ELLIPTICAL :
+ case XGRAD_RECT :
+ {
+ aStartPos = basegfx::B2DPoint(aRange.getMinX(), aCenter.getY());
+ aEndPos = basegfx::B2DPoint(aRange.getMinX(), aRange.getMinY());
+
+ if(rG.aGradient.GetBorder())
+ {
+ basegfx::B2DVector aFullVec(aStartPos - aEndPos);
+ const double fLen = (aFullVec.getLength() * (100.0 - (double)rG.aGradient.GetBorder())) / 100.0;
+ aFullVec.normalize();
+ aStartPos = aEndPos + (aFullVec * fLen);
+ }
+
+ if(rG.aGradient.GetAngle())
+ {
+ const double fAngle = (double)rG.aGradient.GetAngle() * (F_PI180 / 10.0);
+ const basegfx::B2DHomMatrix aTransformation(basegfx::tools::createRotateAroundPoint(aEndPos, -fAngle));
+
+ aStartPos *= aTransformation;
+ aEndPos *= aTransformation;
+ }
+
+ if(rG.aGradient.GetXOffset() || rG.aGradient.GetYOffset())
+ {
+ basegfx::B2DPoint aOffset(
+ (aRange.getWidth() * rG.aGradient.GetXOffset()) / 100.0,
+ (aRange.getHeight() * rG.aGradient.GetYOffset()) / 100.0);
+
+ aStartPos += aOffset;
+ aEndPos += aOffset;
+ }
+
+ break;
+ }
+ }
+
+ // set values for vector positions now
+ rV.maPositionA = aStartPos;
+ rV.maPositionB = aEndPos;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void GradTransformer::VecToGrad(GradTransVector& rV, GradTransGradient& rG, GradTransGradient& rGOld, const SdrObject* pObj,
+ sal_Bool bMoveSingle, sal_Bool bMoveFirst)
+{
+ // fill old gradient to new gradient to have a base
+ rG = rGOld;
+
+ // handle color changes
+ if(rV.aCol1 != rGOld.aGradient.GetStartColor())
+ {
+ rG.aGradient.SetStartColor(rV.aCol1);
+ rG.aGradient.SetStartIntens(100);
+ }
+ if(rV.aCol2 != rGOld.aGradient.GetEndColor())
+ {
+ rG.aGradient.SetEndColor(rV.aCol2);
+ rG.aGradient.SetEndIntens(100);
+ }
+
+ // calc the basic positions
+ const Rectangle aObjectSnapRectangle(pObj->GetSnapRect());
+ const basegfx::B2DRange aRange(aObjectSnapRectangle.Left(), aObjectSnapRectangle.Top(), aObjectSnapRectangle.Right(), aObjectSnapRectangle.Bottom());
+ const basegfx::B2DPoint aCenter(aRange.getCenter());
+ basegfx::B2DPoint aStartPos(rV.maPositionA);
+ basegfx::B2DPoint aEndPos(rV.maPositionB);
+
+ switch(rG.aGradient.GetGradientStyle())
+ {
+ case XGRAD_LINEAR :
+ {
+ if(!bMoveSingle || (bMoveSingle && !bMoveFirst))
+ {
+ basegfx::B2DVector aFullVec(aEndPos - aStartPos);
+
+ if(bMoveSingle)
+ {
+ aFullVec = aEndPos - aCenter;
+ }
+
+ aFullVec.normalize();
+
+ double fNewFullAngle(atan2(aFullVec.getY(), aFullVec.getX()));
+ fNewFullAngle /= F_PI180;
+ fNewFullAngle *= -10.0;
+ fNewFullAngle += 900.0;
+
+ // clip
+ while(fNewFullAngle < 0.0)
+ {
+ fNewFullAngle += 3600.0;
+ }
+
+ while(fNewFullAngle >= 3600.0)
+ {
+ fNewFullAngle -= 3600.0;
+ }
+
+ // to int and set
+ sal_Int32 nNewAngle = FRound(fNewFullAngle);
+
+ if(nNewAngle != rGOld.aGradient.GetAngle())
+ {
+ rG.aGradient.SetAngle(nNewAngle);
+ }
+ }
+
+ if(!bMoveSingle || (bMoveSingle && bMoveFirst))
+ {
+ const basegfx::B2DVector aFullVec(aEndPos - aStartPos);
+ const basegfx::B2DPoint aBottomLeft(aRange.getMinX(), aRange.getMaximum().getY());
+ const basegfx::B2DPoint aTopLeft(aRange.getMinX(), aRange.getMinY());
+ const basegfx::B2DVector aOldVec(aBottomLeft - aTopLeft);
+ const double fFullLen(aFullVec.getLength());
+ const double fOldLen(aOldVec.getLength());
+ const double fNewBorder((fFullLen * 100.0) / fOldLen);
+ sal_Int32 nNewBorder(100L - FRound(fNewBorder));
+
+ // clip
+ if(nNewBorder < 0L)
+ {
+ nNewBorder = 0L;
+ }
+
+ if(nNewBorder > 100L)
+ {
+ nNewBorder = 100L;
+ }
+
+ // set
+ if(nNewBorder != rG.aGradient.GetBorder())
+ {
+ rG.aGradient.SetBorder((sal_uInt16)nNewBorder);
+ }
+ }
+
+ break;
+ }
+ case XGRAD_AXIAL :
+ {
+ if(!bMoveSingle || (bMoveSingle && !bMoveFirst))
+ {
+ basegfx::B2DVector aFullVec(aEndPos - aCenter);
+ const basegfx::B2DVector aOldVec(basegfx::B2DPoint(aCenter.getX(), aRange.getMaximum().getY()) - aCenter);
+ const double fFullLen(aFullVec.getLength());
+ const double fOldLen(aOldVec.getLength());
+ const double fNewBorder((fFullLen * 100.0) / fOldLen);
+ sal_Int32 nNewBorder = 100 - FRound(fNewBorder);
+
+ // clip
+ if(nNewBorder < 0L)
+ {
+ nNewBorder = 0L;
+ }
+
+ if(nNewBorder > 100L)
+ {
+ nNewBorder = 100L;
+ }
+
+ // set
+ if(nNewBorder != rG.aGradient.GetBorder())
+ {
+ rG.aGradient.SetBorder((sal_uInt16)nNewBorder);
+ }
+
+ aFullVec.normalize();
+ double fNewFullAngle(atan2(aFullVec.getY(), aFullVec.getX()));
+ fNewFullAngle /= F_PI180;
+ fNewFullAngle *= -10.0;
+ fNewFullAngle += 900.0;
+
+ // clip
+ while(fNewFullAngle < 0.0)
+ {
+ fNewFullAngle += 3600.0;
+ }
+
+ while(fNewFullAngle >= 3600.0)
+ {
+ fNewFullAngle -= 3600.0;
+ }
+
+ // to int and set
+ const sal_Int32 nNewAngle(FRound(fNewFullAngle));
+
+ if(nNewAngle != rGOld.aGradient.GetAngle())
+ {
+ rG.aGradient.SetAngle(nNewAngle);
+ }
+ }
+
+ break;
+ }
+ case XGRAD_RADIAL :
+ case XGRAD_SQUARE :
+ {
+ if(!bMoveSingle || (bMoveSingle && !bMoveFirst))
+ {
+ const basegfx::B2DPoint aTopLeft(aRange.getMinX(), aRange.getMinY());
+ const basegfx::B2DPoint aOffset(aEndPos - aTopLeft);
+ sal_Int32 nNewXOffset(FRound((aOffset.getX() * 100.0) / aRange.getWidth()));
+ sal_Int32 nNewYOffset(FRound((aOffset.getY() * 100.0) / aRange.getHeight()));
+
+ // clip
+ if(nNewXOffset < 0L)
+ {
+ nNewXOffset = 0L;
+ }
+
+ if(nNewXOffset > 100L)
+ {
+ nNewXOffset = 100L;
+ }
+
+ if(nNewYOffset < 0L)
+ {
+ nNewYOffset = 0L;
+ }
+
+ if(nNewYOffset > 100L)
+ {
+ nNewYOffset = 100L;
+ }
+
+ rG.aGradient.SetXOffset((sal_uInt16)nNewXOffset);
+ rG.aGradient.SetYOffset((sal_uInt16)nNewYOffset);
+
+ aStartPos -= aOffset;
+ aEndPos -= aOffset;
+ }
+
+ if(!bMoveSingle || (bMoveSingle && bMoveFirst))
+ {
+ basegfx::B2DVector aFullVec(aStartPos - aEndPos);
+ const basegfx::B2DPoint aBottomLeft(aRange.getMinX(), aRange.getMaximum().getY());
+ const basegfx::B2DPoint aTopLeft(aRange.getMinX(), aRange.getMinY());
+ const basegfx::B2DVector aOldVec(aBottomLeft - aTopLeft);
+ const double fFullLen(aFullVec.getLength());
+ const double fOldLen(aOldVec.getLength());
+ const double fNewBorder((fFullLen * 100.0) / fOldLen);
+ sal_Int32 nNewBorder(100L - FRound(fNewBorder));
+
+ // clip
+ if(nNewBorder < 0L)
+ {
+ nNewBorder = 0L;
+ }
+
+ if(nNewBorder > 100L)
+ {
+ nNewBorder = 100L;
+ }
+
+ // set
+ if(nNewBorder != rG.aGradient.GetBorder())
+ {
+ rG.aGradient.SetBorder((sal_uInt16)nNewBorder);
+ }
+
+ // angle is not definitely necessary for these modes, but it makes
+ // controlling more fun for the user
+ aFullVec.normalize();
+ double fNewFullAngle(atan2(aFullVec.getY(), aFullVec.getX()));
+ fNewFullAngle /= F_PI180;
+ fNewFullAngle *= -10.0;
+ fNewFullAngle += 900.0;
+
+ // clip
+ while(fNewFullAngle < 0.0)
+ {
+ fNewFullAngle += 3600.0;
+ }
+
+ while(fNewFullAngle >= 3600.0)
+ {
+ fNewFullAngle -= 3600.0;
+ }
+
+ // to int and set
+ const sal_Int32 nNewAngle(FRound(fNewFullAngle));
+
+ if(nNewAngle != rGOld.aGradient.GetAngle())
+ {
+ rG.aGradient.SetAngle(nNewAngle);
+ }
+ }
+
+ break;
+ }
+ case XGRAD_ELLIPTICAL :
+ case XGRAD_RECT :
+ {
+ if(!bMoveSingle || (bMoveSingle && !bMoveFirst))
+ {
+ const basegfx::B2DPoint aTopLeft(aRange.getMinX(), aRange.getMinY());
+ const basegfx::B2DPoint aOffset(aEndPos - aTopLeft);
+ sal_Int32 nNewXOffset(FRound((aOffset.getX() * 100.0) / aRange.getWidth()));
+ sal_Int32 nNewYOffset(FRound((aOffset.getY() * 100.0) / aRange.getHeight()));
+
+ // clip
+ if(nNewXOffset < 0L)
+ {
+ nNewXOffset = 0L;
+ }
+
+ if(nNewXOffset > 100L)
+ {
+ nNewXOffset = 100L;
+ }
+
+ if(nNewYOffset < 0L)
+ {
+ nNewYOffset = 0L;
+ }
+
+ if(nNewYOffset > 100L)
+ {
+ nNewYOffset = 100L;
+ }
+
+ rG.aGradient.SetXOffset((sal_uInt16)nNewXOffset);
+ rG.aGradient.SetYOffset((sal_uInt16)nNewYOffset);
+
+ aStartPos -= aOffset;
+ aEndPos -= aOffset;
+ }
+
+ if(!bMoveSingle || (bMoveSingle && bMoveFirst))
+ {
+ basegfx::B2DVector aFullVec(aStartPos - aEndPos);
+ const basegfx::B2DPoint aTopLeft(aRange.getMinX(), aRange.getMinY());
+ const basegfx::B2DPoint aCenterLeft(aRange.getMinX(), aRange.getHeight());
+ const basegfx::B2DVector aOldVec(aCenterLeft - aTopLeft);
+ const double fFullLen(aFullVec.getLength());
+ const double fOldLen(aOldVec.getLength());
+ const double fNewBorder((fFullLen * 100.0) / fOldLen);
+ sal_Int32 nNewBorder(100L - FRound(fNewBorder));
+
+ // clip
+ if(nNewBorder < 0L)
+ {
+ nNewBorder = 0L;
+ }
+
+ if(nNewBorder > 100L)
+ {
+ nNewBorder = 100L;
+ }
+
+ // set
+ if(nNewBorder != rG.aGradient.GetBorder())
+ {
+ rG.aGradient.SetBorder((sal_uInt16)nNewBorder);
+ }
+
+ // angle is not definitely necessary for these modes, but it makes
+ // controlling more fun for the user
+ aFullVec.normalize();
+ double fNewFullAngle(atan2(aFullVec.getY(), aFullVec.getX()));
+ fNewFullAngle /= F_PI180;
+ fNewFullAngle *= -10.0;
+ fNewFullAngle += 900.0;
+
+ // clip
+ while(fNewFullAngle < 0.0)
+ {
+ fNewFullAngle += 3600.0;
+ }
+
+ while(fNewFullAngle >= 3600.0)
+ {
+ fNewFullAngle -= 3600.0;
+ }
+
+ // to int and set
+ const sal_Int32 nNewAngle(FRound(fNewFullAngle));
+
+ if(nNewAngle != rGOld.aGradient.GetAngle())
+ {
+ rG.aGradient.SetAngle(nNewAngle);
+ }
+ }
+
+ break;
+ }
+ }
+}
+
+// eof
diff --git a/svx/source/svdraw/gradtrns.hxx b/svx/source/svdraw/gradtrns.hxx
new file mode 100644
index 000000000000..bf5352632f40
--- /dev/null
+++ b/svx/source/svdraw/gradtrns.hxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _GRADTRANS_HXX
+#define _GRADTRANS_HXX
+
+#include <svx/xgrad.hxx>
+#include <tools/gen.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+
+class SdrObject;
+
+class GradTransVector
+{
+public:
+ basegfx::B2DPoint maPositionA;
+ basegfx::B2DPoint maPositionB;
+ Color aCol1;
+ Color aCol2;
+};
+
+class GradTransGradient
+{
+public:
+ XGradient aGradient;
+};
+
+class GradTransformer
+{
+public:
+ GradTransformer() {}
+
+ void GradToVec(GradTransGradient& rG, GradTransVector& rV,
+ const SdrObject* pObj);
+ void VecToGrad(GradTransVector& rV, GradTransGradient& rG,
+ GradTransGradient& rGOld, const SdrObject* pObj, sal_Bool bMoveSingle, sal_Bool bMoveFirst);
+};
+
+#endif // _GRADTRANS_HXX
+
diff --git a/svx/source/svdraw/impgrfll.cxx b/svx/source/svdraw/impgrfll.cxx
new file mode 100644
index 000000000000..a649977b744c
--- /dev/null
+++ b/svx/source/svdraw/impgrfll.cxx
@@ -0,0 +1,255 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/rectenum.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/bitmap.hxx>
+
+///////////////////////////////////////////////////////////////////////////////
+
+void ImpCalcBmpFillSizes( Size& rStartOffset,
+ Size& rBmpOutputSize,
+ const Rectangle& rOutputRect,
+ const MapMode& rOutputMapMode,
+ const Bitmap& rFillBitmap,
+ const Size& rBmpSize,
+ const Size& rBmpPerCent,
+ const Size& rBmpOffPerCent,
+ sal_Bool bBmpLogSize,
+ sal_Bool bBmpTile,
+ sal_Bool bBmpStretch,
+ RECT_POINT eBmpRectPoint )
+{
+ sal_Bool bOriginalSize = sal_False, bScaleSize = sal_False;
+
+ // Falls keine Groessen gegeben sind ( z.B. alte Dokumente )
+ // berechnen wir uns die Groesse selber aus der Bitmap
+ // ==> altes Verhalten;
+ // wenn nur eine Groesse gegeben ist, wird die andere
+ // Groesse angepasst berechnet
+ if( bBmpLogSize )
+ {
+ if( !rBmpSize.Width() && !rBmpSize.Height() )
+ bOriginalSize = sal_True;
+ else if( !rBmpSize.Width() || !rBmpSize.Height() )
+ bScaleSize = sal_True;
+ }
+ else
+ {
+ if( !rBmpPerCent.Width() && !rBmpPerCent.Height() )
+ bOriginalSize = sal_True;
+ else if( !rBmpPerCent.Width() || !rBmpPerCent.Height() )
+ bScaleSize = sal_True;
+ }
+
+ // entweder Originalgroesse oder angepasste Groesse
+ if( bOriginalSize || bScaleSize )
+ {
+ MapMode aBmpPrefMapMode( rFillBitmap.GetPrefMapMode() );
+ Size aBmpPrefSize( rFillBitmap.GetPrefSize() );
+
+ // Falls keine gesetzt ist, nehmen wir Pixel
+ if( !aBmpPrefSize.Width() || !aBmpPrefSize.Height() )
+ {
+ aBmpPrefSize = rFillBitmap.GetSizePixel();
+ aBmpPrefMapMode = MAP_PIXEL;
+ }
+
+ if( bOriginalSize )
+ {
+ if( MAP_PIXEL == aBmpPrefMapMode.GetMapUnit() )
+ rBmpOutputSize = Application::GetDefaultDevice()->PixelToLogic( aBmpPrefSize, rOutputMapMode );
+ else
+ rBmpOutputSize = OutputDevice::LogicToLogic( aBmpPrefSize, aBmpPrefMapMode, rOutputMapMode );
+ }
+ else
+ {
+ if( bBmpLogSize )
+ {
+ rBmpOutputSize = rBmpSize;
+
+ if( !rBmpSize.Width() )
+ rBmpOutputSize.Width() = basegfx::fround( (double) rBmpSize.Height() * aBmpPrefSize.Width() / aBmpPrefSize.Height() );
+ else
+ rBmpOutputSize.Height() = basegfx::fround( (double) rBmpSize.Width() * aBmpPrefSize.Height() / aBmpPrefSize.Width() );
+ }
+ else
+ {
+ if( !rBmpPerCent.Width() )
+ {
+ rBmpOutputSize.Height() = basegfx::fround( (double) rOutputRect.GetHeight() * rBmpPerCent.Height() / 100. );
+ rBmpOutputSize.Width() = basegfx::fround( (double) rBmpOutputSize.Height() * aBmpPrefSize.Width() / aBmpPrefSize.Height() );
+ }
+ else
+ {
+ rBmpOutputSize.Width() = basegfx::fround( (double) rOutputRect.GetWidth() * rBmpPerCent.Width() / 100. );
+ rBmpOutputSize.Height() = basegfx::fround( (double) rBmpOutputSize.Width() * aBmpPrefSize.Height() / aBmpPrefSize.Width() );
+ }
+ }
+ }
+ }
+ // ansonsten koennen wir die Groesse leicht selber berechnen
+ else
+ {
+ if( bBmpLogSize )
+ rBmpOutputSize = rBmpSize;
+ else
+ {
+ rBmpOutputSize.Width() = basegfx::fround( (double) rOutputRect.GetWidth() * rBmpPerCent.Width() / 100. );
+ rBmpOutputSize.Height() = basegfx::fround( (double) rOutputRect.GetHeight() * rBmpPerCent.Height() / 100. );
+ }
+ }
+
+ // nur bei Kachelung die anderen Positionen berechnen
+ if( bBmpTile )
+ {
+ Point aStartPoint;
+
+ // Grundposition der ersten Kachel berechen;
+ // Diese Position wird spaeter zur Berechnung der absoluten
+ // Startposition links oberhalb des Objektes benutzt
+ switch( eBmpRectPoint )
+ {
+ case( RP_MT ):
+ {
+ aStartPoint.X() = rOutputRect.Left() + ( ( rOutputRect.GetWidth() - rBmpOutputSize.Width() ) >> 1 );
+ aStartPoint.Y() = rOutputRect.Top();
+ }
+ break;
+
+ case( RP_RT ):
+ {
+ aStartPoint.X() = rOutputRect.Right() - rBmpOutputSize.Width();
+ aStartPoint.Y() = rOutputRect.Top();
+ }
+ break;
+
+ case( RP_LM ):
+ {
+ aStartPoint.X() = rOutputRect.Left();
+ aStartPoint.Y() = rOutputRect.Top() + ( ( rOutputRect.GetHeight() - rBmpOutputSize.Height() ) >> 1 );
+ }
+ break;
+
+ case( RP_MM ):
+ {
+ aStartPoint.X() = rOutputRect.Left() + ( ( rOutputRect.GetWidth() - rBmpOutputSize.Width() ) >> 1 );
+ aStartPoint.Y() = rOutputRect.Top() + ( ( rOutputRect.GetHeight() - rBmpOutputSize.Height() ) >> 1 );
+ }
+ break;
+
+ case( RP_RM ):
+ {
+ aStartPoint.X() = rOutputRect.Right() - rBmpOutputSize.Width();
+ aStartPoint.Y() = rOutputRect.Top() + ( ( rOutputRect.GetHeight() - rBmpOutputSize.Height() ) >> 1 );
+ }
+ break;
+
+ case( RP_LB ):
+ {
+ aStartPoint.X() = rOutputRect.Left();
+ aStartPoint.Y() = rOutputRect.Bottom() - rBmpOutputSize.Height();
+ }
+ break;
+
+ case( RP_MB ):
+ {
+ aStartPoint.X() = rOutputRect.Left() + ( ( rOutputRect.GetWidth() - rBmpOutputSize.Width() ) >> 1 );
+ aStartPoint.Y() = rOutputRect.Bottom() - rBmpOutputSize.Height();
+ }
+ break;
+
+ case( RP_RB ):
+ {
+ aStartPoint.X() = rOutputRect.Right() - rBmpOutputSize.Width();
+ aStartPoint.Y() = rOutputRect.Bottom() - rBmpOutputSize.Height();
+ }
+ break;
+
+ // default linke obere Ecke
+ default:
+ aStartPoint = rOutputRect.TopLeft();
+ break;
+ }
+
+ // X- oder Y-Positionsoffset beruecksichtigen
+ if( rBmpOffPerCent.Width() )
+ aStartPoint.X() += ( rBmpOutputSize.Width() * rBmpOffPerCent.Width() / 100 );
+
+ if( rBmpOffPerCent.Height() )
+ aStartPoint.Y() += ( rBmpOutputSize.Height() * rBmpOffPerCent.Height() / 100 );
+
+ // echten Startpunkt berechnen ( links oben )
+ if( rBmpOutputSize.Width() && rBmpOutputSize.Height() )
+ {
+ const long nDiffX = aStartPoint.X() - rOutputRect.Left();
+ const long nDiffY = aStartPoint.Y() - rOutputRect.Top();
+
+ if ( nDiffX )
+ {
+ long nCount = nDiffX / rBmpOutputSize.Width() + 1;
+
+ if ( rBmpOffPerCent.Height() && ( nCount & 1L ) )
+ nCount++;
+
+ aStartPoint.X() -= ( nCount * rBmpOutputSize.Width() );
+ }
+
+ if ( nDiffY )
+ {
+ long nCount = nDiffY / rBmpOutputSize.Height() + 1;
+
+ if ( rBmpOffPerCent.Width() && ( nCount & 1L ) )
+ nCount++;
+
+ aStartPoint.Y() -= ( nCount * rBmpOutputSize.Height() );
+ }
+ }
+
+ rStartOffset = Size( aStartPoint.X() - rOutputRect.Left(),
+ aStartPoint.Y() - rOutputRect.Top() );
+ }
+ else
+ {
+ if( bBmpStretch )
+ {
+ rStartOffset = Size(0, 0);
+ rBmpOutputSize = rOutputRect.GetSize();
+ }
+ else
+ {
+ rStartOffset = Size( ( rOutputRect.GetWidth() - rBmpOutputSize.Width() ) >> 1,
+ ( rOutputRect.GetHeight() - rBmpOutputSize.Height() ) >> 1 );
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/svdraw/polypolygoneditor.cxx b/svx/source/svdraw/polypolygoneditor.cxx
new file mode 100644
index 000000000000..804f39957938
--- /dev/null
+++ b/svx/source/svdraw/polypolygoneditor.cxx
@@ -0,0 +1,190 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+
+#include "svx/polypolygoneditor.hxx"
+
+namespace sdr {
+
+PolyPolygonEditor::PolyPolygonEditor( const basegfx::B2DPolyPolygon& rPolyPolygon, bool bClosed )
+: maPolyPolygon( rPolyPolygon )
+, mbIsClosed( bClosed )
+{
+}
+
+bool PolyPolygonEditor::DeletePoints( const std::set< sal_uInt16 >& rAbsPoints )
+{
+ bool bPolyPolyChanged = false;
+
+ std::set< sal_uInt16 >::const_reverse_iterator aIter;( rAbsPoints.rbegin() );
+ for( aIter = rAbsPoints.rbegin(); aIter != rAbsPoints.rend(); aIter++ )
+ {
+ sal_uInt32 nPoly, nPnt;
+ if( GetRelativePolyPoint(maPolyPolygon,(*aIter), nPoly, nPnt) )
+ {
+ // remove point
+ basegfx::B2DPolygon aCandidate(maPolyPolygon.getB2DPolygon(nPoly));
+
+ aCandidate.remove(nPnt);
+
+ if( ( mbIsClosed && aCandidate.count() < 3L) || (aCandidate.count() < 2L) )
+ {
+ maPolyPolygon.remove(nPoly);
+ }
+ else
+ {
+ maPolyPolygon.setB2DPolygon(nPoly, aCandidate);
+ }
+
+ bPolyPolyChanged = true;
+ }
+ }
+
+ return bPolyPolyChanged;
+}
+
+bool PolyPolygonEditor::SetSegmentsKind(SdrPathSegmentKind eKind, const std::set< sal_uInt16 >& rAbsPoints )
+{
+ bool bPolyPolyChanged = false;
+
+ std::set< sal_uInt16 >::const_reverse_iterator aIter;( rAbsPoints.rbegin() );
+ for( aIter = rAbsPoints.rbegin(); aIter != rAbsPoints.rend(); aIter++ )
+ {
+ sal_uInt32 nPolyNum, nPntNum;
+
+ if(PolyPolygonEditor::GetRelativePolyPoint(maPolyPolygon, (*aIter), nPolyNum, nPntNum))
+ {
+ // do change at aNewPolyPolygon. Take a look at edge.
+ basegfx::B2DPolygon aCandidate(maPolyPolygon.getB2DPolygon(nPolyNum));
+ bool bCandidateChanged(false);
+ const sal_uInt32 nCount(aCandidate.count());
+
+ if(nCount && (nPntNum + 1 < nCount || aCandidate.isClosed()))
+ {
+ // it's a valid edge, check control point usage
+ const sal_uInt32 nNextIndex((nPntNum + 1) % nCount);
+ const bool bContolUsed(aCandidate.areControlPointsUsed()
+ && (aCandidate.isNextControlPointUsed(nPntNum) || aCandidate.isPrevControlPointUsed(nNextIndex)));
+
+ if(bContolUsed)
+ {
+ if(SDRPATHSEGMENT_TOGGLE == eKind || SDRPATHSEGMENT_LINE == eKind)
+ {
+ // remove control
+ aCandidate.resetNextControlPoint(nPntNum);
+ aCandidate.resetPrevControlPoint(nNextIndex);
+ bCandidateChanged = true;
+ }
+ }
+ else
+ {
+ if(SDRPATHSEGMENT_TOGGLE == eKind || SDRPATHSEGMENT_CURVE == eKind)
+ {
+ // add control
+ const basegfx::B2DPoint aStart(aCandidate.getB2DPoint(nPntNum));
+ const basegfx::B2DPoint aEnd(aCandidate.getB2DPoint(nNextIndex));
+
+ aCandidate.setNextControlPoint(nPntNum, interpolate(aStart, aEnd, (1.0 / 3.0)));
+ aCandidate.setPrevControlPoint(nNextIndex, interpolate(aStart, aEnd, (2.0 / 3.0)));
+ bCandidateChanged = true;
+ }
+ }
+
+ if(bCandidateChanged)
+ {
+ maPolyPolygon.setB2DPolygon(nPolyNum, aCandidate);
+ bPolyPolyChanged = true;
+ }
+ }
+ }
+ }
+
+ return bPolyPolyChanged;
+}
+
+bool PolyPolygonEditor::SetPointsSmooth( basegfx::B2VectorContinuity eFlags, const std::set< sal_uInt16 >& rAbsPoints)
+{
+ bool bPolyPolygonChanged(false);
+
+ std::set< sal_uInt16 >::const_reverse_iterator aIter;( rAbsPoints.rbegin() );
+ for( aIter = rAbsPoints.rbegin(); aIter != rAbsPoints.rend(); aIter++ )
+ {
+ sal_uInt32 nPolyNum, nPntNum;
+
+ if(PolyPolygonEditor::GetRelativePolyPoint(maPolyPolygon, (*aIter), nPolyNum, nPntNum))
+ {
+ // do change at aNewPolyPolygon...
+ basegfx::B2DPolygon aCandidate(maPolyPolygon.getB2DPolygon(nPolyNum));
+
+ // set continuity in point, make sure there is a curve
+ bool bPolygonChanged(false);
+ bPolygonChanged = basegfx::tools::expandToCurveInPoint(aCandidate, nPntNum);
+ bPolygonChanged |= basegfx::tools::setContinuityInPoint(aCandidate, nPntNum, eFlags);
+
+ if(bPolygonChanged)
+ {
+ maPolyPolygon.setB2DPolygon(nPolyNum, aCandidate);
+ bPolyPolygonChanged = true;
+ }
+ }
+ }
+
+ return bPolyPolygonChanged;
+}
+
+bool PolyPolygonEditor::GetRelativePolyPoint( const basegfx::B2DPolyPolygon& rPoly, sal_uInt32 nAbsPnt, sal_uInt32& rPolyNum, sal_uInt32& rPointNum )
+{
+ const sal_uInt32 nPolyCount(rPoly.count());
+ sal_uInt32 nPolyNum(0L);
+
+ while(nPolyNum < nPolyCount)
+ {
+ const sal_uInt32 nPointCount(rPoly.getB2DPolygon(nPolyNum).count());
+
+ if(nAbsPnt < nPointCount)
+ {
+ rPolyNum = nPolyNum;
+ rPointNum = nAbsPnt;
+
+ return true;
+ }
+ else
+ {
+ nPolyNum++;
+ nAbsPnt -= nPointCount;
+ }
+ }
+
+ return false;
+}
+
+} // end of namespace sdr
diff --git a/svx/source/svdraw/sdrcomment.cxx b/svx/source/svdraw/sdrcomment.cxx
new file mode 100644
index 000000000000..9f68b3e806ff
--- /dev/null
+++ b/svx/source/svdraw/sdrcomment.cxx
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdrcomment.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ Comment::Comment(
+ sal_uInt32 nID,
+ Date aCreationDate,
+ const ::rtl::OUString& rUserName,
+ const ::rtl::OUString& rText,
+ const basegfx::B2DPoint& rPosition)
+ : mnID(nID),
+ maCreationDate(aCreationDate),
+ maUserName(rUserName),
+ maText(rText),
+ maPosition(rPosition)
+ {
+ }
+
+ Comment::~Comment()
+ {
+ }
+
+ sal_Bool Comment::operator==(const Comment& rCandidate) const
+ {
+ return (
+ mnID == rCandidate.mnID
+ && maCreationDate == rCandidate.maCreationDate
+ && maUserName == rCandidate.maUserName
+ && maText == rCandidate.maText
+ && maPosition == rCandidate.maPosition);
+ }
+
+ void Comment::SetCreationDate(Date aNewDate)
+ {
+ if(aNewDate != maCreationDate)
+ {
+ maCreationDate = aNewDate;
+ }
+ }
+
+ void Comment::SetUserName(const ::rtl::OUString& rNewName)
+ {
+ if(rNewName != maUserName)
+ {
+ maUserName = rNewName;
+ }
+ }
+
+ void Comment::SetText(const ::rtl::OUString& rNewText)
+ {
+ if(rNewText != maText)
+ {
+ maText = rNewText;
+ }
+ }
+
+ void Comment::SetPosition(const basegfx::B2DPoint& rNewPos)
+ {
+ if(rNewPos != maPosition)
+ {
+ maPosition = rNewPos;
+ }
+ }
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/svdraw/sdrhittesthelper.cxx b/svx/source/svdraw/sdrhittesthelper.cxx
new file mode 100644
index 000000000000..58eef58a9fd6
--- /dev/null
+++ b/svx/source/svdraw/sdrhittesthelper.cxx
@@ -0,0 +1,173 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_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( rObject.IsVisible() && (!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/sdrmasterpagedescriptor.cxx b/svx/source/svdraw/sdrmasterpagedescriptor.cxx
new file mode 100644
index 000000000000..eb757a8ee41c
--- /dev/null
+++ b/svx/source/svdraw/sdrmasterpagedescriptor.cxx
@@ -0,0 +1,142 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdrmasterpagedescriptor.hxx>
+#include <svx/sdr/contact/viewcontactofmasterpagedescriptor.hxx>
+#include <svx/svdpage.hxx>
+
+// #i42075#
+#include <svx/svdobj.hxx>
+#include <svx/xfillit0.hxx>
+#include <svl/itemset.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ // ViewContact part
+ sdr::contact::ViewContact* MasterPageDescriptor::CreateObjectSpecificViewContact()
+ {
+ return new sdr::contact::ViewContactOfMasterPageDescriptor(*this);
+ }
+
+ MasterPageDescriptor::MasterPageDescriptor(SdrPage& aOwnerPage, SdrPage& aUsedPage)
+ : maOwnerPage(aOwnerPage),
+ maUsedPage(aUsedPage),
+ mpViewContact(0L)
+ {
+ // all layers visible
+ maVisibleLayers.SetAll();
+
+ // register at used page
+ maUsedPage.AddPageUser(*this);
+ }
+
+ MasterPageDescriptor::~MasterPageDescriptor()
+ {
+ // de-register at used page
+ maUsedPage.RemovePageUser(*this);
+
+ if(mpViewContact)
+ {
+ delete mpViewContact;
+ mpViewContact = 0L;
+ }
+ }
+
+ // ViewContact part
+ sdr::contact::ViewContact& MasterPageDescriptor::GetViewContact() const
+ {
+ if(!mpViewContact)
+ {
+ const_cast< MasterPageDescriptor* >(this)->mpViewContact =
+ const_cast< MasterPageDescriptor* >(this)->CreateObjectSpecificViewContact();
+ }
+
+ return *mpViewContact;
+ }
+
+ // this method is called form the destructor of the referenced page.
+ // do all necessary action to forget the page. It is not necessary to call
+ // RemovePageUser(), that is done form the destructor.
+ void MasterPageDescriptor::PageInDestruction(const SdrPage& /*rPage*/)
+ {
+ maOwnerPage.TRG_ClearMasterPage();
+ }
+
+ void MasterPageDescriptor::SetVisibleLayers(const SetOfByte& rNew)
+ {
+ if(rNew != maVisibleLayers)
+ {
+ maVisibleLayers = rNew;
+ GetViewContact().ActionChanged();
+ }
+ }
+
+ // operators
+ sal_Bool MasterPageDescriptor::operator==(const MasterPageDescriptor& rCandidate) const
+ {
+ return (&maOwnerPage == &rCandidate.maOwnerPage
+ && &maUsedPage == &rCandidate.maUsedPage
+ && maVisibleLayers == rCandidate.maVisibleLayers);
+ }
+
+ sal_Bool MasterPageDescriptor::operator!=(const MasterPageDescriptor& rCandidate) const
+ {
+ return (&maOwnerPage != &rCandidate.maOwnerPage
+ || &maUsedPage != &rCandidate.maUsedPage
+ || maVisibleLayers != rCandidate.maVisibleLayers);
+ }
+
+ const SdrPageProperties* MasterPageDescriptor::getCorrectSdrPageProperties() const
+ {
+ const SdrPage* pCorrectPage = &GetOwnerPage();
+ const SdrPageProperties* pCorrectProperties = &pCorrectPage->getSdrPageProperties();
+
+ if(XFILL_NONE == ((const XFillStyleItem&)pCorrectProperties->GetItemSet().Get(XATTR_FILLSTYLE)).GetValue())
+ {
+ pCorrectPage = &GetUsedPage();
+ pCorrectProperties = &pCorrectPage->getSdrPageProperties();
+ }
+
+ if(pCorrectPage->IsMasterPage() && !pCorrectProperties->GetStyleSheet())
+ {
+ // #i110846# Suppress SdrPage FillStyle for MasterPages without StyleSheets,
+ // else the PoolDefault (XFILL_COLOR and Blue8) will be used. Normally, all
+ // MasterPages should have a StyleSheet excactly for this reason, but historically
+ // e.g. the Notes MasterPage has no StyleSheet set (and there maybe others).
+ pCorrectProperties = 0;
+ }
+
+ return pCorrectProperties;
+ }
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/svdraw/sdrpagewindow.cxx b/svx/source/svdraw/sdrpagewindow.cxx
new file mode 100644
index 000000000000..79c09eea0179
--- /dev/null
+++ b/svx/source/svdraw/sdrpagewindow.cxx
@@ -0,0 +1,468 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdrpagewindow.hxx>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/util/XModeChangeBroadcaster.hpp>
+#include <comphelper/processfactory.hxx>
+#include <vcl/svapp.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <svx/svdouno.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/sdrpaintwindow.hxx>
+#include <svx/sdr/contact/objectcontactofpageview.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <vos/mutex.hxx>
+#include <svx/fmview.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > SdrPageWindow::GetControlContainer( bool _bCreateIfNecessary ) const
+{
+ if ( !mxControlContainer.is() && _bCreateIfNecessary )
+ {
+ SdrView& rView = GetPageView().GetView();
+
+ const SdrPaintWindow& rPaintWindow( GetOriginalPaintWindow() ? *GetOriginalPaintWindow() : GetPaintWindow() );
+ if ( rPaintWindow.OutputToWindow() && !rView.IsPrintPreview() )
+ {
+ Window& rWindow = dynamic_cast< Window& >( rPaintWindow.GetOutputDevice() );
+ const_cast< SdrPageWindow* >( this )->mxControlContainer = VCLUnoHelper::CreateControlContainer( &rWindow );
+
+ // #100394# xC->setVisible triggers window->Show() and this has
+ // problems when the view is not completely constructed which may
+ // happen when loading. This leads to accessibility broadcasts which
+ // throw asserts due to the not finished view. All this chan be avoided
+ // since xC->setVisible is here called only for the side effect in
+ // UnoControlContainer::setVisible(...) which calls createPeer(...).
+ // This will now be called directly from here.
+
+ // UnoContainerModel erzeugen
+ // uno::Reference< awt::XWindow > xC(mxControlContainer, uno::UNO_QUERY);
+ // CreateControlContainer() is only used from
+ // , thus it seems not necessary to make
+ // it visible her at all.
+ // #58917# Das Show darf nicht am VCL-Fenster landen, weil dann Assertion vom SFX
+ // sal_Bool bVis = pWindow->IsVisible();
+ // xC->setVisible(sal_True);
+ // if ( !bVis )
+ // pWindow->Hide();
+ // if( !mxContext.is() && bVisible )
+ // // Es ist ein TopWindow, also automatisch anzeigen
+ // createPeer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > (), ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > () );
+
+ uno::Reference< awt::XControl > xControl(mxControlContainer, uno::UNO_QUERY);
+ if(xControl.is())
+ {
+ uno::Reference< uno::XInterface > xContext = xControl->getContext();
+ if(!xContext.is())
+ {
+ xControl->createPeer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > (),
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > () );
+ }
+ }
+ }
+ else
+ {
+ // Printer und VirtualDevice, bzw. kein OutDev
+ uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ if( xFactory.is() )
+ {
+ const_cast< SdrPageWindow* >( this )->mxControlContainer = uno::Reference< awt::XControlContainer >(xFactory->createInstance(rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlContainer")), uno::UNO_QUERY);
+ uno::Reference< awt::XControlModel > xModel(xFactory->createInstance(rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlContainerModel")), uno::UNO_QUERY);
+ uno::Reference< awt::XControl > xControl(mxControlContainer, uno::UNO_QUERY);
+ if (xControl.is())
+ xControl->setModel(xModel);
+
+ OutputDevice& rOutDev = rPaintWindow.GetOutputDevice();
+ Point aPosPix = rOutDev.GetMapMode().GetOrigin();
+ Size aSizePix = rOutDev.GetOutputSizePixel();
+
+ uno::Reference< awt::XWindow > xContComp(mxControlContainer, uno::UNO_QUERY);
+ if( xContComp.is() )
+ xContComp->setPosSize(aPosPix.X(), aPosPix.Y(), aSizePix.Width(), aSizePix.Height(), awt::PosSize::POSSIZE);
+ }
+ }
+
+ FmFormView* pViewAsFormView = dynamic_cast< FmFormView* >( &rView );
+ if ( pViewAsFormView )
+ pViewAsFormView->InsertControlContainer(mxControlContainer);
+ }
+ return mxControlContainer;
+}
+
+SdrPageWindow::SdrPageWindow(SdrPageView& rPageView, SdrPaintWindow& rPaintWindow)
+: mpObjectContact(0L),
+ mrPageView(rPageView),
+ mpPaintWindow(&rPaintWindow),
+ mpOriginalPaintWindow(NULL)
+{
+}
+
+SdrPageWindow::~SdrPageWindow()
+{
+ // #110094#, #i26631#
+ ResetObjectContact();
+
+ if (mxControlContainer.is())
+ {
+ SdrView& rView = GetPageView().GetView();
+
+ // notify derived views
+ FmFormView* pViewAsFormView = dynamic_cast< FmFormView* >( &rView );
+ if ( pViewAsFormView )
+ pViewAsFormView->RemoveControlContainer(mxControlContainer);
+
+ // dispose the control container
+ uno::Reference< lang::XComponent > xComponent(mxControlContainer, uno::UNO_QUERY);
+ xComponent->dispose();
+ }
+}
+
+// #110094# ObjectContact section
+sdr::contact::ObjectContact* SdrPageWindow::CreateViewSpecificObjectContact()
+{
+ return new sdr::contact::ObjectContactOfPageView(*this);
+}
+
+// OVERLAYMANAGER
+::sdr::overlay::OverlayManager* SdrPageWindow::GetOverlayManager() const
+{
+ return GetPaintWindow().GetOverlayManager();
+}
+
+void SdrPageWindow::patchPaintWindow(SdrPaintWindow& rPaintWindow)
+{
+ mpOriginalPaintWindow = mpPaintWindow;
+ mpPaintWindow = &rPaintWindow;
+}
+
+void SdrPageWindow::unpatchPaintWindow()
+{
+ DBG_ASSERT(mpOriginalPaintWindow, "SdrPageWindow::unpatchPaintWindow: paint window not patched!" );
+ if ( mpOriginalPaintWindow )
+ {
+ mpPaintWindow = mpOriginalPaintWindow;
+ mpOriginalPaintWindow = NULL;
+ }
+}
+
+void SdrPageWindow::PrePaint()
+{
+ // give OC the chance to do ProcessDisplay preparations
+ if(HasObjectContact())
+ {
+ GetObjectContact().PrepareProcessDisplay();
+ }
+}
+
+void SdrPageWindow::PostPaint()
+{
+}
+
+void SdrPageWindow::PrepareRedraw(const Region& rReg)
+{
+ // evtl. give OC the chance to do ProcessDisplay preparations
+ if(HasObjectContact())
+ {
+ GetObjectContact().PrepareProcessDisplay();
+ }
+
+ // remember eventually changed RedrawArea at PaintWindow for usage with
+ // overlay and PreRenderDevice stuff
+ GetPaintWindow().SetRedrawRegion(rReg);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// clip test
+#ifdef CLIPPER_TEST
+#include <svx/svdopath.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <vcl/salbtype.hxx> // FRound
+#include <basegfx/polygon/b2dpolygoncutandtouch.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolygonclipper.hxx>
+
+// for ::std::sort
+#include <algorithm>
+
+namespace
+{
+ void impPaintStrokePolygon(const basegfx::B2DPolygon& rCandidate, OutputDevice& rOutDev, Color aColor)
+ {
+ basegfx::B2DPolygon aCandidate(rCandidate);
+
+ if(aCandidate.areControlPointsUsed())
+ {
+ aCandidate = basegfx::tools::adaptiveSubdivideByAngle(rCandidate);
+ }
+
+ if(aCandidate.count())
+ {
+ const sal_uInt32 nLoopCount(aCandidate.isClosed() ? aCandidate.count() : aCandidate.count() - 1L);
+ rOutDev.SetFillColor();
+ rOutDev.SetLineColor(aColor);
+
+ for(sal_uInt32 a(0L); a < nLoopCount; a++)
+ {
+ const basegfx::B2DPoint aBStart(aCandidate.getB2DPoint(a));
+ const basegfx::B2DPoint aBEnd(aCandidate.getB2DPoint((a + 1) % aCandidate.count()));
+ const Point aStart(FRound(aBStart.getX()), FRound(aBStart.getY()));
+ const Point aEnd(FRound(aBEnd.getX()), FRound(aBEnd.getY()));
+ rOutDev.DrawLine(aStart, aEnd);
+ }
+ }
+ }
+
+ void impTryTest(const SdrPageView& rPageView, OutputDevice& rOutDev)
+ {
+ if(rPageView.GetPage() && rPageView.GetPage()->GetObjCount() >= 2L)
+ {
+ SdrPage* pPage = rPageView.GetPage();
+ SdrObject* pObjA = pPage->GetObj(0L);
+
+ if(pObjA && pObjA->ISA(SdrPathObj))
+ {
+ basegfx::B2DPolyPolygon aPolyA(((SdrPathObj*)pObjA)->GetPathPoly());
+ aPolyA = basegfx::tools::correctOrientations(aPolyA);
+
+ basegfx::B2DPolyPolygon aPolyB;
+
+ for(sal_uInt32 a(1L); a < rPageView.GetPage()->GetObjCount(); a++)
+ {
+ SdrObject* pObjB = pPage->GetObj(a);
+
+ if(pObjB && pObjB->ISA(SdrPathObj))
+ {
+ basegfx::B2DPolyPolygon aCandidate(((SdrPathObj*)pObjB)->GetPathPoly());
+ aCandidate = basegfx::tools::correctOrientations(aCandidate);
+ aPolyB.append(aCandidate);
+ }
+ }
+
+ if(aPolyA.count() && aPolyA.isClosed() && aPolyB.count())
+ {
+ // poly A is the clipregion, clip poly b against it. Algo depends on
+ // poly b being closed.
+ basegfx::B2DPolyPolygon aResult(basegfx::tools::clipPolyPolygonOnPolyPolygon(aPolyB, aPolyA));
+
+ for(sal_uInt32 a(0L); a < aResult.count(); a++)
+ {
+ Color aColor(rand()%255, rand()%255, rand()%255);
+ impPaintStrokePolygon(aResult.getB2DPolygon(a), rOutDev, aColor);
+ }
+
+ bool bBla = true;
+ }
+ }
+ }
+ }
+} // end of anonymous namespace
+#endif // CLIPPER_TEST
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdrPageWindow::RedrawAll(sdr::contact::ViewObjectContactRedirector* pRedirector) const
+{
+ // set Redirector
+ GetObjectContact().SetViewObjectContactRedirector(pRedirector);
+
+ // set PaintingPageView
+ const SdrView& rView = mrPageView.GetView();
+ SdrModel& rModel = *((SdrModel*)rView.GetModel());
+
+ // get to be processed layers
+ const sal_Bool bPrinter(GetPaintWindow().OutputToPrinter());
+ SetOfByte aProcessLayers = bPrinter ? mrPageView.GetPrintableLayers() : mrPageView.GetVisibleLayers();
+
+ // create PaintInfoRec, #114359# use Rectangle only temporarily
+ const Region& rRegion = GetPaintWindow().GetRedrawRegion();
+
+ // create processing data
+ sdr::contact::DisplayInfo aDisplayInfo;
+
+ // Draw all layers. do NOT draw form layer from CompleteRedraw, this is done separate
+ // as a single layer paint
+ const SdrLayerAdmin& rLayerAdmin = rModel.GetLayerAdmin();
+ const SdrLayerID nControlLayerId = rLayerAdmin.GetLayerID(rLayerAdmin.GetControlLayerName(), sal_False);
+ aProcessLayers.Clear(nControlLayerId);
+
+ // still something to paint?
+ if(!aProcessLayers.IsEmpty())
+ {
+ aDisplayInfo.SetProcessLayers(aProcessLayers);
+
+ // Set region as redraw area
+ aDisplayInfo.SetRedrawArea(rRegion);
+
+ // Draw/Impress
+ aDisplayInfo.SetPageProcessingActive(rView.IsPagePaintingAllowed()); // #i72889#
+
+ // paint page
+ GetObjectContact().ProcessDisplay(aDisplayInfo);
+ }
+
+ // reset redirector
+ GetObjectContact().SetViewObjectContactRedirector(0L);
+
+ // LineClip test
+#ifdef CLIPPER_TEST
+ if(true)
+ {
+ impTryTest(GetPageView(), GetPaintWindow().GetOutputDevice());
+ }
+#endif // CLIPPER_TEST
+}
+
+void SdrPageWindow::RedrawLayer(const SdrLayerID* pId, sdr::contact::ViewObjectContactRedirector* pRedirector) const
+{
+ // set redirector
+ GetObjectContact().SetViewObjectContactRedirector(pRedirector);
+
+ // set PaintingPageView
+ const SdrView& rView = mrPageView.GetView();
+ SdrModel& rModel = *((SdrModel*)rView.GetModel());
+
+ // get the layers to process
+ const sal_Bool bPrinter(GetPaintWindow().OutputToPrinter());
+ SetOfByte aProcessLayers = bPrinter ? mrPageView.GetPrintableLayers() : mrPageView.GetVisibleLayers();
+
+ // is the given layer visible at all?
+ if(aProcessLayers.IsSet(*pId))
+ {
+ // find out if we are painting the ControlLayer
+ const SdrLayerAdmin& rLayerAdmin = rModel.GetLayerAdmin();
+ const SdrLayerID nControlLayerId = rLayerAdmin.GetLayerID(rLayerAdmin.GetControlLayerName(), sal_False);
+ const sal_Bool bControlLayerProcessingActive(pId && nControlLayerId == *pId);
+
+ // create PaintInfoRec, use Rectangle only temporarily
+ const Region& rRegion = GetPaintWindow().GetRedrawRegion();
+
+ // create processing data
+ sdr::contact::DisplayInfo aDisplayInfo;
+
+ // is it the control layer? If Yes, set flag
+ aDisplayInfo.SetControlLayerProcessingActive(bControlLayerProcessingActive);
+
+ // Draw just the one given layer
+ aProcessLayers.ClearAll();
+ aProcessLayers.Set(*pId);
+
+ aDisplayInfo.SetProcessLayers(aProcessLayers);
+
+ // Set region as redraw area
+ aDisplayInfo.SetRedrawArea(rRegion);
+
+ // Writer or calc, coming from original RedrawOneLayer.
+ // #i72889# no page painting for layer painting
+ aDisplayInfo.SetPageProcessingActive(false);
+
+ // paint page
+ GetObjectContact().ProcessDisplay(aDisplayInfo);
+ }
+
+ // reset redirector
+ GetObjectContact().SetViewObjectContactRedirector(0L);
+}
+
+// Invalidate call, used from ObjectContact(OfPageView) in InvalidatePartOfView(...)
+void SdrPageWindow::InvalidatePageWindow(const basegfx::B2DRange& rRange)
+{
+ if(GetPageView().IsVisible() && GetPaintWindow().OutputToWindow())
+ {
+ const SvtOptionsDrawinglayer aDrawinglayerOpt;
+ Window& rWindow(static_cast< Window& >(GetPaintWindow().GetOutputDevice()));
+ basegfx::B2DRange aDiscreteRange(rRange);
+ aDiscreteRange.transform(rWindow.GetViewTransformation());
+
+ if(aDrawinglayerOpt.IsAntiAliasing())
+ {
+ // invalidate one discrete unit more under the assumption that AA
+ // needs one pixel more
+ aDiscreteRange.grow(1.0);
+ }
+
+ const Rectangle aVCLDiscreteRectangle(
+ (sal_Int32)floor(aDiscreteRange.getMinX()), (sal_Int32)floor(aDiscreteRange.getMinY()),
+ (sal_Int32)ceil(aDiscreteRange.getMaxX()), (sal_Int32)ceil(aDiscreteRange.getMaxY()));
+ const bool bWasMapModeEnabled(rWindow.IsMapModeEnabled());
+
+ rWindow.EnableMapMode(false);
+ rWindow.Invalidate(aVCLDiscreteRectangle, INVALIDATE_NOERASE);
+ rWindow.EnableMapMode(bWasMapModeEnabled);
+ }
+}
+
+// #110094# ObjectContact section
+sdr::contact::ObjectContact& SdrPageWindow::GetObjectContact() const
+{
+ if(!mpObjectContact)
+ {
+ ((SdrPageWindow*)this)->mpObjectContact = ((SdrPageWindow*)this)->CreateViewSpecificObjectContact();
+ }
+
+ return *mpObjectContact;
+}
+
+bool SdrPageWindow::HasObjectContact() const
+{
+ return ( mpObjectContact != NULL );
+}
+
+// #i26631#
+void SdrPageWindow::ResetObjectContact()
+{
+ if(mpObjectContact)
+ {
+ delete mpObjectContact;
+ mpObjectContact = 0L;
+ }
+}
+
+void SdrPageWindow::SetDesignMode( bool _bDesignMode ) const
+{
+ const ::sdr::contact::ObjectContactOfPageView* pOC = dynamic_cast< const ::sdr::contact::ObjectContactOfPageView* >( &GetObjectContact() );
+ DBG_ASSERT( pOC, "SdrPageWindow::SetDesignMode: invalid object contact!" );
+ if ( pOC )
+ pOC->SetUNOControlsDesignMode( _bDesignMode );
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/svdraw/sdrpaintwindow.cxx b/svx/source/svdraw/sdrpaintwindow.cxx
new file mode 100644
index 000000000000..656ab9f2f27a
--- /dev/null
+++ b/svx/source/svdraw/sdrpaintwindow.cxx
@@ -0,0 +1,312 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdrpaintwindow.hxx>
+#include <svx/sdr/overlay/overlaymanagerbuffered.hxx>
+#include <svx/svdpntv.hxx>
+#include <vcl/gdimtf.hxx>
+#include <vcl/svapp.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrPreRenderDevice::SdrPreRenderDevice(OutputDevice& rOriginal)
+: mrOutputDevice(rOriginal)
+{
+}
+
+SdrPreRenderDevice::~SdrPreRenderDevice()
+{
+}
+
+void SdrPreRenderDevice::PreparePreRenderDevice()
+{
+ // compare size of maPreRenderDevice with size of visible area
+ if(maPreRenderDevice.GetOutputSizePixel() != mrOutputDevice.GetOutputSizePixel())
+ {
+ maPreRenderDevice.SetOutputSizePixel(mrOutputDevice.GetOutputSizePixel());
+ }
+
+ // Also compare the MapModes for zoom/scroll changes
+ if(maPreRenderDevice.GetMapMode() != mrOutputDevice.GetMapMode())
+ {
+ maPreRenderDevice.SetMapMode(mrOutputDevice.GetMapMode());
+ }
+
+ // #i29186#
+ maPreRenderDevice.SetDrawMode(mrOutputDevice.GetDrawMode());
+ maPreRenderDevice.SetSettings(mrOutputDevice.GetSettings());
+}
+
+void SdrPreRenderDevice::OutputPreRenderDevice(const Region& rExpandedRegion)
+{
+ // region to pixels
+ Region aRegionPixel(mrOutputDevice.LogicToPixel(rExpandedRegion));
+ RegionHandle aRegionHandle(aRegionPixel.BeginEnumRects());
+ Rectangle aRegionRectanglePixel;
+
+ // MapModes off
+ sal_Bool bMapModeWasEnabledDest(mrOutputDevice.IsMapModeEnabled());
+ sal_Bool bMapModeWasEnabledSource(maPreRenderDevice.IsMapModeEnabled());
+ mrOutputDevice.EnableMapMode(sal_False);
+ maPreRenderDevice.EnableMapMode(sal_False);
+
+ while(aRegionPixel.GetEnumRects(aRegionHandle, aRegionRectanglePixel))
+ {
+ // for each rectangle, copy the area
+ const Point aTopLeft(aRegionRectanglePixel.TopLeft());
+ const Size aSize(aRegionRectanglePixel.GetSize());
+
+ mrOutputDevice.DrawOutDev(
+ aTopLeft, aSize,
+ aTopLeft, aSize,
+ maPreRenderDevice);
+
+#ifdef DBG_UTIL
+ // #i74769#
+ static bool bDoPaintForVisualControlRegion(false);
+ if(bDoPaintForVisualControlRegion)
+ {
+ Color aColor((((((rand()&0x7f)|0x80)<<8L)|((rand()&0x7f)|0x80))<<8L)|((rand()&0x7f)|0x80));
+ mrOutputDevice.SetLineColor(aColor);
+ mrOutputDevice.SetFillColor();
+ mrOutputDevice.DrawRect(aRegionRectanglePixel);
+ }
+#endif
+ }
+
+ aRegionPixel.EndEnumRects(aRegionHandle);
+
+ mrOutputDevice.EnableMapMode(bMapModeWasEnabledDest);
+ maPreRenderDevice.EnableMapMode(bMapModeWasEnabledSource);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+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)
+ {
+ mbUseBuffer = bUseBuffer;
+ pOldOverlayManager = mpOverlayManager;
+ mpOverlayManager = NULL;
+ }
+
+ // not yet one created?
+ if(!mpOverlayManager)
+ {
+ // is it a window?
+ if(OUTDEV_WINDOW == GetOutputDevice().GetOutDevType())
+ {
+ // decide which OverlayManager to use
+ if(GetPaintView().IsBufferedOverlayAllowed() && mbUseBuffer)
+ {
+ // buffered OverlayManager, buffers it's background and refreshes from there
+ // for pure overlay changes (no system redraw). The 3rd parameter specifies
+ // if that refresh itself will use a 2nd vdev to avoid flickering.
+ // 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
+ // 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 (!)");
+
+ // Request a repaint so that the buffered overlay manager fills
+ // its buffer properly. This is a workaround for missing buffer
+ // updates.
+ Window* pWindow = dynamic_cast<Window*>(&GetOutputDevice());
+ if (pWindow != NULL)
+ pWindow->Invalidate();
+
+ Color aColA(GetPaintView().getOptionsDrawinglayer().GetStripeColorA());
+ Color aColB(GetPaintView().getOptionsDrawinglayer().GetStripeColorB());
+
+ if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
+ {
+ aColA = aColB = Application::GetSettings().GetStyleSettings().GetHighlightColor();
+ aColB.Invert();
+ }
+
+ mpOverlayManager->setStripeColorA(aColA);
+ mpOverlayManager->setStripeColorB(aColB);
+ mpOverlayManager->setStripeLengthPixel(GetPaintView().getOptionsDrawinglayer().GetStripeLength());
+ }
+ }
+
+ // OverlayObjects are transfered for the evtl. newly created OverlayManager by handing over
+ // at construction time
+ if(pOldOverlayManager)
+ {
+ // The old overlay manager is not used anymore and can be (has to be) deleted.
+ delete pOldOverlayManager;
+ }
+}
+
+SdrPaintWindow::SdrPaintWindow(SdrPaintView& rNewPaintView, OutputDevice& rOut)
+: mrOutputDevice(rOut),
+ mrPaintView(rNewPaintView),
+ mpOverlayManager(0L),
+ mpPreRenderDevice(0L),
+ mbTemporaryTarget(false), // #i72889#
+ mbUseBuffer(true)
+{
+}
+
+SdrPaintWindow::~SdrPaintWindow()
+{
+ if(mpOverlayManager)
+ {
+ delete mpOverlayManager;
+ mpOverlayManager = 0L;
+ }
+
+ DestroyPreRenderDevice();
+}
+
+::sdr::overlay::OverlayManager* SdrPaintWindow::GetOverlayManager() const
+{
+ if(!mpOverlayManager)
+ {
+ // Create buffered overlay manager by default.
+ const_cast< SdrPaintWindow* >(this)->impCreateOverlayManager(true);
+ }
+
+ return mpOverlayManager;
+}
+
+Rectangle SdrPaintWindow::GetVisibleArea() const
+{
+ Size aVisSizePixel(GetOutputDevice().GetOutputSizePixel());
+ return Rectangle(GetOutputDevice().PixelToLogic(Rectangle(Point(0,0), aVisSizePixel)));
+}
+
+sal_Bool SdrPaintWindow::OutputToRecordingMetaFile() const
+{
+ GDIMetaFile* pMetaFile = mrOutputDevice.GetConnectMetaFile();
+ return (pMetaFile && pMetaFile->IsRecord() && !pMetaFile->IsPause());
+}
+
+void SdrPaintWindow::PreparePreRenderDevice()
+{
+ const sal_Bool bPrepareBufferedOutput(
+ mrPaintView.IsBufferedOutputAllowed()
+ && !OutputToPrinter()
+ && !OutputToVirtualDevice()
+ && !OutputToRecordingMetaFile());
+
+ if(bPrepareBufferedOutput)
+ {
+ if(!mpPreRenderDevice)
+ {
+ mpPreRenderDevice = new SdrPreRenderDevice(mrOutputDevice);
+ }
+ }
+ else
+ {
+ DestroyPreRenderDevice();
+ }
+
+ if(mpPreRenderDevice)
+ {
+ mpPreRenderDevice->PreparePreRenderDevice();
+ }
+}
+
+void SdrPaintWindow::DestroyPreRenderDevice()
+{
+ if(mpPreRenderDevice)
+ {
+ delete mpPreRenderDevice;
+ mpPreRenderDevice = 0L;
+ }
+}
+
+void SdrPaintWindow::OutputPreRenderDevice(const Region& rExpandedRegion)
+{
+ if(mpPreRenderDevice)
+ {
+ mpPreRenderDevice->OutputPreRenderDevice(rExpandedRegion);
+ }
+}
+
+// #i73602# add flag if buffer shall be used
+void SdrPaintWindow::DrawOverlay(const Region& rRegion, bool bUseBuffer)
+{
+ // ## force creation of OverlayManager since the first repaint needs to
+ // save the background to get a controlled start into overlay mechanism
+ impCreateOverlayManager(bUseBuffer);
+
+ if(mpOverlayManager && !OutputToPrinter())
+ {
+ if(mpPreRenderDevice && bUseBuffer)
+ {
+ mpOverlayManager->completeRedraw(rRegion, &mpPreRenderDevice->GetPreRenderDevice());
+ }
+ else
+ {
+ mpOverlayManager->completeRedraw(rRegion);
+ }
+ }
+}
+
+void SdrPaintWindow::HideOverlay(const Region& rRegion)
+{
+ if(mpOverlayManager && !OutputToPrinter())
+ {
+ if(!mpPreRenderDevice)
+ {
+ mpOverlayManager->restoreBackground(rRegion);
+ }
+ }
+}
+
+const Region& SdrPaintWindow::GetRedrawRegion() const
+{
+ return maRedrawRegion;
+}
+
+void SdrPaintWindow::SetRedrawRegion(const Region& rNew)
+{
+ maRedrawRegion = rNew;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/svdraw/selectioncontroller.cxx b/svx/source/svdraw/selectioncontroller.cxx
new file mode 100644
index 000000000000..d76f95837441
--- /dev/null
+++ b/svx/source/svdraw/selectioncontroller.cxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <tools/debug.hxx>
+#include <svx/selectioncontroller.hxx>
+
+namespace sdr
+{
+
+bool SelectionController::onKeyInput(const KeyEvent& /*rKEvt*/, Window* /*pWin*/)
+{
+ return false;
+}
+
+bool SelectionController::onMouseButtonDown(const MouseEvent& /*rMEvt*/, Window* /*pWin*/)
+{
+ return false;
+}
+
+bool SelectionController::onMouseButtonUp(const MouseEvent& /*rMEvt*/, Window* /*pWin*/)
+{
+ return false;
+}
+
+bool SelectionController::onMouseMove(const MouseEvent& /*rMEvt*/, Window* /*pWin*/)
+{
+ return false;
+}
+
+void SelectionController::onSelectionHasChanged()
+{
+}
+
+void SelectionController::GetState( SfxItemSet& /*rSet*/ )
+{
+}
+
+void SelectionController::Execute( SfxRequest& /*rReq*/ )
+{
+}
+
+bool SelectionController::DeleteMarked()
+{
+ return false;
+}
+
+bool SelectionController::GetAttributes(SfxItemSet& /*rTargetSet*/, bool /*bOnlyHardAttr*/) const
+{
+ return false;
+}
+
+bool SelectionController::SetAttributes(const SfxItemSet& /*rSet*/, bool /*bReplaceAll*/)
+{
+ return false;
+}
+
+bool SelectionController::GetStyleSheet( SfxStyleSheet* &/*rpStyleSheet*/ ) const
+{
+ return false;
+}
+
+bool SelectionController::SetStyleSheet( SfxStyleSheet* /*pStyleSheet*/, bool /*bDontRemoveHardAttr*/ )
+{
+ return false;
+}
+
+bool SelectionController::GetMarkedObjModel( SdrPage* /*pNewPage*/ )
+{
+ return false;
+}
+
+bool SelectionController::PasteObjModel( const SdrModel& /*rModel*/ )
+{
+ return false;
+}
+
+bool SelectionController::TakeFormatPaintBrush( boost::shared_ptr< SfxItemSet >& /*rFormatSet*/ )
+{
+ return false;
+}
+
+bool SelectionController::ApplyFormatPaintBrush( SfxItemSet& /*rFormatSet*/, bool /*bNoCharacterFormats*/, bool /*bNoParagraphFormats*/ )
+{
+ return false;
+}
+
+}
diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx
new file mode 100644
index 000000000000..9b73f0caaab7
--- /dev/null
+++ b/svx/source/svdraw/svdattr.cxx
@@ -0,0 +1,2429 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+
+#include <com/sun/star/drawing/TextFitToSizeType.hpp>
+#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include <com/sun/star/drawing/TextAnimationKind.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/drawing/TextAnimationDirection.hpp>
+#include <com/sun/star/drawing/ConnectorType.hpp>
+#include <com/sun/star/drawing/MeasureKind.hpp>
+#include <com/sun/star/drawing/MeasureTextHorzPos.hpp>
+#include <com/sun/star/drawing/MeasureTextVertPos.hpp>
+#include <com/sun/star/drawing/CircleKind.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <unotools/intlwrapper.hxx>
+#include <comphelper/processfactory.hxx>
+#include <vcl/svapp.hxx>
+#include <svx/svdattr.hxx>
+#include <svx/svdattrx.hxx>
+#include <svx/svdpool.hxx>
+
+#include <svl/solar.hrc>
+#include "editeng/xmlcnitm.hxx"
+
+#include <svx/svxids.hrc>
+#include <svx/xtable.hxx> // fuer RGB_Color()
+#include "svx/svditext.hxx"
+#include <svx/svdmodel.hxx> // fuer DEGREE_CHAR
+#include <svx/svdtrans.hxx>
+#include "svx/svdglob.hxx" // Stringcache
+#include "svx/svdstr.hrc"
+#include <svx/sdgcpitm.hxx>
+#include <editeng/adjitem.hxx>
+#include <svx/sdtfchim.hxx>
+#include <editeng/writingmodeitem.hxx>
+#include <tools/bigint.hxx>
+#include <tools/stream.hxx>
+
+#include <svx/xfillit0.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/svx3ditems.hxx>
+
+#define ITEMID_BOX SDRATTR_TABLE_BORDER
+#define ITEMID_BOXINFO SDRATTR_TABLE_BORDER_INNER
+#include "editeng/boxitem.hxx"
+
+#define ITEMID_SHADOW SDRATTR_TABLE_BORDER_SHADOW
+#include "editeng/shaditem.hxx"
+
+#define ITEMID_LINE 0
+#include "editeng/bolnitem.hxx"
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+SdrItemPool::SdrItemPool(
+ SfxItemPool* _pMaster,
+ sal_Bool bLoadRefCounts)
+: XOutdevItemPool(_pMaster, SDRATTR_START, SDRATTR_END, bLoadRefCounts)
+{
+ // preapare some constants
+ const Color aNullCol(RGB_Color(COL_BLACK));
+ const XubString aEmptyStr;
+ const sal_Int32 nDefEdgeDist(500L); // Erstmal hart defaulted fuer Draw (100TH_MM). hier muss noch der MapMode beruecksichtigt werden.
+
+ // init the non-persistent items
+ for(sal_uInt16 i(SDRATTR_NOTPERSIST_FIRST); i <= SDRATTR_NOTPERSIST_LAST; i++)
+ {
+ mpLocalItemInfos[i - SDRATTR_START]._nFlags=0;
+ }
+
+ // init own PoolDefaults
+ mppLocalPoolDefaults[SDRATTR_SHADOW -SDRATTR_START]=new SdrShadowItem;
+ mppLocalPoolDefaults[SDRATTR_SHADOWCOLOR -SDRATTR_START]=new SdrShadowColorItem(aEmptyStr,aNullCol);
+ mppLocalPoolDefaults[SDRATTR_SHADOWXDIST -SDRATTR_START]=new SdrShadowXDistItem;
+ mppLocalPoolDefaults[SDRATTR_SHADOWYDIST -SDRATTR_START]=new SdrShadowYDistItem;
+ mppLocalPoolDefaults[SDRATTR_SHADOWTRANSPARENCE-SDRATTR_START]=new SdrShadowTransparenceItem;
+ mppLocalPoolDefaults[SDRATTR_SHADOW3D -SDRATTR_START]=new SfxVoidItem(SDRATTR_SHADOW3D );
+ mppLocalPoolDefaults[SDRATTR_SHADOWPERSP -SDRATTR_START]=new SfxVoidItem(SDRATTR_SHADOWPERSP );
+ mppLocalPoolDefaults[SDRATTR_CAPTIONTYPE -SDRATTR_START]=new SdrCaptionTypeItem ;
+ mppLocalPoolDefaults[SDRATTR_CAPTIONFIXEDANGLE-SDRATTR_START]=new SdrCaptionFixedAngleItem;
+ mppLocalPoolDefaults[SDRATTR_CAPTIONANGLE -SDRATTR_START]=new SdrCaptionAngleItem ;
+ mppLocalPoolDefaults[SDRATTR_CAPTIONGAP -SDRATTR_START]=new SdrCaptionGapItem ;
+ mppLocalPoolDefaults[SDRATTR_CAPTIONESCDIR -SDRATTR_START]=new SdrCaptionEscDirItem ;
+ mppLocalPoolDefaults[SDRATTR_CAPTIONESCISREL -SDRATTR_START]=new SdrCaptionEscIsRelItem ;
+ mppLocalPoolDefaults[SDRATTR_CAPTIONESCREL -SDRATTR_START]=new SdrCaptionEscRelItem ;
+ mppLocalPoolDefaults[SDRATTR_CAPTIONESCABS -SDRATTR_START]=new SdrCaptionEscAbsItem ;
+ mppLocalPoolDefaults[SDRATTR_CAPTIONLINELEN -SDRATTR_START]=new SdrCaptionLineLenItem ;
+ mppLocalPoolDefaults[SDRATTR_CAPTIONFITLINELEN-SDRATTR_START]=new SdrCaptionFitLineLenItem;
+ mppLocalPoolDefaults[SDRATTR_ECKENRADIUS -SDRATTR_START]=new SdrEckenradiusItem;
+ mppLocalPoolDefaults[SDRATTR_TEXT_MINFRAMEHEIGHT -SDRATTR_START]=new SdrTextMinFrameHeightItem;
+ mppLocalPoolDefaults[SDRATTR_TEXT_AUTOGROWHEIGHT -SDRATTR_START]=new SdrTextAutoGrowHeightItem;
+ mppLocalPoolDefaults[SDRATTR_TEXT_FITTOSIZE -SDRATTR_START]=new SdrTextFitToSizeTypeItem;
+ mppLocalPoolDefaults[SDRATTR_TEXT_LEFTDIST -SDRATTR_START]=new SdrTextLeftDistItem;
+ mppLocalPoolDefaults[SDRATTR_TEXT_RIGHTDIST -SDRATTR_START]=new SdrTextRightDistItem;
+ mppLocalPoolDefaults[SDRATTR_TEXT_UPPERDIST -SDRATTR_START]=new SdrTextUpperDistItem;
+ mppLocalPoolDefaults[SDRATTR_TEXT_LOWERDIST -SDRATTR_START]=new SdrTextLowerDistItem;
+ mppLocalPoolDefaults[SDRATTR_TEXT_VERTADJUST -SDRATTR_START]=new SdrTextVertAdjustItem;
+ mppLocalPoolDefaults[SDRATTR_TEXT_MAXFRAMEHEIGHT -SDRATTR_START]=new SdrTextMaxFrameHeightItem;
+ mppLocalPoolDefaults[SDRATTR_TEXT_MINFRAMEWIDTH -SDRATTR_START]=new SdrTextMinFrameWidthItem;
+ mppLocalPoolDefaults[SDRATTR_TEXT_MAXFRAMEWIDTH -SDRATTR_START]=new SdrTextMaxFrameWidthItem;
+ mppLocalPoolDefaults[SDRATTR_TEXT_AUTOGROWWIDTH -SDRATTR_START]=new SdrTextAutoGrowWidthItem;
+ mppLocalPoolDefaults[SDRATTR_TEXT_HORZADJUST -SDRATTR_START]=new SdrTextHorzAdjustItem;
+ mppLocalPoolDefaults[SDRATTR_TEXT_ANIKIND -SDRATTR_START]=new SdrTextAniKindItem;
+ mppLocalPoolDefaults[SDRATTR_TEXT_ANIDIRECTION -SDRATTR_START]=new SdrTextAniDirectionItem;
+ mppLocalPoolDefaults[SDRATTR_TEXT_ANISTARTINSIDE -SDRATTR_START]=new SdrTextAniStartInsideItem;
+ mppLocalPoolDefaults[SDRATTR_TEXT_ANISTOPINSIDE -SDRATTR_START]=new SdrTextAniStopInsideItem;
+ mppLocalPoolDefaults[SDRATTR_TEXT_ANICOUNT -SDRATTR_START]=new SdrTextAniCountItem;
+ mppLocalPoolDefaults[SDRATTR_TEXT_ANIDELAY -SDRATTR_START]=new SdrTextAniDelayItem;
+ mppLocalPoolDefaults[SDRATTR_TEXT_ANIAMOUNT -SDRATTR_START]=new SdrTextAniAmountItem;
+ mppLocalPoolDefaults[SDRATTR_TEXT_CONTOURFRAME -SDRATTR_START]=new SdrTextContourFrameItem;
+ mppLocalPoolDefaults[SDRATTR_CUSTOMSHAPE_ADJUSTMENT -SDRATTR_START]=new SdrCustomShapeAdjustmentItem;
+ mppLocalPoolDefaults[SDRATTR_XMLATTRIBUTES -SDRATTR_START]=new SvXMLAttrContainerItem( SDRATTR_XMLATTRIBUTES );
+ mppLocalPoolDefaults[SDRATTR_TEXT_USEFIXEDCELLHEIGHT -SDRATTR_START]=new SdrTextFixedCellHeightItem;
+ mppLocalPoolDefaults[SDRATTR_TEXT_WORDWRAP -SDRATTR_START]=new SdrTextWordWrapItem;
+ mppLocalPoolDefaults[SDRATTR_TEXT_AUTOGROWSIZE -SDRATTR_START]=new SdrTextAutoGrowSizeItem;
+ mppLocalPoolDefaults[SDRATTR_EDGEKIND -SDRATTR_START]=new SdrEdgeKindItem;
+ mppLocalPoolDefaults[SDRATTR_EDGENODE1HORZDIST-SDRATTR_START]=new SdrEdgeNode1HorzDistItem(nDefEdgeDist);
+ mppLocalPoolDefaults[SDRATTR_EDGENODE1VERTDIST-SDRATTR_START]=new SdrEdgeNode1VertDistItem(nDefEdgeDist);
+ mppLocalPoolDefaults[SDRATTR_EDGENODE2HORZDIST-SDRATTR_START]=new SdrEdgeNode2HorzDistItem(nDefEdgeDist);
+ mppLocalPoolDefaults[SDRATTR_EDGENODE2VERTDIST-SDRATTR_START]=new SdrEdgeNode2VertDistItem(nDefEdgeDist);
+ mppLocalPoolDefaults[SDRATTR_EDGENODE1GLUEDIST-SDRATTR_START]=new SdrEdgeNode1GlueDistItem;
+ mppLocalPoolDefaults[SDRATTR_EDGENODE2GLUEDIST-SDRATTR_START]=new SdrEdgeNode2GlueDistItem;
+ mppLocalPoolDefaults[SDRATTR_EDGELINEDELTAANZ -SDRATTR_START]=new SdrEdgeLineDeltaAnzItem;
+ mppLocalPoolDefaults[SDRATTR_EDGELINE1DELTA -SDRATTR_START]=new SdrEdgeLine1DeltaItem;
+ mppLocalPoolDefaults[SDRATTR_EDGELINE2DELTA -SDRATTR_START]=new SdrEdgeLine2DeltaItem;
+ mppLocalPoolDefaults[SDRATTR_EDGELINE3DELTA -SDRATTR_START]=new SdrEdgeLine3DeltaItem;
+ mppLocalPoolDefaults[SDRATTR_MEASUREKIND -SDRATTR_START]=new SdrMeasureKindItem;
+ mppLocalPoolDefaults[SDRATTR_MEASURETEXTHPOS -SDRATTR_START]=new SdrMeasureTextHPosItem;
+ mppLocalPoolDefaults[SDRATTR_MEASURETEXTVPOS -SDRATTR_START]=new SdrMeasureTextVPosItem;
+ mppLocalPoolDefaults[SDRATTR_MEASURELINEDIST -SDRATTR_START]=new SdrMeasureLineDistItem(800);
+ mppLocalPoolDefaults[SDRATTR_MEASUREHELPLINEOVERHANG -SDRATTR_START]=new SdrMeasureHelplineOverhangItem(200);
+ mppLocalPoolDefaults[SDRATTR_MEASUREHELPLINEDIST -SDRATTR_START]=new SdrMeasureHelplineDistItem(100);
+ mppLocalPoolDefaults[SDRATTR_MEASUREHELPLINE1LEN -SDRATTR_START]=new SdrMeasureHelpline1LenItem;
+ mppLocalPoolDefaults[SDRATTR_MEASUREHELPLINE2LEN -SDRATTR_START]=new SdrMeasureHelpline2LenItem;
+ mppLocalPoolDefaults[SDRATTR_MEASUREBELOWREFEDGE -SDRATTR_START]=new SdrMeasureBelowRefEdgeItem;
+ mppLocalPoolDefaults[SDRATTR_MEASURETEXTROTA90 -SDRATTR_START]=new SdrMeasureTextRota90Item;
+ mppLocalPoolDefaults[SDRATTR_MEASURETEXTUPSIDEDOWN -SDRATTR_START]=new SdrMeasureTextUpsideDownItem;
+ mppLocalPoolDefaults[SDRATTR_MEASUREOVERHANG -SDRATTR_START]=new SdrMeasureOverhangItem(600);
+ mppLocalPoolDefaults[SDRATTR_MEASUREUNIT -SDRATTR_START]=new SdrMeasureUnitItem;
+ mppLocalPoolDefaults[SDRATTR_MEASURESCALE -SDRATTR_START]=new SdrMeasureScaleItem;
+ mppLocalPoolDefaults[SDRATTR_MEASURESHOWUNIT -SDRATTR_START]=new SdrMeasureShowUnitItem;
+ mppLocalPoolDefaults[SDRATTR_MEASUREFORMATSTRING -SDRATTR_START]=new SdrMeasureFormatStringItem();
+ mppLocalPoolDefaults[SDRATTR_MEASURETEXTAUTOANGLE -SDRATTR_START]=new SdrMeasureTextAutoAngleItem();
+ mppLocalPoolDefaults[SDRATTR_MEASURETEXTAUTOANGLEVIEW-SDRATTR_START]=new SdrMeasureTextAutoAngleViewItem();
+ mppLocalPoolDefaults[SDRATTR_MEASURETEXTISFIXEDANGLE -SDRATTR_START]=new SdrMeasureTextIsFixedAngleItem();
+ mppLocalPoolDefaults[SDRATTR_MEASURETEXTFIXEDANGLE -SDRATTR_START]=new SdrMeasureTextFixedAngleItem();
+ mppLocalPoolDefaults[SDRATTR_MEASUREDECIMALPLACES -SDRATTR_START]=new SdrMeasureDecimalPlacesItem();
+ mppLocalPoolDefaults[SDRATTR_CIRCKIND -SDRATTR_START]=new SdrCircKindItem;
+ mppLocalPoolDefaults[SDRATTR_CIRCSTARTANGLE-SDRATTR_START]=new SdrCircStartAngleItem;
+ mppLocalPoolDefaults[SDRATTR_CIRCENDANGLE -SDRATTR_START]=new SdrCircEndAngleItem;
+ mppLocalPoolDefaults[SDRATTR_OBJMOVEPROTECT -SDRATTR_START]=new SdrObjMoveProtectItem;
+ mppLocalPoolDefaults[SDRATTR_OBJSIZEPROTECT -SDRATTR_START]=new SdrObjSizeProtectItem;
+ mppLocalPoolDefaults[SDRATTR_OBJPRINTABLE -SDRATTR_START]=new SdrObjPrintableItem;
+ mppLocalPoolDefaults[SDRATTR_OBJVISIBLE -SDRATTR_START]=new SdrObjVisibleItem;
+ mppLocalPoolDefaults[SDRATTR_LAYERID -SDRATTR_START]=new SdrLayerIdItem;
+ mppLocalPoolDefaults[SDRATTR_LAYERNAME -SDRATTR_START]=new SdrLayerNameItem;
+ mppLocalPoolDefaults[SDRATTR_OBJECTNAME -SDRATTR_START]=new SdrObjectNameItem;
+ mppLocalPoolDefaults[SDRATTR_ALLPOSITIONX -SDRATTR_START]=new SdrAllPositionXItem;
+ mppLocalPoolDefaults[SDRATTR_ALLPOSITIONY -SDRATTR_START]=new SdrAllPositionYItem;
+ mppLocalPoolDefaults[SDRATTR_ALLSIZEWIDTH -SDRATTR_START]=new SdrAllSizeWidthItem;
+ mppLocalPoolDefaults[SDRATTR_ALLSIZEHEIGHT -SDRATTR_START]=new SdrAllSizeHeightItem;
+ mppLocalPoolDefaults[SDRATTR_ONEPOSITIONX -SDRATTR_START]=new SdrOnePositionXItem;
+ mppLocalPoolDefaults[SDRATTR_ONEPOSITIONY -SDRATTR_START]=new SdrOnePositionYItem;
+ mppLocalPoolDefaults[SDRATTR_ONESIZEWIDTH -SDRATTR_START]=new SdrOneSizeWidthItem;
+ mppLocalPoolDefaults[SDRATTR_ONESIZEHEIGHT -SDRATTR_START]=new SdrOneSizeHeightItem;
+ mppLocalPoolDefaults[SDRATTR_LOGICSIZEWIDTH -SDRATTR_START]=new SdrLogicSizeWidthItem;
+ mppLocalPoolDefaults[SDRATTR_LOGICSIZEHEIGHT-SDRATTR_START]=new SdrLogicSizeHeightItem;
+ mppLocalPoolDefaults[SDRATTR_ROTATEANGLE -SDRATTR_START]=new SdrRotateAngleItem;
+ mppLocalPoolDefaults[SDRATTR_SHEARANGLE -SDRATTR_START]=new SdrShearAngleItem;
+ mppLocalPoolDefaults[SDRATTR_MOVEX -SDRATTR_START]=new SdrMoveXItem;
+ mppLocalPoolDefaults[SDRATTR_MOVEY -SDRATTR_START]=new SdrMoveYItem;
+ mppLocalPoolDefaults[SDRATTR_RESIZEXONE -SDRATTR_START]=new SdrResizeXOneItem;
+ mppLocalPoolDefaults[SDRATTR_RESIZEYONE -SDRATTR_START]=new SdrResizeYOneItem;
+ mppLocalPoolDefaults[SDRATTR_ROTATEONE -SDRATTR_START]=new SdrRotateOneItem;
+ mppLocalPoolDefaults[SDRATTR_HORZSHEARONE -SDRATTR_START]=new SdrHorzShearOneItem;
+ mppLocalPoolDefaults[SDRATTR_VERTSHEARONE -SDRATTR_START]=new SdrVertShearOneItem;
+ mppLocalPoolDefaults[SDRATTR_RESIZEXALL -SDRATTR_START]=new SdrResizeXAllItem;
+ mppLocalPoolDefaults[SDRATTR_RESIZEYALL -SDRATTR_START]=new SdrResizeYAllItem;
+ mppLocalPoolDefaults[SDRATTR_ROTATEALL -SDRATTR_START]=new SdrRotateAllItem;
+ mppLocalPoolDefaults[SDRATTR_HORZSHEARALL -SDRATTR_START]=new SdrHorzShearAllItem;
+ mppLocalPoolDefaults[SDRATTR_VERTSHEARALL -SDRATTR_START]=new SdrVertShearAllItem;
+ mppLocalPoolDefaults[SDRATTR_TRANSFORMREF1X -SDRATTR_START]=new SdrTransformRef1XItem;
+ mppLocalPoolDefaults[SDRATTR_TRANSFORMREF1Y -SDRATTR_START]=new SdrTransformRef1YItem;
+ mppLocalPoolDefaults[SDRATTR_TRANSFORMREF2X -SDRATTR_START]=new SdrTransformRef2XItem;
+ mppLocalPoolDefaults[SDRATTR_TRANSFORMREF2Y -SDRATTR_START]=new SdrTransformRef2YItem;
+ mppLocalPoolDefaults[SDRATTR_TEXTDIRECTION -SDRATTR_START]=new SvxWritingModeItem(com::sun::star::text::WritingMode_LR_TB, SDRATTR_TEXTDIRECTION);
+ mppLocalPoolDefaults[ SDRATTR_GRAFRED - SDRATTR_START] = new SdrGrafRedItem;
+ mppLocalPoolDefaults[ SDRATTR_GRAFGREEN - SDRATTR_START] = new SdrGrafGreenItem;
+ mppLocalPoolDefaults[ SDRATTR_GRAFBLUE - SDRATTR_START] = new SdrGrafBlueItem;
+ mppLocalPoolDefaults[ SDRATTR_GRAFLUMINANCE - SDRATTR_START] = new SdrGrafLuminanceItem;
+ mppLocalPoolDefaults[ SDRATTR_GRAFCONTRAST - SDRATTR_START] = new SdrGrafContrastItem;
+ mppLocalPoolDefaults[ SDRATTR_GRAFGAMMA - SDRATTR_START] = new SdrGrafGamma100Item;
+ mppLocalPoolDefaults[ SDRATTR_GRAFTRANSPARENCE - SDRATTR_START] = new SdrGrafTransparenceItem;
+ mppLocalPoolDefaults[ SDRATTR_GRAFINVERT - SDRATTR_START] = new SdrGrafInvertItem;
+ mppLocalPoolDefaults[ SDRATTR_GRAFMODE - SDRATTR_START] = new SdrGrafModeItem;
+ mppLocalPoolDefaults[ SDRATTR_GRAFCROP - SDRATTR_START] = new SdrGrafCropItem;
+ mppLocalPoolDefaults[ SDRATTR_3DOBJ_PERCENT_DIAGONAL - SDRATTR_START ] = new Svx3DPercentDiagonalItem;
+ mppLocalPoolDefaults[ SDRATTR_3DOBJ_BACKSCALE - SDRATTR_START ] = new Svx3DBackscaleItem;
+ mppLocalPoolDefaults[ SDRATTR_3DOBJ_DEPTH - SDRATTR_START ] = new Svx3DDepthItem;
+ mppLocalPoolDefaults[ SDRATTR_3DOBJ_HORZ_SEGS - SDRATTR_START ] = new Svx3DHorizontalSegmentsItem;
+ mppLocalPoolDefaults[ SDRATTR_3DOBJ_VERT_SEGS - SDRATTR_START ] = new Svx3DVerticalSegmentsItem;
+ mppLocalPoolDefaults[ SDRATTR_3DOBJ_END_ANGLE - SDRATTR_START ] = new Svx3DEndAngleItem;
+ mppLocalPoolDefaults[ SDRATTR_3DOBJ_DOUBLE_SIDED - SDRATTR_START ] = new Svx3DDoubleSidedItem;
+ mppLocalPoolDefaults[ SDRATTR_3DOBJ_NORMALS_KIND - SDRATTR_START ] = new Svx3DNormalsKindItem;
+ mppLocalPoolDefaults[ SDRATTR_3DOBJ_NORMALS_INVERT - SDRATTR_START ] = new Svx3DNormalsInvertItem;
+ mppLocalPoolDefaults[ SDRATTR_3DOBJ_TEXTURE_PROJ_X - SDRATTR_START ] = new Svx3DTextureProjectionXItem;
+ mppLocalPoolDefaults[ SDRATTR_3DOBJ_TEXTURE_PROJ_Y - SDRATTR_START ] = new Svx3DTextureProjectionYItem;
+ mppLocalPoolDefaults[ SDRATTR_3DOBJ_SHADOW_3D - SDRATTR_START ] = new Svx3DShadow3DItem;
+ mppLocalPoolDefaults[ SDRATTR_3DOBJ_MAT_COLOR - SDRATTR_START ] = new Svx3DMaterialColorItem;
+ mppLocalPoolDefaults[ SDRATTR_3DOBJ_MAT_EMISSION - SDRATTR_START ] = new Svx3DMaterialEmissionItem;
+ mppLocalPoolDefaults[ SDRATTR_3DOBJ_MAT_SPECULAR - SDRATTR_START ] = new Svx3DMaterialSpecularItem;
+ mppLocalPoolDefaults[ SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY - SDRATTR_START ] = new Svx3DMaterialSpecularIntensityItem;
+ mppLocalPoolDefaults[ SDRATTR_3DOBJ_TEXTURE_KIND - SDRATTR_START ] = new Svx3DTextureKindItem;
+ mppLocalPoolDefaults[ SDRATTR_3DOBJ_TEXTURE_MODE - SDRATTR_START ] = new Svx3DTextureModeItem;
+ mppLocalPoolDefaults[ SDRATTR_3DOBJ_TEXTURE_FILTER - SDRATTR_START ] = new Svx3DTextureFilterItem;
+ mppLocalPoolDefaults[ SDRATTR_3DOBJ_SMOOTH_NORMALS - SDRATTR_START ] = new Svx3DSmoothNormalsItem;
+ mppLocalPoolDefaults[ SDRATTR_3DOBJ_SMOOTH_LIDS - SDRATTR_START ] = new Svx3DSmoothLidsItem;
+ mppLocalPoolDefaults[ SDRATTR_3DOBJ_CHARACTER_MODE - SDRATTR_START ] = new Svx3DCharacterModeItem;
+ mppLocalPoolDefaults[ SDRATTR_3DOBJ_CLOSE_FRONT - SDRATTR_START ] = new Svx3DCloseFrontItem;
+ mppLocalPoolDefaults[ SDRATTR_3DOBJ_CLOSE_BACK - SDRATTR_START ] = new Svx3DCloseBackItem;
+ mppLocalPoolDefaults[ SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY - SDRATTR_START ] = new Svx3DReducedLineGeometryItem;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_PERSPECTIVE - SDRATTR_START ] = new Svx3DPerspectiveItem;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_DISTANCE - SDRATTR_START ] = new Svx3DDistanceItem;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_FOCAL_LENGTH - SDRATTR_START ] = new Svx3DFocalLengthItem;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_TWO_SIDED_LIGHTING - SDRATTR_START ] = new Svx3DTwoSidedLightingItem;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_1 - SDRATTR_START ] = new Svx3DLightcolor1Item;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_2 - SDRATTR_START ] = new Svx3DLightcolor2Item;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_3 - SDRATTR_START ] = new Svx3DLightcolor3Item;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_4 - SDRATTR_START ] = new Svx3DLightcolor4Item;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_5 - SDRATTR_START ] = new Svx3DLightcolor5Item;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_6 - SDRATTR_START ] = new Svx3DLightcolor6Item;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_7 - SDRATTR_START ] = new Svx3DLightcolor7Item;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_8 - SDRATTR_START ] = new Svx3DLightcolor8Item;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_AMBIENTCOLOR - SDRATTR_START ] = new Svx3DAmbientcolorItem;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_1 - SDRATTR_START ] = new Svx3DLightOnOff1Item;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_2 - SDRATTR_START ] = new Svx3DLightOnOff2Item;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_3 - SDRATTR_START ] = new Svx3DLightOnOff3Item;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_4 - SDRATTR_START ] = new Svx3DLightOnOff4Item;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_5 - SDRATTR_START ] = new Svx3DLightOnOff5Item;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_6 - SDRATTR_START ] = new Svx3DLightOnOff6Item;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_7 - SDRATTR_START ] = new Svx3DLightOnOff7Item;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_8 - SDRATTR_START ] = new Svx3DLightOnOff8Item;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_1 - SDRATTR_START ] = new Svx3DLightDirection1Item;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_2 - SDRATTR_START ] = new Svx3DLightDirection2Item;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_3 - SDRATTR_START ] = new Svx3DLightDirection3Item;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_4 - SDRATTR_START ] = new Svx3DLightDirection4Item;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_5 - SDRATTR_START ] = new Svx3DLightDirection5Item;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_6 - SDRATTR_START ] = new Svx3DLightDirection6Item;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_7 - SDRATTR_START ] = new Svx3DLightDirection7Item;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_8 - SDRATTR_START ] = new Svx3DLightDirection8Item;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_SHADOW_SLANT - SDRATTR_START ] = new Svx3DShadowSlantItem;
+ mppLocalPoolDefaults[ SDRATTR_3DSCENE_SHADE_MODE - SDRATTR_START ] = new Svx3DShadeModeItem;
+ mppLocalPoolDefaults[ SDRATTR_CUSTOMSHAPE_ENGINE - SDRATTR_START ] = new SdrCustomShapeEngineItem;
+ mppLocalPoolDefaults[ SDRATTR_CUSTOMSHAPE_DATA - SDRATTR_START ] = new SdrCustomShapeDataItem;
+ mppLocalPoolDefaults[ SDRATTR_CUSTOMSHAPE_GEOMETRY - SDRATTR_START ] = new SdrCustomShapeGeometryItem;
+ mppLocalPoolDefaults[ SDRATTR_CUSTOMSHAPE_REPLACEMENT_URL - SDRATTR_START ] = new SdrCustomShapeReplacementURLItem;
+
+ SvxBoxItem* pboxItem = new SvxBoxItem( SDRATTR_TABLE_BORDER );
+ pboxItem->SetDistance( 100 );
+ mppLocalPoolDefaults[ SDRATTR_TABLE_BORDER - SDRATTR_START ] = pboxItem;
+
+ SvxBoxInfoItem* pBoxInfoItem = new SvxBoxInfoItem( SDRATTR_TABLE_BORDER_INNER );
+
+ pBoxInfoItem->SetTable( sal_True );
+ pBoxInfoItem->SetDist( sal_True); // Abstandsfeld immer anzeigen
+// pBoxInfoItem->SetMinDist( sal_True );// Minimalgroesse in Tabellen und Absaetzen setzen
+// pBoxInfoItem->SetDefDist( MIN_BORDER_DIST );// Default-Abstand immer setzen
+ pBoxInfoItem->SetValid( VALID_DISABLE, sal_True ); // Einzelne Linien koennen nur in Tabellen DontCare-Status haben
+
+ mppLocalPoolDefaults[ SDRATTR_TABLE_BORDER_INNER - SDRATTR_START ] = pBoxInfoItem;
+// mppLocalPoolDefaults[ SDRATTR_TABLE_BORDER_SHADOW - SDRATTR_START ] = new SvxShadowItem( SDRATTR_TABLE_BORDER_SHADOW );
+ mppLocalPoolDefaults[ SDRATTR_TABLE_BORDER_TLBR - SDRATTR_START ] = new SvxLineItem( SDRATTR_TABLE_BORDER_TLBR );
+ mppLocalPoolDefaults[ SDRATTR_TABLE_BORDER_BLTR - SDRATTR_START ] = new SvxLineItem( SDRATTR_TABLE_BORDER_BLTR );
+
+ // set own ItemInfos
+ mpLocalItemInfos[SDRATTR_SHADOW-SDRATTR_START]._nSID=SID_ATTR_FILL_SHADOW;
+ mpLocalItemInfos[SDRATTR_TEXT_FITTOSIZE-SDRATTR_START]._nSID=SID_ATTR_TEXT_FITTOSIZE;
+ mpLocalItemInfos[SDRATTR_GRAFCROP-SDRATTR_START]._nSID=SID_ATTR_GRAF_CROP;
+
+ mpLocalItemInfos[SDRATTR_TABLE_BORDER - SDRATTR_START ]._nSID = SID_ATTR_BORDER_OUTER;
+ mpLocalItemInfos[SDRATTR_TABLE_BORDER_INNER - SDRATTR_START ]._nSID = SID_ATTR_BORDER_INNER;
+// mpLocalItemInfos[SDRATTR_TABLE_BORDER_SHADOW - SDRATTR_START ]._nSID = SID_ATTR_BORDER_SHADOW;
+ mpLocalItemInfos[SDRATTR_TABLE_BORDER_TLBR - SDRATTR_START ]._nSID = SID_ATTR_BORDER_DIAG_TLBR;
+ mpLocalItemInfos[SDRATTR_TABLE_BORDER_BLTR - SDRATTR_START ]._nSID = SID_ATTR_BORDER_DIAG_BLTR;
+
+ // it's my own creation level, set Defaults and ItemInfos
+ SetDefaults(mppLocalPoolDefaults);
+ SetItemInfos(mpLocalItemInfos);
+}
+
+/*************************************************************************
+|*
+|* copy ctor, sorgt dafuer, dass die static defaults gecloned werden
+|* (Parameter 2 = sal_True)
+|*
+\************************************************************************/
+
+SdrItemPool::SdrItemPool(const SdrItemPool& rPool)
+: XOutdevItemPool(rPool)
+{
+}
+
+/*************************************************************************
+|*
+|* Clone()
+|*
+\************************************************************************/
+
+SfxItemPool* __EXPORT SdrItemPool::Clone() const
+{
+ return new SdrItemPool(*this);
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+SdrItemPool::~SdrItemPool()
+{
+ // dtor of SfxItemPool
+ Delete();
+
+ // clear own static Defaults
+ if(mppLocalPoolDefaults)
+ {
+ const sal_uInt16 nBeg(SDRATTR_SHADOW_FIRST - SDRATTR_START);
+ const sal_uInt16 nEnd2(SDRATTR_END - SDRATTR_START);
+
+ for(sal_uInt16 i(nBeg); i <= nEnd2; i++)
+ {
+ SetRefCount(*mppLocalPoolDefaults[i],0);
+ delete mppLocalPoolDefaults[i];
+ mppLocalPoolDefaults[i] = 0L;
+ }
+ }
+
+ // split pools before detroying
+ SetSecondaryPool(NULL);
+}
+
+SfxItemPresentation __EXPORT SdrItemPool::GetPresentation(
+ const SfxPoolItem& rItem, SfxItemPresentation ePresentation,
+ SfxMapUnit ePresentationMetric, XubString& rText,
+ const IntlWrapper * pIntlWrapper) const
+{
+ if (!IsInvalidItem(&rItem)) {
+ sal_uInt16 nWhich=rItem.Which();
+ if (nWhich>=SDRATTR_SHADOW_FIRST && nWhich<=SDRATTR_END) {
+ rItem.GetPresentation(SFX_ITEM_PRESENTATION_NAMELESS,
+ GetMetric(nWhich),ePresentationMetric,rText,
+ pIntlWrapper);
+ String aStr;
+
+ TakeItemName(nWhich, aStr);
+ aStr += sal_Unicode(' ');
+ rText.Insert(aStr, 0);
+
+ return ePresentation;
+ }
+ }
+ return XOutdevItemPool::GetPresentation(rItem,ePresentation,ePresentationMetric,rText,pIntlWrapper);
+}
+
+void SdrItemPool::TakeItemName(sal_uInt16 nWhich, String& rItemName)
+{
+ ResMgr* pResMgr = ImpGetResMgr();
+ sal_uInt16 nResId = SIP_UNKNOWN_ATTR;
+
+ switch (nWhich)
+ {
+ case XATTR_LINESTYLE : nResId = SIP_XA_LINESTYLE;break;
+ case XATTR_LINEDASH : nResId = SIP_XA_LINEDASH;break;
+ case XATTR_LINEWIDTH : nResId = SIP_XA_LINEWIDTH;break;
+ case XATTR_LINECOLOR : nResId = SIP_XA_LINECOLOR;break;
+ case XATTR_LINESTART : nResId = SIP_XA_LINESTART;break;
+ case XATTR_LINEEND : nResId = SIP_XA_LINEEND;break;
+ case XATTR_LINESTARTWIDTH : nResId = SIP_XA_LINESTARTWIDTH;break;
+ case XATTR_LINEENDWIDTH : nResId = SIP_XA_LINEENDWIDTH;break;
+ case XATTR_LINESTARTCENTER : nResId = SIP_XA_LINESTARTCENTER;break;
+ case XATTR_LINEENDCENTER : nResId = SIP_XA_LINEENDCENTER;break;
+ case XATTR_LINETRANSPARENCE : nResId = SIP_XA_LINETRANSPARENCE;break;
+ case XATTR_LINEJOINT : nResId = SIP_XA_LINEJOINT;break;
+ case XATTRSET_LINE : nResId = SIP_XATTRSET_LINE;break;
+
+ case XATTR_FILLSTYLE : nResId = SIP_XA_FILLSTYLE;break;
+ case XATTR_FILLCOLOR : nResId = SIP_XA_FILLCOLOR;break;
+ case XATTR_FILLGRADIENT : nResId = SIP_XA_FILLGRADIENT;break;
+ case XATTR_FILLHATCH : nResId = SIP_XA_FILLHATCH;break;
+ case XATTR_FILLBITMAP : nResId = SIP_XA_FILLBITMAP;break;
+ case XATTR_FILLTRANSPARENCE : nResId = SIP_XA_FILLTRANSPARENCE;break;
+ case XATTR_GRADIENTSTEPCOUNT : nResId = SIP_XA_GRADIENTSTEPCOUNT;break;
+ case XATTR_FILLBMP_TILE : nResId = SIP_XA_FILLBMP_TILE;break;
+ case XATTR_FILLBMP_POS : nResId = SIP_XA_FILLBMP_POS;break;
+ case XATTR_FILLBMP_SIZEX : nResId = SIP_XA_FILLBMP_SIZEX;break;
+ case XATTR_FILLBMP_SIZEY : nResId = SIP_XA_FILLBMP_SIZEY;break;
+ case XATTR_FILLFLOATTRANSPARENCE: nResId = SIP_XA_FILLFLOATTRANSPARENCE;break;
+ case XATTR_SECONDARYFILLCOLOR : nResId = SIP_XA_SECONDARYFILLCOLOR;break;
+ case XATTR_FILLBMP_SIZELOG : nResId = SIP_XA_FILLBMP_SIZELOG;break;
+ case XATTR_FILLBMP_TILEOFFSETX : nResId = SIP_XA_FILLBMP_TILEOFFSETX;break;
+ case XATTR_FILLBMP_TILEOFFSETY : nResId = SIP_XA_FILLBMP_TILEOFFSETY;break;
+ case XATTR_FILLBMP_STRETCH : nResId = SIP_XA_FILLBMP_STRETCH;break;
+ case XATTR_FILLBMP_POSOFFSETX : nResId = SIP_XA_FILLBMP_POSOFFSETX;break;
+ case XATTR_FILLBMP_POSOFFSETY : nResId = SIP_XA_FILLBMP_POSOFFSETY;break;
+ case XATTR_FILLBACKGROUND : nResId = SIP_XA_FILLBACKGROUND;break;
+
+ case XATTRSET_FILL : nResId = SIP_XATTRSET_FILL;break;
+
+ case XATTR_FORMTXTSTYLE : nResId = SIP_XA_FORMTXTSTYLE;break;
+ case XATTR_FORMTXTADJUST : nResId = SIP_XA_FORMTXTADJUST;break;
+ case XATTR_FORMTXTDISTANCE : nResId = SIP_XA_FORMTXTDISTANCE;break;
+ case XATTR_FORMTXTSTART : nResId = SIP_XA_FORMTXTSTART;break;
+ case XATTR_FORMTXTMIRROR : nResId = SIP_XA_FORMTXTMIRROR;break;
+ case XATTR_FORMTXTOUTLINE : nResId = SIP_XA_FORMTXTOUTLINE;break;
+ case XATTR_FORMTXTSHADOW : nResId = SIP_XA_FORMTXTSHADOW;break;
+ case XATTR_FORMTXTSHDWCOLOR : nResId = SIP_XA_FORMTXTSHDWCOLOR;break;
+ case XATTR_FORMTXTSHDWXVAL : nResId = SIP_XA_FORMTXTSHDWXVAL;break;
+ case XATTR_FORMTXTSHDWYVAL : nResId = SIP_XA_FORMTXTSHDWYVAL;break;
+ case XATTR_FORMTXTSTDFORM : nResId = SIP_XA_FORMTXTSTDFORM;break;
+ case XATTR_FORMTXTHIDEFORM : nResId = SIP_XA_FORMTXTHIDEFORM;break;
+ case XATTR_FORMTXTSHDWTRANSP: nResId = SIP_XA_FORMTXTSHDWTRANSP;break;
+
+ case SDRATTR_SHADOW : nResId = SIP_SA_SHADOW;break;
+ case SDRATTR_SHADOWCOLOR : nResId = SIP_SA_SHADOWCOLOR;break;
+ case SDRATTR_SHADOWXDIST : nResId = SIP_SA_SHADOWXDIST;break;
+ case SDRATTR_SHADOWYDIST : nResId = SIP_SA_SHADOWYDIST;break;
+ case SDRATTR_SHADOWTRANSPARENCE: nResId = SIP_SA_SHADOWTRANSPARENCE;break;
+ case SDRATTR_SHADOW3D : nResId = SIP_SA_SHADOW3D;break;
+ case SDRATTR_SHADOWPERSP : nResId = SIP_SA_SHADOWPERSP;break;
+
+ case SDRATTR_CAPTIONTYPE : nResId = SIP_SA_CAPTIONTYPE;break;
+ case SDRATTR_CAPTIONFIXEDANGLE: nResId = SIP_SA_CAPTIONFIXEDANGLE;break;
+ case SDRATTR_CAPTIONANGLE : nResId = SIP_SA_CAPTIONANGLE;break;
+ case SDRATTR_CAPTIONGAP : nResId = SIP_SA_CAPTIONGAP;break;
+ case SDRATTR_CAPTIONESCDIR : nResId = SIP_SA_CAPTIONESCDIR;break;
+ case SDRATTR_CAPTIONESCISREL : nResId = SIP_SA_CAPTIONESCISREL;break;
+ case SDRATTR_CAPTIONESCREL : nResId = SIP_SA_CAPTIONESCREL;break;
+ case SDRATTR_CAPTIONESCABS : nResId = SIP_SA_CAPTIONESCABS;break;
+ case SDRATTR_CAPTIONLINELEN : nResId = SIP_SA_CAPTIONLINELEN;break;
+ case SDRATTR_CAPTIONFITLINELEN: nResId = SIP_SA_CAPTIONFITLINELEN;break;
+
+ case SDRATTR_ECKENRADIUS : nResId = SIP_SA_ECKENRADIUS;break;
+ case SDRATTR_TEXT_MINFRAMEHEIGHT : nResId = SIP_SA_TEXT_MINFRAMEHEIGHT;break;
+ case SDRATTR_TEXT_AUTOGROWHEIGHT : nResId = SIP_SA_TEXT_AUTOGROWHEIGHT;break;
+ case SDRATTR_TEXT_FITTOSIZE : nResId = SIP_SA_TEXT_FITTOSIZE;break;
+ case SDRATTR_TEXT_LEFTDIST : nResId = SIP_SA_TEXT_LEFTDIST;break;
+ case SDRATTR_TEXT_RIGHTDIST : nResId = SIP_SA_TEXT_RIGHTDIST;break;
+ case SDRATTR_TEXT_UPPERDIST : nResId = SIP_SA_TEXT_UPPERDIST;break;
+ case SDRATTR_TEXT_LOWERDIST : nResId = SIP_SA_TEXT_LOWERDIST;break;
+ case SDRATTR_TEXT_VERTADJUST : nResId = SIP_SA_TEXT_VERTADJUST;break;
+ case SDRATTR_TEXT_MAXFRAMEHEIGHT : nResId = SIP_SA_TEXT_MAXFRAMEHEIGHT;break;
+ case SDRATTR_TEXT_MINFRAMEWIDTH : nResId = SIP_SA_TEXT_MINFRAMEWIDTH;break;
+ case SDRATTR_TEXT_MAXFRAMEWIDTH : nResId = SIP_SA_TEXT_MAXFRAMEWIDTH;break;
+ case SDRATTR_TEXT_AUTOGROWWIDTH : nResId = SIP_SA_TEXT_AUTOGROWWIDTH;break;
+ case SDRATTR_TEXT_HORZADJUST : nResId = SIP_SA_TEXT_HORZADJUST;break;
+ case SDRATTR_TEXT_ANIKIND : nResId = SIP_SA_TEXT_ANIKIND;break;
+ case SDRATTR_TEXT_ANIDIRECTION : nResId = SIP_SA_TEXT_ANIDIRECTION;break;
+ case SDRATTR_TEXT_ANISTARTINSIDE : nResId = SIP_SA_TEXT_ANISTARTINSIDE;break;
+ case SDRATTR_TEXT_ANISTOPINSIDE : nResId = SIP_SA_TEXT_ANISTOPINSIDE;break;
+ case SDRATTR_TEXT_ANICOUNT : nResId = SIP_SA_TEXT_ANICOUNT;break;
+ case SDRATTR_TEXT_ANIDELAY : nResId = SIP_SA_TEXT_ANIDELAY;break;
+ case SDRATTR_TEXT_ANIAMOUNT : nResId = SIP_SA_TEXT_ANIAMOUNT;break;
+ case SDRATTR_TEXT_CONTOURFRAME : nResId = SIP_SA_TEXT_CONTOURFRAME;break;
+ case SDRATTR_CUSTOMSHAPE_ADJUSTMENT : nResId = SIP_SA_CUSTOMSHAPE_ADJUSTMENT;break;
+ case SDRATTR_XMLATTRIBUTES : nResId = SIP_SA_XMLATTRIBUTES;break;
+ case SDRATTR_TEXT_USEFIXEDCELLHEIGHT: nResId = SIP_SA_TEXT_USEFIXEDCELLHEIGHT;break;
+ case SDRATTR_TEXT_WORDWRAP : nResId = SIP_SA_WORDWRAP;break;
+ case SDRATTR_TEXT_AUTOGROWSIZE : nResId = SIP_SA_AUTOGROWSIZE;break;
+
+ case SDRATTR_EDGEKIND : nResId = SIP_SA_EDGEKIND;break;
+ case SDRATTR_EDGENODE1HORZDIST : nResId = SIP_SA_EDGENODE1HORZDIST;break;
+ case SDRATTR_EDGENODE1VERTDIST : nResId = SIP_SA_EDGENODE1VERTDIST;break;
+ case SDRATTR_EDGENODE2HORZDIST : nResId = SIP_SA_EDGENODE2HORZDIST;break;
+ case SDRATTR_EDGENODE2VERTDIST : nResId = SIP_SA_EDGENODE2VERTDIST;break;
+ case SDRATTR_EDGENODE1GLUEDIST : nResId = SIP_SA_EDGENODE1GLUEDIST;break;
+ case SDRATTR_EDGENODE2GLUEDIST : nResId = SIP_SA_EDGENODE2GLUEDIST;break;
+ case SDRATTR_EDGELINEDELTAANZ : nResId = SIP_SA_EDGELINEDELTAANZ;break;
+ case SDRATTR_EDGELINE1DELTA : nResId = SIP_SA_EDGELINE1DELTA;break;
+ case SDRATTR_EDGELINE2DELTA : nResId = SIP_SA_EDGELINE2DELTA;break;
+ case SDRATTR_EDGELINE3DELTA : nResId = SIP_SA_EDGELINE3DELTA;break;
+
+ case SDRATTR_MEASUREKIND : nResId = SIP_SA_MEASUREKIND;break;
+ case SDRATTR_MEASURETEXTHPOS : nResId = SIP_SA_MEASURETEXTHPOS;break;
+ case SDRATTR_MEASURETEXTVPOS : nResId = SIP_SA_MEASURETEXTVPOS;break;
+ case SDRATTR_MEASURELINEDIST : nResId = SIP_SA_MEASURELINEDIST;break;
+ case SDRATTR_MEASUREHELPLINEOVERHANG : nResId = SIP_SA_MEASUREHELPLINEOVERHANG;break;
+ case SDRATTR_MEASUREHELPLINEDIST : nResId = SIP_SA_MEASUREHELPLINEDIST;break;
+ case SDRATTR_MEASUREHELPLINE1LEN : nResId = SIP_SA_MEASUREHELPLINE1LEN;break;
+ case SDRATTR_MEASUREHELPLINE2LEN : nResId = SIP_SA_MEASUREHELPLINE2LEN;break;
+ case SDRATTR_MEASUREBELOWREFEDGE : nResId = SIP_SA_MEASUREBELOWREFEDGE;break;
+ case SDRATTR_MEASURETEXTROTA90 : nResId = SIP_SA_MEASURETEXTROTA90;break;
+ case SDRATTR_MEASURETEXTUPSIDEDOWN : nResId = SIP_SA_MEASURETEXTUPSIDEDOWN;break;
+ case SDRATTR_MEASUREOVERHANG : nResId = SIP_SA_MEASUREOVERHANG;break;
+ case SDRATTR_MEASUREUNIT : nResId = SIP_SA_MEASUREUNIT;break;
+ case SDRATTR_MEASURESCALE : nResId = SIP_SA_MEASURESCALE;break;
+ case SDRATTR_MEASURESHOWUNIT : nResId = SIP_SA_MEASURESHOWUNIT;break;
+ case SDRATTR_MEASUREFORMATSTRING : nResId = SIP_SA_MEASUREFORMATSTRING;break;
+ case SDRATTR_MEASURETEXTAUTOANGLE : nResId = SIP_SA_MEASURETEXTAUTOANGLE;break;
+ case SDRATTR_MEASURETEXTAUTOANGLEVIEW: nResId = SIP_SA_MEASURETEXTAUTOANGLEVIEW;break;
+ case SDRATTR_MEASURETEXTISFIXEDANGLE : nResId = SIP_SA_MEASURETEXTISFIXEDANGLE;break;
+ case SDRATTR_MEASURETEXTFIXEDANGLE : nResId = SIP_SA_MEASURETEXTFIXEDANGLE;break;
+ case SDRATTR_MEASUREDECIMALPLACES : nResId = SIP_SA_MEASUREDECIMALPLACES;break;
+
+ case SDRATTR_CIRCKIND : nResId = SIP_SA_CIRCKIND;break;
+ case SDRATTR_CIRCSTARTANGLE: nResId = SIP_SA_CIRCSTARTANGLE;break;
+ case SDRATTR_CIRCENDANGLE : nResId = SIP_SA_CIRCENDANGLE;break;
+
+ case SDRATTR_OBJMOVEPROTECT : nResId = SIP_SA_OBJMOVEPROTECT;break;
+ case SDRATTR_OBJSIZEPROTECT : nResId = SIP_SA_OBJSIZEPROTECT;break;
+ case SDRATTR_OBJPRINTABLE : nResId = SIP_SA_OBJPRINTABLE;break;
+ case SDRATTR_OBJVISIBLE : nResId = SIP_SA_OBJVISIBLE;break;
+ case SDRATTR_LAYERID : nResId = SIP_SA_LAYERID;break;
+ case SDRATTR_LAYERNAME : nResId = SIP_SA_LAYERNAME;break;
+ case SDRATTR_OBJECTNAME : nResId = SIP_SA_OBJECTNAME;break;
+ case SDRATTR_ALLPOSITIONX : nResId = SIP_SA_ALLPOSITIONX;break;
+ case SDRATTR_ALLPOSITIONY : nResId = SIP_SA_ALLPOSITIONY;break;
+ case SDRATTR_ALLSIZEWIDTH : nResId = SIP_SA_ALLSIZEWIDTH;break;
+ case SDRATTR_ALLSIZEHEIGHT : nResId = SIP_SA_ALLSIZEHEIGHT;break;
+ case SDRATTR_ONEPOSITIONX : nResId = SIP_SA_ONEPOSITIONX;break;
+ case SDRATTR_ONEPOSITIONY : nResId = SIP_SA_ONEPOSITIONY;break;
+ case SDRATTR_ONESIZEWIDTH : nResId = SIP_SA_ONESIZEWIDTH;break;
+ case SDRATTR_ONESIZEHEIGHT : nResId = SIP_SA_ONESIZEHEIGHT;break;
+ case SDRATTR_LOGICSIZEWIDTH : nResId = SIP_SA_LOGICSIZEWIDTH;break;
+ case SDRATTR_LOGICSIZEHEIGHT: nResId = SIP_SA_LOGICSIZEHEIGHT;break;
+ case SDRATTR_ROTATEANGLE : nResId = SIP_SA_ROTATEANGLE;break;
+ case SDRATTR_SHEARANGLE : nResId = SIP_SA_SHEARANGLE;break;
+ case SDRATTR_MOVEX : nResId = SIP_SA_MOVEX;break;
+ case SDRATTR_MOVEY : nResId = SIP_SA_MOVEY;break;
+ case SDRATTR_RESIZEXONE : nResId = SIP_SA_RESIZEXONE;break;
+ case SDRATTR_RESIZEYONE : nResId = SIP_SA_RESIZEYONE;break;
+ case SDRATTR_ROTATEONE : nResId = SIP_SA_ROTATEONE;break;
+ case SDRATTR_HORZSHEARONE : nResId = SIP_SA_HORZSHEARONE;break;
+ case SDRATTR_VERTSHEARONE : nResId = SIP_SA_VERTSHEARONE;break;
+ case SDRATTR_RESIZEXALL : nResId = SIP_SA_RESIZEXALL;break;
+ case SDRATTR_RESIZEYALL : nResId = SIP_SA_RESIZEYALL;break;
+ case SDRATTR_ROTATEALL : nResId = SIP_SA_ROTATEALL;break;
+ case SDRATTR_HORZSHEARALL : nResId = SIP_SA_HORZSHEARALL;break;
+ case SDRATTR_VERTSHEARALL : nResId = SIP_SA_VERTSHEARALL;break;
+ case SDRATTR_TRANSFORMREF1X : nResId = SIP_SA_TRANSFORMREF1X;break;
+ case SDRATTR_TRANSFORMREF1Y : nResId = SIP_SA_TRANSFORMREF1Y;break;
+ case SDRATTR_TRANSFORMREF2X : nResId = SIP_SA_TRANSFORMREF2X;break;
+ case SDRATTR_TRANSFORMREF2Y : nResId = SIP_SA_TRANSFORMREF2Y;break;
+
+ case SDRATTR_GRAFRED : nResId = SIP_SA_GRAFRED;break;
+ case SDRATTR_GRAFGREEN : nResId = SIP_SA_GRAFGREEN;break;
+ case SDRATTR_GRAFBLUE : nResId = SIP_SA_GRAFBLUE;break;
+ case SDRATTR_GRAFLUMINANCE : nResId = SIP_SA_GRAFLUMINANCE;break;
+ case SDRATTR_GRAFCONTRAST : nResId = SIP_SA_GRAFCONTRAST;break;
+ case SDRATTR_GRAFGAMMA : nResId = SIP_SA_GRAFGAMMA;break;
+ case SDRATTR_GRAFTRANSPARENCE : nResId = SIP_SA_GRAFTRANSPARENCE;break;
+ case SDRATTR_GRAFINVERT : nResId = SIP_SA_GRAFINVERT;break;
+ case SDRATTR_GRAFMODE : nResId = SIP_SA_GRAFMODE;break;
+ case SDRATTR_GRAFCROP : nResId = SIP_SA_GRAFCROP;break;
+
+ case EE_PARA_HYPHENATE : nResId = SIP_EE_PARA_HYPHENATE;break;
+ case EE_PARA_BULLETSTATE: nResId = SIP_EE_PARA_BULLETSTATE;break;
+ case EE_PARA_OUTLLRSPACE: nResId = SIP_EE_PARA_OUTLLRSPACE;break;
+ case EE_PARA_OUTLLEVEL : nResId = SIP_EE_PARA_OUTLLEVEL;break;
+ case EE_PARA_BULLET : nResId = SIP_EE_PARA_BULLET;break;
+ case EE_PARA_LRSPACE : nResId = SIP_EE_PARA_LRSPACE;break;
+ case EE_PARA_ULSPACE : nResId = SIP_EE_PARA_ULSPACE;break;
+ case EE_PARA_SBL : nResId = SIP_EE_PARA_SBL;break;
+ case EE_PARA_JUST : nResId = SIP_EE_PARA_JUST;break;
+ case EE_PARA_TABS : nResId = SIP_EE_PARA_TABS;break;
+
+ case EE_CHAR_COLOR : nResId = SIP_EE_CHAR_COLOR;break;
+ case EE_CHAR_FONTINFO : nResId = SIP_EE_CHAR_FONTINFO;break;
+ case EE_CHAR_FONTHEIGHT : nResId = SIP_EE_CHAR_FONTHEIGHT;break;
+ case EE_CHAR_FONTWIDTH : nResId = SIP_EE_CHAR_FONTWIDTH;break;
+ case EE_CHAR_WEIGHT : nResId = SIP_EE_CHAR_WEIGHT;break;
+ case EE_CHAR_UNDERLINE : nResId = SIP_EE_CHAR_UNDERLINE;break;
+ case EE_CHAR_OVERLINE : nResId = SIP_EE_CHAR_OVERLINE;break;
+ case EE_CHAR_STRIKEOUT : nResId = SIP_EE_CHAR_STRIKEOUT;break;
+ case EE_CHAR_ITALIC : nResId = SIP_EE_CHAR_ITALIC;break;
+ case EE_CHAR_OUTLINE : nResId = SIP_EE_CHAR_OUTLINE;break;
+ case EE_CHAR_SHADOW : nResId = SIP_EE_CHAR_SHADOW;break;
+ case EE_CHAR_ESCAPEMENT : nResId = SIP_EE_CHAR_ESCAPEMENT;break;
+ case EE_CHAR_PAIRKERNING: nResId = SIP_EE_CHAR_PAIRKERNING;break;
+ case EE_CHAR_KERNING : nResId = SIP_EE_CHAR_KERNING;break;
+ case EE_CHAR_WLM : nResId = SIP_EE_CHAR_WLM;break;
+ case EE_FEATURE_TAB : nResId = SIP_EE_FEATURE_TAB;break;
+ case EE_FEATURE_LINEBR : nResId = SIP_EE_FEATURE_LINEBR;break;
+ case EE_FEATURE_NOTCONV : nResId = SIP_EE_FEATURE_NOTCONV;break;
+ case EE_FEATURE_FIELD : nResId = SIP_EE_FEATURE_FIELD;break;
+ } // switch
+
+ rItemName = String( ResId( nResId, *pResMgr ) );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// FractionItem
+////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1_AUTOFACTORY(SdrFractionItem,SfxPoolItem);
+
+SdrFractionItem::SdrFractionItem(sal_uInt16 nId, SvStream& rIn):
+ SfxPoolItem(nId)
+{
+ sal_Int32 nMul,nDiv;
+ rIn>>nMul;
+ rIn>>nDiv;
+ nValue=Fraction(nMul,nDiv);
+}
+
+int __EXPORT SdrFractionItem::operator==(const SfxPoolItem& rCmp) const
+{
+ return SfxPoolItem::operator==(rCmp) &&
+ ((SdrFractionItem&)rCmp).GetValue()==nValue;
+}
+
+SfxItemPresentation __EXPORT SdrFractionItem::GetPresentation(
+ SfxItemPresentation ePresentation, SfxMapUnit /*eCoreMetric*/,
+ SfxMapUnit /*ePresentationMetric*/, XubString &rText, const IntlWrapper *) const
+{
+ if(nValue.IsValid())
+ {
+ sal_Int32 nDiv = nValue.GetDenominator();
+ rText = UniString::CreateFromInt32(nValue.GetNumerator());
+
+ if(nDiv != 1)
+ {
+ rText += sal_Unicode('/');
+ rText += UniString::CreateFromInt32(nDiv);
+ }
+ }
+ else
+ {
+ rText = UniString();
+ rText += sal_Unicode('?');
+ }
+
+ if(ePresentation == SFX_ITEM_PRESENTATION_COMPLETE)
+ {
+ XubString aStr;
+
+ SdrItemPool::TakeItemName(Which(), aStr);
+ aStr += sal_Unicode(' ');
+ rText.Insert(aStr, 0);
+ }
+
+ return ePresentation;
+}
+
+SfxPoolItem* __EXPORT SdrFractionItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new SdrFractionItem(Which(),rIn);
+}
+
+SvStream& __EXPORT SdrFractionItem::Store(SvStream& rOut, sal_uInt16 /*nItemVers*/) const
+{
+ rOut<<sal_Int32(nValue.GetNumerator());
+ rOut<<sal_Int32(nValue.GetDenominator());
+ return rOut;
+}
+
+SfxPoolItem* __EXPORT SdrFractionItem::Clone(SfxItemPool * /*pPool*/) const
+{
+ return new SdrFractionItem(Which(),GetValue());
+}
+
+#ifdef SDR_ISPOOLABLE
+int __EXPORT SdrFractionItem::IsPoolable() const
+{
+ sal_uInt16 nId=Which();
+ return nId<SDRATTR_NOTPERSIST_FIRST || nId>SDRATTR_NOTPERSIST_LAST;
+}
+#endif
+
+////////////////////////////////////////////////////////////////////////////////
+// ScaleItem
+////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1_AUTOFACTORY(SdrScaleItem,SdrFractionItem);
+
+SfxItemPresentation __EXPORT SdrScaleItem::GetPresentation(
+ SfxItemPresentation ePresentation, SfxMapUnit /*eCoreMetric*/,
+ SfxMapUnit /*ePresentationMetric*/, XubString &rText, const IntlWrapper *) const
+{
+ if(GetValue().IsValid())
+ {
+ sal_Int32 nDiv = GetValue().GetDenominator();
+
+ rText = UniString::CreateFromInt32(GetValue().GetNumerator());
+ rText += sal_Unicode(':');
+ rText += UniString::CreateFromInt32(nDiv);
+ }
+ else
+ {
+ rText = UniString();
+ rText += sal_Unicode('?');
+ }
+
+ if(ePresentation == SFX_ITEM_PRESENTATION_COMPLETE)
+ {
+ XubString aStr;
+
+ SdrItemPool::TakeItemName(Which(), aStr);
+ aStr += sal_Unicode(' ');
+ rText.Insert(aStr, 0);
+ }
+
+ return ePresentation;
+}
+
+SfxPoolItem* __EXPORT SdrScaleItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new SdrScaleItem(Which(),rIn);
+}
+
+SfxPoolItem* __EXPORT SdrScaleItem::Clone(SfxItemPool * /*pPool*/) const
+{
+ return new SdrScaleItem(Which(),GetValue());
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// OnOffItem
+////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1_AUTOFACTORY(SdrOnOffItem,SfxBoolItem);
+
+SfxPoolItem* __EXPORT SdrOnOffItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new SdrOnOffItem(Which(),GetValue());
+}
+
+SfxPoolItem* __EXPORT SdrOnOffItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new SdrOnOffItem(Which(),rIn);
+}
+
+XubString __EXPORT SdrOnOffItem::GetValueTextByVal(sal_Bool bVal) const
+{
+ if (bVal) return ImpGetResStr(STR_ItemValON);
+ else return ImpGetResStr(STR_ItemValOFF);
+}
+
+SfxItemPresentation __EXPORT SdrOnOffItem::GetPresentation(SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, XubString& rText, const IntlWrapper *) const
+{
+ rText=GetValueTextByVal(GetValue());
+ if (ePres==SFX_ITEM_PRESENTATION_COMPLETE) {
+ String aStr;
+
+ SdrItemPool::TakeItemName(Which(), aStr);
+ aStr += sal_Unicode(' ');
+ rText.Insert(aStr, 0);
+ }
+ return ePres;
+}
+
+#ifdef SDR_ISPOOLABLE
+int __EXPORT SdrOnOffItem::IsPoolable() const
+{
+ sal_uInt16 nId=Which();
+ return nId<SDRATTR_NOTPERSIST_FIRST || nId>SDRATTR_NOTPERSIST_LAST;
+}
+#endif
+
+TYPEINIT1_AUTOFACTORY(SdrYesNoItem,SfxBoolItem);
+
+SfxPoolItem* __EXPORT SdrYesNoItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new SdrYesNoItem(Which(),GetValue());
+}
+
+SfxPoolItem* __EXPORT SdrYesNoItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new SdrYesNoItem(Which(),rIn);
+}
+
+XubString __EXPORT SdrYesNoItem::GetValueTextByVal(sal_Bool bVal) const
+{
+ if (bVal) return ImpGetResStr(STR_ItemValYES);
+ else return ImpGetResStr(STR_ItemValNO);
+}
+
+SfxItemPresentation __EXPORT SdrYesNoItem::GetPresentation(SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, XubString& rText, const IntlWrapper *) const
+{
+ rText=GetValueTextByVal(GetValue());
+ if (ePres==SFX_ITEM_PRESENTATION_COMPLETE) {
+ String aStr;
+
+ SdrItemPool::TakeItemName(Which(), aStr);
+ aStr += sal_Unicode(' ');
+ rText.Insert(aStr, 0);
+ }
+ return ePres;
+}
+
+#ifdef SDR_ISPOOLABLE
+int __EXPORT SdrYesNoItem::IsPoolable() const
+{
+ sal_uInt16 nId=Which();
+ return nId<SDRATTR_NOTPERSIST_FIRST || nId>SDRATTR_NOTPERSIST_LAST;
+}
+#endif
+
+//------------------------------------------------------------
+// class SdrPercentItem
+//------------------------------------------------------------
+
+TYPEINIT1_AUTOFACTORY(SdrPercentItem,SfxUInt16Item);
+
+SfxPoolItem* __EXPORT SdrPercentItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new SdrPercentItem(Which(),GetValue());
+}
+
+SfxPoolItem* __EXPORT SdrPercentItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new SdrPercentItem(Which(),rIn);
+}
+
+SfxItemPresentation __EXPORT SdrPercentItem::GetPresentation(
+ SfxItemPresentation ePres, SfxMapUnit /*eCoreMetric*/,
+ SfxMapUnit /*ePresMetric*/, XubString& rText, const IntlWrapper *) const
+{
+ rText = UniString::CreateFromInt32(GetValue());
+ rText += sal_Unicode('%');
+
+ if(ePres == SFX_ITEM_PRESENTATION_COMPLETE)
+ {
+ XubString aStr;
+
+ SdrItemPool::TakeItemName(Which(), aStr);
+ aStr += sal_Unicode(' ');
+ rText.Insert(aStr, 0);
+ }
+
+ return ePres;
+}
+
+#ifdef SDR_ISPOOLABLE
+int __EXPORT SdrPercentItem::IsPoolable() const
+{
+ sal_uInt16 nId=Which();
+ return nId<SDRATTR_NOTPERSIST_FIRST || nId>SDRATTR_NOTPERSIST_LAST;
+}
+#endif
+
+//------------------------------------------------------------
+// class SdrAngleItem
+//------------------------------------------------------------
+
+TYPEINIT1_AUTOFACTORY(SdrAngleItem,SfxInt32Item);
+
+SfxPoolItem* __EXPORT SdrAngleItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new SdrAngleItem(Which(),GetValue());
+}
+
+SfxPoolItem* __EXPORT SdrAngleItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new SdrAngleItem(Which(),rIn);
+}
+
+SfxItemPresentation __EXPORT SdrAngleItem::GetPresentation(
+ SfxItemPresentation ePres, SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/,
+ XubString& rText, const IntlWrapper * pIntlWrapper) const
+{
+ sal_Int32 nValue(GetValue());
+ sal_Bool bNeg(nValue < 0);
+
+ if(bNeg)
+ nValue = -nValue;
+
+ rText = UniString::CreateFromInt32(nValue);
+
+ if(nValue)
+ {
+ sal_Unicode aUnicodeNull('0');
+ xub_StrLen nAnz(2);
+
+ const IntlWrapper* pMyIntlWrapper = NULL;
+// DBG_ASSERT( pIntlWrapper, "SdrAngleItem::GetPresentation: using default App-IntlWrapper" );
+ if(!pIntlWrapper)
+ pIntlWrapper = pMyIntlWrapper = new IntlWrapper(
+ ::comphelper::getProcessServiceFactory(),
+ Application::GetSettings().GetLanguage() );
+
+ if(pIntlWrapper->getLocaleData()->isNumLeadingZero())
+ nAnz++;
+
+ while(rText.Len() < nAnz)
+ rText.Insert(aUnicodeNull, 0);
+
+ xub_StrLen nLen = rText.Len();
+ sal_Bool bNull1(rText.GetChar(nLen-1) == aUnicodeNull);
+ sal_Bool bNull2(bNull1 && rText.GetChar(nLen-2) == aUnicodeNull);
+
+ if(bNull2)
+ {
+ // keine Nachkommastellen
+ rText.Erase(nLen-2);
+ }
+ else
+ {
+ sal_Unicode cDec =
+ pIntlWrapper->getLocaleData()->getNumDecimalSep().GetChar(0);
+ rText.Insert(cDec, nLen-2);
+
+ if(bNull1)
+ rText.Erase(nLen);
+ }
+
+ if(bNeg)
+ rText.Insert(sal_Unicode('-'), 0);
+
+ if ( pMyIntlWrapper )
+ {
+ delete pMyIntlWrapper;
+ pIntlWrapper = NULL;
+ }
+ }
+
+ rText += sal_Unicode(DEGREE_CHAR);
+
+ if(ePres == SFX_ITEM_PRESENTATION_COMPLETE)
+ {
+ XubString aStr;
+
+ SdrItemPool::TakeItemName(Which(), aStr);
+ aStr += sal_Unicode(' ');
+ rText.Insert(aStr, 0);
+ }
+
+ return ePres;
+}
+
+#ifdef SDR_ISPOOLABLE
+int __EXPORT SdrAngleItem::IsPoolable() const
+{
+ sal_uInt16 nId=Which();
+ return nId<SDRATTR_NOTPERSIST_FIRST || nId>SDRATTR_NOTPERSIST_LAST;
+}
+#endif
+
+//------------------------------------------------------------
+// class SdrMetricItem
+//------------------------------------------------------------
+
+TYPEINIT1_AUTOFACTORY(SdrMetricItem,SfxInt32Item);
+
+SfxPoolItem* __EXPORT SdrMetricItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new SdrMetricItem(Which(),GetValue());
+}
+
+SfxPoolItem* __EXPORT SdrMetricItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new SdrMetricItem(Which(),rIn);
+}
+
+FASTBOOL __EXPORT SdrMetricItem::HasMetrics() const
+{
+ return sal_True;
+}
+
+FASTBOOL __EXPORT SdrMetricItem::ScaleMetrics(long nMul, long nDiv)
+{
+ if (GetValue()!=0) {
+ BigInt aVal(GetValue());
+ aVal*=nMul;
+ aVal+=nDiv/2; // fuer korrektes Runden
+ aVal/=nDiv;
+ SetValue(long(aVal));
+ }
+ return sal_True;
+}
+
+SfxItemPresentation __EXPORT SdrMetricItem::GetPresentation(SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, XubString& rText, const IntlWrapper *) const
+{
+ long nValue=GetValue();
+ SdrFormatter aFmt((MapUnit)eCoreMetric,(MapUnit)ePresMetric);
+ aFmt.TakeStr(nValue,rText);
+ String aStr;
+ aFmt.TakeUnitStr((MapUnit)ePresMetric,aStr);
+ rText+=aStr;
+ if (ePres==SFX_ITEM_PRESENTATION_COMPLETE) {
+ String aStr2;
+
+ SdrItemPool::TakeItemName(Which(), aStr2);
+ aStr2 += sal_Unicode(' ');
+ rText.Insert(aStr2, 0);
+ }
+ return ePres;
+}
+
+#ifdef SDR_ISPOOLABLE
+int __EXPORT SdrMetricItem::IsPoolable() const
+{
+ sal_uInt16 nId=Which();
+ return nId<SDRATTR_NOTPERSIST_FIRST || nId>SDRATTR_NOTPERSIST_LAST;
+}
+#endif
+
+////////////////////////////////////////////////////////////////////////////////
+// Items des Legendenobjekts
+////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1_AUTOFACTORY(SdrCaptionTypeItem,SfxEnumItem);
+
+SfxPoolItem* __EXPORT SdrCaptionTypeItem::Clone(SfxItemPool* /*pPool*/) const { return new SdrCaptionTypeItem(*this); }
+
+SfxPoolItem* __EXPORT SdrCaptionTypeItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const { return new SdrCaptionTypeItem(rIn); }
+
+sal_uInt16 __EXPORT SdrCaptionTypeItem::GetValueCount() const { return 4; }
+
+XubString __EXPORT SdrCaptionTypeItem::GetValueTextByPos(sal_uInt16 nPos) const
+{
+ return ImpGetResStr(STR_ItemValCAPTIONTYPE1+nPos);
+}
+
+SfxItemPresentation __EXPORT SdrCaptionTypeItem::GetPresentation(SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, XubString& rText, const IntlWrapper *) const
+{
+ rText=GetValueTextByPos(sal::static_int_cast< sal_uInt16 >(GetValue()));
+ if (ePres==SFX_ITEM_PRESENTATION_COMPLETE) {
+ String aStr;
+
+ SdrItemPool::TakeItemName(Which(), aStr);
+ aStr += sal_Unicode(' ');
+ rText.Insert(aStr, 0);
+ }
+ return ePres;
+}
+
+TYPEINIT1_AUTOFACTORY(SdrCaptionEscDirItem,SfxEnumItem);
+
+SfxPoolItem* __EXPORT SdrCaptionEscDirItem::Clone(SfxItemPool* /*pPool*/) const { return new SdrCaptionEscDirItem(*this); }
+
+SfxPoolItem* __EXPORT SdrCaptionEscDirItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const { return new SdrCaptionEscDirItem(rIn); }
+
+sal_uInt16 __EXPORT SdrCaptionEscDirItem::GetValueCount() const { return 3; }
+
+XubString __EXPORT SdrCaptionEscDirItem::GetValueTextByPos(sal_uInt16 nPos) const
+{
+ return ImpGetResStr(STR_ItemValCAPTIONESCHORI+nPos);
+}
+
+SfxItemPresentation __EXPORT SdrCaptionEscDirItem::GetPresentation(SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, XubString& rText, const IntlWrapper *) const
+{
+ rText=GetValueTextByPos(sal::static_int_cast< sal_uInt16 >(GetValue()));
+ if (ePres==SFX_ITEM_PRESENTATION_COMPLETE) {
+ String aStr;
+
+ SdrItemPool::TakeItemName(Which(), aStr);
+ aStr += sal_Unicode(' ');
+ rText.Insert(aStr, 0);
+ }
+ return ePres;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// MiscItems
+////////////////////////////////////////////////////////////////////////////////
+
+// FitToSize
+TYPEINIT1_AUTOFACTORY(SdrTextFitToSizeTypeItem,SfxEnumItem);
+
+SfxPoolItem* __EXPORT SdrTextFitToSizeTypeItem::Clone(SfxItemPool* /*pPool*/) const { return new SdrTextFitToSizeTypeItem(*this); }
+
+SfxPoolItem* __EXPORT SdrTextFitToSizeTypeItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const { return new SdrTextFitToSizeTypeItem(rIn); }
+
+sal_uInt16 __EXPORT SdrTextFitToSizeTypeItem::GetValueCount() const { return 4; }
+
+XubString __EXPORT SdrTextFitToSizeTypeItem::GetValueTextByPos(sal_uInt16 nPos) const
+{
+ return ImpGetResStr(STR_ItemValFITTOSIZENONE+nPos);
+}
+
+SfxItemPresentation __EXPORT SdrTextFitToSizeTypeItem::GetPresentation(SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, XubString& rText, const IntlWrapper *) const
+{
+ rText=GetValueTextByPos(sal::static_int_cast< sal_uInt16 >(GetValue()));
+ if (ePres==SFX_ITEM_PRESENTATION_COMPLETE) {
+ String aStr;
+
+ SdrItemPool::TakeItemName(Which(), aStr);
+ aStr += sal_Unicode(' ');
+ rText.Insert(aStr, 0);
+ }
+ return ePres;
+}
+
+int __EXPORT SdrTextFitToSizeTypeItem::HasBoolValue() const { return sal_True; }
+
+sal_Bool __EXPORT SdrTextFitToSizeTypeItem::GetBoolValue() const { return GetValue()!=SDRTEXTFIT_NONE; }
+
+void __EXPORT SdrTextFitToSizeTypeItem::SetBoolValue(sal_Bool bVal) { SetValue(sal::static_int_cast< sal_uInt16 >(bVal ? SDRTEXTFIT_PROPORTIONAL : SDRTEXTFIT_NONE)); }
+
+sal_Bool SdrTextFitToSizeTypeItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ drawing::TextFitToSizeType eFS = (drawing::TextFitToSizeType)GetValue();
+ rVal <<= eFS;
+
+ return sal_True;
+}
+
+sal_Bool SdrTextFitToSizeTypeItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ drawing::TextFitToSizeType eFS;
+ if(!(rVal >>= eFS))
+ {
+ sal_Int32 nEnum = 0;
+ if(!(rVal >>= nEnum))
+ return sal_False;
+
+ eFS = (drawing::TextFitToSizeType) nEnum;
+ }
+
+ SetValue( sal::static_int_cast< sal_uInt16 >( (SdrFitToSizeType)eFS ) );
+
+ return sal_True;
+}
+
+TYPEINIT1_AUTOFACTORY(SdrTextVertAdjustItem,SfxEnumItem);
+
+SfxPoolItem* __EXPORT SdrTextVertAdjustItem::Clone(SfxItemPool* /*pPool*/) const { return new SdrTextVertAdjustItem(*this); }
+
+SfxPoolItem* __EXPORT SdrTextVertAdjustItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const { return new SdrTextVertAdjustItem(rIn); }
+
+sal_uInt16 __EXPORT SdrTextVertAdjustItem::GetValueCount() const { return 5; }
+
+XubString __EXPORT SdrTextVertAdjustItem::GetValueTextByPos(sal_uInt16 nPos) const
+{
+ return ImpGetResStr(STR_ItemValTEXTVADJTOP+nPos);
+}
+
+SfxItemPresentation __EXPORT SdrTextVertAdjustItem::GetPresentation(SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, XubString& rText, const IntlWrapper *) const
+{
+ rText=GetValueTextByPos(sal::static_int_cast< sal_uInt16 >(GetValue()));
+ if (ePres==SFX_ITEM_PRESENTATION_COMPLETE) {
+ String aStr;
+
+ SdrItemPool::TakeItemName(Which(), aStr);
+ aStr += sal_Unicode(' ');
+ rText.Insert(aStr, 0);
+ }
+ return ePres;
+}
+
+sal_Bool SdrTextVertAdjustItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (drawing::TextVerticalAdjust)GetValue();
+ return sal_True;
+}
+
+sal_Bool SdrTextVertAdjustItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ drawing::TextVerticalAdjust eAdj;
+ if(!(rVal >>= eAdj))
+ {
+ sal_Int32 nEnum = 0;
+ if(!(rVal >>= nEnum))
+ return sal_False;
+
+ eAdj = (drawing::TextVerticalAdjust)nEnum;
+ }
+
+ SetValue( sal::static_int_cast< sal_uInt16 >( (SdrTextVertAdjust)eAdj ) );
+
+ return sal_True;
+}
+
+TYPEINIT1_AUTOFACTORY(SdrTextHorzAdjustItem,SfxEnumItem);
+
+SfxPoolItem* __EXPORT SdrTextHorzAdjustItem::Clone(SfxItemPool* /*pPool*/) const { return new SdrTextHorzAdjustItem(*this); }
+
+SfxPoolItem* __EXPORT SdrTextHorzAdjustItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const { return new SdrTextHorzAdjustItem(rIn); }
+
+sal_uInt16 __EXPORT SdrTextHorzAdjustItem::GetValueCount() const { return 5; }
+
+XubString __EXPORT SdrTextHorzAdjustItem::GetValueTextByPos(sal_uInt16 nPos) const
+{
+ return ImpGetResStr(STR_ItemValTEXTHADJLEFT+nPos);
+}
+
+SfxItemPresentation __EXPORT SdrTextHorzAdjustItem::GetPresentation(SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, XubString& rText, const IntlWrapper *) const
+{
+ rText=GetValueTextByPos(sal::static_int_cast< sal_uInt16 >(GetValue()));
+ if (ePres==SFX_ITEM_PRESENTATION_COMPLETE) {
+ String aStr;
+
+ SdrItemPool::TakeItemName(Which(), aStr);
+ aStr += sal_Unicode(' ');
+ rText.Insert(aStr, 0);
+ }
+ return ePres;
+}
+
+sal_Bool SdrTextHorzAdjustItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (drawing::TextHorizontalAdjust)GetValue();
+ return sal_True;
+}
+
+sal_Bool SdrTextHorzAdjustItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ drawing::TextHorizontalAdjust eAdj;
+ if(!(rVal >>= eAdj))
+ {
+ sal_Int32 nEnum = 0;
+ if(!(rVal >>= nEnum))
+ return sal_False;
+
+ eAdj = (drawing::TextHorizontalAdjust)nEnum;
+ }
+
+ SetValue( sal::static_int_cast< sal_uInt16 >( (SdrTextHorzAdjust)eAdj ) );
+
+ return sal_True;
+}
+
+TYPEINIT1_AUTOFACTORY(SdrTextAniKindItem,SfxEnumItem);
+
+SfxPoolItem* __EXPORT SdrTextAniKindItem::Clone(SfxItemPool* /*pPool*/) const { return new SdrTextAniKindItem(*this); }
+
+SfxPoolItem* __EXPORT SdrTextAniKindItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const { return new SdrTextAniKindItem(rIn); }
+
+sal_uInt16 __EXPORT SdrTextAniKindItem::GetValueCount() const { return 5; }
+
+XubString __EXPORT SdrTextAniKindItem::GetValueTextByPos(sal_uInt16 nPos) const
+{
+ return ImpGetResStr(STR_ItemValTEXTANI_NONE+nPos);
+}
+
+SfxItemPresentation __EXPORT SdrTextAniKindItem::GetPresentation(SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, XubString& rText, const IntlWrapper *) const
+{
+ rText=GetValueTextByPos(sal::static_int_cast< sal_uInt16 >(GetValue()));
+ if (ePres==SFX_ITEM_PRESENTATION_COMPLETE) {
+ String aStr;
+
+ SdrItemPool::TakeItemName(Which(), aStr);
+ aStr += sal_Unicode(' ');
+ rText.Insert(aStr, 0);
+ }
+ return ePres;
+}
+
+sal_Bool SdrTextAniKindItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (drawing::TextAnimationKind)GetValue();
+ return sal_True;
+}
+
+sal_Bool SdrTextAniKindItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ drawing::TextAnimationKind eKind;
+ if(!(rVal >>= eKind))
+ {
+ sal_Int32 nEnum = 0;
+ if(!(rVal >>= nEnum))
+ return sal_False;
+ eKind = (drawing::TextAnimationKind)nEnum;
+ }
+
+ SetValue( sal::static_int_cast< sal_uInt16 >( (SdrTextAniKind)eKind ) );
+
+ return sal_True;
+}
+
+TYPEINIT1_AUTOFACTORY(SdrTextAniDirectionItem,SfxEnumItem);
+
+SfxPoolItem* __EXPORT SdrTextAniDirectionItem::Clone(SfxItemPool* /*pPool*/) const { return new SdrTextAniDirectionItem(*this); }
+
+SfxPoolItem* __EXPORT SdrTextAniDirectionItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const { return new SdrTextAniDirectionItem(rIn); }
+
+sal_uInt16 __EXPORT SdrTextAniDirectionItem::GetValueCount() const { return 4; }
+
+XubString __EXPORT SdrTextAniDirectionItem::GetValueTextByPos(sal_uInt16 nPos) const
+{
+ return ImpGetResStr(STR_ItemValTEXTANI_LEFT+nPos);
+}
+
+SfxItemPresentation __EXPORT SdrTextAniDirectionItem::GetPresentation(SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, XubString& rText, const IntlWrapper *) const
+{
+ rText=GetValueTextByPos(sal::static_int_cast< sal_uInt16 >(GetValue()));
+ if (ePres==SFX_ITEM_PRESENTATION_COMPLETE) {
+ String aStr;
+
+ SdrItemPool::TakeItemName(Which(), aStr);
+ aStr += sal_Unicode(' ');
+ rText.Insert(aStr, 0);
+ }
+ return ePres;
+}
+
+sal_Bool SdrTextAniDirectionItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (drawing::TextAnimationDirection)GetValue();
+ return sal_True;
+}
+
+sal_Bool SdrTextAniDirectionItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ drawing::TextAnimationDirection eDir;
+ if(!(rVal >>= eDir))
+ {
+ sal_Int32 nEnum = 0;
+ if(!(rVal >>= nEnum))
+ return sal_False;
+
+ eDir = (drawing::TextAnimationDirection)nEnum;
+ }
+
+ SetValue( sal::static_int_cast< sal_uInt16 >( (SdrTextAniDirection)eDir ) );
+
+ return sal_True;
+}
+
+TYPEINIT1_AUTOFACTORY(SdrTextAniDelayItem,SfxUInt16Item);
+
+SfxPoolItem* __EXPORT SdrTextAniDelayItem::Clone(SfxItemPool* /*pPool*/) const { return new SdrTextAniDelayItem(*this); }
+
+SfxPoolItem* __EXPORT SdrTextAniDelayItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const { return new SdrTextAniDelayItem(rIn); }
+
+SfxItemPresentation __EXPORT SdrTextAniDelayItem::GetPresentation(
+ SfxItemPresentation ePres, SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/,
+ XubString& rText, const IntlWrapper *) const
+{
+ rText = UniString::CreateFromInt32(GetValue());
+ rText += sal_Unicode('m');
+ rText += sal_Unicode('s');
+
+ if(ePres == SFX_ITEM_PRESENTATION_COMPLETE)
+ {
+ XubString aStr;
+
+ SdrItemPool::TakeItemName(Which(), aStr);
+ aStr += sal_Unicode(' ');
+ rText.Insert(aStr, 0);
+ }
+
+ return ePres;
+}
+
+TYPEINIT1_AUTOFACTORY(SdrTextAniAmountItem,SfxInt16Item);
+
+SfxPoolItem* __EXPORT SdrTextAniAmountItem::Clone(SfxItemPool* /*pPool*/) const { return new SdrTextAniAmountItem(*this); }
+
+SfxPoolItem* __EXPORT SdrTextAniAmountItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const { return new SdrTextAniAmountItem(rIn); }
+
+FASTBOOL __EXPORT SdrTextAniAmountItem::HasMetrics() const
+{
+ return GetValue()>0;
+}
+
+FASTBOOL __EXPORT SdrTextAniAmountItem::ScaleMetrics(long nMul, long nDiv)
+{
+ if (GetValue()>0) {
+ BigInt aVal(GetValue());
+ aVal*=nMul;
+ aVal+=nDiv/2; // fuer korrektes Runden
+ aVal/=nDiv;
+ SetValue(short(aVal));
+ return sal_True;
+ } else return sal_False;
+}
+
+SfxItemPresentation __EXPORT SdrTextAniAmountItem::GetPresentation(
+ SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric,
+ XubString& rText, const IntlWrapper *) const
+{
+ sal_Int32 nValue(GetValue());
+
+ if(!nValue)
+ nValue = -1L;
+
+ if(nValue < 0)
+ {
+ sal_Char aText[] = "pixel";
+
+ rText = UniString::CreateFromInt32(-nValue);
+ rText += UniString(aText, sizeof(aText-1));
+ }
+ else
+ {
+ SdrFormatter aFmt((MapUnit)eCoreMetric, (MapUnit)ePresMetric);
+ XubString aStr;
+
+ aFmt.TakeStr(nValue, rText);
+ aFmt.TakeUnitStr((MapUnit)ePresMetric, aStr);
+ rText += aStr;
+ }
+
+ if(ePres == SFX_ITEM_PRESENTATION_COMPLETE)
+ {
+ XubString aStr;
+
+ SdrItemPool::TakeItemName(Which(), aStr);
+ aStr += sal_Unicode(' ');
+ rText.Insert(aStr, 0);
+ }
+
+ return ePres;
+}
+
+TYPEINIT1_AUTOFACTORY( SdrTextFixedCellHeightItem, SfxBoolItem );
+SdrTextFixedCellHeightItem::SdrTextFixedCellHeightItem( sal_Bool bUseFixedCellHeight )
+ : SfxBoolItem( SDRATTR_TEXT_USEFIXEDCELLHEIGHT, bUseFixedCellHeight )
+{
+}
+SdrTextFixedCellHeightItem::SdrTextFixedCellHeightItem( SvStream & rStream, sal_uInt16 nVersion )
+ : SfxBoolItem( SDRATTR_TEXT_USEFIXEDCELLHEIGHT, sal_False )
+{
+ if ( nVersion )
+ {
+ sal_Bool bValue;
+ rStream >> bValue;
+ SetValue( bValue );
+ }
+}
+SfxItemPresentation __EXPORT SdrTextFixedCellHeightItem::GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresentationMetric*/,
+ String &rText, const IntlWrapper * ) const
+{
+ rText = GetValueTextByVal( GetValue() );
+ if (ePres==SFX_ITEM_PRESENTATION_COMPLETE)
+ {
+ String aStr;
+ SdrItemPool::TakeItemName(Which(), aStr);
+ aStr += sal_Unicode(' ');
+ rText.Insert(aStr, 0);
+ }
+ return ePres;
+}
+SfxPoolItem* __EXPORT SdrTextFixedCellHeightItem::Create( SvStream& rIn, sal_uInt16 nItemVersion ) const
+{
+ return new SdrTextFixedCellHeightItem( rIn, nItemVersion );
+}
+SvStream& __EXPORT SdrTextFixedCellHeightItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
+{
+ if ( nItemVersion )
+ {
+ sal_Bool bValue = (sal_Bool)GetValue();
+ rOut << bValue;
+ }
+ return rOut;
+}
+SfxPoolItem* __EXPORT SdrTextFixedCellHeightItem::Clone( SfxItemPool * /*pPool*/) const
+{
+ return new SdrTextFixedCellHeightItem( GetValue() );
+}
+sal_uInt16 SdrTextFixedCellHeightItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/) const
+{
+ return 1;
+}
+sal_Bool SdrTextFixedCellHeightItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ sal_Bool bValue = (sal_Bool)GetValue();
+ rVal <<= bValue;
+ return sal_True;
+}
+sal_Bool SdrTextFixedCellHeightItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ sal_Bool bValue = sal_Bool();
+ if( !( rVal >>= bValue ) )
+ return sal_False;
+ SetValue( bValue );
+ return sal_True;
+}
+#ifdef SDR_ISPOOLABLE
+int __EXPORT SdrTextFixedCellHeightItem::IsPoolable() const
+{
+ sal_uInt16 nId=Which();
+ return nId < SDRATTR_NOTPERSIST_FIRST || nId > SDRATTR_NOTPERSIST_LAST;
+}
+#endif
+
+TYPEINIT1_AUTOFACTORY( SdrCustomShapeAdjustmentItem, SfxPoolItem );
+
+SdrCustomShapeAdjustmentItem::SdrCustomShapeAdjustmentItem() : SfxPoolItem( SDRATTR_CUSTOMSHAPE_ADJUSTMENT )
+{
+}
+
+SdrCustomShapeAdjustmentItem::SdrCustomShapeAdjustmentItem( SvStream& rIn, sal_uInt16 nVersion ):
+ SfxPoolItem( SDRATTR_CUSTOMSHAPE_ADJUSTMENT )
+{
+ if ( nVersion )
+ {
+ SdrCustomShapeAdjustmentValue aVal;
+ sal_uInt32 i, nCount;
+ rIn >> nCount;
+ for ( i = 0; i < nCount; i++ )
+ {
+ rIn >> aVal.nValue;
+ SetValue( i, aVal );
+ }
+ }
+}
+
+SdrCustomShapeAdjustmentItem::~SdrCustomShapeAdjustmentItem()
+{
+ void* pPtr;
+ for ( pPtr = aAdjustmentValueList.First(); pPtr; pPtr = aAdjustmentValueList.Next() )
+ delete (SdrCustomShapeAdjustmentValue*)pPtr;
+}
+
+int __EXPORT SdrCustomShapeAdjustmentItem::operator==( const SfxPoolItem& rCmp ) const
+{
+ int bRet = SfxPoolItem::operator==( rCmp );
+ if ( bRet )
+ {
+ bRet = ((SdrCustomShapeAdjustmentItem&)rCmp).GetCount() == GetCount();
+ if ( bRet )
+ {
+ sal_uInt32 i;
+ for ( i = 0; i < GetCount(); i++ )
+ {
+ if ( ((SdrCustomShapeAdjustmentItem&)rCmp).GetValue( i ).nValue != GetValue( i ).nValue )
+ {
+ bRet = 0;
+ break;
+ }
+ }
+ }
+ }
+ return bRet;
+}
+
+SfxItemPresentation __EXPORT SdrCustomShapeAdjustmentItem::GetPresentation(
+ SfxItemPresentation ePresentation, SfxMapUnit /*eCoreMetric*/,
+ SfxMapUnit /*ePresentationMetric*/, XubString &rText, const IntlWrapper *) const
+{
+ sal_uInt32 i, nCount = GetCount();
+ rText.Append( UniString::CreateFromInt32( nCount ) );
+ for ( i = 0; i < nCount; i++ )
+ {
+ rText += sal_Unicode( ' ' );
+ rText.Append( UniString::CreateFromInt32( GetValue( i ).nValue ) );
+ }
+ if ( ePresentation == SFX_ITEM_PRESENTATION_COMPLETE )
+ {
+ XubString aStr;
+
+ SdrItemPool::TakeItemName( Which(), aStr );
+ aStr += sal_Unicode( ' ' );
+ rText.Insert( aStr, 0 );
+ }
+ return ePresentation;
+}
+
+SfxPoolItem* __EXPORT SdrCustomShapeAdjustmentItem::Create( SvStream& rIn, sal_uInt16 nItemVersion ) const
+{
+ return new SdrCustomShapeAdjustmentItem( rIn, nItemVersion );
+}
+
+SvStream& __EXPORT SdrCustomShapeAdjustmentItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
+{
+ if ( nItemVersion )
+ {
+ sal_uInt32 i, nCount = GetCount();
+ rOut << nCount;
+ for ( i = 0; i < nCount; i++ )
+ rOut << GetValue( i ).nValue;
+ }
+ return rOut;
+}
+
+SfxPoolItem* __EXPORT SdrCustomShapeAdjustmentItem::Clone( SfxItemPool * /*pPool*/) const
+{
+ sal_uInt32 i;
+ SdrCustomShapeAdjustmentItem* pItem = new SdrCustomShapeAdjustmentItem;
+ for ( i = 0; i < GetCount(); i++ )
+ {
+ const SdrCustomShapeAdjustmentValue& rVal = GetValue( i );
+ pItem->SetValue( i, rVal );
+ }
+ return pItem;
+}
+
+#ifdef SDR_ISPOOLABLE
+int __EXPORT SdrCustomShapeAdjustmentItem::IsPoolable() const
+{
+ sal_uInt16 nId=Which();
+ return nId < SDRATTR_NOTPERSIST_FIRST || nId > SDRATTR_NOTPERSIST_LAST;
+}
+#endif
+
+const SdrCustomShapeAdjustmentValue& SdrCustomShapeAdjustmentItem::GetValue( sal_uInt32 nIndex ) const
+{
+#ifdef DBG_UTIL
+ if ( aAdjustmentValueList.Count() <= nIndex )
+ DBG_ERROR( "SdrCustomShapeAdjustemntItem::GetValue - nIndex out of range (SJ)" );
+#endif
+ return *(SdrCustomShapeAdjustmentValue*)aAdjustmentValueList.GetObject( nIndex );
+}
+
+void SdrCustomShapeAdjustmentItem::SetValue( sal_uInt32 nIndex, const SdrCustomShapeAdjustmentValue& rVal )
+{
+ sal_uInt32 i;
+ for ( i = GetCount(); i <= nIndex; i++ )
+ {
+ SdrCustomShapeAdjustmentValue* pItem = new SdrCustomShapeAdjustmentValue;
+ aAdjustmentValueList.Insert( pItem, LIST_APPEND );
+ }
+ SdrCustomShapeAdjustmentValue& rValue = *(SdrCustomShapeAdjustmentValue*)aAdjustmentValueList.GetObject( nIndex );
+ rValue.nValue = rVal.nValue;
+}
+
+sal_uInt16 SdrCustomShapeAdjustmentItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/) const
+{
+ return 1;
+}
+
+sal_Bool SdrCustomShapeAdjustmentItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ sal_uInt32 i, nCount = GetCount();
+ uno::Sequence< sal_Int32 > aSequence( nCount );
+ if ( nCount )
+ {
+ sal_Int32* pPtr = aSequence.getArray();
+ for ( i = 0; i < nCount; i++ )
+ *pPtr++ = GetValue( i ).nValue;
+ }
+ rVal <<= aSequence;
+ return sal_True;
+}
+
+sal_Bool SdrCustomShapeAdjustmentItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ uno::Sequence< sal_Int32 > aSequence;
+ if( !( rVal >>= aSequence ) )
+ return sal_False;
+
+ void* pPtr;
+ for ( pPtr = aAdjustmentValueList.First(); pPtr; pPtr = aAdjustmentValueList.Next() )
+ delete (SdrCustomShapeAdjustmentValue*)pPtr;
+
+ sal_uInt32 i, nCount = aSequence.getLength();
+ if ( nCount )
+ {
+ const sal_Int32* pPtr2 = aSequence.getConstArray();
+ for ( i = 0; i < nCount; i++ )
+ {
+ SdrCustomShapeAdjustmentValue* pItem = new SdrCustomShapeAdjustmentValue;
+ pItem->nValue = *pPtr2++;
+ aAdjustmentValueList.Insert( pItem, LIST_APPEND );
+ }
+ }
+ return sal_True;
+}
+
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// Edge
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+// EdgeKind
+TYPEINIT1_AUTOFACTORY(SdrEdgeKindItem,SfxEnumItem);
+
+SfxPoolItem* __EXPORT SdrEdgeKindItem::Clone(SfxItemPool* /*pPool*/) const { return new SdrEdgeKindItem(*this); }
+
+SfxPoolItem* __EXPORT SdrEdgeKindItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const { return new SdrEdgeKindItem(rIn); }
+
+sal_uInt16 __EXPORT SdrEdgeKindItem::GetValueCount() const { return 4; }
+
+XubString __EXPORT SdrEdgeKindItem::GetValueTextByPos(sal_uInt16 nPos) const
+{
+ return ImpGetResStr(STR_ItemValEDGE_ORTHOLINES+nPos);
+}
+
+SfxItemPresentation __EXPORT SdrEdgeKindItem::GetPresentation(SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, XubString& rText, const IntlWrapper *) const
+{
+ rText=GetValueTextByPos(sal::static_int_cast< sal_uInt16 >(GetValue()));
+ if (ePres==SFX_ITEM_PRESENTATION_COMPLETE) {
+ String aStr;
+
+ SdrItemPool::TakeItemName(Which(), aStr);
+ aStr += sal_Unicode(' ');
+ rText.Insert(aStr, 0);
+ }
+ return ePres;
+}
+
+sal_Bool SdrEdgeKindItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ drawing::ConnectorType eCT = drawing::ConnectorType_STANDARD;
+
+ switch( GetValue() )
+ {
+ case SDREDGE_ORTHOLINES : eCT = drawing::ConnectorType_STANDARD; break;
+ case SDREDGE_THREELINES : eCT = drawing::ConnectorType_LINES; break;
+ case SDREDGE_ONELINE : eCT = drawing::ConnectorType_LINE; break;
+ case SDREDGE_BEZIER : eCT = drawing::ConnectorType_CURVE; break;
+ case SDREDGE_ARC : eCT = drawing::ConnectorType_CURVE; break;
+ default:
+ DBG_ERROR( "SdrEdgeKindItem::QueryValue : unknown enum" );
+ }
+
+ rVal <<= eCT;
+
+ return sal_True;
+}
+
+sal_Bool SdrEdgeKindItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ drawing::ConnectorType eCT;
+ if(!(rVal >>= eCT))
+ {
+ sal_Int32 nEnum = 0;
+ if(!(rVal >>= nEnum))
+ return sal_False;
+
+ eCT = (drawing::ConnectorType)nEnum;
+ }
+
+ SdrEdgeKind eEK = SDREDGE_ORTHOLINES;
+ switch( eCT )
+ {
+ case drawing::ConnectorType_STANDARD : eEK = SDREDGE_ORTHOLINES; break;
+ case drawing::ConnectorType_CURVE : eEK = SDREDGE_BEZIER; break;
+ case drawing::ConnectorType_LINE : eEK = SDREDGE_ONELINE; break;
+ case drawing::ConnectorType_LINES : eEK = SDREDGE_THREELINES; break;
+ default:
+ DBG_ERROR( "SdrEdgeKindItem::PuValue : unknown enum" );
+ }
+ SetValue( sal::static_int_cast< sal_uInt16 >( eEK ) );
+
+ return sal_True;
+}
+
+sal_Bool SdrEdgeNode1HorzDistItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (sal_Int32)GetValue();
+ return sal_True;
+}
+
+sal_Bool SdrEdgeNode1HorzDistItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ sal_Int32 nValue = 0;
+ if(!(rVal >>= nValue))
+ return sal_False;
+
+ SetValue( nValue );
+ return sal_True;
+}
+
+sal_Bool SdrEdgeNode1VertDistItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (sal_Int32)GetValue();
+ return sal_True;
+}
+
+sal_Bool SdrEdgeNode1VertDistItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ sal_Int32 nValue = 0;
+ if(!(rVal >>= nValue))
+ return sal_False;
+
+ SetValue( nValue );
+ return sal_True;
+}
+
+sal_Bool SdrEdgeNode2HorzDistItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (sal_Int32)GetValue();
+ return sal_True;
+}
+
+sal_Bool SdrEdgeNode2HorzDistItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ sal_Int32 nValue = 0;
+ if(!(rVal >>= nValue))
+ return sal_False;
+
+ SetValue( nValue );
+ return sal_True;
+}
+
+sal_Bool SdrEdgeNode2VertDistItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (sal_Int32)GetValue();
+ return sal_True;
+}
+
+sal_Bool SdrEdgeNode2VertDistItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ sal_Int32 nValue = 0;
+ if(!(rVal >>= nValue))
+ return sal_False;
+
+ SetValue( nValue );
+ return sal_True;
+}
+
+sal_Bool SdrEdgeLine1DeltaItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (sal_Int32)GetValue();
+ return sal_True;
+}
+
+sal_Bool SdrEdgeLine1DeltaItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ sal_Int32 nValue = 0;
+ if(!(rVal >>= nValue))
+ return sal_False;
+
+ SetValue( nValue );
+ return sal_True;
+}
+
+sal_Bool SdrEdgeLine2DeltaItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (sal_Int32)GetValue();
+ return sal_True;
+}
+
+sal_Bool SdrEdgeLine2DeltaItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ sal_Int32 nValue = 0;
+ if(!(rVal >>= nValue))
+ return sal_False;
+
+ SetValue( nValue );
+ return sal_True;
+}
+
+sal_Bool SdrEdgeLine3DeltaItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (sal_Int32)GetValue();
+ return sal_True;
+}
+
+sal_Bool SdrEdgeLine3DeltaItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ sal_Int32 nValue = 0;
+ if(!(rVal >>= nValue))
+ return sal_False;
+
+ SetValue( nValue );
+ return sal_True;
+}
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// Measure
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+// MeasureKind
+TYPEINIT1_AUTOFACTORY(SdrMeasureKindItem,SfxEnumItem);
+
+SfxPoolItem* __EXPORT SdrMeasureKindItem::Clone(SfxItemPool* /*pPool*/) const { return new SdrMeasureKindItem(*this); }
+
+SfxPoolItem* __EXPORT SdrMeasureKindItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const { return new SdrMeasureKindItem(rIn); }
+
+sal_uInt16 __EXPORT SdrMeasureKindItem::GetValueCount() const { return 2; }
+
+XubString __EXPORT SdrMeasureKindItem::GetValueTextByPos(sal_uInt16 nPos) const
+{
+ return ImpGetResStr(STR_ItemValMEASURE_STD+nPos);
+}
+
+SfxItemPresentation __EXPORT SdrMeasureKindItem::GetPresentation(SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, XubString& rText, const IntlWrapper *) const
+{
+ rText=GetValueTextByPos(sal::static_int_cast< sal_uInt16 >(GetValue()));
+ if (ePres==SFX_ITEM_PRESENTATION_COMPLETE) {
+ String aStr;
+
+ SdrItemPool::TakeItemName(Which(), aStr);
+ aStr += sal_Unicode(' ');
+ rText.Insert(aStr, 0);
+ }
+ return ePres;
+}
+
+sal_Bool SdrMeasureKindItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (drawing::MeasureKind)GetValue();
+ return sal_True;
+}
+
+sal_Bool SdrMeasureKindItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ drawing::MeasureKind eKind;
+ if(!(rVal >>= eKind))
+ {
+ sal_Int32 nEnum = 0;
+ if(!(rVal >>= nEnum))
+ return sal_False;
+
+ eKind = (drawing::MeasureKind)nEnum;
+ }
+
+ SetValue( sal::static_int_cast< sal_uInt16 >( (SdrMeasureKind)eKind ) );
+ return sal_True;
+}
+
+TYPEINIT1_AUTOFACTORY(SdrMeasureTextHPosItem,SfxEnumItem);
+
+SfxPoolItem* __EXPORT SdrMeasureTextHPosItem::Clone(SfxItemPool* /*pPool*/) const { return new SdrMeasureTextHPosItem(*this); }
+
+SfxPoolItem* __EXPORT SdrMeasureTextHPosItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const { return new SdrMeasureTextHPosItem(rIn); }
+
+sal_uInt16 __EXPORT SdrMeasureTextHPosItem::GetValueCount() const { return 4; }
+
+XubString __EXPORT SdrMeasureTextHPosItem::GetValueTextByPos(sal_uInt16 nPos) const
+{
+ return ImpGetResStr(STR_ItemValMEASURE_TEXTHAUTO+nPos);
+}
+
+SfxItemPresentation __EXPORT SdrMeasureTextHPosItem::GetPresentation(SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, XubString& rText, const IntlWrapper *) const
+{
+ rText=GetValueTextByPos(sal::static_int_cast< sal_uInt16 >(GetValue()));
+ if (ePres==SFX_ITEM_PRESENTATION_COMPLETE) {
+ String aStr;
+
+ SdrItemPool::TakeItemName(Which(), aStr);
+ aStr += sal_Unicode(' ');
+ rText.Insert(aStr, 0);
+ }
+ return ePres;
+}
+
+sal_Bool SdrMeasureTextHPosItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (drawing::MeasureTextHorzPos)GetValue();
+ return sal_True;
+}
+
+sal_Bool SdrMeasureTextHPosItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ drawing::MeasureTextHorzPos ePos;
+ if(!(rVal >>= ePos))
+ {
+ sal_Int32 nEnum = 0;
+ if(!(rVal >>= nEnum))
+ return sal_False;
+
+ ePos = (drawing::MeasureTextHorzPos)nEnum;
+ }
+
+ SetValue( sal::static_int_cast< sal_uInt16 >( (SdrMeasureTextHPos)ePos ) );
+ return sal_True;
+}
+
+TYPEINIT1_AUTOFACTORY(SdrMeasureTextVPosItem,SfxEnumItem);
+
+SfxPoolItem* __EXPORT SdrMeasureTextVPosItem::Clone(SfxItemPool* /*pPool*/) const { return new SdrMeasureTextVPosItem(*this); }
+
+SfxPoolItem* __EXPORT SdrMeasureTextVPosItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const { return new SdrMeasureTextVPosItem(rIn); }
+
+sal_uInt16 __EXPORT SdrMeasureTextVPosItem::GetValueCount() const { return 5; }
+
+XubString __EXPORT SdrMeasureTextVPosItem::GetValueTextByPos(sal_uInt16 nPos) const
+{
+ return ImpGetResStr(STR_ItemValMEASURE_TEXTVAUTO+nPos);
+}
+
+SfxItemPresentation __EXPORT SdrMeasureTextVPosItem::GetPresentation(SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, XubString& rText, const IntlWrapper *) const
+{
+ rText=GetValueTextByPos(sal::static_int_cast< sal_uInt16 >(GetValue()));
+ if (ePres==SFX_ITEM_PRESENTATION_COMPLETE) {
+ String aStr;
+
+ SdrItemPool::TakeItemName(Which(), aStr);
+ aStr += sal_Unicode(' ');
+ rText.Insert(aStr, 0);
+ }
+ return ePres;
+}
+
+sal_Bool SdrMeasureTextVPosItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (drawing::MeasureTextVertPos)GetValue();
+ return sal_True;
+}
+
+sal_Bool SdrMeasureTextVPosItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ drawing::MeasureTextVertPos ePos;
+ if(!(rVal >>= ePos))
+ {
+ sal_Int32 nEnum = 0;
+ if(!(rVal >>= nEnum))
+ return sal_False;
+
+ ePos = (drawing::MeasureTextVertPos)nEnum;
+ }
+
+ SetValue( sal::static_int_cast< sal_uInt16 >( (SdrMeasureTextHPos)ePos ) );
+ return sal_True;
+}
+
+TYPEINIT1_AUTOFACTORY(SdrMeasureUnitItem,SfxEnumItem);
+
+SfxPoolItem* __EXPORT SdrMeasureUnitItem::Clone(SfxItemPool* /*pPool*/) const { return new SdrMeasureUnitItem(*this); }
+
+SfxPoolItem* __EXPORT SdrMeasureUnitItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const { return new SdrMeasureUnitItem(rIn); }
+
+sal_uInt16 __EXPORT SdrMeasureUnitItem::GetValueCount() const { return 14; }
+
+XubString __EXPORT SdrMeasureUnitItem::GetValueTextByPos(sal_uInt16 nPos) const
+{
+ XubString aRetval;
+
+ if((FieldUnit)nPos == FUNIT_NONE)
+ {
+ sal_Char aText[] = "default";
+ aRetval += UniString(aText, sizeof(aText-1));
+ }
+ else
+ {
+ SdrFormatter::TakeUnitStr((FieldUnit)nPos, aRetval);
+ }
+
+ return aRetval;
+}
+
+SfxItemPresentation __EXPORT SdrMeasureUnitItem::GetPresentation(SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, XubString& rText, const IntlWrapper *) const
+{
+ rText=GetValueTextByPos(sal::static_int_cast< sal_uInt16 >(GetValue()));
+ if (ePres==SFX_ITEM_PRESENTATION_COMPLETE) {
+ String aStr;
+
+ SdrItemPool::TakeItemName(Which(), aStr);
+ aStr += sal_Unicode(' ');
+ rText.Insert(aStr, 0);
+ }
+ return ePres;
+}
+
+sal_Bool SdrMeasureUnitItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (sal_Int32)GetValue();
+ return sal_True;
+}
+
+sal_Bool SdrMeasureUnitItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ sal_Int32 nMeasure = 0;
+ if(!(rVal >>= nMeasure))
+ return sal_False;
+
+ SetValue( sal::static_int_cast< sal_uInt16 >( (FieldUnit)nMeasure ) );
+ return sal_True;
+}
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// Circ
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+// CircKind
+TYPEINIT1_AUTOFACTORY(SdrCircKindItem,SfxEnumItem);
+
+SfxPoolItem* __EXPORT SdrCircKindItem::Clone(SfxItemPool* /*pPool*/) const { return new SdrCircKindItem(*this); }
+
+SfxPoolItem* __EXPORT SdrCircKindItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const { return new SdrCircKindItem(rIn); }
+
+sal_uInt16 __EXPORT SdrCircKindItem::GetValueCount() const { return 4; }
+
+XubString __EXPORT SdrCircKindItem::GetValueTextByPos(sal_uInt16 nPos) const
+{
+ return ImpGetResStr(STR_ItemValCIRC_FULL+nPos);
+}
+
+SfxItemPresentation __EXPORT SdrCircKindItem::GetPresentation(SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/, XubString& rText, const IntlWrapper *) const
+{
+ rText=GetValueTextByPos(sal::static_int_cast< sal_uInt16 >(GetValue()));
+ if (ePres==SFX_ITEM_PRESENTATION_COMPLETE) {
+ String aStr;
+
+ SdrItemPool::TakeItemName(Which(), aStr);
+ aStr += sal_Unicode(' ');
+ rText.Insert(aStr, 0);
+ }
+ return ePres;
+}
+
+sal_Bool SdrCircKindItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (drawing::CircleKind)GetValue();
+ return sal_True;
+}
+
+sal_Bool SdrCircKindItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ drawing::CircleKind eKind;
+ if(!(rVal >>= eKind))
+ {
+ sal_Int32 nEnum = 0;
+ if(!(rVal >>= nEnum))
+ return sal_False;
+
+ eKind = (drawing::CircleKind)nEnum;
+ }
+
+ SetValue( sal::static_int_cast< sal_uInt16 >( (SdrCircKind)eKind ) );
+ return sal_True;
+}
+
+//------------------------------------------------------------
+// class SdrSignedPercentItem
+//------------------------------------------------------------
+
+TYPEINIT1_AUTOFACTORY( SdrSignedPercentItem, SfxInt16Item );
+
+
+SfxPoolItem* __EXPORT SdrSignedPercentItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new SdrSignedPercentItem( Which(), GetValue() );
+}
+
+SfxPoolItem* __EXPORT SdrSignedPercentItem::Create( SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new SdrSignedPercentItem( Which(), rIn );
+}
+
+SfxItemPresentation __EXPORT SdrSignedPercentItem::GetPresentation(
+ SfxItemPresentation ePres, SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/,
+ XubString& rText, const IntlWrapper *) const
+{
+ rText = UniString::CreateFromInt32(GetValue());
+ rText += sal_Unicode('%');
+
+ if(ePres == SFX_ITEM_PRESENTATION_COMPLETE)
+ {
+ XubString aStr;
+
+ SdrItemPool::TakeItemName(Which(), aStr);
+ aStr += sal_Unicode(' ');
+ rText.Insert(aStr, 0);
+ }
+
+ return ePres;
+}
+
+#ifdef SDR_ISPOOLABLE
+
+int __EXPORT SdrSignedPercentItem::IsPoolable() const
+{
+ sal_uInt16 nId=Which();
+ return nId < SDRATTR_NOTPERSIST_FIRST || nId > SDRATTR_NOTPERSIST_LAST;
+}
+#endif
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// SdrGrafRedItem
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+TYPEINIT1( SdrGrafRedItem, SdrSignedPercentItem );
+
+SfxPoolItem* __EXPORT SdrGrafRedItem::Clone( SfxItemPool* /*pPool*/) const
+{
+ return new SdrGrafRedItem( *this );
+}
+
+SfxPoolItem* __EXPORT SdrGrafRedItem::Create( SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new SdrGrafRedItem( rIn );
+}
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// SdrGrafGreenItem
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+TYPEINIT1( SdrGrafGreenItem, SdrSignedPercentItem );
+
+SfxPoolItem* __EXPORT SdrGrafGreenItem::Clone( SfxItemPool* /*pPool*/) const
+{
+ return new SdrGrafGreenItem( *this );
+}
+
+SfxPoolItem* __EXPORT SdrGrafGreenItem::Create( SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new SdrGrafGreenItem( rIn );
+}
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// SdrGrafBlueItem
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+TYPEINIT1( SdrGrafBlueItem, SdrSignedPercentItem );
+
+SfxPoolItem* __EXPORT SdrGrafBlueItem::Clone( SfxItemPool* /*pPool*/) const
+{
+ return new SdrGrafBlueItem( *this );
+}
+
+SfxPoolItem* __EXPORT SdrGrafBlueItem::Create( SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new SdrGrafBlueItem( rIn );
+}
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// SdrGrafLuminanceItem
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+TYPEINIT1( SdrGrafLuminanceItem, SdrSignedPercentItem );
+
+SfxPoolItem* __EXPORT SdrGrafLuminanceItem::Clone( SfxItemPool* /*pPool*/) const
+{
+ return new SdrGrafLuminanceItem( *this );
+}
+
+SfxPoolItem* __EXPORT SdrGrafLuminanceItem::Create( SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new SdrGrafLuminanceItem( rIn );
+}
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// SdrGrafContrastItem
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+TYPEINIT1( SdrGrafContrastItem, SdrSignedPercentItem );
+
+SfxPoolItem* __EXPORT SdrGrafContrastItem::Clone( SfxItemPool* /*pPool*/) const
+{
+ return new SdrGrafContrastItem( *this );
+}
+
+SfxPoolItem* __EXPORT SdrGrafContrastItem::Create( SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new SdrGrafContrastItem( rIn );
+}
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// SdrGrafGamma100Item
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+TYPEINIT1( SdrGrafGamma100Item, SfxUInt32Item );
+
+SfxPoolItem* __EXPORT SdrGrafGamma100Item::Clone( SfxItemPool* /*pPool */) const
+{
+ return new SdrGrafGamma100Item( *this );
+}
+
+SfxPoolItem* __EXPORT SdrGrafGamma100Item::Create( SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new SdrGrafGamma100Item( rIn );
+}
+
+sal_Bool SdrGrafGamma100Item::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= ((double)GetValue()) / 100.0;
+ return sal_True;
+}
+
+sal_Bool SdrGrafGamma100Item::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ double nGamma = 0;
+ if(!(rVal >>= nGamma))
+ return sal_False;
+
+ SetValue( (sal_uInt32)(nGamma * 100.0 ) );
+ return sal_True;
+}
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// SdrGrafInvertItem
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+TYPEINIT1( SdrGrafInvertItem, SdrOnOffItem );
+
+SfxPoolItem* __EXPORT SdrGrafInvertItem::Clone( SfxItemPool* /*pPool*/) const
+{
+ return new SdrGrafInvertItem( *this );
+}
+
+SfxPoolItem* __EXPORT SdrGrafInvertItem::Create( SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new SdrGrafInvertItem( rIn );
+}
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// SdrGrafTransparenceItem
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+TYPEINIT1( SdrGrafTransparenceItem, SdrPercentItem );
+
+SfxPoolItem* __EXPORT SdrGrafTransparenceItem::Clone( SfxItemPool* /*pPool*/) const
+{
+ return new SdrGrafTransparenceItem( *this );
+}
+
+SfxPoolItem* __EXPORT SdrGrafTransparenceItem::Create( SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new SdrGrafTransparenceItem( rIn );
+}
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// SdrGrafModeItem
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+TYPEINIT1( SdrGrafModeItem, SfxEnumItem );
+
+SfxPoolItem* __EXPORT SdrGrafModeItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new SdrGrafModeItem( *this );
+}
+
+SfxPoolItem* __EXPORT SdrGrafModeItem::Create( SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new SdrGrafModeItem( rIn );
+}
+
+sal_uInt16 __EXPORT SdrGrafModeItem::GetValueCount() const
+{
+ return 4;
+}
+
+XubString __EXPORT SdrGrafModeItem::GetValueTextByPos(sal_uInt16 nPos) const
+{
+ XubString aStr;
+
+ switch(nPos)
+ {
+ case 1:
+ {
+ sal_Char aTextGreys[] = "Greys";
+ aStr += UniString(aTextGreys, sizeof(aTextGreys-1));
+ break;
+ }
+ case 2:
+ {
+ sal_Char aTextBlackWhite[] = "Black/White";
+ aStr += UniString(aTextBlackWhite, sizeof(aTextBlackWhite-1));
+ break;
+ }
+ case 3:
+ {
+ sal_Char aTextWatermark[] = "Watermark";
+ aStr += UniString(aTextWatermark, sizeof(aTextWatermark-1));
+ break;
+ }
+ default:
+ {
+ sal_Char aTextStandard[] = "Standard";
+ aStr += UniString(aTextStandard, sizeof(aTextStandard-1));
+ break;
+ }
+ }
+
+ return aStr;
+}
+
+SfxItemPresentation __EXPORT SdrGrafModeItem::GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/,
+ XubString& rText, const IntlWrapper *) const
+{
+ rText = GetValueTextByPos( sal::static_int_cast< sal_uInt16 >( GetValue() ) );
+
+ if( ePres == SFX_ITEM_PRESENTATION_COMPLETE )
+ {
+ String aStr;
+
+ SdrItemPool::TakeItemName( Which(), aStr );
+ aStr += sal_Unicode(' ');
+ rText.Insert( aStr, 0 );
+ }
+
+ return ePres;
+}
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// SdrGrafCropItem
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+TYPEINIT1( SdrGrafCropItem, SvxGrfCrop );
+
+SfxPoolItem* SdrGrafCropItem::Clone( SfxItemPool* /*pPool*/) const
+{
+ return new SdrGrafCropItem( *this );
+}
+
+SfxPoolItem* SdrGrafCropItem::Create( SvStream& rIn, sal_uInt16 nVer ) const
+{
+ return( ( 0 == nVer ) ? Clone( NULL ) : SvxGrfCrop::Create( rIn, nVer ) );
+}
+
+sal_uInt16 SdrGrafCropItem::GetVersion( sal_uInt16 /*nFileVersion*/) const
+{
+ // GRFCROP_VERSION_MOVETOSVX is 1
+ return GRFCROP_VERSION_MOVETOSVX;
+}
+
+// eof
diff --git a/svx/source/svdraw/svdcrtv.cxx b/svx/source/svdraw/svdcrtv.cxx
new file mode 100644
index 000000000000..6fa8b0552f35
--- /dev/null
+++ b/svx/source/svdraw/svdcrtv.cxx
@@ -0,0 +1,964 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svdcrtv.hxx>
+#include "svx/xattr.hxx"
+#include <svx/svdundo.hxx>
+#include <svx/svdocapt.hxx> // Spezialbehandlung: Nach dem Create transparente Fuellung
+#include <svx/svdoedge.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/scene3d.hxx>
+#include <svx/view3d.hxx>
+#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
+#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/sdrpaintwindow.hxx>
+#include "fmobj.hxx"
+#include <svx/svdocirc.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class ImplConnectMarkerOverlay
+{
+ // The OverlayObjects
+ ::sdr::overlay::OverlayObjectList maObjects;
+
+ // The remembered target object
+ const SdrObject& mrObject;
+
+public:
+ ImplConnectMarkerOverlay(const SdrCreateView& rView, SdrObject& rObject);
+ ~ImplConnectMarkerOverlay();
+
+ const SdrObject& GetTargetObject() const { return mrObject; }
+};
+
+ImplConnectMarkerOverlay::ImplConnectMarkerOverlay(const SdrCreateView& rView, SdrObject& rObject)
+: mrObject(rObject)
+{
+ basegfx::B2DPolyPolygon aB2DPolyPolygon(rObject.TakeXorPoly());
+
+ for(sal_uInt32 a(0L); a < rView.PaintWindowCount(); a++)
+ {
+ SdrPaintWindow* pCandidate = rView.GetPaintWindow(a);
+ ::sdr::overlay::OverlayManager* pTargetOverlay = pCandidate->GetOverlayManager();
+
+ if(pTargetOverlay)
+ {
+ Size aHalfLogicSize(pTargetOverlay->getOutputDevice().PixelToLogic(Size(4, 4)));
+
+ // object
+ ::sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(aB2DPolyPolygon);
+ pTargetOverlay->add(*pNew);
+ maObjects.append(*pNew);
+
+ // gluepoints
+ if(rView.IsAutoVertexConnectors())
+ {
+ for(sal_uInt16 i(0); i < 4; i++)
+ {
+ SdrGluePoint aGluePoint(rObject.GetVertexGluePoint(i));
+ const Point& rPosition = aGluePoint.GetAbsolutePos(rObject);
+
+ basegfx::B2DPoint aTopLeft(rPosition.X() - aHalfLogicSize.Width(), rPosition.Y() - aHalfLogicSize.Height());
+ basegfx::B2DPoint aBottomRight(rPosition.X() + aHalfLogicSize.Width(), rPosition.Y() + aHalfLogicSize.Height());
+
+ basegfx::B2DPolygon aTempPoly;
+ aTempPoly.append(aTopLeft);
+ aTempPoly.append(basegfx::B2DPoint(aBottomRight.getX(), aTopLeft.getY()));
+ aTempPoly.append(aBottomRight);
+ aTempPoly.append(basegfx::B2DPoint(aTopLeft.getX(), aBottomRight.getY()));
+ aTempPoly.setClosed(true);
+
+ basegfx::B2DPolyPolygon aTempPolyPoly;
+ aTempPolyPoly.append(aTempPoly);
+
+ pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(aTempPolyPoly);
+ pTargetOverlay->add(*pNew);
+ maObjects.append(*pNew);
+ }
+ }
+ }
+ }
+}
+
+ImplConnectMarkerOverlay::~ImplConnectMarkerOverlay()
+{
+ // The OverlayObjects are cleared using the destructor of OverlayObjectList.
+ // That destructor calls clear() at the list which removes all objects from the
+ // OverlayManager and deletes them.
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class ImpSdrCreateViewExtraData
+{
+ // The OverlayObjects for XOR replacement
+ ::sdr::overlay::OverlayObjectList maObjects;
+
+public:
+ ImpSdrCreateViewExtraData();
+ ~ImpSdrCreateViewExtraData();
+
+ void CreateAndShowOverlay(const SdrCreateView& rView, const SdrObject* pObject, const basegfx::B2DPolyPolygon& rPolyPoly);
+ void HideOverlay();
+};
+
+ImpSdrCreateViewExtraData::ImpSdrCreateViewExtraData()
+{
+}
+
+ImpSdrCreateViewExtraData::~ImpSdrCreateViewExtraData()
+{
+ HideOverlay();
+}
+
+void ImpSdrCreateViewExtraData::CreateAndShowOverlay(const SdrCreateView& rView, const SdrObject* pObject, const basegfx::B2DPolyPolygon& rPolyPoly)
+{
+ for(sal_uInt32 a(0L); a < rView.PaintWindowCount(); a++)
+ {
+ SdrPaintWindow* pCandidate = rView.GetPaintWindow(a);
+ ::sdr::overlay::OverlayManager* pOverlayManager = pCandidate->GetOverlayManager();
+
+ if(pOverlayManager)
+ {
+ if(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);
+ }
+
+ if(rPolyPoly.count())
+ {
+ ::sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(rPolyPoly);
+ pOverlayManager->add(*pNew);
+ maObjects.append(*pNew);
+ }
+ }
+ }
+}
+
+void ImpSdrCreateViewExtraData::HideOverlay()
+{
+ // the clear() call at the list removes all objects from the
+ // OverlayManager and deletes them.
+ maObjects.clear();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@ @@@@@ @@@@@ @@@@ @@@@@@ @@@@@ @@ @@ @@ @@@@@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@
+// @@ @@@@@ @@@@ @@@@@@ @@ @@@@ @@@@@ @@ @@@@ @@@@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@
+// @@@@ @@ @@ @@@@@ @@ @@ @@ @@@@@ @ @@ @@@@@ @@ @@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrCreateView::ImpClearConnectMarker()
+{
+ if(mpCoMaOverlay)
+ {
+ delete mpCoMaOverlay;
+ mpCoMaOverlay = 0L;
+ }
+}
+
+void SdrCreateView::ImpClearVars()
+{
+ nAktInvent=SdrInventor;
+ nAktIdent=OBJ_NONE;
+ pAktCreate=NULL;
+ pCreatePV=NULL;
+ bAutoTextEdit=sal_False;
+ b1stPointAsCenter=sal_False;
+ aAktCreatePointer=Pointer(POINTER_CROSS);
+ bUseIncompatiblePathCreateInterface=sal_False;
+ bAutoClosePolys=sal_True;
+ nAutoCloseDistPix=5;
+ nFreeHandMinDistPix=10;
+
+ ImpClearConnectMarker();
+}
+
+void SdrCreateView::ImpMakeCreateAttr()
+{
+}
+
+SdrCreateView::SdrCreateView(SdrModel* pModel1, OutputDevice* pOut)
+: SdrDragView(pModel1,pOut),
+ mpCoMaOverlay(0L),
+ mpCreateViewExtraData(new ImpSdrCreateViewExtraData())
+{
+ ImpClearVars();
+ ImpMakeCreateAttr();
+}
+
+SdrCreateView::~SdrCreateView()
+{
+ ImpClearConnectMarker();
+ delete mpCreateViewExtraData;
+ SdrObject::Free( pAktCreate );
+}
+
+void SdrCreateView::ImpDelCreateAttr()
+{
+}
+
+sal_Bool SdrCreateView::IsAction() const
+{
+ return SdrDragView::IsAction() || pAktCreate!=NULL;
+}
+
+void SdrCreateView::MovAction(const Point& rPnt)
+{
+ SdrDragView::MovAction(rPnt);
+ if (pAktCreate!=NULL) {
+ MovCreateObj(rPnt);
+ }
+}
+
+void SdrCreateView::EndAction()
+{
+ if (pAktCreate!=NULL) EndCreateObj(SDRCREATE_FORCEEND);
+ SdrDragView::EndAction();
+}
+
+void SdrCreateView::BckAction()
+{
+ if (pAktCreate!=NULL) BckCreateObj();
+ SdrDragView::BckAction();
+}
+
+void SdrCreateView::BrkAction()
+{
+ SdrDragView::BrkAction();
+ BrkCreateObj();
+}
+
+void SdrCreateView::TakeActionRect(Rectangle& rRect) const
+{
+ if (pAktCreate!=NULL)
+ {
+ rRect=aDragStat.GetActionRect();
+ if (rRect.IsEmpty())
+ {
+ rRect=Rectangle(aDragStat.GetPrev(),aDragStat.GetNow());
+ }
+ }
+ else
+ {
+ SdrDragView::TakeActionRect(rRect);
+ }
+}
+
+sal_Bool SdrCreateView::CheckEdgeMode()
+{
+ sal_uInt32 nInv=nAktInvent;
+ sal_uInt16 nIdn=nAktIdent;
+ if (pAktCreate!=NULL)
+ {
+ nInv=pAktCreate->GetObjInventor();
+ nIdn=pAktCreate->GetObjIdentifier();
+ // wird vom EdgeObj gemanaged
+ if (nAktInvent==SdrInventor && nAktIdent==OBJ_EDGE) return sal_False;
+ }
+
+ if (!IsCreateMode() || nAktInvent!=SdrInventor || nAktIdent!=OBJ_EDGE)
+ {
+ ImpClearConnectMarker();
+ return sal_False;
+ }
+ else
+ {
+ // sal_True heisst: MouseMove soll Connect checken
+ return !IsAction();
+ }
+}
+
+void SdrCreateView::SetConnectMarker(const SdrObjConnection& rCon, const SdrPageView& /*rPV*/)
+{
+ SdrObject* pTargetObject = rCon.pObj;
+
+ if(pTargetObject)
+ {
+ // if target object changes, throw away overlay object to make room for changes
+ if(mpCoMaOverlay && pTargetObject != &mpCoMaOverlay->GetTargetObject())
+ {
+ ImpClearConnectMarker();
+ }
+
+ if(!mpCoMaOverlay)
+ {
+ mpCoMaOverlay = new ImplConnectMarkerOverlay(*this, *pTargetObject);
+ }
+ }
+ else
+ {
+ ImpClearConnectMarker();
+ }
+}
+
+void SdrCreateView::HideConnectMarker()
+{
+ ImpClearConnectMarker();
+}
+
+sal_Bool SdrCreateView::MouseMove(const MouseEvent& rMEvt, Window* pWin)
+{
+ if(CheckEdgeMode() && pWin)
+ {
+ SdrPageView* pPV = GetSdrPageView();
+
+ if(pPV)
+ {
+ // Defaultete Hit-Toleranz bei IsMarkedHit() mal aendern !!!!
+ Point aPos(pWin->PixelToLogic(rMEvt.GetPosPixel()));
+ sal_Bool bMarkHit=PickHandle(aPos)!=NULL || IsMarkedObjHit(aPos);
+ SdrObjConnection aCon;
+ if (!bMarkHit) SdrEdgeObj::ImpFindConnector(aPos,*pPV,aCon,NULL,pWin);
+ SetConnectMarker(aCon,*pPV);
+ }
+ }
+ return SdrDragView::MouseMove(rMEvt,pWin);
+}
+
+sal_Bool SdrCreateView::IsTextTool() const
+{
+ return eEditMode==SDREDITMODE_CREATE && nAktInvent==SdrInventor && (nAktIdent==OBJ_TEXT || nAktIdent==OBJ_TEXTEXT || nAktIdent==OBJ_TITLETEXT || nAktIdent==OBJ_OUTLINETEXT);
+}
+
+sal_Bool SdrCreateView::IsEdgeTool() const
+{
+ return eEditMode==SDREDITMODE_CREATE && nAktInvent==SdrInventor && (nAktIdent==OBJ_EDGE);
+}
+
+sal_Bool SdrCreateView::IsMeasureTool() const
+{
+ return eEditMode==SDREDITMODE_CREATE && nAktInvent==SdrInventor && (nAktIdent==OBJ_MEASURE);
+}
+
+void SdrCreateView::SetCurrentObj(sal_uInt16 nIdent, sal_uInt32 nInvent)
+{
+ if (nAktInvent!=nInvent || nAktIdent!=nIdent)
+ {
+ nAktInvent=nInvent;
+ nAktIdent=nIdent;
+ SdrObject* pObj = SdrObjFactory::MakeNewObject(nInvent,nIdent,NULL,NULL);
+
+ if(pObj)
+ {
+ // Auf pers. Wunsch von Marco:
+ // Mauszeiger bei Textwerkzeug immer I-Beam. Fadenkreuz
+ // mit kleinem I-Beam erst bai MouseButtonDown
+ if(IsTextTool())
+ {
+ // #81944# AW: Here the correct pointer needs to be used
+ // if the default is set to vertical writing
+ aAktCreatePointer = POINTER_TEXT;
+ }
+ else
+ aAktCreatePointer = pObj->GetCreatePointer();
+
+ SdrObject::Free( pObj );
+ }
+ else
+ {
+ aAktCreatePointer = Pointer(POINTER_CROSS);
+ }
+ }
+
+ CheckEdgeMode();
+ ImpSetGlueVisible3(IsEdgeTool());
+}
+
+sal_Bool SdrCreateView::ImpBegCreateObj(sal_uInt32 nInvent, sal_uInt16 nIdent, const Point& rPnt, OutputDevice* pOut,
+ short nMinMov, SdrPageView* pPV, const Rectangle& rLogRect, SdrObject* pPreparedFactoryObject)
+{
+ sal_Bool bRet=sal_False;
+ UnmarkAllObj();
+ BrkAction();
+
+ ImpClearConnectMarker();
+
+ if (pPV!=NULL)
+ {
+ pCreatePV=pPV;
+ }
+ else
+ {
+ pCreatePV = GetSdrPageView();
+ }
+ if (pCreatePV!=NULL)
+ { // ansonsten keine Seite angemeldet!
+ String aLay(aAktLayer);
+
+ if(nInvent == SdrInventor && nIdent == OBJ_MEASURE && aMeasureLayer.Len())
+ {
+ aLay = aMeasureLayer;
+ }
+
+ SdrLayerID nLayer=pCreatePV->GetPage()->GetLayerAdmin().GetLayerID(aLay,sal_True);
+ if (nLayer==SDRLAYER_NOTFOUND) nLayer=0;
+ if (!pCreatePV->GetLockedLayers().IsSet(nLayer) && pCreatePV->GetVisibleLayers().IsSet(nLayer))
+ {
+ if(pPreparedFactoryObject)
+ {
+ pAktCreate = pPreparedFactoryObject;
+
+ if(pCreatePV->GetPage())
+ {
+ pAktCreate->SetPage(pCreatePV->GetPage());
+ }
+ else if (pMod)
+ {
+ pAktCreate->SetModel(pMod);
+ }
+ }
+ else
+ {
+ pAktCreate = SdrObjFactory::MakeNewObject(nInvent, nIdent, pCreatePV->GetPage(), pMod);
+ }
+
+ Point aPnt(rPnt);
+ if (nAktInvent!=SdrInventor || (nAktIdent!=sal_uInt16(OBJ_EDGE) &&
+ nAktIdent!=sal_uInt16(OBJ_FREELINE) &&
+ nAktIdent!=sal_uInt16(OBJ_FREEFILL) )) { // Kein Fang fuer Edge und Freihand!
+ aPnt=GetSnapPos(aPnt,pCreatePV);
+ }
+ if (pAktCreate!=NULL)
+ {
+ sal_Bool bStartEdit=sal_False; // nach Ende von Create automatisch TextEdit starten
+ if (pDefaultStyleSheet!=NULL) pAktCreate->NbcSetStyleSheet(pDefaultStyleSheet, sal_False);
+
+ // #101618# SW uses a naked SdrObject for frame construction. Normally, such an
+ // object should not be created. Since it is possible to use it as a helper
+ // object (e.g. in letting the user define an area with the interactive
+ // construction) at least no items should be set at that object.
+ if(nInvent != SdrInventor || nIdent != OBJ_NONE)
+ {
+ pAktCreate->SetMergedItemSet(aDefaultAttr);
+ }
+
+ if (HAS_BASE(SdrCaptionObj,pAktCreate))
+ {
+ SfxItemSet aSet(pMod->GetItemPool());
+ aSet.Put(XFillColorItem(String(),Color(COL_WHITE))); // Falls einer auf Solid umschaltet
+ aSet.Put(XFillStyleItem(XFILL_NONE));
+
+ pAktCreate->SetMergedItemSet(aSet);
+
+ bStartEdit=sal_True;
+ }
+ if (nInvent==SdrInventor && (nIdent==OBJ_TEXT || nIdent==OBJ_TEXTEXT ||
+ nIdent==OBJ_TITLETEXT || nIdent==OBJ_OUTLINETEXT))
+ {
+ // Fuer alle Textrahmen default keinen Hintergrund und keine Umrandung
+ SfxItemSet aSet(pMod->GetItemPool());
+ aSet.Put(XFillColorItem(String(),Color(COL_WHITE))); // Falls einer auf Solid umschaltet
+ aSet.Put(XFillStyleItem(XFILL_NONE));
+ aSet.Put(XLineColorItem(String(),Color(COL_BLACK))); // Falls einer auf Solid umschaltet
+ aSet.Put(XLineStyleItem(XLINE_NONE));
+
+ pAktCreate->SetMergedItemSet(aSet);
+
+ bStartEdit=sal_True;
+ }
+ if (!rLogRect.IsEmpty()) pAktCreate->NbcSetLogicRect(rLogRect);
+
+ // #90129# make sure drag start point is inside WorkArea
+ const Rectangle& rWorkArea = ((SdrDragView*)this)->GetWorkArea();
+
+ if(!rWorkArea.IsEmpty())
+ {
+ if(aPnt.X() < rWorkArea.Left())
+ {
+ aPnt.X() = rWorkArea.Left();
+ }
+
+ if(aPnt.X() > rWorkArea.Right())
+ {
+ aPnt.X() = rWorkArea.Right();
+ }
+
+ if(aPnt.Y() < rWorkArea.Top())
+ {
+ aPnt.Y() = rWorkArea.Top();
+ }
+
+ if(aPnt.Y() > rWorkArea.Bottom())
+ {
+ aPnt.Y() = rWorkArea.Bottom();
+ }
+ }
+
+ aDragStat.Reset(aPnt);
+ aDragStat.SetView((SdrView*)this);
+ aDragStat.SetPageView(pCreatePV);
+ aDragStat.SetMinMove(ImpGetMinMovLogic(nMinMov,pOut));
+ pDragWin=pOut;
+ if (pAktCreate->BegCreate(aDragStat))
+ {
+ ShowCreateObj(/*pOut,sal_True*/);
+ bRet=sal_True;
+ }
+ else
+ {
+ SdrObject::Free( pAktCreate );
+ pAktCreate=NULL;
+ pCreatePV=NULL;
+ }
+ }
+ }
+ }
+ return bRet;
+}
+
+sal_Bool SdrCreateView::BegCreateObj(const Point& rPnt, OutputDevice* pOut, short nMinMov, SdrPageView* pPV)
+{
+ return ImpBegCreateObj(nAktInvent,nAktIdent,rPnt,pOut,nMinMov,pPV,Rectangle(), 0L);
+}
+
+sal_Bool SdrCreateView::BegCreatePreparedObject(const Point& rPnt, sal_Int16 nMinMov, SdrObject* pPreparedFactoryObject)
+{
+ sal_uInt32 nInvent(nAktInvent);
+ sal_uInt16 nIdent(nAktIdent);
+
+ if(pPreparedFactoryObject)
+ {
+ nInvent = pPreparedFactoryObject->GetObjInventor();
+ nIdent = pPreparedFactoryObject->GetObjIdentifier();
+ }
+
+ return ImpBegCreateObj(nInvent, nIdent, rPnt, 0L, nMinMov, 0L, Rectangle(), pPreparedFactoryObject);
+}
+
+sal_Bool SdrCreateView::BegCreateCaptionObj(const Point& rPnt, const Size& rObjSiz,
+ OutputDevice* pOut, short nMinMov, SdrPageView* pPV)
+{
+ return ImpBegCreateObj(SdrInventor,OBJ_CAPTION,rPnt,pOut,nMinMov,pPV,
+ Rectangle(rPnt,Size(rObjSiz.Width()+1,rObjSiz.Height()+1)), 0L);
+}
+
+void SdrCreateView::MovCreateObj(const Point& rPnt)
+{
+ if (pAktCreate!=NULL) {
+ Point aPnt(rPnt);
+ if (!aDragStat.IsNoSnap())
+ {
+ aPnt=GetSnapPos(aPnt,pCreatePV);
+ }
+ if (IsOrtho())
+ {
+ if (aDragStat.IsOrtho8Possible()) OrthoDistance8(aDragStat.GetPrev(),aPnt,IsBigOrtho());
+ else if (aDragStat.IsOrtho4Possible()) OrthoDistance4(aDragStat.GetPrev(),aPnt,IsBigOrtho());
+ }
+
+ // #77734# If the drag point was limited and Ortho is active, do
+ // the small ortho correction (reduction) -> last parameter to FALSE.
+ sal_Bool bDidLimit(ImpLimitToWorkArea(aPnt));
+ if(bDidLimit && IsOrtho())
+ {
+ if(aDragStat.IsOrtho8Possible())
+ OrthoDistance8(aDragStat.GetPrev(), aPnt, sal_False);
+ else if(aDragStat.IsOrtho4Possible())
+ OrthoDistance4(aDragStat.GetPrev(), aPnt, sal_False);
+ }
+
+ if (aPnt==aDragStat.GetNow()) return;
+ bool bMerk(aDragStat.IsMinMoved());
+ if (aDragStat.CheckMinMoved(aPnt))
+ {
+ Rectangle aBound;
+ if (!bMerk) aDragStat.NextPoint();
+ aDragStat.NextMove(aPnt);
+ pAktCreate->MovCreate(aDragStat);
+
+ // MovCreate changes the object, so use ActionChanged() on it
+ pAktCreate->ActionChanged();
+
+ // replace for DrawCreateObjDiff
+ HideCreateObj();
+ ShowCreateObj();
+ }
+ }
+}
+
+sal_Bool SdrCreateView::EndCreateObj(SdrCreateCmd eCmd)
+{
+ sal_Bool bRet=sal_False;
+ SdrObject* pObjMerk=pAktCreate;
+ SdrPageView* pPVMerk=pCreatePV;
+
+ if (pAktCreate!=NULL)
+ {
+ sal_uIntPtr nAnz=aDragStat.GetPointAnz();
+
+ if (nAnz<=1 && eCmd==SDRCREATE_FORCEEND)
+ {
+ BrkCreateObj(); // Objekte mit nur einem Punkt gibt's nicht (zumindest noch nicht)
+ return sal_False; // sal_False=Event nicht ausgewertet
+ }
+
+ sal_Bool bPntsEq=nAnz>1;
+ sal_uIntPtr i=1;
+ Point aP0=aDragStat.GetPoint(0);
+ while (bPntsEq && i<nAnz) { bPntsEq=aP0==aDragStat.GetPoint(i); i++; }
+
+ if (pAktCreate->EndCreate(aDragStat,eCmd))
+ {
+ HideCreateObj();
+
+ if (!bPntsEq)
+ {
+ // sonst Brk, weil alle Punkte gleich sind.
+ SdrObject* pObj=pAktCreate;
+ pAktCreate=NULL;
+
+ const SdrLayerAdmin& rAd = pCreatePV->GetPage()->GetLayerAdmin();
+ SdrLayerID nLayer(0);
+
+ // #i72535#
+ if(pObj->ISA(FmFormObj))
+ {
+ // for FormControls, force to form layer
+ nLayer = rAd.GetLayerID(rAd.GetControlLayerName(), true);
+ }
+ else
+ {
+ nLayer = rAd.GetLayerID(aAktLayer, sal_True);
+ }
+
+ if(SDRLAYER_NOTFOUND == nLayer)
+ {
+ nLayer=0;
+ }
+
+ pObj->SetLayer(nLayer);
+
+ // #83403# recognize creation of a new 3D object inside a 3D scene
+ sal_Bool bSceneIntoScene(sal_False);
+
+ if(pObjMerk
+ && pObjMerk->ISA(E3dScene)
+ && pCreatePV
+ && pCreatePV->GetAktGroup()
+ && pCreatePV->GetAktGroup()->ISA(E3dScene))
+ {
+ sal_Bool bDidInsert = ((E3dView*)this)->ImpCloneAll3DObjectsToDestScene(
+ (E3dScene*)pObjMerk, (E3dScene*)pCreatePV->GetAktGroup(), Point(0, 0));
+
+ if(bDidInsert)
+ {
+ // delete object, it's content is cloned and inserted
+ SdrObject::Free( pObjMerk );
+ pObjMerk = 0L;
+ bRet = sal_False;
+ bSceneIntoScene = sal_True;
+ }
+ }
+
+ if(!bSceneIntoScene)
+ {
+ // do the same as before
+ InsertObjectAtView(pObj, *pCreatePV);
+ }
+
+ pCreatePV=NULL;
+ bRet=sal_True; // sal_True=Event ausgewertet
+ }
+ else
+ {
+ BrkCreateObj();
+ }
+ }
+ else
+ { // Mehr Punkte
+ if (eCmd==SDRCREATE_FORCEEND || // nix da, Ende erzwungen
+ nAnz==0 || // keine Punkte da (kann eigentlich nicht vorkommen)
+ (nAnz<=1 && !aDragStat.IsMinMoved())) { // MinMove nicht erfuellt
+ BrkCreateObj();
+ }
+ else
+ {
+ // replace for DrawCreateObjDiff
+ HideCreateObj();
+ ShowCreateObj();
+ aDragStat.ResetMinMoved(); // NextPoint gibt's bei MovCreateObj()
+ bRet=sal_True;
+ }
+ }
+ if (bRet && pObjMerk!=NULL && IsTextEditAfterCreate())
+ {
+ SdrTextObj* pText=PTR_CAST(SdrTextObj,pObjMerk);
+ if (pText!=NULL && pText->IsTextFrame())
+ {
+ SdrBeginTextEdit(pText, pPVMerk, (Window*)0L, sal_True, (SdrOutliner*)0L, (OutlinerView*)0L);
+ }
+ }
+ }
+ return bRet;
+}
+
+void SdrCreateView::BckCreateObj()
+{
+ if (pAktCreate!=NULL)
+ {
+ if (aDragStat.GetPointAnz()<=2 )
+ {
+ BrkCreateObj();
+ }
+ else
+ {
+ HideCreateObj();
+ aDragStat.PrevPoint();
+ if (pAktCreate->BckCreate(aDragStat))
+ {
+ ShowCreateObj();
+ }
+ else
+ {
+ BrkCreateObj();
+ }
+ }
+ }
+}
+
+void SdrCreateView::BrkCreateObj()
+{
+ if (pAktCreate!=NULL)
+ {
+ HideCreateObj();
+ pAktCreate->BrkCreate(aDragStat);
+ SdrObject::Free( pAktCreate );
+ pAktCreate=NULL;
+ pCreatePV=NULL;
+ }
+}
+
+void SdrCreateView::ShowCreateObj(/*OutputDevice* pOut, sal_Bool bFull*/)
+{
+ if(IsCreateObj() && !aDragStat.IsShown())
+ {
+ if(pAktCreate)
+ {
+ // for migration from XOR, replace DrawDragObj here to create
+ // 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)
+ {
+ const SfxItemSet& rSet = pAktCreate->GetMergedItemSet();
+ const XFillStyle eFill(((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue());
+ const XLineStyle eLine(((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue());
+
+ if(XLINE_NONE == eLine && XFILL_NONE == eFill)
+ {
+ bUseSolidDragging = sal_False;
+ }
+ }
+
+ // check for form controls
+ if(bUseSolidDragging)
+ {
+ if(pAktCreate->ISA(SdrUnoObj))
+ {
+ bUseSolidDragging = sal_False;
+ }
+ }
+
+ // #i101781# force to non-solid dragging when not creating a full circle
+ if(bUseSolidDragging)
+ {
+ SdrCircObj* pCircObj = dynamic_cast< SdrCircObj* >(pAktCreate);
+
+ if(pCircObj && OBJ_CIRC != pCircObj->GetObjIdentifier())
+ {
+ // #i103058# Allow SolidDragging with four points
+ if(aDragStat.GetPointAnz() < 4)
+ {
+ bUseSolidDragging = false;
+ }
+ }
+ }
+
+ if(bUseSolidDragging)
+ {
+ basegfx::B2DPolyPolygon aDragPolyPolygon;
+
+ if(pAktCreate->ISA(SdrRectObj))
+ {
+ // ensure object has some size, necessary for SdrTextObj because
+ // there are still untested divisions by that sizes
+ Rectangle aCurrentSnapRect(pAktCreate->GetSnapRect());
+
+ if(!(aCurrentSnapRect.GetWidth() > 1 && aCurrentSnapRect.GetHeight() > 1))
+ {
+ Rectangle aNewRect(aDragStat.GetStart(), aDragStat.GetStart() + Point(2, 2));
+ pAktCreate->NbcSetSnapRect(aNewRect);
+ }
+ }
+
+ if(pAktCreate->ISA(SdrPathObj))
+ {
+ // The up-to-now created path needs to be set at the object to have something
+ // that can be visualized
+ SdrPathObj& rPathObj((SdrPathObj&)(*pAktCreate));
+ const basegfx::B2DPolyPolygon aCurrentPolyPolygon(rPathObj.getObjectPolyPolygon(aDragStat));
+
+ if(aCurrentPolyPolygon.count())
+ {
+ rPathObj.NbcSetPathPoly(aCurrentPolyPolygon);
+ }
+
+ aDragPolyPolygon = rPathObj.getDragPolyPolygon(aDragStat);
+ }
+
+ // use directly the SdrObject for overlay
+ mpCreateViewExtraData->CreateAndShowOverlay(*this, pAktCreate, aDragPolyPolygon);
+ }
+ else
+ {
+ 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(sal_True);
+ }
+}
+
+void SdrCreateView::HideCreateObj()
+{
+ if(IsCreateObj() && aDragStat.IsShown())
+ {
+ // for migration from XOR, replace DrawDragObj here to create
+ // overlay objects instead.
+ mpCreateViewExtraData->HideOverlay();
+
+ //DrawCreateObj(pOut,bFull);
+ aDragStat.SetShown(sal_False);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/* new interface src537 */
+sal_Bool SdrCreateView::GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr) const
+{
+ if(pAktCreate)
+ {
+ rTargetSet.Put(pAktCreate->GetMergedItemSet());
+ return sal_True;
+ }
+ else
+ {
+ return SdrDragView::GetAttributes(rTargetSet, bOnlyHardAttr);
+ }
+}
+
+sal_Bool SdrCreateView::SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll)
+{
+ if(pAktCreate)
+ {
+ pAktCreate->SetMergedItemSetAndBroadcast(rSet, bReplaceAll);
+
+ return sal_True;
+ }
+ else
+ {
+ return SdrDragView::SetAttributes(rSet,bReplaceAll);
+ }
+}
+
+SfxStyleSheet* SdrCreateView::GetStyleSheet() const // SfxStyleSheet* SdrCreateView::GetStyleSheet(sal_Bool& rOk) const
+{
+ if (pAktCreate!=NULL)
+ {
+ //rOk=sal_True;
+ return pAktCreate->GetStyleSheet();
+ }
+ else
+ {
+ return SdrDragView::GetStyleSheet(); // SdrDragView::GetStyleSheet(rOk);
+ }
+}
+
+sal_Bool SdrCreateView::SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr)
+{
+ if (pAktCreate!=NULL)
+ {
+ pAktCreate->SetStyleSheet(pStyleSheet,bDontRemoveHardAttr);
+ return sal_True;
+ }
+ else
+ {
+ return SdrDragView::SetStyleSheet(pStyleSheet,bDontRemoveHardAttr);
+ }
+}
+
diff --git a/svx/source/svdraw/svddrag.cxx b/svx/source/svdraw/svddrag.cxx
new file mode 100644
index 000000000000..c21d0e7bc631
--- /dev/null
+++ b/svx/source/svdraw/svddrag.cxx
@@ -0,0 +1,153 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/svdview.hxx>
+#include <svx/svddrag.hxx>
+
+void SdrDragStat::Clear(FASTBOOL bLeaveOne)
+{
+ void* pP=aPnts.First();
+ while (pP!=NULL) {
+ delete (Point*)pP;
+ pP=aPnts.Next();
+ }
+ if (pUser!=NULL) delete pUser;
+ pUser=NULL;
+ aPnts.Clear();
+ if (bLeaveOne) {
+ aPnts.Insert(new Point,CONTAINER_APPEND);
+ }
+}
+
+void SdrDragStat::Reset()
+{
+ pView=NULL;
+ pPageView=NULL;
+ bShown=sal_False;
+ nMinMov=1;
+ bMinMoved=sal_False;
+ bHorFixed=sal_False;
+ bVerFixed=sal_False;
+ bWantNoSnap=sal_False;
+ pHdl=NULL;
+ bOrtho4=sal_False;
+ bOrtho8=sal_False;
+ pDragMethod=NULL;
+ bEndDragChangesAttributes=sal_False;
+ bEndDragChangesGeoAndAttributes=sal_False;
+ bMouseIsUp=sal_False;
+ Clear(sal_True);
+ aActionRect=Rectangle();
+}
+
+void SdrDragStat::Reset(const Point& rPnt)
+{
+ Reset();
+ Start()=rPnt;
+ aPos0=rPnt;
+ aRealPos0=rPnt;
+ RealNow()=rPnt;
+}
+
+void SdrDragStat::NextMove(const Point& rPnt)
+{
+ aRealPos0=GetRealNow();
+ aPos0=GetNow();
+ RealNow()=rPnt;
+ Point aBla=KorregPos(GetRealNow(),GetPrev());
+ Now()=aBla;
+}
+
+void SdrDragStat::NextPoint(FASTBOOL bSaveReal)
+{
+ Point aPnt(GetNow());
+ if (bSaveReal) aPnt=aRealNow;
+ aPnts.Insert(new Point(KorregPos(GetRealNow(),aPnt)),CONTAINER_APPEND);
+ Prev()=aPnt;
+}
+
+void SdrDragStat::PrevPoint()
+{
+ if (aPnts.Count()>=2) { // einer muss immer da bleiben
+ Point* pPnt=(Point*)(aPnts.GetObject(aPnts.Count()-2));
+ aPnts.Remove(aPnts.Count()-2);
+ delete pPnt;
+ Now()=KorregPos(GetRealNow(),GetPrev());
+ }
+}
+
+Point SdrDragStat::KorregPos(const Point& rNow, const Point& /*rPrev*/) const
+{
+ Point aRet(rNow);
+ return aRet;
+}
+
+FASTBOOL SdrDragStat::CheckMinMoved(const Point& rPnt)
+{
+ if (!bMinMoved) {
+ long dx=rPnt.X()-GetPrev().X(); if (dx<0) dx=-dx;
+ long dy=rPnt.Y()-GetPrev().Y(); if (dy<0) dy=-dy;
+ if (dx>=long(nMinMov) || dy>=long(nMinMov))
+ bMinMoved=sal_True;
+ }
+ return bMinMoved;
+}
+
+Fraction SdrDragStat::GetXFact() const
+{
+ long nMul=GetNow().X()-aRef1.X();
+ long nDiv=GetPrev().X()-aRef1.X();
+ if (nDiv==0) nDiv=1;
+ if (bHorFixed) { nMul=1; nDiv=1; }
+ return Fraction(nMul,nDiv);
+}
+
+Fraction SdrDragStat::GetYFact() const
+{
+ long nMul=GetNow().Y()-aRef1.Y();
+ long nDiv=GetPrev().Y()-aRef1.Y();
+ if (nDiv==0) nDiv=1;
+ if (bVerFixed) { nMul=1; nDiv=1; }
+ return Fraction(nMul,nDiv);
+}
+
+void SdrDragStat::TakeCreateRect(Rectangle& rRect) const
+{
+ rRect=Rectangle(GetStart(),GetNow());
+ if (GetPointAnz()>=2) {
+ Point aBtmRgt(GetPoint(1));
+ rRect.Right()=aBtmRgt.X();
+ rRect.Bottom()=aBtmRgt.Y();
+ }
+ if (pView!=NULL && pView->IsCreate1stPointAsCenter()) {
+ rRect.Top()+=rRect.Top()-rRect.Bottom();
+ rRect.Left()+=rRect.Left()-rRect.Right();
+ }
+}
+
diff --git a/svx/source/svdraw/svddrgm1.hxx b/svx/source/svdraw/svddrgm1.hxx
new file mode 100644
index 000000000000..201d02e7b9f3
--- /dev/null
+++ b/svx/source/svdraw/svddrgm1.hxx
@@ -0,0 +1,277 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDDRGM1_HXX
+#define _SVDDRGM1_HXX
+
+#include <svx/xpoly.hxx>
+#include <svx/svdhdl.hxx>
+#include <svx/svddrgv.hxx>
+#include <svx/svddrgmt.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class SdrDragView;
+class SdrDragStat;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// SdrDragMovHdl
+
+class SdrDragMovHdl : public SdrDragMethod
+{
+private:
+ bool bMirrObjShown;
+
+protected:
+ // define nothing, overload to do so
+ virtual void createSdrDragEntries();
+
+public:
+ TYPEINFO();
+ SdrDragMovHdl(SdrDragView& rNewView);
+
+ virtual void TakeSdrDragComment(String& rStr) const;
+ virtual bool BeginSdrDrag();
+ virtual void MoveSdrDrag(const Point& rPnt);
+ virtual bool EndSdrDrag(bool bCopy);
+ virtual void CancelSdrDrag();
+ virtual Pointer GetSdrDragPointer() const;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// SdrDragRotate
+
+class SdrDragRotate : public SdrDragMethod
+{
+private:
+ double nSin;
+ double nCos;
+ long nWink0;
+ long nWink;
+ bool bRight;
+
+public:
+ TYPEINFO();
+ SdrDragRotate(SdrDragView& rNewView);
+
+ virtual void TakeSdrDragComment(String& rStr) const;
+ virtual bool BeginSdrDrag();
+ virtual void MoveSdrDrag(const Point& rPnt);
+ virtual bool EndSdrDrag(bool bCopy);
+ virtual Pointer GetSdrDragPointer() const;
+
+ virtual basegfx::B2DHomMatrix getCurrentTransformation();
+ virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget);
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// SdrDragShear
+
+class SdrDragShear : public SdrDragMethod
+{
+private:
+ Fraction aFact;
+ long nWink0;
+ long nWink;
+ double nTan;
+ bool bVertical; // Vertikales verzerren
+ bool bResize; // Shear mit Resize
+ bool bUpSideDown; // Beim Shear/Slant gespiegelt
+ bool bSlant;
+
+public:
+ TYPEINFO();
+ SdrDragShear(SdrDragView& rNewView,bool bSlant1);
+
+ virtual void TakeSdrDragComment(String& rStr) const;
+ virtual bool BeginSdrDrag();
+ virtual void MoveSdrDrag(const Point& rPnt);
+ virtual bool EndSdrDrag(bool bCopy);
+ virtual Pointer GetSdrDragPointer() const;
+
+ virtual basegfx::B2DHomMatrix getCurrentTransformation();
+ virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget);
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// SdrDragMirror
+
+class SdrDragMirror : public SdrDragMethod
+{
+private:
+ Point aDif;
+ long nWink;
+ bool bMirrored;
+ bool bSide0;
+
+ bool ImpCheckSide(const Point& rPnt) const;
+
+public:
+ TYPEINFO();
+ SdrDragMirror(SdrDragView& rNewView);
+
+ virtual void TakeSdrDragComment(String& rStr) const;
+ virtual bool BeginSdrDrag();
+ virtual void MoveSdrDrag(const Point& rPnt);
+ virtual bool EndSdrDrag(bool bCopy);
+ virtual Pointer GetSdrDragPointer() const;
+
+ virtual basegfx::B2DHomMatrix getCurrentTransformation();
+ virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget);
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// SdrDragGradient
+
+class SdrDragGradient : public SdrDragMethod
+{
+private:
+ // Handles to work on
+ SdrHdlGradient* pIAOHandle;
+
+ // is this for gradient (or for transparence) ?
+ unsigned bIsGradient : 1;
+
+public:
+ TYPEINFO();
+ SdrDragGradient(SdrDragView& rNewView, bool bGrad = true);
+
+ bool IsGradient() const { return bIsGradient; }
+
+ virtual void TakeSdrDragComment(String& rStr) const;
+ virtual bool BeginSdrDrag();
+ virtual void MoveSdrDrag(const Point& rPnt);
+ virtual bool EndSdrDrag(bool bCopy);
+ virtual Pointer GetSdrDragPointer() const;
+ virtual void CancelSdrDrag();
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// SdrDragCrook
+
+class SdrDragCrook : public SdrDragMethod
+{
+private:
+ Rectangle aMarkRect;
+ Point aMarkCenter;
+ Point aCenter;
+ Point aStart;
+ Fraction aFact;
+ Point aRad;
+ bool bContortionAllowed;
+ bool bNoContortionAllowed;
+ bool bContortion;
+ bool bResizeAllowed;
+ bool bResize;
+ bool bRotateAllowed;
+ bool bRotate;
+ bool bVertical;
+ bool bValid;
+ bool bLft;
+ bool bRgt;
+ bool bUpr;
+ bool bLwr;
+ bool bAtCenter;
+ long nWink;
+ long nMarkSize;
+ SdrCrookMode eMode;
+
+ // helpers for applyCurrentTransformationToPolyPolygon
+ void _MovAllPoints(basegfx::B2DPolyPolygon& rTarget);
+ void _MovCrookPoint(Point& rPnt, Point* pC1, Point* pC2);
+
+protected:
+ // needs to add drag geometry to the default
+ virtual void createSdrDragEntries();
+
+public:
+ TYPEINFO();
+ SdrDragCrook(SdrDragView& rNewView);
+
+ virtual void TakeSdrDragComment(String& rStr) const;
+ virtual bool BeginSdrDrag();
+ virtual void MoveSdrDrag(const Point& rPnt);
+ virtual bool EndSdrDrag(bool bCopy);
+ virtual Pointer GetSdrDragPointer() const;
+
+ virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget);
+ virtual void applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget);
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// SdrDragDistort
+
+class SdrDragDistort : public SdrDragMethod
+{
+private:
+ Rectangle aMarkRect;
+ XPolygon aDistortedRect;
+ sal_uInt16 nPolyPt;
+ bool bContortionAllowed;
+ bool bNoContortionAllowed;
+ bool bContortion;
+
+ // helper for applyCurrentTransformationToPolyPolygon
+ void _MovAllPoints(basegfx::B2DPolyPolygon& rTarget);
+
+protected:
+ // needs to add drag geometry to the default
+ virtual void createSdrDragEntries();
+
+public:
+ TYPEINFO();
+ SdrDragDistort(SdrDragView& rNewView);
+
+ virtual void TakeSdrDragComment(String& rStr) const;
+ virtual bool BeginSdrDrag();
+ virtual void MoveSdrDrag(const Point& rPnt);
+ virtual bool EndSdrDrag(bool bCopy);
+ virtual Pointer GetSdrDragPointer() const;
+
+ virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget);
+ virtual void applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget);
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// SdrDragCrop
+
+class SdrDragCrop : public SdrDragResize
+{
+public:
+ TYPEINFO();
+ SdrDragCrop(SdrDragView& rNewView);
+
+ virtual void TakeSdrDragComment(String& rStr) const;
+ virtual bool EndSdrDrag(bool bCopy);
+ virtual Pointer GetSdrDragPointer() const;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#endif //_SVDDRGM1_HXX
+
+// eof
diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
new file mode 100644
index 000000000000..afbb6d0b4066
--- /dev/null
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -0,0 +1,3662 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svddrgm1.hxx"
+#include <math.h>
+
+#ifndef _MATH_H
+#define _MATH_H
+#endif
+#include <tools/bigint.hxx>
+#include <vcl/svapp.hxx>
+
+#include "svx/xattr.hxx"
+#include <svx/xpoly.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/svdtrans.hxx>
+#include <svx/svdundo.hxx>
+#include <svx/svdmark.hxx>
+#include <svx/svdocapt.hxx>
+#include <svx/svdpagv.hxx>
+#include "svx/svdstr.hrc" // Namen aus der Resource
+#include "svx/svdglob.hxx" // StringCache
+#include <svx/svddrgv.hxx>
+#include <svx/svdundo.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <svx/sdgcpitm.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <svx/sdr/overlay/overlaypolypolygon.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <svx/sdr/overlay/overlayrollingrectangle.hxx>
+#include <svx/sdrpagewindow.hxx>
+#include <svx/sdrpaintwindow.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx>
+#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
+#include <svx/sdr/contact/objectcontact.hxx>
+#include "svx/svditer.hxx"
+#include <svx/svdopath.hxx>
+#include <svx/polypolygoneditor.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
+#include <drawinglayer/primitive2d/markerarrayprimitive2d.hxx>
+#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/svdovirt.hxx>
+#include <svx/svdouno.hxx>
+#include <svx/sdr/primitive2d/sdrprimitivetools.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <drawinglayer/attribute/sdrlineattribute.hxx>
+#include <drawinglayer/attribute/sdrlinestartendattribute.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrDragEntry::SdrDragEntry()
+: mbAddToTransparent(false)
+{
+}
+
+SdrDragEntry::~SdrDragEntry()
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrDragEntryPolyPolygon::SdrDragEntryPolyPolygon(const basegfx::B2DPolyPolygon& rOriginalPolyPolygon)
+: SdrDragEntry(),
+ maOriginalPolyPolygon(rOriginalPolyPolygon)
+{
+}
+
+SdrDragEntryPolyPolygon::~SdrDragEntryPolyPolygon()
+{
+}
+
+drawinglayer::primitive2d::Primitive2DSequence SdrDragEntryPolyPolygon::createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod)
+{
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
+
+ if(maOriginalPolyPolygon.count())
+ {
+ basegfx::B2DPolyPolygon aCopy(maOriginalPolyPolygon);
+ const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
+
+ rDragMethod.applyCurrentTransformationToPolyPolygon(aCopy);
+ basegfx::BColor aColA(aSvtOptionsDrawinglayer.GetStripeColorA().getBColor());
+ basegfx::BColor aColB(aSvtOptionsDrawinglayer.GetStripeColorB().getBColor());
+ const double fStripeLength(aSvtOptionsDrawinglayer.GetStripeLength());
+
+ if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
+ {
+ aColA = aColB = Application::GetSettings().GetStyleSettings().GetHighlightColor().getBColor();
+ aColB.invert();
+ }
+
+ drawinglayer::primitive2d::Primitive2DReference aPolyPolygonMarkerPrimitive2D(
+ new drawinglayer::primitive2d::PolyPolygonMarkerPrimitive2D(aCopy, aColA, aColB, fStripeLength));
+
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aPolyPolygonMarkerPrimitive2D, 1);
+ }
+
+ return aRetval;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrDragEntrySdrObject::SdrDragEntrySdrObject(const SdrObject& rOriginal, sdr::contact::ObjectContact& rObjectContact, bool bModify)
+: SdrDragEntry(),
+ maOriginal(rOriginal),
+ mpClone(0),
+ mrObjectContact(rObjectContact),
+ mbModify(bModify)
+{
+ // add SdrObject parts to transparent overlay stuff
+ setAddToTransparent(true);
+}
+
+SdrDragEntrySdrObject::~SdrDragEntrySdrObject()
+{
+ if(mpClone)
+ {
+ SdrObject::Free(mpClone);
+ }
+}
+
+drawinglayer::primitive2d::Primitive2DSequence SdrDragEntrySdrObject::createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod)
+{
+ // for the moment, i need to re-create the clone in all cases. I need to figure
+ // out when clone and original have the same class, so that i can use operator=
+ // in those cases
+
+ // // copy all other needed stuff
+ // basegfx::B2DHomMatrix aMatrix;
+ // basegfx::B2DPolyPolygon aPolyPolygon;
+ // pOleObject->TRGetBaseGeometry(aMatrix, aPolyPolygon);
+ // pClone->TRSetBaseGeometry(aMatrix, aPolyPolygon);
+
+ const SdrObject* pSource = &maOriginal;
+
+ if(mpClone)
+ {
+ SdrObject::Free(mpClone);
+ mpClone = 0;
+ }
+
+ if(mbModify)
+ {
+ if(!mpClone)
+ {
+ mpClone = maOriginal.getFullDragClone();
+ }
+
+ // apply original transformation, implemented at the DragMethods
+ rDragMethod.applyCurrentTransformationToSdrObject(*mpClone);
+
+ // choose source for geometry data
+ pSource = mpClone;
+ }
+
+ // get VOC and Primitive2DSequence
+ sdr::contact::ViewContact& rVC = pSource->GetViewContact();
+ sdr::contact::ViewObjectContact& rVOC = rVC.GetViewObjectContact(mrObjectContact);
+ sdr::contact::DisplayInfo aDisplayInfo;
+
+ // Do not use the last ViewPort set at the OC from the last ProcessDisplay(),
+ // here we want the complete primitive sequence without visibility clippings
+ mrObjectContact.resetViewPort();
+
+ return rVOC.getPrimitive2DSequenceHierarchy(aDisplayInfo);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrDragEntryPrimitive2DSequence::SdrDragEntryPrimitive2DSequence(
+ const drawinglayer::primitive2d::Primitive2DSequence& rSequence,
+ bool bAddToTransparent)
+: SdrDragEntry(),
+ maPrimitive2DSequence(rSequence)
+{
+ // add parts to transparent overlay stuff eventually
+ setAddToTransparent(bAddToTransparent);
+}
+
+SdrDragEntryPrimitive2DSequence::~SdrDragEntryPrimitive2DSequence()
+{
+}
+
+drawinglayer::primitive2d::Primitive2DSequence SdrDragEntryPrimitive2DSequence::createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod)
+{
+ drawinglayer::primitive2d::Primitive2DReference aTransformPrimitive2D(
+ new drawinglayer::primitive2d::TransformPrimitive2D(
+ rDragMethod.getCurrentTransformation(),
+ maPrimitive2DSequence));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&aTransformPrimitive2D, 1);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrDragEntryPointGlueDrag::SdrDragEntryPointGlueDrag(const std::vector< basegfx::B2DPoint >& rPositions, bool bIsPointDrag)
+: maPositions(rPositions),
+ mbIsPointDrag(bIsPointDrag)
+{
+ // add SdrObject parts to transparent overlay stuff
+ setAddToTransparent(true);
+}
+
+SdrDragEntryPointGlueDrag::~SdrDragEntryPointGlueDrag()
+{
+}
+
+drawinglayer::primitive2d::Primitive2DSequence SdrDragEntryPointGlueDrag::createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod)
+{
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
+
+ if(maPositions.size())
+ {
+ basegfx::B2DPolygon aPolygon;
+ sal_uInt32 a(0);
+
+ for(a = 0; a < maPositions.size(); a++)
+ {
+ aPolygon.append(maPositions[a]);
+ }
+
+ basegfx::B2DPolyPolygon aPolyPolygon(aPolygon);
+
+ rDragMethod.applyCurrentTransformationToPolyPolygon(aPolyPolygon);
+
+ const basegfx::B2DPolygon aTransformed(aPolyPolygon.getB2DPolygon(0));
+ std::vector< basegfx::B2DPoint > aTransformedPositions;
+
+ aTransformedPositions.reserve(aTransformed.count());
+
+ for(a = 0; a < aTransformed.count(); a++)
+ {
+ aTransformedPositions.push_back(aTransformed.getB2DPoint(a));
+ }
+
+ if(mbIsPointDrag)
+ {
+ const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
+ basegfx::BColor aColor(aSvtOptionsDrawinglayer.GetStripeColorA().getBColor());
+
+ if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
+ {
+ aColor = Application::GetSettings().GetStyleSettings().GetHighlightColor().getBColor();
+ }
+
+ drawinglayer::primitive2d::Primitive2DReference aMarkerArrayPrimitive2D(
+ new drawinglayer::primitive2d::MarkerArrayPrimitive2D(aTransformedPositions,
+ drawinglayer::primitive2d::createDefaultCross_3x3(aColor)));
+
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aMarkerArrayPrimitive2D, 1);
+ }
+ else
+ {
+ const basegfx::BColor aBackPen(1.0, 1.0, 1.0);
+ const basegfx::BColor aRGBFrontColor(0.0, 0.0, 1.0); // COL_LIGHTBLUE
+ drawinglayer::primitive2d::Primitive2DReference aMarkerArrayPrimitive2D(
+ new drawinglayer::primitive2d::MarkerArrayPrimitive2D(aTransformedPositions,
+ drawinglayer::primitive2d::createDefaultGluepoint_7x7(aBackPen, aRGBFrontColor)));
+
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aMarkerArrayPrimitive2D, 1);
+ }
+ }
+
+ return aRetval;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT0(SdrDragMethod);
+
+void SdrDragMethod::resetSdrDragEntries()
+{
+ // clear entries; creation is on demand
+ clearSdrDragEntries();
+}
+
+basegfx::B2DRange SdrDragMethod::getCurrentRange() const
+{
+ return getB2DRangeFromOverlayObjectList();
+}
+
+void SdrDragMethod::createSdrDragEntries()
+{
+ if(getSdrDragView().GetSdrPageView() && getSdrDragView().GetSdrPageView()->HasMarkedObjPageView())
+ {
+ if(getSdrDragView().IsDraggingPoints())
+ {
+ createSdrDragEntries_PointDrag();
+ }
+ else if(getSdrDragView().IsDraggingGluePoints())
+ {
+ createSdrDragEntries_GlueDrag();
+ }
+ else
+ {
+ if(getSolidDraggingActive())
+ {
+ createSdrDragEntries_SolidDrag();
+ }
+ else
+ {
+ createSdrDragEntries_PolygonDrag();
+ }
+ }
+ }
+}
+
+void SdrDragMethod::createSdrDragEntryForSdrObject(const SdrObject& rOriginal, sdr::contact::ObjectContact& rObjectContact, bool bModify)
+{
+ // add full obejct drag; Clone() at the object has to work
+ // for this
+ addSdrDragEntry(new SdrDragEntrySdrObject(rOriginal, rObjectContact, bModify));
+}
+
+void SdrDragMethod::createSdrDragEntries_SolidDrag()
+{
+ const sal_uInt32 nMarkAnz(getSdrDragView().GetMarkedObjectCount());
+ SdrPageView* pPV = getSdrDragView().GetSdrPageView();
+
+ if(pPV)
+ {
+ for(sal_uInt32 a(0); a < nMarkAnz; a++)
+ {
+ SdrMark* pM = getSdrDragView().GetSdrMarkByIndex(a);
+
+ if(pM->GetPageView() == pPV)
+ {
+ const SdrObject* pObject = pM->GetMarkedSdrObj();
+
+ if(pObject)
+ {
+ if(pPV->PageWindowCount())
+ {
+ sdr::contact::ObjectContact& rOC = pPV->GetPageWindow(0)->GetObjectContact();
+ SdrObjListIter aIter(*pObject);
+
+ while(aIter.IsMore())
+ {
+ SdrObject* pCandidate = aIter.Next();
+
+ if(pCandidate)
+ {
+ const bool bSuppressFullDrag(!pCandidate->supportsFullDrag());
+ bool bAddWireframe(bSuppressFullDrag);
+
+ if(!bAddWireframe && !pCandidate->HasLineStyle())
+ {
+ // add wireframe for objects without outline
+ bAddWireframe = true;
+ }
+
+ if(!bSuppressFullDrag)
+ {
+ // add full obejct drag; Clone() at the object has to work
+ // for this
+ createSdrDragEntryForSdrObject(*pCandidate, rOC, true);
+ }
+
+ if(bAddWireframe)
+ {
+ // when dragging a 50% transparent copy of a filled or not filled object without
+ // outline, this is normally hard to see. Add extra wireframe in that case. This
+ // works nice e.g. with thext frames etc.
+ addSdrDragEntry(new SdrDragEntryPolyPolygon(pCandidate->TakeXorPoly()));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+void SdrDragMethod::createSdrDragEntries_PolygonDrag()
+{
+ const sal_uInt32 nMarkAnz(getSdrDragView().GetMarkedObjectCount());
+ bool bNoPolygons(getSdrDragView().IsNoDragXorPolys() || nMarkAnz > getSdrDragView().GetDragXorPolyLimit());
+ basegfx::B2DPolyPolygon aResult;
+ sal_uInt32 nPointCount(0);
+
+ for(sal_uInt32 a(0); !bNoPolygons && a < nMarkAnz; a++)
+ {
+ SdrMark* pM = getSdrDragView().GetSdrMarkByIndex(a);
+
+ if(pM->GetPageView() == getSdrDragView().GetSdrPageView())
+ {
+ const basegfx::B2DPolyPolygon aNewPolyPolygon(pM->GetMarkedSdrObj()->TakeXorPoly());
+
+ for(sal_uInt32 b(0); b < aNewPolyPolygon.count(); b++)
+ {
+ nPointCount += aNewPolyPolygon.getB2DPolygon(b).count();
+ }
+
+ if(nPointCount > getSdrDragView().GetDragXorPointLimit())
+ {
+ bNoPolygons = true;
+ }
+
+ if(!bNoPolygons)
+ {
+ aResult.append(aNewPolyPolygon);
+ }
+ }
+ }
+
+ if(bNoPolygons)
+ {
+ const Rectangle aR(getSdrDragView().GetSdrPageView()->MarkSnap());
+ const basegfx::B2DRange aNewRectangle(aR.Left(), aR.Top(), aR.Right(), aR.Bottom());
+ basegfx::B2DPolygon aNewPolygon(basegfx::tools::createPolygonFromRect(aNewRectangle));
+
+ aResult = basegfx::B2DPolyPolygon(basegfx::tools::expandToCurve(aNewPolygon));
+ }
+
+ if(aResult.count())
+ {
+ addSdrDragEntry(new SdrDragEntryPolyPolygon(aResult));
+ }
+}
+
+void SdrDragMethod::createSdrDragEntries_PointDrag()
+{
+ const sal_uInt32 nMarkAnz(getSdrDragView().GetMarkedObjectCount());
+ std::vector< basegfx::B2DPoint > aPositions;
+
+ for(sal_uInt32 nm(0); nm < nMarkAnz; nm++)
+ {
+ SdrMark* pM = getSdrDragView().GetSdrMarkByIndex(nm);
+
+ if(pM->GetPageView() == getSdrDragView().GetSdrPageView())
+ {
+ const SdrUShortCont* pPts = pM->GetMarkedPoints();
+
+ if(pPts && pPts->GetCount())
+ {
+ const SdrObject* pObj = pM->GetMarkedSdrObj();
+ const SdrPathObj* pPath = dynamic_cast< const SdrPathObj* >(pObj);
+
+ if(pPath)
+ {
+ const basegfx::B2DPolyPolygon aPathXPP = pPath->GetPathPoly();
+
+ if(aPathXPP.count())
+ {
+ const sal_uInt32 nPtAnz(pPts->GetCount());
+
+ for(sal_uInt32 nPtNum(0); nPtNum < nPtAnz; nPtNum++)
+ {
+ sal_uInt32 nPolyNum, nPointNum;
+ const sal_uInt16 nObjPt(pPts->GetObject(nPtNum));
+
+ if(sdr::PolyPolygonEditor::GetRelativePolyPoint(aPathXPP, nObjPt, nPolyNum, nPointNum))
+ {
+ aPositions.push_back(aPathXPP.getB2DPolygon(nPolyNum).getB2DPoint(nPointNum));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if(aPositions.size())
+ {
+ addSdrDragEntry(new SdrDragEntryPointGlueDrag(aPositions, true));
+ }
+}
+
+void SdrDragMethod::createSdrDragEntries_GlueDrag()
+{
+ const sal_uInt32 nMarkAnz(getSdrDragView().GetMarkedObjectCount());
+ std::vector< basegfx::B2DPoint > aPositions;
+
+ for(sal_uInt32 nm(0); nm < nMarkAnz; nm++)
+ {
+ SdrMark* pM = getSdrDragView().GetSdrMarkByIndex(nm);
+
+ if(pM->GetPageView() == getSdrDragView().GetSdrPageView())
+ {
+ const SdrUShortCont* pPts = pM->GetMarkedGluePoints();
+
+ if(pPts && pPts->GetCount())
+ {
+ const SdrObject* pObj = pM->GetMarkedSdrObj();
+ const SdrGluePointList* pGPL = pObj->GetGluePointList();
+
+ if(pGPL)
+ {
+ const sal_uInt32 nPtAnz(pPts->GetCount());
+
+ for(sal_uInt32 nPtNum(0); nPtNum < nPtAnz; nPtNum++)
+ {
+ const sal_uInt16 nObjPt(pPts->GetObject(nPtNum));
+ const sal_uInt16 nGlueNum(pGPL->FindGluePoint(nObjPt));
+
+ if(SDRGLUEPOINT_NOTFOUND != nGlueNum)
+ {
+ const Point aPoint((*pGPL)[nGlueNum].GetAbsolutePos(*pObj));
+ aPositions.push_back(basegfx::B2DPoint(aPoint.X(), aPoint.Y()));
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if(aPositions.size())
+ {
+ addSdrDragEntry(new SdrDragEntryPointGlueDrag(aPositions, false));
+ }
+}
+
+void SdrDragMethod::ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, XubString& rStr, sal_uInt16 nVal) const
+{
+ sal_uInt16 nOpt=0;
+ if (IsDraggingPoints()) {
+ nOpt=IMPSDR_POINTSDESCRIPTION;
+ } else if (IsDraggingGluePoints()) {
+ nOpt=IMPSDR_GLUEPOINTSDESCRIPTION;
+ }
+ getSdrDragView().ImpTakeDescriptionStr(nStrCacheID,rStr,nVal,nOpt);
+}
+
+SdrObject* SdrDragMethod::GetDragObj() const
+{
+ SdrObject* pObj=NULL;
+ if (getSdrDragView().pDragHdl!=NULL) pObj=getSdrDragView().pDragHdl->GetObj();
+ if (pObj==NULL) pObj=getSdrDragView().pMarkedObj;
+ return pObj;
+}
+
+SdrPageView* SdrDragMethod::GetDragPV() const
+{
+ SdrPageView* pPV=NULL;
+ if (getSdrDragView().pDragHdl!=NULL) pPV=getSdrDragView().pDragHdl->GetPageView();
+ if (pPV==NULL) pPV=getSdrDragView().pMarkedPV;
+ return pPV;
+}
+
+void SdrDragMethod::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
+{
+ // the original applies the transformation using TRGetBaseGeometry/TRSetBaseGeometry.
+ // Later this should be the only needed one for linear transforms (not for SdrDragCrook and
+ // SdrDragDistort, those are NOT linear). Currently, this can not yet be used since the
+ // special handling of rotate/mirror due to the not-being-able to handle it in the old
+ // drawinglayer stuff. Text would currently not correctly be mirrored in the preview.
+ basegfx::B2DHomMatrix aObjectTransform;
+ basegfx::B2DPolyPolygon aObjectPolyPolygon;
+ bool bPolyUsed(rTarget.TRGetBaseGeometry(aObjectTransform, aObjectPolyPolygon));
+
+ // apply transform to object transform
+ aObjectTransform *= getCurrentTransformation();
+
+ if(bPolyUsed)
+ {
+ // do something special since the object size is in the polygon
+ // break up matrix to get the scale
+ basegfx::B2DTuple aScale;
+ basegfx::B2DTuple aTranslate;
+ double fRotate, fShearX;
+ aObjectTransform.decompose(aScale, aTranslate, fRotate, fShearX);
+
+ // get polygon's pos and size
+ const basegfx::B2DRange aPolyRange(aObjectPolyPolygon.getB2DRange());
+
+ // get the scaling factors (do not mirror, this is in the object transformation)
+ const double fScaleX(fabs(aScale.getX()) / (basegfx::fTools::equalZero(aPolyRange.getWidth()) ? 1.0 : aPolyRange.getWidth()));
+ const double fScaleY(fabs(aScale.getY()) / (basegfx::fTools::equalZero(aPolyRange.getHeight()) ? 1.0 : aPolyRange.getHeight()));
+
+ // prepare transform matrix for polygon
+ basegfx::B2DHomMatrix aPolyTransform(basegfx::tools::createTranslateB2DHomMatrix(
+ -aPolyRange.getMinX(), -aPolyRange.getMinY()));
+ aPolyTransform.scale(fScaleX, fScaleY);
+
+ // normally the poly should be moved back, but the translation is in the object
+ // transformation and thus does not need to be done
+ // aPolyTransform.translate(-aPolyRange.getMinX(), -aPolyRange.getMinY());
+
+ // transform the polygon
+ aObjectPolyPolygon.transform(aPolyTransform);
+ }
+
+ rTarget.TRSetBaseGeometry(getCurrentTransformation() * aObjectTransform, aObjectPolyPolygon);
+}
+
+void SdrDragMethod::applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget)
+{
+ // original uses CurrentTransformation
+ rTarget.transform(getCurrentTransformation());
+}
+
+SdrDragMethod::SdrDragMethod(SdrDragView& rNewView)
+: maSdrDragEntries(),
+ maOverlayObjectList(),
+ mrSdrDragView(rNewView),
+ mbMoveOnly(false),
+ mbSolidDraggingActive(getSdrDragView().IsSolidDragging())
+{
+ if(mbSolidDraggingActive && Application::GetSettings().GetStyleSettings().GetHighContrastMode())
+ {
+ // fallback to wireframe when high contrast is used
+ mbSolidDraggingActive = false;
+ }
+}
+
+SdrDragMethod::~SdrDragMethod()
+{
+ clearSdrDragEntries();
+}
+
+void SdrDragMethod::Show()
+{
+ getSdrDragView().ShowDragObj();
+}
+
+void SdrDragMethod::Hide()
+{
+ getSdrDragView().HideDragObj();
+}
+
+basegfx::B2DHomMatrix SdrDragMethod::getCurrentTransformation()
+{
+ return basegfx::B2DHomMatrix();
+}
+
+void SdrDragMethod::CancelSdrDrag()
+{
+ Hide();
+}
+
+void SdrDragMethod::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlayManager)
+{
+ // create SdrDragEntries on demand
+ if(!maSdrDragEntries.size())
+ {
+ createSdrDragEntries();
+ }
+
+ // if there are entries, derive OverlayObjects from the entries, including
+ // modification from current interactive state
+ if(maSdrDragEntries.size())
+ {
+ drawinglayer::primitive2d::Primitive2DSequence aResult;
+ drawinglayer::primitive2d::Primitive2DSequence aResultTransparent;
+
+ for(sal_uInt32 a(0); a < maSdrDragEntries.size(); a++)
+ {
+ SdrDragEntry* pCandidate = maSdrDragEntries[a];
+
+ if(pCandidate)
+ {
+ const drawinglayer::primitive2d::Primitive2DSequence aCandidateResult(pCandidate->createPrimitive2DSequenceInCurrentState(*this));
+
+ if(aCandidateResult.hasElements())
+ {
+ if(pCandidate->getAddToTransparent())
+ {
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aResultTransparent, aCandidateResult);
+ }
+ else
+ {
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aResult, aCandidateResult);
+ }
+ }
+ }
+ }
+
+ if(DoAddConnectorOverlays())
+ {
+ const drawinglayer::primitive2d::Primitive2DSequence aConnectorOverlays(AddConnectorOverlays());
+
+ if(aConnectorOverlays.hasElements())
+ {
+ // add connector overlays to transparent part
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aResultTransparent, aConnectorOverlays);
+ }
+ }
+
+ if(aResult.hasElements())
+ {
+ sdr::overlay::OverlayObject* pNewOverlayObject = new sdr::overlay::OverlayPrimitive2DSequenceObject(aResult);
+ rOverlayManager.add(*pNewOverlayObject);
+ addToOverlayObjectList(*pNewOverlayObject);
+ }
+
+ if(aResultTransparent.hasElements())
+ {
+ drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparencePrimitive2D(new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(aResultTransparent, 0.5));
+ aResultTransparent = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparencePrimitive2D, 1);
+
+ sdr::overlay::OverlayObject* pNewOverlayObject = new sdr::overlay::OverlayPrimitive2DSequenceObject(aResultTransparent);
+ rOverlayManager.add(*pNewOverlayObject);
+ addToOverlayObjectList(*pNewOverlayObject);
+ }
+ }
+
+ // evtl add DragStripes (help lines cross the page when dragging)
+ if(getSdrDragView().IsDragStripes())
+ {
+ Rectangle aActionRectangle;
+ getSdrDragView().TakeActionRect(aActionRectangle);
+
+ const basegfx::B2DPoint aTopLeft(aActionRectangle.Left(), aActionRectangle.Top());
+ const basegfx::B2DPoint aBottomRight(aActionRectangle.Right(), aActionRectangle.Bottom());
+ sdr::overlay::OverlayRollingRectangleStriped* pNew = new sdr::overlay::OverlayRollingRectangleStriped(
+ aTopLeft, aBottomRight, true, false);
+
+ rOverlayManager.add(*pNew);
+ addToOverlayObjectList(*pNew);
+ }
+}
+
+void SdrDragMethod::destroyOverlayGeometry()
+{
+ clearOverlayObjectList();
+}
+
+bool SdrDragMethod::DoAddConnectorOverlays()
+{
+ // these conditions are translated from SdrDragView::ImpDrawEdgeXor
+ const SdrMarkList& rMarkedNodes = getSdrDragView().GetEdgesOfMarkedNodes();
+
+ if(!rMarkedNodes.GetMarkCount())
+ {
+ return false;
+ }
+
+ if(!getSdrDragView().IsRubberEdgeDragging() && !getSdrDragView().IsDetailedEdgeDragging())
+ {
+ return false;
+ }
+
+ if(getSdrDragView().IsDraggingPoints() || getSdrDragView().IsDraggingGluePoints())
+ {
+ return false;
+ }
+
+ if(!getMoveOnly() && !(
+ IS_TYPE(SdrDragMove, this) || IS_TYPE(SdrDragResize, this) ||
+ IS_TYPE(SdrDragRotate,this) || IS_TYPE(SdrDragMirror,this)))
+ {
+ return false;
+ }
+
+ const bool bDetail(getSdrDragView().IsDetailedEdgeDragging() && getMoveOnly());
+
+ if(!bDetail && !getSdrDragView().IsRubberEdgeDragging())
+ {
+ return false;
+ }
+
+ // one more migrated from SdrEdgeObj::NspToggleEdgeXor
+ if(IS_TYPE(SdrDragObjOwn, this) || IS_TYPE(SdrDragMovHdl, this))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+drawinglayer::primitive2d::Primitive2DSequence SdrDragMethod::AddConnectorOverlays()
+{
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
+ const bool bDetail(getSdrDragView().IsDetailedEdgeDragging() && getMoveOnly());
+ const SdrMarkList& rMarkedNodes = getSdrDragView().GetEdgesOfMarkedNodes();
+
+ for(sal_uInt16 a(0); a < rMarkedNodes.GetMarkCount(); a++)
+ {
+ SdrMark* pEM = rMarkedNodes.GetMark(a);
+
+ if(pEM && pEM->GetMarkedSdrObj())
+ {
+ SdrEdgeObj* pEdge = dynamic_cast< SdrEdgeObj* >(pEM->GetMarkedSdrObj());
+
+ if(pEdge)
+ {
+ const basegfx::B2DPolygon aEdgePolygon(pEdge->ImplAddConnectorOverlay(*this, pEM->IsCon1(), pEM->IsCon2(), bDetail));
+
+ if(aEdgePolygon.count())
+ {
+ // this polygon is a temporary calculated connector path, so it is not possible to fetch
+ // the needed primitives directly from the pEdge object which does not get changed. If full
+ // drag is on, use the SdrObjects ItemSet to create a adequate representation
+ bool bUseSolidDragging(getSolidDraggingActive());
+
+ if(bUseSolidDragging)
+ {
+ // switch off solid dragging if connector is not visible
+ if(!pEdge->HasLineStyle())
+ {
+ bUseSolidDragging = false;
+ }
+ }
+
+ if(bUseSolidDragging)
+ {
+ const SfxItemSet& rItemSet = pEdge->GetMergedItemSet();
+ const drawinglayer::attribute::SdrLineAttribute aLine(
+ drawinglayer::primitive2d::createNewSdrLineAttribute(rItemSet));
+
+ if(!aLine.isDefault())
+ {
+ const drawinglayer::attribute::SdrLineStartEndAttribute aLineStartEnd(
+ drawinglayer::primitive2d::createNewSdrLineStartEndAttribute(
+ rItemSet,
+ aLine.getWidth()));
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(
+ aRetval, drawinglayer::primitive2d::createPolygonLinePrimitive(
+ aEdgePolygon,
+ basegfx::B2DHomMatrix(),
+ aLine,
+ aLineStartEnd));
+ }
+ }
+ else
+ {
+ const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
+ basegfx::BColor aColA(aSvtOptionsDrawinglayer.GetStripeColorA().getBColor());
+ basegfx::BColor aColB(aSvtOptionsDrawinglayer.GetStripeColorB().getBColor());
+ const double fStripeLength(aSvtOptionsDrawinglayer.GetStripeLength());
+
+ if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
+ {
+ aColA = aColB = Application::GetSettings().GetStyleSettings().GetHighlightColor().getBColor();
+ aColB.invert();
+ }
+
+ drawinglayer::primitive2d::Primitive2DReference aPolyPolygonMarkerPrimitive2D(
+ new drawinglayer::primitive2d::PolyPolygonMarkerPrimitive2D(
+ basegfx::B2DPolyPolygon(aEdgePolygon), aColA, aColB, fStripeLength));
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aPolyPolygonMarkerPrimitive2D);
+ }
+ }
+ }
+ }
+ }
+
+ return aRetval;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(SdrDragMovHdl,SdrDragMethod);
+
+SdrDragMovHdl::SdrDragMovHdl(SdrDragView& rNewView)
+: SdrDragMethod(rNewView),
+ bMirrObjShown(false)
+{
+}
+
+void SdrDragMovHdl::createSdrDragEntries()
+{
+ // SdrDragMovHdl does not use the default drags,
+ // but creates nothing
+}
+
+void SdrDragMovHdl::TakeSdrDragComment(XubString& rStr) const
+{
+ rStr=ImpGetResStr(STR_DragMethMovHdl);
+ if (getSdrDragView().IsDragWithCopy()) rStr+=ImpGetResStr(STR_EditWithCopy);
+}
+
+bool SdrDragMovHdl::BeginSdrDrag()
+{
+ if( !GetDragHdl() )
+ return false;
+
+ DragStat().Ref1()=GetDragHdl()->GetPos();
+ DragStat().SetShown(!DragStat().IsShown());
+ SdrHdlKind eKind=GetDragHdl()->GetKind();
+ SdrHdl* pH1=GetHdlList().GetHdl(HDL_REF1);
+ SdrHdl* pH2=GetHdlList().GetHdl(HDL_REF2);
+
+ if (eKind==HDL_MIRX)
+ {
+ if (pH1==NULL || pH2==NULL)
+ {
+ DBG_ERROR("SdrDragMovHdl::BeginSdrDrag(): Verschieben der Spiegelachse: Referenzhandles nicht gefunden");
+ return false;
+ }
+
+ DragStat().SetActionRect(Rectangle(pH1->GetPos(),pH2->GetPos()));
+ }
+ else
+ {
+ Point aPt(GetDragHdl()->GetPos());
+ DragStat().SetActionRect(Rectangle(aPt,aPt));
+ }
+
+ return true;
+}
+
+void SdrDragMovHdl::MoveSdrDrag(const Point& rNoSnapPnt)
+{
+ Point aPnt(rNoSnapPnt);
+
+ if ( GetDragHdl() && DragStat().CheckMinMoved(rNoSnapPnt))
+ {
+ if (GetDragHdl()->GetKind()==HDL_MIRX)
+ {
+ SdrHdl* pH1=GetHdlList().GetHdl(HDL_REF1);
+ SdrHdl* pH2=GetHdlList().GetHdl(HDL_REF2);
+
+ if (pH1==NULL || pH2==NULL)
+ return;
+
+ if (!DragStat().IsNoSnap())
+ {
+ long nBestXSnap=0;
+ long nBestYSnap=0;
+ bool bXSnapped=false;
+ bool bYSnapped=false;
+ Point aDif(aPnt-DragStat().GetStart());
+ getSdrDragView().CheckSnap(Ref1()+aDif,NULL,nBestXSnap,nBestYSnap,bXSnapped,bYSnapped);
+ getSdrDragView().CheckSnap(Ref2()+aDif,NULL,nBestXSnap,nBestYSnap,bXSnapped,bYSnapped);
+ aPnt.X()+=nBestXSnap;
+ aPnt.Y()+=nBestYSnap;
+ }
+
+ if (aPnt!=DragStat().GetNow())
+ {
+ Hide();
+ DragStat().NextMove(aPnt);
+ Point aDif(DragStat().GetNow()-DragStat().GetStart());
+ pH1->SetPos(Ref1()+aDif);
+ pH2->SetPos(Ref2()+aDif);
+
+ SdrHdl* pHM = GetHdlList().GetHdl(HDL_MIRX);
+
+ if(pHM)
+ pHM->Touch();
+
+ Show();
+ DragStat().SetActionRect(Rectangle(pH1->GetPos(),pH2->GetPos()));
+ }
+ }
+ else
+ {
+ if (!DragStat().IsNoSnap()) SnapPos(aPnt);
+ long nSA=0;
+
+ if (getSdrDragView().IsAngleSnapEnabled())
+ nSA=getSdrDragView().GetSnapAngle();
+
+ if (getSdrDragView().IsMirrorAllowed(true,true))
+ { // eingeschraenkt
+ if (!getSdrDragView().IsMirrorAllowed(false,false)) nSA=4500;
+ if (!getSdrDragView().IsMirrorAllowed(true,false)) nSA=9000;
+ }
+
+ if (getSdrDragView().IsOrtho() && nSA!=9000)
+ nSA=4500;
+
+ if (nSA!=0)
+ { // Winkelfang
+ SdrHdlKind eRef=HDL_REF1;
+
+ if (GetDragHdl()->GetKind()==HDL_REF1)
+ eRef=HDL_REF2;
+
+ SdrHdl* pH=GetHdlList().GetHdl(eRef);
+
+ if (pH!=NULL)
+ {
+ Point aRef(pH->GetPos());
+ long nWink=NormAngle360(GetAngle(aPnt-aRef));
+ long nNeuWink=nWink;
+ nNeuWink+=nSA/2;
+ nNeuWink/=nSA;
+ nNeuWink*=nSA;
+ nNeuWink=NormAngle360(nNeuWink);
+ double a=(nNeuWink-nWink)*nPi180;
+ double nSin=sin(a);
+ double nCos=cos(a);
+ RotatePoint(aPnt,aRef,nSin,nCos);
+
+ // Bei bestimmten Werten Rundungsfehler ausschliessen:
+ if (nSA==9000)
+ {
+ if (nNeuWink==0 || nNeuWink==18000) aPnt.Y()=aRef.Y();
+ if (nNeuWink==9000 || nNeuWink==27000) aPnt.X()=aRef.X();
+ }
+
+ if (nSA==4500)
+ OrthoDistance8(aRef,aPnt,true);
+ }
+ }
+
+ if (aPnt!=DragStat().GetNow())
+ {
+ Hide();
+ DragStat().NextMove(aPnt);
+ GetDragHdl()->SetPos(DragStat().GetNow());
+ SdrHdl* pHM = GetHdlList().GetHdl(HDL_MIRX);
+
+ if(pHM)
+ pHM->Touch();
+
+ Show();
+ DragStat().SetActionRect(Rectangle(aPnt,aPnt));
+ }
+ }
+ }
+}
+
+bool SdrDragMovHdl::EndSdrDrag(bool /*bCopy*/)
+{
+ if( GetDragHdl() )
+ {
+ switch (GetDragHdl()->GetKind())
+ {
+ case HDL_REF1:
+ Ref1()=DragStat().GetNow();
+ break;
+
+ case HDL_REF2:
+ Ref2()=DragStat().GetNow();
+ break;
+
+ case HDL_MIRX:
+ Ref1()+=DragStat().GetNow()-DragStat().GetStart();
+ Ref2()+=DragStat().GetNow()-DragStat().GetStart();
+ break;
+
+ default: break;
+ }
+ }
+
+ return true;
+}
+
+void SdrDragMovHdl::CancelSdrDrag()
+{
+ Hide();
+
+ SdrHdl* pHdl = GetDragHdl();
+ if( pHdl )
+ pHdl->SetPos(DragStat().GetRef1());
+
+ SdrHdl* pHM = GetHdlList().GetHdl(HDL_MIRX);
+
+ if(pHM)
+ pHM->Touch();
+}
+
+Pointer SdrDragMovHdl::GetSdrDragPointer() const
+{
+ const SdrHdl* pHdl = GetDragHdl();
+
+ if (pHdl!=NULL)
+ {
+ return pHdl->GetPointer();
+ }
+
+ return Pointer(POINTER_REFHAND);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(SdrDragObjOwn,SdrDragMethod);
+
+SdrDragObjOwn::SdrDragObjOwn(SdrDragView& rNewView)
+: SdrDragMethod(rNewView),
+ mpClone(0)
+{
+ const SdrObject* pObj = GetDragObj();
+
+ if(pObj)
+ {
+ // suppress full drag for some object types
+ setSolidDraggingActive(pObj->supportsFullDrag());
+ }
+}
+
+SdrDragObjOwn::~SdrDragObjOwn()
+{
+ if(mpClone)
+ {
+ SdrObject::Free(mpClone);
+ }
+}
+
+void SdrDragObjOwn::createSdrDragEntries()
+{
+ if(mpClone)
+ {
+ basegfx::B2DPolyPolygon aDragPolyPolygon;
+ bool bAddWireframe(true);
+
+ if(getSolidDraggingActive())
+ {
+ SdrPageView* pPV = getSdrDragView().GetSdrPageView();
+
+ if(pPV && pPV->PageWindowCount())
+ {
+ sdr::contact::ObjectContact& rOC = pPV->GetPageWindow(0)->GetObjectContact();
+ addSdrDragEntry(new SdrDragEntrySdrObject(*mpClone, rOC, false));
+
+ // potentially no wireframe needed, full drag works
+ bAddWireframe = false;
+ }
+ }
+
+ if(!bAddWireframe)
+ {
+ // check for extra conditions for wireframe, e.g. no border at
+ // objects
+ if(!mpClone->HasLineStyle())
+ {
+ bAddWireframe = true;
+ }
+ }
+
+ if(bAddWireframe)
+ {
+ // use wireframe poly when full drag is off or did not work
+ aDragPolyPolygon = mpClone->TakeXorPoly();
+ }
+
+ // add evtl. extra DragPolyPolygon
+ const basegfx::B2DPolyPolygon aSpecialDragPolyPolygon(mpClone->getSpecialDragPoly(DragStat()));
+
+ if(aSpecialDragPolyPolygon.count())
+ {
+ aDragPolyPolygon.append(aSpecialDragPolyPolygon);
+ }
+
+ if(aDragPolyPolygon.count())
+ {
+ addSdrDragEntry(new SdrDragEntryPolyPolygon(aDragPolyPolygon));
+ }
+ }
+}
+
+void SdrDragObjOwn::TakeSdrDragComment(XubString& rStr) const
+{
+ // #i103058# get info string from the clone preferred, the original will
+ // not be changed. For security, use original as fallback
+ if(mpClone)
+ {
+ rStr = mpClone->getSpecialDragComment(DragStat());
+ }
+ else
+ {
+ const SdrObject* pObj = GetDragObj();
+
+ if(pObj)
+ {
+ rStr = pObj->getSpecialDragComment(DragStat());
+ }
+ }
+}
+
+bool SdrDragObjOwn::BeginSdrDrag()
+{
+ if(!mpClone)
+ {
+ const SdrObject* pObj = GetDragObj();
+
+ if(pObj && !pObj->IsResizeProtect())
+ {
+ if(pObj->beginSpecialDrag(DragStat()))
+ {
+ // create nitial clone to have a start visualisation
+ mpClone = pObj->getFullDragClone();
+ mpClone->applySpecialDrag(DragStat());
+
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+void SdrDragObjOwn::MoveSdrDrag(const Point& rNoSnapPnt)
+{
+ const SdrObject* pObj = GetDragObj();
+
+ if(pObj)
+ {
+ Point aPnt(rNoSnapPnt);
+ SdrPageView* pPV = GetDragPV();
+
+ if(pPV)
+ {
+ if(!DragStat().IsNoSnap())
+ {
+ SnapPos(aPnt);
+ }
+
+ if(getSdrDragView().IsOrtho())
+ {
+ if (DragStat().IsOrtho8Possible())
+ {
+ OrthoDistance8(DragStat().GetStart(),aPnt,getSdrDragView().IsBigOrtho());
+ }
+ else if (DragStat().IsOrtho4Possible())
+ {
+ OrthoDistance4(DragStat().GetStart(),aPnt,getSdrDragView().IsBigOrtho());
+ }
+ }
+
+ if(DragStat().CheckMinMoved(rNoSnapPnt))
+ {
+ if(aPnt != DragStat().GetNow())
+ {
+ Hide();
+ DragStat().NextMove(aPnt);
+
+ // since SdrDragObjOwn currently supports no transformation of
+ // existing SdrDragEntries but only their recreation, a recreation
+ // after every move is needed in this mode. Delete existing
+ // SdrDragEntries here to force their recreation in the following Show().
+ clearSdrDragEntries();
+
+ // delete current clone (after the last reference to it is deleted above)
+ if(mpClone)
+ {
+ SdrObject::Free(mpClone);
+ mpClone = 0;
+ }
+
+ // create a new clone and modify to current drag state
+ if(!mpClone)
+ {
+ mpClone = pObj->getFullDragClone();
+ mpClone->applySpecialDrag(DragStat());
+ }
+
+ Show();
+ }
+ }
+ }
+ }
+}
+
+bool SdrDragObjOwn::EndSdrDrag(bool /*bCopy*/)
+{
+ Hide();
+ SdrUndoAction* pUndo = NULL;
+ SdrUndoAction* pUndo2 = NULL;
+ std::vector< SdrUndoAction* > vConnectorUndoActions;
+ bool bRet = false;
+ SdrObject* pObj = GetDragObj();
+
+ if(pObj)
+ {
+ const bool bUndo = getSdrDragView().IsUndoEnabled();
+
+ if( bUndo )
+ {
+ if(!getSdrDragView().IsInsObjPoint() && pObj->IsInserted() )
+ {
+ if (DragStat().IsEndDragChangesAttributes())
+ {
+ pUndo=getSdrDragView().GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj);
+
+ if (DragStat().IsEndDragChangesGeoAndAttributes())
+ {
+ vConnectorUndoActions = getSdrDragView().CreateConnectorUndo( *pObj );
+ pUndo2 = getSdrDragView().GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj);
+ }
+ }
+ else
+ {
+ vConnectorUndoActions = getSdrDragView().CreateConnectorUndo( *pObj );
+ pUndo= getSdrDragView().GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj);
+ }
+ }
+
+ if( pUndo )
+ {
+ getSdrDragView().BegUndo( pUndo->GetComment() );
+ }
+ else
+ {
+ getSdrDragView().BegUndo();
+ }
+ }
+
+ // evtl. use opertator= for setting changed object data (do not change selection in
+ // view, this will destroy the interactor). This is possible since a clone is now
+ // directly modified by the modifiers. Only SdrTableObj is adding own UNDOs
+ // in it's SdrTableObj::endSpecialDrag, so currently not possible. OTOH it uses
+ // a CreateUndoGeoObject() so maybe setting SetEndDragChangesAttributes is okay. I
+ // will test this now
+ Rectangle aBoundRect0;
+
+ if(pObj->GetUserCall())
+ {
+ aBoundRect0 = pObj->GetLastBoundRect();
+ }
+
+ bRet = pObj->applySpecialDrag(DragStat());
+
+ if(bRet)
+ {
+ pObj->SetChanged();
+ pObj->BroadcastObjectChange();
+ pObj->SendUserCall( SDRUSERCALL_RESIZE, aBoundRect0 );
+ }
+
+ if(bRet)
+ {
+ if( bUndo )
+ {
+ getSdrDragView().AddUndoActions( vConnectorUndoActions );
+
+ if ( pUndo )
+ {
+ getSdrDragView().AddUndo(pUndo);
+ }
+
+ if ( pUndo2 )
+ {
+ getSdrDragView().AddUndo(pUndo2);
+ }
+ }
+ }
+ else
+ {
+ if( bUndo )
+ {
+ std::vector< SdrUndoAction* >::iterator vConnectorUndoIter( vConnectorUndoActions.begin() );
+
+ while( vConnectorUndoIter != vConnectorUndoActions.end() )
+ {
+ delete *vConnectorUndoIter++;
+ }
+
+ delete pUndo;
+ delete pUndo2;
+ }
+ }
+
+ if( bUndo )
+ getSdrDragView().EndUndo();
+ }
+
+ return bRet;
+}
+
+Pointer SdrDragObjOwn::GetSdrDragPointer() const
+{
+ const SdrHdl* pHdl=GetDragHdl();
+
+ if (pHdl)
+ {
+ return pHdl->GetPointer();
+ }
+
+ return Pointer(POINTER_MOVE);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(SdrDragMove,SdrDragMethod);
+
+void SdrDragMove::createSdrDragEntryForSdrObject(const SdrObject& rOriginal, sdr::contact::ObjectContact& rObjectContact, bool /*bModify*/)
+{
+ // for SdrDragMove, use current Primitive2DSequence of SdrObject visualisation
+ // in given ObjectContact directly
+ sdr::contact::ViewContact& rVC = rOriginal.GetViewContact();
+ sdr::contact::ViewObjectContact& rVOC = rVC.GetViewObjectContact(rObjectContact);
+ sdr::contact::DisplayInfo aDisplayInfo;
+
+ // Do not use the last ViewPort set at the OC from the last ProcessDisplay(),
+ // here we want the complete primitive sequence without visibility clippings
+ rObjectContact.resetViewPort();
+
+ addSdrDragEntry(new SdrDragEntryPrimitive2DSequence(rVOC.getPrimitive2DSequenceHierarchy(aDisplayInfo), true));
+}
+
+void SdrDragMove::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
+{
+ rTarget.Move(Size(DragStat().GetDX(), DragStat().GetDY()));
+}
+
+SdrDragMove::SdrDragMove(SdrDragView& rNewView)
+: SdrDragMethod(rNewView)
+{
+ setMoveOnly(true);
+}
+
+void SdrDragMove::TakeSdrDragComment(XubString& rStr) const
+{
+ XubString aStr;
+
+ ImpTakeDescriptionStr(STR_DragMethMove, rStr);
+ rStr.AppendAscii(" (x=");
+ getSdrDragView().GetModel()->TakeMetricStr(DragStat().GetDX(), aStr);
+ rStr += aStr;
+ rStr.AppendAscii(" y=");
+ getSdrDragView().GetModel()->TakeMetricStr(DragStat().GetDY(), aStr);
+ rStr += aStr;
+ rStr += sal_Unicode(')');
+
+ if(getSdrDragView().IsDragWithCopy())
+ {
+ if(!getSdrDragView().IsInsObjPoint() && !getSdrDragView().IsInsGluePoint())
+ {
+ rStr += ImpGetResStr(STR_EditWithCopy);
+ }
+ }
+}
+
+bool SdrDragMove::BeginSdrDrag()
+{
+ DragStat().SetActionRect(GetMarkedRect());
+ Show();
+
+ return true;
+}
+
+basegfx::B2DHomMatrix SdrDragMove::getCurrentTransformation()
+{
+ return basegfx::tools::createTranslateB2DHomMatrix(DragStat().GetDX(), DragStat().GetDY());
+}
+
+void SdrDragMove::ImpCheckSnap(const Point& rPt)
+{
+ Point aPt(rPt);
+ sal_uInt16 nRet=SnapPos(aPt);
+ aPt-=rPt;
+
+ if ((nRet & SDRSNAP_XSNAPPED) !=0)
+ {
+ if (bXSnapped)
+ {
+ if (Abs(aPt.X())<Abs(nBestXSnap))
+ {
+ nBestXSnap=aPt.X();
+ }
+ }
+ else
+ {
+ nBestXSnap=aPt.X();
+ bXSnapped=true;
+ }
+ }
+
+ if ((nRet & SDRSNAP_YSNAPPED) !=0)
+ {
+ if (bYSnapped)
+ {
+ if (Abs(aPt.Y())<Abs(nBestYSnap))
+ {
+ nBestYSnap=aPt.Y();
+ }
+ }
+ else
+ {
+ nBestYSnap=aPt.Y();
+ bYSnapped=true;
+ }
+ }
+}
+
+void SdrDragMove::MoveSdrDrag(const Point& rNoSnapPnt_)
+{
+ nBestXSnap=0;
+ nBestYSnap=0;
+ bXSnapped=false;
+ bYSnapped=false;
+ Point aNoSnapPnt(rNoSnapPnt_);
+ const Rectangle& aSR=GetMarkedRect();
+ long nMovedx=aNoSnapPnt.X()-DragStat().GetStart().X();
+ long nMovedy=aNoSnapPnt.Y()-DragStat().GetStart().Y();
+ Point aLO(aSR.TopLeft()); aLO.X()+=nMovedx; aLO.Y()+=nMovedy;
+ Point aRU(aSR.BottomRight()); aRU.X()+=nMovedx; aRU.Y()+=nMovedy;
+ Point aLU(aLO.X(),aRU.Y());
+ Point aRO(aRU.X(),aLO.Y());
+ ImpCheckSnap(aLO);
+
+ if (!getSdrDragView().IsMoveSnapOnlyTopLeft())
+ {
+ ImpCheckSnap(aRO);
+ ImpCheckSnap(aLU);
+ ImpCheckSnap(aRU);
+ }
+
+ Point aPnt(aNoSnapPnt.X()+nBestXSnap,aNoSnapPnt.Y()+nBestYSnap);
+ bool bOrtho=getSdrDragView().IsOrtho();
+
+ if (bOrtho)
+ OrthoDistance8(DragStat().GetStart(),aPnt,getSdrDragView().IsBigOrtho());
+
+ if (DragStat().CheckMinMoved(aNoSnapPnt))
+ {
+ Point aPt1(aPnt);
+ Rectangle aLR(getSdrDragView().GetWorkArea());
+ bool bWorkArea=!aLR.IsEmpty();
+ bool bDragLimit=IsDragLimit();
+
+ if (bDragLimit || bWorkArea)
+ {
+ Rectangle aSR2(GetMarkedRect());
+ Point aD(aPt1-DragStat().GetStart());
+
+ if (bDragLimit)
+ {
+ Rectangle aR2(GetDragLimitRect());
+
+ if (bWorkArea)
+ aLR.Intersection(aR2);
+ else
+ aLR=aR2;
+ }
+
+ if (aSR2.Left()>aLR.Left() || aSR2.Right()<aLR.Right())
+ { // ist ueberhaupt Platz zum verschieben?
+ aSR2.Move(aD.X(),0);
+
+ if (aSR2.Left()<aLR.Left())
+ {
+ aPt1.X()-=aSR2.Left()-aLR.Left();
+ }
+ else if (aSR2.Right()>aLR.Right())
+ {
+ aPt1.X()-=aSR2.Right()-aLR.Right();
+ }
+ }
+ else
+ aPt1.X()=DragStat().GetStart().X(); // kein Platz zum verschieben
+
+ if (aSR2.Top()>aLR.Top() || aSR2.Bottom()<aLR.Bottom())
+ { // ist ueberhaupt Platz zum verschieben?
+ aSR2.Move(0,aD.Y());
+
+ if (aSR2.Top()<aLR.Top())
+ {
+ aPt1.Y()-=aSR2.Top()-aLR.Top();
+ }
+ else if (aSR2.Bottom()>aLR.Bottom())
+ {
+ aPt1.Y()-=aSR2.Bottom()-aLR.Bottom();
+ }
+ }
+ else
+ aPt1.Y()=DragStat().GetStart().Y(); // kein Platz zum verschieben
+ }
+
+ if (getSdrDragView().IsDraggingGluePoints())
+ { // Klebepunkte aufs BoundRect des Obj limitieren
+ aPt1-=DragStat().GetStart();
+ const SdrMarkList& rML=GetMarkedObjectList();
+ sal_uLong nMarkAnz=rML.GetMarkCount();
+
+ for (sal_uLong nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++)
+ {
+ const SdrMark* pM=rML.GetMark(nMarkNum);
+ const SdrUShortCont* pPts=pM->GetMarkedGluePoints();
+ sal_uLong nPtAnz=pPts==NULL ? 0 : pPts->GetCount();
+
+ if (nPtAnz!=0)
+ {
+ const SdrObject* pObj=pM->GetMarkedSdrObj();
+ const SdrGluePointList* pGPL=pObj->GetGluePointList();
+ Rectangle aBound(pObj->GetCurrentBoundRect());
+
+ for (sal_uLong nPtNum=0; nPtNum<nPtAnz; nPtNum++)
+ {
+ sal_uInt16 nId=pPts->GetObject(nPtNum);
+ sal_uInt16 nGlueNum=pGPL->FindGluePoint(nId);
+
+ if (nGlueNum!=SDRGLUEPOINT_NOTFOUND)
+ {
+ Point aPt((*pGPL)[nGlueNum].GetAbsolutePos(*pObj));
+ aPt+=aPt1; // soviel soll verschoben werden
+ if (aPt.X()<aBound.Left() ) aPt1.X()-=aPt.X()-aBound.Left() ;
+ if (aPt.X()>aBound.Right() ) aPt1.X()-=aPt.X()-aBound.Right() ;
+ if (aPt.Y()<aBound.Top() ) aPt1.Y()-=aPt.Y()-aBound.Top() ;
+ if (aPt.Y()>aBound.Bottom()) aPt1.Y()-=aPt.Y()-aBound.Bottom();
+ }
+ }
+ }
+ }
+
+ aPt1+=DragStat().GetStart();
+ }
+
+ if (bOrtho)
+ OrthoDistance8(DragStat().GetStart(),aPt1,false);
+
+ if (aPt1!=DragStat().GetNow())
+ {
+ Hide();
+ DragStat().NextMove(aPt1);
+ Rectangle aAction(GetMarkedRect());
+ aAction.Move(DragStat().GetDX(),DragStat().GetDY());
+ DragStat().SetActionRect(aAction);
+ Show();
+ }
+ }
+}
+
+bool SdrDragMove::EndSdrDrag(bool bCopy)
+{
+ Hide();
+
+ if (getSdrDragView().IsInsObjPoint() || getSdrDragView().IsInsGluePoint())
+ bCopy=false;
+
+ if (IsDraggingPoints())
+ {
+ getSdrDragView().MoveMarkedPoints(Size(DragStat().GetDX(),DragStat().GetDY()),bCopy);
+ }
+ else if (IsDraggingGluePoints())
+ {
+ getSdrDragView().MoveMarkedGluePoints(Size(DragStat().GetDX(),DragStat().GetDY()),bCopy);
+ }
+ else
+ {
+ getSdrDragView().MoveMarkedObj(Size(DragStat().GetDX(),DragStat().GetDY()),bCopy);
+ }
+
+ return true;
+}
+
+Pointer SdrDragMove::GetSdrDragPointer() const
+{
+ if (IsDraggingPoints() || IsDraggingGluePoints())
+ {
+ return Pointer(POINTER_MOVEPOINT);
+ }
+ else
+ {
+ return Pointer(POINTER_MOVE);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(SdrDragResize,SdrDragMethod);
+
+SdrDragResize::SdrDragResize(SdrDragView& rNewView)
+: SdrDragMethod(rNewView),
+ aXFact(1,1),
+ aYFact(1,1)
+{
+}
+
+void SdrDragResize::TakeSdrDragComment(XubString& rStr) const
+{
+ ImpTakeDescriptionStr(STR_DragMethResize, rStr);
+ bool bEqual(aXFact == aYFact);
+ Fraction aFact1(1,1);
+ Point aStart(DragStat().GetStart());
+ Point aRef(DragStat().GetRef1());
+ sal_Int32 nXDiv(aStart.X() - aRef.X());
+
+ if(!nXDiv)
+ nXDiv = 1;
+
+ sal_Int32 nYDiv(aStart.Y() - aRef.Y());
+
+ if(!nYDiv)
+ nYDiv = 1;
+
+ bool bX(aXFact != aFact1 && Abs(nXDiv) > 1);
+ bool bY(aYFact != aFact1 && Abs(nYDiv) > 1);
+
+ if(bX || bY)
+ {
+ XubString aStr;
+
+ rStr.AppendAscii(" (");
+
+ if(bX)
+ {
+ if(!bEqual)
+ rStr.AppendAscii("x=");
+
+ getSdrDragView().GetModel()->TakePercentStr(aXFact, aStr);
+ rStr += aStr;
+ }
+
+ if(bY && !bEqual)
+ {
+ if(bX)
+ rStr += sal_Unicode(' ');
+
+ rStr.AppendAscii("y=");
+ getSdrDragView().GetModel()->TakePercentStr(aYFact, aStr);
+ rStr += aStr;
+ }
+
+ rStr += sal_Unicode(')');
+ }
+
+ if(getSdrDragView().IsDragWithCopy())
+ rStr += ImpGetResStr(STR_EditWithCopy);
+}
+
+bool SdrDragResize::BeginSdrDrag()
+{
+ SdrHdlKind eRefHdl=HDL_MOVE;
+ SdrHdl* pRefHdl=NULL;
+
+ switch (GetDragHdlKind())
+ {
+ case HDL_UPLFT: eRefHdl=HDL_LWRGT; break;
+ case HDL_UPPER: eRefHdl=HDL_LOWER; DragStat().SetHorFixed(true); break;
+ case HDL_UPRGT: eRefHdl=HDL_LWLFT; break;
+ case HDL_LEFT : eRefHdl=HDL_RIGHT; DragStat().SetVerFixed(true); break;
+ case HDL_RIGHT: eRefHdl=HDL_LEFT ; DragStat().SetVerFixed(true); break;
+ case HDL_LWLFT: eRefHdl=HDL_UPRGT; break;
+ case HDL_LOWER: eRefHdl=HDL_UPPER; DragStat().SetHorFixed(true); break;
+ case HDL_LWRGT: eRefHdl=HDL_UPLFT; break;
+ default: break;
+ }
+
+ if (eRefHdl!=HDL_MOVE)
+ pRefHdl=GetHdlList().GetHdl(eRefHdl);
+
+ if (pRefHdl!=NULL && !getSdrDragView().IsResizeAtCenter())
+ {
+ DragStat().Ref1()=pRefHdl->GetPos();
+ }
+ else
+ {
+ SdrHdl* pRef1=GetHdlList().GetHdl(HDL_UPLFT);
+ SdrHdl* pRef2=GetHdlList().GetHdl(HDL_LWRGT);
+
+ if (pRef1!=NULL && pRef2!=NULL)
+ {
+ DragStat().Ref1()=Rectangle(pRef1->GetPos(),pRef2->GetPos()).Center();
+ }
+ else
+ {
+ DragStat().Ref1()=GetMarkedRect().Center();
+ }
+ }
+
+ Show();
+
+ return true;
+}
+
+basegfx::B2DHomMatrix SdrDragResize::getCurrentTransformation()
+{
+ basegfx::B2DHomMatrix aRetval(basegfx::tools::createTranslateB2DHomMatrix(
+ -DragStat().Ref1().X(), -DragStat().Ref1().Y()));
+ aRetval.scale(aXFact, aYFact);
+ aRetval.translate(DragStat().Ref1().X(), DragStat().Ref1().Y());
+
+ return aRetval;
+}
+
+void SdrDragResize::MoveSdrDrag(const Point& rNoSnapPnt)
+{
+ Point aPnt(GetSnapPos(rNoSnapPnt));
+ Point aStart(DragStat().GetStart());
+ Point aRef(DragStat().GetRef1());
+ Fraction aMaxFact(0x7FFFFFFF,1);
+ Rectangle aLR(getSdrDragView().GetWorkArea());
+ bool bWorkArea=!aLR.IsEmpty();
+ bool bDragLimit=IsDragLimit();
+
+ if (bDragLimit || bWorkArea)
+ {
+ Rectangle aSR(GetMarkedRect());
+
+ if (bDragLimit)
+ {
+ Rectangle aR2(GetDragLimitRect());
+
+ if (bWorkArea)
+ aLR.Intersection(aR2);
+ else
+ aLR=aR2;
+ }
+
+ if (aPnt.X()<aLR.Left())
+ aPnt.X()=aLR.Left();
+ else if (aPnt.X()>aLR.Right())
+ aPnt.X()=aLR.Right();
+
+ if (aPnt.Y()<aLR.Top())
+ aPnt.Y()=aLR.Top();
+ else if (aPnt.Y()>aLR.Bottom())
+ aPnt.Y()=aLR.Bottom();
+
+ if (aRef.X()>aSR.Left())
+ {
+ Fraction aMax(aRef.X()-aLR.Left(),aRef.X()-aSR.Left());
+
+ if (aMax<aMaxFact)
+ aMaxFact=aMax;
+ }
+
+ if (aRef.X()<aSR.Right())
+ {
+ Fraction aMax(aLR.Right()-aRef.X(),aSR.Right()-aRef.X());
+
+ if (aMax<aMaxFact)
+ aMaxFact=aMax;
+ }
+
+ if (aRef.Y()>aSR.Top())
+ {
+ Fraction aMax(aRef.Y()-aLR.Top(),aRef.Y()-aSR.Top());
+
+ if (aMax<aMaxFact)
+ aMaxFact=aMax;
+ }
+
+ if (aRef.Y()<aSR.Bottom())
+ {
+ Fraction aMax(aLR.Bottom()-aRef.Y(),aSR.Bottom()-aRef.Y());
+
+ if (aMax<aMaxFact)
+ aMaxFact=aMax;
+ }
+ }
+
+ long nXDiv=aStart.X()-aRef.X(); if (nXDiv==0) nXDiv=1;
+ long nYDiv=aStart.Y()-aRef.Y(); if (nYDiv==0) nYDiv=1;
+ long nXMul=aPnt.X()-aRef.X();
+ long nYMul=aPnt.Y()-aRef.Y();
+
+ if (nXDiv<0)
+ {
+ nXDiv=-nXDiv;
+ nXMul=-nXMul;
+ }
+
+ if (nYDiv<0)
+ {
+ nYDiv=-nYDiv;
+ nYMul=-nYMul;
+ }
+
+ bool bXNeg=nXMul<0; if (bXNeg) nXMul=-nXMul;
+ bool bYNeg=nYMul<0; if (bYNeg) nYMul=-nYMul;
+ bool bOrtho=getSdrDragView().IsOrtho() || !getSdrDragView().IsResizeAllowed(false);
+
+ if (!DragStat().IsHorFixed() && !DragStat().IsVerFixed())
+ {
+ if (Abs(nXDiv)<=1 || Abs(nYDiv)<=1)
+ bOrtho=false;
+
+ if (bOrtho)
+ {
+ if ((Fraction(nXMul,nXDiv)>Fraction(nYMul,nYDiv)) !=getSdrDragView().IsBigOrtho())
+ {
+ nXMul=nYMul;
+ nXDiv=nYDiv;
+ }
+ else
+ {
+ nYMul=nXMul;
+ nYDiv=nXDiv;
+ }
+ }
+ }
+ else
+ {
+ if (bOrtho)
+ {
+ if (DragStat().IsHorFixed())
+ {
+ bXNeg=false;
+ nXMul=nYMul;
+ nXDiv=nYDiv;
+ }
+
+ if (DragStat().IsVerFixed())
+ {
+ bYNeg=false;
+ nYMul=nXMul;
+ nYDiv=nXDiv;
+ }
+ }
+ else
+ {
+ if (DragStat().IsHorFixed())
+ {
+ bXNeg=false;
+ nXMul=1;
+ nXDiv=1;
+ }
+
+ if (DragStat().IsVerFixed())
+ {
+ bYNeg=false;
+ nYMul=1;
+ nYDiv=1;
+ }
+ }
+ }
+
+ Fraction aNeuXFact(nXMul,nXDiv);
+ Fraction aNeuYFact(nYMul,nYDiv);
+
+ if (bOrtho)
+ {
+ if (aNeuXFact>aMaxFact)
+ {
+ aNeuXFact=aMaxFact;
+ aNeuYFact=aMaxFact;
+ }
+
+ if (aNeuYFact>aMaxFact)
+ {
+ aNeuXFact=aMaxFact;
+ aNeuYFact=aMaxFact;
+ }
+ }
+
+ if (bXNeg)
+ aNeuXFact=Fraction(-aNeuXFact.GetNumerator(),aNeuXFact.GetDenominator());
+
+ if (bYNeg)
+ aNeuYFact=Fraction(-aNeuYFact.GetNumerator(),aNeuYFact.GetDenominator());
+
+ if (DragStat().CheckMinMoved(aPnt))
+ {
+ if ((!DragStat().IsHorFixed() && aPnt.X()!=DragStat().GetNow().X()) ||
+ (!DragStat().IsVerFixed() && aPnt.Y()!=DragStat().GetNow().Y()))
+ {
+ Hide();
+ DragStat().NextMove(aPnt);
+ aXFact=aNeuXFact;
+ aYFact=aNeuYFact;
+ Show();
+ }
+ }
+}
+
+void SdrDragResize::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
+{
+ rTarget.Resize(DragStat().Ref1(),aXFact,aYFact);
+}
+
+bool SdrDragResize::EndSdrDrag(bool bCopy)
+{
+ Hide();
+
+ if (IsDraggingPoints())
+ {
+ getSdrDragView().ResizeMarkedPoints(DragStat().Ref1(),aXFact,aYFact,bCopy);
+ }
+ else if (IsDraggingGluePoints())
+ {
+ getSdrDragView().ResizeMarkedGluePoints(DragStat().Ref1(),aXFact,aYFact,bCopy);
+ }
+ else
+ {
+ getSdrDragView().ResizeMarkedObj(DragStat().Ref1(),aXFact,aYFact,bCopy);
+ }
+
+ return true;
+}
+
+Pointer SdrDragResize::GetSdrDragPointer() const
+{
+ const SdrHdl* pHdl=GetDragHdl();
+
+ if (pHdl!=NULL)
+ {
+ return pHdl->GetPointer();
+ }
+
+ return Pointer(POINTER_MOVE);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(SdrDragRotate,SdrDragMethod);
+
+void SdrDragRotate::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
+{
+ rTarget.Rotate(DragStat().GetRef1(), nWink, sin(nWink*nPi180), cos(nWink*nPi180));
+}
+
+SdrDragRotate::SdrDragRotate(SdrDragView& rNewView)
+: SdrDragMethod(rNewView),
+ nSin(0.0),
+ nCos(1.0),
+ nWink0(0),
+ nWink(0),
+ bRight(false)
+{
+}
+
+void SdrDragRotate::TakeSdrDragComment(XubString& rStr) const
+{
+ ImpTakeDescriptionStr(STR_DragMethRotate, rStr);
+ rStr.AppendAscii(" (");
+ XubString aStr;
+ sal_Int32 nTmpWink(NormAngle360(nWink));
+
+ if(bRight && nWink)
+ {
+ nTmpWink -= 36000;
+ }
+
+ getSdrDragView().GetModel()->TakeWinkStr(nTmpWink, aStr);
+ rStr += aStr;
+ rStr += sal_Unicode(')');
+
+ if(getSdrDragView().IsDragWithCopy())
+ rStr += ImpGetResStr(STR_EditWithCopy);
+}
+
+bool SdrDragRotate::BeginSdrDrag()
+{
+ SdrHdl* pH=GetHdlList().GetHdl(HDL_REF1);
+
+ if (pH!=NULL)
+ {
+ Show();
+ DragStat().Ref1()=pH->GetPos();
+ nWink0=GetAngle(DragStat().GetStart()-DragStat().GetRef1());
+ return true;
+ }
+ else
+ {
+ DBG_ERROR("SdrDragRotate::BeginSdrDrag(): Kein Referenzpunkt-Handle gefunden");
+ return false;
+ }
+}
+
+basegfx::B2DHomMatrix SdrDragRotate::getCurrentTransformation()
+{
+ return basegfx::tools::createRotateAroundPoint(
+ DragStat().GetRef1().X(), DragStat().GetRef1().Y(),
+ -atan2(nSin, nCos));
+}
+
+void SdrDragRotate::MoveSdrDrag(const Point& rPnt_)
+{
+ Point aPnt(rPnt_);
+ if (DragStat().CheckMinMoved(aPnt))
+ {
+ long nNeuWink=NormAngle360(GetAngle(aPnt-DragStat().GetRef1())-nWink0);
+ long nSA=0;
+
+ if (getSdrDragView().IsAngleSnapEnabled())
+ nSA=getSdrDragView().GetSnapAngle();
+
+ if (!getSdrDragView().IsRotateAllowed(false))
+ nSA=9000;
+
+ if (nSA!=0)
+ { // Winkelfang
+ nNeuWink+=nSA/2;
+ nNeuWink/=nSA;
+ nNeuWink*=nSA;
+ }
+
+ nNeuWink=NormAngle180(nNeuWink);
+
+ if (nWink!=nNeuWink)
+ {
+ sal_uInt16 nSekt0=GetAngleSector(nWink);
+ sal_uInt16 nSekt1=GetAngleSector(nNeuWink);
+
+ if (nSekt0==0 && nSekt1==3)
+ bRight=true;
+
+ if (nSekt0==3 && nSekt1==0)
+ bRight=false;
+
+ nWink=nNeuWink;
+ double a=nWink*nPi180;
+ double nSin1=sin(a); // schonmal berechnen, damit mgl. wenig Zeit
+ double nCos1=cos(a); // zwischen Hide() und Show() vergeht
+ Hide();
+ nSin=nSin1;
+ nCos=nCos1;
+ DragStat().NextMove(aPnt);
+ Show();
+ }
+ }
+}
+
+bool SdrDragRotate::EndSdrDrag(bool bCopy)
+{
+ Hide();
+
+ if (nWink!=0)
+ {
+ if (IsDraggingPoints())
+ {
+ getSdrDragView().RotateMarkedPoints(DragStat().GetRef1(),nWink,bCopy);
+ }
+ else if (IsDraggingGluePoints())
+ {
+ getSdrDragView().RotateMarkedGluePoints(DragStat().GetRef1(),nWink,bCopy);
+ }
+ else
+ {
+ getSdrDragView().RotateMarkedObj(DragStat().GetRef1(),nWink,bCopy);
+ }
+ }
+ return true;
+}
+
+Pointer SdrDragRotate::GetSdrDragPointer() const
+{
+ return Pointer(POINTER_ROTATE);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(SdrDragShear,SdrDragMethod);
+
+SdrDragShear::SdrDragShear(SdrDragView& rNewView, bool bSlant1)
+: SdrDragMethod(rNewView),
+ aFact(1,1),
+ nWink0(0),
+ nWink(0),
+ nTan(0.0),
+ bVertical(false),
+ bResize(false),
+ bUpSideDown(false),
+ bSlant(bSlant1)
+{
+}
+
+void SdrDragShear::TakeSdrDragComment(XubString& rStr) const
+{
+ ImpTakeDescriptionStr(STR_DragMethShear, rStr);
+ rStr.AppendAscii(" (");
+
+ sal_Int32 nTmpWink(nWink);
+
+ if(bUpSideDown)
+ nTmpWink += 18000;
+
+ nTmpWink = NormAngle180(nTmpWink);
+
+ XubString aStr;
+
+ getSdrDragView().GetModel()->TakeWinkStr(nTmpWink, aStr);
+ rStr += aStr;
+ rStr += sal_Unicode(')');
+
+ if(getSdrDragView().IsDragWithCopy())
+ rStr += ImpGetResStr(STR_EditWithCopy);
+}
+
+bool SdrDragShear::BeginSdrDrag()
+{
+ SdrHdlKind eRefHdl=HDL_MOVE;
+ SdrHdl* pRefHdl=NULL;
+
+ switch (GetDragHdlKind())
+ {
+ case HDL_UPPER: eRefHdl=HDL_LOWER; break;
+ case HDL_LOWER: eRefHdl=HDL_UPPER; break;
+ case HDL_LEFT : eRefHdl=HDL_RIGHT; bVertical=true; break;
+ case HDL_RIGHT: eRefHdl=HDL_LEFT ; bVertical=true; break;
+ default: break;
+ }
+
+ if (eRefHdl!=HDL_MOVE)
+ pRefHdl=GetHdlList().GetHdl(eRefHdl);
+
+ if (pRefHdl!=NULL)
+ {
+ DragStat().Ref1()=pRefHdl->GetPos();
+ nWink0=GetAngle(DragStat().GetStart()-DragStat().GetRef1());
+ }
+ else
+ {
+ DBG_ERROR("SdrDragShear::BeginSdrDrag(): Kein Referenzpunkt-Handle fuer Shear gefunden");
+ return false;
+ }
+
+ Show();
+ return true;
+}
+
+basegfx::B2DHomMatrix SdrDragShear::getCurrentTransformation()
+{
+ basegfx::B2DHomMatrix aRetval(basegfx::tools::createTranslateB2DHomMatrix(
+ -DragStat().GetRef1().X(), -DragStat().GetRef1().Y()));
+
+ if (bResize)
+ {
+ if (bVertical)
+ {
+ aRetval.scale(aFact, 1.0);
+ aRetval.shearY(-nTan);
+ }
+ else
+ {
+ aRetval.scale(1.0, aFact);
+ aRetval.shearX(-nTan);
+ }
+ }
+
+ aRetval.translate(DragStat().GetRef1().X(), DragStat().GetRef1().Y());
+
+ return aRetval;
+}
+
+void SdrDragShear::MoveSdrDrag(const Point& rPnt)
+{
+ if (DragStat().CheckMinMoved(rPnt))
+ {
+ bResize=!getSdrDragView().IsOrtho();
+ long nSA=0;
+
+ if (getSdrDragView().IsAngleSnapEnabled())
+ nSA=getSdrDragView().GetSnapAngle();
+
+ Point aP0(DragStat().GetStart());
+ Point aPnt(rPnt);
+ Fraction aNeuFact(1,1);
+
+ // Wenn kein Winkelfang, dann ggf. Rasterfang (ausser bei Slant)
+ if (nSA==0 && !bSlant)
+ aPnt=GetSnapPos(aPnt);
+
+ if (!bSlant && !bResize)
+ { // Shear ohne Resize
+ if (bVertical)
+ aPnt.X()=aP0.X();
+ else
+ aPnt.Y()=aP0.Y();
+ }
+
+ Point aRef(DragStat().GetRef1());
+ Point aDif(aPnt-aRef);
+
+ long nNeuWink=0;
+
+ if (bSlant)
+ {
+ nNeuWink=NormAngle180(-(GetAngle(aDif)-nWink0));
+
+ if (bVertical)
+ nNeuWink=NormAngle180(-nNeuWink);
+ }
+ else
+ {
+ if (bVertical)
+ nNeuWink=NormAngle180(GetAngle(aDif));
+ else
+ nNeuWink=NormAngle180(-(GetAngle(aDif)-9000));
+
+ if (nNeuWink<-9000 || nNeuWink>9000)
+ nNeuWink=NormAngle180(nNeuWink+18000);
+
+ if (bResize)
+ {
+ Point aPt2(aPnt);
+
+ if (nSA!=0)
+ aPt2=GetSnapPos(aPnt); // den also in jedem Falle fangen
+
+ if (bVertical)
+ {
+ aNeuFact=Fraction(aPt2.X()-aRef.X(),aP0.X()-aRef.X());
+ }
+ else
+ {
+ aNeuFact=Fraction(aPt2.Y()-aRef.Y(),aP0.Y()-aRef.Y());
+ }
+ }
+ }
+
+ bool bNeg=nNeuWink<0;
+
+ if (bNeg)
+ nNeuWink=-nNeuWink;
+
+ if (nSA!=0)
+ { // Winkelfang
+ nNeuWink+=nSA/2;
+ nNeuWink/=nSA;
+ nNeuWink*=nSA;
+ }
+
+ nNeuWink=NormAngle360(nNeuWink);
+ bUpSideDown=nNeuWink>9000 && nNeuWink<27000;
+
+ if (bSlant)
+ { // Resize fuer Slant berechnen
+ // Mit Winkelfang jedoch ohne 89deg Begrenzung
+ long nTmpWink=nNeuWink;
+ if (bUpSideDown) nNeuWink-=18000;
+ if (bNeg) nTmpWink=-nTmpWink;
+ bResize=true;
+ double nCos=cos(nTmpWink*nPi180);
+ aNeuFact=nCos;
+ Kuerzen(aFact,10); // 3 Dezimalstellen sollten reichen
+ }
+
+ if (nNeuWink>8900)
+ nNeuWink=8900;
+
+ if (bNeg)
+ nNeuWink=-nNeuWink;
+
+ if (nWink!=nNeuWink || aFact!=aNeuFact)
+ {
+ nWink=nNeuWink;
+ aFact=aNeuFact;
+ double a=nWink*nPi180;
+ double nTan1=0.0;
+ nTan1=tan(a); // schonmal berechnen, damit mgl. wenig Zeit zwischen Hide() und Show() vergeht
+ Hide();
+ nTan=nTan1;
+ DragStat().NextMove(rPnt);
+ Show();
+ }
+ }
+}
+
+void SdrDragShear::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
+{
+ if (bResize)
+ {
+ if (bVertical)
+ {
+ rTarget.Resize(DragStat().GetRef1(),aFact,Fraction(1,1));
+ }
+ else
+ {
+ rTarget.Resize(DragStat().GetRef1(),Fraction(1,1),aFact);
+ }
+ }
+
+ if (nWink!=0)
+ {
+ rTarget.Shear(DragStat().GetRef1(),nWink,tan(nWink*nPi180),bVertical);
+ }
+}
+
+bool SdrDragShear::EndSdrDrag(bool bCopy)
+{
+ Hide();
+
+ if (bResize && aFact==Fraction(1,1))
+ bResize=false;
+
+ if (nWink!=0 || bResize)
+ {
+ if (nWink!=0 && bResize)
+ {
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_EditShear,aStr);
+
+ if (bCopy)
+ aStr+=ImpGetResStr(STR_EditWithCopy);
+
+ getSdrDragView().BegUndo(aStr);
+ }
+
+ if (bResize)
+ {
+ if (bVertical)
+ {
+ getSdrDragView().ResizeMarkedObj(DragStat().GetRef1(),aFact,Fraction(1,1),bCopy);
+ }
+ else
+ {
+ getSdrDragView().ResizeMarkedObj(DragStat().GetRef1(),Fraction(1,1),aFact,bCopy);
+ }
+
+ bCopy=false;
+ }
+
+ if (nWink!=0)
+ {
+ getSdrDragView().ShearMarkedObj(DragStat().GetRef1(),nWink,bVertical,bCopy);
+ }
+
+ if (nWink!=0 && bResize)
+ getSdrDragView().EndUndo();
+
+ return true;
+ }
+
+ return false;
+}
+
+Pointer SdrDragShear::GetSdrDragPointer() const
+{
+ if (bVertical)
+ return Pointer(POINTER_VSHEAR);
+ else
+ return Pointer(POINTER_HSHEAR);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(SdrDragMirror,SdrDragMethod);
+
+void SdrDragMirror::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
+{
+ if(bMirrored)
+ {
+ rTarget.Mirror(DragStat().GetRef1(), DragStat().GetRef2());
+ }
+}
+
+SdrDragMirror::SdrDragMirror(SdrDragView& rNewView)
+: SdrDragMethod(rNewView),
+ nWink(0),
+ bMirrored(false),
+ bSide0(false)
+{
+}
+
+bool SdrDragMirror::ImpCheckSide(const Point& rPnt) const
+{
+ long nWink1=GetAngle(rPnt-DragStat().GetRef1());
+ nWink1-=nWink;
+ nWink1=NormAngle360(nWink1);
+
+ return nWink1<18000;
+}
+
+void SdrDragMirror::TakeSdrDragComment(XubString& rStr) const
+{
+ if (aDif.X()==0)
+ ImpTakeDescriptionStr(STR_DragMethMirrorHori,rStr);
+ else if (aDif.Y()==0)
+ ImpTakeDescriptionStr(STR_DragMethMirrorVert,rStr);
+ else if (Abs(aDif.X())==Abs(aDif.Y()))
+ ImpTakeDescriptionStr(STR_DragMethMirrorDiag,rStr);
+ else
+ ImpTakeDescriptionStr(STR_DragMethMirrorFree,rStr);
+
+ if (getSdrDragView().IsDragWithCopy())
+ rStr+=ImpGetResStr(STR_EditWithCopy);
+}
+
+bool SdrDragMirror::BeginSdrDrag()
+{
+ SdrHdl* pH1=GetHdlList().GetHdl(HDL_REF1);
+ SdrHdl* pH2=GetHdlList().GetHdl(HDL_REF2);
+
+ if (pH1!=NULL && pH2!=NULL)
+ {
+ DragStat().Ref1()=pH1->GetPos();
+ DragStat().Ref2()=pH2->GetPos();
+ Ref1()=pH1->GetPos();
+ Ref2()=pH2->GetPos();
+ aDif=pH2->GetPos()-pH1->GetPos();
+ bool b90=(aDif.X()==0) || aDif.Y()==0;
+ bool b45=b90 || (Abs(aDif.X())==Abs(aDif.Y()));
+ nWink=NormAngle360(GetAngle(aDif));
+
+ if (!getSdrDragView().IsMirrorAllowed(false,false) && !b45)
+ return false; // freier Achsenwinkel nicht erlaubt
+
+ if (!getSdrDragView().IsMirrorAllowed(true,false) && !b90)
+ return false; // 45deg auch nicht erlaubt
+
+ bSide0=ImpCheckSide(DragStat().GetStart());
+ Show();
+ return true;
+ }
+ else
+ {
+ DBG_ERROR("SdrDragMirror::BeginSdrDrag(): Spiegelachse nicht gefunden");
+ return false;
+ }
+}
+
+basegfx::B2DHomMatrix SdrDragMirror::getCurrentTransformation()
+{
+ basegfx::B2DHomMatrix aRetval;
+
+ if (bMirrored)
+ {
+ const double fDeltaX(DragStat().GetRef2().X() - DragStat().GetRef1().X());
+ const double fDeltaY(DragStat().GetRef2().Y() - DragStat().GetRef1().Y());
+ const double fRotation(atan2(fDeltaY, fDeltaX));
+
+ aRetval = basegfx::tools::createTranslateB2DHomMatrix(-DragStat().GetRef1().X(), -DragStat().GetRef1().Y());
+ aRetval.rotate(-fRotation);
+ aRetval.scale(1.0, -1.0);
+ aRetval.rotate(fRotation);
+ aRetval.translate(DragStat().GetRef1().X(), DragStat().GetRef1().Y());
+ }
+
+ return aRetval;
+}
+
+void SdrDragMirror::MoveSdrDrag(const Point& rPnt)
+{
+ if (DragStat().CheckMinMoved(rPnt))
+ {
+ bool bNeuSide=ImpCheckSide(rPnt);
+ bool bNeuMirr=bSide0!=bNeuSide;
+
+ if (bMirrored!=bNeuMirr)
+ {
+ Hide();
+ bMirrored=bNeuMirr;
+ DragStat().NextMove(rPnt);
+ Show();
+ }
+ }
+}
+
+bool SdrDragMirror::EndSdrDrag(bool bCopy)
+{
+ Hide();
+
+ if (bMirrored)
+ {
+ getSdrDragView().MirrorMarkedObj(DragStat().GetRef1(),DragStat().GetRef2(),bCopy);
+ }
+
+ return true;
+}
+
+Pointer SdrDragMirror::GetSdrDragPointer() const
+{
+ return Pointer(POINTER_MIRROR);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(SdrDragGradient, SdrDragMethod);
+
+SdrDragGradient::SdrDragGradient(SdrDragView& rNewView, bool bGrad)
+: SdrDragMethod(rNewView),
+ pIAOHandle(NULL),
+ bIsGradient(bGrad)
+{
+}
+
+void SdrDragGradient::TakeSdrDragComment(XubString& rStr) const
+{
+ if(IsGradient())
+ ImpTakeDescriptionStr(STR_DragMethGradient, rStr);
+ else
+ ImpTakeDescriptionStr(STR_DragMethTransparence, rStr);
+}
+
+bool SdrDragGradient::BeginSdrDrag()
+{
+ bool bRetval(false);
+
+ pIAOHandle = (SdrHdlGradient*)GetHdlList().GetHdl(IsGradient() ? HDL_GRAD : HDL_TRNS);
+
+ if(pIAOHandle)
+ {
+ // save old values
+ DragStat().Ref1() = pIAOHandle->GetPos();
+ DragStat().Ref2() = pIAOHandle->Get2ndPos();
+
+ // what was hit?
+ bool bHit(false);
+ SdrHdlColor* pColHdl = pIAOHandle->GetColorHdl1();
+
+ // init handling flags
+ pIAOHandle->SetMoveSingleHandle(false);
+ pIAOHandle->SetMoveFirstHandle(false);
+
+ // test first color handle
+ if(pColHdl)
+ {
+ basegfx::B2DPoint aPosition(DragStat().GetStart().X(), DragStat().GetStart().Y());
+
+ if(pColHdl->getOverlayObjectList().isHitLogic(aPosition))
+ {
+ bHit = true;
+ pIAOHandle->SetMoveSingleHandle(true);
+ pIAOHandle->SetMoveFirstHandle(true);
+ }
+ }
+
+ // test second color handle
+ pColHdl = pIAOHandle->GetColorHdl2();
+
+ if(!bHit && pColHdl)
+ {
+ basegfx::B2DPoint aPosition(DragStat().GetStart().X(), DragStat().GetStart().Y());
+
+ if(pColHdl->getOverlayObjectList().isHitLogic(aPosition))
+ {
+ bHit = true;
+ pIAOHandle->SetMoveSingleHandle(true);
+ }
+ }
+
+ // test gradient handle itself
+ if(!bHit)
+ {
+ basegfx::B2DPoint aPosition(DragStat().GetStart().X(), DragStat().GetStart().Y());
+
+ if(pIAOHandle->getOverlayObjectList().isHitLogic(aPosition))
+ {
+ bHit = true;
+ }
+ }
+
+ // everything up and running :o}
+ bRetval = bHit;
+ }
+ else
+ {
+ DBG_ERROR("SdrDragGradient::BeginSdrDrag(): IAOGradient nicht gefunden");
+ }
+
+ return bRetval;
+}
+
+void SdrDragGradient::MoveSdrDrag(const Point& rPnt)
+{
+ if(pIAOHandle && DragStat().CheckMinMoved(rPnt))
+ {
+ DragStat().NextMove(rPnt);
+
+ // Do the Move here!!! DragStat().GetStart()
+ Point aMoveDiff = rPnt - DragStat().GetStart();
+
+ if(pIAOHandle->IsMoveSingleHandle())
+ {
+ if(pIAOHandle->IsMoveFirstHandle())
+ {
+ pIAOHandle->SetPos(DragStat().Ref1() + aMoveDiff);
+ if(pIAOHandle->GetColorHdl1())
+ pIAOHandle->GetColorHdl1()->SetPos(DragStat().Ref1() + aMoveDiff);
+ }
+ else
+ {
+ pIAOHandle->Set2ndPos(DragStat().Ref2() + aMoveDiff);
+ if(pIAOHandle->GetColorHdl2())
+ pIAOHandle->GetColorHdl2()->SetPos(DragStat().Ref2() + aMoveDiff);
+ }
+ }
+ else
+ {
+ pIAOHandle->SetPos(DragStat().Ref1() + aMoveDiff);
+ pIAOHandle->Set2ndPos(DragStat().Ref2() + aMoveDiff);
+
+ if(pIAOHandle->GetColorHdl1())
+ pIAOHandle->GetColorHdl1()->SetPos(DragStat().Ref1() + aMoveDiff);
+
+ if(pIAOHandle->GetColorHdl2())
+ pIAOHandle->GetColorHdl2()->SetPos(DragStat().Ref2() + aMoveDiff);
+ }
+
+ // new state
+ pIAOHandle->FromIAOToItem(getSdrDragView().GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(), false, false);
+ }
+}
+
+bool SdrDragGradient::EndSdrDrag(bool /*bCopy*/)
+{
+ // here the result is clear, do something with the values
+ Ref1() = pIAOHandle->GetPos();
+ Ref2() = pIAOHandle->Get2ndPos();
+
+ // new state
+ pIAOHandle->FromIAOToItem(getSdrDragView().GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(), true, true);
+
+ return true;
+}
+
+void SdrDragGradient::CancelSdrDrag()
+{
+ // restore old values
+ pIAOHandle->SetPos(DragStat().Ref1());
+ pIAOHandle->Set2ndPos(DragStat().Ref2());
+
+ if(pIAOHandle->GetColorHdl1())
+ pIAOHandle->GetColorHdl1()->SetPos(DragStat().Ref1());
+
+ if(pIAOHandle->GetColorHdl2())
+ pIAOHandle->GetColorHdl2()->SetPos(DragStat().Ref2());
+
+ // new state
+ pIAOHandle->FromIAOToItem(getSdrDragView().GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(), true, false);
+}
+
+Pointer SdrDragGradient::GetSdrDragPointer() const
+{
+ return Pointer(POINTER_REFHAND);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(SdrDragCrook,SdrDragMethod);
+
+SdrDragCrook::SdrDragCrook(SdrDragView& rNewView)
+: SdrDragMethod(rNewView),
+ aFact(1,1),
+ bContortionAllowed(false),
+ bNoContortionAllowed(false),
+ bContortion(false),
+ bResizeAllowed(false),
+ bResize(false),
+ bRotateAllowed(false),
+ bRotate(false),
+ bVertical(false),
+ bValid(false),
+ bLft(false),
+ bRgt(false),
+ bUpr(false),
+ bLwr(false),
+ bAtCenter(false),
+ nWink(0),
+ nMarkSize(0),
+ eMode(SDRCROOK_ROTATE)
+{
+}
+
+void SdrDragCrook::TakeSdrDragComment(XubString& rStr) const
+{
+ ImpTakeDescriptionStr(!bContortion ? STR_DragMethCrook : STR_DragMethCrookContortion, rStr);
+
+ if(bValid)
+ {
+ rStr.AppendAscii(" (");
+
+ XubString aStr;
+ sal_Int32 nVal(nWink);
+
+ if(bAtCenter)
+ nVal *= 2;
+
+ nVal = Abs(nVal);
+ getSdrDragView().GetModel()->TakeWinkStr(nVal, aStr);
+ rStr += aStr;
+ rStr += sal_Unicode(')');
+ }
+
+ if(getSdrDragView().IsDragWithCopy())
+ rStr += ImpGetResStr(STR_EditWithCopy);
+}
+
+// #96920# These defines parametrise the created raster
+// for interactions
+#define DRAG_CROOK_RASTER_MINIMUM (4)
+#define DRAG_CROOK_RASTER_MAXIMUM (15)
+#define DRAG_CROOK_RASTER_DISTANCE (30)
+
+basegfx::B2DPolyPolygon impCreateDragRaster(SdrPageView& rPageView, const Rectangle& rMarkRect)
+{
+ basegfx::B2DPolyPolygon aRetval;
+
+ if(rPageView.PageWindowCount())
+ {
+ OutputDevice& rOut = (rPageView.GetPageWindow(0)->GetPaintWindow().GetOutputDevice());
+ Rectangle aPixelSize = rOut.LogicToPixel(rMarkRect);
+ sal_uInt32 nHorDiv(aPixelSize.GetWidth() / DRAG_CROOK_RASTER_DISTANCE);
+ sal_uInt32 nVerDiv(aPixelSize.GetHeight() / DRAG_CROOK_RASTER_DISTANCE);
+
+ if(nHorDiv > DRAG_CROOK_RASTER_MAXIMUM)
+ nHorDiv = DRAG_CROOK_RASTER_MAXIMUM;
+ if(nHorDiv < DRAG_CROOK_RASTER_MINIMUM)
+ nHorDiv = DRAG_CROOK_RASTER_MINIMUM;
+
+ if(nVerDiv > DRAG_CROOK_RASTER_MAXIMUM)
+ nVerDiv = DRAG_CROOK_RASTER_MAXIMUM;
+ if(nVerDiv < DRAG_CROOK_RASTER_MINIMUM)
+ nVerDiv = DRAG_CROOK_RASTER_MINIMUM;
+
+ const double fXLen(rMarkRect.GetWidth() / (double)nHorDiv);
+ const double fYLen(rMarkRect.GetHeight() / (double)nVerDiv);
+ double fYPos(rMarkRect.Top());
+ sal_uInt32 a, b;
+
+ for(a = 0; a <= nVerDiv; a++)
+ {
+ // hor lines
+ for(b = 0; b < nHorDiv; b++)
+ {
+ basegfx::B2DPolygon aHorLineSegment;
+
+ const double fNewX(rMarkRect.Left() + (b * fXLen));
+ aHorLineSegment.append(basegfx::B2DPoint(fNewX, fYPos));
+ aHorLineSegment.appendBezierSegment(
+ basegfx::B2DPoint(fNewX + (fXLen * (1.0 / 3.0)), fYPos),
+ basegfx::B2DPoint(fNewX + (fXLen * (2.0 / 3.0)), fYPos),
+ basegfx::B2DPoint(fNewX + fXLen, fYPos));
+ aRetval.append(aHorLineSegment);
+ }
+
+ // increments
+ fYPos += fYLen;
+ }
+
+ double fXPos(rMarkRect.Left());
+
+ for(a = 0; a <= nHorDiv; a++)
+ {
+ // ver lines
+ for(b = 0; b < nVerDiv; b++)
+ {
+ basegfx::B2DPolygon aVerLineSegment;
+
+ const double fNewY(rMarkRect.Top() + (b * fYLen));
+ aVerLineSegment.append(basegfx::B2DPoint(fXPos, fNewY));
+ aVerLineSegment.appendBezierSegment(
+ basegfx::B2DPoint(fXPos, fNewY + (fYLen * (1.0 / 3.0))),
+ basegfx::B2DPoint(fXPos, fNewY + (fYLen * (2.0 / 3.0))),
+ basegfx::B2DPoint(fXPos, fNewY + fYLen));
+ aRetval.append(aVerLineSegment);
+ }
+
+ // increments
+ fXPos += fXLen;
+ }
+ }
+
+ return aRetval;
+}
+
+void SdrDragCrook::createSdrDragEntries()
+{
+ // Add extended frame raster first, so it will be behind objects
+ if(getSdrDragView().GetSdrPageView())
+ {
+ const basegfx::B2DPolyPolygon aDragRaster(impCreateDragRaster(*getSdrDragView().GetSdrPageView(), GetMarkedRect()));
+
+ if(aDragRaster.count())
+ {
+ addSdrDragEntry(new SdrDragEntryPolyPolygon(aDragRaster));
+ }
+ }
+
+ // call parent
+ SdrDragMethod::createSdrDragEntries();
+}
+
+bool SdrDragCrook::BeginSdrDrag()
+{
+ bContortionAllowed=getSdrDragView().IsCrookAllowed(false);
+ bNoContortionAllowed=getSdrDragView().IsCrookAllowed(true);
+ bResizeAllowed=getSdrDragView().IsResizeAllowed(false);
+ bRotateAllowed=getSdrDragView().IsRotateAllowed(false);
+
+ if (bContortionAllowed || bNoContortionAllowed)
+ {
+ bVertical=(GetDragHdlKind()==HDL_LOWER || GetDragHdlKind()==HDL_UPPER);
+ aMarkRect=GetMarkedRect();
+ aMarkCenter=aMarkRect.Center();
+ nMarkSize=bVertical ? (aMarkRect.GetHeight()-1) : (aMarkRect.GetWidth()-1);
+ aCenter=aMarkCenter;
+ aStart=DragStat().GetStart();
+ Show();
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+void SdrDragCrook::_MovAllPoints(basegfx::B2DPolyPolygon& rTarget)
+{
+ SdrPageView* pPV = getSdrDragView().GetSdrPageView();
+
+ if(pPV)
+ {
+ XPolyPolygon aTempPolyPoly(rTarget);
+
+ if (pPV->HasMarkedObjPageView())
+ {
+ sal_uInt16 nPolyAnz=aTempPolyPoly.Count();
+
+ if (!bContortion && !getSdrDragView().IsNoDragXorPolys())
+ {
+ sal_uInt16 n1st=0,nLast=0;
+ Point aC(aCenter);
+
+ while (n1st<nPolyAnz)
+ {
+ nLast=n1st;
+ while (nLast<nPolyAnz && aTempPolyPoly[nLast].GetPointCount()!=0) nLast++;
+ Rectangle aBound(aTempPolyPoly[n1st].GetBoundRect());
+ sal_uInt16 i;
+
+ for (i=n1st+1; i<nLast; i++)
+ {
+ aBound.Union(aTempPolyPoly[n1st].GetBoundRect());
+ }
+
+ Point aCtr0(aBound.Center());
+ Point aCtr1(aCtr0);
+
+ if (bResize)
+ {
+ Fraction aFact1(1,1);
+
+ if (bVertical)
+ {
+ ResizePoint(aCtr1,aC,aFact1,aFact);
+ }
+ else
+ {
+ ResizePoint(aCtr1,aC,aFact,aFact1);
+ }
+ }
+
+ bool bRotOk=false;
+ double nSin=0,nCos=0;
+
+ if (aRad.X()!=0 && aRad.Y()!=0)
+ {
+ bRotOk=bRotate;
+
+ switch (eMode)
+ {
+ case SDRCROOK_ROTATE : CrookRotateXPoint (aCtr1,NULL,NULL,aC,aRad,nSin,nCos,bVertical); break;
+ case SDRCROOK_SLANT : CrookSlantXPoint (aCtr1,NULL,NULL,aC,aRad,nSin,nCos,bVertical); break;
+ case SDRCROOK_STRETCH: CrookStretchXPoint(aCtr1,NULL,NULL,aC,aRad,nSin,nCos,bVertical,aMarkRect); break;
+ } // switch
+ }
+
+ aCtr1-=aCtr0;
+
+ for (i=n1st; i<nLast; i++)
+ {
+ if (bRotOk)
+ {
+ RotateXPoly(aTempPolyPoly[i],aCtr0,nSin,nCos);
+ }
+
+ aTempPolyPoly[i].Move(aCtr1.X(),aCtr1.Y());
+ }
+
+ n1st=nLast+1;
+ }
+ }
+ else
+ {
+ sal_uInt16 i,j;
+
+ for (j=0; j<nPolyAnz; j++)
+ {
+ XPolygon& aPol=aTempPolyPoly[j];
+ sal_uInt16 nPtAnz=aPol.GetPointCount();
+ i=0;
+
+ while (i<nPtAnz)
+ {
+ Point* pPnt=&aPol[i];
+ Point* pC1=NULL;
+ Point* pC2=NULL;
+
+ if (i+1<nPtAnz && aPol.IsControl(i))
+ { // Kontrollpunkt links
+ pC1=pPnt;
+ i++;
+ pPnt=&aPol[i];
+ }
+
+ i++;
+
+ if (i<nPtAnz && aPol.IsControl(i))
+ { // Kontrollpunkt rechts
+ pC2=&aPol[i];
+ i++;
+ }
+
+ _MovCrookPoint(*pPnt,pC1,pC2);
+ }
+ }
+ }
+ }
+
+ rTarget = aTempPolyPoly.getB2DPolyPolygon();
+ }
+}
+
+void SdrDragCrook::_MovCrookPoint(Point& rPnt, Point* pC1, Point* pC2)
+{
+ bool bVert=bVertical;
+ bool bC1=pC1!=NULL;
+ bool bC2=pC2!=NULL;
+ Point aC(aCenter);
+
+ if (bResize)
+ {
+ Fraction aFact1(1,1);
+
+ if (bVert)
+ {
+ ResizePoint(rPnt,aC,aFact1,aFact);
+
+ if (bC1)
+ ResizePoint(*pC1,aC,aFact1,aFact);
+
+ if (bC2)
+ ResizePoint(*pC2,aC,aFact1,aFact);
+ }
+ else
+ {
+ ResizePoint(rPnt,aC,aFact,aFact1);
+
+ if (bC1)
+ ResizePoint(*pC1,aC,aFact,aFact1);
+
+ if (bC2)
+ ResizePoint(*pC2,aC,aFact,aFact1);
+ }
+ }
+
+ if (aRad.X()!=0 && aRad.Y()!=0)
+ {
+ double nSin,nCos;
+
+ switch (eMode)
+ {
+ case SDRCROOK_ROTATE : CrookRotateXPoint (rPnt,pC1,pC2,aC,aRad,nSin,nCos,bVert); break;
+ case SDRCROOK_SLANT : CrookSlantXPoint (rPnt,pC1,pC2,aC,aRad,nSin,nCos,bVert); break;
+ case SDRCROOK_STRETCH: CrookStretchXPoint(rPnt,pC1,pC2,aC,aRad,nSin,nCos,bVert,aMarkRect); break;
+ } // switch
+ }
+}
+
+void SdrDragCrook::MoveSdrDrag(const Point& rPnt)
+{
+ if (DragStat().CheckMinMoved(rPnt))
+ {
+ Point aPnt(rPnt);
+ bool bNeuMoveOnly=getSdrDragView().IsMoveOnlyDragging();
+ bAtCenter=false;
+ SdrCrookMode eNeuMode=getSdrDragView().GetCrookMode();
+ bool bNeuContortion=!bNeuMoveOnly && ((bContortionAllowed && !getSdrDragView().IsCrookNoContortion()) || !bNoContortionAllowed);
+ bResize=!getSdrDragView().IsOrtho() && bResizeAllowed && !bNeuMoveOnly;
+ bool bNeuRotate=bRotateAllowed && !bNeuContortion && !bNeuMoveOnly && eNeuMode==SDRCROOK_ROTATE;
+ long nSA=0;
+
+ if (nSA==0)
+ aPnt=GetSnapPos(aPnt);
+
+ Point aNeuCenter(aMarkCenter.X(),aStart.Y());
+
+ if (bVertical)
+ {
+ aNeuCenter.X()=aStart.X();
+ aNeuCenter.Y()=aMarkCenter.Y();
+ }
+
+ if (!getSdrDragView().IsCrookAtCenter())
+ {
+ switch (GetDragHdlKind())
+ {
+ case HDL_UPLFT: aNeuCenter.X()=aMarkRect.Right(); bLft=true; break;
+ case HDL_UPPER: aNeuCenter.Y()=aMarkRect.Bottom(); bUpr=true; break;
+ case HDL_UPRGT: aNeuCenter.X()=aMarkRect.Left(); bRgt=true; break;
+ case HDL_LEFT : aNeuCenter.X()=aMarkRect.Right(); bLft=true; break;
+ case HDL_RIGHT: aNeuCenter.X()=aMarkRect.Left(); bRgt=true; break;
+ case HDL_LWLFT: aNeuCenter.X()=aMarkRect.Right(); bLft=true; break;
+ case HDL_LOWER: aNeuCenter.Y()=aMarkRect.Top(); bLwr=true; break;
+ case HDL_LWRGT: aNeuCenter.X()=aMarkRect.Left(); bRgt=true; break;
+ default: bAtCenter=true;
+ }
+ }
+ else
+ bAtCenter=true;
+
+ Fraction aNeuFact(1,1);
+ long dx1=aPnt.X()-aNeuCenter.X();
+ long dy1=aPnt.Y()-aNeuCenter.Y();
+ bValid=bVertical ? dx1!=0 : dy1!=0;
+
+ if (bValid)
+ {
+ if (bVertical)
+ bValid=Abs(dx1)*100>Abs(dy1);
+ else
+ bValid=Abs(dy1)*100>Abs(dx1);
+ }
+
+ long nNeuRad=0;
+ nWink=0;
+
+ if (bValid)
+ {
+ double a=0; // Steigung des Radius
+ long nPntWink=0;
+
+ if (bVertical)
+ {
+ a=((double)dy1)/((double)dx1); // Steigung des Radius
+ nNeuRad=((long)(dy1*a)+dx1) /2;
+ aNeuCenter.X()+=nNeuRad;
+ nPntWink=GetAngle(aPnt-aNeuCenter);
+ }
+ else
+ {
+ a=((double)dx1)/((double)dy1); // Steigung des Radius
+ nNeuRad=((long)(dx1*a)+dy1) /2;
+ aNeuCenter.Y()+=nNeuRad;
+ nPntWink=GetAngle(aPnt-aNeuCenter)-9000;
+ }
+
+ if (!bAtCenter)
+ {
+ if (nNeuRad<0)
+ {
+ if (bRgt) nPntWink+=18000;
+ if (bLft) nPntWink=18000-nPntWink;
+ if (bLwr) nPntWink=-nPntWink;
+ }
+ else
+ {
+ if (bRgt) nPntWink=-nPntWink;
+ if (bUpr) nPntWink=18000-nPntWink;
+ if (bLwr) nPntWink+=18000;
+ }
+
+ nPntWink=NormAngle360(nPntWink);
+ }
+ else
+ {
+ if (nNeuRad<0) nPntWink+=18000;
+ if (bVertical) nPntWink=18000-nPntWink;
+ nPntWink=NormAngle180(nPntWink);
+ nPntWink=Abs(nPntWink);
+ }
+
+ double nUmfang=2*Abs(nNeuRad)*nPi;
+
+ if (bResize)
+ {
+ if (nSA!=0)
+ { // Winkelfang
+ long nWink0=nPntWink;
+ nPntWink+=nSA/2;
+ nPntWink/=nSA;
+ nPntWink*=nSA;
+ BigInt a2(nNeuRad);
+ a2*=BigInt(nWink);
+ a2/=BigInt(nWink0);
+ nNeuRad=long(a2);
+
+ if (bVertical)
+ aNeuCenter.X()=aStart.X()+nNeuRad;
+ else
+ aNeuCenter.Y()=aStart.Y()+nNeuRad;
+ }
+
+ long nMul=(long)(nUmfang*NormAngle360(nPntWink)/36000);
+
+ if (bAtCenter)
+ nMul*=2;
+
+ aNeuFact=Fraction(nMul,nMarkSize);
+ nWink=nPntWink;
+ }
+ else
+ {
+ nWink=(long)((nMarkSize*360/nUmfang)*100)/2;
+
+ if (nWink==0)
+ bValid=false;
+
+ if (bValid && nSA!=0)
+ { // Winkelfang
+ long nWink0=nWink;
+ nWink+=nSA/2;
+ nWink/=nSA;
+ nWink*=nSA;
+ BigInt a2(nNeuRad);
+ a2*=BigInt(nWink);
+ a2/=BigInt(nWink0);
+ nNeuRad=long(a2);
+
+ if (bVertical)
+ aNeuCenter.X()=aStart.X()+nNeuRad;
+ else
+ aNeuCenter.Y()=aStart.Y()+nNeuRad;
+ }
+ }
+ }
+
+ if (nWink==0 || nNeuRad==0)
+ bValid=false;
+
+ if (!bValid)
+ nNeuRad=0;
+
+ if (!bValid && bResize)
+ {
+ long nMul=bVertical ? dy1 : dx1;
+
+ if (bLft || bUpr)
+ nMul=-nMul;
+
+ long nDiv=nMarkSize;
+
+ if (bAtCenter)
+ {
+ nMul*=2;
+ nMul=Abs(nMul);
+ }
+
+ aNeuFact=Fraction(nMul,nDiv);
+ }
+
+ if (aNeuCenter!=aCenter || bNeuContortion!=bContortion || aNeuFact!=aFact ||
+ bNeuMoveOnly != getMoveOnly() || bNeuRotate!=bRotate || eNeuMode!=eMode)
+ {
+ Hide();
+ setMoveOnly(bNeuMoveOnly);
+ bRotate=bNeuRotate;
+ eMode=eNeuMode;
+ bContortion=bNeuContortion;
+ aCenter=aNeuCenter;
+ aFact=aNeuFact;
+ aRad=Point(nNeuRad,nNeuRad);
+ bResize=aFact!=Fraction(1,1) && aFact.GetDenominator()!=0 && aFact.IsValid();
+ DragStat().NextMove(aPnt);
+ Show();
+ }
+ }
+}
+
+void SdrDragCrook::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
+{
+ const bool bDoResize(aFact!=Fraction(1,1));
+ const bool bDoCrook(aCenter!=aMarkCenter && aRad.X()!=0 && aRad.Y()!=0);
+
+ if (bDoCrook || bDoResize)
+ {
+ if (bDoResize)
+ {
+ Fraction aFact1(1,1);
+
+ if (bContortion)
+ {
+ if (bVertical)
+ {
+ rTarget.Resize(aCenter,aFact1,aFact);
+ }
+ else
+ {
+ rTarget.Resize(aCenter,aFact,aFact1);
+ }
+ }
+ else
+ {
+ Point aCtr0(rTarget.GetSnapRect().Center());
+ Point aCtr1(aCtr0);
+
+ if (bVertical)
+ {
+ ResizePoint(aCtr1,aCenter,aFact1,aFact);
+ }
+ else
+ {
+ ResizePoint(aCtr1,aCenter,aFact,aFact1);
+ }
+
+ Size aSiz(aCtr1.X()-aCtr0.X(),aCtr1.Y()-aCtr0.Y());
+
+ rTarget.Move(aSiz);
+ }
+ }
+
+ if (bDoCrook)
+ {
+ const Rectangle aLocalMarkRect(getSdrDragView().GetMarkedObjRect());
+ const bool bLocalRotate(!bContortion && eMode == SDRCROOK_ROTATE && getSdrDragView().IsRotateAllowed(false));
+
+ getSdrDragView().ImpCrookObj(&rTarget,aCenter,aRad,eMode,bVertical,!bContortion,bLocalRotate,aLocalMarkRect);
+ }
+ }
+}
+
+void SdrDragCrook::applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget)
+{
+ // use helper derived from old stuff
+ _MovAllPoints(rTarget);
+}
+
+bool SdrDragCrook::EndSdrDrag(bool bCopy)
+{
+ Hide();
+
+ if (bResize && aFact==Fraction(1,1))
+ bResize=false;
+
+ const bool bUndo = getSdrDragView().IsUndoEnabled();
+
+ bool bDoCrook=aCenter!=aMarkCenter && aRad.X()!=0 && aRad.Y()!=0;
+
+ if (bDoCrook || bResize)
+ {
+ if (bResize && bUndo)
+ {
+ XubString aStr;
+ ImpTakeDescriptionStr(!bContortion?STR_EditCrook:STR_EditCrookContortion,aStr);
+
+ if (bCopy)
+ aStr+=ImpGetResStr(STR_EditWithCopy);
+
+ getSdrDragView().BegUndo(aStr);
+ }
+
+ if (bResize)
+ {
+ Fraction aFact1(1,1);
+
+ if (bContortion)
+ {
+ if (bVertical)
+ getSdrDragView().ResizeMarkedObj(aCenter,aFact1,aFact,bCopy);
+ else
+ getSdrDragView().ResizeMarkedObj(aCenter,aFact,aFact1,bCopy);
+ }
+ else
+ {
+ if (bCopy)
+ getSdrDragView().CopyMarkedObj();
+
+ sal_uLong nMarkAnz=getSdrDragView().GetMarkedObjectList().GetMarkCount();
+
+ for (sal_uLong nm=0; nm<nMarkAnz; nm++)
+ {
+ SdrMark* pM=getSdrDragView().GetMarkedObjectList().GetMark(nm);
+ SdrObject* pO=pM->GetMarkedSdrObj();
+ Point aCtr0(pO->GetSnapRect().Center());
+ Point aCtr1(aCtr0);
+
+ if (bVertical)
+ ResizePoint(aCtr1,aCenter,aFact1,aFact);
+ else
+ ResizePoint(aCtr1,aCenter,aFact,aFact1);
+
+ Size aSiz(aCtr1.X()-aCtr0.X(),aCtr1.Y()-aCtr0.Y());
+ if( bUndo )
+ AddUndo(getSdrDragView().GetModel()->GetSdrUndoFactory().CreateUndoMoveObject(*pO,aSiz));
+ pO->Move(aSiz);
+ }
+ }
+
+ bCopy=false;
+ }
+
+ if (bDoCrook)
+ {
+ getSdrDragView().CrookMarkedObj(aCenter,aRad,eMode,bVertical,!bContortion,bCopy);
+ getSdrDragView().SetLastCrookCenter(aCenter);
+ }
+
+ if (bResize && bUndo)
+ getSdrDragView().EndUndo();
+
+ return true;
+ }
+
+ return false;
+}
+
+Pointer SdrDragCrook::GetSdrDragPointer() const
+{
+ return Pointer(POINTER_CROOK);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(SdrDragDistort,SdrDragMethod);
+
+SdrDragDistort::SdrDragDistort(SdrDragView& rNewView)
+: SdrDragMethod(rNewView),
+ nPolyPt(0),
+ bContortionAllowed(false),
+ bNoContortionAllowed(false),
+ bContortion(false)
+{
+}
+
+void SdrDragDistort::TakeSdrDragComment(XubString& rStr) const
+{
+ ImpTakeDescriptionStr(STR_DragMethDistort, rStr);
+
+ XubString aStr;
+
+ rStr.AppendAscii(" (x=");
+ getSdrDragView().GetModel()->TakeMetricStr(DragStat().GetDX(), aStr);
+ rStr += aStr;
+ rStr.AppendAscii(" y=");
+ getSdrDragView().GetModel()->TakeMetricStr(DragStat().GetDY(), aStr);
+ rStr += aStr;
+ rStr += sal_Unicode(')');
+
+ if(getSdrDragView().IsDragWithCopy())
+ rStr += ImpGetResStr(STR_EditWithCopy);
+}
+
+void SdrDragDistort::createSdrDragEntries()
+{
+ // Add extended frame raster first, so it will be behind objects
+ if(getSdrDragView().GetSdrPageView())
+ {
+ const basegfx::B2DPolyPolygon aDragRaster(impCreateDragRaster(*getSdrDragView().GetSdrPageView(), GetMarkedRect()));
+
+ if(aDragRaster.count())
+ {
+ addSdrDragEntry(new SdrDragEntryPolyPolygon(aDragRaster));
+ }
+ }
+
+ // call parent
+ SdrDragMethod::createSdrDragEntries();
+}
+
+bool SdrDragDistort::BeginSdrDrag()
+{
+ bContortionAllowed=getSdrDragView().IsDistortAllowed(false);
+ bNoContortionAllowed=getSdrDragView().IsDistortAllowed(true);
+
+ if (bContortionAllowed || bNoContortionAllowed)
+ {
+ SdrHdlKind eKind=GetDragHdlKind();
+ nPolyPt=0xFFFF;
+
+ if (eKind==HDL_UPLFT) nPolyPt=0;
+ if (eKind==HDL_UPRGT) nPolyPt=1;
+ if (eKind==HDL_LWRGT) nPolyPt=2;
+ if (eKind==HDL_LWLFT) nPolyPt=3;
+ if (nPolyPt>3) return false;
+
+ aMarkRect=GetMarkedRect();
+ aDistortedRect=XPolygon(aMarkRect);
+ Show();
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+void SdrDragDistort::_MovAllPoints(basegfx::B2DPolyPolygon& rTarget)
+{
+ if (bContortion)
+ {
+ SdrPageView* pPV = getSdrDragView().GetSdrPageView();
+
+ if(pPV)
+ {
+ if (pPV->HasMarkedObjPageView())
+ {
+ basegfx::B2DPolyPolygon aDragPolygon(rTarget);
+ const basegfx::B2DRange aOriginalRange(aMarkRect.Left(), aMarkRect.Top(), aMarkRect.Right(), aMarkRect.Bottom());
+ const basegfx::B2DPoint aTopLeft(aDistortedRect[0].X(), aDistortedRect[0].Y());
+ const basegfx::B2DPoint aTopRight(aDistortedRect[1].X(), aDistortedRect[1].Y());
+ const basegfx::B2DPoint aBottomLeft(aDistortedRect[3].X(), aDistortedRect[3].Y());
+ const basegfx::B2DPoint aBottomRight(aDistortedRect[2].X(), aDistortedRect[2].Y());
+
+ aDragPolygon = basegfx::tools::distort(aDragPolygon, aOriginalRange, aTopLeft, aTopRight, aBottomLeft, aBottomRight);
+ rTarget = aDragPolygon;
+ }
+ }
+ }
+}
+
+void SdrDragDistort::MoveSdrDrag(const Point& rPnt)
+{
+ if (DragStat().CheckMinMoved(rPnt))
+ {
+ Point aPnt(GetSnapPos(rPnt));
+
+ if (getSdrDragView().IsOrtho())
+ OrthoDistance8(DragStat().GetStart(),aPnt,getSdrDragView().IsBigOrtho());
+
+ bool bNeuContortion=(bContortionAllowed && !getSdrDragView().IsCrookNoContortion()) || !bNoContortionAllowed;
+
+ if (bNeuContortion!=bContortion || aDistortedRect[nPolyPt]!=aPnt)
+ {
+ Hide();
+ aDistortedRect[nPolyPt]=aPnt;
+ bContortion=bNeuContortion;
+ DragStat().NextMove(aPnt);
+ Show();
+ }
+ }
+}
+
+bool SdrDragDistort::EndSdrDrag(bool bCopy)
+{
+ Hide();
+ bool bDoDistort=DragStat().GetDX()!=0 || DragStat().GetDY()!=0;
+
+ if (bDoDistort)
+ {
+ getSdrDragView().DistortMarkedObj(aMarkRect,aDistortedRect,!bContortion,bCopy);
+ return true;
+ }
+
+ return false;
+}
+
+Pointer SdrDragDistort::GetSdrDragPointer() const
+{
+ return Pointer(POINTER_REFHAND);
+}
+
+void SdrDragDistort::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
+{
+ const bool bDoDistort(DragStat().GetDX()!=0 || DragStat().GetDY()!=0);
+
+ if (bDoDistort)
+ {
+ getSdrDragView().ImpDistortObj(&rTarget, aMarkRect, aDistortedRect, !bContortion);
+ }
+}
+
+void SdrDragDistort::applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget)
+{
+ // use helper derived from old stuff
+ _MovAllPoints(rTarget);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(SdrDragCrop,SdrDragResize);
+
+SdrDragCrop::SdrDragCrop(SdrDragView& rNewView)
+: SdrDragResize(rNewView)
+{
+ // switch off solid dragging for crop; it just makes no sense since showing
+ // a 50% transparent object above the original will not be visible
+ setSolidDraggingActive(false);
+}
+
+void SdrDragCrop::TakeSdrDragComment(XubString& rStr) const
+{
+ ImpTakeDescriptionStr(STR_DragMethCrop, rStr);
+
+ XubString aStr;
+
+ rStr.AppendAscii(" (x=");
+ getSdrDragView().GetModel()->TakeMetricStr(DragStat().GetDX(), aStr);
+ rStr += aStr;
+ rStr.AppendAscii(" y=");
+ getSdrDragView().GetModel()->TakeMetricStr(DragStat().GetDY(), aStr);
+ rStr += aStr;
+ rStr += sal_Unicode(')');
+
+ if(getSdrDragView().IsDragWithCopy())
+ rStr += ImpGetResStr(STR_EditWithCopy);
+}
+
+bool SdrDragCrop::EndSdrDrag(bool bCopy)
+{
+ Hide();
+
+ if( DragStat().GetDX()==0 && DragStat().GetDY()==0 )
+ return false;
+
+ const SdrMarkList& rMarkList = getSdrDragView().GetMarkedObjectList();
+
+ if( rMarkList.GetMarkCount() != 1 )
+ return false;
+
+ SdrGrafObj* pObj = dynamic_cast<SdrGrafObj*>( rMarkList.GetMark( 0 )->GetMarkedSdrObj() );
+
+ if( !pObj || (pObj->GetGraphicType() == GRAPHIC_NONE) || (pObj->GetGraphicType() == GRAPHIC_DEFAULT) )
+ return false;
+
+ const GraphicObject& rGraphicObject = pObj->GetGraphicObject();
+ const MapMode aMapMode100thmm(MAP_100TH_MM);
+ Size aGraphicSize(rGraphicObject.GetPrefSize());
+
+ if( MAP_PIXEL == rGraphicObject.GetPrefMapMode().GetMapUnit() )
+ aGraphicSize = Application::GetDefaultDevice()->PixelToLogic( aGraphicSize, aMapMode100thmm );
+ else
+ aGraphicSize = Application::GetDefaultDevice()->LogicToLogic( aGraphicSize, rGraphicObject.GetPrefMapMode(), aMapMode100thmm);
+
+ if( aGraphicSize.nA == 0 || aGraphicSize.nB == 0 )
+ return false;
+
+ const SdrGrafCropItem& rOldCrop = (const SdrGrafCropItem&)pObj->GetMergedItem(SDRATTR_GRAFCROP);
+
+ const bool bUndo = getSdrDragView().IsUndoEnabled();
+
+ if( bUndo )
+ {
+ String aUndoStr;
+ ImpTakeDescriptionStr(STR_DragMethCrop, aUndoStr);
+
+ getSdrDragView().BegUndo( aUndoStr );
+ getSdrDragView().AddUndo( getSdrDragView().GetModel()->GetSdrUndoFactory().CreateUndoGeoObject( *pObj ) );
+ }
+
+ Rectangle aOldRect( pObj->GetLogicRect() );
+ getSdrDragView().ResizeMarkedObj(DragStat().Ref1(),aXFact,aYFact,bCopy);
+ Rectangle aNewRect( pObj->GetLogicRect() );
+
+ double fScaleX = ( aGraphicSize.Width() - rOldCrop.GetLeft() - rOldCrop.GetRight() ) / (double)aOldRect.GetWidth();
+ double fScaleY = ( aGraphicSize.Height() - rOldCrop.GetTop() - rOldCrop.GetBottom() ) / (double)aOldRect.GetHeight();
+
+ sal_Int32 nDiffLeft = aNewRect.nLeft - aOldRect.nLeft;
+ sal_Int32 nDiffTop = aNewRect.nTop - aOldRect.nTop;
+ sal_Int32 nDiffRight = aNewRect.nRight - aOldRect.nRight;
+ sal_Int32 nDiffBottom = aNewRect.nBottom - aOldRect.nBottom;
+
+ sal_Int32 nLeftCrop = static_cast<sal_Int32>( rOldCrop.GetLeft() + nDiffLeft * fScaleX );
+ sal_Int32 nTopCrop = static_cast<sal_Int32>( rOldCrop.GetTop() + nDiffTop * fScaleY );
+ sal_Int32 nRightCrop = static_cast<sal_Int32>( rOldCrop.GetRight() - nDiffRight * fScaleX );
+ sal_Int32 nBottomCrop = static_cast<sal_Int32>( rOldCrop.GetBottom() - nDiffBottom * fScaleY );
+
+ SfxItemPool& rPool = getSdrDragView().GetModel()->GetItemPool();
+ SfxItemSet aSet( rPool, SDRATTR_GRAFCROP, SDRATTR_GRAFCROP );
+ aSet.Put( SdrGrafCropItem( nLeftCrop, nTopCrop, nRightCrop, nBottomCrop ) );
+ getSdrDragView().SetAttributes( aSet, false );
+
+ if( bUndo )
+ getSdrDragView().EndUndo();
+
+ return true;
+}
+
+Pointer SdrDragCrop::GetSdrDragPointer() const
+{
+ return Pointer(POINTER_CROP);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/svdraw/svddrgv.cxx b/svx/source/svdraw/svddrgv.cxx
new file mode 100644
index 000000000000..ea2b67ca12f6
--- /dev/null
+++ b/svx/source/svdraw/svddrgv.cxx
@@ -0,0 +1,1006 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svddrgv.hxx>
+#include "svx/xattr.hxx"
+#include <svx/xpoly.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/svdtrans.hxx>
+#include <svx/svdundo.hxx>
+#include <svx/svdocapt.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/svdoedge.hxx>
+#include "svx/svdstr.hrc"
+#include "svx/svdglob.hxx"
+#include "svddrgm1.hxx"
+#include <svx/obj3d.hxx>
+#include <svx/svdoashp.hxx>
+#include <svx/sdrpaintwindow.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <svx/polypolygoneditor.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+
+using namespace sdr;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@@ @@@@@ @@@@ @@@@ @@ @@ @@ @@@@@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@
+// @@ @@ @@@@@ @@@@@@ @@ @@@ @@@@@ @@ @@@@ @@@@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@
+// @@@@@ @@ @@ @@ @@ @@@@@ @ @@ @@@@@ @@ @@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrDragView::ImpClearVars()
+{
+ bFramDrag=sal_False;
+ eDragMode=SDRDRAG_MOVE;
+ bDragLimit=sal_False;
+ bMarkedHitMovesAlways=sal_False;
+ eDragHdl=HDL_MOVE;
+ pDragHdl=NULL;
+ bDragHdl=sal_False;
+ bDragSpecial=sal_False;
+ mpCurrentSdrDragMethod=NULL;
+ bDragStripes=sal_False;
+ bMirrRefDragObj=sal_True;
+ bDragWithCopy=sal_False;
+ pInsPointUndo=NULL;
+ bInsGluePoint=sal_False;
+ bInsObjPointMode=sal_False;
+ bInsGluePointMode=sal_False;
+ nDragXorPolyLimit=100;
+ nDragXorPointLimit=500;
+ bNoDragXorPolys=sal_False;
+ bAutoVertexCon=sal_True;
+ bAutoCornerCon=sal_False;
+ bRubberEdgeDragging=sal_True;
+ nRubberEdgeDraggingLimit=100;
+ bDetailedEdgeDragging=sal_True;
+ nDetailedEdgeDraggingLimit=10;
+ bResizeAtCenter=sal_False;
+ bCrookAtCenter=sal_False;
+ bMouseHideWhileDraggingPoints=sal_False;
+
+ // init using default
+ mbSolidDragging = getOptionsDrawinglayer().IsSolidDragCreate();
+}
+
+void SdrDragView::ImpMakeDragAttr()
+{
+ ImpDelDragAttr();
+}
+
+SdrDragView::SdrDragView(SdrModel* pModel1, OutputDevice* pOut)
+: SdrExchangeView(pModel1,pOut)
+{
+ ImpClearVars();
+ ImpMakeDragAttr();
+}
+
+SdrDragView::~SdrDragView()
+{
+ ImpDelDragAttr();
+}
+
+void SdrDragView::ImpDelDragAttr()
+{
+}
+
+sal_Bool SdrDragView::IsAction() const
+{
+ return (mpCurrentSdrDragMethod || SdrExchangeView::IsAction());
+}
+
+void SdrDragView::MovAction(const Point& rPnt)
+{
+ SdrExchangeView::MovAction(rPnt);
+ if (mpCurrentSdrDragMethod)
+ {
+ MovDragObj(rPnt);
+ }
+}
+
+void SdrDragView::EndAction()
+{
+ if (mpCurrentSdrDragMethod)
+ {
+ EndDragObj(sal_False);
+ }
+ SdrExchangeView::EndAction();
+}
+
+void SdrDragView::BckAction()
+{
+ SdrExchangeView::BckAction();
+ BrkDragObj();
+}
+
+void SdrDragView::BrkAction()
+{
+ SdrExchangeView::BrkAction();
+ BrkDragObj();
+}
+
+void SdrDragView::TakeActionRect(Rectangle& rRect) const
+{
+ if (mpCurrentSdrDragMethod)
+ {
+ rRect=aDragStat.GetActionRect();
+ if (rRect.IsEmpty())
+ {
+ SdrPageView* pPV = GetSdrPageView();
+
+ if(pPV&& pPV->HasMarkedObjPageView())
+ {
+ // #i95646# is this used..?
+ const basegfx::B2DRange aBoundRange(mpCurrentSdrDragMethod->getCurrentRange());
+ rRect = Rectangle(
+ basegfx::fround(aBoundRange.getMinX()), basegfx::fround(aBoundRange.getMinY()),
+ basegfx::fround(aBoundRange.getMaxX()), basegfx::fround(aBoundRange.getMaxY()));
+ }
+ }
+ if (rRect.IsEmpty())
+ {
+ rRect=Rectangle(aDragStat.GetNow(),aDragStat.GetNow());
+ }
+ }
+ else
+ {
+ SdrExchangeView::TakeActionRect(rRect);
+ }
+}
+
+sal_Bool SdrDragView::TakeDragObjAnchorPos(Point& rPos, sal_Bool bTR ) const
+{
+ Rectangle aR;
+ TakeActionRect(aR);
+ rPos = bTR ? aR.TopRight() : aR.TopLeft();
+ if (GetMarkedObjectCount()==1 && IsDragObj() && // nur bei Einzelselektion
+ !IsDraggingPoints() && !IsDraggingGluePoints() && // nicht beim Punkteschieben
+ !mpCurrentSdrDragMethod->ISA(SdrDragMovHdl)) // nicht beim Handlesschieben
+ {
+ SdrObject* pObj=GetMarkedObjectByIndex(0);
+ if (pObj->ISA(SdrCaptionObj))
+ {
+ Point aPt(((SdrCaptionObj*)pObj)->GetTailPos());
+ sal_Bool bTail=eDragHdl==HDL_POLY; // Schwanz wird gedraggt (nicht so ganz feine Abfrage hier)
+ sal_Bool bOwn=mpCurrentSdrDragMethod->ISA(SdrDragObjOwn); // Objektspeziefisch
+ if (!bTail)
+ { // bei bTail liefert TakeActionRect schon das richtige
+ if (bOwn)
+ { // bOwn kann sein MoveTextFrame, ResizeTextFrame aber eben nicht mehr DragTail
+ rPos=aPt;
+ }
+ else
+ {
+ // drag the whole Object (Move, Resize, ...)
+ const basegfx::B2DPoint aTransformed(mpCurrentSdrDragMethod->getCurrentTransformation() * basegfx::B2DPoint(aPt.X(), aPt.Y()));
+ rPos.X() = basegfx::fround(aTransformed.getX());
+ rPos.Y() = basegfx::fround(aTransformed.getY());
+ }
+ }
+ }
+ return sal_True;
+ }
+ return sal_False;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_Bool SdrDragView::TakeDragLimit(SdrDragMode /*eMode*/, Rectangle& /*rRect*/) const
+{
+ return sal_False;
+}
+
+sal_Bool SdrDragView::BegDragObj(const Point& rPnt, OutputDevice* pOut, SdrHdl* pHdl, short nMinMov, SdrDragMethod* pForcedMeth)
+{
+ BrkAction();
+
+ bool bRet=false;
+ {
+ SetDragWithCopy(sal_False);
+ //ForceEdgesOfMarkedNodes();
+ //TODO: aAni.Reset();
+ mpCurrentSdrDragMethod=NULL;
+ bDragSpecial=sal_False;
+ bDragLimit=sal_False;
+ SdrDragMode eTmpMode=eDragMode;
+ if (eTmpMode==SDRDRAG_MOVE && pHdl!=NULL && pHdl->GetKind()!=HDL_MOVE) {
+ eTmpMode=SDRDRAG_RESIZE;
+ }
+ bDragLimit=TakeDragLimit(eTmpMode,aDragLimit);
+ bFramDrag=ImpIsFrameHandles();
+ if (!bFramDrag &&
+ (pMarkedObj==NULL || !pMarkedObj->hasSpecialDrag()) &&
+ (pHdl==NULL || pHdl->GetObj()==NULL)) {
+ bFramDrag=sal_True;
+ }
+
+ Point aPnt(rPnt);
+ if(pHdl == NULL
+ || pHdl->GetKind() == HDL_MOVE
+ || pHdl->GetKind() == HDL_MIRX
+ || pHdl->GetKind() == HDL_TRNS
+ || pHdl->GetKind() == HDL_GRAD)
+ {
+ aDragStat.Reset(aPnt);
+ }
+ else
+ {
+ aDragStat.Reset(pHdl->GetPos());
+ }
+
+ aDragStat.SetView((SdrView*)this);
+ aDragStat.SetPageView(pMarkedPV); // <<-- hier muss die DragPV rein!!!
+ aDragStat.SetMinMove(ImpGetMinMovLogic(nMinMov,pOut));
+ aDragStat.SetHdl(pHdl);
+ aDragStat.NextPoint();
+ pDragWin=pOut;
+ pDragHdl=pHdl;
+ eDragHdl= pHdl==NULL ? HDL_MOVE : pHdl->GetKind();
+ bDragHdl=eDragHdl==HDL_REF1 || eDragHdl==HDL_REF2 || eDragHdl==HDL_MIRX;
+
+ // #103894# Expand test for HDL_ANCHOR_TR
+ sal_Bool bNotDraggable = (HDL_ANCHOR == eDragHdl || HDL_ANCHOR_TR == eDragHdl);
+
+ if(pHdl && (pHdl->GetKind() == HDL_SMARTTAG) && pForcedMeth )
+ {
+ // just use the forced method for smart tags
+ }
+ else if(bDragHdl)
+ {
+ mpCurrentSdrDragMethod = new SdrDragMovHdl(*this);
+ }
+ else if(!bNotDraggable)
+ {
+ switch (eDragMode)
+ {
+ case SDRDRAG_ROTATE: case SDRDRAG_SHEAR: case SDRDRAG_DISTORT:
+ {
+ switch (eDragHdl)
+ {
+ case HDL_LEFT: case HDL_RIGHT:
+ case HDL_UPPER: case HDL_LOWER:
+ {
+ // Sind 3D-Objekte selektiert?
+ sal_Bool b3DObjSelected = sal_False;
+ for(sal_uInt32 a=0;!b3DObjSelected && a<GetMarkedObjectCount();a++)
+ {
+ SdrObject* pObj = GetMarkedObjectByIndex(a);
+ if(pObj && pObj->ISA(E3dObject))
+ b3DObjSelected = sal_True;
+ }
+ // Falls ja, Shear auch bei !IsShearAllowed zulassen,
+ // da es sich bei 3D-Objekten um eingeschraenkte
+ // Rotationen handelt
+ if (!b3DObjSelected && !IsShearAllowed())
+ return sal_False;
+ mpCurrentSdrDragMethod = new SdrDragShear(*this,eDragMode==SDRDRAG_ROTATE);
+ } break;
+ case HDL_UPLFT: case HDL_UPRGT:
+ case HDL_LWLFT: case HDL_LWRGT:
+ {
+ if (eDragMode==SDRDRAG_SHEAR || eDragMode==SDRDRAG_DISTORT)
+ {
+ if (!IsDistortAllowed(sal_True) && !IsDistortAllowed(sal_False)) return sal_False;
+ mpCurrentSdrDragMethod = new SdrDragDistort(*this);
+ }
+ else
+ {
+ if (!IsRotateAllowed(sal_True)) return sal_False;
+ mpCurrentSdrDragMethod = new SdrDragRotate(*this);
+ }
+ } break;
+ default:
+ {
+ if (IsMarkedHitMovesAlways() && eDragHdl==HDL_MOVE)
+ { // HDL_MOVE ist auch wenn Obj direkt getroffen
+ if (!IsMoveAllowed()) return sal_False;
+ mpCurrentSdrDragMethod = new SdrDragMove(*this);
+ }
+ else
+ {
+ if (!IsRotateAllowed(sal_True)) return sal_False;
+ mpCurrentSdrDragMethod = new SdrDragRotate(*this);
+ }
+ }
+ }
+ } break;
+ case SDRDRAG_MIRROR:
+ {
+ if (eDragHdl==HDL_MOVE && IsMarkedHitMovesAlways())
+ {
+ if (!IsMoveAllowed()) return sal_False;
+ mpCurrentSdrDragMethod = new SdrDragMove(*this);
+ }
+ else
+ {
+ if (!IsMirrorAllowed(sal_True,sal_True)) return sal_False;
+ mpCurrentSdrDragMethod = new SdrDragMirror(*this);
+ }
+ } break;
+
+ case SDRDRAG_CROP:
+ {
+ if (eDragHdl==HDL_MOVE && IsMarkedHitMovesAlways())
+ {
+ if (!IsMoveAllowed())
+ return sal_False;
+ mpCurrentSdrDragMethod = new SdrDragMove(*this);
+ }
+ else
+ {
+ if (!IsCrookAllowed(sal_True) && !IsCrookAllowed(sal_False))
+ return sal_False;
+ mpCurrentSdrDragMethod = new SdrDragCrop(*this);
+ }
+ }
+ break;
+
+ case SDRDRAG_TRANSPARENCE:
+ {
+ if(eDragHdl == HDL_MOVE && IsMarkedHitMovesAlways())
+ {
+ if(!IsMoveAllowed())
+ return sal_False;
+ mpCurrentSdrDragMethod = new SdrDragMove(*this);
+ }
+ else
+ {
+ if(!IsTransparenceAllowed())
+ return sal_False;
+
+ mpCurrentSdrDragMethod = new SdrDragGradient(*this, sal_False);
+ }
+ break;
+ }
+ case SDRDRAG_GRADIENT:
+ {
+ if(eDragHdl == HDL_MOVE && IsMarkedHitMovesAlways())
+ {
+ if(!IsMoveAllowed())
+ return sal_False;
+ mpCurrentSdrDragMethod = new SdrDragMove(*this);
+ }
+ else
+ {
+ if(!IsGradientAllowed())
+ return sal_False;
+
+ mpCurrentSdrDragMethod = new SdrDragGradient(*this);
+ }
+ break;
+ }
+
+ case SDRDRAG_CROOK :
+ {
+ if (eDragHdl==HDL_MOVE && IsMarkedHitMovesAlways())
+ {
+ if (!IsMoveAllowed()) return sal_False;
+ mpCurrentSdrDragMethod = new SdrDragMove(*this);
+ }
+ else
+ {
+ if (!IsCrookAllowed(sal_True) && !IsCrookAllowed(sal_False)) return sal_False;
+ mpCurrentSdrDragMethod = new SdrDragCrook(*this);
+ }
+ } break;
+
+ default:
+ {
+ // SDRDRAG_MOVE
+ if((eDragHdl == HDL_MOVE) && !IsMoveAllowed())
+ {
+ return sal_False;
+ }
+ else if(eDragHdl == HDL_GLUE)
+ {
+ mpCurrentSdrDragMethod = new SdrDragMove(*this);
+ }
+ else
+ {
+ if(bFramDrag)
+ {
+ if(eDragHdl == HDL_MOVE)
+ {
+ mpCurrentSdrDragMethod = new SdrDragMove(*this);
+ }
+ else
+ {
+ if(!IsResizeAllowed(sal_True))
+ {
+ return sal_False;
+ }
+
+ sal_Bool bSingleTextObjMark = sal_False; // SJ: #i100490#
+ if ( GetMarkedObjectCount() == 1 )
+ {
+ pMarkedObj=GetMarkedObjectByIndex(0);
+ if ( pMarkedObj &&
+ pMarkedObj->ISA( SdrTextObj ) &&
+ static_cast<SdrTextObj*>(pMarkedObj)->IsTextFrame() )
+ bSingleTextObjMark = sal_True;
+ }
+ if ( bSingleTextObjMark )
+ mpCurrentSdrDragMethod = new SdrDragObjOwn(*this);
+ else
+ mpCurrentSdrDragMethod = new SdrDragResize(*this);
+ }
+ }
+ else
+ {
+ if(HDL_MOVE == eDragHdl)
+ {
+ const bool bCustomShapeSelected(1 == GetMarkedObjectCount() && GetMarkedObjectByIndex(0)->ISA(SdrObjCustomShape));
+
+ if(bCustomShapeSelected)
+ {
+ mpCurrentSdrDragMethod = new SdrDragMove( *this );
+ }
+ }
+ else if(HDL_POLY == eDragHdl)
+ {
+ const bool bConnectorSelected(1 == GetMarkedObjectCount() && GetMarkedObjectByIndex(0)->ISA(SdrEdgeObj));
+
+ if(bConnectorSelected)
+ {
+ // #i97784#
+ // fallback to old behaviour for connectors (see
+ // text in task description for more details)
+ }
+ else if(!IsMoveAllowed() || !IsResizeAllowed())
+ {
+ // #i77187#
+ // do not allow move of polygon points if object is move or size protected
+ return sal_False;
+ }
+ }
+
+ if(!mpCurrentSdrDragMethod)
+ {
+ // fallback to DragSpecial if no interaction defined
+ bDragSpecial = sal_True;
+ mpCurrentSdrDragMethod = new SdrDragObjOwn(*this);
+ }
+ }
+ }
+ }
+ }
+ }
+ if (pForcedMeth!=NULL)
+ {
+ delete mpCurrentSdrDragMethod;
+ mpCurrentSdrDragMethod = pForcedMeth;
+ }
+ aDragStat.SetDragMethod(mpCurrentSdrDragMethod);
+ if (mpCurrentSdrDragMethod)
+ {
+ bRet = mpCurrentSdrDragMethod->BeginSdrDrag();
+ if (!bRet)
+ {
+ if (pHdl==NULL && IS_TYPE(SdrDragObjOwn,mpCurrentSdrDragMethod))
+ {
+ // Aha, Obj kann nicht Move SpecialDrag, also MoveFrameDrag versuchen
+ delete mpCurrentSdrDragMethod;
+ mpCurrentSdrDragMethod = 0;
+ bDragSpecial=sal_False;
+
+ if (!IsMoveAllowed())
+ return sal_False;
+
+ bFramDrag=sal_True;
+ mpCurrentSdrDragMethod = new SdrDragMove(*this);
+ aDragStat.SetDragMethod(mpCurrentSdrDragMethod);
+ bRet = mpCurrentSdrDragMethod->BeginSdrDrag();
+ }
+ }
+ if (!bRet)
+ {
+ delete mpCurrentSdrDragMethod;
+ mpCurrentSdrDragMethod = 0;
+ aDragStat.SetDragMethod(mpCurrentSdrDragMethod);
+ }
+ }
+ }
+
+ return bRet;
+}
+
+void SdrDragView::MovDragObj(const Point& rPnt)
+{
+ if (mpCurrentSdrDragMethod)
+ {
+ Point aPnt(rPnt);
+ ImpLimitToWorkArea(aPnt);
+ mpCurrentSdrDragMethod->MoveSdrDrag(aPnt); // this call already makes a Hide()/Show combination
+ }
+}
+
+sal_Bool SdrDragView::EndDragObj(sal_Bool bCopy)
+{
+ bool bRet(false);
+
+ // #i73341# If insert GluePoint, do not insist on last points being different
+ if(mpCurrentSdrDragMethod && aDragStat.IsMinMoved() && (IsInsertGluePoint() || aDragStat.GetNow() != aDragStat.GetPrev()))
+ {
+ sal_uIntPtr nHdlAnzMerk=0;
+
+ if (bEliminatePolyPoints)
+ { // IBM Special
+ nHdlAnzMerk=GetMarkablePointCount();
+ }
+
+ const bool bUndo = IsUndoEnabled();
+ if (IsInsertGluePoint() && bUndo)
+ {
+ BegUndo(aInsPointUndoStr);
+ AddUndo(pInsPointUndo);
+ }
+
+ bRet = mpCurrentSdrDragMethod->EndSdrDrag(bCopy);
+
+ if( IsInsertGluePoint() && bUndo)
+ EndUndo();
+
+ delete mpCurrentSdrDragMethod;
+ mpCurrentSdrDragMethod = 0;
+
+ if (bEliminatePolyPoints)
+ { // IBM Special
+ if (nHdlAnzMerk!=GetMarkablePointCount())
+ {
+ UnmarkAllPoints();
+ }
+ }
+
+ if (bInsPolyPoint)
+ {
+ SetMarkHandles();
+ bInsPolyPoint=sal_False;
+ if( bUndo )
+ {
+ BegUndo(aInsPointUndoStr);
+ AddUndo(pInsPointUndo);
+ EndUndo();
+ }
+ }
+
+ eDragHdl=HDL_MOVE;
+ pDragHdl=NULL;
+
+ if (!bSomeObjChgdFlag)
+ {
+ // Aha, Obj hat nicht gebroadcastet (z.B. Writer FlyFrames)
+ if(!bDragHdl)
+ {
+ AdjustMarkHdl();
+ }
+ }
+ }
+ else
+ {
+ BrkDragObj();
+ }
+
+ bInsPolyPoint=sal_False;
+ SetInsertGluePoint(sal_False);
+
+ return bRet;
+}
+
+void SdrDragView::BrkDragObj()
+{
+ if (mpCurrentSdrDragMethod)
+ {
+ mpCurrentSdrDragMethod->CancelSdrDrag();
+
+ delete mpCurrentSdrDragMethod;
+ mpCurrentSdrDragMethod = 0;
+
+ if (bInsPolyPoint)
+ {
+ pInsPointUndo->Undo(); // Den eingefuegten Punkt wieder raus
+ delete pInsPointUndo;
+ pInsPointUndo=NULL;
+ SetMarkHandles();
+ bInsPolyPoint=sal_False;
+ }
+
+ if (IsInsertGluePoint())
+ {
+ pInsPointUndo->Undo(); // Den eingefuegten Klebepunkt wieder raus
+ delete pInsPointUndo;
+ pInsPointUndo=NULL;
+ SetInsertGluePoint(sal_False);
+ }
+
+ eDragHdl=HDL_MOVE;
+ pDragHdl=NULL;
+ }
+}
+
+sal_Bool SdrDragView::IsInsObjPointPossible() const
+{
+ return pMarkedObj!=NULL && pMarkedObj->IsPolyObj();
+}
+
+sal_Bool SdrDragView::ImpBegInsObjPoint(sal_Bool bIdxZwang, sal_uInt32 nIdx, const Point& rPnt, sal_Bool bNewObj, OutputDevice* pOut)
+{
+ sal_Bool bRet(sal_False);
+
+ if(pMarkedObj && pMarkedObj->ISA(SdrPathObj))
+ {
+ SdrPathObj* pMarkedPath = (SdrPathObj*)pMarkedObj;
+ BrkAction();
+ pInsPointUndo = dynamic_cast< SdrUndoGeoObj* >( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pMarkedObj) );
+ DBG_ASSERT( pInsPointUndo, "svx::SdrDragView::BegInsObjPoint(), could not create correct undo object!" );
+
+ XubString aStr(ImpGetResStr(STR_DragInsertPoint));
+ XubString aName;
+ pMarkedObj->TakeObjNameSingul(aName);
+ xub_StrLen nPos(aStr.SearchAscii("%1"));
+
+ if(STRING_NOTFOUND != nPos)
+ {
+ aStr.Erase(nPos, 2);
+ aStr.Insert(aName, nPos);
+ }
+
+ aInsPointUndoStr = aStr;
+ Point aPt(rPnt);
+
+ if(bNewObj)
+ aPt = GetSnapPos(aPt,pMarkedPV);
+
+ sal_Bool bClosed0(pMarkedPath->IsClosedObj());
+
+ if(bIdxZwang)
+ {
+ mnInsPointNum = pMarkedPath->NbcInsPoint(nIdx, aPt, bNewObj, sal_True);
+ }
+ else
+ {
+ mnInsPointNum = pMarkedPath->NbcInsPointOld(aPt, bNewObj, sal_True);
+ }
+
+ if(bClosed0 != pMarkedPath->IsClosedObj())
+ {
+ // Obj was closed implicit
+ // object changed
+ pMarkedPath->SetChanged();
+ pMarkedPath->BroadcastObjectChange();
+ }
+
+ if(0xffffffff != mnInsPointNum)
+ {
+ bInsPolyPoint = sal_True;
+ UnmarkAllPoints();
+ AdjustMarkHdl();
+
+ bRet = BegDragObj(rPnt, pOut, aHdl.GetHdl(mnInsPointNum), 0);
+
+ if (bRet)
+ {
+ aDragStat.SetMinMoved();
+ MovDragObj(rPnt);
+ }
+ }
+ else
+ {
+ delete pInsPointUndo;
+ pInsPointUndo = NULL;
+ }
+ }
+
+ return bRet;
+}
+
+sal_Bool SdrDragView::EndInsObjPoint(SdrCreateCmd eCmd)
+{
+ if(IsInsObjPoint())
+ {
+ sal_uInt32 nNextPnt(mnInsPointNum);
+ Point aPnt(aDragStat.GetNow());
+ sal_Bool bOk=EndDragObj(sal_False);
+ if (bOk==sal_True && eCmd!=SDRCREATE_FORCEEND)
+ {
+ // Ret=True bedeutet: Action ist vorbei.
+ bOk=!(ImpBegInsObjPoint(sal_True, nNextPnt, aPnt, eCmd == SDRCREATE_NEXTOBJECT, pDragWin));
+ }
+
+ return bOk;
+ } else return sal_False;
+}
+
+sal_Bool SdrDragView::IsInsGluePointPossible() const
+{
+ sal_Bool bRet=sal_False;
+ if (IsInsGluePointMode() && AreObjectsMarked())
+ {
+ if (GetMarkedObjectCount()==1)
+ {
+ // sal_False liefern, wenn 1 Objekt und dieses ein Verbinder ist.
+ const SdrObject* pObj=GetMarkedObjectByIndex(0);
+ if (!HAS_BASE(SdrEdgeObj,pObj))
+ {
+ bRet=sal_True;
+ }
+ }
+ else
+ {
+ bRet=sal_True;
+ }
+ }
+ return bRet;
+}
+
+sal_Bool SdrDragView::BegInsGluePoint(const Point& rPnt)
+{
+ sal_Bool bRet=sal_False;
+ SdrObject* pObj;
+ SdrPageView* pPV;
+ sal_uIntPtr nMarkNum;
+ if (PickMarkedObj(rPnt,pObj,pPV,&nMarkNum,SDRSEARCH_PASS2BOUND))
+ {
+ BrkAction();
+ UnmarkAllGluePoints();
+ pInsPointUndo= dynamic_cast< SdrUndoGeoObj* >( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj) );
+ DBG_ASSERT( pInsPointUndo, "svx::SdrDragView::BegInsObjPoint(), could not create correct undo object!" );
+ XubString aStr(ImpGetResStr(STR_DragInsertGluePoint));
+ XubString aName; pObj->TakeObjNameSingul(aName);
+
+ aStr.SearchAndReplaceAscii("%1", aName);
+
+ aInsPointUndoStr=aStr;
+ SdrGluePointList* pGPL=pObj->ForceGluePointList();
+ if (pGPL!=NULL)
+ {
+ sal_uInt16 nGlueIdx=pGPL->Insert(SdrGluePoint());
+ SdrGluePoint& rGP=(*pGPL)[nGlueIdx];
+ sal_uInt16 nGlueId=rGP.GetId();
+ rGP.SetAbsolutePos(rPnt,*pObj);
+
+ SdrHdl* pHdl=NULL;
+ if (MarkGluePoint(pObj,nGlueId,pPV))
+ {
+ pHdl=GetGluePointHdl(pObj,nGlueId);
+ }
+ if (pHdl!=NULL && pHdl->GetKind()==HDL_GLUE && pHdl->GetObj()==pObj && pHdl->GetObjHdlNum()==nGlueId)
+ {
+ SetInsertGluePoint(sal_True);
+ bRet=BegDragObj(rPnt,NULL,pHdl,0);
+ if (bRet)
+ {
+ aDragStat.SetMinMoved();
+ MovDragObj(rPnt);
+ }
+ else
+ {
+ SetInsertGluePoint(sal_False);
+ delete pInsPointUndo;
+ pInsPointUndo=NULL;
+ }
+ }
+ else
+ {
+ DBG_ERROR("BegInsGluePoint(): GluePoint-Handle nicht gefunden");
+ }
+ }
+ else
+ {
+ // Keine Klebepunkte moeglich bei diesem Objekt (z.B. Edge)
+ SetInsertGluePoint(sal_False);
+ delete pInsPointUndo;
+ pInsPointUndo=NULL;
+ }
+ }
+
+ return bRet;
+}
+
+void SdrDragView::ShowDragObj()
+{
+ if(mpCurrentSdrDragMethod && !aDragStat.IsShown())
+ {
+ for(sal_uInt32 a(0); a < PaintWindowCount(); a++)
+ {
+ SdrPaintWindow* pCandidate = GetPaintWindow(a);
+ sdr::overlay::OverlayManager* pOverlayManager = pCandidate->GetOverlayManager();
+
+ if(pOverlayManager)
+ {
+ mpCurrentSdrDragMethod->CreateOverlayGeometry(*pOverlayManager);
+
+ // #i101679# Force changed overlay to be shown
+ pOverlayManager->flush();
+ }
+ }
+
+ aDragStat.SetShown(sal_True);
+ }
+}
+
+void SdrDragView::HideDragObj()
+{
+ if(mpCurrentSdrDragMethod && aDragStat.IsShown())
+ {
+ mpCurrentSdrDragMethod->destroyOverlayGeometry();
+ aDragStat.SetShown(sal_False);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrDragView::SetNoDragXorPolys(sal_Bool bOn)
+{
+ if (IsNoDragXorPolys()!=bOn)
+ {
+ const bool bDragging(mpCurrentSdrDragMethod);
+ const bool bShown(bDragging && aDragStat.IsShown());
+
+ if(bShown)
+ {
+ HideDragObj();
+ }
+
+ bNoDragXorPolys = bOn;
+
+ if(bDragging)
+ {
+ // force recreation of drag content
+ mpCurrentSdrDragMethod->resetSdrDragEntries();
+ }
+
+ if(bShown)
+ {
+ ShowDragObj();
+ }
+ }
+}
+
+void SdrDragView::SetDragStripes(sal_Bool bOn)
+{
+ if (mpCurrentSdrDragMethod && aDragStat.IsShown())
+ {
+ HideDragObj();
+ bDragStripes=bOn;
+ ShowDragObj();
+ }
+ else
+ {
+ bDragStripes=bOn;
+ }
+}
+
+sal_Bool SdrDragView::IsOrthoDesired() const
+{
+ if(mpCurrentSdrDragMethod && (IS_TYPE(SdrDragObjOwn, mpCurrentSdrDragMethod) || IS_TYPE(SdrDragResize, mpCurrentSdrDragMethod)))
+ {
+ return bOrthoDesiredOnMarked;
+ }
+
+ return sal_False;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrDragView::SetRubberEdgeDragging(sal_Bool bOn)
+{
+ if (bOn!=IsRubberEdgeDragging())
+ {
+ sal_uIntPtr nAnz = GetEdgesOfMarkedNodes().GetMarkCount();
+ sal_Bool bShowHide=nAnz!=0 && IsDragObj() &&
+ (nRubberEdgeDraggingLimit>=nAnz);
+ if (bShowHide)
+ HideDragObj();
+ bRubberEdgeDragging=bOn;
+ if (bShowHide)
+ ShowDragObj();
+ }
+}
+
+void SdrDragView::SetRubberEdgeDraggingLimit(sal_uInt16 nEdgeObjAnz)
+{
+ if (nEdgeObjAnz!=nRubberEdgeDraggingLimit)
+ {
+ sal_uIntPtr nAnz = GetEdgesOfMarkedNodes().GetMarkCount();
+ sal_Bool bShowHide=IsRubberEdgeDragging() && nAnz!=0 && IsDragObj() &&
+ (nEdgeObjAnz>=nAnz)!=(nRubberEdgeDraggingLimit>=nAnz);
+ if (bShowHide)
+ HideDragObj();
+ nRubberEdgeDraggingLimit=nEdgeObjAnz;
+ if (bShowHide)
+ ShowDragObj();
+ }
+}
+
+void SdrDragView::SetDetailedEdgeDragging(sal_Bool bOn)
+{
+ if (bOn!=IsDetailedEdgeDragging())
+ {
+ sal_uIntPtr nAnz = GetEdgesOfMarkedNodes().GetMarkCount();
+ sal_Bool bShowHide=nAnz!=0 && IsDragObj() &&
+ (nDetailedEdgeDraggingLimit>=nAnz);
+ if (bShowHide)
+ HideDragObj();
+ bDetailedEdgeDragging=bOn;
+ if (bShowHide)
+ ShowDragObj();
+ }
+}
+
+void SdrDragView::SetDetailedEdgeDraggingLimit(sal_uInt16 nEdgeObjAnz)
+{
+ if (nEdgeObjAnz!=nDetailedEdgeDraggingLimit)
+ {
+ sal_uIntPtr nAnz = GetEdgesOfMarkedNodes().GetMarkCount();
+ sal_Bool bShowHide=IsDetailedEdgeDragging() && nAnz!=0 && IsDragObj() &&
+ (nEdgeObjAnz>=nAnz)!=(nDetailedEdgeDraggingLimit>=nAnz);
+ if (bShowHide)
+ HideDragObj();
+ nDetailedEdgeDraggingLimit=nEdgeObjAnz;
+ if (bShowHide)
+ ShowDragObj();
+ }
+}
+
+void SdrDragView::SetMarkHandles()
+{
+ if( pDragHdl )
+ pDragHdl = 0;
+
+ SdrExchangeView::SetMarkHandles();
+}
+
+void SdrDragView::SetSolidDragging(bool bOn)
+{
+ if((bool)mbSolidDragging != bOn)
+ {
+ mbSolidDragging = bOn;
+ }
+}
+
+bool SdrDragView::IsSolidDragging() const
+{
+ // allow each user to disable by having a local setting, but using AND for
+ // checking allowance
+ return mbSolidDragging && getOptionsDrawinglayer().IsSolidDragCreate();
+}
+
+// eof
diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx
new file mode 100644
index 000000000000..ec9fece55649
--- /dev/null
+++ b/svx/source/svdraw/svdedtv.cxx
@@ -0,0 +1,1046 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <vcl/metaact.hxx>
+#include <svx/svdedtv.hxx>
+#include <svx/svdundo.hxx>
+#include <svx/svdograf.hxx> // fuer Possibilities
+#include <svx/svdopath.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/svdopage.hxx>
+#include <svx/svdoedge.hxx>
+#include <svx/svdlayer.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdpoev.hxx> // fuer die PolyPossiblities
+#include "svx/svdstr.hrc" // Namen aus der Resource
+#include "svx/svdglob.hxx" // StringCache
+#include <svx/e3dsceneupdater.hxx>
+
+// #i13033#
+#include <clonelist.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@@ @@@@@ @@ @@@@@@ @@ @@ @@ @@@@@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@
+// @@@@ @@ @@ @@ @@ @@@@@ @@ @@@@ @@@@@@@
+// @@ @@ @@ @@ @@ @@@ @@ @@ @@@@@@@
+// @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@
+// @@@@@ @@@@@ @@ @@ @ @@ @@@@@ @@ @@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrEditView::ImpResetPossibilityFlags()
+{
+ bReadOnly =sal_False;
+
+ bGroupPossible =sal_False;
+ bUnGroupPossible =sal_False;
+ bGrpEnterPossible =sal_False;
+ bDeletePossible =sal_False;
+ bToTopPossible =sal_False;
+ bToBtmPossible =sal_False;
+ bReverseOrderPossible =sal_False;
+
+ bImportMtfPossible =sal_False;
+ bCombinePossible =sal_False;
+ bDismantlePossible =sal_False;
+ bCombineNoPolyPolyPossible =sal_False;
+ bDismantleMakeLinesPossible=sal_False;
+ bOrthoDesiredOnMarked =sal_False;
+
+ bMoreThanOneNotMovable =sal_False;
+ bOneOrMoreMovable =sal_False;
+ bMoreThanOneNoMovRot =sal_False;
+ bContortionPossible =sal_False;
+ bAllPolys =sal_False;
+ bOneOrMorePolys =sal_False;
+ bMoveAllowed =sal_False;
+ bResizeFreeAllowed =sal_False;
+ bResizePropAllowed =sal_False;
+ bRotateFreeAllowed =sal_False;
+ bRotate90Allowed =sal_False;
+ bMirrorFreeAllowed =sal_False;
+ bMirror45Allowed =sal_False;
+ bMirror90Allowed =sal_False;
+ bTransparenceAllowed =sal_False;
+ bGradientAllowed =sal_False;
+ bShearAllowed =sal_False;
+ bEdgeRadiusAllowed =sal_False;
+ bCanConvToPath =sal_False;
+ bCanConvToPoly =sal_False;
+ bCanConvToContour =sal_False;
+ bCanConvToPathLineToArea=sal_False;
+ bCanConvToPolyLineToArea=sal_False;
+ bMoveProtect =sal_False;
+ bResizeProtect =sal_False;
+}
+
+void SdrEditView::ImpClearVars()
+{
+ ImpResetPossibilityFlags();
+ bPossibilitiesDirty=sal_True; // << war von Purify angemeckert
+ bBundleVirtObj=sal_False;
+}
+
+SdrEditView::SdrEditView(SdrModel* pModel1, OutputDevice* pOut):
+ SdrMarkView(pModel1,pOut)
+{
+ ImpClearVars();
+}
+
+SdrEditView::~SdrEditView()
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrLayer* SdrEditView::InsertNewLayer(const XubString& rName, sal_uInt16 nPos)
+{
+ SdrLayerAdmin& rLA=pMod->GetLayerAdmin();
+ sal_uInt16 nMax=rLA.GetLayerCount();
+ if (nPos>nMax) nPos=nMax;
+ SdrLayer* pNewLayer=rLA.NewLayer(rName,nPos);
+
+ if( GetModel()->IsUndoEnabled() )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewLayer(nPos,rLA,*pMod));
+
+ pMod->SetChanged();
+ return pNewLayer;
+}
+
+#include <svx/svdogrp.hxx>
+#include <svx/scene3d.hxx>
+
+sal_Bool SdrEditView::ImpDelLayerCheck(SdrObjList* pOL, SdrLayerID nDelID) const
+{
+ sal_Bool bDelAll(sal_True);
+ sal_uInt32 nObjAnz(pOL->GetObjCount());
+
+ for(sal_uInt32 nObjNum(nObjAnz); nObjNum > 0 && bDelAll;)
+ {
+ nObjNum--;
+ SdrObject* pObj = pOL->GetObj(nObjNum);
+ SdrObjList* pSubOL = pObj->GetSubList();
+
+ // #104809# Test explicitely for group objects and 3d scenes
+ if(pSubOL && (pObj->ISA(SdrObjGroup) || pObj->ISA(E3dScene)))
+ {
+ if(!ImpDelLayerCheck(pSubOL, nDelID))
+ {
+ // Rekursion
+ bDelAll = sal_False;
+ }
+ }
+ else
+ {
+ if(pObj->GetLayer() != nDelID)
+ {
+ bDelAll = sal_False;
+ }
+ }
+ }
+
+ return bDelAll;
+}
+
+void SdrEditView::ImpDelLayerDelObjs(SdrObjList* pOL, SdrLayerID nDelID)
+{
+ sal_uInt32 nObjAnz(pOL->GetObjCount());
+ // make sure OrdNums are correct
+ pOL->GetObj(0)->GetOrdNum();
+
+ const bool bUndo = GetModel()->IsUndoEnabled();
+
+ for(sal_uInt32 nObjNum(nObjAnz); nObjNum > 0;)
+ {
+ nObjNum--;
+ SdrObject* pObj = pOL->GetObj(nObjNum);
+ SdrObjList* pSubOL = pObj->GetSubList();
+
+
+ // #104809# Test explicitely for group objects and 3d scenes
+ if(pSubOL && (pObj->ISA(SdrObjGroup) || pObj->ISA(E3dScene)))
+ {
+ if(ImpDelLayerCheck(pSubOL, nDelID))
+ {
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj, true));
+ pOL->RemoveObject(nObjNum);
+
+ if( !bUndo )
+ SdrObject::Free( pObj );
+ }
+ else
+ {
+ ImpDelLayerDelObjs(pSubOL, nDelID);
+ }
+ }
+ else
+ {
+ if(pObj->GetLayer() == nDelID)
+ {
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj, true));
+ pOL->RemoveObject(nObjNum);
+ if( !bUndo )
+ SdrObject::Free( pObj );
+ }
+ }
+ }
+}
+
+void SdrEditView::DeleteLayer(const XubString& rName)
+{
+ SdrLayerAdmin& rLA = pMod->GetLayerAdmin();
+ SdrLayer* pLayer = rLA.GetLayer(rName, sal_True);
+ sal_uInt16 nLayerNum(rLA.GetLayerPos(pLayer));
+
+ if(SDRLAYER_NOTFOUND != nLayerNum)
+ {
+
+ SdrLayerID nDelID = pLayer->GetID();
+
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ BegUndo(ImpGetResStr(STR_UndoDelLayer));
+
+ sal_Bool bMaPg(sal_True);
+
+ for(sal_uInt16 nPageKind(0); nPageKind < 2; nPageKind++)
+ {
+ // MasterPages and DrawPages
+ sal_uInt16 nPgAnz(bMaPg ? pMod->GetMasterPageCount() : pMod->GetPageCount());
+
+ for(sal_uInt16 nPgNum(0); nPgNum < nPgAnz; nPgNum++)
+ {
+ // over all pages
+ SdrPage* pPage = (bMaPg) ? pMod->GetMasterPage(nPgNum) : pMod->GetPage(nPgNum);
+ sal_uInt32 nObjAnz(pPage->GetObjCount());
+
+ // make sure OrdNums are correct
+ if(nObjAnz)
+ pPage->GetObj(0)->GetOrdNum();
+
+ for(sal_uInt32 nObjNum(nObjAnz); nObjNum > 0;)
+ {
+ nObjNum--;
+ SdrObject* pObj = pPage->GetObj(nObjNum);
+ SdrObjList* pSubOL = pObj->GetSubList();
+
+ // #104809# Test explicitely for group objects and 3d scenes
+ if(pSubOL && (pObj->ISA(SdrObjGroup) || pObj->ISA(E3dScene)))
+ {
+ if(ImpDelLayerCheck(pSubOL, nDelID))
+ {
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj, true));
+ pPage->RemoveObject(nObjNum);
+ if( !bUndo )
+ SdrObject::Free(pObj);
+ }
+ else
+ {
+ ImpDelLayerDelObjs(pSubOL, nDelID);
+ }
+ }
+ else
+ {
+ if(pObj->GetLayer() == nDelID)
+ {
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj, true));
+ pPage->RemoveObject(nObjNum);
+ if( !bUndo )
+ SdrObject::Free(pObj);
+ }
+ }
+ }
+ }
+ bMaPg = sal_False;
+ }
+
+ if( bUndo )
+ {
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteLayer(nLayerNum, rLA, *pMod));
+ rLA.RemoveLayer(nLayerNum);
+ EndUndo();
+ }
+ else
+ {
+ delete rLA.RemoveLayer(nLayerNum);
+ }
+
+ pMod->SetChanged();
+ }
+}
+
+void SdrEditView::MoveLayer(const XubString& rName, sal_uInt16 nNewPos)
+{
+ SdrLayerAdmin& rLA=pMod->GetLayerAdmin();
+ SdrLayer* pLayer=rLA.GetLayer(rName,sal_True);
+ sal_uInt16 nLayerNum=rLA.GetLayerPos(pLayer);
+ if (nLayerNum!=SDRLAYER_NOTFOUND)
+ {
+ if( IsUndoEnabled() )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoMoveLayer(nLayerNum,rLA,*pMod,nNewPos));
+ rLA.MoveLayer(nLayerNum,nNewPos);
+ pMod->SetChanged();
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrEditView::EndUndo()
+{
+ // #i13033#
+ // Comparison changed to 1L since EndUndo() is called later now
+ // and EndUndo WILL change count to count-1
+ if(1L == pMod->GetUndoBracketLevel())
+ {
+ ImpBroadcastEdgesOfMarkedNodes();
+ }
+
+ // #i13033#
+ // moved to bottom to still have access to UNDOs inside of
+ // ImpBroadcastEdgesOfMarkedNodes()
+ pMod->EndUndo();
+}
+
+void SdrEditView::ImpBroadcastEdgesOfMarkedNodes()
+{
+ const List& rAllMarkedObjects = GetTransitiveHullOfMarkedObjects();
+
+ // #i13033#
+ // New mechanism to search for necessary disconnections for
+ // changed connectors inside the transitive hull of all at
+ // the beginning of UNDO selected objects
+ for(sal_uInt32 a(0L); a < rAllMarkedObjects.Count(); a++)
+ {
+ SdrEdgeObj* pEdge = PTR_CAST(SdrEdgeObj, (SdrObject*)rAllMarkedObjects.GetObject(a));
+
+ if(pEdge)
+ {
+ SdrObject* pObj1 = pEdge->GetConnectedNode(sal_False);
+ SdrObject* pObj2 = pEdge->GetConnectedNode(sal_True);
+
+ if(pObj1
+ && LIST_ENTRY_NOTFOUND == rAllMarkedObjects.GetPos(pObj1)
+ && !pEdge->CheckNodeConnection(sal_False))
+ {
+ if( IsUndoEnabled() )
+ AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pEdge));
+ pEdge->DisconnectFromNode(sal_False);
+ }
+
+ if(pObj2
+ && LIST_ENTRY_NOTFOUND == rAllMarkedObjects.GetPos(pObj2)
+ && !pEdge->CheckNodeConnection(sal_True))
+ {
+ if( IsUndoEnabled() )
+ AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pEdge));
+ pEdge->DisconnectFromNode(sal_True);
+ }
+ }
+ }
+
+ sal_uIntPtr nMarkedEdgeAnz = GetMarkedEdgesOfMarkedNodes().GetMarkCount();
+ sal_uInt16 i;
+
+ for (i=0; i<nMarkedEdgeAnz; i++) {
+ SdrMark* pEM = GetMarkedEdgesOfMarkedNodes().GetMark(i);
+ SdrObject* pEdgeTmp=pEM->GetMarkedSdrObj();
+ SdrEdgeObj* pEdge=PTR_CAST(SdrEdgeObj,pEdgeTmp);
+ if (pEdge!=NULL) {
+ pEdge->SetEdgeTrackDirty();
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// #### ### #### #### # #### # # # ##### # ##### ####
+// # # # # # # # # # # # # # # # #
+// #### # # ### ### # #### # # # # # #### ###
+// # # # # # # # # # # # # # # #
+// # ### #### #### # #### # #### # # # ##### ####
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrEditView::MarkListHasChanged()
+{
+ SdrMarkView::MarkListHasChanged();
+ bPossibilitiesDirty=sal_True;
+}
+
+void SdrEditView::ModelHasChanged()
+{
+ SdrMarkView::ModelHasChanged();
+ bPossibilitiesDirty=sal_True;
+}
+
+sal_Bool SdrEditView::IsResizeAllowed(sal_Bool bProp) const
+{
+ ForcePossibilities();
+ if (bResizeProtect) return sal_False;
+ if (bProp) return bResizePropAllowed;
+ return bResizeFreeAllowed;
+}
+
+sal_Bool SdrEditView::IsRotateAllowed(sal_Bool b90Deg) const
+{
+ ForcePossibilities();
+ if (bMoveProtect) return sal_False;
+ if (b90Deg) return bRotate90Allowed;
+ return bRotateFreeAllowed;
+}
+
+sal_Bool SdrEditView::IsMirrorAllowed(sal_Bool b45Deg, sal_Bool b90Deg) const
+{
+ ForcePossibilities();
+ if (bMoveProtect) return sal_False;
+ if (b90Deg) return bMirror90Allowed;
+ if (b45Deg) return bMirror45Allowed;
+ return bMirrorFreeAllowed && !bMoveProtect;
+}
+
+sal_Bool SdrEditView::IsTransparenceAllowed() const
+{
+ ForcePossibilities();
+ return bTransparenceAllowed;
+}
+
+sal_Bool SdrEditView::IsGradientAllowed() const
+{
+ ForcePossibilities();
+ return bGradientAllowed;
+}
+
+sal_Bool SdrEditView::IsShearAllowed() const
+{
+ ForcePossibilities();
+ if (bResizeProtect) return sal_False;
+ return bShearAllowed;
+}
+
+sal_Bool SdrEditView::IsEdgeRadiusAllowed() const
+{
+ ForcePossibilities();
+ return bEdgeRadiusAllowed;
+}
+
+sal_Bool SdrEditView::IsCrookAllowed(sal_Bool bNoContortion) const
+{
+ // CrookMode fehlt hier (weil kein Rotate bei Shear ...)
+ ForcePossibilities();
+ if (bNoContortion) {
+ if (!bRotateFreeAllowed) return sal_False; // Crook is nich
+ return !bMoveProtect && bMoveAllowed;
+ } else {
+ return !bResizeProtect && bContortionPossible;
+ }
+}
+
+sal_Bool SdrEditView::IsDistortAllowed(sal_Bool bNoContortion) const
+{
+ ForcePossibilities();
+ if (bNoContortion) {
+ return sal_False;
+ } else {
+ return !bResizeProtect && bContortionPossible;
+ }
+}
+
+sal_Bool SdrEditView::IsCombinePossible(sal_Bool bNoPolyPoly) const
+{
+ ForcePossibilities();
+ if (bNoPolyPoly) return bCombineNoPolyPolyPossible;
+ else return bCombinePossible;
+}
+
+sal_Bool SdrEditView::IsDismantlePossible(sal_Bool bMakeLines) const
+{
+ ForcePossibilities();
+ if (bMakeLines) return bDismantleMakeLinesPossible;
+ else return bDismantlePossible;
+}
+
+void SdrEditView::CheckPossibilities()
+{
+ if (bSomeObjChgdFlag) bPossibilitiesDirty=sal_True;
+
+ if(bSomeObjChgdFlag)
+ {
+ // This call IS necessary to correct the MarkList, in which
+ // no longer to the model belonging objects still can reside.
+ // These ones nned to be removed.
+ CheckMarked();
+ }
+
+ if (bPossibilitiesDirty) {
+ ImpResetPossibilityFlags();
+ SortMarkedObjects();
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ if (nMarkAnz!=0) {
+ bReverseOrderPossible=nMarkAnz>=2;
+
+ sal_uIntPtr nMovableCount=0;
+ bGroupPossible=nMarkAnz>=2;
+ bCombinePossible=nMarkAnz>=2;
+ if (nMarkAnz==1) {
+ // bCombinePossible gruendlicher checken
+ // fehlt noch ...
+ const SdrObject* pObj=GetMarkedObjectByIndex(0);
+ //const SdrPathObj* pPath=PTR_CAST(SdrPathObj,pObj);
+ sal_Bool bGroup=pObj->GetSubList()!=NULL;
+ sal_Bool bHasText=pObj->GetOutlinerParaObject()!=NULL;
+ if (bGroup || bHasText) {
+ bCombinePossible=sal_True;
+ }
+ }
+ bCombineNoPolyPolyPossible=bCombinePossible;
+ bDeletePossible=sal_True;
+ // Zu den Transformationen erstmal ja sagen
+ bMoveAllowed =sal_True;
+ bResizeFreeAllowed=sal_True;
+ bResizePropAllowed=sal_True;
+ bRotateFreeAllowed=sal_True;
+ bRotate90Allowed =sal_True;
+ bMirrorFreeAllowed=sal_True;
+ bMirror45Allowed =sal_True;
+ bMirror90Allowed =sal_True;
+ bShearAllowed =sal_True;
+ bEdgeRadiusAllowed=sal_False;
+ bContortionPossible=sal_True;
+ bCanConvToContour = sal_True;
+
+ // these ones are only allowed when single object is selected
+ bTransparenceAllowed = (nMarkAnz == 1);
+ bGradientAllowed = (nMarkAnz == 1);
+ if(bGradientAllowed)
+ {
+ // gradient depends on fillstyle
+ const SdrMark* pM = GetSdrMarkByIndex(0);
+ const SdrObject* pObj = pM->GetMarkedSdrObj();
+
+ // maybe group object, so get merged ItemSet
+ const SfxItemSet& rSet = pObj->GetMergedItemSet();
+ SfxItemState eState = rSet.GetItemState(XATTR_FILLSTYLE, sal_False);
+
+ if(SFX_ITEM_DONTCARE != eState)
+ {
+ // If state is not DONTCARE, test the item
+ XFillStyle eFillStyle = ((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue();
+
+ if(eFillStyle != XFILL_GRADIENT)
+ {
+ bGradientAllowed = sal_False;
+ }
+ }
+ }
+
+ sal_Bool bNoMovRotFound=sal_False;
+ const SdrPageView* pPV0=NULL;
+
+ for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++) {
+ const SdrMark* pM=GetSdrMarkByIndex(nm);
+ const SdrObject* pObj=pM->GetMarkedSdrObj();
+ const SdrPageView* pPV=pM->GetPageView();
+ if (pPV!=pPV0) {
+ if (pPV->IsReadOnly()) bReadOnly=sal_True;
+ pPV0=pPV;
+ }
+
+ SdrObjTransformInfoRec aInfo;
+ pObj->TakeObjInfo(aInfo);
+ sal_Bool bMovPrt=pObj->IsMoveProtect();
+ sal_Bool bSizPrt=pObj->IsResizeProtect();
+ if (!bMovPrt && aInfo.bMoveAllowed) nMovableCount++; // Menge der MovableObjs zaehlen
+ if (bMovPrt) bMoveProtect=sal_True;
+ if (bSizPrt) bResizeProtect=sal_True;
+
+ // not allowed when not allowed at one object
+ if(!aInfo.bTransparenceAllowed)
+ bTransparenceAllowed = sal_False;
+
+ // Wenn einer was nicht kann, duerfen's alle nicht
+ if (!aInfo.bMoveAllowed ) bMoveAllowed =sal_False;
+ if (!aInfo.bResizeFreeAllowed) bResizeFreeAllowed=sal_False;
+ if (!aInfo.bResizePropAllowed) bResizePropAllowed=sal_False;
+ if (!aInfo.bRotateFreeAllowed) bRotateFreeAllowed=sal_False;
+ if (!aInfo.bRotate90Allowed ) bRotate90Allowed =sal_False;
+ if (!aInfo.bMirrorFreeAllowed) bMirrorFreeAllowed=sal_False;
+ if (!aInfo.bMirror45Allowed ) bMirror45Allowed =sal_False;
+ if (!aInfo.bMirror90Allowed ) bMirror90Allowed =sal_False;
+ if (!aInfo.bShearAllowed ) bShearAllowed =sal_False;
+ if (aInfo.bEdgeRadiusAllowed) bEdgeRadiusAllowed=sal_True;
+ if (aInfo.bNoContortion ) bContortionPossible=sal_False;
+ // Fuer Crook mit Contortion: Alle Objekte muessen
+ // Movable und Rotatable sein, ausser maximal 1
+ if (!bMoreThanOneNoMovRot) {
+ if (!aInfo.bMoveAllowed || !aInfo.bResizeFreeAllowed) {
+ bMoreThanOneNoMovRot=bNoMovRotFound;
+ bNoMovRotFound=sal_True;
+ }
+ }
+
+ // when one member cannot be converted, no conversion is possible
+ if(!aInfo.bCanConvToContour)
+ bCanConvToContour = sal_False;
+
+ // Ungroup
+ if (!bUnGroupPossible) bUnGroupPossible=pObj->GetSubList()!=NULL;
+ // ConvertToCurve: Wenn mind. einer konvertiert werden kann ist das ok.
+ if (aInfo.bCanConvToPath ) bCanConvToPath =sal_True;
+ if (aInfo.bCanConvToPoly ) bCanConvToPoly =sal_True;
+ if (aInfo.bCanConvToPathLineToArea) bCanConvToPathLineToArea=sal_True;
+ if (aInfo.bCanConvToPolyLineToArea) bCanConvToPolyLineToArea=sal_True;
+
+ // Combine/Dismantle
+ if(bCombinePossible)
+ {
+ bCombinePossible = ImpCanConvertForCombine(pObj);
+ bCombineNoPolyPolyPossible = bCombinePossible;
+ }
+
+ if (!bDismantlePossible) bDismantlePossible = ImpCanDismantle(pObj, sal_False);
+ if (!bDismantleMakeLinesPossible) bDismantleMakeLinesPossible = ImpCanDismantle(pObj, sal_True);
+ // OrthoDesiredOnMarked checken
+ if (!bOrthoDesiredOnMarked && !aInfo.bNoOrthoDesired) bOrthoDesiredOnMarked=sal_True;
+ // ImportMtf checken
+
+ if (!bImportMtfPossible) {
+ sal_Bool bGraf=HAS_BASE(SdrGrafObj,pObj);
+ sal_Bool bOle2=HAS_BASE(SdrOle2Obj,pObj);
+
+ if( bGraf && ((SdrGrafObj*)pObj)->HasGDIMetaFile() && !((SdrGrafObj*)pObj)->IsEPS() )
+ bImportMtfPossible = sal_True;
+
+ if (bOle2)
+ bImportMtfPossible=((SdrOle2Obj*)pObj)->GetObjRef().is();
+ }
+ }
+
+ bMoreThanOneNotMovable=nMovableCount<nMarkAnz-1;
+ bOneOrMoreMovable=nMovableCount!=0;
+ bGrpEnterPossible=bUnGroupPossible;
+ }
+ ImpCheckToTopBtmPossible();
+ ((SdrPolyEditView*)this)->ImpCheckPolyPossibilities();
+ bPossibilitiesDirty=sal_False;
+
+ if (bReadOnly) {
+ sal_Bool bMerker1=bGrpEnterPossible;
+ ImpResetPossibilityFlags();
+ bReadOnly=sal_True;
+ bGrpEnterPossible=bMerker1;
+ }
+ if (bMoveAllowed) {
+ // Verschieben von angeklebten Verbindern unterbinden
+ // Derzeit nur fuer Einfachselektion implementiert.
+ if (nMarkAnz==1) {
+ SdrObject* pObj=GetMarkedObjectByIndex(0);
+ SdrEdgeObj* pEdge=PTR_CAST(SdrEdgeObj,pObj);
+ if (pEdge!=NULL) {
+ SdrObject* pNode1=pEdge->GetConnectedNode(sal_True);
+ SdrObject* pNode2=pEdge->GetConnectedNode(sal_False);
+ if (pNode1!=NULL || pNode2!=NULL) bMoveAllowed=sal_False;
+ }
+ }
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrEditView::ForceMarkedObjToAnotherPage()
+{
+ sal_Bool bFlg=sal_False;
+ for (sal_uIntPtr nm=0; nm<GetMarkedObjectCount(); nm++) {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ Rectangle aObjRect(pObj->GetCurrentBoundRect());
+ Rectangle aPgRect(pM->GetPageView()->GetPageRect());
+ if (!aObjRect.IsOver(aPgRect)) {
+ sal_Bool bFnd=sal_False;
+ SdrPageView* pPV = GetSdrPageView();
+
+ if(pPV)
+ {
+ bFnd = aObjRect.IsOver(pPV->GetPageRect());
+ }
+
+ if(bFnd)
+ {
+ pM->GetPageView()->GetObjList()->RemoveObject(pObj->GetOrdNum());
+ SdrInsertReason aReason(SDRREASON_VIEWCALL);
+ pPV->GetObjList()->InsertObject(pObj,CONTAINER_APPEND,&aReason);
+ pM->SetPageView(pPV);
+ InvalidateAllWin(aObjRect);
+ bFlg=sal_True;
+ }
+ }
+ }
+ if (bFlg) {
+ MarkListHasChanged();
+ }
+}
+
+void SdrEditView::DeleteMarkedList(const SdrMarkList& rMark)
+{
+ if (rMark.GetMarkCount()!=0)
+ {
+ rMark.ForceSort();
+
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ BegUndo();
+ const sal_uInt32 nMarkAnz(rMark.GetMarkCount());
+
+ if(nMarkAnz)
+ {
+ sal_uInt32 nm(0);
+ std::vector< E3DModifySceneSnapRectUpdater* > aUpdaters;
+
+ if( bUndo )
+ {
+ for(nm = nMarkAnz; nm > 0;)
+ {
+ nm--;
+ SdrMark* pM = rMark.GetMark(nm);
+ SdrObject* pObj = pM->GetMarkedSdrObj();
+
+ // extra undo actions for changed connector which now may hold it's layouted path (SJ)
+ std::vector< SdrUndoAction* > vConnectorUndoActions( CreateConnectorUndo( *pObj ) );
+ AddUndoActions( vConnectorUndoActions );
+
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj));
+ }
+ }
+
+ // Sicherstellen, dass die OrderNums stimmen:
+ rMark.GetMark(0)->GetMarkedSdrObj()->GetOrdNum();
+
+ std::vector< SdrObject* > aRemoved3DObjects;
+
+ for(nm = nMarkAnz; nm > 0;)
+ {
+ nm--;
+ SdrMark* pM = rMark.GetMark(nm);
+ SdrObject* pObj = pM->GetMarkedSdrObj();
+ SdrObjList* pOL = pObj->GetObjList(); //#52680#
+ const sal_uInt32 nOrdNum(pObj->GetOrdNumDirect());
+
+ bool bIs3D = dynamic_cast< E3dObject* >(pObj);
+ // set up a scene updater if object is a 3d object
+ if(bIs3D)
+ {
+ aUpdaters.push_back(new E3DModifySceneSnapRectUpdater(pObj));
+ }
+
+ pOL->RemoveObject(nOrdNum);
+
+ if( !bUndo )
+ {
+ if( bIs3D )
+ aRemoved3DObjects.push_back( pObj ); // may be needed later
+ else
+ SdrObject::Free(pObj);
+ }
+ }
+
+ // fire scene updaters
+ while(aUpdaters.size())
+ {
+ delete aUpdaters.back();
+ aUpdaters.pop_back();
+ }
+
+ if( !bUndo )
+ {
+ // now delete removed scene objects
+ while(aRemoved3DObjects.size())
+ {
+ SdrObject::Free( aRemoved3DObjects.back() );
+ aRemoved3DObjects.pop_back();
+ }
+ }
+ }
+
+ if( bUndo )
+ EndUndo();
+ }
+}
+
+void SdrEditView::DeleteMarkedObj()
+{
+ // #i110981# return when nothing is to be done at all
+ if(!GetMarkedObjectCount())
+ {
+ return;
+ }
+
+ // moved breaking action and undo start outside loop
+ BrkAction();
+ BegUndo(ImpGetResStr(STR_EditDelete),GetDescriptionOfMarkedObjects(),SDRREPFUNC_OBJ_DELETE);
+
+ // remove as long as something is selected. This allows to schedule objects for
+ // removal for a next run as needed
+ while(GetMarkedObjectCount())
+ {
+ // vector to remember the parents which may be empty after object removal
+ std::vector< SdrObject* > aParents;
+
+ {
+ const SdrMarkList& rMarkList = GetMarkedObjectList();
+ const sal_uInt32 nCount(rMarkList.GetMarkCount());
+ sal_uInt32 a(0);
+
+ for(a = 0; a < nCount; a++)
+ {
+ // in the first run, add all found parents, but only once
+ SdrMark* pMark = rMarkList.GetMark(a);
+ SdrObject* pObject = pMark->GetMarkedSdrObj();
+ SdrObject* pParent = pObject->GetObjList()->GetOwnerObj();
+
+ if(pParent)
+ {
+ if(aParents.size())
+ {
+ std::vector< SdrObject* >::iterator aFindResult =
+ std::find(aParents.begin(), aParents.end(), pParent);
+
+ if(aFindResult == aParents.end())
+ {
+ aParents.push_back(pParent);
+ }
+ }
+ else
+ {
+ aParents.push_back(pParent);
+ }
+ }
+ }
+
+ if(aParents.size())
+ {
+ // in a 2nd run, remove all objects which may already be scheduled for
+ // removal. I am not sure if this can happen, but theoretically
+ // a to-be-removed object may already be the group/3DScene itself
+ for(a = 0; a < nCount; a++)
+ {
+ SdrMark* pMark = rMarkList.GetMark(a);
+ SdrObject* pObject = pMark->GetMarkedSdrObj();
+
+ std::vector< SdrObject* >::iterator aFindResult =
+ std::find(aParents.begin(), aParents.end(), pObject);
+
+ if(aFindResult != aParents.end())
+ {
+ aParents.erase(aFindResult);
+ }
+ }
+ }
+ }
+
+ // original stuff: remove selected objects. Handle clear will
+ // do something only once
+ DeleteMarkedList(GetMarkedObjectList());
+ GetMarkedObjectListWriteAccess().Clear();
+ aHdl.Clear();
+
+ while(aParents.size() && !GetMarkedObjectCount())
+ {
+ // iterate over remembered parents
+ SdrObject* pParent = aParents.back();
+ aParents.pop_back();
+
+ if(pParent->GetSubList() && 0 == pParent->GetSubList()->GetObjCount())
+ {
+ // we detected an empty parent, a candidate to leave group/3DScene
+ // if entered
+ if(GetSdrPageView()->GetAktGroup()
+ && GetSdrPageView()->GetAktGroup() == pParent)
+ {
+ GetSdrPageView()->LeaveOneGroup();
+ }
+
+ // schedule empty parent for removal
+ GetMarkedObjectListWriteAccess().InsertEntry(
+ SdrMark(pParent, GetSdrPageView()));
+ }
+ }
+ }
+
+ // end undo and change messaging moved at the end
+ EndUndo();
+ MarkListHasChanged();
+}
+
+void SdrEditView::CopyMarkedObj()
+{
+ SortMarkedObjects();
+
+ SdrMarkList aSourceObjectsForCopy(GetMarkedObjectList());
+ // Folgende Schleife Anstatt MarkList::Merge(), damit
+ // ich jeweils mein Flag an die MarkEntries setzen kann.
+ sal_uIntPtr nEdgeAnz = GetEdgesOfMarkedNodes().GetMarkCount();
+ for (sal_uIntPtr nEdgeNum=0; nEdgeNum<nEdgeAnz; nEdgeNum++) {
+ SdrMark aM(*GetEdgesOfMarkedNodes().GetMark(nEdgeNum));
+ aM.SetUser(1);
+ aSourceObjectsForCopy.InsertEntry(aM);
+ }
+ aSourceObjectsForCopy.ForceSort();
+
+ // #i13033#
+ // New mechanism to re-create the connections of cloned connectors
+ CloneList aCloneList;
+
+ const bool bUndo = IsUndoEnabled();
+
+ GetMarkedObjectListWriteAccess().Clear();
+ sal_uIntPtr nCloneErrCnt=0;
+ sal_uIntPtr nMarkAnz=aSourceObjectsForCopy.GetMarkCount();
+ sal_uIntPtr nm;
+ for (nm=0; nm<nMarkAnz; nm++) {
+ SdrMark* pM=aSourceObjectsForCopy.GetMark(nm);
+ SdrObject* pO=pM->GetMarkedSdrObj()->Clone();
+ if (pO!=NULL) {
+ SdrInsertReason aReason(SDRREASON_VIEWCALL);
+ pM->GetPageView()->GetObjList()->InsertObject(pO,CONTAINER_APPEND,&aReason);
+
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoCopyObject(*pO));
+
+ SdrMark aME(*pM);
+ aME.SetMarkedSdrObj(pO);
+ aCloneList.AddPair(pM->GetMarkedSdrObj(), pO);
+
+ if (pM->GetUser()==0)
+ {
+ // Sonst war's nur eine mitzukierende Edge
+ GetMarkedObjectListWriteAccess().InsertEntry(aME);
+ }
+ } else {
+ nCloneErrCnt++;
+ }
+ }
+
+ // #i13033#
+ // New mechanism to re-create the connections of cloned connectors
+ aCloneList.CopyConnections();
+
+ if(0L != nCloneErrCnt)
+ {
+#ifdef DBG_UTIL
+ ByteString aStr("SdrEditView::CopyMarkedObj(): Fehler beim Clonen ");
+
+ if(nCloneErrCnt == 1)
+ {
+ aStr += "eines Zeichenobjekts.";
+ }
+ else
+ {
+ aStr += "von ";
+ aStr += ByteString::CreateFromInt32( nCloneErrCnt );
+ aStr += " Zeichenobjekten.";
+ }
+
+ aStr += " Objektverbindungen werden nicht mitkopiert.";
+ DBG_ERROR(aStr.GetBuffer());
+#endif
+ }
+ MarkListHasChanged();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_Bool SdrEditView::InsertObjectAtView(SdrObject* pObj, SdrPageView& rPV, sal_uIntPtr nOptions)
+{
+ if ((nOptions & SDRINSERT_SETDEFLAYER)!=0) {
+ SdrLayerID nLayer=rPV.GetPage()->GetLayerAdmin().GetLayerID(aAktLayer,sal_True);
+ if (nLayer==SDRLAYER_NOTFOUND) nLayer=0;
+ if (rPV.GetLockedLayers().IsSet(nLayer) || !rPV.GetVisibleLayers().IsSet(nLayer)) {
+ SdrObject::Free( pObj ); // Layer gesperrt oder nicht sichtbar
+ return sal_False;
+ }
+ pObj->NbcSetLayer(nLayer);
+ }
+ if ((nOptions & SDRINSERT_SETDEFATTR)!=0) {
+ if (pDefaultStyleSheet!=NULL) pObj->NbcSetStyleSheet(pDefaultStyleSheet, sal_False);
+ pObj->SetMergedItemSet(aDefaultAttr);
+ }
+ if (!pObj->IsInserted()) {
+ SdrInsertReason aReason(SDRREASON_VIEWCALL);
+ if ((nOptions & SDRINSERT_NOBROADCAST)!=0) {
+ rPV.GetObjList()->NbcInsertObject(pObj,CONTAINER_APPEND,&aReason);
+ } else {
+ rPV.GetObjList()->InsertObject(pObj,CONTAINER_APPEND,&aReason);
+ }
+ }
+ if( IsUndoEnabled() )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pObj));
+
+ if ((nOptions & SDRINSERT_DONTMARK)==0) {
+ if ((nOptions & SDRINSERT_ADDMARK)==0) UnmarkAllObj();
+ MarkObj(pObj,&rPV);
+ }
+ return sal_True;
+}
+
+void SdrEditView::ReplaceObjectAtView(SdrObject* pOldObj, SdrPageView& rPV, SdrObject* pNewObj, sal_Bool bMark)
+{
+ SdrObjList* pOL=pOldObj->GetObjList();
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoReplaceObject(*pOldObj,*pNewObj));
+
+ if( IsObjMarked( pOldObj ) )
+ MarkObj( pOldObj, &rPV, sal_True /*unmark!*/ );
+
+ pOL->ReplaceObject(pNewObj,pOldObj->GetOrdNum());
+
+ if( !bUndo )
+ SdrObject::Free( pOldObj );
+
+ if (bMark) MarkObj(pNewObj,&rPV);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+bool SdrEditView::IsUndoEnabled() const
+{
+ return pMod->IsUndoEnabled();
+}
+
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
new file mode 100644
index 000000000000..3502db48e4e9
--- /dev/null
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -0,0 +1,1784 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svdedtv.hxx>
+#include <math.h>
+
+#ifndef _MATH_H
+#define _MATH_H
+#endif
+#include <tools/bigint.hxx>
+#include <svl/itemiter.hxx>
+#include <vcl/msgbox.hxx>
+#include <svx/rectenum.hxx>
+#include <svx/svxids.hrc> // fuer SID_ATTR_TRANSFORM_...
+#include <svx/svdattr.hxx> // fuer Get/SetGeoAttr
+#include "svx/svditext.hxx"
+#include "svx/svditer.hxx"
+#include <svx/svdtrans.hxx>
+#include <svx/svdundo.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdlayer.hxx> // fuer MergeNotPersistAttr
+#include <svx/svdattrx.hxx> // fuer MergeNotPersistAttr
+#include <svx/svdetc.hxx> // fuer SearchOutlinerItems
+#include <svx/svdopath.hxx> // fuer Crook
+#include "svx/svdstr.hrc" // Namen aus der Resource
+#include "svx/svdglob.hxx" // StringCache
+#include <editeng/eeitem.hxx>
+#include <svl/aeitem.hxx>
+#include <svl/whiter.hxx>
+#include <svx/sdr/contact/objectcontact.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/e3dsceneupdater.hxx>
+#include <svx/obj3d.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@@ @@@@@ @@ @@@@@@ @@ @@ @@ @@@@@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@
+// @@@@ @@ @@ @@ @@ @@@@@ @@ @@@@ @@@@@@@
+// @@ @@ @@ @@ @@ @@@ @@ @@ @@@@@@@
+// @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@
+// @@@@@ @@@@@ @@ @@ @ @@ @@@@@ @@ @@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrEditView::SetMarkedObjRect(const Rectangle& rRect, sal_Bool bCopy)
+{
+ DBG_ASSERT(!rRect.IsEmpty(),"SetMarkedObjRect() mit leerem Rect mach keinen Sinn");
+ if (rRect.IsEmpty()) return;
+ sal_uIntPtr nAnz=GetMarkedObjectCount();
+ if (nAnz==0) return;
+ Rectangle aR0(GetMarkedObjRect());
+ DBG_ASSERT(!aR0.IsEmpty(),"SetMarkedObjRect(): GetMarkedObjRect() ist leer");
+ if (aR0.IsEmpty()) return;
+ long x0=aR0.Left();
+ long y0=aR0.Top();
+ long w0=aR0.Right()-x0;
+ long h0=aR0.Bottom()-y0;
+ long x1=rRect.Left();
+ long y1=rRect.Top();
+ long w1=rRect.Right()-x1;
+ long h1=rRect.Bottom()-y1;
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_EditPosSize,aStr);
+ if (bCopy)
+ aStr+=ImpGetResStr(STR_EditWithCopy);
+
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ BegUndo(aStr);
+
+ if (bCopy)
+ CopyMarkedObj();
+
+ for (sal_uIntPtr nm=0; nm<nAnz; nm++)
+ {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pO=pM->GetMarkedSdrObj();
+ if( bUndo )
+ AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
+
+ Rectangle aR1(pO->GetSnapRect());
+ if (!aR1.IsEmpty())
+ {
+ if (aR1==aR0)
+ {
+ aR1=rRect;
+ }
+ else
+ { // aR1 von aR0 nach rRect transformieren
+ aR1.Move(-x0,-y0);
+ BigInt l(aR1.Left());
+ BigInt r(aR1.Right());
+ BigInt t(aR1.Top());
+ BigInt b(aR1.Bottom());
+ if (w0!=0) {
+ l*=w1; l/=w0;
+ r*=w1; r/=w0;
+ } else {
+ l=0; r=w1;
+ }
+ if (h0!=0) {
+ t*=h1; t/=h0;
+ b*=h1; b/=h0;
+ } else {
+ t=0; b=h1;
+ }
+ aR1.Left ()=long(l);
+ aR1.Right ()=long(r);
+ aR1.Top ()=long(t);
+ aR1.Bottom()=long(b);
+ aR1.Move(x1,y1);
+ }
+ pO->SetSnapRect(aR1);
+ } else {
+ DBG_ERROR("SetMarkedObjRect(): pObj->GetSnapRect() liefert leeres Rect");
+ }
+ }
+ if( bUndo )
+ EndUndo();
+}
+
+std::vector< SdrUndoAction* > SdrEditView::CreateConnectorUndo( SdrObject& rO )
+{
+ std::vector< SdrUndoAction* > vUndoActions;
+
+ if ( rO.GetBroadcaster() )
+ {
+ const SdrPage* pPage = rO.GetPage();
+ if ( pPage )
+ {
+ SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
+ while( aIter.IsMore() )
+ {
+ SdrObject* pPartObj = aIter.Next();
+ if ( pPartObj->ISA( SdrEdgeObj ) )
+ {
+ if ( ( pPartObj->GetConnectedNode( sal_False ) == &rO ) ||
+ ( pPartObj->GetConnectedNode( sal_True ) == &rO ) )
+ {
+ vUndoActions.push_back( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject( *pPartObj ) );
+ }
+ }
+ }
+ }
+ }
+ return vUndoActions;
+}
+
+void SdrEditView::AddUndoActions( std::vector< SdrUndoAction* >& rUndoActions )
+{
+ std::vector< SdrUndoAction* >::iterator aUndoActionIter( rUndoActions.begin() );
+ while( aUndoActionIter != rUndoActions.end() )
+ AddUndo( *aUndoActionIter++ );
+}
+
+void SdrEditView::MoveMarkedObj(const Size& rSiz, bool bCopy)
+{
+ const bool bUndo = IsUndoEnabled();
+
+ if( bUndo )
+ {
+ XubString aStr(ImpGetResStr(STR_EditMove));
+ if (bCopy)
+ aStr+=ImpGetResStr(STR_EditWithCopy);
+ // benoetigt eigene UndoGroup wegen Parameter
+ BegUndo(aStr,GetDescriptionOfMarkedObjects(),SDRREPFUNC_OBJ_MOVE);
+ }
+
+ if (bCopy)
+ CopyMarkedObj();
+
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
+ {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pO=pM->GetMarkedSdrObj();
+ if( bUndo )
+ {
+ std::vector< SdrUndoAction* > vConnectorUndoActions( CreateConnectorUndo( *pO ) );
+ AddUndoActions( vConnectorUndoActions );
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoMoveObject(*pO,rSiz));
+ }
+ pO->Move(rSiz);
+ }
+
+ if( bUndo )
+ EndUndo();
+}
+
+void SdrEditView::ResizeMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy)
+{
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ {
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_EditResize,aStr);
+ if (bCopy)
+ aStr+=ImpGetResStr(STR_EditWithCopy);
+ BegUndo(aStr);
+ }
+
+ if (bCopy)
+ CopyMarkedObj();
+
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
+ {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pO=pM->GetMarkedSdrObj();
+ if( bUndo )
+ {
+ std::vector< SdrUndoAction* > vConnectorUndoActions( CreateConnectorUndo( *pO ) );
+ AddUndoActions( vConnectorUndoActions );
+ AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
+ }
+ pO->Resize(rRef,xFact,yFact);
+ }
+
+ if( bUndo )
+ EndUndo();
+}
+
+long SdrEditView::GetMarkedObjRotate() const
+{
+ sal_Bool b1st=sal_True;
+ sal_Bool bOk=sal_True;
+ long nWink=0;
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ for (sal_uIntPtr nm=0; nm<nMarkAnz && bOk; nm++) {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pO=pM->GetMarkedSdrObj();
+ long nWink2=pO->GetRotateAngle();
+ if (b1st) nWink=nWink2;
+ else if (nWink2!=nWink) bOk=sal_False;
+ b1st=sal_False;
+ }
+ if (!bOk) nWink=0;
+ return nWink;
+}
+
+void SdrEditView::RotateMarkedObj(const Point& rRef, long nWink, bool bCopy)
+{
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ {
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_EditRotate,aStr);
+ if (bCopy) aStr+=ImpGetResStr(STR_EditWithCopy);
+ BegUndo(aStr);
+ }
+
+ if (bCopy)
+ CopyMarkedObj();
+
+ double nSin=sin(nWink*nPi180);
+ double nCos=cos(nWink*nPi180);
+ const sal_uInt32 nMarkAnz(GetMarkedObjectCount());
+
+ if(nMarkAnz)
+ {
+ std::vector< E3DModifySceneSnapRectUpdater* > aUpdaters;
+
+ for(sal_uInt32 nm(0); nm < nMarkAnz; nm++)
+ {
+ SdrMark* pM = GetSdrMarkByIndex(nm);
+ SdrObject* pO = pM->GetMarkedSdrObj();
+
+ if( bUndo )
+ {
+ // extra undo actions for changed connector which now may hold it's layouted path (SJ)
+ std::vector< SdrUndoAction* > vConnectorUndoActions( CreateConnectorUndo( *pO ) );
+ AddUndoActions( vConnectorUndoActions );
+
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
+ }
+
+ // set up a scene updater if object is a 3d object
+ if(dynamic_cast< E3dObject* >(pO))
+ {
+ aUpdaters.push_back(new E3DModifySceneSnapRectUpdater(pO));
+ }
+
+ pO->Rotate(rRef,nWink,nSin,nCos);
+ }
+
+ // fire scene updaters
+ while(aUpdaters.size())
+ {
+ delete aUpdaters.back();
+ aUpdaters.pop_back();
+ }
+ }
+
+ if( bUndo )
+ EndUndo();
+}
+
+void SdrEditView::MirrorMarkedObj(const Point& rRef1, const Point& rRef2, bool bCopy)
+{
+ const bool bUndo = IsUndoEnabled();
+
+ if( bUndo )
+ {
+ XubString aStr;
+ Point aDif(rRef2-rRef1);
+ if (aDif.X()==0) ImpTakeDescriptionStr(STR_EditMirrorHori,aStr);
+ else if (aDif.Y()==0) ImpTakeDescriptionStr(STR_EditMirrorVert,aStr);
+ else if (Abs(aDif.X())==Abs(aDif.Y())) ImpTakeDescriptionStr(STR_EditMirrorDiag,aStr);
+ else ImpTakeDescriptionStr(STR_EditMirrorFree,aStr);
+ if (bCopy) aStr+=ImpGetResStr(STR_EditWithCopy);
+ BegUndo(aStr);
+ }
+
+ if (bCopy)
+ CopyMarkedObj();
+
+ const sal_uInt32 nMarkAnz(GetMarkedObjectCount());
+
+ if(nMarkAnz)
+ {
+ std::vector< E3DModifySceneSnapRectUpdater* > aUpdaters;
+
+ for(sal_uInt32 nm(0); nm < nMarkAnz; nm++)
+ {
+ SdrMark* pM = GetSdrMarkByIndex(nm);
+ SdrObject* pO = pM->GetMarkedSdrObj();
+
+ if( bUndo )
+ {
+ // extra undo actions for changed connector which now may hold it's layouted path (SJ)
+ std::vector< SdrUndoAction* > vConnectorUndoActions( CreateConnectorUndo( *pO ) );
+ AddUndoActions( vConnectorUndoActions );
+
+ AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
+ }
+
+ // set up a scene updater if object is a 3d object
+ if(dynamic_cast< E3dObject* >(pO))
+ {
+ aUpdaters.push_back(new E3DModifySceneSnapRectUpdater(pO));
+ }
+
+ pO->Mirror(rRef1,rRef2);
+ }
+
+ // fire scene updaters
+ while(aUpdaters.size())
+ {
+ delete aUpdaters.back();
+ aUpdaters.pop_back();
+ }
+ }
+
+ if( bUndo )
+ EndUndo();
+}
+
+void SdrEditView::MirrorMarkedObjHorizontal(sal_Bool bCopy)
+{
+ Point aCenter(GetMarkedObjRect().Center());
+ Point aPt2(aCenter);
+ aPt2.Y()++;
+ MirrorMarkedObj(aCenter,aPt2,bCopy);
+}
+
+void SdrEditView::MirrorMarkedObjVertical(sal_Bool bCopy)
+{
+ Point aCenter(GetMarkedObjRect().Center());
+ Point aPt2(aCenter);
+ aPt2.X()++;
+ MirrorMarkedObj(aCenter,aPt2,bCopy);
+}
+
+long SdrEditView::GetMarkedObjShear() const
+{
+ sal_Bool b1st=sal_True;
+ sal_Bool bOk=sal_True;
+ long nWink=0;
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ for (sal_uIntPtr nm=0; nm<nMarkAnz && bOk; nm++) {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pO=pM->GetMarkedSdrObj();
+ long nWink2=pO->GetShearAngle();
+ if (b1st) nWink=nWink2;
+ else if (nWink2!=nWink) bOk=sal_False;
+ b1st=sal_False;
+ }
+ if (nWink>SDRMAXSHEAR) nWink=SDRMAXSHEAR;
+ if (nWink<-SDRMAXSHEAR) nWink=-SDRMAXSHEAR;
+ if (!bOk) nWink=0;
+ return nWink;
+}
+
+void SdrEditView::ShearMarkedObj(const Point& rRef, long nWink, bool bVShear, bool bCopy)
+{
+ const bool bUndo = IsUndoEnabled();
+
+ if( bUndo )
+ {
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_EditShear,aStr);
+ if (bCopy)
+ aStr+=ImpGetResStr(STR_EditWithCopy);
+ BegUndo(aStr);
+ }
+
+ if (bCopy)
+ CopyMarkedObj();
+
+ double nTan=tan(nWink*nPi180);
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
+ {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pO=pM->GetMarkedSdrObj();
+ if( bUndo )
+ {
+ std::vector< SdrUndoAction* > vConnectorUndoActions( CreateConnectorUndo( *pO ) );
+ AddUndoActions( vConnectorUndoActions );
+ AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
+ }
+ pO->Shear(rRef,nWink,nTan,bVShear);
+ }
+
+ if( bUndo )
+ EndUndo();
+}
+
+void SdrEditView::ImpCrookObj(SdrObject* pO, const Point& rRef, const Point& rRad,
+ SdrCrookMode eMode, sal_Bool bVertical, sal_Bool bNoContortion, sal_Bool bRotate, const Rectangle& rMarkRect)
+{
+ SdrPathObj* pPath=PTR_CAST(SdrPathObj,pO);
+ sal_Bool bDone = sal_False;
+
+ if(pPath!=NULL && !bNoContortion)
+ {
+ XPolyPolygon aXPP(pPath->GetPathPoly());
+ switch (eMode) {
+ case SDRCROOK_ROTATE : CrookRotatePoly (aXPP,rRef,rRad,bVertical); break;
+ case SDRCROOK_SLANT : CrookSlantPoly (aXPP,rRef,rRad,bVertical); break;
+ case SDRCROOK_STRETCH: CrookStretchPoly(aXPP,rRef,rRad,bVertical,rMarkRect); break;
+ } // switch
+ pPath->SetPathPoly(aXPP.getB2DPolyPolygon());
+ bDone = sal_True;
+ }
+
+ if(!bDone && !pPath && pO->IsPolyObj() && 0L != pO->GetPointCount())
+ {
+ // FuerPolyObj's, aber NICHT fuer SdrPathObj's, z.B. fuer's Bemassungsobjekt
+ sal_uInt32 nPtAnz(pO->GetPointCount());
+ XPolygon aXP((sal_uInt16)nPtAnz);
+ sal_uInt32 nPtNum;
+
+ for(nPtNum = 0L; nPtNum < nPtAnz; nPtNum++)
+ {
+ Point aPt(pO->GetPoint(nPtNum));
+ aXP[(sal_uInt16)nPtNum]=aPt;
+ }
+
+ switch (eMode)
+ {
+ case SDRCROOK_ROTATE : CrookRotatePoly (aXP,rRef,rRad,bVertical); break;
+ case SDRCROOK_SLANT : CrookSlantPoly (aXP,rRef,rRad,bVertical); break;
+ case SDRCROOK_STRETCH: CrookStretchPoly(aXP,rRef,rRad,bVertical,rMarkRect); break;
+ }
+
+ for(nPtNum = 0L; nPtNum < nPtAnz; nPtNum++)
+ {
+ // hier koennte man vieleicht auch mal das Broadcasting optimieren
+ // ist aber z.Zt. bei den 2 Punkten des Bemassungsobjekts noch nicht so tragisch
+ pO->SetPoint(aXP[(sal_uInt16)nPtNum],nPtNum);
+ }
+
+ bDone = sal_True;
+ }
+
+ if(!bDone)
+ {
+ // Fuer alle anderen oder wenn bNoContortion
+ Point aCtr0(pO->GetSnapRect().Center());
+ Point aCtr1(aCtr0);
+ sal_Bool bRotOk(sal_False);
+ double nSin(0.0), nCos(1.0);
+ double nWink(0.0);
+
+ if(0 != rRad.X() && 0 != rRad.Y())
+ {
+ bRotOk = bRotate;
+
+ switch (eMode)
+ {
+ case SDRCROOK_ROTATE : nWink=CrookRotateXPoint (aCtr1,NULL,NULL,rRef,rRad,nSin,nCos,bVertical); bRotOk=bRotate; break;
+ case SDRCROOK_SLANT : nWink=CrookSlantXPoint (aCtr1,NULL,NULL,rRef,rRad,nSin,nCos,bVertical); break;
+ case SDRCROOK_STRETCH: nWink=CrookStretchXPoint(aCtr1,NULL,NULL,rRef,rRad,nSin,nCos,bVertical,rMarkRect); break;
+ }
+ }
+
+ aCtr1 -= aCtr0;
+
+ if(bRotOk)
+ pO->Rotate(aCtr0, Round(nWink/nPi180), nSin, nCos);
+
+ pO->Move(Size(aCtr1.X(),aCtr1.Y()));
+ }
+}
+
+void SdrEditView::CrookMarkedObj(const Point& rRef, const Point& rRad, SdrCrookMode eMode,
+ bool bVertical, bool bNoContortion, bool bCopy)
+{
+ Rectangle aMarkRect(GetMarkedObjRect());
+ const bool bUndo = IsUndoEnabled();
+
+ bool bRotate=bNoContortion && eMode==SDRCROOK_ROTATE && IsRotateAllowed(sal_False);
+
+ if( bUndo )
+ {
+ XubString aStr;
+ ImpTakeDescriptionStr(bNoContortion?STR_EditCrook:STR_EditCrookContortion,aStr);
+ if (bCopy)
+ aStr+=ImpGetResStr(STR_EditWithCopy);
+ BegUndo(aStr);
+ }
+
+ if (bCopy)
+ CopyMarkedObj();
+
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
+ {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pO=pM->GetMarkedSdrObj();
+ if( bUndo )
+ AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
+
+ const SdrObjList* pOL=pO->GetSubList();
+ if (bNoContortion || pOL==NULL) {
+ ImpCrookObj(pO,rRef,rRad,eMode,bVertical,bNoContortion,bRotate,aMarkRect);
+ } else {
+ SdrObjListIter aIter(*pOL,IM_DEEPNOGROUPS);
+ while (aIter.IsMore()) {
+ SdrObject* pO1=aIter.Next();
+ ImpCrookObj(pO1,rRef,rRad,eMode,bVertical,bNoContortion,bRotate,aMarkRect);
+ }
+ }
+ }
+
+ if( bUndo )
+ EndUndo();
+}
+
+void SdrEditView::ImpDistortObj(SdrObject* pO, const Rectangle& rRef, const XPolygon& rDistortedRect, sal_Bool bNoContortion)
+{
+ SdrPathObj* pPath = PTR_CAST(SdrPathObj, pO);
+
+ if(!bNoContortion && pPath)
+ {
+ XPolyPolygon aXPP(pPath->GetPathPoly());
+ aXPP.Distort(rRef, rDistortedRect);
+ pPath->SetPathPoly(aXPP.getB2DPolyPolygon());
+ }
+ else if(pO->IsPolyObj())
+ {
+ // z.B. fuer's Bemassungsobjekt
+ sal_uInt32 nPtAnz(pO->GetPointCount());
+ XPolygon aXP((sal_uInt16)nPtAnz);
+ sal_uInt32 nPtNum;
+
+ for(nPtNum = 0L; nPtNum < nPtAnz; nPtNum++)
+ {
+ Point aPt(pO->GetPoint(nPtNum));
+ aXP[(sal_uInt16)nPtNum]=aPt;
+ }
+
+ aXP.Distort(rRef, rDistortedRect);
+
+ for(nPtNum = 0L; nPtNum < nPtAnz; nPtNum++)
+ {
+ // hier koennte man vieleicht auch mal das Broadcasting optimieren
+ // ist aber z.Zt. bei den 2 Punkten des Bemassungsobjekts noch nicht so tragisch
+ pO->SetPoint(aXP[(sal_uInt16)nPtNum],nPtNum);
+ }
+ }
+}
+
+void SdrEditView::DistortMarkedObj(const Rectangle& rRef, const XPolygon& rDistortedRect, bool bNoContortion, bool bCopy)
+{
+ const bool bUndo = IsUndoEnabled();
+
+ if( bUndo )
+ {
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_EditDistort,aStr);
+ if (bCopy)
+ aStr+=ImpGetResStr(STR_EditWithCopy);
+ BegUndo(aStr);
+ }
+
+ if (bCopy)
+ CopyMarkedObj();
+
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
+ {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pO=pM->GetMarkedSdrObj();
+ if( bUndo )
+ AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
+
+ Rectangle aRefRect(rRef);
+ XPolygon aRefPoly(rDistortedRect);
+ const SdrObjList* pOL=pO->GetSubList();
+ if (bNoContortion || pOL==NULL) {
+ ImpDistortObj(pO,aRefRect,aRefPoly,bNoContortion);
+ } else {
+ SdrObjListIter aIter(*pOL,IM_DEEPNOGROUPS);
+ while (aIter.IsMore()) {
+ SdrObject* pO1=aIter.Next();
+ ImpDistortObj(pO1,aRefRect,aRefPoly,bNoContortion);
+ }
+ }
+ }
+ if( bUndo )
+ EndUndo();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrEditView::SetNotPersistAttrToMarked(const SfxItemSet& rAttr, sal_Bool /*bReplaceAll*/)
+{
+ // bReplaceAll hat hier keinerlei Wirkung
+ Rectangle aAllSnapRect(GetMarkedObjRect());
+ const SfxPoolItem *pPoolItem=NULL;
+ if (rAttr.GetItemState(SDRATTR_TRANSFORMREF1X,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ long n=((const SdrTransformRef1XItem*)pPoolItem)->GetValue();
+ SetRef1(Point(n,GetRef1().Y()));
+ }
+ if (rAttr.GetItemState(SDRATTR_TRANSFORMREF1Y,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ long n=((const SdrTransformRef1YItem*)pPoolItem)->GetValue();
+ SetRef1(Point(GetRef1().X(),n));
+ }
+ if (rAttr.GetItemState(SDRATTR_TRANSFORMREF2X,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ long n=((const SdrTransformRef2XItem*)pPoolItem)->GetValue();
+ SetRef2(Point(n,GetRef2().Y()));
+ }
+ if (rAttr.GetItemState(SDRATTR_TRANSFORMREF2Y,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ long n=((const SdrTransformRef2YItem*)pPoolItem)->GetValue();
+ SetRef2(Point(GetRef2().X(),n));
+ }
+ long nAllPosX=0; sal_Bool bAllPosX=sal_False;
+ long nAllPosY=0; sal_Bool bAllPosY=sal_False;
+ long nAllWdt=0; sal_Bool bAllWdt=sal_False;
+ long nAllHgt=0; sal_Bool bAllHgt=sal_False;
+ sal_Bool bDoIt=sal_False;
+ if (rAttr.GetItemState(SDRATTR_ALLPOSITIONX,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ nAllPosX=((const SdrAllPositionXItem*)pPoolItem)->GetValue();
+ bAllPosX=sal_True; bDoIt=sal_True;
+ }
+ if (rAttr.GetItemState(SDRATTR_ALLPOSITIONY,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ nAllPosY=((const SdrAllPositionYItem*)pPoolItem)->GetValue();
+ bAllPosY=sal_True; bDoIt=sal_True;
+ }
+ if (rAttr.GetItemState(SDRATTR_ALLSIZEWIDTH,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ nAllWdt=((const SdrAllSizeWidthItem*)pPoolItem)->GetValue();
+ bAllWdt=sal_True; bDoIt=sal_True;
+ }
+ if (rAttr.GetItemState(SDRATTR_ALLSIZEHEIGHT,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ nAllHgt=((const SdrAllSizeHeightItem*)pPoolItem)->GetValue();
+ bAllHgt=sal_True; bDoIt=sal_True;
+ }
+ if (bDoIt) {
+ Rectangle aRect(aAllSnapRect); // !!! fuer PolyPt's und GluePt's aber bitte noch aendern !!!
+ if (bAllPosX) aRect.Move(nAllPosX-aRect.Left(),0);
+ if (bAllPosY) aRect.Move(0,nAllPosY-aRect.Top());
+ if (bAllWdt) aRect.Right()=aAllSnapRect.Left()+nAllWdt;
+ if (bAllHgt) aRect.Bottom()=aAllSnapRect.Top()+nAllHgt;
+ SetMarkedObjRect(aRect);
+ }
+ if (rAttr.GetItemState(SDRATTR_RESIZEXALL,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ Fraction aXFact=((const SdrResizeXAllItem*)pPoolItem)->GetValue();
+ ResizeMarkedObj(aAllSnapRect.TopLeft(),aXFact,Fraction(1,1));
+ }
+ if (rAttr.GetItemState(SDRATTR_RESIZEYALL,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ Fraction aYFact=((const SdrResizeYAllItem*)pPoolItem)->GetValue();
+ ResizeMarkedObj(aAllSnapRect.TopLeft(),Fraction(1,1),aYFact);
+ }
+ if (rAttr.GetItemState(SDRATTR_ROTATEALL,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ long nAngle=((const SdrRotateAllItem*)pPoolItem)->GetValue();
+ RotateMarkedObj(aAllSnapRect.Center(),nAngle);
+ }
+ if (rAttr.GetItemState(SDRATTR_HORZSHEARALL,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ long nAngle=((const SdrHorzShearAllItem*)pPoolItem)->GetValue();
+ ShearMarkedObj(aAllSnapRect.Center(),nAngle,sal_False);
+ }
+ if (rAttr.GetItemState(SDRATTR_VERTSHEARALL,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ long nAngle=((const SdrVertShearAllItem*)pPoolItem)->GetValue();
+ ShearMarkedObj(aAllSnapRect.Center(),nAngle,sal_True);
+ }
+
+ const bool bUndo = IsUndoEnabled();
+
+ // Todo: WhichRange nach Notwendigkeit ueberpruefen.
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
+ {
+ const SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ //const SdrPageView* pPV=pM->GetPageView();
+ if( bUndo )
+ AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
+
+ pObj->ApplyNotPersistAttr(rAttr);
+ }
+}
+
+void SdrEditView::MergeNotPersistAttrFromMarked(SfxItemSet& rAttr, sal_Bool /*bOnlyHardAttr*/) const
+{
+ // bOnlyHardAttr hat hier keinerlei Wirkung
+ // Hier muss ausserdem noch der Nullpunkt und
+ // die PvPos berueksichtigt werden.
+ Rectangle aAllSnapRect(GetMarkedObjRect()); // !!! fuer PolyPt's und GluePt's aber bitte noch aendern !!!
+ long nAllSnapPosX=aAllSnapRect.Left();
+ long nAllSnapPosY=aAllSnapRect.Top();
+ long nAllSnapWdt=aAllSnapRect.GetWidth()-1;
+ long nAllSnapHgt=aAllSnapRect.GetHeight()-1;
+ // koennte mal zu CheckPossibilities mit rein
+ sal_Bool bMovProtect=sal_False,bMovProtectDC=sal_False;
+ sal_Bool bSizProtect=sal_False,bSizProtectDC=sal_False;
+ sal_Bool bPrintable =sal_True ,bPrintableDC=sal_False;
+ sal_Bool bVisible = sal_True, bVisibleDC=sal_False;
+ SdrLayerID nLayerId=0; sal_Bool bLayerDC=sal_False;
+ XubString aObjName; sal_Bool bObjNameDC=sal_False,bObjNameSet=sal_False;
+ long nSnapPosX=0; sal_Bool bSnapPosXDC=sal_False;
+ long nSnapPosY=0; sal_Bool bSnapPosYDC=sal_False;
+ long nSnapWdt=0; sal_Bool bSnapWdtDC=sal_False;
+ long nSnapHgt=0; sal_Bool bSnapHgtDC=sal_False;
+ long nLogicWdt=0; sal_Bool bLogicWdtDC=sal_False,bLogicWdtDiff=sal_False;
+ long nLogicHgt=0; sal_Bool bLogicHgtDC=sal_False,bLogicHgtDiff=sal_False;
+ long nRotAngle=0; sal_Bool bRotAngleDC=sal_False;
+ long nShrAngle=0; sal_Bool bShrAngleDC=sal_False;
+ Rectangle aSnapRect;
+ Rectangle aLogicRect;
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++) {
+ const SdrMark* pM=GetSdrMarkByIndex(nm);
+ const SdrObject* pObj=pM->GetMarkedSdrObj();
+ if (nm==0) {
+ nLayerId=pObj->GetLayer();
+ bMovProtect=pObj->IsMoveProtect();
+ bSizProtect=pObj->IsResizeProtect();
+ bPrintable =pObj->IsPrintable();
+ bVisible = pObj->IsVisible();
+ Rectangle aSnapRect2(pObj->GetSnapRect());
+ Rectangle aLogicRect2(pObj->GetLogicRect());
+ nSnapPosX=aSnapRect2.Left();
+ nSnapPosY=aSnapRect2.Top();
+ nSnapWdt=aSnapRect2.GetWidth()-1;
+ nSnapHgt=aSnapRect2.GetHeight()-1;
+ nLogicWdt=aLogicRect2.GetWidth()-1;
+ nLogicHgt=aLogicRect2.GetHeight()-1;
+ bLogicWdtDiff=nLogicWdt!=nSnapWdt;
+ bLogicHgtDiff=nLogicHgt!=nSnapHgt;
+ nRotAngle=pObj->GetRotateAngle();
+ nShrAngle=pObj->GetShearAngle();
+ } else {
+ if (!bLayerDC && nLayerId !=pObj->GetLayer()) bLayerDC=sal_True;
+ if (!bMovProtectDC && bMovProtect!=pObj->IsMoveProtect()) bMovProtectDC=sal_True;
+ if (!bSizProtectDC && bSizProtect!=pObj->IsResizeProtect()) bSizProtectDC=sal_True;
+ if (!bPrintableDC && bPrintable !=pObj->IsPrintable()) bPrintableDC=sal_True;
+ if (!bVisibleDC && bVisible !=pObj->IsVisible()) bVisibleDC=sal_True;
+ if (!bRotAngleDC && nRotAngle !=pObj->GetRotateAngle()) bRotAngleDC=sal_True;
+ if (!bShrAngleDC && nShrAngle !=pObj->GetShearAngle()) bShrAngleDC=sal_True;
+ if (!bSnapWdtDC || !bSnapHgtDC || !bSnapPosXDC || !bSnapPosYDC || !bLogicWdtDiff || !bLogicHgtDiff) {
+ aSnapRect=pObj->GetSnapRect();
+ if (nSnapPosX!=aSnapRect.Left()) bSnapPosXDC=sal_True;
+ if (nSnapPosY!=aSnapRect.Top()) bSnapPosYDC=sal_True;
+ if (nSnapWdt!=aSnapRect.GetWidth()-1) bSnapWdtDC=sal_True;
+ if (nSnapHgt!=aSnapRect.GetHeight()-1) bSnapHgtDC=sal_True;
+ }
+ if (!bLogicWdtDC || !bLogicHgtDC || !bLogicWdtDiff || !bLogicHgtDiff) {
+ aLogicRect=pObj->GetLogicRect();
+ if (nLogicWdt!=aLogicRect.GetWidth()-1) bLogicWdtDC=sal_True;
+ if (nLogicHgt!=aLogicRect.GetHeight()-1) bLogicHgtDC=sal_True;
+ if (!bLogicWdtDiff && aSnapRect.GetWidth()!=aLogicRect.GetWidth()) bLogicWdtDiff=sal_True;
+ if (!bLogicHgtDiff && aSnapRect.GetHeight()!=aLogicRect.GetHeight()) bLogicHgtDiff=sal_True;
+ }
+ }
+ if (!bObjNameDC ) {
+ if (!bObjNameSet) {
+ aObjName=pObj->GetName();
+ } else {
+ if (aObjName!=pObj->GetName()) bObjNameDC=sal_True;
+ }
+ }
+ }
+
+ if (bSnapPosXDC || nAllSnapPosX!=nSnapPosX) rAttr.Put(SdrAllPositionXItem(nAllSnapPosX));
+ if (bSnapPosYDC || nAllSnapPosY!=nSnapPosY) rAttr.Put(SdrAllPositionYItem(nAllSnapPosY));
+ if (bSnapWdtDC || nAllSnapWdt !=nSnapWdt ) rAttr.Put(SdrAllSizeWidthItem(nAllSnapWdt));
+ if (bSnapHgtDC || nAllSnapHgt !=nSnapHgt ) rAttr.Put(SdrAllSizeHeightItem(nAllSnapHgt));
+
+ // Items fuer reine Transformationen
+ rAttr.Put(SdrMoveXItem());
+ rAttr.Put(SdrMoveYItem());
+ rAttr.Put(SdrResizeXOneItem());
+ rAttr.Put(SdrResizeYOneItem());
+ rAttr.Put(SdrRotateOneItem());
+ rAttr.Put(SdrHorzShearOneItem());
+ rAttr.Put(SdrVertShearOneItem());
+
+ if (nMarkAnz>1) {
+ rAttr.Put(SdrResizeXAllItem());
+ rAttr.Put(SdrResizeYAllItem());
+ rAttr.Put(SdrRotateAllItem());
+ rAttr.Put(SdrHorzShearAllItem());
+ rAttr.Put(SdrVertShearAllItem());
+ }
+
+ if(eDragMode == SDRDRAG_ROTATE || eDragMode == SDRDRAG_MIRROR)
+ {
+ rAttr.Put(SdrTransformRef1XItem(GetRef1().X()));
+ rAttr.Put(SdrTransformRef1YItem(GetRef1().Y()));
+ }
+
+ if(eDragMode == SDRDRAG_MIRROR)
+ {
+ rAttr.Put(SdrTransformRef2XItem(GetRef2().X()));
+ rAttr.Put(SdrTransformRef2YItem(GetRef2().Y()));
+ }
+}
+
+SfxItemSet SdrEditView::GetAttrFromMarked(sal_Bool bOnlyHardAttr) const
+{
+ SfxItemSet aSet(pMod->GetItemPool());
+ MergeAttrFromMarked(aSet,bOnlyHardAttr);
+ //the EE_FEATURE items should not be set with SetAttrToMarked (see error message there)
+ //so we do not set them here
+ // #i32448#
+ // Do not disable, but clear the items.
+ aSet.ClearItem(EE_FEATURE_TAB);
+ aSet.ClearItem(EE_FEATURE_LINEBR);
+ aSet.ClearItem(EE_FEATURE_NOTCONV);
+ aSet.ClearItem(EE_FEATURE_FIELD);
+ return aSet;
+}
+
+void SdrEditView::MergeAttrFromMarked(SfxItemSet& rAttr, sal_Bool bOnlyHardAttr) const
+{
+ sal_uInt32 nMarkAnz(GetMarkedObjectCount());
+
+ for(sal_uInt32 a(0); a < nMarkAnz; a++)
+ {
+ // #80277# merging was done wrong in the prev version
+ //const SfxItemSet& rSet = GetMarkedObjectByIndex()->GetItemSet();
+ const SfxItemSet& rSet = GetMarkedObjectByIndex(a)->GetMergedItemSet();
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich(aIter.FirstWhich());
+
+ while(nWhich)
+ {
+ if(!bOnlyHardAttr)
+ {
+ if(SFX_ITEM_DONTCARE == rSet.GetItemState(nWhich, sal_False))
+ rAttr.InvalidateItem(nWhich);
+ else
+ rAttr.MergeValue(rSet.Get(nWhich), sal_True);
+ }
+ else if(SFX_ITEM_SET == rSet.GetItemState(nWhich, sal_False))
+ {
+ const SfxPoolItem& rItem = rSet.Get(nWhich);
+ rAttr.MergeValue(rItem, sal_True);
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+ }
+}
+
+void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, sal_Bool bReplaceAll)
+{
+ if (AreObjectsMarked())
+ {
+#ifdef DBG_UTIL
+ {
+ sal_Bool bHasEEFeatureItems=sal_False;
+ SfxItemIter aIter(rAttr);
+ const SfxPoolItem* pItem=aIter.FirstItem();
+ while (!bHasEEFeatureItems && pItem!=NULL) {
+ if (!IsInvalidItem(pItem)) {
+ sal_uInt16 nW=pItem->Which();
+ if (nW>=EE_FEATURE_START && nW<=EE_FEATURE_END) bHasEEFeatureItems=sal_True;
+ }
+ pItem=aIter.NextItem();
+ }
+ if(bHasEEFeatureItems)
+ {
+ String aMessage;
+ aMessage.AppendAscii("SdrEditView::SetAttrToMarked(): Das setzen von EE_FEATURE-Items an der SdrView macht keinen Sinn! Es fuehrt nur zu Overhead und nicht mehr lesbaren Dokumenten.");
+ InfoBox(NULL, aMessage).Execute();
+ }
+ }
+#endif
+
+ // #103836# if the user thets character attributes to the complete shape,
+ // we want to remove all hard set character attributes with same
+ // which ids from the text. We do that later but here we remember
+ // all character attribute which id's that are set.
+ std::vector<sal_uInt16> aCharWhichIds;
+ {
+ SfxItemIter aIter(rAttr);
+ const SfxPoolItem* pItem=aIter.FirstItem();
+ while( pItem!=NULL )
+ {
+ if (!IsInvalidItem(pItem))
+ {
+ sal_uInt16 nWhich = pItem->Which();
+ if (nWhich>=EE_CHAR_START && nWhich<=EE_CHAR_END)
+ aCharWhichIds.push_back( nWhich );
+ }
+ pItem=aIter.NextItem();
+ }
+ }
+
+ // Joe, 2.7.98: Damit Undo nach Format.Standard auch die Textattribute korrekt restauriert
+ sal_Bool bHasEEItems=SearchOutlinerItems(rAttr,bReplaceAll);
+
+ // AW 030100: save additional geom info when para or char attributes
+ // are changed and the geom form of the text object might be changed
+ sal_Bool bPossibleGeomChange(sal_False);
+ SfxWhichIter aIter(rAttr);
+ sal_uInt16 nWhich = aIter.FirstWhich();
+ while(!bPossibleGeomChange && nWhich)
+ {
+ SfxItemState eState = rAttr.GetItemState(nWhich);
+ if(eState == SFX_ITEM_SET)
+ {
+ if((nWhich >= SDRATTR_TEXT_MINFRAMEHEIGHT && nWhich <= SDRATTR_TEXT_CONTOURFRAME)
+ || nWhich == SDRATTR_3DOBJ_PERCENT_DIAGONAL
+ || nWhich == SDRATTR_3DOBJ_BACKSCALE
+ || nWhich == SDRATTR_3DOBJ_DEPTH
+ || nWhich == SDRATTR_3DOBJ_END_ANGLE
+ || nWhich == SDRATTR_3DSCENE_DISTANCE)
+ {
+ bPossibleGeomChange = sal_True;
+ }
+ }
+ nWhich = aIter.NextWhich();
+ }
+
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ {
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_EditSetAttributes,aStr);
+ BegUndo(aStr);
+ }
+
+ const sal_uInt32 nMarkAnz(GetMarkedObjectCount());
+ std::vector< E3DModifySceneSnapRectUpdater* > aUpdaters;
+
+ // create ItemSet without SFX_ITEM_DONTCARE. Put()
+ // uses it's second parameter (bInvalidAsDefault) to
+ // remove all such items to set them to default.
+ SfxItemSet aAttr(*rAttr.GetPool(), rAttr.GetRanges());
+ aAttr.Put(rAttr, sal_True);
+
+ // #i38135#
+ bool bResetAnimationTimer(false);
+
+ for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
+ {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj = pM->GetMarkedSdrObj();
+
+ if( bUndo )
+ {
+ std::vector< SdrUndoAction* > vConnectorUndoActions;
+ SdrEdgeObj* pEdgeObj = dynamic_cast< SdrEdgeObj* >( pObj );
+ if ( pEdgeObj )
+ bPossibleGeomChange = sal_True;
+ else if( bUndo )
+ vConnectorUndoActions = CreateConnectorUndo( *pObj );
+
+ AddUndoActions( vConnectorUndoActions );
+ }
+
+ // new geometry undo
+ if(bPossibleGeomChange && bUndo)
+ {
+ // save position and size of obect, too
+ AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
+ }
+
+ if( bUndo )
+ {
+ // #i8508#
+ // If this is a text object also rescue the OutlinerParaObject since
+ // applying attributes to the object may change text layout when
+ // multiple portions exist with multiple formats. If a OutlinerParaObject
+ // really exists and needs to be rescued is evaluated in the undo
+ // implementation itself.
+ const bool bRescueText = dynamic_cast< SdrTextObj* >(pObj) != 0;
+
+ // add attribute undo
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj,sal_False,bHasEEItems || bPossibleGeomChange || bRescueText));
+ }
+
+ // set up a scxene updater if object is a 3d object
+ if(dynamic_cast< E3dObject* >(pObj))
+ {
+ aUpdaters.push_back(new E3DModifySceneSnapRectUpdater(pObj));
+ }
+
+ // set attributes at object
+ pObj->SetMergedItemSetAndBroadcast(aAttr, bReplaceAll);
+
+ if(pObj->ISA(SdrTextObj))
+ {
+ SdrTextObj* pTextObj = ((SdrTextObj*)pObj);
+
+ if(0 != aCharWhichIds.size())
+ {
+ Rectangle aOldBoundRect = pTextObj->GetLastBoundRect();
+
+ // #110094#-14 pTextObj->SendRepaintBroadcast(pTextObj->GetBoundRect());
+ pTextObj->RemoveOutlinerCharacterAttribs( aCharWhichIds );
+
+ // object has changed, should be called form
+ // RemoveOutlinerCharacterAttribs. This will change when the text
+ // object implementation changes.
+ pTextObj->SetChanged();
+
+ pTextObj->BroadcastObjectChange();
+ pTextObj->SendUserCall(SDRUSERCALL_CHGATTR, aOldBoundRect);
+ }
+ }
+
+ // #i38495#
+ if(!bResetAnimationTimer)
+ {
+ if(pObj->GetViewContact().isAnimatedInAnyViewObjectContact())
+ {
+ bResetAnimationTimer = true;
+ }
+ }
+ }
+
+ // fire scene updaters
+ while(aUpdaters.size())
+ {
+ delete aUpdaters.back();
+ aUpdaters.pop_back();
+ }
+
+ // #i38135#
+ if(bResetAnimationTimer)
+ {
+ SetAnimationTimer(0L);
+ }
+
+ // besser vorher checken, was gemacht werden soll:
+ // pObj->SetAttr() oder SetNotPersistAttr()
+ // !!! fehlende Implementation !!!
+ SetNotPersistAttrToMarked(rAttr,bReplaceAll);
+
+ if( bUndo )
+ EndUndo();
+ }
+}
+
+SfxStyleSheet* SdrEditView::GetStyleSheetFromMarked() const
+{
+ SfxStyleSheet* pRet=NULL;
+ sal_Bool b1st=sal_True;
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++) {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SfxStyleSheet* pSS=pM->GetMarkedSdrObj()->GetStyleSheet();
+ if (b1st) pRet=pSS;
+ else if (pRet!=pSS) return NULL; // verschiedene StyleSheets
+ b1st=sal_False;
+ }
+ return pRet;
+}
+
+void SdrEditView::SetStyleSheetToMarked(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr)
+{
+ if (AreObjectsMarked())
+ {
+ const bool bUndo = IsUndoEnabled();
+
+ if( bUndo )
+ {
+ XubString aStr;
+ if (pStyleSheet!=NULL)
+ ImpTakeDescriptionStr(STR_EditSetStylesheet,aStr);
+ else
+ ImpTakeDescriptionStr(STR_EditDelStylesheet,aStr);
+ BegUndo(aStr);
+ }
+
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
+ {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ if( bUndo )
+ {
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pM->GetMarkedSdrObj()));
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pM->GetMarkedSdrObj(),true,true));
+ }
+ pM->GetMarkedSdrObj()->SetStyleSheet(pStyleSheet,bDontRemoveHardAttr);
+ }
+
+ if( bUndo )
+ EndUndo();
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/* new interface src537 */
+sal_Bool SdrEditView::GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr) const
+{
+ if(GetMarkedObjectCount())
+ {
+ rTargetSet.Put(GetAttrFromMarked(bOnlyHardAttr), sal_False);
+ return sal_True;
+ }
+ else
+ {
+ return SdrMarkView::GetAttributes(rTargetSet, bOnlyHardAttr);
+ }
+}
+
+sal_Bool SdrEditView::SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll)
+{
+ if (GetMarkedObjectCount()!=0) {
+ SetAttrToMarked(rSet,bReplaceAll);
+ return sal_True;
+ } else {
+ return SdrMarkView::SetAttributes(rSet,bReplaceAll);
+ }
+}
+
+SfxStyleSheet* SdrEditView::GetStyleSheet() const // SfxStyleSheet* SdrEditView::GetStyleSheet(sal_Bool& rOk) const
+{
+ if (GetMarkedObjectCount()!=0) {
+ //rOk=sal_True;
+ return GetStyleSheetFromMarked();
+ } else {
+ return SdrMarkView::GetStyleSheet(); // SdrMarkView::GetStyleSheet(rOk);
+ }
+}
+
+sal_Bool SdrEditView::SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr)
+{
+ if (GetMarkedObjectCount()!=0) {
+ SetStyleSheetToMarked(pStyleSheet,bDontRemoveHardAttr);
+ return sal_True;
+ } else {
+ return SdrMarkView::SetStyleSheet(pStyleSheet,bDontRemoveHardAttr);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SfxItemSet SdrEditView::GetGeoAttrFromMarked() const
+{
+ SfxItemSet aRetSet(pMod->GetItemPool(), // SID_ATTR_TRANSFORM_... aus s:svxids.hrc
+ SID_ATTR_TRANSFORM_POS_X,SID_ATTR_TRANSFORM_ANGLE,
+ SID_ATTR_TRANSFORM_PROTECT_POS,SID_ATTR_TRANSFORM_AUTOHEIGHT,
+ SDRATTR_ECKENRADIUS,SDRATTR_ECKENRADIUS,
+ 0);
+ if (AreObjectsMarked()) {
+ SfxItemSet aMarkAttr(GetAttrFromMarked(sal_False)); // wg. AutoGrowHeight und Eckenradius
+ Rectangle aRect(GetMarkedObjRect());
+
+ if(GetSdrPageView())
+ {
+ GetSdrPageView()->LogicToPagePos(aRect);
+ }
+
+ // Position
+ aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_POS_X,aRect.Left()));
+ aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_POS_Y,aRect.Top()));
+
+ // Groesse
+ long nResizeRefX=aRect.Left();
+ long nResizeRefY=aRect.Top();
+ if (eDragMode==SDRDRAG_ROTATE) { // Drehachse auch als Referenz fuer Resize
+ nResizeRefX=aRef1.X();
+ nResizeRefY=aRef1.Y();
+ }
+ aRetSet.Put(SfxUInt32Item(SID_ATTR_TRANSFORM_WIDTH,aRect.Right()-aRect.Left()));
+ aRetSet.Put(SfxUInt32Item(SID_ATTR_TRANSFORM_HEIGHT,aRect.Bottom()-aRect.Top()));
+ aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_RESIZE_REF_X,nResizeRefX));
+ aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_RESIZE_REF_Y,nResizeRefY));
+
+ Point aRotateAxe(aRef1);
+
+ if(GetSdrPageView())
+ {
+ GetSdrPageView()->LogicToPagePos(aRotateAxe);
+ }
+
+ // Drehung
+ long nRotateRefX=aRect.Center().X();
+ long nRotateRefY=aRect.Center().Y();
+ if (eDragMode==SDRDRAG_ROTATE) {
+ nRotateRefX=aRotateAxe.X();
+ nRotateRefY=aRotateAxe.Y();
+ }
+ aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_ANGLE,GetMarkedObjRotate()));
+ aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_ROT_X,nRotateRefX));
+ aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_ROT_Y,nRotateRefY));
+
+ // Shear
+ long nShearRefX=aRect.Left();
+ long nShearRefY=aRect.Bottom();
+ if (eDragMode==SDRDRAG_ROTATE) { // Drehachse auch als Referenz fuer Shear
+ nShearRefX=aRotateAxe.X();
+ nShearRefY=aRotateAxe.Y();
+ }
+ aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_SHEAR,GetMarkedObjShear()));
+ aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_SHEAR_X,nShearRefX));
+ aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_SHEAR_Y,nShearRefY));
+
+ // Pruefen der einzelnen Objekte, ob Objekte geschuetzt sind
+ const SdrMarkList& rMarkList=GetMarkedObjectList();
+ sal_uIntPtr nMarkCount=rMarkList.GetMarkCount();
+ SdrObject* pObj=rMarkList.GetMark(0)->GetMarkedSdrObj();
+ sal_Bool bPosProt=pObj->IsMoveProtect();
+ sal_Bool bSizProt=pObj->IsResizeProtect();
+ sal_Bool bPosProtDontCare=sal_False;
+ sal_Bool bSizProtDontCare=sal_False;
+ for (sal_uIntPtr i=1; i<nMarkCount && (!bPosProtDontCare || !bSizProtDontCare); i++) {
+ pObj=rMarkList.GetMark(i)->GetMarkedSdrObj();
+ if (bPosProt!=pObj->IsMoveProtect()) bPosProtDontCare=sal_True;
+ if (bSizProt!=pObj->IsResizeProtect()) bSizProtDontCare=sal_True;
+ }
+
+ // InvalidateItem setzt das Item auf DONT_CARE
+ if (bPosProtDontCare) {
+ aRetSet.InvalidateItem(SID_ATTR_TRANSFORM_PROTECT_POS);
+ } else {
+ aRetSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_PROTECT_POS,bPosProt));
+ }
+ if (bSizProtDontCare) {
+ aRetSet.InvalidateItem(SID_ATTR_TRANSFORM_PROTECT_SIZE);
+ } else {
+ aRetSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_PROTECT_SIZE,bSizProt));
+ }
+
+ SfxItemState eState=aMarkAttr.GetItemState(SDRATTR_TEXT_AUTOGROWWIDTH);
+ sal_Bool bAutoGrow=((SdrTextAutoGrowWidthItem&)(aMarkAttr.Get(SDRATTR_TEXT_AUTOGROWWIDTH))).GetValue();
+ if (eState==SFX_ITEM_DONTCARE) {
+ aRetSet.InvalidateItem(SID_ATTR_TRANSFORM_AUTOWIDTH);
+ } else if (eState==SFX_ITEM_SET) {
+ aRetSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_AUTOWIDTH,bAutoGrow));
+ }
+
+ eState=aMarkAttr.GetItemState(SDRATTR_TEXT_AUTOGROWHEIGHT);
+ bAutoGrow=((SdrTextAutoGrowHeightItem&)(aMarkAttr.Get(SDRATTR_TEXT_AUTOGROWHEIGHT))).GetValue();
+ if (eState==SFX_ITEM_DONTCARE) {
+ aRetSet.InvalidateItem(SID_ATTR_TRANSFORM_AUTOHEIGHT);
+ } else if (eState==SFX_ITEM_SET) {
+ aRetSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_AUTOHEIGHT,bAutoGrow));
+ }
+
+ eState=aMarkAttr.GetItemState(SDRATTR_ECKENRADIUS);
+ long nRadius=((SdrEckenradiusItem&)(aMarkAttr.Get(SDRATTR_ECKENRADIUS))).GetValue();
+ if (eState==SFX_ITEM_DONTCARE) {
+ aRetSet.InvalidateItem(SDRATTR_ECKENRADIUS);
+ } else if (eState==SFX_ITEM_SET) {
+ aRetSet.Put(SdrEckenradiusItem(nRadius));
+ }
+
+ }
+ return aRetSet;
+}
+
+Point ImpGetPoint(Rectangle aRect, RECT_POINT eRP)
+{
+ switch(eRP) {
+ case RP_LT: return aRect.TopLeft();
+ case RP_MT: return aRect.TopCenter();
+ case RP_RT: return aRect.TopRight();
+ case RP_LM: return aRect.LeftCenter();
+ case RP_MM: return aRect.Center();
+ case RP_RM: return aRect.RightCenter();
+ case RP_LB: return aRect.BottomLeft();
+ case RP_MB: return aRect.BottomCenter();
+ case RP_RB: return aRect.BottomRight();
+ }
+ return Point(); // Sollte nicht vorkommen !
+}
+
+void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr)
+{
+ Rectangle aRect(GetMarkedObjRect());
+
+ if(GetSdrPageView())
+ {
+ GetSdrPageView()->LogicToPagePos(aRect);
+ }
+
+ long nOldRotateAngle=GetMarkedObjRotate();
+ long nOldShearAngle=GetMarkedObjShear();
+ const SdrMarkList& rMarkList=GetMarkedObjectList();
+ sal_uIntPtr nMarkCount=rMarkList.GetMarkCount();
+ SdrObject* pObj=NULL;
+
+ RECT_POINT eSizePoint=RP_MM;
+ long nPosDX=0;
+ long nPosDY=0;
+ long nSizX=0;
+ long nSizY=0;
+ long nRotateAngle=0;
+
+ // #86909#
+ sal_Bool bModeIsRotate(eDragMode == SDRDRAG_ROTATE);
+ long nRotateX(0);
+ long nRotateY(0);
+ long nOldRotateX(0);
+ long nOldRotateY(0);
+ if(bModeIsRotate)
+ {
+ Point aRotateAxe(aRef1);
+
+ if(GetSdrPageView())
+ {
+ GetSdrPageView()->LogicToPagePos(aRotateAxe);
+ }
+
+ nRotateX = nOldRotateX = aRotateAxe.X();
+ nRotateY = nOldRotateY = aRotateAxe.Y();
+ }
+
+ long nNewShearAngle=0;
+ long nShearAngle=0;
+ long nShearX=0;
+ long nShearY=0;
+ sal_Bool bShearVert=sal_False;
+
+ sal_Bool bChgPos=sal_False;
+ sal_Bool bChgSiz=sal_False;
+ sal_Bool bChgHgt=sal_False;
+ sal_Bool bRotate=sal_False;
+ sal_Bool bShear =sal_False;
+
+ sal_Bool bSetAttr=sal_False;
+ SfxItemSet aSetAttr(pMod->GetItemPool());
+
+ const SfxPoolItem* pPoolItem=NULL;
+
+ // Position
+ if (SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_POS_X,sal_True,&pPoolItem)) {
+ nPosDX=((const SfxInt32Item*)pPoolItem)->GetValue()-aRect.Left();
+ bChgPos=sal_True;
+ }
+ if (SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_POS_Y,sal_True,&pPoolItem)){
+ nPosDY=((const SfxInt32Item*)pPoolItem)->GetValue()-aRect.Top();
+ bChgPos=sal_True;
+ }
+ // Groesse
+ if (SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_WIDTH,sal_True,&pPoolItem)) {
+ nSizX=((const SfxUInt32Item*)pPoolItem)->GetValue();
+ bChgSiz=sal_True;
+ }
+ if (SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_HEIGHT,sal_True,&pPoolItem)) {
+ nSizY=((const SfxUInt32Item*)pPoolItem)->GetValue();
+ bChgSiz=sal_True;
+ bChgHgt=sal_True;
+ }
+ if (bChgSiz) {
+ eSizePoint=(RECT_POINT)((const SfxAllEnumItem&)rAttr.Get(SID_ATTR_TRANSFORM_SIZE_POINT)).GetValue();
+ }
+
+ // Rotation
+ if (SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_ANGLE,sal_True,&pPoolItem)) {
+ nRotateAngle=((const SfxInt32Item*)pPoolItem)->GetValue()-nOldRotateAngle;
+ bRotate = (nRotateAngle != 0);
+ }
+
+ // #86909# pos rot point x
+ if(bRotate || SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_ROT_X, sal_True ,&pPoolItem))
+ nRotateX = ((const SfxInt32Item&)rAttr.Get(SID_ATTR_TRANSFORM_ROT_X)).GetValue();
+
+ // #86909# pos rot point y
+ if(bRotate || SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_ROT_Y, sal_True ,&pPoolItem))
+ nRotateY = ((const SfxInt32Item&)rAttr.Get(SID_ATTR_TRANSFORM_ROT_Y)).GetValue();
+
+ // Shear
+ if (SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_SHEAR,sal_True,&pPoolItem)) {
+ nNewShearAngle=((const SfxInt32Item*)pPoolItem)->GetValue();
+ if (nNewShearAngle>SDRMAXSHEAR) nNewShearAngle=SDRMAXSHEAR;
+ if (nNewShearAngle<-SDRMAXSHEAR) nNewShearAngle=-SDRMAXSHEAR;
+ if (nNewShearAngle!=nOldShearAngle) {
+ bShearVert=((const SfxBoolItem&)rAttr.Get(SID_ATTR_TRANSFORM_SHEAR_VERTICAL)).GetValue();
+ if (bShearVert) {
+ nShearAngle=nNewShearAngle;
+ } else {
+ if (nNewShearAngle!=0 && nOldShearAngle!=0) {
+ // Bugfix #25714#.
+ double nOld=tan((double)nOldShearAngle*nPi180);
+ double nNew=tan((double)nNewShearAngle*nPi180);
+ nNew-=nOld;
+ nNew=atan(nNew)/nPi180;
+ nShearAngle=Round(nNew);
+ } else {
+ nShearAngle=nNewShearAngle-nOldShearAngle;
+ }
+ }
+ bShear=nShearAngle!=0;
+ if (bShear) {
+ nShearX=((const SfxInt32Item&)rAttr.Get(SID_ATTR_TRANSFORM_SHEAR_X)).GetValue();
+ nShearY=((const SfxInt32Item&)rAttr.Get(SID_ATTR_TRANSFORM_SHEAR_Y)).GetValue();
+ }
+ }
+ }
+
+ // AutoGrow
+ if (SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_AUTOWIDTH,sal_True,&pPoolItem)) {
+ sal_Bool bAutoGrow=((const SfxBoolItem*)pPoolItem)->GetValue();
+ aSetAttr.Put(SdrTextAutoGrowWidthItem(bAutoGrow));
+ bSetAttr=sal_True;
+ }
+
+ if (SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_AUTOHEIGHT,sal_True,&pPoolItem)) {
+ sal_Bool bAutoGrow=((const SfxBoolItem*)pPoolItem)->GetValue();
+ aSetAttr.Put(SdrTextAutoGrowHeightItem(bAutoGrow));
+ bSetAttr=sal_True;
+ }
+
+ // Eckenradius
+ if (bEdgeRadiusAllowed && SFX_ITEM_SET==rAttr.GetItemState(SDRATTR_ECKENRADIUS,sal_True,&pPoolItem)) {
+ long nRadius=((SdrEckenradiusItem*)pPoolItem)->GetValue();
+ aSetAttr.Put(SdrEckenradiusItem(nRadius));
+ bSetAttr=sal_True;
+ }
+
+ ForcePossibilities();
+
+ BegUndo(ImpGetResStr(STR_EditTransform),GetDescriptionOfMarkedObjects());
+
+ if (bSetAttr) {
+ SetAttrToMarked(aSetAttr,sal_False);
+ }
+
+ // Groesse und Hoehe aendern
+ if (bChgSiz && (bResizeFreeAllowed || bResizePropAllowed)) {
+ Fraction aWdt(nSizX,aRect.Right()-aRect.Left());
+ Fraction aHgt(nSizY,aRect.Bottom()-aRect.Top());
+ Point aRef(ImpGetPoint(aRect,eSizePoint));
+
+ if(GetSdrPageView())
+ {
+ GetSdrPageView()->PagePosToLogic(aRef);
+ }
+
+ ResizeMarkedObj(aRef,aWdt,aHgt);
+ }
+
+ // Rotieren
+ if (bRotate && (bRotateFreeAllowed || bRotate90Allowed)) {
+ Point aRef(nRotateX,nRotateY);
+
+ if(GetSdrPageView())
+ {
+ GetSdrPageView()->PagePosToLogic(aRef);
+ }
+
+ RotateMarkedObj(aRef,nRotateAngle);
+ }
+
+ // #86909# set rotation point position
+ if(bModeIsRotate && (nRotateX != nOldRotateX || nRotateY != nOldRotateY))
+ {
+ Point aNewRef1(nRotateX, nRotateY);
+
+ if(GetSdrPageView())
+ {
+ GetSdrPageView()->PagePosToLogic(aNewRef1);
+ }
+
+ SetRef1(aNewRef1);
+ }
+
+ // Shear
+ if (bShear && bShearAllowed) {
+ Point aRef(nShearX,nShearY);
+
+ if(GetSdrPageView())
+ {
+ GetSdrPageView()->PagePosToLogic(aRef);
+ }
+
+ ShearMarkedObj(aRef,nShearAngle,bShearVert);
+
+ // #i74358#
+ // ShearMarkedObj creates a linear combination of the existing transformation and
+ // the new shear to apply. If the object is already transformed (e.g. rotated) the
+ // linear combination will not decompose to the same start values again, but to a
+ // new combination. Thus it makes no sense to check if the wanted shear is reached
+ // or not. Taking out.
+#if 0
+ long nTempAngle=GetMarkedObjShear();
+ if (nTempAngle!=0 && nTempAngle!=nNewShearAngle && !bShearVert) {
+ // noch eine 2. Iteration zur Kompensation der Rundungsfehler
+ double nOld=tan((double)nTempAngle*nPi180);
+ double nNew=tan((double)nNewShearAngle*nPi180);
+ nNew-=nOld;
+ nNew=atan(nNew)/nPi180;
+ nTempAngle=Round(nNew);
+ if (nTempAngle!=0) {
+ ShearMarkedObj(aRef,nTempAngle,bShearVert);
+ }
+ }
+#endif
+ }
+
+ // Position aendern
+ if (bChgPos && bMoveAllowed) {
+ MoveMarkedObj(Size(nPosDX,nPosDY));
+ }
+
+ // protect position
+ if(SFX_ITEM_SET == rAttr.GetItemState(SID_ATTR_TRANSFORM_PROTECT_POS, sal_True, &pPoolItem))
+ {
+ const sal_Bool bProtPos(((const SfxBoolItem*)pPoolItem)->GetValue());
+ bool bChanged(false);
+
+ for(sal_uInt32 i(0); i < nMarkCount; i++)
+ {
+ pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
+
+ if(pObj->IsMoveProtect() != bProtPos)
+ {
+ bChanged = true;
+ pObj->SetMoveProtect(bProtPos);
+
+ if(bProtPos)
+ {
+ pObj->SetResizeProtect(true);
+ }
+ }
+ }
+
+ if(bChanged)
+ {
+ bMoveProtect = bProtPos;
+
+ if(bProtPos)
+ {
+ bResizeProtect = true;
+ }
+
+ // #i77187# there is no simple method to get the toolbars updated
+ // in the application. The App is listening to selection change and i
+ // will use it here (even if not true). It's acceptable since changing
+ // this model data is pretty rare and only possible using the F4 dialog
+ MarkListHasChanged();
+ }
+ }
+
+ if(!bMoveProtect)
+ {
+ // protect size
+ if(SFX_ITEM_SET == rAttr.GetItemState(SID_ATTR_TRANSFORM_PROTECT_SIZE, sal_True, &pPoolItem))
+ {
+ const sal_Bool bProtSize(((const SfxBoolItem*)pPoolItem)->GetValue());
+ bool bChanged(false);
+
+ for(sal_uInt32 i(0); i < nMarkCount; i++)
+ {
+ pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
+
+ if(pObj->IsResizeProtect() != bProtSize)
+ {
+ bChanged = true;
+ pObj->SetResizeProtect(bProtSize);
+ }
+ }
+
+ if(bChanged)
+ {
+ bResizeProtect = bProtSize;
+
+ // #i77187# see above
+ MarkListHasChanged();
+ }
+ }
+ }
+
+ EndUndo();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_Bool SdrEditView::IsAlignPossible() const
+{ // Mindestens 2 markierte Objekte, davon mind. 1 beweglich
+ ForcePossibilities();
+ sal_uIntPtr nAnz=GetMarkedObjectCount();
+ if (nAnz==0) return sal_False; // Nix markiert!
+ if (nAnz==1) return bMoveAllowed; // einzelnes Obj an der Seite ausrichten
+ return bOneOrMoreMovable; // ansonsten ist MarkCount>=2
+}
+
+void SdrEditView::AlignMarkedObjects(SdrHorAlign eHor, SdrVertAlign eVert, sal_Bool bBoundRects)
+{
+ if (eHor==SDRHALIGN_NONE && eVert==SDRVALIGN_NONE)
+ return;
+
+ SortMarkedObjects();
+ if (GetMarkedObjectCount()<1)
+ return;
+
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ {
+ XubString aStr(GetDescriptionOfMarkedObjects());
+ if (eHor==SDRHALIGN_NONE)
+ {
+ switch (eVert)
+ {
+ case SDRVALIGN_TOP : ImpTakeDescriptionStr(STR_EditAlignVTop ,aStr); break;
+ case SDRVALIGN_BOTTOM: ImpTakeDescriptionStr(STR_EditAlignVBottom,aStr); break;
+ case SDRVALIGN_CENTER: ImpTakeDescriptionStr(STR_EditAlignVCenter,aStr); break;
+ default: break;
+ }
+ }
+ else if (eVert==SDRVALIGN_NONE)
+ {
+ switch (eHor)
+ {
+ case SDRHALIGN_LEFT : ImpTakeDescriptionStr(STR_EditAlignHLeft ,aStr); break;
+ case SDRHALIGN_RIGHT : ImpTakeDescriptionStr(STR_EditAlignHRight ,aStr); break;
+ case SDRHALIGN_CENTER: ImpTakeDescriptionStr(STR_EditAlignHCenter,aStr); break;
+ default: break;
+ }
+ }
+ else if (eHor==SDRHALIGN_CENTER && eVert==SDRVALIGN_CENTER)
+ {
+ ImpTakeDescriptionStr(STR_EditAlignCenter,aStr);
+ }
+ else
+ {
+ ImpTakeDescriptionStr(STR_EditAlign,aStr);
+ }
+ BegUndo(aStr);
+ }
+
+ Rectangle aBound;
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ sal_uIntPtr nm;
+ sal_Bool bHasFixed=sal_False;
+ for (nm=0; nm<nMarkAnz; nm++)
+ {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ SdrObjTransformInfoRec aInfo;
+ pObj->TakeObjInfo(aInfo);
+ if (!aInfo.bMoveAllowed || pObj->IsMoveProtect())
+ {
+ Rectangle aObjRect(bBoundRects?pObj->GetCurrentBoundRect():pObj->GetSnapRect());
+ aBound.Union(aObjRect);
+ bHasFixed=sal_True;
+ }
+ }
+ if (!bHasFixed)
+ {
+ if (nMarkAnz==1)
+ { // einzelnes Obj an der Seite ausrichten
+ const SdrObject* pObj=GetMarkedObjectByIndex(0L);
+ const SdrPage* pPage=pObj->GetPage();
+ const SdrPageGridFrameList* pGFL=pPage->GetGridFrameList(GetSdrPageViewOfMarkedByIndex(0),&(pObj->GetSnapRect()));
+ const SdrPageGridFrame* pFrame=NULL;
+ if (pGFL!=NULL && pGFL->GetCount()!=0)
+ { // Writer
+ pFrame=&((*pGFL)[0]);
+ }
+
+ if (pFrame!=NULL)
+ { // Writer
+ aBound=pFrame->GetUserArea();
+ }
+ else
+ {
+ aBound=Rectangle(pPage->GetLftBorder(),pPage->GetUppBorder(),
+ pPage->GetWdt()-pPage->GetRgtBorder(),
+ pPage->GetHgt()-pPage->GetLwrBorder());
+ }
+ }
+ else
+ {
+ if (bBoundRects)
+ aBound=GetMarkedObjBoundRect();
+ else
+ aBound=GetMarkedObjRect();
+ }
+ }
+ Point aCenter(aBound.Center());
+ for (nm=0; nm<nMarkAnz; nm++)
+ {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ SdrObjTransformInfoRec aInfo;
+ pObj->TakeObjInfo(aInfo);
+ if (aInfo.bMoveAllowed && !pObj->IsMoveProtect())
+ {
+ // SdrPageView* pPV=pM->GetPageView();
+ long nXMov=0;
+ long nYMov=0;
+ Rectangle aObjRect(bBoundRects?pObj->GetCurrentBoundRect():pObj->GetSnapRect());
+ switch (eVert)
+ {
+ case SDRVALIGN_TOP : nYMov=aBound.Top() -aObjRect.Top() ; break;
+ case SDRVALIGN_BOTTOM: nYMov=aBound.Bottom()-aObjRect.Bottom() ; break;
+ case SDRVALIGN_CENTER: nYMov=aCenter.Y() -aObjRect.Center().Y(); break;
+ default: break;
+ }
+ switch (eHor)
+ {
+ case SDRHALIGN_LEFT : nXMov=aBound.Left() -aObjRect.Left() ; break;
+ case SDRHALIGN_RIGHT : nXMov=aBound.Right() -aObjRect.Right() ; break;
+ case SDRHALIGN_CENTER: nXMov=aCenter.X() -aObjRect.Center().X(); break;
+ default: break;
+ }
+ if (nXMov!=0 || nYMov!=0)
+ {
+ // #104104# SdrEdgeObj needs an extra SdrUndoGeoObj since the
+ // connections may need to be saved
+ if( bUndo )
+ {
+ if( dynamic_cast<SdrEdgeObj*>(pObj) )
+ {
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
+ }
+
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoMoveObject(*pObj,Size(nXMov,nYMov)));
+ }
+
+ pObj->Move(Size(nXMov,nYMov));
+ }
+ }
+ }
+
+ if( bUndo )
+ EndUndo();
+}
+
diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx
new file mode 100644
index 000000000000..7af96024cb5e
--- /dev/null
+++ b/svx/source/svdraw/svdedtv2.cxx
@@ -0,0 +1,2139 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svdedtv.hxx>
+#include <editeng/outliner.hxx>
+#include <svx/svdundo.hxx>
+#include <svx/svdogrp.hxx> // fuer's Gruppieren
+#include <svx/svdovirt.hxx> // fuer VirtualObject-Bundling (Writer)
+#include <svx/svdopath.hxx> // fuer CombineObjects
+#include <svx/svdpage.hxx>
+#include <svx/svdpagv.hxx>
+#include "svx/svditer.hxx"
+#include <svx/svdograf.hxx> // fuer Possibilities
+#include <svx/svdoole2.hxx> // und Mtf-Import
+#include "svx/svdstr.hrc" // Namen aus der Resource
+#include "svx/svdglob.hxx" // StringCache
+#include "svdfmtf.hxx"
+#include <svx/svdetc.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <vcl/msgbox.hxx>
+#include <editeng/outlobj.hxx>
+#include <editeng/eeitem.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+
+#include <svx/svxdlg.hxx> //CHINA001
+#include <svx/dialogs.hrc> //CHINA001
+
+// #i37011#
+#include <svx/svdoashp.hxx>
+#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@@ @@@@@ @@ @@@@@@ @@ @@ @@ @@@@@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@
+// @@@@ @@ @@ @@ @@ @@@@@ @@ @@@@ @@@@@@@
+// @@ @@ @@ @@ @@ @@@ @@ @@ @@@@@@@
+// @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@
+// @@@@@ @@@@@ @@ @@ @ @@ @@@@@ @@ @@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrEditView::ImpBundleVirtObjOfMarkList()
+{
+ // ... fehlende Implementation
+}
+
+SdrObject* SdrEditView::GetMaxToTopObj(SdrObject* /*pObj*/) const
+{
+ return NULL;
+}
+
+SdrObject* SdrEditView::GetMaxToBtmObj(SdrObject* /*pObj*/) const
+{
+ return NULL;
+}
+
+void SdrEditView::ObjOrderChanged(SdrObject* /*pObj*/, sal_uIntPtr /*nOldPos*/, sal_uIntPtr /*nNewPos*/)
+{
+}
+
+void SdrEditView::MovMarkedToTop()
+{
+ sal_uIntPtr nAnz=GetMarkedObjectCount();
+ if (nAnz!=0)
+ {
+ const bool bUndo = IsUndoEnabled();
+
+ if( bUndo )
+ BegUndo(ImpGetResStr(STR_EditMovToTop),GetDescriptionOfMarkedObjects(),SDRREPFUNC_OBJ_MOVTOTOP);
+
+ SortMarkedObjects();
+ sal_uIntPtr nm;
+ for (nm=0; nm<nAnz; nm++)
+ { // Ordnums muessen alle stimmen!
+ GetMarkedObjectByIndex(nm)->GetOrdNum();
+ }
+ sal_Bool bChg=sal_False;
+ SdrObjList* pOL0=NULL;
+ sal_uIntPtr nNewPos=0;
+ for (nm=nAnz; nm>0;)
+ {
+ nm--;
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ SdrObjList* pOL=pObj->GetObjList();
+ if (pOL!=pOL0)
+ {
+ nNewPos=sal_uIntPtr(pOL->GetObjCount()-1);
+ pOL0=pOL;
+ }
+ sal_uIntPtr nNowPos=pObj->GetOrdNumDirect();
+ const Rectangle& rBR=pObj->GetCurrentBoundRect();
+ sal_uIntPtr nCmpPos=nNowPos+1;
+ SdrObject* pMaxObj=GetMaxToTopObj(pObj);
+ if (pMaxObj!=NULL)
+ {
+ sal_uIntPtr nMaxPos=pMaxObj->GetOrdNum();
+ if (nMaxPos!=0)
+ nMaxPos--;
+ if (nNewPos>nMaxPos)
+ nNewPos=nMaxPos; // diesen nicht ueberholen.
+ if (nNewPos<nNowPos)
+ nNewPos=nNowPos; // aber dabei auch nicht in die falsche Richtung schieben
+ }
+ sal_Bool bEnd=sal_False;
+ while (nCmpPos<nNewPos && !bEnd)
+ {
+ SdrObject* pCmpObj=pOL->GetObj(nCmpPos);
+ if (pCmpObj==NULL)
+ {
+ DBG_ERROR("MovMarkedToTop(): Vergleichsobjekt nicht gefunden");
+ bEnd=sal_True;
+ }
+ else if (pCmpObj==pMaxObj)
+ {
+ nNewPos=nCmpPos;
+ nNewPos--;
+ bEnd=sal_True;
+ }
+ else if (rBR.IsOver(pCmpObj->GetCurrentBoundRect()))
+ {
+ nNewPos=nCmpPos;
+ bEnd=sal_True;
+ }
+ else
+ {
+ nCmpPos++;
+ }
+ }
+ if (nNowPos!=nNewPos)
+ {
+ bChg=sal_True;
+ pOL->SetObjectOrdNum(nNowPos,nNewPos);
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj,nNowPos,nNewPos));
+ ObjOrderChanged(pObj,nNowPos,nNewPos);
+ }
+ nNewPos--;
+ }
+
+ if( bUndo )
+ EndUndo();
+
+ if (bChg)
+ MarkListHasChanged();
+ }
+}
+
+void SdrEditView::MovMarkedToBtm()
+{
+ sal_uIntPtr nAnz=GetMarkedObjectCount();
+ if (nAnz!=0)
+ {
+ const bool bUndo = IsUndoEnabled();
+
+ if( bUndo )
+ BegUndo(ImpGetResStr(STR_EditMovToBtm),GetDescriptionOfMarkedObjects(),SDRREPFUNC_OBJ_MOVTOBTM);
+
+ SortMarkedObjects();
+ sal_uIntPtr nm;
+ for (nm=0; nm<nAnz; nm++)
+ { // Ordnums muessen alle stimmen!
+ GetMarkedObjectByIndex(nm)->GetOrdNum();
+ }
+
+ sal_Bool bChg=sal_False;
+ SdrObjList* pOL0=NULL;
+ sal_uIntPtr nNewPos=0;
+ for (nm=0; nm<nAnz; nm++)
+ {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ SdrObjList* pOL=pObj->GetObjList();
+ if (pOL!=pOL0)
+ {
+ nNewPos=0;
+ pOL0=pOL;
+ }
+ sal_uIntPtr nNowPos=pObj->GetOrdNumDirect();
+ const Rectangle& rBR=pObj->GetCurrentBoundRect();
+ sal_uIntPtr nCmpPos=nNowPos; if (nCmpPos>0) nCmpPos--;
+ SdrObject* pMaxObj=GetMaxToBtmObj(pObj);
+ if (pMaxObj!=NULL)
+ {
+ sal_uIntPtr nMinPos=pMaxObj->GetOrdNum()+1;
+ if (nNewPos<nMinPos)
+ nNewPos=nMinPos; // diesen nicht ueberholen.
+ if (nNewPos>nNowPos)
+ nNewPos=nNowPos; // aber dabei auch nicht in die falsche Richtung schieben
+ }
+ sal_Bool bEnd=sal_False;
+ // nNewPos ist an dieser Stelle noch die maximale Position,
+ // an der das Obj hinruecken darf, ohne seinen Vorgaenger
+ // (Mehrfachselektion) zu ueberholen.
+ while (nCmpPos>nNewPos && !bEnd)
+ {
+ SdrObject* pCmpObj=pOL->GetObj(nCmpPos);
+ if (pCmpObj==NULL)
+ {
+ DBG_ERROR("MovMarkedToBtm(): Vergleichsobjekt nicht gefunden");
+ bEnd=sal_True;
+ }
+ else if (pCmpObj==pMaxObj)
+ {
+ nNewPos=nCmpPos;
+ nNewPos++;
+ bEnd=sal_True;
+ }
+ else if (rBR.IsOver(pCmpObj->GetCurrentBoundRect()))
+ {
+ nNewPos=nCmpPos;
+ bEnd=sal_True;
+ }
+ else
+ {
+ nCmpPos--;
+ }
+ }
+ if (nNowPos!=nNewPos)
+ {
+ bChg=sal_True;
+ pOL->SetObjectOrdNum(nNowPos,nNewPos);
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj,nNowPos,nNewPos));
+ ObjOrderChanged(pObj,nNowPos,nNewPos);
+ }
+ nNewPos++;
+ }
+
+ if(bUndo)
+ EndUndo();
+
+ if(bChg)
+ MarkListHasChanged();
+ }
+}
+
+void SdrEditView::PutMarkedToTop()
+{
+ PutMarkedInFrontOfObj(NULL);
+}
+
+void SdrEditView::PutMarkedInFrontOfObj(const SdrObject* pRefObj)
+{
+ sal_uIntPtr nAnz=GetMarkedObjectCount();
+ if (nAnz!=0)
+ {
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ BegUndo(ImpGetResStr(STR_EditPutToTop),GetDescriptionOfMarkedObjects(),SDRREPFUNC_OBJ_PUTTOTOP);
+
+ SortMarkedObjects();
+
+ if (pRefObj!=NULL)
+ {
+ // Damit "Vor das Objekt" auch funktioniert wenn die
+ // markierten Objekte bereits vor dem Objekt stehen
+ sal_uIntPtr nRefMark=TryToFindMarkedObject(pRefObj);
+ SdrMark aRefMark;
+ if (nRefMark!=CONTAINER_ENTRY_NOTFOUND)
+ {
+ aRefMark=*GetSdrMarkByIndex(nRefMark);
+ GetMarkedObjectListWriteAccess().DeleteMark(nRefMark);
+ }
+ PutMarkedToBtm();
+ if (nRefMark!=CONTAINER_ENTRY_NOTFOUND)
+ {
+ GetMarkedObjectListWriteAccess().InsertEntry(aRefMark);
+ SortMarkedObjects();
+ }
+ }
+ sal_uIntPtr nm;
+ for (nm=0; nm<nAnz; nm++)
+ { // Ordnums muessen alle stimmen!
+ GetMarkedObjectByIndex(nm)->GetOrdNum();
+ }
+ sal_Bool bChg=sal_False;
+ SdrObjList* pOL0=NULL;
+ sal_uIntPtr nNewPos=0;
+ for (nm=nAnz; nm>0;)
+ {
+ nm--;
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ if (pObj!=pRefObj)
+ {
+ SdrObjList* pOL=pObj->GetObjList();
+ if (pOL!=pOL0)
+ {
+ nNewPos=sal_uIntPtr(pOL->GetObjCount()-1);
+ pOL0=pOL;
+ }
+ sal_uIntPtr nNowPos=pObj->GetOrdNumDirect();
+ SdrObject* pMaxObj=GetMaxToTopObj(pObj);
+ if (pMaxObj!=NULL)
+ {
+ sal_uIntPtr nMaxOrd=pMaxObj->GetOrdNum(); // geht leider nicht anders
+ if (nMaxOrd>0)
+ nMaxOrd--;
+ if (nNewPos>nMaxOrd)
+ nNewPos=nMaxOrd; // nicht ueberholen.
+ if (nNewPos<nNowPos)
+ nNewPos=nNowPos; // aber dabei auch nicht in die falsche Richtung schieben
+ }
+ if (pRefObj!=NULL)
+ {
+ if (pRefObj->GetObjList()==pObj->GetObjList())
+ {
+ sal_uIntPtr nMaxOrd=pRefObj->GetOrdNum(); // geht leider nicht anders
+ if (nNewPos>nMaxOrd)
+ nNewPos=nMaxOrd; // nicht ueberholen.
+ if (nNewPos<nNowPos)
+ nNewPos=nNowPos; // aber dabei auch nicht in die falsche Richtung schieben
+ }
+ else
+ {
+ nNewPos=nNowPos; // andere PageView, also nicht veraendern
+ }
+ }
+ if (nNowPos!=nNewPos)
+ {
+ bChg=sal_True;
+ pOL->SetObjectOrdNum(nNowPos,nNewPos);
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj,nNowPos,nNewPos));
+ ObjOrderChanged(pObj,nNowPos,nNewPos);
+ }
+ nNewPos--;
+ } // if (pObj!=pRefObj)
+ } // for-Schleife ueber alle Markierten Objekte
+
+ if( bUndo )
+ EndUndo();
+
+ if(bChg)
+ MarkListHasChanged();
+ }
+}
+
+void SdrEditView::PutMarkedToBtm()
+{
+ PutMarkedBehindObj(NULL);
+}
+
+void SdrEditView::PutMarkedBehindObj(const SdrObject* pRefObj)
+{
+ sal_uIntPtr nAnz=GetMarkedObjectCount();
+ if (nAnz!=0)
+ {
+ const bool bUndo = IsUndoEnabled();
+
+ if( bUndo )
+ BegUndo(ImpGetResStr(STR_EditPutToBtm),GetDescriptionOfMarkedObjects(),SDRREPFUNC_OBJ_PUTTOBTM);
+
+ SortMarkedObjects();
+ if (pRefObj!=NULL)
+ {
+ // Damit "Hinter das Objekt" auch funktioniert wenn die
+ // markierten Objekte bereits hinter dem Objekt stehen
+ sal_uIntPtr nRefMark=TryToFindMarkedObject(pRefObj);
+ SdrMark aRefMark;
+ if (nRefMark!=CONTAINER_ENTRY_NOTFOUND)
+ {
+ aRefMark=*GetSdrMarkByIndex(nRefMark);
+ GetMarkedObjectListWriteAccess().DeleteMark(nRefMark);
+ }
+ PutMarkedToTop();
+ if (nRefMark!=CONTAINER_ENTRY_NOTFOUND)
+ {
+ GetMarkedObjectListWriteAccess().InsertEntry(aRefMark);
+ SortMarkedObjects();
+ }
+ }
+ sal_uIntPtr nm;
+ for (nm=0; nm<nAnz; nm++) { // Ordnums muessen alle stimmen!
+ GetMarkedObjectByIndex(nm)->GetOrdNum();
+ }
+ sal_Bool bChg=sal_False;
+ SdrObjList* pOL0=NULL;
+ sal_uIntPtr nNewPos=0;
+ for (nm=0; nm<nAnz; nm++) {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ if (pObj!=pRefObj) {
+ SdrObjList* pOL=pObj->GetObjList();
+ if (pOL!=pOL0) {
+ nNewPos=0;
+ pOL0=pOL;
+ }
+ sal_uIntPtr nNowPos=pObj->GetOrdNumDirect();
+ SdrObject* pMinObj=GetMaxToBtmObj(pObj);
+ if (pMinObj!=NULL) {
+ sal_uIntPtr nMinOrd=pMinObj->GetOrdNum()+1; // geht leider nicht anders
+ if (nNewPos<nMinOrd) nNewPos=nMinOrd; // nicht ueberholen.
+ if (nNewPos>nNowPos) nNewPos=nNowPos; // aber dabei auch nicht in die falsche Richtung schieben
+ }
+ if (pRefObj!=NULL) {
+ if (pRefObj->GetObjList()==pObj->GetObjList()) {
+ sal_uIntPtr nMinOrd=pRefObj->GetOrdNum(); // geht leider nicht anders
+ if (nNewPos<nMinOrd) nNewPos=nMinOrd; // nicht ueberholen.
+ if (nNewPos>nNowPos) nNewPos=nNowPos; // aber dabei auch nicht in die falsche Richtung schieben
+ } else {
+ nNewPos=nNowPos; // andere PageView, also nicht veraendern
+ }
+ }
+ if (nNowPos!=nNewPos) {
+ bChg=sal_True;
+ pOL->SetObjectOrdNum(nNowPos,nNewPos);
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj,nNowPos,nNewPos));
+ ObjOrderChanged(pObj,nNowPos,nNewPos);
+ }
+ nNewPos++;
+ } // if (pObj!=pRefObj)
+ } // for-Schleife ueber alle markierten Objekte
+
+ if(bUndo)
+ EndUndo();
+
+ if(bChg)
+ MarkListHasChanged();
+ }
+}
+
+void SdrEditView::ReverseOrderOfMarked()
+{
+ SortMarkedObjects();
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ if (nMarkAnz>0)
+ {
+ //sal_Bool bNeedBundle=sal_False;
+ sal_Bool bChg=sal_False;
+
+ bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ BegUndo(ImpGetResStr(STR_EditRevOrder),GetDescriptionOfMarkedObjects(),SDRREPFUNC_OBJ_REVORDER);
+
+ sal_uIntPtr a=0;
+ do {
+ // Markierung ueber mehrere PageViews berueksichtigen
+ sal_uIntPtr b=a+1;
+ while (b<nMarkAnz && GetSdrPageViewOfMarkedByIndex(b) == GetSdrPageViewOfMarkedByIndex(a)) b++;
+ b--;
+ SdrObjList* pOL=GetSdrPageViewOfMarkedByIndex(a)->GetObjList();
+ sal_uIntPtr c=b;
+ if (a<c) { // Sicherstellen, dass die OrdNums nicht Dirty sind
+ GetMarkedObjectByIndex(a)->GetOrdNum();
+ }
+ while (a<c) {
+ SdrObject* pObj1=GetMarkedObjectByIndex(a);
+ SdrObject* pObj2=GetMarkedObjectByIndex(c);
+ sal_uIntPtr nOrd1=pObj1->GetOrdNumDirect();
+ sal_uIntPtr nOrd2=pObj2->GetOrdNumDirect();
+ if( bUndo )
+ {
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj1,nOrd1,nOrd2));
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj2,nOrd2-1,nOrd1));
+ }
+ pOL->SetObjectOrdNum(nOrd1,nOrd2);
+ // Obj 2 ist um eine Position nach vorn gerutscht, deshalb nun nOrd2-1
+ pOL->SetObjectOrdNum(nOrd2-1,nOrd1);
+ // Verwendung von Replace statt SetOrdNum wg. Performance (Neuberechnung der Ordnums)
+ a++; c--;
+ bChg=sal_True;
+ }
+ a=b+1;
+ } while (a<nMarkAnz);
+
+ if(bUndo)
+ EndUndo();
+
+ if(bChg)
+ MarkListHasChanged();
+ }
+}
+
+void SdrEditView::ImpCheckToTopBtmPossible()
+{
+ sal_uIntPtr nAnz=GetMarkedObjectCount();
+ if (nAnz==0)
+ return;
+ if (nAnz==1)
+ { // Sonderbehandlung fuer Einzelmarkierung
+ SdrObject* pObj=GetMarkedObjectByIndex(0);
+ SdrObjList* pOL=pObj->GetObjList();
+ sal_uIntPtr nMax=pOL->GetObjCount();
+ sal_uIntPtr nMin=0;
+ sal_uIntPtr nObjNum=pObj->GetOrdNum();
+ SdrObject* pRestrict=GetMaxToTopObj(pObj);
+ if (pRestrict!=NULL) {
+ sal_uIntPtr nRestrict=pRestrict->GetOrdNum();
+ if (nRestrict<nMax) nMax=nRestrict;
+ }
+ pRestrict=GetMaxToBtmObj(pObj);
+ if (pRestrict!=NULL) {
+ sal_uIntPtr nRestrict=pRestrict->GetOrdNum();
+ if (nRestrict>nMin) nMin=nRestrict;
+ }
+ bToTopPossible=nObjNum<sal_uIntPtr(nMax-1);
+ bToBtmPossible=nObjNum>nMin;
+ } else { // Mehrfachselektion
+ sal_uIntPtr nm=0;
+ SdrObjList* pOL0=NULL;
+ long nPos0=-1;
+ while (!bToBtmPossible && nm<nAnz) { // 'nach hinten' checken
+ SdrObject* pObj=GetMarkedObjectByIndex(nm);
+ SdrObjList* pOL=pObj->GetObjList();
+ if (pOL!=pOL0) {
+ nPos0=-1;
+ pOL0=pOL;
+ }
+ sal_uIntPtr nPos=pObj->GetOrdNum();
+ bToBtmPossible=nPos>sal_uIntPtr(nPos0+1);
+ nPos0=long(nPos);
+ nm++;
+ }
+ nm=nAnz;
+ pOL0=NULL;
+ nPos0=0x7FFFFFFF;
+ while (!bToTopPossible && nm>0) { // 'nach vorn' checken
+ nm--;
+ SdrObject* pObj=GetMarkedObjectByIndex(nm);
+ SdrObjList* pOL=pObj->GetObjList();
+ if (pOL!=pOL0) {
+ nPos0=pOL->GetObjCount();
+ pOL0=pOL;
+ }
+ sal_uIntPtr nPos=pObj->GetOrdNum();
+ bToTopPossible=nPos+1<sal_uIntPtr(nPos0);
+ nPos0=nPos;
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@ @@@@ @@ @@ @@@@@ @@ @@ @@ @@@@@
+// @@ @@ @@ @@ @@@ @@@ @@ @@ @@ @@@ @@ @@
+// @@ @@ @@ @@@@@@@ @@ @@ @@ @@@@@@ @@
+// @@ @@ @@ @@@@@@@ @@@@@ @@ @@@@@@ @@@@
+// @@ @@ @@ @@ @ @@ @@ @@ @@ @@ @@@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@@@ @@@@ @@ @@ @@@@@ @@ @@ @@ @@@@@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrEditView::ImpCopyAttributes(const SdrObject* pSource, SdrObject* pDest) const
+{
+ if (pSource!=NULL) {
+ SdrObjList* pOL=pSource->GetSubList();
+ if (pOL!=NULL && !pSource->Is3DObj()) { // erstes Nichtgruppenobjekt aus der Gruppe holen
+ SdrObjListIter aIter(*pOL,IM_DEEPNOGROUPS);
+ pSource=aIter.Next();
+ }
+ }
+
+ if(pSource && pDest)
+ {
+ SfxItemSet aSet(pMod->GetItemPool(),
+ SDRATTR_START, SDRATTR_NOTPERSIST_FIRST-1,
+ SDRATTR_NOTPERSIST_LAST+1, SDRATTR_END,
+ EE_ITEMS_START, EE_ITEMS_END,
+ 0, 0); // #52757#, #52762#
+
+ aSet.Put(pSource->GetMergedItemSet());
+
+ pDest->ClearMergedItem();
+ pDest->SetMergedItemSet(aSet);
+
+ pDest->NbcSetLayer(pSource->GetLayer());
+ pDest->NbcSetStyleSheet(pSource->GetStyleSheet(), sal_True);
+ }
+}
+
+sal_Bool SdrEditView::ImpCanConvertForCombine1(const SdrObject* pObj) const
+{
+ // #69711 : new condition IsLine() to be able to combine simple Lines
+ sal_Bool bIsLine(sal_False);
+
+ const SdrPathObj* pPath = PTR_CAST(SdrPathObj,pObj);
+
+ if(pPath)
+ {
+ bIsLine = pPath->IsLine();
+ }
+
+ SdrObjTransformInfoRec aInfo;
+ pObj->TakeObjInfo(aInfo);
+
+ return (aInfo.bCanConvToPath || aInfo.bCanConvToPoly || bIsLine);
+}
+
+sal_Bool SdrEditView::ImpCanConvertForCombine(const SdrObject* pObj) const
+{
+ SdrObjList* pOL = pObj->GetSubList();
+
+ if(pOL && !pObj->Is3DObj())
+ {
+ SdrObjListIter aIter(*pOL, IM_DEEPNOGROUPS);
+
+ while(aIter.IsMore())
+ {
+ SdrObject* pObj1 = aIter.Next();
+
+ // Es muessen alle Member einer Gruppe konvertierbar sein
+ if(!ImpCanConvertForCombine1(pObj1))
+ {
+ return sal_False;
+ }
+ }
+ }
+ else
+ {
+ if(!ImpCanConvertForCombine1(pObj))
+ {
+ return sal_False;
+ }
+ }
+
+ return sal_True;
+}
+
+basegfx::B2DPolyPolygon SdrEditView::ImpGetPolyPolygon1(const SdrObject* pObj, sal_Bool bCombine) const
+{
+ basegfx::B2DPolyPolygon aRetval;
+ SdrPathObj* pPath = PTR_CAST(SdrPathObj, pObj);
+
+ if(bCombine && pPath && !pObj->GetOutlinerParaObject())
+ {
+ aRetval = pPath->GetPathPoly();
+ }
+ else
+ {
+ SdrObject* pConvObj = pObj->ConvertToPolyObj(bCombine, sal_False);
+
+ if(pConvObj)
+ {
+ SdrObjList* pOL = pConvObj->GetSubList();
+
+ if(pOL)
+ {
+ SdrObjListIter aIter(*pOL, IM_DEEPNOGROUPS);
+
+ while(aIter.IsMore())
+ {
+ SdrObject* pObj1 = aIter.Next();
+ pPath = PTR_CAST(SdrPathObj, pObj1);
+
+ if(pPath)
+ {
+ aRetval.append(pPath->GetPathPoly());
+ }
+ }
+ }
+ else
+ {
+ pPath = PTR_CAST(SdrPathObj, pConvObj);
+
+ if(pPath)
+ {
+ aRetval = pPath->GetPathPoly();
+ }
+ }
+
+ SdrObject::Free( pConvObj );
+ }
+ }
+
+ return aRetval;
+}
+
+basegfx::B2DPolyPolygon SdrEditView::ImpGetPolyPolygon(const SdrObject* pObj, sal_Bool bCombine) const
+{
+ SdrObjList* pOL = pObj->GetSubList();
+
+ if(pOL && !pObj->Is3DObj())
+ {
+ basegfx::B2DPolyPolygon aRetval;
+ SdrObjListIter aIter(*pOL, IM_DEEPNOGROUPS);
+
+ while(aIter.IsMore())
+ {
+ SdrObject* pObj1 = aIter.Next();
+ aRetval.append(ImpGetPolyPolygon1(pObj1, bCombine));
+ }
+
+ return aRetval;
+ }
+ else
+ {
+ return ImpGetPolyPolygon1(pObj, bCombine);
+ }
+}
+
+basegfx::B2DPolygon SdrEditView::ImpCombineToSinglePolygon(const basegfx::B2DPolyPolygon& rPolyPolygon) const
+{
+ const sal_uInt32 nPolyCount(rPolyPolygon.count());
+
+ if(0L == nPolyCount)
+ {
+ return basegfx::B2DPolygon();
+ }
+ else if(1L == nPolyCount)
+ {
+ return rPolyPolygon.getB2DPolygon(0L);
+ }
+ else
+ {
+ basegfx::B2DPolygon aRetval(rPolyPolygon.getB2DPolygon(0L));
+
+ for(sal_uInt32 a(1L); a < nPolyCount; a++)
+ {
+ basegfx::B2DPolygon aCandidate(rPolyPolygon.getB2DPolygon(a));
+
+ if(aRetval.count())
+ {
+ if(aCandidate.count())
+ {
+ const basegfx::B2DPoint aCA(aCandidate.getB2DPoint(0L));
+ const basegfx::B2DPoint aCB(aCandidate.getB2DPoint(aCandidate.count() - 1L));
+ const basegfx::B2DPoint aRA(aRetval.getB2DPoint(0L));
+ const basegfx::B2DPoint aRB(aRetval.getB2DPoint(aRetval.count() - 1L));
+
+ const double fRACA(basegfx::B2DVector(aCA - aRA).getLength());
+ const double fRACB(basegfx::B2DVector(aCB - aRA).getLength());
+ const double fRBCA(basegfx::B2DVector(aCA - aRB).getLength());
+ const double fRBCB(basegfx::B2DVector(aCB - aRB).getLength());
+
+ const double fSmallestRA(fRACA < fRACB ? fRACA : fRACB);
+ const double fSmallestRB(fRBCA < fRBCB ? fRBCA : fRBCB);
+
+ if(fSmallestRA < fSmallestRB)
+ {
+ // flip result
+ aRetval.flip();
+ }
+
+ const double fSmallestCA(fRACA < fRBCA ? fRACA : fRBCA);
+ const double fSmallestCB(fRACB < fRBCB ? fRACB : fRBCB);
+
+ if(fSmallestCB < fSmallestCA)
+ {
+ // flip candidate
+ aCandidate.flip();
+ }
+
+ // append candidate to retval
+ aRetval.append(aCandidate);
+ }
+ }
+ else
+ {
+ aRetval = aCandidate;
+ }
+ }
+
+ return aRetval;
+ }
+}
+
+// for distribution dialog function
+struct ImpDistributeEntry
+{
+ SdrObject* mpObj;
+ sal_Int32 mnPos;
+ sal_Int32 mnLength;
+};
+
+DECLARE_LIST(ImpDistributeEntryList, ImpDistributeEntry*)
+
+void SdrEditView::DistributeMarkedObjects()
+{
+ sal_uInt32 nMark(GetMarkedObjectCount());
+
+ if(nMark > 2)
+ {
+ SfxItemSet aNewAttr(pMod->GetItemPool());
+ //CHINA001 SvxDistributeDialog* pDlg = new SvxDistributeDialog(NULL, aNewAttr);
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ AbstractSvxDistributeDialog *pDlg = pFact->CreateSvxDistributeDialog(NULL, aNewAttr);
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+
+ sal_uInt16 nResult = pDlg->Execute();
+
+ if(nResult == RET_OK)
+ {
+ SvxDistributeHorizontal eHor = pDlg->GetDistributeHor();
+ SvxDistributeVertical eVer = pDlg->GetDistributeVer();
+ ImpDistributeEntryList aEntryList;
+ sal_uInt32 a, nInsPos, nFullLength;
+
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ BegUndo();
+
+ if(eHor != SvxDistributeHorizontalNone)
+ {
+ // build sorted entry list
+ nFullLength = 0L;
+
+ for(a=0;a<nMark;a++)
+ {
+ SdrMark* pMark = GetSdrMarkByIndex(a);
+ ImpDistributeEntry* pNew = new ImpDistributeEntry;
+
+ pNew->mpObj = pMark->GetMarkedSdrObj();
+ nInsPos = 0;
+
+ switch(eHor)
+ {
+ case SvxDistributeHorizontalLeft:
+ {
+ pNew->mnPos = pNew->mpObj->GetSnapRect().Left();
+ break;
+ }
+ case SvxDistributeHorizontalCenter:
+ {
+ pNew->mnPos = (pNew->mpObj->GetSnapRect().Right() + pNew->mpObj->GetSnapRect().Left()) / 2;
+ break;
+ }
+ case SvxDistributeHorizontalDistance:
+ {
+ pNew->mnLength = pNew->mpObj->GetSnapRect().GetWidth() + 1;
+ nFullLength += pNew->mnLength;
+ pNew->mnPos = (pNew->mpObj->GetSnapRect().Right() + pNew->mpObj->GetSnapRect().Left()) / 2;
+ break;
+ }
+ case SvxDistributeHorizontalRight:
+ {
+ pNew->mnPos = pNew->mpObj->GetSnapRect().Right();
+ break;
+ }
+ default: break;
+ }
+
+ while(nInsPos < aEntryList.Count() && aEntryList.GetObject(nInsPos)->mnPos < pNew->mnPos)
+ nInsPos++;
+
+ aEntryList.Insert(pNew, nInsPos);
+ }
+
+ if(eHor == SvxDistributeHorizontalDistance)
+ {
+ // calc room in-between
+ sal_Int32 nWidth = GetAllMarkedBoundRect().GetWidth() + 1;
+ double fStepWidth = ((double)nWidth - (double)nFullLength) / (double)(aEntryList.Count() - 1);
+ double fStepStart = (double)aEntryList.GetObject(0)->mnPos;
+ fStepStart += fStepWidth + (double)((aEntryList.GetObject(0)->mnLength + aEntryList.GetObject(1)->mnLength) / 2);
+
+ // move entries 1..n-1
+ for(a=1;a<aEntryList.Count()-1;a++)
+ {
+ ImpDistributeEntry* pCurr = aEntryList.GetObject(a);
+ ImpDistributeEntry* pNext = aEntryList.GetObject(a+1);
+ sal_Int32 nDelta = (sal_Int32)(fStepStart + 0.5) - pCurr->mnPos;
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pCurr->mpObj));
+ pCurr->mpObj->Move(Size(nDelta, 0));
+ fStepStart += fStepWidth + (double)((pCurr->mnLength + pNext->mnLength) / 2);
+ }
+ }
+ else
+ {
+ // calc distances
+ sal_Int32 nWidth = aEntryList.GetObject(aEntryList.Count() - 1)->mnPos - aEntryList.GetObject(0)->mnPos;
+ double fStepWidth = (double)nWidth / (double)(aEntryList.Count() - 1);
+ double fStepStart = (double)aEntryList.GetObject(0)->mnPos;
+ fStepStart += fStepWidth;
+
+ // move entries 1..n-1
+ for(a=1;a<aEntryList.Count()-1;a++)
+ {
+ ImpDistributeEntry* pCurr = aEntryList.GetObject(a);
+ sal_Int32 nDelta = (sal_Int32)(fStepStart + 0.5) - pCurr->mnPos;
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pCurr->mpObj));
+ pCurr->mpObj->Move(Size(nDelta, 0));
+ fStepStart += fStepWidth;
+ }
+ }
+
+ // clear list
+ while(aEntryList.Count())
+ delete aEntryList.Remove((sal_uIntPtr)0L);
+ }
+
+ if(eVer != SvxDistributeVerticalNone)
+ {
+ // build sorted entry list
+ nFullLength = 0L;
+
+ for(a=0;a<nMark;a++)
+ {
+ SdrMark* pMark = GetSdrMarkByIndex(a);
+ ImpDistributeEntry* pNew = new ImpDistributeEntry;
+
+ pNew->mpObj = pMark->GetMarkedSdrObj();
+ nInsPos = 0;
+
+ switch(eVer)
+ {
+ case SvxDistributeVerticalTop:
+ {
+ pNew->mnPos = pNew->mpObj->GetSnapRect().Top();
+ break;
+ }
+ case SvxDistributeVerticalCenter:
+ {
+ pNew->mnPos = (pNew->mpObj->GetSnapRect().Bottom() + pNew->mpObj->GetSnapRect().Top()) / 2;
+ break;
+ }
+ case SvxDistributeVerticalDistance:
+ {
+ pNew->mnLength = pNew->mpObj->GetSnapRect().GetHeight() + 1;
+ nFullLength += pNew->mnLength;
+ pNew->mnPos = (pNew->mpObj->GetSnapRect().Bottom() + pNew->mpObj->GetSnapRect().Top()) / 2;
+ break;
+ }
+ case SvxDistributeVerticalBottom:
+ {
+ pNew->mnPos = pNew->mpObj->GetSnapRect().Bottom();
+ break;
+ }
+ default: break;
+ }
+
+ while(nInsPos < aEntryList.Count() && aEntryList.GetObject(nInsPos)->mnPos < pNew->mnPos)
+ nInsPos++;
+
+ aEntryList.Insert(pNew, nInsPos);
+ }
+
+ if(eVer == SvxDistributeVerticalDistance)
+ {
+ // calc room in-between
+ sal_Int32 nHeight = GetAllMarkedBoundRect().GetHeight() + 1;
+ double fStepWidth = ((double)nHeight - (double)nFullLength) / (double)(aEntryList.Count() - 1);
+ double fStepStart = (double)aEntryList.GetObject(0)->mnPos;
+ fStepStart += fStepWidth + (double)((aEntryList.GetObject(0)->mnLength + aEntryList.GetObject(1)->mnLength) / 2);
+
+ // move entries 1..n-1
+ for(a=1;a<aEntryList.Count()-1;a++)
+ {
+ ImpDistributeEntry* pCurr = aEntryList.GetObject(a);
+ ImpDistributeEntry* pNext = aEntryList.GetObject(a+1);
+ sal_Int32 nDelta = (sal_Int32)(fStepStart + 0.5) - pCurr->mnPos;
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pCurr->mpObj));
+ pCurr->mpObj->Move(Size(0, nDelta));
+ fStepStart += fStepWidth + (double)((pCurr->mnLength + pNext->mnLength) / 2);
+ }
+ }
+ else
+ {
+ // calc distances
+ sal_Int32 nHeight = aEntryList.GetObject(aEntryList.Count() - 1)->mnPos - aEntryList.GetObject(0)->mnPos;
+ double fStepWidth = (double)nHeight / (double)(aEntryList.Count() - 1);
+ double fStepStart = (double)aEntryList.GetObject(0)->mnPos;
+ fStepStart += fStepWidth;
+
+ // move entries 1..n-1
+ for(a=1;a<aEntryList.Count()-1;a++)
+ {
+ ImpDistributeEntry* pCurr = aEntryList.GetObject(a);
+ sal_Int32 nDelta = (sal_Int32)(fStepStart + 0.5) - pCurr->mnPos;
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pCurr->mpObj));
+ pCurr->mpObj->Move(Size(0, nDelta));
+ fStepStart += fStepWidth;
+ }
+ }
+
+ // clear list
+ while(aEntryList.Count())
+ delete aEntryList.Remove((sal_uIntPtr)0L);
+ }
+
+ // UNDO-Comment and end of UNDO
+ SetUndoComment(ImpGetResStr(STR_DistributeMarkedObjects));
+
+ if( bUndo )
+ EndUndo();
+ }
+
+ delete(pDlg);
+ }
+ }
+}
+
+void SdrEditView::MergeMarkedObjects(SdrMergeMode eMode)
+{
+ // #i73441# check content
+ if(AreObjectsMarked())
+ {
+ SdrMarkList aRemove;
+ SortMarkedObjects();
+
+ const bool bUndo = IsUndoEnabled();
+
+ if( bUndo )
+ BegUndo();
+
+ sal_uInt32 nInsPos=0xFFFFFFFF;
+ const SdrObject* pAttrObj = NULL;
+ basegfx::B2DPolyPolygon aMergePolyPolygonA;
+ basegfx::B2DPolyPolygon aMergePolyPolygonB;
+
+ SdrObjList* pInsOL = NULL;
+ SdrPageView* pInsPV = NULL;
+ sal_Bool bFirstObjectComplete(sal_False);
+
+ // make sure selected objects are contour objects
+ // since now basegfx::tools::adaptiveSubdivide() is used, it is no longer
+ // necessary to use ConvertMarkedToPolyObj which will subdivide curves using the old
+ // mechanisms. In a next step the polygon clipper will even be able to clip curves...
+ // ConvertMarkedToPolyObj(sal_True);
+ ConvertMarkedToPathObj(sal_True);
+ OSL_ENSURE(AreObjectsMarked(), "no more objects selected after preparations (!)");
+
+ for(sal_uInt32 a=0;a<GetMarkedObjectCount();a++)
+ {
+ SdrMark* pM = GetSdrMarkByIndex(a);
+ SdrObject* pObj = pM->GetMarkedSdrObj();
+
+ if(ImpCanConvertForCombine(pObj))
+ {
+ if(!pAttrObj)
+ pAttrObj = pObj;
+
+ nInsPos = pObj->GetOrdNum() + 1;
+ pInsPV = pM->GetPageView();
+ pInsOL = pObj->GetObjList();
+
+ // #i76891# use single iter from SJ here whcih works on SdrObjects and takes
+ // groups into account by itself
+ SdrObjListIter aIter(*pObj, IM_DEEPWITHGROUPS);
+
+ while(aIter.IsMore())
+ {
+ SdrObject* pCandidate = aIter.Next();
+ SdrPathObj* pPathObj = PTR_CAST(SdrPathObj, pCandidate);
+ if(pPathObj)
+ {
+ basegfx::B2DPolyPolygon aTmpPoly(pPathObj->GetPathPoly());
+
+ // #i76891# unfortunately ConvertMarkedToPathObj has converted all
+ // involved polygon data to curve segments, even if not necessary.
+ // It is better to try to reduce to more simple polygons.
+ aTmpPoly = basegfx::tools::simplifyCurveSegments(aTmpPoly);
+
+ // for each part polygon as preparation, remove self-intersections
+ // correct orientations and get rid of evtl. neutral polygons.
+ aTmpPoly = basegfx::tools::prepareForPolygonOperation(aTmpPoly);
+
+ if(!bFirstObjectComplete)
+ {
+ // #i111987# Also need to collect ORed source shape when more than
+ // a single polygon is involved
+ if(aMergePolyPolygonA.count())
+ {
+ aMergePolyPolygonA = basegfx::tools::solvePolygonOperationOr(aMergePolyPolygonA, aTmpPoly);
+ }
+ else
+ {
+ aMergePolyPolygonA = aTmpPoly;
+ }
+ }
+ else
+ {
+ if(aMergePolyPolygonB.count())
+ {
+ // to topologically correctly collect the 2nd polygon
+ // group it is necessary to OR the parts (each is seen as
+ // XOR-FillRule polygon and they are drawn over each-other)
+ aMergePolyPolygonB = basegfx::tools::solvePolygonOperationOr(aMergePolyPolygonB, aTmpPoly);
+ }
+ else
+ {
+ aMergePolyPolygonB = aTmpPoly;
+ }
+ }
+ }
+ }
+
+ // was there something added to the first poly?
+ if(!bFirstObjectComplete && aMergePolyPolygonA.count())
+ {
+ bFirstObjectComplete = sal_True;
+ }
+
+ // move object to temporary delete list
+ aRemove.InsertEntry(SdrMark(pObj, pM->GetPageView()));
+ }
+ }
+
+ switch(eMode)
+ {
+ case SDR_MERGE_MERGE:
+ {
+ // merge all contained parts (OR)
+ static bool bTestXOR(false);
+ if(bTestXOR)
+ {
+ aMergePolyPolygonA = basegfx::tools::solvePolygonOperationXor(aMergePolyPolygonA, aMergePolyPolygonB);
+ }
+ else
+ {
+ aMergePolyPolygonA = basegfx::tools::solvePolygonOperationOr(aMergePolyPolygonA, aMergePolyPolygonB);
+ }
+ break;
+ }
+ case SDR_MERGE_SUBSTRACT:
+ {
+ // Substract B from A
+ aMergePolyPolygonA = basegfx::tools::solvePolygonOperationDiff(aMergePolyPolygonA, aMergePolyPolygonB);
+ break;
+ }
+ case SDR_MERGE_INTERSECT:
+ {
+ // AND B and A
+ aMergePolyPolygonA = basegfx::tools::solvePolygonOperationAnd(aMergePolyPolygonA, aMergePolyPolygonB);
+ break;
+ }
+ }
+
+ // #i73441# check insert list before taking actions
+ if(pInsOL)
+ {
+ SdrPathObj* pPath = new SdrPathObj(OBJ_PATHFILL, aMergePolyPolygonA);
+ ImpCopyAttributes(pAttrObj, pPath);
+ SdrInsertReason aReason(SDRREASON_VIEWCALL, pAttrObj);
+ pInsOL->InsertObject(pPath, nInsPos, &aReason);
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pPath));
+ MarkObj(pPath, pInsPV, sal_False, sal_True);
+ }
+
+ aRemove.ForceSort();
+ switch(eMode)
+ {
+ case SDR_MERGE_MERGE:
+ {
+ SetUndoComment(
+ ImpGetResStr(STR_EditMergeMergePoly),
+ aRemove.GetMarkDescription());
+ break;
+ }
+ case SDR_MERGE_SUBSTRACT:
+ {
+ SetUndoComment(
+ ImpGetResStr(STR_EditMergeSubstractPoly),
+ aRemove.GetMarkDescription());
+ break;
+ }
+ case SDR_MERGE_INTERSECT:
+ {
+ SetUndoComment(
+ ImpGetResStr(STR_EditMergeIntersectPoly),
+ aRemove.GetMarkDescription());
+ break;
+ }
+ }
+ DeleteMarkedList(aRemove);
+
+ if( bUndo )
+ EndUndo();
+ }
+}
+
+void SdrEditView::CombineMarkedObjects(sal_Bool bNoPolyPoly)
+{
+ // #105899# Start of Combine-Undo put to front, else ConvertMarkedToPolyObj would
+ // create a 2nd Undo-action and Undo-Comment.
+
+ bool bUndo = IsUndoEnabled();
+
+ // Undo-String will be set later
+ if( bUndo )
+ BegUndo(String(), String(), bNoPolyPoly ? SDRREPFUNC_OBJ_COMBINE_ONEPOLY : SDRREPFUNC_OBJ_COMBINE_POLYPOLY);
+
+ // #105899# First, guarantee that all objects are converted to polyobjects,
+ // especially for SdrGrafObj with bitmap filling this is necessary to not
+ // loose the bitmap filling.
+
+ // #i12392#
+ // ConvertMarkedToPolyObj was too strong here, it will loose quality and
+ // information when curve objects are combined. This can be replaced by
+ // using ConvertMarkedToPathObj without changing the previous fix.
+
+ // #i21250#
+ // Instead of simply passing sal_True as LineToArea, use bNoPolyPoly as info
+ // if this command is a 'Combine' or a 'Connect' command. On Connect it's sal_True.
+ // To not concert line segments with a set line width to polygons in that case,
+ // use this info. Do not convert LineToArea on Connect commands.
+ // ConvertMarkedToPathObj(!bNoPolyPoly);
+
+ // #114310#
+ // This is used for Combine and Connect. In no case it is necessary to force
+ // the content to curve, but it is also not good to force to polygons. Thus,
+ // curve is the less information loosing one. Remember: This place is not
+ // used for merge.
+ // LineToArea is never necessary, both commands are able to take over the
+ // set line style and to display it correctly. Thus, i will use a
+ // ConvertMarkedToPathObj with a sal_False in any case. Only drawback is that
+ // simple polygons will be changed to curves, but with no information loss.
+ ConvertMarkedToPathObj(sal_False /* bLineToArea */);
+
+ // continue as before
+ basegfx::B2DPolyPolygon aPolyPolygon;
+ SdrObjList* pAktOL = 0L;
+ SdrMarkList aRemoveMerker;
+
+ SortMarkedObjects();
+ sal_uInt32 nInsPos(0xFFFFFFFF);
+ SdrObjList* pInsOL = 0L;
+ SdrPageView* pInsPV = 0L;
+ const sal_uInt32 nAnz(GetMarkedObjectCount());
+ const SdrObject* pAttrObj = 0L;
+
+ for(sal_uInt32 a(nAnz); a > 0L; )
+ {
+ a--;
+ SdrMark* pM = GetSdrMarkByIndex(a);
+ SdrObject* pObj = pM->GetMarkedSdrObj();
+ SdrObjList* pThisOL = pObj->GetObjList();
+
+ if(pAktOL != pThisOL)
+ {
+ pAktOL = pThisOL;
+ }
+
+ if(ImpCanConvertForCombine(pObj))
+ {
+ // Obj merken fuer Attribute kopieren
+ pAttrObj = pObj;
+
+ // unfortunately ConvertMarkedToPathObj has converted all
+ // involved polygon data to curve segments, even if not necessary.
+ // It is better to try to reduce to more simple polygons.
+ basegfx::B2DPolyPolygon aTmpPoly(basegfx::tools::simplifyCurveSegments(ImpGetPolyPolygon(pObj, sal_True)));
+ aPolyPolygon.insert(0L, aTmpPoly);
+
+ if(!pInsOL)
+ {
+ nInsPos = pObj->GetOrdNum() + 1L;
+ pInsPV = pM->GetPageView();
+ pInsOL = pObj->GetObjList();
+ }
+
+ aRemoveMerker.InsertEntry(SdrMark(pObj, pM->GetPageView()));
+ }
+ }
+
+ if(bNoPolyPoly)
+ {
+ basegfx::B2DPolygon aCombinedPolygon(ImpCombineToSinglePolygon(aPolyPolygon));
+ aPolyPolygon.clear();
+ aPolyPolygon.append(aCombinedPolygon);
+ }
+
+ const sal_uInt32 nPolyCount(aPolyPolygon.count());
+
+ if(nPolyCount)
+ {
+ SdrObjKind eKind = OBJ_PATHFILL;
+
+ if(nPolyCount > 1L)
+ {
+ aPolyPolygon.setClosed(true);
+ }
+ else
+ {
+ // auf Polyline Checken
+ const basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(0L));
+ const sal_uInt32 nPointCount(aPolygon.count());
+
+ if(nPointCount <= 2L)
+ {
+ eKind = OBJ_PATHLINE;
+ }
+ else
+ {
+ if(!aPolygon.isClosed())
+ {
+ const basegfx::B2DPoint aPointA(aPolygon.getB2DPoint(0L));
+ const basegfx::B2DPoint aPointB(aPolygon.getB2DPoint(nPointCount - 1L));
+ const double fDistance(basegfx::B2DVector(aPointB - aPointA).getLength());
+ const double fJoinTolerance(10.0);
+
+ if(fDistance < fJoinTolerance)
+ {
+ aPolyPolygon.setClosed(true);
+ }
+ else
+ {
+ eKind = OBJ_PATHLINE;
+ }
+ }
+ }
+ }
+
+ SdrPathObj* pPath = new SdrPathObj(eKind,aPolyPolygon);
+
+ // Attribute des untersten Objekts
+ ImpCopyAttributes(pAttrObj, pPath);
+
+ // #100408# If LineStyle of pAttrObj is XLINE_NONE force to XLINE_SOLID to make visible.
+ const XLineStyle eLineStyle = ((const XLineStyleItem&)pAttrObj->GetMergedItem(XATTR_LINESTYLE)).GetValue();
+ const XFillStyle eFillStyle = ((const XFillStyleItem&)pAttrObj->GetMergedItem(XATTR_FILLSTYLE)).GetValue();
+
+ // #110635#
+ // Take fill style/closed state of pAttrObj in account when deciding to change the line style
+ sal_Bool bIsClosedPathObj(pAttrObj->ISA(SdrPathObj) && ((SdrPathObj*)pAttrObj)->IsClosed());
+
+ if(XLINE_NONE == eLineStyle && (XFILL_NONE == eFillStyle || !bIsClosedPathObj))
+ {
+ pPath->SetMergedItem(XLineStyleItem(XLINE_SOLID));
+ }
+
+ SdrInsertReason aReason(SDRREASON_VIEWCALL,pAttrObj);
+ pInsOL->InsertObject(pPath,nInsPos,&aReason);
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pPath));
+
+ // #111111#
+ // Here was a severe error: Without UnmarkAllObj, the new object was marked
+ // additionally to the two ones which are deleted below. As long as those are
+ // in the UNDO there is no problem, but as soon as they get deleted, the
+ // MarkList will contain deleted objects -> GPF.
+ UnmarkAllObj(pInsPV);
+ MarkObj(pPath, pInsPV, sal_False, sal_True);
+ }
+
+ // UndoComment aus den tatsaechlich verwendeten Objekten zusammenbauen
+ aRemoveMerker.ForceSort(); // wichtig fuer Remove (s.u.)
+ if( bUndo )
+ SetUndoComment(ImpGetResStr(bNoPolyPoly?STR_EditCombine_OnePoly:STR_EditCombine_PolyPoly),aRemoveMerker.GetMarkDescription());
+
+ // die tatsaechlich verwendeten Objekten aus der Liste entfernen
+ DeleteMarkedList(aRemoveMerker);
+ if( bUndo )
+ EndUndo();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@@ @@ @@@@ @@ @@ @@@@ @@ @@ @@@@@@ @@ @@@@@
+// @@ @@ @@ @@ @@ @@@ @@@ @@ @@ @@@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@@@@@@ @@ @@ @@@@@@ @@ @@ @@
+// @@ @@ @@ @@@@ @@@@@@@ @@@@@@ @@@@@@ @@ @@ @@@@
+// @@ @@ @@ @@ @@ @ @@ @@ @@ @@ @@@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@@@@ @@ @@@@ @@ @@ @@ @@ @@ @@ @@ @@@@@ @@@@@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_Bool SdrEditView::ImpCanDismantle(const basegfx::B2DPolyPolygon& rPpolyPolygon, sal_Bool bMakeLines) const
+{
+ sal_Bool bCan(sal_False);
+ const sal_uInt32 nPolygonCount(rPpolyPolygon.count());
+
+ if(nPolygonCount >= 2L)
+ {
+ // #i69172# dismantle makes sense with 2 or more polygons in a polyPolygon
+ bCan = sal_True;
+ }
+ else if(bMakeLines && 1L == nPolygonCount)
+ {
+ // #i69172# ..or with at least 2 edges (curves or lines)
+ const basegfx::B2DPolygon aPolygon(rPpolyPolygon.getB2DPolygon(0L));
+ const sal_uInt32 nPointCount(aPolygon.count());
+
+ if(nPointCount > 2L)
+ {
+ bCan = sal_True;
+ }
+ }
+
+ return bCan;
+}
+
+sal_Bool SdrEditView::ImpCanDismantle(const SdrObject* pObj, sal_Bool bMakeLines) const
+{
+ sal_Bool bOtherObjs(sal_False); // sal_True=andere Objekte ausser PathObj's vorhanden
+ sal_Bool bMin1PolyPoly(sal_False); // sal_True=mind. 1 PolyPolygon mit mehr als ein Polygon vorhanden
+ SdrObjList* pOL = pObj->GetSubList();
+
+ if(pOL)
+ {
+ // Aha, Gruppenobjekt. Also alle Member ansehen.
+ // Alle muessen PathObjs sein !
+ SdrObjListIter aIter(*pOL, IM_DEEPNOGROUPS);
+
+ while(aIter.IsMore() && !bOtherObjs)
+ {
+ const SdrObject* pObj1 = aIter.Next();
+ const SdrPathObj* pPath = PTR_CAST(SdrPathObj, pObj1);
+
+ if(pPath)
+ {
+ if(ImpCanDismantle(pPath->GetPathPoly(), bMakeLines))
+ {
+ bMin1PolyPoly = sal_True;
+ }
+
+ SdrObjTransformInfoRec aInfo;
+ pObj1->TakeObjInfo(aInfo);
+
+ if(!aInfo.bCanConvToPath)
+ {
+ // Passiert z.B. im Falle Fontwork (Joe, 28-11-95)
+ bOtherObjs = sal_True;
+ }
+ }
+ else
+ {
+ bOtherObjs = sal_True;
+ }
+ }
+ }
+ else
+ {
+ const SdrPathObj* pPath = PTR_CAST(SdrPathObj, pObj);
+ const SdrObjCustomShape* pCustomShape = PTR_CAST(SdrObjCustomShape, pObj);
+
+ // #i37011#
+ if(pPath)
+ {
+ if(ImpCanDismantle(pPath->GetPathPoly(),bMakeLines))
+ {
+ bMin1PolyPoly = sal_True;
+ }
+
+ SdrObjTransformInfoRec aInfo;
+ pObj->TakeObjInfo(aInfo);
+
+ // #69711 : new condition IsLine() to be able to break simple Lines
+ if(!(aInfo.bCanConvToPath || aInfo.bCanConvToPoly) && !pPath->IsLine())
+ {
+ // Passiert z.B. im Falle Fontwork (Joe, 28-11-95)
+ bOtherObjs = sal_True;
+ }
+ }
+ else if(pCustomShape)
+ {
+ if(bMakeLines)
+ {
+ // allow break command
+ bMin1PolyPoly = sal_True;
+ }
+ }
+ else
+ {
+ bOtherObjs = sal_True;
+ }
+ }
+ return bMin1PolyPoly && !bOtherObjs;
+}
+
+void SdrEditView::ImpDismantleOneObject(const SdrObject* pObj, SdrObjList& rOL, sal_uIntPtr& rPos, SdrPageView* pPV, sal_Bool bMakeLines)
+{
+ const SdrPathObj* pSrcPath = PTR_CAST(SdrPathObj, pObj);
+ const SdrObjCustomShape* pCustomShape = PTR_CAST(SdrObjCustomShape, pObj);
+
+ const bool bUndo = IsUndoEnabled();
+
+ if(pSrcPath)
+ {
+ // #i74631# redesigned due to XpolyPolygon removal and explicit constructors
+ SdrObject* pLast = 0; // fuer die Zuweisung des OutlinerParaObject
+ const basegfx::B2DPolyPolygon& rPolyPolygon(pSrcPath->GetPathPoly());
+ const sal_uInt32 nPolyCount(rPolyPolygon.count());
+
+ for(sal_uInt32 a(0); a < nPolyCount; a++)
+ {
+ const basegfx::B2DPolygon& rCandidate(rPolyPolygon.getB2DPolygon(a));
+ const sal_uInt32 nPointCount(rCandidate.count());
+
+ if(!bMakeLines || nPointCount < 2)
+ {
+ SdrPathObj* pPath = new SdrPathObj((SdrObjKind)pSrcPath->GetObjIdentifier(), basegfx::B2DPolyPolygon(rCandidate));
+ ImpCopyAttributes(pSrcPath, pPath);
+ pLast = pPath;
+ SdrInsertReason aReason(SDRREASON_VIEWCALL, pSrcPath);
+ rOL.InsertObject(pPath, rPos, &aReason);
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pPath, sal_True));
+ MarkObj(pPath, pPV, sal_False, sal_True);
+ rPos++;
+ }
+ else
+ {
+ const sal_uInt32 nLoopCount(rCandidate.isClosed() ? nPointCount : nPointCount - 1);
+
+ for(sal_uInt32 b(0); b < nLoopCount; b++)
+ {
+ SdrObjKind eKind(OBJ_PLIN);
+ basegfx::B2DPolygon aNewPolygon;
+ const sal_uInt32 nNextIndex((b + 1) % nPointCount);
+
+ aNewPolygon.append(rCandidate.getB2DPoint(b));
+
+ if(rCandidate.areControlPointsUsed())
+ {
+ aNewPolygon.appendBezierSegment(
+ rCandidate.getNextControlPoint(b),
+ rCandidate.getPrevControlPoint(nNextIndex),
+ rCandidate.getB2DPoint(nNextIndex));
+ eKind = OBJ_PATHLINE;
+ }
+ else
+ {
+ aNewPolygon.append(rCandidate.getB2DPoint(nNextIndex));
+ }
+
+ SdrPathObj* pPath = new SdrPathObj(eKind, basegfx::B2DPolyPolygon(aNewPolygon));
+ ImpCopyAttributes(pSrcPath, pPath);
+ pLast = pPath;
+ SdrInsertReason aReason(SDRREASON_VIEWCALL, pSrcPath);
+ rOL.InsertObject(pPath, rPos, &aReason);
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pPath, sal_True));
+ MarkObj(pPath, pPV, sal_False, sal_True);
+ rPos++;
+ }
+ }
+ }
+
+ if(pLast && pSrcPath->GetOutlinerParaObject())
+ {
+ pLast->SetOutlinerParaObject(new OutlinerParaObject(*pSrcPath->GetOutlinerParaObject()));
+ }
+ }
+ else if(pCustomShape)
+ {
+ if(bMakeLines)
+ {
+ // break up custom shape
+ const SdrObject* pReplacement = pCustomShape->GetSdrObjectFromCustomShape();
+
+ if(pReplacement)
+ {
+ SdrObject* pCandidate = pReplacement->Clone();
+ DBG_ASSERT(pCandidate, "SdrEditView::ImpDismantleOneObject: Could not clone SdrObject (!)");
+ pCandidate->SetModel(pCustomShape->GetModel());
+
+ if(((SdrShadowItem&)pCustomShape->GetMergedItem(SDRATTR_SHADOW)).GetValue())
+ {
+ if(pReplacement->ISA(SdrObjGroup))
+ {
+ pCandidate->SetMergedItem(SdrShadowItem(sal_True));
+ }
+ }
+
+ SdrInsertReason aReason(SDRREASON_VIEWCALL, pCustomShape);
+ rOL.InsertObject(pCandidate, rPos, &aReason);
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pCandidate, true));
+ MarkObj(pCandidate, pPV, sal_False, sal_True);
+
+ if(pCustomShape->HasText() && !pCustomShape->IsTextPath())
+ {
+ // #i37011# also create a text object and add at rPos + 1
+ SdrTextObj* pTextObj = (SdrTextObj*)SdrObjFactory::MakeNewObject(
+ pCustomShape->GetObjInventor(), OBJ_TEXT, 0L, pCustomShape->GetModel());
+
+ // Copy text content
+ OutlinerParaObject* pParaObj = pCustomShape->GetOutlinerParaObject();
+ if(pParaObj)
+ {
+ pTextObj->NbcSetOutlinerParaObject(new OutlinerParaObject(*pParaObj));
+ }
+
+ // copy all attributes
+ SfxItemSet aTargetItemSet(pCustomShape->GetMergedItemSet());
+
+ // clear fill and line style
+ aTargetItemSet.Put(XLineStyleItem(XLINE_NONE));
+ aTargetItemSet.Put(XFillStyleItem(XFILL_NONE));
+
+ // get the text bounds and set at text object
+ Rectangle aTextBounds = pCustomShape->GetSnapRect();
+ if(pCustomShape->GetTextBounds(aTextBounds))
+ {
+ pTextObj->SetSnapRect(aTextBounds);
+ }
+
+ // if rotated, copy GeoStat, too.
+ const GeoStat& rSourceGeo = pCustomShape->GetGeoStat();
+ if(rSourceGeo.nDrehWink)
+ {
+ pTextObj->NbcRotate(
+ pCustomShape->GetSnapRect().Center(), rSourceGeo.nDrehWink,
+ rSourceGeo.nSin, rSourceGeo.nCos);
+ }
+
+ // set modified ItemSet at text object
+ pTextObj->SetMergedItemSet(aTargetItemSet);
+
+ // insert object
+ rOL.InsertObject(pTextObj, rPos + 1, &aReason);
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pTextObj, true));
+ MarkObj(pTextObj, pPV, sal_False, sal_True);
+ }
+ }
+ }
+ }
+}
+
+void SdrEditView::DismantleMarkedObjects(sal_Bool bMakeLines)
+{
+ //sal_uInt32 nCnt(0);
+ // Temporaere Marklist
+ SdrMarkList aRemoveMerker;
+
+ SortMarkedObjects();
+
+ const bool bUndo = IsUndoEnabled();
+
+ if( bUndo )
+ {
+ // Der Comment wird spaeter zusammengebaut
+ BegUndo(String(), String(),
+ bMakeLines ? SDRREPFUNC_OBJ_DISMANTLE_LINES : SDRREPFUNC_OBJ_DISMANTLE_POLYS);
+ }
+
+ sal_uIntPtr nm;
+ sal_uIntPtr nAnz=GetMarkedObjectCount();
+ SdrObjList* pOL0=NULL;
+ for (nm=nAnz; nm>0;) {
+ nm--;
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ SdrPageView* pPV=pM->GetPageView();
+ SdrObjList* pOL=pObj->GetObjList();
+ if (pOL!=pOL0) { pOL0=pOL; pObj->GetOrdNum(); } // sicherstellen, dass OrdNums stimmen!
+ if (ImpCanDismantle(pObj,bMakeLines)) {
+ aRemoveMerker.InsertEntry(SdrMark(pObj,pM->GetPageView()));
+ sal_uIntPtr nPos0=pObj->GetOrdNumDirect();
+ sal_uIntPtr nPos=nPos0+1;
+ SdrObjList* pSubList=pObj->GetSubList();
+ if (pSubList!=NULL && !pObj->Is3DObj()) {
+ SdrObjListIter aIter(*pSubList,IM_DEEPNOGROUPS);
+ while (aIter.IsMore()) {
+ const SdrObject* pObj1=aIter.Next();
+ ImpDismantleOneObject(pObj1,*pOL,nPos,pPV,bMakeLines);
+ }
+ } else {
+ ImpDismantleOneObject(pObj,*pOL,nPos,pPV,bMakeLines);
+ }
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj,sal_True));
+ pOL->RemoveObject(nPos0);
+
+ if( !bUndo )
+ SdrObject::Free(pObj);
+ }
+ }
+
+ if( bUndo )
+ {
+ // UndoComment aus den tatsaechlich verwendeten Objekten zusammenbauen
+ SetUndoComment(ImpGetResStr(bMakeLines?STR_EditDismantle_Lines:STR_EditDismantle_Polys),aRemoveMerker.GetMarkDescription());
+ // die tatsaechlich verwendeten Objekten aus der Liste entfernen
+ EndUndo();
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// #### #### ### # # ####
+// # # # # # # # # #
+// # ## #### # # # # ####
+// # # # # # # # # #
+// #### # # ### ### #
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrEditView::GroupMarked(const SdrObject* pUserGrp)
+{
+ if (AreObjectsMarked())
+ {
+ SortMarkedObjects();
+
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ {
+ BegUndo(ImpGetResStr(STR_EditGroup),GetDescriptionOfMarkedObjects(),SDRREPFUNC_OBJ_GROUP);
+
+ const sal_uIntPtr nAnz = GetMarkedObjectCount();
+ for(sal_uIntPtr nm = nAnz; nm>0; )
+ {
+ // UndoActions fuer alle betroffenen Objekte anlegen
+ nm--;
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj = pM->GetMarkedSdrObj();
+ std::vector< SdrUndoAction* > vConnectorUndoActions( CreateConnectorUndo( *pObj ) );
+ AddUndoActions( vConnectorUndoActions );
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoRemoveObject( *pObj ));
+ }
+ }
+
+ SdrMarkList aNewMark;
+ SdrPageView* pPV = GetSdrPageView();
+
+ if(pPV)
+ {
+ SdrObjList* pAktLst=pPV->GetObjList();
+ SdrObjList* pSrcLst=pAktLst;
+ SdrObjList* pSrcLst0=pSrcLst;
+ SdrPage* pPage=pPV->GetPage();
+ // sicherstellen, dass die OrdNums stimmen
+ if (pSrcLst->IsObjOrdNumsDirty())
+ pSrcLst->RecalcObjOrdNums();
+ SdrObject* pGrp=NULL;
+ SdrObject* pRefObj=NULL; // Referenz fuer InsertReason (-> rumankern im Writer)
+ SdrObject* pRefObj1=NULL; // Referenz fuer InsertReason (-> rumankern im Writer)
+ SdrObjList* pDstLst=NULL;
+ // Falls alle markierten Objekte aus Fremden Obj-Listen
+ // kommen, kommt das Gruppenobjekt an das Ende der Liste.
+ sal_uIntPtr nInsPos=pSrcLst->GetObjCount();
+ sal_Bool bNeedInsPos=sal_True;
+ for (sal_uIntPtr nm=GetMarkedObjectCount(); nm>0;)
+ {
+ nm--;
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ if (pM->GetPageView()==pPV)
+ {
+ if (pGrp==NULL)
+ {
+ if (pUserGrp!=NULL)
+ pGrp=pUserGrp->Clone();
+ if (pGrp==NULL)
+ pGrp=new SdrObjGroup;
+ pDstLst=pGrp->GetSubList();
+ DBG_ASSERT(pDstLst!=NULL,"Angebliches Gruppenobjekt liefert keine Objektliste");
+ }
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ pSrcLst=pObj->GetObjList();
+ if (pSrcLst!=pSrcLst0)
+ {
+ if (pSrcLst->IsObjOrdNumsDirty())
+ pSrcLst->RecalcObjOrdNums();
+ }
+ sal_Bool bForeignList=pSrcLst!=pAktLst;
+ sal_Bool bGrouped=pSrcLst!=pPage;
+ if (!bForeignList && bNeedInsPos)
+ {
+ nInsPos=pObj->GetOrdNum(); // ua, damit sind alle ObjOrdNum der Page gesetzt
+ nInsPos++;
+ bNeedInsPos=sal_False;
+ }
+ pSrcLst->RemoveObject(pObj->GetOrdNumDirect());
+ if (!bForeignList)
+ nInsPos--; // InsertPos korregieren
+ SdrInsertReason aReason(SDRREASON_VIEWCALL);
+ pDstLst->InsertObject(pObj,0,&aReason);
+ GetMarkedObjectListWriteAccess().DeleteMark(nm);
+ if (pRefObj1==NULL)
+ pRefObj1=pObj; // Das oberste sichtbare Objekt
+ if (!bGrouped)
+ {
+ if (pRefObj==NULL)
+ pRefObj=pObj; // Das oberste sichtbare nicht gruppierte Objekt
+ }
+ pSrcLst0=pSrcLst;
+ }
+ }
+ if (pRefObj==NULL)
+ pRefObj=pRefObj1;
+ if (pGrp!=NULL)
+ {
+ aNewMark.InsertEntry(SdrMark(pGrp,pPV));
+ sal_uIntPtr nAnz=pDstLst->GetObjCount();
+ SdrInsertReason aReason(SDRREASON_VIEWCALL,pRefObj);
+ pAktLst->InsertObject(pGrp,nInsPos,&aReason);
+ if( bUndo )
+ {
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pGrp,true)); // Kein Recalc!
+ for (sal_uIntPtr no=0; no<nAnz; no++)
+ {
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoInsertObject(*pDstLst->GetObj(no)));
+ }
+ }
+ }
+ }
+ GetMarkedObjectListWriteAccess().Merge(aNewMark);
+ MarkListHasChanged();
+
+ if( bUndo )
+ EndUndo();
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// # # # # #### #### ### # # ####
+// # # ## # # # # # # # # # #
+// # # # # # # ## #### # # # # ####
+// # # # ## # # # # # # # # #
+// ### # # #### # # ### ### #
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrEditView::UnGroupMarked()
+{
+ SdrMarkList aNewMark;
+
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ BegUndo(String(), String(), SDRREPFUNC_OBJ_UNGROUP);
+
+ sal_uIntPtr nCount=0;
+ XubString aName1;
+ XubString aName;
+ sal_Bool bNameOk=sal_False;
+ for (sal_uIntPtr nm=GetMarkedObjectCount(); nm>0;) {
+ nm--;
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pGrp=pM->GetMarkedSdrObj();
+ SdrObjList* pSrcLst=pGrp->GetSubList();
+ if (pSrcLst!=NULL) {
+ nCount++;
+ if (nCount==1) {
+ pGrp->TakeObjNameSingul(aName); // Bezeichnung der Gruppe holen
+ pGrp->TakeObjNamePlural(aName1); // Bezeichnung der Gruppe holen
+ bNameOk=sal_True;
+ } else {
+ if (nCount==2) aName=aName1; // Pluralname setzen
+ if (bNameOk) {
+ XubString aStr;
+ pGrp->TakeObjNamePlural(aStr); // Bezeichnung der Gruppe holen
+
+ if(!aStr.Equals(aName))
+ bNameOk = sal_False;
+ }
+ }
+ sal_uIntPtr nDstCnt=pGrp->GetOrdNum();
+ SdrObjList* pDstLst=pM->GetPageView()->GetObjList();
+
+ // FIRST move contained objects to parent of group, so that
+ // the contained objects are NOT migrated to the UNDO-ItemPool
+ // when AddUndo(new SdrUndoDelObj(*pGrp)) is called.
+ sal_uIntPtr nAnz=pSrcLst->GetObjCount();
+ sal_uIntPtr no;
+
+ if( bUndo )
+ {
+ for (no=nAnz; no>0;)
+ {
+ no--;
+ SdrObject* pObj=pSrcLst->GetObj(no);
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoRemoveObject(*pObj));
+ }
+ }
+ for (no=0; no<nAnz; no++)
+ {
+ SdrObject* pObj=pSrcLst->RemoveObject(0);
+ SdrInsertReason aReason(SDRREASON_VIEWCALL,pGrp);
+ pDstLst->InsertObject(pObj,nDstCnt,&aReason);
+ if( bUndo )
+ AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoInsertObject(*pObj,true));
+ nDstCnt++;
+ // Kein SortCheck beim einfuegen in die MarkList, denn das
+ // wuerde wg. pObj->GetOrdNum() jedesmal ein RecalcOrdNums()
+ // provozieren:
+ aNewMark.InsertEntry(SdrMark(pObj,pM->GetPageView()),sal_False);
+ }
+
+ if( bUndo )
+ {
+ // Now it is safe to add the delete-UNDO which trigers the
+ // MigrateItemPool now only for itself, not for the subobjects.
+ // nDstCnt is right, because previous inserts move group
+ // object deeper and increase nDstCnt.
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pGrp));
+ }
+ pDstLst->RemoveObject(nDstCnt);
+
+ if( !bUndo )
+ SdrObject::Free(pGrp);
+
+ GetMarkedObjectListWriteAccess().DeleteMark(nm);
+ }
+ }
+ if (nCount!=0)
+ {
+ if (!bNameOk)
+ aName=ImpGetResStr(STR_ObjNamePluralGRUP); // Oberbegriff Gruppenobjekte verwenden, wenn verschiedene Objekte.
+ SetUndoComment(ImpGetResStr(STR_EditUngroup),aName);
+ }
+
+ if( bUndo )
+ EndUndo();
+
+ if (nCount!=0)
+ {
+ GetMarkedObjectListWriteAccess().Merge(aNewMark,sal_True); // Durch das obige Einsortieren ist aNewMark genau verkehrtherum
+ MarkListHasChanged();
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// ### ### # # # # ##### #### ##### ##### ### #### ### # # #
+// # # # # ## # # # # # # # # # # # # # # # # #
+// # # # # # # # # #### #### # # # # #### # # # #
+// # # # # # ## # # # # # # # # # # # # # #
+// ### ### # # # ##### # # # # ### # ### #### #
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrObject* SdrEditView::ImpConvertOneObj(SdrObject* pObj, sal_Bool bPath, sal_Bool bLineToArea)
+{
+ SdrObject* pNewObj = pObj->ConvertToPolyObj(bPath, bLineToArea);
+ if (pNewObj!=NULL)
+ {
+ SdrObjList* pOL=pObj->GetObjList();
+ DBG_ASSERT(pOL!=NULL,"ConvertTo: Obj liefert keine ObjList");
+ if (pOL!=NULL)
+ {
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoReplaceObject(*pObj,*pNewObj));
+
+ pOL->ReplaceObject(pNewObj,pObj->GetOrdNum());
+
+ if( !bUndo )
+ SdrObject::Free(pObj);
+ }
+ }
+ return pNewObj;
+}
+
+void SdrEditView::ImpConvertTo(sal_Bool bPath, sal_Bool bLineToArea)
+{
+ sal_Bool bMrkChg=sal_False;
+ sal_Bool bModChg=sal_False;
+ if (AreObjectsMarked()) {
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ sal_uInt16 nDscrID=0;
+ if(bLineToArea)
+ {
+ if(nMarkAnz == 1)
+ nDscrID = STR_EditConvToContour;
+ else
+ nDscrID = STR_EditConvToContours;
+
+ BegUndo(ImpGetResStr(nDscrID), GetDescriptionOfMarkedObjects());
+ }
+ else
+ {
+ if (bPath) {
+ if (nMarkAnz==1) nDscrID=STR_EditConvToCurve;
+ else nDscrID=STR_EditConvToCurves;
+ BegUndo(ImpGetResStr(nDscrID),GetDescriptionOfMarkedObjects(),SDRREPFUNC_OBJ_CONVERTTOPATH);
+ } else {
+ if (nMarkAnz==1) nDscrID=STR_EditConvToPoly;
+ else nDscrID=STR_EditConvToPolys;
+ BegUndo(ImpGetResStr(nDscrID),GetDescriptionOfMarkedObjects(),SDRREPFUNC_OBJ_CONVERTTOPOLY);
+ }
+ }
+ for (sal_uIntPtr nm=nMarkAnz; nm>0;) {
+ nm--;
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ SdrPageView* pPV=pM->GetPageView();
+ if (pObj->IsGroupObject() && !pObj->Is3DObj()) {
+ SdrObject* pGrp=pObj;
+ SdrObjListIter aIter(*pGrp,IM_DEEPNOGROUPS);
+ while (aIter.IsMore()) {
+ pObj=aIter.Next();
+ if (ImpConvertOneObj(pObj,bPath,bLineToArea)) bModChg=sal_True;
+ }
+ } else {
+ SdrObject* pNewObj=ImpConvertOneObj(pObj,bPath,bLineToArea);
+ if (pNewObj!=NULL) {
+ bModChg=sal_True;
+ bMrkChg=sal_True;
+ GetMarkedObjectListWriteAccess().ReplaceMark(SdrMark(pNewObj,pPV),nm);
+ }
+ }
+ }
+ EndUndo();
+ if (bMrkChg) AdjustMarkHdl();
+ if (bMrkChg) MarkListHasChanged();
+ }
+}
+
+void SdrEditView::ConvertMarkedToPathObj(sal_Bool bLineToArea)
+{
+ ImpConvertTo(sal_True, bLineToArea);
+}
+
+void SdrEditView::ConvertMarkedToPolyObj(sal_Bool bLineToArea)
+{
+ ImpConvertTo(sal_False, bLineToArea);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// # # ##### ##### ### ##### # # ##### # # # #### ### #### #####
+// ## ## # # # # # # # # # ## ## # # # # # # #
+// # # # #### # ##### ### # # #### ### # # # # #### # # #### #
+// # # # # # # # # # # # # # # # # # # #
+// # # ##### # # # # # #### ##### # # # # ### # # #
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrEditView::DoImportMarkedMtf(SvdProgressInfo *pProgrInfo)
+{
+ const bool bUndo = IsUndoEnabled();
+
+ if( bUndo )
+ BegUndo(String(), String(), SDRREPFUNC_OBJ_IMPORTMTF);
+
+ SortMarkedObjects();
+ SdrMarkList aForTheDescription;
+ SdrMarkList aNewMarked;
+ sal_uIntPtr nAnz=GetMarkedObjectCount();
+
+ for (sal_uIntPtr nm=nAnz; nm>0;)
+ { // Undo Objekte fuer alle neuen Objekte erzeugen
+ // zwischen den Metafiles auf Abbruch testen
+ if( pProgrInfo != NULL )
+ {
+ pProgrInfo->SetNextObject();
+ if(!pProgrInfo->ReportActions(0))
+ break;
+ }
+
+ nm--;
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ SdrPageView* pPV=pM->GetPageView();
+ SdrObjList* pOL=pObj->GetObjList();
+ sal_uIntPtr nInsPos=pObj->GetOrdNum()+1;
+ SdrGrafObj* pGraf=PTR_CAST(SdrGrafObj,pObj);
+ SdrOle2Obj* pOle2=PTR_CAST(SdrOle2Obj,pObj);
+ sal_uIntPtr nInsAnz=0;
+ if (pGraf!=NULL && pGraf->HasGDIMetaFile())
+ {
+ ImpSdrGDIMetaFileImport aFilter(*pMod);
+ aFilter.SetScaleRect(pGraf->GetSnapRect());
+ aFilter.SetLayer(pObj->GetLayer());
+ nInsAnz=aFilter.DoImport(pGraf->GetTransformedGraphic().GetGDIMetaFile(),*pOL,nInsPos,pProgrInfo);
+ }
+ if ( pOle2!=NULL && pOle2->GetGraphic() )
+ {
+ //const GDIMetaFile* pMtf=pOle2->GetGDIMetaFile();
+ ImpSdrGDIMetaFileImport aFilter(*pMod);
+ aFilter.SetScaleRect(pOle2->GetLogicRect());
+ aFilter.SetLayer(pObj->GetLayer());
+ nInsAnz=aFilter.DoImport(pOle2->GetGraphic()->GetGDIMetaFile(),*pOL,nInsPos,pProgrInfo);
+ }
+ if (nInsAnz!=0)
+ {
+ sal_uIntPtr nObj=nInsPos;
+ for (sal_uIntPtr i=0; i<nInsAnz; i++)
+ {
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pOL->GetObj(nObj)));
+
+ // Neue MarkList pflegen
+ SdrMark aNewMark(pOL->GetObj(nObj), pPV);
+ aNewMarked.InsertEntry(aNewMark);
+
+ nObj++;
+ }
+ aForTheDescription.InsertEntry(*pM);
+
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj));
+
+ // Objekt aus selektion loesen und loeschen
+ GetMarkedObjectListWriteAccess().DeleteMark(TryToFindMarkedObject(pObj));
+ pOL->RemoveObject(nInsPos-1);
+
+ if( !bUndo )
+ SdrObject::Free(pObj);
+ }
+ }
+
+ // MarkObj... fehlt... jetzt nicht mehr (AW)
+ if(aNewMarked.GetMarkCount())
+ {
+ // Neue Selektion bilden
+ for(sal_uIntPtr a(0); a < aNewMarked.GetMarkCount(); a++)
+ {
+ GetMarkedObjectListWriteAccess().InsertEntry(*aNewMarked.GetMark(a));
+ }
+
+ SortMarkedObjects();
+ }
+
+ if( bUndo )
+ {
+ SetUndoComment(ImpGetResStr(STR_EditImportMtf),aForTheDescription.GetMarkDescription());
+ EndUndo();
+ }
+}
+
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
new file mode 100644
index 000000000000..a8a0663a4b04
--- /dev/null
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -0,0 +1,2146 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <com/sun/star/i18n/WordType.hpp>
+
+#include <svtools/accessibilityoptions.hxx>
+
+#include <svx/svdedxv.hxx>
+#include <svl/solar.hrc>
+
+//#include <tools/string.h>
+#include <svl/itemiter.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/hatch.hxx>
+#include <svl/whiter.hxx>
+#include <svl/style.hxx>
+#include <editeng/editstat.hxx>
+#include <tools/config.hxx>
+#include <vcl/cursor.hxx>
+#include <editeng/unotext.hxx>
+
+#include <editeng/editeng.hxx>
+#include <editeng/editobj.hxx>
+#include <editeng/outlobj.hxx>
+#include <editeng/scripttypeitem.hxx>
+#include "svx/svditext.hxx"
+#include <svx/svdoutl.hxx>
+#include <svx/sdtfchim.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/svdundo.hxx>
+#include "svx/svditer.hxx"
+#include "svx/svdpagv.hxx"
+#include "svx/svdpage.hxx"
+#include "svx/svdetc.hxx" // fuer GetDraftFillColor
+#include "svx/svdotable.hxx"
+#include <svx/selectioncontroller.hxx>
+#ifdef DBG_UTIL
+#include <svdibrow.hxx>
+#endif
+
+#include <svx/svdoutl.hxx>
+#include <svx/svddrgv.hxx> // fuer SetSolidDragging()
+#include "svx/svdstr.hrc" // Namen aus der Resource
+#include "svx/svdglob.hxx" // StringCache
+#include "svx/globl3d.hxx"
+#include <editeng/outliner.hxx>
+#include <editeng/adjitem.hxx>
+
+// #98988#
+#include <svtools/colorcfg.hxx>
+#include <vcl/svapp.hxx> //add CHINA001
+#include <svx/sdrpaintwindow.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrObjEditView::ImpClearVars()
+{
+ bQuickTextEditMode=sal_True;
+ bMacroMode=sal_True;
+ pTextEditOutliner=NULL;
+ pTextEditOutlinerView=NULL;
+ pTextEditPV=NULL;
+ pTextEditWin=NULL;
+ pTextEditCursorMerker=NULL;
+ pEditPara=NULL;
+ bTextEditNewObj=sal_False;
+ bMacroDown=sal_False;
+ pMacroObj=NULL;
+ pMacroPV=NULL;
+ pMacroWin=NULL;
+ nMacroTol=0;
+ bTextEditDontDelete=sal_False;
+ bTextEditOnlyOneView=sal_False;
+}
+
+SdrObjEditView::SdrObjEditView(SdrModel* pModel1, OutputDevice* pOut):
+ SdrGlueEditView(pModel1,pOut)
+{
+ ImpClearVars();
+}
+
+SdrObjEditView::~SdrObjEditView()
+{
+ pTextEditWin = NULL; // Damit es in SdrEndTextEdit kein ShowCursor gibt
+ if (IsTextEdit()) SdrEndTextEdit();
+ if (pTextEditOutliner!=NULL) {
+ delete pTextEditOutliner;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_Bool SdrObjEditView::IsAction() const
+{
+ return IsMacroObj() || SdrGlueEditView::IsAction();
+}
+
+void SdrObjEditView::MovAction(const Point& rPnt)
+{
+ if (IsMacroObj()) MovMacroObj(rPnt);
+ SdrGlueEditView::MovAction(rPnt);
+}
+
+void SdrObjEditView::EndAction()
+{
+ if (IsMacroObj()) EndMacroObj();
+ SdrGlueEditView::EndAction();
+}
+
+void SdrObjEditView::BckAction()
+{
+ BrkMacroObj();
+ SdrGlueEditView::BckAction();
+}
+
+void SdrObjEditView::BrkAction()
+{
+ BrkMacroObj();
+ SdrGlueEditView::BrkAction();
+}
+
+void SdrObjEditView::TakeActionRect(Rectangle& rRect) const
+{
+ if (IsMacroObj()) {
+ rRect=pMacroObj->GetCurrentBoundRect();
+ } else {
+ SdrGlueEditView::TakeActionRect(rRect);
+ }
+}
+
+void __EXPORT SdrObjEditView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
+{
+ SdrGlueEditView::Notify(rBC,rHint);
+ // Printerwechsel waerend des Editierens
+ SdrHint* pSdrHint=PTR_CAST(SdrHint,&rHint);
+ if (pSdrHint!=NULL && pTextEditOutliner!=NULL) {
+ SdrHintKind eKind=pSdrHint->GetKind();
+ if (eKind==HINT_REFDEVICECHG) {
+ pTextEditOutliner->SetRefDevice(pMod->GetRefDevice());
+ }
+ if (eKind==HINT_DEFAULTTABCHG) {
+ pTextEditOutliner->SetDefTab(pMod->GetDefaultTabulator());
+ }
+ if (eKind==HINT_DEFFONTHGTCHG) {
+ // ...
+ }
+ if (eKind==HINT_MODELSAVED) { // #43095#
+ pTextEditOutliner->ClearModifyFlag();
+ }
+ }
+}
+
+void SdrObjEditView::ModelHasChanged()
+{
+ SdrGlueEditView::ModelHasChanged();
+ if (mxTextEditObj.is() && !mxTextEditObj->IsInserted()) SdrEndTextEdit(); // Objekt geloescht
+ // TextEditObj geaendert?
+ if (IsTextEdit()) {
+ SdrTextObj* pTextObj=dynamic_cast<SdrTextObj*>( mxTextEditObj.get() );
+ if (pTextObj!=NULL) {
+ sal_uIntPtr nOutlViewAnz=pTextEditOutliner->GetViewCount();
+ sal_Bool bAreaChg=sal_False;
+ sal_Bool bAnchorChg=sal_False;
+ sal_Bool bColorChg=sal_False;
+ bool bContourFrame=pTextObj->IsContourTextFrame();
+ EVAnchorMode eNewAnchor(ANCHOR_VCENTER_HCENTER);
+ Rectangle aOldArea(aMinTextEditArea);
+ aOldArea.Union(aTextEditArea);
+ Color aNewColor;
+ { // Area Checken
+ Size aPaperMin1;
+ Size aPaperMax1;
+ Rectangle aEditArea1;
+ Rectangle aMinArea1;
+ pTextObj->TakeTextEditArea(&aPaperMin1,&aPaperMax1,&aEditArea1,&aMinArea1);
+
+ // #108784#
+ Point aPvOfs(pTextObj->GetTextEditOffset());
+
+ aEditArea1.Move(aPvOfs.X(),aPvOfs.Y());
+ aMinArea1.Move(aPvOfs.X(),aPvOfs.Y());
+ Rectangle aNewArea(aMinArea1);
+ aNewArea.Union(aEditArea1);
+ if (aNewArea!=aOldArea || aEditArea1!=aTextEditArea || aMinArea1!=aMinTextEditArea ||
+ pTextEditOutliner->GetMinAutoPaperSize()!=aPaperMin1 || pTextEditOutliner->GetMaxAutoPaperSize()!=aPaperMax1) {
+ aTextEditArea=aEditArea1;
+ aMinTextEditArea=aMinArea1;
+ pTextEditOutliner->SetUpdateMode(sal_False);
+ pTextEditOutliner->SetMinAutoPaperSize(aPaperMin1);
+ pTextEditOutliner->SetMaxAutoPaperSize(aPaperMax1);
+ pTextEditOutliner->SetPaperSize(Size(0,0)); // Damit der Outliner neu formatiert
+ if (!bContourFrame) {
+ pTextEditOutliner->ClearPolygon();
+ sal_uIntPtr nStat=pTextEditOutliner->GetControlWord();
+ nStat|=EE_CNTRL_AUTOPAGESIZE;
+ pTextEditOutliner->SetControlWord(nStat);
+ } else {
+ sal_uIntPtr nStat=pTextEditOutliner->GetControlWord();
+ nStat&=~EE_CNTRL_AUTOPAGESIZE;
+ pTextEditOutliner->SetControlWord(nStat);
+ Rectangle aAnchorRect;
+ pTextObj->TakeTextAnchorRect(aAnchorRect);
+ pTextObj->ImpSetContourPolygon(*pTextEditOutliner,aAnchorRect, sal_True);
+ }
+ for (sal_uIntPtr nOV=0; nOV<nOutlViewAnz; nOV++) {
+ OutlinerView* pOLV=pTextEditOutliner->GetView(nOV);
+ sal_uIntPtr nStat0=pOLV->GetControlWord();
+ sal_uIntPtr nStat=nStat0;
+ // AutoViewSize nur wenn nicht KontourFrame.
+ if (!bContourFrame) nStat|=EV_CNTRL_AUTOSIZE;
+ else nStat&=~EV_CNTRL_AUTOSIZE;
+ if (nStat!=nStat0) pOLV->SetControlWord(nStat);
+ }
+ pTextEditOutliner->SetUpdateMode(sal_True);
+ bAreaChg=sal_True;
+ }
+ }
+ if (pTextEditOutlinerView!=NULL) { // Fuellfarbe und Anker checken
+ EVAnchorMode eOldAnchor=pTextEditOutlinerView->GetAnchorMode();
+ eNewAnchor=(EVAnchorMode)pTextObj->GetOutlinerViewAnchorMode();
+ bAnchorChg=eOldAnchor!=eNewAnchor;
+ Color aOldColor(pTextEditOutlinerView->GetBackgroundColor());
+ aNewColor = GetTextEditBackgroundColor(*this);
+ bColorChg=aOldColor!=aNewColor;
+ }
+ // #104082# refresh always when it's a contour frame. That
+ // refresh is necessary since it triggers the repaint
+ // which makes the Handles visible. Changes at TakeTextRect()
+ // seem to have resulted in a case where no refresh is executed.
+ // Before that, a refresh must have been always executed
+ // (else this error would have happend earlier), thus i
+ // even think here a refresh should be done always.
+ // Since follow-up problems cannot even be guessed I only
+ // add this one more case to the if below.
+ // BTW: It's VERY bad style that here, inside ModelHasChanged()
+ // the outliner is again massively changed for the text object
+ // in text edit mode. Normally, all necessary data should be
+ // set at SdrBeginTextEdit(). Some changes and value assigns in
+ // SdrBeginTextEdit() are completely useless since they are set here
+ // again on ModelHasChanged().
+ if (bContourFrame || bAreaChg || bAnchorChg || bColorChg)
+ {
+ for (sal_uIntPtr nOV=0; nOV<nOutlViewAnz; nOV++)
+ {
+ OutlinerView* pOLV=pTextEditOutliner->GetView(nOV);
+ { // Alten OutlinerView-Bereich invalidieren
+ Window* pWin=pOLV->GetWindow();
+ Rectangle aTmpRect(aOldArea);
+ sal_uInt16 nPixSiz=pOLV->GetInvalidateMore()+1;
+ Size aMore(pWin->PixelToLogic(Size(nPixSiz,nPixSiz)));
+ aTmpRect.Left()-=aMore.Width();
+ aTmpRect.Right()+=aMore.Width();
+ aTmpRect.Top()-=aMore.Height();
+ aTmpRect.Bottom()+=aMore.Height();
+ InvalidateOneWin(*pWin,aTmpRect);
+ }
+ if (bAnchorChg)
+ pOLV->SetAnchorMode(eNewAnchor);
+ if (bColorChg)
+ pOLV->SetBackgroundColor( aNewColor );
+
+ pOLV->SetOutputArea(aTextEditArea); // weil sonst scheinbar nicht richtig umgeankert wird
+ ImpInvalidateOutlinerView(*pOLV);
+ }
+ pTextEditOutlinerView->ShowCursor();
+ }
+ }
+ ImpMakeTextCursorAreaVisible();
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@@@ @@@@@ @@ @@ @@@@@@ @@@@@ @@@@@ @@ @@@@@@
+// @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@@@@ @@ @@ @@ @@ @@ @@
+// @@ @@@@ @@@ @@ @@@@ @@ @@ @@ @@
+// @@ @@ @@@@@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@
+// @@ @@@@@ @@ @@ @@ @@@@@ @@@@@ @@ @@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrObjEditView::ImpPaintOutlinerView(OutlinerView& rOutlView, const Rectangle& rRect) const
+{
+ Window* pWin = rOutlView.GetWindow();
+
+ if(pWin)
+ {
+ const SdrTextObj* pText = PTR_CAST(SdrTextObj,GetTextEditObject());
+ bool bTextFrame(pText && pText->IsTextFrame());
+ bool bFitToSize(0 != (pTextEditOutliner->GetControlWord() & EE_CNTRL_STRETCHING));
+ bool bModifyMerk(pTextEditOutliner->IsModified()); // #43095#
+ Rectangle aBlankRect(rOutlView.GetOutputArea());
+ aBlankRect.Union(aMinTextEditArea);
+ Rectangle aPixRect(pWin->LogicToPixel(aBlankRect));
+ aBlankRect.Intersection(rRect);
+ rOutlView.GetOutliner()->SetUpdateMode(sal_True); // Bugfix #22596#
+ rOutlView.Paint(aBlankRect);
+
+ if(!bModifyMerk)
+ {
+ // #43095#
+ pTextEditOutliner->ClearModifyFlag();
+ }
+
+ if(bTextFrame && !bFitToSize)
+ {
+ aPixRect.Left()--;
+ aPixRect.Top()--;
+ aPixRect.Right()++;
+ aPixRect.Bottom()++;
+ sal_uInt16 nPixSiz(rOutlView.GetInvalidateMore() - 1);
+
+ {
+ // xPixRect Begrenzen, wegen Treiberproblem bei zu weit hinausragenden Pixelkoordinaten
+ Size aMaxXY(pWin->GetOutputSizePixel());
+ long a(2 * nPixSiz);
+ long nMaxX(aMaxXY.Width() + a);
+ long nMaxY(aMaxXY.Height() + a);
+
+ if (aPixRect.Left ()<-a) aPixRect.Left()=-a;
+ if (aPixRect.Top ()<-a) aPixRect.Top ()=-a;
+ if (aPixRect.Right ()>nMaxX) aPixRect.Right ()=nMaxX;
+ if (aPixRect.Bottom()>nMaxY) aPixRect.Bottom()=nMaxY;
+ }
+
+ Rectangle aOuterPix(aPixRect);
+ aOuterPix.Left()-=nPixSiz;
+ aOuterPix.Top()-=nPixSiz;
+ aOuterPix.Right()+=nPixSiz;
+ aOuterPix.Bottom()+=nPixSiz;
+
+ bool bMerk(pWin->IsMapModeEnabled());
+ pWin->EnableMapMode(sal_False);
+ PolyPolygon aPolyPoly( 2 );
+
+ svtools::ColorConfig aColorConfig;
+ Color aHatchCol( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
+ const Hatch aHatch( HATCH_SINGLE, aHatchCol, 3, 450 );
+
+ aPolyPoly.Insert( aOuterPix );
+ aPolyPoly.Insert( aPixRect );
+ pWin->DrawHatch( aPolyPoly, aHatch );
+
+ pWin->EnableMapMode(bMerk);
+ }
+
+ rOutlView.ShowCursor();
+ }
+}
+
+void SdrObjEditView::ImpInvalidateOutlinerView(OutlinerView& rOutlView) const
+{
+ Window* pWin = rOutlView.GetWindow();
+
+ if(pWin)
+ {
+ const SdrTextObj* pText = PTR_CAST(SdrTextObj,GetTextEditObject());
+ bool bTextFrame(pText && pText->IsTextFrame());
+ bool bFitToSize(0 != (pTextEditOutliner->GetControlWord() & EE_CNTRL_STRETCHING));
+
+ if(bTextFrame && !bFitToSize)
+ {
+ Rectangle aBlankRect(rOutlView.GetOutputArea());
+ aBlankRect.Union(aMinTextEditArea);
+ Rectangle aPixRect(pWin->LogicToPixel(aBlankRect));
+ sal_uInt16 nPixSiz(rOutlView.GetInvalidateMore() - 1);
+
+ aPixRect.Left()--;
+ aPixRect.Top()--;
+ aPixRect.Right()++;
+ aPixRect.Bottom()++;
+
+ {
+ // xPixRect Begrenzen, wegen Treiberproblem bei zu weit hinausragenden Pixelkoordinaten
+ Size aMaxXY(pWin->GetOutputSizePixel());
+ long a(2 * nPixSiz);
+ long nMaxX(aMaxXY.Width() + a);
+ long nMaxY(aMaxXY.Height() + a);
+
+ if (aPixRect.Left ()<-a) aPixRect.Left()=-a;
+ if (aPixRect.Top ()<-a) aPixRect.Top ()=-a;
+ if (aPixRect.Right ()>nMaxX) aPixRect.Right ()=nMaxX;
+ if (aPixRect.Bottom()>nMaxY) aPixRect.Bottom()=nMaxY;
+ }
+
+ Rectangle aOuterPix(aPixRect);
+ aOuterPix.Left()-=nPixSiz;
+ aOuterPix.Top()-=nPixSiz;
+ aOuterPix.Right()+=nPixSiz;
+ aOuterPix.Bottom()+=nPixSiz;
+
+ bool bMerk(pWin->IsMapModeEnabled());
+ pWin->EnableMapMode(sal_False);
+ pWin->Invalidate(aOuterPix);
+ pWin->EnableMapMode(bMerk);
+ }
+ }
+}
+
+OutlinerView* SdrObjEditView::ImpMakeOutlinerView(Window* pWin, sal_Bool /*bNoPaint*/, OutlinerView* pGivenView) const
+{
+ // Hintergrund
+ Color aBackground(GetTextEditBackgroundColor(*this));
+ SdrTextObj* pText = dynamic_cast< SdrTextObj * >( mxTextEditObj.get() );
+ sal_Bool bTextFrame=pText!=NULL && pText->IsTextFrame();
+ sal_Bool bContourFrame=pText!=NULL && pText->IsContourTextFrame();
+ // OutlinerView erzeugen
+ OutlinerView* pOutlView=pGivenView;
+ pTextEditOutliner->SetUpdateMode(sal_False);
+ if (pOutlView==NULL) pOutlView=new OutlinerView(pTextEditOutliner,pWin);
+ else pOutlView->SetWindow(pWin);
+ // Scrollen verbieten
+ sal_uIntPtr nStat=pOutlView->GetControlWord();
+ nStat&=~EV_CNTRL_AUTOSCROLL;
+ // AutoViewSize nur wenn nicht KontourFrame.
+ if (!bContourFrame) nStat|=EV_CNTRL_AUTOSIZE;
+ if (bTextFrame) {
+ sal_uInt16 nPixSiz=aHdl.GetHdlSize()*2+1;
+ nStat|=EV_CNTRL_INVONEMORE;
+ pOutlView->SetInvalidateMore(nPixSiz);
+ }
+ pOutlView->SetControlWord(nStat);
+ pOutlView->SetBackgroundColor( aBackground );
+ if (pText!=NULL)
+ {
+ pOutlView->SetAnchorMode((EVAnchorMode)(pText->GetOutlinerViewAnchorMode()));
+ pTextEditOutliner->SetFixedCellHeight(((const SdrTextFixedCellHeightItem&)pText->GetMergedItem(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue());
+ }
+ pOutlView->SetOutputArea(aTextEditArea);
+ pTextEditOutliner->SetUpdateMode(sal_True);
+ ImpInvalidateOutlinerView(*pOutlView);
+ return pOutlView;
+}
+
+sal_Bool SdrObjEditView::IsTextEditFrame() const
+{
+ SdrTextObj* pText = dynamic_cast< SdrTextObj* >( mxTextEditObj.get() );
+ return pText!=NULL && pText->IsTextFrame();
+}
+
+IMPL_LINK(SdrObjEditView,ImpOutlinerStatusEventHdl,EditStatus*,pEditStat)
+{
+ if(pTextEditOutliner )
+ {
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj * >( mxTextEditObj.get() );
+ if( pTextObj )
+ {
+ pTextObj->onEditOutlinerStatusEvent( pEditStat );
+ }
+ }
+ return 0;
+}
+
+IMPL_LINK(SdrObjEditView,ImpOutlinerCalcFieldValueHdl,EditFieldInfo*,pFI)
+{
+ bool bOk=false;
+ String& rStr=pFI->GetRepresentation();
+ rStr.Erase();
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mxTextEditObj.get() );
+ if (pTextObj!=NULL) {
+ Color* pTxtCol=NULL;
+ Color* pFldCol=NULL;
+ bOk=pTextObj->CalcFieldValue(pFI->GetField(),pFI->GetPara(),pFI->GetPos(),sal_True,pTxtCol,pFldCol,rStr);
+ if (bOk) {
+ if (pTxtCol!=NULL) {
+ pFI->SetTxtColor(*pTxtCol);
+ delete pTxtCol;
+ }
+ if (pFldCol!=NULL) {
+ pFI->SetFldColor(*pFldCol);
+ delete pFldCol;
+ } else {
+ pFI->SetFldColor(Color(COL_LIGHTGRAY)); // kann spaeter (357) raus
+ }
+ }
+ }
+ Outliner& rDrawOutl=pMod->GetDrawOutliner(pTextObj);
+ Link aDrawOutlLink=rDrawOutl.GetCalcFieldValueHdl();
+ if (!bOk && aDrawOutlLink.IsSet()) {
+ aDrawOutlLink.Call(pFI);
+ bOk = (sal_Bool)rStr.Len();
+ }
+ if (!bOk && aOldCalcFieldValueLink.IsSet()) {
+ return aOldCalcFieldValueLink.Call(pFI);
+ }
+ return 0;
+}
+
+sal_Bool SdrObjEditView::SdrBeginTextEdit(
+ SdrObject* pObj, SdrPageView* pPV, Window* pWin,
+ sal_Bool bIsNewObj, SdrOutliner* pGivenOutliner,
+ OutlinerView* pGivenOutlinerView,
+ sal_Bool bDontDeleteOutliner, sal_Bool bOnlyOneView,
+ sal_Bool bGrabFocus)
+{
+ SdrEndTextEdit();
+
+ if( dynamic_cast< SdrTextObj* >( pObj ) == 0 )
+ return sal_False; // currently only possible with text objects
+
+ if(bGrabFocus && pWin)
+ {
+ // attetion, this call may cause an EndTextEdit() call to this view
+ pWin->GrabFocus(); // to force the cursor into the edit view
+ }
+
+ bTextEditDontDelete=bDontDeleteOutliner && pGivenOutliner!=NULL;
+ bTextEditOnlyOneView=bOnlyOneView;
+ bTextEditNewObj=bIsNewObj;
+ const sal_uInt32 nWinAnz(PaintWindowCount());
+ sal_uInt32 i;
+ sal_Bool bBrk(sal_False);
+ // Abbruch, wenn kein Objekt angegeben.
+
+ if(!pObj)
+ {
+ bBrk = sal_True;
+ }
+
+ if(!bBrk && !pWin)
+ {
+ for(i = 0L; i < nWinAnz && !pWin; i++)
+ {
+ SdrPaintWindow* pPaintWindow = GetPaintWindow(i);
+
+ if(OUTDEV_WINDOW == pPaintWindow->GetOutputDevice().GetOutDevType())
+ {
+ pWin = (Window*)(&pPaintWindow->GetOutputDevice());
+ }
+ }
+
+ // Abbruch, wenn kein Window da.
+ if(!pWin)
+ {
+ bBrk = sal_True;
+ }
+ }
+
+ if(!bBrk && !pPV)
+ {
+ pPV = GetSdrPageView();
+
+ // Abbruch, wenn keine PageView zu dem Objekt vorhanden.
+ if(!pPV)
+ {
+ bBrk = sal_True;
+ }
+ }
+
+ if(pObj && pPV)
+ {
+ // Kein TextEdit an Objekten im gesperrten Layer
+ if(pPV->GetLockedLayers().IsSet(pObj->GetLayer()))
+ {
+ bBrk = sal_True;
+ }
+ }
+
+ if(pTextEditOutliner)
+ {
+ DBG_ERROR("SdrObjEditView::SdrBeginTextEdit() da stand noch ein alter Outliner rum");
+ delete pTextEditOutliner;
+ pTextEditOutliner = 0L;
+ }
+
+ if(!bBrk)
+ {
+ pTextEditWin=pWin;
+ pTextEditPV=pPV;
+ mxTextEditObj.reset( pObj );
+ pTextEditOutliner=pGivenOutliner;
+ if (pTextEditOutliner==NULL)
+ pTextEditOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, mxTextEditObj->GetModel() );
+
+ {
+ SvtAccessibilityOptions aOptions;
+ pTextEditOutliner->ForceAutoColor( aOptions.GetIsAutomaticFontColor() );
+ }
+
+ sal_Bool bEmpty = mxTextEditObj->GetOutlinerParaObject()==NULL;
+
+ aOldCalcFieldValueLink=pTextEditOutliner->GetCalcFieldValueHdl();
+ // Der FieldHdl muss von SdrBeginTextEdit gesetzt sein, da dor ein UpdateFields gerufen wird.
+ pTextEditOutliner->SetCalcFieldValueHdl(LINK(this,SdrObjEditView,ImpOutlinerCalcFieldValueHdl));
+ pTextEditOutliner->SetBeginPasteOrDropHdl(LINK(this,SdrObjEditView,BeginPasteOrDropHdl));
+ pTextEditOutliner->SetEndPasteOrDropHdl(LINK(this,SdrObjEditView, EndPasteOrDropHdl));
+
+ // It is just necessary to make the visualized page known. Set it.
+ pTextEditOutliner->setVisualizedPage(pPV ? pPV->GetPage() : 0);
+
+ pTextEditOutliner->SetTextObjNoInit( dynamic_cast< SdrTextObj* >( mxTextEditObj.get() ) );
+
+ if(mxTextEditObj->BegTextEdit(*pTextEditOutliner))
+ {
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mxTextEditObj.get() );
+ DBG_ASSERT( pTextObj, "svx::SdrObjEditView::BegTextEdit(), no text object?" );
+ if( !pTextObj )
+ return sal_False;
+
+ // #111096# Switch off evtl. running TextAnimation
+ pTextObj->SetTextAnimationAllowed(sal_False);
+
+ // alten Cursor merken
+ if (pTextEditOutliner->GetViewCount()!=0)
+ {
+ OutlinerView* pTmpOLV=pTextEditOutliner->RemoveView(sal_uIntPtr(0));
+ if(pTmpOLV!=NULL && pTmpOLV!=pGivenOutlinerView)
+ delete pTmpOLV;
+ }
+
+ // EditArea ueberTakeTextEditArea bestimmen
+ // Das koennte eigentlich entfallen, da TakeTextRect() die Berechnung der aTextEditArea vornimmt
+ // Die aMinTextEditArea muss jedoch wohl auch erfolgen (darum bleibt es voerst drinnen)
+ pTextObj->TakeTextEditArea(NULL,NULL,&aTextEditArea,&aMinTextEditArea);
+
+ Rectangle aTextRect;
+ Rectangle aAnchorRect;
+ pTextObj->TakeTextRect(*pTextEditOutliner, aTextRect, sal_True,
+ &aAnchorRect /* #97097# Give sal_True here, not sal_False */);
+
+ if ( !pTextObj->IsContourTextFrame() )
+ {
+ // FitToSize erstmal nicht mit ContourFrame
+ SdrFitToSizeType eFit = pTextObj->GetFitToSize();
+ if (eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES)
+ aTextRect = aAnchorRect;
+ }
+
+ aTextEditArea = aTextRect;
+
+ // #108784#
+ Point aPvOfs(pTextObj->GetTextEditOffset());
+
+ aTextEditArea.Move(aPvOfs.X(),aPvOfs.Y());
+ aMinTextEditArea.Move(aPvOfs.X(),aPvOfs.Y());
+ pTextEditCursorMerker=pWin->GetCursor();
+
+ aHdl.SetMoveOutside(sal_True);
+
+ // #i72757#
+ // Since IsMarkHdlWhenTextEdit() is ignored, it is necessary
+ // to call AdjustMarkHdl() always.
+ AdjustMarkHdl();
+
+ pTextEditOutlinerView=ImpMakeOutlinerView(pWin,!bEmpty,pGivenOutlinerView);
+
+ // check if this view is already inserted
+ sal_uIntPtr i2,nCount = pTextEditOutliner->GetViewCount();
+ for( i2 = 0; i2 < nCount; i2++ )
+ {
+ if( pTextEditOutliner->GetView(i2) == pTextEditOutlinerView )
+ break;
+ }
+
+ if( i2 == nCount )
+ pTextEditOutliner->InsertView(pTextEditOutlinerView,0);
+
+ aHdl.SetMoveOutside(sal_False);
+ aHdl.SetMoveOutside(sal_True);
+ //OLMRefreshAllIAOManagers();
+
+ // alle Wins als OutlinerView beim Outliner anmelden
+ if(!bOnlyOneView)
+ {
+ for(i = 0L; i < nWinAnz; i++)
+ {
+ SdrPaintWindow* pPaintWindow = GetPaintWindow(i);
+ OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
+
+ if(&rOutDev != pWin && OUTDEV_WINDOW == rOutDev.GetOutDevType())
+ {
+ OutlinerView* pOutlView = ImpMakeOutlinerView((Window*)(&rOutDev), !bEmpty, 0L);
+ pTextEditOutliner->InsertView(pOutlView, (sal_uInt16)i);
+ }
+ }
+ }
+
+ pTextEditOutlinerView->ShowCursor();
+ pTextEditOutliner->SetStatusEventHdl(LINK(this,SdrObjEditView,ImpOutlinerStatusEventHdl));
+#ifdef DBG_UTIL
+ if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
+#endif
+ pTextEditOutliner->ClearModifyFlag();
+
+ // #71519#, #91453#
+ if(pWin)
+ {
+ sal_Bool bExtraInvalidate(sal_False);
+
+ // #71519#
+ if(!bExtraInvalidate)
+ {
+ SdrFitToSizeType eFit = pTextObj->GetFitToSize();
+ if(eFit == SDRTEXTFIT_PROPORTIONAL || eFit == SDRTEXTFIT_ALLLINES)
+ bExtraInvalidate = sal_True;
+ }
+
+ if(bExtraInvalidate)
+ {
+ pWin->Invalidate(aTextEditArea);
+ }
+ }
+
+ // send HINT_BEGEDIT #99840#
+ if( GetModel() )
+ {
+ SdrHint aHint(*pTextObj);
+ aHint.SetKind(HINT_BEGEDIT);
+ GetModel()->Broadcast(aHint);
+ }
+
+ pTextEditOutliner->setVisualizedPage(0);
+
+ if( mxSelectionController.is() )
+ mxSelectionController->onSelectionHasChanged();
+
+ return sal_True; // Gut gelaufen, TextEdit laeuft nun
+ }
+ else
+ {
+ bBrk = sal_True;
+ pTextEditOutliner->SetCalcFieldValueHdl(aOldCalcFieldValueLink);
+ pTextEditOutliner->SetBeginPasteOrDropHdl(Link());
+ pTextEditOutliner->SetEndPasteOrDropHdl(Link());
+
+ }
+ }
+ if (pTextEditOutliner != NULL)
+ {
+ pTextEditOutliner->setVisualizedPage(0);
+ }
+
+ // wenn hier angekommen, dann ist irgendwas schief gelaufen
+ if(!bDontDeleteOutliner)
+ {
+ if(pGivenOutliner!=NULL)
+ {
+ delete pGivenOutliner;
+ pTextEditOutliner = NULL;
+ }
+ if(pGivenOutlinerView!=NULL)
+ {
+ delete pGivenOutlinerView;
+ pGivenOutlinerView = NULL;
+ }
+ }
+ if( pTextEditOutliner!=NULL )
+ {
+ delete pTextEditOutliner;
+ }
+
+ pTextEditOutliner=NULL;
+ pTextEditOutlinerView=NULL;
+ mxTextEditObj.reset(0);
+ pTextEditPV=NULL;
+ pTextEditWin=NULL;
+ //HMHif (bMarkHdlWhenTextEdit) {
+ //HMH HideMarkHdl();
+ //HMH}
+ aHdl.SetMoveOutside(sal_False);
+ //HMHShowMarkHdl();
+
+ return sal_False;
+}
+
+SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(sal_Bool bDontDeleteReally)
+{
+ SdrEndTextEditKind eRet=SDRENDTEXTEDIT_UNCHANGED;
+ SdrTextObj* pTEObj = dynamic_cast< SdrTextObj* >( mxTextEditObj.get() );
+ Window* pTEWin =pTextEditWin;
+ SdrOutliner* pTEOutliner =pTextEditOutliner;
+ OutlinerView* pTEOutlinerView=pTextEditOutlinerView;
+ Cursor* pTECursorMerker=pTextEditCursorMerker;
+
+ // send HINT_ENDEDIT #99840#
+ if( GetModel() && mxTextEditObj.is() )
+ {
+ SdrHint aHint(*mxTextEditObj.get());
+ aHint.SetKind(HINT_ENDEDIT);
+ GetModel()->Broadcast(aHint);
+ }
+
+ mxTextEditObj.reset(0);
+ pTextEditPV=NULL;
+ pTextEditWin=NULL;
+ pTextEditOutliner=NULL;
+ pTextEditOutlinerView=NULL;
+ pTextEditCursorMerker=NULL;
+ aTextEditArea=Rectangle();
+
+ if (pTEOutliner!=NULL)
+ {
+ sal_Bool bModified=pTEOutliner->IsModified();
+ if (pTEOutlinerView!=NULL)
+ {
+ pTEOutlinerView->HideCursor();
+ }
+ if (pTEObj!=NULL)
+ {
+ pTEOutliner->CompleteOnlineSpelling();
+
+ SdrUndoObjSetText* pTxtUndo = 0;
+
+ if( bModified )
+ {
+ sal_Int32 nText;
+ for( nText = 0; nText < pTEObj->getTextCount(); ++nText )
+ if( pTEObj->getText( nText ) == pTEObj->getActiveText() )
+ break;
+
+ pTxtUndo = dynamic_cast< SdrUndoObjSetText* >( GetModel()->GetSdrUndoFactory().CreateUndoObjectSetText(*pTEObj, nText ) );
+ }
+ DBG_ASSERT( !bModified || pTxtUndo, "svx::SdrObjEditView::EndTextEdit(), could not create undo action!" );
+ // Den alten CalcFieldValue-Handler wieder setzen
+ // Muss vor Obj::EndTextEdit() geschehen, da dort ein UpdateFields() gemacht wird.
+ pTEOutliner->SetCalcFieldValueHdl(aOldCalcFieldValueLink);
+ pTEOutliner->SetBeginPasteOrDropHdl(Link());
+ pTEOutliner->SetEndPasteOrDropHdl(Link());
+
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ {
+ XubString aObjName;
+ pTEObj->TakeObjNameSingul(aObjName);
+ BegUndo(ImpGetResStr(STR_UndoObjSetText),aObjName);
+ }
+
+ pTEObj->EndTextEdit(*pTEOutliner);
+
+ if( (pTEObj->GetRotateAngle() != 0) || (pTEObj && pTEObj->ISA(SdrTextObj) && ((SdrTextObj*)pTEObj)->IsFontwork()) )
+ {
+ // obviously a repaint
+ pTEObj->ActionChanged();
+ }
+
+ if (pTxtUndo!=NULL)
+ {
+ pTxtUndo->AfterSetText();
+ if (!pTxtUndo->IsDifferent())
+ {
+ delete pTxtUndo;
+ pTxtUndo=NULL;
+ }
+ }
+ // Loeschung des gesamten TextObj checken
+ SdrUndoAction* pDelUndo=NULL;
+ sal_Bool bDelObj=sal_False;
+ SdrTextObj* pTextObj=PTR_CAST(SdrTextObj,pTEObj);
+ if (pTextObj!=NULL && bTextEditNewObj)
+ {
+ bDelObj=pTextObj->IsTextFrame() &&
+ !pTextObj->HasText() &&
+ !pTextObj->IsEmptyPresObj() &&
+ !pTextObj->HasFill() &&
+ !pTextObj->HasLine();
+
+ if(pTEObj->IsInserted() && bDelObj && pTextObj->GetObjInventor()==SdrInventor && !bDontDeleteReally)
+ {
+ SdrObjKind eIdent=(SdrObjKind)pTextObj->GetObjIdentifier();
+ if(eIdent==OBJ_TEXT || eIdent==OBJ_TEXTEXT)
+ {
+ pDelUndo= GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pTEObj);
+ }
+ }
+ }
+ if (pTxtUndo!=NULL)
+ {
+ if( bUndo )
+ AddUndo(pTxtUndo);
+ eRet=SDRENDTEXTEDIT_CHANGED;
+ }
+ if (pDelUndo!=NULL)
+ {
+ if( bUndo )
+ {
+ AddUndo(pDelUndo);
+ }
+ else
+ {
+ delete pDelUndo;
+ }
+ eRet=SDRENDTEXTEDIT_DELETED;
+ DBG_ASSERT(pTEObj->GetObjList()!=NULL,"SdrObjEditView::SdrEndTextEdit(): Fatal: Editiertes Objekt hat keine ObjList!");
+ if (pTEObj->GetObjList()!=NULL)
+ {
+ pTEObj->GetObjList()->RemoveObject(pTEObj->GetOrdNum());
+ CheckMarked(); // und gleich die Maekierung entfernen...
+ }
+ }
+ else if (bDelObj)
+ { // Fuer den Writer: Loeschen muss die App nachholen.
+ eRet=SDRENDTEXTEDIT_SHOULDBEDELETED;
+ }
+
+ if( bUndo )
+ EndUndo(); // EndUndo hinter Remove, falls der UndoStack gleich weggehaun' wird
+
+ // #111096#
+ // Switch on evtl. TextAnimation again after TextEdit
+ if(pTEObj->ISA(SdrTextObj))
+ {
+ ((SdrTextObj*)pTEObj)->SetTextAnimationAllowed(sal_True);
+ }
+
+ // #i72757#
+ // Since IsMarkHdlWhenTextEdit() is ignored, it is necessary
+ // to call AdjustMarkHdl() always.
+ AdjustMarkHdl();
+ }
+ // alle OutlinerViews loeschen
+ for (sal_uIntPtr i=pTEOutliner->GetViewCount(); i>0;)
+ {
+ i--;
+ OutlinerView* pOLV=pTEOutliner->GetView(i);
+ sal_uInt16 nMorePix=pOLV->GetInvalidateMore() + 10; // solaris aw033 test #i#
+ Window* pWin=pOLV->GetWindow();
+ Rectangle aRect(pOLV->GetOutputArea());
+ pTEOutliner->RemoveView(i);
+ if (!bTextEditDontDelete || i!=0)
+ {
+ // die nullte gehoert mir u.U. nicht.
+ delete pOLV;
+ }
+ aRect.Union(aTextEditArea);
+ aRect.Union(aMinTextEditArea);
+ aRect=pWin->LogicToPixel(aRect);
+ aRect.Left()-=nMorePix;
+ aRect.Top()-=nMorePix;
+ aRect.Right()+=nMorePix;
+ aRect.Bottom()+=nMorePix;
+ aRect=pWin->PixelToLogic(aRect);
+ InvalidateOneWin(*pWin,aRect);
+// pWin->Invalidate(INVALIDATE_UPDATE);
+
+// pWin->Update();
+// pWin->Flush();
+ pWin->SetFillColor();
+ pWin->SetLineColor(COL_BLACK);
+ pWin->DrawPixel(aRect.TopLeft());
+ pWin->DrawPixel(aRect.TopRight());
+ pWin->DrawPixel(aRect.BottomLeft());
+ pWin->DrawPixel(aRect.BottomRight());
+ //pWin->DrawRect(aRect);
+ }
+ // und auch den Outliner selbst
+ if (!bTextEditDontDelete) delete pTEOutliner;
+ else pTEOutliner->Clear();
+ if (pTEWin!=NULL) {
+ pTEWin->SetCursor(pTECursorMerker);
+ }
+//HMH if (bMarkHdlWhenTextEdit) {
+//HMH HideMarkHdl();
+//HMH }
+ aHdl.SetMoveOutside(sal_False);
+ if (eRet!=SDRENDTEXTEDIT_UNCHANGED)
+//HMH {
+//HMH ShowMarkHdl(); // Handles kommen ansonsten via Broadcast
+//HMH }
+//HMH else
+ {
+ GetMarkedObjectListWriteAccess().SetNameDirty();
+ }
+#ifdef DBG_UTIL
+ if (pItemBrowser)
+ {
+ GetMarkedObjectListWriteAccess().SetNameDirty();
+ pItemBrowser->SetDirty();
+ }
+#endif
+ }
+
+ // #108784#
+ if( pTEObj &&
+ pTEObj->GetModel() &&
+ !pTEObj->GetModel()->isLocked() &&
+ pTEObj->GetBroadcaster())
+ {
+ SdrHint aHint(HINT_ENDEDIT);
+ aHint.SetObject(pTEObj);
+ ((SfxBroadcaster*)pTEObj->GetBroadcaster())->Broadcast(aHint);
+ }
+
+ return eRet;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// info about TextEdit. Default is sal_False.
+bool SdrObjEditView::IsTextEdit() const
+{
+ return mxTextEditObj.is();
+}
+
+// info about TextEditPageView. Default is 0L.
+SdrPageView* SdrObjEditView::GetTextEditPageView() const
+{
+ return pTextEditPV;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+OutlinerView* SdrObjEditView::ImpFindOutlinerView(Window* pWin) const
+{
+ if (pWin==NULL) return NULL;
+ if (pTextEditOutliner==NULL) return NULL;
+ OutlinerView* pNewView=NULL;
+ sal_uIntPtr nWinAnz=pTextEditOutliner->GetViewCount();
+ for (sal_uIntPtr i=0; i<nWinAnz && pNewView==NULL; i++) {
+ OutlinerView* pView=pTextEditOutliner->GetView(i);
+ if (pView->GetWindow()==pWin) pNewView=pView;
+ }
+ return pNewView;
+}
+
+void SdrObjEditView::SetTextEditWin(Window* pWin)
+{
+ if(mxTextEditObj.is() && pWin!=NULL && pWin!=pTextEditWin)
+ {
+ OutlinerView* pNewView=ImpFindOutlinerView(pWin);
+ if (pNewView!=NULL && pNewView!=pTextEditOutlinerView)
+ {
+ if (pTextEditOutlinerView!=NULL)
+ {
+ pTextEditOutlinerView->HideCursor();
+ }
+ pTextEditOutlinerView=pNewView;
+ pTextEditWin=pWin;
+ pWin->GrabFocus(); // Damit der Cursor hier auch blinkt
+ pNewView->ShowCursor();
+ ImpMakeTextCursorAreaVisible();
+ }
+ }
+}
+
+sal_Bool SdrObjEditView::IsTextEditHit(const Point& rHit, short nTol) const
+{
+ sal_Bool bOk=sal_False;
+ if(mxTextEditObj.is())
+ {
+ nTol=ImpGetHitTolLogic(nTol,NULL);
+ // nur drittel Toleranz hier, damit die Handles
+ // noch vernuenftig getroffen werden koennen
+ nTol=nTol/3;
+ nTol=0; // Joe am 6.3.1997: Keine Hittoleranz mehr hier
+ if (!bOk)
+ {
+ Rectangle aEditArea;
+ OutlinerView* pOLV=pTextEditOutliner->GetView(0);
+ if (pOLV!=NULL)
+ {
+ aEditArea.Union(pOLV->GetOutputArea());
+ }
+ aEditArea.Left()-=nTol;
+ aEditArea.Top()-=nTol;
+ aEditArea.Right()+=nTol;
+ aEditArea.Bottom()+=nTol;
+ bOk=aEditArea.IsInside(rHit);
+ if (bOk)
+ { // Nun noch checken, ob auch wirklich Buchstaben getroffen wurden
+ Point aPnt(rHit); aPnt-=aEditArea.TopLeft();
+ long nHitTol = 2000;
+ OutputDevice* pRef = pTextEditOutliner->GetRefDevice();
+ if( pRef )
+ nHitTol = pRef->LogicToLogic( nHitTol, MAP_100TH_MM, pRef->GetMapMode().GetMapUnit() );
+
+ bOk = pTextEditOutliner->IsTextPos( aPnt, (sal_uInt16)nHitTol );
+ }
+ }
+ }
+ return bOk;
+}
+
+sal_Bool SdrObjEditView::IsTextEditFrameHit(const Point& rHit) const
+{
+ sal_Bool bOk=sal_False;
+ if(mxTextEditObj.is())
+ {
+ SdrTextObj* pText= dynamic_cast<SdrTextObj*>(mxTextEditObj.get());
+ OutlinerView* pOLV=pTextEditOutliner->GetView(0);
+ if( pOLV )
+ {
+ Window* pWin=pOLV->GetWindow();
+ if (pText!=NULL && pText->IsTextFrame() && pOLV!=NULL && pWin!=NULL) {
+ sal_uInt16 nPixSiz=pOLV->GetInvalidateMore();
+ Rectangle aEditArea(aMinTextEditArea);
+ aEditArea.Union(pOLV->GetOutputArea());
+ if (!aEditArea.IsInside(rHit)) {
+ Size aSiz(pWin->PixelToLogic(Size(nPixSiz,nPixSiz)));
+ aEditArea.Left()-=aSiz.Width();
+ aEditArea.Top()-=aSiz.Height();
+ aEditArea.Right()+=aSiz.Width();
+ aEditArea.Bottom()+=aSiz.Height();
+ bOk=aEditArea.IsInside(rHit);
+ }
+ }
+ }
+ }
+ return bOk;
+}
+
+void SdrObjEditView::AddTextEditOfs(MouseEvent& rMEvt) const
+{
+ if(mxTextEditObj.is())
+ {
+ Point aPvOfs;
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mxTextEditObj.get() );
+
+ if( pTextObj )
+ {
+ // #108784#
+ aPvOfs += pTextObj->GetTextEditOffset();
+ }
+
+ Point aObjOfs(mxTextEditObj->GetLogicRect().TopLeft());
+ (Point&)(rMEvt.GetPosPixel())+=aPvOfs+aObjOfs;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_Bool SdrObjEditView::KeyInput(const KeyEvent& rKEvt, Window* pWin)
+{
+ if(pTextEditOutlinerView)
+ {
+#ifdef DBG_UTIL
+ if(rKEvt.GetKeyCode().GetCode() == KEY_RETURN && pTextEditOutliner->GetParagraphCount() == 1)
+ {
+ ByteString aLine(
+ pTextEditOutliner->GetText(pTextEditOutliner->GetParagraph( 0 ), 1),
+ gsl_getSystemTextEncoding());
+ aLine = aLine.ToUpperAscii();
+
+ if(aLine == "HELLO JOE, PLEASE SHOW THE ITEMBROWSER")
+ ShowItemBrowser();
+ }
+#endif
+ if (pTextEditOutlinerView->PostKeyEvent(rKEvt))
+ {
+ if( pMod /* && !pMod->IsChanged() */ )
+ {
+ if( pTextEditOutliner && pTextEditOutliner->IsModified() )
+ pMod->SetChanged( sal_True );
+ }
+
+ if (pWin!=NULL && pWin!=pTextEditWin) SetTextEditWin(pWin);
+#ifdef DBG_UTIL
+ if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
+#endif
+ ImpMakeTextCursorAreaVisible();
+ return sal_True;
+ }
+ }
+ return SdrGlueEditView::KeyInput(rKEvt,pWin);
+}
+
+sal_Bool SdrObjEditView::MouseButtonDown(const MouseEvent& rMEvt, Window* pWin)
+{
+ if (pTextEditOutlinerView!=NULL) {
+ sal_Bool bPostIt=pTextEditOutliner->IsInSelectionMode();
+ if (!bPostIt) {
+ Point aPt(rMEvt.GetPosPixel());
+ if (pWin!=NULL) aPt=pWin->PixelToLogic(aPt);
+ else if (pTextEditWin!=NULL) aPt=pTextEditWin->PixelToLogic(aPt);
+ bPostIt=IsTextEditHit(aPt,nHitTolLog);
+ }
+ if (bPostIt) {
+ Point aPixPos(rMEvt.GetPosPixel());
+ Rectangle aR(pWin->LogicToPixel(pTextEditOutlinerView->GetOutputArea()));
+ if (aPixPos.X()<aR.Left ()) aPixPos.X()=aR.Left ();
+ if (aPixPos.X()>aR.Right ()) aPixPos.X()=aR.Right ();
+ if (aPixPos.Y()<aR.Top ()) aPixPos.Y()=aR.Top ();
+ if (aPixPos.Y()>aR.Bottom()) aPixPos.Y()=aR.Bottom();
+ MouseEvent aMEvt(aPixPos,rMEvt.GetClicks(),rMEvt.GetMode(),
+ rMEvt.GetButtons(),rMEvt.GetModifier());
+ if (pTextEditOutlinerView->MouseButtonDown(aMEvt)) {
+ if (pWin!=NULL && pWin!=pTextEditWin) SetTextEditWin(pWin);
+#ifdef DBG_UTIL
+ if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
+#endif
+ ImpMakeTextCursorAreaVisible();
+ return sal_True;
+ }
+ }
+ }
+ return SdrGlueEditView::MouseButtonDown(rMEvt,pWin);
+}
+
+sal_Bool SdrObjEditView::MouseButtonUp(const MouseEvent& rMEvt, Window* pWin)
+{
+ if (pTextEditOutlinerView!=NULL) {
+ sal_Bool bPostIt=pTextEditOutliner->IsInSelectionMode();
+ if (!bPostIt) {
+ Point aPt(rMEvt.GetPosPixel());
+ if (pWin!=NULL) aPt=pWin->PixelToLogic(aPt);
+ else if (pTextEditWin!=NULL) aPt=pTextEditWin->PixelToLogic(aPt);
+ bPostIt=IsTextEditHit(aPt,nHitTolLog);
+ }
+ if (bPostIt) {
+ Point aPixPos(rMEvt.GetPosPixel());
+ Rectangle aR(pWin->LogicToPixel(pTextEditOutlinerView->GetOutputArea()));
+ if (aPixPos.X()<aR.Left ()) aPixPos.X()=aR.Left ();
+ if (aPixPos.X()>aR.Right ()) aPixPos.X()=aR.Right ();
+ if (aPixPos.Y()<aR.Top ()) aPixPos.Y()=aR.Top ();
+ if (aPixPos.Y()>aR.Bottom()) aPixPos.Y()=aR.Bottom();
+ MouseEvent aMEvt(aPixPos,rMEvt.GetClicks(),rMEvt.GetMode(),
+ rMEvt.GetButtons(),rMEvt.GetModifier());
+ if (pTextEditOutlinerView->MouseButtonUp(aMEvt)) {
+#ifdef DBG_UTIL
+ if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
+#endif
+ ImpMakeTextCursorAreaVisible();
+ return sal_True;
+ }
+ }
+ }
+ return SdrGlueEditView::MouseButtonUp(rMEvt,pWin);
+}
+
+sal_Bool SdrObjEditView::MouseMove(const MouseEvent& rMEvt, Window* pWin)
+{
+ if (pTextEditOutlinerView!=NULL) {
+ sal_Bool bSelMode=pTextEditOutliner->IsInSelectionMode();
+ sal_Bool bPostIt=bSelMode;
+ if (!bPostIt) {
+ Point aPt(rMEvt.GetPosPixel());
+ if (pWin!=NULL) aPt=pWin->PixelToLogic(aPt);
+ else if (pTextEditWin!=NULL) aPt=pTextEditWin->PixelToLogic(aPt);
+ bPostIt=IsTextEditHit(aPt,nHitTolLog);
+ }
+ if (bPostIt) {
+ Point aPixPos(rMEvt.GetPosPixel());
+ Rectangle aR(pWin->LogicToPixel(pTextEditOutlinerView->GetOutputArea()));
+ if (aPixPos.X()<aR.Left ()) aPixPos.X()=aR.Left ();
+ if (aPixPos.X()>aR.Right ()) aPixPos.X()=aR.Right ();
+ if (aPixPos.Y()<aR.Top ()) aPixPos.Y()=aR.Top ();
+ if (aPixPos.Y()>aR.Bottom()) aPixPos.Y()=aR.Bottom();
+ MouseEvent aMEvt(aPixPos,rMEvt.GetClicks(),rMEvt.GetMode(),
+ rMEvt.GetButtons(),rMEvt.GetModifier());
+ if (pTextEditOutlinerView->MouseMove(aMEvt) && bSelMode) {
+#ifdef DBG_UTIL
+ if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
+#endif
+ ImpMakeTextCursorAreaVisible();
+ return sal_True;
+ }
+ }
+ }
+ return SdrGlueEditView::MouseMove(rMEvt,pWin);
+}
+
+sal_Bool SdrObjEditView::Command(const CommandEvent& rCEvt, Window* pWin)
+{
+ // solange bis die OutlinerView einen sal_Bool zurueckliefert
+ // bekommt sie nur COMMAND_STARTDRAG
+ if (pTextEditOutlinerView!=NULL)
+ {
+ if (rCEvt.GetCommand()==COMMAND_STARTDRAG) {
+ sal_Bool bPostIt=pTextEditOutliner->IsInSelectionMode() || !rCEvt.IsMouseEvent();
+ if (!bPostIt && rCEvt.IsMouseEvent()) {
+ Point aPt(rCEvt.GetMousePosPixel());
+ if (pWin!=NULL) aPt=pWin->PixelToLogic(aPt);
+ else if (pTextEditWin!=NULL) aPt=pTextEditWin->PixelToLogic(aPt);
+ bPostIt=IsTextEditHit(aPt,nHitTolLog);
+ }
+ if (bPostIt) {
+ Point aPixPos(rCEvt.GetMousePosPixel());
+ if (rCEvt.IsMouseEvent()) {
+ Rectangle aR(pWin->LogicToPixel(pTextEditOutlinerView->GetOutputArea()));
+ if (aPixPos.X()<aR.Left ()) aPixPos.X()=aR.Left ();
+ if (aPixPos.X()>aR.Right ()) aPixPos.X()=aR.Right ();
+ if (aPixPos.Y()<aR.Top ()) aPixPos.Y()=aR.Top ();
+ if (aPixPos.Y()>aR.Bottom()) aPixPos.Y()=aR.Bottom();
+ }
+ CommandEvent aCEvt(aPixPos,rCEvt.GetCommand(),rCEvt.IsMouseEvent());
+ // Command ist an der OutlinerView leider void
+ pTextEditOutlinerView->Command(aCEvt);
+ if (pWin!=NULL && pWin!=pTextEditWin) SetTextEditWin(pWin);
+#ifdef DBG_UTIL
+ if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
+#endif
+ ImpMakeTextCursorAreaVisible();
+ return sal_True;
+ }
+ }
+ else // if (rCEvt.GetCommand() == COMMAND_VOICE )
+ {
+ pTextEditOutlinerView->Command(rCEvt);
+ return sal_True;
+ }
+ }
+ return SdrGlueEditView::Command(rCEvt,pWin);
+}
+
+sal_Bool SdrObjEditView::Cut(sal_uIntPtr nFormat)
+{
+ if (pTextEditOutliner!=NULL) {
+ pTextEditOutlinerView->Cut();
+#ifdef DBG_UTIL
+ if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
+#endif
+ ImpMakeTextCursorAreaVisible();
+ return sal_True;
+ } else {
+ return SdrGlueEditView::Cut(nFormat);
+ }
+}
+
+sal_Bool SdrObjEditView::Yank(sal_uIntPtr nFormat)
+{
+ if (pTextEditOutliner!=NULL) {
+ pTextEditOutlinerView->Copy();
+ return sal_True;
+ } else {
+ return SdrGlueEditView::Yank(nFormat);
+ }
+}
+
+sal_Bool SdrObjEditView::Paste(Window* pWin, sal_uIntPtr nFormat)
+{
+ if (pTextEditOutliner!=NULL) {
+ if (pWin!=NULL) {
+ OutlinerView* pNewView=ImpFindOutlinerView(pWin);
+ if (pNewView!=NULL) {
+ pNewView->Paste();
+ }
+ } else {
+ pTextEditOutlinerView->Paste();
+ }
+#ifdef DBG_UTIL
+ if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
+#endif
+ ImpMakeTextCursorAreaVisible();
+ return sal_True;
+ } else {
+ return SdrGlueEditView::Paste(pWin,nFormat);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_Bool SdrObjEditView::ImpIsTextEditAllSelected() const
+{
+ sal_Bool bRet=sal_False;
+ if (pTextEditOutliner!=NULL && pTextEditOutlinerView!=NULL)
+ {
+ if(SdrTextObj::HasTextImpl( pTextEditOutliner ) )
+ {
+ const sal_uInt32 nParaAnz=pTextEditOutliner->GetParagraphCount();
+ Paragraph* pLastPara=pTextEditOutliner->GetParagraph( nParaAnz > 1 ? nParaAnz - 1 : 0 );
+
+ ESelection aESel(pTextEditOutlinerView->GetSelection());
+ if (aESel.nStartPara==0 && aESel.nStartPos==0 && aESel.nEndPara==sal_uInt16(nParaAnz-1))
+ {
+ XubString aStr(pTextEditOutliner->GetText(pLastPara));
+
+ if(aStr.Len() == aESel.nEndPos)
+ bRet = sal_True;
+ }
+ // und nun auch noch fuer den Fall, das rueckwaerts selektiert wurde
+ if (!bRet && aESel.nEndPara==0 && aESel.nEndPos==0 && aESel.nStartPara==sal_uInt16(nParaAnz-1))
+ {
+ XubString aStr(pTextEditOutliner->GetText(pLastPara));
+
+ if(aStr.Len() == aESel.nStartPos)
+ bRet = sal_True;
+ }
+ }
+ else
+ {
+ bRet=sal_True;
+ }
+ }
+ return bRet;
+}
+
+void SdrObjEditView::ImpMakeTextCursorAreaVisible()
+{
+ if (pTextEditOutlinerView!=NULL && pTextEditWin!=NULL) {
+ Cursor* pCsr=pTextEditWin->GetCursor();
+ if (pCsr!=NULL) {
+ Size aSiz(pCsr->GetSize());
+ if (aSiz.Width()!=0 && aSiz.Height()!=0) { // #38450#
+ MakeVisible(Rectangle(pCsr->GetPos(),aSiz),*pTextEditWin);
+ }
+ }
+ }
+}
+
+sal_uInt16 SdrObjEditView::GetScriptType() const
+{
+ sal_uInt16 nScriptType = 0;
+
+ if( IsTextEdit() )
+ {
+ if( mxTextEditObj->GetOutlinerParaObject() )
+ nScriptType = mxTextEditObj->GetOutlinerParaObject()->GetTextObject().GetScriptType();
+
+ if( pTextEditOutlinerView )
+ nScriptType = pTextEditOutlinerView->GetSelectedScriptType();
+ }
+ else
+ {
+ sal_uInt32 nMarkCount( GetMarkedObjectCount() );
+
+ for( sal_uInt32 i = 0; i < nMarkCount; i++ )
+ {
+ OutlinerParaObject* pParaObj = GetMarkedObjectByIndex( i )->GetOutlinerParaObject();
+
+ if( pParaObj )
+ {
+ nScriptType |= pParaObj->GetTextObject().GetScriptType();
+ }
+ }
+ }
+
+ if( nScriptType == 0 )
+ nScriptType = SCRIPTTYPE_LATIN;
+
+ return nScriptType;
+}
+
+/* new interface src537 */
+sal_Bool SdrObjEditView::GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr) const
+{
+ if( mxSelectionController.is() )
+ if( mxSelectionController->GetAttributes( rTargetSet, bOnlyHardAttr ) )
+ return sal_True;
+
+ if(IsTextEdit())
+ {
+ DBG_ASSERT(pTextEditOutlinerView!=NULL,"SdrObjEditView::GetAttributes(): pTextEditOutlinerView=NULL");
+ DBG_ASSERT(pTextEditOutliner!=NULL,"SdrObjEditView::GetAttributes(): pTextEditOutliner=NULL");
+
+ // #92389# take care of bOnlyHardAttr(!)
+ if(!bOnlyHardAttr && mxTextEditObj->GetStyleSheet())
+ rTargetSet.Put(mxTextEditObj->GetStyleSheet()->GetItemSet());
+
+ // add object attributes
+ rTargetSet.Put( mxTextEditObj->GetMergedItemSet() );
+
+ if( mxTextEditObj->GetOutlinerParaObject() )
+ rTargetSet.Put( SvxScriptTypeItem( mxTextEditObj->GetOutlinerParaObject()->GetTextObject().GetScriptType() ) );
+
+ if(pTextEditOutlinerView)
+ {
+ // FALSE= InvalidItems nicht al Default, sondern als "Loecher" betrachten
+ rTargetSet.Put(pTextEditOutlinerView->GetAttribs(), sal_False);
+ rTargetSet.Put( SvxScriptTypeItem( pTextEditOutlinerView->GetSelectedScriptType() ), sal_False );
+ }
+
+ if(GetMarkedObjectCount()==1 && GetMarkedObjectByIndex(0)==mxTextEditObj.get())
+ {
+ MergeNotPersistAttrFromMarked(rTargetSet, bOnlyHardAttr);
+ }
+
+ return sal_True;
+ }
+ else
+ {
+ return SdrGlueEditView::GetAttributes(rTargetSet, bOnlyHardAttr);
+ }
+}
+
+sal_Bool SdrObjEditView::SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll)
+{
+ sal_Bool bRet=sal_False;
+ sal_Bool bTextEdit=pTextEditOutlinerView!=NULL && mxTextEditObj.is();
+ sal_Bool bAllTextSelected=ImpIsTextEditAllSelected();
+ SfxItemSet* pModifiedSet=NULL;
+ const SfxItemSet* pSet=&rSet;
+ //const SvxAdjustItem* pParaJust=NULL;
+
+ if (!bTextEdit)
+ {
+ // Kein TextEdit aktiv -> alle Items ans Zeichenobjekt
+ if( mxSelectionController.is() )
+ bRet=mxSelectionController->SetAttributes(*pSet,bReplaceAll );
+
+ if( !bRet )
+ {
+ bRet=SdrGlueEditView::SetAttributes(*pSet,bReplaceAll);
+ }
+ }
+ else
+ {
+#ifdef DBG_UTIL
+ {
+ sal_Bool bHasEEFeatureItems=sal_False;
+ SfxItemIter aIter(rSet);
+ const SfxPoolItem* pItem=aIter.FirstItem();
+ while (!bHasEEFeatureItems && pItem!=NULL)
+ {
+ if (!IsInvalidItem(pItem))
+ {
+ sal_uInt16 nW=pItem->Which();
+ if (nW>=EE_FEATURE_START && nW<=EE_FEATURE_END)
+ bHasEEFeatureItems=sal_True;
+ }
+
+ pItem=aIter.NextItem();
+ }
+
+ if(bHasEEFeatureItems)
+ {
+ String aMessage;
+ aMessage.AppendAscii("SdrObjEditView::SetAttributes(): Das setzen von EE_FEATURE-Items an der SdrView macht keinen Sinn! Es fuehrt nur zu Overhead und nicht mehr lesbaren Dokumenten.");
+ InfoBox(NULL, aMessage).Execute();
+ }
+ }
+#endif
+
+ sal_Bool bOnlyEEItems;
+ sal_Bool bNoEEItems=!SearchOutlinerItems(*pSet,bReplaceAll,&bOnlyEEItems);
+ // alles selektiert? -> Attrs auch an den Rahmen
+ // und falls keine EEItems, dann Attrs nur an den Rahmen
+ if (bAllTextSelected || bNoEEItems)
+ {
+ if( mxSelectionController.is() )
+ bRet=mxSelectionController->SetAttributes(*pSet,bReplaceAll );
+
+ if( !bRet )
+ {
+ const bool bUndo = IsUndoEnabled();
+
+ if( bUndo )
+ {
+ String aStr;
+ ImpTakeDescriptionStr(STR_EditSetAttributes,aStr);
+ BegUndo(aStr);
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*mxTextEditObj.get()));
+
+ // #i43537#
+ // If this is a text object also rescue the OutlinerParaObject since
+ // applying attributes to the object may change text layout when
+ // multiple portions exist with multiple formats. If a OutlinerParaObject
+ // really exists and needs to be rescued is evaluated in the undo
+ // implementation itself.
+ bool bRescueText = dynamic_cast< SdrTextObj* >(mxTextEditObj.get());
+
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*mxTextEditObj.get(),false,!bNoEEItems || bRescueText));
+ EndUndo();
+ }
+
+ mxTextEditObj->SetMergedItemSetAndBroadcast(*pSet, bReplaceAll);
+
+ FlushComeBackTimer(); // Damit ModeHasChanged sofort kommt
+ bRet=sal_True;
+ }
+ }
+ else if (!bOnlyEEItems)
+ {
+ // sonst Set ggf. splitten
+ // Es wird nun ein ItemSet aSet gemacht, in den die EE_Items von
+ // *pSet nicht enhalten ist (ansonsten ist es eine Kopie).
+ sal_uInt16* pNewWhichTable=RemoveWhichRange(pSet->GetRanges(),EE_ITEMS_START,EE_ITEMS_END);
+ SfxItemSet aSet(pMod->GetItemPool(),pNewWhichTable);
+ /*90353*/ delete[] pNewWhichTable;
+ SfxWhichIter aIter(aSet);
+ sal_uInt16 nWhich=aIter.FirstWhich();
+ while (nWhich!=0)
+ {
+ const SfxPoolItem* pItem;
+ SfxItemState eState=pSet->GetItemState(nWhich,sal_False,&pItem);
+ if (eState==SFX_ITEM_SET) aSet.Put(*pItem);
+ nWhich=aIter.NextWhich();
+ }
+
+
+ if( mxSelectionController.is() )
+ bRet=mxSelectionController->SetAttributes(aSet,bReplaceAll );
+
+ if( !bRet )
+ {
+ if( IsUndoEnabled() )
+ {
+ String aStr;
+ ImpTakeDescriptionStr(STR_EditSetAttributes,aStr);
+ BegUndo(aStr);
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*mxTextEditObj.get()));
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*mxTextEditObj.get(),false,false));
+ EndUndo();
+ }
+
+ mxTextEditObj->SetMergedItemSetAndBroadcast(aSet, bReplaceAll);
+
+ if (GetMarkedObjectCount()==1 && GetMarkedObjectByIndex(0)==mxTextEditObj.get())
+ {
+ SetNotPersistAttrToMarked(aSet,bReplaceAll);
+ }
+ }
+ FlushComeBackTimer();
+ bRet=sal_True;
+ }
+ if(!bNoEEItems)
+ {
+ // und nun die Attribute auch noch an die EditEngine
+ if (bReplaceAll) {
+ // Am Outliner kann man leider nur alle Attribute platthauen
+ pTextEditOutlinerView->RemoveAttribs( sal_True );
+ }
+ pTextEditOutlinerView->SetAttribs(rSet);
+
+#ifdef DBG_UTIL
+ if (pItemBrowser!=NULL)
+ pItemBrowser->SetDirty();
+#endif
+
+ ImpMakeTextCursorAreaVisible();
+ }
+ bRet=sal_True;
+ }
+ if (pModifiedSet!=NULL)
+ delete pModifiedSet;
+ return bRet;
+}
+
+SfxStyleSheet* SdrObjEditView::GetStyleSheet() const
+{
+ SfxStyleSheet* pSheet = 0;
+
+ if( mxSelectionController.is() )
+ {
+ if( mxSelectionController->GetStyleSheet( pSheet ) )
+ return pSheet;
+ }
+
+ if ( pTextEditOutlinerView )
+ {
+ pSheet = pTextEditOutlinerView->GetStyleSheet();
+ }
+ else
+ {
+ pSheet = SdrGlueEditView::GetStyleSheet();
+ }
+ return pSheet;
+}
+
+sal_Bool SdrObjEditView::SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr)
+{
+ if( mxSelectionController.is() )
+ {
+ if( mxSelectionController->SetStyleSheet( pStyleSheet, bDontRemoveHardAttr ) )
+ return sal_True;
+ }
+
+ // if we are currently in edit mode we must also set the stylesheet
+ // on all paragraphs in the Outliner for the edit view
+ // #92191#
+ if( NULL != pTextEditOutlinerView )
+ {
+ Outliner* pOutliner = pTextEditOutlinerView->GetOutliner();
+
+ const sal_uIntPtr nParaCount = pOutliner->GetParagraphCount();
+ sal_uIntPtr nPara;
+ for( nPara = 0; nPara < nParaCount; nPara++ )
+ {
+ pOutliner->SetStyleSheet( nPara, pStyleSheet );
+ }
+ }
+
+ return SdrGlueEditView::SetStyleSheet(pStyleSheet,bDontRemoveHardAttr);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrObjEditView::AddWindowToPaintView(OutputDevice* pNewWin)
+{
+ SdrGlueEditView::AddWindowToPaintView(pNewWin);
+
+ if(mxTextEditObj.is() && !bTextEditOnlyOneView && pNewWin->GetOutDevType()==OUTDEV_WINDOW)
+ {
+ OutlinerView* pOutlView=ImpMakeOutlinerView((Window*)pNewWin,sal_False,NULL);
+ pTextEditOutliner->InsertView(pOutlView);
+ }
+}
+
+void SdrObjEditView::DeleteWindowFromPaintView(OutputDevice* pOldWin)
+{
+ SdrGlueEditView::DeleteWindowFromPaintView(pOldWin);
+
+ if(mxTextEditObj.is() && !bTextEditOnlyOneView && pOldWin->GetOutDevType()==OUTDEV_WINDOW)
+ {
+ for (sal_uIntPtr i=pTextEditOutliner->GetViewCount(); i>0;) {
+ i--;
+ OutlinerView* pOLV=pTextEditOutliner->GetView(i);
+ if (pOLV && pOLV->GetWindow()==(Window*)pOldWin) {
+ delete pTextEditOutliner->RemoveView(i);
+ }
+ }
+ }
+}
+
+sal_Bool SdrObjEditView::IsTextEditInSelectionMode() const
+{
+ return pTextEditOutliner!=NULL && pTextEditOutliner->IsInSelectionMode();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@ @@ @@@@ @@@@ @@@@@ @@@@ @@ @@ @@@@ @@@@@ @@@@@
+// @@@ @@@ @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@@ @@ @@ @@ @@ @@
+// @@@@@@@ @@ @@ @@ @@ @@ @@ @@ @@@@@@@ @@ @@ @@ @@ @@
+// @@@@@@@ @@@@@@ @@ @@@@@ @@ @@ @@@@@@@ @@ @@ @@ @@ @@@@
+// @@ @ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@@@ @@ @@ @@@@ @@ @@ @@@@ @@@@@ @@@@@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_Bool SdrObjEditView::BegMacroObj(const Point& rPnt, short nTol, SdrObject* pObj, SdrPageView* pPV, Window* pWin)
+{
+ sal_Bool bRet=sal_False;
+ BrkMacroObj();
+ if (pObj!=NULL && pPV!=NULL && pWin!=NULL && pObj->HasMacro()) {
+ nTol=ImpGetHitTolLogic(nTol,NULL);
+ pMacroObj=pObj;
+ pMacroPV=pPV;
+ pMacroWin=pWin;
+ bMacroDown=sal_False;
+ nMacroTol=sal_uInt16(nTol);
+ aMacroDownPos=rPnt;
+ MovMacroObj(rPnt);
+ }
+ return bRet;
+}
+
+void SdrObjEditView::ImpMacroUp(const Point& rUpPos)
+{
+ if (pMacroObj!=NULL && bMacroDown)
+ {
+ SdrObjMacroHitRec aHitRec;
+ aHitRec.aPos=rUpPos;
+ aHitRec.aDownPos=aMacroDownPos;
+ aHitRec.nTol=nMacroTol;
+ aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
+ aHitRec.pPageView=pMacroPV;
+ aHitRec.pOut=pMacroWin;
+ pMacroObj->PaintMacro(*pMacroWin,Rectangle(),aHitRec);
+ bMacroDown=sal_False;
+ }
+}
+
+void SdrObjEditView::ImpMacroDown(const Point& rDownPos)
+{
+ if (pMacroObj!=NULL && !bMacroDown)
+ {
+ SdrObjMacroHitRec aHitRec;
+ aHitRec.aPos=rDownPos;
+ aHitRec.aDownPos=aMacroDownPos;
+ aHitRec.nTol=nMacroTol;
+ aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
+ aHitRec.pPageView=pMacroPV;
+ aHitRec.bDown=sal_True;
+ aHitRec.pOut=pMacroWin;
+ pMacroObj->PaintMacro(*pMacroWin,Rectangle(),aHitRec);
+ bMacroDown=sal_True;
+ }
+}
+
+void SdrObjEditView::MovMacroObj(const Point& rPnt)
+{
+ if (pMacroObj!=NULL) {
+ SdrObjMacroHitRec aHitRec;
+ aHitRec.aPos=rPnt;
+ aHitRec.aDownPos=aMacroDownPos;
+ aHitRec.nTol=nMacroTol;
+ aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
+ aHitRec.pPageView=pMacroPV;
+ aHitRec.bDown=bMacroDown;
+ aHitRec.pOut=pMacroWin;
+ sal_Bool bDown=pMacroObj->IsMacroHit(aHitRec);
+ if (bDown) ImpMacroDown(rPnt);
+ else ImpMacroUp(rPnt);
+ }
+}
+
+void SdrObjEditView::BrkMacroObj()
+{
+ if (pMacroObj!=NULL) {
+ ImpMacroUp(aMacroDownPos);
+ pMacroObj=NULL;
+ pMacroPV=NULL;
+ pMacroWin=NULL;
+ }
+}
+
+sal_Bool SdrObjEditView::EndMacroObj()
+{
+ if (pMacroObj!=NULL && bMacroDown) {
+ ImpMacroUp(aMacroDownPos);
+ SdrObjMacroHitRec aHitRec;
+ aHitRec.aPos=aMacroDownPos;
+ aHitRec.aDownPos=aMacroDownPos;
+ aHitRec.nTol=nMacroTol;
+ aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
+ aHitRec.pPageView=pMacroPV;
+ aHitRec.bDown=sal_True;
+ aHitRec.pOut=pMacroWin;
+ bool bRet=pMacroObj->DoMacro(aHitRec);
+ pMacroObj=NULL;
+ pMacroPV=NULL;
+ pMacroWin=NULL;
+ return bRet;
+ } else {
+ BrkMacroObj();
+ return sal_False;
+ }
+}
+
+/** fills the given any with a XTextCursor for the current text selection.
+ Leaves the any untouched if there currently is no text selected */
+void SdrObjEditView::getTextSelection( ::com::sun::star::uno::Any& rSelection )
+{
+ if( IsTextEdit() )
+ {
+ OutlinerView* pOutlinerView = GetTextEditOutlinerView();
+ if( pOutlinerView && pOutlinerView->HasSelection() )
+ {
+ SdrObject* pObj = GetTextEditObject();
+
+ if( pObj )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xText( pObj->getUnoShape(), ::com::sun::star::uno::UNO_QUERY );
+ if( xText.is() )
+ {
+ SvxUnoTextBase* pRange = SvxUnoTextBase::getImplementation( xText );
+ if( pRange )
+ {
+ rSelection <<= pRange->createTextCursorBySelection( pOutlinerView->GetSelection() );
+ }
+ }
+ }
+ }
+ }
+}
+
+namespace sdr { namespace table {
+extern rtl::Reference< sdr::SelectionController > CreateTableController( SdrObjEditView* pView, const SdrObject* pObj, const rtl::Reference< sdr::SelectionController >& xRefController );
+} }
+
+/* check if we have a single selection and that single object likes
+ to handle the mouse and keyboard events itself
+
+ @todo: the selection controller should be queried from the
+ object specific view contact. Currently this method only
+ works for tables.
+*/
+void SdrObjEditView::MarkListHasChanged()
+{
+ SdrGlueEditView::MarkListHasChanged();
+
+ if( mxSelectionController.is() )
+ {
+ mxLastSelectionController = mxSelectionController;
+ mxSelectionController->onSelectionHasChanged();
+ }
+
+ mxSelectionController.clear();
+
+ const SdrMarkList& rMarkList=GetMarkedObjectList();
+ if( rMarkList.GetMarkCount() == 1 )
+ {
+ const SdrObject* pObj= rMarkList.GetMark(0)->GetMarkedSdrObj();
+ // check for table
+ if( pObj && (pObj->GetObjInventor() == SdrInventor ) && (pObj->GetObjIdentifier() == OBJ_TABLE) )
+ {
+ mxSelectionController = sdr::table::CreateTableController( this, pObj, mxLastSelectionController );
+ if( mxSelectionController.is() )
+ {
+ mxLastSelectionController.clear();
+ mxSelectionController->onSelectionHasChanged();
+ }
+ }
+ }
+}
+
+IMPL_LINK( SdrObjEditView, EndPasteOrDropHdl, PasteOrDropInfos*, pInfos )
+{
+ OnEndPasteOrDrop( pInfos );
+ return 0;
+}
+
+IMPL_LINK( SdrObjEditView, BeginPasteOrDropHdl, PasteOrDropInfos*, pInfos )
+{
+ OnBeginPasteOrDrop( pInfos );
+ return 0;
+}
+
+void SdrObjEditView::OnBeginPasteOrDrop( PasteOrDropInfos* )
+{
+ // applications can derive from these virtual methods to do something before a drop or paste operation
+}
+
+void SdrObjEditView::OnEndPasteOrDrop( PasteOrDropInfos* )
+{
+ // applications can derive from these virtual methods to do something before a drop or paste operation
+}
+
+bool SdrObjEditView::SupportsFormatPaintbrush( sal_uInt32 nObjectInventor, sal_uInt16 nObjectIdentifier ) const
+{
+ if( nObjectInventor != SdrInventor && nObjectInventor != E3dInventor )
+ return false;
+ switch(nObjectIdentifier)
+ {
+ case OBJ_NONE:
+ case OBJ_GRUP:
+ return false;
+ case OBJ_LINE:
+ case OBJ_RECT:
+ case OBJ_CIRC:
+ case OBJ_SECT:
+ case OBJ_CARC:
+ case OBJ_CCUT:
+ case OBJ_POLY:
+ case OBJ_PLIN:
+ case OBJ_PATHLINE:
+ case OBJ_PATHFILL:
+ case OBJ_FREELINE:
+ case OBJ_FREEFILL:
+ case OBJ_SPLNLINE:
+ case OBJ_SPLNFILL:
+ case OBJ_TEXT:
+ case OBJ_TEXTEXT:
+ case OBJ_TITLETEXT:
+ case OBJ_OUTLINETEXT:
+ case OBJ_GRAF:
+ case OBJ_OLE2:
+ case OBJ_TABLE:
+ return true;
+ case OBJ_EDGE:
+ case OBJ_CAPTION:
+ return false;
+ case OBJ_PATHPOLY:
+ case OBJ_PATHPLIN:
+ return true;
+ case OBJ_PAGE:
+ case OBJ_MEASURE:
+ case OBJ_DUMMY:
+ case OBJ_FRAME:
+ case OBJ_UNO:
+ return false;
+ case OBJ_CUSTOMSHAPE:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static const sal_uInt16* GetFormatRangeImpl( bool bTextOnly )
+{
+ static const sal_uInt16 gRanges[] = {
+ SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST,
+ SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST,
+ SDRATTR_TABLE_FIRST, SDRATTR_TABLE_LAST,
+ XATTR_LINE_FIRST, XATTR_LINE_LAST,
+ XATTR_FILL_FIRST, XATTRSET_FILL,
+ EE_PARA_START, EE_PARA_END,
+ EE_CHAR_START, EE_CHAR_END,
+ 0,0
+ };
+ return &gRanges[ bTextOnly ? 10 : 0];
+}
+
+bool SdrObjEditView::TakeFormatPaintBrush( boost::shared_ptr< SfxItemSet >& rFormatSet )
+{
+ if( mxSelectionController.is() && mxSelectionController->TakeFormatPaintBrush(rFormatSet) )
+ return true;
+
+ const SdrMarkList& rMarkList = GetMarkedObjectList();
+ if( rMarkList.GetMarkCount() >= 1 )
+ {
+ OutlinerView* pOLV = GetTextEditOutlinerView();
+
+ rFormatSet.reset( new SfxItemSet( GetModel()->GetItemPool(), GetFormatRangeImpl( pOLV != NULL ) ) );
+ if( pOLV )
+ {
+ rFormatSet->Put( pOLV->GetAttribs() );
+ }
+ else
+ {
+ const sal_Bool bOnlyHardAttr = sal_False;
+ rFormatSet->Put( GetAttrFromMarked(bOnlyHardAttr) );
+ }
+ return true;
+ }
+
+ return false;
+}
+
+static SfxItemSet CreatePaintSet( const sal_uInt16 *pRanges, SfxItemPool& rPool, const SfxItemSet& rSourceSet, const SfxItemSet& rTargetSet, bool bNoCharacterFormats, bool bNoParagraphFormats )
+{
+ SfxItemSet aPaintSet( rPool, pRanges );
+
+ while( *pRanges )
+ {
+ sal_uInt16 nWhich = *pRanges++;
+ const sal_uInt16 nLastWhich = *pRanges++;
+
+ if( bNoCharacterFormats && (nWhich == EE_CHAR_START) )
+ continue;
+
+ if( bNoParagraphFormats && (nWhich == EE_PARA_START ) )
+ continue;
+
+ for( ; nWhich < nLastWhich; nWhich++ )
+ {
+ const SfxPoolItem* pSourceItem = rSourceSet.GetItem( nWhich );
+ const SfxPoolItem* pTargetItem = rTargetSet.GetItem( nWhich );
+
+ if( (pSourceItem && !pTargetItem) || (pSourceItem && pTargetItem && !((*pSourceItem) == (*pTargetItem)) ) )
+ {
+ aPaintSet.Put( *pSourceItem );
+ }
+ }
+ }
+ return aPaintSet;
+}
+
+void SdrObjEditView::ApplyFormatPaintBrushToText( SfxItemSet& rFormatSet, SdrTextObj& rTextObj, SdrText* pText, bool bNoCharacterFormats, bool bNoParagraphFormats )
+{
+ OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : 0;
+ if(pParaObj)
+ {
+ SdrOutliner& rOutliner = rTextObj.ImpGetDrawOutliner();
+ rOutliner.SetText(*pParaObj);
+
+ sal_uInt32 nParaCount(rOutliner.GetParagraphCount());
+
+ if(nParaCount)
+ {
+ for(sal_uInt16 nPara = 0; nPara < nParaCount; nPara++)
+ {
+ if( !bNoCharacterFormats )
+ rOutliner.QuickRemoveCharAttribs( nPara, /* remove all */0 );
+
+ SfxItemSet aSet(rOutliner.GetParaAttribs(nPara));
+ aSet.Put(CreatePaintSet( GetFormatRangeImpl(true), *aSet.GetPool(), rFormatSet, aSet, bNoCharacterFormats, bNoParagraphFormats ) );
+ rOutliner.SetParaAttribs(nPara, aSet);
+ }
+
+ OutlinerParaObject* pTemp = rOutliner.CreateParaObject(0, (sal_uInt16)nParaCount);
+ rOutliner.Clear();
+
+ rTextObj.NbcSetOutlinerParaObjectForText(pTemp,pText);
+ }
+ }
+}
+
+void SdrObjEditView::ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats )
+{
+ if( !mxSelectionController.is() || !mxSelectionController->ApplyFormatPaintBrush( rFormatSet, bNoCharacterFormats, bNoParagraphFormats ) )
+ {
+ const SdrMarkList& rMarkList = GetMarkedObjectList();
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ OutlinerView* pOLV = GetTextEditOutlinerView();
+
+ const SfxItemSet& rShapeSet = pObj->GetMergedItemSet();
+
+ if( !pOLV )
+ {
+ // if not in text edit mode (aka the user selected text or clicked on a word)
+ // apply formating attributes to selected shape
+ // All formating items (see ranges above) that are unequal in selected shape and
+ // the format paintbrush are hard set on the selected shape.
+
+ const sal_uInt16* pRanges = rFormatSet.GetRanges();
+ bool bTextOnly = true;
+
+ while( *pRanges )
+ {
+ if( (*pRanges != EE_PARA_START) && (*pRanges != EE_CHAR_START) )
+ {
+ bTextOnly = false;
+ break;
+ }
+ pRanges += 2;
+ }
+
+ if( !bTextOnly )
+ {
+ SfxItemSet aPaintSet( CreatePaintSet( GetFormatRangeImpl(false), *rShapeSet.GetPool(), rFormatSet, rShapeSet, bNoCharacterFormats, bNoParagraphFormats ) );
+ const sal_Bool bReplaceAll = sal_False;
+ SetAttrToMarked(aPaintSet, bReplaceAll);
+ }
+
+ // now apply character and paragraph formating to text, if the shape has any
+ SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(pObj);
+ if( pTextObj )
+ {
+ sal_Int32 nText = pTextObj->getTextCount();
+
+ while( --nText >= 0 )
+ {
+ SdrText* pText = pTextObj->getText( nText );
+ ApplyFormatPaintBrushToText( rFormatSet, *pTextObj, pText, bNoCharacterFormats, bNoParagraphFormats );
+ }
+ }
+ }
+ else
+ {
+ ::Outliner* pOutliner = pOLV->GetOutliner();
+ if( pOutliner )
+ {
+ const EditEngine& rEditEngine = pOutliner->GetEditEngine();
+
+ ESelection aSel( pOLV->GetSelection() );
+ if( !aSel.HasRange() )
+ pOLV->SetSelection( rEditEngine.GetWord( aSel, com::sun::star::i18n::WordType::DICTIONARY_WORD ) );
+
+ const sal_Bool bRemoveParaAttribs = !bNoParagraphFormats;
+ pOLV->RemoveAttribsKeepLanguages( bRemoveParaAttribs );
+ SfxItemSet aSet( pOLV->GetAttribs() );
+ SfxItemSet aPaintSet( CreatePaintSet(GetFormatRangeImpl(true), *aSet.GetPool(), rFormatSet, aSet, bNoCharacterFormats, bNoParagraphFormats ) );
+ pOLV->SetAttribs( aPaintSet );
+ }
+ }
+ }
+}
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx
new file mode 100644
index 000000000000..b68909ffa99a
--- /dev/null
+++ b/svx/source/svdraw/svdetc.cxx
@@ -0,0 +1,1118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "editeng/forbiddencharacterstable.hxx"
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <com/sun/star/embed/EmbedStates.hpp>
+#include <svx/svdetc.hxx>
+#include "svx/svditext.hxx"
+#include <svx/svdmodel.hxx>
+#include <svx/svdtrans.hxx>
+#include "svx/svdglob.hxx"
+#include "svx/svdstr.hrc"
+#include "svx/svdviter.hxx"
+#include <svx/svdview.hxx>
+#include <svx/svdoutl.hxx>
+#include <vcl/bmpacc.hxx>
+#include <editeng/eeitem.hxx>
+#include <svl/itemset.hxx>
+#include <tools/config.hxx>
+#include <unotools/cacheoptions.hxx>
+#include <svl/whiter.hxx>
+#include <tools/bigint.hxx>
+#include "editeng/fontitem.hxx"
+#include <editeng/colritem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <svx/xgrad.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xflhtit.hxx>
+#include <svx/xbtmpit.hxx>
+#include <svx/xflgrit.hxx>
+#include <svx/svdoole2.hxx>
+#include <svl/itempool.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+#include <comphelper/processfactory.hxx>
+#include <i18npool/lang.h>
+#include <unotools/charclass.hxx>
+#include <unotools/syslocale.hxx>
+#include <svx/xflbckit.hxx>
+#include <svx/extrusionbar.hxx>
+#include <svx/fontworkbar.hxx>
+#include <vcl/svapp.hxx> //add CHINA001
+#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdotable.hxx>
+#include <svx/sdrhittesthelper.hxx>
+
+using namespace ::com::sun::star;
+
+/******************************************************************************
+* Globale Daten der DrawingEngine
+******************************************************************************/
+
+SdrGlobalData::SdrGlobalData() :
+ pSysLocale(NULL),
+ pCharClass(NULL),
+ pLocaleData(NULL),
+ pOutliner(NULL),
+ pDefaults(NULL),
+ pResMgr(NULL),
+ nExchangeFormat(0)
+{
+ //pSysLocale = new SvtSysLocale;
+ //pCharClass = pSysLocale->GetCharClassPtr();
+ //pLocaleData = pSysLocale->GetLocaleDataPtr();
+
+ svx::ExtrusionBar::RegisterInterface();
+ svx::FontworkBar::RegisterInterface();
+}
+
+SdrGlobalData::~SdrGlobalData()
+{
+ delete pOutliner;
+ delete pDefaults;
+ delete pResMgr;
+ //! do NOT delete pCharClass and pLocaleData
+ delete pSysLocale;
+}
+const SvtSysLocale* SdrGlobalData::GetSysLocale()
+{
+ if ( !pSysLocale )
+ pSysLocale = new SvtSysLocale;
+ return pSysLocale;
+}
+const CharClass* SdrGlobalData::GetCharClass()
+{
+ if ( !pCharClass )
+ pCharClass = GetSysLocale()->GetCharClassPtr();
+ return pCharClass;
+}
+const LocaleDataWrapper* SdrGlobalData::GetLocaleData()
+{
+ if ( !pLocaleData )
+ pLocaleData = GetSysLocale()->GetLocaleDataPtr();
+ return pLocaleData;
+}
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+OLEObjCache::OLEObjCache()
+: Container( 0 )
+{
+ SvtCacheOptions aCacheOptions;
+
+ nSize = aCacheOptions.GetDrawingEngineOLE_Objects();
+ pTimer = new AutoTimer();
+ Link aLink = LINK(this, OLEObjCache, UnloadCheckHdl);
+
+ pTimer->SetTimeoutHdl(aLink);
+ pTimer->SetTimeout(20000);
+ pTimer->Start();
+
+ aLink.Call(pTimer);
+}
+
+OLEObjCache::~OLEObjCache()
+{
+ pTimer->Stop();
+ delete pTimer;
+}
+
+void OLEObjCache::UnloadOnDemand()
+{
+ if ( nSize < Count() )
+ {
+ // more objects than configured cache size try to remove objects
+ // of course not the freshly inserted one at nIndex=0
+ sal_uIntPtr nCount2 = Count();
+ sal_uIntPtr nIndex = nCount2-1;
+ while( nIndex && nCount2 > nSize )
+ {
+ SdrOle2Obj* pUnloadObj = (SdrOle2Obj*) GetObject(nIndex--);
+ if ( pUnloadObj )
+ {
+ try
+ {
+ // it is important to get object without reinitialization to avoid reentrance
+ uno::Reference< embed::XEmbeddedObject > xUnloadObj = pUnloadObj->GetObjRef_NoInit();
+
+ 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() )
+ {
+ for ( sal_uIntPtr nCheckInd = 0; nCheckInd < Count(); nCheckInd++ )
+ {
+ SdrOle2Obj* pCacheObj = (SdrOle2Obj*) GetObject(nCheckInd);
+ if ( pCacheObj && pCacheObj != pUnloadObj )
+ {
+ uno::Reference< frame::XModel > xParentModel = pCacheObj->GetParentXModel();
+ if ( xUnloadModel == xParentModel )
+ bUnload = sal_False; // the object has running embedded objects
+ }
+ }
+ }
+ }
+
+ if ( bUnload && UnloadObj(pUnloadObj) )
+ // object was successfully unloaded
+ nCount2--;
+ }
+ catch( uno::Exception& )
+ {}
+ }
+ }
+ }
+}
+
+void OLEObjCache::SetSize(sal_uIntPtr nNewSize)
+{
+ nSize = nNewSize;
+}
+
+void OLEObjCache::InsertObj(SdrOle2Obj* pObj)
+{
+ if ( Count() )
+ {
+ SdrOle2Obj* pExistingObj = (SdrOle2Obj*)GetObject( 0 );
+ if ( pObj == pExistingObj )
+ // the object is already on the top, nothing has to be changed
+ return;
+ }
+
+ // get the old position of the object to know whether it is already in container
+ sal_uIntPtr nOldPos = GetPos( pObj );
+
+ // insert object into first position
+ Remove( nOldPos );
+ Insert(pObj, (sal_uIntPtr) 0L);
+
+ if ( nOldPos == CONTAINER_ENTRY_NOTFOUND )
+ {
+ // a new object was inserted, recalculate the cache
+ UnloadOnDemand();
+ }
+}
+
+void OLEObjCache::RemoveObj(SdrOle2Obj* pObj)
+{
+ Remove(pObj);
+}
+
+sal_Bool OLEObjCache::UnloadObj(SdrOle2Obj* pObj)
+{
+ sal_Bool bUnloaded = sal_False;
+ if (pObj)
+ {
+ //#i80528# The old mechanism is completely useless, only taking into account if
+ // in all views the GrafDraft feature is used. This will nearly never have been the
+ // case since no one ever used this option.
+ //
+ // A much better (and working) criteria would be the VOC contact count.
+ // The quesion is what will happen whe i make it work now suddenly? I
+ // will try it for 2.4.
+ const sdr::contact::ViewContact& rViewContact = pObj->GetViewContact();
+ const bool bVisible(rViewContact.HasViewObjectContacts(true));
+
+ if(!bVisible)
+ {
+ bUnloaded = pObj->Unload();
+ }
+ }
+
+ return bUnloaded;
+}
+
+IMPL_LINK(OLEObjCache, UnloadCheckHdl, AutoTimer*, /*pTim*/)
+{
+ UnloadOnDemand();
+ return 0;
+}
+
+void ContainerSorter::DoSort(sal_uIntPtr a, sal_uIntPtr b) const
+{
+ sal_uIntPtr nAnz=rCont.Count();
+ if (b>nAnz) b=nAnz;
+ if (b>0) b--;
+ if (a<b) ImpSubSort(a,b);
+}
+
+void ContainerSorter::Is1stLessThan2nd(const void* /*pElem1*/, const void* /*pElem2*/) const
+{
+}
+
+void ContainerSorter::ImpSubSort(long nL, long nR) const
+{
+ long i,j;
+ const void* pX;
+ void* pI;
+ void* pJ;
+ i=nL;
+ j=nR;
+ pX=rCont.GetObject((nL+nR)/2);
+ do {
+ pI=rCont.Seek(i);
+ while (pI!=pX && Compare(pI,pX)<0) { i++; pI=rCont.Next(); }
+ pJ=rCont.Seek(j);
+ while (pJ!=pX && Compare(pX,pJ)<0) { j--; pJ=rCont.Prev(); }
+ if (i<=j) {
+ rCont.Replace(pJ,i);
+ rCont.Replace(pI,j);
+ i++;
+ j--;
+ }
+ } while (i<=j);
+ if (nL<j) ImpSubSort(nL,j);
+ if (i<nR) ImpSubSort(i,nR);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class ImpUShortContainerSorter: public ContainerSorter {
+public:
+ ImpUShortContainerSorter(Container& rNewCont): ContainerSorter(rNewCont) {}
+ virtual int Compare(const void* pElem1, const void* pElem2) const;
+};
+
+int ImpUShortContainerSorter::Compare(const void* pElem1, const void* pElem2) const
+{
+ sal_uInt16 n1=sal_uInt16(sal_uIntPtr(pElem1));
+ sal_uInt16 n2=sal_uInt16(sal_uIntPtr(pElem2));
+ return n1<n2 ? -1 : n1>n2 ? 1 : 0;
+}
+
+void UShortCont::Sort()
+{
+ ImpUShortContainerSorter aSorter(aArr);
+ aSorter.DoSort();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class ImpClipMerk {
+ Region aClip;
+ FASTBOOL bClip;
+public:
+ ImpClipMerk(const OutputDevice& rOut): aClip(rOut.GetClipRegion()),bClip(rOut.IsClipRegion()) {}
+ void Restore(OutputDevice& rOut)
+ {
+ // Kein Clipping in die Metafileaufzeichnung
+ GDIMetaFile* pMtf=rOut.GetConnectMetaFile();
+ if (pMtf!=NULL && (!pMtf->IsRecord() || pMtf->IsPause())) pMtf=NULL;
+ if (pMtf!=NULL) pMtf->Pause(sal_True);
+ if (bClip) rOut.SetClipRegion(aClip);
+ else rOut.SetClipRegion();
+ if (pMtf!=NULL) pMtf->Pause(sal_False);
+ }
+};
+
+class ImpColorMerk {
+ Color aLineColor;
+ Color aFillColor;
+ Color aBckgrdColor;
+ Font aFont;
+public:
+ ImpColorMerk(const OutputDevice& rOut):
+ aLineColor( rOut.GetLineColor() ),
+ aFillColor( rOut.GetFillColor() ),
+ aBckgrdColor( rOut.GetBackground().GetColor() ),
+ aFont (rOut.GetFont()) {}
+
+ ImpColorMerk(const OutputDevice& rOut, sal_uInt16 nMode)
+ {
+ if ( (nMode & SDRHDC_SAVEPEN) == SDRHDC_SAVEPEN )
+ aLineColor = rOut.GetLineColor();
+
+ if ( (nMode & SDRHDC_SAVEBRUSH) == SDRHDC_SAVEBRUSH)
+ {
+ aFillColor = rOut.GetFillColor();
+ aBckgrdColor = rOut.GetBackground().GetColor();
+ }
+
+ if ( (nMode & SDRHDC_SAVEFONT) == SDRHDC_SAVEFONT)
+ aFont=rOut.GetFont();
+ }
+
+ void Restore(OutputDevice& rOut, sal_uInt16 nMode=SDRHDC_SAVEPENANDBRUSHANDFONT)
+ {
+ if ( (nMode & SDRHDC_SAVEPEN) == SDRHDC_SAVEPEN)
+ rOut.SetLineColor( aLineColor );
+
+ if ( (nMode & SDRHDC_SAVEBRUSH) == SDRHDC_SAVEBRUSH)
+ {
+ rOut.SetFillColor( aFillColor );
+ rOut.SetBackground( Wallpaper( aBckgrdColor ) );
+ }
+ if ((nMode & SDRHDC_SAVEFONT) ==SDRHDC_SAVEFONT)
+ {
+ if (!rOut.GetFont().IsSameInstance(aFont))
+ {
+ rOut.SetFont(aFont);
+ }
+ }
+ }
+
+ const Color& GetLineColor() const { return aLineColor; }
+};
+
+ImpSdrHdcMerk::ImpSdrHdcMerk(const OutputDevice& rOut, sal_uInt16 nNewMode, FASTBOOL bAutoMerk):
+ pFarbMerk(NULL),
+ pClipMerk(NULL),
+ pLineColorMerk(NULL),
+ nMode(nNewMode)
+{
+ if (bAutoMerk) Save(rOut);
+}
+
+ImpSdrHdcMerk::~ImpSdrHdcMerk()
+{
+ if (pFarbMerk!=NULL) delete pFarbMerk;
+ if (pClipMerk!=NULL) delete pClipMerk;
+ if (pLineColorMerk !=NULL) delete pLineColorMerk;
+}
+
+void ImpSdrHdcMerk::Save(const OutputDevice& rOut)
+{
+ if (pFarbMerk!=NULL)
+ {
+ delete pFarbMerk;
+ pFarbMerk=NULL;
+ }
+ if (pClipMerk!=NULL)
+ {
+ delete pClipMerk;
+ pClipMerk=NULL;
+ }
+ if (pLineColorMerk !=NULL)
+ {
+ delete pLineColorMerk ;
+ pLineColorMerk =NULL;
+ }
+ if ((nMode & SDRHDC_SAVECLIPPING) ==SDRHDC_SAVECLIPPING)
+ pClipMerk=new ImpClipMerk(rOut);
+
+ sal_uInt16 nCol=nMode & SDRHDC_SAVEPENANDBRUSHANDFONT;
+
+ if (nCol==SDRHDC_SAVEPEN)
+ pLineColorMerk=new Color( rOut.GetLineColor() );
+ else if (nCol==SDRHDC_SAVEPENANDBRUSHANDFONT)
+ pFarbMerk=new ImpColorMerk(rOut);
+ else if (nCol!=0)
+ pFarbMerk=new ImpColorMerk(rOut,nCol);
+}
+
+void ImpSdrHdcMerk::Restore(OutputDevice& rOut, sal_uInt16 nMask) const
+{
+ nMask&=nMode; // nur restaurieren, was auch gesichert wurde
+
+ if ((nMask & SDRHDC_SAVECLIPPING) ==SDRHDC_SAVECLIPPING && pClipMerk!=NULL)
+ pClipMerk->Restore(rOut);
+
+ sal_uInt16 nCol=nMask & SDRHDC_SAVEPENANDBRUSHANDFONT;
+
+ if (nCol==SDRHDC_SAVEPEN)
+ {
+ if (pLineColorMerk!=NULL)
+ rOut.SetLineColor(*pLineColorMerk);
+ else if (pFarbMerk!=NULL)
+ rOut.SetLineColor( pFarbMerk->GetLineColor() );
+ } else if (nCol!=0 && pFarbMerk!=NULL)
+ pFarbMerk->Restore(rOut,nCol);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrLinkList::Clear()
+{
+ unsigned nAnz=GetLinkCount();
+ for (unsigned i=0; i<nAnz; i++) {
+ delete (Link*)aList.GetObject(i);
+ }
+ aList.Clear();
+}
+
+unsigned SdrLinkList::FindEntry(const Link& rLink) const
+{
+ unsigned nAnz=GetLinkCount();
+ for (unsigned i=0; i<nAnz; i++) {
+ if (GetLink(i)==rLink) return i;
+ }
+ return 0xFFFF;
+}
+
+void SdrLinkList::InsertLink(const Link& rLink, unsigned nPos)
+{
+ unsigned nFnd=FindEntry(rLink);
+ if (nFnd==0xFFFF) {
+ if (rLink.IsSet()) {
+ aList.Insert(new Link(rLink),nPos);
+ } else {
+ DBG_ERROR("SdrLinkList::InsertLink(): Versuch, einen nicht gesetzten Link einzufuegen");
+ }
+ } else {
+ DBG_ERROR("SdrLinkList::InsertLink(): Link schon vorhanden");
+ }
+}
+
+void SdrLinkList::RemoveLink(const Link& rLink)
+{
+ unsigned nFnd=FindEntry(rLink);
+ if (nFnd!=0xFFFF) {
+ Link* pLink=(Link*)aList.Remove(nFnd);
+ delete pLink;
+ } else {
+ DBG_ERROR("SdrLinkList::RemoveLink(): Link nicht gefunden");
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// #98988# Re-implement GetDraftFillColor(...)
+
+FASTBOOL GetDraftFillColor(const SfxItemSet& rSet, Color& rCol)
+{
+ XFillStyle eFill=((XFillStyleItem&)rSet.Get(XATTR_FILLSTYLE)).GetValue();
+ FASTBOOL bRetval(sal_False);
+
+ switch(eFill)
+ {
+ case XFILL_SOLID:
+ {
+ rCol = ((XFillColorItem&)rSet.Get(XATTR_FILLCOLOR)).GetColorValue();
+ bRetval = sal_True;
+
+ break;
+ }
+ case XFILL_HATCH:
+ {
+ Color aCol1(((XFillHatchItem&)rSet.Get(XATTR_FILLHATCH)).GetHatchValue().GetColor());
+ Color aCol2(COL_WHITE);
+
+ // #97870# when hatch background is activated, use object fill color as hatch color
+ sal_Bool bFillHatchBackground = ((const XFillBackgroundItem&)(rSet.Get(XATTR_FILLBACKGROUND))).GetValue();
+ if(bFillHatchBackground)
+ {
+ aCol2 = ((const XFillColorItem&)(rSet.Get(XATTR_FILLCOLOR))).GetColorValue();
+ }
+
+ const basegfx::BColor aAverageColor(basegfx::average(aCol1.getBColor(), aCol2.getBColor()));
+ rCol = Color(aAverageColor);
+ bRetval = sal_True;
+
+ break;
+ }
+ case XFILL_GRADIENT: {
+ const XGradient& rGrad=((XFillGradientItem&)rSet.Get(XATTR_FILLGRADIENT)).GetGradientValue();
+ Color aCol1(rGrad.GetStartColor());
+ Color aCol2(rGrad.GetEndColor());
+ const basegfx::BColor aAverageColor(basegfx::average(aCol1.getBColor(), aCol2.getBColor()));
+ rCol = Color(aAverageColor);
+ bRetval = sal_True;
+
+ break;
+ }
+ case XFILL_BITMAP:
+ {
+ const Bitmap& rBitmap = ((XFillBitmapItem&)rSet.Get(XATTR_FILLBITMAP)).GetBitmapValue().GetBitmap();
+ const Size aSize(rBitmap.GetSizePixel());
+ const sal_uInt32 nWidth = aSize.Width();
+ const sal_uInt32 nHeight = aSize.Height();
+ Bitmap aBitmap(rBitmap);
+ BitmapReadAccess* pAccess = aBitmap.AcquireReadAccess();
+
+ if(pAccess && nWidth > 0 && nHeight > 0)
+ {
+ sal_uInt32 nRt(0L);
+ sal_uInt32 nGn(0L);
+ sal_uInt32 nBl(0L);
+ const sal_uInt32 nMaxSteps(8L);
+ const sal_uInt32 nXStep((nWidth > nMaxSteps) ? nWidth / nMaxSteps : 1L);
+ const sal_uInt32 nYStep((nHeight > nMaxSteps) ? nHeight / nMaxSteps : 1L);
+ sal_uInt32 nAnz(0L);
+
+ for(sal_uInt32 nY(0L); nY < nHeight; nY += nYStep)
+ {
+ for(sal_uInt32 nX(0L); nX < nWidth; nX += nXStep)
+ {
+ const BitmapColor& rCol2 = (pAccess->HasPalette())
+ ? pAccess->GetPaletteColor((sal_uInt8)pAccess->GetPixel(nY, nX))
+ : pAccess->GetPixel(nY, nX);
+
+ nRt += rCol2.GetRed();
+ nGn += rCol2.GetGreen();
+ nBl += rCol2.GetBlue();
+ nAnz++;
+ }
+ }
+
+ nRt /= nAnz;
+ nGn /= nAnz;
+ nBl /= nAnz;
+
+ rCol = Color(sal_uInt8(nRt), sal_uInt8(nGn), sal_uInt8(nBl));
+
+ bRetval = sal_True;
+ }
+
+ if(pAccess)
+ {
+ aBitmap.ReleaseAccess(pAccess);
+ }
+
+ break;
+ }
+ default: break;
+ }
+
+ return bRetval;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrEngineDefaults::SdrEngineDefaults():
+ aFontName( OutputDevice::GetDefaultFont( DEFAULTFONT_SERIF, LANGUAGE_SYSTEM, DEFAULTFONT_FLAGS_ONLYONE ).GetName() ),
+ eFontFamily(FAMILY_ROMAN),
+ aFontColor(COL_AUTO),
+ nFontHeight(847), // 847/100mm = ca. 24 Point
+ eMapUnit(MAP_100TH_MM),
+ aMapFraction(1,1)
+{
+}
+
+SdrEngineDefaults& SdrEngineDefaults::GetDefaults()
+{
+ SdrGlobalData& rGlobalData=GetSdrGlobalData();
+ if (rGlobalData.pDefaults==NULL) {
+ rGlobalData.pDefaults=new SdrEngineDefaults;
+ }
+ return *rGlobalData.pDefaults;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrEngineDefaults::LanguageHasChanged()
+{
+ SdrGlobalData& rGlobalData=GetSdrGlobalData();
+ if (rGlobalData.pResMgr!=NULL) {
+ delete rGlobalData.pResMgr;
+ rGlobalData.pResMgr=NULL;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrOutliner* SdrMakeOutliner( sal_uInt16 nOutlinerMode, SdrModel* pModel )
+{
+ //SdrEngineDefaults& rDefaults = SdrEngineDefaults::GetDefaults();
+
+ SfxItemPool* pPool = &pModel->GetItemPool();
+ SdrOutliner* pOutl = new SdrOutliner( pPool, nOutlinerMode );
+ pOutl->SetEditTextObjectPool( pPool );
+ pOutl->SetStyleSheetPool( (SfxStyleSheetPool*) pModel->GetStyleSheetPool() );
+ pOutl->SetDefTab( pModel->GetDefaultTabulator() );
+ pOutl->SetForbiddenCharsTable( pModel->GetForbiddenCharsTable() );
+ pOutl->SetAsianCompressionMode( pModel->GetCharCompressType() );
+ pOutl->SetKernAsianPunctuation( pModel->IsKernAsianPunctuation() );
+ pOutl->SetAddExtLeading( pModel->IsAddExtLeading() );
+
+ return pOutl;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+SdrLinkList& ImpGetUserMakeObjHdl()
+{
+ SdrGlobalData& rGlobalData=GetSdrGlobalData();
+ return rGlobalData.aUserMakeObjHdl;
+}
+
+SdrLinkList& ImpGetUserMakeObjUserDataHdl()
+{
+ SdrGlobalData& rGlobalData=GetSdrGlobalData();
+ return rGlobalData.aUserMakeObjUserDataHdl;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ResMgr* ImpGetResMgr()
+{
+ SdrGlobalData& rGlobalData = GetSdrGlobalData();
+
+ if(!rGlobalData.pResMgr)
+ {
+ ByteString aName("svx");
+ rGlobalData.pResMgr =
+ ResMgr::CreateResMgr( aName.GetBuffer(), Application::GetSettings().GetUILocale() );
+ }
+
+ return rGlobalData.pResMgr;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+String ImpGetResStr(sal_uInt16 nResID)
+{
+ return String(ResId(nResID, *ImpGetResMgr()));
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+String GetResourceString(sal_uInt16 nResID)
+{
+ return ImpGetResStr( nResID );
+}
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_Bool SearchOutlinerItems(const SfxItemSet& rSet, sal_Bool bInklDefaults, sal_Bool* pbOnlyEE)
+{
+ sal_Bool bHas=sal_False;
+ sal_Bool bOnly=sal_True;
+ sal_Bool bLookOnly=pbOnlyEE!=NULL;
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich=aIter.FirstWhich();
+ while (((bLookOnly && bOnly) || !bHas) && nWhich!=0) {
+ // bei bInklDefaults ist der gesamte Which-Range
+ // ausschlaggebend, ansonsten nur die gesetzten Items
+ // Disabled und DontCare wird als Loch im Which-Range betrachtet
+ SfxItemState eState=rSet.GetItemState(nWhich);
+ if ((eState==SFX_ITEM_DEFAULT && bInklDefaults) || eState==SFX_ITEM_SET) {
+ if (nWhich<EE_ITEMS_START || nWhich>EE_ITEMS_END) bOnly=sal_False;
+ else bHas=sal_True;
+ }
+ nWhich=aIter.NextWhich();
+ }
+ if (!bHas) bOnly=sal_False;
+ if (pbOnlyEE!=NULL) *pbOnlyEE=bOnly;
+ return bHas;
+}
+
+sal_uInt16* RemoveWhichRange(const sal_uInt16* pOldWhichTable, sal_uInt16 nRangeBeg, sal_uInt16 nRangeEnd)
+{
+ // insgesamt sind 6 Faelle moeglich (je Range):
+ // [Beg..End] zu entfernender Range
+ // [b..e] [b..e] [b..e] Fall 1,3,2: egal, ganz weg, egal + Ranges
+ // [b........e] [b........e] Fall 4,5 : Bereich verkleinern | in
+ // [b......................e] Fall 6 : Splitting + pOldWhichTable
+ sal_uInt16 nAnz=0;
+ while (pOldWhichTable[nAnz]!=0) nAnz++;
+ nAnz++; // nAnz muesste nun in jedem Fall eine ungerade Zahl sein (0 am Ende des Arrays)
+ DBG_ASSERT((nAnz&1)==1,"Joe: RemoveWhichRange: WhichTable hat keine ungerade Anzahl von Eintraegen");
+ sal_uInt16 nAlloc=nAnz;
+ // benoetigte Groesse des neuen Arrays ermitteln
+ sal_uInt16 nNum=nAnz-1;
+ while (nNum!=0) {
+ nNum-=2;
+ sal_uInt16 nBeg=pOldWhichTable[nNum];
+ sal_uInt16 nEnd=pOldWhichTable[nNum+1];
+ if (nEnd<nRangeBeg) /*nCase=1*/ ;
+ else if (nBeg>nRangeEnd) /* nCase=2 */ ;
+ else if (nBeg>=nRangeBeg && nEnd<=nRangeEnd) /* nCase=3 */ nAlloc-=2;
+ else if (nEnd<=nRangeEnd) /* nCase=4 */;
+ else if (nBeg>=nRangeBeg) /* nCase=5*/ ;
+ else /* nCase=6 */ nAlloc+=2;
+ }
+
+ sal_uInt16* pNewWhichTable=new sal_uInt16[nAlloc];
+ memcpy(pNewWhichTable,pOldWhichTable,nAlloc*sizeof(sal_uInt16));
+ pNewWhichTable[nAlloc-1]=0; // im Falle 3 fehlt die 0 am Ende
+ // nun die unerwuenschten Ranges entfernen
+ nNum=nAlloc-1;
+ while (nNum!=0) {
+ nNum-=2;
+ sal_uInt16 nBeg=pNewWhichTable[nNum];
+ sal_uInt16 nEnd=pNewWhichTable[nNum+1];
+ unsigned nCase=0;
+ if (nEnd<nRangeBeg) nCase=1;
+ else if (nBeg>nRangeEnd) nCase=2;
+ else if (nBeg>=nRangeBeg && nEnd<=nRangeEnd) nCase=3;
+ else if (nEnd<=nRangeEnd) nCase=4;
+ else if (nBeg>=nRangeBeg) nCase=5;
+ else nCase=6;
+ switch (nCase) {
+ case 3: {
+ unsigned nTailBytes=(nAnz-(nNum+2))*sizeof(sal_uInt16);
+ memcpy(&pNewWhichTable[nNum],&pNewWhichTable[nNum+2],nTailBytes);
+ nAnz-=2; // Merken: Array hat sich verkleinert
+ } break;
+ case 4: pNewWhichTable[nNum+1]=nRangeBeg-1; break;
+ case 5: pNewWhichTable[nNum]=nRangeEnd+1; break;
+ case 6: {
+ unsigned nTailBytes=(nAnz-(nNum+2))*sizeof(sal_uInt16);
+ memcpy(&pNewWhichTable[nNum+4],&pNewWhichTable[nNum+2],nTailBytes);
+ nAnz+=2; // Merken: Array hat sich vergroessert
+ pNewWhichTable[nNum+2]=nRangeEnd+1;
+ pNewWhichTable[nNum+3]=pNewWhichTable[nNum+1];
+ pNewWhichTable[nNum+1]=nRangeBeg-1;
+ } break;
+ } // switch
+ }
+ return pNewWhichTable;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SvdProgressInfo::SvdProgressInfo( Link *_pLink )
+{
+ DBG_ASSERT(_pLink!=NULL,"SvdProgressInfo(): Kein Link angegeben!!");
+
+ pLink = _pLink;
+ nSumActionCount = 0;
+ nSumCurAction = 0;
+
+ nObjCount = 0;
+ nCurObj = 0;
+
+ nActionCount = 0;
+ nCurAction = 0;
+
+ nInsertCount = 0;
+ nCurInsert = 0;
+}
+
+void SvdProgressInfo::Init( sal_uIntPtr _nSumActionCount, sal_uIntPtr _nObjCount )
+{
+ nSumActionCount = _nSumActionCount;
+ nObjCount = _nObjCount;
+}
+
+sal_Bool SvdProgressInfo::ReportActions( sal_uIntPtr nAnzActions )
+{
+ nSumCurAction += nAnzActions;
+ nCurAction += nAnzActions;
+ if(nCurAction > nActionCount)
+ nCurAction = nActionCount;
+
+ return pLink->Call(NULL) == 1L;
+}
+
+sal_Bool SvdProgressInfo::ReportInserts( sal_uIntPtr nAnzInserts )
+{
+ nSumCurAction += nAnzInserts;
+ nCurInsert += nAnzInserts;
+
+ return pLink->Call(NULL) == 1L;
+}
+
+sal_Bool SvdProgressInfo::ReportRescales( sal_uIntPtr nAnzRescales )
+{
+ nSumCurAction += nAnzRescales;
+ return pLink->Call(NULL) == 1L;
+}
+
+void SvdProgressInfo::SetActionCount( sal_uIntPtr _nActionCount )
+{
+ nActionCount = _nActionCount;
+}
+
+void SvdProgressInfo::SetInsertCount( sal_uIntPtr _nInsertCount )
+{
+ nInsertCount = _nInsertCount;
+}
+
+sal_Bool SvdProgressInfo::SetNextObject()
+{
+ nActionCount = 0;
+ nCurAction = 0;
+
+ nInsertCount = 0;
+ nCurInsert = 0;
+
+ nCurObj++;
+ return ReportActions(0);
+}
+
+void SvdProgressInfo::ReportError()
+{
+ pLink->Call((void *)1L);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// #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(sal_uIntPtr 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 sal_uInt16 SPOTCOUNT(5);
+ Point aSpotPos[SPOTCOUNT];
+ Color aSpotColor[SPOTCOUNT];
+ sal_uIntPtr nHeight( rArea.GetSize().Height() );
+ sal_uIntPtr nWidth( rArea.GetSize().Width() );
+ sal_uIntPtr nWidth14 = nWidth / 4;
+ sal_uIntPtr nHeight14 = nHeight / 4;
+ sal_uIntPtr nWidth34 = ( 3 * nWidth ) / 4;
+ sal_uIntPtr nHeight34 = ( 3 * nHeight ) / 4;
+
+ sal_uInt16 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);
+ }
+
+ sal_uInt16 aMatch[SPOTCOUNT];
+
+ for ( i = 0; i < SPOTCOUNT; i++ )
+ {
+ // were same spot colors found?
+ aMatch[i] = 0;
+
+ for ( sal_uInt16 j = 0; j < SPOTCOUNT; j++ )
+ {
+ if( j != i )
+ {
+ if( aSpotColor[i] == aSpotColor[j] )
+ {
+ aMatch[i]++;
+ }
+ }
+ }
+ }
+
+ // highest weight to center spot
+ aBackground = aSpotColor[0];
+
+ for ( sal_uInt16 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/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
new file mode 100644
index 000000000000..6a207ca4cba4
--- /dev/null
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -0,0 +1,1028 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svdfmtf.hxx"
+#include <editeng/editdata.hxx>
+#include <math.h>
+#include <svx/xpoly.hxx>
+#include <vcl/svapp.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/crsditem.hxx>
+#include <editeng/shdditem.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xgrad.hxx>
+#include <svx/xflgrit.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/akrnitem.hxx>
+#include <editeng/wrlmitem.hxx>
+#include <editeng/cntritem.hxx>
+#include <editeng/colritem.hxx>
+#include <vcl/metric.hxx>
+#include <editeng/charscaleitem.hxx>
+#include <svx/xflhtit.hxx>
+#include <svx/svdattr.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdobj.hxx>
+#include "svx/svditext.hxx"
+#include <svx/svdotext.hxx>
+#include <svx/svdorect.hxx>
+#include <svx/svdocirc.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/svdetc.hxx>
+#include <svl/itemset.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <vcl/salbtype.hxx> // FRound
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <svx/xlinjoit.hxx>
+#include <svx/xlndsit.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ImpSdrGDIMetaFileImport::ImpSdrGDIMetaFileImport(SdrModel& rModel):
+ nMapScalingOfs(0),
+ pLineAttr(NULL),pFillAttr(NULL),pTextAttr(NULL),
+ pPage(NULL),pModel(NULL),nLayer(0),
+ nLineWidth(0),
+ maLineJoin(basegfx::B2DLINEJOIN_NONE),
+ maDash(XDASH_RECT, 0, 0, 0, 0, 0),
+ bFntDirty(sal_True),
+ bLastObjWasPolyWithoutLine(sal_False),bNoLine(sal_False),bNoFill(sal_False),bLastObjWasLine(sal_False)
+{
+ aVD.EnableOutput(sal_False);
+
+ // #i111954# init to no fill and no line initially
+ aVD.SetLineColor();
+ aVD.SetFillColor();
+
+ aOldLineColor.SetRed( aVD.GetLineColor().GetRed() + 1 ); // invalidate old line color
+ pLineAttr=new SfxItemSet(rModel.GetItemPool(),XATTR_LINE_FIRST,XATTR_LINE_LAST);
+ pFillAttr=new SfxItemSet(rModel.GetItemPool(),XATTR_FILL_FIRST,XATTR_FILL_LAST);
+ pTextAttr=new SfxItemSet(rModel.GetItemPool(),EE_ITEMS_START,EE_ITEMS_END);
+ pModel=&rModel;
+}
+
+ImpSdrGDIMetaFileImport::~ImpSdrGDIMetaFileImport()
+{
+ delete pLineAttr;
+ delete pFillAttr;
+ delete pTextAttr;
+}
+
+sal_uIntPtr ImpSdrGDIMetaFileImport::DoImport(const GDIMetaFile& rMtf,
+ SdrObjList& rOL,
+ sal_uIntPtr nInsPos,
+ SvdProgressInfo *pProgrInfo)
+{
+ pPage = rOL.GetPage();
+ GDIMetaFile* pTmpMtf=NULL;
+ GDIMetaFile* pMtf = (GDIMetaFile*) &rMtf;
+ sal_uIntPtr nActionAnz=pMtf->GetActionCount();
+ sal_Bool bError = sal_False;
+
+
+ // setup some global scale parameter
+ // fScaleX, fScaleY, aScaleX, aScaleY, bMov, bSize
+ fScaleX = fScaleY = 1.0;
+ Size aMtfSize( pMtf->GetPrefSize() );
+ if ( aMtfSize.Width() & aMtfSize.Height() && ( aScaleRect.IsEmpty() == sal_False ) )
+ {
+ aOfs = aScaleRect.TopLeft();
+ if ( aMtfSize.Width() != ( aScaleRect.GetWidth() - 1 ) )
+ fScaleX = (double)( aScaleRect.GetWidth() - 1 ) / (double)aMtfSize.Width();
+ if ( aMtfSize.Height() != ( aScaleRect.GetHeight() - 1 ) )
+ fScaleY = (double)( aScaleRect.GetHeight() - 1 ) / (double)aMtfSize.Height();
+ }
+
+ bMov = aOfs.X()!=0 || aOfs.Y()!=0;
+ bSize = sal_False;
+
+ aScaleX = Fraction( 1, 1 );
+ aScaleY = Fraction( 1, 1 );
+ if ( aMtfSize.Width() != ( aScaleRect.GetWidth() - 1 ) )
+ {
+ aScaleX = Fraction( aScaleRect.GetWidth() - 1, aMtfSize.Width() );
+ bSize = sal_True;
+ }
+ if ( aMtfSize.Height() != ( aScaleRect.GetHeight() - 1 ) )
+ {
+ aScaleY = Fraction( aScaleRect.GetHeight() - 1, aMtfSize.Height() );
+ bSize = sal_True;
+ }
+
+ if(65000 < nActionAnz)
+ {
+ nActionAnz = 65000;
+ bError = sal_True;
+ }
+
+ if(pProgrInfo)
+ pProgrInfo->SetActionCount(nActionAnz);
+
+ sal_uIntPtr nActionsToReport = 0;
+
+ for( MetaAction* pAct = pMtf->FirstAction(); pAct; pAct = pMtf->NextAction() )
+ {
+ switch (pAct->GetType())
+ {
+ case META_PIXEL_ACTION : DoAction((MetaPixelAction &)*pAct); break;
+ case META_POINT_ACTION : DoAction((MetaPointAction &)*pAct); break;
+ case META_LINE_ACTION : DoAction((MetaLineAction &)*pAct); break;
+ case META_RECT_ACTION : DoAction((MetaRectAction &)*pAct); break;
+ case META_ROUNDRECT_ACTION : DoAction((MetaRoundRectAction &)*pAct); break;
+ case META_ELLIPSE_ACTION : DoAction((MetaEllipseAction &)*pAct); break;
+ case META_ARC_ACTION : DoAction((MetaArcAction &)*pAct); break;
+ case META_PIE_ACTION : DoAction((MetaPieAction &)*pAct); break;
+ case META_CHORD_ACTION : DoAction((MetaChordAction &)*pAct); break;
+ case META_POLYLINE_ACTION : DoAction((MetaPolyLineAction &)*pAct); break;
+ case META_POLYGON_ACTION : DoAction((MetaPolygonAction &)*pAct); break;
+ case META_POLYPOLYGON_ACTION : DoAction((MetaPolyPolygonAction &)*pAct); break;
+ case META_TEXT_ACTION : DoAction((MetaTextAction &)*pAct); break;
+ case META_TEXTARRAY_ACTION : DoAction((MetaTextArrayAction &)*pAct); break;
+ case META_STRETCHTEXT_ACTION : DoAction((MetaStretchTextAction &)*pAct); break;
+ case META_BMP_ACTION : DoAction((MetaBmpAction &)*pAct); break;
+ case META_BMPSCALE_ACTION : DoAction((MetaBmpScaleAction &)*pAct); break;
+ case META_BMPEX_ACTION : DoAction((MetaBmpExAction &)*pAct); break;
+ case META_BMPEXSCALE_ACTION : DoAction((MetaBmpExScaleAction &)*pAct); break;
+ case META_LINECOLOR_ACTION : DoAction((MetaLineColorAction &)*pAct); break;
+ case META_FILLCOLOR_ACTION : DoAction((MetaFillColorAction &)*pAct); break;
+ case META_TEXTCOLOR_ACTION : DoAction((MetaTextColorAction &)*pAct); break;
+ case META_TEXTFILLCOLOR_ACTION : DoAction((MetaTextFillColorAction &)*pAct); break;
+ case META_FONT_ACTION : DoAction((MetaFontAction &)*pAct); break;
+ case META_TEXTALIGN_ACTION : DoAction((MetaTextAlignAction &)*pAct); break;
+ case META_MAPMODE_ACTION : DoAction((MetaMapModeAction &)*pAct); break;
+ case META_CLIPREGION_ACTION : DoAction((MetaClipRegionAction &)*pAct); break;
+ case META_MOVECLIPREGION_ACTION : DoAction((MetaMoveClipRegionAction &)*pAct); break;
+ case META_ISECTRECTCLIPREGION_ACTION: DoAction((MetaISectRectClipRegionAction&)*pAct); break;
+ case META_ISECTREGIONCLIPREGION_ACTION: DoAction((MetaISectRegionClipRegionAction&)*pAct); break;
+ case META_RASTEROP_ACTION : DoAction((MetaRasterOpAction &)*pAct); break;
+ case META_PUSH_ACTION : DoAction((MetaPushAction &)*pAct); break;
+ case META_POP_ACTION : DoAction((MetaPopAction &)*pAct); break;
+ case META_HATCH_ACTION : DoAction((MetaHatchAction &)*pAct); break;
+ case META_COMMENT_ACTION : DoAction((MetaCommentAction &)*pAct, pMtf); break;
+
+ }
+
+ if(pProgrInfo != NULL)
+ {
+ nActionsToReport++;
+ if(nActionsToReport >= 16) // Alle 16 Action updaten
+ {
+ if(!pProgrInfo->ReportActions(nActionsToReport))
+ break;
+ nActionsToReport = 0;
+ }
+ }
+ }
+
+ if(pProgrInfo != NULL)
+ {
+ pProgrInfo->ReportActions(nActionsToReport);
+ nActionsToReport = 0;
+ }
+
+ // MapMode-Scaling vornehmen
+ MapScaling();
+ // Objekte in vorgegebenes Rechteck hineinskalieren
+ sal_uIntPtr nAnz=aTmpList.GetObjCount();
+
+ // Beim berechnen der Fortschrittsanzeige wird GetActionCount()*3 benutzt.
+ // Da in aTmpList allerdings weniger eintraege als GetActionCount()
+ // existieren koennen, muessen hier die zuviel vermuteten Actionen wieder
+ // hinzugefuegt werden.
+ nActionsToReport = (pMtf->GetActionCount() - nAnz)*2;
+
+
+ // Alle noch nicht gemeldeten Rescales melden
+ if(pProgrInfo)
+ {
+ pProgrInfo->ReportRescales(nActionsToReport);
+ pProgrInfo->SetInsertCount(nAnz);
+ }
+ nActionsToReport = 0;
+
+ // alle in aTmpList zwischengespeicherten Objekte nun in rOL ab der Position nInsPos einfuegen
+ if (nInsPos>rOL.GetObjCount()) nInsPos=rOL.GetObjCount();
+ SdrInsertReason aReason(SDRREASON_VIEWCALL);
+ for (sal_uIntPtr i=0; i<nAnz; i++)
+ {
+ SdrObject* pObj=aTmpList.GetObj(i);
+ rOL.NbcInsertObject(pObj,nInsPos,&aReason);
+ nInsPos++;
+
+ if(pProgrInfo != NULL)
+ {
+ nActionsToReport++;
+ if(nActionsToReport >= 32) // Alle 32 Action updaten
+ {
+ pProgrInfo->ReportInserts(nActionsToReport);
+ nActionsToReport = 0;
+ }
+ }
+ }
+ if (pTmpMtf!=NULL) delete pTmpMtf;
+
+ // ein letztesmal alle verbliebennen Inserts reporten
+ if(pProgrInfo != NULL)
+ {
+ pProgrInfo->ReportInserts(nActionsToReport);
+ if(bError)
+ pProgrInfo->ReportError();
+ }
+
+ return aTmpList.GetObjCount();
+}
+
+void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* pObj, FASTBOOL bForceTextAttr)
+{
+ bNoLine = sal_False; bNoFill = sal_False;
+ FASTBOOL bLine=sal_True && !bForceTextAttr;
+ FASTBOOL bFill=pObj==NULL || pObj->IsClosedObj() && !bForceTextAttr;
+ FASTBOOL bText=bForceTextAttr || (pObj!=NULL && pObj->GetOutlinerParaObject()!=NULL);
+
+ if ( bLine )
+ {
+ if ( nLineWidth )
+ pLineAttr->Put( XLineWidthItem( nLineWidth ) );
+ else
+ pLineAttr->Put( XLineWidthItem( 0 ) );
+
+ aOldLineColor = aVD.GetLineColor();
+ if( aVD.IsLineColor() )
+ {
+ pLineAttr->Put(XLineStyleItem(XLINE_SOLID));
+ pLineAttr->Put(XLineColorItem(String(), aVD.GetLineColor()));
+ }
+ else
+ pLineAttr->Put(XLineStyleItem(XLINE_NONE));
+
+ switch(maLineJoin)
+ {
+ default : // basegfx::B2DLINEJOIN_NONE
+ pLineAttr->Put(XLineJointItem(XLINEJOINT_NONE));
+ break;
+ case basegfx::B2DLINEJOIN_MIDDLE:
+ pLineAttr->Put(XLineJointItem(XLINEJOINT_MIDDLE));
+ break;
+ case basegfx::B2DLINEJOIN_BEVEL:
+ pLineAttr->Put(XLineJointItem(XLINEJOINT_BEVEL));
+ break;
+ case basegfx::B2DLINEJOIN_MITER:
+ pLineAttr->Put(XLineJointItem(XLINEJOINT_MITER));
+ break;
+ case basegfx::B2DLINEJOIN_ROUND:
+ pLineAttr->Put(XLineJointItem(XLINEJOINT_ROUND));
+ break;
+ }
+
+ if(((maDash.GetDots() && maDash.GetDotLen()) || (maDash.GetDashes() && maDash.GetDashLen())) && maDash.GetDistance())
+ {
+ pLineAttr->Put(XLineDashItem(String(), maDash));
+ }
+ else
+ {
+ pLineAttr->Put(XLineDashItem(String(), XDash(XDASH_RECT)));
+ }
+ }
+ else
+ bNoLine = sal_True;
+
+ if ( bFill )
+ {
+ if( aVD.IsFillColor() )
+ {
+ pFillAttr->Put(XFillStyleItem(XFILL_SOLID));
+ pFillAttr->Put(XFillColorItem(String(), aVD.GetFillColor()));
+ }
+ else
+ pFillAttr->Put(XFillStyleItem(XFILL_NONE));
+ }
+ else
+ bNoFill = sal_True;
+
+ if ( bText && bFntDirty )
+ {
+ Font aFnt(aVD.GetFont());
+ pTextAttr->Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(), aFnt.GetStyleName(),
+ aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO ) );
+ pTextAttr->Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(), aFnt.GetStyleName(),
+ aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO_CJK ) );
+ pTextAttr->Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(), aFnt.GetStyleName(),
+ aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO_CTL ) );
+ pTextAttr->Put(SvxPostureItem(aFnt.GetItalic(), EE_CHAR_ITALIC));
+ pTextAttr->Put(SvxWeightItem(aFnt.GetWeight(), EE_CHAR_WEIGHT));
+ sal_uInt32 nHeight = FRound(aFnt.GetSize().Height() * fScaleY);
+ pTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) );
+ pTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) );
+ pTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CTL ) );
+ pTextAttr->Put(SvxCharScaleWidthItem(100, EE_CHAR_FONTWIDTH));
+ pTextAttr->Put(SvxUnderlineItem(aFnt.GetUnderline(), EE_CHAR_UNDERLINE));
+ pTextAttr->Put(SvxOverlineItem(aFnt.GetOverline(), EE_CHAR_OVERLINE));
+ pTextAttr->Put(SvxCrossedOutItem(aFnt.GetStrikeout(), EE_CHAR_STRIKEOUT));
+ pTextAttr->Put(SvxShadowedItem(aFnt.IsShadow(), EE_CHAR_SHADOW));
+ pTextAttr->Put(SvxAutoKernItem(aFnt.IsKerning(), EE_CHAR_KERNING));
+ pTextAttr->Put(SvxWordLineModeItem(aFnt.IsWordLineMode(), EE_CHAR_WLM));
+ pTextAttr->Put(SvxContourItem(aFnt.IsOutline(), EE_CHAR_OUTLINE));
+ pTextAttr->Put(SvxColorItem(aFnt.GetColor(), EE_CHAR_COLOR));
+ //... svxfont textitem svditext
+ bFntDirty=sal_False;
+ }
+ if (pObj!=NULL)
+ {
+ pObj->SetLayer(nLayer);
+ if (bLine) pObj->SetMergedItemSet(*pLineAttr);
+ if (bFill) pObj->SetMergedItemSet(*pFillAttr);
+ if (bText)
+ {
+ pObj->SetMergedItemSet(*pTextAttr);
+ pObj->SetMergedItem( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_LEFT ) );
+ }
+ }
+}
+
+void ImpSdrGDIMetaFileImport::InsertObj( SdrObject* pObj, sal_Bool bScale )
+{
+ if ( bScale && !aScaleRect.IsEmpty() )
+ {
+ if ( bSize )
+ pObj->NbcResize( Point(), aScaleX, aScaleY );
+ if ( bMov )
+ pObj->NbcMove( Size( aOfs.X(), aOfs.Y() ) );
+ }
+
+ // #i111954# check object for visibility
+ // used are SdrPathObj, SdrRectObj, SdrCircObj, SdrGrafObj
+ bool bVisible(false);
+
+ if(pObj->HasLineStyle())
+ {
+ bVisible = true;
+ }
+
+ if(!bVisible && pObj->HasFillStyle())
+ {
+ bVisible = true;
+ }
+
+ if(!bVisible)
+ {
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(pObj);
+
+ if(pTextObj && pTextObj->HasText())
+ {
+ bVisible = true;
+ }
+ }
+
+ if(!bVisible)
+ {
+ SdrGrafObj* pGrafObj = dynamic_cast< SdrGrafObj* >(pObj);
+
+ if(pGrafObj)
+ {
+ // this may be refined to check if the graphic really is visible. It
+ // is here to ensure that graphic objects without fill, line and text
+ // get created
+ bVisible = true;
+ }
+ }
+
+ if(!bVisible)
+ {
+ SdrObject::Free(pObj);
+ }
+ else
+ {
+ aTmpList.InsertObject( pObj );
+ if ( HAS_BASE( SdrPathObj, pObj ) )
+ {
+ FASTBOOL bClosed=pObj->IsClosedObj();
+ bLastObjWasPolyWithoutLine=bNoLine && bClosed;
+ bLastObjWasLine=!bClosed;
+ }
+ else
+ {
+ bLastObjWasPolyWithoutLine = sal_False;
+ bLastObjWasLine = sal_False;
+ }
+ }
+}
+
+/**************************************************************************************************/
+
+void ImpSdrGDIMetaFileImport::DoAction(MetaPixelAction& /*rAct*/)
+{
+}
+
+void ImpSdrGDIMetaFileImport::DoAction(MetaPointAction& /*rAct*/)
+{
+}
+
+void ImpSdrGDIMetaFileImport::DoAction(MetaLineAction& rAct)
+{
+ // #i73407# reformulation to use new B2DPolygon classes
+ const basegfx::B2DPoint aStart(rAct.GetStartPoint().X(), rAct.GetStartPoint().Y());
+ const basegfx::B2DPoint aEnd(rAct.GetEndPoint().X(), rAct.GetEndPoint().Y());
+
+ if(!aStart.equal(aEnd))
+ {
+ basegfx::B2DPolygon aLine;
+ const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y()));
+
+ aLine.append(aStart);
+ aLine.append(aEnd);
+ aLine.transform(aTransform);
+
+ const LineInfo& rLineInfo = rAct.GetLineInfo();
+ const sal_Int32 nNewLineWidth(rLineInfo.GetWidth());
+ bool bCreateLineObject(true);
+
+ if(bLastObjWasLine && (nNewLineWidth == nLineWidth) && CheckLastLineMerge(aLine))
+ {
+ bCreateLineObject = false;
+ }
+
+ if(bCreateLineObject)
+ {
+ SdrPathObj* pPath = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aLine));
+ nLineWidth = nNewLineWidth;
+ maLineJoin = rLineInfo.GetLineJoin();
+ maDash = XDash(XDASH_RECT,
+ rLineInfo.GetDotCount(), rLineInfo.GetDotLen(),
+ rLineInfo.GetDashCount(), rLineInfo.GetDashLen(),
+ rLineInfo.GetDistance());
+ SetAttributes(pPath);
+ nLineWidth = 0;
+ maLineJoin = basegfx::B2DLINEJOIN_NONE;
+ maDash = XDash();
+ InsertObj(pPath, false);
+ }
+ }
+}
+
+void ImpSdrGDIMetaFileImport::DoAction(MetaRectAction& rAct)
+{
+ SdrRectObj* pRect=new SdrRectObj(rAct.GetRect());
+ SetAttributes(pRect);
+ InsertObj(pRect);
+}
+
+void ImpSdrGDIMetaFileImport::DoAction(MetaRoundRectAction& rAct)
+{
+ SdrRectObj* pRect=new SdrRectObj(rAct.GetRect());
+ SetAttributes(pRect);
+ long nRad=(rAct.GetHorzRound()+rAct.GetVertRound())/2;
+ if (nRad!=0) {
+ SfxItemSet aSet(*pLineAttr->GetPool(),SDRATTR_ECKENRADIUS,SDRATTR_ECKENRADIUS);
+ aSet.Put(SdrEckenradiusItem(nRad));
+ pRect->SetMergedItemSet(aSet);
+ }
+ InsertObj(pRect);
+}
+
+/**************************************************************************************************/
+
+void ImpSdrGDIMetaFileImport::DoAction(MetaEllipseAction& rAct)
+{
+ SdrCircObj* pCirc=new SdrCircObj(OBJ_CIRC,rAct.GetRect());
+ SetAttributes(pCirc);
+ InsertObj(pCirc);
+}
+
+void ImpSdrGDIMetaFileImport::DoAction(MetaArcAction& rAct)
+{
+ Point aCenter(rAct.GetRect().Center());
+ long nStart=GetAngle(rAct.GetStartPoint()-aCenter);
+ long nEnd=GetAngle(rAct.GetEndPoint()-aCenter);
+ SdrCircObj* pCirc=new SdrCircObj(OBJ_CARC,rAct.GetRect(),nStart,nEnd);
+ SetAttributes(pCirc);
+ InsertObj(pCirc);
+}
+
+void ImpSdrGDIMetaFileImport::DoAction(MetaPieAction& rAct)
+{
+ Point aCenter(rAct.GetRect().Center());
+ long nStart=GetAngle(rAct.GetStartPoint()-aCenter);
+ long nEnd=GetAngle(rAct.GetEndPoint()-aCenter);
+ SdrCircObj* pCirc=new SdrCircObj(OBJ_SECT,rAct.GetRect(),nStart,nEnd);
+ SetAttributes(pCirc);
+ InsertObj(pCirc);
+}
+
+void ImpSdrGDIMetaFileImport::DoAction(MetaChordAction& rAct)
+{
+ Point aCenter(rAct.GetRect().Center());
+ long nStart=GetAngle(rAct.GetStartPoint()-aCenter);
+ long nEnd=GetAngle(rAct.GetEndPoint()-aCenter);
+ SdrCircObj* pCirc=new SdrCircObj(OBJ_CCUT,rAct.GetRect(),nStart,nEnd);
+ SetAttributes(pCirc);
+ InsertObj(pCirc);
+}
+
+/**************************************************************************************************/
+
+bool ImpSdrGDIMetaFileImport::CheckLastLineMerge(const basegfx::B2DPolygon& rSrcPoly)
+{
+ // #i102706# Do not merge closed polygons
+ if(rSrcPoly.isClosed())
+ {
+ return false;
+ }
+
+ // #i73407# reformulation to use new B2DPolygon classes
+ if(bLastObjWasLine && (aOldLineColor == aVD.GetLineColor()) && rSrcPoly.count())
+ {
+ SdrObject* pTmpObj = aTmpList.GetObj(aTmpList.GetObjCount() - 1);
+ SdrPathObj* pLastPoly = PTR_CAST(SdrPathObj, pTmpObj);
+
+ if(pLastPoly)
+ {
+ if(1L == pLastPoly->GetPathPoly().count())
+ {
+ bool bOk(false);
+ basegfx::B2DPolygon aDstPoly(pLastPoly->GetPathPoly().getB2DPolygon(0L));
+
+ // #i102706# Do not merge closed polygons
+ if(aDstPoly.isClosed())
+ {
+ return false;
+ }
+
+ if(aDstPoly.count())
+ {
+ const sal_uInt32 nMaxDstPnt(aDstPoly.count() - 1L);
+ const sal_uInt32 nMaxSrcPnt(rSrcPoly.count() - 1L);
+
+ if(aDstPoly.getB2DPoint(nMaxDstPnt) == rSrcPoly.getB2DPoint(0L))
+ {
+ aDstPoly.append(rSrcPoly, 1L, rSrcPoly.count() - 1L);
+ bOk = true;
+ }
+ else if(aDstPoly.getB2DPoint(0L) == rSrcPoly.getB2DPoint(nMaxSrcPnt))
+ {
+ basegfx::B2DPolygon aNew(rSrcPoly);
+ aNew.append(aDstPoly, 1L, aDstPoly.count() - 1L);
+ aDstPoly = aNew;
+ bOk = true;
+ }
+ else if(aDstPoly.getB2DPoint(0L) == rSrcPoly.getB2DPoint(0L))
+ {
+ aDstPoly.flip();
+ aDstPoly.append(rSrcPoly, 1L, rSrcPoly.count() - 1L);
+ bOk = true;
+ }
+ else if(aDstPoly.getB2DPoint(nMaxDstPnt) == rSrcPoly.getB2DPoint(nMaxSrcPnt))
+ {
+ basegfx::B2DPolygon aNew(rSrcPoly);
+ aNew.flip();
+ aDstPoly.append(aNew, 1L, aNew.count() - 1L);
+ bOk = true;
+ }
+ }
+
+ if(bOk)
+ {
+ pLastPoly->NbcSetPathPoly(basegfx::B2DPolyPolygon(aDstPoly));
+ }
+
+ return bOk;
+ }
+ }
+ }
+
+ return false;
+}
+
+bool ImpSdrGDIMetaFileImport::CheckLastPolyLineAndFillMerge(const basegfx::B2DPolyPolygon & rPolyPolygon)
+{
+ // #i73407# reformulation to use new B2DPolygon classes
+ if(bLastObjWasPolyWithoutLine)
+ {
+ SdrObject* pTmpObj = aTmpList.GetObj(aTmpList.GetObjCount() - 1);
+ SdrPathObj* pLastPoly = PTR_CAST(SdrPathObj, pTmpObj);
+
+ if(pLastPoly)
+ {
+ if(pLastPoly->GetPathPoly() == rPolyPolygon)
+ {
+ SetAttributes(NULL);
+
+ if(!bNoLine && bNoFill)
+ {
+ pLastPoly->SetMergedItemSet(*pLineAttr);
+
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+}
+
+
+void ImpSdrGDIMetaFileImport::DoAction( MetaPolyLineAction& rAct )
+{
+ // #i73407# reformulation to use new B2DPolygon classes
+ basegfx::B2DPolygon aSource(rAct.GetPolygon().getB2DPolygon());
+
+ if(aSource.count())
+ {
+ const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y()));
+ aSource.transform(aTransform);
+ }
+
+ const LineInfo& rLineInfo = rAct.GetLineInfo();
+ const sal_Int32 nNewLineWidth(rLineInfo.GetWidth());
+ bool bCreateLineObject(true);
+
+ if(bLastObjWasLine && (nNewLineWidth == nLineWidth) && CheckLastLineMerge(aSource))
+ {
+ bCreateLineObject = false;
+ }
+ else if(bLastObjWasPolyWithoutLine && CheckLastPolyLineAndFillMerge(basegfx::B2DPolyPolygon(aSource)))
+ {
+ bCreateLineObject = false;
+ }
+
+ if(bCreateLineObject)
+ {
+ SdrPathObj* pPath = new SdrPathObj(
+ aSource.isClosed() ? OBJ_POLY : OBJ_PLIN,
+ basegfx::B2DPolyPolygon(aSource));
+ nLineWidth = nNewLineWidth;
+ maLineJoin = rLineInfo.GetLineJoin();
+ maDash = XDash(XDASH_RECT,
+ rLineInfo.GetDotCount(), rLineInfo.GetDotLen(),
+ rLineInfo.GetDashCount(), rLineInfo.GetDashLen(),
+ rLineInfo.GetDistance());
+ SetAttributes(pPath);
+ nLineWidth = 0;
+ maLineJoin = basegfx::B2DLINEJOIN_NONE;
+ maDash = XDash();
+ InsertObj(pPath, false);
+ }
+}
+
+void ImpSdrGDIMetaFileImport::DoAction( MetaPolygonAction& rAct )
+{
+ // #i73407# reformulation to use new B2DPolygon classes
+ basegfx::B2DPolygon aSource(rAct.GetPolygon().getB2DPolygon());
+
+ if(aSource.count())
+ {
+ const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y()));
+ aSource.transform(aTransform);
+
+ if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(basegfx::B2DPolyPolygon(aSource)))
+ {
+ // #i73407# make sure polygon is closed, it's a filled primitive
+ aSource.setClosed(true);
+
+ SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, basegfx::B2DPolyPolygon(aSource));
+ SetAttributes(pPath);
+ InsertObj(pPath, false);
+ }
+ }
+}
+
+void ImpSdrGDIMetaFileImport::DoAction(MetaPolyPolygonAction& rAct)
+{
+ // #i73407# reformulation to use new B2DPolygon classes
+ basegfx::B2DPolyPolygon aSource(rAct.GetPolyPolygon().getB2DPolyPolygon());
+
+ if(aSource.count())
+ {
+ const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y()));
+ aSource.transform(aTransform);
+
+ if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource))
+ {
+ // #i73407# make sure polygon is closed, it's a filled primitive
+ aSource.setClosed(true);
+
+ SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource);
+ SetAttributes(pPath);
+ InsertObj(pPath, false);
+ }
+ }
+}
+
+/**************************************************************************************************/
+
+void ImpSdrGDIMetaFileImport::ImportText( const Point& rPos, const XubString& rStr, const MetaAction& rAct )
+{
+ // calc text box size, add 5% to make it fit safely
+
+ FontMetric aFontMetric( aVD.GetFontMetric() );
+ Font aFnt( aVD.GetFont() );
+ FontAlign eAlg( aFnt.GetAlign() );
+
+ sal_Int32 nTextWidth = (sal_Int32)( aVD.GetTextWidth( rStr ) * fScaleX );
+ sal_Int32 nTextHeight = (sal_Int32)( aVD.GetTextHeight() * fScaleY );
+ //sal_Int32 nDxWidth = 0;
+ //sal_Int32 nLen = rStr.Len();
+
+ Point aPos( FRound(rPos.X() * fScaleX + aOfs.X()), FRound(rPos.Y() * fScaleY + aOfs.Y()) );
+ Size aSize( nTextWidth, nTextHeight );
+
+ if ( eAlg == ALIGN_BASELINE )
+ aPos.Y() -= FRound(aFontMetric.GetAscent() * fScaleY);
+ else if ( eAlg == ALIGN_BOTTOM )
+ aPos.Y() -= nTextHeight;
+
+ Rectangle aTextRect( aPos, aSize );
+ SdrRectObj* pText =new SdrRectObj( OBJ_TEXT, aTextRect );
+
+ if ( aFnt.GetWidth() || ( rAct.GetType() == META_STRETCHTEXT_ACTION ) )
+ {
+ pText->ClearMergedItem( SDRATTR_TEXT_AUTOGROWWIDTH );
+ pText->SetMergedItem( SdrTextAutoGrowHeightItem( sal_False ) );
+ // don't let the margins eat the space needed for the text
+ pText->SetMergedItem ( SdrTextUpperDistItem (0));
+ pText->SetMergedItem ( SdrTextLowerDistItem (0));
+ pText->SetMergedItem ( SdrTextRightDistItem (0));
+ pText->SetMergedItem ( SdrTextLeftDistItem (0));
+ pText->SetMergedItem( SdrTextFitToSizeTypeItem( SDRTEXTFIT_ALLLINES ) );
+ }
+ else
+ pText->SetMergedItem( SdrTextAutoGrowWidthItem( sal_True ) );
+
+ pText->SetModel( pModel );
+ pText->SetLayer( nLayer );
+ pText->NbcSetText( rStr );
+ SetAttributes( pText, sal_True );
+ pText->SetSnapRect( aTextRect );
+
+ if (!aFnt.IsTransparent())
+ {
+ SfxItemSet aAttr(*pFillAttr->GetPool(),XATTR_FILL_FIRST,XATTR_FILL_LAST);
+ aAttr.Put(XFillStyleItem(XFILL_SOLID));
+ aAttr.Put(XFillColorItem(String(), aFnt.GetFillColor()));
+ pText->SetMergedItemSet(aAttr);
+ }
+ sal_uInt32 nWink = aFnt.GetOrientation();
+ if ( nWink )
+ {
+ nWink*=10;
+ double a=nWink*nPi180;
+ double nSin=sin(a);
+ double nCos=cos(a);
+ pText->NbcRotate(aPos,nWink,nSin,nCos);
+ }
+ InsertObj( pText, sal_False );
+}
+
+void ImpSdrGDIMetaFileImport::DoAction(MetaTextAction& rAct)
+{
+ XubString aStr(rAct.GetText());
+ aStr.Erase(0,rAct.GetIndex());
+ aStr.Erase(rAct.GetLen());
+ ImportText( rAct.GetPoint(), aStr, rAct );
+}
+
+void ImpSdrGDIMetaFileImport::DoAction(MetaTextArrayAction& rAct)
+{
+ XubString aStr(rAct.GetText());
+ aStr.Erase(0,rAct.GetIndex());
+ aStr.Erase(rAct.GetLen());
+ ImportText( rAct.GetPoint(), aStr, rAct );
+}
+
+void ImpSdrGDIMetaFileImport::DoAction(MetaStretchTextAction& rAct)
+{
+ XubString aStr(rAct.GetText());
+ aStr.Erase(0,rAct.GetIndex());
+ aStr.Erase(rAct.GetLen());
+ ImportText( rAct.GetPoint(), aStr, rAct );
+}
+
+void ImpSdrGDIMetaFileImport::DoAction(MetaBmpAction& rAct)
+{
+ Rectangle aRect(rAct.GetPoint(),rAct.GetBitmap().GetSizePixel());
+ aRect.Right()++; aRect.Bottom()++;
+ SdrGrafObj* pGraf=new SdrGrafObj(Graphic(rAct.GetBitmap()),aRect);
+ InsertObj(pGraf);
+}
+
+void ImpSdrGDIMetaFileImport::DoAction(MetaBmpScaleAction& rAct)
+{
+ Rectangle aRect(rAct.GetPoint(),rAct.GetSize());
+ aRect.Right()++; aRect.Bottom()++;
+ SdrGrafObj* pGraf=new SdrGrafObj(Graphic(rAct.GetBitmap()),aRect);
+ InsertObj(pGraf);
+}
+
+void ImpSdrGDIMetaFileImport::DoAction(MetaBmpExAction& rAct)
+{
+ Rectangle aRect(rAct.GetPoint(),rAct.GetBitmapEx().GetSizePixel());
+ aRect.Right()++; aRect.Bottom()++;
+ SdrGrafObj* pGraf=new SdrGrafObj( rAct.GetBitmapEx(), aRect );
+ InsertObj(pGraf);
+}
+
+void ImpSdrGDIMetaFileImport::DoAction(MetaBmpExScaleAction& rAct)
+{
+ Rectangle aRect(rAct.GetPoint(),rAct.GetSize());
+ aRect.Right()++; aRect.Bottom()++;
+ SdrGrafObj* pGraf=new SdrGrafObj( rAct.GetBitmapEx(), aRect );
+ InsertObj(pGraf);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void ImpSdrGDIMetaFileImport::DoAction( MetaHatchAction& rAct )
+{
+ // #i73407# reformulation to use new B2DPolygon classes
+ basegfx::B2DPolyPolygon aSource(rAct.GetPolyPolygon().getB2DPolyPolygon());
+
+ if(aSource.count())
+ {
+ const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y()));
+ aSource.transform(aTransform);
+
+ if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource))
+ {
+ const Hatch& rHatch = rAct.GetHatch();
+ SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource);
+ SfxItemSet aHatchAttr(pModel->GetItemPool(),
+ XATTR_FILLSTYLE, XATTR_FILLSTYLE,
+ XATTR_FILLHATCH, XATTR_FILLHATCH, 0, 0 );
+ XHatchStyle eStyle;
+
+ switch(rHatch.GetStyle())
+ {
+ case(HATCH_TRIPLE) :
+ {
+ eStyle = XHATCH_TRIPLE;
+ break;
+ }
+
+ case(HATCH_DOUBLE) :
+ {
+ eStyle = XHATCH_DOUBLE;
+ break;
+ }
+
+ default:
+ {
+ eStyle = XHATCH_SINGLE;
+ break;
+ }
+ }
+
+ SetAttributes(pPath);
+ aHatchAttr.Put(XFillStyleItem(XFILL_HATCH));
+ aHatchAttr.Put(XFillHatchItem(&pModel->GetItemPool(), XHatch(rHatch.GetColor(), eStyle, rHatch.GetDistance(), rHatch.GetAngle())));
+ pPath->SetMergedItemSet(aHatchAttr);
+
+ InsertObj(pPath, false);
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void ImpSdrGDIMetaFileImport::DoAction(MetaLineColorAction& rAct)
+{
+ rAct.Execute(&aVD);
+}
+
+void ImpSdrGDIMetaFileImport::DoAction(MetaMapModeAction& rAct)
+{
+ MapScaling();
+ rAct.Execute(&aVD);
+ bLastObjWasPolyWithoutLine=sal_False;
+ bLastObjWasLine=sal_False;
+}
+
+void ImpSdrGDIMetaFileImport::MapScaling()
+{
+ sal_uInt32 i, nAnz = aTmpList.GetObjCount();
+ const MapMode& rMap = aVD.GetMapMode();
+ Point aMapOrg( rMap.GetOrigin() );
+ sal_Bool bMov2 = aMapOrg.X() != 0 || aMapOrg.Y() != 0;
+ if ( bMov2 )
+ {
+ for ( i = nMapScalingOfs; i < nAnz; i++ )
+ {
+ SdrObject* pObj = aTmpList.GetObj(i);
+ if ( bMov2 )
+ pObj->NbcMove( Size( aMapOrg.X(), aMapOrg.Y() ) );
+ }
+ }
+ nMapScalingOfs = nAnz;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void ImpSdrGDIMetaFileImport::DoAction( MetaCommentAction& rAct, GDIMetaFile* pMtf )
+{
+ ByteString aSkipComment;
+
+ if( rAct.GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_BEGIN" ) == COMPARE_EQUAL )
+ {
+ MetaGradientExAction* pAct = (MetaGradientExAction*) pMtf->NextAction();
+
+ if( pAct && pAct->GetType() == META_GRADIENTEX_ACTION )
+ {
+ // #i73407# reformulation to use new B2DPolygon classes
+ basegfx::B2DPolyPolygon aSource(pAct->GetPolyPolygon().getB2DPolyPolygon());
+
+ if(aSource.count())
+ {
+ if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource))
+ {
+ const Gradient& rGrad = pAct->GetGradient();
+ SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource);
+ SfxItemSet aGradAttr(pModel->GetItemPool(),
+ XATTR_FILLSTYLE, XATTR_FILLSTYLE,
+ XATTR_FILLGRADIENT, XATTR_FILLGRADIENT, 0, 0 );
+ XGradient aXGradient;
+
+ aXGradient.SetGradientStyle((XGradientStyle)rGrad.GetStyle());
+ aXGradient.SetStartColor(rGrad.GetStartColor());
+ aXGradient.SetEndColor(rGrad.GetEndColor());
+ aXGradient.SetAngle((sal_uInt16)rGrad.GetAngle());
+ aXGradient.SetBorder(rGrad.GetBorder());
+ aXGradient.SetXOffset(rGrad.GetOfsX());
+ aXGradient.SetYOffset(rGrad.GetOfsY());
+ aXGradient.SetStartIntens(rGrad.GetStartIntensity());
+ aXGradient.SetEndIntens(rGrad.GetEndIntensity());
+ aXGradient.SetSteps(rGrad.GetSteps());
+
+ if(aVD.IsLineColor())
+ {
+ // switch line off; when there was one there will be a
+ // META_POLYLINE_ACTION following creating another object
+ const Color aLineColor(aVD.GetLineColor());
+ aVD.SetLineColor();
+ SetAttributes(pPath);
+ aVD.SetLineColor(aLineColor);
+ }
+ else
+ {
+ SetAttributes(pPath);
+ }
+
+ aGradAttr.Put(XFillStyleItem(XFILL_GRADIENT));
+ aGradAttr.Put(XFillGradientItem(&pModel->GetItemPool(), aXGradient));
+ pPath->SetMergedItemSet(aGradAttr);
+
+ InsertObj(pPath);
+ }
+ }
+
+ aSkipComment = "XGRAD_SEQ_END";
+ }
+ }
+
+ if(aSkipComment.Len())
+ {
+ MetaAction* pSkipAct = pMtf->NextAction();
+
+ while( pSkipAct
+ && ((pSkipAct->GetType() != META_COMMENT_ACTION )
+ || (((MetaCommentAction*)pSkipAct)->GetComment().CompareIgnoreCaseToAscii(aSkipComment.GetBuffer()) != COMPARE_EQUAL)))
+ {
+ pSkipAct = pMtf->NextAction();
+ }
+ }
+}
+
+// eof
diff --git a/svx/source/svdraw/svdfmtf.hxx b/svx/source/svdraw/svdfmtf.hxx
new file mode 100644
index 000000000000..abe434aa215b
--- /dev/null
+++ b/svx/source/svdraw/svdfmtf.hxx
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVDFMTF_HXX
+#define _SVDFMTF_HXX
+
+#include <vcl/metaact.hxx>
+#include <vcl/virdev.hxx>
+#include <svx/svdobj.hxx>
+
+//************************************************************
+// Vorausdeklarationen
+//************************************************************
+
+class SfxItemSet;
+class SdrObjList;
+class SdrModel;
+class SdrPage;
+class SdrObject;
+class SvdProgressInfo;
+
+//************************************************************
+// Hilfsklasse SdrObjRefList
+//************************************************************
+
+class SdrObjRefList
+{
+ Container aList;
+public:
+
+ SdrObjRefList()
+ : aList(1024,64,64)
+ {}
+
+ void Clear() { aList.Clear(); }
+ sal_uLong GetObjCount() const { return aList.Count(); }
+ SdrObject* GetObj(sal_uLong nNum) const { return (SdrObject*)aList.GetObject(nNum); }
+ SdrObject* operator[](sal_uLong nNum) const { return (SdrObject*)aList.GetObject(nNum); }
+ void InsertObject(SdrObject* pObj, sal_uLong nPos=CONTAINER_APPEND) { aList.Insert(pObj,nPos); }
+ void RemoveObject(sal_uLong nPos) { aList.Remove(nPos); }
+};
+
+//************************************************************
+// Hilfsklasse ImpSdrGDIMetaFileImport
+//************************************************************
+
+class ImpSdrGDIMetaFileImport
+{
+protected:
+ SdrObjRefList aTmpList;
+ VirtualDevice aVD;
+ Rectangle aScaleRect;
+ sal_uLong nMapScalingOfs; // ab hier nocht nicht mit MapScaling bearbeitet
+ SfxItemSet* pLineAttr;
+ SfxItemSet* pFillAttr;
+ SfxItemSet* pTextAttr;
+ SdrPage* pPage;
+ SdrModel* pModel;
+ SdrLayerID nLayer;
+ Color aOldLineColor;
+ sal_Int32 nLineWidth;
+ basegfx::B2DLineJoin maLineJoin;
+ XDash maDash;
+
+ sal_Bool bMov;
+ sal_Bool bSize;
+ Point aOfs;
+ double fScaleX;
+ double fScaleY;
+ Fraction aScaleX;
+ Fraction aScaleY;
+
+ sal_Bool bFntDirty;
+
+ // fuer Optimierung von (PenNULL,Brush,DrawPoly),(Pen,BrushNULL,DrawPoly) -> aus 2 mach ein
+ sal_Bool bLastObjWasPolyWithoutLine;
+ sal_Bool bNoLine;
+ sal_Bool bNoFill;
+
+ // fuer Optimierung mehrerer Linien zu einer Polyline
+ sal_Bool bLastObjWasLine;
+
+protected:
+ void DoAction(MetaPixelAction & rAct);
+ void DoAction(MetaPointAction & rAct);
+ void DoAction(MetaLineAction & rAct);
+ void DoAction(MetaRectAction & rAct);
+ void DoAction(MetaRoundRectAction & rAct);
+ void DoAction(MetaEllipseAction & rAct);
+ void DoAction(MetaArcAction & rAct);
+ void DoAction(MetaPieAction & rAct);
+ void DoAction(MetaChordAction & rAct);
+ void DoAction(MetaPolyLineAction & rAct);
+ void DoAction(MetaPolygonAction & rAct);
+ void DoAction(MetaPolyPolygonAction & rAct);
+ void DoAction(MetaTextAction & rAct);
+ void DoAction(MetaTextArrayAction & rAct);
+ void DoAction(MetaStretchTextAction & rAct);
+ void DoAction(MetaBmpAction & rAct);
+ void DoAction(MetaBmpScaleAction & rAct);
+ void DoAction(MetaBmpExAction & rAct);
+ void DoAction(MetaBmpExScaleAction & rAct);
+ void DoAction(MetaHatchAction & rAct);
+ void DoAction(MetaLineColorAction & rAct);
+ void DoAction(MetaMapModeAction & rAct);
+ void DoAction(MetaFillColorAction & rAct) { rAct.Execute(&aVD); }
+ void DoAction(MetaTextColorAction & rAct) { rAct.Execute(&aVD); }
+ void DoAction(MetaTextFillColorAction & rAct) { rAct.Execute(&aVD); }
+ void DoAction(MetaFontAction & rAct) { rAct.Execute(&aVD); bFntDirty=sal_True; }
+ void DoAction(MetaTextAlignAction & rAct) { rAct.Execute(&aVD); bFntDirty=sal_True; }
+ void DoAction(MetaClipRegionAction & rAct) { rAct.Execute(&aVD); }
+ void DoAction(MetaRasterOpAction & rAct) { rAct.Execute(&aVD); }
+ void DoAction(MetaPushAction & rAct) { rAct.Execute(&aVD); }
+ void DoAction(MetaPopAction & rAct) { rAct.Execute(&aVD); bFntDirty=sal_True; }
+ void DoAction(MetaMoveClipRegionAction & rAct) { rAct.Execute(&aVD); }
+ void DoAction(MetaISectRectClipRegionAction& rAct) { rAct.Execute(&aVD); }
+ void DoAction(MetaISectRegionClipRegionAction& rAct) { rAct.Execute(&aVD); }
+ void DoAction(MetaCommentAction& rAct, GDIMetaFile* pMtf);
+
+ void ImportText( const Point& rPos, const XubString& rStr, const MetaAction& rAct );
+ void SetAttributes(SdrObject* pObj, FASTBOOL bForceTextAttr=sal_False);
+ void InsertObj( SdrObject* pObj, sal_Bool bScale = sal_True );
+ void MapScaling();
+
+ // #i73407# reformulation to use new B2DPolygon classes
+ bool CheckLastLineMerge(const basegfx::B2DPolygon& rSrcPoly);
+ bool CheckLastPolyLineAndFillMerge(const basegfx::B2DPolyPolygon& rPolyPolygon);
+
+public:
+ ImpSdrGDIMetaFileImport(SdrModel& rModel);
+ ~ImpSdrGDIMetaFileImport();
+ sal_uLong DoImport(const GDIMetaFile& rMtf, SdrObjList& rDestList, sal_uLong nInsPos=CONTAINER_APPEND, SvdProgressInfo *pProgrInfo = NULL);
+ void SetLayer(SdrLayerID nLay) { nLayer=nLay; }
+ SdrLayerID GetLayer() const { return nLayer; }
+ void SetScaleRect(const Rectangle& rRect) { aScaleRect=rRect; }
+ const Rectangle& GetScaleRect() const { return aScaleRect; }
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDFMTF_HXX
+// eof
diff --git a/svx/source/svdraw/svdglev.cxx b/svx/source/svdraw/svdglev.cxx
new file mode 100644
index 000000000000..a9c1e387d46e
--- /dev/null
+++ b/svx/source/svdraw/svdglev.cxx
@@ -0,0 +1,422 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svdglev.hxx>
+#include <math.h>
+
+#include <svx/svdundo.hxx>
+#include "svx/svdstr.hrc" // Namen aus der Resource
+#include "svx/svdglob.hxx" // StringCache
+#include <svx/svdpagv.hxx>
+#include <svx/svdglue.hxx>
+#include <svx/svdtrans.hxx>
+#include <svx/svdobj.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrGlueEditView::ImpClearVars()
+{
+}
+
+SdrGlueEditView::SdrGlueEditView(SdrModel* pModel1, OutputDevice* pOut):
+ SdrPolyEditView(pModel1,pOut)
+{
+ ImpClearVars();
+}
+
+SdrGlueEditView::~SdrGlueEditView()
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrGlueEditView::ImpDoMarkedGluePoints(PGlueDoFunc pDoFunc, sal_Bool bConst, const void* p1, const void* p2, const void* p3, const void* p4, const void* p5)
+{
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++) {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ const SdrUShortCont* pPts=pM->GetMarkedGluePoints();
+ sal_uIntPtr nPtAnz=pPts==NULL ? 0 : pPts->GetCount();
+ if (nPtAnz!=0) {
+ SdrGluePointList* pGPL=NULL;
+ if (bConst) {
+ const SdrGluePointList* pConstGPL=pObj->GetGluePointList();
+ pGPL=(SdrGluePointList*)pConstGPL;
+ } else {
+ pGPL=pObj->ForceGluePointList();
+ }
+ if (pGPL!=NULL)
+ {
+ if(!bConst && IsUndoEnabled() )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
+
+ for (sal_uIntPtr nPtNum=0; nPtNum<nPtAnz; nPtNum++)
+ {
+ sal_uInt16 nPtId=pPts->GetObject(nPtNum);
+ sal_uInt16 nGlueIdx=pGPL->FindGluePoint(nPtId);
+ if (nGlueIdx!=SDRGLUEPOINT_NOTFOUND)
+ {
+ SdrGluePoint& rGP=(*pGPL)[nGlueIdx];
+ (*pDoFunc)(rGP,pObj,p1,p2,p3,p4,p5);
+ }
+ }
+ if (!bConst)
+ {
+ pObj->SetChanged();
+ pObj->BroadcastObjectChange();
+ }
+ }
+ }
+ }
+ if (!bConst && nMarkAnz!=0) pMod->SetChanged();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+static void ImpGetEscDir(SdrGluePoint& rGP, const SdrObject* /*pObj*/, const void* pbFirst, const void* pnThisEsc, const void* pnRet, const void*, const void*)
+{
+ sal_uInt16& nRet=*(sal_uInt16*)pnRet;
+ sal_Bool& bFirst=*(sal_Bool*)pbFirst;
+ if (nRet!=FUZZY) {
+ sal_uInt16 nEsc=rGP.GetEscDir();
+ sal_Bool bOn=(nEsc & *(sal_uInt16*)pnThisEsc)!=0;
+ if (bFirst) { nRet=bOn; bFirst=sal_False; }
+ else if (nRet!=bOn) nRet=FUZZY;
+ }
+}
+
+TRISTATE SdrGlueEditView::IsMarkedGluePointsEscDir(sal_uInt16 nThisEsc) const
+{
+ ForceUndirtyMrkPnt();
+ sal_Bool bFirst=sal_True;
+ sal_uInt16 nRet=sal_False;
+ ((SdrGlueEditView*)this)->ImpDoMarkedGluePoints(ImpGetEscDir,sal_True,&bFirst,&nThisEsc,&nRet);
+ return (TRISTATE)nRet;
+}
+
+static void ImpSetEscDir(SdrGluePoint& rGP, const SdrObject* /*pObj*/, const void* pnThisEsc, const void* pbOn, const void*, const void*, const void*)
+{
+ sal_uInt16 nEsc=rGP.GetEscDir();
+ if (*(sal_Bool*)pbOn) nEsc|=*(sal_uInt16*)pnThisEsc;
+ else nEsc&=~*(sal_uInt16*)pnThisEsc;
+ rGP.SetEscDir(nEsc);
+}
+
+void SdrGlueEditView::SetMarkedGluePointsEscDir(sal_uInt16 nThisEsc, sal_Bool bOn)
+{
+ ForceUndirtyMrkPnt();
+ BegUndo(ImpGetResStr(STR_EditSetGlueEscDir),GetDescriptionOfMarkedGluePoints());
+ ImpDoMarkedGluePoints(ImpSetEscDir,sal_False,&nThisEsc,&bOn);
+ EndUndo();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+static void ImpGetPercent(SdrGluePoint& rGP, const SdrObject* /*pObj*/, const void* pbFirst, const void* pnRet, const void*, const void*, const void*)
+{
+ sal_uInt16& nRet=*(sal_uInt16*)pnRet;
+ sal_Bool& bFirst=*(sal_Bool*)pbFirst;
+ if (nRet!=FUZZY) {
+ bool bOn=rGP.IsPercent();
+ if (bFirst) { nRet=bOn; bFirst=sal_False; }
+ else if ((nRet!=0)!=bOn) nRet=FUZZY;
+ }
+}
+
+TRISTATE SdrGlueEditView::IsMarkedGluePointsPercent() const
+{
+ ForceUndirtyMrkPnt();
+ sal_Bool bFirst=sal_True;
+ sal_uInt16 nRet=sal_True;
+ ((SdrGlueEditView*)this)->ImpDoMarkedGluePoints(ImpGetPercent,sal_True,&bFirst,&nRet);
+ return (TRISTATE)nRet;
+}
+
+static void ImpSetPercent(SdrGluePoint& rGP, const SdrObject* pObj, const void* pbOn, const void*, const void*, const void*, const void*)
+{
+ Point aPos(rGP.GetAbsolutePos(*pObj));
+ rGP.SetPercent(*(sal_Bool*)pbOn);
+ rGP.SetAbsolutePos(aPos,*pObj);
+}
+
+void SdrGlueEditView::SetMarkedGluePointsPercent(sal_Bool bOn)
+{
+ ForceUndirtyMrkPnt();
+ BegUndo(ImpGetResStr(STR_EditSetGluePercent),GetDescriptionOfMarkedGluePoints());
+ ImpDoMarkedGluePoints(ImpSetPercent,sal_False,&bOn);
+ EndUndo();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+static void ImpGetAlign(SdrGluePoint& rGP, const SdrObject* /*pObj*/, const void* pbFirst, const void* pbDontCare, const void* pbVert, const void* pnRet, const void*)
+{
+ sal_uInt16& nRet=*(sal_uInt16*)pnRet;
+ sal_Bool& bFirst=*(sal_Bool*)pbFirst;
+ sal_Bool& bDontCare=*(sal_Bool*)pbDontCare;
+ sal_Bool bVert=*(sal_Bool*)pbVert;
+ if (!bDontCare) {
+ sal_uInt16 nAlg=0;
+ if (bVert) {
+ nAlg=rGP.GetVertAlign();
+ } else {
+ nAlg=rGP.GetHorzAlign();
+ }
+ if (bFirst) { nRet=nAlg; bFirst=sal_False; }
+ else if (nRet!=nAlg) {
+ if (bVert) {
+ nRet=SDRVERTALIGN_DONTCARE;
+ } else {
+ nRet=SDRHORZALIGN_DONTCARE;
+ }
+ bDontCare=sal_True;
+ }
+ }
+}
+
+sal_uInt16 SdrGlueEditView::GetMarkedGluePointsAlign(sal_Bool bVert) const
+{
+ ForceUndirtyMrkPnt();
+ sal_Bool bFirst=sal_True;
+ sal_Bool bDontCare=sal_False;
+ sal_uInt16 nRet=0;
+ ((SdrGlueEditView*)this)->ImpDoMarkedGluePoints(ImpGetAlign,sal_True,&bFirst,&bDontCare,&bVert,&nRet);
+ return nRet;
+}
+
+static void ImpSetAlign(SdrGluePoint& rGP, const SdrObject* pObj, const void* pbVert, const void* pnAlign, const void*, const void*, const void*)
+{
+ Point aPos(rGP.GetAbsolutePos(*pObj));
+ if (*(sal_Bool*)pbVert) { // bVert?
+ rGP.SetVertAlign(*(sal_uInt16*)pnAlign);
+ } else {
+ rGP.SetHorzAlign(*(sal_uInt16*)pnAlign);
+ }
+ rGP.SetAbsolutePos(aPos,*pObj);
+}
+
+void SdrGlueEditView::SetMarkedGluePointsAlign(sal_Bool bVert, sal_uInt16 nAlign)
+{
+ ForceUndirtyMrkPnt();
+ BegUndo(ImpGetResStr(STR_EditSetGlueAlign),GetDescriptionOfMarkedGluePoints());
+ ImpDoMarkedGluePoints(ImpSetAlign,sal_False,&bVert,&nAlign);
+ EndUndo();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_Bool SdrGlueEditView::IsDeleteMarkedGluePointsPossible() const
+{
+ return HasMarkedGluePoints();
+}
+
+void SdrGlueEditView::DeleteMarkedGluePoints()
+{
+ BrkAction();
+ ForceUndirtyMrkPnt();
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ BegUndo(ImpGetResStr(STR_EditDelete),GetDescriptionOfMarkedGluePoints(),SDRREPFUNC_OBJ_DELETE);
+
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
+ {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ const SdrUShortCont* pPts=pM->GetMarkedGluePoints();
+ sal_uIntPtr nPtAnz=pPts==NULL ? 0 : pPts->GetCount();
+ if (nPtAnz!=0)
+ {
+ SdrGluePointList* pGPL=pObj->ForceGluePointList();
+ if (pGPL!=NULL)
+ {
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
+
+ for (sal_uIntPtr nPtNum=0; nPtNum<nPtAnz; nPtNum++)
+ {
+ sal_uInt16 nPtId=pPts->GetObject(nPtNum);
+ sal_uInt16 nGlueIdx=pGPL->FindGluePoint(nPtId);
+ if (nGlueIdx!=SDRGLUEPOINT_NOTFOUND)
+ {
+ pGPL->Delete(nGlueIdx);
+ }
+ }
+ pObj->SetChanged();
+ pObj->BroadcastObjectChange();
+ }
+ }
+ }
+ if( bUndo )
+ EndUndo();
+ UnmarkAllGluePoints();
+ if (nMarkAnz!=0)
+ pMod->SetChanged();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrGlueEditView::ImpCopyMarkedGluePoints()
+{
+ const bool bUndo = IsUndoEnabled();
+
+ if( bUndo )
+ BegUndo();
+
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
+ {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ SdrUShortCont* pPts=pM->GetMarkedGluePoints();
+ SdrGluePointList* pGPL=pObj->ForceGluePointList();
+ sal_uIntPtr nPtAnz=pPts==NULL ? 0 : pPts->GetCount();
+ if (nPtAnz!=0 && pGPL!=NULL)
+ {
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
+
+ for (sal_uIntPtr nPtNum=0; nPtNum<nPtAnz; nPtNum++)
+ {
+ sal_uInt16 nPtId=pPts->GetObject(nPtNum);
+ sal_uInt16 nGlueIdx=pGPL->FindGluePoint(nPtId);
+ if (nGlueIdx!=SDRGLUEPOINT_NOTFOUND)
+ {
+ SdrGluePoint aNewGP((*pGPL)[nGlueIdx]); // GluePoint klonen
+ sal_uInt16 nNewIdx=pGPL->Insert(aNewGP); // und einfuegen
+ sal_uInt16 nNewId=(*pGPL)[nNewIdx].GetId(); // Id des neuen GluePoints ermitteln
+ pPts->Replace(nNewId,nPtNum); // und diesen markieren (anstelle des alten)
+ }
+ }
+ }
+ }
+ if( bUndo )
+ EndUndo();
+
+ if (nMarkAnz!=0)
+ pMod->SetChanged();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrGlueEditView::ImpTransformMarkedGluePoints(PGlueTrFunc pTrFunc, const void* p1, const void* p2, const void* p3, const void* p4, const void* p5)
+{
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++) {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ const SdrUShortCont* pPts=pM->GetMarkedGluePoints();
+ sal_uIntPtr nPtAnz=pPts==NULL ? 0 : pPts->GetCount();
+ if (nPtAnz!=0) {
+ SdrGluePointList* pGPL=pObj->ForceGluePointList();
+ if (pGPL!=NULL)
+ {
+ if( IsUndoEnabled() )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
+
+ for (sal_uIntPtr nPtNum=0; nPtNum<nPtAnz; nPtNum++) {
+ sal_uInt16 nPtId=pPts->GetObject(nPtNum);
+ sal_uInt16 nGlueIdx=pGPL->FindGluePoint(nPtId);
+ if (nGlueIdx!=SDRGLUEPOINT_NOTFOUND) {
+ SdrGluePoint& rGP=(*pGPL)[nGlueIdx];
+ Point aPos(rGP.GetAbsolutePos(*pObj));
+ (*pTrFunc)(aPos,p1,p2,p3,p4,p5);
+ rGP.SetAbsolutePos(aPos,*pObj);
+ }
+ }
+ pObj->SetChanged();
+ pObj->BroadcastObjectChange();
+ }
+ }
+ }
+ if (nMarkAnz!=0) pMod->SetChanged();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+static void ImpMove(Point& rPt, const void* p1, const void* /*p2*/, const void* /*p3*/, const void* /*p4*/, const void* /*p5*/)
+{
+ rPt.X()+=((const Size*)p1)->Width();
+ rPt.Y()+=((const Size*)p1)->Height();
+}
+
+void SdrGlueEditView::MoveMarkedGluePoints(const Size& rSiz, bool bCopy)
+{
+ ForceUndirtyMrkPnt();
+ XubString aStr(ImpGetResStr(STR_EditMove));
+ if (bCopy) aStr+=ImpGetResStr(STR_EditWithCopy);
+ BegUndo(aStr,GetDescriptionOfMarkedGluePoints(),SDRREPFUNC_OBJ_MOVE);
+ if (bCopy) ImpCopyMarkedGluePoints();
+ ImpTransformMarkedGluePoints(ImpMove,&rSiz);
+ EndUndo();
+ AdjustMarkHdl();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+static void ImpResize(Point& rPt, const void* p1, const void* p2, const void* p3, const void* /*p4*/, const void* /*p5*/)
+{
+ ResizePoint(rPt,*(const Point*)p1,*(const Fraction*)p2,*(const Fraction*)p3);
+}
+
+void SdrGlueEditView::ResizeMarkedGluePoints(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy)
+{
+ ForceUndirtyMrkPnt();
+ XubString aStr(ImpGetResStr(STR_EditResize));
+ if (bCopy) aStr+=ImpGetResStr(STR_EditWithCopy);
+ BegUndo(aStr,GetDescriptionOfMarkedGluePoints(),SDRREPFUNC_OBJ_RESIZE);
+ if (bCopy) ImpCopyMarkedGluePoints();
+ ImpTransformMarkedGluePoints(ImpResize,&rRef,&xFact,&yFact);
+ EndUndo();
+ AdjustMarkHdl();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+static void ImpRotate(Point& rPt, const void* p1, const void* /*p2*/, const void* p3, const void* p4, const void* /*p5*/)
+{
+ RotatePoint(rPt,*(const Point*)p1,*(const double*)p3,*(const double*)p4);
+}
+
+void SdrGlueEditView::RotateMarkedGluePoints(const Point& rRef, long nWink, bool bCopy)
+{
+ ForceUndirtyMrkPnt();
+ XubString aStr(ImpGetResStr(STR_EditRotate));
+ if (bCopy) aStr+=ImpGetResStr(STR_EditWithCopy);
+ BegUndo(aStr,GetDescriptionOfMarkedGluePoints(),SDRREPFUNC_OBJ_ROTATE);
+ if (bCopy) ImpCopyMarkedGluePoints();
+ double nSin=sin(nWink*nPi180);
+ double nCos=cos(nWink*nPi180);
+ ImpTransformMarkedGluePoints(ImpRotate,&rRef,&nWink,&nSin,&nCos);
+ EndUndo();
+ AdjustMarkHdl();
+}
+
diff --git a/svx/source/svdraw/svdglue.cxx b/svx/source/svdraw/svdglue.cxx
new file mode 100644
index 000000000000..f5df7171499f
--- /dev/null
+++ b/svx/source/svdraw/svdglue.cxx
@@ -0,0 +1,450 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <tools/debug.hxx>
+
+#include <svx/svdglue.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdtrans.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrGluePoint::SetReallyAbsolute(FASTBOOL bOn, const SdrObject& rObj)
+{
+ if ( bReallyAbsolute != bOn )
+ {
+ if ( bOn )
+ {
+ aPos=GetAbsolutePos(rObj);
+ bReallyAbsolute=bOn;
+ }
+ else
+ {
+ bReallyAbsolute=bOn;
+ Point aPt(aPos);
+ SetAbsolutePos(aPt,rObj);
+ }
+ }
+}
+
+Point SdrGluePoint::GetAbsolutePos(const SdrObject& rObj) const
+{
+ if (bReallyAbsolute) return aPos;
+ Rectangle aSnap(rObj.GetSnapRect());
+ Rectangle aBound(rObj.GetSnapRect());
+ Point aPt(aPos);
+
+ Point aOfs(aSnap.Center());
+ switch (GetHorzAlign()) {
+ case SDRHORZALIGN_LEFT : aOfs.X()=aSnap.Left(); break;
+ case SDRHORZALIGN_RIGHT : aOfs.X()=aSnap.Right(); break;
+ }
+ switch (GetVertAlign()) {
+ case SDRVERTALIGN_TOP : aOfs.Y()=aSnap.Top(); break;
+ case SDRVERTALIGN_BOTTOM: aOfs.Y()=aSnap.Bottom(); break;
+ }
+ if (!bNoPercent) {
+ long nXMul=aSnap.Right()-aSnap.Left();
+ long nYMul=aSnap.Bottom()-aSnap.Top();
+ long nXDiv=10000;
+ long nYDiv=10000;
+ if (nXMul!=nXDiv) {
+ aPt.X()*=nXMul;
+ aPt.X()/=nXDiv;
+ }
+ if (nYMul!=nYDiv) {
+ aPt.Y()*=nYMul;
+ aPt.Y()/=nYDiv;
+ }
+ }
+ aPt+=aOfs;
+ // Und nun auf's BoundRect des Objekts begrenzen
+ if (aPt.X()<aBound.Left ()) aPt.X()=aBound.Left ();
+ if (aPt.X()>aBound.Right ()) aPt.X()=aBound.Right ();
+ if (aPt.Y()<aBound.Top ()) aPt.Y()=aBound.Top ();
+ if (aPt.Y()>aBound.Bottom()) aPt.Y()=aBound.Bottom();
+ return aPt;
+}
+
+void SdrGluePoint::SetAbsolutePos(const Point& rNewPos, const SdrObject& rObj)
+{
+ if (bReallyAbsolute) {
+ aPos=rNewPos;
+ return;
+ }
+ Rectangle aSnap(rObj.GetSnapRect());
+ Point aPt(rNewPos);
+
+ Point aOfs(aSnap.Center());
+ switch (GetHorzAlign()) {
+ case SDRHORZALIGN_LEFT : aOfs.X()=aSnap.Left(); break;
+ case SDRHORZALIGN_RIGHT : aOfs.X()=aSnap.Right(); break;
+ }
+ switch (GetVertAlign()) {
+ case SDRVERTALIGN_TOP : aOfs.Y()=aSnap.Top(); break;
+ case SDRVERTALIGN_BOTTOM: aOfs.Y()=aSnap.Bottom(); break;
+ }
+ aPt-=aOfs;
+ if (!bNoPercent) {
+ long nXMul=aSnap.Right()-aSnap.Left();
+ long nYMul=aSnap.Bottom()-aSnap.Top();
+ if (nXMul==0) nXMul=1;
+ if (nYMul==0) nYMul=1;
+ long nXDiv=10000;
+ long nYDiv=10000;
+ if (nXMul!=nXDiv) {
+ aPt.X()*=nXDiv;
+ aPt.X()/=nXMul;
+ }
+ if (nYMul!=nYDiv) {
+ aPt.Y()*=nYDiv;
+ aPt.Y()/=nYMul;
+ }
+ }
+ aPos=aPt;
+}
+
+long SdrGluePoint::GetAlignAngle() const
+{
+ switch (nAlign) {
+ case SDRHORZALIGN_CENTER|SDRVERTALIGN_CENTER: return 0; // Invalid!
+ case SDRHORZALIGN_RIGHT |SDRVERTALIGN_CENTER: return 0;
+ case SDRHORZALIGN_RIGHT |SDRVERTALIGN_TOP : return 4500;
+ case SDRHORZALIGN_CENTER|SDRVERTALIGN_TOP : return 9000;
+ case SDRHORZALIGN_LEFT |SDRVERTALIGN_TOP : return 13500;
+ case SDRHORZALIGN_LEFT |SDRVERTALIGN_CENTER: return 18000;
+ case SDRHORZALIGN_LEFT |SDRVERTALIGN_BOTTOM: return 22500;
+ case SDRHORZALIGN_CENTER|SDRVERTALIGN_BOTTOM: return 27000;
+ case SDRHORZALIGN_RIGHT |SDRVERTALIGN_BOTTOM: return 31500;
+ } // switch
+ return 0;
+}
+
+void SdrGluePoint::SetAlignAngle(long nWink)
+{
+ nWink=NormAngle360(nWink);
+ if (nWink>=33750 || nWink<2250) nAlign=SDRHORZALIGN_RIGHT |SDRVERTALIGN_CENTER;
+ else if (nWink< 6750) nAlign=SDRHORZALIGN_RIGHT |SDRVERTALIGN_TOP ;
+ else if (nWink<11250) nAlign=SDRHORZALIGN_CENTER|SDRVERTALIGN_TOP ;
+ else if (nWink<15750) nAlign=SDRHORZALIGN_LEFT |SDRVERTALIGN_TOP ;
+ else if (nWink<20250) nAlign=SDRHORZALIGN_LEFT |SDRVERTALIGN_CENTER;
+ else if (nWink<24750) nAlign=SDRHORZALIGN_LEFT |SDRVERTALIGN_BOTTOM;
+ else if (nWink<29250) nAlign=SDRHORZALIGN_CENTER|SDRVERTALIGN_BOTTOM;
+ else if (nWink<33750) nAlign=SDRHORZALIGN_RIGHT |SDRVERTALIGN_BOTTOM;
+}
+
+long SdrGluePoint::EscDirToAngle(sal_uInt16 nEsc) const
+{
+ switch (nEsc) {
+ case SDRESC_RIGHT : return 0;
+ case SDRESC_TOP : return 9000;
+ case SDRESC_LEFT : return 18000;
+ case SDRESC_BOTTOM: return 27000;
+ } // switch
+ return 0;
+}
+
+sal_uInt16 SdrGluePoint::EscAngleToDir(long nWink) const
+{
+ nWink=NormAngle360(nWink);
+ if (nWink>=31500 || nWink<4500) return SDRESC_RIGHT;
+ if (nWink<13500) return SDRESC_TOP;
+ if (nWink<22500) return SDRESC_LEFT;
+ if (nWink<31500) return SDRESC_BOTTOM;
+ return 0;
+}
+
+void SdrGluePoint::Rotate(const Point& rRef, long nWink, double sn, double cs, const SdrObject* pObj)
+{
+ Point aPt(pObj!=NULL ? GetAbsolutePos(*pObj) : GetPos());
+ RotatePoint(aPt,rRef,sn,cs);
+ // Bezugskante drehen
+ if(nAlign != (SDRHORZALIGN_CENTER|SDRVERTALIGN_CENTER))
+ {
+ SetAlignAngle(GetAlignAngle()+nWink);
+ }
+ // Austrittsrichtungen drehen
+ sal_uInt16 nEscDir0=nEscDir;
+ sal_uInt16 nEscDir1=0;
+ if ((nEscDir0&SDRESC_LEFT )!=0) nEscDir1|=EscAngleToDir(EscDirToAngle(SDRESC_LEFT )+nWink);
+ if ((nEscDir0&SDRESC_TOP )!=0) nEscDir1|=EscAngleToDir(EscDirToAngle(SDRESC_TOP )+nWink);
+ if ((nEscDir0&SDRESC_RIGHT )!=0) nEscDir1|=EscAngleToDir(EscDirToAngle(SDRESC_RIGHT )+nWink);
+ if ((nEscDir0&SDRESC_BOTTOM)!=0) nEscDir1|=EscAngleToDir(EscDirToAngle(SDRESC_BOTTOM)+nWink);
+ nEscDir=nEscDir1;
+ if (pObj!=NULL) SetAbsolutePos(aPt,*pObj); else SetPos(aPt);
+}
+
+void SdrGluePoint::Mirror(const Point& rRef1, const Point& rRef2, const SdrObject* pObj)
+{
+ Point aPt(rRef2); aPt-=rRef1;
+ long nWink=GetAngle(aPt);
+ Mirror(rRef1,rRef2,nWink,pObj);
+}
+
+void SdrGluePoint::Mirror(const Point& rRef1, const Point& rRef2, long nWink, const SdrObject* pObj)
+{
+ Point aPt(pObj!=NULL ? GetAbsolutePos(*pObj) : GetPos());
+ MirrorPoint(aPt,rRef1,rRef2);
+ // Bezugskante spiegeln
+ if(nAlign != (SDRHORZALIGN_CENTER|SDRVERTALIGN_CENTER))
+ {
+ long nAW=GetAlignAngle();
+ nAW+=2*(nWink-nAW);
+ SetAlignAngle(nAW);
+ }
+ // Austrittsrichtungen spiegeln
+ sal_uInt16 nEscDir0=nEscDir;
+ sal_uInt16 nEscDir1=0;
+ if ((nEscDir0&SDRESC_LEFT)!=0) {
+ long nEW=EscDirToAngle(SDRESC_LEFT);
+ nEW+=2*(nWink-nEW);
+ nEscDir1|=EscAngleToDir(nEW);
+ }
+ if ((nEscDir0&SDRESC_TOP)!=0) {
+ long nEW=EscDirToAngle(SDRESC_TOP);
+ nEW+=2*(nWink-nEW);
+ nEscDir1|=EscAngleToDir(nEW);
+ }
+ if ((nEscDir0&SDRESC_RIGHT)!=0) {
+ long nEW=EscDirToAngle(SDRESC_RIGHT);
+ nEW+=2*(nWink-nEW);
+ nEscDir1|=EscAngleToDir(nEW);
+ }
+ if ((nEscDir0&SDRESC_BOTTOM)!=0) {
+ long nEW=EscDirToAngle(SDRESC_BOTTOM);
+ nEW+=2*(nWink-nEW);
+ nEscDir1|=EscAngleToDir(nEW);
+ }
+ nEscDir=nEscDir1;
+ if (pObj!=NULL) SetAbsolutePos(aPt,*pObj); else SetPos(aPt);
+}
+
+void SdrGluePoint::Shear(const Point& rRef, long /*nWink*/, double tn, FASTBOOL bVShear, const SdrObject* pObj)
+{
+ Point aPt(pObj!=NULL ? GetAbsolutePos(*pObj) : GetPos());
+ ShearPoint(aPt,rRef,tn,bVShear);
+ if (pObj!=NULL) SetAbsolutePos(aPt,*pObj); else SetPos(aPt);
+}
+
+void SdrGluePoint::Draw(OutputDevice& rOut, const SdrObject* pObj) const
+{
+ Color aBackPenColor(COL_WHITE);
+ Color aForePenColor(COL_LIGHTBLUE);
+
+ bool bMapMerk=rOut.IsMapModeEnabled();
+ Point aPt(pObj!=NULL ? GetAbsolutePos(*pObj) : GetPos());
+ aPt=rOut.LogicToPixel(aPt);
+ rOut.EnableMapMode(sal_False);
+ long x=aPt.X(),y=aPt.Y(); // Groesse erstmal fest auf 7 Pixel
+
+ rOut.SetLineColor( aBackPenColor );
+ rOut.DrawLine(Point(x-2,y-3),Point(x+3,y+2));
+ rOut.DrawLine(Point(x-3,y-2),Point(x+2,y+3));
+ rOut.DrawLine(Point(x-3,y+2),Point(x+2,y-3));
+ rOut.DrawLine(Point(x-2,y+3),Point(x+3,y-2));
+
+ if (bNoPercent)
+ {
+ switch (GetHorzAlign())
+ {
+ case SDRHORZALIGN_LEFT : rOut.DrawLine(Point(x-3,y-1),Point(x-3,y+1)); break;
+ case SDRHORZALIGN_RIGHT : rOut.DrawLine(Point(x+3,y-1),Point(x+3,y+1)); break;
+ }
+
+ switch (GetVertAlign())
+ {
+ case SDRVERTALIGN_TOP : rOut.DrawLine(Point(x-1,y-3),Point(x+1,y-3)); break;
+ case SDRVERTALIGN_BOTTOM: rOut.DrawLine(Point(x-1,y+3),Point(x+1,y+3)); break;
+ }
+ }
+
+ rOut.SetLineColor( aForePenColor );
+ rOut.DrawLine(Point(x-2,y-2),Point(x+2,y+2));
+ rOut.DrawLine(Point(x-2,y+2),Point(x+2,y-2));
+ rOut.EnableMapMode(bMapMerk);
+}
+
+void SdrGluePoint::Invalidate(Window& rWin, const SdrObject* pObj) const
+{
+ bool bMapMerk=rWin.IsMapModeEnabled();
+ Point aPt(pObj!=NULL ? GetAbsolutePos(*pObj) : GetPos());
+ aPt=rWin.LogicToPixel(aPt);
+ rWin.EnableMapMode(sal_False);
+ long x=aPt.X(),y=aPt.Y(); // Groesse erstmal fest auf 7 Pixel
+
+ // #111096#
+ // do not erase background, that causes flicker (!)
+ rWin.Invalidate(Rectangle(Point(x-3,y-3),Point(x+3,y+3)), INVALIDATE_NOERASE);
+
+ rWin.EnableMapMode(bMapMerk);
+}
+
+FASTBOOL SdrGluePoint::IsHit(const Point& rPnt, const OutputDevice& rOut, const SdrObject* pObj) const
+{
+ Point aPt(pObj!=NULL ? GetAbsolutePos(*pObj) : GetPos());
+ Size aSiz=rOut.PixelToLogic(Size(3,3));
+ Rectangle aRect(aPt.X()-aSiz.Width(),aPt.Y()-aSiz.Height(),aPt.X()+aSiz.Width(),aPt.Y()+aSiz.Height());
+ return aRect.IsInside(rPnt);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrGluePointList::Clear()
+{
+ sal_uInt16 nAnz=GetCount();
+ for (sal_uInt16 i=0; i<nAnz; i++) {
+ delete GetObject(i);
+ }
+ aList.Clear();
+}
+
+void SdrGluePointList::operator=(const SdrGluePointList& rSrcList)
+{
+ if (GetCount()!=0) Clear();
+ sal_uInt16 nAnz=rSrcList.GetCount();
+ for (sal_uInt16 i=0; i<nAnz; i++) {
+ Insert(rSrcList[i]);
+ }
+}
+
+// Die Id's der Klebepunkte in der Liste sind stets streng monoton steigend!
+// Ggf. wird dem neuen Klebepunkt eine neue Id zugewiesen (wenn diese bereits
+// vergeben ist). Die Id 0 ist reserviert.
+sal_uInt16 SdrGluePointList::Insert(const SdrGluePoint& rGP)
+{
+ SdrGluePoint* pGP=new SdrGluePoint(rGP);
+ sal_uInt16 nId=pGP->GetId();
+ sal_uInt16 nAnz=GetCount();
+ sal_uInt16 nInsPos=nAnz;
+ sal_uInt16 nLastId=nAnz!=0 ? GetObject(nAnz-1)->GetId() : 0;
+ DBG_ASSERT(nLastId>=nAnz,"SdrGluePointList::Insert(): nLastId<nAnz");
+ FASTBOOL bHole=nLastId>nAnz;
+ if (nId<=nLastId) {
+ if (!bHole || nId==0) {
+ nId=nLastId+1;
+ } else {
+ FASTBOOL bBrk=sal_False;
+ for (sal_uInt16 nNum=0; nNum<nAnz && !bBrk; nNum++) {
+ const SdrGluePoint* pGP2=GetObject(nNum);
+ sal_uInt16 nTmpId=pGP2->GetId();
+ if (nTmpId==nId) {
+ nId=nLastId+1; // bereits vorhanden
+ bBrk=sal_True;
+ }
+ if (nTmpId>nId) {
+ nInsPos=nNum; // Hier einfuegen (einsortieren)
+ bBrk=sal_True;
+ }
+ }
+ }
+ pGP->SetId(nId);
+ }
+ aList.Insert(pGP,nInsPos);
+ return nInsPos;
+}
+
+void SdrGluePointList::Invalidate(Window& rWin, const SdrObject* pObj) const
+{
+ sal_uInt16 nAnz=GetCount();
+ for (sal_uInt16 nNum=0; nNum<nAnz; nNum++) {
+ GetObject(nNum)->Invalidate(rWin,pObj);
+ }
+}
+
+sal_uInt16 SdrGluePointList::FindGluePoint(sal_uInt16 nId) const
+{
+ // Hier noch einen optimaleren Suchalgorithmus implementieren.
+ // Die Liste sollte stets sortiert sein!!!!
+ sal_uInt16 nAnz=GetCount();
+ sal_uInt16 nRet=SDRGLUEPOINT_NOTFOUND;
+ for (sal_uInt16 nNum=0; nNum<nAnz && nRet==SDRGLUEPOINT_NOTFOUND; nNum++) {
+ const SdrGluePoint* pGP=GetObject(nNum);
+ if (pGP->GetId()==nId) nRet=nNum;
+ }
+ return nRet;
+}
+
+sal_uInt16 SdrGluePointList::HitTest(const Point& rPnt, const OutputDevice& rOut, const SdrObject* pObj, FASTBOOL bBack, FASTBOOL bNext, sal_uInt16 nId0) const
+{
+ sal_uInt16 nAnz=GetCount();
+ sal_uInt16 nRet=SDRGLUEPOINT_NOTFOUND;
+ sal_uInt16 nNum=bBack ? 0 : nAnz;
+ while ((bBack ? nNum<nAnz : nNum>0) && nRet==SDRGLUEPOINT_NOTFOUND) {
+ if (!bBack) nNum--;
+ const SdrGluePoint* pGP=GetObject(nNum);
+ if (bNext) {
+ if (pGP->GetId()==nId0) bNext=sal_False;
+ } else {
+ if (pGP->IsHit(rPnt,rOut,pObj)) nRet=nNum;
+ }
+ if (bBack) nNum++;
+ }
+ return nRet;
+}
+
+void SdrGluePointList::SetReallyAbsolute(FASTBOOL bOn, const SdrObject& rObj)
+{
+ sal_uInt16 nAnz=GetCount();
+ for (sal_uInt16 nNum=0; nNum<nAnz; nNum++) {
+ GetObject(nNum)->SetReallyAbsolute(bOn,rObj);
+ }
+}
+
+void SdrGluePointList::Rotate(const Point& rRef, long nWink, double sn, double cs, const SdrObject* pObj)
+{
+ sal_uInt16 nAnz=GetCount();
+ for (sal_uInt16 nNum=0; nNum<nAnz; nNum++) {
+ GetObject(nNum)->Rotate(rRef,nWink,sn,cs,pObj);
+ }
+}
+
+void SdrGluePointList::Mirror(const Point& rRef1, const Point& rRef2, const SdrObject* pObj)
+{
+ Point aPt(rRef2); aPt-=rRef1;
+ long nWink=GetAngle(aPt);
+ Mirror(rRef1,rRef2,nWink,pObj);
+}
+
+void SdrGluePointList::Mirror(const Point& rRef1, const Point& rRef2, long nWink, const SdrObject* pObj)
+{
+ sal_uInt16 nAnz=GetCount();
+ for (sal_uInt16 nNum=0; nNum<nAnz; nNum++) {
+ GetObject(nNum)->Mirror(rRef1,rRef2,nWink,pObj);
+ }
+}
+
+void SdrGluePointList::Shear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear, const SdrObject* pObj)
+{
+ sal_uInt16 nAnz=GetCount();
+ for (sal_uInt16 nNum=0; nNum<nAnz; nNum++) {
+ GetObject(nNum)->Shear(rRef,nWink,tn,bVShear,pObj);
+ }
+}
+
+// eof
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
new file mode 100644
index 000000000000..b587945b183d
--- /dev/null
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -0,0 +1,2417 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <algorithm>
+
+#include <svx/svdhdl.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/svdmrkv.hxx>
+#include <vcl/window.hxx>
+
+#include <vcl/virdev.hxx>
+#include <tools/poly.hxx>
+#include <vcl/bmpacc.hxx>
+
+#include <svx/sxekitm.hxx>
+#include "svx/svdstr.hrc"
+#include "svx/svdglob.hxx"
+
+#include <svx/svdmodel.hxx>
+#include "gradtrns.hxx"
+#include <svx/xflgrit.hxx>
+#include <svx/svdundo.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/xflftrit.hxx>
+
+// #105678#
+#include <svx/svdopath.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <svx/sdr/overlay/overlayanimatedbitmapex.hxx>
+#include <svx/sdr/overlay/overlaybitmapex.hxx>
+#include <svx/sdr/overlay/overlayline.hxx>
+#include <svx/sdr/overlay/overlaytriangle.hxx>
+#include <svx/sdr/overlay/overlayhatchrect.hxx>
+#include <svx/sdrpagewindow.hxx>
+#include <svx/sdrpaintwindow.hxx>
+#include <vcl/svapp.hxx>
+#include <svx/sdr/overlay/overlaypolypolygon.hxx>
+#include <vcl/lazydelete.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// #i15222#
+// Due to the ressource problems in Win95/98 with bitmap ressources i
+// will change this handle bitmap provinging class. Old version was splitting
+// and preparing all small handle bitmaps in device bitmap format, now this will
+// be done on the fly. Thus, tehre is only the one big bitmap remembered. With
+// three source bitmaps, this will be 3 system bitmap ressources instead of hundreds.
+// The price for that needs to be evaluated. Maybe we will need another change here
+// if this is too expensive.
+class SdrHdlBitmapSet
+{
+ // the bitmap holding all infos
+ BitmapEx maMarkersBitmap;
+
+ // the cropped Bitmaps for reusage
+ ::std::vector< BitmapEx > maRealMarkers;
+
+ // elpers
+ BitmapEx& impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const Rectangle& rRectangle);
+
+public:
+ SdrHdlBitmapSet(sal_uInt16 nResId);
+ ~SdrHdlBitmapSet();
+
+ const BitmapEx& GetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd=0);
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#define KIND_COUNT (14)
+#define INDEX_COUNT (6)
+#define INDIVIDUAL_COUNT (4)
+
+SdrHdlBitmapSet::SdrHdlBitmapSet(sal_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)
+ 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()
+{
+}
+
+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
+const BitmapEx& SdrHdlBitmapSet::GetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd)
+{
+ // fill in size and source position in maMarkersBitmap
+ const sal_uInt16 nYPos(nInd * 11);
+
+ switch(eKindOfMarker)
+ {
+ default:
+ {
+ DBG_ERROR( "unknown kind of marker" );
+ // no break here, return Rect_7x7 as default
+ }
+ case Rect_7x7:
+ {
+ return impGetOrCreateTargetBitmap((0 * INDEX_COUNT) + nInd, Rectangle(Point(0, nYPos), Size(7, 7)));
+ }
+
+ case Rect_9x9:
+ {
+ return impGetOrCreateTargetBitmap((1 * INDEX_COUNT) + nInd, Rectangle(Point(7, nYPos), Size(9, 9)));
+ }
+
+ case Rect_11x11:
+ {
+ 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:
+ {
+ 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)));
+ }
+ }
+ }
+
+ case Circ_7x7:
+ {
+ return impGetOrCreateTargetBitmap((4 * INDEX_COUNT) + nInd, Rectangle(Point(27, nYPos), Size(7, 7)));
+ }
+
+ case Circ_9x9:
+ case Customshape1:
+ {
+ return impGetOrCreateTargetBitmap((5 * INDEX_COUNT) + nInd, Rectangle(Point(34, nYPos), Size(9, 9)));
+ }
+
+ case Circ_11x11:
+ {
+ return impGetOrCreateTargetBitmap((6 * INDEX_COUNT) + nInd, Rectangle(Point(43, nYPos), Size(11, 11)));
+ }
+
+ case Elli_7x9:
+ {
+ return impGetOrCreateTargetBitmap((7 * INDEX_COUNT) + nInd, Rectangle(Point(54, nYPos), Size(7, 9)));
+ }
+
+ case Elli_9x11:
+ {
+ return impGetOrCreateTargetBitmap((8 * INDEX_COUNT) + nInd, Rectangle(Point(61, nYPos), Size(9, 11)));
+ }
+
+ case Elli_9x7:
+ {
+ return impGetOrCreateTargetBitmap((9 * INDEX_COUNT) + nInd, Rectangle(Point(70, nYPos), Size(9, 7)));
+ }
+
+ case Elli_11x9:
+ {
+ return impGetOrCreateTargetBitmap((10 * INDEX_COUNT) + nInd, Rectangle(Point(79, nYPos), Size(11, 9)));
+ }
+
+ case RectPlus_7x7:
+ {
+ return impGetOrCreateTargetBitmap((11 * INDEX_COUNT) + nInd, Rectangle(Point(90, nYPos), Size(7, 7)));
+ }
+
+ case RectPlus_9x9:
+ {
+ return impGetOrCreateTargetBitmap((12 * INDEX_COUNT) + nInd, Rectangle(Point(97, nYPos), Size(9, 9)));
+ }
+
+ case RectPlus_11x11:
+ {
+ return impGetOrCreateTargetBitmap((13 * INDEX_COUNT) + nInd, Rectangle(Point(106, nYPos), Size(11, 11)));
+ }
+
+ case Crosshair:
+ {
+ return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 0, Rectangle(Point(0, 68), Size(15, 15)));
+ }
+
+ case Glue:
+ {
+ return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 1, Rectangle(Point(15, 74), Size(9, 9)));
+ }
+
+ case Anchor: // #101688# AnchorTR for SW
+ case AnchorTR:
+ {
+ 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:
+ {
+ return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 3, Rectangle(Point(48, 68), Size(24, 23)));
+ }
+ }
+
+ // cannot happen since all pathes return something; return Rect_7x7 as default (see switch)
+ return maRealMarkers[0];
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrHdlBitmapSet& getSimpleSet()
+{
+ static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aSimpleSet(new SdrHdlBitmapSet(SIP_SA_MARKERS));
+ return *aSimpleSet.get();
+}
+
+SdrHdlBitmapSet& getModernSet()
+{
+ static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aModernSet(new SdrHdlBitmapSet(SIP_SA_FINE_MARKERS));
+ return *aModernSet.get();
+}
+
+SdrHdlBitmapSet& getHighContrastSet()
+{
+ static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aHighContrastSet(new SdrHdlBitmapSet(SIP_SA_ACCESSIBILITY_MARKERS));
+ return *aHighContrastSet.get();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrHdl::SdrHdl():
+ pObj(NULL),
+ pPV(NULL),
+ pHdlList(NULL),
+ eKind(HDL_MOVE),
+ nDrehWink(0),
+ nObjHdlNum(0),
+ nPolyNum(0),
+ nPPntNum(0),
+ nSourceHdlNum(0),
+ bSelect(sal_False),
+ b1PixMore(sal_False),
+ bPlusHdl(sal_False),
+ mbMoveOutside(false),
+ mbMouseOver(false)
+{
+}
+
+SdrHdl::SdrHdl(const Point& rPnt, SdrHdlKind eNewKind):
+ pObj(NULL),
+ pPV(NULL),
+ pHdlList(NULL),
+ aPos(rPnt),
+ eKind(eNewKind),
+ nDrehWink(0),
+ nObjHdlNum(0),
+ nPolyNum(0),
+ nPPntNum(0),
+ nSourceHdlNum(0),
+ bSelect(sal_False),
+ b1PixMore(sal_False),
+ bPlusHdl(sal_False),
+ mbMoveOutside(false),
+ mbMouseOver(false)
+{
+}
+
+SdrHdl::~SdrHdl()
+{
+ GetRidOfIAObject();
+}
+
+void SdrHdl::Set1PixMore(sal_Bool bJa)
+{
+ if(b1PixMore != bJa)
+ {
+ b1PixMore = bJa;
+
+ // create new display
+ Touch();
+ }
+}
+
+void SdrHdl::SetMoveOutside( bool bMoveOutside )
+{
+ if(mbMoveOutside != bMoveOutside)
+ {
+ mbMoveOutside = bMoveOutside;
+
+ // create new display
+ Touch();
+ }
+}
+
+void SdrHdl::SetDrehWink(long n)
+{
+ if(nDrehWink != n)
+ {
+ nDrehWink = n;
+
+ // create new display
+ Touch();
+ }
+}
+
+void SdrHdl::SetPos(const Point& rPnt)
+{
+ if(aPos != rPnt)
+ {
+ // remember new position
+ aPos = rPnt;
+
+ // create new display
+ Touch();
+ }
+}
+
+void SdrHdl::SetSelected(sal_Bool bJa)
+{
+ if(bSelect != bJa)
+ {
+ // remember new value
+ bSelect = bJa;
+
+ // create new display
+ Touch();
+ }
+}
+
+void SdrHdl::SetHdlList(SdrHdlList* pList)
+{
+ if(pHdlList != pList)
+ {
+ // rememver list
+ pHdlList = pList;
+
+ // now its possible to create graphic representation
+ Touch();
+ }
+}
+
+void SdrHdl::SetObj(SdrObject* pNewObj)
+{
+ if(pObj != pNewObj)
+ {
+ // remember new object
+ pObj = pNewObj;
+
+ // graphic representation may have changed
+ Touch();
+ }
+}
+
+void SdrHdl::Touch()
+{
+ // force update of graphic representation
+ CreateB2dIAObject();
+}
+
+void SdrHdl::GetRidOfIAObject()
+{
+ //OLMaIAOGroup.Delete();
+
+ // OVERLAYMANAGER
+ maOverlayGroup.clear();
+}
+
+void SdrHdl::CreateB2dIAObject()
+{
+ // first throw away old one
+ GetRidOfIAObject();
+
+ if(pHdlList && pHdlList->GetView() && !pHdlList->GetView()->areMarkHandlesHidden())
+ {
+ BitmapColorIndex eColIndex = LightGreen;
+ BitmapMarkerKind eKindOfMarker = Rect_7x7;
+
+ sal_Bool bRot = pHdlList->IsRotateShear();
+ if(pObj)
+ eColIndex = (bSelect) ? Cyan : LightCyan;
+ if(bRot)
+ {
+ // Drehhandles in Rot
+ if(pObj && bSelect)
+ eColIndex = Red;
+ else
+ eColIndex = LightRed;
+ }
+
+ switch(eKind)
+ {
+ case HDL_MOVE:
+ {
+ eKindOfMarker = (b1PixMore) ? Rect_9x9 : Rect_7x7;
+ break;
+ }
+ case HDL_UPLFT:
+ case HDL_UPRGT:
+ case HDL_LWLFT:
+ case HDL_LWRGT:
+ {
+ // corner handles
+ if(bRot)
+ {
+ eKindOfMarker = Circ_7x7;
+ }
+ else
+ {
+ eKindOfMarker = Rect_7x7;
+ }
+ break;
+ }
+ case HDL_UPPER:
+ case HDL_LOWER:
+ {
+ // Upper/Lower handles
+ if(bRot)
+ {
+ eKindOfMarker = Elli_9x7;
+ }
+ else
+ {
+ eKindOfMarker = Rect_7x7;
+ }
+ break;
+ }
+ case HDL_LEFT:
+ case HDL_RIGHT:
+ {
+ // Left/Right handles
+ if(bRot)
+ {
+ eKindOfMarker = Elli_7x9;
+ }
+ else
+ {
+ eKindOfMarker = Rect_7x7;
+ }
+ break;
+ }
+ case HDL_POLY:
+ {
+ if(bRot)
+ {
+ eKindOfMarker = (b1PixMore) ? Circ_9x9 : Circ_7x7;
+ }
+ else
+ {
+ eKindOfMarker = (b1PixMore) ? Rect_9x9 : Rect_7x7;
+ }
+ break;
+ }
+ case HDL_BWGT: // weight at poly
+ {
+ eKindOfMarker = Circ_7x7;
+ break;
+ }
+ case HDL_CIRC:
+ {
+ eKindOfMarker = Rect_11x11;
+ break;
+ }
+ case HDL_REF1:
+ case HDL_REF2:
+ {
+ eKindOfMarker = Crosshair;
+ break;
+ }
+ case HDL_GLUE:
+ {
+ eKindOfMarker = Glue;
+ break;
+ }
+ case HDL_ANCHOR:
+ {
+ eKindOfMarker = Anchor;
+ break;
+ }
+ case HDL_USER:
+ {
+ break;
+ }
+ // #101688# top right anchor for SW
+ case HDL_ANCHOR_TR:
+ {
+ eKindOfMarker = AnchorTR;
+ break;
+ }
+
+ // for SJ and the CustomShapeHandles:
+ case HDL_CUSTOMSHAPE1:
+ {
+ eKindOfMarker = Customshape1;
+ eColIndex = Yellow;
+ break;
+ }
+ default:
+ break;
+ }
+
+ SdrMarkView* pView = pHdlList->GetView();
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(pPageView)
+ {
+ for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
+ {
+ // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b];
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
+ {
+ Point aMoveOutsideOffset(0, 0);
+
+ // add offset if necessary
+ if(pHdlList->IsMoveOutside() || mbMoveOutside)
+ {
+ OutputDevice& rOutDev = rPageWindow.GetPaintWindow().GetOutputDevice();
+ Size aOffset = rOutDev.PixelToLogic(Size(4, 4));
+
+ if(eKind == HDL_UPLFT || eKind == HDL_UPPER || eKind == HDL_UPRGT)
+ aMoveOutsideOffset.Y() -= aOffset.Width();
+ if(eKind == HDL_LWLFT || eKind == HDL_LOWER || eKind == HDL_LWRGT)
+ aMoveOutsideOffset.Y() += aOffset.Height();
+ if(eKind == HDL_UPLFT || eKind == HDL_LEFT || eKind == HDL_LWLFT)
+ aMoveOutsideOffset.X() -= aOffset.Width();
+ if(eKind == HDL_UPRGT || eKind == HDL_RIGHT || eKind == HDL_LWRGT)
+ aMoveOutsideOffset.X() += aOffset.Height();
+ }
+
+ if(rPageWindow.GetOverlayManager())
+ {
+ basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
+ ::sdr::overlay::OverlayObject* pNewOverlayObject = CreateOverlayObject(
+ aPosition,
+ eColIndex,
+ eKindOfMarker,
+ aMoveOutsideOffset);
+
+ // OVERLAYMANAGER
+ if(pNewOverlayObject)
+ {
+ rPageWindow.GetOverlayManager()->add(*pNewOverlayObject);
+ maOverlayGroup.append(*pNewOverlayObject);
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+BitmapMarkerKind SdrHdl::GetNextBigger(BitmapMarkerKind eKnd) const
+{
+ BitmapMarkerKind eRetval(eKnd);
+
+ switch(eKnd)
+ {
+ case Rect_7x7: eRetval = Rect_9x9; break;
+ case Rect_9x9: eRetval = Rect_11x11; break;
+ case Rect_11x11: eRetval = Rect_13x13; break;
+ //case Rect_13x13: eRetval = ; break;
+
+ case Circ_7x7: eRetval = Circ_9x9; break;
+ case Circ_9x9: eRetval = Circ_11x11; break;
+ //case Circ_11x11: eRetval = ; break;
+
+ case Elli_7x9: eRetval = Elli_9x11; break;
+ //case Elli_9x11: eRetval = ; break;
+
+ case Elli_9x7: eRetval = Elli_11x9; break;
+ //case Elli_11x9: eRetval = ; break;
+
+ case RectPlus_7x7: eRetval = RectPlus_9x9; break;
+ case RectPlus_9x9: eRetval = RectPlus_11x11; break;
+ //case RectPlus_11x11: eRetval = ; break;
+
+ //case Crosshair: eRetval = ; break;
+ //case Glue: eRetval = ; break;
+
+ // #98388# let anchor blink with it's pressed state
+ case Anchor: eRetval = AnchorPressed; break;
+
+ // #101688# same for AnchorTR
+ case AnchorTR: eRetval = AnchorPressedTR; break;
+ default:
+ break;
+ }
+
+ return eRetval;
+}
+
+// #101928#
+BitmapEx SdrHdl::ImpGetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd, sal_Bool bFine, sal_Bool bIsHighContrast)
+{
+ if(bIsHighContrast)
+ {
+ return getHighContrastSet().GetBitmapEx(eKindOfMarker, nInd);
+ }
+ else
+ {
+ if(bFine)
+ {
+ return getModernSet().GetBitmapEx(eKindOfMarker, nInd);
+ }
+ else
+ {
+ return getSimpleSet().GetBitmapEx(eKindOfMarker, nInd);
+ }
+ }
+}
+
+::sdr::overlay::OverlayObject* SdrHdl::CreateOverlayObject(
+ const basegfx::B2DPoint& rPos,
+ BitmapColorIndex eColIndex, BitmapMarkerKind eKindOfMarker, Point aMoveOutsideOffset)
+{
+ ::sdr::overlay::OverlayObject* pRetval = 0L;
+ sal_Bool bIsFineHdl(pHdlList->IsFineHdl());
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+ sal_Bool bIsHighContrast(rStyleSettings.GetHighContrastMode());
+
+ // support bigger sizes
+ sal_Bool bForceBiggerSize(sal_False);
+
+ if(pHdlList->GetHdlSize() > 3)
+ {
+ bForceBiggerSize = sal_True;
+ }
+
+ // #101928# ...for high contrast, too.
+ if(!bForceBiggerSize && bIsHighContrast)
+ {
+ // #107925#
+ // ...but not for anchors, else they will not blink when activated
+ if(Anchor != eKindOfMarker && AnchorTR != eKindOfMarker)
+ {
+ bForceBiggerSize = sal_True;
+ }
+ }
+
+ if(bForceBiggerSize)
+ {
+ eKindOfMarker = GetNextBigger(eKindOfMarker);
+ }
+
+ // #97016# II This handle has the focus, visualize it
+ if(IsFocusHdl() && pHdlList && pHdlList->GetFocusHdl() == this)
+ {
+ // create animated handle
+ BitmapMarkerKind eNextBigger = GetNextBigger(eKindOfMarker);
+
+ if(eNextBigger == eKindOfMarker)
+ {
+ // this may happen for the not supported getting-bigger types.
+ // Choose an alternative here
+ switch(eKindOfMarker)
+ {
+ case Rect_13x13: eNextBigger = Rect_11x11; break;
+ case Circ_11x11: eNextBigger = Elli_11x9; break;
+ case Elli_9x11: eNextBigger = Elli_11x9; break;
+ case Elli_11x9: eNextBigger = Elli_9x11; break;
+ case RectPlus_11x11: eNextBigger = Rect_13x13; break;
+
+ case Crosshair:
+ eNextBigger = Glue;
+ break;
+
+ case Glue:
+ eNextBigger = Crosshair;
+ break;
+ default:
+ break;
+ }
+ }
+
+ // create animated hdl
+ // #101928# use ImpGetBitmapEx(...) now
+ BitmapEx aBmpEx1 = ImpGetBitmapEx(eKindOfMarker, (sal_uInt16)eColIndex, bIsFineHdl, bIsHighContrast);
+ BitmapEx aBmpEx2 = ImpGetBitmapEx(eNextBigger, (sal_uInt16)eColIndex, bIsFineHdl, bIsHighContrast);
+
+ // #i53216# Use system cursor blink time. Use the unsigned value.
+ const sal_uInt32 nBlinkTime((sal_uInt32)Application::GetSettings().GetStyleSettings().GetCursorBlinkTime());
+
+ if(eKindOfMarker == Anchor || eKindOfMarker == AnchorPressed)
+ {
+ // #98388# when anchor is used take upper left as reference point inside the handle
+ pRetval = new ::sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime);
+ }
+ else if(eKindOfMarker == AnchorTR || eKindOfMarker == AnchorPressedTR)
+ {
+ // #101688# AnchorTR for SW, take top right as (0,0)
+ pRetval = new ::sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime,
+ (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1), 0,
+ (sal_uInt16)(aBmpEx2.GetSizePixel().Width() - 1), 0);
+ }
+ else
+ {
+ // create centered handle as default
+ pRetval = new ::sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime,
+ (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
+ (sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
+ (sal_uInt16)(aBmpEx2.GetSizePixel().Width() - 1) >> 1,
+ (sal_uInt16)(aBmpEx2.GetSizePixel().Height() - 1) >> 1);
+ }
+ }
+ else
+ {
+ // create normal handle
+ // #101928# use ImpGetBitmapEx(...) now
+ BitmapEx aBmpEx = ImpGetBitmapEx(eKindOfMarker, (sal_uInt16)eColIndex, bIsFineHdl, bIsHighContrast);
+
+ if(eKindOfMarker == Anchor || eKindOfMarker == AnchorPressed)
+ {
+ // #98388# upper left as reference point inside the handle for AnchorPressed, too
+ pRetval = new ::sdr::overlay::OverlayBitmapEx(rPos, aBmpEx);
+ }
+ else if(eKindOfMarker == AnchorTR || eKindOfMarker == AnchorPressedTR)
+ {
+ // #101688# AnchorTR for SW, take top right as (0,0)
+ pRetval = new ::sdr::overlay::OverlayBitmapEx(rPos, aBmpEx,
+ (sal_uInt16)(aBmpEx.GetSizePixel().Width() - 1), 0);
+ }
+ else
+ {
+ sal_uInt16 nCenX((sal_uInt16)(aBmpEx.GetSizePixel().Width() - 1L) >> 1);
+ sal_uInt16 nCenY((sal_uInt16)(aBmpEx.GetSizePixel().Height() - 1L) >> 1);
+
+ if(aMoveOutsideOffset.X() > 0)
+ {
+ nCenX = 0;
+ }
+ else if(aMoveOutsideOffset.X() < 0)
+ {
+ nCenX = (sal_uInt16)(aBmpEx.GetSizePixel().Width() - 1);
+ }
+
+ if(aMoveOutsideOffset.Y() > 0)
+ {
+ nCenY = 0;
+ }
+ else if(aMoveOutsideOffset.Y() < 0)
+ {
+ nCenY = (sal_uInt16)(aBmpEx.GetSizePixel().Height() - 1);
+ }
+
+ // create centered handle as default
+ pRetval = new ::sdr::overlay::OverlayBitmapEx(rPos, aBmpEx, nCenX, nCenY);
+ }
+ }
+
+ return pRetval;
+}
+
+bool SdrHdl::IsHdlHit(const Point& rPnt) const
+{
+ // OVERLAYMANAGER
+ basegfx::B2DPoint aPosition(rPnt.X(), rPnt.Y());
+ return maOverlayGroup.isHitLogic(aPosition);
+}
+
+Pointer SdrHdl::GetPointer() const
+{
+ PointerStyle ePtr=POINTER_MOVE;
+ const sal_Bool bSize=eKind>=HDL_UPLFT && eKind<=HDL_LWRGT;
+ const sal_Bool bRot=pHdlList!=NULL && pHdlList->IsRotateShear();
+ const sal_Bool bDis=pHdlList!=NULL && pHdlList->IsDistortShear();
+ if (bSize && pHdlList!=NULL && (bRot || bDis)) {
+ switch (eKind) {
+ case HDL_UPLFT: case HDL_UPRGT:
+ case HDL_LWLFT: case HDL_LWRGT: ePtr=bRot ? POINTER_ROTATE : POINTER_REFHAND; break;
+ case HDL_LEFT : case HDL_RIGHT: ePtr=POINTER_VSHEAR; break;
+ case HDL_UPPER: case HDL_LOWER: ePtr=POINTER_HSHEAR; break;
+ default:
+ break;
+ }
+ } else {
+ // Fuer Resize von gedrehten Rechtecken die Mauszeiger etwas mitdrehen
+ if (bSize && nDrehWink!=0) {
+ long nHdlWink=0;
+ switch (eKind) {
+ case HDL_LWRGT: nHdlWink=31500; break;
+ case HDL_LOWER: nHdlWink=27000; break;
+ case HDL_LWLFT: nHdlWink=22500; break;
+ case HDL_LEFT : nHdlWink=18000; break;
+ case HDL_UPLFT: nHdlWink=13500; break;
+ case HDL_UPPER: nHdlWink=9000; break;
+ case HDL_UPRGT: nHdlWink=4500; break;
+ case HDL_RIGHT: nHdlWink=0; break;
+ default:
+ break;
+ }
+ nHdlWink+=nDrehWink+2249; // und etwas drauf (zum runden)
+ while (nHdlWink<0) nHdlWink+=36000;
+ while (nHdlWink>=36000) nHdlWink-=36000;
+ nHdlWink/=4500;
+ switch ((sal_uInt8)nHdlWink) {
+ case 0: ePtr=POINTER_ESIZE; break;
+ case 1: ePtr=POINTER_NESIZE; break;
+ case 2: ePtr=POINTER_NSIZE; break;
+ case 3: ePtr=POINTER_NWSIZE; break;
+ case 4: ePtr=POINTER_WSIZE; break;
+ case 5: ePtr=POINTER_SWSIZE; break;
+ case 6: ePtr=POINTER_SSIZE; break;
+ case 7: ePtr=POINTER_SESIZE; break;
+ } // switch
+ } else {
+ switch (eKind) {
+ case HDL_UPLFT: ePtr=POINTER_NWSIZE; break;
+ case HDL_UPPER: ePtr=POINTER_NSIZE; break;
+ case HDL_UPRGT: ePtr=POINTER_NESIZE; break;
+ case HDL_LEFT : ePtr=POINTER_WSIZE; break;
+ case HDL_RIGHT: ePtr=POINTER_ESIZE; break;
+ case HDL_LWLFT: ePtr=POINTER_SWSIZE; break;
+ case HDL_LOWER: ePtr=POINTER_SSIZE; break;
+ case HDL_LWRGT: ePtr=POINTER_SESIZE; break;
+ case HDL_POLY : ePtr=POINTER_MOVEPOINT; break;
+ case HDL_CIRC : ePtr=POINTER_HAND; break;
+ case HDL_REF1 : ePtr=POINTER_REFHAND; break;
+ case HDL_REF2 : ePtr=POINTER_REFHAND; break;
+ case HDL_BWGT : ePtr=POINTER_MOVEBEZIERWEIGHT; break;
+ case HDL_GLUE : ePtr=POINTER_MOVEPOINT; break;
+ case HDL_CUSTOMSHAPE1 : ePtr=POINTER_HAND; break;
+ default:
+ break;
+ }
+ }
+ }
+ return Pointer(ePtr);
+}
+
+// #97016# II
+sal_Bool SdrHdl::IsFocusHdl() const
+{
+ switch(eKind)
+ {
+ case HDL_UPLFT: // Oben links
+ case HDL_UPPER: // Oben
+ case HDL_UPRGT: // Oben rechts
+ case HDL_LEFT: // Links
+ case HDL_RIGHT: // Rechts
+ case HDL_LWLFT: // Unten links
+ case HDL_LOWER: // Unten
+ case HDL_LWRGT: // Unten rechts
+ {
+ // if it's a activated TextEdit, it's moved to extended points
+ if(pHdlList && pHdlList->IsMoveOutside())
+ return sal_False;
+ else
+ return sal_True;
+ }
+
+ case HDL_MOVE: // Handle zum Verschieben des Objekts
+ case HDL_POLY: // Punktselektion an Polygon oder Bezierkurve
+ case HDL_BWGT: // Gewicht an einer Bezierkurve
+ case HDL_CIRC: // Winkel an Kreissegmenten, Eckenradius am Rect
+ case HDL_REF1: // Referenzpunkt 1, z.B. Rotationsmitte
+ case HDL_REF2: // Referenzpunkt 2, z.B. Endpunkt der Spiegelachse
+ //case HDL_MIRX: // Die Spiegelachse selbst
+ case HDL_GLUE: // GluePoint
+
+ // #98388# do NOT activate here, let SW implement their own SdrHdl and
+ // overload IsFocusHdl() there to make the anchor accessible
+ //case HDL_ANCHOR: // anchor symbol (SD, SW)
+ // #101688# same for AnchorTR
+ //case HDL_ANCHOR_TR: // anchor symbol (SD, SW)
+
+ //case HDL_TRNS: // interactive transparence
+ //case HDL_GRAD: // interactive gradient
+ //case HDL_COLR: // interactive color
+
+ // for SJ and the CustomShapeHandles:
+ case HDL_CUSTOMSHAPE1:
+
+ case HDL_USER:
+ {
+ return sal_True;
+ }
+
+ default:
+ {
+ return sal_False;
+ }
+ }
+}
+
+void SdrHdl::onMouseEnter(const MouseEvent& /*rMEvt*/)
+{
+}
+
+void SdrHdl::onMouseLeave()
+{
+}
+
+bool SdrHdl::isMouseOver() const
+{
+ return mbMouseOver;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// class SdrHdlColor
+
+SdrHdlColor::SdrHdlColor(const Point& rRef, Color aCol, const Size& rSize, sal_Bool bLum)
+: SdrHdl(rRef, HDL_COLR),
+ aMarkerSize(rSize),
+ bUseLuminance(bLum)
+{
+ if(IsUseLuminance())
+ aCol = GetLuminance(aCol);
+
+ // remember color
+ aMarkerColor = aCol;
+}
+
+SdrHdlColor::~SdrHdlColor()
+{
+}
+
+void SdrHdlColor::CreateB2dIAObject()
+{
+ // first throw away old one
+ GetRidOfIAObject();
+
+ if(pHdlList)
+ {
+ SdrMarkView* pView = pHdlList->GetView();
+
+ if(pView && !pView->areMarkHandlesHidden())
+ {
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(pPageView)
+ {
+ for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
+ {
+ // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b];
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
+ {
+ if(rPageWindow.GetOverlayManager())
+ {
+ Bitmap aBmpCol(CreateColorDropper(aMarkerColor));
+ basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
+ ::sdr::overlay::OverlayObject* pNewOverlayObject = new
+ ::sdr::overlay::OverlayBitmapEx(
+ aPosition,
+ BitmapEx(aBmpCol),
+ (sal_uInt16)(aBmpCol.GetSizePixel().Width() - 1) >> 1,
+ (sal_uInt16)(aBmpCol.GetSizePixel().Height() - 1) >> 1
+ );
+ DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
+
+ // OVERLAYMANAGER
+ if(pNewOverlayObject)
+ {
+ rPageWindow.GetOverlayManager()->add(*pNewOverlayObject);
+ maOverlayGroup.append(*pNewOverlayObject);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+Bitmap SdrHdlColor::CreateColorDropper(Color aCol)
+{
+ // get the Bitmap
+ Bitmap aRetval(aMarkerSize, 24);
+ aRetval.Erase(aCol);
+
+ // get write access
+ BitmapWriteAccess* pWrite = aRetval.AcquireWriteAccess();
+ DBG_ASSERT(pWrite, "Got NO write access to a new Bitmap !!!");
+
+ if(pWrite)
+ {
+ // draw outer border
+ sal_Int32 nWidth = aMarkerSize.Width();
+ sal_Int32 nHeight = aMarkerSize.Height();
+
+ pWrite->SetLineColor(Color(COL_LIGHTGRAY));
+ pWrite->DrawLine(Point(0, 0), Point(0, nHeight - 1));
+ pWrite->DrawLine(Point(1, 0), Point(nWidth - 1, 0));
+ pWrite->SetLineColor(Color(COL_GRAY));
+ pWrite->DrawLine(Point(1, nHeight - 1), Point(nWidth - 1, nHeight - 1));
+ pWrite->DrawLine(Point(nWidth - 1, 1), Point(nWidth - 1, nHeight - 2));
+
+ // draw lighter UpperLeft
+ const Color aLightColor(
+ (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetRed() + (sal_Int16)0x0040), (sal_Int16)0x00ff)),
+ (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetGreen() + (sal_Int16)0x0040), (sal_Int16)0x00ff)),
+ (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetBlue() + (sal_Int16)0x0040), (sal_Int16)0x00ff)));
+ pWrite->SetLineColor(aLightColor);
+ pWrite->DrawLine(Point(1, 1), Point(1, nHeight - 2));
+ pWrite->DrawLine(Point(2, 1), Point(nWidth - 2, 1));
+
+ // draw darker LowerRight
+ const Color aDarkColor(
+ (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetRed() - (sal_Int16)0x0040), (sal_Int16)0x0000)),
+ (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetGreen() - (sal_Int16)0x0040), (sal_Int16)0x0000)),
+ (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetBlue() - (sal_Int16)0x0040), (sal_Int16)0x0000)));
+ pWrite->SetLineColor(aDarkColor);
+ pWrite->DrawLine(Point(2, nHeight - 2), Point(nWidth - 2, nHeight - 2));
+ pWrite->DrawLine(Point(nWidth - 2, 2), Point(nWidth - 2, nHeight - 3));
+
+ // get rid of write access
+ delete pWrite;
+ }
+
+ return aRetval;
+}
+
+Color SdrHdlColor::GetLuminance(const Color& rCol)
+{
+ sal_uInt8 aLum = rCol.GetLuminance();
+ Color aRetval(aLum, aLum, aLum);
+ return aRetval;
+}
+
+void SdrHdlColor::CallColorChangeLink()
+{
+ aColorChangeHdl.Call(this);
+}
+
+void SdrHdlColor::SetColor(Color aNew, sal_Bool bCallLink)
+{
+ if(IsUseLuminance())
+ aNew = GetLuminance(aNew);
+
+ if(aMarkerColor != aNew)
+ {
+ // remember new color
+ aMarkerColor = aNew;
+
+ // create new display
+ Touch();
+
+ // tell about change
+ if(bCallLink)
+ CallColorChangeLink();
+ }
+}
+
+void SdrHdlColor::SetSize(const Size& rNew)
+{
+ if(rNew != aMarkerSize)
+ {
+ // remember new size
+ aMarkerSize = rNew;
+
+ // create new display
+ Touch();
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// class SdrHdlGradient
+
+SdrHdlGradient::SdrHdlGradient(const Point& rRef1, const Point& rRef2, sal_Bool bGrad)
+: SdrHdl(rRef1, bGrad ? HDL_GRAD : HDL_TRNS),
+ pColHdl1(NULL),
+ pColHdl2(NULL),
+ a2ndPos(rRef2),
+ bGradient(bGrad)
+{
+}
+
+SdrHdlGradient::~SdrHdlGradient()
+{
+}
+
+void SdrHdlGradient::Set2ndPos(const Point& rPnt)
+{
+ if(a2ndPos != rPnt)
+ {
+ // remember new position
+ a2ndPos = rPnt;
+
+ // create new display
+ Touch();
+ }
+}
+
+void SdrHdlGradient::CreateB2dIAObject()
+{
+ // first throw away old one
+ GetRidOfIAObject();
+
+ if(pHdlList)
+ {
+ SdrMarkView* pView = pHdlList->GetView();
+
+ if(pView && !pView->areMarkHandlesHidden())
+ {
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(pPageView)
+ {
+ for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
+ {
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
+ {
+ if(rPageWindow.GetOverlayManager())
+ {
+ // striped line in between
+ basegfx::B2DVector aVec(a2ndPos.X() - aPos.X(), a2ndPos.Y() - aPos.Y());
+ double fVecLen = aVec.getLength();
+ double fLongPercentArrow = (1.0 - 0.05) * fVecLen;
+ double fHalfArrowWidth = (0.05 * 0.5) * fVecLen;
+ aVec.normalize();
+ basegfx::B2DVector aPerpend(-aVec.getY(), aVec.getX());
+ sal_Int32 nMidX = (sal_Int32)(aPos.X() + aVec.getX() * fLongPercentArrow);
+ sal_Int32 nMidY = (sal_Int32)(aPos.Y() + aVec.getY() * fLongPercentArrow);
+ Point aMidPoint(nMidX, nMidY);
+
+ basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
+ basegfx::B2DPoint aMidPos(aMidPoint.X(), aMidPoint.Y());
+
+ ::sdr::overlay::OverlayObject* pNewOverlayObject = new
+ ::sdr::overlay::OverlayLineStriped(
+ aPosition, aMidPos
+ );
+ DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
+
+ pNewOverlayObject->setBaseColor(IsGradient() ? Color(COL_BLACK) : Color(COL_BLUE));
+ rPageWindow.GetOverlayManager()->add(*pNewOverlayObject);
+ maOverlayGroup.append(*pNewOverlayObject);
+
+ // arrowhead
+ Point aLeft(aMidPoint.X() + (sal_Int32)(aPerpend.getX() * fHalfArrowWidth),
+ aMidPoint.Y() + (sal_Int32)(aPerpend.getY() * fHalfArrowWidth));
+ Point aRight(aMidPoint.X() - (sal_Int32)(aPerpend.getX() * fHalfArrowWidth),
+ aMidPoint.Y() - (sal_Int32)(aPerpend.getY() * fHalfArrowWidth));
+
+ basegfx::B2DPoint aPositionLeft(aLeft.X(), aLeft.Y());
+ basegfx::B2DPoint aPositionRight(aRight.X(), aRight.Y());
+ basegfx::B2DPoint aPosition2(a2ndPos.X(), a2ndPos.Y());
+
+ pNewOverlayObject = new
+ ::sdr::overlay::OverlayTriangle(
+ aPositionLeft,
+ aPosition2,
+ aPositionRight,
+ IsGradient() ? Color(COL_BLACK) : Color(COL_BLUE)
+ );
+ DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
+
+ rPageWindow.GetOverlayManager()->add(*pNewOverlayObject);
+ maOverlayGroup.append(*pNewOverlayObject);
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+IMPL_LINK(SdrHdlGradient, ColorChangeHdl, SdrHdl*, /*pHdl*/)
+{
+ if(GetObj())
+ FromIAOToItem(GetObj(), sal_True, sal_True);
+ return 0;
+}
+
+void SdrHdlGradient::FromIAOToItem(SdrObject* _pObj, sal_Bool bSetItemOnObject, sal_Bool bUndo)
+{
+ // from IAO positions and colors to gradient
+ const SfxItemSet& rSet = _pObj->GetMergedItemSet();
+
+ GradTransformer aGradTransformer;
+ GradTransGradient aOldGradTransGradient;
+ GradTransGradient aGradTransGradient;
+ GradTransVector aGradTransVector;
+
+ String aString;
+
+ aGradTransVector.maPositionA = basegfx::B2DPoint(GetPos().X(), GetPos().Y());
+ aGradTransVector.maPositionB = basegfx::B2DPoint(Get2ndPos().X(), Get2ndPos().Y());
+ if(pColHdl1)
+ aGradTransVector.aCol1 = pColHdl1->GetColor();
+ if(pColHdl2)
+ aGradTransVector.aCol2 = pColHdl2->GetColor();
+
+ if(IsGradient())
+ aOldGradTransGradient.aGradient = ((XFillGradientItem&)rSet.Get(XATTR_FILLGRADIENT)).GetGradientValue();
+ else
+ aOldGradTransGradient.aGradient = ((XFillFloatTransparenceItem&)rSet.Get(XATTR_FILLFLOATTRANSPARENCE)).GetGradientValue();
+
+ // transform vector data to gradient
+ aGradTransformer.VecToGrad(aGradTransVector, aGradTransGradient, aOldGradTransGradient, _pObj, bMoveSingleHandle, bMoveFirstHandle);
+
+ if(bSetItemOnObject)
+ {
+ SdrModel* pModel = _pObj->GetModel();
+ SfxItemSet aNewSet(pModel->GetItemPool());
+
+ if(IsGradient())
+ {
+ aString = String();
+ XFillGradientItem aNewGradItem(aString, aGradTransGradient.aGradient);
+ aNewSet.Put(aNewGradItem);
+ }
+ else
+ {
+ aString = String();
+ XFillFloatTransparenceItem aNewTransItem(aString, aGradTransGradient.aGradient);
+ aNewSet.Put(aNewTransItem);
+ }
+
+ if(bUndo && pModel->IsUndoEnabled())
+ {
+ pModel->BegUndo(SVX_RESSTR(IsGradient() ? SIP_XA_FILLGRADIENT : SIP_XA_FILLTRANSPARENCE));
+ pModel->AddUndo(pModel->GetSdrUndoFactory().CreateUndoAttrObject(*_pObj));
+ pModel->EndUndo();
+ }
+
+ pObj->SetMergedItemSetAndBroadcast(aNewSet);
+ }
+
+ // back transformation, set values on pIAOHandle
+ aGradTransformer.GradToVec(aGradTransGradient, aGradTransVector, _pObj);
+
+ SetPos(Point(FRound(aGradTransVector.maPositionA.getX()), FRound(aGradTransVector.maPositionA.getY())));
+ Set2ndPos(Point(FRound(aGradTransVector.maPositionB.getX()), FRound(aGradTransVector.maPositionB.getY())));
+ if(pColHdl1)
+ {
+ pColHdl1->SetPos(Point(FRound(aGradTransVector.maPositionA.getX()), FRound(aGradTransVector.maPositionA.getY())));
+ pColHdl1->SetColor(aGradTransVector.aCol1);
+ }
+ if(pColHdl2)
+ {
+ pColHdl2->SetPos(Point(FRound(aGradTransVector.maPositionB.getX()), FRound(aGradTransVector.maPositionB.getY())));
+ pColHdl2->SetColor(aGradTransVector.aCol2);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrHdlLine::~SdrHdlLine() {}
+
+void SdrHdlLine::CreateB2dIAObject()
+{
+ // first throw away old one
+ GetRidOfIAObject();
+
+ if(pHdlList)
+ {
+ SdrMarkView* pView = pHdlList->GetView();
+
+ if(pView && !pView->areMarkHandlesHidden() && pHdl1 && pHdl2)
+ {
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(pPageView)
+ {
+ for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
+ {
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
+ {
+ if(rPageWindow.GetOverlayManager())
+ {
+ basegfx::B2DPoint aPosition1(pHdl1->GetPos().X(), pHdl1->GetPos().Y());
+ basegfx::B2DPoint aPosition2(pHdl2->GetPos().X(), pHdl2->GetPos().Y());
+
+ ::sdr::overlay::OverlayObject* pNewOverlayObject = new
+ ::sdr::overlay::OverlayLineStriped(
+ aPosition1,
+ aPosition2
+ );
+ DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
+
+ // OVERLAYMANAGER
+ if(pNewOverlayObject)
+ {
+ // color(?)
+ pNewOverlayObject->setBaseColor(Color(COL_LIGHTRED));
+
+ rPageWindow.GetOverlayManager()->add(*pNewOverlayObject);
+ maOverlayGroup.append(*pNewOverlayObject);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+Pointer SdrHdlLine::GetPointer() const
+{
+ return Pointer(POINTER_REFHAND);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrHdlBezWgt::~SdrHdlBezWgt() {}
+
+void SdrHdlBezWgt::CreateB2dIAObject()
+{
+ // call parent
+ SdrHdl::CreateB2dIAObject();
+
+ // create lines
+ if(pHdlList)
+ {
+ SdrMarkView* pView = pHdlList->GetView();
+
+ if(pView && !pView->areMarkHandlesHidden())
+ {
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(pPageView)
+ {
+ for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
+ {
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
+ {
+ if(rPageWindow.GetOverlayManager())
+ {
+ basegfx::B2DPoint aPosition1(pHdl1->GetPos().X(), pHdl1->GetPos().Y());
+ basegfx::B2DPoint aPosition2(aPos.X(), aPos.Y());
+
+ if(!aPosition1.equal(aPosition2))
+ {
+ ::sdr::overlay::OverlayObject* pNewOverlayObject = new
+ ::sdr::overlay::OverlayLineStriped(
+ aPosition1,
+ aPosition2
+ );
+ DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
+
+ // OVERLAYMANAGER
+ if(pNewOverlayObject)
+ {
+ // line part is not hittable
+ pNewOverlayObject->setHittable(sal_False);
+
+ // color(?)
+ pNewOverlayObject->setBaseColor(Color(COL_LIGHTBLUE));
+
+ rPageWindow.GetOverlayManager()->add(*pNewOverlayObject);
+ maOverlayGroup.append(*pNewOverlayObject);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+E3dVolumeMarker::E3dVolumeMarker(const basegfx::B2DPolyPolygon& rWireframePoly)
+{
+ aWireframePoly = rWireframePoly;
+}
+
+void E3dVolumeMarker::CreateB2dIAObject()
+{
+ // create lines
+ if(pHdlList)
+ {
+ SdrMarkView* pView = pHdlList->GetView();
+
+ if(pView && !pView->areMarkHandlesHidden())
+ {
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(pPageView)
+ {
+ for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
+ {
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
+ {
+ if(rPageWindow.GetOverlayManager() && aWireframePoly.count())
+ {
+ ::sdr::overlay::OverlayObject* pNewOverlayObject = new
+ ::sdr::overlay::OverlayPolyPolygonStriped(aWireframePoly);
+ DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
+
+ // OVERLAYMANAGER
+ if(pNewOverlayObject)
+ {
+ pNewOverlayObject->setBaseColor(Color(COL_BLACK));
+
+ rPageWindow.GetOverlayManager()->add(*pNewOverlayObject);
+ maOverlayGroup.append(*pNewOverlayObject);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ImpEdgeHdl::~ImpEdgeHdl()
+{
+}
+
+void ImpEdgeHdl::CreateB2dIAObject()
+{
+ if(nObjHdlNum <= 1 && pObj)
+ {
+ // first throw away old one
+ GetRidOfIAObject();
+
+ BitmapColorIndex eColIndex = LightCyan;
+ BitmapMarkerKind eKindOfMarker = Rect_7x7;
+
+ if(pHdlList)
+ {
+ SdrMarkView* pView = pHdlList->GetView();
+
+ if(pView && !pView->areMarkHandlesHidden())
+ {
+ const SdrEdgeObj* pEdge = (SdrEdgeObj*)pObj;
+
+ if(pEdge->GetConnectedNode(nObjHdlNum == 0) != NULL)
+ eColIndex = LightRed;
+
+ if(nPPntNum < 2)
+ {
+ // Handle with plus sign inside
+ eKindOfMarker = Circ_7x7;
+ }
+
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(pPageView)
+ {
+ for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
+ {
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
+ {
+ if(rPageWindow.GetOverlayManager())
+ {
+ basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
+
+ ::sdr::overlay::OverlayObject* pNewOverlayObject = CreateOverlayObject(
+ aPosition,
+ eColIndex,
+ eKindOfMarker);
+
+ // OVERLAYMANAGER
+ if(pNewOverlayObject)
+ {
+ rPageWindow.GetOverlayManager()->add(*pNewOverlayObject);
+ maOverlayGroup.append(*pNewOverlayObject);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ // call parent
+ SdrHdl::CreateB2dIAObject();
+ }
+}
+
+void ImpEdgeHdl::SetLineCode(SdrEdgeLineCode eCode)
+{
+ if(eLineCode != eCode)
+ {
+ // remember new value
+ eLineCode = eCode;
+
+ // create new display
+ Touch();
+ }
+}
+
+Pointer ImpEdgeHdl::GetPointer() const
+{
+ SdrEdgeObj* pEdge=PTR_CAST(SdrEdgeObj,pObj);
+ if (pEdge==NULL)
+ return SdrHdl::GetPointer();
+ if (nObjHdlNum<=1)
+ return Pointer(POINTER_MOVEPOINT); //Pointer(POINTER_DRAW_CONNECT);
+ if (IsHorzDrag())
+ return Pointer(POINTER_ESIZE);
+ else
+ return Pointer(POINTER_SSIZE);
+}
+
+sal_Bool ImpEdgeHdl::IsHorzDrag() const
+{
+ SdrEdgeObj* pEdge=PTR_CAST(SdrEdgeObj,pObj);
+ if (pEdge==NULL)
+ return sal_False;
+ if (nObjHdlNum<=1)
+ return sal_False;
+
+ SdrEdgeKind eEdgeKind = ((SdrEdgeKindItem&)(pEdge->GetObjectItem(SDRATTR_EDGEKIND))).GetValue();
+
+ const SdrEdgeInfoRec& rInfo=pEdge->aEdgeInfo;
+ if (eEdgeKind==SDREDGE_ORTHOLINES || eEdgeKind==SDREDGE_BEZIER)
+ {
+ return !rInfo.ImpIsHorzLine(eLineCode,*pEdge->pEdgeTrack);
+ }
+ else if (eEdgeKind==SDREDGE_THREELINES)
+ {
+ long nWink=nObjHdlNum==2 ? rInfo.nAngle1 : rInfo.nAngle2;
+ if (nWink==0 || nWink==18000)
+ return sal_True;
+ else
+ return sal_False;
+ }
+ return sal_False;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ImpMeasureHdl::~ImpMeasureHdl()
+{
+}
+
+void ImpMeasureHdl::CreateB2dIAObject()
+{
+ // first throw away old one
+ GetRidOfIAObject();
+
+ if(pHdlList)
+ {
+ SdrMarkView* pView = pHdlList->GetView();
+
+ if(pView && !pView->areMarkHandlesHidden())
+ {
+ BitmapColorIndex eColIndex = LightCyan;
+ BitmapMarkerKind eKindOfMarker = Rect_9x9;
+
+ if(nObjHdlNum > 1)
+ {
+ eKindOfMarker = Rect_7x7;
+ }
+
+ if(bSelect)
+ {
+ eColIndex = Cyan;
+ }
+
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(pPageView)
+ {
+ for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
+ {
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
+ {
+ if(rPageWindow.GetOverlayManager())
+ {
+ basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
+
+ ::sdr::overlay::OverlayObject* pNewOverlayObject = CreateOverlayObject(
+ aPosition,
+ eColIndex,
+ eKindOfMarker);
+
+ // OVERLAYMANAGER
+ if(pNewOverlayObject)
+ {
+ rPageWindow.GetOverlayManager()->add(*pNewOverlayObject);
+ maOverlayGroup.append(*pNewOverlayObject);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+Pointer ImpMeasureHdl::GetPointer() const
+{
+ switch (nObjHdlNum)
+ {
+ case 0: case 1: return Pointer(POINTER_HAND);
+ case 2: case 3: return Pointer(POINTER_MOVEPOINT);
+ case 4: case 5: return SdrHdl::GetPointer(); // wird dann entsprechend gedreht
+ } // switch
+ return Pointer(POINTER_NOTALLOWED);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ImpTextframeHdl::ImpTextframeHdl(const Rectangle& rRect) :
+ SdrHdl(rRect.TopLeft(),HDL_MOVE),
+ maRect(rRect)
+{
+}
+
+void ImpTextframeHdl::CreateB2dIAObject()
+{
+ // first throw away old one
+ GetRidOfIAObject();
+
+ if(pHdlList)
+ {
+ SdrMarkView* pView = pHdlList->GetView();
+
+ if(pView && !pView->areMarkHandlesHidden())
+ {
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(pPageView)
+ {
+ for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
+ {
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
+ {
+ if(rPageWindow.GetOverlayManager())
+ {
+ const basegfx::B2DPoint aTopLeft(maRect.Left(), maRect.Top());
+ const basegfx::B2DPoint aBottomRight(maRect.Right(), maRect.Bottom());
+ const svtools::ColorConfig aColorConfig;
+ const Color aHatchCol( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
+
+ ::sdr::overlay::OverlayHatchRect* pNewOverlayObject = new ::sdr::overlay::OverlayHatchRect(
+ aTopLeft,
+ aBottomRight,
+ aHatchCol,
+ 3.0,
+ 3.0,
+ 45 * F_PI180,
+ nDrehWink * -F_PI18000);
+ pNewOverlayObject->setHittable(false);
+
+ // OVERLAYMANAGER
+ if(pNewOverlayObject)
+ {
+ rPageWindow.GetOverlayManager()->add(*pNewOverlayObject);
+ maOverlayGroup.append(*pNewOverlayObject);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class ImpSdrHdlListSorter: public ContainerSorter {
+public:
+ ImpSdrHdlListSorter(Container& rNewCont): ContainerSorter(rNewCont) {}
+ virtual int Compare(const void* pElem1, const void* pElem2) const;
+};
+
+int ImpSdrHdlListSorter::Compare(const void* pElem1, const void* pElem2) const
+{
+ SdrHdlKind eKind1=((SdrHdl*)pElem1)->GetKind();
+ SdrHdlKind eKind2=((SdrHdl*)pElem2)->GetKind();
+ // Level 1: Erst normale Handles, dann Glue, dann User, dann Plushandles, dann Retpunkt-Handles
+ unsigned n1=1;
+ unsigned n2=1;
+ if (eKind1!=eKind2)
+ {
+ if (eKind1==HDL_REF1 || eKind1==HDL_REF2 || eKind1==HDL_MIRX) n1=5;
+ else if (eKind1==HDL_GLUE) n1=2;
+ else if (eKind1==HDL_USER) n1=3;
+ else if (eKind1==HDL_SMARTTAG) n1=0;
+ if (eKind2==HDL_REF1 || eKind2==HDL_REF2 || eKind2==HDL_MIRX) n2=5;
+ else if (eKind2==HDL_GLUE) n2=2;
+ else if (eKind2==HDL_USER) n2=3;
+ else if (eKind2==HDL_SMARTTAG) n2=0;
+ }
+ if (((SdrHdl*)pElem1)->IsPlusHdl()) n1=4;
+ if (((SdrHdl*)pElem2)->IsPlusHdl()) n2=4;
+ if (n1==n2)
+ {
+ // Level 2: PageView (Pointer)
+ SdrPageView* pPV1=((SdrHdl*)pElem1)->GetPageView();
+ SdrPageView* pPV2=((SdrHdl*)pElem2)->GetPageView();
+ if (pPV1==pPV2)
+ {
+ // Level 3: Position (x+y)
+ SdrObject* pObj1=((SdrHdl*)pElem1)->GetObj();
+ SdrObject* pObj2=((SdrHdl*)pElem2)->GetObj();
+ if (pObj1==pObj2)
+ {
+ sal_uInt32 nNum1=((SdrHdl*)pElem1)->GetObjHdlNum();
+ sal_uInt32 nNum2=((SdrHdl*)pElem2)->GetObjHdlNum();
+ if (nNum1==nNum2)
+ { // #48763#
+ if (eKind1==eKind2)
+ return (long)pElem1<(long)pElem2 ? -1 : 1; // Notloesung, um immer die gleiche Sortierung zu haben
+ return (sal_uInt16)eKind1<(sal_uInt16)eKind2 ? -1 : 1;
+ }
+ else
+ return nNum1<nNum2 ? -1 : 1;
+ }
+ else
+ {
+ return (long)pObj1<(long)pObj2 ? -1 : 1;
+ }
+ }
+ else
+ {
+ return (long)pPV1<(long)pPV2 ? -1 : 1;
+ }
+ }
+ else
+ {
+ return n1<n2 ? -1 : 1;
+ }
+}
+
+SdrMarkView* SdrHdlList::GetView() const
+{
+ return pView;
+}
+
+// #105678# Help struct for re-sorting handles
+struct ImplHdlAndIndex
+{
+ SdrHdl* mpHdl;
+ sal_uInt32 mnIndex;
+};
+
+// #105678# Help method for sorting handles taking care of OrdNums, keeping order in
+// single objects and re-sorting polygon handles intuitively
+extern "C" int __LOADONCALLAPI ImplSortHdlFunc( const void* pVoid1, const void* pVoid2 )
+{
+ const ImplHdlAndIndex* p1 = (ImplHdlAndIndex*)pVoid1;
+ const ImplHdlAndIndex* p2 = (ImplHdlAndIndex*)pVoid2;
+
+ if(p1->mpHdl->GetObj() == p2->mpHdl->GetObj())
+ {
+ if(p1->mpHdl->GetObj() && p1->mpHdl->GetObj()->ISA(SdrPathObj))
+ {
+ // same object and a path object
+ if((p1->mpHdl->GetKind() == HDL_POLY || p1->mpHdl->GetKind() == HDL_BWGT)
+ && (p2->mpHdl->GetKind() == HDL_POLY || p2->mpHdl->GetKind() == HDL_BWGT))
+ {
+ // both handles are point or control handles
+ if(p1->mpHdl->GetPolyNum() == p2->mpHdl->GetPolyNum())
+ {
+ if(p1->mpHdl->GetPointNum() < p2->mpHdl->GetPointNum())
+ {
+ return -1;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+ else if(p1->mpHdl->GetPolyNum() < p2->mpHdl->GetPolyNum())
+ {
+ return -1;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+ }
+ }
+ else
+ {
+ if(!p1->mpHdl->GetObj())
+ {
+ return -1;
+ }
+ else if(!p2->mpHdl->GetObj())
+ {
+ return 1;
+ }
+ else
+ {
+ // different objects, use OrdNum for sort
+ const sal_uInt32 nOrdNum1 = p1->mpHdl->GetObj()->GetOrdNum();
+ const sal_uInt32 nOrdNum2 = p2->mpHdl->GetObj()->GetOrdNum();
+
+ if(nOrdNum1 < nOrdNum2)
+ {
+ return -1;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+ }
+
+ // fallback to indices
+ if(p1->mnIndex < p2->mnIndex)
+ {
+ return -1;
+ }
+ else
+ {
+ return 1;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// #97016# II
+
+void SdrHdlList::TravelFocusHdl(sal_Bool bForward)
+{
+ // security correction
+ if(mnFocusIndex != CONTAINER_ENTRY_NOTFOUND && mnFocusIndex >= GetHdlCount())
+ mnFocusIndex = CONTAINER_ENTRY_NOTFOUND;
+
+ if(aList.Count())
+ {
+ // take care of old handle
+ const sal_uIntPtr nOldHdlNum(mnFocusIndex);
+ SdrHdl* pOld = GetHdl(nOldHdlNum);
+ //SDOsal_Bool bRefresh(sal_False);
+
+ if(pOld)
+ {
+ // switch off old handle
+ mnFocusIndex = CONTAINER_ENTRY_NOTFOUND;
+ pOld->Touch();
+ //SDObRefresh = sal_True;
+ }
+
+ // #105678# Alloc pointer array for sorted handle list
+ ImplHdlAndIndex* pHdlAndIndex = new ImplHdlAndIndex[aList.Count()];
+
+ // #105678# build sorted handle list
+ sal_uInt32 a;
+ for( a = 0; a < aList.Count(); a++)
+ {
+ pHdlAndIndex[a].mpHdl = (SdrHdl*)aList.GetObject(a);
+ pHdlAndIndex[a].mnIndex = a;
+ }
+
+ // #105678# qsort all entries
+ qsort(pHdlAndIndex, aList.Count(), sizeof(ImplHdlAndIndex), ImplSortHdlFunc);
+
+ // #105678# look for old num in sorted array
+ sal_uIntPtr nOldHdl(nOldHdlNum);
+
+ if(nOldHdlNum != CONTAINER_ENTRY_NOTFOUND)
+ {
+ for(a = 0; a < aList.Count(); a++)
+ {
+ if(pHdlAndIndex[a].mpHdl == pOld)
+ {
+ nOldHdl = a;
+ break;
+ }
+ }
+ }
+
+ // #105678# build new HdlNum
+ sal_uIntPtr nNewHdl(nOldHdl);
+
+ // #105678# do the focus travel
+ if(bForward)
+ {
+ if(nOldHdl != CONTAINER_ENTRY_NOTFOUND)
+ {
+ if(nOldHdl == aList.Count() - 1)
+ {
+ // end forward run
+ nNewHdl = CONTAINER_ENTRY_NOTFOUND;
+ }
+ else
+ {
+ // simply the next handle
+ nNewHdl++;
+ }
+ }
+ else
+ {
+ // start forward run at first entry
+ nNewHdl = 0;
+ }
+ }
+ else
+ {
+ if(nOldHdl == CONTAINER_ENTRY_NOTFOUND)
+ {
+ // start backward run at last entry
+ nNewHdl = aList.Count() - 1;
+
+ }
+ else
+ {
+ if(nOldHdl == 0)
+ {
+ // end backward run
+ nNewHdl = CONTAINER_ENTRY_NOTFOUND;
+ }
+ else
+ {
+ // simply the previous handle
+ nNewHdl--;
+ }
+ }
+ }
+
+ // #105678# build new HdlNum
+ sal_uInt32 nNewHdlNum(nNewHdl);
+
+ // look for old num in sorted array
+ if(nNewHdl != CONTAINER_ENTRY_NOTFOUND)
+ {
+ SdrHdl* pNew = pHdlAndIndex[nNewHdl].mpHdl;
+
+ for(a = 0; a < aList.Count(); a++)
+ {
+ if((SdrHdl*)aList.GetObject(a) == pNew)
+ {
+ nNewHdlNum = a;
+ break;
+ }
+ }
+ }
+
+ // take care of next handle
+ if(nOldHdlNum != nNewHdlNum)
+ {
+ mnFocusIndex = nNewHdlNum;
+ SdrHdl* pNew = GetHdl(mnFocusIndex);
+
+ if(pNew)
+ {
+ pNew->Touch();
+ //SDObRefresh = sal_True;
+ }
+ }
+
+ // #105678# free mem again
+ delete [] pHdlAndIndex;
+ }
+}
+
+SdrHdl* SdrHdlList::GetFocusHdl() const
+{
+ if(mnFocusIndex != CONTAINER_ENTRY_NOTFOUND && mnFocusIndex < GetHdlCount())
+ return GetHdl(mnFocusIndex);
+ else
+ return 0L;
+}
+
+void SdrHdlList::SetFocusHdl(SdrHdl* pNew)
+{
+ if(pNew)
+ {
+ SdrHdl* pActual = GetFocusHdl();
+
+ if(!pActual || pActual != pNew)
+ {
+ sal_uIntPtr nNewHdlNum = GetHdlNum(pNew);
+
+ if(nNewHdlNum != CONTAINER_ENTRY_NOTFOUND)
+ {
+ //SDOsal_Bool bRefresh(sal_False);
+ mnFocusIndex = nNewHdlNum;
+
+ if(pActual)
+ {
+ pActual->Touch();
+ //SDObRefresh = sal_True;
+ }
+
+ if(pNew)
+ {
+ pNew->Touch();
+ //SDObRefresh = sal_True;
+ }
+
+ //OLMif(bRefresh)
+ //OLM{
+ //OLM if(pView)
+ //OLM pView->RefreshAllIAOManagers();
+ //OLM}
+ }
+ }
+ }
+}
+
+void SdrHdlList::ResetFocusHdl()
+{
+ SdrHdl* pHdl = GetFocusHdl();
+
+ mnFocusIndex = CONTAINER_ENTRY_NOTFOUND;
+
+ if(pHdl)
+ {
+ pHdl->Touch();
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrHdlList::SdrHdlList(SdrMarkView* pV)
+: mnFocusIndex(CONTAINER_ENTRY_NOTFOUND),
+ pView(pV),
+ aList(1024,32,32)
+{
+ nHdlSize = 3;
+ bRotateShear = sal_False;
+ bMoveOutside = sal_False;
+ bDistortShear = sal_False;
+ bFineHandles = sal_False;
+}
+
+SdrHdlList::~SdrHdlList()
+{
+ Clear();
+}
+
+void SdrHdlList::SetHdlSize(sal_uInt16 nSiz)
+{
+ if(nHdlSize != nSiz)
+ {
+ // remember new value
+ nHdlSize = nSiz;
+
+ // propagate change to IAOs
+ for(sal_uInt32 i=0; i<GetHdlCount(); i++)
+ {
+ SdrHdl* pHdl = GetHdl(i);
+ pHdl->Touch();
+ }
+ }
+}
+
+void SdrHdlList::SetMoveOutside(sal_Bool bOn)
+{
+ if(bMoveOutside != bOn)
+ {
+ // remember new value
+ bMoveOutside = bOn;
+
+ // propagate change to IAOs
+ for(sal_uInt32 i=0; i<GetHdlCount(); i++)
+ {
+ SdrHdl* pHdl = GetHdl(i);
+ pHdl->Touch();
+ }
+ }
+}
+
+void SdrHdlList::SetRotateShear(sal_Bool bOn)
+{
+ bRotateShear = bOn;
+}
+
+void SdrHdlList::SetDistortShear(sal_Bool bOn)
+{
+ bDistortShear = bOn;
+}
+
+void SdrHdlList::SetFineHdl(sal_Bool bOn)
+{
+ if(bFineHandles != bOn)
+ {
+ // remember new state
+ bFineHandles = bOn;
+
+ // propagate change to IAOs
+ for(sal_uInt32 i=0; i<GetHdlCount(); i++)
+ {
+ SdrHdl* pHdl = GetHdl(i);
+ pHdl->Touch();
+ }
+ }
+}
+
+SdrHdl* SdrHdlList::RemoveHdl(sal_uIntPtr nNum)
+{
+ SdrHdl* pRetval = (SdrHdl*)aList.Remove(nNum);
+
+ return pRetval;
+}
+
+void SdrHdlList::Clear()
+{
+ for (sal_uIntPtr i=0; i<GetHdlCount(); i++)
+ {
+ SdrHdl* pHdl=GetHdl(i);
+ delete pHdl;
+ }
+ aList.Clear();
+
+ bRotateShear=sal_False;
+ bDistortShear=sal_False;
+}
+
+void SdrHdlList::Sort()
+{
+ // #97016# II: remember current focused handle
+ SdrHdl* pPrev = GetFocusHdl();
+
+ ImpSdrHdlListSorter aSort(aList);
+ aSort.DoSort();
+
+ // #97016# II: get now and compare
+ SdrHdl* pNow = GetFocusHdl();
+
+ if(pPrev != pNow)
+ {
+ //SDOsal_Bool bRefresh(sal_False);
+
+ if(pPrev)
+ {
+ pPrev->Touch();
+ //SDObRefresh = sal_True;
+ }
+
+ if(pNow)
+ {
+ pNow->Touch();
+ //SDObRefresh = sal_True;
+ }
+ }
+}
+
+sal_uIntPtr SdrHdlList::GetHdlNum(const SdrHdl* pHdl) const
+{
+ if (pHdl==NULL)
+ return CONTAINER_ENTRY_NOTFOUND;
+ sal_uIntPtr nPos=aList.GetPos(pHdl);
+ return nPos;
+}
+
+void SdrHdlList::AddHdl(SdrHdl* pHdl, sal_Bool bAtBegin)
+{
+ if (pHdl!=NULL)
+ {
+ if (bAtBegin)
+ {
+ aList.Insert(pHdl,sal_uIntPtr(0));
+ }
+ else
+ {
+ aList.Insert(pHdl,CONTAINER_APPEND);
+ }
+ pHdl->SetHdlList(this);
+ }
+}
+
+SdrHdl* SdrHdlList::IsHdlListHit(const Point& rPnt, sal_Bool bBack, sal_Bool bNext, SdrHdl* pHdl0) const
+{
+ SdrHdl* pRet=NULL;
+ sal_uIntPtr nAnz=GetHdlCount();
+ sal_uIntPtr nNum=bBack ? 0 : nAnz;
+ while ((bBack ? nNum<nAnz : nNum>0) && pRet==NULL)
+ {
+ if (!bBack)
+ nNum--;
+ SdrHdl* pHdl=GetHdl(nNum);
+ if (bNext)
+ {
+ if (pHdl==pHdl0)
+ bNext=sal_False;
+ }
+ else
+ {
+ if (pHdl->IsHdlHit(rPnt))
+ pRet=pHdl;
+ }
+ if (bBack)
+ nNum++;
+ }
+ return pRet;
+}
+
+SdrHdl* SdrHdlList::GetHdl(SdrHdlKind eKind1) const
+{
+ SdrHdl* pRet=NULL;
+ for (sal_uIntPtr i=0; i<GetHdlCount() && pRet==NULL; i++)
+ {
+ SdrHdl* pHdl=GetHdl(i);
+ if (pHdl->GetKind()==eKind1)
+ pRet=pHdl;
+ }
+ return pRet;
+}
+
+// --------------------------------------------------------------------
+// SdrCropHdl
+// --------------------------------------------------------------------
+
+SdrCropHdl::SdrCropHdl(const Point& rPnt, SdrHdlKind eNewKind)
+: SdrHdl( rPnt, eNewKind )
+{
+}
+
+// --------------------------------------------------------------------
+
+BitmapEx SdrCropHdl::GetHandlesBitmap( bool bIsFineHdl, bool bIsHighContrast )
+{
+ if( bIsHighContrast )
+ {
+ static BitmapEx* pHighContrastBitmap = 0;
+ if( pHighContrastBitmap == 0 )
+ pHighContrastBitmap = new BitmapEx(ResId(SIP_SA_ACCESSIBILITY_CROP_MARKERS, *ImpGetResMgr()));
+ return *pHighContrastBitmap;
+ }
+ else if( bIsFineHdl )
+ {
+ static BitmapEx* pModernBitmap = 0;
+ if( pModernBitmap == 0 )
+ pModernBitmap = new BitmapEx(ResId(SIP_SA_CROP_FINE_MARKERS, *ImpGetResMgr()));
+ return *pModernBitmap;
+ }
+ else
+ {
+ static BitmapEx* pSimpleBitmap = 0;
+ if( pSimpleBitmap == 0 )
+ pSimpleBitmap = new BitmapEx(ResId(SIP_SA_CROP_MARKERS, *ImpGetResMgr()));
+ return *pSimpleBitmap;
+ }
+}
+
+// --------------------------------------------------------------------
+
+BitmapEx SdrCropHdl::GetBitmapForHandle( const BitmapEx& rBitmap, int nSize )
+{
+ int nPixelSize = 0, nX = 0, nY = 0, nOffset = 0;
+
+ if( nSize <= 3 )
+ {
+ nPixelSize = 13;
+ nOffset = 0;
+ }
+ else if( nSize <=4 )
+ {
+ nPixelSize = 17;
+ nOffset = 36;
+ }
+ else
+ {
+ nPixelSize = 21;
+ nOffset = 84;
+ }
+
+ switch( eKind )
+ {
+ case HDL_UPLFT: nX = 0; nY = 0; break;
+ case HDL_UPPER: nX = 1; nY = 0; break;
+ case HDL_UPRGT: nX = 2; nY = 0; break;
+ case HDL_LEFT: nX = 0; nY = 1; break;
+ case HDL_RIGHT: nX = 2; nY = 1; break;
+ case HDL_LWLFT: nX = 0; nY = 2; break;
+ case HDL_LOWER: nX = 1; nY = 2; break;
+ case HDL_LWRGT: nX = 2; nY = 2; break;
+ default: break;
+ }
+
+ Rectangle aSourceRect( Point( nX * (nPixelSize-1) + nOffset, nY * (nPixelSize-1)), Size(nPixelSize, nPixelSize) );
+
+ BitmapEx aRetval(rBitmap);
+ aRetval.Crop(aSourceRect);
+ return aRetval;
+}
+
+// --------------------------------------------------------------------
+
+void SdrCropHdl::CreateB2dIAObject()
+{
+ // first throw away old one
+ GetRidOfIAObject();
+
+ SdrMarkView* pView = pHdlList ? pHdlList->GetView() : 0;
+ SdrPageView* pPageView = pView ? pView->GetSdrPageView() : 0;
+
+ if( pPageView && !pView->areMarkHandlesHidden() )
+ {
+ sal_Bool bIsFineHdl(pHdlList->IsFineHdl());
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+ sal_Bool bIsHighContrast(rStyleSettings.GetHighContrastMode());
+ int nHdlSize = pHdlList->GetHdlSize();
+ if( bIsHighContrast )
+ nHdlSize = 4;
+
+ const BitmapEx aHandlesBitmap( GetHandlesBitmap( bIsFineHdl, bIsHighContrast ) );
+ BitmapEx aBmpEx1( GetBitmapForHandle( aHandlesBitmap, nHdlSize ) );
+
+ for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
+ {
+ // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b];
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
+ {
+ if(rPageWindow.GetOverlayManager())
+ {
+ basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
+
+ ::sdr::overlay::OverlayObject* pOverlayObject = 0L;
+
+ // animate focused handles
+ if(IsFocusHdl() && (pHdlList->GetFocusHdl() == this))
+ {
+ if( nHdlSize >= 2 )
+ nHdlSize = 1;
+
+ BitmapEx aBmpEx2( GetBitmapForHandle( aHandlesBitmap, nHdlSize + 1 ) );
+
+ const sal_uInt32 nBlinkTime = sal::static_int_cast<sal_uInt32>(rStyleSettings.GetCursorBlinkTime());
+
+ pOverlayObject = new ::sdr::overlay::OverlayAnimatedBitmapEx(aPosition, aBmpEx1, aBmpEx2, nBlinkTime,
+ (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
+ (sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
+ (sal_uInt16)(aBmpEx2.GetSizePixel().Width() - 1) >> 1,
+ (sal_uInt16)(aBmpEx2.GetSizePixel().Height() - 1) >> 1);
+ }
+ else
+ {
+ // create centered handle as default
+ pOverlayObject = new ::sdr::overlay::OverlayBitmapEx(aPosition, aBmpEx1,
+ (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
+ (sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1);
+ }
+
+ // OVERLAYMANAGER
+ if(pOverlayObject)
+ {
+ rPageWindow.GetOverlayManager()->add(*pOverlayObject);
+ maOverlayGroup.append(*pOverlayObject);
+ }
+ }
+ }
+ }
+ }
+}
+
+// --------------------------------------------------------------------
diff --git a/svx/source/svdraw/svdhlpln.cxx b/svx/source/svdraw/svdhlpln.cxx
new file mode 100644
index 000000000000..588c7a3d57f2
--- /dev/null
+++ b/svx/source/svdraw/svdhlpln.cxx
@@ -0,0 +1,149 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svdhlpln.hxx>
+#include <tools/color.hxx>
+
+#include <vcl/outdev.hxx>
+#include <vcl/window.hxx>
+#include <tools/poly.hxx>
+#include <vcl/lineinfo.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+Pointer SdrHelpLine::GetPointer() const
+{
+ switch (eKind) {
+ case SDRHELPLINE_VERTICAL : return Pointer(POINTER_ESIZE);
+ case SDRHELPLINE_HORIZONTAL: return Pointer(POINTER_SSIZE);
+ default : return Pointer(POINTER_MOVE);
+ } // switch
+}
+
+FASTBOOL SdrHelpLine::IsHit(const Point& rPnt, sal_uInt16 nTolLog, const OutputDevice& rOut) const
+{
+ Size a1Pix(rOut.PixelToLogic(Size(1,1)));
+ FASTBOOL bXHit=rPnt.X()>=aPos.X()-nTolLog && rPnt.X()<=aPos.X()+nTolLog+a1Pix.Width();
+ FASTBOOL bYHit=rPnt.Y()>=aPos.Y()-nTolLog && rPnt.Y()<=aPos.Y()+nTolLog+a1Pix.Height();
+ switch (eKind) {
+ case SDRHELPLINE_VERTICAL : return bXHit;
+ case SDRHELPLINE_HORIZONTAL: return bYHit;
+ case SDRHELPLINE_POINT: {
+ if (bXHit || bYHit) {
+ Size aRad(rOut.PixelToLogic(Size(SDRHELPLINE_POINT_PIXELSIZE,SDRHELPLINE_POINT_PIXELSIZE)));
+ return rPnt.X()>=aPos.X()-aRad.Width() && rPnt.X()<=aPos.X()+aRad.Width()+a1Pix.Width() &&
+ rPnt.Y()>=aPos.Y()-aRad.Height() && rPnt.Y()<=aPos.Y()+aRad.Height()+a1Pix.Height();
+ }
+ } break;
+ } // switch
+ return sal_False;
+}
+
+Rectangle SdrHelpLine::GetBoundRect(const OutputDevice& rOut) const
+{
+ Rectangle aRet(aPos,aPos);
+ Point aOfs(rOut.GetMapMode().GetOrigin());
+ Size aSiz(rOut.GetOutputSize());
+ switch (eKind) {
+ case SDRHELPLINE_VERTICAL : aRet.Top()=-aOfs.Y(); aRet.Bottom()=-aOfs.Y()+aSiz.Height(); break;
+ case SDRHELPLINE_HORIZONTAL: aRet.Left()=-aOfs.X(); aRet.Right()=-aOfs.X()+aSiz.Width(); break;
+ case SDRHELPLINE_POINT : {
+ Size aRad(rOut.PixelToLogic(Size(SDRHELPLINE_POINT_PIXELSIZE,SDRHELPLINE_POINT_PIXELSIZE)));
+ aRet.Left() -=aRad.Width();
+ aRet.Right() +=aRad.Width();
+ aRet.Top() -=aRad.Height();
+ aRet.Bottom()+=aRad.Height();
+ } break;
+ } // switch
+ return aRet;
+}
+
+bool SdrHelpLine::IsVisibleEqual( const SdrHelpLine& rHelpLine, const OutputDevice& rOut ) const
+{
+ if( eKind == rHelpLine.eKind)
+ {
+ Point aPt1(rOut.LogicToPixel(aPos)), aPt2(rOut.LogicToPixel(rHelpLine.aPos));
+ switch( eKind )
+ {
+ case SDRHELPLINE_POINT:
+ return aPt1 == aPt2;
+ case SDRHELPLINE_VERTICAL:
+ return aPt1.X() == aPt2.X();
+ case SDRHELPLINE_HORIZONTAL:
+ return aPt1.Y() == aPt2.Y();
+ }
+ }
+ return false;
+}
+
+void SdrHelpLineList::Clear()
+{
+ sal_uInt16 nAnz=GetCount();
+ for (sal_uInt16 i=0; i<nAnz; i++) {
+ delete GetObject(i);
+ }
+ aList.Clear();
+}
+
+void SdrHelpLineList::operator=(const SdrHelpLineList& rSrcList)
+{
+ Clear();
+ sal_uInt16 nAnz=rSrcList.GetCount();
+ for (sal_uInt16 i=0; i<nAnz; i++) {
+ Insert(rSrcList[i]);
+ }
+}
+
+bool SdrHelpLineList::operator==(const SdrHelpLineList& rSrcList) const
+{
+ FASTBOOL bEqual=sal_False;
+ sal_uInt16 nAnz=GetCount();
+ if (nAnz==rSrcList.GetCount()) {
+ bEqual=sal_True;
+ for (sal_uInt16 i=0; i<nAnz && bEqual; i++) {
+ if (*GetObject(i)!=*rSrcList.GetObject(i)) {
+ bEqual=sal_False;
+ }
+ }
+ }
+ return bEqual;
+}
+
+sal_uInt16 SdrHelpLineList::HitTest(const Point& rPnt, sal_uInt16 nTolLog, const OutputDevice& rOut) const
+{
+ sal_uInt16 nAnz=GetCount();
+ for (sal_uInt16 i=nAnz; i>0;) {
+ i--;
+ if (GetObject(i)->IsHit(rPnt,nTolLog,rOut)) return i;
+ }
+ return SDRHELPLINE_NOTFOUND;
+}
+
+// eof
diff --git a/svx/source/svdraw/svdibrow.cxx b/svx/source/svdraw/svdibrow.cxx
new file mode 100644
index 000000000000..a951819104aa
--- /dev/null
+++ b/svx/source/svdraw/svdibrow.cxx
@@ -0,0 +1,1299 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <editeng/eeitem.hxx>
+
+#include "svdibrow.hxx"
+
+#ifndef _STDLIB_H
+#include <stdlib.h>
+#define _STDLIB_H
+#endif
+
+#include "svx/svditext.hxx"
+#include <editeng/flditem.hxx>
+#include <editeng/editdata.hxx>
+#include <svx/svdpool.hxx>
+#include <svx/svdattr.hxx>
+#include <svx/svdattrx.hxx>
+#include <svx/svdview.hxx>
+#include <svx/xenum.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/xlnstwit.hxx>
+#include <svx/xlnedwit.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xflbmtit.hxx>
+#include <svx/xtextit0.hxx>
+#include <svx/xflbstit.hxx>
+#include <svx/xflbtoxy.hxx>
+#include <svx/xftshit.hxx>
+#include <editeng/colritem.hxx>
+
+
+#include "editeng/fontitem.hxx"
+#include <editeng/fhgtitem.hxx>
+
+#include <editeng/charscaleitem.hxx>
+#include <svl/whiter.hxx>
+#include <svl/flagitem.hxx>
+#include <svl/ptitem.hxx>
+#include <svl/rectitem.hxx>
+
+#include <svl/rngitem.hxx>
+#include <svx/sdrpaintwindow.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#define ITEMBROWSER_WHICHCOL_ID 1
+#define ITEMBROWSER_STATECOL_ID 2
+#define ITEMBROWSER_TYPECOL_ID 3
+#define ITEMBROWSER_NAMECOL_ID 4
+#define ITEMBROWSER_VALUECOL_ID 5
+
+enum ItemType {
+ ITEM_DONTKNOW, ITEM_BYTE, ITEM_INT16, ITEM_UINT16, ITEM_INT32, ITEM_UINT32,
+ ITEM_ENUM, ITEM_BOOL, ITEM_FLAG, ITEM_STRING, ITEM_POINT, ITEM_RECT, ITEM_RANGE, ITEM_LRANGE,
+ ITEM_FRACTION,
+ ITEM_XCOLOR,
+ ITEM_COLOR,
+ ITEM_FONT, ITEM_FONTHEIGHT, ITEM_FONTWIDTH, ITEM_FIELD
+};
+
+class ImpItemListRow
+{
+public:
+ XubString aName;
+ XubString aValue;
+ SfxItemState eState;
+ sal_uInt16 nWhichId;
+
+ TypeId pType;
+ ItemType eItemType;
+
+ sal_Int32 nVal;
+ sal_Int32 nMin;
+ sal_Int32 nMax;
+
+ sal_Bool bComment;
+ sal_Bool bIsNum;
+ sal_Bool bCanNum;
+
+public:
+ ImpItemListRow()
+ : eState(SFX_ITEM_UNKNOWN),
+ nWhichId(0),
+ pType(NULL),
+ eItemType(ITEM_DONTKNOW),
+ nVal(0),
+ nMin(0),
+ nMax(0),
+ bComment(sal_False),
+ bIsNum(sal_False),
+ bCanNum(sal_False)
+ {}
+
+ XubString GetItemTypeStr() const;
+ sal_Bool operator==(const ImpItemListRow& rEntry) const;
+ sal_Bool operator!=(const ImpItemListRow& rEntry) const { return !operator==(rEntry); }
+};
+
+XubString ImpItemListRow::GetItemTypeStr() const
+{
+ XubString aStr;
+
+ switch(eItemType)
+ {
+ case ITEM_BYTE : aStr.AppendAscii("Byte"); break;
+ case ITEM_INT16 : aStr.AppendAscii("Int16"); break;
+ case ITEM_UINT16 : aStr.AppendAscii("UInt16"); break;
+ case ITEM_INT32 : aStr.AppendAscii("Int32"); break;
+ case ITEM_UINT32 : aStr.AppendAscii("UInt32"); break;
+ case ITEM_ENUM : aStr.AppendAscii("Enum"); break;
+ case ITEM_BOOL : aStr.AppendAscii("Bool"); break;
+ case ITEM_FLAG : aStr.AppendAscii("Flag"); break;
+ case ITEM_STRING : aStr.AppendAscii("String"); break;
+ case ITEM_POINT : aStr.AppendAscii("Point"); break;
+ case ITEM_RECT : aStr.AppendAscii("Rectangle");break;
+ case ITEM_RANGE : aStr.AppendAscii("Range"); break;
+ case ITEM_LRANGE : aStr.AppendAscii("LRange"); break;
+ case ITEM_FRACTION : aStr.AppendAscii("Fraction"); break;
+ case ITEM_XCOLOR : aStr.AppendAscii("XColor"); break;
+ case ITEM_COLOR : aStr.AppendAscii("Color"); break;
+ case ITEM_FONT : aStr.AppendAscii("Font"); break;
+ case ITEM_FONTHEIGHT:aStr.AppendAscii("FontHeight");break;
+ case ITEM_FONTWIDTH :aStr.AppendAscii("FontWidth"); break;
+ case ITEM_FIELD :aStr.AppendAscii("Field"); break;
+ default: break;
+ }
+
+ return aStr;
+}
+
+sal_Bool ImpItemListRow::operator==(const ImpItemListRow& rEntry) const
+{
+ return (aName.Equals(rEntry.aName)
+ && aValue.Equals(rEntry.aValue)
+ && eState==rEntry.eState
+ && nWhichId==rEntry.nWhichId
+ && bComment==rEntry.bComment
+ && bIsNum==rEntry.bIsNum
+ && bCanNum==rEntry.bCanNum
+ && pType==rEntry.pType
+ && eItemType==rEntry.eItemType
+ && nVal==rEntry.nVal
+ && nMin==rEntry.nMin
+ && nMax==rEntry.nMax);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class ImpItemEdit: public Edit
+{
+ _SdrItemBrowserControl* pBrowse;
+
+public:
+ ImpItemEdit(Window* pParent, _SdrItemBrowserControl* pBrowse_, WinBits nBits=0)
+ : Edit(pParent, nBits),
+ pBrowse(pBrowse_)
+ {}
+
+ virtual ~ImpItemEdit();
+ virtual void KeyInput(const KeyEvent& rEvt);
+};
+
+__EXPORT ImpItemEdit::~ImpItemEdit()
+{
+}
+
+void __EXPORT ImpItemEdit::KeyInput(const KeyEvent& rKEvt)
+{
+ _SdrItemBrowserControl* pBrowseMerk = pBrowse;
+
+ sal_uInt16 nKeyCode(rKEvt.GetKeyCode().GetCode() + rKEvt.GetKeyCode().GetModifier());
+
+ if(nKeyCode == KEY_RETURN)
+ {
+ pBrowseMerk->EndChangeEntry();
+ pBrowseMerk->GrabFocus();
+ }
+ else if(nKeyCode == KEY_ESCAPE)
+ {
+ pBrowseMerk->BrkChangeEntry();
+ pBrowseMerk->GrabFocus();
+ }
+ else if(nKeyCode == KEY_UP || nKeyCode == KEY_DOWN)
+ {
+ pBrowseMerk->EndChangeEntry();
+ pBrowseMerk->GrabFocus();
+ pBrowseMerk->KeyInput(rKEvt);
+ }
+ else
+ Edit::KeyInput(rKEvt);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#define MYBROWSEMODE (BROWSER_THUMBDRAGGING|BROWSER_KEEPHIGHLIGHT|BROWSER_NO_HSCROLL|BROWSER_HIDECURSOR)
+
+_SdrItemBrowserControl::_SdrItemBrowserControl(Window* pParent, WinBits nBits):
+ BrowseBox(pParent,nBits,MYBROWSEMODE),
+ aList(1024,16,16)
+{
+ ImpCtor();
+}
+
+__EXPORT _SdrItemBrowserControl::~_SdrItemBrowserControl()
+{
+ if(pEditControl)
+ delete pEditControl;
+
+ if(pAktChangeEntry)
+ delete pAktChangeEntry;
+
+ Clear();
+}
+
+void _SdrItemBrowserControl::ImpCtor()
+{
+ pEditControl = NULL;
+ pAktChangeEntry = NULL;
+ nLastWhichOfs = 0;
+ nLastWhich = 0;
+ nLastWhichOben = 0; // not implemented yet
+ nLastWhichUnten = 0; // not implemented yet
+ bWhichesButNames = sal_False;
+ bDontHideIneffectiveItems = sal_False;
+ bDontSortItems = sal_False;
+ bShowWhichIds = sal_False;
+ bShowRealValues = sal_False;
+ bShowWhichIds = sal_True; // not implemented yet
+ bShowRealValues = sal_True; // not implemented yet
+
+ rtl_TextEncoding aTextEncoding = gsl_getSystemTextEncoding();
+
+ InsertDataColumn(
+ ITEMBROWSER_WHICHCOL_ID,
+ String("Which", aTextEncoding),
+ GetTextWidth(String(" Which ", aTextEncoding)) + 2);
+ InsertDataColumn(
+ ITEMBROWSER_STATECOL_ID,
+ String("State", aTextEncoding),
+ Max(GetTextWidth(String(" State ", aTextEncoding)) + 2 ,
+ GetTextWidth(String("DontCare", aTextEncoding)) + 2));
+ InsertDataColumn(
+ ITEMBROWSER_TYPECOL_ID ,
+ String("Type", aTextEncoding),
+ GetTextWidth(String(" Type_ ", aTextEncoding)) + 2);
+ InsertDataColumn(
+ ITEMBROWSER_NAMECOL_ID ,
+ String("Name", aTextEncoding),
+ 150);
+ InsertDataColumn(
+ ITEMBROWSER_VALUECOL_ID,
+ String("Value", aTextEncoding),
+ GetTextWidth(String("12345678901234567890", aTextEncoding)));
+ SetDataRowHeight(
+ GetTextHeight());
+
+ long nWdt=GetColumnWidth(ITEMBROWSER_WHICHCOL_ID)+
+ GetColumnWidth(ITEMBROWSER_STATECOL_ID)+
+ GetColumnWidth(ITEMBROWSER_TYPECOL_ID )+
+ GetColumnWidth(ITEMBROWSER_NAMECOL_ID )+
+ GetColumnWidth(ITEMBROWSER_VALUECOL_ID);
+
+ long nHgt=GetTitleHeight()+16*GetDataRowHeight();
+
+ SetOutputSizePixel(Size(nWdt,nHgt));
+}
+
+void _SdrItemBrowserControl::Clear()
+{
+ sal_uIntPtr nAnz=aList.Count();
+ for (sal_uIntPtr nNum=0; nNum<nAnz; nNum++) {
+ delete ImpGetEntry(nNum);
+ }
+ aList.Clear();
+ BrowseBox::Clear();
+}
+
+long __EXPORT _SdrItemBrowserControl::GetRowCount() const
+{
+ return aList.Count();
+}
+
+sal_Bool __EXPORT _SdrItemBrowserControl::SeekRow(long nRow)
+{
+ nAktPaintRow=nRow;
+ return sal_True;
+}
+
+String _SdrItemBrowserControl::GetCellText(long _nRow, sal_uInt16 _nColId) const
+{
+ String sRet;
+ if ( _nRow >= 0 && _nRow < (sal_Int32)aList.Count() )
+ {
+ ImpItemListRow* pEntry = ImpGetEntry(_nRow);
+ if ( pEntry )
+ {
+ if ( pEntry->bComment )
+ {
+ if (_nColId == ITEMBROWSER_NAMECOL_ID)
+ sRet = pEntry->aName;
+ }
+ else
+ {
+ rtl_TextEncoding aTextEncoding = gsl_getSystemTextEncoding();
+
+ sRet = XubString("???", aTextEncoding);
+ switch (_nColId)
+ {
+ case ITEMBROWSER_WHICHCOL_ID:
+ sRet = UniString::CreateFromInt32(pEntry->nWhichId); break;
+ case ITEMBROWSER_STATECOL_ID:
+ {
+ switch (pEntry->eState)
+ {
+ case SFX_ITEM_UNKNOWN : sRet=String("Uknown", aTextEncoding); break;
+ case SFX_ITEM_DISABLED: sRet=String("Disabled", aTextEncoding); break;
+ case SFX_ITEM_DONTCARE: sRet=String("DontCare", aTextEncoding); break;
+ case SFX_ITEM_SET : sRet=String("Set", aTextEncoding); break;
+ case SFX_ITEM_DEFAULT : sRet=String("Default", aTextEncoding); break;
+ } // switch
+ } break;
+ case ITEMBROWSER_TYPECOL_ID: sRet = pEntry->GetItemTypeStr(); break;
+ case ITEMBROWSER_NAMECOL_ID: sRet = pEntry->aName; break;
+ case ITEMBROWSER_VALUECOL_ID: sRet = pEntry->aValue; break;
+ } // switch
+ }
+ }
+ }
+ return sRet;
+}
+
+void __EXPORT _SdrItemBrowserControl::PaintField(OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId) const
+{
+ if (nAktPaintRow<0 || (sal_uIntPtr)nAktPaintRow>=aList.Count()) {
+ return;
+ }
+ Rectangle aR(rRect);
+ aR.Bottom()++;
+ ImpItemListRow* pEntry=ImpGetEntry(nAktPaintRow);
+ if (pEntry->bComment)
+ {
+ if (nColumnId==ITEMBROWSER_NAMECOL_ID)
+ {
+ rDev.SetLineColor();
+ rDev.SetFillColor( Color( COL_LIGHTGRAY ) );
+ aR.Left()=0;
+ aR.Right()=rDev.GetOutputSize().Width();
+ rDev.DrawRect(aR);
+ rDev.DrawText(rRect.TopLeft(),pEntry->aName);
+ }
+ } else {
+ rDev.SetClipRegion(aR);
+ rDev.DrawText(aR.TopLeft(),GetCellText(nAktPaintRow,nColumnId));
+ rDev.SetClipRegion();
+ }
+}
+
+sal_uIntPtr _SdrItemBrowserControl::GetCurrentPos() const
+{
+ sal_uIntPtr nRet=CONTAINER_ENTRY_NOTFOUND;
+ if (GetSelectRowCount()==1) {
+ long nPos=((BrowseBox*)this)->FirstSelectedRow();
+ if (nPos>=0 && (sal_uIntPtr)nPos<aList.Count()) {
+ nRet=(sal_uIntPtr)nPos;
+ }
+ }
+ return nRet;
+}
+
+sal_uInt16 _SdrItemBrowserControl::GetCurrentWhich() const
+{
+ sal_uInt16 nRet=0;
+ sal_uIntPtr nPos=GetCurrentPos();
+ if (nPos!=CONTAINER_ENTRY_NOTFOUND) {
+ nRet=ImpGetEntry(nPos)->nWhichId;
+ }
+ return nRet;
+}
+
+void __EXPORT _SdrItemBrowserControl::DoubleClick(const BrowserMouseEvent&)
+{
+ sal_uIntPtr nPos=GetCurrentPos();
+ if (nPos!=CONTAINER_ENTRY_NOTFOUND) {
+ BegChangeEntry(nPos);
+ }
+}
+
+void __EXPORT _SdrItemBrowserControl::KeyInput(const KeyEvent& rKEvt)
+{
+ sal_uInt16 nKeyCode=rKEvt.GetKeyCode().GetCode()+rKEvt.GetKeyCode().GetModifier();
+ FASTBOOL bAusgewertet=sal_False;
+ sal_uIntPtr nPos=GetCurrentPos();
+ if (nPos!=CONTAINER_ENTRY_NOTFOUND) {
+ if (nKeyCode==KEY_RETURN) {
+ if (BegChangeEntry(nPos)) bAusgewertet=sal_True;
+ } else if (nKeyCode==KEY_ESCAPE) {
+ // ...
+ } else if (rKEvt.GetKeyCode().GetModifier()==KEY_SHIFT+KEY_MOD1+KEY_MOD2) { // Strg
+ if (nKeyCode==KEY_SHIFT+KEY_MOD1+KEY_MOD2+KEY_W) {
+ bWhichesButNames=!bWhichesButNames;
+ SetDirty();
+ }
+ if (nKeyCode==KEY_SHIFT+KEY_MOD1+KEY_MOD2+KEY_I) {
+ bDontHideIneffectiveItems=!bDontHideIneffectiveItems;
+ SetDirty();
+ }
+ if (nKeyCode==KEY_SHIFT+KEY_MOD1+KEY_MOD2+KEY_S) {
+ bDontSortItems=!bDontSortItems;
+ SetDirty();
+ }
+ }
+ }
+ if (!bAusgewertet) BrowseBox::KeyInput(rKEvt);
+}
+
+void _SdrItemBrowserControl::SetDirty()
+{
+ aSetDirtyHdl.Call(this);
+}
+
+Rectangle _SdrItemBrowserControl::GetFieldCharacterBounds(sal_Int32 /*_nRow*/,sal_Int32 /*_nColumnPos*/,sal_Int32 /*nIndex*/)
+{
+ // no accessibility implementation required
+ return Rectangle();
+}
+
+sal_Int32 _SdrItemBrowserControl::GetFieldIndexAtPoint(sal_Int32 /*_nRow*/,sal_Int32 /*_nColumnPos*/,const Point& /*_rPoint*/)
+{
+ // no accessibility implementation required
+ return -1;
+}
+
+void __EXPORT _SdrItemBrowserControl::Select()
+{
+ EndChangeEntry();
+ BrowseBox::Select();
+ ImpSaveWhich();
+}
+
+void _SdrItemBrowserControl::ImpSaveWhich()
+{
+ sal_uInt16 nWh=GetCurrentWhich();
+ if (nWh!=0) {
+ long nPos=GetCurrentPos();
+ long nTop=GetTopRow();
+ long nBtm=GetTopRow()+GetVisibleRows()+1;
+ nLastWhich=nWh;
+ nLastWhichOfs=nPos-nTop;
+ if (nTop<0) nTop=0;
+ if (nBtm>=(long)aList.Count()) nBtm=aList.Count()-1;
+ nLastWhichOben=ImpGetEntry(nTop)->nWhichId;
+ nLastWhichUnten=ImpGetEntry(nBtm)->nWhichId;
+ }
+}
+
+void _SdrItemBrowserControl::ImpRestoreWhich()
+{
+ if (nLastWhich!=0) {
+ FASTBOOL bFnd=sal_False;
+ sal_uInt16 nBestMinWh=0,nBestMaxWh=0xFFFF; // not implemented yet
+ sal_uIntPtr nBestMinPos=0,nBestMaxPos=0xFFFFFFFF; // not implemented yet
+ sal_uIntPtr nAnz=aList.Count();
+ sal_uIntPtr nNum;
+ for (nNum=0; nNum<nAnz && !bFnd; nNum++) {
+ ImpItemListRow* pEntry=ImpGetEntry(nNum);
+ if (!pEntry->bComment) {
+ sal_uInt16 nWh=pEntry->nWhichId;
+ if (nWh==nLastWhich) bFnd=sal_True;
+ else if (nWh<nLastWhich && nWh>nBestMinWh) nBestMinPos=nNum;
+ else if (nWh>nLastWhich && nWh<nBestMaxWh) nBestMaxPos=nNum;
+ }
+ }
+ if (bFnd) {
+ long nPos=nNum-1;
+ long nWhichOfs=nPos-GetTopRow();
+ if (nWhichOfs!=nLastWhichOfs) {
+ ScrollRows(nWhichOfs-nLastWhichOfs);
+ }
+ GoToRow(nPos);
+ }
+ }
+}
+
+FASTBOOL _SdrItemBrowserControl::BegChangeEntry(sal_uIntPtr nPos)
+{
+ BrkChangeEntry();
+ FASTBOOL bRet=sal_False;
+ ImpItemListRow* pEntry=ImpGetEntry(nPos);
+ if (pEntry!=NULL && !pEntry->bComment) {
+ SetMode(MYBROWSEMODE & ~BROWSER_KEEPHIGHLIGHT);
+ pEditControl=new ImpItemEdit(&GetDataWindow(),this,0/*|WB_BORDER|WB_3DLOOK*/);
+ Rectangle aRect(GetFieldRectPixel(nPos,ITEMBROWSER_VALUECOL_ID,sal_False));
+ aRect.Left()+=2; // Kleiner Offset fuer's Edit, damit's pixelgenau stimmt
+ aRect.Right()--;
+ pEditControl->SetPosSizePixel(aRect.TopLeft(),aRect.GetSize());
+ pEditControl->SetText(pEntry->aValue);
+ pEditControl->SetBackground( Wallpaper(Color(COL_LIGHTGRAY)));
+ Font aFont(pEditControl->GetFont());
+ aFont.SetFillColor(Color(COL_LIGHTGRAY));
+ pEditControl->SetFont(aFont);
+ pEditControl->Show();
+ pEditControl->GrabFocus();
+ pEditControl->SetSelection(Selection(SELECTION_MIN,SELECTION_MAX));
+ Window* pParent=GetParent();
+ aWNamMerk=pParent->GetText();
+ XubString aNeuNam(aWNamMerk);
+ aNeuNam += sal_Unicode(' ');
+ aNeuNam += pEntry->GetItemTypeStr();
+ if (pEntry->bCanNum) {
+ aNeuNam.AppendAscii(": ");
+ aNeuNam += UniString::CreateFromInt32(pEntry->nMin);
+ aNeuNam.AppendAscii("..");
+ aNeuNam += UniString::CreateFromInt32(pEntry->nMax);
+ }
+ aNeuNam.AppendAscii(" - Type 'del' to reset to default.");
+ pParent->SetText(aNeuNam);
+ pAktChangeEntry=new ImpItemListRow(*pEntry);
+ bRet=sal_True;
+ }
+ return bRet;
+}
+
+FASTBOOL _SdrItemBrowserControl::EndChangeEntry()
+{
+ FASTBOOL bRet=sal_False;
+ if (pEditControl!=NULL) {
+ aEntryChangedHdl.Call(this);
+ delete pEditControl;
+ pEditControl=NULL;
+ delete pAktChangeEntry;
+ pAktChangeEntry=NULL;
+ Window* pParent=GetParent();
+ pParent->SetText(aWNamMerk);
+ SetMode(MYBROWSEMODE);
+ bRet=sal_True;
+ }
+ return bRet;
+}
+
+void _SdrItemBrowserControl::BrkChangeEntry()
+{
+ if (pEditControl!=NULL) {
+ delete pEditControl;
+ pEditControl=NULL;
+ delete pAktChangeEntry;
+ pAktChangeEntry=NULL;
+ Window* pParent=GetParent();
+ pParent->SetText(aWNamMerk);
+ SetMode(MYBROWSEMODE);
+ }
+}
+
+void _SdrItemBrowserControl::ImpSetEntry(const ImpItemListRow& rEntry, sal_uIntPtr nEntryNum)
+{
+ ImpItemListRow* pAktEntry=ImpGetEntry(nEntryNum);
+ if (pAktEntry==NULL) {
+ aList.Insert(new ImpItemListRow(rEntry),CONTAINER_APPEND);
+ RowInserted(nEntryNum);
+ } else if (*pAktEntry!=rEntry) {
+ FASTBOOL bStateDiff=rEntry.eState!=pAktEntry->eState;
+ FASTBOOL bValueDiff=!rEntry.aValue.Equals(pAktEntry->aValue);
+ FASTBOOL bAllDiff=sal_True;
+ if (bStateDiff || bValueDiff) {
+ // Checken, ob nur State und/oder Value geaendert
+ ImpItemListRow aTest(rEntry);
+ aTest.eState=pAktEntry->eState;
+ aTest.aValue=pAktEntry->aValue;
+ if (aTest==*pAktEntry) bAllDiff=sal_False;
+ }
+ *pAktEntry=rEntry;
+ if (bAllDiff) {
+ RowModified(nEntryNum);
+ } else {
+ if (bStateDiff) RowModified(nEntryNum,ITEMBROWSER_STATECOL_ID);
+ if (bValueDiff) RowModified(nEntryNum,ITEMBROWSER_VALUECOL_ID);
+ }
+ }
+}
+
+FASTBOOL ImpGetItem(const SfxItemSet& rSet, sal_uInt16 nWhich, const SfxPoolItem*& rpItem)
+{
+ SfxItemState eState=rSet.GetItemState(nWhich,sal_True,&rpItem);
+ if (eState==SFX_ITEM_DEFAULT) {
+ rpItem=&rSet.Get(nWhich);
+ }
+ return (eState==SFX_ITEM_DEFAULT || eState==SFX_ITEM_SET) && rpItem!=NULL;
+}
+
+FASTBOOL IsItemIneffective(sal_uInt16 nWhich, const SfxItemSet* pSet, sal_uInt16& rIndent)
+{
+ rIndent=0;
+ if (pSet==NULL) return sal_False;
+ const SfxPoolItem* pItem=NULL;
+ FASTBOOL bRet=sal_False;
+ switch (nWhich) {
+ case XATTR_LINEDASH :
+ case XATTR_LINEWIDTH :
+ case XATTR_LINECOLOR :
+ case XATTR_LINESTART :
+ case XATTR_LINEEND :
+ case XATTR_LINESTARTWIDTH :
+ case XATTR_LINEENDWIDTH :
+ case XATTR_LINESTARTCENTER :
+ case XATTR_LINEENDCENTER :
+ case XATTR_LINETRANSPARENCE : {
+ rIndent=1;
+ if (ImpGetItem(*pSet,XATTR_LINESTYLE,pItem)) {
+ XLineStyle eLineStyle=((const XLineStyleItem*)pItem)->GetValue();
+ if (eLineStyle==XLINE_NONE) return sal_True;
+ if (eLineStyle!=XLINE_DASH && nWhich==XATTR_LINEDASH) return sal_True;
+ }
+ if (nWhich==XATTR_LINESTART || nWhich==XATTR_LINESTARTCENTER) {
+ rIndent=2;
+ if (ImpGetItem(*pSet,XATTR_LINESTARTWIDTH,pItem)) {
+ sal_Int32 nWdt=((const XLineStartWidthItem*)pItem)->GetValue();
+ if (nWdt==0) return sal_True;
+ }
+ }
+ if (nWhich==XATTR_LINEEND || nWhich==XATTR_LINEENDCENTER) {
+ rIndent=2;
+ if (ImpGetItem(*pSet,XATTR_LINEENDWIDTH,pItem)) {
+ sal_Int32 nWdt=((const XLineEndWidthItem*)pItem)->GetValue();
+ if (nWdt==0) return sal_True;
+ }
+ }
+ } break;
+ case XATTR_FILLCOLOR : /*nur bei Style=Color*/
+ case XATTR_FILLGRADIENT : /*nur bei Style=Gradient*/
+ case XATTR_FILLHATCH : /*nur bei Style=Hatch*/
+ case XATTR_FILLTRANSPARENCE : /*nur bei Style=Color*/
+ case XATTR_GRADIENTSTEPCOUNT : /*nur bei Style=Gradient*/
+ case XATTR_FILLBACKGROUND : /*nur bei Style=Hatch*/
+ {
+ rIndent=1;
+ if (ImpGetItem(*pSet,XATTR_FILLSTYLE,pItem)) {
+ XFillStyle eFillStyle=((const XFillStyleItem*)pItem)->GetValue();
+ if (eFillStyle==XFILL_NONE) return sal_True;
+ // Transparenz z.Zt. nur fuer SolidFill
+ if (eFillStyle!=XFILL_SOLID && (nWhich==XATTR_FILLCOLOR || nWhich==XATTR_FILLTRANSPARENCE)) return sal_True;
+ if (eFillStyle!=XFILL_GRADIENT && (nWhich==XATTR_FILLGRADIENT || nWhich==XATTR_GRADIENTSTEPCOUNT)) return sal_True;
+ if (eFillStyle!=XFILL_HATCH && (nWhich==XATTR_FILLHATCH || nWhich==XATTR_FILLBACKGROUND)) return sal_True;
+ }
+ } break;
+ case XATTR_FILLBITMAP :
+ case XATTR_FILLBMP_TILE :
+ case XATTR_FILLBMP_POS : /* z.Zt. nur wenn TILE=sal_True */
+ case XATTR_FILLBMP_SIZEX : /* nur wenn nicht Stretch */
+ case XATTR_FILLBMP_SIZEY : /* nur wenn nicht Stretch */
+ case XATTR_FILLBMP_SIZELOG : /* nur wenn SIZELOG=sal_False zum ruecksetzen auf sal_True (alt) -> doch noch in Gebrauch */
+ case XATTR_FILLBMP_TILEOFFSETX : /* nur wenn TILE=sal_True */
+ case XATTR_FILLBMP_TILEOFFSETY : /* nur wenn TILE=sal_True */
+ case XATTR_FILLBMP_STRETCH : /* nur wenn TILE=sal_False */
+ case XATTR_FILLBMP_POSOFFSETX : /* nur wenn TILE=sal_True*/
+ case XATTR_FILLBMP_POSOFFSETY : { /* nur wenn TILE=sal_True*/
+ rIndent=1;
+ if (ImpGetItem(*pSet,XATTR_FILLSTYLE,pItem)) {
+ XFillStyle eFillStyle=((const XFillStyleItem*)pItem)->GetValue();
+ if (eFillStyle!=XFILL_BITMAP) return sal_True;
+ }
+ if (nWhich==XATTR_FILLBITMAP || nWhich==XATTR_FILLBMP_TILE) {
+ return sal_False; // immer anwaehlbar
+ }
+ FASTBOOL bTileTRUE=sal_False;
+ FASTBOOL bTileFALSE=sal_False;
+ FASTBOOL bStretchTRUE=sal_False;
+ FASTBOOL bStretchFALSE=sal_False;
+ if (ImpGetItem(*pSet,XATTR_FILLBMP_TILE,pItem)) {
+ bTileTRUE=((const XFillBmpTileItem*)pItem)->GetValue();
+ bTileFALSE=!bTileTRUE;
+ }
+ if (ImpGetItem(*pSet,XATTR_FILLBMP_STRETCH,pItem)) {
+ bStretchTRUE=((const XFillBmpStretchItem*)pItem)->GetValue();
+ bStretchFALSE=!bStretchTRUE;
+ }
+ // Stretch nicht anwaehlbar, wenn Tile=TRUE
+ if (nWhich==XATTR_FILLBMP_STRETCH) return bTileTRUE;
+ // und uebrig bleiben 7+1 Item (Unterattribute)
+ rIndent=2;
+ // Pos (enum) nicht anwaehlbar, wenn Tile=FALSE
+ if (nWhich==XATTR_FILLBMP_POS) return bTileFALSE;
+ // SizeXY nicht anwaehlbar bei Stretch=TRUE
+ if (nWhich==XATTR_FILLBMP_SIZEX || nWhich==XATTR_FILLBMP_SIZEY) {
+ return bTileFALSE && bStretchTRUE;
+ }
+ // 2 Items speziell fuer Tile
+ if (nWhich==XATTR_FILLBMP_POSOFFSETX || nWhich==XATTR_FILLBMP_POSOFFSETY) {
+ return bTileFALSE;
+ }
+ // Noch 2 Items speziell fuer Tile die sich jedoch gegenseitig ausschliessen
+ if (nWhich==XATTR_FILLBMP_TILEOFFSETX || nWhich==XATTR_FILLBMP_TILEOFFSETY) {
+ if (bTileFALSE) return sal_True;
+ sal_uInt16 nX=0,nY=0;
+ FASTBOOL bX=sal_False,bY=sal_False;
+ if (ImpGetItem(*pSet,XATTR_FILLBMP_TILEOFFSETX,pItem)) {
+ nX=((const XFillBmpTileOffsetXItem*)pItem)->GetValue();
+ bX=sal_True;
+ }
+ if (ImpGetItem(*pSet,XATTR_FILLBMP_TILEOFFSETY,pItem)) {
+ nY=((const XFillBmpTileOffsetYItem*)pItem)->GetValue();
+ bY=sal_True;
+ }
+ if (nWhich==XATTR_FILLBMP_TILEOFFSETX) {
+ if (nX!=0 || !bX) return sal_False;
+ if (nY!=0) return sal_True;
+ } else {
+ if (nY!=0 || !bY) return sal_False;
+ if (nX!=0) return sal_True;
+ }
+ }
+ // SizeLog nicht anwaehlbar bei Stretch=TRUE
+ // und sonst auch nur wenn es auf SizeLog=sal_False gesetzt ist.
+ // -> wohl doch noch in Gebrauch
+ // (sal_True ist der statische PoolDefault)
+ if (nWhich==XATTR_FILLBMP_SIZELOG) {
+ if (bTileFALSE && bStretchTRUE) return sal_True;
+ }
+ } break;
+
+ case XATTR_FORMTXTADJUST :
+ case XATTR_FORMTXTDISTANCE :
+ case XATTR_FORMTXTSTART :
+ case XATTR_FORMTXTMIRROR :
+ case XATTR_FORMTXTOUTLINE :
+ case XATTR_FORMTXTSHADOW :
+ case XATTR_FORMTXTSHDWCOLOR :
+ case XATTR_FORMTXTSHDWXVAL :
+ case XATTR_FORMTXTSHDWYVAL :
+ case XATTR_FORMTXTSTDFORM :
+ case XATTR_FORMTXTHIDEFORM :
+ case XATTR_FORMTXTSHDWTRANSP: {
+ rIndent=1;
+ if (ImpGetItem(*pSet,XATTR_FORMTXTSTYLE,pItem)) {
+ XFormTextStyle eStyle=((const XFormTextStyleItem*)pItem)->GetValue();
+ if (eStyle==XFT_NONE) return sal_True;
+ }
+ if ((nWhich>=XATTR_FORMTXTSHDWCOLOR && nWhich<=XATTR_FORMTXTSHDWYVAL) || nWhich>=XATTR_FORMTXTSHDWTRANSP) {
+ rIndent=2;
+ if (ImpGetItem(*pSet,XATTR_FORMTXTSHADOW,pItem)) {
+ XFormTextShadow eShadow=((const XFormTextShadowItem*)pItem)->GetValue();
+ if (eShadow==XFTSHADOW_NONE) return sal_True;
+ }
+ }
+ } break;
+
+ case SDRATTR_SHADOWCOLOR :
+ case SDRATTR_SHADOWXDIST :
+ case SDRATTR_SHADOWYDIST :
+ case SDRATTR_SHADOWTRANSPARENCE:
+ case SDRATTR_SHADOW3D :
+ case SDRATTR_SHADOWPERSP : {
+ rIndent=1;
+ if (ImpGetItem(*pSet,SDRATTR_SHADOW,pItem)) {
+ FASTBOOL bShadow=((const SdrShadowItem*)pItem)->GetValue();
+ if (!bShadow) return sal_True;
+ }
+ } break;
+
+ case SDRATTR_CAPTIONANGLE: {
+ rIndent=1;
+ if (ImpGetItem(*pSet,SDRATTR_CAPTIONFIXEDANGLE,pItem)) {
+ FASTBOOL bFixed=((const SdrCaptionFixedAngleItem*)pItem)->GetValue();
+ if (!bFixed) return sal_True;
+ }
+ } break;
+ case SDRATTR_CAPTIONESCREL:
+ case SDRATTR_CAPTIONESCABS: {
+ rIndent=1;
+ if (ImpGetItem(*pSet,SDRATTR_CAPTIONESCISREL,pItem)) {
+ FASTBOOL bRel=((const SdrCaptionEscIsRelItem*)pItem)->GetValue();
+ if (bRel && nWhich==SDRATTR_CAPTIONESCABS) return sal_True;
+ if (!bRel && nWhich==SDRATTR_CAPTIONESCREL) return sal_True;
+ }
+ } break;
+ case SDRATTR_CAPTIONLINELEN: {
+ rIndent=1;
+ if (ImpGetItem(*pSet,SDRATTR_CAPTIONFITLINELEN,pItem)) {
+ FASTBOOL bFit=((const SdrCaptionFitLineLenItem*)pItem)->GetValue();
+ if (bFit) return sal_True;
+ }
+ } break;
+
+ case SDRATTR_TEXT_MINFRAMEHEIGHT:
+ case SDRATTR_TEXT_MAXFRAMEHEIGHT: {
+ rIndent=1;
+ if (ImpGetItem(*pSet,SDRATTR_TEXT_AUTOGROWHEIGHT,pItem)) {
+ FASTBOOL bAutoGrow=((const SdrTextAutoGrowHeightItem*)pItem)->GetValue();
+ if (!bAutoGrow) return sal_True;
+ }
+ } break;
+ case SDRATTR_TEXT_MINFRAMEWIDTH:
+ case SDRATTR_TEXT_MAXFRAMEWIDTH: {
+ rIndent=1;
+ if (ImpGetItem(*pSet,SDRATTR_TEXT_AUTOGROWWIDTH,pItem)) {
+ FASTBOOL bAutoGrow=((const SdrTextAutoGrowWidthItem*)pItem)->GetValue();
+ if (!bAutoGrow) return sal_True;
+ }
+ } break;
+ case SDRATTR_TEXT_VERTADJUST:
+ case SDRATTR_TEXT_HORZADJUST: {
+ if (ImpGetItem(*pSet,SDRATTR_TEXT_FITTOSIZE,pItem)) {
+ SdrFitToSizeType eFit=((const SdrTextFitToSizeTypeItem*)pItem)->GetValue();
+ if (eFit!=SDRTEXTFIT_NONE) return sal_True;
+ }
+ } break;
+
+ case SDRATTR_TEXT_ANIDIRECTION :
+ case SDRATTR_TEXT_ANISTARTINSIDE:
+ case SDRATTR_TEXT_ANISTOPINSIDE :
+ case SDRATTR_TEXT_ANICOUNT :
+ case SDRATTR_TEXT_ANIDELAY :
+ case SDRATTR_TEXT_ANIAMOUNT : {
+ rIndent=1;
+ if (ImpGetItem(*pSet,SDRATTR_TEXT_ANIKIND,pItem)) {
+ SdrTextAniKind eAniKind=((const SdrTextAniKindItem*)pItem)->GetValue();
+ if (eAniKind==SDRTEXTANI_NONE) return sal_True;
+ if (eAniKind==SDRTEXTANI_BLINK && (nWhich==SDRATTR_TEXT_ANIDIRECTION || nWhich==SDRATTR_TEXT_ANIAMOUNT)) return sal_True;
+ if (eAniKind==SDRTEXTANI_SLIDE && (nWhich==SDRATTR_TEXT_ANISTARTINSIDE || nWhich==SDRATTR_TEXT_ANISTOPINSIDE)) return sal_True;
+ }
+ } break;
+
+ case SDRATTR_EDGELINEDELTAANZ: return sal_True;
+ case SDRATTR_EDGELINE1DELTA:
+ case SDRATTR_EDGELINE2DELTA:
+ case SDRATTR_EDGELINE3DELTA: {
+ if (ImpGetItem(*pSet,SDRATTR_EDGEKIND,pItem)) {
+ SdrEdgeKind eKind=((const SdrEdgeKindItem*)pItem)->GetValue();
+ if (eKind==SDREDGE_THREELINES) {
+ if (nWhich>SDRATTR_EDGELINE2DELTA) return sal_True;
+ else return sal_False;
+ }
+ if (eKind!=SDREDGE_ORTHOLINES && eKind!=SDREDGE_BEZIER) return sal_True;
+ }
+ if (ImpGetItem(*pSet,SDRATTR_EDGELINEDELTAANZ,pItem)) {
+ sal_uInt16 nAnz=((const SdrEdgeLineDeltaAnzItem*)pItem)->GetValue();
+ if (nAnz==0) return sal_True;
+ if (nAnz==1 && nWhich>SDRATTR_EDGELINE1DELTA) return sal_True;
+ if (nAnz==2 && nWhich>SDRATTR_EDGELINE2DELTA) return sal_True;
+ if (nAnz==3 && nWhich>SDRATTR_EDGELINE3DELTA) return sal_True;
+ }
+ } break;
+
+ case SDRATTR_CIRCSTARTANGLE:
+ case SDRATTR_CIRCENDANGLE : {
+ rIndent=1;
+ if (ImpGetItem(*pSet,SDRATTR_CIRCKIND,pItem)) {
+ SdrCircKind eKind=((const SdrCircKindItem*)pItem)->GetValue();
+ if (eKind==SDRCIRC_FULL) return sal_True;
+ }
+ } break;
+ } // switch
+ return bRet;
+}
+
+sal_uInt16 ImpSortWhich(sal_uInt16 nWhich)
+{
+ switch (nWhich) {
+ // Line
+ case XATTR_LINESTART : nWhich=XATTR_LINETRANSPARENCE ; break;
+ case XATTR_LINEEND : nWhich=XATTR_LINESTARTWIDTH ; break;
+ case XATTR_LINESTARTWIDTH : nWhich=XATTR_LINESTART ; break;
+ case XATTR_LINEENDWIDTH : nWhich=XATTR_LINESTARTCENTER ; break;
+ case XATTR_LINESTARTCENTER : nWhich=XATTR_LINEENDWIDTH ; break;
+ case XATTR_LINEENDCENTER : nWhich=XATTR_LINEEND ; break;
+ case XATTR_LINETRANSPARENCE : nWhich=XATTR_LINEENDCENTER ; break;
+
+ // Fill
+ case XATTR_FILLBMP_POS : nWhich=XATTR_FILLBMP_STRETCH ; break;
+ case XATTR_FILLBMP_SIZEX : nWhich=XATTR_FILLBMP_POS ; break;
+ case XATTR_FILLBMP_SIZEY : nWhich=XATTR_FILLBMP_SIZEX ; break;
+ case XATTR_FILLBMP_SIZELOG : nWhich=XATTR_FILLBMP_SIZEY ; break;
+ case XATTR_FILLBMP_TILEOFFSETX : nWhich=XATTR_FILLBMP_SIZELOG ; break;
+ case XATTR_FILLBMP_TILEOFFSETY : nWhich=XATTR_FILLBMP_TILEOFFSETX ; break;
+ case XATTR_FILLBMP_STRETCH : nWhich=XATTR_FILLBMP_TILEOFFSETY ; break;
+
+ // Fontwork
+ case XATTR_FORMTXTSHADOW : nWhich=XATTR_FORMTXTSTDFORM ; break;
+ case XATTR_FORMTXTSHDWCOLOR : nWhich=XATTR_FORMTXTHIDEFORM ; break;
+ case XATTR_FORMTXTSHDWXVAL : nWhich=XATTR_FORMTXTSHADOW ; break;
+ case XATTR_FORMTXTSHDWYVAL : nWhich=XATTR_FORMTXTSHDWCOLOR ; break;
+ case XATTR_FORMTXTSTDFORM : nWhich=XATTR_FORMTXTSHDWXVAL ; break;
+ case XATTR_FORMTXTHIDEFORM : nWhich=XATTR_FORMTXTSHDWYVAL ; break;
+
+ // Misc
+ case SDRATTR_TEXT_MINFRAMEHEIGHT: nWhich=SDRATTR_TEXT_FITTOSIZE ; break;
+ case SDRATTR_TEXT_AUTOGROWHEIGHT: nWhich=SDRATTR_TEXT_LEFTDIST ; break;
+ case SDRATTR_TEXT_FITTOSIZE : nWhich=SDRATTR_TEXT_RIGHTDIST ; break;
+ case SDRATTR_TEXT_LEFTDIST : nWhich=SDRATTR_TEXT_UPPERDIST ; break;
+ case SDRATTR_TEXT_RIGHTDIST : nWhich=SDRATTR_TEXT_LOWERDIST ; break;
+ case SDRATTR_TEXT_UPPERDIST : nWhich=SDRATTR_TEXT_AUTOGROWWIDTH ; break;
+ case SDRATTR_TEXT_LOWERDIST : nWhich=SDRATTR_TEXT_MINFRAMEWIDTH ; break;
+ case SDRATTR_TEXT_VERTADJUST : nWhich=SDRATTR_TEXT_MAXFRAMEWIDTH ; break;
+ case SDRATTR_TEXT_MAXFRAMEHEIGHT: nWhich=SDRATTR_TEXT_AUTOGROWHEIGHT; break;
+ case SDRATTR_TEXT_MINFRAMEWIDTH : nWhich=SDRATTR_TEXT_MINFRAMEHEIGHT; break;
+ case SDRATTR_TEXT_MAXFRAMEWIDTH : nWhich=SDRATTR_TEXT_MAXFRAMEHEIGHT; break;
+ case SDRATTR_TEXT_AUTOGROWWIDTH : nWhich=SDRATTR_TEXT_HORZADJUST ; break;
+ case SDRATTR_TEXT_HORZADJUST : nWhich=SDRATTR_TEXT_VERTADJUST ; break;
+ } // switch
+ return nWhich;
+}
+
+#define INSERTCOMMENT(nStartId,nEndId,aStr) \
+ { if (nWhich0<nStartId && nWhich>=nStartId && nWhich<=nEndId) aCommentStr=aStr; }
+
+void _SdrItemBrowserControl::SetAttributes(const SfxItemSet* pSet, const SfxItemSet* p2ndSet)
+{
+ SetMode(MYBROWSEMODE & ~BROWSER_KEEPHIGHLIGHT);
+ if (pSet!=NULL) {
+ rtl_TextEncoding aTextEncoding = gsl_getSystemTextEncoding();
+ sal_uInt16 nEntryNum=0;
+ SfxWhichIter aIter(*pSet);
+ const SfxItemPool* pPool=pSet->GetPool();
+ sal_uInt16 nWhich0=0;
+ sal_uInt16 nWhich=aIter.FirstWhich();
+ while (nWhich!=0) {
+ // Nun erstmal etwas umsortieren
+ // Geht nur, solange keine InvalidItems, d.h. keine Luecken
+ // an dieser Stelle im Set sind
+ if (!bDontSortItems) nWhich=ImpSortWhich(nWhich);
+ SfxItemState eState=pSet->GetItemState(nWhich);
+ if (p2ndSet!=NULL) {
+ SfxItemState e2ndState=p2ndSet->GetItemState(nWhich);
+ if (eState==SFX_ITEM_DEFAULT) eState=SFX_ITEM_DISABLED;
+ else if (e2ndState==SFX_ITEM_DEFAULT) eState=SFX_ITEM_DEFAULT;
+ }
+ if (eState!=SFX_ITEM_DISABLED) {
+ const SfxPoolItem& rItem=pSet->Get(nWhich);
+ sal_uInt16 nIndent=0;
+ if (!HAS_BASE(SfxVoidItem,&rItem) && !HAS_BASE(SfxSetItem,&rItem) && (!IsItemIneffective(nWhich,pSet,nIndent) || bDontHideIneffectiveItems)) {
+ XubString aCommentStr;
+
+ INSERTCOMMENT(XATTR_LINE_FIRST,XATTR_LINE_LAST,String("L I N I E", aTextEncoding));
+ INSERTCOMMENT(XATTR_FILL_FIRST,XATTR_FILL_LAST,String("F L Ä C H E", aTextEncoding));
+ INSERTCOMMENT(XATTR_TEXT_FIRST,XATTR_TEXT_LAST,String("F O N T W O R K", aTextEncoding));
+ INSERTCOMMENT(SDRATTR_SHADOW_FIRST,SDRATTR_SHADOW_LAST,String("S C H A T T E N", aTextEncoding));
+ INSERTCOMMENT(SDRATTR_CAPTION_FIRST,SDRATTR_CAPTION_LAST,String("L E G E N D E", aTextEncoding));
+ INSERTCOMMENT(SDRATTR_MISC_FIRST,SDRATTR_MISC_LAST,String("V E R S C H I E D E N E S", aTextEncoding));
+ INSERTCOMMENT(SDRATTR_EDGE_FIRST,SDRATTR_EDGE_LAST,String("V E R B I N D E R", aTextEncoding));
+ INSERTCOMMENT(SDRATTR_MEASURE_FIRST,SDRATTR_MEASURE_LAST,String("B E M A S S U N G", aTextEncoding));
+ INSERTCOMMENT(SDRATTR_CIRC_FIRST,SDRATTR_CIRC_LAST,String("K R E I S", aTextEncoding));
+ INSERTCOMMENT(SDRATTR_NOTPERSIST_FIRST,SDRATTR_NOTPERSIST_LAST,String("N O T P E R S I S T", aTextEncoding));
+ INSERTCOMMENT(SDRATTR_MOVEX,SDRATTR_VERTSHEARONE,String("Transformationen auf alle Objekte einzeln", aTextEncoding));
+ INSERTCOMMENT(SDRATTR_RESIZEXALL,SDRATTR_VERTSHEARALL,String("Transformationen auf alle Objekte gemeinsam", aTextEncoding));
+ INSERTCOMMENT(SDRATTR_TRANSFORMREF1X,SDRATTR_TRANSFORMREF2Y,String("View-Referenzpunkte", aTextEncoding));
+ INSERTCOMMENT(SDRATTR_GRAF_FIRST,SDRATTR_GRAF_LAST,String("G R A F I K", aTextEncoding));
+ INSERTCOMMENT(EE_ITEMS_START,EE_ITEMS_END,String("E D I T E N G I N E", aTextEncoding));
+ INSERTCOMMENT(EE_ITEMS_END+1,EE_ITEMS_END+1,String("... by Joe Merten, JME Engineering Berlin ...", aTextEncoding));
+
+ if(aCommentStr.Len())
+ {
+ ImpItemListRow aEntry;
+ aEntry.bComment=sal_True;
+ aEntry.aName=aCommentStr;
+ ImpSetEntry(aEntry,nEntryNum);
+ nEntryNum++;
+ }
+ nWhich0=nWhich;
+ ImpItemListRow aEntry;
+ SdrItemPool::TakeItemName(nWhich, aEntry.aName);
+ nIndent*=2;
+
+ while(nIndent > 0)
+ {
+ aEntry.aName.Insert(sal_Unicode(' '), 0);
+ nIndent--;
+ }
+
+ aEntry.eState=eState;
+ aEntry.nWhichId=nWhich;
+ if (!IsInvalidItem(&rItem)) {
+ aEntry.pType=rItem.Type();
+ aEntry.nMax=0x7FFFFFFF;
+ aEntry.nMin=-aEntry.nMax;
+ aEntry.nVal=-4711;
+ if (HAS_BASE(SfxByteItem ,&rItem)) aEntry.eItemType=ITEM_BYTE;
+ else if (HAS_BASE(SfxInt16Item ,&rItem)) aEntry.eItemType=ITEM_INT16;
+ else if (HAS_BASE(SfxUInt16Item ,&rItem)) aEntry.eItemType=ITEM_UINT16;
+ else if (HAS_BASE(SfxInt32Item ,&rItem)) aEntry.eItemType=ITEM_INT32;
+ else if (HAS_BASE(SfxUInt32Item ,&rItem)) aEntry.eItemType=ITEM_UINT32;
+ else if (HAS_BASE(SfxEnumItemInterface,&rItem)) aEntry.eItemType=ITEM_ENUM;
+ else if (HAS_BASE(SfxBoolItem ,&rItem)) aEntry.eItemType=ITEM_BOOL;
+ else if (HAS_BASE(SfxFlagItem ,&rItem)) aEntry.eItemType=ITEM_FLAG;
+ else if (HAS_BASE(XColorItem ,&rItem)) aEntry.eItemType=ITEM_XCOLOR;
+ else if (HAS_BASE(SfxStringItem ,&rItem)) aEntry.eItemType=ITEM_STRING;
+ else if (HAS_BASE(SfxPointItem ,&rItem)) aEntry.eItemType=ITEM_POINT;
+ else if (HAS_BASE(SfxRectangleItem,&rItem)) aEntry.eItemType=ITEM_RECT;
+ else if (HAS_BASE(SfxRangeItem ,&rItem)) aEntry.eItemType=ITEM_RANGE;
+ else if (HAS_BASE(SdrFractionItem ,&rItem)) aEntry.eItemType=ITEM_FRACTION;
+ else if (HAS_BASE(SvxColorItem ,&rItem)) aEntry.eItemType=ITEM_COLOR;
+ else if (HAS_BASE(SvxFontItem ,&rItem)) aEntry.eItemType=ITEM_FONT;
+ else if (HAS_BASE(SvxFontHeightItem,&rItem))aEntry.eItemType=ITEM_FONTHEIGHT;
+ else if (HAS_BASE(SvxCharScaleWidthItem,&rItem)) aEntry.eItemType=ITEM_FONTWIDTH;
+ else if (HAS_BASE(SvxFieldItem ,&rItem)) aEntry.eItemType=ITEM_FIELD;
+ switch (aEntry.eItemType) {
+ case ITEM_BYTE : aEntry.bIsNum=sal_True; aEntry.nVal=((SfxByteItem &)rItem).GetValue(); aEntry.nMin=0; aEntry.nMax=255; break;
+ case ITEM_INT16 : aEntry.bIsNum=sal_True; aEntry.nVal=((SfxInt16Item &)rItem).GetValue(); aEntry.nMin=-32767; aEntry.nMax=32767; break;
+ case ITEM_UINT16 : aEntry.bIsNum=sal_True; aEntry.nVal=((SfxUInt16Item&)rItem).GetValue(); aEntry.nMin=0; aEntry.nMax=65535; break;
+ case ITEM_INT32 : aEntry.bIsNum=sal_True; aEntry.nVal=((SfxInt32Item &)rItem).GetValue(); break;
+ case ITEM_UINT32 : aEntry.bIsNum=sal_True; aEntry.nVal=((SfxUInt32Item&)rItem).GetValue(); aEntry.nMin=0; /*aEntry.nMax=0xFF...*/;break;
+ case ITEM_ENUM : aEntry.bCanNum=sal_True; aEntry.nVal=((SfxEnumItemInterface&)rItem).GetEnumValue(); aEntry.nMin=0; aEntry.nMax=((SfxEnumItemInterface&)rItem).GetValueCount()-1; break;
+ case ITEM_BOOL : aEntry.bCanNum=sal_True; aEntry.nVal=((SfxBoolItem &)rItem).GetValue(); aEntry.nMin=0; aEntry.nMax=1; break;
+ case ITEM_FLAG : aEntry.bCanNum=sal_True; aEntry.nVal=((SfxFlagItem &)rItem).GetValue(); aEntry.nMin=0; aEntry.nMax=0xFFFF; break;
+ case ITEM_FONTHEIGHT: aEntry.bCanNum=sal_True; aEntry.nVal=((SvxFontHeightItem&)rItem).GetHeight(); aEntry.nMin=0; break;
+ case ITEM_FONTWIDTH : aEntry.bCanNum=sal_True; aEntry.nVal=((SvxCharScaleWidthItem&)rItem).GetValue(); aEntry.nMin=0; aEntry.nMax=0xFFFF;break;
+ default: break;
+ } // switch
+ if (aEntry.bIsNum) aEntry.bCanNum=sal_True;
+ FASTBOOL bGetPres=sal_True;
+ if (bGetPres) {
+ rItem.GetPresentation(SFX_ITEM_PRESENTATION_NAMELESS,
+ pPool->GetMetric(nWhich),
+ SFX_MAPUNIT_MM,aEntry.aValue);
+ if (aEntry.bCanNum) {
+ aEntry.aValue.InsertAscii(": ",0);
+ aEntry.aValue.Insert(UniString::CreateFromInt32(aEntry.nVal),0);
+ }
+ } else {
+ if (aEntry.eItemType==ITEM_BOOL) aEntry.aValue.AppendAscii(aEntry.nVal!=0 ? "True" : "False");
+ else if (aEntry.bCanNum) aEntry.aValue = UniString::CreateFromInt32(aEntry.nVal);
+ else if (aEntry.eItemType==ITEM_STRING) aEntry.aValue=((SfxStringItem&)rItem).GetValue();
+ else if (aEntry.eItemType==ITEM_ENUM && nWhich!=EE_CHAR_WEIGHT) aEntry.aValue=((SfxEnumItemInterface&)rItem).GetValueTextByPos((sal_Bool)aEntry.nVal);
+ else aEntry.aValue = String("GPF", aTextEncoding);
+ }
+ } else {
+ aEntry.aValue = String("InvalidItem", aTextEncoding);
+ }
+ ImpSetEntry(aEntry,nEntryNum);
+ nEntryNum++;
+ }
+ }
+ nWhich=aIter.NextWhich();
+ } // while
+
+ if (aList.Count()>nEntryNum) { // evtl. noch zuviele Eintraege
+ sal_uIntPtr nTooMuch=aList.Count()-nEntryNum;
+ for (sal_uIntPtr nNum=0; nNum<nTooMuch; nNum++) {
+ delete ImpGetEntry(nEntryNum);
+ aList.Remove(nEntryNum);
+ }
+ RowRemoved(nEntryNum,nTooMuch);
+ }
+ } else {
+ Clear(); // wenn pSet==NULL
+ }
+ ImpRestoreWhich();
+ SetMode(MYBROWSEMODE);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+_SdrItemBrowserWindow::_SdrItemBrowserWindow(Window* pParent, WinBits nBits):
+ FloatingWindow(pParent,nBits),
+ aBrowse(this)
+{
+ SetOutputSizePixel(aBrowse.GetSizePixel());
+ SetText(String("Joe's ItemBrowser", gsl_getSystemTextEncoding()));
+ aBrowse.Show();
+}
+
+__EXPORT _SdrItemBrowserWindow::~_SdrItemBrowserWindow()
+{
+}
+
+void __EXPORT _SdrItemBrowserWindow::Resize()
+{
+ aBrowse.SetSizePixel(GetOutputSizePixel());
+}
+
+void __EXPORT _SdrItemBrowserWindow::GetFocus()
+{
+ aBrowse.GrabFocus();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrItemBrowser::SdrItemBrowser(SdrView& rView):
+ _SdrItemBrowserWindow(ImpGetViewWin(rView)),
+ pView(&rView),
+ bDirty(sal_False)
+{
+ aIdleTimer.SetTimeoutHdl(LINK(this,SdrItemBrowser,IdleHdl));
+ GetBrowserControl().SetEntryChangedHdl(LINK(this,SdrItemBrowser,ChangedHdl));
+ GetBrowserControl().SetSetDirtyHdl(LINK(this,SdrItemBrowser,SetDirtyHdl));
+ SetDirty();
+}
+
+Window* SdrItemBrowser::ImpGetViewWin(SdrView& rView)
+{
+ const sal_uInt32 nWinCount(rView.PaintWindowCount());
+
+ for(sal_uInt32 a(0L); a < nWinCount; a++)
+ {
+ SdrPaintWindow* pCandidate = rView.GetPaintWindow(a);
+
+ if(OUTDEV_WINDOW == pCandidate->GetOutputDevice().GetOutDevType())
+ {
+ return (Window*)(&pCandidate->GetOutputDevice());
+ }
+ }
+
+ return 0L;
+}
+
+void SdrItemBrowser::ForceParent()
+{
+ Window* pWin=ImpGetViewWin(*pView);
+ if (pWin!=NULL) SetParent(pWin);
+}
+
+void SdrItemBrowser::SetDirty()
+{
+ if (!bDirty) {
+ bDirty=sal_True;
+ aIdleTimer.SetTimeout(1);
+ aIdleTimer.Start();
+ }
+}
+
+void SdrItemBrowser::Undirty()
+{
+ aIdleTimer.Stop();
+ bDirty = sal_False;
+
+// SfxItemSet aSet(pView->GetAttributes());
+ SfxItemSet aSet(pView->GetModel()->GetItemPool());
+ pView->GetAttributes(aSet);
+
+ if(pView->AreObjectsMarked())
+ {
+ // SfxItemSet a2ndSet(pView->GetAttributes(sal_True));
+ SfxItemSet a2ndSet(pView->GetModel()->GetItemPool());
+ pView->GetAttributes(a2ndSet, sal_True);
+
+ SetAttributes(&aSet,&a2ndSet);
+ }
+ else
+ {
+ SetAttributes(&aSet);
+ }
+}
+
+IMPL_LINK(SdrItemBrowser,IdleHdl,Timer*,EMPTYARG)
+{
+ Undirty();
+ return 0;
+}
+
+IMPL_LINK(SdrItemBrowser,ChangedHdl,_SdrItemBrowserControl*,pBrowse)
+{
+ const ImpItemListRow* pEntry=pBrowse->GetAktChangeEntry();
+ if (pEntry!=NULL)
+ {
+// SfxItemSet aSet(pView->GetAttributes());
+ SfxItemSet aSet(pView->GetModel()->GetItemPool());
+ pView->GetAttributes(aSet);
+
+ SfxItemSet aNewSet(*aSet.GetPool(),pEntry->nWhichId,pEntry->nWhichId);
+ XubString aNewText(pBrowse->GetNewEntryValue());
+ sal_Bool bDel( aNewText.EqualsAscii("del")
+ || aNewText.EqualsAscii("Del")
+ || aNewText.EqualsAscii("DEL")
+ || aNewText.EqualsAscii("default")
+ || aNewText.EqualsAscii("Default")
+ || aNewText.EqualsAscii("DEFAULT"));
+
+ if (!bDel) {
+ SfxPoolItem* pNewItem=aSet.Get(pEntry->nWhichId).Clone();
+ long nLongVal=0;
+ nLongVal = aNewText.ToInt32();
+ if (pEntry->bCanNum) {
+ if (nLongVal>pEntry->nMax) nLongVal=pEntry->nMax;
+ if (nLongVal<pEntry->nMin) nLongVal=pEntry->nMin;
+ }
+ FASTBOOL bPair=sal_False;
+ FASTBOOL bPairX=sal_True;
+ FASTBOOL bPairY=sal_False;
+ sal_uInt16 nSepLen=1;
+ long nLongX = aNewText.ToInt32();
+ long nLongY=0;
+ xub_StrLen nPos = aNewText.Search(sal_Unicode('/'));
+ if (nPos==STRING_NOTFOUND) nPos=aNewText.Search(sal_Unicode(':'));
+ if (nPos==STRING_NOTFOUND) nPos=aNewText.Search(sal_Unicode(' '));
+ if (nPos==STRING_NOTFOUND) { nPos=aNewText.SearchAscii(".."); if (nPos!=STRING_NOTFOUND) nSepLen=2; }
+ if (nPos!=STRING_NOTFOUND) {
+ bPair=sal_True;
+ bPairX=nPos>0;
+ XubString s(aNewText);
+ s.Erase(0,nPos+nSepLen);
+ bPairY = (sal_Bool)aNewText.Len();
+ nLongY = s.ToInt32();
+ }
+ switch (pEntry->eItemType) {
+ case ITEM_BYTE : ((SfxByteItem *)pNewItem)->SetValue((sal_uInt8 )nLongVal); break;
+ case ITEM_INT16 : ((SfxInt16Item *)pNewItem)->SetValue((sal_Int16 )nLongVal); break;
+ case ITEM_UINT16: ((SfxUInt16Item*)pNewItem)->SetValue((sal_uInt16)nLongVal); break;
+ case ITEM_INT32: {
+ if(HAS_BASE(SdrAngleItem, pNewItem))
+ {
+ aNewText.SearchAndReplace(sal_Unicode(','), sal_Unicode('.'));
+ double nVal = aNewText.ToFloat();
+ nLongVal = (long)(nVal * 100 + 0.5);
+ }
+ ((SfxInt32Item *)pNewItem)->SetValue((sal_Int32)nLongVal);
+ } break;
+ case ITEM_UINT32: ((SfxUInt32Item*)pNewItem)->SetValue(aNewText.ToInt32()); break;
+ case ITEM_ENUM : ((SfxEnumItemInterface*)pNewItem)->SetEnumValue((sal_uInt16)nLongVal); break;
+ case ITEM_BOOL: {
+ aNewText.ToUpperAscii();
+ if (aNewText.EqualsAscii("TRUE")) nLongVal=1;
+ if (aNewText.EqualsAscii("JA")) nLongVal=1;
+ if (aNewText.EqualsAscii("AN")) nLongVal=1;
+ if (aNewText.EqualsAscii("EIN")) nLongVal=1;
+ if (aNewText.EqualsAscii("ON")) nLongVal=1;
+ if (aNewText.EqualsAscii("YES")) nLongVal=1;
+ ((SfxBoolItem*)pNewItem)->SetValue((sal_Bool)nLongVal);
+ } break;
+ case ITEM_FLAG : ((SfxFlagItem *)pNewItem)->SetValue((sal_uInt16)nLongVal); break;
+ case ITEM_STRING: ((SfxStringItem*)pNewItem)->SetValue(aNewText); break;
+ case ITEM_POINT : ((SfxPointItem*)pNewItem)->SetValue(Point(nLongX,nLongY)); break;
+ case ITEM_RECT : break;
+ case ITEM_RANGE : {
+ ((SfxRangeItem*)pNewItem)->From()=(sal_uInt16)nLongX;
+ ((SfxRangeItem*)pNewItem)->From()=(sal_uInt16)nLongY;
+ } break;
+ case ITEM_LRANGE : {
+ } break;
+ case ITEM_FRACTION: {
+ if (!bPairX) nLongX=1;
+ if (!bPairY) nLongY=1;
+ ((SdrFractionItem*)pNewItem)->SetValue(Fraction(nLongX,nLongY));
+ } break;
+ case ITEM_XCOLOR: break;
+ case ITEM_COLOR: break;
+ case ITEM_FONT: {
+ ((SvxFontItem*)pNewItem)->GetFamily()=FAMILY_DONTKNOW;
+ ((SvxFontItem*)pNewItem)->GetFamilyName()=aNewText;
+ ((SvxFontItem*)pNewItem)->GetStyleName().Erase();
+ } break;
+ case ITEM_FONTHEIGHT: {
+ sal_uIntPtr nHgt=0;
+ sal_uInt16 nProp=100;
+ if (aNewText.Search(sal_Unicode('%'))!=STRING_NOTFOUND) {
+ nProp=(sal_uInt16)nLongVal;
+ } else {
+ nHgt=nLongVal;
+ }
+ ((SvxFontHeightItem*)pNewItem)->SetHeight(nHgt,nProp);
+ } break;
+ case ITEM_FONTWIDTH: {
+ sal_uInt16 nProp=100;
+ if (aNewText.Search(sal_Unicode('%'))!=STRING_NOTFOUND) {
+ nProp=(sal_uInt16)nLongVal;
+ }
+ ((SvxCharScaleWidthItem*)pNewItem)->SetValue(nProp);
+ } break;
+ case ITEM_FIELD: break;
+ default: break;
+ } // switch
+ aNewSet.Put(*pNewItem);
+ delete pNewItem;
+ }
+ pView->SetAttributes(aNewSet,bDel);
+ }
+ return 0;
+}
+
+IMPL_LINK(SdrItemBrowser,SetDirtyHdl,_SdrItemBrowserControl*,EMPTYARG)
+{
+ SetDirty();
+ return 0;
+}
+
+
diff --git a/svx/source/svdraw/svditer.cxx b/svx/source/svdraw/svditer.cxx
new file mode 100644
index 000000000000..7bc03d3a5957
--- /dev/null
+++ b/svx/source/svdraw/svditer.cxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "svx/svditer.hxx"
+#include <svx/svdpage.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdmark.hxx>
+
+// #99190#
+#include <svx/scene3d.hxx>
+
+SdrObjListIter::SdrObjListIter(const SdrObjList& rObjList, SdrIterMode eMode, sal_Bool bReverse)
+: maObjList(1024, 64, 64),
+ mnIndex(0L),
+ mbReverse(bReverse)
+{
+ ImpProcessObjectList(rObjList, eMode, sal_True);
+ Reset();
+}
+
+SdrObjListIter::SdrObjListIter(const SdrObjList& rObjList, sal_Bool bUseZOrder, SdrIterMode eMode, sal_Bool bReverse)
+: maObjList(1024, 64, 64),
+ mnIndex(0L),
+ mbReverse(bReverse)
+{
+ ImpProcessObjectList(rObjList, eMode, bUseZOrder);
+ Reset();
+}
+
+SdrObjListIter::SdrObjListIter( const SdrObject& rObj, SdrIterMode eMode, sal_Bool bReverse )
+: maObjList(1024, 64, 64),
+ mnIndex(0L),
+ mbReverse(bReverse)
+{
+ if ( rObj.ISA( SdrObjGroup ) )
+ ImpProcessObjectList(*rObj.GetSubList(), eMode, sal_True);
+ else
+ maObjList.Insert( (void*)&rObj, LIST_APPEND );
+ Reset();
+}
+
+SdrObjListIter::SdrObjListIter( const SdrMarkList& rMarkList, SdrIterMode eMode, sal_Bool bReverse )
+: maObjList(1024, 64, 64),
+ mnIndex(0L),
+ mbReverse(bReverse)
+{
+ ImpProcessMarkList(rMarkList, eMode);
+ Reset();
+}
+
+void SdrObjListIter::ImpProcessObjectList(const SdrObjList& rObjList, SdrIterMode eMode, sal_Bool bUseZOrder)
+{
+ for( sal_uIntPtr nIdx = 0, nCount = rObjList.GetObjCount(); nIdx < nCount; ++nIdx )
+ {
+ SdrObject* pObj = bUseZOrder ?
+ rObjList.GetObj( nIdx ) : rObjList.GetObjectForNavigationPosition( nIdx );
+ OSL_ASSERT( pObj != 0 );
+ if( pObj )
+ ImpProcessObj( pObj, eMode, bUseZOrder );
+ }
+}
+
+void SdrObjListIter::ImpProcessMarkList( const SdrMarkList& rMarkList, SdrIterMode eMode )
+{
+ for( sal_uIntPtr nIdx = 0, nCount = rMarkList.GetMarkCount(); nIdx < nCount; ++nIdx )
+ if( SdrObject* pObj = rMarkList.GetMark( nIdx )->GetMarkedSdrObj() )
+ ImpProcessObj( pObj, eMode, sal_False );
+}
+
+void SdrObjListIter::ImpProcessObj(SdrObject* pObj, SdrIterMode eMode, sal_Bool bUseZOrder)
+{
+ bool bIsGroup = pObj->IsGroupObject();
+ // #99190# 3D objects are no group objects, IsGroupObject()
+ // only tests if pSub is not null ptr :-(
+ if( bIsGroup && pObj->ISA( E3dObject ) && !pObj->ISA( E3dScene ) )
+ bIsGroup = false;
+
+ if( !bIsGroup || (eMode != IM_DEEPNOGROUPS) )
+ maObjList.Insert( pObj, LIST_APPEND );
+
+ if( bIsGroup && (eMode != IM_FLAT) )
+ ImpProcessObjectList( *pObj->GetSubList(), eMode, bUseZOrder );
+}
diff --git a/svx/source/svdraw/svdlayer.cxx b/svx/source/svdraw/svdlayer.cxx
new file mode 100644
index 000000000000..f4df93fc843e
--- /dev/null
+++ b/svx/source/svdraw/svdlayer.cxx
@@ -0,0 +1,458 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <svx/svdlayer.hxx>
+#include <svx/svdmodel.hxx> // fuer Broadcasting
+#include "svx/svdglob.hxx" // StringCache
+#include "svx/svdstr.hrc" // Namen aus der Resource
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// SetOfByte
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_Bool SetOfByte::IsEmpty() const
+{
+ for(sal_uInt16 i(0); i < 32; i++)
+ {
+ if(aData[i] != 0)
+ return sal_False;
+ }
+
+ return sal_True;
+}
+
+sal_Bool SetOfByte::IsFull() const
+{
+ for(sal_uInt16 i(0); i < 32; i++)
+ {
+ if(aData[i] != 0xFF)
+ return sal_False;
+ }
+
+ return sal_True;
+}
+
+sal_uInt16 SetOfByte::GetSetCount() const
+{
+ sal_uInt16 nRet(0);
+
+ for(sal_uInt16 i(0); i < 32; i++)
+ {
+ sal_uInt8 a(aData[i]);
+
+ if(a != 0)
+ {
+ if(a & 0x80) nRet++;
+ if(a & 0x40) nRet++;
+ if(a & 0x20) nRet++;
+ if(a & 0x10) nRet++;
+ if(a & 0x08) nRet++;
+ if(a & 0x04) nRet++;
+ if(a & 0x02) nRet++;
+ if(a & 0x01) nRet++;
+ }
+ }
+
+ return nRet;
+}
+
+sal_uInt8 SetOfByte::GetSetBit(sal_uInt16 nNum) const
+{
+ nNum++;
+ sal_uInt16 i(0), j(0);
+ sal_uInt16 nRet(0);
+
+ while(j < nNum && i < 256)
+ {
+ if(IsSet(sal_uInt8(i)))
+ j++;
+ i++;
+ }
+
+ if(j == nNum)
+ nRet = i - 1;
+
+ return sal_uInt8(nRet);
+}
+
+sal_uInt16 SetOfByte::GetClearCount() const
+{
+ return sal_uInt16(256 - GetSetCount());
+}
+
+sal_uInt8 SetOfByte::GetClearBit(sal_uInt16 nNum) const
+{
+ nNum++;
+ sal_uInt16 i(0), j(0);
+ sal_uInt16 nRet(0);
+
+ while(j < nNum && i < 256)
+ {
+ if(!IsSet(sal_uInt8(i)))
+ j++;
+ i++;
+ }
+
+ if(j == nNum)
+ nRet = i - 1;
+
+ return sal_uInt8(nRet);
+}
+
+void SetOfByte::operator&=(const SetOfByte& r2ndSet)
+{
+ for(sal_uInt16 i(0); i < 32; i++)
+ {
+ aData[i] &= r2ndSet.aData[i];
+ }
+}
+
+void SetOfByte::operator|=(const SetOfByte& r2ndSet)
+{
+ for(sal_uInt16 i(0); i < 32; i++)
+ {
+ aData[i] |= r2ndSet.aData[i];
+ }
+}
+
+/** initialize this set with a uno sequence of sal_Int8
+*/
+void SetOfByte::PutValue( const com::sun::star::uno::Any & rAny )
+{
+ com::sun::star::uno::Sequence< sal_Int8 > aSeq;
+ if( rAny >>= aSeq )
+ {
+ sal_Int16 nCount = (sal_Int16)aSeq.getLength();
+ if( nCount > 32 )
+ nCount = 32;
+
+ sal_Int16 nIndex;
+ for( nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ aData[nIndex] = static_cast<sal_uInt8>(aSeq[nIndex]);
+ }
+
+ for( ; nIndex < 32; nIndex++ )
+ {
+ aData[nIndex] = 0;
+ }
+ }
+}
+
+/** returns a uno sequence of sal_Int8
+*/
+void SetOfByte::QueryValue( com::sun::star::uno::Any & rAny ) const
+{
+ sal_Int16 nNumBytesSet = 0;
+ sal_Int16 nIndex;
+ for( nIndex = 31; nIndex >= 00; nIndex-- )
+ {
+ if( 0 != aData[nIndex] )
+ {
+ nNumBytesSet = nIndex + 1;
+ break;
+ }
+ }
+
+ com::sun::star::uno::Sequence< sal_Int8 > aSeq( nNumBytesSet );
+
+ for( nIndex = 0; nIndex < nNumBytesSet; nIndex++ )
+ {
+ aSeq[nIndex] = static_cast<sal_Int8>(aData[nIndex]);
+ }
+
+ rAny <<= aSeq;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// SdrLayer
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrLayer::SetStandardLayer(FASTBOOL bStd)
+{
+ nType=(sal_uInt16)bStd;
+ if (bStd) {
+ aName=ImpGetResStr(STR_StandardLayerName);
+ }
+ if (pModel!=NULL) {
+ SdrHint aHint(HINT_LAYERCHG);
+ pModel->Broadcast(aHint);
+ pModel->SetChanged();
+ }
+}
+
+void SdrLayer::SetName(const XubString& rNewName)
+{
+ if(!rNewName.Equals(aName))
+ {
+ aName = rNewName;
+ nType = 0; // Userdefined
+
+ if(pModel)
+ {
+ SdrHint aHint(HINT_LAYERCHG);
+
+ pModel->Broadcast(aHint);
+ pModel->SetChanged();
+ }
+ }
+}
+
+bool SdrLayer::operator==(const SdrLayer& rCmpLayer) const
+{
+ return (nID == rCmpLayer.nID
+ && nType == rCmpLayer.nType
+ && aName.Equals(rCmpLayer.aName));
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// SdrLayerAdmin
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrLayerAdmin::SdrLayerAdmin(SdrLayerAdmin* pNewParent):
+ aLayer(1024,16,16),
+ aLSets(1024,16,16),
+ pModel(NULL)
+{
+ sal_Char aTextControls[] = "Controls";
+ aControlLayerName = String(aTextControls, sizeof(aTextControls-1));
+ pParent=pNewParent;
+}
+
+SdrLayerAdmin::SdrLayerAdmin(const SdrLayerAdmin& rSrcLayerAdmin):
+ aLayer(1024,16,16),
+ aLSets(1024,16,16),
+ pParent(NULL),
+ pModel(NULL)
+{
+ sal_Char aTextControls[] = "Controls";
+ aControlLayerName = String(aTextControls, sizeof(aTextControls-1));
+ *this = rSrcLayerAdmin;
+}
+
+SdrLayerAdmin::~SdrLayerAdmin()
+{
+ ClearLayer();
+}
+
+void SdrLayerAdmin::ClearLayer()
+{
+ SdrLayer* pL;
+ pL=(SdrLayer*)aLayer.First();
+ while (pL!=NULL) {
+ delete pL;
+ pL=(SdrLayer*)aLayer.Next();
+ }
+ aLayer.Clear();
+}
+
+const SdrLayerAdmin& SdrLayerAdmin::operator=(const SdrLayerAdmin& rSrcLayerAdmin)
+{
+ ClearLayer();
+ pParent=rSrcLayerAdmin.pParent;
+ sal_uInt16 i;
+ sal_uInt16 nAnz=rSrcLayerAdmin.GetLayerCount();
+ for (i=0; i<nAnz; i++) {
+ aLayer.Insert(new SdrLayer(*rSrcLayerAdmin.GetLayer(i)),CONTAINER_APPEND);
+ }
+ return *this;
+}
+
+bool SdrLayerAdmin::operator==(const SdrLayerAdmin& rCmpLayerAdmin) const
+{
+ if (pParent!=rCmpLayerAdmin.pParent ||
+ aLayer.Count()!=rCmpLayerAdmin.aLayer.Count() ||
+ aLSets.Count()!=rCmpLayerAdmin.aLSets.Count()) return sal_False;
+ FASTBOOL bOk=sal_True;
+ sal_uInt16 nAnz=GetLayerCount();
+ sal_uInt16 i=0;
+ while (bOk && i<nAnz) {
+ bOk=*GetLayer(i)==*rCmpLayerAdmin.GetLayer(i);
+ i++;
+ }
+ return bOk;
+}
+
+void SdrLayerAdmin::SetModel(SdrModel* pNewModel)
+{
+ if (pNewModel!=pModel) {
+ pModel=pNewModel;
+ sal_uInt16 nAnz=GetLayerCount();
+ sal_uInt16 i;
+ for (i=0; i<nAnz; i++) {
+ GetLayer(i)->SetModel(pNewModel);
+ }
+ }
+}
+
+void SdrLayerAdmin::Broadcast() const
+{
+ if (pModel!=NULL) {
+ SdrHint aHint(HINT_LAYERORDERCHG);
+ pModel->Broadcast(aHint);
+ pModel->SetChanged();
+ }
+}
+
+SdrLayer* SdrLayerAdmin::RemoveLayer(sal_uInt16 nPos)
+{
+ SdrLayer* pRetLayer=(SdrLayer*)(aLayer.Remove(nPos));
+ Broadcast();
+ return pRetLayer;
+}
+
+SdrLayer* SdrLayerAdmin::NewLayer(const XubString& rName, sal_uInt16 nPos)
+{
+ SdrLayerID nID=GetUniqueLayerID();
+ SdrLayer* pLay=new SdrLayer(nID,rName);
+ pLay->SetModel(pModel);
+ aLayer.Insert(pLay,nPos);
+ Broadcast();
+ return pLay;
+}
+
+SdrLayer* SdrLayerAdmin::NewStandardLayer(sal_uInt16 nPos)
+{
+ SdrLayerID nID=GetUniqueLayerID();
+ SdrLayer* pLay=new SdrLayer(nID,String());
+ pLay->SetStandardLayer();
+ pLay->SetModel(pModel);
+ aLayer.Insert(pLay,nPos);
+ Broadcast();
+ return pLay;
+}
+
+SdrLayer* SdrLayerAdmin::MoveLayer(sal_uInt16 nPos, sal_uInt16 nNewPos)
+{
+ SdrLayer* pLayer=(SdrLayer*)(aLayer.Remove(nPos));
+ if (pLayer!=NULL) {
+ aLayer.Insert(pLayer,nNewPos);
+ }
+
+ Broadcast();
+ return pLayer;
+}
+
+void SdrLayerAdmin::MoveLayer(SdrLayer* pLayer, sal_uInt16 nNewPos)
+{
+ sal_uIntPtr nPos=aLayer.GetPos(pLayer);
+ if (nPos!=CONTAINER_ENTRY_NOTFOUND) {
+ aLayer.Remove(nPos);
+ aLayer.Insert(pLayer,nNewPos);
+ Broadcast();
+ }
+}
+
+sal_uInt16 SdrLayerAdmin::GetLayerPos(SdrLayer* pLayer) const
+{
+ sal_uIntPtr nRet=SDRLAYER_NOTFOUND;
+ if (pLayer!=NULL) {
+ nRet=aLayer.GetPos(pLayer);
+ if (nRet==CONTAINER_ENTRY_NOTFOUND) {
+ nRet=SDRLAYER_NOTFOUND;
+ }
+ }
+ return sal_uInt16(nRet);
+}
+
+const SdrLayer* SdrLayerAdmin::GetLayer(const XubString& rName, FASTBOOL /*bInherited*/) const
+{
+ sal_uInt16 i(0);
+ const SdrLayer* pLay = NULL;
+
+ while(i < GetLayerCount() && !pLay)
+ {
+ if(rName.Equals(GetLayer(i)->GetName()))
+ pLay = GetLayer(i);
+ else
+ i++;
+ }
+
+ if(!pLay && pParent)
+ {
+ pLay = pParent->GetLayer(rName, sal_True);
+ }
+
+ return pLay;
+}
+
+SdrLayerID SdrLayerAdmin::GetLayerID(const XubString& rName, FASTBOOL bInherited) const
+{
+ SdrLayerID nRet=SDRLAYER_NOTFOUND;
+ const SdrLayer* pLay=GetLayer(rName,bInherited);
+ if (pLay!=NULL) nRet=pLay->GetID();
+ return nRet;
+}
+
+const SdrLayer* SdrLayerAdmin::GetLayerPerID(sal_uInt16 nID) const
+{
+ sal_uInt16 i=0;
+ const SdrLayer* pLay=NULL;
+ while (i<GetLayerCount() && pLay==NULL) {
+ if (nID==GetLayer(i)->GetID()) pLay=GetLayer(i);
+ else i++;
+ }
+ return pLay;
+}
+
+// Globale LayerID's beginnen mit 0 aufsteigend.
+// Lokale LayerID's beginnen mit 254 absteigend.
+// 255 ist reserviert fuer SDRLAYER_NOTFOUND
+
+SdrLayerID SdrLayerAdmin::GetUniqueLayerID() const
+{
+ SetOfByte aSet;
+ sal_Bool bDown = (pParent == NULL);
+ sal_uInt16 j;
+ for (j=0; j<GetLayerCount(); j++)
+ {
+ aSet.Set(GetLayer((sal_uInt16)j)->GetID());
+ }
+ SdrLayerID i;
+ if (!bDown)
+ {
+ i=254;
+ while (i && aSet.IsSet(sal_uInt8(i)))
+ --i;
+ if (i == 0)
+ i=254;
+ }
+ else
+ {
+ i=0;
+ while (i<=254 && aSet.IsSet(sal_uInt8(i)))
+ i++;
+ if (i>254)
+ i=0;
+ }
+ return i;
+}
+
diff --git a/svx/source/svdraw/svdmark.cxx b/svx/source/svdraw/svdmark.cxx
new file mode 100644
index 000000000000..8949b1418f94
--- /dev/null
+++ b/svx/source/svdraw/svdmark.cxx
@@ -0,0 +1,1040 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <svx/svdmark.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdpage.hxx>
+#include "svx/svditer.hxx"
+#include <svx/svdpagv.hxx>
+#include <svx/svdopath.hxx> // zur Abschaltung
+#include <svx/svdogrp.hxx> // des Cache bei
+#include <svx/svdorect.hxx> // GetMarkDescription
+#include "svx/svdstr.hrc" // Namen aus der Resource
+#include "svx/svdglob.hxx" // StringCache
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+#include <svx/obj3d.hxx>
+#include <svx/scene3d.hxx>
+#include <svl/brdcst.hxx>
+#include <svx/svdoedge.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class ImpSdrUShortContSorter: public ContainerSorter
+{
+public:
+ ImpSdrUShortContSorter(Container& rNewCont)
+ : ContainerSorter(rNewCont)
+ {}
+
+ virtual int Compare(const void* pElem1, const void* pElem2) const;
+};
+
+int ImpSdrUShortContSorter::Compare(const void* pElem1, const void* pElem2) const
+{
+ sal_uInt16 n1((sal_uInt16)((sal_uIntPtr)pElem1));
+ sal_uInt16 n2((sal_uInt16)((sal_uIntPtr)pElem2));
+
+ return ((n1 < n2) ? (-1) : (n1 > n2) ? (1) : (0));
+}
+
+void SdrUShortCont::Sort() const
+{
+ ImpSdrUShortContSorter aSort(*((Container*)(&maArray)));
+ aSort.DoSort();
+ ((SdrUShortCont*)this)->mbSorted = sal_True;
+
+ sal_uLong nNum(GetCount());
+
+ if(nNum > 1)
+ {
+ nNum--;
+ sal_uInt16 nVal0 = GetObject(nNum);
+
+ while(nNum > 0)
+ {
+ nNum--;
+ sal_uInt16 nVal1 = GetObject(nNum);
+
+ if(nVal1 == nVal0)
+ {
+ ((SdrUShortCont*)this)->Remove(nNum);
+ }
+
+ nVal0 = nVal1;
+ }
+ }
+}
+
+void SdrUShortCont::CheckSort(sal_uLong nPos)
+{
+ sal_uLong nAnz(maArray.Count());
+
+ if(nPos > nAnz)
+ nPos = nAnz;
+
+ sal_uInt16 nAktVal = GetObject(nPos);
+
+ if(nPos > 0)
+ {
+ sal_uInt16 nPrevVal = GetObject(nPos - 1);
+
+ if(nPrevVal >= nAktVal)
+ mbSorted = sal_False;
+ }
+
+ if(nPos < nAnz - 1)
+ {
+ sal_uInt16 nNextVal = GetObject(nPos + 1);
+
+ if(nNextVal <= nAktVal)
+ mbSorted = sal_False;
+ }
+}
+
+std::set< sal_uInt16 > SdrUShortCont::getContainer()
+{
+ std::set< sal_uInt16 > aSet;
+
+ sal_uInt32 nAnz = maArray.Count();
+ while(nAnz)
+ aSet.insert( GetObject(--nAnz) );
+
+ return aSet;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrMark::SdrMark(SdrObject* pNewObj, SdrPageView* pNewPageView)
+: mpSelectedSdrObject(pNewObj),
+ mpPageView(pNewPageView),
+ mpPoints(0L),
+ mpLines(0L),
+ mpGluePoints(0L),
+ mbCon1(sal_False),
+ mbCon2(sal_False),
+ mnUser(0)
+{
+ if(mpSelectedSdrObject)
+ {
+ mpSelectedSdrObject->AddObjectUser( *this );
+ }
+}
+
+SdrMark::SdrMark(const SdrMark& rMark)
+: ObjectUser(),
+ mpSelectedSdrObject(0L),
+ mpPageView(0L),
+ mpPoints(0L),
+ mpLines(0L),
+ mpGluePoints(0L),
+ mbCon1(sal_False),
+ mbCon2(sal_False),
+ mnUser(0)
+{
+ *this = rMark;
+}
+
+SdrMark::~SdrMark()
+{
+ if(mpSelectedSdrObject)
+ {
+ mpSelectedSdrObject->RemoveObjectUser( *this );
+ }
+
+ if(mpPoints)
+ {
+ delete mpPoints;
+ }
+
+ if(mpLines)
+ {
+ delete mpLines;
+ }
+
+ if(mpGluePoints)
+ {
+ delete mpGluePoints;
+ }
+}
+
+void SdrMark::ObjectInDestruction(const SdrObject& rObject)
+{
+ (void) rObject; // avoid warnings
+ OSL_ENSURE(mpSelectedSdrObject && mpSelectedSdrObject == &rObject, "SdrMark::ObjectInDestruction: called form object different from hosted one (!)");
+ OSL_ENSURE(mpSelectedSdrObject, "SdrMark::ObjectInDestruction: still seleceted SdrObject is deleted, deselect first (!)");
+ mpSelectedSdrObject = 0L;
+}
+
+void SdrMark::SetMarkedSdrObj(SdrObject* pNewObj)
+{
+ if(mpSelectedSdrObject)
+ {
+ mpSelectedSdrObject->RemoveObjectUser( *this );
+ }
+
+ mpSelectedSdrObject = pNewObj;
+
+ if(mpSelectedSdrObject)
+ {
+ mpSelectedSdrObject->AddObjectUser( *this );
+ }
+}
+
+SdrObject* SdrMark::GetMarkedSdrObj() const
+{
+ return mpSelectedSdrObject;
+}
+
+SdrMark& SdrMark::operator=(const SdrMark& rMark)
+{
+ SetMarkedSdrObj(rMark.mpSelectedSdrObject);
+ mpPageView = rMark.mpPageView;
+ mbCon1 = rMark.mbCon1;
+ mbCon2 = rMark.mbCon2;
+ mnUser = rMark.mnUser;
+
+ if(!rMark.mpPoints)
+ {
+ if(mpPoints)
+ {
+ delete mpPoints;
+ mpPoints = 0L;
+ }
+ }
+ else
+ {
+ if(!mpPoints)
+ {
+ mpPoints = new SdrUShortCont(*rMark.mpPoints);
+ }
+ else
+ {
+ *mpPoints = *rMark.mpPoints;
+ }
+ }
+
+ if(!rMark.mpLines)
+ {
+ if(mpLines)
+ {
+ delete mpLines;
+ mpLines = 0L;
+ }
+ }
+ else
+ {
+ if(!mpLines)
+ {
+ mpLines = new SdrUShortCont(*rMark.mpLines);
+ }
+ else
+ {
+ *mpLines = *rMark.mpLines;
+ }
+ }
+
+ if(!rMark.mpGluePoints)
+ {
+ if(mpGluePoints)
+ {
+ delete mpGluePoints;
+ mpGluePoints = 0L;
+ }
+ }
+ else
+ {
+ if(!mpGluePoints)
+ {
+ mpGluePoints = new SdrUShortCont(*rMark.mpGluePoints);
+ }
+ else
+ {
+ *mpGluePoints = *rMark.mpGluePoints;
+ }
+ }
+
+ return *this;
+}
+
+sal_Bool SdrMark::operator==(const SdrMark& rMark) const
+{
+ sal_Bool bRet(mpSelectedSdrObject == rMark.mpSelectedSdrObject && mpPageView == rMark.mpPageView && mbCon1 == rMark.mbCon1 && mbCon2 == rMark.mbCon2 && mnUser == rMark.mnUser);
+
+ if((mpPoints != 0L) != (rMark.mpPoints != 0L))
+ bRet = sal_False;
+
+ if((mpLines != 0L) != (rMark.mpLines != 0L))
+ bRet = sal_False;
+
+ if((mpGluePoints != 0L) != (rMark.mpGluePoints != 0L))
+ bRet = sal_False;
+
+ if(bRet && mpPoints && *mpPoints != *rMark.mpPoints)
+ bRet = sal_False;
+
+ if(bRet && mpLines && *mpLines != *rMark.mpLines)
+ bRet = sal_False;
+
+ if(bRet && mpGluePoints && *mpGluePoints != *rMark.mpGluePoints)
+ bRet = sal_False;
+
+ return bRet;
+}
+
+SdrPage* SdrMark::GetPage() const
+{
+ return (mpSelectedSdrObject ? mpSelectedSdrObject->GetPage() : 0);
+}
+
+SdrObjList* SdrMark::GetObjList() const
+{
+ return (mpSelectedSdrObject ? mpSelectedSdrObject->GetObjList() : 0);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class ImpSdrMarkListSorter: public ContainerSorter
+{
+public:
+ ImpSdrMarkListSorter(Container& rNewCont)
+ : ContainerSorter(rNewCont)
+ {}
+
+ virtual int Compare(const void* pElem1, const void* pElem2) const;
+};
+
+int ImpSdrMarkListSorter::Compare(const void* pElem1, const void* pElem2) const
+{
+ SdrObject* pObj1 = ((SdrMark*)pElem1)->GetMarkedSdrObj();
+ SdrObject* pObj2 = ((SdrMark*)pElem2)->GetMarkedSdrObj();
+ SdrObjList* pOL1 = (pObj1) ? pObj1->GetObjList() : 0L;
+ SdrObjList* pOL2 = (pObj2) ? pObj2->GetObjList() : 0L;
+
+ if (pOL1 == pOL2)
+ {
+ // AF: Note that I reverted a change from sal_uInt32 to sal_uLong (made
+ // for 64bit compliance, #i78198#) because internally in SdrObject
+ // both nOrdNum and mnNavigationPosition are stored as sal_uInt32.
+ sal_uInt32 nObjOrd1((pObj1) ? pObj1->GetNavigationPosition() : 0);
+ sal_uInt32 nObjOrd2((pObj2) ? pObj2->GetNavigationPosition() : 0);
+
+ return (nObjOrd1 < nObjOrd2 ? -1 : 1);
+ }
+ else
+ {
+ return ((long)pOL1 < (long)pOL2) ? -1 : 1;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrMarkList::ForceSort() const
+{
+ if(!mbSorted)
+ {
+ ((SdrMarkList*)this)->ImpForceSort();
+ }
+}
+
+void SdrMarkList::ImpForceSort()
+{
+ if(!mbSorted)
+ {
+ mbSorted = sal_True;
+ sal_uLong nAnz = maList.Count();
+
+ // remove invalid
+ if(nAnz > 0 )
+ {
+ SdrMark* pAkt = (SdrMark*)maList.First();
+ while( pAkt )
+ {
+ if(pAkt->GetMarkedSdrObj() == 0)
+ {
+ maList.Remove();
+ delete pAkt;
+ }
+ pAkt= (SdrMark*)maList.Next();
+ }
+ nAnz = maList.Count();
+ }
+
+ if(nAnz > 1)
+ {
+ ImpSdrMarkListSorter aSort(maList);
+ aSort.DoSort();
+
+ // remove duplicates
+ if(maList.Count() > 1)
+ {
+ SdrMark* pAkt = (SdrMark*)maList.Last();
+ SdrMark* pCmp = (SdrMark*)maList.Prev();
+
+ while(pCmp)
+ {
+ if(pAkt->GetMarkedSdrObj() == pCmp->GetMarkedSdrObj() && pAkt->GetMarkedSdrObj())
+ {
+ // Con1/Con2 Merging
+ if(pCmp->IsCon1())
+ pAkt->SetCon1(sal_True);
+
+ if(pCmp->IsCon2())
+ pAkt->SetCon2(sal_True);
+
+ // pCmp loeschen.
+ maList.Remove();
+
+ delete pCmp;
+ }
+ else
+ {
+ pAkt = pCmp;
+ }
+
+ pCmp = (SdrMark*)maList.Prev();
+ }
+ }
+ }
+ }
+}
+
+void SdrMarkList::Clear()
+{
+ for(sal_uLong i(0L); i < GetMarkCount(); i++)
+ {
+ SdrMark* pMark = GetMark(i);
+ delete pMark;
+ }
+
+ maList.Clear();
+ SetNameDirty();
+}
+
+void SdrMarkList::operator=(const SdrMarkList& rLst)
+{
+ Clear();
+
+ for(sal_uLong i(0L); i < rLst.GetMarkCount(); i++)
+ {
+ SdrMark* pMark = rLst.GetMark(i);
+ SdrMark* pNeuMark = new SdrMark(*pMark);
+ maList.Insert(pNeuMark, CONTAINER_APPEND);
+ }
+
+ maMarkName = rLst.maMarkName;
+ mbNameOk = rLst.mbNameOk;
+ maPointName = rLst.maPointName;
+ mbPointNameOk = rLst.mbPointNameOk;
+ maGluePointName = rLst.maGluePointName;
+ mbGluePointNameOk = rLst.mbGluePointNameOk;
+ mbSorted = rLst.mbSorted;
+}
+
+sal_uLong SdrMarkList::FindObject(const SdrObject* pObj) const
+{
+ // #109658#
+ //
+ // Since relying on OrdNums is not allowed for the selection because objects in the
+ // selection may not be inserted in a list if they are e.g. modified ATM, i changed
+ // this loop to just look if the object pointer is in the selection.
+ //
+ // Problem is that GetOrdNum() which is const, internally casts to non-const and
+ // hardly sets the OrdNum member of the object (nOrdNum) to 0 (ZERO) if the object
+ // is not inserted in a object list.
+ // Since this may be by purpose and necessary somewhere else i decided that it is
+ // less dangerous to change this method then changing SdrObject::GetOrdNum().
+ if(pObj && maList.Count())
+ {
+ for(sal_uLong a(0L); a < maList.Count(); a++)
+ {
+ if(((SdrMark*)(maList.GetObject(a)))->GetMarkedSdrObj() == pObj)
+ {
+ return a;
+ }
+ }
+ }
+
+ return CONTAINER_ENTRY_NOTFOUND;
+}
+
+void SdrMarkList::InsertEntry(const SdrMark& rMark, sal_Bool bChkSort)
+{
+ SetNameDirty();
+ sal_uLong nAnz(maList.Count());
+
+ if(!bChkSort || !mbSorted || nAnz == 0)
+ {
+ if(!bChkSort)
+ mbSorted = sal_False;
+
+ maList.Insert(new SdrMark(rMark), CONTAINER_APPEND);
+ }
+ else
+ {
+ SdrMark* pLast = GetMark(sal_uLong(nAnz - 1));
+ const SdrObject* pLastObj = pLast->GetMarkedSdrObj();
+ const SdrObject* pNeuObj = rMark.GetMarkedSdrObj();
+
+ if(pLastObj == pNeuObj)
+ {
+ // Aha, den gibt's schon
+ // Con1/Con2 Merging
+ if(rMark.IsCon1())
+ pLast->SetCon1(sal_True);
+
+ if(rMark.IsCon2())
+ pLast->SetCon2(sal_True);
+ }
+ else
+ {
+ SdrMark* pKopie = new SdrMark(rMark);
+ maList.Insert(pKopie, CONTAINER_APPEND);
+
+ // und nun checken, ob die Sortierung noch ok ist
+ const SdrObjList* pLastOL = pLastObj!=0L ? pLastObj->GetObjList() : 0L;
+ const SdrObjList* pNeuOL = pNeuObj !=0L ? pNeuObj ->GetObjList() : 0L;
+
+ if(pLastOL == pNeuOL)
+ {
+ const sal_uLong nLastNum(pLastObj!=0L ? pLastObj->GetOrdNum() : 0);
+ const sal_uLong nNeuNum(pNeuObj !=0L ? pNeuObj ->GetOrdNum() : 0);
+
+ if(nNeuNum < nLastNum)
+ {
+ // irgendwann muss mal sortiert werden
+ mbSorted = sal_False;
+ }
+ }
+ else
+ {
+ // irgendwann muss mal sortiert werden
+ mbSorted = sal_False;
+ }
+ }
+ }
+
+ return;
+}
+
+void SdrMarkList::DeleteMark(sal_uLong nNum)
+{
+ SdrMark* pMark = GetMark(nNum);
+ DBG_ASSERT(pMark!=0L,"DeleteMark: MarkEntry nicht gefunden");
+
+ if(pMark)
+ {
+ maList.Remove(nNum);
+ delete pMark;
+ SetNameDirty();
+ }
+}
+
+void SdrMarkList::ReplaceMark(const SdrMark& rNewMark, sal_uLong nNum)
+{
+ SdrMark* pMark = GetMark(nNum);
+ DBG_ASSERT(pMark!=0L,"ReplaceMark: MarkEntry nicht gefunden");
+
+ if(pMark)
+ {
+ delete pMark;
+ SetNameDirty();
+ SdrMark* pKopie = new SdrMark(rNewMark);
+ maList.Replace(pKopie, nNum);
+ mbSorted = sal_False;
+ }
+}
+
+void SdrMarkList::Merge(const SdrMarkList& rSrcList, sal_Bool bReverse)
+{
+ sal_uLong nAnz(rSrcList.maList.Count());
+
+ if(rSrcList.mbSorted)
+ {
+ // Merging ohne ein Sort bei rSrcList zu erzwingen
+ bReverse = sal_False;
+ }
+
+ if(!bReverse)
+ {
+ for(sal_uLong i(0L); i < nAnz; i++)
+ {
+ SdrMark* pM = (SdrMark*)(rSrcList.maList.GetObject(i));
+ InsertEntry(*pM);
+ }
+ }
+ else
+ {
+ for(sal_uLong i(nAnz); i > 0;)
+ {
+ i--;
+ SdrMark* pM = (SdrMark*)(rSrcList.maList.GetObject(i));
+ InsertEntry(*pM);
+ }
+ }
+}
+
+sal_Bool SdrMarkList::DeletePageView(const SdrPageView& rPV)
+{
+ sal_Bool bChgd(sal_False);
+
+ for(sal_uLong i(GetMarkCount()); i > 0; )
+ {
+ i--;
+ SdrMark* pMark = GetMark(i);
+
+ if(pMark->GetPageView()==&rPV)
+ {
+ maList.Remove(i);
+ delete pMark;
+ SetNameDirty();
+ bChgd = sal_True;
+ }
+ }
+
+ return bChgd;
+}
+
+sal_Bool SdrMarkList::InsertPageView(const SdrPageView& rPV)
+{
+ sal_Bool bChgd(sal_False);
+ DeletePageView(rPV); // erstmal alle raus, dann die ganze Seite hinten dran
+ SdrObject* pObj;
+ const SdrObjList* pOL = rPV.GetObjList();
+ sal_uLong nObjAnz(pOL->GetObjCount());
+
+ for(sal_uLong nO(0L); nO < nObjAnz; nO++)
+ {
+ pObj = pOL->GetObj(nO);
+ sal_Bool bDoIt(rPV.IsObjMarkable(pObj));
+
+ if(bDoIt)
+ {
+ SdrMark* pM = new SdrMark(pObj, (SdrPageView*)&rPV);
+ maList.Insert(pM, CONTAINER_APPEND);
+ SetNameDirty();
+ bChgd = sal_True;
+ }
+ }
+
+ return bChgd;
+}
+
+const XubString& SdrMarkList::GetMarkDescription() const
+{
+ sal_uLong nAnz(GetMarkCount());
+
+ if(mbNameOk && 1L == nAnz)
+ {
+ // Bei Einfachselektion nur Textrahmen cachen
+ const SdrObject* pObj = GetMark(0)->GetMarkedSdrObj();
+ const SdrTextObj* pTextObj = PTR_CAST(SdrTextObj, pObj);
+
+ if(!pTextObj || !pTextObj->IsTextFrame())
+ {
+ ((SdrMarkList*)(this))->mbNameOk = sal_False;
+ }
+ }
+
+ if(!mbNameOk)
+ {
+ SdrMark* pMark = GetMark(0);
+ XubString aNam;
+
+ if(!nAnz)
+ {
+ ((SdrMarkList*)(this))->maMarkName = ImpGetResStr(STR_ObjNameNoObj);
+ }
+ else if(1L == nAnz)
+ {
+ if(pMark->GetMarkedSdrObj())
+ {
+ pMark->GetMarkedSdrObj()->TakeObjNameSingul(aNam);
+ }
+ }
+ else
+ {
+ if(pMark->GetMarkedSdrObj())
+ {
+ pMark->GetMarkedSdrObj()->TakeObjNamePlural(aNam);
+ XubString aStr1;
+ sal_Bool bEq(sal_True);
+
+ for(sal_uLong i = 1; i < GetMarkCount() && bEq; i++)
+ {
+ SdrMark* pMark2 = GetMark(i);
+ pMark2->GetMarkedSdrObj()->TakeObjNamePlural(aStr1);
+ bEq = aNam.Equals(aStr1);
+ }
+
+ if(!bEq)
+ {
+ aNam = ImpGetResStr(STR_ObjNamePlural);
+ }
+ }
+
+ aNam.Insert(sal_Unicode(' '), 0);
+ aNam.Insert(UniString::CreateFromInt32(nAnz), 0);
+ }
+
+ ((SdrMarkList*)(this))->maMarkName = aNam;
+ ((SdrMarkList*)(this))->mbNameOk = sal_True;
+ }
+
+ return maMarkName;
+}
+
+const XubString& SdrMarkList::GetPointMarkDescription(sal_Bool bGlue) const
+{
+ sal_Bool& rNameOk = (sal_Bool&)(bGlue ? mbGluePointNameOk : mbPointNameOk);
+ XubString& rName = (XubString&)(bGlue ? maGluePointName : maPointName);
+ sal_uLong nMarkAnz(GetMarkCount());
+ sal_uLong nMarkPtAnz(0L);
+ sal_uLong nMarkPtObjAnz(0L);
+ sal_uLong n1stMarkNum(ULONG_MAX);
+
+ for(sal_uLong nMarkNum(0L); nMarkNum < nMarkAnz; nMarkNum++)
+ {
+ const SdrMark* pMark = GetMark(nMarkNum);
+ const SdrUShortCont* pPts = bGlue ? pMark->GetMarkedGluePoints() : pMark->GetMarkedPoints();
+ sal_uLong nAnz(pPts ? pPts->GetCount() : 0);
+
+ if(nAnz)
+ {
+ if(n1stMarkNum == ULONG_MAX)
+ {
+ n1stMarkNum = nMarkNum;
+ }
+
+ nMarkPtAnz += nAnz;
+ nMarkPtObjAnz++;
+ }
+
+ if(nMarkPtObjAnz > 1 && rNameOk)
+ {
+ // vorzeitige Entscheidung
+ return rName;
+ }
+ }
+
+ if(rNameOk && 1L == nMarkPtObjAnz)
+ {
+ // Bei Einfachselektion nur Textrahmen cachen
+ const SdrObject* pObj = GetMark(0)->GetMarkedSdrObj();
+ const SdrTextObj* pTextObj = PTR_CAST(SdrTextObj,pObj);
+
+ if(!pTextObj || !pTextObj->IsTextFrame())
+ {
+ rNameOk = sal_False;
+ }
+ }
+
+ if(!nMarkPtObjAnz)
+ {
+ rName.Erase();
+ rNameOk = sal_True;
+ }
+ else if(!rNameOk)
+ {
+ const SdrMark* pMark = GetMark(n1stMarkNum);
+ XubString aNam;
+
+ if(1L == nMarkPtObjAnz)
+ {
+ if(pMark->GetMarkedSdrObj())
+ {
+ pMark->GetMarkedSdrObj()->TakeObjNameSingul(aNam);
+ }
+ }
+ else
+ {
+ if(pMark->GetMarkedSdrObj())
+ {
+ pMark->GetMarkedSdrObj()->TakeObjNamePlural(aNam);
+ }
+
+ XubString aStr1;
+ sal_Bool bEq(sal_True);
+
+ for(sal_uLong i(n1stMarkNum + 1L); i < GetMarkCount() && bEq; i++)
+ {
+ const SdrMark* pMark2 = GetMark(i);
+ const SdrUShortCont* pPts = bGlue ? pMark2->GetMarkedGluePoints() : pMark2->GetMarkedPoints();
+
+ if(pPts && pPts->GetCount() && pMark2->GetMarkedSdrObj())
+ {
+ pMark2->GetMarkedSdrObj()->TakeObjNamePlural(aStr1);
+ bEq = aNam.Equals(aStr1);
+ }
+ }
+
+ if(!bEq)
+ {
+ aNam = ImpGetResStr(STR_ObjNamePlural);
+ }
+
+ aNam.Insert(sal_Unicode(' '), 0);
+ aNam.Insert(UniString::CreateFromInt32(nMarkPtObjAnz), 0);
+ }
+
+ XubString aStr1;
+
+ if(1L == nMarkPtAnz)
+ {
+ aStr1 = (ImpGetResStr(bGlue ? STR_ViewMarkedGluePoint : STR_ViewMarkedPoint));
+ }
+ else
+ {
+ aStr1 = (ImpGetResStr(bGlue ? STR_ViewMarkedGluePoints : STR_ViewMarkedPoints));
+ aStr1.SearchAndReplaceAscii("%2", UniString::CreateFromInt32(nMarkPtAnz));
+ }
+
+ aStr1.SearchAndReplaceAscii("%1", aNam);
+ rName = aStr1;
+ rNameOk = sal_True;
+ }
+
+ return rName;
+}
+
+sal_Bool SdrMarkList::TakeBoundRect(SdrPageView* pPV, Rectangle& rRect) const
+{
+ sal_Bool bFnd(sal_False);
+ Rectangle aR;
+
+ for(sal_uLong i(0L); i < GetMarkCount(); i++)
+ {
+ SdrMark* pMark = GetMark(i);
+
+ if(!pPV || pMark->GetPageView() == pPV)
+ {
+ if(pMark->GetMarkedSdrObj())
+ {
+ aR = pMark->GetMarkedSdrObj()->GetCurrentBoundRect();
+
+ if(bFnd)
+ {
+ rRect.Union(aR);
+ }
+ else
+ {
+ rRect = aR;
+ bFnd = sal_True;
+ }
+ }
+ }
+ }
+
+ return bFnd;
+}
+
+sal_Bool SdrMarkList::TakeSnapRect(SdrPageView* pPV, Rectangle& rRect) const
+{
+ sal_Bool bFnd(sal_False);
+
+ for(sal_uLong i(0L); i < GetMarkCount(); i++)
+ {
+ SdrMark* pMark = GetMark(i);
+
+ if(!pPV || pMark->GetPageView() == pPV)
+ {
+ if(pMark->GetMarkedSdrObj())
+ {
+ Rectangle aR(pMark->GetMarkedSdrObj()->GetSnapRect());
+
+ if(bFnd)
+ {
+ rRect.Union(aR);
+ }
+ else
+ {
+ rRect = aR;
+ bFnd = sal_True;
+ }
+ }
+ }
+ }
+
+ return bFnd;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ ViewSelection::ViewSelection()
+ : mbEdgesOfMarkedNodesDirty(sal_False)
+ {
+ }
+
+ void ViewSelection::SetEdgesOfMarkedNodesDirty()
+ {
+ if(!mbEdgesOfMarkedNodesDirty)
+ {
+ mbEdgesOfMarkedNodesDirty = sal_True;
+ maEdgesOfMarkedNodes.Clear();
+ maMarkedEdgesOfMarkedNodes.Clear();
+ maAllMarkedObjects.Clear();
+ }
+ }
+
+ const SdrMarkList& ViewSelection::GetEdgesOfMarkedNodes() const
+ {
+ if(mbEdgesOfMarkedNodesDirty)
+ {
+ ((ViewSelection*)this)->ImpForceEdgesOfMarkedNodes();
+ }
+
+ return maEdgesOfMarkedNodes;
+ }
+
+ const SdrMarkList& ViewSelection::GetMarkedEdgesOfMarkedNodes() const
+ {
+ if(mbEdgesOfMarkedNodesDirty)
+ {
+ ((ViewSelection*)this)->ImpForceEdgesOfMarkedNodes();
+ }
+
+ return maMarkedEdgesOfMarkedNodes;
+ }
+
+ const List& ViewSelection::GetAllMarkedObjects() const
+ {
+ if(mbEdgesOfMarkedNodesDirty)
+ {
+ ((ViewSelection*)this)->ImpForceEdgesOfMarkedNodes();
+ }
+
+ return maAllMarkedObjects;
+ }
+
+ void ViewSelection::ImplCollectCompleteSelection(SdrObject* pObj)
+ {
+ if(pObj)
+ {
+ sal_Bool bIsGroup(pObj->IsGroupObject());
+
+ if(bIsGroup && pObj->ISA(E3dObject) && !pObj->ISA(E3dScene))
+ {
+ bIsGroup = sal_False;
+ }
+
+ if(bIsGroup)
+ {
+ SdrObjList* pList = pObj->GetSubList();
+
+ for(sal_uLong a(0L); a < pList->GetObjCount(); a++)
+ {
+ SdrObject* pObj2 = pList->GetObj(a);
+ ImplCollectCompleteSelection(pObj2);
+ }
+ }
+
+ maAllMarkedObjects.Insert(pObj, LIST_APPEND);
+ }
+ }
+
+ void ViewSelection::ImpForceEdgesOfMarkedNodes()
+ {
+ if(mbEdgesOfMarkedNodesDirty)
+ {
+ mbEdgesOfMarkedNodesDirty = sal_False;
+ maMarkedObjectList.ForceSort();
+ maEdgesOfMarkedNodes.Clear();
+ maMarkedEdgesOfMarkedNodes.Clear();
+ maAllMarkedObjects.Clear();
+
+ // #126320# GetMarkCount after ForceSort
+ const sal_uLong nMarkAnz(maMarkedObjectList.GetMarkCount());
+
+ for(sal_uLong a(0L); a < nMarkAnz; a++)
+ {
+ SdrObject* pCandidate = maMarkedObjectList.GetMark(a)->GetMarkedSdrObj();
+
+ if(pCandidate)
+ {
+ // build transitive hull
+ ImplCollectCompleteSelection(pCandidate);
+
+ if(pCandidate->IsNode())
+ {
+ // travel over broadcaster/listener to access edges connected to the selected object
+ const SfxBroadcaster* pBC = pCandidate->GetBroadcaster();
+
+ if(pBC)
+ {
+ sal_uInt16 nLstAnz(pBC->GetListenerCount());
+
+ for(sal_uInt16 nl(0); nl < nLstAnz; nl++)
+ {
+ SfxListener* pLst = pBC->GetListener(nl);
+ SdrEdgeObj* pEdge = PTR_CAST(SdrEdgeObj, pLst);
+
+ if(pEdge && pEdge->IsInserted() && pEdge->GetPage() == pCandidate->GetPage())
+ {
+ SdrMark aM(pEdge, maMarkedObjectList.GetMark(a)->GetPageView());
+
+ if(pEdge->GetConnectedNode(sal_True) == pCandidate)
+ {
+ aM.SetCon1(sal_True);
+ }
+
+ if(pEdge->GetConnectedNode(sal_False) == pCandidate)
+ {
+ aM.SetCon2(sal_True);
+ }
+
+ if(CONTAINER_ENTRY_NOTFOUND == maMarkedObjectList.FindObject(pEdge))
+ {
+ // nachsehen, ob er selbst markiert ist
+ maEdgesOfMarkedNodes.InsertEntry(aM);
+ }
+ else
+ {
+ maMarkedEdgesOfMarkedNodes.InsertEntry(aM);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ maEdgesOfMarkedNodes.ForceSort();
+ maMarkedEdgesOfMarkedNodes.ForceSort();
+ }
+ }
+} // end of namespace sdr
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
new file mode 100644
index 000000000000..5328e5f1a3d1
--- /dev/null
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -0,0 +1,2258 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svdmodel.hxx>
+
+#include <rtl/uuid.h>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <osl/endian.h>
+#include <rtl/logfile.hxx>
+#include <math.h>
+#include <tools/urlobj.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+
+#include <tools/string.hxx>
+#include <svl/whiter.hxx>
+#include <svx/xit.hxx>
+#include <svx/xbtmpit.hxx>
+#include <svx/xlndsit.hxx>
+#include <svx/xlnedit.hxx>
+#include <svx/xflgrit.hxx>
+#include <svx/xflftrit.hxx>
+#include <svx/xflhtit.hxx>
+#include <svx/xlnstit.hxx>
+
+#include "svx/svditext.hxx"
+#include <editeng/editeng.hxx> // Fuer EditEngine::CreatePool()
+
+#include <svx/xtable.hxx>
+
+#include "svx/svditer.hxx"
+#include <svx/svdtrans.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdlayer.hxx>
+#include <svx/svdundo.hxx>
+#include <svx/svdpool.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdotext.hxx> // fuer ReformatAllTextObjects und CalcFieldValue
+#include <svx/svdetc.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/svdoole2.hxx>
+#include "svx/svdglob.hxx" // Stringcache
+#include "svx/svdstr.hrc" // Objektname
+#include "svdoutlinercache.hxx"
+
+
+#include <svl/asiancfg.hxx>
+#include "editeng/fontitem.hxx"
+#include <editeng/colritem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <svl/style.hxx>
+#include <tools/bigint.hxx>
+#include <editeng/numitem.hxx>
+#include <editeng/bulitem.hxx>
+#include <editeng/outlobj.hxx>
+#include "editeng/forbiddencharacterstable.hxx"
+#include <svl/zforlist.hxx>
+#include <comphelper/processfactory.hxx>
+
+// #90477#
+#include <tools/tenccvt.hxx>
+#include <unotools/syslocale.hxx>
+
+// #95114#
+#include <vcl/svapp.hxx>
+#include <svx/sdr/properties/properties.hxx>
+#include <editeng/eeitem.hxx>
+#include <svl/itemset.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+struct SdrModelImpl
+{
+ SfxUndoManager* mpUndoManager;
+ SdrUndoFactory* mpUndoFactory;
+ bool mbAllowShapePropertyChangeListener;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+DBG_NAME(SdrModel)
+TYPEINIT1(SdrModel,SfxBroadcaster);
+void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbeddedHelper,
+ bool bUseExtColorTable, bool bLoadRefCounts)
+{
+ mpImpl = new SdrModelImpl;
+ mpImpl->mpUndoManager=0;
+ mpImpl->mpUndoFactory=0;
+ mpImpl->mbAllowShapePropertyChangeListener=false;
+ mbInDestruction=false;
+ aObjUnit=SdrEngineDefaults::GetMapFraction();
+ eObjUnit=SdrEngineDefaults::GetMapUnit();
+ eUIUnit=FUNIT_MM;
+ aUIScale=Fraction(1,1);
+ nUIUnitKomma=0;
+ bUIOnlyKomma=sal_False;
+ pLayerAdmin=NULL;
+ pItemPool=pPool;
+ bMyPool=sal_False;
+ m_pEmbeddedHelper=_pEmbeddedHelper;
+ pDrawOutliner=NULL;
+ pHitTestOutliner=NULL;
+ pRefOutDev=NULL;
+ nProgressAkt=0;
+ nProgressMax=0;
+ nProgressOfs=0;
+ pDefaultStyleSheet=NULL;
+ pLinkManager=NULL;
+ pUndoStack=NULL;
+ pRedoStack=NULL;
+ nMaxUndoCount=16;
+ pAktUndoGroup=NULL;
+ nUndoLevel=0;
+ mbUndoEnabled=true;
+ nProgressPercent=0;
+ nLoadVersion=0;
+ bExtColorTable=sal_False;
+ mbChanged = sal_False;
+ bInfoChanged=sal_False;
+ bPagNumsDirty=sal_False;
+ bMPgNumsDirty=sal_False;
+ bPageNotValid=sal_False;
+ bSavePortable=sal_False;
+ bSaveCompressed=sal_False;
+ bSaveNative=sal_False;
+ bSwapGraphics=sal_False;
+ nSwapGraphicsMode=SDR_SWAPGRAPHICSMODE_DEFAULT;
+ bSaveOLEPreview=sal_False;
+ bPasteResize=sal_False;
+ bNoBitmapCaching=sal_False;
+ bReadOnly=sal_False;
+ nStreamCompressMode=COMPRESSMODE_NONE;
+ nStreamNumberFormat=NUMBERFORMAT_INT_BIGENDIAN;
+ nDefaultTabulator=0;
+ pColorTable=NULL;
+ pDashList=NULL;
+ pLineEndList=NULL;
+ pHatchList=NULL;
+ pGradientList=NULL;
+ pBitmapList=NULL;
+ mpNumberFormatter = NULL;
+ bTransparentTextFrames=sal_False;
+ bStarDrawPreviewMode = sal_False;
+ nStarDrawPreviewMasterPageNum = SDRPAGE_NOTFOUND;
+ pModelStorage = NULL;
+ mpForbiddenCharactersTable = NULL;
+ mbModelLocked = sal_False;
+ mpOutlinerCache = NULL;
+ mbKernAsianPunctuation = sal_False;
+ mbAddExtLeading = sal_False;
+ mnHandoutPageCount = 0;
+
+ SvxAsianConfig aAsian;
+ mnCharCompressType = aAsian.GetCharDistanceCompression();
+
+#ifdef OSL_LITENDIAN
+ nStreamNumberFormat=NUMBERFORMAT_INT_LITTLEENDIAN;
+#endif
+ bExtColorTable=bUseExtColorTable;
+
+ if ( pPool == NULL )
+ {
+ pItemPool=new SdrItemPool(0L, bLoadRefCounts);
+ // Der Outliner hat keinen eigenen Pool, deshalb den der EditEngine
+ SfxItemPool* pOutlPool=EditEngine::CreatePool( bLoadRefCounts );
+ // OutlinerPool als SecondaryPool des SdrPool
+ pItemPool->SetSecondaryPool(pOutlPool);
+ // Merken, dass ich mir die beiden Pools selbst gemacht habe
+ bMyPool=sal_True;
+ }
+ pItemPool->SetDefaultMetric((SfxMapUnit)eObjUnit);
+
+// SJ: #95129# using static SdrEngineDefaults only if default SvxFontHeight item is not available
+ const SfxPoolItem* pPoolItem = pItemPool->GetPoolDefaultItem( EE_CHAR_FONTHEIGHT );
+ if ( pPoolItem )
+ nDefTextHgt = ((SvxFontHeightItem*)pPoolItem)->GetHeight();
+ else
+ nDefTextHgt = SdrEngineDefaults::GetFontHeight();
+
+ pItemPool->SetPoolDefaultItem( SdrTextWordWrapItem( sal_False ) );
+
+ SetTextDefaults();
+ pLayerAdmin=new SdrLayerAdmin;
+ pLayerAdmin->SetModel(this);
+ ImpSetUIUnit();
+
+ // den DrawOutliner OnDemand erzeugen geht noch nicht, weil ich den Pool
+ // sonst nicht kriege (erst ab 302!)
+ pDrawOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, this );
+ ImpSetOutlinerDefaults(pDrawOutliner, sal_True);
+
+ pHitTestOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, this );
+ ImpSetOutlinerDefaults(pHitTestOutliner, sal_True);
+
+ ImpCreateTables();
+}
+
+SdrModel::SdrModel(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, sal_Bool bLoadRefCounts):
+ maMaPag(1024,32,32),
+ maPages(1024,32,32)
+{
+#ifdef TIMELOG
+ RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "svx", "aw93748", "SdrModel::SdrModel(...)" );
+#endif
+
+ DBG_CTOR(SdrModel,NULL);
+ ImpCtor(pPool,pPers,sal_False, (FASTBOOL)bLoadRefCounts);
+}
+
+SdrModel::SdrModel(const String& rPath, SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, sal_Bool bLoadRefCounts):
+ maMaPag(1024,32,32),
+ maPages(1024,32,32),
+ aTablePath(rPath)
+{
+#ifdef TIMELOG
+ RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "svx", "aw93748", "SdrModel::SdrModel(...)" );
+#endif
+
+ DBG_CTOR(SdrModel,NULL);
+ ImpCtor(pPool,pPers,sal_False, (FASTBOOL)bLoadRefCounts);
+}
+
+SdrModel::SdrModel(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, FASTBOOL bUseExtColorTable, sal_Bool bLoadRefCounts):
+ maMaPag(1024,32,32),
+ maPages(1024,32,32)
+{
+#ifdef TIMELOG
+ RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "svx", "aw93748", "SdrModel::SdrModel(...)" );
+#endif
+
+ DBG_CTOR(SdrModel,NULL);
+ ImpCtor(pPool,pPers,bUseExtColorTable, (FASTBOOL)bLoadRefCounts);
+}
+
+SdrModel::SdrModel(const String& rPath, SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, FASTBOOL bUseExtColorTable, sal_Bool bLoadRefCounts):
+ maMaPag(1024,32,32),
+ maPages(1024,32,32),
+ aTablePath(rPath)
+{
+#ifdef TIMELOG
+ RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "svx", "aw93748", "SdrModel::SdrModel(...)" );
+#endif
+
+ DBG_CTOR(SdrModel,NULL);
+ ImpCtor(pPool,pPers,bUseExtColorTable, (FASTBOOL)bLoadRefCounts);
+}
+
+SdrModel::SdrModel(const SdrModel& /*rSrcModel*/):
+ SfxBroadcaster(),
+ tools::WeakBase< SdrModel >(),
+ maMaPag(1024,32,32),
+ maPages(1024,32,32)
+{
+#ifdef TIMELOG
+ RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "svx", "aw93748", "SdrModel::SdrModel(...)" );
+#endif
+
+ // noch nicht implementiert
+ DBG_ERROR("SdrModel::CopyCtor() ist noch nicht implementiert");
+}
+
+SdrModel::~SdrModel()
+{
+#ifdef TIMELOG
+ RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "svx", "aw93748", "SdrModel::~SdrModel(...)" );
+#endif
+
+ DBG_DTOR(SdrModel,NULL);
+
+ mbInDestruction = true;
+
+ Broadcast(SdrHint(HINT_MODELCLEARED));
+
+ delete mpOutlinerCache;
+
+ ClearUndoBuffer();
+#ifdef DBG_UTIL
+ if(pAktUndoGroup)
+ {
+ ByteString aStr("Im Dtor des SdrModel steht noch ein offenes Undo rum: \"");
+
+ aStr += ByteString(pAktUndoGroup->GetComment(), gsl_getSystemTextEncoding());
+ aStr += '\"';
+
+ DBG_ERROR(aStr.GetBuffer());
+ }
+#endif
+ if (pAktUndoGroup!=NULL)
+ delete pAktUndoGroup;
+
+ // #116168#
+ ClearModel(sal_True);
+
+ delete pLayerAdmin;
+
+ // Den DrawOutliner erst nach dem ItemPool loeschen, da
+ // der ItemPool Items des DrawOutliners referenziert !!! (<- das war mal)
+ // Wg. Problem bei Malte Reihenfolge wieder umgestellt.
+ // Loeschen des Outliners vor dem loeschen des ItemPools
+ delete pHitTestOutliner;
+ delete pDrawOutliner;
+
+ // delete StyleSheetPool, derived classes should not do this since
+ // the DrawingEngine may need it in its destrctor (SB)
+ if( mxStyleSheetPool.is() )
+ {
+ Reference< XComponent > xComponent( dynamic_cast< cppu::OWeakObject* >( mxStyleSheetPool.get() ), UNO_QUERY );
+ if( xComponent.is() ) try
+ {
+ xComponent->dispose();
+ }
+ catch( RuntimeException& )
+ {
+ }
+ mxStyleSheetPool.clear();
+ }
+
+ if (bMyPool)
+ {
+ // Pools loeschen, falls es meine sind
+ SfxItemPool* pOutlPool=pItemPool->GetSecondaryPool();
+ SfxItemPool::Free(pItemPool);
+ // Der OutlinerPool muss nach dem ItemPool plattgemacht werden, da der
+ // ItemPool SetItems enthaelt die ihrerseits Items des OutlinerPools
+ // referenzieren (Joe)
+ SfxItemPool::Free(pOutlPool);
+ }
+
+ if( mpForbiddenCharactersTable )
+ mpForbiddenCharactersTable->release();
+
+ // Tabellen, Listen und Paletten loeschen
+ if (!bExtColorTable)
+ delete pColorTable;
+ delete pDashList;
+ delete pLineEndList;
+ delete pHatchList;
+ delete pGradientList;
+ delete pBitmapList;
+
+ if(mpNumberFormatter)
+ delete mpNumberFormatter;
+
+ delete mpImpl->mpUndoFactory;
+ delete mpImpl;
+}
+
+bool SdrModel::IsInDestruction() const
+{
+ return mbInDestruction;
+}
+
+const SvNumberFormatter& SdrModel::GetNumberFormatter() const
+{
+ if(!mpNumberFormatter)
+ {
+ // use cast here since from outside view this IS a const method
+ ((SdrModel*)this)->mpNumberFormatter = new SvNumberFormatter(
+ ::comphelper::getProcessServiceFactory(), LANGUAGE_SYSTEM);
+ }
+
+ return *mpNumberFormatter;
+}
+
+// noch nicht implementiert:
+void SdrModel::operator=(const SdrModel& /*rSrcModel*/)
+{
+ DBG_ERROR("SdrModel::operator=() ist noch nicht implementiert");
+}
+
+FASTBOOL SdrModel::operator==(const SdrModel& /*rCmpModel*/) const
+{
+ DBG_ERROR("SdrModel::operator==() ist noch nicht implementiert");
+ return sal_False;
+}
+
+void SdrModel::SetSwapGraphics( FASTBOOL bSwap )
+{
+ bSwapGraphics = bSwap;
+}
+
+FASTBOOL SdrModel::IsReadOnly() const
+{
+ return bReadOnly;
+}
+
+void SdrModel::SetReadOnly(FASTBOOL bYes)
+{
+ bReadOnly=bYes;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrModel::SetMaxUndoActionCount(sal_uIntPtr nAnz)
+{
+ if (nAnz<1) nAnz=1;
+ nMaxUndoCount=nAnz;
+ if (pUndoStack!=NULL) {
+ while (pUndoStack->Count()>nMaxUndoCount) {
+ delete (SfxUndoAction*) pUndoStack->Remove(pUndoStack->Count());
+ }
+ }
+}
+
+void SdrModel::ClearUndoBuffer()
+{
+ if (pUndoStack!=NULL) {
+ while (pUndoStack->Count()!=0) {
+ delete (SfxUndoAction*) pUndoStack->Remove(pUndoStack->Count()-1);
+ }
+ delete pUndoStack;
+ pUndoStack=NULL;
+ }
+ if (pRedoStack!=NULL) {
+ while (pRedoStack->Count()!=0) {
+ delete (SfxUndoAction*) pRedoStack->Remove(pRedoStack->Count()-1);
+ }
+ delete pRedoStack;
+ pRedoStack=NULL;
+ }
+}
+
+FASTBOOL SdrModel::Undo()
+{
+ FASTBOOL bRet=sal_False;
+ if( mpImpl->mpUndoManager )
+ {
+ DBG_ERROR("svx::SdrModel::Undo(), method not supported with application undo manager!");
+ }
+ else
+ {
+ SfxUndoAction* pDo=(SfxUndoAction*)GetUndoAction(0);
+ if(pDo!=NULL)
+ {
+ const bool bWasUndoEnabled = mbUndoEnabled;
+ mbUndoEnabled = false;
+ pDo->Undo();
+ if(pRedoStack==NULL)
+ pRedoStack=new Container(1024,16,16);
+ pRedoStack->Insert(pUndoStack->Remove((sal_uIntPtr)0),(sal_uIntPtr)0);
+ mbUndoEnabled = bWasUndoEnabled;
+ }
+ }
+ return bRet;
+}
+
+FASTBOOL SdrModel::Redo()
+{
+ FASTBOOL bRet=sal_False;
+ if( mpImpl->mpUndoManager )
+ {
+ DBG_ERROR("svx::SdrModel::Redo(), method not supported with application undo manager!");
+ }
+ else
+ {
+ SfxUndoAction* pDo=(SfxUndoAction*)GetRedoAction(0);
+ if(pDo!=NULL)
+ {
+ const bool bWasUndoEnabled = mbUndoEnabled;
+ mbUndoEnabled = false;
+ pDo->Redo();
+ if(pUndoStack==NULL)
+ pUndoStack=new Container(1024,16,16);
+ pUndoStack->Insert(pRedoStack->Remove((sal_uIntPtr)0),(sal_uIntPtr)0);
+ mbUndoEnabled = bWasUndoEnabled;
+ }
+ }
+ return bRet;
+}
+
+FASTBOOL SdrModel::Repeat(SfxRepeatTarget& rView)
+{
+ FASTBOOL bRet=sal_False;
+ if( mpImpl->mpUndoManager )
+ {
+ DBG_ERROR("svx::SdrModel::Redo(), method not supported with application undo manager!");
+ }
+ else
+ {
+ SfxUndoAction* pDo=(SfxUndoAction*)GetUndoAction(0);
+ if(pDo!=NULL)
+ {
+ if(pDo->CanRepeat(rView))
+ {
+ pDo->Repeat(rView);
+ bRet=sal_True;
+ }
+ }
+ }
+ return bRet;
+}
+
+void SdrModel::ImpPostUndoAction(SdrUndoAction* pUndo)
+{
+ DBG_ASSERT( mpImpl->mpUndoManager == 0, "svx::SdrModel::ImpPostUndoAction(), method not supported with application undo manager!" );
+ if( IsUndoEnabled() )
+ {
+ if (aUndoLink.IsSet())
+ {
+ aUndoLink.Call(pUndo);
+ }
+ else
+ {
+ if (pUndoStack==NULL)
+ pUndoStack=new Container(1024,16,16);
+ pUndoStack->Insert(pUndo,(sal_uIntPtr)0);
+ while (pUndoStack->Count()>nMaxUndoCount)
+ {
+ delete (SfxUndoAction*)pUndoStack->Remove(pUndoStack->Count()-1);
+ }
+ if (pRedoStack!=NULL)
+ pRedoStack->Clear();
+ }
+ }
+ else
+ {
+ delete pUndo;
+ }
+}
+
+void SdrModel::BegUndo()
+{
+ if( mpImpl->mpUndoManager )
+ {
+ const String aEmpty;
+ mpImpl->mpUndoManager->EnterListAction(aEmpty,aEmpty);
+ nUndoLevel++;
+ }
+ else if( IsUndoEnabled() )
+ {
+ if(pAktUndoGroup==NULL)
+ {
+ pAktUndoGroup = new SdrUndoGroup(*this);
+ nUndoLevel=1;
+ }
+ else
+ {
+ nUndoLevel++;
+ }
+ }
+}
+
+void SdrModel::BegUndo(const XubString& rComment)
+{
+ if( mpImpl->mpUndoManager )
+ {
+ const String aEmpty;
+ mpImpl->mpUndoManager->EnterListAction( rComment, aEmpty );
+ nUndoLevel++;
+ }
+ else if( IsUndoEnabled() )
+ {
+ BegUndo();
+ if (nUndoLevel==1)
+ {
+ pAktUndoGroup->SetComment(rComment);
+ }
+ }
+}
+
+void SdrModel::BegUndo(const XubString& rComment, const XubString& rObjDescr, SdrRepeatFunc eFunc)
+{
+ if( mpImpl->mpUndoManager )
+ {
+ String aComment(rComment);
+ if( aComment.Len() && rObjDescr.Len() )
+ {
+ String aSearchString(RTL_CONSTASCII_USTRINGPARAM("%1"));
+ aComment.SearchAndReplace(aSearchString, rObjDescr);
+ }
+ const String aEmpty;
+ mpImpl->mpUndoManager->EnterListAction( aComment,aEmpty );
+ nUndoLevel++;
+ }
+ else if( IsUndoEnabled() )
+ {
+ BegUndo();
+ if (nUndoLevel==1)
+ {
+ pAktUndoGroup->SetComment(rComment);
+ pAktUndoGroup->SetObjDescription(rObjDescr);
+ pAktUndoGroup->SetRepeatFunction(eFunc);
+ }
+ }
+}
+
+void SdrModel::BegUndo(SdrUndoGroup* pUndoGrp)
+{
+ if( mpImpl->mpUndoManager )
+ {
+ DBG_ERROR("svx::SdrModel::BegUndo(), method not supported with application undo manager!" );
+ nUndoLevel++;
+ }
+ else if( IsUndoEnabled() )
+ {
+ if (pAktUndoGroup==NULL)
+ {
+ pAktUndoGroup=pUndoGrp;
+ nUndoLevel=1;
+ }
+ else
+ {
+ delete pUndoGrp;
+ nUndoLevel++;
+ }
+ }
+ else
+ {
+ delete pUndoGrp;
+ }
+}
+
+void SdrModel::EndUndo()
+{
+ DBG_ASSERT(nUndoLevel!=0,"SdrModel::EndUndo(): UndoLevel is already 0!");
+ if( mpImpl->mpUndoManager )
+ {
+ if( nUndoLevel )
+ {
+ nUndoLevel--;
+ mpImpl->mpUndoManager->LeaveListAction();
+ }
+ }
+ else
+ {
+ if(pAktUndoGroup!=NULL && IsUndoEnabled())
+ {
+ nUndoLevel--;
+ if(nUndoLevel==0)
+ {
+ if(pAktUndoGroup->GetActionCount()!=0)
+ {
+ SdrUndoAction* pUndo=pAktUndoGroup;
+ pAktUndoGroup=NULL;
+ ImpPostUndoAction(pUndo);
+ }
+ else
+ {
+ // was empty
+ delete pAktUndoGroup;
+ pAktUndoGroup=NULL;
+ }
+ }
+ }
+ }
+}
+
+void SdrModel::SetUndoComment(const XubString& rComment)
+{
+ DBG_ASSERT(nUndoLevel!=0,"SdrModel::SetUndoComment(): UndoLevel is on level 0!");
+
+ if( mpImpl->mpUndoManager )
+ {
+ DBG_ERROR("svx::SdrModel::SetUndoComment(), method not supported with application undo manager!" );
+ }
+ else if( IsUndoEnabled() )
+ {
+ if(nUndoLevel==1)
+ {
+ pAktUndoGroup->SetComment(rComment);
+ }
+ }
+}
+
+void SdrModel::SetUndoComment(const XubString& rComment, const XubString& rObjDescr)
+{
+ DBG_ASSERT(nUndoLevel!=0,"SdrModel::SetUndoComment(): UndoLevel is 0!");
+ if( mpImpl->mpUndoManager )
+ {
+ DBG_ERROR("svx::SdrModel::SetUndoComment(), method not supported with application undo manager!" );
+ }
+ else
+ {
+ if (nUndoLevel==1)
+ {
+ pAktUndoGroup->SetComment(rComment);
+ pAktUndoGroup->SetObjDescription(rObjDescr);
+ }
+ }
+}
+
+void SdrModel::AddUndo(SdrUndoAction* pUndo)
+{
+ if( mpImpl->mpUndoManager )
+ {
+ mpImpl->mpUndoManager->AddUndoAction( pUndo );
+ }
+ else if( !IsUndoEnabled() )
+ {
+ delete pUndo;
+ }
+ else
+ {
+ if (pAktUndoGroup!=NULL)
+ {
+ pAktUndoGroup->AddAction(pUndo);
+ }
+ else
+ {
+ ImpPostUndoAction(pUndo);
+ }
+ }
+}
+
+void SdrModel::EnableUndo( bool bEnable )
+{
+ if( mpImpl->mpUndoManager )
+ {
+ mpImpl->mpUndoManager->EnableUndo( bEnable );
+ }
+ else
+ {
+ mbUndoEnabled = bEnable;
+ }
+}
+
+bool SdrModel::IsUndoEnabled() const
+{
+ if( mpImpl->mpUndoManager )
+ {
+ return mpImpl->mpUndoManager->IsUndoEnabled();
+ }
+ else
+ {
+ return mbUndoEnabled;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrModel::ImpCreateTables()
+{
+ // der Writer hat seinen eigenen ColorTable
+ if (!bExtColorTable) pColorTable=new XColorTable(aTablePath,(XOutdevItemPool*)pItemPool);
+ pDashList =new XDashList (aTablePath,(XOutdevItemPool*)pItemPool);
+ pLineEndList =new XLineEndList (aTablePath,(XOutdevItemPool*)pItemPool);
+ pHatchList =new XHatchList (aTablePath,(XOutdevItemPool*)pItemPool);
+ pGradientList=new XGradientList(aTablePath,(XOutdevItemPool*)pItemPool);
+ pBitmapList =new XBitmapList (aTablePath,(XOutdevItemPool*)pItemPool);
+}
+
+// #116168#
+void SdrModel::ClearModel(sal_Bool bCalledFromDestructor)
+{
+ if(bCalledFromDestructor)
+ {
+ mbInDestruction = true;
+ }
+
+ sal_Int32 i;
+ // delete all drawing pages
+ sal_Int32 nAnz=GetPageCount();
+ for (i=nAnz-1; i>=0; i--)
+ {
+ DeletePage( (sal_uInt16)i );
+ }
+ maPages.Clear();
+ // #109538#
+ PageListChanged();
+
+ // delete all Masterpages
+ nAnz=GetMasterPageCount();
+ for(i=nAnz-1; i>=0; i--)
+ {
+ DeleteMasterPage( (sal_uInt16)i );
+ }
+ maMaPag.Clear();
+ // #109538#
+ MasterPageListChanged();
+
+ pLayerAdmin->ClearLayer();
+}
+
+SdrModel* SdrModel::AllocModel() const
+{
+ SdrModel* pModel=new SdrModel;
+ pModel->SetScaleUnit(eObjUnit,aObjUnit);
+ return pModel;
+}
+
+SdrPage* SdrModel::AllocPage(FASTBOOL bMasterPage)
+{
+ return new SdrPage(*this,bMasterPage);
+}
+
+void SdrModel::SetTextDefaults() const
+{
+ SetTextDefaults( pItemPool, nDefTextHgt );
+}
+
+void ImpGetDefaultFontsLanguage( SvxFontItem& rLatin, SvxFontItem& rAsian, SvxFontItem& rComplex)
+{
+ const sal_uInt16 nItemCnt = 3;
+ static struct {
+ sal_uInt16 nFntType, nLanguage;
+ } aOutTypeArr[ nItemCnt ] = {
+ { DEFAULTFONT_LATIN_TEXT, LANGUAGE_ENGLISH_US },
+ { DEFAULTFONT_CJK_TEXT, LANGUAGE_ENGLISH_US },
+ { DEFAULTFONT_CTL_TEXT, LANGUAGE_ARABIC_SAUDI_ARABIA }
+ };
+ SvxFontItem* aItemArr[ nItemCnt ] = { &rLatin, &rAsian, &rComplex };
+
+ for( sal_uInt16 n = 0; n < nItemCnt; ++n )
+ {
+ Font aFnt( OutputDevice::GetDefaultFont(
+ aOutTypeArr[ n ].nFntType, aOutTypeArr[ n ].nLanguage,
+ DEFAULTFONT_FLAGS_ONLYONE, 0 ));
+ SvxFontItem* pI = aItemArr[ n ];
+ pI->GetFamily() = aFnt.GetFamily();
+ pI->GetFamilyName() = aFnt.GetName();
+ pI->GetStyleName().Erase();
+ pI->GetPitch() = aFnt.GetPitch();
+ pI->GetCharSet() = aFnt.GetCharSet();
+ }
+}
+
+void SdrModel::SetTextDefaults( SfxItemPool* pItemPool, sal_uIntPtr nDefTextHgt )
+{
+ // #95114# set application-language specific dynamic pool language defaults
+ SvxFontItem aSvxFontItem( EE_CHAR_FONTINFO) ;
+ SvxFontItem aSvxFontItemCJK(EE_CHAR_FONTINFO_CJK);
+ SvxFontItem aSvxFontItemCTL(EE_CHAR_FONTINFO_CTL);
+ sal_uInt16 nLanguage(Application::GetSettings().GetLanguage());
+
+ // get DEFAULTFONT_LATIN_TEXT and set at pool as dynamic default
+ Font aFont(OutputDevice::GetDefaultFont(DEFAULTFONT_LATIN_TEXT, nLanguage, DEFAULTFONT_FLAGS_ONLYONE, 0));
+ aSvxFontItem.GetFamily() = aFont.GetFamily();
+ aSvxFontItem.GetFamilyName() = aFont.GetName();
+ aSvxFontItem.GetStyleName().Erase();
+ aSvxFontItem.GetPitch() = aFont.GetPitch();
+ aSvxFontItem.GetCharSet() = aFont.GetCharSet();
+ pItemPool->SetPoolDefaultItem(aSvxFontItem);
+
+ // get DEFAULTFONT_CJK_TEXT and set at pool as dynamic default
+ Font aFontCJK(OutputDevice::GetDefaultFont(DEFAULTFONT_CJK_TEXT, nLanguage, DEFAULTFONT_FLAGS_ONLYONE, 0));
+ aSvxFontItemCJK.GetFamily() = aFontCJK.GetFamily();
+ aSvxFontItemCJK.GetFamilyName() = aFontCJK.GetName();
+ aSvxFontItemCJK.GetStyleName().Erase();
+ aSvxFontItemCJK.GetPitch() = aFontCJK.GetPitch();
+ aSvxFontItemCJK.GetCharSet() = aFontCJK.GetCharSet();
+ pItemPool->SetPoolDefaultItem(aSvxFontItemCJK);
+
+ // get DEFAULTFONT_CTL_TEXT and set at pool as dynamic default
+ Font aFontCTL(OutputDevice::GetDefaultFont(DEFAULTFONT_CTL_TEXT, nLanguage, DEFAULTFONT_FLAGS_ONLYONE, 0));
+ aSvxFontItemCTL.GetFamily() = aFontCTL.GetFamily();
+ aSvxFontItemCTL.GetFamilyName() = aFontCTL.GetName();
+ aSvxFontItemCTL.GetStyleName().Erase();
+ aSvxFontItemCTL.GetPitch() = aFontCTL.GetPitch();
+ aSvxFontItemCTL.GetCharSet() = aFontCTL.GetCharSet();
+ pItemPool->SetPoolDefaultItem(aSvxFontItemCTL);
+
+ // set dynamic FontHeight defaults
+ pItemPool->SetPoolDefaultItem( SvxFontHeightItem(nDefTextHgt, 100, EE_CHAR_FONTHEIGHT ) );
+ pItemPool->SetPoolDefaultItem( SvxFontHeightItem(nDefTextHgt, 100, EE_CHAR_FONTHEIGHT_CJK ) );
+ pItemPool->SetPoolDefaultItem( SvxFontHeightItem(nDefTextHgt, 100, EE_CHAR_FONTHEIGHT_CTL ) );
+
+ // set FontColor defaults
+ pItemPool->SetPoolDefaultItem( SvxColorItem(SdrEngineDefaults::GetFontColor(), EE_CHAR_COLOR) );
+}
+
+SdrOutliner& SdrModel::GetDrawOutliner(const SdrTextObj* pObj) const
+{
+ pDrawOutliner->SetTextObj(pObj);
+ return *pDrawOutliner;
+}
+
+boost::shared_ptr< SdrOutliner > SdrModel::CreateDrawOutliner(const SdrTextObj* pObj)
+{
+ boost::shared_ptr< SdrOutliner > xDrawOutliner( SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, this ) );
+ ImpSetOutlinerDefaults(xDrawOutliner.get(), sal_True);
+ xDrawOutliner->SetTextObj(pObj);
+ return xDrawOutliner;
+}
+
+const SdrTextObj* SdrModel::GetFormattingTextObj() const
+{
+ if (pDrawOutliner!=NULL) {
+ return pDrawOutliner->GetTextObj();
+ }
+ return NULL;
+}
+
+void SdrModel::ImpSetOutlinerDefaults( SdrOutliner* pOutliner, sal_Bool bInit )
+{
+ /**************************************************************************
+ * Initialisierung der Outliner fuer Textausgabe und HitTest
+ **************************************************************************/
+ if( bInit )
+ {
+ pOutliner->EraseVirtualDevice();
+ pOutliner->SetUpdateMode(sal_False);
+ pOutliner->SetEditTextObjectPool(pItemPool);
+ pOutliner->SetDefTab(nDefaultTabulator);
+ }
+
+ pOutliner->SetRefDevice(GetRefDevice());
+ pOutliner->SetForbiddenCharsTable(GetForbiddenCharsTable());
+ pOutliner->SetAsianCompressionMode( mnCharCompressType );
+ pOutliner->SetKernAsianPunctuation( IsKernAsianPunctuation() );
+ pOutliner->SetAddExtLeading( IsAddExtLeading() );
+
+ if ( !GetRefDevice() )
+ {
+ MapMode aMapMode(eObjUnit, Point(0,0), aObjUnit, aObjUnit);
+ pOutliner->SetRefMapMode(aMapMode);
+ }
+}
+
+void SdrModel::SetRefDevice(OutputDevice* pDev)
+{
+ pRefOutDev=pDev;
+ ImpSetOutlinerDefaults( pDrawOutliner );
+ ImpSetOutlinerDefaults( pHitTestOutliner );
+ RefDeviceChanged();
+}
+
+void SdrModel::ImpReformatAllTextObjects()
+{
+ if( isLocked() )
+ return;
+
+ sal_uInt16 nAnz=GetMasterPageCount();
+ sal_uInt16 nNum;
+ for (nNum=0; nNum<nAnz; nNum++) {
+ GetMasterPage(nNum)->ReformatAllTextObjects();
+ }
+ nAnz=GetPageCount();
+ for (nNum=0; nNum<nAnz; nNum++) {
+ GetPage(nNum)->ReformatAllTextObjects();
+ }
+}
+
+/** #103122#
+ steps over all available pages and sends notify messages to
+ all edge objects that are connected to other objects so that
+ they may reposition itselfs
+*/
+void SdrModel::ImpReformatAllEdgeObjects()
+{
+ if( isLocked() )
+ return;
+
+ sal_uInt16 nAnz=GetMasterPageCount();
+ sal_uInt16 nNum;
+ for (nNum=0; nNum<nAnz; nNum++)
+ {
+ GetMasterPage(nNum)->ReformatAllEdgeObjects();
+ }
+ nAnz=GetPageCount();
+ for (nNum=0; nNum<nAnz; nNum++)
+ {
+ GetPage(nNum)->ReformatAllEdgeObjects();
+ }
+}
+
+SvStream* SdrModel::GetDocumentStream(SdrDocumentStreamInfo& /*rStreamInfo*/) const
+{
+ return NULL;
+}
+
+// Die Vorlagenattribute der Zeichenobjekte in harte Attribute verwandeln.
+void SdrModel::BurnInStyleSheetAttributes()
+{
+ sal_uInt16 nAnz=GetMasterPageCount();
+ sal_uInt16 nNum;
+ for (nNum=0; nNum<nAnz; nNum++) {
+ GetMasterPage(nNum)->BurnInStyleSheetAttributes();
+ }
+ nAnz=GetPageCount();
+ for (nNum=0; nNum<nAnz; nNum++) {
+ GetPage(nNum)->BurnInStyleSheetAttributes();
+ }
+}
+
+void SdrModel::RefDeviceChanged()
+{
+ Broadcast(SdrHint(HINT_REFDEVICECHG));
+ ImpReformatAllTextObjects();
+}
+
+void SdrModel::SetDefaultFontHeight(sal_uIntPtr nVal)
+{
+ if (nVal!=nDefTextHgt) {
+ nDefTextHgt=nVal;
+ Broadcast(SdrHint(HINT_DEFFONTHGTCHG));
+ ImpReformatAllTextObjects();
+ }
+}
+
+void SdrModel::SetDefaultTabulator(sal_uInt16 nVal)
+{
+ if (nDefaultTabulator!=nVal) {
+ nDefaultTabulator=nVal;
+ Outliner& rOutliner=GetDrawOutliner();
+ rOutliner.SetDefTab(nVal);
+ Broadcast(SdrHint(HINT_DEFAULTTABCHG));
+ ImpReformatAllTextObjects();
+ }
+}
+
+void SdrModel::ImpSetUIUnit()
+{
+ if(0 == aUIScale.GetNumerator() || 0 == aUIScale.GetDenominator())
+ {
+ aUIScale = Fraction(1,1);
+ }
+
+ // set start values
+ nUIUnitKomma = 0;
+ sal_Int64 nMul(1);
+ sal_Int64 nDiv(1);
+
+ // normalize on meters resp. inch
+ switch (eObjUnit)
+ {
+ case MAP_100TH_MM : nUIUnitKomma+=5; break;
+ case MAP_10TH_MM : nUIUnitKomma+=4; break;
+ case MAP_MM : nUIUnitKomma+=3; break;
+ case MAP_CM : nUIUnitKomma+=2; break;
+ case MAP_1000TH_INCH: nUIUnitKomma+=3; break;
+ case MAP_100TH_INCH : nUIUnitKomma+=2; break;
+ case MAP_10TH_INCH : nUIUnitKomma+=1; break;
+ case MAP_INCH : nUIUnitKomma+=0; break;
+ case MAP_POINT : nDiv=72; break; // 1Pt = 1/72"
+ case MAP_TWIP : nDiv=144; nUIUnitKomma++; break; // 1Twip = 1/1440"
+ case MAP_PIXEL : break;
+ case MAP_SYSFONT : break;
+ case MAP_APPFONT : break;
+ case MAP_RELATIVE : break;
+ default: break;
+ } // switch
+
+ // 1 mile = 8 furlong = 63.360" = 1.609.344,0mm
+ // 1 furlong = 10 chains = 7.920" = 201.168,0mm
+ // 1 chain = 4 poles = 792" = 20.116,8mm
+ // 1 pole = 5 1/2 yd = 198" = 5.029,2mm
+ // 1 yd = 3 ft = 36" = 914,4mm
+ // 1 ft = 12 " = 1" = 304,8mm
+ switch (eUIUnit)
+ {
+ case FUNIT_NONE : break;
+ // Metrisch
+ case FUNIT_100TH_MM: nUIUnitKomma-=5; break;
+ case FUNIT_MM : nUIUnitKomma-=3; break;
+ case FUNIT_CM : nUIUnitKomma-=2; break;
+ case FUNIT_M : nUIUnitKomma+=0; break;
+ case FUNIT_KM : nUIUnitKomma+=3; break;
+ // Inch
+ case FUNIT_TWIP : nMul=144; nUIUnitKomma--; break; // 1Twip = 1/1440"
+ case FUNIT_POINT : nMul=72; break; // 1Pt = 1/72"
+ case FUNIT_PICA : nMul=6; break; // 1Pica = 1/6" ?
+ case FUNIT_INCH : break; // 1" = 1"
+ case FUNIT_FOOT : nDiv*=12; break; // 1Ft = 12"
+ case FUNIT_MILE : nDiv*=6336; nUIUnitKomma++; break; // 1mile = 63360"
+ // sonstiges
+ case FUNIT_CUSTOM : break;
+ case FUNIT_PERCENT: nUIUnitKomma+=2; break;
+ } // switch
+
+ // check if mapping is from metric to inch and adapt
+ const bool bMapInch(IsInch(eObjUnit));
+ const bool bUIMetr(IsMetric(eUIUnit));
+
+ if (bMapInch && bUIMetr)
+ {
+ nUIUnitKomma += 4;
+ nMul *= 254;
+ }
+
+ // check if mapping is from inch to metric and adapt
+ const bool bMapMetr(IsMetric(eObjUnit));
+ const bool bUIInch(IsInch(eUIUnit));
+
+ if (bMapMetr && bUIInch)
+ {
+ nUIUnitKomma -= 4;
+ nDiv *= 254;
+ }
+
+ // use temporary fraction for reduction (fallback to 32bit here),
+ // may need to be changed in the future, too
+ if(1 != nMul || 1 != nDiv)
+ {
+ const Fraction aTemp(static_cast< long >(nMul), static_cast< long >(nDiv));
+ nMul = aTemp.GetNumerator();
+ nDiv = aTemp.GetDenominator();
+ }
+
+ // #i89872# take Unit of Measurement into account
+ if(1 != aUIScale.GetDenominator() || 1 != aUIScale.GetNumerator())
+ {
+ // divide by UIScale
+ nMul *= aUIScale.GetDenominator();
+ nDiv *= aUIScale.GetNumerator();
+ }
+
+ // shorten trailing zeroes for dividend
+ while(0 == (nMul % 10))
+ {
+ nUIUnitKomma--;
+ nMul /= 10;
+ }
+
+ // shorten trailing zeroes for divisor
+ while(0 == (nDiv % 10))
+ {
+ nUIUnitKomma++;
+ nDiv /= 10;
+ }
+
+ // end preparations, set member values
+ aUIUnitFact = Fraction(sal_Int32(nMul), sal_Int32(nDiv));
+ bUIOnlyKomma = (nMul == nDiv);
+ TakeUnitStr(eUIUnit, aUIUnitStr);
+}
+
+void SdrModel::SetScaleUnit(MapUnit eMap, const Fraction& rFrac)
+{
+ if (eObjUnit!=eMap || aObjUnit!=rFrac) {
+ eObjUnit=eMap;
+ aObjUnit=rFrac;
+ pItemPool->SetDefaultMetric((SfxMapUnit)eObjUnit);
+ ImpSetUIUnit();
+ ImpSetOutlinerDefaults( pDrawOutliner );
+ ImpSetOutlinerDefaults( pHitTestOutliner );
+ ImpReformatAllTextObjects(); // #40424#
+ }
+}
+
+void SdrModel::SetScaleUnit(MapUnit eMap)
+{
+ if (eObjUnit!=eMap) {
+ eObjUnit=eMap;
+ pItemPool->SetDefaultMetric((SfxMapUnit)eObjUnit);
+ ImpSetUIUnit();
+ ImpSetOutlinerDefaults( pDrawOutliner );
+ ImpSetOutlinerDefaults( pHitTestOutliner );
+ ImpReformatAllTextObjects(); // #40424#
+ }
+}
+
+void SdrModel::SetScaleFraction(const Fraction& rFrac)
+{
+ if (aObjUnit!=rFrac) {
+ aObjUnit=rFrac;
+ ImpSetUIUnit();
+ ImpSetOutlinerDefaults( pDrawOutliner );
+ ImpSetOutlinerDefaults( pHitTestOutliner );
+ ImpReformatAllTextObjects(); // #40424#
+ }
+}
+
+void SdrModel::SetUIUnit(FieldUnit eUnit)
+{
+ if (eUIUnit!=eUnit) {
+ eUIUnit=eUnit;
+ ImpSetUIUnit();
+ ImpReformatAllTextObjects(); // #40424#
+ }
+}
+
+void SdrModel::SetUIScale(const Fraction& rScale)
+{
+ if (aUIScale!=rScale) {
+ aUIScale=rScale;
+ ImpSetUIUnit();
+ ImpReformatAllTextObjects(); // #40424#
+ }
+}
+
+void SdrModel::SetUIUnit(FieldUnit eUnit, const Fraction& rScale)
+{
+ if (eUIUnit!=eUnit || aUIScale!=rScale) {
+ eUIUnit=eUnit;
+ aUIScale=rScale;
+ ImpSetUIUnit();
+ ImpReformatAllTextObjects(); // #40424#
+ }
+}
+
+void SdrModel::TakeUnitStr(FieldUnit eUnit, XubString& rStr)
+{
+ switch(eUnit)
+ {
+ default:
+ case FUNIT_NONE :
+ case FUNIT_CUSTOM :
+ {
+ rStr = String();
+ break;
+ }
+ case FUNIT_100TH_MM:
+ {
+ sal_Char aText[] = "/100mm";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+ case FUNIT_MM :
+ {
+ sal_Char aText[] = "mm";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+ case FUNIT_CM :
+ {
+ sal_Char aText[] = "cm";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+ case FUNIT_M :
+ {
+ rStr = String();
+ rStr += sal_Unicode('m');
+ break;
+ }
+ case FUNIT_KM :
+ {
+ sal_Char aText[] = "km";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+ case FUNIT_TWIP :
+ {
+ sal_Char aText[] = "twip";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+ case FUNIT_POINT :
+ {
+ sal_Char aText[] = "pt";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+ case FUNIT_PICA :
+ {
+ sal_Char aText[] = "pica";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+ case FUNIT_INCH :
+ {
+ rStr = String();
+ rStr += sal_Unicode('"');
+ break;
+ }
+ case FUNIT_FOOT :
+ {
+ sal_Char aText[] = "ft";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+ case FUNIT_MILE :
+ {
+ sal_Char aText[] = "mile(s)";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+ case FUNIT_PERCENT:
+ {
+ rStr = String();
+ rStr += sal_Unicode('%');
+ break;
+ }
+ }
+}
+
+void SdrModel::TakeMetricStr(long nVal, XubString& rStr, FASTBOOL bNoUnitChars, sal_Int32 nNumDigits) const
+{
+ // #i22167#
+ // change to double precision usage to not loose decimal places after comma
+ const bool bNegative(nVal < 0L);
+ SvtSysLocale aSysLoc;
+ const LocaleDataWrapper& rLoc(aSysLoc.GetLocaleData());
+ double fLocalValue(double(nVal) * double(aUIUnitFact));
+
+ if(bNegative)
+ {
+ fLocalValue = -fLocalValue;
+ }
+
+ if( -1 == nNumDigits )
+ {
+ nNumDigits = rLoc.getNumDigits();
+ }
+
+ sal_Int32 nKomma(nUIUnitKomma);
+
+ if(nKomma > nNumDigits)
+ {
+ const sal_Int32 nDiff(nKomma - nNumDigits);
+ const double fFactor(pow(10.0, static_cast<const int>(nDiff)));
+
+ fLocalValue /= fFactor;
+ nKomma = nNumDigits;
+ }
+ else if(nKomma < nNumDigits)
+ {
+ const sal_Int32 nDiff(nNumDigits - nKomma);
+ const double fFactor(pow(10.0, static_cast<const int>(nDiff)));
+
+ fLocalValue *= fFactor;
+ nKomma = nNumDigits;
+ }
+
+ rStr = UniString::CreateFromInt32(static_cast<sal_Int32>(fLocalValue + 0.5));
+
+ if(nKomma < 0)
+ {
+ // Negatives Komma bedeutet: Nullen dran
+ sal_Int32 nAnz(-nKomma);
+
+ for(sal_Int32 i=0; i<nAnz; i++)
+ rStr += sal_Unicode('0');
+
+ nKomma = 0;
+ }
+
+ // #83257# the second condition needs to be <= since inside this loop
+ // also the leading zero is inserted.
+ if(nKomma > 0 && rStr.Len() <= nKomma)
+ {
+ // Fuer Komma evtl. vorne Nullen dran
+ sal_Int32 nAnz(nKomma - rStr.Len());
+
+ if(nAnz >= 0 && rLoc.isNumLeadingZero())
+ nAnz++;
+
+ for(sal_Int32 i=0; i<nAnz; i++)
+ rStr.Insert(sal_Unicode('0'), 0);
+ }
+
+ sal_Unicode cDec( rLoc.getNumDecimalSep().GetChar(0) );
+
+ // KommaChar einfuegen
+ sal_Int32 nVorKomma(rStr.Len() - nKomma);
+
+ if(nKomma > 0)
+ rStr.Insert(cDec, (xub_StrLen) nVorKomma);
+
+ if(!rLoc.isNumTrailingZeros())
+ {
+ while(rStr.Len() && rStr.GetChar(rStr.Len() - 1) == sal_Unicode('0'))
+ rStr.Erase(rStr.Len() - 1);
+
+ if(rStr.Len() && rStr.GetChar(rStr.Len() - 1) == cDec)
+ rStr.Erase(rStr.Len() - 1);
+ }
+
+ // ggf. Trennpunkte bei jedem Tausender einfuegen
+ if( nVorKomma > 3 )
+ {
+ String aThoSep( rLoc.getNumThousandSep() );
+ if ( aThoSep.Len() > 0 )
+ {
+ sal_Unicode cTho( aThoSep.GetChar(0) );
+ sal_Int32 i(nVorKomma - 3);
+
+ while(i > 0) // #78311#
+ {
+ rStr.Insert(cTho, (xub_StrLen)i);
+ i -= 3;
+ }
+ }
+ }
+
+ if(!rStr.Len())
+ {
+ rStr = String();
+ rStr += sal_Unicode('0');
+ }
+
+ if(bNegative)
+ {
+ rStr.Insert(sal_Unicode('-'), 0);
+ }
+
+ if(!bNoUnitChars)
+ rStr += aUIUnitStr;
+}
+
+void SdrModel::TakeWinkStr(long nWink, XubString& rStr, FASTBOOL bNoDegChar) const
+{
+ sal_Bool bNeg(nWink < 0);
+
+ if(bNeg)
+ nWink = -nWink;
+
+ rStr = UniString::CreateFromInt32(nWink);
+
+ SvtSysLocale aSysLoc;
+ const LocaleDataWrapper& rLoc = aSysLoc.GetLocaleData();
+ xub_StrLen nAnz(2);
+
+ if(rLoc.isNumLeadingZero())
+ nAnz++;
+
+ while(rStr.Len() < nAnz)
+ rStr.Insert(sal_Unicode('0'), 0);
+
+ rStr.Insert(rLoc.getNumDecimalSep().GetChar(0), rStr.Len() - 2);
+
+ if(bNeg)
+ rStr.Insert(sal_Unicode('-'), 0);
+
+ if(!bNoDegChar)
+ rStr += DEGREE_CHAR;
+}
+
+void SdrModel::TakePercentStr(const Fraction& rVal, XubString& rStr, FASTBOOL bNoPercentChar) const
+{
+ sal_Int32 nMul(rVal.GetNumerator());
+ sal_Int32 nDiv(rVal.GetDenominator());
+ sal_Bool bNeg(nMul < 0);
+
+ if(nDiv < 0)
+ bNeg = !bNeg;
+
+ if(nMul < 0)
+ nMul = -nMul;
+
+ if(nDiv < 0)
+ nDiv = -nDiv;
+
+ nMul *= 100;
+ nMul += nDiv/2;
+ nMul /= nDiv;
+
+ rStr = UniString::CreateFromInt32(nMul);
+
+ if(bNeg)
+ rStr.Insert(sal_Unicode('-'), 0);
+
+ if(!bNoPercentChar)
+ rStr += sal_Unicode('%');
+}
+
+void SdrModel::SetChanged(sal_Bool bFlg)
+{
+ mbChanged = bFlg;
+}
+
+void SdrModel::RecalcPageNums(FASTBOOL bMaster)
+{
+ Container& rPL=*(bMaster ? &maMaPag : &maPages);
+ sal_uInt16 nAnz=sal_uInt16(rPL.Count());
+ sal_uInt16 i;
+ for (i=0; i<nAnz; i++) {
+ SdrPage* pPg=(SdrPage*)(rPL.GetObject(i));
+ pPg->SetPageNum(i);
+ }
+ if (bMaster) bMPgNumsDirty=sal_False;
+ else bPagNumsDirty=sal_False;
+}
+
+void SdrModel::InsertPage(SdrPage* pPage, sal_uInt16 nPos)
+{
+ sal_uInt16 nAnz=GetPageCount();
+ if (nPos>nAnz) nPos=nAnz;
+ maPages.Insert(pPage,nPos);
+ // #109538#
+ PageListChanged();
+ pPage->SetInserted(sal_True);
+ pPage->SetPageNum(nPos);
+ pPage->SetModel(this);
+ if (nPos<nAnz) bPagNumsDirty=sal_True;
+ SetChanged();
+ SdrHint aHint(HINT_PAGEORDERCHG);
+ aHint.SetPage(pPage);
+ Broadcast(aHint);
+}
+
+void SdrModel::DeletePage(sal_uInt16 nPgNum)
+{
+ SdrPage* pPg=RemovePage(nPgNum);
+ delete pPg;
+}
+
+SdrPage* SdrModel::RemovePage(sal_uInt16 nPgNum)
+{
+ SdrPage* pPg=(SdrPage*)maPages.Remove(nPgNum);
+ // #109538#
+ PageListChanged();
+ if (pPg!=NULL) {
+ pPg->SetInserted(sal_False);
+ }
+ bPagNumsDirty=sal_True;
+ SetChanged();
+ SdrHint aHint(HINT_PAGEORDERCHG);
+ aHint.SetPage(pPg);
+ Broadcast(aHint);
+ return pPg;
+}
+
+void SdrModel::MovePage(sal_uInt16 nPgNum, sal_uInt16 nNewPos)
+{
+ SdrPage* pPg=(SdrPage*)maPages.Remove(nPgNum);
+ // #109538#
+ PageListChanged();
+ if (pPg!=NULL) {
+ pPg->SetInserted(sal_False);
+ InsertPage(pPg,nNewPos);
+ }
+}
+
+void SdrModel::InsertMasterPage(SdrPage* pPage, sal_uInt16 nPos)
+{
+ sal_uInt16 nAnz=GetMasterPageCount();
+ if (nPos>nAnz) nPos=nAnz;
+ maMaPag.Insert(pPage,nPos);
+ // #109538#
+ MasterPageListChanged();
+ pPage->SetInserted(sal_True);
+ pPage->SetPageNum(nPos);
+ pPage->SetModel(this);
+ if (nPos<nAnz) {
+ bMPgNumsDirty=sal_True;
+ }
+ SetChanged();
+ SdrHint aHint(HINT_PAGEORDERCHG);
+ aHint.SetPage(pPage);
+ Broadcast(aHint);
+}
+
+void SdrModel::DeleteMasterPage(sal_uInt16 nPgNum)
+{
+ SdrPage* pPg=RemoveMasterPage(nPgNum);
+ if (pPg!=NULL) delete pPg;
+}
+
+SdrPage* SdrModel::RemoveMasterPage(sal_uInt16 nPgNum)
+{
+ SdrPage* pRetPg=(SdrPage*)maMaPag.Remove(nPgNum);
+ // #109538#
+ MasterPageListChanged();
+
+ if(pRetPg)
+ {
+ // Nun die Verweise der normalen Zeichenseiten auf die entfernte MasterPage loeschen
+ sal_uInt16 nPageAnz(GetPageCount());
+
+ for(sal_uInt16 np(0); np < nPageAnz; np++)
+ {
+ GetPage(np)->TRG_ImpMasterPageRemoved(*pRetPg);
+ }
+
+ pRetPg->SetInserted(sal_False);
+ }
+
+ bMPgNumsDirty=sal_True;
+ SetChanged();
+ SdrHint aHint(HINT_PAGEORDERCHG);
+ aHint.SetPage(pRetPg);
+ Broadcast(aHint);
+ return pRetPg;
+}
+
+void SdrModel::MoveMasterPage(sal_uInt16 nPgNum, sal_uInt16 nNewPos)
+{
+ SdrPage* pPg=(SdrPage*)maMaPag.Remove(nPgNum);
+ // #109538#
+ MasterPageListChanged();
+ if (pPg!=NULL) {
+ pPg->SetInserted(sal_False);
+ maMaPag.Insert(pPg,nNewPos);
+ // #109538#
+ MasterPageListChanged();
+ }
+ bMPgNumsDirty=sal_True;
+ SetChanged();
+ SdrHint aHint(HINT_PAGEORDERCHG);
+ aHint.SetPage(pPg);
+ Broadcast(aHint);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+FASTBOOL SdrModel::CheckConsistence() const
+{
+ FASTBOOL bRet=sal_True;
+#ifdef DBG_UTIL
+ DBG_CHKTHIS(SdrModel,NULL);
+#endif
+ return bRet;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+// #48289#
+void SdrModel::CopyPages(sal_uInt16 nFirstPageNum, sal_uInt16 nLastPageNum,
+ sal_uInt16 nDestPos,
+ FASTBOOL bUndo, FASTBOOL bMoveNoCopy)
+{
+ if( bUndo && !IsUndoEnabled() )
+ bUndo = false;
+
+ if( bUndo )
+ BegUndo(ImpGetResStr(STR_UndoMergeModel));
+
+ sal_uInt16 nPageAnz=GetPageCount();
+ sal_uInt16 nMaxPage=nPageAnz;
+
+ if (nMaxPage!=0)
+ nMaxPage--;
+ if (nFirstPageNum>nMaxPage)
+ nFirstPageNum=nMaxPage;
+ if (nLastPageNum>nMaxPage)
+ nLastPageNum =nMaxPage;
+ FASTBOOL bReverse=nLastPageNum<nFirstPageNum;
+ if (nDestPos>nPageAnz)
+ nDestPos=nPageAnz;
+
+ // Zunaechst die Zeiger der betroffenen Seiten in einem Array sichern
+ sal_uInt16 nPageNum=nFirstPageNum;
+ sal_uInt16 nCopyAnz=((!bReverse)?(nLastPageNum-nFirstPageNum):(nFirstPageNum-nLastPageNum))+1;
+ SdrPage** pPagePtrs=new SdrPage*[nCopyAnz];
+ sal_uInt16 nCopyNum;
+ for(nCopyNum=0; nCopyNum<nCopyAnz; nCopyNum++)
+ {
+ pPagePtrs[nCopyNum]=GetPage(nPageNum);
+ if (bReverse)
+ nPageNum--;
+ else
+ nPageNum++;
+ }
+
+ // Jetzt die Seiten kopieren
+ sal_uInt16 nDestNum=nDestPos;
+ for (nCopyNum=0; nCopyNum<nCopyAnz; nCopyNum++)
+ {
+ SdrPage* pPg=pPagePtrs[nCopyNum];
+ sal_uInt16 nPageNum2=pPg->GetPageNum();
+ if (!bMoveNoCopy)
+ {
+ const SdrPage* pPg1=GetPage(nPageNum2);
+ pPg=pPg1->Clone();
+ InsertPage(pPg,nDestNum);
+ if (bUndo)
+ AddUndo(GetSdrUndoFactory().CreateUndoCopyPage(*pPg));
+ nDestNum++;
+ }
+ else
+ {
+ // Move ist nicht getestet!
+ if (nDestNum>nPageNum2)
+ nDestNum--;
+
+ if(bUndo)
+ AddUndo(GetSdrUndoFactory().CreateUndoSetPageNum(*GetPage(nPageNum2),nPageNum2,nDestNum));
+
+ pPg=RemovePage(nPageNum2);
+ InsertPage(pPg,nDestNum);
+ nDestNum++;
+ }
+
+ if(bReverse)
+ nPageNum2--;
+ else
+ nPageNum2++;
+ }
+
+ delete[] pPagePtrs;
+ if(bUndo)
+ EndUndo();
+}
+
+void SdrModel::Merge(SdrModel& rSourceModel,
+ sal_uInt16 nFirstPageNum, sal_uInt16 nLastPageNum,
+ sal_uInt16 nDestPos,
+ FASTBOOL bMergeMasterPages, FASTBOOL bAllMasterPages,
+ FASTBOOL bUndo, FASTBOOL bTreadSourceAsConst)
+{
+ if (&rSourceModel==this)
+ { // #48289#
+ CopyPages(nFirstPageNum,nLastPageNum,nDestPos,bUndo,!bTreadSourceAsConst);
+ return;
+ }
+
+ if( bUndo && !IsUndoEnabled() )
+ bUndo = false;
+
+ if (bUndo)
+ BegUndo(ImpGetResStr(STR_UndoMergeModel));
+
+ sal_uInt16 nSrcPageAnz=rSourceModel.GetPageCount();
+ sal_uInt16 nSrcMasterPageAnz=rSourceModel.GetMasterPageCount();
+ sal_uInt16 nDstMasterPageAnz=GetMasterPageCount();
+ FASTBOOL bInsPages=(nFirstPageNum<nSrcPageAnz || nLastPageNum<nSrcPageAnz);
+ sal_uInt16 nMaxSrcPage=nSrcPageAnz; if (nMaxSrcPage!=0) nMaxSrcPage--;
+ if (nFirstPageNum>nMaxSrcPage) nFirstPageNum=nMaxSrcPage;
+ if (nLastPageNum>nMaxSrcPage) nLastPageNum =nMaxSrcPage;
+ FASTBOOL bReverse=nLastPageNum<nFirstPageNum;
+
+ sal_uInt16* pMasterMap=NULL;
+ int* pMasterNeed=NULL;
+ sal_uInt16 nMasterNeed=0;
+ if (bMergeMasterPages && nSrcMasterPageAnz!=0) {
+ // Feststellen, welche MasterPages aus rSrcModel benoetigt werden
+ pMasterMap=new sal_uInt16[nSrcMasterPageAnz];
+ pMasterNeed=new int[nSrcMasterPageAnz];
+ memset(pMasterMap,0xFF,nSrcMasterPageAnz*sizeof(sal_uInt16));
+ if (bAllMasterPages) {
+ memset(pMasterNeed,sal_True,nSrcMasterPageAnz*sizeof(FASTBOOL));
+ } else {
+ memset(pMasterNeed,sal_False,nSrcMasterPageAnz*sizeof(FASTBOOL));
+ sal_uInt16 nAnf= bReverse ? nLastPageNum : nFirstPageNum;
+ sal_uInt16 nEnd= bReverse ? nFirstPageNum : nLastPageNum;
+ for (sal_uInt16 i=nAnf; i<=nEnd; i++) {
+ const SdrPage* pPg=rSourceModel.GetPage(i);
+ if(pPg->TRG_HasMasterPage())
+ {
+ SdrPage& rMasterPage = pPg->TRG_GetMasterPage();
+ sal_uInt16 nMPgNum(rMasterPage.GetPageNum());
+
+ if(nMPgNum < nSrcMasterPageAnz)
+ {
+ pMasterNeed[nMPgNum] = sal_True;
+ }
+ }
+ }
+ }
+ // Nun das Mapping der MasterPages bestimmen
+ sal_uInt16 nAktMaPagNum=nDstMasterPageAnz;
+ for (sal_uInt16 i=0; i<nSrcMasterPageAnz; i++) {
+ if (pMasterNeed[i]) {
+ pMasterMap[i]=nAktMaPagNum;
+ nAktMaPagNum++;
+ nMasterNeed++;
+ }
+ }
+ }
+
+ // rueberholen der Masterpages
+ if (pMasterMap!=NULL && pMasterNeed!=NULL && nMasterNeed!=0) {
+ for (sal_uInt16 i=nSrcMasterPageAnz; i>0;) {
+ i--;
+ if (pMasterNeed[i]) {
+ SdrPage* pPg=NULL;
+ if (bTreadSourceAsConst) {
+ const SdrPage* pPg1=rSourceModel.GetMasterPage(i);
+ pPg=pPg1->Clone();
+ } else {
+ pPg=rSourceModel.RemoveMasterPage(i);
+ }
+ if (pPg!=NULL) {
+ // und alle ans einstige Ende des DstModel reinschieben.
+ // nicht InsertMasterPage() verwenden da die Sache
+ // inkonsistent ist bis alle drin sind
+ maMaPag.Insert(pPg,nDstMasterPageAnz);
+ // #109538#
+ MasterPageListChanged();
+ pPg->SetInserted(sal_True);
+ pPg->SetModel(this);
+ bMPgNumsDirty=sal_True;
+ if (bUndo) AddUndo(GetSdrUndoFactory().CreateUndoNewPage(*pPg));
+ } else {
+ DBG_ERROR("SdrModel::Merge(): MasterPage im SourceModel nicht gefunden");
+ }
+ }
+ }
+ }
+
+ // rueberholen der Zeichenseiten
+ if (bInsPages) {
+ sal_uInt16 nSourcePos=nFirstPageNum;
+ sal_uInt16 nMergeCount=sal_uInt16(Abs((long)((long)nFirstPageNum-nLastPageNum))+1);
+ if (nDestPos>GetPageCount()) nDestPos=GetPageCount();
+ while (nMergeCount>0) {
+ SdrPage* pPg=NULL;
+ if (bTreadSourceAsConst) {
+ const SdrPage* pPg1=rSourceModel.GetPage(nSourcePos);
+ pPg=pPg1->Clone();
+ } else {
+ pPg=rSourceModel.RemovePage(nSourcePos);
+ }
+ if (pPg!=NULL) {
+ InsertPage(pPg,nDestPos);
+ if (bUndo) AddUndo(GetSdrUndoFactory().CreateUndoNewPage(*pPg));
+ // und nun zu den MasterPageDescriptoren
+
+ if(pPg->TRG_HasMasterPage())
+ {
+ SdrPage& rMasterPage = pPg->TRG_GetMasterPage();
+ sal_uInt16 nMaPgNum(rMasterPage.GetPageNum());
+
+ if (bMergeMasterPages)
+ {
+ sal_uInt16 nNeuNum(0xFFFF);
+
+ if(pMasterMap)
+ {
+ nNeuNum = pMasterMap[nMaPgNum];
+ }
+
+ if(nNeuNum != 0xFFFF)
+ {
+ if(bUndo)
+ {
+ AddUndo(GetSdrUndoFactory().CreateUndoPageChangeMasterPage(*pPg));
+ }
+
+ pPg->TRG_SetMasterPage(*GetMasterPage(nNeuNum));
+ }
+ DBG_ASSERT(nNeuNum!=0xFFFF,"SdrModel::Merge(): Irgendwas ist krumm beim Mappen der MasterPages");
+ } else {
+ if (nMaPgNum>=nDstMasterPageAnz) {
+ // Aha, die ist ausserbalb des urspruenglichen Bereichs der Masterpages des DstModel
+ pPg->TRG_ClearMasterPage();
+ }
+ }
+ }
+
+ } else {
+ DBG_ERROR("SdrModel::Merge(): Zeichenseite im SourceModel nicht gefunden");
+ }
+ nDestPos++;
+ if (bReverse) nSourcePos--;
+ else if (bTreadSourceAsConst) nSourcePos++;
+ nMergeCount--;
+ }
+ }
+
+ delete [] pMasterMap;
+ delete [] pMasterNeed;
+
+ bMPgNumsDirty=sal_True;
+ bPagNumsDirty=sal_True;
+
+ SetChanged();
+ // Fehlt: Mergen und Mapping der Layer
+ // an den Objekten sowie an den MasterPageDescriptoren
+ if (bUndo) EndUndo();
+}
+
+void SdrModel::SetStarDrawPreviewMode(sal_Bool bPreview)
+{
+ if (!bPreview && bStarDrawPreviewMode && GetPageCount())
+ {
+ // Das Zuruecksetzen ist nicht erlaubt, da das Model ev. nicht vollstaendig geladen wurde
+ DBG_ASSERT(sal_False,"SdrModel::SetStarDrawPreviewMode(): Zuruecksetzen nicht erlaubt, da Model ev. nicht vollstaendig");
+ }
+ else
+ {
+ bStarDrawPreviewMode = bPreview;
+ }
+}
+
+uno::Reference< uno::XInterface > SdrModel::getUnoModel()
+{
+ if( !mxUnoModel.is() )
+ mxUnoModel = createUnoModel();
+
+ return mxUnoModel;
+}
+
+void SdrModel::setUnoModel( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xModel )
+{
+ mxUnoModel = xModel;
+}
+
+uno::Reference< uno::XInterface > SdrModel::createUnoModel()
+{
+ DBG_ERROR( "SdrModel::createUnoModel() - base implementation should not be called!" );
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xInt;
+ return xInt;
+}
+
+void SdrModel::setLock( sal_Bool bLock )
+{
+ if( mbModelLocked != bLock )
+ {
+ if( sal_False == bLock )
+ {
+ // ReformatAllTextObjects(); #103122# due to a typo in the above if, this code was never
+ // executed, so I remove it until we discover that we need it here
+ ImpReformatAllEdgeObjects(); // #103122#
+ }
+ mbModelLocked = bLock;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrModel::MigrateItemSet( const SfxItemSet* pSourceSet, SfxItemSet* pDestSet, SdrModel* pNewModel )
+{
+ if( pSourceSet && pDestSet && (pSourceSet != pDestSet ) )
+ {
+ if( pNewModel == NULL )
+ pNewModel = this;
+
+ SfxWhichIter aWhichIter(*pSourceSet);
+ sal_uInt16 nWhich(aWhichIter.FirstWhich());
+ const SfxPoolItem *pPoolItem;
+
+ while(nWhich)
+ {
+ if(SFX_ITEM_SET == pSourceSet->GetItemState(nWhich, sal_False, &pPoolItem))
+ {
+ const SfxPoolItem* pItem = pPoolItem;
+
+ switch( nWhich )
+ {
+ case XATTR_FILLBITMAP:
+ pItem = ((XFillBitmapItem*)pItem)->checkForUniqueItem( pNewModel );
+ break;
+ case XATTR_LINEDASH:
+ pItem = ((XLineDashItem*)pItem)->checkForUniqueItem( pNewModel );
+ break;
+ case XATTR_LINESTART:
+ pItem = ((XLineStartItem*)pItem)->checkForUniqueItem( pNewModel );
+ break;
+ case XATTR_LINEEND:
+ pItem = ((XLineEndItem*)pItem)->checkForUniqueItem( pNewModel );
+ break;
+ case XATTR_FILLGRADIENT:
+ pItem = ((XFillGradientItem*)pItem)->checkForUniqueItem( pNewModel );
+ break;
+ case XATTR_FILLFLOATTRANSPARENCE:
+ // #85953# allow all kinds of XFillFloatTransparenceItem to be set
+ pItem = ((XFillFloatTransparenceItem*)pItem)->checkForUniqueItem( pNewModel );
+ break;
+ case XATTR_FILLHATCH:
+ pItem = ((XFillHatchItem*)pItem)->checkForUniqueItem( pNewModel );
+ break;
+ }
+
+ // set item
+ if( pItem )
+ {
+ pDestSet->Put(*pItem);
+
+ // delete item if it was a generated one
+ if( pItem != pPoolItem)
+ delete (SfxPoolItem*)pItem;
+ }
+ }
+ nWhich = aWhichIter.NextWhich();
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrModel::SetForbiddenCharsTable( vos::ORef<SvxForbiddenCharactersTable> xForbiddenChars )
+{
+ if( mpForbiddenCharactersTable )
+ mpForbiddenCharactersTable->release();
+
+ mpForbiddenCharactersTable = xForbiddenChars.getBodyPtr();
+
+ if( mpForbiddenCharactersTable )
+ mpForbiddenCharactersTable->acquire();
+
+ ImpSetOutlinerDefaults( pDrawOutliner );
+ ImpSetOutlinerDefaults( pHitTestOutliner );
+}
+
+vos::ORef<SvxForbiddenCharactersTable> SdrModel::GetForbiddenCharsTable() const
+{
+ return mpForbiddenCharactersTable;
+}
+
+void SdrModel::SetCharCompressType( sal_uInt16 nType )
+{
+ if( nType != mnCharCompressType )
+ {
+ mnCharCompressType = nType;
+ ImpSetOutlinerDefaults( pDrawOutliner );
+ ImpSetOutlinerDefaults( pHitTestOutliner );
+ }
+}
+
+void SdrModel::SetKernAsianPunctuation( sal_Bool bEnabled )
+{
+ if( mbKernAsianPunctuation != bEnabled )
+ {
+ mbKernAsianPunctuation = bEnabled;
+ ImpSetOutlinerDefaults( pDrawOutliner );
+ ImpSetOutlinerDefaults( pHitTestOutliner );
+ }
+}
+
+void SdrModel::SetAddExtLeading( sal_Bool bEnabled )
+{
+ if( mbAddExtLeading != bEnabled )
+ {
+ mbAddExtLeading = bEnabled;
+ ImpSetOutlinerDefaults( pDrawOutliner );
+ ImpSetOutlinerDefaults( pHitTestOutliner );
+ }
+}
+
+void SdrModel::ReformatAllTextObjects()
+{
+ ImpReformatAllTextObjects();
+}
+
+FASTBOOL SdrModel::HasTransparentObjects( sal_Bool bCheckForAlphaChannel ) const
+{
+ FASTBOOL bRet = sal_False;
+ sal_uInt16 n, nCount;
+
+ for( n = 0, nCount = GetMasterPageCount(); ( n < nCount ) && !bRet; n++ )
+ if( GetMasterPage( n )->HasTransparentObjects( bCheckForAlphaChannel ) )
+ bRet = sal_True;
+
+ if( !bRet )
+ {
+ for( n = 0, nCount = GetPageCount(); ( n < nCount ) && !bRet; n++ )
+ if( GetPage( n )->HasTransparentObjects( bCheckForAlphaChannel ) )
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+SdrOutliner* SdrModel::createOutliner( sal_uInt16 nOutlinerMode )
+{
+ if( NULL == mpOutlinerCache )
+ mpOutlinerCache = new SdrOutlinerCache(this);
+
+ return mpOutlinerCache->createOutliner( nOutlinerMode );
+}
+
+void SdrModel::disposeOutliner( SdrOutliner* pOutliner )
+{
+ if( mpOutlinerCache )
+ {
+ mpOutlinerCache->disposeOutliner( pOutliner );
+ }
+ else
+ {
+ delete pOutliner;
+ }
+}
+
+SvxNumType SdrModel::GetPageNumType() const
+{
+ return SVX_ARABIC;
+}
+
+const SdrPage* SdrModel::GetPage(sal_uInt16 nPgNum) const
+{
+ DBG_ASSERT(nPgNum < maPages.Count(), "SdrModel::GetPage: Access out of range (!)");
+ return (SdrPage*)(maPages.GetObject(nPgNum));
+}
+
+SdrPage* SdrModel::GetPage(sal_uInt16 nPgNum)
+{
+ DBG_ASSERT(nPgNum < maPages.Count(), "SdrModel::GetPage: Access out of range (!)");
+ return (SdrPage*)(maPages.GetObject(nPgNum));
+}
+
+sal_uInt16 SdrModel::GetPageCount() const
+{
+ return sal_uInt16(maPages.Count());
+}
+
+void SdrModel::PageListChanged()
+{
+}
+
+const SdrPage* SdrModel::GetMasterPage(sal_uInt16 nPgNum) const
+{
+ DBG_ASSERT(nPgNum < maMaPag.Count(), "SdrModel::GetMasterPage: Access out of range (!)");
+ return (SdrPage*)(maMaPag.GetObject(nPgNum));
+}
+
+SdrPage* SdrModel::GetMasterPage(sal_uInt16 nPgNum)
+{
+ DBG_ASSERT(nPgNum < maMaPag.Count(), "SdrModel::GetMasterPage: Access out of range (!)");
+ return (SdrPage*)(maMaPag.GetObject(nPgNum));
+}
+
+sal_uInt16 SdrModel::GetMasterPageCount() const
+{
+ return sal_uInt16(maMaPag.Count());
+}
+
+void SdrModel::MasterPageListChanged()
+{
+}
+
+void SdrModel::SetSdrUndoManager( SfxUndoManager* pUndoManager )
+{
+ mpImpl->mpUndoManager = pUndoManager;
+}
+
+SfxUndoManager* SdrModel::GetSdrUndoManager() const
+{
+ return mpImpl->mpUndoManager;
+}
+
+SdrUndoFactory& SdrModel::GetSdrUndoFactory() const
+{
+ if( !mpImpl->mpUndoFactory )
+ mpImpl->mpUndoFactory = new SdrUndoFactory;
+ return *mpImpl->mpUndoFactory;
+}
+
+void SdrModel::SetSdrUndoFactory( SdrUndoFactory* pUndoFactory )
+{
+ if( pUndoFactory && (pUndoFactory != mpImpl->mpUndoFactory) )
+ {
+ delete mpImpl->mpUndoFactory;
+ mpImpl->mpUndoFactory = pUndoFactory;
+ }
+}
+
+/** cl: added this for OJ to complete his reporting engine, does not work
+ correctly so only enable it for his model */
+bool SdrModel::IsAllowShapePropertyChangeListener() const
+{
+ return mpImpl && mpImpl->mbAllowShapePropertyChangeListener;
+}
+
+void SdrModel::SetAllowShapePropertyChangeListener( bool bAllow )
+{
+ if( mpImpl )
+ {
+ mpImpl->mbAllowShapePropertyChangeListener = bAllow;
+ }
+}
+
+const ::com::sun::star::uno::Sequence< sal_Int8 >& SdrModel::getUnoTunnelImplementationId()
+{
+ static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = 0;
+ if( !pSeq )
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !pSeq )
+ {
+ static Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+ return *pSeq;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(SdrHint,SfxHint);
+
+SdrHint::SdrHint()
+: mpPage(0L),
+ mpObj(0L),
+ mpObjList(0L),
+ meHint(HINT_UNKNOWN)
+{
+}
+
+SdrHint::SdrHint(SdrHintKind eNewHint)
+: mpPage(0L),
+ mpObj(0L),
+ mpObjList(0L),
+ meHint(eNewHint)
+{
+}
+
+SdrHint::SdrHint(const SdrObject& rNewObj)
+: mpPage(rNewObj.GetPage()),
+ mpObj(&rNewObj),
+ mpObjList(rNewObj.GetObjList()),
+ meHint(HINT_OBJCHG)
+{
+ maRectangle = rNewObj.GetLastBoundRect();
+}
+
+SdrHint::SdrHint(const SdrObject& rNewObj, const Rectangle& rRect)
+: mpPage(rNewObj.GetPage()),
+ mpObj(&rNewObj),
+ mpObjList(rNewObj.GetObjList()),
+ meHint(HINT_OBJCHG)
+{
+ maRectangle = rRect;
+}
+
+void SdrHint::SetPage(const SdrPage* pNewPage)
+{
+ mpPage = pNewPage;
+}
+
+void SdrHint::SetObjList(const SdrObjList* pNewOL)
+{
+ mpObjList = pNewOL;
+}
+
+void SdrHint::SetObject(const SdrObject* pNewObj)
+{
+ mpObj = pNewObj;
+}
+
+void SdrHint::SetKind(SdrHintKind eNewKind)
+{
+ meHint = eNewKind;
+}
+
+void SdrHint::SetRect(const Rectangle& rNewRect)
+{
+ maRectangle = rNewRect;
+}
+
+const SdrPage* SdrHint::GetPage() const
+{
+ return mpPage;
+}
+
+const SdrObjList* SdrHint::GetObjList() const
+{
+ return mpObjList;
+}
+
+const SdrObject* SdrHint::GetObject() const
+{
+ return mpObj;
+}
+
+SdrHintKind SdrHint::GetKind() const
+{
+ return meHint;
+}
+
+const Rectangle& SdrHint::GetRect() const
+{
+ return maRectangle;
+}
+
+// eof
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
new file mode 100644
index 000000000000..f9055fedcabc
--- /dev/null
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -0,0 +1,2177 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svdmrkv.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/svdoedge.hxx>
+#include "svx/svdglob.hxx"
+#include "svx/svditext.hxx"
+#include <svx/svdview.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdpage.hxx>
+#include "svddrgm1.hxx"
+
+#ifdef DBG_UTIL
+#include <svdibrow.hxx>
+#endif
+
+#include <svx/svdoole2.hxx>
+#include <svx/xgrad.hxx>
+#include <svx/xflgrit.hxx>
+#include "gradtrns.hxx"
+#include <svx/xflftrit.hxx>
+#include <svx/dialmgr.hxx>
+#include "svx/svdstr.hrc"
+#include <svx/svdundo.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/scene3d.hxx>
+#include <svx/svdovirt.hxx>
+#include <svx/sdr/overlay/overlayrollingrectangle.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <svx/sdrpaintwindow.hxx>
+#include <svx/sdrpagewindow.hxx>
+#include <svx/sdrhittesthelper.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// predefines
+
+class SdrUnoControlList;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// #114409#-3 Migrate Marking of Objects, Points and GluePoints
+
+class ImplMarkingOverlay
+{
+ // The OverlayObjects
+ ::sdr::overlay::OverlayObjectList maObjects;
+
+ // The remembered second position in logical coodinates
+ basegfx::B2DPoint maSecondPosition;
+
+ // bitfield
+ // A flag to remember if the action is for unmarking.
+ unsigned mbUnmarking : 1;
+
+public:
+ ImplMarkingOverlay(const SdrPaintView& rView, const basegfx::B2DPoint& rStartPos, sal_Bool bUnmarking = sal_False);
+ ~ImplMarkingOverlay();
+
+ void SetSecondPosition(const basegfx::B2DPoint& rNewPosition);
+ sal_Bool IsUnmarking() const { return mbUnmarking; }
+};
+
+ImplMarkingOverlay::ImplMarkingOverlay(const SdrPaintView& rView, const basegfx::B2DPoint& rStartPos, sal_Bool bUnmarking)
+: maSecondPosition(rStartPos),
+ mbUnmarking(bUnmarking)
+{
+ for(sal_uInt32 a(0L); a < rView.PaintWindowCount(); a++)
+ {
+ SdrPaintWindow* pCandidate = rView.GetPaintWindow(a);
+ ::sdr::overlay::OverlayManager* pTargetOverlay = pCandidate->GetOverlayManager();
+
+ if(pTargetOverlay)
+ {
+ ::sdr::overlay::OverlayRollingRectangleStriped* pNew = new ::sdr::overlay::OverlayRollingRectangleStriped(
+ rStartPos, rStartPos, false);
+ pTargetOverlay->add(*pNew);
+ maObjects.append(*pNew);
+ }
+ }
+}
+
+ImplMarkingOverlay::~ImplMarkingOverlay()
+{
+ // The OverlayObjects are cleared using the destructor of OverlayObjectList.
+ // That destructor calls clear() at the list which removes all objects from the
+ // OverlayManager and deletes them.
+}
+
+void ImplMarkingOverlay::SetSecondPosition(const basegfx::B2DPoint& rNewPosition)
+{
+ if(rNewPosition != maSecondPosition)
+ {
+ // apply to OverlayObjects
+ for(sal_uInt32 a(0L); a < maObjects.count(); a++)
+ {
+ ::sdr::overlay::OverlayRollingRectangleStriped& rCandidate = (::sdr::overlay::OverlayRollingRectangleStriped&)maObjects.getOverlayObject(a);
+ rCandidate.setSecondPosition(rNewPosition);
+ }
+
+ // remember new position
+ maSecondPosition = rNewPosition;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@ @@ @@@@ @@@@@ @@ @@ @@ @@ @@ @@@@@ @@ @@
+// @@@ @@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@@@@@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@
+// @@@@@@@ @@@@@@ @@@@@ @@@@ @@@@@ @@ @@@@ @@@@@@@
+// @@ @ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @ @@ @@@@@ @@ @@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrMarkView::ImpClearVars()
+{
+ eDragMode=SDRDRAG_MOVE;
+ //HMHbHdlShown=sal_False;
+ bRefHdlShownOnly=sal_False;
+ eEditMode=SDREDITMODE_EDIT;
+ eEditMode0=SDREDITMODE_EDIT;
+ bDesignMode=sal_False;
+ pMarkedObj=NULL;
+ pMarkedPV=NULL;
+ bForceFrameHandles=sal_False;
+ bPlusHdlAlways=sal_False;
+ nFrameHandlesLimit=50;
+ bInsPolyPoint=sal_False;
+ mnInsPointNum = 0L;
+ bMarkedObjRectDirty=sal_False;
+ bMarkedPointsRectsDirty=sal_False;
+ mbMarkHandlesHidden = false;
+ bMrkPntDirty=sal_False;
+ bMarkHdlWhenTextEdit=sal_False;
+ bMarkableObjCountDirty=sal_False; // noch nicht implementiert
+ nMarkableObjCount=0; // noch nicht implementiert
+
+ // #114409#-3 Migrate selections
+ BrkMarkObj();
+ BrkMarkPoints();
+ BrkMarkGluePoints();
+}
+
+SdrMarkView::SdrMarkView(SdrModel* pModel1, OutputDevice* pOut)
+: SdrSnapView(pModel1,pOut),
+ mpMarkObjOverlay(0L),
+ mpMarkPointsOverlay(0L),
+ mpMarkGluePointsOverlay(0L),
+ aHdl(this),
+ mpSdrViewSelection(new sdr::ViewSelection())
+{
+ ImpClearVars();
+ StartListening(*pModel1);
+}
+
+SdrMarkView::~SdrMarkView()
+{
+ // #114409#-3 Migrate selections
+ BrkMarkObj();
+ BrkMarkPoints();
+ BrkMarkGluePoints();
+ delete mpSdrViewSelection;
+}
+
+void __EXPORT SdrMarkView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
+{
+ SdrHint* pSdrHint=PTR_CAST(SdrHint,&rHint);
+ if (pSdrHint!=NULL)
+ {
+ SdrHintKind eKind=pSdrHint->GetKind();
+
+ if (eKind==HINT_OBJCHG || eKind==HINT_OBJINSERTED || eKind==HINT_OBJREMOVED)
+ {
+ bMarkedObjRectDirty=sal_True;
+ bMarkedPointsRectsDirty=sal_True;
+ }
+/* removed for now since this breaks existing code who iterates over the mark list and sequentially replaces objects
+ if( eKind==HINT_OBJREMOVED && IsObjMarked( const_cast<SdrObject*>(pSdrHint->GetObject()) ) )
+ {
+ MarkObj( const_cast<SdrObject*>(pSdrHint->GetObject()), GetSdrPageView(), sal_True );
+ }
+*/
+ }
+ SdrSnapView::Notify(rBC,rHint);
+}
+
+void SdrMarkView::ModelHasChanged()
+{
+ SdrPaintView::ModelHasChanged();
+ GetMarkedObjectListWriteAccess().SetNameDirty();
+ bMarkedObjRectDirty=sal_True;
+ bMarkedPointsRectsDirty=sal_True;
+ // Es sind beispielsweise Obj markiert und maMarkedObjectListist Sorted.
+ // In einer anderen View 2 wird die ObjOrder veraendert
+ // (z.B. MovToTop()). Dann ist Neusortieren der MarkList erforderlich.
+ GetMarkedObjectListWriteAccess().SetUnsorted();
+ SortMarkedObjects();
+ bMrkPntDirty=sal_True;
+ UndirtyMrkPnt();
+ SdrView* pV=(SdrView*)this;
+ if (pV!=NULL && !pV->IsDragObj() && !pV->IsInsObjPoint()) { // an dieser Stelle habe ich ein ziemliches Problem !!!
+ AdjustMarkHdl();
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_Bool SdrMarkView::IsAction() const
+{
+ return SdrSnapView::IsAction() || IsMarkObj() || IsMarkPoints() || IsMarkGluePoints();
+}
+
+void SdrMarkView::MovAction(const Point& rPnt)
+{
+ SdrSnapView::MovAction(rPnt);
+
+ if(IsMarkObj())
+ {
+ MovMarkObj(rPnt);
+ }
+ else if(IsMarkPoints())
+ {
+ MovMarkPoints(rPnt);
+ }
+ else if(IsMarkGluePoints())
+ {
+ MovMarkGluePoints(rPnt);
+ }
+}
+
+void SdrMarkView::EndAction()
+{
+ if(IsMarkObj())
+ {
+ EndMarkObj();
+ }
+ else if(IsMarkPoints())
+ {
+ EndMarkPoints();
+ }
+ else if(IsMarkGluePoints())
+ {
+ EndMarkGluePoints();
+ }
+
+ SdrSnapView::EndAction();
+}
+
+void SdrMarkView::BckAction()
+{
+ SdrSnapView::BckAction();
+ BrkMarkObj();
+ BrkMarkPoints();
+ BrkMarkGluePoints();
+}
+
+void SdrMarkView::BrkAction()
+{
+ SdrSnapView::BrkAction();
+ BrkMarkObj();
+ BrkMarkPoints();
+ BrkMarkGluePoints();
+}
+
+void SdrMarkView::TakeActionRect(Rectangle& rRect) const
+{
+ if(IsMarkObj() || IsMarkPoints() || IsMarkGluePoints())
+ {
+ rRect = Rectangle(aDragStat.GetStart(), aDragStat.GetNow());
+ }
+ else
+ {
+ SdrSnapView::TakeActionRect(rRect);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrMarkView::ClearPageView()
+{
+ UnmarkAllObj();
+ SdrSnapView::ClearPageView();
+}
+
+void SdrMarkView::HideSdrPage()
+{
+ bool bMrkChg(false);
+ //HMHbool bVis(false);
+
+ if(mpPageView)
+ {
+ // break all creation actions when hiding page (#75081#)
+ BrkAction();
+ //HMHbVis = IsMarkHdlShown();
+
+ //HMHif(bVis)
+ //HMH{
+ //HMH HideMarkHdl();
+ //HMH}
+
+ // Alle Markierungen dieser Seite verwerfen
+ bMrkChg = GetMarkedObjectListWriteAccess().DeletePageView(*mpPageView);
+ }
+
+ SdrSnapView::HideSdrPage();
+
+ if(bMrkChg)
+ {
+ MarkListHasChanged();
+ AdjustMarkHdl();
+ }
+
+ //HMHif(bVis)
+ //HMH{
+ //HMH ShowMarkHdl();
+ //HMH}
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_Bool SdrMarkView::BegMarkObj(const Point& rPnt, sal_Bool bUnmark)
+{
+ BrkAction();
+
+ DBG_ASSERT(0L == mpMarkObjOverlay, "SdrMarkView::BegMarkObj: There exists a mpMarkObjOverlay (!)");
+ basegfx::B2DPoint aStartPos(rPnt.X(), rPnt.Y());
+ mpMarkObjOverlay = new ImplMarkingOverlay(*this, aStartPos, bUnmark);
+
+ aDragStat.Reset(rPnt);
+ aDragStat.NextPoint();
+ aDragStat.SetMinMove(nMinMovLog);
+
+ return sal_True;
+}
+
+void SdrMarkView::MovMarkObj(const Point& rPnt)
+{
+ if(IsMarkObj() && aDragStat.CheckMinMoved(rPnt))
+ {
+ aDragStat.NextMove(rPnt);
+ DBG_ASSERT(mpMarkObjOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
+ basegfx::B2DPoint aNewPos(rPnt.X(), rPnt.Y());
+ mpMarkObjOverlay->SetSecondPosition(aNewPos);
+ }
+}
+
+sal_Bool SdrMarkView::EndMarkObj()
+{
+ sal_Bool bRetval(sal_False);
+
+ if(IsMarkObj())
+ {
+ if(aDragStat.IsMinMoved())
+ {
+ Rectangle aRect(aDragStat.GetStart(), aDragStat.GetNow());
+ aRect.Justify();
+ MarkObj(aRect, mpMarkObjOverlay->IsUnmarking());
+ bRetval = sal_True;
+ }
+
+ // cleanup
+ BrkMarkObj();
+ }
+
+ return bRetval;
+}
+
+void SdrMarkView::BrkMarkObj()
+{
+ if(IsMarkObj())
+ {
+ DBG_ASSERT(mpMarkObjOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
+ delete mpMarkObjOverlay;
+ mpMarkObjOverlay = 0L;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_Bool SdrMarkView::BegMarkPoints(const Point& rPnt, sal_Bool bUnmark)
+{
+ if(HasMarkablePoints())
+ {
+ BrkAction();
+
+ DBG_ASSERT(0L == mpMarkPointsOverlay, "SdrMarkView::BegMarkObj: There exists a mpMarkPointsOverlay (!)");
+ basegfx::B2DPoint aStartPos(rPnt.X(), rPnt.Y());
+ mpMarkPointsOverlay = new ImplMarkingOverlay(*this, aStartPos, bUnmark);
+
+ aDragStat.Reset(rPnt);
+ aDragStat.NextPoint();
+ aDragStat.SetMinMove(nMinMovLog);
+
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+void SdrMarkView::MovMarkPoints(const Point& rPnt)
+{
+ if(IsMarkPoints() && aDragStat.CheckMinMoved(rPnt))
+ {
+ aDragStat.NextMove(rPnt);
+
+ DBG_ASSERT(mpMarkPointsOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
+ basegfx::B2DPoint aNewPos(rPnt.X(), rPnt.Y());
+ mpMarkPointsOverlay->SetSecondPosition(aNewPos);
+ }
+}
+
+sal_Bool SdrMarkView::EndMarkPoints()
+{
+ sal_Bool bRetval(sal_False);
+
+ if(IsMarkPoints())
+ {
+ if(aDragStat.IsMinMoved())
+ {
+ Rectangle aRect(aDragStat.GetStart(), aDragStat.GetNow());
+ aRect.Justify();
+ MarkPoints(aRect, mpMarkPointsOverlay->IsUnmarking());
+
+ bRetval = sal_True;
+ }
+
+ // cleanup
+ BrkMarkPoints();
+ }
+
+ return bRetval;
+}
+
+void SdrMarkView::BrkMarkPoints()
+{
+ if(IsMarkPoints())
+ {
+ DBG_ASSERT(mpMarkPointsOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
+ delete mpMarkPointsOverlay;
+ mpMarkPointsOverlay = 0L;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_Bool SdrMarkView::BegMarkGluePoints(const Point& rPnt, sal_Bool bUnmark)
+{
+ if(HasMarkableGluePoints())
+ {
+ BrkAction();
+
+ DBG_ASSERT(0L == mpMarkGluePointsOverlay, "SdrMarkView::BegMarkObj: There exists a mpMarkGluePointsOverlay (!)");
+ basegfx::B2DPoint aStartPos(rPnt.X(), rPnt.Y());
+ mpMarkGluePointsOverlay = new ImplMarkingOverlay(*this, aStartPos, bUnmark);
+
+ aDragStat.Reset(rPnt);
+ aDragStat.NextPoint();
+ aDragStat.SetMinMove(nMinMovLog);
+
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+void SdrMarkView::MovMarkGluePoints(const Point& rPnt)
+{
+ if(IsMarkGluePoints() && aDragStat.CheckMinMoved(rPnt))
+ {
+ aDragStat.NextMove(rPnt);
+
+ DBG_ASSERT(mpMarkGluePointsOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
+ basegfx::B2DPoint aNewPos(rPnt.X(), rPnt.Y());
+ mpMarkGluePointsOverlay->SetSecondPosition(aNewPos);
+ }
+}
+
+sal_Bool SdrMarkView::EndMarkGluePoints()
+{
+ sal_Bool bRetval(sal_False);
+
+ if(IsMarkGluePoints())
+ {
+ if(aDragStat.IsMinMoved())
+ {
+ Rectangle aRect(aDragStat.GetStart(),aDragStat.GetNow());
+ aRect.Justify();
+ MarkGluePoints(&aRect, mpMarkGluePointsOverlay->IsUnmarking());
+
+ bRetval = sal_True;
+ }
+
+ // cleanup
+ BrkMarkGluePoints();
+ }
+
+ return bRetval;
+}
+
+void SdrMarkView::BrkMarkGluePoints()
+{
+ if(IsMarkGluePoints())
+ {
+ DBG_ASSERT(mpMarkGluePointsOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
+ delete mpMarkGluePointsOverlay;
+ mpMarkGluePointsOverlay = 0L;
+ }
+}
+
+sal_Bool SdrMarkView::HasMarkableObj() const
+{
+ sal_uIntPtr nCount=0;
+
+ SdrPageView* pPV = GetSdrPageView();
+ if(pPV)
+ {
+ SdrObjList* pOL=pPV->GetObjList();
+ sal_uIntPtr nObjAnz=pOL->GetObjCount();
+ for (sal_uIntPtr nObjNum=0; nObjNum<nObjAnz && nCount==0; nObjNum++) {
+ SdrObject* pObj=pOL->GetObj(nObjNum);
+ if (IsObjMarkable(pObj,pPV)) {
+ nCount++;
+ }
+ }
+ }
+ return nCount!=0;
+}
+
+sal_uIntPtr SdrMarkView::GetMarkableObjCount() const
+{
+ sal_uIntPtr nCount=0;
+ SdrPageView* pPV = GetSdrPageView();
+
+ if(pPV)
+ {
+ SdrObjList* pOL=pPV->GetObjList();
+ sal_uIntPtr nObjAnz=pOL->GetObjCount();
+ for (sal_uIntPtr nObjNum=0; nObjNum<nObjAnz; nObjNum++) {
+ SdrObject* pObj=pOL->GetObj(nObjNum);
+ if (IsObjMarkable(pObj,pPV)) {
+ nCount++;
+ }
+ }
+ }
+ return nCount;
+}
+
+//HMHvoid SdrMarkView::ImpShowMarkHdl(bool /*bNoRefHdl*/)
+//HMH{
+//HMH bNoRefHdl=sal_False; // geht leider erstmal nicht anders
+//HMH if (!bHdlShown) {
+//HMH bRefHdlShownOnly=sal_False;
+//HMH bHdlShown=sal_True;
+//HMH }
+//HMH}
+
+//HMHvoid SdrMarkView::ShowMarkHdl(bool /*bNoRefHdl*/)
+//HMH{
+//HMH bNoRefHdl=sal_False; // geht leider erstmal nicht anders
+//HMH ImpShowMarkHdl(bNoRefHdl);
+//HMH}
+
+
+//HMHvoid SdrMarkView::HideMarkHdl(bool /*bNoRefHdl*/)
+//HMH{
+//HMH bNoRefHdl=sal_False; // geht leider erstmal nicht anders
+//HMH if (bHdlShown) {
+//HMH bRefHdlShownOnly=bNoRefHdl;
+//HMH bHdlShown=sal_False;
+//HMH }
+//HMH}
+
+void SdrMarkView::hideMarkHandles()
+{
+ if(!mbMarkHandlesHidden)
+ {
+ mbMarkHandlesHidden = true;
+ AdjustMarkHdl();
+ }
+}
+
+void SdrMarkView::showMarkHandles()
+{
+ if(mbMarkHandlesHidden)
+ {
+ mbMarkHandlesHidden = false;
+ AdjustMarkHdl();
+ }
+}
+
+sal_Bool SdrMarkView::ImpIsFrameHandles() const
+{
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ sal_Bool bFrmHdl=nMarkAnz>nFrameHandlesLimit || bForceFrameHandles;
+ sal_Bool bStdDrag=eDragMode==SDRDRAG_MOVE;
+ if (nMarkAnz==1 && bStdDrag && bFrmHdl)
+ {
+ const SdrObject* pObj=GetMarkedObjectByIndex(0);
+ if (pObj->GetObjInventor()==SdrInventor)
+ {
+ sal_uInt16 nIdent=pObj->GetObjIdentifier();
+ if (nIdent==OBJ_LINE || nIdent==OBJ_EDGE || nIdent==OBJ_CAPTION || nIdent==OBJ_MEASURE || nIdent==OBJ_CUSTOMSHAPE || nIdent==OBJ_TABLE )
+ {
+ bFrmHdl=sal_False;
+ }
+ }
+ }
+ if (!bStdDrag && !bFrmHdl) {
+ // Grundsaetzlich erstmal alle anderen Dragmodi nur mit FrameHandles
+ bFrmHdl=sal_True;
+ if (eDragMode==SDRDRAG_ROTATE) {
+ // bei Rotate ObjOwn-Drag, wenn mind. 1 PolyObj
+ for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz && bFrmHdl; nMarkNum++) {
+ const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
+ const SdrObject* pObj=pM->GetMarkedSdrObj();
+ bFrmHdl=!pObj->IsPolyObj();
+ }
+ }
+ }
+ if (!bFrmHdl) {
+ // FrameHandles, wenn wenigstens 1 Obj kein SpecialDrag kann
+ for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz && !bFrmHdl; nMarkNum++) {
+ const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
+ const SdrObject* pObj=pM->GetMarkedSdrObj();
+ bFrmHdl=!pObj->hasSpecialDrag();
+ }
+ }
+ return bFrmHdl;
+}
+
+void SdrMarkView::SetMarkHandles()
+{
+ // #105722# remember old focus handle values to search for it again
+ const SdrHdl* pSaveOldFocusHdl = aHdl.GetFocusHdl();
+ sal_Bool bSaveOldFocus(sal_False);
+ sal_uInt32 nSavePolyNum(0L), nSavePointNum(0L);
+ SdrHdlKind eSaveKind(HDL_MOVE);
+ SdrObject* pSaveObj = NULL;
+
+ if(pSaveOldFocusHdl
+ && pSaveOldFocusHdl->GetObj()
+ && pSaveOldFocusHdl->GetObj()->ISA(SdrPathObj)
+ && (pSaveOldFocusHdl->GetKind() == HDL_POLY || pSaveOldFocusHdl->GetKind() == HDL_BWGT))
+ {
+ bSaveOldFocus = sal_True;
+ nSavePolyNum = pSaveOldFocusHdl->GetPolyNum();
+ nSavePointNum = pSaveOldFocusHdl->GetPointNum();
+ pSaveObj = pSaveOldFocusHdl->GetObj();
+ eSaveKind = pSaveOldFocusHdl->GetKind();
+ }
+
+ // delete/clear all handles. This will always be done, even with areMarkHandlesHidden()
+ aHdl.Clear();
+ aHdl.SetRotateShear(eDragMode==SDRDRAG_ROTATE);
+ aHdl.SetDistortShear(eDragMode==SDRDRAG_SHEAR);
+ pMarkedObj=NULL;
+ pMarkedPV=NULL;
+
+ // are handles enabled at all? Create only then
+ if(!areMarkHandlesHidden())
+ {
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ sal_Bool bStdDrag=eDragMode==SDRDRAG_MOVE;
+ sal_Bool bSingleTextObjMark=sal_False;
+
+ if (nMarkAnz==1)
+ {
+ pMarkedObj=GetMarkedObjectByIndex(0);
+ bSingleTextObjMark =
+ pMarkedObj &&
+ pMarkedObj->ISA(SdrTextObj) &&
+ static_cast<SdrTextObj*>(pMarkedObj)->IsTextFrame();
+ }
+
+ sal_Bool bFrmHdl=ImpIsFrameHandles();
+
+ if (nMarkAnz>0)
+ {
+ pMarkedPV=GetSdrPageViewOfMarkedByIndex(0);
+
+ for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz && (pMarkedPV!=NULL || !bFrmHdl); nMarkNum++)
+ {
+ const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
+
+ if (pMarkedPV!=pM->GetPageView())
+ {
+ pMarkedPV=NULL;
+ }
+ }
+ }
+
+ if (bFrmHdl)
+ {
+ Rectangle aRect(GetMarkedObjRect());
+
+ // #i33755#
+ const sal_Bool bHideHandlesWhenInTextEdit(
+ ((SdrView*)this)->IsTextEdit()
+ && pMarkedObj
+ && pMarkedObj->ISA(SdrTextObj)
+ && ((SdrTextObj*)pMarkedObj)->IsInEditMode());
+
+ if(!aRect.IsEmpty() && !bHideHandlesWhenInTextEdit)
+ { // sonst nix gefunden
+ if( bSingleTextObjMark )
+ {
+ const sal_uIntPtr nSiz0=aHdl.GetHdlCount();
+ pMarkedObj->AddToHdlList(aHdl);
+ const sal_uIntPtr nSiz1=aHdl.GetHdlCount();
+ for (sal_uIntPtr i=nSiz0; i<nSiz1; i++)
+ {
+ SdrHdl* pHdl=aHdl.GetHdl(i);
+ pHdl->SetObj(pMarkedObj);
+ pHdl->SetPageView(pMarkedPV);
+ pHdl->SetObjHdlNum(sal_uInt16(i-nSiz0));
+ }
+ }
+ else if( eDragMode==SDRDRAG_CROP )
+ {
+ aHdl.AddHdl(new SdrCropHdl(aRect.TopLeft() ,HDL_UPLFT));
+ aHdl.AddHdl(new SdrCropHdl(aRect.TopCenter() ,HDL_UPPER));
+ aHdl.AddHdl(new SdrCropHdl(aRect.TopRight() ,HDL_UPRGT));
+ aHdl.AddHdl(new SdrCropHdl(aRect.LeftCenter() ,HDL_LEFT ));
+ aHdl.AddHdl(new SdrCropHdl(aRect.RightCenter() ,HDL_RIGHT));
+ aHdl.AddHdl(new SdrCropHdl(aRect.BottomLeft() ,HDL_LWLFT));
+ aHdl.AddHdl(new SdrCropHdl(aRect.BottomCenter(),HDL_LOWER));
+ aHdl.AddHdl(new SdrCropHdl(aRect.BottomRight() ,HDL_LWRGT));
+ }
+ else
+ {
+ sal_Bool bWdt0=aRect.Left()==aRect.Right();
+ sal_Bool bHgt0=aRect.Top()==aRect.Bottom();
+ if (bWdt0 && bHgt0)
+ {
+ aHdl.AddHdl(new SdrHdl(aRect.TopLeft(),HDL_UPLFT));
+ }
+ else if (!bStdDrag && (bWdt0 || bHgt0))
+ {
+ aHdl.AddHdl(new SdrHdl(aRect.TopLeft() ,HDL_UPLFT));
+ aHdl.AddHdl(new SdrHdl(aRect.BottomRight(),HDL_LWRGT));
+ }
+ else
+ {
+ if (!bWdt0 && !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.TopLeft() ,HDL_UPLFT));
+ if ( !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.TopCenter() ,HDL_UPPER));
+ if (!bWdt0 && !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.TopRight() ,HDL_UPRGT));
+ if (!bWdt0 ) aHdl.AddHdl(new SdrHdl(aRect.LeftCenter() ,HDL_LEFT ));
+ if (!bWdt0 ) aHdl.AddHdl(new SdrHdl(aRect.RightCenter() ,HDL_RIGHT));
+ if (!bWdt0 && !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.BottomLeft() ,HDL_LWLFT));
+ if ( !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.BottomCenter(),HDL_LOWER));
+ if (!bWdt0 && !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.BottomRight() ,HDL_LWRGT));
+ }
+ }
+ }
+ }
+ else
+ {
+ for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++)
+ {
+ const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ SdrPageView* pPV=pM->GetPageView();
+ const sal_uIntPtr nSiz0=aHdl.GetHdlCount();
+ pObj->AddToHdlList(aHdl);
+ const sal_uIntPtr nSiz1=aHdl.GetHdlCount();
+ bool bPoly=pObj->IsPolyObj();
+ const SdrUShortCont* pMrkPnts=pM->GetMarkedPoints();
+ for (sal_uIntPtr i=nSiz0; i<nSiz1; i++)
+ {
+ SdrHdl* pHdl=aHdl.GetHdl(i);
+ pHdl->SetObj(pObj);
+ pHdl->SetPageView(pPV);
+ pHdl->SetObjHdlNum(sal_uInt16(i-nSiz0));
+ if (bPoly)
+ {
+ sal_Bool bSelected=pMrkPnts!=NULL && pMrkPnts->Exist(sal_uInt16(i-nSiz0));
+ pHdl->SetSelected(bSelected);
+ //sal_Bool bPlus=bPlusHdlAlways;
+ if (bPlusHdlAlways || bSelected)
+ {
+ sal_uInt32 nPlusAnz=pObj->GetPlusHdlCount(*pHdl);
+ for (sal_uInt32 nPlusNum=0; nPlusNum<nPlusAnz; nPlusNum++)
+ {
+ SdrHdl* pPlusHdl=pObj->GetPlusHdl(*pHdl,nPlusNum);
+ if (pPlusHdl!=NULL)
+ {
+ pPlusHdl->SetObj(pObj);
+ pPlusHdl->SetPageView(pPV);
+ pPlusHdl->SetPlusHdl(sal_True);
+ aHdl.AddHdl(pPlusHdl);
+ }
+ }
+ }
+ }
+ }
+ } // for nMarkNum
+ } // if bFrmHdl else
+
+ // GluePoint-Handles
+ for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++)
+ {
+ const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ SdrPageView* pPV=pM->GetPageView();
+ const SdrUShortCont* pMrkGlue=pM->GetMarkedGluePoints();
+ if (pMrkGlue!=NULL)
+ {
+ const SdrGluePointList* pGPL=pObj->GetGluePointList();
+ if (pGPL!=NULL)
+ {
+ //sal_uInt16 nGlueAnz=pGPL->GetCount();
+ sal_uInt16 nAnz=(sal_uInt16)pMrkGlue->GetCount();
+ for (sal_uInt16 nNum=0; nNum<nAnz; nNum++)
+ {
+ sal_uInt16 nId=pMrkGlue->GetObject(nNum);
+ //nNum changed to nNumGP because already used in for loop
+ sal_uInt16 nNumGP=pGPL->FindGluePoint(nId);
+ if (nNumGP!=SDRGLUEPOINT_NOTFOUND)
+ {
+ const SdrGluePoint& rGP=(*pGPL)[nNumGP];
+ Point aPos(rGP.GetAbsolutePos(*pObj));
+ SdrHdl* pGlueHdl=new SdrHdl(aPos,HDL_GLUE);
+ pGlueHdl->SetObj(pObj);
+ pGlueHdl->SetPageView(pPV);
+ pGlueHdl->SetObjHdlNum(nId);
+ aHdl.AddHdl(pGlueHdl);
+ }
+ }
+ }
+ }
+ }
+
+ // Drehpunkt/Spiegelachse
+ AddDragModeHdl(eDragMode);
+
+ // add custom handles (used by other apps, e.g. AnchorPos)
+ AddCustomHdl();
+
+ // sort handles
+ aHdl.Sort();
+
+ // #105722# try to restore focus handle index from remembered values
+ if(bSaveOldFocus)
+ {
+ for(sal_uInt32 a(0); a < aHdl.GetHdlCount(); a++)
+ {
+ SdrHdl* pCandidate = aHdl.GetHdl(a);
+
+ if(pCandidate->GetObj()
+ && pCandidate->GetObj() == pSaveObj
+ && pCandidate->GetKind() == eSaveKind
+ && pCandidate->GetPolyNum() == nSavePolyNum
+ && pCandidate->GetPointNum() == nSavePointNum)
+ {
+ aHdl.SetFocusHdl(pCandidate);
+ break;
+ }
+ }
+ }
+ }
+}
+
+void SdrMarkView::AddCustomHdl()
+{
+ // add custom handles (used by other apps, e.g. AnchorPos)
+}
+
+void SdrMarkView::SetDragMode(SdrDragMode eMode)
+{
+ SdrDragMode eMode0=eDragMode;
+ eDragMode=eMode;
+ if (eDragMode==SDRDRAG_RESIZE) eDragMode=SDRDRAG_MOVE;
+ if (eDragMode!=eMode0) {
+ //HMHBOOL bVis=IsMarkHdlShown();
+ //HMHif (bVis) HideMarkHdl();
+ ForceRefToMarked();
+ SetMarkHandles();
+ //HMHif (bVis) ShowMarkHdl();
+ {
+ if (AreObjectsMarked()) MarkListHasChanged();
+ }
+ }
+}
+
+void SdrMarkView::AddDragModeHdl(SdrDragMode eMode)
+{
+ switch(eMode)
+ {
+ case SDRDRAG_ROTATE:
+ {
+ // add rotation center
+ SdrHdl* pHdl = new SdrHdl(aRef1, HDL_REF1);
+
+ aHdl.AddHdl(pHdl);
+
+ break;
+ }
+ case SDRDRAG_MIRROR:
+ {
+ // add mirror axis
+ SdrHdl* pHdl3 = new SdrHdl(aRef2, HDL_REF2);
+ SdrHdl* pHdl2 = new SdrHdl(aRef1, HDL_REF1);
+ SdrHdl* pHdl1 = new SdrHdlLine(*pHdl2, *pHdl3, HDL_MIRX);
+
+ pHdl1->SetObjHdlNum(1); // fuer Sortierung
+ pHdl2->SetObjHdlNum(2); // fuer Sortierung
+ pHdl3->SetObjHdlNum(3); // fuer Sortierung
+
+ aHdl.AddHdl(pHdl1); // Linie als erstes, damit als letztes im HitTest
+ aHdl.AddHdl(pHdl2);
+ aHdl.AddHdl(pHdl3);
+
+ break;
+ }
+ case SDRDRAG_TRANSPARENCE:
+ {
+ // add interactive transparence handle
+ sal_uIntPtr nMarkAnz = GetMarkedObjectCount();
+ if(nMarkAnz == 1)
+ {
+ SdrObject* pObj = GetMarkedObjectByIndex(0);
+ SdrModel* pModel = GetModel();
+ const SfxItemSet& rSet = pObj->GetMergedItemSet();
+
+ if(SFX_ITEM_SET != rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, sal_False))
+ {
+ // add this item, it's not yet there
+ XFillFloatTransparenceItem aNewItem(
+ (const XFillFloatTransparenceItem&)rSet.Get(XATTR_FILLFLOATTRANSPARENCE));
+ XGradient aGrad = aNewItem.GetGradientValue();
+
+ aNewItem.SetEnabled(sal_True);
+ aGrad.SetStartIntens(100);
+ aGrad.SetEndIntens(100);
+ aNewItem.SetGradientValue(aGrad);
+
+ // add undo to allow user to take back this step
+ if( pModel->IsUndoEnabled() )
+ {
+ pModel->BegUndo(SVX_RESSTR(SIP_XA_FILLTRANSPARENCE));
+ pModel->AddUndo(pModel->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
+ pModel->EndUndo();
+ }
+
+ //pObj->SetItemAndBroadcast(aNewItem);
+ SfxItemSet aNewSet(pModel->GetItemPool());
+ aNewSet.Put(aNewItem);
+ pObj->SetMergedItemSetAndBroadcast(aNewSet);
+ }
+
+ // set values and transform to vector set
+ GradTransformer aGradTransformer;
+ GradTransVector aGradTransVector;
+ GradTransGradient aGradTransGradient;
+
+ aGradTransGradient.aGradient = ((XFillFloatTransparenceItem&)rSet.Get(XATTR_FILLFLOATTRANSPARENCE)).GetGradientValue();
+ aGradTransformer.GradToVec(aGradTransGradient, aGradTransVector, pObj);
+
+ // build handles
+ const Point aTmpPos1(basegfx::fround(aGradTransVector.maPositionA.getX()), basegfx::fround(aGradTransVector.maPositionA.getY()));
+ const Point aTmpPos2(basegfx::fround(aGradTransVector.maPositionB.getX()), basegfx::fround(aGradTransVector.maPositionB.getY()));
+ SdrHdlColor* pColHdl1 = new SdrHdlColor(aTmpPos1, aGradTransVector.aCol1, SDR_HANDLE_COLOR_SIZE_NORMAL, sal_True);
+ SdrHdlColor* pColHdl2 = new SdrHdlColor(aTmpPos2, aGradTransVector.aCol2, SDR_HANDLE_COLOR_SIZE_NORMAL, sal_True);
+ SdrHdlGradient* pGradHdl = new SdrHdlGradient(aTmpPos1, aTmpPos2, sal_False);
+ DBG_ASSERT(pColHdl1 && pColHdl2 && pGradHdl, "Got not all necessary handles!!");
+
+ // link them
+ pGradHdl->SetColorHandles(pColHdl1, pColHdl2);
+ pGradHdl->SetObj(pObj);
+ pColHdl1->SetColorChangeHdl(LINK(pGradHdl, SdrHdlGradient, ColorChangeHdl));
+ pColHdl2->SetColorChangeHdl(LINK(pGradHdl, SdrHdlGradient, ColorChangeHdl));
+
+ // insert them
+ aHdl.AddHdl(pColHdl1);
+ aHdl.AddHdl(pColHdl2);
+ aHdl.AddHdl(pGradHdl);
+ }
+ break;
+ }
+ case SDRDRAG_GRADIENT:
+ {
+ // add interactive gradient handle
+ sal_uIntPtr nMarkAnz = GetMarkedObjectCount();
+ if(nMarkAnz == 1)
+ {
+ SdrObject* pObj = GetMarkedObjectByIndex(0);
+ const SfxItemSet& rSet = pObj->GetMergedItemSet();
+ XFillStyle eFillStyle = ((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue();
+
+ if(eFillStyle == XFILL_GRADIENT)
+ {
+ // set values and transform to vector set
+ GradTransformer aGradTransformer;
+ GradTransVector aGradTransVector;
+ GradTransGradient aGradTransGradient;
+ Size aHdlSize(15, 15);
+
+ aGradTransGradient.aGradient = ((XFillGradientItem&)rSet.Get(XATTR_FILLGRADIENT)).GetGradientValue();
+ aGradTransformer.GradToVec(aGradTransGradient, aGradTransVector, pObj);
+
+ // build handles
+ const Point aTmpPos1(basegfx::fround(aGradTransVector.maPositionA.getX()), basegfx::fround(aGradTransVector.maPositionA.getY()));
+ const Point aTmpPos2(basegfx::fround(aGradTransVector.maPositionB.getX()), basegfx::fround(aGradTransVector.maPositionB.getY()));
+ SdrHdlColor* pColHdl1 = new SdrHdlColor(aTmpPos1, aGradTransVector.aCol1, aHdlSize, sal_False);
+ SdrHdlColor* pColHdl2 = new SdrHdlColor(aTmpPos2, aGradTransVector.aCol2, aHdlSize, sal_False);
+ SdrHdlGradient* pGradHdl = new SdrHdlGradient(aTmpPos1, aTmpPos2, sal_True);
+ DBG_ASSERT(pColHdl1 && pColHdl2 && pGradHdl, "Got not all necessary handles!!");
+
+ // link them
+ pGradHdl->SetColorHandles(pColHdl1, pColHdl2);
+ pGradHdl->SetObj(pObj);
+ pColHdl1->SetColorChangeHdl(LINK(pGradHdl, SdrHdlGradient, ColorChangeHdl));
+ pColHdl2->SetColorChangeHdl(LINK(pGradHdl, SdrHdlGradient, ColorChangeHdl));
+
+ // insert them
+ aHdl.AddHdl(pColHdl1);
+ aHdl.AddHdl(pColHdl2);
+ aHdl.AddHdl(pGradHdl);
+ }
+ }
+ break;
+ }
+ case SDRDRAG_CROP:
+ {
+ // todo
+ break;
+ }
+ default: break;
+ }
+}
+
+/** handle mouse over effects for handles */
+sal_Bool SdrMarkView::MouseMove(const MouseEvent& rMEvt, Window* pWin)
+{
+ if(aHdl.GetHdlCount())
+ {
+ SdrHdl* pMouseOverHdl = 0;
+ if( !rMEvt.IsLeaveWindow() && pWin )
+ {
+ Point aMDPos( pWin->PixelToLogic( rMEvt.GetPosPixel() ) );
+ pMouseOverHdl = PickHandle(aMDPos);
+ }
+
+ // notify last mouse over handle that he lost the mouse
+ const sal_uIntPtr nHdlCount = aHdl.GetHdlCount();
+
+ for(sal_uIntPtr nHdl = 0; nHdl < nHdlCount; nHdl++ )
+ {
+ SdrHdl* pCurrentHdl = GetHdl(nHdl);
+ if( pCurrentHdl->mbMouseOver )
+ {
+ if( pCurrentHdl != pMouseOverHdl )
+ {
+ pCurrentHdl->mbMouseOver = false;
+ pCurrentHdl->onMouseLeave();
+ }
+ break;
+ }
+ }
+
+ // notify current mouse over handle
+ if( pMouseOverHdl /* && !pMouseOverHdl->mbMouseOver */ )
+ {
+ pMouseOverHdl->mbMouseOver = true;
+ pMouseOverHdl->onMouseEnter(rMEvt);
+ }
+ }
+ return SdrSnapView::MouseMove(rMEvt, pWin);
+}
+
+void SdrMarkView::ForceRefToMarked()
+{
+ switch(eDragMode)
+ {
+ case SDRDRAG_ROTATE:
+ {
+ Rectangle aR(GetMarkedObjRect());
+ aRef1 = aR.Center();
+
+ break;
+ }
+
+ case SDRDRAG_MIRROR:
+ {
+ // Erstmal die laenge der Spiegelachsenlinie berechnen
+ long nOutMin=0;
+ long nOutMax=0;
+ long nMinLen=0;
+ long nObjDst=0;
+ long nOutHgt=0;
+ OutputDevice* pOut=GetFirstOutputDevice();
+ //OutputDevice* pOut=GetWin(0);
+ if (pOut!=NULL) {
+ // Mindestlaenge 50 Pixel
+ nMinLen=pOut->PixelToLogic(Size(0,50)).Height();
+ // 20 Pixel fuer RefPt-Abstand vom Obj
+ nObjDst=pOut->PixelToLogic(Size(0,20)).Height();
+ // MinY/MaxY
+ // Abstand zum Rand = Mindestlaenge = 10 Pixel
+ long nDst=pOut->PixelToLogic(Size(0,10)).Height();
+ nOutMin=-pOut->GetMapMode().GetOrigin().Y();
+ nOutMax=pOut->GetOutputSize().Height()-1+nOutMin;
+ nOutMin+=nDst;
+ nOutMax-=nDst;
+ // Absolute Mindestlaenge jedoch 10 Pixel
+ if (nOutMax-nOutMin<nDst) {
+ nOutMin+=nOutMax+1;
+ nOutMin/=2;
+ nOutMin-=(nDst+1)/2;
+ nOutMax=nOutMin+nDst;
+ }
+ nOutHgt=nOutMax-nOutMin;
+ // Sonst Mindestlaenge = 1/4 OutHgt
+ long nTemp=nOutHgt/4;
+ if (nTemp>nMinLen) nMinLen=nTemp;
+ }
+
+ Rectangle aR(GetMarkedObjBoundRect());
+ Point aCenter(aR.Center());
+ long nMarkHgt=aR.GetHeight()-1;
+ long nHgt=nMarkHgt+nObjDst*2; // 20 Pixel obej und unten ueberstehend
+ if (nHgt<nMinLen) nHgt=nMinLen; // Mindestlaenge 50 Pixel bzw. 1/4 OutHgt
+
+ long nY1=aCenter.Y()-(nHgt+1)/2;
+ long nY2=nY1+nHgt;
+
+ if (pOut!=NULL && nMinLen>nOutHgt) nMinLen=nOutHgt; // evtl. noch etwas verkuerzen
+
+ if (pOut!=NULL) { // nun vollstaendig in den sichtbaren Bereich schieben
+ if (nY1<nOutMin) {
+ nY1=nOutMin;
+ if (nY2<nY1+nMinLen) nY2=nY1+nMinLen;
+ }
+ if (nY2>nOutMax) {
+ nY2=nOutMax;
+ if (nY1>nY2-nMinLen) nY1=nY2-nMinLen;
+ }
+ }
+
+ aRef1.X()=aCenter.X();
+ aRef1.Y()=nY1;
+ aRef2.X()=aCenter.X();
+ aRef2.Y()=nY2;
+
+ break;
+ }
+
+ case SDRDRAG_TRANSPARENCE:
+ case SDRDRAG_GRADIENT:
+ case SDRDRAG_CROP:
+ {
+ Rectangle aRect(GetMarkedObjBoundRect());
+ aRef1 = aRect.TopLeft();
+ aRef2 = aRect.BottomRight();
+ break;
+ }
+ default: break;
+ }
+}
+
+void SdrMarkView::SetRef1(const Point& rPt)
+{
+ if(eDragMode == SDRDRAG_ROTATE || eDragMode == SDRDRAG_MIRROR)
+ {
+ aRef1 = rPt;
+ SdrHdl* pH = aHdl.GetHdl(HDL_REF1);
+ if(pH)
+ pH->SetPos(rPt);
+ //HMHShowMarkHdl();
+ }
+}
+
+void SdrMarkView::SetRef2(const Point& rPt)
+{
+ if(eDragMode == SDRDRAG_MIRROR)
+ {
+ aRef2 = rPt;
+ SdrHdl* pH = aHdl.GetHdl(HDL_REF2);
+ if(pH)
+ pH->SetPos(rPt);
+ //HMHShowMarkHdl();
+ }
+}
+
+void SdrMarkView::CheckMarked()
+{
+ for (sal_uIntPtr nm=GetMarkedObjectCount(); nm>0;) {
+ nm--;
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ SdrPageView* pPV=pM->GetPageView();
+ SdrLayerID nLay=pObj->GetLayer();
+ sal_Bool bRaus=!pObj->IsInserted(); // Obj geloescht?
+ if (!pObj->Is3DObj()) {
+ bRaus=bRaus || pObj->GetPage()!=pPV->GetPage(); // Obj ploetzlich in anderer Page oder Group
+ }
+ bRaus=bRaus || pPV->GetLockedLayers().IsSet(nLay) || // Layer gesperrt?
+ !pPV->GetVisibleLayers().IsSet(nLay); // Layer nicht sichtbar?
+
+ if( !bRaus )
+ bRaus = !pObj->IsVisible(); // not visible objects can not be marked
+
+ if (!bRaus) {
+ // Joe am 9.3.1997: Gruppierte Objekten koennen nun auch
+ // markiert werden. Nach EnterGroup muessen aber die Objekte
+ // der hoeheren Ebene deselektiert werden.
+ const SdrObjList* pOOL=pObj->GetObjList();
+ const SdrObjList* pVOL=pPV->GetObjList();
+ while (pOOL!=NULL && pOOL!=pVOL) {
+ pOOL=pOOL->GetUpList();
+ }
+ bRaus=pOOL!=pVOL;
+ }
+
+ if (bRaus)
+ {
+ GetMarkedObjectListWriteAccess().DeleteMark(nm);
+ }
+ else
+ {
+ if (!IsGluePointEditMode()) { // Markierte GluePoints nur im GlueEditMode
+ SdrUShortCont* pPts=pM->GetMarkedGluePoints();
+ if (pPts!=NULL && pPts->GetCount()!=0) {
+ pPts->Clear();
+ }
+ }
+ }
+ }
+
+ // #97995# at least reset the remembered BoundRect to prevent handle
+ // generation if bForceFrameHandles is TRUE.
+ bMarkedObjRectDirty = sal_True;
+}
+
+void SdrMarkView::SetMarkRects()
+{
+ SdrPageView* pPV = GetSdrPageView();
+
+ if(pPV)
+ {
+ pPV->SetHasMarkedObj(GetSnapRectFromMarkedObjects(pPV, pPV->MarkSnap()));
+ GetBoundRectFromMarkedObjects(pPV, pPV->MarkBound());
+ }
+}
+
+void SdrMarkView::SetFrameHandles(sal_Bool bOn)
+{
+ if (bOn!=bForceFrameHandles) {
+ sal_Bool bOld=ImpIsFrameHandles();
+ bForceFrameHandles=bOn;
+ sal_Bool bNew=ImpIsFrameHandles();
+ if (bNew!=bOld) {
+ AdjustMarkHdl(); //HMHTRUE);
+ MarkListHasChanged();
+ }
+ }
+}
+
+void SdrMarkView::SetEditMode(SdrViewEditMode eMode)
+{
+ if (eMode!=eEditMode) {
+ sal_Bool bGlue0=eEditMode==SDREDITMODE_GLUEPOINTEDIT;
+ sal_Bool bEdge0=((SdrCreateView*)this)->IsEdgeTool();
+ eEditMode0=eEditMode;
+ eEditMode=eMode;
+ sal_Bool bGlue1=eEditMode==SDREDITMODE_GLUEPOINTEDIT;
+ sal_Bool bEdge1=((SdrCreateView*)this)->IsEdgeTool();
+ // etwas Aufwand um Flackern zu verhindern beim Umschalten
+ // zwischen GlueEdit und EdgeTool
+ if (bGlue1 && !bGlue0) ImpSetGlueVisible2(bGlue1);
+ if (bEdge1!=bEdge0) ImpSetGlueVisible3(bEdge1);
+ if (!bGlue1 && bGlue0) ImpSetGlueVisible2(bGlue1);
+ if (bGlue0 && !bGlue1) UnmarkAllGluePoints();
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_Bool SdrMarkView::IsObjMarkable(SdrObject* pObj, SdrPageView* pPV) const
+{
+ if (pObj)
+ {
+ if (pObj->IsMarkProtect() ||
+ (!bDesignMode && pObj->IsUnoObj()))
+ {
+ // Objekt nicht selektierbar oder
+ // SdrUnoObj nicht im DesignMode
+ return sal_False;
+ }
+ }
+ return pPV!=NULL ? pPV->IsObjMarkable(pObj) : sal_True;
+}
+
+sal_Bool SdrMarkView::IsMarkedObjHit(const Point& rPnt, short nTol) const
+{
+ sal_Bool bRet=sal_False;
+ nTol=ImpGetHitTolLogic(nTol,NULL);
+ Point aPt(rPnt);
+ for (sal_uIntPtr nm=0; nm<GetMarkedObjectCount() && !bRet; nm++) {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ bRet = 0 != CheckSingleSdrObjectHit(aPt,sal_uInt16(nTol),pM->GetMarkedSdrObj(),pM->GetPageView(),0,0);
+ }
+ return bRet;
+}
+
+SdrHdl* SdrMarkView::PickHandle(const Point& rPnt, sal_uIntPtr nOptions, SdrHdl* pHdl0) const
+{
+ if (bSomeObjChgdFlag) { // ggf. Handles neu berechnen lassen!
+ FlushComeBackTimer();
+ }
+ sal_Bool bBack=(nOptions & SDRSEARCH_BACKWARD) !=0;
+ sal_Bool bNext=(nOptions & SDRSEARCH_NEXT) !=0;
+ Point aPt(rPnt);
+ return aHdl.IsHdlListHit(aPt,bBack,bNext,pHdl0);
+}
+
+sal_Bool SdrMarkView::MarkObj(const Point& rPnt, short nTol, sal_Bool bToggle, sal_Bool bDeep)
+{
+ SdrObject* pObj;
+ SdrPageView* pPV;
+ nTol=ImpGetHitTolLogic(nTol,NULL);
+ sal_uIntPtr nOptions=SDRSEARCH_PICKMARKABLE;
+ if (bDeep) nOptions=nOptions|SDRSEARCH_DEEP;
+ sal_Bool bRet=PickObj(rPnt,(sal_uInt16)nTol,pObj,pPV,nOptions);
+ if (bRet) {
+ sal_Bool bUnmark=bToggle && IsObjMarked(pObj);
+ MarkObj(pObj,pPV,bUnmark);
+ }
+ return bRet;
+}
+
+sal_Bool SdrMarkView::MarkNextObj(sal_Bool bPrev)
+{
+ SdrPageView* pPageView = GetSdrPageView();
+
+ if(!pPageView)
+ {
+ return sal_False;
+ }
+
+ SortMarkedObjects();
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ sal_uIntPtr nChgMarkNum = ULONG_MAX; // Nummer des zu ersetzenden MarkEntries
+ sal_uIntPtr nSearchObjNum = bPrev ? 0 : ULONG_MAX;
+ if (nMarkAnz!=0) {
+ nChgMarkNum=bPrev ? 0 : sal_uIntPtr(nMarkAnz-1);
+ SdrMark* pM=GetSdrMarkByIndex(nChgMarkNum);
+ OSL_ASSERT(pM!=NULL);
+ if (pM->GetMarkedSdrObj() != NULL)
+ nSearchObjNum = pM->GetMarkedSdrObj()->GetNavigationPosition();
+ }
+
+ SdrObject* pMarkObj=NULL;
+ SdrObjList* pSearchObjList=pPageView->GetObjList();
+ sal_uIntPtr nObjAnz=pSearchObjList->GetObjCount();
+ if (nObjAnz!=0) {
+ if (nSearchObjNum>nObjAnz) nSearchObjNum=nObjAnz;
+ while (pMarkObj==NULL && ((!bPrev && nSearchObjNum>0) || (bPrev && nSearchObjNum<nObjAnz)))
+ {
+ if (!bPrev)
+ nSearchObjNum--;
+ SdrObject* pSearchObj = pSearchObjList->GetObjectForNavigationPosition(nSearchObjNum);
+ if (IsObjMarkable(pSearchObj,pPageView))
+ {
+ if (TryToFindMarkedObject(pSearchObj)==CONTAINER_ENTRY_NOTFOUND)
+ {
+ pMarkObj=pSearchObj;
+ }
+ }
+ if (bPrev) nSearchObjNum++;
+ }
+ }
+
+ if(!pMarkObj)
+ {
+ return sal_False;
+ }
+
+ if (nChgMarkNum!=ULONG_MAX)
+ {
+ GetMarkedObjectListWriteAccess().DeleteMark(nChgMarkNum);
+ }
+ MarkObj(pMarkObj,pPageView); // ruft auch MarkListHasChanged(), AdjustMarkHdl()
+ return sal_True;
+}
+
+sal_Bool SdrMarkView::MarkNextObj(const Point& rPnt, short nTol, sal_Bool bPrev)
+{
+ SortMarkedObjects();
+ nTol=ImpGetHitTolLogic(nTol,NULL);
+ Point aPt(rPnt);
+ SdrMark* pTopMarkHit=NULL;
+ SdrMark* pBtmMarkHit=NULL;
+ sal_uIntPtr nTopMarkHit=0;
+ sal_uIntPtr nBtmMarkHit=0;
+ // oberstes der markierten Objekte suchen, das von rPnt getroffen wird
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ sal_uIntPtr nm=0;
+ for (nm=nMarkAnz; nm>0 && pTopMarkHit==NULL;) {
+ nm--;
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ if(CheckSingleSdrObjectHit(aPt,sal_uInt16(nTol),pM->GetMarkedSdrObj(),pM->GetPageView(),0,0))
+ {
+ pTopMarkHit=pM;
+ nTopMarkHit=nm;
+ }
+ }
+ // Nichts gefunden, dann ganz normal ein Obj markieren.
+ if (pTopMarkHit==NULL) return MarkObj(rPnt,sal_uInt16(nTol),sal_False);
+
+ SdrObject* pTopObjHit=pTopMarkHit->GetMarkedSdrObj();
+ SdrObjList* pObjList=pTopObjHit->GetObjList();
+ SdrPageView* pPV=pTopMarkHit->GetPageView();
+ // unterstes der markierten Objekte suchen, das von rPnt getroffen wird
+ // und auf der gleichen PageView liegt wie pTopMarkHit
+ for (nm=0; nm<nMarkAnz && pBtmMarkHit==NULL; nm++) {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrPageView* pPV2=pM->GetPageView();
+ if (pPV2==pPV && CheckSingleSdrObjectHit(aPt,sal_uInt16(nTol),pM->GetMarkedSdrObj(),pPV2,0,0))
+ {
+ pBtmMarkHit=pM;
+ nBtmMarkHit=nm;
+ }
+ }
+ if (pBtmMarkHit==NULL) { pBtmMarkHit=pTopMarkHit; nBtmMarkHit=nTopMarkHit; }
+ SdrObject* pBtmObjHit=pBtmMarkHit->GetMarkedSdrObj();
+ sal_uIntPtr nObjAnz=pObjList->GetObjCount();
+
+ // #110988#
+ //sal_uIntPtr nSearchBeg=bPrev ? pBtmObjHit->GetOrdNum()+1 : pTopObjHit->GetOrdNum();
+ sal_uInt32 nSearchBeg;
+ E3dScene* pScene = NULL;
+ SdrObject* pObjHit = (bPrev) ? pBtmObjHit : pTopObjHit;
+ sal_Bool bRemap = pObjHit->ISA(E3dCompoundObject)
+ ? ((E3dCompoundObject*)pObjHit)->IsAOrdNumRemapCandidate(pScene)
+ : sal_False;
+
+ if(bPrev)
+ {
+ sal_uInt32 nOrdNumBtm(pBtmObjHit->GetOrdNum());
+
+ if(bRemap)
+ {
+ nOrdNumBtm = pScene->RemapOrdNum(nOrdNumBtm);
+ }
+
+ nSearchBeg = nOrdNumBtm + 1;
+ }
+ else
+ {
+ sal_uInt32 nOrdNumTop(pTopObjHit->GetOrdNum());
+
+ if(bRemap)
+ {
+ nOrdNumTop = pScene->RemapOrdNum(nOrdNumTop);
+ }
+
+ nSearchBeg = nOrdNumTop;
+ }
+
+ sal_uIntPtr no=nSearchBeg;
+ SdrObject* pFndObj=NULL;
+ //SdrObject* pAktObj=NULL;
+ while (pFndObj==NULL && ((!bPrev && no>0) || (bPrev && no<nObjAnz))) {
+ if (!bPrev) no--;
+ SdrObject* pObj;
+
+ if(bRemap)
+ {
+ pObj = pObjList->GetObj(pScene->RemapOrdNum(no));
+ }
+ else
+ {
+ pObj = pObjList->GetObj(no);
+ }
+
+ if (CheckSingleSdrObjectHit(aPt,sal_uInt16(nTol),pObj,pPV,SDRSEARCH_TESTMARKABLE,0))
+ {
+ if (TryToFindMarkedObject(pObj)==CONTAINER_ENTRY_NOTFOUND) {
+ pFndObj=pObj;
+ } else {
+ // hier wg. Performance ggf. noch no auf Top bzw. auf Btm stellen
+ }
+ }
+ if (bPrev) no++;
+ }
+ if (pFndObj!=NULL)
+ {
+ GetMarkedObjectListWriteAccess().DeleteMark(bPrev?nBtmMarkHit:nTopMarkHit);
+ GetMarkedObjectListWriteAccess().InsertEntry(SdrMark(pFndObj,pPV));
+ MarkListHasChanged();
+ AdjustMarkHdl(); //HMHTRUE);
+ }
+ return pFndObj!=NULL;
+}
+
+sal_Bool SdrMarkView::MarkObj(const Rectangle& rRect, sal_Bool bUnmark)
+{
+ sal_Bool bFnd=sal_False;
+ Rectangle aR(rRect);
+ SdrObject* pObj;
+ SdrObjList* pObjList;
+ BrkAction();
+ SdrPageView* pPV = GetSdrPageView();
+
+ if(pPV)
+ {
+ pObjList=pPV->GetObjList();
+ Rectangle aFrm1(aR);
+ sal_uIntPtr nObjAnz=pObjList->GetObjCount();
+ for (sal_uIntPtr nO=0; nO<nObjAnz; nO++) {
+ pObj=pObjList->GetObj(nO);
+ Rectangle aRect(pObj->GetCurrentBoundRect());
+ if (aFrm1.IsInside(aRect)) {
+ if (!bUnmark) {
+ if (IsObjMarkable(pObj,pPV))
+ {
+ GetMarkedObjectListWriteAccess().InsertEntry(SdrMark(pObj,pPV));
+ bFnd=sal_True;
+ }
+ } else {
+ sal_uIntPtr nPos=TryToFindMarkedObject(pObj);
+ if (nPos!=CONTAINER_ENTRY_NOTFOUND)
+ {
+ GetMarkedObjectListWriteAccess().DeleteMark(nPos);
+ bFnd=sal_True;
+ }
+ }
+ }
+ }
+ }
+ if (bFnd) {
+ SortMarkedObjects();
+ MarkListHasChanged();
+ AdjustMarkHdl(); //HMHTRUE);
+ //HMHShowMarkHdl();
+ }
+ return bFnd;
+}
+
+void SdrMarkView::MarkObj(SdrObject* pObj, SdrPageView* pPV, sal_Bool bUnmark, sal_Bool bImpNoSetMarkHdl)
+{
+ if (pObj!=NULL && pPV!=NULL && IsObjMarkable(pObj, pPV)) {
+ BrkAction();
+ if (!bUnmark)
+ {
+ GetMarkedObjectListWriteAccess().InsertEntry(SdrMark(pObj,pPV));
+ }
+ else
+ {
+ sal_uIntPtr nPos=TryToFindMarkedObject(pObj);
+ if (nPos!=CONTAINER_ENTRY_NOTFOUND)
+ {
+ GetMarkedObjectListWriteAccess().DeleteMark(nPos);
+ }
+ }
+ if (!bImpNoSetMarkHdl) {
+ MarkListHasChanged();
+ AdjustMarkHdl(); //HMHTRUE);
+ //HMHif (!bSomeObjChgdFlag) {
+ // ShowMarkHdl kommt sonst mit dem AfterPaintTimer
+ //HMHShowMarkHdl();
+ //HMH}
+ }
+ }
+}
+
+sal_Bool SdrMarkView::IsObjMarked(SdrObject* pObj) const
+{
+ // nicht so ganz die feine Art: Da FindObject() nicht const ist
+ // muss ich mich hier auf non-const casten.
+ sal_uIntPtr nPos=((SdrMarkView*)this)->TryToFindMarkedObject(pObj);
+ return nPos!=CONTAINER_ENTRY_NOTFOUND;
+}
+
+sal_uInt16 SdrMarkView::GetMarkHdlSizePixel() const
+{
+ return aHdl.GetHdlSize()*2+1;
+}
+
+void SdrMarkView::SetSolidMarkHdl(sal_Bool bOn)
+{
+ if (bOn!=aHdl.IsFineHdl()) {
+ //HMHBOOL bMerk=IsMarkHdlShown();
+ //HMHif (bMerk) HideMarkHdl();
+ aHdl.SetFineHdl(bOn);
+ //HMHif (bMerk) ShowMarkHdl();
+ }
+}
+
+void SdrMarkView::SetMarkHdlSizePixel(sal_uInt16 nSiz)
+{
+ if (nSiz<3) nSiz=3;
+ nSiz/=2;
+ if (nSiz!=aHdl.GetHdlSize()) {
+ //HMHBOOL bMerk=IsMarkHdlShown();
+ //HMHif (bMerk) HideMarkHdl();
+ aHdl.SetHdlSize(nSiz);
+ //HMHif (bMerk) ShowMarkHdl();
+ }
+}
+
+#define SDRSEARCH_IMPISMASTER 0x80000000 /* MasterPage wird gerade durchsucht */
+SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObject* pObj, SdrPageView* pPV, sal_uIntPtr nOptions, const SetOfByte* pMVisLay) const
+{
+ if(((nOptions & SDRSEARCH_IMPISMASTER) && pObj->IsNotVisibleAsMaster()) || (!pObj->IsVisible()))
+ {
+ return NULL;
+ }
+
+ const bool bCheckIfMarkable(nOptions & SDRSEARCH_TESTMARKABLE);
+ const bool bDeep(nOptions & SDRSEARCH_DEEP);
+ const bool bOLE(pObj->ISA(SdrOle2Obj));
+ const bool bTXT(pObj->ISA(SdrTextObj) && ((SdrTextObj*)pObj)->IsTextFrame());
+ SdrObject* pRet=NULL;
+ Rectangle aRect(pObj->GetCurrentBoundRect());
+ sal_uInt16 nTol2(nTol);
+
+ // double tolerance for OLE, text frames and objects in
+ // active text edit
+ if(bOLE || bTXT || pObj==((SdrObjEditView*)this)->GetTextEditObject())
+ {
+ nTol2*=2;
+ }
+
+ aRect.Left ()-=nTol2; // Einmal Toleranz drauf fuer alle Objekte
+ aRect.Top ()-=nTol2;
+ aRect.Right ()+=nTol2;
+ aRect.Bottom()+=nTol2;
+
+ if (aRect.IsInside(rPnt))
+ {
+ if ((!bCheckIfMarkable || IsObjMarkable(pObj,pPV)))
+ {
+ SdrObjList* pOL=pObj->GetSubList();
+
+ if (pOL!=NULL && pOL->GetObjCount()!=0)
+ {
+ SdrObject* pTmpObj;
+ // OD 30.06.2003 #108784# - adjustment hit point for virtual
+ // objects.
+ Point aPnt( rPnt );
+
+ if ( pObj->ISA(SdrVirtObj) )
+ {
+ Point aOffset = static_cast<SdrVirtObj*>(pObj)->GetOffset();
+ aPnt.Move( -aOffset.X(), -aOffset.Y() );
+ }
+
+ pRet=CheckSingleSdrObjectHit(aPnt,nTol,pOL,pPV,nOptions,pMVisLay,pTmpObj);
+ }
+ else
+ {
+ if(!pMVisLay || pMVisLay->IsSet(pObj->GetLayer()))
+ {
+ pRet = SdrObjectPrimitiveHit(*pObj, rPnt, nTol2, *pPV, &pPV->GetVisibleLayers(), false);
+ }
+ }
+ }
+ }
+
+ if (!bDeep && pRet!=NULL)
+ {
+ pRet=pObj;
+ }
+
+ return pRet;
+}
+
+SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObjList* pOL, SdrPageView* pPV, sal_uIntPtr nOptions, const SetOfByte* pMVisLay, SdrObject*& rpRootObj) const
+{
+ sal_Bool bBack=(nOptions & SDRSEARCH_BACKWARD)!=0;
+ SdrObject* pRet=NULL;
+ rpRootObj=NULL;
+ if (pOL!=NULL)
+ {
+ // #110988#
+ sal_Bool bRemap(pOL->GetOwnerObj() && pOL->GetOwnerObj()->ISA(E3dScene));
+ E3dScene* pRemapScene = (bRemap ? (E3dScene*)pOL->GetOwnerObj() : 0L);
+
+ sal_uIntPtr nObjAnz=pOL->GetObjCount();
+ sal_uIntPtr nObjNum=bBack ? 0 : nObjAnz;
+ while (pRet==NULL && (bBack ? nObjNum<nObjAnz : nObjNum>0)) {
+ if (!bBack) nObjNum--;
+ SdrObject* pObj;
+
+ // #110988#
+ if(bRemap)
+ {
+ pObj = pOL->GetObj(pRemapScene->RemapOrdNum(nObjNum));
+ }
+ else
+ {
+ pObj = pOL->GetObj(nObjNum);
+ }
+
+ pRet=CheckSingleSdrObjectHit(rPnt,nTol,pObj,pPV,nOptions,pMVisLay);
+ if (pRet!=NULL) rpRootObj=pObj;
+ if (bBack) nObjNum++;
+ }
+ }
+ return pRet;
+}
+
+sal_Bool SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uIntPtr nOptions) const
+{
+ return PickObj(rPnt,nTol,rpObj,rpPV,nOptions,NULL,NULL,NULL);
+}
+
+sal_Bool SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uIntPtr nOptions, SdrObject** ppRootObj, sal_uIntPtr* pnMarkNum, sal_uInt16* pnPassNum) const
+{ // Fehlt noch Pass2,Pass3
+ SortMarkedObjects();
+ if (ppRootObj!=NULL) *ppRootObj=NULL;
+ if (pnMarkNum!=NULL) *pnMarkNum=CONTAINER_ENTRY_NOTFOUND;
+ if (pnPassNum!=NULL) *pnPassNum=0;
+ rpObj=NULL;
+ rpPV=NULL;
+ sal_Bool bWholePage=(nOptions & SDRSEARCH_WHOLEPAGE) !=0;
+ sal_Bool bMarked=(nOptions & SDRSEARCH_MARKED) !=0;
+ sal_Bool bMasters=!bMarked && (nOptions & SDRSEARCH_ALSOONMASTER) !=0;
+ sal_Bool bBack=(nOptions & SDRSEARCH_BACKWARD) !=0;
+#if OSL_DEBUG_LEVEL > 0
+ sal_Bool bNext=(nOptions & SDRSEARCH_NEXT) !=0; (void)bNext; // n.i.
+ sal_Bool bBoundCheckOn2ndPass=(nOptions & SDRSEARCH_PASS2BOUND) !=0; (void)bBoundCheckOn2ndPass;// n.i.
+ sal_Bool bCheckNearestOn3rdPass=(nOptions & SDRSEARCH_PASS3NEAREST) !=0; (void)bCheckNearestOn3rdPass;// n.i.
+#endif
+ if (nTol<0) nTol=ImpGetHitTolLogic(nTol,NULL);
+ Point aPt(rPnt);
+ SdrObject* pObj=NULL;
+ SdrObject* pHitObj=NULL;
+ SdrPageView* pPV=NULL;
+ if (!bBack && ((SdrObjEditView*)this)->IsTextEditFrameHit(rPnt)) {
+ pObj=((SdrObjEditView*)this)->GetTextEditObject();
+ pHitObj=pObj;
+ pPV=((SdrObjEditView*)this)->GetTextEditPageView();
+ }
+ if (bMarked) {
+ sal_uIntPtr nMrkAnz=GetMarkedObjectCount();
+ sal_uIntPtr nMrkNum=bBack ? 0 : nMrkAnz;
+ while (pHitObj==NULL && (bBack ? nMrkNum<nMrkAnz : nMrkNum>0)) {
+ if (!bBack) nMrkNum--;
+ SdrMark* pM=GetSdrMarkByIndex(nMrkNum);
+ pObj=pM->GetMarkedSdrObj();
+ pPV=pM->GetPageView();
+ pHitObj=CheckSingleSdrObjectHit(aPt,nTol,pObj,pPV,nOptions,NULL);
+ if (bBack) nMrkNum++;
+ }
+ }
+ else
+ {
+ pPV = GetSdrPageView();
+
+ if(pPV)
+ {
+ SdrPage* pPage=pPV->GetPage();
+ sal_uInt16 nPgAnz=1;
+
+ if(bMasters && pPage->TRG_HasMasterPage())
+ {
+ nPgAnz++;
+ }
+
+ sal_Bool bExtraPassForWholePage=bWholePage && pPage!=pPV->GetObjList();
+ if (bExtraPassForWholePage) nPgAnz++; // Suche erst in AktObjList, dann auf der gesamten Page
+ sal_uInt16 nPgNum=bBack ? 0 : nPgAnz;
+ while (pHitObj==NULL && (bBack ? nPgNum<nPgAnz : nPgNum>0)) {
+ sal_uIntPtr nTmpOptions=nOptions;
+ if (!bBack) nPgNum--;
+ const SetOfByte* pMVisLay=NULL;
+ SdrObjList* pObjList=NULL;
+ if (pnPassNum!=NULL) *pnPassNum&=~(SDRSEARCHPASS_MASTERPAGE|SDRSEARCHPASS_INACTIVELIST);
+ if (nPgNum>=nPgAnz-1 || (bExtraPassForWholePage && nPgNum>=nPgAnz-2))
+ {
+ pObjList=pPV->GetObjList();
+ if (bExtraPassForWholePage && nPgNum==nPgAnz-2) {
+ pObjList=pPage;
+ if (pnPassNum!=NULL) *pnPassNum|=SDRSEARCHPASS_INACTIVELIST;
+ }
+ }
+ else
+ {
+ // sonst MasterPage
+ SdrPage& rMasterPage = pPage->TRG_GetMasterPage();
+ pMVisLay = &pPage->TRG_GetMasterPageVisibleLayers();
+ pObjList = &rMasterPage;
+
+ if (pnPassNum!=NULL) *pnPassNum|=SDRSEARCHPASS_MASTERPAGE;
+ nTmpOptions=nTmpOptions | SDRSEARCH_IMPISMASTER;
+ }
+ pHitObj=CheckSingleSdrObjectHit(aPt,nTol,pObjList,pPV,nTmpOptions,pMVisLay,pObj);
+ if (bBack) nPgNum++;
+ }
+ }
+ }
+ if (pHitObj!=NULL) {
+ if (ppRootObj!=NULL) *ppRootObj=pObj;
+ if ((nOptions & SDRSEARCH_DEEP) !=0) pObj=pHitObj;
+ if ((nOptions & SDRSEARCH_TESTTEXTEDIT) !=0) {
+ if (!pObj->HasTextEdit() || pPV->GetLockedLayers().IsSet(pObj->GetLayer())) {
+ pObj=NULL;
+ }
+ }
+ if (pObj!=NULL && (nOptions & SDRSEARCH_TESTMACRO) !=0) {
+ SdrObjMacroHitRec aHitRec;
+ aHitRec.aPos=aPt;
+ aHitRec.aDownPos=aPt;
+ aHitRec.nTol=nTol;
+ aHitRec.pVisiLayer=&pPV->GetVisibleLayers();
+ aHitRec.pPageView=pPV;
+ 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(!SdrObjectPrimitiveHit(*pObj, aPt, 0, *pPV, 0, true))
+ {
+ pObj = 0;
+ }
+ }
+ if (pObj!=NULL) {
+ rpObj=pObj;
+ rpPV=pPV;
+ if (pnPassNum!=NULL) *pnPassNum|=SDRSEARCHPASS_DIRECT;
+ }
+ }
+ return rpObj!=NULL;
+}
+
+sal_Bool SdrMarkView::PickMarkedObj(const Point& rPnt, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uIntPtr* pnMarkNum, sal_uIntPtr nOptions) const
+{
+ SortMarkedObjects();
+ sal_Bool bBoundCheckOn2ndPass=(nOptions & SDRSEARCH_PASS2BOUND) !=0;
+ sal_Bool bCheckNearestOn3rdPass=(nOptions & SDRSEARCH_PASS3NEAREST) !=0;
+ rpObj=NULL;
+ rpPV=NULL;
+ if (pnMarkNum!=NULL) *pnMarkNum=CONTAINER_ENTRY_NOTFOUND;
+ Point aPt(rPnt);
+ sal_uInt16 nTol=(sal_uInt16)nHitTolLog;
+ sal_Bool bFnd=sal_False;
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ sal_uIntPtr nMarkNum;
+ for (nMarkNum=nMarkAnz; nMarkNum>0 && !bFnd;) {
+ nMarkNum--;
+ SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
+ SdrPageView* pPV=pM->GetPageView();
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ bFnd = 0 != CheckSingleSdrObjectHit(aPt,nTol,pObj,pPV,SDRSEARCH_TESTMARKABLE,0);
+ if (bFnd) {
+ rpObj=pObj;
+ rpPV=pPV;
+ if (pnMarkNum!=NULL) *pnMarkNum=nMarkNum;
+ }
+ }
+ if ((bBoundCheckOn2ndPass || bCheckNearestOn3rdPass) && !bFnd) {
+ SdrObject* pBestObj=NULL;
+ SdrPageView* pBestPV=NULL;
+ sal_uIntPtr nBestMarkNum=0;
+ sal_uIntPtr nBestDist=ULONG_MAX;
+ for (nMarkNum=nMarkAnz; nMarkNum>0 && !bFnd;) {
+ nMarkNum--;
+ SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
+ SdrPageView* pPV=pM->GetPageView();
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ Rectangle aRect(pObj->GetCurrentBoundRect());
+ aRect.Left ()-=nTol;
+ aRect.Top ()-=nTol;
+ aRect.Right ()+=nTol;
+ aRect.Bottom()+=nTol;
+ if (aRect.IsInside(aPt)) {
+ bFnd=sal_True;
+ rpObj=pObj;
+ rpPV=pPV;
+ if (pnMarkNum!=NULL) *pnMarkNum=nMarkNum;
+ } else if (bCheckNearestOn3rdPass) {
+ sal_uIntPtr nDist=0;
+ if (aPt.X()<aRect.Left()) nDist+=aRect.Left()-aPt.X();
+ if (aPt.X()>aRect.Right()) nDist+=aPt.X()-aRect.Right();
+ if (aPt.Y()<aRect.Top()) nDist+=aRect.Top()-aPt.Y();
+ if (aPt.Y()>aRect.Bottom()) nDist+=aPt.Y()-aRect.Bottom();
+ if (nDist<nBestDist) {
+ pBestObj=pObj;
+ pBestPV=pPV;
+ nBestMarkNum=nMarkNum;
+ }
+ }
+ }
+ if (bCheckNearestOn3rdPass && !bFnd) {
+ rpObj=pBestObj;
+ rpPV=pBestPV;
+ if (pnMarkNum!=NULL) *pnMarkNum=nBestMarkNum;
+ bFnd=pBestObj!=NULL;
+ }
+ }
+ return bFnd;
+}
+
+SdrHitKind SdrMarkView::PickSomething(const Point& rPnt, short nTol) const
+{
+ nTol=ImpGetHitTolLogic(nTol,NULL);
+ SdrHitKind eRet=SDRHIT_NONE;
+ Point aPt(rPnt);
+ SdrObject* pObj=NULL;
+ SdrPageView* pPV=NULL;
+ if (eRet==SDRHIT_NONE && PickObj(rPnt,sal_uInt16(nTol),pObj,pPV,SDRSEARCH_PICKMARKABLE)) {
+ Rectangle aRct1(aPt-Point(nTol,nTol),aPt+Point(nTol,nTol)); // HitRect fuer Toleranz
+ Rectangle aBR(pObj->GetCurrentBoundRect());
+ if (aRct1.IsInside(aBR.TopLeft())) eRet=SDRHIT_BOUNDTL;
+ else if (aRct1.IsInside(aBR.TopCenter())) eRet=SDRHIT_BOUNDTC;
+ else if (aRct1.IsInside(aBR.TopRight())) eRet=SDRHIT_BOUNDTR;
+ else if (aRct1.IsInside(aBR.LeftCenter())) eRet=SDRHIT_BOUNDCL;
+ else if (aRct1.IsInside(aBR.RightCenter())) eRet=SDRHIT_BOUNDCR;
+ else if (aRct1.IsInside(aBR.BottomLeft())) eRet=SDRHIT_BOUNDBL;
+ else if (aRct1.IsInside(aBR.BottomCenter())) eRet=SDRHIT_BOUNDBC;
+ else if (aRct1.IsInside(aBR.BottomRight())) eRet=SDRHIT_BOUNDBR;
+ else eRet=SDRHIT_OBJECT;
+ }
+ return eRet;
+}
+
+void SdrMarkView::UnmarkAllObj(SdrPageView* pPV)
+{
+ if (GetMarkedObjectCount()!=0) {
+ BrkAction();
+ //HMHBOOL bVis=bHdlShown;
+ //HMHif (bVis) HideMarkHdl();
+ if (pPV!=NULL)
+ {
+ GetMarkedObjectListWriteAccess().DeletePageView(*pPV);
+ }
+ else
+ {
+ GetMarkedObjectListWriteAccess().Clear();
+ }
+ pMarkedObj=NULL;
+ pMarkedPV=NULL;
+ MarkListHasChanged();
+ AdjustMarkHdl(); //HMHTRUE);
+ //HMHif (bVis) ShowMarkHdl(); // ggf. fuer die RefPoints
+ }
+}
+
+void SdrMarkView::MarkAllObj(SdrPageView* _pPV)
+{
+ BrkAction();
+ //HMHHideMarkHdl();
+
+ if(!_pPV)
+ {
+ _pPV = GetSdrPageView();
+ }
+
+ // #i69171# _pPV may still be NULL if there is no SDrPageView (!), e.g. when inserting
+ // other files
+ if(_pPV)
+ {
+ const bool bMarkChg(GetMarkedObjectListWriteAccess().InsertPageView(*_pPV));
+
+ if(bMarkChg)
+ {
+ MarkListHasChanged();
+ }
+ }
+
+ if(GetMarkedObjectCount())
+ {
+ AdjustMarkHdl(); //HMHTRUE);
+ //HMHShowMarkHdl();
+ }
+}
+
+void SdrMarkView::AdjustMarkHdl() //HMHBOOL bRestraintPaint)
+{
+ //HMHBOOL bVis=bHdlShown;
+ //HMHif (bVis) HideMarkHdl();
+ CheckMarked();
+ SetMarkRects();
+ SetMarkHandles();
+ //HMHif(bRestraintPaint && bVis)
+ //HMH{
+ //HMH ShowMarkHdl();
+ //HMH}
+}
+
+Rectangle SdrMarkView::GetMarkedObjBoundRect() const
+{
+ Rectangle aRect;
+ for (sal_uIntPtr nm=0; nm<GetMarkedObjectCount(); nm++) {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pO=pM->GetMarkedSdrObj();
+ Rectangle aR1(pO->GetCurrentBoundRect());
+ if (aRect.IsEmpty()) aRect=aR1;
+ else aRect.Union(aR1);
+ }
+ return aRect;
+}
+
+const Rectangle& SdrMarkView::GetMarkedObjRect() const
+{
+ if (bMarkedObjRectDirty) {
+ ((SdrMarkView*)this)->bMarkedObjRectDirty=sal_False;
+ Rectangle aRect;
+ for (sal_uIntPtr nm=0; nm<GetMarkedObjectCount(); nm++) {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pO=pM->GetMarkedSdrObj();
+ Rectangle aR1(pO->GetSnapRect());
+ if (aRect.IsEmpty()) aRect=aR1;
+ else aRect.Union(aR1);
+ }
+ ((SdrMarkView*)this)->aMarkedObjRect=aRect;
+ }
+ return aMarkedObjRect;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrMarkView::ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, XubString& rStr, sal_uInt16 nVal, sal_uInt16 nOpt) const
+{
+ rStr = ImpGetResStr(nStrCacheID);
+ xub_StrLen nPos = rStr.SearchAscii("%1");
+
+ if(nPos != STRING_NOTFOUND)
+ {
+ rStr.Erase(nPos, 2);
+
+ if(nOpt == IMPSDR_POINTSDESCRIPTION)
+ {
+ rStr.Insert(GetDescriptionOfMarkedPoints(), nPos);
+ }
+ else if(nOpt == IMPSDR_GLUEPOINTSDESCRIPTION)
+ {
+ rStr.Insert(GetDescriptionOfMarkedGluePoints(), nPos);
+ }
+ else
+ {
+ rStr.Insert(GetDescriptionOfMarkedObjects(), nPos);
+ }
+ }
+
+ nPos = rStr.SearchAscii("%2");
+
+ if(nPos != STRING_NOTFOUND)
+ {
+ rStr.Erase(nPos, 2);
+ rStr.Insert(UniString::CreateFromInt32(nVal), nPos);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_Bool SdrMarkView::EnterMarkedGroup()
+{
+ sal_Bool bRet=sal_False;
+ // Es wird nur die erste gefundene Gruppe (also nur in einer PageView) geentert
+ // Weil PageView::EnterGroup ein AdjustMarkHdl ruft.
+ // Das muss ich per Flag mal unterbinden vvvvvvvv
+ SdrPageView* pPV = GetSdrPageView();
+
+ if(pPV)
+ {
+ sal_Bool bEnter=sal_False;
+ for (sal_uInt32 nm(GetMarkedObjectCount()); nm > 0 && !bEnter;)
+ {
+ nm--;
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ if (pM->GetPageView()==pPV) {
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ if (pObj->IsGroupObject()) {
+ if (pPV->EnterGroup(pObj)) {
+ bRet=sal_True;
+ bEnter=sal_True;
+ }
+ }
+ }
+ }
+ }
+ return bRet;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrMarkView::MarkListHasChanged()
+{
+ GetMarkedObjectListWriteAccess().SetNameDirty();
+ SetEdgesOfMarkedNodesDirty(); // bEdgesOfMarkedNodesDirty=sal_True;
+
+ bMarkedObjRectDirty=sal_True;
+ bMarkedPointsRectsDirty=sal_True;
+#ifdef DBG_UTIL
+ if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
+#endif
+ sal_Bool bOneEdgeMarked=sal_False;
+ if (GetMarkedObjectCount()==1) {
+ const SdrObject* pObj=GetMarkedObjectByIndex(0);
+ if (pObj->GetObjInventor()==SdrInventor) {
+ sal_uInt16 nIdent=pObj->GetObjIdentifier();
+ bOneEdgeMarked=nIdent==OBJ_EDGE;
+ }
+ }
+ ImpSetGlueVisible4(bOneEdgeMarked);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrMarkView::SetMoveOutside(sal_Bool bOn)
+{
+ aHdl.SetMoveOutside(bOn);
+}
+
+sal_Bool SdrMarkView::IsMoveOutside() const
+{
+ return aHdl.IsMoveOutside();
+}
+
+void SdrMarkView::SetDesignMode( sal_Bool _bOn )
+{
+ if ( bDesignMode != _bOn )
+ {
+ bDesignMode = _bOn;
+ SdrPageView* pPageView = GetSdrPageView();
+ if ( pPageView )
+ pPageView->SetDesignMode( _bOn );
+ }
+}
+
+// MarkHandles Objektaenderung:
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// - Bei Notify mit HINT_OBJCHG (oder so) werden die Handles erstmal versteckt
+// (wenn nicht schon wegen Dragging versteckt).
+// - XorHdl: Bei ModelHasChanged() werden sie dann wieder angezeigt.
+// - PaintEvents kommen nun durch.
+// - Die XorHandles werden z.T. wieder uebermalt.
+// - Xor: Nach dem Painten werden die Handles im (vom PaintHandler gerufenen)
+// CompleteRedraw per ToggleShownXor bei gesetzter ClipRegion nochmal gemalt
+// und damit ist alles in Butter.
+// - ToggleShownXor macht bei SolidHdl nix weil bHdlShown=FALSE
+// - Der AfterPaintTimer wird gestartet.
+// - SolidHdl: Im AfterPaintHandler wird ShowMarkHdl gerufen.
+// Da die Handles zu diesem Zeitpunkt nicht angezeigt sind wird:
+// - SaveBackground durchgefuehrt.
+// - DrawMarkHdl gerufen und bHdlShown gesetzt.
+//
+// MarkHandles bei sonstigem Invalidate:
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// In diesem Fall bekomme ich kein Notify und beim Aufruf des
+// PaintHandlers->CompleteRedraw() sind auch die SolidHandles sichtbar.
+
diff --git a/svx/source/svdraw/svdmrkv1.cxx b/svx/source/svdraw/svdmrkv1.cxx
new file mode 100644
index 000000000000..a1d2a2ecae9d
--- /dev/null
+++ b/svx/source/svdraw/svdmrkv1.cxx
@@ -0,0 +1,724 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svdmrkv.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/svdoedge.hxx>
+#include "svx/svdglob.hxx"
+#include <svx/svdpagv.hxx>
+#include <svx/svdpage.hxx>
+#include "svddrgm1.hxx"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@@ @@ @@ @@ @@ @@ @@ @@@@@@ @@ @@ @@@@ @@@@@ @@ @@ @@ @@@@@ @@@@@ @@ @@ @@ @@ @@@@
+// @@ @@ @@ @@ @@@ @@ @@ @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@
+// @@ @@ @@ @@ @@@@@@ @@ @@ @@ @@@@@@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@@@@@ @@
+// @@@@@ @@ @@ @@@@@@ @@@@ @@ @@@@@@@ @@@@@@ @@@@@ @@@@ @@ @@@@ @@@@@ @@ @@ @@@@@@ @@ @@@
+// @@ @@ @@ @@ @@@ @@ @@ @@ @@ @ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@@@@ @@ @@ @@@@ @@ @@ @@@@@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_Bool SdrMarkView::HasMarkablePoints() const
+{
+ ForceUndirtyMrkPnt();
+ bool bRet=false;
+ if (!ImpIsFrameHandles()) {
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ if (nMarkAnz<=nFrameHandlesLimit) {
+ for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz && !bRet; nMarkNum++) {
+ const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
+ const SdrObject* pObj=pM->GetMarkedSdrObj();
+ bRet=pObj->IsPolyObj();
+ }
+ }
+ }
+ return bRet;
+}
+
+sal_uIntPtr SdrMarkView::GetMarkablePointCount() const
+{
+ ForceUndirtyMrkPnt();
+ sal_uIntPtr nAnz=0;
+ if (!ImpIsFrameHandles()) {
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ if (nMarkAnz<=nFrameHandlesLimit) {
+ for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++) {
+ const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
+ const SdrObject* pObj=pM->GetMarkedSdrObj();
+ if (pObj->IsPolyObj()) {
+ nAnz+=pObj->GetPointCount();
+ }
+ }
+ }
+ }
+ return nAnz;
+}
+
+sal_Bool SdrMarkView::HasMarkedPoints() const
+{
+ ForceUndirtyMrkPnt();
+ sal_Bool bRet=sal_False;
+ if (!ImpIsFrameHandles()) {
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ if (nMarkAnz<=nFrameHandlesLimit) {
+ for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz && !bRet; nMarkNum++) {
+ const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
+ const SdrUShortCont* pPts=pM->GetMarkedPoints();
+ bRet=pPts!=NULL && pPts->GetCount()!=0;
+ }
+ }
+ }
+ return bRet;
+}
+
+sal_uIntPtr SdrMarkView::GetMarkedPointCount() const
+{
+ ForceUndirtyMrkPnt();
+ sal_uIntPtr nAnz=0;
+ if (!ImpIsFrameHandles()) {
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ if (nMarkAnz<=nFrameHandlesLimit) {
+ for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++) {
+ const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
+ const SdrUShortCont* pPts=pM->GetMarkedPoints();
+ if (pPts!=NULL) nAnz+=pPts->GetCount();
+ }
+ }
+ }
+ return nAnz;
+}
+
+sal_Bool SdrMarkView::IsPointMarkable(const SdrHdl& rHdl) const
+{
+ return !ImpIsFrameHandles() && &rHdl!=NULL && !rHdl.IsPlusHdl() && rHdl.GetKind()!=HDL_GLUE && rHdl.GetKind()!=HDL_SMARTTAG && rHdl.GetObj()!=NULL && rHdl.GetObj()->IsPolyObj();
+}
+
+sal_Bool SdrMarkView::MarkPointHelper(SdrHdl* pHdl, SdrMark* pMark, sal_Bool bUnmark)
+{
+ return ImpMarkPoint( pHdl, pMark, bUnmark );
+}
+
+sal_Bool SdrMarkView::ImpMarkPoint(SdrHdl* pHdl, SdrMark* pMark, sal_Bool bUnmark)
+{
+ if (pHdl==NULL || pHdl->IsPlusHdl() || pHdl->GetKind()==HDL_GLUE)
+ return sal_False;
+
+ if (pHdl->IsSelected() != bUnmark)
+ return sal_False;
+
+ SdrObject* pObj=pHdl->GetObj();
+ if (pObj==NULL || !pObj->IsPolyObj())
+ return sal_False;
+
+ if (pMark==NULL)
+ {
+ sal_uIntPtr nMarkNum=TryToFindMarkedObject(pObj);
+ if (nMarkNum==CONTAINER_ENTRY_NOTFOUND)
+ return sal_False;
+ pMark=GetSdrMarkByIndex(nMarkNum);
+ }
+ const sal_uInt32 nHdlNum(pHdl->GetObjHdlNum());
+ SdrUShortCont* pPts=pMark->ForceMarkedPoints();
+ if (!bUnmark)
+ {
+ pPts->Insert((sal_uInt16)nHdlNum);
+ }
+ else
+ {
+ sal_uIntPtr nBla=pPts->GetPos((sal_uInt16)nHdlNum);
+ if (nBla!=CONTAINER_ENTRY_NOTFOUND)
+ {
+ pPts->Remove(nBla);
+ }
+ else
+ {
+ return sal_False; // Fehlerfall!
+ }
+ }
+
+ pHdl->SetSelected(!bUnmark);
+ if (!bPlusHdlAlways)
+ {
+ if (!bUnmark)
+ {
+ sal_uInt32 nAnz(pObj->GetPlusHdlCount(*pHdl));
+ for (sal_uInt32 i=0; i<nAnz; i++)
+ {
+ SdrHdl* pPlusHdl=pObj->GetPlusHdl(*pHdl,i);
+ if (pPlusHdl!=NULL)
+ {
+ pPlusHdl->SetObj(pObj);
+ pPlusHdl->SetPageView(pMark->GetPageView());
+ pPlusHdl->SetPlusHdl(sal_True);
+ aHdl.AddHdl(pPlusHdl);
+ }
+ }
+ }
+ else
+ {
+ for (sal_uIntPtr i = aHdl.GetHdlCount(); i>0;)
+ {
+ i--;
+ SdrHdl* pPlusHdl=aHdl.GetHdl(i);
+ if (pPlusHdl->IsPlusHdl() && pPlusHdl->GetSourceHdlNum()==nHdlNum)
+ {
+ aHdl.RemoveHdl(i);
+ delete pPlusHdl;
+ }
+ }
+ }
+ }
+
+ // #97016# II: Sort handles. This was missing in ImpMarkPoint all the time.
+ aHdl.Sort();
+
+ return sal_True;
+}
+
+
+sal_Bool SdrMarkView::MarkPoint(SdrHdl& rHdl, sal_Bool bUnmark)
+{
+ if (&rHdl==NULL) return sal_False;
+ ForceUndirtyMrkPnt();
+ sal_Bool bRet=sal_False;
+ const SdrObject* pObj=rHdl.GetObj();
+ if (IsPointMarkable(rHdl) && rHdl.IsSelected()==bUnmark) {
+ sal_uIntPtr nMarkNum=TryToFindMarkedObject(pObj);
+ if (nMarkNum!=CONTAINER_ENTRY_NOTFOUND) {
+ SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
+ SdrUShortCont* pPts=pM->ForceMarkedPoints();
+ pPts->ForceSort();
+ if (ImpMarkPoint(&rHdl,pM,bUnmark)) {
+ pPts->ForceSort();
+ MarkListHasChanged();
+ bRet=sal_True;
+ }
+ }
+ }
+
+ return bRet;
+}
+
+sal_Bool SdrMarkView::MarkPoints(const Rectangle* pRect, sal_Bool bUnmark)
+{
+ ForceUndirtyMrkPnt();
+ sal_Bool bChgd=sal_False;
+ SortMarkedObjects();
+ const SdrObject* pObj0=NULL;
+ const SdrPageView* pPV0=NULL;
+ SdrMark* pM=NULL;
+ aHdl.Sort();
+ //HMHBOOL bHideHdl=IsMarkHdlShown() && IsSolidMarkHdl() && !bPlusHdlAlways;
+ sal_uIntPtr nHdlAnz=aHdl.GetHdlCount();
+ for (sal_uIntPtr nHdlNum=nHdlAnz; nHdlNum>0;) {
+ nHdlNum--;
+ SdrHdl* pHdl=aHdl.GetHdl(nHdlNum);
+ if (IsPointMarkable(*pHdl) && pHdl->IsSelected()==bUnmark) {
+ const SdrObject* pObj=pHdl->GetObj();
+ const SdrPageView* pPV=pHdl->GetPageView();
+ if (pObj!=pObj0 || pPV!=pPV0 || pM==NULL) { // Dieser Abschnitt dient zur Optimierung,
+ if (pM!=NULL) {
+ SdrUShortCont* pPts=pM->GetMarkedPoints();
+ if (pPts!=NULL) pPts->ForceSort();
+ }
+ sal_uIntPtr nMarkNum=TryToFindMarkedObject(pObj); // damit ImpMarkPoint() nicht staendig das
+ if (nMarkNum!=CONTAINER_ENTRY_NOTFOUND) { // Objekt in der MarkList suchen muss.
+ pM=GetSdrMarkByIndex(nMarkNum);
+ pObj0=pObj;
+ pPV0=pPV;
+ SdrUShortCont* pPts=pM->ForceMarkedPoints();
+ pPts->ForceSort();
+ } else {
+#ifdef DBG_UTIL
+ if (pObj->IsInserted()) {
+ DBG_ERROR("SdrMarkView::MarkPoints(const Rectangle* pRect): Markiertes Objekt nicht gefunden");
+ }
+#endif
+ pM=NULL;
+ }
+ }
+ Point aPos(pHdl->GetPos());
+ if (pM!=NULL && (pRect==NULL || pRect->IsInside(aPos))) {
+ //HMHif (bHideHdl && IsMarkHdlShown() && pHdl->GetObj()!=NULL) {
+ //HMHsal_uInt32 nAnz=pHdl->GetObj()->GetPlusHdlCount(*pHdl);
+ //HMHif (nAnz!=0L) HideMarkHdl(); // #36987#
+ //HMH}
+ if (ImpMarkPoint(pHdl,pM,bUnmark)) bChgd=sal_True;
+ }
+ }
+ }
+ if (pM!=NULL) { // Den zuletzt geaenderten MarkEntry ggf. noch aufraeumen
+ SdrUShortCont* pPts=pM->GetMarkedPoints();
+ if (pPts!=NULL) pPts->ForceSort();
+ }
+ //HMHif (bHideHdl) ShowMarkHdl(); // #36987#
+ if (bChgd) {
+ MarkListHasChanged();
+ }
+
+ return bChgd;
+}
+
+sal_Bool SdrMarkView::MarkNextPoint(sal_Bool /*bPrev*/)
+{
+ ForceUndirtyMrkPnt();
+ sal_Bool bChgd=sal_False;
+ SortMarkedObjects();
+ // ...
+ if (bChgd) {
+ MarkListHasChanged();
+ }
+ return bChgd;
+}
+
+sal_Bool SdrMarkView::MarkNextPoint(const Point& /*rPnt*/, sal_Bool /*bPrev*/)
+{
+ ForceUndirtyMrkPnt();
+ sal_Bool bChgd=sal_False;
+ SortMarkedObjects();
+ // ...
+ if (bChgd) {
+ MarkListHasChanged();
+ }
+ return bChgd;
+}
+
+const Rectangle& SdrMarkView::GetMarkedPointsRect() const
+{
+ ForceUndirtyMrkPnt();
+ if (bMarkedPointsRectsDirty) ImpSetPointsRects();
+ return aMarkedPointsRect;
+}
+
+void SdrMarkView::SetPlusHandlesAlwaysVisible(sal_Bool bOn)
+{ // HandlePaint optimieren !!!!!!!
+ ForceUndirtyMrkPnt();
+ if (bOn!=bPlusHdlAlways) {
+ //HMHBOOL bVis=IsMarkHdlShown();
+ //HMHif (bVis) HideMarkHdl();
+ bPlusHdlAlways=bOn;
+ SetMarkHandles();
+ //HMHif (bVis) ShowMarkHdl();
+ MarkListHasChanged();
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// ImpSetPointsRects() ist fuer PolyPoints und GluePoints!
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrMarkView::ImpSetPointsRects() const
+{
+ Rectangle aPnts;
+ Rectangle aGlue;
+ sal_uIntPtr nHdlAnz=aHdl.GetHdlCount();
+ for (sal_uIntPtr nHdlNum=0; nHdlNum<nHdlAnz; nHdlNum++) {
+ const SdrHdl* pHdl=aHdl.GetHdl(nHdlNum);
+ SdrHdlKind eKind=pHdl->GetKind();
+ if ((eKind==HDL_POLY && pHdl->IsSelected()) || eKind==HDL_GLUE) {
+ Point aPt(pHdl->GetPos());
+ Rectangle& rR=eKind==HDL_GLUE ? aGlue : aPnts;
+ if (rR.IsEmpty()) {
+ rR=Rectangle(aPt,aPt);
+ } else {
+ if (aPt.X()<rR.Left ()) rR.Left ()=aPt.X();
+ if (aPt.X()>rR.Right ()) rR.Right ()=aPt.X();
+ if (aPt.Y()<rR.Top ()) rR.Top ()=aPt.Y();
+ if (aPt.Y()>rR.Bottom()) rR.Bottom()=aPt.Y();
+ }
+ }
+ }
+ ((SdrMarkView*)this)->aMarkedPointsRect=aPnts;
+ ((SdrMarkView*)this)->aMarkedGluePointsRect=aGlue;
+ ((SdrMarkView*)this)->bMarkedPointsRectsDirty=sal_False;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// UndirtyMrkPnt() ist fuer PolyPoints und GluePoints!
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrMarkView::UndirtyMrkPnt() const
+{
+ sal_Bool bChg=sal_False;
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++) {
+ SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
+ const SdrObject* pObj=pM->GetMarkedSdrObj();
+ // PolyPoints
+ SdrUShortCont* pPts=pM->GetMarkedPoints();
+ if (pPts!=NULL) {
+ if (pObj->IsPolyObj()) {
+ // Ungueltig markierte Punkte entfernen, also alle
+ // Eintraege die groesser sind als die Punktanzahl des Objekts
+ sal_uInt32 nMax(pObj->GetPointCount());
+ sal_uInt32 nPtNum(0xffffffff);
+
+ pPts->ForceSort();
+
+ for (sal_uInt32 nIndex(pPts->GetCount()); nIndex > 0L && nPtNum >= nMax;)
+ {
+ nIndex--;
+ nPtNum = pPts->GetObject(nIndex);
+
+ if(nPtNum >= nMax)
+ {
+ pPts->Remove(nIndex);
+ bChg = sal_True;
+ }
+ }
+ }
+ else
+ {
+ DBG_ERROR("SdrMarkView::UndirtyMrkPnt(): Markierte Punkte an einem Objekt, dass kein PolyObj ist!");
+ if(pPts && pPts->GetCount())
+ {
+ pPts->Clear();
+ bChg = sal_True;
+ }
+ }
+ }
+
+ // GluePoints
+ pPts=pM->GetMarkedGluePoints();
+ const SdrGluePointList* pGPL=pObj->GetGluePointList();
+ if (pPts!=NULL) {
+ if (pGPL!=NULL) {
+ // Ungueltig markierte Klebepunkte entfernen, also alle
+ // Eintraege (Id's) die nicht in der GluePointList des
+ // Objekts enthalten sind
+ pPts->ForceSort();
+ for (sal_uIntPtr nIndex=pPts->GetCount(); nIndex>0;) {
+ nIndex--;
+ sal_uInt16 nId=pPts->GetObject(nIndex);
+ if (pGPL->FindGluePoint(nId)==SDRGLUEPOINT_NOTFOUND) {
+ pPts->Remove(nIndex);
+ bChg=sal_True;
+ }
+ }
+ } else {
+ if (pPts!=NULL && pPts->GetCount()!=0) {
+ pPts->Clear(); // Objekt hat keine Klebepunkte (mehr)
+ bChg=sal_True;
+ }
+ }
+ }
+ }
+ if (bChg) ((SdrMarkView*)this)->bMarkedPointsRectsDirty=sal_True;
+ ((SdrMarkView*)this)->bMrkPntDirty=sal_False;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_Bool SdrMarkView::HasMarkableGluePoints() const
+{
+ sal_Bool bRet=sal_False;
+ if (IsGluePointEditMode()) {
+ ForceUndirtyMrkPnt();
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz && !bRet; nMarkNum++) {
+ const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
+ const SdrObject* pObj=pM->GetMarkedSdrObj();
+ const SdrGluePointList* pGPL=pObj->GetGluePointList();
+
+ // #i38892#
+ if(pGPL && pGPL->GetCount())
+ {
+ for(sal_uInt16 a(0); !bRet && a < pGPL->GetCount(); a++)
+ {
+ if((*pGPL)[a].IsUserDefined())
+ {
+ bRet = sal_True;
+ }
+ }
+ }
+ }
+ }
+ return bRet;
+}
+
+sal_uIntPtr SdrMarkView::GetMarkableGluePointCount() const
+{
+ sal_uIntPtr nAnz=0;
+ if (IsGluePointEditMode()) {
+ ForceUndirtyMrkPnt();
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++) {
+ const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
+ const SdrObject* pObj=pM->GetMarkedSdrObj();
+ const SdrGluePointList* pGPL=pObj->GetGluePointList();
+
+ // #i38892#
+ if(pGPL && pGPL->GetCount())
+ {
+ for(sal_uInt16 a(0); a < pGPL->GetCount(); a++)
+ {
+ if((*pGPL)[a].IsUserDefined())
+ {
+ nAnz++;
+ }
+ }
+ }
+ }
+ }
+ return nAnz;
+}
+
+sal_Bool SdrMarkView::HasMarkedGluePoints() const
+{
+ ForceUndirtyMrkPnt();
+ sal_Bool bRet=sal_False;
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz && !bRet; nMarkNum++) {
+ const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
+ const SdrUShortCont* pPts=pM->GetMarkedGluePoints();
+ bRet=pPts!=NULL && pPts->GetCount()!=0;
+ }
+ return bRet;
+}
+
+sal_uIntPtr SdrMarkView::GetMarkedGluePointCount() const
+{
+ ForceUndirtyMrkPnt();
+ sal_uIntPtr nAnz=0;
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++) {
+ const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
+ const SdrUShortCont* pPts=pM->GetMarkedGluePoints();
+ if (pPts!=NULL) nAnz+=pPts->GetCount();
+ }
+ return nAnz;
+}
+
+sal_Bool SdrMarkView::MarkGluePoints(const Rectangle* pRect, sal_Bool bUnmark)
+{
+ if (!IsGluePointEditMode() && !bUnmark) return sal_False;
+ ForceUndirtyMrkPnt();
+ sal_Bool bChgd=sal_False;
+ SortMarkedObjects();
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++) {
+ SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
+ const SdrObject* pObj=pM->GetMarkedSdrObj();
+ const SdrGluePointList* pGPL=pObj->GetGluePointList();
+ SdrUShortCont* pPts=pM->GetMarkedGluePoints();
+ if (bUnmark && pRect==NULL) { // UnmarkAll
+ if (pPts!=NULL && pPts->GetCount()!=0) {
+ pPts->Clear();
+ bChgd=sal_True;
+ }
+ } else {
+ if (pGPL!=NULL && (pPts!=NULL || !bUnmark)) {
+ sal_uInt16 nGPAnz=pGPL->GetCount();
+ for (sal_uInt16 nGPNum=0; nGPNum<nGPAnz; nGPNum++) {
+ const SdrGluePoint& rGP=(*pGPL)[nGPNum];
+
+ // #i38892#
+ if(rGP.IsUserDefined())
+ {
+ Point aPos(rGP.GetAbsolutePos(*pObj));
+ if (pRect==NULL || pRect->IsInside(aPos)) {
+ if (pPts==NULL) pPts=pM->ForceMarkedGluePoints();
+ else pPts->ForceSort();
+ sal_uIntPtr nPos=pPts->GetPos(rGP.GetId());
+ if (!bUnmark && nPos==CONTAINER_ENTRY_NOTFOUND) {
+ bChgd=sal_True;
+ pPts->Insert(rGP.GetId());
+ }
+ if (bUnmark && nPos!=CONTAINER_ENTRY_NOTFOUND) {
+ bChgd=sal_True;
+ pPts->Remove(nPos);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ if (bChgd) {
+ AdjustMarkHdl();
+ MarkListHasChanged();
+ }
+ return bChgd;
+}
+
+sal_Bool SdrMarkView::PickGluePoint(const Point& rPnt, SdrObject*& rpObj, sal_uInt16& rnId, SdrPageView*& rpPV, sal_uIntPtr nOptions) const
+{
+ SdrObject* pObj0=rpObj;
+ //SdrPageView* pPV0=rpPV;
+ sal_uInt16 nId0=rnId;
+ rpObj=NULL; rpPV=NULL; rnId=0;
+ if (!IsGluePointEditMode()) return sal_False;
+ sal_Bool bBack=(nOptions & SDRSEARCH_BACKWARD) !=0;
+ sal_Bool bNext=(nOptions & SDRSEARCH_NEXT) !=0;
+ OutputDevice* pOut=(OutputDevice*)pActualOutDev;
+ if (pOut==NULL) pOut=GetFirstOutputDevice(); //GetWin(0);
+ if (pOut==NULL) return sal_False;
+ SortMarkedObjects();
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ sal_uIntPtr nMarkNum=bBack ? 0 : nMarkAnz;
+ if (bNext) {
+ nMarkNum=((SdrMarkView*)this)->TryToFindMarkedObject(pObj0);
+ if (nMarkNum==CONTAINER_ENTRY_NOTFOUND) return sal_False;
+ if (!bBack) nMarkNum++;
+ }
+ while (bBack ? nMarkNum<nMarkAnz : nMarkNum>0) {
+ if (!bBack) nMarkNum--;
+ const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ SdrPageView* pPV=pM->GetPageView();
+ const SdrGluePointList* pGPL=pObj->GetGluePointList();
+ if (pGPL!=NULL) {
+ sal_uInt16 nNum=pGPL->HitTest(rPnt,*pOut,pObj,bBack,bNext,nId0);
+ if (nNum!=SDRGLUEPOINT_NOTFOUND)
+ {
+ // #i38892#
+ const SdrGluePoint& rCandidate = (*pGPL)[nNum];
+
+ if(rCandidate.IsUserDefined())
+ {
+ rpObj=pObj;
+ rnId=(*pGPL)[nNum].GetId();
+ rpPV=pPV;
+ return sal_True;
+ }
+ }
+ }
+ bNext=sal_False; // HitNextGluePoint nur beim ersten Obj
+ if (bBack) nMarkNum++;
+ }
+ return sal_False;
+}
+
+sal_Bool SdrMarkView::MarkGluePoint(const SdrObject* pObj, sal_uInt16 nId, const SdrPageView* /*pPV*/, sal_Bool bUnmark)
+{
+ if (!IsGluePointEditMode()) return sal_False;
+ ForceUndirtyMrkPnt();
+ sal_Bool bChgd=sal_False;
+ if (pObj!=NULL) {
+ sal_uIntPtr nMarkPos=TryToFindMarkedObject(pObj);
+ if (nMarkPos!=CONTAINER_ENTRY_NOTFOUND) {
+ SdrMark* pM=GetSdrMarkByIndex(nMarkPos);
+ SdrUShortCont* pPts=bUnmark ? pM->GetMarkedGluePoints() : pM->ForceMarkedGluePoints();
+ if (pPts!=NULL) {
+ sal_uIntPtr nPointPos=pPts->GetPos(nId);
+ if (!bUnmark && nPointPos==CONTAINER_ENTRY_NOTFOUND) {
+ bChgd=sal_True;
+ pPts->Insert(nId);
+ }
+ if (bUnmark && nPointPos!=CONTAINER_ENTRY_NOTFOUND) {
+ bChgd=sal_True;
+ pPts->Remove(nPointPos);
+ }
+ }
+ } else {
+ // Objekt implizit markieren ...
+ // ... fehlende Implementation
+ }
+ }
+ if (bChgd) {
+ AdjustMarkHdl();
+ MarkListHasChanged();
+ }
+ return bChgd;
+}
+
+sal_Bool SdrMarkView::IsGluePointMarked(const SdrObject* pObj, sal_uInt16 nId) const
+{
+ ForceUndirtyMrkPnt();
+ sal_Bool bRet=sal_False;
+ sal_uIntPtr nPos=((SdrMarkView*)this)->TryToFindMarkedObject(pObj); // casting auf NonConst
+ if (nPos!=CONTAINER_ENTRY_NOTFOUND) {
+ const SdrMark* pM=GetSdrMarkByIndex(nPos);
+ const SdrUShortCont* pPts=pM->GetMarkedGluePoints();
+ if (pPts!=NULL) {
+ bRet=pPts->Exist(nId);
+ }
+ }
+ return bRet;
+}
+
+sal_Bool SdrMarkView::UnmarkGluePoint(const SdrHdl& rHdl)
+{
+ if (&rHdl!=NULL && rHdl.GetKind()==HDL_GLUE && rHdl.GetObj()!=NULL) {
+ return MarkGluePoint(rHdl.GetObj(),(sal_uInt16)rHdl.GetObjHdlNum(),rHdl.GetPageView(),sal_True);
+ } else return sal_False;
+}
+
+SdrHdl* SdrMarkView::GetGluePointHdl(const SdrObject* pObj, sal_uInt16 nId) const
+{
+ ForceUndirtyMrkPnt();
+ sal_uIntPtr nHdlAnz=aHdl.GetHdlCount();
+ for (sal_uIntPtr nHdlNum=0; nHdlNum<nHdlAnz; nHdlNum++) {
+ SdrHdl* pHdl=aHdl.GetHdl(nHdlNum);
+ if (pHdl->GetObj()==pObj &&
+ pHdl->GetKind()==HDL_GLUE &&
+ pHdl->GetObjHdlNum()==nId ) return pHdl;
+ }
+ return NULL;
+}
+
+sal_Bool SdrMarkView::MarkNextGluePoint(sal_Bool /*bPrev*/)
+{
+ ForceUndirtyMrkPnt();
+ sal_Bool bChgd=sal_False;
+ SortMarkedObjects();
+ // ...
+ if (bChgd) {
+ MarkListHasChanged();
+ }
+ return bChgd;
+}
+
+sal_Bool SdrMarkView::MarkNextGluePoint(const Point& /*rPnt*/, sal_Bool /*bPrev*/)
+{
+ ForceUndirtyMrkPnt();
+ sal_Bool bChgd=sal_False;
+ SortMarkedObjects();
+ // ...
+ if (bChgd) {
+ MarkListHasChanged();
+ }
+ return bChgd;
+}
+
+const Rectangle& SdrMarkView::GetMarkedGluePointsRect() const
+{
+ ForceUndirtyMrkPnt();
+ if (bMarkedPointsRectsDirty) ImpSetPointsRects();
+ return aMarkedGluePointsRect;
+}
+
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
new file mode 100644
index 000000000000..30791ce216d4
--- /dev/null
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -0,0 +1,3504 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/svdoashp.hxx>
+#include "svx/unoapi.hxx"
+#include <svx/unoshape.hxx>
+#include <ucbhelper/content.hxx>
+#include <ucbhelper/contentbroker.hxx>
+#include <unotools/datetime.hxx>
+#include <sfx2/lnkbase.hxx>
+#include <tools/urlobj.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/XCustomShapeEngine.hpp>
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include "unopolyhelper.hxx"
+#include <comphelper/processfactory.hxx>
+#include <svl/urihelper.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <svx/svdogrp.hxx>
+#include <vcl/salbtype.hxx> // FRound
+#include <svx/svddrag.hxx>
+#include <svx/xpool.hxx>
+#include <svx/xpoly.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdpage.hxx>
+#include "svx/svditer.hxx"
+#include <svx/svdobj.hxx>
+#include <svx/svdtrans.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/svdattrx.hxx> // NotPersistItems
+#include <svx/svdoedge.hxx> // #32383# Die Verbinder nach Move nochmal anbroadcasten
+#include "svx/svdglob.hxx" // StringCache
+#include "svx/svdstr.hrc" // Objektname
+#include <editeng/eeitem.hxx>
+#include "editeng/editstat.hxx"
+#include <svx/svdoutl.hxx>
+#include <editeng/outlobj.hxx>
+#include <svx/sdtfchim.hxx>
+#include "../svx/EnhancedCustomShapeGeometry.hxx"
+#include "../svx/EnhancedCustomShapeTypeNames.hxx"
+#include "../svx/EnhancedCustomShape2d.hxx"
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
+#include <editeng/writingmodeitem.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/svxids.hrc>
+#include <svl/whiter.hxx>
+#include <svx/sdr/properties/customshapeproperties.hxx>
+#include <svx/sdr/contact/viewcontactofsdrobjcustomshape.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xlntrit.hxx>
+#include <svx/xfltrit.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xflgrit.hxx>
+#include <svx/xflhtit.hxx>
+#include <svx/xbtmpit.hxx>
+#include <vcl/bmpacc.hxx>
+#include <svx/svdview.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
+// #104018# replace macros above with type-safe methods
+inline double ImplTwipsToMM(double fVal) { return (fVal * (127.0 / 72.0)); }
+inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); }
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::drawing;
+
+static MSO_SPT ImpGetCustomShapeType( const SdrObjCustomShape& rCustoShape )
+{
+ MSO_SPT eRetValue = mso_sptNil;
+
+ rtl::OUString aEngine( ( (SdrCustomShapeEngineItem&)rCustoShape.GetMergedItem( SDRATTR_CUSTOMSHAPE_ENGINE ) ).GetValue() );
+ if ( !aEngine.getLength() || aEngine.equalsAscii( "com.sun.star.drawing.EnhancedCustomShapeEngine" ) )
+ {
+ rtl::OUString sShapeType;
+ const rtl::OUString sType( RTL_CONSTASCII_USTRINGPARAM ( "Type" ) );
+ SdrCustomShapeGeometryItem& rGeometryItem( (SdrCustomShapeGeometryItem&)rCustoShape.GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ Any* pAny = rGeometryItem.GetPropertyValueByName( sType );
+ if ( pAny && ( *pAny >>= sShapeType ) )
+ eRetValue = EnhancedCustomShapeTypeNames::Get( sShapeType );
+ }
+ return eRetValue;
+};
+
+static sal_Bool ImpVerticalSwitch( const SdrObjCustomShape& rCustoShape )
+{
+ sal_Bool bRet = sal_False;
+ MSO_SPT eShapeType( ImpGetCustomShapeType( rCustoShape ) );
+ switch( eShapeType )
+ {
+ case mso_sptAccentBorderCallout90 : // 2 ortho
+ case mso_sptBorderCallout1 : // 2 diag
+ case mso_sptBorderCallout2 : // 3
+ {
+ bRet = sal_True;
+ }
+ break;
+/*
+ case mso_sptCallout1 :
+ case mso_sptAccentCallout1 :
+ case mso_sptAccentBorderCallout1 :
+ case mso_sptBorderCallout90 :
+ case mso_sptCallout90 :
+ case mso_sptAccentCallout90 :
+ case mso_sptCallout2 :
+ case mso_sptCallout3 :
+ case mso_sptAccentCallout2 :
+ case mso_sptAccentCallout3 :
+ case mso_sptBorderCallout3 :
+ case mso_sptAccentBorderCallout2 :
+ case mso_sptAccentBorderCallout3 :
+*/
+ default: break;
+ }
+ return bRet;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// #i37011# create a clone with all attributes changed to shadow attributes
+// and translation executed, too.
+SdrObject* ImpCreateShadowObjectClone(const SdrObject& rOriginal, const SfxItemSet& rOriginalSet)
+{
+ SdrObject* pRetval = 0L;
+ const sal_Bool bShadow(((SdrShadowItem&)rOriginalSet.Get(SDRATTR_SHADOW)).GetValue());
+
+ if(bShadow)
+ {
+ // create a shadow representing object
+ const sal_Int32 nXDist(((SdrShadowXDistItem&)(rOriginalSet.Get(SDRATTR_SHADOWXDIST))).GetValue());
+ const sal_Int32 nYDist(((SdrShadowYDistItem&)(rOriginalSet.Get(SDRATTR_SHADOWYDIST))).GetValue());
+ const ::Color aShadowColor(((SdrShadowColorItem&)(rOriginalSet.Get(SDRATTR_SHADOWCOLOR))).GetColorValue());
+ const sal_uInt16 nShadowTransparence(((SdrShadowTransparenceItem&)(rOriginalSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue());
+ pRetval = rOriginal.Clone();
+ DBG_ASSERT(pRetval, "ImpCreateShadowObjectClone: Could not clone object (!)");
+
+ // look for used stuff
+ SdrObjListIter aIterator(rOriginal);
+ sal_Bool bLineUsed(sal_False);
+ sal_Bool bAllFillUsed(sal_False);
+ sal_Bool bSolidFillUsed(sal_False);
+ sal_Bool bGradientFillUsed(sal_False);
+ sal_Bool bHatchFillUsed(sal_False);
+ sal_Bool bBitmapFillUsed(sal_False);
+
+ while(aIterator.IsMore())
+ {
+ SdrObject* pObj = aIterator.Next();
+ XFillStyle eFillStyle = ((XFillStyleItem&)(pObj->GetMergedItem(XATTR_FILLSTYLE))).GetValue();
+
+ if(!bLineUsed)
+ {
+ XLineStyle eLineStyle = ((XLineStyleItem&)(pObj->GetMergedItem(XATTR_LINESTYLE))).GetValue();
+
+ if(XLINE_NONE != eLineStyle)
+ {
+ bLineUsed = sal_True;
+ }
+ }
+
+ if(!bAllFillUsed)
+ {
+ if(!bSolidFillUsed && XFILL_SOLID == eFillStyle)
+ {
+ bSolidFillUsed = sal_True;
+ bAllFillUsed = (bSolidFillUsed || bGradientFillUsed || bHatchFillUsed || bBitmapFillUsed);
+ }
+ if(!bGradientFillUsed && XFILL_GRADIENT == eFillStyle)
+ {
+ bGradientFillUsed = sal_True;
+ bAllFillUsed = (bSolidFillUsed || bGradientFillUsed || bHatchFillUsed || bBitmapFillUsed);
+ }
+ if(!bHatchFillUsed && XFILL_HATCH == eFillStyle)
+ {
+ bHatchFillUsed = sal_True;
+ bAllFillUsed = (bSolidFillUsed || bGradientFillUsed || bHatchFillUsed || bBitmapFillUsed);
+ }
+ if(!bBitmapFillUsed && XFILL_BITMAP == eFillStyle)
+ {
+ bBitmapFillUsed = sal_True;
+ bAllFillUsed = (bSolidFillUsed || bGradientFillUsed || bHatchFillUsed || bBitmapFillUsed);
+ }
+ }
+ }
+
+ // translate to shadow coordinates
+ pRetval->NbcMove(Size(nXDist, nYDist));
+
+ // set items as needed
+ SfxItemSet aTempSet(rOriginalSet);
+
+ // SJ: #40108# :-( if a SvxWritingModeItem (Top->Bottom) is set the text object
+ // is creating a paraobject, but paraobjects can not be created without model. So
+ // we are preventing the crash by setting the writing mode always left to right,
+ // this is not bad since our shadow geometry does not contain text.
+ aTempSet.Put( SvxWritingModeItem( com::sun::star::text::WritingMode_LR_TB, SDRATTR_TEXTDIRECTION ) );
+
+ // no shadow
+ aTempSet.Put(SdrShadowItem(sal_False));
+ aTempSet.Put(SdrShadowXDistItem(0L));
+ aTempSet.Put(SdrShadowYDistItem(0L));
+
+ // line color and transparence like shadow
+ if(bLineUsed)
+ {
+ aTempSet.Put(XLineColorItem(String(), aShadowColor));
+ aTempSet.Put(XLineTransparenceItem(nShadowTransparence));
+ }
+
+ // fill color and transparence like shadow
+ if(bSolidFillUsed)
+ {
+ aTempSet.Put(XFillColorItem(String(), aShadowColor));
+ aTempSet.Put(XFillTransparenceItem(nShadowTransparence));
+ }
+
+ // gradient and transparence like shadow
+ if(bGradientFillUsed)
+ {
+ XGradient aGradient(((XFillGradientItem&)(rOriginalSet.Get(XATTR_FILLGRADIENT))).GetGradientValue());
+ sal_uInt8 nStartLuminance(aGradient.GetStartColor().GetLuminance());
+ sal_uInt8 nEndLuminance(aGradient.GetEndColor().GetLuminance());
+
+ if(aGradient.GetStartIntens() != 100)
+ {
+ nStartLuminance = (sal_uInt8)(nStartLuminance * ((double)aGradient.GetStartIntens() / 100.0));
+ }
+
+ if(aGradient.GetEndIntens() != 100)
+ {
+ nEndLuminance = (sal_uInt8)(nEndLuminance * ((double)aGradient.GetEndIntens() / 100.0));
+ }
+
+ ::Color aStartColor(
+ (sal_uInt8)((nStartLuminance * aShadowColor.GetRed()) / 256),
+ (sal_uInt8)((nStartLuminance * aShadowColor.GetGreen()) / 256),
+ (sal_uInt8)((nStartLuminance * aShadowColor.GetBlue()) / 256));
+
+ ::Color aEndColor(
+ (sal_uInt8)((nEndLuminance * aShadowColor.GetRed()) / 256),
+ (sal_uInt8)((nEndLuminance * aShadowColor.GetGreen()) / 256),
+ (sal_uInt8)((nEndLuminance * aShadowColor.GetBlue()) / 256));
+
+ aGradient.SetStartColor(aStartColor);
+ aGradient.SetEndColor(aEndColor);
+ aTempSet.Put(XFillGradientItem(aTempSet.GetPool(), aGradient));
+ aTempSet.Put(XFillTransparenceItem(nShadowTransparence));
+ }
+
+ // hatch and transparence like shadow
+ if(bHatchFillUsed)
+ {
+ XHatch aHatch(((XFillHatchItem&)(rOriginalSet.Get(XATTR_FILLHATCH))).GetHatchValue());
+ aHatch.SetColor(aShadowColor);
+ aTempSet.Put(XFillHatchItem(aTempSet.GetPool(), aHatch));
+ aTempSet.Put(XFillTransparenceItem(nShadowTransparence));
+ }
+
+ // bitmap and transparence like shadow
+ if(bBitmapFillUsed)
+ {
+ XOBitmap aFillBitmap(((XFillBitmapItem&)(rOriginalSet.Get(XATTR_FILLBITMAP))).GetBitmapValue());
+ Bitmap aSourceBitmap(aFillBitmap.GetBitmap());
+ BitmapReadAccess* pReadAccess = aSourceBitmap.AcquireReadAccess();
+
+ if(!aSourceBitmap.IsEmpty())
+ {
+ if(pReadAccess)
+ {
+ Bitmap aDestBitmap(aSourceBitmap.GetSizePixel(), 24L);
+ BitmapWriteAccess* pWriteAccess = aDestBitmap.AcquireWriteAccess();
+
+ if(pWriteAccess)
+ {
+ for(sal_Int32 y(0L); y < pReadAccess->Height(); y++)
+ {
+ for(sal_Int32 x(0L); x < pReadAccess->Width(); x++)
+ {
+ sal_uInt16 nLuminance((sal_uInt16)pReadAccess->GetLuminance(y, x) + 1);
+ const BitmapColor aDestColor(
+ (sal_uInt8)((nLuminance * (sal_uInt16)aShadowColor.GetRed()) >> 8L),
+ (sal_uInt8)((nLuminance * (sal_uInt16)aShadowColor.GetGreen()) >> 8L),
+ (sal_uInt8)((nLuminance * (sal_uInt16)aShadowColor.GetBlue()) >> 8L));
+ pWriteAccess->SetPixel(y, x, aDestColor);
+ }
+ }
+
+ aDestBitmap.ReleaseAccess(pWriteAccess);
+ aFillBitmap.SetBitmap(aDestBitmap);
+ }
+
+ aSourceBitmap.ReleaseAccess(pReadAccess);
+ }
+ }
+
+ aTempSet.Put(XFillBitmapItem(aTempSet.GetPool(), aFillBitmap));
+ aTempSet.Put(XFillTransparenceItem(nShadowTransparence));
+ }
+
+ // set attributes and paint shadow object
+ pRetval->SetMergedItemSet( aTempSet );
+ }
+ return pRetval;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+Reference< XCustomShapeEngine > SdrObjCustomShape::GetCustomShapeEngine( const SdrObjCustomShape* pCustomShape )
+{
+ Reference< XCustomShapeEngine > xCustomShapeEngine;
+ String aEngine(((SdrCustomShapeEngineItem&)pCustomShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_ENGINE )).GetValue());
+ if ( !aEngine.Len() )
+ aEngine = String( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.drawing.EnhancedCustomShapeEngine" ) );
+
+ Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+
+ Reference< XShape > aXShape = GetXShapeForSdrObject( (SdrObjCustomShape*)pCustomShape );
+ if ( aXShape.is() )
+ {
+ if ( aEngine.Len() && xFactory.is() )
+ {
+ Sequence< Any > aArgument( 1 );
+ Sequence< PropertyValue > aPropValues( 1 );
+ aPropValues[ 0 ].Name = rtl::OUString::createFromAscii( "CustomShape" );
+ aPropValues[ 0 ].Value <<= aXShape;
+ aArgument[ 0 ] <<= aPropValues;
+ Reference< XInterface > xInterface( xFactory->createInstanceWithArguments( aEngine, aArgument ) );
+ if ( xInterface.is() )
+ xCustomShapeEngine = Reference< XCustomShapeEngine >( xInterface, UNO_QUERY );
+ }
+ }
+ return xCustomShapeEngine;
+}
+const SdrObject* SdrObjCustomShape::GetSdrObjectFromCustomShape() const
+{
+ if ( !mXRenderedCustomShape.is() )
+ {
+ Reference< XCustomShapeEngine > xCustomShapeEngine( GetCustomShapeEngine( this ) );
+ if ( xCustomShapeEngine.is() )
+ ((SdrObjCustomShape*)this)->mXRenderedCustomShape = xCustomShapeEngine->render();
+ }
+ SdrObject* pRenderedCustomShape = mXRenderedCustomShape.is()
+ ? GetSdrObjectFromXShape( mXRenderedCustomShape )
+ : NULL;
+ return pRenderedCustomShape;
+}
+
+// #i37011# Shadow geometry creation
+const SdrObject* SdrObjCustomShape::GetSdrObjectShadowFromCustomShape() const
+{
+ if(!mpLastShadowGeometry)
+ {
+ const SdrObject* pSdrObject = GetSdrObjectFromCustomShape();
+ if(pSdrObject)
+ {
+ const SfxItemSet& rOriginalSet = GetObjectItemSet();
+ const sal_Bool bShadow(((SdrShadowItem&)rOriginalSet.Get( SDRATTR_SHADOW )).GetValue());
+
+ if(bShadow)
+ {
+ // create a clone with all attributes changed to shadow attributes
+ // and translation executed, too.
+ ((SdrObjCustomShape*)this)->mpLastShadowGeometry = ImpCreateShadowObjectClone(*pSdrObject, rOriginalSet);
+ }
+ }
+ }
+
+ return mpLastShadowGeometry;
+}
+
+sal_Bool SdrObjCustomShape::IsTextPath() const
+{
+ const rtl::OUString sTextPath( RTL_CONSTASCII_USTRINGPARAM ( "TextPath" ) );
+ sal_Bool bTextPathOn = sal_False;
+ SdrCustomShapeGeometryItem& rGeometryItem = (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
+ Any* pAny = rGeometryItem.GetPropertyValueByName( sTextPath, sTextPath );
+ if ( pAny )
+ *pAny >>= bTextPathOn;
+ return bTextPathOn;
+}
+
+sal_Bool SdrObjCustomShape::UseNoFillStyle() const
+{
+ sal_Bool bRet = sal_False;
+ rtl::OUString sShapeType;
+ const rtl::OUString sType( RTL_CONSTASCII_USTRINGPARAM ( "Type" ) );
+ SdrCustomShapeGeometryItem& rGeometryItem( (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ Any* pAny = rGeometryItem.GetPropertyValueByName( sType );
+ if ( pAny )
+ *pAny >>= sShapeType;
+ bRet = IsCustomShapeFilledByDefault( EnhancedCustomShapeTypeNames::Get( sType ) ) == 0;
+
+ return bRet;
+}
+
+sal_Bool SdrObjCustomShape::IsMirroredX() const
+{
+ sal_Bool bMirroredX = sal_False;
+ SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ const rtl::OUString sMirroredX( RTL_CONSTASCII_USTRINGPARAM ( "MirroredX" ) );
+ com::sun::star::uno::Any* pAny = aGeometryItem.GetPropertyValueByName( sMirroredX );
+ if ( pAny )
+ *pAny >>= bMirroredX;
+ return bMirroredX;
+}
+sal_Bool SdrObjCustomShape::IsMirroredY() const
+{
+ sal_Bool bMirroredY = sal_False;
+ SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ const rtl::OUString sMirroredY( RTL_CONSTASCII_USTRINGPARAM ( "MirroredY" ) );
+ com::sun::star::uno::Any* pAny = aGeometryItem.GetPropertyValueByName( sMirroredY );
+ if ( pAny )
+ *pAny >>= bMirroredY;
+ return bMirroredY;
+}
+void SdrObjCustomShape::SetMirroredX( const sal_Bool bMirrorX )
+{
+ SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ const rtl::OUString sMirroredX( RTL_CONSTASCII_USTRINGPARAM ( "MirroredX" ) );
+ //com::sun::star::uno::Any* pAny = aGeometryItem.GetPropertyValueByName( sMirroredX );
+ PropertyValue aPropVal;
+ aPropVal.Name = sMirroredX;
+ aPropVal.Value <<= bMirrorX;
+ aGeometryItem.SetPropertyValue( aPropVal );
+ SetMergedItem( aGeometryItem );
+}
+void SdrObjCustomShape::SetMirroredY( const sal_Bool bMirrorY )
+{
+ SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ const rtl::OUString sMirroredY( RTL_CONSTASCII_USTRINGPARAM ( "MirroredY" ) );
+ //com::sun::star::uno::Any* pAny = aGeometryItem.GetPropertyValueByName( sMirroredY );
+ PropertyValue aPropVal;
+ aPropVal.Name = sMirroredY;
+ aPropVal.Value <<= bMirrorY;
+ aGeometryItem.SetPropertyValue( aPropVal );
+ SetMergedItem( aGeometryItem );
+}
+
+double SdrObjCustomShape::GetObjectRotation() const
+{
+ return fObjectRotation;
+}
+
+double SdrObjCustomShape::GetExtraTextRotation() const
+{
+ const com::sun::star::uno::Any* pAny;
+ SdrCustomShapeGeometryItem& rGeometryItem = (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
+ const rtl::OUString sTextRotateAngle( RTL_CONSTASCII_USTRINGPARAM ( "TextRotateAngle" ) );
+ pAny = rGeometryItem.GetPropertyValueByName( sTextRotateAngle );
+ double fExtraTextRotateAngle = 0.0;
+ if ( pAny )
+ *pAny >>= fExtraTextRotateAngle;
+ return fExtraTextRotateAngle;
+}
+sal_Bool SdrObjCustomShape::GetTextBounds( Rectangle& rTextBound ) const
+{
+ sal_Bool bRet = sal_False;
+ Reference< XCustomShapeEngine > xCustomShapeEngine( GetCustomShapeEngine( this ) ); // a candidate for being cached
+ if ( xCustomShapeEngine.is() )
+ {
+ awt::Rectangle aR( xCustomShapeEngine->getTextBounds() );
+ if ( aR.Width || aR.Height )
+ {
+ rTextBound = Rectangle( Point( aR.X, aR.Y ), Size( aR.Width, aR.Height ) );
+ bRet = sal_True;
+ }
+ }
+ return bRet;
+}
+basegfx::B2DPolyPolygon SdrObjCustomShape::GetLineGeometry( const SdrObjCustomShape* pCustomShape, const sal_Bool bBezierAllowed )
+{
+ basegfx::B2DPolyPolygon aRetval;
+ sal_Bool bRet = sal_False;
+ Reference< XCustomShapeEngine > xCustomShapeEngine( GetCustomShapeEngine( pCustomShape ) );
+ if ( xCustomShapeEngine.is() )
+ {
+ com::sun::star::drawing::PolyPolygonBezierCoords aBezierCoords = xCustomShapeEngine->getLineGeometry();
+ try
+ {
+ aRetval = SvxConvertPolyPolygonBezierToB2DPolyPolygon( &aBezierCoords );
+ if ( !bBezierAllowed && aRetval.areControlPointsUsed())
+ {
+ aRetval = basegfx::tools::adaptiveSubdivideByAngle(aRetval);
+ }
+ bRet = sal_True;
+ }
+ catch ( const com::sun::star::lang::IllegalArgumentException )
+ {
+ }
+ }
+ return aRetval;
+}
+
+std::vector< SdrCustomShapeInteraction > SdrObjCustomShape::GetInteractionHandles( const SdrObjCustomShape* pCustomShape ) const
+{
+ std::vector< SdrCustomShapeInteraction > xRet;
+ try
+ {
+ Reference< XCustomShapeEngine > xCustomShapeEngine( GetCustomShapeEngine( pCustomShape ) );
+ if ( xCustomShapeEngine.is() )
+ {
+ int i;
+ Sequence< Reference< XCustomShapeHandle > > xInteractionHandles( xCustomShapeEngine->getInteraction() );
+ for ( i = 0; i < xInteractionHandles.getLength(); i++ )
+ {
+ if ( xInteractionHandles[ i ].is() )
+ {
+ SdrCustomShapeInteraction aSdrCustomShapeInteraction;
+ aSdrCustomShapeInteraction.xInteraction = xInteractionHandles[ i ];
+ aSdrCustomShapeInteraction.aPosition = xInteractionHandles[ i ]->getPosition();
+
+ sal_Int32 nMode = 0;
+ switch( ImpGetCustomShapeType( *this ) )
+ {
+ case mso_sptAccentBorderCallout90 : // 2 ortho
+ {
+ if ( !i )
+ nMode |= CUSTOMSHAPE_HANDLE_RESIZE_FIXED | CUSTOMSHAPE_HANDLE_CREATE_FIXED;
+ else if ( i == 1)
+ nMode |= CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_X | CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_Y | CUSTOMSHAPE_HANDLE_MOVE_SHAPE | CUSTOMSHAPE_HANDLE_ORTHO4;
+ }
+ break;
+
+ case mso_sptWedgeRectCallout :
+ case mso_sptWedgeRRectCallout :
+ case mso_sptCloudCallout :
+ case mso_sptWedgeEllipseCallout :
+ {
+ if ( !i )
+ nMode |= CUSTOMSHAPE_HANDLE_RESIZE_FIXED;
+ }
+ break;
+
+ case mso_sptBorderCallout1 : // 2 diag
+ {
+ if ( !i )
+ nMode |= CUSTOMSHAPE_HANDLE_RESIZE_FIXED | CUSTOMSHAPE_HANDLE_CREATE_FIXED;
+ else if ( i == 1 )
+ nMode |= CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_X | CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_Y | CUSTOMSHAPE_HANDLE_MOVE_SHAPE;
+ }
+ break;
+ case mso_sptBorderCallout2 : // 3
+ {
+ if ( !i )
+ nMode |= CUSTOMSHAPE_HANDLE_RESIZE_FIXED | CUSTOMSHAPE_HANDLE_CREATE_FIXED;
+ else if ( i == 2 )
+ nMode |= CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_X | CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_Y | CUSTOMSHAPE_HANDLE_MOVE_SHAPE;
+ }
+ break;
+ case mso_sptCallout90 :
+ case mso_sptAccentCallout90 :
+ case mso_sptBorderCallout90 :
+ case mso_sptCallout1 :
+ case mso_sptCallout2 :
+ case mso_sptCallout3 :
+ case mso_sptAccentCallout1 :
+ case mso_sptAccentCallout2 :
+ case mso_sptAccentCallout3 :
+ case mso_sptBorderCallout3 :
+ case mso_sptAccentBorderCallout1 :
+ case mso_sptAccentBorderCallout2 :
+ case mso_sptAccentBorderCallout3 :
+ {
+ if ( !i )
+ nMode |= CUSTOMSHAPE_HANDLE_RESIZE_FIXED | CUSTOMSHAPE_HANDLE_CREATE_FIXED;
+ }
+ break;
+ default: break;
+ }
+ aSdrCustomShapeInteraction.nMode = nMode;
+ xRet.push_back( aSdrCustomShapeInteraction );
+ }
+ }
+ }
+ }
+ catch( const uno::RuntimeException& )
+ {
+ }
+ return xRet;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// BaseProperties section
+#define DEFAULT_MINIMUM_SIGNED_COMPARE ((sal_Int32)0x80000000)
+#define DEFAULT_MAXIMUM_SIGNED_COMPARE ((sal_Int32)0x7fffffff)
+
+sdr::properties::BaseProperties* SdrObjCustomShape::CreateObjectSpecificProperties()
+{
+ return new sdr::properties::CustomShapeProperties(*this);
+}
+
+TYPEINIT1(SdrObjCustomShape,SdrTextObj);
+SdrObjCustomShape::SdrObjCustomShape() :
+ SdrTextObj(),
+ fObjectRotation( 0.0 ),
+ mpLastShadowGeometry(0L)
+{
+ bTextFrame = sal_True;
+}
+
+SdrObjCustomShape::~SdrObjCustomShape()
+{
+ // delete buffered display geometry
+ InvalidateRenderGeometry();
+}
+
+void SdrObjCustomShape::MergeDefaultAttributes( const rtl::OUString* pType )
+{
+ PropertyValue aPropVal;
+ rtl::OUString sShapeType;
+ const rtl::OUString sType( RTL_CONSTASCII_USTRINGPARAM ( "Type" ) );
+ SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ if ( pType && pType->getLength() )
+ {
+ sal_Int32 nType = pType->toInt32();
+ if ( nType )
+ sShapeType = EnhancedCustomShapeTypeNames::Get( static_cast< MSO_SPT >( nType ) );
+ else
+ sShapeType = *pType;
+
+ aPropVal.Name = sType;
+ aPropVal.Value <<= sShapeType;
+ aGeometryItem.SetPropertyValue( aPropVal );
+ }
+ else
+ {
+ Any *pAny = aGeometryItem.GetPropertyValueByName( sType );
+ if ( pAny )
+ *pAny >>= sShapeType;
+ }
+ MSO_SPT eSpType = EnhancedCustomShapeTypeNames::Get( sShapeType );
+
+ const sal_Int32* pDefData = NULL;
+ const mso_CustomShape* pDefCustomShape = GetCustomShapeContent( eSpType );
+ if ( pDefCustomShape )
+ pDefData = pDefCustomShape->pDefData;
+
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > seqAdjustmentValues;
+
+ //////////////////////
+ // AdjustmentValues //
+ //////////////////////
+ const rtl::OUString sAdjustmentValues( RTL_CONSTASCII_USTRINGPARAM ( "AdjustmentValues" ) );
+ const Any* pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sAdjustmentValues );
+ if ( pAny )
+ *pAny >>= seqAdjustmentValues;
+ if ( pDefCustomShape && pDefData ) // now check if we have to default some adjustment values
+ {
+ // first check if there are adjustment values are to be appended
+ sal_Int32 i, nAdjustmentValues = seqAdjustmentValues.getLength();
+ sal_Int32 nAdjustmentDefaults = *pDefData++;
+ if ( nAdjustmentDefaults > nAdjustmentValues )
+ {
+ seqAdjustmentValues.realloc( nAdjustmentDefaults );
+ for ( i = nAdjustmentValues; i < nAdjustmentDefaults; i++ )
+ {
+ seqAdjustmentValues[ i ].Value <<= pDefData[ i ];
+ seqAdjustmentValues[ i ].State = com::sun::star::beans::PropertyState_DIRECT_VALUE; // com::sun::star::beans::PropertyState_DEFAULT_VALUE;
+ }
+ }
+ // check if there are defaulted adjustment values that should be filled the hard coded defaults (pDefValue)
+ sal_Int32 nCount = nAdjustmentValues > nAdjustmentDefaults ? nAdjustmentDefaults : nAdjustmentValues;
+ for ( i = 0; i < nCount; i++ )
+ {
+ if ( seqAdjustmentValues[ i ].State != com::sun::star::beans::PropertyState_DIRECT_VALUE )
+ {
+ seqAdjustmentValues[ i ].Value <<= pDefData[ i ];
+ seqAdjustmentValues[ i ].State = com::sun::star::beans::PropertyState_DIRECT_VALUE;
+ }
+ }
+ }
+ aPropVal.Name = sAdjustmentValues;
+ aPropVal.Value <<= seqAdjustmentValues;
+ aGeometryItem.SetPropertyValue( aPropVal );
+
+ ///////////////
+ // Coordsize //
+ ///////////////
+ const rtl::OUString sViewBox( RTL_CONSTASCII_USTRINGPARAM ( "ViewBox" ) );
+ const Any* pViewBox = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sViewBox );
+ com::sun::star::awt::Rectangle aViewBox;
+ if ( !pViewBox || !(*pViewBox >>= aViewBox ) )
+ {
+ if ( pDefCustomShape )
+ {
+ aViewBox.X = 0;
+ aViewBox.Y = 0;
+ aViewBox.Width = pDefCustomShape->nCoordWidth;
+ aViewBox.Height= pDefCustomShape->nCoordHeight;
+ aPropVal.Name = sViewBox;
+ aPropVal.Value <<= aViewBox;
+ aGeometryItem.SetPropertyValue( aPropVal );
+ }
+ }
+
+ const rtl::OUString sPath( RTL_CONSTASCII_USTRINGPARAM ( "Path" ) );
+
+ //////////////////////
+ // Path/Coordinates //
+ //////////////////////
+ const rtl::OUString sCoordinates( RTL_CONSTASCII_USTRINGPARAM ( "Coordinates" ) );
+ pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sCoordinates );
+ if ( !pAny && pDefCustomShape && pDefCustomShape->nVertices && pDefCustomShape->pVertices )
+ {
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair> seqCoordinates;
+
+ sal_Int32 i, nCount = pDefCustomShape->nVertices;
+ seqCoordinates.realloc( nCount );
+ for ( i = 0; i < nCount; i++ )
+ {
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqCoordinates[ i ].First, pDefCustomShape->pVertices[ i ].nValA );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqCoordinates[ i ].Second, pDefCustomShape->pVertices[ i ].nValB );
+ }
+ aPropVal.Name = sCoordinates;
+ aPropVal.Value <<= seqCoordinates;
+ aGeometryItem.SetPropertyValue( sPath, aPropVal );
+ }
+
+ /////////////////////
+ // Path/GluePoints //
+ /////////////////////
+ const rtl::OUString sGluePoints( RTL_CONSTASCII_USTRINGPARAM ( "GluePoints" ) );
+ pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sGluePoints );
+ if ( !pAny && pDefCustomShape && pDefCustomShape->nGluePoints && pDefCustomShape->pGluePoints )
+ {
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair> seqGluePoints;
+ sal_Int32 i, nCount = pDefCustomShape->nGluePoints;
+ seqGluePoints.realloc( nCount );
+ for ( i = 0; i < nCount; i++ )
+ {
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqGluePoints[ i ].First, pDefCustomShape->pGluePoints[ i ].nValA );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqGluePoints[ i ].Second, pDefCustomShape->pGluePoints[ i ].nValB );
+ }
+ aPropVal.Name = sGluePoints;
+ aPropVal.Value <<= seqGluePoints;
+ aGeometryItem.SetPropertyValue( sPath, aPropVal );
+ }
+
+ ///////////////////
+ // Path/Segments //
+ ///////////////////
+ const rtl::OUString sSegments( RTL_CONSTASCII_USTRINGPARAM ( "Segments" ) );
+ pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sSegments );
+ if ( !pAny && pDefCustomShape && pDefCustomShape->nElements && pDefCustomShape->pElements )
+ {
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > seqSegments;
+
+ sal_Int32 i, nCount = pDefCustomShape->nElements;
+ seqSegments.realloc( nCount );
+ for ( i = 0; i < nCount; i++ )
+ {
+ EnhancedCustomShapeSegment& rSegInfo = seqSegments[ i ];
+ sal_uInt16 nSDat = pDefCustomShape->pElements[ i ];
+ switch( nSDat >> 8 )
+ {
+ case 0x00 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::LINETO;
+ rSegInfo.Count = nSDat & 0xff;
+ if ( !rSegInfo.Count )
+ rSegInfo.Count = 1;
+ }
+ break;
+ case 0x20 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::CURVETO;
+ rSegInfo.Count = nSDat & 0xff;
+ if ( !rSegInfo.Count )
+ rSegInfo.Count = 1;
+ }
+ break;
+ case 0x40 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::MOVETO;
+ rSegInfo.Count = nSDat & 0xff;
+ if ( !rSegInfo.Count )
+ rSegInfo.Count = 1;
+ }
+ break;
+ case 0x60 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::CLOSESUBPATH;
+ rSegInfo.Count = 0;
+ }
+ break;
+ case 0x80 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ENDSUBPATH;
+ rSegInfo.Count = 0;
+ }
+ break;
+ case 0xa1 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ANGLEELLIPSETO;
+ rSegInfo.Count = ( nSDat & 0xff ) / 3;
+ }
+ break;
+ case 0xa2 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ANGLEELLIPSE;
+ rSegInfo.Count = ( nSDat & 0xff ) / 3;
+ }
+ break;
+ case 0xa3 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ARCTO;
+ rSegInfo.Count = ( nSDat & 0xff ) >> 2;
+ }
+ break;
+ case 0xa4 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ARC;
+ rSegInfo.Count = ( nSDat & 0xff ) >> 2;
+ }
+ break;
+ case 0xa5 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::CLOCKWISEARCTO;
+ rSegInfo.Count = ( nSDat & 0xff ) >> 2;
+ }
+ break;
+ case 0xa6 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::CLOCKWISEARC;
+ rSegInfo.Count = ( nSDat & 0xff ) >> 2;
+ }
+ break;
+ case 0xa7 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTX;
+ rSegInfo.Count = nSDat & 0xff;
+ }
+ break;
+ case 0xa8 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTY;
+ rSegInfo.Count = nSDat & 0xff;
+ }
+ break;
+ case 0xaa :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::NOFILL;
+ rSegInfo.Count = 0;
+ }
+ break;
+ case 0xab :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::NOSTROKE;
+ rSegInfo.Count = 0;
+ }
+ break;
+ default:
+ case 0xf8 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::UNKNOWN;
+ rSegInfo.Count = nSDat;
+ }
+ break;
+ }
+ }
+ aPropVal.Name = sSegments;
+ aPropVal.Value <<= seqSegments;
+ aGeometryItem.SetPropertyValue( sPath, aPropVal );
+ }
+
+ ///////////////////
+ // Path/StretchX //
+ ///////////////////
+ const rtl::OUString sStretchX( RTL_CONSTASCII_USTRINGPARAM ( "StretchX" ) );
+ pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sStretchX );
+ if ( !pAny && pDefCustomShape )
+ {
+ sal_Int32 nXRef = pDefCustomShape->nXRef;
+ if ( ( nXRef != DEFAULT_MINIMUM_SIGNED_COMPARE ) )
+ {
+ aPropVal.Name = sStretchX;
+ aPropVal.Value <<= nXRef;
+ aGeometryItem.SetPropertyValue( sPath, aPropVal );
+ }
+ }
+
+ ///////////////////
+ // Path/StretchY //
+ ///////////////////
+ const rtl::OUString sStretchY( RTL_CONSTASCII_USTRINGPARAM ( "StretchY" ) );
+ pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sStretchY );
+ if ( !pAny && pDefCustomShape )
+ {
+ sal_Int32 nYRef = pDefCustomShape->nYRef;
+ if ( ( nYRef != DEFAULT_MINIMUM_SIGNED_COMPARE ) )
+ {
+ aPropVal.Name = sStretchY;
+ aPropVal.Value <<= nYRef;
+ aGeometryItem.SetPropertyValue( sPath, aPropVal );
+ }
+ }
+
+ /////////////////////
+ // Path/TextFrames //
+ /////////////////////
+ const rtl::OUString sTextFrames( RTL_CONSTASCII_USTRINGPARAM ( "TextFrames" ) );
+ pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sTextFrames );
+ if ( !pAny && pDefCustomShape && pDefCustomShape->nTextRect && pDefCustomShape->pTextRect )
+ {
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame > seqTextFrames;
+
+ sal_Int32 i, nCount = pDefCustomShape->nTextRect;
+ seqTextFrames.realloc( nCount );
+ const SvxMSDffTextRectangles* pRectangles = pDefCustomShape->pTextRect;
+ for ( i = 0; i < nCount; i++, pRectangles++ )
+ {
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames[ i ].TopLeft.First, pRectangles->nPairA.nValA );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames[ i ].TopLeft.Second, pRectangles->nPairA.nValB );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames[ i ].BottomRight.First, pRectangles->nPairB.nValA );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames[ i ].BottomRight.Second, pRectangles->nPairB.nValB );
+ }
+ aPropVal.Name = sTextFrames;
+ aPropVal.Value <<= seqTextFrames;
+ aGeometryItem.SetPropertyValue( sPath, aPropVal );
+ }
+
+ ///////////////
+ // Equations //
+ ///////////////
+ const rtl::OUString sEquations( RTL_CONSTASCII_USTRINGPARAM( "Equations" ) );
+ pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sEquations );
+ if ( !pAny && pDefCustomShape && pDefCustomShape->nCalculation && pDefCustomShape->pCalculation )
+ {
+ com::sun::star::uno::Sequence< rtl::OUString > seqEquations;
+
+ sal_Int32 i, nCount = pDefCustomShape->nCalculation;
+ seqEquations.realloc( nCount );
+ const SvxMSDffCalculationData* pData = pDefCustomShape->pCalculation;
+ for ( i = 0; i < nCount; i++, pData++ )
+ seqEquations[ i ] = EnhancedCustomShape2d::GetEquation( pData->nFlags, pData->nVal[ 0 ], pData->nVal[ 1 ], pData->nVal[ 2 ] );
+ aPropVal.Name = sEquations;
+ aPropVal.Value <<= seqEquations;
+ aGeometryItem.SetPropertyValue( aPropVal );
+ }
+
+ /////////////
+ // Handles //
+ /////////////
+ const rtl::OUString sHandles( RTL_CONSTASCII_USTRINGPARAM( "Handles" ) );
+ pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sHandles );
+ if ( !pAny && pDefCustomShape && pDefCustomShape->nHandles && pDefCustomShape->pHandles )
+ {
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValues > seqHandles;
+
+ sal_Int32 i, n, nCount = pDefCustomShape->nHandles;
+ const SvxMSDffHandle* pData = pDefCustomShape->pHandles;
+ seqHandles.realloc( nCount );
+ for ( i = 0; i < nCount; i++, pData++ )
+ {
+ sal_Int32 nPropertiesNeeded = 1; // position is always needed
+ sal_Int32 nFlags = pData->nFlags;
+ if ( nFlags & MSDFF_HANDLE_FLAGS_MIRRORED_X )
+ nPropertiesNeeded++;
+ if ( nFlags & MSDFF_HANDLE_FLAGS_MIRRORED_Y )
+ nPropertiesNeeded++;
+ if ( nFlags & MSDFF_HANDLE_FLAGS_SWITCHED )
+ nPropertiesNeeded++;
+ if ( nFlags & MSDFF_HANDLE_FLAGS_POLAR )
+ {
+ nPropertiesNeeded++;
+ if ( nFlags & MSDFF_HANDLE_FLAGS_RADIUS_RANGE )
+ {
+ if ( pData->nRangeXMin != DEFAULT_MINIMUM_SIGNED_COMPARE )
+ nPropertiesNeeded++;
+ if ( pData->nRangeXMax != DEFAULT_MAXIMUM_SIGNED_COMPARE )
+ nPropertiesNeeded++;
+ }
+ }
+ else if ( nFlags & MSDFF_HANDLE_FLAGS_RANGE )
+ {
+ if ( pData->nRangeXMin != DEFAULT_MINIMUM_SIGNED_COMPARE )
+ nPropertiesNeeded++;
+ if ( pData->nRangeXMax != DEFAULT_MAXIMUM_SIGNED_COMPARE )
+ nPropertiesNeeded++;
+ if ( pData->nRangeYMin != DEFAULT_MINIMUM_SIGNED_COMPARE )
+ nPropertiesNeeded++;
+ if ( pData->nRangeYMax != DEFAULT_MAXIMUM_SIGNED_COMPARE )
+ nPropertiesNeeded++;
+ }
+
+ n = 0;
+ com::sun::star::beans::PropertyValues& rPropValues = seqHandles[ i ];
+ rPropValues.realloc( nPropertiesNeeded );
+
+ // POSITION
+ {
+ const rtl::OUString sPosition( RTL_CONSTASCII_USTRINGPARAM ( "Position" ) );
+ ::com::sun::star::drawing::EnhancedCustomShapeParameterPair aPosition;
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aPosition.First, pData->nPositionX, sal_True, sal_True );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aPosition.Second, pData->nPositionY, sal_True, sal_False );
+ rPropValues[ n ].Name = sPosition;
+ rPropValues[ n++ ].Value <<= aPosition;
+ }
+ if ( nFlags & MSDFF_HANDLE_FLAGS_MIRRORED_X )
+ {
+ const rtl::OUString sMirroredX( RTL_CONSTASCII_USTRINGPARAM ( "MirroredX" ) );
+ sal_Bool bMirroredX = sal_True;
+ rPropValues[ n ].Name = sMirroredX;
+ rPropValues[ n++ ].Value <<= bMirroredX;
+ }
+ if ( nFlags & MSDFF_HANDLE_FLAGS_MIRRORED_Y )
+ {
+ const rtl::OUString sMirroredY( RTL_CONSTASCII_USTRINGPARAM ( "MirroredY" ) );
+ sal_Bool bMirroredY = sal_True;
+ rPropValues[ n ].Name = sMirroredY;
+ rPropValues[ n++ ].Value <<= bMirroredY;
+ }
+ if ( nFlags & MSDFF_HANDLE_FLAGS_SWITCHED )
+ {
+ const rtl::OUString sSwitched( RTL_CONSTASCII_USTRINGPARAM ( "Switched" ) );
+ sal_Bool bSwitched = sal_True;
+ rPropValues[ n ].Name = sSwitched;
+ rPropValues[ n++ ].Value <<= bSwitched;
+ }
+ if ( nFlags & MSDFF_HANDLE_FLAGS_POLAR )
+ {
+ const rtl::OUString sPolar( RTL_CONSTASCII_USTRINGPARAM ( "Polar" ) );
+ ::com::sun::star::drawing::EnhancedCustomShapeParameterPair aCenter;
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aCenter.First, pData->nCenterX,
+ ( nFlags & MSDFF_HANDLE_FLAGS_CENTER_X_IS_SPECIAL ) != 0, sal_True );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aCenter.Second, pData->nCenterY,
+ ( nFlags & MSDFF_HANDLE_FLAGS_CENTER_Y_IS_SPECIAL ) != 0, sal_False );
+ rPropValues[ n ].Name = sPolar;
+ rPropValues[ n++ ].Value <<= aCenter;
+ if ( nFlags & MSDFF_HANDLE_FLAGS_RADIUS_RANGE )
+ {
+ if ( pData->nRangeXMin != DEFAULT_MINIMUM_SIGNED_COMPARE )
+ {
+ const rtl::OUString sRadiusRangeMinimum( RTL_CONSTASCII_USTRINGPARAM ( "RadiusRangeMinimum" ) );
+ ::com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum;
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRadiusRangeMinimum, pData->nRangeXMin,
+ ( nFlags & MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL ) != 0, sal_True );
+ rPropValues[ n ].Name = sRadiusRangeMinimum;
+ rPropValues[ n++ ].Value <<= aRadiusRangeMinimum;
+ }
+ if ( pData->nRangeXMax != DEFAULT_MAXIMUM_SIGNED_COMPARE )
+ {
+ const rtl::OUString sRadiusRangeMaximum( RTL_CONSTASCII_USTRINGPARAM ( "RadiusRangeMaximum" ) );
+ ::com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum;
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRadiusRangeMaximum, pData->nRangeXMax,
+ ( nFlags & MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL ) != 0, sal_False );
+ rPropValues[ n ].Name = sRadiusRangeMaximum;
+ rPropValues[ n++ ].Value <<= aRadiusRangeMaximum;
+ }
+ }
+ }
+ else if ( nFlags & MSDFF_HANDLE_FLAGS_RANGE )
+ {
+ if ( pData->nRangeXMin != DEFAULT_MINIMUM_SIGNED_COMPARE )
+ {
+ const rtl::OUString sRangeXMinimum( RTL_CONSTASCII_USTRINGPARAM ( "RangeXMinimum" ) );
+ ::com::sun::star::drawing::EnhancedCustomShapeParameter aRangeXMinimum;
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRangeXMinimum, pData->nRangeXMin,
+ ( nFlags & MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL ) != 0, sal_True );
+ rPropValues[ n ].Name = sRangeXMinimum;
+ rPropValues[ n++ ].Value <<= aRangeXMinimum;
+ }
+ if ( pData->nRangeXMax != DEFAULT_MAXIMUM_SIGNED_COMPARE )
+ {
+ const rtl::OUString sRangeXMaximum( RTL_CONSTASCII_USTRINGPARAM ( "RangeXMaximum" ) );
+ ::com::sun::star::drawing::EnhancedCustomShapeParameter aRangeXMaximum;
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRangeXMaximum, pData->nRangeXMax,
+ ( nFlags & MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL ) != 0, sal_False );
+ rPropValues[ n ].Name = sRangeXMaximum;
+ rPropValues[ n++ ].Value <<= aRangeXMaximum;
+ }
+ if ( pData->nRangeYMin != DEFAULT_MINIMUM_SIGNED_COMPARE )
+ {
+ const rtl::OUString sRangeYMinimum( RTL_CONSTASCII_USTRINGPARAM ( "RangeYMinimum" ) );
+ ::com::sun::star::drawing::EnhancedCustomShapeParameter aRangeYMinimum;
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRangeYMinimum, pData->nRangeYMin,
+ ( nFlags & MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL ) != 0, sal_True );
+ rPropValues[ n ].Name = sRangeYMinimum;
+ rPropValues[ n++ ].Value <<= aRangeYMinimum;
+ }
+ if ( pData->nRangeYMax != DEFAULT_MAXIMUM_SIGNED_COMPARE )
+ {
+ const rtl::OUString sRangeYMaximum( RTL_CONSTASCII_USTRINGPARAM ( "RangeYMaximum" ) );
+ ::com::sun::star::drawing::EnhancedCustomShapeParameter aRangeYMaximum;
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRangeYMaximum, pData->nRangeYMax,
+ ( nFlags & MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL ) != 0, sal_False );
+ rPropValues[ n ].Name = sRangeYMaximum;
+ rPropValues[ n++ ].Value <<= aRangeYMaximum;
+ }
+ }
+ }
+ aPropVal.Name = sHandles;
+ aPropVal.Value <<= seqHandles;
+ aGeometryItem.SetPropertyValue( aPropVal );
+ }
+ SetMergedItem( aGeometryItem );
+}
+
+sal_Bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) const
+{
+ sal_Bool bIsDefaultGeometry = sal_False;
+
+ PropertyValue aPropVal;
+ rtl::OUString sShapeType;
+ const rtl::OUString sType( RTL_CONSTASCII_USTRINGPARAM ( "Type" ) );
+ SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+
+ Any *pAny = aGeometryItem.GetPropertyValueByName( sType );
+ if ( pAny )
+ *pAny >>= sShapeType;
+
+ MSO_SPT eSpType = EnhancedCustomShapeTypeNames::Get( sShapeType );
+
+ const mso_CustomShape* pDefCustomShape = GetCustomShapeContent( eSpType );
+ const rtl::OUString sPath( RTL_CONSTASCII_USTRINGPARAM ( "Path" ) );
+ switch( eDefaultType )
+ {
+ case DEFAULT_VIEWBOX :
+ {
+ const rtl::OUString sViewBox( RTL_CONSTASCII_USTRINGPARAM ( "ViewBox" ) );
+ const Any* pViewBox = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sViewBox );
+ com::sun::star::awt::Rectangle aViewBox;
+ if ( pViewBox && ( *pViewBox >>= aViewBox ) )
+ {
+ if ( ( aViewBox.Width == pDefCustomShape->nCoordWidth )
+ && ( aViewBox.Height == pDefCustomShape->nCoordHeight ) )
+ bIsDefaultGeometry = sal_True;
+ }
+ }
+ break;
+
+ case DEFAULT_PATH :
+ {
+ const rtl::OUString sCoordinates( RTL_CONSTASCII_USTRINGPARAM ( "Coordinates" ) );
+ pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sCoordinates );
+ if ( pAny && pDefCustomShape && pDefCustomShape->nVertices && pDefCustomShape->pVertices )
+ {
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair> seqCoordinates1, seqCoordinates2;
+ if ( *pAny >>= seqCoordinates1 )
+ {
+ sal_Int32 i, nCount = pDefCustomShape->nVertices;
+ seqCoordinates2.realloc( nCount );
+ for ( i = 0; i < nCount; i++ )
+ {
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqCoordinates2[ i ].First, pDefCustomShape->pVertices[ i ].nValA );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqCoordinates2[ i ].Second, pDefCustomShape->pVertices[ i ].nValB );
+ }
+ if ( seqCoordinates1 == seqCoordinates2 )
+ bIsDefaultGeometry = sal_True;
+ }
+ }
+ else if ( pDefCustomShape && ( ( pDefCustomShape->nVertices == 0 ) || ( pDefCustomShape->pVertices == 0 ) ) )
+ bIsDefaultGeometry = sal_True;
+ }
+ break;
+
+ case DEFAULT_GLUEPOINTS :
+ {
+ const rtl::OUString sGluePoints( RTL_CONSTASCII_USTRINGPARAM ( "GluePoints" ) );
+ pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sGluePoints );
+ if ( pAny && pDefCustomShape && pDefCustomShape->nGluePoints && pDefCustomShape->pGluePoints )
+ {
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair> seqGluePoints1, seqGluePoints2;
+ if ( *pAny >>= seqGluePoints1 )
+ {
+ sal_Int32 i, nCount = pDefCustomShape->nGluePoints;
+ seqGluePoints2.realloc( nCount );
+ for ( i = 0; i < nCount; i++ )
+ {
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqGluePoints2[ i ].First, pDefCustomShape->pGluePoints[ i ].nValA );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqGluePoints2[ i ].Second, pDefCustomShape->pGluePoints[ i ].nValB );
+ }
+ if ( seqGluePoints1 == seqGluePoints2 )
+ bIsDefaultGeometry = sal_True;
+ }
+ }
+ else if ( pDefCustomShape && ( pDefCustomShape->nGluePoints == 0 ) )
+ bIsDefaultGeometry = sal_True;
+ }
+ break;
+
+ case DEFAULT_SEGMENTS :
+ {
+ ///////////////////
+ // Path/Segments //
+ ///////////////////
+ const rtl::OUString sSegments( RTL_CONSTASCII_USTRINGPARAM ( "Segments" ) );
+ pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sSegments );
+ if ( pAny )
+ {
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > seqSegments1, seqSegments2;
+ if ( *pAny >>= seqSegments1 )
+ {
+ if ( pDefCustomShape && pDefCustomShape->nElements && pDefCustomShape->pElements )
+ {
+ sal_Int32 i, nCount = pDefCustomShape->nElements;
+ if ( nCount )
+ {
+ seqSegments2.realloc( nCount );
+ for ( i = 0; i < nCount; i++ )
+ {
+ EnhancedCustomShapeSegment& rSegInfo = seqSegments2[ i ];
+ sal_uInt16 nSDat = pDefCustomShape->pElements[ i ];
+ switch( nSDat >> 8 )
+ {
+ case 0x00 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::LINETO;
+ rSegInfo.Count = nSDat & 0xff;
+ if ( !rSegInfo.Count )
+ rSegInfo.Count = 1;
+ }
+ break;
+ case 0x20 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::CURVETO;
+ rSegInfo.Count = nSDat & 0xff;
+ if ( !rSegInfo.Count )
+ rSegInfo.Count = 1;
+ }
+ break;
+ case 0x40 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::MOVETO;
+ rSegInfo.Count = nSDat & 0xff;
+ if ( !rSegInfo.Count )
+ rSegInfo.Count = 1;
+ }
+ break;
+ case 0x60 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::CLOSESUBPATH;
+ rSegInfo.Count = 0;
+ }
+ break;
+ case 0x80 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ENDSUBPATH;
+ rSegInfo.Count = 0;
+ }
+ break;
+ case 0xa1 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ANGLEELLIPSETO;
+ rSegInfo.Count = ( nSDat & 0xff ) / 3;
+ }
+ break;
+ case 0xa2 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ANGLEELLIPSE;
+ rSegInfo.Count = ( nSDat & 0xff ) / 3;
+ }
+ break;
+ case 0xa3 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ARCTO;
+ rSegInfo.Count = ( nSDat & 0xff ) >> 2;
+ }
+ break;
+ case 0xa4 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ARC;
+ rSegInfo.Count = ( nSDat & 0xff ) >> 2;
+ }
+ break;
+ case 0xa5 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::CLOCKWISEARCTO;
+ rSegInfo.Count = ( nSDat & 0xff ) >> 2;
+ }
+ break;
+ case 0xa6 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::CLOCKWISEARC;
+ rSegInfo.Count = ( nSDat & 0xff ) >> 2;
+ }
+ break;
+ case 0xa7 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTX;
+ rSegInfo.Count = nSDat & 0xff;
+ }
+ break;
+ case 0xa8 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTY;
+ rSegInfo.Count = nSDat & 0xff;
+ }
+ break;
+ case 0xaa :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::NOFILL;
+ rSegInfo.Count = 0;
+ }
+ break;
+ case 0xab :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::NOSTROKE;
+ rSegInfo.Count = 0;
+ }
+ break;
+ default:
+ case 0xf8 :
+ {
+ rSegInfo.Command = EnhancedCustomShapeSegmentCommand::UNKNOWN;
+ rSegInfo.Count = nSDat;
+ }
+ break;
+ }
+ }
+ if ( seqSegments1 == seqSegments2 )
+ bIsDefaultGeometry = sal_True;
+ }
+ }
+ else
+ {
+ // check if its the default segment description ( M L Z N )
+ if ( seqSegments1.getLength() == 4 )
+ {
+ if ( ( seqSegments1[ 0 ].Command == EnhancedCustomShapeSegmentCommand::MOVETO )
+ && ( seqSegments1[ 1 ].Command == EnhancedCustomShapeSegmentCommand::LINETO )
+ && ( seqSegments1[ 2 ].Command == EnhancedCustomShapeSegmentCommand::CLOSESUBPATH )
+ && ( seqSegments1[ 3 ].Command == EnhancedCustomShapeSegmentCommand::ENDSUBPATH ) )
+ bIsDefaultGeometry = sal_True;
+ }
+ }
+ }
+ }
+ else if ( pDefCustomShape && ( ( pDefCustomShape->nElements == 0 ) || ( pDefCustomShape->pElements == 0 ) ) )
+ bIsDefaultGeometry = sal_True;
+ }
+ break;
+
+ case DEFAULT_STRETCHX :
+ {
+ const rtl::OUString sStretchX( RTL_CONSTASCII_USTRINGPARAM ( "StretchX" ) );
+ pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sStretchX );
+ if ( pAny && pDefCustomShape )
+ {
+ sal_Int32 nStretchX = 0;
+ if ( *pAny >>= nStretchX )
+ {
+ if ( pDefCustomShape->nXRef == nStretchX )
+ bIsDefaultGeometry = sal_True;
+ }
+ }
+ else if ( pDefCustomShape && ( pDefCustomShape->nXRef == DEFAULT_MINIMUM_SIGNED_COMPARE ) )
+ bIsDefaultGeometry = sal_True;
+ }
+ break;
+
+ case DEFAULT_STRETCHY :
+ {
+ const rtl::OUString sStretchY( RTL_CONSTASCII_USTRINGPARAM ( "StretchY" ) );
+ pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sStretchY );
+ if ( pAny && pDefCustomShape )
+ {
+ sal_Int32 nStretchY = 0;
+ if ( *pAny >>= nStretchY )
+ {
+ if ( pDefCustomShape->nYRef == nStretchY )
+ bIsDefaultGeometry = sal_True;
+ }
+ }
+ else if ( pDefCustomShape && ( pDefCustomShape->nYRef == DEFAULT_MINIMUM_SIGNED_COMPARE ) )
+ bIsDefaultGeometry = sal_True;
+ }
+ break;
+
+ case DEFAULT_EQUATIONS :
+ {
+ const rtl::OUString sEquations( RTL_CONSTASCII_USTRINGPARAM( "Equations" ) );
+ pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sEquations );
+ if ( pAny && pDefCustomShape && pDefCustomShape->nCalculation && pDefCustomShape->pCalculation )
+ {
+ com::sun::star::uno::Sequence< rtl::OUString > seqEquations1, seqEquations2;
+ if ( *pAny >>= seqEquations1 )
+ {
+ sal_Int32 i, nCount = pDefCustomShape->nCalculation;
+ seqEquations2.realloc( nCount );
+
+ const SvxMSDffCalculationData* pData = pDefCustomShape->pCalculation;
+ for ( i = 0; i < nCount; i++, pData++ )
+ seqEquations2[ i ] = EnhancedCustomShape2d::GetEquation( pData->nFlags, pData->nVal[ 0 ], pData->nVal[ 1 ], pData->nVal[ 2 ] );
+
+ if ( seqEquations1 == seqEquations2 )
+ bIsDefaultGeometry = sal_True;
+ }
+ }
+ else if ( pDefCustomShape && ( ( pDefCustomShape->nCalculation == 0 ) || ( pDefCustomShape->pCalculation == 0 ) ) )
+ bIsDefaultGeometry = sal_True;
+ }
+ break;
+
+ case DEFAULT_TEXTFRAMES :
+ {
+ const rtl::OUString sTextFrames( RTL_CONSTASCII_USTRINGPARAM( "TextFrames" ) );
+ pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sTextFrames );
+ if ( pAny && pDefCustomShape && pDefCustomShape->nTextRect && pDefCustomShape->pTextRect )
+ {
+ com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame > seqTextFrames1, seqTextFrames2;
+ if ( *pAny >>= seqTextFrames1 )
+ {
+ sal_Int32 i, nCount = pDefCustomShape->nTextRect;
+ seqTextFrames2.realloc( nCount );
+ const SvxMSDffTextRectangles* pRectangles = pDefCustomShape->pTextRect;
+ for ( i = 0; i < nCount; i++, pRectangles++ )
+ {
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames2[ i ].TopLeft.First, pRectangles->nPairA.nValA );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames2[ i ].TopLeft.Second, pRectangles->nPairA.nValB );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames2[ i ].BottomRight.First, pRectangles->nPairB.nValA );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqTextFrames2[ i ].BottomRight.Second, pRectangles->nPairB.nValB );
+ }
+ if ( seqTextFrames1 == seqTextFrames2 )
+ bIsDefaultGeometry = sal_True;
+ }
+ }
+ else if ( pDefCustomShape && ( ( pDefCustomShape->nTextRect == 0 ) || ( pDefCustomShape->pTextRect == 0 ) ) )
+ bIsDefaultGeometry = sal_True;
+ }
+ break;
+
+ case DEFAULT_HANDLES :
+ {
+ const rtl::OUString sHandles( RTL_CONSTASCII_USTRINGPARAM( "Handles" ) );
+ pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sHandles );
+ if ( pAny && pDefCustomShape && pDefCustomShape->nHandles && pDefCustomShape->pHandles )
+ {
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValues > seqHandles1, seqHandles2;
+ if ( *pAny >>= seqHandles1 )
+ {
+ sal_Int32 i, n, nCount = pDefCustomShape->nHandles;
+ const SvxMSDffHandle* pData = pDefCustomShape->pHandles;
+ seqHandles2.realloc( nCount );
+ for ( i = 0; i < nCount; i++, pData++ )
+ {
+ sal_Int32 nPropertiesNeeded = 1; // position is always needed
+ sal_Int32 nFlags = pData->nFlags;
+ if ( nFlags & MSDFF_HANDLE_FLAGS_MIRRORED_X )
+ nPropertiesNeeded++;
+ if ( nFlags & MSDFF_HANDLE_FLAGS_MIRRORED_Y )
+ nPropertiesNeeded++;
+ if ( nFlags & MSDFF_HANDLE_FLAGS_SWITCHED )
+ nPropertiesNeeded++;
+ if ( nFlags & MSDFF_HANDLE_FLAGS_POLAR )
+ {
+ nPropertiesNeeded++;
+ if ( nFlags & MSDFF_HANDLE_FLAGS_RADIUS_RANGE )
+ {
+ if ( pData->nRangeXMin != DEFAULT_MINIMUM_SIGNED_COMPARE )
+ nPropertiesNeeded++;
+ if ( pData->nRangeXMax != DEFAULT_MAXIMUM_SIGNED_COMPARE )
+ nPropertiesNeeded++;
+ }
+ }
+ else if ( nFlags & MSDFF_HANDLE_FLAGS_RANGE )
+ {
+ if ( pData->nRangeXMin != DEFAULT_MINIMUM_SIGNED_COMPARE )
+ nPropertiesNeeded++;
+ if ( pData->nRangeXMax != DEFAULT_MAXIMUM_SIGNED_COMPARE )
+ nPropertiesNeeded++;
+ if ( pData->nRangeYMin != DEFAULT_MINIMUM_SIGNED_COMPARE )
+ nPropertiesNeeded++;
+ if ( pData->nRangeYMax != DEFAULT_MAXIMUM_SIGNED_COMPARE )
+ nPropertiesNeeded++;
+ }
+
+ n = 0;
+ com::sun::star::beans::PropertyValues& rPropValues = seqHandles2[ i ];
+ rPropValues.realloc( nPropertiesNeeded );
+
+ // POSITION
+ {
+ const rtl::OUString sPosition( RTL_CONSTASCII_USTRINGPARAM ( "Position" ) );
+ ::com::sun::star::drawing::EnhancedCustomShapeParameterPair aPosition;
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aPosition.First, pData->nPositionX, sal_True, sal_True );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aPosition.Second, pData->nPositionY, sal_True, sal_False );
+ rPropValues[ n ].Name = sPosition;
+ rPropValues[ n++ ].Value <<= aPosition;
+ }
+ if ( nFlags & MSDFF_HANDLE_FLAGS_MIRRORED_X )
+ {
+ const rtl::OUString sMirroredX( RTL_CONSTASCII_USTRINGPARAM ( "MirroredX" ) );
+ sal_Bool bMirroredX = sal_True;
+ rPropValues[ n ].Name = sMirroredX;
+ rPropValues[ n++ ].Value <<= bMirroredX;
+ }
+ if ( nFlags & MSDFF_HANDLE_FLAGS_MIRRORED_Y )
+ {
+ const rtl::OUString sMirroredY( RTL_CONSTASCII_USTRINGPARAM ( "MirroredY" ) );
+ sal_Bool bMirroredY = sal_True;
+ rPropValues[ n ].Name = sMirroredY;
+ rPropValues[ n++ ].Value <<= bMirroredY;
+ }
+ if ( nFlags & MSDFF_HANDLE_FLAGS_SWITCHED )
+ {
+ const rtl::OUString sSwitched( RTL_CONSTASCII_USTRINGPARAM ( "Switched" ) );
+ sal_Bool bSwitched = sal_True;
+ rPropValues[ n ].Name = sSwitched;
+ rPropValues[ n++ ].Value <<= bSwitched;
+ }
+ if ( nFlags & MSDFF_HANDLE_FLAGS_POLAR )
+ {
+ const rtl::OUString sPolar( RTL_CONSTASCII_USTRINGPARAM ( "Polar" ) );
+ ::com::sun::star::drawing::EnhancedCustomShapeParameterPair aCenter;
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aCenter.First, pData->nCenterX,
+ ( nFlags & MSDFF_HANDLE_FLAGS_CENTER_X_IS_SPECIAL ) != 0, sal_True );
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aCenter.Second, pData->nCenterY,
+ ( nFlags & MSDFF_HANDLE_FLAGS_CENTER_Y_IS_SPECIAL ) != 0, sal_False );
+ rPropValues[ n ].Name = sPolar;
+ rPropValues[ n++ ].Value <<= aCenter;
+ if ( nFlags & MSDFF_HANDLE_FLAGS_RADIUS_RANGE )
+ {
+ if ( pData->nRangeXMin != DEFAULT_MINIMUM_SIGNED_COMPARE )
+ {
+ const rtl::OUString sRadiusRangeMinimum( RTL_CONSTASCII_USTRINGPARAM ( "RadiusRangeMinimum" ) );
+ ::com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum;
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRadiusRangeMinimum, pData->nRangeXMin,
+ ( nFlags & MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL ) != 0, sal_True );
+ rPropValues[ n ].Name = sRadiusRangeMinimum;
+ rPropValues[ n++ ].Value <<= aRadiusRangeMinimum;
+ }
+ if ( pData->nRangeXMax != DEFAULT_MAXIMUM_SIGNED_COMPARE )
+ {
+ const rtl::OUString sRadiusRangeMaximum( RTL_CONSTASCII_USTRINGPARAM ( "RadiusRangeMaximum" ) );
+ ::com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum;
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRadiusRangeMaximum, pData->nRangeXMax,
+ ( nFlags & MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL ) != 0, sal_False );
+ rPropValues[ n ].Name = sRadiusRangeMaximum;
+ rPropValues[ n++ ].Value <<= aRadiusRangeMaximum;
+ }
+ }
+ }
+ else if ( nFlags & MSDFF_HANDLE_FLAGS_RANGE )
+ {
+ if ( pData->nRangeXMin != DEFAULT_MINIMUM_SIGNED_COMPARE )
+ {
+ const rtl::OUString sRangeXMinimum( RTL_CONSTASCII_USTRINGPARAM ( "RangeXMinimum" ) );
+ ::com::sun::star::drawing::EnhancedCustomShapeParameter aRangeXMinimum;
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRangeXMinimum, pData->nRangeXMin,
+ ( nFlags & MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL ) != 0, sal_True );
+ rPropValues[ n ].Name = sRangeXMinimum;
+ rPropValues[ n++ ].Value <<= aRangeXMinimum;
+ }
+ if ( pData->nRangeXMax != DEFAULT_MAXIMUM_SIGNED_COMPARE )
+ {
+ const rtl::OUString sRangeXMaximum( RTL_CONSTASCII_USTRINGPARAM ( "RangeXMaximum" ) );
+ ::com::sun::star::drawing::EnhancedCustomShapeParameter aRangeXMaximum;
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRangeXMaximum, pData->nRangeXMax,
+ ( nFlags & MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL ) != 0, sal_False );
+ rPropValues[ n ].Name = sRangeXMaximum;
+ rPropValues[ n++ ].Value <<= aRangeXMaximum;
+ }
+ if ( pData->nRangeYMin != DEFAULT_MINIMUM_SIGNED_COMPARE )
+ {
+ const rtl::OUString sRangeYMinimum( RTL_CONSTASCII_USTRINGPARAM ( "RangeYMinimum" ) );
+ ::com::sun::star::drawing::EnhancedCustomShapeParameter aRangeYMinimum;
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRangeYMinimum, pData->nRangeYMin,
+ ( nFlags & MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL ) != 0, sal_True );
+ rPropValues[ n ].Name = sRangeYMinimum;
+ rPropValues[ n++ ].Value <<= aRangeYMinimum;
+ }
+ if ( pData->nRangeYMax != DEFAULT_MAXIMUM_SIGNED_COMPARE )
+ {
+ const rtl::OUString sRangeYMaximum( RTL_CONSTASCII_USTRINGPARAM ( "RangeYMaximum" ) );
+ ::com::sun::star::drawing::EnhancedCustomShapeParameter aRangeYMaximum;
+ EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRangeYMaximum, pData->nRangeYMax,
+ ( nFlags & MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL ) != 0, sal_False );
+ rPropValues[ n ].Name = sRangeYMaximum;
+ rPropValues[ n++ ].Value <<= aRangeYMaximum;
+ }
+ }
+ }
+ if ( seqHandles1 == seqHandles2 )
+ bIsDefaultGeometry = sal_True;
+ }
+ }
+ else if ( pDefCustomShape && ( ( pDefCustomShape->nHandles == 0 ) || ( pDefCustomShape->pHandles == 0 ) ) )
+ bIsDefaultGeometry = sal_True;
+ }
+ break;
+ }
+ return bIsDefaultGeometry;
+}
+
+void SdrObjCustomShape::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
+{
+ rInfo.bResizeFreeAllowed=fObjectRotation == 0.0;
+ rInfo.bResizePropAllowed=sal_True;
+ rInfo.bRotateFreeAllowed=sal_True;
+ rInfo.bRotate90Allowed =sal_True;
+ rInfo.bMirrorFreeAllowed=sal_True;
+ rInfo.bMirror45Allowed =sal_True;
+ rInfo.bMirror90Allowed =sal_True;
+ rInfo.bTransparenceAllowed = sal_False;
+ rInfo.bGradientAllowed = sal_False;
+ rInfo.bShearAllowed =sal_True;
+ rInfo.bEdgeRadiusAllowed=sal_False;
+ rInfo.bNoContortion =sal_True;
+
+ // #i37011#
+ if ( mXRenderedCustomShape.is() )
+ {
+ const SdrObject* pRenderedCustomShape = GetSdrObjectFromXShape( mXRenderedCustomShape );
+ if ( pRenderedCustomShape )
+ {
+ // #i37262#
+ // Iterate self over the contained objects, since there are combinations of
+ // polygon and curve objects. In that case, aInfo.bCanConvToPath and
+ // aInfo.bCanConvToPoly would be false. What is needed here is an or, not an and.
+ SdrObjListIter aIterator(*pRenderedCustomShape);
+ while(aIterator.IsMore())
+ {
+ SdrObject* pCandidate = aIterator.Next();
+ SdrObjTransformInfoRec aInfo;
+ pCandidate->TakeObjInfo(aInfo);
+
+ // set path and poly conversion if one is possible since
+ // this object will first be broken
+ const sal_Bool bCanConvToPathOrPoly(aInfo.bCanConvToPath || aInfo.bCanConvToPoly);
+ if(rInfo.bCanConvToPath != bCanConvToPathOrPoly)
+ {
+ rInfo.bCanConvToPath = bCanConvToPathOrPoly;
+ }
+
+ if(rInfo.bCanConvToPoly != bCanConvToPathOrPoly)
+ {
+ rInfo.bCanConvToPoly = bCanConvToPathOrPoly;
+ }
+
+ if(rInfo.bCanConvToContour != aInfo.bCanConvToContour)
+ {
+ rInfo.bCanConvToContour = aInfo.bCanConvToContour;
+ }
+ }
+ }
+ }
+}
+
+void SdrObjCustomShape::SetModel(SdrModel* pNewModel)
+{
+ SdrTextObj::SetModel(pNewModel);
+ mXRenderedCustomShape.clear();
+}
+
+sal_uInt16 SdrObjCustomShape::GetObjIdentifier() const
+{
+ return sal_uInt16(OBJ_CUSTOMSHAPE);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrObjCustomShape::RecalcSnapRect()
+{
+ SdrTextObj::RecalcSnapRect();
+}
+const Rectangle& SdrObjCustomShape::GetSnapRect() const
+{
+ return SdrTextObj::GetSnapRect();
+}
+const Rectangle& SdrObjCustomShape::GetCurrentBoundRect() const
+{
+ return SdrTextObj::GetCurrentBoundRect();
+}
+const Rectangle& SdrObjCustomShape::GetLogicRect() const
+{
+ return SdrTextObj::GetLogicRect();
+}
+void SdrObjCustomShape::NbcSetSnapRect( const Rectangle& rRect )
+{
+ aRect=rRect;
+ ImpJustifyRect(aRect);
+ InvalidateRenderGeometry();
+ Rectangle aTextBound( aRect );
+ if ( GetTextBounds( aTextBound ) )
+ {
+ if ( pModel==NULL || !pModel->IsPasteResize() )
+ {
+ long nHDist=GetTextLeftDistance()+GetTextRightDistance();
+ long nVDist=GetTextUpperDistance()+GetTextLowerDistance();
+ long nTWdt=aTextBound.GetWidth ()-1-nHDist; if (nTWdt<0) nTWdt=0;
+ long nTHgt=aTextBound.GetHeight()-1-nVDist; if (nTHgt<0) nTHgt=0;
+ if ( IsAutoGrowWidth() )
+ NbcSetMinTextFrameWidth( nTWdt );
+ if ( IsAutoGrowHeight() )
+ NbcSetMinTextFrameHeight( nTHgt );
+ NbcAdjustTextFrameWidthAndHeight();
+ }
+ }
+ ImpCheckShear();
+ SetRectsDirty();
+ SetChanged();
+}
+void SdrObjCustomShape::SetSnapRect( const Rectangle& rRect )
+{
+ Rectangle aBoundRect0;
+ if ( pUserCall )
+ aBoundRect0 = GetLastBoundRect();
+ NbcSetSnapRect( rRect );
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+}
+void SdrObjCustomShape::NbcSetLogicRect( const Rectangle& rRect )
+{
+ aRect = rRect;
+ ImpJustifyRect( aRect );
+ InvalidateRenderGeometry();
+ Rectangle aTextBound( aRect );
+ if ( GetTextBounds( aTextBound ) )
+ {
+ long nHDist=GetTextLeftDistance()+GetTextRightDistance();
+ long nVDist=GetTextUpperDistance()+GetTextLowerDistance();
+
+ long nTWdt=aTextBound.GetWidth()-1-nHDist; if (nTWdt<0) nTWdt=0;
+ long nTHgt=aTextBound.GetHeight()-1-nVDist; if (nTHgt<0) nTHgt=0;
+ if ( IsAutoGrowWidth() )
+ NbcSetMinTextFrameWidth( nTWdt );
+ if ( IsAutoGrowHeight() )
+ NbcSetMinTextFrameHeight( nTHgt );
+ NbcAdjustTextFrameWidthAndHeight();
+ }
+ SetRectsDirty();
+ SetChanged();
+}
+void SdrObjCustomShape::SetLogicRect( const Rectangle& rRect )
+{
+ Rectangle aBoundRect0;
+ if ( pUserCall )
+ aBoundRect0 = GetLastBoundRect();
+ NbcSetLogicRect(rRect);
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+}
+void SdrObjCustomShape::Move( const Size& rSiz )
+{
+ if ( rSiz.Width() || rSiz.Height() )
+ {
+ Rectangle aBoundRect0;
+ if ( pUserCall )
+ aBoundRect0 = GetLastBoundRect();
+ // #110094#-14 SendRepaintBroadcast();
+ NbcMove(rSiz);
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0);
+ }
+}
+void SdrObjCustomShape::NbcMove( const Size& rSiz )
+{
+ SdrTextObj::NbcMove( rSiz );
+ if ( mXRenderedCustomShape.is() )
+ {
+ SdrObject* pRenderedCustomShape = GetSdrObjectFromXShape( mXRenderedCustomShape );
+ if ( pRenderedCustomShape )
+ {
+ // #i97149# the visualisation shape needs to be informed
+ // about change, too
+ pRenderedCustomShape->ActionChanged();
+ pRenderedCustomShape->NbcMove( rSiz );
+ }
+ }
+
+ // #i37011# adapt geometry shadow
+ if(mpLastShadowGeometry)
+ {
+ mpLastShadowGeometry->NbcMove( rSiz );
+ }
+}
+void SdrObjCustomShape::Resize( const Point& rRef, const Fraction& xFact, const Fraction& yFact )
+{
+ SdrTextObj::Resize( rRef, xFact, yFact );
+}
+
+void SdrObjCustomShape::NbcResize( const Point& rRef, const Fraction& rxFact, const Fraction& ryFact )
+{
+ Fraction xFact( rxFact );
+ Fraction yFact( ryFact );
+
+ // taking care of handles that should not been changed
+ Rectangle aOld( aRect );
+ std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles( this ) );
+
+ SdrTextObj::NbcResize( rRef, xFact, yFact );
+
+ if ( ( xFact.GetNumerator() != xFact.GetDenominator() )
+ || ( yFact.GetNumerator()!= yFact.GetDenominator() ) )
+ {
+ if ( ( ( xFact.GetNumerator() < 0 ) && ( xFact.GetDenominator() > 0 ) ) ||
+ ( ( xFact.GetNumerator() > 0 ) && ( xFact.GetDenominator() < 0 ) ) )
+ {
+ SetMirroredX( IsMirroredX() == sal_False );
+ }
+ if ( ( ( yFact.GetNumerator() < 0 ) && ( yFact.GetDenominator() > 0 ) ) ||
+ ( ( yFact.GetNumerator() > 0 ) && ( yFact.GetDenominator() < 0 ) ) )
+ {
+ SetMirroredY( IsMirroredY() == sal_False );
+ }
+ }
+
+ std::vector< SdrCustomShapeInteraction >::iterator aIter( aInteractionHandles.begin() );
+ while ( aIter != aInteractionHandles.end() )
+ {
+ try
+ {
+ if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_FIXED )
+ aIter->xInteraction->setControllerPosition( aIter->aPosition );
+ if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_X )
+ {
+ sal_Int32 nX = ( aIter->aPosition.X - aOld.Left() ) + aRect.Left();
+ aIter->xInteraction->setControllerPosition( com::sun::star::awt::Point( nX, aIter->xInteraction->getPosition().Y ) );
+ }
+ if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_Y )
+ {
+ sal_Int32 nY = ( aIter->aPosition.Y - aOld.Top() ) + aRect.Top();
+ aIter->xInteraction->setControllerPosition( com::sun::star::awt::Point( aIter->xInteraction->getPosition().X, nY ) );
+ }
+ }
+ catch ( const uno::RuntimeException& )
+ {
+ }
+ aIter++;
+ }
+ InvalidateRenderGeometry();
+}
+void SdrObjCustomShape::NbcRotate( const Point& rRef, long nWink, double sn, double cs )
+{
+ sal_Bool bMirroredX = IsMirroredX();
+ sal_Bool bMirroredY = IsMirroredY();
+
+ fObjectRotation = fmod( fObjectRotation, 360.0 );
+ if ( fObjectRotation < 0 )
+ fObjectRotation = 360 + fObjectRotation;
+
+ // the rotation angle for ashapes is stored in fObjectRotation, this rotation
+ // has to be applied to the text object (which is internally using aGeo.nWink).
+ SdrTextObj::NbcRotate( aRect.TopLeft(), -aGeo.nDrehWink, // retrieving the unrotated text object
+ sin( (-aGeo.nDrehWink) * F_PI18000 ),
+ cos( (-aGeo.nDrehWink) * F_PI18000 ) );
+ aGeo.nDrehWink = 0; // resetting aGeo data
+ aGeo.RecalcSinCos();
+
+ long nW = (long)( fObjectRotation * 100 ); // applying our object rotation
+ if ( bMirroredX )
+ nW = 36000 - nW;
+ if ( bMirroredY )
+ nW = 18000 - nW;
+ nW = nW % 36000;
+ if ( nW < 0 )
+ nW = 36000 + nW;
+ SdrTextObj::NbcRotate( aRect.TopLeft(), nW, // applying text rotation
+ sin( nW * F_PI18000 ),
+ cos( nW * F_PI18000 ) );
+
+ int nSwap = 0;
+ if ( bMirroredX )
+ nSwap ^= 1;
+ if ( bMirroredY )
+ nSwap ^= 1;
+
+ double fWink = nWink; // updating to our new object rotation
+ fWink /= 100.0;
+ fObjectRotation = fmod( nSwap ? fObjectRotation - fWink : fObjectRotation + fWink, 360.0 );
+ if ( fObjectRotation < 0 )
+ fObjectRotation = 360 + fObjectRotation;
+
+ SdrTextObj::NbcRotate( rRef, nWink, sn, cs ); // applying text rotation
+ InvalidateRenderGeometry();
+}
+
+void SdrObjCustomShape::NbcMirror( const Point& rRef1, const Point& rRef2 )
+{
+ // storing horizontal and vertical flipping without modifying the rotate angle
+
+ sal_Bool bHorz = sal_False;
+ sal_Bool bVert = sal_False;
+ if ( rRef1.X() == rRef2.X() )
+ bHorz = sal_True;
+ if ( rRef1.Y() == rRef2.Y() )
+ bVert = sal_True;
+ if ( !bHorz && !bVert )
+ bHorz = bVert = sal_True;
+
+ if ( bHorz || bVert )
+ {
+ SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+
+ /////////////////
+ // "MirroredX" //
+ /////////////////
+ if ( bHorz )
+ {
+ const rtl::OUString sMirroredX( RTL_CONSTASCII_USTRINGPARAM ( "MirroredX" ) );
+ com::sun::star::uno::Any* pAny = aGeometryItem.GetPropertyValueByName( sMirroredX );
+ if ( pAny )
+ {
+ sal_Bool bFlip = sal_Bool();
+ if ( *pAny >>= bFlip )
+ {
+ if ( bFlip )
+ bHorz = sal_False;
+ }
+ }
+ PropertyValue aPropVal;
+ aPropVal.Name = sMirroredX;
+ aPropVal.Value <<= bHorz;
+ aGeometryItem.SetPropertyValue( aPropVal );
+ }
+
+ /////////////////
+ // "MirroredY" //
+ /////////////////
+ if ( bVert )
+ {
+ const rtl::OUString sMirroredY( RTL_CONSTASCII_USTRINGPARAM ( "MirroredY" ) );
+ com::sun::star::uno::Any* pAny = aGeometryItem.GetPropertyValueByName( sMirroredY );
+ if ( pAny )
+ {
+ sal_Bool bFlip = sal_Bool();
+ if ( *pAny >>= bFlip )
+ {
+ if ( bFlip )
+ bVert = sal_False;
+ }
+ }
+ PropertyValue aPropVal;
+ aPropVal.Name = sMirroredY;
+ aPropVal.Value <<= bVert;
+ aGeometryItem.SetPropertyValue( aPropVal );
+ }
+ SetMergedItem( aGeometryItem );
+ }
+ SdrTextObj::NbcMirror( rRef1, rRef2 );
+ InvalidateRenderGeometry();
+}
+
+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 )
+{
+ 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(sal_uInt16 nPosNum) const
+{
+ sal_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(sal_False);
+ return aGP;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+// #i38892#
+void SdrObjCustomShape::ImpCheckCustomGluePointsAreAdded()
+{
+ const SdrObject* pSdrObject = GetSdrObjectFromCustomShape();
+
+ if(pSdrObject)
+ {
+ const SdrGluePointList* pSource = pSdrObject->GetGluePointList();
+
+ if(pSource && pSource->GetCount())
+ {
+ if(!SdrTextObj::GetGluePointList())
+ {
+ SdrTextObj::ForceGluePointList();
+ }
+
+ const SdrGluePointList* pList = SdrTextObj::GetGluePointList();
+
+ if(pList)
+ {
+ SdrGluePointList aNewList;
+ sal_uInt16 a;
+
+ for(a = 0; a < pSource->GetCount(); a++)
+ {
+ SdrGluePoint aCopy((*pSource)[a]);
+ aCopy.SetUserDefined(sal_False);
+ 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 )
+ {
+ sal_uInt16 nPointCount=aPoly.GetSize();
+ for (sal_uInt16 i=0; i<nPointCount; i++)
+ ShearPoint(aPoly[i],aRect.Center(), fTan, sal_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];
+
+ if(rCandidate.IsUserDefined())
+ {
+ aNewList.Insert(rCandidate);
+ }
+ }
+
+ // copy new list to local. This is NOT very convenient behaviour, the local
+ // GluePointList should not be set, but be delivered by using GetGluePointList(),
+ // maybe on demand. Since the local object is changed here, this is assumed to
+ // be a result of GetGluePointList and thus the list is copied
+ if(pPlusData)
+ {
+ *pPlusData->pGluePoints = aNewList;
+ }
+ }
+ }
+ }
+}
+
+// #i38892#
+const SdrGluePointList* SdrObjCustomShape::GetGluePointList() const
+{
+ ((SdrObjCustomShape*)this)->ImpCheckCustomGluePointsAreAdded();
+ return SdrTextObj::GetGluePointList();
+}
+
+// #i38892#
+//SdrGluePointList* SdrObjCustomShape::GetGluePointList()
+//{
+// ImpCheckCustomGluePointsAreAdded();
+// return SdrTextObj::GetGluePointList();
+//}
+
+// #i38892#
+SdrGluePointList* SdrObjCustomShape::ForceGluePointList()
+{
+ if(SdrTextObj::ForceGluePointList())
+ {
+ ImpCheckCustomGluePointsAreAdded();
+ return SdrTextObj::ForceGluePointList();
+ }
+ else
+ {
+ return 0L;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_uInt32 SdrObjCustomShape::GetHdlCount() const
+{
+ const sal_uInt32 nBasicHdlCount(SdrTextObj::GetHdlCount());
+ std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles( this ) );
+ return ( aInteractionHandles.size() + nBasicHdlCount );
+}
+
+SdrHdl* SdrObjCustomShape::GetHdl( sal_uInt32 nHdlNum ) const
+{
+ SdrHdl* pH = NULL;
+ const sal_uInt32 nBasicHdlCount(SdrTextObj::GetHdlCount());
+
+ if ( nHdlNum < nBasicHdlCount )
+ pH = SdrTextObj::GetHdl( nHdlNum );
+ else
+ {
+ std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles( this ) );
+ const sal_uInt32 nCustomShapeHdlNum(nHdlNum - nBasicHdlCount);
+
+ if ( nCustomShapeHdlNum < aInteractionHandles.size() )
+ {
+ if ( aInteractionHandles[ nCustomShapeHdlNum ].xInteraction.is() )
+ {
+ try
+ {
+ com::sun::star::awt::Point aPosition( aInteractionHandles[ nCustomShapeHdlNum ].xInteraction->getPosition() );
+ pH = new SdrHdl( Point( aPosition.X, aPosition.Y ), HDL_CUSTOMSHAPE1 );
+ pH->SetPointNum( nCustomShapeHdlNum );
+ pH->SetObj( (SdrObject*)this );
+ }
+ catch ( const uno::RuntimeException& )
+ {
+ }
+ }
+ }
+ }
+ return pH;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+bool SdrObjCustomShape::hasSpecialDrag() const
+{
+ return true;
+}
+
+bool SdrObjCustomShape::beginSpecialDrag(SdrDragStat& rDrag) const
+{
+ const SdrHdl* pHdl = rDrag.GetHdl();
+
+ if(pHdl && HDL_CUSTOMSHAPE1 == pHdl->GetKind())
+ {
+ rDrag.SetEndDragChangesAttributes(true);
+ rDrag.SetNoSnap(true);
+ }
+ else
+ {
+ const SdrHdl* pHdl2 = rDrag.GetHdl();
+ const SdrHdlKind eHdl((pHdl2 == NULL) ? HDL_MOVE : pHdl2->GetKind());
+
+ switch( eHdl )
+ {
+ case HDL_UPLFT :
+ case HDL_UPPER :
+ case HDL_UPRGT :
+ case HDL_LEFT :
+ case HDL_RIGHT :
+ case HDL_LWLFT :
+ case HDL_LOWER :
+ case HDL_LWRGT :
+ case HDL_MOVE :
+ {
+ break;
+ }
+ default:
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+void SdrObjCustomShape::DragResizeCustomShape( const Rectangle& rNewRect, SdrObjCustomShape* pObj ) const
+{
+ Rectangle aOld( pObj->aRect );
+ sal_Bool bOldMirroredX( pObj->IsMirroredX() );
+ sal_Bool bOldMirroredY( pObj->IsMirroredY() );
+
+ Rectangle aNewRect( rNewRect );
+ aNewRect.Justify();
+
+ 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(), aGeoStat.nTan );
+ if ( pObj->aGeo.nDrehWink ) RotatePoint(aNewPos, aOld.TopLeft(), aGeoStat.nSin, aGeoStat.nCos );
+ aNewRect.SetPos( aNewPos );
+ }
+ if ( aNewRect != pObj->aRect )
+ {
+ pObj->SetLogicRect( aNewRect );
+ pObj->InvalidateRenderGeometry();
+
+ if ( rNewRect.Left() > rNewRect.Right() )
+ {
+ 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() )
+ {
+ Point aLeft( pObj->GetSnapRect().Left(), ( pObj->GetSnapRect().Top() + pObj->GetSnapRect().Bottom() ) >> 1 );
+ Point aRight( aLeft.X() + 1000, aLeft.Y() );
+ pObj->NbcMirror( aLeft, aRight );
+ }
+
+ std::vector< SdrCustomShapeInteraction >::iterator aIter( aInteractionHandles.begin() );
+ while ( aIter != aInteractionHandles.end() )
+ {
+ try
+ {
+ if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_FIXED )
+ aIter->xInteraction->setControllerPosition( aIter->aPosition );
+ if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_X )
+ {
+ sal_Int32 nX;
+ if ( bOldMirroredX )
+ {
+ nX = ( aIter->aPosition.X - aOld.Right() );
+ if ( rNewRect.Left() > rNewRect.Right() )
+ nX = pObj->aRect.Left() - nX;
+ else
+ nX += pObj->aRect.Right();
+ }
+ else
+ {
+ nX = ( aIter->aPosition.X - aOld.Left() );
+ if ( rNewRect.Left() > rNewRect.Right() )
+ nX = pObj->aRect.Right() - nX;
+ else
+ nX += pObj->aRect.Left();
+ }
+ aIter->xInteraction->setControllerPosition( com::sun::star::awt::Point( nX, aIter->xInteraction->getPosition().Y ) );
+ }
+ if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_ABSOLUTE_Y )
+ {
+ sal_Int32 nY;
+ if ( bOldMirroredY )
+ {
+ nY = ( aIter->aPosition.Y - aOld.Bottom() );
+ if ( rNewRect.Top() > rNewRect.Bottom() )
+ nY = pObj->aRect.Top() - nY;
+ else
+ nY += pObj->aRect.Bottom();
+ }
+ else
+ {
+ nY = ( aIter->aPosition.Y - aOld.Top() );
+ if ( rNewRect.Top() > rNewRect.Bottom() )
+ nY = pObj->aRect.Bottom() - nY;
+ else
+ nY += pObj->aRect.Top();
+ }
+ aIter->xInteraction->setControllerPosition( com::sun::star::awt::Point( aIter->xInteraction->getPosition().X, nY ) );
+ }
+ }
+ catch ( const uno::RuntimeException& )
+ {
+ }
+ aIter++;
+ }
+ }
+}
+
+void SdrObjCustomShape::DragMoveCustomShapeHdl( const Point aDestination, const sal_uInt16 nCustomShapeHdlNum, SdrObjCustomShape* pObj ) const
+{
+ std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles( pObj ) );
+ if ( nCustomShapeHdlNum < aInteractionHandles.size() )
+ {
+ SdrCustomShapeInteraction aInteractionHandle( aInteractionHandles[ nCustomShapeHdlNum ] );
+ if ( aInteractionHandle.xInteraction.is() )
+ {
+ try
+ {
+ com::sun::star::awt::Point aPt( aDestination.X(), aDestination.Y() );
+ if ( aInteractionHandle.nMode & CUSTOMSHAPE_HANDLE_MOVE_SHAPE )
+ {
+ sal_Int32 nXDiff = aPt.X - aInteractionHandle.aPosition.X;
+ sal_Int32 nYDiff = aPt.Y - aInteractionHandle.aPosition.Y;
+
+ pObj->aRect.Move( nXDiff, nYDiff );
+ pObj->aOutRect.Move( nXDiff, nYDiff );
+ pObj->maSnapRect.Move( nXDiff, nYDiff );
+ pObj->SetRectsDirty(sal_True);
+ pObj->InvalidateRenderGeometry();
+
+ std::vector< SdrCustomShapeInteraction >::iterator aIter( aInteractionHandles.begin() );
+ while ( aIter != aInteractionHandles.end() )
+ {
+ if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_FIXED )
+ {
+ if ( aIter->xInteraction.is() )
+ aIter->xInteraction->setControllerPosition( aIter->aPosition );
+ }
+ aIter++;
+ }
+ }
+ aInteractionHandle.xInteraction->setControllerPosition( aPt );
+ }
+ catch ( const uno::RuntimeException& )
+ {
+ }
+ }
+ }
+}
+
+bool SdrObjCustomShape::applySpecialDrag(SdrDragStat& rDrag)
+{
+ const SdrHdl* pHdl = rDrag.GetHdl();
+ const SdrHdlKind eHdl((pHdl == NULL) ? HDL_MOVE : pHdl->GetKind());
+
+ switch(eHdl)
+ {
+ case HDL_CUSTOMSHAPE1 :
+ {
+ rDrag.SetEndDragChangesGeoAndAttributes(true);
+ DragMoveCustomShapeHdl( rDrag.GetNow(), (sal_uInt16)pHdl->GetPointNum(), this );
+ SetRectsDirty();
+ InvalidateRenderGeometry();
+ SetChanged();
+ break;
+ }
+
+ case HDL_UPLFT :
+ case HDL_UPPER :
+ case HDL_UPRGT :
+ case HDL_LEFT :
+ case HDL_RIGHT :
+ case HDL_LWLFT :
+ case HDL_LOWER :
+ case HDL_LWRGT :
+ {
+ DragResizeCustomShape(ImpDragCalcRect(rDrag), this);
+ break;
+ }
+ case HDL_MOVE :
+ {
+ Move(Size(rDrag.GetDX(), rDrag.GetDY()));
+ break;
+ }
+ default: break;
+ }
+
+ return true;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrObjCustomShape::DragCreateObject( SdrDragStat& rStat )
+{
+ Rectangle aRect1;
+ rStat.TakeCreateRect( aRect1 );
+
+ std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles( this ) );
+
+ sal_uInt32 nDefaultObjectSizeWidth = 3000; // default width from SDOptions ?
+ sal_uInt32 nDefaultObjectSizeHeight= 3000;
+
+ if ( ImpVerticalSwitch( *this ) )
+ {
+ SetMirroredX( aRect1.Left() > aRect1.Right() );
+
+ aRect1 = Rectangle( rStat.GetNow(), Size( nDefaultObjectSizeWidth, nDefaultObjectSizeHeight ) );
+ // subtracting the horizontal difference of the latest handle from shape position
+ if ( aInteractionHandles.size() )
+ {
+ sal_Int32 nHandlePos = aInteractionHandles[ aInteractionHandles.size() - 1 ].xInteraction->getPosition().X;
+ aRect1.Move( aRect.Left() - nHandlePos, 0 );
+ }
+ }
+ ImpJustifyRect( aRect1 );
+ rStat.SetActionRect( aRect1 );
+ aRect = aRect1;
+ SetRectsDirty();
+
+ std::vector< SdrCustomShapeInteraction >::iterator aIter( aInteractionHandles.begin() );
+ while ( aIter != aInteractionHandles.end() )
+ {
+ try
+ {
+ if ( aIter->nMode & CUSTOMSHAPE_HANDLE_CREATE_FIXED )
+ aIter->xInteraction->setControllerPosition( awt::Point( rStat.GetStart().X(), rStat.GetStart().Y() ) );
+ }
+ catch ( const uno::RuntimeException& )
+ {
+ }
+ aIter++;
+ }
+
+ SetBoundRectDirty();
+ bSnapRectDirty=sal_True;
+}
+
+FASTBOOL SdrObjCustomShape::BegCreate( SdrDragStat& rDrag )
+{
+ return SdrTextObj::BegCreate( rDrag );
+}
+
+FASTBOOL SdrObjCustomShape::MovCreate(SdrDragStat& rStat)
+{
+ SdrView* pView = rStat.GetView(); // #i37448#
+ if( pView && pView->IsSolidDragging() )
+ {
+ InvalidateRenderGeometry();
+ }
+ DragCreateObject( rStat );
+ SetRectsDirty();
+ return sal_True;
+}
+
+FASTBOOL SdrObjCustomShape::EndCreate( SdrDragStat& rStat, SdrCreateCmd eCmd )
+{
+ DragCreateObject( rStat );
+
+ if ( bTextFrame )
+ {
+ if ( IsAutoGrowHeight() )
+ {
+ // MinTextHeight
+ long nHgt=aRect.GetHeight()-1;
+ if (nHgt==1) nHgt=0;
+ NbcSetMinTextFrameHeight( nHgt );
+ }
+ if ( IsAutoGrowWidth() )
+ {
+ // MinTextWidth
+ long nWdt=aRect.GetWidth()-1;
+ if (nWdt==1) nWdt=0;
+ NbcSetMinTextFrameWidth( nWdt );
+ }
+ // Textrahmen neu berechnen
+ NbcAdjustTextFrameWidthAndHeight();
+ }
+ SetRectsDirty();
+ return ( eCmd == SDRCREATE_FORCEEND || rStat.GetPointAnz() >= 2 );
+}
+
+basegfx::B2DPolyPolygon SdrObjCustomShape::TakeCreatePoly(const SdrDragStat& /*rDrag*/) const
+{
+ return GetLineGeometry( this, sal_False );
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+// in context with the SdrObjCustomShape the SdrTextAutoGrowHeightItem == true -> Resize Shape to fit text,
+// the SdrTextAutoGrowWidthItem == true -> Word wrap text in Shape
+FASTBOOL SdrObjCustomShape::IsAutoGrowHeight() const
+{
+ const SfxItemSet& rSet = GetMergedItemSet();
+ FASTBOOL bIsAutoGrowHeight = ((SdrTextAutoGrowHeightItem&)(rSet.Get(SDRATTR_TEXT_AUTOGROWHEIGHT))).GetValue();
+ if ( bIsAutoGrowHeight && IsVerticalWriting() )
+ bIsAutoGrowHeight = ((SdrTextWordWrapItem&)(rSet.Get(SDRATTR_TEXT_WORDWRAP))).GetValue() == sal_False;
+ return bIsAutoGrowHeight;
+}
+FASTBOOL SdrObjCustomShape::IsAutoGrowWidth() const
+{
+ const SfxItemSet& rSet = GetMergedItemSet();
+ FASTBOOL bIsAutoGrowWidth = ((SdrTextAutoGrowHeightItem&)(rSet.Get(SDRATTR_TEXT_AUTOGROWHEIGHT))).GetValue();
+ if ( bIsAutoGrowWidth && !IsVerticalWriting() )
+ bIsAutoGrowWidth = ((SdrTextWordWrapItem&)(rSet.Get(SDRATTR_TEXT_WORDWRAP))).GetValue() == sal_False;
+ return bIsAutoGrowWidth;
+}
+
+/* The following method is identical to the SdrTextObj::SetVerticalWriting method, the only difference
+ is that the SdrAutoGrowWidthItem and SdrAutoGrowHeightItem are not exchanged if the vertical writing
+ mode has been changed */
+
+void SdrObjCustomShape::SetVerticalWriting( sal_Bool bVertical )
+{
+ ForceOutlinerParaObject();
+
+ OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
+
+ DBG_ASSERT( pOutlinerParaObject, "SdrTextObj::SetVerticalWriting() without OutlinerParaObject!" );
+
+ if( pOutlinerParaObject )
+ {
+ if(pOutlinerParaObject->IsVertical() != (bool)bVertical)
+ {
+ // get item settings
+ const SfxItemSet& rSet = GetObjectItemSet();
+
+ // #103516# Also exchange hor/ver adjust items
+ SdrTextHorzAdjust eHorz = ((SdrTextHorzAdjustItem&)(rSet.Get(SDRATTR_TEXT_HORZADJUST))).GetValue();
+ SdrTextVertAdjust eVert = ((SdrTextVertAdjustItem&)(rSet.Get(SDRATTR_TEXT_VERTADJUST))).GetValue();
+
+ // rescue object size
+ Rectangle aObjectRect = GetSnapRect();
+
+ // prepare ItemSet to set exchanged width and height items
+ SfxItemSet aNewSet(*rSet.GetPool(),
+ SDRATTR_TEXT_AUTOGROWHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT,
+ // #103516# Expanded item ranges to also support hor and ver adjust.
+ SDRATTR_TEXT_VERTADJUST, SDRATTR_TEXT_VERTADJUST,
+ SDRATTR_TEXT_AUTOGROWWIDTH, SDRATTR_TEXT_HORZADJUST,
+ 0, 0);
+
+ aNewSet.Put(rSet);
+
+ // #103516# Exchange horz and vert adjusts
+ switch(eVert)
+ {
+ case SDRTEXTVERTADJUST_TOP: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT)); break;
+ case SDRTEXTVERTADJUST_CENTER: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER)); break;
+ case SDRTEXTVERTADJUST_BOTTOM: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT)); break;
+ case SDRTEXTVERTADJUST_BLOCK: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_BLOCK)); break;
+ }
+ switch(eHorz)
+ {
+ case SDRTEXTHORZADJUST_LEFT: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_BOTTOM)); break;
+ case SDRTEXTHORZADJUST_CENTER: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER)); break;
+ case SDRTEXTHORZADJUST_RIGHT: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP)); break;
+ case SDRTEXTHORZADJUST_BLOCK: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_BLOCK)); break;
+ }
+
+ SetObjectItemSet( aNewSet );
+ pOutlinerParaObject = GetOutlinerParaObject();
+ if ( pOutlinerParaObject )
+ pOutlinerParaObject->SetVertical(bVertical);
+
+ // restore object size
+ SetSnapRect(aObjectRect);
+ }
+ }
+}
+FASTBOOL SdrObjCustomShape::AdjustTextFrameWidthAndHeight(Rectangle& rR, FASTBOOL bHgt, FASTBOOL bWdt) const
+{
+ if ( pModel && HasText() && !rR.IsEmpty() )
+ {
+ FASTBOOL bWdtGrow=bWdt && IsAutoGrowWidth();
+ FASTBOOL bHgtGrow=bHgt && IsAutoGrowHeight();
+ if ( bWdtGrow || bHgtGrow )
+ {
+ Rectangle aR0(rR);
+ long nHgt=0,nMinHgt=0,nMaxHgt=0;
+ long nWdt=0,nMinWdt=0,nMaxWdt=0;
+ Size aSiz(rR.GetSize()); aSiz.Width()--; aSiz.Height()--;
+ Size aMaxSiz(100000,100000);
+ Size aTmpSiz(pModel->GetMaxObjSize());
+ if (aTmpSiz.Width()!=0) aMaxSiz.Width()=aTmpSiz.Width();
+ if (aTmpSiz.Height()!=0) aMaxSiz.Height()=aTmpSiz.Height();
+ if (bWdtGrow)
+ {
+ nMinWdt=GetMinTextFrameWidth();
+ nMaxWdt=GetMaxTextFrameWidth();
+ if (nMaxWdt==0 || nMaxWdt>aMaxSiz.Width()) nMaxWdt=aMaxSiz.Width();
+ if (nMinWdt<=0) nMinWdt=1;
+ aSiz.Width()=nMaxWdt;
+ }
+ if (bHgtGrow)
+ {
+ nMinHgt=GetMinTextFrameHeight();
+ nMaxHgt=GetMaxTextFrameHeight();
+ if (nMaxHgt==0 || nMaxHgt>aMaxSiz.Height()) nMaxHgt=aMaxSiz.Height();
+ if (nMinHgt<=0) nMinHgt=1;
+ aSiz.Height()=nMaxHgt;
+ }
+ long nHDist=GetTextLeftDistance()+GetTextRightDistance();
+ long nVDist=GetTextUpperDistance()+GetTextLowerDistance();
+ aSiz.Width()-=nHDist;
+ aSiz.Height()-=nVDist;
+ if ( aSiz.Width() < 2 )
+ aSiz.Width() = 2; // Mindestgroesse 2
+ if ( aSiz.Height() < 2 )
+ aSiz.Height() = 2; // Mindestgroesse 2
+
+ if(pEdtOutl)
+ {
+ pEdtOutl->SetMaxAutoPaperSize( aSiz );
+ if (bWdtGrow)
+ {
+ Size aSiz2(pEdtOutl->CalcTextSize());
+ nWdt=aSiz2.Width()+1; // lieber etwas Tolleranz
+ if (bHgtGrow) nHgt=aSiz2.Height()+1; // lieber etwas Tolleranz
+ } else
+ {
+ nHgt=pEdtOutl->GetTextHeight()+1; // lieber etwas Tolleranz
+ }
+ }
+ else
+ {
+ Outliner& rOutliner=ImpGetDrawOutliner();
+ rOutliner.SetPaperSize(aSiz);
+ rOutliner.SetUpdateMode(sal_True);
+ // !!! hier sollte ich wohl auch noch mal die Optimierung mit
+ // bPortionInfoChecked usw einbauen
+ OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
+ if( pOutlinerParaObject != NULL )
+ {
+ rOutliner.SetText(*pOutlinerParaObject);
+ rOutliner.SetFixedCellHeight(((const SdrTextFixedCellHeightItem&)GetMergedItem(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue());
+ }
+ if ( bWdtGrow )
+ {
+ Size aSiz2(rOutliner.CalcTextSize());
+ nWdt=aSiz2.Width()+1; // lieber etwas Tolleranz
+ if ( bHgtGrow )
+ nHgt=aSiz2.Height()+1; // lieber etwas Tolleranz
+ }
+ else
+ nHgt = rOutliner.GetTextHeight()+1; // lieber etwas Tolleranz
+ rOutliner.Clear();
+ }
+ if ( nWdt < nMinWdt )
+ nWdt = nMinWdt;
+ if ( nWdt > nMaxWdt )
+ nWdt = nMaxWdt;
+ nWdt += nHDist;
+ if ( nWdt < 1 )
+ nWdt = 1; // nHDist kann auch negativ sein
+ if ( nHgt < nMinHgt )
+ nHgt = nMinHgt;
+ if ( nHgt > nMaxHgt )
+ nHgt = nMaxHgt;
+ nHgt+=nVDist;
+ if ( nHgt < 1 )
+ nHgt = 1; // nVDist kann auch negativ sein
+ long nWdtGrow = nWdt-(rR.Right()-rR.Left());
+ long nHgtGrow = nHgt-(rR.Bottom()-rR.Top());
+ if ( nWdtGrow == 0 )
+ bWdtGrow = sal_False;
+ if ( nHgtGrow == 0 )
+ bHgtGrow=sal_False;
+ if ( bWdtGrow || bHgtGrow )
+ {
+ if ( bWdtGrow )
+ {
+ SdrTextHorzAdjust eHAdj=GetTextHorizontalAdjust();
+ if ( eHAdj == SDRTEXTHORZADJUST_LEFT )
+ rR.Right()+=nWdtGrow;
+ else if ( eHAdj == SDRTEXTHORZADJUST_RIGHT )
+ rR.Left()-=nWdtGrow;
+ else
+ {
+ long nWdtGrow2=nWdtGrow/2;
+ rR.Left()-=nWdtGrow2;
+ rR.Right()=rR.Left()+nWdt;
+ }
+ }
+ if ( bHgtGrow )
+ {
+ SdrTextVertAdjust eVAdj=GetTextVerticalAdjust();
+ if ( eVAdj == SDRTEXTVERTADJUST_TOP )
+ rR.Bottom()+=nHgtGrow;
+ else if ( eVAdj == SDRTEXTVERTADJUST_BOTTOM )
+ rR.Top()-=nHgtGrow;
+ else
+ {
+ long nHgtGrow2=nHgtGrow/2;
+ rR.Top()-=nHgtGrow2;
+ rR.Bottom()=rR.Top()+nHgt;
+ }
+ }
+ if ( aGeo.nDrehWink )
+ {
+ Point aD1(rR.TopLeft());
+ aD1-=aR0.TopLeft();
+ Point aD2(aD1);
+ RotatePoint(aD2,Point(),aGeo.nSin,aGeo.nCos);
+ aD2-=aD1;
+ rR.Move(aD2.X(),aD2.Y());
+ }
+ return sal_True;
+ }
+ }
+ }
+ return sal_False;
+}
+
+Rectangle SdrObjCustomShape::ImpCalculateTextFrame( const FASTBOOL bHgt, const FASTBOOL bWdt )
+{
+ Rectangle aReturnValue;
+
+ Rectangle aOldTextRect( aRect ); // <- initial text rectangle
+
+ Rectangle aNewTextRect( aRect ); // <- new text rectangle returned from the custom shape renderer,
+ GetTextBounds( aNewTextRect ); // it depends to the current logical shape size
+
+ Rectangle aAdjustedTextRect( aNewTextRect ); // <- new text rectangle is being tested by AdjustTextFrameWidthAndHeight to ensure
+ if ( AdjustTextFrameWidthAndHeight( aAdjustedTextRect, bHgt, bWdt ) ) // that the new text rectangle is matching the current text size from the outliner
+ {
+ if ( ( aAdjustedTextRect != aNewTextRect ) && ( aOldTextRect != aAdjustedTextRect ) )
+ {
+ aReturnValue = aRect;
+ double fXScale = (double)aOldTextRect.GetWidth() / (double)aNewTextRect.GetWidth();
+ double fYScale = (double)aOldTextRect.GetHeight() / (double)aNewTextRect.GetHeight();
+ double fRightDiff = (double)( aAdjustedTextRect.Right() - aNewTextRect.Right() ) * fXScale;
+ double fLeftDiff = (double)( aAdjustedTextRect.Left() - aNewTextRect.Left() ) * fXScale;
+ double fTopDiff = (double)( aAdjustedTextRect.Top() - aNewTextRect.Top() ) * fYScale;
+ double fBottomDiff= (double)( aAdjustedTextRect.Bottom()- aNewTextRect.Bottom()) * fYScale;
+ aReturnValue.Left() += (sal_Int32)fLeftDiff;
+ aReturnValue.Right() += (sal_Int32)fRightDiff;
+ aReturnValue.Top() += (sal_Int32)fTopDiff;
+ aReturnValue.Bottom() += (sal_Int32)fBottomDiff;
+ }
+ }
+ return aReturnValue;
+}
+
+FASTBOOL SdrObjCustomShape::NbcAdjustTextFrameWidthAndHeight(FASTBOOL bHgt, FASTBOOL bWdt)
+{
+ Rectangle aNewTextRect = ImpCalculateTextFrame( bHgt, bWdt );
+ sal_Bool bRet = !aNewTextRect.IsEmpty() && ( aNewTextRect != aRect );
+ if ( bRet )
+ {
+ // taking care of handles that should not been changed
+ std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles( this ) );
+
+ aRect = aNewTextRect;
+ SetRectsDirty();
+ SetChanged();
+
+ std::vector< SdrCustomShapeInteraction >::iterator aIter( aInteractionHandles.begin() );
+ while ( aIter != aInteractionHandles.end() )
+ {
+ try
+ {
+ if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_FIXED )
+ aIter->xInteraction->setControllerPosition( aIter->aPosition );
+ }
+ catch ( const uno::RuntimeException& )
+ {
+ }
+ aIter++;
+ }
+ InvalidateRenderGeometry();
+ }
+ return bRet;
+}
+FASTBOOL SdrObjCustomShape::AdjustTextFrameWidthAndHeight(FASTBOOL bHgt, FASTBOOL bWdt)
+{
+ Rectangle aNewTextRect = ImpCalculateTextFrame( bHgt, bWdt );
+ sal_Bool bRet = !aNewTextRect.IsEmpty() && ( aNewTextRect != aRect );
+ if ( bRet )
+ {
+ Rectangle aBoundRect0;
+ if ( pUserCall )
+ aBoundRect0 = GetCurrentBoundRect();
+
+ // taking care of handles that should not been changed
+ std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles( this ) );
+
+// SendRepaintBroadcast();
+ aRect = aNewTextRect;
+ SetRectsDirty();
+
+ std::vector< SdrCustomShapeInteraction >::iterator aIter( aInteractionHandles.begin() );
+ while ( aIter != aInteractionHandles.end() )
+ {
+ try
+ {
+ if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_FIXED )
+ aIter->xInteraction->setControllerPosition( aIter->aPosition );
+ }
+ catch ( const uno::RuntimeException& )
+ {
+ }
+ aIter++;
+ }
+
+ InvalidateRenderGeometry();
+ SetChanged();
+// SendRepaintBroadcast();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+ }
+ return bRet;
+}
+sal_Bool SdrObjCustomShape::BegTextEdit( SdrOutliner& rOutl )
+{
+ return SdrTextObj::BegTextEdit( rOutl );
+}
+void SdrObjCustomShape::TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle* pViewInit, Rectangle* pViewMin) const
+{
+ Size aPaperMin,aPaperMax;
+ Rectangle aViewInit;
+ TakeTextAnchorRect( aViewInit );
+ if ( aGeo.nDrehWink )
+ {
+ Point aCenter(aViewInit.Center());
+ aCenter-=aViewInit.TopLeft();
+ Point aCenter0(aCenter);
+ RotatePoint(aCenter,Point(),aGeo.nSin,aGeo.nCos);
+ aCenter-=aCenter0;
+ aViewInit.Move(aCenter.X(),aCenter.Y());
+ }
+ Size aAnkSiz(aViewInit.GetSize());
+ aAnkSiz.Width()--; aAnkSiz.Height()--; // weil GetSize() ein draufaddiert
+ Size aMaxSiz(1000000,1000000);
+ if (pModel!=NULL) {
+ Size aTmpSiz(pModel->GetMaxObjSize());
+ if (aTmpSiz.Width()!=0) aMaxSiz.Width()=aTmpSiz.Width();
+ if (aTmpSiz.Height()!=0) aMaxSiz.Height()=aTmpSiz.Height();
+ }
+ SdrTextHorzAdjust eHAdj(GetTextHorizontalAdjust());
+ SdrTextVertAdjust eVAdj(GetTextVerticalAdjust());
+
+ long nMinWdt = GetMinTextFrameWidth();
+ long nMinHgt = GetMinTextFrameHeight();
+ long nMaxWdt = GetMaxTextFrameWidth();
+ long nMaxHgt = GetMaxTextFrameHeight();
+ if (nMinWdt<1) nMinWdt=1;
+ if (nMinHgt<1) nMinHgt=1;
+ if ( nMaxWdt == 0 || nMaxWdt > aMaxSiz.Width() )
+ nMaxWdt = aMaxSiz.Width();
+ if ( nMaxHgt == 0 || nMaxHgt > aMaxSiz.Height() )
+ nMaxHgt=aMaxSiz.Height();
+
+ if (((SdrTextWordWrapItem&)(GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue())
+ {
+ if ( IsVerticalWriting() )
+ {
+ nMaxHgt = aAnkSiz.Height();
+ nMinHgt = nMaxHgt;
+ }
+ else
+ {
+ nMaxWdt = aAnkSiz.Width();
+ nMinWdt = nMaxWdt;
+ }
+ }
+ aPaperMax.Width()=nMaxWdt;
+ aPaperMax.Height()=nMaxHgt;
+
+ aPaperMin.Width()=nMinWdt;
+ aPaperMin.Height()=nMinHgt;
+
+ if ( pViewMin )
+ {
+ *pViewMin = aViewInit;
+
+ long nXFree = aAnkSiz.Width() - aPaperMin.Width();
+ if ( eHAdj == SDRTEXTHORZADJUST_LEFT )
+ pViewMin->Right() -= nXFree;
+ else if ( eHAdj == SDRTEXTHORZADJUST_RIGHT )
+ pViewMin->Left() += nXFree;
+ else { pViewMin->Left() += nXFree / 2; pViewMin->Right() = pViewMin->Left() + aPaperMin.Width(); }
+
+ long nYFree = aAnkSiz.Height() - aPaperMin.Height();
+ if ( eVAdj == SDRTEXTVERTADJUST_TOP )
+ pViewMin->Bottom() -= nYFree;
+ else if ( eVAdj == SDRTEXTVERTADJUST_BOTTOM )
+ pViewMin->Top() += nYFree;
+ else { pViewMin->Top() += nYFree / 2; pViewMin->Bottom() = pViewMin->Top() + aPaperMin.Height(); }
+ }
+
+ if( IsVerticalWriting() )
+ aPaperMin.Width() = 0;
+ else
+ aPaperMin.Height() = 0; // #33102#
+
+ if( eHAdj != SDRTEXTHORZADJUST_BLOCK )
+ aPaperMin.Width()=0;
+
+ // #103516# For complete ver adjust support, set paper min height to 0, here.
+ if(SDRTEXTVERTADJUST_BLOCK != eVAdj )
+ aPaperMin.Height() = 0;
+
+ if (pPaperMin!=NULL) *pPaperMin=aPaperMin;
+ if (pPaperMax!=NULL) *pPaperMax=aPaperMax;
+ if (pViewInit!=NULL) *pViewInit=aViewInit;
+}
+void SdrObjCustomShape::EndTextEdit( SdrOutliner& rOutl )
+{
+ SdrTextObj::EndTextEdit( rOutl );
+ InvalidateRenderGeometry();
+}
+void SdrObjCustomShape::TakeTextAnchorRect( Rectangle& rAnchorRect ) const
+{
+ if ( GetTextBounds( rAnchorRect ) )
+ {
+ Point aRotateRef( maSnapRect.Center() );
+ rAnchorRect.Left() += GetTextLeftDistance();
+ rAnchorRect.Top() += GetTextUpperDistance();
+ rAnchorRect.Right() -= GetTextRightDistance();
+ rAnchorRect.Bottom() -= GetTextLowerDistance();
+ ImpJustifyRect( rAnchorRect );
+
+ if ( rAnchorRect.GetWidth() < 2 )
+ rAnchorRect.Right() = rAnchorRect.Left() + 1; // minimal width is 2
+ if ( rAnchorRect.GetHeight() < 2 )
+ rAnchorRect.Bottom() = rAnchorRect.Top() + 1; // minimal height is 2
+ if ( aGeo.nDrehWink )
+ {
+ Point aP( rAnchorRect.TopLeft() );
+ RotatePoint( aP, aRotateRef, aGeo.nSin, aGeo. nCos );
+ rAnchorRect.SetPos( aP );
+ }
+ }
+ else
+ SdrTextObj::TakeTextAnchorRect( rAnchorRect );
+}
+void SdrObjCustomShape::TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, FASTBOOL bNoEditText,
+ Rectangle* pAnchorRect, sal_Bool /*bLineWidth*/) const
+{
+ Rectangle aAnkRect; // Rect innerhalb dem geankert wird
+ TakeTextAnchorRect(aAnkRect);
+ SdrTextVertAdjust eVAdj=GetTextVerticalAdjust();
+ SdrTextHorzAdjust eHAdj=GetTextHorizontalAdjust();
+ sal_uIntPtr nStat0=rOutliner.GetControlWord();
+ Size aNullSize;
+
+ rOutliner.SetControlWord(nStat0|EE_CNTRL_AUTOPAGESIZE);
+ rOutliner.SetMinAutoPaperSize(aNullSize);
+ sal_Int32 nMaxAutoPaperWidth = 1000000;
+ sal_Int32 nMaxAutoPaperHeight= 1000000;
+
+ long nAnkWdt=aAnkRect.GetWidth();
+ long nAnkHgt=aAnkRect.GetHeight();
+
+ if (((SdrTextWordWrapItem&)(GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue())
+ {
+ if ( IsVerticalWriting() )
+ nMaxAutoPaperHeight = nAnkHgt;
+ else
+ nMaxAutoPaperWidth = nAnkWdt;
+ }
+ if(SDRTEXTHORZADJUST_BLOCK == eHAdj && !IsVerticalWriting())
+ {
+ rOutliner.SetMinAutoPaperSize(Size(nAnkWdt, 0));
+ }
+
+ if(SDRTEXTVERTADJUST_BLOCK == eVAdj && IsVerticalWriting())
+ {
+ rOutliner.SetMinAutoPaperSize(Size(0, nAnkHgt));
+ }
+ rOutliner.SetMaxAutoPaperSize( Size( nMaxAutoPaperWidth, nMaxAutoPaperHeight ) );
+ rOutliner.SetPaperSize( aNullSize );
+
+ // Text in den Outliner stecken - ggf. den aus dem EditOutliner
+ OutlinerParaObject* pPara= GetOutlinerParaObject();
+ if (pEdtOutl && !bNoEditText)
+ pPara=pEdtOutl->CreateParaObject();
+
+ if (pPara)
+ {
+ sal_Bool bHitTest = sal_False;
+ if( pModel )
+ bHitTest = &pModel->GetHitTestOutliner() == &rOutliner;
+
+ const SdrTextObj* pTestObj = rOutliner.GetTextObj();
+ if( !pTestObj || !bHitTest || pTestObj != this ||
+ pTestObj->GetOutlinerParaObject() != GetOutlinerParaObject() )
+ {
+ if( bHitTest )
+ rOutliner.SetTextObj( this );
+
+ rOutliner.SetUpdateMode(sal_True);
+ rOutliner.SetText(*pPara);
+ }
+ }
+ else
+ {
+ rOutliner.SetTextObj( NULL );
+ }
+ if (pEdtOutl && !bNoEditText && pPara)
+ delete pPara;
+
+ rOutliner.SetUpdateMode(sal_True);
+ rOutliner.SetControlWord(nStat0);
+
+ SdrText* pText = getActiveText();
+ if( pText )
+ pText->CheckPortionInfo( rOutliner );
+
+ Point aTextPos(aAnkRect.TopLeft());
+ Size aTextSiz(rOutliner.GetPaperSize()); // GetPaperSize() hat etwas Toleranz drauf, oder?
+
+ // #106653#
+ // For draw objects containing text correct hor/ver alignment if text is bigger
+ // than the object itself. Without that correction, the text would always be
+ // formatted to the left edge (or top edge when vertical) of the draw object.
+
+ if( !IsTextFrame() )
+ {
+ if(aAnkRect.GetWidth() < aTextSiz.Width() && !IsVerticalWriting())
+ {
+ // #110129#
+ // Horizontal case here. Correct only if eHAdj == SDRTEXTHORZADJUST_BLOCK,
+ // else the alignment is wanted.
+ if(SDRTEXTHORZADJUST_BLOCK == eHAdj)
+ {
+ eHAdj = SDRTEXTHORZADJUST_CENTER;
+ }
+ }
+
+ if(aAnkRect.GetHeight() < aTextSiz.Height() && IsVerticalWriting())
+ {
+ // #110129#
+ // Vertical case here. Correct only if eHAdj == SDRTEXTVERTADJUST_BLOCK,
+ // else the alignment is wanted.
+ if(SDRTEXTVERTADJUST_BLOCK == eVAdj)
+ {
+ eVAdj = SDRTEXTVERTADJUST_CENTER;
+ }
+ }
+ }
+
+ if (eHAdj==SDRTEXTHORZADJUST_CENTER || eHAdj==SDRTEXTHORZADJUST_RIGHT)
+ {
+ long nFreeWdt=aAnkRect.GetWidth()-aTextSiz.Width();
+ if (eHAdj==SDRTEXTHORZADJUST_CENTER)
+ aTextPos.X()+=nFreeWdt/2;
+ if (eHAdj==SDRTEXTHORZADJUST_RIGHT)
+ aTextPos.X()+=nFreeWdt;
+ }
+ if (eVAdj==SDRTEXTVERTADJUST_CENTER || eVAdj==SDRTEXTVERTADJUST_BOTTOM)
+ {
+ long nFreeHgt=aAnkRect.GetHeight()-aTextSiz.Height();
+ if (eVAdj==SDRTEXTVERTADJUST_CENTER)
+ aTextPos.Y()+=nFreeHgt/2;
+ if (eVAdj==SDRTEXTVERTADJUST_BOTTOM)
+ aTextPos.Y()+=nFreeHgt;
+ }
+ if (aGeo.nDrehWink!=0)
+ RotatePoint(aTextPos,aAnkRect.TopLeft(),aGeo.nSin,aGeo.nCos);
+
+ if (pAnchorRect)
+ *pAnchorRect=aAnkRect;
+
+ // rTextRect ist bei ContourFrame in einigen Faellen nicht korrekt
+ rTextRect=Rectangle(aTextPos,aTextSiz);
+}
+
+void SdrObjCustomShape::NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject)
+{
+ SdrTextObj::NbcSetOutlinerParaObject( pTextObject );
+ SetBoundRectDirty();
+ SetRectsDirty(sal_True);
+ InvalidateRenderGeometry();
+}
+
+void SdrObjCustomShape::operator=(const SdrObject& rObj)
+{
+ SdrTextObj::operator=( rObj );
+ aName =((SdrObjCustomShape&)rObj).aName;
+ fObjectRotation = ((SdrObjCustomShape&)rObj).fObjectRotation;
+ InvalidateRenderGeometry();
+}
+
+
+void SdrObjCustomShape::TakeObjNameSingul(XubString& rName) const
+{
+ rName = ImpGetResStr(STR_ObjNameSingulCUSTOMSHAPE);
+ String aNm( GetName() );
+ if( aNm.Len() )
+ {
+ rName += sal_Unicode(' ');
+ rName += sal_Unicode('\'');
+ rName += aNm;
+ rName += sal_Unicode('\'');
+ }
+}
+
+void SdrObjCustomShape::TakeObjNamePlural(XubString& rName) const
+{
+ rName=ImpGetResStr(STR_ObjNamePluralCUSTOMSHAPE);
+}
+
+basegfx::B2DPolyPolygon SdrObjCustomShape::TakeXorPoly() const
+{
+ return GetLineGeometry( (SdrObjCustomShape*)this, sal_False );
+}
+
+basegfx::B2DPolyPolygon SdrObjCustomShape::TakeContour() const
+{
+ const SdrObject* pSdrObject = GetSdrObjectFromCustomShape();
+ if ( pSdrObject )
+ return pSdrObject->TakeContour();
+ return basegfx::B2DPolyPolygon();
+}
+
+SdrObject* SdrObjCustomShape::DoConvertToPolyObj(sal_Bool bBezier) const
+{
+ // #i37011#
+ SdrObject* pRetval = 0L;
+ SdrObject* pRenderedCustomShape = 0L;
+
+ if ( !mXRenderedCustomShape.is() )
+ {
+ // force CustomShape
+ ((SdrObjCustomShape*)this)->GetSdrObjectFromCustomShape();
+ }
+
+ if ( mXRenderedCustomShape.is() )
+ {
+ pRenderedCustomShape = GetSdrObjectFromXShape( mXRenderedCustomShape );
+ }
+
+ if ( pRenderedCustomShape )
+ {
+ SdrObject* pCandidate = pRenderedCustomShape->Clone();
+ DBG_ASSERT(pCandidate, "SdrObjCustomShape::DoConvertToPolyObj: Could not clone SdrObject (!)");
+ pCandidate->SetModel(GetModel());
+ pRetval = pCandidate->DoConvertToPolyObj(bBezier);
+ SdrObject::Free( pCandidate );
+
+ if(pRetval)
+ {
+ const sal_Bool bShadow(((SdrShadowItem&)GetMergedItem(SDRATTR_SHADOW)).GetValue());
+ if(bShadow)
+ {
+ pRetval->SetMergedItem(SdrShadowItem(sal_True));
+ }
+ }
+
+ if(HasText() && !IsTextPath())
+ {
+ pRetval = ImpConvertAddText(pRetval, bBezier);
+ }
+ }
+
+ return pRetval;
+}
+
+void SdrObjCustomShape::NbcSetStyleSheet( SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr )
+{
+ // #i40944#
+ InvalidateRenderGeometry();
+ SdrObject::NbcSetStyleSheet( pNewStyleSheet, bDontRemoveHardAttr );
+}
+
+void SdrObjCustomShape::SetPage( SdrPage* pNewPage )
+{
+ SdrTextObj::SetPage( pNewPage );
+
+ if( pNewPage )
+ {
+ // invalidating rectangles by SetRectsDirty is not sufficient,
+ // AdjustTextFrameWidthAndHeight() also has to be made, both
+ // actions are done by NbcSetSnapRect
+ Rectangle aTmp( aRect ); //creating temporary rectangle #i61108#
+ NbcSetSnapRect( aTmp );
+ }
+}
+
+SdrObjGeoData* SdrObjCustomShape::NewGeoData() const
+{
+ return new SdrAShapeObjGeoData;
+}
+
+void SdrObjCustomShape::SaveGeoData(SdrObjGeoData& rGeo) const
+{
+ SdrTextObj::SaveGeoData( rGeo );
+ SdrAShapeObjGeoData& rAGeo=(SdrAShapeObjGeoData&)rGeo;
+ rAGeo.fObjectRotation = fObjectRotation;
+ rAGeo.bMirroredX = IsMirroredX();
+ rAGeo.bMirroredY = IsMirroredY();
+
+ const rtl::OUString sAdjustmentValues( RTL_CONSTASCII_USTRINGPARAM ( "AdjustmentValues" ) );
+ Any* pAny( ( (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ).GetPropertyValueByName( sAdjustmentValues ) );
+ if ( pAny )
+ *pAny >>= rAGeo.aAdjustmentSeq;
+}
+
+void SdrObjCustomShape::RestGeoData(const SdrObjGeoData& rGeo)
+{
+ SdrTextObj::RestGeoData( rGeo );
+ SdrAShapeObjGeoData& rAGeo=(SdrAShapeObjGeoData&)rGeo;
+ fObjectRotation = rAGeo.fObjectRotation;
+ SetMirroredX( rAGeo.bMirroredX );
+ SetMirroredY( rAGeo.bMirroredY );
+
+ SdrCustomShapeGeometryItem rGeometryItem = (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
+ const rtl::OUString sAdjustmentValues( RTL_CONSTASCII_USTRINGPARAM ( "AdjustmentValues" ) );
+ PropertyValue aPropVal;
+ aPropVal.Name = sAdjustmentValues;
+ aPropVal.Value <<= rAGeo.aAdjustmentSeq;
+ rGeometryItem.SetPropertyValue( aPropVal );
+ SetMergedItem( rGeometryItem );
+
+ InvalidateRenderGeometry();
+}
+
+void SdrObjCustomShape::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& /*rPolyPolygon*/)
+{
+ // break up matrix
+ basegfx::B2DTuple aScale;
+ basegfx::B2DTuple aTranslate;
+ double fRotate, fShearX;
+ rMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
+
+ // #i75086# Old DrawingLayer (GeoStat and geometry) does not support holding negative scalings
+ // in X and Y which equal a 180 degree rotation. Recognize it and react accordingly
+ if(basegfx::fTools::less(aScale.getX(), 0.0) && basegfx::fTools::less(aScale.getY(), 0.0))
+ {
+ aScale.setX(fabs(aScale.getX()));
+ aScale.setY(fabs(aScale.getY()));
+ fRotate = fmod(fRotate + F_PI, F_2PI);
+ }
+
+ // reset object shear and rotations
+ aGeo.nDrehWink = 0;
+ aGeo.RecalcSinCos();
+ aGeo.nShearWink = 0;
+ aGeo.RecalcTan();
+
+ // force metric to pool metric
+ SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
+ if(eMapUnit != SFX_MAPUNIT_100TH_MM)
+ {
+ switch(eMapUnit)
+ {
+ case SFX_MAPUNIT_TWIP :
+ {
+ // position
+ aTranslate.setX(ImplMMToTwips(aTranslate.getX()));
+ aTranslate.setY(ImplMMToTwips(aTranslate.getY()));
+
+ // size
+ aScale.setX(ImplMMToTwips(aScale.getX()));
+ aScale.setY(ImplMMToTwips(aScale.getY()));
+
+ break;
+ }
+ default:
+ {
+ DBG_ERROR("TRSetBaseGeometry: Missing unit translation to PoolMetric!");
+ }
+ }
+ }
+
+ // if anchor is used, make position relative to it
+ if( pModel && pModel->IsWriter() )
+ {
+ if(GetAnchorPos().X() || GetAnchorPos().Y())
+ {
+ aTranslate += basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
+ }
+ }
+
+ // build and set BaseRect (use scale)
+ Point aPoint = Point();
+ Size aSize(FRound(aScale.getX()), FRound(aScale.getY()));
+ Rectangle aBaseRect(aPoint, aSize);
+ 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, sal_False);
+ }
+
+ // rotation?
+ if(!basegfx::fTools::equalZero(fRotate))
+ {
+ GeoStat aGeoStat;
+
+ // #i78696#
+ // fRotate is mathematically correct, but aGeoStat.nDrehWink is
+ // mirrored -> mirror value here
+ aGeoStat.nDrehWink = NormAngle360(FRound(-fRotate / F_PI18000));
+ aGeoStat.RecalcSinCos();
+ Rotate(Point(), aGeoStat.nDrehWink, aGeoStat.nSin, aGeoStat.nCos);
+ }
+
+ // translate?
+ if(!aTranslate.equalZero())
+ {
+ Move(Size(FRound(aTranslate.getX()), FRound(aTranslate.getY())));
+ }
+}
+
+// taking fObjectRotation instead of aGeo.nWink
+sal_Bool SdrObjCustomShape::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& /*rPolyPolygon*/) const
+{
+ // get turn and shear
+// double fRotate = (aGeo.nDrehWink / 100.0) * F_PI180;
+ double fRotate = fObjectRotation * F_PI180;
+ double fShearX = (aGeo.nShearWink / 100.0) * F_PI180;
+
+ // get aRect, this is the unrotated snaprect
+ Rectangle aRectangle(aRect);
+
+ sal_Bool bMirroredX = IsMirroredX();
+ sal_Bool bMirroredY = IsMirroredY();
+ if ( bMirroredX || bMirroredY )
+ { // we have to retrieve the unmirrored rect
+
+ GeoStat aNewGeo( aGeo );
+
+ if ( bMirroredX )
+ {
+ Polygon aPol( Rect2Poly( aRect, aNewGeo ) );
+ Rectangle aBoundRect( aPol.GetBoundRect() );
+
+ Point aRef1( ( aBoundRect.Left() + aBoundRect.Right() ) >> 1, aBoundRect.Top() );
+ Point aRef2( aRef1.X(), aRef1.Y() + 1000 );
+ sal_uInt16 i;
+ sal_uInt16 nPntAnz=aPol.GetSize();
+ for (i=0; i<nPntAnz; i++)
+ {
+ MirrorPoint(aPol[i],aRef1,aRef2);
+ }
+ // Polygon wenden und etwas schieben
+ Polygon aPol0(aPol);
+ aPol[0]=aPol0[1];
+ aPol[1]=aPol0[0];
+ aPol[2]=aPol0[3];
+ aPol[3]=aPol0[2];
+ aPol[4]=aPol0[1];
+ Poly2Rect(aPol,aRectangle,aNewGeo);
+ }
+ if ( bMirroredY )
+ {
+ Polygon aPol( Rect2Poly( aRectangle, aNewGeo ) );
+ Rectangle aBoundRect( aPol.GetBoundRect() );
+
+ Point aRef1( aBoundRect.Left(), ( aBoundRect.Top() + aBoundRect.Bottom() ) >> 1 );
+ Point aRef2( aRef1.X() + 1000, aRef1.Y() );
+ sal_uInt16 i;
+ sal_uInt16 nPntAnz=aPol.GetSize();
+ for (i=0; i<nPntAnz; i++)
+ {
+ MirrorPoint(aPol[i],aRef1,aRef2);
+ }
+ // Polygon wenden und etwas schieben
+ Polygon aPol0(aPol);
+ aPol[0]=aPol0[1];
+ aPol[1]=aPol0[0];
+ aPol[2]=aPol0[3];
+ aPol[3]=aPol0[2];
+ aPol[4]=aPol0[1];
+ Poly2Rect(aPol,aRectangle,aNewGeo);
+ }
+ }
+
+ // fill other values
+ basegfx::B2DTuple aScale(aRectangle.GetWidth(), aRectangle.GetHeight());
+ basegfx::B2DTuple aTranslate(aRectangle.Left(), aRectangle.Top());
+
+ // position maybe relative to anchorpos, convert
+ if( pModel && pModel->IsWriter() )
+ {
+ if(GetAnchorPos().X() || GetAnchorPos().Y())
+ {
+ aTranslate -= basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
+ }
+ }
+
+ // force MapUnit to 100th mm
+ SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
+ if(eMapUnit != SFX_MAPUNIT_100TH_MM)
+ {
+ switch(eMapUnit)
+ {
+ case SFX_MAPUNIT_TWIP :
+ {
+ // postion
+ aTranslate.setX(ImplTwipsToMM(aTranslate.getX()));
+ aTranslate.setY(ImplTwipsToMM(aTranslate.getY()));
+
+ // size
+ aScale.setX(ImplTwipsToMM(aScale.getX()));
+ aScale.setY(ImplTwipsToMM(aScale.getY()));
+
+ break;
+ }
+ default:
+ {
+ DBG_ERROR("TRGetBaseGeometry: Missing unit translation to 100th mm!");
+ }
+ }
+ }
+
+ // build matrix
+ rMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ aScale,
+ basegfx::fTools::equalZero(fShearX) ? 0.0 : tan(fShearX),
+ basegfx::fTools::equalZero(fRotate) ? 0.0 : -fRotate,
+ aTranslate);
+
+ return sal_False;
+}
+
+sdr::contact::ViewContact* SdrObjCustomShape::CreateObjectSpecificViewContact()
+{
+ return new sdr::contact::ViewContactOfSdrObjCustomShape(*this);
+}
+
+// #i33136#
+bool SdrObjCustomShape::doConstructOrthogonal(const ::rtl::OUString& rName)
+{
+ bool bRetval(false);
+ static ::rtl::OUString Imps_sNameASOrtho_quadrat( RTL_CONSTASCII_USTRINGPARAM( "quadrat" ) );
+ static ::rtl::OUString Imps_sNameASOrtho_round_quadrat( RTL_CONSTASCII_USTRINGPARAM( "round-quadrat" ) );
+ static ::rtl::OUString Imps_sNameASOrtho_circle( RTL_CONSTASCII_USTRINGPARAM( "circle" ) );
+ static ::rtl::OUString Imps_sNameASOrtho_circle_pie( RTL_CONSTASCII_USTRINGPARAM( "circle-pie" ) );
+ static ::rtl::OUString Imps_sNameASOrtho_ring( RTL_CONSTASCII_USTRINGPARAM( "ring" ) );
+
+ if(Imps_sNameASOrtho_quadrat.equalsIgnoreAsciiCase(rName))
+ {
+ bRetval = true;
+ }
+ else if(Imps_sNameASOrtho_round_quadrat.equalsIgnoreAsciiCase(rName))
+ {
+ bRetval = true;
+ }
+ else if(Imps_sNameASOrtho_circle.equalsIgnoreAsciiCase(rName))
+ {
+ bRetval = true;
+ }
+ else if(Imps_sNameASOrtho_circle_pie.equalsIgnoreAsciiCase(rName))
+ {
+ bRetval = true;
+ }
+ else if(Imps_sNameASOrtho_ring.equalsIgnoreAsciiCase(rName))
+ {
+ bRetval = true;
+ }
+
+ return bRetval;
+}
+
+// #i37011# centralize throw-away of render geometry
+void SdrObjCustomShape::InvalidateRenderGeometry()
+{
+ mXRenderedCustomShape = 0L;
+ SdrObject::Free( mpLastShadowGeometry );
+ mpLastShadowGeometry = 0L;
+}
+
+// eof
diff --git a/svx/source/svdraw/svdoattr.cxx b/svx/source/svdraw/svdoattr.cxx
new file mode 100644
index 000000000000..27c31647e881
--- /dev/null
+++ b/svx/source/svdraw/svdoattr.cxx
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svdoattr.hxx>
+#include <svx/xpool.hxx>
+#include "svx/svditext.hxx"
+#include <svx/svdmodel.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdattr.hxx>
+#include <svx/svdattrx.hxx>
+#include <svx/svdpool.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/svdocapt.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/svdorect.hxx>
+#include <svx/svdocirc.hxx>
+#include <svx/svdomeas.hxx>
+#include <svl/smplhint.hxx>
+#include <svl/itemiter.hxx>
+#include <svx/xenum.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/xlnstwit.hxx>
+#include <svx/xlnedwit.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xflbmtit.hxx>
+#include <svx/xtextit0.hxx>
+#include <svx/xflbstit.hxx>
+#include <svx/xflbtoxy.hxx>
+#include <svx/xftshit.hxx>
+
+
+#include <editeng/colritem.hxx>
+#include "editeng/fontitem.hxx"
+#include <editeng/fhgtitem.hxx>
+
+//#include <editeng/charscaleitem.hxx>
+#include <svx/xlnstcit.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svl/style.hxx>
+#include <svl/style.hxx>
+#include <svl/whiter.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xlntrit.hxx>
+#include <svx/xfltrit.hxx>
+#include <svx/xlnedcit.hxx>
+#include <editeng/adjitem.hxx>
+#include <svx/xflbckit.hxx>
+#include <svx/xtable.hxx>
+#include <svx/xbtmpit.hxx>
+#include <svx/xlndsit.hxx>
+#include <svx/xlnedit.hxx>
+#include <svx/xflgrit.hxx>
+#include <svx/xflftrit.hxx>
+#include <svx/xflhtit.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/sdr/properties/attributeproperties.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include "svx/xlinjoit.hxx"
+#include <svdoimp.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+sdr::properties::BaseProperties* SdrAttrObj::CreateObjectSpecificProperties()
+{
+ return new sdr::properties::AttributeProperties(*this);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(SdrAttrObj,SdrObject);
+
+SdrAttrObj::SdrAttrObj()
+{
+}
+
+SdrAttrObj::~SdrAttrObj()
+{
+}
+
+const Rectangle& SdrAttrObj::GetSnapRect() const
+{
+ if(bSnapRectDirty)
+ {
+ ((SdrAttrObj*)this)->RecalcSnapRect();
+ ((SdrAttrObj*)this)->bSnapRectDirty = false;
+ }
+
+ return maSnapRect;
+}
+
+void SdrAttrObj::SetModel(SdrModel* pNewModel)
+{
+ SdrModel* pOldModel = pModel;
+
+ // test for correct pool in ItemSet; move to new pool if necessary
+ if(pNewModel && GetObjectItemPool() && GetObjectItemPool() != &pNewModel->GetItemPool())
+ {
+ MigrateItemPool(GetObjectItemPool(), &pNewModel->GetItemPool(), pNewModel);
+ }
+
+ // call parent
+ SdrObject::SetModel(pNewModel);
+
+ // modify properties
+ GetProperties().SetModel(pOldModel, pNewModel);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// syntactical sugar for ItemSet accesses
+
+void __EXPORT SdrAttrObj::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint)
+{
+ SfxSimpleHint *pSimple = PTR_CAST(SfxSimpleHint, &rHint);
+ sal_Bool bDataChg(pSimple && SFX_HINT_DATACHANGED == pSimple->GetId());
+
+ if(bDataChg)
+ {
+ Rectangle aBoundRect = GetLastBoundRect();
+ SetBoundRectDirty();
+ SetRectsDirty(sal_True);
+
+ // This may have lead to object change
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_CHGATTR, aBoundRect);
+ }
+}
+
+sal_Int32 SdrAttrObj::ImpGetLineWdt() const
+{
+ sal_Int32 nRetval(0);
+
+ if(XLINE_NONE != ((XLineStyleItem&)(GetObjectItem(XATTR_LINESTYLE))).GetValue())
+ {
+ nRetval = ((XLineWidthItem&)(GetObjectItem(XATTR_LINEWIDTH))).GetValue();
+ }
+
+ return nRetval;
+}
+
+sal_Bool SdrAttrObj::HasFill() const
+{
+ return bClosedObj && ((XFillStyleItem&)(GetProperties().GetObjectItemSet().Get(XATTR_FILLSTYLE))).GetValue()!=XFILL_NONE;
+}
+
+sal_Bool SdrAttrObj::HasLine() const
+{
+ return ((XLineStyleItem&)(GetProperties().GetObjectItemSet().Get(XATTR_LINESTYLE))).GetValue()!=XLINE_NONE;
+}
+
+// eof
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
new file mode 100644
index 000000000000..81ff5005d0f6
--- /dev/null
+++ b/svx/source/svdraw/svdobj.cxx
@@ -0,0 +1,3310 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <com/sun/star/lang/XComponent.hpp>
+
+#define _USE_MATH_DEFINES
+#include <math.h>
+#include <vcl/metaact.hxx> // fuer TakeContour
+#include <vcl/cvtsvm.hxx>
+#include <tools/line.hxx>
+#include <tools/bigint.hxx>
+#include <tools/diagnose_ex.h>
+#include <vector>
+#include <svx/svdobj.hxx>
+#include <svx/xpoly.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/svdtrans.hxx>
+#include <svx/svdhdl.hxx>
+#include <svx/svddrag.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdovirt.hxx> // Fuer Add/Del Ref
+#include <svx/svdview.hxx> // fuer Dragging (Ortho abfragen)
+#include "svx/svdglob.hxx" // StringCache
+#include <svx/svdstr.hrc> // Objektname
+#include <svx/svdogrp.hxx> // Factory
+#include <svx/svdopath.hxx> // Factory
+#include <svx/svdoedge.hxx> // Factory
+#include <svx/svdorect.hxx> // Factory
+#include <svx/svdocirc.hxx> // Factory
+#include <svx/svdotext.hxx> // Factory
+#include <svx/svdomeas.hxx> // Factory
+#include <svx/svdograf.hxx> // Factory
+#include <svx/svdoole2.hxx> // Factory
+#include <svx/svdocapt.hxx> // Factory
+#include <svx/svdopage.hxx> // Factory
+#include <svx/svdouno.hxx> // Factory
+#include <svx/svdattrx.hxx> // NotPersistItems
+#include <svx/svdoashp.hxx>
+#include <svx/svdomedia.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svx/xlnstwit.hxx>
+#include <svx/xlnedwit.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/xlnedit.hxx>
+#include <svx/xlnstcit.hxx>
+#include <svx/xlnedcit.hxx>
+#include <svx/xlndsit.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/svditer.hxx>
+#include <svx/xlntrit.hxx>
+#include <svx/xfltrit.hxx>
+#include <svx/xfltrit.hxx>
+#include <svx/xflftrit.hxx>
+#include "svx/xlinjoit.hxx"
+#include <svx/unopage.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/xenum.hxx>
+#include <svx/xgrad.hxx>
+#include <svx/xhatch.hxx>
+#include <svx/xflhtit.hxx>
+#include <svx/xbtmpit.hxx>
+#include <svx/svdpool.hxx>
+#include <editeng/editeng.hxx>
+#include <vcl/salbtype.hxx> // FRound
+#include <svl/whiter.hxx>
+
+// #97849#
+#include <svx/fmmodel.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/objface.hxx>
+#include "svdoimp.hxx"
+#include <vcl/graphictools.hxx>
+#include <svtools/colorcfg.hxx>
+#include <svx/sdr/properties/emptyproperties.hxx>
+#include <svx/sdr/contact/viewcontactofsdrobj.hxx>
+#include <svx/sdr/contact/viewcontactofgraphic.hxx>
+#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <svx/unoshape.hxx>
+#include <vcl/virdev.hxx>
+#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
+#include <drawinglayer/processor2d/contourextractor2d.hxx>
+#include <drawinglayer/processor2d/linegeometryextractor2d.hxx>
+#include <svx/polysc3d.hxx>
+#include "svx/svdotable.hxx"
+#include "svx/shapepropertynotifier.hxx"
+#include <svx/sdrhittesthelper.hxx>
+#include <svx/svdundo.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <svx/sdrobjectfilter.hxx>
+
+using namespace ::com::sun::star;
+
+// #104018# replace macros above with type-detecting methods
+inline double ImplTwipsToMM(double fVal) { return (fVal * (127.0 / 72.0)); }
+inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); }
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT0(SdrObjUserCall);
+
+SdrObjUserCall::~SdrObjUserCall()
+{
+}
+
+void SdrObjUserCall::Changed(const SdrObject& /*rObj*/, SdrUserCallType /*eType*/, const Rectangle& /*rOldBoundRect*/)
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT0(SdrObjUserData);
+
+void SdrObjUserData::operator=(const SdrObjUserData& /*rData*/) // nicht implementiert
+{
+}
+
+sal_Bool SdrObjUserData::operator==(const SdrObjUserData& /*rData*/) const // nicht implementiert
+{
+ return sal_False;
+}
+
+sal_Bool SdrObjUserData::operator!=(const SdrObjUserData& /*rData*/) const // nicht implementiert
+{
+ return sal_False;
+}
+
+SdrObjUserData::~SdrObjUserData()
+{
+}
+
+FASTBOOL SdrObjUserData::HasMacro(const SdrObject* /*pObj*/) const
+{
+ return sal_False;
+}
+
+SdrObject* SdrObjUserData::CheckMacroHit(const SdrObjMacroHitRec& rRec, const SdrObject* pObj) const
+{
+ 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
+{
+ return Pointer(POINTER_REFHAND);
+}
+
+void SdrObjUserData::PaintMacro(OutputDevice& rOut, const Rectangle& /*rDirtyRect*/, const SdrObjMacroHitRec& /*rRec*/, const SdrObject* pObj) const
+{
+ if(!pObj)
+ return;
+
+ const RasterOp eRop(rOut.GetRasterOp());
+ const basegfx::B2DPolyPolygon aPolyPolygon(pObj->TakeXorPoly());
+ const sal_uInt32 nCount(aPolyPolygon.count());
+
+ rOut.SetLineColor(COL_BLACK);
+ rOut.SetFillColor();
+ rOut.SetRasterOp(ROP_INVERT);
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ rOut.DrawPolyLine(aPolyPolygon.getB2DPolygon(a));
+ }
+
+ rOut.SetRasterOp(eRop);
+}
+
+FASTBOOL SdrObjUserData::DoMacro(const SdrObjMacroHitRec& /*rRec*/, SdrObject* /*pObj*/)
+{
+ return sal_False;
+}
+
+XubString SdrObjUserData::GetMacroPopupComment(const SdrObjMacroHitRec& /*rRec*/, const SdrObject* /*pObj*/) const
+{
+ return String();
+}
+
+void SdrObjUserDataList::Clear()
+{
+ sal_uInt16 nAnz=GetUserDataCount();
+ for (sal_uInt16 i=0; i<nAnz; i++) {
+ delete GetUserData(i);
+ }
+ aList.Clear();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+DBG_NAME(SdrObjGeoData);
+
+SdrObjGeoData::SdrObjGeoData():
+ pGPL(NULL),
+ bMovProt(sal_False),
+ bSizProt(sal_False),
+ bNoPrint(sal_False),
+ bClosedObj(sal_False),
+ mbVisible(true),
+ mnLayerID(0)
+{
+ DBG_CTOR(SdrObjGeoData,NULL);
+}
+
+SdrObjGeoData::~SdrObjGeoData()
+{
+ DBG_DTOR(SdrObjGeoData,NULL);
+ delete pGPL;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT0(SdrObjPlusData);
+
+SdrObjPlusData::SdrObjPlusData():
+ pBroadcast(NULL),
+ pUserDataList(NULL),
+ pGluePoints(NULL),
+ pAutoTimer(NULL)
+{
+}
+
+SdrObjPlusData::~SdrObjPlusData()
+{
+ if (pBroadcast !=NULL) delete pBroadcast;
+ if (pUserDataList!=NULL) delete pUserDataList;
+ if (pGluePoints !=NULL) delete pGluePoints;
+ if (pAutoTimer !=NULL) delete pAutoTimer;
+}
+
+SdrObjPlusData* SdrObjPlusData::Clone(SdrObject* pObj1) const
+{
+ SdrObjPlusData* pNeuPlusData=new SdrObjPlusData;
+ if (pUserDataList!=NULL) {
+ sal_uInt16 nAnz=pUserDataList->GetUserDataCount();
+ if (nAnz!=0) {
+ pNeuPlusData->pUserDataList=new SdrObjUserDataList;
+ for (sal_uInt16 i=0; i<nAnz; i++) {
+ SdrObjUserData* pNeuUserData=pUserDataList->GetUserData(i)->Clone(pObj1);
+ if (pNeuUserData!=NULL) {
+ pNeuPlusData->pUserDataList->InsertUserData(pNeuUserData);
+ } else {
+ DBG_ERROR("SdrObjPlusData::Clone(): UserData.Clone() liefert NULL");
+ }
+ }
+ }
+ }
+ if (pGluePoints!=NULL) pNeuPlusData->pGluePoints=new SdrGluePointList(*pGluePoints);
+ // MtfAnimator wird auch nicht mitkopiert
+
+ // #i68101#
+ // copy object name, title and description
+ pNeuPlusData->aObjName = aObjName;
+ pNeuPlusData->aObjTitle = aObjTitle;
+ pNeuPlusData->aObjDescription = aObjDescription;
+
+ if (pAutoTimer!=NULL) {
+ pNeuPlusData->pAutoTimer=new AutoTimer;
+ // Handler, etc. nicht mitkopieren!
+ }
+
+ // For HTMLName: Do not clone, leave uninitialized (empty string)
+
+ return pNeuPlusData;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@ @@@@@ @@@@@@ @@@@@ @@@@ @@@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@@@@ @@ @@@@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@@@ @@@@@ @@@@ @@@@@ @@@@ @@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+// BaseProperties section
+
+sdr::properties::BaseProperties* SdrObject::CreateObjectSpecificProperties()
+{
+ return new sdr::properties::EmptyProperties(*this);
+}
+
+sdr::properties::BaseProperties& SdrObject::GetProperties() const
+{
+ if(!mpProperties)
+ {
+ const_cast< SdrObject* >(this)->mpProperties =
+ const_cast< SdrObject* >(this)->CreateObjectSpecificProperties();
+ }
+
+ return *mpProperties;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// ObjectUser section
+
+void SdrObject::AddObjectUser(sdr::ObjectUser& rNewUser)
+{
+ maObjectUsers.push_back(&rNewUser);
+}
+
+void SdrObject::RemoveObjectUser(sdr::ObjectUser& rOldUser)
+{
+ const ::sdr::ObjectUserVector::iterator aFindResult = ::std::find(maObjectUsers.begin(), maObjectUsers.end(), &rOldUser);
+ if(aFindResult != maObjectUsers.end())
+ {
+ maObjectUsers.erase(aFindResult);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// #110094# DrawContact section
+
+sdr::contact::ViewContact* SdrObject::CreateObjectSpecificViewContact()
+{
+ return new sdr::contact::ViewContactOfSdrObj(*this);
+}
+
+sdr::contact::ViewContact& SdrObject::GetViewContact() const
+{
+ if(!mpViewContact)
+ {
+ const_cast< SdrObject* >(this)->mpViewContact =
+ const_cast< SdrObject* >(this)->CreateObjectSpecificViewContact();
+ }
+
+ return *mpViewContact;
+}
+
+// DrawContact support: Methods for handling Object changes
+void SdrObject::ActionChanged() const
+{
+ // Do necessary ViewContact actions
+ GetViewContact().ActionChanged();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdrObject::SetBoundRectDirty()
+{
+ aOutRect = Rectangle();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+DBG_NAME(SdrObject);
+TYPEINIT1(SdrObject,SfxListener);
+
+SdrObject::SdrObject()
+ :mpProperties(0L)
+ ,mpViewContact(0L)
+ ,pObjList(NULL)
+ ,pPage(NULL)
+ ,pModel(NULL)
+ ,pUserCall(NULL)
+ ,pPlusData(NULL)
+ ,nOrdNum(0)
+ ,mnNavigationPosition(SAL_MAX_UINT32)
+ ,mnLayerID(0)
+ ,mpSvxShape( NULL )
+ ,maWeakUnoShape()
+{
+ DBG_CTOR(SdrObject,NULL);
+ bVirtObj =sal_False;
+ bSnapRectDirty =sal_True;
+ bNetLock =sal_False;
+ bInserted =sal_False;
+ bGrouped =sal_False;
+ bMovProt =sal_False;
+ bSizProt =sal_False;
+ bNoPrint =sal_False;
+ bEmptyPresObj =sal_False;
+ bNotVisibleAsMaster=sal_False;
+ bClosedObj =sal_False;
+ mbVisible = true;
+
+ // #i25616#
+ mbLineIsOutsideGeometry = sal_False;
+
+ // #i25616#
+ mbSupportTextIndentingOnLineWidthChange = sal_False;
+
+ //#110094#-1
+ //bWriterFlyFrame =sal_False;
+
+ bNotMasterCachable=sal_False;
+ bIsEdge=sal_False;
+ bIs3DObj=sal_False;
+ bMarkProt=sal_False;
+ bIsUnoObj=sal_False;
+}
+
+SdrObject::~SdrObject()
+{
+ // tell all the registered ObjectUsers that the page is in destruction
+ ::sdr::ObjectUserVector aListCopy(maObjectUsers.begin(), maObjectUsers.end());
+ for(::sdr::ObjectUserVector::iterator aIterator = aListCopy.begin(); aIterator != aListCopy.end(); aIterator++)
+ {
+ sdr::ObjectUser* pObjectUser = *aIterator;
+ DBG_ASSERT(pObjectUser, "SdrObject::~SdrObject: corrupt ObjectUser list (!)");
+ pObjectUser->ObjectInDestruction(*this);
+ }
+
+ // Clear the vector. This means that user do not need to call RemoveObjectUser()
+ // when they get called from ObjectInDestruction().
+ maObjectUsers.clear();
+
+ try
+ {
+ SvxShape* pSvxShape = getSvxShape();
+ if ( pSvxShape )
+ {
+ OSL_ENSURE(!pSvxShape->HasSdrObjectOwnership(),"Please check where this call come from and replace it with SdrObject::Free");
+ pSvxShape->InvalidateSdrObject();
+ uno::Reference< lang::XComponent > xShapeComp( getWeakUnoShape(), uno::UNO_QUERY_THROW );
+ xShapeComp->dispose();
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ DBG_DTOR(SdrObject,NULL);
+ SendUserCall(SDRUSERCALL_DELETE, GetLastBoundRect());
+ if (pPlusData!=NULL) delete pPlusData;
+
+ if(mpProperties)
+ {
+ delete mpProperties;
+ mpProperties = 0L;
+ }
+
+ // #110094#
+ if(mpViewContact)
+ {
+ delete mpViewContact;
+ mpViewContact = 0L;
+ }
+}
+
+void SdrObject::Free( SdrObject*& _rpObject )
+{
+ SdrObject* pObject = _rpObject; _rpObject = NULL;
+ if ( pObject == NULL )
+ // nothing to do
+ return;
+
+ SvxShape* pShape = pObject->getSvxShape();
+ if ( pShape && pShape->HasSdrObjectOwnership() )
+ // only the shape is allowed to delete me, and will reset the ownership before doing so
+ return;
+
+ delete pObject;
+}
+
+SdrObjPlusData* SdrObject::NewPlusData() const
+{
+ return new SdrObjPlusData;
+}
+
+void SdrObject::SetRectsDirty(sal_Bool bNotMyself)
+{
+ if (!bNotMyself) {
+ SetBoundRectDirty();
+ bSnapRectDirty=sal_True;
+ }
+ if (pObjList!=NULL) {
+ pObjList->SetRectsDirty();
+ }
+}
+
+void SdrObject::SetModel(SdrModel* pNewModel)
+{
+ if(pNewModel && pPage)
+ {
+ if(pPage->GetModel() != pNewModel)
+ {
+ pPage = NULL;
+ }
+ }
+
+ // update listeners at possible api wrapper object
+ if( pModel != pNewModel )
+ {
+ SvxShape* pShape = getSvxShape();
+ if( pShape )
+ pShape->ChangeModel( pNewModel );
+ }
+
+ pModel = pNewModel;
+}
+
+void SdrObject::SetObjList(SdrObjList* pNewObjList)
+{
+ pObjList=pNewObjList;
+}
+
+void SdrObject::SetPage(SdrPage* pNewPage)
+{
+ pPage=pNewPage;
+ if (pPage!=NULL) {
+ SdrModel* pMod=pPage->GetModel();
+ if (pMod!=pModel && pMod!=NULL) {
+ SetModel(pMod);
+ }}
+}
+
+// init global static itempool
+SdrItemPool* SdrObject::mpGlobalItemPool = NULL;
+
+SdrItemPool& SdrObject::GetGlobalDrawObjectItemPool()
+{
+ if(!mpGlobalItemPool)
+ {
+ mpGlobalItemPool = new SdrItemPool();
+ SfxItemPool* pGlobalOutlPool = EditEngine::CreatePool();
+ mpGlobalItemPool->SetSecondaryPool(pGlobalOutlPool);
+ mpGlobalItemPool->SetDefaultMetric((SfxMapUnit)SdrEngineDefaults::GetMapUnit());
+ mpGlobalItemPool->FreezeIdRanges();
+ }
+
+ return *mpGlobalItemPool;
+}
+
+void SdrObject::FreeGlobalDrawObjectItemPool()
+{
+ // code for deletion of GlobalItemPool
+ if(mpGlobalItemPool)
+ {
+ SfxItemPool* pGlobalOutlPool = mpGlobalItemPool->GetSecondaryPool();
+ SfxItemPool::Free(mpGlobalItemPool);
+ SfxItemPool::Free(pGlobalOutlPool);
+ }
+}
+
+SdrItemPool* SdrObject::GetObjectItemPool() const
+{
+ if(pModel)
+ return (SdrItemPool*)(&pModel->GetItemPool());
+
+ // use a static global default pool
+ return &SdrObject::GetGlobalDrawObjectItemPool();
+}
+
+sal_uInt32 SdrObject::GetObjInventor() const
+{
+ return SdrInventor;
+}
+
+sal_uInt16 SdrObject::GetObjIdentifier() const
+{
+ return sal_uInt16(OBJ_NONE);
+}
+
+void SdrObject::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
+{
+ rInfo.bRotateFreeAllowed=sal_False;
+ rInfo.bMirrorFreeAllowed=sal_False;
+ rInfo.bTransparenceAllowed = sal_False;
+ rInfo.bGradientAllowed = sal_False;
+ rInfo.bShearAllowed =sal_False;
+ rInfo.bEdgeRadiusAllowed=sal_False;
+ rInfo.bCanConvToPath =sal_False;
+ rInfo.bCanConvToPoly =sal_False;
+ rInfo.bCanConvToContour = sal_False;
+ rInfo.bCanConvToPathLineToArea=sal_False;
+ rInfo.bCanConvToPolyLineToArea=sal_False;
+}
+
+SdrLayerID SdrObject::GetLayer() const
+{
+ return mnLayerID;
+}
+
+void SdrObject::getMergedHierarchyLayerSet(SetOfByte& rSet) const
+{
+ rSet.Set(GetLayer());
+ SdrObjList* pOL=GetSubList();
+ if (pOL!=NULL) {
+ sal_uIntPtr nObjAnz=pOL->GetObjCount();
+ for (sal_uIntPtr nObjNum=0; nObjNum<nObjAnz; nObjNum++) {
+ pOL->GetObj(nObjNum)->getMergedHierarchyLayerSet(rSet);
+ }
+ }
+}
+
+void SdrObject::NbcSetLayer(SdrLayerID nLayer)
+{
+ if(GetLayer() != nLayer)
+ {
+ mnLayerID = nLayer;
+ }
+}
+
+void SdrObject::SetLayer(SdrLayerID nLayer)
+{
+ NbcSetLayer(nLayer);
+ SetChanged();
+ BroadcastObjectChange();
+}
+
+void SdrObject::AddListener(SfxListener& rListener)
+{
+ ImpForcePlusData();
+ if (pPlusData->pBroadcast==NULL) pPlusData->pBroadcast=new SfxBroadcaster;
+ rListener.StartListening(*pPlusData->pBroadcast);
+}
+
+void SdrObject::RemoveListener(SfxListener& rListener)
+{
+ if (pPlusData!=NULL && pPlusData->pBroadcast!=NULL) {
+ rListener.EndListening(*pPlusData->pBroadcast);
+ if (!pPlusData->pBroadcast->HasListeners()) {
+ delete pPlusData->pBroadcast;
+ pPlusData->pBroadcast=NULL;
+ }
+ }
+}
+
+void SdrObject::AddReference(SdrVirtObj& rVrtObj)
+{
+ AddListener(rVrtObj);
+}
+
+void SdrObject::DelReference(SdrVirtObj& rVrtObj)
+{
+ RemoveListener(rVrtObj);
+}
+
+AutoTimer* SdrObject::ForceAutoTimer()
+{
+ ImpForcePlusData();
+ if (pPlusData->pAutoTimer==NULL) pPlusData->pAutoTimer=new AutoTimer;
+ return pPlusData->pAutoTimer;
+}
+
+FASTBOOL SdrObject::HasRefPoint() const
+{
+ return sal_False;
+}
+
+Point SdrObject::GetRefPoint() const
+{
+ return GetCurrentBoundRect().Center();
+}
+
+void SdrObject::SetRefPoint(const Point& /*rPnt*/)
+{
+}
+
+SdrObjList* SdrObject::GetSubList() const
+{
+ return NULL;
+}
+
+SdrObject* SdrObject::GetUpGroup() const
+{
+ return pObjList!=NULL ? pObjList->GetOwnerObj() : NULL;
+}
+
+void SdrObject::SetName(const String& rStr)
+{
+ if(rStr.Len() && !pPlusData)
+ {
+ ImpForcePlusData();
+ }
+
+ if(pPlusData && pPlusData->aObjName != rStr)
+ {
+ // --> OD 2009-07-09 #i73249#
+ // Undo/Redo for setting object's name
+ bool bUndo( false );
+ if ( GetModel() && GetModel()->IsUndoEnabled() )
+ {
+ bUndo = true;
+ SdrUndoAction* pUndoAction =
+ GetModel()->GetSdrUndoFactory().CreateUndoObjectStrAttr(
+ *this,
+ SdrUndoObjStrAttr::OBJ_NAME,
+ GetName(),
+ rStr );
+ GetModel()->BegUndo( pUndoAction->GetComment() );
+ GetModel()->AddUndo( pUndoAction );
+ }
+ // <--
+ pPlusData->aObjName = rStr;
+ // --> OD 2009-07-09 #i73249#
+ if ( bUndo )
+ {
+ GetModel()->EndUndo();
+ }
+ // <--
+ SetChanged();
+ BroadcastObjectChange();
+ }
+}
+
+String SdrObject::GetName() const
+{
+ if(pPlusData)
+ {
+ return pPlusData->aObjName;
+ }
+
+ return String();
+}
+
+void SdrObject::SetTitle(const String& rStr)
+{
+ if(rStr.Len() && !pPlusData)
+ {
+ ImpForcePlusData();
+ }
+
+ if(pPlusData && pPlusData->aObjTitle != rStr)
+ {
+ // --> OD 2009-07-13 #i73249#
+ // Undo/Redo for setting object's title
+ bool bUndo( false );
+ if ( GetModel() && GetModel()->IsUndoEnabled() )
+ {
+ bUndo = true;
+ SdrUndoAction* pUndoAction =
+ GetModel()->GetSdrUndoFactory().CreateUndoObjectStrAttr(
+ *this,
+ SdrUndoObjStrAttr::OBJ_TITLE,
+ GetTitle(),
+ rStr );
+ GetModel()->BegUndo( pUndoAction->GetComment() );
+ GetModel()->AddUndo( pUndoAction );
+ }
+ // <--
+ pPlusData->aObjTitle = rStr;
+ // --> OD 2009-07-13 #i73249#
+ if ( bUndo )
+ {
+ GetModel()->EndUndo();
+ }
+ // <--
+ SetChanged();
+ BroadcastObjectChange();
+ }
+}
+
+String SdrObject::GetTitle() const
+{
+ if(pPlusData)
+ {
+ return pPlusData->aObjTitle;
+ }
+
+ return String();
+}
+
+void SdrObject::SetDescription(const String& rStr)
+{
+ if(rStr.Len() && !pPlusData)
+ {
+ ImpForcePlusData();
+ }
+
+ if(pPlusData && pPlusData->aObjDescription != rStr)
+ {
+ // --> OD 2009-07-13 #i73249#
+ // Undo/Redo for setting object's description
+ bool bUndo( false );
+ if ( GetModel() && GetModel()->IsUndoEnabled() )
+ {
+ bUndo = true;
+ SdrUndoAction* pUndoAction =
+ GetModel()->GetSdrUndoFactory().CreateUndoObjectStrAttr(
+ *this,
+ SdrUndoObjStrAttr::OBJ_DESCRIPTION,
+ GetDescription(),
+ rStr );
+ GetModel()->BegUndo( pUndoAction->GetComment() );
+ GetModel()->AddUndo( pUndoAction );
+ }
+ // <--
+ pPlusData->aObjDescription = rStr;
+ // --> OD 2009-07-13 #i73249#
+ if ( bUndo )
+ {
+ GetModel()->EndUndo();
+ }
+ // <--
+ SetChanged();
+ BroadcastObjectChange();
+ }
+}
+
+String SdrObject::GetDescription() const
+{
+ if(pPlusData)
+ {
+ return pPlusData->aObjDescription;
+ }
+
+ return String();
+}
+
+void SdrObject::SetHTMLName(const String& rStr)
+{
+ if(rStr.Len() && !pPlusData)
+ {
+ ImpForcePlusData();
+ }
+
+ if(pPlusData && pPlusData->aObjName != rStr)
+ {
+ pPlusData->aHTMLName = rStr;
+ SetChanged();
+ }
+}
+
+String SdrObject::GetHTMLName() const
+{
+ if(pPlusData)
+ {
+ return pPlusData->aHTMLName;
+ }
+
+ return String();
+}
+
+sal_uInt32 SdrObject::GetOrdNum() const
+{
+ if (pObjList!=NULL) {
+ if (pObjList->IsObjOrdNumsDirty()) {
+ pObjList->RecalcObjOrdNums();
+ }
+ } else ((SdrObject*)this)->nOrdNum=0;
+ return nOrdNum;
+}
+
+
+
+
+sal_uInt32 SdrObject::GetNavigationPosition (void)
+{
+ if (pObjList!=NULL && pObjList->RecalcNavigationPositions())
+ {
+ return mnNavigationPosition;
+ }
+ else
+ return GetOrdNum();
+}
+
+
+
+
+void SdrObject::SetNavigationPosition (const sal_uInt32 nNewPosition)
+{
+ mnNavigationPosition = nNewPosition;
+}
+
+
+
+
+// #111111#
+// To make clearer that this method may trigger RecalcBoundRect and thus may be
+// expensive and somtimes problematic (inside a bigger object change You will get
+// non-useful BoundRects sometimes) i rename that method from GetBoundRect() to
+// GetCurrentBoundRect().
+const Rectangle& SdrObject::GetCurrentBoundRect() const
+{
+ if(aOutRect.IsEmpty())
+ {
+ const_cast< SdrObject* >(this)->RecalcBoundRect();
+ }
+
+ return aOutRect;
+}
+
+// #111111#
+// To have a possibility to get the last calculated BoundRect e.g for producing
+// the first rectangle for repaints (old and new need to be used) without forcing
+// a RecalcBoundRect (which may be problematical and expensive sometimes) i add here
+// a new method for accessing the last BoundRect.
+const Rectangle& SdrObject::GetLastBoundRect() const
+{
+ return aOutRect;
+}
+
+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())
+ {
+ const drawinglayer::primitive2d::Primitive2DSequence xPrimitives(GetViewContact().getViewIndependentPrimitive2DSequence());
+
+ if(xPrimitives.hasElements())
+ {
+ // use neutral ViewInformation and get the range of the primitives
+ const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
+ const basegfx::B2DRange aRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xPrimitives, aViewInformation2D));
+
+ if(!aRange.isEmpty())
+ {
+ aOutRect = Rectangle(
+ (sal_Int32)floor(aRange.getMinX()), (sal_Int32)floor(aRange.getMinY()),
+ (sal_Int32)ceil(aRange.getMaxX()), (sal_Int32)ceil(aRange.getMaxY()));
+ return;
+ }
+ }
+ }
+}
+
+void SdrObject::BroadcastObjectChange() const
+{
+ if( pModel && pModel->isLocked() )
+ return;
+
+ sal_Bool bPlusDataBroadcast(pPlusData && pPlusData->pBroadcast);
+ sal_Bool bObjectChange(IsInserted() && pModel);
+
+ if(bPlusDataBroadcast || bObjectChange)
+ {
+ SdrHint aHint(*this);
+
+ if(bPlusDataBroadcast)
+ {
+ pPlusData->pBroadcast->Broadcast(aHint);
+ }
+
+ if(bObjectChange)
+ {
+ pModel->Broadcast(aHint);
+ }
+ }
+}
+
+void SdrObject::SetChanged()
+{
+ // #110094#-11
+ // For test purposes, use the new ViewContact for change
+ // notification now.
+ ActionChanged();
+
+ if(IsInserted() && pModel)
+ {
+ pModel->SetChanged();
+ }
+}
+
+// Tooling for painting a single object to a OutputDevice.
+sal_Bool SdrObject::SingleObjectPainter(OutputDevice& rOut) const
+{
+ sdr::contact::SdrObjectVector aObjectVector;
+ aObjectVector.push_back(const_cast< SdrObject* >(this));
+
+ sdr::contact::ObjectContactOfObjListPainter aPainter(rOut, aObjectVector, GetPage());
+ sdr::contact::DisplayInfo aDisplayInfo;
+
+ // do processing
+ aPainter.ProcessDisplay(aDisplayInfo);
+
+ return sal_True;
+}
+
+sal_Bool SdrObject::LineGeometryUsageIsNecessary() const
+{
+ XLineStyle eXLS = (XLineStyle)((const XLineStyleItem&)GetMergedItem(XATTR_LINESTYLE)).GetValue();
+ return (eXLS != XLINE_NONE);
+}
+
+SdrObject* SdrObject::Clone() const
+{
+ SdrObject* pObj=SdrObjFactory::MakeNewObject(GetObjInventor(),GetObjIdentifier(),NULL);
+ if (pObj!=NULL) {
+ pObj->pModel=pModel;
+ pObj->pPage=pPage;
+ *pObj=*this;
+ }
+ return pObj;
+}
+
+void SdrObject::operator=(const SdrObject& rObj)
+{
+ if(mpProperties)
+ {
+ delete mpProperties;
+ mpProperties = 0L;
+ }
+
+ // #110094#
+ if(mpViewContact)
+ {
+ delete mpViewContact;
+ mpViewContact = 0L;
+ }
+
+ // The Clone() method uses the local copy constructor from the individual
+ // sdr::properties::BaseProperties class. Since the target class maybe for another
+ // draw object a SdrObject needs to be provided, as in the nromal constructor.
+ mpProperties = &rObj.GetProperties().Clone(*this);
+
+ pModel =rObj.pModel;
+ aOutRect=rObj.aOutRect;
+ mnLayerID = rObj.mnLayerID;
+ aAnchor =rObj.aAnchor;
+ bVirtObj=rObj.bVirtObj;
+ bSizProt=rObj.bSizProt;
+ bMovProt=rObj.bMovProt;
+ bNoPrint=rObj.bNoPrint;
+ mbVisible=rObj.mbVisible;
+ bMarkProt=rObj.bMarkProt;
+ //EmptyPresObj wird nicht kopiert: nun doch! (25-07-1995, Joe)
+ bEmptyPresObj =rObj.bEmptyPresObj;
+ //NotVisibleAsMaster wird nicht kopiert: nun doch! (25-07-1995, Joe)
+ bNotVisibleAsMaster=rObj.bNotVisibleAsMaster;
+ bSnapRectDirty=sal_True; //rObj.bSnapRectDirty;
+ bNotMasterCachable=rObj.bNotMasterCachable;
+ if (pPlusData!=NULL) { delete pPlusData; pPlusData=NULL; }
+ if (rObj.pPlusData!=NULL) {
+ pPlusData=rObj.pPlusData->Clone(this);
+ }
+ if (pPlusData!=NULL && pPlusData->pBroadcast!=NULL) {
+ delete pPlusData->pBroadcast; // der Broadcaster wird nicht mitkopiert
+ pPlusData->pBroadcast=NULL;
+ }
+}
+
+void SdrObject::TakeObjNameSingul(XubString& rName) const
+{
+ rName=ImpGetResStr(STR_ObjNameSingulNONE);
+
+ String aName( GetName() );
+ if(aName.Len())
+ {
+ rName += sal_Unicode(' ');
+ rName += sal_Unicode('\'');
+ rName += aName;
+ rName += sal_Unicode('\'');
+ }
+}
+
+void SdrObject::TakeObjNamePlural(XubString& rName) const
+{
+ rName=ImpGetResStr(STR_ObjNamePluralNONE);
+}
+
+void SdrObject::ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, XubString& rStr, sal_uInt16 nVal) const
+{
+ rStr = ImpGetResStr(nStrCacheID);
+
+ sal_Char aSearchText1[] = "%1";
+ sal_Char aSearchText2[] = "%2";
+ xub_StrLen nPos = rStr.SearchAscii(aSearchText1);
+
+ if(nPos != STRING_NOTFOUND)
+ {
+ rStr.Erase(nPos, 2);
+
+ XubString aObjName;
+
+ TakeObjNameSingul(aObjName);
+ rStr.Insert(aObjName, nPos);
+ }
+
+ nPos = rStr.SearchAscii(aSearchText2);
+
+ if(nPos != STRING_NOTFOUND)
+ {
+ rStr.Erase(nPos, 2);
+ rStr.Insert(UniString::CreateFromInt32(nVal), nPos);
+ }
+}
+
+XubString SdrObject::GetWinkStr(long nWink, FASTBOOL bNoDegChar) const
+{
+ XubString aStr;
+ if (pModel!=NULL) {
+ pModel->TakeWinkStr(nWink,aStr,bNoDegChar);
+ }
+ return aStr;
+}
+
+XubString SdrObject::GetMetrStr(long nVal, MapUnit /*eWantMap*/, FASTBOOL bNoUnitChars) const
+{
+ XubString aStr;
+ if (pModel!=NULL) {
+ pModel->TakeMetricStr(nVal,aStr,bNoUnitChars);
+ }
+ return aStr;
+}
+
+basegfx::B2DPolyPolygon SdrObject::TakeXorPoly() const
+{
+ basegfx::B2DPolyPolygon aRetval;
+ const Rectangle aR(GetCurrentBoundRect());
+ const basegfx::B2DRange aRange(aR.Left(), aR.Top(), aR.Right(), aR.Bottom());
+ aRetval.append(basegfx::tools::createPolygonFromRect(aRange));
+
+ return aRetval;
+}
+
+basegfx::B2DPolyPolygon SdrObject::TakeContour() const
+{
+ basegfx::B2DPolyPolygon aRetval;
+
+ // create cloned object without text, but with XLINE_SOLID,
+ // COL_BLACK as line color and XFILL_NONE
+ SdrObject* pClone = Clone();
+
+ if(pClone)
+ {
+ const SdrTextObj* pTextObj = dynamic_cast< const SdrTextObj* >(this);
+
+ if(pTextObj)
+ {
+ // no text and no text animation
+ pClone->SetMergedItem(SdrTextAniKindItem(SDRTEXTANI_NONE));
+ pClone->SetOutlinerParaObject(0);
+ }
+
+ const SdrEdgeObj* pEdgeObj = dynamic_cast< const SdrEdgeObj* >(this);
+
+ if(pEdgeObj)
+ {
+ // create connections if connector, will be cleaned up when
+ // deleting the connector again
+ SdrObject* pLeft = pEdgeObj->GetConnectedNode(sal_True);
+ SdrObject* pRight = pEdgeObj->GetConnectedNode(sal_False);
+
+ if(pLeft)
+ {
+ pClone->ConnectToNode(sal_True, pLeft);
+ }
+
+ if(pRight)
+ {
+ pClone->ConnectToNode(sal_False, pRight);
+ }
+ }
+
+ 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)));
+ aNewSet.Put(XFillStyleItem(XFILL_NONE));
+ pClone->SetMergedItemSet(aNewSet);
+
+ // get sequence from clone
+ const sdr::contact::ViewContact& rVC(pClone->GetViewContact());
+ const drawinglayer::primitive2d::Primitive2DSequence xSequence(rVC.getViewIndependentPrimitive2DSequence());
+
+ if(xSequence.hasElements())
+ {
+ // use neutral ViewInformation
+ const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
+
+ // create extractor, process and get result
+ drawinglayer::processor2d::ContourExtractor2D aExtractor(aViewInformation2D);
+ aExtractor.process(xSequence);
+ const std::vector< basegfx::B2DPolyPolygon >& rResult(aExtractor.getExtractedContour());
+ const sal_uInt32 nSize(rResult.size());
+
+ // when count is one, it is implied that the object has only it's normal
+ // contour anyways and TakeCountour() is to return an empty PolyPolygon
+ // (see old implementation for historical reasons)
+ if(nSize > 1)
+ {
+ // the topology for contour is correctly a vector of PolyPolygons; for
+ // historical reasons cut it back to a single PolyPolygon here
+ for(sal_uInt32 a(0); a < nSize; a++)
+ {
+ aRetval.append(rResult[a]);
+ }
+ }
+ }
+
+ delete pClone;
+ }
+
+ return aRetval;
+}
+
+sal_uInt32 SdrObject::GetHdlCount() const
+{
+ return 8L;
+}
+
+SdrHdl* SdrObject::GetHdl(sal_uInt32 nHdlNum) const
+{
+ SdrHdl* pH=NULL;
+ const Rectangle& rR=GetSnapRect();
+ switch (nHdlNum) {
+ case 0: pH=new SdrHdl(rR.TopLeft(), HDL_UPLFT); break; // Oben links
+ case 1: pH=new SdrHdl(rR.TopCenter(), HDL_UPPER); break; // Oben
+ case 2: pH=new SdrHdl(rR.TopRight(), HDL_UPRGT); break; // Oben rechts
+ case 3: pH=new SdrHdl(rR.LeftCenter(), HDL_LEFT ); break; // Links
+ case 4: pH=new SdrHdl(rR.RightCenter(), HDL_RIGHT); break; // Rechts
+ case 5: pH=new SdrHdl(rR.BottomLeft(), HDL_LWLFT); break; // Unten links
+ case 6: pH=new SdrHdl(rR.BottomCenter(),HDL_LOWER); break; // Unten
+ case 7: pH=new SdrHdl(rR.BottomRight(), HDL_LWRGT); break; // Unten rechts
+ }
+ return pH;
+}
+
+sal_uInt32 SdrObject::GetPlusHdlCount(const SdrHdl& /*rHdl*/) const
+{
+ return 0L;
+}
+
+SdrHdl* SdrObject::GetPlusHdl(const SdrHdl& /*rHdl*/, sal_uInt32 /*nPlNum*/) const
+{
+ return 0L;
+}
+
+void SdrObject::AddToHdlList(SdrHdlList& rHdlList) const
+{
+ sal_uInt32 nAnz=GetHdlCount();
+ for (sal_uInt32 i=0L; i<nAnz; i++) {
+ SdrHdl* pHdl=GetHdl(i);
+ if (pHdl!=NULL) {
+ rHdlList.AddHdl(pHdl);
+ }
+ }
+}
+
+Rectangle SdrObject::ImpDragCalcRect(const SdrDragStat& rDrag) const
+{
+ Rectangle aTmpRect(GetSnapRect());
+ Rectangle aRect(aTmpRect);
+ const SdrHdl* pHdl=rDrag.GetHdl();
+ SdrHdlKind eHdl=pHdl==NULL ? HDL_MOVE : pHdl->GetKind();
+ FASTBOOL bEcke=(eHdl==HDL_UPLFT || eHdl==HDL_UPRGT || eHdl==HDL_LWLFT || eHdl==HDL_LWRGT);
+ FASTBOOL bOrtho=rDrag.GetView()!=NULL && rDrag.GetView()->IsOrtho();
+ FASTBOOL bBigOrtho=bEcke && bOrtho && rDrag.GetView()->IsBigOrtho();
+ Point aPos(rDrag.GetNow());
+ FASTBOOL bLft=(eHdl==HDL_UPLFT || eHdl==HDL_LEFT || eHdl==HDL_LWLFT);
+ FASTBOOL bRgt=(eHdl==HDL_UPRGT || eHdl==HDL_RIGHT || eHdl==HDL_LWRGT);
+ FASTBOOL bTop=(eHdl==HDL_UPRGT || eHdl==HDL_UPPER || eHdl==HDL_UPLFT);
+ FASTBOOL bBtm=(eHdl==HDL_LWRGT || eHdl==HDL_LOWER || eHdl==HDL_LWLFT);
+ if (bLft) aTmpRect.Left() =aPos.X();
+ if (bRgt) aTmpRect.Right() =aPos.X();
+ if (bTop) aTmpRect.Top() =aPos.Y();
+ if (bBtm) aTmpRect.Bottom()=aPos.Y();
+ if (bOrtho) { // Ortho
+ long nWdt0=aRect.Right() -aRect.Left();
+ long nHgt0=aRect.Bottom()-aRect.Top();
+ long nXMul=aTmpRect.Right() -aTmpRect.Left();
+ long nYMul=aTmpRect.Bottom()-aTmpRect.Top();
+ long nXDiv=nWdt0;
+ long nYDiv=nHgt0;
+ FASTBOOL bXNeg=(nXMul<0)!=(nXDiv<0);
+ FASTBOOL bYNeg=(nYMul<0)!=(nYDiv<0);
+ nXMul=Abs(nXMul);
+ nYMul=Abs(nYMul);
+ nXDiv=Abs(nXDiv);
+ nYDiv=Abs(nYDiv);
+ Fraction aXFact(nXMul,nXDiv); // Fractions zum kuerzen
+ Fraction aYFact(nYMul,nYDiv); // und zum vergleichen
+ nXMul=aXFact.GetNumerator();
+ nYMul=aYFact.GetNumerator();
+ nXDiv=aXFact.GetDenominator();
+ nYDiv=aYFact.GetDenominator();
+ if (bEcke) { // Eckpunkthandles
+ FASTBOOL bUseX=(aXFact<aYFact) != bBigOrtho;
+ if (bUseX) {
+ long nNeed=long(BigInt(nHgt0)*BigInt(nXMul)/BigInt(nXDiv));
+ if (bYNeg) nNeed=-nNeed;
+ if (bTop) aTmpRect.Top()=aTmpRect.Bottom()-nNeed;
+ if (bBtm) aTmpRect.Bottom()=aTmpRect.Top()+nNeed;
+ } else {
+ long nNeed=long(BigInt(nWdt0)*BigInt(nYMul)/BigInt(nYDiv));
+ if (bXNeg) nNeed=-nNeed;
+ if (bLft) aTmpRect.Left()=aTmpRect.Right()-nNeed;
+ if (bRgt) aTmpRect.Right()=aTmpRect.Left()+nNeed;
+ }
+ } else { // Scheitelpunkthandles
+ if ((bLft || bRgt) && nXDiv!=0) {
+ long nHgt0b=aRect.Bottom()-aRect.Top();
+ long nNeed=long(BigInt(nHgt0b)*BigInt(nXMul)/BigInt(nXDiv));
+ aTmpRect.Top()-=(nNeed-nHgt0b)/2;
+ aTmpRect.Bottom()=aTmpRect.Top()+nNeed;
+ }
+ if ((bTop || bBtm) && nYDiv!=0) {
+ long nWdt0b=aRect.Right()-aRect.Left();
+ long nNeed=long(BigInt(nWdt0b)*BigInt(nYMul)/BigInt(nYDiv));
+ aTmpRect.Left()-=(nNeed-nWdt0b)/2;
+ aTmpRect.Right()=aTmpRect.Left()+nNeed;
+ }
+ }
+ }
+ aTmpRect.Justify();
+ return aTmpRect;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+bool SdrObject::hasSpecialDrag() const
+{
+ return false;
+}
+
+bool SdrObject::supportsFullDrag() const
+{
+ return true;
+}
+
+SdrObject* SdrObject::getFullDragClone() const
+{
+ // default uses simple clone
+ return Clone();
+}
+
+bool SdrObject::beginSpecialDrag(SdrDragStat& rDrag) const
+{
+ const SdrHdl* pHdl = rDrag.GetHdl();
+
+ SdrHdlKind eHdl = (pHdl == NULL) ? HDL_MOVE : pHdl->GetKind();
+
+ if(eHdl==HDL_UPLFT || eHdl==HDL_UPPER || eHdl==HDL_UPRGT ||
+ eHdl==HDL_LEFT || eHdl==HDL_RIGHT || eHdl==HDL_LWLFT ||
+ eHdl==HDL_LOWER || eHdl==HDL_LWRGT)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+bool SdrObject::applySpecialDrag(SdrDragStat& rDrag)
+{
+ Rectangle aNewRect(ImpDragCalcRect(rDrag));
+
+ if(aNewRect != GetSnapRect())
+ {
+ NbcSetSnapRect(aNewRect);
+ }
+
+ return true;
+}
+
+String SdrObject::getSpecialDragComment(const SdrDragStat& /*rDrag*/) const
+{
+ return String();
+}
+
+basegfx::B2DPolyPolygon SdrObject::getSpecialDragPoly(const SdrDragStat& /*rDrag*/) const
+{
+ // default has nothing to add
+ return basegfx::B2DPolyPolygon();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Create
+FASTBOOL SdrObject::BegCreate(SdrDragStat& rStat)
+{
+ rStat.SetOrtho4Possible();
+ Rectangle aRect1(rStat.GetStart(), rStat.GetNow());
+ aRect1.Justify();
+ rStat.SetActionRect(aRect1);
+ aOutRect = aRect1;
+ return sal_True;
+}
+
+FASTBOOL SdrObject::MovCreate(SdrDragStat& rStat)
+{
+ rStat.TakeCreateRect(aOutRect);
+ rStat.SetActionRect(aOutRect);
+ aOutRect.Justify();
+
+ // #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=sal_True;
+
+ return sal_True;
+}
+
+FASTBOOL SdrObject::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
+{
+ rStat.TakeCreateRect(aOutRect);
+ aOutRect.Justify();
+
+ // #i101648# see description at MovCreate
+ //
+ // SetRectsDirty();
+
+ return (eCmd==SDRCREATE_FORCEEND || rStat.GetPointAnz()>=2);
+}
+
+void SdrObject::BrkCreate(SdrDragStat& /*rStat*/)
+{
+}
+
+FASTBOOL SdrObject::BckCreate(SdrDragStat& /*rStat*/)
+{
+ return sal_False;
+}
+
+basegfx::B2DPolyPolygon SdrObject::TakeCreatePoly(const SdrDragStat& rDrag) const
+{
+ Rectangle aRect1;
+ rDrag.TakeCreateRect(aRect1);
+ aRect1.Justify();
+
+ basegfx::B2DPolyPolygon aRetval;
+ const basegfx::B2DRange aRange(aRect1.Left(), aRect1.Top(), aRect1.Right(), aRect1.Bottom());
+ aRetval.append(basegfx::tools::createPolygonFromRect(aRange));
+ return aRetval;
+}
+
+Pointer SdrObject::GetCreatePointer() const
+{
+ return Pointer(POINTER_CROSS);
+}
+
+// Transformationen
+void SdrObject::NbcMove(const Size& rSiz)
+{
+ MoveRect(aOutRect,rSiz);
+ SetRectsDirty();
+}
+
+void SdrObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+{
+ FASTBOOL bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
+ FASTBOOL bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
+ if (bXMirr || bYMirr) {
+ Point aRef1(GetSnapRect().Center());
+ if (bXMirr) {
+ Point aRef2(aRef1);
+ aRef2.Y()++;
+ NbcMirrorGluePoints(aRef1,aRef2);
+ }
+ if (bYMirr) {
+ Point aRef2(aRef1);
+ aRef2.X()++;
+ NbcMirrorGluePoints(aRef1,aRef2);
+ }
+ }
+ ResizeRect(aOutRect,rRef,xFact,yFact);
+ SetRectsDirty();
+}
+
+void SdrObject::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
+{
+ SetGlueReallyAbsolute(sal_True);
+ aOutRect.Move(-rRef.X(),-rRef.Y());
+ Rectangle R(aOutRect);
+ if (sn==1.0 && cs==0.0) { // 90deg
+ aOutRect.Left() =-R.Bottom();
+ aOutRect.Right() =-R.Top();
+ aOutRect.Top() =R.Left();
+ aOutRect.Bottom()=R.Right();
+ } else if (sn==0.0 && cs==-1.0) { // 180deg
+ aOutRect.Left() =-R.Right();
+ aOutRect.Right() =-R.Left();
+ aOutRect.Top() =-R.Bottom();
+ aOutRect.Bottom()=-R.Top();
+ } else if (sn==-1.0 && cs==0.0) { // 270deg
+ aOutRect.Left() =R.Top();
+ aOutRect.Right() =R.Bottom();
+ aOutRect.Top() =-R.Right();
+ aOutRect.Bottom()=-R.Left();
+ }
+ aOutRect.Move(rRef.X(),rRef.Y());
+ aOutRect.Justify(); // Sicherheitshalber
+ SetRectsDirty();
+ NbcRotateGluePoints(rRef,nWink,sn,cs);
+ SetGlueReallyAbsolute(sal_False);
+}
+
+void SdrObject::NbcMirror(const Point& rRef1, const Point& rRef2)
+{
+ SetGlueReallyAbsolute(sal_True);
+ aOutRect.Move(-rRef1.X(),-rRef1.Y());
+ Rectangle R(aOutRect);
+ long dx=rRef2.X()-rRef1.X();
+ long dy=rRef2.Y()-rRef1.Y();
+ if (dx==0) { // Vertikale Achse
+ aOutRect.Left() =-R.Right();
+ aOutRect.Right()=-R.Left();
+ } else if (dy==0) { // Horizontale Achse
+ aOutRect.Top() =-R.Bottom();
+ aOutRect.Bottom()=-R.Top();
+ } else if (dx==dy) { /* 45 Grad Achse \ */
+ aOutRect.Left() =R.Top();
+ aOutRect.Right() =R.Bottom();
+ aOutRect.Top() =R.Left();
+ aOutRect.Bottom()=R.Right();
+ } else if (dx==-dy) { // 45 Grad Achse /
+ aOutRect.Left() =-R.Bottom();
+ aOutRect.Right() =-R.Top();
+ aOutRect.Top() =-R.Right();
+ aOutRect.Bottom()=-R.Left();
+ }
+ aOutRect.Move(rRef1.X(),rRef1.Y());
+ aOutRect.Justify(); // Sicherheitshalber
+ SetRectsDirty();
+ NbcMirrorGluePoints(rRef1,rRef2);
+ SetGlueReallyAbsolute(sal_False);
+}
+
+void SdrObject::NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
+{
+ SetGlueReallyAbsolute(sal_True);
+ NbcShearGluePoints(rRef,nWink,tn,bVShear);
+ SetGlueReallyAbsolute(sal_False);
+}
+
+void SdrObject::Move(const Size& rSiz)
+{
+ if (rSiz.Width()!=0 || rSiz.Height()!=0) {
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ // #110094#-14 SendRepaintBroadcast();
+ NbcMove(rSiz);
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0);
+ }
+}
+
+void SdrObject::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+{
+ if (xFact.GetNumerator()!=xFact.GetDenominator() || yFact.GetNumerator()!=yFact.GetDenominator()) {
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ // #110094#-14 SendRepaintBroadcast();
+ NbcResize(rRef,xFact,yFact);
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+ }
+}
+
+void SdrObject::Rotate(const Point& rRef, long nWink, double sn, double cs)
+{
+ if (nWink!=0) {
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ // #110094#-14 SendRepaintBroadcast();
+ NbcRotate(rRef,nWink,sn,cs);
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+ }
+}
+
+void SdrObject::Mirror(const Point& rRef1, const Point& rRef2)
+{
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ // #110094#-14 SendRepaintBroadcast();
+ NbcMirror(rRef1,rRef2);
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+}
+
+void SdrObject::Shear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
+{
+ if (nWink!=0) {
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ // #110094#-14 SendRepaintBroadcast();
+ NbcShear(rRef,nWink,tn,bVShear);
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+ }
+}
+
+void SdrObject::NbcSetRelativePos(const Point& rPnt)
+{
+ Point aRelPos0(GetSnapRect().TopLeft()-aAnchor);
+ Size aSiz(rPnt.X()-aRelPos0.X(),rPnt.Y()-aRelPos0.Y());
+ NbcMove(aSiz); // Der ruft auch das SetRectsDirty()
+}
+
+void SdrObject::SetRelativePos(const Point& rPnt)
+{
+ if (rPnt!=GetRelativePos()) {
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ // #110094#-14 SendRepaintBroadcast();
+ NbcSetRelativePos(rPnt);
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0);
+ }
+}
+
+Point SdrObject::GetRelativePos() const
+{
+ return GetSnapRect().TopLeft()-aAnchor;
+}
+
+void SdrObject::NbcSetAnchorPos(const Point& rPnt)
+{
+ Size aSiz(rPnt.X()-aAnchor.X(),rPnt.Y()-aAnchor.Y());
+ aAnchor=rPnt;
+ NbcMove(aSiz); // Der ruft auch das SetRectsDirty()
+}
+
+void SdrObject::SetAnchorPos(const Point& rPnt)
+{
+ if (rPnt!=aAnchor) {
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ // #110094#-14 SendRepaintBroadcast();
+ NbcSetAnchorPos(rPnt);
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0);
+ }
+}
+
+const Point& SdrObject::GetAnchorPos() const
+{
+ return aAnchor;
+}
+
+void SdrObject::RecalcSnapRect()
+{
+}
+
+const Rectangle& SdrObject::GetSnapRect() const
+{
+ return aOutRect;
+}
+
+void SdrObject::NbcSetSnapRect(const Rectangle& rRect)
+{
+ aOutRect=rRect;
+}
+
+const Rectangle& SdrObject::GetLogicRect() const
+{
+ return GetSnapRect();
+}
+
+void SdrObject::NbcSetLogicRect(const Rectangle& rRect)
+{
+ NbcSetSnapRect(rRect);
+}
+
+void SdrObject::AdjustToMaxRect( const Rectangle& rMaxRect, bool /* bShrinkOnly = false */ )
+{
+ SetLogicRect( rMaxRect );
+}
+
+void SdrObject::SetSnapRect(const Rectangle& rRect)
+{
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ // #110094#-14 SendRepaintBroadcast();
+ NbcSetSnapRect(rRect);
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+}
+
+void SdrObject::SetLogicRect(const Rectangle& rRect)
+{
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ // #110094#-14 SendRepaintBroadcast();
+ NbcSetLogicRect(rRect);
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+}
+
+long SdrObject::GetRotateAngle() const
+{
+ return 0;
+}
+
+long SdrObject::GetShearAngle(FASTBOOL /*bVertical*/) const
+{
+ return 0;
+}
+
+sal_uInt32 SdrObject::GetSnapPointCount() const
+{
+ return GetPointCount();
+}
+
+Point SdrObject::GetSnapPoint(sal_uInt32 i) const
+{
+ return GetPoint(i);
+}
+
+sal_Bool SdrObject::IsPolyObj() const
+{
+ return sal_False;
+}
+
+sal_uInt32 SdrObject::GetPointCount() const
+{
+ return 0L;
+}
+
+Point SdrObject::GetPoint(sal_uInt32 /*i*/) const
+{
+ return Point();
+}
+
+void SdrObject::SetPoint(const Point& rPnt, sal_uInt32 i)
+{
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ // #110094#-14 SendRepaintBroadcast();
+ NbcSetPoint(rPnt, i);
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+}
+
+void SdrObject::NbcSetPoint(const Point& /*rPnt*/, sal_uInt32 /*i*/)
+{
+}
+
+FASTBOOL SdrObject::HasTextEdit() const
+{
+ return sal_False;
+}
+
+sal_Bool SdrObject::BegTextEdit(SdrOutliner& /*rOutl*/)
+{
+ return sal_False;
+}
+
+void SdrObject::EndTextEdit(SdrOutliner& /*rOutl*/)
+{
+}
+
+void SdrObject::SetOutlinerParaObject(OutlinerParaObject* pTextObject)
+{
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ // #110094#-14 SendRepaintBroadcast();
+ NbcSetOutlinerParaObject(pTextObject);
+ SetChanged();
+ BroadcastObjectChange();
+ if (GetCurrentBoundRect()!=aBoundRect0) {
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+ }
+}
+
+void SdrObject::NbcSetOutlinerParaObject(OutlinerParaObject* /*pTextObject*/)
+{
+}
+
+OutlinerParaObject* SdrObject::GetOutlinerParaObject() const
+{
+ return NULL;
+}
+
+void SdrObject::NbcReformatText()
+{
+}
+
+void SdrObject::ReformatText()
+{
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ NbcReformatText();
+ SetChanged();
+ BroadcastObjectChange();
+ if (GetCurrentBoundRect()!=aBoundRect0) {
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+ }
+}
+
+void SdrObject::BurnInStyleSheetAttributes()
+{
+ GetProperties().ForceStyleToHardAttributes();
+}
+
+#define Imp2ndKennung (0x434F4D43)
+SdrObjUserData* SdrObject::ImpGetMacroUserData() const
+{
+ SdrObjUserData* pData=NULL;
+ sal_uInt16 nAnz=GetUserDataCount();
+ for (sal_uInt16 nNum=nAnz; nNum>0 && pData==NULL;) {
+ nNum--;
+ pData=GetUserData(nNum);
+ if (!pData->HasMacro(this)) pData=NULL;
+ }
+ return pData;
+}
+
+FASTBOOL SdrObject::HasMacro() const
+{
+ SdrObjUserData* pData=ImpGetMacroUserData();
+ return pData!=NULL ? pData->HasMacro(this) : sal_False;
+}
+
+SdrObject* SdrObject::CheckMacroHit(const SdrObjMacroHitRec& rRec) const
+{
+ SdrObjUserData* pData = ImpGetMacroUserData();
+
+ if(pData)
+ {
+ return pData->CheckMacroHit(rRec, this);
+ }
+
+ if(rRec.pPageView)
+ {
+ return SdrObjectPrimitiveHit(*this, rRec.aPos, rRec.nTol, *rRec.pPageView, rRec.pVisiLayer, false);
+ }
+
+ return 0;
+}
+
+Pointer SdrObject::GetMacroPointer(const SdrObjMacroHitRec& rRec) const
+{
+ SdrObjUserData* pData=ImpGetMacroUserData();
+ if (pData!=NULL) {
+ return pData->GetMacroPointer(rRec,this);
+ }
+ return Pointer(POINTER_REFHAND);
+}
+
+void SdrObject::PaintMacro(OutputDevice& rOut, const Rectangle& rDirtyRect, const SdrObjMacroHitRec& rRec) const
+{
+ SdrObjUserData* pData=ImpGetMacroUserData();
+
+ if(pData)
+ {
+ pData->PaintMacro(rOut,rDirtyRect,rRec,this);
+ }
+ else
+ {
+ const RasterOp eRop(rOut.GetRasterOp());
+ const basegfx::B2DPolyPolygon aPolyPolygon(TakeXorPoly());
+ const sal_uInt32 nCount(aPolyPolygon.count());
+
+ rOut.SetLineColor(COL_BLACK);
+ rOut.SetFillColor();
+ rOut.SetRasterOp(ROP_INVERT);
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ rOut.DrawPolyLine(aPolyPolygon.getB2DPolygon(a));
+ }
+
+ rOut.SetRasterOp(eRop);
+ }
+}
+
+FASTBOOL SdrObject::DoMacro(const SdrObjMacroHitRec& rRec)
+{
+ SdrObjUserData* pData=ImpGetMacroUserData();
+ if (pData!=NULL) {
+ return pData->DoMacro(rRec,this);
+ }
+ return sal_False;
+}
+
+XubString SdrObject::GetMacroPopupComment(const SdrObjMacroHitRec& rRec) const
+{
+ SdrObjUserData* pData=ImpGetMacroUserData();
+ if (pData!=NULL) {
+ return pData->GetMacroPopupComment(rRec,this);
+ }
+ return String();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrObjGeoData* SdrObject::NewGeoData() const
+{
+ return new SdrObjGeoData;
+}
+
+void SdrObject::SaveGeoData(SdrObjGeoData& rGeo) const
+{
+ rGeo.aBoundRect =GetCurrentBoundRect();
+ rGeo.aAnchor =aAnchor ;
+ rGeo.bMovProt =bMovProt ;
+ rGeo.bSizProt =bSizProt ;
+ rGeo.bNoPrint =bNoPrint ;
+ rGeo.mbVisible =mbVisible ;
+ rGeo.bClosedObj =bClosedObj ;
+ rGeo.mnLayerID = mnLayerID;
+
+ // Benutzerdefinierte Klebepunkte
+ if (pPlusData!=NULL && pPlusData->pGluePoints!=NULL) {
+ if (rGeo.pGPL!=NULL) {
+ *rGeo.pGPL=*pPlusData->pGluePoints;
+ } else {
+ rGeo.pGPL=new SdrGluePointList(*pPlusData->pGluePoints);
+ }
+ } else {
+ if (rGeo.pGPL!=NULL) {
+ delete rGeo.pGPL;
+ rGeo.pGPL=NULL;
+ }
+ }
+}
+
+void SdrObject::RestGeoData(const SdrObjGeoData& rGeo)
+{
+ SetRectsDirty();
+ aOutRect =rGeo.aBoundRect ;
+ aAnchor =rGeo.aAnchor ;
+ bMovProt =rGeo.bMovProt ;
+ bSizProt =rGeo.bSizProt ;
+ bNoPrint =rGeo.bNoPrint ;
+ mbVisible =rGeo.mbVisible ;
+ bClosedObj =rGeo.bClosedObj ;
+ mnLayerID = rGeo.mnLayerID;
+
+ // Benutzerdefinierte Klebepunkte
+ if (rGeo.pGPL!=NULL) {
+ ImpForcePlusData();
+ if (pPlusData->pGluePoints!=NULL) {
+ *pPlusData->pGluePoints=*rGeo.pGPL;
+ } else {
+ pPlusData->pGluePoints=new SdrGluePointList(*rGeo.pGPL);
+ }
+ } else {
+ if (pPlusData!=NULL && pPlusData->pGluePoints!=NULL) {
+ delete pPlusData->pGluePoints;
+ pPlusData->pGluePoints=NULL;
+ }
+ }
+}
+
+SdrObjGeoData* SdrObject::GetGeoData() const
+{
+ SdrObjGeoData* pGeo=NewGeoData();
+ SaveGeoData(*pGeo);
+ return pGeo;
+}
+
+void SdrObject::SetGeoData(const SdrObjGeoData& rGeo)
+{
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ RestGeoData(rGeo);
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// ItemSet access
+
+const SfxItemSet& SdrObject::GetObjectItemSet() const
+{
+ return GetProperties().GetObjectItemSet();
+}
+
+const SfxItemSet& SdrObject::GetMergedItemSet() const
+{
+ return GetProperties().GetMergedItemSet();
+}
+
+void SdrObject::SetObjectItem(const SfxPoolItem& rItem)
+{
+ GetProperties().SetObjectItem(rItem);
+}
+
+void SdrObject::SetMergedItem(const SfxPoolItem& rItem)
+{
+ GetProperties().SetMergedItem(rItem);
+}
+
+void SdrObject::ClearObjectItem(const sal_uInt16 nWhich)
+{
+ GetProperties().ClearObjectItem(nWhich);
+}
+
+void SdrObject::ClearMergedItem(const sal_uInt16 nWhich)
+{
+ GetProperties().ClearMergedItem(nWhich);
+}
+
+void SdrObject::SetObjectItemSet(const SfxItemSet& rSet)
+{
+ GetProperties().SetObjectItemSet(rSet);
+}
+
+void SdrObject::SetMergedItemSet(const SfxItemSet& rSet, sal_Bool bClearAllItems)
+{
+ GetProperties().SetMergedItemSet(rSet, bClearAllItems);
+}
+
+const SfxPoolItem& SdrObject::GetObjectItem(const sal_uInt16 nWhich) const
+{
+ return GetObjectItemSet().Get(nWhich);
+}
+
+const SfxPoolItem& SdrObject::GetMergedItem(const sal_uInt16 nWhich) const
+{
+ return GetMergedItemSet().Get(nWhich);
+}
+
+void SdrObject::SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, sal_Bool bClearAllItems)
+{
+ GetProperties().SetMergedItemSetAndBroadcast(rSet, bClearAllItems);
+}
+
+void SdrObject::ApplyNotPersistAttr(const SfxItemSet& rAttr)
+{
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ NbcApplyNotPersistAttr(rAttr);
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+}
+
+void SdrObject::NbcApplyNotPersistAttr(const SfxItemSet& rAttr)
+{
+ const Rectangle& rSnap=GetSnapRect();
+ const Rectangle& rLogic=GetLogicRect();
+ Point aRef1(rSnap.Center());
+ Point aRef2(aRef1); aRef2.Y()++;
+ const SfxPoolItem *pPoolItem=NULL;
+ if (rAttr.GetItemState(SDRATTR_TRANSFORMREF1X,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ aRef1.X()=((const SdrTransformRef1XItem*)pPoolItem)->GetValue();
+ }
+ if (rAttr.GetItemState(SDRATTR_TRANSFORMREF1Y,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ aRef1.Y()=((const SdrTransformRef1YItem*)pPoolItem)->GetValue();
+ }
+ if (rAttr.GetItemState(SDRATTR_TRANSFORMREF2X,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ aRef2.X()=((const SdrTransformRef2XItem*)pPoolItem)->GetValue();
+ }
+ if (rAttr.GetItemState(SDRATTR_TRANSFORMREF2Y,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ aRef2.Y()=((const SdrTransformRef2YItem*)pPoolItem)->GetValue();
+ }
+
+ Rectangle aNewSnap(rSnap);
+ if (rAttr.GetItemState(SDRATTR_MOVEX,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ long n=((const SdrMoveXItem*)pPoolItem)->GetValue();
+ aNewSnap.Move(n,0);
+ }
+ if (rAttr.GetItemState(SDRATTR_MOVEY,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ long n=((const SdrMoveYItem*)pPoolItem)->GetValue();
+ aNewSnap.Move(0,n);
+ }
+ if (rAttr.GetItemState(SDRATTR_ONEPOSITIONX,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ long n=((const SdrOnePositionXItem*)pPoolItem)->GetValue();
+ aNewSnap.Move(n-aNewSnap.Left(),0);
+ }
+ if (rAttr.GetItemState(SDRATTR_ONEPOSITIONY,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ long n=((const SdrOnePositionYItem*)pPoolItem)->GetValue();
+ aNewSnap.Move(0,n-aNewSnap.Top());
+ }
+ if (rAttr.GetItemState(SDRATTR_ONESIZEWIDTH,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ long n=((const SdrOneSizeWidthItem*)pPoolItem)->GetValue();
+ aNewSnap.Right()=aNewSnap.Left()+n;
+ }
+ if (rAttr.GetItemState(SDRATTR_ONESIZEHEIGHT,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ long n=((const SdrOneSizeHeightItem*)pPoolItem)->GetValue();
+ aNewSnap.Bottom()=aNewSnap.Top()+n;
+ }
+ if (aNewSnap!=rSnap) {
+ if (aNewSnap.GetSize()==rSnap.GetSize()) {
+ NbcMove(Size(aNewSnap.Left()-rSnap.Left(),aNewSnap.Top()-rSnap.Top()));
+ } else {
+ NbcSetSnapRect(aNewSnap);
+ }
+ }
+
+ if (rAttr.GetItemState(SDRATTR_SHEARANGLE,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ long n=((const SdrShearAngleItem*)pPoolItem)->GetValue();
+ n-=GetShearAngle();
+ if (n!=0) {
+ double nTan=tan(n*nPi180);
+ NbcShear(aRef1,n,nTan,sal_False);
+ }
+ }
+ if (rAttr.GetItemState(SDRATTR_ROTATEANGLE,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ long n=((const SdrRotateAngleItem*)pPoolItem)->GetValue();
+ n-=GetRotateAngle();
+ if (n!=0) {
+ double nSin=sin(n*nPi180);
+ double nCos=cos(n*nPi180);
+ NbcRotate(aRef1,n,nSin,nCos);
+ }
+ }
+ if (rAttr.GetItemState(SDRATTR_ROTATEONE,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ long n=((const SdrRotateOneItem*)pPoolItem)->GetValue();
+ double nSin=sin(n*nPi180);
+ double nCos=cos(n*nPi180);
+ NbcRotate(aRef1,n,nSin,nCos);
+ }
+ if (rAttr.GetItemState(SDRATTR_HORZSHEARONE,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ long n=((const SdrHorzShearOneItem*)pPoolItem)->GetValue();
+ double nTan=tan(n*nPi180);
+ NbcShear(aRef1,n,nTan,sal_False);
+ }
+ if (rAttr.GetItemState(SDRATTR_VERTSHEARONE,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ long n=((const SdrVertShearOneItem*)pPoolItem)->GetValue();
+ double nTan=tan(n*nPi180);
+ NbcShear(aRef1,n,nTan,sal_True);
+ }
+
+ if (rAttr.GetItemState(SDRATTR_OBJMOVEPROTECT,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ bool b=((const SdrObjMoveProtectItem*)pPoolItem)->GetValue();
+ SetMoveProtect(b);
+ }
+ if (rAttr.GetItemState(SDRATTR_OBJSIZEPROTECT,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ bool b=((const SdrObjSizeProtectItem*)pPoolItem)->GetValue();
+ SetResizeProtect(b);
+ }
+
+ /* #67368# move protect always sets size protect */
+ if( IsMoveProtect() )
+ SetResizeProtect( true );
+
+ if (rAttr.GetItemState(SDRATTR_OBJPRINTABLE,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ bool b=((const SdrObjPrintableItem*)pPoolItem)->GetValue();
+ SetPrintable(b);
+ }
+
+ if (rAttr.GetItemState(SDRATTR_OBJVISIBLE,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ bool b=((const SdrObjVisibleItem*)pPoolItem)->GetValue();
+ SetVisible(b);
+ }
+
+ SdrLayerID nLayer=SDRLAYER_NOTFOUND;
+ if (rAttr.GetItemState(SDRATTR_LAYERID,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ nLayer=((const SdrLayerIdItem*)pPoolItem)->GetValue();
+ }
+ if (rAttr.GetItemState(SDRATTR_LAYERNAME,sal_True,&pPoolItem)==SFX_ITEM_SET && pModel!=NULL) {
+ XubString aLayerName=((const SdrLayerNameItem*)pPoolItem)->GetValue();
+ const SdrLayerAdmin* pLayAd=pPage!=NULL ? &pPage->GetLayerAdmin() : pModel!=NULL ? &pModel->GetLayerAdmin() : NULL;
+ if (pLayAd!=NULL) {
+ const SdrLayer* pLayer=pLayAd->GetLayer(aLayerName, sal_True);
+ if (pLayer!=NULL) {
+ nLayer=pLayer->GetID();
+ }
+ }
+
+ }
+ if (nLayer!=SDRLAYER_NOTFOUND) {
+ NbcSetLayer(nLayer);
+ }
+
+ if (rAttr.GetItemState(SDRATTR_OBJECTNAME,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ XubString aName=((const SdrObjectNameItem*)pPoolItem)->GetValue();
+ SetName(aName);
+ }
+ Rectangle aNewLogic(rLogic);
+ if (rAttr.GetItemState(SDRATTR_LOGICSIZEWIDTH,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ long n=((const SdrLogicSizeWidthItem*)pPoolItem)->GetValue();
+ aNewLogic.Right()=aNewLogic.Left()+n;
+ }
+ if (rAttr.GetItemState(SDRATTR_LOGICSIZEHEIGHT,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ long n=((const SdrLogicSizeHeightItem*)pPoolItem)->GetValue();
+ aNewLogic.Bottom()=aNewLogic.Top()+n;
+ }
+ if (aNewLogic!=rLogic) {
+ NbcSetLogicRect(aNewLogic);
+ }
+ Fraction aResizeX(1,1);
+ Fraction aResizeY(1,1);
+ if (rAttr.GetItemState(SDRATTR_RESIZEXONE,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ aResizeX*=((const SdrResizeXOneItem*)pPoolItem)->GetValue();
+ }
+ if (rAttr.GetItemState(SDRATTR_RESIZEYONE,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ aResizeY*=((const SdrResizeYOneItem*)pPoolItem)->GetValue();
+ }
+ if (aResizeX!=Fraction(1,1) || aResizeY!=Fraction(1,1)) {
+ NbcResize(aRef1,aResizeX,aResizeY);
+ }
+}
+
+void lcl_SetItem(SfxItemSet& rAttr, FASTBOOL bMerge, const SfxPoolItem& rItem)
+{
+ if (bMerge) rAttr.MergeValue(rItem,sal_True);
+ else rAttr.Put(rItem);
+}
+
+void SdrObject::TakeNotPersistAttr(SfxItemSet& rAttr, FASTBOOL bMerge) const
+{
+ const Rectangle& rSnap=GetSnapRect();
+ const Rectangle& rLogic=GetLogicRect();
+ lcl_SetItem(rAttr,bMerge,SdrObjMoveProtectItem(IsMoveProtect()));
+ lcl_SetItem(rAttr,bMerge,SdrObjSizeProtectItem(IsResizeProtect()));
+ lcl_SetItem(rAttr,bMerge,SdrObjPrintableItem(IsPrintable()));
+ lcl_SetItem(rAttr,bMerge,SdrObjVisibleItem(IsVisible()));
+ lcl_SetItem(rAttr,bMerge,SdrRotateAngleItem(GetRotateAngle()));
+ lcl_SetItem(rAttr,bMerge,SdrShearAngleItem(GetShearAngle()));
+ lcl_SetItem(rAttr,bMerge,SdrOneSizeWidthItem(rSnap.GetWidth()-1));
+ lcl_SetItem(rAttr,bMerge,SdrOneSizeHeightItem(rSnap.GetHeight()-1));
+ lcl_SetItem(rAttr,bMerge,SdrOnePositionXItem(rSnap.Left()));
+ lcl_SetItem(rAttr,bMerge,SdrOnePositionYItem(rSnap.Top()));
+ if (rLogic.GetWidth()!=rSnap.GetWidth()) {
+ lcl_SetItem(rAttr,bMerge,SdrLogicSizeWidthItem(rLogic.GetWidth()-1));
+ }
+ if (rLogic.GetHeight()!=rSnap.GetHeight()) {
+ lcl_SetItem(rAttr,bMerge,SdrLogicSizeHeightItem(rLogic.GetHeight()-1));
+ }
+ XubString aName(GetName());
+
+ if(aName.Len())
+ {
+ lcl_SetItem(rAttr, bMerge, SdrObjectNameItem(aName));
+ }
+
+ lcl_SetItem(rAttr,bMerge,SdrLayerIdItem(GetLayer()));
+ const SdrLayerAdmin* pLayAd=pPage!=NULL ? &pPage->GetLayerAdmin() : pModel!=NULL ? &pModel->GetLayerAdmin() : NULL;
+ if (pLayAd!=NULL) {
+ const SdrLayer* pLayer=pLayAd->GetLayerPerID(GetLayer());
+ if (pLayer!=NULL) {
+ lcl_SetItem(rAttr,bMerge,SdrLayerNameItem(pLayer->GetName()));
+ }
+ }
+ Point aRef1(rSnap.Center());
+ Point aRef2(aRef1); aRef2.Y()++;
+ lcl_SetItem(rAttr,bMerge,SdrTransformRef1XItem(aRef1.X()));
+ lcl_SetItem(rAttr,bMerge,SdrTransformRef1YItem(aRef1.Y()));
+ lcl_SetItem(rAttr,bMerge,SdrTransformRef2XItem(aRef2.X()));
+ lcl_SetItem(rAttr,bMerge,SdrTransformRef2YItem(aRef2.Y()));
+}
+
+SfxStyleSheet* SdrObject::GetStyleSheet() const
+{
+ return GetProperties().GetStyleSheet();
+}
+
+void SdrObject::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+{
+ Rectangle aBoundRect0;
+
+ if(pUserCall)
+ aBoundRect0 = GetLastBoundRect();
+
+ // #110094#-14 SendRepaintBroadcast();
+ NbcSetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_CHGATTR, aBoundRect0);
+}
+
+void SdrObject::NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+{
+ // only allow graphic and presentation styles for shapes
+ if( pNewStyleSheet && (pNewStyleSheet->GetFamily() == SFX_STYLE_FAMILY_PARA) && (pNewStyleSheet->GetFamily() == SFX_STYLE_FAMILY_PAGE) )
+ return;
+
+ GetProperties().SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+}
+
+// Das Broadcasting beim Setzen der Attribute wird vom AttrObj gemanagt
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+FASTBOOL SdrObject::IsNode() const
+{
+ return sal_True;
+}
+
+SdrGluePoint SdrObject::GetVertexGluePoint(sal_uInt16 nPosNum) const
+{
+ // #i41936# Use SnapRect for default GluePoints
+ const Rectangle aR(GetSnapRect());
+ Point aPt;
+
+ switch(nPosNum)
+ {
+ case 0 : aPt = aR.TopCenter(); break;
+ case 1 : aPt = aR.RightCenter(); break;
+ case 2 : aPt = aR.BottomCenter(); break;
+ case 3 : aPt = aR.LeftCenter(); break;
+ }
+
+ aPt -= aR.Center();
+ SdrGluePoint aGP(aPt);
+ aGP.SetPercent(sal_False);
+
+ return aGP;
+}
+
+SdrGluePoint SdrObject::GetCornerGluePoint(sal_uInt16 nPosNum) const
+{
+ Rectangle aR(GetCurrentBoundRect());
+ Point aPt;
+ switch (nPosNum) {
+ case 0 : aPt=aR.TopLeft(); break;
+ case 1 : aPt=aR.TopRight(); break;
+ case 2 : aPt=aR.BottomRight(); break;
+ case 3 : aPt=aR.BottomLeft(); break;
+ }
+ aPt-=GetSnapRect().Center();
+ SdrGluePoint aGP(aPt);
+ aGP.SetPercent(sal_False);
+ return aGP;
+}
+
+const SdrGluePointList* SdrObject::GetGluePointList() const
+{
+ if (pPlusData!=NULL) return pPlusData->pGluePoints;
+ return NULL;
+}
+
+//SdrGluePointList* SdrObject::GetGluePointList()
+//{
+// if (pPlusData!=NULL) return pPlusData->pGluePoints;
+// return NULL;
+//}
+
+SdrGluePointList* SdrObject::ForceGluePointList()
+{
+ ImpForcePlusData();
+ if (pPlusData->pGluePoints==NULL) {
+ pPlusData->pGluePoints=new SdrGluePointList;
+ }
+ return pPlusData->pGluePoints;
+}
+
+void SdrObject::SetGlueReallyAbsolute(FASTBOOL bOn)
+{
+ // erst Const-Aufruf um zu sehen, ob
+ // ueberhaupt Klebepunkte da sind
+ // const-Aufruf erzwingen!
+ if (GetGluePointList()!=NULL) {
+ SdrGluePointList* pGPL=ForceGluePointList();
+ pGPL->SetReallyAbsolute(bOn,*this);
+ }
+}
+
+void SdrObject::NbcRotateGluePoints(const Point& rRef, long nWink, double sn, double cs)
+{
+ // erst Const-Aufruf um zu sehen, ob
+ // ueberhaupt Klebepunkte da sind
+ // const-Aufruf erzwingen!
+ if (GetGluePointList()!=NULL) {
+ SdrGluePointList* pGPL=ForceGluePointList();
+ pGPL->Rotate(rRef,nWink,sn,cs,this);
+ }
+}
+
+void SdrObject::NbcMirrorGluePoints(const Point& rRef1, const Point& rRef2)
+{
+ // erst Const-Aufruf um zu sehen, ob
+ // ueberhaupt Klebepunkte da sind
+ // const-Aufruf erzwingen!
+ if (GetGluePointList()!=NULL) {
+ SdrGluePointList* pGPL=ForceGluePointList();
+ pGPL->Mirror(rRef1,rRef2,this);
+ }
+}
+
+void SdrObject::NbcShearGluePoints(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
+{
+ // erst Const-Aufruf um zu sehen, ob
+ // ueberhaupt Klebepunkte da sind
+ // const-Aufruf erzwingen!
+ if (GetGluePointList()!=NULL) {
+ SdrGluePointList* pGPL=ForceGluePointList();
+ pGPL->Shear(rRef,nWink,tn,bVShear,this);
+ }
+}
+
+FASTBOOL SdrObject::IsEdge() const
+{
+ return sal_False;
+}
+
+void SdrObject::ConnectToNode(FASTBOOL /*bTail1*/, SdrObject* /*pObj*/)
+{
+}
+
+void SdrObject::DisconnectFromNode(FASTBOOL /*bTail1*/)
+{
+}
+
+SdrObject* SdrObject::GetConnectedNode(FASTBOOL /*bTail1*/) const
+{
+ return NULL;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrObject* SdrObject::ImpConvertToContourObj(SdrObject* pRet, sal_Bool bForceLineDash) const
+{
+ bool bNoChange(true);
+
+ if(pRet->LineGeometryUsageIsNecessary())
+ {
+ basegfx::B2DPolyPolygon aMergedLineFillPolyPolygon;
+ basegfx::B2DPolyPolygon aMergedHairlinePolyPolygon;
+ const drawinglayer::primitive2d::Primitive2DSequence xSequence(pRet->GetViewContact().getViewIndependentPrimitive2DSequence());
+
+ if(xSequence.hasElements())
+ {
+ // use neutral ViewInformation
+ const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
+
+ // create extractor, process and get result
+ drawinglayer::processor2d::LineGeometryExtractor2D aExtractor(aViewInformation2D);
+ aExtractor.process(xSequence);
+
+ // #i102241# check for line results
+ const std::vector< basegfx::B2DPolygon >& rHairlineVector = aExtractor.getExtractedHairlines();
+
+ 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]);
+ }
+ }
+
+ // #i102241# check for fill rsults
+ const std::vector< basegfx::B2DPolyPolygon >& rLineFillVector(aExtractor.getExtractedLineFills());
+
+ if(rLineFillVector.size())
+ {
+ // merge to a single PolyPolygon (OR)
+ aMergedLineFillPolyPolygon = basegfx::tools::mergeToSinglePolyPolygon(rLineFillVector);
+ }
+ }
+
+ // || aMergedHairlinePolyPolygon.Count() removed; the conversion is ONLY
+ // useful when new closed filled polygons are created
+ if(aMergedLineFillPolyPolygon.count() || (bForceLineDash && aMergedHairlinePolyPolygon.count()))
+ {
+ SfxItemSet aSet(pRet->GetMergedItemSet());
+ XFillStyle eOldFillStyle = ((const XFillStyleItem&)(aSet.Get(XATTR_FILLSTYLE))).GetValue();
+ SdrPathObj* aLinePolygonPart = NULL;
+ SdrPathObj* aLineHairlinePart = NULL;
+ bool bBuildGroup(false);
+
+ if(aMergedLineFillPolyPolygon.count())
+ {
+ // create SdrObject for filled line geometry
+ aLinePolygonPart = new SdrPathObj(OBJ_PATHFILL, aMergedLineFillPolyPolygon);
+ aLinePolygonPart->SetModel(pRet->GetModel());
+
+ // correct item properties
+ aSet.Put(XLineWidthItem(0L));
+ aSet.Put(XLineStyleItem(XLINE_NONE));
+ Color aColorLine = ((const XLineColorItem&)(aSet.Get(XATTR_LINECOLOR))).GetColorValue();
+ sal_uInt16 nTransLine = ((const XLineTransparenceItem&)(aSet.Get(XATTR_LINETRANSPARENCE))).GetValue();
+ aSet.Put(XFillColorItem(XubString(), aColorLine));
+ aSet.Put(XFillStyleItem(XFILL_SOLID));
+ aSet.Put(XFillTransparenceItem(nTransLine));
+
+ aLinePolygonPart->SetMergedItemSet(aSet);
+ }
+
+ 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, aMergedHairlinePolyPolygon);
+ aLineHairlinePart->SetModel(pRet->GetModel());
+
+ aSet.Put(XLineWidthItem(0L));
+ aSet.Put(XFillStyleItem(XFILL_NONE));
+ aSet.Put(XLineStyleItem(XLINE_SOLID));
+
+ // it is also necessary to switch off line start and ends here
+ aSet.Put(XLineStartWidthItem(0));
+ aSet.Put(XLineEndWidthItem(0));
+
+ aLineHairlinePart->SetMergedItemSet(aSet);
+
+ if(aLinePolygonPart)
+ {
+ bBuildGroup = true;
+ }
+ }
+
+ // check if original geometry should be added (e.g. filled and closed)
+ bool bAddOriginalGeometry(false);
+ SdrPathObj* pPath = PTR_CAST(SdrPathObj, pRet);
+
+ if(pPath && pPath->IsClosed())
+ {
+ if(eOldFillStyle != XFILL_NONE)
+ {
+ // #107600# use new boolean here
+ bAddOriginalGeometry = true;
+ }
+ }
+
+ // do we need a group?
+ if(bBuildGroup || bAddOriginalGeometry)
+ {
+ SdrObject* pGroup = new SdrObjGroup;
+ pGroup->SetModel(pRet->GetModel());
+
+ if(bAddOriginalGeometry)
+ {
+ // Add a clone of the original geometry.
+ aSet.ClearItem();
+ aSet.Put(pRet->GetMergedItemSet());
+ aSet.Put(XLineStyleItem(XLINE_NONE));
+ aSet.Put(XLineWidthItem(0L));
+
+ SdrObject* pClone = pRet->Clone();
+
+ pClone->SetModel(pRet->GetModel());
+ pClone->SetMergedItemSet(aSet);
+
+ pGroup->GetSubList()->NbcInsertObject(pClone);
+ }
+
+ if(aLinePolygonPart)
+ {
+ pGroup->GetSubList()->NbcInsertObject(aLinePolygonPart);
+ }
+
+ if(aLineHairlinePart)
+ {
+ pGroup->GetSubList()->NbcInsertObject(aLineHairlinePart);
+ }
+
+ pRet = pGroup;
+
+ // be more careful with the state describing bool
+ bNoChange = false;
+ }
+ else
+ {
+ if(aLinePolygonPart)
+ {
+ pRet = aLinePolygonPart;
+ // be more careful with the state describing bool
+ bNoChange = false;
+ }
+ else if(aLineHairlinePart)
+ {
+ pRet = aLineHairlinePart;
+ // be more careful with the state describing bool
+ bNoChange = false;
+ }
+ }
+ }
+ }
+
+ if(bNoChange)
+ {
+ // due to current method usage, create and return a clone when nothing has changed
+ SdrObject* pClone = pRet->Clone();
+ pClone->SetModel(pRet->GetModel());
+ pRet = pClone;
+ }
+
+ return pRet;
+}
+
+// convert this path object to contour object, even when it is a group
+SdrObject* SdrObject::ConvertToContourObj(SdrObject* pRet, sal_Bool bForceLineDash) const
+{
+ if(pRet->ISA(SdrObjGroup))
+ {
+ SdrObjList* pObjList2 = pRet->GetSubList();
+ SdrObject* pGroup = new SdrObjGroup;
+ pGroup->SetModel(pRet->GetModel());
+
+ for(sal_uInt32 a=0;a<pObjList2->GetObjCount();a++)
+ {
+ SdrObject* pIterObj = pObjList2->GetObj(a);
+ pGroup->GetSubList()->NbcInsertObject(ConvertToContourObj(pIterObj, bForceLineDash));
+ }
+
+ pRet = pGroup;
+ }
+ else
+ {
+ if(pRet && pRet->ISA(SdrPathObj))
+ {
+ SdrPathObj* pPathObj = (SdrPathObj*)pRet;
+
+ // 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
+ pPathObj->SetPathPoly(basegfx::tools::simplifyCurveSegments(pPathObj->GetPathPoly()));
+ }
+
+ pRet = ImpConvertToContourObj(pRet, bForceLineDash);
+ }
+
+ // #i73441# preserve LayerID
+ if(pRet && pRet->GetLayer() != GetLayer())
+ {
+ pRet->SetLayer(GetLayer());
+ }
+
+ return pRet;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrObject* SdrObject::ConvertToPolyObj(sal_Bool bBezier, sal_Bool bLineToArea) const
+{
+ SdrObject* pRet = DoConvertToPolyObj(bBezier);
+
+ if(pRet && bLineToArea)
+ {
+ SdrObject* pNewRet = ConvertToContourObj(pRet);
+ delete pRet;
+ pRet = pNewRet;
+ }
+
+ // #i73441# preserve LayerID
+ if(pRet && pRet->GetLayer() != GetLayer())
+ {
+ pRet->SetLayer(GetLayer());
+ }
+
+ return pRet;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrObject* SdrObject::DoConvertToPolyObj(sal_Bool /*bBezier*/) const
+{
+ return NULL;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrObject::SetInserted(sal_Bool bIns)
+{
+ if (bIns!=IsInserted()) {
+ bInserted=bIns;
+ Rectangle aBoundRect0(GetLastBoundRect());
+ if (bIns) SendUserCall(SDRUSERCALL_INSERTED,aBoundRect0);
+ else SendUserCall(SDRUSERCALL_REMOVED,aBoundRect0);
+
+ if (pPlusData!=NULL && pPlusData->pBroadcast!=NULL) { // #42522#
+ SdrHint aHint(*this);
+ aHint.SetKind(bIns?HINT_OBJINSERTED:HINT_OBJREMOVED);
+ pPlusData->pBroadcast->Broadcast(aHint);
+ }
+ }
+}
+
+void SdrObject::SetMoveProtect(sal_Bool bProt)
+{
+ if(IsMoveProtect() != bProt)
+ {
+ // #i77187# secured and simplified
+ bMovProt = bProt;
+ SetChanged();
+ BroadcastObjectChange();
+ }
+}
+
+void SdrObject::SetResizeProtect(sal_Bool bProt)
+{
+ if(IsResizeProtect() != bProt)
+ {
+ // #i77187# secured and simplified
+ bSizProt = bProt;
+ SetChanged();
+ BroadcastObjectChange();
+ }
+}
+
+void SdrObject::SetPrintable(sal_Bool bPrn)
+{
+ if( bPrn == bNoPrint )
+ {
+ bNoPrint=!bPrn;
+ SetChanged();
+ if (IsInserted() && pModel!=NULL)
+ {
+ SdrHint aHint(*this);
+ pModel->Broadcast(aHint);
+ }
+ }
+}
+
+void SdrObject::SetVisible(sal_Bool bVisible)
+{
+ if( bVisible != mbVisible )
+ {
+ mbVisible = bVisible;
+ SetChanged();
+ if (IsInserted() && pModel!=NULL)
+ {
+ SdrHint aHint(*this);
+ pModel->Broadcast(aHint);
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_uInt16 SdrObject::GetUserDataCount() const
+{
+ if (pPlusData==NULL || pPlusData->pUserDataList==NULL) return 0;
+ return pPlusData->pUserDataList->GetUserDataCount();
+}
+
+SdrObjUserData* SdrObject::GetUserData(sal_uInt16 nNum) const
+{
+ if (pPlusData==NULL || pPlusData->pUserDataList==NULL) return NULL;
+ return pPlusData->pUserDataList->GetUserData(nNum);
+}
+
+void SdrObject::InsertUserData(SdrObjUserData* pData, sal_uInt16 nPos)
+{
+ if (pData!=NULL) {
+ ImpForcePlusData();
+ if (pPlusData->pUserDataList==NULL) pPlusData->pUserDataList=new SdrObjUserDataList;
+ pPlusData->pUserDataList->InsertUserData(pData,nPos);
+ } else {
+ DBG_ERROR("SdrObject::InsertUserData(): pData ist NULL-Pointer");
+ }
+}
+
+void SdrObject::DeleteUserData(sal_uInt16 nNum)
+{
+ sal_uInt16 nAnz=GetUserDataCount();
+ if (nNum<nAnz) {
+ pPlusData->pUserDataList->DeleteUserData(nNum);
+ if (nAnz==1) {
+ delete pPlusData->pUserDataList;
+ pPlusData->pUserDataList=NULL;
+ }
+ } else {
+ DBG_ERROR("SdrObject::DeleteUserData(): ungueltiger Index");
+ }
+}
+
+void SdrObject::SendUserCall(SdrUserCallType eUserCall, const Rectangle& rBoundRect) const
+{
+ SdrObjGroup* pGroup = NULL;
+
+ if( pObjList && pObjList->GetListKind() == SDROBJLIST_GROUPOBJ )
+ pGroup = (SdrObjGroup*) pObjList->GetOwnerObj();
+
+ if ( pUserCall )
+ {
+ // UserCall ausfuehren
+ pUserCall->Changed( *this, eUserCall, rBoundRect );
+ }
+
+ while( pGroup )
+ {
+ // Gruppe benachrichtigen
+ if( pGroup->GetUserCall() )
+ {
+ SdrUserCallType eChildUserType = SDRUSERCALL_CHILD_CHGATTR;
+
+ switch( eUserCall )
+ {
+ case SDRUSERCALL_MOVEONLY:
+ eChildUserType = SDRUSERCALL_CHILD_MOVEONLY;
+ break;
+
+ case SDRUSERCALL_RESIZE:
+ eChildUserType = SDRUSERCALL_CHILD_RESIZE;
+ break;
+
+ case SDRUSERCALL_CHGATTR:
+ eChildUserType = SDRUSERCALL_CHILD_CHGATTR;
+ break;
+
+ case SDRUSERCALL_DELETE:
+ eChildUserType = SDRUSERCALL_CHILD_DELETE;
+ break;
+
+ case SDRUSERCALL_COPY:
+ eChildUserType = SDRUSERCALL_CHILD_COPY;
+ break;
+
+ case SDRUSERCALL_INSERTED:
+ eChildUserType = SDRUSERCALL_CHILD_INSERTED;
+ break;
+
+ case SDRUSERCALL_REMOVED:
+ eChildUserType = SDRUSERCALL_CHILD_REMOVED;
+ break;
+
+ default: break;
+ }
+
+ pGroup->GetUserCall()->Changed( *this, eChildUserType, rBoundRect );
+ }
+
+ if( pGroup->GetObjList() &&
+ pGroup->GetObjList()->GetListKind() == SDROBJLIST_GROUPOBJ &&
+ pGroup != (SdrObjGroup*) pObjList->GetOwnerObj() )
+ pGroup = (SdrObjGroup*) pObjList->GetOwnerObj();
+ else
+ pGroup = NULL;
+ }
+
+ // notify our UNO shape listeners
+ switch ( eUserCall )
+ {
+ case SDRUSERCALL_RESIZE:
+ notifyShapePropertyChange( ::svx::eShapeSize );
+ // fall through - RESIZE might also imply a change of the position
+ case SDRUSERCALL_MOVEONLY:
+ notifyShapePropertyChange( ::svx::eShapePosition );
+ break;
+ default:
+ // not interested in
+ break;
+ }
+}
+
+// ItemPool fuer dieses Objekt wechseln
+void SdrObject::MigrateItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel)
+{
+ if(pSrcPool && pDestPool && (pSrcPool != pDestPool))
+ {
+ GetProperties().MoveToItemPool(pSrcPool, pDestPool, pNewModel);
+ }
+}
+
+sal_Bool SdrObject::IsTransparent( sal_Bool /*bCheckForAlphaChannel*/) const
+{
+ bool bRet = false;
+
+ if( IsGroupObject() )
+ {
+ SdrObjListIter aIter( *GetSubList(), IM_DEEPNOGROUPS );
+
+ for( SdrObject* pO = aIter.Next(); pO && !bRet; pO = aIter.Next() )
+ {
+ const SfxItemSet& rAttr = pO->GetMergedItemSet();
+
+ if( ( ( (const XFillTransparenceItem&) rAttr.Get( XATTR_FILLTRANSPARENCE ) ).GetValue() ||
+ ( (const XLineTransparenceItem&) rAttr.Get( XATTR_LINETRANSPARENCE ) ).GetValue() ) ||
+ ( ( rAttr.GetItemState( XATTR_FILLFLOATTRANSPARENCE ) == SFX_ITEM_SET ) &&
+ ( (const XFillFloatTransparenceItem&) rAttr.Get( XATTR_FILLFLOATTRANSPARENCE ) ).IsEnabled() ) )
+ {
+ bRet = sal_True;
+ }
+ else if( pO->ISA( SdrGrafObj ) )
+ {
+ SdrGrafObj* pGrafObj = (SdrGrafObj*) pO;
+ if( ( (const SdrGrafTransparenceItem&) rAttr.Get( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ||
+ ( pGrafObj->GetGraphicType() == GRAPHIC_BITMAP && pGrafObj->GetGraphic().GetBitmapEx().IsAlpha() ) )
+ {
+ bRet = sal_True;
+ }
+ }
+ }
+ }
+ else
+ {
+ const SfxItemSet& rAttr = GetMergedItemSet();
+
+ if( ( ( (const XFillTransparenceItem&) rAttr.Get( XATTR_FILLTRANSPARENCE ) ).GetValue() ||
+ ( (const XLineTransparenceItem&) rAttr.Get( XATTR_LINETRANSPARENCE ) ).GetValue() ) ||
+ ( ( rAttr.GetItemState( XATTR_FILLFLOATTRANSPARENCE ) == SFX_ITEM_SET ) &&
+ ( (const XFillFloatTransparenceItem&) rAttr.Get( XATTR_FILLFLOATTRANSPARENCE ) ).IsEnabled() ) )
+ {
+ bRet = sal_True;
+ }
+ else if( ISA( SdrGrafObj ) )
+ {
+ SdrGrafObj* pGrafObj = (SdrGrafObj*) this;
+
+ // #i25616#
+ bRet = pGrafObj->IsObjectTransparent();
+ }
+ }
+
+ return bRet;
+}
+
+void SdrObject::impl_setUnoShape( const uno::Reference< uno::XInterface >& _rxUnoShape )
+{
+ maWeakUnoShape = _rxUnoShape;
+ mpSvxShape = SvxShape::getImplementation( _rxUnoShape );
+// OSL_ENSURE( mpSvxShape || !_rxUnoShape.is(),
+// "SdrObject::setUnoShape: not sure it's a good idea to have an XShape which is not implemented by SvxShape ..." );
+}
+
+/** only for internal use! */
+SvxShape* SdrObject::getSvxShape() const
+{
+ DBG_TESTSOLARMUTEX();
+ // retrieving the impl pointer and subsequently using it is not thread-safe, of course, so it needs to be
+ // guarded by the SolarMutex
+
+#if OSL_DEBUG_LEVE > 0
+ uno::Reference< uno::XInterface > xShape( maWeakUnoShape );
+ OSL_ENSURE( !( !xShapeGuard.is() && mpSvxShape ),
+ "SdrObject::getSvxShape: still having IMPL-Pointer to dead object!" );
+#endif
+
+ return mpSvxShape;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SdrObject::getUnoShape()
+{
+ // try weak reference first
+ uno::Reference< uno::XInterface > xShape( getWeakUnoShape() );
+ if( !xShape.is() )
+ {
+ OSL_ENSURE( mpSvxShape == NULL, "SdrObject::getUnoShape: XShape already dead, but still an IMPL pointer!" );
+ if ( pPage )
+ {
+ uno::Reference< uno::XInterface > xPage( pPage->getUnoPage() );
+ if( xPage.is() )
+ {
+ SvxDrawPage* pDrawPage = SvxDrawPage::getImplementation(xPage);
+ if( pDrawPage )
+ {
+ // create one
+ xShape = pDrawPage->_CreateShape( this );
+ impl_setUnoShape( xShape );
+ }
+ }
+ }
+ else
+ {
+ mpSvxShape = SvxDrawPage::CreateShapeByTypeAndInventor( GetObjIdentifier(), GetObjInventor(), this, NULL );
+ maWeakUnoShape = xShape = static_cast< ::cppu::OWeakObject* >( mpSvxShape );
+ }
+ }
+
+ return xShape;
+}
+
+::svx::PropertyChangeNotifier& SdrObject::getShapePropertyChangeNotifier()
+{
+ DBG_TESTSOLARMUTEX();
+
+ SvxShape* pSvxShape = getSvxShape();
+ ENSURE_OR_THROW( pSvxShape, "no SvxShape, yet!" );
+ return pSvxShape->getShapePropertyChangeNotifier();
+}
+
+void SdrObject::notifyShapePropertyChange( const ::svx::ShapeProperty _eProperty ) const
+{
+ DBG_TESTSOLARMUTEX();
+
+ SvxShape* pSvxShape = const_cast< SdrObject* >( this )->getSvxShape();
+ if ( pSvxShape )
+ return pSvxShape->getShapePropertyChangeNotifier().notifyPropertyChange( _eProperty );
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// transformation interface for StarOfficeAPI. This implements support for
+// homogen 3x3 matrices containing the transformation of the SdrObject. At the
+// moment it contains a shearX, rotation and translation, but for setting all linear
+// transforms like Scale, ShearX, ShearY, Rotate and Translate are supported.
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon
+// with the base geometry and returns TRUE. Otherwise it returns FALSE.
+sal_Bool SdrObject::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& /*rPolyPolygon*/) const
+{
+ // any kind of SdrObject, just use SnapRect
+ Rectangle aRectangle(GetSnapRect());
+
+ // convert to transformation values
+ basegfx::B2DTuple aScale(aRectangle.GetWidth(), aRectangle.GetHeight());
+ basegfx::B2DTuple aTranslate(aRectangle.Left(), aRectangle.Top());
+
+ // position maybe relative to anchorpos, convert
+ if( pModel && pModel->IsWriter() )
+ {
+ if(GetAnchorPos().X() || GetAnchorPos().Y())
+ {
+ aTranslate -= basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
+ }
+ }
+
+ // force MapUnit to 100th mm
+ SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
+ if(eMapUnit != SFX_MAPUNIT_100TH_MM)
+ {
+ switch(eMapUnit)
+ {
+ case SFX_MAPUNIT_TWIP :
+ {
+ // postion
+ aTranslate.setX(ImplTwipsToMM(aTranslate.getX()));
+ aTranslate.setY(ImplTwipsToMM(aTranslate.getY()));
+
+ // size
+ aScale.setX(ImplTwipsToMM(aScale.getX()));
+ aScale.setY(ImplTwipsToMM(aScale.getY()));
+
+ break;
+ }
+ default:
+ {
+ DBG_ERROR("TRGetBaseGeometry: Missing unit translation to 100th mm!");
+ }
+ }
+ }
+
+ // build matrix
+ rMatrix = basegfx::tools::createScaleTranslateB2DHomMatrix(aScale, aTranslate);
+
+ return sal_False;
+}
+
+// sets the base geometry of the object using infos contained in the homogen 3x3 matrix.
+// If it's an SdrPathObj it will use the provided geometry information. The Polygon has
+// to use (0,0) as upper left and will be scaled to the given size in the matrix.
+void SdrObject::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& /*rPolyPolygon*/)
+{
+ // break up matrix
+ basegfx::B2DTuple aScale;
+ basegfx::B2DTuple aTranslate;
+ double fRotate, fShearX;
+ rMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
+
+ // #i75086# Old DrawingLayer (GeoStat and geometry) does not support holding negative scalings
+ // in X and Y which equal a 180 degree rotation. Recognize it and react accordingly
+ if(basegfx::fTools::less(aScale.getX(), 0.0) && basegfx::fTools::less(aScale.getY(), 0.0))
+ {
+ aScale.setX(fabs(aScale.getX()));
+ aScale.setY(fabs(aScale.getY()));
+ fRotate = fmod(fRotate + F_PI, F_2PI);
+ }
+
+ // force metric to pool metric
+ SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
+ if(eMapUnit != SFX_MAPUNIT_100TH_MM)
+ {
+ switch(eMapUnit)
+ {
+ case SFX_MAPUNIT_TWIP :
+ {
+ // position
+ aTranslate.setX(ImplMMToTwips(aTranslate.getX()));
+ aTranslate.setY(ImplMMToTwips(aTranslate.getY()));
+
+ // size
+ aScale.setX(ImplMMToTwips(aScale.getX()));
+ aScale.setY(ImplMMToTwips(aScale.getY()));
+
+ break;
+ }
+ default:
+ {
+ DBG_ERROR("TRSetBaseGeometry: Missing unit translation to PoolMetric!");
+ }
+ }
+ }
+
+ // if anchor is used, make position relative to it
+ if( pModel && pModel->IsWriter() )
+ {
+ if(GetAnchorPos().X() || GetAnchorPos().Y())
+ {
+ aTranslate += basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
+ }
+ }
+
+ // build BaseRect
+ Point aPoint(FRound(aTranslate.getX()), FRound(aTranslate.getY()));
+ Rectangle aBaseRect(aPoint, Size(FRound(aScale.getX()), FRound(aScale.getY())));
+
+ // set BaseRect
+ SetSnapRect(aBaseRect);
+}
+
+// #116168#
+// Give info if object is in destruction
+sal_Bool SdrObject::IsInDestruction() const
+{
+ if(pModel)
+ return pModel->IsInDestruction();
+ return sal_False;
+}
+
+// return if fill is != XFILL_NONE
+bool SdrObject::HasFillStyle() const
+{
+ return (((const XFillStyleItem&)GetObjectItem(XATTR_FILLSTYLE)).GetValue() != XFILL_NONE);
+}
+
+bool SdrObject::HasLineStyle() const
+{
+ return (((const XLineStyleItem&)GetObjectItem(XATTR_LINESTYLE)).GetValue() != XLINE_NONE);
+}
+
+
+// #i52224#
+// on import of OLE object from MS documents the BLIP size might be retrieved,
+// the following four methods are used to control it;
+// usually this data makes no sence after the import is finished, since the object
+// might be resized
+
+Rectangle SdrObject::GetBLIPSizeRectangle() const
+{
+ return maBLIPSizeRectangle;
+}
+
+void SdrObject::SetBLIPSizeRectangle( const Rectangle& aRect )
+{
+ maBLIPSizeRectangle = aRect;
+}
+
+void SdrObject::SetContextWritingMode( const sal_Int16 /*_nContextWritingMode*/ )
+{
+ // this base class does not support different writing modes, so ignore the call
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@ @@@@@ @@@@@@ @@@@@ @@@@ @@@@ @@@@@@ @@@@ @@@@@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@@@@ @@ @@@@ @@@@@@ @@ @@ @@ @@ @@@@@ @@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@@@ @@@@@ @@@@ @@ @@ @@ @@@@ @@ @@@@ @@ @@ @@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrObjFactory::SdrObjFactory(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrPage* pNewPage, SdrModel* pNewModel)
+{
+ nInventor=nInvent;
+ nIdentifier=nIdent;
+ pNewObj=NULL;
+ pPage=pNewPage;
+ pModel=pNewModel;
+ pObj=NULL;
+ pNewData=NULL;
+}
+
+SdrObjFactory::SdrObjFactory(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrObject* pObj1)
+{
+ nInventor=nInvent;
+ nIdentifier=nIdent;
+ pNewObj=NULL;
+ pPage=NULL;
+ pModel=NULL;
+ pObj=pObj1;
+ pNewData=NULL;
+}
+
+SdrObject* SdrObjFactory::MakeNewObject(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrPage* pPage, SdrModel* pModel)
+{
+ if(pModel == NULL && pPage != NULL)
+ pModel = pPage->GetModel();
+ SdrObject* pObj = NULL;
+
+ if(nInvent == SdrInventor)
+ {
+ switch (nIdent)
+ {
+ case sal_uInt16(OBJ_NONE ): pObj=new SdrObject; break;
+ case sal_uInt16(OBJ_GRUP ): pObj=new SdrObjGroup; break;
+ case sal_uInt16(OBJ_LINE ): pObj=new SdrPathObj(OBJ_LINE ); break;
+ case sal_uInt16(OBJ_POLY ): pObj=new SdrPathObj(OBJ_POLY ); break;
+ case sal_uInt16(OBJ_PLIN ): pObj=new SdrPathObj(OBJ_PLIN ); break;
+ case sal_uInt16(OBJ_PATHLINE ): pObj=new SdrPathObj(OBJ_PATHLINE ); break;
+ case sal_uInt16(OBJ_PATHFILL ): pObj=new SdrPathObj(OBJ_PATHFILL ); break;
+ case sal_uInt16(OBJ_FREELINE ): pObj=new SdrPathObj(OBJ_FREELINE ); break;
+ case sal_uInt16(OBJ_FREEFILL ): pObj=new SdrPathObj(OBJ_FREEFILL ); break;
+ case sal_uInt16(OBJ_PATHPOLY ): pObj=new SdrPathObj(OBJ_POLY ); break;
+ case sal_uInt16(OBJ_PATHPLIN ): pObj=new SdrPathObj(OBJ_PLIN ); break;
+ case sal_uInt16(OBJ_EDGE ): pObj=new SdrEdgeObj; break;
+ case sal_uInt16(OBJ_RECT ): pObj=new SdrRectObj; break;
+ case sal_uInt16(OBJ_CIRC ): pObj=new SdrCircObj(OBJ_CIRC ); break;
+ case sal_uInt16(OBJ_SECT ): pObj=new SdrCircObj(OBJ_SECT ); break;
+ case sal_uInt16(OBJ_CARC ): pObj=new SdrCircObj(OBJ_CARC ); break;
+ case sal_uInt16(OBJ_CCUT ): pObj=new SdrCircObj(OBJ_CCUT ); break;
+ case sal_uInt16(OBJ_TEXT ): pObj=new SdrRectObj(OBJ_TEXT ); break;
+ case sal_uInt16(OBJ_TEXTEXT ): pObj=new SdrRectObj(OBJ_TEXTEXT ); break;
+ case sal_uInt16(OBJ_TITLETEXT ): pObj=new SdrRectObj(OBJ_TITLETEXT ); break;
+ case sal_uInt16(OBJ_OUTLINETEXT): pObj=new SdrRectObj(OBJ_OUTLINETEXT); break;
+ case sal_uInt16(OBJ_MEASURE ): pObj=new SdrMeasureObj; break;
+ case sal_uInt16(OBJ_GRAF ): pObj=new SdrGrafObj; break;
+ case sal_uInt16(OBJ_OLE2 ): pObj=new SdrOle2Obj; break;
+ case sal_uInt16(OBJ_FRAME ): pObj=new SdrOle2Obj(sal_True); break;
+ case sal_uInt16(OBJ_CAPTION ): pObj=new SdrCaptionObj; break;
+ case sal_uInt16(OBJ_PAGE ): pObj=new SdrPageObj; break;
+ case sal_uInt16(OBJ_UNO ): pObj=new SdrUnoObj(String()); break;
+ case sal_uInt16(OBJ_CUSTOMSHAPE ): pObj=new SdrObjCustomShape(); break;
+ case sal_uInt16(OBJ_MEDIA ): pObj=new SdrMediaObj(); break;
+ case sal_uInt16(OBJ_TABLE ): pObj=new ::sdr::table::SdrTableObj(pModel); break;
+ }
+ }
+
+ if(pObj == NULL)
+ {
+ SdrObjFactory* pFact=new SdrObjFactory(nInvent,nIdent,pPage,pModel);
+ SdrLinkList& rLL=ImpGetUserMakeObjHdl();
+ unsigned nAnz=rLL.GetLinkCount();
+ unsigned i=0;
+ while (i<nAnz && pObj==NULL) {
+ rLL.GetLink(i).Call((void*)pFact);
+ pObj=pFact->pNewObj;
+ i++;
+ }
+ delete pFact;
+ }
+
+ if(pObj == NULL)
+ {
+ // Na wenn's denn keiner will ...
+ }
+
+ if(pObj != NULL)
+ {
+ if(pPage != NULL)
+ pObj->SetPage(pPage);
+ else if(pModel != NULL)
+ pObj->SetModel(pModel);
+ }
+
+ return pObj;
+}
+
+SdrObjUserData* SdrObjFactory::MakeNewObjUserData(sal_uInt32 nInvent, sal_uInt16 nIdent, SdrObject* pObj1)
+{
+ SdrObjUserData* pData=NULL;
+ if (nInvent==SdrInventor) {
+ switch (nIdent)
+ {
+ case sal_uInt16(SDRUSERDATA_OBJTEXTLINK) : pData=new ImpSdrObjTextLinkUserData((SdrTextObj*)pObj1); break;
+ }
+ }
+ if (pData==NULL) {
+ SdrObjFactory aFact(nInvent,nIdent,pObj1);
+ SdrLinkList& rLL=ImpGetUserMakeObjUserDataHdl();
+ unsigned nAnz=rLL.GetLinkCount();
+ unsigned i=0;
+ while (i<nAnz && pData==NULL) {
+ rLL.GetLink(i).Call((void*)&aFact);
+ pData=aFact.pNewData;
+ i++;
+ }
+ }
+ return pData;
+}
+
+void SdrObjFactory::InsertMakeObjectHdl(const Link& rLink)
+{
+ SdrLinkList& rLL=ImpGetUserMakeObjHdl();
+ rLL.InsertLink(rLink);
+}
+
+void SdrObjFactory::RemoveMakeObjectHdl(const Link& rLink)
+{
+ SdrLinkList& rLL=ImpGetUserMakeObjHdl();
+ rLL.RemoveLink(rLink);
+}
+
+void SdrObjFactory::InsertMakeUserDataHdl(const Link& rLink)
+{
+ SdrLinkList& rLL=ImpGetUserMakeObjUserDataHdl();
+ rLL.InsertLink(rLink);
+}
+
+void SdrObjFactory::RemoveMakeUserDataHdl(const Link& rLink)
+{
+ SdrLinkList& rLL=ImpGetUserMakeObjUserDataHdl();
+ rLL.RemoveLink(rLink);
+}
+
+namespace svx
+{
+ ISdrObjectFilter::~ISdrObjectFilter()
+ {
+ }
+}
+
+// eof
diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx
new file mode 100644
index 000000000000..53f255c361a1
--- /dev/null
+++ b/svx/source/svdraw/svdocapt.cxx
@@ -0,0 +1,851 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <tools/bigint.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svl/style.hxx>
+#include <svx/svdocapt.hxx>
+#include <svx/xpool.hxx>
+#include <svx/xpoly.hxx>
+#include <svx/svdattrx.hxx>
+#include <svx/svdpool.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/svdtrans.hxx>
+#include <svx/svdhdl.hxx>
+#include <svx/svddrag.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdview.hxx> // fuer RectSnap
+#include "svx/svdglob.hxx" // StringCache
+#include "svx/svdstr.hrc" // Objektname
+#include <svx/svdogrp.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/xflhtit.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xfltrit.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/sdr/properties/captionproperties.hxx>
+#include <vcl/salbtype.hxx> // FRound
+#include <svx/sdr/contact/viewcontactofsdrcaptionobj.hxx>
+#include <basegfx/tuple/b2dtuple.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#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)); }
+inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); }
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+enum EscDir {LKS,RTS,OBN,UNT};
+
+class ImpCaptParams
+{
+public:
+ SdrCaptionType eType;
+ long nAngle;
+ long nGap;
+ long nEscRel;
+ long nEscAbs;
+ long nLineLen;
+ SdrCaptionEscDir eEscDir;
+ FASTBOOL bFitLineLen;
+ FASTBOOL bEscRel;
+ FASTBOOL bFixedAngle;
+
+public:
+ ImpCaptParams()
+ {
+ eType =SDRCAPT_TYPE3;
+ bFixedAngle=sal_False;
+ nAngle =4500;
+ nGap =0;
+ eEscDir =SDRCAPT_ESCHORIZONTAL;
+ bEscRel =sal_True;
+ nEscRel =5000;
+ nEscAbs =0;
+ nLineLen =0;
+ bFitLineLen=sal_True;
+ }
+ void CalcEscPos(const Point& rTail, const Rectangle& rRect, Point& rPt, EscDir& rDir) const;
+};
+
+void ImpCaptParams::CalcEscPos(const Point& rTailPt, const Rectangle& rRect, Point& rPt, EscDir& rDir) const
+{
+ Point aTl(rTailPt); // lokal kopieren wg. Performance
+ long nX,nY;
+ if (bEscRel) {
+ nX=rRect.Right()-rRect.Left();
+ nX=BigMulDiv(nX,nEscRel,10000);
+ nY=rRect.Bottom()-rRect.Top();
+ nY=BigMulDiv(nY,nEscRel,10000);
+ } else {
+ nX=nEscAbs;
+ nY=nEscAbs;
+ }
+ nX+=rRect.Left();
+ nY+=rRect.Top();
+ Point aBestPt;
+ EscDir eBestDir=LKS;
+ FASTBOOL bTryH=eEscDir==SDRCAPT_ESCBESTFIT;
+ if (!bTryH) {
+ if (eType!=SDRCAPT_TYPE1) {
+ bTryH=eEscDir==SDRCAPT_ESCHORIZONTAL;
+ } else {
+ bTryH=eEscDir==SDRCAPT_ESCVERTICAL;
+ }
+ }
+ FASTBOOL bTryV=eEscDir==SDRCAPT_ESCBESTFIT;
+ if (!bTryV) {
+ if (eType!=SDRCAPT_TYPE1) {
+ bTryV=eEscDir==SDRCAPT_ESCVERTICAL;
+ } else {
+ bTryV=eEscDir==SDRCAPT_ESCHORIZONTAL;
+ }
+ }
+
+ if (bTryH) {
+ Point aLft(rRect.Left()-nGap,nY);
+ Point aRgt(rRect.Right()+nGap,nY);
+ FASTBOOL bLft=(aTl.X()-aLft.X()<aRgt.X()-aTl.X());
+ if (bLft) {
+ eBestDir=LKS;
+ aBestPt=aLft;
+ } else {
+ eBestDir=RTS;
+ aBestPt=aRgt;
+ }
+ }
+ if (bTryV) {
+ Point aTop(nX,rRect.Top()-nGap);
+ Point aBtm(nX,rRect.Bottom()+nGap);
+ FASTBOOL bTop=(aTl.Y()-aTop.Y()<aBtm.Y()-aTl.Y());
+ Point aBest2;
+ EscDir eBest2;
+ if (bTop) {
+ eBest2=OBN;
+ aBest2=aTop;
+ } else {
+ eBest2=UNT;
+ aBest2=aBtm;
+ }
+ FASTBOOL bTakeIt=eEscDir!=SDRCAPT_ESCBESTFIT;
+ if (!bTakeIt) {
+ BigInt aHorX(aBestPt.X()-aTl.X()); aHorX*=aHorX;
+ BigInt aHorY(aBestPt.Y()-aTl.Y()); aHorY*=aHorY;
+ BigInt aVerX(aBest2.X()-aTl.X()); aVerX*=aVerX;
+ BigInt aVerY(aBest2.Y()-aTl.Y()); aVerY*=aVerY;
+ if (eType!=SDRCAPT_TYPE1) {
+ bTakeIt=aVerX+aVerY<aHorX+aHorY;
+ } else {
+ bTakeIt=aVerX+aVerY>=aHorX+aHorY;
+ }
+ }
+ if (bTakeIt) {
+ aBestPt=aBest2;
+ eBestDir=eBest2;
+ }
+ }
+ rPt=aBestPt;
+ rDir=eBestDir;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// BaseProperties section
+
+sdr::properties::BaseProperties* SdrCaptionObj::CreateObjectSpecificProperties()
+{
+ return new sdr::properties::CaptionProperties(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// DrawContact section
+
+sdr::contact::ViewContact* SdrCaptionObj::CreateObjectSpecificViewContact()
+{
+ return new sdr::contact::ViewContactOfSdrCaptionObj(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(SdrCaptionObj,SdrRectObj);
+
+SdrCaptionObj::SdrCaptionObj():
+ SdrRectObj(OBJ_TEXT),
+ aTailPoly(3), // Default Groesse: 3 Punkte = 2 Linien
+ mbSpecialTextBoxShadow(sal_False),
+ mbFixedTail(sal_False)
+{
+}
+
+SdrCaptionObj::SdrCaptionObj(const Rectangle& rRect):
+ SdrRectObj(OBJ_TEXT,rRect),
+ aTailPoly(3), // Default Groesse: 3 Punkte = 2 Linien
+ mbSpecialTextBoxShadow(sal_False),
+ mbFixedTail(sal_False)
+{
+}
+
+SdrCaptionObj::SdrCaptionObj(const Rectangle& rRect, const Point& rTail):
+ SdrRectObj(OBJ_TEXT,rRect),
+ aTailPoly(3), // Default Groesse: 3 Punkte = 2 Linien
+ mbSpecialTextBoxShadow(sal_False),
+ mbFixedTail(sal_False)
+{
+ aTailPoly[0]=maFixedTailPos=rTail;
+}
+
+SdrCaptionObj::~SdrCaptionObj()
+{
+}
+
+void SdrCaptionObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
+{
+ rInfo.bRotateFreeAllowed=sal_False;
+ rInfo.bRotate90Allowed =sal_False;
+ rInfo.bMirrorFreeAllowed=sal_False;
+ rInfo.bMirror45Allowed =sal_False;
+ rInfo.bMirror90Allowed =sal_False;
+ rInfo.bTransparenceAllowed = sal_False;
+ rInfo.bGradientAllowed = sal_False;
+ rInfo.bShearAllowed =sal_False;
+ rInfo.bEdgeRadiusAllowed=sal_False;
+ rInfo.bCanConvToPath =sal_True;
+ rInfo.bCanConvToPoly =sal_True;
+ rInfo.bCanConvToPathLineToArea=sal_False;
+ rInfo.bCanConvToPolyLineToArea=sal_False;
+ rInfo.bCanConvToContour = (rInfo.bCanConvToPoly || LineGeometryUsageIsNecessary());
+}
+
+sal_uInt16 SdrCaptionObj::GetObjIdentifier() const
+{
+ return sal_uInt16(OBJ_CAPTION);
+}
+
+void SdrCaptionObj::operator=(const SdrObject& rObj)
+{
+ SdrRectObj::operator=(rObj);
+ aTailPoly=((SdrCaptionObj&)rObj).aTailPoly;
+}
+
+void SdrCaptionObj::TakeObjNameSingul(XubString& rName) const
+{
+ rName=ImpGetResStr(STR_ObjNameSingulCAPTION);
+
+ String aName( GetName() );
+ if(aName.Len())
+ {
+ rName += sal_Unicode(' ');
+ rName += sal_Unicode('\'');
+ rName += aName;
+ rName += sal_Unicode('\'');
+ }
+}
+
+void SdrCaptionObj::TakeObjNamePlural(XubString& rName) const
+{
+ rName=ImpGetResStr(STR_ObjNamePluralCAPTION);
+}
+
+basegfx::B2DPolyPolygon SdrCaptionObj::TakeXorPoly() const
+{
+ basegfx::B2DPolyPolygon aPolyPoly(SdrRectObj::TakeXorPoly());
+ aPolyPoly.append(aTailPoly.getB2DPolygon());
+
+ return aPolyPoly;
+}
+
+sal_uInt32 SdrCaptionObj::GetHdlCount() const
+{
+ sal_uInt32 nAnz1(SdrRectObj::GetHdlCount());
+ // sal_uInt32 nAnz2(aTailPoly.GetSize());
+ // Derzeit ist nur das Draggen des Schwanzendes implementiert
+ return nAnz1 + 1L;
+}
+
+SdrHdl* SdrCaptionObj::GetHdl(sal_uInt32 nHdlNum) const
+{
+ const sal_uInt32 nRectHdlAnz(SdrRectObj::GetHdlCount());
+
+ if(nHdlNum < nRectHdlAnz)
+ {
+ return SdrRectObj::GetHdl(nHdlNum);
+ }
+ else
+ {
+ sal_uInt32 nPntNum(nHdlNum);
+ nPntNum -= nRectHdlAnz;
+
+ if(nPntNum < aTailPoly.GetSize())
+ {
+ SdrHdl* pHdl = new SdrHdl(aTailPoly.GetPoint((sal_uInt16)nPntNum), HDL_POLY);
+ pHdl->SetPolyNum(1L);
+ pHdl->SetPointNum(nPntNum);
+ return pHdl;
+ }
+ else
+ {
+ return 0L;
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+bool SdrCaptionObj::hasSpecialDrag() const
+{
+ return true;
+}
+
+bool SdrCaptionObj::beginSpecialDrag(SdrDragStat& rDrag) const
+{
+ const SdrHdl* pHdl = rDrag.GetHdl();
+ rDrag.SetEndDragChangesAttributes(true);
+ rDrag.SetEndDragChangesGeoAndAttributes(true);
+
+ if(pHdl && 0 == pHdl->GetPolyNum())
+ {
+ return SdrRectObj::beginSpecialDrag(rDrag);
+ }
+ else
+ {
+ rDrag.SetOrtho8Possible(true);
+
+ if(!pHdl)
+ {
+ if (bMovProt)
+ return 0;
+
+ rDrag.SetNoSnap(true);
+ rDrag.SetActionRect(aRect);
+
+ Point aHit(rDrag.GetStart());
+
+ if(rDrag.GetPageView() && SdrObjectPrimitiveHit(*this, aHit, 0, *rDrag.GetPageView(), 0, false))
+ {
+ return true;
+ }
+ }
+ else
+ {
+ if((1 == pHdl->GetPolyNum()) && (0 == pHdl->GetPointNum()))
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool SdrCaptionObj::applySpecialDrag(SdrDragStat& rDrag)
+{
+ const SdrHdl* pHdl = rDrag.GetHdl();
+
+ if(pHdl && 0 == pHdl->GetPolyNum())
+ {
+ const bool bRet(SdrRectObj::applySpecialDrag(rDrag));
+ ImpRecalcTail();
+ ActionChanged();
+
+ return bRet;
+ }
+ else
+ {
+ Point aDelt(rDrag.GetNow()-rDrag.GetStart());
+
+ if(!pHdl)
+ {
+ aRect.Move(aDelt.X(),aDelt.Y());
+ }
+ else
+ {
+ aTailPoly[0] += aDelt;
+ }
+
+ ImpRecalcTail();
+ ActionChanged();
+
+ return true;
+ }
+}
+
+String SdrCaptionObj::getSpecialDragComment(const SdrDragStat& rDrag) const
+{
+ const bool bCreateComment(rDrag.GetView() && this == rDrag.GetView()->GetCreateObj());
+
+ if(bCreateComment)
+ {
+ return String();
+ }
+ else
+ {
+ const SdrHdl* pHdl = rDrag.GetHdl();
+
+ if(pHdl && 0 == pHdl->GetPolyNum())
+ {
+ return SdrRectObj::getSpecialDragComment(rDrag);
+ }
+ else
+ {
+ XubString aStr;
+
+ if(!pHdl)
+ {
+ ImpTakeDescriptionStr(STR_DragCaptFram, aStr);
+ }
+ else
+ {
+ ImpTakeDescriptionStr(STR_DragCaptTail, aStr);
+ }
+
+ return aStr;
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrCaptionObj::ImpGetCaptParams(ImpCaptParams& rPara) const
+{
+ const SfxItemSet& rSet = GetObjectItemSet();
+ rPara.eType =((SdrCaptionTypeItem&) (rSet.Get(SDRATTR_CAPTIONTYPE ))).GetValue();
+ rPara.bFixedAngle=((SdrCaptionFixedAngleItem&)(rSet.Get(SDRATTR_CAPTIONANGLE ))).GetValue();
+ rPara.nAngle =((SdrCaptionAngleItem&) (rSet.Get(SDRATTR_CAPTIONFIXEDANGLE))).GetValue();
+ rPara.nGap =((SdrCaptionGapItem&) (rSet.Get(SDRATTR_CAPTIONGAP ))).GetValue();
+ rPara.eEscDir =((SdrCaptionEscDirItem&) (rSet.Get(SDRATTR_CAPTIONESCDIR ))).GetValue();
+ rPara.bEscRel =((SdrCaptionEscIsRelItem&) (rSet.Get(SDRATTR_CAPTIONESCISREL ))).GetValue();
+ rPara.nEscRel =((SdrCaptionEscRelItem&) (rSet.Get(SDRATTR_CAPTIONESCREL ))).GetValue();
+ rPara.nEscAbs =((SdrCaptionEscAbsItem&) (rSet.Get(SDRATTR_CAPTIONESCABS ))).GetValue();
+ rPara.nLineLen =((SdrCaptionLineLenItem&) (rSet.Get(SDRATTR_CAPTIONLINELEN ))).GetValue();
+ rPara.bFitLineLen=((SdrCaptionFitLineLenItem&)(rSet.Get(SDRATTR_CAPTIONFITLINELEN))).GetValue();
+}
+
+void SdrCaptionObj::ImpRecalcTail()
+{
+ ImpCaptParams aPara;
+ ImpGetCaptParams(aPara);
+ ImpCalcTail(aPara,aTailPoly,aRect);
+ SetRectsDirty();
+ SetXPolyDirty();
+}
+
+// #i35971#
+// SdrCaptionObj::ImpCalcTail1 does move the object(!). What a hack.
+// I really wonder why this had not triggered problems before. I am
+// sure there are some places where SetTailPos() is called at least
+// twice or SetSnapRect after it again just to work around this.
+// Changed this method to not do that.
+// Also found why this has been done: For interactive dragging of the
+// tail end pos for SDRCAPT_TYPE1. This sure was the simplest method
+// to achieve this, for the cost to make a whole group of const methods
+// of this object implicitly chainging the object's position.
+void SdrCaptionObj::ImpCalcTail1(const ImpCaptParams& rPara, Polygon& rPoly, Rectangle& rRect) const
+{
+ Polygon aPol(2);
+ Point aTl(rPoly[0]);
+
+ aPol[0] = aTl;
+ aPol[1] = aTl;
+
+ EscDir eEscDir;
+ Point aEscPos;
+
+ rPara.CalcEscPos(aTl, rRect, aEscPos, eEscDir);
+ aPol[1] = aEscPos;
+
+ if(eEscDir==LKS || eEscDir==RTS)
+ {
+ aPol[0].X() = aEscPos.X();
+ }
+ else
+ {
+ aPol[0].Y() = aEscPos.Y();
+ }
+
+ rPoly = aPol;
+}
+
+void SdrCaptionObj::ImpCalcTail2(const ImpCaptParams& rPara, Polygon& rPoly, Rectangle& rRect) const
+{ // Gap/EscDir/EscPos/Angle
+ Polygon aPol(2);
+ Point aTl(rPoly[0]);
+ aPol[0]=aTl;
+
+ EscDir eEscDir;
+ Point aEscPos;
+ rPara.CalcEscPos(aTl,rRect,aEscPos,eEscDir);
+ aPol[1]=aEscPos;
+
+ if (!rPara.bFixedAngle) {
+ // fehlende Implementation
+ }
+ rPoly=aPol;
+}
+
+void SdrCaptionObj::ImpCalcTail3(const ImpCaptParams& rPara, Polygon& rPoly, Rectangle& rRect) const
+{ // Gap/EscDir/EscPos/Angle/LineLen
+ Polygon aPol(3);
+ Point aTl(rPoly[0]);
+ aPol[0]=aTl;
+
+ EscDir eEscDir;
+ Point aEscPos;
+ rPara.CalcEscPos(aTl,rRect,aEscPos,eEscDir);
+ aPol[1]=aEscPos;
+ aPol[2]=aEscPos;
+
+ if (eEscDir==LKS || eEscDir==RTS) {
+ if (rPara.bFitLineLen) {
+ aPol[1].X()=(aTl.X()+aEscPos.X())/2;
+ } else {
+ if (eEscDir==LKS) aPol[1].X()-=rPara.nLineLen;
+ else aPol[1].X()+=rPara.nLineLen;
+ }
+ } else {
+ if (rPara.bFitLineLen) {
+ aPol[1].Y()=(aTl.Y()+aEscPos.Y())/2;
+ } else {
+ if (eEscDir==OBN) aPol[1].Y()-=rPara.nLineLen;
+ else aPol[1].Y()+=rPara.nLineLen;
+ }
+ }
+ if (!rPara.bFixedAngle) {
+ // fehlende Implementation
+ }
+ rPoly=aPol;
+}
+
+void SdrCaptionObj::ImpCalcTail4(const ImpCaptParams& rPara, Polygon& rPoly, Rectangle& rRect) const
+{
+ ImpCalcTail3(rPara,rPoly,rRect);
+}
+
+void SdrCaptionObj::ImpCalcTail(const ImpCaptParams& rPara, Polygon& rPoly, Rectangle& rRect) const
+{
+ switch (rPara.eType) {
+ case SDRCAPT_TYPE1: ImpCalcTail1(rPara,rPoly,rRect); break;
+ case SDRCAPT_TYPE2: ImpCalcTail2(rPara,rPoly,rRect); break;
+ case SDRCAPT_TYPE3: ImpCalcTail3(rPara,rPoly,rRect); break;
+ case SDRCAPT_TYPE4: ImpCalcTail4(rPara,rPoly,rRect); break;
+ }
+}
+
+FASTBOOL SdrCaptionObj::BegCreate(SdrDragStat& rStat)
+{
+ if (aRect.IsEmpty()) return sal_False; // Create z.Zt. nur mit vorgegebenen Rect
+
+ ImpCaptParams aPara;
+ ImpGetCaptParams(aPara);
+ aRect.SetPos(rStat.GetNow());
+ aTailPoly[0]=rStat.GetStart();
+ ImpCalcTail(aPara,aTailPoly,aRect);
+ rStat.SetActionRect(aRect);
+ return sal_True;
+}
+
+FASTBOOL SdrCaptionObj::MovCreate(SdrDragStat& rStat)
+{
+ ImpCaptParams aPara;
+ ImpGetCaptParams(aPara);
+ aRect.SetPos(rStat.GetNow());
+ ImpCalcTail(aPara,aTailPoly,aRect);
+ rStat.SetActionRect(aRect);
+ SetBoundRectDirty();
+ bSnapRectDirty=sal_True;
+ return sal_True;
+}
+
+FASTBOOL SdrCaptionObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
+{
+ ImpCaptParams aPara;
+ ImpGetCaptParams(aPara);
+ aRect.SetPos(rStat.GetNow());
+ ImpCalcTail(aPara,aTailPoly,aRect);
+ SetRectsDirty();
+ return (eCmd==SDRCREATE_FORCEEND || rStat.GetPointAnz()>=2);
+}
+
+FASTBOOL SdrCaptionObj::BckCreate(SdrDragStat& /*rStat*/)
+{
+ return sal_False;
+}
+
+void SdrCaptionObj::BrkCreate(SdrDragStat& /*rStat*/)
+{
+}
+
+basegfx::B2DPolyPolygon SdrCaptionObj::TakeCreatePoly(const SdrDragStat& /*rDrag*/) const
+{
+ basegfx::B2DPolyPolygon aRetval;
+ const basegfx::B2DRange aRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom());
+ aRetval.append(basegfx::tools::createPolygonFromRect(aRange));
+ aRetval.append(aTailPoly.getB2DPolygon());
+ return aRetval;
+}
+
+Pointer SdrCaptionObj::GetCreatePointer() const
+{
+ return Pointer(POINTER_DRAW_CAPTION);
+}
+
+void SdrCaptionObj::NbcMove(const Size& rSiz)
+{
+ SdrRectObj::NbcMove(rSiz);
+ MovePoly(aTailPoly,rSiz);
+ if(mbFixedTail)
+ SetTailPos(GetFixedTailPos());
+}
+
+void SdrCaptionObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+{
+ SdrRectObj::NbcResize(rRef,xFact,yFact);
+ ResizePoly(aTailPoly,rRef,xFact,yFact);
+ ImpRecalcTail();
+ if(mbFixedTail)
+ SetTailPos(GetFixedTailPos());
+}
+
+void SdrCaptionObj::NbcSetRelativePos(const Point& rPnt)
+{
+ Point aRelPos0(aTailPoly.GetPoint(0)-aAnchor);
+ Size aSiz(rPnt.X()-aRelPos0.X(),rPnt.Y()-aRelPos0.Y());
+ NbcMove(aSiz); // Der ruft auch das SetRectsDirty()
+}
+
+Point SdrCaptionObj::GetRelativePos() const
+{
+ return aTailPoly.GetPoint(0)-aAnchor;
+}
+
+void SdrCaptionObj::NbcSetAnchorPos(const Point& rPnt)
+{
+ SdrRectObj::NbcSetAnchorPos(rPnt);
+ // !!!!! fehlende Impl.
+}
+
+const Point& SdrCaptionObj::GetAnchorPos() const
+{
+ // !!!!! fehlende Impl.
+ return SdrRectObj::GetAnchorPos();
+}
+
+void SdrCaptionObj::RecalcSnapRect()
+{
+ SdrRectObj::RecalcSnapRect();
+ // #i32599#
+ // maSnapRect.Union(aTailPoly.GetBoundRect());
+ // !!!!! fehlende Impl.
+}
+
+const Rectangle& SdrCaptionObj::GetSnapRect() const
+{
+ return SdrRectObj::GetSnapRect();
+}
+
+void SdrCaptionObj::NbcSetSnapRect(const Rectangle& rRect)
+{
+ // #i32599#
+ // Move back to see the rectangle of the underlying SdrRectObj
+ // as the SnapRect, without the TailPos. That simplifies SnapRect
+ // handling again, if not allows it at all...
+ SdrRectObj::NbcSetSnapRect(rRect);
+}
+
+const Rectangle& SdrCaptionObj::GetLogicRect() const
+{
+ return aRect;
+}
+
+void SdrCaptionObj::NbcSetLogicRect(const Rectangle& rRect)
+{
+ SdrRectObj::NbcSetLogicRect(rRect);
+ ImpRecalcTail();
+}
+
+const Point& SdrCaptionObj::GetTailPos() const
+{
+ return aTailPoly[0];
+}
+
+void SdrCaptionObj::SetTailPos(const Point& rPos)
+{
+ if (aTailPoly.GetSize()==0 || aTailPoly[0]!=rPos) {
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ // #110094#-14 SendRepaintBroadcast();
+ NbcSetTailPos(rPos);
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+ }
+}
+
+void SdrCaptionObj::NbcSetTailPos(const Point& rPos)
+{
+ aTailPoly[0]=rPos;
+ ImpRecalcTail();
+}
+
+sal_uInt32 SdrCaptionObj::GetSnapPointCount() const
+{
+ // !!!!! fehlende Impl.
+ return 0L;
+}
+
+Point SdrCaptionObj::GetSnapPoint(sal_uInt32 /*i*/) const
+{
+ // !!!!! fehlende Impl.
+ return Point(0,0);
+}
+
+void SdrCaptionObj::SetModel(SdrModel* pNewModel)
+{
+ SdrRectObj::SetModel(pNewModel);
+ ImpRecalcTail();
+}
+
+void SdrCaptionObj::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
+{
+ SdrRectObj::Notify(rBC,rHint);
+ ImpRecalcTail();
+}
+
+SdrObjGeoData* SdrCaptionObj::NewGeoData() const
+{
+ return new SdrCaptObjGeoData;
+}
+
+void SdrCaptionObj::SaveGeoData(SdrObjGeoData& rGeo) const
+{
+ SdrRectObj::SaveGeoData(rGeo);
+ SdrCaptObjGeoData& rCGeo=(SdrCaptObjGeoData&)rGeo;
+ rCGeo.aTailPoly=aTailPoly;
+}
+
+void SdrCaptionObj::RestGeoData(const SdrObjGeoData& rGeo)
+{
+ SdrRectObj::RestGeoData(rGeo);
+ SdrCaptObjGeoData& rCGeo=(SdrCaptObjGeoData&)rGeo;
+ aTailPoly=rCGeo.aTailPoly;
+}
+
+SdrObject* SdrCaptionObj::DoConvertToPolyObj(sal_Bool bBezier) const
+{ // #42334# - Convert implementiert
+ SdrObject* pRect=SdrRectObj::DoConvertToPolyObj(bBezier);
+ SdrObject* pTail = ImpConvertMakeObj(basegfx::B2DPolyPolygon(aTailPoly.getB2DPolygon()), sal_False, bBezier);
+ SdrObject* pRet=(pTail!=NULL) ? pTail : pRect;
+ if (pTail!=NULL && pRect!=NULL) {
+ FASTBOOL bInsRect=sal_True;
+ FASTBOOL bInsTail=sal_True;
+ SdrObjList* pOL=pTail->GetSubList();
+ if (pOL!=NULL) { pRet=pRect; bInsTail=sal_False; }
+ if (pOL==NULL) pOL=pRect->GetSubList();
+ if (pOL!=NULL) { pRet=pRect; bInsRect=sal_False; }
+ if (pOL==NULL) {
+ SdrObjGroup* pGrp=new SdrObjGroup;
+ pOL=pGrp->GetSubList();
+ pRet=pGrp;
+ }
+ if (bInsRect) pOL->NbcInsertObject(pRect);
+ if (bInsTail) pOL->NbcInsertObject(pTail,0);
+ }
+ return pRet;
+}
+
+// #i32599#
+// Add own implementation for TRSetBaseGeometry to handle TailPos over changes.
+void SdrCaptionObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& /*rPolyPolygon*/)
+{
+ // break up matrix
+ basegfx::B2DTuple aScale;
+ basegfx::B2DTuple aTranslate;
+ double fRotate, fShearX;
+ rMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
+
+ // #i75086# Old DrawingLayer (GeoStat and geometry) does not support holding negative scalings
+ // in X and Y which equal a 180 degree rotation. Recognize it and react accordingly
+ if(basegfx::fTools::less(aScale.getX(), 0.0) && basegfx::fTools::less(aScale.getY(), 0.0))
+ {
+ aScale.setX(fabs(aScale.getX()));
+ aScale.setY(fabs(aScale.getY()));
+ fRotate = fmod(fRotate + F_PI, F_2PI);
+ }
+
+ // force metric to pool metric
+ SfxMapUnit eMapUnit = pModel->GetItemPool().GetMetric(0);
+ if(eMapUnit != SFX_MAPUNIT_100TH_MM)
+ {
+ switch(eMapUnit)
+ {
+ case SFX_MAPUNIT_TWIP :
+ {
+ // position
+ aTranslate.setX(ImplMMToTwips(aTranslate.getX()));
+ aTranslate.setY(ImplMMToTwips(aTranslate.getY()));
+
+ // size
+ aScale.setX(ImplMMToTwips(aScale.getX()));
+ aScale.setY(ImplMMToTwips(aScale.getY()));
+
+ break;
+ }
+ default:
+ {
+ DBG_ERROR("TRSetBaseGeometry: Missing unit translation to PoolMetric!");
+ }
+ }
+ }
+
+ // if anchor is used, make position relative to it
+ if( pModel->IsWriter() )
+ {
+ if(GetAnchorPos().X() || GetAnchorPos().Y())
+ {
+ aTranslate += basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
+ }
+ }
+
+ // build BaseRect
+ Point aPoint(FRound(aTranslate.getX()), FRound(aTranslate.getY()));
+ Rectangle aBaseRect(aPoint, Size(FRound(aScale.getX()), FRound(aScale.getY())));
+
+ // set BaseRect, but rescue TailPos over this call
+ const Point aTailPoint = GetTailPos();
+ SetSnapRect(aBaseRect);
+ SetTailPos(aTailPoint);
+ ImpRecalcTail();
+}
+
+// geometry access
+basegfx::B2DPolygon SdrCaptionObj::getTailPolygon() const
+{
+ return aTailPoly.getB2DPolygon();
+}
+
+// eof
diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx
new file mode 100644
index 000000000000..1d00e13571d9
--- /dev/null
+++ b/svx/source/svdraw/svdocirc.cxx
@@ -0,0 +1,1169 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svl/style.hxx>
+#include <tools/bigint.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svx/xlnedwit.hxx>
+#include <svx/xlnstwit.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/xlnedit.hxx>
+#include <svx/svdocirc.hxx>
+#include <math.h>
+#include <svx/xpool.hxx>
+#include <svx/svdattr.hxx>
+#include <svx/svdpool.hxx>
+#include <svx/svdattrx.hxx>
+#include <svx/svdtrans.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/svddrag.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdopath.hxx> // fuer die Objektkonvertierung
+#include <svx/svdview.hxx> // Zum Draggen (Ortho)
+#include "svx/svdglob.hxx" // StringCache
+#include "svx/svdstr.hrc" // Objektname
+#include <editeng/eeitem.hxx>
+#include "svdoimp.hxx"
+#include <svx/sdr/properties/circleproperties.hxx>
+#include <svx/sdr/contact/viewcontactofsdrcircobj.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+Point GetWinkPnt(const Rectangle& rR, long nWink)
+{
+ Point aCenter(rR.Center());
+ long nWdt=rR.Right()-rR.Left();
+ long nHgt=rR.Bottom()-rR.Top();
+ long nMaxRad=((nWdt>nHgt ? nWdt : nHgt)+1) /2;
+ double a;
+ a=nWink*nPi180;
+ Point aRetval(Round(cos(a)*nMaxRad),-Round(sin(a)*nMaxRad));
+ if (nWdt==0) aRetval.X()=0;
+ if (nHgt==0) aRetval.Y()=0;
+ if (nWdt!=nHgt) {
+ if (nWdt>nHgt) {
+ if (nWdt!=0) {
+ // eventuelle Ueberlaeufe bei sehr grossen Objekten abfangen (Bug 23384)
+ if (Abs(nHgt)>32767 || Abs(aRetval.Y())>32767) {
+ aRetval.Y()=BigMulDiv(aRetval.Y(),nHgt,nWdt);
+ } else {
+ aRetval.Y()=aRetval.Y()*nHgt/nWdt;
+ }
+ }
+ } else {
+ if (nHgt!=0) {
+ // eventuelle Ueberlaeufe bei sehr grossen Objekten abfangen (Bug 23384)
+ if (Abs(nWdt)>32767 || Abs(aRetval.X())>32767) {
+ aRetval.X()=BigMulDiv(aRetval.X(),nWdt,nHgt);
+ } else {
+ aRetval.X()=aRetval.X()*nWdt/nHgt;
+ }
+ }
+ }
+ }
+ aRetval+=aCenter;
+ return aRetval;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// BaseProperties section
+
+sdr::properties::BaseProperties* SdrCircObj::CreateObjectSpecificProperties()
+{
+ return new sdr::properties::CircleProperties(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// DrawContact section
+
+sdr::contact::ViewContact* SdrCircObj::CreateObjectSpecificViewContact()
+{
+ return new sdr::contact::ViewContactOfSdrCircObj(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(SdrCircObj,SdrRectObj);
+
+SdrCircObj::SdrCircObj(SdrObjKind eNewKind)
+{
+ nStartWink=0;
+ nEndWink=36000;
+ meCircleKind=eNewKind;
+ bClosedObj=eNewKind!=OBJ_CARC;
+}
+
+SdrCircObj::SdrCircObj(SdrObjKind eNewKind, const Rectangle& rRect):
+ SdrRectObj(rRect)
+{
+ nStartWink=0;
+ nEndWink=36000;
+ meCircleKind=eNewKind;
+ bClosedObj=eNewKind!=OBJ_CARC;
+}
+
+SdrCircObj::SdrCircObj(SdrObjKind eNewKind, const Rectangle& rRect, long nNewStartWink, long nNewEndWink):
+ SdrRectObj(rRect)
+{
+ long nWinkDif=nNewEndWink-nNewStartWink;
+ nStartWink=NormAngle360(nNewStartWink);
+ nEndWink=NormAngle360(nNewEndWink);
+ if (nWinkDif==36000) nEndWink+=nWinkDif; // Vollkreis
+ meCircleKind=eNewKind;
+ bClosedObj=eNewKind!=OBJ_CARC;
+}
+
+SdrCircObj::~SdrCircObj()
+{
+}
+
+void SdrCircObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
+{
+ FASTBOOL bCanConv=!HasText() || ImpCanConvTextToCurve();
+ rInfo.bEdgeRadiusAllowed = sal_False;
+ rInfo.bCanConvToPath=bCanConv;
+ rInfo.bCanConvToPoly=bCanConv;
+ rInfo.bCanConvToContour = !IsFontwork() && (rInfo.bCanConvToPoly || LineGeometryUsageIsNecessary());
+}
+
+sal_uInt16 SdrCircObj::GetObjIdentifier() const
+{
+ return sal_uInt16(meCircleKind);
+}
+
+FASTBOOL SdrCircObj::PaintNeedsXPolyCirc() const
+{
+ // XPoly ist notwendig fuer alle gedrehten Ellipsenobjekte,
+ // fuer alle Kreis- und Ellipsenabschnitte
+ // und wenn nicht WIN dann (erstmal) auch fuer Kreis-/Ellipsenausschnitte
+ // und Kreis-/Ellipsenboegen (wg. Genauigkeit)
+ FASTBOOL bNeed=aGeo.nDrehWink!=0 || aGeo.nShearWink!=0 || meCircleKind==OBJ_CCUT;
+ // Wenn nicht Win, dann fuer alle ausser Vollkreis (erstmal!!!)
+ if (meCircleKind!=OBJ_CIRC) bNeed=sal_True;
+
+ const SfxItemSet& rSet = GetObjectItemSet();
+ if(!bNeed)
+ {
+ // XPoly ist notwendig fuer alles was nicht LineSolid oder LineNone ist
+ XLineStyle eLine = ((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue();
+ bNeed = eLine != XLINE_NONE && eLine != XLINE_SOLID;
+
+ // XPoly ist notwendig fuer dicke Linien
+ if(!bNeed && eLine != XLINE_NONE)
+ bNeed = ((XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue() != 0;
+
+ // XPoly ist notwendig fuer Kreisboegen mit Linienenden
+ if(!bNeed && meCircleKind == OBJ_CARC)
+ {
+ // Linienanfang ist da, wenn StartPolygon und StartWidth!=0
+ bNeed=((XLineStartItem&)(rSet.Get(XATTR_LINESTART))).GetLineStartValue().count() != 0L &&
+ ((XLineStartWidthItem&)(rSet.Get(XATTR_LINESTARTWIDTH))).GetValue() != 0;
+
+ if(!bNeed)
+ {
+ // Linienende ist da, wenn EndPolygon und EndWidth!=0
+ bNeed = ((XLineEndItem&)(rSet.Get(XATTR_LINEEND))).GetLineEndValue().count() != 0L &&
+ ((XLineEndWidthItem&)(rSet.Get(XATTR_LINEENDWIDTH))).GetValue() != 0;
+ }
+ }
+ }
+
+ // XPoly ist notwendig, wenn Fill !=None und !=Solid
+ if(!bNeed && meCircleKind != OBJ_CARC)
+ {
+ XFillStyle eFill=((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue();
+ bNeed = eFill != XFILL_NONE && eFill != XFILL_SOLID;
+ }
+
+ if(!bNeed && meCircleKind != OBJ_CIRC && nStartWink == nEndWink)
+ bNeed=sal_True; // Weil sonst Vollkreis gemalt wird
+
+ return bNeed;
+}
+
+basegfx::B2DPolygon SdrCircObj::ImpCalcXPolyCirc(const SdrObjKind eCicrleKind, const Rectangle& rRect1, long nStart, long nEnd) const
+{
+ const basegfx::B2DRange aRange(rRect1.Left(), rRect1.Top(), rRect1.Right(), rRect1.Bottom());
+ basegfx::B2DPolygon aCircPolygon;
+
+ if(OBJ_CIRC == eCicrleKind)
+ {
+ // create full circle. Do not use createPolygonFromEllipse; it's necessary
+ // to get the start point to the bottom of the circle to keep compatible to
+ // old geometry creation
+ aCircPolygon = basegfx::tools::createPolygonFromUnitCircle(1);
+
+ // needs own scaling and translation from unit circle to target size (same as
+ // would be in createPolygonFromEllipse)
+ const basegfx::B2DPoint aCenter(aRange.getCenter());
+ const basegfx::B2DHomMatrix aMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix(
+ aRange.getWidth() / 2.0, aRange.getHeight() / 2.0,
+ aCenter.getX(), aCenter.getY()));
+ aCircPolygon.transform(aMatrix);
+ }
+ else
+ {
+ // mirror start, end for geometry creation since model coordinate system is mirrored in Y
+ // #i111715# increase numerical correctness by first dividing and not using F_PI1800
+ const double fStart((((36000 - nEnd) % 36000) / 18000.0) * F_PI);
+ const double fEnd((((36000 - nStart) % 36000) / 18000.0) * F_PI);
+
+ // create circle segment. This is not closed by default
+ aCircPolygon = basegfx::tools::createPolygonFromEllipseSegment(
+ aRange.getCenter(), aRange.getWidth() / 2.0, aRange.getHeight() / 2.0,
+ fStart, fEnd);
+
+ // check closing states
+ const bool bCloseSegment(OBJ_CARC != eCicrleKind);
+ const bool bCloseUsingCenter(OBJ_SECT == eCicrleKind);
+
+ if(bCloseSegment)
+ {
+ if(bCloseUsingCenter)
+ {
+ // add center point at start (for historical reasons)
+ basegfx::B2DPolygon aSector;
+ aSector.append(aRange.getCenter());
+ aSector.append(aCircPolygon);
+ aCircPolygon = aSector;
+ }
+
+ // close
+ aCircPolygon.setClosed(true);
+ }
+ }
+
+ // #i76950#
+ if(aGeo.nShearWink || aGeo.nDrehWink)
+ {
+ // translate top left to (0,0)
+ const basegfx::B2DPoint aTopLeft(aRange.getMinimum());
+ basegfx::B2DHomMatrix aMatrix(basegfx::tools::createTranslateB2DHomMatrix(
+ -aTopLeft.getX(), -aTopLeft.getY()));
+
+ // shear, rotate and back to top left (if needed)
+ aMatrix = basegfx::tools::createShearXRotateTranslateB2DHomMatrix(
+ aGeo.nShearWink ? tan((36000 - aGeo.nShearWink) * F_PI18000) : 0.0,
+ aGeo.nDrehWink ? (36000 - aGeo.nDrehWink) * F_PI18000 : 0.0,
+ aTopLeft) * aMatrix;
+
+ // apply transformation
+ aCircPolygon.transform(aMatrix);
+ }
+
+ return aCircPolygon;
+}
+
+void SdrCircObj::RecalcXPoly()
+{
+ const basegfx::B2DPolygon aPolyCirc(ImpCalcXPolyCirc(meCircleKind, aRect, nStartWink, nEndWink));
+ mpXPoly = new XPolygon(aPolyCirc);
+}
+
+void SdrCircObj::TakeObjNameSingul(XubString& rName) const
+{
+ sal_uInt16 nID=STR_ObjNameSingulCIRC;
+ if (aRect.GetWidth()==aRect.GetHeight() && aGeo.nShearWink==0) {
+ switch (meCircleKind) {
+ case OBJ_CIRC: nID=STR_ObjNameSingulCIRC; break;
+ case OBJ_SECT: nID=STR_ObjNameSingulSECT; break;
+ case OBJ_CARC: nID=STR_ObjNameSingulCARC; break;
+ case OBJ_CCUT: nID=STR_ObjNameSingulCCUT; break;
+ default: break;
+ }
+ } else {
+ switch (meCircleKind) {
+ case OBJ_CIRC: nID=STR_ObjNameSingulCIRCE; break;
+ case OBJ_SECT: nID=STR_ObjNameSingulSECTE; break;
+ case OBJ_CARC: nID=STR_ObjNameSingulCARCE; break;
+ case OBJ_CCUT: nID=STR_ObjNameSingulCCUTE; break;
+ default: break;
+ }
+ }
+ rName=ImpGetResStr(nID);
+
+ String aName( GetName() );
+ if(aName.Len())
+ {
+ rName += sal_Unicode(' ');
+ rName += sal_Unicode('\'');
+ rName += aName;
+ rName += sal_Unicode('\'');
+ }
+}
+
+void SdrCircObj::TakeObjNamePlural(XubString& rName) const
+{
+ sal_uInt16 nID=STR_ObjNamePluralCIRC;
+ if (aRect.GetWidth()==aRect.GetHeight() && aGeo.nShearWink==0) {
+ switch (meCircleKind) {
+ case OBJ_CIRC: nID=STR_ObjNamePluralCIRC; break;
+ case OBJ_SECT: nID=STR_ObjNamePluralSECT; break;
+ case OBJ_CARC: nID=STR_ObjNamePluralCARC; break;
+ case OBJ_CCUT: nID=STR_ObjNamePluralCCUT; break;
+ default: break;
+ }
+ } else {
+ switch (meCircleKind) {
+ case OBJ_CIRC: nID=STR_ObjNamePluralCIRCE; break;
+ case OBJ_SECT: nID=STR_ObjNamePluralSECTE; break;
+ case OBJ_CARC: nID=STR_ObjNamePluralCARCE; break;
+ case OBJ_CCUT: nID=STR_ObjNamePluralCCUTE; break;
+ default: break;
+ }
+ }
+ rName=ImpGetResStr(nID);
+}
+
+void SdrCircObj::operator=(const SdrObject& rObj)
+{
+ SdrRectObj::operator=(rObj);
+
+ nStartWink = ((SdrCircObj&)rObj).nStartWink;
+ nEndWink = ((SdrCircObj&)rObj).nEndWink;
+}
+
+basegfx::B2DPolyPolygon SdrCircObj::TakeXorPoly() const
+{
+ const basegfx::B2DPolygon aCircPolygon(ImpCalcXPolyCirc(meCircleKind, aRect, nStartWink, nEndWink));
+ return basegfx::B2DPolyPolygon(aCircPolygon);
+}
+
+struct ImpCircUser : public SdrDragStatUserData
+{
+ Rectangle aR;
+ Point aCenter;
+ Point aRadius;
+ Point aP1;
+ Point aP2;
+ long nMaxRad;
+ long nHgt;
+ long nWdt;
+ long nStart;
+ long nEnd;
+ long nWink;
+ FASTBOOL bRight; // noch nicht implementiert
+
+public:
+ ImpCircUser()
+ : nMaxRad(0),
+ nHgt(0),
+ nWdt(0),
+ nStart(0),
+ nEnd(0),
+ bRight(sal_False)
+ {}
+ void SetCreateParams(SdrDragStat& rStat);
+};
+
+sal_uInt32 SdrCircObj::GetHdlCount() const
+{
+ if(OBJ_CIRC != meCircleKind)
+ {
+ return 10L;
+ }
+ else
+ {
+ return 8L;
+ }
+}
+
+SdrHdl* SdrCircObj::GetHdl(sal_uInt32 nHdlNum) const
+{
+ if (meCircleKind==OBJ_CIRC)
+ {
+ nHdlNum += 2L;
+ }
+
+ SdrHdl* pH = NULL;
+ Point aPnt;
+ SdrHdlKind eLocalKind(HDL_MOVE);
+ sal_uInt32 nPNum(0);
+
+ switch (nHdlNum)
+ {
+ case 0:
+ aPnt = GetWinkPnt(aRect,nStartWink);
+ eLocalKind = HDL_CIRC;
+ nPNum = 1;
+ break;
+ case 1:
+ aPnt = GetWinkPnt(aRect,nEndWink);
+ eLocalKind = HDL_CIRC;
+ nPNum = 2L;
+ break;
+ case 2:
+ aPnt = aRect.TopLeft();
+ eLocalKind = HDL_UPLFT;
+ break;
+ case 3:
+ aPnt = aRect.TopCenter();
+ eLocalKind = HDL_UPPER;
+ break;
+ case 4:
+ aPnt = aRect.TopRight();
+ eLocalKind = HDL_UPRGT;
+ break;
+ case 5:
+ aPnt = aRect.LeftCenter();
+ eLocalKind = HDL_LEFT;
+ break;
+ case 6:
+ aPnt = aRect.RightCenter();
+ eLocalKind = HDL_RIGHT;
+ break;
+ case 7:
+ aPnt = aRect.BottomLeft();
+ eLocalKind = HDL_LWLFT;
+ break;
+ case 8:
+ aPnt = aRect.BottomCenter();
+ eLocalKind = HDL_LOWER;
+ break;
+ case 9:
+ aPnt = aRect.BottomRight();
+ eLocalKind = HDL_LWRGT;
+ break;
+ }
+
+ if (aGeo.nShearWink)
+ {
+ ShearPoint(aPnt,aRect.TopLeft(),aGeo.nTan);
+ }
+
+ if (aGeo.nDrehWink)
+ {
+ RotatePoint(aPnt,aRect.TopLeft(),aGeo.nSin,aGeo.nCos);
+ }
+
+ if (eLocalKind != HDL_MOVE)
+ {
+ pH = new SdrHdl(aPnt,eLocalKind);
+ pH->SetPointNum(nPNum);
+ pH->SetObj((SdrObject*)this);
+ pH->SetDrehWink(aGeo.nDrehWink);
+ }
+
+ return pH;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+bool SdrCircObj::hasSpecialDrag() const
+{
+ return true;
+}
+
+bool SdrCircObj::beginSpecialDrag(SdrDragStat& rDrag) const
+{
+ const bool bWink(rDrag.GetHdl() && HDL_CIRC == rDrag.GetHdl()->GetKind());
+
+ if(bWink)
+ {
+ if(1 == rDrag.GetHdl()->GetPointNum() || 2 == rDrag.GetHdl()->GetPointNum())
+ {
+ rDrag.SetNoSnap(true);
+ }
+
+ return true;
+ }
+
+ return SdrTextObj::beginSpecialDrag(rDrag);
+}
+
+bool SdrCircObj::applySpecialDrag(SdrDragStat& rDrag)
+{
+ const bool bWink(rDrag.GetHdl() && HDL_CIRC == rDrag.GetHdl()->GetKind());
+
+ if(bWink)
+ {
+ Point aPt(rDrag.GetNow());
+
+ if (aGeo.nDrehWink!=0)
+ RotatePoint(aPt,aRect.TopLeft(),-aGeo.nSin,aGeo.nCos);
+
+ if (aGeo.nShearWink!=0)
+ ShearPoint(aPt,aRect.TopLeft(),-aGeo.nTan);
+
+ aPt-=aRect.Center();
+
+ long nWdt=aRect.Right()-aRect.Left();
+ long nHgt=aRect.Bottom()-aRect.Top();
+
+ if(nWdt>=nHgt)
+ {
+ aPt.Y()=BigMulDiv(aPt.Y(),nWdt,nHgt);
+ }
+ else
+ {
+ aPt.X()=BigMulDiv(aPt.X(),nHgt,nWdt);
+ }
+
+ long nWink=NormAngle360(GetAngle(aPt));
+
+ if (rDrag.GetView() && rDrag.GetView()->IsAngleSnapEnabled())
+ {
+ long nSA=rDrag.GetView()->GetSnapAngle();
+
+ if (nSA!=0)
+ {
+ nWink+=nSA/2;
+ nWink/=nSA;
+ nWink*=nSA;
+ nWink=NormAngle360(nWink);
+ }
+ }
+
+ if(1 == rDrag.GetHdl()->GetPointNum())
+ {
+ nStartWink = nWink;
+ }
+ else if(2 == rDrag.GetHdl()->GetPointNum())
+ {
+ nEndWink = nWink;
+ }
+
+ SetRectsDirty();
+ SetXPolyDirty();
+ ImpSetCircInfoToAttr();
+ SetChanged();
+
+ return true;
+ }
+ else
+ {
+ return SdrTextObj::applySpecialDrag(rDrag);
+ }
+}
+
+String SdrCircObj::getSpecialDragComment(const SdrDragStat& rDrag) const
+{
+ const bool bCreateComment(rDrag.GetView() && this == rDrag.GetView()->GetCreateObj());
+
+ if(bCreateComment)
+ {
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_ViewCreateObj, aStr);
+ const sal_uInt32 nPntAnz(rDrag.GetPointAnz());
+
+ if(OBJ_CIRC != meCircleKind && nPntAnz > 2)
+ {
+ ImpCircUser* pU = (ImpCircUser*)rDrag.GetUser();
+ sal_Int32 nWink;
+
+ aStr.AppendAscii(" (");
+
+ if(3 == nPntAnz)
+ {
+ nWink = pU->nStart;
+ }
+ else
+ {
+ nWink = pU->nEnd;
+ }
+
+ aStr += GetWinkStr(nWink,sal_False);
+ aStr += sal_Unicode(')');
+ }
+
+ return aStr;
+ }
+ else
+ {
+ const bool bWink(rDrag.GetHdl() && HDL_CIRC == rDrag.GetHdl()->GetKind());
+
+ if(bWink)
+ {
+ XubString aStr;
+ const sal_Int32 nWink(1 == rDrag.GetHdl()->GetPointNum() ? nStartWink : nEndWink);
+
+ ImpTakeDescriptionStr(STR_DragCircAngle, aStr);
+ aStr.AppendAscii(" (");
+ aStr += GetWinkStr(nWink,sal_False);
+ aStr += sal_Unicode(')');
+
+ return aStr;
+ }
+ else
+ {
+ return SdrTextObj::getSpecialDragComment(rDrag);
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void ImpCircUser::SetCreateParams(SdrDragStat& rStat)
+{
+ rStat.TakeCreateRect(aR);
+ aR.Justify();
+ aCenter=aR.Center();
+ nWdt=aR.Right()-aR.Left();
+ nHgt=aR.Bottom()-aR.Top();
+ nMaxRad=((nWdt>nHgt ? nWdt : nHgt)+1) /2;
+ nStart=0;
+ nEnd=36000;
+ if (rStat.GetPointAnz()>2) {
+ Point aP(rStat.GetPoint(2)-aCenter);
+ if (nWdt==0) aP.X()=0;
+ if (nHgt==0) aP.Y()=0;
+ if (nWdt>=nHgt) {
+ if (nHgt!=0) aP.Y()=aP.Y()*nWdt/nHgt;
+ } else {
+ if (nWdt!=0) aP.X()=aP.X()*nHgt/nWdt;
+ }
+ nStart=NormAngle360(GetAngle(aP));
+ if (rStat.GetView()!=NULL && rStat.GetView()->IsAngleSnapEnabled()) {
+ long nSA=rStat.GetView()->GetSnapAngle();
+ if (nSA!=0) { // Winkelfang
+ nStart+=nSA/2;
+ nStart/=nSA;
+ nStart*=nSA;
+ nStart=NormAngle360(nStart);
+ }
+ }
+ aP1 = GetWinkPnt(aR,nStart);
+ nEnd=nStart;
+ aP2=aP1;
+ } else aP1=aCenter;
+ if (rStat.GetPointAnz()>3) {
+ Point aP(rStat.GetPoint(3)-aCenter);
+ if (nWdt>=nHgt) {
+ aP.Y()=BigMulDiv(aP.Y(),nWdt,nHgt);
+ } else {
+ aP.X()=BigMulDiv(aP.X(),nHgt,nWdt);
+ }
+ nEnd=NormAngle360(GetAngle(aP));
+ if (rStat.GetView()!=NULL && rStat.GetView()->IsAngleSnapEnabled()) {
+ long nSA=rStat.GetView()->GetSnapAngle();
+ if (nSA!=0) { // Winkelfang
+ nEnd+=nSA/2;
+ nEnd/=nSA;
+ nEnd*=nSA;
+ nEnd=NormAngle360(nEnd);
+ }
+ }
+ aP2 = GetWinkPnt(aR,nEnd);
+ } else aP2=aCenter;
+}
+
+void SdrCircObj::ImpSetCreateParams(SdrDragStat& rStat) const
+{
+ ImpCircUser* pU=(ImpCircUser*)rStat.GetUser();
+ if (pU==NULL) {
+ pU=new ImpCircUser;
+ rStat.SetUser(pU);
+ }
+ pU->SetCreateParams(rStat);
+}
+
+FASTBOOL SdrCircObj::BegCreate(SdrDragStat& rStat)
+{
+ rStat.SetOrtho4Possible();
+ Rectangle aRect1(rStat.GetStart(), rStat.GetNow());
+ aRect1.Justify();
+ rStat.SetActionRect(aRect1);
+ aRect = aRect1;
+ ImpSetCreateParams(rStat);
+ return sal_True;
+}
+
+FASTBOOL SdrCircObj::MovCreate(SdrDragStat& rStat)
+{
+ ImpSetCreateParams(rStat);
+ ImpCircUser* pU=(ImpCircUser*)rStat.GetUser();
+ rStat.SetActionRect(pU->aR);
+ aRect=pU->aR; // fuer ObjName
+ ImpJustifyRect(aRect);
+ nStartWink=pU->nStart;
+ nEndWink=pU->nEnd;
+ SetBoundRectDirty();
+ bSnapRectDirty=sal_True;
+ SetXPolyDirty();
+
+ // #i103058# push current angle settings to ItemSet to
+ // allow FullDrag visualisation
+ if(rStat.GetPointAnz() >= 4)
+ {
+ ImpSetCircInfoToAttr();
+ }
+
+ return sal_True;
+}
+
+FASTBOOL SdrCircObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
+{
+ ImpSetCreateParams(rStat);
+ ImpCircUser* pU=(ImpCircUser*)rStat.GetUser();
+ FASTBOOL bRet=sal_False;
+ if (eCmd==SDRCREATE_FORCEEND && rStat.GetPointAnz()<4) meCircleKind=OBJ_CIRC;
+ if (meCircleKind==OBJ_CIRC) {
+ bRet=rStat.GetPointAnz()>=2;
+ if (bRet) {
+ aRect=pU->aR;
+ ImpJustifyRect(aRect);
+ }
+ } else {
+ rStat.SetNoSnap(rStat.GetPointAnz()>=2);
+ rStat.SetOrtho4Possible(rStat.GetPointAnz()<2);
+ bRet=rStat.GetPointAnz()>=4;
+ if (bRet) {
+ aRect=pU->aR;
+ ImpJustifyRect(aRect);
+ nStartWink=pU->nStart;
+ nEndWink=pU->nEnd;
+ }
+ }
+ bClosedObj=meCircleKind!=OBJ_CARC;
+ SetRectsDirty();
+ SetXPolyDirty();
+ ImpSetCircInfoToAttr();
+ if (bRet) {
+ delete pU;
+ rStat.SetUser(NULL);
+ }
+ return bRet;
+}
+
+void SdrCircObj::BrkCreate(SdrDragStat& rStat)
+{
+ ImpCircUser* pU=(ImpCircUser*)rStat.GetUser();
+ delete pU;
+ rStat.SetUser(NULL);
+}
+
+FASTBOOL SdrCircObj::BckCreate(SdrDragStat& rStat)
+{
+ rStat.SetNoSnap(rStat.GetPointAnz()>=3);
+ rStat.SetOrtho4Possible(rStat.GetPointAnz()<3);
+ return meCircleKind!=OBJ_CIRC;
+}
+
+basegfx::B2DPolyPolygon SdrCircObj::TakeCreatePoly(const SdrDragStat& rDrag) const
+{
+ ImpCircUser* pU = (ImpCircUser*)rDrag.GetUser();
+
+ if(rDrag.GetPointAnz() < 4L)
+ {
+ // force to OBJ_CIRC to get full visualisation
+ basegfx::B2DPolyPolygon aRetval(ImpCalcXPolyCirc(OBJ_CIRC, pU->aR, pU->nStart, pU->nEnd));
+
+ if(3L == rDrag.GetPointAnz())
+ {
+ // add edge to first point on ellipse
+ basegfx::B2DPolygon aNew;
+
+ aNew.append(basegfx::B2DPoint(pU->aCenter.X(), pU->aCenter.Y()));
+ aNew.append(basegfx::B2DPoint(pU->aP1.X(), pU->aP1.Y()));
+ aRetval.append(aNew);
+ }
+
+ return aRetval;
+ }
+ else
+ {
+ return basegfx::B2DPolyPolygon(ImpCalcXPolyCirc(meCircleKind, pU->aR, pU->nStart, pU->nEnd));
+ }
+}
+
+Pointer SdrCircObj::GetCreatePointer() const
+{
+ switch (meCircleKind) {
+ case OBJ_CIRC: return Pointer(POINTER_DRAW_ELLIPSE);
+ case OBJ_SECT: return Pointer(POINTER_DRAW_PIE);
+ case OBJ_CARC: return Pointer(POINTER_DRAW_ARC);
+ case OBJ_CCUT: return Pointer(POINTER_DRAW_CIRCLECUT);
+ default: break;
+ } // switch
+ return Pointer(POINTER_CROSS);
+}
+
+void SdrCircObj::NbcMove(const Size& aSiz)
+{
+ MoveRect(aRect,aSiz);
+ MoveRect(aOutRect,aSiz);
+ MoveRect(maSnapRect,aSiz);
+ SetXPolyDirty();
+ SetRectsDirty(sal_True);
+}
+
+void SdrCircObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+{
+ long nWink0=aGeo.nDrehWink;
+ FASTBOOL bNoShearRota=(aGeo.nDrehWink==0 && aGeo.nShearWink==0);
+ SdrTextObj::NbcResize(rRef,xFact,yFact);
+ bNoShearRota|=(aGeo.nDrehWink==0 && aGeo.nShearWink==0);
+ if (meCircleKind!=OBJ_CIRC) {
+ FASTBOOL bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
+ FASTBOOL bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
+ if (bXMirr || bYMirr) {
+ // bei bXMirr!=bYMirr muessten eigentlich noch die beiden
+ // Linienende vertauscht werden. Das ist jedoch mal wieder
+ // schlecht (wg. zwangslaeufiger harter Formatierung).
+ // Alternativ koennte ein bMirrored-Flag eingefuehrt werden
+ // (Vielleicht ja mal grundsaetzlich, auch fuer gepiegelten Text, ...).
+ long nS0=nStartWink;
+ long nE0=nEndWink;
+ if (bNoShearRota) {
+ // Das RectObj spiegelt bei VMirror bereits durch durch 180deg Drehung.
+ if (! (bXMirr && bYMirr)) {
+ long nTmp=nS0;
+ nS0=18000-nE0;
+ nE0=18000-nTmp;
+ }
+ } else { // Spiegeln fuer verzerrte Ellipsen
+ if (bXMirr!=bYMirr) {
+ nS0+=nWink0;
+ nE0+=nWink0;
+ if (bXMirr) {
+ long nTmp=nS0;
+ nS0=18000-nE0;
+ nE0=18000-nTmp;
+ }
+ if (bYMirr) {
+ long nTmp=nS0;
+ nS0=-nE0;
+ nE0=-nTmp;
+ }
+ nS0-=aGeo.nDrehWink;
+ nE0-=aGeo.nDrehWink;
+ }
+ }
+ long nWinkDif=nE0-nS0;
+ nStartWink=NormAngle360(nS0);
+ nEndWink =NormAngle360(nE0);
+ if (nWinkDif==36000) nEndWink+=nWinkDif; // Vollkreis
+ }
+ }
+ SetXPolyDirty();
+ ImpSetCircInfoToAttr();
+}
+
+void SdrCircObj::NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
+{
+ SdrTextObj::NbcShear(rRef,nWink,tn,bVShear);
+ SetXPolyDirty();
+ ImpSetCircInfoToAttr();
+}
+
+void SdrCircObj::NbcMirror(const Point& rRef1, const Point& rRef2)
+{
+ //long nWink0=aGeo.nDrehWink;
+ FASTBOOL bFreeMirr=meCircleKind!=OBJ_CIRC;
+ Point aTmpPt1;
+ Point aTmpPt2;
+ if (bFreeMirr) { // bei freier Spiegelachse einige Vorbereitungen Treffen
+ Point aCenter(aRect.Center());
+ long nWdt=aRect.GetWidth()-1;
+ long nHgt=aRect.GetHeight()-1;
+ long nMaxRad=((nWdt>nHgt ? nWdt : nHgt)+1) /2;
+ double a;
+ // Startpunkt
+ a=nStartWink*nPi180;
+ aTmpPt1=Point(Round(cos(a)*nMaxRad),-Round(sin(a)*nMaxRad));
+ if (nWdt==0) aTmpPt1.X()=0;
+ if (nHgt==0) aTmpPt1.Y()=0;
+ aTmpPt1+=aCenter;
+ // Endpunkt
+ a=nEndWink*nPi180;
+ aTmpPt2=Point(Round(cos(a)*nMaxRad),-Round(sin(a)*nMaxRad));
+ if (nWdt==0) aTmpPt2.X()=0;
+ if (nHgt==0) aTmpPt2.Y()=0;
+ aTmpPt2+=aCenter;
+ if (aGeo.nDrehWink!=0) {
+ RotatePoint(aTmpPt1,aRect.TopLeft(),aGeo.nSin,aGeo.nCos);
+ RotatePoint(aTmpPt2,aRect.TopLeft(),aGeo.nSin,aGeo.nCos);
+ }
+ if (aGeo.nShearWink!=0) {
+ ShearPoint(aTmpPt1,aRect.TopLeft(),aGeo.nTan);
+ ShearPoint(aTmpPt2,aRect.TopLeft(),aGeo.nTan);
+ }
+ }
+ SdrTextObj::NbcMirror(rRef1,rRef2);
+ if (meCircleKind!=OBJ_CIRC) { // Anpassung von Start- und Endwinkel
+ MirrorPoint(aTmpPt1,rRef1,rRef2);
+ MirrorPoint(aTmpPt2,rRef1,rRef2);
+ // Unrotate:
+ if (aGeo.nDrehWink!=0) {
+ RotatePoint(aTmpPt1,aRect.TopLeft(),-aGeo.nSin,aGeo.nCos); // -sin fuer Umkehrung
+ RotatePoint(aTmpPt2,aRect.TopLeft(),-aGeo.nSin,aGeo.nCos); // -sin fuer Umkehrung
+ }
+ // Unshear:
+ if (aGeo.nShearWink!=0) {
+ ShearPoint(aTmpPt1,aRect.TopLeft(),-aGeo.nTan); // -tan fuer Umkehrung
+ ShearPoint(aTmpPt2,aRect.TopLeft(),-aGeo.nTan); // -tan fuer Umkehrung
+ }
+ Point aCenter(aRect.Center());
+ aTmpPt1-=aCenter;
+ aTmpPt2-=aCenter;
+ // Weil gespiegelt sind die Winkel nun auch noch vertauscht
+ nStartWink=GetAngle(aTmpPt2);
+ nEndWink =GetAngle(aTmpPt1);
+ long nWinkDif=nEndWink-nStartWink;
+ nStartWink=NormAngle360(nStartWink);
+ nEndWink =NormAngle360(nEndWink);
+ if (nWinkDif==36000) nEndWink+=nWinkDif; // Vollkreis
+ }
+ SetXPolyDirty();
+ ImpSetCircInfoToAttr();
+}
+
+SdrObjGeoData* SdrCircObj::NewGeoData() const
+{
+ return new SdrCircObjGeoData;
+}
+
+void SdrCircObj::SaveGeoData(SdrObjGeoData& rGeo) const
+{
+ SdrRectObj::SaveGeoData(rGeo);
+ SdrCircObjGeoData& rCGeo=(SdrCircObjGeoData&)rGeo;
+ rCGeo.nStartWink=nStartWink;
+ rCGeo.nEndWink =nEndWink;
+}
+
+void SdrCircObj::RestGeoData(const SdrObjGeoData& rGeo)
+{
+ SdrRectObj::RestGeoData(rGeo);
+ SdrCircObjGeoData& rCGeo=(SdrCircObjGeoData&)rGeo;
+ nStartWink=rCGeo.nStartWink;
+ nEndWink =rCGeo.nEndWink;
+ SetXPolyDirty();
+ ImpSetCircInfoToAttr();
+}
+
+void Union(Rectangle& rR, const Point& rP)
+{
+ if (rP.X()<rR.Left ()) rR.Left ()=rP.X();
+ if (rP.X()>rR.Right ()) rR.Right ()=rP.X();
+ if (rP.Y()<rR.Top ()) rR.Top ()=rP.Y();
+ if (rP.Y()>rR.Bottom()) rR.Bottom()=rP.Y();
+}
+
+void SdrCircObj::TakeUnrotatedSnapRect(Rectangle& rRect) const
+{
+ rRect=aRect;
+ if (meCircleKind!=OBJ_CIRC) {
+ const Point aPntStart(GetWinkPnt(aRect,nStartWink));
+ const Point aPntEnd(GetWinkPnt(aRect,nEndWink));
+ long a=nStartWink;
+ long e=nEndWink;
+ rRect.Left ()=aRect.Right();
+ rRect.Right ()=aRect.Left();
+ rRect.Top ()=aRect.Bottom();
+ rRect.Bottom()=aRect.Top();
+ Union(rRect,aPntStart);
+ Union(rRect,aPntEnd);
+ if ((a<=18000 && e>=18000) || (a>e && (a<=18000 || e>=18000))) {
+ Union(rRect,aRect.LeftCenter());
+ }
+ if ((a<=27000 && e>=27000) || (a>e && (a<=27000 || e>=27000))) {
+ Union(rRect,aRect.BottomCenter());
+ }
+ if (a>e) {
+ Union(rRect,aRect.RightCenter());
+ }
+ if ((a<=9000 && e>=9000) || (a>e && (a<=9000 || e>=9000))) {
+ Union(rRect,aRect.TopCenter());
+ }
+ if (meCircleKind==OBJ_SECT) {
+ Union(rRect,aRect.Center());
+ }
+ if (aGeo.nDrehWink!=0) {
+ Point aDst(rRect.TopLeft());
+ aDst-=aRect.TopLeft();
+ Point aDst0(aDst);
+ RotatePoint(aDst,Point(),aGeo.nSin,aGeo.nCos);
+ aDst-=aDst0;
+ rRect.Move(aDst.X(),aDst.Y());
+ }
+ }
+ if (aGeo.nShearWink!=0) {
+ long nDst=Round((rRect.Bottom()-rRect.Top())*aGeo.nTan);
+ if (aGeo.nShearWink>0) {
+ Point aRef(rRect.TopLeft());
+ rRect.Left()-=nDst;
+ Point aTmpPt(rRect.TopLeft());
+ RotatePoint(aTmpPt,aRef,aGeo.nSin,aGeo.nCos);
+ aTmpPt-=rRect.TopLeft();
+ rRect.Move(aTmpPt.X(),aTmpPt.Y());
+ } else {
+ rRect.Right()-=nDst;
+ }
+ }
+}
+
+void SdrCircObj::RecalcSnapRect()
+{
+ if (PaintNeedsXPolyCirc()) {
+ maSnapRect=GetXPoly().GetBoundRect();
+ } else {
+ TakeUnrotatedSnapRect(maSnapRect);
+ }
+}
+
+void SdrCircObj::NbcSetSnapRect(const Rectangle& rRect)
+{
+ if (aGeo.nDrehWink!=0 || aGeo.nShearWink!=0 || meCircleKind!=OBJ_CIRC) {
+ Rectangle aSR0(GetSnapRect());
+ long nWdt0=aSR0.Right()-aSR0.Left();
+ long nHgt0=aSR0.Bottom()-aSR0.Top();
+ long nWdt1=rRect.Right()-rRect.Left();
+ long nHgt1=rRect.Bottom()-rRect.Top();
+ NbcResize(maSnapRect.TopLeft(),Fraction(nWdt1,nWdt0),Fraction(nHgt1,nHgt0));
+ NbcMove(Size(rRect.Left()-aSR0.Left(),rRect.Top()-aSR0.Top()));
+ } else {
+ aRect=rRect;
+ ImpJustifyRect(aRect);
+ }
+ SetRectsDirty();
+ SetXPolyDirty();
+ ImpSetCircInfoToAttr();
+}
+
+sal_uInt32 SdrCircObj::GetSnapPointCount() const
+{
+ if (meCircleKind==OBJ_CIRC) {
+ return 1L;
+ } else {
+ return 3L;
+ }
+}
+
+Point SdrCircObj::GetSnapPoint(sal_uInt32 i) const
+{
+ switch (i) {
+ case 1 : return GetWinkPnt(aRect,nStartWink);
+ case 2 : return GetWinkPnt(aRect,nEndWink);
+ default: return aRect.Center();
+ }
+}
+
+void __EXPORT SdrCircObj::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
+{
+ SetXPolyDirty();
+ SdrRectObj::Notify(rBC,rHint);
+ ImpSetAttrToCircInfo();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrCircObj::ImpSetAttrToCircInfo()
+{
+ const SfxItemSet& rSet = GetObjectItemSet();
+ SdrCircKind eNewKindA = ((SdrCircKindItem&)rSet.Get(SDRATTR_CIRCKIND)).GetValue();
+ SdrObjKind eNewKind = meCircleKind;
+
+ if(eNewKindA == SDRCIRC_FULL)
+ eNewKind = OBJ_CIRC;
+ else if(eNewKindA == SDRCIRC_SECT)
+ eNewKind = OBJ_SECT;
+ else if(eNewKindA == SDRCIRC_ARC)
+ eNewKind = OBJ_CARC;
+ else if(eNewKindA == SDRCIRC_CUT)
+ eNewKind = OBJ_CCUT;
+
+ sal_Int32 nNewStart = ((SdrCircStartAngleItem&)rSet.Get(SDRATTR_CIRCSTARTANGLE)).GetValue();
+ sal_Int32 nNewEnd = ((SdrCircEndAngleItem&)rSet.Get(SDRATTR_CIRCENDANGLE)).GetValue();
+
+ sal_Bool bKindChg = meCircleKind != eNewKind;
+ sal_Bool bWinkChg = nNewStart != nStartWink || nNewEnd != nEndWink;
+
+ if(bKindChg || bWinkChg)
+ {
+ meCircleKind = eNewKind;
+ nStartWink = nNewStart;
+ nEndWink = nNewEnd;
+
+ if(bKindChg || (meCircleKind != OBJ_CIRC && bWinkChg))
+ {
+ SetXPolyDirty();
+ SetRectsDirty();
+ }
+ }
+}
+
+void SdrCircObj::ImpSetCircInfoToAttr()
+{
+ SdrCircKind eNewKindA = SDRCIRC_FULL;
+ const SfxItemSet& rSet = GetObjectItemSet();
+
+ if(meCircleKind == OBJ_SECT)
+ eNewKindA = SDRCIRC_SECT;
+ else if(meCircleKind == OBJ_CARC)
+ eNewKindA = SDRCIRC_ARC;
+ else if(meCircleKind == OBJ_CCUT)
+ eNewKindA = SDRCIRC_CUT;
+
+ SdrCircKind eOldKindA = ((SdrCircKindItem&)rSet.Get(SDRATTR_CIRCKIND)).GetValue();
+ sal_Int32 nOldStartWink = ((SdrCircStartAngleItem&)rSet.Get(SDRATTR_CIRCSTARTANGLE)).GetValue();
+ sal_Int32 nOldEndWink = ((SdrCircEndAngleItem&)rSet.Get(SDRATTR_CIRCENDANGLE)).GetValue();
+
+ if(eNewKindA != eOldKindA || nStartWink != nOldStartWink || nEndWink != nOldEndWink)
+ {
+ // #81921# since SetItem() implicitly calls ImpSetAttrToCircInfo()
+ // setting the item directly is necessary here.
+ if(eNewKindA != eOldKindA)
+ {
+ GetProperties().SetObjectItemDirect(SdrCircKindItem(eNewKindA));
+ }
+
+ if(nStartWink != nOldStartWink)
+ {
+ GetProperties().SetObjectItemDirect(SdrCircStartAngleItem(nStartWink));
+ }
+
+ if(nEndWink != nOldEndWink)
+ {
+ GetProperties().SetObjectItemDirect(SdrCircEndAngleItem(nEndWink));
+ }
+
+ SetXPolyDirty();
+ ImpSetAttrToCircInfo();
+ }
+}
+
+SdrObject* SdrCircObj::DoConvertToPolyObj(sal_Bool bBezier) const
+{
+ const sal_Bool bFill(OBJ_CARC == meCircleKind ? sal_False : sal_True);
+ const basegfx::B2DPolygon aCircPolygon(ImpCalcXPolyCirc(meCircleKind, aRect, nStartWink, nEndWink));
+ SdrObject* pRet = ImpConvertMakeObj(basegfx::B2DPolyPolygon(aCircPolygon), bFill, bBezier);
+ pRet = ImpConvertAddText(pRet, bBezier);
+
+ return pRet;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx
new file mode 100644
index 000000000000..6eec6e855bf9
--- /dev/null
+++ b/svx/source/svdraw/svdoedge.cxx
@@ -0,0 +1,2497 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svdoedge.hxx>
+#include <svx/xpool.hxx>
+#include <svx/xpoly.hxx>
+#include <svx/svdattrx.hxx>
+#include <svx/svdpool.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svddrag.hxx>
+#include <svx/svddrgv.hxx>
+#include "svddrgm1.hxx"
+#include <svx/svdhdl.hxx>
+#include <svx/svdtrans.hxx>
+#include <svx/svdetc.hxx>
+#include "svx/svdglob.hxx" // StringCache
+#include "svx/svdstr.hrc" // Objektname
+#include <svl/style.hxx>
+#include <svl/smplhint.hxx>
+#include <editeng/eeitem.hxx>
+#include "svdoimp.hxx"
+#include <svx/sdr/properties/connectorproperties.hxx>
+#include <svx/sdr/contact/viewcontactofsdredgeobj.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdrhittesthelper.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrObjConnection::~SdrObjConnection()
+{
+}
+
+void SdrObjConnection::ResetVars()
+{
+ pObj=NULL;
+ nConId=0;
+ nXDist=0;
+ nYDist=0;
+ bBestConn=sal_True;
+ bBestVertex=sal_True;
+ bXDistOvr=sal_False;
+ bYDistOvr=sal_False;
+ bAutoVertex=sal_False;
+ bAutoCorner=sal_False;
+}
+
+FASTBOOL SdrObjConnection::TakeGluePoint(SdrGluePoint& rGP, FASTBOOL bSetAbsPos) const
+{
+ FASTBOOL bRet=sal_False;
+ if (pObj!=NULL) { // Ein Obj muss schon angedockt sein!
+ if (bAutoVertex) {
+ rGP=pObj->GetVertexGluePoint(nConId);
+ bRet=sal_True;
+ } else if (bAutoCorner) {
+ rGP=pObj->GetCornerGluePoint(nConId);
+ bRet=sal_True;
+ } else {
+ const SdrGluePointList* pGPL=pObj->GetGluePointList();
+ if (pGPL!=NULL) {
+ sal_uInt16 nNum=pGPL->FindGluePoint(nConId);
+ if (nNum!=SDRGLUEPOINT_NOTFOUND) {
+ rGP=(*pGPL)[nNum];
+ bRet=sal_True;
+ }
+ }
+ }
+ }
+ if (bRet && bSetAbsPos) {
+ Point aPt(rGP.GetAbsolutePos(*pObj));
+ aPt+=aObjOfs;
+ rGP.SetPos(aPt);
+ }
+ return bRet;
+}
+
+Point& SdrEdgeInfoRec::ImpGetLineVersatzPoint(SdrEdgeLineCode eLineCode)
+{
+ switch (eLineCode) {
+ case OBJ1LINE2 : return aObj1Line2;
+ case OBJ1LINE3 : return aObj1Line3;
+ case OBJ2LINE2 : return aObj2Line2;
+ case OBJ2LINE3 : return aObj2Line3;
+ case MIDDLELINE: return aMiddleLine;
+ } // switch
+ return aMiddleLine;
+}
+
+sal_uInt16 SdrEdgeInfoRec::ImpGetPolyIdx(SdrEdgeLineCode eLineCode, const XPolygon& rXP) const
+{
+ switch (eLineCode) {
+ case OBJ1LINE2 : return 1;
+ case OBJ1LINE3 : return 2;
+ case OBJ2LINE2 : return rXP.GetPointCount()-3;
+ case OBJ2LINE3 : return rXP.GetPointCount()-4;
+ case MIDDLELINE: return nMiddleLine;
+ } // switch
+ return 0;
+}
+
+FASTBOOL SdrEdgeInfoRec::ImpIsHorzLine(SdrEdgeLineCode eLineCode, const XPolygon& rXP) const
+{
+ sal_uInt16 nIdx=ImpGetPolyIdx(eLineCode,rXP);
+ FASTBOOL bHorz=nAngle1==0 || nAngle1==18000;
+ if (eLineCode==OBJ2LINE2 || eLineCode==OBJ2LINE3) {
+ nIdx=rXP.GetPointCount()-nIdx; // #36314#
+ bHorz=nAngle2==0 || nAngle2==18000; // #52000#
+ }
+ if ((nIdx & 1)==1) bHorz=!bHorz;
+ return bHorz;
+}
+
+void SdrEdgeInfoRec::ImpSetLineVersatz(SdrEdgeLineCode eLineCode, const XPolygon& rXP, long nVal)
+{
+ Point& rPt=ImpGetLineVersatzPoint(eLineCode);
+ if (ImpIsHorzLine(eLineCode,rXP)) rPt.Y()=nVal;
+ else rPt.X()=nVal;
+}
+
+long SdrEdgeInfoRec::ImpGetLineVersatz(SdrEdgeLineCode eLineCode, const XPolygon& rXP) const
+{
+ const Point& rPt=ImpGetLineVersatzPoint(eLineCode);
+ if (ImpIsHorzLine(eLineCode,rXP)) return rPt.Y();
+ else return rPt.X();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// BaseProperties section
+
+sdr::properties::BaseProperties* SdrEdgeObj::CreateObjectSpecificProperties()
+{
+ return new sdr::properties::ConnectorProperties(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// DrawContact section
+
+sdr::contact::ViewContact* SdrEdgeObj::CreateObjectSpecificViewContact()
+{
+ return new sdr::contact::ViewContactOfSdrEdgeObj(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(SdrEdgeObj,SdrTextObj);
+
+SdrEdgeObj::SdrEdgeObj()
+: SdrTextObj(),
+ nNotifyingCount(0),
+ bEdgeTrackDirty(sal_False),
+ bEdgeTrackUserDefined(sal_False),
+ // #109007# Default is to allow default connects
+ mbSuppressDefaultConnect(sal_False),
+ // #110649#
+ mbBoundRectCalculationRunning(sal_False)
+{
+ bClosedObj=sal_False;
+ bIsEdge=sal_True;
+ pEdgeTrack=new XPolygon;
+
+}
+
+SdrEdgeObj::~SdrEdgeObj()
+{
+ DisconnectFromNode(sal_True);
+ DisconnectFromNode(sal_False);
+ delete pEdgeTrack;
+}
+
+void SdrEdgeObj::ImpSetAttrToEdgeInfo()
+{
+ const SfxItemSet& rSet = GetObjectItemSet();
+ SdrEdgeKind eKind = ((SdrEdgeKindItem&)(rSet.Get(SDRATTR_EDGEKIND))).GetValue();
+ sal_Int32 nVal1 = ((SdrEdgeLine1DeltaItem&)rSet.Get(SDRATTR_EDGELINE1DELTA)).GetValue();
+ sal_Int32 nVal2 = ((SdrEdgeLine2DeltaItem&)rSet.Get(SDRATTR_EDGELINE2DELTA)).GetValue();
+ sal_Int32 nVal3 = ((SdrEdgeLine3DeltaItem&)rSet.Get(SDRATTR_EDGELINE3DELTA)).GetValue();
+
+ if(eKind == SDREDGE_ORTHOLINES || eKind == SDREDGE_BEZIER)
+ {
+ sal_Int32 nVals[3] = { nVal1, nVal2, nVal3 };
+ sal_uInt16 n = 0;
+
+ if(aEdgeInfo.nObj1Lines >= 2 && n < 3)
+ {
+ aEdgeInfo.ImpSetLineVersatz(OBJ1LINE2, *pEdgeTrack, nVals[n]);
+ n++;
+ }
+
+ if(aEdgeInfo.nObj1Lines >= 3 && n < 3)
+ {
+ aEdgeInfo.ImpSetLineVersatz(OBJ1LINE3, *pEdgeTrack, nVals[n]);
+ n++;
+ }
+
+ if(aEdgeInfo.nMiddleLine != 0xFFFF && n < 3)
+ {
+ aEdgeInfo.ImpSetLineVersatz(MIDDLELINE, *pEdgeTrack, nVals[n]);
+ n++;
+ }
+
+ if(aEdgeInfo.nObj2Lines >= 3 && n < 3)
+ {
+ aEdgeInfo.ImpSetLineVersatz(OBJ2LINE3, *pEdgeTrack, nVals[n]);
+ n++;
+ }
+
+ if(aEdgeInfo.nObj2Lines >= 2 && n < 3)
+ {
+ aEdgeInfo.ImpSetLineVersatz(OBJ2LINE2, *pEdgeTrack, nVals[n]);
+ n++;
+ }
+ }
+ else if(eKind == SDREDGE_THREELINES)
+ {
+ sal_Bool bHor1 = aEdgeInfo.nAngle1 == 0 || aEdgeInfo.nAngle1 == 18000;
+ sal_Bool bHor2 = aEdgeInfo.nAngle2 == 0 || aEdgeInfo.nAngle2 == 18000;
+
+ if(bHor1)
+ {
+ aEdgeInfo.aObj1Line2.X() = nVal1;
+ }
+ else
+ {
+ aEdgeInfo.aObj1Line2.Y() = nVal1;
+ }
+
+ if(bHor2)
+ {
+ aEdgeInfo.aObj2Line2.X() = nVal2;
+ }
+ else
+ {
+ aEdgeInfo.aObj2Line2.Y() = nVal2;
+ }
+ }
+
+ // #84649#
+ ImpDirtyEdgeTrack();
+}
+
+void SdrEdgeObj::ImpSetEdgeInfoToAttr()
+{
+ const SfxItemSet& rSet = GetObjectItemSet();
+ SdrEdgeKind eKind = ((SdrEdgeKindItem&)(rSet.Get(SDRATTR_EDGEKIND))).GetValue();
+ sal_Int32 nValAnz = ((SdrEdgeLineDeltaAnzItem&)rSet.Get(SDRATTR_EDGELINEDELTAANZ)).GetValue();
+ sal_Int32 nVal1 = ((SdrEdgeLine1DeltaItem&)rSet.Get(SDRATTR_EDGELINE1DELTA)).GetValue();
+ sal_Int32 nVal2 = ((SdrEdgeLine2DeltaItem&)rSet.Get(SDRATTR_EDGELINE2DELTA)).GetValue();
+ sal_Int32 nVal3 = ((SdrEdgeLine3DeltaItem&)rSet.Get(SDRATTR_EDGELINE3DELTA)).GetValue();
+ sal_Int32 nVals[3] = { nVal1, nVal2, nVal3 };
+ sal_uInt16 n = 0;
+
+ if(eKind == SDREDGE_ORTHOLINES || eKind == SDREDGE_BEZIER)
+ {
+ if(aEdgeInfo.nObj1Lines >= 2 && n < 3)
+ {
+ nVals[n] = aEdgeInfo.ImpGetLineVersatz(OBJ1LINE2, *pEdgeTrack);
+ n++;
+ }
+
+ if(aEdgeInfo.nObj1Lines >= 3 && n < 3)
+ {
+ nVals[n] = aEdgeInfo.ImpGetLineVersatz(OBJ1LINE3, *pEdgeTrack);
+ n++;
+ }
+
+ if(aEdgeInfo.nMiddleLine != 0xFFFF && n < 3)
+ {
+ nVals[n] = aEdgeInfo.ImpGetLineVersatz(MIDDLELINE, *pEdgeTrack);
+ n++;
+ }
+
+ if(aEdgeInfo.nObj2Lines >= 3 && n < 3)
+ {
+ nVals[n] = aEdgeInfo.ImpGetLineVersatz(OBJ2LINE3, *pEdgeTrack);
+ n++;
+ }
+
+ if(aEdgeInfo.nObj2Lines >= 2 && n < 3)
+ {
+ nVals[n] = aEdgeInfo.ImpGetLineVersatz(OBJ2LINE2, *pEdgeTrack);
+ n++;
+ }
+ }
+ else if(eKind == SDREDGE_THREELINES)
+ {
+ sal_Bool bHor1 = aEdgeInfo.nAngle1 == 0 || aEdgeInfo.nAngle1 == 18000;
+ sal_Bool bHor2 = aEdgeInfo.nAngle2 == 0 || aEdgeInfo.nAngle2 == 18000;
+
+ n = 2;
+ nVals[0] = bHor1 ? aEdgeInfo.aObj1Line2.X() : aEdgeInfo.aObj1Line2.Y();
+ nVals[1] = bHor2 ? aEdgeInfo.aObj2Line2.X() : aEdgeInfo.aObj2Line2.Y();
+ }
+
+ if(n != nValAnz || nVals[0] != nVal1 || nVals[1] != nVal2 || nVals[2] != nVal3)
+ {
+ // #75371# Here no more notifying is necessary, just local changes are OK.
+ if(n != nValAnz)
+ {
+ GetProperties().SetObjectItemDirect(SdrEdgeLineDeltaAnzItem(n));
+ }
+
+ if(nVals[0] != nVal1)
+ {
+ GetProperties().SetObjectItemDirect(SdrEdgeLine1DeltaItem(nVals[0]));
+ }
+
+ if(nVals[1] != nVal2)
+ {
+ GetProperties().SetObjectItemDirect(SdrEdgeLine2DeltaItem(nVals[1]));
+ }
+
+ if(nVals[2] != nVal3)
+ {
+ GetProperties().SetObjectItemDirect(SdrEdgeLine3DeltaItem(nVals[2]));
+ }
+
+ if(n < 3)
+ {
+ GetProperties().ClearObjectItemDirect(SDRATTR_EDGELINE3DELTA);
+ }
+
+ if(n < 2)
+ {
+ GetProperties().ClearObjectItemDirect(SDRATTR_EDGELINE2DELTA);
+ }
+
+ if(n < 1)
+ {
+ GetProperties().ClearObjectItemDirect(SDRATTR_EDGELINE1DELTA);
+ }
+ }
+}
+
+void SdrEdgeObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
+{
+ rInfo.bRotateFreeAllowed=sal_False;
+ rInfo.bRotate90Allowed =sal_False;
+ rInfo.bMirrorFreeAllowed=sal_False;
+ rInfo.bMirror45Allowed =sal_False;
+ rInfo.bMirror90Allowed =sal_False;
+ rInfo.bTransparenceAllowed = sal_False;
+ rInfo.bGradientAllowed = sal_False;
+ rInfo.bShearAllowed =sal_False;
+ rInfo.bEdgeRadiusAllowed=sal_False;
+ FASTBOOL bCanConv=!HasText() || ImpCanConvTextToCurve();
+ rInfo.bCanConvToPath=bCanConv;
+ rInfo.bCanConvToPoly=bCanConv;
+ rInfo.bCanConvToContour = (rInfo.bCanConvToPoly || LineGeometryUsageIsNecessary());
+}
+
+sal_uInt16 SdrEdgeObj::GetObjIdentifier() const
+{
+ return sal_uInt16(OBJ_EDGE);
+}
+
+const Rectangle& SdrEdgeObj::GetCurrentBoundRect() const
+{
+ if(bEdgeTrackDirty)
+ {
+ ((SdrEdgeObj*)this)->ImpRecalcEdgeTrack();
+ }
+
+ return SdrTextObj::GetCurrentBoundRect();
+}
+
+const Rectangle& SdrEdgeObj::GetSnapRect() const
+{
+ if(bEdgeTrackDirty)
+ {
+ ((SdrEdgeObj*)this)->ImpRecalcEdgeTrack();
+ }
+
+ return SdrTextObj::GetSnapRect();
+}
+
+void SdrEdgeObj::RecalcSnapRect()
+{
+ maSnapRect=pEdgeTrack->GetBoundRect();
+}
+
+void SdrEdgeObj::TakeUnrotatedSnapRect(Rectangle& rRect) const
+{
+ rRect=GetSnapRect();
+}
+
+FASTBOOL SdrEdgeObj::IsNode() const
+{
+ return sal_True;
+}
+
+SdrGluePoint SdrEdgeObj::GetVertexGluePoint(sal_uInt16 nNum) const
+{
+ Point aPt;
+ sal_uInt16 nPntAnz=pEdgeTrack->GetPointCount();
+ if (nPntAnz>0)
+ {
+ Point aOfs = GetSnapRect().Center();
+ if (nNum==2 && GetConnectedNode(sal_True)==NULL) aPt=(*pEdgeTrack)[0];
+ else if (nNum==3 && GetConnectedNode(sal_False)==NULL) aPt=(*pEdgeTrack)[nPntAnz-1];
+ else {
+ if ((nPntAnz & 1) ==1) {
+ aPt=(*pEdgeTrack)[nPntAnz/2];
+ } else {
+ Point aPt1((*pEdgeTrack)[nPntAnz/2-1]);
+ Point aPt2((*pEdgeTrack)[nPntAnz/2]);
+ aPt1+=aPt2;
+ aPt1.X()/=2;
+ aPt1.Y()/=2;
+ aPt=aPt1;
+ }
+ }
+ aPt-=aOfs;
+ }
+ SdrGluePoint aGP(aPt);
+ aGP.SetPercent(sal_False);
+ return aGP;
+}
+
+SdrGluePoint SdrEdgeObj::GetCornerGluePoint(sal_uInt16 nNum) const
+{
+ return GetVertexGluePoint(nNum);
+}
+
+const SdrGluePointList* SdrEdgeObj::GetGluePointList() const
+{
+ return NULL; // Keine benutzerdefinierten Klebepunkte fuer Verbinder #31671#
+}
+
+SdrGluePointList* SdrEdgeObj::ForceGluePointList()
+{
+ return NULL; // Keine benutzerdefinierten Klebepunkte fuer Verbinder #31671#
+}
+
+FASTBOOL SdrEdgeObj::IsEdge() const
+{
+ return sal_True;
+}
+
+void SdrEdgeObj::ConnectToNode(FASTBOOL bTail1, SdrObject* pObj)
+{
+ SdrObjConnection& rCon=GetConnection(bTail1);
+ DisconnectFromNode(bTail1);
+ if (pObj!=NULL) {
+ pObj->AddListener(*this);
+ rCon.pObj=pObj;
+ ImpDirtyEdgeTrack();
+ }
+}
+
+void SdrEdgeObj::DisconnectFromNode(FASTBOOL bTail1)
+{
+ SdrObjConnection& rCon=GetConnection(bTail1);
+ if (rCon.pObj!=NULL) {
+ rCon.pObj->RemoveListener(*this);
+ rCon.pObj=NULL;
+ }
+}
+
+SdrObject* SdrEdgeObj::GetConnectedNode(FASTBOOL bTail1) const
+{
+ SdrObject* pObj=GetConnection(bTail1).pObj;
+ if (pObj!=NULL && (pObj->GetPage()!=pPage || !pObj->IsInserted())) pObj=NULL;
+ return pObj;
+}
+
+FASTBOOL SdrEdgeObj::CheckNodeConnection(FASTBOOL bTail1) const
+{
+ FASTBOOL bRet=sal_False;
+ const SdrObjConnection& rCon=GetConnection(bTail1);
+ sal_uInt16 nPtAnz=pEdgeTrack->GetPointCount();
+ if (rCon.pObj!=NULL && rCon.pObj->GetPage()==pPage && nPtAnz!=0) {
+ const SdrGluePointList* pGPL=rCon.pObj->GetGluePointList();
+ sal_uInt16 nConAnz=pGPL==NULL ? 0 : pGPL->GetCount();
+ sal_uInt16 nGesAnz=nConAnz+8;
+ Point aTail(bTail1 ? (*pEdgeTrack)[0] : (*pEdgeTrack)[sal_uInt16(nPtAnz-1)]);
+ for (sal_uInt16 i=0; i<nGesAnz && !bRet; i++) {
+ if (i<nConAnz) { // UserDefined
+ bRet=aTail==(*pGPL)[i].GetAbsolutePos(*rCon.pObj);
+ } else if (i<nConAnz+4) { // Vertex
+ SdrGluePoint aPt(rCon.pObj->GetVertexGluePoint(i-nConAnz));
+ bRet=aTail==aPt.GetAbsolutePos(*rCon.pObj);
+ } else { // Corner
+ SdrGluePoint aPt(rCon.pObj->GetCornerGluePoint(i-nConAnz-4));
+ bRet=aTail==aPt.GetAbsolutePos(*rCon.pObj);
+ }
+ }
+ }
+ return bRet;
+}
+
+void SdrEdgeObj::ImpSetTailPoint(FASTBOOL bTail1, const Point& rPt)
+{
+ sal_uInt16 nPtAnz=pEdgeTrack->GetPointCount();
+ if (nPtAnz==0) {
+ (*pEdgeTrack)[0]=rPt;
+ (*pEdgeTrack)[1]=rPt;
+ } else if (nPtAnz==1) {
+ if (!bTail1) (*pEdgeTrack)[1]=rPt;
+ else { (*pEdgeTrack)[1]=(*pEdgeTrack)[0]; (*pEdgeTrack)[0]=rPt; }
+ } else {
+ if (!bTail1) (*pEdgeTrack)[sal_uInt16(nPtAnz-1)]=rPt;
+ else (*pEdgeTrack)[0]=rPt;
+ }
+ ImpRecalcEdgeTrack();
+ SetRectsDirty();
+}
+
+void SdrEdgeObj::ImpDirtyEdgeTrack()
+{
+ if ( !bEdgeTrackUserDefined || !(GetModel() && GetModel()->isLocked()) )
+ bEdgeTrackDirty = sal_True;
+}
+
+void SdrEdgeObj::ImpUndirtyEdgeTrack()
+{
+ if (bEdgeTrackDirty && (GetModel() && GetModel()->isLocked()) ) {
+ ImpRecalcEdgeTrack();
+ }
+}
+
+void SdrEdgeObj::ImpRecalcEdgeTrack()
+{
+ if ( bEdgeTrackUserDefined && (GetModel() && GetModel()->isLocked()) )
+ return;
+
+ // #110649#
+ if(IsBoundRectCalculationRunning())
+ {
+ // this object is involved into another ImpRecalcEdgeTrack() call
+ // from another SdrEdgeObj. Do not calculate again to avoid loop.
+ // Also, do not change bEdgeTrackDirty so that it gets recalculated
+ // later at the first non-looping call.
+ }
+ // #i43068#
+ else if(GetModel() && GetModel()->isLocked())
+ {
+ // avoid re-layout during imports/API call sequences
+ // #i45294# but calc EdgeTrack and secure properties there
+ ((SdrEdgeObj*)this)->mbBoundRectCalculationRunning = sal_True;
+ *pEdgeTrack=ImpCalcEdgeTrack(*pEdgeTrack,aCon1,aCon2,&aEdgeInfo);
+ ImpSetAttrToEdgeInfo();
+ bEdgeTrackDirty=sal_False;
+ ((SdrEdgeObj*)this)->mbBoundRectCalculationRunning = sal_False;
+ }
+ else
+ {
+ // To not run in a depth loop, use a coloring algorythm on
+ // SdrEdgeObj BoundRect calculations
+ ((SdrEdgeObj*)this)->mbBoundRectCalculationRunning = sal_True;
+
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ SetRectsDirty();
+ // #110094#-14 if (!bEdgeTrackDirty) SendRepaintBroadcast();
+ *pEdgeTrack=ImpCalcEdgeTrack(*pEdgeTrack,aCon1,aCon2,&aEdgeInfo);
+ ImpSetEdgeInfoToAttr(); // Die Werte aus aEdgeInfo in den Pool kopieren
+ bEdgeTrackDirty=sal_False;
+
+ // Only redraw here, no object change
+ ActionChanged();
+ // BroadcastObjectChange();
+
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+
+ // #110649#
+ ((SdrEdgeObj*)this)->mbBoundRectCalculationRunning = sal_False;
+ }
+}
+
+sal_uInt16 SdrEdgeObj::ImpCalcEscAngle(SdrObject* pObj, const Point& rPt) const
+{
+ if (pObj==NULL) return SDRESC_ALL;
+ Rectangle aR(pObj->GetSnapRect());
+ long dxl=rPt.X()-aR.Left();
+ long dyo=rPt.Y()-aR.Top();
+ long dxr=aR.Right()-rPt.X();
+ long dyu=aR.Bottom()-rPt.Y();
+ FASTBOOL bxMitt=Abs(dxl-dxr)<2;
+ FASTBOOL byMitt=Abs(dyo-dyu)<2;
+ long dx=Min(dxl,dxr);
+ long dy=Min(dyo,dyu);
+ FASTBOOL bDiag=Abs(dx-dy)<2;
+ if (bxMitt && byMitt) return SDRESC_ALL; // In der Mitte
+ if (bDiag) { // diagonal
+ sal_uInt16 nRet=0;
+ if (byMitt) nRet|=SDRESC_VERT;
+ if (bxMitt) nRet|=SDRESC_HORZ;
+ if (dxl<dxr) { // Links
+ if (dyo<dyu) nRet|=SDRESC_LEFT | SDRESC_TOP;
+ else nRet|=SDRESC_LEFT | SDRESC_BOTTOM;
+ } else { // Rechts
+ if (dyo<dyu) nRet|=SDRESC_RIGHT | SDRESC_TOP;
+ else nRet|=SDRESC_RIGHT | SDRESC_BOTTOM;
+ }
+ return nRet;
+ }
+ if (dx<dy) { // waagerecht
+ if (bxMitt) return SDRESC_HORZ;
+ if (dxl<dxr) return SDRESC_LEFT;
+ else return SDRESC_RIGHT;
+ } else { // senkrecht
+ if (byMitt) return SDRESC_VERT;
+ if (dyo<dyu) return SDRESC_TOP;
+ else return SDRESC_BOTTOM;
+ }
+}
+
+FASTBOOL SdrEdgeObj::ImpStripPolyPoints(XPolygon& /*rXP*/) const
+{
+ // fehlende Implementation !!!
+ return sal_False;
+}
+
+XPolygon SdrEdgeObj::ImpCalcObjToCenter(const Point& rStPt, long nEscAngle, const Rectangle& rRect, const Point& rMeeting) const
+{
+ XPolygon aXP;
+ aXP.Insert(XPOLY_APPEND,rStPt,XPOLY_NORMAL);
+ FASTBOOL bRts=nEscAngle==0;
+ FASTBOOL bObn=nEscAngle==9000;
+ FASTBOOL bLks=nEscAngle==18000;
+ FASTBOOL bUnt=nEscAngle==27000;
+
+ Point aP1(rStPt); // erstmal den Pflichtabstand
+ if (bLks) aP1.X()=rRect.Left();
+ if (bRts) aP1.X()=rRect.Right();
+ if (bObn) aP1.Y()=rRect.Top();
+ if (bUnt) aP1.Y()=rRect.Bottom();
+
+ FASTBOOL bFinish=sal_False;
+ if (!bFinish) {
+ Point aP2(aP1); // Und nun den Pflichtabstand ggf. bis auf Meetinghoehe erweitern
+ if (bLks && rMeeting.X()<=aP2.X()) aP2.X()=rMeeting.X();
+ if (bRts && rMeeting.X()>=aP2.X()) aP2.X()=rMeeting.X();
+ if (bObn && rMeeting.Y()<=aP2.Y()) aP2.Y()=rMeeting.Y();
+ if (bUnt && rMeeting.Y()>=aP2.Y()) aP2.Y()=rMeeting.Y();
+ aXP.Insert(XPOLY_APPEND,aP2,XPOLY_NORMAL);
+
+ Point aP3(aP2);
+ if ((bLks && rMeeting.X()>aP2.X()) || (bRts && rMeeting.X()<aP2.X())) { // Aussenrum
+ if (rMeeting.Y()<aP2.Y()) {
+ aP3.Y()=rRect.Top();
+ if (rMeeting.Y()<aP3.Y()) aP3.Y()=rMeeting.Y();
+ } else {
+ aP3.Y()=rRect.Bottom();
+ if (rMeeting.Y()>aP3.Y()) aP3.Y()=rMeeting.Y();
+ }
+ aXP.Insert(XPOLY_APPEND,aP3,XPOLY_NORMAL);
+ if (aP3.Y()!=rMeeting.Y()) {
+ aP3.X()=rMeeting.X();
+ aXP.Insert(XPOLY_APPEND,aP3,XPOLY_NORMAL);
+ }
+ }
+ if ((bObn && rMeeting.Y()>aP2.Y()) || (bUnt && rMeeting.Y()<aP2.Y())) { // Aussenrum
+ if (rMeeting.X()<aP2.X()) {
+ aP3.X()=rRect.Left();
+ if (rMeeting.X()<aP3.X()) aP3.X()=rMeeting.X();
+ } else {
+ aP3.X()=rRect.Right();
+ if (rMeeting.X()>aP3.X()) aP3.X()=rMeeting.X();
+ }
+ aXP.Insert(XPOLY_APPEND,aP3,XPOLY_NORMAL);
+ if (aP3.X()!=rMeeting.X()) {
+ aP3.Y()=rMeeting.Y();
+ aXP.Insert(XPOLY_APPEND,aP3,XPOLY_NORMAL);
+ }
+ }
+ }
+#ifdef DBG_UTIL
+ if (aXP.GetPointCount()>4) {
+ DBG_ERROR("SdrEdgeObj::ImpCalcObjToCenter(): Polygon hat mehr als 4 Punkte!");
+ }
+#endif
+ return aXP;
+}
+
+XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const XPolygon& rTrack0, SdrObjConnection& rCon1, SdrObjConnection& rCon2, SdrEdgeInfoRec* pInfo) const
+{
+ Point aPt1,aPt2;
+ SdrGluePoint aGP1,aGP2;
+ sal_uInt16 nEsc1=SDRESC_ALL,nEsc2=SDRESC_ALL;
+ Rectangle aBoundRect1;
+ Rectangle aBoundRect2;
+ Rectangle aBewareRect1;
+ Rectangle aBewareRect2;
+ // Erstmal die alten Endpunkte wiederholen
+ if (rTrack0.GetPointCount()!=0) {
+ aPt1=rTrack0[0];
+ sal_uInt16 nSiz=rTrack0.GetPointCount();
+ nSiz--;
+ aPt2=rTrack0[nSiz];
+ } else {
+ if (!aOutRect.IsEmpty()) {
+ aPt1=aOutRect.TopLeft();
+ aPt2=aOutRect.BottomRight();
+ }
+ }
+ FASTBOOL bCon1=rCon1.pObj!=NULL && rCon1.pObj->GetPage()==pPage && rCon1.pObj->IsInserted();
+ FASTBOOL bCon2=rCon2.pObj!=NULL && rCon2.pObj->GetPage()==pPage && rCon2.pObj->IsInserted();
+ const SfxItemSet& rSet = GetObjectItemSet();
+
+ if (bCon1) {
+ if (rCon1.pObj==(SdrObject*)this)
+ {
+ // sicherheitshalber Abfragen #44515#
+ aBoundRect1=aOutRect;
+ }
+ else
+ {
+ aBoundRect1 = rCon1.pObj->GetCurrentBoundRect();
+ }
+ aBoundRect1.Move(rCon1.aObjOfs.X(),rCon1.aObjOfs.Y());
+ aBewareRect1=aBoundRect1;
+
+ sal_Int32 nH = ((SdrEdgeNode1HorzDistItem&)rSet.Get(SDRATTR_EDGENODE1HORZDIST)).GetValue();
+ sal_Int32 nV = ((SdrEdgeNode1VertDistItem&)rSet.Get(SDRATTR_EDGENODE1VERTDIST)).GetValue();
+
+ aBewareRect1.Left()-=nH;
+ aBewareRect1.Right()+=nH;
+ aBewareRect1.Top()-=nV;
+ aBewareRect1.Bottom()+=nV;
+ } else {
+ aBoundRect1=Rectangle(aPt1,aPt1);
+ aBoundRect1.Move(rCon1.aObjOfs.X(),rCon1.aObjOfs.Y());
+ aBewareRect1=aBoundRect1;
+ }
+ if (bCon2) {
+ if (rCon2.pObj==(SdrObject*)this) { // sicherheitshalber Abfragen #44515#
+ aBoundRect2=aOutRect;
+ }
+ else
+ {
+ aBoundRect2 = rCon2.pObj->GetCurrentBoundRect();
+ }
+ aBoundRect2.Move(rCon2.aObjOfs.X(),rCon2.aObjOfs.Y());
+ aBewareRect2=aBoundRect2;
+
+ sal_Int32 nH = ((SdrEdgeNode2HorzDistItem&)rSet.Get(SDRATTR_EDGENODE2HORZDIST)).GetValue();
+ sal_Int32 nV = ((SdrEdgeNode2VertDistItem&)rSet.Get(SDRATTR_EDGENODE2VERTDIST)).GetValue();
+
+ aBewareRect2.Left()-=nH;
+ aBewareRect2.Right()+=nH;
+ aBewareRect2.Top()-=nV;
+ aBewareRect2.Bottom()+=nV;
+ } else {
+ aBoundRect2=Rectangle(aPt2,aPt2);
+ aBoundRect2.Move(rCon2.aObjOfs.X(),rCon2.aObjOfs.Y());
+ aBewareRect2=aBoundRect2;
+ }
+ XPolygon aBestXP;
+ sal_uIntPtr nBestQual=0xFFFFFFFF;
+ SdrEdgeInfoRec aBestInfo;
+ FASTBOOL bAuto1=bCon1 && rCon1.bBestVertex;
+ FASTBOOL bAuto2=bCon2 && rCon2.bBestVertex;
+ if (bAuto1) rCon1.bAutoVertex=sal_True;
+ if (bAuto2) rCon2.bAutoVertex=sal_True;
+ sal_uInt16 nBestAuto1=0;
+ sal_uInt16 nBestAuto2=0;
+ sal_uInt16 nAnz1=bAuto1 ? 4 : 1;
+ sal_uInt16 nAnz2=bAuto2 ? 4 : 1;
+ for (sal_uInt16 nNum1=0; nNum1<nAnz1; nNum1++) {
+ if (bAuto1) rCon1.nConId=nNum1;
+ if (bCon1 && rCon1.TakeGluePoint(aGP1,sal_True)) {
+ aPt1=aGP1.GetPos();
+ nEsc1=aGP1.GetEscDir();
+ if (nEsc1==SDRESC_SMART) nEsc1=ImpCalcEscAngle(rCon1.pObj,aPt1-rCon1.aObjOfs);
+ }
+ for (sal_uInt16 nNum2=0; nNum2<nAnz2; nNum2++) {
+ if (bAuto2) rCon2.nConId=nNum2;
+ if (bCon2 && rCon2.TakeGluePoint(aGP2,sal_True)) {
+ aPt2=aGP2.GetPos();
+ nEsc2=aGP2.GetEscDir();
+ if (nEsc2==SDRESC_SMART) nEsc2=ImpCalcEscAngle(rCon2.pObj,aPt2-rCon2.aObjOfs);
+ }
+ for (long nA1=0; nA1<36000; nA1+=9000) {
+ sal_uInt16 nE1=nA1==0 ? SDRESC_RIGHT : nA1==9000 ? SDRESC_TOP : nA1==18000 ? SDRESC_LEFT : nA1==27000 ? SDRESC_BOTTOM : 0;
+ for (long nA2=0; nA2<36000; nA2+=9000) {
+ sal_uInt16 nE2=nA2==0 ? SDRESC_RIGHT : nA2==9000 ? SDRESC_TOP : nA2==18000 ? SDRESC_LEFT : nA2==27000 ? SDRESC_BOTTOM : 0;
+ if ((nEsc1&nE1)!=0 && (nEsc2&nE2)!=0) {
+ sal_uIntPtr nQual=0;
+ SdrEdgeInfoRec aInfo;
+ if (pInfo!=NULL) aInfo=*pInfo;
+ XPolygon aXP(ImpCalcEdgeTrack(aPt1,nA1,aBoundRect1,aBewareRect1,aPt2,nA2,aBoundRect2,aBewareRect2,&nQual,&aInfo));
+ if (nQual<nBestQual) {
+ aBestXP=aXP;
+ nBestQual=nQual;
+ aBestInfo=aInfo;
+ nBestAuto1=nNum1;
+ nBestAuto2=nNum2;
+ }
+ }
+ }
+ }
+ }
+ }
+ if (bAuto1) rCon1.nConId=nBestAuto1;
+ if (bAuto2) rCon2.nConId=nBestAuto2;
+ if (pInfo!=NULL) *pInfo=aBestInfo;
+ return aBestXP;
+}
+
+XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rectangle& rBoundRect1, const Rectangle& rBewareRect1,
+ const Point& rPt2, long nAngle2, const Rectangle& rBoundRect2, const Rectangle& rBewareRect2,
+ sal_uIntPtr* pnQuality, SdrEdgeInfoRec* pInfo) const
+{
+ SdrEdgeKind eKind=((SdrEdgeKindItem&)(GetObjectItem(SDRATTR_EDGEKIND))).GetValue();
+ FASTBOOL bRts1=nAngle1==0;
+ FASTBOOL bObn1=nAngle1==9000;
+ FASTBOOL bLks1=nAngle1==18000;
+ FASTBOOL bUnt1=nAngle1==27000;
+ FASTBOOL bHor1=bLks1 || bRts1;
+ FASTBOOL bVer1=bObn1 || bUnt1;
+ FASTBOOL bRts2=nAngle2==0;
+ FASTBOOL bObn2=nAngle2==9000;
+ FASTBOOL bLks2=nAngle2==18000;
+ FASTBOOL bUnt2=nAngle2==27000;
+ FASTBOOL bHor2=bLks2 || bRts2;
+ FASTBOOL bVer2=bObn2 || bUnt2;
+ FASTBOOL bInfo=pInfo!=NULL;
+ if (bInfo) {
+ pInfo->cOrthoForm=0;
+ pInfo->nAngle1=nAngle1;
+ pInfo->nAngle2=nAngle2;
+ pInfo->nObj1Lines=1;
+ pInfo->nObj2Lines=1;
+ pInfo->nMiddleLine=0xFFFF;
+ }
+ Point aPt1(rPt1);
+ Point aPt2(rPt2);
+ Rectangle aBoundRect1 (rBoundRect1 );
+ Rectangle aBoundRect2 (rBoundRect2 );
+ Rectangle aBewareRect1(rBewareRect1);
+ Rectangle aBewareRect2(rBewareRect2);
+ Point aMeeting((aPt1.X()+aPt2.X()+1)/2,(aPt1.Y()+aPt2.Y()+1)/2);
+ FASTBOOL bMeetingXMid=sal_True;
+ FASTBOOL bMeetingYMid=sal_True;
+ if (eKind==SDREDGE_ONELINE) {
+ XPolygon aXP(2);
+ aXP[0]=rPt1;
+ aXP[1]=rPt2;
+ if (pnQuality!=NULL) {
+ *pnQuality=Abs(rPt1.X()-rPt2.X())+Abs(rPt1.Y()-rPt2.Y());
+ }
+ return aXP;
+ } else if (eKind==SDREDGE_THREELINES) {
+ XPolygon aXP(4);
+ aXP[0]=rPt1;
+ aXP[1]=rPt1;
+ aXP[2]=rPt2;
+ aXP[3]=rPt2;
+ if (bRts1) aXP[1].X()=aBewareRect1.Right(); //+=500;
+ if (bObn1) aXP[1].Y()=aBewareRect1.Top(); //-=500;
+ if (bLks1) aXP[1].X()=aBewareRect1.Left(); //-=500;
+ if (bUnt1) aXP[1].Y()=aBewareRect1.Bottom(); //+=500;
+ if (bRts2) aXP[2].X()=aBewareRect2.Right(); //+=500;
+ if (bObn2) aXP[2].Y()=aBewareRect2.Top(); //-=500;
+ if (bLks2) aXP[2].X()=aBewareRect2.Left(); //-=500;
+ if (bUnt2) aXP[2].Y()=aBewareRect2.Bottom(); //+=500;
+ if (pnQuality!=NULL) {
+ long nQ=Abs(aXP[1].X()-aXP[0].X())+Abs(aXP[1].Y()-aXP[0].Y());
+ nQ+=Abs(aXP[2].X()-aXP[1].X())+Abs(aXP[2].Y()-aXP[1].Y());
+ nQ+=Abs(aXP[3].X()-aXP[2].X())+Abs(aXP[3].Y()-aXP[2].Y());
+ *pnQuality=nQ;
+ }
+ if (bInfo) {
+ pInfo->nObj1Lines=2;
+ pInfo->nObj2Lines=2;
+ if (bHor1) {
+ aXP[1].X()+=pInfo->aObj1Line2.X();
+ } else {
+ aXP[1].Y()+=pInfo->aObj1Line2.Y();
+ }
+ if (bHor2) {
+ aXP[2].X()+=pInfo->aObj2Line2.X();
+ } else {
+ aXP[2].Y()+=pInfo->aObj2Line2.Y();
+ }
+ }
+ return aXP;
+ }
+ sal_uInt16 nIntersections=0;
+ FASTBOOL bForceMeeting=sal_False; // Muss die Linie durch den MeetingPoint laufen?
+ {
+ Point aC1(aBewareRect1.Center());
+ Point aC2(aBewareRect2.Center());
+ if (aBewareRect1.Left()<=aBewareRect2.Right() && aBewareRect1.Right()>=aBewareRect2.Left()) {
+ // Ueberschneidung auf der X-Achse
+ long n1=Max(aBewareRect1.Left(),aBewareRect2.Left());
+ long n2=Min(aBewareRect1.Right(),aBewareRect2.Right());
+ aMeeting.X()=(n1+n2+1)/2;
+ } else {
+ // Ansonsten den Mittelpunkt des Freiraums
+ if (aC1.X()<aC2.X()) {
+ aMeeting.X()=(aBewareRect1.Right()+aBewareRect2.Left()+1)/2;
+ } else {
+ aMeeting.X()=(aBewareRect1.Left()+aBewareRect2.Right()+1)/2;
+ }
+ }
+ if (aBewareRect1.Top()<=aBewareRect2.Bottom() && aBewareRect1.Bottom()>=aBewareRect2.Top()) {
+ // Ueberschneidung auf der Y-Achse
+ long n1=Max(aBewareRect1.Top(),aBewareRect2.Top());
+ long n2=Min(aBewareRect1.Bottom(),aBewareRect2.Bottom());
+ aMeeting.Y()=(n1+n2+1)/2;
+ } else {
+ // Ansonsten den Mittelpunkt des Freiraums
+ if (aC1.Y()<aC2.Y()) {
+ aMeeting.Y()=(aBewareRect1.Bottom()+aBewareRect2.Top()+1)/2;
+ } else {
+ aMeeting.Y()=(aBewareRect1.Top()+aBewareRect2.Bottom()+1)/2;
+ }
+ }
+ // Im Prinzip gibt es 3 zu unterscheidene Faelle:
+ // 1. Beide in die selbe Richtung
+ // 2. Beide in genau entgegengesetzte Richtungen
+ // 3. Einer waagerecht und der andere senkrecht
+ long nXMin=Min(aBewareRect1.Left(),aBewareRect2.Left());
+ long nXMax=Max(aBewareRect1.Right(),aBewareRect2.Right());
+ long nYMin=Min(aBewareRect1.Top(),aBewareRect2.Top());
+ long nYMax=Max(aBewareRect1.Bottom(),aBewareRect2.Bottom());
+ //int bBoundOverlap=aBoundRect1.Right()>aBoundRect2.Left() && aBoundRect1.Left()<aBoundRect2.Right() &&
+ aBoundRect1.Bottom()>aBoundRect2.Top() && aBoundRect1.Top()<aBoundRect2.Bottom();
+ FASTBOOL bBewareOverlap=aBewareRect1.Right()>aBewareRect2.Left() && aBewareRect1.Left()<aBewareRect2.Right() &&
+ aBewareRect1.Bottom()>aBewareRect2.Top() && aBewareRect1.Top()<aBewareRect2.Bottom();
+ unsigned nMainCase=3;
+ if (nAngle1==nAngle2) nMainCase=1;
+ else if ((bHor1 && bHor2) || (bVer1 && bVer2)) nMainCase=2;
+ if (nMainCase==1) { // Fall 1: Beide in eine Richtung moeglich.
+ if (bVer1) aMeeting.X()=(aPt1.X()+aPt2.X()+1)/2; // ist hier besser, als der
+ if (bHor1) aMeeting.Y()=(aPt1.Y()+aPt2.Y()+1)/2; // Mittelpunkt des Freiraums
+ // bX1Ok bedeutet, dass die Vertikale, die aus Obj1 austritt, keinen Konflikt mit Obj2 bildet, ...
+ FASTBOOL bX1Ok=aPt1.X()<=aBewareRect2.Left() || aPt1.X()>=aBewareRect2.Right();
+ FASTBOOL bX2Ok=aPt2.X()<=aBewareRect1.Left() || aPt2.X()>=aBewareRect1.Right();
+ FASTBOOL bY1Ok=aPt1.Y()<=aBewareRect2.Top() || aPt1.Y()>=aBewareRect2.Bottom();
+ FASTBOOL bY2Ok=aPt2.Y()<=aBewareRect1.Top() || aPt2.Y()>=aBewareRect1.Bottom();
+ if (bLks1 && (bY1Ok || aBewareRect1.Left()<aBewareRect2.Right()) && (bY2Ok || aBewareRect2.Left()<aBewareRect1.Right())) {
+ aMeeting.X()=nXMin;
+ bMeetingXMid=sal_False;
+ }
+ if (bRts1 && (bY1Ok || aBewareRect1.Right()>aBewareRect2.Left()) && (bY2Ok || aBewareRect2.Right()>aBewareRect1.Left())) {
+ aMeeting.X()=nXMax;
+ bMeetingXMid=sal_False;
+ }
+ if (bObn1 && (bX1Ok || aBewareRect1.Top()<aBewareRect2.Bottom()) && (bX2Ok || aBewareRect2.Top()<aBewareRect1.Bottom())) {
+ aMeeting.Y()=nYMin;
+ bMeetingYMid=sal_False;
+ }
+ if (bUnt1 && (bX1Ok || aBewareRect1.Bottom()>aBewareRect2.Top()) && (bX2Ok || aBewareRect2.Bottom()>aBewareRect1.Top())) {
+ aMeeting.Y()=nYMax;
+ bMeetingYMid=sal_False;
+ }
+ } else if (nMainCase==2) {
+ // Fall 2:
+ bForceMeeting=sal_True;
+ if (bHor1) { // beide waagerecht
+ /* 9 Moeglichkeiten: ù ù ù */
+ /* 2.1 Gegenueber, Ueberschneidung à ´ ù */
+ /* nur auf der Y-Achse ù ù ù */
+ /* 2.2, 2.3 Gegenueber, vertikal versetzt. Ã ù ù ù ù ù */
+ /* Ueberschneidung weder auf der ù ´ ù ù ´ ù */
+ /* X- noch auf der Y-Achse ù ù ù Ã ù ù */
+ /* 2.4, 2.5 Untereinander, ù Ã ù ù ù ù */
+ /* Ueberschneidung ù ´ ù ù ´ ù */
+ /* nur auf X-Achse ù ù ù ù Ã ù */
+ /* 2.6, 2.7 Gegeneinander, vertikal versetzt. ù ù Ã ù ù ù */
+ /* Ueberschneidung weder auf der ù ´ ù ù ´ ù */
+ /* X- noch auf der Y-Achse. ù ù ù ù ù Ã */
+ /* 2.8 Gegeneinander. ù ù ù */
+ /* Ueberschneidung nur ù ´ Ã */
+ /* auf der Y-Achse. ù ù ù */
+ /* 2.9 Die BewareRects der Objekte ueberschneiden */
+ /* sich auf X- und Y-Achse. */
+ /* Die Faelle gelten entsprechend umgesetzt auch fuer */
+ /* senkrechte Linienaustritte. */
+ /* Die Faelle 2.1-2.7 werden mit dem Default-Meeting ausreichend*/
+ /* gut behandelt. Spezielle MeetingPoints werden hier also nur */
+ /* fuer 2.8 und 2.9 bestimmt. */
+
+ // Normalisierung. aR1 soll der nach rechts und
+ // aR2 der nach links austretende sein.
+ Rectangle aBewR1(bRts1 ? aBewareRect1 : aBewareRect2);
+ Rectangle aBewR2(bRts1 ? aBewareRect2 : aBewareRect1);
+ Rectangle aBndR1(bRts1 ? aBoundRect1 : aBoundRect2);
+ Rectangle aBndR2(bRts1 ? aBoundRect2 : aBoundRect1);
+ if (aBewR1.Bottom()>aBewR2.Top() && aBewR1.Top()<aBewR2.Bottom()) {
+ // Ueberschneidung auf der Y-Achse. Faelle 2.1, 2.8, 2.9
+ if (aBewR1.Right()>aBewR2.Left()) {
+ // Faelle 2.8, 2.9
+ // Fall 2.8 ist immer Aussenrumlauf (bDirect=sal_False).
+ // Fall 2.9 kann auch Direktverbindung sein (bei geringer
+ // Ueberschneidung der BewareRects ohne Ueberschneidung der
+ // Boundrects wenn die Linienaustritte sonst das BewareRect
+ // des jeweils anderen Objekts verletzen wuerden.
+ FASTBOOL bCase29Direct=sal_False;
+ FASTBOOL bCase29=aBewR1.Right()>aBewR2.Left();
+ if (aBndR1.Right()<=aBndR2.Left()) { // Fall 2.9 und keine Boundrectueberschneidung
+ if ((aPt1.Y()>aBewareRect2.Top() && aPt1.Y()<aBewareRect2.Bottom()) ||
+ (aPt2.Y()>aBewareRect1.Top() && aPt2.Y()<aBewareRect1.Bottom())) {
+ bCase29Direct=sal_True;
+ }
+ }
+ if (!bCase29Direct) {
+ FASTBOOL bObenLang=Abs(nYMin-aMeeting.Y())<=Abs(nYMax-aMeeting.Y());
+ if (bObenLang) {
+ aMeeting.Y()=nYMin;
+ } else {
+ aMeeting.Y()=nYMax;
+ }
+ bMeetingYMid=sal_False;
+ if (bCase29) {
+ // und nun noch dafuer sorgen, dass das
+ // umzingelte Obj nicht durchquert wird
+ if ((aBewR1.Center().Y()<aBewR2.Center().Y()) != bObenLang) {
+ aMeeting.X()=aBewR2.Right();
+ } else {
+ aMeeting.X()=aBewR1.Left();
+ }
+ bMeetingXMid=sal_False;
+ }
+ } else {
+ // Direkte Verbindung (3-Linien Z-Verbindung), da
+ // Verletzung der BewareRects unvermeidlich ist.
+ // Via Dreisatz werden die BewareRects nun verkleinert.
+ long nWant1=aBewR1.Right()-aBndR1.Right(); // Abstand bei Obj1
+ long nWant2=aBndR2.Left()-aBewR2.Left(); // Abstand bei Obj2
+ long nSpace=aBndR2.Left()-aBndR1.Right(); // verfuegbarer Platz
+ long nGet1=BigMulDiv(nWant1,nSpace,nWant1+nWant2);
+ long nGet2=nSpace-nGet1;
+ if (bRts1) { // Normalisierung zurueckwandeln
+ aBewareRect1.Right()+=nGet1-nWant1;
+ aBewareRect2.Left()-=nGet2-nWant2;
+ } else {
+ aBewareRect2.Right()+=nGet1-nWant1;
+ aBewareRect1.Left()-=nGet2-nWant2;
+ }
+ nIntersections++; // Qualitaet herabsetzen
+ }
+ }
+ }
+ } else if (bVer1) { // beide senkrecht
+ Rectangle aBewR1(bUnt1 ? aBewareRect1 : aBewareRect2);
+ Rectangle aBewR2(bUnt1 ? aBewareRect2 : aBewareRect1);
+ Rectangle aBndR1(bUnt1 ? aBoundRect1 : aBoundRect2);
+ Rectangle aBndR2(bUnt1 ? aBoundRect2 : aBoundRect1);
+ if (aBewR1.Right()>aBewR2.Left() && aBewR1.Left()<aBewR2.Right()) {
+ // Ueberschneidung auf der Y-Achse. Faelle 2.1, 2.8, 2.9
+ if (aBewR1.Bottom()>aBewR2.Top()) {
+ // Faelle 2.8, 2.9
+ // Fall 2.8 ist immer Aussenrumlauf (bDirect=sal_False).
+ // Fall 2.9 kann auch Direktverbindung sein (bei geringer
+ // Ueberschneidung der BewareRects ohne Ueberschneidung der
+ // Boundrects wenn die Linienaustritte sonst das BewareRect
+ // des jeweils anderen Objekts verletzen wuerden.
+ FASTBOOL bCase29Direct=sal_False;
+ FASTBOOL bCase29=aBewR1.Bottom()>aBewR2.Top();
+ if (aBndR1.Bottom()<=aBndR2.Top()) { // Fall 2.9 und keine Boundrectueberschneidung
+ if ((aPt1.X()>aBewareRect2.Left() && aPt1.X()<aBewareRect2.Right()) ||
+ (aPt2.X()>aBewareRect1.Left() && aPt2.X()<aBewareRect1.Right())) {
+ bCase29Direct=sal_True;
+ }
+ }
+ if (!bCase29Direct) {
+ FASTBOOL bLinksLang=Abs(nXMin-aMeeting.X())<=Abs(nXMax-aMeeting.X());
+ if (bLinksLang) {
+ aMeeting.X()=nXMin;
+ } else {
+ aMeeting.X()=nXMax;
+ }
+ bMeetingXMid=sal_False;
+ if (bCase29) {
+ // und nun noch dafuer sorgen, dass das
+ // umzingelte Obj nicht durchquert wird
+ if ((aBewR1.Center().X()<aBewR2.Center().X()) != bLinksLang) {
+ aMeeting.Y()=aBewR2.Bottom();
+ } else {
+ aMeeting.Y()=aBewR1.Top();
+ }
+ bMeetingYMid=sal_False;
+ }
+ } else {
+ // Direkte Verbindung (3-Linien Z-Verbindung), da
+ // Verletzung der BewareRects unvermeidlich ist.
+ // Via Dreisatz werden die BewareRects nun verkleinert.
+ long nWant1=aBewR1.Bottom()-aBndR1.Bottom(); // Abstand bei Obj1
+ long nWant2=aBndR2.Top()-aBewR2.Top(); // Abstand bei Obj2
+ long nSpace=aBndR2.Top()-aBndR1.Bottom(); // verfuegbarer Platz
+ long nGet1=BigMulDiv(nWant1,nSpace,nWant1+nWant2);
+ long nGet2=nSpace-nGet1;
+ if (bUnt1) { // Normalisierung zurueckwandeln
+ aBewareRect1.Bottom()+=nGet1-nWant1;
+ aBewareRect2.Top()-=nGet2-nWant2;
+ } else {
+ aBewareRect2.Bottom()+=nGet1-nWant1;
+ aBewareRect1.Top()-=nGet2-nWant2;
+ }
+ nIntersections++; // Qualitaet herabsetzen
+ }
+ }
+ }
+ }
+ } else if (nMainCase==3) { // Fall 3: Einer waagerecht und der andere senkrecht. Sehr viele Fallunterscheidungen
+ /* Kleine Legende: ù ú ù ú ù -> Ohne Ueberschneidung, maximal Beruehrung. */
+ /* ú ú ú ú ú -> Ueberschneidung */
+ /* ù ú Ã ú ù -> Selbe Hoehe */
+ /* ú ú ú ú ú -> Ueberschneidung */
+ /* ù ú ù ú ù -> Ohne Ueberschneidung, maximal Beruehrung. */
+ /* Linienaustritte links ´, rechts Ã, oben Á und unten Â. */
+ /* Insgesamt sind 96 Konstellationen moeglich, wobei einige nicht einmal */
+ /* eindeutig einem Fall und damit einer Behandlungsmethode zugeordnet werden */
+ /* koennen. */
+ /* 3.1: Hierzu moegen alle Konstellationen zaehlen, die durch den */
+ /* Default-MeetingPoint zufriedenstellend abgedeckt sind (20+12). */
+ /* Â Â Â ú Á Á ú Â Â Â Diese 12 ù ú ù Â ù ù ú ù ú ù ù Â ù ú ù ù ú ù ú ù */
+ /* ú ú ú ú Á Á ú ú ú ú Konstel. ú ú ú ú ú ú ú ú ú Â ú ú ú ú ú Â ú ú ú ú */
+ /* ù ú Ã ú ù ù ú ´ ú ù jedoch ù ú Ã ú Á ù ú Ã ú Â Á ú ´ ú ù Â ú ´ ú ù */
+ /* ú ú ú ú Â Â ú ú ú ú nur zum ú ú ú ú Á ú ú ú ú ú Á ú ú ú ú ú ú ú ú ú */
+ /* Á Á Á ú Â Â ú Á Á Á Teil: ù ú ù Á ù ù ú ù ú ù ù Á ù ú ù ù ú ù ú ù */
+ /* Letztere 16 Faelle scheiden aus, sobald sich die Objekte offen */
+ /* gegenueberstehen (siehe Fall 3.2). */
+ /* 3.2: Die Objekte stehen sich offen gegenueber und somit ist eine */
+ /* Verbindung mit lediglich 2 Linien moeglich (4+20). */
+ /* Dieser Fall hat 1. Prioritaet. */
+ /* ù ú ù ú Â Â ú ù ú ù Diese 20 ù ú ù Â ù ù Â ù ú ù ù ú ù ú ù ù ú ù ú ù */
+ /* ú ú ú ú ú ú ú ú ú ú Konstel. ú ú ú Â Â Â Â ú ú ú ú ú ú ú ú ú ú ú ú ú */
+ /* ù ú Ã ú ù ù ú ´ ú ù jedoch ù ú Ã Á Á Á Á ´ ú ù ù ú Ã Â Â Â Â ´ ú ù */
+ /* ú ú ú ú ú ú ú ú ú ú nur zum ú ú ú Á Á Á Á ú ú ú ú ú ú ú ú ú ú ú ú ú */
+ /* ù ú ù ú Á Á ú ù ú ù Teil: ù ú ù Á ù ù Á ù ú ù ù ú ù ú ù ù ú ù ú ù */
+ /* 3.3: Die Linienaustritte zeigen vom anderen Objekt weg bzw. hinter */
+ /* dessen Ruecken vorbei (52+4). */
+ /* Á Á Á Á ù ù Á Á Á Á ù ú ú ú ù ù ú ù ú ù Diese 4 ù ú ù ú ù ù ú ù ú ù */
+ /* Á Á Á Á ú ú Á Á Á Á Â Â Â ú ú ú ú Â Â Â Konstel. ú ú ú Â ú ú Â ú ú ú */
+ /* Á Á Ã ú ù ù ú ´ Á Á Â Â Ã ú ù ù ú ´ Â Â jedoch ù ú Ã ú ù ù ú ´ ú ù */
+ /* Á Á Á ú ú ú ú Á Á Á Â Â Â Â ú ú Â Â Â Â nur zum ú ú ú Á ú ú Á ú ú ú */
+ /* ù ú ù ú ù ù ú ù ú ù Â Â Â Â ù ù Â Â Â Â Teil: ù ú ù ú ù ù ú ù ú ù */
+
+ // Fall 3.2
+ Rectangle aTmpR1(aBewareRect1);
+ Rectangle aTmpR2(aBewareRect2);
+ if (bBewareOverlap) {
+ // Ueberschneidung der BewareRects: BoundRects fuer Check auf Fall 3.2 verwenden.
+ aTmpR1=aBoundRect1;
+ aTmpR2=aBoundRect2;
+ }
+ if ((((bRts1 && aTmpR1.Right ()<=aPt2.X()) || (bLks1 && aTmpR1.Left()>=aPt2.X())) &&
+ ((bUnt2 && aTmpR2.Bottom()<=aPt1.Y()) || (bObn2 && aTmpR2.Top ()>=aPt1.Y()))) ||
+ (((bRts2 && aTmpR2.Right ()<=aPt1.X()) || (bLks2 && aTmpR2.Left()>=aPt1.X())) &&
+ ((bUnt1 && aTmpR1.Bottom()<=aPt2.Y()) || (bObn1 && aTmpR1.Top ()>=aPt2.Y())))) {
+ // Fall 3.2 trifft zu: Verbindung mit lediglich 2 Linien
+ bForceMeeting=sal_True;
+ bMeetingXMid=sal_False;
+ bMeetingYMid=sal_False;
+ if (bHor1) {
+ aMeeting.X()=aPt2.X();
+ aMeeting.Y()=aPt1.Y();
+ } else {
+ aMeeting.X()=aPt1.X();
+ aMeeting.Y()=aPt2.Y();
+ }
+ // Falls Ueberschneidung der BewareRects:
+ aBewareRect1=aTmpR1;
+ aBewareRect2=aTmpR2;
+ } else if ((((bRts1 && aBewareRect1.Right ()>aBewareRect2.Left ()) ||
+ (bLks1 && aBewareRect1.Left ()<aBewareRect2.Right ())) &&
+ ((bUnt2 && aBewareRect2.Bottom()>aBewareRect1.Top ()) ||
+ (bObn2 && aBewareRect2.Top ()<aBewareRect1.Bottom()))) ||
+ (((bRts2 && aBewareRect2.Right ()>aBewareRect1.Left ()) ||
+ (bLks2 && aBewareRect2.Left ()<aBewareRect1.Right ())) &&
+ ((bUnt1 && aBewareRect1.Bottom()>aBewareRect2.Top ()) ||
+ (bObn1 && aBewareRect1.Top ()<aBewareRect2.Bottom())))) {
+ // Fall 3.3
+ bForceMeeting=sal_True;
+ if (bRts1 || bRts2) { aMeeting.X()=nXMax; bMeetingXMid=sal_False; }
+ if (bLks1 || bLks2) { aMeeting.X()=nXMin; bMeetingXMid=sal_False; }
+ if (bUnt1 || bUnt2) { aMeeting.Y()=nYMax; bMeetingYMid=sal_False; }
+ if (bObn1 || bObn2) { aMeeting.Y()=nYMin; bMeetingYMid=sal_False; }
+ }
+ }
+ }
+
+ XPolygon aXP1(ImpCalcObjToCenter(aPt1,nAngle1,aBewareRect1,aMeeting));
+ XPolygon aXP2(ImpCalcObjToCenter(aPt2,nAngle2,aBewareRect2,aMeeting));
+ sal_uInt16 nXP1Anz=aXP1.GetPointCount();
+ sal_uInt16 nXP2Anz=aXP2.GetPointCount();
+ if (bInfo) {
+ pInfo->nObj1Lines=nXP1Anz; if (nXP1Anz>1) pInfo->nObj1Lines--;
+ pInfo->nObj2Lines=nXP2Anz; if (nXP2Anz>1) pInfo->nObj2Lines--;
+ }
+ Point aEP1(aXP1[nXP1Anz-1]);
+ Point aEP2(aXP2[nXP2Anz-1]);
+ FASTBOOL bInsMeetingPoint=aEP1.X()!=aEP2.X() && aEP1.Y()!=aEP2.Y();
+ FASTBOOL bHorzE1=aEP1.Y()==aXP1[nXP1Anz-2].Y(); // letzte Linie von XP1 horizontal?
+ FASTBOOL bHorzE2=aEP2.Y()==aXP2[nXP2Anz-2].Y(); // letzte Linie von XP2 horizontal?
+ if (aEP1==aEP2 && (bHorzE1 && bHorzE2 && aEP1.Y()==aEP2.Y()) || (!bHorzE1 && !bHorzE2 && aEP1.X()==aEP2.X())) {
+ // Sonderbehandlung fuer 'I'-Verbinder
+ nXP1Anz--; aXP1.Remove(nXP1Anz,1);
+ nXP2Anz--; aXP2.Remove(nXP2Anz,1);
+ bMeetingXMid=sal_False;
+ bMeetingYMid=sal_False;
+ }
+ if (bInsMeetingPoint) {
+ aXP1.Insert(XPOLY_APPEND,aMeeting,XPOLY_NORMAL);
+ if (bInfo) {
+ // Durch einfuegen des MeetingPoints kommen 2 weitere Linie hinzu.
+ // Evtl. wird eine von diesen die Mittellinie.
+ if (pInfo->nObj1Lines==pInfo->nObj2Lines) {
+ pInfo->nObj1Lines++;
+ pInfo->nObj2Lines++;
+ } else {
+ if (pInfo->nObj1Lines>pInfo->nObj2Lines) {
+ pInfo->nObj2Lines++;
+ pInfo->nMiddleLine=nXP1Anz-1;
+ } else {
+ pInfo->nObj1Lines++;
+ pInfo->nMiddleLine=nXP1Anz;
+ }
+ }
+ }
+ } else if (bInfo && aEP1!=aEP2 && nXP1Anz+nXP2Anz>=4) {
+ // Durch Verbinden der beiden Enden kommt eine weitere Linie hinzu.
+ // Dies wird die Mittellinie.
+ pInfo->nMiddleLine=nXP1Anz-1;
+ }
+ sal_uInt16 nNum=aXP2.GetPointCount();
+ if (aXP1[nXP1Anz-1]==aXP2[nXP2Anz-1] && nXP1Anz>1 && nXP2Anz>1) nNum--;
+ while (nNum>0) {
+ nNum--;
+ aXP1.Insert(XPOLY_APPEND,aXP2[nNum],XPOLY_NORMAL);
+ }
+ sal_uInt16 nPntAnz=aXP1.GetPointCount();
+ char cForm=0;
+ if (bInfo || pnQuality!=NULL) {
+ cForm='?';
+ if (nPntAnz==2) cForm='I';
+ else if (nPntAnz==3) cForm='L';
+ else if (nPntAnz==4) { // Z oder U
+ if (nAngle1==nAngle2) cForm='U';
+ else cForm='Z';
+ } else if (nPntAnz==4) { /* Ú-¿ Ú-¿ */
+ /* ... -Ù -Ù */
+ } else if (nPntAnz==6) { // S oder C oder ...
+ if (nAngle1!=nAngle2) {
+ // Fuer Typ S hat Linie2 dieselbe Richtung wie Linie4.
+ // Bei Typ C sind die beiden genau entgegengesetzt.
+ Point aP1(aXP1[1]);
+ Point aP2(aXP1[2]);
+ Point aP3(aXP1[3]);
+ Point aP4(aXP1[4]);
+ if (aP1.Y()==aP2.Y()) { // beide Linien Horz
+ if ((aP1.X()<aP2.X())==(aP3.X()<aP4.X())) cForm='S';
+ else cForm='C';
+ } else { // sonst beide Linien Vert
+ if ((aP1.Y()<aP2.Y())==(aP3.Y()<aP4.Y())) cForm='S';
+ else cForm='C';
+ }
+ } else cForm='4'; // sonst der 3. Fall mit 5 Linien
+ } else cForm='?'; //
+ // Weitere Formen:
+ if (bInfo) {
+ pInfo->cOrthoForm=cForm;
+ if (cForm=='I' || cForm=='L' || cForm=='Z' || cForm=='U') {
+ pInfo->nObj1Lines=1;
+ pInfo->nObj2Lines=1;
+ if (cForm=='Z' || cForm=='U') {
+ pInfo->nMiddleLine=1;
+ } else {
+ pInfo->nMiddleLine=0xFFFF;
+ }
+ } else if (cForm=='S' || cForm=='C') {
+ pInfo->nObj1Lines=2;
+ pInfo->nObj2Lines=2;
+ pInfo->nMiddleLine=2;
+ }
+ }
+ }
+ if (pnQuality!=NULL) {
+ sal_uIntPtr nQual=0;
+ sal_uIntPtr nQual0=nQual; // Ueberlaeufe vorbeugen
+ FASTBOOL bOverflow=sal_False;
+ Point aPt0(aXP1[0]);
+ for (sal_uInt16 nPntNum=1; nPntNum<nPntAnz; nPntNum++) {
+ Point aPt1b(aXP1[nPntNum]);
+ nQual+=Abs(aPt1b.X()-aPt0.X())+Abs(aPt1b.Y()-aPt0.Y());
+ if (nQual<nQual0) bOverflow=sal_True;
+ nQual0=nQual;
+ aPt0=aPt1b;
+ }
+
+ sal_uInt16 nTmp=nPntAnz;
+ if (cForm=='Z') {
+ nTmp=2; // Z-Form hat gute Qualitaet (nTmp=2 statt 4)
+ sal_uIntPtr n1=Abs(aXP1[1].X()-aXP1[0].X())+Abs(aXP1[1].Y()-aXP1[0].Y());
+ sal_uIntPtr n2=Abs(aXP1[2].X()-aXP1[1].X())+Abs(aXP1[2].Y()-aXP1[1].Y());
+ sal_uIntPtr n3=Abs(aXP1[3].X()-aXP1[2].X())+Abs(aXP1[3].Y()-aXP1[2].Y());
+ // fuer moeglichst gleichlange Linien sorgen
+ sal_uIntPtr nBesser=0;
+ n1+=n3;
+ n3=n2/4;
+ if (n1>=n2) nBesser=6;
+ else if (n1>=3*n3) nBesser=4;
+ else if (n1>=2*n3) nBesser=2;
+ if (aXP1[0].Y()!=aXP1[1].Y()) nBesser++; // Senkrechte Startlinie kriegt auch noch einen Pluspunkt (fuer H/V-Prio)
+ if (nQual>nBesser) nQual-=nBesser; else nQual=0;
+ }
+ if (nTmp>=3) {
+ nQual0=nQual;
+ nQual+=(sal_uIntPtr)nTmp*0x01000000;
+ if (nQual<nQual0 || nTmp>15) bOverflow=sal_True;
+ }
+ if (nPntAnz>=2) { // Austrittswinkel nochmal pruefen
+ Point aP1(aXP1[1]); aP1-=aXP1[0];
+ Point aP2(aXP1[nPntAnz-2]); aP2-=aXP1[nPntAnz-1];
+ long nAng1=0; if (aP1.X()<0) nAng1=18000; if (aP1.Y()>0) nAng1=27000;
+ if (aP1.Y()<0) nAng1=9000; if (aP1.X()!=0 && aP1.Y()!=0) nAng1=1; // Schraeg!?!
+ long nAng2=0; if (aP2.X()<0) nAng2=18000; if (aP2.Y()>0) nAng2=27000;
+ if (aP2.Y()<0) nAng2=9000; if (aP2.X()!=0 && aP2.Y()!=0) nAng2=1; // Schraeg!?!
+ if (nAng1!=nAngle1) nIntersections++;
+ if (nAng2!=nAngle2) nIntersections++;
+ }
+
+ // Fuer den Qualitaetscheck wieder die Original-Rects verwenden und
+ // gleichzeitig checken, ob eins fuer die Edge-Berechnung verkleinert
+ // wurde (z.B. Fall 2.9)
+ aBewareRect1=rBewareRect1;
+ aBewareRect2=rBewareRect2;
+
+ for (sal_uInt16 i=0; i<nPntAnz; i++) {
+ Point aPt1b(aXP1[i]);
+ FASTBOOL b1=aPt1b.X()>aBewareRect1.Left() && aPt1b.X()<aBewareRect1.Right() &&
+ aPt1b.Y()>aBewareRect1.Top() && aPt1b.Y()<aBewareRect1.Bottom();
+ FASTBOOL b2=aPt1b.X()>aBewareRect2.Left() && aPt1b.X()<aBewareRect2.Right() &&
+ aPt1b.Y()>aBewareRect2.Top() && aPt1b.Y()<aBewareRect2.Bottom();
+ sal_uInt16 nInt0=nIntersections;
+ if (i==0 || i==nPntAnz-1) {
+ if (b1 && b2) nIntersections++;
+ } else {
+ if (b1) nIntersections++;
+ if (b2) nIntersections++;
+ }
+ // und nun noch auf Ueberschneidungen checken
+ if (i>0 && nInt0==nIntersections) {
+ if (aPt0.Y()==aPt1b.Y()) { // Horizontale Linie
+ if (aPt0.Y()>aBewareRect1.Top() && aPt0.Y()<aBewareRect1.Bottom() &&
+ ((aPt0.X()<=aBewareRect1.Left() && aPt1b.X()>=aBewareRect1.Right()) ||
+ (aPt1b.X()<=aBewareRect1.Left() && aPt0.X()>=aBewareRect1.Right()))) nIntersections++;
+ if (aPt0.Y()>aBewareRect2.Top() && aPt0.Y()<aBewareRect2.Bottom() &&
+ ((aPt0.X()<=aBewareRect2.Left() && aPt1b.X()>=aBewareRect2.Right()) ||
+ (aPt1b.X()<=aBewareRect2.Left() && aPt0.X()>=aBewareRect2.Right()))) nIntersections++;
+ } else { // Vertikale Linie
+ if (aPt0.X()>aBewareRect1.Left() && aPt0.X()<aBewareRect1.Right() &&
+ ((aPt0.Y()<=aBewareRect1.Top() && aPt1b.Y()>=aBewareRect1.Bottom()) ||
+ (aPt1b.Y()<=aBewareRect1.Top() && aPt0.Y()>=aBewareRect1.Bottom()))) nIntersections++;
+ if (aPt0.X()>aBewareRect2.Left() && aPt0.X()<aBewareRect2.Right() &&
+ ((aPt0.Y()<=aBewareRect2.Top() && aPt1b.Y()>=aBewareRect2.Bottom()) ||
+ (aPt1b.Y()<=aBewareRect2.Top() && aPt0.Y()>=aBewareRect2.Bottom()))) nIntersections++;
+ }
+ }
+ aPt0=aPt1b;
+ }
+ if (nPntAnz<=1) nIntersections++;
+ nQual0=nQual;
+ nQual+=(sal_uIntPtr)nIntersections*0x10000000;
+ if (nQual<nQual0 || nIntersections>15) bOverflow=sal_True;
+
+ if (bOverflow || nQual==0xFFFFFFFF) nQual=0xFFFFFFFE;
+ *pnQuality=nQual;
+ }
+ if (bInfo) { // nun die Linienversaetze auf aXP1 anwenden
+ if (pInfo->nMiddleLine!=0xFFFF) {
+ sal_uInt16 nIdx=pInfo->ImpGetPolyIdx(MIDDLELINE,aXP1);
+ if (pInfo->ImpIsHorzLine(MIDDLELINE,aXP1)) {
+ aXP1[nIdx].Y()+=pInfo->aMiddleLine.Y();
+ aXP1[nIdx+1].Y()+=pInfo->aMiddleLine.Y();
+ } else {
+ aXP1[nIdx].X()+=pInfo->aMiddleLine.X();
+ aXP1[nIdx+1].X()+=pInfo->aMiddleLine.X();
+ }
+ }
+ if (pInfo->nObj1Lines>=2) {
+ sal_uInt16 nIdx=pInfo->ImpGetPolyIdx(OBJ1LINE2,aXP1);
+ if (pInfo->ImpIsHorzLine(OBJ1LINE2,aXP1)) {
+ aXP1[nIdx].Y()+=pInfo->aObj1Line2.Y();
+ aXP1[nIdx+1].Y()+=pInfo->aObj1Line2.Y();
+ } else {
+ aXP1[nIdx].X()+=pInfo->aObj1Line2.X();
+ aXP1[nIdx+1].X()+=pInfo->aObj1Line2.X();
+ }
+ }
+ if (pInfo->nObj1Lines>=3) {
+ sal_uInt16 nIdx=pInfo->ImpGetPolyIdx(OBJ1LINE3,aXP1);
+ if (pInfo->ImpIsHorzLine(OBJ1LINE3,aXP1)) {
+ aXP1[nIdx].Y()+=pInfo->aObj1Line3.Y();
+ aXP1[nIdx+1].Y()+=pInfo->aObj1Line3.Y();
+ } else {
+ aXP1[nIdx].X()+=pInfo->aObj1Line3.X();
+ aXP1[nIdx+1].X()+=pInfo->aObj1Line3.X();
+ }
+ }
+ if (pInfo->nObj2Lines>=2) {
+ sal_uInt16 nIdx=pInfo->ImpGetPolyIdx(OBJ2LINE2,aXP1);
+ if (pInfo->ImpIsHorzLine(OBJ2LINE2,aXP1)) {
+ aXP1[nIdx].Y()+=pInfo->aObj2Line2.Y();
+ aXP1[nIdx+1].Y()+=pInfo->aObj2Line2.Y();
+ } else {
+ aXP1[nIdx].X()+=pInfo->aObj2Line2.X();
+ aXP1[nIdx+1].X()+=pInfo->aObj2Line2.X();
+ }
+ }
+ if (pInfo->nObj2Lines>=3) {
+ sal_uInt16 nIdx=pInfo->ImpGetPolyIdx(OBJ2LINE3,aXP1);
+ if (pInfo->ImpIsHorzLine(OBJ2LINE3,aXP1)) {
+ aXP1[nIdx].Y()+=pInfo->aObj2Line3.Y();
+ aXP1[nIdx+1].Y()+=pInfo->aObj2Line3.Y();
+ } else {
+ aXP1[nIdx].X()+=pInfo->aObj2Line3.X();
+ aXP1[nIdx+1].X()+=pInfo->aObj2Line3.X();
+ }
+ }
+ }
+ // Nun mache ich ggf. aus dem Verbinder eine Bezierkurve
+ if (eKind==SDREDGE_BEZIER && nPntAnz>2) {
+ Point* pPt1=&aXP1[0];
+ Point* pPt2=&aXP1[1];
+ Point* pPt3=&aXP1[nPntAnz-2];
+ Point* pPt4=&aXP1[nPntAnz-1];
+ long dx1=pPt2->X()-pPt1->X();
+ long dy1=pPt2->Y()-pPt1->Y();
+ long dx2=pPt3->X()-pPt4->X();
+ long dy2=pPt3->Y()-pPt4->Y();
+ if (cForm=='L') { // nPntAnz==3
+ aXP1.SetFlags(1,XPOLY_CONTROL);
+ Point aPt3(*pPt2);
+ aXP1.Insert(2,aPt3,XPOLY_CONTROL);
+ nPntAnz=aXP1.GetPointCount();
+ pPt1=&aXP1[0];
+ pPt2=&aXP1[1];
+ pPt3=&aXP1[nPntAnz-2];
+ pPt4=&aXP1[nPntAnz-1];
+ pPt2->X()-=dx1/3;
+ pPt2->Y()-=dy1/3;
+ pPt3->X()-=dx2/3;
+ pPt3->Y()-=dy2/3;
+ } else if (nPntAnz>=4 && nPntAnz<=6) { // Z oder U oder ...
+ // fuer Alle Anderen werden die Endpunkte der Ausgangslinien
+ // erstmal zu Kontrollpunkten. Bei nPntAnz>4 ist also noch
+ // Nacharbeit erforderlich!
+ aXP1.SetFlags(1,XPOLY_CONTROL);
+ aXP1.SetFlags(nPntAnz-2,XPOLY_CONTROL);
+ // Distanz x1.5
+ pPt2->X()+=dx1/2;
+ pPt2->Y()+=dy1/2;
+ pPt3->X()+=dx2/2;
+ pPt3->Y()+=dy2/2;
+ if (nPntAnz==5) {
+ // Vor und hinter dem Mittelpunkt jeweils
+ // noch einen Kontrollpunkt einfuegen
+ Point aCenter(aXP1[2]);
+ long dx1b=aCenter.X()-aXP1[1].X();
+ long dy1b=aCenter.Y()-aXP1[1].Y();
+ long dx2b=aCenter.X()-aXP1[3].X();
+ long dy2b=aCenter.Y()-aXP1[3].Y();
+ aXP1.Insert(2,aCenter,XPOLY_CONTROL);
+ aXP1.SetFlags(3,XPOLY_SYMMTR);
+ aXP1.Insert(4,aCenter,XPOLY_CONTROL);
+ aXP1[2].X()-=dx1b/2;
+ aXP1[2].Y()-=dy1b/2;
+ aXP1[3].X()-=(dx1b+dx2b)/4;
+ aXP1[3].Y()-=(dy1b+dy2b)/4;
+ aXP1[4].X()-=dx2b/2;
+ aXP1[4].Y()-=dy2b/2;
+ }
+ if (nPntAnz==6) {
+ Point aPt1b(aXP1[2]);
+ Point aPt2b(aXP1[3]);
+ aXP1.Insert(2,aPt1b,XPOLY_CONTROL);
+ aXP1.Insert(5,aPt2b,XPOLY_CONTROL);
+ long dx=aPt1b.X()-aPt2b.X();
+ long dy=aPt1b.Y()-aPt2b.Y();
+ aXP1[3].X()-=dx/2;
+ aXP1[3].Y()-=dy/2;
+ aXP1.SetFlags(3,XPOLY_SYMMTR);
+ //aXP1[4].X()+=dx/2;
+ //aXP1[4].Y()+=dy/2;
+ aXP1.Remove(4,1); // weil identisch mit aXP1[3]
+ }
+ }
+ }
+ return aXP1;
+}
+
+/*
+Nach einer einfachen Rechnung koennte es max. 64 unterschiedliche Verlaeufe mit
+5 Linien, 32 mit 4 Linien, 16 mit 3, 8 mit 2 Linien und 4 mit 1 Linie geben=124.
+Normalisiert auf 1. Austrittswinkel nach rechts bleiben dann noch 31.
+Dann noch eine vertikale Spiegelung wegnormalisiert bleiben noch 16
+characteristische Verlaufszuege mit 1-5 Linien:
+Mit 1 Linie (Typ 'I'): --
+Mit 2 Linien (Typ 'L'): -Ù
+Mit 3 Linien (Typ 'U'): -¿ (Typ 'Z'): Ú-
+ -Ù -Ù
+Mit 4 Linien: 1 ist nicht plausibel, 3 ist=2 (90deg Drehung). Verbleibt 2,4
+ Ú-Ù Ú¿ À¿ Ú¿ Ú¿ Ú-¿
+ -Ù -Ù -Ù -Ù -Ù -Ù
+Mit 5 Linien: nicht plausibel sind 1,2,4,5. 7 ist identisch mit 3 (Richtungsumkehr)
+ Bleibt also 3,6 und 8. '4' 'S' 'C'
+ ¿ Ú -¿ Ú- Ú-¿ Ú-
+ Ú-Ù Ú-Ù Ú-¿ Ú-¿ À¿ À¿ -Ù ³ Ú-¿ Ú-¿ À¿ Ú-¿
+ -Ù -Ù -Ù Ù -Ù À- -Ù -Ù --Ù À Ù -Ù Ù -Ù À Ù
+Insgesamt sind also 9 Grundtypen zu unterscheiden die den 400 Konstellationen
+aus Objektposition und Austrittswinkeln zuzuordnen sind.
+4 der 9 Grundtypen haben eine 'Mittellinie'. Die Anzahl der zu Objektabstaende
+je Objekt variiert von 0-3:
+ Mi O1 O2 Anmerkung
+'I': n 0 0
+'L': n 0 0
+'U': n 0-1 0-1
+'Z': j 0 0
+4.1: j 0 1 = U+1 bzw. 1+U
+4.2: n 0-2 0-2 = Z+1
+'4': j 0 2 = Z+2
+'S': j 1 1 = 1+Z+1
+'C': n 0-3 0-3 = 1+U+1
+*/
+
+void __EXPORT SdrEdgeObj::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
+{
+ SfxSimpleHint* pSimple=PTR_CAST(SfxSimpleHint,&rHint);
+ sal_uIntPtr nId=pSimple==0 ? 0 : pSimple->GetId();
+ FASTBOOL bDataChg=nId==SFX_HINT_DATACHANGED;
+ FASTBOOL bDying=nId==SFX_HINT_DYING;
+ FASTBOOL bObj1=aCon1.pObj!=NULL && aCon1.pObj->GetBroadcaster()==&rBC;
+ FASTBOOL bObj2=aCon2.pObj!=NULL && aCon2.pObj->GetBroadcaster()==&rBC;
+ if (bDying && (bObj1 || bObj2)) {
+ // #35605# Dying vorher abfangen, damit AttrObj nicht
+ // wg. vermeintlicher Vorlagenaenderung rumbroadcastet
+ if (bObj1) aCon1.pObj=NULL;
+ if (bObj2) aCon2.pObj=NULL;
+ return; // Und mehr braucht hier nicht getan werden.
+ }
+ if ( bObj1 || bObj2 )
+ {
+ bEdgeTrackUserDefined = sal_False;
+ }
+ SdrTextObj::Notify(rBC,rHint);
+ if (nNotifyingCount==0) { // Hier nun auch ein VerriegelungsFlag
+ ((SdrEdgeObj*)this)->nNotifyingCount++;
+ SdrHint* pSdrHint=PTR_CAST(SdrHint,&rHint);
+ if (bDataChg) { // StyleSheet geaendert
+ ImpSetAttrToEdgeInfo(); // Werte bei Vorlagenaenderung vom Pool nach aEdgeInfo kopieren
+ }
+ if (bDataChg ||
+ (bObj1 && aCon1.pObj->GetPage()==pPage) ||
+ (bObj2 && aCon2.pObj->GetPage()==pPage) ||
+ (pSdrHint && pSdrHint->GetKind()==HINT_OBJREMOVED))
+ {
+ // Broadcasting nur, wenn auf der selben Page
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ // #110094#-14 if (!bEdgeTrackDirty) SendRepaintBroadcast();
+ ImpDirtyEdgeTrack();
+
+ // only redraw here, no objectchange
+ ActionChanged();
+ // BroadcastObjectChange();
+
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+ }
+ ((SdrEdgeObj*)this)->nNotifyingCount--;
+ }
+}
+
+/** updates edges that are connected to the edges of this object
+ as if the connected objects send a repaint broadcast
+ #103122#
+*/
+void SdrEdgeObj::Reformat()
+{
+ if( NULL != aCon1.pObj )
+ {
+ SfxSimpleHint aHint( SFX_HINT_DATACHANGED );
+ Notify( *const_cast<SfxBroadcaster*>(aCon1.pObj->GetBroadcaster()), aHint );
+ }
+
+ if( NULL != aCon2.pObj )
+ {
+ SfxSimpleHint aHint( SFX_HINT_DATACHANGED );
+ Notify( *const_cast<SfxBroadcaster*>(aCon2.pObj->GetBroadcaster()), aHint );
+ }
+}
+
+void SdrEdgeObj::operator=(const SdrObject& rObj)
+{
+ SdrTextObj::operator=(rObj);
+ *pEdgeTrack =*((SdrEdgeObj&)rObj).pEdgeTrack;
+ bEdgeTrackDirty=((SdrEdgeObj&)rObj).bEdgeTrackDirty;
+ aCon1 =((SdrEdgeObj&)rObj).aCon1;
+ aCon2 =((SdrEdgeObj&)rObj).aCon2;
+ aCon1.pObj=NULL;
+ aCon2.pObj=NULL;
+ aEdgeInfo=((SdrEdgeObj&)rObj).aEdgeInfo;
+}
+
+void SdrEdgeObj::TakeObjNameSingul(XubString& rName) const
+{
+ rName=ImpGetResStr(STR_ObjNameSingulEDGE);
+
+ String aName( GetName() );
+ if(aName.Len())
+ {
+ rName += sal_Unicode(' ');
+ rName += sal_Unicode('\'');
+ rName += aName;
+ rName += sal_Unicode('\'');
+ }
+}
+
+void SdrEdgeObj::TakeObjNamePlural(XubString& rName) const
+{
+ rName=ImpGetResStr(STR_ObjNamePluralEDGE);
+}
+
+basegfx::B2DPolyPolygon SdrEdgeObj::TakeXorPoly() const
+{
+ basegfx::B2DPolyPolygon aPolyPolygon;
+
+ if (bEdgeTrackDirty)
+ {
+ ((SdrEdgeObj*)this)->ImpRecalcEdgeTrack();
+ }
+
+ if(pEdgeTrack)
+ {
+ aPolyPolygon.append(pEdgeTrack->getB2DPolygon());
+ }
+
+ return aPolyPolygon;
+}
+
+void SdrEdgeObj::SetEdgeTrackPath( const basegfx::B2DPolyPolygon& rPoly )
+{
+ if ( !rPoly.count() )
+ {
+ bEdgeTrackDirty = sal_True;
+ bEdgeTrackUserDefined = sal_False;
+ }
+ else
+ {
+ *pEdgeTrack = XPolygon( rPoly.getB2DPolygon( 0 ) );
+ bEdgeTrackDirty = sal_False;
+ bEdgeTrackUserDefined = sal_True;
+
+ // #i110629# also set aRect and maSnapeRect dependent from pEdgeTrack
+ const Rectangle aPolygonBounds(pEdgeTrack->GetBoundRect());
+ aRect = aPolygonBounds;
+ maSnapRect = aPolygonBounds;
+ }
+}
+
+basegfx::B2DPolyPolygon SdrEdgeObj::GetEdgeTrackPath() const
+{
+ basegfx::B2DPolyPolygon aPolyPolygon;
+
+ if (bEdgeTrackDirty)
+ ((SdrEdgeObj*)this)->ImpRecalcEdgeTrack();
+
+ aPolyPolygon.append( pEdgeTrack->getB2DPolygon() );
+
+ return aPolyPolygon;
+}
+
+sal_uInt32 SdrEdgeObj::GetHdlCount() const
+{
+ SdrEdgeKind eKind=((SdrEdgeKindItem&)(GetObjectItem(SDRATTR_EDGEKIND))).GetValue();
+ sal_uInt32 nHdlAnz(0L);
+ sal_uInt32 nPntAnz(pEdgeTrack->GetPointCount());
+
+ if(nPntAnz)
+ {
+ nHdlAnz = 2L;
+
+ if ((eKind==SDREDGE_ORTHOLINES || eKind==SDREDGE_BEZIER) && nPntAnz >= 4L)
+ {
+ sal_uInt32 nO1(aEdgeInfo.nObj1Lines > 0L ? aEdgeInfo.nObj1Lines - 1L : 0L);
+ sal_uInt32 nO2(aEdgeInfo.nObj2Lines > 0L ? aEdgeInfo.nObj2Lines - 1L : 0L);
+ sal_uInt32 nM(aEdgeInfo.nMiddleLine != 0xFFFF ? 1L : 0L);
+ nHdlAnz += nO1 + nO2 + nM;
+ }
+ else if (eKind==SDREDGE_THREELINES && nPntAnz == 4L)
+ {
+ if(GetConnectedNode(sal_True))
+ nHdlAnz++;
+
+ if(GetConnectedNode(sal_False))
+ nHdlAnz++;
+ }
+ }
+
+ return nHdlAnz;
+}
+
+SdrHdl* SdrEdgeObj::GetHdl(sal_uInt32 nHdlNum) const
+{
+ SdrHdl* pHdl=NULL;
+ sal_uInt32 nPntAnz(pEdgeTrack->GetPointCount());
+ if (nPntAnz!=0) {
+ if (nHdlNum==0) {
+ pHdl=new ImpEdgeHdl((*pEdgeTrack)[0],HDL_POLY);
+ if (aCon1.pObj!=NULL && aCon1.bBestVertex) pHdl->Set1PixMore(sal_True);
+ } else if (nHdlNum==1) {
+ pHdl=new ImpEdgeHdl((*pEdgeTrack)[sal_uInt16(nPntAnz-1)],HDL_POLY);
+ if (aCon2.pObj!=NULL && aCon2.bBestVertex) pHdl->Set1PixMore(sal_True);
+ } else {
+ SdrEdgeKind eKind=((SdrEdgeKindItem&)(GetObjectItem(SDRATTR_EDGEKIND))).GetValue();
+ if (eKind==SDREDGE_ORTHOLINES || eKind==SDREDGE_BEZIER) {
+ sal_uInt32 nO1(aEdgeInfo.nObj1Lines > 0L ? aEdgeInfo.nObj1Lines - 1L : 0L);
+ sal_uInt32 nO2(aEdgeInfo.nObj2Lines > 0L ? aEdgeInfo.nObj2Lines - 1L : 0L);
+ sal_uInt32 nM(aEdgeInfo.nMiddleLine != 0xFFFF ? 1L : 0L);
+ sal_uInt32 nNum(nHdlNum - 2L);
+ sal_Int32 nPt(0L);
+ pHdl=new ImpEdgeHdl(Point(),HDL_POLY);
+ if (nNum<nO1) {
+ nPt=nNum+1L;
+ if (nNum==0) ((ImpEdgeHdl*)pHdl)->SetLineCode(OBJ1LINE2);
+ if (nNum==1) ((ImpEdgeHdl*)pHdl)->SetLineCode(OBJ1LINE3);
+ } else {
+ nNum=nNum-nO1;
+ if (nNum<nO2) {
+ nPt=nPntAnz-3-nNum;
+ if (nNum==0) ((ImpEdgeHdl*)pHdl)->SetLineCode(OBJ2LINE2);
+ if (nNum==1) ((ImpEdgeHdl*)pHdl)->SetLineCode(OBJ2LINE3);
+ } else {
+ nNum=nNum-nO2;
+ if (nNum<nM) {
+ nPt=aEdgeInfo.nMiddleLine;
+ ((ImpEdgeHdl*)pHdl)->SetLineCode(MIDDLELINE);
+ }
+ }
+ }
+ if (nPt>0) {
+ Point aPos((*pEdgeTrack)[(sal_uInt16)nPt]);
+ aPos+=(*pEdgeTrack)[(sal_uInt16)nPt+1];
+ aPos.X()/=2;
+ aPos.Y()/=2;
+ pHdl->SetPos(aPos);
+ } else {
+ delete pHdl;
+ pHdl=NULL;
+ }
+ } else if (eKind==SDREDGE_THREELINES) {
+ sal_uInt32 nNum(nHdlNum);
+ if (GetConnectedNode(sal_True)==NULL) nNum++;
+ Point aPos((*pEdgeTrack)[(sal_uInt16)nNum-1]);
+ pHdl=new ImpEdgeHdl(aPos,HDL_POLY);
+ if (nNum==2) ((ImpEdgeHdl*)pHdl)->SetLineCode(OBJ1LINE2);
+ if (nNum==3) ((ImpEdgeHdl*)pHdl)->SetLineCode(OBJ2LINE2);
+ }
+ }
+ if (pHdl!=NULL) {
+ pHdl->SetPointNum(nHdlNum);
+ }
+ }
+ return pHdl;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+bool SdrEdgeObj::hasSpecialDrag() const
+{
+ return true;
+}
+
+SdrObject* SdrEdgeObj::getFullDragClone() const
+{
+ // use Clone operator
+ SdrEdgeObj* pRetval = (SdrEdgeObj*)Clone();
+
+ // copy connections for clone, SdrEdgeObj::operator= does not do this
+ pRetval->ConnectToNode(true, GetConnectedNode(true));
+ pRetval->ConnectToNode(false, GetConnectedNode(false));
+
+ return pRetval;
+}
+
+bool SdrEdgeObj::beginSpecialDrag(SdrDragStat& rDrag) const
+{
+ if(!rDrag.GetHdl())
+ return false;
+
+ rDrag.SetEndDragChangesAttributes(true);
+
+ if(rDrag.GetHdl()->GetPointNum() < 2)
+ {
+ rDrag.SetNoSnap(true);
+ }
+
+ return true;
+}
+
+bool SdrEdgeObj::applySpecialDrag(SdrDragStat& rDragStat)
+{
+ SdrEdgeObj* pOriginalEdge = dynamic_cast< SdrEdgeObj* >(rDragStat.GetHdl()->GetObj());
+ const bool bOriginalEdgeModified(pOriginalEdge == this);
+
+ if(!bOriginalEdgeModified && pOriginalEdge)
+ {
+ // copy connections when clone is modified. This is needed because
+ // as preparation to this modification the data from the original object
+ // was copied to the clone using the operator=. As can be seen there,
+ // that operator does not copy the connections (for good reason)
+ ConnectToNode(true, pOriginalEdge->GetConnection(true).GetObject());
+ ConnectToNode(false, pOriginalEdge->GetConnection(false).GetObject());
+ }
+
+ if(rDragStat.GetHdl()->GetPointNum() < 2)
+ {
+ // start or end point connector drag
+ const bool bDragA(0 == rDragStat.GetHdl()->GetPointNum());
+ const Point aPointNow(rDragStat.GetNow());
+
+ if(rDragStat.GetPageView())
+ {
+ SdrObjConnection* pDraggedOne(bDragA ? &aCon1 : &aCon2);
+
+ // clear connection
+ DisconnectFromNode(bDragA);
+
+ // look for new connection
+ ImpFindConnector(aPointNow, *rDragStat.GetPageView(), *pDraggedOne, pOriginalEdge);
+
+ if(pDraggedOne->pObj)
+ {
+ // if found, officially connect to it; ImpFindConnector only
+ // sets pObj hard
+ SdrObject* pNewConnection = pDraggedOne->pObj;
+ pDraggedOne->pObj = 0;
+ ConnectToNode(bDragA, pNewConnection);
+ }
+
+ if(rDragStat.GetView() && !bOriginalEdgeModified)
+ {
+ // show IA helper, but only do this during IA, so not when the original
+ // Edge gets modified in the last call
+ rDragStat.GetView()->SetConnectMarker(*pDraggedOne, *rDragStat.GetPageView());
+ }
+ }
+
+ if(pEdgeTrack)
+ {
+ // change pEdgeTrack to modified position
+ if(bDragA)
+ {
+ (*pEdgeTrack)[0] = aPointNow;
+ }
+ else
+ {
+ (*pEdgeTrack)[sal_uInt16(pEdgeTrack->GetPointCount()-1)] = aPointNow;
+ }
+ }
+
+ // reset edge info's offsets, this is a end point drag
+ aEdgeInfo.aObj1Line2 = Point();
+ aEdgeInfo.aObj1Line3 = Point();
+ aEdgeInfo.aObj2Line2 = Point();
+ aEdgeInfo.aObj2Line3 = Point();
+ aEdgeInfo.aMiddleLine = Point();
+ }
+ else
+ {
+ // control point connector drag
+ const ImpEdgeHdl* pEdgeHdl = (ImpEdgeHdl*)rDragStat.GetHdl();
+ const SdrEdgeLineCode eLineCode = pEdgeHdl->GetLineCode();
+ const Point aDist(rDragStat.GetNow() - rDragStat.GetStart());
+ sal_Int32 nDist(pEdgeHdl->IsHorzDrag() ? aDist.X() : aDist.Y());
+
+ nDist += aEdgeInfo.ImpGetLineVersatz(eLineCode, *pEdgeTrack);
+ aEdgeInfo.ImpSetLineVersatz(eLineCode, *pEdgeTrack, nDist);
+ }
+
+ // force recalc EdgeTrack
+ *pEdgeTrack = ImpCalcEdgeTrack(*pEdgeTrack, aCon1, aCon2, &aEdgeInfo);
+ bEdgeTrackDirty=sal_False;
+
+ // save EdgeInfos and mark object as user modified
+ ImpSetEdgeInfoToAttr();
+ bEdgeTrackUserDefined = false;
+ //SetRectsDirty();
+ //SetChanged();
+
+ if(bOriginalEdgeModified && rDragStat.GetView())
+ {
+ // hide connect marker helper again when original gets changed.
+ // This happens at the end of the interaction
+ rDragStat.GetView()->HideConnectMarker();
+ }
+
+ return true;
+}
+
+String SdrEdgeObj::getSpecialDragComment(const SdrDragStat& rDrag) const
+{
+ const bool bCreateComment(rDrag.GetView() && this == rDrag.GetView()->GetCreateObj());
+
+ if(bCreateComment)
+ {
+ return String();
+ }
+ else
+ {
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_DragEdgeTail, aStr);
+
+ return aStr;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+basegfx::B2DPolygon SdrEdgeObj::ImplAddConnectorOverlay(SdrDragMethod& rDragMethod, bool bTail1, bool bTail2, bool bDetail) const
+{
+ basegfx::B2DPolygon aResult;
+
+ if(bDetail)
+ {
+ SdrObjConnection aMyCon1(aCon1);
+ SdrObjConnection aMyCon2(aCon2);
+
+ if (bTail1)
+ {
+ const basegfx::B2DPoint aTemp(rDragMethod.getCurrentTransformation() * basegfx::B2DPoint(aMyCon1.aObjOfs.X(), aMyCon1.aObjOfs.Y()));
+ aMyCon1.aObjOfs.X() = basegfx::fround(aTemp.getX());
+ aMyCon1.aObjOfs.Y() = basegfx::fround(aTemp.getY());
+ }
+
+ if (bTail2)
+ {
+ const basegfx::B2DPoint aTemp(rDragMethod.getCurrentTransformation() * basegfx::B2DPoint(aMyCon2.aObjOfs.X(), aMyCon2.aObjOfs.Y()));
+ aMyCon2.aObjOfs.X() = basegfx::fround(aTemp.getX());
+ aMyCon2.aObjOfs.Y() = basegfx::fround(aTemp.getY());
+ }
+
+ SdrEdgeInfoRec aInfo(aEdgeInfo);
+ XPolygon aXP(ImpCalcEdgeTrack(*pEdgeTrack, aMyCon1, aMyCon2, &aInfo));
+
+ if(aXP.GetPointCount())
+ {
+ aResult = aXP.getB2DPolygon();
+ }
+ }
+ else
+ {
+ Point aPt1((*pEdgeTrack)[0]);
+ Point aPt2((*pEdgeTrack)[sal_uInt16(pEdgeTrack->GetPointCount() - 1)]);
+
+ if (aCon1.pObj && (aCon1.bBestConn || aCon1.bBestVertex))
+ aPt1 = aCon1.pObj->GetSnapRect().Center();
+
+ if (aCon2.pObj && (aCon2.bBestConn || aCon2.bBestVertex))
+ aPt2 = aCon2.pObj->GetSnapRect().Center();
+
+ if (bTail1)
+ {
+ const basegfx::B2DPoint aTemp(rDragMethod.getCurrentTransformation() * basegfx::B2DPoint(aPt1.X(), aPt1.Y()));
+ aPt1.X() = basegfx::fround(aTemp.getX());
+ aPt1.Y() = basegfx::fround(aTemp.getY());
+ }
+
+ if (bTail2)
+ {
+ const basegfx::B2DPoint aTemp(rDragMethod.getCurrentTransformation() * basegfx::B2DPoint(aPt2.X(), aPt2.Y()));
+ aPt2.X() = basegfx::fround(aTemp.getX());
+ aPt2.Y() = basegfx::fround(aTemp.getY());
+ }
+
+ aResult.append(basegfx::B2DPoint(aPt1.X(), aPt1.Y()));
+ aResult.append(basegfx::B2DPoint(aPt2.X(), aPt2.Y()));
+ }
+
+ return aResult;
+}
+
+FASTBOOL SdrEdgeObj::BegCreate(SdrDragStat& rDragStat)
+{
+ rDragStat.SetNoSnap(sal_True);
+ pEdgeTrack->SetPointCount(2);
+ (*pEdgeTrack)[0]=rDragStat.GetStart();
+ (*pEdgeTrack)[1]=rDragStat.GetNow();
+ if (rDragStat.GetPageView()!=NULL) {
+ ImpFindConnector(rDragStat.GetStart(),*rDragStat.GetPageView(),aCon1,this);
+ ConnectToNode(sal_True,aCon1.pObj);
+ }
+ *pEdgeTrack=ImpCalcEdgeTrack(*pEdgeTrack,aCon1,aCon2,&aEdgeInfo);
+ return sal_True;
+}
+
+FASTBOOL SdrEdgeObj::MovCreate(SdrDragStat& rDragStat)
+{
+ sal_uInt16 nMax=pEdgeTrack->GetPointCount();
+ (*pEdgeTrack)[nMax-1]=rDragStat.GetNow();
+ if (rDragStat.GetPageView()!=NULL) {
+ ImpFindConnector(rDragStat.GetNow(),*rDragStat.GetPageView(),aCon2,this);
+ rDragStat.GetView()->SetConnectMarker(aCon2,*rDragStat.GetPageView());
+ }
+ SetBoundRectDirty();
+ bSnapRectDirty=sal_True;
+ ConnectToNode(sal_False,aCon2.pObj);
+ *pEdgeTrack=ImpCalcEdgeTrack(*pEdgeTrack,aCon1,aCon2,&aEdgeInfo);
+ bEdgeTrackDirty=sal_False;
+ return sal_True;
+}
+
+FASTBOOL SdrEdgeObj::EndCreate(SdrDragStat& rDragStat, SdrCreateCmd eCmd)
+{
+ FASTBOOL bOk=(eCmd==SDRCREATE_FORCEEND || rDragStat.GetPointAnz()>=2);
+ if (bOk) {
+ ConnectToNode(sal_True,aCon1.pObj);
+ ConnectToNode(sal_False,aCon2.pObj);
+ if (rDragStat.GetView()!=NULL) {
+ rDragStat.GetView()->HideConnectMarker();
+ }
+ ImpSetEdgeInfoToAttr(); // Die Werte aus aEdgeInfo in den Pool kopieren
+ }
+ SetRectsDirty();
+ return bOk;
+}
+
+FASTBOOL SdrEdgeObj::BckCreate(SdrDragStat& rDragStat)
+{
+ if (rDragStat.GetView()!=NULL) {
+ rDragStat.GetView()->HideConnectMarker();
+ }
+ return sal_False;
+}
+
+void SdrEdgeObj::BrkCreate(SdrDragStat& rDragStat)
+{
+ if (rDragStat.GetView()!=NULL) {
+ rDragStat.GetView()->HideConnectMarker();
+ }
+}
+
+basegfx::B2DPolyPolygon SdrEdgeObj::TakeCreatePoly(const SdrDragStat& /*rStatDrag*/) const
+{
+ basegfx::B2DPolyPolygon aRetval;
+ aRetval.append(pEdgeTrack->getB2DPolygon());
+ return aRetval;
+}
+
+Pointer SdrEdgeObj::GetCreatePointer() const
+{
+ return Pointer(POINTER_DRAW_CONNECT);
+}
+
+FASTBOOL SdrEdgeObj::ImpFindConnector(const Point& rPt, const SdrPageView& rPV, SdrObjConnection& rCon, const SdrEdgeObj* pThis, OutputDevice* pOut)
+{
+ rCon.ResetVars();
+ if (pOut==NULL) pOut=rPV.GetView().GetFirstOutputDevice(); // GetWin(0);
+ if (pOut==NULL) return sal_False;
+ SdrObjList* pOL=rPV.GetObjList();
+ const SetOfByte& rVisLayer=rPV.GetVisibleLayers();
+ // Sensitiver Bereich der Konnektoren ist doppelt so gross wie die Handles:
+ sal_uInt16 nMarkHdSiz=rPV.GetView().GetMarkHdlSizePixel();
+ Size aHalfConSiz(nMarkHdSiz,nMarkHdSiz);
+ aHalfConSiz=pOut->PixelToLogic(aHalfConSiz);
+ Size aHalfCenterSiz(2*aHalfConSiz.Width(),2*aHalfConSiz.Height());
+ Rectangle aMouseRect(rPt,rPt);
+ aMouseRect.Left() -=aHalfConSiz.Width();
+ aMouseRect.Top() -=aHalfConSiz.Height();
+ aMouseRect.Right() +=aHalfConSiz.Width();
+ aMouseRect.Bottom()+=aHalfConSiz.Height();
+ sal_uInt16 nBoundHitTol=(sal_uInt16)aHalfConSiz.Width()/2; if (nBoundHitTol==0) nBoundHitTol=1;
+ sal_uIntPtr no=pOL->GetObjCount();
+ FASTBOOL bFnd=sal_False;
+ SdrObjConnection aTestCon;
+ SdrObjConnection aBestCon;
+ FASTBOOL bTestBoundHit=sal_False;
+ //int bBestBoundHit=sal_False;
+
+ while (no>0 && !bFnd) {
+ // Problem: Gruppenobjekt mit verschiedenen Layern liefert LayerID 0 !!!!
+ no--;
+ SdrObject* pObj=pOL->GetObj(no);
+ if (rVisLayer.IsSet(pObj->GetLayer()) && pObj->IsVisible() && // only visible objects
+ (pThis==NULL || pObj!=(SdrObject*)pThis) && // nicht an mich selbst connecten
+ pObj->IsNode())
+ {
+ Rectangle aObjBound(pObj->GetCurrentBoundRect());
+ if (aObjBound.IsOver(aMouseRect)) {
+ aTestCon.ResetVars();
+ bTestBoundHit=sal_False;
+ FASTBOOL bEdge=HAS_BASE(SdrEdgeObj,pObj); // kein BestCon fuer Edge
+ // Die Userdefined Konnektoren haben absolute Prioritaet.
+ // Danach kommt Vertex, Corner und Mitte(Best) gleich priorisiert.
+ // Zum Schluss kommt noch ein HitTest aufs Obj.
+ const SdrGluePointList* pGPL=pObj->GetGluePointList();
+ sal_uInt16 nConAnz=pGPL==NULL ? 0 : pGPL->GetCount();
+ sal_uInt16 nGesAnz=nConAnz+9;
+ FASTBOOL bUserFnd=sal_False;
+ sal_uIntPtr nBestDist=0xFFFFFFFF;
+ for (sal_uInt16 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;
+ FASTBOOL bCenter=i==nConAnz+8;
+ FASTBOOL bOk=sal_False;
+ Point aConPos;
+ sal_uInt16 nConNum=i;
+ if (bUser) {
+ const SdrGluePoint& rGP=(*pGPL)[nConNum];
+ aConPos=rGP.GetAbsolutePos(*pObj);
+ nConNum=rGP.GetId();
+ bOk=sal_True;
+ } else if (bVertex && !bUserFnd) {
+ nConNum=nConNum-nConAnz;
+ if (rPV.GetView().IsAutoVertexConnectors()) {
+ SdrGluePoint aPt(pObj->GetVertexGluePoint(nConNum));
+ aConPos=aPt.GetAbsolutePos(*pObj);
+ bOk=sal_True;
+ } else i+=3;
+ } else if (bCorner && !bUserFnd) {
+ nConNum-=nConAnz+4;
+ if (rPV.GetView().IsAutoCornerConnectors()) {
+ SdrGluePoint aPt(pObj->GetCornerGluePoint(nConNum));
+ aConPos=aPt.GetAbsolutePos(*pObj);
+ bOk=sal_True;
+ } else i+=3;
+ }
+ else if (bCenter && !bUserFnd && !bEdge)
+ {
+ // #109007#
+ // Suppress default connect at object center
+ if(!pThis || !pThis->GetSuppressDefaultConnect())
+ {
+ // Edges nicht!
+ nConNum=0;
+ aConPos=aObjBound.Center();
+ bOk=sal_True;
+ }
+ }
+ if (bOk && aMouseRect.IsInside(aConPos)) {
+ if (bUser) bUserFnd=sal_True;
+ bFnd=sal_True;
+ sal_uIntPtr nDist=(sal_uIntPtr)Abs(aConPos.X()-rPt.X())+(sal_uIntPtr)Abs(aConPos.Y()-rPt.Y());
+ if (nDist<nBestDist) {
+ nBestDist=nDist;
+ aTestCon.pObj=pObj;
+ aTestCon.nConId=nConNum;
+ aTestCon.bAutoCorner=bCorner;
+ aTestCon.bAutoVertex=bVertex;
+ aTestCon.bBestConn=sal_False; // bCenter;
+ aTestCon.bBestVertex=bCenter;
+ }
+ }
+ }
+ // Falls kein Konnektor getroffen wird nochmal
+ // HitTest versucht fuer BestConnector (=bCenter)
+ if(!bFnd &&
+ !bEdge &&
+ SdrObjectPrimitiveHit(*pObj, rPt, nBoundHitTol, rPV, &rVisLayer, false))
+ {
+ // #109007#
+ // Suppress default connect at object inside bound
+ if(!pThis || !pThis->GetSuppressDefaultConnect())
+ {
+ bFnd=sal_True;
+ aTestCon.pObj=pObj;
+ aTestCon.bBestConn=sal_True;
+ }
+ }
+ if (bFnd) {
+ Rectangle aMouseRect2(rPt,rPt);
+ aMouseRect.Left() -=nBoundHitTol;
+ aMouseRect.Top() -=nBoundHitTol;
+ aMouseRect.Right() +=nBoundHitTol;
+ aMouseRect.Bottom()+=nBoundHitTol;
+ bTestBoundHit=aObjBound.IsOver(aMouseRect2);
+ }
+
+ }
+ }
+ }
+ rCon=aTestCon;
+ return bFnd;
+}
+
+void SdrEdgeObj::NbcSetSnapRect(const Rectangle& rRect)
+{
+ const Rectangle aOld(GetSnapRect());
+
+ if(aOld != rRect)
+ {
+ if(aRect.IsEmpty() && 0 == pEdgeTrack->GetPointCount())
+ {
+ // #i110629# When initializing, do not scale on empty Rectangle; this
+ // will mirror the underlying text object (!)
+ aRect = rRect;
+ maSnapRect = rRect;
+ }
+ else
+ {
+ long nMulX = rRect.Right() - rRect.Left();
+ long nDivX = aOld.Right() - aOld.Left();
+ long nMulY = rRect.Bottom() - rRect.Top();
+ long nDivY = aOld.Bottom() - aOld.Top();
+ if ( nDivX == 0 ) { nMulX = 1; nDivX = 1; }
+ if ( nDivY == 0 ) { nMulY = 1; nDivY = 1; }
+ Fraction aX(nMulX, nDivX);
+ Fraction aY(nMulY, nDivY);
+ NbcResize(aOld.TopLeft(), aX, aY);
+ NbcMove(Size(rRect.Left() - aOld.Left(), rRect.Top() - aOld.Top()));
+ }
+ }
+}
+
+void SdrEdgeObj::NbcMove(const Size& rSiz)
+{
+ SdrTextObj::NbcMove(rSiz);
+ MoveXPoly(*pEdgeTrack,rSiz);
+}
+
+void SdrEdgeObj::NbcResize(const Point& rRefPnt, const Fraction& aXFact, const Fraction& aYFact)
+{
+ SdrTextObj::NbcResize(rRefPnt,aXFact,aXFact);
+ ResizeXPoly(*pEdgeTrack,rRefPnt,aXFact,aYFact);
+
+ // #75371# if resize is not from paste, forget user distances
+ if(!GetModel()->IsPasteResize())
+ {
+ // #75735#
+ aEdgeInfo.aObj1Line2 = Point();
+ aEdgeInfo.aObj1Line3 = Point();
+ aEdgeInfo.aObj2Line2 = Point();
+ aEdgeInfo.aObj2Line3 = Point();
+ aEdgeInfo.aMiddleLine = Point();
+ }
+}
+
+SdrObject* SdrEdgeObj::DoConvertToPolyObj(sal_Bool bBezier) const
+{
+ basegfx::B2DPolyPolygon aPolyPolygon;
+ aPolyPolygon.append(pEdgeTrack->getB2DPolygon());
+ SdrObject* pRet = ImpConvertMakeObj(aPolyPolygon, sal_False, bBezier);
+ pRet = ImpConvertAddText(pRet, bBezier);
+
+ return pRet;
+}
+
+sal_uInt32 SdrEdgeObj::GetSnapPointCount() const
+{
+ return 2L;
+}
+
+Point SdrEdgeObj::GetSnapPoint(sal_uInt32 i) const
+{
+ ((SdrEdgeObj*)this)->ImpUndirtyEdgeTrack();
+ sal_uInt16 nAnz=pEdgeTrack->GetPointCount();
+ if (i==0) return (*pEdgeTrack)[0];
+ else return (*pEdgeTrack)[nAnz-1];
+}
+
+sal_Bool SdrEdgeObj::IsPolyObj() const
+{
+ return sal_False;
+}
+
+sal_uInt32 SdrEdgeObj::GetPointCount() const
+{
+ return 0L;
+}
+
+Point SdrEdgeObj::GetPoint(sal_uInt32 i) const
+{
+ ((SdrEdgeObj*)this)->ImpUndirtyEdgeTrack();
+ sal_uInt16 nAnz=pEdgeTrack->GetPointCount();
+ if (0L == i)
+ return (*pEdgeTrack)[0];
+ else
+ return (*pEdgeTrack)[nAnz-1];
+}
+
+void SdrEdgeObj::NbcSetPoint(const Point& rPnt, sal_uInt32 i)
+{
+ // ToDo: Umconnekten fehlt noch
+ ImpUndirtyEdgeTrack();
+ sal_uInt16 nAnz=pEdgeTrack->GetPointCount();
+ if (0L == i)
+ (*pEdgeTrack)[0]=rPnt;
+ if (1L == i)
+ (*pEdgeTrack)[nAnz-1]=rPnt;
+ SetEdgeTrackDirty();
+ SetRectsDirty();
+}
+
+SdrEdgeObjGeoData::SdrEdgeObjGeoData()
+{
+ pEdgeTrack=new XPolygon;
+}
+
+SdrEdgeObjGeoData::~SdrEdgeObjGeoData()
+{
+ delete pEdgeTrack;
+}
+
+SdrObjGeoData* SdrEdgeObj::NewGeoData() const
+{
+ return new SdrEdgeObjGeoData;
+}
+
+void SdrEdgeObj::SaveGeoData(SdrObjGeoData& rGeo) const
+{
+ SdrTextObj::SaveGeoData(rGeo);
+ SdrEdgeObjGeoData& rEGeo=(SdrEdgeObjGeoData&)rGeo;
+ rEGeo.aCon1 =aCon1;
+ rEGeo.aCon2 =aCon2;
+ *rEGeo.pEdgeTrack =*pEdgeTrack;
+ rEGeo.bEdgeTrackDirty=bEdgeTrackDirty;
+ rEGeo.bEdgeTrackUserDefined=bEdgeTrackUserDefined;
+ rEGeo.aEdgeInfo =aEdgeInfo;
+}
+
+void SdrEdgeObj::RestGeoData(const SdrObjGeoData& rGeo)
+{
+ SdrTextObj::RestGeoData(rGeo);
+ SdrEdgeObjGeoData& rEGeo=(SdrEdgeObjGeoData&)rGeo;
+ if (aCon1.pObj!=rEGeo.aCon1.pObj) {
+ if (aCon1.pObj!=NULL) aCon1.pObj->RemoveListener(*this);
+ aCon1=rEGeo.aCon1;
+ if (aCon1.pObj!=NULL) aCon1.pObj->AddListener(*this);
+ }
+ if (aCon2.pObj!=rEGeo.aCon2.pObj) {
+ if (aCon2.pObj!=NULL) aCon2.pObj->RemoveListener(*this);
+ aCon2=rEGeo.aCon2;
+ if (aCon2.pObj!=NULL) aCon2.pObj->AddListener(*this);
+ }
+ *pEdgeTrack =*rEGeo.pEdgeTrack;
+ bEdgeTrackDirty=rEGeo.bEdgeTrackDirty;
+ bEdgeTrackUserDefined=rEGeo.bEdgeTrackUserDefined;
+ aEdgeInfo =rEGeo.aEdgeInfo;
+}
+
+Point SdrEdgeObj::GetTailPoint( sal_Bool bTail ) const
+{
+ if( pEdgeTrack && pEdgeTrack->GetPointCount()!=0)
+ {
+ const XPolygon& rTrack0 = *pEdgeTrack;
+ if(bTail)
+ {
+ return rTrack0[0];
+ }
+ else
+ {
+ const sal_uInt16 nSiz = rTrack0.GetPointCount() - 1;
+ return rTrack0[nSiz];
+ }
+ }
+ else
+ {
+ if(bTail)
+ return aOutRect.TopLeft();
+ else
+ return aOutRect.BottomRight();
+ }
+
+}
+
+void SdrEdgeObj::SetTailPoint( sal_Bool bTail, const Point& rPt )
+{
+ ImpSetTailPoint( bTail, rPt );
+ SetChanged();
+}
+
+/** this method is used by the api to set a glue point for a connection
+ nId == -1 : The best default point is automaticly choosen
+ 0 <= nId <= 3 : One of the default points is choosen
+ nId >= 4 : A user defined glue point is choosen
+*/
+void SdrEdgeObj::setGluePointIndex( sal_Bool bTail, sal_Int32 nIndex /* = -1 */ )
+{
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetCurrentBoundRect();
+ // #110094#-14 BroadcastObjectChange();
+
+ SdrObjConnection& rConn1 = GetConnection( bTail );
+
+ rConn1.SetAutoVertex( nIndex >= 0 && nIndex <= 3 );
+ rConn1.SetBestConnection( nIndex < 0 );
+ rConn1.SetBestVertex( nIndex < 0 );
+
+ if( nIndex > 3 )
+ {
+// nIndex -= 4;
+ nIndex -= 3; // SJ: the start api index is 0, whereas the implementation in svx starts from 1
+
+ // for user defined glue points we have
+ // to get the id for this index first
+ const SdrGluePointList* pList = rConn1.GetObject() ? rConn1.GetObject()->GetGluePointList() : NULL;
+ if( pList == NULL || SDRGLUEPOINT_NOTFOUND == pList->FindGluePoint((sal_uInt16)nIndex) )
+ return;
+ }
+ else if( nIndex < 0 )
+ {
+ nIndex = 0;
+ }
+
+ rConn1.SetConnectorId( (sal_uInt16)nIndex );
+
+ SetChanged();
+ SetRectsDirty();
+ ImpRecalcEdgeTrack();
+ // bEdgeTrackDirty=sal_True;
+}
+
+/** this method is used by the api to return a glue point id for a connection.
+ See setGluePointId for possible return values */
+sal_Int32 SdrEdgeObj::getGluePointIndex( sal_Bool bTail )
+{
+ SdrObjConnection& rConn1 = GetConnection( bTail );
+ sal_Int32 nId = -1;
+ if( !rConn1.IsBestConnection() )
+ {
+ nId = rConn1.GetConnectorId();
+ if( !rConn1.IsAutoVertex() )
+// nId += 4;
+ nId += 3; // SJ: the start api index is 0, whereas the implementation in svx starts from 1
+ }
+ return nId;
+}
+
+// #102344# Implementation was missing; edge track needs to be invalidated additionally.
+void SdrEdgeObj::NbcSetAnchorPos(const Point& rPnt)
+{
+ // call parent functionality
+ SdrTextObj::NbcSetAnchorPos(rPnt);
+
+ // Additionally, invalidate edge track
+ ImpDirtyEdgeTrack();
+}
+
+sal_Bool SdrEdgeObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const
+{
+ // use base method from SdrObject, it's not rotatable and
+ // a call to GetSnapRect() is used. That's what we need for Connector.
+ return SdrObject::TRGetBaseGeometry(rMatrix, rPolyPolygon);
+}
+
+void SdrEdgeObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon)
+{
+ // evtl. take care for existing connections. For now, just use the
+ // implementation from SdrObject.
+ SdrObject::TRSetBaseGeometry(rMatrix, rPolyPolygon);
+}
+
+// for geometry access
+::basegfx::B2DPolygon SdrEdgeObj::getEdgeTrack() const
+{
+ if(bEdgeTrackDirty)
+ {
+ const_cast< SdrEdgeObj* >(this)->ImpRecalcEdgeTrack();
+ }
+
+ if(pEdgeTrack)
+ {
+ return pEdgeTrack->getB2DPolygon();
+ }
+ else
+ {
+ return ::basegfx::B2DPolygon();
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
new file mode 100644
index 000000000000..adfc7d0ba991
--- /dev/null
+++ b/svx/source/svdraw/svdograf.cxx
@@ -0,0 +1,1426 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#define _ANIMATION
+#include <unotools/streamwrap.hxx>
+
+#include <sfx2/lnkbase.hxx>
+#include <math.h>
+#include <vcl/salbtype.hxx>
+#include <sot/formats.hxx>
+#include <sot/storage.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <svl/style.hxx>
+#include <svtools/filter.hxx>
+#include <svl/urihelper.hxx>
+#include <svtools/grfmgr.hxx>
+#include <vcl/svapp.hxx>
+
+#include <sfx2/linkmgr.hxx>
+#include <sfx2/docfile.hxx>
+#include <svx/svdetc.hxx>
+#include "svx/svdglob.hxx"
+#include "svx/svdstr.hrc"
+#include <svx/svdpool.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdmrkv.hxx>
+#include <svx/svdpagv.hxx>
+#include "svx/svdviter.hxx"
+#include <svx/svdview.hxx>
+#include "svtools/filter.hxx"
+#include <svx/svdograf.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/xbitmap.hxx>
+#include <svx/xbtmpit.hxx>
+#include <svx/xflbmtit.hxx>
+#include <svx/svdundo.hxx>
+#include "svdfmtf.hxx"
+#include <svx/sdgcpitm.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/sdr/properties/graphicproperties.hxx>
+#include <svx/sdr/contact/viewcontactofgraphic.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <osl/thread.hxx>
+#include <vos/mutex.hxx>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::io;
+
+// -----------
+// - Defines -
+// -----------
+
+#define GRAFSTREAMPOS_INVALID 0xffffffff
+#define SWAPGRAPHIC_TIMEOUT 5000
+
+
+// ------------------
+// - SdrGraphicLink -
+// ------------------
+
+
+const Graphic ImpLoadLinkedGraphic( const String& rFileName, const String& rFilterName )
+{
+ Graphic aGraphic;
+
+ SfxMedium xMed( rFileName, STREAM_STD_READ, sal_True );
+ xMed.DownLoad();
+
+ SvStream* pInStrm = xMed.GetInStream();
+ if ( pInStrm )
+ {
+ pInStrm->Seek( STREAM_SEEK_TO_BEGIN );
+ GraphicFilter* pGF = GraphicFilter::GetGraphicFilter();
+
+ const sal_uInt16 nFilter = rFilterName.Len() && pGF->GetImportFormatCount()
+ ? pGF->GetImportFormatNumber( rFilterName )
+ : GRFILTER_FORMAT_DONTKNOW;
+
+ String aEmptyStr;
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > aFilterData( 1 );
+
+ // Room for improvment:
+ // As this is a linked graphic the GfxLink is not needed if saving/loading our own format.
+ // But this link is required by some filters to access the native graphic (pdf export/ms export),
+ // there we should create a new service to provide this data if needed
+ aFilterData[ 0 ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CreateNativeLink" ) );
+ aFilterData[ 0 ].Value = Any( sal_True );
+ pGF->ImportGraphic( aGraphic, aEmptyStr, *pInStrm, nFilter, NULL, 0, &aFilterData );
+ }
+ return aGraphic;
+}
+
+class SdrGraphicUpdater;
+class SdrGraphicLink : public sfx2::SvBaseLink
+{
+ SdrGrafObj* pGrafObj;
+ SdrGraphicUpdater* pGraphicUpdater;
+
+public:
+ SdrGraphicLink(SdrGrafObj* pObj);
+ virtual ~SdrGraphicLink();
+
+ virtual void Closed();
+ virtual void DataChanged( const String& rMimeType,
+ const ::com::sun::star::uno::Any & rValue );
+ void DataChanged( const Graphic& rGraphic );
+
+ sal_Bool Connect() { return 0 != GetRealObject(); }
+ void UpdateAsynchron();
+ void RemoveGraphicUpdater();
+};
+
+class SdrGraphicUpdater : public ::osl::Thread
+{
+public:
+ SdrGraphicUpdater( const String& rFileName, const String& rFilterName, SdrGraphicLink& );
+ virtual ~SdrGraphicUpdater( void );
+
+ void SAL_CALL Terminate( void );
+
+ sal_Bool GraphicLinkChanged( const String& rFileName ){ return mrFileName != rFileName; };
+
+protected:
+
+ /** is called from the inherited create method and acts as the
+ main function of this thread.
+ */
+ virtual void SAL_CALL run(void);
+
+ /** Called after the thread is terminated via the terminate
+ method. Used to kill the thread by calling delete on this.
+ */
+ virtual void SAL_CALL onTerminated(void);
+
+private:
+
+ ::osl::Mutex maMutex;
+ const String& mrFileName;
+ const String& mrFilterName;
+ SdrGraphicLink& mrGraphicLink;
+
+ volatile bool mbIsTerminated;
+};
+
+SdrGraphicUpdater::SdrGraphicUpdater( const String& rFileName, const String& rFilterName, SdrGraphicLink& rGraphicLink )
+: mrFileName( rFileName )
+, mrFilterName( rFilterName )
+, mrGraphicLink( rGraphicLink )
+, mbIsTerminated( sal_False )
+{
+ create();
+}
+
+SdrGraphicUpdater::~SdrGraphicUpdater( void )
+{
+}
+
+void SdrGraphicUpdater::Terminate()
+{
+ ::osl::MutexGuard aGuard( maMutex );
+ mbIsTerminated = sal_True;
+}
+
+void SAL_CALL SdrGraphicUpdater::onTerminated(void)
+{
+ delete this;
+}
+
+void SAL_CALL SdrGraphicUpdater::run(void)
+{
+ Graphic aGraphic( ImpLoadLinkedGraphic( mrFileName, mrFilterName ) );
+ ::osl::MutexGuard aGuard(maMutex);
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ if ( !mbIsTerminated )
+ {
+ mrGraphicLink.DataChanged( aGraphic );
+ mrGraphicLink.RemoveGraphicUpdater();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+SdrGraphicLink::SdrGraphicLink(SdrGrafObj* pObj)
+: ::sfx2::SvBaseLink( ::sfx2::LINKUPDATE_ONCALL, SOT_FORMATSTR_ID_SVXB )
+, pGrafObj( pObj )
+, pGraphicUpdater( NULL )
+{
+ SetSynchron( sal_False );
+}
+
+// -----------------------------------------------------------------------------
+
+SdrGraphicLink::~SdrGraphicLink()
+{
+ if ( pGraphicUpdater )
+ pGraphicUpdater->Terminate();
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGraphicLink::DataChanged( const Graphic& rGraphic )
+{
+ pGrafObj->ImpSetLinkedGraphic( rGraphic );
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGraphicLink::RemoveGraphicUpdater()
+{
+ pGraphicUpdater = NULL;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGraphicLink::DataChanged( const String& rMimeType,
+ const ::com::sun::star::uno::Any & rValue )
+{
+ SdrModel* pModel = pGrafObj ? pGrafObj->GetModel() : 0;
+ sfx2::LinkManager* pLinkManager= pModel ? pModel->GetLinkManager() : 0;
+
+ if( pLinkManager && rValue.hasValue() )
+ {
+ pLinkManager->GetDisplayNames( this, 0, &pGrafObj->aFileName, 0, &pGrafObj->aFilterName );
+
+ Graphic aGraphic;
+ if( sfx2::LinkManager::GetGraphicFromAny( rMimeType, rValue, aGraphic ))
+ {
+ pGrafObj->NbcSetGraphic( aGraphic );
+ pGrafObj->ActionChanged();
+ }
+ else if( SotExchange::GetFormatIdFromMimeType( rMimeType ) != sfx2::LinkManager::RegisterStatusInfoId() )
+ {
+ // broadcasting, to update slidesorter
+ pGrafObj->BroadcastObjectChange();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGraphicLink::Closed()
+{
+ // Die Verbindung wird aufgehoben; pLink des Objekts auf NULL setzen, da die Link-Instanz ja gerade destruiert wird.
+ pGrafObj->ForceSwapIn();
+ pGrafObj->pGraphicLink=NULL;
+ pGrafObj->ReleaseGraphicLink();
+ SvBaseLink::Closed();
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGraphicLink::UpdateAsynchron()
+{
+ if( GetObj() )
+ {
+ if ( pGraphicUpdater )
+ {
+ if ( pGraphicUpdater->GraphicLinkChanged( pGrafObj->GetFileName() ) )
+ {
+ pGraphicUpdater->Terminate();
+ pGraphicUpdater = new SdrGraphicUpdater( pGrafObj->GetFileName(), pGrafObj->GetFilterName(), *this );
+ }
+ }
+ else
+ pGraphicUpdater = new SdrGraphicUpdater( pGrafObj->GetFileName(), pGrafObj->GetFilterName(), *this );
+ }
+}
+
+// --------------
+// - SdrGrafObj -
+// --------------
+
+//////////////////////////////////////////////////////////////////////////////
+// BaseProperties section
+
+sdr::properties::BaseProperties* SdrGrafObj::CreateObjectSpecificProperties()
+{
+ return new sdr::properties::GraphicProperties(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// DrawContact section
+
+sdr::contact::ViewContact* SdrGrafObj::CreateObjectSpecificViewContact()
+{
+ return new sdr::contact::ViewContactOfGraphic(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(SdrGrafObj,SdrRectObj);
+
+// -----------------------------------------------------------------------------
+
+SdrGrafObj::SdrGrafObj()
+: SdrRectObj(),
+ pGraphicLink ( NULL ),
+ bMirrored ( sal_False )
+{
+ pGraphic = new GraphicObject;
+ pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
+ bNoShear = sal_True;
+
+ // #111096#
+ mbGrafAnimationAllowed = sal_True;
+
+ // #i25616#
+ mbLineIsOutsideGeometry = sal_True;
+ mbInsidePaint = sal_False;
+ mbIsPreview = sal_False;
+
+ // #i25616#
+ mbSupportTextIndentingOnLineWidthChange = sal_False;
+}
+
+// -----------------------------------------------------------------------------
+
+SdrGrafObj::SdrGrafObj(const Graphic& rGrf, const Rectangle& rRect)
+: SdrRectObj ( rRect ),
+ pGraphicLink ( NULL ),
+ bMirrored ( sal_False )
+{
+ pGraphic = new GraphicObject( rGrf );
+ pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
+ bNoShear = sal_True;
+
+ // #111096#
+ mbGrafAnimationAllowed = sal_True;
+
+ // #i25616#
+ mbLineIsOutsideGeometry = sal_True;
+ mbInsidePaint = sal_False;
+ mbIsPreview = sal_False;
+
+ // #i25616#
+ mbSupportTextIndentingOnLineWidthChange = sal_False;
+}
+
+// -----------------------------------------------------------------------------
+
+SdrGrafObj::SdrGrafObj( const Graphic& rGrf )
+: SdrRectObj(),
+ pGraphicLink ( NULL ),
+ bMirrored ( sal_False )
+{
+ pGraphic = new GraphicObject( rGrf );
+ pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
+ bNoShear = sal_True;
+
+ // #111096#
+ mbGrafAnimationAllowed = sal_True;
+
+ // #i25616#
+ mbLineIsOutsideGeometry = sal_True;
+ mbInsidePaint = sal_False;
+ mbIsPreview = sal_False;
+
+ // #i25616#
+ mbSupportTextIndentingOnLineWidthChange = sal_False;
+}
+
+// -----------------------------------------------------------------------------
+
+SdrGrafObj::~SdrGrafObj()
+{
+ delete pGraphic;
+ ImpLinkAbmeldung();
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::SetGraphicObject( const GraphicObject& rGrfObj )
+{
+ *pGraphic = rGrfObj;
+ pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
+ pGraphic->SetUserData();
+ mbIsPreview = sal_False;
+ SetChanged();
+ BroadcastObjectChange();
+}
+
+// -----------------------------------------------------------------------------
+
+const GraphicObject& SdrGrafObj::GetGraphicObject(bool bForceSwapIn) const
+{
+ if(bForceSwapIn)
+ {
+ ForceSwapIn();
+ }
+
+ return *pGraphic;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::NbcSetGraphic( const Graphic& rGrf )
+{
+ pGraphic->SetGraphic( rGrf );
+ pGraphic->SetUserData();
+ mbIsPreview = sal_False;
+}
+
+void SdrGrafObj::SetGraphic( const Graphic& rGrf )
+{
+ NbcSetGraphic(rGrf);
+ SetChanged();
+ BroadcastObjectChange();
+}
+
+// -----------------------------------------------------------------------------
+
+const Graphic& SdrGrafObj::GetGraphic() const
+{
+ ForceSwapIn();
+ return pGraphic->GetGraphic();
+}
+
+// -----------------------------------------------------------------------------
+
+Graphic SdrGrafObj::GetTransformedGraphic( sal_uIntPtr nTransformFlags ) const
+{
+ // #107947# Refactored most of the code to GraphicObject, where
+ // everybody can use e.g. the cropping functionality
+
+ GraphicType eType = GetGraphicType();
+ MapMode aDestMap( pModel->GetScaleUnit(), Point(), pModel->GetScaleFraction(), pModel->GetScaleFraction() );
+ const Size aDestSize( GetLogicRect().GetSize() );
+ const sal_Bool bMirror = ( nTransformFlags & SDRGRAFOBJ_TRANSFORMATTR_MIRROR ) != 0;
+ const sal_Bool bRotate = ( ( nTransformFlags & SDRGRAFOBJ_TRANSFORMATTR_ROTATE ) != 0 ) &&
+ ( aGeo.nDrehWink && aGeo.nDrehWink != 18000 ) && ( GRAPHIC_NONE != eType );
+
+ // #104115# Need cropping info earlier
+ ( (SdrGrafObj*) this )->ImpSetAttrToGrafInfo();
+ GraphicAttr aActAttr;
+
+ if( SDRGRAFOBJ_TRANSFORMATTR_NONE != nTransformFlags &&
+ GRAPHIC_NONE != eType )
+ {
+ // actually transform the graphic only in this case. On the
+ // other hand, cropping will always happen
+ aActAttr = aGrafInfo;
+
+ if( bMirror )
+ {
+ sal_uInt16 nMirrorCase = ( aGeo.nDrehWink == 18000 ) ? ( bMirrored ? 3 : 4 ) : ( bMirrored ? 2 : 1 );
+ FASTBOOL bHMirr = nMirrorCase == 2 || nMirrorCase == 4;
+ FASTBOOL bVMirr = nMirrorCase == 3 || nMirrorCase == 4;
+
+ aActAttr.SetMirrorFlags( ( bHMirr ? BMP_MIRROR_HORZ : 0 ) | ( bVMirr ? BMP_MIRROR_VERT : 0 ) );
+ }
+
+ if( bRotate )
+ aActAttr.SetRotation( sal_uInt16(aGeo.nDrehWink / 10) );
+ }
+
+ // #107947# Delegate to moved code in GraphicObject
+ return GetGraphicObject().GetTransformedGraphic( aDestSize, aDestMap, aActAttr );
+}
+
+// -----------------------------------------------------------------------------
+
+GraphicType SdrGrafObj::GetGraphicType() const
+{
+ return pGraphic->GetType();
+}
+
+sal_Bool SdrGrafObj::IsAnimated() const
+{
+ return pGraphic->IsAnimated();
+}
+
+sal_Bool SdrGrafObj::IsEPS() const
+{
+ return pGraphic->IsEPS();
+}
+
+sal_Bool SdrGrafObj::IsSwappedOut() const
+{
+ return mbIsPreview ? sal_True : pGraphic->IsSwappedOut();
+}
+
+const MapMode& SdrGrafObj::GetGrafPrefMapMode() const
+{
+ return pGraphic->GetPrefMapMode();
+}
+
+const Size& SdrGrafObj::GetGrafPrefSize() const
+{
+ return pGraphic->GetPrefSize();
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::SetGrafStreamURL( const String& rGraphicStreamURL )
+{
+ mbIsPreview = sal_False;
+ if( !rGraphicStreamURL.Len() )
+ {
+ pGraphic->SetUserData();
+ }
+ else if( pModel->IsSwapGraphics() )
+ {
+ pGraphic->SetUserData( rGraphicStreamURL );
+
+ // set state of graphic object to 'swapped out'
+ if( pGraphic->GetType() == GRAPHIC_NONE )
+ pGraphic->SetSwapState();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+String SdrGrafObj::GetGrafStreamURL() const
+{
+ return pGraphic->GetUserData();
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::SetFileName(const String& rFileName)
+{
+ aFileName = rFileName;
+ SetChanged();
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::SetFilterName(const String& rFilterName)
+{
+ aFilterName = rFilterName;
+ SetChanged();
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::ForceSwapIn() const
+{
+ if( mbIsPreview )
+ {
+ // removing preview graphic
+ const String aUserData( pGraphic->GetUserData() );
+
+ Graphic aEmpty;
+ pGraphic->SetGraphic( aEmpty );
+ pGraphic->SetUserData( aUserData );
+ pGraphic->SetSwapState();
+
+ const_cast< SdrGrafObj* >( this )->mbIsPreview = sal_False;
+ }
+ if ( pGraphicLink && pGraphic->IsSwappedOut() )
+ ImpUpdateGraphicLink( sal_False );
+ else
+ pGraphic->FireSwapInRequest();
+
+ if( pGraphic->IsSwappedOut() ||
+ ( pGraphic->GetType() == GRAPHIC_NONE ) ||
+ ( pGraphic->GetType() == GRAPHIC_DEFAULT ) )
+ {
+ Graphic aDefaultGraphic;
+ aDefaultGraphic.SetDefaultType();
+ pGraphic->SetGraphic( aDefaultGraphic );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::ForceSwapOut() const
+{
+ pGraphic->FireSwapOutRequest();
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::ImpLinkAnmeldung()
+{
+ sfx2::LinkManager* pLinkManager = pModel != NULL ? pModel->GetLinkManager() : NULL;
+
+ if( pLinkManager != NULL && pGraphicLink == NULL )
+ {
+ if( aFileName.Len() )
+ {
+ pGraphicLink = new SdrGraphicLink( this );
+ pLinkManager->InsertFileLink( *pGraphicLink, OBJECT_CLIENT_GRF, aFileName, ( aFilterName.Len() ? &aFilterName : NULL ), NULL );
+ pGraphicLink->Connect();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::ImpLinkAbmeldung()
+{
+ sfx2::LinkManager* pLinkManager = pModel != NULL ? pModel->GetLinkManager() : NULL;
+
+ if( pLinkManager != NULL && pGraphicLink!=NULL)
+ {
+ // Bei Remove wird *pGraphicLink implizit deleted
+ pLinkManager->Remove( pGraphicLink );
+ pGraphicLink=NULL;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::SetGraphicLink( const String& rFileName, const String& rFilterName )
+{
+ ImpLinkAbmeldung();
+ aFileName = rFileName;
+ aFilterName = rFilterName;
+ ImpLinkAnmeldung();
+ pGraphic->SetUserData();
+
+ // #92205# A linked graphic is per definition swapped out (has to be loaded)
+ pGraphic->SetSwapState();
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::ReleaseGraphicLink()
+{
+ ImpLinkAbmeldung();
+ aFileName = String();
+ aFilterName = String();
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
+{
+ FASTBOOL bAnim = pGraphic->IsAnimated();
+ FASTBOOL bNoPresGrf = ( pGraphic->GetType() != GRAPHIC_NONE ) && !bEmptyPresObj;
+
+ rInfo.bResizeFreeAllowed = aGeo.nDrehWink % 9000 == 0 ||
+ aGeo.nDrehWink % 18000 == 0 ||
+ aGeo.nDrehWink % 27000 == 0;
+
+ rInfo.bResizePropAllowed = sal_True;
+ rInfo.bRotateFreeAllowed = bNoPresGrf && !bAnim;
+ rInfo.bRotate90Allowed = bNoPresGrf && !bAnim;
+ rInfo.bMirrorFreeAllowed = bNoPresGrf && !bAnim;
+ rInfo.bMirror45Allowed = bNoPresGrf && !bAnim;
+ rInfo.bMirror90Allowed = !bEmptyPresObj;
+ rInfo.bTransparenceAllowed = sal_False;
+ rInfo.bGradientAllowed = sal_False;
+ rInfo.bShearAllowed = sal_False;
+ rInfo.bEdgeRadiusAllowed=sal_False;
+ rInfo.bCanConvToPath = sal_False;
+ rInfo.bCanConvToPathLineToArea = sal_False;
+ rInfo.bCanConvToPolyLineToArea = sal_False;
+ rInfo.bCanConvToPoly = !IsEPS();
+ rInfo.bCanConvToContour = (rInfo.bCanConvToPoly || LineGeometryUsageIsNecessary());
+}
+
+// -----------------------------------------------------------------------------
+
+sal_uInt16 SdrGrafObj::GetObjIdentifier() const
+{
+ return sal_uInt16( OBJ_GRAF );
+}
+
+// -----------------------------------------------------------------------------
+
+/* The graphic of the GraphicLink will be loaded. If it is called with
+ bAsynchron = true then the graphic will be set later via DataChanged
+*/
+sal_Bool SdrGrafObj::ImpUpdateGraphicLink( sal_Bool bAsynchron ) const
+{
+ sal_Bool bRet = sal_False;
+ if( pGraphicLink )
+ {
+ if ( bAsynchron )
+ pGraphicLink->UpdateAsynchron();
+ else
+ pGraphicLink->DataChanged( ImpLoadLinkedGraphic( aFileName, aFilterName ) );
+ bRet = sal_True;
+ }
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::ImpSetLinkedGraphic( const Graphic& rGraphic )
+{
+ const sal_Bool bIsChanged = GetModel()->IsChanged();
+ NbcSetGraphic( rGraphic );
+ ActionChanged();
+ BroadcastObjectChange();
+ GetModel()->SetChanged( bIsChanged );
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::TakeObjNameSingul(XubString& rName) const
+{
+ switch( pGraphic->GetType() )
+ {
+ case GRAPHIC_BITMAP:
+ {
+ const sal_uInt16 nId = ( ( pGraphic->IsTransparent() || ( (const SdrGrafTransparenceItem&) GetObjectItem( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ) ?
+ ( IsLinkedGraphic() ? STR_ObjNameSingulGRAFBMPTRANSLNK : STR_ObjNameSingulGRAFBMPTRANS ) :
+ ( IsLinkedGraphic() ? STR_ObjNameSingulGRAFBMPLNK : STR_ObjNameSingulGRAFBMP ) );
+
+ rName=ImpGetResStr( nId );
+ }
+ break;
+
+ case GRAPHIC_GDIMETAFILE:
+ rName=ImpGetResStr( IsLinkedGraphic() ? STR_ObjNameSingulGRAFMTFLNK : STR_ObjNameSingulGRAFMTF );
+ break;
+
+ case GRAPHIC_NONE:
+ rName=ImpGetResStr( IsLinkedGraphic() ? STR_ObjNameSingulGRAFNONELNK : STR_ObjNameSingulGRAFNONE );
+ break;
+
+ default:
+ rName=ImpGetResStr( IsLinkedGraphic() ? STR_ObjNameSingulGRAFLNK : STR_ObjNameSingulGRAF );
+ break;
+ }
+
+ const String aName(GetName());
+
+ if( aName.Len() )
+ {
+ rName.AppendAscii( " '" );
+ rName += aName;
+ rName += sal_Unicode( '\'' );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::TakeObjNamePlural( XubString& rName ) const
+{
+ switch( pGraphic->GetType() )
+ {
+ case GRAPHIC_BITMAP:
+ {
+ const sal_uInt16 nId = ( ( pGraphic->IsTransparent() || ( (const SdrGrafTransparenceItem&) GetObjectItem( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ) ?
+ ( IsLinkedGraphic() ? STR_ObjNamePluralGRAFBMPTRANSLNK : STR_ObjNamePluralGRAFBMPTRANS ) :
+ ( IsLinkedGraphic() ? STR_ObjNamePluralGRAFBMPLNK : STR_ObjNamePluralGRAFBMP ) );
+
+ rName=ImpGetResStr( nId );
+ }
+ break;
+
+ case GRAPHIC_GDIMETAFILE:
+ rName=ImpGetResStr( IsLinkedGraphic() ? STR_ObjNamePluralGRAFMTFLNK : STR_ObjNamePluralGRAFMTF );
+ break;
+
+ case GRAPHIC_NONE:
+ rName=ImpGetResStr( IsLinkedGraphic() ? STR_ObjNamePluralGRAFNONELNK : STR_ObjNamePluralGRAFNONE );
+ break;
+
+ default:
+ rName=ImpGetResStr( IsLinkedGraphic() ? STR_ObjNamePluralGRAFLNK : STR_ObjNamePluralGRAF );
+ break;
+ }
+
+ const String aName(GetName());
+
+ if( aName.Len() )
+ {
+ rName.AppendAscii( " '" );
+ rName += aName;
+ rName += sal_Unicode( '\'' );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+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 );
+
+ const SdrGrafObj& rGraf = (SdrGrafObj&) rObj;
+
+ pGraphic->SetGraphic( rGraf.GetGraphic(), &rGraf.GetGraphicObject() );
+ aCropRect = rGraf.aCropRect;
+ aFileName = rGraf.aFileName;
+ aFilterName = rGraf.aFilterName;
+ bMirrored = rGraf.bMirrored;
+
+ if( rGraf.pGraphicLink != NULL)
+ {
+ SetGraphicLink( aFileName, aFilterName );
+ }
+
+ ImpSetAttrToGrafInfo();
+}
+
+// -----------------------------------------------------------------------------
+// #i25616#
+
+basegfx::B2DPolyPolygon SdrGrafObj::TakeXorPoly() const
+{
+ if(mbInsidePaint)
+ {
+ basegfx::B2DPolyPolygon aRetval;
+
+ // take grown rectangle
+ const sal_Int32 nHalfLineWidth(ImpGetLineWdt() / 2);
+ const Rectangle aGrownRect(
+ aRect.Left() - nHalfLineWidth,
+ aRect.Top() - nHalfLineWidth,
+ aRect.Right() + nHalfLineWidth,
+ aRect.Bottom() + nHalfLineWidth);
+
+ XPolygon aXPoly(ImpCalcXPoly(aGrownRect, GetEckenradius()));
+ aRetval.append(aXPoly.getB2DPolygon());
+
+ return aRetval;
+ }
+ else
+ {
+ // call parent
+ return SdrRectObj::TakeXorPoly();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+sal_uInt32 SdrGrafObj::GetHdlCount() const
+{
+ return 8L;
+}
+
+// -----------------------------------------------------------------------------
+
+SdrHdl* SdrGrafObj::GetHdl(sal_uInt32 nHdlNum) const
+{
+ return SdrRectObj::GetHdl( nHdlNum + 1L );
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+{
+ SdrRectObj::NbcResize( rRef, xFact, yFact );
+
+ FASTBOOL bMirrX = xFact.GetNumerator() < 0;
+ FASTBOOL bMirrY = yFact.GetNumerator() < 0;
+
+ if( bMirrX != bMirrY )
+ bMirrored = !bMirrored;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
+{
+ SdrRectObj::NbcRotate(rRef,nWink,sn,cs);
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::NbcMirror(const Point& rRef1, const Point& rRef2)
+{
+ SdrRectObj::NbcMirror(rRef1,rRef2);
+ bMirrored = !bMirrored;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
+{
+ SdrRectObj::NbcRotate( rRef, nWink, tn, bVShear );
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::NbcSetSnapRect(const Rectangle& rRect)
+{
+ SdrRectObj::NbcSetSnapRect(rRect);
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::NbcSetLogicRect( const Rectangle& rRect)
+{
+ //int bChg=rRect.GetSize()!=aRect.GetSize();
+ SdrRectObj::NbcSetLogicRect(rRect);
+}
+
+// -----------------------------------------------------------------------------
+
+SdrObjGeoData* SdrGrafObj::NewGeoData() const
+{
+ return new SdrGrafObjGeoData;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::SaveGeoData(SdrObjGeoData& rGeo) const
+{
+ SdrRectObj::SaveGeoData(rGeo);
+ SdrGrafObjGeoData& rGGeo=(SdrGrafObjGeoData&)rGeo;
+ rGGeo.bMirrored=bMirrored;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::RestGeoData(const SdrObjGeoData& rGeo)
+{
+ //long nDrehMerk = aGeo.nDrehWink;
+ //long nShearMerk = aGeo.nShearWink;
+ //int bMirrMerk = bMirrored;
+ Size aSizMerk( aRect.GetSize() );
+
+ SdrRectObj::RestGeoData(rGeo);
+ SdrGrafObjGeoData& rGGeo=(SdrGrafObjGeoData&)rGeo;
+ bMirrored=rGGeo.bMirrored;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::SetPage( SdrPage* pNewPage )
+{
+ FASTBOOL bRemove = pNewPage == NULL && pPage != NULL;
+ FASTBOOL bInsert = pNewPage != NULL && pPage == NULL;
+
+ if( bRemove )
+ {
+ // hier kein SwapIn noetig, weil wenn nicht geladen, dann auch nicht animiert.
+ if( pGraphic->IsAnimated())
+ pGraphic->StopAnimation();
+
+ if( pGraphicLink != NULL )
+ ImpLinkAbmeldung();
+ }
+
+ SdrRectObj::SetPage( pNewPage );
+
+ if(aFileName.Len() && bInsert)
+ ImpLinkAnmeldung();
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::SetModel( SdrModel* pNewModel )
+{
+ FASTBOOL bChg = pNewModel != pModel;
+
+ if( bChg )
+ {
+ if( pGraphic->HasUserData() )
+ {
+ ForceSwapIn();
+ pGraphic->SetUserData();
+ }
+
+ if( pGraphicLink != NULL )
+ ImpLinkAbmeldung();
+ }
+
+ // Model umsetzen
+ SdrRectObj::SetModel(pNewModel);
+
+ if( bChg && aFileName.Len() )
+ ImpLinkAnmeldung();
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::StartAnimation( OutputDevice* /*pOutDev*/, const Point& /*rPoint*/, const Size& /*rSize*/, long /*nExtraData*/)
+{
+ // #111096#
+ // use new graf animation
+ SetGrafAnimationAllowed(sal_True);
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::StopAnimation(OutputDevice* /*pOutDev*/, long /*nExtraData*/)
+{
+ // #111096#
+ // use new graf animation
+ SetGrafAnimationAllowed(sal_False);
+}
+
+// -----------------------------------------------------------------------------
+
+FASTBOOL SdrGrafObj::HasGDIMetaFile() const
+{
+ return( pGraphic->GetType() == GRAPHIC_GDIMETAFILE );
+}
+
+// -----------------------------------------------------------------------------
+
+const GDIMetaFile* SdrGrafObj::GetGDIMetaFile() const
+{
+ DBG_ERROR( "Invalid return value! Don't use it! (KA)" );
+ return &GetGraphic().GetGDIMetaFile();
+}
+
+// -----------------------------------------------------------------------------
+
+SdrObject* SdrGrafObj::DoConvertToPolyObj(sal_Bool bBezier) const
+{
+ SdrObject* pRetval = NULL;
+
+ switch( GetGraphicType() )
+ {
+ case GRAPHIC_GDIMETAFILE:
+ {
+ // NUR die aus dem MetaFile erzeugbaren Objekte in eine Gruppe packen und zurueckliefern
+ SdrObjGroup* pGrp = new SdrObjGroup();
+ ImpSdrGDIMetaFileImport aFilter(*GetModel());
+ Point aOutPos( aRect.TopLeft() );
+ const Size aOutSiz( aRect.GetSize() );
+
+ aFilter.SetScaleRect(GetSnapRect());
+ aFilter.SetLayer(GetLayer());
+
+ sal_uInt32 nInsAnz = aFilter.DoImport(GetTransformedGraphic().GetGDIMetaFile(), *pGrp->GetSubList(), 0);
+ if(nInsAnz)
+ {
+ pRetval = pGrp;
+ pGrp->NbcSetLayer(GetLayer());
+ pGrp->SetModel(GetModel());
+ pRetval = ImpConvertAddText(pRetval, bBezier);
+
+ // convert all children
+ if( pRetval )
+ {
+ SdrObject* pHalfDone = pRetval;
+ pRetval = pHalfDone->DoConvertToPolyObj(bBezier);
+ SdrObject::Free( pHalfDone ); // resulting object is newly created
+
+ if( pRetval )
+ {
+ // flatten subgroups. As we call
+ // DoConvertToPolyObj() on the resulting group
+ // objects, subgroups can exist (e.g. text is
+ // a group object for every line).
+ SdrObjList* pList = pRetval->GetSubList();
+ if( pList )
+ pList->FlattenGroups();
+ }
+ }
+ }
+ else
+ delete pGrp;
+ break;
+ }
+ case GRAPHIC_BITMAP:
+ {
+ // Grundobjekt kreieren und Fuellung ergaenzen
+ pRetval = SdrRectObj::DoConvertToPolyObj(bBezier);
+
+ // Bitmap als Attribut retten
+ if(pRetval)
+ {
+ // Bitmap als Fuellung holen
+ SfxItemSet aSet(GetObjectItemSet());
+
+ aSet.Put(XFillStyleItem(XFILL_BITMAP));
+ Bitmap aBitmap( GetTransformedGraphic().GetBitmap() );
+ XOBitmap aXBmp(aBitmap, XBITMAP_STRETCH);
+ aSet.Put(XFillBitmapItem(String(), aXBmp));
+ aSet.Put(XFillBmpTileItem(sal_False));
+
+ pRetval->SetMergedItemSet(aSet);
+ }
+ break;
+ }
+ case GRAPHIC_NONE:
+ case GRAPHIC_DEFAULT:
+ {
+ pRetval = SdrRectObj::DoConvertToPolyObj(bBezier);
+ break;
+ }
+ }
+
+ return pRetval;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
+{
+ SetXPolyDirty();
+ SdrRectObj::Notify( rBC, rHint );
+ ImpSetAttrToGrafInfo();
+}
+
+void SdrGrafObj::ImpSetAttrToGrafInfo()
+{
+ const SfxItemSet& rSet = GetObjectItemSet();
+ const sal_uInt16 nTrans = ( (SdrGrafTransparenceItem&) rSet.Get( SDRATTR_GRAFTRANSPARENCE ) ).GetValue();
+ const SdrGrafCropItem& rCrop = (const SdrGrafCropItem&) rSet.Get( SDRATTR_GRAFCROP );
+
+ aGrafInfo.SetLuminance( ( (SdrGrafLuminanceItem&) rSet.Get( SDRATTR_GRAFLUMINANCE ) ).GetValue() );
+ aGrafInfo.SetContrast( ( (SdrGrafContrastItem&) rSet.Get( SDRATTR_GRAFCONTRAST ) ).GetValue() );
+ aGrafInfo.SetChannelR( ( (SdrGrafRedItem&) rSet.Get( SDRATTR_GRAFRED ) ).GetValue() );
+ aGrafInfo.SetChannelG( ( (SdrGrafGreenItem&) rSet.Get( SDRATTR_GRAFGREEN ) ).GetValue() );
+ aGrafInfo.SetChannelB( ( (SdrGrafBlueItem&) rSet.Get( SDRATTR_GRAFBLUE ) ).GetValue() );
+ aGrafInfo.SetGamma( ( (SdrGrafGamma100Item&) rSet.Get( SDRATTR_GRAFGAMMA ) ).GetValue() * 0.01 );
+ aGrafInfo.SetTransparency( (sal_uInt8) FRound( Min( nTrans, (sal_uInt16) 100 ) * 2.55 ) );
+ aGrafInfo.SetInvert( ( (SdrGrafInvertItem&) rSet.Get( SDRATTR_GRAFINVERT ) ).GetValue() );
+ aGrafInfo.SetDrawMode( ( (SdrGrafModeItem&) rSet.Get( SDRATTR_GRAFMODE ) ).GetValue() );
+ aGrafInfo.SetCrop( rCrop.GetLeft(), rCrop.GetTop(), rCrop.GetRight(), rCrop.GetBottom() );
+
+ SetXPolyDirty();
+ SetRectsDirty();
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::ImpSetGrafInfoToAttr()
+{
+ SetObjectItem( SdrGrafLuminanceItem( aGrafInfo.GetLuminance() ) );
+ SetObjectItem( SdrGrafContrastItem( aGrafInfo.GetContrast() ) );
+ SetObjectItem( SdrGrafRedItem( aGrafInfo.GetChannelR() ) );
+ SetObjectItem( SdrGrafGreenItem( aGrafInfo.GetChannelG() ) );
+ SetObjectItem( SdrGrafBlueItem( aGrafInfo.GetChannelB() ) );
+ SetObjectItem( SdrGrafGamma100Item( FRound( aGrafInfo.GetGamma() * 100.0 ) ) );
+ SetObjectItem( SdrGrafTransparenceItem( (sal_uInt16) FRound( aGrafInfo.GetTransparency() / 2.55 ) ) );
+ SetObjectItem( SdrGrafInvertItem( aGrafInfo.IsInvert() ) );
+ SetObjectItem( SdrGrafModeItem( aGrafInfo.GetDrawMode() ) );
+ SetObjectItem( SdrGrafCropItem( aGrafInfo.GetLeftCrop(), aGrafInfo.GetTopCrop(), aGrafInfo.GetRightCrop(), aGrafInfo.GetBottomCrop() ) );
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrGrafObj::AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly )
+{
+ Size aSize;
+ Size aMaxSize( rMaxRect.GetSize() );
+ if ( pGraphic->GetPrefMapMode().GetMapUnit() == MAP_PIXEL )
+ aSize = Application::GetDefaultDevice()->PixelToLogic( pGraphic->GetPrefSize(), MAP_100TH_MM );
+ else
+ aSize = OutputDevice::LogicToLogic( pGraphic->GetPrefSize(),
+ pGraphic->GetPrefMapMode(),
+ MapMode( MAP_100TH_MM ) );
+
+ if( aSize.Height() != 0 && aSize.Width() != 0 )
+ {
+ Point aPos( rMaxRect.TopLeft() );
+
+ // Falls Grafik zu gross, wird die Grafik
+ // in die Seite eingepasst
+ if ( (!bShrinkOnly ||
+ ( aSize.Height() > aMaxSize.Height() ) ||
+ ( aSize.Width() > aMaxSize.Width() ) )&&
+ aSize.Height() && aMaxSize.Height() )
+ {
+ float fGrfWH = (float)aSize.Width() /
+ (float)aSize.Height();
+ float fWinWH = (float)aMaxSize.Width() /
+ (float)aMaxSize.Height();
+
+ // Grafik an Pagesize anpassen (skaliert)
+ if ( fGrfWH < fWinWH )
+ {
+ aSize.Width() = (long)(aMaxSize.Height() * fGrfWH);
+ aSize.Height()= aMaxSize.Height();
+ }
+ else if ( fGrfWH > 0.F )
+ {
+ aSize.Width() = aMaxSize.Width();
+ aSize.Height()= (long)(aMaxSize.Width() / fGrfWH);
+ }
+
+ aPos = rMaxRect.Center();
+ }
+
+ if( bShrinkOnly )
+ aPos = aRect.TopLeft();
+
+ aPos.X() -= aSize.Width() / 2;
+ aPos.Y() -= aSize.Height() / 2;
+ SetLogicRect( Rectangle( aPos, aSize ) );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO )
+{
+ SvStream* pRet = GRFMGR_AUTOSWAPSTREAM_NONE;
+
+ if( pO->IsInSwapOut() )
+ {
+ if( pModel && !mbIsPreview && pModel->IsSwapGraphics() && pGraphic->GetSizeBytes() > 20480 )
+ {
+ // test if this object is visualized from someone
+ // ## test only if there are VOCs other than the preview renderer
+ if(!GetViewContact().HasViewObjectContacts(true))
+ {
+ const sal_uIntPtr nSwapMode = pModel->GetSwapGraphicsMode();
+
+ if( ( pGraphic->HasUserData() || pGraphicLink ) &&
+ ( nSwapMode & SDR_SWAPGRAPHICSMODE_PURGE ) )
+ {
+ pRet = GRFMGR_AUTOSWAPSTREAM_LINK;
+ }
+ else if( nSwapMode & SDR_SWAPGRAPHICSMODE_TEMP )
+ {
+ pRet = GRFMGR_AUTOSWAPSTREAM_TEMP;
+ pGraphic->SetUserData();
+ }
+
+ // #i102380#
+ sdr::contact::ViewContactOfGraphic* pVC = dynamic_cast< sdr::contact::ViewContactOfGraphic* >(&GetViewContact());
+
+ if(pVC)
+ {
+ pVC->flushGraphicObjects();
+ }
+ }
+ }
+ }
+ else if( pO->IsInSwapIn() )
+ {
+ // kann aus dem original Doc-Stream nachgeladen werden...
+ if( pModel != NULL )
+ {
+ if( pGraphic->HasUserData() )
+ {
+ SdrDocumentStreamInfo aStreamInfo;
+
+ aStreamInfo.mbDeleteAfterUse = sal_False;
+ aStreamInfo.maUserData = pGraphic->GetUserData();
+
+ SvStream* pStream = pModel->GetDocumentStream( aStreamInfo );
+
+ if( pStream != NULL )
+ {
+ Graphic aGraphic;
+
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >* pFilterData = NULL;
+
+ if(mbInsidePaint && !GetViewContact().HasViewObjectContacts(true))
+ {
+// Rectangle aSnapRect(GetSnapRect());
+// const Rectangle aSnapRectPixel(pOutDev->LogicToPixel(aSnapRect));
+
+ pFilterData = new com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >( 3 );
+
+ com::sun::star::awt::Size aPreviewSizeHint( 64, 64 );
+ sal_Bool bAllowPartialStreamRead = sal_True;
+ sal_Bool bCreateNativeLink = sal_False;
+ (*pFilterData)[ 0 ].Name = String( RTL_CONSTASCII_USTRINGPARAM( "PreviewSizeHint" ) );
+ (*pFilterData)[ 0 ].Value <<= aPreviewSizeHint;
+ (*pFilterData)[ 1 ].Name = String( RTL_CONSTASCII_USTRINGPARAM( "AllowPartialStreamRead" ) );
+ (*pFilterData)[ 1 ].Value <<= bAllowPartialStreamRead;
+ (*pFilterData)[ 2 ].Name = String( RTL_CONSTASCII_USTRINGPARAM( "CreateNativeLink" ) );
+ (*pFilterData)[ 2 ].Value <<= bCreateNativeLink;
+
+ mbIsPreview = sal_True;
+ }
+
+ if( !GraphicFilter::GetGraphicFilter()->ImportGraphic( aGraphic, String(), *pStream,
+ GRFILTER_FORMAT_DONTKNOW, NULL, 0, pFilterData ) )
+ {
+ const String aUserData( pGraphic->GetUserData() );
+
+ pGraphic->SetGraphic( aGraphic );
+ pGraphic->SetUserData( aUserData );
+
+ // #142146# Graphic successfully swapped in.
+ pRet = GRFMGR_AUTOSWAPSTREAM_LOADED;
+ }
+ delete pFilterData;
+
+ pStream->ResetError();
+
+ if( aStreamInfo.mbDeleteAfterUse || aStreamInfo.mxStorageRef.is() )
+ {
+ if ( aStreamInfo.mxStorageRef.is() )
+ {
+ aStreamInfo.mxStorageRef->dispose();
+ aStreamInfo.mxStorageRef = 0;
+ }
+
+ delete pStream;
+ }
+ }
+ }
+ else if( !ImpUpdateGraphicLink( sal_False ) )
+ {
+ pRet = GRFMGR_AUTOSWAPSTREAM_TEMP;
+ }
+ else
+ {
+ pRet = GRFMGR_AUTOSWAPSTREAM_LOADED;
+ }
+ }
+ else
+ pRet = GRFMGR_AUTOSWAPSTREAM_TEMP;
+ }
+
+ return (long)(void*) pRet;
+}
+
+// -----------------------------------------------------------------------------
+
+// #111096#
+// Access to GrafAnimationAllowed flag
+sal_Bool SdrGrafObj::IsGrafAnimationAllowed() const
+{
+ return mbGrafAnimationAllowed;
+}
+
+void SdrGrafObj::SetGrafAnimationAllowed(sal_Bool bNew)
+{
+ if(mbGrafAnimationAllowed != bNew)
+ {
+ mbGrafAnimationAllowed = bNew;
+ ActionChanged();
+ }
+}
+
+// #i25616#
+sal_Bool SdrGrafObj::IsObjectTransparent() const
+{
+ if(((const SdrGrafTransparenceItem&)GetObjectItem(SDRATTR_GRAFTRANSPARENCE)).GetValue()
+ || pGraphic->IsTransparent())
+ {
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+Reference< XInputStream > SdrGrafObj::getInputStream()
+{
+ Reference< XInputStream > xStream;
+
+ if( pModel )
+ {
+// if( !pGraphic->HasUserData() )
+// pGraphic->SwapOut();
+
+ // kann aus dem original Doc-Stream nachgeladen werden...
+ if( pGraphic->HasUserData() )
+ {
+ SdrDocumentStreamInfo aStreamInfo;
+
+ aStreamInfo.mbDeleteAfterUse = sal_False;
+ aStreamInfo.maUserData = pGraphic->GetUserData();
+
+ SvStream* pStream = pModel->GetDocumentStream( aStreamInfo );
+
+ if( pStream )
+ xStream.set( new utl::OInputStreamWrapper( pStream, sal_True ) );
+ }
+ else if( pGraphic && GetGraphic().IsLink() )
+ {
+ Graphic aGraphic( GetGraphic() );
+ GfxLink aLink( aGraphic.GetLink() );
+ sal_uInt32 nSize = aLink.GetDataSize();
+ const void* pSourceData = (const void*)aLink.GetData();
+ if( nSize && pSourceData )
+ {
+ sal_uInt8 * pBuffer = new sal_uInt8[ nSize ];
+ if( pBuffer )
+ {
+ memcpy( pBuffer, pSourceData, nSize );
+
+ SvMemoryStream* pStream = new SvMemoryStream( (void*)pBuffer, (sal_Size)nSize, STREAM_READ );
+ pStream->ObjectOwnsMemory( sal_True );
+ xStream.set( new utl::OInputStreamWrapper( pStream, sal_True ) );
+ }
+ }
+ }
+
+ if( !xStream.is() && aFileName.Len() )
+ {
+ SvFileStream* pStream = new SvFileStream( aFileName, STREAM_READ );
+ if( pStream )
+ xStream.set( new utl::OInputStreamWrapper( pStream ) );
+ }
+ }
+
+ return xStream;
+}
+
+// eof
diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx
new file mode 100644
index 000000000000..ede6b35178f9
--- /dev/null
+++ b/svx/source/svdraw/svdogrp.cxx
@@ -0,0 +1,801 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <sfx2/linkmgr.hxx>
+
+#include <ucbhelper/content.hxx>
+#include <ucbhelper/contentbroker.hxx>
+#include <unotools/datetime.hxx>
+
+#include <svx/svdogrp.hxx>
+
+#include <sfx2/lnkbase.hxx>
+#include <tools/urlobj.hxx>
+
+#include <svl/urihelper.hxx>
+
+#include <svx/xpool.hxx>
+#include <svx/xpoly.hxx>
+
+#include <svx/svdmodel.hxx>
+#include <svx/svdpage.hxx>
+#include "svx/svditer.hxx"
+#include <svx/svdobj.hxx>
+#include <svx/svdtrans.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/svdattrx.hxx> // NotPersistItems
+#include <svx/svdoedge.hxx> // #32383# Die Verbinder nach Move nochmal anbroadcasten
+#include "svx/svdglob.hxx" // StringCache
+#include "svx/svdstr.hrc" // Objektname
+
+#include <svx/svxids.hrc>
+#include <svl/whiter.hxx>
+#include <svx/svdpool.hxx>
+#include <svx/sdr/properties/groupproperties.hxx>
+
+// #110094#
+#include <svx/sdr/contact/viewcontactofgroup.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@ @@@@@ @@@@@@ @@@@ @@@@@ @@@@ @@ @@ @@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@@@@ @@ @@ @@@ @@@@@ @@ @@ @@ @@ @@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@@@ @@@@@ @@@@ @@@@@ @@ @@ @@@@ @@@@ @@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+// BaseProperties section
+
+sdr::properties::BaseProperties* SdrObjGroup::CreateObjectSpecificProperties()
+{
+ return new sdr::properties::GroupProperties(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// #110094# DrawContact section
+
+sdr::contact::ViewContact* SdrObjGroup::CreateObjectSpecificViewContact()
+{
+ return new sdr::contact::ViewContactOfGroup(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(SdrObjGroup,SdrObject);
+
+SdrObjGroup::SdrObjGroup()
+{
+ pSub=new SdrObjList(NULL,NULL);
+ pSub->SetOwnerObj(this);
+ pSub->SetListKind(SDROBJLIST_GROUPOBJ);
+ bRefPoint=sal_False;
+ nDrehWink=0;
+ nShearWink=0;
+ bClosedObj=sal_False;
+}
+
+
+SdrObjGroup::~SdrObjGroup()
+{
+ delete pSub;
+}
+
+void SdrObjGroup::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
+{
+ rInfo.bNoContortion=sal_False;
+ SdrObjList* pOL=pSub;
+ sal_uIntPtr nObjAnz=pOL->GetObjCount();
+ for (sal_uIntPtr i=0; i<nObjAnz; i++) {
+ SdrObject* pObj=pOL->GetObj(i);
+ SdrObjTransformInfoRec aInfo;
+ pObj->TakeObjInfo(aInfo);
+ if (!aInfo.bMoveAllowed ) rInfo.bMoveAllowed =sal_False;
+ if (!aInfo.bResizeFreeAllowed ) rInfo.bResizeFreeAllowed =sal_False;
+ if (!aInfo.bResizePropAllowed ) rInfo.bResizePropAllowed =sal_False;
+ if (!aInfo.bRotateFreeAllowed ) rInfo.bRotateFreeAllowed =sal_False;
+ if (!aInfo.bRotate90Allowed ) rInfo.bRotate90Allowed =sal_False;
+ if (!aInfo.bMirrorFreeAllowed ) rInfo.bMirrorFreeAllowed =sal_False;
+ if (!aInfo.bMirror45Allowed ) rInfo.bMirror45Allowed =sal_False;
+ if (!aInfo.bMirror90Allowed ) rInfo.bMirror90Allowed =sal_False;
+ if (!aInfo.bShearAllowed ) rInfo.bShearAllowed =sal_False;
+ if (!aInfo.bEdgeRadiusAllowed ) rInfo.bEdgeRadiusAllowed =sal_False;
+ if (!aInfo.bNoOrthoDesired ) rInfo.bNoOrthoDesired =sal_False;
+ if (aInfo.bNoContortion ) rInfo.bNoContortion =sal_True;
+ if (!aInfo.bCanConvToPath ) rInfo.bCanConvToPath =sal_False;
+
+ if(!aInfo.bCanConvToContour)
+ rInfo.bCanConvToContour = sal_False;
+
+ if (!aInfo.bCanConvToPoly ) rInfo.bCanConvToPoly =sal_False;
+ if (!aInfo.bCanConvToPathLineToArea) rInfo.bCanConvToPathLineToArea=sal_False;
+ if (!aInfo.bCanConvToPolyLineToArea) rInfo.bCanConvToPolyLineToArea=sal_False;
+ }
+ if (nObjAnz==0) {
+ rInfo.bRotateFreeAllowed=sal_False;
+ rInfo.bRotate90Allowed =sal_False;
+ rInfo.bMirrorFreeAllowed=sal_False;
+ rInfo.bMirror45Allowed =sal_False;
+ rInfo.bMirror90Allowed =sal_False;
+ rInfo.bTransparenceAllowed = sal_False;
+ rInfo.bGradientAllowed = sal_False;
+ rInfo.bShearAllowed =sal_False;
+ rInfo.bEdgeRadiusAllowed=sal_False;
+ rInfo.bNoContortion =sal_True;
+ }
+ if(nObjAnz != 1)
+ {
+ // only allowed if single object selected
+ rInfo.bTransparenceAllowed = sal_False;
+ rInfo.bGradientAllowed = sal_False;
+ }
+}
+
+
+void SdrObjGroup::SetBoundRectDirty()
+{
+ // avoid resetting aOutRect which in case of this object is model data,
+ // not re-creatable view data
+}
+
+sal_uInt16 SdrObjGroup::GetObjIdentifier() const
+{
+ return sal_uInt16(OBJ_GRUP);
+}
+
+
+SdrLayerID SdrObjGroup::GetLayer() const
+{
+ FASTBOOL b1st=sal_True;
+ SdrLayerID nLay=SdrLayerID(SdrObject::GetLayer());
+ SdrObjList* pOL=pSub;
+ sal_uIntPtr nObjAnz=pOL->GetObjCount();
+ for (sal_uIntPtr i=0; i<nObjAnz; i++) {
+ SdrLayerID nLay1=pOL->GetObj(i)->GetLayer();
+ if (b1st) { nLay=nLay1; b1st=sal_False; }
+ else if (nLay1!=nLay) return 0;
+ }
+ return nLay;
+}
+
+
+void SdrObjGroup::NbcSetLayer(SdrLayerID nLayer)
+{
+ SdrObject::NbcSetLayer(nLayer);
+ SdrObjList* pOL=pSub;
+ sal_uIntPtr nObjAnz=pOL->GetObjCount();
+ for (sal_uIntPtr i=0; i<nObjAnz; i++) {
+ pOL->GetObj(i)->NbcSetLayer(nLayer);
+ }
+}
+
+
+void SdrObjGroup::SetObjList(SdrObjList* pNewObjList)
+{
+ SdrObject::SetObjList(pNewObjList);
+ pSub->SetUpList(pNewObjList);
+}
+
+
+void SdrObjGroup::SetPage(SdrPage* pNewPage)
+{
+ SdrObject::SetPage(pNewPage);
+ pSub->SetPage(pNewPage);
+}
+
+
+void SdrObjGroup::SetModel(SdrModel* pNewModel)
+{
+ if(pNewModel!=pModel)
+ {
+ // #i30648#
+ // This method also needs to migrate the used ItemSet
+ // when the destination model uses a different pool
+ // than the current one. Else it is possible to create
+ // SdrObjGroups which reference the old pool which might
+ // be destroyed (as the bug shows).
+ SdrModel* pOldModel = pModel;
+
+ // test for correct pool in ItemSet; move to new pool if necessary
+ if(pNewModel && GetObjectItemPool() && GetObjectItemPool() != &pNewModel->GetItemPool())
+ {
+ MigrateItemPool(GetObjectItemPool(), &pNewModel->GetItemPool(), pNewModel);
+ }
+
+ // call parent
+ SdrObject::SetModel(pNewModel);
+
+ // set new model at content
+ pSub->SetModel(pNewModel);
+
+ // modify properties
+ GetProperties().SetModel(pOldModel, pNewModel);
+ }
+}
+
+
+FASTBOOL SdrObjGroup::HasRefPoint() const
+{
+ return bRefPoint;
+}
+
+
+Point SdrObjGroup::GetRefPoint() const
+{
+ return aRefPoint;
+}
+
+
+void SdrObjGroup::SetRefPoint(const Point& rPnt)
+{
+ bRefPoint=sal_True;
+ aRefPoint=rPnt;
+}
+
+
+SdrObjList* SdrObjGroup::GetSubList() const
+{
+ return pSub;
+}
+
+const Rectangle& SdrObjGroup::GetCurrentBoundRect() const
+{
+ // --> OD 2007-02-01 #144962#
+ // <aOutRect> has to contain the bounding rectangle
+ if ( pSub->GetObjCount()!=0 )
+ {
+ const_cast<SdrObjGroup*>(this)->aOutRect = pSub->GetAllObjBoundRect();
+ }
+
+ return aOutRect;
+ // <--
+}
+
+
+const Rectangle& SdrObjGroup::GetSnapRect() const
+{
+ // --> OD 2007-02-01 #144962#
+ // <aOutRect> has to contain the bounding rectangle
+ if ( pSub->GetObjCount()!=0 )
+ {
+ return pSub->GetAllObjSnapRect();
+ }
+ else
+ {
+ return aOutRect;
+ }
+ // <--
+}
+
+void SdrObjGroup::operator=(const SdrObject& rObj)
+{
+ if(rObj.IsGroupObject())
+ {
+ // copy SdrObject stuff
+ SdrObject::operator=(rObj);
+
+ // #i36404#
+ // copy SubList, init model and page first
+ SdrObjList& rSourceSubList = *rObj.GetSubList();
+ pSub->SetPage(rSourceSubList.GetPage());
+ pSub->SetModel(rSourceSubList.GetModel());
+ pSub->CopyObjects(*rObj.GetSubList());
+
+ // copy local paremeters
+ nDrehWink =((SdrObjGroup&)rObj).nDrehWink;
+ nShearWink =((SdrObjGroup&)rObj).nShearWink;
+ aRefPoint =((SdrObjGroup&)rObj).aRefPoint;
+ bRefPoint =((SdrObjGroup&)rObj).bRefPoint;
+ }
+}
+
+
+void SdrObjGroup::TakeObjNameSingul(XubString& rName) const
+{
+ if(!pSub->GetObjCount())
+ {
+ rName = ImpGetResStr(STR_ObjNameSingulGRUPEMPTY);
+ }
+ else
+ {
+ rName = ImpGetResStr(STR_ObjNameSingulGRUP);
+ }
+
+ const String aName(GetName());
+
+ if(aName.Len())
+ {
+ rName += sal_Unicode(' ');
+ rName += sal_Unicode('\'');
+ rName += aName;
+ rName += sal_Unicode('\'');
+ }
+}
+
+
+void SdrObjGroup::TakeObjNamePlural(XubString& rName) const
+{
+ if (pSub->GetObjCount()==0) {
+ rName=ImpGetResStr(STR_ObjNamePluralGRUPEMPTY);
+ } else {
+ rName=ImpGetResStr(STR_ObjNamePluralGRUP);
+ }
+}
+
+
+void SdrObjGroup::RecalcSnapRect()
+{
+ // nicht erforderlich, da die Rects von der SubList verwendet werden.
+}
+
+basegfx::B2DPolyPolygon SdrObjGroup::TakeXorPoly() const
+{
+ basegfx::B2DPolyPolygon aRetval;
+ const sal_uInt32 nObjCount(pSub->GetObjCount());
+
+ for(sal_uInt32 a(0L); a < nObjCount; a++)
+ {
+ SdrObject* pObj = pSub->GetObj(a);
+ aRetval.append(pObj->TakeXorPoly());
+ }
+
+ if(!aRetval.count())
+ {
+ const basegfx::B2DRange aRange(aOutRect.Left(), aOutRect.Top(), aOutRect.Right(), aOutRect.Bottom());
+ aRetval.append(basegfx::tools::createPolygonFromRect(aRange));
+ }
+
+ return aRetval;
+}
+
+bool SdrObjGroup::beginSpecialDrag(SdrDragStat& /*rDrag*/) const
+{
+ return false;
+}
+
+
+FASTBOOL SdrObjGroup::BegCreate(SdrDragStat& /*rStat*/)
+{
+ return sal_False;
+}
+
+
+long SdrObjGroup::GetRotateAngle() const
+{
+ return nDrehWink;
+}
+
+
+long SdrObjGroup::GetShearAngle(FASTBOOL /*bVertical*/) const
+{
+ return nShearWink;
+}
+
+
+void SdrObjGroup::NbcSetSnapRect(const Rectangle& rRect)
+{
+ Rectangle aOld(GetSnapRect());
+ long nMulX=rRect.Right()-rRect.Left();
+ long nDivX=aOld.Right()-aOld.Left();
+ long nMulY=rRect.Bottom()-rRect.Top();
+ long nDivY=aOld.Bottom()-aOld.Top();
+ if (nDivX==0) { nMulX=1; nDivX=1; }
+ if (nDivY==0) { nMulY=1; nDivY=1; }
+ if (nMulX!=nDivX || nMulY!=nDivY) {
+ Fraction aX(nMulX,nDivX);
+ Fraction aY(nMulY,nDivY);
+ NbcResize(aOld.TopLeft(),aX,aY);
+ }
+ if (rRect.Left()!=aOld.Left() || rRect.Top()!=aOld.Top()) {
+ NbcMove(Size(rRect.Left()-aOld.Left(),rRect.Top()-aOld.Top()));
+ }
+}
+
+
+void SdrObjGroup::NbcSetLogicRect(const Rectangle& rRect)
+{
+ NbcSetSnapRect(rRect);
+}
+
+
+void SdrObjGroup::NbcMove(const Size& rSiz)
+{
+ MovePoint(aRefPoint,rSiz);
+ if (pSub->GetObjCount()!=0) {
+ SdrObjList* pOL=pSub;
+ sal_uIntPtr nObjAnz=pOL->GetObjCount();
+ for (sal_uIntPtr i=0; i<nObjAnz; i++) {
+ SdrObject* pObj=pOL->GetObj(i);
+ pObj->NbcMove(rSiz);
+ }
+ } else {
+ MoveRect(aOutRect,rSiz);
+ SetRectsDirty();
+ }
+}
+
+
+void SdrObjGroup::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+{
+ FASTBOOL bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
+ FASTBOOL bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
+ if (bXMirr || bYMirr) {
+ Point aRef1(GetSnapRect().Center());
+ if (bXMirr) {
+ Point aRef2(aRef1);
+ aRef2.Y()++;
+ NbcMirrorGluePoints(aRef1,aRef2);
+ }
+ if (bYMirr) {
+ Point aRef2(aRef1);
+ aRef2.X()++;
+ NbcMirrorGluePoints(aRef1,aRef2);
+ }
+ }
+ ResizePoint(aRefPoint,rRef,xFact,yFact);
+ if (pSub->GetObjCount()!=0) {
+ SdrObjList* pOL=pSub;
+ sal_uIntPtr nObjAnz=pOL->GetObjCount();
+ for (sal_uIntPtr i=0; i<nObjAnz; i++) {
+ SdrObject* pObj=pOL->GetObj(i);
+ pObj->NbcResize(rRef,xFact,yFact);
+ }
+ } else {
+ ResizeRect(aOutRect,rRef,xFact,yFact);
+ SetRectsDirty();
+ }
+}
+
+
+void SdrObjGroup::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
+{
+ SetGlueReallyAbsolute(sal_True);
+ nDrehWink=NormAngle360(nDrehWink+nWink);
+ RotatePoint(aRefPoint,rRef,sn,cs);
+ SdrObjList* pOL=pSub;
+ sal_uIntPtr nObjAnz=pOL->GetObjCount();
+ for (sal_uIntPtr i=0; i<nObjAnz; i++) {
+ SdrObject* pObj=pOL->GetObj(i);
+ pObj->NbcRotate(rRef,nWink,sn,cs);
+ }
+ NbcRotateGluePoints(rRef,nWink,sn,cs);
+ SetGlueReallyAbsolute(sal_False);
+}
+
+
+void SdrObjGroup::NbcMirror(const Point& rRef1, const Point& rRef2)
+{
+ SetGlueReallyAbsolute(sal_True);
+ MirrorPoint(aRefPoint,rRef1,rRef2); // fehlende Implementation in SvdEtc !!!
+ SdrObjList* pOL=pSub;
+ sal_uIntPtr nObjAnz=pOL->GetObjCount();
+ for (sal_uIntPtr i=0; i<nObjAnz; i++) {
+ SdrObject* pObj=pOL->GetObj(i);
+ pObj->NbcMirror(rRef1,rRef2);
+ }
+ NbcMirrorGluePoints(rRef1,rRef2);
+ SetGlueReallyAbsolute(sal_False);
+}
+
+
+void SdrObjGroup::NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
+{
+ SetGlueReallyAbsolute(sal_True);
+ nShearWink+=nWink;
+ ShearPoint(aRefPoint,rRef,tn);
+ SdrObjList* pOL=pSub;
+ sal_uIntPtr nObjAnz=pOL->GetObjCount();
+ for (sal_uIntPtr i=0; i<nObjAnz; i++) {
+ SdrObject* pObj=pOL->GetObj(i);
+ pObj->NbcShear(rRef,nWink,tn,bVShear);
+ }
+ NbcShearGluePoints(rRef,nWink,tn,bVShear);
+ SetGlueReallyAbsolute(sal_False);
+}
+
+
+void SdrObjGroup::NbcSetAnchorPos(const Point& rPnt)
+{
+ aAnchor=rPnt;
+ Size aSiz(rPnt.X()-aAnchor.X(),rPnt.Y()-aAnchor.Y());
+ MovePoint(aRefPoint,aSiz);
+ SdrObjList* pOL=pSub;
+ sal_uIntPtr nObjAnz=pOL->GetObjCount();
+ for (sal_uIntPtr i=0; i<nObjAnz; i++) {
+ SdrObject* pObj=pOL->GetObj(i);
+ pObj->NbcSetAnchorPos(rPnt);
+ }
+}
+
+
+void SdrObjGroup::SetSnapRect(const Rectangle& rRect)
+{
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ Rectangle aOld(GetSnapRect());
+ long nMulX=rRect.Right()-rRect.Left();
+ long nDivX=aOld.Right()-aOld.Left();
+ long nMulY=rRect.Bottom()-rRect.Top();
+ long nDivY=aOld.Bottom()-aOld.Top();
+ if (nDivX==0) { nMulX=1; nDivX=1; }
+ if (nDivY==0) { nMulY=1; nDivY=1; }
+ if (nMulX!=nDivX || nMulY!=nDivY) {
+ Fraction aX(nMulX,nDivX);
+ Fraction aY(nMulY,nDivY);
+ Resize(aOld.TopLeft(),aX,aY);
+ }
+ if (rRect.Left()!=aOld.Left() || rRect.Top()!=aOld.Top()) {
+ Move(Size(rRect.Left()-aOld.Left(),rRect.Top()-aOld.Top()));
+ }
+
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+}
+
+
+void SdrObjGroup::SetLogicRect(const Rectangle& rRect)
+{
+ SetSnapRect(rRect);
+}
+
+
+void SdrObjGroup::Move(const Size& rSiz)
+{
+ if (rSiz.Width()!=0 || rSiz.Height()!=0) {
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ MovePoint(aRefPoint,rSiz);
+ if (pSub->GetObjCount()!=0) {
+ // #32383# Erst die Verbinder verschieben, dann den Rest
+ SdrObjList* pOL=pSub;
+ sal_uIntPtr nObjAnz=pOL->GetObjCount();
+ sal_uIntPtr i;
+ for (i=0; i<nObjAnz; i++) {
+ SdrObject* pObj=pOL->GetObj(i);
+ if (pObj->IsEdgeObj()) pObj->Move(rSiz);
+ }
+ for (i=0; i<nObjAnz; i++) {
+ SdrObject* pObj=pOL->GetObj(i);
+ if (!pObj->IsEdgeObj()) pObj->Move(rSiz);
+ }
+ } else {
+ // #110094#-14 SendRepaintBroadcast();
+ MoveRect(aOutRect,rSiz);
+ SetRectsDirty();
+ }
+
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0);
+ }
+}
+
+
+void SdrObjGroup::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+{
+ if (xFact.GetNumerator()!=xFact.GetDenominator() || yFact.GetNumerator()!=yFact.GetDenominator()) {
+ FASTBOOL bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
+ FASTBOOL bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
+ if (bXMirr || bYMirr) {
+ Point aRef1(GetSnapRect().Center());
+ if (bXMirr) {
+ Point aRef2(aRef1);
+ aRef2.Y()++;
+ NbcMirrorGluePoints(aRef1,aRef2);
+ }
+ if (bYMirr) {
+ Point aRef2(aRef1);
+ aRef2.X()++;
+ NbcMirrorGluePoints(aRef1,aRef2);
+ }
+ }
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ ResizePoint(aRefPoint,rRef,xFact,yFact);
+ if (pSub->GetObjCount()!=0) {
+ // #32383# Erst die Verbinder verschieben, dann den Rest
+ SdrObjList* pOL=pSub;
+ sal_uIntPtr nObjAnz=pOL->GetObjCount();
+ sal_uIntPtr i;
+ for (i=0; i<nObjAnz; i++) {
+ SdrObject* pObj=pOL->GetObj(i);
+ if (pObj->IsEdgeObj()) pObj->Resize(rRef,xFact,yFact);
+ }
+ for (i=0; i<nObjAnz; i++) {
+ SdrObject* pObj=pOL->GetObj(i);
+ if (!pObj->IsEdgeObj()) pObj->Resize(rRef,xFact,yFact);
+ }
+ } else {
+ // #110094#-14 SendRepaintBroadcast();
+ ResizeRect(aOutRect,rRef,xFact,yFact);
+ SetRectsDirty();
+ }
+
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+ }
+}
+
+
+void SdrObjGroup::Rotate(const Point& rRef, long nWink, double sn, double cs)
+{
+ if (nWink!=0) {
+ SetGlueReallyAbsolute(sal_True);
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ nDrehWink=NormAngle360(nDrehWink+nWink);
+ RotatePoint(aRefPoint,rRef,sn,cs);
+ // #32383# Erst die Verbinder verschieben, dann den Rest
+ SdrObjList* pOL=pSub;
+ sal_uIntPtr nObjAnz=pOL->GetObjCount();
+ sal_uIntPtr i;
+ for (i=0; i<nObjAnz; i++) {
+ SdrObject* pObj=pOL->GetObj(i);
+ if (pObj->IsEdgeObj()) pObj->Rotate(rRef,nWink,sn,cs);
+ }
+ for (i=0; i<nObjAnz; i++) {
+ SdrObject* pObj=pOL->GetObj(i);
+ if (!pObj->IsEdgeObj()) pObj->Rotate(rRef,nWink,sn,cs);
+ }
+ NbcRotateGluePoints(rRef,nWink,sn,cs);
+ SetGlueReallyAbsolute(sal_False);
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+ }
+}
+
+
+void SdrObjGroup::Mirror(const Point& rRef1, const Point& rRef2)
+{
+ SetGlueReallyAbsolute(sal_True);
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ MirrorPoint(aRefPoint,rRef1,rRef2); // fehlende Implementation in SvdEtc !!!
+ // #32383# Erst die Verbinder verschieben, dann den Rest
+ SdrObjList* pOL=pSub;
+ sal_uIntPtr nObjAnz=pOL->GetObjCount();
+ sal_uIntPtr i;
+ for (i=0; i<nObjAnz; i++) {
+ SdrObject* pObj=pOL->GetObj(i);
+ if (pObj->IsEdgeObj()) pObj->Mirror(rRef1,rRef2);
+ }
+ for (i=0; i<nObjAnz; i++) {
+ SdrObject* pObj=pOL->GetObj(i);
+ if (!pObj->IsEdgeObj()) pObj->Mirror(rRef1,rRef2);
+ }
+ NbcMirrorGluePoints(rRef1,rRef2);
+ SetGlueReallyAbsolute(sal_False);
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+}
+
+
+void SdrObjGroup::Shear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
+{
+ if (nWink!=0) {
+ SetGlueReallyAbsolute(sal_True);
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ nShearWink+=nWink;
+ ShearPoint(aRefPoint,rRef,tn);
+ // #32383# Erst die Verbinder verschieben, dann den Rest
+ SdrObjList* pOL=pSub;
+ sal_uIntPtr nObjAnz=pOL->GetObjCount();
+ sal_uIntPtr i;
+ for (i=0; i<nObjAnz; i++) {
+ SdrObject* pObj=pOL->GetObj(i);
+ if (pObj->IsEdgeObj()) pObj->Shear(rRef,nWink,tn,bVShear);
+ }
+ for (i=0; i<nObjAnz; i++) {
+ SdrObject* pObj=pOL->GetObj(i);
+ if (!pObj->IsEdgeObj()) pObj->Shear(rRef,nWink,tn,bVShear);
+ }
+ NbcShearGluePoints(rRef,nWink,tn,bVShear);
+ SetGlueReallyAbsolute(sal_False);
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+ }
+}
+
+
+void SdrObjGroup::SetAnchorPos(const Point& rPnt)
+{
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ FASTBOOL bChg=aAnchor!=rPnt;
+ aAnchor=rPnt;
+ Size aSiz(rPnt.X()-aAnchor.X(),rPnt.Y()-aAnchor.Y());
+ MovePoint(aRefPoint,aSiz);
+ // #32383# Erst die Verbinder verschieben, dann den Rest
+ SdrObjList* pOL=pSub;
+ sal_uIntPtr nObjAnz=pOL->GetObjCount();
+ sal_uIntPtr i;
+ for (i=0; i<nObjAnz; i++) {
+ SdrObject* pObj=pOL->GetObj(i);
+ if (pObj->IsEdgeObj()) pObj->SetAnchorPos(rPnt);
+ }
+ for (i=0; i<nObjAnz; i++) {
+ SdrObject* pObj=pOL->GetObj(i);
+ if (!pObj->IsEdgeObj()) pObj->SetAnchorPos(rPnt);
+ }
+ if (bChg) {
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0);
+ }
+}
+
+
+
+void SdrObjGroup::NbcSetRelativePos(const Point& rPnt)
+{
+ Point aRelPos0(GetSnapRect().TopLeft()-aAnchor);
+ Size aSiz(rPnt.X()-aRelPos0.X(),rPnt.Y()-aRelPos0.Y());
+ NbcMove(aSiz); // Der ruft auch das SetRectsDirty()
+}
+
+void SdrObjGroup::SetRelativePos(const Point& rPnt)
+{
+ Point aRelPos0(GetSnapRect().TopLeft()-aAnchor);
+ Size aSiz(rPnt.X()-aRelPos0.X(),rPnt.Y()-aRelPos0.Y());
+ if (aSiz.Width()!=0 || aSiz.Height()!=0) Move(aSiz); // Der ruft auch das SetRectsDirty() und Broadcast, ...
+}
+
+void SdrObjGroup::NbcReformatText()
+{
+ pSub->NbcReformatAllTextObjects();
+}
+
+void SdrObjGroup::ReformatText()
+{
+ pSub->ReformatAllTextObjects();
+}
+
+SdrObject* SdrObjGroup::DoConvertToPolyObj(sal_Bool bBezier) const
+{
+ SdrObject* pGroup = new SdrObjGroup;
+ pGroup->SetModel(GetModel());
+
+ for(sal_uInt32 a=0;a<pSub->GetObjCount();a++)
+ {
+ SdrObject* pIterObj = pSub->GetObj(a);
+ SdrObject* pResult = pIterObj->DoConvertToPolyObj(bBezier);
+
+ // pResult can be NULL e.g. for empty objects
+ if( pResult )
+ pGroup->GetSubList()->NbcInsertObject(pResult);
+ }
+
+ return pGroup;
+}
+
+// eof
diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx
new file mode 100644
index 000000000000..63d23eb2c72b
--- /dev/null
+++ b/svx/source/svdraw/svdomeas.cxx
@@ -0,0 +1,1494 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svdomeas.hxx>
+#include <math.h>
+#include "svx/svditext.hxx" //
+#include <svx/xpoly.hxx>
+#include <svx/svdtrans.hxx>
+#include <svx/svdhdl.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/svddrag.hxx>
+#include <svx/svdpool.hxx>
+#include <svx/svdattrx.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdview.hxx>
+#include "svx/svdglob.hxx" // StringCache
+#include "svx/svdstr.hrc" // Objektname
+#include <svl/style.hxx>
+#include <svl/smplhint.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/xlnstwit.hxx>
+#include <svx/xlnedit.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svx/xlnedwit.hxx>
+#include <svx/xlnstcit.hxx>
+#include <svx/xlnedcit.hxx>
+#include <editeng/outlobj.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/editobj.hxx>
+#include <editeng/measfld.hxx>
+#include <editeng/flditem.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/svdpage.hxx>
+#include <unotools/syslocale.hxx>
+#include "svdoimp.hxx"
+#include <svx/sdr/properties/measureproperties.hxx>
+#include <svx/sdr/contact/viewcontactofsdrmeasureobj.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrMeasureObjGeoData::SdrMeasureObjGeoData() {}
+SdrMeasureObjGeoData::~SdrMeasureObjGeoData() {}
+
+void SdrMeasureObj::TakeRepresentation( XubString& rStr, SdrMeasureFieldKind eMeasureFieldKind ) const
+{
+ rStr.Erase();
+ Fraction aMeasureScale(1, 1);
+ sal_Bool bTextRota90(sal_False);
+ sal_Bool bShowUnit(sal_False);
+ FieldUnit eMeasureUnit(FUNIT_NONE);
+ FieldUnit eModUIUnit(FUNIT_NONE);
+
+ const SfxItemSet& rSet = GetMergedItemSet();
+ bTextRota90 = ((SdrMeasureTextRota90Item&)rSet.Get(SDRATTR_MEASURETEXTROTA90)).GetValue();
+ eMeasureUnit = ((SdrMeasureUnitItem&)rSet.Get(SDRATTR_MEASUREUNIT)).GetValue();
+ aMeasureScale = ((SdrMeasureScaleItem&)rSet.Get(SDRATTR_MEASURESCALE)).GetValue();
+ bShowUnit = ((SdrMeasureShowUnitItem&)rSet.Get(SDRATTR_MEASURESHOWUNIT)).GetValue();
+ sal_Int16 nNumDigits = ((SdrMeasureDecimalPlacesItem&)rSet.Get(SDRATTR_MEASUREDECIMALPLACES)).GetValue();
+
+ //SdrModel* pModel = rObj.pModel;
+
+ switch(eMeasureFieldKind)
+ {
+ case SDRMEASUREFIELD_VALUE:
+ {
+ if(pModel)
+ {
+ eModUIUnit = pModel->GetUIUnit();
+
+ if(eMeasureUnit == FUNIT_NONE)
+ eMeasureUnit = eModUIUnit;
+
+ sal_Int32 nLen(GetLen(aPt2 - aPt1));
+ Fraction aFact(1,1);
+
+ if(eMeasureUnit != eModUIUnit)
+ {
+ // Zur Umrechnung der Einheiten
+ aFact *= GetMapFactor(eModUIUnit, eMeasureUnit).X();
+ }
+
+ if(aMeasureScale.GetNumerator() != aMeasureScale.GetDenominator())
+ {
+ aFact *= aMeasureScale;
+ }
+
+ if(aFact.GetNumerator() != aFact.GetDenominator())
+ {
+ // Scaling ueber BigInt, um Ueberlaeufe zu vermeiden
+ nLen = BigMulDiv(nLen, aFact.GetNumerator(), aFact.GetDenominator());
+ }
+
+ pModel->TakeMetricStr(nLen, rStr, sal_True, nNumDigits);
+
+ if(!aFact.IsValid())
+ {
+ rStr = String();
+ rStr += sal_Unicode('?');
+ }
+
+ sal_Unicode cDec(SvtSysLocale().GetLocaleData().getNumDecimalSep().GetChar(0));
+
+ if(rStr.Search(cDec) != STRING_NOTFOUND)
+ {
+ xub_StrLen nLen2(rStr.Len() - 1);
+
+ while(rStr.GetChar(nLen2) == sal_Unicode('0'))
+ {
+ rStr.Erase(nLen2);
+ nLen2--;
+ }
+
+ if(rStr.GetChar(nLen2) == cDec)
+ {
+ rStr.Erase(nLen2);
+ nLen2--;
+ }
+
+ if(!rStr.Len())
+ rStr += sal_Unicode('0');
+ }
+ }
+ else
+ {
+ // falls kein Model da ... (z.B. Preview im Dialog)
+ rStr = String();
+ rStr.AppendAscii("4711");
+ }
+
+ break;
+ }
+ case SDRMEASUREFIELD_UNIT:
+ {
+ if(bShowUnit)
+ {
+ if(pModel)
+ {
+ eModUIUnit = pModel->GetUIUnit();
+
+ if(eMeasureUnit == FUNIT_NONE)
+ eMeasureUnit = eModUIUnit;
+
+ if(bShowUnit)
+ pModel->TakeUnitStr(eMeasureUnit, rStr);
+ }
+ }
+
+ break;
+ }
+ case SDRMEASUREFIELD_ROTA90BLANCS:
+ {
+ if(bTextRota90)
+ {
+ rStr = String();
+ rStr += sal_Unicode(' ');
+ }
+
+ break;
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// BaseProperties section
+
+sdr::properties::BaseProperties* SdrMeasureObj::CreateObjectSpecificProperties()
+{
+ return new sdr::properties::MeasureProperties(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// DrawContact section
+
+sdr::contact::ViewContact* SdrMeasureObj::CreateObjectSpecificViewContact()
+{
+ return new sdr::contact::ViewContactOfSdrMeasureObj(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(SdrMeasureObj,SdrTextObj);
+
+SdrMeasureObj::SdrMeasureObj():
+ bTextDirty(sal_False)
+{
+ // #i25616#
+ mbSupportTextIndentingOnLineWidthChange = sal_False;
+}
+
+SdrMeasureObj::SdrMeasureObj(const Point& rPt1, const Point& rPt2):
+ aPt1(rPt1),
+ aPt2(rPt2),
+ bTextDirty(sal_False)
+{
+ // #i25616#
+ mbSupportTextIndentingOnLineWidthChange = sal_False;
+}
+
+SdrMeasureObj::~SdrMeasureObj()
+{
+}
+
+void SdrMeasureObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
+{
+ rInfo.bSelectAllowed =sal_True;
+ rInfo.bMoveAllowed =sal_True;
+ rInfo.bResizeFreeAllowed=sal_True;
+ rInfo.bResizePropAllowed=sal_True;
+ rInfo.bRotateFreeAllowed=sal_True;
+ rInfo.bRotate90Allowed =sal_True;
+ rInfo.bMirrorFreeAllowed=sal_True;
+ rInfo.bMirror45Allowed =sal_True;
+ rInfo.bMirror90Allowed =sal_True;
+ rInfo.bTransparenceAllowed = sal_False;
+ rInfo.bGradientAllowed = sal_False;
+ rInfo.bShearAllowed =sal_True;
+ rInfo.bEdgeRadiusAllowed=sal_False;
+ rInfo.bNoOrthoDesired =sal_True;
+ rInfo.bNoContortion =sal_False;
+ rInfo.bCanConvToPath =sal_False;
+ rInfo.bCanConvToPoly =sal_True;
+ rInfo.bCanConvToPathLineToArea=sal_False;
+ rInfo.bCanConvToPolyLineToArea=sal_False;
+ rInfo.bCanConvToContour = (rInfo.bCanConvToPoly || LineGeometryUsageIsNecessary());
+}
+
+sal_uInt16 SdrMeasureObj::GetObjIdentifier() const
+{
+ return (sal_uInt16)OBJ_MEASURE;
+}
+
+struct ImpMeasureRec : public SdrDragStatUserData
+{
+ Point aPt1;
+ Point aPt2;
+ SdrMeasureKind eKind;
+ SdrMeasureTextHPos eWantTextHPos;
+ SdrMeasureTextVPos eWantTextVPos;
+ long nLineDist;
+ long nHelplineOverhang;
+ long nHelplineDist;
+ long nHelpline1Len;
+ long nHelpline2Len;
+ FASTBOOL bBelowRefEdge;
+ FASTBOOL bTextRota90;
+ FASTBOOL bTextUpsideDown;
+ long nMeasureOverhang;
+ FieldUnit eMeasureUnit;
+ Fraction aMeasureScale;
+ FASTBOOL bShowUnit;
+ String aFormatString;
+ FASTBOOL bTextAutoAngle;
+ long nTextAutoAngleView;
+ FASTBOOL bTextIsFixedAngle;
+ long nTextFixedAngle;
+};
+
+struct ImpLineRec
+{
+ Point aP1;
+ Point aP2;
+};
+
+struct ImpMeasurePoly
+{
+ ImpLineRec aMainline1; // die mit dem 1. Pfeil
+ ImpLineRec aMainline2; // die mit dem 2. Pfeil
+ ImpLineRec aMainline3; // die dazwischen
+ ImpLineRec aHelpline1;
+ ImpLineRec aHelpline2;
+ Rectangle aTextRect;
+ Size aTextSize;
+ long nLineLen;
+ long nLineWink;
+ long nTextWink;
+ long nHlpWink;
+ double nLineSin;
+ double nLineCos;
+ double nHlpSin;
+ double nHlpCos;
+ sal_uInt16 nMainlineAnz;
+ SdrMeasureTextHPos eUsedTextHPos;
+ SdrMeasureTextVPos eUsedTextVPos;
+ long nLineWdt2; // Halbe Strichstaerke
+ long nArrow1Len; // Laenge des 1. Pfeils. Bei Center nur die Haelfte
+ long nArrow2Len; // Laenge des 2. Pfeils. Bei Center nur die Haelfte
+ long nArrow1Wdt; // Breite des 1. Pfeils
+ long nArrow2Wdt; // Breite des 2. Pfeils
+ long nShortLineLen; // Linienlaenge, wenn PfeileAussen
+ FASTBOOL bArrow1Center; // Pfeil 1 zentriert?
+ FASTBOOL bArrow2Center; // Pfeil 2 zentriert?
+ FASTBOOL bAutoUpsideDown; // UpsideDown durch Automatik
+ FASTBOOL bPfeileAussen;
+ FASTBOOL bBreakedLine;
+};
+
+void SdrMeasureObj::ImpTakeAttr(ImpMeasureRec& rRec) const
+{
+ rRec.aPt1 = aPt1;
+ rRec.aPt2 = aPt2;
+
+ const SfxItemSet& rSet = GetObjectItemSet();
+ rRec.eKind =((SdrMeasureKindItem& )rSet.Get(SDRATTR_MEASUREKIND )).GetValue();
+ rRec.eWantTextHPos =((SdrMeasureTextHPosItem& )rSet.Get(SDRATTR_MEASURETEXTHPOS )).GetValue();
+ rRec.eWantTextVPos =((SdrMeasureTextVPosItem& )rSet.Get(SDRATTR_MEASURETEXTVPOS )).GetValue();
+ rRec.nLineDist =((SdrMeasureLineDistItem& )rSet.Get(SDRATTR_MEASURELINEDIST )).GetValue();
+ rRec.nHelplineOverhang=((SdrMeasureHelplineOverhangItem&)rSet.Get(SDRATTR_MEASUREHELPLINEOVERHANG)).GetValue();
+ rRec.nHelplineDist =((SdrMeasureHelplineDistItem& )rSet.Get(SDRATTR_MEASUREHELPLINEDIST )).GetValue();
+ rRec.nHelpline1Len =((SdrMeasureHelpline1LenItem& )rSet.Get(SDRATTR_MEASUREHELPLINE1LEN )).GetValue();
+ rRec.nHelpline2Len =((SdrMeasureHelpline2LenItem& )rSet.Get(SDRATTR_MEASUREHELPLINE2LEN )).GetValue();
+ rRec.bBelowRefEdge =((SdrMeasureBelowRefEdgeItem& )rSet.Get(SDRATTR_MEASUREBELOWREFEDGE )).GetValue();
+ rRec.bTextRota90 =((SdrMeasureTextRota90Item& )rSet.Get(SDRATTR_MEASURETEXTROTA90 )).GetValue();
+ rRec.bTextUpsideDown =((SdrMeasureTextUpsideDownItem& )rSet.Get(SDRATTR_MEASURETEXTUPSIDEDOWN )).GetValue();
+ rRec.nMeasureOverhang =((SdrMeasureOverhangItem& )rSet.Get(SDRATTR_MEASUREOVERHANG )).GetValue();
+ rRec.eMeasureUnit =((SdrMeasureUnitItem& )rSet.Get(SDRATTR_MEASUREUNIT )).GetValue();
+ rRec.aMeasureScale =((SdrMeasureScaleItem& )rSet.Get(SDRATTR_MEASURESCALE )).GetValue();
+ rRec.bShowUnit =((SdrMeasureShowUnitItem& )rSet.Get(SDRATTR_MEASURESHOWUNIT )).GetValue();
+ rRec.aFormatString =((SdrMeasureFormatStringItem& )rSet.Get(SDRATTR_MEASUREFORMATSTRING )).GetValue();
+ rRec.bTextAutoAngle =((SdrMeasureTextAutoAngleItem& )rSet.Get(SDRATTR_MEASURETEXTAUTOANGLE )).GetValue();
+ rRec.nTextAutoAngleView=((SdrMeasureTextAutoAngleViewItem&)rSet.Get(SDRATTR_MEASURETEXTAUTOANGLEVIEW)).GetValue();
+ rRec.bTextIsFixedAngle =((SdrMeasureTextIsFixedAngleItem& )rSet.Get(SDRATTR_MEASURETEXTISFIXEDANGLE )).GetValue();
+ rRec.nTextFixedAngle =((SdrMeasureTextFixedAngleItem& )rSet.Get(SDRATTR_MEASURETEXTFIXEDANGLE )).GetValue();
+}
+
+long impGetLineStartEndDistance(const basegfx::B2DPolyPolygon& rPolyPolygon, long nNewWidth, bool bCenter)
+{
+ const basegfx::B2DRange aPolygonRange(rPolyPolygon.getB2DRange());
+ const double fOldWidth(aPolygonRange.getWidth() > 1.0 ? aPolygonRange.getWidth() : 1.0);
+ const double fScale((double)nNewWidth / fOldWidth);
+ long nHeight(basegfx::fround(aPolygonRange.getHeight() * fScale));
+
+ if(bCenter)
+ {
+ nHeight /= 2L;
+ }
+
+ return nHeight;
+}
+
+void SdrMeasureObj::ImpCalcGeometrics(const ImpMeasureRec& rRec, ImpMeasurePoly& rPol) const
+{
+ Point aP1(rRec.aPt1);
+ Point aP2(rRec.aPt2);
+ Point aDelt(aP2); aDelt-=aP1;
+
+ rPol.aTextSize=GetTextSize();
+ rPol.nLineLen=GetLen(aDelt);
+
+ rPol.nLineWdt2=0;
+ long nArrow1Len=0; bool bArrow1Center=false;
+ long nArrow2Len=0; bool bArrow2Center=false;
+ long nArrow1Wdt=0;
+ long nArrow2Wdt=0;
+ rPol.nArrow1Wdt=0;
+ rPol.nArrow2Wdt=0;
+ long nArrowNeed=0;
+ long nShortLen=0;
+ FASTBOOL bPfeileAussen=sal_False;
+
+ const SfxItemSet& rSet = GetObjectItemSet();
+ sal_Int32 nLineWdt = ((XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue(); // Strichstaerke
+ rPol.nLineWdt2 = (nLineWdt + 1) / 2;
+
+ nArrow1Wdt = ((const XLineStartWidthItem&)(rSet.Get(XATTR_LINESTARTWIDTH))).GetValue();
+ if(nArrow1Wdt < 0)
+ nArrow1Wdt = -nLineWdt * nArrow1Wdt / 100; // <0 = relativ
+
+ nArrow2Wdt = ((const XLineEndWidthItem&)(rSet.Get(XATTR_LINEENDWIDTH))).GetValue();
+ if(nArrow2Wdt < 0)
+ nArrow2Wdt = -nLineWdt * nArrow2Wdt / 100; // <0 = relativ
+
+ basegfx::B2DPolyPolygon aPol1(((const XLineStartItem&)(rSet.Get(XATTR_LINESTART))).GetLineStartValue());
+ basegfx::B2DPolyPolygon aPol2(((const XLineEndItem&)(rSet.Get(XATTR_LINEEND))).GetLineEndValue());
+ bArrow1Center = ((const XLineStartCenterItem&)(rSet.Get(XATTR_LINESTARTCENTER))).GetValue();
+ bArrow2Center = ((const XLineEndCenterItem&)(rSet.Get(XATTR_LINEENDCENTER))).GetValue();
+ nArrow1Len = impGetLineStartEndDistance(aPol1, nArrow1Wdt, bArrow1Center) - 1;
+ nArrow2Len = impGetLineStartEndDistance(aPol2, nArrow2Wdt, bArrow2Center) - 1;
+
+ // nArrowLen ist bei bCenter bereits halbiert
+ // Bei 2 Pfeilen a 4mm ist unter 10mm Schluss.
+ nArrowNeed=nArrow1Len+nArrow2Len+(nArrow1Wdt+nArrow2Wdt)/2;
+ if (rPol.nLineLen<nArrowNeed) bPfeileAussen=sal_True;
+ nShortLen=(nArrow1Len+nArrow1Wdt + nArrow2Len+nArrow2Wdt) /2;
+
+ rPol.eUsedTextHPos=rRec.eWantTextHPos;
+ rPol.eUsedTextVPos=rRec.eWantTextVPos;
+ if (rPol.eUsedTextVPos==SDRMEASURE_TEXTVAUTO) rPol.eUsedTextVPos=SDRMEASURE_ABOVE;
+ FASTBOOL bBrkLine=rPol.eUsedTextVPos==SDRMEASURETEXT_BREAKEDLINE;
+ if (rPol.eUsedTextVPos==SDRMEASURETEXT_VERTICALCENTERED)
+ {
+ OutlinerParaObject* pOutlinerParaObject = SdrTextObj::GetOutlinerParaObject();
+ if (pOutlinerParaObject!=NULL && pOutlinerParaObject->GetTextObject().GetParagraphCount()==1)
+ {
+ bBrkLine=sal_True; // Unterbrochene Linie, wenn nur 1 Absatz.
+ }
+ }
+ rPol.bBreakedLine=bBrkLine;
+ if (rPol.eUsedTextHPos==SDRMEASURE_TEXTHAUTO) { // bei zu breitem Text diesen eventuell nach aussen schieben
+ FASTBOOL bOutside=sal_False;
+ long nNeedSiz=!rRec.bTextRota90 ? rPol.aTextSize.Width() : rPol.aTextSize.Height();
+ if (nNeedSiz>rPol.nLineLen) bOutside=sal_True; // Text passt nicht in die Mitte
+ if (bBrkLine) {
+ if (nNeedSiz+nArrowNeed>rPol.nLineLen) bPfeileAussen=sal_True; // Text passt in die Mitte, wenn die Pfeile nach aussen kommen
+ } else {
+ long nSmallNeed=nArrow1Len+nArrow2Len+(nArrow1Wdt+nArrow2Wdt)/2/4;
+ if (nNeedSiz+nSmallNeed>rPol.nLineLen) bPfeileAussen=sal_True; // Text passt in die Mitte, wenn die Pfeile nach aussen kommen
+ }
+ rPol.eUsedTextHPos=bOutside ? SDRMEASURE_TEXTLEFTOUTSIDE : SDRMEASURE_TEXTINSIDE;
+ }
+ if (rPol.eUsedTextHPos!=SDRMEASURE_TEXTINSIDE) bPfeileAussen=sal_True;
+ rPol.nArrow1Wdt=nArrow1Wdt;
+ rPol.nArrow2Wdt=nArrow2Wdt;
+ rPol.nShortLineLen=nShortLen;
+ rPol.bPfeileAussen=bPfeileAussen;
+ rPol.nArrow1Len=nArrow1Len;
+ rPol.bArrow1Center=bArrow1Center;
+ rPol.nArrow2Len=nArrow2Len;
+ rPol.bArrow2Center=bArrow2Center;
+
+ rPol.nLineWink=GetAngle(aDelt);
+ double a=rPol.nLineWink*nPi180;
+ double nLineSin=sin(a);
+ double nLineCos=cos(a);
+ rPol.nLineSin=nLineSin;
+ rPol.nLineCos=nLineCos;
+
+ rPol.nTextWink=rPol.nLineWink;
+ if (rRec.bTextRota90) rPol.nTextWink+=9000;
+
+ rPol.bAutoUpsideDown=sal_False;
+ if (rRec.bTextAutoAngle) {
+ long nTmpWink=NormAngle360(rPol.nTextWink-rRec.nTextAutoAngleView);
+ if (nTmpWink>=18000) {
+ rPol.nTextWink+=18000;
+ rPol.bAutoUpsideDown=sal_True;
+ }
+ }
+
+ if (rRec.bTextUpsideDown) rPol.nTextWink+=18000;
+ rPol.nTextWink=NormAngle360(rPol.nTextWink);
+ rPol.nHlpWink=rPol.nLineWink+9000;
+ if (rRec.bBelowRefEdge) rPol.nHlpWink+=18000;
+ rPol.nHlpWink=NormAngle360(rPol.nHlpWink);
+ double nHlpSin=nLineCos;
+ double nHlpCos=-nLineSin;
+ if (rRec.bBelowRefEdge) {
+ nHlpSin=-nHlpSin;
+ nHlpCos=-nHlpCos;
+ }
+ rPol.nHlpSin=nHlpSin;
+ rPol.nHlpCos=nHlpCos;
+
+ long nLineDist=rRec.nLineDist;
+ long nOverhang=rRec.nHelplineOverhang;
+ long nHelplineDist=rRec.nHelplineDist;
+
+ long dx= Round(nLineDist*nHlpCos);
+ long dy=-Round(nLineDist*nHlpSin);
+ long dxh1a= Round((nHelplineDist-rRec.nHelpline1Len)*nHlpCos);
+ long dyh1a=-Round((nHelplineDist-rRec.nHelpline1Len)*nHlpSin);
+ long dxh1b= Round((nHelplineDist-rRec.nHelpline2Len)*nHlpCos);
+ long dyh1b=-Round((nHelplineDist-rRec.nHelpline2Len)*nHlpSin);
+ long dxh2= Round((nLineDist+nOverhang)*nHlpCos);
+ long dyh2=-Round((nLineDist+nOverhang)*nHlpSin);
+
+ // Masshilfslinie 1
+ rPol.aHelpline1.aP1=Point(aP1.X()+dxh1a,aP1.Y()+dyh1a);
+ rPol.aHelpline1.aP2=Point(aP1.X()+dxh2,aP1.Y()+dyh2);
+
+ // Masshilfslinie 2
+ rPol.aHelpline2.aP1=Point(aP2.X()+dxh1b,aP2.Y()+dyh1b);
+ rPol.aHelpline2.aP2=Point(aP2.X()+dxh2,aP2.Y()+dyh2);
+
+ // Masslinie(n)
+ Point aMainlinePt1(aP1.X()+dx,aP1.Y()+dy);
+ Point aMainlinePt2(aP2.X()+dx,aP2.Y()+dy);
+ if (!bPfeileAussen) {
+ rPol.aMainline1.aP1=aMainlinePt1;
+ rPol.aMainline1.aP2=aMainlinePt2;
+ rPol.aMainline2=rPol.aMainline1;
+ rPol.aMainline3=rPol.aMainline1;
+ rPol.nMainlineAnz=1;
+ if (bBrkLine) {
+ long nNeedSiz=!rRec.bTextRota90 ? rPol.aTextSize.Width() : rPol.aTextSize.Height();
+ long nHalfLen=(rPol.nLineLen-nNeedSiz-nArrow1Wdt/4-nArrow2Wdt/4) /2;
+ rPol.nMainlineAnz=2;
+ rPol.aMainline1.aP2=aMainlinePt1;
+ rPol.aMainline1.aP2.X()+=nHalfLen;
+ RotatePoint(rPol.aMainline1.aP2,rPol.aMainline1.aP1,nLineSin,nLineCos);
+ rPol.aMainline2.aP1=aMainlinePt2;
+ rPol.aMainline2.aP1.X()-=nHalfLen;
+ RotatePoint(rPol.aMainline2.aP1,rPol.aMainline2.aP2,nLineSin,nLineCos);
+ }
+ } else {
+ long nLen1=nShortLen; // Pfeilbreite als Linienlaenge ausserhalb des Pfeils
+ long nLen2=nShortLen;
+ long nTextWdt=rRec.bTextRota90 ? rPol.aTextSize.Height() : rPol.aTextSize.Width();
+ if (!bBrkLine) {
+ if (rPol.eUsedTextHPos==SDRMEASURE_TEXTLEFTOUTSIDE) nLen1=nArrow1Len+nTextWdt;
+ if (rPol.eUsedTextHPos==SDRMEASURE_TEXTRIGHTOUTSIDE) nLen2=nArrow2Len+nTextWdt;
+ }
+ rPol.aMainline1.aP1=aMainlinePt1;
+ rPol.aMainline1.aP2=aMainlinePt1; rPol.aMainline1.aP2.X()-=nLen1; RotatePoint(rPol.aMainline1.aP2,aMainlinePt1,nLineSin,nLineCos);
+ rPol.aMainline2.aP1=aMainlinePt2; rPol.aMainline2.aP1.X()+=nLen2; RotatePoint(rPol.aMainline2.aP1,aMainlinePt2,nLineSin,nLineCos);
+ rPol.aMainline2.aP2=aMainlinePt2;
+ rPol.aMainline3.aP1=aMainlinePt1;
+ rPol.aMainline3.aP2=aMainlinePt2;
+ rPol.nMainlineAnz=3;
+ if (bBrkLine && rPol.eUsedTextHPos==SDRMEASURE_TEXTINSIDE) rPol.nMainlineAnz=2;
+ }
+}
+
+basegfx::B2DPolyPolygon SdrMeasureObj::ImpCalcXPoly(const ImpMeasurePoly& rPol) const
+{
+ basegfx::B2DPolyPolygon aRetval;
+ basegfx::B2DPolygon aPartPolyA;
+ aPartPolyA.append(basegfx::B2DPoint(rPol.aMainline1.aP1.X(), rPol.aMainline1.aP1.Y()));
+ aPartPolyA.append(basegfx::B2DPoint(rPol.aMainline1.aP2.X(), rPol.aMainline1.aP2.Y()));
+ aRetval.append(aPartPolyA);
+
+ if(rPol.nMainlineAnz > 1)
+ {
+ aPartPolyA.clear();
+ aPartPolyA.append(basegfx::B2DPoint(rPol.aMainline2.aP1.X(), rPol.aMainline2.aP1.Y()));
+ aPartPolyA.append(basegfx::B2DPoint(rPol.aMainline2.aP2.X(), rPol.aMainline2.aP2.Y()));
+ aRetval.append(aPartPolyA);
+ }
+
+ if(rPol.nMainlineAnz > 2)
+ {
+ aPartPolyA.clear();
+ aPartPolyA.append(basegfx::B2DPoint(rPol.aMainline3.aP1.X(), rPol.aMainline3.aP1.Y()));
+ aPartPolyA.append(basegfx::B2DPoint(rPol.aMainline3.aP2.X(), rPol.aMainline3.aP2.Y()));
+ aRetval.append(aPartPolyA);
+ }
+
+ aPartPolyA.clear();
+ aPartPolyA.append(basegfx::B2DPoint(rPol.aHelpline1.aP1.X(), rPol.aHelpline1.aP1.Y()));
+ aPartPolyA.append(basegfx::B2DPoint(rPol.aHelpline1.aP2.X(), rPol.aHelpline1.aP2.Y()));
+ aRetval.append(aPartPolyA);
+
+ aPartPolyA.clear();
+ aPartPolyA.append(basegfx::B2DPoint(rPol.aHelpline2.aP1.X(), rPol.aHelpline2.aP1.Y()));
+ aPartPolyA.append(basegfx::B2DPoint(rPol.aHelpline2.aP2.X(), rPol.aHelpline2.aP2.Y()));
+ aRetval.append(aPartPolyA);
+
+ return aRetval;
+}
+
+FASTBOOL SdrMeasureObj::CalcFieldValue(const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos,
+ FASTBOOL bEdit,
+ Color*& rpTxtColor, Color*& rpFldColor, XubString& rRet) const
+{
+ const SvxFieldData* pField=rField.GetField();
+ SdrMeasureField* pMeasureField=PTR_CAST(SdrMeasureField,pField);
+ if (pMeasureField!=NULL) {
+ TakeRepresentation(rRet, pMeasureField->GetMeasureFieldKind());
+ if (rpFldColor!=NULL) {
+ if (!bEdit)
+ {
+ delete rpFldColor;
+ rpFldColor=NULL;
+ }
+ }
+ return sal_True;
+ } else {
+ return SdrTextObj::CalcFieldValue(rField,nPara,nPos,bEdit,rpTxtColor,rpFldColor,rRet);
+ }
+}
+
+void SdrMeasureObj::UndirtyText() const
+{
+ if (bTextDirty)
+ {
+ SdrOutliner& rOutliner=ImpGetDrawOutliner();
+ OutlinerParaObject* pOutlinerParaObject = SdrTextObj::GetOutlinerParaObject();
+ if(pOutlinerParaObject==NULL)
+ {
+ rOutliner.QuickInsertField(SvxFieldItem(SdrMeasureField(SDRMEASUREFIELD_ROTA90BLANCS), EE_FEATURE_FIELD), ESelection(0,0));
+ rOutliner.QuickInsertField(SvxFieldItem(SdrMeasureField(SDRMEASUREFIELD_VALUE), EE_FEATURE_FIELD),ESelection(0,1));
+ rOutliner.QuickInsertField(SvxFieldItem(SdrMeasureField(SDRMEASUREFIELD_UNIT), EE_FEATURE_FIELD),ESelection(0,2));
+ rOutliner.QuickInsertField(SvxFieldItem(SdrMeasureField(SDRMEASUREFIELD_ROTA90BLANCS), EE_FEATURE_FIELD),ESelection(0,3));
+
+ if(GetStyleSheet())
+ rOutliner.SetStyleSheet(0, GetStyleSheet());
+
+ rOutliner.SetParaAttribs(0, GetObjectItemSet());
+
+ // casting auf nonconst
+ const_cast<SdrMeasureObj*>(this)->NbcSetOutlinerParaObject( rOutliner.CreateParaObject() );
+ }
+ else
+ {
+ rOutliner.SetText(*pOutlinerParaObject);
+ }
+
+ rOutliner.SetUpdateMode(sal_True);
+ rOutliner.UpdateFields();
+ Size aSiz(rOutliner.CalcTextSize());
+ rOutliner.Clear();
+ // 3x casting auf nonconst
+ ((SdrMeasureObj*)this)->aTextSize=aSiz;
+ ((SdrMeasureObj*)this)->bTextSizeDirty=sal_False;
+ ((SdrMeasureObj*)this)->bTextDirty=sal_False;
+ }
+}
+
+void SdrMeasureObj::TakeUnrotatedSnapRect(Rectangle& rRect) const
+{
+ if (bTextDirty) UndirtyText();
+ ImpMeasureRec aRec;
+ ImpMeasurePoly aMPol;
+ ImpTakeAttr(aRec);
+ ImpCalcGeometrics(aRec,aMPol);
+
+ // TextSize ermitteln inkl. Textrahmenabstaende
+ Size aTextSize2(aMPol.aTextSize);
+ if (aTextSize2.Width()<1) aTextSize2.Width()=1;
+ if (aTextSize2.Height()<1) aTextSize2.Height()=1;
+ aTextSize2.Width()+=GetTextLeftDistance()+GetTextRightDistance();
+ aTextSize2.Height()+=GetTextUpperDistance()+GetTextLowerDistance();
+
+ Point aPt1b(aMPol.aMainline1.aP1);
+ long nLen=aMPol.nLineLen;
+ long nLWdt=aMPol.nLineWdt2;
+ long nArr1Len=aMPol.nArrow1Len;
+ long nArr2Len=aMPol.nArrow2Len;
+ if (aMPol.bBreakedLine) {
+ // Bei Unterbrochener Linie und Outside muss der Text nicht neben den
+ // Pfeil sondern neben die Linie an dem Pfeil plaziert werden
+ nArr1Len=aMPol.nShortLineLen+aMPol.nArrow1Wdt/4;
+ nArr2Len=aMPol.nShortLineLen+aMPol.nArrow2Wdt/4;
+ }
+
+ Point aTextPos;
+ FASTBOOL bRota90=aRec.bTextRota90;
+ FASTBOOL bUpsideDown=aRec.bTextUpsideDown!=aMPol.bAutoUpsideDown;
+ FASTBOOL bBelowRefEdge=aRec.bBelowRefEdge;
+ SdrMeasureTextHPos eMH=aMPol.eUsedTextHPos;
+ SdrMeasureTextVPos eMV=aMPol.eUsedTextVPos;
+ if (!bRota90) {
+ switch (eMH) {
+ case SDRMEASURE_TEXTLEFTOUTSIDE: aTextPos.X()=aPt1b.X()-aTextSize2.Width()-nArr1Len-nLWdt; break;
+ case SDRMEASURE_TEXTRIGHTOUTSIDE: aTextPos.X()=aPt1b.X()+nLen+nArr2Len+nLWdt; break;
+ default: aTextPos.X()=aPt1b.X(); aTextSize2.Width()=nLen;
+ }
+ switch (eMV) {
+ case SDRMEASURETEXT_VERTICALCENTERED:
+ case SDRMEASURETEXT_BREAKEDLINE: aTextPos.Y()=aPt1b.Y()-aTextSize2.Height()/2; break;
+ case SDRMEASURE_BELOW: {
+ if (!bUpsideDown) aTextPos.Y()=aPt1b.Y()+nLWdt;
+ else aTextPos.Y()=aPt1b.Y()-aTextSize2.Height()-nLWdt;
+ } break;
+ default: {
+ if (!bUpsideDown) aTextPos.Y()=aPt1b.Y()-aTextSize2.Height()-nLWdt;
+ else aTextPos.Y()=aPt1b.Y()+nLWdt;
+ }
+ }
+ if (bUpsideDown) {
+ aTextPos.X()+=aTextSize2.Width();
+ aTextPos.Y()+=aTextSize2.Height();
+ }
+ } else { // also wenn bTextRota90==TRUE
+ switch (eMH) {
+ case SDRMEASURE_TEXTLEFTOUTSIDE: aTextPos.X()=aPt1b.X()-aTextSize2.Height()-nArr1Len; break;
+ case SDRMEASURE_TEXTRIGHTOUTSIDE: aTextPos.X()=aPt1b.X()+nLen+nArr2Len; break;
+ default: aTextPos.X()=aPt1b.X(); aTextSize2.Height()=nLen;
+ }
+ switch (eMV) {
+ case SDRMEASURETEXT_VERTICALCENTERED:
+ case SDRMEASURETEXT_BREAKEDLINE: aTextPos.Y()=aPt1b.Y()+aTextSize2.Width()/2; break;
+ case SDRMEASURE_BELOW: {
+ if (!bBelowRefEdge) aTextPos.Y()=aPt1b.Y()+aTextSize2.Width()+nLWdt;
+ else aTextPos.Y()=aPt1b.Y()-nLWdt;
+ } break;
+ default: {
+ if (!bBelowRefEdge) aTextPos.Y()=aPt1b.Y()-nLWdt;
+ else aTextPos.Y()=aPt1b.Y()+aTextSize2.Width()+nLWdt;
+ }
+ }
+ if (bUpsideDown) {
+ aTextPos.X()+=aTextSize2.Height();
+ aTextPos.Y()-=aTextSize2.Width();
+ }
+ }
+ if (aMPol.nTextWink!=aGeo.nDrehWink) {
+ ((SdrMeasureObj*)this)->aGeo.nDrehWink=aMPol.nTextWink;
+ ((SdrMeasureObj*)this)->aGeo.RecalcSinCos();
+ }
+ RotatePoint(aTextPos,aPt1b,aMPol.nLineSin,aMPol.nLineCos);
+ aTextSize2.Width()++; aTextSize2.Height()++; // wg. des komischen Verhaltens beim Rect-Ctor
+ rRect=Rectangle(aTextPos,aTextSize2);
+ rRect.Justify();
+ ((SdrMeasureObj*)this)->aRect=rRect;
+
+ if (aMPol.nTextWink!=aGeo.nDrehWink) {
+ ((SdrMeasureObj*)this)->aGeo.nDrehWink=aMPol.nTextWink;
+ ((SdrMeasureObj*)this)->aGeo.RecalcSinCos();
+ }
+}
+
+void SdrMeasureObj::operator=(const SdrObject& rObj)
+{
+ SdrTextObj::operator=(rObj);
+ aPt1=((SdrMeasureObj&)rObj).aPt1;
+ aPt2=((SdrMeasureObj&)rObj).aPt2;
+ bTextDirty=((SdrMeasureObj&)rObj).bTextDirty;
+}
+
+void SdrMeasureObj::TakeObjNameSingul(XubString& rName) const
+{
+ rName=ImpGetResStr(STR_ObjNameSingulMEASURE);
+
+ String aName( GetName() );
+ if(aName.Len())
+ {
+ rName += sal_Unicode(' ');
+ rName += sal_Unicode('\'');
+ rName += aName;
+ rName += sal_Unicode('\'');
+ }
+}
+
+void SdrMeasureObj::TakeObjNamePlural(XubString& rName) const
+{
+ rName=ImpGetResStr(STR_ObjNamePluralMEASURE);
+}
+
+basegfx::B2DPolyPolygon SdrMeasureObj::TakeXorPoly() const
+{
+ ImpMeasureRec aRec;
+ ImpMeasurePoly aMPol;
+ ImpTakeAttr(aRec);
+ ImpCalcGeometrics(aRec,aMPol);
+ return ImpCalcXPoly(aMPol);
+}
+
+sal_uInt32 SdrMeasureObj::GetHdlCount() const
+{
+ return 6L;
+}
+
+SdrHdl* SdrMeasureObj::GetHdl(sal_uInt32 nHdlNum) const
+{
+ ImpMeasureRec aRec;
+ ImpMeasurePoly aMPol;
+ ImpTakeAttr(aRec);
+ aRec.nHelplineDist=0;
+ ImpCalcGeometrics(aRec,aMPol);
+ Point aPt;
+ //SdrHdlKind eHdl=HDL_POLY;
+ switch (nHdlNum) {
+ case 0: aPt=aMPol.aHelpline1.aP1; break;
+ case 1: aPt=aMPol.aHelpline2.aP1; break;
+ case 2: aPt=aPt1; break;
+ case 3: aPt=aPt2; break;
+ case 4: aPt=aMPol.aHelpline1.aP2; break;
+ case 5: aPt=aMPol.aHelpline2.aP2; break;
+ } // switch
+ SdrHdl* pHdl=new ImpMeasureHdl(aPt,HDL_USER);
+ pHdl->SetObjHdlNum(nHdlNum);
+ pHdl->SetDrehWink(aMPol.nLineWink);
+ return pHdl;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+bool SdrMeasureObj::hasSpecialDrag() const
+{
+ return true;
+}
+
+bool SdrMeasureObj::beginSpecialDrag(SdrDragStat& rDrag) const
+{
+ const SdrHdl* pHdl = rDrag.GetHdl();
+
+ if(pHdl)
+ {
+ const sal_uInt32 nHdlNum(pHdl->GetObjHdlNum());
+
+ if(nHdlNum != 2 && nHdlNum != 3)
+ {
+ rDrag.SetEndDragChangesAttributes(true);
+ }
+
+ return true;
+ }
+
+ return false;
+}
+
+bool SdrMeasureObj::applySpecialDrag(SdrDragStat& rDrag)
+{
+ ImpMeasureRec aMeasureRec;
+ const SdrHdl* pHdl = rDrag.GetHdl();
+ const sal_uInt32 nHdlNum(pHdl->GetObjHdlNum());
+
+ ImpTakeAttr(aMeasureRec);
+ ImpEvalDrag(aMeasureRec, rDrag);
+
+ switch (nHdlNum)
+ {
+ case 2:
+ {
+ aPt1 = aMeasureRec.aPt1;
+ SetTextDirty();
+ break;
+ }
+ case 3:
+ {
+ aPt2 = aMeasureRec.aPt2;
+ SetTextDirty();
+ break;
+ }
+ default:
+ {
+ switch(nHdlNum)
+ {
+ case 0:
+ case 1:
+ {
+ ImpMeasureRec aOrigMeasureRec;
+ ImpTakeAttr(aOrigMeasureRec);
+
+ if(aMeasureRec.nHelpline1Len != aOrigMeasureRec.nHelpline1Len)
+ {
+ SetObjectItem(SdrMeasureHelpline1LenItem(aMeasureRec.nHelpline1Len));
+ }
+
+ if(aMeasureRec.nHelpline2Len != aOrigMeasureRec.nHelpline2Len)
+ {
+ SetObjectItem(SdrMeasureHelpline2LenItem(aMeasureRec.nHelpline2Len));
+ }
+
+ break;
+ }
+
+ case 4:
+ case 5:
+ {
+ ImpMeasureRec aOrigMeasureRec;
+ ImpTakeAttr(aOrigMeasureRec);
+
+ if(aMeasureRec.nLineDist != aOrigMeasureRec.nLineDist)
+ {
+ SetObjectItem(SdrMeasureLineDistItem(aMeasureRec.nLineDist));
+ }
+
+ if(aMeasureRec.bBelowRefEdge != aOrigMeasureRec.bBelowRefEdge)
+ {
+ SetObjectItem(SdrMeasureBelowRefEdgeItem(aMeasureRec.bBelowRefEdge));
+ }
+ }
+ }
+ }
+ } // switch
+
+ SetRectsDirty();
+ SetChanged();
+
+ return true;
+}
+
+String SdrMeasureObj::getSpecialDragComment(const SdrDragStat& /*rDrag*/) const
+{
+ XubString aStr;
+ return aStr;
+}
+
+void SdrMeasureObj::ImpEvalDrag(ImpMeasureRec& rRec, const SdrDragStat& rDrag) const
+{
+ long nLineWink=GetAngle(rRec.aPt2-rRec.aPt1);
+ double a=nLineWink*nPi180;
+ double nSin=sin(a);
+ double nCos=cos(a);
+
+ const SdrHdl* pHdl=rDrag.GetHdl();
+ sal_uInt32 nHdlNum(pHdl->GetObjHdlNum());
+ FASTBOOL bOrtho=rDrag.GetView()!=NULL && rDrag.GetView()->IsOrtho();
+ FASTBOOL bBigOrtho=bOrtho && rDrag.GetView()->IsBigOrtho();
+ FASTBOOL bBelow=rRec.bBelowRefEdge;
+ Point aPt(rDrag.GetNow());
+
+ switch (nHdlNum) {
+ case 0: {
+ RotatePoint(aPt,aPt1,nSin,-nCos);
+ rRec.nHelpline1Len=aPt1.Y()-aPt.Y();
+ if (bBelow) rRec.nHelpline1Len=-rRec.nHelpline1Len;
+ if (bOrtho) rRec.nHelpline2Len=rRec.nHelpline1Len;
+ } break;
+ case 1: {
+ RotatePoint(aPt,aPt2,nSin,-nCos);
+ rRec.nHelpline2Len=aPt2.Y()-aPt.Y();
+ if (bBelow) rRec.nHelpline2Len=-rRec.nHelpline2Len;
+ if (bOrtho) rRec.nHelpline1Len=rRec.nHelpline2Len;
+ } break;
+ case 2: case 3: {
+ FASTBOOL bAnf=nHdlNum==2;
+ Point& rMov=bAnf ? rRec.aPt1 : rRec.aPt2;
+ Point aMov(rMov);
+ Point aFix(bAnf ? rRec.aPt2 : rRec.aPt1);
+ if (bOrtho) {
+ long ndx0=aMov.X()-aFix.X();
+ long ndy0=aMov.Y()-aFix.Y();
+ FASTBOOL bHLin=ndy0==0;
+ FASTBOOL bVLin=ndx0==0;
+ if (!bHLin || !bVLin) { // sonst ist aPt1==aPt2
+ long ndx=aPt.X()-aFix.X();
+ long ndy=aPt.Y()-aFix.Y();
+ double nXFact=0; if (!bVLin) nXFact=(double)ndx/(double)ndx0;
+ double nYFact=0; if (!bHLin) nYFact=(double)ndy/(double)ndy0;
+ FASTBOOL bHor=bHLin || (!bVLin && (nXFact>nYFact) ==bBigOrtho);
+ FASTBOOL bVer=bVLin || (!bHLin && (nXFact<=nYFact)==bBigOrtho);
+ if (bHor) ndy=long(ndy0*nXFact);
+ if (bVer) ndx=long(ndx0*nYFact);
+ aPt=aFix;
+ aPt.X()+=ndx;
+ aPt.Y()+=ndy;
+ } // else Ortho8
+ }
+ rMov=aPt;
+ } break;
+ case 4: case 5: {
+ long nVal0=rRec.nLineDist;
+ RotatePoint(aPt,(nHdlNum==4 ? aPt1 : aPt2),nSin,-nCos);
+ rRec.nLineDist=aPt.Y()- (nHdlNum==4 ? aPt1.Y() : aPt2.Y());
+ if (bBelow) rRec.nLineDist=-rRec.nLineDist;
+ if (rRec.nLineDist<0) {
+ rRec.nLineDist=-rRec.nLineDist;
+ rRec.bBelowRefEdge=!bBelow;
+ }
+ rRec.nLineDist-=rRec.nHelplineOverhang;
+ if (bOrtho) rRec.nLineDist=nVal0;
+ } break;
+ } // switch
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+FASTBOOL SdrMeasureObj::BegCreate(SdrDragStat& rStat)
+{
+ rStat.SetOrtho8Possible();
+ aPt1=rStat.GetStart();
+ aPt2=rStat.GetNow();
+ SetTextDirty();
+ return sal_True;
+}
+
+FASTBOOL SdrMeasureObj::MovCreate(SdrDragStat& rStat)
+{
+ SdrView* pView=rStat.GetView();
+ aPt1=rStat.GetStart();
+ aPt2=rStat.GetNow();
+ if (pView!=NULL && pView->IsCreate1stPointAsCenter()) {
+ aPt1+=aPt1;
+ aPt1-=rStat.Now();
+ }
+ SetTextDirty();
+ SetBoundRectDirty();
+ bSnapRectDirty=sal_True;
+ return sal_True;
+}
+
+FASTBOOL SdrMeasureObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
+{
+ SetTextDirty();
+ SetRectsDirty();
+ return (eCmd==SDRCREATE_FORCEEND || rStat.GetPointAnz()>=2);
+}
+
+FASTBOOL SdrMeasureObj::BckCreate(SdrDragStat& /*rStat*/)
+{
+ return sal_False;
+}
+
+void SdrMeasureObj::BrkCreate(SdrDragStat& /*rStat*/)
+{
+}
+
+basegfx::B2DPolyPolygon SdrMeasureObj::TakeCreatePoly(const SdrDragStat& /*rDrag*/) const
+{
+ ImpMeasureRec aRec;
+ ImpMeasurePoly aMPol;
+
+ ImpTakeAttr(aRec);
+ ImpCalcGeometrics(aRec, aMPol);
+
+ return ImpCalcXPoly(aMPol);
+}
+
+Pointer SdrMeasureObj::GetCreatePointer() const
+{
+ return Pointer(POINTER_CROSS);
+}
+
+void SdrMeasureObj::NbcMove(const Size& rSiz)
+{
+ SdrTextObj::NbcMove(rSiz);
+ MovePoint(aPt1,rSiz);
+ MovePoint(aPt2,rSiz);
+}
+
+void SdrMeasureObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+{
+ SdrTextObj::NbcResize(rRef,xFact,yFact);
+ ResizePoint(aPt1,rRef,xFact,yFact);
+ ResizePoint(aPt2,rRef,xFact,yFact);
+ SetTextDirty();
+}
+
+void SdrMeasureObj::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
+{
+ SdrTextObj::NbcRotate(rRef,nWink,sn,cs);
+ long nLen0=GetLen(aPt2-aPt1);
+ RotatePoint(aPt1,rRef,sn,cs);
+ RotatePoint(aPt2,rRef,sn,cs);
+ long nLen1=GetLen(aPt2-aPt1);
+ if (nLen1!=nLen0) { // Aha, Rundungsfehler
+ long dx=aPt2.X()-aPt1.X();
+ long dy=aPt2.Y()-aPt1.Y();
+ dx=BigMulDiv(dx,nLen0,nLen1);
+ dy=BigMulDiv(dy,nLen0,nLen1);
+ if (rRef==aPt2) {
+ aPt1.X()=aPt2.X()-dx;
+ aPt1.Y()=aPt2.Y()-dy;
+ } else {
+ aPt2.X()=aPt1.X()+dx;
+ aPt2.Y()=aPt1.Y()+dy;
+ }
+ }
+ SetRectsDirty();
+}
+
+void SdrMeasureObj::NbcMirror(const Point& rRef1, const Point& rRef2)
+{
+ SdrTextObj::NbcMirror(rRef1,rRef2);
+ MirrorPoint(aPt1,rRef1,rRef2);
+ MirrorPoint(aPt2,rRef1,rRef2);
+ SetRectsDirty();
+}
+
+void SdrMeasureObj::NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
+{
+ SdrTextObj::NbcShear(rRef,nWink,tn,bVShear);
+ ShearPoint(aPt1,rRef,tn,bVShear);
+ ShearPoint(aPt2,rRef,tn,bVShear);
+ SetRectsDirty();
+ SetTextDirty();
+}
+
+long SdrMeasureObj::GetRotateAngle() const
+{
+ return GetAngle(aPt2-aPt1);
+}
+
+void SdrMeasureObj::RecalcSnapRect()
+{
+ // #94520# Added correct implementation here.
+ ImpMeasureRec aRec;
+ ImpMeasurePoly aMPol;
+ XPolyPolygon aXPP;
+
+ ImpTakeAttr(aRec);
+ ImpCalcGeometrics(aRec, aMPol);
+ aXPP = XPolyPolygon(ImpCalcXPoly(aMPol));
+ maSnapRect = aXPP.GetBoundRect();
+}
+
+sal_uInt32 SdrMeasureObj::GetSnapPointCount() const
+{
+ return 2L;
+}
+
+Point SdrMeasureObj::GetSnapPoint(sal_uInt32 i) const
+{
+ if (i==0) return aPt1;
+ else return aPt2;
+}
+
+sal_Bool SdrMeasureObj::IsPolyObj() const
+{
+ return sal_True;
+}
+
+sal_uInt32 SdrMeasureObj::GetPointCount() const
+{
+ return 2L;
+}
+
+Point SdrMeasureObj::GetPoint(sal_uInt32 i) const
+{
+ return (0L == i) ? aPt1 : aPt2;
+}
+
+void SdrMeasureObj::NbcSetPoint(const Point& rPnt, sal_uInt32 i)
+{
+ if (0L == i)
+ aPt1=rPnt;
+ if (1L == i)
+ aPt2=rPnt;
+ SetRectsDirty();
+ SetTextDirty();
+}
+
+SdrObjGeoData* SdrMeasureObj::NewGeoData() const
+{
+ return new SdrMeasureObjGeoData;
+}
+
+void SdrMeasureObj::SaveGeoData(SdrObjGeoData& rGeo) const
+{
+ SdrTextObj::SaveGeoData(rGeo);
+ SdrMeasureObjGeoData& rMGeo=(SdrMeasureObjGeoData&)rGeo;
+ rMGeo.aPt1=aPt1;
+ rMGeo.aPt2=aPt2;
+}
+
+void SdrMeasureObj::RestGeoData(const SdrObjGeoData& rGeo)
+{
+ SdrTextObj::RestGeoData(rGeo);
+ SdrMeasureObjGeoData& rMGeo=(SdrMeasureObjGeoData&)rGeo;
+ aPt1=rMGeo.aPt1;
+ aPt2=rMGeo.aPt2;
+ SetTextDirty();
+}
+
+SdrObject* SdrMeasureObj::DoConvertToPolyObj(sal_Bool bBezier) const
+{
+ // get XOR Poly as base
+ XPolyPolygon aTmpPolyPolygon(TakeXorPoly());
+
+ // get local ItemSet and StyleSheet
+ SfxItemSet aSet(GetObjectItemSet());
+ SfxStyleSheet* pStyleSheet = GetStyleSheet();
+
+ // prepare group
+ SdrObjGroup* pGroup = new SdrObjGroup;
+ pGroup->SetModel(GetModel());
+
+ // prepare parameters
+ basegfx::B2DPolyPolygon aPolyPoly;
+ SdrPathObj* pPath;
+ sal_uInt16 nCount(aTmpPolyPolygon.Count());
+ sal_uInt16 nLoopStart(0);
+
+ if(nCount == 3)
+ {
+ // three lines, first one is the middle one
+ aPolyPoly.clear();
+ aPolyPoly.append(aTmpPolyPolygon[0].getB2DPolygon());
+
+ pPath = new SdrPathObj(OBJ_PATHLINE, aPolyPoly);
+ pPath->SetModel(GetModel());
+ pPath->SetMergedItemSet(aSet);
+ pPath->SetStyleSheet(pStyleSheet, true);
+ pGroup->GetSubList()->NbcInsertObject(pPath);
+ aSet.Put(XLineStartWidthItem(0L));
+ aSet.Put(XLineEndWidthItem(0L));
+ nLoopStart = 1;
+ }
+ else if(nCount == 4)
+ {
+ // four lines, middle line with gap, so there are two lines used
+ // which have one arrow each
+ //sal_Int32 nStartWidth = ((const XLineStartWidthItem&)(aSet.Get(XATTR_LINESTARTWIDTH))).GetValue();
+ sal_Int32 nEndWidth = ((const XLineEndWidthItem&)(aSet.Get(XATTR_LINEENDWIDTH))).GetValue();
+ aSet.Put(XLineEndWidthItem(0L));
+
+ aPolyPoly.clear();
+ aPolyPoly.append(aTmpPolyPolygon[0].getB2DPolygon());
+ pPath = new SdrPathObj(OBJ_PATHLINE, aPolyPoly);
+ pPath->SetModel(GetModel());
+ pPath->SetMergedItemSet(aSet);
+ pPath->SetStyleSheet(pStyleSheet, true);
+
+ pGroup->GetSubList()->NbcInsertObject(pPath);
+
+ aSet.Put(XLineEndWidthItem(nEndWidth));
+ aSet.Put(XLineStartWidthItem(0L));
+
+ aPolyPoly.clear();
+ aPolyPoly.append(aTmpPolyPolygon[1].getB2DPolygon());
+ pPath = new SdrPathObj(OBJ_PATHLINE, aPolyPoly);
+ pPath->SetModel(GetModel());
+ pPath->SetMergedItemSet(aSet);
+ pPath->SetStyleSheet(pStyleSheet, true);
+
+ pGroup->GetSubList()->NbcInsertObject(pPath);
+
+ aSet.Put(XLineEndWidthItem(0L));
+ nLoopStart = 2;
+ }
+ else if(nCount == 5)
+ {
+ // five lines, first two are the outer ones
+ //sal_Int32 nStartWidth = ((const XLineStartWidthItem&)(aSet.Get(XATTR_LINESTARTWIDTH))).GetValue();
+ sal_Int32 nEndWidth = ((const XLineEndWidthItem&)(aSet.Get(XATTR_LINEENDWIDTH))).GetValue();
+
+ aSet.Put(XLineEndWidthItem(0L));
+
+ aPolyPoly.clear();
+ aPolyPoly.append(aTmpPolyPolygon[0].getB2DPolygon());
+ pPath = new SdrPathObj(OBJ_PATHLINE, aPolyPoly);
+ pPath->SetModel(GetModel());
+ pPath->SetMergedItemSet(aSet);
+ pPath->SetStyleSheet(pStyleSheet, true);
+
+ pGroup->GetSubList()->NbcInsertObject(pPath);
+
+ aSet.Put(XLineEndWidthItem(nEndWidth));
+ aSet.Put(XLineStartWidthItem(0L));
+
+ aPolyPoly.clear();
+ aPolyPoly.append(aTmpPolyPolygon[1].getB2DPolygon());
+ pPath = new SdrPathObj(OBJ_PATHLINE, aPolyPoly);
+ pPath->SetModel(GetModel());
+ pPath->SetMergedItemSet(aSet);
+ pPath->SetStyleSheet(pStyleSheet, true);
+
+ pGroup->GetSubList()->NbcInsertObject(pPath);
+
+ aSet.Put(XLineEndWidthItem(0L));
+ nLoopStart = 2;
+ }
+
+ for(;nLoopStart<nCount;nLoopStart++)
+ {
+ aPolyPoly.clear();
+ aPolyPoly.append(aTmpPolyPolygon[nLoopStart].getB2DPolygon());
+ pPath = new SdrPathObj(OBJ_PATHLINE, aPolyPoly);
+ pPath->SetModel(GetModel());
+ pPath->SetMergedItemSet(aSet);
+ pPath->SetStyleSheet(pStyleSheet, true);
+
+ pGroup->GetSubList()->NbcInsertObject(pPath);
+ }
+
+ return ImpConvertAddText(pGroup, bBezier);
+}
+
+sal_Bool SdrMeasureObj::BegTextEdit(SdrOutliner& rOutl)
+{
+ UndirtyText();
+ return SdrTextObj::BegTextEdit(rOutl);
+}
+
+const Size& SdrMeasureObj::GetTextSize() const
+{
+ if (bTextDirty) UndirtyText();
+ return SdrTextObj::GetTextSize();
+}
+
+OutlinerParaObject* SdrMeasureObj::GetOutlinerParaObject() const
+{
+ if(bTextDirty)
+ UndirtyText();
+ return SdrTextObj::GetOutlinerParaObject();
+}
+
+void SdrMeasureObj::NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject)
+{
+ SdrTextObj::NbcSetOutlinerParaObject(pTextObject);
+ if(SdrTextObj::GetOutlinerParaObject())
+ SetTextDirty(); // Text neu berechnen!
+}
+
+void SdrMeasureObj::TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, FASTBOOL bNoEditText,
+ Rectangle* pAnchorRect, sal_Bool bLineWidth ) const
+{
+ if (bTextDirty) UndirtyText();
+ SdrTextObj::TakeTextRect( rOutliner, rTextRect, bNoEditText, pAnchorRect, bLineWidth );
+}
+
+void SdrMeasureObj::TakeTextAnchorRect(Rectangle& rAnchorRect) const
+{
+ if (bTextDirty) UndirtyText();
+ SdrTextObj::TakeTextAnchorRect(rAnchorRect);
+}
+
+void SdrMeasureObj::TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle* pViewInit, Rectangle* pViewMin) const
+{
+ if (bTextDirty) UndirtyText();
+ SdrTextObj::TakeTextEditArea(pPaperMin,pPaperMax,pViewInit,pViewMin);
+}
+
+sal_uInt16 SdrMeasureObj::GetOutlinerViewAnchorMode() const
+{
+ if (bTextDirty) UndirtyText();
+ ImpMeasureRec aRec;
+ ImpMeasurePoly aMPol;
+ ImpTakeAttr(aRec);
+ ImpCalcGeometrics(aRec,aMPol);
+
+ SdrTextHorzAdjust eTH=GetTextHorizontalAdjust();
+ SdrTextVertAdjust eTV=GetTextVerticalAdjust();
+ SdrMeasureTextHPos eMH=aMPol.eUsedTextHPos;
+ SdrMeasureTextVPos eMV=aMPol.eUsedTextVPos;
+ FASTBOOL bTextRota90=aRec.bTextRota90;
+ //int bTextUpsideDown=aRec.bTextUpsideDown;
+ FASTBOOL bBelowRefEdge=aRec.bBelowRefEdge;
+
+ // bTextUpsideDown muss hier noch ausgewertet werden!!!!
+ if (!bTextRota90) {
+ if (eMH==SDRMEASURE_TEXTLEFTOUTSIDE) eTH=SDRTEXTHORZADJUST_RIGHT;
+ if (eMH==SDRMEASURE_TEXTRIGHTOUTSIDE) eTH=SDRTEXTHORZADJUST_LEFT;
+ // bei eMH==SDRMEASURE_TEXTINSIDE kann horizontal geankert werden.
+ if (eMV==SDRMEASURE_ABOVE) eTV=SDRTEXTVERTADJUST_BOTTOM;
+ if (eMV==SDRMEASURE_BELOW) eTV=SDRTEXTVERTADJUST_TOP;
+ if (eMV==SDRMEASURETEXT_BREAKEDLINE || eMV==SDRMEASURETEXT_VERTICALCENTERED) eTV=SDRTEXTVERTADJUST_CENTER;
+ } else {
+ if (eMH==SDRMEASURE_TEXTLEFTOUTSIDE) eTV=SDRTEXTVERTADJUST_BOTTOM;
+ if (eMH==SDRMEASURE_TEXTRIGHTOUTSIDE) eTV=SDRTEXTVERTADJUST_TOP;
+ // bei eMH==SDRMEASURE_TEXTINSIDE kann vertikal geankert werden.
+ if (!bBelowRefEdge) {
+ if (eMV==SDRMEASURE_ABOVE) eTH=SDRTEXTHORZADJUST_LEFT;
+ if (eMV==SDRMEASURE_BELOW) eTH=SDRTEXTHORZADJUST_RIGHT;
+ } else {
+ if (eMV==SDRMEASURE_ABOVE) eTH=SDRTEXTHORZADJUST_RIGHT;
+ if (eMV==SDRMEASURE_BELOW) eTH=SDRTEXTHORZADJUST_LEFT;
+ }
+ if (eMV==SDRMEASURETEXT_BREAKEDLINE || eMV==SDRMEASURETEXT_VERTICALCENTERED) eTH=SDRTEXTHORZADJUST_CENTER;
+ }
+
+ EVAnchorMode eRet=ANCHOR_BOTTOM_HCENTER;
+ if (eTH==SDRTEXTHORZADJUST_LEFT) {
+ if (eTV==SDRTEXTVERTADJUST_TOP) eRet=ANCHOR_TOP_LEFT;
+ else if (eTV==SDRTEXTVERTADJUST_BOTTOM) eRet=ANCHOR_BOTTOM_LEFT;
+ else eRet=ANCHOR_VCENTER_LEFT;
+ } else if (eTH==SDRTEXTHORZADJUST_RIGHT) {
+ if (eTV==SDRTEXTVERTADJUST_TOP) eRet=ANCHOR_TOP_RIGHT;
+ else if (eTV==SDRTEXTVERTADJUST_BOTTOM) eRet=ANCHOR_BOTTOM_RIGHT;
+ else eRet=ANCHOR_VCENTER_RIGHT;
+ } else {
+ if (eTV==SDRTEXTVERTADJUST_TOP) eRet=ANCHOR_TOP_HCENTER;
+ else if (eTV==SDRTEXTVERTADJUST_BOTTOM) eRet=ANCHOR_BOTTOM_HCENTER;
+ else eRet=ANCHOR_VCENTER_HCENTER;
+ }
+ return (sal_uInt16)eRet;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// #i97878#
+// TRGetBaseGeometry/TRSetBaseGeometry needs to be based on two positions,
+// same as line geometry in SdrPathObj. Thus needs to be overloaded and
+// implemented since currently it is derived from SdrTextObj which uses
+// a functionality based on SnapRect which is not useful here
+
+inline double ImplTwipsToMM(double fVal) { return (fVal * (127.0 / 72.0)); }
+inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); }
+
+sal_Bool SdrMeasureObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& /*rPolyPolygon*/) const
+{
+ // handle the same as a simple line since the definition is based on two points
+ const basegfx::B2DRange aRange(aPt1.X(), aPt1.Y(), aPt2.X(), aPt2.Y());
+ basegfx::B2DTuple aScale(aRange.getRange());
+ basegfx::B2DTuple aTranslate(aRange.getMinimum());
+
+ // position maybe relative to anchorpos, convert
+ if( pModel->IsWriter() )
+ {
+ if(GetAnchorPos().X() || GetAnchorPos().Y())
+ {
+ aTranslate -= basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
+ }
+ }
+
+ // force MapUnit to 100th mm
+ SfxMapUnit eMapUnit = pModel->GetItemPool().GetMetric(0);
+ if(eMapUnit != SFX_MAPUNIT_100TH_MM)
+ {
+ switch(eMapUnit)
+ {
+ case SFX_MAPUNIT_TWIP :
+ {
+ // postion
+ aTranslate.setX(ImplTwipsToMM(aTranslate.getX()));
+ aTranslate.setY(ImplTwipsToMM(aTranslate.getY()));
+
+ // size
+ aScale.setX(ImplTwipsToMM(aScale.getX()));
+ aScale.setY(ImplTwipsToMM(aScale.getY()));
+
+ break;
+ }
+ default:
+ {
+ DBG_ERROR("TRGetBaseGeometry: Missing unit translation to 100th mm!");
+ }
+ }
+ }
+
+ // build return value matrix
+ rMatrix = basegfx::tools::createScaleTranslateB2DHomMatrix(aScale, aTranslate);
+
+ return sal_True;
+}
+
+void SdrMeasureObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& /*rPolyPolygon*/)
+{
+ // use given transformation to derive the two defining points from unit line
+ basegfx::B2DPoint aPosA(rMatrix * basegfx::B2DPoint(0.0, 0.0));
+ basegfx::B2DPoint aPosB(rMatrix * basegfx::B2DPoint(1.0, 0.0));
+
+ // force metric to pool metric
+ SfxMapUnit eMapUnit = pModel->GetItemPool().GetMetric(0);
+ if(eMapUnit != SFX_MAPUNIT_100TH_MM)
+ {
+ switch(eMapUnit)
+ {
+ case SFX_MAPUNIT_TWIP :
+ {
+ // position
+ aPosA.setX(ImplMMToTwips(aPosA.getX()));
+ aPosA.setY(ImplMMToTwips(aPosA.getY()));
+ aPosB.setX(ImplMMToTwips(aPosB.getX()));
+ aPosB.setY(ImplMMToTwips(aPosB.getY()));
+
+ break;
+ }
+ default:
+ {
+ DBG_ERROR("TRSetBaseGeometry: Missing unit translation to PoolMetric!");
+ }
+ }
+ }
+
+ if( pModel->IsWriter() )
+ {
+ // if anchor is used, make position relative to it
+ if(GetAnchorPos().X() || GetAnchorPos().Y())
+ {
+ const basegfx::B2DVector aAnchorOffset(GetAnchorPos().X(), GetAnchorPos().Y());
+
+ aPosA += aAnchorOffset;
+ aPosB += aAnchorOffset;
+ }
+ }
+
+ // derive new model data
+ const Point aNewPt1(basegfx::fround(aPosA.getX()), basegfx::fround(aPosA.getY()));
+ const Point aNewPt2(basegfx::fround(aPosB.getX()), basegfx::fround(aPosB.getY()));
+
+ if(aNewPt1 != aPt1 || aNewPt2 != aPt2)
+ {
+ // set model values and broadcast
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+
+ aPt1 = aNewPt1;
+ aPt2 = aNewPt2;
+
+ SetTextDirty();
+ ActionChanged();
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx
new file mode 100644
index 000000000000..26dfb41de180
--- /dev/null
+++ b/svx/source/svdraw/svdomedia.cxx
@@ -0,0 +1,285 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <vcl/svapp.hxx>
+
+#include <svx/svdomedia.hxx>
+#include "svx/svdglob.hxx"
+#include "svx/svdstr.hrc"
+#include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx>
+#include <avmedia/mediawindow.hxx>
+
+// ---------------
+// - SdrMediaObj -
+// ---------------
+
+TYPEINIT1( SdrMediaObj, SdrRectObj );
+
+// ------------------------------------------------------------------------------
+
+SdrMediaObj::SdrMediaObj()
+{
+}
+
+// ------------------------------------------------------------------------------
+
+SdrMediaObj::SdrMediaObj( const Rectangle& rRect ) :
+ SdrRectObj( rRect )
+{
+}
+
+// ------------------------------------------------------------------------------
+
+SdrMediaObj::~SdrMediaObj()
+{
+}
+
+// ------------------------------------------------------------------------------
+
+FASTBOOL SdrMediaObj::HasTextEdit() const
+{
+ return sal_False;
+}
+
+// ------------------------------------------------------------------------------
+
+sdr::contact::ViewContact* SdrMediaObj::CreateObjectSpecificViewContact()
+{
+ return new ::sdr::contact::ViewContactOfSdrMediaObj( *this );
+}
+
+// ------------------------------------------------------------------------------
+
+void SdrMediaObj::TakeObjInfo( SdrObjTransformInfoRec& rInfo ) const
+{
+ rInfo.bSelectAllowed = true;
+ rInfo.bMoveAllowed = true;
+ rInfo.bResizeFreeAllowed = true;
+ rInfo.bResizePropAllowed = true;
+ rInfo.bRotateFreeAllowed = false;
+ rInfo.bRotate90Allowed = false;
+ rInfo.bMirrorFreeAllowed = false;
+ rInfo.bMirror45Allowed = false;
+ rInfo.bMirror90Allowed = false;
+ rInfo.bTransparenceAllowed = false;
+ rInfo.bGradientAllowed = false;
+ rInfo.bShearAllowed = false;
+ rInfo.bEdgeRadiusAllowed = false;
+ rInfo.bNoOrthoDesired = false;
+ rInfo.bNoContortion = false;
+ rInfo.bCanConvToPath = false;
+ rInfo.bCanConvToPoly = false;
+ rInfo.bCanConvToContour = false;
+ rInfo.bCanConvToPathLineToArea = false;
+ rInfo.bCanConvToPolyLineToArea = false;
+}
+
+// ------------------------------------------------------------------------------
+
+sal_uInt16 SdrMediaObj::GetObjIdentifier() const
+{
+ return sal_uInt16( OBJ_MEDIA );
+}
+
+// ------------------------------------------------------------------------------
+
+void SdrMediaObj::TakeObjNameSingul(XubString& rName) const
+{
+ rName=ImpGetResStr(STR_ObjNameSingulMEDIA);
+
+ String aName( GetName() );
+
+ if(aName.Len())
+ {
+ rName += sal_Unicode(' ');
+ rName += sal_Unicode('\'');
+ rName += aName;
+ rName += sal_Unicode('\'');
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+void SdrMediaObj::TakeObjNamePlural(XubString& rName) const
+{
+ rName=ImpGetResStr(STR_ObjNamePluralMEDIA);
+}
+
+// ------------------------------------------------------------------------------
+
+void SdrMediaObj::operator=(const SdrObject& rObj)
+{
+ SdrRectObj::operator=( rObj );
+
+ if( rObj.ISA( SdrMediaObj ) )
+ {
+ const SdrMediaObj& rMediaObj = static_cast< const SdrMediaObj& >( rObj );
+
+ setMediaProperties( rMediaObj.getMediaProperties() );
+ setGraphic( rMediaObj.mapGraphic.get() );
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+void SdrMediaObj::AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly /* = false */ )
+{
+ Size aSize( Application::GetDefaultDevice()->PixelToLogic( getPreferredSize(), MAP_100TH_MM ) );
+ Size aMaxSize( rMaxRect.GetSize() );
+
+ if( aSize.Height() != 0 && aSize.Width() != 0 )
+ {
+ Point aPos( rMaxRect.TopLeft() );
+
+ // Falls Grafik zu gross, wird die Grafik
+ // in die Seite eingepasst
+ if ( (!bShrinkOnly ||
+ ( aSize.Height() > aMaxSize.Height() ) ||
+ ( aSize.Width() > aMaxSize.Width() ) )&&
+ aSize.Height() && aMaxSize.Height() )
+ {
+ float fGrfWH = (float)aSize.Width() /
+ (float)aSize.Height();
+ float fWinWH = (float)aMaxSize.Width() /
+ (float)aMaxSize.Height();
+
+ // Grafik an Pagesize anpassen (skaliert)
+ if ( fGrfWH < fWinWH )
+ {
+ aSize.Width() = (long)(aMaxSize.Height() * fGrfWH);
+ aSize.Height()= aMaxSize.Height();
+ }
+ else if ( fGrfWH > 0.F )
+ {
+ aSize.Width() = aMaxSize.Width();
+ aSize.Height()= (long)(aMaxSize.Width() / fGrfWH);
+ }
+
+ aPos = rMaxRect.Center();
+ }
+
+ if( bShrinkOnly )
+ aPos = aRect.TopLeft();
+
+ aPos.X() -= aSize.Width() / 2;
+ aPos.Y() -= aSize.Height() / 2;
+ SetLogicRect( Rectangle( aPos, aSize ) );
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+void SdrMediaObj::setURL( const ::rtl::OUString& rURL )
+{
+ ::avmedia::MediaItem aURLItem;
+
+ aURLItem.setURL( rURL );
+ setMediaProperties( aURLItem );
+}
+
+// ------------------------------------------------------------------------------
+
+const ::rtl::OUString& SdrMediaObj::getURL() const
+{
+ return getMediaProperties().getURL();
+}
+
+// ------------------------------------------------------------------------------
+
+void SdrMediaObj::setMediaProperties( const ::avmedia::MediaItem& rState )
+{
+ mediaPropertiesChanged( rState );
+ static_cast< ::sdr::contact::ViewContactOfSdrMediaObj& >( GetViewContact() ).executeMediaItem( getMediaProperties() );
+}
+
+// ------------------------------------------------------------------------------
+
+const ::avmedia::MediaItem& SdrMediaObj::getMediaProperties() const
+{
+ return maMediaProperties;
+}
+
+// ------------------------------------------------------------------------------
+
+bool SdrMediaObj::hasPreferredSize() const
+{
+ return static_cast< ::sdr::contact::ViewContactOfSdrMediaObj& >( GetViewContact() ).hasPreferredSize();
+}
+
+// ------------------------------------------------------------------------------
+
+Size SdrMediaObj::getPreferredSize() const
+{
+ return static_cast< ::sdr::contact::ViewContactOfSdrMediaObj& >( GetViewContact() ).getPreferredSize();
+}
+
+// ------------------------------------------------------------------------------
+
+const Graphic& SdrMediaObj::getGraphic() const
+{
+ if( !mapGraphic.get() )
+ const_cast< SdrMediaObj* >( this )->mapGraphic.reset( new Graphic( ::avmedia::MediaWindow::grabFrame( getURL(), true ) ) );
+
+ return *mapGraphic;
+}
+
+// ------------------------------------------------------------------------------
+
+void SdrMediaObj::setGraphic( const Graphic* pGraphic )
+{
+ mapGraphic.reset( pGraphic ? new Graphic( *pGraphic ) : NULL );
+}
+
+// ------------------------------------------------------------------------------
+
+void SdrMediaObj::mediaPropertiesChanged( const ::avmedia::MediaItem& rNewProperties )
+{
+ const sal_uInt32 nMaskSet = rNewProperties.getMaskSet();
+
+ // use only a subset of MediaItem properties for own own properties
+ if( ( AVMEDIA_SETMASK_URL & nMaskSet ) &&
+ ( rNewProperties.getURL() != getURL() ) )
+ {
+ setGraphic();
+ maMediaProperties.setURL( rNewProperties.getURL() );
+ }
+
+ if( AVMEDIA_SETMASK_LOOP & nMaskSet )
+ maMediaProperties.setLoop( rNewProperties.isLoop() );
+
+ if( AVMEDIA_SETMASK_MUTE & nMaskSet )
+ maMediaProperties.setMute( rNewProperties.isMute() );
+
+ if( AVMEDIA_SETMASK_VOLUMEDB & nMaskSet )
+ maMediaProperties.setVolumeDB( rNewProperties.getVolumeDB() );
+
+ if( AVMEDIA_SETMASK_ZOOM & nMaskSet )
+ maMediaProperties.setZoom( rNewProperties.getZoom() );
+}
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
new file mode 100644
index 000000000000..7becaa96e254
--- /dev/null
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -0,0 +1,2242 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svdoole2.hxx>
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+#include <com/sun/star/util/XModifiable.hpp>
+#include <com/sun/star/embed/EmbedStates.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/embed/EmbedMisc.hpp>
+#include <com/sun/star/embed/Aspects.hpp>
+#include <com/sun/star/embed/XInplaceClient.hpp>
+#include <com/sun/star/embed/XInplaceObject.hpp>
+#include <com/sun/star/embed/XLinkageSupport.hpp>
+#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
+#include <com/sun/star/embed/XWindowSupplier.hpp>
+#include <com/sun/star/document/XEventListener.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include "com/sun/star/document/XStorageBasedDocument.hpp"
+
+#include <comphelper/processfactory.hxx>
+#include <cppuhelper/exc_hlp.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/helper/convert.hxx>
+
+#include <svtools/filter.hxx>
+#include <svtools/embedhlp.hxx>
+
+#include <sfx2/objsh.hxx>
+#include <sfx2/ipclient.hxx>
+#include <sfx2/lnkbase.hxx>
+#include <tools/stream.hxx>
+#include <comphelper/anytostring.hxx>
+#include <svx/svdpagv.hxx>
+#include <tools/globname.hxx>
+#include <vcl/jobset.hxx>
+#include <sot/clsids.hxx>
+
+#include <sot/formats.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <svtools/transfer.hxx>
+#include <cppuhelper/implbase5.hxx>
+
+#include <svl/solar.hrc>
+#include <svl/urihelper.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include <svx/svdpagv.hxx>
+#include <svx/svdmodel.hxx>
+#include "svx/svdglob.hxx" // Stringcache
+#include "svx/svdstr.hrc" // Objektname
+#include <svx/svdetc.hxx>
+#include <svx/svdview.hxx>
+#include "unomlstr.hxx"
+#include <svtools/chartprettypainter.hxx>
+#include <svx/sdr/contact/viewcontactofsdrole2obj.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/sdr/properties/oleproperties.hxx>
+
+// #i100710#
+#include <svx/xlnclit.hxx>
+#include <svx/xbtmpit.hxx>
+#include <svx/xflbmtit.hxx>
+#include <svx/xflbstit.hxx>
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+uno::Reference < beans::XPropertySet > lcl_getFrame_throw(const SdrOle2Obj* _pObject)
+{
+ uno::Reference < beans::XPropertySet > xFrame;
+ if ( _pObject )
+ {
+ uno::Reference< frame::XController> xController = _pObject->GetParentXModel()->getCurrentController();
+ if ( xController.is() )
+ {
+ xFrame.set( xController->getFrame(),uno::UNO_QUERY_THROW);
+ }
+ } // if ( _pObject )
+ return xFrame;
+}
+
+class SdrLightEmbeddedClient_Impl : public ::cppu::WeakImplHelper5
+ < embed::XStateChangeListener
+ , document::XEventListener
+ , embed::XInplaceClient
+ , embed::XEmbeddedClient
+ , embed::XWindowSupplier
+ >
+{
+ uno::Reference< awt::XWindow > m_xWindow;
+ SdrOle2Obj* mpObj;
+
+ Fraction m_aScaleWidth;
+ Fraction m_aScaleHeight;
+
+
+public:
+ SdrLightEmbeddedClient_Impl( SdrOle2Obj* pObj );
+ void Release();
+
+ void SetSizeScale( const Fraction& aScaleWidth, const Fraction& aScaleHeight )
+ {
+ m_aScaleWidth = aScaleWidth;
+ m_aScaleHeight = aScaleHeight;
+ }
+
+ Fraction GetScaleWidth() const { return m_aScaleWidth; }
+ Fraction GetScaleHeight() const { return m_aScaleHeight; }
+
+ void setWindow(const uno::Reference< awt::XWindow >& _xWindow);
+
+private:
+ Rectangle impl_getScaledRect_nothrow() const;
+ // XStateChangeListener
+ virtual void SAL_CALL changingState( const ::com::sun::star::lang::EventObject& aEvent, ::sal_Int32 nOldState, ::sal_Int32 nNewState ) throw (::com::sun::star::embed::WrongStateException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL stateChanged( const ::com::sun::star::lang::EventObject& aEvent, ::sal_Int32 nOldState, ::sal_Int32 nNewState ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ // document::XEventListener
+ virtual void SAL_CALL notifyEvent( const document::EventObject& aEvent ) throw( uno::RuntimeException );
+
+ // XEmbeddedClient
+ virtual void SAL_CALL saveObject() throw ( embed::ObjectSaveVetoException, uno::Exception, uno::RuntimeException );
+ virtual void SAL_CALL visibilityChanged( sal_Bool bVisible ) throw ( embed::WrongStateException, uno::RuntimeException );
+
+ // XComponentSupplier
+ virtual uno::Reference< util::XCloseable > SAL_CALL getComponent() throw ( uno::RuntimeException );
+
+ // XInplaceClient
+ virtual sal_Bool SAL_CALL canInplaceActivate() throw ( uno::RuntimeException );
+ virtual void SAL_CALL activatingInplace() throw ( embed::WrongStateException, uno::RuntimeException );
+ virtual void SAL_CALL activatingUI() throw ( embed::WrongStateException, uno::RuntimeException );
+ virtual void SAL_CALL deactivatedInplace() throw ( embed::WrongStateException, uno::RuntimeException );
+ virtual void SAL_CALL deactivatedUI() throw ( embed::WrongStateException, uno::RuntimeException );
+ virtual uno::Reference< ::com::sun::star::frame::XLayoutManager > SAL_CALL getLayoutManager() throw ( embed::WrongStateException, uno::RuntimeException );
+ virtual uno::Reference< frame::XDispatchProvider > SAL_CALL getInplaceDispatchProvider() throw ( embed::WrongStateException, uno::RuntimeException );
+ virtual awt::Rectangle SAL_CALL getPlacement() throw ( embed::WrongStateException, uno::RuntimeException );
+ virtual awt::Rectangle SAL_CALL getClipRectangle() throw ( embed::WrongStateException, uno::RuntimeException );
+ virtual void SAL_CALL translateAccelerators( const uno::Sequence< awt::KeyEvent >& aKeys ) throw ( embed::WrongStateException, uno::RuntimeException );
+ virtual void SAL_CALL scrollObject( const awt::Size& aOffset ) throw ( embed::WrongStateException, uno::RuntimeException );
+ virtual void SAL_CALL changedPlacement( const awt::Rectangle& aPosRect ) throw ( embed::WrongStateException, uno::Exception, uno::RuntimeException );
+
+ // XWindowSupplier
+ virtual uno::Reference< awt::XWindow > SAL_CALL getWindow() throw ( uno::RuntimeException );
+};
+
+//--------------------------------------------------------------------
+SdrLightEmbeddedClient_Impl::SdrLightEmbeddedClient_Impl( SdrOle2Obj* pObj )
+: mpObj( pObj )
+{
+}
+Rectangle SdrLightEmbeddedClient_Impl::impl_getScaledRect_nothrow() const
+{
+ MapUnit aContainerMapUnit( MAP_100TH_MM );
+ uno::Reference< embed::XVisualObject > xParentVis( mpObj->GetParentXModel(), uno::UNO_QUERY );
+ if ( xParentVis.is() )
+ aContainerMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xParentVis->getMapUnit( mpObj->GetAspect() ) );
+ Rectangle aLogicRect( mpObj->GetLogicRect() );
+ // apply scaling to object area and convert to pixels
+ aLogicRect.SetSize( Size( Fraction( aLogicRect.GetWidth() ) * m_aScaleWidth,
+ Fraction( aLogicRect.GetHeight() ) * m_aScaleHeight ) );
+ return aLogicRect;
+}
+//--------------------------------------------------------------------
+void SAL_CALL SdrLightEmbeddedClient_Impl::changingState( const ::com::sun::star::lang::EventObject& /*aEvent*/, ::sal_Int32 /*nOldState*/, ::sal_Int32 /*nNewState*/ ) throw (::com::sun::star::embed::WrongStateException, ::com::sun::star::uno::RuntimeException)
+{
+}
+
+//--------------------------------------------------------------------
+void SdrLightEmbeddedClient_Impl::Release()
+{
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ mpObj = NULL;
+ }
+
+ release();
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL SdrLightEmbeddedClient_Impl::stateChanged( const ::com::sun::star::lang::EventObject& /*aEvent*/, ::sal_Int32 nOldState, ::sal_Int32 nNewState ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ if ( mpObj && nOldState == embed::EmbedStates::LOADED && nNewState == embed::EmbedStates::RUNNING )
+ {
+ mpObj->ObjectLoaded();
+ GetSdrGlobalData().GetOLEObjCache().InsertObj(mpObj);
+ }
+ else if ( mpObj && nNewState == embed::EmbedStates::LOADED && nOldState == embed::EmbedStates::RUNNING )
+ {
+ GetSdrGlobalData().GetOLEObjCache().RemoveObj(mpObj);
+ }
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL SdrLightEmbeddedClient_Impl::disposing( const ::com::sun::star::lang::EventObject& /*aEvent*/ ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ GetSdrGlobalData().GetOLEObjCache().RemoveObj(mpObj);
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL SdrLightEmbeddedClient_Impl::notifyEvent( const document::EventObject& aEvent ) throw( uno::RuntimeException )
+{
+ // TODO/LATER: when writer uses this implementation the code could be shared with SfxInPlaceClient_Impl
+
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ // the code currently makes sence only in case there is no other client
+ if ( mpObj && mpObj->GetAspect() != embed::Aspects::MSOLE_ICON && aEvent.EventName.equalsAscii("OnVisAreaChanged")
+ && mpObj->GetObjRef().is() && mpObj->GetObjRef()->getClientSite() == uno::Reference< embed::XEmbeddedClient >( this ) )
+ {
+ try
+ {
+ MapUnit aContainerMapUnit( MAP_100TH_MM );
+ uno::Reference< embed::XVisualObject > xParentVis( mpObj->GetParentXModel(), uno::UNO_QUERY );
+ if ( xParentVis.is() )
+ aContainerMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xParentVis->getMapUnit( mpObj->GetAspect() ) );
+
+ MapUnit aObjMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( mpObj->GetObjRef()->getMapUnit( mpObj->GetAspect() ) );
+
+ Rectangle aVisArea;
+ awt::Size aSz;
+ try
+ {
+ aSz = mpObj->GetObjRef()->getVisualAreaSize( mpObj->GetAspect() );
+ }
+ catch( embed::NoVisualAreaSizeException& )
+ {
+ OSL_ENSURE( sal_False, "No visual area size!\n" );
+ aSz.Width = 5000;
+ aSz.Height = 5000;
+ }
+ catch( uno::Exception& )
+ {
+ OSL_ENSURE( sal_False, "Unexpected exception!\n" );
+ aSz.Width = 5000;
+ aSz.Height = 5000;
+ }
+
+ aVisArea.SetSize( Size( aSz.Width, aSz.Height ) );
+ aVisArea = OutputDevice::LogicToLogic( aVisArea, aObjMapUnit, aContainerMapUnit );
+ Size aScaledSize( static_cast< long >( m_aScaleWidth * Fraction( aVisArea.GetWidth() ) ),
+ static_cast< long >( m_aScaleHeight * Fraction( aVisArea.GetHeight() ) ) );
+ Rectangle aLogicRect( mpObj->GetLogicRect() );
+
+ // react to the change if the difference is bigger than one pixel
+ Size aPixelDiff =
+ Application::GetDefaultDevice()->LogicToPixel(
+ Size( aLogicRect.GetWidth() - aScaledSize.Width(),
+ aLogicRect.GetHeight() - aScaledSize.Height() ),
+ aContainerMapUnit );
+ if( aPixelDiff.Width() || aPixelDiff.Height() )
+ {
+ mpObj->SetLogicRect( Rectangle( aLogicRect.TopLeft(), aScaledSize ) );
+ mpObj->BroadcastObjectChange();
+ }
+ else
+ mpObj->ActionChanged();
+ }
+ catch( uno::Exception& )
+ {
+ OSL_ENSURE( sal_False, "Unexpected exception!\n" );
+ }
+ }
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL SdrLightEmbeddedClient_Impl::saveObject()
+ throw ( embed::ObjectSaveVetoException,
+ uno::Exception,
+ uno::RuntimeException )
+{
+ // TODO/LATER: when writer uses this implementation the code could be shared with SfxInPlaceClient_Impl
+ uno::Reference< embed::XCommonEmbedPersist > xPersist;
+ uno::Reference< util::XModifiable > xModifiable;
+
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ if ( !mpObj )
+ throw embed::ObjectSaveVetoException();
+
+ // the common persistance is supported by objects and links
+ xPersist = uno::Reference< embed::XCommonEmbedPersist >( mpObj->GetObjRef(), uno::UNO_QUERY_THROW );
+ xModifiable = uno::Reference< util::XModifiable >( mpObj->GetParentXModel(), uno::UNO_QUERY );
+ }
+
+ xPersist->storeOwn();
+
+ if ( xModifiable.is() )
+ xModifiable->setModified( sal_True );
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL SdrLightEmbeddedClient_Impl::visibilityChanged( sal_Bool /*bVisible*/ )
+ throw ( embed::WrongStateException,
+ uno::RuntimeException )
+{
+ // nothing to do currently
+ // TODO/LATER: when writer uses this implementation the code could be shared with SfxInPlaceClient_Impl
+ if ( mpObj )
+ {
+ Rectangle aLogicRect( mpObj->GetLogicRect() );
+ Size aLogicSize( aLogicRect.GetWidth(), aLogicRect.GetHeight() );
+
+ if( mpObj->IsChart() )
+ {
+ //charts never should be stretched see #i84323# for example
+ mpObj->SetLogicRect( Rectangle( aLogicRect.TopLeft(), aLogicSize ) );
+ mpObj->BroadcastObjectChange();
+ } // if( mpObj->IsChart() )
+ }
+}
+
+//--------------------------------------------------------------------
+uno::Reference< util::XCloseable > SAL_CALL SdrLightEmbeddedClient_Impl::getComponent()
+ throw ( uno::RuntimeException )
+{
+ uno::Reference< util::XCloseable > xResult;
+
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( mpObj )
+ xResult = uno::Reference< util::XCloseable >( mpObj->GetParentXModel(), uno::UNO_QUERY );
+
+ return xResult;
+}
+// XInplaceClient
+//--------------------------------------------------------------------
+sal_Bool SAL_CALL SdrLightEmbeddedClient_Impl::canInplaceActivate()
+ throw ( uno::RuntimeException )
+{
+ sal_Bool bRet = sal_False;
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( mpObj )
+ {
+ uno::Reference< embed::XEmbeddedObject > xObject = mpObj->GetObjRef();
+ if ( !xObject.is() )
+ throw uno::RuntimeException();
+ // we don't want to switch directly from outplace to inplace mode
+ bRet = !( xObject->getCurrentState() == embed::EmbedStates::ACTIVE || mpObj->GetAspect() == embed::Aspects::MSOLE_ICON );
+ } // if ( mpObj )
+ return bRet;
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL SdrLightEmbeddedClient_Impl::activatingInplace()
+ throw ( embed::WrongStateException,
+ uno::RuntimeException )
+{
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL SdrLightEmbeddedClient_Impl::activatingUI()
+ throw ( embed::WrongStateException,
+ uno::RuntimeException )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ uno::Reference < beans::XPropertySet > xFrame( lcl_getFrame_throw(mpObj));
+ uno::Reference < frame::XFrame > xOwnFrame( xFrame,uno::UNO_QUERY);
+ uno::Reference < frame::XFramesSupplier > xParentFrame( xOwnFrame->getCreator(), uno::UNO_QUERY );
+ if ( xParentFrame.is() )
+ xParentFrame->setActiveFrame( xOwnFrame );
+
+ OLEObjCache& rObjCache = GetSdrGlobalData().GetOLEObjCache();
+ const sal_uIntPtr nCount = rObjCache.Count();
+ for(sal_Int32 i = nCount-1 ; i >= 0;--i)
+ {
+ SdrOle2Obj* pObj = reinterpret_cast<SdrOle2Obj*>(rObjCache.GetObject(i));
+ if ( pObj != mpObj )
+ {
+ // only deactivate ole objects which belongs to the same frame
+ if ( xFrame == lcl_getFrame_throw(pObj) )
+ {
+ uno::Reference< embed::XEmbeddedObject > xObject = pObj->GetObjRef();
+ try
+ {
+ if ( xObject->getStatus( pObj->GetAspect() ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE )
+ xObject->changeState( embed::EmbedStates::INPLACE_ACTIVE );
+ else
+ {
+ // the links should not stay in running state for long time because of locking
+ uno::Reference< embed::XLinkageSupport > xLink( xObject, uno::UNO_QUERY );
+ if ( xLink.is() && xLink->isLink() )
+ xObject->changeState( embed::EmbedStates::LOADED );
+ else
+ xObject->changeState( embed::EmbedStates::RUNNING );
+ }
+ }
+ catch (com::sun::star::uno::Exception& )
+ {}
+ }
+ }
+ } // for(sal_Int32 i = nCount-1 ; i >= 0;--i)
+
+ //m_pClient->GetViewShell()->UIActivating( m_pClient );
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL SdrLightEmbeddedClient_Impl::deactivatedInplace()
+ throw ( embed::WrongStateException,
+ uno::RuntimeException )
+{
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL SdrLightEmbeddedClient_Impl::deactivatedUI()
+ throw ( embed::WrongStateException,
+ uno::RuntimeException )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager(getLayoutManager());
+ if ( xLayoutManager.is() )
+ {
+ const static rtl::OUString aMenuBarURL( RTL_CONSTASCII_USTRINGPARAM( "private:resource/menubar/menubar" ));
+ if ( !xLayoutManager->isElementVisible( aMenuBarURL ) )
+ xLayoutManager->createElement( aMenuBarURL );
+ }
+}
+
+//--------------------------------------------------------------------
+uno::Reference< ::com::sun::star::frame::XLayoutManager > SAL_CALL SdrLightEmbeddedClient_Impl::getLayoutManager()
+ throw ( embed::WrongStateException,
+ uno::RuntimeException )
+{
+ uno::Reference< ::com::sun::star::frame::XLayoutManager > xMan;
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ uno::Reference < beans::XPropertySet > xFrame( lcl_getFrame_throw(mpObj));
+ try
+ {
+ xMan.set(xFrame->getPropertyValue( ::rtl::OUString::createFromAscii("LayoutManager") ),uno::UNO_QUERY);
+ }
+ catch ( uno::Exception& )
+ {
+ throw uno::RuntimeException();
+ }
+
+ return xMan;
+}
+
+//--------------------------------------------------------------------
+uno::Reference< frame::XDispatchProvider > SAL_CALL SdrLightEmbeddedClient_Impl::getInplaceDispatchProvider()
+ throw ( embed::WrongStateException,
+ uno::RuntimeException )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ return uno::Reference < frame::XDispatchProvider >( lcl_getFrame_throw(mpObj), uno::UNO_QUERY_THROW );
+}
+
+//--------------------------------------------------------------------
+awt::Rectangle SAL_CALL SdrLightEmbeddedClient_Impl::getPlacement()
+ throw ( embed::WrongStateException,
+ uno::RuntimeException )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( !mpObj )
+ throw uno::RuntimeException();
+
+ Rectangle aLogicRect = impl_getScaledRect_nothrow();
+ MapUnit aContainerMapUnit( MAP_100TH_MM );
+ uno::Reference< embed::XVisualObject > xParentVis( mpObj->GetParentXModel(), uno::UNO_QUERY );
+ if ( xParentVis.is() )
+ aContainerMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xParentVis->getMapUnit( mpObj->GetAspect() ) );
+
+ aLogicRect = Application::GetDefaultDevice()->LogicToPixel(aLogicRect,aContainerMapUnit);
+ return AWTRectangle( aLogicRect );
+}
+
+//--------------------------------------------------------------------
+awt::Rectangle SAL_CALL SdrLightEmbeddedClient_Impl::getClipRectangle()
+ throw ( embed::WrongStateException,
+ uno::RuntimeException )
+{
+ return getPlacement();
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL SdrLightEmbeddedClient_Impl::translateAccelerators( const uno::Sequence< awt::KeyEvent >& /*aKeys*/ )
+ throw ( embed::WrongStateException,
+ uno::RuntimeException )
+{
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL SdrLightEmbeddedClient_Impl::scrollObject( const awt::Size& /*aOffset*/ )
+ throw ( embed::WrongStateException,
+ uno::RuntimeException )
+{
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL SdrLightEmbeddedClient_Impl::changedPlacement( const awt::Rectangle& aPosRect )
+ throw ( embed::WrongStateException,
+ uno::Exception,
+ uno::RuntimeException )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( !mpObj )
+ throw uno::RuntimeException();
+
+ uno::Reference< embed::XInplaceObject > xInplace( mpObj->GetObjRef(), uno::UNO_QUERY );
+ if ( !xInplace.is() )
+ throw uno::RuntimeException();
+
+ // check if the change is at least one pixel in size
+ awt::Rectangle aOldRect = getPlacement();
+ Rectangle aNewPixelRect = VCLRectangle( aPosRect );
+ Rectangle aOldPixelRect = VCLRectangle( aOldRect );
+ if ( aOldPixelRect == aNewPixelRect )
+ // nothing has changed
+ return;
+
+ // new scaled object area
+ MapUnit aContainerMapUnit( MAP_100TH_MM );
+ uno::Reference< embed::XVisualObject > xParentVis( mpObj->GetParentXModel(), uno::UNO_QUERY );
+ if ( xParentVis.is() )
+ aContainerMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xParentVis->getMapUnit( mpObj->GetAspect() ) );
+
+ Rectangle aNewLogicRect = Application::GetDefaultDevice()->PixelToLogic(aNewPixelRect,aContainerMapUnit);
+ Rectangle aLogicRect = impl_getScaledRect_nothrow();
+
+ if ( aNewLogicRect != aLogicRect )
+ {
+ // the calculation of the object area has not changed the object size
+ // it should be done here then
+ //SfxBooleanFlagGuard aGuard( m_bResizeNoScale, sal_True );
+
+ // new size of the object area without scaling
+ Size aNewObjSize( Fraction( aNewLogicRect.GetWidth() ) / m_aScaleWidth,
+ Fraction( aNewLogicRect.GetHeight() ) / m_aScaleHeight );
+
+ // now remove scaling from new placement and keep this a the new object area
+ aNewLogicRect.SetSize( aNewObjSize );
+ // react to the change if the difference is bigger than one pixel
+ Size aPixelDiff =
+ Application::GetDefaultDevice()->LogicToPixel(
+ Size( aLogicRect.GetWidth() - aNewObjSize.Width(),
+ aLogicRect.GetHeight() - aNewObjSize.Height() ),
+ aContainerMapUnit );
+ if( aPixelDiff.Width() || aPixelDiff.Height() )
+ {
+ mpObj->SetLogicRect( Rectangle( aLogicRect.TopLeft(), aNewObjSize ) );
+ mpObj->BroadcastObjectChange();
+ }
+ else
+ mpObj->ActionChanged();
+
+ // let the window size be recalculated
+ //SizeHasChanged(); // TODO: OJ
+ }
+}
+// XWindowSupplier
+//--------------------------------------------------------------------
+uno::Reference< awt::XWindow > SAL_CALL SdrLightEmbeddedClient_Impl::getWindow()
+ throw ( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ uno::Reference< awt::XWindow > xCurrent = m_xWindow;
+ if ( !xCurrent.is() )
+ {
+ if ( !mpObj )
+ throw uno::RuntimeException();
+ uno::Reference< frame::XFrame> xFrame(lcl_getFrame_throw(mpObj),uno::UNO_QUERY_THROW);
+ xCurrent = xFrame->getComponentWindow();
+ } // if ( !xCurrent.is() )
+ return xCurrent;
+}
+void SdrLightEmbeddedClient_Impl::setWindow(const uno::Reference< awt::XWindow >& _xWindow)
+{
+ m_xWindow = _xWindow;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class SdrEmbedObjectLink : public sfx2::SvBaseLink
+{
+ SdrOle2Obj* pObj;
+
+public:
+ SdrEmbedObjectLink(SdrOle2Obj* pObj);
+ virtual ~SdrEmbedObjectLink();
+
+ virtual void Closed();
+ virtual void DataChanged( const String& rMimeType,
+ const ::com::sun::star::uno::Any & rValue );
+
+ sal_Bool Connect() { return GetRealObject() != NULL; }
+};
+
+// -----------------------------------------------------------------------------
+
+SdrEmbedObjectLink::SdrEmbedObjectLink(SdrOle2Obj* pObject):
+ ::sfx2::SvBaseLink( ::sfx2::LINKUPDATE_ONCALL, SOT_FORMATSTR_ID_SVXB ),
+ pObj(pObject)
+{
+ SetSynchron( sal_False );
+}
+
+// -----------------------------------------------------------------------------
+
+SdrEmbedObjectLink::~SdrEmbedObjectLink()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrEmbedObjectLink::DataChanged( const String& /*rMimeType*/,
+ const ::com::sun::star::uno::Any & /*rValue*/ )
+{
+ if ( !pObj->UpdateLinkURL_Impl() )
+ {
+ // the link URL was not changed
+ uno::Reference< embed::XEmbeddedObject > xObject = pObj->GetObjRef();
+ OSL_ENSURE( xObject.is(), "The object must exist always!\n" );
+ if ( xObject.is() )
+ {
+ // let the object reload the link
+ // TODO/LATER: reload call could be used for this case
+
+ try
+ {
+ sal_Int32 nState = xObject->getCurrentState();
+ if ( nState != embed::EmbedStates::LOADED )
+ {
+ // in some cases the linked file probably is not locked so it could be changed
+ xObject->changeState( embed::EmbedStates::LOADED );
+ xObject->changeState( nState );
+ }
+ }
+ catch ( uno::Exception& )
+ {
+ }
+ }
+ }
+
+ pObj->GetNewReplacement();
+ pObj->SetChanged();
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrEmbedObjectLink::Closed()
+{
+ pObj->BreakFileLink_Impl();
+ SvBaseLink::Closed();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class SdrOle2ObjImpl
+{
+public:
+ // TODO/LATER: do we really need this pointer?
+ GraphicObject* pGraphicObject;
+ String aPersistName; // name of object in persist
+ SdrLightEmbeddedClient_Impl* pLightClient; // must be registered as client only using AddOwnLightClient() call
+
+ // #107645#
+ // New local var to avoid repeated loading if load of OLE2 fails
+ sal_Bool mbLoadingOLEObjectFailed;
+ sal_Bool mbConnected;
+
+ SdrEmbedObjectLink* mpObjectLink;
+ String maLinkURL;
+
+ SdrOle2ObjImpl()
+ : pGraphicObject( NULL )
+ // #107645#
+ // init to start situation, loading did not fail
+ , mbLoadingOLEObjectFailed( sal_False )
+ , mbConnected( sal_False )
+ , mpObjectLink( NULL )
+ {
+ }
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+// Predicate determining whether the given OLE is an internal math
+// object
+static bool ImplIsMathObj( const uno::Reference < embed::XEmbeddedObject >& rObjRef )
+{
+ if ( !rObjRef.is() )
+ return false;
+
+ SvGlobalName aClassName( rObjRef->getClassID() );
+ if( aClassName == SvGlobalName(SO3_SM_CLASSID_30) ||
+ aClassName == SvGlobalName(SO3_SM_CLASSID_40) ||
+ aClassName == SvGlobalName(SO3_SM_CLASSID_50) ||
+ aClassName == SvGlobalName(SO3_SM_CLASSID_60) ||
+ aClassName == SvGlobalName(SO3_SM_CLASSID) )
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// BaseProperties section
+
+sdr::properties::BaseProperties* SdrOle2Obj::CreateObjectSpecificProperties()
+{
+ return new sdr::properties::OleProperties(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// DrawContact section
+
+sdr::contact::ViewContact* SdrOle2Obj::CreateObjectSpecificViewContact()
+{
+ return new sdr::contact::ViewContactOfSdrOle2Obj(*this);
+}
+
+// -----------------------------------------------------------------------------
+
+TYPEINIT1(SdrOle2Obj,SdrRectObj);
+DBG_NAME(SdrOle2Obj)
+SdrOle2Obj::SdrOle2Obj(FASTBOOL bFrame_) : m_bTypeAsked(false)
+,m_bChart(false)
+{
+ DBG_CTOR( SdrOle2Obj,NULL);
+ bInDestruction = sal_False;
+ Init();
+ bFrame=bFrame_;
+}
+
+// -----------------------------------------------------------------------------
+SdrOle2Obj::SdrOle2Obj( const svt::EmbeddedObjectRef& rNewObjRef, FASTBOOL bFrame_)
+ : xObjRef( rNewObjRef )
+ , m_bTypeAsked(false)
+ , m_bChart(false)
+{
+ DBG_CTOR( SdrOle2Obj,NULL);
+ bInDestruction = sal_False;
+ Init();
+
+ bFrame=bFrame_;
+
+ if ( xObjRef.is() && (xObjRef->getStatus( GetAspect() ) & embed::EmbedMisc::EMBED_NEVERRESIZE ) )
+ SetResizeProtect(sal_True);
+
+ // #108759# For math objects, set closed state to transparent
+ if( ImplIsMathObj( xObjRef.GetObject() ) )
+ SetClosedObj( false );
+}
+
+// -----------------------------------------------------------------------------
+
+SdrOle2Obj::SdrOle2Obj( const svt::EmbeddedObjectRef& rNewObjRef, const XubString& rNewObjName, FASTBOOL bFrame_)
+ : xObjRef( rNewObjRef )
+ , m_bTypeAsked(false)
+ , m_bChart(false)
+{
+ DBG_CTOR( SdrOle2Obj,NULL);
+ bInDestruction = sal_False;
+ Init();
+
+ mpImpl->aPersistName = rNewObjName;
+ bFrame=bFrame_;
+
+ if ( xObjRef.is() && (xObjRef->getStatus( GetAspect() ) & embed::EmbedMisc::EMBED_NEVERRESIZE ) )
+ SetResizeProtect(sal_True);
+
+ // #108759# For math objects, set closed state to transparent
+ if( ImplIsMathObj( xObjRef.GetObject() ) )
+ SetClosedObj( false );
+}
+
+// -----------------------------------------------------------------------------
+
+SdrOle2Obj::SdrOle2Obj( const svt::EmbeddedObjectRef& rNewObjRef, const XubString& rNewObjName, const Rectangle& rNewRect, FASTBOOL bFrame_)
+ : SdrRectObj(rNewRect)
+ , xObjRef( rNewObjRef )
+ , m_bTypeAsked(false)
+ , m_bChart(false)
+{
+ DBG_CTOR( SdrOle2Obj,NULL);
+ bInDestruction = sal_False;
+ Init();
+
+ mpImpl->aPersistName = rNewObjName;
+ bFrame=bFrame_;
+
+ if ( xObjRef.is() && (xObjRef->getStatus( GetAspect() ) & embed::EmbedMisc::EMBED_NEVERRESIZE ) )
+ SetResizeProtect(sal_True);
+
+ // #108759# For math objects, set closed state to transparent
+ if( ImplIsMathObj( xObjRef.GetObject() ) )
+ SetClosedObj( false );
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrOle2Obj::Init()
+{
+ mpImpl = new SdrOle2ObjImpl;
+ pModifyListener = NULL;
+ pGraphic=NULL;
+ mpImpl->pGraphicObject=NULL;
+ mpImpl->pLightClient = 0;
+
+ xObjRef.Lock( sal_True );
+}
+
+// -----------------------------------------------------------------------------
+
+SdrOle2Obj::~SdrOle2Obj()
+{
+ DBG_DTOR( SdrOle2Obj,NULL);
+ bInDestruction = sal_True;
+
+ if ( mpImpl->mbConnected )
+ Disconnect();
+
+ if( pGraphic!=NULL )
+ delete pGraphic;
+
+ if(mpImpl->pGraphicObject!=NULL)
+ delete mpImpl->pGraphicObject;
+
+ if(pModifyListener)
+ {
+ pModifyListener->invalidate();
+ pModifyListener->release();
+ }
+
+ DisconnectFileLink_Impl();
+
+ if ( mpImpl->pLightClient )
+ {
+ mpImpl->pLightClient->Release();
+ mpImpl->pLightClient = NULL;
+ }
+
+ delete mpImpl;
+}
+
+// -----------------------------------------------------------------------------
+void SdrOle2Obj::SetAspect( sal_Int64 nAspect )
+{
+ xObjRef.SetViewAspect( nAspect );
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrOle2Obj::SetGraphic_Impl(const Graphic* pGrf)
+{
+ if ( pGraphic )
+ {
+ delete pGraphic;
+ pGraphic = NULL;
+ delete mpImpl->pGraphicObject;
+ mpImpl->pGraphicObject = NULL;
+ }
+
+ if (pGrf!=NULL)
+ {
+ pGraphic = new Graphic(*pGrf);
+ mpImpl->pGraphicObject = new GraphicObject( *pGraphic );
+ }
+
+ SetChanged();
+ BroadcastObjectChange();
+
+ //if ( ppObjRef->Is() && pGrf )
+ // BroadcastObjectChange();
+}
+
+void SdrOle2Obj::SetGraphic(const Graphic* pGrf)
+{
+ // only for setting a preview graphic
+ SetGraphic_Impl( pGrf );
+}
+
+// -----------------------------------------------------------------------------
+
+FASTBOOL SdrOle2Obj::IsEmpty() const
+{
+ return !(xObjRef.is());
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrOle2Obj::Connect()
+{
+ if( IsEmptyPresObj() )
+ return;
+
+ if( mpImpl->mbConnected )
+ {
+ // mba: currently there are situations where it seems to be unavoidable to have multiple connects
+ // changing this would need a larger code rewrite, so for now I remove the assertion
+ // DBG_ERROR("Connect() called on connected object!");
+ return;
+ }
+
+ Connect_Impl();
+ AddListeners_Impl();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdrOle2Obj::UpdateLinkURL_Impl()
+{
+ sal_Bool bResult = sal_False;
+
+ if ( mpImpl->mpObjectLink )
+ {
+ sfx2::LinkManager* pLinkManager = pModel ? pModel->GetLinkManager() : NULL;
+ if ( pLinkManager )
+ {
+ String aNewLinkURL;
+ pLinkManager->GetDisplayNames( mpImpl->mpObjectLink, 0, &aNewLinkURL, 0, 0 );
+ if ( !aNewLinkURL.EqualsIgnoreCaseAscii( mpImpl->maLinkURL ) )
+ {
+ const_cast<SdrOle2Obj*>(this)->GetObjRef_Impl();
+ uno::Reference< embed::XCommonEmbedPersist > xPersObj( xObjRef.GetObject(), uno::UNO_QUERY );
+ OSL_ENSURE( xPersObj.is(), "The object must exist!\n" );
+ if ( xPersObj.is() )
+ {
+ try
+ {
+ sal_Int32 nCurState = xObjRef->getCurrentState();
+ if ( nCurState != embed::EmbedStates::LOADED )
+ xObjRef->changeState( embed::EmbedStates::LOADED );
+
+ // TODO/LATER: there should be possible to get current mediadescriptor settings from the object
+ uno::Sequence< beans::PropertyValue > aArgs( 1 );
+ aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
+ aArgs[0].Value <<= ::rtl::OUString( aNewLinkURL );
+ xPersObj->reload( aArgs, uno::Sequence< beans::PropertyValue >() );
+
+ mpImpl->maLinkURL = aNewLinkURL;
+ bResult = sal_True;
+
+ if ( nCurState != embed::EmbedStates::LOADED )
+ xObjRef->changeState( nCurState );
+ }
+ catch( ::com::sun::star::uno::Exception& e )
+ {
+ (void)e;
+ DBG_ERROR(
+ (OString("SdrOle2Obj::UpdateLinkURL_Impl(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+ }
+
+ if ( !bResult )
+ {
+ // TODO/LATER: return the old name to the link manager, is it possible?
+ }
+ }
+ }
+ }
+
+ return bResult;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrOle2Obj::BreakFileLink_Impl()
+{
+ uno::Reference<document::XStorageBasedDocument> xDoc;
+ if ( pModel )
+ xDoc.set( pModel->getUnoModel(),uno::UNO_QUERY);
+
+ if ( xDoc.is() )
+ {
+ uno::Reference< embed::XStorage > xStorage = xDoc->getDocumentStorage();
+ if ( xStorage.is() )
+ {
+ try
+ {
+ uno::Reference< embed::XLinkageSupport > xLinkSupport( xObjRef.GetObject(), uno::UNO_QUERY_THROW );
+ xLinkSupport->breakLink( xStorage, mpImpl->aPersistName );
+ DisconnectFileLink_Impl();
+ mpImpl->maLinkURL = String();
+ }
+ catch( ::com::sun::star::uno::Exception& e )
+ {
+ (void)e;
+ DBG_ERROR(
+ (OString("SdrOle2Obj::BreakFileLink_Impl(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrOle2Obj::DisconnectFileLink_Impl()
+{
+ sfx2::LinkManager* pLinkManager = pModel ? pModel->GetLinkManager() : NULL;
+ if ( pLinkManager && mpImpl->mpObjectLink )
+ {
+ pLinkManager->Remove( mpImpl->mpObjectLink );
+ mpImpl->mpObjectLink = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrOle2Obj::CheckFileLink_Impl()
+{
+ if ( pModel && xObjRef.GetObject().is() && !mpImpl->mpObjectLink )
+ {
+ try
+ {
+ uno::Reference< embed::XLinkageSupport > xLinkSupport( xObjRef.GetObject(), uno::UNO_QUERY );
+ if ( xLinkSupport.is() && xLinkSupport->isLink() )
+ {
+ String aLinkURL = xLinkSupport->getLinkURL();
+ if ( aLinkURL.Len() )
+ {
+ // this is a file link so the model link manager should handle it
+ sfx2::LinkManager* pLinkManager = pModel->GetLinkManager();
+ if ( pLinkManager )
+ {
+ mpImpl->mpObjectLink = new SdrEmbedObjectLink( this );
+ mpImpl->maLinkURL = aLinkURL;
+ pLinkManager->InsertFileLink( *mpImpl->mpObjectLink, OBJECT_CLIENT_OLE, aLinkURL, NULL, NULL );
+ mpImpl->mpObjectLink->Connect();
+ }
+ }
+ }
+ }
+ catch( ::com::sun::star::uno::Exception& e )
+ {
+ (void)e;
+ DBG_ERROR(
+ (OString("SdrOle2Obj::CheckFileLink_Impl(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrOle2Obj::Reconnect_Impl()
+{
+ DBG_ASSERT( mpImpl->mbConnected, "Assigned unconnected object?!" );
+ Connect_Impl();
+}
+
+void SdrOle2Obj::Connect_Impl()
+{
+ if( pModel && mpImpl->aPersistName.Len() )
+ {
+ try
+ {
+ ::comphelper::IEmbeddedHelper* pPers = pModel->GetPersist();
+ if ( pPers )
+ {
+ comphelper::EmbeddedObjectContainer& rContainer = pPers->getEmbeddedObjectContainer();
+ if ( !rContainer.HasEmbeddedObject( mpImpl->aPersistName )
+ || ( xObjRef.is() && !rContainer.HasEmbeddedObject( xObjRef.GetObject() ) ) )
+ {
+ // object not known to container document
+ // No object -> disaster!
+ DBG_ASSERT( xObjRef.is(), "No object in connect!");
+ if ( xObjRef.is() )
+ {
+ // object came from the outside, now add it to the container
+ ::rtl::OUString aTmp;
+ rContainer.InsertEmbeddedObject( xObjRef.GetObject(), aTmp );
+ mpImpl->aPersistName = aTmp;
+ }
+ }
+ else if ( !xObjRef.is() )
+ {
+ xObjRef.Assign( rContainer.GetEmbeddedObject( mpImpl->aPersistName ), xObjRef.GetViewAspect() );
+ m_bTypeAsked = false;
+ }
+
+ if ( xObjRef.GetObject().is() )
+ {
+ xObjRef.AssignToContainer( &rContainer, mpImpl->aPersistName );
+ mpImpl->mbConnected = true;
+ xObjRef.Lock( sal_True );
+ }
+ }
+
+ if ( xObjRef.is() )
+ {
+ if ( !mpImpl->pLightClient )
+ {
+ mpImpl->pLightClient = new SdrLightEmbeddedClient_Impl( this );
+ mpImpl->pLightClient->acquire();
+ }
+
+ xObjRef->addStateChangeListener( mpImpl->pLightClient );
+ xObjRef->addEventListener( uno::Reference< document::XEventListener >( mpImpl->pLightClient ) );
+
+ if ( xObjRef->getCurrentState() != embed::EmbedStates::LOADED )
+ GetSdrGlobalData().GetOLEObjCache().InsertObj(this);
+
+ CheckFileLink_Impl();
+
+ uno::Reference< container::XChild > xChild( xObjRef.GetObject(), uno::UNO_QUERY );
+ if( xChild.is() )
+ {
+ uno::Reference< uno::XInterface > xParent( pModel->getUnoModel());
+ if( xParent.is())
+ xChild->setParent( pModel->getUnoModel() );
+ }
+
+ }
+ }
+ catch( ::com::sun::star::uno::Exception& e )
+ {
+ (void)e;
+ DBG_ERROR(
+ (OString("SdrOle2Obj::Connect_Impl(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+ }
+
+ //TODO/LATER: wait for definition of MiscStatus RESIZEONPRINTERCHANGE
+ //if ( xObjRef.is() && (*ppObjRef)->GetMiscStatus() & SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE )
+ {
+ //TODO/LATER: needs a new handling for OnPrinterChanged
+ /*
+ if (pModel && pModel->GetRefDevice() &&
+ pModel->GetRefDevice()->GetOutDevType() == OUTDEV_PRINTER)
+ {
+ // Kein RefDevice oder RefDevice kein Printer
+ sal_Bool bModified = (*ppObjRef)->IsModified();
+ Printer* pPrinter = (Printer*) pModel->GetRefDevice();
+ (*ppObjRef)->OnDocumentPrinterChanged( pPrinter );
+ (*ppObjRef)->SetModified( bModified );
+ }*/
+ }
+}
+
+void SdrOle2Obj::ObjectLoaded()
+{
+ AddListeners_Impl();
+}
+
+void SdrOle2Obj::AddListeners_Impl()
+{
+ if( xObjRef.is() && xObjRef->getCurrentState() != embed::EmbedStates::LOADED )
+ {
+ // register modify listener
+ if( !pModifyListener )
+ {
+ ((SdrOle2Obj*)this)->pModifyListener = new SvxUnoShapeModifyListener( (SdrOle2Obj*)this );
+ pModifyListener->acquire();
+ }
+
+ uno::Reference< util::XModifyBroadcaster > xBC( getXModel(), uno::UNO_QUERY );
+ if( xBC.is() && pModifyListener )
+ {
+ uno::Reference< util::XModifyListener > xListener( pModifyListener );
+ xBC->addModifyListener( xListener );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrOle2Obj::Disconnect()
+{
+ if( IsEmptyPresObj() )
+ return;
+
+ if( !mpImpl->mbConnected )
+ {
+ DBG_ERROR("Disconnect() called on disconnected object!");
+ return;
+ }
+
+ RemoveListeners_Impl();
+ Disconnect_Impl();
+}
+
+void SdrOle2Obj::RemoveListeners_Impl()
+{
+ if( xObjRef.is() && mpImpl->aPersistName.Len() )
+ {
+ try
+ {
+ sal_Int32 nState = xObjRef->getCurrentState();
+ if ( nState != embed::EmbedStates::LOADED )
+ {
+ uno::Reference< util::XModifyBroadcaster > xBC( getXModel(), uno::UNO_QUERY );
+ if( xBC.is() && pModifyListener )
+ {
+ uno::Reference< util::XModifyListener > xListener( pModifyListener );
+ xBC->removeModifyListener( xListener );
+ }
+ }
+ }
+ catch( ::com::sun::star::uno::Exception& e )
+ {
+ (void)e;
+ DBG_ERROR(
+ (OString("SdrOle2Obj::RemoveListeners_Impl(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+ }
+}
+
+void SdrOle2Obj::Disconnect_Impl()
+{
+ try
+ {
+ if ( pModel && mpImpl->aPersistName.Len() )
+ {
+ if( pModel->IsInDestruction() )
+ {
+ // TODO/LATER: here we must assume that the destruction of the model is enough to make clear that we will not
+ // remove the object from the container, even if the DrawingObject itself is not destroyed (unfortunately this
+ // There is no real need to do the following removing of the object from the container
+ // in case the model has correct persistance, but in case of problems such a removing
+ // would make the behaviour of the office more stable
+
+ comphelper::EmbeddedObjectContainer* pContainer = xObjRef.GetContainer();
+ if ( pContainer )
+ {
+ pContainer->CloseEmbeddedObject( xObjRef.GetObject() );
+ xObjRef.AssignToContainer( NULL, mpImpl->aPersistName );
+ }
+
+ // happens later than the destruction of the model, so we can't assert that).
+ //DBG_ASSERT( bInDestruction, "Model is destroyed, but not me?!" );
+ //TODO/LATER: should be make sure that the ObjectShell also forgets the object, because we will close it soon?
+ /*
+ uno::Reference < util::XCloseable > xClose( xObjRef, uno::UNO_QUERY );
+ if ( xClose.is() )
+ {
+ try
+ {
+ xClose->close( sal_True );
+ }
+ catch ( util::CloseVetoException& )
+ {
+ // there's still someone who needs the object!
+ }
+ }
+
+ xObjRef = NULL;*/
+ }
+ else if ( xObjRef.is() )
+ {
+ if ( pModel->getUnoModel().is() )
+ {
+ // remove object, but don't close it (that's up to someone else)
+ comphelper::EmbeddedObjectContainer* pContainer = xObjRef.GetContainer();
+ if ( pContainer )
+ {
+ pContainer->RemoveEmbeddedObject( xObjRef.GetObject(), sal_False);
+
+ // TODO/LATER: mpImpl->aPersistName contains outdated information, to have it uptodate
+ // it should be returned from RemoveEmbeddedObject call. Currently it is no problem,
+ // since no container is adjusted, actually the empty string could be provided as a name here
+ xObjRef.AssignToContainer( NULL, mpImpl->aPersistName );
+ }
+
+ DisconnectFileLink_Impl();
+ }
+ }
+ }
+
+ if ( xObjRef.is() && mpImpl->pLightClient )
+ {
+ xObjRef->removeStateChangeListener ( mpImpl->pLightClient );
+ xObjRef->removeEventListener( uno::Reference< document::XEventListener >( mpImpl->pLightClient ) );
+ xObjRef->setClientSite( NULL );
+
+ GetSdrGlobalData().GetOLEObjCache().RemoveObj(this);
+ }
+ }
+ catch( ::com::sun::star::uno::Exception& e )
+ {
+ (void)e;
+ DBG_ERROR(
+ (OString("SdrOle2Obj::Disconnect_Impl(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+
+ mpImpl->mbConnected = false;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrOle2Obj::SetModel(SdrModel* pNewModel)
+{
+ ::comphelper::IEmbeddedHelper* pDestPers = pNewModel ? pNewModel->GetPersist() : 0;
+ ::comphelper::IEmbeddedHelper* pSrcPers = pModel ? pModel->GetPersist() : 0;
+
+ if ( pNewModel == pModel )
+ {
+ // don't know if this is necessary or if it will ever happen, but who know?!
+ SdrRectObj::SetModel( pNewModel );
+ return;
+ }
+
+ // assignment to model has changed
+ DBG_ASSERT( pSrcPers || !mpImpl->mbConnected, "Connected object without a model?!" );
+
+ DBG_ASSERT( pDestPers, "The destination model must have a persistence! Please submit an issue!" );
+ DBG_ASSERT( pDestPers != pSrcPers, "The source and the destination models should have different persistences! Problems are possible!" );
+
+ // this is a bug if the target model has no persistence
+ // no error handling is possible so just do nothing in this method
+ if ( !pDestPers )
+ return;
+
+ RemoveListeners_Impl();
+
+ if( pDestPers && pSrcPers && !IsEmptyPresObj() )
+ {
+ try
+ {
+ // move the objects' storage; ObjectRef remains the same, but PersistName may change
+ ::rtl::OUString aTmp;
+ comphelper::EmbeddedObjectContainer& rContainer = pSrcPers->getEmbeddedObjectContainer();
+ uno::Reference < embed::XEmbeddedObject > xObj = rContainer.GetEmbeddedObject( mpImpl->aPersistName );
+ DBG_ASSERT( !xObjRef.is() || xObjRef.GetObject() == xObj, "Wrong object identity!" );
+ if ( xObj.is() )
+ {
+ pDestPers->getEmbeddedObjectContainer().MoveEmbeddedObject( rContainer, xObj, aTmp );
+ mpImpl->aPersistName = aTmp;
+ xObjRef.AssignToContainer( &pDestPers->getEmbeddedObjectContainer(), aTmp );
+ }
+ DBG_ASSERT( aTmp.getLength(), "Copying embedded object failed!" );
+ }
+ catch( ::com::sun::star::uno::Exception& e )
+ {
+ (void)e;
+ DBG_ERROR(
+ (OString("SdrOle2Obj::SetModel(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+ }
+ }
+
+ SdrRectObj::SetModel( pNewModel );
+
+ // #i43086#
+ // #i85304 redo the change for charts for the above bugfix, as #i43086# does not ocur anymore
+ //so maybe the ImpSetVisAreaSize call can be removed here completely
+ //Nevertheless I leave it in for other objects as I am not sure about the side effects when removing now
+ if( pModel && !pModel->isLocked() && !IsChart() )
+ ImpSetVisAreaSize();
+
+ if( pDestPers && !IsEmptyPresObj() )
+ {
+ if ( !pSrcPers || IsEmptyPresObj() )
+ // object wasn't connected, now it should
+ Connect_Impl();
+ else
+ Reconnect_Impl();
+ }
+
+ AddListeners_Impl();
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrOle2Obj::SetPage(SdrPage* pNewPage)
+{
+ FASTBOOL bRemove=pNewPage==NULL && pPage!=NULL;
+ FASTBOOL bInsert=pNewPage!=NULL && pPage==NULL;
+
+ if (bRemove && mpImpl->mbConnected )
+ Disconnect();
+
+ SdrRectObj::SetPage(pNewPage);
+
+ if (bInsert && !mpImpl->mbConnected )
+ Connect();
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrOle2Obj::SetObjRef( const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >& rNewObjRef )
+{
+ DBG_ASSERT( !rNewObjRef.is() || !xObjRef.GetObject().is(), "SetObjRef called on already initialized object!");
+ if( rNewObjRef == xObjRef.GetObject() )
+ return;
+
+ // MBA: the caller of the method is responsible to control the old object, it will not be closed here
+ // Otherwise WW8 import crashes because it tranfers control to OLENode by this method
+ if ( xObjRef.GetObject().is() )
+ xObjRef.Lock( sal_False );
+
+ // MBA: avoid removal of object in Disconnect! It is definitely a HACK to call SetObjRef(0)!
+ // This call will try to close the objects; so if anybody else wants to keep it, it must be locked by a CloseListener
+ xObjRef.Clear();
+
+ if ( mpImpl->mbConnected )
+ Disconnect();
+
+ xObjRef.Assign( rNewObjRef, GetAspect() );
+ m_bTypeAsked = false;
+
+ if ( xObjRef.is() )
+ {
+ DELETEZ( pGraphic );
+
+ if ( (xObjRef->getStatus( GetAspect() ) & embed::EmbedMisc::EMBED_NEVERRESIZE ) )
+ SetResizeProtect(sal_True);
+
+ // #108759# For math objects, set closed state to transparent
+ if( ImplIsMathObj( rNewObjRef ) )
+ SetClosedObj( false );
+
+ Connect();
+ }
+
+ SetChanged();
+ BroadcastObjectChange();
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrOle2Obj::SetClosedObj( bool bIsClosed )
+{
+ // TODO/LATER: do we still need this hack?
+ // #108759# Allow changes to the closed state of OLE objects
+ bClosedObj = bIsClosed;
+}
+
+// -----------------------------------------------------------------------------
+
+SdrObject* SdrOle2Obj::getFullDragClone() const
+{
+ // special handling for OLE. The default handling works, but is too
+ // slow when the whole OLE needs to be cloned. Get the Metafile and
+ // create a graphic object with it
+ Graphic* pOLEGraphic = GetGraphic();
+ SdrObject* pClone = 0;
+
+ if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
+ {
+ pOLEGraphic = getEmbeddedObjectRef().GetHCGraphic();
+ }
+
+ if(pOLEGraphic)
+ {
+ pClone = new SdrGrafObj(*pOLEGraphic, GetSnapRect());
+
+ // this would be the place where to copy all attributes
+ // when OLE will support fill and line style
+ // pClone->SetMergedItem(pOleObject->GetMergedItemSet());
+ }
+ else
+ {
+ // #i100710# pOLEGraphic may be zero (no visualisation available),
+ // so we need to use the OLE replacement graphic
+ pClone = new SdrRectObj(GetSnapRect());
+
+ // gray outline
+ pClone->SetMergedItem(XLineStyleItem(XLINE_SOLID));
+ const svtools::ColorConfig aColorConfig;
+ const svtools::ColorConfigValue aColor(aColorConfig.GetColorValue(svtools::OBJECTBOUNDARIES));
+ pClone->SetMergedItem(XLineColorItem(String(), aColor.nColor));
+
+ // bitmap fill
+ pClone->SetMergedItem(XFillStyleItem(XFILL_BITMAP));
+ pClone->SetMergedItem(XFillBitmapItem(String(), GetEmtyOLEReplacementBitmap()));
+ pClone->SetMergedItem(XFillBmpTileItem(false));
+ pClone->SetMergedItem(XFillBmpStretchItem(false));
+ }
+
+ return pClone;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrOle2Obj::SetPersistName( const String& rPersistName )
+{
+ DBG_ASSERT( !mpImpl->aPersistName.Len(), "Persist name changed!");
+
+ mpImpl->aPersistName = rPersistName;
+ mpImpl->mbLoadingOLEObjectFailed = false;
+
+ Connect();
+ SetChanged();
+}
+
+void SdrOle2Obj::AbandonObject()
+{
+ mpImpl->aPersistName.Erase();
+ mpImpl->mbLoadingOLEObjectFailed = false;
+ SetObjRef(0);
+}
+
+// -----------------------------------------------------------------------------
+
+String SdrOle2Obj::GetPersistName() const
+{
+ return mpImpl->aPersistName;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrOle2Obj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
+{
+ rInfo.bRotateFreeAllowed=sal_False;
+ rInfo.bRotate90Allowed =sal_False;
+ rInfo.bMirrorFreeAllowed=sal_False;
+ rInfo.bMirror45Allowed =sal_False;
+ rInfo.bMirror90Allowed =sal_False;
+ rInfo.bTransparenceAllowed = sal_False;
+ rInfo.bGradientAllowed = sal_False;
+ rInfo.bShearAllowed =sal_False;
+ rInfo.bEdgeRadiusAllowed=sal_False;
+ rInfo.bNoOrthoDesired =sal_False;
+ rInfo.bCanConvToPath =sal_False;
+ rInfo.bCanConvToPoly =sal_False;
+ rInfo.bCanConvToPathLineToArea=sal_False;
+ rInfo.bCanConvToPolyLineToArea=sal_False;
+ rInfo.bCanConvToContour = sal_False;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_uInt16 SdrOle2Obj::GetObjIdentifier() const
+{
+ return bFrame ? sal_uInt16(OBJ_FRAME) : sal_uInt16(OBJ_OLE2);
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrOle2Obj::TakeObjNameSingul(XubString& rName) const
+{
+ rName = ImpGetResStr(bFrame ? STR_ObjNameSingulFrame : STR_ObjNameSingulOLE2);
+
+ const String aName(GetName());
+
+ if( aName.Len() )
+ {
+ rName.AppendAscii(" '");
+ rName += aName;
+ rName += sal_Unicode('\'');
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrOle2Obj::TakeObjNamePlural(XubString& rName) const
+{
+ rName=ImpGetResStr(bFrame ? STR_ObjNamePluralFrame : STR_ObjNamePluralOLE2);
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrOle2Obj::operator=(const SdrObject& rObj)
+{
+ //TODO/LATER: who takes over control of my old object?!
+ if( &rObj != this )
+ {
+ // #116235#
+ // ImpAssign( rObj );
+ const SdrOle2Obj& rOle2Obj = static_cast< const SdrOle2Obj& >( rObj );
+
+ uno::Reference < util::XCloseable > xClose( xObjRef.GetObject(), uno::UNO_QUERY );
+
+ if( pModel && mpImpl->mbConnected )
+ Disconnect();
+
+ SdrRectObj::operator=( rObj );
+
+ // #108867# Manually copying bClosedObj attribute
+ SetClosedObj( rObj.IsClosedObj() );
+
+ mpImpl->aPersistName = rOle2Obj.mpImpl->aPersistName;
+ aProgName = rOle2Obj.aProgName;
+ bFrame = rOle2Obj.bFrame;
+
+ if( rOle2Obj.pGraphic )
+ {
+ if( pGraphic )
+ {
+ delete pGraphic;
+ delete mpImpl->pGraphicObject;
+ }
+
+ pGraphic = new Graphic( *rOle2Obj.pGraphic );
+ mpImpl->pGraphicObject = new GraphicObject( *pGraphic );
+ }
+
+ if( pModel && rObj.GetModel() && !IsEmptyPresObj() )
+ {
+ ::comphelper::IEmbeddedHelper* pDestPers = pModel->GetPersist();
+ ::comphelper::IEmbeddedHelper* pSrcPers = rObj.GetModel()->GetPersist();
+ if( pDestPers && pSrcPers )
+ {
+ DBG_ASSERT( !xObjRef.is(), "Object already existing!" );
+ comphelper::EmbeddedObjectContainer& rContainer = pSrcPers->getEmbeddedObjectContainer();
+ uno::Reference < embed::XEmbeddedObject > xObj = rContainer.GetEmbeddedObject( mpImpl->aPersistName );
+ if ( xObj.is() )
+ {
+ ::rtl::OUString aTmp;
+ xObjRef.Assign( pDestPers->getEmbeddedObjectContainer().CopyAndGetEmbeddedObject( rContainer, xObj, aTmp ), rOle2Obj.GetAspect() );
+ m_bTypeAsked = false;
+ mpImpl->aPersistName = aTmp;
+ CheckFileLink_Impl();
+ }
+
+ Connect();
+
+ /* only needed for MSOLE-Objects, now handled inside implementation of Object
+ if ( xObjRef.is() && rOle2Obj.xObjRef.is() && rOle2Obj.GetAspect() != embed::Aspects::MSOLE_ICON )
+ {
+ try
+ {
+ awt::Size aVisSize = rOle2Obj.xObjRef->getVisualAreaSize( rOle2Obj.GetAspect() );
+ if( rOle2Obj.xObjRef->getMapUnit( rOle2Obj.GetAspect() ) == xObjRef->getMapUnit( GetAspect() ) )
+ xObjRef->setVisualAreaSize( GetAspect(), aVisSize );
+ }
+ catch ( embed::WrongStateException& )
+ {
+ // setting of VisArea not necessary for objects that don't cache it in loaded state
+ }
+ catch( embed::NoVisualAreaSizeException& )
+ {
+ // objects my not have visual areas
+ }
+ catch( uno::Exception& e )
+ {
+ (void)e;
+ DBG_ERROR( "SdrOle2Obj::operator=(), unexcpected exception caught!" );
+ }
+ } */
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrOle2Obj::ImpSetVisAreaSize()
+{
+ // currently there is no need to recalculate scaling for iconified objects
+ // TODO/LATER: it might be needed in future when it is possible to change the icon
+ if ( GetAspect() == embed::Aspects::MSOLE_ICON )
+ return;
+
+ // the object area of an embedded object was changed, e.g. by user interaction an a selected object
+ GetObjRef();
+ if ( xObjRef.is() )
+ {
+ OSL_ASSERT( pModel );
+ sal_Int64 nMiscStatus = xObjRef->getStatus( GetAspect() );
+
+ // the client is required to get access to scaling
+ SfxInPlaceClient* pClient = SfxInPlaceClient::GetClient( dynamic_cast<SfxObjectShell*>(pModel->GetPersist()), xObjRef.GetObject() );
+ sal_Bool bHasOwnClient =
+ ( mpImpl->pLightClient
+ && xObjRef->getClientSite() == uno::Reference< embed::XEmbeddedClient >( mpImpl->pLightClient ) );
+
+ if ( pClient || bHasOwnClient )
+ {
+ // TODO/LATER: IMHO we need to do similar things when object is UIActive or OutplaceActive?! (MBA)
+ if ( ((nMiscStatus & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE) &&
+ svt::EmbeddedObjectRef::TryRunningState( xObjRef.GetObject() ))
+ || xObjRef->getCurrentState() == embed::EmbedStates::INPLACE_ACTIVE
+ )
+ {
+ Fraction aScaleWidth;
+ Fraction aScaleHeight;
+ if ( pClient )
+ {
+ aScaleWidth = pClient->GetScaleWidth();
+ aScaleHeight = pClient->GetScaleHeight();
+ }
+ else
+ {
+ aScaleWidth = mpImpl->pLightClient->GetScaleWidth();
+ aScaleHeight = mpImpl->pLightClient->GetScaleHeight();
+ }
+
+ // The object wants to resize itself (f.e. Chart wants to recalculate the layout)
+ // or object is inplace active and so has a window that must be resized also
+ // In these cases the change in the object area size will be reflected in a change of the
+ // objects' visual area. The scaling will not change, but it might exist already and must
+ // be used in calculations
+ MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObjRef->getMapUnit( GetAspect() ) );
+ Size aVisSize( (long)( Fraction( aRect.GetWidth() ) / aScaleWidth ),
+ (long)( Fraction( aRect.GetHeight() ) / aScaleHeight ) );
+
+ aVisSize = OutputDevice::LogicToLogic( aVisSize, pModel->GetScaleUnit(), aMapUnit);
+ awt::Size aSz;
+ aSz.Width = aVisSize.Width();
+ aSz.Height = aVisSize.Height();
+ xObjRef->setVisualAreaSize( GetAspect(), aSz );
+
+ try
+ {
+ aSz = xObjRef->getVisualAreaSize( GetAspect() );
+ }
+ catch( embed::NoVisualAreaSizeException& )
+ {}
+
+ Rectangle aAcceptedVisArea;
+ aAcceptedVisArea.SetSize( Size( (long)( Fraction( long( aSz.Width ) ) * aScaleWidth ),
+ (long)( Fraction( long( aSz.Height ) ) * aScaleHeight ) ) );
+ if (aVisSize != aAcceptedVisArea.GetSize())
+ {
+ // server changed VisArea to its liking and the VisArea is different than the suggested one
+ // store the new value as given by the object
+ MapUnit aNewMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObjRef->getMapUnit( GetAspect() ) );
+ aRect.SetSize(OutputDevice::LogicToLogic( aAcceptedVisArea.GetSize(), aNewMapUnit, pModel->GetScaleUnit()));
+ }
+
+ // make the new object area known to the client
+ // compared to the "else" branch aRect might have been changed by the object and no additional scaling was applied
+ // OJ: WHY this -> OSL_ASSERT( pClient );
+ if( pClient )
+ pClient->SetObjArea(aRect);
+
+ // we need a new replacement image as the object has resized itself
+
+ //#i79578# don't request a new replacement image for charts to often
+ //a chart sends a modified call to the framework if it was changed
+ //thus the replacement update is already handled there
+ if( !IsChart() )
+ xObjRef.UpdateReplacement();
+ }
+ else
+ {
+ // The object isn't active and does not want to resize itself so the changed object area size
+ // will be reflected in a changed object scaling
+ Fraction aScaleWidth;
+ Fraction aScaleHeight;
+ Size aObjAreaSize;
+ if ( CalculateNewScaling( aScaleWidth, aScaleHeight, aObjAreaSize ) )
+ {
+ if ( pClient )
+ {
+ Rectangle aScaleRect(aRect.TopLeft(), aObjAreaSize);
+ pClient->SetObjAreaAndScale( aScaleRect, aScaleWidth, aScaleHeight);
+ }
+ else
+ {
+ mpImpl->pLightClient->SetSizeScale( aScaleWidth, aScaleHeight );
+ }
+ }
+ }
+ }
+ else if( (nMiscStatus & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE) &&
+ svt::EmbeddedObjectRef::TryRunningState( xObjRef.GetObject() ) )
+ {
+ //also handle not sfx based ole objects e.g. charts
+ //#i83860# resizing charts in impress distorts fonts
+ uno::Reference< embed::XVisualObject > xVisualObject( this->getXModel(), uno::UNO_QUERY );
+ if( xVisualObject.is() )
+ {
+ MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObjRef->getMapUnit( GetAspect() ) );
+ Point aTL( aRect.TopLeft() );
+ Point aBR( aRect.BottomRight() );
+ Point aTL2( OutputDevice::LogicToLogic( aTL, pModel->GetScaleUnit(), aMapUnit) );
+ Point aBR2( OutputDevice::LogicToLogic( aBR, pModel->GetScaleUnit(), aMapUnit) );
+ Rectangle aNewRect( aTL2, aBR2 );
+ xVisualObject->setVisualAreaSize( GetAspect(), awt::Size( aNewRect.GetWidth(), aNewRect.GetHeight() ) );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrOle2Obj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+{
+ if( pModel && !pModel->isLocked() )
+ {
+ GetObjRef();
+ if ( xObjRef.is() && ( xObjRef->getStatus( GetAspect() ) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE ) )
+ {
+ // if the object needs recompose on resize
+ // the client site should be created before the resize will take place
+ // check whether there is no client site and create it if necessary
+ AddOwnLightClient();
+ }
+ }
+
+ SdrRectObj::NbcResize(rRef,xFact,yFact);
+ if (aGeo.nShearWink!=0 || aGeo.nDrehWink!=0) { // kleine Korrekturen
+ if (aGeo.nDrehWink>=9000 && aGeo.nDrehWink<27000) {
+ aRect.Move(aRect.Left()-aRect.Right(),aRect.Top()-aRect.Bottom());
+ }
+ aGeo.nDrehWink=0;
+ aGeo.nShearWink=0;
+ aGeo.nSin=0.0;
+ aGeo.nCos=1.0;
+ aGeo.nTan=0.0;
+ SetRectsDirty();
+ }
+ if( pModel && !pModel->isLocked() )
+ ImpSetVisAreaSize();
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrOle2Obj::SetGeoData(const SdrObjGeoData& rGeo)
+{
+ SdrRectObj::SetGeoData(rGeo);
+ if( pModel && !pModel->isLocked() )
+ ImpSetVisAreaSize();
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrOle2Obj::NbcSetSnapRect(const Rectangle& rRect)
+{
+ SdrRectObj::NbcSetSnapRect(rRect);
+ if( pModel && !pModel->isLocked() )
+ ImpSetVisAreaSize();
+
+ if ( xObjRef.is() && IsChart() )
+ {
+ //#i103460# charts do not necessaryly have an own size within ODF files,
+ //for this case they need to use the size settings from the surrounding frame,
+ //which is made available with this method as there is no other way
+ xObjRef.SetDefaultSizeForChart( Size( rRect.GetWidth(), rRect.GetHeight() ) );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrOle2Obj::NbcSetLogicRect(const Rectangle& rRect)
+{
+ SdrRectObj::NbcSetLogicRect(rRect);
+ if( pModel && !pModel->isLocked() )
+ ImpSetVisAreaSize();
+}
+
+Graphic* SdrOle2Obj::GetGraphic() const
+{
+ if ( xObjRef.is() )
+ return xObjRef.GetGraphic();
+ return pGraphic;
+}
+
+void SdrOle2Obj::GetNewReplacement()
+{
+ if ( xObjRef.is() )
+ xObjRef.UpdateReplacement();
+}
+
+// -----------------------------------------------------------------------------
+
+Size SdrOle2Obj::GetOrigObjSize( MapMode* pTargetMapMode ) const
+{
+ return xObjRef.GetSize( pTargetMapMode );
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrOle2Obj::NbcMove(const Size& rSize)
+{
+ SdrRectObj::NbcMove(rSize);
+ if( pModel && !pModel->isLocked() )
+ ImpSetVisAreaSize();
+}
+
+// -----------------------------------------------------------------------------
+
+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
+ {
+ uno::Reference < util::XModifiable > xModifiable( xObj->getComponent(), uno::UNO_QUERY );
+ if ( !xModifiable.is() )
+ bResult = sal_True;
+ else
+ {
+ 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 ) )
+ {
+ bResult = sal_True;
+ }
+ }
+ }
+
+ 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() );
+ }
+ }
+
+ return bResult;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdrOle2Obj::Unload()
+{
+ sal_Bool bUnloaded = sal_False;
+
+ if( xObjRef.is() )
+ {
+ //TODO/LATER: no refcounting tricks anymore!
+ //"customers" must register as state change listeners
+ //Nicht notwendig im Doc DTor (MM)
+ //sal_uIntPtr nRefCount = (*ppObjRef)->GetRefCount();
+ // prevent Unload if there are external references
+ //if( nRefCount > 2 )
+ // return sal_False;
+ //DBG_ASSERT( nRefCount == 2, "Wrong RefCount for unload" );
+ }
+ else
+ bUnloaded = sal_True;
+
+ if ( pModel && xObjRef.is() )
+ {
+ bUnloaded = Unload( xObjRef.GetObject(), GetAspect() );
+ }
+
+ return bUnloaded;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrOle2Obj::GetObjRef_Impl()
+{
+ if ( !xObjRef.is() && mpImpl->aPersistName.Len() && pModel && pModel->GetPersist() )
+ {
+ // #107645#
+ // Only try loading if it did not went wrong up to now
+ if(!mpImpl->mbLoadingOLEObjectFailed)
+ {
+ xObjRef.Assign( pModel->GetPersist()->getEmbeddedObjectContainer().GetEmbeddedObject( mpImpl->aPersistName ), GetAspect() );
+ m_bTypeAsked = false;
+ CheckFileLink_Impl();
+
+ // #107645#
+ // If loading of OLE object failed, remember that to not invoke a endless
+ // loop trying to load it again and again.
+ if( xObjRef.is() )
+ {
+ mpImpl->mbLoadingOLEObjectFailed = sal_True;
+ }
+
+ // #108759# For math objects, set closed state to transparent
+ if( ImplIsMathObj( xObjRef.GetObject() ) )
+ SetClosedObj( false );
+ }
+
+ if ( xObjRef.is() )
+ {
+ if( !IsEmptyPresObj() )
+ {
+ // #75637# remember modified status of model
+ const sal_Bool bWasChanged(pModel ? pModel->IsChanged() : sal_False);
+
+ // perhaps preview not valid anymore
+ // #75637# This line changes the modified state of the model
+ SetGraphic_Impl( NULL );
+
+ // #75637# if status was not set before, force it back
+ // to not set, so that SetGraphic(0L) above does not
+ // set the modified state of the model.
+ if(!bWasChanged && pModel && pModel->IsChanged())
+ {
+ pModel->SetChanged( sal_False );
+ }
+ }
+
+ sal_Int64 nMiscStatus = xObjRef->getStatus( GetAspect() );
+ (void)nMiscStatus;
+ //TODO/LATER: wait until ResizeOnPrinterChange is defined
+ //if ( nMiscStatus & SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE )
+ {
+ if (pModel && pModel->GetRefDevice() &&
+ pModel->GetRefDevice()->GetOutDevType() == OUTDEV_PRINTER)
+ {
+ if(!bInDestruction)
+ {
+ //TODO/LATER: printerchange notification
+ /*
+ // prevent SetModified (don't want no update here)
+ sal_Bool bWasEnabled = (*ppObjRef)->IsEnableSetModified();
+ if ( bWasEnabled )
+ (*ppObjRef)->EnableSetModified( sal_False );
+
+ // Kein RefDevice oder RefDevice kein Printer
+ Printer* pPrinter = (Printer*) pModel->GetRefDevice();
+ (*ppObjRef)->OnDocumentPrinterChanged( pPrinter );
+
+ // reset state
+ (*ppObjRef)->EnableSetModified( bWasEnabled );*/
+ }
+ }
+ }
+ }
+
+ if ( xObjRef.is() )
+ Connect();
+ }
+
+ if ( mpImpl->mbConnected )
+ // move object to first position in cache
+ GetSdrGlobalData().GetOLEObjCache().InsertObj(this);
+}
+
+uno::Reference < embed::XEmbeddedObject > SdrOle2Obj::GetObjRef() const
+{
+ const_cast<SdrOle2Obj*>(this)->GetObjRef_Impl();
+ return xObjRef.GetObject();
+}
+
+uno::Reference < embed::XEmbeddedObject > SdrOle2Obj::GetObjRef_NoInit() const
+{
+ return xObjRef.GetObject();
+}
+
+// -----------------------------------------------------------------------------
+
+uno::Reference< frame::XModel > SdrOle2Obj::getXModel() const
+{
+ GetObjRef();
+ if ( svt::EmbeddedObjectRef::TryRunningState(xObjRef.GetObject()) )
+ return uno::Reference< frame::XModel >( xObjRef->getComponent(), uno::UNO_QUERY );
+ else
+ return uno::Reference< frame::XModel >();
+}
+
+// -----------------------------------------------------------------------------
+
+// #109985#
+sal_Bool SdrOle2Obj::IsChart() const
+{
+ if ( !m_bTypeAsked )
+ {
+ m_bChart = ChartPrettyPainter::IsChart(xObjRef);
+ m_bTypeAsked = true;
+ }
+ return m_bChart;
+}
+
+// -----------------------------------------------------------------------------
+void SdrOle2Obj::SetGraphicToObj( const Graphic& aGraphic, const ::rtl::OUString& aMediaType )
+{
+ xObjRef.SetGraphic( aGraphic, aMediaType );
+}
+
+// -----------------------------------------------------------------------------
+void SdrOle2Obj::SetGraphicToObj( const uno::Reference< io::XInputStream >& xGrStream, const ::rtl::OUString& aMediaType )
+{
+ xObjRef.SetGraphicStream( xGrStream, aMediaType );
+}
+
+// -----------------------------------------------------------------------------
+sal_Bool SdrOle2Obj::IsCalc() const
+{
+ if ( !xObjRef.is() )
+ return false;
+
+ SvGlobalName aObjClsId( xObjRef->getClassID() );
+ if( SvGlobalName(SO3_SC_CLASSID_30) == aObjClsId
+ || SvGlobalName(SO3_SC_CLASSID_40) == aObjClsId
+ || SvGlobalName(SO3_SC_CLASSID_50) == aObjClsId
+ || SvGlobalName(SO3_SC_CLASSID_60) == aObjClsId
+ || SvGlobalName(SO3_SC_OLE_EMBED_CLASSID_60) == aObjClsId
+ || SvGlobalName(SO3_SC_OLE_EMBED_CLASSID_8) == aObjClsId
+ || SvGlobalName(SO3_SC_CLASSID) == aObjClsId )
+ {
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------------
+uno::Reference< frame::XModel > SdrOle2Obj::GetParentXModel() const
+{
+ uno::Reference< frame::XModel > xDoc;
+ if ( pModel )
+ xDoc.set( pModel->getUnoModel(),uno::UNO_QUERY);
+ return xDoc;
+}
+
+// -----------------------------------------------------------------------------
+sal_Bool SdrOle2Obj::CalculateNewScaling( Fraction& aScaleWidth, Fraction& aScaleHeight, Size& aObjAreaSize )
+{
+ // TODO/LEAN: to avoid rounding errors scaling always uses the VisArea.
+ // If we don't cache it for own objects also we must load the object here
+ if ( !xObjRef.is() || !pModel )
+ return sal_False;
+
+ MapMode aMapMode( pModel->GetScaleUnit() );
+ aObjAreaSize = xObjRef.GetSize( &aMapMode );
+
+ Size aSize = aRect.GetSize();
+ aScaleWidth = Fraction(aSize.Width(), aObjAreaSize.Width() );
+ aScaleHeight = Fraction(aSize.Height(), aObjAreaSize.Height() );
+
+ // reduce to 10 binary digits
+ Kuerzen(aScaleHeight, 10);
+ Kuerzen(aScaleWidth, 10);
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------------
+sal_Bool SdrOle2Obj::AddOwnLightClient()
+{
+ // The Own Light Client must be registered in object only using this method!
+ if ( !SfxInPlaceClient::GetClient( dynamic_cast<SfxObjectShell*>(pModel->GetPersist()), xObjRef.GetObject() )
+ && !( mpImpl->pLightClient && xObjRef->getClientSite() == uno::Reference< embed::XEmbeddedClient >( mpImpl->pLightClient ) ) )
+ {
+ Connect();
+
+ if ( xObjRef.is() && mpImpl->pLightClient )
+ {
+ Fraction aScaleWidth;
+ Fraction aScaleHeight;
+ Size aObjAreaSize;
+ if ( CalculateNewScaling( aScaleWidth, aScaleHeight, aObjAreaSize ) )
+ {
+ mpImpl->pLightClient->SetSizeScale( aScaleWidth, aScaleHeight );
+ try {
+ xObjRef->setClientSite( mpImpl->pLightClient );
+ return sal_True;
+ } catch( uno::Exception& )
+ {}
+ }
+
+ }
+
+ return sal_False;
+ }
+
+ return sal_True;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+Bitmap SdrOle2Obj::GetEmtyOLEReplacementBitmap()
+{
+ return Bitmap(ResId(BMP_SVXOLEOBJ, *ImpGetResMgr()));
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SdrOle2Obj::SetWindow(const com::sun::star::uno::Reference < com::sun::star::awt::XWindow >& _xWindow)
+{
+ if ( xObjRef.is() && mpImpl->pLightClient )
+ {
+ mpImpl->pLightClient->setWindow(_xWindow);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/svdraw/svdopage.cxx b/svx/source/svdraw/svdopage.cxx
new file mode 100644
index 000000000000..1897d2765678
--- /dev/null
+++ b/svx/source/svdraw/svdopage.cxx
@@ -0,0 +1,195 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svdopage.hxx>
+#include "svx/svdglob.hxx" // Stringcache
+#include "svx/svdstr.hrc" // Objektname
+#include <svx/svdtrans.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdoutl.hxx>
+#include <svtools/colorcfg.hxx>
+#include <svl/itemset.hxx>
+#include <svx/sdr/properties/pageproperties.hxx>
+
+// #111111#
+#include <svx/sdr/contact/viewcontactofpageobj.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// BaseProperties section
+
+sdr::properties::BaseProperties* SdrPageObj::CreateObjectSpecificProperties()
+{
+ return new sdr::properties::PageProperties(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// DrawContact section
+
+sdr::contact::ViewContact* SdrPageObj::CreateObjectSpecificViewContact()
+{
+ return new sdr::contact::ViewContactOfPageObj(*this);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// this method is called form the destructor of the referenced page.
+// do all necessary action to forget the page. It is not necessary to call
+// RemovePageUser(), that is done form the destructor.
+void SdrPageObj::PageInDestruction(const SdrPage& rPage)
+{
+ if(mpShownPage && mpShownPage == &rPage)
+ {
+ // #i58769# Do not call ActionChanged() here, because that would
+ // lead to the construction of a view contact object for a page that
+ // is being destroyed.
+
+ mpShownPage = 0L;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(SdrPageObj,SdrObject);
+
+SdrPageObj::SdrPageObj(SdrPage* pNewPage)
+: mpShownPage(pNewPage)
+{
+ if(mpShownPage)
+ {
+ mpShownPage->AddPageUser(*this);
+ }
+}
+
+SdrPageObj::SdrPageObj(const Rectangle& rRect, SdrPage* pNewPage)
+: mpShownPage(pNewPage)
+{
+ if(mpShownPage)
+ {
+ mpShownPage->AddPageUser(*this);
+ }
+
+ aOutRect = rRect;
+}
+
+SdrPageObj::~SdrPageObj()
+{
+ // #111111#
+ if(mpShownPage)
+ {
+ mpShownPage->RemovePageUser(*this);
+ }
+}
+
+// #111111#
+SdrPage* SdrPageObj::GetReferencedPage() const
+{
+ return mpShownPage;
+}
+
+// #111111#
+void SdrPageObj::SetReferencedPage(SdrPage* pNewPage)
+{
+ if(mpShownPage != pNewPage)
+ {
+ if(mpShownPage)
+ {
+ mpShownPage->RemovePageUser(*this);
+ }
+
+ mpShownPage = pNewPage;
+
+ if(mpShownPage)
+ {
+ mpShownPage->AddPageUser(*this);
+ }
+
+ SetChanged();
+ BroadcastObjectChange();
+ }
+}
+
+// #i96598#
+void SdrPageObj::SetBoundRectDirty()
+{
+ // avoid resetting aOutRect which in case of this object is model data,
+ // not re-creatable view data
+}
+
+sal_uInt16 SdrPageObj::GetObjIdentifier() const
+{
+ return sal_uInt16(OBJ_PAGE);
+}
+
+void SdrPageObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
+{
+ rInfo.bRotateFreeAllowed=sal_False;
+ rInfo.bRotate90Allowed =sal_False;
+ rInfo.bMirrorFreeAllowed=sal_False;
+ rInfo.bMirror45Allowed =sal_False;
+ rInfo.bMirror90Allowed =sal_False;
+ rInfo.bTransparenceAllowed = sal_False;
+ rInfo.bGradientAllowed = sal_False;
+ rInfo.bShearAllowed =sal_False;
+ rInfo.bEdgeRadiusAllowed=sal_False;
+ rInfo.bNoOrthoDesired =sal_False;
+ rInfo.bCanConvToPath =sal_False;
+ rInfo.bCanConvToPoly =sal_False;
+ rInfo.bCanConvToPathLineToArea=sal_False;
+ rInfo.bCanConvToPolyLineToArea=sal_False;
+}
+
+void SdrPageObj::operator=(const SdrObject& rObj)
+{
+ SdrObject::operator=(rObj);
+ SetReferencedPage(((const SdrPageObj&)rObj).GetReferencedPage());
+}
+
+void SdrPageObj::TakeObjNameSingul(XubString& rName) const
+{
+ rName=ImpGetResStr(STR_ObjNameSingulPAGE);
+
+ String aName( GetName() );
+ if(aName.Len())
+ {
+ rName += sal_Unicode(' ');
+ rName += sal_Unicode('\'');
+ rName += aName;
+ rName += sal_Unicode('\'');
+ }
+}
+
+void SdrPageObj::TakeObjNamePlural(XubString& rName) const
+{
+ rName=ImpGetResStr(STR_ObjNamePluralPAGE);
+}
+
+// eof
diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
new file mode 100644
index 000000000000..38784af56936
--- /dev/null
+++ b/svx/source/svdraw/svdopath.cxx
@@ -0,0 +1,3118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <tools/bigint.hxx>
+#include <svx/svdopath.hxx>
+#include <math.h>
+#include <svx/xpool.hxx>
+#include <svx/xpoly.hxx>
+#include <svx/svdattr.hxx>
+#include <svx/svdtrans.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/svddrag.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdhdl.hxx>
+#include <svx/svdview.hxx> // fuer MovCreate bei Freihandlinien
+#include "svx/svdglob.hxx" // Stringcache
+#include "svx/svdstr.hrc" // Objektname
+
+#ifdef _MSC_VER
+#pragma optimize ("",off)
+#pragma warning(disable: 4748) // "... because optimizations are disabled ..."
+#endif
+
+#include <svx/xlnwtit.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/polypolygoneditor.hxx>
+#include <svx/xlntrit.hxx>
+#include <vcl/salbtype.hxx> // FRound
+#include "svdoimp.hxx"
+#include <svx/sdr/contact/viewcontactofsdrpathobj.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+// #104018# replace macros above with type-safe methods
+inline sal_Int32 ImplTwipsToMM(sal_Int32 nVal) { return ((nVal * 127 + 36) / 72); }
+inline sal_Int32 ImplMMToTwips(sal_Int32 nVal) { return ((nVal * 72 + 63) / 127); }
+inline sal_Int64 ImplTwipsToMM(sal_Int64 nVal) { return ((nVal * 127 + 36) / 72); }
+inline sal_Int64 ImplMMToTwips(sal_Int64 nVal) { return ((nVal * 72 + 63) / 127); }
+inline double ImplTwipsToMM(double fVal) { return (fVal * (127.0 / 72.0)); }
+inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); }
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/curve/b2dcubicbezier.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <svx/sdr/attribute/sdrtextattribute.hxx>
+#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <svx/sdr/attribute/sdrformtextattribute.hxx>
+
+using namespace sdr;
+
+inline sal_uInt16 GetPrevPnt(sal_uInt16 nPnt, sal_uInt16 nPntMax, FASTBOOL bClosed)
+{
+ if (nPnt>0) {
+ nPnt--;
+ } else {
+ nPnt=nPntMax;
+ if (bClosed) nPnt--;
+ }
+ return nPnt;
+}
+
+inline sal_uInt16 GetNextPnt(sal_uInt16 nPnt, sal_uInt16 nPntMax, FASTBOOL bClosed)
+{
+ nPnt++;
+ if (nPnt>nPntMax || (bClosed && nPnt>=nPntMax)) nPnt=0;
+ return nPnt;
+}
+
+struct ImpSdrPathDragData : public SdrDragStatUserData
+{
+ XPolygon aXP; // Ausschnitt aud dem Originalpolygon
+ FASTBOOL bValid; // sal_False = zu wenig Punkte
+ FASTBOOL bClosed; // geschlossenes Objekt?
+ sal_uInt16 nPoly; // Nummer des Polygons im PolyPolygon
+ sal_uInt16 nPnt; // Punktnummer innerhalb des obigen Polygons
+ sal_uInt16 nPntAnz; // Punktanzahl des Polygons
+ sal_uInt16 nPntMax; // Maximaler Index
+ FASTBOOL bBegPnt; // Gedraggter Punkt ist der Anfangspunkt einer Polyline
+ FASTBOOL bEndPnt; // Gedraggter Punkt ist der Endpunkt einer Polyline
+ sal_uInt16 nPrevPnt; // Index des vorherigen Punkts
+ sal_uInt16 nNextPnt; // Index des naechsten Punkts
+ FASTBOOL bPrevIsBegPnt; // Vorheriger Punkt ist Anfangspunkt einer Polyline
+ FASTBOOL bNextIsEndPnt; // Folgepunkt ist Endpunkt einer Polyline
+ sal_uInt16 nPrevPrevPnt; // Index des vorvorherigen Punkts
+ sal_uInt16 nNextNextPnt; // Index des uebernaechsten Punkts
+ FASTBOOL bControl; // Punkt ist ein Kontrollpunkt
+ FASTBOOL bIsPrevControl; // Punkt ist Kontrollpunkt vor einem Stuetzpunkt
+ FASTBOOL bIsNextControl; // Punkt ist Kontrollpunkt hinter einem Stuetzpunkt
+ FASTBOOL bPrevIsControl; // Falls nPnt ein StPnt: Davor ist ein Kontrollpunkt
+ FASTBOOL bNextIsControl; // Falls nPnt ein StPnt: Dahinter ist ein Kontrollpunkt
+ sal_uInt16 nPrevPrevPnt0;
+ sal_uInt16 nPrevPnt0;
+ sal_uInt16 nPnt0;
+ sal_uInt16 nNextPnt0;
+ sal_uInt16 nNextNextPnt0;
+ FASTBOOL bEliminate; // Punkt loeschen? (wird von MovDrag gesetzt)
+
+ // ##
+ sal_Bool mbMultiPointDrag;
+ const XPolyPolygon maOrig;
+ XPolyPolygon maMove;
+ Container maHandles;
+
+public:
+ ImpSdrPathDragData(const SdrPathObj& rPO, const SdrHdl& rHdl, sal_Bool bMuPoDr, const SdrDragStat& rDrag);
+ void ResetPoly(const SdrPathObj& rPO);
+ sal_Bool IsMultiPointDrag() const { return mbMultiPointDrag; }
+};
+
+ImpSdrPathDragData::ImpSdrPathDragData(const SdrPathObj& rPO, const SdrHdl& rHdl, sal_Bool bMuPoDr, const SdrDragStat& rDrag)
+: aXP(5),
+ mbMultiPointDrag(bMuPoDr),
+ maOrig(rPO.GetPathPoly()),
+ maHandles(0)
+{
+ if(mbMultiPointDrag)
+ {
+ const SdrMarkView& rMarkView = *rDrag.GetView();
+ const SdrHdlList& rHdlList = rMarkView.GetHdlList();
+ const sal_uInt32 nHdlCount = rHdlList.GetHdlCount();
+ const SdrObject* pInteractionObject(nHdlCount && rHdlList.GetHdl(0) ? rHdlList.GetHdl(0)->GetObj() : 0);
+
+ for(sal_uInt32 a(0); a < nHdlCount; a++)
+ {
+ SdrHdl* pTestHdl = rHdlList.GetHdl(a);
+
+ if(pTestHdl && pTestHdl->IsSelected() && pTestHdl->GetObj() == pInteractionObject)
+ {
+ maHandles.Insert(pTestHdl, CONTAINER_APPEND);
+ }
+ }
+
+ maMove = maOrig;
+ bValid = sal_True;
+ }
+ else
+ {
+ bValid=sal_False;
+ bClosed=rPO.IsClosed(); // geschlossenes Objekt?
+ nPoly=(sal_uInt16)rHdl.GetPolyNum(); // Nummer des Polygons im PolyPolygon
+ nPnt=(sal_uInt16)rHdl.GetPointNum(); // Punktnummer innerhalb des obigen Polygons
+ const XPolygon aTmpXP(rPO.GetPathPoly().getB2DPolygon(nPoly));
+ nPntAnz=aTmpXP.GetPointCount(); // Punktanzahl des Polygons
+ if (nPntAnz==0 || (bClosed && nPntAnz==1)) return; // min. 1Pt bei Line, min. 2 bei Polygon
+ nPntMax=nPntAnz-1; // Maximaler Index
+ bBegPnt=!bClosed && nPnt==0; // Gedraggter Punkt ist der Anfangspunkt einer Polyline
+ bEndPnt=!bClosed && nPnt==nPntMax; // Gedraggter Punkt ist der Endpunkt einer Polyline
+ if (bClosed && nPntAnz<=3) { // Falls Polygon auch nur eine Linie ist
+ bBegPnt=(nPntAnz<3) || nPnt==0;
+ bEndPnt=(nPntAnz<3) || nPnt==nPntMax-1;
+ }
+ nPrevPnt=nPnt; // Index des vorherigen Punkts
+ nNextPnt=nPnt; // Index des naechsten Punkts
+ if (!bBegPnt) nPrevPnt=GetPrevPnt(nPnt,nPntMax,bClosed);
+ if (!bEndPnt) nNextPnt=GetNextPnt(nPnt,nPntMax,bClosed);
+ bPrevIsBegPnt=bBegPnt || (!bClosed && nPrevPnt==0);
+ bNextIsEndPnt=bEndPnt || (!bClosed && nNextPnt==nPntMax);
+ nPrevPrevPnt=nPnt; // Index des vorvorherigen Punkts
+ nNextNextPnt=nPnt; // Index des uebernaechsten Punkts
+ if (!bPrevIsBegPnt) nPrevPrevPnt=GetPrevPnt(nPrevPnt,nPntMax,bClosed);
+ if (!bNextIsEndPnt) nNextNextPnt=GetNextPnt(nNextPnt,nPntMax,bClosed);
+ bControl=rHdl.IsPlusHdl(); // Punkt ist ein Kontrollpunkt
+ bIsPrevControl=sal_False; // Punkt ist Kontrollpunkt vor einem Stuetzpunkt
+ bIsNextControl=sal_False; // Punkt ist Kontrollpunkt hinter einem Stuetzpunkt
+ bPrevIsControl=sal_False; // Falls nPnt ein StPnt: Davor ist ein Kontrollpunkt
+ bNextIsControl=sal_False; // Falls nPnt ein StPnt: Dahinter ist ein Kontrollpunkt
+ if (bControl) {
+ bIsPrevControl=aTmpXP.IsControl(nPrevPnt);
+ bIsNextControl=!bIsPrevControl;
+ } else {
+ bPrevIsControl=!bBegPnt && !bPrevIsBegPnt && aTmpXP.GetFlags(nPrevPnt)==XPOLY_CONTROL;
+ bNextIsControl=!bEndPnt && !bNextIsEndPnt && aTmpXP.GetFlags(nNextPnt)==XPOLY_CONTROL;
+ }
+ nPrevPrevPnt0=nPrevPrevPnt;
+ nPrevPnt0 =nPrevPnt;
+ nPnt0 =nPnt;
+ nNextPnt0 =nNextPnt;
+ nNextNextPnt0=nNextNextPnt;
+ nPrevPrevPnt=0;
+ nPrevPnt=1;
+ nPnt=2;
+ nNextPnt=3;
+ nNextNextPnt=4;
+ bEliminate=sal_False;
+ ResetPoly(rPO);
+ bValid=sal_True;
+ }
+}
+
+void ImpSdrPathDragData::ResetPoly(const SdrPathObj& rPO)
+{
+ const XPolygon aTmpXP(rPO.GetPathPoly().getB2DPolygon(nPoly));
+ aXP[0]=aTmpXP[nPrevPrevPnt0]; aXP.SetFlags(0,aTmpXP.GetFlags(nPrevPrevPnt0));
+ aXP[1]=aTmpXP[nPrevPnt0]; aXP.SetFlags(1,aTmpXP.GetFlags(nPrevPnt0));
+ aXP[2]=aTmpXP[nPnt0]; aXP.SetFlags(2,aTmpXP.GetFlags(nPnt0));
+ aXP[3]=aTmpXP[nNextPnt0]; aXP.SetFlags(3,aTmpXP.GetFlags(nNextPnt0));
+ aXP[4]=aTmpXP[nNextNextPnt0]; aXP.SetFlags(4,aTmpXP.GetFlags(nNextNextPnt0));
+}
+
+/*************************************************************************/
+
+struct ImpPathCreateUser : public SdrDragStatUserData
+{
+ Point aBezControl0;
+ Point aBezStart;
+ Point aBezCtrl1;
+ Point aBezCtrl2;
+ Point aBezEnd;
+ Point aCircStart;
+ Point aCircEnd;
+ Point aCircCenter;
+ Point aLineStart;
+ Point aLineEnd;
+ Point aRectP1;
+ Point aRectP2;
+ Point aRectP3;
+ long nCircRadius;
+ long nCircStWink;
+ long nCircRelWink;
+ FASTBOOL bBezier;
+ FASTBOOL bBezHasCtrl0;
+ FASTBOOL bCurve;
+ FASTBOOL bCircle;
+ FASTBOOL bAngleSnap;
+ FASTBOOL bLine;
+ FASTBOOL bLine90;
+ FASTBOOL bRect;
+ FASTBOOL bMixedCreate;
+ sal_uInt16 nBezierStartPoint;
+ SdrObjKind eStartKind;
+ SdrObjKind eAktKind;
+
+public:
+ ImpPathCreateUser(): nCircRadius(0),nCircStWink(0),nCircRelWink(0),
+ bBezier(sal_False),bBezHasCtrl0(sal_False),bCurve(sal_False),bCircle(sal_False),bAngleSnap(sal_False),bLine(sal_False),bLine90(sal_False),bRect(sal_False),
+ bMixedCreate(sal_False),nBezierStartPoint(0),eStartKind(OBJ_NONE),eAktKind(OBJ_NONE) { }
+
+ void ResetFormFlags() { bBezier=sal_False; bCurve=sal_False; bCircle=sal_False; bLine=sal_False; bRect=sal_False; }
+ FASTBOOL IsFormFlag() const { return bBezier || bCurve || bCircle || bLine || bRect; }
+ XPolygon GetFormPoly() const;
+ FASTBOOL CalcBezier(const Point& rP1, const Point& rP2, const Point& rDir, FASTBOOL bMouseDown);
+ XPolygon GetBezierPoly() const;
+ //int CalcCurve(const Point& rP1, const Point& rP2, const Point& rDir, SdrView* pView) { return sal_False; }
+ XPolygon GetCurvePoly() const { return XPolygon(); }
+ FASTBOOL CalcCircle(const Point& rP1, const Point& rP2, const Point& rDir, SdrView* pView);
+ XPolygon GetCirclePoly() const;
+ FASTBOOL CalcLine(const Point& rP1, const Point& rP2, const Point& rDir, SdrView* pView);
+ Point CalcLine(const Point& rCsr, long nDirX, long nDirY, SdrView* pView) const;
+ XPolygon GetLinePoly() const;
+ FASTBOOL CalcRect(const Point& rP1, const Point& rP2, const Point& rDir, SdrView* pView);
+ XPolygon GetRectPoly() const;
+};
+
+XPolygon ImpPathCreateUser::GetFormPoly() const
+{
+ if (bBezier) return GetBezierPoly();
+ if (bCurve) return GetCurvePoly();
+ if (bCircle) return GetCirclePoly();
+ if (bLine) return GetLinePoly();
+ if (bRect) return GetRectPoly();
+ return XPolygon();
+}
+
+FASTBOOL ImpPathCreateUser::CalcBezier(const Point& rP1, const Point& rP2, const Point& rDir, FASTBOOL bMouseDown)
+{
+ FASTBOOL bRet=sal_True;
+ aBezStart=rP1;
+ aBezCtrl1=rP1+rDir;
+ aBezCtrl2=rP2;
+
+ // #i21479#
+ // Also copy the end point when no end point is set yet
+ if (!bMouseDown || (0L == aBezEnd.X() && 0L == aBezEnd.Y())) aBezEnd=rP2;
+
+ bBezier=bRet;
+ return bRet;
+}
+
+XPolygon ImpPathCreateUser::GetBezierPoly() const
+{
+ XPolygon aXP(4);
+ aXP[0]=aBezStart; aXP.SetFlags(0,XPOLY_SMOOTH);
+ aXP[1]=aBezCtrl1; aXP.SetFlags(1,XPOLY_CONTROL);
+ aXP[2]=aBezCtrl2; aXP.SetFlags(2,XPOLY_CONTROL);
+ aXP[3]=aBezEnd;
+ return aXP;
+}
+
+FASTBOOL ImpPathCreateUser::CalcCircle(const Point& rP1, const Point& rP2, const Point& rDir, SdrView* pView)
+{
+ long nTangAngle=GetAngle(rDir);
+ aCircStart=rP1;
+ aCircEnd=rP2;
+ aCircCenter=rP1;
+ long dx=rP2.X()-rP1.X();
+ long dy=rP2.Y()-rP1.Y();
+ long dAngle=GetAngle(Point(dx,dy))-nTangAngle;
+ dAngle=NormAngle360(dAngle);
+ long nTmpAngle=NormAngle360(9000-dAngle);
+ FASTBOOL bRet=nTmpAngle!=9000 && nTmpAngle!=27000;
+ long nRad=0;
+ if (bRet) {
+ double cs=cos(nTmpAngle*nPi180);
+ double nR=(double)GetLen(Point(dx,dy))/cs/2;
+ nRad=Abs(Round(nR));
+ }
+ if (dAngle<18000) {
+ nCircStWink=NormAngle360(nTangAngle-9000);
+ nCircRelWink=NormAngle360(2*dAngle);
+ aCircCenter.X()+=Round(nRad*cos((nTangAngle+9000)*nPi180));
+ aCircCenter.Y()-=Round(nRad*sin((nTangAngle+9000)*nPi180));
+ } else {
+ nCircStWink=NormAngle360(nTangAngle+9000);
+ nCircRelWink=-NormAngle360(36000-2*dAngle);
+ aCircCenter.X()+=Round(nRad*cos((nTangAngle-9000)*nPi180));
+ aCircCenter.Y()-=Round(nRad*sin((nTangAngle-9000)*nPi180));
+ }
+ bAngleSnap=pView!=NULL && pView->IsAngleSnapEnabled();
+ if (bAngleSnap) {
+ long nSA=pView->GetSnapAngle();
+ if (nSA!=0) { // Winkelfang
+ FASTBOOL bNeg=nCircRelWink<0;
+ if (bNeg) nCircRelWink=-nCircRelWink;
+ nCircRelWink+=nSA/2;
+ nCircRelWink/=nSA;
+ nCircRelWink*=nSA;
+ nCircRelWink=NormAngle360(nCircRelWink);
+ if (bNeg) nCircRelWink=-nCircRelWink;
+ }
+ }
+ nCircRadius=nRad;
+ if (nRad==0 || Abs(nCircRelWink)<5) bRet=sal_False;
+ bCircle=bRet;
+ return bRet;
+}
+
+XPolygon ImpPathCreateUser::GetCirclePoly() const
+{
+ if (nCircRelWink>=0) {
+ XPolygon aXP(aCircCenter,nCircRadius,nCircRadius,
+ sal_uInt16((nCircStWink+5)/10),sal_uInt16((nCircStWink+nCircRelWink+5)/10),sal_False);
+ aXP[0]=aCircStart; aXP.SetFlags(0,XPOLY_SMOOTH);
+ if (!bAngleSnap) aXP[aXP.GetPointCount()-1]=aCircEnd;
+ return aXP;
+ } else {
+ XPolygon aXP(aCircCenter,nCircRadius,nCircRadius,
+ sal_uInt16(NormAngle360(nCircStWink+nCircRelWink+5)/10),sal_uInt16((nCircStWink+5)/10),sal_False);
+ sal_uInt16 nAnz=aXP.GetPointCount();
+ for (sal_uInt16 nNum=nAnz/2; nNum>0;) {
+ nNum--; // XPoly Punktreihenfolge umkehren
+ sal_uInt16 n2=nAnz-nNum-1;
+ Point aPt(aXP[nNum]);
+ aXP[nNum]=aXP[n2];
+ aXP[n2]=aPt;
+ }
+ aXP[0]=aCircStart; aXP.SetFlags(0,XPOLY_SMOOTH);
+ if (!bAngleSnap) aXP[aXP.GetPointCount()-1]=aCircEnd;
+ return aXP;
+ }
+}
+
+Point ImpPathCreateUser::CalcLine(const Point& aCsr, long nDirX, long nDirY, SdrView* pView) const
+{
+ long x=aCsr.X(),x1=x,x2=x;
+ long y=aCsr.Y(),y1=y,y2=y;
+ FASTBOOL bHLin=nDirY==0;
+ FASTBOOL bVLin=nDirX==0;
+ if (bHLin) y=0;
+ else if (bVLin) x=0;
+ else {
+ x1=BigMulDiv(y,nDirX,nDirY);
+ y2=BigMulDiv(x,nDirY,nDirX);
+ long l1=Abs(x1)+Abs(y1);
+ long l2=Abs(x2)+Abs(y2);
+ if ((l1<=l2) != (pView!=NULL && pView->IsBigOrtho())) {
+ x=x1; y=y1;
+ } else {
+ x=x2; y=y2;
+ }
+ }
+ return Point(x,y);
+}
+
+FASTBOOL ImpPathCreateUser::CalcLine(const Point& rP1, const Point& rP2, const Point& rDir, SdrView* pView)
+{
+ aLineStart=rP1;
+ aLineEnd=rP2;
+ bLine90=sal_False;
+ if (rP1==rP2 || (rDir.X()==0 && rDir.Y()==0)) { bLine=sal_False; return sal_False; }
+ Point aTmpPt(rP2-rP1);
+ long nDirX=rDir.X();
+ long nDirY=rDir.Y();
+ Point aP1(CalcLine(aTmpPt, nDirX, nDirY,pView)); aP1-=aTmpPt; long nQ1=Abs(aP1.X())+Abs(aP1.Y());
+ Point aP2(CalcLine(aTmpPt, nDirY,-nDirX,pView)); aP2-=aTmpPt; long nQ2=Abs(aP2.X())+Abs(aP2.Y());
+ if (pView!=NULL && pView->IsOrtho()) nQ1=0; // Ortho schaltet rechtwinklig aus
+ bLine90=nQ1>2*nQ2;
+ if (!bLine90) { // glatter Uebergang
+ aLineEnd+=aP1;
+ } else { // rechtwinkliger Uebergang
+ aLineEnd+=aP2;
+ }
+ bLine=sal_True;
+ return sal_True;
+}
+
+XPolygon ImpPathCreateUser::GetLinePoly() const
+{
+ XPolygon aXP(2);
+ aXP[0]=aLineStart; if (!bLine90) aXP.SetFlags(0,XPOLY_SMOOTH);
+ aXP[1]=aLineEnd;
+ return aXP;
+}
+
+FASTBOOL ImpPathCreateUser::CalcRect(const Point& rP1, const Point& rP2, const Point& rDir, SdrView* pView)
+{
+ aRectP1=rP1;
+ aRectP2=rP1;
+ aRectP3=rP2;
+ if (rP1==rP2 || (rDir.X()==0 && rDir.Y()==0)) { bRect=sal_False; return sal_False; }
+ Point aTmpPt(rP2-rP1);
+ long nDirX=rDir.X();
+ long nDirY=rDir.Y();
+ long x=aTmpPt.X();
+ long y=aTmpPt.Y();
+ FASTBOOL bHLin=nDirY==0;
+ FASTBOOL bVLin=nDirX==0;
+ if (bHLin) y=0;
+ else if (bVLin) x=0;
+ else {
+ y=BigMulDiv(x,nDirY,nDirX);
+ long nHypLen=aTmpPt.Y()-y;
+ long nTangAngle=-GetAngle(rDir);
+ // sin=g/h, g=h*sin
+ double a=nTangAngle*nPi180;
+ double sn=sin(a);
+ double cs=cos(a);
+ double nGKathLen=nHypLen*sn;
+ y+=Round(nGKathLen*sn);
+ x+=Round(nGKathLen*cs);
+ }
+ aRectP2.X()+=x;
+ aRectP2.Y()+=y;
+ if (pView!=NULL && pView->IsOrtho()) {
+ long dx1=aRectP2.X()-aRectP1.X(); long dx1a=Abs(dx1);
+ long dy1=aRectP2.Y()-aRectP1.Y(); long dy1a=Abs(dy1);
+ long dx2=aRectP3.X()-aRectP2.X(); long dx2a=Abs(dx2);
+ long dy2=aRectP3.Y()-aRectP2.Y(); long dy2a=Abs(dy2);
+ FASTBOOL b1MoreThan2=dx1a+dy1a>dx2a+dy2a;
+ if (b1MoreThan2 != pView->IsBigOrtho()) {
+ long xtemp=dy2a-dx1a; if (dx1<0) xtemp=-xtemp;
+ long ytemp=dx2a-dy1a; if (dy1<0) ytemp=-ytemp;
+ aRectP2.X()+=xtemp;
+ aRectP2.Y()+=ytemp;
+ aRectP3.X()+=xtemp;
+ aRectP3.Y()+=ytemp;
+ } else {
+ long xtemp=dy1a-dx2a; if (dx2<0) xtemp=-xtemp;
+ long ytemp=dx1a-dy2a; if (dy2<0) ytemp=-ytemp;
+ aRectP3.X()+=xtemp;
+ aRectP3.Y()+=ytemp;
+ }
+ }
+ bRect=sal_True;
+ return sal_True;
+}
+
+XPolygon ImpPathCreateUser::GetRectPoly() const
+{
+ XPolygon aXP(3);
+ aXP[0]=aRectP1; aXP.SetFlags(0,XPOLY_SMOOTH);
+ aXP[1]=aRectP2;
+ if (aRectP3!=aRectP2) aXP[2]=aRectP3;
+ return aXP;
+}
+
+/*************************************************************************/
+
+class ImpPathForDragAndCreate
+{
+ SdrPathObj& mrSdrPathObject;
+ XPolyPolygon aPathPolygon;
+ SdrObjKind meObjectKind;
+ ImpSdrPathDragData* mpSdrPathDragData;
+ bool mbCreating;
+
+public:
+ ImpPathForDragAndCreate(SdrPathObj& rSdrPathObject);
+ ~ImpPathForDragAndCreate();
+
+ // drag stuff
+ bool beginPathDrag( SdrDragStat& rDrag ) const;
+ bool movePathDrag( SdrDragStat& rDrag ) const;
+ bool endPathDrag( SdrDragStat& rDrag );
+ //void cancelSpecialDrag( SdrDragStat& rDrag ) const;
+ String getSpecialDragComment(const SdrDragStat& rDrag) const;
+ basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat& rDrag) const;
+
+ // create stuff
+ FASTBOOL BegCreate(SdrDragStat& rStat);
+ FASTBOOL MovCreate(SdrDragStat& rStat);
+ FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
+ FASTBOOL BckCreate(SdrDragStat& rStat);
+ void BrkCreate(SdrDragStat& rStat);
+ Pointer GetCreatePointer() const;
+
+ // helping stuff
+ bool IsClosed(SdrObjKind eKind) const { return eKind==OBJ_POLY || eKind==OBJ_PATHPOLY || eKind==OBJ_PATHFILL || eKind==OBJ_FREEFILL || eKind==OBJ_SPLNFILL; }
+ bool IsFreeHand(SdrObjKind eKind) const { return eKind==OBJ_FREELINE || eKind==OBJ_FREEFILL; }
+ bool IsBezier(SdrObjKind eKind) const { return eKind==OBJ_PATHLINE || eKind==OBJ_PATHFILL; }
+ bool IsCreating() const { return mbCreating; }
+
+ // get the polygon
+ basegfx::B2DPolyPolygon TakeObjectPolyPolygon(const SdrDragStat& rDrag) const;
+ basegfx::B2DPolyPolygon TakeDragPolyPolygon(const SdrDragStat& rDrag) const;
+ basegfx::B2DPolyPolygon getModifiedPolyPolygon() const { return aPathPolygon.getB2DPolyPolygon(); }
+};
+
+ImpPathForDragAndCreate::ImpPathForDragAndCreate(SdrPathObj& rSdrPathObject)
+: mrSdrPathObject(rSdrPathObject),
+ aPathPolygon(rSdrPathObject.GetPathPoly()),
+ meObjectKind(mrSdrPathObject.meKind),
+ mpSdrPathDragData(0),
+ mbCreating(false)
+{
+}
+
+ImpPathForDragAndCreate::~ImpPathForDragAndCreate()
+{
+ if(mpSdrPathDragData)
+ {
+ delete mpSdrPathDragData;
+ }
+}
+
+bool ImpPathForDragAndCreate::beginPathDrag( SdrDragStat& rDrag ) const
+{
+ const SdrHdl* pHdl=rDrag.GetHdl();
+ if(!pHdl)
+ return sal_False;
+
+ sal_Bool bMultiPointDrag(sal_True);
+
+ if(aPathPolygon[(sal_uInt16)pHdl->GetPolyNum()].IsControl((sal_uInt16)pHdl->GetPointNum()))
+ bMultiPointDrag = sal_False;
+
+ if(bMultiPointDrag)
+ {
+ const SdrMarkView& rMarkView = *rDrag.GetView();
+ const SdrHdlList& rHdlList = rMarkView.GetHdlList();
+ const sal_uInt32 nHdlCount = rHdlList.GetHdlCount();
+ const SdrObject* pInteractionObject(nHdlCount && rHdlList.GetHdl(0) ? rHdlList.GetHdl(0)->GetObj() : 0);
+ sal_uInt32 nSelectedPoints(0);
+
+ for(sal_uInt32 a(0); a < nHdlCount; a++)
+ {
+ SdrHdl* pTestHdl = rHdlList.GetHdl(a);
+
+ if(pTestHdl && pTestHdl->IsSelected() && pTestHdl->GetObj() == pInteractionObject)
+ {
+ nSelectedPoints++;
+ }
+ }
+
+ if(nSelectedPoints <= 1)
+ bMultiPointDrag = sal_False;
+ }
+
+ ((ImpPathForDragAndCreate*)this)->mpSdrPathDragData = new ImpSdrPathDragData(mrSdrPathObject,*pHdl,bMultiPointDrag,rDrag);
+
+ if(!mpSdrPathDragData || !mpSdrPathDragData->bValid)
+ {
+ DBG_ERROR("ImpPathForDragAndCreate::BegDrag(): ImpSdrPathDragData ist ungueltig");
+ delete mpSdrPathDragData;
+ ((ImpPathForDragAndCreate*)this)->mpSdrPathDragData = 0;
+ return false;
+ }
+
+ return true;
+}
+
+bool ImpPathForDragAndCreate::movePathDrag( SdrDragStat& rDrag ) const
+{
+ if(!mpSdrPathDragData || !mpSdrPathDragData->bValid)
+ {
+ DBG_ERROR("ImpPathForDragAndCreate::MovDrag(): ImpSdrPathDragData ist ungueltig");
+ return false;
+ }
+
+ if(mpSdrPathDragData->IsMultiPointDrag())
+ {
+ Point aDelta(rDrag.GetNow() - rDrag.GetStart());
+
+ if(aDelta.X() || aDelta.Y())
+ {
+ for(sal_uInt32 a(0); a < mpSdrPathDragData->maHandles.Count(); a++)
+ {
+ SdrHdl* pHandle = (SdrHdl*)mpSdrPathDragData->maHandles.GetObject(a);
+ const sal_uInt16 nPolyIndex((sal_uInt16)pHandle->GetPolyNum());
+ const sal_uInt16 nPointIndex((sal_uInt16)pHandle->GetPointNum());
+ const XPolygon& rOrig = mpSdrPathDragData->maOrig[nPolyIndex];
+ XPolygon& rMove = mpSdrPathDragData->maMove[nPolyIndex];
+ const sal_uInt16 nPointCount(rOrig.GetPointCount());
+ sal_Bool bClosed(rOrig[0] == rOrig[nPointCount-1]);
+
+ // move point itself
+ rMove[nPointIndex] = rOrig[nPointIndex] + aDelta;
+
+ // when point is first and poly closed, move close point, too.
+ if(nPointCount > 0 && !nPointIndex && bClosed)
+ {
+ rMove[nPointCount - 1] = rOrig[nPointCount - 1] + aDelta;
+
+ // when moving the last point it may be necessary to move the
+ // control point in front of this one, too.
+ if(nPointCount > 1 && rOrig.IsControl(nPointCount - 2))
+ rMove[nPointCount - 2] = rOrig[nPointCount - 2] + aDelta;
+ }
+
+ // is a control point before this?
+ if(nPointIndex > 0 && rOrig.IsControl(nPointIndex - 1))
+ {
+ // Yes, move it, too
+ rMove[nPointIndex - 1] = rOrig[nPointIndex - 1] + aDelta;
+ }
+
+ // is a control point after this?
+ if(nPointIndex + 1 < nPointCount && rOrig.IsControl(nPointIndex + 1))
+ {
+ // Yes, move it, too
+ rMove[nPointIndex + 1] = rOrig[nPointIndex + 1] + aDelta;
+ }
+ }
+ }
+ }
+ else
+ {
+ mpSdrPathDragData->ResetPoly(mrSdrPathObject);
+
+ // Div. Daten lokal Kopieren fuer weniger Code und schnelleren Zugriff
+ FASTBOOL bClosed =mpSdrPathDragData->bClosed ; // geschlossenes Objekt?
+ sal_uInt16 nPnt =mpSdrPathDragData->nPnt ; // Punktnummer innerhalb des obigen Polygons
+ FASTBOOL bBegPnt =mpSdrPathDragData->bBegPnt ; // Gedraggter Punkt ist der Anfangspunkt einer Polyline
+ FASTBOOL bEndPnt =mpSdrPathDragData->bEndPnt ; // Gedraggter Punkt ist der Endpunkt einer Polyline
+ sal_uInt16 nPrevPnt =mpSdrPathDragData->nPrevPnt ; // Index des vorherigen Punkts
+ sal_uInt16 nNextPnt =mpSdrPathDragData->nNextPnt ; // Index des naechsten Punkts
+ FASTBOOL bPrevIsBegPnt =mpSdrPathDragData->bPrevIsBegPnt ; // Vorheriger Punkt ist Anfangspunkt einer Polyline
+ FASTBOOL bNextIsEndPnt =mpSdrPathDragData->bNextIsEndPnt ; // Folgepunkt ist Endpunkt einer Polyline
+ sal_uInt16 nPrevPrevPnt =mpSdrPathDragData->nPrevPrevPnt ; // Index des vorvorherigen Punkts
+ sal_uInt16 nNextNextPnt =mpSdrPathDragData->nNextNextPnt ; // Index des uebernaechsten Punkts
+ FASTBOOL bControl =mpSdrPathDragData->bControl ; // Punkt ist ein Kontrollpunkt
+ //int bIsPrevControl=mpSdrPathDragData->bIsPrevControl; // Punkt ist Kontrollpunkt vor einem Stuetzpunkt
+ FASTBOOL bIsNextControl=mpSdrPathDragData->bIsNextControl; // Punkt ist Kontrollpunkt hinter einem Stuetzpunkt
+ FASTBOOL bPrevIsControl=mpSdrPathDragData->bPrevIsControl; // Falls nPnt ein StPnt: Davor ist ein Kontrollpunkt
+ FASTBOOL bNextIsControl=mpSdrPathDragData->bNextIsControl; // Falls nPnt ein StPnt: Dahinter ist ein Kontrollpunkt
+
+ // Ortho bei Linien/Polygonen = Winkel beibehalten
+ if (!bControl && rDrag.GetView()!=NULL && rDrag.GetView()->IsOrtho()) {
+ FASTBOOL bBigOrtho=rDrag.GetView()->IsBigOrtho();
+ Point aPos(rDrag.GetNow()); // die aktuelle Position
+ Point aPnt(mpSdrPathDragData->aXP[nPnt]); // der gedraggte Punkt
+ sal_uInt16 nPnt1=0xFFFF,nPnt2=0xFFFF; // seine Nachbarpunkte
+ Point aNeuPos1,aNeuPos2; // die neuen Alternativen fuer aPos
+ FASTBOOL bPnt1=sal_False,bPnt2=sal_False; // die neuen Alternativen gueltig?
+ if (!bClosed && mpSdrPathDragData->nPntAnz>=2) { // Mind. 2 Pt bei Linien
+ if (!bBegPnt) nPnt1=nPrevPnt;
+ if (!bEndPnt) nPnt2=nNextPnt;
+ }
+ if (bClosed && mpSdrPathDragData->nPntAnz>=3) { // Mind. 3 Pt bei Polygon
+ nPnt1=nPrevPnt;
+ nPnt2=nNextPnt;
+ }
+ if (nPnt1!=0xFFFF && !bPrevIsControl) {
+ Point aPnt1=mpSdrPathDragData->aXP[nPnt1];
+ long ndx0=aPnt.X()-aPnt1.X();
+ long ndy0=aPnt.Y()-aPnt1.Y();
+ FASTBOOL bHLin=ndy0==0;
+ FASTBOOL bVLin=ndx0==0;
+ if (!bHLin || !bVLin) {
+ long ndx=aPos.X()-aPnt1.X();
+ long ndy=aPos.Y()-aPnt1.Y();
+ bPnt1=sal_True;
+ double nXFact=0; if (!bVLin) nXFact=(double)ndx/(double)ndx0;
+ double nYFact=0; if (!bHLin) nYFact=(double)ndy/(double)ndy0;
+ FASTBOOL bHor=bHLin || (!bVLin && (nXFact>nYFact) ==bBigOrtho);
+ FASTBOOL bVer=bVLin || (!bHLin && (nXFact<=nYFact)==bBigOrtho);
+ if (bHor) ndy=long(ndy0*nXFact);
+ if (bVer) ndx=long(ndx0*nYFact);
+ aNeuPos1=aPnt1;
+ aNeuPos1.X()+=ndx;
+ aNeuPos1.Y()+=ndy;
+ }
+ }
+ if (nPnt2!=0xFFFF && !bNextIsControl) {
+ Point aPnt2=mpSdrPathDragData->aXP[nPnt2];
+ long ndx0=aPnt.X()-aPnt2.X();
+ long ndy0=aPnt.Y()-aPnt2.Y();
+ FASTBOOL bHLin=ndy0==0;
+ FASTBOOL bVLin=ndx0==0;
+ if (!bHLin || !bVLin) {
+ long ndx=aPos.X()-aPnt2.X();
+ long ndy=aPos.Y()-aPnt2.Y();
+ bPnt2=sal_True;
+ double nXFact=0; if (!bVLin) nXFact=(double)ndx/(double)ndx0;
+ double nYFact=0; if (!bHLin) nYFact=(double)ndy/(double)ndy0;
+ FASTBOOL bHor=bHLin || (!bVLin && (nXFact>nYFact) ==bBigOrtho);
+ FASTBOOL bVer=bVLin || (!bHLin && (nXFact<=nYFact)==bBigOrtho);
+ if (bHor) ndy=long(ndy0*nXFact);
+ if (bVer) ndx=long(ndx0*nYFact);
+ aNeuPos2=aPnt2;
+ aNeuPos2.X()+=ndx;
+ aNeuPos2.Y()+=ndy;
+ }
+ }
+ if (bPnt1 && bPnt2) { // beide Alternativen vorhanden (Konkurenz)
+ BigInt nX1(aNeuPos1.X()-aPos.X()); nX1*=nX1;
+ BigInt nY1(aNeuPos1.Y()-aPos.Y()); nY1*=nY1;
+ BigInt nX2(aNeuPos2.X()-aPos.X()); nX2*=nX2;
+ BigInt nY2(aNeuPos2.Y()-aPos.Y()); nY2*=nY2;
+ nX1+=nY1; // Korrekturabstand zum Quadrat
+ nX2+=nY2; // Korrekturabstand zum Quadrat
+ // Die Alternative mit dem geringeren Korrekturbedarf gewinnt
+ if (nX1<nX2) bPnt2=sal_False; else bPnt1=sal_False;
+ }
+ if (bPnt1) rDrag.Now()=aNeuPos1;
+ if (bPnt2) rDrag.Now()=aNeuPos2;
+ }
+ rDrag.SetActionRect(Rectangle(rDrag.GetNow(),rDrag.GetNow()));
+
+ // IBM Special: Punkte eliminieren, wenn die beiden angrenzenden
+ // Linien eh' fast 180 deg sind.
+ if (!bControl && rDrag.GetView()!=NULL && rDrag.GetView()->IsEliminatePolyPoints() &&
+ !bBegPnt && !bEndPnt && !bPrevIsControl && !bNextIsControl)
+ {
+ Point aPt(mpSdrPathDragData->aXP[nNextPnt]);
+ aPt-=rDrag.GetNow();
+ long nWink1=GetAngle(aPt);
+ aPt=rDrag.GetNow();
+ aPt-=mpSdrPathDragData->aXP[nPrevPnt];
+ long nWink2=GetAngle(aPt);
+ long nDiff=nWink1-nWink2;
+ nDiff=Abs(nDiff);
+ mpSdrPathDragData->bEliminate=nDiff<=rDrag.GetView()->GetEliminatePolyPointLimitAngle();
+ if (mpSdrPathDragData->bEliminate) { // Position anpassen, damit Smooth an den Enden stimmt
+ aPt=mpSdrPathDragData->aXP[nNextPnt];
+ aPt+=mpSdrPathDragData->aXP[nPrevPnt];
+ aPt/=2;
+ rDrag.Now()=aPt;
+ }
+ }
+
+ // Um diese Entfernung wurde insgesamt gedraggd
+ Point aDiff(rDrag.GetNow()); aDiff-=mpSdrPathDragData->aXP[nPnt];
+
+ // Insgesamt sind 8 Faelle moeglich:
+ // X 1. Weder rechts noch links Ctrl.
+ // o--X--o 2. Rechts und links Ctrl, gedraggd wird St.
+ // o--X 3. Nur links Ctrl, gedraggd wird St.
+ // X--o 4. Nur rechts Ctrl, gedraggd wird St.
+ // x--O--o 5. Rechts und links Ctrl, gedraggd wird links.
+ // x--O 6. Nur links Ctrl, gedraggd wird links.
+ // o--O--x 7. Rechts und links Ctrl, gedraggd wird rechts.
+ // O--x 8. Nur rechts Ctrl, gedraggd wird rechts.
+ // Zusaetzlich ist zu beachten, dass das Veraendern einer Linie (keine Kurve)
+ // eine evtl. Kurve am anderen Ende der Linie bewirkt, falls dort Smooth
+ // gesetzt ist (Kontrollpunktausrichtung an Gerade).
+
+ mpSdrPathDragData->aXP[nPnt]+=aDiff;
+
+ // Nun symmetrische PlusHandles etc. checken
+ if (bControl) { // Faelle 5,6,7,8
+ sal_uInt16 nSt=nPnt; // der zugehoerige Stuetzpunkt
+ sal_uInt16 nFix=nPnt; // der gegenueberliegende Kontrollpunkt
+ if (bIsNextControl) { // Wenn der naechste ein Kontrollpunkt ist, muss der vorh. der Stuetzpunkt sein
+ nSt=nPrevPnt;
+ nFix=nPrevPrevPnt;
+ } else {
+ nSt=nNextPnt;
+ nFix=nNextNextPnt;
+ }
+ if (mpSdrPathDragData->aXP.IsSmooth(nSt)) {
+ mpSdrPathDragData->aXP.CalcSmoothJoin(nSt,nPnt,nFix);
+ }
+ }
+
+ if (!bControl) { // Faelle 1,2,3,4 wobei bei 1 nix passiert und bei 3+4 unten noch mehr folgt
+ // die beiden Kontrollpunkte mit verschieben
+ if (bPrevIsControl) mpSdrPathDragData->aXP[nPrevPnt]+=aDiff;
+ if (bNextIsControl) mpSdrPathDragData->aXP[nNextPnt]+=aDiff;
+ // Kontrollpunkt ggf. an Gerade ausrichten
+ if (mpSdrPathDragData->aXP.IsSmooth(nPnt)) {
+ if (bPrevIsControl && !bNextIsControl && !bEndPnt) { // Fall 3
+ mpSdrPathDragData->aXP.CalcSmoothJoin(nPnt,nNextPnt,nPrevPnt);
+ }
+ if (bNextIsControl && !bPrevIsControl && !bBegPnt) { // Fall 4
+ mpSdrPathDragData->aXP.CalcSmoothJoin(nPnt,nPrevPnt,nNextPnt);
+ }
+ }
+ // Und nun noch die anderen Enden der Strecken ueberpruefen (nPnt+-1).
+ // Ist dort eine Kurve (IsControl(nPnt+-2)) mit SmoothJoin (nPnt+-1),
+ // so muss der entsprechende Kontrollpunkt (nPnt+-2) angepasst werden.
+ if (!bBegPnt && !bPrevIsControl && !bPrevIsBegPnt && mpSdrPathDragData->aXP.IsSmooth(nPrevPnt)) {
+ if (mpSdrPathDragData->aXP.IsControl(nPrevPrevPnt)) {
+ mpSdrPathDragData->aXP.CalcSmoothJoin(nPrevPnt,nPnt,nPrevPrevPnt);
+ }
+ }
+ if (!bEndPnt && !bNextIsControl && !bNextIsEndPnt && mpSdrPathDragData->aXP.IsSmooth(nNextPnt)) {
+ if (mpSdrPathDragData->aXP.IsControl(nNextNextPnt)) {
+ mpSdrPathDragData->aXP.CalcSmoothJoin(nNextPnt,nPnt,nNextNextPnt);
+ }
+ }
+ }
+ }
+
+ return true;
+}
+
+bool ImpPathForDragAndCreate::endPathDrag(SdrDragStat& rDrag)
+{
+ Point aLinePt1;
+ Point aLinePt2;
+ bool bLineGlueMirror(OBJ_LINE == meObjectKind);
+ if (bLineGlueMirror) { // #40549#
+ XPolygon& rXP=aPathPolygon[0];
+ aLinePt1=rXP[0];
+ aLinePt2=rXP[1];
+ }
+
+ if(!mpSdrPathDragData || !mpSdrPathDragData->bValid)
+ {
+ DBG_ERROR("ImpPathForDragAndCreate::MovDrag(): ImpSdrPathDragData ist ungueltig");
+ return false;
+ }
+
+ if(mpSdrPathDragData->IsMultiPointDrag())
+ {
+ aPathPolygon = mpSdrPathDragData->maMove;
+ }
+ else
+ {
+ const SdrHdl* pHdl=rDrag.GetHdl();
+
+ // Referenz auf das Polygon
+ XPolygon& rXP=aPathPolygon[(sal_uInt16)pHdl->GetPolyNum()];
+
+ // Die 5 Punkte die sich evtl. geaendert haben
+ if (!mpSdrPathDragData->bPrevIsBegPnt) rXP[mpSdrPathDragData->nPrevPrevPnt0]=mpSdrPathDragData->aXP[mpSdrPathDragData->nPrevPrevPnt];
+ if (!mpSdrPathDragData->bNextIsEndPnt) rXP[mpSdrPathDragData->nNextNextPnt0]=mpSdrPathDragData->aXP[mpSdrPathDragData->nNextNextPnt];
+ if (!mpSdrPathDragData->bBegPnt) rXP[mpSdrPathDragData->nPrevPnt0] =mpSdrPathDragData->aXP[mpSdrPathDragData->nPrevPnt];
+ if (!mpSdrPathDragData->bEndPnt) rXP[mpSdrPathDragData->nNextPnt0] =mpSdrPathDragData->aXP[mpSdrPathDragData->nNextPnt];
+ rXP[mpSdrPathDragData->nPnt0] =mpSdrPathDragData->aXP[mpSdrPathDragData->nPnt];
+
+ // Letzter Punkt muss beim Geschlossenen immer gleich dem Ersten sein
+ if (mpSdrPathDragData->bClosed) rXP[rXP.GetPointCount()-1]=rXP[0];
+
+ if (mpSdrPathDragData->bEliminate)
+ {
+ basegfx::B2DPolyPolygon aTempPolyPolygon(aPathPolygon.getB2DPolyPolygon());
+ sal_uInt32 nPoly,nPnt;
+
+ if(PolyPolygonEditor::GetRelativePolyPoint(aTempPolyPolygon, rDrag.GetHdl()->GetSourceHdlNum(), nPoly, nPnt))
+ {
+ basegfx::B2DPolygon aCandidate(aTempPolyPolygon.getB2DPolygon(nPoly));
+ aCandidate.remove(nPnt);
+
+ if((IsClosed(meObjectKind) && aCandidate.count() < 3L) || aCandidate.count() < 2L)
+ {
+ aTempPolyPolygon.remove(nPoly);
+ }
+ else
+ {
+ aTempPolyPolygon.setB2DPolygon(nPoly, aCandidate);
+ }
+ }
+
+ aPathPolygon = XPolyPolygon(aTempPolyPolygon);
+ }
+
+ // Winkel anpassen fuer Text an einfacher Linie
+ if (bLineGlueMirror)
+ { // #40549#
+ Point aLinePt1_(aPathPolygon[0][0]);
+ Point aLinePt2_(aPathPolygon[0][1]);
+ FASTBOOL bXMirr=(aLinePt1_.X()>aLinePt2_.X())!=(aLinePt1.X()>aLinePt2.X());
+ FASTBOOL bYMirr=(aLinePt1_.Y()>aLinePt2_.Y())!=(aLinePt1.Y()>aLinePt2.Y());
+ if (bXMirr || bYMirr) {
+ Point aRef1(mrSdrPathObject.GetSnapRect().Center());
+ if (bXMirr) {
+ Point aRef2(aRef1);
+ aRef2.Y()++;
+ mrSdrPathObject.NbcMirrorGluePoints(aRef1,aRef2);
+ }
+ if (bYMirr) {
+ Point aRef2(aRef1);
+ aRef2.X()++;
+ mrSdrPathObject.NbcMirrorGluePoints(aRef1,aRef2);
+ }
+ }
+ }
+ }
+
+ delete mpSdrPathDragData;
+ mpSdrPathDragData = 0;
+
+ return true;
+}
+
+/*void ImpPathForDragAndCreate::cancelSpecialDrag( SdrDragStat& rDrag ) const
+{
+ ImpSdrPathDragData* pID=(ImpSdrPathDragData*)rDrag.GetUser();
+ if (pID!=NULL) {
+ delete pID;
+ rDrag.SetUser(NULL);
+ }
+}*/
+
+String ImpPathForDragAndCreate::getSpecialDragComment(const SdrDragStat& rDrag) const
+{
+ XubString aStr;
+ const SdrHdl* pHdl = rDrag.GetHdl();
+ const bool bCreateComment(rDrag.GetView() && &mrSdrPathObject == rDrag.GetView()->GetCreateObj());
+
+ if(bCreateComment && rDrag.GetUser())
+ {
+ // #i103058# re-add old creation comment mode
+ ImpPathCreateUser* pU = (ImpPathCreateUser*)rDrag.GetUser();
+ const SdrObjKind eKindMerk(meObjectKind);
+ mrSdrPathObject.meKind = pU->eAktKind;
+ mrSdrPathObject.ImpTakeDescriptionStr(STR_ViewCreateObj, aStr);
+ mrSdrPathObject.meKind = eKindMerk;
+
+ Point aPrev(rDrag.GetPrev());
+ Point aNow(rDrag.GetNow());
+
+ if(pU->bLine)
+ aNow = pU->aLineEnd;
+
+ aNow -= aPrev;
+ aStr.AppendAscii(" (");
+
+ XubString aMetr;
+
+ if(pU->bCircle)
+ {
+ mrSdrPathObject.GetModel()->TakeWinkStr(Abs(pU->nCircRelWink), aMetr);
+ aStr += aMetr;
+ aStr.AppendAscii(" r=");
+ mrSdrPathObject.GetModel()->TakeMetricStr(pU->nCircRadius, aMetr, sal_True);
+ aStr += aMetr;
+ }
+
+ aStr.AppendAscii("dx=");
+ mrSdrPathObject.GetModel()->TakeMetricStr(aNow.X(), aMetr, sal_True);
+ aStr += aMetr;
+
+ aStr.AppendAscii(" dy=");
+ mrSdrPathObject.GetModel()->TakeMetricStr(aNow.Y(), aMetr, sal_True);
+ aStr += aMetr;
+
+ if(!IsFreeHand(meObjectKind))
+ {
+ sal_Int32 nLen(GetLen(aNow));
+ aStr.AppendAscii(" l=");
+ mrSdrPathObject.GetModel()->TakeMetricStr(nLen, aMetr, sal_True);
+ aStr += aMetr;
+
+ sal_Int32 nWink(GetAngle(aNow));
+ aStr += sal_Unicode(' ');
+ mrSdrPathObject.GetModel()->TakeWinkStr(nWink, aMetr);
+ aStr += aMetr;
+ }
+
+ aStr += sal_Unicode(')');
+ }
+ else if(!mrSdrPathObject.GetModel() || !pHdl)
+ {
+ // #i103058# fallback when no model and/or Handle, both needed
+ // for else-path
+ mrSdrPathObject.ImpTakeDescriptionStr(STR_DragPathObj, aStr);
+ }
+ else
+ {
+ // #i103058# standard for modification; model and handle needed
+ ImpSdrPathDragData* pDragData = mpSdrPathDragData;
+
+ if(!pDragData)
+ {
+ // getSpecialDragComment is also used from create, so fallback to GetUser()
+ // when mpSdrPathDragData is not set
+ pDragData = (ImpSdrPathDragData*)rDrag.GetUser();
+ }
+
+ if(!pDragData)
+ {
+ DBG_ERROR("ImpPathForDragAndCreate::MovDrag(): ImpSdrPathDragData ist ungueltig");
+ return String();
+ }
+
+ if(!pDragData->IsMultiPointDrag() && pDragData->bEliminate)
+ {
+ // Punkt von ...
+ mrSdrPathObject.ImpTakeDescriptionStr(STR_ViewMarkedPoint, aStr);
+
+ // %O loeschen
+ XubString aStr2(ImpGetResStr(STR_EditDelete));
+
+ // UNICODE: Punkt von ... loeschen
+ aStr2.SearchAndReplaceAscii("%1", aStr);
+
+ return aStr2;
+ }
+
+ // dx=0.00 dy=0.00 // Beide Seiten Bezier
+ // dx=0.00 dy=0.00 l=0.00 0.00ø // Anfang oder Ende oder eine Seite Bezier bzw. Hebel
+ // dx=0.00 dy=0.00 l=0.00 0.00ø / l=0.00 0.00ø // Mittendrin
+ XubString aMetr;
+ Point aBeg(rDrag.GetStart());
+ Point aNow(rDrag.GetNow());
+
+ aStr = String();
+ aStr.AppendAscii("dx=");
+ mrSdrPathObject.GetModel()->TakeMetricStr(aNow.X() - aBeg.X(), aMetr, sal_True);
+ aStr += aMetr;
+
+ aStr.AppendAscii(" dy=");
+ mrSdrPathObject.GetModel()->TakeMetricStr(aNow.Y() - aBeg.Y(), aMetr, sal_True);
+ aStr += aMetr;
+
+ if(!pDragData->IsMultiPointDrag())
+ {
+ sal_uInt16 nPntNum((sal_uInt16)pHdl->GetPointNum());
+ const XPolygon& rXPoly = aPathPolygon[(sal_uInt16)rDrag.GetHdl()->GetPolyNum()];
+ sal_uInt16 nPntAnz((sal_uInt16)rXPoly.GetPointCount());
+ sal_Bool bClose(IsClosed(meObjectKind));
+
+ if(bClose)
+ nPntAnz--;
+
+ if(pHdl->IsPlusHdl())
+ {
+ // Hebel
+ sal_uInt16 nRef(nPntNum);
+
+ if(rXPoly.IsControl(nPntNum + 1))
+ nRef--;
+ else
+ nRef++;
+
+ aNow -= rXPoly[nRef];
+
+ sal_Int32 nLen(GetLen(aNow));
+ aStr.AppendAscii(" l=");
+ mrSdrPathObject.GetModel()->TakeMetricStr(nLen, aMetr, sal_True);
+ aStr += aMetr;
+
+ sal_Int32 nWink(GetAngle(aNow));
+ aStr += sal_Unicode(' ');
+ mrSdrPathObject.GetModel()->TakeWinkStr(nWink, aMetr);
+ aStr += aMetr;
+ }
+ else if(nPntAnz > 1)
+ {
+ sal_uInt16 nPntMax(nPntAnz - 1);
+ Point aPt1,aPt2;
+ sal_Bool bIsClosed(IsClosed(meObjectKind));
+ sal_Bool bPt1(nPntNum > 0);
+ sal_Bool bPt2(nPntNum < nPntMax);
+
+ if(bIsClosed && nPntAnz > 2)
+ {
+ bPt1 = sal_True;
+ bPt2 = sal_True;
+ }
+
+ sal_uInt16 nPt1,nPt2;
+
+ if(nPntNum > 0)
+ nPt1 = nPntNum - 1;
+ else
+ nPt1 = nPntMax;
+
+ if(nPntNum < nPntMax)
+ nPt2 = nPntNum + 1;
+ else
+ nPt2 = 0;
+
+ if(bPt1 && rXPoly.IsControl(nPt1))
+ bPt1 = sal_False; // Keine Anzeige
+
+ if(bPt2 && rXPoly.IsControl(nPt2))
+ bPt2 = sal_False; // von Bezierdaten
+
+ if(bPt1)
+ {
+ Point aPt(aNow);
+ aPt -= rXPoly[nPt1];
+
+ sal_Int32 nLen(GetLen(aPt));
+ aStr.AppendAscii(" l=");
+ mrSdrPathObject.GetModel()->TakeMetricStr(nLen, aMetr, sal_True);
+ aStr += aMetr;
+
+ sal_Int32 nWink(GetAngle(aPt));
+ aStr += sal_Unicode(' ');
+ mrSdrPathObject.GetModel()->TakeWinkStr(nWink, aMetr);
+ aStr += aMetr;
+ }
+
+ if(bPt2)
+ {
+ if(bPt1)
+ aStr.AppendAscii(" / ");
+ else
+ aStr.AppendAscii(" ");
+
+ Point aPt(aNow);
+ aPt -= rXPoly[nPt2];
+
+ sal_Int32 nLen(GetLen(aPt));
+ aStr.AppendAscii("l=");
+ mrSdrPathObject.GetModel()->TakeMetricStr(nLen, aMetr, sal_True);
+ aStr += aMetr;
+
+ sal_Int32 nWink(GetAngle(aPt));
+ aStr += sal_Unicode(' ');
+ mrSdrPathObject.GetModel()->TakeWinkStr(nWink, aMetr);
+ aStr += aMetr;
+ }
+ }
+ }
+ }
+
+ return aStr;
+}
+
+basegfx::B2DPolyPolygon ImpPathForDragAndCreate::getSpecialDragPoly(const SdrDragStat& rDrag) const
+{
+ if(!mpSdrPathDragData || !mpSdrPathDragData->bValid)
+ {
+ DBG_ERROR("ImpPathForDragAndCreate::MovDrag(): ImpSdrPathDragData ist ungueltig");
+ return basegfx::B2DPolyPolygon();
+ }
+
+ XPolyPolygon aRetval;
+
+ if(mpSdrPathDragData->IsMultiPointDrag())
+ {
+ aRetval.Insert(mpSdrPathDragData->maMove);
+ }
+ else
+ {
+ const XPolygon& rXP=aPathPolygon[(sal_uInt16)rDrag.GetHdl()->GetPolyNum()];
+ if (rXP.GetPointCount()<=2) { //|| rXPoly.GetFlags(1)==XPOLY_CONTROL && rXPoly.GetPointCount()<=4
+ XPolygon aXPoly(rXP);
+ aXPoly[(sal_uInt16)rDrag.GetHdl()->GetPointNum()]=rDrag.GetNow();
+ aRetval.Insert(aXPoly);
+ return aRetval.getB2DPolyPolygon();
+ }
+ // Div. Daten lokal Kopieren fuer weniger Code und schnelleren Zugriff
+ FASTBOOL bClosed =mpSdrPathDragData->bClosed ; // geschlossenes Objekt?
+ sal_uInt16 nPntAnz =mpSdrPathDragData->nPntAnz ; // Punktanzahl
+ sal_uInt16 nPnt =mpSdrPathDragData->nPnt ; // Punktnummer innerhalb des Polygons
+ FASTBOOL bBegPnt =mpSdrPathDragData->bBegPnt ; // Gedraggter Punkt ist der Anfangspunkt einer Polyline
+ FASTBOOL bEndPnt =mpSdrPathDragData->bEndPnt ; // Gedraggter Punkt ist der Endpunkt einer Polyline
+ sal_uInt16 nPrevPnt =mpSdrPathDragData->nPrevPnt ; // Index des vorherigen Punkts
+ sal_uInt16 nNextPnt =mpSdrPathDragData->nNextPnt ; // Index des naechsten Punkts
+ FASTBOOL bPrevIsBegPnt =mpSdrPathDragData->bPrevIsBegPnt ; // Vorheriger Punkt ist Anfangspunkt einer Polyline
+ FASTBOOL bNextIsEndPnt =mpSdrPathDragData->bNextIsEndPnt ; // Folgepunkt ist Endpunkt einer Polyline
+ sal_uInt16 nPrevPrevPnt =mpSdrPathDragData->nPrevPrevPnt ; // Index des vorvorherigen Punkts
+ sal_uInt16 nNextNextPnt =mpSdrPathDragData->nNextNextPnt ; // Index des uebernaechsten Punkts
+ FASTBOOL bControl =mpSdrPathDragData->bControl ; // Punkt ist ein Kontrollpunkt
+ //int bIsPrevControl=mpSdrPathDragData->bIsPrevControl; // Punkt ist Kontrollpunkt vor einem Stuetzpunkt
+ FASTBOOL bIsNextControl=mpSdrPathDragData->bIsNextControl; // Punkt ist Kontrollpunkt hinter einem Stuetzpunkt
+ FASTBOOL bPrevIsControl=mpSdrPathDragData->bPrevIsControl; // Falls nPnt ein StPnt: Davor ist ein Kontrollpunkt
+ FASTBOOL bNextIsControl=mpSdrPathDragData->bNextIsControl; // Falls nPnt ein StPnt: Dahinter ist ein Kontrollpunkt
+ XPolygon aXPoly(mpSdrPathDragData->aXP);
+ XPolygon aLine1(2);
+ XPolygon aLine2(2);
+ XPolygon aLine3(2);
+ XPolygon aLine4(2);
+ if (bControl) {
+ aLine1[1]=mpSdrPathDragData->aXP[nPnt];
+ if (bIsNextControl) { // bin ich Kontrollpunkt hinter der Stuetzstelle?
+ aLine1[0]=mpSdrPathDragData->aXP[nPrevPnt];
+ aLine2[0]=mpSdrPathDragData->aXP[nNextNextPnt];
+ aLine2[1]=mpSdrPathDragData->aXP[nNextPnt];
+ if (mpSdrPathDragData->aXP.IsSmooth(nPrevPnt) && !bPrevIsBegPnt && mpSdrPathDragData->aXP.IsControl(nPrevPrevPnt)) {
+ aXPoly.Insert(0,rXP[mpSdrPathDragData->nPrevPrevPnt0-1],XPOLY_CONTROL);
+ aXPoly.Insert(0,rXP[mpSdrPathDragData->nPrevPrevPnt0-2],XPOLY_NORMAL);
+ // Hebellienien fuer das gegenueberliegende Kurvensegment
+ aLine3[0]=mpSdrPathDragData->aXP[nPrevPnt];
+ aLine3[1]=mpSdrPathDragData->aXP[nPrevPrevPnt];
+ aLine4[0]=rXP[mpSdrPathDragData->nPrevPrevPnt0-2];
+ aLine4[1]=rXP[mpSdrPathDragData->nPrevPrevPnt0-1];
+ } else {
+ aXPoly.Remove(0,1);
+ }
+ } else { // ansonsten bin ich Kontrollpunkt vor der Stuetzstelle
+ aLine1[0]=mpSdrPathDragData->aXP[nNextPnt];
+ aLine2[0]=mpSdrPathDragData->aXP[nPrevPrevPnt];
+ aLine2[1]=mpSdrPathDragData->aXP[nPrevPnt];
+ if (mpSdrPathDragData->aXP.IsSmooth(nNextPnt) && !bNextIsEndPnt && mpSdrPathDragData->aXP.IsControl(nNextNextPnt)) {
+ aXPoly.Insert(XPOLY_APPEND,rXP[mpSdrPathDragData->nNextNextPnt0+1],XPOLY_CONTROL);
+ aXPoly.Insert(XPOLY_APPEND,rXP[mpSdrPathDragData->nNextNextPnt0+2],XPOLY_NORMAL);
+ // Hebellinien fuer das gegenueberliegende Kurvensegment
+ aLine3[0]=mpSdrPathDragData->aXP[nNextPnt];
+ aLine3[1]=mpSdrPathDragData->aXP[nNextNextPnt];
+ aLine4[0]=rXP[mpSdrPathDragData->nNextNextPnt0+2];
+ aLine4[1]=rXP[mpSdrPathDragData->nNextNextPnt0+1];
+ } else {
+ aXPoly.Remove(aXPoly.GetPointCount()-1,1);
+ }
+ }
+ } else { // ansonsten kein Kontrollpunkt
+ if (mpSdrPathDragData->bEliminate) {
+ aXPoly.Remove(2,1);
+ }
+ if (bPrevIsControl) aXPoly.Insert(0,rXP[mpSdrPathDragData->nPrevPrevPnt0-1],XPOLY_NORMAL);
+ else if (!bBegPnt && !bPrevIsBegPnt && mpSdrPathDragData->aXP.IsControl(nPrevPrevPnt)) {
+ aXPoly.Insert(0,rXP[mpSdrPathDragData->nPrevPrevPnt0-1],XPOLY_CONTROL);
+ aXPoly.Insert(0,rXP[mpSdrPathDragData->nPrevPrevPnt0-2],XPOLY_NORMAL);
+ } else {
+ aXPoly.Remove(0,1);
+ if (bBegPnt) aXPoly.Remove(0,1);
+ }
+ if (bNextIsControl) aXPoly.Insert(XPOLY_APPEND,rXP[mpSdrPathDragData->nNextNextPnt0+1],XPOLY_NORMAL);
+ else if (!bEndPnt && !bNextIsEndPnt && mpSdrPathDragData->aXP.IsControl(nNextNextPnt)) {
+ aXPoly.Insert(XPOLY_APPEND,rXP[mpSdrPathDragData->nNextNextPnt0+1],XPOLY_CONTROL);
+ aXPoly.Insert(XPOLY_APPEND,rXP[mpSdrPathDragData->nNextNextPnt0+2],XPOLY_NORMAL);
+ } else {
+ aXPoly.Remove(aXPoly.GetPointCount()-1,1);
+ if (bEndPnt) aXPoly.Remove(aXPoly.GetPointCount()-1,1);
+ }
+ if (bClosed) { // "Birnenproblem": 2 Linien, 1 Kurve, alles Smooth, Punkt zw. beiden Linien wird gedraggt
+ if (aXPoly.GetPointCount()>nPntAnz && aXPoly.IsControl(1)) {
+ sal_uInt16 a=aXPoly.GetPointCount();
+ aXPoly[a-2]=aXPoly[2]; aXPoly.SetFlags(a-2,aXPoly.GetFlags(2));
+ aXPoly[a-1]=aXPoly[3]; aXPoly.SetFlags(a-1,aXPoly.GetFlags(3));
+ aXPoly.Remove(0,3);
+ }
+ }
+ }
+ aRetval.Insert(aXPoly);
+ if (aLine1.GetPointCount()>1) aRetval.Insert(aLine1);
+ if (aLine2.GetPointCount()>1) aRetval.Insert(aLine2);
+ if (aLine3.GetPointCount()>1) aRetval.Insert(aLine3);
+ if (aLine4.GetPointCount()>1) aRetval.Insert(aLine4);
+ }
+
+ return aRetval.getB2DPolyPolygon();
+}
+
+FASTBOOL ImpPathForDragAndCreate::BegCreate(SdrDragStat& rStat)
+{
+ bool bFreeHand(IsFreeHand(meObjectKind));
+ rStat.SetNoSnap(bFreeHand);
+ rStat.SetOrtho8Possible();
+ aPathPolygon.Clear();
+ mbCreating=sal_True;
+ FASTBOOL bMakeStartPoint=sal_True;
+ SdrView* pView=rStat.GetView();
+ if (pView!=NULL && pView->IsUseIncompatiblePathCreateInterface() &&
+ (meObjectKind==OBJ_POLY || meObjectKind==OBJ_PLIN || meObjectKind==OBJ_PATHLINE || meObjectKind==OBJ_PATHFILL)) {
+ bMakeStartPoint=sal_False;
+ }
+ aPathPolygon.Insert(XPolygon());
+ aPathPolygon[0][0]=rStat.GetStart();
+ if (bMakeStartPoint) {
+ aPathPolygon[0][1]=rStat.GetNow();
+ }
+ ImpPathCreateUser* pU=new ImpPathCreateUser;
+ pU->eStartKind=meObjectKind;
+ pU->eAktKind=meObjectKind;
+ rStat.SetUser(pU);
+ return sal_True;
+}
+
+FASTBOOL ImpPathForDragAndCreate::MovCreate(SdrDragStat& rStat)
+{
+ ImpPathCreateUser* pU=(ImpPathCreateUser*)rStat.GetUser();
+ SdrView* pView=rStat.GetView();
+ XPolygon& rXPoly=aPathPolygon[aPathPolygon.Count()-1];
+ if (pView!=NULL && pView->IsCreateMode()) {
+ // ggf. auf anderes CreateTool umschalten
+ sal_uInt16 nIdent;
+ sal_uInt32 nInvent;
+ pView->TakeCurrentObj(nIdent,nInvent);
+ if (nInvent==SdrInventor && pU->eAktKind!=(SdrObjKind)nIdent) {
+ SdrObjKind eNewKind=(SdrObjKind)nIdent;
+ switch (eNewKind) {
+ case OBJ_CARC: case OBJ_CIRC: case OBJ_CCUT: case OBJ_SECT: eNewKind=OBJ_CARC;
+ case OBJ_RECT:
+ case OBJ_LINE: case OBJ_PLIN: case OBJ_POLY:
+ case OBJ_PATHLINE: case OBJ_PATHFILL:
+ case OBJ_FREELINE: case OBJ_FREEFILL:
+ case OBJ_SPLNLINE: case OBJ_SPLNFILL: {
+ pU->eAktKind=eNewKind;
+ pU->bMixedCreate=sal_True;
+ pU->nBezierStartPoint=rXPoly.GetPointCount();
+ if (pU->nBezierStartPoint>0) pU->nBezierStartPoint--;
+ } break;
+ default: break;
+ } // switch
+ }
+ }
+ sal_uInt16 nActPoint=rXPoly.GetPointCount();
+ if (aPathPolygon.Count()>1 && rStat.IsMouseDown() && nActPoint<2) {
+ rXPoly[0]=rStat.GetPos0();
+ rXPoly[1]=rStat.GetNow();
+ nActPoint=2;
+ }
+ if (nActPoint==0) {
+ rXPoly[0]=rStat.GetPos0();
+ } else nActPoint--;
+ FASTBOOL bFreeHand=IsFreeHand(pU->eAktKind);
+ rStat.SetNoSnap(bFreeHand /*|| (pU->bMixed && pU->eAktKind==OBJ_LINE)*/);
+ rStat.SetOrtho8Possible(pU->eAktKind!=OBJ_CARC && pU->eAktKind!=OBJ_RECT && (!pU->bMixedCreate || pU->eAktKind!=OBJ_LINE));
+ Point aActMerk(rXPoly[nActPoint]);
+ rXPoly[nActPoint]=rStat.Now();
+ if (!pU->bMixedCreate && pU->eStartKind==OBJ_LINE && rXPoly.GetPointCount()>=1) {
+ Point aPt(rStat.Start());
+ if (pView!=NULL && pView->IsCreate1stPointAsCenter()) {
+ aPt+=aPt;
+ aPt-=rStat.Now();
+ }
+ rXPoly[0]=aPt;
+ }
+ OutputDevice* pOut=pView==NULL ? NULL : pView->GetFirstOutputDevice(); // GetWin(0);
+ if (bFreeHand) {
+ if (pU->nBezierStartPoint>nActPoint) pU->nBezierStartPoint=nActPoint;
+ if (rStat.IsMouseDown() && nActPoint>0) {
+ // keine aufeinanderfolgenden Punkte an zu Nahe gelegenen Positionen zulassen
+ long nMinDist=1;
+ if (pView!=NULL) nMinDist=pView->GetFreeHandMinDistPix();
+ if (pOut!=NULL) nMinDist=pOut->PixelToLogic(Size(nMinDist,0)).Width();
+ if (nMinDist<1) nMinDist=1;
+
+ Point aPt0(rXPoly[nActPoint-1]);
+ Point aPt1(rStat.Now());
+ long dx=aPt0.X()-aPt1.X(); if (dx<0) dx=-dx;
+ long dy=aPt0.Y()-aPt1.Y(); if (dy<0) dy=-dy;
+ if (dx<nMinDist && dy<nMinDist) return sal_False;
+
+ // folgendes ist aus EndCreate kopiert (nur kleine Modifikationen)
+ // und sollte dann mal in eine Methode zusammengefasst werden:
+
+ if (nActPoint-pU->nBezierStartPoint>=3 && ((nActPoint-pU->nBezierStartPoint)%3)==0) {
+ rXPoly.PointsToBezier(nActPoint-3);
+ rXPoly.SetFlags(nActPoint-1,XPOLY_CONTROL);
+ rXPoly.SetFlags(nActPoint-2,XPOLY_CONTROL);
+
+ if (nActPoint>=6 && rXPoly.IsControl(nActPoint-4)) {
+ rXPoly.CalcTangent(nActPoint-3,nActPoint-4,nActPoint-2);
+ rXPoly.SetFlags(nActPoint-3,XPOLY_SMOOTH);
+ }
+ }
+ rXPoly[nActPoint+1]=rStat.Now();
+ rStat.NextPoint();
+ } else {
+ pU->nBezierStartPoint=nActPoint;
+ }
+ }
+
+ pU->ResetFormFlags();
+ if (IsBezier(pU->eAktKind)) {
+ if (nActPoint>=2) {
+ pU->CalcBezier(rXPoly[nActPoint-1],rXPoly[nActPoint],rXPoly[nActPoint-1]-rXPoly[nActPoint-2],rStat.IsMouseDown());
+ } else if (pU->bBezHasCtrl0) {
+ pU->CalcBezier(rXPoly[nActPoint-1],rXPoly[nActPoint],pU->aBezControl0-rXPoly[nActPoint-1],rStat.IsMouseDown());
+ }
+ }
+ if (pU->eAktKind==OBJ_CARC && nActPoint>=2) {
+ pU->CalcCircle(rXPoly[nActPoint-1],rXPoly[nActPoint],rXPoly[nActPoint-1]-rXPoly[nActPoint-2],pView);
+ }
+ if (pU->eAktKind==OBJ_LINE && nActPoint>=2) {
+ pU->CalcLine(rXPoly[nActPoint-1],rXPoly[nActPoint],rXPoly[nActPoint-1]-rXPoly[nActPoint-2],pView);
+ }
+ if (pU->eAktKind==OBJ_RECT && nActPoint>=2) {
+ pU->CalcRect(rXPoly[nActPoint-1],rXPoly[nActPoint],rXPoly[nActPoint-1]-rXPoly[nActPoint-2],pView);
+ }
+
+ return sal_True;
+}
+
+FASTBOOL ImpPathForDragAndCreate::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
+{
+ ImpPathCreateUser* pU=(ImpPathCreateUser*)rStat.GetUser();
+ FASTBOOL bRet=sal_False;
+ SdrView* pView=rStat.GetView();
+ FASTBOOL bIncomp=pView!=NULL && pView->IsUseIncompatiblePathCreateInterface();
+ XPolygon& rXPoly=aPathPolygon[aPathPolygon.Count()-1];
+ sal_uInt16 nActPoint=rXPoly.GetPointCount()-1;
+ Point aAktMerk(rXPoly[nActPoint]);
+ rXPoly[nActPoint]=rStat.Now();
+ if (!pU->bMixedCreate && pU->eStartKind==OBJ_LINE) {
+ if (rStat.GetPointAnz()>=2) eCmd=SDRCREATE_FORCEEND;
+ bRet=eCmd==SDRCREATE_FORCEEND;
+ if (bRet) {
+ mbCreating=sal_False;
+ delete pU;
+ rStat.SetUser(NULL);
+ }
+ return bRet;
+ }
+
+ if (!pU->bMixedCreate && IsFreeHand(pU->eStartKind)) {
+ if (rStat.GetPointAnz()>=2) eCmd=SDRCREATE_FORCEEND;
+ bRet=eCmd==SDRCREATE_FORCEEND;
+ if (bRet) {
+ mbCreating=sal_False;
+ delete pU;
+ rStat.SetUser(NULL);
+ }
+ return bRet;
+ }
+ if (eCmd==SDRCREATE_NEXTPOINT || eCmd==SDRCREATE_NEXTOBJECT) {
+ // keine aufeinanderfolgenden Punkte an identischer Position zulassen
+ if (nActPoint==0 || rStat.Now()!=rXPoly[nActPoint-1]) {
+ if (bIncomp) {
+ if (pU->nBezierStartPoint>nActPoint) pU->nBezierStartPoint=nActPoint;
+ if (IsBezier(pU->eAktKind) && nActPoint-pU->nBezierStartPoint>=3 && ((nActPoint-pU->nBezierStartPoint)%3)==0) {
+ rXPoly.PointsToBezier(nActPoint-3);
+ rXPoly.SetFlags(nActPoint-1,XPOLY_CONTROL);
+ rXPoly.SetFlags(nActPoint-2,XPOLY_CONTROL);
+
+ if (nActPoint>=6 && rXPoly.IsControl(nActPoint-4)) {
+ rXPoly.CalcTangent(nActPoint-3,nActPoint-4,nActPoint-2);
+ rXPoly.SetFlags(nActPoint-3,XPOLY_SMOOTH);
+ }
+ }
+ } else {
+ if (nActPoint==1 && IsBezier(pU->eAktKind) && !pU->bBezHasCtrl0) {
+ pU->aBezControl0=rStat.GetNow();;
+ pU->bBezHasCtrl0=sal_True;
+ nActPoint--;
+ }
+ if (pU->IsFormFlag()) {
+ sal_uInt16 nPtAnz0=rXPoly.GetPointCount();
+ rXPoly.Remove(nActPoint-1,2); // die letzten beiden Punkte entfernen und durch die Form ersetzen
+ rXPoly.Insert(XPOLY_APPEND,pU->GetFormPoly());
+ sal_uInt16 nPtAnz1=rXPoly.GetPointCount();
+ for (sal_uInt16 i=nPtAnz0+1; i<nPtAnz1-1; i++) { // Damit BckAction richtig funktioniert
+ if (!rXPoly.IsControl(i)) rStat.NextPoint();
+ }
+ nActPoint=rXPoly.GetPointCount()-1;
+ }
+ }
+ nActPoint++;
+ rXPoly[nActPoint]=rStat.GetNow();
+ }
+ if (eCmd==SDRCREATE_NEXTOBJECT) {
+ if (rXPoly.GetPointCount()>=2) {
+ pU->bBezHasCtrl0=sal_False;
+ // nur einzelnes Polygon kann offen sein, deshalb schliessen
+ rXPoly[nActPoint]=rXPoly[0];
+ XPolygon aXP;
+ aXP[0]=rStat.GetNow();
+ aPathPolygon.Insert(aXP);
+ }
+ }
+ }
+
+ sal_uInt16 nPolyAnz=aPathPolygon.Count();
+ if (nPolyAnz!=0) {
+ // den letzten Punkt ggf. wieder loeschen
+ if (eCmd==SDRCREATE_FORCEEND) {
+ XPolygon& rXP=aPathPolygon[nPolyAnz-1];
+ sal_uInt16 nPtAnz=rXP.GetPointCount();
+ if (nPtAnz>=2) {
+ if (!rXP.IsControl(nPtAnz-2)) {
+ if (rXP[nPtAnz-1]==rXP[nPtAnz-2]) {
+ rXP.Remove(nPtAnz-1,1);
+ }
+ } else {
+ if (rXP[nPtAnz-3]==rXP[nPtAnz-2]) {
+ rXP.Remove(nPtAnz-3,3);
+ }
+ }
+ }
+ }
+ for (sal_uInt16 nPolyNum=nPolyAnz; nPolyNum>0;) {
+ nPolyNum--;
+ XPolygon& rXP=aPathPolygon[nPolyNum];
+ sal_uInt16 nPtAnz=rXP.GetPointCount();
+ // Polygone mit zu wenig Punkten werden geloescht
+ if (nPolyNum<nPolyAnz-1 || eCmd==SDRCREATE_FORCEEND) {
+ if (nPtAnz<2) aPathPolygon.Remove(nPolyNum);
+ }
+ }
+ }
+ pU->ResetFormFlags();
+ bRet=eCmd==SDRCREATE_FORCEEND;
+ if (bRet) {
+ mbCreating=sal_False;
+ delete pU;
+ rStat.SetUser(NULL);
+ }
+ return bRet;
+}
+
+FASTBOOL ImpPathForDragAndCreate::BckCreate(SdrDragStat& rStat)
+{
+ ImpPathCreateUser* pU=(ImpPathCreateUser*)rStat.GetUser();
+ if (aPathPolygon.Count()>0) {
+ XPolygon& rXPoly=aPathPolygon[aPathPolygon.Count()-1];
+ sal_uInt16 nActPoint=rXPoly.GetPointCount();
+ if (nActPoint>0) {
+ nActPoint--;
+ // Das letzte Stueck einer Bezierkurve wird erstmal zu 'ner Linie
+ rXPoly.Remove(nActPoint,1);
+ if (nActPoint>=3 && rXPoly.IsControl(nActPoint-1)) {
+ // Beziersegment am Ende sollte zwar nicht vorkommen, aber falls doch ...
+ rXPoly.Remove(nActPoint-1,1);
+ if (rXPoly.IsControl(nActPoint-2)) rXPoly.Remove(nActPoint-2,1);
+ }
+ }
+ nActPoint=rXPoly.GetPointCount();
+ if (nActPoint>=4) { // Kein Beziersegment am Ende
+ nActPoint--;
+ if (rXPoly.IsControl(nActPoint-1)) {
+ rXPoly.Remove(nActPoint-1,1);
+ if (rXPoly.IsControl(nActPoint-2)) rXPoly.Remove(nActPoint-2,1);
+ }
+ }
+ if (rXPoly.GetPointCount()<2) {
+ aPathPolygon.Remove(aPathPolygon.Count()-1);
+ }
+ if (aPathPolygon.Count()>0) {
+ XPolygon& rLocalXPoly=aPathPolygon[aPathPolygon.Count()-1];
+ sal_uInt16 nLocalActPoint=rLocalXPoly.GetPointCount();
+ if (nLocalActPoint>0) {
+ nLocalActPoint--;
+ rLocalXPoly[nLocalActPoint]=rStat.Now();
+ }
+ }
+ }
+ pU->ResetFormFlags();
+ return aPathPolygon.Count()!=0;
+}
+
+void ImpPathForDragAndCreate::BrkCreate(SdrDragStat& rStat)
+{
+ ImpPathCreateUser* pU=(ImpPathCreateUser*)rStat.GetUser();
+ aPathPolygon.Clear();
+ mbCreating=sal_False;
+ delete pU;
+ rStat.SetUser(NULL);
+}
+
+basegfx::B2DPolyPolygon ImpPathForDragAndCreate::TakeObjectPolyPolygon(const SdrDragStat& rDrag) const
+{
+ basegfx::B2DPolyPolygon aRetval(aPathPolygon.getB2DPolyPolygon());
+ SdrView* pView = rDrag.GetView();
+
+ if(pView && pView->IsUseIncompatiblePathCreateInterface())
+ return aRetval;
+
+ ImpPathCreateUser* pU = (ImpPathCreateUser*)rDrag.GetUser();
+ basegfx::B2DPolygon aNewPolygon(aRetval.count() ? aRetval.getB2DPolygon(aRetval.count() - 1L) : basegfx::B2DPolygon());
+
+ if(pU->IsFormFlag() && aNewPolygon.count() > 1L)
+ {
+ // remove last segment and replace with current
+ // do not forget to rescue the previous control point which will be lost when
+ // the point it's associated with is removed
+ const sal_uInt32 nChangeIndex(aNewPolygon.count() - 2);
+ const basegfx::B2DPoint aSavedPrevCtrlPoint(aNewPolygon.getPrevControlPoint(nChangeIndex));
+
+ aNewPolygon.remove(nChangeIndex, 2L);
+ aNewPolygon.append(pU->GetFormPoly().getB2DPolygon());
+
+ if(nChangeIndex < aNewPolygon.count())
+ {
+ // if really something was added, set the saved prev control point at the
+ // point where it belongs
+ aNewPolygon.setPrevControlPoint(nChangeIndex, aSavedPrevCtrlPoint);
+ }
+ }
+
+ if(aRetval.count())
+ {
+ aRetval.setB2DPolygon(aRetval.count() - 1L, aNewPolygon);
+ }
+ else
+ {
+ aRetval.append(aNewPolygon);
+ }
+
+ return aRetval;
+}
+
+basegfx::B2DPolyPolygon ImpPathForDragAndCreate::TakeDragPolyPolygon(const SdrDragStat& rDrag) const
+{
+ basegfx::B2DPolyPolygon aRetval;
+ SdrView* pView = rDrag.GetView();
+
+ if(pView && pView->IsUseIncompatiblePathCreateInterface())
+ return aRetval;
+
+ ImpPathCreateUser* pU = (ImpPathCreateUser*)rDrag.GetUser();
+
+ if(pU && pU->bBezier && rDrag.IsMouseDown())
+ {
+ // no more XOR, no need for complicated helplines
+ basegfx::B2DPolygon aHelpline;
+ aHelpline.append(basegfx::B2DPoint(pU->aBezCtrl2.X(), pU->aBezCtrl2.Y()));
+ aHelpline.append(basegfx::B2DPoint(pU->aBezEnd.X(), pU->aBezEnd.Y()));
+ aRetval.append(aHelpline);
+ }
+
+ return aRetval;
+}
+
+Pointer ImpPathForDragAndCreate::GetCreatePointer() const
+{
+ switch (meObjectKind) {
+ case OBJ_LINE : return Pointer(POINTER_DRAW_LINE);
+ case OBJ_POLY : return Pointer(POINTER_DRAW_POLYGON);
+ case OBJ_PLIN : return Pointer(POINTER_DRAW_POLYGON);
+ case OBJ_PATHLINE: return Pointer(POINTER_DRAW_BEZIER);
+ case OBJ_PATHFILL: return Pointer(POINTER_DRAW_BEZIER);
+ case OBJ_FREELINE: return Pointer(POINTER_DRAW_FREEHAND);
+ case OBJ_FREEFILL: return Pointer(POINTER_DRAW_FREEHAND);
+ case OBJ_SPLNLINE: return Pointer(POINTER_DRAW_FREEHAND);
+ case OBJ_SPLNFILL: return Pointer(POINTER_DRAW_FREEHAND);
+ case OBJ_PATHPOLY: return Pointer(POINTER_DRAW_POLYGON);
+ case OBJ_PATHPLIN: return Pointer(POINTER_DRAW_POLYGON);
+ default: break;
+ } // switch
+ return Pointer(POINTER_CROSS);
+}
+
+/*************************************************************************/
+
+SdrPathObjGeoData::SdrPathObjGeoData()
+{
+}
+
+SdrPathObjGeoData::~SdrPathObjGeoData()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// DrawContact section
+
+sdr::contact::ViewContact* SdrPathObj::CreateObjectSpecificViewContact()
+{
+ return new sdr::contact::ViewContactOfSdrPathObj(*this);
+}
+
+/*************************************************************************/
+
+TYPEINIT1(SdrPathObj,SdrTextObj);
+
+SdrPathObj::SdrPathObj(SdrObjKind eNewKind)
+: meKind(eNewKind),
+ mpDAC(0L)
+{
+ bClosedObj = IsClosed();
+}
+
+SdrPathObj::SdrPathObj(SdrObjKind eNewKind, const basegfx::B2DPolyPolygon& rPathPoly)
+: maPathPolygon(rPathPoly),
+ meKind(eNewKind),
+ mpDAC(0L)
+{
+ bClosedObj = IsClosed();
+ ImpForceKind();
+}
+
+SdrPathObj::~SdrPathObj()
+{
+ impDeleteDAC();
+}
+
+sal_Bool ImpIsLine(const basegfx::B2DPolyPolygon& rPolyPolygon)
+{
+ return (1L == rPolyPolygon.count() && 2L == rPolyPolygon.getB2DPolygon(0L).count());
+}
+
+Rectangle ImpGetBoundRect(const basegfx::B2DPolyPolygon& rPolyPolygon)
+{
+ basegfx::B2DRange aRange(basegfx::tools::getRange(rPolyPolygon));
+
+ return Rectangle(
+ FRound(aRange.getMinX()), FRound(aRange.getMinY()),
+ FRound(aRange.getMaxX()), FRound(aRange.getMaxY()));
+}
+
+void SdrPathObj::ImpForceLineWink()
+{
+ if(OBJ_LINE == meKind && ImpIsLine(GetPathPoly()))
+ {
+ const basegfx::B2DPolygon aPoly(GetPathPoly().getB2DPolygon(0L));
+ const basegfx::B2DPoint aB2DPoint0(aPoly.getB2DPoint(0L));
+ const basegfx::B2DPoint aB2DPoint1(aPoly.getB2DPoint(1L));
+ const Point aPoint0(FRound(aB2DPoint0.getX()), FRound(aB2DPoint0.getY()));
+ const Point aPoint1(FRound(aB2DPoint1.getX()), FRound(aB2DPoint1.getY()));
+ const Point aDelt(aPoint1 - aPoint0);
+
+ aGeo.nDrehWink=GetAngle(aDelt);
+ aGeo.nShearWink=0;
+ aGeo.RecalcSinCos();
+ aGeo.RecalcTan();
+
+ // #101412# for SdrTextObj, keep aRect up to date
+ aRect = Rectangle(aPoint0, aPoint1);
+ aRect.Justify();
+ }
+}
+
+void SdrPathObj::ImpForceKind()
+{
+ if (meKind==OBJ_PATHPLIN) meKind=OBJ_PLIN;
+ if (meKind==OBJ_PATHPOLY) meKind=OBJ_POLY;
+
+ if(GetPathPoly().areControlPointsUsed())
+ {
+ switch (meKind)
+ {
+ case OBJ_LINE: meKind=OBJ_PATHLINE; break;
+ case OBJ_PLIN: meKind=OBJ_PATHLINE; break;
+ case OBJ_POLY: meKind=OBJ_PATHFILL; break;
+ default: break;
+ }
+ }
+ else
+ {
+ switch (meKind)
+ {
+ case OBJ_PATHLINE: meKind=OBJ_PLIN; break;
+ case OBJ_FREELINE: meKind=OBJ_PLIN; break;
+ case OBJ_PATHFILL: meKind=OBJ_POLY; break;
+ case OBJ_FREEFILL: meKind=OBJ_POLY; break;
+ default: break;
+ }
+ }
+
+ if (meKind==OBJ_LINE && !ImpIsLine(GetPathPoly())) meKind=OBJ_PLIN;
+ if (meKind==OBJ_PLIN && ImpIsLine(GetPathPoly())) meKind=OBJ_LINE;
+
+ bClosedObj=IsClosed();
+
+ if (meKind==OBJ_LINE)
+ {
+ ImpForceLineWink();
+ }
+ else
+ {
+ // #i10659#, similar to #101412# but for polys with more than 2 points.
+ //
+ // Here i again need to fix something, because when Path-Polys are Copy-Pasted
+ // between Apps with different measurements (e.g. 100TH_MM and TWIPS) there is
+ // a scaling loop started from SdrExchangeView::Paste. This is principally nothing
+ // wrong, but aRect is wrong here and not even updated by RecalcSnapRect(). If
+ // this is the case, some size needs to be set here in aRect to avoid that the cyclus
+ // through Rect2Poly - Poly2Rect does something badly wrong since that cycle is
+ // BASED on aRect. That cycle is triggered in SdrTextObj::NbcResize() which is called
+ // from the local Resize() implementation.
+ //
+ // Basic problem is that the member aRect in SdrTextObj basically is a unrotated
+ // text rectangle for the text object itself and methods at SdrTextObj do handle it
+ // in that way. Many draw objects derived from SdrTextObj 'abuse' aRect as SnapRect
+ // which is basically wrong. To make the SdrText methods which deal with aRect directly
+ // work it is necessary to always keep aRect updated. This e.g. not done after a Clone()
+ // command for SdrPathObj. Since adding this update mechanism with #101412# to
+ // ImpForceLineWink() for lines was very successful, i add it to where ImpForceLineWink()
+ // was called, once here below and once on a 2nd place below.
+
+ // #i10659# for SdrTextObj, keep aRect up to date
+ if(GetPathPoly().count())
+ {
+ aRect = ImpGetBoundRect(GetPathPoly());
+ }
+ }
+
+ // #i75974# adapt polygon state to object type. This may include a reinterpretation
+ // of a closed geometry as open one, but with identical first and last point
+ for(sal_uInt32 a(0); a < maPathPolygon.count(); a++)
+ {
+ basegfx::B2DPolygon aCandidate(maPathPolygon.getB2DPolygon(a));
+
+ if((bool)IsClosed() != aCandidate.isClosed())
+ {
+ // #i80213# really change polygon geometry; else e.g. the last point which
+ // needs to be identical with the first one will be missing when opening
+ // due to OBJ_PATH type
+ if(aCandidate.isClosed())
+ {
+ basegfx::tools::openWithGeometryChange(aCandidate);
+ }
+ else
+ {
+ basegfx::tools::closeWithGeometryChange(aCandidate);
+ }
+
+ maPathPolygon.setB2DPolygon(a, aCandidate);
+ }
+ }
+}
+
+void SdrPathObj::ImpSetClosed(sal_Bool bClose)
+{
+ if(bClose)
+ {
+ switch (meKind)
+ {
+ case OBJ_LINE : meKind=OBJ_POLY; break;
+ case OBJ_PLIN : meKind=OBJ_POLY; break;
+ case OBJ_PATHLINE: meKind=OBJ_PATHFILL; break;
+ case OBJ_FREELINE: meKind=OBJ_FREEFILL; break;
+ case OBJ_SPLNLINE: meKind=OBJ_SPLNFILL; break;
+ default: break;
+ }
+
+ bClosedObj = sal_True;
+ }
+ else
+ {
+ switch (meKind)
+ {
+ case OBJ_POLY : meKind=OBJ_PLIN; break;
+ case OBJ_PATHFILL: meKind=OBJ_PATHLINE; break;
+ case OBJ_FREEFILL: meKind=OBJ_FREELINE; break;
+ case OBJ_SPLNFILL: meKind=OBJ_SPLNLINE; break;
+ default: break;
+ }
+
+ bClosedObj = sal_False;
+ }
+
+ ImpForceKind();
+}
+
+void SdrPathObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
+{
+ rInfo.bNoContortion=sal_False;
+
+ FASTBOOL bCanConv = !HasText() || ImpCanConvTextToCurve();
+ FASTBOOL bIsPath = IsBezier() || IsSpline();
+
+ rInfo.bEdgeRadiusAllowed = sal_False;
+ rInfo.bCanConvToPath = bCanConv && !bIsPath;
+ rInfo.bCanConvToPoly = bCanConv && bIsPath;
+ rInfo.bCanConvToContour = !IsFontwork() && (rInfo.bCanConvToPoly || LineGeometryUsageIsNecessary());
+}
+
+sal_uInt16 SdrPathObj::GetObjIdentifier() const
+{
+ return sal_uInt16(meKind);
+}
+
+void SdrPathObj::operator=(const SdrObject& rObj)
+{
+ SdrTextObj::operator=(rObj);
+ SdrPathObj& rPath=(SdrPathObj&)rObj;
+ maPathPolygon=rPath.GetPathPoly();
+}
+
+void SdrPathObj::TakeObjNameSingul(XubString& rName) const
+{
+ if(OBJ_LINE == meKind)
+ {
+ sal_uInt16 nId(STR_ObjNameSingulLINE);
+
+ if(ImpIsLine(GetPathPoly()))
+ {
+ const basegfx::B2DPolygon aPoly(GetPathPoly().getB2DPolygon(0L));
+ const basegfx::B2DPoint aB2DPoint0(aPoly.getB2DPoint(0L));
+ const basegfx::B2DPoint aB2DPoint1(aPoly.getB2DPoint(1L));
+ const Point aPoint0(FRound(aB2DPoint0.getX()), FRound(aB2DPoint0.getY()));
+ const Point aPoint1(FRound(aB2DPoint0.getX()), FRound(aB2DPoint0.getY()));
+
+ if(aB2DPoint0 != aB2DPoint1)
+ {
+ if(aB2DPoint0.getY() == aB2DPoint1.getY())
+ {
+ nId = STR_ObjNameSingulLINE_Hori;
+ }
+ else if(aB2DPoint0.getX() == aB2DPoint1.getX())
+ {
+ nId = STR_ObjNameSingulLINE_Vert;
+ }
+ else
+ {
+ const double fDx(fabs(aB2DPoint0.getX() - aB2DPoint1.getX()));
+ const double fDy(fabs(aB2DPoint0.getY() - aB2DPoint1.getY()));
+
+ if(fDx == fDy)
+ {
+ nId = STR_ObjNameSingulLINE_Diag;
+ }
+ }
+ }
+ }
+
+ rName = ImpGetResStr(nId);
+ }
+ else if(OBJ_PLIN == meKind || OBJ_POLY == meKind)
+ {
+ const sal_Bool bClosed(OBJ_POLY == meKind);
+ sal_uInt16 nId(0);
+
+ if(mpDAC && mpDAC->IsCreating())
+ {
+ if(bClosed)
+ {
+ nId = STR_ObjNameSingulPOLY;
+ }
+ else
+ {
+ nId = STR_ObjNameSingulPLIN;
+ }
+
+ rName = ImpGetResStr(nId);
+ }
+ else
+ {
+ // get point count
+ sal_uInt32 nPointCount(0L);
+ const sal_uInt32 nPolyCount(GetPathPoly().count());
+
+ for(sal_uInt32 a(0L); a < nPolyCount; a++)
+ {
+ nPointCount += GetPathPoly().getB2DPolygon(a).count();
+ }
+
+ if(bClosed)
+ {
+ nId = STR_ObjNameSingulPOLY_PntAnz;
+ }
+ else
+ {
+ nId = STR_ObjNameSingulPLIN_PntAnz;
+ }
+
+ rName = ImpGetResStr(nId);
+ sal_uInt16 nPos(rName.SearchAscii("%2")); // #i96537#
+
+ if(STRING_NOTFOUND != nPos)
+ {
+ rName.Erase(nPos, 2);
+ rName.Insert(UniString::CreateFromInt32(nPointCount), nPos);
+ }
+ }
+ }
+ else
+ {
+ switch (meKind)
+ {
+ case OBJ_PATHLINE: rName=ImpGetResStr(STR_ObjNameSingulPATHLINE); break;
+ case OBJ_FREELINE: rName=ImpGetResStr(STR_ObjNameSingulFREELINE); break;
+ case OBJ_SPLNLINE: rName=ImpGetResStr(STR_ObjNameSingulNATSPLN); break;
+ case OBJ_PATHFILL: rName=ImpGetResStr(STR_ObjNameSingulPATHFILL); break;
+ case OBJ_FREEFILL: rName=ImpGetResStr(STR_ObjNameSingulFREEFILL); break;
+ case OBJ_SPLNFILL: rName=ImpGetResStr(STR_ObjNameSingulPERSPLN); break;
+ default: break;
+ }
+ }
+
+ String aName(GetName());
+ if(aName.Len())
+ {
+ rName += sal_Unicode(' ');
+ rName += sal_Unicode('\'');
+ rName += aName;
+ rName += sal_Unicode('\'');
+ }
+}
+
+void SdrPathObj::TakeObjNamePlural(XubString& rName) const
+{
+ switch(meKind)
+ {
+ case OBJ_LINE : rName=ImpGetResStr(STR_ObjNamePluralLINE ); break;
+ case OBJ_PLIN : rName=ImpGetResStr(STR_ObjNamePluralPLIN ); break;
+ case OBJ_POLY : rName=ImpGetResStr(STR_ObjNamePluralPOLY ); break;
+ case OBJ_PATHLINE: rName=ImpGetResStr(STR_ObjNamePluralPATHLINE); break;
+ case OBJ_FREELINE: rName=ImpGetResStr(STR_ObjNamePluralFREELINE); break;
+ case OBJ_SPLNLINE: rName=ImpGetResStr(STR_ObjNamePluralNATSPLN); break;
+ case OBJ_PATHFILL: rName=ImpGetResStr(STR_ObjNamePluralPATHFILL); break;
+ case OBJ_FREEFILL: rName=ImpGetResStr(STR_ObjNamePluralFREEFILL); break;
+ case OBJ_SPLNFILL: rName=ImpGetResStr(STR_ObjNamePluralPERSPLN); break;
+ default: break;
+ }
+}
+
+basegfx::B2DPolyPolygon SdrPathObj::TakeXorPoly() const
+{
+ return GetPathPoly();
+}
+
+sal_uInt32 SdrPathObj::GetHdlCount() const
+{
+ sal_uInt32 nRetval(0L);
+ const sal_uInt32 nPolyCount(GetPathPoly().count());
+
+ for(sal_uInt32 a(0L); a < nPolyCount; a++)
+ {
+ nRetval += GetPathPoly().getB2DPolygon(a).count();
+ }
+
+ return nRetval;
+}
+
+SdrHdl* SdrPathObj::GetHdl(sal_uInt32 nHdlNum) const
+{
+ // #i73248#
+ // Warn the user that this is ineffective and show alternatives. Should not be used at all.
+ OSL_ENSURE(false, "SdrPathObj::GetHdl(): ineffective, use AddToHdlList instead (!)");
+
+ // to have an alternative, get single handle using the ineffective way
+ SdrHdl* pRetval = 0;
+ SdrHdlList aLocalList(0);
+ AddToHdlList(aLocalList);
+ const sal_uInt32 nHdlCount(aLocalList.GetHdlCount());
+
+ if(nHdlCount && nHdlNum < nHdlCount)
+ {
+ // remove and remember. The other created handles will be deleted again with the
+ // destruction of the local list
+ pRetval = aLocalList.RemoveHdl(nHdlNum);
+ }
+
+ return pRetval;
+}
+
+void SdrPathObj::AddToHdlList(SdrHdlList& rHdlList) const
+{
+ // keep old stuff to be able to keep old SdrHdl stuff, too
+ const XPolyPolygon aOldPathPolygon(GetPathPoly());
+ sal_uInt16 nPolyCnt=aOldPathPolygon.Count();
+ FASTBOOL bClosed=IsClosed();
+ sal_uInt16 nIdx=0;
+
+ for (sal_uInt16 i=0; i<nPolyCnt; i++) {
+ const XPolygon& rXPoly=aOldPathPolygon.GetObject(i);
+ sal_uInt16 nPntCnt=rXPoly.GetPointCount();
+ if (bClosed && nPntCnt>1) nPntCnt--;
+
+ for (sal_uInt16 j=0; j<nPntCnt; j++) {
+ if (rXPoly.GetFlags(j)!=XPOLY_CONTROL) {
+ const Point& rPnt=rXPoly[j];
+ SdrHdl* pHdl=new SdrHdl(rPnt,HDL_POLY);
+ pHdl->SetPolyNum(i);
+ pHdl->SetPointNum(j);
+ pHdl->Set1PixMore(j==0);
+ pHdl->SetSourceHdlNum(nIdx);
+ nIdx++;
+ rHdlList.AddHdl(pHdl);
+ }
+ }
+ }
+}
+
+sal_uInt32 SdrPathObj::GetPlusHdlCount(const SdrHdl& rHdl) const
+{
+ // keep old stuff to be able to keep old SdrHdl stuff, too
+ const XPolyPolygon aOldPathPolygon(GetPathPoly());
+ sal_uInt16 nCnt = 0;
+ sal_uInt16 nPnt = (sal_uInt16)rHdl.GetPointNum();
+ sal_uInt16 nPolyNum = (sal_uInt16)rHdl.GetPolyNum();
+
+ if(nPolyNum < aOldPathPolygon.Count())
+ {
+ const XPolygon& rXPoly = aOldPathPolygon[nPolyNum];
+ sal_uInt16 nPntMax = rXPoly.GetPointCount();
+ if (nPntMax>0)
+ {
+ nPntMax--;
+ if (nPnt<=nPntMax)
+ {
+ if (rXPoly.GetFlags(nPnt)!=XPOLY_CONTROL)
+ {
+ if (nPnt==0 && IsClosed()) nPnt=nPntMax;
+ if (nPnt>0 && rXPoly.GetFlags(nPnt-1)==XPOLY_CONTROL) nCnt++;
+ if (nPnt==nPntMax && IsClosed()) nPnt=0;
+ if (nPnt<nPntMax && rXPoly.GetFlags(nPnt+1)==XPOLY_CONTROL) nCnt++;
+ }
+ }
+ }
+ }
+
+ return nCnt;
+}
+
+SdrHdl* SdrPathObj::GetPlusHdl(const SdrHdl& rHdl, sal_uInt32 nPlusNum) const
+{
+ // keep old stuff to be able to keep old SdrHdl stuff, too
+ const XPolyPolygon aOldPathPolygon(GetPathPoly());
+ SdrHdl* pHdl = 0L;
+ sal_uInt16 nPnt = (sal_uInt16)rHdl.GetPointNum();
+ sal_uInt16 nPolyNum = (sal_uInt16)rHdl.GetPolyNum();
+
+ if (nPolyNum<aOldPathPolygon.Count())
+ {
+ const XPolygon& rXPoly = aOldPathPolygon[nPolyNum];
+ sal_uInt16 nPntMax = rXPoly.GetPointCount();
+
+ if (nPntMax>0)
+ {
+ nPntMax--;
+ if (nPnt<=nPntMax)
+ {
+ pHdl=new SdrHdlBezWgt(&rHdl);
+ pHdl->SetPolyNum(rHdl.GetPolyNum());
+
+ if (nPnt==0 && IsClosed()) nPnt=nPntMax;
+ if (nPnt>0 && rXPoly.GetFlags(nPnt-1)==XPOLY_CONTROL && nPlusNum==0)
+ {
+ pHdl->SetPos(rXPoly[nPnt-1]);
+ pHdl->SetPointNum(nPnt-1);
+ }
+ else
+ {
+ if (nPnt==nPntMax && IsClosed()) nPnt=0;
+ if (nPnt<rXPoly.GetPointCount()-1 && rXPoly.GetFlags(nPnt+1)==XPOLY_CONTROL)
+ {
+ pHdl->SetPos(rXPoly[nPnt+1]);
+ pHdl->SetPointNum(nPnt+1);
+ }
+ }
+
+ pHdl->SetSourceHdlNum(rHdl.GetSourceHdlNum());
+ pHdl->SetPlusHdl(sal_True);
+ }
+ }
+ }
+ return pHdl;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+bool SdrPathObj::hasSpecialDrag() const
+{
+ return true;
+}
+
+bool SdrPathObj::beginSpecialDrag(SdrDragStat& rDrag) const
+{
+ ImpPathForDragAndCreate aDragAndCreate(*((SdrPathObj*)this));
+
+ return aDragAndCreate.beginPathDrag(rDrag);
+}
+
+bool SdrPathObj::applySpecialDrag(SdrDragStat& rDrag)
+{
+ ImpPathForDragAndCreate aDragAndCreate(*this);
+ bool bRetval(aDragAndCreate.beginPathDrag(rDrag));
+
+ if(bRetval)
+ {
+ bRetval = aDragAndCreate.movePathDrag(rDrag);
+ }
+
+ if(bRetval)
+ {
+ bRetval = aDragAndCreate.endPathDrag(rDrag);
+ }
+
+ if(bRetval)
+ {
+ NbcSetPathPoly(aDragAndCreate.getModifiedPolyPolygon());
+ }
+
+ return bRetval;
+}
+
+String SdrPathObj::getSpecialDragComment(const SdrDragStat& rDrag) const
+{
+ String aRetval;
+
+ if(mpDAC)
+ {
+ // #i103058# also get a comment when in creation
+ const bool bCreateComment(rDrag.GetView() && this == rDrag.GetView()->GetCreateObj());
+
+ if(bCreateComment)
+ {
+ aRetval = mpDAC->getSpecialDragComment(rDrag);
+ }
+ }
+ else
+ {
+ ImpPathForDragAndCreate aDragAndCreate(*((SdrPathObj*)this));
+ bool bDidWork(aDragAndCreate.beginPathDrag((SdrDragStat&)rDrag));
+
+ if(bDidWork)
+ {
+ aRetval = aDragAndCreate.getSpecialDragComment(rDrag);
+ }
+ }
+
+ return aRetval;
+}
+
+basegfx::B2DPolyPolygon SdrPathObj::getSpecialDragPoly(const SdrDragStat& rDrag) const
+{
+ basegfx::B2DPolyPolygon aRetval;
+ ImpPathForDragAndCreate aDragAndCreate(*((SdrPathObj*)this));
+ bool bDidWork(aDragAndCreate.beginPathDrag((SdrDragStat&)rDrag));
+
+ if(bDidWork)
+ {
+ aRetval = aDragAndCreate.getSpecialDragPoly(rDrag);
+ }
+
+ return aRetval;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+FASTBOOL SdrPathObj::BegCreate(SdrDragStat& rStat)
+{
+ impDeleteDAC();
+ return impGetDAC().BegCreate(rStat);
+}
+
+FASTBOOL SdrPathObj::MovCreate(SdrDragStat& rStat)
+{
+ return impGetDAC().MovCreate(rStat);
+}
+
+FASTBOOL SdrPathObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
+{
+ FASTBOOL bRetval(impGetDAC().EndCreate(rStat, eCmd));
+
+ if(bRetval && mpDAC)
+ {
+ SetPathPoly(mpDAC->getModifiedPolyPolygon());
+
+ // #i75974# Check for AutoClose feature. Moved here from ImpPathForDragAndCreate::EndCreate
+ // to be able to use the type-changing ImpSetClosed method
+ if(!IsClosedObj())
+ {
+ SdrView* pView = rStat.GetView();
+
+ if(pView && pView->IsAutoClosePolys() && !pView->IsUseIncompatiblePathCreateInterface())
+ {
+ OutputDevice* pOut = pView->GetFirstOutputDevice();
+
+ if(pOut)
+ {
+ if(GetPathPoly().count())
+ {
+ const basegfx::B2DPolygon aCandidate(GetPathPoly().getB2DPolygon(0));
+
+ if(aCandidate.count() > 2)
+ {
+ // check distance of first and last point
+ const sal_Int32 nCloseDist(pOut->PixelToLogic(Size(pView->GetAutoCloseDistPix(), 0)).Width());
+ const basegfx::B2DVector aDistVector(aCandidate.getB2DPoint(aCandidate.count() - 1) - aCandidate.getB2DPoint(0));
+
+ if(aDistVector.getLength() <= (double)nCloseDist)
+ {
+ // close it
+ ImpSetClosed(true);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ impDeleteDAC();
+ }
+
+ return bRetval;
+}
+
+FASTBOOL SdrPathObj::BckCreate(SdrDragStat& rStat)
+{
+ return impGetDAC().BckCreate(rStat);
+}
+
+void SdrPathObj::BrkCreate(SdrDragStat& rStat)
+{
+ impGetDAC().BrkCreate(rStat);
+ impDeleteDAC();
+}
+
+basegfx::B2DPolyPolygon SdrPathObj::TakeCreatePoly(const SdrDragStat& rDrag) const
+{
+ basegfx::B2DPolyPolygon aRetval;
+
+ if(mpDAC)
+ {
+ aRetval = mpDAC->TakeObjectPolyPolygon(rDrag);
+ aRetval.append(mpDAC->TakeDragPolyPolygon(rDrag));
+ }
+
+ return aRetval;
+}
+
+// during drag or create, allow accessing the so-far created/modified polyPolygon
+basegfx::B2DPolyPolygon SdrPathObj::getObjectPolyPolygon(const SdrDragStat& rDrag) const
+{
+ basegfx::B2DPolyPolygon aRetval;
+
+ if(mpDAC)
+ {
+ aRetval = mpDAC->TakeObjectPolyPolygon(rDrag);
+ }
+
+ return aRetval;
+}
+
+basegfx::B2DPolyPolygon SdrPathObj::getDragPolyPolygon(const SdrDragStat& rDrag) const
+{
+ basegfx::B2DPolyPolygon aRetval;
+
+ if(mpDAC)
+ {
+ aRetval = mpDAC->TakeDragPolyPolygon(rDrag);
+ }
+
+ return aRetval;
+}
+
+Pointer SdrPathObj::GetCreatePointer() const
+{
+ return impGetDAC().GetCreatePointer();
+}
+
+void SdrPathObj::NbcMove(const Size& rSiz)
+{
+ maPathPolygon.transform(basegfx::tools::createTranslateB2DHomMatrix(rSiz.Width(), rSiz.Height()));
+
+ // #i19871# first modify locally, then call parent (to get correct SnapRect with GluePoints)
+ SdrTextObj::NbcMove(rSiz);
+}
+
+void SdrPathObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+{
+ basegfx::B2DHomMatrix aTrans(basegfx::tools::createTranslateB2DHomMatrix(-rRef.X(), -rRef.Y()));
+ aTrans = basegfx::tools::createScaleTranslateB2DHomMatrix(
+ double(xFact), double(yFact), rRef.X(), rRef.Y()) * aTrans;
+ maPathPolygon.transform(aTrans);
+
+ // #i19871# first modify locally, then call parent (to get correct SnapRect with GluePoints)
+ SdrTextObj::NbcResize(rRef,xFact,yFact);
+}
+
+void SdrPathObj::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
+{
+ // Thank JOE, the angles are defined mirrored to the mathematical meanings
+ const basegfx::B2DHomMatrix aTrans(basegfx::tools::createRotateAroundPoint(rRef.X(), rRef.Y(), -nWink * nPi180));
+ maPathPolygon.transform(aTrans);
+
+ // #i19871# first modify locally, then call parent (to get correct SnapRect with GluePoints)
+ SdrTextObj::NbcRotate(rRef,nWink,sn,cs);
+}
+
+void SdrPathObj::NbcShear(const Point& rRefPnt, long nAngle, double fTan, FASTBOOL bVShear)
+{
+ basegfx::B2DHomMatrix aTrans(basegfx::tools::createTranslateB2DHomMatrix(-rRefPnt.X(), -rRefPnt.Y()));
+
+ if(bVShear)
+ {
+ // Thank JOE, the angles are defined mirrored to the mathematical meanings
+ aTrans.shearY(-fTan);
+ }
+ else
+ {
+ aTrans.shearX(-fTan);
+ }
+
+ aTrans.translate(rRefPnt.X(), rRefPnt.Y());
+ maPathPolygon.transform(aTrans);
+
+ // #i19871# first modify locally, then call parent (to get correct SnapRect with GluePoints)
+ SdrTextObj::NbcShear(rRefPnt,nAngle,fTan,bVShear);
+}
+
+void SdrPathObj::NbcMirror(const Point& rRefPnt1, const Point& rRefPnt2)
+{
+ const double fDiffX(rRefPnt2.X() - rRefPnt1.X());
+ const double fDiffY(rRefPnt2.Y() - rRefPnt1.Y());
+ const double fRot(atan2(fDiffY, fDiffX));
+ basegfx::B2DHomMatrix aTrans(basegfx::tools::createTranslateB2DHomMatrix(-rRefPnt1.X(), -rRefPnt1.Y()));
+ aTrans.rotate(-fRot);
+ aTrans.scale(1.0, -1.0);
+ aTrans.rotate(fRot);
+ aTrans.translate(rRefPnt1.X(), rRefPnt1.Y());
+ maPathPolygon.transform(aTrans);
+
+ // #97538# Do Joe's special handling for lines when mirroring, too
+ ImpForceKind();
+
+ // #i19871# first modify locally, then call parent (to get correct SnapRect with GluePoints)
+ SdrTextObj::NbcMirror(rRefPnt1,rRefPnt2);
+}
+
+void SdrPathObj::TakeUnrotatedSnapRect(Rectangle& rRect) const
+{
+ if(!aGeo.nDrehWink)
+ {
+ rRect = GetSnapRect();
+ }
+ else
+ {
+ XPolyPolygon aXPP(GetPathPoly());
+ RotateXPoly(aXPP,Point(),-aGeo.nSin,aGeo.nCos);
+ rRect=aXPP.GetBoundRect();
+ Point aTmp(rRect.TopLeft());
+ RotatePoint(aTmp,Point(),aGeo.nSin,aGeo.nCos);
+ aTmp-=rRect.TopLeft();
+ rRect.Move(aTmp.X(),aTmp.Y());
+ }
+}
+
+void SdrPathObj::RecalcSnapRect()
+{
+ if(GetPathPoly().count())
+ {
+ maSnapRect = ImpGetBoundRect(GetPathPoly());
+ }
+}
+
+void SdrPathObj::NbcSetSnapRect(const Rectangle& rRect)
+{
+ Rectangle aOld(GetSnapRect());
+
+ // #95736# Take RECT_EMPTY into account when calculating scale factors
+ long nMulX = (RECT_EMPTY == rRect.Right()) ? 0 : rRect.Right() - rRect.Left();
+
+ long nDivX = aOld.Right() - aOld.Left();
+
+ // #95736# Take RECT_EMPTY into account when calculating scale factors
+ long nMulY = (RECT_EMPTY == rRect.Bottom()) ? 0 : rRect.Bottom() - rRect.Top();
+
+ long nDivY = aOld.Bottom() - aOld.Top();
+ if ( nDivX == 0 ) { nMulX = 1; nDivX = 1; }
+ if ( nDivY == 0 ) { nMulY = 1; nDivY = 1; }
+ Fraction aX(nMulX,nDivX);
+ Fraction aY(nMulY,nDivY);
+ NbcResize(aOld.TopLeft(), aX, aY);
+ NbcMove(Size(rRect.Left() - aOld.Left(), rRect.Top() - aOld.Top()));
+}
+
+sal_uInt32 SdrPathObj::GetSnapPointCount() const
+{
+ return GetHdlCount();
+}
+
+Point SdrPathObj::GetSnapPoint(sal_uInt32 nSnapPnt) const
+{
+ sal_uInt32 nPoly,nPnt;
+ if(!PolyPolygonEditor::GetRelativePolyPoint(GetPathPoly(), nSnapPnt, nPoly, nPnt))
+ {
+ DBG_ASSERT(sal_False,"SdrPathObj::GetSnapPoint: Punkt nSnapPnt nicht vorhanden!");
+ }
+
+ const basegfx::B2DPoint aB2DPoint(GetPathPoly().getB2DPolygon(nPoly).getB2DPoint(nPnt));
+ return Point(FRound(aB2DPoint.getX()), FRound(aB2DPoint.getY()));
+}
+
+sal_Bool SdrPathObj::IsPolyObj() const
+{
+ return sal_True;
+}
+
+sal_uInt32 SdrPathObj::GetPointCount() const
+{
+ const sal_uInt32 nPolyCount(GetPathPoly().count());
+ sal_uInt32 nRetval(0L);
+
+ for(sal_uInt32 a(0L); a < nPolyCount; a++)
+ {
+ nRetval += GetPathPoly().getB2DPolygon(a).count();
+ }
+
+ return nRetval;
+}
+
+Point SdrPathObj::GetPoint(sal_uInt32 nHdlNum) const
+{
+ Point aRetval;
+ sal_uInt32 nPoly,nPnt;
+
+ if(PolyPolygonEditor::GetRelativePolyPoint(GetPathPoly(), nHdlNum, nPoly, nPnt))
+ {
+ const basegfx::B2DPolygon aPoly(GetPathPoly().getB2DPolygon(nPoly));
+ const basegfx::B2DPoint aPoint(aPoly.getB2DPoint(nPnt));
+ aRetval = Point(FRound(aPoint.getX()), FRound(aPoint.getY()));
+ }
+
+ return aRetval;
+}
+
+void SdrPathObj::NbcSetPoint(const Point& rPnt, sal_uInt32 nHdlNum)
+{
+ sal_uInt32 nPoly,nPnt;
+
+ if(PolyPolygonEditor::GetRelativePolyPoint(GetPathPoly(), nHdlNum, nPoly, nPnt))
+ {
+ basegfx::B2DPolygon aNewPolygon(GetPathPoly().getB2DPolygon(nPoly));
+ aNewPolygon.setB2DPoint(nPnt, basegfx::B2DPoint(rPnt.X(), rPnt.Y()));
+ maPathPolygon.setB2DPolygon(nPoly, aNewPolygon);
+
+ if(meKind==OBJ_LINE)
+ {
+ ImpForceLineWink();
+ }
+ else
+ {
+ if(GetPathPoly().count())
+ {
+ // #i10659# for SdrTextObj, keep aRect up to date
+ aRect = ImpGetBoundRect(GetPathPoly()); // fuer SdrTextObj#
+ }
+ }
+
+ SetRectsDirty();
+ }
+}
+
+sal_uInt32 SdrPathObj::NbcInsPointOld(const Point& rPos, sal_Bool bNewObj, sal_Bool bHideHim)
+{
+ sal_uInt32 nNewHdl;
+
+ if(bNewObj)
+ {
+ nNewHdl = NbcInsPoint(0L, rPos, sal_True, bHideHim);
+ }
+ else
+ {
+ // look for smallest distance data
+ const basegfx::B2DPoint aTestPoint(rPos.X(), rPos.Y());
+ sal_uInt32 nSmallestPolyIndex(0L);
+ sal_uInt32 nSmallestEdgeIndex(0L);
+ double fSmallestCut;
+ basegfx::tools::getSmallestDistancePointToPolyPolygon(GetPathPoly(), aTestPoint, nSmallestPolyIndex, nSmallestEdgeIndex, fSmallestCut);
+
+ // create old polygon index from it
+ sal_uInt32 nPolyIndex(nSmallestEdgeIndex);
+
+ for(sal_uInt32 a(0L); a < nSmallestPolyIndex; a++)
+ {
+ nPolyIndex += GetPathPoly().getB2DPolygon(a).count();
+ }
+
+ nNewHdl = NbcInsPoint(nPolyIndex, rPos, sal_False, bHideHim);
+ }
+
+ ImpForceKind();
+ return nNewHdl;
+}
+
+sal_uInt32 SdrPathObj::NbcInsPoint(sal_uInt32 /*nHdlNum*/, const Point& rPos, sal_Bool bNewObj, sal_Bool /*bHideHim*/)
+{
+ sal_uInt32 nNewHdl;
+
+ if(bNewObj)
+ {
+ basegfx::B2DPolygon aNewPoly;
+ const basegfx::B2DPoint aPoint(rPos.X(), rPos.Y());
+ aNewPoly.append(aPoint);
+ aNewPoly.setClosed(IsClosed());
+ maPathPolygon.append(aNewPoly);
+ SetRectsDirty();
+ nNewHdl = GetHdlCount();
+ }
+ else
+ {
+ // look for smallest distance data
+ const basegfx::B2DPoint aTestPoint(rPos.X(), rPos.Y());
+ sal_uInt32 nSmallestPolyIndex(0L);
+ sal_uInt32 nSmallestEdgeIndex(0L);
+ double fSmallestCut;
+ basegfx::tools::getSmallestDistancePointToPolyPolygon(GetPathPoly(), aTestPoint, nSmallestPolyIndex, nSmallestEdgeIndex, fSmallestCut);
+ basegfx::B2DPolygon aCandidate(GetPathPoly().getB2DPolygon(nSmallestPolyIndex));
+ const bool bBefore(!aCandidate.isClosed() && 0L == nSmallestEdgeIndex && 0.0 == fSmallestCut);
+ const bool bAfter(!aCandidate.isClosed() && aCandidate.count() == nSmallestEdgeIndex + 2L && 1.0 == fSmallestCut);
+
+ if(bBefore)
+ {
+ // before first point
+ aCandidate.insert(0L, aTestPoint);
+
+ if(aCandidate.areControlPointsUsed())
+ {
+ if(aCandidate.isNextControlPointUsed(1))
+ {
+ aCandidate.setNextControlPoint(0, interpolate(aTestPoint, aCandidate.getB2DPoint(1), (1.0 / 3.0)));
+ aCandidate.setPrevControlPoint(1, interpolate(aTestPoint, aCandidate.getB2DPoint(1), (2.0 / 3.0)));
+ }
+ }
+
+ nNewHdl = 0L;
+ }
+ else if(bAfter)
+ {
+ // after last point
+ aCandidate.append(aTestPoint);
+
+ if(aCandidate.areControlPointsUsed())
+ {
+ if(aCandidate.isPrevControlPointUsed(aCandidate.count() - 2))
+ {
+ aCandidate.setNextControlPoint(aCandidate.count() - 2, interpolate(aCandidate.getB2DPoint(aCandidate.count() - 2), aTestPoint, (1.0 / 3.0)));
+ aCandidate.setPrevControlPoint(aCandidate.count() - 1, interpolate(aCandidate.getB2DPoint(aCandidate.count() - 2), aTestPoint, (2.0 / 3.0)));
+ }
+ }
+
+ nNewHdl = aCandidate.count() - 1L;
+ }
+ else
+ {
+ // in between
+ bool bSegmentSplit(false);
+ const sal_uInt32 nNextIndex((nSmallestEdgeIndex + 1) % aCandidate.count());
+
+ if(aCandidate.areControlPointsUsed())
+ {
+ if(aCandidate.isNextControlPointUsed(nSmallestEdgeIndex) || aCandidate.isPrevControlPointUsed(nNextIndex))
+ {
+ bSegmentSplit = true;
+ }
+ }
+
+ if(bSegmentSplit)
+ {
+ // rebuild original segment to get the split data
+ basegfx::B2DCubicBezier aBezierA, aBezierB;
+ const basegfx::B2DCubicBezier aBezier(
+ aCandidate.getB2DPoint(nSmallestEdgeIndex),
+ aCandidate.getNextControlPoint(nSmallestEdgeIndex),
+ aCandidate.getPrevControlPoint(nNextIndex),
+ aCandidate.getB2DPoint(nNextIndex));
+
+ // split and insert hit point
+ aBezier.split(fSmallestCut, &aBezierA, &aBezierB);
+ aCandidate.insert(nSmallestEdgeIndex + 1, aTestPoint);
+
+ // since we inserted hit point and not split point, we need to add an offset
+ // to the control points to get the C1 continuity we want to achieve
+ const basegfx::B2DVector aOffset(aTestPoint - aBezierA.getEndPoint());
+ aCandidate.setNextControlPoint(nSmallestEdgeIndex, aBezierA.getControlPointA() + aOffset);
+ aCandidate.setPrevControlPoint(nSmallestEdgeIndex + 1, aBezierA.getControlPointB() + aOffset);
+ aCandidate.setNextControlPoint(nSmallestEdgeIndex + 1, aBezierB.getControlPointA() + aOffset);
+ aCandidate.setPrevControlPoint((nSmallestEdgeIndex + 2) % aCandidate.count(), aBezierB.getControlPointB() + aOffset);
+ }
+ else
+ {
+ aCandidate.insert(nSmallestEdgeIndex + 1L, aTestPoint);
+ }
+
+ nNewHdl = nSmallestEdgeIndex + 1L;
+ }
+
+ maPathPolygon.setB2DPolygon(nSmallestPolyIndex, aCandidate);
+
+ // create old polygon index from it
+ for(sal_uInt32 a(0L); a < nSmallestPolyIndex; a++)
+ {
+ nNewHdl += GetPathPoly().getB2DPolygon(a).count();
+ }
+ }
+
+ ImpForceKind();
+ return nNewHdl;
+}
+
+SdrObject* SdrPathObj::RipPoint(sal_uInt32 nHdlNum, sal_uInt32& rNewPt0Index)
+{
+ SdrPathObj* pNewObj = 0L;
+ const basegfx::B2DPolyPolygon aLocalPolyPolygon(GetPathPoly());
+ sal_uInt32 nPoly, nPnt;
+
+ if(PolyPolygonEditor::GetRelativePolyPoint(aLocalPolyPolygon, nHdlNum, nPoly, nPnt))
+ {
+ if(0L == nPoly)
+ {
+ const basegfx::B2DPolygon aCandidate(aLocalPolyPolygon.getB2DPolygon(nPoly));
+ const sal_uInt32 nPointCount(aCandidate.count());
+
+ if(nPointCount)
+ {
+ if(IsClosed())
+ {
+ // when closed, RipPoint means to open the polygon at the selected point. To
+ // be able to do that, it is necessary to make the selected point the first one
+ basegfx::B2DPolygon aNewPolygon(basegfx::tools::makeStartPoint(aCandidate, nPnt));
+ SetPathPoly(basegfx::B2DPolyPolygon(aNewPolygon));
+ ToggleClosed();
+
+ // give back new position of old start point (historical reasons)
+ rNewPt0Index = (nPointCount - nPnt) % nPointCount;
+ }
+ else
+ {
+ if(nPointCount >= 3L && nPnt != 0L && nPnt + 1L < nPointCount)
+ {
+ // split in two objects at point nPnt
+ basegfx::B2DPolygon aSplitPolyA(aCandidate, 0L, nPnt + 1L);
+ SetPathPoly(basegfx::B2DPolyPolygon(aSplitPolyA));
+
+ pNewObj = (SdrPathObj*)Clone();
+ basegfx::B2DPolygon aSplitPolyB(aCandidate, nPnt, nPointCount - nPnt);
+ pNewObj->SetPathPoly(basegfx::B2DPolyPolygon(aSplitPolyB));
+ }
+ }
+ }
+ }
+ }
+
+ return pNewObj;
+}
+
+SdrObject* SdrPathObj::DoConvertToPolyObj(sal_Bool bBezier) const
+{
+ // #i89784# check for FontWork with activated HideContour
+ const drawinglayer::attribute::SdrTextAttribute aText(
+ drawinglayer::primitive2d::createNewSdrTextAttribute(GetObjectItemSet(), *getText(0)));
+ const bool bHideContour(
+ !aText.isDefault() && !aText.getSdrFormTextAttribute().isDefault() && aText.isHideContour());
+
+ SdrObject* pRet = bHideContour ?
+ 0 :
+ ImpConvertMakeObj(GetPathPoly(), IsClosed(), bBezier);
+
+ SdrPathObj* pPath = PTR_CAST(SdrPathObj, pRet);
+
+ if(pPath)
+ {
+ if(pPath->GetPathPoly().areControlPointsUsed())
+ {
+ if(!bBezier)
+ {
+ // reduce all bezier curves
+ pPath->SetPathPoly(basegfx::tools::adaptiveSubdivideByAngle(pPath->GetPathPoly()));
+ }
+ }
+ else
+ {
+ if(bBezier)
+ {
+ // create bezier curves
+ pPath->SetPathPoly(basegfx::tools::expandToCurve(pPath->GetPathPoly()));
+ }
+ }
+ }
+
+ pRet = ImpConvertAddText(pRet, bBezier);
+
+ return pRet;
+}
+
+SdrObjGeoData* SdrPathObj::NewGeoData() const
+{
+ return new SdrPathObjGeoData;
+}
+
+void SdrPathObj::SaveGeoData(SdrObjGeoData& rGeo) const
+{
+ SdrTextObj::SaveGeoData(rGeo);
+ SdrPathObjGeoData& rPGeo = (SdrPathObjGeoData&) rGeo;
+ rPGeo.maPathPolygon=GetPathPoly();
+ rPGeo.meKind=meKind;
+}
+
+void SdrPathObj::RestGeoData(const SdrObjGeoData& rGeo)
+{
+ SdrTextObj::RestGeoData(rGeo);
+ SdrPathObjGeoData& rPGeo=(SdrPathObjGeoData&)rGeo;
+ maPathPolygon=rPGeo.maPathPolygon;
+ meKind=rPGeo.meKind;
+ ImpForceKind(); // damit u.a. bClosed gesetzt wird
+}
+
+void SdrPathObj::NbcSetPathPoly(const basegfx::B2DPolyPolygon& rPathPoly)
+{
+ if(GetPathPoly() != rPathPoly)
+ {
+ maPathPolygon=rPathPoly;
+ ImpForceKind();
+ SetRectsDirty();
+ }
+}
+
+void SdrPathObj::SetPathPoly(const basegfx::B2DPolyPolygon& rPathPoly)
+{
+ if(GetPathPoly() != rPathPoly)
+ {
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ NbcSetPathPoly(rPathPoly);
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+ }
+}
+
+void SdrPathObj::ToggleClosed() // long nOpenDistance)
+{
+ Rectangle aBoundRect0;
+ if(pUserCall != NULL)
+ aBoundRect0 = GetLastBoundRect();
+ ImpSetClosed(!IsClosed()); // neuen ObjKind setzen
+ ImpForceKind(); // wg. Line->Poly->PolyLine statt Line->Poly->Line
+ SetRectsDirty();
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_RESIZE, aBoundRect0);
+}
+
+// fuer friend class SdrPolyEditView auf einigen Compilern:
+void SdrPathObj::SetRectsDirty(sal_Bool bNotMyself)
+{
+ SdrTextObj::SetRectsDirty(bNotMyself);
+}
+
+ImpPathForDragAndCreate& SdrPathObj::impGetDAC() const
+{
+ if(!mpDAC)
+ {
+ ((SdrPathObj*)this)->mpDAC = new ImpPathForDragAndCreate(*((SdrPathObj*)this));
+ }
+
+ return *mpDAC;
+}
+
+void SdrPathObj::impDeleteDAC() const
+{
+ if(mpDAC)
+ {
+ delete mpDAC;
+ ((SdrPathObj*)this)->mpDAC = 0L;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// transformation interface for StarOfficeAPI. This implements support for
+// homogen 3x3 matrices containing the transformation of the SdrObject. At the
+// moment it contains a shearX, rotation and translation, but for setting all linear
+// transforms like Scale, ShearX, ShearY, Rotate and Translate are supported.
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon
+// with the base geometry and returns TRUE. Otherwise it returns FALSE.
+sal_Bool SdrPathObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const
+{
+ double fRotate(0.0);
+ double fShearX(0.0);
+ basegfx::B2DTuple aScale(1.0, 1.0);
+ basegfx::B2DTuple aTranslate(0.0, 0.0);
+
+ if(GetPathPoly().count())
+ {
+ // copy geometry
+ basegfx::B2DHomMatrix aMoveToZeroMatrix;
+ rPolyPolygon = GetPathPoly();
+
+ if(OBJ_LINE == meKind)
+ {
+ // ignore shear and rotate, just use scale and translate
+ OSL_ENSURE(GetPathPoly().count() > 0L && GetPathPoly().getB2DPolygon(0L).count() > 1L, "OBJ_LINE with too less polygons (!)");
+ // #i72287# use polygon without control points for range calculation. Do not change rPolyPolygon
+ // itself, else this method will no longer return the full polygon information (curve will
+ // be lost)
+ const basegfx::B2DRange aPolyRangeNoCurve(basegfx::tools::getRange(rPolyPolygon));
+ aScale = aPolyRangeNoCurve.getRange();
+ aTranslate = aPolyRangeNoCurve.getMinimum();
+
+ // define matrix for move polygon to zero point
+ aMoveToZeroMatrix.translate(-aTranslate.getX(), -aTranslate.getY());
+ }
+ else
+ {
+ if(aGeo.nShearWink || aGeo.nDrehWink)
+ {
+ // get rotate and shear in drawingLayer notation
+ fRotate = aGeo.nDrehWink * F_PI18000;
+ fShearX = aGeo.nShearWink * F_PI18000;
+
+ // build mathematically correct (negative shear and rotate) object transform
+ // containing shear and rotate to extract unsheared, unrotated polygon
+ basegfx::B2DHomMatrix aObjectMatrix;
+ aObjectMatrix.shearX(tan((36000 - aGeo.nShearWink) * F_PI18000));
+ aObjectMatrix.rotate((36000 - aGeo.nDrehWink) * F_PI18000);
+
+ // create inverse from it and back-transform polygon
+ basegfx::B2DHomMatrix aInvObjectMatrix(aObjectMatrix);
+ aInvObjectMatrix.invert();
+ rPolyPolygon.transform(aInvObjectMatrix);
+
+ // get range from unsheared, unrotated polygon and extract scale and translate.
+ // transform topLeft from it back to transformed state to get original
+ // topLeft (rotation center)
+ // #i72287# use polygon without control points for range calculation. Do not change rPolyPolygon
+ // itself, else this method will no longer return the full polygon information (curve will
+ // be lost)
+ const basegfx::B2DRange aCorrectedRangeNoCurve(basegfx::tools::getRange(rPolyPolygon));
+ aTranslate = aObjectMatrix * aCorrectedRangeNoCurve.getMinimum();
+ aScale = aCorrectedRangeNoCurve.getRange();
+
+ // define matrix for move polygon to zero point
+ // #i112280# Added missing minus for Y-Translation
+ aMoveToZeroMatrix.translate(-aCorrectedRangeNoCurve.getMinX(), -aCorrectedRangeNoCurve.getMinY());
+ }
+ else
+ {
+ // get scale and translate from unsheared, unrotated polygon
+ // #i72287# use polygon without control points for range calculation. Do not change rPolyPolygon
+ // itself, else this method will no longer return the full polygon information (curve will
+ // be lost)
+ const basegfx::B2DRange aPolyRangeNoCurve(basegfx::tools::getRange(rPolyPolygon));
+ aScale = aPolyRangeNoCurve.getRange();
+ aTranslate = aPolyRangeNoCurve.getMinimum();
+
+ // define matrix for move polygon to zero point
+ aMoveToZeroMatrix.translate(-aTranslate.getX(), -aTranslate.getY());
+ }
+ }
+
+ // move polygon to zero point with pre-defined matrix
+ rPolyPolygon.transform(aMoveToZeroMatrix);
+ }
+
+ // position maybe relative to anchorpos, convert
+ if( pModel && pModel->IsWriter() )
+ {
+ if(GetAnchorPos().X() || GetAnchorPos().Y())
+ {
+ aTranslate -= basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
+ }
+ }
+
+ // force MapUnit to 100th mm
+ SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
+ if(eMapUnit != SFX_MAPUNIT_100TH_MM)
+ {
+ switch(eMapUnit)
+ {
+ case SFX_MAPUNIT_TWIP :
+ {
+ // postion
+ aTranslate.setX(ImplTwipsToMM(aTranslate.getX()));
+ aTranslate.setY(ImplTwipsToMM(aTranslate.getY()));
+
+ // size
+ aScale.setX(ImplTwipsToMM(aScale.getX()));
+ aScale.setY(ImplTwipsToMM(aScale.getY()));
+
+ // polygon
+ basegfx::B2DHomMatrix aTwipsToMM;
+ const double fFactorTwipsToMM(127.0 / 72.0);
+ aTwipsToMM.scale(fFactorTwipsToMM, fFactorTwipsToMM);
+ rPolyPolygon.transform(aTwipsToMM);
+
+ break;
+ }
+ default:
+ {
+ DBG_ERROR("TRGetBaseGeometry: Missing unit translation to 100th mm!");
+ }
+ }
+ }
+
+ // build return value matrix
+ rMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ aScale,
+ basegfx::fTools::equalZero(fShearX) ? 0.0 : tan(fShearX),
+ basegfx::fTools::equalZero(fRotate) ? 0.0 : -fRotate,
+ aTranslate);
+
+ return sal_True;
+}
+
+// sets the base geometry of the object using infos contained in the homogen 3x3 matrix.
+// If it's an SdrPathObj it will use the provided geometry information. The Polygon has
+// to use (0,0) as upper left and will be scaled to the given size in the matrix.
+void SdrPathObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon)
+{
+ // break up matrix
+ basegfx::B2DTuple aScale;
+ basegfx::B2DTuple aTranslate;
+ double fRotate, fShearX;
+ rMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
+
+ // #i75086# Old DrawingLayer (GeoStat and geometry) does not support holding negative scalings
+ // in X and Y which equal a 180 degree rotation. Recognize it and react accordingly
+ if(basegfx::fTools::less(aScale.getX(), 0.0) && basegfx::fTools::less(aScale.getY(), 0.0))
+ {
+ aScale.setX(fabs(aScale.getX()));
+ aScale.setY(fabs(aScale.getY()));
+ fRotate = fmod(fRotate + F_PI, F_2PI);
+ }
+
+ // copy poly
+ basegfx::B2DPolyPolygon aNewPolyPolygon(rPolyPolygon);
+
+ // reset object shear and rotations
+ aGeo.nDrehWink = 0;
+ aGeo.RecalcSinCos();
+ aGeo.nShearWink = 0;
+ aGeo.RecalcTan();
+
+ // force metric to pool metric
+ SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
+ if(eMapUnit != SFX_MAPUNIT_100TH_MM)
+ {
+ switch(eMapUnit)
+ {
+ case SFX_MAPUNIT_TWIP :
+ {
+ // position
+ aTranslate.setX(ImplMMToTwips(aTranslate.getX()));
+ aTranslate.setY(ImplMMToTwips(aTranslate.getY()));
+
+ // size
+ aScale.setX(ImplMMToTwips(aScale.getX()));
+ aScale.setY(ImplMMToTwips(aScale.getY()));
+
+ // polygon
+ basegfx::B2DHomMatrix aMMToTwips;
+ const double fFactorMMToTwips(72.0 / 127.0);
+ aMMToTwips.scale(fFactorMMToTwips, fFactorMMToTwips);
+ aNewPolyPolygon.transform(aMMToTwips);
+
+ break;
+ }
+ default:
+ {
+ DBG_ERROR("TRSetBaseGeometry: Missing unit translation to PoolMetric!");
+ }
+ }
+ }
+
+ if( pModel && pModel->IsWriter() )
+ {
+ // if anchor is used, make position relative to it
+ if(GetAnchorPos().X() || GetAnchorPos().Y())
+ {
+ aTranslate += basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
+ }
+ }
+
+ // create transformation for polygon, set values at aGeo direct
+ basegfx::B2DHomMatrix aTransform;
+
+ // #i75086#
+ // Given polygon is already scaled (for historical reasons), but not mirrored yet.
+ // Thus, when scale is negative in X or Y, apply the needed mirroring accordingly.
+ if(basegfx::fTools::less(aScale.getX(), 0.0) || basegfx::fTools::less(aScale.getY(), 0.0))
+ {
+ aTransform.scale(
+ basegfx::fTools::less(aScale.getX(), 0.0) ? -1.0 : 1.0,
+ basegfx::fTools::less(aScale.getY(), 0.0) ? -1.0 : 1.0);
+ }
+
+ if(!basegfx::fTools::equalZero(fShearX))
+ {
+ aTransform.shearX(tan(-atan(fShearX)));
+ aGeo.nShearWink = FRound(atan(fShearX) / F_PI18000);
+ aGeo.RecalcTan();
+ }
+
+ if(!basegfx::fTools::equalZero(fRotate))
+ {
+ // #i78696#
+ // fRotate is matematically correct for linear transformations, so it's
+ // the one to use for the geometry change
+ aTransform.rotate(fRotate);
+
+ // #i78696#
+ // fRotate is matematically correct, but aGeoStat.nDrehWink is
+ // mirrored -> mirror value here
+ aGeo.nDrehWink = NormAngle360(FRound(-fRotate / F_PI18000));
+ aGeo.RecalcSinCos();
+ }
+
+ if(!aTranslate.equalZero())
+ {
+ // #i39529# absolute positioning, so get current position (without control points (!))
+ const basegfx::B2DRange aCurrentRange(basegfx::tools::getRange(aNewPolyPolygon));
+ aTransform.translate(aTranslate.getX() - aCurrentRange.getMinX(), aTranslate.getY() - aCurrentRange.getMinY());
+ }
+
+ // transform polygon and trigger change
+ aNewPolyPolygon.transform(aTransform);
+ SetPathPoly(aNewPolyPolygon);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx
new file mode 100644
index 000000000000..c6202b825561
--- /dev/null
+++ b/svx/source/svdraw/svdorect.cxx
@@ -0,0 +1,620 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svdorect.hxx>
+#include <math.h>
+#include <stdlib.h>
+#include <svx/xpool.hxx>
+#include <svx/xpoly.hxx>
+#include <svx/svdattr.hxx>
+#include <svx/svdpool.hxx>
+#include <svx/svdtrans.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/svddrag.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdocapt.hxx> // fuer Import von SdrFileVersion 2
+#include <svx/svdpagv.hxx> // fuer
+#include <svx/svdview.hxx> // das
+#include <svx/svdundo.hxx> // Macro-Beispiel
+#include <svx/svdopath.hxx>
+#include "svx/svdglob.hxx" // Stringcache
+#include "svx/svdstr.hrc" // Objektname
+#include <svx/xflclit.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xlnwtit.hxx>
+#include "svdoimp.hxx"
+#include <svx/sdr/properties/rectangleproperties.hxx>
+#include <svx/sdr/contact/viewcontactofsdrrectobj.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// BaseProperties section
+
+sdr::properties::BaseProperties* SdrRectObj::CreateObjectSpecificProperties()
+{
+ return new sdr::properties::RectangleProperties(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// DrawContact section
+
+sdr::contact::ViewContact* SdrRectObj::CreateObjectSpecificViewContact()
+{
+ return new sdr::contact::ViewContactOfSdrRectObj(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(SdrRectObj,SdrTextObj);
+
+SdrRectObj::SdrRectObj()
+: mpXPoly(0L)
+{
+ bClosedObj=sal_True;
+}
+
+SdrRectObj::SdrRectObj(const Rectangle& rRect)
+: SdrTextObj(rRect),
+ mpXPoly(NULL)
+{
+ bClosedObj=sal_True;
+}
+
+SdrRectObj::SdrRectObj(SdrObjKind eNewTextKind)
+: SdrTextObj(eNewTextKind),
+ mpXPoly(NULL)
+{
+ DBG_ASSERT(eTextKind==OBJ_TEXT || eTextKind==OBJ_TEXTEXT ||
+ eTextKind==OBJ_OUTLINETEXT || eTextKind==OBJ_TITLETEXT,
+ "SdrRectObj::SdrRectObj(SdrObjKind) ist nur fuer Textrahmen gedacht");
+ bClosedObj=sal_True;
+}
+
+SdrRectObj::SdrRectObj(SdrObjKind eNewTextKind, const Rectangle& rRect)
+: SdrTextObj(eNewTextKind,rRect),
+ mpXPoly(NULL)
+{
+ DBG_ASSERT(eTextKind==OBJ_TEXT || eTextKind==OBJ_TEXTEXT ||
+ eTextKind==OBJ_OUTLINETEXT || eTextKind==OBJ_TITLETEXT,
+ "SdrRectObj::SdrRectObj(SdrObjKind,...) ist nur fuer Textrahmen gedacht");
+ bClosedObj=sal_True;
+}
+
+SdrRectObj::SdrRectObj(SdrObjKind eNewTextKind, const Rectangle& rNewRect, SvStream& rInput, const String& rBaseURL, sal_uInt16 eFormat)
+: SdrTextObj(eNewTextKind,rNewRect,rInput,rBaseURL,eFormat),
+ mpXPoly(NULL)
+{
+ DBG_ASSERT(eTextKind==OBJ_TEXT || eTextKind==OBJ_TEXTEXT ||
+ eTextKind==OBJ_OUTLINETEXT || eTextKind==OBJ_TITLETEXT,
+ "SdrRectObj::SdrRectObj(SdrObjKind,...) ist nur fuer Textrahmen gedacht");
+ bClosedObj=sal_True;
+}
+
+SdrRectObj::~SdrRectObj()
+{
+ if(mpXPoly)
+ {
+ delete mpXPoly;
+ }
+}
+
+void SdrRectObj::SetXPolyDirty()
+{
+ if(mpXPoly)
+ {
+ delete mpXPoly;
+ mpXPoly = 0L;
+ }
+}
+
+FASTBOOL SdrRectObj::PaintNeedsXPoly(long nEckRad) const
+{
+ FASTBOOL bNeed=aGeo.nDrehWink!=0 || aGeo.nShearWink!=0 || nEckRad!=0;
+ return bNeed;
+}
+
+XPolygon SdrRectObj::ImpCalcXPoly(const Rectangle& rRect1, long nRad1) const
+{
+ XPolygon aXPoly(rRect1,nRad1,nRad1);
+ const sal_uInt16 nPointAnz(aXPoly.GetPointCount());
+ XPolygon aNeuPoly(nPointAnz+1);
+ sal_uInt16 nShift=nPointAnz-2;
+ if (nRad1!=0) nShift=nPointAnz-5;
+ sal_uInt16 j=nShift;
+ for (sal_uInt16 i=1; i<nPointAnz; i++) {
+ aNeuPoly[i]=aXPoly[j];
+ aNeuPoly.SetFlags(i,aXPoly.GetFlags(j));
+ j++;
+ if (j>=nPointAnz) j=1;
+ }
+ aNeuPoly[0]=rRect1.BottomCenter();
+ aNeuPoly[nPointAnz]=aNeuPoly[0];
+ aXPoly=aNeuPoly;
+
+ // Die Winkelangaben beziehen sich immer auf die linke obere Ecke von !aRect!
+ if (aGeo.nShearWink!=0) ShearXPoly(aXPoly,aRect.TopLeft(),aGeo.nTan);
+ if (aGeo.nDrehWink!=0) RotateXPoly(aXPoly,aRect.TopLeft(),aGeo.nSin,aGeo.nCos);
+ return aXPoly;
+}
+
+void SdrRectObj::RecalcXPoly()
+{
+ mpXPoly = new XPolygon(ImpCalcXPoly(aRect,GetEckenradius()));
+}
+
+const XPolygon& SdrRectObj::GetXPoly() const
+{
+ if(!mpXPoly)
+ {
+ ((SdrRectObj*)this)->RecalcXPoly();
+ }
+
+ return *mpXPoly;
+}
+
+void SdrRectObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
+{
+ FASTBOOL bNoTextFrame=!IsTextFrame();
+ rInfo.bResizeFreeAllowed=bNoTextFrame || aGeo.nDrehWink%9000==0;
+ rInfo.bResizePropAllowed=sal_True;
+ rInfo.bRotateFreeAllowed=sal_True;
+ rInfo.bRotate90Allowed =sal_True;
+ rInfo.bMirrorFreeAllowed=bNoTextFrame;
+ rInfo.bMirror45Allowed =bNoTextFrame;
+ rInfo.bMirror90Allowed =bNoTextFrame;
+
+ // allow transparence
+ rInfo.bTransparenceAllowed = sal_True;
+
+ // gradient depends on fillstyle
+ XFillStyle eFillStyle = ((XFillStyleItem&)(GetObjectItem(XATTR_FILLSTYLE))).GetValue();
+ rInfo.bGradientAllowed = (eFillStyle == XFILL_GRADIENT);
+
+ rInfo.bShearAllowed =bNoTextFrame;
+ rInfo.bEdgeRadiusAllowed=sal_True;
+
+ FASTBOOL bCanConv=!HasText() || ImpCanConvTextToCurve();
+ if (bCanConv && !bNoTextFrame && !HasText()) {
+ bCanConv=HasFill() || HasLine();
+ }
+ rInfo.bCanConvToPath =bCanConv;
+ rInfo.bCanConvToPoly =bCanConv;
+ rInfo.bCanConvToContour = (rInfo.bCanConvToPoly || LineGeometryUsageIsNecessary());
+}
+
+sal_uInt16 SdrRectObj::GetObjIdentifier() const
+{
+ if (IsTextFrame()) return sal_uInt16(eTextKind);
+ else return sal_uInt16(OBJ_RECT);
+}
+
+void SdrRectObj::TakeUnrotatedSnapRect(Rectangle& rRect) const
+{
+ rRect=aRect;
+ if (aGeo.nShearWink!=0) {
+ long nDst=Round((aRect.Bottom()-aRect.Top())*aGeo.nTan);
+ if (aGeo.nShearWink>0) {
+ Point aRef(rRect.TopLeft());
+ rRect.Left()-=nDst;
+ Point aTmpPt(rRect.TopLeft());
+ RotatePoint(aTmpPt,aRef,aGeo.nSin,aGeo.nCos);
+ aTmpPt-=rRect.TopLeft();
+ rRect.Move(aTmpPt.X(),aTmpPt.Y());
+ } else {
+ rRect.Right()-=nDst;
+ }
+ }
+}
+
+void SdrRectObj::TakeObjNameSingul(XubString& rName) const
+{
+ if (IsTextFrame())
+ {
+ SdrTextObj::TakeObjNameSingul(rName);
+ }
+ else
+ {
+ sal_uInt16 nResId=STR_ObjNameSingulRECT;
+ if (aGeo.nShearWink!=0) {
+ nResId+=4; // Parallelogramm oder Raute
+ // Raute ist nicht, weil Shear die vertikalen Kanten verlaengert!
+ // Wenn Zeit ist, werde ich das mal berechnen.
+ } else {
+ if (aRect.GetWidth()==aRect.GetHeight()) nResId+=2; // Quadrat
+ }
+ if (GetEckenradius()!=0) nResId+=8; // abgerundet
+ rName=ImpGetResStr(nResId);
+
+ String aName( GetName() );
+ if(aName.Len())
+ {
+ rName += sal_Unicode(' ');
+ rName += sal_Unicode('\'');
+ rName += aName;
+ rName += sal_Unicode('\'');
+ }
+ }
+}
+
+void SdrRectObj::TakeObjNamePlural(XubString& rName) const
+{
+ if (IsTextFrame()) SdrTextObj::TakeObjNamePlural(rName);
+ else {
+ sal_uInt16 nResId=STR_ObjNamePluralRECT;
+ if (aGeo.nShearWink!=0) {
+ nResId+=4; // Parallelogramm oder Raute
+ } else {
+ if (aRect.GetWidth()==aRect.GetHeight()) nResId+=2; // Quadrat
+ }
+ if (GetEckenradius()!=0) nResId+=8; // abgerundet
+ rName=ImpGetResStr(nResId);
+ }
+}
+
+void SdrRectObj::operator=(const SdrObject& rObj)
+{
+ SdrTextObj::operator=(rObj);
+}
+
+basegfx::B2DPolyPolygon SdrRectObj::TakeXorPoly() const
+{
+ XPolyPolygon aXPP;
+ aXPP.Insert(ImpCalcXPoly(aRect,GetEckenradius()));
+ return aXPP.getB2DPolyPolygon();
+}
+
+void SdrRectObj::RecalcSnapRect()
+{
+ long nEckRad=GetEckenradius();
+ if ((aGeo.nDrehWink!=0 || aGeo.nShearWink!=0) && nEckRad!=0) {
+ maSnapRect=GetXPoly().GetBoundRect();
+ } else {
+ SdrTextObj::RecalcSnapRect();
+ }
+}
+
+void SdrRectObj::NbcSetSnapRect(const Rectangle& rRect)
+{
+ SdrTextObj::NbcSetSnapRect(rRect);
+ SetXPolyDirty();
+}
+
+void SdrRectObj::NbcSetLogicRect(const Rectangle& rRect)
+{
+ SdrTextObj::NbcSetLogicRect(rRect);
+ SetXPolyDirty();
+}
+
+sal_uInt32 SdrRectObj::GetHdlCount() const
+{
+ return IsTextFrame() ? 10 : 9;
+}
+
+SdrHdl* SdrRectObj::GetHdl(sal_uInt32 nHdlNum) const
+{
+ SdrHdl* pH = NULL;
+ Point aPnt;
+ SdrHdlKind eKind = HDL_MOVE;
+
+ if(!IsTextFrame())
+ {
+ nHdlNum++;
+ }
+
+ switch(nHdlNum)
+ {
+ case 0:
+ {
+ pH = new ImpTextframeHdl(aRect);
+ pH->SetObj((SdrObject*)this);
+ pH->SetDrehWink(aGeo.nDrehWink);
+ break;
+ }
+ case 1:
+ {
+ long a = GetEckenradius();
+ long b = Max(aRect.GetWidth(),aRect.GetHeight())/2; // Wird aufgerundet, da GetWidth() eins draufaddiert
+ if (a>b) a=b;
+ if (a<0) a=0;
+ aPnt=aRect.TopLeft();
+ aPnt.X()+=a;
+ eKind = HDL_CIRC;
+ break;
+ }
+ case 2: aPnt=aRect.TopLeft(); eKind = HDL_UPLFT; break; // Oben links
+ case 3: aPnt=aRect.TopCenter(); eKind = HDL_UPPER; break; // Oben
+ case 4: aPnt=aRect.TopRight(); eKind = HDL_UPRGT; break; // Oben rechts
+ case 5: aPnt=aRect.LeftCenter(); eKind = HDL_LEFT ; break; // Links
+ case 6: aPnt=aRect.RightCenter(); eKind = HDL_RIGHT; break; // Rechts
+ case 7: aPnt=aRect.BottomLeft(); eKind = HDL_LWLFT; break; // Unten links
+ case 8: aPnt=aRect.BottomCenter(); eKind = HDL_LOWER; break; // Unten
+ case 9: aPnt=aRect.BottomRight(); eKind = HDL_LWRGT; break; // Unten rechts
+ }
+
+ if(!pH)
+ {
+ if(aGeo.nShearWink)
+ {
+ ShearPoint(aPnt,aRect.TopLeft(),aGeo.nTan);
+ }
+
+ if(aGeo.nDrehWink)
+ {
+ RotatePoint(aPnt,aRect.TopLeft(),aGeo.nSin,aGeo.nCos);
+ }
+
+ pH = new SdrHdl(aPnt,eKind);
+ pH->SetObj((SdrObject*)this);
+ pH->SetDrehWink(aGeo.nDrehWink);
+ }
+
+ return pH;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+bool SdrRectObj::hasSpecialDrag() const
+{
+ return true;
+}
+
+bool SdrRectObj::beginSpecialDrag(SdrDragStat& rDrag) const
+{
+ const bool bRad(rDrag.GetHdl() && HDL_CIRC == rDrag.GetHdl()->GetKind());
+
+ if(bRad)
+ {
+ rDrag.SetEndDragChangesAttributes(true);
+
+ return true;
+ }
+
+ return SdrTextObj::beginSpecialDrag(rDrag);
+}
+
+bool SdrRectObj::applySpecialDrag(SdrDragStat& rDrag)
+{
+ const bool bRad(rDrag.GetHdl() && HDL_CIRC == rDrag.GetHdl()->GetKind());
+
+ if (bRad)
+ {
+ Rectangle aBoundRect0;
+ Point aPt(rDrag.GetNow());
+
+ if(aGeo.nDrehWink)
+ RotatePoint(aPt,aRect.TopLeft(),-aGeo.nSin,aGeo.nCos);
+
+ sal_Int32 nRad(aPt.X() - aRect.Left());
+
+ if (nRad < 0)
+ nRad = 0;
+
+ if(nRad != GetEckenradius())
+ {
+ NbcSetEckenradius(nRad);
+ }
+
+ return true;
+ }
+ else
+ {
+ return SdrTextObj::applySpecialDrag(rDrag);
+ }
+}
+
+String SdrRectObj::getSpecialDragComment(const SdrDragStat& rDrag) const
+{
+ const bool bCreateComment(rDrag.GetView() && this == rDrag.GetView()->GetCreateObj());
+
+ if(bCreateComment)
+ {
+ return String();
+ }
+ else
+ {
+ const bool bRad(rDrag.GetHdl() && HDL_CIRC == rDrag.GetHdl()->GetKind());
+
+ if(bRad)
+ {
+ Point aPt(rDrag.GetNow());
+
+ // -sin fuer Umkehrung
+ if(aGeo.nDrehWink)
+ RotatePoint(aPt, aRect.TopLeft(), -aGeo.nSin, aGeo.nCos);
+
+ sal_Int32 nRad(aPt.X() - aRect.Left());
+
+ if(nRad < 0)
+ nRad = 0;
+
+ XubString aStr;
+
+ ImpTakeDescriptionStr(STR_DragRectEckRad, aStr);
+ aStr.AppendAscii(" (");
+ aStr += GetMetrStr(nRad);
+ aStr += sal_Unicode(')');
+
+ return aStr;
+ }
+ else
+ {
+ return SdrTextObj::getSpecialDragComment(rDrag);
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+basegfx::B2DPolyPolygon SdrRectObj::TakeCreatePoly(const SdrDragStat& rDrag) const
+{
+ Rectangle aRect1;
+ rDrag.TakeCreateRect(aRect1);
+ aRect1.Justify();
+
+ basegfx::B2DPolyPolygon aRetval;
+ aRetval.append(ImpCalcXPoly(aRect1,GetEckenradius()).getB2DPolygon());
+ return aRetval;
+}
+
+Pointer SdrRectObj::GetCreatePointer() const
+{
+ if (IsTextFrame()) return Pointer(POINTER_DRAW_TEXT);
+ return Pointer(POINTER_DRAW_RECT);
+}
+
+void SdrRectObj::NbcMove(const Size& rSiz)
+{
+ SdrTextObj::NbcMove(rSiz);
+ SetXPolyDirty();
+}
+
+void SdrRectObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+{
+ SdrTextObj::NbcResize(rRef,xFact,yFact);
+ SetXPolyDirty();
+}
+
+void SdrRectObj::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
+{
+ SdrTextObj::NbcRotate(rRef,nWink,sn,cs);
+ SetXPolyDirty();
+}
+
+void SdrRectObj::NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
+{
+ SdrTextObj::NbcShear(rRef,nWink,tn,bVShear);
+ SetXPolyDirty();
+}
+
+void SdrRectObj::NbcMirror(const Point& rRef1, const Point& rRef2)
+{
+ SdrTextObj::NbcMirror(rRef1,rRef2);
+ SetXPolyDirty();
+}
+
+FASTBOOL SdrRectObj::DoMacro(const SdrObjMacroHitRec& rRec)
+{
+ return SdrTextObj::DoMacro(rRec);
+}
+
+XubString SdrRectObj::GetMacroPopupComment(const SdrObjMacroHitRec& rRec) const
+{
+ return SdrTextObj::GetMacroPopupComment(rRec);
+}
+
+SdrGluePoint SdrRectObj::GetVertexGluePoint(sal_uInt16 nPosNum) const
+{
+ sal_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(sal_False);
+ return aGP;
+}
+
+SdrGluePoint SdrRectObj::GetCornerGluePoint(sal_uInt16 nPosNum) const
+{
+ sal_Int32 nWdt = ImpGetLineWdt(); // #i25616# ((XLineWidthItem&)(GetObjectItem(XATTR_LINEWIDTH))).GetValue();
+
+ // #i25616#
+ if(!LineIsOutsideGeometry())
+ {
+ nWdt++;
+ nWdt /= 2;
+ }
+
+ Point aPt;
+ switch (nPosNum) {
+ case 0: aPt=aRect.TopLeft(); aPt.X()-=nWdt; aPt.Y()-=nWdt; break;
+ case 1: aPt=aRect.TopRight(); aPt.X()+=nWdt; aPt.Y()-=nWdt; break;
+ case 2: aPt=aRect.BottomRight(); aPt.X()+=nWdt; aPt.Y()+=nWdt; break;
+ case 3: aPt=aRect.BottomLeft(); aPt.X()-=nWdt; aPt.Y()+=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(sal_False);
+ return aGP;
+}
+
+SdrObject* SdrRectObj::DoConvertToPolyObj(sal_Bool bBezier) const
+{
+ XPolygon aXP(ImpCalcXPoly(aRect,GetEckenradius()));
+ { // #40608# Nur Uebergangsweise bis zum neuen TakeContour()
+ aXP.Remove(0,1);
+ aXP[aXP.GetPointCount()-1]=aXP[0];
+ }
+
+ basegfx::B2DPolyPolygon aPolyPolygon(aXP.getB2DPolygon());
+ aPolyPolygon.removeDoublePoints();
+ SdrObject* pRet = 0L;
+
+ if(!IsTextFrame() || HasFill() || HasLine())
+ {
+ pRet = ImpConvertMakeObj(aPolyPolygon, sal_True, bBezier);
+ }
+
+ pRet = ImpConvertAddText(pRet, bBezier);
+
+ return pRet;
+}
+
+void SdrRectObj::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
+{
+ SdrTextObj::Notify(rBC,rHint);
+ SetXPolyDirty(); // wg. Eckenradius
+}
+
+void SdrRectObj::RestGeoData(const SdrObjGeoData& rGeo)
+{
+ SdrTextObj::RestGeoData(rGeo);
+ SetXPolyDirty();
+}
+
+// eof
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
new file mode 100644
index 000000000000..7c0d7e6568af
--- /dev/null
+++ b/svx/source/svdraw/svdotext.cxx
@@ -0,0 +1,2132 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svdotext.hxx>
+#include "svx/svditext.hxx"
+#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 <svx/svdetc.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/svdmodel.hxx> // OutlinerDefaults
+#include "svx/svdglob.hxx" // Stringcache
+#include "svx/svdstr.hrc" // Objektname
+#include <editeng/writingmodeitem.hxx>
+#include <svx/sdtfchim.hxx>
+#include <svtools/colorcfg.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/editstat.hxx>
+#include <editeng/outlobj.hxx>
+#include <editeng/editobj.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <svl/itempool.hxx>
+#include <editeng/adjitem.hxx>
+#include <editeng/flditem.hxx>
+#include <svx/xftouit.hxx>
+#include <vcl/salbtype.hxx> // FRound
+#include <svx/xflgrit.hxx>
+#include <svx/svdpool.hxx>
+#include <svx/xflclit.hxx>
+#include <svl/style.hxx>
+#include <editeng/editeng.hxx>
+#include <svl/itemiter.hxx>
+#include <svx/sdr/properties/textproperties.hxx>
+#include <vcl/metaact.hxx>
+#include <svx/sdr/contact/viewcontactoftextobj.hxx>
+#include <basegfx/tuple/b2dtuple.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+#include <vcl/virdev.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+// #104018# replace macros above with type-safe methods
+inline double ImplTwipsToMM(double fVal) { return (fVal * (127.0 / 72.0)); }
+inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); }
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@@@ @@@@@ @@ @@ @@@@@@ @@@@ @@@@@ @@@@@@
+// @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@@@@ @@ @@ @@ @@ @@ @@
+// @@ @@@@ @@@ @@ @@ @@ @@@@@ @@
+// @@ @@ @@@@@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@@@@ @@ @@ @@ @@@@ @@@@@ @@@@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+// BaseProperties section
+
+sdr::properties::BaseProperties* SdrTextObj::CreateObjectSpecificProperties()
+{
+ return new sdr::properties::TextProperties(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// DrawContact section
+
+sdr::contact::ViewContact* SdrTextObj::CreateObjectSpecificViewContact()
+{
+ return new sdr::contact::ViewContactOfTextObj(*this);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(SdrTextObj,SdrAttrObj);
+
+SdrTextObj::SdrTextObj()
+: SdrAttrObj(),
+ mpText(NULL),
+ pEdtOutl(NULL),
+ pFormTextBoundRect(NULL),
+ eTextKind(OBJ_TEXT)
+{
+ bTextSizeDirty=sal_False;
+ bTextFrame=sal_False;
+ bNoShear=sal_False;
+ bNoRotate=sal_False;
+ bNoMirror=sal_False;
+ bDisableAutoWidthOnDragging=sal_False;
+
+ // #101684#
+ mbInEditMode = sal_False;
+
+ // #111096#
+ mbTextHidden = sal_False;
+
+ // #111096#
+ mbTextAnimationAllowed = sal_True;
+
+ // #108784#
+ maTextEditOffset = Point(0, 0);
+
+ // #i25616#
+ mbSupportTextIndentingOnLineWidthChange = sal_True;
+}
+
+SdrTextObj::SdrTextObj(const Rectangle& rNewRect)
+: SdrAttrObj(),
+ aRect(rNewRect),
+ mpText(NULL),
+ pEdtOutl(NULL),
+ pFormTextBoundRect(NULL)
+{
+ bTextSizeDirty=sal_False;
+ bTextFrame=sal_False;
+ bNoShear=sal_False;
+ bNoRotate=sal_False;
+ bNoMirror=sal_False;
+ bDisableAutoWidthOnDragging=sal_False;
+ ImpJustifyRect(aRect);
+
+ // #101684#
+ mbInEditMode = sal_False;
+
+ // #111096#
+ mbTextHidden = sal_False;
+
+ // #111096#
+ mbTextAnimationAllowed = sal_True;
+
+ // #108784#
+ maTextEditOffset = Point(0, 0);
+
+ // #i25616#
+ mbSupportTextIndentingOnLineWidthChange = sal_True;
+}
+
+SdrTextObj::SdrTextObj(SdrObjKind eNewTextKind)
+: SdrAttrObj(),
+ mpText(NULL),
+ pEdtOutl(NULL),
+ pFormTextBoundRect(NULL),
+ eTextKind(eNewTextKind)
+{
+ bTextSizeDirty=sal_False;
+ bTextFrame=sal_True;
+ bNoShear=sal_True;
+ bNoRotate=sal_False;
+ bNoMirror=sal_True;
+ bDisableAutoWidthOnDragging=sal_False;
+
+ // #101684#
+ mbInEditMode = sal_False;
+
+ // #111096#
+ mbTextHidden = sal_False;
+
+ // #111096#
+ mbTextAnimationAllowed = sal_True;
+
+ // #108784#
+ maTextEditOffset = Point(0, 0);
+
+ // #i25616#
+ mbSupportTextIndentingOnLineWidthChange = sal_True;
+}
+
+SdrTextObj::SdrTextObj(SdrObjKind eNewTextKind, const Rectangle& rNewRect)
+: SdrAttrObj(),
+ aRect(rNewRect),
+ mpText(NULL),
+ pEdtOutl(NULL),
+ pFormTextBoundRect(NULL),
+ eTextKind(eNewTextKind)
+{
+ bTextSizeDirty=sal_False;
+ bTextFrame=sal_True;
+ bNoShear=sal_True;
+ bNoRotate=sal_False;
+ bNoMirror=sal_True;
+ bDisableAutoWidthOnDragging=sal_False;
+ ImpJustifyRect(aRect);
+
+ // #101684#
+ mbInEditMode = sal_False;
+
+ // #111096#
+ mbTextHidden = sal_False;
+
+ // #111096#
+ mbTextAnimationAllowed = sal_True;
+
+ // #108784#
+ maTextEditOffset = Point(0, 0);
+
+ // #i25616#
+ mbSupportTextIndentingOnLineWidthChange = sal_True;
+}
+
+SdrTextObj::SdrTextObj(SdrObjKind eNewTextKind, const Rectangle& rNewRect, SvStream& rInput, const String& rBaseURL, sal_uInt16 eFormat)
+: SdrAttrObj(),
+ aRect(rNewRect),
+ mpText(NULL),
+ pEdtOutl(NULL),
+ pFormTextBoundRect(NULL),
+ eTextKind(eNewTextKind)
+{
+ bTextSizeDirty=sal_False;
+ bTextFrame=sal_True;
+ bNoShear=sal_True;
+ bNoRotate=sal_False;
+ bNoMirror=sal_True;
+ bDisableAutoWidthOnDragging=sal_False;
+ ImpJustifyRect(aRect);
+
+ NbcSetText(rInput, rBaseURL, eFormat);
+
+ // #101684#
+ mbInEditMode = sal_False;
+
+ // #111096#
+ mbTextHidden = sal_False;
+
+ // #111096#
+ mbTextAnimationAllowed = sal_True;
+
+ // #108784#
+ maTextEditOffset = Point(0, 0);
+
+ // #i25616#
+ mbSupportTextIndentingOnLineWidthChange = sal_True;
+}
+
+SdrTextObj::~SdrTextObj()
+{
+ if( pModel )
+ {
+ SdrOutliner& rOutl = pModel->GetHitTestOutliner();
+ if( rOutl.GetTextObj() == this )
+ rOutl.SetTextObj( NULL );
+ }
+
+ if(mpText!=NULL)
+ delete mpText;
+
+ if (pFormTextBoundRect!=NULL)
+ delete pFormTextBoundRect;
+
+ ImpLinkAbmeldung();
+}
+
+void SdrTextObj::FitFrameToTextSize()
+{
+ DBG_ASSERT(pModel!=NULL,"SdrTextObj::FitFrameToTextSize(): pModel=NULL!");
+ ImpJustifyRect(aRect);
+
+ SdrText* pText = getActiveText();
+ if( pText!=NULL && pText->GetOutlinerParaObject() && pModel!=NULL)
+ {
+ SdrOutliner& rOutliner=ImpGetDrawOutliner();
+ rOutliner.SetPaperSize(Size(aRect.Right()-aRect.Left(),aRect.Bottom()-aRect.Top()));
+ rOutliner.SetUpdateMode(sal_True);
+ rOutliner.SetText(*pText->GetOutlinerParaObject());
+ Rectangle aTextRect;
+ Size aNewSize(rOutliner.CalcTextSize());
+ rOutliner.Clear();
+ aNewSize.Width()++; // wegen evtl. Rundungsfehler
+ aNewSize.Width()+=GetTextLeftDistance()+GetTextRightDistance();
+ aNewSize.Height()+=GetTextUpperDistance()+GetTextLowerDistance();
+ Rectangle aNewRect(aRect);
+ aNewRect.SetSize(aNewSize);
+ ImpJustifyRect(aNewRect);
+ if (aNewRect!=aRect) {
+ SetLogicRect(aNewRect);
+ }
+ }
+}
+
+void SdrTextObj::NbcSetText(const XubString& rStr)
+{
+ SdrOutliner& rOutliner=ImpGetDrawOutliner();
+ rOutliner.SetStyleSheet( 0, GetStyleSheet());
+ //OutputDevice* pRef1=rOutliner.GetRefDevice();
+ rOutliner.SetUpdateMode(sal_True);
+ rOutliner.SetText(rStr,rOutliner.GetParagraph( 0 ));
+ OutlinerParaObject* pNewText=rOutliner.CreateParaObject();
+ Size aSiz(rOutliner.CalcTextSize());
+ //OutputDevice* pRef2=rOutliner.GetRefDevice();
+ rOutliner.Clear();
+ NbcSetOutlinerParaObject(pNewText);
+ aTextSize=aSiz;
+ bTextSizeDirty=sal_False;
+}
+
+void SdrTextObj::SetText(const XubString& rStr)
+{
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ // #110094#-14 SendRepaintBroadcast();
+ NbcSetText(rStr);
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+ //if (GetBoundRect()!=aBoundRect0) {
+ // SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+ //}
+}
+
+void SdrTextObj::NbcSetText(SvStream& rInput, const String& rBaseURL, sal_uInt16 eFormat)
+{
+ SdrOutliner& rOutliner=ImpGetDrawOutliner();
+ rOutliner.SetStyleSheet( 0, GetStyleSheet());
+ rOutliner.Read(rInput,rBaseURL,eFormat);
+ OutlinerParaObject* pNewText=rOutliner.CreateParaObject();
+ rOutliner.SetUpdateMode(sal_True);
+ Size aSiz(rOutliner.CalcTextSize());
+ rOutliner.Clear();
+ NbcSetOutlinerParaObject(pNewText);
+ aTextSize=aSiz;
+ bTextSizeDirty=sal_False;
+}
+
+void SdrTextObj::SetText(SvStream& rInput, const String& rBaseURL, sal_uInt16 eFormat)
+{
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ // #110094#-14 SendRepaintBroadcast();
+ NbcSetText(rInput,rBaseURL,eFormat);
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+}
+
+const Size& SdrTextObj::GetTextSize() const
+{
+ if (bTextSizeDirty)
+ {
+ Size aSiz;
+ SdrText* pText = getActiveText();
+ if( pText && pText->GetOutlinerParaObject ())
+ {
+ SdrOutliner& rOutliner=ImpGetDrawOutliner();
+ rOutliner.SetText(*pText->GetOutlinerParaObject());
+ rOutliner.SetUpdateMode(sal_True);
+ aSiz=rOutliner.CalcTextSize();
+ rOutliner.Clear();
+ }
+ // 2x casting auf nonconst
+ ((SdrTextObj*)this)->aTextSize=aSiz;
+ ((SdrTextObj*)this)->bTextSizeDirty=sal_False;
+ }
+ return aTextSize;
+}
+
+FASTBOOL SdrTextObj::IsAutoGrowHeight() const
+{
+ if(!bTextFrame)
+ return sal_False; // AutoGrow nur bei TextFrames
+
+ const SfxItemSet& rSet = GetObjectItemSet();
+ sal_Bool bRet = ((SdrTextAutoGrowHeightItem&)(rSet.Get(SDRATTR_TEXT_AUTOGROWHEIGHT))).GetValue();
+
+ if(bRet)
+ {
+ SdrTextAniKind eAniKind = ((SdrTextAniKindItem&)(rSet.Get(SDRATTR_TEXT_ANIKIND))).GetValue();
+
+ if(eAniKind == SDRTEXTANI_SCROLL || eAniKind == SDRTEXTANI_ALTERNATE || eAniKind == SDRTEXTANI_SLIDE)
+ {
+ SdrTextAniDirection eDirection = ((SdrTextAniDirectionItem&)(rSet.Get(SDRATTR_TEXT_ANIDIRECTION))).GetValue();
+
+ if(eDirection == SDRTEXTANI_UP || eDirection == SDRTEXTANI_DOWN)
+ {
+ bRet = sal_False;
+ }
+ }
+ }
+ return bRet;
+}
+
+FASTBOOL SdrTextObj::IsAutoGrowWidth() const
+{
+ if(!bTextFrame)
+ return sal_False; // AutoGrow nur bei TextFrames
+
+ const SfxItemSet& rSet = GetObjectItemSet();
+ sal_Bool bRet = ((SdrTextAutoGrowHeightItem&)(rSet.Get(SDRATTR_TEXT_AUTOGROWWIDTH))).GetValue();
+
+ // #101684#
+ sal_Bool bInEditMOde = IsInEditMode();
+
+ if(!bInEditMOde && bRet)
+ {
+ SdrTextAniKind eAniKind = ((SdrTextAniKindItem&)(rSet.Get(SDRATTR_TEXT_ANIKIND))).GetValue();
+
+ if(eAniKind == SDRTEXTANI_SCROLL || eAniKind == SDRTEXTANI_ALTERNATE || eAniKind == SDRTEXTANI_SLIDE)
+ {
+ SdrTextAniDirection eDirection = ((SdrTextAniDirectionItem&)(rSet.Get(SDRATTR_TEXT_ANIDIRECTION))).GetValue();
+
+ if(eDirection == SDRTEXTANI_LEFT || eDirection == SDRTEXTANI_RIGHT)
+ {
+ bRet = sal_False;
+ }
+ }
+ }
+ return bRet;
+}
+
+SdrTextHorzAdjust SdrTextObj::GetTextHorizontalAdjust() const
+{
+ return GetTextHorizontalAdjust(GetObjectItemSet());
+}
+
+SdrTextHorzAdjust SdrTextObj::GetTextHorizontalAdjust(const SfxItemSet& rSet) const
+{
+ if(IsContourTextFrame())
+ return SDRTEXTHORZADJUST_BLOCK;
+
+ SdrTextHorzAdjust eRet = ((SdrTextHorzAdjustItem&)(rSet.Get(SDRATTR_TEXT_HORZADJUST))).GetValue();
+
+ // #101684#
+ sal_Bool bInEditMode = IsInEditMode();
+
+ if(!bInEditMode && eRet == SDRTEXTHORZADJUST_BLOCK)
+ {
+ SdrTextAniKind eAniKind = ((SdrTextAniKindItem&)(rSet.Get(SDRATTR_TEXT_ANIKIND))).GetValue();
+
+ if(eAniKind == SDRTEXTANI_SCROLL || eAniKind == SDRTEXTANI_ALTERNATE || eAniKind == SDRTEXTANI_SLIDE)
+ {
+ SdrTextAniDirection eDirection = ((SdrTextAniDirectionItem&)(rSet.Get(SDRATTR_TEXT_ANIDIRECTION))).GetValue();
+
+ if(eDirection == SDRTEXTANI_LEFT || eDirection == SDRTEXTANI_RIGHT)
+ {
+ eRet = SDRTEXTHORZADJUST_LEFT;
+ }
+ }
+ }
+
+ return eRet;
+} // defaults: BLOCK fuer Textrahmen, CENTER fuer beschriftete Grafikobjekte
+
+SdrTextVertAdjust SdrTextObj::GetTextVerticalAdjust() const
+{
+ return GetTextVerticalAdjust(GetObjectItemSet());
+}
+
+SdrTextVertAdjust SdrTextObj::GetTextVerticalAdjust(const SfxItemSet& rSet) const
+{
+ if(IsContourTextFrame())
+ return SDRTEXTVERTADJUST_TOP;
+
+ // #103516# Take care for vertical text animation here
+ SdrTextVertAdjust eRet = ((SdrTextVertAdjustItem&)(rSet.Get(SDRATTR_TEXT_VERTADJUST))).GetValue();
+ sal_Bool bInEditMode = IsInEditMode();
+
+ // #103516# Take care for vertical text animation here
+ if(!bInEditMode && eRet == SDRTEXTVERTADJUST_BLOCK)
+ {
+ SdrTextAniKind eAniKind = ((SdrTextAniKindItem&)(rSet.Get(SDRATTR_TEXT_ANIKIND))).GetValue();
+
+ if(eAniKind == SDRTEXTANI_SCROLL || eAniKind == SDRTEXTANI_ALTERNATE || eAniKind == SDRTEXTANI_SLIDE)
+ {
+ SdrTextAniDirection eDirection = ((SdrTextAniDirectionItem&)(rSet.Get(SDRATTR_TEXT_ANIDIRECTION))).GetValue();
+
+ if(eDirection == SDRTEXTANI_LEFT || eDirection == SDRTEXTANI_RIGHT)
+ {
+ eRet = SDRTEXTVERTADJUST_TOP;
+ }
+ }
+ }
+
+ return eRet;
+} // defaults: TOP fuer Textrahmen, CENTER fuer beschriftete Grafikobjekte
+
+void SdrTextObj::ImpJustifyRect(Rectangle& rRect) const
+{
+ if (!rRect.IsEmpty()) {
+ rRect.Justify();
+ if (rRect.Left()==rRect.Right()) rRect.Right()++;
+ if (rRect.Top()==rRect.Bottom()) rRect.Bottom()++;
+ }
+}
+
+void SdrTextObj::ImpCheckShear()
+{
+ if (bNoShear && aGeo.nShearWink!=0) {
+ aGeo.nShearWink=0;
+ aGeo.nTan=0;
+ }
+}
+
+void SdrTextObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
+{
+ FASTBOOL bNoTextFrame=!IsTextFrame();
+ rInfo.bResizeFreeAllowed=bNoTextFrame || aGeo.nDrehWink%9000==0;
+ rInfo.bResizePropAllowed=sal_True;
+ rInfo.bRotateFreeAllowed=sal_True;
+ rInfo.bRotate90Allowed =sal_True;
+ rInfo.bMirrorFreeAllowed=bNoTextFrame;
+ rInfo.bMirror45Allowed =bNoTextFrame;
+ rInfo.bMirror90Allowed =bNoTextFrame;
+
+ // allow transparence
+ rInfo.bTransparenceAllowed = sal_True;
+
+ // gradient depends on fillstyle
+ XFillStyle eFillStyle = ((XFillStyleItem&)(GetObjectItem(XATTR_FILLSTYLE))).GetValue();
+ rInfo.bGradientAllowed = (eFillStyle == XFILL_GRADIENT);
+ rInfo.bShearAllowed =bNoTextFrame;
+ rInfo.bEdgeRadiusAllowed=sal_True;
+ FASTBOOL bCanConv=ImpCanConvTextToCurve();
+ rInfo.bCanConvToPath =bCanConv;
+ rInfo.bCanConvToPoly =bCanConv;
+ rInfo.bCanConvToPathLineToArea=bCanConv;
+ rInfo.bCanConvToPolyLineToArea=bCanConv;
+ rInfo.bCanConvToContour = (rInfo.bCanConvToPoly || LineGeometryUsageIsNecessary());
+}
+
+sal_uInt16 SdrTextObj::GetObjIdentifier() const
+{
+ return sal_uInt16(eTextKind);
+}
+
+bool SdrTextObj::HasTextImpl( SdrOutliner* pOutliner )
+{
+ bool bRet=false;
+ if(pOutliner)
+ {
+ Paragraph* p1stPara=pOutliner->GetParagraph( 0 );
+ sal_uIntPtr nParaAnz=pOutliner->GetParagraphCount();
+ if(p1stPara==NULL)
+ nParaAnz=0;
+
+ if(nParaAnz==1)
+ {
+ // if it is only one paragraph, check if that paragraph is empty
+ XubString aStr(pOutliner->GetText(p1stPara));
+
+ if(!aStr.Len())
+ nParaAnz = 0;
+ }
+
+ bRet= nParaAnz!=0;
+ }
+ return bRet;
+}
+
+FASTBOOL SdrTextObj::HasEditText() const
+{
+ return HasTextImpl( pEdtOutl );
+}
+
+void SdrTextObj::SetPage(SdrPage* pNewPage)
+{
+ FASTBOOL bRemove=pNewPage==NULL && pPage!=NULL;
+ FASTBOOL bInsert=pNewPage!=NULL && pPage==NULL;
+ FASTBOOL bLinked=IsLinkedText();
+
+ if (bLinked && bRemove) {
+ ImpLinkAbmeldung();
+ }
+
+ SdrAttrObj::SetPage(pNewPage);
+
+ if (bLinked && bInsert) {
+ ImpLinkAnmeldung();
+ }
+}
+
+void SdrTextObj::SetModel(SdrModel* pNewModel)
+{
+ SdrModel* pOldModel=pModel;
+ bool bLinked=IsLinkedText();
+ bool bChg=pNewModel!=pModel;
+
+ if (bLinked && bChg)
+ {
+ ImpLinkAbmeldung();
+ }
+
+ SdrAttrObj::SetModel(pNewModel);
+
+ if( bChg )
+ {
+ if( pNewModel != 0 && pOldModel != 0 )
+ SetTextSizeDirty();
+
+ sal_Int32 nCount = getTextCount();
+ for( sal_Int32 nText = 0; nText < nCount; nText++ )
+ {
+ SdrText* pText = getText( nText );
+ if( pText )
+ pText->SetModel( pNewModel );
+ }
+ }
+
+ if (bLinked && bChg)
+ {
+ ImpLinkAnmeldung();
+ }
+}
+
+FASTBOOL SdrTextObj::NbcSetEckenradius(long nRad)
+{
+ SetObjectItem(SdrEckenradiusItem(nRad));
+ return sal_True;
+}
+
+FASTBOOL SdrTextObj::NbcSetAutoGrowHeight(bool bAuto)
+{
+ if(bTextFrame)
+ {
+ SetObjectItem(SdrTextAutoGrowHeightItem(bAuto));
+ return sal_True;
+ }
+ return sal_False;
+}
+
+FASTBOOL SdrTextObj::NbcSetMinTextFrameHeight(long nHgt)
+{
+ if( bTextFrame && ( !pModel || !pModel->isLocked() ) ) // SJ: #i44922#
+ {
+ SetObjectItem(SdrTextMinFrameHeightItem(nHgt));
+
+ // #84974# use bDisableAutoWidthOnDragging as
+ // bDisableAutoHeightOnDragging if vertical.
+ if(IsVerticalWriting() && bDisableAutoWidthOnDragging)
+ {
+ bDisableAutoWidthOnDragging = sal_False;
+ SetObjectItem(SdrTextAutoGrowHeightItem(sal_False));
+ }
+
+ return sal_True;
+ }
+ return sal_False;
+}
+
+FASTBOOL SdrTextObj::NbcSetMaxTextFrameHeight(long nHgt)
+{
+ if(bTextFrame)
+ {
+ SetObjectItem(SdrTextMaxFrameHeightItem(nHgt));
+ return sal_True;
+ }
+ return sal_False;
+}
+
+FASTBOOL SdrTextObj::NbcSetAutoGrowWidth(bool bAuto)
+{
+ if(bTextFrame)
+ {
+ SetObjectItem(SdrTextAutoGrowWidthItem(bAuto));
+ return sal_True;
+ }
+ return sal_False;
+}
+
+FASTBOOL SdrTextObj::NbcSetMinTextFrameWidth(long nWdt)
+{
+ if( bTextFrame && ( !pModel || !pModel->isLocked() ) ) // SJ: #i44922#
+ {
+ SetObjectItem(SdrTextMinFrameWidthItem(nWdt));
+
+ // #84974# use bDisableAutoWidthOnDragging only
+ // when not vertical.
+ if(!IsVerticalWriting() && bDisableAutoWidthOnDragging)
+ {
+ bDisableAutoWidthOnDragging = sal_False;
+ SetObjectItem(SdrTextAutoGrowWidthItem(sal_False));
+ }
+
+ return sal_True;
+ }
+ return sal_False;
+}
+
+FASTBOOL SdrTextObj::NbcSetMaxTextFrameWidth(long nWdt)
+{
+ if(bTextFrame)
+ {
+ SetObjectItem(SdrTextMaxFrameWidthItem(nWdt));
+ return sal_True;
+ }
+ return sal_False;
+}
+
+FASTBOOL SdrTextObj::NbcSetFitToSize(SdrFitToSizeType eFit)
+{
+ if(bTextFrame)
+ {
+ SetObjectItem(SdrTextFitToSizeTypeItem(eFit));
+ return sal_True;
+ }
+ return sal_False;
+}
+
+void SdrTextObj::ImpSetContourPolygon( SdrOutliner& rOutliner, Rectangle& rAnchorRect, sal_Bool bLineWidth ) const
+{
+ basegfx::B2DPolyPolygon aXorPolyPolygon(TakeXorPoly());
+ basegfx::B2DPolyPolygon* pContourPolyPolygon = 0L;
+ basegfx::B2DHomMatrix aMatrix(basegfx::tools::createTranslateB2DHomMatrix(
+ -rAnchorRect.Left(), -rAnchorRect.Top()));
+
+ if(aGeo.nDrehWink)
+ {
+ // Unrotate!
+ aMatrix.rotate(-aGeo.nDrehWink * nPi180);
+ }
+
+ aXorPolyPolygon.transform(aMatrix);
+
+ if( bLineWidth )
+ {
+ // Strichstaerke beruecksichtigen
+ // Beim Hittest muss das unterbleiben (Performance!)
+ pContourPolyPolygon = new basegfx::B2DPolyPolygon();
+
+ // #86258# test if shadow needs to be avoided for TakeContour()
+ const SfxItemSet& rSet = GetObjectItemSet();
+ sal_Bool bShadowOn = ((SdrShadowItem&)(rSet.Get(SDRATTR_SHADOW))).GetValue();
+
+ // #i33696#
+ // Remember TextObject currently set at the DrawOutliner, it WILL be
+ // replaced during calculating the outline since it uses an own paint
+ // and that one uses the DrawOutliner, too.
+ const SdrTextObj* pLastTextObject = rOutliner.GetTextObj();
+
+ if(bShadowOn)
+ {
+ // #86258# force shadow off
+ SdrObject* pCopy = Clone();
+ pCopy->SetMergedItem(SdrShadowItem(sal_False));
+ *pContourPolyPolygon = pCopy->TakeContour();
+ SdrObject::Free( pCopy );
+ }
+ else
+ {
+ *pContourPolyPolygon = TakeContour();
+ }
+
+ // #i33696#
+ // restore remembered text object
+ if(pLastTextObject != rOutliner.GetTextObj())
+ {
+ rOutliner.SetTextObj(pLastTextObject);
+ }
+
+ pContourPolyPolygon->transform(aMatrix);
+ }
+
+ rOutliner.SetPolygon(aXorPolyPolygon, pContourPolyPolygon);
+}
+
+void SdrTextObj::TakeUnrotatedSnapRect(Rectangle& rRect) const
+{
+ rRect=aRect;
+}
+
+void SdrTextObj::TakeTextAnchorRect(Rectangle& rAnchorRect) const
+{
+ long nLeftDist=GetTextLeftDistance();
+ long nRightDist=GetTextRightDistance();
+ long nUpperDist=GetTextUpperDistance();
+ long nLowerDist=GetTextLowerDistance();
+ Rectangle aAnkRect(aRect); // Rect innerhalb dem geankert wird
+ FASTBOOL bFrame=IsTextFrame();
+ if (!bFrame) {
+ TakeUnrotatedSnapRect(aAnkRect);
+ }
+ Point aRotateRef(aAnkRect.TopLeft());
+ aAnkRect.Left()+=nLeftDist;
+ aAnkRect.Top()+=nUpperDist;
+ aAnkRect.Right()-=nRightDist;
+ aAnkRect.Bottom()-=nLowerDist;
+
+ // #108816#
+ // Since sizes may be bigger than the object bounds it is necessary to
+ // justify the rect now.
+ ImpJustifyRect(aAnkRect);
+
+ if (bFrame) {
+ // !!! hier noch etwas verfeinern !!!
+ if (aAnkRect.GetWidth()<2) aAnkRect.Right()=aAnkRect.Left()+1; // Mindestgroesse 2
+ if (aAnkRect.GetHeight()<2) aAnkRect.Bottom()=aAnkRect.Top()+1; // Mindestgroesse 2
+ }
+ if (aGeo.nDrehWink!=0) {
+ Point aTmpPt(aAnkRect.TopLeft());
+ RotatePoint(aTmpPt,aRotateRef,aGeo.nSin,aGeo.nCos);
+ aTmpPt-=aAnkRect.TopLeft();
+ aAnkRect.Move(aTmpPt.X(),aTmpPt.Y());
+ }
+ rAnchorRect=aAnkRect;
+}
+
+void SdrTextObj::TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, FASTBOOL bNoEditText,
+ Rectangle* pAnchorRect, sal_Bool bLineWidth ) const
+{
+ Rectangle aAnkRect; // Rect innerhalb dem geankert wird
+ TakeTextAnchorRect(aAnkRect);
+ SdrTextVertAdjust eVAdj=GetTextVerticalAdjust();
+ SdrTextHorzAdjust eHAdj=GetTextHorizontalAdjust();
+ SdrTextAniKind eAniKind=GetTextAniKind();
+ SdrTextAniDirection eAniDirection=GetTextAniDirection();
+
+ SdrFitToSizeType eFit=GetFitToSize();
+ FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
+ FASTBOOL bContourFrame=IsContourTextFrame();
+
+ FASTBOOL bFrame=IsTextFrame();
+ sal_uIntPtr nStat0=rOutliner.GetControlWord();
+ Size aNullSize;
+ if (!bContourFrame)
+ {
+ rOutliner.SetControlWord(nStat0|EE_CNTRL_AUTOPAGESIZE);
+ rOutliner.SetMinAutoPaperSize(aNullSize);
+ rOutliner.SetMaxAutoPaperSize(Size(1000000,1000000));
+ }
+
+ if (!bFitToSize && !bContourFrame)
+ {
+ long nAnkWdt=aAnkRect.GetWidth();
+ long nAnkHgt=aAnkRect.GetHeight();
+ if (bFrame)
+ {
+ long nWdt=nAnkWdt;
+ long nHgt=nAnkHgt;
+
+ // #101684#
+ sal_Bool bInEditMode = IsInEditMode();
+
+ if (!bInEditMode && (eAniKind==SDRTEXTANI_SCROLL || eAniKind==SDRTEXTANI_ALTERNATE || eAniKind==SDRTEXTANI_SLIDE))
+ {
+ // Grenzenlose Papiergroesse fuer Laufschrift
+ if (eAniDirection==SDRTEXTANI_LEFT || eAniDirection==SDRTEXTANI_RIGHT) nWdt=1000000;
+ if (eAniDirection==SDRTEXTANI_UP || eAniDirection==SDRTEXTANI_DOWN) nHgt=1000000;
+ }
+ rOutliner.SetMaxAutoPaperSize(Size(nWdt,nHgt));
+ }
+
+ // #103516# New try with _BLOCK for hor and ver after completely
+ // supporting full width for vertical text.
+ if(SDRTEXTHORZADJUST_BLOCK == eHAdj && !IsVerticalWriting())
+ {
+ rOutliner.SetMinAutoPaperSize(Size(nAnkWdt, 0));
+ }
+
+ if(SDRTEXTVERTADJUST_BLOCK == eVAdj && IsVerticalWriting())
+ {
+ rOutliner.SetMinAutoPaperSize(Size(0, nAnkHgt));
+ }
+ }
+
+ rOutliner.SetPaperSize(aNullSize);
+ if (bContourFrame)
+ ImpSetContourPolygon( rOutliner, aAnkRect, bLineWidth );
+
+ // put text into the outliner, if available from the edit outliner
+ SdrText* pText = getActiveText();
+ OutlinerParaObject* pOutlinerParaObject = pText ? pText->GetOutlinerParaObject() : 0;
+ OutlinerParaObject* pPara = (pEdtOutl && !bNoEditText) ? pEdtOutl->CreateParaObject() : pOutlinerParaObject;
+
+ if (pPara)
+ {
+ sal_Bool bHitTest = sal_False;
+ if( pModel )
+ bHitTest = &pModel->GetHitTestOutliner() == &rOutliner;
+
+ const SdrTextObj* pTestObj = rOutliner.GetTextObj();
+ if( !pTestObj || !bHitTest || pTestObj != this ||
+ pTestObj->GetOutlinerParaObject() != pOutlinerParaObject )
+ {
+ if( bHitTest ) // #i33696# take back fix #i27510#
+ {
+ rOutliner.SetTextObj( this );
+ rOutliner.SetFixedCellHeight(((const SdrTextFixedCellHeightItem&)GetMergedItem(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue());
+ }
+
+ rOutliner.SetUpdateMode(sal_True);
+ rOutliner.SetText(*pPara);
+ }
+ }
+ else
+ {
+ rOutliner.SetTextObj( NULL );
+ }
+
+ if (pEdtOutl && !bNoEditText && pPara)
+ delete pPara;
+
+ rOutliner.SetUpdateMode(sal_True);
+ rOutliner.SetControlWord(nStat0);
+
+ if( pText )
+ pText->CheckPortionInfo(rOutliner);
+
+ Point aTextPos(aAnkRect.TopLeft());
+ Size aTextSiz(rOutliner.GetPaperSize()); // GetPaperSize() hat etwas Toleranz drauf, oder?
+
+ // #106653#
+ // For draw objects containing text correct hor/ver alignment if text is bigger
+ // than the object itself. Without that correction, the text would always be
+ // formatted to the left edge (or top edge when vertical) of the draw object.
+ if(!IsTextFrame())
+ {
+ if(aAnkRect.GetWidth() < aTextSiz.Width() && !IsVerticalWriting())
+ {
+ // #110129#
+ // Horizontal case here. Correct only if eHAdj == SDRTEXTHORZADJUST_BLOCK,
+ // else the alignment is wanted.
+ if(SDRTEXTHORZADJUST_BLOCK == eHAdj)
+ {
+ eHAdj = SDRTEXTHORZADJUST_CENTER;
+ }
+ }
+
+ if(aAnkRect.GetHeight() < aTextSiz.Height() && IsVerticalWriting())
+ {
+ // #110129#
+ // Vertical case here. Correct only if eHAdj == SDRTEXTVERTADJUST_BLOCK,
+ // else the alignment is wanted.
+ if(SDRTEXTVERTADJUST_BLOCK == eVAdj)
+ {
+ eVAdj = SDRTEXTVERTADJUST_CENTER;
+ }
+ }
+ }
+
+ if (eHAdj==SDRTEXTHORZADJUST_CENTER || eHAdj==SDRTEXTHORZADJUST_RIGHT)
+ {
+ long nFreeWdt=aAnkRect.GetWidth()-aTextSiz.Width();
+ if (eHAdj==SDRTEXTHORZADJUST_CENTER)
+ aTextPos.X()+=nFreeWdt/2;
+ if (eHAdj==SDRTEXTHORZADJUST_RIGHT)
+ aTextPos.X()+=nFreeWdt;
+ }
+ if (eVAdj==SDRTEXTVERTADJUST_CENTER || eVAdj==SDRTEXTVERTADJUST_BOTTOM)
+ {
+ long nFreeHgt=aAnkRect.GetHeight()-aTextSiz.Height();
+ if (eVAdj==SDRTEXTVERTADJUST_CENTER)
+ aTextPos.Y()+=nFreeHgt/2;
+ if (eVAdj==SDRTEXTVERTADJUST_BOTTOM)
+ aTextPos.Y()+=nFreeHgt;
+ }
+ if (aGeo.nDrehWink!=0)
+ RotatePoint(aTextPos,aAnkRect.TopLeft(),aGeo.nSin,aGeo.nCos);
+
+ if (pAnchorRect)
+ *pAnchorRect=aAnkRect;
+
+ // rTextRect ist bei ContourFrame in einigen Faellen nicht korrekt
+ rTextRect=Rectangle(aTextPos,aTextSiz);
+ if (bContourFrame)
+ rTextRect=aAnkRect;
+}
+
+OutlinerParaObject* SdrTextObj::GetEditOutlinerParaObject() const
+{
+ OutlinerParaObject* pPara=NULL;
+ if( HasTextImpl( pEdtOutl ) )
+ {
+ sal_uInt16 nParaAnz = static_cast< sal_uInt16 >( pEdtOutl->GetParagraphCount() );
+ pPara = pEdtOutl->CreateParaObject(0, nParaAnz);
+ }
+ return pPara;
+}
+
+void SdrTextObj::ImpSetCharStretching(SdrOutliner& rOutliner, const Rectangle& rTextRect, const Rectangle& rAnchorRect, Fraction& rFitXKorreg) const
+{
+ OutputDevice* pOut = rOutliner.GetRefDevice();
+ sal_Bool bNoStretching(sal_False);
+
+ if(pOut && pOut->GetOutDevType() == OUTDEV_PRINTER)
+ {
+ // #35762#: Checken ob CharStretching ueberhaupt moeglich
+ GDIMetaFile* pMtf = pOut->GetConnectMetaFile();
+ UniString aTestString(sal_Unicode('J'));
+
+ if(pMtf && (!pMtf->IsRecord() || pMtf->IsPause()))
+ pMtf = NULL;
+
+ if(pMtf)
+ pMtf->Pause(sal_True);
+
+ Font aFontMerk(pOut->GetFont());
+ Font aTmpFont( OutputDevice::GetDefaultFont( DEFAULTFONT_SERIF, LANGUAGE_SYSTEM, DEFAULTFONT_FLAGS_ONLYONE ) );
+
+ aTmpFont.SetSize(Size(0,100));
+ pOut->SetFont(aTmpFont);
+ Size aSize1(pOut->GetTextWidth(aTestString), pOut->GetTextHeight());
+ aTmpFont.SetSize(Size(800,100));
+ pOut->SetFont(aTmpFont);
+ Size aSize2(pOut->GetTextWidth(aTestString), pOut->GetTextHeight());
+ pOut->SetFont(aFontMerk);
+
+ if(pMtf)
+ pMtf->Pause(sal_False);
+
+ bNoStretching = (aSize1 == aSize2);
+
+#ifdef WNT
+ // #35762# Windows vergroessert bei Size(100,500) den Font proportional
+ // Und das finden wir nicht so schoen.
+ if(aSize2.Height() >= aSize1.Height() * 2)
+ {
+ bNoStretching = sal_True;
+ }
+#endif
+ }
+ unsigned nLoopCount=0;
+ FASTBOOL bNoMoreLoop=sal_False;
+ long nXDiff0=0x7FFFFFFF;
+ long nWantWdt=rAnchorRect.Right()-rAnchorRect.Left();
+ long nIsWdt=rTextRect.Right()-rTextRect.Left();
+ if (nIsWdt==0) nIsWdt=1;
+
+ long nWantHgt=rAnchorRect.Bottom()-rAnchorRect.Top();
+ long nIsHgt=rTextRect.Bottom()-rTextRect.Top();
+ if (nIsHgt==0) nIsHgt=1;
+
+ long nXTolPl=nWantWdt/100; // Toleranz +1%
+ long nXTolMi=nWantWdt/25; // Toleranz -4%
+ long nXKorr =nWantWdt/20; // Korrekturmasstab 5%
+
+ long nX=(nWantWdt*100) /nIsWdt; // X-Stretching berechnen
+ long nY=(nWantHgt*100) /nIsHgt; // Y-Stretching berechnen
+ FASTBOOL bChkX=sal_True;
+ FASTBOOL bChkY=sal_True;
+ if (bNoStretching) { // #35762# evtl. nur proportional moeglich
+ if (nX>nY) { nX=nY; bChkX=sal_False; }
+ else { nY=nX; bChkY=sal_False; }
+ }
+
+ while (nLoopCount<5 && !bNoMoreLoop) {
+ if (nX<0) nX=-nX;
+ if (nX<1) { nX=1; bNoMoreLoop=sal_True; }
+ if (nX>65535) { nX=65535; bNoMoreLoop=sal_True; }
+
+ if (nY<0) nY=-nY;
+ if (nY<1) { nY=1; bNoMoreLoop=sal_True; }
+ if (nY>65535) { nY=65535; bNoMoreLoop=sal_True; }
+
+ // exception, there is no text yet (horizontal case)
+ if(nIsWdt <= 1)
+ {
+ nX = nY;
+ bNoMoreLoop = sal_True;
+ }
+
+ // #87877# exception, there is no text yet (vertical case)
+ if(nIsHgt <= 1)
+ {
+ nY = nX;
+ bNoMoreLoop = sal_True;
+ }
+
+ rOutliner.SetGlobalCharStretching((sal_uInt16)nX,(sal_uInt16)nY);
+ nLoopCount++;
+ Size aSiz(rOutliner.CalcTextSize());
+ long nXDiff=aSiz.Width()-nWantWdt;
+ rFitXKorreg=Fraction(nWantWdt,aSiz.Width());
+ if (((nXDiff>=nXTolMi || !bChkX) && nXDiff<=nXTolPl) || nXDiff==nXDiff0/*&& Abs(nYDiff)<=nYTol*/) {
+ bNoMoreLoop=sal_True;
+ } else {
+ // Stretchingfaktoren korregieren
+ long nMul=nWantWdt;
+ long nDiv=aSiz.Width();
+ if (Abs(nXDiff)<=2*nXKorr) {
+ if (nMul>nDiv) nDiv+=(nMul-nDiv)/2; // und zwar nur um die haelfte des berechneten
+ else nMul+=(nDiv-nMul)/2; // weil die EE ja eh wieder falsch rechnet
+ }
+ nX=nX*nMul/nDiv;
+ if (bNoStretching) nY=nX;
+ }
+ nXDiff0=nXDiff;
+ }
+}
+
+void SdrTextObj::StartTextAnimation(OutputDevice* /*pOutDev*/, const Point& /*rOffset*/, long /*nExtraData*/)
+{
+ // #111096#
+ // use new text animation
+ SetTextAnimationAllowed(sal_True);
+}
+
+void SdrTextObj::StopTextAnimation(OutputDevice* /*pOutDev*/, long /*nExtraData*/)
+{
+ // #111096#
+ // use new text animation
+ SetTextAnimationAllowed(sal_False);
+}
+
+void SdrTextObj::TakeObjNameSingul(XubString& rName) const
+{
+ XubString aStr;
+
+ switch(eTextKind)
+ {
+ case OBJ_OUTLINETEXT:
+ {
+ aStr = ImpGetResStr(STR_ObjNameSingulOUTLINETEXT);
+ break;
+ }
+
+ case OBJ_TITLETEXT :
+ {
+ aStr = ImpGetResStr(STR_ObjNameSingulTITLETEXT);
+ break;
+ }
+
+ default:
+ {
+ if(IsLinkedText())
+ aStr = ImpGetResStr(STR_ObjNameSingulTEXTLNK);
+ else
+ aStr = ImpGetResStr(STR_ObjNameSingulTEXT);
+ break;
+ }
+ }
+
+ OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
+ if(pOutlinerParaObject && eTextKind != OBJ_OUTLINETEXT)
+ {
+ // Macht bei OUTLINETEXT wohl derzeit noch etwas Probleme
+ XubString aStr2(pOutlinerParaObject->GetTextObject().GetText(0));
+ aStr2.EraseLeadingChars();
+
+ // #69446# avoid non expanded text portions in object name
+ // (second condition is new)
+ if(aStr2.Len() && aStr2.Search(sal_Unicode(255)) == STRING_NOTFOUND)
+ {
+ // #76681# space between ResStr and content text
+ aStr += sal_Unicode(' ');
+
+ aStr += sal_Unicode('\'');
+
+ if(aStr2.Len() > 10)
+ {
+ aStr2.Erase(8);
+ aStr2.AppendAscii("...", 3);
+ }
+
+ aStr += aStr2;
+ aStr += sal_Unicode('\'');
+ }
+ }
+
+ rName = aStr;
+
+ String aName( GetName() );
+ if(aName.Len())
+ {
+ rName += sal_Unicode(' ');
+ rName += sal_Unicode('\'');
+ rName += aName;
+ rName += sal_Unicode('\'');
+ }
+
+}
+
+void SdrTextObj::TakeObjNamePlural(XubString& rName) const
+{
+ switch (eTextKind) {
+ case OBJ_OUTLINETEXT: rName=ImpGetResStr(STR_ObjNamePluralOUTLINETEXT); break;
+ case OBJ_TITLETEXT : rName=ImpGetResStr(STR_ObjNamePluralTITLETEXT); break;
+ default: {
+ if (IsLinkedText()) {
+ rName=ImpGetResStr(STR_ObjNamePluralTEXTLNK);
+ } else {
+ rName=ImpGetResStr(STR_ObjNamePluralTEXT);
+ }
+ } break;
+ } // switch
+}
+
+void SdrTextObj::operator=(const SdrObject& rObj)
+{
+ // call parent
+ SdrObject::operator=(rObj);
+
+ const SdrTextObj* pTextObj = dynamic_cast< const SdrTextObj* >( &rObj );
+ if (pTextObj!=NULL)
+ {
+ aRect =pTextObj->aRect;
+ aGeo =pTextObj->aGeo;
+ eTextKind =pTextObj->eTextKind;
+ bTextFrame=pTextObj->bTextFrame;
+ aTextSize=pTextObj->aTextSize;
+ bTextSizeDirty=pTextObj->bTextSizeDirty;
+
+ // #101776# Not all of the necessary parameters were copied yet.
+ bNoShear = pTextObj->bNoShear;
+ bNoRotate = pTextObj->bNoRotate;
+ bNoMirror = pTextObj->bNoMirror;
+ bDisableAutoWidthOnDragging = pTextObj->bDisableAutoWidthOnDragging;
+
+ OutlinerParaObject* pNewOutlinerParaObject = 0;
+
+ SdrText* pText = getActiveText();
+
+ if( pText && pTextObj->HasText() )
+ {
+ const Outliner* pEO=pTextObj->pEdtOutl;
+ if (pEO!=NULL)
+ {
+ pNewOutlinerParaObject = pEO->CreateParaObject();
+ }
+ else
+ {
+ pNewOutlinerParaObject = new OutlinerParaObject(*pTextObj->getActiveText()->GetOutlinerParaObject());
+ }
+ }
+
+ mpText->SetOutlinerParaObject( pNewOutlinerParaObject );
+ ImpSetTextStyleSheetListeners();
+ }
+}
+
+basegfx::B2DPolyPolygon SdrTextObj::TakeXorPoly() const
+{
+ Polygon aPol(aRect);
+ if (aGeo.nShearWink!=0) ShearPoly(aPol,aRect.TopLeft(),aGeo.nTan);
+ if (aGeo.nDrehWink!=0) RotatePoly(aPol,aRect.TopLeft(),aGeo.nSin,aGeo.nCos);
+
+ basegfx::B2DPolyPolygon aRetval;
+ aRetval.append(aPol.getB2DPolygon());
+ return aRetval;
+}
+
+basegfx::B2DPolyPolygon SdrTextObj::TakeContour() const
+{
+ basegfx::B2DPolyPolygon aRetval(SdrAttrObj::TakeContour());
+
+ // und nun noch ggf. das BoundRect des Textes dazu
+ if ( pModel && GetOutlinerParaObject() && !IsFontwork() && !IsContourTextFrame() )
+ {
+ // #80328# using Clone()-Paint() strategy inside TakeContour() leaves a destroyed
+ // SdrObject as pointer in DrawOutliner. Set *this again in fetching the outliner
+ // in every case
+ SdrOutliner& rOutliner=ImpGetDrawOutliner();
+
+ Rectangle aAnchor2;
+ Rectangle aR;
+ TakeTextRect(rOutliner,aR,sal_False,&aAnchor2);
+ rOutliner.Clear();
+ SdrFitToSizeType eFit=GetFitToSize();
+ FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
+ if (bFitToSize) aR=aAnchor2;
+ Polygon aPol(aR);
+ if (aGeo.nDrehWink!=0) RotatePoly(aPol,aR.TopLeft(),aGeo.nSin,aGeo.nCos);
+
+ aRetval.append(aPol.getB2DPolygon());
+ }
+
+ return aRetval;
+}
+
+void SdrTextObj::RecalcSnapRect()
+{
+ if (aGeo.nDrehWink!=0 || aGeo.nShearWink!=0) {
+ Polygon aPol(aRect);
+ if (aGeo.nShearWink!=0) ShearPoly(aPol,aRect.TopLeft(),aGeo.nTan);
+ if (aGeo.nDrehWink!=0) RotatePoly(aPol,aRect.TopLeft(),aGeo.nSin,aGeo.nCos);
+ maSnapRect=aPol.GetBoundRect();
+ } else {
+ maSnapRect=aRect;
+ }
+}
+
+sal_uInt32 SdrTextObj::GetSnapPointCount() const
+{
+ return 4L;
+}
+
+Point SdrTextObj::GetSnapPoint(sal_uInt32 i) const
+{
+ Point aP;
+ switch (i) {
+ case 0: aP=aRect.TopLeft(); break;
+ case 1: aP=aRect.TopRight(); break;
+ case 2: aP=aRect.BottomLeft(); break;
+ case 3: aP=aRect.BottomRight(); break;
+ default: aP=aRect.Center(); break;
+ }
+ if (aGeo.nShearWink!=0) ShearPoint(aP,aRect.TopLeft(),aGeo.nTan);
+ if (aGeo.nDrehWink!=0) RotatePoint(aP,aRect.TopLeft(),aGeo.nSin,aGeo.nCos);
+ return aP;
+}
+
+void SdrTextObj::ImpCheckMasterCachable()
+{
+ bNotMasterCachable=sal_False;
+
+ OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
+
+ if(!bNotVisibleAsMaster && pOutlinerParaObject && pOutlinerParaObject->IsEditDoc() )
+ {
+ const EditTextObject& rText= pOutlinerParaObject->GetTextObject();
+ bNotMasterCachable=rText.HasField(SvxPageField::StaticType());
+ if( !bNotMasterCachable )
+ {
+ bNotMasterCachable=rText.HasField(SvxHeaderField::StaticType());
+ if( !bNotMasterCachable )
+ {
+ bNotMasterCachable=rText.HasField(SvxFooterField::StaticType());
+ if( !bNotMasterCachable )
+ {
+ bNotMasterCachable=rText.HasField(SvxDateTimeField::StaticType());
+ }
+ }
+ }
+ }
+}
+
+// #101029#: Extracted from ImpGetDrawOutliner()
+void SdrTextObj::ImpInitDrawOutliner( SdrOutliner& rOutl ) const
+{
+ rOutl.SetUpdateMode(sal_False);
+ sal_uInt16 nOutlinerMode = OUTLINERMODE_OUTLINEOBJECT;
+ if ( !IsOutlText() )
+ nOutlinerMode = OUTLINERMODE_TEXTOBJECT;
+ rOutl.Init( nOutlinerMode );
+
+ rOutl.SetGlobalCharStretching(100,100);
+ sal_uIntPtr nStat=rOutl.GetControlWord();
+ nStat&=~(EE_CNTRL_STRETCHING|EE_CNTRL_AUTOPAGESIZE);
+ rOutl.SetControlWord(nStat);
+ Size aNullSize;
+ Size aMaxSize(100000,100000);
+ rOutl.SetMinAutoPaperSize(aNullSize);
+ rOutl.SetMaxAutoPaperSize(aMaxSize);
+ rOutl.SetPaperSize(aMaxSize);
+ rOutl.ClearPolygon();
+}
+
+SdrOutliner& SdrTextObj::ImpGetDrawOutliner() const
+{
+ SdrOutliner& rOutl=pModel->GetDrawOutliner(this);
+
+ // #101029#: Code extracted to ImpInitDrawOutliner()
+ ImpInitDrawOutliner( rOutl );
+
+ return rOutl;
+}
+
+boost::shared_ptr< SdrOutliner > SdrTextObj::CreateDrawOutliner()
+{
+ boost::shared_ptr< SdrOutliner > xDrawOutliner( pModel->CreateDrawOutliner(this) );
+ ImpInitDrawOutliner( *(xDrawOutliner.get()) );
+ return xDrawOutliner;
+}
+
+// #101029#: Extracted from Paint()
+void SdrTextObj::ImpSetupDrawOutlinerForPaint( FASTBOOL bContourFrame,
+ SdrOutliner& rOutliner,
+ Rectangle& rTextRect,
+ Rectangle& rAnchorRect,
+ Rectangle& rPaintRect,
+ Fraction& rFitXKorreg ) const
+{
+ if (!bContourFrame)
+ {
+ // FitToSize erstmal nicht mit ContourFrame
+ SdrFitToSizeType eFit=GetFitToSize();
+ if (eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES)
+ {
+ sal_uIntPtr nStat=rOutliner.GetControlWord();
+ nStat|=EE_CNTRL_STRETCHING|EE_CNTRL_AUTOPAGESIZE;
+ rOutliner.SetControlWord(nStat);
+ }
+ }
+ rOutliner.SetFixedCellHeight(((const SdrTextFixedCellHeightItem&)GetMergedItem(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue());
+ TakeTextRect(rOutliner, rTextRect, sal_False, &rAnchorRect);
+ rPaintRect = rTextRect;
+
+ if (!bContourFrame)
+ {
+ // FitToSize erstmal nicht mit ContourFrame
+ SdrFitToSizeType eFit=GetFitToSize();
+ if (eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES)
+ {
+ ImpSetCharStretching(rOutliner,rTextRect,rAnchorRect,rFitXKorreg);
+ rPaintRect=rAnchorRect;
+ }
+ }
+}
+
+void SdrTextObj::SetupOutlinerFormatting( SdrOutliner& rOutl, Rectangle& rPaintRect ) const
+{
+ ImpInitDrawOutliner( rOutl );
+ UpdateOutlinerFormatting( rOutl, rPaintRect );
+}
+
+void SdrTextObj::UpdateOutlinerFormatting( SdrOutliner& rOutl, Rectangle& rPaintRect ) const
+{
+ Rectangle aTextRect;
+ Rectangle aAnchorRect;
+ Fraction aFitXKorreg(1,1);
+
+ FASTBOOL bContourFrame=IsContourTextFrame();
+
+ if( GetModel() )
+ {
+ MapMode aMapMode(GetModel()->GetScaleUnit(), Point(0,0),
+ GetModel()->GetScaleFraction(),
+ GetModel()->GetScaleFraction());
+ rOutl.SetRefMapMode(aMapMode);
+ }
+
+ ImpSetupDrawOutlinerForPaint( bContourFrame, rOutl, aTextRect, aAnchorRect, rPaintRect, aFitXKorreg );
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+OutlinerParaObject* SdrTextObj::GetOutlinerParaObject() const
+{
+ SdrText* pText = getActiveText();
+ if( pText )
+ return pText->GetOutlinerParaObject();
+ else
+ return 0;
+}
+
+bool SdrTextObj::HasOutlinerParaObject() const
+{
+ SdrText* pText = getActiveText();
+ if( pText && pText->GetOutlinerParaObject() )
+ return true;
+ return false;
+}
+
+void SdrTextObj::NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject)
+{
+ NbcSetOutlinerParaObjectForText( pTextObject, getActiveText() );
+}
+
+void SdrTextObj::NbcSetOutlinerParaObjectForText( OutlinerParaObject* pTextObject, SdrText* pText )
+{
+ if( pText )
+ pText->SetOutlinerParaObject( pTextObject );
+
+ if( pText->GetOutlinerParaObject() )
+ {
+ SvxWritingModeItem aWritingMode(pText->GetOutlinerParaObject()->IsVertical()
+ ? com::sun::star::text::WritingMode_TB_RL
+ : com::sun::star::text::WritingMode_LR_TB,
+ SDRATTR_TEXTDIRECTION);
+ GetProperties().SetObjectItemDirect(aWritingMode);
+ }
+
+ SetTextSizeDirty();
+ if (IsTextFrame() && (IsAutoGrowHeight() || IsAutoGrowWidth()))
+ { // Textrahmen anpassen!
+ NbcAdjustTextFrameWidthAndHeight();
+ }
+ if (!IsTextFrame())
+ {
+ // Das SnapRect behaelt seine Groesse bei
+ SetRectsDirty(sal_True);
+ }
+
+ // always invalidate BoundRect on change
+ SetBoundRectDirty();
+ ActionChanged();
+
+ ImpSetTextStyleSheetListeners();
+ ImpCheckMasterCachable();
+}
+
+void SdrTextObj::NbcReformatText()
+{
+ SdrText* pText = getActiveText();
+ if( pText && pText->GetOutlinerParaObject() )
+ {
+ pText->ReformatText();
+ if (bTextFrame)
+ {
+ NbcAdjustTextFrameWidthAndHeight();
+ }
+ else
+ {
+ // Das SnapRect behaelt seine Groesse bei
+ SetBoundRectDirty();
+ SetRectsDirty(sal_True);
+ }
+ SetTextSizeDirty();
+ ActionChanged();
+ // FME, AW: i22396
+ // Necessary here since we have no compare operator at the outliner
+ // para object which may detect changes regarding the combination
+ // of outliner para data and configuration (e.g., change of
+ // formatting of text numerals)
+ GetViewContact().flushViewObjectContacts(false);
+ }
+}
+
+void SdrTextObj::ReformatText()
+{
+ if(GetOutlinerParaObject())
+ {
+ Rectangle aBoundRect0;
+ if (pUserCall!=NULL)
+ aBoundRect0=GetLastBoundRect();
+
+ // #110094#-14 SendRepaintBroadcast();
+ NbcReformatText();
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+ }
+}
+
+SdrObjGeoData* SdrTextObj::NewGeoData() const
+{
+ return new SdrTextObjGeoData;
+}
+
+void SdrTextObj::SaveGeoData(SdrObjGeoData& rGeo) const
+{
+ SdrAttrObj::SaveGeoData(rGeo);
+ SdrTextObjGeoData& rTGeo=(SdrTextObjGeoData&)rGeo;
+ rTGeo.aRect =aRect;
+ rTGeo.aGeo =aGeo;
+}
+
+void SdrTextObj::RestGeoData(const SdrObjGeoData& rGeo)
+{ // RectsDirty wird von SdrObject gerufen
+ SdrAttrObj::RestGeoData(rGeo);
+ SdrTextObjGeoData& rTGeo=(SdrTextObjGeoData&)rGeo;
+ aRect =rTGeo.aRect;
+ aGeo =rTGeo.aGeo;
+ SetTextSizeDirty();
+}
+
+SdrFitToSizeType SdrTextObj::GetFitToSize() const
+{
+ SdrFitToSizeType eType = SDRTEXTFIT_NONE;
+
+ if(!IsAutoGrowWidth())
+ eType = ((SdrTextFitToSizeTypeItem&)(GetObjectItem(SDRATTR_TEXT_FITTOSIZE))).GetValue();
+
+ return eType;
+}
+
+void SdrTextObj::ForceOutlinerParaObject()
+{
+ SdrText* pText = getActiveText();
+ if( pText && (pText->GetOutlinerParaObject() == 0) )
+ {
+ sal_uInt16 nOutlMode = OUTLINERMODE_TEXTOBJECT;
+ if( IsTextFrame() && eTextKind == OBJ_OUTLINETEXT )
+ nOutlMode = OUTLINERMODE_OUTLINEOBJECT;
+
+ pText->ForceOutlinerParaObject( nOutlMode );
+ }
+}
+
+sal_Bool SdrTextObj::IsVerticalWriting() const
+{
+ // #89459#
+ if(pEdtOutl)
+ {
+ return pEdtOutl->IsVertical();
+ }
+
+ OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
+ if(pOutlinerParaObject)
+ {
+ return pOutlinerParaObject->IsVertical();
+ }
+
+ return sal_False;
+}
+
+void SdrTextObj::SetVerticalWriting(sal_Bool bVertical)
+{
+ OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
+ if( !pOutlinerParaObject && bVertical )
+ {
+ // we only need to force a outliner para object if the default of
+ // horizontal text is changed
+ ForceOutlinerParaObject();
+ pOutlinerParaObject = GetOutlinerParaObject();
+ }
+
+ if( pOutlinerParaObject && (pOutlinerParaObject->IsVertical() != (bool)bVertical) )
+ {
+ // get item settings
+ const SfxItemSet& rSet = GetObjectItemSet();
+ sal_Bool bAutoGrowWidth = ((SdrTextAutoGrowWidthItem&)rSet.Get(SDRATTR_TEXT_AUTOGROWWIDTH)).GetValue();
+ sal_Bool bAutoGrowHeight = ((SdrTextAutoGrowHeightItem&)rSet.Get(SDRATTR_TEXT_AUTOGROWHEIGHT)).GetValue();
+
+ // #103516# Also exchange hor/ver adjust items
+ SdrTextHorzAdjust eHorz = ((SdrTextHorzAdjustItem&)(rSet.Get(SDRATTR_TEXT_HORZADJUST))).GetValue();
+ SdrTextVertAdjust eVert = ((SdrTextVertAdjustItem&)(rSet.Get(SDRATTR_TEXT_VERTADJUST))).GetValue();
+
+ // rescue object size
+ Rectangle aObjectRect = GetSnapRect();
+
+ // prepare ItemSet to set exchanged width and height items
+ SfxItemSet aNewSet(*rSet.GetPool(),
+ SDRATTR_TEXT_AUTOGROWHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT,
+ // #103516# Expanded item ranges to also support hor and ver adjust.
+ SDRATTR_TEXT_VERTADJUST, SDRATTR_TEXT_VERTADJUST,
+ SDRATTR_TEXT_AUTOGROWWIDTH, SDRATTR_TEXT_HORZADJUST,
+ 0, 0);
+
+ aNewSet.Put(rSet);
+ aNewSet.Put(SdrTextAutoGrowWidthItem(bAutoGrowHeight));
+ aNewSet.Put(SdrTextAutoGrowHeightItem(bAutoGrowWidth));
+
+ // #103516# Exchange horz and vert adjusts
+ switch(eVert)
+ {
+ case SDRTEXTVERTADJUST_TOP: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT)); break;
+ case SDRTEXTVERTADJUST_CENTER: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER)); break;
+ case SDRTEXTVERTADJUST_BOTTOM: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT)); break;
+ case SDRTEXTVERTADJUST_BLOCK: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_BLOCK)); break;
+ }
+ switch(eHorz)
+ {
+ case SDRTEXTHORZADJUST_LEFT: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_BOTTOM)); break;
+ case SDRTEXTHORZADJUST_CENTER: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER)); break;
+ case SDRTEXTHORZADJUST_RIGHT: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP)); break;
+ case SDRTEXTHORZADJUST_BLOCK: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_BLOCK)); break;
+ }
+
+ SetObjectItemSet(aNewSet);
+
+ pOutlinerParaObject = GetOutlinerParaObject();
+ if( pOutlinerParaObject )
+ {
+ // set ParaObject orientation accordingly
+ pOutlinerParaObject->SetVertical(bVertical);
+ }
+
+ // restore object size
+ SetSnapRect(aObjectRect);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// transformation interface for StarOfficeAPI. This implements support for
+// homogen 3x3 matrices containing the transformation of the SdrObject. At the
+// moment it contains a shearX, rotation and translation, but for setting all linear
+// transforms like Scale, ShearX, ShearY, Rotate and Translate are supported.
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon
+// with the base geometry and returns TRUE. Otherwise it returns FALSE.
+sal_Bool SdrTextObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& /*rPolyPolygon*/) const
+{
+ // get turn and shear
+ double fRotate = (aGeo.nDrehWink / 100.0) * F_PI180;
+ double fShearX = (aGeo.nShearWink / 100.0) * F_PI180;
+
+ // get aRect, this is the unrotated snaprect
+ Rectangle aRectangle(aRect);
+
+ // fill other values
+ basegfx::B2DTuple aScale(aRectangle.GetWidth(), aRectangle.GetHeight());
+ basegfx::B2DTuple aTranslate(aRectangle.Left(), aRectangle.Top());
+
+ // position maybe relative to anchorpos, convert
+ if( pModel && pModel->IsWriter() )
+ {
+ if(GetAnchorPos().X() || GetAnchorPos().Y())
+ {
+ aTranslate -= basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
+ }
+ }
+
+ // force MapUnit to 100th mm
+ SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
+ if(eMapUnit != SFX_MAPUNIT_100TH_MM)
+ {
+ switch(eMapUnit)
+ {
+ case SFX_MAPUNIT_TWIP :
+ {
+ // postion
+ aTranslate.setX(ImplTwipsToMM(aTranslate.getX()));
+ aTranslate.setY(ImplTwipsToMM(aTranslate.getY()));
+
+ // size
+ aScale.setX(ImplTwipsToMM(aScale.getX()));
+ aScale.setY(ImplTwipsToMM(aScale.getY()));
+
+ break;
+ }
+ default:
+ {
+ DBG_ERROR("TRGetBaseGeometry: Missing unit translation to 100th mm!");
+ }
+ }
+ }
+
+ // build matrix
+ rMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ aScale,
+ basegfx::fTools::equalZero(fShearX) ? 0.0 : tan(fShearX),
+ basegfx::fTools::equalZero(fRotate) ? 0.0 : -fRotate,
+ aTranslate);
+
+ return sal_False;
+}
+
+// sets the base geometry of the object using infos contained in the homogen 3x3 matrix.
+// If it's an SdrPathObj it will use the provided geometry information. The Polygon has
+// to use (0,0) as upper left and will be scaled to the given size in the matrix.
+void SdrTextObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& /*rPolyPolygon*/)
+{
+ // break up matrix
+ basegfx::B2DTuple aScale;
+ basegfx::B2DTuple aTranslate;
+ double fRotate(0.0);
+ double fShearX(0.0);
+ rMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
+
+ // #i75086# Old DrawingLayer (GeoStat and geometry) does not support holding negative scalings
+ // in X and Y which equal a 180 degree rotation. Recognize it and react accordingly
+ if(basegfx::fTools::less(aScale.getX(), 0.0) && basegfx::fTools::less(aScale.getY(), 0.0))
+ {
+ aScale.setX(fabs(aScale.getX()));
+ aScale.setY(fabs(aScale.getY()));
+ fRotate = fmod(fRotate + F_PI, F_2PI);
+ }
+
+ // reset object shear and rotations
+ aGeo.nDrehWink = 0;
+ aGeo.RecalcSinCos();
+ aGeo.nShearWink = 0;
+ aGeo.RecalcTan();
+
+ // force metric to pool metric
+ SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
+ if(eMapUnit != SFX_MAPUNIT_100TH_MM)
+ {
+ switch(eMapUnit)
+ {
+ case SFX_MAPUNIT_TWIP :
+ {
+ // position
+ aTranslate.setX(ImplMMToTwips(aTranslate.getX()));
+ aTranslate.setY(ImplMMToTwips(aTranslate.getY()));
+
+ // size
+ aScale.setX(ImplMMToTwips(aScale.getX()));
+ aScale.setY(ImplMMToTwips(aScale.getY()));
+
+ break;
+ }
+ default:
+ {
+ DBG_ERROR("TRSetBaseGeometry: Missing unit translation to PoolMetric!");
+ }
+ }
+ }
+
+ // if anchor is used, make position relative to it
+ if( pModel && pModel->IsWriter() )
+ {
+ if(GetAnchorPos().X() || GetAnchorPos().Y())
+ {
+ aTranslate += basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
+ }
+ }
+
+ // build and set BaseRect (use scale)
+ Point aPoint = Point();
+ Size aSize(FRound(aScale.getX()), FRound(aScale.getY()));
+ Rectangle aBaseRect(aPoint, aSize);
+ 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, sal_False);
+ }
+
+ // rotation?
+ if(!basegfx::fTools::equalZero(fRotate))
+ {
+ GeoStat aGeoStat;
+
+ // #i78696#
+ // fRotate is matematically correct, but aGeoStat.nDrehWink is
+ // mirrored -> mirror value here
+ aGeoStat.nDrehWink = NormAngle360(FRound(-fRotate / F_PI18000));
+ aGeoStat.RecalcSinCos();
+ Rotate(Point(), aGeoStat.nDrehWink, aGeoStat.nSin, aGeoStat.nCos);
+ }
+
+ // translate?
+ if(!aTranslate.equalZero())
+ {
+ Move(Size(FRound(aTranslate.getX()), FRound(aTranslate.getY())));
+ }
+}
+
+bool SdrTextObj::IsRealyEdited() const
+{
+ return pEdtOutl && pEdtOutl->IsModified();
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////////////
+// moved inlines here form hxx
+
+long SdrTextObj::GetEckenradius() const
+{
+ return ((SdrEckenradiusItem&)(GetObjectItemSet().Get(SDRATTR_ECKENRADIUS))).GetValue();
+}
+
+long SdrTextObj::GetMinTextFrameHeight() const
+{
+ return ((SdrTextMinFrameHeightItem&)(GetObjectItemSet().Get(SDRATTR_TEXT_MINFRAMEHEIGHT))).GetValue();
+}
+
+long SdrTextObj::GetMaxTextFrameHeight() const
+{
+ return ((SdrTextMaxFrameHeightItem&)(GetObjectItemSet().Get(SDRATTR_TEXT_MAXFRAMEHEIGHT))).GetValue();
+}
+
+long SdrTextObj::GetMinTextFrameWidth() const
+{
+ return ((SdrTextMinFrameWidthItem&)(GetObjectItemSet().Get(SDRATTR_TEXT_MINFRAMEWIDTH))).GetValue();
+}
+
+long SdrTextObj::GetMaxTextFrameWidth() const
+{
+ return ((SdrTextMaxFrameWidthItem&)(GetObjectItemSet().Get(SDRATTR_TEXT_MAXFRAMEWIDTH))).GetValue();
+}
+
+FASTBOOL SdrTextObj::IsFontwork() const
+{
+ return (bTextFrame) ? sal_False // Default ist FALSE
+ : ((XFormTextStyleItem&)(GetObjectItemSet().Get(XATTR_FORMTXTSTYLE))).GetValue()!=XFT_NONE;
+}
+
+FASTBOOL SdrTextObj::IsHideContour() const
+{
+ return (bTextFrame) ? sal_False // Default ist: Nein, kein HideContour; HideContour nicht bei TextFrames
+ : ((XFormTextHideFormItem&)(GetObjectItemSet().Get(XATTR_FORMTXTHIDEFORM))).GetValue();
+}
+
+FASTBOOL SdrTextObj::IsContourTextFrame() const
+{
+ return (bTextFrame) ? sal_False // ContourFrame nicht bei normalen TextFrames
+ : ((SdrTextContourFrameItem&)(GetObjectItemSet().Get(SDRATTR_TEXT_CONTOURFRAME))).GetValue();
+}
+
+long SdrTextObj::GetTextLeftDistance() const
+{
+ return ((SdrTextLeftDistItem&)(GetObjectItemSet().Get(SDRATTR_TEXT_LEFTDIST))).GetValue();
+}
+
+long SdrTextObj::GetTextRightDistance() const
+{
+ return ((SdrTextRightDistItem&)(GetObjectItemSet().Get(SDRATTR_TEXT_RIGHTDIST))).GetValue();
+}
+
+long SdrTextObj::GetTextUpperDistance() const
+{
+ return ((SdrTextUpperDistItem&)(GetObjectItemSet().Get(SDRATTR_TEXT_UPPERDIST))).GetValue();
+}
+
+long SdrTextObj::GetTextLowerDistance() const
+{
+ return ((SdrTextLowerDistItem&)(GetObjectItemSet().Get(SDRATTR_TEXT_LOWERDIST))).GetValue();
+}
+
+SdrTextAniKind SdrTextObj::GetTextAniKind() const
+{
+ return ((SdrTextAniKindItem&)(GetObjectItemSet().Get(SDRATTR_TEXT_ANIKIND))).GetValue();
+}
+
+SdrTextAniDirection SdrTextObj::GetTextAniDirection() const
+{
+ return ((SdrTextAniDirectionItem&)(GetObjectItemSet().Get(SDRATTR_TEXT_ANIDIRECTION))).GetValue();
+}
+
+// #111096#
+// Access to thext hidden flag
+sal_Bool SdrTextObj::GetTextHidden() const
+{
+ return mbTextHidden;
+}
+
+void SdrTextObj::NbcSetTextHidden(sal_Bool bNew)
+{
+ if(bNew != mbTextHidden)
+ {
+ mbTextHidden = bNew;
+ }
+}
+
+// #111096#
+// Get necessary data for text scroll animation. ATM base it on a Text-Metafile and a
+// painting rectangle. Rotation is excluded from the returned values.
+GDIMetaFile* SdrTextObj::GetTextScrollMetaFileAndRectangle(
+ Rectangle& rScrollRectangle, Rectangle& rPaintRectangle)
+{
+ GDIMetaFile* pRetval = 0L;
+ SdrOutliner& rOutliner = ImpGetDrawOutliner();
+ Rectangle aTextRect;
+ Rectangle aAnchorRect;
+ Rectangle aPaintRect;
+ Fraction aFitXKorreg(1,1);
+ bool bContourFrame(IsContourTextFrame());
+
+ // get outliner set up. To avoid getting a somehow rotated MetaFile,
+ // temporarily disable object rotation.
+ sal_Int32 nAngle(aGeo.nDrehWink);
+ aGeo.nDrehWink = 0L;
+ ImpSetupDrawOutlinerForPaint( bContourFrame, rOutliner, aTextRect, aAnchorRect, aPaintRect, aFitXKorreg );
+ aGeo.nDrehWink = nAngle;
+
+ Rectangle aScrollFrameRect(aPaintRect);
+ const SfxItemSet& rSet = GetObjectItemSet();
+ SdrTextAniDirection eDirection = ((SdrTextAniDirectionItem&)(rSet.Get(SDRATTR_TEXT_ANIDIRECTION))).GetValue();
+
+ if(SDRTEXTANI_LEFT == eDirection || SDRTEXTANI_RIGHT == eDirection)
+ {
+ aScrollFrameRect.Left() = aAnchorRect.Left();
+ aScrollFrameRect.Right() = aAnchorRect.Right();
+ }
+
+ if(SDRTEXTANI_UP == eDirection || SDRTEXTANI_DOWN == eDirection)
+ {
+ aScrollFrameRect.Top() = aAnchorRect.Top();
+ aScrollFrameRect.Bottom() = aAnchorRect.Bottom();
+ }
+
+ // create the MetaFile
+ pRetval = new GDIMetaFile;
+ VirtualDevice aBlackHole;
+ aBlackHole.EnableOutput(sal_False);
+ pRetval->Record(&aBlackHole);
+ Point aPaintPos = aPaintRect.TopLeft();
+
+ rOutliner.Draw(&aBlackHole, aPaintPos);
+
+ pRetval->Stop();
+ pRetval->WindStart();
+
+ // return PaintRectanglePixel and pRetval;
+ rScrollRectangle = aScrollFrameRect;
+ rPaintRectangle = aPaintRect;
+
+ return pRetval;
+}
+
+// #111096#
+// Access to TextAnimationAllowed flag
+bool SdrTextObj::IsTextAnimationAllowed() const
+{
+ return mbTextAnimationAllowed;
+}
+
+void SdrTextObj::SetTextAnimationAllowed(sal_Bool bNew)
+{
+ if(mbTextAnimationAllowed != bNew)
+ {
+ mbTextAnimationAllowed = bNew;
+ ActionChanged();
+ }
+}
+
+/** called from the SdrObjEditView during text edit when the status of the edit outliner changes */
+void SdrTextObj::onEditOutlinerStatusEvent( EditStatus* pEditStatus )
+{
+ const sal_uInt32 nStat = pEditStatus->GetStatusWord();
+ const bool bGrowX=(nStat & EE_STAT_TEXTWIDTHCHANGED) !=0;
+ const bool bGrowY=(nStat & EE_STAT_TEXTHEIGHTCHANGED) !=0;
+ if(bTextFrame && (bGrowX || bGrowY))
+ {
+ const bool bAutoGrowHgt= bTextFrame && IsAutoGrowHeight();
+ const bool bAutoGrowWdt= bTextFrame && IsAutoGrowWidth();
+
+ if ((bGrowX && bAutoGrowWdt) || (bGrowY && bAutoGrowHgt))
+ {
+ AdjustTextFrameWidthAndHeight();
+ }
+ }
+}
+
+/** returns the currently active text. */
+SdrText* SdrTextObj::getActiveText() const
+{
+ if( !mpText )
+ return getText( 0 );
+ else
+ return mpText;
+}
+
+/** returns the nth available text. */
+SdrText* SdrTextObj::getText( sal_Int32 nIndex ) const
+{
+ if( nIndex == 0 )
+ {
+ if( mpText == 0 )
+ const_cast< SdrTextObj* >(this)->mpText = new SdrText( *(const_cast< SdrTextObj* >(this)) );
+ return mpText;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+/** returns the number of texts available for this object. */
+sal_Int32 SdrTextObj::getTextCount() const
+{
+ return 1;
+}
+
+/** changes the current active text */
+void SdrTextObj::setActiveText( sal_Int32 /*nIndex*/ )
+{
+}
+
+/** returns the index of the text that contains the given point or -1 */
+sal_Int32 SdrTextObj::CheckTextHit(const Point& /*rPnt*/) const
+{
+ return 0;
+}
+
+void SdrTextObj::SetObjectItemNoBroadcast(const SfxPoolItem& rItem)
+{
+ static_cast< sdr::properties::TextProperties& >(GetProperties()).SetObjectItemNoBroadcast(rItem);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// Konzept des TextObjekts:
+// ~~~~~~~~~~~~~~~~~~~~~~~~
+// Attribute/Varianten:
+// - sal_Bool Textrahmen / beschriftetes Zeichenobjekt
+// - sal_Bool FontWork (wenn nicht Textrahmen und nicht ContourTextFrame)
+// - sal_Bool ContourTextFrame (wenn nicht Textrahmen und nicht Fontwork)
+// - long Drehwinkel (wenn nicht FontWork)
+// - long Textrahmenabstaende (wenn nicht FontWork)
+// - sal_Bool FitToSize (wenn nicht FontWork)
+// - sal_Bool AutoGrowingWidth/Height (wenn nicht FitToSize und nicht FontWork)
+// - long Min/MaxFrameWidth/Height (wenn AutoGrowingWidth/Height)
+// - enum Horizontale Textverankerung Links,Mitte,Rechts,Block,Stretch(ni)
+// - enum Vertikale Textverankerung Oben,Mitte,Unten,Block,Stretch(ni)
+// - enum Laufschrift (wenn nicht FontWork)
+//
+// Jedes abgeleitete Objekt ist entweder ein Textrahmen (bTextFrame=sal_True)
+// oder ein beschriftetes Zeichenobjekt (bTextFrame=sal_False).
+//
+// Defaultverankerung von Textrahmen:
+// SDRTEXTHORZADJUST_BLOCK, SDRTEXTVERTADJUST_TOP
+// = statische Pooldefaults
+// Defaultverankerung von beschrifteten Zeichenobjekten:
+// SDRTEXTHORZADJUST_CENTER, SDRTEXTVERTADJUST_CENTER
+// durch harte Attributierung von SdrAttrObj
+//
+// Jedes vom SdrTextObj abgeleitete Objekt muss ein "UnrotatedSnapRect"
+// (->TakeUnrotatedSnapRect()) liefern (Drehreferenz ist TopLeft dieses
+// Rechtecks (aGeo.nDrehWink)), welches die Grundlage der Textverankerung
+// bildet. Von diesem werden dann ringsum die Textrahmenabstaende abgezogen;
+// das Ergebnis ist der Ankerbereich (->TakeTextAnchorRect()). Innerhalb
+// dieses Bereichs wird dann in Abhaengigkeit von der horizontalen und
+// vertikalen Ausrichtung (SdrTextVertAdjust,SdrTextHorzAdjust) der Ankerpunkt
+// sowie der Ausgabebereich bestimmt. Bei beschrifteten Grafikobjekten kann
+// der Ausgabebereich durchaus groesser als der Ankerbereich werden, bei
+// Textrahmen ist er stets kleiner oder gleich (ausser bei negativen Textrahmen-
+// abstaenden).
+//
+// FitToSize hat Prioritaet vor Textverankerung und AutoGrowHeight/Width. Der
+// Ausgabebereich ist bei FitToSize immer genau der Ankerbereich. Weiterhin
+// gibt es bei FitToSize keinen automatischen Zeilenumbruch.
+//
+// ContourTextFrame:
+// - long Drehwinkel
+// - long Textrahmenabstaende spaeter vielleicht
+// - sal_Bool FitToSize spaeter vielleicht
+// - sal_Bool AutoGrowingWidth/Height viel spaeter vielleicht
+// - long Min/MaxFrameWidth/Height viel spaeter vielleicht
+// - enum Horizontale Textverankerung spaeter vielleicht, erstmal Links, Absatz zentr.
+// - enum Vertikale Textverankerung spaeter vielleicht, erstmal oben
+// - enum Laufschrift spaeter vielleicht (evtl. sogar mit korrektem Clipping)
+//
+// Bei Aenderungen zu beachten:
+// - Paint
+// - HitTest
+// - ConvertToPoly
+// - Edit
+// - Drucken,Speichern, Paint in Nachbarview waerend Edit
+// - ModelChanged (z.B. durch NachbarView oder Lineale) waerend Edit
+// - FillColorChanged waerend Edit
+// - uvm...
+//
+/////////////////////////////////////////////////////////////////////////////////////////////////
+
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
new file mode 100644
index 000000000000..9bc3bbb4958c
--- /dev/null
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -0,0 +1,1258 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svdotext.hxx>
+#include <svx/svdoutl.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <svx/sdr/primitive2d/sdrtextprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textdecoratedprimitive2d.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <editeng/editstat.hxx>
+#include <vcl/salbtype.hxx>
+#include <svx/sdtfchim.hxx>
+#include <svl/itemset.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <drawinglayer/animation/animationtiming.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <vcl/svapp.hxx>
+#include <editeng/eeitemid.hxx>
+#include <editeng/escpitem.hxx>
+#include <editeng/svxenum.hxx>
+#include <editeng/flditem.hxx>
+#include <drawinglayer/primitive2d/texthierarchyprimitive2d.hxx>
+#include <vcl/metaact.hxx>
+#include <drawinglayer/primitive2d/wrongspellprimitive2d.hxx>
+#include <drawinglayer/primitive2d/graphicprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textlayoutdevice.hxx>
+#include <svx/unoapi.hxx>
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+#include <editeng/outlobj.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// helpers
+
+namespace
+{
+ drawinglayer::primitive2d::Primitive2DSequence impConvertVectorToPrimitive2DSequence(const std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rPrimitiveVector)
+ {
+ const sal_Int32 nCount(rPrimitiveVector.size());
+ drawinglayer::primitive2d::Primitive2DSequence aRetval(nCount);
+
+ for(sal_Int32 a(0L); a < nCount; a++)
+ {
+ aRetval[a] = drawinglayer::primitive2d::Primitive2DReference(rPrimitiveVector[a]);
+ }
+
+ return aRetval;
+ }
+
+ class impTextBreakupHandler
+ {
+ private:
+ std::vector< drawinglayer::primitive2d::BasePrimitive2D* > maTextPortionPrimitives;
+ std::vector< drawinglayer::primitive2d::BasePrimitive2D* > maLinePrimitives;
+ std::vector< drawinglayer::primitive2d::BasePrimitive2D* > maParagraphPrimitives;
+
+ SdrOutliner& mrOutliner;
+ basegfx::B2DHomMatrix maNewTransformA;
+ basegfx::B2DHomMatrix maNewTransformB;
+
+ // the visible area for contour text decomposition
+ basegfx::B2DVector maScale;
+
+ // #SJ# ClipRange for BlockText decomposition; only text portions completely
+ // inside are to be accepted, so this is different from geometric clipping
+ // (which would allow e.g. upper parts of portions to remain). Only used for
+ // BlockText (see there)
+ basegfx::B2DRange maClipRange;
+
+ DECL_LINK(decomposeContourTextPrimitive, DrawPortionInfo* );
+ DECL_LINK(decomposeBlockTextPrimitive, DrawPortionInfo* );
+ DECL_LINK(decomposeStretchTextPrimitive, DrawPortionInfo* );
+
+ DECL_LINK(decomposeContourBulletPrimitive, DrawBulletInfo* );
+ DECL_LINK(decomposeBlockBulletPrimitive, DrawBulletInfo* );
+ DECL_LINK(decomposeStretchBulletPrimitive, DrawBulletInfo* );
+
+ bool impIsUnderlineAbove(const Font& rFont) const;
+ void impCreateTextPortionPrimitive(const DrawPortionInfo& rInfo);
+ drawinglayer::primitive2d::BasePrimitive2D* impCheckFieldPrimitive(drawinglayer::primitive2d::BasePrimitive2D* pPrimitive, const DrawPortionInfo& rInfo) const;
+ void impFlushTextPortionPrimitivesToLinePrimitives();
+ void impFlushLinePrimitivesToParagraphPrimitives();
+ void impHandleDrawPortionInfo(const DrawPortionInfo& rInfo);
+ void impHandleDrawBulletInfo(const DrawBulletInfo& rInfo);
+
+ public:
+ impTextBreakupHandler(SdrOutliner& rOutliner)
+ : maTextPortionPrimitives(),
+ maLinePrimitives(),
+ maParagraphPrimitives(),
+ mrOutliner(rOutliner),
+ maNewTransformA(),
+ maNewTransformB(),
+ maScale(),
+ maClipRange()
+ {
+ }
+
+ void decomposeContourTextPrimitive(const basegfx::B2DHomMatrix& rNewTransformA, const basegfx::B2DHomMatrix& rNewTransformB, const basegfx::B2DVector& rScale)
+ {
+ maScale = rScale;
+ maNewTransformA = rNewTransformA;
+ maNewTransformB = rNewTransformB;
+ mrOutliner.SetDrawPortionHdl(LINK(this, impTextBreakupHandler, decomposeContourTextPrimitive));
+ mrOutliner.SetDrawBulletHdl(LINK(this, impTextBreakupHandler, decomposeContourBulletPrimitive));
+ mrOutliner.StripPortions();
+ mrOutliner.SetDrawPortionHdl(Link());
+ mrOutliner.SetDrawBulletHdl(Link());
+ }
+
+ void decomposeBlockTextPrimitive(
+ const basegfx::B2DHomMatrix& rNewTransformA,
+ const basegfx::B2DHomMatrix& rNewTransformB,
+ const basegfx::B2DRange& rClipRange)
+ {
+ maNewTransformA = rNewTransformA;
+ maNewTransformB = rNewTransformB;
+ maClipRange = rClipRange;
+ mrOutliner.SetDrawPortionHdl(LINK(this, impTextBreakupHandler, decomposeBlockTextPrimitive));
+ mrOutliner.SetDrawBulletHdl(LINK(this, impTextBreakupHandler, decomposeBlockBulletPrimitive));
+ mrOutliner.StripPortions();
+ mrOutliner.SetDrawPortionHdl(Link());
+ mrOutliner.SetDrawBulletHdl(Link());
+ }
+
+ void decomposeStretchTextPrimitive(const basegfx::B2DHomMatrix& rNewTransformA, const basegfx::B2DHomMatrix& rNewTransformB)
+ {
+ maNewTransformA = rNewTransformA;
+ maNewTransformB = rNewTransformB;
+ mrOutliner.SetDrawPortionHdl(LINK(this, impTextBreakupHandler, decomposeStretchTextPrimitive));
+ mrOutliner.SetDrawBulletHdl(LINK(this, impTextBreakupHandler, decomposeStretchBulletPrimitive));
+ mrOutliner.StripPortions();
+ mrOutliner.SetDrawPortionHdl(Link());
+ mrOutliner.SetDrawBulletHdl(Link());
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequence();
+ };
+
+ bool impTextBreakupHandler::impIsUnderlineAbove(const Font& rFont) const
+ {
+ if(!rFont.IsVertical())
+ {
+ return false;
+ }
+
+ if((LANGUAGE_JAPANESE == rFont.GetLanguage()) || (LANGUAGE_JAPANESE == rFont.GetCJKContextLanguage()))
+ {
+ // the underline is right for Japanese only
+ return true;
+ }
+
+ return false;
+ }
+
+ void impTextBreakupHandler::impCreateTextPortionPrimitive(const DrawPortionInfo& rInfo)
+ {
+ if(rInfo.mrText.Len() && rInfo.mnTextLen)
+ {
+ basegfx::B2DVector aFontScaling;
+ drawinglayer::attribute::FontAttribute aFontAttribute(
+ drawinglayer::primitive2d::getFontAttributeFromVclFont(
+ aFontScaling,
+ rInfo.mrFont,
+ rInfo.IsRTL(),
+ false));
+ basegfx::B2DHomMatrix aNewTransform;
+
+ // add font scale to new transform
+ aNewTransform.scale(aFontScaling.getX(), aFontScaling.getY());
+
+ // look for proportional font scaling, evtl scale accordingly
+ if(100 != rInfo.mrFont.GetPropr())
+ {
+ const double fFactor(rInfo.mrFont.GetPropr() / 100.0);
+ aNewTransform.scale(fFactor, fFactor);
+ }
+
+ // apply font rotate
+ if(rInfo.mrFont.GetOrientation())
+ {
+ aNewTransform.rotate(-rInfo.mrFont.GetOrientation() * F_PI1800);
+ }
+
+ // look for escapement, evtl translate accordingly
+ if(rInfo.mrFont.GetEscapement())
+ {
+ sal_Int16 nEsc(rInfo.mrFont.GetEscapement());
+
+ if(DFLT_ESC_AUTO_SUPER == nEsc)
+ {
+ nEsc = 33;
+ }
+ else if(DFLT_ESC_AUTO_SUB == nEsc)
+ {
+ nEsc = -20;
+ }
+
+ if(nEsc > 100)
+ {
+ nEsc = 100;
+ }
+ else if(nEsc < -100)
+ {
+ nEsc = -100;
+ }
+
+ const double fEscapement(nEsc / -100.0);
+ aNewTransform.translate(0.0, fEscapement * aFontScaling.getY());
+ }
+
+ // apply transformA
+ aNewTransform *= maNewTransformA;
+
+ // apply local offset
+ aNewTransform.translate(rInfo.mrStartPos.X(), rInfo.mrStartPos.Y());
+
+ // also apply embedding object's transform
+ aNewTransform *= maNewTransformB;
+
+ // prepare DXArray content. To make it independent from font size (and such from
+ // the text transformation), scale it to unit coordinates
+ ::std::vector< double > aDXArray;
+ static bool bDisableTextArray(false);
+
+ if(!bDisableTextArray && rInfo.mpDXArray && rInfo.mnTextLen)
+ {
+ aDXArray.reserve(rInfo.mnTextLen);
+
+ for(xub_StrLen a(0); a < rInfo.mnTextLen; a++)
+ {
+ aDXArray.push_back((double)rInfo.mpDXArray[a]);
+ }
+ }
+
+ // create complex text primitive and append
+ const Color aFontColor(rInfo.mrFont.GetColor());
+ const basegfx::BColor aBFontColor(aFontColor.getBColor());
+
+ // prepare wordLineMode (for underline and strikeout)
+ // NOT for bullet texts. It is set (this may be an error by itself), but needs to be suppressed to hinder e.g. '1)'
+ // to be splitted which would not look like the original
+ const bool bWordLineMode(rInfo.mrFont.IsWordLineMode() && !rInfo.mbEndOfBullet);
+
+ // prepare new primitive
+ drawinglayer::primitive2d::BasePrimitive2D* pNewPrimitive = 0;
+ const bool bDecoratedIsNeeded(
+ UNDERLINE_NONE != rInfo.mrFont.GetOverline()
+ || UNDERLINE_NONE != rInfo.mrFont.GetUnderline()
+ || STRIKEOUT_NONE != rInfo.mrFont.GetStrikeout()
+ || EMPHASISMARK_NONE != (rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_STYLE)
+ || RELIEF_NONE != rInfo.mrFont.GetRelief()
+ || rInfo.mrFont.IsShadow()
+ || bWordLineMode);
+
+ if(bDecoratedIsNeeded)
+ {
+ // TextDecoratedPortionPrimitive2D needed, prepare some more data
+ // get overline and underline color. If it's on automatic (0xffffffff) use FontColor instead
+ const Color aUnderlineColor(rInfo.maTextLineColor);
+ const basegfx::BColor aBUnderlineColor((0xffffffff == aUnderlineColor.GetColor()) ? aBFontColor : aUnderlineColor.getBColor());
+ const Color aOverlineColor(rInfo.maOverlineColor);
+ const basegfx::BColor aBOverlineColor((0xffffffff == aOverlineColor.GetColor()) ? aBFontColor : aOverlineColor.getBColor());
+
+ // prepare overline and underline data
+ const drawinglayer::primitive2d::TextLine eFontOverline(
+ drawinglayer::primitive2d::mapFontUnderlineToTextLine(rInfo.mrFont.GetOverline()));
+ const drawinglayer::primitive2d::TextLine eFontUnderline(
+ drawinglayer::primitive2d::mapFontUnderlineToTextLine(rInfo.mrFont.GetUnderline()));
+
+ // check UndelineAbove
+ const bool bUnderlineAbove(
+ drawinglayer::primitive2d::TEXT_LINE_NONE != eFontUnderline && impIsUnderlineAbove(rInfo.mrFont));
+
+ // prepare strikeout data
+ const drawinglayer::primitive2d::TextStrikeout eTextStrikeout(
+ drawinglayer::primitive2d::mapFontStrikeoutToTextStrikeout(rInfo.mrFont.GetStrikeout()));
+
+ // prepare emphasis mark data
+ drawinglayer::primitive2d::TextEmphasisMark eTextEmphasisMark(drawinglayer::primitive2d::TEXT_EMPHASISMARK_NONE);
+
+ switch(rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_STYLE)
+ {
+ case EMPHASISMARK_DOT : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_DOT; break;
+ case EMPHASISMARK_CIRCLE : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_CIRCLE; break;
+ case EMPHASISMARK_DISC : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_DISC; break;
+ case EMPHASISMARK_ACCENT : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_ACCENT; break;
+ }
+
+ const bool bEmphasisMarkAbove(rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_POS_ABOVE);
+ const bool bEmphasisMarkBelow(rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_POS_BELOW);
+
+ // prepare font relief data
+ drawinglayer::primitive2d::TextRelief eTextRelief(drawinglayer::primitive2d::TEXT_RELIEF_NONE);
+
+ switch(rInfo.mrFont.GetRelief())
+ {
+ case RELIEF_EMBOSSED : eTextRelief = drawinglayer::primitive2d::TEXT_RELIEF_EMBOSSED; break;
+ case RELIEF_ENGRAVED : eTextRelief = drawinglayer::primitive2d::TEXT_RELIEF_ENGRAVED; break;
+ default : break; // RELIEF_NONE, FontRelief_FORCE_EQUAL_SIZE
+ }
+
+ // prepare shadow/outline data
+ const bool bShadow(rInfo.mrFont.IsShadow());
+
+ // TextDecoratedPortionPrimitive2D is needed, create one
+ pNewPrimitive = new drawinglayer::primitive2d::TextDecoratedPortionPrimitive2D(
+
+ // attributes for TextSimplePortionPrimitive2D
+ aNewTransform,
+ rInfo.mrText,
+ rInfo.mnTextStart,
+ rInfo.mnTextLen,
+ aDXArray,
+ aFontAttribute,
+ rInfo.mpLocale ? *rInfo.mpLocale : ::com::sun::star::lang::Locale(),
+ aBFontColor,
+
+ // attributes for TextDecoratedPortionPrimitive2D
+ aBOverlineColor,
+ aBUnderlineColor,
+ eFontOverline,
+ eFontUnderline,
+ bUnderlineAbove,
+ eTextStrikeout,
+ bWordLineMode,
+ eTextEmphasisMark,
+ bEmphasisMarkAbove,
+ bEmphasisMarkBelow,
+ eTextRelief,
+ bShadow);
+ }
+ else
+ {
+ // TextSimplePortionPrimitive2D is enough
+ pNewPrimitive = new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
+ aNewTransform,
+ rInfo.mrText,
+ rInfo.mnTextStart,
+ rInfo.mnTextLen,
+ aDXArray,
+ aFontAttribute,
+ rInfo.mpLocale ? *rInfo.mpLocale : ::com::sun::star::lang::Locale(),
+ aBFontColor);
+ }
+
+ if(rInfo.mbEndOfBullet)
+ {
+ // embed in TextHierarchyBulletPrimitive2D
+ const drawinglayer::primitive2d::Primitive2DReference aNewReference(pNewPrimitive);
+ const drawinglayer::primitive2d::Primitive2DSequence aNewSequence(&aNewReference, 1);
+ pNewPrimitive = new drawinglayer::primitive2d::TextHierarchyBulletPrimitive2D(aNewSequence);
+ }
+
+ if(rInfo.mpFieldData)
+ {
+ pNewPrimitive = impCheckFieldPrimitive(pNewPrimitive, rInfo);
+ }
+
+ maTextPortionPrimitives.push_back(pNewPrimitive);
+
+ // support for WrongSpellVector. Create WrongSpellPrimitives as needed
+ if(rInfo.mpWrongSpellVector && !aDXArray.empty())
+ {
+ const sal_uInt32 nSize(rInfo.mpWrongSpellVector->size());
+ const sal_uInt32 nDXCount(aDXArray.size());
+ const basegfx::BColor aSpellColor(1.0, 0.0, 0.0); // red, hard coded
+
+ for(sal_uInt32 a(0); a < nSize; a++)
+ {
+ const EEngineData::WrongSpellClass& rCandidate = (*rInfo.mpWrongSpellVector)[a];
+
+ if(rCandidate.nStart >= rInfo.mnTextStart && rCandidate.nEnd >= rInfo.mnTextStart && rCandidate.nEnd > rCandidate.nStart)
+ {
+ const sal_uInt32 nStart(rCandidate.nStart - rInfo.mnTextStart);
+ const sal_uInt32 nEnd(rCandidate.nEnd - rInfo.mnTextStart);
+ double fStart(0.0);
+ double fEnd(0.0);
+
+ if(nStart > 0 && nStart - 1 < nDXCount)
+ {
+ fStart = aDXArray[nStart - 1];
+ }
+
+ if(nEnd > 0 && nEnd - 1 < nDXCount)
+ {
+ fEnd = aDXArray[nEnd - 1];
+ }
+
+ if(!basegfx::fTools::equal(fStart, fEnd))
+ {
+ if(rInfo.IsRTL())
+ {
+ // #i98523#
+ // When the portion is RTL, mirror the redlining using the
+ // full portion width
+ const double fTextWidth(aDXArray[aDXArray.size() - 1]);
+
+ fStart = fTextWidth - fStart;
+ fEnd = fTextWidth - fEnd;
+ }
+
+ // need to take FontScaling out of values; it's already part of
+ // aNewTransform and would be double applied
+ const double fFontScaleX(aFontScaling.getX());
+
+ if(!basegfx::fTools::equal(fFontScaleX, 1.0)
+ && !basegfx::fTools::equalZero(fFontScaleX))
+ {
+ fStart /= fFontScaleX;
+ fEnd /= fFontScaleX;
+ }
+
+ maTextPortionPrimitives.push_back(new drawinglayer::primitive2d::WrongSpellPrimitive2D(
+ aNewTransform,
+ fStart,
+ fEnd,
+ aSpellColor));
+ }
+ }
+ }
+ }
+ }
+ }
+
+ drawinglayer::primitive2d::BasePrimitive2D* impTextBreakupHandler::impCheckFieldPrimitive(drawinglayer::primitive2d::BasePrimitive2D* pPrimitive, const DrawPortionInfo& rInfo) const
+ {
+ if(rInfo.mpFieldData)
+ {
+ // Support for FIELD_SEQ_BEGIN, FIELD_SEQ_END. If used, create a TextHierarchyFieldPrimitive2D
+ // which holds the field type and evtl. the URL
+ const SvxURLField* pURLField = dynamic_cast< const SvxURLField* >(rInfo.mpFieldData);
+ const SvxPageField* pPageField = dynamic_cast< const SvxPageField* >(rInfo.mpFieldData);
+
+ // embed current primitive to a sequence
+ drawinglayer::primitive2d::Primitive2DSequence aSequence;
+
+ if(pPrimitive)
+ {
+ aSequence.realloc(1);
+ aSequence[0] = drawinglayer::primitive2d::Primitive2DReference(pPrimitive);
+ }
+
+ if(pURLField)
+ {
+ pPrimitive = new drawinglayer::primitive2d::TextHierarchyFieldPrimitive2D(aSequence, drawinglayer::primitive2d::FIELD_TYPE_URL, pURLField->GetURL());
+ }
+ else if(pPageField)
+ {
+ pPrimitive = new drawinglayer::primitive2d::TextHierarchyFieldPrimitive2D(aSequence, drawinglayer::primitive2d::FIELD_TYPE_PAGE, String());
+ }
+ else
+ {
+ pPrimitive = new drawinglayer::primitive2d::TextHierarchyFieldPrimitive2D(aSequence, drawinglayer::primitive2d::FIELD_TYPE_COMMON, String());
+ }
+ }
+
+ return pPrimitive;
+ }
+
+ void impTextBreakupHandler::impFlushTextPortionPrimitivesToLinePrimitives()
+ {
+ // only create a line primitive when we had content; there is no need for
+ // empty line primitives (contrary to paragraphs, see below).
+ if(maTextPortionPrimitives.size())
+ {
+ drawinglayer::primitive2d::Primitive2DSequence aLineSequence(impConvertVectorToPrimitive2DSequence(maTextPortionPrimitives));
+ maTextPortionPrimitives.clear();
+ maLinePrimitives.push_back(new drawinglayer::primitive2d::TextHierarchyLinePrimitive2D(aLineSequence));
+ }
+ }
+
+ void impTextBreakupHandler::impFlushLinePrimitivesToParagraphPrimitives()
+ {
+ // ALWAYS create a paragraph primitive, even when no content was added. This is done to
+ // have the correct paragraph count even with empty paragraphs. Those paragraphs will
+ // have an empty sub-PrimitiveSequence.
+ drawinglayer::primitive2d::Primitive2DSequence aParagraphSequence(impConvertVectorToPrimitive2DSequence(maLinePrimitives));
+ maLinePrimitives.clear();
+ maParagraphPrimitives.push_back(new drawinglayer::primitive2d::TextHierarchyParagraphPrimitive2D(aParagraphSequence));
+ }
+
+ void impTextBreakupHandler::impHandleDrawPortionInfo(const DrawPortionInfo& rInfo)
+ {
+ impCreateTextPortionPrimitive(rInfo);
+
+ if(rInfo.mbEndOfLine || rInfo.mbEndOfParagraph)
+ {
+ impFlushTextPortionPrimitivesToLinePrimitives();
+ }
+
+ if(rInfo.mbEndOfParagraph)
+ {
+ impFlushLinePrimitivesToParagraphPrimitives();
+ }
+ }
+
+ void impTextBreakupHandler::impHandleDrawBulletInfo(const DrawBulletInfo& rInfo)
+ {
+ basegfx::B2DHomMatrix aNewTransform;
+
+ // add size to new transform
+ aNewTransform.scale(rInfo.maBulletSize.getWidth(), rInfo.maBulletSize.getHeight());
+
+ // apply transformA
+ aNewTransform *= maNewTransformA;
+
+ // apply local offset
+ aNewTransform.translate(rInfo.maBulletPosition.X(), rInfo.maBulletPosition.Y());
+
+ // also apply embedding object's transform
+ aNewTransform *= maNewTransformB;
+
+ // prepare empty GraphicAttr
+ const GraphicAttr aGraphicAttr;
+
+ // create GraphicPrimitive2D
+ const drawinglayer::primitive2d::Primitive2DReference aNewReference(new drawinglayer::primitive2d::GraphicPrimitive2D(
+ aNewTransform,
+ rInfo.maBulletGraphicObject,
+ aGraphicAttr));
+
+ // embed in TextHierarchyBulletPrimitive2D
+ const drawinglayer::primitive2d::Primitive2DSequence aNewSequence(&aNewReference, 1);
+ drawinglayer::primitive2d::BasePrimitive2D* pNewPrimitive = new drawinglayer::primitive2d::TextHierarchyBulletPrimitive2D(aNewSequence);
+
+ // add to output
+ maTextPortionPrimitives.push_back(pNewPrimitive);
+ }
+
+ IMPL_LINK(impTextBreakupHandler, decomposeContourTextPrimitive, DrawPortionInfo*, pInfo)
+ {
+ // for contour text, ignore (clip away) all portions which are below
+ // the visible area given by maScale
+ if(pInfo && (double)pInfo->mrStartPos.Y() < maScale.getY())
+ {
+ impHandleDrawPortionInfo(*pInfo);
+ }
+
+ return 0;
+ }
+
+ IMPL_LINK(impTextBreakupHandler, decomposeBlockTextPrimitive, DrawPortionInfo*, pInfo)
+ {
+ if(pInfo)
+ {
+ // #SJ# Is clipping wanted? This is text clipping; only accept a portion
+ // if it's completely in the range
+ if(!maClipRange.isEmpty())
+ {
+ // Test start position first; this allows to not get the text range at
+ // all if text is far outside
+ const basegfx::B2DPoint aStartPosition(pInfo->mrStartPos.X(), pInfo->mrStartPos.Y());
+
+ if(!maClipRange.isInside(aStartPosition))
+ {
+ return 0;
+ }
+
+ // Start position is inside. Get TextBoundRect and TopLeft next
+ drawinglayer::primitive2d::TextLayouterDevice aTextLayouterDevice;
+ aTextLayouterDevice.setFont(pInfo->mrFont);
+
+ const basegfx::B2DRange aTextBoundRect(
+ aTextLayouterDevice.getTextBoundRect(
+ pInfo->mrText, pInfo->mnTextStart, pInfo->mnTextLen));
+ const basegfx::B2DPoint aTopLeft(aTextBoundRect.getMinimum() + aStartPosition);
+
+ if(!maClipRange.isInside(aTopLeft))
+ {
+ return 0;
+ }
+
+ // TopLeft is inside. Get BottomRight and check
+ const basegfx::B2DPoint aBottomRight(aTextBoundRect.getMaximum() + aStartPosition);
+
+ if(!maClipRange.isInside(aBottomRight))
+ {
+ return 0;
+ }
+
+ // all inside, clip was successful
+ }
+ impHandleDrawPortionInfo(*pInfo);
+ }
+
+ return 0;
+ }
+
+ IMPL_LINK(impTextBreakupHandler, decomposeStretchTextPrimitive, DrawPortionInfo*, pInfo)
+ {
+ if(pInfo)
+ {
+ impHandleDrawPortionInfo(*pInfo);
+ }
+
+ return 0;
+ }
+
+ IMPL_LINK(impTextBreakupHandler, decomposeContourBulletPrimitive, DrawBulletInfo*, pInfo)
+ {
+ if(pInfo)
+ {
+ impHandleDrawBulletInfo(*pInfo);
+ }
+
+ return 0;
+ }
+
+ IMPL_LINK(impTextBreakupHandler, decomposeBlockBulletPrimitive, DrawBulletInfo*, pInfo)
+ {
+ if(pInfo)
+ {
+ impHandleDrawBulletInfo(*pInfo);
+ }
+
+ return 0;
+ }
+
+ IMPL_LINK(impTextBreakupHandler, decomposeStretchBulletPrimitive, DrawBulletInfo*, pInfo)
+ {
+ if(pInfo)
+ {
+ impHandleDrawBulletInfo(*pInfo);
+ }
+
+ return 0;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence impTextBreakupHandler::getPrimitive2DSequence()
+ {
+ if(maTextPortionPrimitives.size())
+ {
+ // collect non-closed lines
+ impFlushTextPortionPrimitivesToLinePrimitives();
+ }
+
+ if(maLinePrimitives.size())
+ {
+ // collect non-closed paragraphs
+ impFlushLinePrimitivesToParagraphPrimitives();
+ }
+
+ return impConvertVectorToPrimitive2DSequence(maParagraphPrimitives);
+ }
+} // end of anonymous namespace
+
+//////////////////////////////////////////////////////////////////////////////
+// primitive decompositions
+
+void SdrTextObj::impDecomposeContourTextPrimitive(
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+ const drawinglayer::primitive2d::SdrContourTextPrimitive2D& rSdrContourTextPrimitive,
+ const drawinglayer::geometry::ViewInformation2D& aViewInformation) const
+{
+ // decompose matrix to have position and size of text
+ basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ rSdrContourTextPrimitive.getObjectTransform().decompose(aScale, aTranslate, fRotate, fShearX);
+
+ // prepare contour polygon, force to non-mirrored for layouting
+ basegfx::B2DPolyPolygon aPolyPolygon(rSdrContourTextPrimitive.getUnitPolyPolygon());
+ aPolyPolygon.transform(basegfx::tools::createScaleB2DHomMatrix(fabs(aScale.getX()), fabs(aScale.getY())));
+
+ // prepare outliner
+ SdrOutliner& rOutliner = ImpGetDrawOutliner();
+ const Size aNullSize;
+ rOutliner.SetPaperSize(aNullSize);
+ rOutliner.SetPolygon(aPolyPolygon);
+ rOutliner.SetUpdateMode(true);
+ rOutliner.SetText(rSdrContourTextPrimitive.getOutlinerParaObject());
+
+ // set visualizing page at Outliner; needed e.g. for PageNumberField decomposition
+ rOutliner.setVisualizedPage(GetSdrPageFromXDrawPage(aViewInformation.getVisualizedPage()));
+
+ // prepare matrices to apply to newly created primitives
+ basegfx::B2DHomMatrix aNewTransformA;
+
+ // mirroring. We are now in the polygon sizes. When mirroring in X and Y,
+ // move the null point which was top left to bottom right.
+ const bool bMirrorX(basegfx::fTools::less(aScale.getX(), 0.0));
+ const bool bMirrorY(basegfx::fTools::less(aScale.getY(), 0.0));
+
+ // in-between the translations of the single primitives will take place. Afterwards,
+ // the object's transformations need to be applied
+ const basegfx::B2DHomMatrix aNewTransformB(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0,
+ fShearX, fRotate, aTranslate.getX(), aTranslate.getY()));
+
+ // now break up text primitives.
+ impTextBreakupHandler aConverter(rOutliner);
+ aConverter.decomposeContourTextPrimitive(aNewTransformA, aNewTransformB, aScale);
+
+ // cleanup outliner
+ rOutliner.Clear();
+ rOutliner.setVisualizedPage(0);
+
+ rTarget = aConverter.getPrimitive2DSequence();
+}
+
+void SdrTextObj::impDecomposeBlockTextPrimitive(
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+ const drawinglayer::primitive2d::SdrBlockTextPrimitive2D& rSdrBlockTextPrimitive,
+ const drawinglayer::geometry::ViewInformation2D& aViewInformation) const
+{
+ // decompose matrix to have position and size of text
+ basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ rSdrBlockTextPrimitive.getTextRangeTransform().decompose(aScale, aTranslate, fRotate, fShearX);
+
+ // use B2DRange aAnchorTextRange for calculations
+ basegfx::B2DRange aAnchorTextRange(aTranslate);
+ aAnchorTextRange.expand(aTranslate + aScale);
+
+ // prepare outliner
+ const bool bIsCell(rSdrBlockTextPrimitive.getCellText());
+ SdrOutliner& rOutliner = ImpGetDrawOutliner();
+ SdrTextHorzAdjust eHAdj = rSdrBlockTextPrimitive.getSdrTextHorzAdjust();
+ SdrTextVertAdjust eVAdj = rSdrBlockTextPrimitive.getSdrTextVertAdjust();
+ const sal_uInt32 nOriginalControlWord(rOutliner.GetControlWord());
+ const Size aNullSize;
+
+ // set visualizing page at Outliner; needed e.g. for PageNumberField decomposition
+ rOutliner.setVisualizedPage(GetSdrPageFromXDrawPage(aViewInformation.getVisualizedPage()));
+ rOutliner.SetFixedCellHeight(rSdrBlockTextPrimitive.isFixedCellHeight());
+ rOutliner.SetControlWord(nOriginalControlWord|EE_CNTRL_AUTOPAGESIZE);
+ rOutliner.SetMinAutoPaperSize(aNullSize);
+ rOutliner.SetMaxAutoPaperSize(Size(1000000,1000000));
+
+ // add one to rage sizes to get back to the old Rectangle and outliner measurements
+ const sal_uInt32 nAnchorTextWidth(FRound(aAnchorTextRange.getWidth() + 1L));
+ const sal_uInt32 nAnchorTextHeight(FRound(aAnchorTextRange.getHeight() + 1L));
+ const bool bVerticalWritintg(rSdrBlockTextPrimitive.getOutlinerParaObject().IsVertical());
+ const Size aAnchorTextSize(Size(nAnchorTextWidth, nAnchorTextHeight));
+
+ if(bIsCell)
+ {
+ // cell text is formated neither like a text object nor like a object
+ // text, so use a special setup here
+ rOutliner.SetMaxAutoPaperSize(aAnchorTextSize);
+
+ // #i106214# To work with an unchangeable PaperSize (CellSize in
+ // this case) Set(Min|Max)AutoPaperSize and SetPaperSize have to be used.
+ // #i106214# This was not completely correct; to still measure the real
+ // text height to allow vertical adjust (and vice versa for VerticalWritintg)
+ // only one aspect has to be set, but the other one to zero
+ if(bVerticalWritintg)
+ {
+ // measure the horizontal text size
+ rOutliner.SetMinAutoPaperSize(Size(0, aAnchorTextSize.Height()));
+ }
+ else
+ {
+ // measure the vertical text size
+ rOutliner.SetMinAutoPaperSize(Size(aAnchorTextSize.Width(), 0));
+ }
+
+ rOutliner.SetPaperSize(aAnchorTextSize);
+ rOutliner.SetUpdateMode(true);
+ rOutliner.SetText(rSdrBlockTextPrimitive.getOutlinerParaObject());
+ }
+ 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);
+
+ // set minimal paper size hor/ver if needed
+ if(bHorizontalIsBlock)
+ {
+ rOutliner.SetMinAutoPaperSize(Size(nAnchorTextWidth, 0));
+ }
+ else if(bVerticalIsBlock)
+ {
+ rOutliner.SetMinAutoPaperSize(Size(0, nAnchorTextHeight));
+ }
+
+ if((rSdrBlockTextPrimitive.getWordWrap() || IsTextFrame()) && !rSdrBlockTextPrimitive.getUnlimitedPage())
+ {
+ // #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);
+ }
+
+ rOutliner.SetPaperSize(aNullSize);
+ rOutliner.SetUpdateMode(true);
+ rOutliner.SetText(rSdrBlockTextPrimitive.getOutlinerParaObject());
+ }
+
+ rOutliner.SetControlWord(nOriginalControlWord);
+
+ // now get back the layouted text size from outliner
+ const Size aOutlinerTextSiz(rOutliner.GetPaperSize());
+ const basegfx::B2DVector aOutlinerScale(aOutlinerTextSiz.Width(), aOutlinerTextSiz.Height());
+ basegfx::B2DVector aAdjustTranslate(0.0, 0.0);
+
+ // For draw objects containing text correct hor/ver alignment if text is bigger
+ // than the object itself. Without that correction, the text would always be
+ // formatted to the left edge (or top edge when vertical) of the draw object.
+ if(!IsTextFrame() && !bIsCell)
+ {
+ if(aAnchorTextRange.getWidth() < aOutlinerScale.getX() && !bVerticalWritintg)
+ {
+ // Horizontal case here. Correct only if eHAdj == SDRTEXTHORZADJUST_BLOCK,
+ // else the alignment is wanted.
+ if(SDRTEXTHORZADJUST_BLOCK == eHAdj)
+ {
+ eHAdj = SDRTEXTHORZADJUST_CENTER;
+ }
+ }
+
+ if(aAnchorTextRange.getHeight() < aOutlinerScale.getY() && bVerticalWritintg)
+ {
+ // Vertical case here. Correct only if eHAdj == SDRTEXTVERTADJUST_BLOCK,
+ // else the alignment is wanted.
+ if(SDRTEXTVERTADJUST_BLOCK == eVAdj)
+ {
+ eVAdj = SDRTEXTVERTADJUST_CENTER;
+ }
+ }
+ }
+
+ // correct horizontal translation using the now known text size
+ if(SDRTEXTHORZADJUST_CENTER == eHAdj || SDRTEXTHORZADJUST_RIGHT == eHAdj)
+ {
+ const double fFree(aAnchorTextRange.getWidth() - aOutlinerScale.getX());
+
+ if(SDRTEXTHORZADJUST_CENTER == eHAdj)
+ {
+ aAdjustTranslate.setX(fFree / 2.0);
+ }
+
+ if(SDRTEXTHORZADJUST_RIGHT == eHAdj)
+ {
+ aAdjustTranslate.setX(fFree);
+ }
+ }
+
+ // correct vertical translation using the now known text size
+ if(SDRTEXTVERTADJUST_CENTER == eVAdj || SDRTEXTVERTADJUST_BOTTOM == eVAdj)
+ {
+ const double fFree(aAnchorTextRange.getHeight() - aOutlinerScale.getY());
+
+ if(SDRTEXTVERTADJUST_CENTER == eVAdj)
+ {
+ aAdjustTranslate.setY(fFree / 2.0);
+ }
+
+ if(SDRTEXTVERTADJUST_BOTTOM == eVAdj)
+ {
+ aAdjustTranslate.setY(fFree);
+ }
+ }
+
+ // prepare matrices to apply to newly created primitives. aNewTransformA
+ // will get coordinates in aOutlinerScale size and positive in X, Y.
+ // Translate relative to given primitive to get same rotation and shear
+ // as the master shape we are working on. For vertical, use the top-right
+ // corner
+ const double fStartInX(bVerticalWritintg ? aAdjustTranslate.getX() + aOutlinerScale.getX() : aAdjustTranslate.getX());
+ const basegfx::B2DTuple aAdjOffset(fStartInX, aAdjustTranslate.getY());
+ basegfx::B2DHomMatrix aNewTransformA(basegfx::tools::createTranslateB2DHomMatrix(aAdjOffset.getX(), aAdjOffset.getY()));
+
+ // mirroring. We are now in aAnchorTextRange sizes. When mirroring in X and Y,
+ // move the null point which was top left to bottom right.
+ const bool bMirrorX(basegfx::fTools::less(aScale.getX(), 0.0));
+ const bool bMirrorY(basegfx::fTools::less(aScale.getY(), 0.0));
+
+ // in-between the translations of the single primitives will take place. Afterwards,
+ // the object's transformations need to be applied
+ const basegfx::B2DHomMatrix aNewTransformB(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0,
+ fShearX, fRotate, aTranslate.getX(), aTranslate.getY()));
+
+ // #SJ# create ClipRange (if needed)
+ basegfx::B2DRange aClipRange;
+
+ if(rSdrBlockTextPrimitive.getClipOnBounds())
+ {
+ aClipRange.expand(-aAdjOffset);
+ aClipRange.expand(basegfx::B2DTuple(aAnchorTextSize.Width(), aAnchorTextSize.Height()) - aAdjOffset);
+ }
+
+ // now break up text primitives.
+ impTextBreakupHandler aConverter(rOutliner);
+ aConverter.decomposeBlockTextPrimitive(aNewTransformA, aNewTransformB, aClipRange);
+
+ // cleanup outliner
+ rOutliner.Clear();
+ rOutliner.setVisualizedPage(0);
+
+ rTarget = aConverter.getPrimitive2DSequence();
+}
+
+void SdrTextObj::impDecomposeStretchTextPrimitive(
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+ const drawinglayer::primitive2d::SdrStretchTextPrimitive2D& rSdrStretchTextPrimitive,
+ const drawinglayer::geometry::ViewInformation2D& aViewInformation) const
+{
+ // decompose matrix to have position and size of text
+ basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ rSdrStretchTextPrimitive.getTextRangeTransform().decompose(aScale, aTranslate, fRotate, fShearX);
+
+ // use non-mirrored B2DRange aAnchorTextRange for calculations
+ basegfx::B2DRange aAnchorTextRange(aTranslate);
+ aAnchorTextRange.expand(aTranslate + aScale);
+
+ // prepare outliner
+ SdrOutliner& rOutliner = ImpGetDrawOutliner();
+ const sal_uInt32 nOriginalControlWord(rOutliner.GetControlWord());
+ const Size aNullSize;
+
+ rOutliner.SetControlWord(nOriginalControlWord|EE_CNTRL_STRETCHING|EE_CNTRL_AUTOPAGESIZE);
+ rOutliner.SetFixedCellHeight(rSdrStretchTextPrimitive.isFixedCellHeight());
+ rOutliner.SetMinAutoPaperSize(aNullSize);
+ rOutliner.SetMaxAutoPaperSize(Size(1000000,1000000));
+ rOutliner.SetPaperSize(aNullSize);
+ rOutliner.SetUpdateMode(true);
+ rOutliner.SetText(rSdrStretchTextPrimitive.getOutlinerParaObject());
+
+ // set visualizing page at Outliner; needed e.g. for PageNumberField decomposition
+ rOutliner.setVisualizedPage(GetSdrPageFromXDrawPage(aViewInformation.getVisualizedPage()));
+
+ // now get back the layouted text size from outliner
+ const Size aOutlinerTextSiz(rOutliner.CalcTextSize());
+ const basegfx::B2DVector aOutlinerScale(
+ basegfx::fTools::equalZero(aOutlinerTextSiz.Width()) ? 1.0 : aOutlinerTextSiz.Width(),
+ basegfx::fTools::equalZero(aOutlinerTextSiz.Height()) ? 1.0 : aOutlinerTextSiz.Height());
+
+ // prepare matrices to apply to newly created primitives
+ basegfx::B2DHomMatrix aNewTransformA;
+
+ // #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());
+ const double fScaleY(fabs(aScale.getY()) / aOutlinerScale.getY());
+ rOutliner.SetGlobalCharStretching((sal_Int16)FRound(fScaleX * 100.0), (sal_Int16)FRound(fScaleY * 100.0));
+
+ // mirroring. We are now in aAnchorTextRange sizes. When mirroring in X and Y,
+ // move the null point which was top left to bottom right.
+ const bool bMirrorX(basegfx::fTools::less(aScale.getX(), 0.0));
+ const bool bMirrorY(basegfx::fTools::less(aScale.getY(), 0.0));
+
+ // in-between the translations of the single primitives will take place. Afterwards,
+ // the object's transformations need to be applied
+ const basegfx::B2DHomMatrix aNewTransformB(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0,
+ fShearX, fRotate, aTranslate.getX(), aTranslate.getY()));
+
+ // now break up text primitives.
+ impTextBreakupHandler aConverter(rOutliner);
+ aConverter.decomposeStretchTextPrimitive(aNewTransformA, aNewTransformB);
+
+ // cleanup outliner
+ rOutliner.SetControlWord(nOriginalControlWord);
+ rOutliner.Clear();
+ rOutliner.setVisualizedPage(0);
+
+ rTarget = aConverter.getPrimitive2DSequence();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// timing generators
+#define ENDLESS_LOOP (0xffffffff)
+#define ENDLESS_TIME ((double)0xffffffff)
+#define PIXEL_DPI (96.0)
+
+void SdrTextObj::impGetBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const
+{
+ if(SDRTEXTANI_BLINK == GetTextAniKind())
+ {
+ // get values
+ const SfxItemSet& rSet = GetObjectItemSet();
+ const sal_uInt32 nRepeat((sal_uInt32)((SdrTextAniCountItem&)rSet.Get(SDRATTR_TEXT_ANICOUNT)).GetValue());
+ bool bVisisbleWhenStopped(((SdrTextAniStopInsideItem&)rSet.Get(SDRATTR_TEXT_ANISTOPINSIDE)).GetValue());
+ double fDelay((double)((SdrTextAniDelayItem&)rSet.Get(SDRATTR_TEXT_ANIDELAY)).GetValue());
+
+ if(0.0 == fDelay)
+ {
+ // use default
+ fDelay = 250.0;
+ }
+
+ // prepare loop and add
+ drawinglayer::animation::AnimationEntryLoop aLoop(nRepeat ? nRepeat : ENDLESS_LOOP);
+ drawinglayer::animation::AnimationEntryFixed aStart(fDelay, 0.0);
+ aLoop.append(aStart);
+ drawinglayer::animation::AnimationEntryFixed aEnd(fDelay, 1.0);
+ aLoop.append(aEnd);
+ rAnimList.append(aLoop);
+
+ // add stopped state if loop is not endless
+ if(0L != nRepeat)
+ {
+ drawinglayer::animation::AnimationEntryFixed aStop(ENDLESS_TIME, bVisisbleWhenStopped ? 0.0 : 1.0);
+ rAnimList.append(aStop);
+ }
+ }
+}
+
+void impCreateScrollTiming(const SfxItemSet& rSet, drawinglayer::animation::AnimationEntryList& rAnimList, bool bForward, double fTimeFullPath, double fFrequency)
+{
+ bool bVisisbleWhenStopped(((SdrTextAniStopInsideItem&)rSet.Get(SDRATTR_TEXT_ANISTOPINSIDE)).GetValue());
+ bool bVisisbleWhenStarted(((SdrTextAniStartInsideItem&)rSet.Get(SDRATTR_TEXT_ANISTOPINSIDE )).GetValue());
+ const sal_uInt32 nRepeat(((SdrTextAniCountItem&)rSet.Get(SDRATTR_TEXT_ANICOUNT)).GetValue());
+
+ if(bVisisbleWhenStarted)
+ {
+ // move from center to outside
+ drawinglayer::animation::AnimationEntryLinear aInOut(fTimeFullPath * 0.5, fFrequency, 0.5, bForward ? 1.0 : 0.0);
+ rAnimList.append(aInOut);
+ }
+
+ // loop. In loop, move through
+ if(nRepeat || 0L == nRepeat)
+ {
+ drawinglayer::animation::AnimationEntryLoop aLoop(nRepeat ? nRepeat : ENDLESS_LOOP);
+ drawinglayer::animation::AnimationEntryLinear aThrough(fTimeFullPath, fFrequency, bForward ? 0.0 : 1.0, bForward ? 1.0 : 0.0);
+ aLoop.append(aThrough);
+ rAnimList.append(aLoop);
+ }
+
+ if(0L != nRepeat && bVisisbleWhenStopped)
+ {
+ // move from outside to center
+ drawinglayer::animation::AnimationEntryLinear aOutIn(fTimeFullPath * 0.5, fFrequency, bForward ? 0.0 : 1.0, 0.5);
+ rAnimList.append(aOutIn);
+
+ // add timing for staying at the end
+ drawinglayer::animation::AnimationEntryFixed aEnd(ENDLESS_TIME, 0.5);
+ rAnimList.append(aEnd);
+ }
+}
+
+void impCreateAlternateTiming(const SfxItemSet& rSet, drawinglayer::animation::AnimationEntryList& rAnimList, double fRelativeTextLength, bool bForward, double fTimeFullPath, double fFrequency)
+{
+ if(basegfx::fTools::more(fRelativeTextLength, 0.5))
+ {
+ // this is the case when fTextLength > fFrameLength, text is bigger than animation frame.
+ // In that case, correct direction
+ bForward = !bForward;
+ }
+
+ const double fStartPosition(bForward ? fRelativeTextLength : 1.0 - fRelativeTextLength);
+ const double fEndPosition(bForward ? 1.0 - fRelativeTextLength : fRelativeTextLength);
+ bool bVisisbleWhenStopped(((SdrTextAniStopInsideItem&)rSet.Get(SDRATTR_TEXT_ANISTOPINSIDE)).GetValue());
+ bool bVisisbleWhenStarted(((SdrTextAniStartInsideItem&)rSet.Get(SDRATTR_TEXT_ANISTOPINSIDE )).GetValue());
+ const sal_uInt32 nRepeat(((SdrTextAniCountItem&)rSet.Get(SDRATTR_TEXT_ANICOUNT)).GetValue());
+
+ if(!bVisisbleWhenStarted)
+ {
+ // move from outside to center
+ drawinglayer::animation::AnimationEntryLinear aOutIn(fTimeFullPath * 0.5, fFrequency, bForward ? 0.0 : 1.0, 0.5);
+ rAnimList.append(aOutIn);
+ }
+
+ // loop. In loop, move out and in again. fInnerMovePath may be negative when text is bigger then frame,
+ // so use absolute value
+ const double fInnerMovePath(fabs(1.0 - (fRelativeTextLength * 2.0)));
+ const double fTimeForInnerPath(fTimeFullPath * fInnerMovePath);
+ const double fHalfInnerPath(fTimeForInnerPath * 0.5);
+ const sal_uInt32 nDoubleRepeat(nRepeat / 2L);
+
+ if(nDoubleRepeat || 0L == nRepeat)
+ {
+ // double forth and back loop
+ drawinglayer::animation::AnimationEntryLoop aLoop(nDoubleRepeat ? nDoubleRepeat : ENDLESS_LOOP);
+ drawinglayer::animation::AnimationEntryLinear aTime0(fHalfInnerPath, fFrequency, 0.5, fEndPosition);
+ aLoop.append(aTime0);
+ drawinglayer::animation::AnimationEntryLinear aTime1(fTimeForInnerPath, fFrequency, fEndPosition, fStartPosition);
+ aLoop.append(aTime1);
+ drawinglayer::animation::AnimationEntryLinear aTime2(fHalfInnerPath, fFrequency, fStartPosition, 0.5);
+ aLoop.append(aTime2);
+ rAnimList.append(aLoop);
+ }
+
+ if(nRepeat % 2L)
+ {
+ // repeat is uneven, so we need one more forth and back to center
+ drawinglayer::animation::AnimationEntryLinear aTime0(fHalfInnerPath, fFrequency, 0.5, fEndPosition);
+ rAnimList.append(aTime0);
+ drawinglayer::animation::AnimationEntryLinear aTime1(fHalfInnerPath, fFrequency, fEndPosition, 0.5);
+ rAnimList.append(aTime1);
+ }
+
+ if(0L != nRepeat)
+ {
+ if(bVisisbleWhenStopped)
+ {
+ // add timing for staying at the end
+ drawinglayer::animation::AnimationEntryFixed aEnd(ENDLESS_TIME, 0.5);
+ rAnimList.append(aEnd);
+ }
+ else
+ {
+ // move from center to outside
+ drawinglayer::animation::AnimationEntryLinear aInOut(fTimeFullPath * 0.5, fFrequency, 0.5, bForward ? 1.0 : 0.0);
+ rAnimList.append(aInOut);
+ }
+ }
+}
+
+void impCreateSlideTiming(const SfxItemSet& rSet, drawinglayer::animation::AnimationEntryList& rAnimList, bool bForward, double fTimeFullPath, double fFrequency)
+{
+ // move in from outside, start outside
+ const double fStartPosition(bForward ? 0.0 : 1.0);
+ const sal_uInt32 nRepeat(((SdrTextAniCountItem&)rSet.Get(SDRATTR_TEXT_ANICOUNT)).GetValue());
+
+ // move from outside to center
+ drawinglayer::animation::AnimationEntryLinear aOutIn(fTimeFullPath * 0.5, fFrequency, fStartPosition, 0.5);
+ rAnimList.append(aOutIn);
+
+ // loop. In loop, move out and in again
+ if(nRepeat > 1L || 0L == nRepeat)
+ {
+ drawinglayer::animation::AnimationEntryLoop aLoop(nRepeat ? nRepeat - 1L : ENDLESS_LOOP);
+ drawinglayer::animation::AnimationEntryLinear aTime0(fTimeFullPath * 0.5, fFrequency, 0.5, fStartPosition);
+ aLoop.append(aTime0);
+ drawinglayer::animation::AnimationEntryLinear aTime1(fTimeFullPath * 0.5, fFrequency, fStartPosition, 0.5);
+ aLoop.append(aTime1);
+ rAnimList.append(aLoop);
+ }
+
+ // always visible when stopped, so add timing for staying at the end when not endless
+ if(0L != nRepeat)
+ {
+ drawinglayer::animation::AnimationEntryFixed aEnd(ENDLESS_TIME, 0.5);
+ rAnimList.append(aEnd);
+ }
+}
+
+void SdrTextObj::impGetScrollTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList, double fFrameLength, double fTextLength) const
+{
+ const SdrTextAniKind eAniKind(GetTextAniKind());
+
+ if(SDRTEXTANI_SCROLL == eAniKind || SDRTEXTANI_ALTERNATE == eAniKind || SDRTEXTANI_SLIDE == eAniKind)
+ {
+ // get data. Goal is to calculate fTimeFullPath which is the time needed to
+ // move animation from (0.0) to (1.0) state
+ const SfxItemSet& rSet = GetObjectItemSet();
+ double fAnimationDelay((double)((SdrTextAniDelayItem&)rSet.Get(SDRATTR_TEXT_ANIDELAY)).GetValue());
+ double fSingleStepWidth((double)((SdrTextAniAmountItem&)rSet.Get(SDRATTR_TEXT_ANIAMOUNT)).GetValue());
+ const SdrTextAniDirection eDirection(GetTextAniDirection());
+ const bool bForward(SDRTEXTANI_RIGHT == eDirection || SDRTEXTANI_DOWN == eDirection);
+
+ if(basegfx::fTools::equalZero(fAnimationDelay))
+ {
+ // default to 1/20 second
+ fAnimationDelay = 50.0;
+ }
+
+ if(basegfx::fTools::less(fSingleStepWidth, 0.0))
+ {
+ // data is in pixels, convert to logic. Imply PIXEL_DPI dpi.
+ // It makes no sense to keep the view-transformation centered
+ // definitions, so get rid of them here.
+ fSingleStepWidth = (-fSingleStepWidth * (2540.0 / PIXEL_DPI));
+ }
+
+ if(basegfx::fTools::equalZero(fSingleStepWidth))
+ {
+ // default to 1 milimeter
+ fSingleStepWidth = 100.0;
+ }
+
+ // use the length of the full animation path and the number of steps
+ // to get the full path time
+ const double fFullPathLength(fFrameLength + fTextLength);
+ const double fNumberOfSteps(fFullPathLength / fSingleStepWidth);
+ double fTimeFullPath(fNumberOfSteps * fAnimationDelay);
+
+ if(fTimeFullPath < fAnimationDelay)
+ {
+ fTimeFullPath = fAnimationDelay;
+ }
+
+ switch(eAniKind)
+ {
+ case SDRTEXTANI_SCROLL :
+ {
+ impCreateScrollTiming(rSet, rAnimList, bForward, fTimeFullPath, fAnimationDelay);
+ break;
+ }
+ case SDRTEXTANI_ALTERNATE :
+ {
+ double fRelativeTextLength(fTextLength / (fFrameLength + fTextLength));
+ impCreateAlternateTiming(rSet, rAnimList, fRelativeTextLength, bForward, fTimeFullPath, fAnimationDelay);
+ break;
+ }
+ case SDRTEXTANI_SLIDE :
+ {
+ impCreateSlideTiming(rSet, rAnimList, bForward, fTimeFullPath, fAnimationDelay);
+ break;
+ }
+ default : break; // SDRTEXTANI_NONE, SDRTEXTANI_BLINK
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx
new file mode 100644
index 000000000000..72de016703bd
--- /dev/null
+++ b/svx/source/svdraw/svdotextpathdecomposition.cxx
@@ -0,0 +1,824 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svdotext.hxx>
+#include <svx/svdoutl.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <svx/sdr/primitive2d/sdrtextprimitive2d.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <vcl/salbtype.hxx>
+#include <svl/itemset.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <algorithm>
+#include <svx/xtextit.hxx>
+#include <svx/xftshtit.hxx>
+#include <vcl/virdev.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 <editeng/unolingu.hxx>
+#include <drawinglayer/primitive2d/textlayoutdevice.hxx>
+#include <drawinglayer/primitive2d/textprimitive2d.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// primitive decomposition helpers
+
+#include <basegfx/polygon/b2dlinegeometry.hxx>
+#include <drawinglayer/attribute/strokeattribute.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xlntrit.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svx/xlinjoit.hxx>
+#include <svx/xlndsit.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
+#include <editeng/editstat.hxx>
+#include <svx/unoapi.hxx>
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+#include <svx/sdr/attribute/sdrformtextoutlineattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::i18n;
+
+//////////////////////////////////////////////////////////////////////////////
+// PathTextPortion helper
+
+namespace
+{
+ class impPathTextPortion
+ {
+ basegfx::B2DVector maOffset;
+ String maText;
+ xub_StrLen mnTextStart;
+ xub_StrLen mnTextLength;
+ sal_uInt16 mnParagraph;
+ xub_StrLen mnIndex;
+ SvxFont maFont;
+ ::std::vector< double > maDblDXArray; // double DXArray, font size independent -> unit coordinate system
+ ::com::sun::star::lang::Locale maLocale;
+
+ // bitfield
+ unsigned mbRTL : 1;
+
+ public:
+ impPathTextPortion(DrawPortionInfo& rInfo)
+ : maOffset(rInfo.mrStartPos.X(), rInfo.mrStartPos.Y()),
+ maText(rInfo.mrText),
+ mnTextStart(rInfo.mnTextStart),
+ mnTextLength(rInfo.mnTextLen),
+ mnParagraph(rInfo.mnPara),
+ mnIndex(rInfo.mnIndex),
+ maFont(rInfo.mrFont),
+ maDblDXArray(),
+ maLocale(rInfo.mpLocale ? *rInfo.mpLocale : ::com::sun::star::lang::Locale()),
+ mbRTL(rInfo.mrFont.IsVertical() ? false : rInfo.IsRTL())
+ {
+ if(mnTextLength && rInfo.mpDXArray)
+ {
+ maDblDXArray.reserve(mnTextLength);
+
+ for(xub_StrLen a(0); a < mnTextLength; a++)
+ {
+ maDblDXArray.push_back((double)rInfo.mpDXArray[a]);
+ }
+ }
+ }
+
+ // for ::std::sort
+ bool operator<(const impPathTextPortion& rComp) const
+ {
+ if(mnParagraph < rComp.mnParagraph)
+ {
+ return true;
+ }
+
+ if(maOffset.getX() < rComp.maOffset.getX())
+ {
+ return true;
+ }
+
+ return (maOffset.getY() < rComp.maOffset.getY());
+ }
+
+ const basegfx::B2DVector& getOffset() const { return maOffset; }
+ const String& getText() const { return maText; }
+ xub_StrLen getTextStart() const { return mnTextStart; }
+ xub_StrLen getTextLength() const { return mnTextLength; }
+ sal_uInt16 getParagraph() const { return mnParagraph; }
+ xub_StrLen getIndex() const { return mnIndex; }
+ const SvxFont& getFont() const { return maFont; }
+ bool isRTL() const { return mbRTL; }
+ const ::std::vector< double >& getDoubleDXArray() const { return maDblDXArray; }
+ const ::com::sun::star::lang::Locale& getLocale() const { return maLocale; }
+
+ xub_StrLen getPortionIndex(xub_StrLen nIndex, xub_StrLen nLength) const
+ {
+ if(mbRTL)
+ {
+ return (mnTextStart + (mnTextLength - (nIndex + nLength)));
+ }
+ else
+ {
+ return (mnTextStart + nIndex);
+ }
+ }
+
+ double getDisplayLength(xub_StrLen nIndex, xub_StrLen nLength) const
+ {
+ drawinglayer::primitive2d::TextLayouterDevice aTextLayouter;
+ double fRetval(0.0);
+
+ if(maFont.IsVertical())
+ {
+ fRetval = aTextLayouter.getTextHeight() * (double)nLength;
+ }
+ else
+ {
+ fRetval = aTextLayouter.getTextWidth(maText, getPortionIndex(nIndex, nLength), nLength);
+ }
+
+ return fRetval;
+ }
+ };
+} // end of anonymous namespace
+
+//////////////////////////////////////////////////////////////////////////////
+// TextBreakup helper
+
+namespace
+{
+ class impTextBreakupHandler
+ {
+ SdrOutliner& mrOutliner;
+ ::std::vector< impPathTextPortion > maPathTextPortions;
+
+ DECL_LINK(decompositionPathTextPrimitive, DrawPortionInfo* );
+
+ public:
+ impTextBreakupHandler(SdrOutliner& rOutliner)
+ : mrOutliner(rOutliner)
+ {
+ }
+
+ const ::std::vector< impPathTextPortion >& decompositionPathTextPrimitive()
+ {
+ // strip portions to maPathTextPortions
+ mrOutliner.SetDrawPortionHdl(LINK(this, impTextBreakupHandler, decompositionPathTextPrimitive));
+ mrOutliner.StripPortions();
+
+ if(maPathTextPortions.size())
+ {
+ // sort portions by paragraph, x and y
+ ::std::sort(maPathTextPortions.begin(), maPathTextPortions.end());
+ }
+
+ return maPathTextPortions;
+ }
+ };
+
+ IMPL_LINK(impTextBreakupHandler, decompositionPathTextPrimitive, DrawPortionInfo*, pInfo)
+ {
+ maPathTextPortions.push_back(impPathTextPortion(*pInfo));
+ return 0;
+ }
+} // end of anonymous namespace
+
+//////////////////////////////////////////////////////////////////////////////
+// TextBreakup one poly and one paragraph helper
+
+namespace
+{
+ class impPolygonParagraphHandler
+ {
+ const drawinglayer::attribute::SdrFormTextAttribute maSdrFormTextAttribute; // 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
+
+ double getParagraphTextLength(const ::std::vector< const impPathTextPortion* >& rTextPortions)
+ {
+ drawinglayer::primitive2d::TextLayouterDevice aTextLayouter;
+ double fRetval(0.0);
+
+ for(sal_uInt32 a(0L); a < rTextPortions.size(); a++)
+ {
+ const impPathTextPortion* pCandidate = rTextPortions[a];
+
+ if(pCandidate && pCandidate->getTextLength())
+ {
+ aTextLayouter.setFont(pCandidate->getFont());
+ fRetval += pCandidate->getDisplayLength(0L, pCandidate->getTextLength());
+ }
+ }
+
+ return fRetval;
+ }
+
+ xub_StrLen getNextGlyphLen(const impPathTextPortion* pCandidate, xub_StrLen nPosition, const ::com::sun::star::lang::Locale& rFontLocale)
+ {
+ xub_StrLen nNextGlyphLen(1);
+
+ if(mxBreak.is())
+ {
+ sal_Int32 nDone(0L);
+ nNextGlyphLen = (xub_StrLen)mxBreak->nextCharacters(pCandidate->getText(), nPosition,
+ rFontLocale, CharacterIteratorMode::SKIPCELL, 1, nDone) - nPosition;
+ }
+
+ return nNextGlyphLen;
+ }
+
+ public:
+ impPolygonParagraphHandler(
+ const drawinglayer::attribute::SdrFormTextAttribute& rSdrFormTextAttribute,
+ std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rDecomposition,
+ std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rShadowDecomposition)
+ : maSdrFormTextAttribute(rSdrFormTextAttribute),
+ mrDecomposition(rDecomposition),
+ mrShadowDecomposition(rShadowDecomposition)
+ {
+ // prepare BreakIterator
+ Reference < XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ Reference < XInterface > xInterface = xMSF->createInstance(::rtl::OUString::createFromAscii("com.sun.star.i18n.BreakIterator"));
+
+ if(xInterface.is())
+ {
+ Any x = xInterface->queryInterface(::getCppuType((const Reference< XBreakIterator >*)0));
+ x >>= mxBreak;
+ }
+ }
+
+ void HandlePair(const basegfx::B2DPolygon rPolygonCandidate, const ::std::vector< const impPathTextPortion* >& rTextPortions)
+ {
+ // prepare polygon geometry, take into account as many parameters as possible
+ basegfx::B2DPolygon aPolygonCandidate(rPolygonCandidate);
+ const double fPolyLength(basegfx::tools::getLength(aPolygonCandidate));
+ double fPolyEnd(fPolyLength);
+ double fPolyStart(0.0);
+ double fAutosizeScaleFactor(1.0);
+ bool bAutosizeScale(false);
+
+ if(maSdrFormTextAttribute.getFormTextMirror())
+ {
+ aPolygonCandidate.flip();
+ }
+
+ if(maSdrFormTextAttribute.getFormTextStart()
+ && (XFT_LEFT == maSdrFormTextAttribute.getFormTextAdjust()
+ || XFT_RIGHT == maSdrFormTextAttribute.getFormTextAdjust()))
+ {
+ if(XFT_LEFT == maSdrFormTextAttribute.getFormTextAdjust())
+ {
+ fPolyStart += maSdrFormTextAttribute.getFormTextStart();
+
+ if(fPolyStart > fPolyEnd)
+ {
+ fPolyStart = fPolyEnd;
+ }
+ }
+ else
+ {
+ fPolyEnd -= maSdrFormTextAttribute.getFormTextStart();
+
+ if(fPolyEnd < fPolyStart)
+ {
+ fPolyEnd = fPolyStart;
+ }
+ }
+ }
+
+ if(XFT_LEFT != maSdrFormTextAttribute.getFormTextAdjust())
+ {
+ // calculate total text length of this paragraph, some layout needs to be done
+ const double fParagraphTextLength(getParagraphTextLength(rTextPortions));
+
+ // check if text is too long for paragraph. If yes, handle as if left aligned (default),
+ // but still take care of XFT_AUTOSIZE in that case
+ const bool bTextTooLong(fParagraphTextLength > (fPolyEnd - fPolyStart));
+
+ if(XFT_RIGHT == maSdrFormTextAttribute.getFormTextAdjust())
+ {
+ if(!bTextTooLong)
+ {
+ // if right aligned, add difference to polygon start
+ fPolyStart += ((fPolyEnd - fPolyStart) - fParagraphTextLength);
+ }
+ }
+ else if(XFT_CENTER == maSdrFormTextAttribute.getFormTextAdjust())
+ {
+ if(!bTextTooLong)
+ {
+ // if centered, add half of difference to polygon start
+ fPolyStart += ((fPolyEnd - fPolyStart) - fParagraphTextLength) / 2.0;
+ }
+ }
+ else if(XFT_AUTOSIZE == maSdrFormTextAttribute.getFormTextAdjust())
+ {
+ // if scale, prepare scale factor between curve length and text length
+ if(0.0 != fParagraphTextLength)
+ {
+ fAutosizeScaleFactor = (fPolyEnd - fPolyStart) / fParagraphTextLength;
+ bAutosizeScale = true;
+ }
+ }
+ }
+
+ // handle text portions for this paragraph
+ for(sal_uInt32 a(0L); a < rTextPortions.size() && fPolyStart < fPolyEnd; a++)
+ {
+ const impPathTextPortion* pCandidate = rTextPortions[a];
+ basegfx::B2DVector aFontScaling;
+ const drawinglayer::attribute::FontAttribute aCandidateFontAttribute(
+ drawinglayer::primitive2d::getFontAttributeFromVclFont(
+ aFontScaling,
+ pCandidate->getFont(),
+ pCandidate->isRTL(),
+ false));
+
+ if(pCandidate && pCandidate->getTextLength())
+ {
+ drawinglayer::primitive2d::TextLayouterDevice aTextLayouter;
+ aTextLayouter.setFont(pCandidate->getFont());
+ xub_StrLen nUsedTextLength(0);
+
+ while(nUsedTextLength < pCandidate->getTextLength() && fPolyStart < fPolyEnd)
+ {
+ xub_StrLen nNextGlyphLen(getNextGlyphLen(pCandidate, pCandidate->getTextStart() + nUsedTextLength, pCandidate->getLocale()));
+
+ // prepare portion length. Takes RTL sections into account.
+ double fPortionLength(pCandidate->getDisplayLength(nUsedTextLength, nNextGlyphLen));
+
+ if(bAutosizeScale)
+ {
+ // when autosize scaling, expand portion length
+ fPortionLength *= fAutosizeScaleFactor;
+ }
+
+ // create transformation
+ basegfx::B2DHomMatrix aNewTransformA, aNewTransformB, aNewShadowTransform;
+ basegfx::B2DPoint aStartPos(basegfx::tools::getPositionAbsolute(aPolygonCandidate, fPolyStart, fPolyLength));
+ basegfx::B2DPoint aEndPos(aStartPos);
+
+ // add font scaling
+ aNewTransformA.scale(aFontScaling.getX(), aFontScaling.getY());
+
+ // prepare scaling of text primitive
+ if(bAutosizeScale)
+ {
+ // when autosize scaling, expand text primitive scaling to it
+ aNewTransformA.scale(fAutosizeScaleFactor, fAutosizeScaleFactor);
+ }
+
+ // eventually create shadow primitives from aDecomposition and add to rDecomposition
+ const bool bShadow(XFTSHADOW_NONE != maSdrFormTextAttribute.getFormTextShadow());
+
+ if(bShadow)
+ {
+ if(XFTSHADOW_NORMAL == maSdrFormTextAttribute.getFormTextShadow())
+ {
+ aNewShadowTransform.translate(
+ maSdrFormTextAttribute.getFormTextShdwXVal(),
+ -maSdrFormTextAttribute.getFormTextShdwYVal());
+ }
+ else // XFTSHADOW_SLANT
+ {
+ double fScaleValue(maSdrFormTextAttribute.getFormTextShdwYVal() / 100.0);
+ double fShearValue(-maSdrFormTextAttribute.getFormTextShdwXVal() * F_PI1800);
+
+ aNewShadowTransform.scale(1.0, fScaleValue);
+ aNewShadowTransform.shearX(sin(fShearValue));
+ aNewShadowTransform.scale(1.0, cos(fShearValue));
+ }
+ }
+
+ switch(maSdrFormTextAttribute.getFormTextStyle())
+ {
+ case XFT_ROTATE :
+ {
+ aEndPos = basegfx::tools::getPositionAbsolute(aPolygonCandidate, fPolyStart + fPortionLength, fPolyLength);
+ const basegfx::B2DVector aDirection(aEndPos - aStartPos);
+ aNewTransformB.rotate(atan2(aDirection.getY(), aDirection.getX()));
+ aNewTransformB.translate(aStartPos.getX(), aStartPos.getY());
+
+ break;
+ }
+ case XFT_UPRIGHT :
+ {
+ aNewTransformB.translate(aStartPos.getX() - (fPortionLength / 2.0), aStartPos.getY());
+
+ break;
+ }
+ case XFT_SLANTX :
+ {
+ aEndPos = basegfx::tools::getPositionAbsolute(aPolygonCandidate, fPolyStart + fPortionLength, fPolyLength);
+ const basegfx::B2DVector aDirection(aEndPos - aStartPos);
+ const double fShearValue(atan2(aDirection.getY(), aDirection.getX()));
+ const double fSin(sin(fShearValue));
+ const double fCos(cos(fShearValue));
+
+ aNewTransformB.shearX(-fSin);
+
+ // Scale may lead to objects without height since fCos == 0.0 is possible.
+ // Renderers need to handle that, it's not a forbidden value and does not
+ // need to be avoided
+ aNewTransformB.scale(1.0, fCos);
+ aNewTransformB.translate(aStartPos.getX() - (fPortionLength / 2.0), aStartPos.getY());
+
+ break;
+ }
+ case XFT_SLANTY :
+ {
+ aEndPos = basegfx::tools::getPositionAbsolute(aPolygonCandidate, fPolyStart + fPortionLength, fPolyLength);
+ const basegfx::B2DVector aDirection(aEndPos - aStartPos);
+ const double fShearValue(atan2(aDirection.getY(), aDirection.getX()));
+ const double fCos(cos(fShearValue));
+ const double fTan(tan(fShearValue));
+
+ // shear to 'stand' on the curve
+ aNewTransformB.shearY(fTan);
+
+ // scale in X to make as tight as needed. As with XFT_SLANT_X, this may
+ // lead to primitives without width which the renderers will handle
+ aNewTransformA.scale(fCos, 1.0);
+
+ aNewTransformB.translate(aStartPos.getX(), aStartPos.getY());
+
+ break;
+ }
+ default : break; // XFT_NONE
+ }
+
+ // distance from path?
+ if(maSdrFormTextAttribute.getFormTextDistance())
+ {
+ if(aEndPos.equal(aStartPos))
+ {
+ aEndPos = basegfx::tools::getPositionAbsolute(aPolygonCandidate, fPolyStart + fPortionLength, fPolyLength);
+ }
+
+ // use back vector (aStartPos - aEndPos) here to get mirrored perpendicular as in old stuff
+ const basegfx::B2DVector aPerpendicular(
+ basegfx::getNormalizedPerpendicular(aStartPos - aEndPos) *
+ maSdrFormTextAttribute.getFormTextDistance());
+ aNewTransformB.translate(aPerpendicular.getX(), aPerpendicular.getY());
+ }
+
+ if(pCandidate->getText().Len() && nNextGlyphLen)
+ {
+ const xub_StrLen nPortionIndex(pCandidate->getPortionIndex(nUsedTextLength, nNextGlyphLen));
+ ::std::vector< double > aNewDXArray;
+
+ if(nNextGlyphLen > 1 && pCandidate->getDoubleDXArray().size())
+ {
+ // copy DXArray for portion
+ aNewDXArray.insert(
+ aNewDXArray.begin(),
+ pCandidate->getDoubleDXArray().begin() + nPortionIndex,
+ pCandidate->getDoubleDXArray().begin() + (nPortionIndex + nNextGlyphLen));
+
+ if(nPortionIndex > 0)
+ {
+ // adapt to portion start
+ double fDXOffset= *(pCandidate->getDoubleDXArray().begin() + (nPortionIndex - 1));
+ ::std::transform(
+ aNewDXArray.begin(), aNewDXArray.end(),
+ aNewDXArray.begin(), ::std::bind2nd(::std::minus<double>(), fDXOffset));
+ }
+
+ if(bAutosizeScale)
+ {
+ // when autosize scaling, adapt to DXArray, too
+ ::std::transform(
+ aNewDXArray.begin(), aNewDXArray.end(),
+ aNewDXArray.begin(), ::std::bind2nd(::std::multiplies<double>(), fAutosizeScaleFactor));
+ }
+ }
+
+ if(bShadow)
+ {
+ // shadow primitive creation
+ const Color aShadowColor(maSdrFormTextAttribute.getFormTextShdwColor());
+ const basegfx::BColor aRGBShadowColor(aShadowColor.getBColor());
+
+ drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pNew =
+ new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
+ aNewTransformB * aNewShadowTransform * aNewTransformA,
+ pCandidate->getText(),
+ nPortionIndex,
+ nNextGlyphLen,
+ aNewDXArray,
+ aCandidateFontAttribute,
+ pCandidate->getLocale(),
+ aRGBShadowColor);
+
+ mrShadowDecomposition.push_back(pNew);
+ }
+
+ {
+ // primitive creation
+ const Color aColor(pCandidate->getFont().GetColor());
+ const basegfx::BColor aRGBColor(aColor.getBColor());
+
+ drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pNew =
+ new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
+ aNewTransformB * aNewTransformA,
+ pCandidate->getText(),
+ nPortionIndex,
+ nNextGlyphLen,
+ aNewDXArray,
+ aCandidateFontAttribute,
+ pCandidate->getLocale(),
+ aRGBColor);
+
+ mrDecomposition.push_back(pNew);
+ }
+ }
+
+ // consume from portion // no += here, xub_StrLen is sal_uInt16 and the compiler will gererate a warning here
+ nUsedTextLength = nUsedTextLength + nNextGlyphLen;
+
+ // consume from polygon
+ fPolyStart += fPortionLength;
+ }
+ }
+ }
+ }
+ };
+} // end of anonymous namespace
+
+//////////////////////////////////////////////////////////////////////////////
+// primitive decomposition helpers
+
+namespace
+{
+ void impAddPolygonStrokePrimitives(
+ const basegfx::B2DPolyPolygonVector& rB2DPolyPolyVector,
+ const basegfx::B2DHomMatrix& rTransform,
+ const drawinglayer::attribute::LineAttribute& rLineAttribute,
+ const drawinglayer::attribute::StrokeAttribute& rStrokeAttribute,
+ std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rTarget)
+ {
+ for(basegfx::B2DPolyPolygonVector::const_iterator aPolygon(rB2DPolyPolyVector.begin()); aPolygon != rB2DPolyPolyVector.end(); aPolygon++)
+ {
+ // prepare PolyPolygons
+ basegfx::B2DPolyPolygon aB2DPolyPolygon = *aPolygon;
+ aB2DPolyPolygon.transform(rTransform);
+
+ for(sal_uInt32 a(0L); a < aB2DPolyPolygon.count(); a++)
+ {
+ // create one primitive per polygon
+ drawinglayer::primitive2d::PolygonStrokePrimitive2D* pNew =
+ new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
+ aB2DPolyPolygon.getB2DPolygon(a), rLineAttribute, rStrokeAttribute);
+ rTarget.push_back(pNew);
+ }
+ }
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence impAddPathTextOutlines(
+ const std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rSource,
+ const drawinglayer::attribute::SdrFormTextOutlineAttribute& rOutlineAttribute)
+ {
+ std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aNewPrimitives;
+
+ for(sal_uInt32 a(0L); a < rSource.size(); a++)
+ {
+ const drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pTextCandidate = dynamic_cast< const drawinglayer::primitive2d::TextSimplePortionPrimitive2D* >(rSource[a]);
+
+ if(pTextCandidate)
+ {
+ basegfx::B2DPolyPolygonVector aB2DPolyPolyVector;
+ basegfx::B2DHomMatrix aPolygonTransform;
+
+ // get text outlines and their object transformation
+ pTextCandidate->getTextOutlinesAndTransformation(aB2DPolyPolyVector, aPolygonTransform);
+
+ if(aB2DPolyPolyVector.size())
+ {
+ // create stroke primitives
+ std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aStrokePrimitives;
+ impAddPolygonStrokePrimitives(
+ aB2DPolyPolyVector,
+ aPolygonTransform,
+ rOutlineAttribute.getLineAttribute(),
+ rOutlineAttribute.getStrokeAttribute(),
+ aStrokePrimitives);
+ const sal_uInt32 nStrokeCount(aStrokePrimitives.size());
+
+ if(nStrokeCount)
+ {
+ if(rOutlineAttribute.getTransparence())
+ {
+ // create UnifiedTransparencePrimitive2D
+ drawinglayer::primitive2d::Primitive2DSequence aStrokePrimitiveSequence(nStrokeCount);
+
+ for(sal_uInt32 b(0L); b < nStrokeCount; b++)
+ {
+ aStrokePrimitiveSequence[b] = drawinglayer::primitive2d::Primitive2DReference(aStrokePrimitives[b]);
+ }
+
+ drawinglayer::primitive2d::UnifiedTransparencePrimitive2D* pNew2 =
+ new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(
+ aStrokePrimitiveSequence,
+ (double)rOutlineAttribute.getTransparence() / 100.0);
+ aNewPrimitives.push_back(pNew2);
+ }
+ else
+ {
+ // add polygons to rDecomposition as polygonStrokePrimitives
+ aNewPrimitives.insert(aNewPrimitives.end(), aStrokePrimitives.begin(), aStrokePrimitives.end());
+ }
+ }
+ }
+ }
+ }
+
+ const sal_uInt32 nNewCount(aNewPrimitives.size());
+
+ if(nNewCount)
+ {
+ drawinglayer::primitive2d::Primitive2DSequence aRetval(nNewCount);
+
+ for(sal_uInt32 a(0L); a < nNewCount; a++)
+ {
+ aRetval[a] = drawinglayer::primitive2d::Primitive2DReference(aNewPrimitives[a]);
+ }
+
+ return aRetval;
+ }
+ else
+ {
+ return drawinglayer::primitive2d::Primitive2DSequence();
+ }
+ }
+} // end of anonymous namespace
+
+//////////////////////////////////////////////////////////////////////////////
+// primitive decomposition
+
+void SdrTextObj::impDecomposePathTextPrimitive(
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+ const drawinglayer::primitive2d::SdrPathTextPrimitive2D& rSdrPathTextPrimitive,
+ const drawinglayer::geometry::ViewInformation2D& aViewInformation) const
+{
+ drawinglayer::primitive2d::Primitive2DSequence aRetvalA;
+ drawinglayer::primitive2d::Primitive2DSequence aRetvalB;
+
+ // prepare outliner
+ SdrOutliner& rOutliner = ImpGetDrawOutliner();
+ rOutliner.SetUpdateMode(true);
+ rOutliner.Clear();
+ rOutliner.SetPaperSize(Size(LONG_MAX,LONG_MAX));
+ rOutliner.SetText(rSdrPathTextPrimitive.getOutlinerParaObject());
+
+ // set visualizing page at Outliner; needed e.g. for PageNumberField decomposition
+ rOutliner.setVisualizedPage(GetSdrPageFromXDrawPage(aViewInformation.getVisualizedPage()));
+
+ // now break up to text portions
+ impTextBreakupHandler aConverter(rOutliner);
+ const ::std::vector< impPathTextPortion > rPathTextPortions = aConverter.decompositionPathTextPrimitive();
+
+ if(rPathTextPortions.size())
+ {
+ // get FormText and polygon values
+ const drawinglayer::attribute::SdrFormTextAttribute& rFormTextAttribute = rSdrPathTextPrimitive.getSdrFormTextAttribute();
+ const basegfx::B2DPolyPolygon& rPathPolyPolygon(rSdrPathTextPrimitive.getPathPolyPolygon());
+
+ // get loop count
+ sal_uInt32 nLoopCount(rPathPolyPolygon.count());
+
+ if(rOutliner.GetParagraphCount() < nLoopCount)
+ {
+ nLoopCount = rOutliner.GetParagraphCount();
+ }
+
+ if(nLoopCount)
+ {
+ // prepare common decomposition stuff
+ std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aRegularDecomposition;
+ std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aShadowDecomposition;
+ impPolygonParagraphHandler aPolygonParagraphHandler(
+ rFormTextAttribute,
+ aRegularDecomposition,
+ aShadowDecomposition);
+ sal_uInt32 a;
+
+ for(a = 0L; a < nLoopCount; a++)
+ {
+ // filter text portions for this paragraph
+ ::std::vector< const impPathTextPortion* > aParagraphTextPortions;
+
+ for(sal_uInt32 b(0L); b < rPathTextPortions.size(); b++)
+ {
+ const impPathTextPortion& rCandidate = rPathTextPortions[b];
+
+ if(rCandidate.getParagraph() == a)
+ {
+ aParagraphTextPortions.push_back(&rCandidate);
+ }
+ }
+
+ // handle data pair polygon/ParagraphTextPortions
+ if(aParagraphTextPortions.size())
+ {
+ aPolygonParagraphHandler.HandlePair(rPathPolyPolygon.getB2DPolygon(a), aParagraphTextPortions);
+ }
+ }
+
+ const sal_uInt32 nShadowCount(aShadowDecomposition.size());
+ const sal_uInt32 nRegularCount(aRegularDecomposition.size());
+
+ if(nShadowCount)
+ {
+ // add shadow primitives to decomposition
+ aRetvalA.realloc(nShadowCount);
+
+ for(a = 0L; a < nShadowCount; a++)
+ {
+ aRetvalA[a] = drawinglayer::primitive2d::Primitive2DReference(aShadowDecomposition[a]);
+ }
+
+ // evtl. add shadow outlines
+ if(rFormTextAttribute.getFormTextOutline()
+ && !rFormTextAttribute.getShadowOutline().isDefault())
+ {
+ const drawinglayer::primitive2d::Primitive2DSequence aOutlines(
+ impAddPathTextOutlines(
+ aShadowDecomposition,
+ rFormTextAttribute.getShadowOutline()));
+
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aRetvalA, aOutlines);
+ }
+ }
+
+ if(nRegularCount)
+ {
+ // add normal primitives to decomposition
+ aRetvalB.realloc(nRegularCount);
+
+ for(a = 0L; a < nRegularCount; a++)
+ {
+ aRetvalB[a] = drawinglayer::primitive2d::Primitive2DReference(aRegularDecomposition[a]);
+ }
+
+ // evtl. add outlines
+ if(rFormTextAttribute.getFormTextOutline()
+ && !rFormTextAttribute.getOutline().isDefault())
+ {
+ const drawinglayer::primitive2d::Primitive2DSequence aOutlines(
+ impAddPathTextOutlines(
+ aRegularDecomposition,
+ rFormTextAttribute.getOutline()));
+
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aRetvalB, aOutlines);
+ }
+ }
+ }
+ }
+
+ // cleanup outliner
+ rOutliner.SetDrawPortionHdl(Link());
+ rOutliner.Clear();
+ rOutliner.setVisualizedPage(0);
+
+ // concatenate all results
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(rTarget, aRetvalA);
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(rTarget, aRetvalB);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/svdraw/svdotxat.cxx b/svx/source/svdraw/svdotxat.cxx
new file mode 100644
index 000000000000..6a903b75ae92
--- /dev/null
+++ b/svx/source/svdraw/svdotxat.cxx
@@ -0,0 +1,462 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svl/style.hxx>
+#include <svx/svdotext.hxx>
+#include "svx/svditext.hxx"
+#include <svx/svdmodel.hxx> // fuer GetMaxObjSize und GetStyleSheetPool
+#include <svx/svdoutl.hxx>
+#include <svx/svdorect.hxx> // fuer SetDirty bei NbcAdjustTextFrameWidthAndHeight
+#include <svx/svdocapt.hxx> // fuer SetDirty bei NbcAdjustTextFrameWidthAndHeight
+#include <svx/svdetc.hxx>
+#include <editeng/writingmodeitem.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/flditem.hxx>
+#include <svx/sdtfchim.hxx>
+
+
+#include <editeng/editview.hxx>
+#include <svl/smplhint.hxx>
+#include <svl/whiter.hxx>
+#include <editeng/outlobj.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/editobj.hxx>
+#include <editeng/fhgtitem.hxx>
+
+#include <editeng/charscaleitem.hxx>
+#include <svl/style.hxx>
+#include <svl/itemiter.hxx>
+#include <editeng/lrspitem.hxx>
+#include <svl/itempool.hxx>
+#include <editeng/numitem.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/postitem.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@@@ @@@@@ @@ @@ @@@@@@ @@@@ @@@@@ @@@@@@
+// @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@@@@ @@ @@ @@ @@ @@ @@
+// @@ @@@@ @@@ @@ @@ @@ @@@@@ @@
+// @@ @@ @@@@@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@@@@ @@ @@ @@ @@@@ @@@@@ @@@@
+//
+// Attribute, StyleSheets und AutoGrow
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+FASTBOOL SdrTextObj::AdjustTextFrameWidthAndHeight(Rectangle& rR, FASTBOOL bHgt, FASTBOOL bWdt) const
+{
+ if (bTextFrame && pModel!=NULL && !rR.IsEmpty())
+ {
+ SdrFitToSizeType eFit=GetFitToSize();
+ FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
+ FASTBOOL bWdtGrow=bWdt && IsAutoGrowWidth();
+ FASTBOOL bHgtGrow=bHgt && IsAutoGrowHeight();
+ SdrTextAniKind eAniKind=GetTextAniKind();
+ SdrTextAniDirection eAniDir=GetTextAniDirection();
+ FASTBOOL bScroll=eAniKind==SDRTEXTANI_SCROLL || eAniKind==SDRTEXTANI_ALTERNATE || eAniKind==SDRTEXTANI_SLIDE;
+ FASTBOOL bHScroll=bScroll && (eAniDir==SDRTEXTANI_LEFT || eAniDir==SDRTEXTANI_RIGHT);
+ FASTBOOL bVScroll=bScroll && (eAniDir==SDRTEXTANI_UP || eAniDir==SDRTEXTANI_DOWN);
+ if (!bFitToSize && (bWdtGrow || bHgtGrow))
+ {
+ Rectangle aR0(rR);
+ long nHgt=0,nMinHgt=0,nMaxHgt=0;
+ long nWdt=0,nMinWdt=0,nMaxWdt=0;
+ Size aSiz(rR.GetSize()); aSiz.Width()--; aSiz.Height()--;
+ Size aMaxSiz(100000,100000);
+ Size aTmpSiz(pModel->GetMaxObjSize());
+ if (aTmpSiz.Width()!=0) aMaxSiz.Width()=aTmpSiz.Width();
+ if (aTmpSiz.Height()!=0) aMaxSiz.Height()=aTmpSiz.Height();
+ if (bWdtGrow)
+ {
+ nMinWdt=GetMinTextFrameWidth();
+ nMaxWdt=GetMaxTextFrameWidth();
+ if (nMaxWdt==0 || nMaxWdt>aMaxSiz.Width()) nMaxWdt=aMaxSiz.Width();
+ if (nMinWdt<=0) nMinWdt=1;
+ aSiz.Width()=nMaxWdt;
+ }
+ if (bHgtGrow)
+ {
+ nMinHgt=GetMinTextFrameHeight();
+ nMaxHgt=GetMaxTextFrameHeight();
+ if (nMaxHgt==0 || nMaxHgt>aMaxSiz.Height()) nMaxHgt=aMaxSiz.Height();
+ if (nMinHgt<=0) nMinHgt=1;
+ aSiz.Height()=nMaxHgt;
+ }
+ long nHDist=GetTextLeftDistance()+GetTextRightDistance();
+ long nVDist=GetTextUpperDistance()+GetTextLowerDistance();
+ aSiz.Width()-=nHDist;
+ aSiz.Height()-=nVDist;
+ if (aSiz.Width()<2) aSiz.Width()=2; // Mindestgroesse 2
+ if (aSiz.Height()<2) aSiz.Height()=2; // Mindestgroesse 2
+
+ // #101684#
+ sal_Bool bInEditMode = IsInEditMode();
+
+ if(!bInEditMode)
+ {
+ if (bHScroll) aSiz.Width()=0x0FFFFFFF; // Laufschrift nicht umbrechen
+ if (bVScroll) aSiz.Height()=0x0FFFFFFF;
+ }
+
+ if(pEdtOutl)
+ {
+ pEdtOutl->SetMaxAutoPaperSize(aSiz);
+ if (bWdtGrow) {
+ Size aSiz2(pEdtOutl->CalcTextSize());
+ nWdt=aSiz2.Width()+1; // lieber etwas Tolleranz
+ if (bHgtGrow) nHgt=aSiz2.Height()+1; // lieber etwas Tolleranz
+ } else {
+ nHgt=pEdtOutl->GetTextHeight()+1; // lieber etwas Tolleranz
+ }
+ } else {
+ Outliner& rOutliner=ImpGetDrawOutliner();
+ rOutliner.SetPaperSize(aSiz);
+ rOutliner.SetUpdateMode(sal_True);
+ // !!! hier sollte ich wohl auch noch mal die Optimierung mit
+ // bPortionInfoChecked usw einbauen
+ OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
+ if ( pOutlinerParaObject != NULL )
+ {
+ rOutliner.SetText(*pOutlinerParaObject);
+ rOutliner.SetFixedCellHeight(((const SdrTextFixedCellHeightItem&)GetMergedItem(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue());
+ }
+ if (bWdtGrow)
+ {
+ Size aSiz2(rOutliner.CalcTextSize());
+ nWdt=aSiz2.Width()+1; // lieber etwas Tolleranz
+ if (bHgtGrow) nHgt=aSiz2.Height()+1; // lieber etwas Tolleranz
+ } else {
+ nHgt=rOutliner.GetTextHeight()+1; // lieber etwas Tolleranz
+ }
+ rOutliner.Clear();
+ }
+ if (nWdt<nMinWdt) nWdt=nMinWdt;
+ if (nWdt>nMaxWdt) nWdt=nMaxWdt;
+ nWdt+=nHDist;
+ if (nWdt<1) nWdt=1; // nHDist kann auch negativ sein
+ if (nHgt<nMinHgt) nHgt=nMinHgt;
+ if (nHgt>nMaxHgt) nHgt=nMaxHgt;
+ nHgt+=nVDist;
+ if (nHgt<1) nHgt=1; // nVDist kann auch negativ sein
+ long nWdtGrow=nWdt-(rR.Right()-rR.Left());
+ long nHgtGrow=nHgt-(rR.Bottom()-rR.Top());
+ if (nWdtGrow==0) bWdtGrow=sal_False;
+ if (nHgtGrow==0) bHgtGrow=sal_False;
+ if (bWdtGrow || bHgtGrow) {
+ if (bWdtGrow) {
+ SdrTextHorzAdjust eHAdj=GetTextHorizontalAdjust();
+ if (eHAdj==SDRTEXTHORZADJUST_LEFT) rR.Right()+=nWdtGrow;
+ else if (eHAdj==SDRTEXTHORZADJUST_RIGHT) rR.Left()-=nWdtGrow;
+ else {
+ long nWdtGrow2=nWdtGrow/2;
+ rR.Left()-=nWdtGrow2;
+ rR.Right()=rR.Left()+nWdt;
+ }
+ }
+ if (bHgtGrow) {
+ SdrTextVertAdjust eVAdj=GetTextVerticalAdjust();
+ if (eVAdj==SDRTEXTVERTADJUST_TOP) rR.Bottom()+=nHgtGrow;
+ else if (eVAdj==SDRTEXTVERTADJUST_BOTTOM) rR.Top()-=nHgtGrow;
+ else {
+ long nHgtGrow2=nHgtGrow/2;
+ rR.Top()-=nHgtGrow2;
+ rR.Bottom()=rR.Top()+nHgt;
+ }
+ }
+ if (aGeo.nDrehWink!=0) {
+ Point aD1(rR.TopLeft());
+ aD1-=aR0.TopLeft();
+ Point aD2(aD1);
+ RotatePoint(aD2,Point(),aGeo.nSin,aGeo.nCos);
+ aD2-=aD1;
+ rR.Move(aD2.X(),aD2.Y());
+ }
+ return sal_True;
+ }
+ }
+ }
+ return sal_False;
+}
+
+FASTBOOL SdrTextObj::NbcAdjustTextFrameWidthAndHeight(FASTBOOL bHgt, FASTBOOL bWdt)
+{
+ FASTBOOL bRet=AdjustTextFrameWidthAndHeight(aRect,bHgt,bWdt);
+ if (bRet) {
+ SetRectsDirty();
+ if (HAS_BASE(SdrRectObj,this)) { // mal wieder 'nen Hack
+ ((SdrRectObj*)this)->SetXPolyDirty();
+ }
+ if (HAS_BASE(SdrCaptionObj,this)) { // mal wieder 'nen Hack
+ ((SdrCaptionObj*)this)->ImpRecalcTail();
+ }
+ }
+ return bRet;
+}
+
+FASTBOOL SdrTextObj::AdjustTextFrameWidthAndHeight(FASTBOOL bHgt, FASTBOOL bWdt)
+{
+ Rectangle aNeuRect(aRect);
+ FASTBOOL bRet=AdjustTextFrameWidthAndHeight(aNeuRect,bHgt,bWdt);
+ if (bRet) {
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ // #110094#-14 SendRepaintBroadcast();
+ aRect=aNeuRect;
+ SetRectsDirty();
+ if (HAS_BASE(SdrRectObj,this)) { // mal wieder 'nen Hack
+ ((SdrRectObj*)this)->SetXPolyDirty();
+ }
+ if (HAS_BASE(SdrCaptionObj,this)) { // mal wieder 'nen Hack
+ ((SdrCaptionObj*)this)->ImpRecalcTail();
+ }
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+ }
+ return bRet;
+}
+
+void SdrTextObj::ImpSetTextStyleSheetListeners()
+{
+ SfxStyleSheetBasePool* pStylePool=pModel!=NULL ? pModel->GetStyleSheetPool() : NULL;
+ if (pStylePool!=NULL)
+ {
+ Container aStyles(1024,64,64);
+ OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
+ if (pOutlinerParaObject!=NULL)
+ {
+ // Zunaechst werden alle im ParaObject enthaltenen StyleSheets
+ // im Container aStyles gesammelt. Dazu wird die Family jeweils
+ // ans Ende des StyleSheet-Namen drangehaengt.
+ const EditTextObject& rTextObj=pOutlinerParaObject->GetTextObject();
+ XubString aStyleName;
+ SfxStyleFamily eStyleFam;
+ sal_uInt16 nParaAnz=rTextObj.GetParagraphCount();
+
+ for(sal_uInt16 nParaNum(0); nParaNum < nParaAnz; nParaNum++)
+ {
+ rTextObj.GetStyleSheet(nParaNum, aStyleName, eStyleFam);
+
+ if(aStyleName.Len())
+ {
+ XubString aFam = UniString::CreateFromInt32((sal_uInt16)eStyleFam);
+ aFam.Expand(5);
+
+ aStyleName += sal_Unicode('|');
+ aStyleName += aFam;
+
+ sal_Bool bFnd(sal_False);
+ sal_uInt32 nNum(aStyles.Count());
+
+ while(!bFnd && nNum > 0)
+ {
+ // kein StyleSheet doppelt!
+ nNum--;
+ bFnd = (aStyleName.Equals(*(XubString*)aStyles.GetObject(nNum)));
+ }
+
+ if(!bFnd)
+ {
+ aStyles.Insert(new XubString(aStyleName), CONTAINER_APPEND);
+ }
+ }
+ }
+ }
+
+ // nun die Strings im Container durch StyleSheet* ersetzten
+ sal_uIntPtr nNum=aStyles.Count();
+ while (nNum>0) {
+ nNum--;
+ XubString* pName=(XubString*)aStyles.GetObject(nNum);
+
+ // UNICODE: String aFam(pName->Cut(pName->Len()-6));
+ String aFam = pName->Copy(0, pName->Len() - 6);
+
+ aFam.Erase(0,1);
+ aFam.EraseTrailingChars();
+
+ // UNICODE: sal_uInt16 nFam=sal_uInt16(aFam);
+ sal_uInt16 nFam = (sal_uInt16)aFam.ToInt32();
+
+ SfxStyleFamily eFam=(SfxStyleFamily)nFam;
+ SfxStyleSheetBase* pStyleBase=pStylePool->Find(*pName,eFam);
+ SfxStyleSheet* pStyle=PTR_CAST(SfxStyleSheet,pStyleBase);
+ delete pName;
+ if (pStyle!=NULL && pStyle!=GetStyleSheet()) {
+ aStyles.Replace(pStyle,nNum);
+ } else {
+ aStyles.Remove(nNum);
+ }
+ }
+ // jetzt alle ueberfluessigen StyleSheets entfernen
+ nNum=GetBroadcasterCount();
+ while (nNum>0) {
+ nNum--;
+ SfxBroadcaster* pBroadcast=GetBroadcasterJOE((sal_uInt16)nNum);
+ SfxStyleSheet* pStyle=PTR_CAST(SfxStyleSheet,pBroadcast);
+ if (pStyle!=NULL && pStyle!=GetStyleSheet()) { // Sonderbehandlung fuer den StyleSheet des Objekts
+ if (aStyles.GetPos(pStyle)==CONTAINER_ENTRY_NOTFOUND) {
+ EndListening(*pStyle);
+ }
+ }
+ }
+ // und schliesslich alle in aStyles enthaltenen StyleSheets mit den vorhandenen Broadcastern mergen
+ nNum=aStyles.Count();
+ while (nNum>0) {
+ nNum--;
+ SfxStyleSheet* pStyle=(SfxStyleSheet*)aStyles.GetObject(nNum);
+ // StartListening soll selbst nachsehen, ob hier nicht evtl. schon gehorcht wird
+ StartListening(*pStyle,sal_True);
+ }
+ }
+}
+
+void SdrTextObj::NbcResizeTextAttributes(const Fraction& xFact, const Fraction& yFact)
+{
+ OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
+ if (pOutlinerParaObject!=NULL && xFact.IsValid() && yFact.IsValid())
+ {
+ Fraction n100(100,1);
+ long nX=long(xFact*n100);
+ long nY=long(yFact*n100);
+ if (nX<0) nX=-nX;
+ if (nX<1) nX=1;
+ if (nX>0xFFFF) nX=0xFFFF;
+ if (nY<0) nY=-nY;
+ if (nY<1) nY=1;
+ if (nY>0xFFFF) nY=0xFFFF;
+ if (nX!=100 || nY!=100)
+ {
+ // Rahmenattribute
+ const SfxItemSet& rSet = GetObjectItemSet();
+ const SvxCharScaleWidthItem& rOldWdt=(SvxCharScaleWidthItem&)rSet.Get(EE_CHAR_FONTWIDTH);
+ const SvxFontHeightItem& rOldHgt=(SvxFontHeightItem&)rSet.Get(EE_CHAR_FONTHEIGHT);
+
+ // erstmal die alten Werte holen
+ long nRelWdt=rOldWdt.GetValue();
+ long nAbsHgt=rOldHgt.GetHeight();
+ long nRelHgt=rOldHgt.GetProp();
+
+ // Relative Breite aendern
+ nRelWdt*=nX;
+ nRelWdt/=nY;
+ if (nRelWdt<0) nRelWdt=-nRelWdt; // nicht negativ
+ if (nRelWdt<=0) nRelWdt=1; // und mind. 1%
+ if (nRelWdt>0xFFFF) nRelWdt=0xFFFF;
+
+ // Absolute Hoehe aendern
+ nAbsHgt*=nY;
+ nAbsHgt/=100;
+ if (nAbsHgt<0) nAbsHgt=-nAbsHgt; // nicht negativ
+ if (nAbsHgt<=0) nAbsHgt=1; // und mind. 1
+ if (nAbsHgt>0xFFFF) nAbsHgt=0xFFFF;
+
+ // und nun attributieren
+ SetObjectItem(SvxCharScaleWidthItem( (sal_uInt16) nRelWdt, EE_CHAR_FONTWIDTH));
+ SetObjectItem(SvxFontHeightItem(nAbsHgt,(sal_uInt16)nRelHgt, EE_CHAR_FONTHEIGHT));
+ // Zeichen- und Absatzattribute innerhalb des OutlinerParaObjects
+ Outliner& rOutliner=ImpGetDrawOutliner();
+ rOutliner.SetPaperSize(Size(LONG_MAX,LONG_MAX));
+ rOutliner.SetText(*pOutlinerParaObject);
+ rOutliner.DoStretchChars((sal_uInt16)nX,(sal_uInt16)nY);
+ OutlinerParaObject* pNewPara=rOutliner.CreateParaObject();
+ NbcSetOutlinerParaObject(pNewPara);
+ rOutliner.Clear();
+ }
+ }
+}
+
+/** #103836# iterates over the paragraphs of a given SdrObject and removes all
+ hard set character attributes with the which ids contained in the
+ given vector
+*/
+void SdrTextObj::RemoveOutlinerCharacterAttribs( const std::vector<sal_uInt16>& rCharWhichIds )
+{
+ sal_Int32 nText = getTextCount();
+
+ while( --nText >= 0 )
+ {
+ SdrText* pText = getText( nText );
+ OutlinerParaObject* pOutlinerParaObject = pText ? pText->GetOutlinerParaObject() : 0;
+
+ if(pOutlinerParaObject)
+ {
+ Outliner* pOutliner = 0;
+
+ if( pEdtOutl || (pText == getActiveText()) )
+ pOutliner = pEdtOutl;
+
+ if(!pOutliner)
+ {
+ pOutliner = &ImpGetDrawOutliner();
+ pOutliner->SetText(*pOutlinerParaObject);
+ }
+
+ ESelection aSelAll( 0, 0, 0xffff, 0xffff );
+ std::vector<sal_uInt16>::const_iterator aIter( rCharWhichIds.begin() );
+ while( aIter != rCharWhichIds.end() )
+ {
+ pOutliner->RemoveAttribs( aSelAll, false, (*aIter++) );
+ }
+
+ if(!pEdtOutl || (pText != getActiveText()) )
+ {
+ const sal_uInt32 nParaCount = pOutliner->GetParagraphCount();
+ OutlinerParaObject* pTemp = pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount);
+ pOutliner->Clear();
+ NbcSetOutlinerParaObjectForText(pTemp, pText);
+ }
+ }
+ }
+}
+
+bool SdrTextObj::HasText() const
+{
+ if( pEdtOutl )
+ return HasEditText();
+
+ OutlinerParaObject* pOPO = GetOutlinerParaObject();
+
+ bool bHasText = false;
+ if( pOPO )
+ {
+ const EditTextObject& rETO = pOPO->GetTextObject();
+ sal_uInt16 nParaCount = rETO.GetParagraphCount();
+
+ if( nParaCount > 0 )
+ bHasText = (nParaCount > 1) || (rETO.GetText( 0 ).Len() != 0);
+ }
+
+ return bHasText;
+}
diff --git a/svx/source/svdraw/svdotxdr.cxx b/svx/source/svdraw/svdotxdr.cxx
new file mode 100644
index 000000000000..845df672d834
--- /dev/null
+++ b/svx/source/svdraw/svdotxdr.cxx
@@ -0,0 +1,285 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svdotext.hxx>
+#include <svx/svdhdl.hxx>
+#include <svx/svddrag.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdorect.hxx> // fuer SetXPolyDirty in MovCreate bei SolidDragging
+#include "svx/svdglob.hxx" // Stringcache
+#include "svx/svdstr.hrc" // Objektname
+#include <svx/svdoashp.hxx>
+#include <tools/bigint.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@@@ @@@@@ @@ @@ @@@@@@ @@@@ @@@@@ @@@@@@
+// @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@@@@ @@ @@ @@ @@ @@ @@
+// @@ @@@@ @@@ @@ @@ @@ @@@@@ @@
+// @@ @@ @@@@@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@@@@ @@ @@ @@ @@@@ @@@@@ @@@@
+//
+// Dragging, Handles, Create
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_uInt32 SdrTextObj::GetHdlCount() const
+{
+ return 8L;
+}
+
+SdrHdl* SdrTextObj::GetHdl(sal_uInt32 nHdlNum) const
+{
+ SdrHdl* pH=NULL;
+ Point aPnt;
+ SdrHdlKind eKind=HDL_MOVE;
+ switch (nHdlNum) {
+ case 0: aPnt=aRect.TopLeft(); eKind=HDL_UPLFT; break; // Oben links
+ case 1: aPnt=aRect.TopCenter(); eKind=HDL_UPPER; break; // Oben
+ case 2: aPnt=aRect.TopRight(); eKind=HDL_UPRGT; break; // Oben rechts
+ case 3: aPnt=aRect.LeftCenter(); eKind=HDL_LEFT ; break; // Links
+ case 4: aPnt=aRect.RightCenter(); eKind=HDL_RIGHT; break; // Rechts
+ case 5: aPnt=aRect.BottomLeft(); eKind=HDL_LWLFT; break; // Unten links
+ case 6: aPnt=aRect.BottomCenter(); eKind=HDL_LOWER; break; // Unten
+ case 7: aPnt=aRect.BottomRight(); eKind=HDL_LWRGT; break; // Unten rechts
+ }
+ if (aGeo.nShearWink!=0) ShearPoint(aPnt,aRect.TopLeft(),aGeo.nTan);
+ if (aGeo.nDrehWink!=0) RotatePoint(aPnt,aRect.TopLeft(),aGeo.nSin,aGeo.nCos);
+ if (eKind!=HDL_MOVE) {
+ pH=new SdrHdl(aPnt,eKind);
+ pH->SetObj((SdrObject*)this);
+ pH->SetDrehWink(aGeo.nDrehWink);
+ }
+ return pH;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+bool SdrTextObj::hasSpecialDrag() const
+{
+ return true;
+}
+
+Rectangle SdrTextObj::ImpDragCalcRect(const SdrDragStat& rDrag) const
+{
+ Rectangle aTmpRect(aRect);
+ const SdrHdl* pHdl=rDrag.GetHdl();
+ SdrHdlKind eHdl=pHdl==NULL ? HDL_MOVE : pHdl->GetKind();
+ FASTBOOL bEcke=(eHdl==HDL_UPLFT || eHdl==HDL_UPRGT || eHdl==HDL_LWLFT || eHdl==HDL_LWRGT);
+ FASTBOOL bOrtho=rDrag.GetView()!=NULL && rDrag.GetView()->IsOrtho();
+ FASTBOOL bBigOrtho=bEcke && bOrtho && rDrag.GetView()->IsBigOrtho();
+ Point aPos(rDrag.GetNow());
+ // Unrotate:
+ if (aGeo.nDrehWink!=0) RotatePoint(aPos,aTmpRect.TopLeft(),-aGeo.nSin,aGeo.nCos);
+ // Unshear:
+ if (aGeo.nShearWink!=0) ShearPoint(aPos,aTmpRect.TopLeft(),-aGeo.nTan);
+ //
+ FASTBOOL bLft=(eHdl==HDL_UPLFT || eHdl==HDL_LEFT || eHdl==HDL_LWLFT);
+ FASTBOOL bRgt=(eHdl==HDL_UPRGT || eHdl==HDL_RIGHT || eHdl==HDL_LWRGT);
+ FASTBOOL bTop=(eHdl==HDL_UPRGT || eHdl==HDL_UPPER || eHdl==HDL_UPLFT);
+ FASTBOOL bBtm=(eHdl==HDL_LWRGT || eHdl==HDL_LOWER || eHdl==HDL_LWLFT);
+ if (bLft) aTmpRect.Left() =aPos.X();
+ if (bRgt) aTmpRect.Right() =aPos.X();
+ if (bTop) aTmpRect.Top() =aPos.Y();
+ if (bBtm) aTmpRect.Bottom()=aPos.Y();
+ if (bOrtho) { // Ortho
+ long nWdt0=aRect.Right() -aRect.Left();
+ long nHgt0=aRect.Bottom()-aRect.Top();
+ long nXMul=aTmpRect.Right() -aTmpRect.Left();
+ long nYMul=aTmpRect.Bottom()-aTmpRect.Top();
+ long nXDiv=nWdt0;
+ long nYDiv=nHgt0;
+ FASTBOOL bXNeg=(nXMul<0)!=(nXDiv<0);
+ FASTBOOL bYNeg=(nYMul<0)!=(nYDiv<0);
+ nXMul=Abs(nXMul);
+ nYMul=Abs(nYMul);
+ nXDiv=Abs(nXDiv);
+ nYDiv=Abs(nYDiv);
+ Fraction aXFact(nXMul,nXDiv); // Fractions zum kuerzen
+ Fraction aYFact(nYMul,nYDiv); // und zum vergleichen
+ nXMul=aXFact.GetNumerator();
+ nYMul=aYFact.GetNumerator();
+ nXDiv=aXFact.GetDenominator();
+ nYDiv=aYFact.GetDenominator();
+ if (bEcke) { // Eckpunkthandles
+ FASTBOOL bUseX=(aXFact<aYFact) != bBigOrtho;
+ if (bUseX) {
+ long nNeed=long(BigInt(nHgt0)*BigInt(nXMul)/BigInt(nXDiv));
+ if (bYNeg) nNeed=-nNeed;
+ if (bTop) aTmpRect.Top()=aTmpRect.Bottom()-nNeed;
+ if (bBtm) aTmpRect.Bottom()=aTmpRect.Top()+nNeed;
+ } else {
+ long nNeed=long(BigInt(nWdt0)*BigInt(nYMul)/BigInt(nYDiv));
+ if (bXNeg) nNeed=-nNeed;
+ if (bLft) aTmpRect.Left()=aTmpRect.Right()-nNeed;
+ if (bRgt) aTmpRect.Right()=aTmpRect.Left()+nNeed;
+ }
+ } else { // Scheitelpunkthandles
+ if ((bLft || bRgt) && nXDiv!=0) {
+ long nHgt0b=aRect.Bottom()-aRect.Top();
+ long nNeed=long(BigInt(nHgt0b)*BigInt(nXMul)/BigInt(nXDiv));
+ aTmpRect.Top()-=(nNeed-nHgt0b)/2;
+ aTmpRect.Bottom()=aTmpRect.Top()+nNeed;
+ }
+ if ((bTop || bBtm) && nYDiv!=0) {
+ long nWdt0b=aRect.Right()-aRect.Left();
+ long nNeed=long(BigInt(nWdt0b)*BigInt(nYMul)/BigInt(nYDiv));
+ aTmpRect.Left()-=(nNeed-nWdt0b)/2;
+ aTmpRect.Right()=aTmpRect.Left()+nNeed;
+ }
+ }
+ }
+ if (!ISA(SdrObjCustomShape)) // not justifying for CustomShapes to be able to detect if a shape has to be mirrored
+ ImpJustifyRect(aTmpRect);
+ return aTmpRect;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// drag
+
+bool SdrTextObj::applySpecialDrag(SdrDragStat& rDrag)
+{
+ Rectangle aNewRect(ImpDragCalcRect(rDrag));
+
+ if(aNewRect.TopLeft() != aRect.TopLeft() && (aGeo.nDrehWink || aGeo.nShearWink))
+ {
+ Point aNewPos(aNewRect.TopLeft());
+
+ if(aGeo.nShearWink)
+ ShearPoint(aNewPos,aRect.TopLeft(),aGeo.nTan);
+
+ if(aGeo.nDrehWink)
+ RotatePoint(aNewPos,aRect.TopLeft(),aGeo.nSin,aGeo.nCos);
+
+ aNewRect.SetPos(aNewPos);
+ }
+
+ if(aNewRect != aRect)
+ {
+ NbcSetLogicRect(aNewRect);
+ }
+
+ return true;
+}
+
+String SdrTextObj::getSpecialDragComment(const SdrDragStat& /*rDrag*/) const
+{
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_DragRectResize,aStr);
+ return aStr;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Create
+
+FASTBOOL SdrTextObj::BegCreate(SdrDragStat& rStat)
+{
+ rStat.SetOrtho4Possible();
+ Rectangle aRect1(rStat.GetStart(), rStat.GetNow());
+ aRect1.Justify();
+ rStat.SetActionRect(aRect1);
+ aRect = aRect1;
+ return sal_True;
+}
+
+FASTBOOL SdrTextObj::MovCreate(SdrDragStat& rStat)
+{
+ Rectangle aRect1;
+ rStat.TakeCreateRect(aRect1);
+ ImpJustifyRect(aRect1);
+ rStat.SetActionRect(aRect1);
+ aRect=aRect1; // fuer ObjName
+ SetBoundRectDirty();
+ bSnapRectDirty=sal_True;
+ if (HAS_BASE(SdrRectObj,this)) {
+ ((SdrRectObj*)this)->SetXPolyDirty();
+ }
+ return sal_True;
+}
+
+FASTBOOL SdrTextObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
+{
+ rStat.TakeCreateRect(aRect);
+ ImpJustifyRect(aRect);
+ if (bTextFrame) {
+ if (IsAutoGrowHeight()) {
+ // MinTextHeight
+ long nHgt=aRect.GetHeight()-1;
+ if (nHgt==1) nHgt=0;
+ NbcSetMinTextFrameHeight(nHgt);
+ }
+ if (IsAutoGrowWidth()) {
+ // MinTextWidth
+ long nWdt=aRect.GetWidth()-1;
+ if (nWdt==1) nWdt=0;
+ NbcSetMinTextFrameWidth(nWdt);
+ }
+ // Textrahmen neu berechnen
+ NbcAdjustTextFrameWidthAndHeight();
+ }
+ SetRectsDirty();
+ if (HAS_BASE(SdrRectObj,this)) {
+ ((SdrRectObj*)this)->SetXPolyDirty();
+ }
+ return (eCmd==SDRCREATE_FORCEEND || rStat.GetPointAnz()>=2);
+}
+
+void SdrTextObj::BrkCreate(SdrDragStat& /*rStat*/)
+{
+}
+
+FASTBOOL SdrTextObj::BckCreate(SdrDragStat& /*rStat*/)
+{
+ return sal_True;
+}
+
+basegfx::B2DPolyPolygon SdrTextObj::TakeCreatePoly(const SdrDragStat& rDrag) const
+{
+ Rectangle aRect1;
+ rDrag.TakeCreateRect(aRect1);
+ aRect1.Justify();
+
+ basegfx::B2DPolyPolygon aRetval;
+ const basegfx::B2DRange aRange(aRect1.Left(), aRect1.Top(), aRect1.Right(), aRect1.Bottom());
+ aRetval.append(basegfx::tools::createPolygonFromRect(aRange));
+ return aRetval;
+}
+
+Pointer SdrTextObj::GetCreatePointer() const
+{
+ if (IsTextFrame()) return Pointer(POINTER_DRAW_TEXT);
+ return Pointer(POINTER_CROSS);
+}
+
diff --git a/svx/source/svdraw/svdotxed.cxx b/svx/source/svdraw/svdotxed.cxx
new file mode 100644
index 000000000000..af53a36f133c
--- /dev/null
+++ b/svx/source/svdraw/svdotxed.cxx
@@ -0,0 +1,350 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svdotext.hxx>
+#include "svx/svditext.hxx"
+#include <svx/svdmodel.hxx> // fuer GetMaxObjSize
+#include <svx/svdoutl.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/editstat.hxx>
+#include <svl/itemset.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/sdtfchim.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@@@ @@@@@ @@ @@ @@@@@@ @@@@ @@@@@ @@@@@@
+// @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@@@@ @@ @@ @@ @@ @@ @@
+// @@ @@@@ @@@ @@ @@ @@ @@@@@ @@
+// @@ @@ @@@@@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@@@@ @@ @@ @@ @@@@ @@@@@ @@@@
+//
+// TextEdit
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+FASTBOOL SdrTextObj::HasTextEdit() const
+{
+ // lt. Anweisung von MB duerfen gelinkte Textobjekte nun doch
+ // geaendert werden (kein automatisches Reload)
+ return sal_True;
+}
+
+sal_Bool SdrTextObj::BegTextEdit(SdrOutliner& rOutl)
+{
+ if (pEdtOutl!=NULL) return sal_False; // Textedit laeuft evtl. schon an einer anderen View!
+ pEdtOutl=&rOutl;
+
+ // #101684#
+ mbInEditMode = sal_True;
+
+ sal_uInt16 nOutlinerMode = OUTLINERMODE_OUTLINEOBJECT;
+ if ( !IsOutlText() )
+ nOutlinerMode = OUTLINERMODE_TEXTOBJECT;
+ rOutl.Init( nOutlinerMode );
+ rOutl.SetRefDevice( pModel->GetRefDevice() );
+
+ SdrFitToSizeType eFit=GetFitToSize();
+ FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
+ FASTBOOL bContourFrame=IsContourTextFrame();
+ ImpSetTextEditParams();
+
+ if (!bContourFrame) {
+ sal_uIntPtr nStat=rOutl.GetControlWord();
+ nStat|=EE_CNTRL_AUTOPAGESIZE;
+ if (bFitToSize) nStat|=EE_CNTRL_STRETCHING; else nStat&=~EE_CNTRL_STRETCHING;
+ rOutl.SetControlWord(nStat);
+ }
+
+ OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
+ if(pOutlinerParaObject!=NULL)
+ {
+ rOutl.SetText(*GetOutlinerParaObject());
+ rOutl.SetFixedCellHeight(((const SdrTextFixedCellHeightItem&)GetMergedItem(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue());
+ }
+
+ // ggf. Rahmenattribute am 1. (neuen) Absatz des Outliners setzen
+ if( !HasTextImpl( &rOutl ) )
+ {
+ // Outliner has no text so we must set some
+ // empty text so the outliner initialise itself
+ rOutl.SetText( String(), rOutl.GetParagraph( 0 ) );
+
+ if(GetStyleSheet())
+ rOutl.SetStyleSheet( 0, GetStyleSheet());
+
+ // Beim setzen der harten Attribute an den ersten Absatz muss
+ // der Parent pOutlAttr (=die Vorlage) temporaer entfernt
+ // werden, da sonst bei SetParaAttribs() auch alle in diesem
+ // Parent enthaltenen Items hart am Absatz attributiert werden.
+ // -> BugID 22467
+ const SfxItemSet& rSet = GetObjectItemSet();
+ SfxItemSet aFilteredSet(*rSet.GetPool(), EE_ITEMS_START, EE_ITEMS_END);
+ aFilteredSet.Put(rSet);
+ rOutl.SetParaAttribs(0, aFilteredSet);
+ }
+ if (bFitToSize)
+ {
+ Rectangle aAnchorRect;
+ Rectangle aTextRect;
+ TakeTextRect(rOutl, aTextRect, sal_False,
+ &aAnchorRect/* #97097# give sal_True here, not sal_False */);
+ Fraction aFitXKorreg(1,1);
+ ImpSetCharStretching(rOutl,aTextRect,aAnchorRect,aFitXKorreg);
+ }
+
+ if(pOutlinerParaObject)
+ {
+ // #78476# also repaint when animated text is put to edit mode
+ // to not make appear the text double
+ // #111096# should now repaint automatically.
+ // sal_Bool bIsAnimated(pPlusData && pPlusData->pAnimator);
+
+ if(aGeo.nDrehWink || IsFontwork() /*|| bIsAnimated*/)
+ {
+ // only repaint here, no real objectchange
+
+// ActionChanged();
+ BroadcastObjectChange();
+ }
+ }
+
+ rOutl.UpdateFields();
+ rOutl.ClearModifyFlag();
+
+ return sal_True;
+}
+
+void SdrTextObj::TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle* pViewInit, Rectangle* pViewMin) const
+{
+ SdrFitToSizeType eFit=GetFitToSize();
+ FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
+ Size aPaperMin,aPaperMax;
+ Rectangle aViewInit;
+ TakeTextAnchorRect(aViewInit);
+ if (aGeo.nDrehWink!=0) {
+ Point aCenter(aViewInit.Center());
+ aCenter-=aViewInit.TopLeft();
+ Point aCenter0(aCenter);
+ RotatePoint(aCenter,Point(),aGeo.nSin,aGeo.nCos);
+ aCenter-=aCenter0;
+ aViewInit.Move(aCenter.X(),aCenter.Y());
+ }
+ Size aAnkSiz(aViewInit.GetSize());
+ aAnkSiz.Width()--; aAnkSiz.Height()--; // weil GetSize() ein draufaddiert
+ Size aMaxSiz(1000000,1000000);
+ if (pModel!=NULL) {
+ Size aTmpSiz(pModel->GetMaxObjSize());
+ if (aTmpSiz.Width()!=0) aMaxSiz.Width()=aTmpSiz.Width();
+ if (aTmpSiz.Height()!=0) aMaxSiz.Height()=aTmpSiz.Height();
+ }
+
+ // #106879#
+ // Done earlier since used in else tree below
+ SdrTextHorzAdjust eHAdj(GetTextHorizontalAdjust());
+ SdrTextVertAdjust eVAdj(GetTextVerticalAdjust());
+
+ if(IsTextFrame())
+ {
+ long nMinWdt=GetMinTextFrameWidth();
+ long nMinHgt=GetMinTextFrameHeight();
+ long nMaxWdt=GetMaxTextFrameWidth();
+ long nMaxHgt=GetMaxTextFrameHeight();
+ if (nMinWdt<1) nMinWdt=1;
+ if (nMinHgt<1) nMinHgt=1;
+ if (!bFitToSize) {
+ if (nMaxWdt==0 || nMaxWdt>aMaxSiz.Width()) nMaxWdt=aMaxSiz.Width();
+ if (nMaxHgt==0 || nMaxHgt>aMaxSiz.Height()) nMaxHgt=aMaxSiz.Height();
+ if (!IsAutoGrowWidth() ) { nMaxWdt=aAnkSiz.Width(); nMinWdt=nMaxWdt; }
+ if (!IsAutoGrowHeight()) { nMaxHgt=aAnkSiz.Height(); nMinHgt=nMaxHgt; }
+ SdrTextAniKind eAniKind=GetTextAniKind();
+ SdrTextAniDirection eAniDirection=GetTextAniDirection();
+
+ // #101684#
+ sal_Bool bInEditMode = IsInEditMode();
+
+ if (!bInEditMode && (eAniKind==SDRTEXTANI_SCROLL || eAniKind==SDRTEXTANI_ALTERNATE || eAniKind==SDRTEXTANI_SLIDE))
+ {
+ // Grenzenlose Papiergroesse fuer Laufschrift
+ if (eAniDirection==SDRTEXTANI_LEFT || eAniDirection==SDRTEXTANI_RIGHT) nMaxWdt=1000000;
+ if (eAniDirection==SDRTEXTANI_UP || eAniDirection==SDRTEXTANI_DOWN) nMaxHgt=1000000;
+ }
+ aPaperMax.Width()=nMaxWdt;
+ aPaperMax.Height()=nMaxHgt;
+ } else {
+ aPaperMax=aMaxSiz;
+ }
+ aPaperMin.Width()=nMinWdt;
+ aPaperMin.Height()=nMinHgt;
+ }
+ else
+ {
+ // #106879#
+ // aPaperMin needs to be set to object's size if full width is activated
+ // for hor or ver writing respectively
+ if((SDRTEXTHORZADJUST_BLOCK == eHAdj && !IsVerticalWriting())
+ || (SDRTEXTVERTADJUST_BLOCK == eVAdj && IsVerticalWriting()))
+ {
+ aPaperMin = aAnkSiz;
+ }
+
+ aPaperMax=aMaxSiz;
+ }
+
+ if (pViewMin!=NULL) {
+ *pViewMin=aViewInit;
+
+ long nXFree=aAnkSiz.Width()-aPaperMin.Width();
+ if (eHAdj==SDRTEXTHORZADJUST_LEFT) pViewMin->Right()-=nXFree;
+ else if (eHAdj==SDRTEXTHORZADJUST_RIGHT) pViewMin->Left()+=nXFree;
+ else { pViewMin->Left()+=nXFree/2; pViewMin->Right()=pViewMin->Left()+aPaperMin.Width(); }
+
+ long nYFree=aAnkSiz.Height()-aPaperMin.Height();
+ if (eVAdj==SDRTEXTVERTADJUST_TOP) pViewMin->Bottom()-=nYFree;
+ else if (eVAdj==SDRTEXTVERTADJUST_BOTTOM) pViewMin->Top()+=nYFree;
+ else { pViewMin->Top()+=nYFree/2; pViewMin->Bottom()=pViewMin->Top()+aPaperMin.Height(); }
+ }
+
+ // Die PaperSize soll in den meisten Faellen von selbst wachsen
+ // #89459#
+ if(IsVerticalWriting())
+ aPaperMin.Width() = 0;
+ else
+ aPaperMin.Height() = 0; // #33102#
+
+ if(eHAdj!=SDRTEXTHORZADJUST_BLOCK || bFitToSize) {
+ aPaperMin.Width()=0;
+ }
+
+ // #103516# For complete ver adjust support, set paper min height to 0, here.
+ if(SDRTEXTVERTADJUST_BLOCK != eVAdj || bFitToSize)
+ {
+ aPaperMin.Height() = 0;
+ }
+
+ if (pPaperMin!=NULL) *pPaperMin=aPaperMin;
+ if (pPaperMax!=NULL) *pPaperMax=aPaperMax;
+ if (pViewInit!=NULL) *pViewInit=aViewInit;
+}
+
+void SdrTextObj::EndTextEdit(SdrOutliner& rOutl)
+{
+ if(rOutl.IsModified())
+ {
+ OutlinerParaObject* pNewText = NULL;
+
+ if(HasTextImpl( &rOutl ) )
+ {
+ // Damit der grauen Feldhintergrund wieder verschwindet
+ rOutl.UpdateFields();
+
+ sal_uInt16 nParaAnz = static_cast< sal_uInt16 >( rOutl.GetParagraphCount() );
+ pNewText = rOutl.CreateParaObject( 0, nParaAnz );
+ }
+
+ // need to end edit mode early since SetOutlinerParaObject already
+ // uses GetCurrentBoundRect() which needs to take the text into account
+ // to work correct
+ mbInEditMode = sal_False;
+ SetOutlinerParaObject(pNewText);
+ }
+
+ pEdtOutl = NULL;
+ rOutl.Clear();
+ sal_uInt32 nStat = rOutl.GetControlWord();
+ nStat &= ~EE_CNTRL_AUTOPAGESIZE;
+ rOutl.SetControlWord(nStat);
+
+ // #101684#
+ mbInEditMode = sal_False;
+}
+
+sal_uInt16 SdrTextObj::GetOutlinerViewAnchorMode() const
+{
+ SdrTextHorzAdjust eH=GetTextHorizontalAdjust();
+ SdrTextVertAdjust eV=GetTextVerticalAdjust();
+ EVAnchorMode eRet=ANCHOR_TOP_LEFT;
+ if (IsContourTextFrame()) return (sal_uInt16)eRet;
+ if (eH==SDRTEXTHORZADJUST_LEFT) {
+ if (eV==SDRTEXTVERTADJUST_TOP) {
+ eRet=ANCHOR_TOP_LEFT;
+ } else if (eV==SDRTEXTVERTADJUST_BOTTOM) {
+ eRet=ANCHOR_BOTTOM_LEFT;
+ } else {
+ eRet=ANCHOR_VCENTER_LEFT;
+ }
+ } else if (eH==SDRTEXTHORZADJUST_RIGHT) {
+ if (eV==SDRTEXTVERTADJUST_TOP) {
+ eRet=ANCHOR_TOP_RIGHT;
+ } else if (eV==SDRTEXTVERTADJUST_BOTTOM) {
+ eRet=ANCHOR_BOTTOM_RIGHT;
+ } else {
+ eRet=ANCHOR_VCENTER_RIGHT;
+ }
+ } else {
+ if (eV==SDRTEXTVERTADJUST_TOP) {
+ eRet=ANCHOR_TOP_HCENTER;
+ } else if (eV==SDRTEXTVERTADJUST_BOTTOM) {
+ eRet=ANCHOR_BOTTOM_HCENTER;
+ } else {
+ eRet=ANCHOR_VCENTER_HCENTER;
+ }
+ }
+ return (sal_uInt16)eRet;
+}
+
+void SdrTextObj::ImpSetTextEditParams() const
+{
+ if (pEdtOutl!=NULL) {
+ FASTBOOL bUpdMerk=pEdtOutl->GetUpdateMode();
+ if (bUpdMerk) pEdtOutl->SetUpdateMode(sal_False);
+ Size aPaperMin;
+ Size aPaperMax;
+ Rectangle aEditArea;
+ TakeTextEditArea(&aPaperMin,&aPaperMax,&aEditArea,NULL);
+ //SdrFitToSizeType eFit=GetFitToSize();
+ //FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
+ FASTBOOL bContourFrame=IsContourTextFrame();
+ //EVAnchorMode eAM=(EVAnchorMode)GetOutlinerViewAnchorMode();
+ //sal_uIntPtr nViewAnz=pEdtOutl->GetViewCount();
+ pEdtOutl->SetMinAutoPaperSize(aPaperMin);
+ pEdtOutl->SetMaxAutoPaperSize(aPaperMax);
+ pEdtOutl->SetPaperSize(Size());
+ if (bContourFrame) {
+ Rectangle aAnchorRect;
+ TakeTextAnchorRect(aAnchorRect);
+ ImpSetContourPolygon(*pEdtOutl,aAnchorRect, sal_True);
+ }
+ if (bUpdMerk) pEdtOutl->SetUpdateMode(sal_True);
+ }
+}
+
diff --git a/svx/source/svdraw/svdotxfl.cxx b/svx/source/svdraw/svdotxfl.cxx
new file mode 100644
index 000000000000..444796adb30c
--- /dev/null
+++ b/svx/source/svdraw/svdotxfl.cxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <editeng/eeitem.hxx>
+
+#include <editeng/measfld.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/svdfield.hxx>
+
+static sal_Bool bInit = sal_False;
+
+// Do not remove this, it is still used in src536a!
+void SdrRegisterFieldClasses()
+{
+ if ( !bInit )
+ {
+ SvxFieldItem::GetClassManager().SV_CLASS_REGISTER(SdrMeasureField);
+ SvxFieldItem::GetClassManager().SV_CLASS_REGISTER(SvxHeaderField);
+ SvxFieldItem::GetClassManager().SV_CLASS_REGISTER(SvxFooterField);
+ SvxFieldItem::GetClassManager().SV_CLASS_REGISTER(SvxDateTimeField);
+ bInit = sal_True;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////// */
+
+FASTBOOL SdrTextObj::CalcFieldValue(const SvxFieldItem& /*rField*/, sal_uInt16 /*nPara*/, sal_uInt16 /*nPos*/,
+ FASTBOOL /*bEdit*/, Color*& /*rpTxtColor*/, Color*& /*rpFldColor*/, XubString& /*rRet*/) const
+{
+ return sal_False;
+}
+
diff --git a/svx/source/svdraw/svdotxln.cxx b/svx/source/svdraw/svdotxln.cxx
new file mode 100644
index 000000000000..d36b73ae0a1b
--- /dev/null
+++ b/svx/source/svdraw/svdotxln.cxx
@@ -0,0 +1,350 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <unotools/ucbstreamhelper.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <ucbhelper/content.hxx>
+#include <ucbhelper/contentbroker.hxx>
+#include <unotools/datetime.hxx>
+#include <svx/svdotext.hxx>
+#include "svx/svditext.hxx"
+#include <svx/svdmodel.hxx>
+#include <editeng/editdata.hxx>
+#include <sfx2/lnkbase.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <tools/urlobj.hxx>
+#include <svl/urihelper.hxx>
+
+// #90477#
+#include <tools/tenccvt.hxx>
+
+#ifndef SVX_LIGHT
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@ @@@@@ @@@@@@ @@@@@@ @@@@@@ @@ @@ @@@@@@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@@@ @@ @@ @@ @@@ @@ @@ @@
+// @@ @@ @@@@@ @@ @@ @@@@@ @@ @@ @@ @@ @@@@@@ @@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@@@ @@ @@ @@ @@ @@@ @@ @@
+// @@@@ @@@@@ @@@@ @@ @@@@@@ @@ @@ @@ @@@@@ @@ @@ @@ @@ @@
+//
+// ImpSdrObjTextLink zur Verbindung von SdrTextObj und LinkManager
+//
+// Einem solchen Link merke ich mir als SdrObjUserData am Objekt. Im Gegensatz
+// zum Grafik-Link werden die ObjektDaten jedoch kopiert (fuer Paint, etc.).
+// Die Information ob das Objekt ein Link ist besteht genau darin, dass dem
+// Objekt ein entsprechender UserData-Record angehaengt ist oder nicht.
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class ImpSdrObjTextLink: public ::sfx2::SvBaseLink
+{
+ SdrTextObj* pSdrObj;
+
+public:
+ ImpSdrObjTextLink( SdrTextObj* pObj1 )
+ : ::sfx2::SvBaseLink( ::sfx2::LINKUPDATE_ONCALL, FORMAT_FILE ),
+ pSdrObj( pObj1 )
+ {}
+ virtual ~ImpSdrObjTextLink();
+
+ virtual void Closed();
+ virtual void DataChanged( const String& rMimeType,
+ const ::com::sun::star::uno::Any & rValue );
+
+ sal_Bool Connect() { return 0 != SvBaseLink::GetRealObject(); }
+};
+
+ImpSdrObjTextLink::~ImpSdrObjTextLink()
+{
+}
+
+void ImpSdrObjTextLink::Closed()
+{
+ if (pSdrObj )
+ {
+ // pLink des Objekts auf NULL setzen, da die Link-Instanz ja gerade destruiert wird.
+ ImpSdrObjTextLinkUserData* pData=pSdrObj->GetLinkUserData();
+ if (pData!=NULL) pData->pLink=NULL;
+ pSdrObj->ReleaseTextLink();
+ }
+ SvBaseLink::Closed();
+}
+
+
+void ImpSdrObjTextLink::DataChanged( const String& /*rMimeType*/,
+ const ::com::sun::star::uno::Any & /*rValue */)
+{
+ FASTBOOL bForceReload=sal_False;
+ SdrModel* pModel = pSdrObj ? pSdrObj->GetModel() : 0;
+ sfx2::LinkManager* pLinkManager= pModel ? pModel->GetLinkManager() : 0;
+ if( pLinkManager )
+ {
+ ImpSdrObjTextLinkUserData* pData=pSdrObj->GetLinkUserData();
+ if( pData )
+ {
+ String aFile;
+ String aFilter;
+ pLinkManager->GetDisplayNames( this, 0,&aFile, 0, &aFilter );
+
+ if( !pData->aFileName.Equals( aFile ) ||
+ !pData->aFilterName.Equals( aFilter ))
+ {
+ pData->aFileName = aFile;
+ pData->aFilterName = aFilter;
+ pSdrObj->SetChanged();
+ bForceReload = sal_True;
+ }
+ }
+ }
+ if (pSdrObj )
+ pSdrObj->ReloadLinkedText( bForceReload );
+}
+#endif // SVX_LIGHT
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@ @@ @@ @@ @@ @@ @@ @@ @@@@@ @@@@@@ @@@@@ @@@@@ @@@@ @@@@@@ @@@@
+// @@ @@ @@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@@@@@ @@@@ @@ @@ @@@@ @@@@@ @@@@@ @@ @@ @@@@@@ @@ @@@@@@
+// @@ @@ @@ @@@ @@@@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@@@@ @@ @@ @@ @@ @@ @@@@ @@@@@ @@@@@@ @@ @@ @@@@@ @@ @@ @@ @@ @@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(ImpSdrObjTextLinkUserData,SdrObjUserData);
+
+ImpSdrObjTextLinkUserData::ImpSdrObjTextLinkUserData(SdrTextObj* pObj1):
+ SdrObjUserData(SdrInventor,SDRUSERDATA_OBJTEXTLINK,0),
+ pObj(pObj1),
+ pLink(NULL),
+ eCharSet(RTL_TEXTENCODING_DONTKNOW)
+{
+}
+
+ImpSdrObjTextLinkUserData::~ImpSdrObjTextLinkUserData()
+{
+#ifndef SVX_LIGHT
+ delete pLink;
+#endif
+}
+
+SdrObjUserData* ImpSdrObjTextLinkUserData::Clone(SdrObject* pObj1) const
+{
+ ImpSdrObjTextLinkUserData* pData=new ImpSdrObjTextLinkUserData((SdrTextObj*)pObj1);
+ pData->aFileName =aFileName;
+ pData->aFilterName=aFilterName;
+ pData->aFileDate0 =aFileDate0;
+ pData->eCharSet =eCharSet;
+ pData->pLink=NULL;
+ return pData;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@@@ @@@@@ @@ @@ @@@@@@ @@@@ @@@@@ @@@@@@
+// @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@@@@ @@ @@ @@ @@ @@ @@
+// @@ @@@@ @@@ @@ @@ @@ @@@@@ @@
+// @@ @@ @@@@@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@@@@ @@ @@ @@ @@@@ @@@@@ @@@@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrTextObj::SetTextLink(const String& rFileName, const String& rFilterName, rtl_TextEncoding eCharSet)
+{
+ if(eCharSet == RTL_TEXTENCODING_DONTKNOW)
+ eCharSet = gsl_getSystemTextEncoding();
+
+ ImpSdrObjTextLinkUserData* pData=GetLinkUserData();
+ if (pData!=NULL) {
+ ReleaseTextLink();
+ }
+ pData=new ImpSdrObjTextLinkUserData(this);
+ pData->aFileName=rFileName;
+ pData->aFilterName=rFilterName;
+ pData->eCharSet=eCharSet;
+ InsertUserData(pData);
+ ImpLinkAnmeldung();
+}
+
+void SdrTextObj::ReleaseTextLink()
+{
+ ImpLinkAbmeldung();
+ sal_uInt16 nAnz=GetUserDataCount();
+ for (sal_uInt16 nNum=nAnz; nNum>0;) {
+ nNum--;
+ SdrObjUserData* pData=GetUserData(nNum);
+ if (pData->GetInventor()==SdrInventor && pData->GetId()==SDRUSERDATA_OBJTEXTLINK) {
+ DeleteUserData(nNum);
+ }
+ }
+}
+
+FASTBOOL SdrTextObj::ReloadLinkedText( FASTBOOL bForceLoad)
+{
+ ImpSdrObjTextLinkUserData* pData = GetLinkUserData();
+ FASTBOOL bRet = sal_True;
+
+ if( pData )
+ {
+ ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
+ DateTime aFileDT;
+ sal_Bool bExists = sal_False, bLoad = sal_False;
+
+ if( pBroker )
+ {
+ bExists = sal_True;
+
+ try
+ {
+ INetURLObject aURL( pData->aFileName );
+ DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ ::ucbhelper::Content aCnt( aURL.GetMainURL( INetURLObject::NO_DECODE ), ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
+ ::com::sun::star::uno::Any aAny( aCnt.getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateModified" ) ) ) );
+ ::com::sun::star::util::DateTime aDateTime;
+
+ aAny >>= aDateTime;
+ ::utl::typeConvert( aDateTime, aFileDT );
+ }
+ catch( ... )
+ {
+ bExists = sal_False;
+ }
+ }
+
+ if( bExists )
+ {
+ if( bForceLoad )
+ bLoad = sal_True;
+ else
+ bLoad = ( aFileDT > pData->aFileDate0 );
+
+ if( bLoad )
+ {
+ bRet = LoadText( pData->aFileName, pData->aFilterName, pData->eCharSet );
+ }
+
+ pData->aFileDate0 = aFileDT;
+ }
+ }
+
+ return bRet;
+}
+
+FASTBOOL SdrTextObj::LoadText(const String& rFileName, const String& /*rFilterName*/, rtl_TextEncoding eCharSet)
+{
+ INetURLObject aFileURL( rFileName );
+ sal_Bool bRet = sal_False;
+
+ if( aFileURL.GetProtocol() == INET_PROT_NOT_VALID )
+ {
+ String aFileURLStr;
+
+ if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( rFileName, aFileURLStr ) )
+ aFileURL = INetURLObject( aFileURLStr );
+ else
+ aFileURL.SetSmartURL( rFileName );
+ }
+
+ DBG_ASSERT( aFileURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aFileURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ );
+
+ if( pIStm )
+ {
+ // #90477# pIStm->SetStreamCharSet( eCharSet );
+ pIStm->SetStreamCharSet(GetSOLoadTextEncoding(eCharSet, (sal_uInt16)pIStm->GetVersion()));
+
+ char cRTF[5];
+ cRTF[4] = 0;
+ pIStm->Read(cRTF, 5);
+
+ sal_Bool bRTF = cRTF[0] == '{' && cRTF[1] == '\\' && cRTF[2] == 'r' && cRTF[3] == 't' && cRTF[4] == 'f';
+
+ pIStm->Seek(0);
+
+ if( !pIStm->GetError() )
+ {
+ SetText( *pIStm, aFileURL.GetMainURL( INetURLObject::NO_DECODE ), sal::static_int_cast< sal_uInt16 >( bRTF ? EE_FORMAT_RTF : EE_FORMAT_TEXT ) );
+ bRet = sal_True;
+ }
+
+ delete pIStm;
+ }
+
+ return bRet;
+}
+
+ImpSdrObjTextLinkUserData* SdrTextObj::GetLinkUserData() const
+{
+ ImpSdrObjTextLinkUserData* pData=NULL;
+ sal_uInt16 nAnz=GetUserDataCount();
+ for (sal_uInt16 nNum=nAnz; nNum>0 && pData==NULL;) {
+ nNum--;
+ pData=(ImpSdrObjTextLinkUserData*)GetUserData(nNum);
+ if (pData->GetInventor()!=SdrInventor || pData->GetId()!=SDRUSERDATA_OBJTEXTLINK) {
+ pData=NULL;
+ }
+ }
+ return pData;
+}
+
+void SdrTextObj::ImpLinkAnmeldung()
+{
+ ImpSdrObjTextLinkUserData* pData=GetLinkUserData();
+ sfx2::LinkManager* pLinkManager=pModel!=NULL ? pModel->GetLinkManager() : NULL;
+ if (pLinkManager!=NULL && pData!=NULL && pData->pLink==NULL) { // Nicht 2x Anmelden
+ pData->pLink=new ImpSdrObjTextLink(this);
+#ifdef GCC
+ pLinkManager->InsertFileLink(*pData->pLink,OBJECT_CLIENT_FILE,pData->aFileName,
+ pData->aFilterName.Len() ?
+ &pData->aFilterName : (const String *)NULL,
+ (const String *)NULL);
+#else
+ pLinkManager->InsertFileLink(*pData->pLink,OBJECT_CLIENT_FILE,pData->aFileName,
+ pData->aFilterName.Len() ? &pData->aFilterName : NULL,NULL);
+#endif
+ pData->pLink->Connect();
+ }
+}
+
+void SdrTextObj::ImpLinkAbmeldung()
+{
+ ImpSdrObjTextLinkUserData* pData=GetLinkUserData();
+ sfx2::LinkManager* pLinkManager=pModel!=NULL ? pModel->GetLinkManager() : NULL;
+ if (pLinkManager!=NULL && pData!=NULL && pData->pLink!=NULL) { // Nicht 2x Abmelden
+ // Bei Remove wird *pLink implizit deleted
+ pLinkManager->Remove( pData->pLink );
+ pData->pLink=NULL;
+ }
+}
+
diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx
new file mode 100644
index 000000000000..6f129affcbba
--- /dev/null
+++ b/svx/source/svdraw/svdotxtr.cxx
@@ -0,0 +1,558 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svdotext.hxx>
+#include "svx/svditext.hxx"
+#include <svx/svdtrans.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/svdpage.hxx> // fuer Convert
+#include <svx/svdmodel.hxx> // fuer Convert
+#include <editeng/outliner.hxx>
+#include <svx/sdr/properties/itemsettools.hxx>
+#include <svx/sdr/properties/properties.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <svl/itemset.hxx>
+#include <svx/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>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@@@ @@@@@ @@ @@ @@@@@@ @@@@ @@@@@ @@@@@@
+// @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@@@@ @@ @@ @@ @@ @@ @@
+// @@ @@@@ @@@ @@ @@ @@ @@@@@ @@
+// @@ @@ @@@@@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@@ @@@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@@@@ @@ @@ @@ @@@@ @@@@@ @@@@
+//
+// Transformationen
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrTextObj::NbcSetSnapRect(const Rectangle& rRect)
+{
+ if (aGeo.nDrehWink!=0 || aGeo.nShearWink!=0) {
+ Rectangle aSR0(GetSnapRect());
+ long nWdt0=aSR0.Right()-aSR0.Left();
+ long nHgt0=aSR0.Bottom()-aSR0.Top();
+ long nWdt1=rRect.Right()-rRect.Left();
+ long nHgt1=rRect.Bottom()-rRect.Top();
+ SdrTextObj::NbcResize(maSnapRect.TopLeft(),Fraction(nWdt1,nWdt0),Fraction(nHgt1,nHgt0));
+ SdrTextObj::NbcMove(Size(rRect.Left()-aSR0.Left(),rRect.Top()-aSR0.Top()));
+ } else {
+ long nHDist=GetTextLeftDistance()+GetTextRightDistance();
+ long nVDist=GetTextUpperDistance()+GetTextLowerDistance();
+ long nTWdt0=aRect.GetWidth ()-1-nHDist; if (nTWdt0<0) nTWdt0=0;
+ long nTHgt0=aRect.GetHeight()-1-nVDist; if (nTHgt0<0) nTHgt0=0;
+ long nTWdt1=rRect.GetWidth ()-1-nHDist; if (nTWdt1<0) nTWdt1=0;
+ long nTHgt1=rRect.GetHeight()-1-nVDist; if (nTHgt1<0) nTHgt1=0;
+ aRect=rRect;
+ ImpJustifyRect(aRect);
+ if (bTextFrame && (pModel==NULL || !pModel->IsPasteResize())) { // #51139#
+ if (nTWdt0!=nTWdt1 && IsAutoGrowWidth() ) NbcSetMinTextFrameWidth(nTWdt1);
+ if (nTHgt0!=nTHgt1 && IsAutoGrowHeight()) NbcSetMinTextFrameHeight(nTHgt1);
+ if (GetFitToSize()==SDRTEXTFIT_RESIZEATTR) {
+ NbcResizeTextAttributes(Fraction(nTWdt1,nTWdt0),Fraction(nTHgt1,nTHgt0));
+ }
+ NbcAdjustTextFrameWidthAndHeight();
+ }
+ ImpCheckShear();
+ SetRectsDirty();
+ }
+}
+
+const Rectangle& SdrTextObj::GetLogicRect() const
+{
+ return aRect;
+}
+
+void SdrTextObj::NbcSetLogicRect(const Rectangle& rRect)
+{
+ long nHDist=GetTextLeftDistance()+GetTextRightDistance();
+ long nVDist=GetTextUpperDistance()+GetTextLowerDistance();
+ long nTWdt0=aRect.GetWidth ()-1-nHDist; if (nTWdt0<0) nTWdt0=0;
+ long nTHgt0=aRect.GetHeight()-1-nVDist; if (nTHgt0<0) nTHgt0=0;
+ long nTWdt1=rRect.GetWidth ()-1-nHDist; if (nTWdt1<0) nTWdt1=0;
+ long nTHgt1=rRect.GetHeight()-1-nVDist; if (nTHgt1<0) nTHgt1=0;
+ aRect=rRect;
+ ImpJustifyRect(aRect);
+ if (bTextFrame) {
+ if (nTWdt0!=nTWdt1 && IsAutoGrowWidth() ) NbcSetMinTextFrameWidth(nTWdt1);
+ if (nTHgt0!=nTHgt1 && IsAutoGrowHeight()) NbcSetMinTextFrameHeight(nTHgt1);
+ if (GetFitToSize()==SDRTEXTFIT_RESIZEATTR) {
+ NbcResizeTextAttributes(Fraction(nTWdt1,nTWdt0),Fraction(nTHgt1,nTHgt0));
+ }
+ NbcAdjustTextFrameWidthAndHeight();
+ }
+ SetRectsDirty();
+}
+
+long SdrTextObj::GetRotateAngle() const
+{
+ return aGeo.nDrehWink;
+}
+
+long SdrTextObj::GetShearAngle(FASTBOOL /*bVertical*/) const
+{
+ return aGeo.nShearWink;
+}
+
+void SdrTextObj::NbcMove(const Size& rSiz)
+{
+ MoveRect(aRect,rSiz);
+ MoveRect(aOutRect,rSiz);
+ MoveRect(maSnapRect,rSiz);
+ SetRectsDirty(sal_True);
+}
+
+void SdrTextObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+{
+ FASTBOOL bNoShearMerk=aGeo.nShearWink==0;
+ FASTBOOL bRota90Merk=bNoShearMerk && aGeo.nDrehWink % 9000 ==0;
+ long nHDist=GetTextLeftDistance()+GetTextRightDistance();
+ long nVDist=GetTextUpperDistance()+GetTextLowerDistance();
+ long nTWdt0=aRect.GetWidth ()-1-nHDist; if (nTWdt0<0) nTWdt0=0;
+ long nTHgt0=aRect.GetHeight()-1-nVDist; if (nTHgt0<0) nTHgt0=0;
+ FASTBOOL bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
+ FASTBOOL bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
+ if (bXMirr || bYMirr) {
+ Point aRef1(GetSnapRect().Center());
+ if (bXMirr) {
+ Point aRef2(aRef1);
+ aRef2.Y()++;
+ NbcMirrorGluePoints(aRef1,aRef2);
+ }
+ if (bYMirr) {
+ Point aRef2(aRef1);
+ aRef2.X()++;
+ NbcMirrorGluePoints(aRef1,aRef2);
+ }
+ }
+
+ if (aGeo.nDrehWink==0 && aGeo.nShearWink==0) {
+ ResizeRect(aRect,rRef,xFact,yFact);
+ if (bYMirr) {
+ aRect.Justify();
+ aRect.Move(aRect.Right()-aRect.Left(),aRect.Bottom()-aRect.Top());
+ aGeo.nDrehWink=18000;
+ aGeo.RecalcSinCos();
+ }
+ }
+ else
+ {
+ // #100663# aRect is NOT initialized for lines (polgon objects with two
+ // exceptionally handled points). Thus, after this call the text rotaion is
+ // gone. This error must be present since day one of this old drawing layer.
+ // It's astonishing that noone discovered it earlier.
+ // Polygon aPol(Rect2Poly(aRect,aGeo));
+ // Polygon aPol(Rect2Poly(GetSnapRect(), aGeo));
+
+ // #101412# go back to old method, side effects are impossible
+ // to calculate.
+ Polygon aPol(Rect2Poly(aRect,aGeo));
+
+ for(sal_uInt16 a(0); a < aPol.GetSize(); a++)
+ {
+ ResizePoint(aPol[a], rRef, xFact, yFact);
+ }
+
+ if(bXMirr != bYMirr)
+ {
+ // Polygon wenden und etwas schieben
+ Polygon aPol0(aPol);
+
+ aPol[0] = aPol0[1];
+ aPol[1] = aPol0[0];
+ aPol[2] = aPol0[3];
+ aPol[3] = aPol0[2];
+ aPol[4] = aPol0[1];
+ }
+
+ Poly2Rect(aPol, aRect, aGeo);
+ }
+
+ if (bRota90Merk) {
+ FASTBOOL bRota90=aGeo.nDrehWink % 9000 ==0;
+ if (!bRota90) { // Scheinbar Rundungsfehler: Korregieren
+ long a=NormAngle360(aGeo.nDrehWink);
+ if (a<4500) a=0;
+ else if (a<13500) a=9000;
+ else if (a<22500) a=18000;
+ else if (a<31500) a=27000;
+ else a=0;
+ aGeo.nDrehWink=a;
+ aGeo.RecalcSinCos();
+ }
+ if (bNoShearMerk!=(aGeo.nShearWink==0)) { // Shear ggf. korregieren wg. Rundungsfehler
+ aGeo.nShearWink=0;
+ aGeo.RecalcTan();
+ }
+ }
+
+ ImpJustifyRect(aRect);
+ long nTWdt1=aRect.GetWidth ()-1-nHDist; if (nTWdt1<0) nTWdt1=0;
+ long nTHgt1=aRect.GetHeight()-1-nVDist; if (nTHgt1<0) nTHgt1=0;
+ if (bTextFrame && (pModel==NULL || !pModel->IsPasteResize())) { // #51139#
+ if (nTWdt0!=nTWdt1 && IsAutoGrowWidth() ) NbcSetMinTextFrameWidth(nTWdt1);
+ if (nTHgt0!=nTHgt1 && IsAutoGrowHeight()) NbcSetMinTextFrameHeight(nTHgt1);
+ if (GetFitToSize()==SDRTEXTFIT_RESIZEATTR) {
+ NbcResizeTextAttributes(Fraction(nTWdt1,nTWdt0),Fraction(nTHgt1,nTHgt0));
+ }
+ NbcAdjustTextFrameWidthAndHeight();
+ }
+ ImpCheckShear();
+ SetRectsDirty();
+}
+
+void SdrTextObj::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
+{
+ SetGlueReallyAbsolute(sal_True);
+ long dx=aRect.Right()-aRect.Left();
+ long dy=aRect.Bottom()-aRect.Top();
+ Point aP(aRect.TopLeft());
+ RotatePoint(aP,rRef,sn,cs);
+ aRect.Left()=aP.X();
+ aRect.Top()=aP.Y();
+ aRect.Right()=aRect.Left()+dx;
+ aRect.Bottom()=aRect.Top()+dy;
+ if (aGeo.nDrehWink==0) {
+ aGeo.nDrehWink=NormAngle360(nWink);
+ aGeo.nSin=sn;
+ aGeo.nCos=cs;
+ } else {
+ aGeo.nDrehWink=NormAngle360(aGeo.nDrehWink+nWink);
+ aGeo.RecalcSinCos();
+ }
+ SetRectsDirty();
+ NbcRotateGluePoints(rRef,nWink,sn,cs);
+ SetGlueReallyAbsolute(sal_False);
+}
+
+void SdrTextObj::NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
+{
+ SetGlueReallyAbsolute(sal_True);
+
+ // #75889# when this is a SdrPathObj aRect maybe not initialized
+ Polygon aPol(Rect2Poly(aRect.IsEmpty() ? GetSnapRect() : aRect, aGeo));
+
+ sal_uInt16 nPointCount=aPol.GetSize();
+ for (sal_uInt16 i=0; i<nPointCount; i++) {
+ ShearPoint(aPol[i],rRef,tn,bVShear);
+ }
+ Poly2Rect(aPol,aRect,aGeo);
+ ImpJustifyRect(aRect);
+ if (bTextFrame) {
+ NbcAdjustTextFrameWidthAndHeight();
+ }
+ ImpCheckShear();
+ SetRectsDirty();
+ NbcShearGluePoints(rRef,nWink,tn,bVShear);
+ SetGlueReallyAbsolute(sal_False);
+}
+
+void SdrTextObj::NbcMirror(const Point& rRef1, const Point& rRef2)
+{
+ SetGlueReallyAbsolute(sal_True);
+ FASTBOOL bNoShearMerk=aGeo.nShearWink==0;
+ FASTBOOL bRota90Merk=sal_False;
+ if (bNoShearMerk &&
+ (rRef1.X()==rRef2.X() || rRef1.Y()==rRef2.Y() ||
+ Abs(rRef1.X()-rRef2.X())==Abs(rRef1.Y()-rRef2.Y()))) {
+ bRota90Merk=aGeo.nDrehWink % 9000 ==0;
+ }
+ Polygon aPol(Rect2Poly(aRect,aGeo));
+ sal_uInt16 i;
+ sal_uInt16 nPntAnz=aPol.GetSize();
+ for (i=0; i<nPntAnz; i++) {
+ MirrorPoint(aPol[i],rRef1,rRef2);
+ }
+ // Polygon wenden und etwas schieben
+ Polygon aPol0(aPol);
+ aPol[0]=aPol0[1];
+ aPol[1]=aPol0[0];
+ aPol[2]=aPol0[3];
+ aPol[3]=aPol0[2];
+ aPol[4]=aPol0[1];
+ Poly2Rect(aPol,aRect,aGeo);
+
+ if (bRota90Merk) {
+ FASTBOOL bRota90=aGeo.nDrehWink % 9000 ==0;
+ if (bRota90Merk && !bRota90) { // Scheinbar Rundungsfehler: Korregieren
+ long a=NormAngle360(aGeo.nDrehWink);
+ if (a<4500) a=0;
+ else if (a<13500) a=9000;
+ else if (a<22500) a=18000;
+ else if (a<31500) a=27000;
+ else a=0;
+ aGeo.nDrehWink=a;
+ aGeo.RecalcSinCos();
+ }
+ }
+ if (bNoShearMerk!=(aGeo.nShearWink==0)) { // Shear ggf. korregieren wg. Rundungsfehler
+ aGeo.nShearWink=0;
+ aGeo.RecalcTan();
+ }
+
+ ImpJustifyRect(aRect);
+ if (bTextFrame) {
+ NbcAdjustTextFrameWidthAndHeight();
+ }
+ ImpCheckShear();
+ SetRectsDirty();
+ NbcMirrorGluePoints(rRef1,rRef2);
+ SetGlueReallyAbsolute(sal_False);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdrObject* SdrTextObj::ImpConvertContainedTextToSdrPathObjs(bool bToPoly) const
+{
+ SdrObject* pRetval = 0;
+
+ if(!ImpCanConvTextToCurve())
+ {
+ // suppress HelpTexts from PresObj's
+ return 0;
+ }
+
+ // get primitives
+ const drawinglayer::primitive2d::Primitive2DSequence xSequence(GetViewContact().getViewIndependentPrimitive2DSequence());
+
+ if(xSequence.hasElements())
+ {
+ // create an extractor with neutral ViewInformation
+ const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
+ drawinglayer::processor2d::TextAsPolygonExtractor2D aExtractor(aViewInformation2D);
+
+ // 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;
+ }
+ }
+ }
+
+ return pRetval;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdrObject* SdrTextObj::DoConvertToPolyObj(sal_Bool bBezier) const
+{
+ 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
+{
+ SdrObjKind ePathKind = bClosed ? OBJ_PATHFILL : OBJ_PATHLINE;
+ basegfx::B2DPolyPolygon aB2DPolyPolygon(rPolyPolygon);
+
+ // #i37011#
+ if(!bBezier)
+ {
+ aB2DPolyPolygon = basegfx::tools::adaptiveSubdivideByAngle(aB2DPolyPolygon);
+ ePathKind = bClosed ? OBJ_POLY : OBJ_PLIN;
+ }
+
+ SdrPathObj* pPathObj = new SdrPathObj(ePathKind, aB2DPolyPolygon);
+
+ if(bBezier)
+ {
+ // create bezier curves
+ pPathObj->SetPathPoly(basegfx::tools::expandToCurve(pPathObj->GetPathPoly()));
+ }
+
+ if(pPathObj)
+ {
+ pPathObj->ImpSetAnchorPos(aAnchor);
+ pPathObj->NbcSetLayer(SdrLayerID(GetLayer()));
+
+ if(pModel)
+ {
+ pPathObj->SetModel(pModel);
+
+ if(!bNoSetAttr)
+ {
+ sdr::properties::ItemChangeBroadcaster aC(*pPathObj);
+
+ pPathObj->ClearMergedItem();
+ pPathObj->SetMergedItemSet(GetObjectItemSet());
+ pPathObj->GetProperties().BroadcastItemChange(aC);
+ pPathObj->NbcSetStyleSheet(GetStyleSheet(), sal_True);
+ }
+ }
+ }
+
+ return pPathObj;
+}
+
+SdrObject* SdrTextObj::ImpConvertAddText(SdrObject* pObj, FASTBOOL bBezier) const
+{
+ if(!ImpCanConvTextToCurve())
+ {
+ return pObj;
+ }
+
+ SdrObject* pText = ImpConvertContainedTextToSdrPathObjs(!bBezier);
+
+ if(!pText)
+ {
+ return pObj;
+ }
+
+ if(!pObj)
+ {
+ return pText;
+ }
+
+ if(pText->IsGroupObject())
+ {
+ // is already group object, add partial shape in front
+ SdrObjList* pOL=pText->GetSubList();
+ pOL->InsertObject(pObj,0);
+
+ return pText;
+ }
+ else
+ {
+ // not yet a group, create one and add partial and new shapes
+ SdrObjGroup* pGrp=new SdrObjGroup;
+ SdrObjList* pOL=pGrp->GetSubList();
+ pOL->InsertObject(pObj);
+ pOL->InsertObject(pText);
+
+ return pGrp;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/svdraw/svdouno.cxx b/svx/source/svdraw/svdouno.cxx
new file mode 100644
index 000000000000..ed6c2170a5f2
--- /dev/null
+++ b/svx/source/svdraw/svdouno.cxx
@@ -0,0 +1,665 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/sdr/contact/viewcontactofunocontrol.hxx>
+#include <svx/sdr/contact/viewobjectcontactofunocontrol.hxx>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/io/XPersistObject.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XActiveDataSink.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/io/XObjectOutputStream.hpp>
+#include <com/sun/star/io/XObjectInputStream.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/types.hxx>
+#include <vcl/pdfextoutdevdata.hxx>
+#include <svx/svdouno.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdmodel.hxx>
+#include "svx/svdglob.hxx" // Stringcache
+#include "svx/svdstr.hrc" // Objektname
+#include <svx/svdetc.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdorect.hxx>
+#include "svx/svdviter.hxx"
+#include <rtl/ref.hxx>
+#include <set>
+#include <memory>
+#include <svx/sdrpagewindow.hxx>
+#include <svx/sdrpaintwindow.hxx>
+#include <tools/diagnose_ex.h>
+#include <svx/svdograf.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::sdr::contact;
+
+//************************************************************
+// Defines
+//************************************************************
+
+//************************************************************
+// Hilfsklasse SdrControlEventListenerImpl
+//************************************************************
+#include <com/sun/star/lang/XEventListener.hpp>
+
+#include <cppuhelper/implbase1.hxx>
+
+// =============================================================================
+class SdrControlEventListenerImpl : public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener >
+{
+protected:
+ SdrUnoObj* pObj;
+
+public:
+ SdrControlEventListenerImpl(SdrUnoObj* _pObj)
+ : pObj(_pObj)
+ {}
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+
+ void StopListening(const uno::Reference< lang::XComponent >& xComp);
+ void StartListening(const uno::Reference< lang::XComponent >& xComp);
+};
+
+// XEventListener
+void SAL_CALL SdrControlEventListenerImpl::disposing( const ::com::sun::star::lang::EventObject& /*Source*/)
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ if (pObj)
+ {
+ pObj->xUnoControlModel = NULL;
+ }
+}
+
+void SdrControlEventListenerImpl::StopListening(const uno::Reference< lang::XComponent >& xComp)
+{
+ if (xComp.is())
+ xComp->removeEventListener(this);
+}
+
+void SdrControlEventListenerImpl::StartListening(const uno::Reference< lang::XComponent >& xComp)
+{
+ if (xComp.is())
+ xComp->addEventListener(this);
+}
+
+// =============================================================================
+struct SAL_DLLPRIVATE SdrUnoObjDataHolder
+{
+ mutable ::rtl::Reference< SdrControlEventListenerImpl >
+ pEventListener;
+};
+
+// =============================================================================
+namespace
+{
+ void lcl_ensureControlVisibility( SdrView* _pView, const SdrUnoObj* _pObject, bool _bVisible )
+ {
+ OSL_PRECOND( _pObject, "lcl_ensureControlVisibility: no object -> no survival!" );
+
+ SdrPageView* pPageView = _pView ? _pView->GetSdrPageView() : NULL;
+ DBG_ASSERT( pPageView, "lcl_ensureControlVisibility: no view found!" );
+ if ( !pPageView )
+ return;
+
+ ViewContact& rUnoControlContact( _pObject->GetViewContact() );
+
+ for ( sal_uInt32 i = 0; i < pPageView->PageWindowCount(); ++i )
+ {
+ const SdrPageWindow* pPageWindow = pPageView->GetPageWindow( i );
+ DBG_ASSERT( pPageWindow, "lcl_ensureControlVisibility: invalid PageViewWindow!" );
+ if ( !pPageWindow )
+ continue;
+
+ if ( !pPageWindow->HasObjectContact() )
+ continue;
+
+ ObjectContact& rPageViewContact( pPageWindow->GetObjectContact() );
+ const ViewObjectContact& rViewObjectContact( rUnoControlContact.GetViewObjectContact( rPageViewContact ) );
+ const ViewObjectContactOfUnoControl* pUnoControlContact = dynamic_cast< const ViewObjectContactOfUnoControl* >( &rViewObjectContact );
+ DBG_ASSERT( pUnoControlContact, "lcl_ensureControlVisibility: wrong ViewObjectContact type!" );
+ if ( !pUnoControlContact )
+ continue;
+
+ pUnoControlContact->ensureControlVisibility( _bVisible );
+ }
+ }
+}
+
+//************************************************************
+// SdrUnoObj
+//************************************************************
+
+TYPEINIT1(SdrUnoObj, SdrRectObj);
+
+SdrUnoObj::SdrUnoObj(const String& rModelName, sal_Bool _bOwnUnoControlModel)
+: m_pImpl( new SdrUnoObjDataHolder ),
+ bOwnUnoControlModel( _bOwnUnoControlModel )
+{
+ bIsUnoObj = sal_True;
+
+ m_pImpl->pEventListener = new SdrControlEventListenerImpl(this);
+
+ // nur ein owner darf eigenstaendig erzeugen
+ if (rModelName.Len())
+ CreateUnoControlModel(rModelName);
+}
+
+SdrUnoObj::SdrUnoObj(const String& rModelName,
+ const uno::Reference< lang::XMultiServiceFactory >& rxSFac,
+ sal_Bool _bOwnUnoControlModel)
+: m_pImpl( new SdrUnoObjDataHolder ),
+ bOwnUnoControlModel( _bOwnUnoControlModel )
+{
+ bIsUnoObj = sal_True;
+
+ m_pImpl->pEventListener = new SdrControlEventListenerImpl(this);
+
+ // nur ein owner darf eigenstaendig erzeugen
+ if (rModelName.Len())
+ CreateUnoControlModel(rModelName,rxSFac);
+}
+
+SdrUnoObj::~SdrUnoObj()
+{
+ try
+ {
+ // clean up the control model
+ uno::Reference< lang::XComponent > xComp(xUnoControlModel, uno::UNO_QUERY);
+ if (xComp.is())
+ {
+ // is the control model owned by it's environment?
+ uno::Reference< container::XChild > xContent(xUnoControlModel, uno::UNO_QUERY);
+ if (xContent.is() && !xContent->getParent().is())
+ xComp->dispose();
+ else
+ m_pImpl->pEventListener->StopListening(xComp);
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ OSL_ENSURE( sal_False, "SdrUnoObj::~SdrUnoObj: caught an exception!" );
+ }
+ delete m_pImpl;
+}
+
+void SdrUnoObj::SetModel(SdrModel* pNewModel)
+{
+ SdrRectObj::SetModel(pNewModel);
+}
+
+void SdrUnoObj::SetPage(SdrPage* pNewPage)
+{
+ SdrRectObj::SetPage(pNewPage);
+}
+
+void SdrUnoObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
+{
+ rInfo.bRotateFreeAllowed = sal_False;
+ rInfo.bRotate90Allowed = sal_False;
+ rInfo.bMirrorFreeAllowed = sal_False;
+ rInfo.bMirror45Allowed = sal_False;
+ rInfo.bMirror90Allowed = sal_False;
+ rInfo.bTransparenceAllowed = sal_False;
+ rInfo.bGradientAllowed = sal_False;
+ rInfo.bShearAllowed = sal_False;
+ rInfo.bEdgeRadiusAllowed = sal_False;
+ rInfo.bNoOrthoDesired = sal_False;
+ rInfo.bCanConvToPath = sal_False;
+ rInfo.bCanConvToPoly = sal_False;
+ rInfo.bCanConvToPathLineToArea = sal_False;
+ rInfo.bCanConvToPolyLineToArea = sal_False;
+ rInfo.bCanConvToContour = sal_False;
+}
+
+sal_uInt16 SdrUnoObj::GetObjIdentifier() const
+{
+ return sal_uInt16(OBJ_UNO);
+}
+
+void SdrUnoObj::SetContextWritingMode( const sal_Int16 _nContextWritingMode )
+{
+ try
+ {
+ uno::Reference< beans::XPropertySet > xModelProperties( GetUnoControlModel(), uno::UNO_QUERY_THROW );
+ xModelProperties->setPropertyValue(
+ ::rtl::OUString::intern( RTL_CONSTASCII_USTRINGPARAM( "ContextWritingMode" ) ),
+ uno::makeAny( _nContextWritingMode )
+ );
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+// ----------------------------------------------------------------------------
+namespace
+{
+ /** helper class to restore graphics at <awt::XView> object after <SdrUnoObj::Paint>
+
+ OD 08.05.2003 #109432#
+ Restoration of graphics necessary to assure that paint on a window
+
+ @author OD
+ */
+ class RestoreXViewGraphics
+ {
+ private:
+ uno::Reference< awt::XView > m_rXView;
+ uno::Reference< awt::XGraphics > m_rXGraphics;
+
+ public:
+ RestoreXViewGraphics( const uno::Reference< awt::XView >& _rXView )
+ {
+ m_rXView = _rXView;
+ m_rXGraphics = m_rXView->getGraphics();
+ }
+ ~RestoreXViewGraphics()
+ {
+ m_rXView->setGraphics( m_rXGraphics );
+ }
+ };
+}
+
+void SdrUnoObj::TakeObjNameSingul(XubString& rName) const
+{
+ rName = ImpGetResStr(STR_ObjNameSingulUno);
+
+ String aName( GetName() );
+ if(aName.Len())
+ {
+ rName += sal_Unicode(' ');
+ rName += sal_Unicode('\'');
+ rName += aName;
+ rName += sal_Unicode('\'');
+ }
+}
+
+void SdrUnoObj::TakeObjNamePlural(XubString& rName) const
+{
+ rName = ImpGetResStr(STR_ObjNamePluralUno);
+}
+
+void SdrUnoObj::operator = (const SdrObject& rObj)
+{
+ SdrRectObj::operator = (rObj);
+
+ // release the reference to the current control model
+ SetUnoControlModel(uno::Reference< awt::XControlModel >());
+
+ aUnoControlModelTypeName = ((SdrUnoObj&) rObj).aUnoControlModelTypeName;
+ aUnoControlTypeName = ((SdrUnoObj&) rObj).aUnoControlTypeName;
+
+ // copy the uno control model
+ uno::Reference< awt::XControlModel > xCtrl( ((SdrUnoObj&) rObj).GetUnoControlModel(), uno::UNO_QUERY );
+ uno::Reference< util::XCloneable > xClone( xCtrl, uno::UNO_QUERY );
+
+ if ( xClone.is() )
+ {
+ // copy the model by cloning
+ uno::Reference< awt::XControlModel > xNewModel( xClone->createClone(), uno::UNO_QUERY );
+ DBG_ASSERT( xNewModel.is(), "SdrUnoObj::operator =, no control model!");
+ xUnoControlModel = xNewModel;
+ }
+ else
+ {
+ // copy the model by streaming
+ uno::Reference< io::XPersistObject > xObj( xCtrl, uno::UNO_QUERY );
+ uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+
+ if ( xObj.is() && xFactory.is() )
+ {
+ // creating a pipe
+ uno::Reference< io::XOutputStream > xOutPipe(xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.io.Pipe")), uno::UNO_QUERY);
+ uno::Reference< io::XInputStream > xInPipe(xOutPipe, uno::UNO_QUERY);
+
+ // creating the mark streams
+ uno::Reference< io::XInputStream > xMarkIn(xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.io.MarkableInputStream")), uno::UNO_QUERY);
+ uno::Reference< io::XActiveDataSink > xMarkSink(xMarkIn, uno::UNO_QUERY);
+
+ uno::Reference< io::XOutputStream > xMarkOut(xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.io.MarkableOutputStream")), uno::UNO_QUERY);
+ uno::Reference< io::XActiveDataSource > xMarkSource(xMarkOut, uno::UNO_QUERY);
+
+ // connect mark and sink
+ uno::Reference< io::XActiveDataSink > xSink(xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.io.ObjectInputStream")), uno::UNO_QUERY);
+
+ // connect mark and source
+ uno::Reference< io::XActiveDataSource > xSource(xFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.io.ObjectOutputStream")), uno::UNO_QUERY);
+
+ uno::Reference< io::XObjectOutputStream > xOutStrm(xSource, uno::UNO_QUERY);
+ uno::Reference< io::XObjectInputStream > xInStrm(xSink, uno::UNO_QUERY);
+
+ if (xMarkSink.is() && xMarkSource.is() && xSink.is() && xSource.is())
+ {
+ xMarkSink->setInputStream(xInPipe);
+ xMarkSource->setOutputStream(xOutPipe);
+ xSink->setInputStream(xMarkIn);
+ xSource->setOutputStream(xMarkOut);
+
+ // write the object to source
+ xOutStrm->writeObject(xObj);
+ xOutStrm->closeOutput();
+ // read the object
+ uno::Reference< awt::XControlModel > xModel(xInStrm->readObject(), uno::UNO_QUERY);
+ xInStrm->closeInput();
+
+ DBG_ASSERT(xModel.is(), "SdrUnoObj::operator =, keine Model erzeugt");
+
+ xUnoControlModel = xModel;
+ }
+ }
+ }
+
+ // get service name of the control from the control model
+ uno::Reference< beans::XPropertySet > xSet(xUnoControlModel, uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ uno::Any aValue( xSet->getPropertyValue( rtl::OUString::createFromAscii("DefaultControl")) );
+ ::rtl::OUString aStr;
+
+ if( aValue >>= aStr )
+ aUnoControlTypeName = String(aStr);
+ }
+
+ uno::Reference< lang::XComponent > xComp(xUnoControlModel, uno::UNO_QUERY);
+ if (xComp.is())
+ m_pImpl->pEventListener->StartListening(xComp);
+}
+
+void SdrUnoObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+{
+ SdrRectObj::NbcResize(rRef,xFact,yFact);
+
+ if (aGeo.nShearWink!=0 || aGeo.nDrehWink!=0)
+ {
+ // kleine Korrekturen
+ if (aGeo.nDrehWink>=9000 && aGeo.nDrehWink<27000)
+ {
+ aRect.Move(aRect.Left()-aRect.Right(),aRect.Top()-aRect.Bottom());
+ }
+
+ aGeo.nDrehWink = 0;
+ aGeo.nShearWink = 0;
+ aGeo.nSin = 0.0;
+ aGeo.nCos = 1.0;
+ aGeo.nTan = 0.0;
+ SetRectsDirty();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+bool SdrUnoObj::hasSpecialDrag() const
+{
+ // no special drag; we have no rounding rect and
+ // do want frame handles
+ return false;
+}
+
+bool SdrUnoObj::supportsFullDrag() const
+{
+ // overloaded to have the possibility to enable/disable in debug and
+ // to ckeck some things out. Current solution is working, so default is
+ // enabled
+ static bool bDoSupportFullDrag(true);
+
+ return bDoSupportFullDrag;
+}
+
+SdrObject* SdrUnoObj::getFullDragClone() const
+{
+ SdrObject* pRetval = 0;
+ static bool bHandleSpecial(false);
+
+ if(bHandleSpecial)
+ {
+ // special handling for SdrUnoObj (FormControl). Create a SdrGrafObj
+ // for drag containing the graphical representation. This does not work too
+ // well, so the default is to simply clone
+ pRetval = new SdrGrafObj(SdrDragView::GetObjGraphic(GetModel(), this), GetLogicRect());
+ }
+ else
+ {
+ // call parent (simply clone)
+ pRetval = SdrRectObj::getFullDragClone();
+ }
+
+ return pRetval;
+}
+
+// -----------------------------------------------------------------------------
+void SdrUnoObj::NbcSetLayer( SdrLayerID _nLayer )
+{
+ if ( GetLayer() == _nLayer )
+ { // redundant call -> not interested in doing anything here
+ SdrRectObj::NbcSetLayer( _nLayer );
+ return;
+ }
+
+ // we need some special handling here in case we're moved from an invisible layer
+ // to a visible one, or vice versa
+ // (relative to a layer. Remember that the visibility of a layer is a view attribute
+ // - the same layer can be visible in one view, and invisible in another view, at the
+ // same time)
+ // 2003-06-03 - #110592# - fs@openoffice.org
+
+ // collect all views in which our old layer is visible
+ ::std::set< SdrView* > aPreviouslyVisible;
+
+ {
+ SdrViewIter aIter( this );
+ for ( SdrView* pView = aIter.FirstView(); pView; pView = aIter.NextView() )
+ aPreviouslyVisible.insert( pView );
+ }
+
+ SdrRectObj::NbcSetLayer( _nLayer );
+
+ // collect all views in which our new layer is visible
+ ::std::set< SdrView* > aNewlyVisible;
+
+ {
+ SdrViewIter aIter( this );
+ for ( SdrView* pView = aIter.FirstView(); pView; pView = aIter.NextView() )
+ {
+ ::std::set< SdrView* >::const_iterator aPrevPos = aPreviouslyVisible.find( pView );
+ if ( aPreviouslyVisible.end() != aPrevPos )
+ { // in pView, we were visible _before_ the layer change, and are
+ // visible _after_ the layer change, too
+ // -> we're not interested in this view at all
+ aPreviouslyVisible.erase( aPrevPos );
+ }
+ else
+ {
+ // in pView, we were visible _before_ the layer change, and are
+ // _not_ visible after the layer change
+ // => remember this view, as our visibility there changed
+ aNewlyVisible.insert( pView );
+ }
+ }
+ }
+
+ // now aPreviouslyVisible contains all views where we became invisible
+ ::std::set< SdrView* >::const_iterator aLoopViews;
+ for ( aLoopViews = aPreviouslyVisible.begin();
+ aLoopViews != aPreviouslyVisible.end();
+ ++aLoopViews
+ )
+ {
+ lcl_ensureControlVisibility( *aLoopViews, this, false );
+ }
+
+ // and aNewlyVisible all views where we became visible
+ for ( aLoopViews = aNewlyVisible.begin();
+ aLoopViews != aNewlyVisible.end();
+ ++aLoopViews
+ )
+ {
+ lcl_ensureControlVisibility( *aLoopViews, this, true );
+ }
+}
+
+void SdrUnoObj::CreateUnoControlModel(const String& rModelName)
+{
+ DBG_ASSERT(!xUnoControlModel.is(), "model already exists");
+
+ aUnoControlModelTypeName = rModelName;
+
+ uno::Reference< awt::XControlModel > xModel;
+ uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ if (aUnoControlModelTypeName.Len() && xFactory.is() )
+ {
+ xModel = uno::Reference< awt::XControlModel >(xFactory->createInstance(
+ aUnoControlModelTypeName), uno::UNO_QUERY);
+
+ if (xModel.is())
+ SetChanged();
+ }
+
+ SetUnoControlModel(xModel);
+}
+
+void SdrUnoObj::CreateUnoControlModel(const String& rModelName,
+ const uno::Reference< lang::XMultiServiceFactory >& rxSFac)
+{
+ DBG_ASSERT(!xUnoControlModel.is(), "model already exists");
+
+ aUnoControlModelTypeName = rModelName;
+
+ uno::Reference< awt::XControlModel > xModel;
+ if (aUnoControlModelTypeName.Len() && rxSFac.is() )
+ {
+ xModel = uno::Reference< awt::XControlModel >(rxSFac->createInstance(
+ aUnoControlModelTypeName), uno::UNO_QUERY);
+
+ if (xModel.is())
+ SetChanged();
+ }
+
+ SetUnoControlModel(xModel);
+}
+
+void SdrUnoObj::SetUnoControlModel( const uno::Reference< awt::XControlModel >& xModel)
+{
+ if (xUnoControlModel.is())
+ {
+ uno::Reference< lang::XComponent > xComp(xUnoControlModel, uno::UNO_QUERY);
+ if (xComp.is())
+ m_pImpl->pEventListener->StopListening(xComp);
+ }
+
+ xUnoControlModel = xModel;
+
+ // control model muss servicename des controls enthalten
+ if (xUnoControlModel.is())
+ {
+ uno::Reference< beans::XPropertySet > xSet(xUnoControlModel, uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ uno::Any aValue( xSet->getPropertyValue(String("DefaultControl", gsl_getSystemTextEncoding())) );
+ ::rtl::OUString aStr;
+ if( aValue >>= aStr )
+ aUnoControlTypeName = String(aStr);
+ }
+
+ uno::Reference< lang::XComponent > xComp(xUnoControlModel, uno::UNO_QUERY);
+ if (xComp.is())
+ m_pImpl->pEventListener->StartListening(xComp);
+ }
+
+ // invalidate all ViewObject contacts
+ ViewContactOfUnoControl* pVC = NULL;
+ if ( impl_getViewContact( pVC ) )
+ {
+ // flushViewObjectContacts() removes all existing VOCs for the local DrawHierarchy. This
+ // is always allowed since they will be re-created on demand (and with the changed model)
+ GetViewContact().flushViewObjectContacts(true);
+ }
+}
+
+//------------------------------------------------------------------------
+uno::Reference< awt::XControl > SdrUnoObj::GetUnoControl(const SdrView& _rView, const OutputDevice& _rOut) const
+{
+ uno::Reference< awt::XControl > xControl;
+
+ SdrPageView* pPageView = _rView.GetSdrPageView();
+ OSL_ENSURE( GetPage() == pPageView->GetPage(), "SdrUnoObj::GetUnoControl: This object is not displayed in that particular view!" );
+ if ( GetPage() != pPageView->GetPage() )
+ return NULL;
+
+ SdrPageWindow* pPageWindow = pPageView ? pPageView->FindPageWindow( _rOut ) : NULL;
+ OSL_ENSURE( pPageWindow, "SdrUnoObj::GetUnoControl: did not find my SdrPageWindow!" );
+ if ( !pPageWindow )
+ return NULL;
+
+ ViewObjectContact& rViewObjectContact( GetViewContact().GetViewObjectContact( pPageWindow->GetObjectContact() ) );
+ ViewObjectContactOfUnoControl* pUnoContact = dynamic_cast< ViewObjectContactOfUnoControl* >( &rViewObjectContact );
+ OSL_ENSURE( pUnoContact, "SdrUnoObj::GetUnoControl: wrong contact type!" );
+ if ( pUnoContact )
+ xControl = pUnoContact->getControl();
+
+ return xControl;
+}
+
+//------------------------------------------------------------------------
+uno::Reference< awt::XControl > SdrUnoObj::GetTemporaryControlForWindow(
+ const Window& _rWindow, uno::Reference< awt::XControlContainer >& _inout_ControlContainer ) const
+{
+ uno::Reference< awt::XControl > xControl;
+
+ ViewContactOfUnoControl* pVC = NULL;
+ if ( impl_getViewContact( pVC ) )
+ xControl = pVC->getTemporaryControlForWindow( _rWindow, _inout_ControlContainer );
+
+ return xControl;
+}
+
+//------------------------------------------------------------------------
+bool SdrUnoObj::impl_getViewContact( ViewContactOfUnoControl*& _out_rpContact ) const
+{
+ ViewContact& rViewContact( GetViewContact() );
+ _out_rpContact = dynamic_cast< ViewContactOfUnoControl* >( &rViewContact );
+ DBG_ASSERT( _out_rpContact, "SdrUnoObj::impl_getViewContact: could not find my ViewContact!" );
+ return ( _out_rpContact != NULL );
+}
+
+//------------------------------------------------------------------------
+::sdr::contact::ViewContact* SdrUnoObj::CreateObjectSpecificViewContact()
+{
+ return new ::sdr::contact::ViewContactOfUnoControl( *this );
+}
+
+// -----------------------------------------------------------------------------
+// eof
diff --git a/svx/source/svdraw/svdoutl.cxx b/svx/source/svdraw/svdoutl.cxx
new file mode 100644
index 000000000000..22c28b7808d4
--- /dev/null
+++ b/svx/source/svdraw/svdoutl.cxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/svdoutl.hxx>
+#include <editeng/outliner.hxx>
+#include <svx/svdotext.hxx>
+#include <editeng/editstat.hxx>
+#include <svx/svdmodel.hxx>
+#include <editeng/eeitem.hxx>
+#include <svl/itempool.hxx>
+
+DBG_NAME(SdrOutliner)
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+SdrOutliner::SdrOutliner( SfxItemPool* pItemPool, sal_uInt16 nMode )
+: Outliner( pItemPool, nMode ),
+ //mpPaintInfoRec( NULL )
+ mpVisualizedPage(0)
+{
+ DBG_CTOR(SdrOutliner,NULL);
+}
+
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+SdrOutliner::~SdrOutliner()
+{
+ DBG_DTOR(SdrOutliner,NULL);
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+void SdrOutliner::SetTextObj( const SdrTextObj* pObj )
+{
+ if( pObj && pObj != mpTextObj.get() )
+ {
+ SetUpdateMode(sal_False);
+ sal_uInt16 nOutlinerMode2 = OUTLINERMODE_OUTLINEOBJECT;
+ if ( !pObj->IsOutlText() )
+ nOutlinerMode2 = OUTLINERMODE_TEXTOBJECT;
+ Init( nOutlinerMode2 );
+
+ SetGlobalCharStretching(100,100);
+
+ sal_uIntPtr nStat = GetControlWord();
+ nStat &= ~( EE_CNTRL_STRETCHING | EE_CNTRL_AUTOPAGESIZE );
+ SetControlWord(nStat);
+
+ Size aNullSize;
+ Size aMaxSize( 100000,100000 );
+ SetMinAutoPaperSize( aNullSize );
+ SetMaxAutoPaperSize( aMaxSize );
+ SetPaperSize( aMaxSize );
+ ClearPolygon();
+ }
+
+ mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+void SdrOutliner::SetTextObjNoInit( const SdrTextObj* pObj )
+{
+ mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+XubString SdrOutliner::CalcFieldValue(const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos,
+ Color*& rpTxtColor, Color*& rpFldColor)
+{
+ FASTBOOL bOk = sal_False;
+ XubString aRet;
+
+ if(mpTextObj.is())
+ bOk = static_cast< SdrTextObj* >( mpTextObj.get())->CalcFieldValue(rField, nPara, nPos, sal_False, rpTxtColor, rpFldColor, aRet);
+
+ if (!bOk)
+ aRet = Outliner::CalcFieldValue(rField, nPara, nPos, rpTxtColor, rpFldColor);
+
+ return aRet;
+}
+
+const SdrTextObj* SdrOutliner::GetTextObj() const
+{
+ if( mpTextObj.is() )
+ return static_cast< SdrTextObj* >( mpTextObj.get() );
+ else
+ return 0;
+}
diff --git a/svx/source/svdraw/svdoutlinercache.cxx b/svx/source/svdraw/svdoutlinercache.cxx
new file mode 100644
index 000000000000..afa2a23bb93d
--- /dev/null
+++ b/svx/source/svdraw/svdoutlinercache.cxx
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+
+#include "svdoutlinercache.hxx"
+#include <svx/svdoutl.hxx>
+#include <svx/svdmodel.hxx>
+
+extern SdrOutliner* SdrMakeOutliner( sal_uInt16 nOutlinerMode, SdrModel* pModel );
+
+SdrOutlinerCache::SdrOutlinerCache( SdrModel* pModel )
+: mpModel( pModel ),
+ mpModeOutline( NULL ),
+ mpModeText( NULL )
+{
+}
+
+SdrOutliner* SdrOutlinerCache::createOutliner( sal_uInt16 nOutlinerMode )
+{
+ SdrOutliner* pOutliner = NULL;
+
+ if( (OUTLINERMODE_OUTLINEOBJECT == nOutlinerMode) && mpModeOutline )
+ {
+ pOutliner = mpModeOutline;
+ mpModeOutline = NULL;
+ }
+ else if( (OUTLINERMODE_TEXTOBJECT == nOutlinerMode) && mpModeText )
+ {
+ pOutliner = mpModeText;
+ mpModeText = NULL;
+ }
+ else
+ {
+ pOutliner = SdrMakeOutliner( nOutlinerMode, mpModel );
+ Outliner& aDrawOutliner = mpModel->GetDrawOutliner();
+ pOutliner->SetCalcFieldValueHdl( aDrawOutliner.GetCalcFieldValueHdl() );
+ }
+
+ return pOutliner;
+}
+
+SdrOutlinerCache::~SdrOutlinerCache()
+{
+ if( mpModeOutline )
+ {
+ delete mpModeOutline;
+ mpModeOutline = NULL;
+ }
+
+ if( mpModeText )
+ {
+ delete mpModeText;
+ mpModeText = NULL;
+ }
+}
+
+void SdrOutlinerCache::disposeOutliner( SdrOutliner* pOutliner )
+{
+ if( pOutliner )
+ {
+ sal_uInt16 nOutlMode = pOutliner->GetOutlinerMode();
+
+ if( (OUTLINERMODE_OUTLINEOBJECT == nOutlMode) && (NULL == mpModeOutline) )
+ {
+ mpModeOutline = pOutliner;
+ pOutliner->Clear();
+ pOutliner->SetVertical( false );
+
+ // #101088# Deregister on outliner, might be reused from outliner cache
+ pOutliner->SetNotifyHdl( Link() );
+ }
+ else if( (OUTLINERMODE_TEXTOBJECT == nOutlMode) && (NULL == mpModeText) )
+ {
+ mpModeText = pOutliner;
+ pOutliner->Clear();
+ pOutliner->SetVertical( false );
+
+ // #101088# Deregister on outliner, might be reused from outliner cache
+ pOutliner->SetNotifyHdl( Link() );
+ }
+ else
+ {
+ delete pOutliner;
+ }
+ }
+}
+
+
diff --git a/svx/source/svdraw/svdovirt.cxx b/svx/source/svdraw/svdovirt.cxx
new file mode 100644
index 000000000000..c6703f2305df
--- /dev/null
+++ b/svx/source/svdraw/svdovirt.cxx
@@ -0,0 +1,659 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svdovirt.hxx>
+#include <svx/xpool.hxx>
+#include <svx/svdtrans.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/svdhdl.hxx>
+#include <svx/sdr/contact/viewcontactofvirtobj.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svddrgv.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sdr::properties::BaseProperties& SdrVirtObj::GetProperties() const
+{
+ return rRefObj.GetProperties();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// AW, OD 2004-05-03 #i27224#
+sdr::contact::ViewContact* SdrVirtObj::CreateObjectSpecificViewContact()
+{
+ return new sdr::contact::ViewContactOfVirtObj(*this);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(SdrVirtObj,SdrObject);
+
+SdrVirtObj::SdrVirtObj(SdrObject& rNewObj):
+ rRefObj(rNewObj)
+{
+ bVirtObj=sal_True; // Ja, ich bin ein virtuelles Objekt
+ rRefObj.AddReference(*this);
+ bClosedObj=rRefObj.IsClosedObj();
+}
+
+SdrVirtObj::SdrVirtObj(SdrObject& rNewObj, const Point& rAnchorPos):
+ rRefObj(rNewObj)
+{
+ aAnchor=rAnchorPos;
+ bVirtObj=sal_True; // Ja, ich bin ein virtuelles Objekt
+ rRefObj.AddReference(*this);
+ bClosedObj=rRefObj.IsClosedObj();
+}
+
+SdrVirtObj::~SdrVirtObj()
+{
+ rRefObj.DelReference(*this);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+const SdrObject& SdrVirtObj::GetReferencedObj() const
+{
+ return rRefObj;
+}
+
+SdrObject& SdrVirtObj::ReferencedObj()
+{
+ return rRefObj;
+}
+
+void __EXPORT SdrVirtObj::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& /*rHint*/)
+{
+ bClosedObj=rRefObj.IsClosedObj();
+ SetRectsDirty(); // hier noch Optimieren.
+
+ // Only a repaint here, rRefObj may have changed and broadcasts
+ ActionChanged();
+ // BroadcastObjectChange();
+}
+
+void SdrVirtObj::NbcSetAnchorPos(const Point& rAnchorPos)
+{
+ aAnchor=rAnchorPos;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrVirtObj::SetModel(SdrModel* pNewModel)
+{
+ SdrObject::SetModel(pNewModel);
+ rRefObj.SetModel(pNewModel);
+}
+
+void SdrVirtObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
+{
+ rRefObj.TakeObjInfo(rInfo);
+}
+
+sal_uInt32 SdrVirtObj::GetObjInventor() const
+{
+ return rRefObj.GetObjInventor();
+}
+
+sal_uInt16 SdrVirtObj::GetObjIdentifier() const
+{
+ return rRefObj.GetObjIdentifier();
+}
+
+SdrObjList* SdrVirtObj::GetSubList() const
+{
+ return rRefObj.GetSubList();
+}
+
+const Rectangle& SdrVirtObj::GetCurrentBoundRect() const
+{
+ ((SdrVirtObj*)this)->aOutRect=rRefObj.GetCurrentBoundRect(); // Hier noch optimieren
+ ((SdrVirtObj*)this)->aOutRect+=aAnchor;
+ return aOutRect;
+}
+
+const Rectangle& SdrVirtObj::GetLastBoundRect() const
+{
+ ((SdrVirtObj*)this)->aOutRect=rRefObj.GetLastBoundRect(); // Hier noch optimieren
+ ((SdrVirtObj*)this)->aOutRect+=aAnchor;
+ return aOutRect;
+}
+
+void SdrVirtObj::RecalcBoundRect()
+{
+ aOutRect=rRefObj.GetCurrentBoundRect();
+ aOutRect+=aAnchor;
+}
+
+void SdrVirtObj::SetChanged()
+{
+ SdrObject::SetChanged();
+}
+
+SdrObject* SdrVirtObj::Clone() const
+{
+ SdrObject* pObj=new SdrVirtObj(((SdrVirtObj*)this)->rRefObj); // Nur eine weitere Referenz
+ return pObj;
+}
+
+void SdrVirtObj::operator=(const SdrObject& rObj)
+{ // ???anderes Objekt referenzieren???
+ SdrObject::operator=(rObj);
+ aAnchor=((SdrVirtObj&)rObj).aAnchor;
+}
+
+void SdrVirtObj::TakeObjNameSingul(XubString& rName) const
+{
+ rRefObj.TakeObjNameSingul(rName);
+ rName.Insert(sal_Unicode('['), 0);
+ rName += sal_Unicode(']');
+
+ String aName( GetName() );
+ if(aName.Len())
+ {
+ rName += sal_Unicode(' ');
+ rName += sal_Unicode('\'');
+ rName += aName;
+ rName += sal_Unicode('\'');
+ }
+}
+
+void SdrVirtObj::TakeObjNamePlural(XubString& rName) const
+{
+ rRefObj.TakeObjNamePlural(rName);
+ rName.Insert(sal_Unicode('['), 0);
+ rName += sal_Unicode(']');
+}
+
+void operator +=(PolyPolygon& rPoly, const Point& rOfs)
+{
+ if (rOfs.X()!=0 || rOfs.Y()!=0) {
+ sal_uInt16 i,j;
+ for (j=0; j<rPoly.Count(); j++) {
+ Polygon aP1(rPoly.GetObject(j));
+ for (i=0; i<aP1.GetSize(); i++) {
+ aP1[i]+=rOfs;
+ }
+ rPoly.Replace(aP1,j);
+ }
+ }
+}
+
+basegfx::B2DPolyPolygon SdrVirtObj::TakeXorPoly() const
+{
+ basegfx::B2DPolyPolygon aPolyPolygon(rRefObj.TakeXorPoly());
+
+ if(aAnchor.X() || aAnchor.Y())
+ {
+ aPolyPolygon.transform(basegfx::tools::createTranslateB2DHomMatrix(aAnchor.X(), aAnchor.Y()));
+ }
+
+ return aPolyPolygon;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_uInt32 SdrVirtObj::GetHdlCount() const
+{
+ return rRefObj.GetHdlCount();
+}
+
+SdrHdl* SdrVirtObj::GetHdl(sal_uInt32 nHdlNum) const
+{
+ SdrHdl* pHdl=rRefObj.GetHdl(nHdlNum);
+
+ // #i73248#
+ // GetHdl() at SdrObject is not guaranteed to return an object
+ if(pHdl)
+ {
+ Point aP(pHdl->GetPos()+aAnchor);
+ pHdl->SetPos(aP);
+ }
+
+ return pHdl;
+}
+
+sal_uInt32 SdrVirtObj::GetPlusHdlCount(const SdrHdl& rHdl) const
+{
+ return rRefObj.GetPlusHdlCount(rHdl);
+}
+
+SdrHdl* SdrVirtObj::GetPlusHdl(const SdrHdl& rHdl, sal_uInt32 nPlNum) const
+{
+ SdrHdl* pHdl=rRefObj.GetPlusHdl(rHdl,nPlNum);
+ pHdl->SetPos(pHdl->GetPos() + aAnchor);
+ return pHdl;
+}
+
+void SdrVirtObj::AddToHdlList(SdrHdlList& rHdlList) const
+{
+ // #i73248#
+ // SdrObject::AddToHdlList(rHdlList) is not a good thing to call
+ // since at SdrPathObj, only AddToHdlList may be used and the call
+ // will instead use the standard implementation which uses GetHdlCount()
+ // and GetHdl instead. This is not wrong, but may be much less effective
+ // and may not be prepared to GetHdl returning NULL
+
+ // get handles using AddToHdlList from ref object
+ SdrHdlList aLocalList(0);
+ rRefObj.AddToHdlList(aLocalList);
+ const sal_uInt32 nHdlCount(aLocalList.GetHdlCount());
+
+ if(nHdlCount)
+ {
+ // translate handles and add them to dest list. They are temporarily part of
+ // two lists then
+ const Point aOffset(GetOffset());
+
+ for(sal_uInt32 a(0L); a < nHdlCount; a++)
+ {
+ SdrHdl* pCandidate = aLocalList.GetHdl(a);
+ pCandidate->SetPos(pCandidate->GetPos() + aOffset);
+ rHdlList.AddHdl(pCandidate);
+ }
+
+ // remove them from source list, else they will be deleted when
+ // source list is deleted
+ while(aLocalList.GetHdlCount())
+ {
+ aLocalList.RemoveHdl(aLocalList.GetHdlCount() - 1L);
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+bool SdrVirtObj::hasSpecialDrag() const
+{
+ return rRefObj.hasSpecialDrag();
+}
+
+bool SdrVirtObj::supportsFullDrag() const
+{
+ return false;
+}
+
+SdrObject* SdrVirtObj::getFullDragClone() const
+{
+ static bool bSpecialHandling(false);
+ SdrObject* pRetval = 0;
+
+ if(bSpecialHandling)
+ {
+ // special handling for VirtObj. Do not create another
+ // reference to rRefObj, this would allow to change that
+ // one on drag. Instead, create a SdrGrafObj for drag containing
+ // the graphical representation
+ pRetval = new SdrGrafObj(SdrDragView::GetObjGraphic(GetModel(), this), GetLogicRect());
+ }
+ else
+ {
+ SdrObject& rReferencedObject = ((SdrVirtObj*)this)->ReferencedObj();
+ pRetval = new SdrGrafObj(SdrDragView::GetObjGraphic(GetModel(), &rReferencedObject), GetLogicRect());
+ }
+
+ return pRetval;
+}
+
+bool SdrVirtObj::beginSpecialDrag(SdrDragStat& rDrag) const
+{
+ return rRefObj.beginSpecialDrag(rDrag);
+}
+
+bool SdrVirtObj::applySpecialDrag(SdrDragStat& rDrag)
+{
+ return rRefObj.applySpecialDrag(rDrag);
+}
+
+basegfx::B2DPolyPolygon SdrVirtObj::getSpecialDragPoly(const SdrDragStat& rDrag) const
+{
+ return rRefObj.getSpecialDragPoly(rDrag);
+ // Offset handlen !!!!!! fehlt noch !!!!!!!
+}
+
+String SdrVirtObj::getSpecialDragComment(const SdrDragStat& rDrag) const
+{
+ return rRefObj.getSpecialDragComment(rDrag);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+FASTBOOL SdrVirtObj::BegCreate(SdrDragStat& rStat)
+{
+ return rRefObj.BegCreate(rStat);
+}
+
+FASTBOOL SdrVirtObj::MovCreate(SdrDragStat& rStat)
+{
+ return rRefObj.MovCreate(rStat);
+}
+
+FASTBOOL SdrVirtObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
+{
+ return rRefObj.EndCreate(rStat,eCmd);
+}
+
+FASTBOOL SdrVirtObj::BckCreate(SdrDragStat& rStat)
+{
+ return rRefObj.BckCreate(rStat);
+}
+
+void SdrVirtObj::BrkCreate(SdrDragStat& rStat)
+{
+ rRefObj.BrkCreate(rStat);
+}
+
+basegfx::B2DPolyPolygon SdrVirtObj::TakeCreatePoly(const SdrDragStat& rDrag) const
+{
+ return rRefObj.TakeCreatePoly(rDrag);
+ // Offset handlen !!!!!! fehlt noch !!!!!!!
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrVirtObj::NbcMove(const Size& rSiz)
+{
+ MovePoint(aAnchor,rSiz);
+ SetRectsDirty();
+}
+
+void SdrVirtObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+{
+ rRefObj.NbcResize(rRef-aAnchor,xFact,yFact);
+ SetRectsDirty();
+}
+
+void SdrVirtObj::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
+{
+ rRefObj.NbcRotate(rRef-aAnchor,nWink,sn,cs);
+ SetRectsDirty();
+}
+
+void SdrVirtObj::NbcMirror(const Point& rRef1, const Point& rRef2)
+{
+ rRefObj.NbcMirror(rRef1-aAnchor,rRef2-aAnchor);
+ SetRectsDirty();
+}
+
+void SdrVirtObj::NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
+{
+ rRefObj.NbcShear(rRef-aAnchor,nWink,tn,bVShear);
+ SetRectsDirty();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrVirtObj::Move(const Size& rSiz)
+{
+ if (rSiz.Width()!=0 || rSiz.Height()!=0) {
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ // #110094#-14 SendRepaintBroadcast();
+ NbcMove(rSiz);
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0);
+ }
+}
+
+void SdrVirtObj::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+{
+ if (xFact.GetNumerator()!=xFact.GetDenominator() || yFact.GetNumerator()!=yFact.GetDenominator()) {
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ rRefObj.Resize(rRef-aAnchor,xFact,yFact);
+ SetRectsDirty();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+ }
+}
+
+void SdrVirtObj::Rotate(const Point& rRef, long nWink, double sn, double cs)
+{
+ if (nWink!=0) {
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ rRefObj.Rotate(rRef-aAnchor,nWink,sn,cs);
+ SetRectsDirty();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+ }
+}
+
+void SdrVirtObj::Mirror(const Point& rRef1, const Point& rRef2)
+{
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ rRefObj.Mirror(rRef1-aAnchor,rRef2-aAnchor);
+ SetRectsDirty();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+}
+
+void SdrVirtObj::Shear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
+{
+ if (nWink!=0) {
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ rRefObj.Shear(rRef-aAnchor,nWink,tn,bVShear);
+ SetRectsDirty();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrVirtObj::RecalcSnapRect()
+{
+ aSnapRect=rRefObj.GetSnapRect();
+ aSnapRect+=aAnchor;
+}
+
+const Rectangle& SdrVirtObj::GetSnapRect() const
+{
+ ((SdrVirtObj*)this)->aSnapRect=rRefObj.GetSnapRect();
+ ((SdrVirtObj*)this)->aSnapRect+=aAnchor;
+ return aSnapRect;
+}
+
+void SdrVirtObj::SetSnapRect(const Rectangle& rRect)
+{
+ {
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ Rectangle aR(rRect);
+ aR-=aAnchor;
+ rRefObj.SetSnapRect(aR);
+ SetRectsDirty();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+ }
+}
+
+void SdrVirtObj::NbcSetSnapRect(const Rectangle& rRect)
+{
+ Rectangle aR(rRect);
+ aR-=aAnchor;
+ SetRectsDirty();
+ rRefObj.NbcSetSnapRect(aR);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+const Rectangle& SdrVirtObj::GetLogicRect() const
+{
+ ((SdrVirtObj*)this)->aSnapRect=rRefObj.GetLogicRect(); // !!! Missbrauch von aSnapRect !!!
+ ((SdrVirtObj*)this)->aSnapRect+=aAnchor; // Wenns mal Aerger gibt, muss ein weiteres Rectangle Member her (oder Heap)
+ return aSnapRect;
+}
+
+void SdrVirtObj::SetLogicRect(const Rectangle& rRect)
+{
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ Rectangle aR(rRect);
+ aR-=aAnchor;
+ rRefObj.SetLogicRect(aR);
+ SetRectsDirty();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+}
+
+void SdrVirtObj::NbcSetLogicRect(const Rectangle& rRect)
+{
+ Rectangle aR(rRect);
+ aR-=aAnchor;
+ SetRectsDirty();
+ rRefObj.NbcSetLogicRect(aR);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+long SdrVirtObj::GetRotateAngle() const
+{
+ return rRefObj.GetRotateAngle();
+}
+
+long SdrVirtObj::GetShearAngle(FASTBOOL bVertical) const
+{
+ return rRefObj.GetShearAngle(bVertical);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_uInt32 SdrVirtObj::GetSnapPointCount() const
+{
+ return rRefObj.GetSnapPointCount();
+}
+
+Point SdrVirtObj::GetSnapPoint(sal_uInt32 i) const
+{
+ Point aP(rRefObj.GetSnapPoint(i));
+ aP+=aAnchor;
+ return aP;
+}
+
+sal_Bool SdrVirtObj::IsPolyObj() const
+{
+ return rRefObj.IsPolyObj();
+}
+
+sal_uInt32 SdrVirtObj::GetPointCount() const
+{
+ return rRefObj.GetPointCount();
+}
+
+Point SdrVirtObj::GetPoint(sal_uInt32 i) const
+{
+ return Point(rRefObj.GetPoint(i) + aAnchor);
+}
+
+void SdrVirtObj::NbcSetPoint(const Point& rPnt, sal_uInt32 i)
+{
+ Point aP(rPnt);
+ aP-=aAnchor;
+ rRefObj.SetPoint(aP,i);
+ SetRectsDirty();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrObjGeoData* SdrVirtObj::NewGeoData() const
+{
+ return rRefObj.NewGeoData();
+}
+
+void SdrVirtObj::SaveGeoData(SdrObjGeoData& rGeo) const
+{
+ rRefObj.SaveGeoData(rGeo);
+}
+
+void SdrVirtObj::RestGeoData(const SdrObjGeoData& rGeo)
+{
+ rRefObj.RestGeoData(rGeo);
+ SetRectsDirty();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrObjGeoData* SdrVirtObj::GetGeoData() const
+{
+ return rRefObj.GetGeoData();
+}
+
+void SdrVirtObj::SetGeoData(const SdrObjGeoData& rGeo)
+{
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+ rRefObj.SetGeoData(rGeo);
+ SetRectsDirty();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrVirtObj::NbcReformatText()
+{
+ rRefObj.NbcReformatText();
+}
+
+void SdrVirtObj::ReformatText()
+{
+ rRefObj.ReformatText();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+FASTBOOL SdrVirtObj::HasMacro() const
+{
+ return rRefObj.HasMacro();
+}
+
+SdrObject* SdrVirtObj::CheckMacroHit(const SdrObjMacroHitRec& rRec) const
+{
+ return rRefObj.CheckMacroHit(rRec); // Todo: Positionsversatz
+}
+
+Pointer SdrVirtObj::GetMacroPointer(const SdrObjMacroHitRec& rRec) const
+{
+ return rRefObj.GetMacroPointer(rRec); // Todo: Positionsversatz
+}
+
+void SdrVirtObj::PaintMacro(OutputDevice& rOut, const Rectangle& rDirtyRect, const SdrObjMacroHitRec& rRec) const
+{
+ rRefObj.PaintMacro(rOut,rDirtyRect,rRec); // Todo: Positionsversatz
+}
+
+FASTBOOL SdrVirtObj::DoMacro(const SdrObjMacroHitRec& rRec)
+{
+ return rRefObj.DoMacro(rRec); // Todo: Positionsversatz
+}
+
+XubString SdrVirtObj::GetMacroPopupComment(const SdrObjMacroHitRec& rRec) const
+{
+ return rRefObj.GetMacroPopupComment(rRec); // Todo: Positionsversatz
+}
+
+const Point SdrVirtObj::GetOffset() const
+{
+ // #i73248# default offset of SdrVirtObj is aAnchor
+ return aAnchor;
+}
+
+// eof
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
new file mode 100644
index 000000000000..7fdc35ae7545
--- /dev/null
+++ b/svx/source/svdraw/svdpage.cxx
@@ -0,0 +1,2032 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svdpage.hxx>
+
+// HACK
+#include <sot/storage.hxx>
+#include <sot/clsids.hxx>
+#include <sot/storage.hxx>
+#include <svx/svdview.hxx>
+#include <string.h>
+#ifndef _STRING_H
+#define _STRING_H
+#endif
+#include <vcl/svapp.hxx>
+
+#include <tools/diagnose_ex.h>
+
+#include <svx/svdetc.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdograf.hxx> // fuer SwapInAll()
+#include <svx/svdoedge.hxx> // Zum kopieren der Konnektoren
+#include <svx/svdoole2.hxx> // Sonderbehandlung OLE beim SdrExchangeFormat
+#include "svx/svditer.hxx"
+#include <svx/svdmodel.hxx>
+#include <svx/svdlayer.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdundo.hxx>
+#include <svx/fmglob.hxx>
+#include <svx/polysc3d.hxx>
+
+#include <svx/fmdpage.hxx>
+
+#include <sfx2/objsh.hxx>
+#include <vcl/salbtype.hxx> // FRound
+#include <svx/sdr/contact/viewcontactofsdrpage.hxx>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <algorithm>
+#include <svl/smplhint.hxx>
+
+using namespace ::com::sun::star;
+
+namespace {
+void DumpObjectList (const ::std::vector<SdrObjectWeakRef>& rContainer)
+{
+ ::std::vector<SdrObjectWeakRef>::const_iterator iObject (rContainer.begin());
+ ::std::vector<SdrObjectWeakRef>::const_iterator iEnd (rContainer.end());
+ for (int nIndex=0 ; iObject!=iEnd; ++iObject,++nIndex)
+ {
+ const SdrObject* pObject = iObject->get();
+ OSL_TRACE("%d : %x, %s", nIndex,
+ pObject,
+ ::rtl::OUStringToOString(pObject->GetName(),RTL_TEXTENCODING_UTF8).getStr());
+ }
+}
+}
+
+
+class SdrObjList::WeakSdrObjectContainerType
+ : public ::std::vector<SdrObjectWeakRef>
+{
+public:
+ WeakSdrObjectContainerType (const sal_Int32 nInitialSize)
+ : ::std::vector<SdrObjectWeakRef>(nInitialSize) {};
+};
+
+
+
+static const sal_Int32 InitialObjectContainerCapacity (64);
+DBG_NAME(SdrObjList)
+
+TYPEINIT0(SdrObjList);
+
+SdrObjList::SdrObjList(SdrModel* pNewModel, SdrPage* pNewPage, SdrObjList* pNewUpList):
+ maList(),
+ mpNavigationOrder(),
+ mbIsNavigationOrderDirty(false)
+{
+ DBG_CTOR(SdrObjList,NULL);
+ maList.reserve(InitialObjectContainerCapacity);
+ pModel=pNewModel;
+ pPage=pNewPage;
+ pUpList=pNewUpList;
+ bObjOrdNumsDirty=sal_False;
+ bRectsDirty=sal_False;
+ pOwnerObj=NULL;
+ eListKind=SDROBJLIST_UNKNOWN;
+}
+
+SdrObjList::SdrObjList(const SdrObjList& rSrcList):
+ maList(),
+ mpNavigationOrder(),
+ mbIsNavigationOrderDirty(false)
+{
+ DBG_CTOR(SdrObjList,NULL);
+ maList.reserve(InitialObjectContainerCapacity);
+ pModel=NULL;
+ pPage=NULL;
+ pUpList=NULL;
+ bObjOrdNumsDirty=sal_False;
+ bRectsDirty=sal_False;
+ pOwnerObj=NULL;
+ eListKind=SDROBJLIST_UNKNOWN;
+ *this=rSrcList;
+}
+
+SdrObjList::~SdrObjList()
+{
+ DBG_DTOR(SdrObjList,NULL);
+
+ // #111111#
+ // To avoid that the Clear() method will broadcast changes when in destruction
+ // which would call virtual methos (not allowed in destructor), the model is set
+ // to NULL here.
+ pModel = 0L;
+
+ Clear(); // Containerinhalt loeschen!
+}
+
+void SdrObjList::operator=(const SdrObjList& rSrcList)
+{
+ Clear();
+ eListKind=rSrcList.eListKind;
+ CopyObjects(rSrcList);
+}
+
+void SdrObjList::CopyObjects(const SdrObjList& rSrcList)
+{
+ Clear();
+ bObjOrdNumsDirty=sal_False;
+ bRectsDirty =sal_False;
+ sal_uIntPtr nCloneErrCnt=0;
+ sal_uIntPtr nAnz=rSrcList.GetObjCount();
+ SdrInsertReason aReason(SDRREASON_COPY);
+ sal_uIntPtr no;
+ for (no=0; no<nAnz; no++) {
+ SdrObject* pSO=rSrcList.GetObj(no);
+
+ // #116235#
+ //SdrObject* pDO=pSO->Clone(pPage,pModel);
+ SdrObject* pDO = pSO->Clone();
+ pDO->SetModel(pModel);
+ pDO->SetPage(pPage);
+
+ if (pDO!=NULL) {
+ NbcInsertObject(pDO,CONTAINER_APPEND,&aReason);
+ } else {
+ nCloneErrCnt++;
+ }
+ }
+ // und nun zu den Konnektoren
+ // Die neuen Objekte werden auf die der rSrcList abgebildet
+ // und so die Objektverbindungen hergestellt.
+ // Aehnliche Implementation an folgenden Stellen:
+ // void SdrObjList::CopyObjects(const SdrObjList& rSrcList)
+ // SdrModel* SdrExchangeView::GetMarkedObjModel() const
+ // FASTBOOL SdrExchangeView::Paste(const SdrModel& rMod,...)
+ // void SdrEditView::CopyMarked()
+ if (nCloneErrCnt==0) {
+ for (no=0; no<nAnz; no++) {
+ const SdrObject* pSrcOb=rSrcList.GetObj(no);
+ SdrEdgeObj* pSrcEdge=PTR_CAST(SdrEdgeObj,pSrcOb);
+ if (pSrcEdge!=NULL) {
+ SdrObject* pSrcNode1=pSrcEdge->GetConnectedNode(sal_True);
+ SdrObject* pSrcNode2=pSrcEdge->GetConnectedNode(sal_False);
+ if (pSrcNode1!=NULL && pSrcNode1->GetObjList()!=pSrcEdge->GetObjList()) pSrcNode1=NULL; // Listenuebergreifend
+ if (pSrcNode2!=NULL && pSrcNode2->GetObjList()!=pSrcEdge->GetObjList()) pSrcNode2=NULL; // ist (noch) nicht
+ if (pSrcNode1!=NULL || pSrcNode2!=NULL) {
+ SdrObject* pEdgeObjTmp=GetObj(no);
+ SdrEdgeObj* pDstEdge=PTR_CAST(SdrEdgeObj,pEdgeObjTmp);
+ if (pDstEdge!=NULL) {
+ if (pSrcNode1!=NULL) {
+ sal_uIntPtr nDstNode1=pSrcNode1->GetOrdNum();
+ SdrObject* pDstNode1=GetObj(nDstNode1);
+ if (pDstNode1!=NULL) { // Sonst grober Fehler!
+ pDstEdge->ConnectToNode(sal_True,pDstNode1);
+ } else {
+ DBG_ERROR("SdrObjList::operator=(): pDstNode1==NULL!");
+ }
+ }
+ if (pSrcNode2!=NULL) {
+ sal_uIntPtr nDstNode2=pSrcNode2->GetOrdNum();
+ SdrObject* pDstNode2=GetObj(nDstNode2);
+ if (pDstNode2!=NULL) { // Node war sonst wohl nicht markiert
+ pDstEdge->ConnectToNode(sal_False,pDstNode2);
+ } else {
+ DBG_ERROR("SdrObjList::operator=(): pDstNode2==NULL!");
+ }
+ }
+ } else {
+ DBG_ERROR("SdrObjList::operator=(): pDstEdge==NULL!");
+ }
+ }
+ }
+ }
+ } else {
+#ifdef DBG_UTIL
+ ByteString aStr("SdrObjList::operator=(): Fehler beim Clonen ");
+
+ if(nCloneErrCnt == 1)
+ {
+ aStr += "eines Zeichenobjekts.";
+ }
+ else
+ {
+ aStr += "von ";
+ aStr += ByteString::CreateFromInt32( nCloneErrCnt );
+ aStr += " Zeichenobjekten.";
+ }
+
+ aStr += " Objektverbindungen werden nicht mitkopiert.";
+
+ DBG_ERROR(aStr.GetBuffer());
+#endif
+ }
+}
+
+void SdrObjList::Clear()
+{
+ sal_Bool bObjectsRemoved(sal_False);
+
+ while( ! maList.empty())
+ {
+ // remove last object from list
+ SdrObject* pObj = maList.back();
+ RemoveObjectFromContainer(maList.size()-1);
+
+ // flushViewObjectContacts() is done since SdrObject::Free is not guaranteed
+ // to delete the object and thus refresh visualisations
+ pObj->GetViewContact().flushViewObjectContacts(true);
+
+ bObjectsRemoved = sal_True;
+
+ // sent remove hint (after removal, see RemoveObject())
+ if(pModel)
+ {
+ SdrHint aHint(*pObj);
+ aHint.SetKind(HINT_OBJREMOVED);
+ aHint.SetPage(pPage);
+ pModel->Broadcast(aHint);
+ }
+
+ // delete the object itself
+ SdrObject::Free( pObj );
+ }
+
+ if(pModel && bObjectsRemoved)
+ {
+ pModel->SetChanged();
+ }
+}
+
+SdrPage* SdrObjList::GetPage() const
+{
+ return pPage;
+}
+
+void SdrObjList::SetPage(SdrPage* pNewPage)
+{
+ if (pPage!=pNewPage) {
+ pPage=pNewPage;
+ sal_uIntPtr nAnz=GetObjCount();
+ for (sal_uIntPtr no=0; no<nAnz; no++) {
+ SdrObject* pObj=GetObj(no);
+ pObj->SetPage(pPage);
+ }
+ }
+}
+
+SdrModel* SdrObjList::GetModel() const
+{
+ return pModel;
+}
+
+void SdrObjList::SetModel(SdrModel* pNewModel)
+{
+ if (pModel!=pNewModel) {
+ pModel=pNewModel;
+ sal_uIntPtr nAnz=GetObjCount();
+ for (sal_uIntPtr i=0; i<nAnz; i++) {
+ SdrObject* pObj=GetObj(i);
+ pObj->SetModel(pModel);
+ }
+ }
+}
+
+void SdrObjList::RecalcObjOrdNums()
+{
+ sal_uIntPtr nAnz=GetObjCount();
+ for (sal_uIntPtr no=0; no<nAnz; no++) {
+ SdrObject* pObj=GetObj(no);
+ pObj->SetOrdNum(no);
+ }
+ bObjOrdNumsDirty=sal_False;
+}
+
+void SdrObjList::RecalcRects()
+{
+ aOutRect=Rectangle();
+ aSnapRect=aOutRect;
+ sal_uIntPtr nAnz=GetObjCount();
+ sal_uIntPtr i;
+ for (i=0; i<nAnz; i++) {
+ SdrObject* pObj=GetObj(i);
+ if (i==0) {
+ aOutRect=pObj->GetCurrentBoundRect();
+ aSnapRect=pObj->GetSnapRect();
+ } else {
+ aOutRect.Union(pObj->GetCurrentBoundRect());
+ aSnapRect.Union(pObj->GetSnapRect());
+ }
+ }
+}
+
+void SdrObjList::SetRectsDirty()
+{
+ bRectsDirty=sal_True;
+ if (pUpList!=NULL) pUpList->SetRectsDirty();
+}
+
+void SdrObjList::impChildInserted(SdrObject& rChild) const
+{
+ sdr::contact::ViewContact* pParent = rChild.GetViewContact().GetParentContact();
+
+ if(pParent)
+ {
+ pParent->ActionChildInserted(rChild.GetViewContact());
+ }
+}
+
+void SdrObjList::NbcInsertObject(SdrObject* pObj, sal_uIntPtr nPos, const SdrInsertReason* /*pReason*/)
+{
+ DBG_ASSERT(pObj!=NULL,"SdrObjList::NbcInsertObject(NULL)");
+ if (pObj!=NULL) {
+ DBG_ASSERT(!pObj->IsInserted(),"ZObjekt hat bereits Inserted-Status");
+ sal_uIntPtr nAnz=GetObjCount();
+ if (nPos>nAnz) nPos=nAnz;
+ InsertObjectIntoContainer(*pObj,nPos);
+
+ if (nPos<nAnz) bObjOrdNumsDirty=sal_True;
+ pObj->SetOrdNum(nPos);
+ pObj->SetObjList(this);
+ pObj->SetPage(pPage);
+
+ // #110094# Inform the parent about change to allow invalidations at
+ // evtl. existing parent visualisations
+ impChildInserted(*pObj);
+
+ if (!bRectsDirty) {
+ aOutRect.Union(pObj->GetCurrentBoundRect());
+ aSnapRect.Union(pObj->GetSnapRect());
+ }
+ pObj->SetInserted(sal_True); // Ruft u.a. den UserCall
+ }
+}
+
+void SdrObjList::InsertObject(SdrObject* pObj, sal_uIntPtr nPos, const SdrInsertReason* pReason)
+{
+ DBG_ASSERT(pObj!=NULL,"SdrObjList::InsertObject(NULL)");
+
+ if(pObj)
+ {
+ // #69055# if anchor is used, reset it before grouping
+ if(GetOwnerObj())
+ {
+ const Point& rAnchorPos = pObj->GetAnchorPos();
+ if(rAnchorPos.X() || rAnchorPos.Y())
+ pObj->NbcSetAnchorPos(Point());
+ }
+
+ // do insert to new group
+ NbcInsertObject(pObj, nPos, pReason);
+
+ // Falls das Objekt in eine Gruppe eingefuegt wird
+ // und nicht mit seinen Bruedern ueberlappt, muss es
+ // einen eigenen Redraw bekommen
+ if(pOwnerObj)
+ {
+ // only repaint here
+ pOwnerObj->ActionChanged();
+ }
+
+ if(pModel)
+ {
+ // Hier muss ein anderer Broadcast her!
+ // Repaint ab Objekt Nummer ... (Achtung: GroupObj)
+ if(pObj->GetPage())
+ {
+ SdrHint aHint(*pObj);
+
+ aHint.SetKind(HINT_OBJINSERTED);
+ pModel->Broadcast(aHint);
+ }
+
+ pModel->SetChanged();
+ }
+ }
+}
+
+SdrObject* SdrObjList::NbcRemoveObject(sal_uIntPtr nObjNum)
+{
+ if (nObjNum >= maList.size())
+ {
+ OSL_ASSERT(nObjNum<maList.size());
+ return NULL;
+ }
+
+ sal_uIntPtr nAnz=GetObjCount();
+ SdrObject* pObj=maList[nObjNum];
+ RemoveObjectFromContainer(nObjNum);
+
+ // flushViewObjectContacts() clears the VOC's and those invalidate
+ pObj->GetViewContact().flushViewObjectContacts(true);
+
+ DBG_ASSERT(pObj!=NULL,"Object zum Removen nicht gefunden");
+ if (pObj!=NULL) {
+ DBG_ASSERT(pObj->IsInserted(),"ZObjekt hat keinen Inserted-Status");
+ pObj->SetInserted(sal_False); // Ruft u.a. den UserCall
+ pObj->SetObjList(NULL);
+ pObj->SetPage(NULL);
+ if (!bObjOrdNumsDirty) { // Optimierung fuer den Fall, dass das letzte Obj rausgenommen wird
+ if (nObjNum!=sal_uIntPtr(nAnz-1)) {
+ bObjOrdNumsDirty=sal_True;
+ }
+ }
+ SetRectsDirty();
+ }
+ return pObj;
+}
+
+SdrObject* SdrObjList::RemoveObject(sal_uIntPtr nObjNum)
+{
+ if (nObjNum >= maList.size())
+ {
+ OSL_ASSERT(nObjNum<maList.size());
+ return NULL;
+ }
+
+ sal_uIntPtr nAnz=GetObjCount();
+ SdrObject* pObj=maList[nObjNum];
+ RemoveObjectFromContainer(nObjNum);
+
+ DBG_ASSERT(pObj!=NULL,"Object zum Removen nicht gefunden");
+ if(pObj)
+ {
+ // flushViewObjectContacts() clears the VOC's and those invalidate
+ pObj->GetViewContact().flushViewObjectContacts(true);
+
+ DBG_ASSERT(pObj->IsInserted(),"ZObjekt hat keinen Inserted-Status");
+ if (pModel!=NULL) {
+ // Hier muss ein anderer Broadcast her!
+ if (pObj->GetPage()!=NULL) {
+ SdrHint aHint(*pObj);
+ aHint.SetKind(HINT_OBJREMOVED);
+ pModel->Broadcast(aHint);
+ }
+ pModel->SetChanged();
+ }
+ pObj->SetInserted(sal_False); // Ruft u.a. den UserCall
+ pObj->SetObjList(NULL);
+ pObj->SetPage(NULL);
+ if (!bObjOrdNumsDirty) { // Optimierung fuer den Fall, dass das letzte Obj rausgenommen wird
+ if (nObjNum!=sal_uIntPtr(nAnz-1)) {
+ bObjOrdNumsDirty=sal_True;
+ }
+ }
+ SetRectsDirty();
+
+ if(pOwnerObj && !GetObjCount())
+ {
+ // empty group created; it needs to be repainted since it's
+ // visualisation changes
+ pOwnerObj->ActionChanged();
+ }
+ }
+ return pObj;
+}
+
+SdrObject* SdrObjList::NbcReplaceObject(SdrObject* pNewObj, sal_uIntPtr nObjNum)
+{
+ if (nObjNum >= maList.size() || pNewObj == NULL)
+ {
+ OSL_ASSERT(nObjNum<maList.size());
+ OSL_ASSERT(pNewObj!=NULL);
+ return NULL;
+ }
+
+ SdrObject* pObj=maList[nObjNum];
+ DBG_ASSERT(pObj!=NULL,"SdrObjList::ReplaceObject: Object zum Removen nicht gefunden");
+ if (pObj!=NULL) {
+ DBG_ASSERT(pObj->IsInserted(),"SdrObjList::ReplaceObject: ZObjekt hat keinen Inserted-Status");
+ pObj->SetInserted(sal_False);
+ pObj->SetObjList(NULL);
+ pObj->SetPage(NULL);
+ ReplaceObjectInContainer(*pNewObj,nObjNum);
+
+ // flushViewObjectContacts() clears the VOC's and those invalidate
+ pObj->GetViewContact().flushViewObjectContacts(true);
+
+ pNewObj->SetOrdNum(nObjNum);
+ pNewObj->SetObjList(this);
+ pNewObj->SetPage(pPage);
+
+ // #110094# Inform the parent about change to allow invalidations at
+ // evtl. existing parent visualisations
+ impChildInserted(*pNewObj);
+
+ pNewObj->SetInserted(sal_True);
+ SetRectsDirty();
+ }
+ return pObj;
+}
+
+SdrObject* SdrObjList::ReplaceObject(SdrObject* pNewObj, sal_uIntPtr nObjNum)
+{
+ if (nObjNum >= maList.size())
+ {
+ OSL_ASSERT(nObjNum<maList.size());
+ return NULL;
+ }
+ if (pNewObj == NULL)
+ {
+ OSL_ASSERT(pNewObj!=NULL);
+ return NULL;
+ }
+
+ SdrObject* pObj=maList[nObjNum];
+ DBG_ASSERT(pObj!=NULL,"SdrObjList::ReplaceObject: Object zum Removen nicht gefunden");
+ if (pObj!=NULL) {
+ DBG_ASSERT(pObj->IsInserted(),"SdrObjList::ReplaceObject: ZObjekt hat keinen Inserted-Status");
+ if (pModel!=NULL) {
+ // Hier muss ein anderer Broadcast her!
+ if (pObj->GetPage()!=NULL) {
+ SdrHint aHint(*pObj);
+ aHint.SetKind(HINT_OBJREMOVED);
+ pModel->Broadcast(aHint);
+ }
+ }
+ pObj->SetInserted(sal_False);
+ pObj->SetObjList(NULL);
+ pObj->SetPage(NULL);
+ ReplaceObjectInContainer(*pNewObj,nObjNum);
+
+ // flushViewObjectContacts() clears the VOC's and those invalidate
+ pObj->GetViewContact().flushViewObjectContacts(true);
+
+ pNewObj->SetOrdNum(nObjNum);
+ pNewObj->SetObjList(this);
+ pNewObj->SetPage(pPage);
+
+ // #110094# Inform the parent about change to allow invalidations at
+ // evtl. existing parent visualisations
+ impChildInserted(*pNewObj);
+
+ pNewObj->SetInserted(sal_True);
+ if (pModel!=NULL) {
+ // Hier muss ein anderer Broadcast her!
+ if (pNewObj->GetPage()!=NULL) {
+ SdrHint aHint(*pNewObj);
+ aHint.SetKind(HINT_OBJINSERTED);
+ pModel->Broadcast(aHint);
+ }
+ pModel->SetChanged();
+ }
+ SetRectsDirty();
+ }
+ return pObj;
+}
+
+SdrObject* SdrObjList::NbcSetObjectOrdNum(sal_uIntPtr nOldObjNum, sal_uIntPtr nNewObjNum)
+{
+ if (nOldObjNum >= maList.size() || nNewObjNum >= maList.size())
+ {
+ OSL_ASSERT(nOldObjNum<maList.size());
+ OSL_ASSERT(nNewObjNum<maList.size());
+ return NULL;
+ }
+
+ SdrObject* pObj=maList[nOldObjNum];
+ if (nOldObjNum==nNewObjNum) return pObj;
+ DBG_ASSERT(pObj!=NULL,"SdrObjList::NbcSetObjectOrdNum: Object nicht gefunden");
+ if (pObj!=NULL) {
+ DBG_ASSERT(pObj->IsInserted(),"SdrObjList::NbcSetObjectOrdNum: ZObjekt hat keinen Inserted-Status");
+ RemoveObjectFromContainer(nOldObjNum);
+
+ InsertObjectIntoContainer(*pObj,nNewObjNum);
+
+ // #110094# No need to delete visualisation data since same object
+ // gets inserted again. Also a single ActionChanged is enough
+ pObj->ActionChanged();
+
+ pObj->SetOrdNum(nNewObjNum);
+ bObjOrdNumsDirty=sal_True;
+ }
+ return pObj;
+}
+
+SdrObject* SdrObjList::SetObjectOrdNum(sal_uIntPtr nOldObjNum, sal_uIntPtr nNewObjNum)
+{
+ if (nOldObjNum >= maList.size() || nNewObjNum >= maList.size())
+ {
+ OSL_ASSERT(nOldObjNum<maList.size());
+ OSL_ASSERT(nNewObjNum<maList.size());
+ return NULL;
+ }
+
+ SdrObject* pObj=maList[nOldObjNum];
+ if (nOldObjNum==nNewObjNum) return pObj;
+ DBG_ASSERT(pObj!=NULL,"SdrObjList::SetObjectOrdNum: Object nicht gefunden");
+ if (pObj!=NULL) {
+ DBG_ASSERT(pObj->IsInserted(),"SdrObjList::SetObjectOrdNum: ZObjekt hat keinen Inserted-Status");
+ RemoveObjectFromContainer(nOldObjNum);
+ InsertObjectIntoContainer(*pObj,nNewObjNum);
+
+ // #110094#No need to delete visualisation data since same object
+ // gets inserted again. Also a single ActionChanged is enough
+ pObj->ActionChanged();
+
+ pObj->SetOrdNum(nNewObjNum);
+ bObjOrdNumsDirty=sal_True;
+ if (pModel!=NULL)
+ {
+ // Hier muss ein anderer Broadcast her!
+ if (pObj->GetPage()!=NULL) pModel->Broadcast(SdrHint(*pObj));
+ pModel->SetChanged();
+ }
+ }
+ return pObj;
+}
+
+const Rectangle& SdrObjList::GetAllObjSnapRect() const
+{
+ if (bRectsDirty) {
+ ((SdrObjList*)this)->RecalcRects();
+ ((SdrObjList*)this)->bRectsDirty=sal_False;
+ }
+ return aSnapRect;
+}
+
+const Rectangle& SdrObjList::GetAllObjBoundRect() const
+{
+ // #i106183# for deep group hierarchies like in chart2, the invalidates
+ // through the hierarchy are not correct; use a 2nd hint for the needed
+ // recalculation. Future versions will have no bool flag at all, but
+ // just aOutRect in empty state to representate an invalid state, thus
+ // it's a step in the right direction.
+ if (bRectsDirty || aOutRect.IsEmpty())
+ {
+ ((SdrObjList*)this)->RecalcRects();
+ ((SdrObjList*)this)->bRectsDirty=sal_False;
+ }
+ return aOutRect;
+}
+
+void SdrObjList::NbcReformatAllTextObjects()
+{
+ sal_uIntPtr nAnz=GetObjCount();
+ sal_uIntPtr nNum=0;
+
+ Printer* pPrinter = NULL;
+
+ if (pModel)
+ {
+ if (pModel->GetRefDevice() && pModel->GetRefDevice()->GetOutDevType() == OUTDEV_PRINTER)
+ {
+ // Kein RefDevice oder RefDevice kein Printer
+ pPrinter = (Printer*) pModel->GetRefDevice();
+ }
+ }
+
+ while (nNum<nAnz)
+ {
+ SdrObject* pObj = GetObj(nNum);
+ if (pPrinter &&
+ pObj->GetObjInventor() == SdrInventor &&
+ pObj->GetObjIdentifier() == OBJ_OLE2 &&
+ !( (SdrOle2Obj*) pObj )->IsEmpty() )
+ {
+ //const SvInPlaceObjectRef& xObjRef = ((SdrOle2Obj*) pObj)->GetObjRef();
+ //TODO/LATER: PrinterChangeNotification needed
+ //if( xObjRef.Is() && ( xObjRef->GetMiscStatus() & SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE ) )
+ // xObjRef->OnDocumentPrinterChanged(pPrinter);
+ }
+
+ pObj->NbcReformatText();
+ nAnz=GetObjCount(); // ReformatText may delete an object
+ nNum++;
+ }
+
+}
+
+void SdrObjList::ReformatAllTextObjects()
+{
+ NbcReformatAllTextObjects();
+}
+
+/** steps over all available objects and reformats all
+ edge objects that are connected to other objects so that
+ they may reposition itselfs.
+ #103122#
+*/
+void SdrObjList::ReformatAllEdgeObjects()
+{
+ const sal_uInt32 nCount=GetObjCount();
+ sal_uInt32 nObj;
+
+ for( nObj = 0; nObj < nCount; nObj++ )
+ {
+ SdrObject* pObj = GetObj(nObj);
+ if( pObj->ISA(SdrEdgeObj) )
+ static_cast<SdrEdgeObj*>(pObj)->Reformat();
+ }
+}
+
+void SdrObjList::BurnInStyleSheetAttributes()
+{
+ for(sal_uInt32 a(0L); a < GetObjCount(); a++)
+ {
+ GetObj(a)->BurnInStyleSheetAttributes();
+ }
+}
+
+sal_uIntPtr SdrObjList::GetObjCount() const
+{
+ return maList.size();
+}
+
+
+
+
+SdrObject* SdrObjList::GetObj(sal_uIntPtr nNum) const
+{
+ if (nNum >= maList.size())
+ {
+ OSL_ASSERT(nNum<maList.size());
+ return NULL;
+ }
+ else
+ return maList[nNum];
+}
+
+
+
+
+FASTBOOL SdrObjList::IsReadOnly() const
+{
+ FASTBOOL bRet=sal_False;
+ if (pPage!=NULL && pPage!=this) bRet=pPage->IsReadOnly();
+ return bRet;
+}
+
+sal_uIntPtr SdrObjList::CountAllObjects() const
+{
+ sal_uIntPtr nCnt=GetObjCount();
+ sal_uIntPtr nAnz=nCnt;
+ for (sal_uInt16 nNum=0; nNum<nAnz; nNum++) {
+ SdrObjList* pSubOL=GetObj(nNum)->GetSubList();
+ if (pSubOL!=NULL) {
+ nCnt+=pSubOL->CountAllObjects();
+ }
+ }
+ return nCnt;
+}
+
+void SdrObjList::ForceSwapInObjects() const
+{
+ sal_uIntPtr nObjAnz=GetObjCount();
+ for (sal_uIntPtr nObjNum=nObjAnz; nObjNum>0;) {
+ SdrObject* pObj=GetObj(--nObjNum);
+ SdrGrafObj* pGrafObj=PTR_CAST(SdrGrafObj,pObj);
+ if (pGrafObj!=NULL) {
+ pGrafObj->ForceSwapIn();
+ }
+ SdrObjList* pOL=pObj->GetSubList();
+ if (pOL!=NULL) {
+ pOL->ForceSwapInObjects();
+ }
+ }
+}
+
+void SdrObjList::ForceSwapOutObjects() const
+{
+ sal_uIntPtr nObjAnz=GetObjCount();
+ for (sal_uIntPtr nObjNum=nObjAnz; nObjNum>0;) {
+ SdrObject* pObj=GetObj(--nObjNum);
+ SdrGrafObj* pGrafObj=PTR_CAST(SdrGrafObj,pObj);
+ if (pGrafObj!=NULL) {
+ pGrafObj->ForceSwapOut();
+ }
+ SdrObjList* pOL=pObj->GetSubList();
+ if (pOL!=NULL) {
+ pOL->ForceSwapOutObjects();
+ }
+ }
+}
+
+void SdrObjList::FlattenGroups()
+{
+ sal_Int32 nObj = GetObjCount();
+ sal_Int32 i;
+ for( i=nObj-1; i>=0; --i)
+ UnGroupObj(i);
+}
+
+void SdrObjList::UnGroupObj( sal_uIntPtr nObjNum )
+{
+ // if the given object is no group, this method is a noop
+ SdrObject* pUngroupObj = GetObj( nObjNum );
+ if( pUngroupObj )
+ {
+ SdrObjList* pSrcLst = pUngroupObj->GetSubList();
+ //sal_Int32 nCount( 0 );
+ if( pUngroupObj->ISA( SdrObjGroup ) && pSrcLst )
+ {
+ SdrObjGroup* pUngroupGroup = static_cast< SdrObjGroup* > (pUngroupObj);
+
+ // ungroup recursively (has to be head recursion,
+ // otherwise our indices will get trashed when doing it in
+ // the loop)
+ pSrcLst->FlattenGroups();
+
+ // the position at which we insert the members of rUngroupGroup
+ sal_Int32 nInsertPos( pUngroupGroup->GetOrdNum() );
+
+ SdrObject* pObj;
+ sal_Int32 i, nAnz = pSrcLst->GetObjCount();
+ for( i=0; i<nAnz; ++i )
+ {
+ pObj = pSrcLst->RemoveObject(0);
+ SdrInsertReason aReason(SDRREASON_VIEWCALL, pUngroupGroup);
+ InsertObject(pObj, nInsertPos, &aReason);
+ ++nInsertPos;
+ }
+
+ RemoveObject(nInsertPos);
+ }
+ }
+#ifdef DBG_UTIL
+ else
+ DBG_ERROR("SdrObjList::UnGroupObj: object index invalid");
+#endif
+}
+
+
+
+
+bool SdrObjList::HasObjectNavigationOrder (void) const
+{
+ return mpNavigationOrder.get() != NULL;
+}
+
+
+
+
+void SdrObjList::SetObjectNavigationPosition (
+ SdrObject& rObject,
+ const sal_uInt32 nNewPosition)
+{
+ // When the navigation order container has not yet been created then
+ // create one now. It is initialized with the z-order taken from
+ // maList.
+ if (mpNavigationOrder.get() == NULL)
+ {
+ mpNavigationOrder.reset(new WeakSdrObjectContainerType(maList.size()));
+ ::std::copy(
+ maList.begin(),
+ maList.end(),
+ mpNavigationOrder->begin());
+ }
+ OSL_ASSERT(mpNavigationOrder.get()!=NULL);
+ OSL_ASSERT( mpNavigationOrder->size() == maList.size());
+
+ SdrObjectWeakRef aReference (&rObject);
+
+ // Look up the object whose navigation position is to be changed.
+ WeakSdrObjectContainerType::iterator iObject (::std::find(
+ mpNavigationOrder->begin(),
+ mpNavigationOrder->end(),
+ aReference));
+ if (iObject == mpNavigationOrder->end())
+ {
+ // The given object is not a member of the navigation order.
+ return;
+ }
+
+ // Move the object to its new position.
+ const sal_uInt32 nOldPosition = ::std::distance(mpNavigationOrder->begin(), iObject);
+ if (nOldPosition != nNewPosition)
+ {
+ mpNavigationOrder->erase(iObject);
+ sal_uInt32 nInsertPosition (nNewPosition);
+ // Adapt insertion position for the just erased object.
+ if (nNewPosition >= nOldPosition)
+ nInsertPosition -= 1;
+ if (nInsertPosition >= mpNavigationOrder->size())
+ mpNavigationOrder->push_back(aReference);
+ else
+ mpNavigationOrder->insert(mpNavigationOrder->begin()+nInsertPosition, aReference);
+
+ mbIsNavigationOrderDirty = true;
+
+ // The navigation order is written out to file so mark the model as modified.
+ if (pModel != NULL)
+ pModel->SetChanged();
+ }
+}
+
+
+
+
+SdrObject* SdrObjList::GetObjectForNavigationPosition (const sal_uInt32 nNavigationPosition) const
+{
+ if (HasObjectNavigationOrder())
+ {
+ // There is a user defined navigation order. Make sure the object
+ // index is correct and look up the object in mpNavigationOrder.
+ if (nNavigationPosition >= mpNavigationOrder->size())
+ {
+ OSL_ASSERT(nNavigationPosition < mpNavigationOrder->size());
+ }
+ else
+ return (*mpNavigationOrder)[nNavigationPosition].get();
+ }
+ else
+ {
+ // There is no user defined navigation order. Use the z-order
+ // instead.
+ if (nNavigationPosition >= maList.size())
+ {
+ OSL_ASSERT(nNavigationPosition < maList.size());
+ }
+ else
+ return maList[nNavigationPosition];
+ }
+ return NULL;
+}
+
+
+
+
+void SdrObjList::ClearObjectNavigationOrder (void)
+{
+ mpNavigationOrder.reset();
+ mbIsNavigationOrderDirty = true;
+}
+
+
+
+
+bool SdrObjList::RecalcNavigationPositions (void)
+{
+ bool bUpToDate (false);
+
+ if (mbIsNavigationOrderDirty)
+ {
+ if (mpNavigationOrder.get() != NULL)
+ {
+ mbIsNavigationOrderDirty = false;
+
+ WeakSdrObjectContainerType::iterator iObject;
+ WeakSdrObjectContainerType::const_iterator iEnd (mpNavigationOrder->end());
+ sal_uInt32 nIndex (0);
+ for (iObject=mpNavigationOrder->begin(); iObject!=iEnd; ++iObject,++nIndex)
+ (*iObject)->SetNavigationPosition(nIndex);
+
+ bUpToDate = true;
+ }
+ }
+
+ return mpNavigationOrder.get() != NULL;
+}
+
+
+
+
+void SdrObjList::SetNavigationOrder (const uno::Reference<container::XIndexAccess>& rxOrder)
+{
+ if (rxOrder.is())
+ {
+ const sal_Int32 nCount = rxOrder->getCount();
+ if ((sal_uInt32)nCount != maList.size())
+ return;
+
+ if (mpNavigationOrder.get() == NULL)
+ mpNavigationOrder.reset(new WeakSdrObjectContainerType(nCount));
+
+ for (sal_Int32 nIndex=0; nIndex<nCount; ++nIndex)
+ {
+ uno::Reference<uno::XInterface> xShape (rxOrder->getByIndex(nIndex), uno::UNO_QUERY);
+ SdrObject* pObject = SdrObject::getSdrObjectFromXShape(xShape);
+ if (pObject == NULL)
+ break;
+ (*mpNavigationOrder)[nIndex] = pObject;
+ }
+
+ mbIsNavigationOrderDirty = true;
+ }
+ else
+ ClearObjectNavigationOrder();
+}
+
+
+
+
+void SdrObjList::InsertObjectIntoContainer (
+ SdrObject& rObject,
+ const sal_uInt32 nInsertPosition)
+{
+ OSL_ASSERT(nInsertPosition<=maList.size());
+
+ // Update the navigation positions.
+ if (HasObjectNavigationOrder())
+ {
+ // The new object does not have a user defined position so append it
+ // to the list.
+ rObject.SetNavigationPosition(mpNavigationOrder->size());
+ mpNavigationOrder->push_back(&rObject);
+ }
+
+ // Insert object into object list. Because the insert() method requires
+ // a valid iterator as insertion position, we have to use push_back() to
+ // insert at the end of the list.
+ if (nInsertPosition >= maList.size())
+ maList.push_back(&rObject);
+ else
+ maList.insert(maList.begin()+nInsertPosition, &rObject);
+ bObjOrdNumsDirty=sal_True;
+}
+
+
+
+
+void SdrObjList::ReplaceObjectInContainer (
+ SdrObject& rNewObject,
+ const sal_uInt32 nObjectPosition)
+{
+ if (nObjectPosition >= maList.size())
+ {
+ OSL_ASSERT(nObjectPosition<maList.size());
+ return;
+ }
+
+ // Update the navigation positions.
+ if (HasObjectNavigationOrder())
+ {
+ // A user defined position of the object that is to be replaced is
+ // not transferred to the new object so erase the former and append
+ // the later object from/to the navigation order.
+ OSL_ASSERT(nObjectPosition < maList.size());
+ SdrObjectWeakRef aReference (maList[nObjectPosition]);
+ WeakSdrObjectContainerType::iterator iObject (::std::find(
+ mpNavigationOrder->begin(),
+ mpNavigationOrder->end(),
+ aReference));
+ if (iObject != mpNavigationOrder->end())
+ mpNavigationOrder->erase(iObject);
+
+ mpNavigationOrder->push_back(&rNewObject);
+
+ mbIsNavigationOrderDirty = true;
+ }
+
+ maList[nObjectPosition] = &rNewObject;
+ bObjOrdNumsDirty=sal_True;
+}
+
+
+
+
+void SdrObjList::RemoveObjectFromContainer (
+ const sal_uInt32 nObjectPosition)
+{
+ if (nObjectPosition >= maList.size())
+ {
+ OSL_ASSERT(nObjectPosition<maList.size());
+ return;
+ }
+
+ // Update the navigation positions.
+ if (HasObjectNavigationOrder())
+ {
+ SdrObjectWeakRef aReference (maList[nObjectPosition]);
+ WeakSdrObjectContainerType::iterator iObject (::std::find(
+ mpNavigationOrder->begin(),
+ mpNavigationOrder->end(),
+ aReference));
+ if (iObject != mpNavigationOrder->end())
+ mpNavigationOrder->erase(iObject);
+ mbIsNavigationOrderDirty = true;
+ }
+
+ maList.erase(maList.begin()+nObjectPosition);
+ bObjOrdNumsDirty=sal_True;
+}
+
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrPageGridFrameList::Clear()
+{
+ sal_uInt16 nAnz=GetCount();
+ for (sal_uInt16 i=0; i<nAnz; i++) {
+ delete GetObject(i);
+ }
+ aList.Clear();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// #111111# PageUser section
+
+void SdrPage::AddPageUser(sdr::PageUser& rNewUser)
+{
+ maPageUsers.push_back(&rNewUser);
+}
+
+void SdrPage::RemovePageUser(sdr::PageUser& rOldUser)
+{
+ const ::sdr::PageUserVector::iterator aFindResult = ::std::find(maPageUsers.begin(), maPageUsers.end(), &rOldUser);
+ if(aFindResult != maPageUsers.end())
+ {
+ maPageUsers.erase(aFindResult);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// #110094# DrawContact section
+
+sdr::contact::ViewContact* SdrPage::CreateObjectSpecificViewContact()
+{
+ return new sdr::contact::ViewContactOfSdrPage(*this);
+}
+
+sdr::contact::ViewContact& SdrPage::GetViewContact() const
+{
+ if(!mpViewContact)
+ {
+ const_cast< SdrPage* >(this)->mpViewContact =
+ const_cast< SdrPage* >(this)->CreateObjectSpecificViewContact();
+ }
+
+ return *mpViewContact;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrPageProperties::ImpRemoveStyleSheet()
+{
+ if(mpStyleSheet)
+ {
+ EndListening(*mpStyleSheet);
+ mpProperties->SetParent(0);
+ mpStyleSheet = 0;
+ }
+}
+
+void SdrPageProperties::ImpAddStyleSheet(SfxStyleSheet& rNewStyleSheet)
+{
+ if(mpStyleSheet != &rNewStyleSheet)
+ {
+ ImpRemoveStyleSheet();
+ mpStyleSheet = &rNewStyleSheet;
+ StartListening(rNewStyleSheet);
+ mpProperties->SetParent(&rNewStyleSheet.GetItemSet());
+ }
+}
+
+void ImpPageChange(SdrPage& rSdrPage)
+{
+ rSdrPage.ActionChanged();
+
+ if(rSdrPage.GetModel())
+ {
+ rSdrPage.GetModel()->SetChanged(true);
+ SdrHint aHint(HINT_PAGEORDERCHG);
+ aHint.SetPage(&rSdrPage);
+ rSdrPage.GetModel()->Broadcast(aHint);
+ }
+}
+
+SdrPageProperties::SdrPageProperties(SdrPage& rSdrPage)
+: SfxListener(),
+ mpSdrPage(&rSdrPage),
+ mpStyleSheet(0),
+ mpProperties(new SfxItemSet(mpSdrPage->GetModel()->GetItemPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST))
+{
+ if(!rSdrPage.IsMasterPage())
+ {
+ mpProperties->Put(XFillStyleItem(XFILL_NONE));
+ }
+}
+
+SdrPageProperties::~SdrPageProperties()
+{
+ ImpRemoveStyleSheet();
+ delete mpProperties;
+}
+
+void SdrPageProperties::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint)
+{
+ const SfxSimpleHint* pSimpleHint = dynamic_cast< const SfxSimpleHint* >(&rHint);
+
+ if(pSimpleHint)
+ {
+ switch(pSimpleHint->GetId())
+ {
+ case SFX_HINT_DATACHANGED :
+ {
+ // notify change, broadcast
+ ImpPageChange(*mpSdrPage);
+ break;
+ }
+ case SFX_HINT_DYING :
+ {
+ // Style needs to be forgotten
+ ImpRemoveStyleSheet();
+ break;
+ }
+ }
+ }
+}
+
+const SfxItemSet& SdrPageProperties::GetItemSet() const
+{
+ return *mpProperties;
+}
+
+void SdrPageProperties::PutItemSet(const SfxItemSet& rSet)
+{
+ OSL_ENSURE(!mpSdrPage->IsMasterPage(), "Item set at MasterPage Attributes (!)");
+ mpProperties->Put(rSet);
+ ImpPageChange(*mpSdrPage);
+}
+
+void SdrPageProperties::PutItem(const SfxPoolItem& rItem)
+{
+ OSL_ENSURE(!mpSdrPage->IsMasterPage(), "Item set at MasterPage Attributes (!)");
+ mpProperties->Put(rItem);
+ ImpPageChange(*mpSdrPage);
+}
+
+void SdrPageProperties::ClearItem(const sal_uInt16 nWhich)
+{
+ mpProperties->ClearItem(nWhich);
+ ImpPageChange(*mpSdrPage);
+}
+
+void SdrPageProperties::SetStyleSheet(SfxStyleSheet* pStyleSheet)
+{
+ if(pStyleSheet)
+ {
+ ImpAddStyleSheet(*pStyleSheet);
+ }
+ else
+ {
+ ImpRemoveStyleSheet();
+ }
+
+ ImpPageChange(*mpSdrPage);
+}
+
+SfxStyleSheet* SdrPageProperties::GetStyleSheet() const
+{
+ return mpStyleSheet;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(SdrPage,SdrObjList);
+DBG_NAME(SdrPage)
+SdrPage::SdrPage(SdrModel& rNewModel, bool bMasterPage)
+: SdrObjList(&rNewModel, this),
+ mpViewContact(0L),
+ nWdt(10L),
+ nHgt(10L),
+ nBordLft(0L),
+ nBordUpp(0L),
+ nBordRgt(0L),
+ nBordLwr(0L),
+ pLayerAdmin(new SdrLayerAdmin(&rNewModel.GetLayerAdmin())),
+ mpSdrPageProperties(0),
+ mpMasterPageDescriptor(0L),
+ nPageNum(0L),
+ mbMaster(bMasterPage),
+ mbInserted(false),
+ mbObjectsNotPersistent(false),
+ mbSwappingLocked(false),
+ mbPageBorderOnlyLeftRight(false)
+{
+ DBG_CTOR(SdrPage,NULL);
+ aPrefVisiLayers.SetAll();
+ eListKind = (bMasterPage) ? SDROBJLIST_MASTERPAGE : SDROBJLIST_DRAWPAGE;
+
+ mpSdrPageProperties = new SdrPageProperties(*this);
+}
+
+SdrPage::SdrPage(const SdrPage& rSrcPage)
+: SdrObjList(rSrcPage.pModel, this),
+ tools::WeakBase< SdrPage >(),
+ mpViewContact(0L),
+ nWdt(rSrcPage.nWdt),
+ nHgt(rSrcPage.nHgt),
+ nBordLft(rSrcPage.nBordLft),
+ nBordUpp(rSrcPage.nBordUpp),
+ nBordRgt(rSrcPage.nBordRgt),
+ nBordLwr(rSrcPage.nBordLwr),
+ pLayerAdmin(new SdrLayerAdmin(rSrcPage.pModel->GetLayerAdmin())),
+ mpSdrPageProperties(0),
+ mpMasterPageDescriptor(0L),
+ nPageNum(rSrcPage.nPageNum),
+ mbMaster(rSrcPage.mbMaster),
+ mbInserted(false),
+ mbObjectsNotPersistent(rSrcPage.mbObjectsNotPersistent),
+ mbSwappingLocked(rSrcPage.mbSwappingLocked),
+ mbPageBorderOnlyLeftRight(rSrcPage.mbPageBorderOnlyLeftRight)
+{
+ DBG_CTOR(SdrPage,NULL);
+ aPrefVisiLayers.SetAll();
+ eListKind = (mbMaster) ? SDROBJLIST_MASTERPAGE : SDROBJLIST_DRAWPAGE;
+
+ // copy things from source
+ // Warning: this leads to slicing (see issue 93186) and has to be
+ // removed as soon as possible.
+ *this = rSrcPage;
+ OSL_ENSURE(mpSdrPageProperties,
+ "SdrPage::SdrPage: operator= did not create needed SdrPageProperties (!)");
+
+ // be careful and correct eListKind, a member of SdrObjList which
+ // will be changed by the SdrOIbjList::operator= before...
+ eListKind = (mbMaster) ? SDROBJLIST_MASTERPAGE : SDROBJLIST_DRAWPAGE;
+
+ // The previous assignment to *this may have resulted in a call to
+ // createUnoPage at a partially initialized (sliced) SdrPage object.
+ // Due to the vtable being not yet fully set-up at this stage,
+ // createUnoPage() may have been called at the wrong class.
+ // To force a call to the right createUnoPage() at a later time when the
+ // new object is full constructed mxUnoPage is disposed now.
+ uno::Reference<lang::XComponent> xComponent (mxUnoPage, uno::UNO_QUERY);
+ if (xComponent.is())
+ {
+ mxUnoPage = NULL;
+ xComponent->dispose();
+ }
+}
+
+SdrPage::~SdrPage()
+{
+ if( mxUnoPage.is() ) try
+ {
+ uno::Reference< lang::XComponent > xPageComponent( mxUnoPage, uno::UNO_QUERY_THROW );
+ mxUnoPage.clear();
+ xPageComponent->dispose();
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ // #111111#
+ // tell all the registered PageUsers that the page is in destruction
+ // This causes some (all?) PageUsers to remove themselves from the list
+ // of page users. Therefore we have to use a copy of the list for the
+ // iteration.
+ ::sdr::PageUserVector aListCopy (maPageUsers.begin(), maPageUsers.end());
+ for(::sdr::PageUserVector::iterator aIterator = aListCopy.begin(); aIterator != aListCopy.end(); aIterator++)
+ {
+ sdr::PageUser* pPageUser = *aIterator;
+ DBG_ASSERT(pPageUser, "SdrPage::~SdrPage: corrupt PageUser list (!)");
+ pPageUser->PageInDestruction(*this);
+ }
+
+ // #111111#
+ // Clear the vector. This means that user do not need to call RemovePageUser()
+ // when they get called from PageInDestruction().
+ maPageUsers.clear();
+
+ delete pLayerAdmin;
+
+ TRG_ClearMasterPage();
+
+ // #110094#
+ if(mpViewContact)
+ {
+ delete mpViewContact;
+ mpViewContact = 0L;
+ }
+
+ {
+ delete mpSdrPageProperties;
+ mpSdrPageProperties = 0;
+ }
+
+ DBG_DTOR(SdrPage,NULL);
+}
+
+void SdrPage::operator=(const SdrPage& rSrcPage)
+{
+ if(mpViewContact)
+ {
+ delete mpViewContact;
+ mpViewContact = 0L;
+ }
+
+ // Joe also sets some parameters for the class this one
+ // is derived from. SdrObjList does the same bad handling of
+ // copy constructor and operator=, so i better let it stand here.
+ pPage = this;
+
+ // copy all the local parameters to make this instance
+ // a valid copy od source page before copying and inserting
+ // the contained objects
+ mbMaster = rSrcPage.mbMaster;
+ mbSwappingLocked = rSrcPage.mbSwappingLocked;
+ mbPageBorderOnlyLeftRight = rSrcPage.mbPageBorderOnlyLeftRight;
+ aPrefVisiLayers = rSrcPage.aPrefVisiLayers;
+ nWdt = rSrcPage.nWdt;
+ nHgt = rSrcPage.nHgt;
+ nBordLft = rSrcPage.nBordLft;
+ nBordUpp = rSrcPage.nBordUpp;
+ nBordRgt = rSrcPage.nBordRgt;
+ nBordLwr = rSrcPage.nBordLwr;
+ nPageNum = rSrcPage.nPageNum;
+
+ if(rSrcPage.TRG_HasMasterPage())
+ {
+ TRG_SetMasterPage(rSrcPage.TRG_GetMasterPage());
+ TRG_SetMasterPageVisibleLayers(rSrcPage.TRG_GetMasterPageVisibleLayers());
+ }
+ else
+ {
+ TRG_ClearMasterPage();
+ }
+ //aMasters = rSrcPage.aMasters;
+
+ mbObjectsNotPersistent = rSrcPage.mbObjectsNotPersistent;
+
+ {
+ // #i111122# delete SdrPageProperties when model is different
+ if(mpSdrPageProperties && GetModel() != rSrcPage.GetModel())
+ {
+ delete mpSdrPageProperties;
+ mpSdrPageProperties = 0;
+ }
+
+ if(!mpSdrPageProperties)
+ {
+ mpSdrPageProperties = new SdrPageProperties(*this);
+ }
+ else
+ {
+ mpSdrPageProperties->ClearItem(0);
+ }
+
+ if(!IsMasterPage())
+ {
+ mpSdrPageProperties->PutItemSet(rSrcPage.getSdrPageProperties().GetItemSet());
+ }
+
+ mpSdrPageProperties->SetStyleSheet(rSrcPage.getSdrPageProperties().GetStyleSheet());
+ }
+
+ // Now copy the contained obejcts (by cloning them)
+ SdrObjList::operator=(rSrcPage);
+}
+
+SdrPage* SdrPage::Clone() const
+{
+ return Clone(NULL);
+}
+
+SdrPage* SdrPage::Clone(SdrModel* pNewModel) const
+{
+ if (pNewModel==NULL) pNewModel=pModel;
+ SdrPage* pPage2=new SdrPage(*pNewModel);
+ *pPage2=*this;
+ return pPage2;
+}
+
+void SdrPage::SetSize(const Size& aSiz)
+{
+ bool bChanged(false);
+
+ if(aSiz.Width() != nWdt)
+ {
+ nWdt = aSiz.Width();
+ bChanged = true;
+ }
+
+ if(aSiz.Height() != nHgt)
+ {
+ nHgt = aSiz.Height();
+ bChanged = true;
+ }
+
+ if(bChanged)
+ {
+ SetChanged();
+ }
+}
+
+Size SdrPage::GetSize() const
+{
+ return Size(nWdt,nHgt);
+}
+
+sal_Int32 SdrPage::GetWdt() const
+{
+ return nWdt;
+}
+
+void SdrPage::SetOrientation(Orientation eOri)
+{
+ // Quadratisch ist und bleibt immer Portrait
+ Size aSiz(GetSize());
+ if (aSiz.Width()!=aSiz.Height()) {
+ if ((eOri==ORIENTATION_PORTRAIT) == (aSiz.Width()>aSiz.Height())) {
+ SetSize(Size(aSiz.Height(),aSiz.Width()));
+ }
+ }
+}
+
+Orientation SdrPage::GetOrientation() const
+{
+ // Quadratisch ist Portrait
+ Orientation eRet=ORIENTATION_PORTRAIT;
+ Size aSiz(GetSize());
+ if (aSiz.Width()>aSiz.Height()) eRet=ORIENTATION_LANDSCAPE;
+ return eRet;
+}
+
+sal_Int32 SdrPage::GetHgt() const
+{
+ return nHgt;
+}
+
+void SdrPage::SetBorder(sal_Int32 nLft, sal_Int32 nUpp, sal_Int32 nRgt, sal_Int32 nLwr)
+{
+ bool bChanged(false);
+
+ if(nBordLft != nLft)
+ {
+ nBordLft = nLft;
+ bChanged = true;
+ }
+
+ if(nBordUpp != nUpp)
+ {
+ nBordUpp = nUpp;
+ bChanged = true;
+ }
+
+ if(nBordRgt != nRgt)
+ {
+ nBordRgt = nRgt;
+ bChanged = true;
+ }
+
+ if(nBordLwr != nLwr)
+ {
+ nBordLwr = nLwr;
+ bChanged = true;
+ }
+
+ if(bChanged)
+ {
+ SetChanged();
+ }
+}
+
+void SdrPage::SetLftBorder(sal_Int32 nBorder)
+{
+ if(nBordLft != nBorder)
+ {
+ nBordLft = nBorder;
+ SetChanged();
+ }
+}
+
+void SdrPage::SetUppBorder(sal_Int32 nBorder)
+{
+ if(nBordUpp != nBorder)
+ {
+ nBordUpp = nBorder;
+ SetChanged();
+ }
+}
+
+void SdrPage::SetRgtBorder(sal_Int32 nBorder)
+{
+ if(nBordRgt != nBorder)
+ {
+ nBordRgt=nBorder;
+ SetChanged();
+ }
+}
+
+void SdrPage::SetLwrBorder(sal_Int32 nBorder)
+{
+ if(nBordLwr != nBorder)
+ {
+ nBordLwr=nBorder;
+ SetChanged();
+ }
+}
+
+sal_Int32 SdrPage::GetLftBorder() const
+{
+ return nBordLft;
+}
+
+sal_Int32 SdrPage::GetUppBorder() const
+{
+ return nBordUpp;
+}
+
+sal_Int32 SdrPage::GetRgtBorder() const
+{
+ return nBordRgt;
+}
+
+sal_Int32 SdrPage::GetLwrBorder() const
+{
+ return nBordLwr;
+}
+
+void SdrPage::SetModel(SdrModel* pNewModel)
+{
+ SdrModel* pOldModel=pModel;
+ SdrObjList::SetModel(pNewModel);
+ if (pNewModel!=pOldModel)
+ {
+ if (pNewModel!=NULL) {
+ pLayerAdmin->SetParent(&pNewModel->GetLayerAdmin());
+ } else {
+ pLayerAdmin->SetParent(NULL);
+ }
+ pLayerAdmin->SetModel(pNewModel);
+
+ // create new SdrPageProperties with new model (due to SfxItemSet there)
+ // and copy ItemSet and StyleSheet
+ SdrPageProperties *pNew = new SdrPageProperties(*this);
+
+ if(!IsMasterPage())
+ {
+ pNew->PutItemSet(getSdrPageProperties().GetItemSet());
+ }
+
+ pNew->SetStyleSheet(getSdrPageProperties().GetStyleSheet());
+
+ delete mpSdrPageProperties;
+ mpSdrPageProperties = pNew;
+ }
+
+ // update listeners at possible api wrapper object
+ if( pOldModel != pNewModel )
+ {
+ if( mxUnoPage.is() )
+ {
+ SvxDrawPage* pPage2 = SvxDrawPage::getImplementation( mxUnoPage );
+ if( pPage2 )
+ pPage2->ChangeModel( pNewModel );
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+// #i68775# React on PageNum changes (from Model in most cases)
+void SdrPage::SetPageNum(sal_uInt16 nNew)
+{
+ if(nNew != nPageNum)
+ {
+ // change
+ nPageNum = nNew;
+
+ // notify visualisations, also notifies e.g. buffered MasterPages
+ ActionChanged();
+ }
+}
+
+sal_uInt16 SdrPage::GetPageNum() const
+{
+ if (!mbInserted)
+ return 0;
+
+ if (mbMaster) {
+ if (pModel && pModel->IsMPgNumsDirty())
+ ((SdrModel*)pModel)->RecalcPageNums(sal_True);
+ } else {
+ if (pModel && pModel->IsPagNumsDirty())
+ ((SdrModel*)pModel)->RecalcPageNums(sal_False);
+ }
+ return nPageNum;
+}
+
+void SdrPage::SetChanged()
+{
+ // #110094#-11
+ // For test purposes, use the new ViewContact for change
+ // notification now.
+ ActionChanged();
+
+ if( pModel )
+ {
+ pModel->SetChanged();
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// MasterPage interface
+
+void SdrPage::TRG_SetMasterPage(SdrPage& rNew)
+{
+ if(mpMasterPageDescriptor && &(mpMasterPageDescriptor->GetUsedPage()) == &rNew)
+ return;
+
+ if(mpMasterPageDescriptor)
+ TRG_ClearMasterPage();
+
+ mpMasterPageDescriptor = new ::sdr::MasterPageDescriptor(*this, rNew);
+ GetViewContact().ActionChanged();
+}
+
+void SdrPage::TRG_ClearMasterPage()
+{
+ if(mpMasterPageDescriptor)
+ {
+ SetChanged();
+
+ // the flushViewObjectContacts() will do needed invalidates by deleting the involved VOCs
+ mpMasterPageDescriptor->GetUsedPage().GetViewContact().flushViewObjectContacts(true);
+
+ delete mpMasterPageDescriptor;
+ mpMasterPageDescriptor = 0L;
+ }
+}
+
+SdrPage& SdrPage::TRG_GetMasterPage() const
+{
+ DBG_ASSERT(mpMasterPageDescriptor != 0L, "TRG_GetMasterPage(): No MasterPage available. Use TRG_HasMasterPage() before access (!)");
+ return mpMasterPageDescriptor->GetUsedPage();
+}
+
+const SetOfByte& SdrPage::TRG_GetMasterPageVisibleLayers() const
+{
+ DBG_ASSERT(mpMasterPageDescriptor != 0L, "TRG_GetMasterPageVisibleLayers(): No MasterPage available. Use TRG_HasMasterPage() before access (!)");
+ return mpMasterPageDescriptor->GetVisibleLayers();
+}
+
+void SdrPage::TRG_SetMasterPageVisibleLayers(const SetOfByte& rNew)
+{
+ DBG_ASSERT(mpMasterPageDescriptor != 0L, "TRG_SetMasterPageVisibleLayers(): No MasterPage available. Use TRG_HasMasterPage() before access (!)");
+ mpMasterPageDescriptor->SetVisibleLayers(rNew);
+}
+
+sdr::contact::ViewContact& SdrPage::TRG_GetMasterPageDescriptorViewContact() const
+{
+ DBG_ASSERT(mpMasterPageDescriptor != 0L, "TRG_GetMasterPageDescriptorViewContact(): No MasterPage available. Use TRG_HasMasterPage() before access (!)");
+ return mpMasterPageDescriptor->GetViewContact();
+}
+
+// #115423# used from SdrModel::RemoveMasterPage
+void SdrPage::TRG_ImpMasterPageRemoved(const SdrPage& rRemovedPage)
+{
+ if(TRG_HasMasterPage())
+ {
+ if(&TRG_GetMasterPage() == &rRemovedPage)
+ {
+ TRG_ClearMasterPage();
+ }
+ }
+}
+
+const SdrPageGridFrameList* SdrPage::GetGridFrameList(const SdrPageView* /*pPV*/, const Rectangle* /*pRect*/) const
+{
+ return NULL;
+}
+
+XubString SdrPage::GetLayoutName() const
+{
+ // Die wollte Dieter haben.
+ return String();
+}
+
+void SdrPage::SetInserted( bool bIns )
+{
+ if( mbInserted != bIns )
+ {
+ mbInserted = bIns;
+
+ SdrObjListIter aIter( *this, IM_FLAT );
+ while ( aIter.IsMore() )
+ {
+ SdrObject* pObj = aIter.Next();
+ if ( pObj->ISA(SdrOle2Obj) )
+ {
+ if( mbInserted )
+ ( (SdrOle2Obj*) pObj)->Connect();
+ else
+ ( (SdrOle2Obj*) pObj)->Disconnect();
+ }
+ }
+ }
+}
+
+
+uno::Reference< uno::XInterface > SdrPage::getUnoPage()
+{
+ // try weak reference first
+ if( !mxUnoPage.is() )
+ {
+ // create one
+ mxUnoPage = createUnoPage();
+ }
+
+ return mxUnoPage;
+}
+
+uno::Reference< uno::XInterface > SdrPage::createUnoPage()
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xInt =
+ static_cast<cppu::OWeakObject*>( new SvxFmDrawPage( this ) );
+ return xInt;
+}
+
+SfxStyleSheet* SdrPage::GetTextStyleSheetForObject( SdrObject* pObj ) const
+{
+ return pObj->GetStyleSheet();
+}
+
+FASTBOOL SdrPage::HasTransparentObjects( sal_Bool bCheckForAlphaChannel ) const
+{
+ FASTBOOL bRet = sal_False;
+
+ for( sal_uIntPtr n = 0, nCount = GetObjCount(); ( n < nCount ) && !bRet; n++ )
+ if( GetObj( n )->IsTransparent( bCheckForAlphaChannel ) )
+ bRet = sal_True;
+
+ return bRet;
+}
+
+/** returns an averaged background color of this page */
+// #i75566# GetBackgroundColor -> GetPageBackgroundColor and bScreenDisplay hint value
+Color SdrPage::GetPageBackgroundColor( SdrPageView* pView, bool bScreenDisplay ) const
+{
+ Color aColor;
+
+ if(bScreenDisplay && (!pView || pView->GetApplicationDocumentColor() == COL_AUTO))
+ {
+ svtools::ColorConfig aColorConfig;
+ aColor = aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor;
+ }
+ else
+ {
+ aColor = pView->GetApplicationDocumentColor();
+ }
+
+ const SfxItemSet* pBackgroundFill = &getSdrPageProperties().GetItemSet();
+
+ if(!IsMasterPage() && TRG_HasMasterPage())
+ {
+ if(XFILL_NONE == ((const XFillStyleItem&)pBackgroundFill->Get(XATTR_FILLSTYLE)).GetValue())
+ {
+ pBackgroundFill = &TRG_GetMasterPage().getSdrPageProperties().GetItemSet();
+ }
+ }
+
+ GetDraftFillColor(*pBackgroundFill, aColor);
+
+ return aColor;
+}
+
+/** *deprecated, use GetBackgroundColor with SdrPageView */
+Color SdrPage::GetPageBackgroundColor() const
+// #i75566# GetBackgroundColor -> GetPageBackgroundColor
+{
+ return GetPageBackgroundColor( NULL, true );
+}
+
+/** this method returns true if the object from the ViewObjectContact should
+ be visible on this page while rendering.
+ bEdit selects if visibility test is for an editing view or a final render,
+ like printing.
+*/
+bool SdrPage::checkVisibility(
+ const sdr::contact::ViewObjectContact& /*rOriginal*/,
+ const sdr::contact::DisplayInfo& /*rDisplayInfo*/,
+ bool /*bEdit*/)
+{
+ // this will be handled in the application if needed
+ return true;
+}
+
+// #110094# DrawContact support: Methods for handling Page changes
+void SdrPage::ActionChanged() const
+{
+ // Do necessary ViewContact actions
+ GetViewContact().ActionChanged();
+
+ // #i48535# also handle MasterPage change
+ if(TRG_HasMasterPage())
+ {
+ TRG_GetMasterPageDescriptorViewContact().ActionChanged();
+ }
+}
+
+// NYI: Dummy implementations for declarations in svdpage.hxx
+Bitmap SdrPage::GetBitmap(const SetOfByte& /*rVisibleLayers*/, FASTBOOL /*bTrimBorders*/) const
+{
+ DBG_ASSERT(0, "SdrPage::GetBitmap(): not yet implemented.");
+ return Bitmap();
+}
+GDIMetaFile SdrPage::GetMetaFile(const SetOfByte& /*rVisibleLayers*/, FASTBOOL /*bTrimBorders*/)
+{
+ DBG_ASSERT(0, "SdrPage::GetMetaFile(): not yet implemented.");
+ return GDIMetaFile();
+}
+
+bool SdrPage::isHandoutMasterPage() const
+{
+ return mbMaster && GetModel() && GetModel()->GetMasterPageCount()
+ && GetModel()->GetMasterPage(0) == this;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// sdr::Comment interface
+
+const sdr::Comment& SdrPage::GetCommentByIndex(sal_uInt32 nIndex)
+{
+ DBG_ASSERT(nIndex < maComments.size(), "SdrPage::GetCommentByIndex: Access out of range (!)");
+ return maComments[nIndex];
+}
+
+void SdrPage::AddComment(const sdr::Comment& rNew)
+{
+ maComments.push_back(rNew);
+ ::std::sort(maComments.begin(), maComments.end());
+}
+
+void SdrPage::ReplaceCommentByIndex(sal_uInt32 nIndex, const sdr::Comment& rNew)
+{
+ DBG_ASSERT(nIndex < maComments.size(), "SdrPage::GetCommentByIndex: Access out of range (!)");
+
+ if(maComments[nIndex] != rNew)
+ {
+ maComments[nIndex] = rNew;
+ ::std::sort(maComments.begin(), maComments.end());
+ }
+}
+
+const SdrPageProperties* SdrPage::getCorrectSdrPageProperties() const
+{
+ if(mpMasterPageDescriptor)
+ {
+ return mpMasterPageDescriptor->getCorrectSdrPageProperties();
+ }
+ else
+ {
+ return &getSdrPageProperties();
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// use new redirector instead of pPaintProc
+
+StandardCheckVisisbilityRedirector::StandardCheckVisisbilityRedirector()
+: ViewObjectContactRedirector()
+{
+}
+
+StandardCheckVisisbilityRedirector::~StandardCheckVisisbilityRedirector()
+{
+}
+
+drawinglayer::primitive2d::Primitive2DSequence StandardCheckVisisbilityRedirector::createRedirectedPrimitive2DSequence(
+ const sdr::contact::ViewObjectContact& rOriginal,
+ const sdr::contact::DisplayInfo& rDisplayInfo)
+{
+ SdrObject* pObject = rOriginal.GetViewContact().TryToGetSdrObject();
+
+ if(pObject)
+ {
+ if(pObject->GetPage())
+ {
+ if(pObject->GetPage()->checkVisibility(rOriginal, rDisplayInfo, false))
+ {
+ return ::sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo);
+ }
+ }
+
+ return drawinglayer::primitive2d::Primitive2DSequence();
+ }
+ else
+ {
+ // not an object, maybe a page
+ return ::sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx
new file mode 100644
index 000000000000..65a72cc915be
--- /dev/null
+++ b/svx/source/svdraw/svdpagv.cxx
@@ -0,0 +1,1133 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/svdpagv.hxx>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <comphelper/processfactory.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/xpoly.hxx>
+#include <svx/svdouno.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdview.hxx>
+
+#include <svx/svdedxv.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/svdpagv.hxx>
+#include <editeng/outliner.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdouno.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdview.hxx>
+#include "svx/svditer.hxx"
+#include <svx/svdogrp.hxx>
+#include <svx/svdtypes.hxx>
+
+#include <svx/svdotext.hxx> // fuer PaintOutlinerView
+#include <svx/svdoole2.hxx>
+
+// #110094#
+#include <svx/sdr/contact/objectcontactofpageview.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/sdr/contact/viewobjectcontactredirector.hxx>
+#include <svx/fmview.hxx>
+
+// for search on vector
+#include <algorithm>
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+#include <svx/sdrpagewindow.hxx>
+#include <svx/sdrpaintwindow.hxx>
+
+TYPEINIT1(SdrPageView, SfxListener);
+DBG_NAME(SdrPageView);
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// interface to SdrPageWindow
+
+SdrPageWindow* SdrPageView::FindPageWindow(SdrPaintWindow& rPaintWindow) const
+{
+ for(SdrPageWindowVector::const_iterator a = maPageWindows.begin(); a != maPageWindows.end(); a++)
+ {
+ if(&((*a)->GetPaintWindow()) == &rPaintWindow)
+ {
+ return *a;
+ }
+ }
+
+ return 0L;
+}
+
+const SdrPageWindow* SdrPageView::FindPatchedPageWindow( const OutputDevice& _rOutDev ) const
+{
+ for ( SdrPageWindowVector::const_iterator loop = maPageWindows.begin();
+ loop != maPageWindows.end();
+ ++loop
+ )
+ {
+ const SdrPageWindow& rPageWindow( *(*loop) );
+ const SdrPaintWindow& rPaintWindow( rPageWindow.GetOriginalPaintWindow() ? *rPageWindow.GetOriginalPaintWindow() : rPageWindow.GetPaintWindow() );
+ if ( &rPaintWindow.GetOutputDevice() == &_rOutDev )
+ {
+ return &rPageWindow;
+ }
+ }
+
+ return NULL;
+}
+
+SdrPageWindow* SdrPageView::FindPageWindow(const OutputDevice& rOutDev) const
+{
+ for(SdrPageWindowVector::const_iterator a = maPageWindows.begin(); a != maPageWindows.end(); a++)
+ {
+ if(&((*a)->GetPaintWindow().GetOutputDevice()) == &rOutDev)
+ {
+ return *a;
+ }
+ }
+
+ return 0L;
+}
+
+SdrPageWindow* SdrPageView::GetPageWindow(sal_uInt32 nIndex) const
+{
+ // #126416#
+ if(nIndex < maPageWindows.size())
+ {
+ return maPageWindows[nIndex];
+ }
+
+ return 0L;
+}
+
+void SdrPageView::ClearPageWindows()
+{
+ // #126416#
+ for(SdrPageWindowVector::const_iterator a = maPageWindows.begin(); a != maPageWindows.end(); a++)
+ {
+ delete *a;
+ }
+
+ maPageWindows.clear();
+}
+
+void SdrPageView::AppendPageWindow(SdrPageWindow& rNew)
+{
+ maPageWindows.push_back(&rNew);
+}
+
+SdrPageWindow* SdrPageView::RemovePageWindow(sal_uInt32 nPos)
+{
+ if(nPos < maPageWindows.size())
+ {
+ SdrPageWindowVector::iterator aAccess = maPageWindows.begin() + nPos;
+ // #114376# remember return value
+ SdrPageWindow* pErasedSdrPageWindow = *aAccess;
+ maPageWindows.erase(aAccess);
+ return pErasedSdrPageWindow;
+ }
+
+ return 0L;
+}
+
+SdrPageWindow* SdrPageView::RemovePageWindow(SdrPageWindow& rOld)
+{
+ const SdrPageWindowVector::iterator aFindResult = ::std::find(maPageWindows.begin(), maPageWindows.end(), &rOld);
+
+ if(aFindResult != maPageWindows.end())
+ {
+ // #114376# remember return value
+ SdrPageWindow* pSdrPageWindow = *aFindResult;
+ maPageWindows.erase(aFindResult);
+ return pSdrPageWindow;
+ }
+
+ return 0L;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SdrPageView::SdrPageView(SdrPage* pPage1, SdrView& rNewView)
+: mrView(rNewView),
+ // #103911# col_auto color lets the view takes the default SvxColorConfig entry
+ maDocumentColor( COL_AUTO ),
+ maBackgroundColor(COL_AUTO ), // #i48367# also react on autocolor
+ mpPreparedPageWindow(0) // #i72752#
+{
+ DBG_CTOR(SdrPageView,NULL);
+ mpPage = pPage1;
+
+ if(mpPage)
+ {
+ aPgOrg.X()=mpPage->GetLftBorder();
+ aPgOrg.Y()=mpPage->GetUppBorder();
+ }
+ mbHasMarked = sal_False;
+ aLayerVisi.SetAll();
+ aLayerPrn.SetAll();
+
+ mbVisible = sal_False;
+ pAktList = NULL;
+ pAktGroup = NULL;
+ SetAktGroupAndList(NULL, mpPage);
+
+ StartListening(*rNewView.GetModel());
+
+ for(sal_uInt32 a(0L); a < rNewView.PaintWindowCount(); a++)
+ {
+ AddPaintWindowToPageView(*rNewView.GetPaintWindow(a));
+ }
+}
+
+SdrPageView::~SdrPageView()
+{
+ DBG_DTOR(SdrPageView,NULL);
+
+ // cleanup window vector
+ ClearPageWindows();
+}
+
+SdrPageWindow& SdrPageView::CreateNewPageWindowEntry(SdrPaintWindow& rPaintWindow)
+{
+ // MIB 3.7.08: Das WinRec muss sofort in die Liste eingetragen werden,
+ // weil sich das InsertControlContainer darauf verlaesst
+ //SdrPageViewWinRec* pRec = new SdrPageViewWinRec( *this, pOut );
+ //pWinList->Insert(pRec);
+ SdrPageWindow& rWindow = *(new SdrPageWindow(*this, rPaintWindow));
+ AppendPageWindow(rWindow);
+
+ return rWindow;
+}
+
+void SdrPageView::AddPaintWindowToPageView(SdrPaintWindow& rPaintWindow)
+{
+ if(!FindPageWindow(rPaintWindow))
+ {
+ CreateNewPageWindowEntry(rPaintWindow);
+ }
+}
+
+void SdrPageView::RemovePaintWindowFromPageView(SdrPaintWindow& rPaintWindow)
+{
+ SdrPageWindow* pCandidate = FindPageWindow(rPaintWindow);
+
+ if(pCandidate)
+ {
+ pCandidate = RemovePageWindow(*pCandidate);
+
+ if(pCandidate)
+ {
+ delete pCandidate;
+ }
+ }
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > SdrPageView::GetControlContainer( const OutputDevice& _rDevice ) const
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > xReturn;
+ const SdrPageWindow* pCandidate = FindPatchedPageWindow( _rDevice );
+
+ if ( pCandidate )
+ xReturn = pCandidate->GetControlContainer( true );
+
+ return xReturn;
+}
+
+void __EXPORT SdrPageView::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& /*rHint*/)
+{
+ // not really interested in
+}
+
+void SdrPageView::ModelHasChanged()
+{
+ if (GetAktGroup()!=NULL) CheckAktGroup();
+}
+
+sal_Bool SdrPageView::IsReadOnly() const
+{
+ return (0L == GetPage() || GetView().GetModel()->IsReadOnly() || GetPage()->IsReadOnly() || GetObjList()->IsReadOnly());
+}
+
+void SdrPageView::Show()
+{
+ if(!IsVisible())
+ {
+ mbVisible = sal_True;
+ InvalidateAllWin();
+
+ for(sal_uInt32 a(0L); a < GetView().PaintWindowCount(); a++)
+ {
+ AddPaintWindowToPageView(*GetView().GetPaintWindow(a));
+ }
+ }
+}
+
+void SdrPageView::Hide()
+{
+ if(IsVisible())
+ {
+ InvalidateAllWin();
+ mbVisible = sal_False;
+ ClearPageWindows();
+ }
+}
+
+Rectangle SdrPageView::GetPageRect() const
+{
+ if (GetPage()==NULL) return Rectangle();
+ return Rectangle(Point(),Size(GetPage()->GetWdt()+1,GetPage()->GetHgt()+1));
+}
+
+void SdrPageView::InvalidateAllWin()
+{
+ if(IsVisible() && GetPage())
+ {
+ Rectangle aRect(Point(0,0),Size(GetPage()->GetWdt()+1,GetPage()->GetHgt()+1));
+ aRect.Union(GetPage()->GetAllObjBoundRect());
+ GetView().InvalidateAllWin(aRect);
+ }
+}
+
+void SdrPageView::InvalidateAllWin(const Rectangle& rRect, sal_Bool bPlus1Pix)
+{
+ if(IsVisible())
+ {
+ GetView().InvalidateAllWin(rRect, bPlus1Pix);
+ }
+}
+
+void SdrPageView::PaintOutlinerView(OutputDevice* pOut, const Rectangle& rRect) const
+{
+ if (GetView().pTextEditOutliner==NULL) return;
+ //const SdrObject* pTextObjTmp=GetView().GetTextEditObject();
+ //const SdrTextObj* pText=PTR_CAST(SdrTextObj,pTextObjTmp);
+ //FASTBOOL bTextFrame=pText!=NULL && pText->IsTextFrame();
+ sal_uIntPtr nViewAnz=GetView().pTextEditOutliner->GetViewCount();
+ for (sal_uIntPtr i=0; i<nViewAnz; i++) {
+ OutlinerView* pOLV=GetView().pTextEditOutliner->GetView(i);
+ if (pOLV->GetWindow()==pOut) {
+ GetView().ImpPaintOutlinerView(*pOLV, rRect);
+ return;
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrPageView::PrePaint()
+{
+ const sal_uInt32 nCount(PageWindowCount());
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ SdrPageWindow* pCandidate = GetPageWindow(a);
+
+ if(pCandidate)
+ {
+ pCandidate->PrePaint();
+ }
+ }
+}
+
+void SdrPageView::PostPaint()
+{
+ const sal_uInt32 nCount(PageWindowCount());
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ SdrPageWindow* pCandidate = GetPageWindow(a);
+
+ if(pCandidate)
+ {
+ pCandidate->PostPaint();
+ }
+ }
+}
+
+void SdrPageView::CompleteRedraw(SdrPaintWindow& rPaintWindow, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector) const
+{
+ if(GetPage())
+ {
+ SdrPageWindow* pPageWindow = FindPageWindow(rPaintWindow);
+ sal_Bool bIsTempTarget(sal_False);
+
+ if(!pPageWindow)
+ {
+ // create temp PageWindow
+ pPageWindow = new SdrPageWindow(*((SdrPageView*)this), rPaintWindow);
+ bIsTempTarget = sal_True;
+ }
+
+ // do the redraw
+ pPageWindow->PrepareRedraw(rReg);
+ pPageWindow->RedrawAll(pRedirector);
+
+ // get rid of temp PageWindow
+ if(bIsTempTarget)
+ {
+ delete pPageWindow;
+ pPageWindow = 0L;
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// #i74769# use SdrPaintWindow directly
+
+void SdrPageView::setPreparedPageWindow(SdrPageWindow* pKnownTarget)
+{
+ // #i72752# remember prepared SdrPageWindow
+ mpPreparedPageWindow = pKnownTarget;
+}
+
+void SdrPageView::DrawLayer(SdrLayerID nID, OutputDevice* pGivenTarget, sdr::contact::ViewObjectContactRedirector* pRedirector) const
+{
+ if(GetPage())
+ {
+ if(pGivenTarget)
+ {
+ const SdrPageWindow* pKnownTarget = FindPageWindow(*pGivenTarget);
+
+ if(pKnownTarget)
+ {
+ // paint known target
+ pKnownTarget->RedrawLayer(&nID, pRedirector);
+ }
+ else
+ {
+ // #i72752# DrawLayer() uses a OutputDevice different from BeginDrawLayer. This happens
+ // e.g. when SW paints a single text line in text edit mode. Try to use it
+ SdrPageWindow* pPreparedTarget = mpPreparedPageWindow;
+
+ if(pPreparedTarget)
+ {
+ // if we have a prepared target, do not use a new SdrPageWindow since this
+ // works but is expensive. Just use a temporary PaintWindow
+ SdrPaintWindow aTemporaryPaintWindow(mrView, *pGivenTarget);
+
+ // Copy existing paint region to use the same as prepared in BeginDrawLayer
+ SdrPaintWindow& rExistingPaintWindow = pPreparedTarget->GetPaintWindow();
+ const Region& rExistingRegion = rExistingPaintWindow.GetRedrawRegion();
+ aTemporaryPaintWindow.SetRedrawRegion(rExistingRegion);
+
+ // patch the ExistingPageWindow
+ pPreparedTarget->patchPaintWindow(aTemporaryPaintWindow);
+
+ // redraw the layer
+ pPreparedTarget->RedrawLayer(&nID, pRedirector);
+
+ // restore the ExistingPageWindow
+ pPreparedTarget->unpatchPaintWindow();
+ }
+ else
+ {
+ OSL_ENSURE(false, "SdrPageView::DrawLayer: Creating temporary SdrPageWindow (ObjectContact), this should never be needed (!)");
+
+ // None of the known OutputDevices is the target of this paint, use
+ // a temporary SdrPageWindow for this Redraw.
+ SdrPaintWindow aTemporaryPaintWindow(mrView, *pGivenTarget);
+ SdrPageWindow aTemporaryPageWindow(*((SdrPageView*)this), aTemporaryPaintWindow);
+
+ // #i72752#
+ // Copy existing paint region if other PageWindows exist, this was created by
+ // PrepareRedraw() from BeginDrawLayer(). Needs to be used e.g. when suddenly SW
+ // paints into an unknown device other than the view was created for (e.g. VirtualDevice)
+ if(PageWindowCount())
+ {
+ SdrPageWindow* pExistingPageWindow = GetPageWindow(0L);
+ SdrPaintWindow& rExistingPaintWindow = pExistingPageWindow->GetPaintWindow();
+ const Region& rExistingRegion = rExistingPaintWindow.GetRedrawRegion();
+ aTemporaryPaintWindow.SetRedrawRegion(rExistingRegion);
+ }
+
+ aTemporaryPageWindow.RedrawLayer(&nID, pRedirector);
+ }
+ }
+ }
+ else
+ {
+ // paint in all known windows
+ for(sal_uInt32 a(0L); a < PageWindowCount(); a++)
+ {
+ SdrPageWindow* pTarget = GetPageWindow(a);
+ pTarget->RedrawLayer(&nID, pRedirector);
+ }
+ }
+ }
+}
+
+void SdrPageView::SetDesignMode( bool _bDesignMode ) const
+{
+ for ( sal_uInt32 i = 0L; i < PageWindowCount(); ++i )
+ {
+ const SdrPageWindow& rPageViewWindow = *GetPageWindow(i);
+ rPageViewWindow.SetDesignMode( _bDesignMode );
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifdef OS2
+#define RGBCOLOR(r,g,b) ((sal_uIntPtr)(((sal_uInt8)(b) | ((sal_uInt16)(g)<<8)) | (((sal_uIntPtr)(sal_uInt8)(r))<<16)))
+#endif
+
+void SdrPageView::DrawPageViewGrid(OutputDevice& rOut, const Rectangle& rRect, Color aColor)
+{
+ if (GetPage()==NULL)
+ return;
+
+ long nx1=GetView().aGridBig.Width();
+ long nx2=GetView().aGridFin.Width();
+ long ny1=GetView().aGridBig.Height();
+ long ny2=GetView().aGridFin.Height();
+
+ if (nx1==0) nx1=nx2;
+ if (nx2==0) nx2=nx1;
+ if (ny1==0) ny1=ny2;
+ if (ny2==0) ny2=ny1;
+ if (nx1==0) { nx1=ny1; nx2=ny2; }
+ if (ny1==0) { ny1=nx1; ny2=nx2; }
+ if (nx1<0) nx1=-nx1;
+ if (nx2<0) nx2=-nx2;
+ if (ny1<0) ny1=-ny1;
+ if (ny2<0) ny2=-ny2;
+
+ if (nx1!=0)
+ {
+ // no more global output size, use window size instead to decide grid sizes
+ long nScreenWdt = rOut.GetOutputSizePixel().Width();
+ // old: long nScreenWdt=System::GetDesktopRectPixel().GetWidth();
+
+ // Grid bei kleinen Zoomstufen etwas erweitern
+ //Size a1PixSiz(rOut.PixelToLogic(Size(1,1)));
+ long nMinDotPix=2;
+ long nMinLinPix=4;
+
+ if (nScreenWdt>=1600)
+ {
+ nMinDotPix=4;
+ nMinLinPix=8;
+ }
+ else if (nScreenWdt>=1024)
+ {
+ nMinDotPix=3;
+ nMinLinPix=6;
+ }
+ else
+ { // z.B. 640x480
+ nMinDotPix=2;
+ nMinLinPix=4;
+ }
+ Size aMinDotDist(rOut.PixelToLogic(Size(nMinDotPix,nMinDotPix)));
+ //Size a3PixSiz(rOut.PixelToLogic(Size(2,2)));
+ Size aMinLinDist(rOut.PixelToLogic(Size(nMinLinPix,nMinLinPix)));
+ FASTBOOL bHoriSolid=nx2<aMinDotDist.Width();
+ FASTBOOL bVertSolid=ny2<aMinDotDist.Height();
+ // Linienabstand vergroessern (mind. 4 Pixel)
+ // Vergroesserung: *2 *5 *10 *20 *50 *100 ...
+ int nTgl=0;
+ long nVal0=nx1;
+ while (nx1<aMinLinDist.Width())
+ {
+ long a=nx1;
+
+ if (nTgl==0) nx1*=2;
+ if (nTgl==1) nx1=nVal0*5; // => nx1*=2.5
+ if (nTgl==2) nx1*=2;
+
+ nVal0=a;
+ nTgl++; if (nTgl>=3) nTgl=0;
+ }
+ nTgl=0;
+ nVal0=ny1;
+ while (ny1<aMinLinDist.Height())
+ {
+ long a=ny1;
+
+ if (nTgl==0) ny1*=2;
+ if (nTgl==1) ny1=nVal0*5; // => ny1*=2.5
+ if (nTgl==2) ny1*=2;
+
+ nVal0=a;
+ nTgl++;
+
+ if (nTgl>=3) nTgl=0;
+ }
+ // Keine Zwischenpunkte, wenn...
+ //if (nx2<a2PixSiz.Width()) nx2=nx1;
+ //if (ny2<a2PixSiz.Height()) ny2=ny1;
+
+ FASTBOOL bHoriFine=nx2<nx1;
+ FASTBOOL bVertFine=ny2<ny1;
+ FASTBOOL bHoriLines=bHoriSolid || bHoriFine || !bVertFine;
+ FASTBOOL bVertLines=bVertSolid || bVertFine;
+
+ Color aColorMerk( rOut.GetLineColor() );
+ rOut.SetLineColor( aColor );
+
+ bool bMap0=rOut.IsMapModeEnabled();
+
+ long nWrX=0;//aWriterPageOffset.X();
+ long nWrY=0;//aWriterPageOffset.Y();
+ Point aOrg(aPgOrg);
+ long x1=GetPage()->GetLftBorder()+1+nWrX;
+ long x2=GetPage()->GetWdt()-GetPage()->GetRgtBorder()-1+nWrY;
+ long y1=GetPage()->GetUppBorder()+1+nWrX;
+ long y2=GetPage()->GetHgt()-GetPage()->GetLwrBorder()-1+nWrY;
+ const SdrPageGridFrameList* pFrames=GetPage()->GetGridFrameList(this,NULL);
+ //sal_uInt16 nBufSiz=1024; // 4k Buffer = max. 512 Punkte
+ // #90353# long* pBuf = NULL;
+ sal_uInt16 nGridPaintAnz=1;
+ if (pFrames!=NULL) nGridPaintAnz=pFrames->GetCount();
+ for (sal_uInt16 nGridPaintNum=0; nGridPaintNum<nGridPaintAnz; nGridPaintNum++) {
+ if (pFrames!=NULL) {
+ const SdrPageGridFrame& rGF=(*pFrames)[nGridPaintNum];
+ nWrX=rGF.GetPaperRect().Left();
+ nWrY=rGF.GetPaperRect().Top();
+ x1=rGF.GetUserArea().Left();
+ x2=rGF.GetUserArea().Right();
+ y1=rGF.GetUserArea().Top();
+ y2=rGF.GetUserArea().Bottom();
+ aOrg=rGF.GetUserArea().TopLeft();
+ aOrg-=rGF.GetPaperRect().TopLeft();
+ }
+ if (!rRect.IsEmpty()) {
+ Size a1PixSiz(rOut.PixelToLogic(Size(1,1)));
+ long nX1Pix=a1PixSiz.Width(); // 1 Pixel Toleranz drauf
+ long nY1Pix=a1PixSiz.Height();
+ if (x1<rRect.Left() -nX1Pix) x1=rRect.Left() -nX1Pix;
+ if (x2>rRect.Right() +nX1Pix) x2=rRect.Right() +nX1Pix;
+ if (y1<rRect.Top() -nY1Pix) y1=rRect.Top() -nY1Pix;
+ if (y2>rRect.Bottom()+nY1Pix) y2=rRect.Bottom()+nY1Pix;
+ }
+ Point aPnt;
+
+ long xBigOrg=aOrg.X()+nWrX;
+ while (xBigOrg>=x1) xBigOrg-=nx1;
+ while (xBigOrg<x1) xBigOrg+=nx1;
+ long xFinOrg=xBigOrg;
+ while (xFinOrg>=x1) xFinOrg-=nx2;
+ while (xFinOrg<x1) xFinOrg+=nx2;
+
+ long yBigOrg=aOrg.Y()+nWrY;
+ while (yBigOrg>=y1) yBigOrg-=ny1;
+ while (yBigOrg<y1) yBigOrg+=ny1;
+ long yFinOrg=yBigOrg;
+ while (yFinOrg>=y1) yFinOrg-=ny2;
+ while (yFinOrg<y1) yFinOrg+=ny2;
+
+ if( x1 <= x2 && y1 <= y2 )
+ {
+ if( bHoriLines )
+ {
+ sal_uIntPtr nGridFlags = ( bHoriSolid ? GRID_HORZLINES : GRID_DOTS );
+ sal_uInt16 nSteps = sal_uInt16(nx1 / nx2);
+ sal_uInt32 nRestPerStepMul1000 = nSteps ? ( ((nx1 * 1000L)/ nSteps) - (nx2 * 1000L) ) : 0;
+ sal_uInt32 nStepOffset = 0;
+ sal_uInt16 nPointOffset = 0;
+
+ for(sal_uInt16 a=0;a<nSteps;a++)
+ {
+ // Zeichnen
+ rOut.DrawGrid(
+ Rectangle( xFinOrg + (a * nx2) + nPointOffset, yBigOrg, x2, y2 ),
+ Size( nx1, ny1 ), nGridFlags );
+
+ // Schritt machen
+ nStepOffset += nRestPerStepMul1000;
+ while(nStepOffset >= 1000)
+ {
+ nStepOffset -= 1000;
+ nPointOffset++;
+ }
+ }
+ }
+
+ if( bVertLines )
+ {
+ sal_uIntPtr nGridFlags = ( bVertSolid ? GRID_VERTLINES : GRID_DOTS );
+ sal_uInt16 nSteps = sal_uInt16(ny1 / ny2);
+ sal_uInt32 nRestPerStepMul1000 = nSteps ? ( ((ny1 * 1000L)/ nSteps) - (ny2 * 1000L) ) : 0;
+ sal_uInt32 nStepOffset = 0;
+ sal_uInt16 nPointOffset = 0;
+
+ for(sal_uInt16 a=0;a<nSteps;a++)
+ {
+ // Zeichnen
+ rOut.DrawGrid(
+ Rectangle( xBigOrg, yFinOrg + (a * ny2) + nPointOffset, x2, y2 ),
+ Size( nx1, ny1 ), nGridFlags );
+
+ // Schritt machen
+ nStepOffset += nRestPerStepMul1000;
+ while(nStepOffset >= 1000)
+ {
+ nStepOffset -= 1000;
+ nPointOffset++;
+ }
+ }
+
+ // rOut.DrawGrid( Rectangle( xo + xBigOrg, yo + yFinOrg, x2, y2 ), Size( nx1, ny2 ), nGridFlags );
+ }
+ }
+ }
+
+ rOut.EnableMapMode(bMap0);
+ rOut.SetLineColor(aColorMerk);
+ }
+}
+
+void SdrPageView::AdjHdl()
+{
+ GetView().AdjustMarkHdl();
+}
+
+void SdrPageView::SetLayer(const XubString& rName, SetOfByte& rBS, sal_Bool bJa)
+{
+ if(!GetPage())
+ return;
+
+ SdrLayerID nID = GetPage()->GetLayerAdmin().GetLayerID(rName, sal_True);
+
+ if(SDRLAYER_NOTFOUND != nID)
+ rBS.Set(nID, bJa);
+}
+
+sal_Bool SdrPageView::IsLayer(const XubString& rName, const SetOfByte& rBS) const
+{
+ if(!GetPage())
+ return sal_False;
+
+ sal_Bool bRet(sal_False);
+
+ if(rName.Len())
+ {
+ SdrLayerID nId = GetPage()->GetLayerAdmin().GetLayerID(rName, sal_True);
+
+ if(SDRLAYER_NOTFOUND != nId)
+ {
+ bRet = rBS.IsSet(nId);
+ }
+ }
+
+ return bRet;
+}
+
+void SdrPageView::SetAllLayers(SetOfByte& rB, sal_Bool bJa)
+{
+ if(bJa)
+ {
+ rB.SetAll();
+ rB.Clear(SDRLAYER_NOTFOUND);
+ }
+ else
+ {
+ rB.ClearAll();
+ }
+}
+
+sal_Bool SdrPageView::IsObjMarkable(SdrObject* pObj) const
+{
+ if(pObj)
+ {
+ // Vom Markieren ausgeschlossen?
+ if(pObj->IsMarkProtect())
+ {
+ return sal_False;
+ }
+
+ // only visible are markable
+ if( !pObj->IsVisible() )
+ {
+ return sal_False;
+ }
+
+ // #112440#
+ if(pObj->ISA(SdrObjGroup))
+ {
+ // If object is a Group object, visibility depends evtl. on
+ // multiple layers. If one object is markable, Group is markable.
+ SdrObjList* pObjList = ((SdrObjGroup*)pObj)->GetSubList();
+
+ if(pObjList && pObjList->GetObjCount())
+ {
+ sal_Bool bGroupIsMarkable(sal_False);
+
+ for(sal_uInt32 a(0L); !bGroupIsMarkable && a < pObjList->GetObjCount(); a++)
+ {
+ SdrObject* pCandidate = pObjList->GetObj(a);
+
+ // call recursively
+ if(IsObjMarkable(pCandidate))
+ {
+ bGroupIsMarkable = sal_True;
+ }
+ }
+
+ return bGroupIsMarkable;
+ }
+ else
+ {
+ // #i43302#
+ // Allow empty groups to be selected to be able to delete them
+ return sal_True;
+ }
+ }
+ else
+ {
+ // Der Layer muss sichtbar und darf nicht gesperrt sein
+ SdrLayerID nL = pObj->GetLayer();
+ return (aLayerVisi.IsSet(sal_uInt8(nL)) && !aLayerLock.IsSet(sal_uInt8(nL)));
+ }
+ }
+
+ return sal_False;
+}
+
+void SdrPageView::SetPageOrigin(const Point& rOrg)
+{
+ if (rOrg!=aPgOrg) {
+ aPgOrg=rOrg;
+ if (GetView().IsGridVisible()) {
+ InvalidateAllWin();
+ }
+ }
+}
+
+void SdrPageView::ImpInvalidateHelpLineArea(sal_uInt16 nNum) const
+{
+ if (GetView().IsHlplVisible() && nNum<aHelpLines.GetCount()) {
+ const SdrHelpLine& rHL=aHelpLines[nNum];
+
+ for(sal_uInt32 a(0L); a < GetView().PaintWindowCount(); a++)
+ {
+ SdrPaintWindow* pCandidate = GetView().GetPaintWindow(a);
+
+ if(pCandidate->OutputToWindow())
+ {
+ OutputDevice& rOutDev = pCandidate->GetOutputDevice();
+ Rectangle aR(rHL.GetBoundRect(rOutDev));
+ Size aSiz(rOutDev.PixelToLogic(Size(1,1)));
+ aR.Left() -= aSiz.Width();
+ aR.Right() += aSiz.Width();
+ aR.Top() -= aSiz.Height();
+ aR.Bottom() += aSiz.Height();
+ ((SdrView&)GetView()).InvalidateOneWin((Window&)rOutDev, aR);
+ }
+ }
+ }
+}
+
+void SdrPageView::SetHelpLines(const SdrHelpLineList& rHLL)
+{
+ aHelpLines=rHLL;
+ InvalidateAllWin();
+}
+
+void SdrPageView::SetHelpLine(sal_uInt16 nNum, const SdrHelpLine& rNewHelpLine)
+{
+ if (nNum<aHelpLines.GetCount() && aHelpLines[nNum]!=rNewHelpLine) {
+ FASTBOOL bNeedRedraw=sal_True;
+ if (aHelpLines[nNum].GetKind()==rNewHelpLine.GetKind()) {
+ switch (rNewHelpLine.GetKind()) {
+ case SDRHELPLINE_VERTICAL : if (aHelpLines[nNum].GetPos().X()==rNewHelpLine.GetPos().X()) bNeedRedraw=sal_False; break;
+ case SDRHELPLINE_HORIZONTAL: if (aHelpLines[nNum].GetPos().Y()==rNewHelpLine.GetPos().Y()) bNeedRedraw=sal_False; break;
+ default: break;
+ } // switch
+ }
+ if (bNeedRedraw) ImpInvalidateHelpLineArea(nNum);
+ aHelpLines[nNum]=rNewHelpLine;
+ if (bNeedRedraw) ImpInvalidateHelpLineArea(nNum);
+ }
+}
+
+void SdrPageView::DeleteHelpLine(sal_uInt16 nNum)
+{
+ if (nNum<aHelpLines.GetCount()) {
+ ImpInvalidateHelpLineArea(nNum);
+ aHelpLines.Delete(nNum);
+ }
+}
+
+void SdrPageView::InsertHelpLine(const SdrHelpLine& rHL, sal_uInt16 nNum)
+{
+ if (nNum>aHelpLines.GetCount()) nNum=aHelpLines.GetCount();
+ aHelpLines.Insert(rHL,nNum);
+ if (GetView().IsHlplVisible()) {
+ if (GetView().IsHlplFront()) {
+ // Hier optimieren ...
+ ImpInvalidateHelpLineArea(nNum);
+ } else {
+ ImpInvalidateHelpLineArea(nNum);
+ }
+ }
+}
+
+// Betretene Gruppe und Liste setzen
+void SdrPageView::SetAktGroupAndList(SdrObject* pNewGroup, SdrObjList* pNewList)
+{
+ if(pAktGroup != pNewGroup)
+ {
+ pAktGroup = pNewGroup;
+ }
+ if(pAktList != pNewList)
+ {
+ pAktList = pNewList;
+ }
+}
+
+sal_Bool SdrPageView::EnterGroup(SdrObject* pObj)
+{
+ sal_Bool bRet(sal_False);
+
+ if(pObj && pObj->IsGroupObject())
+ {
+ sal_Bool bGlueInvalidate(GetView().ImpIsGlueVisible());
+
+ if(bGlueInvalidate)
+ {
+ GetView().GlueInvalidate();
+ }
+
+ // deselect all
+ GetView().UnmarkAll();
+
+ // set current group and list
+ SdrObjList* pNewObjList = pObj->GetSubList();
+ SetAktGroupAndList(pObj, pNewObjList);
+
+ // select contained object if only one object is contained,
+ // else select nothing and let the user decide what to do next
+ if(pNewObjList && pNewObjList->GetObjCount() == 1)
+ {
+ SdrObject* pFirstObject = pNewObjList->GetObj(0L);
+
+ if(GetView().GetSdrPageView())
+ {
+ GetView().MarkObj(pFirstObject, GetView().GetSdrPageView());
+ }
+ }
+
+ // build new handles
+ GetView().AdjustMarkHdl();
+
+ // invalidate only when view wants to visualize group entering
+ if(GetView().DoVisualizeEnteredGroup())
+ {
+ InvalidateAllWin();
+ }
+
+ if (bGlueInvalidate)
+ {
+ GetView().GlueInvalidate();
+ }
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+void SdrPageView::LeaveOneGroup()
+{
+ if(GetAktGroup())
+ {
+ sal_Bool bGlueInvalidate = (GetView().ImpIsGlueVisible());
+
+ if(bGlueInvalidate)
+ GetView().GlueInvalidate();
+
+ SdrObject* pLastGroup = GetAktGroup();
+ SdrObject* pParentGroup = GetAktGroup()->GetUpGroup();
+ SdrObjList* pParentList = GetPage();
+
+ if(pParentGroup)
+ pParentList = pParentGroup->GetSubList();
+
+ // Alles deselektieren
+ GetView().UnmarkAll();
+
+ // Zuweisungen, pAktGroup und pAktList muessen gesetzt sein
+ SetAktGroupAndList(pParentGroup, pParentList);
+
+ // gerade verlassene Gruppe selektieren
+ if(pLastGroup)
+ if(GetView().GetSdrPageView())
+ GetView().MarkObj(pLastGroup, GetView().GetSdrPageView());
+
+ GetView().AdjustMarkHdl();
+
+ // invalidate only when view wants to visualize group entering
+ if(GetView().DoVisualizeEnteredGroup())
+ InvalidateAllWin();
+
+ if(bGlueInvalidate)
+ GetView().GlueInvalidate();
+ }
+}
+
+void SdrPageView::LeaveAllGroup()
+{
+ if(GetAktGroup())
+ {
+ sal_Bool bGlueInvalidate = (GetView().ImpIsGlueVisible());
+
+ if(bGlueInvalidate)
+ GetView().GlueInvalidate();
+
+ SdrObject* pLastGroup = GetAktGroup();
+
+ // Alles deselektieren
+ GetView().UnmarkAll();
+
+ // Zuweisungen, pAktGroup und pAktList muessen gesetzt sein
+ SetAktGroupAndList(NULL, GetPage());
+
+ // Oberste letzte Gruppe finden und selektieren
+ if(pLastGroup)
+ {
+ while(pLastGroup->GetUpGroup())
+ pLastGroup = pLastGroup->GetUpGroup();
+
+ if(GetView().GetSdrPageView())
+ GetView().MarkObj(pLastGroup, GetView().GetSdrPageView());
+ }
+
+ GetView().AdjustMarkHdl();
+
+ // invalidate only when view wants to visualize group entering
+ if(GetView().DoVisualizeEnteredGroup())
+ InvalidateAllWin();
+
+ if(bGlueInvalidate)
+ GetView().GlueInvalidate();
+ }
+}
+
+sal_uInt16 SdrPageView::GetEnteredLevel() const
+{
+ sal_uInt16 nAnz=0;
+ SdrObject* pGrp=GetAktGroup();
+ while (pGrp!=NULL) {
+ nAnz++;
+ pGrp=pGrp->GetUpGroup();
+ }
+ return nAnz;
+}
+
+XubString SdrPageView::GetActualGroupName() const
+{
+ if(GetAktGroup())
+ {
+ XubString aStr(GetAktGroup()->GetName());
+
+ if(!aStr.Len())
+ aStr += sal_Unicode('?');
+
+ return aStr;
+ }
+ else
+ return String();
+}
+
+XubString SdrPageView::GetActualPathName(sal_Unicode cSep) const
+{
+ XubString aStr;
+ sal_Bool bNamFnd(sal_False);
+ SdrObject* pGrp = GetAktGroup();
+
+ while(pGrp)
+ {
+ XubString aStr1(pGrp->GetName());
+
+ if(!aStr1.Len())
+ aStr1 += sal_Unicode('?');
+ else
+ bNamFnd = sal_True;
+
+ aStr += aStr1;
+ pGrp = pGrp->GetUpGroup();
+
+ if(pGrp)
+ aStr += cSep;
+ }
+
+ if(!bNamFnd && GetAktGroup())
+ {
+ aStr = String();
+ aStr += sal_Unicode('(');
+ aStr += String::CreateFromInt32( GetEnteredLevel() );
+ aStr += sal_Unicode(')');
+ }
+
+ return aStr;
+}
+
+void SdrPageView::CheckAktGroup()
+{
+ SdrObject* pGrp=GetAktGroup();
+ while (pGrp!=NULL &&
+ (!pGrp->IsInserted() || pGrp->GetObjList()==NULL ||
+ pGrp->GetPage()==NULL || pGrp->GetModel()==NULL)) { // irgendwas daneben?
+ pGrp=pGrp->GetUpGroup();
+ }
+ if (pGrp!=GetAktGroup()) {
+ if (pGrp!=NULL) EnterGroup(pGrp);
+ else LeaveAllGroup();
+ }
+}
+
+// #103834# Set background color for svx at SdrPageViews
+void SdrPageView::SetApplicationBackgroundColor(Color aBackgroundColor)
+{
+ maBackgroundColor = aBackgroundColor;
+}
+
+// #109585#
+Color SdrPageView::GetApplicationBackgroundColor() const
+{
+ return maBackgroundColor;
+}
+
+// #103911# Set document color for svx at SdrPageViews
+void SdrPageView::SetApplicationDocumentColor(Color aDocumentColor)
+{
+ maDocumentColor = aDocumentColor;
+}
+
+Color SdrPageView::GetApplicationDocumentColor() const
+{
+ return maDocumentColor;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx
new file mode 100644
index 000000000000..aaa83ed5f1fe
--- /dev/null
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -0,0 +1,1548 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <com/sun/star/awt/XWindow.hpp>
+#include <svx/svdpntv.hxx>
+#include <vcl/msgbox.hxx>
+#include <svx/sdrpaintwindow.hxx>
+#include <svtools/grfmgr.hxx>
+#include <svx/svdmodel.hxx>
+
+#ifdef DBG_UTIL
+#include <svdibrow.hxx>
+#endif
+#include <svx/svdpage.hxx>
+#include <svx/svdpagv.hxx>
+#include <svl/smplhint.hxx>
+
+#include <svx/svdpntv.hxx>
+#include <editeng/editdata.hxx>
+#include <svx/svdmrkv.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdundo.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdglue.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdattrx.hxx>
+#include "svdibrow.hxx"
+#include "svx/svditer.hxx"
+#include <svx/svdouno.hxx>
+#include <svx/sdr/overlay/overlayobjectlist.hxx>
+#include <svx/sdr/overlay/overlayrollingrectangle.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <svx/svdglue.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdview.hxx>
+#include <svx/sxlayitm.hxx>
+#include <svl/itemiter.hxx>
+#include <editeng/eeitem.hxx>
+#include <svl/whiter.hxx>
+#include <svl/style.hxx>
+#include <svx/sdrpagewindow.hxx>
+#include <svx/svdouno.hxx>
+#include <vcl/svapp.hxx>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+
+// #i38135#
+#include <svx/sdr/contact/objectcontact.hxx>
+#include <svx/sdr/animation/objectanimator.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// #114409#-3 Migrate Encirclement
+class ImplEncirclementOverlay
+{
+ // The OverlayObjects
+ ::sdr::overlay::OverlayObjectList maObjects;
+
+ // The remembered second position in logical coodinates
+ basegfx::B2DPoint maSecondPosition;
+
+public:
+ ImplEncirclementOverlay(const SdrPaintView& rView, const basegfx::B2DPoint& rStartPos);
+ ~ImplEncirclementOverlay();
+
+ void SetSecondPosition(const basegfx::B2DPoint& rNewPosition);
+};
+
+ImplEncirclementOverlay::ImplEncirclementOverlay(const SdrPaintView& rView, const basegfx::B2DPoint& rStartPos)
+: maSecondPosition(rStartPos)
+{
+ for(sal_uInt32 a(0L); a < rView.PaintWindowCount(); a++)
+ {
+ SdrPaintWindow* pCandidate = rView.GetPaintWindow(a);
+ ::sdr::overlay::OverlayManager* pTargetOverlay = pCandidate->GetOverlayManager();
+
+ if(pTargetOverlay)
+ {
+ ::sdr::overlay::OverlayRollingRectangleStriped* aNew = new ::sdr::overlay::OverlayRollingRectangleStriped(
+ rStartPos, rStartPos, false);
+ pTargetOverlay->add(*aNew);
+ maObjects.append(*aNew);
+ }
+ }
+}
+
+ImplEncirclementOverlay::~ImplEncirclementOverlay()
+{
+ // The OverlayObjects are cleared using the destructor of OverlayObjectList.
+ // That destructor calls clear() at the list which removes all objects from the
+ // OverlayManager and deletes them.
+}
+
+void ImplEncirclementOverlay::SetSecondPosition(const basegfx::B2DPoint& rNewPosition)
+{
+ if(rNewPosition != maSecondPosition)
+ {
+ // apply to OverlayObjects
+ for(sal_uInt32 a(0L); a < maObjects.count(); a++)
+ {
+ ::sdr::overlay::OverlayRollingRectangleStriped& rCandidate = (::sdr::overlay::OverlayRollingRectangleStriped&)maObjects.getOverlayObject(a);
+ rCandidate.setSecondPosition(rNewPosition);
+ }
+
+ // remember new position
+ maSecondPosition = rNewPosition;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// interface to SdrPaintWindow
+
+SdrPaintWindow* SdrPaintView::FindPaintWindow(const OutputDevice& rOut) const
+{
+ for(SdrPaintWindowVector::const_iterator a = maPaintWindows.begin(); a != maPaintWindows.end(); a++)
+ {
+ if(&((*a)->GetOutputDevice()) == &rOut)
+ {
+ return *a;
+ }
+ }
+
+ return 0L;
+}
+
+SdrPaintWindow* SdrPaintView::GetPaintWindow(sal_uInt32 nIndex) const
+{
+ if(nIndex < maPaintWindows.size())
+ {
+ return maPaintWindows[nIndex];
+ }
+
+ return 0L;
+}
+
+void SdrPaintView::AppendPaintWindow(SdrPaintWindow& rNew)
+{
+ maPaintWindows.push_back(&rNew);
+}
+
+SdrPaintWindow* SdrPaintView::RemovePaintWindow(SdrPaintWindow& rOld)
+{
+ SdrPaintWindow* pRetval = 0L;
+ const SdrPaintWindowVector::iterator aFindResult = ::std::find(maPaintWindows.begin(), maPaintWindows.end(), &rOld);
+
+ if(aFindResult != maPaintWindows.end())
+ {
+ // remember return value, aFindResult is no longer valid after deletion
+ pRetval = *aFindResult;
+ maPaintWindows.erase(aFindResult);
+ }
+
+ return pRetval;
+}
+
+OutputDevice* SdrPaintView::GetFirstOutputDevice() const
+{
+ if(PaintWindowCount())
+ {
+ return &(GetPaintWindow(0)->GetOutputDevice());
+ }
+
+ return 0L;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( SvxViewHint, SfxHint );
+
+SvxViewHint::SvxViewHint (HintType eHintType)
+ : meHintType(eHintType)
+{
+}
+
+SvxViewHint::HintType SvxViewHint::GetHintType (void) const
+{
+ return meHintType;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT2(SdrPaintView,SfxListener,SfxRepeatTarget);
+
+DBG_NAME(SdrPaintView);
+
+void SdrPaintView::ImpClearVars()
+{
+#ifdef DBG_UTIL
+ pItemBrowser=NULL;
+#endif
+ bPageVisible=sal_True;
+ bPageBorderVisible=sal_True;
+ bBordVisible=sal_True;
+ bGridVisible=sal_True;
+ bGridFront =sal_False;
+ bHlplVisible=sal_True;
+ bHlplFront =sal_True;
+ bGlueVisible=sal_False;
+ bGlueVisible2=sal_False;
+ bGlueVisible3=sal_False;
+ bGlueVisible4=sal_False;
+ bSwapAsynchron=sal_False;
+ bPrintPreview=sal_False;
+ mbPreviewRenderer=sal_False;
+
+ eAnimationMode = SDR_ANIMATION_ANIMATE;
+ bAnimationPause = sal_False;
+
+ nHitTolPix=2;
+ nMinMovPix=3;
+ nHitTolLog=0;
+ nMinMovLog=0;
+ pActualOutDev=NULL;
+ pDragWin=NULL;
+ bRestoreColors=sal_True;
+ pDefaultStyleSheet=NULL;
+ bSomeObjChgdFlag=sal_False;
+ nGraphicManagerDrawMode = GRFMGR_DRAW_STANDARD;
+ aComeBackTimer.SetTimeout(1);
+ aComeBackTimer.SetTimeoutHdl(LINK(this,SdrPaintView,ImpComeBackHdl));
+ String aNam; // System::GetUserName() just return an empty string
+
+ if (pMod)
+ SetDefaultStyleSheet(pMod->GetDefaultStyleSheet(), sal_True);
+
+ aNam.ToUpperAscii();
+
+ maGridColor = Color( COL_BLACK );
+ BrkEncirclement();
+}
+
+SdrPaintView::SdrPaintView(SdrModel* pModel1, OutputDevice* pOut)
+: mpEncirclementOverlay(0L),
+ mpPageView(0L),
+ aDefaultAttr(pModel1->GetItemPool()),
+ mbBufferedOutputAllowed(false),
+ mbBufferedOverlayAllowed(false),
+ mbPagePaintingAllowed(true),
+ mbHideOle(false),
+ mbHideChart(false),
+ mbHideDraw(false),
+ mbHideFormControl(false)
+{
+ DBG_CTOR(SdrPaintView,NULL);
+ pMod=pModel1;
+ ImpClearVars();
+
+ if(pOut)
+ {
+ AddWindowToPaintView(pOut);
+ }
+
+ // Flag zur Visualisierung von Gruppen
+ bVisualizeEnteredGroup = sal_True;
+
+ maColorConfig.AddListener(this);
+ onChangeColorConfig();
+}
+
+SdrPaintView::~SdrPaintView()
+{
+ DBG_DTOR(SdrPaintView,NULL);
+ if (pDefaultStyleSheet)
+ EndListening(*pDefaultStyleSheet);
+
+ maColorConfig.RemoveListener(this);
+ ClearPageView();
+
+#ifdef DBG_UTIL
+ if(pItemBrowser)
+ {
+ delete pItemBrowser;
+ }
+#endif
+
+ // delete existing SdrPaintWindows
+ while(maPaintWindows.size())
+ {
+ delete maPaintWindows.back();
+ maPaintWindows.pop_back();
+ }
+
+ // #114409#-3 Migrate HelpLine
+ BrkEncirclement();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void __EXPORT SdrPaintView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
+{
+ //If the stylesheet has been destroyed
+ if (&rBC == pDefaultStyleSheet)
+ {
+ if (rHint.ISA(SfxSimpleHint) && ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING)
+ pDefaultStyleSheet = NULL;
+ return;
+ }
+
+ sal_Bool bObjChg=!bSomeObjChgdFlag; // sal_True= auswerten fuer ComeBack-Timer
+ if (bObjChg) {
+ SdrHint* pSdrHint=PTR_CAST(SdrHint,&rHint);
+ if (pSdrHint!=NULL) {
+ SdrHintKind eKind=pSdrHint->GetKind();
+ if (eKind==HINT_OBJCHG || eKind==HINT_OBJINSERTED || eKind==HINT_OBJREMOVED) {
+ if (bObjChg) {
+ bSomeObjChgdFlag=sal_True;
+ aComeBackTimer.Start();
+ }
+ }
+ if (eKind==HINT_PAGEORDERCHG) {
+ const SdrPage* pPg=pSdrHint->GetPage();
+
+ if(pPg && !pPg->IsInserted())
+ {
+ if(mpPageView && mpPageView->GetPage() == pPg)
+ {
+ HideSdrPage();
+ }
+ }
+ }
+ }
+ }
+}
+
+void SdrPaintView::ConfigurationChanged( ::utl::ConfigurationBroadcaster* , sal_uInt32 )
+{
+ onChangeColorConfig();
+ InvalidateAllWin();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+IMPL_LINK_INLINE_START(SdrPaintView,ImpComeBackHdl,Timer*,EMPTYARG)
+{
+ if (bSomeObjChgdFlag) {
+ bSomeObjChgdFlag=sal_False;
+ ModelHasChanged();
+ }
+ return 0;
+}
+IMPL_LINK_INLINE_END(SdrPaintView,ImpComeBackHdl,Timer*,pTimer)
+
+void SdrPaintView::FlushComeBackTimer() const
+{
+ if (bSomeObjChgdFlag) {
+ // casting auf nonconst
+ ((SdrPaintView*)this)->ImpComeBackHdl(&((SdrPaintView*)this)->aComeBackTimer);
+ ((SdrPaintView*)this)->aComeBackTimer.Stop();
+ }
+}
+
+void SdrPaintView::ModelHasChanged()
+{
+ // Auch alle PageViews benachrichtigen
+ if(mpPageView && !mpPageView->GetPage()->IsInserted())
+ {
+ HideSdrPage();
+ }
+
+ // test mpPageView here again, HideSdrPage() may have invalidated it.
+ if(mpPageView)
+ {
+ mpPageView->ModelHasChanged();
+ }
+
+#ifdef DBG_UTIL
+ if(pItemBrowser)
+ {
+ pItemBrowser->SetDirty();
+ }
+#endif
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_Bool SdrPaintView::IsAction() const
+{
+ return IsEncirclement();
+}
+
+void SdrPaintView::MovAction(const Point& rPnt)
+{
+ if (IsEncirclement())
+ {
+ MovEncirclement(rPnt);
+ }
+}
+
+void SdrPaintView::EndAction()
+{
+ if(IsEncirclement())
+ {
+ EndEncirclement();
+ }
+}
+
+void SdrPaintView::BckAction()
+{
+ BrkEncirclement();
+}
+
+void SdrPaintView::BrkAction()
+{
+ BrkEncirclement();
+}
+
+void SdrPaintView::TakeActionRect(Rectangle& rRect) const
+{
+ if(IsEncirclement())
+ {
+ rRect = Rectangle(aDragStat.GetStart(),aDragStat.GetNow());
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// info about TextEdit. Default is sal_False.
+bool SdrPaintView::IsTextEdit() const
+{
+ return false;
+}
+
+// info about TextEditPageView. Default is 0L.
+SdrPageView* SdrPaintView::GetTextEditPageView() const
+{
+ return 0L;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_uInt16 SdrPaintView::ImpGetMinMovLogic(short nMinMov, const OutputDevice* pOut) const
+{
+ if (nMinMov>=0) return sal_uInt16(nMinMov);
+ if (pOut==NULL)
+ {
+ pOut = GetFirstOutputDevice();
+ }
+ if (pOut!=NULL) {
+ return short(-pOut->PixelToLogic(Size(nMinMov,0)).Width());
+ } else {
+ return 0;
+ }
+}
+
+sal_uInt16 SdrPaintView::ImpGetHitTolLogic(short nHitTol, const OutputDevice* pOut) const
+{
+ if (nHitTol>=0) return sal_uInt16(nHitTol);
+ if (pOut==NULL)
+ {
+ pOut = GetFirstOutputDevice();
+ }
+ if (pOut!=NULL) {
+ return short(-pOut->PixelToLogic(Size(nHitTol,0)).Width());
+ } else {
+ return 0;
+ }
+}
+
+void SdrPaintView::TheresNewMapMode()
+{
+ if (pActualOutDev!=NULL) {
+ nHitTolLog=(sal_uInt16)((OutputDevice*)pActualOutDev)->PixelToLogic(Size(nHitTolPix,0)).Width();
+ nMinMovLog=(sal_uInt16)((OutputDevice*)pActualOutDev)->PixelToLogic(Size(nMinMovPix,0)).Width();
+ }
+}
+
+void SdrPaintView::SetActualWin(const OutputDevice* pWin)
+{
+ pActualOutDev=pWin;
+ TheresNewMapMode();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrPaintView::BegEncirclement(const Point& rPnt)
+{
+ BrkAction();
+
+ DBG_ASSERT(0L == mpEncirclementOverlay, "SdrSnapView::BegSetPageOrg: There exists a ImplPageOriginOverlay (!)");
+ basegfx::B2DPoint aStartPos(rPnt.X(), rPnt.Y());
+ mpEncirclementOverlay = new ImplEncirclementOverlay(*this, aStartPos);
+
+ aDragStat.Reset(rPnt);
+ aDragStat.SetMinMove(ImpGetMinMovLogic(-2,0L));
+ aDragStat.NextPoint();
+}
+
+void SdrPaintView::MovEncirclement(const Point& rPnt)
+{
+ if(IsEncirclement() && aDragStat.CheckMinMoved(rPnt))
+ {
+ aDragStat.NextMove(rPnt);
+
+ DBG_ASSERT(mpEncirclementOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
+ basegfx::B2DPoint aNewPos(rPnt.X(), rPnt.Y());
+ mpEncirclementOverlay->SetSecondPosition(aNewPos);
+ }
+}
+
+Rectangle SdrPaintView::EndEncirclement(sal_Bool bNoJustify)
+{
+ Rectangle aRetval;
+
+ if(IsEncirclement())
+ {
+ if(aDragStat.IsMinMoved())
+ {
+ aRetval = Rectangle(aDragStat.GetStart(), aDragStat.GetNow());
+
+ if(!bNoJustify)
+ {
+ aRetval.Justify();
+ }
+ }
+
+ // cleanup
+ BrkEncirclement();
+ }
+
+ return aRetval;
+}
+
+void SdrPaintView::BrkEncirclement()
+{
+ if(IsEncirclement())
+ {
+ DBG_ASSERT(mpEncirclementOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
+ delete mpEncirclementOverlay;
+ mpEncirclementOverlay = 0L;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrPaintView::ClearPageView()
+{
+ BrkAction();
+
+ if(mpPageView)
+ {
+ InvalidateAllWin();
+ delete mpPageView;
+ mpPageView = 0L;
+ }
+}
+
+SdrPageView* SdrPaintView::ShowSdrPage(SdrPage* pPage)
+{
+ if(pPage && (!mpPageView || mpPageView->GetPage() != pPage))
+ {
+ if(mpPageView)
+ {
+ InvalidateAllWin();
+ delete mpPageView;
+ }
+
+ mpPageView = new SdrPageView(pPage, *((SdrView*)this));
+ mpPageView->Show();
+ }
+
+ return mpPageView;
+}
+
+void SdrPaintView::HideSdrPage()
+{
+ if(mpPageView)
+ {
+ mpPageView->Hide();
+ delete mpPageView;
+ mpPageView = 0L;
+ }
+}
+
+void SdrPaintView::AddWindowToPaintView(OutputDevice* pNewWin)
+{
+ DBG_ASSERT(pNewWin, "SdrPaintView::AddWindowToPaintView: No OutputDevice(!)");
+ SdrPaintWindow* pNewPaintWindow = new SdrPaintWindow(*this, *pNewWin);
+ AppendPaintWindow(*pNewPaintWindow);
+
+ if(mpPageView)
+ {
+ mpPageView->AddPaintWindowToPageView(*pNewPaintWindow);
+ }
+
+#ifdef DBG_UTIL
+ if (pItemBrowser!=NULL)
+ pItemBrowser->ForceParent();
+#endif
+}
+
+void SdrPaintView::DeleteWindowFromPaintView(OutputDevice* pOldWin)
+{
+ DBG_ASSERT(pOldWin, "SdrPaintView::DeleteWindowFromPaintView: No OutputDevice(!)");
+ SdrPaintWindow* pCandidate = FindPaintWindow(*pOldWin);
+
+ if(pCandidate)
+ {
+ if(mpPageView)
+ {
+ mpPageView->RemovePaintWindowFromPageView(*pCandidate);
+ }
+
+ RemovePaintWindow(*pCandidate);
+ delete pCandidate;
+ }
+
+#ifdef DBG_UTIL
+ if (pItemBrowser!=NULL)
+ pItemBrowser->ForceParent();
+#endif
+}
+
+void SdrPaintView::SetLayerVisible(const XubString& rName, sal_Bool bShow)
+{
+ if(mpPageView)
+ {
+ mpPageView->SetLayerVisible(rName,bShow);
+ }
+
+ InvalidateAllWin();
+}
+
+bool SdrPaintView::IsLayerVisible(const XubString& rName) const
+{
+ if(mpPageView)
+ {
+ return mpPageView->IsLayerVisible(rName);
+ }
+
+ return false;
+}
+
+void SdrPaintView::SetAllLayersVisible(sal_Bool bShow)
+{
+ if(mpPageView)
+ {
+ mpPageView->SetAllLayersVisible(bShow);
+ }
+
+ InvalidateAllWin();
+}
+
+void SdrPaintView::SetLayerLocked(const XubString& rName, sal_Bool bLock)
+{
+ if(mpPageView)
+ {
+ mpPageView->SetLayerLocked(rName,bLock);
+ }
+}
+
+bool SdrPaintView::IsLayerLocked(const XubString& rName) const
+{
+ if(mpPageView)
+ {
+ return mpPageView->IsLayerLocked(rName);
+ }
+
+ return false;
+}
+
+void SdrPaintView::SetAllLayersLocked(sal_Bool bLock)
+{
+ if(mpPageView)
+ {
+ mpPageView->SetAllLayersLocked(bLock);
+ }
+}
+
+void SdrPaintView::SetLayerPrintable(const XubString& rName, sal_Bool bPrn)
+{
+ if(mpPageView)
+ {
+ mpPageView->SetLayerPrintable(rName,bPrn);
+ }
+}
+
+bool SdrPaintView::IsLayerPrintable(const XubString& rName) const
+{
+ if(mpPageView)
+ {
+ return mpPageView->IsLayerPrintable(rName);
+ }
+
+ return false;
+}
+
+void SdrPaintView::SetAllLayersPrintable(sal_Bool bPrn)
+{
+ if(mpPageView)
+ {
+ mpPageView->SetAllLayersPrintable(bPrn);
+ }
+}
+
+void SdrPaintView::PrePaint()
+{
+ if(mpPageView)
+ {
+ mpPageView->PrePaint();
+ }
+}
+
+void SdrPaintView::PostPaint()
+{
+ if(mpPageView)
+ {
+ mpPageView->PostPaint();
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// #define SVX_REPAINT_TIMER_TEST
+
+void SdrPaintView::CompleteRedraw(OutputDevice* pOut, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector)
+{
+#ifdef SVX_REPAINT_TIMER_TEST
+#define REMEMBERED_TIMES_COUNT (10)
+ static bool bDoTimerTest(false);
+ static bool bTimesInited(false);
+ static sal_uInt32 nRepeatCount(10L);
+ static double fLastTimes[REMEMBERED_TIMES_COUNT];
+ const sal_uInt32 nStartTime(Time::GetSystemTicks());
+ sal_uInt32 count(1L);
+ sal_uInt32 a;
+
+ if(bDoTimerTest)
+ {
+ count = nRepeatCount;
+ }
+
+ for(a = 0L; a < count; a++)
+ {
+#endif // SVX_REPAINT_TIMER_TEST
+
+ // #i74769# check if pOut is a win and has a ClipRegion. If Yes, the Region
+ // rReg may be made more granular (fine) with using it. Normally, rReg
+ // does come from Window::Paint() anyways and thus is based on a single
+ // rectangle which was derived from exactly that repaint region
+ Region aOptimizedRepaintRegion(rReg);
+
+ if(pOut && OUTDEV_WINDOW == pOut->GetOutDevType())
+ {
+ Window* pWindow = (Window*)pOut;
+
+ if(pWindow->IsInPaint())
+ {
+ if(!pWindow->GetPaintRegion().IsEmpty())
+ {
+ aOptimizedRepaintRegion.Intersect(pWindow->GetPaintRegion());
+
+#ifdef DBG_UTIL
+ // #i74769# test-paint repaint region
+ static bool bDoPaintForVisualControl(false);
+ if(bDoPaintForVisualControl)
+ {
+ RegionHandle aRegionHandle(aOptimizedRepaintRegion.BeginEnumRects());
+ Rectangle aRegionRectangle;
+
+ while(aOptimizedRepaintRegion.GetEnumRects(aRegionHandle, aRegionRectangle))
+ {
+ pWindow->SetLineColor(COL_LIGHTGREEN);
+ pWindow->SetFillColor();
+ pWindow->DrawRect(aRegionRectangle);
+ }
+
+ aOptimizedRepaintRegion.EndEnumRects(aRegionHandle);
+ }
+#endif
+ }
+ }
+ }
+
+ SdrPaintWindow* pPaintWindow = BeginCompleteRedraw(pOut);
+ OSL_ENSURE(pPaintWindow, "SdrPaintView::CompleteRedraw: No OutDev (!)");
+
+ DoCompleteRedraw(*pPaintWindow, aOptimizedRepaintRegion, pRedirector);
+ EndCompleteRedraw(*pPaintWindow, true);
+
+#ifdef SVX_REPAINT_TIMER_TEST
+ }
+
+ if(bDoTimerTest)
+ {
+ const sal_uInt32 nStopTime(Time::GetSystemTicks());
+ const sal_uInt32 nNeededTime(nStopTime - nStartTime);
+ const double fTimePerPaint((double)nNeededTime / (double)nRepeatCount);
+
+ if(!bTimesInited)
+ {
+ for(a = 0L; a < REMEMBERED_TIMES_COUNT; a++)
+ {
+ fLastTimes[a] = fTimePerPaint;
+ }
+
+ bTimesInited = true;
+ }
+ else
+ {
+ for(a = 1L; a < REMEMBERED_TIMES_COUNT; a++)
+ {
+ fLastTimes[a - 1L] = fLastTimes[a];
+ }
+
+ fLastTimes[REMEMBERED_TIMES_COUNT - 1L] = fTimePerPaint;
+ }
+
+ double fAddedTimes(0.0);
+
+ for(a = 0L; a < REMEMBERED_TIMES_COUNT; a++)
+ {
+ fAddedTimes += fLastTimes[a];
+ }
+
+ const double fAverageTimePerPaint(fAddedTimes / (double)REMEMBERED_TIMES_COUNT);
+
+ fprintf(stderr, "-----------(start result)----------\n");
+ fprintf(stderr, "StartTime : %u, StopTime: %u, NeededTime: %u, TimePerPaint: %f\n", nStartTime, nStopTime, nNeededTime, fTimePerPaint);
+ fprintf(stderr, "Remembered times: ");
+
+ for(a = 0L; a < REMEMBERED_TIMES_COUNT; a++)
+ {
+ fprintf(stderr, "%d: %f ", a, fLastTimes[a]);
+ }
+
+ fprintf(stderr, "\n");
+ fprintf(stderr, "AverageTimePerPaint: %f\n", fAverageTimePerPaint);
+ fprintf(stderr, "-----------(stop result)----------\n");
+ }
+#endif // SVX_REPAINT_TIMER_TEST
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// #i72889#
+
+SdrPaintWindow* SdrPaintView::BeginCompleteRedraw(OutputDevice* pOut)
+{
+ OSL_ENSURE(pOut, "SdrPaintView::BeginCompleteRedraw: No OutDev (!)");
+ SdrPaintWindow* pPaintWindow = FindPaintWindow(*pOut);
+
+ if(pPaintWindow)
+ {
+ // draw preprocessing, only for known devices
+ // prepare PreRendering
+ pPaintWindow->PreparePreRenderDevice();
+ }
+ else
+ {
+ // None of the known OutputDevices is the target of this paint, use
+ // a temporary SdrPaintWindow for this Redraw.
+ pPaintWindow = new SdrPaintWindow(*this, *pOut);
+ pPaintWindow->setTemporaryTarget(true);
+ }
+
+ return pPaintWindow;
+}
+
+void SdrPaintView::DoCompleteRedraw(SdrPaintWindow& rPaintWindow, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector)
+{
+ // redraw all PageViews with the target. This may expand the RedrawRegion
+ // at the PaintWindow, plus taking care of FormLayer expansion
+ if(mpPageView)
+ {
+ mpPageView->CompleteRedraw(rPaintWindow, rReg, pRedirector);
+ }
+}
+
+void SdrPaintView::EndCompleteRedraw(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer)
+{
+ if(rPaintWindow.getTemporaryTarget())
+ {
+ // get rid of temp target again
+ delete (&rPaintWindow);
+ }
+ else
+ {
+ // draw postprocessing, only for known devices
+ // it is necessary to always paint FormLayer
+ if(bPaintFormLayer)
+ {
+ ImpFormLayerDrawing(rPaintWindow);
+ }
+
+ // look for active TextEdit. As long as this cannot be painted to a VDev,
+ // it cannot get part of buffering. In that case, output evtl. prerender
+ // early and paint text edit to window.
+ const bool bTextEditActive(IsTextEdit() && GetTextEditPageView());
+
+ if(bTextEditActive)
+ {
+ // output PreRendering and destroy it so that it is not used for FormLayer
+ // or overlay
+ rPaintWindow.OutputPreRenderDevice(rPaintWindow.GetRedrawRegion());
+
+ // draw old text edit stuff before overlay to have it as part of the background
+ // ATM. This will be changed to have the text editing on the overlay, bit it
+ // is not an easy thing to do, see BegTextEdit and the OutlinerView stuff used...
+ if(bTextEditActive)
+ {
+ ImpTextEditDrawing(rPaintWindow);
+ }
+
+ // draw Overlay directly to window. This will save the contents of the window
+ // in the RedrawRegion to the overlay background buffer, too.
+ // This may lead to problems when reading from the screen is slow from the
+ // graphics driver/graphiccard combination.
+ rPaintWindow.DrawOverlay(rPaintWindow.GetRedrawRegion(), false);
+ }
+ else
+ {
+ // draw Overlay, also to PreRender device if exists
+ rPaintWindow.DrawOverlay(rPaintWindow.GetRedrawRegion(), true);
+
+ // output PreRendering
+ rPaintWindow.OutputPreRenderDevice(rPaintWindow.GetRedrawRegion());
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrPaintWindow* SdrPaintView::BeginDrawLayers(OutputDevice* pOut, const Region& rReg, bool bDisableIntersect)
+{
+ // #i74769# use BeginCompleteRedraw() as common base
+ SdrPaintWindow* pPaintWindow = BeginCompleteRedraw(pOut);
+ OSL_ENSURE(pPaintWindow, "SdrPaintView::BeginDrawLayers: No SdrPaintWindow (!)");
+
+ if(mpPageView)
+ {
+ SdrPageWindow* pKnownTarget = mpPageView->FindPageWindow(*pPaintWindow);
+
+ if(pKnownTarget)
+ {
+ // #i74769# check if pOut is a win and has a ClipRegion. If Yes, the Region
+ // rReg may be made more granular (fine) with using it. Normally, rReg
+ // does come from Window::Paint() anyways and thus is based on a single
+ // rectangle which was derived from exactly that repaint region
+ Region aOptimizedRepaintRegion(rReg);
+
+ // #i76114# Intersecting the region with the Window's paint region is disabled
+ // for print preview in Calc, because the intersection can be empty (if the paint
+ // region is outside of the table area of the page), and then no clip region
+ // would be set.
+ if(pOut && OUTDEV_WINDOW == pOut->GetOutDevType() && !bDisableIntersect)
+ {
+ Window* pWindow = (Window*)pOut;
+
+ if(pWindow->IsInPaint())
+ {
+ if(!pWindow->GetPaintRegion().IsEmpty())
+ {
+ aOptimizedRepaintRegion.Intersect(pWindow->GetPaintRegion());
+
+#ifdef DBG_UTIL
+ // #i74769# test-paint repaint region
+ static bool bDoPaintForVisualControl(false);
+ if(bDoPaintForVisualControl)
+ {
+ RegionHandle aRegionHandle(aOptimizedRepaintRegion.BeginEnumRects());
+ Rectangle aRegionRectangle;
+
+ while(aOptimizedRepaintRegion.GetEnumRects(aRegionHandle, aRegionRectangle))
+ {
+ pWindow->SetLineColor(COL_LIGHTGREEN);
+ pWindow->SetFillColor();
+ pWindow->DrawRect(aRegionRectangle);
+ }
+
+ aOptimizedRepaintRegion.EndEnumRects(aRegionHandle);
+ }
+#endif
+ }
+ }
+ }
+
+ // prepare redraw
+ pKnownTarget->PrepareRedraw(aOptimizedRepaintRegion);
+
+ // remember prepared SdrPageWindow
+ mpPageView->setPreparedPageWindow(pKnownTarget);
+ }
+ }
+
+ return pPaintWindow;
+}
+
+void SdrPaintView::EndDrawLayers(SdrPaintWindow& rPaintWindow, bool bPaintFormLayer)
+{
+ // #i74769# use EndCompleteRedraw() as common base
+ EndCompleteRedraw(rPaintWindow, bPaintFormLayer);
+
+ if(mpPageView)
+ {
+ // forget prepared SdrPageWindow
+ mpPageView->setPreparedPageWindow(0);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrPaintView::ImpTextEditDrawing(SdrPaintWindow& rPaintWindow) const
+{
+ // draw old text edit stuff
+ if(IsTextEdit())
+ {
+ SdrPageView* pPageView = GetTextEditPageView();
+
+ if(pPageView)
+ {
+ // paint TextEdit directly to the destination OutDev
+ const Region& rRedrawRegion = rPaintWindow.GetRedrawRegion();
+ const Rectangle aCheckRect(rRedrawRegion.GetBoundRect());
+ pPageView->PaintOutlinerView(&rPaintWindow.GetOutputDevice(), aCheckRect);
+ }
+ }
+}
+
+void SdrPaintView::ImpFormLayerDrawing(SdrPaintWindow& rPaintWindow) const
+{
+ if(mpPageView)
+ {
+ SdrPageWindow* pKnownTarget = mpPageView->FindPageWindow(rPaintWindow);
+
+ if(pKnownTarget)
+ {
+ const SdrModel& rModel = *(GetModel());
+ const SdrLayerAdmin& rLayerAdmin = rModel.GetLayerAdmin();
+ const SdrLayerID nControlLayerId = rLayerAdmin.GetLayerID(rLayerAdmin.GetControlLayerName(), sal_False);
+
+ // BUFFERED use GetTargetOutputDevice() now, it may be targeted to VDevs, too
+ // need to set PreparedPageWindow to make DrawLayer use the correct ObjectContact
+ mpPageView->setPreparedPageWindow(pKnownTarget);
+ mpPageView->DrawLayer(nControlLayerId, &rPaintWindow.GetTargetOutputDevice());
+ mpPageView->setPreparedPageWindow(0);
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_Bool SdrPaintView::KeyInput(const KeyEvent& /*rKEvt*/, Window* /*pWin*/)
+{
+ return sal_False;
+}
+
+void SdrPaintView::GlueInvalidate() const
+{
+ const sal_uInt32 nWindowCount(PaintWindowCount());
+
+ for(sal_uInt32 nWinNum(0L); nWinNum < nWindowCount; nWinNum++)
+ {
+ SdrPaintWindow* pPaintWindow = GetPaintWindow(nWinNum);
+
+ if(pPaintWindow->OutputToWindow())
+ {
+ OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
+
+ if(mpPageView)
+ {
+ const SdrObjList* pOL=mpPageView->GetObjList();
+ sal_uIntPtr nObjAnz=pOL->GetObjCount();
+ for (sal_uIntPtr nObjNum=0; nObjNum<nObjAnz; nObjNum++) {
+ const SdrObject* pObj=pOL->GetObj(nObjNum);
+ const SdrGluePointList* pGPL=pObj->GetGluePointList();
+ if (pGPL!=NULL && pGPL->GetCount()!=0) {
+ pGPL->Invalidate((Window&)rOutDev, pObj);
+ }
+ }
+ }
+ }
+ }
+}
+
+void SdrPaintView::InvalidateAllWin()
+{
+ const sal_uInt32 nWindowCount(PaintWindowCount());
+
+ for(sal_uInt32 a(0L); a < nWindowCount; a++)
+ {
+ SdrPaintWindow* pPaintWindow = GetPaintWindow(a);
+
+ if(pPaintWindow->OutputToWindow())
+ {
+ InvalidateOneWin((Window&)pPaintWindow->GetOutputDevice());
+ }
+ }
+}
+
+void SdrPaintView::InvalidateAllWin(const Rectangle& rRect, sal_Bool bPlus1Pix)
+{
+ const sal_uInt32 nWindowCount(PaintWindowCount());
+
+ for(sal_uInt32 a(0L); a < nWindowCount; a++)
+ {
+ SdrPaintWindow* pPaintWindow = GetPaintWindow(a);
+
+ if(pPaintWindow->OutputToWindow())
+ {
+ OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
+ Rectangle aRect(rRect);
+
+ if(bPlus1Pix)
+ {
+ Size aPixSiz(1,1);
+ Size aSiz(rOutDev.PixelToLogic(aPixSiz));
+ aRect.Left ()-=aSiz.Width();
+ aRect.Top ()-=aSiz.Height();
+ aRect.Right ()+=aSiz.Width();
+ aRect.Bottom()+=aSiz.Height();
+ }
+
+ Point aOrg(rOutDev.GetMapMode().GetOrigin());
+ aOrg.X()=-aOrg.X(); aOrg.Y()=-aOrg.Y();
+ Rectangle aOutRect(aOrg, rOutDev.GetOutputSize());
+
+ if (aRect.IsOver(aOutRect))
+ {
+ InvalidateOneWin((Window&)rOutDev, aRect);
+ }
+ }
+ }
+}
+
+void SdrPaintView::InvalidateOneWin(Window& rWin)
+{
+ // #111096#
+ // do not erase background, that causes flicker (!)
+ rWin.Invalidate(INVALIDATE_NOERASE);
+}
+
+void SdrPaintView::InvalidateOneWin(Window& rWin, const Rectangle& rRect)
+{
+ // #111096#
+ // do not erase background, that causes flicker (!)
+ rWin.Invalidate(rRect, INVALIDATE_NOERASE);
+}
+
+void SdrPaintView::LeaveOneGroup()
+{
+ if(mpPageView)
+ {
+ mpPageView->LeaveOneGroup();
+ }
+}
+
+void SdrPaintView::LeaveAllGroup()
+{
+ if(mpPageView)
+ {
+ mpPageView->LeaveAllGroup();
+ }
+}
+
+bool SdrPaintView::IsGroupEntered() const
+{
+ if(mpPageView)
+ {
+ return (mpPageView->GetEnteredLevel() != 0);
+ }
+
+ return false;
+}
+
+void SdrPaintView::SetNotPersistDefaultAttr(const SfxItemSet& rAttr, sal_Bool /*bReplaceAll*/)
+{
+ // bReplaceAll hat hier keinerlei Wirkung
+ sal_Bool bMeasure=ISA(SdrView) && ((SdrView*)this)->IsMeasureTool();
+ const SfxPoolItem *pPoolItem=NULL;
+ if (rAttr.GetItemState(SDRATTR_LAYERID,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ SdrLayerID nLayerId=((const SdrLayerIdItem*)pPoolItem)->GetValue();
+ const SdrLayer* pLayer=pMod->GetLayerAdmin().GetLayerPerID(nLayerId);
+ if (pLayer!=NULL) {
+ if (bMeasure) aMeasureLayer=pLayer->GetName();
+ else aAktLayer=pLayer->GetName();
+ }
+ }
+ if (rAttr.GetItemState(SDRATTR_LAYERNAME,sal_True,&pPoolItem)==SFX_ITEM_SET) {
+ if (bMeasure) aMeasureLayer=((const SdrLayerNameItem*)pPoolItem)->GetValue();
+ else aAktLayer=((const SdrLayerNameItem*)pPoolItem)->GetValue();
+ }
+}
+
+void SdrPaintView::MergeNotPersistDefaultAttr(SfxItemSet& rAttr, sal_Bool /*bOnlyHardAttr*/) const
+{
+ // bOnlyHardAttr hat hier keinerlei Wirkung
+ sal_Bool bMeasure=ISA(SdrView) && ((SdrView*)this)->IsMeasureTool();
+ const XubString& aNam=bMeasure?aMeasureLayer:aAktLayer;
+ rAttr.Put(SdrLayerNameItem(aNam));
+ SdrLayerID nLayer=pMod->GetLayerAdmin().GetLayerID(aNam,sal_True);
+ if (nLayer!=SDRLAYER_NOTFOUND) {
+ rAttr.Put(SdrLayerIdItem(nLayer));
+ }
+}
+
+void SdrPaintView::SetDefaultAttr(const SfxItemSet& rAttr, sal_Bool bReplaceAll)
+{
+#ifdef DBG_UTIL
+ {
+ sal_Bool bHasEEFeatureItems=sal_False;
+ SfxItemIter aIter(rAttr);
+ const SfxPoolItem* pItem=aIter.FirstItem();
+ while (!bHasEEFeatureItems && pItem!=NULL) {
+ if (!IsInvalidItem(pItem)) {
+ sal_uInt16 nW=pItem->Which();
+ if (nW>=EE_FEATURE_START && nW<=EE_FEATURE_END) bHasEEFeatureItems=sal_True;
+ }
+ pItem=aIter.NextItem();
+ }
+
+ if(bHasEEFeatureItems)
+ {
+ String aMessage;
+ aMessage.AppendAscii("SdrPaintView::SetDefaultAttr(): Das setzen von EE_FEATURE-Items an der SdrView macht keinen Sinn! Es fuehrt nur zu Overhead und nicht mehr lesbaren Dokumenten.");
+ InfoBox(NULL, aMessage).Execute();
+ }
+ }
+#endif
+ if (bReplaceAll) aDefaultAttr.Set(rAttr);
+ else aDefaultAttr.Put(rAttr,sal_False); // FALSE= InvalidItems nicht als Default, sondern als "Loecher" betrachten
+ SetNotPersistDefaultAttr(rAttr,bReplaceAll);
+#ifdef DBG_UTIL
+ if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
+#endif
+}
+
+void SdrPaintView::SetDefaultStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr)
+{
+ if (pDefaultStyleSheet)
+ EndListening(*pDefaultStyleSheet);
+ pDefaultStyleSheet=pStyleSheet;
+ if (pDefaultStyleSheet)
+ StartListening(*pDefaultStyleSheet);
+
+ if (pStyleSheet!=NULL && !bDontRemoveHardAttr) {
+ SfxWhichIter aIter(pStyleSheet->GetItemSet());
+ sal_uInt16 nWhich=aIter.FirstWhich();
+ while (nWhich!=0) {
+ if (pStyleSheet->GetItemSet().GetItemState(nWhich,sal_True)==SFX_ITEM_SET) {
+ aDefaultAttr.ClearItem(nWhich);
+ }
+ nWhich=aIter.NextWhich();
+ }
+ }
+#ifdef DBG_UTIL
+ if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
+#endif
+}
+
+/* new interface src537 */
+sal_Bool SdrPaintView::GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr) const
+{
+ if(bOnlyHardAttr || !pDefaultStyleSheet)
+ {
+ rTargetSet.Put(aDefaultAttr, sal_False);
+ }
+ else
+ {
+ // sonst DefStyleSheet dazumergen
+ rTargetSet.Put(pDefaultStyleSheet->GetItemSet(), sal_False);
+ rTargetSet.Put(aDefaultAttr, sal_False);
+ }
+ MergeNotPersistDefaultAttr(rTargetSet, bOnlyHardAttr);
+ return sal_True;
+}
+
+sal_Bool SdrPaintView::SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll)
+{
+ SetDefaultAttr(rSet,bReplaceAll);
+ return sal_True;
+}
+
+SfxStyleSheet* SdrPaintView::GetStyleSheet() const // SfxStyleSheet* SdrPaintView::GetStyleSheet(sal_Bool& rOk) const
+{
+ //rOk=sal_True;
+ return GetDefaultStyleSheet();
+}
+
+sal_Bool SdrPaintView::SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr)
+{
+ SetDefaultStyleSheet(pStyleSheet,bDontRemoveHardAttr);
+ return sal_True;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifdef DBG_UTIL
+void SdrPaintView::ShowItemBrowser(sal_Bool bShow)
+{
+ if (bShow) {
+ if (pItemBrowser==NULL) {
+ pItemBrowser=new SdrItemBrowser(*(SdrView*)this);
+ pItemBrowser->SetFloatingMode(sal_True);
+ }
+ pItemBrowser->Show();
+ pItemBrowser->GrabFocus();
+ } else {
+ if (pItemBrowser!=NULL) {
+ pItemBrowser->Hide();
+ delete pItemBrowser;
+ pItemBrowser=NULL;
+ }
+ }
+}
+#endif
+
+void SdrPaintView::MakeVisible(const Rectangle& rRect, Window& rWin)
+{
+ MapMode aMap(rWin.GetMapMode());
+ Size aActualSize(rWin.GetOutputSize());
+
+ if( aActualSize.Height() > 0 && aActualSize.Width() > 0 )
+ {
+ Size aNewSize(rRect.GetSize());
+ sal_Bool bNewScale=sal_False;
+ sal_Bool bNeedMoreX=aNewSize.Width()>aActualSize.Width();
+ sal_Bool bNeedMoreY=aNewSize.Height()>aActualSize.Height();
+ if (bNeedMoreX || bNeedMoreY)
+ {
+ bNewScale=sal_True;
+ // Neuen MapMode (Size+Org) setzen und dabei alles invalidieren
+ Fraction aXFact(aNewSize.Width(),aActualSize.Width());
+ Fraction aYFact(aNewSize.Height(),aActualSize.Height());
+ if (aYFact>aXFact) aXFact=aYFact;
+ aXFact*=aMap.GetScaleX();
+ aXFact.ReduceInaccurate(10); // Um Ueberlaeufe und BigInt-Mapping zu vermeiden
+ aMap.SetScaleX(aXFact);
+ aMap.SetScaleY(aYFact);
+ rWin.SetMapMode(aMap);
+ aActualSize=rWin.GetOutputSize();
+ }
+ Point aOrg(aMap.GetOrigin());
+ long dx=0,dy=0;
+ long l=-aOrg.X();
+ long r=-aOrg.X()+aActualSize.Width()-1;
+ long o=-aOrg.Y();
+ long u=-aOrg.Y()+aActualSize.Height()-1;
+ if (l>rRect.Left()) dx=rRect.Left()-l;
+ else if (r<rRect.Right()) dx=rRect.Right()-r;
+ if (o>rRect.Top()) dy=rRect.Top()-o;
+ else if (u<rRect.Bottom()) dy=rRect.Bottom()-u;
+ aMap.SetOrigin(Point(aOrg.X()-dx,aOrg.Y()-dy));
+ if (!bNewScale) {
+ if (dx!=0 || dy!=0) {
+ rWin.Scroll(-dx,-dy);
+ rWin.SetMapMode(aMap);
+ rWin.Update();
+ }
+ } else {
+ rWin.SetMapMode(aMap);
+ InvalidateOneWin(rWin);
+ }
+ }
+}
+
+void SdrPaintView::DoConnect(SdrOle2Obj* /*pOleObj*/)
+{
+}
+
+void SdrPaintView::SetAnimationEnabled( sal_Bool bEnable )
+{
+ SetAnimationMode( bEnable ? SDR_ANIMATION_ANIMATE : SDR_ANIMATION_DISABLE );
+}
+
+void SdrPaintView::SetAnimationPause( bool bSet )
+{
+ if((bool)bAnimationPause != bSet)
+ {
+ bAnimationPause = bSet;
+
+ if(mpPageView)
+ {
+ for(sal_uInt32 b(0L); b < mpPageView->PageWindowCount(); b++)
+ {
+ const SdrPageWindow& rPageWindow = *(mpPageView->GetPageWindow(b));
+ sdr::contact::ObjectContact& rObjectContact = rPageWindow.GetObjectContact();
+ sdr::animation::primitiveAnimator& rAnimator = rObjectContact.getPrimitiveAnimator();
+
+ if(rAnimator.IsPaused() != bSet)
+ {
+ rAnimator.SetPaused(bSet);
+ }
+ }
+ }
+ }
+}
+
+void SdrPaintView::SetAnimationMode( const SdrAnimationMode eMode )
+{
+ eAnimationMode = eMode;
+}
+
+void SdrPaintView::VisAreaChanged(const OutputDevice* pOut)
+{
+ if(mpPageView)
+ {
+ if (pOut)
+ {
+ SdrPageWindow* pWindow = mpPageView->FindPageWindow(*((OutputDevice*)pOut));
+
+ if(pWindow)
+ {
+ VisAreaChanged(*pWindow);
+ }
+ }
+ else
+ {
+ for(sal_uInt32 a(0L); a < mpPageView->PageWindowCount(); a++)
+ {
+ VisAreaChanged(*mpPageView->GetPageWindow(a));
+ }
+ }
+ }
+}
+
+void SdrPaintView::VisAreaChanged(const SdrPageWindow& /*rWindow*/)
+{
+ // notify SfxListener
+ Broadcast(SvxViewHint(SvxViewHint::SVX_HINT_VIEWCHANGED));
+}
+
+const svtools::ColorConfig& SdrPaintView::getColorConfig() const
+{
+ return maColorConfig;
+}
+
+void SdrPaintView::onChangeColorConfig()
+{
+ SetGridColor( Color( maColorConfig.GetColorValue( svtools::DRAWGRID ).nColor ) );
+}
+
+void SdrPaintView::SetGridColor( Color aColor )
+{
+ maGridColor = aColor;
+}
+
+Color SdrPaintView::GetGridColor() const
+{
+ return maGridColor;
+}
+
+// #103834# Set background color for svx at SdrPageViews
+void SdrPaintView::SetApplicationBackgroundColor(Color aBackgroundColor)
+{
+ if(mpPageView)
+ {
+ mpPageView->SetApplicationBackgroundColor(aBackgroundColor);
+ }
+}
+
+// #103911# Set document color for svx at SdrPageViews
+void SdrPaintView::SetApplicationDocumentColor(Color aDocumentColor)
+{
+ if(mpPageView)
+ {
+ mpPageView->SetApplicationDocumentColor(aDocumentColor);
+ }
+}
+
+// #114898#
+bool SdrPaintView::IsBufferedOutputAllowed() const
+{
+ return (mbBufferedOutputAllowed && maDrawinglayerOpt.IsPaintBuffer());
+}
+
+// #114898#
+void SdrPaintView::SetBufferedOutputAllowed(bool bNew)
+{
+ if(bNew != (bool)mbBufferedOutputAllowed)
+ {
+ mbBufferedOutputAllowed = bNew;
+ }
+}
+
+bool SdrPaintView::IsBufferedOverlayAllowed() const
+{
+ return (mbBufferedOverlayAllowed && maDrawinglayerOpt.IsOverlayBuffer());
+}
+
+void SdrPaintView::SetBufferedOverlayAllowed(bool bNew)
+{
+ if(bNew != (bool)mbBufferedOverlayAllowed)
+ {
+ mbBufferedOverlayAllowed = bNew;
+ }
+}
+
+sal_Bool SdrPaintView::IsPagePaintingAllowed() const
+{
+ return mbPagePaintingAllowed;
+}
+
+void SdrPaintView::SetPagePaintingAllowed(bool bNew)
+{
+ if(bNew != (bool)mbPagePaintingAllowed)
+ {
+ mbPagePaintingAllowed = bNew;
+ }
+}
+
+// #i38135# Sets the timer for Object animations and restarts.
+void SdrPaintView::SetAnimationTimer(sal_uInt32 nTime)
+{
+ if(mpPageView)
+ {
+ // first, reset all timers at all windows to 0L
+ for(sal_uInt32 a(0L); a < mpPageView->PageWindowCount(); a++)
+ {
+ const SdrPageWindow& rPageWindow = *mpPageView->GetPageWindow(a);
+ sdr::contact::ObjectContact& rObjectContact = rPageWindow.GetObjectContact();
+ sdr::animation::primitiveAnimator& rAnimator = rObjectContact.getPrimitiveAnimator();
+ rAnimator.SetTime(nTime);
+ }
+ }
+}
+
+// eof
diff --git a/svx/source/svdraw/svdpoev.cxx b/svx/source/svdraw/svdpoev.cxx
new file mode 100644
index 000000000000..75be5919b114
--- /dev/null
+++ b/svx/source/svdraw/svdpoev.cxx
@@ -0,0 +1,745 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svdpoev.hxx>
+#include <math.h>
+#include <svx/svdpagv.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/svdundo.hxx>
+#include "svx/svdstr.hrc" // Namen aus der Resource
+#include "svx/svdglob.hxx" // StringCache
+#include <svx/svdtrans.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <vcl/salbtype.hxx> // FRound
+
+#include <svx/polypolygoneditor.hxx>
+
+using namespace sdr;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrPolyEditView::ImpResetPolyPossibilityFlags()
+{
+ eMarkedPointsSmooth=SDRPATHSMOOTH_DONTCARE;
+ eMarkedSegmentsKind=SDRPATHSEGMENT_DONTCARE;
+ bSetMarkedPointsSmoothPossible=sal_False;
+ bSetMarkedSegmentsKindPossible=sal_False;
+}
+
+void SdrPolyEditView::ImpClearVars()
+{
+ ImpResetPolyPossibilityFlags();
+}
+
+SdrPolyEditView::SdrPolyEditView(SdrModel* pModel1, OutputDevice* pOut):
+ SdrEditView(pModel1,pOut)
+{
+ ImpClearVars();
+}
+
+SdrPolyEditView::~SdrPolyEditView()
+{
+}
+
+void SdrPolyEditView::ImpCheckPolyPossibilities()
+{
+ ImpResetPolyPossibilityFlags();
+ const sal_uIntPtr nMarkAnz(GetMarkedObjectCount());
+
+ if(nMarkAnz && !ImpIsFrameHandles())
+ {
+ bool b1stSmooth(true);
+ bool b1stSegm(true);
+ bool bCurve(false);
+ bool bSmoothFuz(false);
+ bool bSegmFuz(false);
+ basegfx::B2VectorContinuity eSmooth = basegfx::CONTINUITY_NONE;
+
+ for(sal_uIntPtr nMarkNum(0L); nMarkNum < nMarkAnz; nMarkNum++)
+ {
+ SdrMark* pM = GetSdrMarkByIndex(nMarkNum);
+ CheckPolyPossibilitiesHelper( pM, b1stSmooth, b1stSegm, bCurve, bSmoothFuz, bSegmFuz, eSmooth );
+ }
+ }
+}
+
+void SdrPolyEditView::CheckPolyPossibilitiesHelper( SdrMark* pM, bool& b1stSmooth, bool& b1stSegm, bool& bCurve, bool& bSmoothFuz, bool& bSegmFuz, basegfx::B2VectorContinuity& eSmooth )
+{
+ SdrObject* pObj = pM->GetMarkedSdrObj();
+ SdrUShortCont* pPts = pM->GetMarkedPoints();
+ SdrPathObj* pPath = PTR_CAST(SdrPathObj,pObj);
+
+ if(pPath && pPts)
+ {
+ const sal_uInt32 nMarkedPntAnz(pPts->GetCount());
+
+ if(nMarkedPntAnz)
+ {
+ bool bClosed(pPath->IsClosed());
+ bSetMarkedPointsSmoothPossible = true;
+
+ if(bClosed)
+ {
+ bSetMarkedSegmentsKindPossible = true;
+ }
+
+ for(sal_uInt32 nMarkedPntNum(0L); nMarkedPntNum < nMarkedPntAnz; nMarkedPntNum++)
+ {
+ sal_uInt32 nNum(pPts->GetObject(nMarkedPntNum));
+ sal_uInt32 nPolyNum, nPntNum;
+
+ if(PolyPolygonEditor::GetRelativePolyPoint(pPath->GetPathPoly(), nNum, nPolyNum, nPntNum))
+ {
+ const basegfx::B2DPolygon aLocalPolygon(pPath->GetPathPoly().getB2DPolygon(nPolyNum));
+ bool bCanSegment(bClosed || nPntNum < aLocalPolygon.count() - 1L);
+
+ if(!bSetMarkedSegmentsKindPossible && bCanSegment)
+ {
+ bSetMarkedSegmentsKindPossible = true;
+ }
+
+ if(!bSmoothFuz)
+ {
+ if (b1stSmooth)
+ {
+ b1stSmooth = false;
+ eSmooth = basegfx::tools::getContinuityInPoint(aLocalPolygon, nPntNum);
+ }
+ else
+ {
+ bSmoothFuz = (eSmooth != basegfx::tools::getContinuityInPoint(aLocalPolygon, nPntNum));
+ }
+ }
+
+ if(!bSegmFuz)
+ {
+ if(bCanSegment)
+ {
+ bool bCrv(aLocalPolygon.isNextControlPointUsed(nPntNum));
+
+ if(b1stSegm)
+ {
+ b1stSegm = false;
+ bCurve = bCrv;
+ }
+ else
+ {
+ bSegmFuz = (bCrv != bCurve);
+ }
+ }
+ }
+ }
+ }
+
+ if(!b1stSmooth && !bSmoothFuz)
+ {
+ if(basegfx::CONTINUITY_NONE == eSmooth)
+ {
+ eMarkedPointsSmooth = SDRPATHSMOOTH_ANGULAR;
+ }
+
+ if(basegfx::CONTINUITY_C1 == eSmooth)
+ {
+ eMarkedPointsSmooth = SDRPATHSMOOTH_ASYMMETRIC;
+ }
+
+ if(basegfx::CONTINUITY_C2 == eSmooth)
+ {
+ eMarkedPointsSmooth = SDRPATHSMOOTH_SYMMETRIC;
+ }
+ }
+
+ if(!b1stSegm && !bSegmFuz)
+ {
+ eMarkedSegmentsKind = (bCurve) ? SDRPATHSEGMENT_CURVE : SDRPATHSEGMENT_LINE;
+ }
+ }
+ }
+}
+
+void SdrPolyEditView::SetMarkedPointsSmooth(SdrPathSmoothKind eKind)
+{
+ basegfx::B2VectorContinuity eFlags;
+
+ if(SDRPATHSMOOTH_ANGULAR == eKind)
+ {
+ eFlags = basegfx::CONTINUITY_NONE;
+ }
+ else if(SDRPATHSMOOTH_ASYMMETRIC == eKind)
+ {
+ eFlags = basegfx::CONTINUITY_C1;
+ }
+ else if(SDRPATHSMOOTH_SYMMETRIC == eKind)
+ {
+ eFlags = basegfx::CONTINUITY_C2;
+ }
+ else
+ {
+ return;
+ }
+
+ if(HasMarkedPoints())
+ {
+ SortMarkedObjects();
+
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ BegUndo(ImpGetResStr(STR_EditSetPointsSmooth), GetDescriptionOfMarkedPoints());
+ sal_uIntPtr nMarkAnz(GetMarkedObjectCount());
+
+ for(sal_uIntPtr nMarkNum(nMarkAnz); nMarkNum > 0L;)
+ {
+ nMarkNum--;
+ SdrMark* pM = GetSdrMarkByIndex(nMarkNum);
+ SdrUShortCont* pPts = pM->GetMarkedPoints();
+ SdrPathObj* pPath = dynamic_cast< SdrPathObj* >( pM->GetMarkedSdrObj() );
+
+ if(pPts && pPath)
+ {
+ PolyPolygonEditor aEditor( pPath->GetPathPoly(), pPath->IsClosed() );
+ if(aEditor.SetPointsSmooth( eFlags, pPts->getContainer() ) )
+ {
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pPath));
+ pPath->SetPathPoly(aEditor.GetPolyPolygon());
+ }
+ }
+ }
+
+ if( bUndo )
+ EndUndo();
+ }
+}
+
+void SdrPolyEditView::SetMarkedSegmentsKind(SdrPathSegmentKind eKind)
+{
+ if(HasMarkedPoints())
+ {
+ SortMarkedObjects();
+
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ BegUndo(ImpGetResStr(STR_EditSetSegmentsKind), GetDescriptionOfMarkedPoints());
+ sal_uIntPtr nMarkAnz(GetMarkedObjectCount());
+
+ for(sal_uIntPtr nMarkNum(nMarkAnz); nMarkNum > 0L;)
+ {
+ nMarkNum--;
+ SdrMark* pM = GetSdrMarkByIndex(nMarkNum);
+ SdrUShortCont* pPts = pM->GetMarkedPoints();
+ SdrPathObj* pPath = dynamic_cast< SdrPathObj* >( pM->GetMarkedSdrObj() );
+
+ if(pPts && pPath)
+ {
+ PolyPolygonEditor aEditor( pPath->GetPathPoly(), pPath->IsClosed() );
+ if(aEditor.SetSegmentsKind( eKind, pPts->getContainer()) )
+ {
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pPath));
+ pPath->SetPathPoly(aEditor.GetPolyPolygon());
+ }
+ }
+ }
+
+ if( bUndo )
+ EndUndo();
+ }
+}
+
+sal_Bool SdrPolyEditView::IsSetMarkedPointsSmoothPossible() const
+{
+ ForcePossibilities();
+ return bSetMarkedPointsSmoothPossible;
+}
+
+SdrPathSmoothKind SdrPolyEditView::GetMarkedPointsSmooth() const
+{
+ ForcePossibilities();
+ return eMarkedPointsSmooth;
+}
+
+sal_Bool SdrPolyEditView::IsSetMarkedSegmentsKindPossible() const
+{
+ ForcePossibilities();
+ return bSetMarkedSegmentsKindPossible;
+}
+
+SdrPathSegmentKind SdrPolyEditView::GetMarkedSegmentsKind() const
+{
+ ForcePossibilities();
+ return eMarkedSegmentsKind;
+}
+
+sal_Bool SdrPolyEditView::IsDeleteMarkedPointsPossible() const
+{
+ return HasMarkedPoints();
+}
+
+void SdrPolyEditView::DeleteMarkedPoints()
+{
+ if (HasMarkedPoints())
+ {
+ BrkAction();
+ SortMarkedObjects();
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ {
+ // Description
+ BegUndo(ImpGetResStr(STR_EditDelete),GetDescriptionOfMarkedPoints(),SDRREPFUNC_OBJ_DELETE);
+ }
+
+ for (sal_uIntPtr nMarkNum=nMarkAnz; nMarkNum>0;)
+ {
+ nMarkNum--;
+ SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
+ SdrUShortCont* pPts=pM->GetMarkedPoints();
+ SdrPathObj* pPath = dynamic_cast< SdrPathObj* >( pM->GetMarkedSdrObj() );
+
+ if( pPath && pPts )
+ {
+ PolyPolygonEditor aEditor( pPath ->GetPathPoly(), pPath->IsClosed() );
+ if( aEditor.DeletePoints( pPts->getContainer() ) )
+ {
+ if( aEditor.GetPolyPolygon().count() )
+ {
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pPath ));
+ pPath->SetPathPoly( aEditor.GetPolyPolygon() );
+ }
+ else
+ {
+ if( bUndo )
+ AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pPath ) );
+ pM->GetPageView()->GetObjList()->RemoveObject(pPath->GetOrdNum());
+ if( !bUndo )
+ {
+ SdrObject* pObj = pPath;
+ SdrObject::Free(pObj);
+ }
+ }
+ }
+ }
+ }
+
+ if( bUndo )
+ EndUndo();
+ UnmarkAllPoints();
+ MarkListHasChanged();
+ }
+}
+
+void SdrPolyEditView::RipUpAtMarkedPoints()
+{
+ if(HasMarkedPoints())
+ {
+ SortMarkedObjects();
+ sal_uInt32 nMarkAnz(GetMarkedObjectCount());
+
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ BegUndo(ImpGetResStr(STR_EditRipUp), GetDescriptionOfMarkedPoints());
+
+ for(sal_uInt32 nMarkNum(nMarkAnz); nMarkNum > 0L;)
+ {
+ nMarkNum--;
+ SdrMark* pM = GetSdrMarkByIndex(nMarkNum);
+ SdrUShortCont* pPts = pM->GetMarkedPoints();
+ SdrPathObj* pObj = PTR_CAST(SdrPathObj, pM->GetMarkedSdrObj());
+
+ if(pPts && pObj)
+ {
+ pPts->ForceSort();
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
+ sal_Bool bKorregFlag(sal_False);
+ sal_Bool bInsAny(sal_False);
+ sal_uInt32 nMarkPtsAnz(pPts->GetCount());
+ sal_uInt32 nMax(pObj->GetHdlCount());
+
+ for(sal_uInt32 i(nMarkPtsAnz); i > 0L;)
+ {
+ i--;
+ sal_uInt32 nNewPt0Idx(0L);
+ SdrObject* pNeuObj = pObj->RipPoint(pPts->GetObject(i), nNewPt0Idx);
+
+ if(pNeuObj)
+ {
+ bInsAny = sal_True;
+ SdrInsertReason aReason(SDRREASON_VIEWCALL, pObj);
+ pM->GetPageView()->GetObjList()->InsertObject(pNeuObj, pObj->GetOrdNum() + 1, &aReason);
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pNeuObj));
+ MarkObj(pNeuObj, pM->GetPageView(), sal_False, sal_True);
+ }
+
+ if(nNewPt0Idx)
+ {
+ // Korrektur notwendig?
+ DBG_ASSERT(bKorregFlag==sal_False,"Mehrfache Indexkorrektur bei SdrPolyEditView::RipUp()");
+ if(!bKorregFlag)
+ {
+ bKorregFlag = sal_True;
+
+ for(sal_uInt32 nBla(0L); nBla < nMarkPtsAnz; nBla++)
+ {
+ sal_uInt32 nPntNum(pPts->GetObject(nBla));
+ nPntNum += nNewPt0Idx;
+
+ if(nPntNum >= nMax)
+ {
+ nPntNum -= nMax;
+ }
+
+ pPts->Replace((sal_uInt16)nPntNum, nBla);
+ }
+
+ i = nMarkPtsAnz; // ... und nochmal von vorn
+ }
+ }
+ }
+ }
+ }
+
+ UnmarkAllPoints();
+ if( bUndo )
+ EndUndo();
+ MarkListHasChanged();
+ }
+}
+
+bool SdrPolyEditView::IsRipUpAtMarkedPointsPossible() const
+{
+ bool bRetval(false);
+ const sal_uInt32 nMarkCount(GetMarkedObjectCount());
+
+ for(sal_uInt32 a(0); a < nMarkCount; a++)
+ {
+ const SdrMark* pMark = GetSdrMarkByIndex(a);
+ const SdrPathObj* pMarkedPathObject = dynamic_cast< const SdrPathObj* >(pMark->GetMarkedSdrObj());
+
+ if(pMarkedPathObject)
+ {
+ const SdrUShortCont* pSelectedPoints = pMark->GetMarkedPoints();
+
+ if(pSelectedPoints && pSelectedPoints->GetCount())
+ {
+ const basegfx::B2DPolyPolygon& rPathPolyPolygon = pMarkedPathObject->GetPathPoly();
+
+ if(1 == rPathPolyPolygon.count())
+ {
+ // #i76617# Do not yet use basegfx::B2DPolygon since curve definitions
+ // are different and methods need to be changed thoroughly with interaction rework
+ const Polygon aPathPolygon(rPathPolyPolygon.getB2DPolygon(0));
+ const sal_uInt16 nPointCount(aPathPolygon.GetSize());
+
+ if(nPointCount >= 3)
+ {
+ bRetval = pMarkedPathObject->IsClosedObj(); // #i76617# aPathPolygon.isClosed();
+
+ for(sal_uInt32 b(0); !bRetval && b < pSelectedPoints->GetCount(); b++)
+ {
+ const sal_uInt16 nMarkedPointNum(pSelectedPoints->GetObject(b));
+
+ bRetval = (nMarkedPointNum > 0 && nMarkedPointNum < nPointCount - 1);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return bRetval;
+}
+
+bool SdrPolyEditView::IsOpenCloseMarkedObjectsPossible() const
+{
+ bool bRetval(false);
+ const sal_uInt32 nMarkCount(GetMarkedObjectCount());
+
+ for(sal_uInt32 a(0); a < nMarkCount; a++)
+ {
+ const SdrMark* pMark = GetSdrMarkByIndex(a);
+ const SdrPathObj* pMarkedPathObject = dynamic_cast< const SdrPathObj* >(pMark->GetMarkedSdrObj());
+
+ if(pMarkedPathObject)
+ {
+ // #i76617# Do not yet use basegfx::B2DPolygon since curve definitions
+ // are different and methods need to be changed thoroughly with interaction rework
+ const PolyPolygon aPathPolyPolygon(pMarkedPathObject->GetPathPoly());
+ const sal_uInt16 nPolygonCount(aPathPolyPolygon.Count());
+
+ for(sal_uInt16 b(0); !bRetval && b < nPolygonCount; b++)
+ {
+ const Polygon& rPathPolygon = aPathPolyPolygon[b];
+ const sal_uInt16 nPointCount(rPathPolygon.GetSize());
+
+ bRetval = (nPointCount >= 3);
+ }
+ }
+ }
+
+ return bRetval;
+}
+
+SdrObjClosedKind SdrPolyEditView::GetMarkedObjectsClosedState() const
+{
+ bool bOpen(false);
+ bool bClosed(false);
+ const sal_uInt32 nMarkCount(GetMarkedObjectCount());
+
+ for(sal_uInt32 a(0); !(bOpen && bClosed) && a < nMarkCount; a++)
+ {
+ const SdrMark* pMark = GetSdrMarkByIndex(a);
+ const SdrPathObj* pMarkedPathObject = dynamic_cast< const SdrPathObj* >(pMark->GetMarkedSdrObj());
+
+ if(pMarkedPathObject)
+ {
+ if(pMarkedPathObject->IsClosedObj())
+ {
+ bClosed = true;
+ }
+ else
+ {
+ bOpen = true;
+ }
+ }
+ }
+
+ if(bOpen && bClosed)
+ {
+ return SDROBJCLOSED_DONTCARE;
+ }
+ else if(bOpen)
+ {
+ return SDROBJCLOSED_OPEN;
+ }
+ else
+ {
+ return SDROBJCLOSED_CLOSED;
+ }
+}
+
+void SdrPolyEditView::ShutMarkedObjects()
+{
+ CloseMarkedObjects();
+}
+
+void SdrPolyEditView::CloseMarkedObjects(sal_Bool bToggle, sal_Bool bOpen) // , long nOpenDistance)
+{
+ if (AreObjectsMarked())
+ {
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ BegUndo(ImpGetResStr(STR_EditShut),GetDescriptionOfMarkedPoints());
+
+ bool bChg=false;
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
+ {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pO=pM->GetMarkedSdrObj();
+ sal_Bool bClosed=pO->IsClosedObj();
+ if (pO->IsPolyObj() && (bClosed==bOpen) || bToggle)
+ {
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO));
+
+ SdrPathObj* pPathObj = dynamic_cast< SdrPathObj* >( pO );
+ if(pPathObj)
+ pPathObj->ToggleClosed();
+ bChg=true;
+ }
+ }
+
+ if( bUndo )
+ EndUndo();
+
+ if (bChg)
+ {
+ UnmarkAllPoints();
+ MarkListHasChanged();
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrPolyEditView::ImpCopyMarkedPoints()
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrPolyEditView::ImpTransformMarkedPoints(PPolyTrFunc pTrFunc, const void* p1, const void* p2, const void* p3, const void* p4, const void* p5)
+{
+ const bool bUndo = IsUndoEnabled();
+
+ sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
+ for (sal_uIntPtr nm=0; nm<nMarkAnz; nm++)
+ {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ const SdrUShortCont* pPts=pM->GetMarkedPoints();
+ sal_uIntPtr nPtAnz=pPts==NULL ? 0 : pPts->GetCount();
+ SdrPathObj* pPath=PTR_CAST(SdrPathObj,pObj);
+ if (nPtAnz!=0 && pPath!=NULL)
+ {
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
+
+ basegfx::B2DPolyPolygon aXPP(pPath->GetPathPoly());
+
+ for(sal_uInt32 nPtNum(0L); nPtNum < nPtAnz; nPtNum++)
+ {
+ sal_uInt32 nPt(pPts->GetObject(nPtNum));
+ sal_uInt32 nPolyNum, nPointNum;
+
+ if(PolyPolygonEditor::GetRelativePolyPoint(aXPP, nPt, nPolyNum, nPointNum))
+ {
+ //#i83671# used nLocalPointNum (which was the polygon point count)
+ // instead of the point index (nPointNum). This of course leaded
+ // to a wrong point access to the B2DPolygon.
+ basegfx::B2DPolygon aNewXP(aXPP.getB2DPolygon(nPolyNum));
+ Point aPos, aC1, aC2;
+ bool bC1(false);
+ bool bC2(false);
+
+ const basegfx::B2DPoint aB2DPos(aNewXP.getB2DPoint(nPointNum));
+ aPos = Point(FRound(aB2DPos.getX()), FRound(aB2DPos.getY()));
+
+ if(aNewXP.isPrevControlPointUsed(nPointNum))
+ {
+ const basegfx::B2DPoint aB2DC1(aNewXP.getPrevControlPoint(nPointNum));
+ aC1 = Point(FRound(aB2DC1.getX()), FRound(aB2DC1.getY()));
+ bC1 = true;
+ }
+
+ if(aNewXP.isNextControlPointUsed(nPointNum))
+ {
+ const basegfx::B2DPoint aB2DC2(aNewXP.getNextControlPoint(nPointNum));
+ aC2 = Point(FRound(aB2DC2.getX()), FRound(aB2DC2.getY()));
+ bC2 = true;
+ }
+
+ (*pTrFunc)(aPos,&aC1,&aC2,p1,p2,p3,p4,p5);
+ aNewXP.setB2DPoint(nPointNum, basegfx::B2DPoint(aPos.X(), aPos.Y()));
+
+ if (bC1)
+ {
+ aNewXP.setPrevControlPoint(nPointNum, basegfx::B2DPoint(aC1.X(), aC1.Y()));
+ }
+
+ if (bC2)
+ {
+ aNewXP.setNextControlPoint(nPointNum, basegfx::B2DPoint(aC2.X(), aC2.Y()));
+ }
+
+ aXPP.setB2DPolygon(nPolyNum, aNewXP);
+ }
+ }
+
+ pPath->SetPathPoly(aXPP);
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+static void ImpMove(Point& rPt, Point* pC1, Point* pC2, const void* p1, const void* /*p2*/, const void* /*p3*/, const void* /*p4*/, const void* /*p5*/)
+{
+ MovePoint(rPt,*(const Size*)p1);
+ if (pC1!=NULL) MovePoint(*pC1,*(const Size*)p1);
+ if (pC2!=NULL) MovePoint(*pC2,*(const Size*)p1);
+}
+
+void SdrPolyEditView::MoveMarkedPoints(const Size& rSiz, bool bCopy)
+{
+ bCopy=sal_False; // noch nicht implementiert
+ ForceUndirtyMrkPnt();
+ XubString aStr(ImpGetResStr(STR_EditMove));
+ if (bCopy) aStr+=ImpGetResStr(STR_EditWithCopy);
+ BegUndo(aStr,GetDescriptionOfMarkedPoints(),SDRREPFUNC_OBJ_MOVE);
+ if (bCopy) ImpCopyMarkedPoints();
+ ImpTransformMarkedPoints(ImpMove,&rSiz);
+ EndUndo();
+ AdjustMarkHdl();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+static void ImpResize(Point& rPt, Point* pC1, Point* pC2, const void* p1, const void* p2, const void* p3, const void* /*p4*/, const void* /*p5*/)
+{
+ ResizePoint(rPt,*(const Point*)p1,*(const Fraction*)p2,*(const Fraction*)p3);
+ if (pC1!=NULL) ResizePoint(*pC1,*(const Point*)p1,*(const Fraction*)p2,*(const Fraction*)p3);
+ if (pC2!=NULL) ResizePoint(*pC2,*(const Point*)p1,*(const Fraction*)p2,*(const Fraction*)p3);
+}
+
+void SdrPolyEditView::ResizeMarkedPoints(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy)
+{
+ bCopy=sal_False; // noch nicht implementiert
+ ForceUndirtyMrkPnt();
+ XubString aStr(ImpGetResStr(STR_EditResize));
+ if (bCopy) aStr+=ImpGetResStr(STR_EditWithCopy);
+ BegUndo(aStr,GetDescriptionOfMarkedPoints(),SDRREPFUNC_OBJ_RESIZE);
+ if (bCopy) ImpCopyMarkedPoints();
+ ImpTransformMarkedPoints(ImpResize,&rRef,&xFact,&yFact);
+ EndUndo();
+ AdjustMarkHdl();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+static void ImpRotate(Point& rPt, Point* pC1, Point* pC2, const void* p1, const void* /*p2*/, const void* p3, const void* p4, const void* /*p5*/)
+{
+ RotatePoint(rPt,*(const Point*)p1,*(const double*)p3,*(const double*)p4);
+ if (pC1!=NULL) RotatePoint(*pC1,*(const Point*)p1,*(const double*)p3,*(const double*)p4);
+ if (pC2!=NULL) RotatePoint(*pC2,*(const Point*)p1,*(const double*)p3,*(const double*)p4);
+}
+
+void SdrPolyEditView::RotateMarkedPoints(const Point& rRef, long nWink, bool bCopy)
+{
+ bCopy=sal_False; // noch nicht implementiert
+ ForceUndirtyMrkPnt();
+ XubString aStr(ImpGetResStr(STR_EditResize));
+ if (bCopy) aStr+=ImpGetResStr(STR_EditWithCopy);
+ BegUndo(aStr,GetDescriptionOfMarkedPoints(),SDRREPFUNC_OBJ_ROTATE);
+ if (bCopy) ImpCopyMarkedPoints();
+ double nSin=sin(nWink*nPi180);
+ double nCos=cos(nWink*nPi180);
+ ImpTransformMarkedPoints(ImpRotate,&rRef,&nWink,&nSin,&nCos);
+ EndUndo();
+ AdjustMarkHdl();
+}
+
+// eof
diff --git a/svx/source/svdraw/svdsnpv.cxx b/svx/source/svdraw/svdsnpv.cxx
new file mode 100644
index 000000000000..d44be3d6bab0
--- /dev/null
+++ b/svx/source/svdraw/svdsnpv.cxx
@@ -0,0 +1,730 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svdsnpv.hxx>
+#include <math.h>
+
+#include <svx/svdetc.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdpage.hxx>
+#include "svx/svditer.hxx"
+#include <svx/sdr/overlay/overlayobjectlist.hxx>
+#include <svx/sdr/overlay/overlaycrosshair.hxx>
+#include <svx/sdr/overlay/overlayhelpline.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdrpaintwindow.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// #114409#-1 Migrate PageOrigin
+class ImplPageOriginOverlay
+{
+ // The OverlayObjects
+ ::sdr::overlay::OverlayObjectList maObjects;
+
+ // The current position in logical coodinates
+ basegfx::B2DPoint maPosition;
+
+public:
+ ImplPageOriginOverlay(const SdrPaintView& rView, const basegfx::B2DPoint& rStartPos);
+ ~ImplPageOriginOverlay();
+
+ void SetPosition(const basegfx::B2DPoint& rNewPosition);
+};
+
+ImplPageOriginOverlay::ImplPageOriginOverlay(const SdrPaintView& rView, const basegfx::B2DPoint& rStartPos)
+: maPosition(rStartPos)
+{
+ for(sal_uInt32 a(0L); a < rView.PaintWindowCount(); a++)
+ {
+ SdrPaintWindow* pCandidate = rView.GetPaintWindow(a);
+ ::sdr::overlay::OverlayManager* pTargetOverlay = pCandidate->GetOverlayManager();
+
+ if(pTargetOverlay)
+ {
+ ::sdr::overlay::OverlayCrosshairStriped* aNew = new ::sdr::overlay::OverlayCrosshairStriped(
+ maPosition);
+ pTargetOverlay->add(*aNew);
+ maObjects.append(*aNew);
+ }
+ }
+}
+
+ImplPageOriginOverlay::~ImplPageOriginOverlay()
+{
+ // The OverlayObjects are cleared using the destructor of OverlayObjectList.
+ // That destructor calls clear() at the list which removes all objects from the
+ // OverlayManager and deletes them.
+}
+
+void ImplPageOriginOverlay::SetPosition(const basegfx::B2DPoint& rNewPosition)
+{
+ if(rNewPosition != maPosition)
+ {
+ // apply to OverlayObjects
+ 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;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// #114409#-2 Migrate HelpLine
+class ImplHelpLineOverlay
+{
+ // The OverlayObjects
+ ::sdr::overlay::OverlayObjectList maObjects;
+
+ // The current position in logical coodinates
+ basegfx::B2DPoint maPosition;
+
+ // HelpLine specific stuff
+ SdrPageView* mpPageView;
+ sal_uInt16 mnHelpLineNumber;
+ SdrHelpLineKind meHelpLineKind;
+
+public:
+ ImplHelpLineOverlay(const SdrPaintView& rView, const basegfx::B2DPoint& rStartPos,
+ SdrPageView* pPageView, sal_uInt16 nHelpLineNumber, SdrHelpLineKind eKind);
+ ~ImplHelpLineOverlay();
+
+ void SetPosition(const basegfx::B2DPoint& rNewPosition);
+
+ // access to HelpLine specific stuff
+ SdrPageView* GetPageView() const { return mpPageView; }
+ sal_uInt16 GetHelpLineNumber() const { return mnHelpLineNumber; }
+ SdrHelpLineKind GetHelpLineKind() const { return meHelpLineKind; }
+};
+
+ImplHelpLineOverlay::ImplHelpLineOverlay(
+ const SdrPaintView& rView, const basegfx::B2DPoint& rStartPos,
+ SdrPageView* pPageView, sal_uInt16 nHelpLineNumber, SdrHelpLineKind eKind)
+: maPosition(rStartPos),
+ mpPageView(pPageView),
+ mnHelpLineNumber(nHelpLineNumber),
+ meHelpLineKind(eKind)
+{
+ for(sal_uInt32 a(0L); a < rView.PaintWindowCount(); a++)
+ {
+ SdrPaintWindow* pCandidate = rView.GetPaintWindow(a);
+ ::sdr::overlay::OverlayManager* pTargetOverlay = pCandidate->GetOverlayManager();
+
+ if(pTargetOverlay)
+ {
+ ::sdr::overlay::OverlayHelplineStriped* aNew = new ::sdr::overlay::OverlayHelplineStriped(
+ maPosition, meHelpLineKind);
+ pTargetOverlay->add(*aNew);
+ maObjects.append(*aNew);
+ }
+ }
+}
+
+ImplHelpLineOverlay::~ImplHelpLineOverlay()
+{
+ // The OverlayObjects are cleared using the destructor of OverlayObjectList.
+ // That destructor calls clear() at the list which removes all objects from the
+ // OverlayManager and deletes them.
+}
+
+void ImplHelpLineOverlay::SetPosition(const basegfx::B2DPoint& rNewPosition)
+{
+ if(rNewPosition != maPosition)
+ {
+ // apply to OverlayObjects
+ // 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;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@ @@ @@ @@@@ @@@@@ @@ @@ @@ @@@@@ @@ @@
+// @@ @@ @@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@@@@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@
+// @@@@ @@@@@@ @@@@@@ @@@@@ @@@@@ @@ @@@@ @@@@@@@
+// @@ @@ @@@ @@ @@ @@ @@@ @@ @@ @@@@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@
+// @@@@ @@ @@ @@ @@ @@ @ @@ @@@@@ @@ @@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrSnapView::ClearVars()
+{
+ nMagnSizPix=4;
+ bSnapEnab=sal_True;
+ bGridSnap=sal_True;
+ bSnapTo1Pix=sal_True;
+ bBordSnap=sal_True;
+ bHlplSnap=sal_True;
+ bOFrmSnap=sal_True;
+ bOPntSnap=sal_False;
+ bOConSnap=sal_True;
+ bMoveMFrmSnap=sal_True;
+ bMoveOFrmSnap=sal_True;
+ bMoveOPntSnap=sal_True;
+ bMoveOConSnap=sal_True;
+ bMoveSnapOnlyTopLeft=sal_False;
+ bOrtho=sal_False;
+ bBigOrtho=sal_True;
+ nSnapAngle=1500;
+ bAngleSnapEnab=sal_False;
+ bMoveOnlyDragging=sal_False;
+ bSlantButShear=sal_False;
+ bCrookNoContortion=sal_False;
+ eCrookMode=SDRCROOK_ROTATE;
+ bHlplFixed=sal_False;
+ bEliminatePolyPoints=sal_False;
+ nEliminatePolyPointLimitAngle=0;
+
+ // #114409#-1 Migrate PageOrigin
+ BrkSetPageOrg();
+
+ // #114409#-2 Migrate HelpLine
+ BrkDragHelpLine();
+}
+
+SdrSnapView::SdrSnapView(SdrModel* pModel1, OutputDevice* pOut):
+ SdrPaintView(pModel1,pOut),
+ // #114409#-1 Migrate PageOrigin
+ mpPageOriginOverlay(0L),
+ // #114409#-2 Migrate HelpLine
+ mpHelpLineOverlay(0L)
+{
+ ClearVars();
+}
+
+// #114409#-1 Migrate PageOrigin
+SdrSnapView::~SdrSnapView()
+{
+ // #114409#-1 Migrate PageOrigin
+ BrkSetPageOrg();
+
+ // #114409#-2 Migrate HelpLine
+ BrkDragHelpLine();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_Bool SdrSnapView::IsAction() const
+{
+ return IsSetPageOrg() || IsDragHelpLine() || SdrPaintView::IsAction();
+}
+
+void SdrSnapView::MovAction(const Point& rPnt)
+{
+ SdrPaintView::MovAction(rPnt);
+ if (IsSetPageOrg()) {
+ MovSetPageOrg(rPnt);
+ }
+ if (IsDragHelpLine()) {
+ MovDragHelpLine(rPnt);
+ }
+}
+
+void SdrSnapView::EndAction()
+{
+ if (IsSetPageOrg()) {
+ EndSetPageOrg();
+ }
+ if (IsDragHelpLine()) {
+ EndDragHelpLine();
+ }
+ SdrPaintView::EndAction();
+}
+
+void SdrSnapView::BckAction()
+{
+ BrkSetPageOrg();
+ BrkDragHelpLine();
+ SdrPaintView::BckAction();
+}
+
+void SdrSnapView::BrkAction()
+{
+ BrkSetPageOrg();
+ BrkDragHelpLine();
+ SdrPaintView::BrkAction();
+}
+
+void SdrSnapView::TakeActionRect(Rectangle& rRect) const
+{
+ if (IsSetPageOrg() || IsDragHelpLine()) {
+ rRect=Rectangle(aDragStat.GetNow(),aDragStat.GetNow());
+ } else {
+ SdrPaintView::TakeActionRect(rRect);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+Point SdrSnapView::GetSnapPos(const Point& rPnt, const SdrPageView* pPV) const
+{
+ Point aPt(rPnt);
+ SnapPos(aPt,pPV);
+ return aPt;
+}
+
+#define NOT_SNAPPED 0x7FFFFFFF
+sal_uInt16 SdrSnapView::SnapPos(Point& rPnt, const SdrPageView* pPV) const
+{
+ if (!bSnapEnab) return SDRSNAP_NOTSNAPPED;
+ sal_Bool bPVOfs=sal_False;
+ long x=rPnt.X();
+ long y=rPnt.Y();
+ if (pPV==NULL) {
+ bPVOfs=sal_True;
+ pPV=GetSdrPageView();
+ if (pPV==NULL) return SDRSNAP_NOTSNAPPED;
+ }
+
+ long dx=NOT_SNAPPED;
+ long dy=NOT_SNAPPED;
+ long dx1,dy1;
+ long mx=aMagnSiz.Width();
+ long my=aMagnSiz.Height();
+ if (bHlplVisible && bHlplSnap && !IsDragHelpLine())
+ {
+ const SdrHelpLineList& rHLL=pPV->GetHelpLines();
+ sal_uInt16 nAnz=rHLL.GetCount();
+ for (sal_uInt16 i=nAnz; i>0;) {
+ i--;
+ const SdrHelpLine& rHL=rHLL[i];
+ const Point& rPos=rHL.GetPos();
+ switch (rHL.GetKind()) {
+ case SDRHELPLINE_VERTICAL: {
+ long a=x-rPos.X();
+ if (Abs(a)<=mx) { dx1=-a; if (Abs(dx1)<Abs(dx)) dx=dx1; }
+ } break;
+ case SDRHELPLINE_HORIZONTAL: {
+ long b=y-rPos.Y();
+ if (Abs(b)<=my) { dy1=-b; if (Abs(dy1)<Abs(dy)) dy=dy1; }
+ } break;
+ case SDRHELPLINE_POINT: {
+ long a=x-rPos.X();
+ long b=y-rPos.Y();
+ if (Abs(a)<=mx && Abs(b)<=my) {
+ dx1=-a; dy1=-b;
+ if (Abs(dx1)<Abs(dx) && Abs(dy1)<Abs(dy)) { dx=dx1; dy=dy1; }
+ }
+ } break;
+ } // switch
+ }
+ }
+ if (bBordVisible && bBordSnap) {
+ SdrPage* pPage=pPV->GetPage();
+ long xs=pPage->GetWdt();
+ long ys=pPage->GetHgt();
+ long lft=pPage->GetLftBorder();
+ long rgt=pPage->GetRgtBorder();
+ long upp=pPage->GetUppBorder();
+ long lwr=pPage->GetLwrBorder();
+ long a;
+ a=x- lft ; if (Abs(a)<=mx) { dx1=-a; if (Abs(dx1)<Abs(dx)) dx=dx1; } // linker Rand
+ a=x-(xs-rgt); if (Abs(a)<=mx) { dx1=-a; if (Abs(dx1)<Abs(dx)) dx=dx1; } // rechter Rand
+ a=x ; if (Abs(a)<=mx) { dx1=-a; if (Abs(dx1)<Abs(dx)) dx=dx1; } // linke Papierkante
+ a=x- xs ; if (Abs(a)<=mx) { dx1=-a; if (Abs(dx1)<Abs(dx)) dx=dx1; } // rechte Papierkante
+ a=y- upp ; if (Abs(a)<=my) { dy1=-a; if (Abs(dy1)<Abs(dy)) dy=dy1; } // linker Rand
+ a=y-(ys-lwr); if (Abs(a)<=my) { dy1=-a; if (Abs(dy1)<Abs(dy)) dy=dy1; } // rechter Rand
+ a=y ; if (Abs(a)<=my) { dy1=-a; if (Abs(dy1)<Abs(dy)) dy=dy1; } // linke Papierkante
+ a=y- ys ; if (Abs(a)<=my) { dy1=-a; if (Abs(dy1)<Abs(dy)) dy=dy1; } // rechte Papierkante
+ }
+ if (bOFrmSnap || bOPntSnap /*|| (bConnVisible && bOConSnap)*/) {
+ sal_uIntPtr nMaxPointSnapCount=200;
+ sal_uIntPtr nMaxFrameSnapCount=200;
+
+ // #97981# go back to IM_DEEPNOGROUPS runthrough for snap to object comparisons
+ SdrObjListIter aIter(*pPV->GetPage(),/*IM_FLAT*/IM_DEEPNOGROUPS,sal_True);
+
+ while (aIter.IsMore() && (nMaxPointSnapCount>0 || nMaxFrameSnapCount>0)) {
+ SdrObject* pO=aIter.Next();
+ Rectangle aRect(pO->GetCurrentBoundRect());
+ aRect.Left ()-=mx;
+ aRect.Right ()+=mx;
+ aRect.Top ()-=my;
+ aRect.Bottom()+=my;
+ if (aRect.IsInside(rPnt)) {
+ if (bOPntSnap && nMaxPointSnapCount>0)
+ {
+ sal_uInt32 nAnz(pO->GetSnapPointCount());
+ for (sal_uInt32 i(0L); i < nAnz && nMaxPointSnapCount > 0L; i++)
+ {
+ Point aP(pO->GetSnapPoint(i));
+ dx1=x-aP.X();
+ dy1=y-aP.Y();
+ if (Abs(dx1)<=mx && Abs(dy1)<=my && Abs(dx1)<Abs(dx) && Abs(dy1)<Abs(dy)) {
+ dx=-dx1;
+ dy=-dy1;
+ }
+ nMaxPointSnapCount--;
+ }
+ }
+ if (bOFrmSnap && nMaxFrameSnapCount>0) {
+ Rectangle aLog(pO->GetSnapRect());
+ Rectangle aR1(aLog);
+ aR1.Left ()-=mx;
+ aR1.Right ()+=mx;
+ aR1.Top ()-=my;
+ aR1.Bottom()+=my;
+ if (aR1.IsInside(rPnt)) {
+ if (Abs(x-aLog.Left ())<=mx) { dx1=-(x-aLog.Left ()); if (Abs(dx1)<Abs(dx)) dx=dx1; }
+ if (Abs(x-aLog.Right ())<=mx) { dx1=-(x-aLog.Right ()); if (Abs(dx1)<Abs(dx)) dx=dx1; }
+ if (Abs(y-aLog.Top ())<=my) { dy1=-(y-aLog.Top ()); if (Abs(dy1)<Abs(dy)) dy=dy1; }
+ if (Abs(y-aLog.Bottom())<=my) { dy1=-(y-aLog.Bottom()); if (Abs(dy1)<Abs(dy)) dy=dy1; }
+ }
+ nMaxFrameSnapCount--;
+ }
+ }
+ }
+ }
+ if(bGridSnap)
+ {
+ double fSnapWidth = aSnapWdtX;
+ if(dx == NOT_SNAPPED && fSnapWidth != 0.0)
+ {
+ double fx = (double)x;
+
+ // round statt trunc
+ if(fx - (double)pPV->GetPageOrigin().X() >= 0.0)
+ fx += fSnapWidth / 2.0;
+ else
+ fx -= fSnapWidth / 2.0;
+
+ x = (long)((fx - (double)pPV->GetPageOrigin().X()) / fSnapWidth);
+ x = (long)((double)x * fSnapWidth + (double)pPV->GetPageOrigin().X());
+ dx = 0;
+ }
+ fSnapWidth = aSnapWdtY;
+ if(dy == NOT_SNAPPED && fSnapWidth)
+ {
+ double fy = (double)y;
+
+ // round statt trunc
+ if(fy - (double)pPV->GetPageOrigin().Y() >= 0.0)
+ fy += fSnapWidth / 2.0;
+ else
+ fy -= fSnapWidth / 2.0;
+
+ y = (long)((fy - (double)pPV->GetPageOrigin().Y()) / fSnapWidth);
+ y = (long)((double)y * fSnapWidth + (double)pPV->GetPageOrigin().Y());
+ dy = 0;
+ }
+ }
+ sal_Bool bRet=SDRSNAP_NOTSNAPPED;
+ if (dx==NOT_SNAPPED) dx=0; else bRet|=SDRSNAP_XSNAPPED;
+ if (dy==NOT_SNAPPED) dy=0; else bRet|=SDRSNAP_YSNAPPED;
+ rPnt.X()=x+dx;
+ rPnt.Y()=y+dy;
+ return bRet;
+}
+
+void SdrSnapView::CheckSnap(const Point& rPt, const SdrPageView* pPV, long& nBestXSnap, long& nBestYSnap, bool& bXSnapped, bool& bYSnapped) const
+{
+ Point aPt(rPt);
+ sal_uInt16 nRet=SnapPos(aPt,pPV);
+ aPt-=rPt;
+ if ((nRet & SDRSNAP_XSNAPPED) !=0) {
+ if (bXSnapped) {
+ if (Abs(aPt.X())<Abs(nBestXSnap)) {
+ nBestXSnap=aPt.X();
+ }
+ } else {
+ nBestXSnap=aPt.X();
+ bXSnapped=sal_True;
+ }
+ }
+ if ((nRet & SDRSNAP_YSNAPPED) !=0) {
+ if (bYSnapped) {
+ if (Abs(aPt.Y())<Abs(nBestYSnap)) {
+ nBestYSnap=aPt.Y();
+ }
+ } else {
+ nBestYSnap=aPt.Y();
+ bYSnapped=sal_True;
+ }
+ }
+}
+
+sal_uInt16 SdrSnapView::SnapRect(const Rectangle& rRect, const SdrPageView* pPV, long& rDX, long& rDY) const
+{
+ long nBestXSnap=0;
+ long nBestYSnap=0;
+ bool bXSnapped=sal_False;
+ bool bYSnapped=sal_False;
+ CheckSnap(rRect.TopLeft() ,pPV,nBestXSnap,nBestYSnap,bXSnapped,bYSnapped);
+ if (!bMoveSnapOnlyTopLeft) {
+ CheckSnap(rRect.TopRight() ,pPV,nBestXSnap,nBestYSnap,bXSnapped,bYSnapped);
+ CheckSnap(rRect.BottomLeft() ,pPV,nBestXSnap,nBestYSnap,bXSnapped,bYSnapped);
+ CheckSnap(rRect.BottomRight(),pPV,nBestXSnap,nBestYSnap,bXSnapped,bYSnapped);
+ }
+ rDX=nBestXSnap;
+ rDY=nBestYSnap;
+ sal_uInt16 nRet=0;
+ if (bXSnapped) nRet+=SDRSNAP_XSNAPPED;
+ if (bYSnapped) nRet+=SDRSNAP_YSNAPPED;
+ return nRet;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_Bool SdrSnapView::BegSetPageOrg(const Point& rPnt)
+{
+ BrkAction();
+
+ DBG_ASSERT(0L == mpPageOriginOverlay, "SdrSnapView::BegSetPageOrg: There exists a ImplPageOriginOverlay (!)");
+ basegfx::B2DPoint aStartPos(rPnt.X(), rPnt.Y());
+ mpPageOriginOverlay = new ImplPageOriginOverlay(*this, aStartPos);
+ aDragStat.Reset(GetSnapPos(rPnt,NULL));
+
+ return sal_True;
+}
+
+void SdrSnapView::MovSetPageOrg(const Point& rPnt)
+{
+ if(IsSetPageOrg())
+ {
+ aDragStat.NextMove(GetSnapPos(rPnt,NULL));
+ DBG_ASSERT(mpPageOriginOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
+ basegfx::B2DPoint aNewPos(aDragStat.GetNow().X(), aDragStat.GetNow().Y());
+ mpPageOriginOverlay->SetPosition(aNewPos);
+ }
+}
+
+sal_Bool SdrSnapView::EndSetPageOrg()
+{
+ sal_Bool bRet(sal_False);
+
+ if(IsSetPageOrg())
+ {
+ SdrPageView* pPV = GetSdrPageView();
+
+ if(pPV)
+ {
+ Point aPnt(aDragStat.GetNow());
+ pPV->SetPageOrigin(aPnt);
+ bRet = sal_True;
+ }
+
+ // cleanup
+ BrkSetPageOrg();
+ }
+
+ return bRet;
+}
+
+void SdrSnapView::BrkSetPageOrg()
+{
+ if(IsSetPageOrg())
+ {
+ DBG_ASSERT(mpPageOriginOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
+ delete mpPageOriginOverlay;
+ mpPageOriginOverlay = 0L;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_Bool SdrSnapView::PickHelpLine(const Point& rPnt, short nTol, const OutputDevice& rOut, sal_uInt16& rnHelpLineNum, SdrPageView*& rpPV) const
+{
+ rpPV=NULL;
+ nTol=ImpGetHitTolLogic(nTol,&rOut);
+ SdrPageView* pPV = GetSdrPageView();
+
+ if(pPV)
+ {
+ Point aPnt(rPnt);
+ sal_uInt16 nIndex=pPV->GetHelpLines().HitTest(aPnt,sal_uInt16(nTol),rOut);
+ if (nIndex!=SDRHELPLINE_NOTFOUND) {
+ rpPV=pPV;
+ rnHelpLineNum=nIndex;
+ return sal_True;
+ }
+ }
+ return sal_False;
+}
+
+// start HelpLine drag for new HelpLine
+sal_Bool SdrSnapView::BegDragHelpLine(sal_uInt16 nHelpLineNum, SdrPageView* pPV)
+{
+ sal_Bool bRet(sal_False);
+
+ if(!bHlplFixed)
+ {
+ BrkAction();
+
+ if(pPV && nHelpLineNum < pPV->GetHelpLines().GetCount())
+ {
+ const SdrHelpLineList& rHelpLines = pPV->GetHelpLines();
+ const SdrHelpLine& rHelpLine = rHelpLines[nHelpLineNum];
+ Point aHelpLinePos = rHelpLine.GetPos(); // + pPV->GetOffset();
+ basegfx::B2DPoint aStartPos(aHelpLinePos.X(), aHelpLinePos.Y());
+
+ DBG_ASSERT(0L == mpHelpLineOverlay, "SdrSnapView::BegDragHelpLine: There exists a ImplHelpLineOverlay (!)");
+ mpHelpLineOverlay = new ImplHelpLineOverlay(*this, aStartPos, pPV, nHelpLineNum, rHelpLine.GetKind());
+
+ aDragStat.Reset(GetSnapPos(aHelpLinePos, pPV));
+ aDragStat.SetMinMove(ImpGetMinMovLogic(-3, 0L));
+
+ bRet = sal_True;
+ }
+ }
+
+ return bRet;
+}
+
+// start HelpLine drag with existing HelpLine
+sal_Bool SdrSnapView::BegDragHelpLine(const Point& rPnt, SdrHelpLineKind eNewKind)
+{
+ sal_Bool bRet(sal_False);
+
+ BrkAction();
+
+ if(GetSdrPageView())
+ {
+ DBG_ASSERT(0L == mpHelpLineOverlay, "SdrSnapView::BegDragHelpLine: There exists a ImplHelpLineOverlay (!)");
+ basegfx::B2DPoint aStartPos(rPnt.X(), rPnt.Y());
+ mpHelpLineOverlay = new ImplHelpLineOverlay(*this, aStartPos, 0L, 0, eNewKind);
+ aDragStat.Reset(GetSnapPos(rPnt, 0L));
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+Pointer SdrSnapView::GetDraggedHelpLinePointer() const
+{
+ if(IsDragHelpLine())
+ {
+ switch(mpHelpLineOverlay->GetHelpLineKind())
+ {
+ case SDRHELPLINE_VERTICAL : return Pointer(POINTER_ESIZE);
+ case SDRHELPLINE_HORIZONTAL: return Pointer(POINTER_SSIZE);
+ default : return Pointer(POINTER_MOVE);
+ }
+ }
+
+ return Pointer(POINTER_MOVE);
+}
+
+void SdrSnapView::MovDragHelpLine(const Point& rPnt)
+{
+ if(IsDragHelpLine() && aDragStat.CheckMinMoved(rPnt))
+ {
+ Point aPnt(GetSnapPos(rPnt, 0L));
+
+ if(aPnt != aDragStat.GetNow())
+ {
+ aDragStat.NextMove(aPnt);
+ DBG_ASSERT(mpHelpLineOverlay, "SdrSnapView::MovDragHelpLine: no ImplHelpLineOverlay (!)");
+ basegfx::B2DPoint aNewPos(aDragStat.GetNow().X(), aDragStat.GetNow().Y());
+ mpHelpLineOverlay->SetPosition(aNewPos);
+ }
+ }
+}
+
+sal_Bool SdrSnapView::EndDragHelpLine()
+{
+ sal_Bool bRet(sal_False);
+
+ if(IsDragHelpLine())
+ {
+ if(aDragStat.IsMinMoved())
+ {
+ SdrPageView* pPageView = mpHelpLineOverlay->GetPageView();
+
+ if(pPageView)
+ {
+ // moved existing one
+ Point aPnt(aDragStat.GetNow());
+ const SdrHelpLineList& rHelpLines = pPageView->GetHelpLines();
+ SdrHelpLine aChangedHelpLine = rHelpLines[mpHelpLineOverlay->GetHelpLineNumber()];
+ aChangedHelpLine.SetPos(aPnt);
+ pPageView->SetHelpLine(mpHelpLineOverlay->GetHelpLineNumber(), aChangedHelpLine);
+
+ bRet = sal_True;
+ }
+ else
+ {
+ // create new one
+ pPageView = GetSdrPageView();
+
+ if(pPageView)
+ {
+ Point aPnt(aDragStat.GetNow());
+ SdrHelpLine aNewHelpLine(mpHelpLineOverlay->GetHelpLineKind(), aPnt);
+ pPageView->InsertHelpLine(aNewHelpLine);
+
+ bRet = sal_True;
+ }
+ }
+ }
+
+ // cleanup
+ BrkDragHelpLine();
+ }
+
+ return bRet;
+}
+
+void SdrSnapView::BrkDragHelpLine()
+{
+ if(IsDragHelpLine())
+ {
+ DBG_ASSERT(mpHelpLineOverlay, "SdrSnapView::EndDragHelpLine: no ImplHelpLineOverlay (!)");
+ delete mpHelpLineOverlay;
+ mpHelpLineOverlay = 0L;
+ }
+}
+
+// eof
diff --git a/svx/source/svdraw/svdstr.src b/svx/source/svdraw/svdstr.src
new file mode 100644
index 000000000000..6690d4a7618b
--- /dev/null
+++ b/svx/source/svdraw/svdstr.src
@@ -0,0 +1,2940 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/* StarView resource file */
+
+#include "svx/svdstr.hrc"
+ // Ab hier gecachte Strings
+String STR_ObjNameSingulNONE
+{
+ Text [ en-US ] = "draw object" ;
+};
+String STR_ObjNamePluralNONE
+{
+ Text [ en-US ] = "draw objects" ;
+};
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+String STR_ObjNameSingulGRUP
+{
+ Text [ en-US ] = "group object" ;
+};
+String STR_ObjNamePluralGRUP
+{
+ Text [ en-US ] = "group objects" ;
+};
+String STR_ObjNameSingulGRUPEMPTY
+{
+ Text [ en-US ] = "blank group object" ;
+};
+String STR_ObjNamePluralGRUPEMPTY
+{
+ Text [ en-US ] = "Blank group objects" ;
+};
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+String STR_ObjNameSingulLINE
+{
+ Text [ en-US ] = "Line" ;
+};
+String STR_ObjNameSingulLINE_Hori
+{
+ Text [ en-US ] = "horizontal line" ;
+};
+String STR_ObjNameSingulLINE_Vert
+{
+ Text [ en-US ] = "Vertical line" ;
+};
+String STR_ObjNameSingulLINE_Diag
+{
+ Text [ en-US ] = "diagonal line" ;
+};
+String STR_ObjNamePluralLINE
+{
+ Text [ en-US ] = "Lines" ;
+};
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+String STR_ObjNameSingulRECT
+{
+ Text [ en-US ] = "Rectangle" ;
+};
+String STR_ObjNamePluralRECT
+{
+ Text [ en-US ] = "Rectangles" ;
+};
+String STR_ObjNameSingulQUAD
+{
+ Text [ en-US ] = "Square" ;
+};
+String STR_ObjNamePluralQUAD
+{
+ Text [ en-US ] = "Squares" ;
+};
+String STR_ObjNameSingulPARAL
+{
+ Text [ en-US ] = "Parallelogram" ;
+};
+String STR_ObjNamePluralPARAL
+{
+ Text [ en-US ] = "Parallelograms" ;
+};
+String STR_ObjNameSingulRAUTE
+{
+ Text [ en-US ] = "Rhombus" ;
+};
+String STR_ObjNamePluralRAUTE
+{
+ Text [ en-US ] = "Rhombuses" ;
+};
+String STR_ObjNameSingulRECTRND
+{
+ Text [ en-US ] = "Rounded rectangle" ;
+};
+String STR_ObjNamePluralRECTRND
+{
+ Text [ en-US ] = "Rounded Rectangles" ;
+};
+String STR_ObjNameSingulQUADRND
+{
+ Text [ en-US ] = "rounded square" ;
+};
+String STR_ObjNamePluralQUADRND
+{
+ Text [ en-US ] = "Rounded Squares" ;
+};
+String STR_ObjNameSingulPARALRND
+{
+ Text [ en-US ] = "Rounded Parallelogram" ;
+};
+String STR_ObjNamePluralPARALRND
+{
+ Text [ en-US ] = "Rounded parallelograms" ;
+};
+String STR_ObjNameSingulRAUTERND
+{
+ Text [ en-US ] = "rounded rhombus" ;
+};
+String STR_ObjNamePluralRAUTERND
+{
+ Text [ en-US ] = "Rounded rhombuses" ;
+};
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+String STR_ObjNameSingulCIRC
+{
+ Text [ en-US ] = "Circle" ;
+};
+String STR_ObjNamePluralCIRC
+{
+ Text [ en-US ] = "Circles" ;
+};
+String STR_ObjNameSingulSECT
+{
+ Text [ en-US ] = "Circle sector" ;
+};
+String STR_ObjNamePluralSECT
+{
+ Text [ en-US ] = "Circle sectors" ;
+};
+String STR_ObjNameSingulCARC
+{
+ Text [ en-US ] = "Arc" ;
+};
+String STR_ObjNamePluralCARC
+{
+ Text [ en-US ] = "Arcs" ;
+};
+String STR_ObjNameSingulCCUT
+{
+ Text [ en-US ] = "Circle segment" ;
+};
+String STR_ObjNamePluralCCUT
+{
+ Text [ en-US ] = "Circle segments" ;
+};
+String STR_ObjNameSingulCIRCE
+{
+ Text [ en-US ] = "Ellipse" ;
+};
+String STR_ObjNamePluralCIRCE
+{
+ Text [ en-US ] = "Ellipses" ;
+};
+String STR_ObjNameSingulSECTE
+{
+ Text [ en-US ] = "Ellipse Pie" ;
+};
+String STR_ObjNamePluralSECTE
+{
+ Text [ en-US ] = "Ellipse Pies" ;
+};
+String STR_ObjNameSingulCARCE
+{
+ Text [ en-US ] = "Elliptical arc" ;
+};
+String STR_ObjNamePluralCARCE
+{
+ Text [ en-US ] = "Elliptical arcs" ;
+};
+String STR_ObjNameSingulCCUTE
+{
+ Text [ en-US ] = "Ellipse Segment" ;
+};
+String STR_ObjNamePluralCCUTE
+{
+ Text [ en-US ] = "Ellipse Segments" ;
+};
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+String STR_ObjNameSingulPOLY
+{
+ Text [ en-US ] = "Polygon" ;
+};
+String STR_ObjNameSingulPOLY_PntAnz
+{
+ Text [ en-US ] = "Polygon %2 corners" ;
+};
+String STR_ObjNamePluralPOLY
+{
+ Text [ en-US ] = "Polygons" ;
+};
+String STR_ObjNameSingulPLIN
+{
+ Text [ en-US ] = "Polyline" ;
+};
+String STR_ObjNameSingulPLIN_PntAnz
+{
+ Text [ en-US ] = "Polyline with %2 corners" ;
+};
+String STR_ObjNamePluralPLIN
+{
+ Text [ en-US ] = "Polylines" ;
+};
+String STR_ObjNameSingulPATHLINE
+{
+ Text [ en-US ] = "Bézier curve" ;
+};
+String STR_ObjNamePluralPATHLINE
+{
+ Text [ en-US ] = "Bézier curves" ;
+};
+String STR_ObjNameSingulPATHFILL
+{
+ Text [ en-US ] = "Bézier curve" ;
+};
+String STR_ObjNamePluralPATHFILL
+{
+ Text [ en-US ] = "Bézier curves" ;
+};
+String STR_ObjNameSingulFREELINE
+{
+ Text [ en-US ] = "Freeform Line" ;
+};
+String STR_ObjNamePluralFREELINE
+{
+ Text [ en-US ] = "Freeform Lines" ;
+};
+String STR_ObjNameSingulFREEFILL
+{
+ Text [ en-US ] = "Freeform Line" ;
+};
+String STR_ObjNamePluralFREEFILL
+{
+ Text [ en-US ] = "Freeform Lines" ;
+};
+String STR_ObjNameSingulCOMBLINE
+{
+ Text [ en-US ] = "Curve" ;
+};
+String STR_ObjNamePluralCOMBLINE
+{
+ Text [ en-US ] = "Curve objects" ;
+};
+String STR_ObjNameSingulCOMBFILL
+{
+ Text [ en-US ] = "Curve" ;
+};
+String STR_ObjNamePluralCOMBFILL
+{
+ Text [ en-US ] = "Curve objects" ;
+};
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+String STR_ObjNameSingulNATSPLN
+{
+ Text [ en-US ] = "Natural Spline" ;
+};
+String STR_ObjNamePluralNATSPLN
+{
+ Text [ en-US ] = "Natural Splines" ;
+};
+String STR_ObjNameSingulPERSPLN
+{
+ Text [ en-US ] = "Periodic Spline" ;
+};
+String STR_ObjNamePluralPERSPLN
+{
+ Text [ en-US ] = "Periodic Splines" ;
+};
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+String STR_ObjNameSingulTEXT
+{
+ Text [ en-US ] = "Text Frame" ;
+};
+String STR_ObjNamePluralTEXT
+{
+ Text [ en-US ] = "Text Frame" ;
+};
+String STR_ObjNameSingulTEXTLNK
+{
+ Text [ en-US ] = "Linked text frame" ;
+};
+String STR_ObjNamePluralTEXTLNK
+{
+ Text [ en-US ] = "Linked text frames" ;
+};
+ //String STR_ObjNameSingulXTXT {
+ // Text="Textfortsetzungsrahmen";
+ // Text[ENGLISH]="drawobject";
+ // Text[norwegian]="Tegneobjekt";
+ // Text[italian]="Disegna oggetto";
+ // Text[portuguese_brazilian]="Desenhar objeto";
+ // Text[portuguese]="Desenhar objecto";
+ // Text[finnish]="Piirto-objekti";
+ // Text[danish]="Tegneobjekt";
+ // Text[french]="Drawobject";
+ // Text[swedish]="Ritobjekt";
+ // Text[dutch]="Tekenobject";
+ // Text[spanish]="Objeto de dibujo";
+ // Text[english_us]="drawobject";
+ //};
+ //String STR_ObjNamePluralXTXT {
+ // Text="Textfortsetzungsrahmen";
+ // Text[ENGLISH]="drawobjects";
+ // Text[norwegian]="Tegneobjektr";
+ // Text[italian]="Disegna oggetti";
+ // Text[portuguese_brazilian]="Desenhar objetos";
+ // Text[portuguese]="Desenhar objectos";
+ // Text[finnish]="Piirto-objektit";
+ // Text[danish]="Tegneobjekter";
+ // Text[french]="Drawobjects";
+ // Text[swedish]="Ritobjekt";
+ // Text[dutch]="Tekenobjecten";
+ // Text[spanish]="Objetos de dibujo";
+ // Text[english_us]="drawobjects";
+ //};
+String STR_ObjNameSingulFITTEXT
+{
+ Text [ en-US ] = "Fit-to-size text object" ;
+};
+String STR_ObjNamePluralFITTEXT
+{
+ Text [ en-US ] = "Fit-to-size text objects" ;
+};
+String STR_ObjNameSingulFITALLTEXT
+{
+ Text [ en-US ] = "Fit-to-size text object" ;
+};
+String STR_ObjNamePluralFITALLTEXT
+{
+ Text [ en-US ] = "Fit-to-size text objects" ;
+};
+String STR_ObjNameSingulTITLETEXT
+{
+ Text [ en-US ] = "Title text" ;
+};
+String STR_ObjNamePluralTITLETEXT
+{
+ Text [ en-US ] = "Title texts" ;
+};
+String STR_ObjNameSingulOUTLINETEXT
+{
+ Text [ en-US ] = "Outline Text" ;
+};
+String STR_ObjNamePluralOUTLINETEXT
+{
+ Text [ en-US ] = "Outline Texts" ;
+};
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+String STR_ObjNameSingulGRAF
+{
+ Text [ en-US ] = "graphic" ;
+};
+String STR_ObjNamePluralGRAF
+{
+ Text [ en-US ] = "graphics" ;
+};
+String STR_ObjNameSingulGRAFLNK
+{
+ Text [ en-US ] = "Linked graphic" ;
+};
+String STR_ObjNamePluralGRAFLNK
+{
+ Text [ en-US ] = "Linked graphics" ;
+};
+String STR_ObjNameSingulGRAFNONE
+{
+ Text [ en-US ] = "Blank graphic object" ;
+};
+String STR_ObjNamePluralGRAFNONE
+{
+ Text [ en-US ] = "Blank graphic objects" ;
+};
+String STR_ObjNameSingulGRAFNONELNK
+{
+ Text [ en-US ] = "Blank linked graphic" ;
+};
+String STR_ObjNamePluralGRAFNONELNK
+{
+ Text [ en-US ] = "Blank linked graphics" ;
+};
+String STR_ObjNameSingulGRAFMTF
+{
+ Text [ en-US ] = "Metafile" ;
+};
+String STR_ObjNamePluralGRAFMTF
+{
+ Text [ en-US ] = "Metafiles" ;
+};
+String STR_ObjNameSingulGRAFMTFLNK
+{
+ Text [ en-US ] = "Linked Metafile" ;
+};
+String STR_ObjNamePluralGRAFMTFLNK
+{
+ Text [ en-US ] = "Linked Metafiles" ;
+};
+String STR_ObjNameSingulGRAFBMP
+{
+ Text [ en-US ] = "Bitmap" ;
+};
+String STR_ObjNameSingulGRAFBMPTRANS
+{
+ Text [ en-US ] = "Bitmap with transparency" ;
+};
+String STR_ObjNameSingulGRAFBMPLNK
+{
+ Text [ en-US ] = "Linked Bitmap" ;
+};
+String STR_ObjNameSingulGRAFBMPTRANSLNK
+{
+ Text [ en-US ] = "Linked bitmap with transparency" ;
+};
+String STR_ObjNamePluralGRAFBMP
+{
+ Text [ en-US ] = "Bitmaps" ;
+};
+String STR_ObjNamePluralGRAFBMPTRANS
+{
+ Text [ en-US ] = "Bitmaps with transparency" ;
+};
+String STR_ObjNamePluralGRAFBMPLNK
+{
+ Text [ en-US ] = "Linked bitmaps" ;
+};
+String STR_ObjNamePluralGRAFBMPTRANSLNK
+{
+ Text [ en-US ] = "Linked bitmaps with transparency" ;
+};
+String STR_ObjNameSingulCUSTOMSHAPE
+{
+ Text [ en-US ] = "Shape";
+};
+String STR_ObjNamePluralCUSTOMSHAPE
+{
+ Text [ en-US ] = "Shapes";
+};
+String STR_ObjNameSingulGRAFMAC
+{
+ Text [ en-US ] = "Mac graphic" ;
+};
+String STR_ObjNamePluralGRAFMAC
+{
+ Text [ en-US ] = "Mac graphics" ;
+};
+String STR_ObjNameSingulGRAFMACLNK
+{
+ Text [ en-US ] = "Linked Mac graphic" ;
+};
+String STR_ObjNamePluralGRAFMACLNK
+{
+ Text [ en-US ] = "Linked Mac graphics" ;
+};
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+String STR_ObjNameSingulOLE2
+{
+ Text [ en-US ] = "embedded object (OLE)" ;
+};
+String STR_ObjNamePluralOLE2
+{
+ Text [ en-US ] = "Embedded objects (OLE)" ;
+};
+String STR_ObjNameSingulUno
+{
+ Text [ en-US ] = "Control";
+};
+String STR_ObjNamePluralUno
+{
+ Text [ en-US ] = "Controls";
+};
+String STR_ObjNameSingulOLE2LNK
+{
+ Text [ en-US ] = "linked embedded object (OLE)" ;
+};
+String STR_ObjNamePluralOLE2LNK
+{
+ Text [ en-US ] = "Linked embedded objects (OLE)" ;
+};
+String STR_ObjOLE2NamePrefix
+{
+ Text [ en-US ] = "Object" ;
+};
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+String STR_ObjNameSingulFrame
+{
+ Text [ en-US ] = "Frame" ;
+};
+String STR_ObjNamePluralFrame
+{
+ Text [ en-US ] = "Frames" ;
+};
+String STR_ObjFrameNamePrefix
+{
+ Text [ en-US ] = "Frame" ;
+};
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+String STR_ObjNameSingulEDGE
+{
+ Text [ en-US ] = "Object Connectors" ;
+};
+String STR_ObjNamePluralEDGE
+{
+ Text [ en-US ] = "Object Connectors" ;
+};
+String STR_ObjNameSingulCAPTION
+{
+ Text [ en-US ] = "Callout" ;
+};
+String STR_ObjNamePluralCAPTION
+{
+ Text [ en-US ] = "Callouts" ;
+};
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+String STR_ObjNameSingulPAGE
+{
+ Text [ en-US ] = "Preview object" ;
+};
+String STR_ObjNamePluralPAGE
+{
+ Text [ en-US ] = "Preview objects" ;
+};
+String STR_ObjNameSingulMEASURE
+{
+ Text [ en-US ] = "Dimension line" ;
+};
+String STR_ObjNamePluralMEASURE
+{
+ Text [ en-US ] = "Dimensioning objects" ;
+};
+String STR_ObjNamePlural
+{
+ Text [ en-US ] = "draw objects" ;
+};
+String STR_ObjNameNoObj
+{
+ Text [ en-US ] = "No draw object" ;
+};
+String STR_ObjNameAnd
+{
+ Text [ en-US ] = "and" ;
+};
+String STR_ObjNameSingulPlural
+{
+ Text [ en-US ] = "draw object(s)" ;
+};
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+
+// Neu ab 537: Namen fuer 3D-Objekte
+String STR_ObjNameSingulCube3d
+{
+ Text [ en-US ] = "3D cube";
+};
+
+String STR_ObjNamePluralCube3d
+{
+ Text [ en-US ] = "3D cubes";
+};
+
+String STR_ObjNameSingulExtrude3d
+{
+ Text [ en-US ] = "Extrusion object";
+};
+
+String STR_ObjNamePluralExtrude3d
+{
+ Text [ en-US ] = "Extrusion objects";
+};
+
+String STR_ObjNameSingulLabel3d
+{
+ Text [ en-US ] = "3D text";
+};
+
+String STR_ObjNamePluralLabel3d
+{
+ Text [ en-US ] = "3D texts";
+};
+
+String STR_ObjNameSingulLathe3d
+{
+ Text [ en-US ] = "rotation object";
+};
+
+String STR_ObjNamePluralLathe3d
+{
+ Text [ en-US ] = "rotation objects";
+};
+
+String STR_ObjNameSingulObj3d
+{
+ Text [ en-US ] = "3D object";
+};
+
+String STR_ObjNamePluralObj3d
+{
+ Text [ en-US ] = "3D objects";
+};
+
+String STR_ObjNamePluralPoly3d
+{
+ Text [ en-US ] = "3D polygons";
+};
+
+String STR_ObjNameSingulScene3d
+{
+ Text [ en-US ] = "3D scene";
+};
+
+String STR_ObjNamePluralScene3d
+{
+ Text [ en-US ] = "3D scenes";
+};
+
+String STR_ObjNameSingulSphere3d
+{
+ Text [ en-US ] = "sphere";
+};
+
+String STR_ObjNamePluralSphere3d
+{
+ Text [ en-US ] = "spheres";
+};
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+
+String STR_EditWithCopy
+{
+ Text [ en-US ] = "with copy" ;
+};
+String STR_EditPosSize
+{
+ Text [ en-US ] = "Set position and size for %1" ;
+};
+String STR_EditDelete
+{
+ Text [ en-US ] = "Delete %1" ;
+};
+String STR_EditMovToTop
+{
+ Text [ en-US ] = "Move %1 forward" ;
+};
+String STR_EditMovToBtm
+{
+ Text [ en-US ] = "Move %1 further back" ;
+};
+String STR_EditPutToTop
+{
+ Text [ en-US ] = "Move %1 to front" ;
+};
+String STR_EditPutToBtm
+{
+ Text [ en-US ] = "Move %1 to back" ;
+};
+String STR_EditRevOrder
+{
+ Text [ en-US ] = "Reverse order of %1" ;
+};
+String STR_EditMove
+{
+ Text [ en-US ] = "Move %1" ;
+};
+String STR_EditResize
+{
+ Text [ en-US ] = "Resize %1" ;
+};
+String STR_EditRotate
+{
+ Text [ en-US ] = "Rotate %1" ;
+};
+String STR_EditMirrorHori
+{
+ Text [ en-US ] = "Flip %1 horizontal" ;
+};
+String STR_EditMirrorVert
+{
+ Text [ en-US ] = "Flip %1 vertical" ;
+};
+String STR_EditMirrorDiag
+{
+ Text [ en-US ] = "Flip %1 diagonal" ;
+};
+String STR_EditMirrorFree
+{
+ Text [ en-US ] = "Flip %1 freehand" ;
+};
+String STR_EditShear
+{
+ Text [ en-US ] = "Distort %1 (slant)" ;
+};
+String STR_EditCrook
+{
+ Text [ en-US ] = "Arrange %1 in circle" ;
+};
+String STR_EditCrookContortion
+{
+ Text [ en-US ] = "Curve %1 in circle" ;
+};
+String STR_EditDistort
+{
+ Text [ en-US ] = "Distort %1" ;
+};
+String STR_EditRipUp
+{
+ Text [ en-US ] = "Undo %1" ;
+};
+String STR_EditSetPointsSmooth
+{
+ Text [ en-US ] = "Modify bézier properties of %1" ;
+};
+String STR_EditSetSegmentsKind
+{
+ Text [ en-US ] = "Modify bézier properties of %1" ;
+};
+String STR_EditShut
+{
+ Text [ en-US ] = "Close %1" ;
+};
+String STR_EditSetGlueEscDir
+{
+ Text [ en-US ] = "Set exit direction for %1" ;
+};
+String STR_EditSetGluePercent
+{
+ Text [ en-US ] = "Set relative attribute at %1" ;
+};
+String STR_EditSetGlueAlign
+{
+ Text [ en-US ] = "Set reference point for %1" ;
+};
+String STR_EditGroup
+{
+ Text [ en-US ] = "Group %1" ;
+};
+String STR_EditUngroup
+{
+ Text [ en-US ] = "Ungroup %1" ;
+};
+String STR_EditSetAttributes
+{
+ Text [ en-US ] = "Apply attributes to %1" ;
+};
+String STR_EditSetStylesheet
+{
+ Text [ en-US ] = "Apply Styles to %1" ;
+};
+String STR_EditDelStylesheet
+{
+ Text [ en-US ] = "Remove Style from %1" ;
+};
+String STR_EditConvToPoly
+{
+ Text [ en-US ] = "Convert %1 to polygon" ;
+};
+String STR_EditConvToPolys
+{
+ Text [ en-US ] = "Convert %1 to polygons" ;
+};
+String STR_EditConvToCurve
+{
+ Text [ en-US ] = "Convert %1 to curve" ;
+};
+String STR_EditConvToCurves
+{
+ Text [ en-US ] = "Convert %1 to curves" ;
+};
+String STR_EditConvToContour
+{
+ Text [ en-US ] = "Convert %1 to contour";
+};
+String STR_EditConvToContours
+{
+ Text [ en-US ] = "Convert %1 to contours";
+};
+String STR_EditAlign
+{
+ Text [ en-US ] = "Align %1" ;
+};
+String STR_EditAlignVTop
+{
+ Text [ en-US ] = "Align %1 to top" ;
+};
+String STR_EditAlignVBottom
+{
+ Text [ en-US ] = "Align %1 to bottom" ;
+};
+String STR_EditAlignVCenter
+{
+ Text [ en-US ] = "Horizontally center %1" ;
+};
+String STR_EditAlignHLeft
+{
+ Text [ en-US ] = "Align %1 to left" ;
+};
+String STR_EditAlignHRight
+{
+ Text [ en-US ] = "Align %1 to right" ;
+};
+String STR_EditAlignHCenter
+{
+ Text [ en-US ] = "Vertically center %1" ;
+};
+String STR_EditAlignCenter
+{
+ Text [ en-US ] = "Center %1" ;
+};
+String STR_EditTransform
+{
+ Text [ en-US ] = "Transform %1" ;
+};
+String STR_EditCombine_PolyPoly
+{
+ Text [ en-US ] = "Combine %1" ;
+};
+String STR_EditMergeMergePoly
+{
+ Text [ en-US ] = "Merge %1";
+};
+String STR_EditMergeSubstractPoly
+{
+ Text [ en-US ] = "Subtract %1";
+};
+String STR_EditMergeIntersectPoly
+{
+ Text [ en-US ] = "Intersect %1";
+};
+String STR_DistributeMarkedObjects
+{
+ Text [ en-US ] = "Distribute selected objects";
+};
+String STR_EditCombine_OnePoly
+{
+ Text [ en-US ] = "Combine %1" ;
+};
+String STR_EditDismantle_Polys
+{
+ Text [ en-US ] = "Split %1" ;
+};
+String STR_EditDismantle_Lines
+{
+ Text [ en-US ] = "Split %1" ;
+};
+String STR_EditImportMtf
+{
+ Text [ en-US ] = "Split %1" ;
+};
+String STR_EditImportSGV
+{
+ Text = "StarDraw Dos Zeichnung importieren" ;
+};
+String STR_EditImportHPGL
+{
+ Text = "HPGL importieren" ;
+};
+String STR_EditImportDXF
+{
+ Text = "DXF importieren" ;
+};
+String STR_ExchangePaste
+{
+ Text [ en-US ] = "Insert object(s)" ;
+};
+String STR_ExchangeClpCut
+{
+ Text [ en-US ] = "Cut %1" ;
+};
+String STR_ExchangeClpPaste
+{
+ Text [ en-US ] = "Paste Clipboard" ;
+};
+String STR_ExchangeDD
+{
+ Text [ en-US ] = "Drag and Drop %1" ;
+};
+String STR_ExchangeDDPaste
+{
+ Text [ en-US ] = "Insert Drag and Drop" ;
+};
+String STR_DragInsertPoint
+{
+ Text [ en-US ] = "Insert point to %1" ;
+};
+String STR_DragInsertGluePoint
+{
+ Text [ en-US ] = "Insert glue point to %1" ;
+};
+String STR_DragMethMovHdl
+{
+ Text [ en-US ] = "Move reference-point" ;
+};
+String STR_DragMethObjOwn
+{
+ Text [ en-US ] = "Geometrically change %1" ;
+};
+String STR_DragMethMove
+{
+ Text [ en-US ] = "Move %1" ;
+};
+String STR_DragMethResize
+{
+ Text [ en-US ] = "Resize %1" ;
+};
+String STR_DragMethRotate
+{
+ Text [ en-US ] = "Rotate %1" ;
+};
+String STR_DragMethMirrorHori
+{
+ Text [ en-US ] = "Flip %1 horizontal" ;
+};
+String STR_DragMethMirrorVert
+{
+ Text [ en-US ] = "Flip %1 vertical" ;
+};
+String STR_DragMethMirrorDiag
+{
+ Text [ en-US ] = "Flip %1 diagonal" ;
+};
+String STR_DragMethMirrorFree
+{
+ Text [ en-US ] = "Flip %1 freehand" ;
+};
+String STR_DragMethGradient
+{
+ Text [ en-US ] = "Interactive gradient for %1";
+};
+String STR_DragMethTransparence
+{
+ Text [ en-US ] = "Interactive transparency for %1";
+};
+String STR_DragMethShear
+{
+ Text [ en-US ] = "Distort %1 (slant)" ;
+};
+String STR_DragMethCrook
+{
+ Text [ en-US ] = "Arrange %1 in circle" ;
+};
+String STR_DragMethCrookContortion
+{
+ Text [ en-US ] = "Curve %1 in circle" ;
+};
+String STR_DragMethDistort
+{
+ Text [ en-US ] = "Distort %1" ;
+};
+String STR_DragMethCrop
+{
+ Text [ en-US ] = "Crop %O" ;
+};
+
+String STR_DragRectEckRad
+{
+ Text [ en-US ] = "Alter radius by %1" ;
+};
+String STR_DragPathObj
+{
+ Text [ en-US ] = "Change %1" ;
+};
+String STR_DragRectResize
+{
+ Text [ en-US ] = "Resize %1" ;
+};
+String STR_DragCaptFram
+{
+ Text [ en-US ] = "Move %1" ;
+};
+String STR_DragCaptTail
+{
+ Text [ en-US ] = "Move end point of %1" ;
+};
+String STR_DragCircAngle
+{
+ Text [ en-US ] = "Adjust angle by %1" ;
+};
+String STR_DragEdgeTail
+{
+ Text [ en-US ] = "Change %1" ;
+};
+String STR_ViewTextEdit
+{
+ Text [ en-US ] = "TextEdit: Paragraph %1, Row %2, Column %3" ;
+};
+String STR_ViewMarked
+{
+ Text [ en-US ] = "%1 selected" ;
+};
+String STR_ViewMarkedPoint
+{
+ Text [ en-US ] = "Point from %1" ;
+};
+String STR_ViewMarkedPoints
+{
+ Text [ en-US ] = "%2 points from %1" ;
+};
+String STR_ViewMarkedGluePoint
+{
+ Text [ en-US ] = "Glue point from %1" ;
+};
+String STR_ViewMarkedGluePoints
+{
+ Text [ en-US ] = "%2 glue points from %1" ;
+};
+String STR_ViewMarkObjs
+{
+ Text [ en-US ] = "Mark objects" ;
+};
+String STR_ViewMarkMoreObjs
+{
+ Text [ en-US ] = "Mark additional objects" ;
+};
+String STR_ViewMarkPoints
+{
+ Text [ en-US ] = "Mark points" ;
+};
+String STR_ViewMarkMorePoints
+{
+ Text [ en-US ] = "Mark additional points" ;
+};
+String STR_ViewMarkGluePoints
+{
+ Text [ en-US ] = "Mark glue points" ;
+};
+String STR_ViewMarkMoreGluePoints
+{
+ Text [ en-US ] = "Mark additional glue points" ;
+};
+String STR_ViewCreateObj
+{
+ Text [ en-US ] = "Create %1" ;
+};
+String STR_UndoInsertObj
+{
+ Text [ en-US ] = "Insert %1" ;
+};
+String STR_UndoCopyObj
+{
+ Text [ en-US ] = "Copy %1" ;
+};
+String STR_UndoObjOrdNum
+{
+ Text [ en-US ] = "Change object order of %1" ;
+};
+String STR_UndoObjSetText
+{
+ Text [ en-US ] = "Edit text of %1" ;
+};
+String STR_UndoNewPage
+{
+ Text [ en-US ] = "Insert page" ;
+};
+String STR_UndoDelPage
+{
+ Text [ en-US ] = "Delete page" ;
+};
+String STR_UndoCopPage
+{
+ Text [ en-US ] = "Copy page" ;
+};
+String STR_UndoMovPage
+{
+ Text [ en-US ] = "Change order of pages" ;
+};
+String STR_UndoNewPageMasterDscr
+{
+ Text [ en-US ] = "Assign background page" ;
+};
+String STR_UndoDelPageMasterDscr
+{
+ Text [ en-US ] = "Clear background page assignment" ;
+};
+String STR_UndoMovPageMasterDscr
+{
+ Text [ en-US ] = "Move background page assignment" ;
+};
+String STR_UndoChgPageMasterDscr
+{
+ Text [ en-US ] = "Change background page assignment" ;
+};
+String STR_UndoMergeModel
+{
+ Text [ en-US ] = "Insert document" ;
+};
+String STR_UndoNewLayer
+{
+ Text [ en-US ] = "Insert Layer" ;
+};
+String STR_UndoDelLayer
+{
+ Text [ en-US ] = "Delete layer" ;
+};
+String STR_UndoMovLayer
+{
+ Text [ en-US ] = "Change order of layers" ;
+};
+// --> OD 2009-07-09 #i73249#
+String STR_UndoObjName
+{
+ Text [ en-US ] = "Change object name of %1 to" ;
+};
+String STR_UndoObjTitle
+{
+ Text [ en-US ] = "Change object title of %1" ;
+};
+String STR_UndoObjDescription
+{
+ Text [ en-US ] = "Change object description of %1" ;
+};
+// <--
+String STR_StandardLayerName
+{
+ Text [ en-US ] = "Standard" ;
+};
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+String STR_ItemValON
+{
+ Text [ en-US ] = "on" ;
+};
+String STR_ItemValOFF
+{
+ Text [ en-US ] = "off" ;
+};
+String STR_ItemValYES
+{
+ Text [ en-US ] = "yes" ;
+};
+String STR_ItemValNO
+{
+ Text [ en-US ] = "No" ;
+};
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+String STR_ItemValCAPTIONTYPE1
+{
+ Text [ en-US ] = "Type 1" ;
+};
+String STR_ItemValCAPTIONTYPE2
+{
+ Text [ en-US ] = "Type 2" ;
+};
+String STR_ItemValCAPTIONTYPE3
+{
+ Text [ en-US ] = "Type 3" ;
+};
+String STR_ItemValCAPTIONTYPE4
+{
+ Text [ en-US ] = "Type 4" ;
+};
+String STR_ItemValCAPTIONESCHORI
+{
+ Text [ en-US ] = "Horizontal" ;
+};
+String STR_ItemValCAPTIONESCVERT
+{
+ Text [ en-US ] = "Vertical" ;
+};
+String STR_ItemValCAPTIONESCBESTFIT
+{
+ Text [ en-US ] = "Automatic" ;
+};
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
+String STR_ItemValFITTOSIZENONE
+{
+ Text [ en-US ] = "Off" ;
+};
+String STR_ItemValFITTOSIZEPROP
+{
+ Text [ en-US ] = "Proportional" ;
+};
+String STR_ItemValFITTOSIZEALLLINES
+{
+ Text [ en-US ] = "Fit to size (all rows separately) " ;
+};
+String STR_ItemValFITTOSIZERESIZEAT
+{
+ Text [ en-US ] = "Use hard attributes" ;
+};
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
+String STR_ItemValTEXTVADJTOP
+{
+ Text [ en-US ] = "Top" ;
+};
+String STR_ItemValTEXTVADJCENTER
+{
+ Text [ en-US ] = "Center" ;
+};
+String STR_ItemValTEXTVADJBOTTOM
+{
+ Text [ en-US ] = "Bottom" ;
+};
+String STR_ItemValTEXTVADJBLOCK
+{
+ Text [ en-US ] = "Use entire height" ;
+};
+String STR_ItemValTEXTVADJSTRETCH
+{
+ Text [ en-US ] = "Stretched" ;
+};
+String STR_ItemValTEXTHADJLEFT
+{
+ Text [ en-US ] = "Left" ;
+};
+String STR_ItemValTEXTHADJCENTER
+{
+ Text [ en-US ] = "Center" ;
+};
+String STR_ItemValTEXTHADJRIGHT
+{
+ Text [ en-US ] = "Right" ;
+};
+String STR_ItemValTEXTHADJBLOCK
+{
+ Text [ en-US ] = "Use entire width" ;
+};
+String STR_ItemValTEXTHADJSTRETCH
+{
+ Text [ en-US ] = "Stretched" ;
+};
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
+String STR_ItemValTEXTANI_NONE
+{
+ Text [ en-US ] = "off" ;
+};
+String STR_ItemValTEXTANI_BLINK
+{
+ Text [ en-US ] = "flash" ;
+};
+String STR_ItemValTEXTANI_SCROLL
+{
+ Text [ en-US ] = "Scroll Through" ;
+};
+String STR_ItemValTEXTANI_ALTERNATE
+{
+ Text [ en-US ] = "alternating" ;
+};
+String STR_ItemValTEXTANI_SLIDE
+{
+ Text [ en-US ] = "Scroll In" ;
+};
+String STR_ItemValTEXTANI_LEFT
+{
+ Text [ en-US ] = "left" ;
+};
+String STR_ItemValTEXTANI_UP
+{
+ Text [ en-US ] = "up" ;
+};
+String STR_ItemValTEXTANI_RIGHT
+{
+ Text [ en-US ] = "right" ;
+};
+String STR_ItemValTEXTANI_DOWN
+{
+ Text [ en-US ] = "down" ;
+};
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
+String STR_ItemValEDGE_ORTHOLINES
+{
+ Text [ en-US ] = "Standard Connector" ;
+};
+String STR_ItemValEDGE_THREELINES
+{
+ Text [ en-US ] = "Line Connector" ;
+};
+String STR_ItemValEDGE_ONELINE
+{
+ Text [ en-US ] = "Straight Connector" ;
+};
+String STR_ItemValEDGE_BEZIER
+{
+ Text [ en-US ] = "Curved Connector" ;
+};
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
+String STR_ItemValMEASURE_STD
+{
+ Text [ en-US ] = "Standard" ;
+};
+String STR_ItemValMEASURE_RADIUS
+{
+ Text [ en-US ] = "Radius" ;
+};
+String STR_ItemValMEASURE_TEXTHAUTO
+{
+ Text [ en-US ] = "automatic" ;
+};
+String STR_ItemValMEASURE_TEXTLEFTOUTSIDE
+{
+ Text [ en-US ] = "left outside" ;
+};
+String STR_ItemValMEASURE_TEXTINSIDE
+{
+ Text [ en-US ] = "inside (centered)" ;
+};
+String STR_ItemValMEASURE_TEXTRIGHTOUTSID
+{
+ Text [ en-US ] = "right outside" ;
+};
+String STR_ItemValMEASURE_TEXTVAUTO
+{
+ Text [ en-US ] = "automatic" ;
+};
+String STR_ItemValMEASURE_ABOVE
+{
+ Text [ en-US ] = "on the line" ;
+};
+String STR_ItemValMEASURETEXT_BREAKEDLINE
+{
+ Text [ en-US ] = "broken line" ;
+};
+String STR_ItemValMEASURE_BELOW
+{
+ Text [ en-US ] = "below the line" ;
+};
+String STR_ItemValMEASURETEXT_VERTICALCEN
+{
+ Text [ en-US ] = "centered" ;
+};
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
+String STR_ItemValCIRC_FULL
+{
+ Text [ en-US ] = "full circle" ;
+};
+String STR_ItemValCIRC_SECT
+{
+ Text [ en-US ] = "Circle Pie" ;
+};
+String STR_ItemValCIRC_CUT
+{
+ Text [ en-US ] = "Circle segment" ;
+};
+String STR_ItemValCIRC_ARC
+{
+ Text [ en-US ] = "Arc" ;
+};
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+String STR_ItemNam_SHADOW
+{
+ Text [ en-US ] = "Shadow" ;
+};
+String STR_ItemNam_SHADOWCOLOR
+{
+ Text [ en-US ] = "Shadow color" ;
+};
+String STR_ItemNam_SHADOWXDIST
+{
+ Text [ en-US ] = "Horizontal shadow outline" ;
+};
+String STR_ItemNam_SHADOWYDIST
+{
+ Text [ en-US ] = "Vertical shadow outline" ;
+};
+String STR_ItemNam_SHADOWTRANSPARENCE
+{
+ Text [ en-US ] = "Shadow transparency" ;
+};
+String STR_ItemNam_SHADOW3D
+{
+ Text [ en-US ] = "3D shadow" ;
+};
+String STR_ItemNam_SHADOWPERSP
+{
+ Text [ en-US ] = "Perspective shadow" ;
+};
+String STR_ItemNam_CAPTIONTYPE
+{
+ Text [ en-US ] = "Callout type" ;
+};
+String STR_ItemNam_CAPTIONFIXEDANGLE
+{
+ Text [ en-US ] = "Given angle" ;
+};
+String STR_ItemNam_CAPTIONANGLE
+{
+ Text [ en-US ] = "Angle" ;
+};
+String STR_ItemNam_CAPTIONGAP
+{
+ Text [ en-US ] = "Gap" ;
+};
+String STR_ItemNam_CAPTIONESCDIR
+{
+ Text [ en-US ] = "Exit direction" ;
+};
+String STR_ItemNam_CAPTIONESCISREL
+{
+ Text [ en-US ] = "Relative exit position" ;
+};
+String STR_ItemNam_CAPTIONESCREL
+{
+ Text [ en-US ] = "Exit Position" ;
+};
+String STR_ItemNam_CAPTIONESCABS
+{
+ Text [ en-US ] = "Exit Position" ;
+};
+String STR_ItemNam_CAPTIONLINELEN
+{
+ Text [ en-US ] = "Line length" ;
+};
+String STR_ItemNam_CAPTIONFITLINELEN
+{
+ Text [ en-US ] = "Auto line length" ;
+};
+String STR_ItemNam_ECKENRADIUS
+{
+ Text [ en-US ] = "Corner radius" ;
+};
+String STR_ItemNam_TEXT_LEFTDIST
+{
+ Text [ en-US ] = "Left border spacing" ;
+};
+String STR_ItemNam_TEXT_RIGHTDIST
+{
+ Text [ en-US ] = "Right border spacing" ;
+};
+String STR_ItemNam_TEXT_UPPERDIST
+{
+ Text [ en-US ] = "Upper border spacing" ;
+};
+String STR_ItemNam_TEXT_LOWERDIST
+{
+ Text [ en-US ] = "Lower border spacing" ;
+};
+String STR_ItemNam_TEXT_AUTOGROWHEIGHT
+{
+ Text [ en-US ] = "AutoFit frame height" ;
+};
+String STR_ItemNam_TEXT_MINFRAMEHEIGHT
+{
+ Text [ en-US ] = "Min. frame height" ;
+};
+String STR_ItemNam_TEXT_MAXFRAMEHEIGHT
+{
+ Text [ en-US ] = "Max. frame height" ;
+};
+String STR_ItemNam_TEXT_AUTOGROWWIDTH
+{
+ Text [ en-US ] = "AutoFit frame width" ;
+};
+String STR_ItemNam_TEXT_MINFRAMEWIDTH
+{
+ Text [ en-US ] = "Min. frame width" ;
+};
+String STR_ItemNam_TEXT_MAXFRAMEWIDTH
+{
+ Text [ en-US ] = "Max. frame width" ;
+};
+String STR_ItemNam_TEXT_VERTADJUST
+{
+ Text [ en-US ] = "Vertical text anchor" ;
+};
+String STR_ItemNam_TEXT_HORZADJUST
+{
+ Text [ en-US ] = "Horizontal text anchor" ;
+};
+String STR_ItemNam_TEXT_FITTOSIZE
+{
+ Text [ en-US ] = "Fit text to frame" ;
+};
+
+String STR_ItemNam_GRAFRED
+{
+ Text [ en-US ] = "Red";
+};
+String STR_ItemNam_GRAFGREEN
+{
+ Text [ en-US ] = "Green";
+};
+String STR_ItemNam_GRAFBLUE
+{
+ Text [ en-US ] = "Blue";
+};
+String STR_ItemNam_GRAFLUMINANCE
+{
+ Text [ en-US ] = "Brightness";
+};
+String STR_ItemNam_GRAFCONTRAST
+{
+ Text [ en-US ] = "Contrast";
+};
+String STR_ItemNam_GRAFGAMMA
+{
+ Text [ en-US ] = "Gamma";
+};
+String STR_ItemNam_GRAFTRANSPARENCE
+{
+ Text [ en-US ] = "Transparency";
+};
+String STR_ItemNam_GRAFINVERT
+{
+ Text [ en-US ] = "Invert";
+};
+String STR_ItemNam_GRAFMODE
+{
+ Text [ en-US ] = "Graphics mode";
+};
+String STR_ItemNam_GRAFRESERVE2 { Text = "" ; };
+String STR_ItemNam_GRAFRESERVE3 { Text = "" ; };
+String STR_ItemNam_GRAFRESERVE4 { Text = "" ; };
+String STR_ItemNam_GRAFRESERVE5 { Text = "" ; };
+String STR_ItemNam_GRAFRESERVE6 { Text = "" ; };
+
+String STR_ItemNam_RESERVE19 { Text = "" ; };
+String STR_ItemNamSET_MISC
+{
+ Text [ en-US ] = "Various attributes" ;
+};
+String STR_ItemNam_OBJMOVEPROTECT
+{
+ Text [ en-US ] = "Position protected" ;
+};
+String STR_ItemNam_OBJSIZEPROTECT
+{
+ Text [ en-US ] = "Size Protection" ;
+};
+String STR_ItemNam_OBJPRINTABLE
+{
+ Text [ en-US ] = "Don't print" ;
+};
+String STR_ItemNam_LAYERID
+{
+ Text [ en-US ] = "Layer Indicator" ;
+};
+String STR_ItemNam_LAYERNAME
+{
+ Text [ en-US ] = "Le~vel" ;
+};
+String STR_ItemNam_OBJECTNAME
+{
+ Text [ en-US ] = "Object name" ;
+};
+String STR_ItemNam_STARTANGLE
+{
+ Text [ en-US ] = "Start angle" ;
+};
+String STR_ItemNam_ENDANGLE
+{
+ Text [ en-US ] = "Final angle" ;
+};
+String STR_ItemNam_POSITIONX
+{
+ Text [ en-US ] = "X Position" ;
+};
+String STR_ItemNam_POSITIONY
+{
+ Text [ en-US ] = "Y Position" ;
+};
+String STR_ItemNam_SIZEWIDTH
+{
+ Text [ en-US ] = "Width" ;
+};
+String STR_ItemNam_SIZEHEIGHT
+{
+ Text [ en-US ] = "Height" ;
+};
+String STR_ItemNam_ROTATEANGLE
+{
+ Text [ en-US ] = "Rotation angle" ;
+};
+String STR_ItemNam_SHEARANGLE
+{
+ Text [ en-US ] = "Shear angle" ;
+};
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ // Ende der gecachten Strings
+
+ // und hier noch Bitmaps
+Bitmap BMAP_GrafikEi { File = "grafikei.bmp" ; };
+Bitmap BMAP_GrafikDe { File = "grafikde.bmp" ; };
+
+// Strings fuer den Vorlagen-Dialog
+String SIP_UNKNOWN_ATTR
+{
+ Text [ en-US ] = "Unknown attribute";
+};
+
+// Strings fuer den Vorlagen-Dialog
+String SIP_XA_LINESTYLE
+{
+ Text [ en-US ] = "Line style";
+};
+
+String SIP_XA_LINEDASH
+{
+ Text [ en-US ] = "Line pattern";
+};
+
+String SIP_XA_LINEWIDTH
+{
+ Text [ en-US ] = "Line width";
+};
+
+String SIP_XA_LINECOLOR
+{
+ Text [ en-US ] = "Line color";
+};
+
+String SIP_XA_LINESTART
+{
+ Text [ en-US ] = "Line head";
+};
+
+String SIP_XA_LINEEND
+{
+ Text [ en-US ] = "Line end";
+};
+
+String SIP_XA_LINESTARTWIDTH
+{
+ Text [ en-US ] = "Line head width";
+};
+
+String SIP_XA_LINEENDWIDTH
+{
+ Text [ en-US ] = "Line end width";
+};
+
+String SIP_XA_LINESTARTCENTER
+{
+ Text [ en-US ] = "Center arrowhead";
+};
+
+String SIP_XA_LINEENDCENTER
+{
+ Text [ en-US ] = "Center arrowend";
+};
+
+String SIP_XA_LINETRANSPARENCE
+{
+ Text [ en-US ] = "Line transparency";
+};
+
+String SIP_XA_LINEJOINT
+{
+ Text [ en-US ] = "Line joint";
+};
+
+String SIP_XA_LINERESERVED2
+{
+ Text [ en-US ] = "Line reserved for 2";
+};
+
+String SIP_XA_LINERESERVED3
+{
+ Text [ en-US ] = "Line reserved for 3";
+};
+
+String SIP_XA_LINERESERVED4
+{
+ Text [ en-US ] = "Line reserved for 4";
+};
+
+String SIP_XA_LINERESERVED5
+{
+ Text [ en-US ] = "Line reserved for 5";
+};
+
+String SIP_XA_LINERESERVED_LAST
+{
+ Text [ en-US ] = "Line reserved for 6";
+};
+
+String SIP_XATTRSET_LINE
+{
+ Text [ en-US ] = "Line attributes";
+};
+
+String SIP_XA_FILLSTYLE
+{
+ Text [ en-US ] = "Fill style";
+};
+
+String SIP_XA_FILLCOLOR
+{
+ Text [ en-US ] = "Fillcolor";
+};
+
+String SIP_XA_FILLGRADIENT
+{
+ Text [ en-US ] = "Gradient";
+};
+
+String SIP_XA_FILLHATCH
+{
+ Text [ en-US ] = "Hatching";
+};
+
+String SIP_XA_FILLBITMAP
+{
+ Text [ en-US ] = "Fillbitmap";
+};
+
+String SIP_XA_FILLTRANSPARENCE
+{
+ Text [ en-US ] = "Transparency";
+};
+
+String SIP_XA_GRADIENTSTEPCOUNT
+{
+ Text [ en-US ] = "Number of gradient steps";
+};
+
+String SIP_XA_FILLBMP_TILE
+{
+ Text [ en-US ] = "Tile fill";
+};
+
+String SIP_XA_FILLBMP_POS
+{
+ Text [ en-US ] = "Fillbitmap position";
+};
+
+String SIP_XA_FILLBMP_SIZEX
+{
+ Text [ en-US ] = "Fillbitmap width";
+};
+
+String SIP_XA_FILLBMP_SIZEY
+{
+ Text [ en-US ] = "Height of fillbitmap";
+};
+
+String SIP_XA_FILLFLOATTRANSPARENCE
+{
+ Text [ en-US ] = "Transparent gradient";
+};
+
+String SIP_XA_SECONDARYFILLCOLOR
+{
+ Text [ en-US ] = "Fill reserved for 2";
+};
+
+String SIP_XA_FILLBMP_SIZELOG
+{
+ Text [ en-US ] = "Tile size not in %";
+};
+
+String SIP_XA_FILLBMP_TILEOFFSETX
+{
+ Text [ en-US ] = "Tile offset X in %";
+};
+
+String SIP_XA_FILLBMP_TILEOFFSETY
+{
+ Text [ en-US ] = "Tile offset Y in %";
+};
+
+String SIP_XA_FILLBMP_STRETCH
+{
+ Text [ en-US ] = "Bitmap scaling";
+};
+
+String SIP_XA_FILLRESERVED3
+{
+ Text [ en-US ] = "Bitmap reserved for 3";
+};
+
+String SIP_XA_FILLRESERVED4
+{
+ Text [ en-US ] = "Bitmap reserved for 4";
+};
+
+String SIP_XA_FILLRESERVED5
+{
+ Text [ en-US ] = "Bitmap reserved for 5";
+};
+
+String SIP_XA_FILLRESERVED6
+{
+ Text [ en-US ] = "Bitmap reserved for 6";
+};
+
+String SIP_XA_FILLRESERVED7
+{
+ Text [ en-US ] = "Bitmap reserved for 7";
+};
+
+String SIP_XA_FILLRESERVED8
+{
+ Text [ en-US ] = "Bitmap reserved for 8";
+};
+
+String SIP_XA_FILLBMP_POSOFFSETX
+{
+ Text [ en-US ] = "Tile position X in %";
+};
+
+String SIP_XA_FILLBMP_POSOFFSETY
+{
+ Text [ en-US ] = "Tile position Y in %";
+};
+
+String SIP_XA_FILLBACKGROUND
+{
+ Text [ en-US ] = "Background fill";
+};
+
+String SIP_XA_FILLRESERVED10
+{
+ Text [ en-US ] = "Fill reserved for 10";
+};
+
+String SIP_XA_FILLRESERVED11
+{
+ Text [ en-US ] = "Fill reserved for 11";
+};
+
+String SIP_XA_FILLRESERVED_LAST
+{
+ Text [ en-US ] = "Fill reserved for 12";
+};
+
+String SIP_XATTRSET_FILL
+{
+ Text [ en-US ] = "Area attributes";
+};
+
+String SIP_XA_FORMTXTSTYLE
+{
+ Text [ en-US ] = "Fontwork style";
+};
+
+String SIP_XA_FORMTXTADJUST
+{
+ Text [ en-US ] = "Fontwork alignment";
+};
+
+String SIP_XA_FORMTXTDISTANCE
+{
+ Text [ en-US ] = "Fontwork spacing";
+};
+
+String SIP_XA_FORMTXTSTART
+{
+ Text [ en-US ] = "Fontwork font begin";
+};
+
+String SIP_XA_FORMTXTMIRROR
+{
+ Text [ en-US ] = "Fontwork mirror";
+};
+
+String SIP_XA_FORMTXTOUTLINE
+{
+ Text [ en-US ] = "Fontwork outline";
+};
+
+String SIP_XA_FORMTXTSHADOW
+{
+ Text [ en-US ] = "Fontwork shadow";
+};
+
+String SIP_XA_FORMTXTSHDWCOLOR
+{
+ Text [ en-US ] = "Fontwork shadow color";
+};
+
+String SIP_XA_FORMTXTSHDWXVAL
+{
+ Text [ en-US ] = "Fontwork shadow offset X";
+};
+
+String SIP_XA_FORMTXTSHDWYVAL
+{
+ Text [ en-US ] = "Fontwork shadow offset Y";
+};
+
+String SIP_XA_FORMTXTSTDFORM
+{
+ Text [ en-US ] = "Fontwork default form";
+};
+
+String SIP_XA_FORMTXTHIDEFORM
+{
+ Text [ en-US ] = "Hide fontwork outline";
+};
+
+String SIP_XA_FORMTXTSHDWTRANSP
+{
+ Text [ en-US ] = "Fontwork shadow transparency";
+};
+
+String SIP_XA_FTRESERVED2
+{
+ Text [ en-US ] = "Fontwork reserved for 2";
+};
+
+String SIP_XA_FTRESERVED3
+{
+ Text [ en-US ] = "Fontwork reserved for 3";
+};
+
+String SIP_XA_FTRESERVED4
+{
+ Text [ en-US ] = "Fontwork reserved for 4";
+};
+
+String SIP_XA_FTRESERVED5
+{
+ Text [ en-US ] = "Fontwork reserved for 5";
+};
+
+String SIP_XA_FTRESERVED_LAST
+{
+ Text [ en-US ] = "Fontwork reserved for 6";
+};
+
+String SIP_SA_SHADOW
+{
+ Text [ en-US ] = "Shadow";
+};
+
+String SIP_SA_SHADOWCOLOR
+{
+ Text [ en-US ] = "Shadow color";
+};
+
+String SIP_SA_SHADOWXDIST
+{
+ Text [ en-US ] = "Shadow spacing X";
+};
+
+String SIP_SA_SHADOWYDIST
+{
+ Text [ en-US ] = "Shadow spacing Y";
+};
+
+String SIP_SA_SHADOWTRANSPARENCE
+{
+ Text [ en-US ] = "Shadow transparency";
+};
+
+String SIP_SA_SHADOW3D
+{
+ Text [ en-US ] = "3D shadow";
+};
+
+String SIP_SA_SHADOWPERSP
+{
+ Text [ en-US ] = "Perspective shadow";
+};
+
+String SIP_SA_CAPTIONTYPE
+{
+ Text [ en-US ] = "Type of legend";
+};
+
+String SIP_SA_CAPTIONFIXEDANGLE
+{
+ Text [ en-US ] = "Fixed legend angle";
+};
+
+String SIP_SA_CAPTIONANGLE
+{
+ Text [ en-US ] = "Legend angle";
+};
+
+String SIP_SA_CAPTIONGAP
+{
+ Text [ en-US ] = "Legend lines spacing";
+};
+
+String SIP_SA_CAPTIONESCDIR
+{
+ Text [ en-US ] = "Legend exit alignment";
+};
+
+String SIP_SA_CAPTIONESCISREL
+{
+ Text [ en-US ] = "Relative exit legend";
+};
+
+String SIP_SA_CAPTIONESCREL
+{
+ Text [ en-US ] = "Relative exit legend";
+};
+
+String SIP_SA_CAPTIONESCABS
+{
+ Text [ en-US ] = "Absolute exit of legend";
+};
+
+String SIP_SA_CAPTIONLINELEN
+{
+ Text [ en-US ] = "Legend line length";
+};
+
+String SIP_SA_CAPTIONFITLINELEN
+{
+ Text [ en-US ] = "AutoLength of legend lines";
+};
+
+String SIP_SA_ECKENRADIUS
+{
+ Text [ en-US ] = "Corner radius";
+};
+
+String SIP_SA_TEXT_MINFRAMEHEIGHT
+{
+ Text [ en-US ] = "Minimal frame height";
+};
+
+String SIP_SA_TEXT_AUTOGROWHEIGHT
+{
+ Text [ en-US ] = "AutoFit height";
+};
+
+String SIP_SA_TEXT_FITTOSIZE
+{
+ Text [ en-US ] = "Fit text to frame";
+};
+
+String SIP_SA_TEXT_LEFTDIST
+{
+ Text [ en-US ] = "Left text frame spacing";
+};
+
+String SIP_SA_TEXT_RIGHTDIST
+{
+ Text [ en-US ] = "Right text frame spacing";
+};
+
+String SIP_SA_TEXT_UPPERDIST
+{
+ Text [ en-US ] = "Upper text frame spacing";
+};
+
+String SIP_SA_TEXT_LOWERDIST
+{
+ Text [ en-US ] = "Lower text frame spacing";
+};
+
+String SIP_SA_TEXT_VERTADJUST
+{
+ Text [ en-US ] = "Vertical text anchor";
+};
+
+String SIP_SA_TEXT_MAXFRAMEHEIGHT
+{
+ Text [ en-US ] = "Maximal frame height";
+};
+
+String SIP_SA_TEXT_MINFRAMEWIDTH
+{
+ Text [ en-US ] = "Minimal frame width";
+};
+
+String SIP_SA_TEXT_MAXFRAMEWIDTH
+{
+ Text [ en-US ] = "Maximal frame width";
+};
+
+String SIP_SA_TEXT_AUTOGROWWIDTH
+{
+ Text [ en-US ] = "AutoFit width";
+};
+
+String SIP_SA_TEXT_HORZADJUST
+{
+ Text [ en-US ] = "Horizontal text anchor";
+};
+
+String SIP_SA_TEXT_ANIKIND
+{
+ Text [ en-US ] = "Ticker";
+};
+
+String SIP_SA_TEXT_ANIDIRECTION
+{
+ Text [ en-US ] = "Ticker direction";
+};
+
+String SIP_SA_TEXT_ANISTARTINSIDE
+{
+ Text [ en-US ] = "Ticker start inside";
+};
+
+String SIP_SA_TEXT_ANISTOPINSIDE
+{
+ Text [ en-US ] = "Ticker stop inside";
+};
+
+String SIP_SA_TEXT_ANICOUNT
+{
+ Text [ en-US ] = "Number of ticker runs";
+};
+
+String SIP_SA_TEXT_ANIDELAY
+{
+ Text [ en-US ] = "Speed of ticker";
+};
+
+String SIP_SA_TEXT_ANIAMOUNT
+{
+ Text [ en-US ] = "Ticker step size";
+};
+
+String SIP_SA_TEXT_CONTOURFRAME
+{
+ Text [ en-US ] = "Outline text flow";
+};
+
+String SIP_SA_CUSTOMSHAPE_ADJUSTMENT
+{
+ Text[ en-US ] = "Shape Adjustment";
+};
+
+String SIP_SA_XMLATTRIBUTES
+{
+ Text [ en-US ] = "User-defined attributes";
+};
+
+String SIP_SA_TEXT_USEFIXEDCELLHEIGHT
+{
+ Text [ en-US ] = "Use font-independent line spacing";
+};
+
+String SIP_SA_WORDWRAP
+{
+ Text[ en-US ] = "Word wrap text in shape";
+};
+
+String SIP_SA_AUTOGROWSIZE
+{
+ Text[ en-US ] = "Auto grow shape to fit text";
+};
+
+String SIP_SA_RESERVE18
+{
+ Text [ en-US ] = "SvDraw reserved for 18";
+};
+
+String SIP_SA_RESERVE19
+{
+ Text [ en-US ] = "SvDraw reserved for 19";
+};
+
+String SIP_SA_EDGEKIND
+{
+ Text [ en-US ] = "Type of connector";
+};
+
+String SIP_SA_EDGENODE1HORZDIST
+{
+ Text [ en-US ] = "Horz. spacing object 1";
+};
+
+String SIP_SA_EDGENODE1VERTDIST
+{
+ Text [ en-US ] = "Vert. spacing object 1";
+};
+
+String SIP_SA_EDGENODE2HORZDIST
+{
+ Text [ en-US ] = "Horz. spacing object 2";
+};
+
+String SIP_SA_EDGENODE2VERTDIST
+{
+ Text [ en-US ] = "Vert. spacing object 2";
+};
+
+String SIP_SA_EDGENODE1GLUEDIST
+{
+ Text [ en-US ] = "Glue spacing object 1";
+};
+
+String SIP_SA_EDGENODE2GLUEDIST
+{
+ Text [ en-US ] = "Glue spacing object 2";
+};
+
+String SIP_SA_EDGELINEDELTAANZ
+{
+ Text [ en-US ] = "Number of movable lines";
+};
+
+String SIP_SA_EDGELINE1DELTA
+{
+ Text [ en-US ] = "Offset line 1";
+};
+
+String SIP_SA_EDGELINE2DELTA
+{
+ Text [ en-US ] = "Offset line 2";
+};
+
+String SIP_SA_EDGELINE3DELTA
+{
+ Text [ en-US ] = "Offset line 3";
+};
+
+String SIP_SA_MEASUREKIND
+{
+ Text [ en-US ] = "Type of dimensioning";
+};
+
+String SIP_SA_MEASURETEXTHPOS
+{
+ Text [ en-US ] = "Dimension value - horizontal position";
+};
+
+String SIP_SA_MEASURETEXTVPOS
+{
+ Text [ en-US ] = "Dimension value - vertical position";
+};
+
+String SIP_SA_MEASURELINEDIST
+{
+ Text [ en-US ] = "Dimension line space";
+};
+
+String SIP_SA_MEASUREHELPLINEOVERHANG
+{
+ Text [ en-US ] = "Dimension help line overhang";
+};
+
+String SIP_SA_MEASUREHELPLINEDIST
+{
+ Text [ en-US ] = "Dimension help line spacing";
+};
+
+String SIP_SA_MEASUREHELPLINE1LEN
+{
+ Text [ en-US ] = "Backlog of dimension help line 1";
+};
+
+String SIP_SA_MEASUREHELPLINE2LEN
+{
+ Text [ en-US ] = "Backlog of dimension help line 2";
+};
+
+String SIP_SA_MEASUREBELOWREFEDGE
+{
+ Text [ en-US ] = "Lower edge dimensioning";
+};
+
+String SIP_SA_MEASURETEXTROTA90
+{
+ Text [ en-US ] = "Dimension value across dimension line";
+};
+
+String SIP_SA_MEASURETEXTUPSIDEDOWN
+{
+ Text [ en-US ] = "Rotate dimension value by 180 degree";
+};
+
+String SIP_SA_MEASUREOVERHANG
+{
+ Text [ en-US ] = "Dimension line overhang";
+};
+
+String SIP_SA_MEASUREUNIT
+{
+ Text [ en-US ] = "Measure unit";
+};
+
+String SIP_SA_MEASURESCALE
+{
+ Text [ en-US ] = "Additional scale factor";
+};
+
+String SIP_SA_MEASURESHOWUNIT
+{
+ Text [ en-US ] = "Measure unit display";
+};
+
+String SIP_SA_MEASUREFORMATSTRING
+{
+ Text [ en-US ] = "Dimension value format";
+};
+
+String SIP_SA_MEASURETEXTAUTOANGLE
+{
+ Text [ en-US ] = "AutoPositioning of the dimension value";
+};
+
+String SIP_SA_MEASURETEXTAUTOANGLEVIEW
+{
+ Text [ en-US ] = "Angle for the automatic positioning of the dimension value";
+};
+
+String SIP_SA_MEASURETEXTISFIXEDANGLE
+{
+ Text [ en-US ] = "Determination of the dimension value angle";
+};
+
+String SIP_SA_MEASURETEXTFIXEDANGLE
+{
+ Text [ en-US ] = "Angle of the dimension value";
+};
+
+String SIP_SA_MEASUREDECIMALPLACES
+{
+ Text [ en-US ] = "Decimal places";
+};
+
+String SIP_SA_MEASURERESERVE05
+{
+ Text [ en-US ] = "Dimensioning reserved 5";
+};
+
+String SIP_SA_MEASURERESERVE06
+{
+ Text [ en-US ] = "Dimensioning reserved for 6";
+};
+
+String SIP_SA_MEASURERESERVE07
+{
+ Text [ en-US ] = "Dimensioning reserved for 7";
+};
+
+String SIP_SA_CIRCKIND
+{
+ Text [ en-US ] = "Type of circle";
+};
+
+String SIP_SA_CIRCSTARTANGLE
+{
+ Text [ en-US ] = "Start angle";
+};
+
+String SIP_SA_CIRCENDANGLE
+{
+ Text [ en-US ] = "End angle";
+};
+
+String SIP_SA_CIRCRESERVE0
+{
+ Text [ en-US ] = "Circle reserved for 0";
+};
+
+String SIP_SA_CIRCRESERVE1
+{
+ Text [ en-US ] = "Circle reserved for 1";
+};
+
+String SIP_SA_CIRCRESERVE2
+{
+ Text [ en-US ] = "Circle reserved for 2";
+};
+
+String SIP_SA_CIRCRESERVE3
+{
+ Text [ en-US ] = "Circle reserved for 3";
+};
+
+String SIP_SA_OBJMOVEPROTECT
+{
+ Text [ en-US ] = "Protected object position";
+};
+
+String SIP_SA_OBJSIZEPROTECT
+{
+ Text [ en-US ] = "Protected object size";
+};
+
+String SIP_SA_OBJPRINTABLE
+{
+ Text [ en-US ] = "Object, printable";
+};
+
+String SIP_SA_OBJVISIBLE
+{
+ Text [ en-US ] = "Object, visible";
+};
+
+String SIP_SA_LAYERID
+{
+ Text [ en-US ] = "Level ID";
+};
+
+String SIP_SA_LAYERNAME
+{
+ Text [ en-US ] = "Layer";
+};
+
+String SIP_SA_OBJECTNAME
+{
+ Text [ en-US ] = "Object name";
+};
+
+String SIP_SA_ALLPOSITIONX
+{
+ Text [ en-US ] = "Position X, complete";
+};
+
+String SIP_SA_ALLPOSITIONY
+{
+ Text [ en-US ] = "Position Y, complete";
+};
+
+String SIP_SA_ALLSIZEWIDTH
+{
+ Text [ en-US ] = "Total Width";
+};
+
+String SIP_SA_ALLSIZEHEIGHT
+{
+ Text [ en-US ] = "Height, complete";
+};
+
+String SIP_SA_ONEPOSITIONX
+{
+ Text [ en-US ] = "Single position X";
+};
+
+String SIP_SA_ONEPOSITIONY
+{
+ Text [ en-US ] = "Single position Y";
+};
+
+String SIP_SA_ONESIZEWIDTH
+{
+ Text [ en-US ] = "Single width";
+};
+
+String SIP_SA_ONESIZEHEIGHT
+{
+ Text [ en-US ] = "Single height";
+};
+
+String SIP_SA_LOGICSIZEWIDTH
+{
+ Text [ en-US ] = "Logical width";
+};
+
+String SIP_SA_LOGICSIZEHEIGHT
+{
+ Text [ en-US ] = "Logical height";
+};
+
+String SIP_SA_ROTATEANGLE
+{
+ Text [ en-US ] = "Single rotation angle";
+};
+
+String SIP_SA_SHEARANGLE
+{
+ Text [ en-US ] = "Single shear angle";
+};
+
+String SIP_SA_MOVEX
+{
+ Text [ en-US ] = "Move horizontally";
+};
+
+String SIP_SA_MOVEY
+{
+ Text [ en-US ] = "Move vertically";
+};
+
+String SIP_SA_RESIZEXONE
+{
+ Text [ en-US ] = "Resize X, single";
+};
+
+String SIP_SA_RESIZEYONE
+{
+ Text [ en-US ] = "Resize Y, single";
+};
+
+String SIP_SA_ROTATEONE
+{
+ Text [ en-US ] = "Single rotation";
+};
+
+String SIP_SA_HORZSHEARONE
+{
+ Text [ en-US ] = "Single horizontal shear";
+};
+
+String SIP_SA_VERTSHEARONE
+{
+ Text [ en-US ] = "Single vertical shear";
+};
+
+String SIP_SA_RESIZEXALL
+{
+ Text [ en-US ] = "Resize X, complete";
+};
+
+String SIP_SA_RESIZEYALL
+{
+ Text [ en-US ] = "Resize Y, complete";
+};
+
+String SIP_SA_ROTATEALL
+{
+ Text [ en-US ] = "Rotate all";
+};
+
+String SIP_SA_HORZSHEARALL
+{
+ Text [ en-US ] = "Shear horizontal, complete";
+};
+
+String SIP_SA_VERTSHEARALL
+{
+ Text [ en-US ] = "Shear vertical, complete";
+};
+
+String SIP_SA_TRANSFORMREF1X
+{
+ Text [ en-US ] = "Reference point 1 X";
+};
+
+String SIP_SA_TRANSFORMREF1Y
+{
+ Text [ en-US ] = "Reference point 1 Y";
+};
+
+String SIP_SA_TRANSFORMREF2X
+{
+ Text [ en-US ] = "Reference point 2 X";
+};
+
+String SIP_SA_TRANSFORMREF2Y
+{
+ Text [ en-US ] = "Reference point 2 Y";
+};
+
+String SIP_EE_PARA_HYPHENATE
+{
+ Text [ en-US ] = "Hyphenation";
+};
+
+String SIP_EE_PARA_BULLETSTATE
+{
+ Text [ en-US ] = "Display bullets";
+};
+
+String SIP_EE_PARA_OUTLLRSPACE
+{
+ Text [ en-US ] = "Numbering indents";
+};
+
+String SIP_EE_PARA_OUTLLEVEL
+{
+ Text [ en-US ] = "Numbering level";
+};
+
+String SIP_EE_PARA_BULLET
+{
+ Text [ en-US ] = "Bullets and Numberings";
+};
+
+String SIP_EE_PARA_LRSPACE
+{
+ Text [ en-US ] = "Indents";
+};
+
+String SIP_EE_PARA_ULSPACE
+{
+ Text [ en-US ] = "Paragraph spacing";
+};
+
+String SIP_EE_PARA_SBL
+{
+ Text [ en-US ] = "Line spacing";
+};
+
+String SIP_EE_PARA_JUST
+{
+ Text [ en-US ] = "Paragraph alignment";
+};
+
+String SIP_EE_PARA_TABS
+{
+ Text [ en-US ] = "Tabulators";
+};
+
+String SIP_EE_CHAR_COLOR
+{
+ Text [ en-US ] = "Font color";
+};
+
+String SIP_EE_CHAR_FONTINFO
+{
+ Text [ en-US ] = "Character set";
+};
+
+String SIP_EE_CHAR_FONTHEIGHT
+{
+ Text [ en-US ] = "Font size";
+};
+
+String SIP_EE_CHAR_FONTWIDTH
+{
+ Text [ en-US ] = "Font width";
+};
+
+String SIP_EE_CHAR_WEIGHT
+{
+ Text [ en-US ] = "Bold (thickness)";
+};
+
+String SIP_EE_CHAR_UNDERLINE
+{
+ Text [ en-US ] = "Underline";
+};
+
+String SIP_EE_CHAR_OVERLINE
+{
+ Text [ en-US ] = "Overline";
+};
+
+String SIP_EE_CHAR_STRIKEOUT
+{
+ Text [ en-US ] = "Strikethrough";
+};
+
+String SIP_EE_CHAR_ITALIC
+{
+ Text [ en-US ] = "Italic";
+};
+
+String SIP_EE_CHAR_OUTLINE
+{
+ Text [ en-US ] = "Outline";
+};
+
+String SIP_EE_CHAR_SHADOW
+{
+ Text [ en-US ] = "Font shadow";
+};
+
+String SIP_EE_CHAR_ESCAPEMENT
+{
+ Text [ en-US ] = "Superscript/subscript";
+};
+
+String SIP_EE_CHAR_PAIRKERNING
+{
+ Text [ en-US ] = "Kerning";
+};
+
+String SIP_EE_CHAR_KERNING
+{
+ Text [ en-US ] = "Manual kerning";
+};
+
+String SIP_EE_CHAR_WLM
+{
+ Text [ en-US ] = "No underline for spaces";
+};
+
+String SIP_EE_FEATURE_TAB
+{
+ Text [ en-US ] = "Tabulator";
+};
+
+String SIP_EE_FEATURE_LINEBR
+{
+ Text [ en-US ] = "Optional line break";
+};
+
+String SIP_EE_FEATURE_NOTCONV
+{
+ Text [ en-US ] = "Non-convertible character";
+};
+
+String SIP_EE_FEATURE_FIELD
+{
+ Text [ en-US ] = "Fields";
+};
+
+String SIP_SA_GRAFRED
+{
+ Text [ en-US ] = "Red";
+};
+String SIP_SA_GRAFGREEN
+{
+ Text [ en-US ] = "Green";
+};
+String SIP_SA_GRAFBLUE
+{
+ Text [ en-US ] = "Blue";
+};
+String SIP_SA_GRAFLUMINANCE
+{
+ Text [ en-US ] = "Brightness";
+};
+String SIP_SA_GRAFCONTRAST
+{
+ Text [ en-US ] = "Contrast";
+};
+String SIP_SA_GRAFGAMMA
+{
+ Text [ en-US ] = "Gamma";
+};
+String SIP_SA_GRAFTRANSPARENCE
+{
+ Text [ en-US ] = "Transparency";
+};
+String SIP_SA_GRAFINVERT
+{
+ Text [ en-US ] = "Invert";
+};
+String SIP_SA_GRAFMODE
+{
+ Text [ en-US ] = "Graphics mode";
+};
+String SIP_SA_GRAFCROP
+{
+ Text [ en-US ] = "Crop";
+
+};
+String SIP_SA_GRAFRESERVE3 { Text = "" ; };
+String SIP_SA_GRAFRESERVE4 { Text = "" ; };
+String SIP_SA_GRAFRESERVE5 { Text = "" ; };
+String SIP_SA_GRAFRESERVE6 { Text = "" ; };
+
+Bitmap SIP_SA_PAGESHADOW35X35
+{
+ File = "pageshadow35x35.png";
+};
+
+Bitmap SIP_SA_MARKERS
+{
+ File = "markers.bmp";
+};
+
+Bitmap SIP_SA_FINE_MARKERS
+{
+ File = "markers2.bmp";
+};
+
+// #100499#
+Bitmap BMP_SVXOLEOBJ
+{
+ File = "oleobj.bmp" ;
+};
+
+// #101928#
+Bitmap SIP_SA_ACCESSIBILITY_MARKERS
+{
+ File = "markersACC.bmp";
+};
+
+String STR_ObjNameSingulMEDIA
+{
+ Text [ en-US ] = "Media object" ;
+};
+String STR_ObjNamePluralMEDIA
+{
+ Text [ en-US ] = "Media objects" ;
+};
+
+// drawing layer table strings
+
+String STR_TABLE_ATTR
+{
+ Text [ en-US ] = "Apply table attributes" ;
+};
+String STR_TABLE_AUTOFMT
+{
+ Text [ en-US ] = "AutoFormat table" ;
+};
+String STR_TABLE_INSCOL
+{
+ Text [ en-US ] = "Insert column" ;
+};
+String STR_TABLE_INSROW
+{
+ Text [ en-US ] = "Insert row" ;
+};
+String STR_UNDO_COL_DELETE
+{
+ Text [ en-US ] = "Delete column" ;
+};
+String STR_UNDO_ROW_DELETE
+{
+ Text [ en-US ] = "Delete row" ;
+};
+String STR_TABLE_SPLIT
+{
+ Text [ en-US ] = "Split cells" ;
+};
+String STR_TABLE_MERGE
+{
+ Text [ en-US ] = "Merge cells" ;
+};
+String STR_TABLE_NUMFORMAT
+{
+ Text [ en-US ] = "Format cell" ;
+};
+
+String STR_TABLE_DISTRIBUTE_ROWS
+{
+ Text [ en-US ] = "Distribute rows" ;
+};
+
+String STR_TABLE_DISTRIBUTE_COLUMNS
+{
+ Text [ en-US ] = "Distribute columns" ;
+};
+
+String STR_TABLE_STYLE
+{
+ Text [ en-US ] = "Table style" ;
+};
+
+String STR_TABLE_STYLE_SETTINGS
+{
+ Text [ en-US ] = "Table style settings" ;
+};
+
+String STR_ObjNameSingulTable
+{
+ Text [ en-US ] = "Table";
+};
+String STR_ObjNamePluralTable
+{
+ Text [ en-US ] = "Tables";
+};
+
+Bitmap SIP_SA_CROP_MARKERS
+{
+ File = "cropmarkers.bmp";
+};
+
+Bitmap SIP_SA_CROP_FINE_MARKERS
+{
+ File = "cropmarkers2.bmp";
+};
+
+Bitmap SIP_SA_ACCESSIBILITY_CROP_MARKERS
+{
+ File = "cropmarkersACC.bmp";
+};
+
+// ******************************************************************* EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/svdraw/svdtext.cxx b/svx/source/svdraw/svdtext.cxx
new file mode 100644
index 000000000000..cc65d71f8e05
--- /dev/null
+++ b/svx/source/svdraw/svdtext.cxx
@@ -0,0 +1,224 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#define ITEMID_FONTHEIGHT EE_CHAR_FONTHEIGHT
+
+#include "svx/svdotext.hxx"
+#include "svx/svdetc.hxx"
+#include "editeng/outlobj.hxx"
+#include "svx/svdoutl.hxx"
+#include "svx/svdmodel.hxx"
+#include "editeng/fhgtitem.hxx"
+#include <editeng/eeitem.hxx>
+#include <svl/itemset.hxx>
+
+SdrText::SdrText( SdrTextObj& rObject, OutlinerParaObject* pOutlinerParaObject /* = 0 */ )
+: mpOutlinerParaObject( pOutlinerParaObject )
+, mrObject( rObject )
+, mpModel( rObject.GetModel() )
+, mbPortionInfoChecked( false )
+{
+ OSL_ENSURE(&mrObject, "SdrText created without SdrTextObj (!)");
+}
+
+SdrText::~SdrText()
+{
+ clearWeak();
+ delete mpOutlinerParaObject;
+}
+
+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())
+ {
+ // #i102062# MemoryLeak closed
+ delete mpOutlinerParaObject;
+ mpOutlinerParaObject = rOutliner.CreateParaObject();
+ }
+ }
+}
+
+void SdrText::ReformatText()
+{
+ mbPortionInfoChecked=sal_False;
+ mpOutlinerParaObject->ClearPortionInfo();
+}
+
+const SfxItemSet& SdrText::GetItemSet() const
+{
+ return const_cast< SdrText* >(this)->GetObjectItemSet();
+}
+
+void SdrText::SetOutlinerParaObject( OutlinerParaObject* pTextObject )
+{
+ if( mpOutlinerParaObject != pTextObject )
+ {
+ if( mpModel )
+ {
+ // Update HitTestOutliner
+ const SdrTextObj* pTestObj = mpModel->GetHitTestOutliner().GetTextObj();
+ if( pTestObj && pTestObj->GetOutlinerParaObject() == mpOutlinerParaObject )
+ mpModel->GetHitTestOutliner().SetTextObj( 0 );
+ }
+
+ if( mpOutlinerParaObject )
+ delete mpOutlinerParaObject;
+
+ mpOutlinerParaObject = pTextObject;
+
+ mbPortionInfoChecked = false;
+ }
+}
+
+OutlinerParaObject* SdrText::GetOutlinerParaObject() const
+{
+ return mpOutlinerParaObject;
+}
+
+/** returns the current OutlinerParaObject and removes it from this instance */
+OutlinerParaObject* SdrText::RemoveOutlinerParaObject()
+{
+ if( mpModel )
+ {
+ // Update HitTestOutliner
+ const SdrTextObj* pTestObj = mpModel->GetHitTestOutliner().GetTextObj();
+ if( pTestObj && pTestObj->GetOutlinerParaObject() == mpOutlinerParaObject )
+ mpModel->GetHitTestOutliner().SetTextObj( 0 );
+ }
+
+ OutlinerParaObject* pOPO = mpOutlinerParaObject;
+
+ mpOutlinerParaObject = 0;
+ mbPortionInfoChecked = false;
+
+ return pOPO;
+}
+
+void SdrText::SetModel( SdrModel* pNewModel )
+{
+ if( pNewModel == mpModel )
+ return;
+
+ SdrModel* pOldModel = mpModel;
+ mpModel = pNewModel;
+
+ if( mpOutlinerParaObject && pOldModel!=NULL && pNewModel!=NULL)
+ {
+ bool bHgtSet = GetObjectItemSet().GetItemState(EE_CHAR_FONTHEIGHT, sal_True) == SFX_ITEM_SET;
+
+ MapUnit aOldUnit(pOldModel->GetScaleUnit());
+ MapUnit aNewUnit(pNewModel->GetScaleUnit());
+ FASTBOOL bScaleUnitChanged=aNewUnit!=aOldUnit;
+ // und nun dem OutlinerParaObject einen neuen Pool verpassen
+ // !!! Hier muss noch DefTab und RefDevice der beiden Models
+ // !!! verglichen werden und dann ggf. AutoGrow zuschlagen !!!
+ // !!! fehlende Implementation !!!
+ sal_uIntPtr nOldFontHgt=pOldModel->GetDefaultFontHeight();
+ sal_uIntPtr nNewFontHgt=pNewModel->GetDefaultFontHeight();
+ sal_Bool bDefHgtChanged=nNewFontHgt!=nOldFontHgt;
+ sal_Bool bSetHgtItem=bDefHgtChanged && !bHgtSet;
+ if (bSetHgtItem)
+ { // #32665#
+ // zunaechst das HeightItem festklopfen, damit
+ // 1. Es eben bestehen bleibt und
+ // 2. DoStretchChars vom richtigen Wert ausgeht
+ SetObjectItem(SvxFontHeightItem(nOldFontHgt, 100, EE_CHAR_FONTHEIGHT));
+ }
+ // erst jetzt den Outliner holen, etc. damit obiges SetAttr auch wirkt
+ SdrOutliner& rOutliner = mrObject.ImpGetDrawOutliner();
+ rOutliner.SetText(*mpOutlinerParaObject);
+ delete mpOutlinerParaObject;
+ mpOutlinerParaObject=0;
+ if (bScaleUnitChanged)
+ {
+ Fraction aMetricFactor=GetMapFactor(aOldUnit,aNewUnit).X();
+
+ // Funktioniert nicht richtig:
+ // Geht am Outliner leider nur in %
+ // double nPercFloat=double(aMetricFactor)*100+0.5;
+ // sal_uInt16 nPerc=(sal_uInt16)nPercFloat;
+ // rOutliner.DoStretchChars(100,nPerc);
+
+ if (bSetHgtItem)
+ {
+ // Und nun noch das Rahmenattribut korregieren
+ nOldFontHgt=BigMulDiv(nOldFontHgt,aMetricFactor.GetNumerator(),aMetricFactor.GetDenominator());
+ SetObjectItem(SvxFontHeightItem(nOldFontHgt, 100, EE_CHAR_FONTHEIGHT));
+ }
+ }
+ SetOutlinerParaObject(rOutliner.CreateParaObject()); // #34494#
+ mpOutlinerParaObject->ClearPortionInfo();
+ mbPortionInfoChecked=sal_False;
+ rOutliner.Clear();
+ }
+}
+
+void SdrText::ForceOutlinerParaObject( sal_uInt16 nOutlMode )
+{
+ if( mpModel && !mpOutlinerParaObject )
+ {
+ Outliner* pOutliner = SdrMakeOutliner( nOutlMode, mpModel );
+ if( pOutliner )
+ {
+ Outliner& aDrawOutliner = mpModel->GetDrawOutliner();
+ pOutliner->SetCalcFieldValueHdl( aDrawOutliner.GetCalcFieldValueHdl() );
+
+ pOutliner->SetStyleSheet( 0, GetStyleSheet());
+ OutlinerParaObject* pOutlinerParaObject = pOutliner->CreateParaObject();
+ SetOutlinerParaObject( pOutlinerParaObject );
+
+ delete pOutliner;
+ }
+ }
+}
+
+const SfxItemSet& SdrText::GetObjectItemSet()
+{
+ return mrObject.GetObjectItemSet();
+}
+
+void SdrText::SetObjectItem(const SfxPoolItem& rItem)
+{
+ mrObject.SetObjectItem( rItem );
+}
+
+SfxStyleSheet* SdrText::GetStyleSheet() const
+{
+ return mrObject.GetStyleSheet();
+}
diff --git a/svx/source/svdraw/svdtrans.cxx b/svx/source/svdraw/svdtrans.cxx
new file mode 100644
index 000000000000..5559b3a9df03
--- /dev/null
+++ b/svx/source/svdraw/svdtrans.cxx
@@ -0,0 +1,1271 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svdtrans.hxx>
+#include <math.h>
+#include <svx/xpoly.hxx>
+
+#include <vcl/virdev.hxx>
+#include <tools/bigint.hxx>
+#include <tools/debug.hxx>
+#include <unotools/syslocale.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void MoveXPoly(XPolygon& rPoly, const Size& S)
+{
+ rPoly.Move(S.Width(),S.Height());
+}
+
+void MoveXPoly(XPolyPolygon& rPoly, const Size& S)
+{
+ rPoly.Move(S.Width(),S.Height());
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void ResizeRect(Rectangle& rRect, const Point& rRef, const Fraction& rxFact, const Fraction& ryFact, FASTBOOL bNoJustify)
+{
+ Fraction xFact(rxFact);
+ Fraction yFact(ryFact);
+ //long nHgt=rRect.Bottom()-rRect.Top();
+
+ {
+ if (xFact.GetDenominator()==0) {
+ long nWdt=rRect.Right()-rRect.Left();
+ if (xFact.GetNumerator()>=0) { // DivZero abfangen
+ xFact=Fraction(xFact.GetNumerator(),1);
+ if (nWdt==0) rRect.Right()++;
+ } else {
+ xFact=Fraction(xFact.GetNumerator(),-1);
+ if (nWdt==0) rRect.Left()--;
+ }
+ }
+ rRect.Left() =rRef.X()+Round(((double)(rRect.Left() -rRef.X())*xFact.GetNumerator())/xFact.GetDenominator());
+ rRect.Right() =rRef.X()+Round(((double)(rRect.Right() -rRef.X())*xFact.GetNumerator())/xFact.GetDenominator());
+ }
+ {
+ if (yFact.GetDenominator()==0) {
+ long nHgt=rRect.Bottom()-rRect.Top();
+ if (yFact.GetNumerator()>=0) { // DivZero abfangen
+ yFact=Fraction(yFact.GetNumerator(),1);
+ if (nHgt==0) rRect.Bottom()++;
+ } else {
+ yFact=Fraction(yFact.GetNumerator(),-1);
+ if (nHgt==0) rRect.Top()--;
+ }
+
+ yFact=Fraction(yFact.GetNumerator(),1); // DivZero abfangen
+ }
+ rRect.Top() =rRef.Y()+Round(((double)(rRect.Top() -rRef.Y())*yFact.GetNumerator())/yFact.GetDenominator());
+ rRect.Bottom()=rRef.Y()+Round(((double)(rRect.Bottom()-rRef.Y())*yFact.GetNumerator())/yFact.GetDenominator());
+ }
+ if (!bNoJustify) rRect.Justify();
+}
+
+
+void ResizePoly(Polygon& rPoly, const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+{
+ sal_uInt16 nAnz=rPoly.GetSize();
+ for (sal_uInt16 i=0; i<nAnz; i++) {
+ ResizePoint(rPoly[i],rRef,xFact,yFact);
+ }
+}
+
+void ResizeXPoly(XPolygon& rPoly, const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+{
+ sal_uInt16 nAnz=rPoly.GetPointCount();
+ for (sal_uInt16 i=0; i<nAnz; i++) {
+ ResizePoint(rPoly[i],rRef,xFact,yFact);
+ }
+}
+
+void ResizePoly(PolyPolygon& rPoly, const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+{
+ sal_uInt16 nAnz=rPoly.Count();
+ for (sal_uInt16 i=0; i<nAnz; i++) {
+ ResizePoly(rPoly[i],rRef,xFact,yFact);
+ }
+}
+
+void ResizeXPoly(XPolyPolygon& rPoly, const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+{
+ sal_uInt16 nAnz=rPoly.Count();
+ for (sal_uInt16 i=0; i<nAnz; i++) {
+ ResizeXPoly(rPoly[i],rRef,xFact,yFact);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void RotatePoly(Polygon& rPoly, const Point& rRef, double sn, double cs)
+{
+ sal_uInt16 nAnz=rPoly.GetSize();
+ for (sal_uInt16 i=0; i<nAnz; i++) {
+ RotatePoint(rPoly[i],rRef,sn,cs);
+ }
+}
+
+void RotateXPoly(XPolygon& rPoly, const Point& rRef, double sn, double cs)
+{
+ sal_uInt16 nAnz=rPoly.GetPointCount();
+ for (sal_uInt16 i=0; i<nAnz; i++) {
+ RotatePoint(rPoly[i],rRef,sn,cs);
+ }
+}
+
+void RotatePoly(PolyPolygon& rPoly, const Point& rRef, double sn, double cs)
+{
+ sal_uInt16 nAnz=rPoly.Count();
+ for (sal_uInt16 i=0; i<nAnz; i++) {
+ RotatePoly(rPoly[i],rRef,sn,cs);
+ }
+}
+
+void RotateXPoly(XPolyPolygon& rPoly, const Point& rRef, double sn, double cs)
+{
+ sal_uInt16 nAnz=rPoly.Count();
+ for (sal_uInt16 i=0; i<nAnz; i++) {
+ RotateXPoly(rPoly[i],rRef,sn,cs);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void MirrorRect(Rectangle& rRect, const Point& /*rRef1*/, const Point& /*rRef2*/, FASTBOOL bNoJustify)
+{
+ // !!! fehlende Implementation !!!
+ if (!bNoJustify) rRect.Justify();
+}
+
+void MirrorPoint(Point& rPnt, const Point& rRef1, const Point& rRef2)
+{
+ long mx=rRef2.X()-rRef1.X();
+ long my=rRef2.Y()-rRef1.Y();
+ if (mx==0) { // Achse senkrecht
+ long dx=rRef1.X()-rPnt.X();
+ rPnt.X()+=2*dx;
+ } else if (my==0) { // Achse waagerecht
+ long dy=rRef1.Y()-rPnt.Y();
+ rPnt.Y()+=2*dy;
+ } else if (mx==my) { // Achse diagonal '\'
+ long dx1=rPnt.X()-rRef1.X();
+ long dy1=rPnt.Y()-rRef1.Y();
+ rPnt.X()=rRef1.X()+dy1;
+ rPnt.Y()=rRef1.Y()+dx1;
+ } else if (mx==-my) { // Achse diagonal '/'
+ long dx1=rPnt.X()-rRef1.X();
+ long dy1=rPnt.Y()-rRef1.Y();
+ rPnt.X()=rRef1.X()-dy1;
+ rPnt.Y()=rRef1.Y()-dx1;
+ } else { // beliebige Achse
+ // mal optimieren !!!
+ // Lot auf der Spiegelachse faellen oder so
+ long nRefWink=GetAngle(rRef2-rRef1);
+ rPnt-=rRef1;
+ long nPntWink=GetAngle(rPnt);
+ long nWink=2*(nRefWink-nPntWink);
+ double a=nWink*nPi180;
+ double nSin=sin(a);
+ double nCos=cos(a);
+ RotatePoint(rPnt,Point(),nSin,nCos);
+ rPnt+=rRef1;
+ }
+}
+
+void MirrorPoly(Polygon& rPoly, const Point& rRef1, const Point& rRef2)
+{
+ sal_uInt16 nAnz=rPoly.GetSize();
+ for (sal_uInt16 i=0; i<nAnz; i++) {
+ MirrorPoint(rPoly[i],rRef1,rRef2);
+ }
+}
+
+void MirrorXPoly(XPolygon& rPoly, const Point& rRef1, const Point& rRef2)
+{
+ sal_uInt16 nAnz=rPoly.GetPointCount();
+ for (sal_uInt16 i=0; i<nAnz; i++) {
+ MirrorPoint(rPoly[i],rRef1,rRef2);
+ }
+}
+
+void MirrorPoly(PolyPolygon& rPoly, const Point& rRef1, const Point& rRef2)
+{
+ sal_uInt16 nAnz=rPoly.Count();
+ for (sal_uInt16 i=0; i<nAnz; i++) {
+ MirrorPoly(rPoly[i],rRef1,rRef2);
+ }
+}
+
+void MirrorXPoly(XPolyPolygon& rPoly, const Point& rRef1, const Point& rRef2)
+{
+ sal_uInt16 nAnz=rPoly.Count();
+ for (sal_uInt16 i=0; i<nAnz; i++) {
+ MirrorXPoly(rPoly[i],rRef1,rRef2);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void ShearPoly(Polygon& rPoly, const Point& rRef, double tn, FASTBOOL bVShear)
+{
+ sal_uInt16 nAnz=rPoly.GetSize();
+ for (sal_uInt16 i=0; i<nAnz; i++) {
+ ShearPoint(rPoly[i],rRef,tn,bVShear);
+ }
+}
+
+void ShearXPoly(XPolygon& rPoly, const Point& rRef, double tn, FASTBOOL bVShear)
+{
+ sal_uInt16 nAnz=rPoly.GetPointCount();
+ for (sal_uInt16 i=0; i<nAnz; i++) {
+ ShearPoint(rPoly[i],rRef,tn,bVShear);
+ }
+}
+
+void ShearPoly(PolyPolygon& rPoly, const Point& rRef, double tn, FASTBOOL bVShear)
+{
+ sal_uInt16 nAnz=rPoly.Count();
+ for (sal_uInt16 i=0; i<nAnz; i++) {
+ ShearPoly(rPoly[i],rRef,tn,bVShear);
+ }
+}
+
+void ShearXPoly(XPolyPolygon& rPoly, const Point& rRef, double tn, FASTBOOL bVShear)
+{
+ sal_uInt16 nAnz=rPoly.Count();
+ for (sal_uInt16 i=0; i<nAnz; i++) {
+ ShearXPoly(rPoly[i],rRef,tn,bVShear);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@ @@@@@ @@@@ @@@@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@@@@ @@ @@ @@ @@ @@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@@@ @@ @@ @@@@ @@@@ @@ @@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+double CrookRotateXPoint(Point& rPnt, Point* pC1, Point* pC2, const Point& rCenter,
+ const Point& rRad, double& rSin, double& rCos, FASTBOOL bVert)
+{
+ FASTBOOL bC1=pC1!=NULL;
+ FASTBOOL bC2=pC2!=NULL;
+ long x0=rPnt.X();
+ long y0=rPnt.Y();
+ long cx=rCenter.X();
+ long cy=rCenter.Y();
+ double nWink=GetCrookAngle(rPnt,rCenter,rRad,bVert);
+ double sn=sin(nWink);
+ double cs=cos(nWink);
+ RotatePoint(rPnt,rCenter,sn,cs);
+ if (bC1) {
+ if (bVert) {
+ // Richtung Zentrum verschieben, als Ausgangsposition fuer Rotate
+ pC1->Y()-=y0;
+ // Resize, entsprechend der Entfernung vom Zentrum
+ pC1->Y()=Round(((double)pC1->Y()) /rRad.X()*(cx-pC1->X()));
+ pC1->Y()+=cy;
+ } else {
+ // Richtung Zentrum verschieben, als Ausgangsposition fuer Rotate
+ pC1->X()-=x0;
+ // Resize, entsprechend der Entfernung vom Zentrum
+ long nPntRad=cy-pC1->Y();
+ double nFact=(double)nPntRad/(double)rRad.Y();
+ pC1->X()=Round((double)pC1->X()*nFact);
+ pC1->X()+=cx;
+ }
+ RotatePoint(*pC1,rCenter,sn,cs);
+ }
+ if (bC2) {
+ if (bVert) {
+ // Richtung Zentrum verschieben, als Ausgangsposition fuer Rotate
+ pC2->Y()-=y0;
+ // Resize, entsprechend der Entfernung vom Zentrum
+ pC2->Y()=Round(((double)pC2->Y()) /rRad.X()*(rCenter.X()-pC2->X()));
+ pC2->Y()+=cy;
+ } else {
+ // Richtung Zentrum verschieben, als Ausgangsposition fuer Rotate
+ pC2->X()-=x0;
+ // Resize, entsprechend der Entfernung vom Zentrum
+ long nPntRad=rCenter.Y()-pC2->Y();
+ double nFact=(double)nPntRad/(double)rRad.Y();
+ pC2->X()=Round((double)pC2->X()*nFact);
+ pC2->X()+=cx;
+ }
+ RotatePoint(*pC2,rCenter,sn,cs);
+ }
+ rSin=sn;
+ rCos=cs;
+ return nWink;
+}
+
+double CrookSlantXPoint(Point& rPnt, Point* pC1, Point* pC2, const Point& rCenter,
+ const Point& rRad, double& rSin, double& rCos, FASTBOOL bVert)
+{
+ FASTBOOL bC1=pC1!=NULL;
+ FASTBOOL bC2=pC2!=NULL;
+ long x0=rPnt.X();
+ long y0=rPnt.Y();
+ long dx1=0,dy1=0;
+ long dxC1=0,dyC1=0;
+ long dxC2=0,dyC2=0;
+ if (bVert) {
+ long nStart=rCenter.X()-rRad.X();
+ dx1=rPnt.X()-nStart;
+ rPnt.X()=nStart;
+ if (bC1) {
+ dxC1=pC1->X()-nStart;
+ pC1->X()=nStart;
+ }
+ if (bC2) {
+ dxC2=pC2->X()-nStart;
+ pC2->X()=nStart;
+ }
+ } else {
+ long nStart=rCenter.Y()-rRad.Y();
+ dy1=rPnt.Y()-nStart;
+ rPnt.Y()=nStart;
+ if (bC1) {
+ dyC1=pC1->Y()-nStart;
+ pC1->Y()=nStart;
+ }
+ if (bC2) {
+ dyC2=pC2->Y()-nStart;
+ pC2->Y()=nStart;
+ }
+ }
+ double nWink=GetCrookAngle(rPnt,rCenter,rRad,bVert);
+ double sn=sin(nWink);
+ double cs=cos(nWink);
+ RotatePoint(rPnt,rCenter,sn,cs);
+ if (bC1) { if (bVert) pC1->Y()-=y0-rCenter.Y(); else pC1->X()-=x0-rCenter.X(); RotatePoint(*pC1,rCenter,sn,cs); }
+ if (bC2) { if (bVert) pC2->Y()-=y0-rCenter.Y(); else pC2->X()-=x0-rCenter.X(); RotatePoint(*pC2,rCenter,sn,cs); }
+ if (bVert) {
+ rPnt.X()+=dx1;
+ if (bC1) pC1->X()+=dxC1;
+ if (bC2) pC2->X()+=dxC2;
+ } else {
+ rPnt.Y()+=dy1;
+ if (bC1) pC1->Y()+=dyC1;
+ if (bC2) pC2->Y()+=dyC2;
+ }
+ rSin=sn;
+ rCos=cs;
+ return nWink;
+}
+
+double CrookStretchXPoint(Point& rPnt, Point* pC1, Point* pC2, const Point& rCenter,
+ const Point& rRad, double& rSin, double& rCos, FASTBOOL bVert,
+ const Rectangle rRefRect)
+{
+ //FASTBOOL bC1=pC1!=NULL;
+ //FASTBOOL bC2=pC2!=NULL;
+ //long x0=rPnt.X();
+ long y0=rPnt.Y();
+ CrookSlantXPoint(rPnt,pC1,pC2,rCenter,rRad,rSin,rCos,bVert);
+ if (bVert) {
+ } else {
+ //long nBase=rCenter.Y()-rRad.Y();
+ long nTop=rRefRect.Top();
+ long nBtm=rRefRect.Bottom();
+ long nHgt=nBtm-nTop;
+ long dy=rPnt.Y()-y0;
+ //FASTBOOL bOben=rRad.Y()<0;
+ double a=((double)(y0-nTop))/nHgt;
+ a*=dy;
+ rPnt.Y()=y0+Round(a);
+ } return 0.0;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void CrookRotatePoly(XPolygon& rPoly, const Point& rCenter, const Point& rRad, FASTBOOL bVert)
+{
+ double nSin,nCos;
+ sal_uInt16 nPointAnz=rPoly.GetPointCount();
+ sal_uInt16 i=0;
+ while (i<nPointAnz) {
+ Point* pPnt=&rPoly[i];
+ Point* pC1=NULL;
+ Point* pC2=NULL;
+ if (i+1<nPointAnz && rPoly.IsControl(i)) { // Kontrollpunkt links
+ pC1=pPnt;
+ i++;
+ pPnt=&rPoly[i];
+ }
+ i++;
+ if (i<nPointAnz && rPoly.IsControl(i)) { // Kontrollpunkt rechts
+ pC2=&rPoly[i];
+ i++;
+ }
+ CrookRotateXPoint(*pPnt,pC1,pC2,rCenter,rRad,nSin,nCos,bVert);
+ }
+}
+
+void CrookSlantPoly(XPolygon& rPoly, const Point& rCenter, const Point& rRad, FASTBOOL bVert)
+{
+ double nSin,nCos;
+ sal_uInt16 nPointAnz=rPoly.GetPointCount();
+ sal_uInt16 i=0;
+ while (i<nPointAnz) {
+ Point* pPnt=&rPoly[i];
+ Point* pC1=NULL;
+ Point* pC2=NULL;
+ if (i+1<nPointAnz && rPoly.IsControl(i)) { // Kontrollpunkt links
+ pC1=pPnt;
+ i++;
+ pPnt=&rPoly[i];
+ }
+ i++;
+ if (i<nPointAnz && rPoly.IsControl(i)) { // Kontrollpunkt rechts
+ pC2=&rPoly[i];
+ i++;
+ }
+ CrookSlantXPoint(*pPnt,pC1,pC2,rCenter,rRad,nSin,nCos,bVert);
+ }
+}
+
+void CrookStretchPoly(XPolygon& rPoly, const Point& rCenter, const Point& rRad, FASTBOOL bVert, const Rectangle rRefRect)
+{
+ double nSin,nCos;
+ sal_uInt16 nPointAnz=rPoly.GetPointCount();
+ sal_uInt16 i=0;
+ while (i<nPointAnz) {
+ Point* pPnt=&rPoly[i];
+ Point* pC1=NULL;
+ Point* pC2=NULL;
+ if (i+1<nPointAnz && rPoly.IsControl(i)) { // Kontrollpunkt links
+ pC1=pPnt;
+ i++;
+ pPnt=&rPoly[i];
+ }
+ i++;
+ if (i<nPointAnz && rPoly.IsControl(i)) { // Kontrollpunkt rechts
+ pC2=&rPoly[i];
+ i++;
+ }
+ CrookStretchXPoint(*pPnt,pC1,pC2,rCenter,rRad,nSin,nCos,bVert,rRefRect);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void CrookRotatePoly(XPolyPolygon& rPoly, const Point& rCenter, const Point& rRad, FASTBOOL bVert)
+{
+ sal_uInt16 nPolyAnz=rPoly.Count();
+ for (sal_uInt16 nPolyNum=0; nPolyNum<nPolyAnz; nPolyNum++) {
+ CrookRotatePoly(rPoly[nPolyNum],rCenter,rRad,bVert);
+ }
+}
+
+void CrookSlantPoly(XPolyPolygon& rPoly, const Point& rCenter, const Point& rRad, FASTBOOL bVert)
+{
+ sal_uInt16 nPolyAnz=rPoly.Count();
+ for (sal_uInt16 nPolyNum=0; nPolyNum<nPolyAnz; nPolyNum++) {
+ CrookSlantPoly(rPoly[nPolyNum],rCenter,rRad,bVert);
+ }
+}
+
+void CrookStretchPoly(XPolyPolygon& rPoly, const Point& rCenter, const Point& rRad, FASTBOOL bVert, const Rectangle rRefRect)
+{
+ sal_uInt16 nPolyAnz=rPoly.Count();
+ for (sal_uInt16 nPolyNum=0; nPolyNum<nPolyAnz; nPolyNum++) {
+ CrookStretchPoly(rPoly[nPolyNum],rCenter,rRad,bVert,rRefRect);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+long GetAngle(const Point& rPnt)
+{
+ long a=0;
+ if (rPnt.Y()==0) {
+ if (rPnt.X()<0) a=-18000;
+ } else if (rPnt.X()==0) {
+ if (rPnt.Y()>0) a=-9000;
+ else a=9000;
+ } else {
+ a=Round((atan2((double)-rPnt.Y(),(double)rPnt.X())/nPi180));
+ }
+ return a;
+}
+
+long NormAngle180(long a)
+{
+ while (a<18000) a+=36000;
+ while (a>=18000) a-=36000;
+ return a;
+}
+
+long NormAngle360(long a)
+{
+ while (a<0) a+=36000;
+ while (a>=36000) a-=36000;
+ return a;
+}
+
+sal_uInt16 GetAngleSector(long nWink)
+{
+ while (nWink<0) nWink+=36000;
+ while (nWink>=36000) nWink-=36000;
+ if (nWink< 9000) return 0;
+ if (nWink<18000) return 1;
+ if (nWink<27000) return 2;
+ return 3;
+}
+
+long GetLen(const Point& rPnt)
+{
+ long x=Abs(rPnt.X());
+ long y=Abs(rPnt.Y());
+ if (x+y<0x8000) { // weil 7FFF * 7FFF * 2 = 7FFE0002
+ x*=x;
+ y*=y;
+ x+=y;
+ x=Round(sqrt((double)x));
+ return x;
+ } else {
+ double nx=x;
+ double ny=y;
+ nx*=nx;
+ ny*=ny;
+ nx+=ny;
+ nx=sqrt(nx);
+ if (nx>0x7FFFFFFF) {
+ return 0x7FFFFFFF; // Ueberlauf, mehr is nich!
+ } else {
+ return Round(nx);
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void GeoStat::RecalcSinCos()
+{
+ if (nDrehWink==0) {
+ nSin=0.0;
+ nCos=1.0;
+ } else {
+ double a=nDrehWink*nPi180;
+ nSin=sin(a);
+ nCos=cos(a);
+ }
+}
+
+void GeoStat::RecalcTan()
+{
+ if (nShearWink==0) {
+ nTan=0.0;
+ } else {
+ double a=nShearWink*nPi180;
+ nTan=tan(a);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+Polygon Rect2Poly(const Rectangle& rRect, const GeoStat& rGeo)
+{
+ Polygon aPol(5);
+ aPol[0]=rRect.TopLeft();
+ aPol[1]=rRect.TopRight();
+ aPol[2]=rRect.BottomRight();
+ aPol[3]=rRect.BottomLeft();
+ aPol[4]=rRect.TopLeft();
+ if (rGeo.nShearWink!=0) ShearPoly(aPol,rRect.TopLeft(),rGeo.nTan);
+ if (rGeo.nDrehWink!=0) RotatePoly(aPol,rRect.TopLeft(),rGeo.nSin,rGeo.nCos);
+ return aPol;
+}
+
+void Poly2Rect(const Polygon& rPol, Rectangle& rRect, GeoStat& rGeo)
+{
+ rGeo.nDrehWink=GetAngle(rPol[1]-rPol[0]);
+ rGeo.nDrehWink=NormAngle360(rGeo.nDrehWink);
+ // Drehung ist damit im Kasten
+ rGeo.RecalcSinCos();
+
+ Point aPt1(rPol[1]-rPol[0]);
+ if (rGeo.nDrehWink!=0) RotatePoint(aPt1,Point(0,0),-rGeo.nSin,rGeo.nCos); // -Sin fuer Rueckdrehung
+ long nWdt=aPt1.X();
+
+ Point aPt0(rPol[0]);
+ Point aPt3(rPol[3]-rPol[0]);
+ if (rGeo.nDrehWink!=0) RotatePoint(aPt3,Point(0,0),-rGeo.nSin,rGeo.nCos); // -Sin fuer Rueckdrehung
+ long nHgt=aPt3.Y();
+
+ if(aPt3.X())
+ {
+ // #i74358# the axes are not orthogonal, so for getting the correct height,
+ // calculate the length of aPt3
+
+ // #i74358# this change was wrong, in the field of the old geometry stuff
+ // it is not an error. The new height always is the same as before; shear
+ // does not change object height at all. This is different from the interactions,
+ // but obviously wanted in the old versions.
+ //
+ // nHgt = static_cast< long >(sqrt(static_cast< double >(aPt3.X() * aPt3.X() + aPt3.Y() * aPt3.Y())));
+ }
+
+ long nShW=GetAngle(aPt3);
+ nShW-=27000; // ShearWink wird zur Senkrechten gemessen
+ nShW=-nShW; // Negieren, denn '+' ist Rechtskursivierung
+
+ FASTBOOL bMirr=aPt3.Y()<0;
+ if (bMirr) { // "Punktetausch" bei Spiegelung
+ nHgt=-nHgt;
+ nShW+=18000;
+ aPt0=rPol[3];
+ }
+ nShW=NormAngle180(nShW);
+ if (nShW<-9000 || nShW>9000) {
+ nShW=NormAngle180(nShW+18000);
+ }
+ if (nShW<-SDRMAXSHEAR) nShW=-SDRMAXSHEAR; // ShearWinkel begrenzen auf +/- 89.00 deg
+ if (nShW>SDRMAXSHEAR) nShW=SDRMAXSHEAR;
+ rGeo.nShearWink=nShW;
+ rGeo.RecalcTan();
+ Point aRU(aPt0);
+ aRU.X()+=nWdt;
+ aRU.Y()+=nHgt;
+ rRect=Rectangle(aPt0,aRU);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void OrthoDistance8(const Point& rPt0, Point& rPt, FASTBOOL bBigOrtho)
+{
+ long dx=rPt.X()-rPt0.X();
+ long dy=rPt.Y()-rPt0.Y();
+ long dxa=Abs(dx);
+ long dya=Abs(dy);
+ if (dx==0 || dy==0 || dxa==dya) return;
+ if (dxa>=dya*2) { rPt.Y()=rPt0.Y(); return; }
+ if (dya>=dxa*2) { rPt.X()=rPt0.X(); return; }
+ if ((dxa<dya) != bBigOrtho) {
+ rPt.Y()=rPt0.Y()+(dxa* (dy>=0 ? 1 : -1) );
+ } else {
+ rPt.X()=rPt0.X()+(dya* (dx>=0 ? 1 : -1) );
+ }
+}
+
+void OrthoDistance4(const Point& rPt0, Point& rPt, FASTBOOL bBigOrtho)
+{
+ long dx=rPt.X()-rPt0.X();
+ long dy=rPt.Y()-rPt0.Y();
+ long dxa=Abs(dx);
+ long dya=Abs(dy);
+ if ((dxa<dya) != bBigOrtho) {
+ rPt.Y()=rPt0.Y()+(dxa* (dy>=0 ? 1 : -1) );
+ } else {
+ rPt.X()=rPt0.X()+(dya* (dx>=0 ? 1 : -1) );
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+long BigMulDiv(long nVal, long nMul, long nDiv)
+{
+ BigInt aVal(nVal);
+ aVal*=nMul;
+ if (aVal.IsNeg()!=(nDiv<0)) {
+ aVal-=nDiv/2; // fuer korrektes Runden
+ } else {
+ aVal+=nDiv/2; // fuer korrektes Runden
+ }
+ if(nDiv)
+ {
+ aVal/=nDiv;
+ return long(aVal);
+ }
+ return 0x7fffffff;
+}
+
+void Kuerzen(Fraction& rF, unsigned nDigits)
+{
+ sal_Int32 nMul=rF.GetNumerator();
+ sal_Int32 nDiv=rF.GetDenominator();
+ FASTBOOL bNeg=sal_False;
+ if (nMul<0) { nMul=-nMul; bNeg=!bNeg; }
+ if (nDiv<0) { nDiv=-nDiv; bNeg=!bNeg; }
+ if (nMul==0 || nDiv==0) return;
+ sal_uInt32 a;
+ a=sal_uInt32(nMul); unsigned nMulZ=0; // Fuehrende Nullen zaehlen
+ while (a<0x00800000) { nMulZ+=8; a<<=8; }
+ while (a<0x80000000) { nMulZ++; a<<=1; }
+ a=sal_uInt32(nDiv); unsigned nDivZ=0; // Fuehrende Nullen zaehlen
+ while (a<0x00800000) { nDivZ+=8; a<<=8; }
+ while (a<0x80000000) { nDivZ++; a<<=1; }
+ // Anzahl der verwendeten Digits bestimmen
+ int nMulDigits=32-nMulZ;
+ int nDivDigits=32-nDivZ;
+ // Nun bestimmen, wieviele Stellen hinten weg koennen
+ int nMulWeg=nMulDigits-nDigits; if (nMulWeg<0) nMulWeg=0;
+ int nDivWeg=nDivDigits-nDigits; if (nDivWeg<0) nDivWeg=0;
+ int nWeg=Min(nMulWeg,nDivWeg);
+ nMul>>=nWeg;
+ nDiv>>=nWeg;
+ if (nMul==0 || nDiv==0) {
+ DBG_WARNING("Oups, beim kuerzen einer Fraction hat sich Joe verrechnet.");
+ return;
+ }
+ if (bNeg) nMul=-nMul;
+ rF=Fraction(nMul,nDiv);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Wieviele eU-Einheiten passen in einen mm bzw. Inch?
+// Oder wie gross ist ein eU in mm bzw. Inch, und davon der Kehrwert
+
+FrPair GetInchOrMM(MapUnit eU)
+{
+ switch (eU) {
+ case MAP_1000TH_INCH: return FrPair(1000,1);
+ case MAP_100TH_INCH : return FrPair( 100,1);
+ case MAP_10TH_INCH : return FrPair( 10,1);
+ case MAP_INCH : return FrPair( 1,1);
+ case MAP_POINT : return FrPair( 72,1);
+ case MAP_TWIP : return FrPair(1440,1);
+ case MAP_100TH_MM : return FrPair( 100,1);
+ case MAP_10TH_MM : return FrPair( 10,1);
+ case MAP_MM : return FrPair( 1,1);
+ case MAP_CM : return FrPair( 1,10);
+ case MAP_PIXEL : {
+ VirtualDevice aVD;
+ aVD.SetMapMode(MapMode(MAP_100TH_MM));
+ Point aP(aVD.PixelToLogic(Point(64,64))); // 64 Pixel fuer bessere Genauigkeit
+ return FrPair(6400,aP.X(),6400,aP.Y());
+ }
+ case MAP_APPFONT: case MAP_SYSFONT: {
+ VirtualDevice aVD;
+ aVD.SetMapMode(MapMode(eU));
+ Point aP(aVD.LogicToPixel(Point(32,32))); // 32 Einheiten fuer bessere Genauigkeit
+ aVD.SetMapMode(MapMode(MAP_100TH_MM));
+ aP=aVD.PixelToLogic(aP);
+ return FrPair(3200,aP.X(),3200,aP.Y());
+ }
+ default: break;
+ }
+ return Fraction(1,1);
+}
+
+FrPair GetInchOrMM(FieldUnit eU)
+{
+ switch (eU) {
+ case FUNIT_INCH : return FrPair( 1,1);
+ case FUNIT_POINT : return FrPair( 72,1);
+ case FUNIT_TWIP : return FrPair(1440,1);
+ case FUNIT_100TH_MM : return FrPair( 100,1);
+ case FUNIT_MM : return FrPair( 1,1);
+ case FUNIT_CM : return FrPair( 1,10);
+ case FUNIT_M : return FrPair( 1,1000);
+ case FUNIT_KM : return FrPair( 1,1000000);
+ case FUNIT_PICA : return FrPair( 6,1);
+ case FUNIT_FOOT : return FrPair( 1,12);
+ case FUNIT_MILE : return FrPair( 1,63360);
+ default: break;
+ }
+ return Fraction(1,1);
+}
+
+// Den Faktor berechnen, der anzuwenden ist um n Einheiten von eS nach
+// eD umzurechnen. Z.B. GetMapFactor(UNIT_MM,UNIT_100TH_MM) => 100.
+
+FrPair GetMapFactor(MapUnit eS, MapUnit eD)
+{
+ if (eS==eD) return FrPair(1,1,1,1);
+ FrPair aS(GetInchOrMM(eS));
+ FrPair aD(GetInchOrMM(eD));
+ FASTBOOL bSInch=IsInch(eS);
+ FASTBOOL bDInch=IsInch(eD);
+ FrPair aRet(aD.X()/aS.X(),aD.Y()/aS.Y());
+ if (bSInch && !bDInch) { aRet.X()*=Fraction(127,5); aRet.Y()*=Fraction(127,5); }
+ if (!bSInch && bDInch) { aRet.X()*=Fraction(5,127); aRet.Y()*=Fraction(5,127); }
+ return aRet;
+};
+
+FrPair GetMapFactor(MapUnit eS, FieldUnit eD)
+{
+ FrPair aS(GetInchOrMM(eS));
+ FrPair aD(GetInchOrMM(eD));
+ FASTBOOL bSInch=IsInch(eS);
+ FASTBOOL bDInch=IsInch(eD);
+ FrPair aRet(aD.X()/aS.X(),aD.Y()/aS.Y());
+ if (bSInch && !bDInch) { aRet.X()*=Fraction(127,5); aRet.Y()*=Fraction(127,5); }
+ if (!bSInch && bDInch) { aRet.X()*=Fraction(5,127); aRet.Y()*=Fraction(5,127); }
+ return aRet;
+};
+
+FrPair GetMapFactor(FieldUnit eS, MapUnit eD)
+{
+ FrPair aS(GetInchOrMM(eS));
+ FrPair aD(GetInchOrMM(eD));
+ FASTBOOL bSInch=IsInch(eS);
+ FASTBOOL bDInch=IsInch(eD);
+ FrPair aRet(aD.X()/aS.X(),aD.Y()/aS.Y());
+ if (bSInch && !bDInch) { aRet.X()*=Fraction(127,5); aRet.Y()*=Fraction(127,5); }
+ if (!bSInch && bDInch) { aRet.X()*=Fraction(5,127); aRet.Y()*=Fraction(5,127); }
+ return aRet;
+};
+
+FrPair GetMapFactor(FieldUnit eS, FieldUnit eD)
+{
+ if (eS==eD) return FrPair(1,1,1,1);
+ FrPair aS(GetInchOrMM(eS));
+ FrPair aD(GetInchOrMM(eD));
+ FASTBOOL bSInch=IsInch(eS);
+ FASTBOOL bDInch=IsInch(eD);
+ FrPair aRet(aD.X()/aS.X(),aD.Y()/aS.Y());
+ if (bSInch && !bDInch) { aRet.X()*=Fraction(127,5); aRet.Y()*=Fraction(127,5); }
+ if (!bSInch && bDInch) { aRet.X()*=Fraction(5,127); aRet.Y()*=Fraction(5,127); }
+ return aRet;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ // 1 mile = 8 furlong = 63.360" = 1.609.344,0mm
+ // 1 furlong = 10 chains = 7.920" = 201.168,0mm
+ // 1 chain = 4 poles = 792" = 20.116,8mm
+ // 1 pole = 5 1/2 yd = 198" = 5.029,2mm
+ // 1 yd = 3 ft = 36" = 914,4mm
+ // 1 ft = 12 " = 1" = 304,8mm
+
+void GetMeterOrInch(MapUnit eMU, short& rnKomma, long& rnMul, long& rnDiv, int& rbMetr, int& rbInch)
+{
+ rnMul=1; rnDiv=1;
+ short nKomma=0;
+ FASTBOOL bMetr=sal_False,bInch=sal_False;
+ switch (eMU) {
+ // Metrisch
+ case MAP_100TH_MM : bMetr=sal_True; nKomma=5; break;
+ case MAP_10TH_MM : bMetr=sal_True; nKomma=4; break;
+ case MAP_MM : bMetr=sal_True; nKomma=3; break;
+ case MAP_CM : bMetr=sal_True; nKomma=2; break;
+ // Inch
+ case MAP_1000TH_INCH: bInch=sal_True; nKomma=3; break;
+ case MAP_100TH_INCH : bInch=sal_True; nKomma=2; break;
+ case MAP_10TH_INCH : bInch=sal_True; nKomma=1; break;
+ case MAP_INCH : bInch=sal_True; nKomma=0; break;
+ case MAP_POINT : bInch=sal_True; rnDiv=72; break; // 1Pt = 1/72"
+ case MAP_TWIP : bInch=sal_True; rnDiv=144; nKomma=1; break; // 1Twip = 1/1440"
+ // Sonstiges
+ case MAP_PIXEL : break;
+ case MAP_SYSFONT : break;
+ case MAP_APPFONT : break;
+ case MAP_RELATIVE : break;
+ default: break;
+ } // switch
+ rnKomma=nKomma;
+ rbMetr=bMetr;
+ rbInch=bInch;
+}
+
+void GetMeterOrInch(FieldUnit eFU, short& rnKomma, long& rnMul, long& rnDiv, int& rbMetr, int& rbInch)
+{
+ rnMul=1; rnDiv=1;
+ short nKomma=0;
+ FASTBOOL bMetr=sal_False,bInch=sal_False;
+ switch (eFU) {
+ case FUNIT_NONE : break;
+ // Metrisch
+ case FUNIT_100TH_MM : bMetr=sal_True; nKomma=5; break;
+ case FUNIT_MM : bMetr=sal_True; nKomma=3; break;
+ case FUNIT_CM : bMetr=sal_True; nKomma=2; break;
+ case FUNIT_M : bMetr=sal_True; nKomma=0; break;
+ case FUNIT_KM : bMetr=sal_True; nKomma=-3; break;
+ // Inch
+ case FUNIT_TWIP : bInch=sal_True; rnDiv=144; nKomma=1; break; // 1Twip = 1/1440"
+ case FUNIT_POINT : bInch=sal_True; rnDiv=72; break; // 1Pt = 1/72"
+ case FUNIT_PICA : bInch=sal_True; rnDiv=6; break; // 1Pica = 1/6" ?
+ case FUNIT_INCH : bInch=sal_True; break; // 1" = 1"
+ case FUNIT_FOOT : bInch=sal_True; rnMul=12; break; // 1Ft = 12"
+ case FUNIT_MILE : bInch=sal_True; rnMul=6336; nKomma=-1; break; // 1mile = 63360"
+ // sonstiges
+ case FUNIT_CUSTOM : break;
+ case FUNIT_PERCENT : nKomma=2; break;
+ } // switch
+ rnKomma=nKomma;
+ rbMetr=bMetr;
+ rbInch=bInch;
+}
+
+void SdrFormatter::Undirty()
+{
+ if (aScale.GetNumerator()==0 || aScale.GetDenominator()==0) aScale=Fraction(1,1);
+ FASTBOOL bSrcMetr,bSrcInch,bDstMetr,bDstInch;
+ long nMul1,nDiv1,nMul2,nDiv2;
+ short nKomma1,nKomma2;
+ // Zunaechst normalisieren auf m bzw. "
+ if (!bSrcFU) {
+ GetMeterOrInch(eSrcMU,nKomma1,nMul1,nDiv1,bSrcMetr,bSrcInch);
+ } else {
+ GetMeterOrInch(eSrcFU,nKomma1,nMul1,nDiv1,bSrcMetr,bSrcInch);
+ }
+ if (!bDstFU) {
+ GetMeterOrInch(eDstMU,nKomma2,nMul2,nDiv2,bDstMetr,bDstInch);
+ } else {
+ GetMeterOrInch(eDstFU,nKomma2,nMul2,nDiv2,bDstMetr,bDstInch);
+ }
+ nMul1*=nDiv2;
+ nDiv1*=nMul2;
+ nKomma1=nKomma1-nKomma2;
+
+ if (bSrcInch && bDstMetr) {
+ nKomma1+=4;
+ nMul1*=254;
+ }
+ if (bSrcMetr && bDstInch) {
+ nKomma1-=4;
+ nDiv1*=254;
+ }
+
+ // Temporaere Fraction zum Kuerzen
+ Fraction aTempFract(nMul1,nDiv1);
+ nMul1=aTempFract.GetNumerator();
+ nDiv1=aTempFract.GetDenominator();
+
+ nMul_=nMul1;
+ nDiv_=nDiv1;
+ nKomma_=nKomma1;
+ bDirty=sal_False;
+}
+
+
+void SdrFormatter::TakeStr(long nVal, XubString& rStr) const
+{
+ sal_Unicode aNullCode('0');
+
+ if(!nVal)
+ {
+ rStr = UniString();
+ rStr += aNullCode;
+ return;
+ }
+
+ // Hier fallen trotzdem evtl. Nachkommastellen weg, wg. MulDiv statt Real
+ sal_Bool bNeg(nVal < 0);
+ SvtSysLocale aSysLoc;
+ const LocaleDataWrapper& rLoc = aSysLoc.GetLocaleData();
+
+ ForceUndirty();
+
+ sal_Int16 nK(nKomma_);
+ XubString aStr;
+
+ if(bNeg)
+ nVal = -nVal;
+
+ while(nK <= -3)
+ {
+ nVal *= 1000;
+ nK += 3;
+ }
+
+ while(nK <= -1)
+ {
+ nVal *= 10;
+ nK++;
+ }
+
+ if(nMul_ != nDiv_)
+ nVal = BigMulDiv(nVal, nMul_, nDiv_);
+
+ aStr = UniString::CreateFromInt32(nVal);
+
+ if(nK > 0 && aStr.Len() <= nK )
+ {
+ // Komma erforderlich
+ sal_Int16 nAnz(nK - aStr.Len());
+
+ if(nAnz >= 0 && rLoc.isNumLeadingZero())
+ nAnz++;
+
+ for(xub_StrLen i=0; i<nAnz; i++)
+ aStr.Insert(aNullCode, 0);
+
+ // zuviele Nachkommastellen abhacken
+ xub_StrLen nNumDigits(rLoc.getNumDigits());
+ xub_StrLen nWeg(nK - nNumDigits);
+
+ if(nWeg > 0)
+ {
+ // hier muesste eigentlich noch gerundet werden!
+ aStr.Erase(aStr.Len() - nWeg);
+ nK = nNumDigits;
+ }
+ }
+
+ // Vorkommastellen fuer spaeter merken
+ xub_StrLen nVorKomma(aStr.Len() - nK);
+
+ if(nK > 0)
+ {
+ // KommaChar einfuegen
+ // erstmal trailing Zeros abhacken
+ while(nK > 0 && aStr.GetChar(aStr.Len() - 1) == aNullCode)
+ {
+ aStr.Erase(aStr.Len() - 1);
+ nK--;
+ }
+
+ if(nK > 0)
+ {
+ // na, noch Nachkommastellen da?
+ sal_Unicode cDec(rLoc.getNumDecimalSep().GetChar(0));
+ aStr.Insert(cDec, nVorKomma);
+ }
+ }
+
+ // ggf. Trennpunkte bei jedem Tausender einfuegen
+ if( nVorKomma > 3 )
+ {
+ String aThoSep( rLoc.getNumThousandSep() );
+ if ( aThoSep.Len() > 0 )
+ {
+ sal_Unicode cTho( aThoSep.GetChar(0) );
+ sal_Int32 i(nVorKomma - 3);
+
+ while(i > 0)
+ {
+ rStr.Insert(cTho, (xub_StrLen)i);
+ i -= 3;
+ }
+ }
+ }
+
+ if(!aStr.Len())
+ aStr += aNullCode;
+
+ if(bNeg && (aStr.Len() > 1 || aStr.GetChar(0) != aNullCode))
+ {
+ rStr.Insert(sal_Unicode('-'), 0);
+ }
+
+ rStr = aStr;
+}
+
+void SdrFormatter::TakeUnitStr(MapUnit eUnit, XubString& rStr)
+{
+ switch(eUnit)
+ {
+ // Metrisch
+ case MAP_100TH_MM :
+ {
+ sal_Char aText[] = "/100mm";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+ case MAP_10TH_MM :
+ {
+ sal_Char aText[] = "/10mm";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+ case MAP_MM :
+ {
+ sal_Char aText[] = "mm";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+ case MAP_CM :
+ {
+ sal_Char aText[] = "cm";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+
+ // Inch
+ case MAP_1000TH_INCH:
+ {
+ sal_Char aText[] = "/1000\"";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+ case MAP_100TH_INCH :
+ {
+ sal_Char aText[] = "/100\"";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+ case MAP_10TH_INCH :
+ {
+ sal_Char aText[] = "/10\"";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+ case MAP_INCH :
+ {
+ rStr = UniString();
+ rStr += sal_Unicode('"');
+ break;
+ }
+ case MAP_POINT :
+ {
+ sal_Char aText[] = "pt";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+ case MAP_TWIP :
+ {
+ sal_Char aText[] = "twip";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+
+ // Sonstiges
+ case MAP_PIXEL :
+ {
+ sal_Char aText[] = "pixel";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+ case MAP_SYSFONT :
+ {
+ sal_Char aText[] = "sysfont";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+ case MAP_APPFONT :
+ {
+ sal_Char aText[] = "appfont";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+ case MAP_RELATIVE :
+ {
+ rStr = UniString();
+ rStr += sal_Unicode('%');
+ break;
+ }
+ default: break;
+ }
+}
+
+void SdrFormatter::TakeUnitStr(FieldUnit eUnit, XubString& rStr)
+{
+ switch(eUnit)
+ {
+ default :
+ case FUNIT_NONE :
+ case FUNIT_CUSTOM :
+ {
+ rStr = UniString();
+ break;
+ }
+
+ // Metrisch
+ case FUNIT_100TH_MM:
+ {
+ sal_Char aText[] = "/100mm";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+ case FUNIT_MM :
+ {
+ sal_Char aText[] = "mm";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+ case FUNIT_CM :
+ {
+ sal_Char aText[] = "cm";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+ case FUNIT_M :
+ {
+ rStr = UniString();
+ rStr += sal_Unicode('m');
+ break;
+ }
+ case FUNIT_KM :
+ {
+ sal_Char aText[] = "km";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+
+ // Inch
+ case FUNIT_TWIP :
+ {
+ sal_Char aText[] = "twip";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+ case FUNIT_POINT :
+ {
+ sal_Char aText[] = "pt";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+ case FUNIT_PICA :
+ {
+ sal_Char aText[] = "pica";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+ case FUNIT_INCH :
+ {
+ rStr = UniString();
+ rStr += sal_Unicode('"');
+ break;
+ }
+ case FUNIT_FOOT :
+ {
+ sal_Char aText[] = "ft";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+ case FUNIT_MILE :
+ {
+ sal_Char aText[] = "mile(s)";
+ rStr = UniString(aText, sizeof(aText-1));
+ break;
+ }
+
+ // sonstiges
+ case FUNIT_PERCENT:
+ {
+ rStr = UniString();
+ rStr += sal_Unicode('%');
+ break;
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
new file mode 100644
index 000000000000..e1d5d7f9b054
--- /dev/null
+++ b/svx/source/svdraw/svdundo.cxx
@@ -0,0 +1,1871 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svdundo.hxx>
+#include "svx/svditext.hxx"
+#include <svx/svdotext.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdlayer.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdview.hxx>
+#include "svx/svdstr.hrc" // Namen aus der Resource
+#include "svx/svdglob.hxx" // StringCache
+#include <svx/scene3d.hxx>
+#include <editeng/outlobj.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/sdr/properties/itemsettools.hxx>
+#include <svx/sdr/properties/properties.hxx>
+#include <svx/svdocapt.hxx>
+#include <svl/whiter.hxx>
+#include <svx/e3dsceneupdater.hxx>
+
+#include "svx/svdviter.hxx"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+// iterates over all views and unmarks this SdrObject if it is marked
+static void ImplUnmarkObject( SdrObject* pObj )
+{
+ SdrViewIter aIter( pObj );
+ for ( SdrView* pView = aIter.FirstView(); pView; pView = aIter.NextView() )
+ {
+ pView->MarkObj( pObj, pView->GetSdrPageView(), sal_True );
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(SdrUndoAction,SfxUndoAction);
+
+sal_Bool SdrUndoAction::CanRepeat(SfxRepeatTarget& rView) const
+{
+ SdrView* pV=PTR_CAST(SdrView,&rView);
+ if (pV!=NULL) return CanSdrRepeat(*pV);
+ return sal_False;
+}
+
+void SdrUndoAction::Repeat(SfxRepeatTarget& rView)
+{
+ SdrView* pV=PTR_CAST(SdrView,&rView);
+ if (pV!=NULL) SdrRepeat(*pV);
+ DBG_ASSERT(pV!=NULL,"Repeat: Uebergebenes SfxRepeatTarget ist keine SdrView");
+}
+
+XubString SdrUndoAction::GetRepeatComment(SfxRepeatTarget& rView) const
+{
+ SdrView* pV=PTR_CAST(SdrView,&rView);
+ if (pV!=NULL) return GetSdrRepeatComment(*pV);
+ return String();
+}
+
+bool SdrUndoAction::CanSdrRepeat(SdrView& /*rView*/) const
+{
+ return sal_False;
+}
+
+void SdrUndoAction::SdrRepeat(SdrView& /*rView*/)
+{
+}
+
+XubString SdrUndoAction::GetSdrRepeatComment(SdrView& /*rView*/) const
+{
+ return String();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrUndoGroup::SdrUndoGroup(SdrModel& rNewMod)
+: SdrUndoAction(rNewMod),
+ aBuf(1024,32,32),
+ eFunction(SDRREPFUNC_OBJ_NONE) /*#72642#*/
+{}
+
+SdrUndoGroup::SdrUndoGroup(SdrModel& rNewMod,const String& rStr)
+: SdrUndoAction(rNewMod),
+ aBuf(1024,32,32),
+ aComment(rStr),
+ eFunction(SDRREPFUNC_OBJ_NONE)
+{}
+
+SdrUndoGroup::~SdrUndoGroup()
+{
+ Clear();
+}
+
+void SdrUndoGroup::Clear()
+{
+ for (sal_uIntPtr nu=0; nu<GetActionCount(); nu++) {
+ SdrUndoAction* pAct=GetAction(nu);
+ delete pAct;
+ }
+ aBuf.Clear();
+}
+
+void SdrUndoGroup::AddAction(SdrUndoAction* pAct)
+{
+ aBuf.Insert(pAct,CONTAINER_APPEND);
+}
+
+void SdrUndoGroup::push_front( SdrUndoAction* pAct )
+{
+ aBuf.Insert(pAct, (sal_uIntPtr)0 );
+}
+
+void SdrUndoGroup::Undo()
+{
+ for (sal_uIntPtr nu=GetActionCount(); nu>0;) {
+ nu--;
+ SdrUndoAction* pAct=GetAction(nu);
+ pAct->Undo();
+ }
+}
+
+void SdrUndoGroup::Redo()
+{
+ for (sal_uIntPtr nu=0; nu<GetActionCount(); nu++) {
+ SdrUndoAction* pAct=GetAction(nu);
+ pAct->Redo();
+ }
+}
+
+XubString SdrUndoGroup::GetComment() const
+{
+ XubString aRet(aComment);
+ sal_Char aSearchText[] = "%1";
+ String aSearchString(aSearchText, sizeof(aSearchText-1));
+
+ aRet.SearchAndReplace(aSearchString, aObjDescription);
+
+ return aRet;
+}
+
+bool SdrUndoGroup::CanSdrRepeat(SdrView& rView) const
+{
+ switch (eFunction) {
+ case SDRREPFUNC_OBJ_NONE : return sal_False;
+ case SDRREPFUNC_OBJ_DELETE : return rView.AreObjectsMarked();
+ case SDRREPFUNC_OBJ_COMBINE_POLYPOLY: return rView.IsCombinePossible(sal_False);
+ case SDRREPFUNC_OBJ_COMBINE_ONEPOLY : return rView.IsCombinePossible(sal_True);
+ case SDRREPFUNC_OBJ_DISMANTLE_POLYS : return rView.IsDismantlePossible(sal_False);
+ case SDRREPFUNC_OBJ_DISMANTLE_LINES : return rView.IsDismantlePossible(sal_True);
+ case SDRREPFUNC_OBJ_CONVERTTOPOLY : return rView.IsConvertToPolyObjPossible(sal_False);
+ case SDRREPFUNC_OBJ_CONVERTTOPATH : return rView.IsConvertToPathObjPossible(sal_False);
+ case SDRREPFUNC_OBJ_GROUP : return rView.IsGroupPossible();
+ case SDRREPFUNC_OBJ_UNGROUP : return rView.IsUnGroupPossible();
+ case SDRREPFUNC_OBJ_PUTTOTOP : return rView.IsToTopPossible();
+ case SDRREPFUNC_OBJ_PUTTOBTM : return rView.IsToBtmPossible();
+ case SDRREPFUNC_OBJ_MOVTOTOP : return rView.IsToTopPossible();
+ case SDRREPFUNC_OBJ_MOVTOBTM : return rView.IsToBtmPossible();
+ case SDRREPFUNC_OBJ_REVORDER : return rView.IsReverseOrderPossible();
+ case SDRREPFUNC_OBJ_IMPORTMTF : return rView.IsImportMtfPossible();
+ default: break;
+ } // switch
+ return sal_False;
+}
+
+void SdrUndoGroup::SdrRepeat(SdrView& rView)
+{
+ switch (eFunction) {
+ case SDRREPFUNC_OBJ_NONE : break;
+ case SDRREPFUNC_OBJ_DELETE : rView.DeleteMarked(); break;
+ case SDRREPFUNC_OBJ_COMBINE_POLYPOLY: rView.CombineMarkedObjects(sal_False); break;
+ case SDRREPFUNC_OBJ_COMBINE_ONEPOLY : rView.CombineMarkedObjects(sal_True); break;
+ case SDRREPFUNC_OBJ_DISMANTLE_POLYS : rView.DismantleMarkedObjects(sal_False); break;
+ case SDRREPFUNC_OBJ_DISMANTLE_LINES : rView.DismantleMarkedObjects(sal_True); break;
+ case SDRREPFUNC_OBJ_CONVERTTOPOLY : rView.ConvertMarkedToPolyObj(sal_False); break;
+ case SDRREPFUNC_OBJ_CONVERTTOPATH : rView.ConvertMarkedToPathObj(sal_False); break;
+ case SDRREPFUNC_OBJ_GROUP : rView.GroupMarked(); break;
+ case SDRREPFUNC_OBJ_UNGROUP : rView.UnGroupMarked(); break;
+ case SDRREPFUNC_OBJ_PUTTOTOP : rView.PutMarkedToTop(); break;
+ case SDRREPFUNC_OBJ_PUTTOBTM : rView.PutMarkedToBtm(); break;
+ case SDRREPFUNC_OBJ_MOVTOTOP : rView.MovMarkedToTop(); break;
+ case SDRREPFUNC_OBJ_MOVTOBTM : rView.MovMarkedToBtm(); break;
+ case SDRREPFUNC_OBJ_REVORDER : rView.ReverseOrderOfMarked(); break;
+ case SDRREPFUNC_OBJ_IMPORTMTF : rView.DoImportMarkedMtf(); break;
+ default: break;
+ } // switch
+}
+
+XubString SdrUndoGroup::GetSdrRepeatComment(SdrView& /*rView*/) const
+{
+ XubString aRet(aComment);
+ sal_Char aSearchText[] = "%1";
+ String aSearchString(aSearchText, sizeof(aSearchText-1));
+
+ aRet.SearchAndReplace(aSearchString, ImpGetResStr(STR_ObjNameSingulPlural));
+
+ return aRet;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@ @@@@@ @@@@@@ @@@@@ @@@@ @@@@@@ @@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@@@@ @@ @@@@ @@ @@ @@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@@@ @@@@@ @@@@ @@@@@ @@@@ @@ @@@@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrUndoObj::SdrUndoObj(SdrObject& rNewObj):
+ SdrUndoAction(*rNewObj.GetModel()),
+ pObj(&rNewObj)
+{
+}
+
+void SdrUndoObj::GetDescriptionStringForObject( const SdrObject& _rForObject, sal_uInt16 nStrCacheID, String& rStr, FASTBOOL bRepeat )
+{
+ rStr = ImpGetResStr(nStrCacheID);
+ sal_Char aSearchText[] = "%1";
+ String aSearchString(aSearchText, sizeof(aSearchText-1));
+
+ xub_StrLen nPos = rStr.Search(aSearchString);
+
+ if(nPos != STRING_NOTFOUND)
+ {
+ rStr.Erase(nPos, 2);
+
+ if(bRepeat)
+ {
+ rStr.Insert(ImpGetResStr(STR_ObjNameSingulPlural), nPos);
+ }
+ else
+ {
+ XubString aStr;
+
+ _rForObject.TakeObjNameSingul(aStr);
+ rStr.Insert(aStr, nPos);
+ }
+ }
+}
+
+void SdrUndoObj::ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, XubString& rStr, FASTBOOL bRepeat) const
+{
+ if ( pObj )
+ GetDescriptionStringForObject( *pObj, nStrCacheID, rStr, bRepeat );
+}
+
+// #94278# common call method for evtl. page change when UNDO/REDO
+// is triggered
+void SdrUndoObj::ImpShowPageOfThisObject()
+{
+ if(pObj && pObj->IsInserted() && pObj->GetPage() && pObj->GetModel())
+ {
+ SdrHint aHint(HINT_SWITCHTOPAGE);
+
+ aHint.SetObject(pObj);
+ aHint.SetPage(pObj->GetPage());
+
+ pObj->GetModel()->Broadcast(aHint);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrUndoAttrObj::SdrUndoAttrObj(SdrObject& rNewObj, FASTBOOL bStyleSheet1, FASTBOOL bSaveText)
+: SdrUndoObj(rNewObj),
+ pUndoSet(NULL),
+ pRedoSet(NULL),
+ pRepeatSet(NULL),
+ pUndoStyleSheet(NULL),
+ pRedoStyleSheet(NULL),
+ pRepeatStyleSheet(NULL),
+ bHaveToTakeRedoSet(sal_True),
+ pTextUndo(NULL),
+
+ // #i8508#
+ pTextRedo(NULL),
+
+ pUndoGroup(NULL)
+{
+ bStyleSheet = bStyleSheet1;
+
+ SdrObjList* pOL = rNewObj.GetSubList();
+ sal_Bool bIsGroup(pOL!=NULL && pOL->GetObjCount());
+ sal_Bool bIs3DScene(bIsGroup && pObj->ISA(E3dScene));
+
+ if(bIsGroup)
+ {
+ // Aha, Gruppenobjekt
+ pUndoGroup = new SdrUndoGroup(*pObj->GetModel());
+ sal_uInt32 nObjAnz(pOL->GetObjCount());
+
+ for(sal_uInt32 nObjNum(0); nObjNum < nObjAnz; nObjNum++)
+ {
+ pUndoGroup->AddAction(
+ new SdrUndoAttrObj(*pOL->GetObj(nObjNum), bStyleSheet1));
+ }
+ }
+
+ if(!bIsGroup || bIs3DScene)
+ {
+ if(pUndoSet)
+ {
+ delete pUndoSet;
+ }
+
+ pUndoSet = new SfxItemSet(pObj->GetMergedItemSet());
+
+ if(bStyleSheet)
+ pUndoStyleSheet = pObj->GetStyleSheet();
+
+ if(bSaveText)
+ {
+ pTextUndo = pObj->GetOutlinerParaObject();
+ if(pTextUndo)
+ pTextUndo = new OutlinerParaObject(*pTextUndo);
+ }
+ }
+}
+
+SdrUndoAttrObj::~SdrUndoAttrObj()
+{
+ if(pUndoSet)
+ delete pUndoSet;
+ if(pRedoSet)
+ delete pRedoSet;
+ if(pRepeatSet)
+ delete pRepeatSet;
+ if(pUndoGroup)
+ delete pUndoGroup;
+ if(pTextUndo)
+ delete pTextUndo;
+
+ // #i8508#
+ if(pTextRedo)
+ delete pTextRedo;
+}
+
+void SdrUndoAttrObj::SetRepeatAttr(const SfxItemSet& rSet)
+{
+ if(pRepeatSet)
+ delete pRepeatSet;
+
+ pRepeatSet = new SfxItemSet(rSet);
+}
+
+void SdrUndoAttrObj::Undo()
+{
+ E3DModifySceneSnapRectUpdater aUpdater(pObj);
+ sal_Bool bIs3DScene(pObj && pObj->ISA(E3dScene));
+
+ // #94278# Trigger PageChangeCall
+ ImpShowPageOfThisObject();
+
+ if(!pUndoGroup || bIs3DScene)
+ {
+ if(bHaveToTakeRedoSet)
+ {
+ bHaveToTakeRedoSet = sal_False;
+
+ if(pRedoSet)
+ {
+ delete pRedoSet;
+ }
+
+ pRedoSet = new SfxItemSet(pObj->GetMergedItemSet());
+
+ if(bStyleSheet)
+ pRedoStyleSheet=pObj->GetStyleSheet();
+
+ if(pTextUndo)
+ {
+ // #i8508#
+ pTextRedo = pObj->GetOutlinerParaObject();
+
+ if(pTextRedo)
+ pTextRedo = new OutlinerParaObject(*pTextRedo);
+ }
+ }
+
+ if(bStyleSheet)
+ {
+ pRedoStyleSheet = pObj->GetStyleSheet();
+ pObj->SetStyleSheet(pUndoStyleSheet, sal_True);
+ }
+
+ sdr::properties::ItemChangeBroadcaster aItemChange(*pObj);
+
+ // #105122# Since ClearItem sets back everything to normal
+ // it also sets fit-to-size text to non-fit-to-size text and
+ // switches on autogrowheight (the default). That may lead to
+ // loosing the geometry size info for the object when it is
+ // re-layouted from AdjustTextFrameWidthAndHeight(). This makes
+ // rescuing the size of the object necessary.
+ const Rectangle aSnapRect = pObj->GetSnapRect();
+
+ if(pUndoSet)
+ {
+ // #109587#
+ if(pObj->ISA(SdrCaptionObj))
+ {
+ // do a more smooth item deletion here, else the text
+ // rect will be reformatted, especially when information regarding
+ // vertical text is changed. When clearing only set items it's
+ // slower, but safer regarding such information (it's not changed
+ // usually)
+ SfxWhichIter aIter(*pUndoSet);
+ sal_uInt16 nWhich(aIter.FirstWhich());
+
+ while(nWhich)
+ {
+ if(SFX_ITEM_SET != pUndoSet->GetItemState(nWhich, sal_False))
+ {
+ pObj->ClearMergedItem(nWhich);
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+ }
+ else
+ {
+ pObj->ClearMergedItem();
+ }
+
+ pObj->SetMergedItemSet(*pUndoSet);
+ }
+
+ // #105122# Restore prev size here when it was changed.
+ if(aSnapRect != pObj->GetSnapRect())
+ {
+ pObj->NbcSetSnapRect(aSnapRect);
+ }
+
+ pObj->GetProperties().BroadcastItemChange(aItemChange);
+
+ if(pTextUndo)
+ {
+ pObj->SetOutlinerParaObject(new OutlinerParaObject(*pTextUndo));
+ }
+ }
+
+ if(pUndoGroup)
+ {
+ pUndoGroup->Undo();
+ }
+}
+
+void SdrUndoAttrObj::Redo()
+{
+ E3DModifySceneSnapRectUpdater aUpdater(pObj);
+ sal_Bool bIs3DScene(pObj && pObj->ISA(E3dScene));
+
+ if(!pUndoGroup || bIs3DScene)
+ {
+ if(bStyleSheet)
+ {
+ pUndoStyleSheet = pObj->GetStyleSheet();
+ pObj->SetStyleSheet(pRedoStyleSheet, sal_True);
+ }
+
+ sdr::properties::ItemChangeBroadcaster aItemChange(*pObj);
+
+ // #105122#
+ const Rectangle aSnapRect = pObj->GetSnapRect();
+
+ if(pRedoSet)
+ {
+ // #109587#
+ if(pObj->ISA(SdrCaptionObj))
+ {
+ // do a more smooth item deletion here, else the text
+ // rect will be reformatted, especially when information regarding
+ // vertical text is changed. When clearing only set items it's
+ // slower, but safer regarding such information (it's not changed
+ // usually)
+ SfxWhichIter aIter(*pRedoSet);
+ sal_uInt16 nWhich(aIter.FirstWhich());
+
+ while(nWhich)
+ {
+ if(SFX_ITEM_SET != pRedoSet->GetItemState(nWhich, sal_False))
+ {
+ pObj->ClearMergedItem(nWhich);
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+ }
+ else
+ {
+ pObj->ClearMergedItem();
+ }
+
+ pObj->SetMergedItemSet(*pRedoSet);
+ }
+
+ // #105122# Restore prev size here when it was changed.
+ if(aSnapRect != pObj->GetSnapRect())
+ {
+ pObj->NbcSetSnapRect(aSnapRect);
+ }
+
+ pObj->GetProperties().BroadcastItemChange(aItemChange);
+
+ // #i8508#
+ if(pTextRedo)
+ {
+ pObj->SetOutlinerParaObject(new OutlinerParaObject(*pTextRedo));
+ }
+ }
+
+ if(pUndoGroup)
+ {
+ pUndoGroup->Redo();
+ }
+
+ // #94278# Trigger PageChangeCall
+ ImpShowPageOfThisObject();
+}
+
+XubString SdrUndoAttrObj::GetComment() const
+{
+ XubString aStr;
+
+ if(bStyleSheet)
+ {
+ ImpTakeDescriptionStr(STR_EditSetStylesheet, aStr);
+ }
+ else
+ {
+ ImpTakeDescriptionStr(STR_EditSetAttributes, aStr);
+ }
+
+ return aStr;
+}
+
+void SdrUndoAttrObj::SdrRepeat(SdrView& rView)
+{
+ if(pRepeatSet)
+ {
+ rView.SetAttrToMarked(*pRepeatSet, sal_False);
+ }
+}
+
+bool SdrUndoAttrObj::CanSdrRepeat(SdrView& rView) const
+{
+ return (pRepeatSet!=0L && rView.AreObjectsMarked());
+}
+
+XubString SdrUndoAttrObj::GetSdrRepeatComment(SdrView& /*rView*/) const
+{
+ XubString aStr;
+
+ if(bStyleSheet)
+ {
+ ImpTakeDescriptionStr(STR_EditSetStylesheet, aStr, sal_True);
+ }
+ else
+ {
+ ImpTakeDescriptionStr(STR_EditSetAttributes, aStr, sal_True);
+ }
+
+ return aStr;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrUndoMoveObj::Undo()
+{
+ // #94278# Trigger PageChangeCall
+ ImpShowPageOfThisObject();
+
+ pObj->Move(Size(-aDistance.Width(),-aDistance.Height()));
+}
+
+void SdrUndoMoveObj::Redo()
+{
+ pObj->Move(Size(aDistance.Width(),aDistance.Height()));
+
+ // #94278# Trigger PageChangeCall
+ ImpShowPageOfThisObject();
+}
+
+XubString SdrUndoMoveObj::GetComment() const
+{
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_EditMove,aStr);
+ return aStr;
+}
+
+void SdrUndoMoveObj::SdrRepeat(SdrView& rView)
+{
+ rView.MoveMarkedObj(aDistance);
+}
+
+bool SdrUndoMoveObj::CanSdrRepeat(SdrView& rView) const
+{
+ return rView.AreObjectsMarked();
+}
+
+XubString SdrUndoMoveObj::GetSdrRepeatComment(SdrView& /*rView*/) const
+{
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_EditMove,aStr,sal_True);
+ return aStr;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrUndoGeoObj::SdrUndoGeoObj(SdrObject& rNewObj):
+ SdrUndoObj(rNewObj),
+ pUndoGeo(NULL),
+ pRedoGeo(NULL),
+ pUndoGroup(NULL)
+{
+ SdrObjList* pOL=rNewObj.GetSubList();
+ if (pOL!=NULL && pOL->GetObjCount() && !rNewObj.ISA(E3dScene))
+ {
+ // Aha, Gruppenobjekt
+ // AW: Aber keine 3D-Szene, dann nur fuer die Szene selbst den Undo anlegen
+ pUndoGroup=new SdrUndoGroup(*pObj->GetModel());
+ sal_uIntPtr nObjAnz=pOL->GetObjCount();
+ for (sal_uIntPtr nObjNum=0; nObjNum<nObjAnz; nObjNum++) {
+ pUndoGroup->AddAction(new SdrUndoGeoObj(*pOL->GetObj(nObjNum)));
+ }
+ } else {
+ pUndoGeo=pObj->GetGeoData();
+ }
+}
+
+SdrUndoGeoObj::~SdrUndoGeoObj()
+{
+ if (pUndoGeo!=NULL) delete pUndoGeo;
+ if (pRedoGeo!=NULL) delete pRedoGeo;
+ if (pUndoGroup!=NULL) delete pUndoGroup;
+}
+
+void SdrUndoGeoObj::Undo()
+{
+ // #94278# Trigger PageChangeCall
+ ImpShowPageOfThisObject();
+
+ if(pUndoGroup)
+ {
+ pUndoGroup->Undo();
+
+ // #97172#
+ // only repaint, no objectchange
+ pObj->ActionChanged();
+ }
+ else
+ {
+ if (pRedoGeo!=NULL) delete pRedoGeo;
+ pRedoGeo=pObj->GetGeoData();
+ pObj->SetGeoData(*pUndoGeo);
+ }
+}
+
+void SdrUndoGeoObj::Redo()
+{
+ if(pUndoGroup)
+ {
+ pUndoGroup->Redo();
+
+ // #97172#
+ // only repaint, no objectchange
+ pObj->ActionChanged();
+ }
+ else
+ {
+ if (pUndoGeo!=NULL) delete pUndoGeo;
+ pUndoGeo=pObj->GetGeoData();
+ pObj->SetGeoData(*pRedoGeo);
+ }
+
+ // #94278# Trigger PageChangeCall
+ ImpShowPageOfThisObject();
+}
+
+XubString SdrUndoGeoObj::GetComment() const
+{
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_DragMethObjOwn,aStr);
+ return aStr;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrUndoObjList::SdrUndoObjList(SdrObject& rNewObj, bool bOrdNumDirect)
+: SdrUndoObj(rNewObj),
+ bOwner(sal_False),
+ pView(NULL),
+ pPageView(NULL)
+{
+ pObjList=pObj->GetObjList();
+ if (bOrdNumDirect) {
+ nOrdNum=pObj->GetOrdNumDirect();
+ } else {
+ nOrdNum=pObj->GetOrdNum();
+ }
+}
+
+SdrUndoObjList::~SdrUndoObjList()
+{
+ if (pObj!=NULL && IsOwner())
+ {
+ // Attribute muessen wieder in den regulaeren Pool
+ SetOwner(sal_False);
+
+ // nun loeschen
+ SdrObject::Free( pObj );
+ }
+}
+
+void SdrUndoObjList::SetOwner(bool bNew)
+{
+ bOwner = bNew;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrUndoRemoveObj::Undo()
+{
+ // #94278# Trigger PageChangeCall
+ ImpShowPageOfThisObject();
+
+ DBG_ASSERT(!pObj->IsInserted(),"UndoRemoveObj: pObj ist bereits Inserted");
+ if (!pObj->IsInserted())
+ {
+ // #i11426#
+ // For UNDOs in Calc/Writer it is necessary to adapt the anchor
+ // pos of the target object.
+ Point aOwnerAnchorPos(0, 0);
+
+ if(pObjList
+ && pObjList->GetOwnerObj()
+ && pObjList->GetOwnerObj()->ISA(SdrObjGroup))
+ {
+ aOwnerAnchorPos = pObjList->GetOwnerObj()->GetAnchorPos();
+ }
+
+ E3DModifySceneSnapRectUpdater aUpdater(pObjList->GetOwnerObj());
+ SdrInsertReason aReason(SDRREASON_UNDO);
+ pObjList->InsertObject(pObj,nOrdNum,&aReason);
+
+ // #i11426#
+ if(aOwnerAnchorPos.X() || aOwnerAnchorPos.Y())
+ {
+ pObj->NbcSetAnchorPos(aOwnerAnchorPos);
+ }
+ }
+}
+
+void SdrUndoRemoveObj::Redo()
+{
+ DBG_ASSERT(pObj->IsInserted(),"RedoRemoveObj: pObj ist nicht Inserted");
+ if (pObj->IsInserted())
+ {
+ ImplUnmarkObject( pObj );
+ E3DModifySceneSnapRectUpdater aUpdater(pObj);
+ pObjList->RemoveObject(nOrdNum);
+ }
+
+ // #94278# Trigger PageChangeCall
+ ImpShowPageOfThisObject();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrUndoInsertObj::Undo()
+{
+ // #94278# Trigger PageChangeCall
+ ImpShowPageOfThisObject();
+
+ DBG_ASSERT(pObj->IsInserted(),"UndoInsertObj: pObj ist nicht Inserted");
+ if (pObj->IsInserted())
+ {
+ ImplUnmarkObject( pObj );
+
+#ifdef DBG_UTIL
+ SdrObject* pChkObj=
+#endif
+ pObjList->RemoveObject(nOrdNum);
+ DBG_ASSERT(pChkObj==pObj,"UndoInsertObj: RemoveObjNum!=pObj");
+ }
+}
+
+void SdrUndoInsertObj::Redo()
+{
+ DBG_ASSERT(!pObj->IsInserted(),"RedoInsertObj: pObj ist bereits Inserted");
+ if (!pObj->IsInserted())
+ {
+ // --> OD 2005-05-10 #i45952# - restore anchor position of an object,
+ // which becomes a member of a group, because its cleared in method
+ // <InsertObject(..)>. Needed for correct ReDo in Writer.
+ Point aAnchorPos( 0, 0 );
+ if ( pObjList &&
+ pObjList->GetOwnerObj() &&
+ pObjList->GetOwnerObj()->ISA(SdrObjGroup) )
+ {
+ aAnchorPos = pObj->GetAnchorPos();
+ }
+ // <--
+
+ SdrInsertReason aReason(SDRREASON_UNDO);
+ pObjList->InsertObject(pObj,nOrdNum,&aReason);
+
+ // --> OD 2005-05-10 #i45952#
+ if ( aAnchorPos.X() || aAnchorPos.Y() )
+ {
+ pObj->NbcSetAnchorPos( aAnchorPos );
+ }
+ // <--
+ }
+
+ // #94278# Trigger PageChangeCall
+ ImpShowPageOfThisObject();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrUndoDelObj::Undo()
+{
+ SdrUndoRemoveObj::Undo();
+ DBG_ASSERT(IsOwner(),"UndoDeleteObj: pObj gehoert nicht der UndoAction");
+ SetOwner(sal_False);
+}
+
+void SdrUndoDelObj::Redo()
+{
+ SdrUndoRemoveObj::Redo();
+ DBG_ASSERT(!IsOwner(),"RedoDeleteObj: pObj gehoert bereits der UndoAction");
+ SetOwner(sal_True);
+}
+
+XubString SdrUndoDelObj::GetComment() const
+{
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_EditDelete,aStr);
+ return aStr;
+}
+
+void SdrUndoDelObj::SdrRepeat(SdrView& rView)
+{
+ rView.DeleteMarked();
+}
+
+bool SdrUndoDelObj::CanSdrRepeat(SdrView& rView) const
+{
+ return rView.AreObjectsMarked();
+}
+
+XubString SdrUndoDelObj::GetSdrRepeatComment(SdrView& /*rView*/) const
+{
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_EditDelete,aStr,sal_True);
+ return aStr;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrUndoNewObj::Undo()
+{
+ SdrUndoInsertObj::Undo();
+ DBG_ASSERT(!IsOwner(),"RedoNewObj: pObj gehoert bereits der UndoAction");
+ SetOwner(sal_True);
+}
+
+void SdrUndoNewObj::Redo()
+{
+ SdrUndoInsertObj::Redo();
+ DBG_ASSERT(IsOwner(),"RedoNewObj: pObj gehoert nicht der UndoAction");
+ SetOwner(sal_False);
+}
+
+String SdrUndoNewObj::GetComment( const SdrObject& _rForObject )
+{
+ String sComment;
+ GetDescriptionStringForObject( _rForObject, STR_UndoInsertObj, sComment );
+ return sComment;
+}
+
+XubString SdrUndoNewObj::GetComment() const
+{
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_UndoInsertObj,aStr);
+ return aStr;
+}
+
+SdrUndoReplaceObj::SdrUndoReplaceObj(SdrObject& rOldObj1, SdrObject& rNewObj1, bool bOrdNumDirect)
+: SdrUndoObj(rOldObj1),
+ bOldOwner(sal_False),
+ bNewOwner(sal_False),
+ pNewObj(&rNewObj1)
+{
+ SetOldOwner(sal_True);
+
+ pObjList=pObj->GetObjList();
+ if (bOrdNumDirect) {
+ nOrdNum=pObj->GetOrdNumDirect();
+ } else {
+ nOrdNum=pObj->GetOrdNum();
+ }
+}
+
+SdrUndoReplaceObj::~SdrUndoReplaceObj()
+{
+ if (pObj!=NULL && IsOldOwner())
+ {
+ // Attribute muessen wieder in den regulaeren Pool
+ SetOldOwner(sal_False);
+
+ // nun loeschen
+ SdrObject::Free( pObj );
+ }
+ if (pNewObj!=NULL && IsNewOwner())
+ {
+ // Attribute muessen wieder in den regulaeren Pool
+ SetNewOwner(sal_False);
+
+ // nun loeschen
+ SdrObject::Free( pNewObj );
+ }
+}
+
+void SdrUndoReplaceObj::Undo()
+{
+ // #94278# Trigger PageChangeCall
+ ImpShowPageOfThisObject();
+
+ if (IsOldOwner() && !IsNewOwner())
+ {
+ DBG_ASSERT(!pObj->IsInserted(),"SdrUndoReplaceObj::Undo(): Altes Objekt ist bereits inserted!");
+ DBG_ASSERT(pNewObj->IsInserted(),"SdrUndoReplaceObj::Undo(): Neues Objekt ist nicht inserted!");
+ SetOldOwner(sal_False);
+ SetNewOwner(sal_True);
+
+ ImplUnmarkObject( pNewObj );
+ pObjList->ReplaceObject(pObj,nOrdNum);
+ }
+ else
+ {
+ DBG_ERROR("SdrUndoReplaceObj::Undo(): IsMine-Flags stehen verkehrt. Doppelter Undo-Aufruf?");
+ }
+}
+
+void SdrUndoReplaceObj::Redo()
+{
+ if (!IsOldOwner() && IsNewOwner())
+ {
+ DBG_ASSERT(!pNewObj->IsInserted(),"SdrUndoReplaceObj::Redo(): Neues Objekt ist bereits inserted!");
+ DBG_ASSERT(pObj->IsInserted(),"SdrUndoReplaceObj::Redo(): Altes Objekt ist nicht inserted!");
+ SetOldOwner(sal_True);
+ SetNewOwner(sal_False);
+
+ ImplUnmarkObject( pObj );
+ pObjList->ReplaceObject(pNewObj,nOrdNum);
+
+ }
+ else
+ {
+ DBG_ERROR("SdrUndoReplaceObj::Redo(): IsMine-Flags stehen verkehrt. Doppelter Redo-Aufruf?");
+ }
+
+ // #94278# Trigger PageChangeCall
+ ImpShowPageOfThisObject();
+}
+
+void SdrUndoReplaceObj::SetNewOwner(bool bNew)
+{
+ bNewOwner = bNew;
+}
+
+void SdrUndoReplaceObj::SetOldOwner(bool bNew)
+{
+ bOldOwner = bNew;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+XubString SdrUndoCopyObj::GetComment() const
+{
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_UndoCopyObj,aStr);
+ return aStr;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// #i11702#
+
+SdrUndoObjectLayerChange::SdrUndoObjectLayerChange(SdrObject& rObj, SdrLayerID aOldLayer, SdrLayerID aNewLayer)
+: SdrUndoObj(rObj),
+ maOldLayer(aOldLayer),
+ maNewLayer(aNewLayer)
+{
+}
+
+void SdrUndoObjectLayerChange::Undo()
+{
+ ImpShowPageOfThisObject();
+ pObj->SetLayer(maOldLayer);
+}
+
+void SdrUndoObjectLayerChange::Redo()
+{
+ pObj->SetLayer(maNewLayer);
+ ImpShowPageOfThisObject();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrUndoObjOrdNum::SdrUndoObjOrdNum(SdrObject& rNewObj, sal_uInt32 nOldOrdNum1, sal_uInt32 nNewOrdNum1):
+ SdrUndoObj(rNewObj),
+ nOldOrdNum(nOldOrdNum1),
+ nNewOrdNum(nNewOrdNum1)
+{
+}
+
+void SdrUndoObjOrdNum::Undo()
+{
+ // #94278# Trigger PageChangeCall
+ ImpShowPageOfThisObject();
+
+ SdrObjList* pOL=pObj->GetObjList();
+ if (pOL==NULL) {
+ DBG_ERROR("UndoObjOrdNum: pObj hat keine ObjList");
+ return;
+ }
+ pOL->SetObjectOrdNum(nNewOrdNum,nOldOrdNum);
+}
+
+void SdrUndoObjOrdNum::Redo()
+{
+ SdrObjList* pOL=pObj->GetObjList();
+ if (pOL==NULL) {
+ DBG_ERROR("RedoObjOrdNum: pObj hat keine ObjList");
+ return;
+ }
+ pOL->SetObjectOrdNum(nOldOrdNum,nNewOrdNum);
+
+ // #94278# Trigger PageChangeCall
+ ImpShowPageOfThisObject();
+}
+
+XubString SdrUndoObjOrdNum::GetComment() const
+{
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_UndoObjOrdNum,aStr);
+ return aStr;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrUndoObjSetText::SdrUndoObjSetText(SdrObject& rNewObj, sal_Int32 nText)
+: SdrUndoObj(rNewObj)
+, pOldText(NULL)
+, pNewText(NULL)
+, bNewTextAvailable(sal_False)
+, bEmptyPresObj(sal_False)
+, mnText(nText)
+{
+ SdrText* pText = static_cast< SdrTextObj*>( &rNewObj )->getText(mnText);
+ if( pText && pText->GetOutlinerParaObject() )
+ pOldText = new OutlinerParaObject(*pText->GetOutlinerParaObject());
+
+ bEmptyPresObj = rNewObj.IsEmptyPresObj();
+}
+
+SdrUndoObjSetText::~SdrUndoObjSetText()
+{
+ if ( pOldText )
+ delete pOldText;
+ if ( pNewText )
+ delete pNewText;
+}
+
+void SdrUndoObjSetText::AfterSetText()
+{
+ if (!bNewTextAvailable)
+ {
+ SdrText* pText = static_cast< SdrTextObj*>( pObj )->getText(mnText);
+ if( pText && pText->GetOutlinerParaObject() )
+ pNewText = new OutlinerParaObject(*pText->GetOutlinerParaObject());
+ bNewTextAvailable=sal_True;
+ }
+}
+
+void SdrUndoObjSetText::Undo()
+{
+ // #94278# Trigger PageChangeCall
+ ImpShowPageOfThisObject();
+
+ // alten Text sichern fuer Redo
+ if (!bNewTextAvailable)
+ AfterSetText();
+
+ // Text fuer Undo kopieren, denn SetOutlinerParaObject() ist Eigentumsuebereignung
+ OutlinerParaObject* pText1 = pOldText;
+ if(pText1)
+ pText1 = new OutlinerParaObject(*pText1);
+
+ SdrText* pText = static_cast< SdrTextObj*>( pObj )->getText(mnText);
+ if( pText )
+ pText->SetOutlinerParaObject(pText1);
+
+ pObj->SetEmptyPresObj( bEmptyPresObj );
+ pObj->ActionChanged();
+}
+
+void SdrUndoObjSetText::Redo()
+{
+ // Text fuer Undo kopieren, denn SetOutlinerParaObject() ist Eigentumsuebereignung
+ OutlinerParaObject* pText1 = pNewText;
+
+ if(pText1)
+ pText1 = new OutlinerParaObject(*pText1);
+
+ SdrText* pText = static_cast< SdrTextObj*>( pObj )->getText(mnText);
+ if( pText )
+ static_cast< SdrTextObj* >( pObj )->NbcSetOutlinerParaObjectForText( pText1, pText );
+
+ pObj->ActionChanged();
+
+ // #94278# Trigger PageChangeCall
+ ImpShowPageOfThisObject();
+}
+
+XubString SdrUndoObjSetText::GetComment() const
+{
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_UndoObjSetText,aStr);
+ return aStr;
+}
+
+XubString SdrUndoObjSetText::GetSdrRepeatComment(SdrView& /*rView*/) const
+{
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_UndoObjSetText,aStr);
+ return aStr;
+}
+
+void SdrUndoObjSetText::SdrRepeat(SdrView& rView)
+{
+ if (bNewTextAvailable && rView.AreObjectsMarked())
+ {
+ const SdrMarkList& rML=rView.GetMarkedObjectList();
+
+ const bool bUndo = rView.IsUndoEnabled();
+ if( bUndo )
+ {
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_UndoObjSetText,aStr);
+ rView.BegUndo(aStr);
+ }
+
+ sal_uIntPtr nAnz=rML.GetMarkCount();
+ for (sal_uIntPtr nm=0; nm<nAnz; nm++)
+ {
+ SdrObject* pObj2=rML.GetMark(nm)->GetMarkedSdrObj();
+ SdrTextObj* pTextObj=PTR_CAST(SdrTextObj,pObj2);
+ if (pTextObj!=NULL)
+ {
+ if( bUndo )
+ rView.AddUndo(new SdrUndoObjSetText(*pTextObj,0));
+
+ OutlinerParaObject* pText1=pNewText;
+ if (pText1!=NULL)
+ pText1 = new OutlinerParaObject(*pText1);
+ pTextObj->SetOutlinerParaObject(pText1);
+ }
+ }
+
+ if( bUndo )
+ rView.EndUndo();
+ }
+}
+
+bool SdrUndoObjSetText::CanSdrRepeat(SdrView& rView) const
+{
+ bool bOk=sal_False;
+ if (bNewTextAvailable && rView.AreObjectsMarked()) {
+ bOk=sal_True;
+ }
+ return bOk;
+}
+
+// --> OD 2009-07-09 #i73249#
+SdrUndoObjStrAttr::SdrUndoObjStrAttr( SdrObject& rNewObj,
+ const ObjStrAttrType eObjStrAttr,
+ const String& sOldStr,
+ const String& sNewStr)
+ : SdrUndoObj( rNewObj ),
+ meObjStrAttr( eObjStrAttr ),
+ msOldStr( sOldStr ),
+ msNewStr( sNewStr )
+{
+}
+
+void SdrUndoObjStrAttr::Undo()
+{
+ ImpShowPageOfThisObject();
+
+ switch ( meObjStrAttr )
+ {
+ case OBJ_NAME:
+ {
+ pObj->SetName( msOldStr );
+ }
+ break;
+ case OBJ_TITLE:
+ {
+ pObj->SetTitle( msOldStr );
+ }
+ break;
+ case OBJ_DESCRIPTION:
+ {
+ pObj->SetDescription( msOldStr );
+ }
+ break;
+ }
+}
+
+void SdrUndoObjStrAttr::Redo()
+{
+ switch ( meObjStrAttr )
+ {
+ case OBJ_NAME:
+ {
+ pObj->SetName( msNewStr );
+ }
+ break;
+ case OBJ_TITLE:
+ {
+ pObj->SetTitle( msNewStr );
+ }
+ break;
+ case OBJ_DESCRIPTION:
+ {
+ pObj->SetDescription( msNewStr );
+ }
+ break;
+ }
+
+ ImpShowPageOfThisObject();
+}
+
+String SdrUndoObjStrAttr::GetComment() const
+{
+ String aStr;
+ switch ( meObjStrAttr )
+ {
+ case OBJ_NAME:
+ {
+ ImpTakeDescriptionStr( STR_UndoObjName, aStr );
+ aStr += sal_Unicode(' ');
+ aStr += sal_Unicode('\'');
+ aStr += msNewStr;
+ aStr += sal_Unicode('\'');
+ }
+ break;
+ case OBJ_TITLE:
+ {
+ ImpTakeDescriptionStr( STR_UndoObjTitle, aStr );
+ }
+ break;
+ case OBJ_DESCRIPTION:
+ {
+ ImpTakeDescriptionStr( STR_UndoObjDescription, aStr );
+ }
+ break;
+ }
+
+ return aStr;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@ @@@@ @@ @@ @@@@@ @@@@@
+// @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@@@@@ @@@@ @@@@ @@@@@
+// @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@
+// @@@@@ @@ @@ @@ @@@@@ @@ @@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrUndoLayer::SdrUndoLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel):
+ SdrUndoAction(rNewModel),
+ pLayer(rNewLayerAdmin.GetLayer(nLayerNum)),
+ pLayerAdmin(&rNewLayerAdmin),
+ nNum(nLayerNum),
+ bItsMine(sal_False)
+{
+}
+
+SdrUndoLayer::~SdrUndoLayer()
+{
+ if (bItsMine) {
+ delete pLayer;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrUndoNewLayer::Undo()
+{
+ DBG_ASSERT(!bItsMine,"SdrUndoNewLayer::Undo(): Layer gehoert bereits der UndoAction");
+ bItsMine=sal_True;
+#ifdef DBG_UTIL
+ SdrLayer* pCmpLayer=
+#endif
+ pLayerAdmin->RemoveLayer(nNum);
+ DBG_ASSERT(pCmpLayer==pLayer,"SdrUndoNewLayer::Undo(): Removter Layer ist != pLayer");
+}
+
+void SdrUndoNewLayer::Redo()
+{
+ DBG_ASSERT(bItsMine,"SdrUndoNewLayer::Undo(): Layer gehoert nicht der UndoAction");
+ bItsMine=sal_False;
+ pLayerAdmin->InsertLayer(pLayer,nNum);
+}
+
+XubString SdrUndoNewLayer::GetComment() const
+{
+ return ImpGetResStr(STR_UndoNewLayer);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrUndoDelLayer::Undo()
+{
+ DBG_ASSERT(bItsMine,"SdrUndoDelLayer::Undo(): Layer gehoert nicht der UndoAction");
+ bItsMine=sal_False;
+ pLayerAdmin->InsertLayer(pLayer,nNum);
+}
+
+void SdrUndoDelLayer::Redo()
+{
+ DBG_ASSERT(!bItsMine,"SdrUndoDelLayer::Undo(): Layer gehoert bereits der UndoAction");
+ bItsMine=sal_True;
+#ifdef DBG_UTIL
+ SdrLayer* pCmpLayer=
+#endif
+ pLayerAdmin->RemoveLayer(nNum);
+ DBG_ASSERT(pCmpLayer==pLayer,"SdrUndoDelLayer::Redo(): Removter Layer ist != pLayer");
+}
+
+XubString SdrUndoDelLayer::GetComment() const
+{
+ return ImpGetResStr(STR_UndoDelLayer);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrUndoMoveLayer::Undo()
+{
+#ifdef DBG_UTIL
+ SdrLayer* pCmpLayer=
+#endif
+ pLayerAdmin->RemoveLayer(nNeuPos);
+ DBG_ASSERT(pCmpLayer==pLayer,"SdrUndoMoveLayer::Undo(): Removter Layer ist != pLayer");
+ pLayerAdmin->InsertLayer(pLayer,nNum);
+}
+
+void SdrUndoMoveLayer::Redo()
+{
+#ifdef DBG_UTIL
+ SdrLayer* pCmpLayer=
+#endif
+ pLayerAdmin->RemoveLayer(nNum);
+ DBG_ASSERT(pCmpLayer==pLayer,"SdrUndoMoveLayer::Redo(): Removter Layer ist != pLayer");
+ pLayerAdmin->InsertLayer(pLayer,nNeuPos);
+}
+
+XubString SdrUndoMoveLayer::GetComment() const
+{
+ return ImpGetResStr(STR_UndoMovLayer);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@@@@ @@@@ @@@@ @@@@@ @@@@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@
+// @@@@@ @@@@@@ @@ @@@ @@@@ @@@@
+// @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@@@@ @@@@@ @@@@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrUndoPage::SdrUndoPage(SdrPage& rNewPg)
+: SdrUndoAction(*rNewPg.GetModel()),
+ mrPage(rNewPg)
+{
+}
+
+void SdrUndoPage::ImpInsertPage(sal_uInt16 nNum)
+{
+ DBG_ASSERT(!mrPage.IsInserted(),"SdrUndoPage::ImpInsertPage(): mrPage ist bereits Inserted");
+ if (!mrPage.IsInserted()) {
+ if (mrPage.IsMasterPage()) {
+ rMod.InsertMasterPage(&mrPage,nNum);
+ } else {
+ rMod.InsertPage(&mrPage,nNum);
+ }
+ }
+}
+
+void SdrUndoPage::ImpRemovePage(sal_uInt16 nNum)
+{
+ DBG_ASSERT(mrPage.IsInserted(),"SdrUndoPage::ImpRemovePage(): mrPage ist nicht Inserted");
+ if (mrPage.IsInserted()) {
+ SdrPage* pChkPg=NULL;
+ if (mrPage.IsMasterPage()) {
+ pChkPg=rMod.RemoveMasterPage(nNum);
+ } else {
+ pChkPg=rMod.RemovePage(nNum);
+ }
+ DBG_ASSERT(pChkPg==&mrPage,"SdrUndoPage::ImpRemovePage(): RemovePage!=&mrPage");
+ }
+}
+
+void SdrUndoPage::ImpMovePage(sal_uInt16 nOldNum, sal_uInt16 nNewNum)
+{
+ DBG_ASSERT(mrPage.IsInserted(),"SdrUndoPage::ImpMovePage(): mrPage ist nicht Inserted");
+ if (mrPage.IsInserted()) {
+ if (mrPage.IsMasterPage()) {
+ rMod.MoveMasterPage(nOldNum,nNewNum);
+ } else {
+ rMod.MovePage(nOldNum,nNewNum);
+ }
+ }
+}
+
+void SdrUndoPage::ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, XubString& rStr, sal_uInt16 /*n*/, FASTBOOL /*bRepeat*/) const
+{
+ rStr=ImpGetResStr(nStrCacheID);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrUndoPageList::SdrUndoPageList(SdrPage& rNewPg):
+ SdrUndoPage(rNewPg),
+ bItsMine(sal_False)
+{
+ nPageNum=rNewPg.GetPageNum();
+}
+
+SdrUndoPageList::~SdrUndoPageList()
+{
+ if(bItsMine)
+ {
+ delete (&mrPage);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrUndoDelPage::SdrUndoDelPage(SdrPage& rNewPg):
+ SdrUndoPageList(rNewPg),
+ pUndoGroup(NULL)
+{
+ bItsMine = sal_True;
+
+ // Und nun ggf. die MasterPage-Beziehungen merken
+ if(mrPage.IsMasterPage())
+ {
+ sal_uInt16 nPageAnz(rMod.GetPageCount());
+
+ for(sal_uInt16 nPageNum2(0); nPageNum2 < nPageAnz; nPageNum2++)
+ {
+ SdrPage* pDrawPage = rMod.GetPage(nPageNum2);
+
+ if(pDrawPage->TRG_HasMasterPage())
+ {
+ SdrPage& rMasterPage = pDrawPage->TRG_GetMasterPage();
+
+ if(&mrPage == &rMasterPage)
+ {
+ if(!pUndoGroup)
+ {
+ pUndoGroup = new SdrUndoGroup(rMod);
+ }
+
+ pUndoGroup->AddAction(rMod.GetSdrUndoFactory().CreateUndoPageRemoveMasterPage(*pDrawPage));
+ }
+ }
+ }
+ }
+}
+
+SdrUndoDelPage::~SdrUndoDelPage()
+{
+ if (pUndoGroup!=NULL) {
+ delete pUndoGroup;
+ }
+}
+
+void SdrUndoDelPage::Undo()
+{
+ ImpInsertPage(nPageNum);
+ if (pUndoGroup!=NULL) { // MasterPage-Beziehungen wiederherstellen
+ pUndoGroup->Undo();
+ }
+ DBG_ASSERT(bItsMine,"UndoDeletePage: mrPage gehoert nicht der UndoAction");
+ bItsMine=sal_False;
+}
+
+void SdrUndoDelPage::Redo()
+{
+ ImpRemovePage(nPageNum);
+ // Die MasterPage-Beziehungen werden ggf. von selbst geloesst
+ DBG_ASSERT(!bItsMine,"RedoDeletePage: mrPage gehoert bereits der UndoAction");
+ bItsMine=sal_True;
+}
+
+XubString SdrUndoDelPage::GetComment() const
+{
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_UndoDelPage,aStr,0,sal_False);
+ return aStr;
+}
+
+XubString SdrUndoDelPage::GetSdrRepeatComment(SdrView& /*rView*/) const
+{
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_UndoDelPage,aStr,0,sal_False);
+ return aStr;
+}
+
+void SdrUndoDelPage::SdrRepeat(SdrView& /*rView*/)
+{
+}
+
+bool SdrUndoDelPage::CanSdrRepeat(SdrView& /*rView*/) const
+{
+ return sal_False;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrUndoNewPage::Undo()
+{
+ ImpRemovePage(nPageNum);
+ DBG_ASSERT(!bItsMine,"UndoNewPage: mrPage gehoert bereits der UndoAction");
+ bItsMine=sal_True;
+}
+
+void SdrUndoNewPage::Redo()
+{
+ ImpInsertPage(nPageNum);
+ DBG_ASSERT(bItsMine,"RedoNewPage: mrPage gehoert nicht der UndoAction");
+ bItsMine=sal_False;
+}
+
+XubString SdrUndoNewPage::GetComment() const
+{
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_UndoNewPage,aStr,0,sal_False);
+ return aStr;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+XubString SdrUndoCopyPage::GetComment() const
+{
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_UndoCopPage,aStr,0,sal_False);
+ return aStr;
+}
+
+XubString SdrUndoCopyPage::GetSdrRepeatComment(SdrView& /*rView*/) const
+{
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_UndoCopPage,aStr,0,sal_False);
+ return aStr;
+}
+
+void SdrUndoCopyPage::SdrRepeat(SdrView& /*rView*/)
+{
+
+}
+
+bool SdrUndoCopyPage::CanSdrRepeat(SdrView& /*rView*/) const
+{
+ return sal_False;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrUndoSetPageNum::Undo()
+{
+ ImpMovePage(nNewPageNum,nOldPageNum);
+}
+
+void SdrUndoSetPageNum::Redo()
+{
+ ImpMovePage(nOldPageNum,nNewPageNum);
+}
+
+XubString SdrUndoSetPageNum::GetComment() const
+{
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_UndoMovPage,aStr,0,sal_False);
+ return aStr;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@ @@ @@@@ @@@@ @@@@@@ @@@@@ @@@@@ @@@@@ @@@@ @@@@ @@@@@ @@@@
+// @@@ @@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@@@@@@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@@@@@@ @@@@@@ @@@@ @@ @@@@ @@@@@ @@@@@ @@@@@@ @@ @@@ @@@@ @@@@
+// @@ @ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@@@ @@ @@@@@ @@ @@ @@ @@ @@ @@@@@ @@@@@ @@@@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrUndoPageMasterPage::SdrUndoPageMasterPage(SdrPage& rChangedPage)
+: SdrUndoPage(rChangedPage),
+ mbOldHadMasterPage(mrPage.TRG_HasMasterPage())
+{
+ // get current state from page
+ if(mbOldHadMasterPage)
+ {
+ maOldSet = mrPage.TRG_GetMasterPageVisibleLayers();
+ maOldMasterPageNumber = mrPage.TRG_GetMasterPage().GetPageNum();
+ }
+}
+
+SdrUndoPageMasterPage::~SdrUndoPageMasterPage()
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrUndoPageRemoveMasterPage::SdrUndoPageRemoveMasterPage(SdrPage& rChangedPage)
+: SdrUndoPageMasterPage(rChangedPage)
+{
+}
+
+void SdrUndoPageRemoveMasterPage::Undo()
+{
+ if(mbOldHadMasterPage)
+ {
+ mrPage.TRG_SetMasterPage(*mrPage.GetModel()->GetMasterPage(maOldMasterPageNumber));
+ mrPage.TRG_SetMasterPageVisibleLayers(maOldSet);
+ }
+}
+
+void SdrUndoPageRemoveMasterPage::Redo()
+{
+ mrPage.TRG_ClearMasterPage();
+}
+
+XubString SdrUndoPageRemoveMasterPage::GetComment() const
+{
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_UndoDelPageMasterDscr,aStr,0,sal_False);
+ return aStr;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrUndoPageChangeMasterPage::SdrUndoPageChangeMasterPage(SdrPage& rChangedPage)
+: SdrUndoPageMasterPage(rChangedPage),
+ mbNewHadMasterPage(sal_False)
+{
+}
+
+void SdrUndoPageChangeMasterPage::Undo()
+{
+ // remember values from new page
+ if(mrPage.TRG_HasMasterPage())
+ {
+ mbNewHadMasterPage = sal_True;
+ maNewSet = mrPage.TRG_GetMasterPageVisibleLayers();
+ maNewMasterPageNumber = mrPage.TRG_GetMasterPage().GetPageNum();
+ }
+
+ // restore old values
+ if(mbOldHadMasterPage)
+ {
+ mrPage.TRG_ClearMasterPage();
+ mrPage.TRG_SetMasterPage(*mrPage.GetModel()->GetMasterPage(maOldMasterPageNumber));
+ mrPage.TRG_SetMasterPageVisibleLayers(maOldSet);
+ }
+}
+
+void SdrUndoPageChangeMasterPage::Redo()
+{
+ // restore new values
+ if(mbNewHadMasterPage)
+ {
+ mrPage.TRG_ClearMasterPage();
+ mrPage.TRG_SetMasterPage(*mrPage.GetModel()->GetMasterPage(maNewMasterPageNumber));
+ mrPage.TRG_SetMasterPageVisibleLayers(maNewSet);
+ }
+}
+
+XubString SdrUndoPageChangeMasterPage::GetComment() const
+{
+ XubString aStr;
+ ImpTakeDescriptionStr(STR_UndoChgPageMasterDscr,aStr,0,sal_False);
+ return aStr;
+}
+
+///////////////////////////////////////////////////////////////////////
+SdrUndoFactory::~SdrUndoFactory(){}
+// shapes
+SdrUndoAction* SdrUndoFactory::CreateUndoMoveObject( SdrObject& rObject )
+{
+ return new SdrUndoMoveObj( rObject );
+}
+
+SdrUndoAction* SdrUndoFactory::CreateUndoMoveObject( SdrObject& rObject, const Size& rDist )
+{
+ return new SdrUndoMoveObj( rObject, rDist );
+}
+
+SdrUndoAction* SdrUndoFactory::CreateUndoGeoObject( SdrObject& rObject )
+{
+ return new SdrUndoGeoObj( rObject );
+}
+
+SdrUndoAction* SdrUndoFactory::CreateUndoAttrObject( SdrObject& rObject, bool bStyleSheet1, bool bSaveText )
+{
+ return new SdrUndoAttrObj( rObject, bStyleSheet1 ? sal_True : sal_False, bSaveText ? sal_True : sal_False );
+}
+
+SdrUndoAction* SdrUndoFactory::CreateUndoRemoveObject( SdrObject& rObject, bool bOrdNumDirect )
+{
+ return new SdrUndoRemoveObj( rObject, bOrdNumDirect ? sal_True : sal_False );
+}
+
+SdrUndoAction* SdrUndoFactory::CreateUndoInsertObject( SdrObject& rObject, bool bOrdNumDirect )
+{
+ return new SdrUndoInsertObj( rObject, bOrdNumDirect ? sal_True : sal_False );
+}
+
+SdrUndoAction* SdrUndoFactory::CreateUndoDeleteObject( SdrObject& rObject, bool bOrdNumDirect )
+{
+ return new SdrUndoDelObj( rObject, bOrdNumDirect ? sal_True : sal_False );
+}
+
+SdrUndoAction* SdrUndoFactory::CreateUndoNewObject( SdrObject& rObject, bool bOrdNumDirect )
+{
+ return new SdrUndoNewObj( rObject, bOrdNumDirect ? sal_True : sal_False );
+}
+
+SdrUndoAction* SdrUndoFactory::CreateUndoCopyObject( SdrObject& rObject, bool bOrdNumDirect )
+{
+ return new SdrUndoCopyObj( rObject, bOrdNumDirect ? sal_True : sal_False );
+}
+
+SdrUndoAction* SdrUndoFactory::CreateUndoObjectOrdNum( SdrObject& rObject, sal_uInt32 nOldOrdNum1, sal_uInt32 nNewOrdNum1)
+{
+ return new SdrUndoObjOrdNum( rObject, nOldOrdNum1, nNewOrdNum1 );
+}
+
+SdrUndoAction* SdrUndoFactory::CreateUndoReplaceObject( SdrObject& rOldObject, SdrObject& rNewObject, bool bOrdNumDirect )
+{
+ return new SdrUndoReplaceObj( rOldObject, rNewObject, bOrdNumDirect ? sal_True : sal_False );
+}
+
+SdrUndoAction* SdrUndoFactory::CreateUndoObjectLayerChange( SdrObject& rObject, SdrLayerID aOldLayer, SdrLayerID aNewLayer )
+{
+ return new SdrUndoObjectLayerChange( rObject, aOldLayer, aNewLayer );
+}
+
+SdrUndoAction* SdrUndoFactory::CreateUndoObjectSetText( SdrObject& rNewObj, sal_Int32 nText )
+{
+ return new SdrUndoObjSetText( rNewObj, nText );
+}
+
+SdrUndoAction* SdrUndoFactory::CreateUndoObjectStrAttr( SdrObject& rObject,
+ SdrUndoObjStrAttr::ObjStrAttrType eObjStrAttrType,
+ String sOldStr,
+ String sNewStr )
+{
+ return new SdrUndoObjStrAttr( rObject, eObjStrAttrType, sOldStr, sNewStr );
+}
+
+
+// layer
+SdrUndoAction* SdrUndoFactory::CreateUndoNewLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel)
+{
+ return new SdrUndoNewLayer( nLayerNum, rNewLayerAdmin, rNewModel );
+}
+
+SdrUndoAction* SdrUndoFactory::CreateUndoDeleteLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel)
+{
+ return new SdrUndoDelLayer( nLayerNum, rNewLayerAdmin, rNewModel );
+}
+
+SdrUndoAction* SdrUndoFactory::CreateUndoMoveLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel, sal_uInt16 nNeuPos1)
+{
+ return new SdrUndoMoveLayer( nLayerNum, rNewLayerAdmin, rNewModel, nNeuPos1 );
+}
+
+// page
+SdrUndoAction* SdrUndoFactory::CreateUndoDeletePage(SdrPage& rPage)
+{
+ return new SdrUndoDelPage( rPage );
+}
+
+SdrUndoAction* SdrUndoFactory::CreateUndoNewPage(SdrPage& rPage)
+{
+ return new SdrUndoNewPage( rPage );
+}
+
+SdrUndoAction* SdrUndoFactory::CreateUndoCopyPage(SdrPage& rPage)
+{
+ return new SdrUndoCopyPage( rPage );
+}
+
+SdrUndoAction* SdrUndoFactory::CreateUndoSetPageNum(SdrPage& rNewPg, sal_uInt16 nOldPageNum1, sal_uInt16 nNewPageNum1)
+{
+ return new SdrUndoSetPageNum( rNewPg, nOldPageNum1, nNewPageNum1 );
+}
+ // master page
+SdrUndoAction* SdrUndoFactory::CreateUndoPageRemoveMasterPage(SdrPage& rChangedPage)
+{
+ return new SdrUndoPageRemoveMasterPage( rChangedPage );
+}
+
+SdrUndoAction* SdrUndoFactory::CreateUndoPageChangeMasterPage(SdrPage& rChangedPage)
+{
+ return new SdrUndoPageChangeMasterPage(rChangedPage);
+}
+
+// eof
diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx
new file mode 100644
index 000000000000..acfaf12ae8d6
--- /dev/null
+++ b/svx/source/svdraw/svdview.cxx
@@ -0,0 +1,1604 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <editeng/eeitem.hxx>
+
+#include "svx/svdstr.hrc" // Namen aus der Resource
+#include "svx/svdglob.hxx" // StringCache
+#include <svx/svdpagv.hxx>
+#include <svx/svdmrkv.hxx>
+#include <svx/svdedxv.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdopath.hxx> // fuer GetContext
+#include <svx/svdograf.hxx> // fuer GetContext
+#include <svx/svdomedia.hxx> // fuer GetContext
+#include <svx/svdetc.hxx> // Fuer SdrEngineDefaults
+
+#ifdef DBG_UTIL
+#include <svdibrow.hxx>
+#endif
+
+#include "svx/svdoutl.hxx"
+#include "svx/svdview.hxx"
+#include "editeng/editview.hxx" // fuer GetField
+#include "editeng/flditem.hxx" // fuer URLField
+#include "svx/obj3d.hxx"
+#include "svx/svddrgmt.hxx"
+#include "svx/svdoutl.hxx"
+#include "svx/svdotable.hxx"
+#include <tools/tenccvt.hxx>
+#include <svx/sdr/overlay/overlaypolypolygon.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <svx/sdrpaintwindow.hxx>
+#include <svx/sdrpagewindow.hxx>
+#include <svx/sdrhittesthelper.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrViewEvent::SdrViewEvent()
+: pHdl(NULL),
+ pObj(NULL),
+ pRootObj(NULL),
+ pPV(NULL),
+ pURLField(NULL),
+ eHit(SDRHIT_NONE),
+ eEvent(SDREVENT_NONE),
+ eHdlKind(HDL_MOVE),
+ eEndCreateCmd(SDRCREATE_NEXTPOINT),
+ nMouseClicks(0),
+ nMouseMode(0),
+ nMouseCode(0),
+ nHlplIdx(0),
+ nGlueId(0),
+ bMouseDown(sal_False),
+ bMouseUp(sal_False),
+ bDoubleHdlSize(sal_False),
+ bIsAction(sal_False),
+ bIsTextEdit(sal_False),
+ bTextEditHit(sal_False),
+ bAddMark(sal_False),
+ bUnmark(sal_False),
+ bPrevNextMark(sal_False),
+ bMarkPrev(sal_False),
+ bInsPointNewObj(sal_False),
+ bDragWithCopy(sal_False),
+ bCaptureMouse(sal_False),
+ bReleaseMouse(sal_False)
+{
+}
+
+SdrViewEvent::~SdrViewEvent()
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// helper class for all D&D overlays
+
+void SdrDropMarkerOverlay::ImplCreateOverlays(const SdrView& rView, const basegfx::B2DPolyPolygon& rPolyPolygon)
+{
+ for(sal_uInt32 a(0L); a < rView.PaintWindowCount(); a++)
+ {
+ SdrPaintWindow* pCandidate = rView.GetPaintWindow(a);
+ ::sdr::overlay::OverlayManager* pTargetOverlay = pCandidate->GetOverlayManager();
+
+ if(pTargetOverlay)
+ {
+ ::sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(
+ rPolyPolygon);
+ pTargetOverlay->add(*pNew);
+ maObjects.append(*pNew);
+ }
+ }
+}
+
+SdrDropMarkerOverlay::SdrDropMarkerOverlay(const SdrView& rView, const SdrObject& rObject)
+{
+ ImplCreateOverlays(rView, rObject.TakeXorPoly());
+}
+
+SdrDropMarkerOverlay::SdrDropMarkerOverlay(const SdrView& rView, const Rectangle& rRectangle)
+{
+ basegfx::B2DPolygon aB2DPolygon;
+ aB2DPolygon.append(basegfx::B2DPoint(rRectangle.Left(), rRectangle.Top()));
+ aB2DPolygon.append(basegfx::B2DPoint(rRectangle.Right(), rRectangle.Top()));
+ aB2DPolygon.append(basegfx::B2DPoint(rRectangle.Right(), rRectangle.Bottom()));
+ aB2DPolygon.append(basegfx::B2DPoint(rRectangle.Left(), rRectangle.Bottom()));
+ aB2DPolygon.setClosed(true);
+
+ basegfx::B2DPolyPolygon aB2DPolyPolygon;
+ aB2DPolyPolygon.append(aB2DPolygon);
+
+ ImplCreateOverlays(rView, aB2DPolyPolygon);
+}
+
+SdrDropMarkerOverlay::SdrDropMarkerOverlay(const SdrView& rView, const Point& rStart, const Point& rEnd)
+{
+ basegfx::B2DPolygon aB2DPolygon;
+ aB2DPolygon.append(basegfx::B2DPoint(rStart.X(), rStart.Y()));
+ aB2DPolygon.append(basegfx::B2DPoint(rEnd.X(), rEnd.Y()));
+ aB2DPolygon.setClosed(true);
+
+ basegfx::B2DPolyPolygon aB2DPolyPolygon;
+ aB2DPolyPolygon.append(aB2DPolygon);
+
+ ImplCreateOverlays(rView, aB2DPolyPolygon);
+}
+
+SdrDropMarkerOverlay::~SdrDropMarkerOverlay()
+{
+ // The OverlayObjects are cleared using the destructor of OverlayObjectList.
+ // That destructor calls clear() at the list which removes all objects from the
+ // OverlayManager and deletes them.
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @@ @@ @@ @@@@@ @@ @@
+// @@ @@ @@ @@ @@ @@
+// @@ @@ @@ @@ @@ @ @@
+// @@@@@ @@ @@@@ @@@@@@@
+// @@@ @@ @@ @@@@@@@
+// @@@ @@ @@ @@@ @@@
+// @ @@ @@@@@ @@ @@
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1(SdrView,SdrCreateView);
+
+SdrView::SdrView(SdrModel* pModel1, OutputDevice* pOut)
+: SdrCreateView(pModel1,pOut),
+ bNoExtendedMouseDispatcher(sal_False),
+ bNoExtendedKeyDispatcher(sal_False),
+ bNoExtendedCommandDispatcher(sal_False),
+ mbMasterPagePaintCaching(sal_False)
+{
+ bTextEditOnObjectsWithoutTextIfTextTool=sal_False;
+
+ maAccessibilityOptions.AddListener(this);
+
+ onAccessibilityOptionsChanged();
+}
+
+SdrView::~SdrView()
+{
+ maAccessibilityOptions.RemoveListener(this);
+}
+
+sal_Bool SdrView::KeyInput(const KeyEvent& rKEvt, Window* pWin)
+{
+ SetActualWin(pWin);
+ sal_Bool bRet=SdrCreateView::KeyInput(rKEvt,pWin);
+ if (!bRet && !IsExtendedKeyInputDispatcherEnabled()) {
+ bRet=sal_True;
+ switch (rKEvt.GetKeyCode().GetFullFunction()) {
+ case KEYFUNC_CUT : Cut(); break;
+ case KEYFUNC_COPY : Yank(); break;
+ case KEYFUNC_PASTE : Paste(pWin); break;
+ case KEYFUNC_DELETE: DeleteMarked(); break;
+ case KEYFUNC_UNDO: pMod->Undo(); break;
+ case KEYFUNC_REDO: pMod->Redo(); break;
+ case KEYFUNC_REPEAT: pMod->Repeat(*this); break;
+ default: {
+ switch (rKEvt.GetKeyCode().GetFullCode()) {
+ case KEY_ESCAPE: {
+ if (IsTextEdit()) SdrEndTextEdit();
+ if (IsAction()) BrkAction();
+ if (pWin!=NULL) pWin->ReleaseMouse();
+ } break;
+ case KEY_DELETE: DeleteMarked(); break;
+ case KEY_CUT: case KEY_DELETE+KEY_SHIFT: Cut(); break;
+ case KEY_COPY: case KEY_INSERT+KEY_MOD1: Yank(); break;
+ case KEY_PASTE: case KEY_INSERT+KEY_SHIFT: Paste(pWin); break;
+ case KEY_UNDO: case KEY_BACKSPACE+KEY_MOD2: pMod->Undo(); break;
+ case KEY_BACKSPACE+KEY_MOD2+KEY_SHIFT: pMod->Redo(); break;
+ case KEY_REPEAT: case KEY_BACKSPACE+KEY_MOD2+KEY_MOD1: pMod->Repeat(*this); break;
+ case KEY_MOD1+KEY_A: MarkAll(); break;
+ default: bRet=sal_False;
+ } // switch
+ }
+ } // switch
+ if (bRet && pWin!=NULL) {
+ pWin->SetPointer(GetPreferedPointer(
+ pWin->PixelToLogic(pWin->ScreenToOutputPixel( pWin->GetPointerPosPixel() ) ),
+ pWin,
+ rKEvt.GetKeyCode().GetModifier()));
+ }
+ }
+ return bRet;
+}
+
+sal_Bool SdrView::MouseButtonDown(const MouseEvent& rMEvt, Window* pWin)
+{
+ SetActualWin(pWin);
+ if (rMEvt.IsLeft()) aDragStat.SetMouseDown(sal_True);
+ sal_Bool bRet=SdrCreateView::MouseButtonDown(rMEvt,pWin);
+ if (!bRet && !IsExtendedMouseEventDispatcherEnabled()) {
+ SdrViewEvent aVEvt;
+ PickAnything(rMEvt,SDRMOUSEBUTTONDOWN,aVEvt);
+ bRet=DoMouseEvent(aVEvt);
+ }
+ return bRet;
+}
+
+sal_Bool SdrView::MouseButtonUp(const MouseEvent& rMEvt, Window* pWin)
+{
+ SetActualWin(pWin);
+ if (rMEvt.IsLeft()) aDragStat.SetMouseDown(sal_False);
+ sal_Bool bAction=IsAction();
+ sal_Bool bRet=!bAction && SdrCreateView::MouseButtonUp(rMEvt,pWin);
+ if (!bRet && !IsExtendedMouseEventDispatcherEnabled()) {
+ SdrViewEvent aVEvt;
+ PickAnything(rMEvt,SDRMOUSEBUTTONUP,aVEvt);
+ bRet=DoMouseEvent(aVEvt);
+ }
+ return bRet;
+}
+
+sal_Bool SdrView::MouseMove(const MouseEvent& rMEvt, Window* pWin)
+{
+ SetActualWin(pWin);
+ aDragStat.SetMouseDown(rMEvt.IsLeft());
+ sal_Bool bRet=SdrCreateView::MouseMove(rMEvt,pWin);
+ if (!IsExtendedMouseEventDispatcherEnabled() && !IsTextEditInSelectionMode()) {
+ SdrViewEvent aVEvt;
+ PickAnything(rMEvt,SDRMOUSEMOVE,aVEvt);
+ if (DoMouseEvent(aVEvt)) bRet=sal_True;
+ }
+
+ // #87792# Removed code which did let the mouse snap on object
+ // points
+
+ return bRet;
+}
+
+sal_Bool SdrView::Command(const CommandEvent& rCEvt, Window* pWin)
+{
+ SetActualWin(pWin);
+ sal_Bool bRet=SdrCreateView::Command(rCEvt,pWin);
+ return bRet;
+}
+
+/* new interface src537 */
+sal_Bool SdrView::GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr) const
+{
+ return SdrCreateView::GetAttributes(rTargetSet, bOnlyHardAttr);
+}
+
+SfxStyleSheet* SdrView::GetStyleSheet() const
+{
+ //sal_Bool bOk=sal_False;
+ return SdrCreateView::GetStyleSheet(); //bOk);
+}
+
+SdrHitKind SdrView::PickAnything(const MouseEvent& rMEvt, sal_uInt16 nEventKind, SdrViewEvent& rVEvt) const
+{
+ rVEvt.bMouseDown=nEventKind==SDRMOUSEBUTTONDOWN;
+ rVEvt.bMouseUp=nEventKind==SDRMOUSEBUTTONUP;
+ rVEvt.nMouseClicks=rMEvt.GetClicks();
+ rVEvt.nMouseMode=rMEvt.GetMode();
+ rVEvt.nMouseCode=rMEvt.GetButtons() | rMEvt.GetModifier();
+ const OutputDevice* pOut=pActualOutDev;
+ if (pOut==NULL)
+ {
+ pOut = GetFirstOutputDevice();
+ //pOut=GetWin(0);
+ }
+ Point aPnt(rMEvt.GetPosPixel());
+ if (pOut!=NULL) aPnt=pOut->PixelToLogic(aPnt);
+ rVEvt.aLogicPos=aPnt;
+ return PickAnything(aPnt,rVEvt);
+}
+
+// Mit der Maus draggen (Move)
+// Beispiel beim erzeugen eines Rechtecks. MouseDown muss ohne
+// ModKey erfolgen, weil sonst i.d.R. Markieren forciert wird (s.u.)
+// Drueckt man dann beim MouseMove gleichzeitig Shift, Ctrl, und Alt,
+// so erzeugt man ein zentrisches Quadrat ohne Fang.
+// Die Doppelbelegung von Ortho und Shift stellt i.d.R. kein Problem dar,
+// da sich beides meisst gegenseitig ausschliesst. Einzig Shear (das beim
+// Verzerren, nicht dass beim Drehen) beruecksichtigt beides gleichzeitig.
+// Dass muss der Anwender erstmal noch umschiffen (z.B. mit einer Hilfslinie).
+#define MODKEY_NoSnap bCtrl /* Fang temporaer aus */
+#define MODKEY_Ortho bShift /* na eben ortho */
+#define MODKEY_Center bAlt /* Zentrisch erzeugen/resizen */
+#define MODKEY_AngleSnap bShift
+#define MODKEY_CopyDrag bCtrl /* Draggen mit kopieren */
+
+// irgendwo hinklicken (MouseDown)
+#define MODKEY_PolyPoly bAlt /* Neues Poly bei InsPt und bei Create */
+#define MODKEY_MultiMark bShift /* MarkObj ohne vorher UnmarkAll */
+#define MODKEY_Unmark bAlt /* Unmark durch Rahmenaufziehen */
+#define MODKEY_ForceMark bCtrl /* Rahmenaufziehen erzwingen, auch wenn Obj an MausPos */
+#define MODKEY_DeepMark bAlt /* MarkNextObj */
+#define MODKEY_DeepBackw bShift /* MarkNextObj rueckwaerts */
+
+SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) const
+{
+ const OutputDevice* pOut=pActualOutDev;
+ if (pOut==NULL)
+ {
+ pOut = GetFirstOutputDevice();
+ //pOut=GetWin(0);
+ }
+
+ // #i73628# Use a non-changeable copy of he logic pos
+ const Point aLocalLogicPosition(rLogicPos);
+
+ sal_Bool bEditMode=IsEditMode();
+ sal_Bool bPointMode=bEditMode && HasMarkablePoints();
+ sal_Bool bGluePointMode=IsGluePointEditMode();
+ sal_Bool bInsPolyPt=bPointMode && IsInsObjPointMode() && IsInsObjPointPossible();
+ sal_Bool bInsGluePt=bGluePointMode && IsInsGluePointMode() && IsInsGluePointPossible();
+ sal_Bool bIsTextEdit=IsTextEdit();
+ sal_Bool bTextEditHit=IsTextEditHit(aLocalLogicPosition,0/*nHitTolLog*/);
+ sal_Bool bTextEditSel=IsTextEditInSelectionMode();
+ sal_Bool bShift=(rVEvt.nMouseCode & KEY_SHIFT) !=0;
+ sal_Bool bCtrl=(rVEvt.nMouseCode & KEY_MOD1) !=0;
+ sal_Bool bAlt=(rVEvt.nMouseCode & KEY_MOD2) !=0;
+ SdrHitKind eHit=SDRHIT_NONE;
+ SdrHdl* pHdl=pOut!=NULL && !bTextEditSel ? PickHandle(aLocalLogicPosition) : NULL;
+ SdrPageView* pPV=NULL;
+ SdrObject* pObj=NULL;
+ SdrObject* pHitObj=NULL;
+ sal_uInt16 nHitPassNum=0;
+ sal_uInt16 nHlplIdx=0;
+ sal_uInt16 nGlueId=0;
+ sal_Bool bUnmarkedObjHit=sal_False;
+ if (bTextEditHit || bTextEditSel)
+ {
+ eHit=SDRHIT_TEXTEDIT;
+ bTextEditHit=sal_True;
+ }
+ else if (pHdl!=NULL)
+ {
+ eHit=SDRHIT_HANDLE; // Handle getroffen hat hoechste Prioritaet
+ }
+ else if (bEditMode && IsHlplVisible() && IsHlplFront() && pOut!=NULL && PickHelpLine(aLocalLogicPosition,nHitTolLog,*pOut,nHlplIdx,pPV))
+ {
+ eHit=SDRHIT_HELPLINE; // Hilfslinie im Vordergrund getroffen zum verschieben
+ }
+ else if (bGluePointMode && PickGluePoint(aLocalLogicPosition,pObj,nGlueId,pPV))
+ {
+ eHit=SDRHIT_GLUEPOINT; // nichtmarkierter Klebepunkt getroffen
+ }
+ else if (PickObj(aLocalLogicPosition,nHitTolLog,pHitObj,pPV,SDRSEARCH_DEEP|SDRSEARCH_MARKED,&pObj,NULL,&nHitPassNum))
+ {
+ eHit=SDRHIT_MARKEDOBJECT;
+ ::sdr::table::SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( pObj );
+ if( pTableObj )
+ {
+ sal_Int32 nX = 0, nY = 0;
+ switch( pTableObj->CheckTableHit( aLocalLogicPosition, nX, nY, 0 ) )
+ {
+ case sdr::table::SDRTABLEHIT_CELL:
+ eHit = SDRHIT_CELL;
+ break;
+ case sdr::table::SDRTABLEHIT_CELLTEXTAREA:
+ eHit = SDRHIT_TEXTEDITOBJ;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ else if (PickObj(aLocalLogicPosition,nHitTolLog,pHitObj,pPV,SDRSEARCH_DEEP|/*SDRSEARCH_TESTMARKABLE|*/SDRSEARCH_ALSOONMASTER|SDRSEARCH_WHOLEPAGE,&pObj,NULL,&nHitPassNum))
+ {
+ // MasterPages und WholePage fuer Macro und URL
+ eHit=SDRHIT_UNMARKEDOBJECT;
+ ::sdr::table::SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( pObj );
+ if( pTableObj )
+ {
+ sal_Int32 nX = 0, nY = 0;
+ switch( pTableObj->CheckTableHit( aLocalLogicPosition, nX, nY, 0 ) )
+ {
+ case sdr::table::SDRTABLEHIT_CELL:
+ eHit = SDRHIT_CELL;
+ break;
+ case sdr::table::SDRTABLEHIT_CELLTEXTAREA:
+ eHit = SDRHIT_TEXTEDITOBJ;
+ break;
+ default:
+ break;
+ }
+ }
+ bUnmarkedObjHit=sal_True;
+ }
+ else if (bEditMode && IsHlplVisible() && !IsHlplFront() && pOut!=NULL && PickHelpLine(aLocalLogicPosition,nHitTolLog,*pOut,nHlplIdx,pPV))
+ {
+ eHit=SDRHIT_HELPLINE; // Hilfslinie im Vordergrund getroffen zum verschieben
+ }
+ if (IsMacroMode() && eHit==SDRHIT_UNMARKEDOBJECT)
+ {
+ bool bRoot=pObj->HasMacro();
+ sal_Bool bDeep=pObj!=pHitObj && pHitObj->HasMacro();
+ sal_Bool bMid=sal_False; // Gruppierte Gruppe mit Macro getroffen?
+ SdrObject* pMidObj=NULL;
+ if (pObj!=pHitObj)
+ {
+ SdrObject* pObjTmp=NULL;
+ pObjTmp=pHitObj->GetUpGroup();
+ if (pObjTmp==pObj) pObjTmp=NULL;
+ while (pObjTmp!=NULL)
+ {
+ if (pObjTmp->HasMacro())
+ {
+ bMid=sal_True;
+ pMidObj=pObjTmp;
+ }
+ pObjTmp=pObjTmp->GetUpGroup();
+ if (pObjTmp==pObj) pObjTmp=NULL;
+ }
+ }
+
+ if (bDeep || bMid || bRoot)
+ {
+ SdrObjMacroHitRec aHitRec;
+ aHitRec.aPos=aLocalLogicPosition;
+ aHitRec.aDownPos=aLocalLogicPosition;
+ aHitRec.nTol=nHitTolLog;
+ aHitRec.pVisiLayer=&pPV->GetVisibleLayers();
+ aHitRec.pPageView=pPV;
+ if (bDeep) bDeep=pHitObj->IsMacroHit(aHitRec);
+ if (bMid ) bMid =pMidObj->IsMacroHit(aHitRec);
+ if (bRoot) bRoot=pObj->IsMacroHit(aHitRec);
+ if (bRoot || bMid || bDeep)
+ {
+ // Prio: 1.Root, 2.Mid, 3.Deep
+ rVEvt.pRootObj=pObj;
+ if (!bRoot) pObj=pMidObj;
+ if (!bRoot && !bMid) pObj=pHitObj;
+ eHit=SDRHIT_MACRO;
+ }
+ }
+ }
+ // auf URL-Field checken
+ if (IsMacroMode() && eHit==SDRHIT_UNMARKEDOBJECT)
+ {
+ SdrTextObj* pTextObj=PTR_CAST(SdrTextObj,pHitObj);
+ if (pTextObj!=NULL && pTextObj->HasText())
+ {
+ bool bTEHit(pPV &&
+ SdrObjectPrimitiveHit(*pTextObj, aLocalLogicPosition, 0, *pPV, &pPV->GetVisibleLayers(), true));
+
+ if (bTEHit)
+ {
+ Rectangle aTextRect;
+ Rectangle aAnchor;
+ SdrOutliner* pOutliner = &pTextObj->ImpGetDrawOutliner();
+ if( pTextObj->GetModel() )
+ pOutliner = &pTextObj->GetModel()->GetHitTestOutliner();
+
+ pTextObj->TakeTextRect( *pOutliner, aTextRect, sal_False, &aAnchor, sal_False );
+
+ // #i73628# Use a text-relative position for hit test in hit test outliner
+ Point aTemporaryTextRelativePosition(aLocalLogicPosition - aTextRect.TopLeft());
+
+ // FitToSize berueksichtigen
+ SdrFitToSizeType eFit=pTextObj->GetFitToSize();
+ sal_Bool bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
+ if (bFitToSize) {
+ Fraction aX(aTextRect.GetWidth()-1,aAnchor.GetWidth()-1);
+ Fraction aY(aTextRect.GetHeight()-1,aAnchor.GetHeight()-1);
+ ResizePoint(aTemporaryTextRelativePosition,Point(),aX,aY);
+ }
+ // Drehung berueksichtigen
+ const GeoStat& rGeo=pTextObj->GetGeoStat();
+ if (rGeo.nDrehWink!=0) RotatePoint(aTemporaryTextRelativePosition,Point(),-rGeo.nSin,rGeo.nCos); // -sin fuer Unrotate
+ // Laufschrift berueksichtigen fehlt noch ...
+ if(pActualOutDev && pActualOutDev->GetOutDevType() == OUTDEV_WINDOW)
+ {
+ OutlinerView aOLV(pOutliner, (Window*)pActualOutDev);
+ const EditView& aEV=aOLV.GetEditView();
+ const SvxFieldItem* pItem=aEV.GetField(aTemporaryTextRelativePosition);
+ if (pItem!=NULL) {
+ const SvxFieldData* pFld=pItem->GetField();
+ const SvxURLField* pURL=PTR_CAST(SvxURLField,pFld);
+ if (pURL!=NULL) {
+ eHit=SDRHIT_URLFIELD;
+ rVEvt.pURLField=pURL;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (nHitPassNum==SDRSEARCHPASS_DIRECT &&
+ (eHit==SDRHIT_MARKEDOBJECT || eHit==SDRHIT_UNMARKEDOBJECT) &&
+ (IsTextTool() || (IsEditMode() && IsQuickTextEditMode())) && pHitObj->HasTextEdit())
+ {
+ // Ringsum die TextEditArea ein Rand zum Selektieren ohne Textedit
+ Rectangle aBoundRect(pHitObj->GetCurrentBoundRect());
+
+ // #105130# Force to SnapRect when Fontwork
+ if(pHitObj->ISA(SdrTextObj) && ((SdrTextObj*)pHitObj)->IsFontwork())
+ {
+ aBoundRect = pHitObj->GetSnapRect();
+ }
+
+ // #105130# Old test for hit on BoundRect is completely wrong
+ // and never worked, doing it new here.
+ sal_Int32 nTolerance(nHitTolLog);
+ sal_Bool bBoundRectHit(sal_False);
+
+ if(pOut)
+ {
+ nTolerance = pOut->PixelToLogic(Size(2, 0)).Width();
+ }
+
+ if( (aLocalLogicPosition.X() >= aBoundRect.Left() - nTolerance && aLocalLogicPosition.X() <= aBoundRect.Left() + nTolerance)
+ || (aLocalLogicPosition.X() >= aBoundRect.Right() - nTolerance && aLocalLogicPosition.X() <= aBoundRect.Right() + nTolerance)
+ || (aLocalLogicPosition.Y() >= aBoundRect.Top() - nTolerance && aLocalLogicPosition.Y() <= aBoundRect.Top() + nTolerance)
+ || (aLocalLogicPosition.Y() >= aBoundRect.Bottom() - nTolerance && aLocalLogicPosition.Y() <= aBoundRect.Bottom() + nTolerance))
+ {
+ bBoundRectHit = sal_True;
+ }
+
+ if(!bBoundRectHit)
+ {
+ bool bTEHit(pPV &&
+ SdrObjectPrimitiveHit(*pHitObj, aLocalLogicPosition, 0, *pPV, &pPV->GetVisibleLayers(), true));
+
+ // TextEdit an Objekten im gesperrten Layer
+ if (pPV->GetLockedLayers().IsSet(pHitObj->GetLayer()))
+ {
+ bTEHit=sal_False;
+ }
+
+ if (bTEHit)
+ {
+ rVEvt.pRootObj=pObj;
+ pObj=pHitObj;
+ eHit=SDRHIT_TEXTEDITOBJ;
+ }
+ }
+ }
+ if (nHitPassNum!=SDRSEARCHPASS_DIRECT && eHit==SDRHIT_UNMARKEDOBJECT) {
+ eHit=SDRHIT_NONE;
+ pObj=NULL;
+ pPV=NULL;
+ }
+ sal_Bool bMouseLeft=(rVEvt.nMouseCode&MOUSE_LEFT)!=0;
+ sal_Bool bMouseRight=(rVEvt.nMouseCode&MOUSE_RIGHT)!=0;
+ sal_Bool bMouseDown=rVEvt.bMouseDown;
+ sal_Bool bMouseUp=rVEvt.bMouseUp;
+ SdrEventKind eEvent=SDREVENT_NONE;
+ sal_Bool bIsAction=IsAction();
+
+ if (bIsAction)
+ {
+ if (bMouseDown)
+ {
+ if (bMouseRight) eEvent=SDREVENT_BCKACTION;
+ }
+ else if (bMouseUp)
+ {
+ if (bMouseLeft)
+ {
+ eEvent=SDREVENT_ENDACTION;
+ if (IsDragObj())
+ {
+ eEvent=SDREVENT_ENDDRAG;
+ rVEvt.bDragWithCopy=MODKEY_CopyDrag;
+ }
+ else if (IsCreateObj() || IsInsObjPoint())
+ {
+ eEvent=IsCreateObj() ? SDREVENT_ENDCREATE : SDREVENT_ENDINSOBJPOINT;
+ rVEvt.eEndCreateCmd=SDRCREATE_NEXTPOINT;
+ if (MODKEY_PolyPoly) rVEvt.eEndCreateCmd=SDRCREATE_NEXTOBJECT;
+ if (rVEvt.nMouseClicks>1) rVEvt.eEndCreateCmd=SDRCREATE_FORCEEND;
+ }
+ else if (IsMarking())
+ {
+ eEvent=SDREVENT_ENDMARK;
+ if (!aDragStat.IsMinMoved())
+ {
+ eEvent=SDREVENT_BRKMARK;
+ rVEvt.bAddMark=MODKEY_MultiMark;
+ }
+ }
+ }
+ }
+ else
+ {
+ eEvent=SDREVENT_MOVACTION;
+ }
+ }
+ else if (eHit==SDRHIT_TEXTEDIT)
+ {
+ eEvent=SDREVENT_TEXTEDIT;
+ }
+ else if (bMouseDown && bMouseLeft)
+ {
+ if (rVEvt.nMouseClicks==2 && rVEvt.nMouseCode==MOUSE_LEFT && pObj!=NULL && pHitObj!=NULL && pHitObj->HasTextEdit() && eHit==SDRHIT_MARKEDOBJECT)
+ {
+ rVEvt.pRootObj=pObj;
+ pObj=pHitObj;
+ eEvent=SDREVENT_BEGTEXTEDIT;
+ }
+ else if (MODKEY_ForceMark && eHit!=SDRHIT_URLFIELD)
+ {
+ eEvent=SDREVENT_BEGMARK; // AddMark,Unmark */
+ }
+ else if (eHit==SDRHIT_HELPLINE)
+ {
+ eEvent=SDREVENT_BEGDRAGHELPLINE; // nix weiter
+ }
+ else if (eHit==SDRHIT_GLUEPOINT)
+ {
+ eEvent=SDREVENT_MARKGLUEPOINT; // AddMark+Drag
+ rVEvt.bAddMark=MODKEY_MultiMark || MODKEY_DeepMark; // falls bei Deep nicht getroffen
+ }
+ else if (eHit==SDRHIT_HANDLE)
+ {
+ eEvent=SDREVENT_BEGDRAGOBJ; // Mark+Drag,AddMark+Drag,DeepMark+Drag,Unmark
+ sal_Bool bGlue=pHdl->GetKind()==HDL_GLUE;
+ sal_Bool bPoly=!bGlue && IsPointMarkable(*pHdl);
+ sal_Bool bMarked=bGlue || bPoly && pHdl->IsSelected();
+ if (bGlue || bPoly)
+ {
+ eEvent=bGlue ? SDREVENT_MARKGLUEPOINT : SDREVENT_MARKPOINT;
+ if (MODKEY_DeepMark)
+ {
+ rVEvt.bAddMark=sal_True;
+ rVEvt.bPrevNextMark=sal_True;
+ rVEvt.bMarkPrev=MODKEY_DeepBackw;
+ }
+ else if (MODKEY_MultiMark)
+ {
+ rVEvt.bAddMark=sal_True;
+ rVEvt.bUnmark=bMarked; // Toggle
+ if (bGlue)
+ {
+ pObj=pHdl->GetObj();
+ nGlueId=(sal_uInt16)pHdl->GetObjHdlNum();
+ }
+ }
+ else if (bMarked)
+ {
+ eEvent=SDREVENT_BEGDRAGOBJ; // MarkState nicht aendern, nur Drag
+ }
+ }
+ }
+ else if (bInsPolyPt && (MODKEY_PolyPoly || (!MODKEY_MultiMark && !MODKEY_DeepMark)))
+ {
+ eEvent=SDREVENT_BEGINSOBJPOINT;
+ rVEvt.bInsPointNewObj=MODKEY_PolyPoly;
+ }
+ else if (bInsGluePt && !MODKEY_MultiMark && !MODKEY_DeepMark)
+ {
+ eEvent=SDREVENT_BEGINSGLUEPOINT;
+ }
+ else if (eHit==SDRHIT_TEXTEDITOBJ)
+ {
+ eEvent=SDREVENT_BEGTEXTEDIT; // AddMark+Drag,DeepMark+Drag,Unmark
+ if (MODKEY_MultiMark || MODKEY_DeepMark)
+ { // falls bei Deep nicht getroffen
+ eEvent=SDREVENT_MARKOBJ;
+ }
+ }
+ else if (eHit==SDRHIT_MACRO)
+ {
+ eEvent=SDREVENT_BEGMACROOBJ; // AddMark+Drag
+ if (MODKEY_MultiMark || MODKEY_DeepMark)
+ { // falls bei Deep nicht getroffen
+ eEvent=SDREVENT_MARKOBJ;
+ }
+ }
+ else if (eHit==SDRHIT_URLFIELD)
+ {
+ eEvent=SDREVENT_EXECUTEURL; // AddMark+Drag
+ if (MODKEY_MultiMark || MODKEY_DeepMark)
+ { // falls bei Deep nicht getroffen
+ eEvent=SDREVENT_MARKOBJ;
+ }
+ }
+ else if (eHit==SDRHIT_MARKEDOBJECT)
+ {
+ eEvent=SDREVENT_BEGDRAGOBJ; // DeepMark+Drag,Unmark
+
+ if (MODKEY_MultiMark || MODKEY_DeepMark)
+ { // falls bei Deep nicht getroffen
+ eEvent=SDREVENT_MARKOBJ;
+ }
+ }
+ else if (IsCreateMode())
+ {
+ eEvent=SDREVENT_BEGCREATEOBJ; // Nix weiter
+ }
+ else if (eHit==SDRHIT_UNMARKEDOBJECT)
+ {
+ eEvent=SDREVENT_MARKOBJ; // AddMark+Drag
+ }
+ else
+ {
+ eEvent=SDREVENT_BEGMARK;
+ }
+
+ if (eEvent==SDREVENT_MARKOBJ)
+ {
+ rVEvt.bAddMark=MODKEY_MultiMark || MODKEY_DeepMark; // falls bei Deep nicht getroffen
+ rVEvt.bPrevNextMark=MODKEY_DeepMark;
+ rVEvt.bMarkPrev=MODKEY_DeepMark && MODKEY_DeepBackw;
+ }
+ if (eEvent==SDREVENT_BEGMARK)
+ {
+ rVEvt.bAddMark=MODKEY_MultiMark;
+ rVEvt.bUnmark=MODKEY_Unmark;
+ }
+ }
+ rVEvt.bIsAction=bIsAction;
+ rVEvt.bIsTextEdit=bIsTextEdit;
+ rVEvt.bTextEditHit=bTextEditHit;
+ rVEvt.aLogicPos=aLocalLogicPosition;
+ rVEvt.pHdl=pHdl;
+ rVEvt.pObj=pObj;
+ if(rVEvt.pRootObj==NULL)
+ rVEvt.pRootObj=pObj;
+ rVEvt.pPV=pPV;
+ rVEvt.nHlplIdx=nHlplIdx;
+ rVEvt.nGlueId=nGlueId;
+ rVEvt.eHit=eHit;
+ rVEvt.eEvent=eEvent;
+ rVEvt.bCaptureMouse=bMouseLeft && bMouseDown && eEvent!=SDREVENT_NONE;
+ rVEvt.bReleaseMouse=bMouseLeft && bMouseUp;
+#ifdef DGB_UTIL
+ if (rVEvt.pRootObj!=NULL) {
+ if (rVEvt.pRootObj->GetObjList()!=rVEvt.pPV->GetObjList()) {
+ DBG_ERROR("SdrView::PickAnything(): pRootObj->GetObjList()!=pPV->GetObjList() !");
+ }
+ }
+#endif
+ return eHit;
+}
+
+sal_Bool SdrView::DoMouseEvent(const SdrViewEvent& rVEvt)
+{
+ sal_Bool bRet=sal_False;
+ SdrHitKind eHit=rVEvt.eHit;
+ Point aLogicPos(rVEvt.aLogicPos);
+
+ sal_Bool bShift=(rVEvt.nMouseCode & KEY_SHIFT) !=0;
+ sal_Bool bCtrl=(rVEvt.nMouseCode & KEY_MOD1) !=0;
+ sal_Bool bAlt=(rVEvt.nMouseCode & KEY_MOD2) !=0;
+ sal_Bool bMouseLeft=(rVEvt.nMouseCode&MOUSE_LEFT)!=0;
+ //sal_Bool bMouseRight=(rVEvt.nMouseCode&MOUSE_RIGHT)!=0;
+ sal_Bool bMouseDown=rVEvt.bMouseDown;
+ sal_Bool bMouseUp=rVEvt.bMouseUp;
+ if (bMouseDown) {
+ if (bMouseLeft) aDragStat.SetMouseDown(sal_True);
+ } else if (bMouseUp) {
+ if (bMouseLeft) aDragStat.SetMouseDown(sal_False);
+ } else { // ansonsten MoueMove
+ aDragStat.SetMouseDown(bMouseLeft);
+ }
+
+#ifdef MODKEY_NoSnap
+ SetSnapEnabled(!MODKEY_NoSnap);
+#endif
+#ifdef MODKEY_Ortho
+ SetOrtho(MODKEY_Ortho!=IsOrthoDesired());
+#endif
+#ifdef MODKEY_BigOrtho
+ SetBigOrtho(MODKEY_BigOrtho);
+#endif
+#ifdef MODKEY_AngleSnap
+ SetAngleSnapEnabled(MODKEY_AngleSnap);
+#endif
+#ifdef MODKEY_CopyDrag
+ SetDragWithCopy(MODKEY_CopyDrag);
+#endif
+#ifdef MODKEY_Center
+ SetCreate1stPointAsCenter(MODKEY_Center);
+ SetResizeAtCenter(MODKEY_Center);
+ SetCrookAtCenter(MODKEY_Center);
+#endif
+ if (bMouseLeft && bMouseDown && rVEvt.bIsTextEdit && (eHit==SDRHIT_UNMARKEDOBJECT || eHit==SDRHIT_NONE)) {
+ SdrEndTextEdit(); // Danebengeklickt, Ende mit Edit
+ // pHdl ist dann ungueltig. Sollte aber egal sein, wein pHdl==NULL
+ // sein muesste (wg. eHit).
+ }
+ switch (rVEvt.eEvent) {
+ case SDREVENT_NONE: bRet=sal_False; break;
+ case SDREVENT_TEXTEDIT: bRet=sal_False; break; // Events an die OutlinerView werden hier nicht beruecksichtigt
+ case SDREVENT_MOVACTION: MovAction(aLogicPos); bRet=sal_True; break;
+ case SDREVENT_ENDACTION: EndAction(); bRet=sal_True; break;
+ case SDREVENT_BCKACTION: BckAction(); bRet=sal_True; break;
+ case SDREVENT_BRKACTION: BrkAction(); bRet=sal_True; break;
+ case SDREVENT_ENDMARK : EndAction(); bRet=sal_True; break;
+ case SDREVENT_BRKMARK : {
+ BrkAction();
+ if (!MarkObj(aLogicPos,nHitTolLog,rVEvt.bAddMark)) {
+ // Kein Obj getroffen. Dann werden zuerst
+ // - Markierte Klebepunkte deselektiert
+ // - dann ggf. selektierte Polygonpunkte
+ // - und ansonsten Objekte
+ if (!rVEvt.bAddMark) UnmarkAll();
+ }
+ bRet=sal_True;
+ } break;
+ case SDREVENT_ENDCREATE: { // ggf. MarkObj
+ SdrCreateCmd eCmd=SDRCREATE_NEXTPOINT;
+ if (MODKEY_PolyPoly) eCmd=SDRCREATE_NEXTOBJECT;
+ if (rVEvt.nMouseClicks>1) eCmd=SDRCREATE_FORCEEND;
+ if (!EndCreateObj(eCmd)) { // Event fuer Create nicht ausgewerten? -> Markieren
+ if (eHit==SDRHIT_UNMARKEDOBJECT || eHit==SDRHIT_TEXTEDIT) {
+ MarkObj(rVEvt.pRootObj,rVEvt.pPV);
+ if (eHit==SDRHIT_TEXTEDIT)
+ {
+ sal_Bool bRet2(pActualOutDev && OUTDEV_WINDOW == pActualOutDev->GetOutDevType() &&
+ SdrBeginTextEdit(rVEvt.pObj, rVEvt.pPV, (Window*)pActualOutDev, sal_False, (SdrOutliner*)0L));
+
+ if(bRet2)
+ {
+ MouseEvent aMEvt(pActualOutDev->LogicToPixel(aLogicPos),
+ 1,rVEvt.nMouseMode,rVEvt.nMouseCode,rVEvt.nMouseCode);
+
+ OutlinerView* pOLV=GetTextEditOutlinerView();
+ if (pOLV!=NULL) {
+ pOLV->MouseButtonDown(aMEvt); // Event an den Outliner, aber ohne Doppelklick
+ pOLV->MouseButtonUp(aMEvt); // Event an den Outliner, aber ohne Doppelklick
+ }
+ }
+ }
+ bRet=sal_True; // Obj markiert und ggf. TextEdit gestartet
+ } else bRet=sal_False; // Create abgebrochen, sonst nix weiter.
+ } else bRet=sal_True; // EndCreate mit sal_True returniert
+ } break;
+ case SDREVENT_ENDDRAG: {
+ bRet=EndDragObj(IsDragWithCopy());
+ ForceMarkedObjToAnotherPage(); // Undo+Klammerung fehlt noch !!!
+ } break;
+ case SDREVENT_MARKOBJ: { // + ggf. BegDrag
+ if (!rVEvt.bAddMark) UnmarkAllObj();
+ sal_Bool bUnmark=rVEvt.bUnmark;
+ if (rVEvt.bPrevNextMark) {
+ bRet=MarkNextObj(aLogicPos,nHitTolLog,rVEvt.bMarkPrev);
+ } else {
+ SortMarkedObjects();
+ sal_uIntPtr nAnz0=GetMarkedObjectCount();
+ bRet=MarkObj(aLogicPos,nHitTolLog,rVEvt.bAddMark);
+ SortMarkedObjects();
+ sal_uIntPtr nAnz1=GetMarkedObjectCount();
+ bUnmark=nAnz1<nAnz0;
+ }
+ if (!bUnmark) {
+ BegDragObj(aLogicPos,NULL,(SdrHdl*)NULL,nMinMovLog);
+ bRet=sal_True;
+ }
+ } break;
+ case SDREVENT_MARKPOINT: { // + ggf. BegDrag
+ if (!rVEvt.bAddMark) UnmarkAllPoints();
+ if (rVEvt.bPrevNextMark) {
+ bRet=MarkNextPoint(aLogicPos,rVEvt.bMarkPrev);
+ } else {
+ bRet=MarkPoint(*rVEvt.pHdl,rVEvt.bUnmark);
+ }
+ if (!rVEvt.bUnmark && !rVEvt.bPrevNextMark) {
+ BegDragObj(aLogicPos,NULL,rVEvt.pHdl,nMinMovLog);
+ bRet=sal_True;
+ }
+ } break;
+ case SDREVENT_MARKGLUEPOINT: { // + ggf. BegDrag
+ if (!rVEvt.bAddMark) UnmarkAllGluePoints();
+ if (rVEvt.bPrevNextMark) {
+ bRet=MarkNextGluePoint(aLogicPos,rVEvt.bMarkPrev);
+ } else {
+ bRet=MarkGluePoint(rVEvt.pObj,rVEvt.nGlueId,rVEvt.pPV,rVEvt.bUnmark);
+ }
+ if (!rVEvt.bUnmark && !rVEvt.bPrevNextMark) {
+ SdrHdl* pHdl=GetGluePointHdl(rVEvt.pObj,rVEvt.nGlueId);
+ BegDragObj(aLogicPos,NULL,pHdl,nMinMovLog);
+ bRet=sal_True;
+ }
+ } break;
+ case SDREVENT_BEGMARK: bRet=BegMark(aLogicPos,rVEvt.bAddMark,rVEvt.bUnmark); break;
+ case SDREVENT_BEGINSOBJPOINT: bRet = BegInsObjPoint(aLogicPos, MODKEY_PolyPoly); break;
+ case SDREVENT_ENDINSOBJPOINT: {
+ SdrCreateCmd eCmd=SDRCREATE_NEXTPOINT;
+ if (MODKEY_PolyPoly) eCmd=SDRCREATE_NEXTOBJECT;
+ if (rVEvt.nMouseClicks>1) eCmd=SDRCREATE_FORCEEND;
+ EndInsObjPoint(eCmd);
+ bRet=sal_True;
+ } break;
+ case SDREVENT_BEGINSGLUEPOINT: bRet=BegInsGluePoint(aLogicPos); break;
+ case SDREVENT_BEGDRAGHELPLINE: bRet=BegDragHelpLine(rVEvt.nHlplIdx,rVEvt.pPV); break;
+ case SDREVENT_BEGDRAGOBJ: bRet=BegDragObj(aLogicPos,NULL,rVEvt.pHdl,nMinMovLog); break;
+ case SDREVENT_BEGCREATEOBJ: {
+ if (nAktInvent==SdrInventor && nAktIdent==OBJ_CAPTION) {
+ long nHgt=SdrEngineDefaults::GetFontHeight();
+ bRet=BegCreateCaptionObj(aLogicPos,Size(5*nHgt,2*nHgt));
+ } else bRet=BegCreateObj(aLogicPos);
+ } break;
+ case SDREVENT_BEGMACROOBJ: bRet=BegMacroObj(aLogicPos,nHitTolLog,rVEvt.pObj,rVEvt.pPV,(Window*)pActualOutDev); break;
+ case SDREVENT_BEGTEXTEDIT: {
+ if (!IsObjMarked(rVEvt.pObj)) {
+ UnmarkAllObj();
+ MarkObj(rVEvt.pRootObj,rVEvt.pPV);
+ }
+
+ bRet = pActualOutDev && OUTDEV_WINDOW == pActualOutDev->GetOutDevType()&&
+ SdrBeginTextEdit(rVEvt.pObj, rVEvt.pPV, (Window*)pActualOutDev, sal_False, (SdrOutliner*)0L);
+
+ if(bRet)
+ {
+ MouseEvent aMEvt(pActualOutDev->LogicToPixel(aLogicPos),
+ 1,rVEvt.nMouseMode,rVEvt.nMouseCode,rVEvt.nMouseCode);
+ OutlinerView* pOLV=GetTextEditOutlinerView();
+ if (pOLV!=NULL) pOLV->MouseButtonDown(aMEvt); // Event an den Outliner, aber ohne Doppelklick
+ }
+ } break;
+ default: break;
+ } // switch
+ if (bRet && pActualOutDev!=NULL && pActualOutDev->GetOutDevType()==OUTDEV_WINDOW) {
+ Window* pWin=(Window*)pActualOutDev;
+ // Maus links gedrueckt?
+ sal_Bool bLeftDown=(rVEvt.nMouseCode&MOUSE_LEFT)!=0 && rVEvt.bMouseDown;
+ // Maus links losgelassen?
+ sal_Bool bLeftUp=(rVEvt.nMouseCode&MOUSE_LEFT)!=0 && rVEvt.bMouseUp;
+ // Maus links gedrueckt oder gehalten?
+ sal_Bool bLeftDown1=(rVEvt.nMouseCode&MOUSE_LEFT)!=0 && !rVEvt.bMouseUp;
+ pWin->SetPointer(GetPreferedPointer(rVEvt.aLogicPos,pWin,
+ rVEvt.nMouseCode & (KEY_SHIFT|KEY_MOD1|KEY_MOD2),bLeftDown1));
+ sal_Bool bAction=IsAction();
+ if (bLeftDown && bAction) pWin->CaptureMouse();
+ else if (bLeftUp || (rVEvt.bIsAction && !bAction)) pWin->ReleaseMouse();
+ }
+ return bRet;
+}
+#include <editeng/outlobj.hxx>
+
+Pointer SdrView::GetPreferedPointer(const Point& rMousePos, const OutputDevice* pOut, sal_uInt16 nModifier, sal_Bool bLeftDown) const
+{
+ // Actions
+ if (IsCreateObj())
+ {
+ return pAktCreate->GetCreatePointer();
+ }
+ if (mpCurrentSdrDragMethod)
+ {
+ if ((IsDraggingPoints() || IsDraggingGluePoints()) && IsMouseHideWhileDraggingPoints())
+ return Pointer(POINTER_NULL);
+
+ return mpCurrentSdrDragMethod->GetSdrDragPointer();
+ }
+ if (IsMarkObj() || IsMarkPoints() || IsMarkGluePoints() || IsEncirclement() || IsSetPageOrg()) return Pointer(POINTER_ARROW);
+ if (IsDragHelpLine()) return GetDraggedHelpLinePointer();
+ if (IsMacroObj()) {
+ SdrObjMacroHitRec aHitRec;
+ aHitRec.aPos=pOut->LogicToPixel(rMousePos);
+ aHitRec.aDownPos=aMacroDownPos;
+ aHitRec.nTol=nMacroTol;
+ aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
+ aHitRec.pPageView=pMacroPV;
+ aHitRec.pOut=pMacroWin;
+ aHitRec.bDown=bMacroDown;
+ return pMacroObj->GetMacroPointer(aHitRec);
+ }
+ //sal_uInt16 nTol=nHitTolLog;
+ // TextEdit, ObjEdit, Macro
+ if (IsTextEdit() && (IsTextEditInSelectionMode() || IsTextEditHit(rMousePos,0/*nTol*/)))
+ {
+ if(!pOut || IsTextEditInSelectionMode())
+ {
+ if(pTextEditOutliner->IsVertical())
+ return Pointer(POINTER_TEXT_VERTICAL);
+ else
+ return Pointer(POINTER_TEXT);
+ }
+ // hier muss besser der Outliner was liefern:
+ Point aPos(pOut->LogicToPixel(rMousePos));
+ Pointer aPointer(pTextEditOutlinerView->GetPointer(aPos));
+ if (aPointer==POINTER_ARROW)
+ {
+ if(pTextEditOutliner->IsVertical())
+ aPointer = POINTER_TEXT_VERTICAL;
+ else
+ aPointer = POINTER_TEXT;
+ }
+ return aPointer;
+ }
+
+ SdrViewEvent aVEvt;
+ aVEvt.nMouseCode=(nModifier&(KEY_SHIFT|KEY_MOD1|KEY_MOD2))|MOUSE_LEFT; // um zu sehen, was bei MouseLeftDown passieren wuerde
+ aVEvt.bMouseDown=!bLeftDown; // Was waere wenn ...
+ aVEvt.bMouseUp=bLeftDown; // Was waere wenn ...
+ if (pOut!=NULL)
+ ((SdrView*)this)->SetActualWin(pOut);
+ SdrHitKind eHit=PickAnything(rMousePos,aVEvt);
+ SdrEventKind eEvent=aVEvt.eEvent;
+ switch (eEvent)
+ {
+ case SDREVENT_BEGCREATEOBJ:
+ return aAktCreatePointer;
+ case SDREVENT_MARKOBJ:
+ case SDREVENT_BEGMARK:
+ return Pointer(POINTER_ARROW);
+ case SDREVENT_MARKPOINT:
+ case SDREVENT_MARKGLUEPOINT:
+ return Pointer(POINTER_MOVEPOINT);
+ case SDREVENT_BEGINSOBJPOINT:
+ case SDREVENT_BEGINSGLUEPOINT:
+ return Pointer(POINTER_CROSS);
+ case SDREVENT_EXECUTEURL:
+ return Pointer(POINTER_REFHAND);
+ case SDREVENT_BEGMACROOBJ:
+ {
+ SdrObjMacroHitRec aHitRec;
+ aHitRec.aPos=aVEvt.aLogicPos;
+ aHitRec.aDownPos=aHitRec.aPos;
+ aHitRec.nTol=nHitTolLog;
+ aHitRec.pVisiLayer=&aVEvt.pPV->GetVisibleLayers();
+ aHitRec.pPageView=aVEvt.pPV;
+ aHitRec.pOut=(OutputDevice*)pOut;
+ return aVEvt.pObj->GetMacroPointer(aHitRec);
+ }
+ default: break;
+ } // switch
+
+ switch(eHit)
+ {
+ case SDRHIT_CELL:
+ return Pointer(POINTER_ARROW);
+ case SDRHIT_HELPLINE :
+ return aVEvt.pPV->GetHelpLines()[aVEvt.nHlplIdx].GetPointer();
+ case SDRHIT_GLUEPOINT:
+ return Pointer(POINTER_MOVEPOINT);
+ case SDRHIT_TEXTEDIT :
+ case SDRHIT_TEXTEDITOBJ:
+ {
+ SdrTextObj* pText = dynamic_cast< SdrTextObj* >( aVEvt.pObj );
+ if(pText && pText->HasText())
+ {
+ OutlinerParaObject* pParaObj = pText->GetOutlinerParaObject();
+ if(pParaObj && pParaObj->IsVertical())
+ return Pointer(POINTER_TEXT_VERTICAL);
+ }
+ return Pointer(POINTER_TEXT);
+ }
+ default: break;
+ }
+
+ sal_Bool bMarkHit=eHit==SDRHIT_MARKEDOBJECT;
+ SdrHdl* pHdl=aVEvt.pHdl;
+ // Nun die Pointer fuer Dragging checken
+ if (pHdl!=NULL || bMarkHit) {
+ SdrHdlKind eHdl= pHdl!=NULL ? pHdl->GetKind() : HDL_MOVE;
+ sal_Bool bCorner=pHdl!=NULL && pHdl->IsCornerHdl();
+ sal_Bool bVertex=pHdl!=NULL && pHdl->IsVertexHdl();
+ sal_Bool bMov=eHdl==HDL_MOVE;
+ if (bMov && (eDragMode==SDRDRAG_MOVE || eDragMode==SDRDRAG_RESIZE || bMarkedHitMovesAlways)) {
+ if (!IsMoveAllowed()) return Pointer(POINTER_ARROW); // weil Doppelklick oder Drag&Drop moeglich
+ return Pointer(POINTER_MOVE);
+ }
+ switch (eDragMode) {
+ case SDRDRAG_ROTATE: {
+ if ((bCorner || bMov) && !IsRotateAllowed(sal_True))
+ return Pointer(POINTER_NOTALLOWED);
+
+ // Sind 3D-Objekte selektiert?
+ sal_Bool b3DObjSelected = sal_False;
+#ifndef SVX_LIGHT
+ for (sal_uInt32 a=0; !b3DObjSelected && a<GetMarkedObjectCount(); a++) {
+ SdrObject* pObj = GetMarkedObjectByIndex(a);
+ if(pObj && pObj->ISA(E3dObject))
+ b3DObjSelected = sal_True;
+ }
+#endif
+ // Falls es um ein 3D-Objekt geht, muss trotz !IsShearAllowed
+ // weitergemacht werden, da es sich um eine Rotation statt um
+ // einen Shear handelt
+ if (bVertex && !IsShearAllowed() && !b3DObjSelected)
+ return Pointer(POINTER_NOTALLOWED);
+ if (bMov)
+ return Pointer(POINTER_ROTATE);
+ } break;
+ case SDRDRAG_SHEAR: case SDRDRAG_DISTORT: {
+ if (bCorner) {
+ if (!IsDistortAllowed(sal_True) && !IsDistortAllowed(sal_False)) return Pointer(POINTER_NOTALLOWED);
+ else return Pointer(POINTER_REFHAND);
+ }
+ if (bVertex && !IsShearAllowed()) return Pointer(POINTER_NOTALLOWED);
+ if (bMov) {
+ if (!IsMoveAllowed()) return Pointer(POINTER_ARROW); // weil Doppelklick oder Drag&Drop moeglich
+ return Pointer(POINTER_MOVE);
+ }
+ } break;
+ case SDRDRAG_MIRROR: {
+ if (bCorner || bVertex || bMov) {
+ SdrHdl* pH1=aHdl.GetHdl(HDL_REF1);
+ SdrHdl* pH2=aHdl.GetHdl(HDL_REF2);
+ sal_Bool b90=sal_False;
+ sal_Bool b45=sal_False;
+ Point aDif;
+ if (pH1!=NULL && pH2!=NULL) {
+ aDif=pH2->GetPos()-pH1->GetPos();
+ b90=(aDif.X()==0) || aDif.Y()==0;
+ b45=b90 || (Abs(aDif.X())==Abs(aDif.Y()));
+ }
+ sal_Bool bNo=sal_False;
+ if (!IsMirrorAllowed(sal_True,sal_True)) bNo=sal_True; // Spiegeln ueberhaupt nicht erlaubt
+ if (!IsMirrorAllowed(sal_False,sal_False) && !b45) bNo=sal_True; // freies Spiegeln nicht erlaubt
+ if (!IsMirrorAllowed(sal_True,sal_False) && !b90) bNo=sal_True; // Spiegeln hor/ver erlaubt
+ if (bNo) return Pointer(POINTER_NOTALLOWED);
+ if (b90) {
+ return Pointer(POINTER_MIRROR);
+ }
+ return Pointer(POINTER_MIRROR);
+ }
+ } break;
+
+ case SDRDRAG_TRANSPARENCE:
+ {
+ if(!IsTransparenceAllowed())
+ return Pointer(POINTER_NOTALLOWED);
+
+ return Pointer(POINTER_REFHAND);
+ }
+
+ case SDRDRAG_GRADIENT:
+ {
+ if(!IsGradientAllowed())
+ return Pointer(POINTER_NOTALLOWED);
+
+ return Pointer(POINTER_REFHAND);
+ }
+
+ case SDRDRAG_CROOK: {
+ if (bCorner || bVertex || bMov) {
+ if (!IsCrookAllowed(sal_True) && !IsCrookAllowed(sal_False)) return Pointer(POINTER_NOTALLOWED);
+ return Pointer(POINTER_CROOK);
+ }
+ }
+
+ case SDRDRAG_CROP:
+ {
+ return Pointer(POINTER_CROP);
+ }
+
+ default: {
+ if ((bCorner || bVertex) && !IsResizeAllowed(sal_True)) return Pointer(POINTER_NOTALLOWED);
+ }
+ }
+ if (pHdl!=NULL) return pHdl->GetPointer();
+ if (bMov) {
+ if (!IsMoveAllowed()) return Pointer(POINTER_ARROW); // weil Doppelklick oder Drag&Drop moeglich
+ return Pointer(POINTER_MOVE);
+ }
+ }
+ if (eEditMode==SDREDITMODE_CREATE) return aAktCreatePointer;
+ return Pointer(POINTER_ARROW);
+}
+
+XubString SdrView::GetStatusText()
+{
+ XubString aStr;
+ XubString aName;
+
+ aStr.AppendAscii("nix");
+
+ if (pAktCreate!=NULL)
+ {
+ aStr=pAktCreate->getSpecialDragComment(aDragStat);
+
+ if(!aStr.Len())
+ {
+ pAktCreate->TakeObjNameSingul(aName);
+ aStr = ImpGetResStr(STR_ViewCreateObj);
+ }
+ }
+ else if (mpCurrentSdrDragMethod)
+ {
+ if (bInsPolyPoint || IsInsertGluePoint())
+ {
+ aStr=aInsPointUndoStr;
+ }
+ else
+ {
+ if (aDragStat.IsMinMoved())
+ {
+ OSL_TRACE("SdrView::GetStatusText(%lx) %lx\n", this, mpCurrentSdrDragMethod);
+ mpCurrentSdrDragMethod->TakeSdrDragComment(aStr);
+ }
+ }
+ }
+ else if(IsMarkObj())
+ {
+ if(AreObjectsMarked())
+ {
+ aStr = ImpGetResStr(STR_ViewMarkMoreObjs);
+ }
+ else
+ {
+ aStr = ImpGetResStr(STR_ViewMarkObjs);
+ }
+ }
+ else if(IsMarkPoints())
+ {
+ if(HasMarkedPoints())
+ {
+ aStr = ImpGetResStr(STR_ViewMarkMorePoints);
+ }
+ else
+ {
+ aStr = ImpGetResStr(STR_ViewMarkPoints);
+ }
+ } else if (IsMarkGluePoints())
+ {
+ if(HasMarkedGluePoints())
+ {
+ aStr = ImpGetResStr(STR_ViewMarkMoreGluePoints);
+ }
+ else
+ {
+ aStr = ImpGetResStr(STR_ViewMarkGluePoints);
+ }
+ }
+ else if (IsTextEdit() && pTextEditOutlinerView!=NULL) {
+ aStr=ImpGetResStr(STR_ViewTextEdit); // "TextEdit - Zeile y Spalte x";
+ ESelection aSel(pTextEditOutlinerView->GetSelection());
+ long nPar=aSel.nEndPara,nLin=0,nCol=aSel.nEndPos;
+ if (aSel.nEndPara>0) {
+ for (sal_uInt16 nParaNum=0; nParaNum<aSel.nEndPara; nParaNum++) {
+ nLin+=pTextEditOutliner->GetLineCount(nParaNum);
+ }
+ }
+ // Noch 'ne kleine Unschoenheit:
+ // Am Ende einer Zeile eines mehrzeiligen Absatzes wird die Position
+ // der naechsten Zeile des selben Absatzes angezeigt, so es eine solche
+ // gibt.
+ sal_uInt16 nParaLine=0;
+ sal_uIntPtr nParaLineAnz=pTextEditOutliner->GetLineCount(aSel.nEndPara);
+ sal_Bool bBrk=sal_False;
+ while (!bBrk) {
+ sal_uInt16 nLen=pTextEditOutliner->GetLineLen(aSel.nEndPara,nParaLine);
+ sal_Bool bLastLine=(nParaLine==nParaLineAnz-1);
+ if (nCol>nLen || (!bLastLine && nCol==nLen)) {
+ nCol-=nLen;
+ nLin++;
+ nParaLine++;
+ } else bBrk=sal_True;
+ if (nLen==0) bBrk=sal_True; // Sicherheitshalber
+ }
+
+ aStr.SearchAndReplaceAscii("%1", UniString::CreateFromInt32(nPar + 1));
+ aStr.SearchAndReplaceAscii("%2", UniString::CreateFromInt32(nLin + 1));
+ aStr.SearchAndReplaceAscii("%3", UniString::CreateFromInt32(nCol + 1));
+
+#ifdef DBG_UTIL
+ aStr += UniString( RTL_CONSTASCII_USTRINGPARAM( ", Level " ) );
+ aStr += UniString::CreateFromInt32( pTextEditOutliner->GetDepth( aSel.nEndPara ) );
+#endif
+ }
+
+ if(aStr.EqualsAscii("nix"))
+ {
+ if (AreObjectsMarked()) {
+ ImpTakeDescriptionStr(STR_ViewMarked,aStr);
+ if (IsGluePointEditMode()) {
+ if (HasMarkedGluePoints()) {
+ ImpTakeDescriptionStr(STR_ViewMarked,aStr,0,IMPSDR_GLUEPOINTSDESCRIPTION);
+ }
+ } else {
+ if (HasMarkedPoints()) {
+ ImpTakeDescriptionStr(STR_ViewMarked,aStr,0,IMPSDR_POINTSDESCRIPTION);
+ }
+ }
+ } else {
+ aStr.Erase();
+ }
+ }
+ else if(aName.Len())
+ {
+ aStr.SearchAndReplaceAscii("%1", aName);
+ }
+
+ if(aStr.Len())
+ {
+ // ersten Buchstaben gross schreiben
+ String aTmpStr(aStr.Copy(0, 1));
+ aTmpStr.ToUpperAscii();
+ aStr.Replace(0, 1, aTmpStr);
+ }
+ return aStr;
+}
+
+SdrViewContext SdrView::GetContext() const
+{
+ if( IsGluePointEditMode() )
+ return SDRCONTEXT_GLUEPOINTEDIT;
+
+ const sal_uIntPtr nMarkAnz = GetMarkedObjectCount();
+
+ if( HasMarkablePoints() && !IsFrameHandles() )
+ {
+ sal_Bool bPath=sal_True;
+ for( sal_uIntPtr nMarkNum = 0; nMarkNum < nMarkAnz && bPath; nMarkNum++ )
+ if (!GetMarkedObjectByIndex(nMarkNum)->ISA(SdrPathObj))
+ bPath=sal_False;
+
+ if( bPath )
+ return SDRCONTEXT_POINTEDIT;
+ }
+
+ if( GetMarkedObjectCount() )
+ {
+ sal_Bool bGraf = sal_True, bMedia = sal_True, bTable = sal_True;
+
+ for( sal_uIntPtr nMarkNum = 0; nMarkNum < nMarkAnz && ( bGraf || bMedia ); nMarkNum++ )
+ {
+ const SdrObject* pMarkObj = GetMarkedObjectByIndex( nMarkNum );
+ DBG_ASSERT( pMarkObj, "SdrView::GetContext(), null pointer in mark list!" );
+
+ if( !pMarkObj )
+ continue;
+
+ if( !pMarkObj->ISA( SdrGrafObj ) )
+ bGraf = sal_False;
+
+ if( !pMarkObj->ISA( SdrMediaObj ) )
+ bMedia = sal_False;
+
+ if( !pMarkObj->ISA( ::sdr::table::SdrTableObj ) )
+ bTable = sal_False;
+ }
+
+ if( bGraf )
+ return SDRCONTEXT_GRAPHIC;
+ else if( bMedia )
+ return SDRCONTEXT_MEDIA;
+ else if( bTable )
+ return SDRCONTEXT_TABLE;
+ }
+
+ return SDRCONTEXT_STANDARD;
+}
+
+void SdrView::MarkAll()
+{
+ if (IsTextEdit()) {
+ GetTextEditOutlinerView()->SetSelection(ESelection(0,0,0xFFFF,0xFFFF));
+#ifdef DBG_UTIL
+ if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
+#endif
+ } else if (IsGluePointEditMode()) MarkAllGluePoints();
+ else if (HasMarkablePoints()) MarkAllPoints();
+ else MarkAllObj();
+}
+
+void SdrView::UnmarkAll()
+{
+ if (IsTextEdit()) {
+ ESelection eSel=GetTextEditOutlinerView()->GetSelection();
+ eSel.nStartPara=eSel.nEndPara;
+ eSel.nStartPos=eSel.nEndPos;
+ GetTextEditOutlinerView()->SetSelection(eSel);
+#ifdef DBG_UTIL
+ if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
+#endif
+ } else if (HasMarkedGluePoints()) UnmarkAllGluePoints();
+ else if (HasMarkedPoints()) UnmarkAllPoints(); // ! Marked statt Markable !
+ else UnmarkAllObj();
+}
+
+sal_Bool SdrView::IsAllMarked() const
+{
+ if (IsTextEdit()) {
+ return ImpIsTextEditAllSelected();
+ }
+ if (IsGluePointEditMode()) {
+ sal_uIntPtr nAnz=GetMarkableGluePointCount();
+ return nAnz!=0 && nAnz==GetMarkedGluePointCount();
+ }
+ if (HasMarkedPoints()) {
+ sal_uIntPtr nAnz=GetMarkablePointCount();
+ return nAnz!=0 && nAnz==GetMarkedPointCount();
+ }
+ sal_uIntPtr nAnz=GetMarkableObjCount();
+ return nAnz!=0 && nAnz == GetMarkedObjectCount();
+}
+
+sal_Bool SdrView::IsMarkPossible() const
+{
+ if(IsTextEdit())
+ {
+ return SdrTextObj::HasTextImpl( pTextEditOutliner );
+ }
+
+ if(IsGluePointEditMode())
+ {
+ return HasMarkableGluePoints();
+ }
+
+ if(HasMarkedPoints())
+ {
+ return HasMarkablePoints();
+ }
+
+ return HasMarkableObj();
+}
+
+sal_Bool SdrView::IsAllMarkPrevNextPossible() const
+{
+ if (IsTextEdit()) {
+ return sal_False;
+ }
+ if (IsGluePointEditMode()) {
+ return HasMarkableGluePoints();
+ }
+ if (HasMarkedPoints()) {
+ return HasMarkablePoints();
+ }
+ return HasMarkableObj();
+}
+
+sal_Bool SdrView::MarkNext(sal_Bool bPrev)
+{
+ if (IsTextEdit()) {
+ return sal_False;
+ }
+ if (IsGluePointEditMode() && HasMarkedGluePoints()) {
+ return MarkNextGluePoint(bPrev);
+ }
+ if (HasMarkedPoints()) {
+ return MarkNextPoint(bPrev);
+ }
+ return MarkNextObj(bPrev);
+}
+
+sal_Bool SdrView::MarkNext(const Point& rPnt, sal_Bool bPrev)
+{
+ if (IsTextEdit()) {
+ return sal_False;
+ }
+ if (IsGluePointEditMode() && HasMarkedGluePoints()) {
+ //return MarkNextGluePoint(rPnt,bPrev); fehlende Implementation !!!
+ }
+ if (HasMarkedPoints()) {
+ //return MarkNextPoint(rPnt,bPrev); fehlende Implementation !!!
+ }
+ return MarkNextObj(rPnt,-2,bPrev);
+}
+
+const Rectangle& SdrView::GetMarkedRect() const
+{
+ if (IsGluePointEditMode() && HasMarkedGluePoints()) {
+ return GetMarkedGluePointsRect();
+ }
+ if (HasMarkedPoints()) {
+ return GetMarkedPointsRect();
+ }
+ return GetMarkedObjRect();
+}
+
+void SdrView::SetMarkedRect(const Rectangle& rRect)
+{
+ if (IsGluePointEditMode() && HasMarkedGluePoints()) {
+ //SetMarkedGluePointsRect(rRect); fehlende Implementation !!!
+ } else if (HasMarkedPoints()) {
+ //SetMarkedPointsRect(rRect); fehlende Implementation !!!
+ } else SetMarkedObjRect(rRect);
+}
+
+void SdrView::DeleteMarked()
+{
+ if (IsTextEdit())
+ {
+ SdrObjEditView::KeyInput(KeyEvent(0,KeyCode(KEYFUNC_DELETE)),pTextEditWin);
+ }
+ else
+ {
+ if( mxSelectionController.is() && mxSelectionController->DeleteMarked() )
+ {
+ // action already performed by current selection controller, do nothing
+ }
+ else if (IsGluePointEditMode() && HasMarkedGluePoints())
+ {
+ DeleteMarkedGluePoints();
+ }
+ else if (GetContext()==SDRCONTEXT_POINTEDIT && HasMarkedPoints())
+ {
+ DeleteMarkedPoints();
+ }
+ else
+ {
+ DeleteMarkedObj();
+ }
+ }
+}
+
+sal_Bool SdrView::BegMark(const Point& rPnt, sal_Bool bAddMark, sal_Bool bUnmark)
+{
+ if (bUnmark) bAddMark=sal_True;
+ if (IsGluePointEditMode()) {
+ if (!bAddMark) UnmarkAllGluePoints();
+ return BegMarkGluePoints(rPnt,bUnmark);
+ } else if (HasMarkablePoints()) {
+ if (!bAddMark) UnmarkAllPoints();
+ return BegMarkPoints(rPnt,bUnmark);
+ } else {
+ if (!bAddMark) UnmarkAllObj();
+ return BegMarkObj(rPnt,bUnmark);
+ }
+}
+
+sal_Bool SdrView::IsDeleteMarkedPossible() const
+{
+ if (IsReadOnly()) return sal_False;
+ if (IsTextEdit()) return sal_True;
+ if (IsGluePointEditMode() && HasMarkedGluePoints()) return sal_True;
+ if (HasMarkedPoints()) return sal_True;
+ return IsDeleteMarkedObjPossible();
+}
+
+void SdrView::ConfigurationChanged( ::utl::ConfigurationBroadcaster*p, sal_uInt32 nHint)
+{
+ onAccessibilityOptionsChanged();
+ SdrCreateView::ConfigurationChanged(p, nHint);
+}
+
+SvtAccessibilityOptions& SdrView::getAccessibilityOptions()
+{
+ return maAccessibilityOptions;
+}
+
+/** method is called whenever the global SvtAccessibilityOptions is changed */
+void SdrView::onAccessibilityOptionsChanged()
+{
+}
+
+void SdrView::SetMasterPagePaintCaching(sal_Bool bOn)
+{
+ if(mbMasterPagePaintCaching != bOn)
+ {
+ mbMasterPagePaintCaching = bOn;
+
+ // reset at all SdrPageWindow's
+ SdrPageView* pPageView = GetSdrPageView();
+
+ if(pPageView)
+ {
+ for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
+ {
+ SdrPageWindow* pPageWindow = pPageView->GetPageWindow(b);
+ DBG_ASSERT(pPageWindow, "SdrView::SetMasterPagePaintCaching: Corrupt SdrPageWindow list (!)");
+
+ // force deletion of ObjectContact, so at re-display all VOCs
+ // will be re-created with updated flag setting
+ pPageWindow->ResetObjectContact();
+ }
+
+ // force redraw of this view
+ pPageView->InvalidateAllWin();
+ }
+ }
+}
+// eof
diff --git a/svx/source/svdraw/svdviter.cxx b/svx/source/svdraw/svdviter.cxx
new file mode 100644
index 000000000000..c33b4d8c84b3
--- /dev/null
+++ b/svx/source/svdraw/svdviter.cxx
@@ -0,0 +1,351 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svx/svdviter.hxx"
+#include <svx/svdobj.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdsob.hxx>
+#include <svl/brdcst.hxx>
+#include <svx/sdrpaintwindow.hxx>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void SdrViewIter::ImpInitVars()
+{
+ mnListenerNum = 0L;
+ mnPageViewNum = 0L;
+ mnOutDevNum = 0L;
+ mpAktView = 0L;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrViewIter::SdrViewIter(const SdrModel* pModel)
+{
+ mpModel = pModel;
+ mpPage = 0L;
+ mpObject = 0L;
+ ImpInitVars();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrViewIter::SdrViewIter(const SdrPage* pPage, sal_Bool bNoMasterPage)
+{
+ mpPage = pPage;
+ mpModel = (pPage) ? pPage->GetModel() : 0L;
+ mpObject = 0L;
+ mbNoMasterPage = bNoMasterPage;
+ ImpInitVars();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrViewIter::SdrViewIter(const SdrObject* pObject, sal_Bool bNoMasterPage)
+{
+ mpObject = pObject;
+ mpModel = (pObject) ? pObject->GetModel() : 0L;
+ mpPage = (pObject) ? pObject->GetPage() : 0L;
+ mbNoMasterPage = bNoMasterPage;
+
+ if(!mpModel || !mpPage)
+ {
+ mpModel = 0L;
+ mpPage = 0L;
+ }
+
+ ImpInitVars();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_Bool SdrViewIter::ImpCheckPageView(SdrPageView* pPV) const
+{
+ if(mpPage)
+ {
+ sal_Bool bMaster(mpPage->IsMasterPage());
+ SdrPage* pPg = pPV->GetPage();
+
+ if(pPg == mpPage)
+ {
+ if(mpObject)
+ {
+ // Objekt gewuenscht? Na dann erstmal sehen, ob
+ // das Obj in dieser PageView auch sichtbar ist.
+ SetOfByte aObjLay;
+ mpObject->getMergedHierarchyLayerSet(aObjLay);
+ aObjLay &= pPV->GetVisibleLayers();
+ return !aObjLay.IsEmpty();
+ }
+ else
+ {
+ return sal_True;
+ }
+ }
+ else
+ {
+ if(!mbNoMasterPage && bMaster && (!mpObject || !mpObject->IsNotVisibleAsMaster()))
+ {
+ if(pPg->TRG_HasMasterPage())
+ {
+ SdrPage& rMasterPage = pPg->TRG_GetMasterPage();
+
+ if(&rMasterPage == mpPage)
+ {
+ // Aha, die gewuenschte Page ist also MasterPage in dieser PageView
+ if(mpObject)
+ {
+ // Objekt gewuenscht? Na dann erstmal sehen, ob
+ // das Obj in dieser PageView auch sichtbar ist.
+ SetOfByte aObjLay;
+ mpObject->getMergedHierarchyLayerSet(aObjLay);
+ aObjLay &= pPV->GetVisibleLayers();
+ aObjLay &= pPg->TRG_GetMasterPageVisibleLayers();
+
+ if(!aObjLay.IsEmpty())
+ {
+ return sal_True;
+ } // ansonsten die naechste MasterPage der Page ansehen...
+ }
+ else
+ {
+ return sal_True;
+ }
+ }
+ }
+ }
+
+ // MasterPage nicht erlaubt oder keine passende gefunden
+ return sal_False;
+ }
+ }
+ else
+ {
+ return sal_True;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrView* SdrViewIter::ImpFindView()
+{
+ if(mpModel)
+ {
+ sal_uInt32 nLsAnz(mpModel->GetListenerCount());
+
+ while(mnListenerNum < nLsAnz)
+ {
+ SfxListener* pLs = mpModel->GetListener((sal_uInt16)mnListenerNum);
+ mpAktView = PTR_CAST(SdrView, pLs);
+
+ if(mpAktView)
+ {
+ if(mpPage)
+ {
+ SdrPageView* pPV = mpAktView->GetSdrPageView();
+
+ if(pPV)
+ {
+ if(ImpCheckPageView(pPV))
+ {
+ return mpAktView;
+ }
+ }
+ }
+ else
+ {
+ return mpAktView;
+ }
+ }
+
+ mnListenerNum++;
+ }
+ }
+
+ mpAktView = 0L;
+ return mpAktView;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrPageView* SdrViewIter::ImpFindPageView()
+{
+ if(mpModel)
+ {
+ while(mpAktView)
+ {
+ SdrPageView* pPV = mpAktView->GetSdrPageView();
+
+ if(pPV)
+ {
+ if(mpPage)
+ {
+ if(ImpCheckPageView(pPV))
+ {
+ return pPV;
+ }
+ }
+ else
+ {
+ return pPV;
+ }
+
+ mnPageViewNum++;
+ }
+
+ mnListenerNum++;
+ ImpFindView();
+ }
+ }
+
+ return 0L;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+OutputDevice* SdrViewIter::ImpFindOutDev()
+{
+ while(mpAktView)
+ {
+ const sal_uInt32 nOutDevAnz(mpAktView->PaintWindowCount());
+
+ if(mnOutDevNum < nOutDevAnz)
+ {
+ SdrPaintWindow* pPaintWindow = mpAktView->GetPaintWindow(mnOutDevNum);
+ return &pPaintWindow->GetOutputDevice();
+ }
+
+ mnListenerNum++;
+ ImpFindView();
+ }
+
+ return 0L;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+Window* SdrViewIter::ImpFindWindow()
+{
+ while(mpAktView)
+ {
+ const sal_uInt32 nOutDevAnz(mpAktView->PaintWindowCount());
+
+ while(mnOutDevNum < nOutDevAnz)
+ {
+ SdrPaintWindow* pPaintWindow = mpAktView->GetPaintWindow(mnOutDevNum);
+ OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
+
+ if(OUTDEV_WINDOW == rOutDev.GetOutDevType())
+ {
+ return (Window*)(&rOutDev);
+ }
+
+ mnOutDevNum++;
+ }
+
+ mnListenerNum++;
+ ImpFindView();
+ }
+
+ return 0L;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrView* SdrViewIter::FirstView()
+{
+ ImpInitVars();
+ return ImpFindView();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrView* SdrViewIter::NextView()
+{
+ mnListenerNum++;
+ return ImpFindView();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrPageView* SdrViewIter::FirstPageView()
+{
+ ImpInitVars();
+ ImpFindView();
+ return ImpFindPageView();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrPageView* SdrViewIter::NextPageView()
+{
+ mnPageViewNum++;
+ return ImpFindPageView();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+OutputDevice* SdrViewIter::FirstOutDev()
+{
+ ImpInitVars();
+ ImpFindView();
+ return ImpFindOutDev();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+OutputDevice* SdrViewIter::NextOutDev()
+{
+ mnOutDevNum++;
+ return ImpFindOutDev();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+Window* SdrViewIter::FirstWindow()
+{
+ ImpInitVars();
+ ImpFindView();
+ return ImpFindWindow();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+Window* SdrViewIter::NextWindow()
+{
+ mnOutDevNum++;
+ return ImpFindWindow();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx
new file mode 100644
index 000000000000..dd7275f9cfdc
--- /dev/null
+++ b/svx/source/svdraw/svdxcgv.cxx
@@ -0,0 +1,894 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <vector>
+#include <editeng/editeng.hxx>
+#include "svx/xexch.hxx"
+#include <svx/xflclit.hxx>
+#include <svx/svdxcgv.hxx>
+#include <svx/svdoutl.hxx>
+#include "svx/svditext.hxx"
+#include <svx/svdetc.hxx>
+#include <svx/svdundo.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdoole2.hxx> // fuer kein OLE im SdrClipboardFormat
+#include <svx/svdorect.hxx>
+#include <svx/svdoedge.hxx> // fuer Konnektoren uebers Clipboard
+#include <svx/svdopage.hxx> // fuer Konnektoren uebers Clipboard
+#include <svx/svdpage.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdtrans.hxx> // Fuer GetMapFactor zum umskalieren bei PasteModel
+#include "svx/svdstr.hrc" // Namen aus der Resource
+#include "svx/svdglob.hxx" // StringCache
+#include "svx/xoutbmp.hxx"
+#include <vcl/metaact.hxx>
+#include <svl/poolitem.hxx>
+#include <svl/itempool.hxx>
+#include <tools/bigint.hxx>
+#include <sot/formats.hxx>
+
+// #i13033#
+#include <clonelist.hxx>
+#include <vcl/virdev.hxx>
+
+// b4967543
+#include <svl/style.hxx>
+
+// #i72535#
+#include "fmobj.hxx"
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SdrExchangeView::SdrExchangeView(SdrModel* pModel1, OutputDevice* pOut):
+ SdrObjEditView(pModel1,pOut)
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+Point SdrExchangeView::GetViewCenter(const OutputDevice* pOut) const
+{
+ Point aCenter;
+ if (pOut==NULL)
+ {
+ pOut = GetFirstOutputDevice();
+ }
+ if (pOut!=NULL) {
+ Point aOfs=pOut->GetMapMode().GetOrigin();
+ Size aOutSiz=pOut->GetOutputSize();
+ aOutSiz.Width()/=2;
+ aOutSiz.Height()/=2;
+ aCenter.X()=aOutSiz.Width() -aOfs.X();
+ aCenter.Y()=aOutSiz.Height()-aOfs.Y();
+ }
+ return aCenter;
+}
+
+Point SdrExchangeView::GetPastePos(SdrObjList* pLst, OutputDevice* pOut)
+{
+ Point aP(GetViewCenter(pOut));
+ SdrPage* pPg=NULL;
+ if (pLst!=NULL) pPg=pLst->GetPage();
+ if (pPg!=NULL) {
+ Size aSiz(pPg->GetSize());
+ aP.X()=aSiz.Width()/2;
+ aP.Y()=aSiz.Height()/2;
+ }
+ return aP;
+}
+
+sal_Bool SdrExchangeView::ImpLimitToWorkArea(Point& rPt) const
+{
+ sal_Bool bRet(sal_False);
+
+ if(!aMaxWorkArea.IsEmpty())
+ {
+ if(rPt.X()<aMaxWorkArea.Left())
+ {
+ rPt.X() = aMaxWorkArea.Left();
+ bRet = sal_True;
+ }
+
+ if(rPt.X()>aMaxWorkArea.Right())
+ {
+ rPt.X() = aMaxWorkArea.Right();
+ bRet = sal_True;
+ }
+
+ if(rPt.Y()<aMaxWorkArea.Top())
+ {
+ rPt.Y() = aMaxWorkArea.Top();
+ bRet = sal_True;
+ }
+
+ if(rPt.Y()>aMaxWorkArea.Bottom())
+ {
+ rPt.Y() = aMaxWorkArea.Bottom();
+ bRet = sal_True;
+ }
+ }
+ return bRet;
+}
+
+void SdrExchangeView::ImpGetPasteObjList(Point& /*rPos*/, SdrObjList*& rpLst)
+{
+ if (rpLst==NULL)
+ {
+ SdrPageView* pPV = GetSdrPageView();
+
+ if (pPV!=NULL) {
+ rpLst=pPV->GetObjList();
+ }
+ }
+}
+
+sal_Bool SdrExchangeView::ImpGetPasteLayer(const SdrObjList* pObjList, SdrLayerID& rLayer) const
+{
+ sal_Bool bRet=sal_False;
+ rLayer=0;
+ if (pObjList!=NULL) {
+ const SdrPage* pPg=pObjList->GetPage();
+ if (pPg!=NULL) {
+ rLayer=pPg->GetLayerAdmin().GetLayerID(aAktLayer,sal_True);
+ if (rLayer==SDRLAYER_NOTFOUND) rLayer=0;
+ SdrPageView* pPV = GetSdrPageView();
+ if (pPV!=NULL) {
+ bRet=!pPV->GetLockedLayers().IsSet(rLayer) && pPV->GetVisibleLayers().IsSet(rLayer);
+ }
+ }
+ }
+ return bRet;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+sal_Bool SdrExchangeView::Paste(const GDIMetaFile& rMtf, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions)
+{
+ Point aPos(rPos);
+ ImpGetPasteObjList(aPos,pLst);
+ ImpLimitToWorkArea( aPos );
+ if (pLst==NULL) return sal_False;
+ SdrLayerID nLayer;
+ if (!ImpGetPasteLayer(pLst,nLayer)) return sal_False;
+ sal_Bool bUnmark=(nOptions&(SDRINSERT_DONTMARK|SDRINSERT_ADDMARK))==0 && !IsTextEdit();
+ if (bUnmark) UnmarkAllObj();
+ SdrGrafObj* pObj=new SdrGrafObj(Graphic(rMtf));
+ pObj->SetLayer(nLayer);
+ ImpPasteObject(pObj,*pLst,aPos,rMtf.GetPrefSize(),rMtf.GetPrefMapMode(),nOptions);
+ return sal_True;
+}
+
+sal_Bool SdrExchangeView::Paste(const Bitmap& rBmp, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions)
+{
+ Point aPos(rPos);
+ ImpGetPasteObjList(aPos,pLst);
+ ImpLimitToWorkArea( aPos );
+ if (pLst==NULL) return sal_False;
+ SdrLayerID nLayer;
+ if (!ImpGetPasteLayer(pLst,nLayer)) return sal_False;
+ sal_Bool bUnmark=(nOptions&(SDRINSERT_DONTMARK|SDRINSERT_ADDMARK))==0 && !IsTextEdit();
+ if (bUnmark) UnmarkAllObj();
+ SdrGrafObj* pObj=new SdrGrafObj(Graphic(rBmp));
+ pObj->SetLayer(nLayer);
+ ImpPasteObject(pObj,*pLst,aPos,rBmp.GetSizePixel(),MapMode(MAP_PIXEL),nOptions);
+ return sal_True;
+}
+
+sal_Bool SdrExchangeView::Paste(const XubString& rStr, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions)
+{
+ if(!rStr.Len())
+ return sal_False;
+
+ Point aPos(rPos);
+ ImpGetPasteObjList(aPos,pLst);
+ ImpLimitToWorkArea( aPos );
+ if (pLst==NULL) return sal_False;
+ SdrLayerID nLayer;
+ if (!ImpGetPasteLayer(pLst,nLayer)) return sal_False;
+ sal_Bool bUnmark=(nOptions&(SDRINSERT_DONTMARK|SDRINSERT_ADDMARK))==0 && !IsTextEdit();
+ if (bUnmark) UnmarkAllObj();
+ Rectangle aTextRect(0,0,500,500);
+ SdrPage* pPage=pLst->GetPage();
+ if (pPage!=NULL) {
+ aTextRect.SetSize(pPage->GetSize());
+ }
+ SdrRectObj* pObj=new SdrRectObj(OBJ_TEXT,aTextRect);
+ pObj->SetModel(pMod);
+ pObj->SetLayer(nLayer);
+ pObj->NbcSetText(rStr); // #32424# SetText vor SetAttr, weil SetAttr sonst unwirksam!
+ if (pDefaultStyleSheet!=NULL) pObj->NbcSetStyleSheet(pDefaultStyleSheet, sal_False);
+
+ pObj->SetMergedItemSet(aDefaultAttr);
+
+ SfxItemSet aTempAttr(pMod->GetItemPool()); // Keine Fuellung oder Linie
+ aTempAttr.Put(XLineStyleItem(XLINE_NONE));
+ aTempAttr.Put(XFillStyleItem(XFILL_NONE));
+
+ pObj->SetMergedItemSet(aTempAttr);
+
+ pObj->FitFrameToTextSize();
+ Size aSiz(pObj->GetLogicRect().GetSize());
+ MapUnit eMap=pMod->GetScaleUnit();
+ Fraction aMap=pMod->GetScaleFraction();
+ ImpPasteObject(pObj,*pLst,aPos,aSiz,MapMode(eMap,Point(0,0),aMap,aMap),nOptions);
+ return sal_True;
+}
+
+sal_Bool SdrExchangeView::Paste(SvStream& rInput, const String& rBaseURL, sal_uInt16 eFormat, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions)
+{
+ Point aPos(rPos);
+ ImpGetPasteObjList(aPos,pLst);
+ ImpLimitToWorkArea( aPos );
+ if (pLst==NULL) return sal_False;
+ SdrLayerID nLayer;
+ if (!ImpGetPasteLayer(pLst,nLayer)) return sal_False;
+ sal_Bool bUnmark=(nOptions&(SDRINSERT_DONTMARK|SDRINSERT_ADDMARK))==0 && !IsTextEdit();
+ if (bUnmark) UnmarkAllObj();
+ Rectangle aTextRect(0,0,500,500);
+ SdrPage* pPage=pLst->GetPage();
+ if (pPage!=NULL) {
+ aTextRect.SetSize(pPage->GetSize());
+ }
+ SdrRectObj* pObj=new SdrRectObj(OBJ_TEXT,aTextRect);
+ pObj->SetModel(pMod);
+ pObj->SetLayer(nLayer);
+ if (pDefaultStyleSheet!=NULL) pObj->NbcSetStyleSheet(pDefaultStyleSheet, sal_False);
+
+ pObj->SetMergedItemSet(aDefaultAttr);
+
+ SfxItemSet aTempAttr(pMod->GetItemPool()); // Keine Fuellung oder Linie
+ aTempAttr.Put(XLineStyleItem(XLINE_NONE));
+ aTempAttr.Put(XFillStyleItem(XFILL_NONE));
+
+ pObj->SetMergedItemSet(aTempAttr);
+
+ pObj->NbcSetText(rInput,rBaseURL,eFormat);
+ pObj->FitFrameToTextSize();
+ Size aSiz(pObj->GetLogicRect().GetSize());
+ MapUnit eMap=pMod->GetScaleUnit();
+ Fraction aMap=pMod->GetScaleFraction();
+ ImpPasteObject(pObj,*pLst,aPos,aSiz,MapMode(eMap,Point(0,0),aMap,aMap),nOptions);
+
+ // b4967543
+ if(pObj && pObj->GetModel() && pObj->GetOutlinerParaObject())
+ {
+ SdrOutliner& rOutliner = pObj->GetModel()->GetHitTestOutliner();
+ rOutliner.SetText(*pObj->GetOutlinerParaObject());
+
+ if(1L == rOutliner.GetParagraphCount())
+ {
+ SfxStyleSheet* pCandidate = rOutliner.GetStyleSheet(0L);
+
+ if(pCandidate)
+ {
+ if(pObj->GetModel()->GetStyleSheetPool() == &pCandidate->GetPool())
+ {
+ pObj->NbcSetStyleSheet(pCandidate, sal_True);
+ }
+ }
+ }
+ }
+
+ return sal_True;
+}
+
+sal_Bool SdrExchangeView::Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, sal_uInt32 nOptions)
+{
+ const SdrModel* pSrcMod=&rMod;
+ if (pSrcMod==pMod)
+ return sal_False; // na so geht's ja nun nicht
+
+ const bool bUndo = IsUndoEnabled();
+
+ if( bUndo )
+ BegUndo(ImpGetResStr(STR_ExchangePaste));
+
+ if( mxSelectionController.is() && mxSelectionController->PasteObjModel( rMod ) )
+ {
+ if( bUndo )
+ EndUndo();
+ return sal_True;
+ }
+
+ Point aPos(rPos);
+ ImpGetPasteObjList(aPos,pLst);
+ SdrPageView* pMarkPV=NULL;
+ SdrPageView* pPV = GetSdrPageView();
+
+ if(pPV)
+ {
+ if ( pPV->GetObjList() == pLst )
+ pMarkPV=pPV;
+ }
+
+ ImpLimitToWorkArea( aPos );
+ if (pLst==NULL)
+ return sal_False;
+
+ sal_Bool bUnmark=(nOptions&(SDRINSERT_DONTMARK|SDRINSERT_ADDMARK))==0 && !IsTextEdit();
+ if (bUnmark)
+ UnmarkAllObj();
+
+ // evtl. umskalieren bei unterschiedlicher MapUnit am Model
+ // Dafuer erstmal die Faktoren berechnen
+ MapUnit eSrcUnit=pSrcMod->GetScaleUnit();
+ MapUnit eDstUnit=pMod->GetScaleUnit();
+ sal_Bool bResize=eSrcUnit!=eDstUnit;
+ Fraction xResize,yResize;
+ Point aPt0;
+ if (bResize)
+ {
+ FrPair aResize(GetMapFactor(eSrcUnit,eDstUnit));
+ xResize=aResize.X();
+ yResize=aResize.Y();
+ }
+ SdrObjList* pDstLst=pLst;
+ sal_uInt16 nPg,nPgAnz=pSrcMod->GetPageCount();
+ for (nPg=0; nPg<nPgAnz; nPg++)
+ {
+ const SdrPage* pSrcPg=pSrcMod->GetPage(nPg);
+
+ // #104148# Use SnapRect, not BoundRect here
+ Rectangle aR=pSrcPg->GetAllObjSnapRect();
+
+ if (bResize)
+ ResizeRect(aR,aPt0,xResize,yResize);
+ Point aDist(aPos-aR.Center());
+ Size aSiz(aDist.X(),aDist.Y());
+ //sal_uIntPtr nDstObjAnz0=pDstLst->GetObjCount();
+ sal_uIntPtr nCloneErrCnt=0;
+ sal_uIntPtr nOb,nObAnz=pSrcPg->GetObjCount();
+ sal_Bool bMark=pMarkPV!=NULL && !IsTextEdit() && (nOptions&SDRINSERT_DONTMARK)==0;
+
+ // #i13033#
+ // New mechanism to re-create the connections of cloned connectors
+ CloneList aCloneList;
+
+ for (nOb=0; nOb<nObAnz; nOb++)
+ {
+ const SdrObject* pSrcOb=pSrcPg->GetObj(nOb);
+
+ // #116235#
+ SdrObject* pNeuObj = pSrcOb->Clone();
+
+ if (pNeuObj!=NULL)
+ {
+ if(bResize)
+ {
+ pNeuObj->GetModel()->SetPasteResize(sal_True); // #51139#
+ pNeuObj->NbcResize(aPt0,xResize,yResize);
+ pNeuObj->GetModel()->SetPasteResize(sal_False); // #51139#
+ }
+
+ // #i39861#
+ pNeuObj->SetModel(pDstLst->GetModel());
+ pNeuObj->SetPage(pDstLst->GetPage());
+
+ pNeuObj->NbcMove(aSiz);
+
+ const SdrPage* pPg = pDstLst->GetPage();
+
+ if(pPg)
+ {
+ // #i72535#
+ const SdrLayerAdmin& rAd = pPg->GetLayerAdmin();
+ SdrLayerID nLayer(0);
+
+ if(pNeuObj->ISA(FmFormObj))
+ {
+ // for FormControls, force to form layer
+ nLayer = rAd.GetLayerID(rAd.GetControlLayerName(), true);
+ }
+ else
+ {
+ nLayer = rAd.GetLayerID(aAktLayer, sal_True);
+ }
+
+ if(SDRLAYER_NOTFOUND == nLayer)
+ {
+ nLayer = 0;
+ }
+
+ pNeuObj->SetLayer(nLayer);
+ }
+
+ SdrInsertReason aReason(SDRREASON_VIEWCALL);
+ pDstLst->InsertObject(pNeuObj,CONTAINER_APPEND,&aReason);
+
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pNeuObj));
+
+ if (bMark) {
+ // Markhandles noch nicht sofort setzen!
+ // Das erledigt das ModelHasChanged der MarkView.
+ MarkObj(pNeuObj,pMarkPV,sal_False,sal_True);
+ }
+
+ // #i13033#
+ aCloneList.AddPair(pSrcOb, pNeuObj);
+ }
+ else
+ {
+ nCloneErrCnt++;
+ }
+ }
+
+ // #i13033#
+ // New mechanism to re-create the connections of cloned connectors
+ aCloneList.CopyConnections();
+
+ if(0L != nCloneErrCnt)
+ {
+#ifdef DBG_UTIL
+ ByteString aStr("SdrExchangeView::Paste(): Fehler beim Clonen ");
+
+ if(nCloneErrCnt == 1)
+ {
+ aStr += "eines Zeichenobjekts.";
+ }
+ else
+ {
+ aStr += "von ";
+ aStr += ByteString::CreateFromInt32( nCloneErrCnt );
+ aStr += " Zeichenobjekten.";
+ }
+
+ aStr += " Objektverbindungen werden nicht mitkopiert.";
+
+ DBG_ERROR(aStr.GetBuffer());
+#endif
+ }
+ }
+
+ if( bUndo )
+ EndUndo();
+
+ return sal_True;
+}
+
+sal_Bool SdrExchangeView::IsExchangeFormatSupported(sal_uIntPtr nFormat) const
+{
+ return( FORMAT_PRIVATE == nFormat ||
+ FORMAT_GDIMETAFILE == nFormat ||
+ FORMAT_BITMAP == nFormat ||
+ FORMAT_RTF == nFormat ||
+ FORMAT_STRING == nFormat ||
+ SOT_FORMATSTR_ID_DRAWING == nFormat ||
+ SOT_FORMATSTR_ID_EDITENGINE == nFormat );
+}
+
+void SdrExchangeView::ImpPasteObject(SdrObject* pObj, SdrObjList& rLst, const Point& rCenter, const Size& rSiz, const MapMode& rMap, sal_uInt32 nOptions)
+{
+ BigInt nSizX(rSiz.Width());
+ BigInt nSizY(rSiz.Height());
+ MapUnit eSrcMU=rMap.GetMapUnit();
+ MapUnit eDstMU=pMod->GetScaleUnit();
+ FrPair aMapFact(GetMapFactor(eSrcMU,eDstMU));
+ Fraction aDstFr(pMod->GetScaleFraction());
+ nSizX*=aMapFact.X().GetNumerator();
+ nSizX*=rMap.GetScaleX().GetNumerator();
+ nSizX*=aDstFr.GetDenominator();
+ nSizX/=aMapFact.X().GetDenominator();
+ nSizX/=rMap.GetScaleX().GetDenominator();
+ nSizX/=aDstFr.GetNumerator();
+ nSizY*=aMapFact.Y().GetNumerator();
+ nSizY*=rMap.GetScaleY().GetNumerator();
+ nSizX*=aDstFr.GetDenominator();
+ nSizY/=aMapFact.Y().GetDenominator();
+ nSizY/=rMap.GetScaleY().GetDenominator();
+ nSizY/=aDstFr.GetNumerator();
+ long xs=nSizX;
+ long ys=nSizY;
+ Point aPos(rCenter.X()-xs/2,rCenter.Y()-ys/2);
+ Rectangle aR(aPos.X(),aPos.Y(),aPos.X()+xs,aPos.Y()+ys);
+ pObj->SetLogicRect(aR);
+ SdrInsertReason aReason(SDRREASON_VIEWCALL);
+ rLst.InsertObject(pObj,CONTAINER_APPEND,&aReason);
+
+ if( IsUndoEnabled() )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pObj));
+
+ SdrPageView* pMarkPV=NULL;
+ SdrPageView* pPV = GetSdrPageView();
+
+ if(pPV)
+ {
+ if (pPV->GetObjList()==&rLst)
+ pMarkPV=pPV;
+ }
+
+ sal_Bool bMark=pMarkPV!=NULL && !IsTextEdit() && (nOptions&SDRINSERT_DONTMARK)==0;
+ if (bMark)
+ { // Obj in der ersten gefundenen PageView markieren
+ MarkObj(pObj,pMarkPV);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+Bitmap SdrExchangeView::GetMarkedObjBitmap( sal_Bool bNoVDevIfOneBmpMarked ) const
+{
+ Bitmap aBmp;
+
+ if( AreObjectsMarked() )
+ {
+ if( bNoVDevIfOneBmpMarked )
+ {
+ SdrObject* pGrafObjTmp = GetMarkedObjectByIndex( 0 );
+ SdrGrafObj* pGrafObj = ( GetMarkedObjectCount() == 1 ) ? PTR_CAST( SdrGrafObj, pGrafObjTmp ) : NULL;
+
+ if( pGrafObj && ( pGrafObj->GetGraphicType() == GRAPHIC_BITMAP ) )
+ aBmp = pGrafObj->GetTransformedGraphic().GetBitmap();
+ }
+
+ if( !aBmp )
+ {
+ const Graphic aGraphic( GetMarkedObjMetaFile( bNoVDevIfOneBmpMarked ) );
+
+ // #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);
+ }
+ }
+
+ return aBmp;
+}
+
+// -----------------------------------------------------------------------------
+
+GDIMetaFile SdrExchangeView::GetMarkedObjMetaFile( sal_Bool bNoVDevIfOneMtfMarked ) const
+{
+ GDIMetaFile aMtf;
+
+ if( AreObjectsMarked() )
+ {
+ Rectangle aBound( GetMarkedObjBoundRect() );
+ Size aBoundSize( aBound.GetWidth(), aBound.GetHeight() );
+ MapMode aMap( pMod->GetScaleUnit(), Point(), pMod->GetScaleFraction(), pMod->GetScaleFraction() );
+
+ if( bNoVDevIfOneMtfMarked )
+ {
+ SdrObject* pGrafObjTmp = GetMarkedObjectByIndex( 0 );
+ SdrGrafObj* pGrafObj = ( GetMarkedObjectCount() ==1 ) ? PTR_CAST( SdrGrafObj, pGrafObjTmp ) : NULL;
+
+ if( pGrafObj )
+ {
+ Graphic aGraphic( pGrafObj->GetTransformedGraphic() );
+
+ if( aGraphic.GetType() == GRAPHIC_BITMAP )
+ {
+ const Point aPos;
+
+ aMtf.AddAction( new MetaBmpExScaleAction( aPos, aBoundSize, aGraphic.GetBitmapEx() ) );
+ aMtf.SetPrefMapMode( aMap );
+ aMtf.SetPrefSize( aBoundSize );
+ }
+ else
+ aMtf = aGraphic.GetGDIMetaFile();
+ }
+ }
+
+ if( !aMtf.GetActionCount() )
+ {
+ VirtualDevice aOut;
+ Size aDummySize( 2, 2 );
+
+ aOut.SetOutputSizePixel( aDummySize );
+ aOut.EnableOutput( sal_False );
+ aOut.SetMapMode( aMap );
+
+ aMtf.Clear();
+ aMtf.Record( &aOut );
+
+ // Replace offset given formally to DrawMarkedObj and used at XOutDev with relative
+ // MapMode (which was also used in XOutDev in that case). Goal is to paint the object
+ // as if TopLeft point is (0,0)
+ const Fraction aNeutralFraction(1, 1);
+ const MapMode aRelativeMapMode(MAP_RELATIVE, Point(-aBound.Left(), -aBound.Top()), aNeutralFraction, aNeutralFraction);
+ aOut.SetMapMode(aRelativeMapMode);
+
+ DrawMarkedObj(aOut);
+
+ aMtf.Stop();
+ aMtf.WindStart();
+ aMtf.SetPrefMapMode( aMap );
+
+ // removed PrefSize extension. It is principially wrong to set a reduced size at
+ // the created MetaFile. The mentioned errors occurr at output time since the integer
+ // MapModes from VCL lead to errors. It is now corrected in the VCLRenderer for
+ // primitives (and may later be done in breaking up a MetaFile to primitives)
+ aMtf.SetPrefSize(aBoundSize);
+ }
+ }
+
+ return aMtf;
+}
+
+// -----------------------------------------------------------------------------
+
+Graphic SdrExchangeView::GetAllMarkedGraphic() const
+{
+ Graphic aRet;
+
+ if( AreObjectsMarked() )
+ {
+ if( ( 1 == GetMarkedObjectCount() ) && GetSdrMarkByIndex( 0 ) )
+ aRet = SdrExchangeView::GetObjGraphic( pMod, GetMarkedObjectByIndex( 0 ) );
+ else
+ aRet = GetMarkedObjMetaFile( sal_False );
+ }
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+Graphic SdrExchangeView::GetObjGraphic( const SdrModel* pModel, const SdrObject* pObj )
+{
+ Graphic aRet;
+
+ if( pModel && pObj )
+ {
+ // try to get a graphic from the object first
+ const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(pObj);
+ const SdrOle2Obj* pSdrOle2Obj = dynamic_cast< const SdrOle2Obj* >(pObj);
+
+ if(pSdrGrafObj)
+ {
+ // #110981# Make behaviour coherent with metafile
+ // recording below (which of course also takes
+ // view-transformed objects)
+ aRet = pSdrGrafObj->GetTransformedGraphic();
+ }
+ else if(pSdrOle2Obj)
+ {
+ if ( pSdrOle2Obj->GetGraphic() )
+ aRet = *pSdrOle2Obj->GetGraphic();
+ }
+
+ // if graphic could not be retrieved => go the hard way and create a MetaFile
+ if( ( GRAPHIC_NONE == aRet.GetType() ) || ( GRAPHIC_DEFAULT == aRet.GetType() ) )
+ {
+ VirtualDevice aOut;
+ GDIMetaFile aMtf;
+ const Rectangle aBoundRect( pObj->GetCurrentBoundRect() );
+ const MapMode aMap( pModel->GetScaleUnit(),
+ Point(),
+ pModel->GetScaleFraction(),
+ pModel->GetScaleFraction() );
+
+ aOut.EnableOutput( sal_False );
+ aOut.SetMapMode( aMap );
+ aMtf.Record( &aOut );
+ pObj->SingleObjectPainter( aOut ); // #110094#-17
+ aMtf.Stop();
+ aMtf.WindStart();
+
+ // #i99268# replace the original offset from using XOutDev's SetOffset
+ // NOT (as tried with #i92760#) with another MapMode which gets recorded
+ // by the Metafile itself (what always leads to problems), but by hardly
+ // moving the result
+ aMtf.Move(-aBoundRect.Left(), -aBoundRect.Top());
+
+ aMtf.SetPrefMapMode( aMap );
+ aMtf.SetPrefSize( aBoundRect.GetSize() );
+
+ if( aMtf.GetActionCount() )
+ aRet = aMtf;
+ }
+ }
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrExchangeView::DrawMarkedObj(OutputDevice& rOut) const
+{
+ SortMarkedObjects();
+
+ ::std::vector< ::std::vector< SdrMark* > > aObjVectors( 2 );
+ ::std::vector< SdrMark* >& rObjVector1 = aObjVectors[ 0 ];
+ ::std::vector< SdrMark* >& rObjVector2 = aObjVectors[ 1 ];
+ const SdrLayerAdmin& rLayerAdmin = pMod->GetLayerAdmin();
+ const sal_uInt32 nControlLayerId = rLayerAdmin.GetLayerID( rLayerAdmin.GetControlLayerName(), sal_False );
+ sal_uInt32 n, nCount;
+
+ for( n = 0, nCount = GetMarkedObjectCount(); n < nCount; n++ )
+ {
+ SdrMark* pMark = GetSdrMarkByIndex( n );
+
+ // paint objects on control layer on top of all otherobjects
+ if( nControlLayerId == pMark->GetMarkedSdrObj()->GetLayer() )
+ rObjVector2.push_back( pMark );
+ else
+ rObjVector1.push_back( pMark );
+ }
+
+ for( n = 0, nCount = aObjVectors.size(); n < nCount; n++ )
+ {
+ ::std::vector< SdrMark* >& rObjVector = aObjVectors[ n ];
+
+ for( sal_uInt32 i = 0; i < rObjVector.size(); i++ )
+ {
+ SdrMark* pMark = rObjVector[ i ];
+ pMark->GetMarkedSdrObj()->SingleObjectPainter( rOut ); // #110094#-17
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+SdrModel* SdrExchangeView::GetMarkedObjModel() const
+{
+ // Wenn das sortieren der MarkList mal stoeren sollte,
+ // werde ich sie mir wohl kopieren muessen.
+ SortMarkedObjects();
+ SdrModel* pNeuMod=pMod->AllocModel();
+ SdrPage* pNeuPag=pNeuMod->AllocPage(sal_False);
+ pNeuMod->InsertPage(pNeuPag);
+
+ if( !mxSelectionController.is() || !mxSelectionController->GetMarkedObjModel( pNeuPag ) )
+ {
+ ::std::vector< ::std::vector< SdrMark* > > aObjVectors( 2 );
+ ::std::vector< SdrMark* >& rObjVector1 = aObjVectors[ 0 ];
+ ::std::vector< SdrMark* >& rObjVector2 = aObjVectors[ 1 ];
+ const SdrLayerAdmin& rLayerAdmin = pMod->GetLayerAdmin();
+ const sal_uInt32 nControlLayerId = rLayerAdmin.GetLayerID( rLayerAdmin.GetControlLayerName(), sal_False );
+ sal_uInt32 n, nCount, nCloneErrCnt = 0;
+
+ for( n = 0, nCount = GetMarkedObjectCount(); n < nCount; n++ )
+ {
+ SdrMark* pMark = GetSdrMarkByIndex( n );
+
+ // paint objects on control layer on top of all otherobjects
+ if( nControlLayerId == pMark->GetMarkedSdrObj()->GetLayer() )
+ rObjVector2.push_back( pMark );
+ else
+ rObjVector1.push_back( pMark );
+ }
+
+ // #i13033#
+ // New mechanism to re-create the connections of cloned connectors
+ CloneList aCloneList;
+
+ for( n = 0, nCount = aObjVectors.size(); n < nCount; n++ )
+ {
+ ::std::vector< SdrMark* >& rObjVector = aObjVectors[ n ];
+
+ for( sal_uInt32 i = 0; i < rObjVector.size(); i++ )
+ {
+ const SdrMark* pMark = rObjVector[ i ];
+ const SdrObject* pObj = pMark->GetMarkedSdrObj();
+ SdrObject* pNeuObj;
+
+ if( pObj->ISA( SdrPageObj ) )
+ {
+ // convert SdrPageObj's to a graphic representation, because
+ // virtual connection to referenced page gets lost in new model
+ pNeuObj = new SdrGrafObj( GetObjGraphic( pMod, pObj ), pObj->GetLogicRect() );
+ pNeuObj->SetPage( pNeuPag );
+ pNeuObj->SetModel( pNeuMod );
+ }
+ else
+ {
+ // #116235#
+ // pNeuObj = pObj->Clone( pNeuPag, pNeuMod );
+ pNeuObj = pObj->Clone();
+ pNeuObj->SetPage( pNeuPag );
+ pNeuObj->SetModel( pNeuMod );
+ }
+
+ if( pNeuObj )
+ {
+ SdrInsertReason aReason(SDRREASON_VIEWCALL);
+ pNeuPag->InsertObject(pNeuObj,CONTAINER_APPEND,&aReason);
+
+ // #i13033#
+ aCloneList.AddPair(pObj, pNeuObj);
+ }
+ else
+ nCloneErrCnt++;
+ }
+ }
+
+ // #i13033#
+ // New mechanism to re-create the connections of cloned connectors
+ aCloneList.CopyConnections();
+
+ if(0L != nCloneErrCnt)
+ {
+#ifdef DBG_UTIL
+ ByteString aStr("SdrExchangeView::GetMarkedObjModel(): Fehler beim Clonen ");
+
+ if(nCloneErrCnt == 1)
+ {
+ aStr += "eines Zeichenobjekts.";
+ }
+ else
+ {
+ aStr += "von ";
+ aStr += ByteString::CreateFromInt32( nCloneErrCnt );
+ aStr += " Zeichenobjekten.";
+ }
+
+ aStr += " Objektverbindungen werden nicht mitkopiert.";
+
+ DBG_ERROR(aStr.GetBuffer());
+#endif
+ }
+ }
+ return pNeuMod;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdrExchangeView::Cut( sal_uIntPtr /*nFormat */)
+{
+ DBG_ERROR( "SdrExchangeView::Cut: Not supported anymore" );
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrExchangeView::CutMarked( sal_uIntPtr /*nFormat */)
+{
+ DBG_ERROR( "SdrExchangeView::CutMarked: Not supported anymore" );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdrExchangeView::Yank(sal_uIntPtr /*nFormat*/)
+{
+ DBG_ERROR( "SdrExchangeView::Yank: Not supported anymore" );
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrExchangeView::YankMarked(sal_uIntPtr /*nFormat*/)
+{
+ DBG_ERROR( "YankMarked: Not supported anymore" );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SdrExchangeView::Paste(Window* /*pWin*/, sal_uIntPtr /*nFormat*/)
+{
+ DBG_ERROR( "SdrExchangeView::Paste: Not supported anymore" );
+ return sal_False;
+}
diff --git a/svx/source/table/accessiblecell.cxx b/svx/source/table/accessiblecell.cxx
new file mode 100644
index 000000000000..ce04c9f6307a
--- /dev/null
+++ b/svx/source/table/accessiblecell.cxx
@@ -0,0 +1,584 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <accessiblecell.hxx>
+
+#include "svx/DescriptionGenerator.hxx"
+
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+
+#include <vcl/svapp.hxx>
+
+#include <unotools/accessiblestatesethelper.hxx>
+
+#include <editeng/outlobj.hxx>
+#include <svx/unoshtxt.hxx>
+#include <svx/svdotext.hxx>
+
+using ::rtl::OUString;
+using namespace ::sdr::table;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+
+namespace accessibility {
+
+// --------------------------------------------------------------------
+// AccessibleCell
+// --------------------------------------------------------------------
+
+AccessibleCell::AccessibleCell( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>& rxParent, const sdr::table::CellRef& rCell, sal_Int32 nIndex, const AccessibleShapeTreeInfo& rShapeTreeInfo )
+: AccessibleCellBase( rxParent, AccessibleRole::TABLE_CELL )
+, maShapeTreeInfo( rShapeTreeInfo )
+, mnIndexInParent( nIndex )
+, mpText( NULL )
+, mxCell( rCell )
+{
+}
+
+// --------------------------------------------------------------------
+
+AccessibleCell::~AccessibleCell (void)
+{
+ DBG_ASSERT( mpText == 0, "svx::AccessibleCell::~AccessibleCell(), not disposed!?" );
+}
+
+// --------------------------------------------------------------------
+
+void AccessibleCell::Init (void)
+{
+ SdrView* pView = maShapeTreeInfo.GetSdrView();
+ const Window* pWindow = maShapeTreeInfo.GetWindow ();
+ if( (pView != NULL) && (pWindow != NULL) && mxCell.is())
+ {
+ OutlinerParaObject* pOutlinerParaObject = mxCell->GetEditOutlinerParaObject(); // Get the OutlinerParaObject if text edit is active
+
+ bool bOwnParaObject = pOutlinerParaObject != 0;
+
+ if( !pOutlinerParaObject )
+ pOutlinerParaObject = mxCell->GetOutlinerParaObject();
+
+ // create AccessibleTextHelper to handle this shape's text
+ if( pOutlinerParaObject )
+ {
+ // non-empty text -> use full-fledged edit source right away
+ ::std::auto_ptr<SvxEditSource> pEditSource( new SvxTextEditSource( mxCell->GetObject(), mxCell.get(), *pView, *pWindow) );
+ mpText = new AccessibleTextHelper( pEditSource );
+ mpText->SetEventSource(this);
+ }
+
+ if( bOwnParaObject)
+ delete pOutlinerParaObject;
+ }
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool AccessibleCell::SetState (sal_Int16 aState)
+{
+ sal_Bool bStateHasChanged = sal_False;
+
+ if (aState == AccessibleStateType::FOCUSED && mpText != NULL)
+ {
+ // Offer FOCUSED state to edit engine and detect whether the state
+ // changes.
+ sal_Bool bIsFocused = mpText->HaveFocus ();
+ mpText->SetFocus (sal_True);
+ bStateHasChanged = (bIsFocused != mpText->HaveFocus ());
+ }
+ else
+ bStateHasChanged = AccessibleContextBase::SetState (aState);
+
+ return bStateHasChanged;
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool AccessibleCell::ResetState (sal_Int16 aState)
+{
+ sal_Bool bStateHasChanged = sal_False;
+
+ if (aState == AccessibleStateType::FOCUSED && mpText != NULL)
+ {
+ // Try to remove FOCUSED state from the edit engine and detect
+ // whether the state changes.
+ sal_Bool bIsFocused = mpText->HaveFocus ();
+ mpText->SetFocus (sal_False);
+ bStateHasChanged = (bIsFocused != mpText->HaveFocus ());
+ }
+ else
+ bStateHasChanged = AccessibleContextBase::ResetState (aState);
+
+ return bStateHasChanged;
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool AccessibleCell::GetState (sal_Int16 aState)
+{
+ if (aState == AccessibleStateType::FOCUSED && mpText != NULL)
+ {
+ // Just delegate the call to the edit engine. The state is not
+ // merged into the state set.
+ return mpText->HaveFocus();
+ }
+ else
+ return AccessibleContextBase::GetState (aState);
+}
+
+//-----------------------------------------------------------------------------
+
+bool AccessibleCell::operator== (const AccessibleCell& rAccessibleCell)
+{
+ return this == &rAccessibleCell;
+}
+
+//-----------------------------------------------------------------------------
+// XInterface
+//-----------------------------------------------------------------------------
+
+Any SAL_CALL AccessibleCell::queryInterface( const Type& aType ) throw (RuntimeException)
+{
+ return AccessibleCellBase::queryInterface( aType );
+}
+
+//-----------------------------------------------------------------------------
+
+void SAL_CALL AccessibleCell::acquire( ) throw ()
+{
+ AccessibleCellBase::acquire();
+}
+
+//-----------------------------------------------------------------------------
+
+void SAL_CALL AccessibleCell::release( ) throw ()
+{
+ AccessibleCellBase::release();
+}
+
+// --------------------------------------------------------------------
+// XAccessibleContext
+// --------------------------------------------------------------------
+
+/** The children of this cell come from the paragraphs of text.
+*/
+sal_Int32 SAL_CALL AccessibleCell::getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ ThrowIfDisposed ();
+ return mpText != NULL ? mpText->GetChildCount () : 0;
+}
+
+// --------------------------------------------------------------------
+
+/** Forward the request to the shape. Return the requested shape or throw
+ an exception for a wrong index.
+*/
+Reference<XAccessible> SAL_CALL AccessibleCell::getAccessibleChild (sal_Int32 nIndex) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ ThrowIfDisposed ();
+
+ // todo: does GetChild throw IndexOutOfBoundsException?
+ return mpText->GetChild (nIndex);
+}
+
+// --------------------------------------------------------------------
+
+/** Return a copy of the state set.
+ Possible states are:
+ ENABLED
+ SHOWING
+ VISIBLE
+*/
+Reference<XAccessibleStateSet> SAL_CALL AccessibleCell::getAccessibleStateSet (void) throw (RuntimeException)
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ ::osl::MutexGuard aGuard (maMutex);
+ Reference<XAccessibleStateSet> xStateSet;
+
+ if (rBHelper.bDisposed || mpText == NULL)
+ {
+ // Return a minimal state set that only contains the DEFUNC state.
+ xStateSet = AccessibleContextBase::getAccessibleStateSet ();
+ }
+ else
+ {
+ ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
+
+ if(pStateSet)
+ {
+ // Merge current FOCUSED state from edit engine.
+ if (mpText != NULL)
+ {
+ if (mpText->HaveFocus())
+ pStateSet->AddState (AccessibleStateType::FOCUSED);
+ else
+ pStateSet->RemoveState (AccessibleStateType::FOCUSED);
+ }
+
+ // Create a copy of the state set that may be modified by the
+ // caller without affecting the current state set.
+ xStateSet = Reference<XAccessibleStateSet>(new ::utl::AccessibleStateSetHelper (*pStateSet));
+ }
+ }
+
+ return xStateSet;
+}
+
+// --------------------------------------------------------------------
+// XAccessibleComponent
+// --------------------------------------------------------------------
+
+sal_Bool SAL_CALL AccessibleCell::containsPoint( const ::com::sun::star::awt::Point& aPoint) throw (::com::sun::star::uno::RuntimeException)
+{
+ return AccessibleComponentBase::containsPoint( aPoint );
+}
+
+/** The implementation below is at the moment straightforward. It iterates
+ over all children (and thereby instances all children which have not
+ been already instatiated) until a child covering the specifed point is
+ found.
+ This leaves room for improvement. For instance, first iterate only over
+ the already instantiated children and only if no match is found
+ instantiate the remaining ones.
+*/
+Reference<XAccessible > SAL_CALL AccessibleCell::getAccessibleAtPoint ( const ::com::sun::star::awt::Point& aPoint) throw(RuntimeException)
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ ::osl::MutexGuard aGuard (maMutex);
+
+ sal_Int32 nChildCount = getAccessibleChildCount ();
+ for (sal_Int32 i=0; i<nChildCount; ++i)
+ {
+ Reference<XAccessible> xChild (getAccessibleChild (i));
+ if (xChild.is())
+ {
+ Reference<XAccessibleComponent> xChildComponent (xChild->getAccessibleContext(), uno::UNO_QUERY);
+ if (xChildComponent.is())
+ {
+ awt::Rectangle aBBox (xChildComponent->getBounds());
+ if ( (aPoint.X >= aBBox.X)
+ && (aPoint.Y >= aBBox.Y)
+ && (aPoint.X < aBBox.X+aBBox.Width)
+ && (aPoint.Y < aBBox.Y+aBBox.Height) )
+ return xChild;
+ }
+ }
+ }
+
+ // Have not found a child under the given point. Returning empty
+ // reference to indicate this.
+ return uno::Reference<XAccessible>();
+}
+
+// --------------------------------------------------------------------
+
+::com::sun::star::awt::Rectangle SAL_CALL AccessibleCell::getBounds(void) throw(RuntimeException)
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ ::osl::MutexGuard aGuard (maMutex);
+
+ ThrowIfDisposed ();
+ ::com::sun::star::awt::Rectangle aBoundingBox;
+ if( mxCell.is() )
+ {
+ // Get the cell's bounding box in internal coordinates (in 100th of mm)
+ const ::Rectangle aCellRect( mxCell->getCellRect() );
+
+ // Transform coordinates from internal to pixel.
+ if (maShapeTreeInfo.GetViewForwarder() == NULL)
+ throw uno::RuntimeException (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleCell has no valid view forwarder")),static_cast<uno::XWeak*>(this));
+
+ ::Size aPixelSize( maShapeTreeInfo.GetViewForwarder()->LogicToPixel(::Size(aCellRect.GetWidth(), aCellRect.GetHeight())) );
+ ::Point aPixelPosition( maShapeTreeInfo.GetViewForwarder()->LogicToPixel( aCellRect.TopLeft() ));
+
+ // Clip the shape's bounding box with the bounding box of its parent.
+ Reference<XAccessibleComponent> xParentComponent ( getAccessibleParent(), uno::UNO_QUERY);
+ if (xParentComponent.is())
+ {
+ // Make the coordinates relative to the parent.
+ awt::Point aParentLocation (xParentComponent->getLocationOnScreen());
+ int x = aPixelPosition.getX() - aParentLocation.X;
+ int y = aPixelPosition.getY() - aParentLocation.Y;
+
+ // Clip with parent (with coordinates relative to itself).
+ ::Rectangle aBBox ( x, y, x + aPixelSize.getWidth(), y + aPixelSize.getHeight());
+ awt::Size aParentSize (xParentComponent->getSize());
+ ::Rectangle aParentBBox (0,0, aParentSize.Width, aParentSize.Height);
+ aBBox = aBBox.GetIntersection (aParentBBox);
+ aBoundingBox = awt::Rectangle ( aBBox.getX(), aBBox.getY(), aBBox.getWidth(), aBBox.getHeight());
+ }
+ else
+ {
+ OSL_TRACE ("parent does not support component");
+ aBoundingBox = awt::Rectangle (aPixelPosition.getX(), aPixelPosition.getY(),aPixelSize.getWidth(), aPixelSize.getHeight());
+ }
+ }
+
+ return aBoundingBox;
+}
+
+// --------------------------------------------------------------------
+
+::com::sun::star::awt::Point SAL_CALL AccessibleCell::getLocation(void) throw (RuntimeException)
+{
+ ThrowIfDisposed ();
+ ::com::sun::star::awt::Rectangle aBoundingBox(getBounds());
+ return ::com::sun::star::awt::Point(aBoundingBox.X, aBoundingBox.Y);
+}
+
+// --------------------------------------------------------------------
+
+::com::sun::star::awt::Point SAL_CALL AccessibleCell::getLocationOnScreen(void) throw(RuntimeException)
+{
+ ThrowIfDisposed ();
+
+ // Get relative position...
+ ::com::sun::star::awt::Point aLocation(getLocation ());
+
+ // ... and add absolute position of the parent.
+ Reference<XAccessibleComponent> xParentComponent( getAccessibleParent(), uno::UNO_QUERY);
+ if(xParentComponent.is())
+ {
+ ::com::sun::star::awt::Point aParentLocation(xParentComponent->getLocationOnScreen());
+ aLocation.X += aParentLocation.X;
+ aLocation.Y += aParentLocation.Y;
+ }
+ else
+ {
+ OSL_TRACE ("getLocation: parent does not support XAccessibleComponent");
+ }
+
+ return aLocation;
+}
+
+// --------------------------------------------------------------------
+
+awt::Size SAL_CALL AccessibleCell::getSize (void) throw (RuntimeException)
+{
+ ThrowIfDisposed ();
+ awt::Rectangle aBoundingBox (getBounds());
+ return awt::Size (aBoundingBox.Width, aBoundingBox.Height);
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL AccessibleCell::addFocusListener ( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener) throw (::com::sun::star::uno::RuntimeException)
+{
+ AccessibleComponentBase::addFocusListener( xListener );
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL AccessibleCell::removeFocusListener (const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
+{
+ AccessibleComponentBase::removeFocusListener( xListener );
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL AccessibleCell::grabFocus (void) throw (::com::sun::star::uno::RuntimeException)
+{
+ AccessibleComponentBase::grabFocus();
+}
+
+// --------------------------------------------------------------------
+
+sal_Int32 SAL_CALL AccessibleCell::getForeground(void) throw (RuntimeException)
+{
+ ThrowIfDisposed ();
+ sal_Int32 nColor (0x0ffffffL);
+
+ // todo
+ return nColor;
+}
+
+// --------------------------------------------------------------------
+
+sal_Int32 SAL_CALL AccessibleCell::getBackground (void) throw (RuntimeException)
+{
+ ThrowIfDisposed ();
+ sal_Int32 nColor (0L);
+
+ // todo
+ return nColor;
+}
+
+// --------------------------------------------------------------------
+// XAccessibleExtendedComponent
+// --------------------------------------------------------------------
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL AccessibleCell::getFont (void) throw (::com::sun::star::uno::RuntimeException)
+{
+//todo
+ return AccessibleComponentBase::getFont();
+}
+
+// --------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL AccessibleCell::getTitledBorderText (void) throw (::com::sun::star::uno::RuntimeException)
+{
+ return AccessibleComponentBase::getTitledBorderText();
+}
+
+// --------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL AccessibleCell::getToolTipText (void) throw (::com::sun::star::uno::RuntimeException)
+{
+ return AccessibleComponentBase::getToolTipText();
+}
+
+// --------------------------------------------------------------------
+// XAccessibleEventBroadcaster
+// --------------------------------------------------------------------
+
+void SAL_CALL AccessibleCell::addEventListener( const Reference<XAccessibleEventListener >& rxListener) throw (RuntimeException)
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ ::osl::MutexGuard aGuard (maMutex);
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ {
+ Reference<XInterface> xSource( static_cast<XComponent *>(this) );
+ lang::EventObject aEventObj(xSource);
+ rxListener->disposing(aEventObj);
+ }
+ else
+ {
+ AccessibleContextBase::addEventListener (rxListener);
+ if (mpText != NULL)
+ mpText->AddEventListener (rxListener);
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SAL_CALL AccessibleCell::removeEventListener( const Reference<XAccessibleEventListener >& rxListener) throw (RuntimeException)
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ AccessibleContextBase::removeEventListener(rxListener);
+ if (mpText != NULL)
+ mpText->RemoveEventListener (rxListener);
+}
+
+// --------------------------------------------------------------------
+// XServiceInfo
+// --------------------------------------------------------------------
+
+OUString SAL_CALL AccessibleCell::getImplementationName(void) throw (RuntimeException)
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleCell"));
+}
+
+// --------------------------------------------------------------------
+
+Sequence<OUString> SAL_CALL AccessibleCell::getSupportedServiceNames(void) throw (RuntimeException)
+{
+ ThrowIfDisposed ();
+
+ // Get list of supported service names from base class...
+ uno::Sequence<OUString> aServiceNames = AccessibleContextBase::getSupportedServiceNames();
+ sal_Int32 nCount (aServiceNames.getLength());
+
+ // ...and add additional names.
+ aServiceNames.realloc (nCount + 1);
+ static const OUString sAdditionalServiceName (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.AccessibleCell"));
+ aServiceNames[nCount] = sAdditionalServiceName;
+
+ return aServiceNames;
+}
+
+// --------------------------------------------------------------------
+// IAccessibleViewForwarderListener
+// --------------------------------------------------------------------
+
+void AccessibleCell::ViewForwarderChanged (ChangeType /*aChangeType*/, const IAccessibleViewForwarder* /*pViewForwarder*/)
+{
+ // Inform all listeners that the graphical representation (i.e. size
+ // and/or position) of the shape has changed.
+ CommitChange(AccessibleEventId::VISIBLE_DATA_CHANGED, Any(), Any());
+
+ // update our children that our screen position might have changed
+ if( mpText )
+ mpText->UpdateChildren();
+}
+
+// --------------------------------------------------------------------
+// protected
+// --------------------------------------------------------------------
+
+void AccessibleCell::disposing (void)
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ ::osl::MutexGuard aGuard (maMutex);
+
+ // Make sure to send an event that this object looses the focus in the
+ // case that it has the focus.
+ ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
+ if (pStateSet != NULL)
+ pStateSet->RemoveState(AccessibleStateType::FOCUSED);
+
+ if (mpText != NULL)
+ {
+ mpText->Dispose();
+ delete mpText;
+ mpText = NULL;
+ }
+
+ // Cleanup. Remove references to objects to allow them to be
+ // destroyed.
+ mxCell.clear();
+ maShapeTreeInfo = AccessibleShapeTreeInfo();
+
+ // Call base classes.
+ AccessibleContextBase::dispose ();
+}
+
+sal_Int32 SAL_CALL AccessibleCell::getAccessibleIndexInParent (void) throw (RuntimeException)
+{
+ ThrowIfDisposed ();
+ return mnIndexInParent;
+}
+
+::rtl::OUString SAL_CALL AccessibleCell::getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException)
+{
+ ThrowIfDisposed ();
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+
+ if( mxCell.is() )
+ return mxCell->getName();
+
+ return AccessibleCellBase::getAccessibleName();
+}
+
+} // end of namespace accessibility
diff --git a/svx/source/table/accessiblecell.hxx b/svx/source/table/accessiblecell.hxx
new file mode 100644
index 000000000000..9d7a3deef5f4
--- /dev/null
+++ b/svx/source/table/accessiblecell.hxx
@@ -0,0 +1,149 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_CELL_HXX
+#define _SVX_ACCESSIBILITY_ACCESSIBLE_CELL_HXX
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+
+#include <rtl/ref.hxx>
+
+#include <editeng/AccessibleContextBase.hxx>
+#include <editeng/AccessibleComponentBase.hxx>
+#include <svx/IAccessibleViewForwarderListener.hxx>
+#include <svx/AccessibleTextHelper.hxx>
+#include <svx/AccessibleShapeTreeInfo.hxx>
+
+#include <cppuhelper/implbase1.hxx>
+
+#include "cell.hxx"
+
+#include <boost/noncopyable.hpp>
+
+class SdrObject;
+
+
+namespace accessibility
+{
+
+class AccessibleShapeInfo;
+class AccessibleShapeTreeInfo;
+class IAccessibleParent;
+
+typedef ::cppu::ImplInheritanceHelper1< AccessibleContextBase, ::com::sun::star::accessibility::XAccessibleExtendedComponent > AccessibleCellBase;
+
+class AccessibleCell : boost::noncopyable, public AccessibleCellBase, public AccessibleComponentBase, public IAccessibleViewForwarderListener
+{
+public:
+ AccessibleCell( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>& rxParent, const sdr::table::CellRef& rCell, sal_Int32 nIndex, const AccessibleShapeTreeInfo& rShapeTreeInfo);
+ virtual ~AccessibleCell (void);
+
+ virtual void Init (void);
+
+ virtual bool operator== (const AccessibleCell& rAccessibleCell);
+
+ virtual sal_Bool SetState (sal_Int16 aState);
+ virtual sal_Bool ResetState (sal_Int16 aState);
+ sal_Bool GetState (sal_Int16 aState);
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire( ) throw ();
+ virtual void SAL_CALL release( ) throw ();
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount(void) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL getAccessibleChild(sal_Int32 nIndex) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL getAccessibleStateSet(void) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(void) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const ::com::sun::star::awt::Point& aPoint) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds(void) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation(void) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen(void) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize(void) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addFocusListener ( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeFocusListener (const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus (void) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground(void) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground(void) throw(::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleExtendedComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont (void) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTitledBorderText (void) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getToolTipText (void) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleEventBroadcaster
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener) throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName (void) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames (void) throw(::com::sun::star::uno::RuntimeException);
+
+ // IAccessibleViewForwarderListener
+ virtual void ViewForwarderChanged (ChangeType aChangeType, const IAccessibleViewForwarder* pViewForwarder);
+
+ using cppu::WeakComponentImplHelperBase::addEventListener;
+ using cppu::WeakComponentImplHelperBase::removeEventListener;
+
+ // Misc
+
+ /** set the index _nIndex at the accessible cell param _nIndex The new index in parent.
+ */
+ inline void setIndexInParent(sal_Int32 _nIndex) { mnIndexInParent = _nIndex; }
+
+protected:
+ /// Bundle of information passed to all shapes in a document tree.
+ AccessibleShapeTreeInfo maShapeTreeInfo;
+
+ /// the index in parent.
+ sal_Int32 mnIndexInParent;
+
+ /// The accessible text engine. May be NULL if it can not be created.
+ AccessibleTextHelper* mpText;
+
+ sdr::table::CellRef mxCell;
+
+ /// This method is called from the component helper base class while disposing.
+ virtual void SAL_CALL disposing (void);
+
+private:
+ explicit AccessibleCell(void); // not implemented
+ explicit AccessibleCell(const AccessibleCell&); // not implemented
+ AccessibleCell& operator=(const AccessibleCell&); // not implemented
+};
+
+} // end of namespace accessibility
+
+#endif
diff --git a/svx/source/table/accessibletableshape.cxx b/svx/source/table/accessibletableshape.cxx
new file mode 100644
index 000000000000..4dd7a4b58b47
--- /dev/null
+++ b/svx/source/table/accessibletableshape.cxx
@@ -0,0 +1,723 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <com/sun/star/table/XMergeableCell.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+
+#include <comphelper/accessiblewrapper.hxx>
+#include <vos/mutex.hxx>
+#include <tools/debug.hxx>
+#include <vcl/svapp.hxx>
+
+#include <svx/AccessibleTableShape.hxx>
+#include "tablecontroller.hxx"
+#include "accessiblecell.hxx"
+
+#include <algorithm>
+
+#include <cppuhelper/implbase1.hxx>
+
+using ::rtl::OUString;
+
+using namespace ::accessibility;
+using namespace ::sdr::table;
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::container;
+
+#define C2U(x) OUString(RTL_CONSTASCII_USTRINGPARAM(x))
+
+namespace accessibility
+{
+
+struct hash
+{
+ std::size_t operator()( const Reference< XCell >& xCell ) const
+ {
+ return std::size_t( xCell.get() );
+ }
+};
+
+typedef std::hash_map< Reference< XCell >, rtl::Reference< AccessibleCell >, hash > AccessibleCellMap;
+
+//-----------------------------------------------------------------------------
+// AccessibleTableShapeImpl
+//-----------------------------------------------------------------------------
+
+class AccessibleTableShapeImpl : public cppu::WeakImplHelper1< XModifyListener >
+{
+public:
+ AccessibleTableShapeImpl( AccessibleShapeTreeInfo& rShapeTreeInfo );
+
+ void init( const Reference< XAccessible>& xAccessible, const Reference< XTable >& xTable );
+ void dispose();
+
+ Reference< XAccessible > getAccessibleChild( sal_Int32 i ) throw(IndexOutOfBoundsException);
+ void getColumnAndRow( sal_Int32 nChildIndex, sal_Int32& rnColumn, sal_Int32& rnRow ) throw (IndexOutOfBoundsException );
+
+ // XModifyListener
+ virtual void SAL_CALL modified( const EventObject& aEvent ) throw (RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const EventObject& Source ) throw (RuntimeException);
+
+ AccessibleShapeTreeInfo& mrShapeTreeInfo;
+ Reference< XTable > mxTable;
+ AccessibleCellMap maChildMap;
+ Reference< XAccessible> mxAccessible;
+};
+
+//-----------------------------------------------------------------------------
+
+AccessibleTableShapeImpl::AccessibleTableShapeImpl( AccessibleShapeTreeInfo& rShapeTreeInfo )
+: mrShapeTreeInfo( rShapeTreeInfo )
+{
+}
+
+//-----------------------------------------------------------------------------
+
+void AccessibleTableShapeImpl::init( const Reference< XAccessible>& xAccessible, const Reference< XTable >& xTable )
+{
+ mxAccessible = xAccessible;
+ mxTable = xTable;
+
+ if( mxTable.is() )
+ {
+ Reference< XModifyListener > xListener( this );
+ mxTable->addModifyListener( xListener );
+ }
+}
+
+//-----------------------------------------------------------------------------
+
+void AccessibleTableShapeImpl::dispose()
+{
+ if( mxTable.is() )
+ {
+ Reference< XModifyListener > xListener( this );
+ mxTable->removeModifyListener( xListener );
+ mxTable.clear();
+ }
+ mxAccessible.clear();
+}
+
+//-----------------------------------------------------------------------------
+
+Reference< XAccessible > AccessibleTableShapeImpl::getAccessibleChild( sal_Int32 nChildIndex ) throw(IndexOutOfBoundsException)
+{
+ sal_Int32 nColumn = 0, nRow = 0;
+ getColumnAndRow( nChildIndex, nColumn, nRow );
+
+ Reference< XCell > xCell( mxTable->getCellByPosition( nColumn, nRow ) );
+ AccessibleCellMap::iterator iter( maChildMap.find( xCell ) );
+
+ if( iter != maChildMap.end() )
+ {
+ Reference< XAccessible > xChild( (*iter).second.get() );
+ return xChild;
+ }
+ else
+ {
+ CellRef xCellRef( dynamic_cast< Cell* >( xCell.get() ) );
+
+ rtl::Reference< AccessibleCell > xAccessibleCell( new AccessibleCell( mxAccessible, xCellRef, nChildIndex, mrShapeTreeInfo ) );
+
+ maChildMap[xCell] = xAccessibleCell;
+
+ xAccessibleCell->Init();
+
+ Reference< XAccessible > xChild( xAccessibleCell.get() );
+ return xChild;
+ }
+}
+
+//-----------------------------------------------------------------------------
+
+void AccessibleTableShapeImpl::getColumnAndRow( sal_Int32 nChildIndex, sal_Int32& rnColumn, sal_Int32& rnRow ) throw (IndexOutOfBoundsException )
+{
+ rnRow = 0;
+ rnColumn = nChildIndex;
+
+ if( mxTable.is() )
+ {
+ const sal_Int32 nColumnCount = mxTable->getColumnCount();
+ while( rnColumn >= nColumnCount )
+ {
+ rnRow++;
+ rnColumn -= nColumnCount;
+ }
+
+ if( rnRow < mxTable->getRowCount() )
+ return;
+ }
+
+ throw IndexOutOfBoundsException();
+}
+
+// XModifyListener
+void SAL_CALL AccessibleTableShapeImpl::modified( const EventObject& /*aEvent*/ ) throw (RuntimeException)
+{
+ if( mxTable.is() ) try
+ {
+ // structural changes may have happened to the table, validate all accessible cell instances
+ AccessibleCellMap aTempChildMap;
+ aTempChildMap.swap( maChildMap );
+
+ // first move all still existing cells to maChildMap again and update their index
+
+ const sal_Int32 nRowCount = mxTable->getRowCount();
+ const sal_Int32 nColCount = mxTable->getColumnCount();
+
+ sal_Int32 nChildIndex = 0;
+
+ for( sal_Int32 nRow = 0; nRow < nRowCount; ++nRow )
+ {
+ for( sal_Int32 nCol = 0; nCol < nColCount; ++nCol )
+ {
+ Reference< XCell > xCell( mxTable->getCellByPosition( nCol, nRow ) );
+ AccessibleCellMap::iterator iter( aTempChildMap.find( xCell ) );
+
+ if( iter != aTempChildMap.end() )
+ {
+ rtl::Reference< AccessibleCell > xAccessibleCell( (*iter).second );
+ xAccessibleCell->setIndexInParent( nChildIndex );
+ xAccessibleCell->CommitChange(AccessibleEventId::VISIBLE_DATA_CHANGED, Any(), Any());
+
+ // move still existing cell from temporary child map to our child map
+ maChildMap[xCell] = xAccessibleCell;
+ aTempChildMap.erase( iter );
+ }
+
+ ++nChildIndex;
+ }
+ }
+
+ // all accessible cell instances still left in aTempChildMap must be disposed
+ // as they are no longer part of the table
+
+ for( AccessibleCellMap::iterator iter( aTempChildMap.begin() ); iter != aTempChildMap.end(); iter++ )
+ {
+ (*iter).second->dispose();
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("svx::AccessibleTableShape::modified(), exception caught!");
+ }
+}
+
+// XEventListener
+void SAL_CALL AccessibleTableShapeImpl::disposing( const EventObject& /*Source*/ ) throw (RuntimeException)
+{
+}
+
+//-----------------------------------------------------------------------------
+// AccessibleTableShape
+//-----------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------
+
+AccessibleTableShape::AccessibleTableShape( const AccessibleShapeInfo& rShapeInfo, const AccessibleShapeTreeInfo& rShapeTreeInfo)
+: AccessibleTableShape_Base(rShapeInfo, rShapeTreeInfo)
+, mxImpl( new AccessibleTableShapeImpl( maShapeTreeInfo ) )
+{
+}
+
+//-----------------------------------------------------------------------------
+
+AccessibleTableShape::~AccessibleTableShape (void)
+{
+}
+
+//-----------------------------------------------------------------------------
+
+void AccessibleTableShape::Init()
+{
+ try
+ {
+
+ Reference< XPropertySet > xSet( mxShape, UNO_QUERY_THROW );
+ Reference< XTable > xTable( xSet->getPropertyValue(C2U("Model")), UNO_QUERY_THROW );
+
+ mxImpl->init( this, xTable );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("AccessibleTableShape::init(), exception caught?");
+ }
+
+ AccessibleTableShape_Base::Init();
+}
+
+//-----------------------------------------------------------------------------
+
+SvxTableController* AccessibleTableShape::getTableController()
+{
+ SdrView* pView = maShapeTreeInfo.GetSdrView ();
+ if( pView )
+ return dynamic_cast< SvxTableController* >( pView->getSelectionController().get() );
+ else
+ return 0;
+}
+
+//-----------------------------------------------------------------------------
+// XInterface
+//-----------------------------------------------------------------------------
+
+Any SAL_CALL AccessibleTableShape::queryInterface( const Type& aType ) throw (RuntimeException)
+{
+ return AccessibleTableShape_Base::queryInterface( aType );
+}
+
+//-----------------------------------------------------------------------------
+
+void SAL_CALL AccessibleTableShape::acquire( ) throw ()
+{
+ AccessibleTableShape_Base::acquire();
+}
+
+//-----------------------------------------------------------------------------
+
+void SAL_CALL AccessibleTableShape::release( ) throw ()
+{
+ AccessibleTableShape_Base::release();
+}
+
+//-----------------------------------------------------------------------------
+// XAccessible
+//-----------------------------------------------------------------------------
+
+Reference< XAccessibleContext > SAL_CALL AccessibleTableShape::getAccessibleContext(void) throw (RuntimeException)
+{
+ return AccessibleShape::getAccessibleContext ();
+}
+
+//-----------------------------------------------------------------------------
+OUString SAL_CALL AccessibleTableShape::getImplementationName(void) throw (RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.accessibility.AccessibleTableShape" ) );
+}
+
+//-----------------------------------------------------------------------------
+
+OUString AccessibleTableShape::CreateAccessibleBaseName(void) throw (RuntimeException)
+{
+ return OUString (RTL_CONSTASCII_USTRINGPARAM("TableShape"));;
+}
+
+//--------------------------------------------------------------------
+
+sal_Int32 SAL_CALL AccessibleTableShape::getAccessibleChildCount( ) throw(RuntimeException)
+{
+ ::vos::OGuard aSolarGuard(::Application::GetSolarMutex());
+ return mxImpl->mxTable.is() ? mxImpl->mxTable->getRowCount() * mxImpl->mxTable->getColumnCount() : 0;
+}
+
+//--------------------------------------------------------------------
+Reference< XAccessible > SAL_CALL AccessibleTableShape::getAccessibleChild( sal_Int32 i ) throw(IndexOutOfBoundsException, RuntimeException)
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ ThrowIfDisposed();
+
+ return mxImpl->getAccessibleChild( i );
+}
+
+//--------------------------------------------------------------------
+Reference< XAccessibleRelationSet > SAL_CALL AccessibleTableShape::getAccessibleRelationSet( ) throw (RuntimeException)
+{
+ return AccessibleShape::getAccessibleRelationSet( );
+}
+
+//--------------------------------------------------------------------
+
+sal_Int16 SAL_CALL AccessibleTableShape::getAccessibleRole (void) throw (RuntimeException)
+{
+ return AccessibleRole::TABLE;
+}
+
+//--------------------------------------------------------------------
+
+void SAL_CALL AccessibleTableShape::disposing (void)
+{
+ mxImpl->dispose();
+
+ // let the base do it's stuff
+ AccessibleShape::disposing();
+}
+
+//--------------------------------------------------------------------
+// XAccessibleTable
+//--------------------------------------------------------------------
+
+sal_Int32 SAL_CALL AccessibleTableShape::getAccessibleRowCount() throw (RuntimeException)
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ return mxImpl->mxTable.is() ? mxImpl->mxTable->getRowCount() : 0;
+}
+
+//--------------------------------------------------------------------
+
+sal_Int32 SAL_CALL AccessibleTableShape::getAccessibleColumnCount( ) throw (RuntimeException)
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ return mxImpl->mxTable.is() ? mxImpl->mxTable->getColumnCount() : 0;
+}
+
+//--------------------------------------------------------------------
+
+OUString SAL_CALL AccessibleTableShape::getAccessibleRowDescription( sal_Int32 nRow ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ checkCellPosition( 0, nRow );
+ return OUString();
+}
+
+//--------------------------------------------------------------------
+
+OUString SAL_CALL AccessibleTableShape::getAccessibleColumnDescription( sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ checkCellPosition( nColumn, 0 );
+ return OUString();
+}
+
+//--------------------------------------------------------------------
+
+sal_Int32 SAL_CALL AccessibleTableShape::getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ checkCellPosition( nColumn, nRow );
+ if( mxImpl->mxTable.is() )
+ {
+ Reference< XMergeableCell > xCell( mxImpl->mxTable->getCellByPosition( nColumn, nRow ), UNO_QUERY );
+ if( xCell.is() )
+ return xCell->getRowSpan();
+ }
+ return 1;
+}
+
+//--------------------------------------------------------------------
+
+sal_Int32 SAL_CALL AccessibleTableShape::getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ checkCellPosition( nColumn, nRow );
+ if( mxImpl->mxTable.is() )
+ {
+ Reference< XMergeableCell > xCell( mxImpl->mxTable->getCellByPosition( nColumn, nRow ), UNO_QUERY );
+ if( xCell.is() )
+ return xCell->getColumnSpan();
+ }
+ return 1;
+}
+
+//--------------------------------------------------------------------
+
+Reference< XAccessibleTable > SAL_CALL AccessibleTableShape::getAccessibleRowHeaders( ) throw (RuntimeException)
+{
+ Reference< XAccessibleTable > xRet( this ); // todo
+ return xRet;
+}
+
+//--------------------------------------------------------------------
+
+Reference< XAccessibleTable > SAL_CALL AccessibleTableShape::getAccessibleColumnHeaders( ) throw (RuntimeException)
+{
+ Reference< XAccessibleTable > xRet( this ); // todo
+ return xRet;
+}
+
+//--------------------------------------------------------------------
+
+Sequence< sal_Int32 > SAL_CALL AccessibleTableShape::getSelectedAccessibleRows( ) throw (RuntimeException)
+{
+ Sequence< sal_Int32 > aRet;
+ return aRet;
+}
+
+//--------------------------------------------------------------------
+
+Sequence< sal_Int32 > SAL_CALL AccessibleTableShape::getSelectedAccessibleColumns( ) throw (RuntimeException)
+{
+ Sequence< sal_Int32 > aRet;
+ return aRet;
+}
+
+//--------------------------------------------------------------------
+
+sal_Bool SAL_CALL AccessibleTableShape::isAccessibleRowSelected( sal_Int32 nRow ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ checkCellPosition( 0, nRow );
+ return sal_False;
+}
+
+//--------------------------------------------------------------------
+
+sal_Bool SAL_CALL AccessibleTableShape::isAccessibleColumnSelected( sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ checkCellPosition( nColumn, 0 );
+ return sal_False;
+}
+
+//--------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL AccessibleTableShape::getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ checkCellPosition( nColumn, nRow );
+
+ sal_Int32 nChildIndex = 0;
+ if( mxImpl->mxTable.is() )
+ nChildIndex = mxImpl->mxTable->getColumnCount() * nRow + nColumn;
+
+ return getAccessibleChild( nChildIndex );
+}
+
+//--------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL AccessibleTableShape::getAccessibleCaption( ) throw (RuntimeException)
+{
+ Reference< XAccessible > xRet;
+ return xRet;
+}
+
+//--------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL AccessibleTableShape::getAccessibleSummary( ) throw (RuntimeException)
+{
+ Reference< XAccessible > xRet;
+ return xRet;
+}
+
+//--------------------------------------------------------------------
+
+sal_Bool SAL_CALL AccessibleTableShape::isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ checkCellPosition( nColumn, nRow );
+
+ SvxTableController* pController = getTableController();
+ if( pController && pController->hasSelectedCells() )
+ {
+ CellPos aFirstPos, aLastPos;
+ pController->getSelectedCells( aFirstPos, aLastPos );
+ if( (aFirstPos.mnRow <= nRow) && (aFirstPos.mnCol <= nColumn) && (nRow <= aLastPos.mnRow) && (nColumn <= aLastPos.mnCol) )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+//--------------------------------------------------------------------
+
+sal_Int32 SAL_CALL AccessibleTableShape::getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ checkCellPosition( nColumn, nRow );
+ return mxImpl->mxTable.is() ? (nRow * mxImpl->mxTable->getColumnCount() + nColumn) : 0;
+}
+
+//--------------------------------------------------------------------
+
+sal_Int32 SAL_CALL AccessibleTableShape::getAccessibleRow( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ sal_Int32 nColumn = 0, nRow = 0;
+ mxImpl->getColumnAndRow( nChildIndex, nColumn, nRow );
+ return nRow;
+}
+
+//--------------------------------------------------------------------
+
+sal_Int32 SAL_CALL AccessibleTableShape::getAccessibleColumn( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ sal_Int32 nColumn = 0, nRow = 0;
+ mxImpl->getColumnAndRow( nChildIndex, nColumn, nRow );
+ return nChildIndex;
+}
+
+//--------------------------------------------------------------------
+// XAccessibleSelection
+//--------------------------------------------------------------------
+
+void SAL_CALL AccessibleTableShape::selectAccessibleChild( sal_Int32 nChildIndex ) throw ( IndexOutOfBoundsException, RuntimeException )
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ CellPos aPos;
+ mxImpl->getColumnAndRow( nChildIndex, aPos.mnCol, aPos.mnRow );
+
+ // todo, select table shape?!?
+ SvxTableController* pController = getTableController();
+ if( pController )
+ {
+ CellPos aFirstPos( aPos ), aLastPos( aPos );
+ if( pController->hasSelectedCells() )
+ {
+ pController->getSelectedCells( aFirstPos, aLastPos );
+
+ aFirstPos.mnRow = std::min( aFirstPos.mnRow, aPos.mnRow );
+ aFirstPos.mnCol = std::min( aFirstPos.mnCol, aPos.mnCol );
+ aLastPos.mnRow = std::max( aLastPos.mnRow, aPos.mnRow );
+ aLastPos.mnCol = std::max( aLastPos.mnCol, aPos.mnCol );
+ }
+ pController->setSelectedCells( aFirstPos, aLastPos );
+ }
+}
+
+//--------------------------------------------------------------------
+
+sal_Bool SAL_CALL AccessibleTableShape::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw ( IndexOutOfBoundsException, RuntimeException )
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ CellPos aPos;
+ mxImpl->getColumnAndRow( nChildIndex, aPos.mnCol, aPos.mnRow );
+
+ return isAccessibleSelected(aPos.mnCol, aPos.mnRow);
+}
+
+//--------------------------------------------------------------------
+
+void SAL_CALL AccessibleTableShape::clearAccessibleSelection() throw ( RuntimeException )
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+
+ SvxTableController* pController = getTableController();
+ if( pController )
+ pController->clearSelection();
+}
+//--------------------------------------------------------------------
+
+void SAL_CALL AccessibleTableShape::selectAllAccessibleChildren() throw ( RuntimeException )
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+
+ // todo: force selection of shape?
+ SvxTableController* pController = getTableController();
+ if( pController )
+ pController->selectAll();
+}
+
+//--------------------------------------------------------------------
+
+sal_Int32 SAL_CALL AccessibleTableShape::getSelectedAccessibleChildCount() throw ( RuntimeException )
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+
+ SvxTableController* pController = getTableController();
+ if( pController && pController->hasSelectedCells() )
+ {
+ CellPos aFirstPos, aLastPos;
+ pController->getSelectedCells( aFirstPos, aLastPos );
+
+ const sal_Int32 nSelectedColumns = std::max( (sal_Int32)0, aLastPos.mnCol - aFirstPos.mnCol ) + 1;
+ const sal_Int32 nSelectedRows = std::max( (sal_Int32)0, aLastPos.mnRow - aFirstPos.mnRow ) + 1;
+ return nSelectedRows * nSelectedColumns;
+ }
+
+ return 0;
+}
+
+//--------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL AccessibleTableShape::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw ( IndexOutOfBoundsException, RuntimeException)
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+
+ SvxTableController* pController = getTableController();
+ if( pController && pController->hasSelectedCells() )
+ {
+ CellPos aFirstPos, aLastPos;
+ pController->getSelectedCells( aFirstPos, aLastPos );
+
+ const sal_Int32 nSelectedColumns = std::max( (sal_Int32)0, aLastPos.mnCol - aFirstPos.mnCol ) + 1;
+ const sal_Int32 nSelectedRows = std::max( (sal_Int32)0, aLastPos.mnRow - aFirstPos.mnRow ) + 1;
+
+ if( nSelectedChildIndex < (nSelectedRows * nSelectedColumns) )
+ {
+ while( nSelectedChildIndex >= nSelectedColumns )
+ {
+ aFirstPos.mnRow++;
+ nSelectedChildIndex -= nSelectedColumns;
+ }
+ return getAccessibleCellAt( nSelectedColumns, aFirstPos.mnRow );
+ }
+ }
+
+ throw IndexOutOfBoundsException();
+}
+
+//--------------------------------------------------------------------
+
+void SAL_CALL AccessibleTableShape::deselectAccessibleChild( sal_Int32 nChildIndex ) throw ( IndexOutOfBoundsException, RuntimeException )
+{
+ ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+ CellPos aPos;
+ mxImpl->getColumnAndRow( nChildIndex, aPos.mnCol, aPos.mnRow );
+
+ // todo, select table shape?!?
+ SvxTableController* pController = getTableController();
+ if( pController && pController->hasSelectedCells() )
+ {
+ CellPos aFirstPos, aLastPos;
+ pController->getSelectedCells( aFirstPos, aLastPos );
+
+ // create a selection where aPos is not part of anymore
+ aFirstPos.mnRow = std::min( aFirstPos.mnRow, aPos.mnRow+1 );
+ aFirstPos.mnCol = std::min( aFirstPos.mnCol, aPos.mnCol+1 );
+ aLastPos.mnRow = std::max( aLastPos.mnRow, aPos.mnRow-1 );
+ aLastPos.mnCol = std::max( aLastPos.mnCol, aPos.mnCol-1 );
+
+ // new selection may be invalid (child to deselect is not at a border of the selection but in between)
+ if( (aFirstPos.mnRow > aLastPos.mnRow) || (aFirstPos.mnCol > aLastPos.mnCol) )
+ pController->clearSelection(); // if selection is invalid, clear all
+ else
+ pController->setSelectedCells( aFirstPos, aLastPos );
+ }
+}
+
+//--------------------------------------------------------------------
+
+void AccessibleTableShape::checkCellPosition( sal_Int32 nCol, sal_Int32 nRow ) throw ( IndexOutOfBoundsException )
+{
+ if( (nCol >= 0) && (nRow >= 0) && mxImpl->mxTable.is() && (nCol < mxImpl->mxTable->getColumnCount()) && (nRow < mxImpl->mxTable->getRowCount()) )
+ return;
+
+ throw IndexOutOfBoundsException();
+}
+
+}
diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx
new file mode 100644
index 000000000000..f6540e304bfc
--- /dev/null
+++ b/svx/source/table/cell.cxx
@@ -0,0 +1,1809 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <com/sun/star/drawing/BitmapMode.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/text/WritingMode.hpp>
+#include <com/sun/star/table/TableBorder.hpp>
+
+#include <cppuhelper/typeprovider.hxx>
+#include <svl/style.hxx>
+#include <svl/itemset.hxx>
+
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include "svx/sdr/properties/textproperties.hxx"
+#include "editeng/outlobj.hxx"
+#include "editeng/writingmodeitem.hxx"
+#include "svx/svdotable.hxx"
+#include "svx/svdoutl.hxx"
+#include "svx/unoshtxt.hxx"
+#include "svx/svdmodel.hxx"
+
+#include "tableundo.hxx"
+#include "cell.hxx"
+#include "svx/svdotable.hxx"
+#include "svx/svdoutl.hxx"
+#include "svx/unoshtxt.hxx"
+#include "svx/unoshprp.hxx"
+#include "svx/unoshape.hxx"
+#include "editeng/editobj.hxx"
+#include "editeng/boxitem.hxx"
+#include "svx/xflbstit.hxx"
+#include "svx/xflbmtit.hxx"
+#include <svx/svdpool.hxx>
+
+// -----------------------------------------------------------------------------
+
+using ::rtl::OUString;
+using ::vos::OGuard;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::container;
+
+// -----------------------------------------------------------------------------
+
+static const SvxItemPropertySet* ImplGetSvxCellPropertySet()
+{
+ // Propertymap fuer einen Outliner Text
+ static const SfxItemPropertyMapEntry aSvxCellPropertyMap[] =
+ {
+ FILL_PROPERTIES
+// { MAP_CHAR_LEN("HasLevels"), OWN_ATTR_HASLEVELS, &::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN("Style"), OWN_ATTR_STYLE, &::com::sun::star::style::XStyle::static_type(), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_WRITINGMODE), SDRATTR_TEXTDIRECTION, &::getCppuType( (::com::sun::star::text::WritingMode*) 0 ), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_HORZADJUST), SDRATTR_TEXT_HORZADJUST, &::getCppuType((const ::com::sun::star::drawing::TextHorizontalAdjust*)0), 0, 0}, \
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_LEFTDIST), SDRATTR_TEXT_LEFTDIST, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_LOWERDIST), SDRATTR_TEXT_LOWERDIST, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_RIGHTDIST), SDRATTR_TEXT_RIGHTDIST, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_UPPERDIST), SDRATTR_TEXT_UPPERDIST, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, \
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_VERTADJUST), SDRATTR_TEXT_VERTADJUST, &::getCppuType((const ::com::sun::star::drawing::TextVerticalAdjust*)0), 0, 0},\
+ { MAP_CHAR_LEN(UNO_NAME_TEXT_WORDWRAP), SDRATTR_TEXT_WORDWRAP, &::getBooleanCppuType(), 0, 0}, \
+
+ { MAP_CHAR_LEN("TableBorder"), OWN_ATTR_TABLEBORDER, &::getCppuType((const TableBorder*)0), 0, 0 }, \
+ { MAP_CHAR_LEN("TopBorder"), SDRATTR_TABLE_BORDER, &::getCppuType((const BorderLine*)0), 0, TOP_BORDER }, \
+ { MAP_CHAR_LEN("BottomBorder"), SDRATTR_TABLE_BORDER, &::getCppuType((const BorderLine*)0), 0, BOTTOM_BORDER }, \
+ { MAP_CHAR_LEN("LeftBorder"), SDRATTR_TABLE_BORDER, &::getCppuType((const BorderLine*)0), 0, LEFT_BORDER }, \
+ { MAP_CHAR_LEN("RightBorder"), SDRATTR_TABLE_BORDER, &::getCppuType((const BorderLine*)0), 0, RIGHT_BORDER }, \
+
+ SVX_UNOEDIT_OUTLINER_PROPERTIES,
+ SVX_UNOEDIT_CHAR_PROPERTIES,
+ SVX_UNOEDIT_PARA_PROPERTIES,
+ {0,0,0,0,0,0}
+ };
+
+ static SvxItemPropertySet aSvxCellPropertySet( aSvxCellPropertyMap, SdrObject::GetGlobalDrawObjectItemPool() );
+ return &aSvxCellPropertySet;
+}
+
+namespace sdr
+{
+ namespace properties
+ {
+ class CellProperties : public TextProperties
+ {
+ protected:
+ // create a new itemset
+ SfxItemSet& CreateObjectSpecificItemSet(SfxItemPool& rPool);
+
+ public:
+ // basic constructor
+ CellProperties(SdrObject& rObj, sdr::table::Cell* pCell );
+
+ // constructor for copying, but using new object
+ CellProperties(const CellProperties& rProps, SdrObject& rObj, sdr::table::Cell* pCell);
+
+ // destructor
+ ~CellProperties();
+
+ // Clone() operator, normally just calls the local copy constructor
+ BaseProperties& Clone(SdrObject& rObj) const;
+
+ void ForceDefaultAttributes();
+
+ void ItemSetChanged(const SfxItemSet& rSet);
+
+ void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem);
+
+ void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr);
+
+ sdr::table::CellRef mxCell;
+ };
+
+ // create a new itemset
+ SfxItemSet& CellProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return *(new SfxItemSet(rPool,
+
+ // range from SdrAttrObj
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+
+ // range for SdrTableObj
+ SDRATTR_TABLE_FIRST, SDRATTR_TABLE_LAST,
+
+ // range from SdrTextObj
+ EE_ITEMS_START, EE_ITEMS_END,
+
+ // end
+ 0, 0));
+ }
+
+ CellProperties::CellProperties(SdrObject& rObj, sdr::table::Cell* pCell)
+ : TextProperties(rObj)
+ , mxCell(pCell)
+ {
+ }
+
+ CellProperties::CellProperties(const CellProperties& rProps, SdrObject& rObj, sdr::table::Cell* pCell)
+ : TextProperties(rProps, rObj)
+ , mxCell( pCell )
+ {
+ }
+
+ CellProperties::~CellProperties()
+ {
+ }
+
+ BaseProperties& CellProperties::Clone(SdrObject& rObj) const
+ {
+ DBG_ERROR("CellProperties::Clone(), does not work yet!");
+ return *(new CellProperties(*this, rObj,0));
+ }
+
+ void CellProperties::ForceDefaultAttributes()
+ {
+ }
+
+ void CellProperties::ItemSetChanged(const SfxItemSet& rSet )
+ {
+ SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
+
+ if( mxCell.is() )
+ {
+ OutlinerParaObject* pParaObj = mxCell->GetEditOutlinerParaObject();
+
+ bool bOwnParaObj = pParaObj != 0;
+
+ if( pParaObj == 0 )
+ pParaObj = mxCell->GetOutlinerParaObject();
+
+ if(pParaObj)
+ {
+ // handle outliner attributes
+ Outliner* pOutliner = 0;
+
+ if(mxCell->IsTextEditActive())
+ {
+ pOutliner = rObj.GetTextEditOutliner();
+ }
+ else
+ {
+ pOutliner = &rObj.ImpGetDrawOutliner();
+ pOutliner->SetText(*pParaObj);
+ }
+
+ sal_uInt32 nParaCount(pOutliner->GetParagraphCount());
+
+ for(sal_uInt16 nPara = 0; nPara < nParaCount; nPara++)
+ {
+ SfxItemSet aSet(pOutliner->GetParaAttribs(nPara));
+ aSet.Put(rSet);
+ pOutliner->SetParaAttribs(nPara, aSet);
+ }
+
+ if(!mxCell->IsTextEditActive())
+ {
+ if(nParaCount)
+ {
+ // force ItemSet
+ GetObjectItemSet();
+
+ SfxItemSet aNewSet(pOutliner->GetParaAttribs(0L));
+ mpItemSet->Put(aNewSet);
+ }
+
+ OutlinerParaObject* pTemp = pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount);
+ pOutliner->Clear();
+
+ mxCell->SetOutlinerParaObject(pTemp);
+ }
+
+ if( bOwnParaObj )
+ delete pParaObj;
+ }
+ }
+
+ // call parent
+ AttributeProperties::ItemSetChanged(rSet);
+
+ if( mxCell.is() )
+ mxCell->notifyModified();
+ }
+
+ void CellProperties::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem)
+ {
+ if(pNewItem && (SDRATTR_TEXTDIRECTION == nWhich))
+ {
+ sal_Bool bVertical(com::sun::star::text::WritingMode_TB_RL == ((SvxWritingModeItem*)pNewItem)->GetValue());
+
+ sdr::table::SdrTableObj& rObj = (sdr::table::SdrTableObj&)GetSdrObject();
+ if( rObj.IsVerticalWriting() != bVertical )
+ rObj.SetVerticalWriting(bVertical);
+ }
+
+ // call parent
+ AttributeProperties::ItemChange( nWhich, pNewItem );
+ }
+
+ void CellProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
+ {
+ TextProperties::SetStyleSheet( pNewStyleSheet, bDontRemoveHardAttr );
+ }
+ } // end of namespace properties
+} // end of namespace sdr
+
+namespace sdr { namespace table {
+
+// -----------------------------------------------------------------------------
+// Cell
+// -----------------------------------------------------------------------------
+
+rtl::Reference< Cell > Cell::create( SdrTableObj& rTableObj, OutlinerParaObject* pOutlinerParaObject )
+{
+ rtl::Reference< Cell > xCell( new Cell( rTableObj, pOutlinerParaObject ) );
+ if( xCell->mxTable.is() )
+ {
+ Reference< XEventListener > xListener( xCell.get() );
+ xCell->mxTable->addEventListener( xListener );
+ }
+ return xCell;
+}
+
+// -----------------------------------------------------------------------------
+
+Cell::Cell( SdrTableObj& rTableObj, OutlinerParaObject* pOutlinerParaObject ) throw()
+: SdrText( rTableObj, pOutlinerParaObject )
+, SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
+, mpPropSet( ImplGetSvxCellPropertySet() )
+, mpProperties( new sdr::properties::CellProperties( rTableObj, this ) )
+, mnCellContentType( CellContentType_EMPTY )
+, mfValue( 0.0 )
+, mnError( 0 )
+, mbMerged( sal_False )
+, mnRowSpan( 1 )
+, mnColSpan( 1 )
+, mxTable( rTableObj.getTable() )
+{
+ if( rTableObj.GetModel() )
+ SetModel( rTableObj.GetModel() );
+}
+
+// -----------------------------------------------------------------------------
+
+Cell::~Cell() throw()
+{
+ dispose();
+}
+
+// -----------------------------------------------------------------------------
+
+void Cell::dispose()
+{
+ if( mxTable.is() )
+ {
+ try
+ {
+ Reference< XEventListener > xThis( this );
+ mxTable->removeEventListener( xThis );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("Cell::dispose(), exception caught!");
+ }
+ mxTable.clear();
+ }
+
+ if( mpProperties )
+ {
+ delete mpProperties;
+ mpProperties = 0;
+ }
+ SetOutlinerParaObject( 0 );
+}
+
+// -----------------------------------------------------------------------------
+
+void Cell::SetModel(SdrModel* pNewModel)
+{
+ SvxTextEditSource* pTextEditSource = dynamic_cast< SvxTextEditSource* >( GetEditSource() );
+ if( (GetModel() != pNewModel) || ( pNewModel && !pTextEditSource) )
+ {
+ if( mpProperties )
+ {
+ SfxItemPool* pItemPool = mpProperties->GetObjectItemSet().GetPool();
+
+ // test for correct pool in ItemSet; move to new pool if necessary
+ if( pNewModel && pItemPool && pItemPool != &pNewModel->GetItemPool())
+ mpProperties->MoveToItemPool(pItemPool, &pNewModel->GetItemPool(), pNewModel);
+ }
+
+ if( pTextEditSource )
+ {
+ pTextEditSource->ChangeModel( pNewModel );
+ }
+ else
+ {
+ SetEditSource( new SvxTextEditSource( &GetObject(), this, static_cast< XWeak * >( this ) ) );
+ }
+
+ SetStyleSheet( 0, sal_True );
+ SdrText::SetModel( pNewModel );
+ ForceOutlinerParaObject( OUTLINERMODE_TEXTOBJECT );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void Cell::merge( sal_Int32 nColumnSpan, sal_Int32 nRowSpan )
+{
+ if( (mnColSpan != nColumnSpan) || (mnRowSpan != nRowSpan) || (mbMerged != sal_False) )
+ {
+ mnColSpan = nColumnSpan;
+ mnRowSpan = nRowSpan;
+ mbMerged = sal_False;
+ notifyModified();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void Cell::mergeContent( const CellRef& xSourceCell )
+{
+ SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() );
+
+ if( xSourceCell->hasText() )
+ {
+ SdrOutliner& rOutliner=rTableObj.ImpGetDrawOutliner();
+ rOutliner.SetUpdateMode(sal_True);
+
+ if( hasText() )
+ {
+ rOutliner.SetText(*GetOutlinerParaObject());
+ rOutliner.AddText(*xSourceCell->GetOutlinerParaObject());
+ }
+ else
+ {
+ rOutliner.SetText(*xSourceCell->GetOutlinerParaObject());
+ }
+
+ SetOutlinerParaObject( rOutliner.CreateParaObject() );
+ rOutliner.Clear();
+ xSourceCell->SetOutlinerParaObject(rOutliner.CreateParaObject());
+ rOutliner.Clear();
+ SetStyleSheet( GetStyleSheet(), sal_True );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void Cell::cloneFrom( const CellRef& xCell )
+{
+ if( xCell.is() )
+ {
+ replaceContentAndFormating( xCell );
+
+ mnCellContentType = xCell->mnCellContentType;
+
+ msFormula = xCell->msFormula;
+ mfValue = xCell->mfValue;
+ mnError = xCell->mnError;
+
+ mbMerged = xCell->mbMerged;
+ mnRowSpan = xCell->mnRowSpan;
+ mnColSpan = xCell->mnColSpan;
+
+ }
+ notifyModified();
+}
+
+void Cell::replaceContentAndFormating( const CellRef& xSourceCell )
+{
+ if( xSourceCell.is() && mpProperties )
+ {
+ mpProperties->SetMergedItemSet( xSourceCell->GetObjectItemSet() );
+ SetOutlinerParaObject( new OutlinerParaObject(*xSourceCell->GetOutlinerParaObject()) );
+
+ SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() );
+ SdrTableObj& rSourceTableObj = dynamic_cast< SdrTableObj& >( xSourceCell->GetObject() );
+
+ if(rSourceTableObj.GetModel() != rTableObj.GetModel())
+ {
+ SetStyleSheet( 0, sal_True );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void Cell::setMerged()
+{
+ if( !mbMerged )
+ {
+ mbMerged = sal_True;
+ notifyModified();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void Cell::notifyModified()
+{
+ if( mxTable.is() )
+ mxTable->setModified( sal_True );
+}
+
+// -----------------------------------------------------------------------------
+// SdrTextShape proxy
+// -----------------------------------------------------------------------------
+
+bool Cell::IsTextEditActive()
+{
+ bool isActive = false;
+ SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() );
+ if(rTableObj.getActiveCell().get() == this )
+ {
+ OutlinerParaObject* pParaObj = rTableObj.GetEditOutlinerParaObject();
+ if( pParaObj != 0 )
+ {
+ isActive = true;
+ delete pParaObj;
+ }
+ }
+ return isActive;
+}
+
+// -----------------------------------------------------------------------------
+
+bool Cell::hasText() const
+{
+ OutlinerParaObject* pParaObj = GetOutlinerParaObject();
+ if( pParaObj )
+ {
+ const EditTextObject& rTextObj = pParaObj->GetTextObject();
+ if( rTextObj.GetParagraphCount() >= 1 )
+ {
+ if( rTextObj.GetParagraphCount() == 1 )
+ {
+ if( rTextObj.GetText(0).Len() == 0 )
+ return false;
+ }
+ return true;
+ }
+ }
+
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+
+OutlinerParaObject* Cell::GetEditOutlinerParaObject() const
+{
+ SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() );
+ if( rTableObj.getActiveCell().get() == this )
+ return rTableObj.GetEditOutlinerParaObject();
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+void Cell::SetStyleSheet( SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr )
+{
+ // only allow cell styles for cells
+ if( pStyleSheet && pStyleSheet->GetFamily() != SFX_STYLE_FAMILY_FRAME )
+ return;
+
+ if( mpProperties && (mpProperties->GetStyleSheet() != pStyleSheet) )
+ {
+ mpProperties->SetStyleSheet( pStyleSheet, bDontRemoveHardAttr );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+const SfxItemSet& Cell::GetObjectItemSet()
+{
+ if( mpProperties )
+ {
+ return mpProperties->GetObjectItemSet();
+ }
+ else
+ {
+ DBG_ERROR("Cell::GetObjectItemSet(), called without properties!");
+ return GetObject().GetObjectItemSet();
+ }
+}
+
+void Cell::SetObjectItem(const SfxPoolItem& rItem)
+{
+ if( mpProperties )
+ {
+ mpProperties->SetObjectItem( rItem );
+ notifyModified();
+ }
+}
+
+void Cell::SetMergedItem(const SfxPoolItem& rItem)
+{
+ SetObjectItem(rItem);
+}
+
+SfxStyleSheet* Cell::GetStyleSheet() const
+{
+ if( mpProperties )
+ return mpProperties->GetStyleSheet();
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+SfxStyleSheetPool* Cell::GetStyleSheetPool() const
+{
+ if( mpProperties && mpProperties->GetStyleSheet() )
+ return dynamic_cast< SfxStyleSheetPool* >( &mpProperties->GetStyleSheet()->GetPool() );
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+const Rectangle& Cell::GetCurrentBoundRect() const
+{
+ return maCellRect;
+}
+
+// -----------------------------------------------------------------------------
+
+void Cell::TakeTextAnchorRect(Rectangle& rAnchorRect) const
+{
+ rAnchorRect.nLeft = maCellRect.nLeft + GetTextLeftDistance();
+ rAnchorRect.nRight = maCellRect.nRight - GetTextRightDistance();
+ rAnchorRect.nTop = maCellRect.nTop + GetTextUpperDistance();
+ rAnchorRect.nBottom = maCellRect.nBottom - GetTextLowerDistance();
+}
+
+// -----------------------------------------------------------------------------
+
+const SfxItemSet& Cell::GetItemSet() const
+{
+ return mpProperties->GetObjectItemSet();
+}
+
+// -----------------------------------------------------------------------------
+
+void Cell::SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, sal_Bool bClearAllItems)
+{
+ if( mpProperties )
+ {
+ mpProperties->SetMergedItemSetAndBroadcast(rSet, bClearAllItems);
+ notifyModified();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 Cell::getMinimumWidth()
+{
+ return GetTextLeftDistance() + GetTextRightDistance() + 100;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 Cell::getMinimumHeight()
+{
+ if( !mpProperties )
+ return 0;
+
+ SdrTableObj& rTableObj = dynamic_cast< SdrTableObj& >( GetObject() );
+ sal_Int32 nMinimumHeight = 0;
+
+ Rectangle aTextRect;
+ TakeTextAnchorRect( aTextRect );
+ Size aSize( aTextRect.GetSize() );
+ aSize.Height()=0x0FFFFFFF;
+
+ SdrOutliner* pEditOutliner = rTableObj.GetCellTextEditOutliner( *this );
+ if(pEditOutliner)
+ {
+ pEditOutliner->SetMaxAutoPaperSize(aSize);
+ nMinimumHeight = pEditOutliner->GetTextHeight()+1;
+ }
+ else /*if ( hasText() )*/
+ {
+ Outliner& rOutliner=rTableObj.ImpGetDrawOutliner();
+ rOutliner.SetPaperSize(aSize);
+ rOutliner.SetUpdateMode(sal_True);
+ ForceOutlinerParaObject( OUTLINERMODE_TEXTOBJECT );
+
+ if( GetOutlinerParaObject() )
+ {
+ rOutliner.SetText(*GetOutlinerParaObject());
+ }
+ nMinimumHeight=rOutliner.GetTextHeight()+1;
+ rOutliner.Clear();
+ }
+
+ nMinimumHeight += GetTextUpperDistance() + GetTextLowerDistance();
+ return nMinimumHeight;
+}
+
+// -----------------------------------------------------------------------------
+
+long Cell::GetTextLeftDistance() const
+{
+ return ((SdrTextLeftDistItem&)(GetItemSet().Get(SDRATTR_TEXT_LEFTDIST))).GetValue();
+}
+
+// -----------------------------------------------------------------------------
+
+long Cell::GetTextRightDistance() const
+{
+ return ((SdrTextRightDistItem&)(GetItemSet().Get(SDRATTR_TEXT_RIGHTDIST))).GetValue();
+}
+
+// -----------------------------------------------------------------------------
+
+long Cell::GetTextUpperDistance() const
+{
+ return ((SdrTextUpperDistItem&)(GetItemSet().Get(SDRATTR_TEXT_UPPERDIST))).GetValue();
+}
+
+// -----------------------------------------------------------------------------
+
+long Cell::GetTextLowerDistance() const
+{
+ return ((SdrTextLowerDistItem&)(GetItemSet().Get(SDRATTR_TEXT_LOWERDIST))).GetValue();
+}
+
+// -----------------------------------------------------------------------------
+
+SdrTextVertAdjust Cell::GetTextVerticalAdjust() const
+{
+ return ((SdrTextVertAdjustItem&)(GetItemSet().Get(SDRATTR_TEXT_VERTADJUST))).GetValue();
+}
+
+// -----------------------------------------------------------------------------
+
+SdrTextHorzAdjust Cell::GetTextHorizontalAdjust() const
+{
+ return ((SdrTextHorzAdjustItem&)(GetItemSet().Get(SDRATTR_TEXT_HORZADJUST))).GetValue();
+}
+
+// -----------------------------------------------------------------------------
+
+void Cell::SetOutlinerParaObject( OutlinerParaObject* pTextObject )
+{
+ SdrText::SetOutlinerParaObject( pTextObject );
+ maSelection.nStartPara = 0xffff;
+
+ if( pTextObject == 0 )
+ ForceOutlinerParaObject( OUTLINERMODE_TEXTOBJECT );
+}
+
+// -----------------------------------------------------------------------------
+
+void Cell::AddUndo()
+{
+ SdrObject& rObj = GetObject();
+ if( rObj.IsInserted() && GetModel() && GetModel()->IsUndoEnabled() )
+ {
+ CellRef xCell( this );
+ GetModel()->AddUndo( new CellUndo( &rObj, xCell ) );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+sdr::properties::TextProperties* Cell::CloneProperties( sdr::properties::TextProperties* pProperties, SdrObject& rNewObj, Cell& rNewCell )
+{
+ if( pProperties )
+ return new sdr::properties::CellProperties( *static_cast<sdr::properties::CellProperties*>(pProperties), rNewObj, &rNewCell );
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+sdr::properties::TextProperties* Cell::CloneProperties( SdrObject& rNewObj, Cell& rNewCell )
+{
+ return CloneProperties(mpProperties,rNewObj,rNewCell);
+}
+
+// -----------------------------------------------------------------------------
+// XInterface
+// -----------------------------------------------------------------------------
+
+Any SAL_CALL Cell::queryInterface( const Type & rType ) throw(RuntimeException)
+{
+ if( rType == XMergeableCell::static_type() )
+ return Any( Reference< XMergeableCell >( this ) );
+
+ if( rType == XCell::static_type() )
+ return Any( Reference< XCell >( this ) );
+
+ if( rType == XLayoutConstrains::static_type() )
+ return Any( Reference< XLayoutConstrains >( this ) );
+
+ if( rType == XEventListener::static_type() )
+ return Any( Reference< XEventListener >( this ) );
+
+ Any aRet( SvxUnoTextBase::queryAggregation( rType ) );
+ if( aRet.hasValue() )
+ return aRet;
+
+ return ::cppu::OWeakObject::queryInterface( rType );
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL Cell::acquire() throw ()
+{
+ ::cppu::OWeakObject::acquire();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL Cell::release() throw ()
+{
+ ::cppu::OWeakObject::release();
+}
+
+// -----------------------------------------------------------------------------
+// XTypeProvider
+// -----------------------------------------------------------------------------
+
+Sequence< Type > SAL_CALL Cell::getTypes( ) throw (RuntimeException)
+{
+ Sequence< Type > aTypes( SvxUnoTextBase::getTypes() );
+
+ sal_Int32 nLen = aTypes.getLength();
+ aTypes.realloc(nLen + 2);
+ aTypes[nLen++] = XMergeableCell::static_type();
+ aTypes[nLen++] = XLayoutConstrains::static_type();
+
+ return aTypes;
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< sal_Int8 > SAL_CALL Cell::getImplementationId( ) throw (RuntimeException)
+{
+ static ::cppu::OImplementationId* pId = 0;
+ if (! pId)
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if (! pId)
+ {
+ static ::cppu::OImplementationId aId;
+ pId = &aId;
+ }
+ }
+ return pId->getImplementationId();
+}
+
+// -----------------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------------
+
+OUString SAL_CALL Cell::getImplementationName( ) throw (RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.table.Cell" ) );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL Cell::supportsService( const OUString& ServiceName ) throw (RuntimeException)
+{
+ if( ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.table.cell" ) ) == 0 )
+ return sal_True;
+
+ if( ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.cell" ) ) == 0 )
+ return sal_True;
+
+ return SvxUnoTextBase::supportsService( ServiceName );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL Cell::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ Sequence< OUString > aSeq( SvxUnoTextBase::getSupportedServiceNames() );
+ sal_Int32 nIndex = aSeq.getLength();
+ aSeq.realloc( nIndex + 2 );
+ aSeq[nIndex++] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.table.cell" ) );
+ aSeq[nIndex++] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.cell" ) );
+ return aSeq;
+}
+
+// -----------------------------------------------------------------------------
+// XLayoutConstrains
+// -----------------------------------------------------------------------------
+
+::com::sun::star::awt::Size SAL_CALL Cell::getMinimumSize( ) throw (RuntimeException)
+{
+ return ::com::sun::star::awt::Size( getMinimumWidth(), getMinimumHeight() );
+}
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::awt::Size SAL_CALL Cell::getPreferredSize( ) throw (RuntimeException)
+{
+ return getMinimumSize();
+}
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::awt::Size SAL_CALL Cell::calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw (RuntimeException)
+{
+ return aNewSize;
+}
+
+// -----------------------------------------------------------------------------
+// XMergeableCell
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL Cell::getRowSpan() throw (RuntimeException)
+{
+ return mnRowSpan;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL Cell::getColumnSpan() throw (RuntimeException)
+{
+ return mnColSpan;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL Cell::isMerged() throw (RuntimeException)
+{
+ return mbMerged;
+}
+
+// -----------------------------------------------------------------------------
+// XCell
+// -----------------------------------------------------------------------------
+
+OUString SAL_CALL Cell::getFormula( ) throw (RuntimeException)
+{
+ return msFormula;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL Cell::setFormula( const OUString& aFormula ) throw (RuntimeException)
+{
+ if( msFormula != aFormula )
+ {
+ msFormula = aFormula;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+double SAL_CALL Cell::getValue( ) throw (RuntimeException)
+{
+ return mfValue;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL Cell::setValue( double nValue ) throw (RuntimeException)
+{
+ if( mfValue == nValue )
+ {
+ mfValue = nValue;
+ mnCellContentType = CellContentType_VALUE;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+CellContentType SAL_CALL Cell::getType() throw (RuntimeException)
+{
+ return mnCellContentType;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL Cell::getError( ) throw (RuntimeException)
+{
+ return mnError;
+}
+
+// -----------------------------------------------------------------------------
+// XPropertySet
+// -----------------------------------------------------------------------------
+
+Any Cell::GetAnyForItem( SfxItemSet& aSet, const SfxItemPropertySimpleEntry* pMap )
+{
+ Any aAny( SvxItemPropertySet_getPropertyValue( *mpPropSet, pMap, aSet ) );
+
+ if( *pMap->pType != aAny.getValueType() )
+ {
+ // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
+ if( ( *pMap->pType == ::getCppuType((const sal_Int16*)0)) && aAny.getValueType() == ::getCppuType((const sal_Int32*)0) )
+ {
+ sal_Int32 nValue = 0;
+ aAny >>= nValue;
+ aAny <<= (sal_Int16)nValue;
+ }
+ else
+ {
+ DBG_ERROR("GetAnyForItem() Returnvalue has wrong Type!" );
+ }
+ }
+
+ return aAny;
+}
+
+Reference< XPropertySetInfo > SAL_CALL Cell::getPropertySetInfo() throw(RuntimeException)
+{
+ return mpPropSet->getPropertySetInfo();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL Cell::setPropertyValue( const OUString& rPropertyName, const Any& rValue ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( (mpProperties == 0) || (GetModel() == 0) )
+ throw DisposedException();
+
+ const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(rPropertyName);
+ if( pMap )
+ {
+ if( (pMap->nFlags & PropertyAttribute::READONLY ) != 0 )
+ throw PropertyVetoException();
+
+ switch( pMap->nWID )
+ {
+ case OWN_ATTR_STYLE:
+ {
+ Reference< XStyle > xStyle;
+ if( !( rValue >>= xStyle ) )
+ throw IllegalArgumentException();
+
+ SfxUnoStyleSheet* pStyle = SfxUnoStyleSheet::getUnoStyleSheet(xStyle);
+ SetStyleSheet( pStyle, sal_True );
+ return;
+ }
+ case OWN_ATTR_TABLEBORDER:
+ {
+ if(rValue.getValueType() != ::getCppuType((const TableBorder*)0) )
+ break;
+
+ const TableBorder* pBorder = (const TableBorder* )rValue.getValue();
+ if( pBorder == NULL )
+ break;
+
+ SvxBoxItem aBox( SDRATTR_TABLE_BORDER );
+ SvxBoxInfoItem aBoxInfo( SDRATTR_TABLE_BORDER_INNER );
+ SvxBorderLine aLine;
+
+ sal_Bool bSet = SvxBoxItem::LineToSvxLine(pBorder->TopLine, aLine, false);
+ aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_TOP);
+ aBoxInfo.SetValid(VALID_TOP, pBorder->IsTopLineValid);
+
+ bSet = SvxBoxItem::LineToSvxLine(pBorder->BottomLine, aLine, false);
+ aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_BOTTOM);
+ aBoxInfo.SetValid(VALID_BOTTOM, pBorder->IsBottomLineValid);
+
+ bSet = SvxBoxItem::LineToSvxLine(pBorder->LeftLine, aLine, false);
+ aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_LEFT);
+ aBoxInfo.SetValid(VALID_LEFT, pBorder->IsLeftLineValid);
+
+ bSet = SvxBoxItem::LineToSvxLine(pBorder->RightLine, aLine, false);
+ aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_RIGHT);
+ aBoxInfo.SetValid(VALID_RIGHT, pBorder->IsRightLineValid);
+
+ bSet = SvxBoxItem::LineToSvxLine(pBorder->HorizontalLine, aLine, false);
+ aBoxInfo.SetLine(bSet ? &aLine : 0, BOXINFO_LINE_HORI);
+ aBoxInfo.SetValid(VALID_HORI, pBorder->IsHorizontalLineValid);
+
+ bSet = SvxBoxItem::LineToSvxLine(pBorder->VerticalLine, aLine, false);
+ aBoxInfo.SetLine(bSet ? &aLine : 0, BOXINFO_LINE_VERT);
+ aBoxInfo.SetValid(VALID_VERT, pBorder->IsVerticalLineValid);
+
+ aBox.SetDistance(pBorder->Distance, false);
+ aBoxInfo.SetValid(VALID_DISTANCE, pBorder->IsDistanceValid);
+
+ mpProperties->SetObjectItem(aBox);
+ mpProperties->SetObjectItem(aBoxInfo);
+ return;
+ }
+ case OWN_ATTR_FILLBMP_MODE:
+ {
+ BitmapMode eMode;
+ if(!(rValue >>= eMode) )
+ {
+ sal_Int32 nMode = 0;
+ if(!(rValue >>= nMode))
+ throw IllegalArgumentException();
+
+ eMode = (BitmapMode)nMode;
+ }
+
+ mpProperties->SetObjectItem( XFillBmpStretchItem( eMode == BitmapMode_STRETCH ) );
+ mpProperties->SetObjectItem( XFillBmpTileItem( eMode == BitmapMode_REPEAT ) );
+ return;
+ }
+ default:
+ {
+ SfxItemSet aSet( GetModel()->GetItemPool(), pMap->nWID, pMap->nWID);
+ aSet.Put(mpProperties->GetItem(pMap->nWID));
+
+ bool bSpecial = false;
+
+ switch( pMap->nWID )
+ {
+ case XATTR_FILLBITMAP:
+ case XATTR_FILLGRADIENT:
+ case XATTR_FILLHATCH:
+ case XATTR_FILLFLOATTRANSPARENCE:
+ case XATTR_LINEEND:
+ case XATTR_LINESTART:
+ case XATTR_LINEDASH:
+ {
+ if( pMap->nMemberId == MID_NAME )
+ {
+ OUString aApiName;
+ if( rValue >>= aApiName )
+ {
+ if( SvxShape::SetFillAttribute( pMap->nWID, aApiName, aSet, GetModel() ) )
+ bSpecial = true;
+ }
+ }
+ }
+ break;
+ }
+
+ if( !bSpecial )
+ {
+
+ if( !SvxUnoTextRangeBase::SetPropertyValueHelper( aSet, pMap, rValue, aSet ))
+ {
+ if( aSet.GetItemState( pMap->nWID ) != SFX_ITEM_SET )
+ {
+ // Default aus ItemPool holen
+ if(GetModel()->GetItemPool().IsWhich(pMap->nWID))
+ aSet.Put(GetModel()->GetItemPool().GetDefaultItem(pMap->nWID));
+ }
+
+ if( aSet.GetItemState( pMap->nWID ) == SFX_ITEM_SET )
+ {
+ SvxItemPropertySet_setPropertyValue( *mpPropSet, pMap, rValue, aSet );
+ }
+ }
+ }
+
+ GetModel()->SetChanged();
+ mpProperties->SetMergedItemSetAndBroadcast( aSet );
+ return;
+ }
+ }
+ }
+ throw UnknownPropertyException();
+}
+
+// -----------------------------------------------------------------------------
+
+Any SAL_CALL Cell::getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( (mpProperties == 0) || (GetModel() == 0) )
+ throw DisposedException();
+
+ const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
+ if( pMap )
+ {
+ switch( pMap->nWID )
+ {
+/*
+ case OWN_ATTR_HASLEVELS:
+ {
+ return Any( hasLevels() );
+ }
+*/
+ case OWN_ATTR_STYLE:
+ {
+ return Any( Reference< XStyle >( dynamic_cast< SfxUnoStyleSheet* >( GetStyleSheet() ) ) );
+ }
+ case OWN_ATTR_TABLEBORDER:
+ {
+ const SvxBoxInfoItem& rBoxInfoItem = static_cast<const SvxBoxInfoItem&>(mpProperties->GetItem(SDRATTR_TABLE_BORDER_INNER));
+ const SvxBoxItem& rBox = static_cast<const SvxBoxItem&>(mpProperties->GetItem(SDRATTR_TABLE_BORDER));
+
+ TableBorder aTableBorder;
+ aTableBorder.TopLine = SvxBoxItem::SvxLineToLine(rBox.GetTop(), false);
+ aTableBorder.IsTopLineValid = rBoxInfoItem.IsValid(VALID_TOP);
+ aTableBorder.BottomLine = SvxBoxItem::SvxLineToLine(rBox.GetBottom(), false);
+ aTableBorder.IsBottomLineValid = rBoxInfoItem.IsValid(VALID_BOTTOM);
+ aTableBorder.LeftLine = SvxBoxItem::SvxLineToLine(rBox.GetLeft(), false);
+ aTableBorder.IsLeftLineValid = rBoxInfoItem.IsValid(VALID_LEFT);
+ aTableBorder.RightLine = SvxBoxItem::SvxLineToLine(rBox.GetRight(), false);
+ aTableBorder.IsRightLineValid = rBoxInfoItem.IsValid(VALID_RIGHT );
+ aTableBorder.HorizontalLine = SvxBoxItem::SvxLineToLine(rBoxInfoItem.GetHori(), false);
+ aTableBorder.IsHorizontalLineValid = rBoxInfoItem.IsValid(VALID_HORI);
+ aTableBorder.VerticalLine = SvxBoxItem::SvxLineToLine(rBoxInfoItem.GetVert(), false);
+ aTableBorder.IsVerticalLineValid = rBoxInfoItem.IsValid(VALID_VERT);
+ aTableBorder.Distance = rBox.GetDistance();
+ aTableBorder.IsDistanceValid = rBoxInfoItem.IsValid(VALID_DISTANCE);
+
+ return Any( aTableBorder );
+ }
+ case OWN_ATTR_FILLBMP_MODE:
+ {
+ const XFillBmpStretchItem& rStretchItem = static_cast<const XFillBmpStretchItem&>(mpProperties->GetItem(XATTR_FILLBMP_STRETCH));
+ const XFillBmpTileItem& rTileItem = static_cast<const XFillBmpTileItem&>(mpProperties->GetItem(XATTR_FILLBMP_TILE));
+ if( rTileItem.GetValue() )
+ {
+ return Any( BitmapMode_REPEAT );
+ }
+ else if( rStretchItem.GetValue() )
+ {
+ return Any( BitmapMode_STRETCH );
+ }
+ else
+ {
+ return Any( BitmapMode_NO_REPEAT );
+ }
+ }
+ default:
+ {
+ SfxItemSet aSet( GetModel()->GetItemPool(), pMap->nWID, pMap->nWID);
+ aSet.Put(mpProperties->GetItem(pMap->nWID));
+
+ Any aAny;
+ if(!SvxUnoTextRangeBase::GetPropertyValueHelper( aSet, pMap, aAny ))
+ {
+ if(!aSet.Count())
+ {
+ // Default aus ItemPool holen
+ if(GetModel()->GetItemPool().IsWhich(pMap->nWID))
+ aSet.Put(GetModel()->GetItemPool().GetDefaultItem(pMap->nWID));
+ }
+
+ if( aSet.Count() )
+ aAny = GetAnyForItem( aSet, pMap );
+ }
+
+ return aAny;
+ }
+ }
+ }
+ throw UnknownPropertyException();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL Cell::addPropertyChangeListener( const OUString& /*aPropertyName*/, const Reference< XPropertyChangeListener >& /*xListener*/ ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL Cell::removePropertyChangeListener( const OUString& /*aPropertyName*/, const Reference< XPropertyChangeListener >& /*aListener*/ ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL Cell::addVetoableChangeListener( const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener >& /*aListener*/ ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL Cell::removeVetoableChangeListener( const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener >& /*aListener*/ ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+// XMultiPropertySet
+// -----------------------------------------------------------------------------
+
+void SAL_CALL Cell::setPropertyValues( const Sequence< OUString >& aPropertyNames, const Sequence< Any >& aValues ) throw (PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ if( (mpProperties == 0) || (GetModel() == 0) )
+ throw DisposedException();
+
+ const sal_Int32 nCount = aPropertyNames.getLength();
+
+ const OUString* pNames = aPropertyNames.getConstArray();
+ const Any* pValues = aValues.getConstArray();
+
+ for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pNames++, pValues++ )
+ {
+ try
+ {
+ setPropertyValue( *pNames, *pValues );
+ }
+ catch( UnknownPropertyException& )
+ {
+ DBG_ERROR("svx::Cell::setPropertyValues(), unknown property!" );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("svx::Cell::setPropertyValues(), Exception caught!" );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< Any > SAL_CALL Cell::getPropertyValues( const Sequence< OUString >& aPropertyNames ) throw (RuntimeException)
+{
+ OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ if( (mpProperties == 0) || (GetModel() == 0) )
+ throw DisposedException();
+
+ const sal_Int32 nCount = aPropertyNames.getLength();
+ const OUString* pNames = aPropertyNames.getConstArray();
+
+ Sequence< Any > aRet( nCount );
+ Any* pValue = aRet.getArray();
+
+ for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pValue++, pNames++ )
+ {
+ try
+ {
+ *pValue = getPropertyValue( *pNames );
+ }
+ catch( UnknownPropertyException& )
+ {
+ DBG_ERROR("svx::Cell::setPropertyValues(), unknown property!" );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "svx::Cell::getPropertyValues(), Exception caught!" );
+ }
+ }
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL Cell::addPropertiesChangeListener( const Sequence< OUString >& /*aPropertyNames*/, const Reference< XPropertiesChangeListener >& /*xListener*/ ) throw (RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL Cell::removePropertiesChangeListener( const Reference< XPropertiesChangeListener >& /*xListener*/ ) throw (RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL Cell::firePropertiesChangeEvent( const Sequence< OUString >& /*aPropertyNames*/, const Reference< XPropertiesChangeListener >& /*xListener*/ ) throw (RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+// XPropertyState
+// -----------------------------------------------------------------------------
+
+PropertyState SAL_CALL Cell::getPropertyState( const OUString& PropertyName ) throw(UnknownPropertyException, RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( (mpProperties == 0) || (GetModel() == 0) )
+ throw DisposedException();
+
+ const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
+
+ if( pMap )
+ {
+ PropertyState eState;
+ switch( pMap->nWID )
+ {
+ case OWN_ATTR_FILLBMP_MODE:
+ {
+ const SfxItemSet& rSet = mpProperties->GetMergedItemSet();
+
+ const bool bStretch = rSet.GetItemState( XATTR_FILLBMP_STRETCH, false ) == SFX_ITEM_SET;
+ const bool bTile = rSet.GetItemState( XATTR_FILLBMP_TILE, false ) == SFX_ITEM_SET;
+ if( bStretch || bTile )
+ {
+ eState = PropertyState_DIRECT_VALUE;
+ }
+ else
+ {
+ eState = PropertyState_DEFAULT_VALUE;
+ }
+ }
+/*
+ case OWN_ATTR_HASLEVELS:
+ {
+ return PropertyState_DIRECT_VALUE;
+ }
+*/
+ case OWN_ATTR_STYLE:
+ {
+ return PropertyState_DIRECT_VALUE;
+ }
+ case OWN_ATTR_TABLEBORDER:
+ {
+ const SfxItemSet& rSet = mpProperties->GetMergedItemSet();
+ if( (rSet.GetItemState( SDRATTR_TABLE_BORDER_INNER, sal_False ) == SFX_ITEM_DEFAULT) && (rSet.GetItemState( SDRATTR_TABLE_BORDER, sal_False ) == SFX_ITEM_DEFAULT) )
+ return PropertyState_DEFAULT_VALUE;
+
+ return PropertyState_DIRECT_VALUE;
+ }
+ default:
+ {
+ const SfxItemSet& rSet = mpProperties->GetMergedItemSet();
+
+ switch( rSet.GetItemState( pMap->nWID, sal_False ) )
+ {
+ case SFX_ITEM_READONLY:
+ case SFX_ITEM_SET:
+ eState = PropertyState_DIRECT_VALUE;
+ break;
+ case SFX_ITEM_DEFAULT:
+ eState = PropertyState_DEFAULT_VALUE;
+ break;
+ // case SFX_ITEM_UNKNOWN:
+ // case SFX_ITEM_DONTCARE:
+ // case SFX_ITEM_DISABLED:
+ default:
+ eState = PropertyState_AMBIGUOUS_VALUE;
+ break;
+ }
+
+ // if a item is set, this doesn't mean we want it :)
+ if( ( PropertyState_DIRECT_VALUE == eState ) )
+ {
+ switch( pMap->nWID )
+ {
+ // the following items are disabled by changing the
+ // fill style or the line style. so there is no need
+ // to export items without names which should be empty
+ case XATTR_FILLBITMAP:
+ case XATTR_FILLGRADIENT:
+ case XATTR_FILLHATCH:
+ case XATTR_LINEDASH:
+ {
+ NameOrIndex* pItem = (NameOrIndex*)rSet.GetItem((sal_uInt16)pMap->nWID);
+ if( ( pItem == NULL ) || ( pItem->GetName().Len() == 0) )
+ eState = PropertyState_DEFAULT_VALUE;
+ }
+ break;
+
+ // #i36115#
+ // If e.g. the LineStart is on NONE and thus the string has length 0, it still
+ // may be a hard attribute covering the set LineStart of the parent (Style).
+ // #i37644#
+ // same is for fill float transparency
+ case XATTR_LINEEND:
+ case XATTR_LINESTART:
+ case XATTR_FILLFLOATTRANSPARENCE:
+ {
+ NameOrIndex* pItem = (NameOrIndex*)rSet.GetItem((sal_uInt16)pMap->nWID);
+ if( ( pItem == NULL ) )
+ eState = PropertyState_DEFAULT_VALUE;
+ }
+ break;
+ }
+ }
+ }
+ }
+ return eState;
+ }
+ throw UnknownPropertyException();
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< PropertyState > SAL_CALL Cell::getPropertyStates( const Sequence< OUString >& aPropertyName ) throw(UnknownPropertyException, RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( (mpProperties == 0) || (GetModel() == 0) )
+ throw DisposedException();
+
+ const sal_Int32 nCount = aPropertyName.getLength();
+
+ Sequence< PropertyState > aRet( nCount );
+
+ const OUString* pNames = aPropertyName.getConstArray();
+ PropertyState* pState = aRet.getArray();
+
+ for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pNames++, pState++ )
+ {
+ try
+ {
+ *pState = getPropertyState( *pNames );
+ }
+ catch( Exception& )
+ {
+ *pState = PropertyState_AMBIGUOUS_VALUE;
+ }
+ }
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL Cell::setPropertyToDefault( const OUString& PropertyName ) throw(UnknownPropertyException, RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( (mpProperties == 0) || (GetModel() == 0) )
+ throw DisposedException();
+
+ const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
+ if( pMap )
+ {
+ switch( pMap->nWID )
+ {
+ case OWN_ATTR_FILLBMP_MODE:
+ {
+ mpProperties->ClearObjectItem( XATTR_FILLBMP_STRETCH );
+ mpProperties->ClearObjectItem( XATTR_FILLBMP_TILE );
+ break;
+ }
+// case OWN_ATTR_HASLEVELS:
+ case OWN_ATTR_STYLE:
+ break;
+
+ case OWN_ATTR_TABLEBORDER:
+ {
+ mpProperties->ClearObjectItem( SDRATTR_TABLE_BORDER_INNER );
+ mpProperties->ClearObjectItem( SDRATTR_TABLE_BORDER );
+ break;
+ }
+
+ default:
+ {
+ mpProperties->ClearObjectItem( pMap->nWID );
+ }
+ }
+
+ GetModel()->SetChanged();
+ return;
+ }
+ throw UnknownPropertyException();
+}
+
+// -----------------------------------------------------------------------------
+
+Any SAL_CALL Cell::getPropertyDefault( const OUString& aPropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( (mpProperties == 0) || (GetModel() == 0) )
+ throw DisposedException();
+
+ const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(aPropertyName);
+ if( pMap )
+ {
+ switch( pMap->nWID )
+ {
+ case OWN_ATTR_FILLBMP_MODE:
+ return Any( BitmapMode_NO_REPEAT );
+
+/*
+ case OWN_ATTR_HASLEVELS:
+ return Any( sal_False );
+*/
+ case OWN_ATTR_STYLE:
+ {
+ Reference< XStyle > xStyle;
+ return Any( xStyle );
+ }
+
+ case OWN_ATTR_TABLEBORDER:
+ {
+ TableBorder aBorder;
+ return Any( aBorder );
+ }
+
+ default:
+ {
+ if( GetModel()->GetItemPool().IsWhich(pMap->nWID) )
+ {
+ SfxItemSet aSet( GetModel()->GetItemPool(), pMap->nWID, pMap->nWID);
+ aSet.Put(GetModel()->GetItemPool().GetDefaultItem(pMap->nWID));
+ return GetAnyForItem( aSet, pMap );
+ }
+ }
+ }
+ }
+ throw UnknownPropertyException();
+}
+
+// -----------------------------------------------------------------------------
+// XMultiPropertyStates
+// -----------------------------------------------------------------------------
+
+void SAL_CALL Cell::setAllPropertiesToDefault( ) throw (RuntimeException)
+{
+ if( mpProperties )
+ delete mpProperties;
+ mpProperties = new sdr::properties::CellProperties( static_cast< SdrTableObj& >( GetObject() ), this );
+
+ SdrOutliner& rOutliner = GetObject().ImpGetDrawOutliner();
+
+ OutlinerParaObject* pParaObj = GetOutlinerParaObject();
+ if( pParaObj )
+ {
+ rOutliner.SetText(*pParaObj);
+ sal_uInt32 nParaCount(rOutliner.GetParagraphCount());
+
+ if(nParaCount)
+ {
+ ESelection aSelection( 0, 0, EE_PARA_ALL, EE_PARA_ALL);
+ rOutliner.RemoveAttribs(aSelection, sal_True, 0);
+
+ OutlinerParaObject* pTemp = rOutliner.CreateParaObject(0, (sal_uInt16)nParaCount);
+ rOutliner.Clear();
+
+ SetOutlinerParaObject(pTemp);
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL Cell::setPropertiesToDefault( const Sequence< OUString >& aPropertyNames ) throw (UnknownPropertyException, RuntimeException)
+{
+ sal_Int32 nCount = aPropertyNames.getLength();
+ const OUString* pName = aPropertyNames.getConstArray();
+
+ while(nCount--)
+ setPropertyToDefault( *pName++ );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< Any > SAL_CALL Cell::getPropertyDefaults( const Sequence< OUString >& aPropertyNames ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ sal_Int32 nCount = aPropertyNames.getLength();
+ Sequence< Any > aDefaults( nCount );
+ Any* pDefaults = aDefaults.getArray();
+ const OUString* pName = aPropertyNames.getConstArray();
+
+ while(nCount--)
+ *pDefaults++ = getPropertyDefault( *pName++ );
+
+ return aDefaults;
+}
+
+// -----------------------------------------------------------------------------
+// XFastPropertySet
+// -----------------------------------------------------------------------------
+
+void SAL_CALL Cell::setFastPropertyValue( sal_Int32 nHandle, const Any& aValue ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ (void)aValue;
+ (void)nHandle;
+ throw UnknownPropertyException();
+}
+
+// -----------------------------------------------------------------------------
+// TODO: Refactor this method!
+Any SAL_CALL Cell::getFastPropertyValue( sal_Int32 nHandle ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ (void)nHandle;
+ throw UnknownPropertyException();
+}
+
+// -----------------------------------------------------------------------------
+// XText
+// -----------------------------------------------------------------------------
+
+void SAL_CALL Cell::insertTextContent( const Reference< XTextRange >& xRange, const Reference< XTextContent >& xContent, sal_Bool bAbsorb ) throw (IllegalArgumentException, RuntimeException)
+{
+ SvxUnoTextBase::insertTextContent( xRange, xContent, bAbsorb );
+ notifyModified();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL Cell::removeTextContent( const Reference< XTextContent >& xContent ) throw (NoSuchElementException, RuntimeException)
+{
+ SvxUnoTextBase::removeTextContent( xContent );
+ notifyModified();
+}
+
+// -----------------------------------------------------------------------------
+// XSimpleText
+// -----------------------------------------------------------------------------
+
+Reference< XTextCursor > SAL_CALL Cell::createTextCursor( ) throw (RuntimeException)
+{
+ return SvxUnoTextBase::createTextCursor();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XTextCursor > SAL_CALL Cell::createTextCursorByRange( const Reference< XTextRange >& aTextPosition ) throw (RuntimeException)
+{
+ return SvxUnoTextBase::createTextCursorByRange( aTextPosition );
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL Cell::insertString( const Reference< XTextRange >& xRange, const OUString& aString, sal_Bool bAbsorb ) throw (RuntimeException)
+{
+ SvxUnoTextBase::insertString( xRange, aString, bAbsorb );
+ notifyModified();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL Cell::insertControlCharacter( const Reference< XTextRange >& xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb ) throw (IllegalArgumentException, RuntimeException)
+{
+ SvxUnoTextBase::insertControlCharacter( xRange, nControlCharacter, bAbsorb );
+ notifyModified();
+}
+
+// -----------------------------------------------------------------------------
+// XTextRange
+// -----------------------------------------------------------------------------
+
+Reference< XText > SAL_CALL Cell::getText( ) throw (RuntimeException)
+{
+ return SvxUnoTextBase::getText();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XTextRange > SAL_CALL Cell::getStart( ) throw (RuntimeException)
+{
+ return SvxUnoTextBase::getStart();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XTextRange > SAL_CALL Cell::getEnd( ) throw (RuntimeException)
+{
+ return SvxUnoTextBase::getEnd();
+}
+
+// -----------------------------------------------------------------------------
+
+OUString SAL_CALL Cell::getString( ) throw (RuntimeException)
+{
+ maSelection.nStartPara = 0xffff;
+ return SvxUnoTextBase::getString();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL Cell::setString( const OUString& aString ) throw (RuntimeException)
+{
+ SvxUnoTextBase::setString( aString );
+ notifyModified();
+}
+
+// XEventListener
+void SAL_CALL Cell::disposing( const EventObject& /*Source*/ ) throw (RuntimeException)
+{
+ mxTable.clear();
+ dispose();
+}
+
+static OUString getCellName( sal_Int32 nCol, sal_Int32 nRow )
+{
+ rtl::OUStringBuffer aBuf;
+
+ if (nCol < 26*26)
+ {
+ if (nCol < 26)
+ aBuf.append( static_cast<sal_Unicode>( 'A' +
+ static_cast<sal_uInt16>(nCol)));
+ else
+ {
+ aBuf.append( static_cast<sal_Unicode>( 'A' +
+ (static_cast<sal_uInt16>(nCol) / 26) - 1));
+ aBuf.append( static_cast<sal_Unicode>( 'A' +
+ (static_cast<sal_uInt16>(nCol) % 26)));
+ }
+ }
+ else
+ {
+ String aStr;
+ while (nCol >= 26)
+ {
+ sal_Int32 nC = nCol % 26;
+ aStr += static_cast<sal_Unicode>( 'A' +
+ static_cast<sal_uInt16>(nC));
+ nCol = nCol - nC;
+ nCol = nCol / 26 - 1;
+ }
+ aStr += static_cast<sal_Unicode>( 'A' +
+ static_cast<sal_uInt16>(nCol));
+ aStr.Reverse();
+ aBuf.append( aStr);
+ }
+ aBuf.append( OUString::valueOf(nRow+1) );
+ return aBuf.makeStringAndClear();
+}
+
+OUString Cell::getName()
+{
+ // todo: optimize!
+ OUString sName;
+ if( mxTable.is() ) try
+ {
+ Reference< XCell > xThis( static_cast< XCell* >( this ) );
+
+ sal_Int32 nRowCount = mxTable->getRowCount();
+ sal_Int32 nColCount = mxTable->getColumnCount();
+ for( sal_Int32 nRow = 0; nRow < nRowCount; nRow++ )
+ {
+ for( sal_Int32 nCol = 0; nCol < nColCount; nCol++ )
+ {
+ Reference< XCell > xCell( mxTable->getCellByPosition( nCol, nRow ) );
+ if( xCell == xThis )
+ {
+ return getCellName( nCol, nRow );
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ }
+
+ return sName;
+}
+
+} }
+
diff --git a/svx/source/table/cell.hxx b/svx/source/table/cell.hxx
new file mode 100644
index 000000000000..9bd2e9440d8c
--- /dev/null
+++ b/svx/source/table/cell.hxx
@@ -0,0 +1,244 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_CELL_HXX_
+#define _SVX_CELL_HXX_
+
+#include <com/sun/star/table/XMergeableCell.hpp>
+#include <com/sun/star/awt/XLayoutConstrains.hpp>
+#include <com/sun/star/beans/XMultiPropertyStates.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+
+#include <rtl/ref.hxx>
+#include <svl/style.hxx>
+#include "svx/sdtaitm.hxx"
+#include "tablemodel.hxx"
+#include "editeng/unotext.hxx"
+#include "svx/svdtext.hxx"
+
+// -----------------------------------------------------------------------------
+
+class SfxItemSet;
+class OutlinerParaObject;
+class SdrObject;
+
+namespace sdr { namespace properties {
+ class TextProperties;
+} }
+
+// -----------------------------------------------------------------------------
+
+namespace sdr { namespace table {
+
+// -----------------------------------------------------------------------------
+
+class SVX_DLLPUBLIC Cell : public SdrText,
+ public SvxUnoTextBase,
+ public ::com::sun::star::table::XMergeableCell,
+ public ::com::sun::star::awt::XLayoutConstrains,
+ public ::com::sun::star::lang::XEventListener,
+ public ::cppu::OWeakObject
+{
+ friend class CellUndo;
+
+public:
+ SVX_DLLPRIVATE static rtl::Reference< Cell > create( SdrTableObj& rTableObj, OutlinerParaObject* pOutlinerParaObject );
+
+ // private
+ SVX_DLLPRIVATE void dispose();
+
+ // SdrTextShape proxy
+ bool IsTextEditActive();
+ SVX_DLLPRIVATE bool hasText() const;
+
+ SVX_DLLPRIVATE void cloneFrom( const CellRef& rCell );
+
+ SVX_DLLPRIVATE void setCellRect( ::Rectangle& rCellRect ) { maCellRect = rCellRect; }
+ SVX_DLLPRIVATE const ::Rectangle& getCellRect() const { return maCellRect; }
+ SVX_DLLPRIVATE ::Rectangle& getCellRect() { return maCellRect; }
+
+ OutlinerParaObject* GetEditOutlinerParaObject() const;
+ SVX_DLLPRIVATE void SetStyleSheet( SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr );
+ SVX_DLLPRIVATE virtual SfxStyleSheet* GetStyleSheet() const;
+ SfxStyleSheetPool* GetStyleSheetPool() const;
+ SVX_DLLPRIVATE virtual const Rectangle& GetCurrentBoundRect() const;
+ SVX_DLLPRIVATE virtual void TakeTextAnchorRect(Rectangle& rAnchorRect) const;
+
+ SVX_DLLPRIVATE virtual const SfxItemSet& GetItemSet() const;
+ SVX_DLLPRIVATE void SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, sal_Bool bClearAllItems);
+ void SetMergedItem(const SfxPoolItem& rItem);
+
+ SVX_DLLPRIVATE sal_Int32 getMinimumWidth();
+ SVX_DLLPRIVATE sal_Int32 getMinimumHeight();
+
+ SVX_DLLPRIVATE long GetTextLeftDistance() const;
+ SVX_DLLPRIVATE long GetTextRightDistance() const;
+ SVX_DLLPRIVATE long GetTextUpperDistance() const;
+ SVX_DLLPRIVATE long GetTextLowerDistance() const;
+
+ SVX_DLLPRIVATE SdrTextVertAdjust GetTextVerticalAdjust() const;
+ SdrTextHorzAdjust GetTextHorizontalAdjust() const;
+
+ SVX_DLLPRIVATE virtual void SetModel(SdrModel* pNewModel);
+
+ SVX_DLLPRIVATE void merge( sal_Int32 nColumnSpan, sal_Int32 nRowSpan );
+ SVX_DLLPRIVATE void mergeContent( const CellRef& xSourceCell );
+ SVX_DLLPRIVATE void replaceContentAndFormating( const CellRef& xSourceCell );
+
+ SVX_DLLPRIVATE void setMerged();
+
+ // XInterface
+ SVX_DLLPRIVATE virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& Type ) throw (::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual void SAL_CALL acquire() throw ();
+ SVX_DLLPRIVATE virtual void SAL_CALL release() throw ();
+
+ // XTypeProvider
+ SVX_DLLPRIVATE virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ SVX_DLLPRIVATE virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XLayoutConstrains
+ SVX_DLLPRIVATE virtual ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw (::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw (::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XMergeableCell
+ SVX_DLLPRIVATE virtual ::sal_Int32 SAL_CALL getRowSpan() throw (::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual ::sal_Int32 SAL_CALL getColumnSpan() throw (::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual ::sal_Bool SAL_CALL isMerged() throw (::com::sun::star::uno::RuntimeException);
+
+ // XCell
+ SVX_DLLPRIVATE virtual ::rtl::OUString SAL_CALL getFormula() throw (::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual void SAL_CALL setFormula( const ::rtl::OUString& aFormula ) throw (::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual double SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual void SAL_CALL setValue( double nValue ) throw (::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual ::com::sun::star::table::CellContentType SAL_CALL getType() throw (::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual sal_Int32 SAL_CALL getError() throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XPropertySet
+ SVX_DLLPRIVATE virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XMultiPropertySet
+ SVX_DLLPRIVATE virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XPropertyState
+ SVX_DLLPRIVATE virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XMultiPropertyStates
+ SVX_DLLPRIVATE virtual void SAL_CALL setAllPropertiesToDefault( ) throw (::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual void SAL_CALL setPropertiesToDefault( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyDefaults( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XFastPropertySet
+ SVX_DLLPRIVATE virtual void SAL_CALL setFastPropertyValue( ::sal_Int32 nHandle, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue( ::sal_Int32 nHandle ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XText
+ SVX_DLLPRIVATE virtual void SAL_CALL insertTextContent( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >& xContent, ::sal_Bool bAbsorb ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual void SAL_CALL removeTextContent( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >& xContent ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+
+ // XSimpleText
+ SVX_DLLPRIVATE virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursor( ) throw (::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursorByRange( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& aTextPosition ) throw (::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual void SAL_CALL insertString( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, const ::rtl::OUString& aString, ::sal_Bool bAbsorb ) throw (::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual void SAL_CALL insertControlCharacter( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, ::sal_Int16 nControlCharacter, ::sal_Bool bAbsorb ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ // XTextRange
+ SVX_DLLPRIVATE virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText( ) throw (::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getStart( ) throw (::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd( ) throw (::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual ::rtl::OUString SAL_CALL getString( ) throw (::com::sun::star::uno::RuntimeException);
+ SVX_DLLPRIVATE virtual void SAL_CALL setString( const ::rtl::OUString& aString ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ SVX_DLLPRIVATE virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ SVX_DLLPRIVATE virtual void SetOutlinerParaObject( OutlinerParaObject* pTextObject );
+
+ SVX_DLLPRIVATE void AddUndo();
+
+ using SvxUnoTextRangeBase::setPropertyValue;
+ using SvxUnoTextRangeBase::getPropertyValue;
+
+ SVX_DLLPRIVATE sdr::properties::TextProperties* CloneProperties( SdrObject& rNewObj, Cell& rNewCell );
+
+ SVX_DLLPRIVATE static sdr::properties::TextProperties* CloneProperties( sdr::properties::TextProperties* pProperties, SdrObject& rNewObj, Cell& rNewCell );
+
+ SVX_DLLPRIVATE void notifyModified();
+
+ ::rtl::OUString getName();
+
+protected:
+ SVX_DLLPRIVATE virtual const SfxItemSet& GetObjectItemSet();
+ SVX_DLLPRIVATE virtual void SetObjectItem(const SfxPoolItem& rItem);
+
+ SVX_DLLPRIVATE ::com::sun::star::uno::Any GetAnyForItem( SfxItemSet& aSet, const SfxItemPropertySimpleEntry* pMap );
+
+private:
+ SVX_DLLPRIVATE Cell( SdrTableObj& rTableObj, OutlinerParaObject* pOutlinerParaObject ) throw();
+ SVX_DLLPRIVATE virtual ~Cell() throw();
+
+ const SvxItemPropertySet* mpPropSet;
+
+ sdr::properties::TextProperties* mpProperties;
+
+ ::com::sun::star::table::CellContentType mnCellContentType;
+
+ ::rtl::OUString msFormula;
+ double mfValue;
+ ::sal_Int32 mnError;
+ ::sal_Bool mbMerged;
+ ::sal_Int32 mnRowSpan;
+ ::sal_Int32 mnColSpan;
+
+ Rectangle maCellRect;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::table::XTable > mxTable;
+};
+
+// -----------------------------------------------------------------------------
+
+} }
+
+#endif
diff --git a/svx/source/table/cellcursor.cxx b/svx/source/table/cellcursor.cxx
new file mode 100644
index 000000000000..7fb3a7ffcf70
--- /dev/null
+++ b/svx/source/table/cellcursor.cxx
@@ -0,0 +1,590 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svx/svdotable.hxx"
+#include "cellcursor.hxx"
+#include "tablelayouter.hxx"
+#include "cell.hxx"
+#include "svx/svdmodel.hxx"
+#include "svx/svdstr.hrc"
+#include "svx/svdglob.hxx"
+
+// -----------------------------------------------------------------------------
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::table;
+
+// -----------------------------------------------------------------------------
+
+namespace sdr { namespace table {
+
+// -----------------------------------------------------------------------------
+// CellCursor
+// -----------------------------------------------------------------------------
+
+CellCursor::CellCursor( const TableModelRef & xTable, sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom )
+: CellCursorBase( xTable, nLeft, nTop, nRight, nBottom )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+CellCursor::~CellCursor()
+{
+}
+
+// -----------------------------------------------------------------------------
+// XCellCursor
+// -----------------------------------------------------------------------------
+
+Reference< XCell > SAL_CALL CellCursor::getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ return CellRange::getCellByPosition( nColumn, nRow );
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XCellRange > SAL_CALL CellCursor::getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ return CellRange::getCellRangeByPosition( nLeft, nTop, nRight, nBottom );
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XCellRange > SAL_CALL CellCursor::getCellRangeByName( const OUString& aRange ) throw (RuntimeException)
+{
+ return CellRange::getCellRangeByName( aRange );
+}
+
+// -----------------------------------------------------------------------------
+// XCellCursor
+// -----------------------------------------------------------------------------
+
+void SAL_CALL CellCursor::gotoStart( ) throw (RuntimeException)
+{
+ mnRight = mnLeft;
+ mnBottom = mnTop;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL CellCursor::gotoEnd( ) throw (RuntimeException)
+{
+ mnLeft = mnRight;
+ mnTop = mnBottom;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL CellCursor::gotoNext( ) throw (RuntimeException)
+{
+ if( mxTable.is() )
+ {
+ mnRight++;
+ if( mnRight >= mxTable->getColumnCount() )
+ {
+ // if we past the last column, try skip to the row line
+ mnTop++;
+ if( mnTop >= mxTable->getRowCount() )
+ {
+ // if we past the last row, do not move cursor at all
+ mnTop--;
+ mnRight--;
+ }
+ else
+ {
+ // restart at the first column on the next row
+ mnRight = 0;
+ }
+ }
+ }
+
+ mnLeft = mnRight;
+ mnTop = mnBottom;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL CellCursor::gotoPrevious( ) throw (RuntimeException)
+{
+ if( mxTable.is() )
+ {
+ if( mnLeft > 0 )
+ {
+ --mnLeft;
+ }
+ else if( mnTop > 0 )
+ {
+ --mnTop;
+ mnLeft = mxTable->getColumnCount() - 1;
+ }
+ }
+
+ mnRight = mnLeft;
+ mnBottom = mnTop;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL CellCursor::gotoOffset( ::sal_Int32 nColumnOffset, ::sal_Int32 nRowOffset ) throw (RuntimeException)
+{
+ if( mxTable.is() )
+ {
+ const sal_Int32 nLeft = mnLeft + nColumnOffset;
+ if( (nLeft >= 0) && (nLeft < mxTable->getColumnCount() ) )
+ mnRight = mnLeft = nLeft;
+
+ const sal_Int32 nTop = mnTop + nRowOffset;
+ if( (nTop >= 0) && (nTop < mxTable->getRowCount()) )
+ mnTop = mnBottom = nTop;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// XMergeableCellCursor
+// -----------------------------------------------------------------------------
+
+/** returns true and the merged cell positions if a merge is valid or false if a merge is
+ not valid for that range */
+bool CellCursor::GetMergedSelection( CellPos& rStart, CellPos& rEnd )
+{
+ rStart.mnCol = mnLeft; rStart.mnRow = mnTop;
+ rEnd.mnCol = mnRight; rEnd.mnRow = mnBottom;
+
+ // single cell merge is never valid
+ if( mxTable.is() && ((mnLeft != mnRight) || (mnTop != mnBottom)) ) try
+ {
+ CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( mnLeft, mnTop ).get() ) );
+
+ // check if first cell is merged
+ if( xCell.is() && xCell->isMerged() )
+ findMergeOrigin( mxTable, mnLeft, mnTop, rStart.mnCol, rStart.mnRow );
+
+ // check if last cell is merged
+ xCell.set( dynamic_cast< Cell* >( mxTable->getCellByPosition( mnRight, mnBottom ).get() ) );
+ if( xCell.is() )
+ {
+ 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() ) );
+ }
+ }
+ if( xCell.is() )
+ {
+ rEnd.mnCol += xCell->getColumnSpan()-1;
+ rEnd.mnRow += xCell->getRowSpan()-1;
+ }
+
+ // now check if everything is inside the given bounds
+ sal_Int32 nRow, nCol;
+ for( nRow = rStart.mnRow; nRow <= rEnd.mnRow; nRow++ )
+ {
+ for( nCol = rStart.mnCol; nCol <= rEnd.mnCol; nCol++ )
+ {
+ xCell.set( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
+ if( !xCell.is() )
+ continue;
+
+ if( xCell->isMerged() )
+ {
+ sal_Int32 nOriginCol, nOriginRow;
+ if( findMergeOrigin( mxTable, nCol, nRow, nOriginCol, nOriginRow ) )
+ {
+ if( (nOriginCol < rStart.mnCol) || (nOriginRow < rStart.mnRow) )
+ return false;
+
+ xCell.set( dynamic_cast< Cell* >( mxTable->getCellByPosition( nOriginCol, nOriginRow ).get() ) );
+ if( xCell.is() )
+ {
+ nOriginCol += xCell->getColumnSpan()-1;
+ nOriginRow += xCell->getRowSpan()-1;
+
+ if( (nOriginCol > rEnd.mnCol) || (nOriginRow > rEnd.mnRow) )
+ return false;
+ }
+ }
+ }
+ else if( ((nCol + xCell->getColumnSpan() - 1) > rEnd.mnCol) || ((nRow + xCell->getRowSpan() - 1 ) > rEnd.mnRow) )
+ {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("sdr::table::SvmxTableController::GetMergedSelection(), exception caught!");
+ }
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL CellCursor::merge( ) throw (NoSupportException, RuntimeException)
+{
+ CellPos aStart, aEnd;
+ if( !GetMergedSelection( aStart, aEnd ) )
+ throw NoSupportException();
+
+ if( !mxTable.is() || (mxTable->getSdrTableObj() == 0) )
+ throw DisposedException();
+
+ SdrModel* pModel = mxTable->getSdrTableObj()->GetModel();
+ const bool bUndo = pModel && mxTable->getSdrTableObj()->IsInserted() && pModel->IsUndoEnabled();
+
+ if( bUndo )
+ pModel->BegUndo( ImpGetResStr(STR_TABLE_MERGE) );
+
+ try
+ {
+ mxTable->merge( aStart.mnCol, aStart.mnRow, aEnd.mnCol - aStart.mnCol + 1, aEnd.mnRow - aStart.mnRow + 1 );
+ mxTable->optimize();
+ mxTable->setModified(sal_True);
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("sdr::table::CellCursor::merge(), exception caught!");
+ }
+
+ if( bUndo )
+ pModel->EndUndo();
+
+ if( pModel )
+ pModel->SetChanged();
+}
+
+// -----------------------------------------------------------------------------
+
+void CellCursor::split_column( sal_Int32 nCol, sal_Int32 nColumns, std::vector< sal_Int32 >& rLeftOvers )
+{
+ const sal_Int32 nRowCount = mxTable->getRowCount();
+
+ sal_Int32 nNewCols = 0, nRow;
+
+ // first check how many columns we need to add
+ for( nRow = mnTop; nRow <= mnBottom; ++nRow )
+ {
+ CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
+ if( xCell.is() && !xCell->isMerged() )
+ nNewCols = std::max( nNewCols, nColumns - xCell->getColumnSpan() + 1 - rLeftOvers[nRow] );
+ }
+
+ if( nNewCols > 0 )
+ {
+ const OUString sWidth( RTL_CONSTASCII_USTRINGPARAM("Width") );
+ Reference< XTableColumns > xCols( mxTable->getColumns(), UNO_QUERY_THROW );
+ Reference< XPropertySet > xRefColumn( xCols->getByIndex( nCol ), UNO_QUERY_THROW );
+ sal_Int32 nWidth = 0;
+ xRefColumn->getPropertyValue( sWidth ) >>= nWidth;
+ const sal_Int32 nNewWidth = nWidth / (nNewCols + 1);
+
+ // reference column gets new width + rounding errors
+ xRefColumn->setPropertyValue( sWidth, Any( nWidth - (nNewWidth * nNewCols) ) );
+
+ xCols->insertByIndex( nCol + 1, nNewCols );
+ mnRight += nNewCols;
+
+ // distribute new width
+ for( sal_Int32 nNewCol = nCol + nNewCols; nNewCol > nCol; --nNewCol )
+ {
+ Reference< XPropertySet > xNewCol( xCols->getByIndex( nNewCol ), UNO_QUERY_THROW );
+ xNewCol->setPropertyValue( sWidth, Any( nNewWidth ) );
+ }
+ }
+
+ for( nRow = 0; nRow < nRowCount; ++nRow )
+ {
+ CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
+ if( !xCell.is() || xCell->isMerged() )
+ {
+ 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
+ {
+ sal_Int32 nRowSpan = xCell->getRowSpan() - 1;
+ sal_Int32 nColSpan = xCell->getColumnSpan() - 1;
+
+ if( (nRow >= mnTop) && (nRow <= mnBottom) )
+ {
+ sal_Int32 nCellsAvailable = 1 + nColSpan + rLeftOvers[nRow];
+ if( nColSpan == 0 )
+ nCellsAvailable += nNewCols;
+
+ DBG_ASSERT( nCellsAvailable > nColumns, "sdr::table::CellCursor::split_column(), somethings wrong" );
+
+ sal_Int32 nSplitSpan = (nCellsAvailable / (nColumns + 1)) - 1;
+
+ sal_Int32 nSplitCol = nCol;
+ sal_Int32 nSplits = nColumns + 1;
+ while( nSplits-- )
+ {
+ // last split eats rounding cells
+ if( nSplits == 0 )
+ nSplitSpan = nCellsAvailable - ((nSplitSpan+1) * nColumns) - 1;
+
+ mxTable->merge( nSplitCol, nRow, nSplitSpan + 1, nRowSpan + 1);
+ if( nSplits > 0 )
+ nSplitCol += nSplitSpan + 1;
+ }
+
+ do
+ {
+ rLeftOvers[nRow++] = 0;
+ }
+ while( nRowSpan-- );
+ --nRow;
+ }
+ else
+ {
+ // cope with outside cells, merge if needed
+ if( nColSpan < (rLeftOvers[nRow] + nNewCols) )
+ mxTable->merge( nCol, nRow, (rLeftOvers[nRow] + nNewCols) + 1, nRowSpan + 1 );
+
+ do
+ {
+ rLeftOvers[nRow++] = 0; // consumed
+ }
+ while( nRowSpan-- );
+ --nRow;
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void CellCursor::split_horizontal( sal_Int32 nColumns )
+{
+ const sal_Int32 nRowCount = mxTable->getRowCount();
+
+ std::vector< sal_Int32 > aLeftOvers( nRowCount );
+
+ for( sal_Int32 nCol = mnRight; nCol >= mnLeft; --nCol )
+ split_column( nCol, nColumns, aLeftOvers );
+}
+
+// -----------------------------------------------------------------------------
+
+void CellCursor::split_row( sal_Int32 nRow, sal_Int32 nRows, std::vector< sal_Int32 >& rLeftOvers )
+{
+ const sal_Int32 nColCount = mxTable->getColumnCount();
+
+ sal_Int32 nNewRows = 0, nCol;
+
+ // first check how many columns we need to add
+ for( nCol = mnLeft; nCol <= mnRight; ++nCol )
+ {
+ CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
+ if( xCell.is() && !xCell->isMerged() )
+ nNewRows = std::max( nNewRows, nRows - xCell->getRowSpan() + 1 - rLeftOvers[nCol] );
+ }
+
+ if( nNewRows > 0 )
+ {
+ const OUString sHeight( RTL_CONSTASCII_USTRINGPARAM("Height") );
+ Reference< XTableRows > xRows( mxTable->getRows(), UNO_QUERY_THROW );
+ Reference< XPropertySet > xRefRow( xRows->getByIndex( nRow ), UNO_QUERY_THROW );
+ sal_Int32 nHeight = 0;
+ xRefRow->getPropertyValue( sHeight ) >>= nHeight;
+ const sal_Int32 nNewHeight = nHeight / (nNewRows + 1);
+
+ // reference row gets new height + rounding errors
+ xRefRow->setPropertyValue( sHeight, Any( nHeight - (nNewHeight * nNewRows) ) );
+
+ xRows->insertByIndex( nRow + 1, nNewRows );
+ mnBottom += nNewRows;
+
+ // distribute new width
+ for( sal_Int32 nNewRow = nRow + nNewRows; nNewRow > nRow; --nNewRow )
+ {
+ Reference< XPropertySet > xNewRow( xRows->getByIndex( nNewRow ), UNO_QUERY_THROW );
+ xNewRow->setPropertyValue( sHeight, Any( nNewHeight ) );
+ }
+ }
+
+ for( nCol = 0; nCol < nColCount; ++nCol )
+ {
+ CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
+ if( !xCell.is() || xCell->isMerged() )
+ {
+ 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
+ {
+ sal_Int32 nRowSpan = xCell->getRowSpan() - 1;
+ sal_Int32 nColSpan = xCell->getColumnSpan() - 1;
+
+ if( (nCol >= mnLeft) && (nCol <= mnRight) )
+ {
+ sal_Int32 nCellsAvailable = 1 + nRowSpan + rLeftOvers[nCol];
+ if( nRowSpan == 0 )
+ nCellsAvailable += nNewRows;
+
+ DBG_ASSERT( nCellsAvailable > nRows, "sdr::table::CellCursor::split_row(), somethings wrong" );
+
+ sal_Int32 nSplitSpan = (nCellsAvailable / (nRows + 1)) - 1;
+
+ sal_Int32 nSplitRow = nRow;
+ sal_Int32 nSplits = nRows + 1;
+ while( nSplits-- )
+ {
+ // last split eats rounding cells
+ if( nSplits == 0 )
+ nSplitSpan = nCellsAvailable - ((nSplitSpan+1) * nRows) - 1;
+
+ mxTable->merge( nCol, nSplitRow, nColSpan + 1, nSplitSpan + 1 );
+ if( nSplits > 0 )
+ nSplitRow += nSplitSpan + 1;
+ }
+
+ do
+ {
+ rLeftOvers[nCol++] = 0;
+ }
+ while( nColSpan-- );
+ --nCol;
+ }
+ else
+ {
+ // cope with outside cells, merge if needed
+ if( nRowSpan < (rLeftOvers[nCol] + nNewRows) )
+ mxTable->merge( nCol, nRow, nColSpan + 1, (rLeftOvers[nCol] + nNewRows) + 1 );
+
+ do
+ {
+ rLeftOvers[nCol++] = 0; // consumed
+ }
+ while( nColSpan-- );
+ --nCol;
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void CellCursor::split_vertical( sal_Int32 nRows )
+{
+ const sal_Int32 nColCount = mxTable->getColumnCount();
+
+ std::vector< sal_Int32 > aLeftOvers( nColCount );
+
+ for( sal_Int32 nRow = mnBottom; nRow >= mnTop; --nRow )
+ split_row( nRow, nRows, aLeftOvers );
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL CellCursor::split( sal_Int32 nColumns, sal_Int32 nRows ) throw (NoSupportException, IllegalArgumentException, RuntimeException)
+{
+ if( (nColumns < 0) || (nRows < 0) )
+ throw IllegalArgumentException();
+
+ if( !mxTable.is() || (mxTable->getSdrTableObj() == 0) )
+ throw DisposedException();
+
+ SdrModel* pModel = mxTable->getSdrTableObj()->GetModel();
+ const bool bUndo = pModel && mxTable->getSdrTableObj()->IsInserted() && pModel->IsUndoEnabled();
+ if( bUndo )
+ pModel->BegUndo( ImpGetResStr(STR_TABLE_SPLIT) );
+
+ try
+ {
+ if( nColumns > 0 )
+ split_horizontal( nColumns );
+
+ if( nRows > 0 )
+ split_vertical( nRows );
+
+ if( nColumns > 0 ||nRows > 0 )
+ mxTable->setModified(sal_True);
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("sdr::table::CellCursor::split(), exception caught!");
+ throw NoSupportException();
+ }
+
+ if( bUndo )
+ pModel->EndUndo();
+
+ if( pModel )
+ pModel->SetChanged();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL CellCursor::isMergeable( ) throw (RuntimeException)
+{
+ CellPos aStart, aEnd;
+ return GetMergedSelection( aStart, aEnd ) ? sal_True : sal_False;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL CellCursor::isUnmergeable( ) throw (RuntimeException)
+{
+ // this is true if there is at least one merged cell in the current range
+ for( sal_Int32 nRow = mnTop; nRow <= mnBottom; nRow++ )
+ {
+ for( sal_Int32 nCol = mnLeft; nCol <= mnRight; nCol++ )
+ {
+ CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
+ if( xCell.is() && ( (xCell->getRowSpan() > 1) || (xCell->getColumnSpan() > 1) ) )
+ return sal_True;
+ }
+ }
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------------
+
+} }
diff --git a/svx/source/table/cellcursor.hxx b/svx/source/table/cellcursor.hxx
new file mode 100644
index 000000000000..39b5a082416c
--- /dev/null
+++ b/svx/source/table/cellcursor.hxx
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_CELLCURSOR_HXX_
+#define _SVX_CELLCURSOR_HXX_
+
+#include <com/sun/star/table/XMergeableCellRange.hpp>
+#include <com/sun/star/table/XCellCursor.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include "cellrange.hxx"
+
+// -----------------------------------------------------------------------------
+
+namespace sdr { namespace table {
+
+struct CellPos;
+
+// -----------------------------------------------------------------------------
+// CellCursor
+// -----------------------------------------------------------------------------
+
+typedef ::cppu::ImplInheritanceHelper2< CellRange, ::com::sun::star::table::XCellCursor, ::com::sun::star::table::XMergeableCellRange > CellCursorBase;
+
+class CellCursor : public CellCursorBase
+{
+public:
+ CellCursor( const TableModelRef& xTableModel, sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom );
+ virtual ~CellCursor();
+
+ // XCellRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > SAL_CALL getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL getCellRangeByName( const ::rtl::OUString& aRange ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XCellCursor
+ virtual void SAL_CALL gotoStart( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL gotoEnd( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL gotoNext( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL gotoPrevious( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL gotoOffset( ::sal_Int32 nColumnOffset, ::sal_Int32 nRowOffset ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XMergeableCellRange
+ virtual void SAL_CALL merge( ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL split( ::sal_Int32 Columns, ::sal_Int32 Rows ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isMergeable( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isUnmergeable( ) throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ bool GetMergedSelection( CellPos& rStart, CellPos& rEnd );
+
+ 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 );
+ void split_vertical( sal_Int32 nRows );
+};
+
+} }
+
+#endif
diff --git a/svx/source/table/celleditsource.cxx b/svx/source/table/celleditsource.cxx
new file mode 100644
index 000000000000..e979816fcb8d
--- /dev/null
+++ b/svx/source/table/celleditsource.cxx
@@ -0,0 +1,1056 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <com/sun/star/linguistic2/XLinguServiceManager.hpp>
+
+#include <rtl/ref.hxx>
+#include <osl/mutex.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <comphelper/processfactory.hxx>
+#include <svl/lstner.hxx>
+#include <svl/hint.hxx>
+#include <svl/style.hxx>
+
+#include "celleditsource.hxx"
+#include "cell.hxx"
+#include "svx/svdmodel.hxx"
+#include "svx/svdoutl.hxx"
+#include "svx/svdobj.hxx"
+#include "editeng/unoedhlp.hxx"
+#include "svx/svdview.hxx"
+#include "svx/svdetc.hxx"
+#include "editeng/outliner.hxx"
+#include "editeng/unoforou.hxx"
+#include "editeng/unoviwou.hxx"
+#include "editeng/outlobj.hxx"
+#include "svx/svdotext.hxx"
+#include "svx/svdpage.hxx"
+#include "editeng/editeng.hxx"
+#include "editeng/unotext.hxx"
+#include "svx/sdrpaintwindow.hxx"
+
+//------------------------------------------------------------------------
+
+using ::rtl::OUString;
+using namespace ::osl;
+using namespace ::vos;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::linguistic2;
+using namespace ::com::sun::star::lang;
+
+//------------------------------------------------------------------------
+
+namespace sdr { namespace table {
+
+//------------------------------------------------------------------------
+// CellEditSourceImpl
+//------------------------------------------------------------------------
+
+/** @descr
+ <p>This class essentially provides the text and view forwarders. If
+ no SdrView is given, this class handles the UNO objects, which are
+ currently not concerned with view issues. In this case,
+ GetViewForwarder() always returns NULL and the underlying
+ EditEngine of the SvxTextForwarder is a background one (i.e. not
+ the official DrawOutliner, but one created exclusively for this
+ object, with no relation to a view).
+ </p>
+
+ <p>If a SdrView is given at construction time, the caller is
+ responsible for destroying this object when the view becomes
+ invalid (the views cannot notify). If GetViewForwarder(sal_True)
+ is called, the underlying shape is put into edit mode, the view
+ forwarder returned encapsulates the OutlinerView and the next call
+ to GetTextForwarder() yields a forwarder encapsulating the actual
+ DrawOutliner. Thus, changes on that Outliner are immediately
+ reflected on the screen. If the object leaves edit mode, the old
+ behaviour is restored.</p>
+ */
+class CellEditSourceImpl : public SfxListener, public SfxBroadcaster
+{
+private:
+ oslInterlockedCount maRefCount;
+
+ SdrView* mpView;
+ const Window* mpWindow;
+ SdrModel* mpModel;
+ SdrOutliner* mpOutliner;
+ SvxOutlinerForwarder* mpTextForwarder;
+ SvxDrawOutlinerViewForwarder* mpViewForwarder;
+ Reference< ::com::sun::star::linguistic2::XLinguServiceManager > mxLinguServiceManager;
+ Point maTextOffset;
+ bool mbDataValid;
+ bool mbDisposed;
+ bool mbIsLocked;
+ bool mbNeedsUpdate;
+ bool mbOldUndoMode;
+ bool mbForwarderIsEditMode; // have to reflect that, since ENDEDIT can happen more often
+ bool mbShapeIsEditMode; // #104157# only true, if HINT_BEGEDIT was received
+ bool mbNotificationsDisabled; // prevent EditEngine/Outliner notifications (e.g. when setting up forwarder)
+
+ CellRef mxCell;
+ SvxUnoTextRangeBaseList maTextRanges;
+
+ SvxTextForwarder* GetBackgroundTextForwarder();
+ SvxTextForwarder* GetEditModeTextForwarder();
+ SvxDrawOutlinerViewForwarder* CreateViewForwarder();
+
+ void SetupOutliner();
+ void UpdateOutliner();
+
+ bool HasView() const { return mpView != 0; }
+ bool IsEditMode() const { return mxCell->IsTextEditActive(); };
+ void dispose();
+
+public:
+ CellEditSourceImpl( const CellRef& xCell );
+ CellEditSourceImpl( const CellRef& xCell, SdrView& rView, const Window& rWindow );
+ ~CellEditSourceImpl();
+
+ void SAL_CALL acquire();
+ void SAL_CALL release();
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ SvxEditSource* Clone() const;
+ SvxTextForwarder* GetTextForwarder();
+ SvxEditViewForwarder* GetEditViewForwarder( sal_Bool );
+ void UpdateData();
+
+ void addRange( SvxUnoTextRangeBase* pNewRange );
+ void removeRange( SvxUnoTextRangeBase* pOldRange );
+ const SvxUnoTextRangeBaseList& getRanges() const;
+
+ void lock();
+ void unlock();
+
+ sal_Bool IsValid() const;
+
+ Rectangle GetVisArea();
+ Point LogicToPixel( const Point&, const MapMode& rMapMode );
+ Point PixelToLogic( const Point&, const MapMode& rMapMode );
+
+ DECL_LINK( NotifyHdl, EENotify* );
+
+ void ChangeModel( SdrModel* pNewModel );
+};
+
+//------------------------------------------------------------------------
+
+CellEditSourceImpl::CellEditSourceImpl( const CellRef& xCell )
+ : maRefCount ( 0 ),
+ mpView ( NULL ),
+ mpWindow ( NULL ),
+ mpModel ( NULL ),
+ mpOutliner ( NULL ),
+ mpTextForwarder ( NULL ),
+ mpViewForwarder ( NULL ),
+ mbDataValid ( false ),
+ mbDisposed ( false ),
+ mbIsLocked ( false ),
+ mbNeedsUpdate ( false ),
+ mbOldUndoMode ( false ),
+ mbForwarderIsEditMode ( false ),
+ mbShapeIsEditMode ( false ),
+ mbNotificationsDisabled ( false ),
+ mxCell( xCell )
+{
+}
+
+//------------------------------------------------------------------------
+
+CellEditSourceImpl::CellEditSourceImpl( const CellRef& xCell, SdrView& rView, const Window& rWindow )
+ : maRefCount ( 0 ),
+ mpView ( &rView ),
+ mpWindow ( &rWindow ),
+ mpModel ( NULL ),
+ mpOutliner ( NULL ),
+ mpTextForwarder ( NULL ),
+ mpViewForwarder ( NULL ),
+ mbDataValid ( false ),
+ mbDisposed ( false ),
+ mbIsLocked ( false ),
+ mbNeedsUpdate ( false ),
+ mbOldUndoMode ( false ),
+ mbForwarderIsEditMode ( false ),
+ mbShapeIsEditMode ( true ),
+ mbNotificationsDisabled ( false ),
+ mxCell( xCell )
+{
+ if( mpView )
+ StartListening( *mpView );
+
+ // #104157# Init edit mode state from shape info (IsTextEditActive())
+ mbShapeIsEditMode = IsEditMode();
+}
+
+//------------------------------------------------------------------------
+
+CellEditSourceImpl::~CellEditSourceImpl()
+{
+ DBG_ASSERT( mbIsLocked == sal_False, "CellEditSourceImpl::~CellEditSourceImpl(), was not unlocked before dispose!" );
+ dispose();
+}
+
+//------------------------------------------------------------------------
+
+void CellEditSourceImpl::addRange( SvxUnoTextRangeBase* pNewRange )
+{
+ if( pNewRange )
+ if( std::find( maTextRanges.begin(), maTextRanges.end(), pNewRange ) == maTextRanges.end() )
+ maTextRanges.push_back( pNewRange );
+}
+
+//------------------------------------------------------------------------
+
+void CellEditSourceImpl::removeRange( SvxUnoTextRangeBase* pOldRange )
+{
+ if( pOldRange )
+ maTextRanges.remove( pOldRange );
+}
+
+//------------------------------------------------------------------------
+
+const SvxUnoTextRangeBaseList& CellEditSourceImpl::getRanges() const
+{
+ return maTextRanges;
+}
+
+//------------------------------------------------------------------------
+
+void SAL_CALL CellEditSourceImpl::acquire()
+{
+ osl_incrementInterlockedCount( &maRefCount );
+}
+
+//------------------------------------------------------------------------
+
+void SAL_CALL CellEditSourceImpl::release()
+{
+ if( ! osl_decrementInterlockedCount( &maRefCount ) )
+ delete this;
+}
+
+void CellEditSourceImpl::ChangeModel( SdrModel* pNewModel )
+{
+ if( mpModel != pNewModel )
+ {
+ if( mpOutliner )
+ {
+ if( mpModel )
+ mpModel->disposeOutliner( mpOutliner );
+ else
+ delete mpOutliner;
+ mpOutliner = 0;
+ }
+
+ if( mpView )
+ {
+ EndListening( *mpView );
+ mpView = 0;
+ }
+
+ mpWindow = 0;
+ mxLinguServiceManager.clear();
+
+ mpModel = pNewModel;
+
+ if( mpTextForwarder )
+ {
+ delete mpTextForwarder;
+ mpTextForwarder = 0;
+ }
+
+ if( mpViewForwarder )
+ {
+ delete mpViewForwarder;
+ mpViewForwarder = 0;
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+
+void CellEditSourceImpl::Notify( SfxBroadcaster&, const SfxHint& rHint )
+{
+ const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
+ const SvxViewHint* pViewHint = PTR_CAST( SvxViewHint, &rHint );
+
+ if( pViewHint )
+ {
+ switch( pViewHint->GetHintType() )
+ {
+ case SvxViewHint::SVX_HINT_VIEWCHANGED:
+ Broadcast( *pViewHint );
+ break;
+ }
+ }
+ else if( pSdrHint )
+ {
+ switch( pSdrHint->GetKind() )
+ {
+ case HINT_OBJCHG:
+ {
+ mbDataValid = sal_False; // Text muss neu geholt werden
+
+ if( HasView() )
+ {
+ // #104157# Update maTextOffset, object has changed
+ // #105196#, #105203#: Cannot call that // here,
+ // since TakeTextRect() (called from there) //
+ // changes outliner content.
+ // UpdateOutliner();
+
+ // #101029# Broadcast object changes, as they might change visible attributes
+ SvxViewHint aHint(SvxViewHint::SVX_HINT_VIEWCHANGED);
+ Broadcast( aHint );
+ }
+ break;
+ }
+
+ case HINT_BEGEDIT:
+/* todo
+ if( mpObject == pSdrHint->GetObject() )
+ {
+ // invalidate old forwarder
+ if( !mbForwarderIsEditMode )
+ {
+ delete mpTextForwarder;
+ mpTextForwarder = NULL;
+ }
+
+ // register as listener - need to broadcast state change messages
+ if( mpView && mpView->GetTextEditOutliner() )
+ mpView->GetTextEditOutliner()->SetNotifyHdl( LINK(this, CellEditSourceImpl, NotifyHdl) );
+
+ // #104157# Only now we're really in edit mode
+ mbShapeIsEditMode = sal_True;
+
+ Broadcast( *pSdrHint );
+ }
+*/
+ break;
+
+ case HINT_ENDEDIT:
+/* todo
+ if( mpObject == pSdrHint->GetObject() )
+ {
+ Broadcast( *pSdrHint );
+
+ // #104157# We're no longer in edit mode
+ mbShapeIsEditMode = sal_False;
+
+ // remove as listener - outliner might outlive ourselves
+ if( mpView && mpView->GetTextEditOutliner() )
+ mpView->GetTextEditOutliner()->SetNotifyHdl( Link() );
+
+ // destroy view forwarder, OutlinerView no longer
+ // valid (no need for UpdateData(), it's been
+ // synched on SdrEndTextEdit)
+ delete mpViewForwarder;
+ mpViewForwarder = NULL;
+
+ // #100424# Invalidate text forwarder, we might
+ // not be called again before entering edit mode a
+ // second time! Then, the old outliner might be
+ // invalid.
+ if( mbForwarderIsEditMode )
+ {
+ mbForwarderIsEditMode = sal_False;
+ delete mpTextForwarder;
+ mpTextForwarder = NULL;
+ }
+ }
+*/
+ break;
+
+ case HINT_MODELCLEARED:
+ dispose();
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+/* unregister at all objects and set all references to 0 */
+void CellEditSourceImpl::dispose()
+{
+ if( mpTextForwarder )
+ {
+ delete mpTextForwarder;
+ mpTextForwarder = 0;
+ }
+
+ if( mpViewForwarder )
+ {
+ delete mpViewForwarder;
+ mpViewForwarder = 0;
+ }
+
+ if( mpOutliner )
+ {
+ if( mpModel )
+ {
+ mpModel->disposeOutliner( mpOutliner );
+ }
+ else
+ {
+ delete mpOutliner;
+ }
+ mpOutliner = 0;
+ }
+
+ if( mpView )
+ {
+ EndListening( *mpView );
+ mpView = 0;
+ }
+
+ mpModel = 0;
+ mpWindow = 0;
+}
+
+//------------------------------------------------------------------------
+
+void CellEditSourceImpl::SetupOutliner()
+{
+ // #101029#
+ // only for UAA edit source: setup outliner equivalently as in
+ // SdrTextObj::Paint(), such that formatting equals screen
+ // layout
+/* todo
+ if( mpObject && mpOutliner )
+ {
+ SdrTextObj* pTextObj = PTR_CAST( SdrTextObj, mpObject );
+ Rectangle aPaintRect;
+ if( pTextObj )
+ {
+ Rectangle aBoundRect( pTextObj->GetCurrentBoundRect() );
+ pTextObj->SetupOutlinerFormatting( *mpOutliner, aPaintRect );
+
+ // #101029# calc text offset from shape anchor
+ maTextOffset = aPaintRect.TopLeft() - aBoundRect.TopLeft();
+ }
+ }
+*/
+}
+
+//------------------------------------------------------------------------
+
+void CellEditSourceImpl::UpdateOutliner()
+{
+ // #104157#
+ // only for UAA edit source: update outliner equivalently as in
+ // SdrTextObj::Paint(), such that formatting equals screen
+ // layout
+/* todo
+ if( mpObject && mpOutliner )
+ {
+ SdrTextObj* pTextObj = PTR_CAST( SdrTextObj, mpObject );
+ Rectangle aPaintRect;
+ if( pTextObj )
+ {
+ Rectangle aBoundRect( pTextObj->GetCurrentBoundRect() );
+ pTextObj->UpdateOutlinerFormatting( *mpOutliner, aPaintRect );
+
+ // #101029# calc text offset from shape anchor
+ maTextOffset = aPaintRect.TopLeft() - aBoundRect.TopLeft();
+ }
+ }
+*/
+}
+
+//------------------------------------------------------------------------
+
+
+SvxTextForwarder* CellEditSourceImpl::GetBackgroundTextForwarder()
+{
+ sal_Bool bCreated = sal_False;
+
+ // #99840#: prevent EE/Outliner notifications during setup
+ mbNotificationsDisabled = true;
+
+ if (!mpTextForwarder)
+ {
+ if( mpOutliner == NULL )
+ {
+ mpOutliner = mpModel->createOutliner( OUTLINERMODE_TEXTOBJECT );
+
+ // #109151# Do the setup after outliner creation, would be useless otherwise
+ if( HasView() )
+ {
+ // #101029#, #104157# Setup outliner _before_ filling it
+ SetupOutliner();
+ }
+
+// todo? mpOutliner->SetTextObjNoInit( pTextObj );
+
+ if( mbIsLocked )
+ {
+ ((EditEngine*)&(mpOutliner->GetEditEngine()))->SetUpdateMode( sal_False );
+ mbOldUndoMode = ((EditEngine*)&(mpOutliner->GetEditEngine()))->IsUndoEnabled();
+ ((EditEngine*)&(mpOutliner->GetEditEngine()))->EnableUndo( sal_False );
+ }
+
+ if ( !mxLinguServiceManager.is() )
+ {
+ Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ mxLinguServiceManager = Reference< XLinguServiceManager >(
+ xMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.linguistic2.LinguServiceManager" ))), UNO_QUERY );
+ }
+
+ if ( mxLinguServiceManager.is() )
+ {
+ Reference< XHyphenator > xHyphenator( mxLinguServiceManager->getHyphenator(), UNO_QUERY );
+ if( xHyphenator.is() )
+ mpOutliner->SetHyphenator( xHyphenator );
+ }
+ }
+
+ mpTextForwarder = new SvxOutlinerForwarder( *mpOutliner );
+
+ // delay listener subscription and UAA initialization until Outliner is fully setup
+ bCreated = true;
+ mbForwarderIsEditMode = false;
+ }
+
+ if( !mbDataValid )
+ {
+ mpTextForwarder->flushCache();
+
+ OutlinerParaObject* pOutlinerParaObject = NULL;
+ bool bTextEditActive = false;
+
+ pOutlinerParaObject = mxCell->GetEditOutlinerParaObject(); // Get the OutlinerParaObject if text edit is active
+
+ if( pOutlinerParaObject )
+ bTextEditActive = true; // text edit active
+ else
+ pOutlinerParaObject = mxCell->GetOutlinerParaObject();
+
+ if( pOutlinerParaObject )
+ {
+ mpOutliner->SetText( *pOutlinerParaObject );
+ }
+ else
+ {
+ bool bVertical = false; // todo?
+
+ // set objects style sheet on empty outliner
+ SfxStyleSheetPool* pPool = mxCell->GetStyleSheetPool();
+ if( pPool )
+ mpOutliner->SetStyleSheetPool( pPool );
+
+ SfxStyleSheet* pStyleSheet = mxCell->GetStyleSheet();
+ if( pStyleSheet )
+ mpOutliner->SetStyleSheet( 0, pStyleSheet );
+
+ if( bVertical )
+ mpOutliner->SetVertical( sal_True );
+ }
+
+ // evtually we have to set the border attributes
+ if (mpOutliner->GetParagraphCount()==1)
+ {
+ // if we only have one paragraph we check if it is empty
+ XubString aStr( mpOutliner->GetText( mpOutliner->GetParagraph( 0 ) ) );
+
+ if(!aStr.Len())
+ {
+ // its empty, so we have to force the outliner to initialise itself
+ mpOutliner->SetText( String(), mpOutliner->GetParagraph( 0 ) );
+
+ if(mxCell->GetStyleSheet())
+ mpOutliner->SetStyleSheet( 0, mxCell->GetStyleSheet());
+ }
+ }
+
+ if( bTextEditActive )
+ delete pOutlinerParaObject;
+
+ mbDataValid = true;
+ }
+
+ if( bCreated && mpOutliner && HasView() )
+ {
+ // register as listener - need to broadcast state change messages
+ // registration delayed until outliner is completely set up
+ mpOutliner->SetNotifyHdl( LINK(this, CellEditSourceImpl, NotifyHdl) );
+ }
+
+ // #99840#: prevent EE/Outliner notifications during setup
+ mbNotificationsDisabled = false;
+
+ return mpTextForwarder;
+}
+
+//------------------------------------------------------------------------
+
+SvxTextForwarder* CellEditSourceImpl::GetEditModeTextForwarder()
+{
+ if( !mpTextForwarder && HasView() )
+ {
+ SdrOutliner* pEditOutliner = mpView->GetTextEditOutliner();
+
+ if( pEditOutliner )
+ {
+ mpTextForwarder = new SvxOutlinerForwarder( *pEditOutliner );
+ mbForwarderIsEditMode = true;
+ }
+ }
+
+ return mpTextForwarder;
+}
+
+//------------------------------------------------------------------------
+
+SvxTextForwarder* CellEditSourceImpl::GetTextForwarder()
+{
+ if( mbDisposed )
+ return NULL;
+
+ if( mpModel == NULL )
+ return NULL;
+
+ // distinguish the cases
+ // a) connected to view, maybe edit mode is active, can work directly on the EditOutliner
+ // b) background Outliner, reflect changes into ParaOutlinerObject (this is exactly the old UNO code)
+ if( HasView() )
+ {
+ if( IsEditMode() != mbForwarderIsEditMode )
+ {
+ // forwarder mismatch - create new
+ delete mpTextForwarder;
+ mpTextForwarder = NULL;
+ }
+
+ if( IsEditMode() )
+ return GetEditModeTextForwarder();
+ else
+ return GetBackgroundTextForwarder();
+ }
+ else
+ return GetBackgroundTextForwarder();
+}
+
+//------------------------------------------------------------------------
+
+SvxDrawOutlinerViewForwarder* CellEditSourceImpl::CreateViewForwarder()
+{
+ if( mpView->GetTextEditOutlinerView() )
+ {
+ // register as listener - need to broadcast state change messages
+ mpView->GetTextEditOutliner()->SetNotifyHdl( LINK(this, CellEditSourceImpl, NotifyHdl) );
+
+ Rectangle aBoundRect( mxCell->GetCurrentBoundRect() );
+ OutlinerView& rOutlView = *mpView->GetTextEditOutlinerView();
+
+ return new SvxDrawOutlinerViewForwarder( rOutlView, aBoundRect.TopLeft() );
+ }
+
+ return NULL;
+}
+
+SvxEditViewForwarder* CellEditSourceImpl::GetEditViewForwarder( sal_Bool bCreate )
+{
+ if( mbDisposed )
+ return NULL;
+
+ if( mpModel == NULL )
+ return NULL;
+
+ // shall we delete?
+ if( mpViewForwarder )
+ {
+ if( !IsEditMode() )
+ {
+ // destroy all forwarders (no need for UpdateData(),
+ // it's been synched on SdrEndTextEdit)
+ delete mpViewForwarder;
+ mpViewForwarder = NULL;
+ }
+ }
+ // which to create? Directly in edit mode, create new, or none?
+ else if( mpView )
+ {
+ if( IsEditMode() )
+ {
+ // create new view forwarder
+ mpViewForwarder = CreateViewForwarder();
+ }
+ else if( bCreate )
+ {
+ // dispose old text forwarder
+ UpdateData();
+
+ delete mpTextForwarder;
+ mpTextForwarder = NULL;
+
+ // enter edit mode
+ mpView->SdrEndTextEdit();
+
+/* todo
+ if(mpView->SdrBeginTextEdit(mpObject, 0L, 0L, sal_False, (SdrOutliner*)0L, 0L, sal_False, sal_False))
+ {
+ if( mxCell->IsTextEditActive() )
+ {
+ // create new view forwarder
+ mpViewForwarder = CreateViewForwarder();
+ }
+ else
+ {
+ // failure. Somehow, SdrBeginTextEdit did not set
+ // our SdrTextObj into edit mode
+ mpView->SdrEndTextEdit();
+ }
+ }
+*/
+ }
+ }
+
+ return mpViewForwarder;
+}
+
+//------------------------------------------------------------------------
+
+void CellEditSourceImpl::UpdateData()
+{
+ // if we have a view and in edit mode, we're working with the
+ // DrawOutliner. Thus, all changes made on the text forwarder are
+ // reflected on the view and committed to the model on
+ // SdrEndTextEdit(). Thus, no need for explicit updates here.
+ if( !HasView() || !IsEditMode() )
+ {
+ if( mbIsLocked )
+ {
+ mbNeedsUpdate = true;
+ }
+ else
+ {
+ if( mpOutliner && !mbDisposed )
+ {
+ if( mpOutliner->GetParagraphCount() != 1 || mpOutliner->GetEditEngine().GetTextLen( 0 ) )
+ {
+ mxCell->SetOutlinerParaObject( mpOutliner->CreateParaObject() );
+ }
+ else
+ {
+ mxCell->SetOutlinerParaObject( NULL );
+ }
+ }
+ }
+ }
+}
+
+void CellEditSourceImpl::lock()
+{
+ mbIsLocked = true;
+ if( mpOutliner )
+ {
+ ((EditEngine*)&(mpOutliner->GetEditEngine()))->SetUpdateMode( sal_False );
+ mbOldUndoMode = ((EditEngine*)&(mpOutliner->GetEditEngine()))->IsUndoEnabled();
+ ((EditEngine*)&(mpOutliner->GetEditEngine()))->EnableUndo( sal_False );
+ }
+}
+
+void CellEditSourceImpl::unlock()
+{
+ mbIsLocked = false;
+
+ if( mbNeedsUpdate )
+ {
+ UpdateData();
+ mbNeedsUpdate = false;
+ }
+
+ if( mpOutliner )
+ {
+ ((EditEngine*)&(mpOutliner->GetEditEngine()))->SetUpdateMode( sal_True );
+ ((EditEngine*)&(mpOutliner->GetEditEngine()))->EnableUndo( mbOldUndoMode );
+ }
+}
+
+sal_Bool CellEditSourceImpl::IsValid() const
+{
+ return mpView && mpWindow ? sal_True : sal_False;
+}
+
+Rectangle CellEditSourceImpl::GetVisArea()
+{
+ if( IsValid() )
+ {
+ SdrPaintWindow* pPaintWindow = mpView->FindPaintWindow(*mpWindow);
+ Rectangle aVisArea;
+
+ if(pPaintWindow)
+ {
+ aVisArea = pPaintWindow->GetVisibleArea();
+ }
+
+ // offset vis area by edit engine left-top position
+ Rectangle aAnchorRect;
+ mxCell->TakeTextAnchorRect( aAnchorRect );
+ aVisArea.Move( -aAnchorRect.Left(), -aAnchorRect.Top() );
+
+ MapMode aMapMode(mpWindow->GetMapMode());
+ aMapMode.SetOrigin(Point());
+ return mpWindow->LogicToPixel( aVisArea, aMapMode );
+ }
+
+ return Rectangle();
+}
+
+Point CellEditSourceImpl::LogicToPixel( const Point& rPoint, const MapMode& rMapMode )
+{
+ // #101029#: The responsibilities of ViewForwarder happen to be
+ // somewhat mixed in this case. On the one hand, we need the
+ // different interface queries on the SvxEditSource interface,
+ // since we need both VisAreas. On the other hand, if an
+ // EditViewForwarder exists, maTextOffset does not remain static,
+ // but may change with every key press.
+ if( IsEditMode() )
+ {
+ SvxEditViewForwarder* pForwarder = GetEditViewForwarder(sal_False);
+
+ if( pForwarder )
+ return pForwarder->LogicToPixel( rPoint, rMapMode );
+ }
+ else if( IsValid() && mpModel )
+ {
+ // #101029#
+ Point aPoint1( rPoint );
+ aPoint1.X() += maTextOffset.X();
+ aPoint1.Y() += maTextOffset.Y();
+
+ Point aPoint2( OutputDevice::LogicToLogic( aPoint1, rMapMode,
+ MapMode(mpModel->GetScaleUnit()) ) );
+ MapMode aMapMode(mpWindow->GetMapMode());
+ aMapMode.SetOrigin(Point());
+ return mpWindow->LogicToPixel( aPoint2, aMapMode );
+ }
+
+ return Point();
+}
+
+Point CellEditSourceImpl::PixelToLogic( const Point& rPoint, const MapMode& rMapMode )
+{
+ // #101029#: The responsibilities of ViewForwarder happen to be
+ // somewhat mixed in this case. On the one hand, we need the
+ // different interface queries on the SvxEditSource interface,
+ // since we need both VisAreas. On the other hand, if an
+ // EditViewForwarder exists, maTextOffset does not remain static,
+ // but may change with every key press.
+ if( IsEditMode() )
+ {
+ SvxEditViewForwarder* pForwarder = GetEditViewForwarder(sal_False);
+
+ if( pForwarder )
+ return pForwarder->PixelToLogic( rPoint, rMapMode );
+ }
+ else if( IsValid() && mpModel )
+ {
+ MapMode aMapMode(mpWindow->GetMapMode());
+ aMapMode.SetOrigin(Point());
+ Point aPoint1( mpWindow->PixelToLogic( rPoint, aMapMode ) );
+ Point aPoint2( OutputDevice::LogicToLogic( aPoint1,
+ MapMode(mpModel->GetScaleUnit()),
+ rMapMode ) );
+ // #101029#
+ aPoint2.X() -= maTextOffset.X();
+ aPoint2.Y() -= maTextOffset.Y();
+
+ return aPoint2;
+ }
+
+ return Point();
+}
+
+IMPL_LINK(CellEditSourceImpl, NotifyHdl, EENotify*, aNotify)
+{
+ if( aNotify && !mbNotificationsDisabled )
+ {
+ ::std::auto_ptr< SfxHint > aHint( SvxEditSourceHelper::EENotification2Hint( aNotify) );
+
+ if( aHint.get() )
+ Broadcast( *aHint.get() );
+ }
+
+ return 0;
+}
+
+//------------------------------------------------------------------------
+
+// --------------------------------------------------------------------
+// CellEditSource
+// --------------------------------------------------------------------
+
+CellEditSource::CellEditSource( const CellRef& xCell )
+{
+ mpImpl = new CellEditSourceImpl( xCell );
+ mpImpl->acquire();
+}
+
+// --------------------------------------------------------------------
+CellEditSource::CellEditSource( const CellRef& xCell, SdrView& rView, const Window& rWindow )
+{
+ mpImpl = new CellEditSourceImpl( xCell, rView, rWindow );
+ mpImpl->acquire();
+}
+
+// --------------------------------------------------------------------
+
+CellEditSource::CellEditSource( CellEditSourceImpl* pImpl )
+{
+ mpImpl = pImpl;
+ mpImpl->acquire();
+}
+
+//------------------------------------------------------------------------
+CellEditSource::~CellEditSource()
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ mpImpl->release();
+}
+
+//------------------------------------------------------------------------
+SvxEditSource* CellEditSource::Clone() const
+{
+ return new CellEditSource( mpImpl );
+}
+
+//------------------------------------------------------------------------
+SvxTextForwarder* CellEditSource::GetTextForwarder()
+{
+ return mpImpl->GetTextForwarder();
+}
+
+//------------------------------------------------------------------------
+SvxEditViewForwarder* CellEditSource::GetEditViewForwarder( sal_Bool bCreate )
+{
+ return mpImpl->GetEditViewForwarder( bCreate );
+}
+
+//------------------------------------------------------------------------
+
+SvxViewForwarder* CellEditSource::GetViewForwarder()
+{
+ return this;
+}
+
+//------------------------------------------------------------------------
+
+void CellEditSource::UpdateData()
+{
+ mpImpl->UpdateData();
+}
+
+//------------------------------------------------------------------------
+
+SfxBroadcaster& CellEditSource::GetBroadcaster() const
+{
+ return *mpImpl;
+}
+
+//------------------------------------------------------------------------
+
+void CellEditSource::lock()
+{
+ mpImpl->lock();
+}
+
+//------------------------------------------------------------------------
+
+void CellEditSource::unlock()
+{
+ mpImpl->unlock();
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool CellEditSource::IsValid() const
+{
+ return mpImpl->IsValid();
+}
+
+//------------------------------------------------------------------------
+
+Rectangle CellEditSource::GetVisArea() const
+{
+ return mpImpl->GetVisArea();
+}
+
+//------------------------------------------------------------------------
+
+Point CellEditSource::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const
+{
+ return mpImpl->LogicToPixel( rPoint, rMapMode );
+}
+
+//------------------------------------------------------------------------
+
+Point CellEditSource::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const
+{
+ return mpImpl->PixelToLogic( rPoint, rMapMode );
+}
+
+//------------------------------------------------------------------------
+
+void CellEditSource::addRange( SvxUnoTextRangeBase* pNewRange )
+{
+ mpImpl->addRange( pNewRange );
+}
+
+//------------------------------------------------------------------------
+
+void CellEditSource::removeRange( SvxUnoTextRangeBase* pOldRange )
+{
+ mpImpl->removeRange( pOldRange );
+}
+
+//------------------------------------------------------------------------
+
+const SvxUnoTextRangeBaseList& CellEditSource::getRanges() const
+{
+ return mpImpl->getRanges();
+}
+
+//------------------------------------------------------------------------
+
+void CellEditSource::ChangeModel( SdrModel* pNewModel )
+{
+ mpImpl->ChangeModel( pNewModel );
+}
+
+//------------------------------------------------------------------------
+
+} }
diff --git a/svx/source/table/celleditsource.hxx b/svx/source/table/celleditsource.hxx
new file mode 100644
index 000000000000..4d5ccbd43e55
--- /dev/null
+++ b/svx/source/table/celleditsource.hxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVX_TABLE_CELLEDITSOURCE_HXX
+#define SVX_TABLE_CELLEDITSOURCE_HXX
+
+#include "cell.hxx"
+#include "celltypes.hxx"
+#include "editeng/unoedsrc.hxx"
+
+class SvxTextForwarder;
+class SdrObject;
+class SdrModel;
+class SdrView;
+class Window;
+
+namespace sdr { namespace table {
+
+class CellEditSourceImpl;
+
+class CellEditSource : public SvxEditSource, public SvxViewForwarder
+{
+public:
+ CellEditSource( const CellRef& xCell );
+
+ /** Since the views don't broadcast their dying, make sure that
+ this object gets destroyed if the view becomes invalid
+
+ The window is necessary, since our views can display on multiple windows
+ */
+ CellEditSource( const CellRef& xCell, SdrView& rView, const Window& rViewWindow );
+ virtual ~CellEditSource();
+
+ virtual SvxEditSource* Clone() const;
+ virtual SvxTextForwarder* GetTextForwarder();
+ virtual SvxViewForwarder* GetViewForwarder();
+ virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate = sal_False );
+ virtual void UpdateData();
+
+ virtual void addRange( SvxUnoTextRangeBase* pNewRange );
+ virtual void removeRange( SvxUnoTextRangeBase* pOldRange );
+ virtual const SvxUnoTextRangeBaseList& getRanges() const;
+
+ virtual SfxBroadcaster& GetBroadcaster() const;
+
+ void lock();
+ void unlock();
+
+ // the SvxViewForwarder interface
+ virtual sal_Bool IsValid() const;
+ virtual Rectangle GetVisArea() const;
+ virtual Point LogicToPixel( const Point&, const MapMode& ) const;
+ virtual Point PixelToLogic( const Point&, const MapMode& ) const;
+
+ void ChangeModel( SdrModel* pNewModel );
+
+private:
+ CellEditSource( CellEditSourceImpl* pImpl );
+
+ CellEditSourceImpl* mpImpl;
+};
+
+} }
+
+#endif
diff --git a/svx/source/table/cellrange.cxx b/svx/source/table/cellrange.cxx
new file mode 100644
index 000000000000..29fc043090a3
--- /dev/null
+++ b/svx/source/table/cellrange.cxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "cellrange.hxx"
+
+// -----------------------------------------------------------------------------
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::table;
+
+// -----------------------------------------------------------------------------
+
+namespace sdr { namespace table {
+
+// -----------------------------------------------------------------------------
+// CellRange
+// -----------------------------------------------------------------------------
+
+CellRange::CellRange( const TableModelRef & xTable, sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom )
+: mxTable( xTable )
+, mnLeft(nLeft)
+, mnTop(nTop)
+, mnRight(nRight)
+, mnBottom(nBottom)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+CellRange::~CellRange()
+{
+}
+
+// -----------------------------------------------------------------------------
+// ICellRange
+// -----------------------------------------------------------------------------
+
+sal_Int32 CellRange::getLeft()
+{
+ return mnLeft;
+}
+
+sal_Int32 CellRange::getTop()
+{
+ return mnTop;
+}
+
+sal_Int32 CellRange::getRight()
+{
+ return mnRight;
+}
+
+sal_Int32 CellRange::getBottom()
+{
+ return mnBottom;
+}
+
+Reference< XTable > CellRange::getTable()
+{
+ return mxTable.get();
+}
+
+// -----------------------------------------------------------------------------
+// XCellRange
+// -----------------------------------------------------------------------------
+
+Reference< XCell > SAL_CALL CellRange::getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ return mxTable->getCellByPosition( mnLeft + nColumn, mnTop + nRow );
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XCellRange > SAL_CALL CellRange::getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ if( (nLeft >= 0 ) && (nTop >= 0) && (nRight >= nLeft) && (nBottom >= nTop) )
+ {
+ nLeft += mnLeft;
+ nTop += mnTop;
+ nRight += mnLeft;
+ nBottom += mnTop;
+
+ const sal_Int32 nMaxColumns = (mnRight == -1) ? mxTable->getColumnCount() : mnLeft;
+ const sal_Int32 nMaxRows = (mnBottom == -1) ? mxTable->getRowCount() : mnBottom;
+ if( (nLeft < nMaxColumns) && (nRight < nMaxColumns) && (nTop < nMaxRows) && (nBottom < nMaxRows) )
+ {
+ return mxTable->getCellRangeByPosition( nLeft, nTop, nRight, nBottom );
+ }
+ }
+ throw IndexOutOfBoundsException();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XCellRange > SAL_CALL CellRange::getCellRangeByName( const OUString& /*aRange*/ ) throw (RuntimeException)
+{
+ return Reference< XCellRange >();
+}
+
+// -----------------------------------------------------------------------------
+
+} }
diff --git a/svx/source/table/cellrange.hxx b/svx/source/table/cellrange.hxx
new file mode 100644
index 000000000000..8932bc735ff7
--- /dev/null
+++ b/svx/source/table/cellrange.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_CELLRANGE_HXX_
+#define _SVX_CELLRANGE_HXX_
+
+#include <com/sun/star/table/XCellRange.hpp>
+#include <cppuhelper/implbase1.hxx>
+
+#include "tablemodel.hxx"
+
+// -----------------------------------------------------------------------------
+
+namespace sdr { namespace table {
+
+// -----------------------------------------------------------------------------
+// CellRange
+// -----------------------------------------------------------------------------
+
+class CellRange : public ::cppu::WeakAggImplHelper1< ::com::sun::star::table::XCellRange >, public ICellRange
+{
+public:
+ CellRange( const TableModelRef & xTable, sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom );
+ virtual ~CellRange();
+
+ // ICellRange
+ virtual sal_Int32 getLeft();
+ virtual sal_Int32 getTop();
+ virtual sal_Int32 getRight();
+ virtual sal_Int32 getBottom();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XTable > getTable();
+
+ // XCellRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > SAL_CALL getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL getCellRangeByName( const ::rtl::OUString& aRange ) throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ TableModelRef mxTable;
+ sal_Int32 mnLeft;
+ sal_Int32 mnTop;
+ sal_Int32 mnRight;
+ sal_Int32 mnBottom;
+};
+
+} }
+
+#endif
diff --git a/svx/source/table/celltypes.hxx b/svx/source/table/celltypes.hxx
new file mode 100644
index 000000000000..78ef7b617968
--- /dev/null
+++ b/svx/source/table/celltypes.hxx
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_CELLTYPES_HXX_
+#define _SVX_CELLTYPES_HXX_
+
+#include <rtl/ref.hxx>
+#include <vector>
+
+namespace sdr { namespace table {
+
+class Cell;
+class TableModel;
+class TableRow;
+class TableColumn;
+class TableRows;
+class TableColumns;
+typedef rtl::Reference< Cell > CellRef;
+typedef rtl::Reference< TableModel > TableModelRef;
+typedef rtl::Reference< TableRow > TableRowRef;
+typedef rtl::Reference< TableColumn > TableColumnRef;
+typedef rtl::Reference< TableRows > TableRowsRef;
+typedef rtl::Reference< TableColumns > TableColumnsRef;
+typedef std::vector< CellRef > CellVector;
+typedef std::vector< TableRowRef > RowVector;
+typedef std::vector< TableColumnRef > ColumnVector;
+
+class TableDesignUser
+{
+public:
+ virtual bool isInUse() = 0;
+};
+
+template< typename T >
+class RangeIterator
+{
+public:
+ /** creates an iterator from rStart (including) to rEnd (excluding) if
+ bForeward is true or from nEnd (excluding to nStart (including).
+ rStart must be <= rEnd.
+ */
+ RangeIterator( const T& rStart, const T& rEnd, bool bForeward = true )
+ {
+ if( bForeward )
+ {
+ maIter = rStart;
+ maEnd = rEnd;
+ }
+ else
+ {
+ maIter = rEnd-1;
+ maEnd = rStart-1;
+ }
+ }
+
+ /* returns true if the next call to next() will return true also. */
+ bool hasNext() const
+ {
+ return maIter != maEnd;
+ }
+
+ /* iterates in the configured direction and returns true if rValue
+ now contains a valid positon in the range of this iterator */
+ bool next( T& rValue )
+ {
+ if( maIter == maEnd )
+ return false;
+
+ rValue = maIter;
+ if( maIter < maEnd )
+ maIter++;
+ else
+ maIter--;
+ return true;
+ }
+
+private:
+ T maEnd;
+ T maIter;
+};
+
+} }
+
+#endif
+
diff --git a/svx/source/table/propertyset.cxx b/svx/source/table/propertyset.cxx
new file mode 100644
index 000000000000..f5297afc770d
--- /dev/null
+++ b/svx/source/table/propertyset.cxx
@@ -0,0 +1,259 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "propertyset.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+
+namespace comphelper {
+
+// -----------------------------------------------------------------------------
+// FastPropertySetInfo
+// -----------------------------------------------------------------------------
+
+FastPropertySetInfo::FastPropertySetInfo()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+FastPropertySetInfo::FastPropertySetInfo( const PropertyVector& rProps )
+{
+ addProperties( rProps );
+}
+
+// -----------------------------------------------------------------------------
+
+FastPropertySetInfo::~FastPropertySetInfo()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void FastPropertySetInfo::addProperty( const Property& rProperty )
+{
+ maProperties.push_back( rProperty );
+ maMap[ rProperty.Name ] = maProperties.size() - 1;
+}
+
+// -----------------------------------------------------------------------------
+
+void FastPropertySetInfo::addProperties( const PropertyVector& rProps )
+{
+ sal_uInt32 nIndex = maProperties.size();
+ sal_uInt32 nCount = rProps.size();
+ maProperties.resize( nIndex + nCount );
+ PropertyVector::const_iterator aIter( rProps.begin() );
+ while( nCount-- )
+ {
+ const Property& rProperty = (*aIter++);
+ maProperties[nIndex] = rProperty;
+ maMap[ rProperty.Name ] = nIndex++;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+const Property& FastPropertySetInfo::getProperty( const OUString& aName ) throw (UnknownPropertyException )
+{
+ PropertyMap::iterator aIter( maMap.find( aName ) );
+ if( aIter == maMap.end() )
+ throw UnknownPropertyException();
+ return maProperties[(*aIter).second];
+}
+
+// -----------------------------------------------------------------------------
+
+const Property* FastPropertySetInfo::hasProperty( const OUString& aName )
+{
+ PropertyMap::iterator aIter( maMap.find( aName ) );
+ if( aIter == maMap.end() )
+ return 0;
+ else
+ return &maProperties[(*aIter).second];
+}
+
+// -----------------------------------------------------------------------------
+// XPropertySetInfo
+// -----------------------------------------------------------------------------
+
+Sequence< Property > SAL_CALL FastPropertySetInfo::getProperties() throw (RuntimeException)
+{
+ return Sequence< Property >( &maProperties[0], maProperties.size() );
+}
+
+// -----------------------------------------------------------------------------
+
+Property SAL_CALL FastPropertySetInfo::getPropertyByName( const OUString& aName ) throw (UnknownPropertyException, RuntimeException)
+{
+ return getProperty( aName );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL FastPropertySetInfo::hasPropertyByName( const OUString& aName ) throw (RuntimeException)
+{
+ return hasProperty( aName ) != 0 ? sal_True : sal_False;;
+}
+
+// -----------------------------------------------------------------------------
+// FastPropertySet
+// -----------------------------------------------------------------------------
+
+FastPropertySet::FastPropertySet( const rtl::Reference< FastPropertySetInfo >& xInfo )
+: mxInfo( xInfo )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+FastPropertySet::~FastPropertySet()
+{
+}
+
+// -----------------------------------------------------------------------------
+// XPropertySet
+// -----------------------------------------------------------------------------
+
+Reference< XPropertySetInfo > SAL_CALL FastPropertySet::getPropertySetInfo( ) throw (RuntimeException)
+{
+ return Reference< XPropertySetInfo >( mxInfo.get() );
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL FastPropertySet::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ setFastPropertyValue( mxInfo->getProperty( aPropertyName ).Handle, aValue );
+}
+
+// -----------------------------------------------------------------------------
+
+Any SAL_CALL FastPropertySet::getPropertyValue( const OUString& aPropertyName ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ return getFastPropertyValue( mxInfo->getProperty( aPropertyName ).Handle );
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL FastPropertySet::addPropertyChangeListener( const OUString&, const Reference< XPropertyChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL FastPropertySet::removePropertyChangeListener( const OUString&, const Reference< XPropertyChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL FastPropertySet::addVetoableChangeListener( const OUString&, const Reference< XVetoableChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL FastPropertySet::removeVetoableChangeListener( const OUString&, const Reference< XVetoableChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+// XMultiPropertySet
+// -----------------------------------------------------------------------------
+
+void SAL_CALL FastPropertySet::setPropertyValues( const Sequence< OUString >& aPropertyNames, const Sequence< Any >& aValues ) throw (PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ const OUString* pPropertyNames = aPropertyNames.getConstArray();
+ const Any* pValues = aValues.getConstArray();
+ sal_Int32 nCount = aPropertyNames.getLength();
+ if( nCount != aValues.getLength() )
+ throw IllegalArgumentException();
+
+ while( nCount-- )
+ {
+ const Property* pProperty = mxInfo->hasProperty( *pPropertyNames++ );
+ if( pProperty ) try
+ {
+ setFastPropertyValue( pProperty->Handle, *pValues );
+ }
+ catch( UnknownPropertyException& )
+ {
+ }
+ pValues++;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< Any > SAL_CALL FastPropertySet::getPropertyValues( const Sequence< OUString >& aPropertyNames ) throw (RuntimeException)
+{
+ sal_Int32 nCount = aPropertyNames.getLength();
+ Sequence< Any > aValues( nCount );
+
+ const OUString* pPropertyNames = aPropertyNames.getConstArray();
+ Any* pValues = aValues.getArray();
+ while( nCount-- )
+ {
+ const Property* pProperty = mxInfo->hasProperty( *pPropertyNames++ );
+ if( pProperty ) try
+ {
+ *pValues = getFastPropertyValue( pProperty->Handle );
+ }
+ catch( UnknownPropertyException& )
+ {
+ }
+ pValues++;
+ }
+ return aValues;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL FastPropertySet::addPropertiesChangeListener( const Sequence< OUString >&, const Reference< XPropertiesChangeListener >& ) throw (RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL FastPropertySet::removePropertiesChangeListener( const Reference< XPropertiesChangeListener >& ) throw (RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL FastPropertySet::firePropertiesChangeEvent( const Sequence< OUString >&, const Reference< XPropertiesChangeListener >& ) throw (RuntimeException)
+{
+}
+
+}
diff --git a/svx/source/table/propertyset.hxx b/svx/source/table/propertyset.hxx
new file mode 100644
index 000000000000..241395272889
--- /dev/null
+++ b/svx/source/table/propertyset.hxx
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _COMPHELPER_PROPERTYSET_HXX_
+#define _COMPHELPER_PROPERTYSET_HXX_
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XFastPropertySet.hpp>
+#include <rtl/ref.hxx>
+#include <functional>
+#include <hash_map>
+#include <vector>
+
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase3.hxx>
+
+namespace comphelper {
+
+// -----------------------------------------------------------------------------
+
+typedef std::vector< ::com::sun::star::beans::Property > PropertyVector;
+typedef std::hash_map< ::rtl::OUString, ::sal_uInt32, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > PropertyMap;
+
+// -----------------------------------------------------------------------------
+
+class FastPropertySetInfo : public ::cppu::WeakAggImplHelper1< ::com::sun::star::beans::XPropertySetInfo >
+{
+public:
+ FastPropertySetInfo();
+ FastPropertySetInfo( const PropertyVector& rProps );
+ virtual ~FastPropertySetInfo();
+
+ void addProperty( const ::com::sun::star::beans::Property& rProperty );
+ void addProperties( const PropertyVector& rProps );
+
+ const ::com::sun::star::beans::Property& getProperty( const ::rtl::OUString& aName ) throw (::com::sun::star::beans::UnknownPropertyException );
+ const ::com::sun::star::beans::Property* hasProperty( const ::rtl::OUString& aName );
+
+ // XPropertySetInfo
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName( const ::rtl::OUString& aName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasPropertyByName( const ::rtl::OUString& Name ) throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ PropertyVector maProperties;
+ PropertyMap maMap;
+};
+
+// -----------------------------------------------------------------------------
+
+class FastPropertySet : public ::cppu::WeakAggImplHelper3< ::com::sun::star::beans::XPropertySet, ::com::sun::star::beans::XMultiPropertySet, ::com::sun::star::beans::XFastPropertySet >
+{
+public:
+ FastPropertySet( const rtl::Reference< FastPropertySetInfo >& xInfo );
+ virtual ~FastPropertySet();
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XMultiPropertySet
+// virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XFastPropertySet
+ virtual void SAL_CALL setFastPropertyValue( ::sal_Int32 nHandle, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) = 0;
+ virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue( ::sal_Int32 nHandle ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) = 0;
+
+private:
+ rtl::Reference< FastPropertySetInfo > mxInfo;
+};
+
+}
+
+#endif
diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx
new file mode 100644
index 000000000000..9ac652f5e025
--- /dev/null
+++ b/svx/source/table/svdotable.cxx
@@ -0,0 +1,2820 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#define ITEMID_BOX SDRATTR_TABLE_BORDER
+#define ITEMID_BOXINFO SDRATTR_TABLE_BORDER_INNER
+
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+
+#include <vcl/canvastools.hxx>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <svl/style.hxx>
+#include "editeng/editstat.hxx"
+#include "editeng/outlobj.hxx"
+#include "svx/svdview.hxx"
+#include "svx/sdr/properties/textproperties.hxx"
+#include "svx/svdotable.hxx"
+#include "svx/svdhdl.hxx"
+#include "viewcontactoftableobj.hxx"
+#include "svx/svdoutl.hxx"
+#include "svx/svddrag.hxx"
+#include "svx/svdpagv.hxx"
+#include "tablemodel.hxx"
+#include "cell.hxx"
+#include "svx/xflclit.hxx"
+#include "tablelayouter.hxx"
+#include "svx/svdetc.hxx"
+#include "tablehandles.hxx"
+#include "editeng/boxitem.hxx"
+#include "svx/framelink.hxx"
+#include "svx/sdr/table/tabledesign.hxx"
+#include "svx/svdundo.hxx"
+#include "svx/svdstr.hrc"
+#include "svx/svdglob.hxx"
+#include "editeng/writingmodeitem.hxx"
+#include "editeng/frmdiritem.hxx"
+#include "svx/xflhtit.hxx"
+#include "svx/xflftrit.hxx"
+#include "svx/xfltrit.hxx"
+
+// -----------------------------------------------------------------------------
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::XInterface;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::container::XIndexAccess;
+using ::com::sun::star::style::XStyle;
+using ::com::sun::star::table::XTableRows;
+using ::com::sun::star::table::XTableColumns;
+using ::com::sun::star::table::XTable;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::util::XModifyBroadcaster;
+using sdr::properties::TextProperties;
+using sdr::properties::BaseProperties;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::style;
+
+namespace sdr { namespace table {
+
+class TableProperties : public TextProperties
+{
+protected:
+ // create a new itemset
+ SfxItemSet& CreateObjectSpecificItemSet(SfxItemPool& rPool);
+
+public:
+ // basic constructor
+ TableProperties(SdrObject& rObj );
+
+ // constructor for copying, but using new object
+ TableProperties(const TableProperties& rProps, SdrObject& rObj );
+
+ // destructor
+ ~TableProperties();
+
+ // Clone() operator, normally just calls the local copy constructor
+ BaseProperties& Clone(SdrObject& rObj) const;
+
+ virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem);
+};
+
+TableProperties::TableProperties(SdrObject& rObj)
+: TextProperties(rObj)
+{
+}
+
+TableProperties::TableProperties(const TableProperties& rProps, SdrObject& rObj)
+: TextProperties(rProps, rObj)
+{
+}
+
+TableProperties::~TableProperties()
+{
+}
+
+BaseProperties& TableProperties::Clone(SdrObject& rObj) const
+{
+ return *(new TableProperties(*this, rObj));
+}
+
+void TableProperties::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem)
+{
+ if( nWhich == SDRATTR_TEXTDIRECTION )
+ AttributeProperties::ItemChange( nWhich, pNewItem );
+ else
+ TextProperties::ItemChange( nWhich, pNewItem );
+}
+
+// create a new itemset
+SfxItemSet& TableProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+{
+ return *(new SfxItemSet(rPool,
+
+ // range from SdrAttrObj
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+
+ // range for SdrTableObj
+ SDRATTR_TABLE_FIRST, SDRATTR_TABLE_LAST,
+
+ // range from SdrTextObj
+ EE_ITEMS_START, EE_ITEMS_END,
+
+ // end
+ 0, 0));
+}
+
+class TableObjectGeoData : public SdrTextObjGeoData
+{
+public:
+ Rectangle maLogicRect;
+};
+
+//------------------------------------------------------------------------
+// TableStyleSettings
+//------------------------------------------------------------------------
+
+TableStyleSettings::TableStyleSettings()
+: mbUseFirstRow(true)
+, mbUseLastRow(false)
+, mbUseFirstColumn(false)
+, mbUseLastColumn(false)
+, mbUseRowBanding(true)
+, mbUseColumnBanding(false)
+{
+}
+
+TableStyleSettings::TableStyleSettings( const TableStyleSettings& rStyle )
+{
+ (*this) = rStyle;
+}
+
+TableStyleSettings& TableStyleSettings::operator=(const TableStyleSettings& rStyle)
+{
+ mbUseFirstRow = rStyle.mbUseFirstRow;
+ mbUseLastRow = rStyle.mbUseLastRow;
+ mbUseFirstColumn = rStyle.mbUseFirstColumn;
+ mbUseLastColumn = rStyle.mbUseLastColumn;
+ mbUseRowBanding = rStyle.mbUseRowBanding;
+ mbUseColumnBanding = rStyle.mbUseColumnBanding;
+ return *this;
+}
+
+bool TableStyleSettings::operator==( const TableStyleSettings& rStyle ) const
+{
+ return
+ (mbUseFirstRow == rStyle.mbUseFirstRow) &&
+ (mbUseLastRow == rStyle.mbUseLastRow) &&
+ (mbUseFirstColumn == rStyle.mbUseFirstColumn) &&
+ (mbUseLastColumn == rStyle.mbUseLastColumn) &&
+ (mbUseRowBanding == rStyle.mbUseRowBanding) &&
+ (mbUseColumnBanding == rStyle.mbUseColumnBanding);
+}
+
+// -----------------------------------------------------------------------------
+
+class SdrTableObjImpl : public TableDesignUser, public ::cppu::WeakImplHelper1< ::com::sun::star::util::XModifyListener >
+{
+public:
+ CellRef mxActiveCell;
+ TableModelRef mxTable;
+ SdrTableObj* mpTableObj;
+ TableLayouter* mpLayouter;
+ CellPos maEditPos;
+ TableStyleSettings maTableStyle;
+ Reference< XIndexAccess > mxTableStyle;
+ bool mbModifyPending;
+// sal_Int32 mnSavedEditRowHeight;
+
+ void SetModel(SdrModel* pOldModel, SdrModel* pNewModel);
+
+ CellRef getCell( const CellPos& rPos ) const;
+ void LayoutTable( Rectangle& rArea, bool bFitWidth, bool bFitHeight );
+
+ bool ApplyCellStyles();
+ void UpdateCells( Rectangle& rArea );
+
+ SdrTableObjImpl();
+ virtual ~SdrTableObjImpl();
+
+ void init( SdrTableObj* pTable, sal_Int32 nColumns, sal_Int32 nRows );
+ void dispose();
+
+ sal_Int32 getColumnCount() const;
+ sal_Int32 getRowCount() const;
+
+ void DragEdge( bool mbHorizontal, int nEdge, sal_Int32 nOffset );
+
+ const SfxPoolItem* GetCellItem( const CellPos& rPos, sal_uInt16 nWhich ) const;
+// void GetBorderLines( const CellPos& rPos, const SvxBorderLine** ppLeft, const SvxBorderLine** ppTop, const SvxBorderLine** ppRight, const SvxBorderLine** ppBottom ) const;
+
+ void operator=( const SdrTableObjImpl& rSource );
+
+ // XModifyListener
+ virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ void update();
+
+ void connectTableStyle();
+ void disconnectTableStyle();
+ virtual bool isInUse();
+
+ bool UpdateWritingMode();
+};
+
+// -----------------------------------------------------------------------------
+
+SdrTableObjImpl::SdrTableObjImpl()
+: mpTableObj( 0 )
+, mpLayouter( 0 )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+SdrTableObjImpl::~SdrTableObjImpl()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrTableObjImpl::init( SdrTableObj* pTable, sal_Int32 nColumns, sal_Int32 nRows )
+{
+ mpTableObj = pTable;
+ mxTable = new TableModel( pTable );
+ mxTable->init( nColumns, nRows );
+ mpLayouter = new TableLayouter( mxTable );
+ Reference< XModifyListener > xListener( static_cast< ::com::sun::star::util::XModifyListener* >(this) );
+ mxTable->addModifyListener( xListener );
+ UpdateWritingMode();
+ LayoutTable( mpTableObj->aRect, true, true );
+ mpTableObj->maLogicRect = mpTableObj->aRect;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrTableObjImpl::operator=( const SdrTableObjImpl& rSource )
+{
+ if( mpLayouter )
+ {
+ delete mpLayouter;
+ mpLayouter = 0;
+ }
+
+ if( mxTable.is() )
+ {
+ Reference< XModifyListener > xListener( static_cast< ::com::sun::star::util::XModifyListener* >(this) );
+ mxTable->removeModifyListener( xListener );
+ mxTable->dispose();
+ mxTable.clear();
+ }
+
+ maTableStyle = rSource.maTableStyle;
+
+ mxTable = new TableModel( mpTableObj, rSource.mxTable );
+ mpLayouter = new TableLayouter( mxTable );
+ Reference< XModifyListener > xListener( static_cast< ::com::sun::star::util::XModifyListener* >(this) );
+ mxTable->addModifyListener( xListener );
+ mxTableStyle = rSource.mxTableStyle;
+ UpdateWritingMode();
+ ApplyCellStyles();
+ mpTableObj->aRect = mpTableObj->maLogicRect;
+ LayoutTable( mpTableObj->aRect, false, false );
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrTableObjImpl::SetModel(SdrModel* /*pOldModel*/, SdrModel* pNewModel)
+{
+ // try to find new table style
+
+ Reference< XIndexAccess > xNewTableStyle;
+ if( mxTableStyle.is() ) try
+ {
+ const OUString sStyleName( Reference< XNamed >( mxTableStyle, UNO_QUERY_THROW )->getName() );
+
+ Reference< XStyleFamiliesSupplier > xSFS( pNewModel->getUnoModel(), UNO_QUERY_THROW );
+ Reference< XNameAccess > xFamilyNameAccess( xSFS->getStyleFamilies(), UNO_QUERY_THROW );
+ const rtl::OUString sFamilyName( RTL_CONSTASCII_USTRINGPARAM( "table" ) );
+ Reference< XNameAccess > xTableFamilyAccess( xFamilyNameAccess->getByName( sFamilyName ), UNO_QUERY_THROW );
+
+ if( xTableFamilyAccess->hasByName( sStyleName ) )
+ {
+ // found table style with the same name
+ xTableFamilyAccess->getByName( sStyleName ) >>= xNewTableStyle;
+ }
+ else
+ {
+ // copy or?
+ Reference< XIndexAccess > xIndexAccess( xTableFamilyAccess, UNO_QUERY_THROW );
+ xIndexAccess->getByIndex( 0 ) >>= xNewTableStyle;
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("svx::SdrTableObjImpl::SetModel(), exception caught!");
+ }
+
+ mxTableStyle = xNewTableStyle;
+
+ update();
+}
+
+// -----------------------------------------------------------------------------
+
+bool SdrTableObjImpl::ApplyCellStyles()
+{
+ if( !mxTable.is() || !mxTable.is() || !mxTableStyle.is() )
+ return false;
+
+ bool bChanges = false;
+
+ const sal_Int32 nColCount = getColumnCount();
+ const sal_Int32 nRowCount = getRowCount();
+
+ const TableStyleSettings& rStyle = maTableStyle;
+
+ CellPos aPos;
+ for( aPos.mnRow = 0; aPos.mnRow < nRowCount; ++aPos.mnRow )
+ {
+ const bool bFirstRow = (aPos.mnRow == 0) && rStyle.mbUseFirstRow;
+ const bool bLastRow = (aPos.mnRow == nRowCount-1) && rStyle.mbUseLastRow;
+
+ for( aPos.mnCol = 0; aPos.mnCol < nColCount; ++aPos.mnCol )
+ {
+ Reference< XStyle > xStyle;
+
+ // first and last row win first, if used and available
+ if( bFirstRow )
+ {
+ mxTableStyle->getByIndex(first_row_style) >>= xStyle;
+ }
+ else if( bLastRow )
+ {
+ mxTableStyle->getByIndex(last_row_style) >>= xStyle;
+ }
+
+ if( !xStyle.is() )
+ {
+ // next come first and last column, if used and available
+ if( rStyle.mbUseFirstColumn && (aPos.mnCol == 0) )
+ {
+ mxTableStyle->getByIndex(first_column_style) >>= xStyle;
+ }
+ else if( rStyle.mbUseLastColumn && (aPos.mnCol == nColCount-1) )
+ {
+ mxTableStyle->getByIndex(last_column_style) >>= xStyle;
+ }
+ }
+
+ if( !xStyle.is() && rStyle.mbUseRowBanding )
+ {
+ if( (aPos.mnRow & 1) == 0 )
+ {
+ mxTableStyle->getByIndex(even_rows_style) >>= xStyle;
+ }
+ else
+ {
+ mxTableStyle->getByIndex(odd_rows_style) >>= xStyle;
+ }
+ }
+
+ if( !xStyle.is() && rStyle.mbUseColumnBanding )
+ {
+ if( (aPos.mnCol & 1) == 0 )
+ {
+ mxTableStyle->getByIndex(even_columns_style) >>= xStyle;
+ }
+ else
+ {
+ mxTableStyle->getByIndex(odd_columns_style) >>= xStyle;
+ }
+ }
+
+ if( !xStyle.is() )
+ {
+ // use default cell style if non found yet
+ mxTableStyle->getByIndex(body_style) >>= xStyle;
+ }
+
+
+ if( xStyle.is() )
+ {
+ SfxUnoStyleSheet* pStyle = SfxUnoStyleSheet::getUnoStyleSheet(xStyle);
+
+ if( pStyle )
+ {
+ CellRef xCell( getCell( aPos ) );
+ if( xCell.is() && ( xCell->GetStyleSheet() != pStyle ) )
+ {
+ bChanges = true;
+ xCell->SetStyleSheet( pStyle, sal_True );
+ }
+ }
+ }
+ }
+ }
+
+ return bChanges;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrTableObjImpl::dispose()
+{
+ if( mxTable.is() )
+ mxTable->dispose();
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrTableObjImpl::DragEdge( bool mbHorizontal, int nEdge, sal_Int32 nOffset )
+{
+ if( (nEdge > 0) && mxTable.is()) try
+ {
+ const OUString sSize( RTL_CONSTASCII_USTRINGPARAM( "Size" ) );
+ nEdge--;
+ if( mbHorizontal )
+ {
+ if( (nEdge >= 0) && (nEdge < getRowCount()) )
+ {
+ sal_Int32 nHeigth = mpLayouter->getRowHeight( nEdge );
+ nHeigth += nOffset;
+ Reference< XIndexAccess > xRows( mxTable->getRows(), UNO_QUERY_THROW );
+ Reference< XPropertySet > xRowSet( xRows->getByIndex( nEdge ), UNO_QUERY_THROW );
+ xRowSet->setPropertyValue( sSize, Any( nHeigth ) );
+ }
+ }
+ else
+ {
+ if( (nEdge >= 0) && (nEdge < getColumnCount()) )
+ {
+ sal_Int32 nWidth = mpLayouter->getColumnWidth( nEdge );
+ nWidth += nOffset;
+
+ Reference< XIndexAccess > xCols( mxTable->getColumns(), UNO_QUERY_THROW );
+ Reference< XPropertySet > xColSet( xCols->getByIndex( nEdge ), UNO_QUERY_THROW );
+ xColSet->setPropertyValue( sSize, Any( nWidth ) );
+
+ if( nEdge > 0 && nEdge < mxTable->getColumnCount() )
+ {
+ const bool bRTL = mpLayouter->GetWritingMode() == WritingMode_RL_TB;
+
+ if( bRTL )
+ nEdge--;
+ else
+ nEdge++;
+
+ if( (bRTL && (nEdge >= 0)) || (!bRTL && (nEdge < mxTable->getColumnCount())) )
+ {
+ nWidth = mpLayouter->getColumnWidth( nEdge );
+ nWidth = std::max( (sal_Int32)(nWidth - nOffset), (sal_Int32)0 );
+
+ xColSet = Reference< XPropertySet >( xCols->getByIndex( nEdge ), UNO_QUERY_THROW );
+ xColSet->setPropertyValue( sSize, Any( nWidth ) );
+ }
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "svx::SdrTableObjImpl::DragEdge(), exception caught!" );
+ }
+}
+
+// -----------------------------------------------------------------------------
+// XModifyListener
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SdrTableObjImpl::modified( const ::com::sun::star::lang::EventObject& /*aEvent*/ ) throw (::com::sun::star::uno::RuntimeException)
+{
+ update();
+}
+
+void SdrTableObjImpl::update()
+{
+ // source can be the table model itself or the assigned table template
+ TableModelNotifyGuard aGuard( mxTable.get() );
+ if( mpTableObj )
+ {
+ if( (maEditPos.mnRow >= getRowCount()) || (maEditPos.mnCol >= getColumnCount()) || (getCell( maEditPos ) != mxActiveCell) )
+ {
+ if(maEditPos.mnRow >= getRowCount())
+ maEditPos.mnRow = getRowCount()-1;
+
+ if(maEditPos.mnCol >= getColumnCount())
+ maEditPos.mnCol = getColumnCount()-1;
+
+ mpTableObj->setActiveCell( maEditPos );
+ }
+
+ ApplyCellStyles();
+
+ mpTableObj->aRect = mpTableObj->maLogicRect;
+ LayoutTable( mpTableObj->aRect, false, false );
+
+ mpTableObj->SetRectsDirty();
+ mpTableObj->ActionChanged();
+ mpTableObj->BroadcastObjectChange();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrTableObjImpl::connectTableStyle()
+{
+ if( mxTableStyle.is() )
+ {
+ Reference< XModifyBroadcaster > xBroadcaster( mxTableStyle, UNO_QUERY );
+ if( xBroadcaster.is() )
+ {
+ Reference< XModifyListener > xListener( static_cast< ::com::sun::star::util::XModifyListener* >(this) );
+ xBroadcaster->addModifyListener( xListener );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrTableObjImpl::disconnectTableStyle()
+{
+ if( mxTableStyle.is() )
+ {
+ Reference< XModifyBroadcaster > xBroadcaster( mxTableStyle, UNO_QUERY );
+ if( xBroadcaster.is() )
+ {
+ Reference< XModifyListener > xListener( static_cast< ::com::sun::star::util::XModifyListener* >(this) );
+ xBroadcaster->removeModifyListener( xListener );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+bool SdrTableObjImpl::isInUse()
+{
+ return mpTableObj && mpTableObj->IsInserted();
+}
+
+// -----------------------------------------------------------------------------
+// XEventListener
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SdrTableObjImpl::disposing( const ::com::sun::star::lang::EventObject& /*Source*/ ) throw (::com::sun::star::uno::RuntimeException)
+{
+ mxActiveCell.clear();
+ mxTable.clear();
+ if( mpLayouter )
+ {
+ delete mpLayouter;
+ mpLayouter = 0;
+ }
+ mpTableObj = 0;
+}
+
+// -----------------------------------------------------------------------------
+
+CellRef SdrTableObjImpl::getCell( const CellPos& rPos ) const
+{
+ CellRef xCell;
+ if( mxTable.is() ) try
+ {
+ xCell.set( dynamic_cast< Cell* >( mxTable->getCellByPosition( rPos.mnCol, rPos.mnRow ).get() ) );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "svx::SdrTableObjImpl::getCell(), exception caught!" );
+ }
+ return xCell;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SdrTableObjImpl::getColumnCount() const
+{
+ return mxTable.is() ? mxTable->getColumnCount() : 0;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SdrTableObjImpl::getRowCount() const
+{
+ return mxTable.is() ? mxTable->getRowCount() : 0;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrTableObjImpl::LayoutTable( Rectangle& rArea, bool bFitWidth, bool bFitHeight )
+{
+ if( mpLayouter && mpTableObj->GetModel() )
+ {
+ TableModelNotifyGuard aGuard( mxTable.get() );
+ mpLayouter->LayoutTable( rArea, bFitWidth, bFitHeight );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+bool SdrTableObjImpl::UpdateWritingMode()
+{
+ if( mpTableObj && mpLayouter )
+ {
+ WritingMode eWritingMode = (WritingMode)static_cast< const SvxWritingModeItem& >( mpTableObj->GetObjectItem( SDRATTR_TEXTDIRECTION ) ).GetValue();
+
+ if( eWritingMode != WritingMode_TB_RL )
+ {
+ if( static_cast< const SvxFrameDirectionItem& >( mpTableObj->GetObjectItem( EE_PARA_WRITINGDIR ) ).GetValue() == FRMDIR_HORI_LEFT_TOP )
+ eWritingMode = WritingMode_LR_TB;
+ else
+ eWritingMode = WritingMode_RL_TB;
+ }
+
+ if( eWritingMode != mpLayouter->GetWritingMode() )
+ {
+ mpLayouter->SetWritingMode( eWritingMode );
+ return true;
+ }
+ }
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrTableObjImpl::UpdateCells( Rectangle& rArea )
+{
+ if( mpLayouter && mxTable.is() )
+ {
+ TableModelNotifyGuard aGuard( mxTable.get() );
+ mpLayouter->updateCells( rArea );
+ mxTable->setModified(sal_True);
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+const SfxPoolItem* SdrTableObjImpl::GetCellItem( const CellPos& rPos, sal_uInt16 nWhich ) const
+{
+ CellRef xCell( getCell( rPos ) );
+ if( xCell.is() )
+ return xCell->GetItemSet().GetItem( nWhich );
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// BaseProperties section
+// -----------------------------------------------------------------------------
+
+sdr::properties::BaseProperties* SdrTableObj::CreateObjectSpecificProperties()
+{
+ return new TableProperties(*this);
+}
+
+// -----------------------------------------------------------------------------
+// DrawContact section
+// -----------------------------------------------------------------------------
+
+sdr::contact::ViewContact* SdrTableObj::CreateObjectSpecificViewContact()
+{
+ return new sdr::contact::ViewContactOfTableObj(*this);
+}
+
+// --------------------------------------------------------------------
+
+TYPEINIT1(SdrTableObj,SdrTextObj);
+
+// --------------------------------------------------------------------
+
+SdrTableObj::SdrTableObj(SdrModel* _pModel)
+{
+ pModel = _pModel;
+ init( 1, 1 );
+}
+
+// --------------------------------------------------------------------
+
+SdrTableObj::SdrTableObj(SdrModel* _pModel, const ::Rectangle& rNewRect, sal_Int32 nColumns, sal_Int32 nRows)
+: SdrTextObj( rNewRect )
+, maLogicRect( rNewRect )
+{
+ pModel = _pModel;
+
+ if( nColumns <= 0 )
+ nColumns = 1;
+
+ if( nRows <= 0 )
+ nRows = 1;
+
+ init( nColumns, nRows );
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::init( sal_Int32 nColumns, sal_Int32 nRows )
+{
+ bClosedObj = sal_True;
+
+ mpImpl = new SdrTableObjImpl;
+ mpImpl->acquire();
+ mpImpl->init( this, nColumns, nRows );
+}
+
+// --------------------------------------------------------------------
+
+SdrTableObj::~SdrTableObj()
+{
+ mpImpl->dispose();
+ mpImpl->release();
+}
+
+// --------------------------------------------------------------------
+// table stuff
+// --------------------------------------------------------------------
+
+Reference< XTable > SdrTableObj::getTable() const
+{
+ return Reference< XTable >( mpImpl->mxTable.get() );
+}
+
+// --------------------------------------------------------------------
+
+bool SdrTableObj::isValid( const CellPos& rPos ) const
+{
+ return (rPos.mnCol >= 0) && (rPos.mnCol < mpImpl->getColumnCount()) && (rPos.mnRow >= 0) && (rPos.mnRow < mpImpl->getRowCount());
+}
+
+// --------------------------------------------------------------------
+
+CellPos SdrTableObj::getFirstCell() const
+{
+ return CellPos( 0,0 );
+}
+
+// --------------------------------------------------------------------
+
+CellPos SdrTableObj::getLastCell() const
+{
+ CellPos aPos;
+ if( mpImpl->mxTable.is() )
+ {
+ aPos.mnCol = mpImpl->getColumnCount()-1;
+ aPos.mnRow = mpImpl->getRowCount()-1;
+ }
+ return aPos;
+}
+
+// --------------------------------------------------------------------
+
+CellPos SdrTableObj::getLeftCell( const CellPos& rPos, bool bEdgeTravel ) const
+{
+ switch( GetWritingMode() )
+ {
+ default:
+ case WritingMode_LR_TB:
+ return getPreviousCell( rPos, bEdgeTravel );
+ case WritingMode_RL_TB:
+ return getNextCell( rPos, bEdgeTravel );
+ case WritingMode_TB_RL:
+ return getPreviousRow( rPos, bEdgeTravel );
+ }
+}
+
+// --------------------------------------------------------------------
+
+CellPos SdrTableObj::getRightCell( const CellPos& rPos, bool bEdgeTravel ) const
+{
+ switch( GetWritingMode() )
+ {
+ default:
+ case WritingMode_LR_TB:
+ return getNextCell( rPos, bEdgeTravel );
+ case WritingMode_RL_TB:
+ return getPreviousCell( rPos, bEdgeTravel );
+ case WritingMode_TB_RL:
+ return getNextRow( rPos, bEdgeTravel );
+ }
+}
+
+// --------------------------------------------------------------------
+
+CellPos SdrTableObj::getUpCell( const CellPos& rPos, bool bEdgeTravel ) const
+{
+ switch( GetWritingMode() )
+ {
+ default:
+ case WritingMode_LR_TB:
+ case WritingMode_RL_TB:
+ return getPreviousRow( rPos, bEdgeTravel );
+ case WritingMode_TB_RL:
+ return getPreviousCell( rPos, bEdgeTravel );
+ }
+}
+
+// --------------------------------------------------------------------
+
+CellPos SdrTableObj::getDownCell( const CellPos& rPos, bool bEdgeTravel ) const
+{
+ switch( GetWritingMode() )
+ {
+ default:
+ case WritingMode_LR_TB:
+ case WritingMode_RL_TB:
+ return getNextRow( rPos, bEdgeTravel );
+ case WritingMode_TB_RL:
+ return getNextCell( rPos, bEdgeTravel );
+ }
+}
+
+// --------------------------------------------------------------------
+
+CellPos SdrTableObj::getPreviousCell( const CellPos& rPos, bool bEdgeTravel ) const
+{
+ CellPos aPos( rPos );
+ if( mpImpl )
+ {
+ CellRef xCell( mpImpl->getCell( aPos ) );
+ if( xCell.is() && xCell->isMerged() )
+ {
+ sal_Int32 nTemp = 0;
+ findMergeOrigin( mpImpl->mxTable.get(), aPos.mnCol, aPos.mnRow, aPos.mnCol, nTemp );
+ }
+
+ if( aPos.mnCol > 0 )
+ {
+ --aPos.mnCol;
+ }
+
+ else if( bEdgeTravel && (aPos.mnRow > 0) )
+ {
+ aPos.mnCol = mpImpl->mxTable->getColumnCount()-1;
+ --aPos.mnRow;
+ }
+ }
+ return aPos;
+}
+
+// --------------------------------------------------------------------
+
+CellPos SdrTableObj::getNextCell( const CellPos& rPos, bool bEdgeTravel ) const
+{
+ CellPos aPos( rPos );
+ if( mpImpl )
+ {
+ CellRef xCell( mpImpl->getCell( aPos ) );
+ if( xCell.is() )
+ {
+ if( xCell->isMerged() )
+ {
+ findMergeOrigin( mpImpl->mxTable, aPos.mnCol, aPos.mnRow, aPos.mnCol, aPos.mnRow );
+
+ xCell = mpImpl->getCell(aPos);
+
+ if( xCell.is() )
+ {
+ aPos.mnCol += xCell->getColumnSpan();
+ aPos.mnRow = rPos.mnRow;
+ }
+ }
+ else
+ {
+ aPos.mnCol += xCell->getColumnSpan();
+ }
+
+ if( aPos.mnCol < mpImpl->mxTable->getColumnCount() )
+ return aPos;
+
+ if( bEdgeTravel && ((aPos.mnRow + 1) < mpImpl->getRowCount()) )
+ {
+ aPos.mnCol = 0;
+ aPos.mnRow += 1;
+ return aPos;
+ }
+ }
+ }
+
+ // last cell reached, no traveling possible
+ return rPos;
+}
+
+// --------------------------------------------------------------------
+
+CellPos SdrTableObj::getPreviousRow( const CellPos& rPos, bool bEdgeTravel ) const
+{
+ CellPos aPos( rPos );
+ if( mpImpl )
+ {
+ CellRef xCell( mpImpl->getCell( aPos ) );
+ if( xCell.is() )
+ {
+ if( xCell->isMerged() )
+ {
+ sal_Int32 nTemp = 0;
+ findMergeOrigin( mpImpl->mxTable, aPos.mnCol, aPos.mnRow, nTemp, aPos.mnRow );
+ }
+ }
+
+ if( aPos.mnRow > 0 )
+ {
+ --aPos.mnRow;
+ }
+ else if( bEdgeTravel && (aPos.mnCol > 0) )
+ {
+ aPos.mnRow = mpImpl->mxTable->getRowCount()-1;
+ --aPos.mnCol;
+ }
+ }
+ return aPos;
+}
+
+// --------------------------------------------------------------------
+
+CellPos SdrTableObj::getNextRow( const CellPos& rPos, bool bEdgeTravel ) const
+{
+ CellPos aPos( rPos );
+
+ if( mpImpl )
+ {
+ CellRef xCell( mpImpl->getCell( rPos ) );
+ if( xCell.is() )
+ {
+ if( xCell->isMerged() )
+ {
+ findMergeOrigin( mpImpl->mxTable, aPos.mnCol, aPos.mnRow, aPos.mnCol, aPos.mnRow );
+ xCell = mpImpl->getCell(aPos);
+ aPos.mnCol = rPos.mnCol;
+ }
+
+ if( xCell.is() )
+ aPos.mnRow += xCell->getRowSpan();
+
+ if( aPos.mnRow < mpImpl->mxTable->getRowCount() )
+ return aPos;
+
+ if( bEdgeTravel && (aPos.mnCol + 1) < mpImpl->mxTable->getColumnCount() )
+ {
+ aPos.mnRow = 0;
+ aPos.mnCol += 1;
+
+ while( aPos.mnCol < mpImpl->mxTable->getColumnCount() )
+ {
+ xCell = mpImpl->getCell( aPos );
+ if( xCell.is() && !xCell->isMerged() )
+ return aPos;
+ aPos.mnCol += 1;
+ }
+ }
+ }
+ }
+
+ // last position reached, no more traveling possible
+ return rPos;
+}
+
+// --------------------------------------------------------------------
+
+const TableStyleSettings& SdrTableObj::getTableStyleSettings() const
+{
+ if( mpImpl )
+ {
+ return mpImpl->maTableStyle;
+ }
+ else
+ {
+ static TableStyleSettings aTmp;
+ return aTmp;
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::setTableStyleSettings( const TableStyleSettings& rStyle )
+{
+ if( mpImpl )
+ {
+ mpImpl->maTableStyle = rStyle;
+ mpImpl->update();
+ }
+}
+
+// --------------------------------------------------------------------
+
+TableHitKind SdrTableObj::CheckTableHit( const Point& rPos, sal_Int32& rnX, sal_Int32& rnY, int nTol ) const
+{
+ if( !mpImpl || !mpImpl->mxTable.is() )
+ return SDRTABLEHIT_NONE;
+
+ rnX = 0;
+ rnY = 0;
+
+ const sal_Int32 nColCount = mpImpl->getColumnCount();
+ const sal_Int32 nRowCount = mpImpl->getRowCount();
+
+ sal_Int32 nX = rPos.X() + nTol - aRect.nLeft;
+ sal_Int32 nY = rPos.Y() + nTol - aRect.nTop;
+
+ if( (nX < 0) || (nX > (aRect.GetWidth() + nTol)) || (nY < 0) || (nY > (aRect.GetHeight() + nTol) ) )
+ return SDRTABLEHIT_NONE;
+
+ // get vertical edge number and check for a hit
+ const bool bRTL = GetWritingMode() == WritingMode_RL_TB;
+ bool bVrtHit = false;
+ if( nX >= 0 )
+ {
+ if( !bRTL )
+ {
+ while( rnX <= nColCount )
+ {
+ if( nX <= (2*nTol) )
+ {
+ bVrtHit = true;
+ break;
+ }
+
+ if( rnX == nColCount )
+ break;
+
+ nX -= mpImpl->mpLayouter->getColumnWidth( rnX );
+ if( nX < 0 )
+ break;
+ rnX++;
+ }
+ }
+ else
+ {
+ rnX = nColCount;
+ while( rnX >= 0 )
+ {
+ if( nX <= (2*nTol) )
+ {
+ bVrtHit = true;
+ break;
+ }
+
+ if( rnX == 0 )
+ break;
+
+ rnX--;
+ nX -= mpImpl->mpLayouter->getColumnWidth( rnX );
+ if( nX < 0 )
+ break;
+ }
+ }
+ }
+
+ // rnX is now the edge number left to the pointer, if it was hit bHrzHit is also true
+
+ // get vertical edge number and check for a hit
+ bool bHrzHit = false;
+ if( nY >= 0 )
+ {
+ while( rnY <= nRowCount )
+ {
+ if( nY <= (2*nTol) )
+ {
+ bHrzHit = true;
+ break;
+ }
+
+ if( rnY == nRowCount )
+ break;
+
+ nY -= mpImpl->mpLayouter->getRowHeight(rnY);
+ if( nY < 0 )
+ break;
+ rnY++;
+ }
+ }
+
+ // rnY is now the edge number above the pointer, if it was hit bVrtHit is also true
+
+ if( bVrtHit && mpImpl->mpLayouter->isEdgeVisible( rnX, rnY, false ) )
+ return SDRTABLEHIT_VERTICAL_BORDER;
+
+ if( bHrzHit && mpImpl->mpLayouter->isEdgeVisible( rnX, rnY, true ) )
+ return SDRTABLEHIT_HORIZONTAL_BORDER;
+
+ CellRef xCell( mpImpl->getCell( CellPos( rnX, rnY ) ) );
+ if( xCell.is() && xCell->isMerged() )
+ findMergeOrigin( mpImpl->mxTable.get(), rnX, rnY, rnX, rnY );
+
+ if( xCell.is() )
+ {
+ nX += mpImpl->mpLayouter->getColumnWidth( rnX );
+ if( nX < xCell->GetTextLeftDistance() )
+ return SDRTABLEHIT_CELL;
+ }
+
+ return SDRTABLEHIT_CELLTEXTAREA;
+}
+
+const SfxItemSet& SdrTableObj::GetActiveCellItemSet() const
+{
+ return getActiveCell()->GetItemSet();
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::InsertRows( sal_Int32 nIndex, sal_Int32 nCount /*= 1*/ )
+{
+ if( mpImpl->mxTable.is() ) try
+ {
+ Reference< XTableRows > xRows( mpImpl->mxTable->getRows(), UNO_QUERY_THROW );
+ xRows->insertByIndex( nIndex, nCount );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("SdrTableObj::InsertRows(), exception caught!");
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::InsertColumns( sal_Int32 nIndex, sal_Int32 nCount /*= 1*/ )
+{
+ if( mpImpl->mxTable.is() ) try
+ {
+ Reference< XTableColumns > xColumns( mpImpl->mxTable->getColumns(), UNO_QUERY_THROW );
+ xColumns->insertByIndex( nIndex, nCount );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("SdrTableObj::InsertColumns(), exception caught!");
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::DeleteRows( sal_Int32 nIndex, sal_Int32 nCount /*= 1*/ )
+{
+ if( mpImpl->mxTable.is() ) try
+ {
+ Reference< XTableRows > xRows( mpImpl->mxTable->getRows(), UNO_QUERY_THROW );
+ xRows->removeByIndex( nIndex, nCount );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("SdrTableObj::DeleteRows(), exception caught!");
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::DeleteColumns( sal_Int32 nIndex, sal_Int32 nCount /*= 1*/ )
+{
+ if( mpImpl->mxTable.is() ) try
+ {
+ Reference< XTableColumns > xColumns( mpImpl->mxTable->getColumns(), UNO_QUERY_THROW );
+ xColumns->removeByIndex( nIndex, nCount );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("SdrTableObj::DeleteColumns(), exception caught!");
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::setTableStyle( const Reference< XIndexAccess >& xTableStyle )
+{
+ if( mpImpl && (mpImpl->mxTableStyle != xTableStyle) )
+ {
+ mpImpl->disconnectTableStyle();
+ mpImpl->mxTableStyle = xTableStyle;
+ mpImpl->connectTableStyle();
+ mpImpl->update();
+ }
+}
+
+// --------------------------------------------------------------------
+
+const Reference< XIndexAccess >& SdrTableObj::getTableStyle() const
+{
+ if( mpImpl )
+ {
+ return mpImpl->mxTableStyle;
+ }
+ else
+ {
+ static Reference< XIndexAccess > aTmp;
+ return aTmp;
+ }
+}
+
+// --------------------------------------------------------------------
+// text stuff
+// --------------------------------------------------------------------
+
+/** returns the currently active text. */
+SdrText* SdrTableObj::getActiveText() const
+{
+ return dynamic_cast< SdrText* >( getActiveCell().get() );
+}
+
+// --------------------------------------------------------------------
+
+/** returns the nth available text. */
+SdrText* SdrTableObj::getText( sal_Int32 nIndex ) const
+{
+ if( mpImpl->mxTable.is() )
+ {
+ const sal_Int32 nColCount = mpImpl->getColumnCount();
+ if( nColCount )
+ {
+ CellPos aPos( nIndex % nColCount, nIndex / nColCount );
+
+ CellRef xCell( mpImpl->getCell( aPos ) );
+ return dynamic_cast< SdrText* >( xCell.get() );
+ }
+ }
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+/** returns the number of texts available for this object. */
+sal_Int32 SdrTableObj::getTextCount() const
+{
+ if( mpImpl->mxTable.is() )
+ {
+ const sal_Int32 nColCount = mpImpl->getColumnCount();
+ const sal_Int32 nRowCount = mpImpl->getRowCount();
+
+ return nColCount * nRowCount;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+// --------------------------------------------------------------------
+
+/** changes the current active text */
+void SdrTableObj::setActiveText( sal_Int32 nIndex )
+{
+ if( mpImpl && mpImpl->mxTable.is() )
+ {
+ const sal_Int32 nColCount = mpImpl->mxTable->getColumnCount();
+ if( nColCount )
+ {
+ CellPos aPos( nIndex % nColCount, nIndex / nColCount );
+ if( isValid( aPos ) )
+ setActiveCell( aPos );
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+/** returns the index of the text that contains the given point or -1 */
+sal_Int32 SdrTableObj::CheckTextHit(const Point& rPnt) const
+{
+ if( mpImpl && mpImpl->mxTable.is() )
+ {
+ CellPos aPos;
+ if( CheckTableHit( rPnt, aPos.mnCol, aPos.mnRow, 0 ) == SDRTABLEHIT_CELLTEXTAREA )
+ return aPos.mnRow * mpImpl->mxTable->getColumnCount() + aPos.mnCol;
+ }
+
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+SdrOutliner* SdrTableObj::GetCellTextEditOutliner( const Cell& rCell ) const
+{
+ if( mpImpl && (mpImpl->getCell( mpImpl->maEditPos ).get() == &rCell) )
+ return pEdtOutl;
+ else
+ return 0;
+}
+
+
+// --------------------------------------------------------------------
+
+const TableLayouter& SdrTableObj::getTableLayouter() const
+{
+ OSL_ENSURE(mpImpl && mpImpl->mpLayouter, "getTableLayouter() error: no mpImpl or mpLayouter (!)");
+ return *(mpImpl->mpLayouter);
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::FitFrameToTextSize()
+{
+ // todo
+}
+
+// --------------------------------------------------------------------
+
+FASTBOOL SdrTableObj::IsAutoGrowHeight() const
+{
+ return sal_True;
+}
+
+// --------------------------------------------------------------------
+
+FASTBOOL SdrTableObj::IsAutoGrowWidth() const
+{
+ return sal_True;
+}
+
+// --------------------------------------------------------------------
+
+bool SdrTableObj::HasText() const
+{
+ return true;
+}
+
+// --------------------------------------------------------------------
+
+bool SdrTableObj::IsTextEditActive( const CellPos& rPos )
+{
+ return pEdtOutl && mpImpl && (rPos == mpImpl->maEditPos);
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::onEditOutlinerStatusEvent( EditStatus* pEditStatus )
+{
+ if( (pEditStatus->GetStatusWord() & EE_STAT_TEXTHEIGHTCHANGED) && mpImpl && mpImpl->mpLayouter )
+ {
+ Rectangle aRect0( aRect );
+ aRect = maLogicRect;
+// mpImpl->mpLayouter->setRowHeight( mpImpl->maEditPos.mnRow, mpImpl->mnSavedEditRowHeight );
+ mpImpl->LayoutTable( aRect, false, false );
+ SetRectsDirty();
+ ActionChanged();
+ BroadcastObjectChange();
+ if( aRect0 != aRect )
+ SendUserCall(SDRUSERCALL_RESIZE,aRect0);
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
+{
+ rInfo.bResizeFreeAllowed=sal_True;
+ rInfo.bResizePropAllowed=sal_True;
+ rInfo.bRotateFreeAllowed=sal_False;
+ rInfo.bRotate90Allowed =sal_False;
+ rInfo.bMirrorFreeAllowed=sal_False;
+ rInfo.bMirror45Allowed =sal_False;
+ rInfo.bMirror90Allowed =sal_False;
+
+ // allow transparence
+ rInfo.bTransparenceAllowed = sal_True;
+
+ // gradient depends on fillstyle
+ XFillStyle eFillStyle = ((XFillStyleItem&)(GetObjectItem(XATTR_FILLSTYLE))).GetValue();
+ rInfo.bGradientAllowed = (eFillStyle == XFILL_GRADIENT);
+ rInfo.bShearAllowed =sal_False;
+ rInfo.bEdgeRadiusAllowed=sal_False;
+ rInfo.bCanConvToPath =sal_False;
+ rInfo.bCanConvToPoly =sal_False;
+ rInfo.bCanConvToPathLineToArea=sal_False;
+ rInfo.bCanConvToPolyLineToArea=sal_False;
+ rInfo.bCanConvToContour = sal_False;
+}
+
+// --------------------------------------------------------------------
+
+sal_uInt16 SdrTableObj::GetObjIdentifier() const
+{
+ return static_cast<sal_uInt16>(OBJ_TABLE);
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::SetPage(SdrPage* pNewPage)
+{
+ SdrTextObj::SetPage(pNewPage);
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::SetModel(SdrModel* pNewModel)
+{
+ SdrModel* pOldModel = GetModel();
+ if( pNewModel != pOldModel )
+ {
+ SdrTextObj::SetModel(pNewModel);
+
+ if( mpImpl )
+ {
+ mpImpl->SetModel( pOldModel, pNewModel );
+
+ if( !maLogicRect.IsEmpty() )
+ {
+ aRect = maLogicRect;
+ mpImpl->LayoutTable( aRect, false, false );
+ }
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, FASTBOOL bNoEditText, Rectangle* pAnchorRect, sal_Bool bLineWidth ) const
+{
+ if( mpImpl )
+ TakeTextRect( mpImpl->maEditPos, rOutliner, rTextRect, bNoEditText, pAnchorRect, bLineWidth );
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::TakeTextRect( const CellPos& rPos, SdrOutliner& rOutliner, Rectangle& rTextRect, FASTBOOL bNoEditText, Rectangle* pAnchorRect, sal_Bool /*bLineWidth*/ ) const
+{
+ if( !mpImpl )
+ return;
+
+ CellRef xCell( mpImpl->getCell( rPos ) );
+ if( !xCell.is() )
+ return;
+
+ Rectangle aAnkRect;
+ TakeTextAnchorRect( rPos, aAnkRect );
+
+ SdrTextVertAdjust eVAdj=xCell->GetTextVerticalAdjust();
+// SdrTextHorzAdjust eHAdj=xCell->GetTextHorizontalAdjust();
+
+ sal_uIntPtr nStat0=rOutliner.GetControlWord();
+ Size aNullSize;
+ nStat0 |= EE_CNTRL_AUTOPAGESIZE;
+ rOutliner.SetControlWord(nStat0);
+ rOutliner.SetMinAutoPaperSize(aNullSize);
+ rOutliner.SetMaxAutoPaperSize(aAnkRect.GetSize());
+ rOutliner.SetPaperSize(aAnkRect.GetSize());
+
+ // #103516# New try with _BLOCK for hor and ver after completely
+ // supporting full width for vertical text.
+// if( SDRTEXTHORZADJUST_BLOCK == eHAdj && !IsVerticalWriting())
+// {
+ rOutliner.SetMinAutoPaperSize(Size(aAnkRect.GetWidth(), 0));
+// }
+// else if(SDRTEXTVERTADJUST_BLOCK == eVAdj && IsVerticalWriting())
+// {
+// rOutliner.SetMinAutoPaperSize(Size(0, aAnkRect.GetHeight()));
+// }
+
+ // ---
+
+ // set text at outliner, maybe from edit outliner
+ OutlinerParaObject* pPara= xCell->GetOutlinerParaObject();
+ if (pEdtOutl && !bNoEditText && mpImpl->mxActiveCell == xCell )
+ pPara=pEdtOutl->CreateParaObject();
+
+ if (pPara)
+ {
+ const bool bHitTest = pModel && (&pModel->GetHitTestOutliner() == &rOutliner);
+
+ const SdrTextObj* pTestObj = rOutliner.GetTextObj();
+ if( !pTestObj || !bHitTest || (pTestObj != this) || (pTestObj->GetOutlinerParaObject() != xCell->GetOutlinerParaObject()) )
+ {
+ if( bHitTest ) // #i33696# take back fix #i27510#
+ rOutliner.SetTextObj( this );
+
+ rOutliner.SetUpdateMode(sal_True);
+ rOutliner.SetText(*pPara);
+ }
+ }
+ else
+ {
+ rOutliner.SetTextObj( NULL );
+ }
+
+ if (pEdtOutl && !bNoEditText && pPara && mpImpl->mxActiveCell == xCell )
+ delete pPara;
+
+ rOutliner.SetUpdateMode(sal_True);
+ rOutliner.SetControlWord(nStat0);
+
+ Point aTextPos(aAnkRect.TopLeft());
+ Size aTextSiz(rOutliner.GetPaperSize());
+/*
+ if (eHAdj==SDRTEXTHORZADJUST_CENTER || eHAdj==SDRTEXTHORZADJUST_RIGHT)
+ {
+ long nFreeWdt=aAnkRect.GetWidth()-aTextSiz.Width();
+ if (eHAdj==SDRTEXTHORZADJUST_CENTER)
+ aTextPos.X()+=nFreeWdt/2;
+ if (eHAdj==SDRTEXTHORZADJUST_RIGHT)
+ aTextPos.X()+=nFreeWdt;
+ }
+*/
+ if (eVAdj==SDRTEXTVERTADJUST_CENTER || eVAdj==SDRTEXTVERTADJUST_BOTTOM)
+ {
+ long nFreeHgt=aAnkRect.GetHeight()-aTextSiz.Height();
+ if (eVAdj==SDRTEXTVERTADJUST_CENTER)
+ aTextPos.Y()+=nFreeHgt/2;
+ if (eVAdj==SDRTEXTVERTADJUST_BOTTOM)
+ aTextPos.Y()+=nFreeHgt;
+ }
+
+ if (pAnchorRect)
+ *pAnchorRect=aAnkRect;
+
+ rTextRect=Rectangle(aTextPos,aTextSiz);
+}
+
+// --------------------------------------------------------------------
+
+const CellRef& SdrTableObj::getActiveCell() const
+{
+ if( mpImpl )
+ {
+ if( !mpImpl->mxActiveCell.is() )
+ {
+ CellPos aPos;
+ const_cast< SdrTableObj* >(this)->setActiveCell( aPos );
+ }
+ return mpImpl->mxActiveCell;
+ }
+ else
+ {
+ static CellRef xCell;
+ return xCell;
+ }
+}
+
+// --------------------------------------------------------------------
+
+sal_Int32 SdrTableObj::getRowCount() const
+{
+ return mpImpl ? mpImpl->getRowCount() : 0;
+}
+
+// --------------------------------------------------------------------
+
+sal_Int32 SdrTableObj::getColumnCount() const
+{
+ return mpImpl ? mpImpl->getColumnCount() : 0;
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::setActiveCell( const CellPos& rPos )
+{
+ if( mpImpl && mpImpl->mxTable.is() ) try
+ {
+ mpImpl->mxActiveCell.set( dynamic_cast< Cell* >( mpImpl->mxTable->getCellByPosition( rPos.mnCol, rPos.mnRow ).get() ) );
+ if( mpImpl->mxActiveCell.is() && mpImpl->mxActiveCell->isMerged() )
+ {
+ CellPos aOrigin;
+ findMergeOrigin( mpImpl->mxTable.get(), rPos.mnCol, rPos.mnRow, aOrigin.mnCol, aOrigin.mnRow );
+ mpImpl->mxActiveCell.set( dynamic_cast< Cell* >( mpImpl->mxTable->getCellByPosition( aOrigin.mnCol, aOrigin.mnRow ).get() ) );
+ mpImpl->maEditPos = aOrigin;
+ }
+ else
+ {
+ mpImpl->maEditPos = rPos;
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("SdrTableObj::setActiveCell(), exception caught!");
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::getActiveCellPos( CellPos& rPos ) const
+{
+ rPos = mpImpl->maEditPos;
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::getCellBounds( const CellPos& rPos, ::Rectangle& rCellRect )
+{
+ if( mpImpl )
+ {
+ CellRef xCell( mpImpl->getCell( rPos ) );
+ if( xCell.is() )
+ rCellRect = xCell->getCellRect();
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::TakeTextAnchorRect(Rectangle& rAnchorRect) const
+{
+ if( mpImpl )
+ TakeTextAnchorRect( mpImpl->maEditPos, rAnchorRect );
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::TakeTextAnchorRect( const CellPos& rPos, Rectangle& rAnchorRect ) const
+{
+ Rectangle aAnkRect(aRect);
+
+ if( mpImpl )
+ {
+ CellRef xCell( mpImpl->getCell( rPos ) );
+ if( xCell.is() )
+ xCell->TakeTextAnchorRect( aAnkRect );
+ }
+
+ ImpJustifyRect(aAnkRect);
+ rAnchorRect=aAnkRect;
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle* pViewInit, Rectangle* pViewMin) const
+{
+ if( mpImpl )
+ TakeTextEditArea( mpImpl->maEditPos, pPaperMin, pPaperMax, pViewInit, pViewMin );
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::TakeTextEditArea( const CellPos& rPos, Size* pPaperMin, Size* pPaperMax, Rectangle* pViewInit, Rectangle* pViewMin ) const
+{
+ Size aPaperMin,aPaperMax;
+ Rectangle aViewInit;
+ TakeTextAnchorRect( rPos, aViewInit );
+
+ Size aAnkSiz(aViewInit.GetSize());
+ aAnkSiz.Width()--; aAnkSiz.Height()--; // weil GetSize() ein draufaddiert
+
+ Size aMaxSiz(aAnkSiz.Width(),1000000);
+ if (pModel!=NULL)
+ {
+ Size aTmpSiz(pModel->GetMaxObjSize());
+ if (aTmpSiz.Height()!=0)
+ aMaxSiz.Height()=aTmpSiz.Height();
+ }
+
+ CellRef xCell( mpImpl->getCell( rPos ) );
+ SdrTextVertAdjust eVAdj = xCell.is() ? xCell->GetTextVerticalAdjust() : SDRTEXTVERTADJUST_TOP;
+// SdrTextHorzAdjust eHAdj = xCell.is() ? xCell->GetTextHorizontalAdjust() : SDRTEXTHORZADJUST_LEFT;
+
+ aPaperMax=aMaxSiz;
+
+// if((SDRTEXTHORZADJUST_BLOCK == eHAdj && !IsVerticalWriting()) || (SDRTEXTVERTADJUST_BLOCK == eVAdj && IsVerticalWriting()))
+ aPaperMin.Width() = aAnkSiz.Width();
+
+ if (pViewMin!=NULL)
+ {
+ *pViewMin=aViewInit;
+/*
+ long nXFree=aAnkSiz.Width()-aPaperMin.Width();
+
+ if (eHAdj==SDRTEXTHORZADJUST_LEFT)
+ {
+ pViewMin->Right()-=nXFree;
+ }
+ else if (eHAdj==SDRTEXTHORZADJUST_RIGHT)
+ {
+ pViewMin->Left()+=nXFree;
+ }
+ else
+ {
+ pViewMin->Left()+=nXFree/2;
+ pViewMin->Right()=pViewMin->Left()+aPaperMin.Width();
+ }
+*/
+ long nYFree=aAnkSiz.Height()-aPaperMin.Height();
+
+ if (eVAdj==SDRTEXTVERTADJUST_TOP)
+ {
+ pViewMin->Bottom()-=nYFree;
+ }
+ else if (eVAdj==SDRTEXTVERTADJUST_BOTTOM)
+ {
+ pViewMin->Top()+=nYFree;
+ }
+ else
+ {
+ pViewMin->Top()+=nYFree/2;
+ pViewMin->Bottom()=pViewMin->Top()+aPaperMin.Height();
+ }
+ }
+
+
+ if(IsVerticalWriting())
+ aPaperMin.Width() = 0;
+ else
+ aPaperMin.Height() = 0;
+
+ if (pPaperMin!=NULL) *pPaperMin=aPaperMin;
+ if (pPaperMax!=NULL) *pPaperMax=aPaperMax;
+ if (pViewInit!=NULL) *pViewInit=aViewInit;
+}
+
+// --------------------------------------------------------------------
+
+sal_uInt16 SdrTableObj::GetOutlinerViewAnchorMode() const
+{
+ EVAnchorMode eRet=ANCHOR_TOP_LEFT;
+ CellRef xCell( getActiveCell() );
+ if( xCell.is() )
+ {
+ SdrTextVertAdjust eV=xCell->GetTextVerticalAdjust();
+// SdrTextHorzAdjust eH=xCell->GetTextHorizontalAdjust();
+
+// if (eH==SDRTEXTHORZADJUST_LEFT)
+ {
+ if (eV==SDRTEXTVERTADJUST_TOP)
+ {
+ eRet=ANCHOR_TOP_LEFT;
+ }
+ else if (eV==SDRTEXTVERTADJUST_BOTTOM)
+ {
+ eRet=ANCHOR_BOTTOM_LEFT;
+ }
+ else
+ {
+ eRet=ANCHOR_VCENTER_LEFT;
+ }
+ }
+/*
+ else if (eH==SDRTEXTHORZADJUST_RIGHT)
+ {
+ if (eV==SDRTEXTVERTADJUST_TOP)
+ {
+ eRet=ANCHOR_TOP_RIGHT;
+ }
+ else if (eV==SDRTEXTVERTADJUST_BOTTOM)
+ {
+ eRet=ANCHOR_BOTTOM_RIGHT;
+ }
+ else
+ {
+ eRet=ANCHOR_VCENTER_RIGHT;
+ }
+ }
+ else
+ {
+ if (eV==SDRTEXTVERTADJUST_TOP)
+ {
+ eRet=ANCHOR_TOP_HCENTER;
+ }
+ else if (eV==SDRTEXTVERTADJUST_BOTTOM)
+ {
+ eRet=ANCHOR_BOTTOM_HCENTER;
+ }
+ else
+ {
+ eRet=ANCHOR_VCENTER_HCENTER;
+ }
+ }
+*/
+ }
+ return (sal_uInt16)eRet;
+}
+
+// --------------------------------------------------------------------
+
+OutlinerParaObject* SdrTableObj::GetEditOutlinerParaObject() const
+{
+ return SdrTextObj::GetEditOutlinerParaObject();
+}
+
+// --------------------------------------------------------------------
+
+SdrOutliner* SdrTableObj::GetCellTextEditOutliner( const CellPos& rPos ) const
+{
+ if( pEdtOutl && mpImpl && (mpImpl->maEditPos == rPos) )
+ return pEdtOutl;
+ else
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+struct ImplTableShadowPaintInfo
+{
+ Color maShadowColor;
+ sal_uInt32 mnXDistance;
+ sal_uInt32 mnYDistance;
+ sal_uInt16 mnShadowTransparence;
+
+ ImplTableShadowPaintInfo( const SfxItemSet& rSet )
+ {
+ const SdrShadowColorItem& rShadColItem = ((const SdrShadowColorItem&)(rSet.Get(SDRATTR_SHADOWCOLOR)));
+ maShadowColor = rShadColItem.GetColorValue();
+ mnShadowTransparence = ((const SdrShadowTransparenceItem&)(rSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue();
+
+ mnXDistance = ((SdrShadowXDistItem&)(rSet.Get(SDRATTR_SHADOWXDIST))).GetValue();
+ mnYDistance = ((SdrShadowYDistItem&)(rSet.Get(SDRATTR_SHADOWYDIST))).GetValue();
+ }
+};
+
+// --------------------------------------------------------------------
+
+void lcl_VertLineEnds( OutputDevice& rDev, const Point& rTop, const Point& rBottom,
+ const Color& rColor, long nXOffs, long nWidth,
+ const svx::frame::Style& rTopLine, const svx::frame::Style& rBottomLine )
+{
+ rDev.SetLineColor(rColor); // PEN_NULL ???
+ rDev.SetFillColor(rColor);
+
+ // Position oben/unten muss unabhaengig von der Liniendicke sein,
+ // damit der Winkel stimmt (oder X-Position auch anpassen)
+ long nTopPos = rTop.Y();
+ long nBotPos = rBottom.Y();
+
+ long nTopLeft = rTop.X() + nXOffs;
+ long nTopRight = nTopLeft + nWidth - 1;
+
+ long nBotLeft = rBottom.X() + nXOffs;
+ long nBotRight = nBotLeft + nWidth - 1;
+
+ // oben abschliessen
+
+ if ( rTopLine.Prim() )
+ {
+ long nLineW = rTopLine.GetWidth();
+ if (nLineW >= 2)
+ {
+ Point aTriangle[3];
+ aTriangle[0] = Point( nTopLeft, nTopPos ); // wie aPoints[0]
+ aTriangle[1] = Point( nTopRight, nTopPos ); // wie aPoints[1]
+ aTriangle[2] = Point( rTop.X(), nTopPos - (nLineW - 1) / 2 );
+ Polygon aTriPoly( 3, aTriangle );
+ rDev.DrawPolygon( aTriPoly );
+ }
+ }
+
+ // unten abschliessen
+
+ if ( rBottomLine.Prim() )
+ {
+ long nLineW = rBottomLine.GetWidth();
+ if (nLineW >= 2)
+ {
+ Point aTriangle[3];
+ aTriangle[0] = Point( nBotLeft, nBotPos ); // wie aPoints[3]
+ aTriangle[1] = Point( nBotRight, nBotPos ); // wie aPoints[2]
+ aTriangle[2] = Point( rBottom.X(), nBotPos - (nLineW - 1) / 2 + nLineW - 1 );
+ Polygon aTriPoly( 3, aTriangle );
+ rDev.DrawPolygon( aTriPoly );
+ }
+ }
+}
+
+void lcl_VertLine( OutputDevice& rDev, const Point& rTop, const Point& rBottom,
+ const svx::frame::Style& rLine,
+ const svx::frame::Style& rTopLine, const svx::frame::Style& rBottomLine,
+ const Color* pForceColor )
+{
+ if( rLine.Prim() )
+ {
+ svx::frame::DrawVerFrameBorderSlanted( rDev, rTop, rBottom, rLine, pForceColor );
+
+ svx::frame::Style aScaled( rLine );
+ aScaled.ScaleSelf( 1.0 / cos( svx::frame::GetVerDiagAngle( rTop, rBottom ) ) );
+ if( pForceColor )
+ aScaled.SetColor( *pForceColor );
+
+ long nXOffs = (aScaled.GetWidth() - 1) / -2L;
+
+ lcl_VertLineEnds( rDev, rTop, rBottom, aScaled.GetColor(),
+ nXOffs, aScaled.Prim(), rTopLine, rBottomLine );
+
+ if( aScaled.Secn() )
+ lcl_VertLineEnds( rDev, rTop, rBottom, aScaled.GetColor(),
+ nXOffs + aScaled.Prim() + aScaled.Dist(), aScaled.Secn(), rTopLine, rBottomLine );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::TakeObjNameSingul(XubString& rName) const
+{
+ rName = ImpGetResStr(STR_ObjNameSingulTable);
+
+ String aName( GetName() );
+ if(aName.Len())
+ {
+ rName += sal_Unicode(' ');
+ rName += sal_Unicode('\'');
+ rName += aName;
+ rName += sal_Unicode('\'');
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::TakeObjNamePlural(XubString& rName) const
+{
+ rName = ImpGetResStr(STR_ObjNamePluralTable);
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::operator=(const SdrObject& rObj)
+{
+ // call parent
+ SdrObject::operator=(rObj);
+
+ const SdrTableObj* pTableObj = dynamic_cast< const SdrTableObj* >( &rObj );
+ if (pTableObj!=NULL)
+ {
+ TableModelNotifyGuard aGuard( mpImpl ? mpImpl->mxTable.get() : 0 );
+
+ maLogicRect = pTableObj->maLogicRect;
+ aRect = pTableObj->aRect;
+ aGeo = pTableObj->aGeo;
+ eTextKind = pTableObj->eTextKind;
+ bTextFrame = pTableObj->bTextFrame;
+ aTextSize = pTableObj->aTextSize;
+ bTextSizeDirty = pTableObj->bTextSizeDirty;
+ bNoShear = pTableObj->bNoShear;
+ bNoRotate = pTableObj->bNoRotate;
+ bNoMirror = pTableObj->bNoMirror;
+ bDisableAutoWidthOnDragging = pTableObj->bDisableAutoWidthOnDragging;
+
+ if( pTableObj->mpImpl )
+ *mpImpl = *pTableObj->mpImpl;
+ }
+}
+
+// --------------------------------------------------------------------
+
+basegfx::B2DPolyPolygon SdrTableObj::TakeXorPoly() const
+{
+ return SdrTextObj::TakeXorPoly();
+}
+
+// --------------------------------------------------------------------
+
+basegfx::B2DPolyPolygon SdrTableObj::TakeContour() const
+{
+ return SdrTextObj::TakeContour();
+}
+
+// --------------------------------------------------------------------
+
+const Rectangle& SdrTableObj::GetSnapRect() const
+{
+ return aRect;
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::NbcSetSnapRect(const Rectangle& rRect)
+{
+ NbcSetLogicRect( rRect );
+}
+
+// --------------------------------------------------------------------
+
+const Rectangle& SdrTableObj::GetLogicRect() const
+{
+ return maLogicRect;
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::RecalcSnapRect()
+{
+}
+
+// --------------------------------------------------------------------
+
+sal_uInt32 SdrTableObj::GetSnapPointCount() const
+{
+ return SdrTextObj::GetSnapPointCount();
+}
+
+// --------------------------------------------------------------------
+
+
+Point SdrTableObj::GetSnapPoint(sal_uInt32 i) const
+{
+ return SdrTextObj::GetSnapPoint(i);
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool SdrTableObj::BegTextEdit(SdrOutliner& rOutl)
+{
+ if( pEdtOutl != NULL )
+ return sal_False;
+
+ pEdtOutl=&rOutl;
+
+// ForceOutlinerParaObject();
+
+ mbInEditMode = sal_True;
+
+ rOutl.Init( OUTLINERMODE_TEXTOBJECT );
+ rOutl.SetRefDevice( pModel->GetRefDevice() );
+
+// --
+ FASTBOOL bUpdMerk=rOutl.GetUpdateMode();
+ if (bUpdMerk) rOutl.SetUpdateMode(sal_False);
+ Size aPaperMin;
+ Size aPaperMax;
+ Rectangle aEditArea;
+ TakeTextEditArea(&aPaperMin,&aPaperMax,&aEditArea,NULL);
+
+ rOutl.SetMinAutoPaperSize(aPaperMin);
+ rOutl.SetMaxAutoPaperSize(aPaperMax);
+ rOutl.SetPaperSize(aPaperMax);
+
+ if (bUpdMerk) rOutl.SetUpdateMode(sal_True);
+//---
+
+ sal_uIntPtr nStat=rOutl.GetControlWord();
+// nStat &= ~EE_CNTRL_AUTOPAGESIZE;
+ nStat |= EE_CNTRL_AUTOPAGESIZE;
+ nStat &=~EE_CNTRL_STRETCHING;
+ rOutl.SetControlWord(nStat);
+
+ OutlinerParaObject* pPara = GetOutlinerParaObject();
+ if(pPara)
+ rOutl.SetText(*pPara);
+
+ rOutl.UpdateFields();
+ rOutl.ClearModifyFlag();
+
+// mpImpl->mnSavedEditRowHeight = mpImpl->mpLayouter->getRowHeight( mpImpl->maEditPos.mnRow );
+
+ return sal_True;
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::EndTextEdit(SdrOutliner& rOutl)
+{
+ if(rOutl.IsModified())
+ {
+ if( GetModel() && GetModel()->IsUndoEnabled() )
+ GetModel()->AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*this) );
+
+ OutlinerParaObject* pNewText = 0;
+ Paragraph* p1stPara = rOutl.GetParagraph( 0 );
+ sal_uInt32 nParaAnz = rOutl.GetParagraphCount();
+
+ if(p1stPara)
+ {
+ if(nParaAnz == 1)
+ {
+ // if its only one paragraph, check if it is empty
+ XubString aStr(rOutl.GetText(p1stPara));
+
+ if(!aStr.Len())
+ {
+ // gotcha!
+ nParaAnz = 0;
+ }
+ }
+
+ // to remove the grey field background
+ rOutl.UpdateFields();
+
+ if(nParaAnz != 0)
+ {
+ // create new text object
+ pNewText = rOutl.CreateParaObject( 0, (sal_uInt16)nParaAnz );
+ }
+ }
+ SetOutlinerParaObject(pNewText);
+ }
+
+ pEdtOutl = 0;
+ rOutl.Clear();
+ sal_uInt32 nStat = rOutl.GetControlWord();
+ nStat &= ~EE_CNTRL_AUTOPAGESIZE;
+ rOutl.SetControlWord(nStat);
+
+ mbInEditMode = sal_False;
+}
+
+// --------------------------------------------------------------------
+
+OutlinerParaObject* SdrTableObj::GetOutlinerParaObject() const
+{
+ CellRef xCell( getActiveCell() );
+ if( xCell.is() )
+ return xCell->GetOutlinerParaObject();
+ else
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::NbcSetOutlinerParaObject( OutlinerParaObject* pTextObject)
+{
+ CellRef xCell( getActiveCell() );
+ if( xCell.is() )
+ {
+ if( pModel )
+ {
+ // Update HitTestOutliner
+ const SdrTextObj* pTestObj = pModel->GetHitTestOutliner().GetTextObj();
+ if( pTestObj && pTestObj->GetOutlinerParaObject() == xCell->GetOutlinerParaObject() )
+ pModel->GetHitTestOutliner().SetTextObj( NULL );
+ }
+
+ xCell->SetOutlinerParaObject( pTextObject );
+
+ SetTextSizeDirty();
+ NbcAdjustTextFrameWidthAndHeight();
+// ImpSetTextStyleSheetListeners();
+// ImpCheckMasterCachable();
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::NbcSetLogicRect(const Rectangle& rRect)
+{
+ maLogicRect=rRect;
+ ImpJustifyRect(maLogicRect);
+ const bool bWidth = maLogicRect.getWidth() != aRect.getWidth();
+ const bool bHeight = maLogicRect.getHeight() != aRect.getHeight();
+ aRect=maLogicRect;
+ NbcAdjustTextFrameWidthAndHeight( !bHeight, !bWidth );
+ SetRectsDirty();
+}
+
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::AdjustToMaxRect( const Rectangle& rMaxRect, bool /* bShrinkOnly = false */ )
+{
+ Rectangle aAdjustRect( rMaxRect );
+ aAdjustRect.setHeight( GetLogicRect().getHeight() );
+ SetLogicRect( aAdjustRect );
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::NbcMove(const Size& rSiz)
+{
+ MoveRect(maLogicRect,rSiz);
+ SdrTextObj::NbcMove( rSiz );
+ if( mpImpl )
+ mpImpl->UpdateCells( aRect );
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+{
+ Rectangle aOldRect( maLogicRect );
+ ResizeRect(maLogicRect,rRef,xFact,yFact);
+
+ aRect = maLogicRect;
+ NbcAdjustTextFrameWidthAndHeight( maLogicRect.GetHeight() == aOldRect.GetHeight(), maLogicRect.GetWidth() == aOldRect.GetWidth() );
+ SetRectsDirty();
+}
+
+// --------------------------------------------------------------------
+
+FASTBOOL SdrTableObj::AdjustTextFrameWidthAndHeight(FASTBOOL bHgt, FASTBOOL bWdt)
+{
+ Rectangle aNeuRect(maLogicRect);
+ FASTBOOL bRet=AdjustTextFrameWidthAndHeight(aNeuRect,bHgt,bWdt);
+ if (bRet)
+ {
+ Rectangle aBoundRect0;
+ if (pUserCall!=NULL)
+ aBoundRect0=GetLastBoundRect();
+ aRect=aNeuRect;
+ SetRectsDirty();
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+ }
+ return bRet;
+}
+
+// --------------------------------------------------------------------
+
+FASTBOOL SdrTableObj::AdjustTextFrameWidthAndHeight(Rectangle& rR, FASTBOOL bHeight, FASTBOOL bWidth) const
+{
+ if((pModel == NULL) || rR.IsEmpty() || !mpImpl || !mpImpl->mxTable.is() )
+ return sal_False;
+
+ Rectangle aRectangle( rR );
+ mpImpl->LayoutTable( aRectangle, !bWidth, !bHeight );
+
+ if( aRectangle != rR )
+ {
+ rR = aRectangle;
+ return sal_True;
+ }
+ else
+ {
+ return sal_False;
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::NbcReformatText()
+{
+ NbcAdjustTextFrameWidthAndHeight();
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::ReformatText()
+{
+ Rectangle aBoundRect0;
+ if (pUserCall!=NULL)
+ aBoundRect0=GetLastBoundRect();
+ NbcReformatText();
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
+}
+
+// --------------------------------------------------------------------
+
+sal_Bool SdrTableObj::IsVerticalWriting() const
+{
+ const SvxWritingModeItem* pModeItem = dynamic_cast< const SvxWritingModeItem* >( &GetObjectItem( SDRATTR_TEXTDIRECTION ) );
+ return pModeItem && pModeItem->GetValue() == com::sun::star::text::WritingMode_TB_RL;
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::SetVerticalWriting(sal_Bool bVertical )
+{
+ if( bVertical != IsVerticalWriting() )
+ {
+ SvxWritingModeItem aModeItem( com::sun::star::text::WritingMode_LR_TB, SDRATTR_TEXTDIRECTION );
+ SetObjectItem( aModeItem );
+ }
+}
+
+// --------------------------------------------------------------------
+
+WritingMode SdrTableObj::GetWritingMode() const
+{
+ WritingMode eMode = WritingMode_LR_TB;
+ if( mpImpl && mpImpl->mpLayouter )
+ eMode = mpImpl->mpLayouter->GetWritingMode();
+ return eMode;
+}
+
+// --------------------------------------------------------------------
+
+// gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon
+// with the base geometry and returns TRUE. Otherwise it returns FALSE.
+sal_Bool SdrTableObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon ) const
+{
+ return SdrTextObj::TRGetBaseGeometry( rMatrix, rPolyPolygon );
+}
+
+// --------------------------------------------------------------------
+
+// sets the base geometry of the object using infos contained in the homogen 3x3 matrix.
+// If it's an SdrPathObj it will use the provided geometry information. The Polygon has
+// to use (0,0) as upper left and will be scaled to the given size in the matrix.
+void SdrTableObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon )
+{
+ SdrTextObj::TRSetBaseGeometry( rMatrix, rPolyPolygon );
+}
+
+// --------------------------------------------------------------------
+
+bool SdrTableObj::IsRealyEdited() const
+{
+ return pEdtOutl && pEdtOutl->IsModified();
+}
+
+// --------------------------------------------------------------------
+
+FASTBOOL SdrTableObj::IsFontwork() const
+{
+ return sal_False;
+}
+
+// --------------------------------------------------------------------
+
+sal_uInt32 SdrTableObj::GetHdlCount() const
+{
+ sal_uInt32 nCount = SdrTextObj::GetHdlCount();
+ const sal_Int32 nRowCount = mpImpl->getRowCount();
+ const sal_Int32 nColCount = mpImpl->getColumnCount();
+
+ if( nRowCount && nColCount )
+ nCount += nRowCount + nColCount + 2 + 1;
+
+ return nCount;
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::AddToHdlList(SdrHdlList& rHdlList) const
+{
+ const sal_Int32 nRowCount = mpImpl->getRowCount();
+ const sal_Int32 nColCount = mpImpl->getColumnCount();
+
+ // first add row handles
+ std::vector< TableEdgeHdl* > aRowEdges( nRowCount + 1 );
+
+ for( sal_Int32 nRow = 0; nRow <= nRowCount; nRow++ )
+ {
+ sal_Int32 nEdgeMin, nEdgeMax;
+ const sal_Int32 nEdge = mpImpl->mpLayouter->getHorizontalEdge( nRow, &nEdgeMin, &nEdgeMax );
+ nEdgeMin -= nEdge;
+ nEdgeMax -= nEdge;
+
+ Point aPoint( aRect.TopLeft() );
+ aPoint.Y() += nEdge;
+
+ TableEdgeHdl* pHdl= new TableEdgeHdl(aPoint,true,nEdgeMin,nEdgeMax,nColCount+1);
+ pHdl->SetPointNum( nRow );
+ rHdlList.AddHdl( pHdl );
+ aRowEdges[nRow] = pHdl;
+ }
+
+ // second add column handles
+ std::vector< TableEdgeHdl* > aColEdges( nColCount + 1 );
+
+ for( sal_Int32 nCol = 0; nCol <= nColCount; nCol++ )
+ {
+ sal_Int32 nEdgeMin, nEdgeMax;
+ const sal_Int32 nEdge = mpImpl->mpLayouter->getVerticalEdge( nCol, &nEdgeMin, &nEdgeMax );
+ nEdgeMin -= nEdge;
+ nEdgeMax -= nEdge;
+
+ Point aPoint( aRect.TopLeft() );
+ aPoint.X() += nEdge;
+
+ TableEdgeHdl* pHdl = new TableEdgeHdl(aPoint,false,nEdgeMin,nEdgeMax, nRowCount+1);
+ pHdl->SetPointNum( nCol );
+ rHdlList.AddHdl( pHdl );
+ aColEdges[nCol] = pHdl;
+ }
+
+ // now add visible edges to row and column handles
+ if( mpImpl && mpImpl->mpLayouter )
+ {
+ TableLayouter& rLayouter = *mpImpl->mpLayouter;
+
+ sal_Int32 nY = 0;
+
+ for( sal_Int32 nRow = 0; nRow <= nRowCount; ++nRow )
+ {
+ const sal_Int32 nRowHeight = (nRow == nRowCount) ? 0 : rLayouter.getRowHeight(nRow);
+ sal_Int32 nX = 0;
+
+ for( sal_Int32 nCol = 0; nCol <= nColCount; ++nCol )
+ {
+ const sal_Int32 nColWidth = (nCol == nColCount) ? 0 : rLayouter.getColumnWidth(nCol);
+
+ if( nRowHeight > 0 )
+ {
+ if( rLayouter.isEdgeVisible( nCol, nRow, false ) )
+ aColEdges[nCol]->SetEdge( nRow, nY, nY + nRowHeight, (rLayouter.getBorderLine( nCol, nRow, false ) == 0) ? Visible : Invisible);
+ }
+
+ if( nColWidth > 0 )
+ {
+ if( rLayouter.isEdgeVisible( nCol, nRow, true ) )
+ aRowEdges[nRow]->SetEdge( nCol, nX, nX + nColWidth, (rLayouter.getBorderLine( nCol, nRow, true ) == 0) ? Visible : Invisible);
+ }
+
+ nX += nColWidth;
+ }
+
+ nY += nRowHeight;
+ }
+ }
+
+ // add remaining handles
+ SdrHdl* pH=0;
+ rHdlList.AddHdl( pH = new TableBorderHdl( aRect ) ); pH->SetMoveOutside( true );
+ rHdlList.AddHdl( pH = new SdrHdl(aRect.TopLeft(),HDL_UPLFT) ); pH->SetMoveOutside( true );
+ rHdlList.AddHdl( pH = new SdrHdl(aRect.TopCenter(),HDL_UPPER) ); pH->SetMoveOutside( true );
+ rHdlList.AddHdl( pH = new SdrHdl(aRect.TopRight(),HDL_UPRGT) ); pH->SetMoveOutside( true );
+ rHdlList.AddHdl( pH = new SdrHdl(aRect.LeftCenter(),HDL_LEFT) ); pH->SetMoveOutside( true );
+ rHdlList.AddHdl( pH = new SdrHdl(aRect.RightCenter(),HDL_RIGHT) ); pH->SetMoveOutside( true );
+ rHdlList.AddHdl( pH = new SdrHdl(aRect.BottomLeft(),HDL_LWLFT) ); pH->SetMoveOutside( true );
+ rHdlList.AddHdl( pH = new SdrHdl(aRect.BottomCenter(),HDL_LOWER) ); pH->SetMoveOutside( true );
+ rHdlList.AddHdl( pH = new SdrHdl(aRect.BottomRight(),HDL_LWRGT) ); pH->SetMoveOutside( true );
+
+ sal_uIntPtr nHdlCount = rHdlList.GetHdlCount();
+ for( sal_uIntPtr nHdl = 0; nHdl < nHdlCount; nHdl++ )
+ rHdlList.GetHdl(nHdl)->SetObj((SdrObject*)this);
+}
+
+// --------------------------------------------------------------------
+
+SdrHdl* SdrTableObj::GetHdl(sal_uInt32 nHdlNum) const
+{
+ // #i73248#
+ // Warn the user that this is ineffective and show alternatives. Should not be used at all.
+ OSL_ENSURE(false, "SdrTableObj::GetHdl(): ineffective, use AddToHdlList instead (!)");
+
+ // to have an alternative, get single handle using the ineffective way
+ SdrHdl* pRetval = 0;
+ SdrHdlList aLocalList(0);
+ AddToHdlList(aLocalList);
+ const sal_uInt32 nHdlCount(aLocalList.GetHdlCount());
+
+ if(nHdlCount && nHdlNum < nHdlCount)
+ {
+ // remove and remember. The other created handles will be deleted again with the
+ // destruction of the local list
+ pRetval = aLocalList.RemoveHdl(nHdlNum);
+ }
+
+ return pRetval;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Draging
+
+bool SdrTableObj::hasSpecialDrag() const
+{
+ return true;
+}
+
+bool SdrTableObj::beginSpecialDrag(SdrDragStat& rDrag) const
+{
+ const SdrHdl* pHdl = rDrag.GetHdl();
+ const SdrHdlKind eHdl((pHdl == NULL) ? HDL_MOVE : pHdl->GetKind());
+
+ switch( eHdl )
+ {
+ case HDL_UPLFT:
+ case HDL_UPPER:
+ case HDL_UPRGT:
+ case HDL_LEFT:
+ case HDL_RIGHT:
+ case HDL_LWLFT:
+ case HDL_LOWER:
+ case HDL_LWRGT:
+ case HDL_MOVE:
+ {
+ break;
+ }
+
+ case HDL_USER:
+ {
+ rDrag.SetEndDragChangesAttributes(false);
+ rDrag.SetNoSnap(true);
+ break;
+ }
+
+ default:
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool SdrTableObj::applySpecialDrag(SdrDragStat& rDrag)
+{
+ bool bRet(true);
+ const SdrHdl* pHdl = rDrag.GetHdl();
+ const SdrHdlKind eHdl((pHdl == NULL) ? HDL_MOVE : pHdl->GetKind());
+
+ switch( eHdl )
+ {
+ case HDL_UPLFT:
+ case HDL_UPPER:
+ case HDL_UPRGT:
+ case HDL_LEFT:
+ case HDL_RIGHT:
+ case HDL_LWLFT:
+ case HDL_LOWER:
+ case HDL_LWRGT:
+ {
+ const Rectangle aNewRectangle(ImpDragCalcRect(rDrag));
+
+ if(aNewRectangle != aRect)
+ {
+ NbcSetLogicRect(aNewRectangle);
+ }
+
+ break;
+ }
+
+ case HDL_MOVE:
+ {
+ NbcMove( Size( rDrag.GetDX(), rDrag.GetDY() ) );
+ break;
+ }
+
+ case HDL_USER:
+ {
+ rDrag.SetEndDragChangesAttributes(false);
+ rDrag.SetNoSnap(true);
+ const TableEdgeHdl* pEdgeHdl = dynamic_cast< const TableEdgeHdl* >( pHdl );
+
+ if( pEdgeHdl )
+ {
+ if( GetModel() && IsInserted() )
+ {
+ rDrag.SetEndDragChangesAttributes(true);
+ }
+
+ mpImpl->DragEdge( pEdgeHdl->IsHorizontalEdge(), pEdgeHdl->GetPointNum(), pEdgeHdl->GetValidDragOffset( rDrag ) );
+ }
+ break;
+ }
+
+ default:
+ {
+ bRet = false;
+ }
+ }
+
+ return bRet;
+}
+
+String SdrTableObj::getSpecialDragComment(const SdrDragStat& rDrag) const
+{
+ return SdrTextObj::getSpecialDragComment( rDrag );
+}
+
+basegfx::B2DPolyPolygon SdrTableObj::getSpecialDragPoly(const SdrDragStat& rDrag) const
+{
+ basegfx::B2DPolyPolygon aRetval;
+ const SdrHdl* pHdl = rDrag.GetHdl();
+
+ if( pHdl && (HDL_USER == pHdl->GetKind()) )
+ {
+ const TableEdgeHdl* pEdgeHdl = dynamic_cast< const TableEdgeHdl* >( pHdl );
+
+ if( pEdgeHdl )
+ {
+ aRetval = pEdgeHdl->getSpecialDragPoly( rDrag );
+ }
+ }
+
+ return aRetval;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Create
+// --------------------------------------------------------------------
+
+FASTBOOL SdrTableObj::BegCreate(SdrDragStat& rStat)
+{
+ rStat.SetOrtho4Possible();
+ Rectangle aRect1(rStat.GetStart(), rStat.GetNow());
+ aRect1.Justify();
+ rStat.SetActionRect(aRect1);
+ aRect = aRect1;
+ return sal_True;
+}
+
+// --------------------------------------------------------------------
+
+FASTBOOL SdrTableObj::MovCreate(SdrDragStat& rStat)
+{
+ Rectangle aRect1;
+ rStat.TakeCreateRect(aRect1);
+ ImpJustifyRect(aRect1);
+ rStat.SetActionRect(aRect1);
+ aRect=aRect1; // fuer ObjName
+ SetBoundRectDirty();
+ bSnapRectDirty=sal_True;
+ return sal_True;
+}
+
+// --------------------------------------------------------------------
+
+FASTBOOL SdrTableObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
+{
+ rStat.TakeCreateRect(aRect);
+ ImpJustifyRect(aRect);
+ return (eCmd==SDRCREATE_FORCEEND || rStat.GetPointAnz()>=2);
+}
+
+void SdrTableObj::BrkCreate(SdrDragStat& /*rStat*/)
+{
+}
+
+// --------------------------------------------------------------------
+
+FASTBOOL SdrTableObj::BckCreate(SdrDragStat& /*rStat*/)
+{
+ return sal_True;
+}
+
+// --------------------------------------------------------------------
+
+basegfx::B2DPolyPolygon SdrTableObj::TakeCreatePoly(const SdrDragStat& rDrag) const
+{
+ Rectangle aRect1;
+ rDrag.TakeCreateRect(aRect1);
+ aRect1.Justify();
+
+ basegfx::B2DPolyPolygon aRetval;
+ const basegfx::B2DRange aRange(aRect1.Left(), aRect1.Top(), aRect1.Right(), aRect1.Bottom());
+ aRetval.append(basegfx::tools::createPolygonFromRect(aRange));
+ return aRetval;
+}
+
+// --------------------------------------------------------------------
+
+Pointer SdrTableObj::GetCreatePointer() const
+{
+ return Pointer(POINTER_CROSS);
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::createCell( CellRef& xNewCell )
+{
+ xNewCell = Cell::create( *this, 0 );
+}
+
+// --------------------------------------------------------------------
+
+SdrObjGeoData *SdrTableObj::NewGeoData() const
+{
+ return new TableObjectGeoData;
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::SaveGeoData(SdrObjGeoData& rGeo) const
+{
+ DBG_ASSERT( dynamic_cast< TableObjectGeoData* >( &rGeo ), "svx::SdrTableObj::SaveGeoData(), illegal geo data!" );
+ SdrTextObj::SaveGeoData (rGeo);
+
+ ((TableObjectGeoData &) rGeo).maLogicRect = maLogicRect;
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::RestGeoData(const SdrObjGeoData& rGeo)
+{
+ DBG_ASSERT( dynamic_cast< const TableObjectGeoData* >( &rGeo ), "svx::SdrTableObj::SaveGeoData(), illegal geo data!" );
+
+ maLogicRect = ((TableObjectGeoData &) rGeo).maLogicRect;
+
+ SdrTextObj::RestGeoData (rGeo);
+
+ if( mpImpl )
+ mpImpl->LayoutTable( aRect, false, false );
+ ActionChanged();
+}
+
+// --------------------------------------------------------------------
+
+SdrTableObj* SdrTableObj::CloneRange( const CellPos& rStart, const CellPos& rEnd )
+{
+ const sal_Int32 nColumns = rEnd.mnCol - rStart.mnCol + 1;
+ const sal_Int32 nRows = rEnd.mnRow - rStart.mnRow + 1;
+
+ SdrTableObj* pNewTableObj = new SdrTableObj( GetModel(), GetCurrentBoundRect(), nColumns, nRows);
+ pNewTableObj->setTableStyleSettings( getTableStyleSettings() );
+ pNewTableObj->setTableStyle( getTableStyle() );
+
+ Reference< XTable > xTable( getTable() );
+ Reference< XTable > xNewTable( pNewTableObj->getTable() );
+
+ if( !xTable.is() || !xNewTable.is() )
+ {
+ delete pNewTableObj;
+ return 0;
+ }
+
+ // copy cells
+ for( sal_Int32 nRow = 0; nRow < nRows; ++nRow )
+ {
+ for( sal_Int32 nCol = 0; nCol < nColumns; ++nCol ) try
+ {
+ CellRef xTargetCell( dynamic_cast< Cell* >( xNewTable->getCellByPosition( nCol, nRow ).get() ) );
+ if( xTargetCell.is() )
+ xTargetCell->cloneFrom( dynamic_cast< Cell* >( xTable->getCellByPosition( rStart.mnCol + nCol, rStart.mnRow + nRow ).get() ) );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "svx::SvxTableController::GetMarkedObjModel(), exception caught!" );
+ }
+ }
+
+ // copy row heights
+ Reference< XTableRows > xNewRows( xNewTable->getRows(), UNO_QUERY_THROW );
+ const OUString sHeight( RTL_CONSTASCII_USTRINGPARAM( "Height" ) );
+ for( sal_Int32 nRow = 0; nRow < nRows; ++nRow )
+ {
+ Reference< XPropertySet > xNewSet( xNewRows->getByIndex( nRow ), UNO_QUERY_THROW );
+ xNewSet->setPropertyValue( sHeight, Any( mpImpl->mpLayouter->getRowHeight( rStart.mnRow + nRow ) ) );
+ }
+
+ // copy column widths
+ Reference< XTableColumns > xNewColumns( xNewTable->getColumns(), UNO_QUERY_THROW );
+ const OUString sWidth( RTL_CONSTASCII_USTRINGPARAM( "Width" ) );
+ for( sal_Int32 nCol = 0; nCol < nColumns; ++nCol )
+ {
+ Reference< XPropertySet > xNewSet( xNewColumns->getByIndex( nCol ), UNO_QUERY_THROW );
+ xNewSet->setPropertyValue( sWidth, Any( mpImpl->mpLayouter->getColumnWidth( rStart.mnCol + nCol ) ) );
+ }
+
+ pNewTableObj->NbcReformatText();
+ pNewTableObj->SetLogicRect( pNewTableObj->GetCurrentBoundRect() );
+
+ return pNewTableObj;
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::DistributeColumns( sal_Int32 nFirstColumn, sal_Int32 nLastColumn )
+{
+ if( mpImpl && mpImpl->mpLayouter )
+ {
+ TableModelNotifyGuard aGuard( mpImpl->mxTable.get() );
+ mpImpl->mpLayouter->DistributeColumns( aRect, nFirstColumn, nLastColumn );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::DistributeRows( sal_Int32 nFirstRow, sal_Int32 nLastRow )
+{
+ if( mpImpl && mpImpl->mpLayouter )
+ {
+ TableModelNotifyGuard aGuard( mpImpl->mxTable.get() );
+ mpImpl->mpLayouter->DistributeRows( aRect, nFirstRow, nLastRow );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::SetChanged()
+{
+ if( mpImpl )
+ {
+ if( mpImpl->UpdateWritingMode() )
+ mpImpl->LayoutTable( aRect, false, false );
+ }
+
+ ::SdrTextObj::SetChanged();
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::uno_lock()
+{
+ if( mpImpl && mpImpl->mxTable.is() )
+ mpImpl->mxTable->lockBroadcasts();
+}
+
+// --------------------------------------------------------------------
+
+void SdrTableObj::uno_unlock()
+{
+ if( mpImpl && mpImpl->mxTable.is() )
+ mpImpl->mxTable->unlockBroadcasts();
+}
+
+// --------------------------------------------------------------------
+
+
+
+} }
diff --git a/svx/source/table/table.src b/svx/source/table/table.src
new file mode 100644
index 000000000000..9ef928599575
--- /dev/null
+++ b/svx/source/table/table.src
@@ -0,0 +1,34 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "svx/dialogs.hrc"
+
+String RID_SVXSTR_STYLEFAMILY_TABLEDESIGN
+{
+ Text [ en-US ] = "Table Design Styles";
+};
+
diff --git a/svx/source/table/tablecolumn.cxx b/svx/source/table/tablecolumn.cxx
new file mode 100644
index 000000000000..9c0df0e77664
--- /dev/null
+++ b/svx/source/table/tablecolumn.cxx
@@ -0,0 +1,305 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <com/sun/star/lang/DisposedException.hpp>
+
+#include "tablecolumn.hxx"
+#include "tableundo.hxx"
+#include "svx/svdmodel.hxx"
+#include "svx/svdotable.hxx"
+
+// -----------------------------------------------------------------------------
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::beans;
+
+// -----------------------------------------------------------------------------
+
+namespace sdr { namespace table {
+
+const sal_Int32 Property_Width = 0;
+const sal_Int32 Property_OptimalWidth = 1;
+const sal_Int32 Property_IsVisible = 2;
+const sal_Int32 Property_IsStartOfNewPage = 3;
+
+// -----------------------------------------------------------------------------
+// TableRow
+// -----------------------------------------------------------------------------
+
+TableColumn::TableColumn( const TableModelRef& xTableModel, sal_Int32 nColumn )
+: TableColumnBase( getStaticPropertySetInfo() )
+, mxTableModel( xTableModel )
+, mnColumn( nColumn )
+, mnWidth( 0 )
+, mbOptimalWidth( sal_True )
+, mbIsVisible( sal_True )
+, mbIsStartOfNewPage( sal_False )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+TableColumn::~TableColumn()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void TableColumn::dispose()
+{
+ mxTableModel.clear();
+}
+
+// -----------------------------------------------------------------------------
+
+void TableColumn::throwIfDisposed() const throw (::com::sun::star::uno::RuntimeException)
+{
+ if( !mxTableModel.is() )
+ throw DisposedException();
+}
+
+// -----------------------------------------------------------------------------
+
+TableColumn& TableColumn::operator=( const TableColumn& r )
+{
+ mnWidth = r.mnWidth;
+ mbOptimalWidth = r.mbOptimalWidth;
+ mbIsVisible = r.mbIsVisible;
+ mbIsStartOfNewPage = r.mbIsStartOfNewPage;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------------
+// XCellRange
+// -----------------------------------------------------------------------------
+
+Reference< XCell > SAL_CALL TableColumn::getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ throwIfDisposed();
+ if( nColumn != 0 )
+ throw IndexOutOfBoundsException();
+
+ return mxTableModel->getCellByPosition( mnColumn, nRow );
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XCellRange > SAL_CALL TableColumn::getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ throwIfDisposed();
+ if( (nTop >= 0 ) && (nLeft == 0) && (nBottom >= nTop) && (nRight == 0) )
+ {
+ return mxTableModel->getCellRangeByPosition( mnColumn, nTop, mnColumn, nBottom );
+ }
+ throw IndexOutOfBoundsException();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XCellRange > SAL_CALL TableColumn::getCellRangeByName( const OUString& /*aRange*/ ) throw (RuntimeException)
+{
+ return Reference< XCellRange >();
+}
+
+// -----------------------------------------------------------------------------
+// XNamed
+// -----------------------------------------------------------------------------
+
+OUString SAL_CALL TableColumn::getName() throw (RuntimeException)
+{
+ return maName;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL TableColumn::setName( const OUString& aName ) throw (RuntimeException)
+{
+ maName = aName;
+}
+
+// -----------------------------------------------------------------------------
+// XFastPropertySet
+// -----------------------------------------------------------------------------
+
+void SAL_CALL TableColumn::setFastPropertyValue( sal_Int32 nHandle, const Any& aValue ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, RuntimeException)
+{
+ bool bOk = false;
+ bool bChange = false;
+
+ SdrModel* pModel = mxTableModel->getSdrTableObj()->GetModel();
+
+ TableColumnUndo* pUndo = 0;
+ if( mxTableModel.is() && mxTableModel->getSdrTableObj() && mxTableModel->getSdrTableObj()->IsInserted() && pModel && pModel->IsUndoEnabled() )
+ {
+ TableColumnRef xThis( this );
+ pUndo = new TableColumnUndo( xThis );
+ }
+
+ switch( nHandle )
+ {
+ case Property_Width:
+ {
+ sal_Int32 nWidth = mnWidth;
+ bOk = aValue >>= nWidth;
+ if( bOk && (nWidth != mnWidth) )
+ {
+ mnWidth = nWidth;
+ mbOptimalWidth = mnWidth == 0;
+ bChange = true;
+ }
+ break;
+ }
+ case Property_OptimalWidth:
+ {
+ sal_Bool bOptimalWidth = mbOptimalWidth;
+ bOk = aValue >>= bOptimalWidth;
+ if( bOk && (mbOptimalWidth != bOptimalWidth) )
+ {
+ mbOptimalWidth = bOptimalWidth;
+ if( bOptimalWidth )
+ mnWidth = 0;
+ bChange = true;
+ }
+ break;
+ }
+ case Property_IsVisible:
+ {
+ sal_Bool bIsVisible = mbIsVisible;
+ bOk = aValue >>= bIsVisible;
+ if( bOk && (mbIsVisible != bIsVisible) )
+ {
+ mbIsVisible = bIsVisible;
+ bChange = true;
+ }
+ break;
+ }
+
+ case Property_IsStartOfNewPage:
+ {
+ sal_Bool bIsStartOfNewPage = mbIsStartOfNewPage;
+ bOk = aValue >>= bIsStartOfNewPage;
+ if( bOk && (mbIsStartOfNewPage != bIsStartOfNewPage) )
+ {
+ mbIsStartOfNewPage = bIsStartOfNewPage;
+ bChange = true;
+ }
+ break;
+ }
+ default:
+ throw UnknownPropertyException();
+ }
+ if( !bOk )
+ throw IllegalArgumentException();
+
+ if( bChange )
+ {
+ if( pUndo )
+ {
+ pModel->AddUndo( pUndo );
+ pUndo = 0;
+ }
+ mxTableModel->setModified(sal_True);
+ }
+
+ if( pUndo )
+ delete pUndo;
+}
+
+// -----------------------------------------------------------------------------
+
+Any SAL_CALL TableColumn::getFastPropertyValue( sal_Int32 nHandle ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ switch( nHandle )
+ {
+ case Property_Width: return Any( mnWidth );
+ case Property_OptimalWidth: return Any( mbOptimalWidth );
+ case Property_IsVisible: return Any( mbIsVisible );
+ case Property_IsStartOfNewPage: return Any( mbIsStartOfNewPage );
+ default: throw UnknownPropertyException();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+rtl::Reference< ::comphelper::FastPropertySetInfo > TableColumn::getStaticPropertySetInfo()
+{
+ static rtl::Reference< ::comphelper::FastPropertySetInfo > xInfo;
+ if( !xInfo.is() )
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is() )
+ {
+ comphelper::PropertyVector aProperties(6);
+
+ aProperties[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) );
+ aProperties[0].Handle = Property_Width;
+ aProperties[0].Type = ::getCppuType((const sal_Int32*)0);
+ aProperties[0].Attributes = 0;
+
+ aProperties[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "OptimalWidth" ) );
+ aProperties[1].Handle = Property_OptimalWidth;
+ aProperties[1].Type = ::getBooleanCppuType();
+ aProperties[1].Attributes = 0;
+
+ aProperties[2].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsVisible" ) );
+ aProperties[2].Handle = Property_IsVisible;
+ aProperties[2].Type = ::getBooleanCppuType();
+ aProperties[2].Attributes = 0;
+
+ aProperties[3].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsStartOfNewPage" ) );
+ aProperties[3].Handle = Property_IsStartOfNewPage;
+ aProperties[3].Type = ::getBooleanCppuType();
+ aProperties[3].Attributes = 0;
+
+ aProperties[4].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Size" ) );
+ aProperties[4].Handle = Property_Width;
+ aProperties[4].Type = ::getCppuType((const sal_Int32*)0);
+ aProperties[4].Attributes = 0;
+
+ aProperties[5].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "OptimalSize" ) );
+ aProperties[5].Handle = Property_OptimalWidth;
+ aProperties[5].Type = ::getBooleanCppuType();
+ aProperties[5].Attributes = 0;
+
+ xInfo.set( new ::comphelper::FastPropertySetInfo(aProperties) );
+ }
+ }
+
+ return xInfo;
+}
+
+// -----------------------------------------------------------------------------
+
+} }
diff --git a/svx/source/table/tablecolumn.hxx b/svx/source/table/tablecolumn.hxx
new file mode 100644
index 000000000000..e020354fe1a7
--- /dev/null
+++ b/svx/source/table/tablecolumn.hxx
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_TABLECOLUMN_HXX_
+#define _SVX_TABLECOLUMN_HXX_
+
+#include <com/sun/star/table/XCellRange.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <cppuhelper/implbase2.hxx>
+
+#include "propertyset.hxx"
+#include "tablemodel.hxx"
+
+// -----------------------------------------------------------------------------
+
+namespace sdr { namespace table {
+
+// -----------------------------------------------------------------------------
+// TableColumn
+// -----------------------------------------------------------------------------
+
+typedef ::cppu::ImplInheritanceHelper2< ::comphelper::FastPropertySet, ::com::sun::star::table::XCellRange, ::com::sun::star::container::XNamed > TableColumnBase;
+
+class TableColumn : public TableColumnBase
+{
+ friend class TableColumnUndo;
+ friend class TableModel;
+public:
+ TableColumn( const TableModelRef& xTableModel, sal_Int32 nColumn );
+ virtual ~TableColumn();
+
+ void dispose();
+ void throwIfDisposed() const throw (::com::sun::star::uno::RuntimeException);
+
+ TableColumn& operator=( const TableColumn& );
+
+ // XCellRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > SAL_CALL getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL getCellRangeByName( const ::rtl::OUString& aRange ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XNamed
+ virtual ::rtl::OUString SAL_CALL getName() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XFastPropertySet
+ virtual void SAL_CALL setFastPropertyValue( ::sal_Int32 nHandle, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue( ::sal_Int32 nHandle ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ static rtl::Reference< ::comphelper::FastPropertySetInfo > getStaticPropertySetInfo();
+
+ TableModelRef mxTableModel;
+ sal_Int32 mnColumn;
+ sal_Int32 mnWidth;
+ sal_Bool mbOptimalWidth;
+ sal_Bool mbIsVisible;
+ sal_Bool mbIsStartOfNewPage;
+ ::rtl::OUString maName;
+};
+
+} }
+
+#endif
diff --git a/svx/source/table/tablecolumns.cxx b/svx/source/table/tablecolumns.cxx
new file mode 100644
index 000000000000..7d0e89a252cd
--- /dev/null
+++ b/svx/source/table/tablecolumns.cxx
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <com/sun/star/lang/DisposedException.hpp>
+
+#include "tablecolumns.hxx"
+#include "tablecolumn.hxx"
+
+// -----------------------------------------------------------------------------
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::table;
+
+// -----------------------------------------------------------------------------
+
+namespace sdr { namespace table {
+
+// -----------------------------------------------------------------------------
+// TableColumns
+// -----------------------------------------------------------------------------
+
+TableColumns::TableColumns( const TableModelRef& xTableModel )
+: mxTableModel( xTableModel )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+TableColumns::~TableColumns()
+{
+ dispose();
+}
+
+// -----------------------------------------------------------------------------
+
+void TableColumns::dispose()
+{
+ mxTableModel.clear();
+}
+
+// -----------------------------------------------------------------------------
+
+void TableColumns::throwIfDisposed() const throw (::com::sun::star::uno::RuntimeException)
+{
+ if( !mxTableModel.is() )
+ throw DisposedException();
+}
+
+// -----------------------------------------------------------------------------
+// XTableRows
+// -----------------------------------------------------------------------------
+
+void SAL_CALL TableColumns::insertByIndex( sal_Int32 nIndex, sal_Int32 nCount ) throw (RuntimeException)
+{
+ throwIfDisposed();
+ mxTableModel->insertColumns( nIndex, nCount );
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL TableColumns::removeByIndex( sal_Int32 nIndex, sal_Int32 nCount ) throw (RuntimeException)
+{
+ throwIfDisposed();
+ mxTableModel->removeColumns( nIndex, nCount );
+}
+
+// -----------------------------------------------------------------------------
+// XIndexAccess
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL TableColumns::getCount() throw (RuntimeException)
+{
+ throwIfDisposed();
+ return mxTableModel->getColumnCount();
+}
+
+// -----------------------------------------------------------------------------
+
+Any SAL_CALL TableColumns::getByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
+{
+ throwIfDisposed();
+
+ if( ( Index < 0 ) || ( Index >= mxTableModel->getColumnCount() ) )
+ throw IndexOutOfBoundsException();
+
+ return Any( Reference< XCellRange >( mxTableModel->getColumn( Index ).get() ) );
+}
+
+// -----------------------------------------------------------------------------
+// XElementAccess
+// -----------------------------------------------------------------------------
+
+Type SAL_CALL TableColumns::getElementType() throw (RuntimeException)
+{
+ throwIfDisposed();
+
+ return XCellRange::static_type();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL TableColumns::hasElements() throw (RuntimeException)
+{
+ throwIfDisposed();
+
+ return mxTableModel->getColumnCount() != 0;
+}
+
+// -----------------------------------------------------------------------------
+
+} }
diff --git a/svx/source/table/tablecolumns.hxx b/svx/source/table/tablecolumns.hxx
new file mode 100644
index 000000000000..2a7be2851141
--- /dev/null
+++ b/svx/source/table/tablecolumns.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_TABLECOLUMNS_HXX_
+#define _SVX_TABLECOLUMNS_HXX_
+
+#include <com/sun/star/table/XTableColumns.hpp>
+#include <cppuhelper/implbase1.hxx>
+
+#include "tablemodel.hxx"
+
+// -----------------------------------------------------------------------------
+
+namespace sdr { namespace table {
+
+// -----------------------------------------------------------------------------
+// TableColumns
+// -----------------------------------------------------------------------------
+
+class TableColumns : public ::cppu::WeakAggImplHelper1< ::com::sun::star::table::XTableColumns >
+{
+public:
+ TableColumns( const TableModelRef& xTableModel );
+ virtual ~TableColumns();
+
+ void dispose();
+ void throwIfDisposed() const throw (::com::sun::star::uno::RuntimeException);
+
+ // XTableColumns
+ virtual void SAL_CALL insertByIndex( sal_Int32 nIndex, sal_Int32 nCount ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeByIndex( sal_Int32 nIndex, sal_Int32 nCount ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // Methods
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasElements() throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ TableModelRef mxTableModel;
+};
+
+} }
+
+#endif
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
new file mode 100644
index 000000000000..9452420901a7
--- /dev/null
+++ b/svx/source/table/tablecontroller.cxx
@@ -0,0 +1,2618 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "tablecontroller.hxx"
+
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/table/XMergeableCellRange.hpp>
+#include <com/sun/star/table/XMergeableCell.hpp>
+
+#include <sal/config.h>
+
+#include <vcl/svapp.hxx>
+#include <svl/whiter.hxx>
+
+#include <sfx2/request.hxx>
+
+#include <editeng/scripttypeitem.hxx>
+#include <svx/svdotable.hxx>
+#include <svx/sdr/overlay/overlayobjectcell.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <svx/svxids.hrc>
+#include <editeng/outlobj.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdetc.hxx>
+#include <editeng/editobj.hxx>
+#include "editeng/editstat.hxx"
+#include "editeng/unolingu.hxx"
+#include "svx/sdrpagewindow.hxx"
+#include <svx/selectioncontroller.hxx>
+#include <svx/svdmodel.hxx>
+#include "svx/sdrpaintwindow.hxx"
+#include <svx/svxdlg.hxx>
+#include <editeng/boxitem.hxx>
+#include "cell.hxx"
+#include <editeng/borderline.hxx>
+#include <editeng/colritem.hxx>
+#include "editeng/bolnitem.hxx"
+#include "svx/svdstr.hrc"
+#include "svx/svdglob.hxx"
+#include "svx/svdpage.hxx"
+#include "tableundo.hxx"
+#include "tablelayouter.hxx"
+
+using ::rtl::OUString;
+using namespace ::sdr::table;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::style;
+
+namespace sdr { namespace table {
+
+// --------------------------------------------------------------------
+// class SvxTableControllerModifyListener
+// --------------------------------------------------------------------
+
+class SvxTableControllerModifyListener : public ::cppu::WeakImplHelper1< ::com::sun::star::util::XModifyListener >
+{
+public:
+ SvxTableControllerModifyListener( SvxTableController* pController )
+ : mpController( pController ) {}
+
+ // XModifyListener
+ virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ SvxTableController* mpController;
+};
+
+// --------------------------------------------------------------------
+// XModifyListener
+// --------------------------------------------------------------------
+
+void SAL_CALL SvxTableControllerModifyListener::modified( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)
+{
+ if( mpController )
+ mpController->onTableModified();
+}
+
+// --------------------------------------------------------------------
+// XEventListener
+// --------------------------------------------------------------------
+
+void SAL_CALL SvxTableControllerModifyListener::disposing( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)
+{
+ mpController = 0;
+}
+
+// --------------------------------------------------------------------
+// class SvxTableController
+// --------------------------------------------------------------------
+
+rtl::Reference< sdr::SelectionController > CreateTableController( SdrObjEditView* pView, const SdrObject* pObj, const rtl::Reference< sdr::SelectionController >& xRefController )
+{
+ return SvxTableController::create( pView, pObj, xRefController );
+}
+
+// --------------------------------------------------------------------
+
+rtl::Reference< sdr::SelectionController > SvxTableController::create( SdrObjEditView* pView, const SdrObject* pObj, const rtl::Reference< sdr::SelectionController >& xRefController )
+{
+ if( xRefController.is() )
+ {
+ SvxTableController* pController = dynamic_cast< SvxTableController* >( xRefController.get() );
+ if( pController && (pController->mxTableObj.get() == pObj) && (pController->mpView == pView) )
+ return xRefController;
+ }
+ return new SvxTableController( pView, pObj );
+}
+
+// --------------------------------------------------------------------
+
+SvxTableController::SvxTableController( SdrObjEditView* pView, const SdrObject* pObj )
+: mbCellSelectionMode(false)
+, mbLeftButtonDown(false)
+, mpSelectionOverlay(0)
+, mpView( dynamic_cast< SdrView* >( pView ) )
+, mxTableObj( dynamic_cast< SdrTableObj* >( const_cast< SdrObject* >( pObj ) ) )
+, mpModel( 0 )
+, mnUpdateEvent( 0 )
+{
+ if( pObj )
+ mpModel = pObj->GetModel();
+
+ if( mxTableObj.is() )
+ {
+ static_cast< const SdrTableObj* >( pObj )->getActiveCellPos( maCursorFirstPos );
+ maCursorLastPos = maCursorFirstPos;
+
+ Reference< XTable > xTable( static_cast< const SdrTableObj* >( pObj )->getTable() );
+ if( xTable.is() )
+ {
+ mxModifyListener = new SvxTableControllerModifyListener( this );
+ xTable->addModifyListener( mxModifyListener );
+
+ mxTable.set( dynamic_cast< TableModel* >( xTable.get() ) );
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+SvxTableController::~SvxTableController()
+{
+ if( mnUpdateEvent )
+ {
+ Application::RemoveUserEvent( mnUpdateEvent );
+ }
+
+ if( mxModifyListener.is() && mxTableObj.get() )
+ {
+ Reference< XTable > xTable( static_cast< SdrTableObj* >( mxTableObj.get() )->getTable() );
+ if( xTable.is() )
+ {
+ xTable->removeModifyListener( mxModifyListener );
+ mxModifyListener.clear();
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+const sal_uInt16 ACTION_NONE = 0;
+const sal_uInt16 ACTION_GOTO_FIRST_CELL = 1;
+const sal_uInt16 ACTION_GOTO_FIRST_COLUMN = 2;
+const sal_uInt16 ACTION_GOTO_FIRST_ROW = 3;
+const sal_uInt16 ACTION_GOTO_LEFT_CELL = 4;
+const sal_uInt16 ACTION_GOTO_UP_CELL = 5;
+const sal_uInt16 ACTION_GOTO_RIGHT_CELL = 6;
+const sal_uInt16 ACTION_GOTO_DOWN_CELL = 7;
+const sal_uInt16 ACTION_GOTO_LAST_CELL = 8;
+const sal_uInt16 ACTION_GOTO_LAST_COLUMN = 9;
+const sal_uInt16 ACTION_GOTO_LAST_ROW = 10;
+const sal_uInt16 ACTION_EDIT_CELL = 11;
+const sal_uInt16 ACTION_STOP_TEXT_EDIT = 12;
+const sal_uInt16 ACTION_REMOVE_SELECTION = 13;
+const sal_uInt16 ACTION_START_SELECTION = 14;
+const sal_uInt16 ACTION_HANDLED_BY_VIEW = 15;
+const sal_uInt16 ACTION_TAB = 18;
+
+bool SvxTableController::onKeyInput(const KeyEvent& rKEvt, Window* pWindow )
+{
+ if( !checkTableObject() )
+ return false;
+
+ // check if we are read only
+ if( mpModel && mpModel->IsReadOnly())
+ {
+ switch( rKEvt.GetKeyCode().GetCode() )
+ {
+ case awt::Key::DOWN:
+ case awt::Key::UP:
+ case awt::Key::LEFT:
+ case awt::Key::RIGHT:
+ case awt::Key::TAB:
+ case awt::Key::HOME:
+ case awt::Key::END:
+ case awt::Key::NUM2:
+ case awt::Key::NUM4:
+ case awt::Key::NUM6:
+ case awt::Key::NUM8:
+ case awt::Key::ESCAPE:
+ case awt::Key::F2:
+ break;
+ default:
+ // tell the view we eat the event, no further processing needed
+ return true;
+ }
+ }
+
+ sal_uInt16 nAction = getKeyboardAction( rKEvt, pWindow );
+
+ return executeAction( nAction, ( rKEvt.GetKeyCode().IsShift() ) ? sal_True : sal_False, pWindow );
+}
+
+// --------------------------------------------------------------------
+// ::com::sun::star::awt::XMouseClickHandler:
+// --------------------------------------------------------------------
+
+bool SvxTableController::onMouseButtonDown(const MouseEvent& rMEvt, Window* pWindow )
+{
+ if( !pWindow || !checkTableObject() )
+ return false;
+
+ SdrViewEvent aVEvt;
+ if( !rMEvt.IsRight() && mpView->PickAnything(rMEvt,SDRMOUSEBUTTONDOWN, aVEvt) == SDRHIT_HANDLE )
+ return false;
+
+ TableHitKind eHit = static_cast< SdrTableObj* >(mxTableObj.get())->CheckTableHit( pWindow->PixelToLogic(rMEvt.GetPosPixel()), maMouseDownPos.mnCol, maMouseDownPos.mnRow, 0 );
+
+ mbLeftButtonDown = (rMEvt.GetClicks() == 1) && rMEvt.IsLeft();
+
+ if( eHit == SDRTABLEHIT_CELL )
+ {
+ StartSelection( maMouseDownPos );
+ return true;
+ }
+
+ if( rMEvt.IsRight() && eHit != SDRTABLEHIT_NONE )
+ return true; // right click will become context menu
+
+ // for cell selektion with the mouse remember our first hit
+ if( mbLeftButtonDown )
+ {
+ RemoveSelection();
+
+ Point aPnt(rMEvt.GetPosPixel());
+ if (pWindow!=NULL)
+ aPnt=pWindow->PixelToLogic(aPnt);
+
+ SdrHdl* pHdl = mpView->PickHandle(aPnt);
+
+ if( pHdl )
+ {
+ mbLeftButtonDown = false;
+ }
+ else
+ {
+ ::sdr::table::SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( mxTableObj.get() );
+
+ if( !pWindow || !pTableObj || eHit == SDRTABLEHIT_NONE)
+ {
+ mbLeftButtonDown = false;
+ }
+ }
+ }
+
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+bool SvxTableController::onMouseButtonUp(const MouseEvent& rMEvt, Window* /*pWin*/)
+{
+ if( !checkTableObject() )
+ return false;
+
+ mbLeftButtonDown = false;
+
+ if( rMEvt.GetClicks() == 2 )
+ return true;
+
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+bool SvxTableController::onMouseMove(const MouseEvent& rMEvt, Window* pWindow )
+{
+ if( !checkTableObject() )
+ return false;
+
+ if( rMEvt.IsLeft() )
+ {
+ int i = 0;
+ i++;
+ }
+
+ SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >( mxTableObj.get() );
+ CellPos aPos;
+ if( mbLeftButtonDown && pTableObj && pTableObj->CheckTableHit( pWindow->PixelToLogic(rMEvt.GetPosPixel()), aPos.mnCol, aPos.mnRow, 0 ) != SDRTABLEHIT_NONE )
+ {
+ if(aPos != maMouseDownPos)
+ {
+ if( mbCellSelectionMode )
+ {
+ setSelectedCells( maMouseDownPos, aPos );
+ return true;
+ }
+ else
+ {
+ StartSelection( maMouseDownPos );
+ }
+ }
+ else if( mbCellSelectionMode )
+ {
+ UpdateSelection( aPos );
+ return true;
+ }
+ }
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+void SvxTableController::onSelectionHasChanged()
+{
+ bool bSelected = false;
+
+ SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >( mxTableObj.get() );
+ if( pTableObj && pTableObj->IsTextEditActive() )
+ {
+ pTableObj->getActiveCellPos( maCursorFirstPos );
+ maCursorLastPos = maCursorFirstPos;
+ mbCellSelectionMode = false;
+ }
+ else
+ {
+ const SdrMarkList& rMarkList= mpView->GetMarkedObjectList();
+ if( rMarkList.GetMarkCount() == 1 )
+ bSelected = mxTableObj.get() == rMarkList.GetMark(0)->GetMarkedSdrObj();
+ }
+
+ if( bSelected )
+ {
+ updateSelectionOverlay();
+ }
+ else
+ {
+ destroySelectionOverlay();
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SvxTableController::GetState( SfxItemSet& rSet )
+{
+ if( !mxTable.is() || !mxTableObj.is() || !mxTableObj->GetModel() )
+ return;
+
+ SfxItemSet* pSet = 0;
+
+ bool bVertDone = false;
+
+ // Iterate over all requested items in the set.
+ SfxWhichIter aIter( rSet );
+ sal_uInt16 nWhich = aIter.FirstWhich();
+ while (nWhich)
+ {
+ switch (nWhich)
+ {
+ case SID_TABLE_VERT_BOTTOM:
+ case SID_TABLE_VERT_CENTER:
+ case SID_TABLE_VERT_NONE:
+ {
+ if( !mxTable.is() || !mxTableObj->GetModel() )
+ {
+ rSet.DisableItem(nWhich);
+ }
+ else if(!bVertDone)
+ {
+ if( !pSet )
+ {
+ pSet = new SfxItemSet( mxTableObj->GetModel()->GetItemPool() );
+ MergeAttrFromSelectedCells(*pSet, sal_False);
+ }
+
+ SdrTextVertAdjust eAdj = SDRTEXTVERTADJUST_BLOCK;
+
+ if( pSet->GetItemState( SDRATTR_TEXT_VERTADJUST ) != SFX_ITEM_DONTCARE )
+ eAdj = ((SdrTextVertAdjustItem&)(pSet->Get(SDRATTR_TEXT_VERTADJUST))).GetValue();
+
+ rSet.Put(SfxBoolItem(SID_TABLE_VERT_BOTTOM, eAdj == SDRTEXTVERTADJUST_BOTTOM));
+ rSet.Put(SfxBoolItem(SID_TABLE_VERT_CENTER, eAdj == SDRTEXTVERTADJUST_CENTER));
+ rSet.Put(SfxBoolItem(SID_TABLE_VERT_NONE, eAdj == SDRTEXTVERTADJUST_TOP));
+ bVertDone = true;
+ }
+ break;
+ }
+ case SID_TABLE_DELETE_ROW:
+ if( !mxTable.is() || !hasSelectedCells() || (mxTable->getRowCount() <= 1) )
+ rSet.DisableItem(SID_TABLE_DELETE_ROW);
+ break;
+ case SID_TABLE_DELETE_COL:
+ if( !mxTable.is() || !hasSelectedCells() || (mxTable->getColumnCount() <= 1) )
+ rSet.DisableItem(SID_TABLE_DELETE_COL);
+ break;
+ case SID_TABLE_MERGE_CELLS:
+ if( !mxTable.is() || !hasSelectedCells() )
+ rSet.DisableItem(SID_TABLE_MERGE_CELLS);
+ break;
+ case SID_TABLE_SPLIT_CELLS:
+ if( !hasSelectedCells() || !mxTable.is() )
+ rSet.DisableItem(SID_TABLE_SPLIT_CELLS);
+ break;
+
+ case SID_OPTIMIZE_TABLE:
+ case SID_TABLE_DISTRIBUTE_COLUMNS:
+ case SID_TABLE_DISTRIBUTE_ROWS:
+ {
+ bool bDistributeColumns = false;
+ bool bDistributeRows = false;
+ if( mxTable.is() )
+ {
+ CellPos aStart, aEnd;
+ getSelectedCells( aStart, aEnd );
+
+ bDistributeColumns = aStart.mnCol != aEnd.mnCol;
+ bDistributeRows = aStart.mnRow != aEnd.mnRow;
+ }
+ if( !bDistributeColumns && !bDistributeRows )
+ rSet.DisableItem(SID_OPTIMIZE_TABLE);
+ if( !bDistributeColumns )
+ rSet.DisableItem(SID_TABLE_DISTRIBUTE_COLUMNS);
+ if( !bDistributeRows )
+ rSet.DisableItem(SID_TABLE_DISTRIBUTE_ROWS);
+ break;
+ }
+
+ case SID_AUTOFORMAT:
+ case SID_TABLE_SORT_DIALOG:
+ case SID_TABLE_AUTOSUM:
+// if( !mxTable.is() )
+// rSet.DisableItem( nWhich );
+ break;
+ default:
+ break;
+ }
+ nWhich = aIter.NextWhich();
+ }
+ if( pSet )
+ delete pSet;
+}
+
+// --------------------------------------------------------------------
+
+void SvxTableController::onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs )
+{
+ ::sdr::table::SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( mxTableObj.get() );
+ if( !pTableObj )
+ return;
+
+ if( mxTable.is() ) try
+ {
+ //
+ bool bInsertAfter = true;
+ sal_uInt16 nCount = 0;
+ if( pArgs )
+ {
+ const SfxPoolItem* pItem = 0;
+ pArgs->GetItemState(nSId, sal_False, &pItem);
+ if (pItem)
+ {
+ nCount = ((const SfxInt16Item* )pItem)->GetValue();
+ if(SFX_ITEM_SET == pArgs->GetItemState(SID_TABLE_PARAM_INSERT_AFTER, sal_True, &pItem))
+ bInsertAfter = ((const SfxBoolItem* )pItem)->GetValue();
+ }
+ }
+
+ CellPos aStart, aEnd;
+ if( hasSelectedCells() )
+ {
+ getSelectedCells( aStart, aEnd );
+ }
+ else
+ {
+ if( bInsertAfter )
+ {
+ aStart.mnCol = mxTable->getColumnCount() - 1;
+ aStart.mnRow = mxTable->getRowCount() - 1;
+ aEnd = aStart;
+ }
+ }
+
+ if( pTableObj->IsTextEditActive() )
+ mpView->SdrEndTextEdit(sal_True);
+
+ RemoveSelection();
+
+ const OUString sSize( RTL_CONSTASCII_USTRINGPARAM( "Size" ) );
+
+ const bool bUndo = mpModel && mpModel->IsUndoEnabled();
+
+ switch( nSId )
+ {
+ case SID_TABLE_INSERT_COL:
+ {
+ TableModelNotifyGuard aGuard( mxTable.get() );
+
+ if( bUndo )
+ {
+ mpModel->BegUndo( ImpGetResStr(STR_TABLE_INSCOL) );
+ mpModel->AddUndo( mpModel->GetSdrUndoFactory().CreateUndoGeoObject(*pTableObj) );
+ }
+
+ Reference< XTableColumns > xCols( mxTable->getColumns() );
+ 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++ )
+ {
+ Reference< XPropertySet >( xCols->getByIndex( aEnd.mnCol + nOffset + 1 ), UNO_QUERY_THROW )->
+ setPropertyValue( sSize,
+ Reference< XPropertySet >( xCols->getByIndex( aStart.mnCol + nOffset ), UNO_QUERY_THROW )->
+ getPropertyValue( sSize ) );
+ }
+
+ if( bUndo )
+ mpModel->EndUndo();
+
+ aStart.mnCol = nNewStartColumn;
+ aStart.mnRow = 0;
+ aEnd.mnCol = aStart.mnCol + nNewColumns - 1;
+ aEnd.mnRow = mxTable->getRowCount() - 1;
+ break;
+ }
+
+ case SID_TABLE_INSERT_ROW:
+ {
+ TableModelNotifyGuard aGuard( mxTable.get() );
+
+ if( bUndo )
+ {
+ mpModel->BegUndo( ImpGetResStr(STR_TABLE_INSROW ) );
+ mpModel->AddUndo( mpModel->GetSdrUndoFactory().CreateUndoGeoObject(*pTableObj) );
+ }
+
+ Reference< XTableRows > xRows( mxTable->getRows() );
+ 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++ )
+ {
+ Reference< XPropertySet >( xRows->getByIndex( aEnd.mnRow + nOffset + 1 ), UNO_QUERY_THROW )->
+ setPropertyValue( sSize,
+ Reference< XPropertySet >( xRows->getByIndex( aStart.mnRow + nOffset ), UNO_QUERY_THROW )->
+ getPropertyValue( sSize ) );
+ }
+
+ if( bUndo )
+ mpModel->EndUndo();
+
+ aStart.mnCol = 0;
+ aStart.mnRow = nNewRowStart;
+ aEnd.mnCol = mxTable->getColumnCount() - 1;
+ aEnd.mnRow = aStart.mnRow + nNewRows - 1;
+ break;
+ }
+ }
+
+ StartSelection( aStart );
+ UpdateSelection( aEnd );
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ DBG_ERROR("svx::SvxTableController::onInsert(), exception caught!");
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SvxTableController::onDelete( sal_uInt16 nSId )
+{
+ ::sdr::table::SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( mxTableObj.get() );
+ if( !pTableObj )
+ return;
+
+ if( mxTable.is() && hasSelectedCells() )
+ {
+ CellPos aStart, aEnd;
+ getSelectedCells( aStart, aEnd );
+
+ if( pTableObj->IsTextEditActive() )
+ mpView->SdrEndTextEdit(sal_True);
+
+ RemoveSelection();
+
+ bool bDeleteTable = false;
+ switch( nSId )
+ {
+ case SID_TABLE_DELETE_COL:
+ {
+ const sal_Int32 nRemovedColumns = aEnd.mnCol - aStart.mnCol + 1;
+ if( nRemovedColumns == mxTable->getColumnCount() )
+ {
+ bDeleteTable = true;
+ }
+ else
+ {
+ Reference< XTableColumns > xCols( mxTable->getColumns() );
+ xCols->removeByIndex( aStart.mnCol, nRemovedColumns );
+ }
+ break;
+ }
+
+ case SID_TABLE_DELETE_ROW:
+ {
+ const sal_Int32 nRemovedRows = aEnd.mnRow - aStart.mnRow + 1;
+ if( nRemovedRows == mxTable->getRowCount() )
+ {
+ bDeleteTable = true;
+ }
+ else
+ {
+ Reference< XTableRows > xRows( mxTable->getRows() );
+ xRows->removeByIndex( aStart.mnRow, nRemovedRows );
+ }
+ break;
+ }
+ }
+
+ if( bDeleteTable )
+ mpView->DeleteMarkedObj();
+ else
+ UpdateTableShape();
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SvxTableController::onSelect( sal_uInt16 nSId )
+{
+ if( mxTable.is() )
+ {
+ const sal_Int32 nRowCount = mxTable->getRowCount();
+ const sal_Int32 nColCount = mxTable->getColumnCount();
+ if( nRowCount && nColCount )
+ {
+ CellPos aStart, aEnd;
+ getSelectedCells( aStart, aEnd );
+
+ switch( nSId )
+ {
+ case SID_TABLE_SELECT_ALL:
+ aEnd.mnCol = 0; aEnd.mnRow = 0;
+ aStart.mnCol = nColCount - 1; aStart.mnRow = nRowCount - 1;
+ break;
+ case SID_TABLE_SELECT_COL:
+ aEnd.mnRow = nRowCount - 1;
+ aStart.mnRow = 0;
+ break;
+ case SID_TABLE_SELECT_ROW:
+ aEnd.mnCol = nColCount - 1;
+ aStart.mnCol = 0;
+ break;
+ }
+
+ StartSelection( aEnd );
+ gotoCell( aStart, true, 0 );
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+void SvxTableController::onFormatTable( SfxRequest& rReq )
+{
+ ::sdr::table::SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( mxTableObj.get() );
+ if( !pTableObj )
+ return;
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if( !pArgs && pTableObj->GetModel() )
+ {
+ SfxItemSet aNewAttr( pTableObj->GetModel()->GetItemPool() );
+ MergeAttrFromSelectedCells(aNewAttr, sal_False);
+
+ // merge drawing layer text distance items into SvxBoxItem used by the dialog
+ SvxBoxItem aBoxItem( static_cast< const SvxBoxItem& >( aNewAttr.Get( SDRATTR_TABLE_BORDER ) ) );
+ aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( ((SdrTextLeftDistItem&)(aNewAttr.Get(SDRATTR_TEXT_LEFTDIST))).GetValue()), BOX_LINE_LEFT );
+ aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( ((SdrTextRightDistItem&)(aNewAttr.Get(SDRATTR_TEXT_RIGHTDIST))).GetValue()), BOX_LINE_RIGHT );
+ aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( ((SdrTextUpperDistItem&)(aNewAttr.Get(SDRATTR_TEXT_UPPERDIST))).GetValue()), BOX_LINE_TOP );
+ aBoxItem.SetDistance( sal::static_int_cast< sal_uInt16 >( ((SdrTextLowerDistItem&)(aNewAttr.Get(SDRATTR_TEXT_LOWERDIST))).GetValue()), BOX_LINE_BOTTOM );
+ aNewAttr.Put( aBoxItem );
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ std::auto_ptr< SfxAbstractTabDialog > pDlg( pFact ? pFact->CreateSvxFormatCellsDialog( NULL, &aNewAttr, pTableObj->GetModel(), pTableObj) : 0 );
+ if( pDlg.get() && pDlg->Execute() )
+ {
+ SfxItemSet aNewSet( *(pDlg->GetOutputItemSet ()) );
+
+ SvxBoxItem aNewBoxItem( static_cast< const SvxBoxItem& >( aNewSet.Get( SDRATTR_TABLE_BORDER ) ) );
+
+ if( aNewBoxItem.GetDistance( BOX_LINE_LEFT ) != aBoxItem.GetDistance( BOX_LINE_LEFT ) )
+ aNewSet.Put(SdrTextLeftDistItem( aNewBoxItem.GetDistance( BOX_LINE_LEFT ) ) );
+
+ if( aNewBoxItem.GetDistance( BOX_LINE_RIGHT ) != aBoxItem.GetDistance( BOX_LINE_RIGHT ) )
+ aNewSet.Put(SdrTextRightDistItem( aNewBoxItem.GetDistance( BOX_LINE_RIGHT ) ) );
+
+ if( aNewBoxItem.GetDistance( BOX_LINE_TOP ) != aBoxItem.GetDistance( BOX_LINE_TOP ) )
+ aNewSet.Put(SdrTextUpperDistItem( aNewBoxItem.GetDistance( BOX_LINE_TOP ) ) );
+
+ if( aNewBoxItem.GetDistance( BOX_LINE_BOTTOM ) != aBoxItem.GetDistance( BOX_LINE_BOTTOM ) )
+ aNewSet.Put(SdrTextLowerDistItem( aNewBoxItem.GetDistance( BOX_LINE_BOTTOM ) ) );
+
+ SetAttrToSelectedCells(aNewSet, sal_False);
+ }
+ UpdateTableShape();
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SvxTableController::Execute( SfxRequest& rReq )
+{
+ const sal_uInt16 nSId = rReq.GetSlot();
+ switch( nSId )
+ {
+ case SID_TABLE_INSERT_ROW:
+ case SID_TABLE_INSERT_COL:
+ onInsert( nSId, rReq.GetArgs() );
+ break;
+ case SID_TABLE_DELETE_ROW:
+ case SID_TABLE_DELETE_COL:
+ onDelete( nSId );
+ break;
+ case SID_TABLE_SELECT_ALL:
+ case SID_TABLE_SELECT_COL:
+ case SID_TABLE_SELECT_ROW:
+ onSelect( nSId );
+ break;
+ case SID_FORMAT_TABLE_DLG:
+ onFormatTable( rReq );
+ break;
+
+ case SID_FRAME_LINESTYLE:
+ case SID_FRAME_LINECOLOR:
+ case SID_ATTR_BORDER:
+ {
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ if( pArgs )
+ ApplyBorderAttr( *pArgs );
+ }
+ break;
+
+ case SID_ATTR_FILL_STYLE:
+ {
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ if( pArgs )
+ SetAttributes( *pArgs, false );
+ }
+ break;
+
+ case SID_TABLE_MERGE_CELLS:
+ MergeMarkedCells();
+ break;
+
+ case SID_TABLE_SPLIT_CELLS:
+ SplitMarkedCells();
+ break;
+
+ case SID_TABLE_DISTRIBUTE_COLUMNS:
+ DistributeColumns();
+ break;
+
+ case SID_TABLE_DISTRIBUTE_ROWS:
+ DistributeRows();
+ break;
+
+ case SID_TABLE_VERT_BOTTOM:
+ case SID_TABLE_VERT_CENTER:
+ case SID_TABLE_VERT_NONE:
+ SetVertical( nSId );
+ break;
+
+ case SID_AUTOFORMAT:
+ case SID_TABLE_SORT_DIALOG:
+ case SID_TABLE_AUTOSUM:
+ default:
+ break;
+
+ case SID_TABLE_STYLE:
+ SetTableStyle( rReq.GetArgs() );
+ break;
+
+ case SID_TABLE_STYLE_SETTINGS:
+ SetTableStyleSettings( rReq.GetArgs() );
+ break;
+ }
+}
+
+void SvxTableController::SetTableStyle( const SfxItemSet* pArgs )
+{
+ SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( mxTableObj.get() );
+ SdrModel* pModel = pTableObj ? pTableObj->GetModel() : 0;
+
+ if( !pTableObj || !pModel || !pArgs || (SFX_ITEM_SET != pArgs->GetItemState(SID_TABLE_STYLE, sal_False)) )
+ return;
+
+ const SfxStringItem* pArg = dynamic_cast< const SfxStringItem* >( &pArgs->Get( SID_TABLE_STYLE ) );
+ if( pArg && mxTable.is() ) try
+ {
+ Reference< XStyleFamiliesSupplier > xSFS( pModel->getUnoModel(), UNO_QUERY_THROW );
+ Reference< XNameAccess > xFamilyNameAccess( xSFS->getStyleFamilies(), UNO_QUERY_THROW );
+ const OUString sFamilyName( RTL_CONSTASCII_USTRINGPARAM( "table" ) );
+ Reference< XNameAccess > xTableFamilyAccess( xFamilyNameAccess->getByName( sFamilyName ), UNO_QUERY_THROW );
+
+ if( xTableFamilyAccess->hasByName( pArg->GetValue() ) )
+ {
+ // found table style with the same name
+ Reference< XIndexAccess > xNewTableStyle( xTableFamilyAccess->getByName( pArg->GetValue() ), UNO_QUERY_THROW );
+
+ const bool bUndo = pModel->IsUndoEnabled();
+
+ if( bUndo )
+ {
+ pModel->BegUndo( ImpGetResStr(STR_TABLE_STYLE) );
+ pModel->AddUndo( new TableStyleUndo( *pTableObj ) );
+ }
+
+ pTableObj->setTableStyle( xNewTableStyle );
+
+ const sal_Int32 nRowCount = mxTable->getRowCount();
+ const sal_Int32 nColCount = mxTable->getColumnCount();
+ for( sal_Int32 nRow = 0; nRow < nRowCount; nRow++ )
+ {
+ for( sal_Int32 nCol = 0; nCol < nColCount; nCol++ ) try
+ {
+ CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
+ if( xCell.is() )
+ {
+ SfxItemSet aSet( xCell->GetItemSet() );
+ bool bChanges = false;
+ const SfxItemSet& rStyleAttribs = xCell->GetStyleSheet()->GetItemSet();
+
+ for ( sal_uInt16 nWhich = SDRATTR_START; nWhich <= SDRATTR_TABLE_LAST; nWhich++ )
+ {
+ if( (rStyleAttribs.GetItemState( nWhich ) == SFX_ITEM_ON) && (aSet.GetItemState( nWhich ) == SFX_ITEM_ON) )
+ {
+ aSet.ClearItem( nWhich );
+ bChanges = true;
+ }
+ }
+
+ if( bChanges )
+ {
+ if( bUndo )
+ xCell->AddUndo();
+
+ xCell->SetMergedItemSetAndBroadcast( aSet, sal_True );
+ }
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ DBG_ERROR( "svx::SvxTableController::SetTableStyle(), exception caught!" );
+ }
+ }
+
+ if( bUndo )
+ pModel->EndUndo();
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ DBG_ERROR( "svx::SvxTableController::SetTableStyle(), exception caught!" );
+ }
+}
+
+void SvxTableController::SetTableStyleSettings( const SfxItemSet* pArgs )
+{
+ SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( mxTableObj.get() );
+ SdrModel* pModel = pTableObj ? pTableObj->GetModel() : 0;
+
+ if( !pTableObj || !pModel )
+ return;
+
+ TableStyleSettings aSettings( pTableObj->getTableStyleSettings() );
+
+ const SfxPoolItem *pPoolItem=NULL;
+
+ if( (SFX_ITEM_SET == pArgs->GetItemState(ID_VAL_USEFIRSTROWSTYLE, sal_False,&pPoolItem)) )
+ aSettings.mbUseFirstRow = static_cast< const SfxBoolItem* >(pPoolItem)->GetValue();
+
+ if( (SFX_ITEM_SET == pArgs->GetItemState(ID_VAL_USELASTROWSTYLE, sal_False,&pPoolItem)) )
+ aSettings.mbUseLastRow = static_cast< const SfxBoolItem* >(pPoolItem)->GetValue();
+
+ if( (SFX_ITEM_SET == pArgs->GetItemState(ID_VAL_USEBANDINGROWSTYLE, sal_False,&pPoolItem)) )
+ aSettings.mbUseRowBanding = static_cast< const SfxBoolItem* >(pPoolItem)->GetValue();
+
+ if( (SFX_ITEM_SET == pArgs->GetItemState(ID_VAL_USEFIRSTCOLUMNSTYLE, sal_False,&pPoolItem)) )
+ aSettings.mbUseFirstColumn = static_cast< const SfxBoolItem* >(pPoolItem)->GetValue();
+
+ if( (SFX_ITEM_SET == pArgs->GetItemState(ID_VAL_USELASTCOLUMNSTYLE, sal_False,&pPoolItem)) )
+ aSettings.mbUseLastColumn = static_cast< const SfxBoolItem* >(pPoolItem)->GetValue();
+
+ if( (SFX_ITEM_SET == pArgs->GetItemState(ID_VAL_USEBANDINGCOLUMNSTYLE, sal_False,&pPoolItem)) )
+ aSettings.mbUseColumnBanding = static_cast< const SfxBoolItem* >(pPoolItem)->GetValue();
+
+ if( aSettings == pTableObj->getTableStyleSettings() )
+ return;
+
+ const bool bUndo = pModel->IsUndoEnabled();
+
+ if( bUndo )
+ {
+ pModel->BegUndo( ImpGetResStr(STR_TABLE_STYLE_SETTINGS) );
+ pModel->AddUndo( new TableStyleUndo( *pTableObj ) );
+ }
+
+ pTableObj->setTableStyleSettings( aSettings );
+
+ if( bUndo )
+ pModel->EndUndo();
+}
+
+void SvxTableController::SetVertical( sal_uInt16 nSId )
+{
+ SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( mxTableObj.get() );
+ if( mxTable.is() && pTableObj )
+ {
+ TableModelNotifyGuard aGuard( mxTable.get() );
+
+ CellPos aStart, aEnd;
+ getSelectedCells( aStart, aEnd );
+
+ SdrTextVertAdjust eAdj = SDRTEXTVERTADJUST_TOP;
+
+ switch( nSId )
+ {
+ case SID_TABLE_VERT_BOTTOM:
+ eAdj = SDRTEXTVERTADJUST_BOTTOM;
+ break;
+ case SID_TABLE_VERT_CENTER:
+ eAdj = SDRTEXTVERTADJUST_CENTER;
+ break;
+ //case SID_TABLE_VERT_NONE:
+ default:
+ break;
+ }
+
+ SdrTextVertAdjustItem aItem( eAdj );
+
+ for( sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++ )
+ {
+ for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ )
+ {
+ CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
+ if( xCell.is() )
+ xCell->SetMergedItem(aItem);
+ }
+ }
+
+ UpdateTableShape();
+ }
+}
+
+void SvxTableController::MergeMarkedCells()
+{
+ CellPos aStart, aEnd;
+ getSelectedCells( aStart, aEnd );
+ 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 );
+ }
+}
+
+void SvxTableController::SplitMarkedCells()
+{
+ if( mxTable.is() )
+ {
+ CellPos aStart, aEnd;
+ getSelectedCells( aStart, aEnd );
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ std::auto_ptr< SvxAbstractSplittTableDialog > xDlg( pFact ? pFact->CreateSvxSplittTableDialog( NULL, false, 99, 99 ) : 0 );
+ if( xDlg.get() && xDlg->Execute() )
+ {
+ const sal_Int32 nCount = xDlg->GetCount() - 1;
+ if( nCount < 1 )
+ return;
+
+ getSelectedCells( aStart, aEnd );
+
+ Reference< XMergeableCellRange > xRange( mxTable->createCursorByRange( mxTable->getCellRangeByPosition( aStart.mnCol, aStart.mnRow, aEnd.mnCol, aEnd.mnRow ) ), UNO_QUERY_THROW );
+
+ const sal_Int32 nRowCount = mxTable->getRowCount();
+ const sal_Int32 nColCount = mxTable->getColumnCount();
+
+
+ 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();
+ if( bUndo )
+ {
+ mpModel->BegUndo( ImpGetResStr(STR_TABLE_SPLIT) );
+ mpModel->AddUndo( mpModel->GetSdrUndoFactory().CreateUndoGeoObject(*pTableObj) );
+ }
+
+ if( xDlg->IsHorizontal() )
+ {
+ xRange->split( 0, nCount );
+ }
+ else
+ {
+ xRange->split( nCount, 0 );
+ }
+
+ if( bUndo )
+ mpModel->EndUndo();
+ }
+ aEnd.mnRow += mxTable->getRowCount() - nRowCount;
+ aEnd.mnCol += mxTable->getColumnCount() - nColCount;
+
+ setSelectedCells( aStart, aEnd );
+ }
+ }
+}
+
+void SvxTableController::DistributeColumns()
+{
+ SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >( mxTableObj.get() );
+ if( pTableObj )
+ {
+ const bool bUndo = mpModel && mpModel->IsUndoEnabled();
+ if( bUndo )
+ {
+ mpModel->BegUndo( ImpGetResStr(STR_TABLE_DISTRIBUTE_COLUMNS) );
+ mpModel->AddUndo( mpModel->GetSdrUndoFactory().CreateUndoGeoObject(*pTableObj) );
+ }
+
+ CellPos aStart, aEnd;
+ getSelectedCells( aStart, aEnd );
+ pTableObj->DistributeColumns( aStart.mnCol, aEnd.mnCol );
+
+ if( bUndo )
+ mpModel->EndUndo();
+ }
+}
+
+void SvxTableController::DistributeRows()
+{
+ SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >( mxTableObj.get() );
+ if( pTableObj )
+ {
+ const bool bUndo = mpModel && mpModel->IsUndoEnabled();
+ if( bUndo )
+ {
+ mpModel->BegUndo( ImpGetResStr(STR_TABLE_DISTRIBUTE_ROWS) );
+ mpModel->AddUndo( mpModel->GetSdrUndoFactory().CreateUndoGeoObject(*pTableObj) );
+ }
+
+ CellPos aStart, aEnd;
+ getSelectedCells( aStart, aEnd );
+ pTableObj->DistributeRows( aStart.mnRow, aEnd.mnRow );
+
+ if( bUndo )
+ mpModel->EndUndo();
+ }
+}
+
+bool SvxTableController::DeleteMarked()
+{
+ if( mbCellSelectionMode )
+ {
+ if( mxTable.is() )
+ {
+ CellPos aStart, aEnd;
+ getSelectedCells( aStart, aEnd );
+ for( sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++ )
+ {
+ for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ )
+ {
+ CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
+ if( xCell.is() )
+ xCell->SetOutlinerParaObject( 0 );
+ }
+ }
+
+ UpdateTableShape();
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool SvxTableController::GetStyleSheet( SfxStyleSheet*& rpStyleSheet ) const
+{
+ if( hasSelectedCells() )
+ {
+ rpStyleSheet = 0;
+
+ if( mxTable.is() )
+ {
+ SfxStyleSheet* pRet=0;
+ bool b1st=true;
+
+ CellPos aStart, aEnd;
+ const_cast<SvxTableController&>(*this).getSelectedCells( aStart, aEnd );
+
+ for( sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++ )
+ {
+ for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ )
+ {
+ CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
+ if( xCell.is() )
+ {
+ SfxStyleSheet* pSS=xCell->GetStyleSheet();
+ if(b1st)
+ {
+ pRet=pSS;
+ }
+ else if(pRet != pSS)
+ {
+ return true;
+ }
+ b1st=false;
+ }
+ }
+ }
+ rpStyleSheet = pRet;
+ return true;
+ }
+ }
+ return false;
+}
+
+bool SvxTableController::SetStyleSheet( SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr )
+{
+ if( hasSelectedCells() && (!pStyleSheet || pStyleSheet->GetFamily() == SFX_STYLE_FAMILY_FRAME) )
+ {
+ if( mxTable.is() )
+ {
+ CellPos aStart, aEnd;
+ getSelectedCells( aStart, aEnd );
+
+ for( sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++ )
+ {
+ for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ )
+ {
+ CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
+ if( xCell.is() )
+ xCell->SetStyleSheet(pStyleSheet,bDontRemoveHardAttr);
+ }
+ }
+
+ UpdateTableShape();
+ return true;
+ }
+ }
+ return false;
+}
+
+// --------------------------------------------------------------------
+// internals
+// --------------------------------------------------------------------
+
+bool SvxTableController::checkTableObject()
+{
+ return mxTableObj.is();
+}
+
+// --------------------------------------------------------------------
+
+sal_uInt16 SvxTableController::getKeyboardAction( const KeyEvent& rKEvt, Window* /*pWindow*/ )
+{
+ const bool bMod1 = rKEvt.GetKeyCode().IsMod1(); // ctrl
+ const bool bMod2 = rKEvt.GetKeyCode().IsMod2() != 0; // Alt
+
+ const bool bTextEdit = mpView->IsTextEdit();
+
+ sal_uInt16 nAction = ACTION_HANDLED_BY_VIEW;
+
+ ::sdr::table::SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( mxTableObj.get() );
+ if( !pTableObj )
+ return nAction;
+
+ // handle special keys
+ const sal_Int16 nCode = rKEvt.GetKeyCode().GetCode();
+ switch( nCode )
+ {
+ case awt::Key::ESCAPE: // handle escape
+ {
+ if( bTextEdit )
+ {
+ // escape during text edit ends text edit
+ nAction = ACTION_STOP_TEXT_EDIT;
+ }
+ if( mbCellSelectionMode )
+ {
+ // escape with selected cells removes selection
+ nAction = ACTION_REMOVE_SELECTION;
+ }
+ break;
+ }
+ case awt::Key::RETURN: // handle return
+ {
+ if( !bMod1 && !bMod2 && !bTextEdit )
+ {
+ // when not already editing, return starts text edit
+ setSelectionStart( pTableObj->getFirstCell() );
+ nAction = ACTION_EDIT_CELL;
+ }
+ break;
+ }
+ case awt::Key::F2: // f2 toggles text edit
+ {
+ if( bMod1 || bMod2 ) // f2 with modifiers is handled by the view
+ {
+ }
+ else if( bTextEdit )
+ {
+ // f2 during text edit stops text edit
+ nAction = ACTION_STOP_TEXT_EDIT;
+ }
+ else if( mbCellSelectionMode )
+ {
+ // f2 with selected cells removes selection
+ nAction = ACTION_REMOVE_SELECTION;
+ }
+ else
+ {
+ // f2 with no selection and no text edit starts text edit
+ setSelectionStart( pTableObj->getFirstCell() );
+ nAction = ACTION_EDIT_CELL;
+ }
+ break;
+ }
+ case awt::Key::HOME:
+ case awt::Key::NUM7:
+ {
+ if( (bMod1 || bMod2) && (bTextEdit || mbCellSelectionMode) )
+ {
+ if( bMod1 && !bMod2 )
+ {
+ // strg + home jumps to first cell
+ nAction = ACTION_GOTO_FIRST_CELL;
+ }
+ else if( !bMod1 && bMod2 )
+ {
+ // alt + home jumps to first column
+ nAction = ACTION_GOTO_FIRST_COLUMN;
+ }
+ }
+ break;
+ }
+ case awt::Key::END:
+ case awt::Key::NUM1:
+ {
+ if( (bMod1 || bMod2) && (bTextEdit || mbCellSelectionMode) )
+ {
+ if( bMod1 && !bMod2 )
+ {
+ // strg + end jumps to last cell
+ nAction = ACTION_GOTO_LAST_CELL;
+ }
+ else if( !bMod1 && bMod2 )
+ {
+ // alt + home jumps to last column
+ nAction = ACTION_GOTO_LAST_COLUMN;
+ }
+ }
+ break;
+ }
+
+ case awt::Key::TAB:
+ {
+ if( bTextEdit || mbCellSelectionMode )
+ nAction = ACTION_TAB;
+ break;
+ }
+
+ case awt::Key::UP:
+ case awt::Key::NUM8:
+ case awt::Key::DOWN:
+ case awt::Key::NUM2:
+ case awt::Key::LEFT:
+ case awt::Key::NUM4:
+ case awt::Key::RIGHT:
+ case awt::Key::NUM6:
+ {
+ bool bTextMove = false;
+
+ if( !bMod1 && bMod2 )
+ {
+ if( (nCode == awt::Key::UP) || (nCode == awt::Key::NUM8) )
+ {
+ nAction = ACTION_GOTO_LEFT_CELL;
+ }
+ else if( (nCode == awt::Key::DOWN) || (nCode == awt::Key::NUM2) )
+ {
+ nAction = ACTION_GOTO_RIGHT_CELL;
+ }
+ break;
+ }
+
+ if( !bTextMove )
+ {
+ OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
+ if( pOLV )
+ {
+ RemoveSelection();
+ // during text edit, check if we navigate out of the cell
+ ESelection aOldSelection = pOLV->GetSelection();
+ pOLV->PostKeyEvent(rKEvt);
+ bTextMove = pOLV && ( aOldSelection.IsEqual(pOLV->GetSelection()) );
+ if( !bTextMove )
+ {
+ nAction = ACTION_NONE;
+ }
+ }
+ }
+
+ if( mbCellSelectionMode || bTextMove )
+ {
+ // no text edit, navigate in cells if selection active
+ switch( nCode )
+ {
+ case awt::Key::LEFT:
+ case awt::Key::NUM4:
+ nAction = ACTION_GOTO_LEFT_CELL;
+ break;
+ case awt::Key::RIGHT:
+ case awt::Key::NUM6:
+ nAction = ACTION_GOTO_RIGHT_CELL;
+ break;
+ case awt::Key::DOWN:
+ case awt::Key::NUM2:
+ nAction = ACTION_GOTO_DOWN_CELL;
+ break;
+ case awt::Key::UP:
+ case awt::Key::NUM8:
+ nAction = ACTION_GOTO_UP_CELL;
+ break;
+ }
+ }
+ break;
+ }
+ case awt::Key::PAGEUP:
+ if( bMod2 )
+ nAction = ACTION_GOTO_FIRST_ROW;
+ break;
+
+ case awt::Key::PAGEDOWN:
+ if( bMod2 )
+ nAction = ACTION_GOTO_LAST_ROW;
+ break;
+ }
+ return nAction;
+}
+
+bool SvxTableController::executeAction( sal_uInt16 nAction, bool bSelect, Window* pWindow )
+{
+ ::sdr::table::SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( mxTableObj.get() );
+ if( !pTableObj )
+ return false;
+
+ switch( nAction )
+ {
+ case ACTION_GOTO_FIRST_CELL:
+ {
+ gotoCell( pTableObj->getFirstCell(), bSelect, pWindow, nAction );
+ break;
+ }
+
+ case ACTION_GOTO_LEFT_CELL:
+ {
+ gotoCell( pTableObj->getLeftCell( getSelectionEnd(), !bSelect ), bSelect, pWindow, nAction );
+ break;
+ }
+
+ case ACTION_GOTO_RIGHT_CELL:
+ {
+ gotoCell( pTableObj->getRightCell( getSelectionEnd(), !bSelect ), bSelect, pWindow, nAction);
+ break;
+ }
+
+ case ACTION_GOTO_LAST_CELL:
+ {
+ gotoCell( pTableObj->getLastCell(), bSelect, pWindow, nAction );
+ break;
+ }
+
+ case ACTION_GOTO_FIRST_COLUMN:
+ {
+ CellPos aPos( pTableObj->getFirstCell().mnCol, getSelectionEnd().mnRow );
+ gotoCell( aPos, bSelect, pWindow, nAction );
+ break;
+ }
+
+ case ACTION_GOTO_LAST_COLUMN:
+ {
+ CellPos aPos( pTableObj->getLastCell().mnCol, getSelectionEnd().mnRow );
+ gotoCell( aPos, bSelect, pWindow, nAction );
+ break;
+ }
+
+ case ACTION_GOTO_FIRST_ROW:
+ {
+ CellPos aPos( getSelectionEnd().mnCol, pTableObj->getFirstCell().mnRow );
+ gotoCell( aPos, bSelect, pWindow, nAction );
+ break;
+ }
+
+ case ACTION_GOTO_UP_CELL:
+ {
+ gotoCell( pTableObj->getUpCell(getSelectionEnd(), !bSelect), bSelect, pWindow, nAction );
+ break;
+ }
+
+ case ACTION_GOTO_DOWN_CELL:
+ {
+ gotoCell( pTableObj->getDownCell(getSelectionEnd(), !bSelect), bSelect, pWindow, nAction );
+ break;
+ }
+
+ case ACTION_GOTO_LAST_ROW:
+ {
+ CellPos aPos( getSelectionEnd().mnCol, pTableObj->getLastCell().mnRow );
+ gotoCell( aPos, bSelect, pWindow, nAction );
+ break;
+ }
+
+ case ACTION_EDIT_CELL:
+ EditCell( getSelectionStart(), pWindow, 0, nAction );
+ break;
+
+ case ACTION_STOP_TEXT_EDIT:
+ StopTextEdit();
+ break;
+
+ case ACTION_REMOVE_SELECTION:
+ RemoveSelection();
+ break;
+
+ case ACTION_START_SELECTION:
+ StartSelection( getSelectionStart() );
+ break;
+
+ case ACTION_TAB:
+ {
+ if( bSelect )
+ gotoCell( pTableObj->getPreviousCell( getSelectionEnd(), true ), false, pWindow, nAction );
+ else
+ {
+ 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;
+ }
+ }
+
+ return nAction != ACTION_HANDLED_BY_VIEW;
+}
+
+// --------------------------------------------------------------------
+
+void SvxTableController::gotoCell( const CellPos& rPos, bool bSelect, Window* pWindow, sal_uInt16 nAction )
+{
+ if( mxTableObj.is() && static_cast<SdrTableObj*>(mxTableObj.get())->IsTextEditActive() )
+ mpView->SdrEndTextEdit(sal_True);
+
+ if( bSelect )
+ {
+ maCursorLastPos = rPos;
+ if( mxTableObj.is() )
+ static_cast< SdrTableObj* >( mxTableObj.get() )->setActiveCell( rPos );
+
+ if( !mbCellSelectionMode )
+ {
+ setSelectedCells( maCursorFirstPos, rPos );
+ }
+ else
+ {
+ UpdateSelection( rPos );
+ }
+ }
+ else
+ {
+ RemoveSelection();
+ EditCell( rPos, pWindow, 0, nAction );
+ }
+}
+
+// --------------------------------------------------------------------
+
+const CellPos& SvxTableController::getSelectionStart()
+{
+ checkCell( maCursorFirstPos );
+ return maCursorFirstPos;
+}
+
+// --------------------------------------------------------------------
+
+void SvxTableController::setSelectionStart( const CellPos& rPos )
+{
+ maCursorFirstPos = rPos;
+}
+
+// --------------------------------------------------------------------
+
+const CellPos& SvxTableController::getSelectionEnd()
+{
+ checkCell( maCursorLastPos );
+ return maCursorLastPos;
+}
+
+// --------------------------------------------------------------------
+
+Reference< XCellCursor > SvxTableController::getSelectionCursor()
+{
+ Reference< XCellCursor > xCursor;
+
+ if( mxTable.is() )
+ {
+ if( hasSelectedCells() )
+ {
+ CellPos aStart, aEnd;
+ getSelectedCells( aStart, aEnd );
+ xCursor = mxTable->createCursorByRange( mxTable->getCellRangeByPosition( aStart.mnCol, aStart.mnRow, aEnd.mnCol, aEnd.mnRow ) );
+ }
+ else
+ {
+ xCursor = mxTable->createCursor();
+ }
+ }
+
+ return xCursor;
+}
+
+void SvxTableController::MergeRange( sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow )
+{
+ if( mxTable.is() ) try
+ {
+ Reference< XMergeableCellRange > xRange( mxTable->createCursorByRange( mxTable->getCellRangeByPosition( nFirstCol, nFirstRow,nLastCol, nLastRow ) ), UNO_QUERY_THROW );
+ if( xRange->isMergeable() )
+ {
+ const bool bUndo = mpModel && mpModel->IsUndoEnabled();
+ if( bUndo )
+ {
+ mpModel->BegUndo( ImpGetResStr(STR_TABLE_MERGE) );
+ mpModel->AddUndo( mpModel->GetSdrUndoFactory().CreateUndoGeoObject(*mxTableObj.get()) );
+ }
+
+ xRange->merge();
+
+ if( bUndo )
+ mpModel->EndUndo();
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ASSERT( false, "sdr::table::SvxTableController::MergeRange(), exception caught!" );
+ }
+}
+
+
+
+// --------------------------------------------------------------------
+
+void SvxTableController::checkCell( CellPos& rPos )
+{
+ if( mxTable.is() ) try
+ {
+ if( rPos.mnCol >= mxTable->getColumnCount() )
+ rPos.mnCol = mxTable->getColumnCount()-1;
+
+ if( rPos.mnRow >= mxTable->getRowCount() )
+ rPos.mnRow = mxTable->getRowCount()-1;
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ DBG_ERROR("sdr::table::SvxTableController::checkCell(), exception caught!" );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SvxTableController::findMergeOrigin( CellPos& rPos )
+{
+ if( mxTable.is() ) try
+ {
+ Reference< XMergeableCell > xCell( mxTable->getCellByPosition( rPos.mnCol, rPos.mnRow ), UNO_QUERY_THROW );
+ if( xCell.is() && xCell->isMerged() )
+ {
+ ::findMergeOrigin( mxTable, rPos.mnCol, rPos.mnRow, rPos.mnCol, rPos.mnRow );
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ DBG_ERROR("sdr::table::SvxTableController::findMergeOrigin(), exception caught!" );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SvxTableController::EditCell( const CellPos& rPos, ::Window* pWindow, const awt::MouseEvent* pMouseEvent /*= 0*/, sal_uInt16 nAction /*= ACTION_NONE */ )
+{
+ SdrPageView* pPV = mpView->GetSdrPageView();
+
+ ::sdr::table::SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( mxTableObj.get() );
+ if( pTableObj && pTableObj->GetPage() == pPV->GetPage() )
+ {
+ bool bEmptyOutliner = false;
+
+ if(!pTableObj->GetOutlinerParaObject() && mpView->GetTextEditOutliner())
+ {
+ ::Outliner* pOutl = mpView->GetTextEditOutliner();
+ sal_uIntPtr nParaAnz = pOutl->GetParagraphCount();
+ Paragraph* p1stPara = pOutl->GetParagraph( 0 );
+
+ if(nParaAnz==1 && p1stPara)
+ {
+ // Bei nur einem Pararaph
+ if (pOutl->GetText(p1stPara).Len() == 0)
+ {
+ bEmptyOutliner = true;
+ }
+ }
+ }
+
+ CellPos aPos( rPos );
+ findMergeOrigin( aPos );
+
+ if( pTableObj != mpView->GetTextEditObject() || bEmptyOutliner || !pTableObj->IsTextEditActive( aPos ) )
+ {
+ if( pTableObj->IsTextEditActive() )
+ mpView->SdrEndTextEdit(sal_True);
+
+ pTableObj->setActiveCell( aPos );
+
+ // create new outliner, owner will be the SdrObjEditView
+ SdrOutliner* pOutl = SdrMakeOutliner( OUTLINERMODE_OUTLINEOBJECT, mpModel );
+ if( pTableObj->IsVerticalWriting() )
+ pOutl->SetVertical( sal_True );
+
+ if(mpView->SdrBeginTextEdit(pTableObj, pPV, pWindow, sal_True, pOutl))
+ {
+ maCursorLastPos = maCursorFirstPos = rPos;
+
+ OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
+
+ bool bNoSel = true;
+
+ if( pMouseEvent )
+ {
+ ::MouseEvent aMEvt( *pMouseEvent );
+
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = mpView->PickAnything(aMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+ if (eHit == SDRHIT_TEXTEDIT)
+ {
+ // Text getroffen
+ pOLV->MouseButtonDown(aMEvt);
+ pOLV->MouseMove(aMEvt);
+ pOLV->MouseButtonUp(aMEvt);
+// pOLV->MouseButtonDown(aMEvt);
+ bNoSel = false;
+ }
+ else
+ {
+ nAction = ACTION_GOTO_LEFT_CELL;
+ }
+ }
+
+ if( bNoSel )
+ {
+ // Move cursor to end of text
+ ESelection aNewSelection;
+
+ const WritingMode eMode = pTableObj->GetWritingMode();
+ if( ((nAction == ACTION_GOTO_LEFT_CELL) || (nAction == ACTION_GOTO_RIGHT_CELL)) && (eMode != WritingMode_TB_RL) )
+ {
+ const bool bLast = ((nAction == ACTION_GOTO_LEFT_CELL) && (eMode == WritingMode_LR_TB)) ||
+ ((nAction == ACTION_GOTO_RIGHT_CELL) && (eMode == WritingMode_RL_TB));
+
+ if( bLast )
+ aNewSelection = ESelection(EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND, EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND);
+ }
+ pOLV->SetSelection(aNewSelection);
+ }
+ }
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+bool SvxTableController::StopTextEdit()
+{
+ if(mpView->IsTextEdit())
+ {
+ mpView->SdrEndTextEdit();
+ mpView->SetCurrentObj(OBJ_TABLE);
+ mpView->SetEditMode(SDREDITMODE_EDIT);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SvxTableController::DeleteTable()
+{
+ //
+}
+
+// --------------------------------------------------------------------
+
+void SvxTableController::getSelectedCells( CellPos& rFirst, CellPos& rLast )
+{
+ if( mbCellSelectionMode )
+ {
+ checkCell( maCursorFirstPos );
+ checkCell( maCursorLastPos );
+
+ rFirst.mnCol = std::min( maCursorFirstPos.mnCol, maCursorLastPos.mnCol );
+ rFirst.mnRow = std::min( maCursorFirstPos.mnRow, maCursorLastPos.mnRow );
+ rLast.mnCol = std::max( maCursorFirstPos.mnCol, maCursorLastPos.mnCol );
+ rLast.mnRow = std::max( maCursorFirstPos.mnRow, maCursorLastPos.mnRow );
+
+ bool bExt = false;
+ if( mxTable.is() ) do
+ {
+ bExt = false;
+ for( sal_Int32 nRow = rFirst.mnRow; nRow <= rLast.mnRow && !bExt; nRow++ )
+ {
+ for( sal_Int32 nCol = rFirst.mnCol; nCol <= rLast.mnCol && !bExt; nCol++ )
+ {
+ Reference< XMergeableCell > xCell( mxTable->getCellByPosition( nCol, nRow ), UNO_QUERY );
+ if( !xCell.is() )
+ continue;
+
+ if( xCell->isMerged() )
+ {
+ CellPos aPos( nCol, nRow );
+ findMergeOrigin( aPos );
+ if( (aPos.mnCol < rFirst.mnCol) || (aPos.mnRow < rFirst.mnRow) )
+ {
+ rFirst.mnCol = std::min( rFirst.mnCol, aPos.mnCol );
+ rFirst.mnRow = std::min( rFirst.mnRow, aPos.mnRow );
+ bExt = true;
+ }
+ }
+ else
+ {
+ if( ((nCol + xCell->getColumnSpan() - 1) > rLast.mnCol) || (nRow + xCell->getRowSpan() - 1 ) > rLast.mnRow )
+ {
+ rLast.mnCol = std::max( rLast.mnCol, nCol + xCell->getColumnSpan() - 1 );
+ rLast.mnRow = std::max( rLast.mnRow, nRow + xCell->getRowSpan() - 1 );
+ bExt = true;
+ }
+ }
+ }
+ }
+ }
+ while(bExt);
+ }
+ else if( mpView && mpView->IsTextEdit() )
+ {
+ rFirst = getSelectionStart();
+ findMergeOrigin( rFirst );
+ rLast = rFirst;
+
+ if( mxTable.is() )
+ {
+ Reference< XMergeableCell > xCell( mxTable->getCellByPosition( rLast.mnCol, rLast.mnRow ), UNO_QUERY );
+ if( xCell.is() )
+ {
+ rLast.mnCol += xCell->getColumnSpan() - 1;
+ rLast.mnRow += xCell->getRowSpan() - 1;
+ }
+ }
+ }
+ else
+ {
+ rFirst.mnCol = 0;
+ rFirst.mnRow = 0;
+ if( mxTable.is() )
+ {
+ rLast.mnRow = mxTable->getRowCount()-1;
+ rLast.mnCol = mxTable->getColumnCount()-1;
+ }
+ else
+ {
+ rLast.mnRow = 0;
+ rLast.mnCol = 0;
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SvxTableController::StartSelection( const CellPos& rPos )
+{
+ StopTextEdit();
+ mbCellSelectionMode = true;
+ maCursorLastPos = maCursorFirstPos = rPos;
+ mpView->MarkListHasChanged();
+}
+
+// --------------------------------------------------------------------
+
+void SvxTableController::setSelectedCells( const CellPos& rStart, const CellPos& rEnd )
+{
+ StopTextEdit();
+ mbCellSelectionMode = true;
+ maCursorFirstPos = rStart;
+ UpdateSelection( rEnd );
+}
+
+// --------------------------------------------------------------------
+
+void SvxTableController::UpdateSelection( const CellPos& rPos )
+{
+ maCursorLastPos = rPos;
+ mpView->MarkListHasChanged();
+}
+
+// --------------------------------------------------------------------
+
+void SvxTableController::clearSelection()
+{
+ RemoveSelection();
+}
+
+// --------------------------------------------------------------------
+
+void SvxTableController::selectAll()
+{
+ if( mxTable.is() )
+ {
+ CellPos aPos1, aPos2( mxTable->getColumnCount()-1, mxTable->getRowCount()-1 );
+ if( (aPos2.mnCol >= 0) && (aPos2.mnRow >= 0) )
+ {
+ setSelectedCells( aPos1, aPos2 );
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SvxTableController::RemoveSelection()
+{
+ if( mbCellSelectionMode )
+ {
+ mbCellSelectionMode = false;
+ mpView->MarkListHasChanged();
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SvxTableController::onTableModified()
+{
+ if( mnUpdateEvent == 0 )
+ mnUpdateEvent = Application::PostUserEvent( LINK( this, SvxTableController, UpdateHdl ) );
+}
+// --------------------------------------------------------------------
+
+void SvxTableController::updateSelectionOverlay()
+{
+ destroySelectionOverlay();
+ if( mbCellSelectionMode )
+ {
+ ::sdr::table::SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( mxTableObj.get() );
+ if( pTableObj )
+ {
+ sdr::overlay::OverlayObjectCell::RangeVector aRanges;
+
+ Rectangle aRect;
+ CellPos aStart,aEnd;
+ getSelectedCells( aStart, aEnd );
+ pTableObj->getCellBounds( aStart, aRect );
+
+ basegfx::B2DRange a2DRange( basegfx::B2DPoint(aRect.Left(), aRect.Top()) );
+ a2DRange.expand( basegfx::B2DPoint(aRect.Right(), aRect.Bottom()) );
+
+ findMergeOrigin( aEnd );
+ pTableObj->getCellBounds( aEnd, aRect );
+ a2DRange.expand( basegfx::B2DPoint(aRect.Left(), aRect.Top()) );
+ a2DRange.expand( basegfx::B2DPoint(aRect.Right(), aRect.Bottom()) );
+ aRanges.push_back( a2DRange );
+
+ ::Color aHighlight( COL_BLUE );
+ OutputDevice* pOutDev = mpView->GetFirstOutputDevice();
+ if( pOutDev )
+ aHighlight = pOutDev->GetSettings().GetStyleSettings().GetHighlightColor();
+
+ const sal_uInt32 nCount = mpView->PaintWindowCount();
+ for( sal_uInt32 nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ SdrPaintWindow* pPaintWindow = mpView->GetPaintWindow(nIndex);
+ if( pPaintWindow )
+ {
+ ::sdr::overlay::OverlayManager* pOverlayManager = pPaintWindow->GetOverlayManager();
+ if( pOverlayManager )
+ {
+ // sdr::overlay::CellOverlayType eType = sdr::overlay::CELL_OVERLAY_INVERT;
+ sdr::overlay::CellOverlayType eType = sdr::overlay::CELL_OVERLAY_TRANSPARENT;
+
+ sdr::overlay::OverlayObjectCell* pOverlay = new sdr::overlay::OverlayObjectCell( eType, aHighlight, aRanges );
+
+ pOverlayManager->add(*pOverlay);
+ mpSelectionOverlay = new ::sdr::overlay::OverlayObjectList;
+ mpSelectionOverlay->append(*pOverlay);
+ }
+ }
+ }
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SvxTableController::destroySelectionOverlay()
+{
+ if( mpSelectionOverlay )
+ {
+ delete mpSelectionOverlay;
+ mpSelectionOverlay = 0;
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SvxTableController::MergeAttrFromSelectedCells(SfxItemSet& rAttr, bool bOnlyHardAttr) const
+{
+ if( mxTable.is() )
+ {
+ CellPos aStart, aEnd;
+ const_cast<SvxTableController&>(*this).getSelectedCells( aStart, aEnd );
+
+ for( sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++ )
+ {
+ for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ )
+ {
+ CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
+ if( xCell.is() && !xCell->isMerged() )
+ {
+ const SfxItemSet& rSet = xCell->GetItemSet();
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich(aIter.FirstWhich());
+ while(nWhich)
+ {
+ if(!bOnlyHardAttr)
+ {
+ if(SFX_ITEM_DONTCARE == rSet.GetItemState(nWhich, sal_False))
+ rAttr.InvalidateItem(nWhich);
+ else
+ rAttr.MergeValue(rSet.Get(nWhich), sal_True);
+ }
+ else if(SFX_ITEM_SET == rSet.GetItemState(nWhich, sal_False))
+ {
+ const SfxPoolItem& rItem = rSet.Get(nWhich);
+ rAttr.MergeValue(rItem, sal_True);
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+ }
+ }
+ }
+ }
+
+ if( mpView->IsTextEdit() )
+ {
+ }
+}
+
+// --------------------------------------------------------------------
+
+const sal_uInt16 CELL_BEFORE = 0x0001;
+const sal_uInt16 CELL_LEFT = 0x0002;
+const sal_uInt16 CELL_RIGHT = 0x0004;
+const sal_uInt16 CELL_AFTER = 0x0008;
+
+const sal_uInt16 CELL_UPPER = 0x0010;
+const sal_uInt16 CELL_TOP = 0x0020;
+const sal_uInt16 CELL_BOTTOM = 0x0040;
+const sal_uInt16 CELL_LOWER = 0x0080;
+
+// --------------------------------------------------------------------
+
+static void ImplSetLinePreserveColor( SvxBoxItem& rNewFrame, const SvxBorderLine* pNew, sal_uInt16 nLine )
+{
+ if( pNew )
+ {
+ const SvxBorderLine* pOld = rNewFrame.GetLine(nLine);
+ if( pOld )
+ {
+ SvxBorderLine aNewLine( *pNew );
+ aNewLine.SetColor( pOld->GetColor() );
+ rNewFrame.SetLine( &aNewLine, nLine );
+ return;
+ }
+ }
+ rNewFrame.SetLine( pNew, nLine );
+}
+
+// --------------------------------------------------------------------
+
+static void ImplApplyBoxItem( sal_uInt16 nCellFlags, const SvxBoxItem* pBoxItem, const SvxBoxInfoItem* pBoxInfoItem, SvxBoxItem& rNewFrame )
+{
+ if( (nCellFlags & (CELL_BEFORE|CELL_AFTER|CELL_UPPER|CELL_LOWER)) != 0 )
+ {
+ // current cell is outside the selection
+
+ if( (nCellFlags & ( CELL_BEFORE|CELL_AFTER)) == 0 ) // check if its not nw or ne corner
+ {
+ if( nCellFlags & CELL_UPPER )
+ {
+ if( pBoxInfoItem->IsValid(VALID_TOP) )
+ rNewFrame.SetLine(0, BOX_LINE_BOTTOM );
+ }
+ else if( nCellFlags & CELL_LOWER )
+ {
+ if( pBoxInfoItem->IsValid(VALID_BOTTOM) )
+ rNewFrame.SetLine( 0, BOX_LINE_TOP );
+ }
+ }
+ else if( (nCellFlags & ( CELL_UPPER|CELL_LOWER)) == 0 ) // check if its not sw or se corner
+ {
+ if( nCellFlags & CELL_BEFORE )
+ {
+ if( pBoxInfoItem->IsValid(VALID_LEFT) )
+ rNewFrame.SetLine( 0, BOX_LINE_RIGHT );
+ }
+ else if( nCellFlags & CELL_AFTER )
+ {
+ if( pBoxInfoItem->IsValid(VALID_RIGHT) )
+ rNewFrame.SetLine( 0, BOX_LINE_LEFT );
+ }
+ }
+ }
+ else
+ {
+ // current cell is inside the selection
+
+ if( (nCellFlags & CELL_LEFT) ? pBoxInfoItem->IsValid(VALID_LEFT) : pBoxInfoItem->IsValid(VALID_VERT) )
+ rNewFrame.SetLine( (nCellFlags & CELL_LEFT) ? pBoxItem->GetLeft() : pBoxInfoItem->GetVert(), BOX_LINE_LEFT );
+
+ if( (nCellFlags & CELL_RIGHT) ? pBoxInfoItem->IsValid(VALID_RIGHT) : pBoxInfoItem->IsValid(VALID_VERT) )
+ rNewFrame.SetLine( (nCellFlags & CELL_RIGHT) ? pBoxItem->GetRight() : pBoxInfoItem->GetVert(), BOX_LINE_RIGHT );
+
+ if( (nCellFlags & CELL_TOP) ? pBoxInfoItem->IsValid(VALID_TOP) : pBoxInfoItem->IsValid(VALID_HORI) )
+ rNewFrame.SetLine( (nCellFlags & CELL_TOP) ? pBoxItem->GetTop() : pBoxInfoItem->GetHori(), BOX_LINE_TOP );
+
+ if( (nCellFlags & CELL_BOTTOM) ? pBoxInfoItem->IsValid(VALID_BOTTOM) : pBoxInfoItem->IsValid(VALID_HORI) )
+ rNewFrame.SetLine( (nCellFlags & CELL_BOTTOM) ? pBoxItem->GetBottom() : pBoxInfoItem->GetHori(), BOX_LINE_BOTTOM );
+
+ // apply distance to borders
+ if( pBoxInfoItem->IsValid( VALID_DISTANCE ) )
+ for( sal_uInt16 nLine = 0; nLine < 4; ++nLine )
+ rNewFrame.SetDistance( pBoxItem->GetDistance( nLine ), nLine );
+ }
+}
+
+// --------------------------------------------------------------------
+
+static void ImplSetLineColor( SvxBoxItem& rNewFrame, sal_uInt16 nLine, const Color& rColor )
+{
+ const SvxBorderLine* pSourceLine = rNewFrame.GetLine( nLine );
+ if( pSourceLine )
+ {
+ SvxBorderLine aLine( *pSourceLine );
+ aLine.SetColor( rColor );
+ rNewFrame.SetLine( &aLine, nLine );
+ }
+}
+
+// --------------------------------------------------------------------
+
+static void ImplApplyLineColorItem( sal_uInt16 nCellFlags, const SvxColorItem* pLineColorItem, SvxBoxItem& rNewFrame )
+{
+ const Color aColor( pLineColorItem->GetValue() );
+
+ if( (nCellFlags & (CELL_LOWER|CELL_BEFORE|CELL_AFTER)) == 0 )
+ ImplSetLineColor( rNewFrame, BOX_LINE_BOTTOM, aColor );
+
+ if( (nCellFlags & (CELL_UPPER|CELL_BEFORE|CELL_AFTER)) == 0 )
+ ImplSetLineColor( rNewFrame, BOX_LINE_TOP, aColor );
+
+ if( (nCellFlags & (CELL_UPPER|CELL_LOWER|CELL_AFTER)) == 0 )
+ ImplSetLineColor( rNewFrame, BOX_LINE_RIGHT, aColor );
+
+ if( (nCellFlags & (CELL_UPPER|CELL_LOWER|CELL_BEFORE)) == 0 )
+ ImplSetLineColor( rNewFrame, BOX_LINE_LEFT, aColor );
+}
+
+// --------------------------------------------------------------------
+
+static void ImplApplyBorderLineItem( sal_uInt16 nCellFlags, const SvxBorderLine* pBorderLineItem, SvxBoxItem& rNewFrame )
+{
+ if( (nCellFlags & ( CELL_BEFORE|CELL_AFTER|CELL_UPPER|CELL_LOWER)) != 0 )
+ {
+ if( (nCellFlags & ( CELL_BEFORE|CELL_AFTER)) == 0 ) // check if its not nw or ne corner
+ {
+ if( nCellFlags & CELL_UPPER )
+ {
+ if( rNewFrame.GetBottom() )
+ ImplSetLinePreserveColor( rNewFrame, pBorderLineItem, BOX_LINE_BOTTOM );
+ }
+ else if( nCellFlags & CELL_LOWER )
+ {
+ if( rNewFrame.GetTop() )
+ ImplSetLinePreserveColor( rNewFrame, pBorderLineItem, BOX_LINE_TOP );
+ }
+ }
+ else if( (nCellFlags & ( CELL_UPPER|CELL_LOWER)) == 0 ) // check if its not sw or se corner
+ {
+ if( nCellFlags & CELL_BEFORE )
+ {
+ if( rNewFrame.GetRight() )
+ ImplSetLinePreserveColor( rNewFrame, pBorderLineItem, BOX_LINE_RIGHT );
+ }
+ else if( nCellFlags & CELL_AFTER )
+ {
+ if( rNewFrame.GetLeft() )
+ ImplSetLinePreserveColor( rNewFrame, pBorderLineItem, BOX_LINE_LEFT );
+ }
+ }
+ }
+ else
+ {
+ if( rNewFrame.GetBottom() )
+ ImplSetLinePreserveColor( rNewFrame, pBorderLineItem, BOX_LINE_BOTTOM );
+ if( rNewFrame.GetTop() )
+ ImplSetLinePreserveColor( rNewFrame, pBorderLineItem, BOX_LINE_TOP );
+ if( rNewFrame.GetRight() )
+ ImplSetLinePreserveColor( rNewFrame, pBorderLineItem, BOX_LINE_RIGHT );
+ if( rNewFrame.GetLeft() )
+ ImplSetLinePreserveColor( rNewFrame, pBorderLineItem, BOX_LINE_LEFT );
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SvxTableController::ApplyBorderAttr( const SfxItemSet& rAttr )
+{
+ if( mxTable.is() )
+ {
+ const sal_Int32 nRowCount = mxTable->getRowCount();
+ const sal_Int32 nColCount = mxTable->getColumnCount();
+ if( nRowCount && nColCount )
+ {
+ const SvxBoxItem* pBoxItem = 0;
+ if(SFX_ITEM_SET == rAttr.GetItemState(SDRATTR_TABLE_BORDER, sal_False) )
+ pBoxItem = dynamic_cast< const SvxBoxItem* >( &rAttr.Get( SDRATTR_TABLE_BORDER ) );
+
+ const SvxBoxInfoItem* pBoxInfoItem = 0;
+ if(SFX_ITEM_SET == rAttr.GetItemState(SDRATTR_TABLE_BORDER_INNER, sal_False) )
+ pBoxInfoItem = dynamic_cast< const SvxBoxInfoItem* >( &rAttr.Get( SDRATTR_TABLE_BORDER_INNER ) );
+
+ const SvxColorItem* pLineColorItem = 0;
+ if(SFX_ITEM_SET == rAttr.GetItemState(SID_FRAME_LINECOLOR, sal_False) )
+ pLineColorItem = dynamic_cast< const SvxColorItem* >( &rAttr.Get( SID_FRAME_LINECOLOR ) );
+
+ const SvxBorderLine* pBorderLineItem = 0;
+ if(SFX_ITEM_SET == rAttr.GetItemState(SID_FRAME_LINESTYLE, sal_False) )
+ pBorderLineItem = ((const SvxLineItem&)rAttr.Get( SID_FRAME_LINESTYLE )).GetLine();
+
+ if( pBoxInfoItem && !pBoxItem )
+ {
+ const static SvxBoxItem gaEmptyBoxItem( SDRATTR_TABLE_BORDER );
+ pBoxItem = &gaEmptyBoxItem;
+ }
+ else if( pBoxItem && !pBoxInfoItem )
+ {
+ const static SvxBoxInfoItem gaEmptyBoxInfoItem( SDRATTR_TABLE_BORDER_INNER );
+ pBoxInfoItem = &gaEmptyBoxInfoItem;
+ }
+
+ CellPos aStart, aEnd;
+ getSelectedCells( aStart, aEnd );
+
+ const sal_Int32 nLastRow = std::min( aEnd.mnRow + 2, nRowCount );
+ const sal_Int32 nLastCol = std::min( aEnd.mnCol + 2, nColCount );
+
+ for( sal_Int32 nRow = std::max( aStart.mnRow - 1, (sal_Int32)0 ); nRow < nLastRow; nRow++ )
+ {
+ sal_uInt16 nRowFlags = 0;
+ nRowFlags |= (nRow == aStart.mnRow) ? CELL_TOP : 0;
+ nRowFlags |= (nRow == aEnd.mnRow) ? CELL_BOTTOM : 0;
+ nRowFlags |= (nRow < aStart.mnRow) ? CELL_UPPER : 0;
+ nRowFlags |= (nRow > aEnd.mnRow) ? CELL_LOWER : 0;
+
+ for( sal_Int32 nCol = std::max( aStart.mnCol - 1, (sal_Int32)0 ); nCol < nLastCol; nCol++ )
+ {
+ CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
+ if( !xCell.is() )
+ continue;
+
+ const SfxItemSet& rSet = xCell->GetItemSet();
+ const SvxBoxItem* pOldOuter = (const SvxBoxItem*) &rSet.Get( SDRATTR_TABLE_BORDER );
+
+ SvxBoxItem aNewFrame( *pOldOuter );
+
+ sal_uInt16 nCellFlags = nRowFlags;
+ nCellFlags |= (nCol == aStart.mnCol) ? CELL_LEFT : 0;
+ nCellFlags |= (nCol == aEnd.mnCol) ? CELL_RIGHT : 0;
+ nCellFlags |= (nCol < aStart.mnCol) ? CELL_BEFORE : 0;
+ nCellFlags |= (nCol > aEnd.mnCol) ? CELL_AFTER : 0;
+
+ if( pBoxItem && pBoxInfoItem )
+ ImplApplyBoxItem( nCellFlags, pBoxItem, pBoxInfoItem, aNewFrame );
+
+ if( pLineColorItem )
+ ImplApplyLineColorItem( nCellFlags, pLineColorItem, aNewFrame );
+
+ if( pBorderLineItem )
+ ImplApplyBorderLineItem( nCellFlags, pBorderLineItem, aNewFrame );
+
+ if (aNewFrame != *pOldOuter)
+ {
+ SfxItemSet aAttr(*rSet.GetPool(), rSet.GetRanges());
+ aAttr.Put(aNewFrame);
+ xCell->SetMergedItemSetAndBroadcast( aAttr, false );
+ }
+ }
+ }
+ }
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SvxTableController::UpdateTableShape()
+{
+ SdrObject* pTableObj = mxTableObj.get();
+ if( pTableObj )
+ {
+ pTableObj->ActionChanged();
+ pTableObj->BroadcastObjectChange();
+ }
+ updateSelectionOverlay();
+}
+
+
+// --------------------------------------------------------------------
+
+void SvxTableController::SetAttrToSelectedCells(const SfxItemSet& rAttr, bool bReplaceAll)
+{
+ if( mxTable.is() )
+ {
+ const bool bUndo = mpModel && mpModel->IsUndoEnabled();
+
+ if( bUndo )
+ mpModel->BegUndo( ImpGetResStr(STR_TABLE_NUMFORMAT) );
+
+ CellPos aStart, aEnd;
+ getSelectedCells( aStart, aEnd );
+
+ SfxItemSet aAttr(*rAttr.GetPool(), rAttr.GetRanges());
+ aAttr.Put(rAttr, sal_True);
+
+ const bool bFrame = (rAttr.GetItemState( SDRATTR_TABLE_BORDER ) == SFX_ITEM_SET) || (rAttr.GetItemState( SDRATTR_TABLE_BORDER_INNER ) == SFX_ITEM_SET);
+
+ if( bFrame )
+ {
+ aAttr.ClearItem( SDRATTR_TABLE_BORDER );
+ aAttr.ClearItem( SDRATTR_TABLE_BORDER_INNER );
+ }
+
+ for( sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++ )
+ {
+ for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ )
+ {
+ CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
+ if( xCell.is() )
+ {
+ if( bUndo )
+ xCell->AddUndo();
+ xCell->SetMergedItemSetAndBroadcast(aAttr, bReplaceAll);
+ }
+ }
+ }
+
+ if( bFrame )
+ {
+ ApplyBorderAttr( rAttr );
+ }
+
+ UpdateTableShape();
+
+ if( bUndo )
+ mpModel->EndUndo();
+
+ }
+}
+
+// --------------------------------------------------------------------
+
+bool SvxTableController::GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const
+{
+ if( mxTableObj.is() && hasSelectedCells() )
+ {
+ MergeAttrFromSelectedCells( rTargetSet, bOnlyHardAttr );
+
+ if( mpView->IsTextEdit() )
+ {
+ if( mxTableObj->GetOutlinerParaObject() )
+ rTargetSet.Put( SvxScriptTypeItem( mxTableObj->GetOutlinerParaObject()->GetTextObject().GetScriptType() ) );
+
+ OutlinerView* pTextEditOutlinerView = mpView->GetTextEditOutlinerView();
+ if(pTextEditOutlinerView)
+ {
+ // FALSE= InvalidItems nicht al Default, sondern als "Loecher" betrachten
+ rTargetSet.Put(pTextEditOutlinerView->GetAttribs(), sal_False);
+ rTargetSet.Put( SvxScriptTypeItem( pTextEditOutlinerView->GetSelectedScriptType() ), sal_False );
+ }
+ }
+
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+// --------------------------------------------------------------------
+
+bool SvxTableController::SetAttributes(const SfxItemSet& rSet, bool bReplaceAll)
+{
+ if( mbCellSelectionMode || mpView->IsTextEdit() )
+ {
+ SetAttrToSelectedCells( rSet, bReplaceAll );
+ return true;
+ }
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+bool SvxTableController::GetMarkedObjModel( SdrPage* pNewPage )
+{
+ if( mxTableObj.is() && mbCellSelectionMode && pNewPage ) try
+ {
+ ::sdr::table::SdrTableObj& rTableObj = *static_cast< ::sdr::table::SdrTableObj* >( mxTableObj.get() );
+
+ CellPos aStart, aEnd;
+ getSelectedCells( aStart, aEnd );
+
+ SdrTableObj* pNewTableObj = rTableObj.CloneRange( aStart, aEnd );
+
+ pNewTableObj->SetPage( pNewPage );
+ pNewTableObj->SetModel( pNewPage->GetModel() );
+
+ SdrInsertReason aReason(SDRREASON_VIEWCALL);
+ pNewPage->InsertObject(pNewTableObj,CONTAINER_APPEND,&aReason);
+
+ return true;
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "svx::SvxTableController::GetMarkedObjModel(), exception caught!" );
+ }
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+bool SvxTableController::PasteObjModel( const SdrModel& rModel )
+{
+ if( mxTableObj.is() && mpView && (rModel.GetPageCount() >= 1) )
+ {
+ const SdrPage* pPastePage = rModel.GetPage(0);
+ if( pPastePage && pPastePage->GetObjCount() == 1 )
+ {
+ SdrTableObj* pPasteTableObj = dynamic_cast< SdrTableObj* >( pPastePage->GetObj(0) );
+ if( pPasteTableObj )
+ {
+ return PasteObject( pPasteTableObj );
+ }
+ }
+ }
+
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+bool SvxTableController::PasteObject( SdrTableObj* pPasteTableObj )
+{
+ if( !pPasteTableObj )
+ return false;
+
+ Reference< XTable > xPasteTable( pPasteTableObj->getTable() );
+ if( !xPasteTable.is() )
+ return false;
+
+ if( !mxTable.is() )
+ return false;
+
+ sal_Int32 nPasteColumns = xPasteTable->getColumnCount();
+ sal_Int32 nPasteRows = xPasteTable->getRowCount();
+
+ CellPos aStart, aEnd;
+ getSelectedCells( aStart, aEnd );
+
+ if( mpView->IsTextEdit() )
+ mpView->SdrEndTextEdit(sal_True);
+
+ sal_Int32 nColumns = mxTable->getColumnCount();
+ sal_Int32 nRows = mxTable->getRowCount();
+
+ const sal_Int32 nMissing = nPasteRows - ( nRows - aStart.mnRow );
+ if( nMissing > 0 )
+ {
+ Reference< XTableRows > xRows( mxTable->getRows() );
+ xRows->insertByIndex( nRows, nMissing );
+ nRows = mxTable->getRowCount();
+ }
+
+ nPasteRows = std::min( nPasteRows, nRows - aStart.mnRow );
+ nPasteColumns = std::min( nPasteColumns, nColumns - aStart.mnCol );
+
+ // copy cell contents
+ for( sal_Int32 nRow = 0; nRow < nPasteRows; ++nRow )
+ {
+ for( sal_Int32 nCol = 0; nCol < nPasteColumns; ++nCol )
+ {
+ CellRef xTargetCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( aStart.mnCol + nCol, aStart.mnRow + nRow ).get() ) );
+ if( xTargetCell.is() && !xTargetCell->isMerged() )
+ {
+ xTargetCell->AddUndo();
+ xTargetCell->cloneFrom( dynamic_cast< Cell* >( xPasteTable->getCellByPosition( nCol, nRow ).get() ) );
+ nCol += xTargetCell->getColumnSpan() - 1;
+ }
+ }
+ }
+
+ UpdateTableShape();
+
+ return true;
+}
+
+bool SvxTableController::TakeFormatPaintBrush( boost::shared_ptr< SfxItemSet >& /*rFormatSet*/ )
+{
+ // SdrView::TakeFormatPaintBrush() is enough
+ return false;
+}
+
+bool SvxTableController::ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats )
+{
+ if( mbCellSelectionMode )
+ {
+ SdrTextObj* pTableObj = dynamic_cast<SdrTextObj*>( mxTableObj.get() );
+ if( !pTableObj )
+ return false;
+
+ const bool bUndo = mpModel && mpModel->IsUndoEnabled();
+
+ if( bUndo )
+ mpModel->BegUndo( ImpGetResStr(STR_TABLE_NUMFORMAT) );
+
+ CellPos aStart, aEnd;
+ getSelectedCells( aStart, aEnd );
+
+ SfxItemSet aAttr(*rFormatSet.GetPool(), rFormatSet.GetRanges());
+ aAttr.Put(rFormatSet, sal_True);
+
+ const bool bFrame = (rFormatSet.GetItemState( SDRATTR_TABLE_BORDER ) == SFX_ITEM_SET) || (rFormatSet.GetItemState( SDRATTR_TABLE_BORDER_INNER ) == SFX_ITEM_SET);
+
+ if( bFrame )
+ {
+ aAttr.ClearItem( SDRATTR_TABLE_BORDER );
+ aAttr.ClearItem( SDRATTR_TABLE_BORDER_INNER );
+ }
+
+ const sal_uInt16* pRanges = rFormatSet.GetRanges();
+ bool bTextOnly = true;
+
+ while( *pRanges )
+ {
+ if( (*pRanges != EE_PARA_START) && (*pRanges != EE_CHAR_START) )
+ {
+ bTextOnly = true;
+ break;
+ }
+ pRanges += 2;
+ }
+
+ const bool bReplaceAll = false;
+ for( sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++ )
+ {
+ for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ )
+ {
+ CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
+ if( xCell.is() )
+ {
+ if( bUndo )
+ xCell->AddUndo();
+ if( !bTextOnly )
+ xCell->SetMergedItemSetAndBroadcast(aAttr, bReplaceAll);
+
+ SdrText* pText = static_cast< SdrText* >( xCell.get() );
+ mpView->ApplyFormatPaintBrushToText( rFormatSet, *pTableObj, pText, bNoCharacterFormats, bNoParagraphFormats );
+ }
+ }
+ }
+
+ if( bFrame )
+ {
+ ApplyBorderAttr( rFormatSet );
+ }
+
+ UpdateTableShape();
+
+ if( bUndo )
+ mpModel->EndUndo();
+
+ return true;
+
+ }
+ return false;
+}
+
+
+// --------------------------------------------------------------------
+
+IMPL_LINK( SvxTableController, UpdateHdl, void *, EMPTYARG )
+{
+ mnUpdateEvent = 0;
+
+ if( mbCellSelectionMode )
+ {
+ CellPos aStart( maCursorFirstPos );
+ CellPos aEnd( maCursorLastPos );
+ checkCell(aStart);
+ checkCell(aEnd);
+ if( aStart != maCursorFirstPos || aEnd != maCursorLastPos )
+ {
+ setSelectedCells( aStart, aEnd );
+ }
+ }
+ updateSelectionOverlay();
+
+ return 0;
+}
+
+} }
diff --git a/svx/source/table/tablecontroller.hxx b/svx/source/table/tablecontroller.hxx
new file mode 100644
index 000000000000..40f22ef8ea09
--- /dev/null
+++ b/svx/source/table/tablecontroller.hxx
@@ -0,0 +1,170 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_TABLECONTROLLER_HXX_
+#define _SVX_TABLECONTROLLER_HXX_
+
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/table/XTable.hpp>
+#include <rtl/ref.hxx>
+
+#include <svx/sdr/overlay/overlayobjectlist.hxx>
+#include <svx/selectioncontroller.hxx>
+#include <svx/svdotable.hxx>
+#include <svx/svdview.hxx>
+#include <tablemodel.hxx>
+
+class SdrObjEditView;
+class SdrObject;
+class SfxItemSet;
+
+namespace sdr { namespace table {
+
+const sal_Int16 SELTYPE_NONE = 0;
+const sal_Int16 SELTYPE_MOUSE = 1;
+const sal_Int16 SELTYPE_KEYS = 2;
+
+class SVX_DLLPUBLIC SvxTableController: public sdr::SelectionController
+{
+public:
+ SVX_DLLPRIVATE SvxTableController( SdrObjEditView* pView, const SdrObject* pObj );
+ SVX_DLLPRIVATE virtual ~SvxTableController();
+
+ // from sdr::SelectionController
+ SVX_DLLPRIVATE virtual bool onKeyInput(const KeyEvent& rKEvt, Window* pWin);
+ SVX_DLLPRIVATE virtual bool onMouseButtonDown(const MouseEvent& rMEvt, Window* pWin);
+ SVX_DLLPRIVATE virtual bool onMouseButtonUp(const MouseEvent& rMEvt, Window* pWin);
+ SVX_DLLPRIVATE virtual bool onMouseMove(const MouseEvent& rMEvt, Window* pWin);
+
+ SVX_DLLPRIVATE virtual bool DeleteMarked();
+
+ SVX_DLLPRIVATE virtual void onSelectionHasChanged();
+
+ SVX_DLLPRIVATE virtual void GetState( SfxItemSet& rSet );
+ SVX_DLLPRIVATE virtual void Execute( SfxRequest& rReq );
+
+ SVX_DLLPRIVATE virtual bool GetStyleSheet( SfxStyleSheet* &rpStyleSheet ) const;
+ SVX_DLLPRIVATE virtual bool SetStyleSheet( SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr );
+
+ SVX_DLLPRIVATE virtual bool TakeFormatPaintBrush( boost::shared_ptr< SfxItemSet >& rFormatSet );
+ SVX_DLLPRIVATE virtual bool ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats );
+
+ // slots
+ SVX_DLLPRIVATE void onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs = 0 );
+ SVX_DLLPRIVATE void onDelete( sal_uInt16 nSId );
+ SVX_DLLPRIVATE void onSelect( sal_uInt16 nSId );
+ SVX_DLLPRIVATE void onFormatTable( SfxRequest& rReq );
+ SVX_DLLPRIVATE void MergeMarkedCells();
+ SVX_DLLPRIVATE void SplitMarkedCells();
+ SVX_DLLPRIVATE void DistributeColumns();
+ SVX_DLLPRIVATE void DistributeRows();
+ SVX_DLLPRIVATE void SetVertical( sal_uInt16 nSId );
+
+ SVX_DLLPRIVATE static rtl::Reference< sdr::SelectionController > create( SdrObjEditView* pView, const SdrObject* pObj, const rtl::Reference< sdr::SelectionController >& xRefController );
+
+ SVX_DLLPRIVATE void MergeAttrFromSelectedCells(SfxItemSet& rAttr, bool bOnlyHardAttr) const;
+ SVX_DLLPRIVATE void SetAttrToSelectedCells(const SfxItemSet& rAttr, bool bReplaceAll);
+
+ SVX_DLLPRIVATE virtual bool GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const;
+ SVX_DLLPRIVATE virtual bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll);
+
+ SVX_DLLPRIVATE virtual bool GetMarkedObjModel( SdrPage* pNewPage );
+ SVX_DLLPRIVATE virtual bool PasteObjModel( const SdrModel& rModel );
+
+ SVX_DLLPRIVATE bool hasSelectedCells() const { return mbCellSelectionMode || mpView->IsTextEdit(); }
+
+ void getSelectedCells( CellPos& rFirstPos, CellPos& rLastPos );
+ void setSelectedCells( const CellPos& rFirstPos, const CellPos& rLastPos );
+ void clearSelection();
+ void selectAll();
+
+ SVX_DLLPRIVATE void onTableModified();
+
+private:
+ SvxTableController(SvxTableController &); // not defined
+ void operator =(SvxTableController &); // not defined
+
+ // internals
+ SVX_DLLPRIVATE void ApplyBorderAttr( const SfxItemSet& rAttr );
+ SVX_DLLPRIVATE void UpdateTableShape();
+
+ SVX_DLLPRIVATE void SetTableStyle( const SfxItemSet* pArgs );
+ SVX_DLLPRIVATE void SetTableStyleSettings( const SfxItemSet* pArgs );
+
+ SVX_DLLPRIVATE bool PasteObject( SdrTableObj* pPasteTableObj );
+
+ SVX_DLLPRIVATE bool checkTableObject();
+ SVX_DLLPRIVATE bool updateTableObject();
+ SVX_DLLPRIVATE const CellPos& getSelectionStart();
+ SVX_DLLPRIVATE void setSelectionStart( const CellPos& rPos );
+ SVX_DLLPRIVATE const CellPos& getSelectionEnd();
+ SVX_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellCursor > getSelectionCursor();
+ SVX_DLLPRIVATE void checkCell( CellPos& rPos );
+
+ SVX_DLLPRIVATE void MergeRange( sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow );
+
+ SVX_DLLPRIVATE void EditCell( const CellPos& rPos, ::Window* pWindow, const ::com::sun::star::awt::MouseEvent* pMouseEvent = 0, sal_uInt16 nAction = 0 );
+ SVX_DLLPRIVATE bool StopTextEdit();
+
+ SVX_DLLPRIVATE void DeleteTable();
+
+ SVX_DLLPRIVATE sal_uInt16 getKeyboardAction( const KeyEvent& rKEvt, Window* pWindow );
+ SVX_DLLPRIVATE bool executeAction( sal_uInt16 nAction, bool bSelect, Window* pWindow );
+ SVX_DLLPRIVATE void gotoCell( const CellPos& rCell, bool bSelect, Window* pWindow, sal_uInt16 nAction = 0 );
+
+ SVX_DLLPRIVATE void StartSelection( const CellPos& rPos );
+ SVX_DLLPRIVATE void UpdateSelection( const CellPos& rPos );
+ SVX_DLLPRIVATE void RemoveSelection();
+ SVX_DLLPRIVATE void updateSelectionOverlay();
+ SVX_DLLPRIVATE void destroySelectionOverlay();
+
+ SVX_DLLPRIVATE void findMergeOrigin( CellPos& rPos );
+
+ DECL_LINK( UpdateHdl, void * );
+
+ TableModelRef mxTable;
+
+ CellPos maCursorFirstPos;
+ CellPos maCursorLastPos;
+ bool mbCellSelectionMode;
+ CellPos maMouseDownPos;
+ bool mbLeftButtonDown;
+ ::sdr::overlay::OverlayObjectList* mpSelectionOverlay;
+
+ SdrView* mpView;
+ SdrObjectWeakRef mxTableObj;
+ SdrModel* mpModel;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > mxModifyListener;
+
+ sal_uLong mnUpdateEvent;
+};
+
+} }
+
+#endif // _SVX_TABLECONTROLLER_HXX_
+
diff --git a/svx/source/table/tabledesign.cxx b/svx/source/table/tabledesign.cxx
new file mode 100644
index 000000000000..e952425e5c30
--- /dev/null
+++ b/svx/source/table/tabledesign.cxx
@@ -0,0 +1,808 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <comphelper/serviceinfohelper.hxx>
+
+#include <osl/mutex.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase6.hxx>
+#include <cppuhelper/implbase7.hxx>
+#include <cppuhelper/interfacecontainer.h>
+
+#include "svx/unoprov.hxx"
+#include "svx/sdr/table/tabledesign.hxx"
+#include "svx/dialmgr.hxx"
+#include "svx/dialogs.hrc"
+
+#include "celltypes.hxx"
+
+#include <vector>
+#include <map>
+
+#include <boost/bind.hpp>
+
+// -----------------------------------------------------------------------------
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::container;
+
+using ::rtl::OUString;
+using ::vos::OGuard;
+using ::osl::MutexGuard;
+using ::osl::ClearableMutexGuard;
+using ::cppu::OInterfaceContainerHelper;
+
+namespace sdr { namespace table {
+
+typedef std::map< OUString, sal_Int32 > CellStyleNameMap;
+
+typedef ::cppu::WeakComponentImplHelper6< XStyle, XNameReplace, XServiceInfo, XIndexAccess, XModifyBroadcaster, XModifyListener > TableDesignStyleBase;
+
+class TableDesignStyle : private ::cppu::BaseMutex, public TableDesignStyleBase
+{
+public:
+ TableDesignStyle();
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
+
+ // XStyle
+ virtual ::sal_Bool SAL_CALL isUserDefined() throw (RuntimeException);
+ virtual ::sal_Bool SAL_CALL isInUse() throw (RuntimeException);
+ virtual OUString SAL_CALL getParentStyle() throw (RuntimeException);
+ virtual void SAL_CALL setParentStyle( const OUString& aParentStyle ) throw (NoSuchElementException, RuntimeException);
+
+ // XNamed
+ virtual OUString SAL_CALL getName() throw (RuntimeException);
+ virtual void SAL_CALL setName( const OUString& aName ) throw (RuntimeException);
+
+ // XNameAccess
+ virtual Any SAL_CALL getByName( const OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getElementNames() throw(RuntimeException);
+ virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw(RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw(RuntimeException);
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() throw(RuntimeException) ;
+ virtual Any SAL_CALL getByIndex( sal_Int32 Index ) throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException);
+
+ // XNameReplace
+ virtual void SAL_CALL replaceByName( const OUString& aName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException);
+
+ // XModifyBroadcaster
+ virtual void SAL_CALL addModifyListener( const Reference< XModifyListener >& aListener ) throw (RuntimeException);
+ virtual void SAL_CALL removeModifyListener( const Reference< XModifyListener >& aListener ) throw (RuntimeException);
+
+ // XModifyListener
+ virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ void notifyModifyListener();
+
+ // this function is called upon disposing the component
+ virtual void SAL_CALL disposing();
+
+ static const CellStyleNameMap& getCellStyleNameMap();
+
+ OUString msName;
+ Reference< XStyle > maCellStyles[style_count];
+};
+
+typedef std::vector< Reference< XStyle > > TableDesignStyleVector;
+
+class TableDesignFamily : public ::cppu::WeakImplHelper7< XNameContainer, XNamed, XIndexAccess, XSingleServiceFactory, XServiceInfo, XComponent, XPropertySet >
+{
+public:
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
+
+ // XNamed
+ virtual OUString SAL_CALL getName( ) throw (RuntimeException);
+ virtual void SAL_CALL setName( const OUString& aName ) throw (RuntimeException);
+
+ // XNameAccess
+ virtual Any SAL_CALL getByName( const OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getElementNames() throw(RuntimeException);
+ virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw(RuntimeException);
+
+ // XElementAccess
+ virtual Type SAL_CALL getElementType() throw(RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw(RuntimeException);
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() throw(RuntimeException) ;
+ virtual Any SAL_CALL getByIndex( sal_Int32 Index ) throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException);
+
+ // XNameContainer
+ virtual void SAL_CALL insertByName( const OUString& aName, const Any& aElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException);
+ virtual void SAL_CALL removeByName( const OUString& Name ) throw(NoSuchElementException, WrappedTargetException, RuntimeException);
+
+ // XNameReplace
+ virtual void SAL_CALL replaceByName( const OUString& aName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException);
+
+ // XSingleServiceFactory
+ virtual Reference< XInterface > SAL_CALL createInstance( ) throw(Exception, RuntimeException);
+ virtual Reference< XInterface > SAL_CALL createInstanceWithArguments( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose( ) throw (RuntimeException);
+ virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException);
+ virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException);
+
+ // XPropertySet
+ virtual Reference<XPropertySetInfo> SAL_CALL getPropertySetInfo() throw (RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException);
+ virtual Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const Reference<XPropertyChangeListener>& xListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const Reference<XPropertyChangeListener>& aListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener(const OUString& PropertyName, const Reference<XVetoableChangeListener>& aListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener(const OUString& PropertyName,const Reference<XVetoableChangeListener>&aListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException);
+
+ TableDesignStyleVector maDesigns;
+};
+
+//------------------------------------------------------------------------
+// TableDesignStyle
+//------------------------------------------------------------------------
+
+TableDesignStyle::TableDesignStyle()
+: TableDesignStyleBase(m_aMutex)
+{
+}
+
+const CellStyleNameMap& TableDesignStyle::getCellStyleNameMap()
+{
+ static CellStyleNameMap aMap;
+ if( aMap.empty() )
+ {
+ CellStyleNameMap aNewMap;
+ aNewMap[ OUString( RTL_CONSTASCII_USTRINGPARAM( "first-row" ) ) ] = first_row_style;
+ aNewMap[ OUString( RTL_CONSTASCII_USTRINGPARAM( "last-row" ) ) ] = last_row_style;
+ aNewMap[ OUString( RTL_CONSTASCII_USTRINGPARAM( "first-column" ) ) ] = first_column_style;
+ aNewMap[ OUString( RTL_CONSTASCII_USTRINGPARAM( "last-column" ) ) ] = last_column_style;
+ aNewMap[ OUString( RTL_CONSTASCII_USTRINGPARAM( "body" ) ) ] = body_style;
+ aNewMap[ OUString( RTL_CONSTASCII_USTRINGPARAM( "even-rows" ) ) ] = even_rows_style;
+ aNewMap[ OUString( RTL_CONSTASCII_USTRINGPARAM( "odd-rows" ) ) ] = odd_rows_style;
+ aNewMap[ OUString( RTL_CONSTASCII_USTRINGPARAM( "even-columns" ) ) ] = even_columns_style;
+ aNewMap[ OUString( RTL_CONSTASCII_USTRINGPARAM( "odd-columns" ) ) ] = odd_columns_style;
+ aNewMap[ OUString( RTL_CONSTASCII_USTRINGPARAM( "background" ) ) ] = background_style;
+ aMap.swap( aNewMap );
+ }
+
+ return aMap;
+}
+
+// ----------------------------------------------------------
+// XServiceInfo
+// ----------------------------------------------------------
+
+OUString SAL_CALL TableDesignStyle::getImplementationName() throw(RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("TableDesignStyle") );
+}
+
+// ----------------------------------------------------------
+
+sal_Bool SAL_CALL TableDesignStyle::supportsService( const OUString& ServiceName ) throw(RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+// ----------------------------------------------------------
+
+Sequence< OUString > SAL_CALL TableDesignStyle::getSupportedServiceNames() throw(RuntimeException)
+{
+ OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.Style") );
+ Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+// ----------------------------------------------------------
+// XStyle
+// ----------------------------------------------------------
+
+sal_Bool SAL_CALL TableDesignStyle::isUserDefined() throw (RuntimeException)
+{
+ return sal_False;
+}
+
+// ----------------------------------------------------------
+
+sal_Bool SAL_CALL TableDesignStyle::isInUse() throw (RuntimeException)
+{
+ ClearableMutexGuard aGuard( rBHelper.rMutex );
+ OInterfaceContainerHelper * pContainer = rBHelper.getContainer( XModifyListener::static_type() );
+ if( pContainer )
+ {
+ Sequence< Reference< XInterface > > aListener( pContainer->getElements() );
+ aGuard.clear();
+
+ sal_Int32 nIndex = aListener.getLength();
+ while( --nIndex >= 0 )
+ {
+ TableDesignUser* pUser = dynamic_cast< TableDesignUser* >( aListener[nIndex].get() );
+ if( pUser && pUser->isInUse() )
+ return sal_True;
+ }
+ }
+ return sal_False;
+}
+
+// ----------------------------------------------------------
+
+OUString SAL_CALL TableDesignStyle::getParentStyle() throw (RuntimeException)
+{
+ return OUString();
+}
+
+// ----------------------------------------------------------
+
+void SAL_CALL TableDesignStyle::setParentStyle( const OUString& ) throw (NoSuchElementException, RuntimeException)
+{
+}
+
+// ----------------------------------------------------------
+// XNamed
+// ----------------------------------------------------------
+
+OUString SAL_CALL TableDesignStyle::getName() throw (RuntimeException)
+{
+ return msName;
+}
+
+// ----------------------------------------------------------
+
+void SAL_CALL TableDesignStyle::setName( const OUString& rName ) throw (RuntimeException)
+{
+ msName = rName;
+}
+
+// ----------------------------------------------------------
+// XNameAccess
+// ----------------------------------------------------------
+
+Any SAL_CALL TableDesignStyle::getByName( const OUString& rName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ const CellStyleNameMap& rMap = getCellStyleNameMap();
+
+ CellStyleNameMap::const_iterator iter = rMap.find( rName );
+ if( iter == rMap.end() )
+ throw NoSuchElementException();
+
+ return Any( maCellStyles[(*iter).second] );
+}
+
+// ----------------------------------------------------------
+
+Sequence< OUString > SAL_CALL TableDesignStyle::getElementNames() throw(RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ const CellStyleNameMap& rMap = getCellStyleNameMap();
+ Sequence< OUString > aRet( rMap.size() );
+ OUString* pName = aRet.getArray();
+
+ CellStyleNameMap::const_iterator iter = rMap.begin();
+ while( iter != rMap.end() )
+ *pName++ = (*iter++).first;
+
+ return aRet;
+}
+
+// ----------------------------------------------------------
+
+sal_Bool SAL_CALL TableDesignStyle::hasByName( const OUString& rName ) throw(RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ const CellStyleNameMap& rMap = getCellStyleNameMap();
+
+ CellStyleNameMap::const_iterator iter = rMap.find( rName );
+ return ( iter != rMap.end() ) ? sal_True : sal_False;
+}
+
+// ----------------------------------------------------------
+// XElementAccess
+// ----------------------------------------------------------
+
+Type SAL_CALL TableDesignStyle::getElementType() throw(RuntimeException)
+{
+ return XStyle::static_type();
+}
+
+// ----------------------------------------------------------
+
+sal_Bool SAL_CALL TableDesignStyle::hasElements() throw(RuntimeException)
+{
+ return sal_True;
+}
+
+// ----------------------------------------------------------
+// XIndexAccess
+// ----------------------------------------------------------
+
+sal_Int32 SAL_CALL TableDesignStyle::getCount() throw(RuntimeException)
+{
+ return style_count;
+}
+
+// ----------------------------------------------------------
+
+Any SAL_CALL TableDesignStyle::getByIndex( sal_Int32 Index ) throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( (Index < 0) || (Index >= style_count) )
+ throw IndexOutOfBoundsException();
+
+ return Any( maCellStyles[Index] );
+}
+
+// ----------------------------------------------------------
+// XNameReplace
+// ----------------------------------------------------------
+
+void SAL_CALL TableDesignStyle::replaceByName( const OUString& rName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ const CellStyleNameMap& rMap = getCellStyleNameMap();
+ CellStyleNameMap::const_iterator iter = rMap.find( rName );
+ if( iter == rMap.end() )
+ throw NoSuchElementException();
+
+
+ Reference< XStyle > xNewStyle;
+ if( !(aElement >>= xNewStyle) )
+ throw IllegalArgumentException();
+
+ const sal_Int32 nIndex = (*iter).second;
+
+ Reference< XStyle > xOldStyle( maCellStyles[nIndex] );
+
+ if( xNewStyle != xOldStyle )
+ {
+ Reference< XModifyListener > xListener( this );
+
+ // end listening to old style, if possible
+ Reference< XModifyBroadcaster > xOldBroadcaster( xOldStyle, UNO_QUERY );
+ if( xOldBroadcaster.is() )
+ xOldBroadcaster->removeModifyListener( xListener );
+
+ // start listening to new style, if possible
+ Reference< XModifyBroadcaster > xNewBroadcaster( xNewStyle, UNO_QUERY );
+ if( xNewBroadcaster.is() )
+ xNewBroadcaster->addModifyListener( xListener );
+
+ maCellStyles[nIndex] = xNewStyle;
+ }
+}
+
+// ----------------------------------------------------------
+// XComponent
+// ----------------------------------------------------------
+
+void SAL_CALL TableDesignStyle::disposing()
+{
+ for( sal_Int32 nIndex = 0; nIndex < style_count; nIndex++ )
+ maCellStyles[nIndex].clear();
+}
+
+//------------------------------------------------------------------------
+// XModifyBroadcaster
+//------------------------------------------------------------------------
+
+void SAL_CALL TableDesignStyle::addModifyListener( const Reference< XModifyListener >& xListener ) throw (RuntimeException)
+{
+ ClearableMutexGuard aGuard( rBHelper.rMutex );
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ {
+ aGuard.clear();
+ EventObject aEvt( static_cast< OWeakObject * >( this ) );
+ xListener->disposing( aEvt );
+ }
+ else
+ {
+ rBHelper.addListener( XModifyListener::static_type(), xListener );
+ }
+}
+
+//------------------------------------------------------------------------
+
+void SAL_CALL TableDesignStyle::removeModifyListener( const Reference< XModifyListener >& xListener ) throw (RuntimeException)
+{
+ rBHelper.removeListener( XModifyListener::static_type(), xListener );
+}
+
+//------------------------------------------------------------------------
+
+void TableDesignStyle::notifyModifyListener()
+{
+ MutexGuard aGuard( rBHelper.rMutex );
+
+ OInterfaceContainerHelper * pContainer = rBHelper.getContainer( XModifyListener::static_type() );
+ if( pContainer )
+ {
+ EventObject aEvt( static_cast< OWeakObject * >( this ) );
+ pContainer->forEach<XModifyListener>( boost::bind( &XModifyListener::modified, _1, boost::cref( aEvt ) ) );
+ }
+}
+
+//------------------------------------------------------------------------
+// XModifyListener
+//------------------------------------------------------------------------
+
+// if we get a modify hint from a style, notify all registered XModifyListener
+void SAL_CALL TableDesignStyle::modified( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)
+{
+ notifyModifyListener();
+}
+
+//------------------------------------------------------------------------
+
+void SAL_CALL TableDesignStyle::disposing( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)
+{
+}
+
+//------------------------------------------------------------------------
+// TableStyle
+//------------------------------------------------------------------------
+
+// ----------------------------------------------------------
+// XServiceInfo
+// ----------------------------------------------------------
+
+OUString SAL_CALL TableDesignFamily::getImplementationName() throw(RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("TableDesignFamily") );
+}
+
+// ----------------------------------------------------------
+
+sal_Bool SAL_CALL TableDesignFamily::supportsService( const OUString& ServiceName ) throw(RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+// ----------------------------------------------------------
+
+Sequence< OUString > SAL_CALL TableDesignFamily::getSupportedServiceNames() throw(RuntimeException)
+{
+ OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.StyleFamily") );
+ Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+// ----------------------------------------------------------
+// XNamed
+// ----------------------------------------------------------
+
+OUString SAL_CALL TableDesignFamily::getName() throw (RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "table" ) );
+}
+
+// ----------------------------------------------------------
+
+void SAL_CALL TableDesignFamily::setName( const OUString& ) throw (RuntimeException)
+{
+}
+
+// ----------------------------------------------------------
+// XNameAccess
+// ----------------------------------------------------------
+
+Any SAL_CALL TableDesignFamily::getByName( const OUString& rName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ for( TableDesignStyleVector::iterator iter( maDesigns.begin() ); iter != maDesigns.end(); iter++ )
+ {
+ if( (*iter)->getName() == rName )
+ return Any( (*iter) );
+ }
+
+ throw NoSuchElementException();
+}
+
+// ----------------------------------------------------------
+
+Sequence< OUString > SAL_CALL TableDesignFamily::getElementNames() throw(RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ Sequence< OUString > aRet( maDesigns.size() );
+ OUString* pNames = aRet.getArray();
+
+ for( TableDesignStyleVector::iterator iter( maDesigns.begin() ); iter != maDesigns.end(); iter++ )
+ *pNames++ = (*iter)->getName();
+
+ return aRet;
+}
+
+// ----------------------------------------------------------
+
+sal_Bool SAL_CALL TableDesignFamily::hasByName( const OUString& aName ) throw(RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ for( TableDesignStyleVector::iterator iter( maDesigns.begin() ); iter != maDesigns.end(); iter++ )
+ if( (*iter)->getName() == aName )
+ return sal_True;
+
+ return sal_False;
+}
+
+// ----------------------------------------------------------
+// XElementAccess
+// ----------------------------------------------------------
+
+Type SAL_CALL TableDesignFamily::getElementType() throw(RuntimeException)
+{
+ return XStyle::static_type();
+}
+
+// ----------------------------------------------------------
+
+sal_Bool SAL_CALL TableDesignFamily::hasElements() throw(RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ return maDesigns.empty() ? sal_False : sal_True;
+}
+
+// ----------------------------------------------------------
+// XIndexAccess
+// ----------------------------------------------------------
+
+sal_Int32 SAL_CALL TableDesignFamily::getCount() throw(RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ return sal::static_int_cast< sal_Int32 >( maDesigns.size() );
+}
+
+// ----------------------------------------------------------
+
+Any SAL_CALL TableDesignFamily::getByIndex( sal_Int32 Index ) throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( (Index >= 0) && (Index < sal::static_int_cast< sal_Int32 >( maDesigns.size() ) ) )
+ return Any( maDesigns[Index] );
+
+ throw IndexOutOfBoundsException();
+}
+
+// ----------------------------------------------------------
+// XNameContainer
+// ----------------------------------------------------------
+
+void SAL_CALL TableDesignFamily::insertByName( const OUString& rName, const Any& rElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ Reference< XStyle > xStyle( rElement, UNO_QUERY );
+ if( !xStyle.is() )
+ throw IllegalArgumentException();
+
+ xStyle->setName( rName );
+ for( TableDesignStyleVector::iterator iter( maDesigns.begin() ); iter != maDesigns.end(); iter++ )
+ if( (*iter)->getName() == rName )
+ throw ElementExistException();
+
+ maDesigns.push_back( xStyle );
+}
+
+// ----------------------------------------------------------
+
+void SAL_CALL TableDesignFamily::removeByName( const OUString& rName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ for( TableDesignStyleVector::iterator iter( maDesigns.begin() ); iter != maDesigns.end(); iter++ )
+ {
+ if( (*iter)->getName() == rName )
+ {
+ maDesigns.erase( iter );
+ return;
+ }
+ }
+
+
+ throw NoSuchElementException();
+}
+
+// ----------------------------------------------------------
+// XNameReplace
+// ----------------------------------------------------------
+
+void SAL_CALL TableDesignFamily::replaceByName( const OUString& rName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ Reference< XStyle > xStyle( aElement, UNO_QUERY );
+ if( !xStyle.is() )
+ throw IllegalArgumentException();
+
+ for( TableDesignStyleVector::iterator iter( maDesigns.begin() ); iter != maDesigns.end(); iter++ )
+ {
+ if( (*iter)->getName() == rName )
+ {
+ (*iter) = xStyle;
+ xStyle->setName( rName );
+ return;
+ }
+ }
+
+ throw NoSuchElementException();
+}
+
+// ----------------------------------------------------------
+// XSingleServiceFactory
+// ----------------------------------------------------------
+
+Reference< XInterface > SAL_CALL TableDesignFamily::createInstance() throw(Exception, RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ return Reference< XInterface >( static_cast< XStyle* >( new TableDesignStyle ) );
+}
+
+// ----------------------------------------------------------
+
+Reference< XInterface > SAL_CALL TableDesignFamily::createInstanceWithArguments( const Sequence< Any >& ) throw(Exception, RuntimeException)
+{
+ return createInstance();
+}
+
+// ----------------------------------------------------------
+// XComponent
+// ----------------------------------------------------------
+
+void SAL_CALL TableDesignFamily::dispose( ) throw (RuntimeException)
+{
+ TableDesignStyleVector aDesigns;
+ aDesigns.swap( maDesigns );
+
+ for( TableDesignStyleVector::iterator iter( aDesigns.begin() ); iter != aDesigns.end(); iter++ )
+ {
+ Reference< XComponent > xComp( (*iter), UNO_QUERY );
+ if( xComp.is() )
+ xComp->dispose();
+ }
+}
+
+// ----------------------------------------------------------
+
+void SAL_CALL TableDesignFamily::addEventListener( const Reference< XEventListener >& ) throw (RuntimeException)
+{
+}
+
+// ----------------------------------------------------------
+
+void SAL_CALL TableDesignFamily::removeEventListener( const Reference< XEventListener >& ) throw (RuntimeException)
+{
+}
+
+// ----------------------------------------------------------
+// XPropertySet
+// ----------------------------------------------------------
+
+Reference<XPropertySetInfo> TableDesignFamily::getPropertySetInfo() throw (RuntimeException)
+{
+ OSL_ENSURE( 0, "###unexpected!" );
+ return Reference<XPropertySetInfo>();
+}
+
+// ----------------------------------------------------------
+
+void TableDesignFamily::setPropertyValue( const OUString& , const Any& ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ OSL_ENSURE( 0, "###unexpected!" );
+}
+
+// ----------------------------------------------------------
+
+Any TableDesignFamily::getPropertyValue( const OUString& PropertyName ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("DisplayName") ))
+ {
+ OUString sDisplayName( SVX_RESSTR( RID_SVXSTR_STYLEFAMILY_TABLEDESIGN ) );
+ return Any( sDisplayName );
+ }
+ else
+ {
+ throw UnknownPropertyException( OUString( RTL_CONSTASCII_USTRINGPARAM("unknown property: ") ) + PropertyName, static_cast<OWeakObject *>(this) );
+ }
+}
+
+// ----------------------------------------------------------
+
+void TableDesignFamily::addPropertyChangeListener( const OUString& , const Reference<XPropertyChangeListener>& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ OSL_ENSURE( 0, "###unexpected!" );
+}
+
+// ----------------------------------------------------------
+
+void TableDesignFamily::removePropertyChangeListener( const OUString& , const Reference<XPropertyChangeListener>& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ OSL_ENSURE( 0, "###unexpected!" );
+}
+
+// ----------------------------------------------------------
+
+void TableDesignFamily::addVetoableChangeListener( const OUString& , const Reference<XVetoableChangeListener>& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ OSL_ENSURE( 0, "###unexpected!" );
+}
+
+// ----------------------------------------------------------
+
+void TableDesignFamily::removeVetoableChangeListener( const OUString& , const Reference<XVetoableChangeListener>& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ OSL_ENSURE( 0, "###unexpected!" );
+}
+
+// --------------------------------------------------------------------
+
+
+SVX_DLLPUBLIC Reference< XNameAccess > CreateTableDesignFamily()
+{
+ return new TableDesignFamily();
+}
+
+} }
diff --git a/svx/source/table/tablehandles.cxx b/svx/source/table/tablehandles.cxx
new file mode 100644
index 000000000000..46df8c681db5
--- /dev/null
+++ b/svx/source/table/tablehandles.cxx
@@ -0,0 +1,314 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "tablehandles.hxx"
+
+#include <vcl/svapp.hxx>
+#include <vcl/outdev.hxx>
+#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 <svx/sdrpaintwindow.hxx>
+#include <svx/svdmrkv.hxx>
+#include <svx/svdpagv.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <svx/sdr/overlay/overlayhatchrect.hxx>
+#include <drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx>
+
+namespace sdr { namespace table {
+
+// --------------------------------------------------------------------
+
+class OverlayTableEdge : public sdr::overlay::OverlayObject
+{
+protected:
+ basegfx::B2DPolyPolygon maPolyPolygon;
+ bool mbVisible;
+
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
+
+public:
+ OverlayTableEdge( const basegfx::B2DPolyPolygon& rPolyPolygon, bool bVisible );
+ virtual ~OverlayTableEdge();
+};
+
+// --------------------------------------------------------------------
+
+TableEdgeHdl::TableEdgeHdl( const Point& rPnt, bool bHorizontal, sal_Int32 nMin, sal_Int32 nMax, sal_Int32 nEdges )
+: SdrHdl( rPnt, HDL_USER )
+, mbHorizontal( bHorizontal )
+, mnMin( nMin )
+, mnMax( nMax )
+, maEdges(nEdges)
+{
+}
+
+void TableEdgeHdl::SetEdge( sal_Int32 nEdge, sal_Int32 nStart, sal_Int32 nEnd, TableEdgeState eState )
+{
+ if( (nEdge >= 0) && (nEdge <= sal::static_int_cast<sal_Int32>(maEdges.size())) )
+ {
+ maEdges[nEdge].mnStart = nStart;
+ maEdges[nEdge].mnEnd = nEnd;
+ maEdges[nEdge].meState = eState;
+ }
+ else
+ {
+ OSL_ENSURE( false, "sdr::table::TableEdgeHdl::SetEdge(), invalid edge!" );
+ }
+}
+
+Pointer TableEdgeHdl::GetPointer() const
+{
+ if( mbHorizontal )
+ return POINTER_VSPLIT;
+ else
+ return POINTER_HSPLIT;
+}
+
+sal_Int32 TableEdgeHdl::GetValidDragOffset( const SdrDragStat& rDrag ) const
+{
+ return std::min( std::max( static_cast<sal_Int32>(mbHorizontal ? rDrag.GetDY() : rDrag.GetDX()), mnMin ), mnMax );
+}
+
+basegfx::B2DPolyPolygon TableEdgeHdl::getSpecialDragPoly(const SdrDragStat& rDrag) const
+{
+ basegfx::B2DPolyPolygon aVisible;
+ basegfx::B2DPolyPolygon aInvisible;
+
+ // create and return visible and non-visible parts for drag
+ getPolyPolygon(aVisible, aInvisible, &rDrag);
+ aVisible.append(aInvisible);
+
+ return aVisible;
+}
+
+void TableEdgeHdl::getPolyPolygon(basegfx::B2DPolyPolygon& rVisible, basegfx::B2DPolyPolygon& rInvisible, const SdrDragStat* pDrag) const
+{
+ // 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 )
+ {
+ int n = mbHorizontal ? 1 : 0;
+ aOffset[n] = aOffset[n] + GetValidDragOffset( *pDrag );
+ }
+
+ basegfx::B2DPoint aStart(aOffset), aEnd(aOffset);
+ int nPos = mbHorizontal ? 0 : 1;
+ TableEdgeVector::const_iterator aIter( maEdges.begin() );
+
+ while( aIter != maEdges.end() )
+ {
+ TableEdge aEdge(*aIter++);
+
+ aStart[nPos] = aOffset[nPos] + aEdge.mnStart;
+ aEnd[nPos] = aOffset[nPos] + aEdge.mnEnd;
+
+ basegfx::B2DPolygon aPolygon;
+ aPolygon.append( aStart );
+ aPolygon.append( aEnd );
+
+ if(aEdge.meState == Visible)
+ {
+ rVisible.append(aPolygon);
+ }
+ else
+ {
+ rInvisible.append(aPolygon);
+ }
+ }
+}
+
+void TableEdgeHdl::CreateB2dIAObject()
+{
+ GetRidOfIAObject();
+
+ if(pHdlList && pHdlList->GetView() && !pHdlList->GetView()->areMarkHandlesHidden())
+ {
+ SdrMarkView* pView = pHdlList->GetView();
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(pPageView)
+ {
+ basegfx::B2DPolyPolygon aVisible;
+ basegfx::B2DPolyPolygon aInvisible;
+
+ // get visible and invisible parts
+ getPolyPolygon(aVisible, aInvisible, 0);
+
+ if(aVisible.count() || aInvisible.count())
+ {
+ for(sal_uInt32 nWindow = 0; nWindow < pPageView->PageWindowCount(); nWindow++)
+ {
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(nWindow);
+
+ 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);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+OverlayTableEdge::OverlayTableEdge( const basegfx::B2DPolyPolygon& rPolyPolygon, bool bVisible )
+: OverlayObject(Color(COL_GRAY))
+, maPolyPolygon( rPolyPolygon )
+, mbVisible(bVisible)
+{
+}
+
+OverlayTableEdge::~OverlayTableEdge()
+{
+}
+
+drawinglayer::primitive2d::Primitive2DSequence OverlayTableEdge::createOverlayObjectPrimitive2DSequence()
+{
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
+
+ if(maPolyPolygon.count())
+ {
+ // 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
+ {
+ // embed in HiddenGeometryPrimitive2D to support HitTest of this invisible
+ // overlay object
+ const drawinglayer::primitive2d::Primitive2DSequence aSequence(&aReference, 1);
+ const drawinglayer::primitive2d::Primitive2DReference aNewReference(
+ new drawinglayer::primitive2d::HiddenGeometryPrimitive2D(aSequence));
+ aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aNewReference, 1);
+ }
+ }
+
+ return aRetval;
+}
+
+// ====================================================================
+
+TableBorderHdl::TableBorderHdl( const Rectangle& rRect )
+: SdrHdl( rRect.TopLeft(), HDL_MOVE )
+, maRectangle( rRect )
+{
+
+}
+
+Pointer TableBorderHdl::GetPointer() const
+{
+ return POINTER_MOVE;
+}
+
+// create marker for this kind
+void TableBorderHdl::CreateB2dIAObject()
+{
+ GetRidOfIAObject();
+
+ if(pHdlList && pHdlList->GetView() && !pHdlList->GetView()->areMarkHandlesHidden())
+ {
+ SdrMarkView* pView = pHdlList->GetView();
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(pPageView)
+ {
+ for(sal_uInt32 nWindow = 0; nWindow < pPageView->PageWindowCount(); nWindow++)
+ {
+ // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b];
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(nWindow);
+
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
+ {
+ if(rPageWindow.GetOverlayManager())
+ {
+ 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);
+ }
+ }
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+} // end of namespace table
+} // end of namespace sdr
diff --git a/svx/source/table/tablehandles.hxx b/svx/source/table/tablehandles.hxx
new file mode 100644
index 000000000000..0704e94a84b7
--- /dev/null
+++ b/svx/source/table/tablehandles.hxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_TABLEHANDLES_HXX
+#define _SVX_TABLEHANDLES_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+
+#include <svx/svdhdl.hxx>
+
+// --------------------------------------------------------------------
+
+namespace sdr { namespace table {
+
+enum TableEdgeState { Empty, Invisible, Visible };
+
+struct TableEdge
+{
+ sal_Int32 mnStart;
+ sal_Int32 mnEnd;
+ TableEdgeState meState;
+
+ TableEdge() : mnStart(0), mnEnd(0), meState(Empty) {}
+};
+
+typedef std::vector< TableEdge > TableEdgeVector;
+
+class TableEdgeHdl : public SdrHdl
+{
+public:
+ TableEdgeHdl( const Point& rPnt, bool bHorizontal, sal_Int32 nMin, sal_Int32 nMax, sal_Int32 nEdges );
+
+ sal_Int32 GetValidDragOffset( const SdrDragStat& rDrag ) const;
+
+ virtual Pointer GetPointer() const;
+
+ void SetEdge( sal_Int32 nEdge, sal_Int32 nStart, sal_Int32 nEnd, TableEdgeState nState );
+
+ bool IsHorizontalEdge() const { return mbHorizontal; }
+
+ basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat& rDrag) const;
+ void getPolyPolygon(basegfx::B2DPolyPolygon& rVisible, basegfx::B2DPolyPolygon& rInvisible, const SdrDragStat* pDrag) const;
+
+protected:
+ // create marker for this kind
+ virtual void CreateB2dIAObject();
+
+private:
+ bool mbHorizontal;
+ sal_Int32 mnMin, mnMax;
+ TableEdgeVector maEdges;
+};
+
+class TableBorderHdl : public SdrHdl
+{
+public:
+ TableBorderHdl( const Rectangle& rRect );
+
+ virtual Pointer GetPointer() const;
+
+protected:
+ // create marker for this kind
+ virtual void CreateB2dIAObject();
+
+private:
+ Rectangle maRectangle;
+};
+
+} // end of namespace table
+} // end of namespace sdr
+
+#endif
diff --git a/svx/source/table/tablelayouter.cxx b/svx/source/table/tablelayouter.cxx
new file mode 100644
index 000000000000..643251100cbd
--- /dev/null
+++ b/svx/source/table/tablelayouter.cxx
@@ -0,0 +1,1300 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <com/sun/star/table/XMergeableCell.hpp>
+#include <com/sun/star/awt/XLayoutConstrains.hpp>
+#include <boost/bind.hpp>
+
+#include "cell.hxx"
+#include "cellrange.hxx"
+#include "tablemodel.hxx"
+#include "tablerow.hxx"
+#include "tablerows.hxx"
+#include "tablecolumn.hxx"
+#include "tablecolumns.hxx"
+#include "tablelayouter.hxx"
+#include "svx/svdotable.hxx"
+#include "editeng/borderline.hxx"
+#include "editeng/boxitem.hxx"
+#include "svx/svdmodel.hxx"
+#include "svx/svdstr.hrc"
+#include "svx/svdglob.hxx"
+
+using ::rtl::OUString;
+using ::com::sun::star::awt::XLayoutConstrains;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::text;
+
+// -----------------------------------------------------------------------------
+
+namespace sdr { namespace table {
+
+// -----------------------------------------------------------------------------
+
+static SvxBorderLine gEmptyBorder;
+
+// -----------------------------------------------------------------------------
+
+TableLayouter::TableLayouter( const TableModelRef& xTableModel )
+: mxTable( xTableModel )
+, meWritingMode( WritingMode_LR_TB )
+, msSize( RTL_CONSTASCII_USTRINGPARAM( "Size" ) )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+TableLayouter::~TableLayouter()
+{
+ ClearBorderLayout();
+}
+
+// -----------------------------------------------------------------------------
+
+basegfx::B2ITuple TableLayouter::getCellSize( const CellPos& rPos ) const
+{
+ sal_Int32 width = 0;
+ sal_Int32 height = 0;
+
+ try
+ {
+ CellRef xCell( getCell( rPos ) );
+ if( xCell.is() && !xCell->isMerged() )
+ {
+ CellPos aPos( rPos );
+
+ sal_Int32 nRowCount = getRowCount();
+ 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--;
+ }
+
+ sal_Int32 nColCount = getColumnCount();
+ 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--;
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "TableLayouter::getCellSize(), exception caught!" );
+ }
+
+ return basegfx::B2ITuple( width, height );
+}
+
+// -----------------------------------------------------------------------------
+
+bool TableLayouter::getCellArea( const CellPos& rPos, basegfx::B2IRectangle& rArea ) const
+{
+ try
+ {
+ CellRef xCell( getCell( rPos ) );
+ if( xCell.is() && !xCell->isMerged() && isValid(rPos) )
+ {
+ const basegfx::B2ITuple aCellSize( getCellSize( rPos ) );
+
+ 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;
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "TableLayouter::getCellSize(), exception caught!" );
+ }
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 TableLayouter::getRowHeight( sal_Int32 nRow )
+{
+ if( isValidRow(nRow) )
+ return maRows[nRow].mnSize;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+void TableLayouter::setRowHeight( sal_Int32 nRow, sal_Int32 nHeight )
+{
+ if( isValidRow(nRow) )
+ {
+ maRows[nRow].mnSize = nHeight;
+ }
+ else
+ {
+ DBG_ERROR( "TableLayouter::setRowHeight(), row out of range!" );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 TableLayouter::getColumnWidth( sal_Int32 nColumn )
+{
+ if( isValidColumn(nColumn) )
+ return maColumns[nColumn].mnSize;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+void TableLayouter::setColumnWidth( sal_Int32 nColumn, sal_Int32 nWidth )
+{
+ if( isValidColumn(nColumn) )
+ maColumns[nColumn].mnSize = nWidth;
+ else
+ DBG_ERROR( "TableLayouter::setColumnWidth(), column out of range!" );
+}
+
+// -----------------------------------------------------------------------------
+
+bool TableLayouter::isEdgeVisible( sal_Int32 nEdgeX, sal_Int32 nEdgeY, bool bHorizontal ) const
+{
+ const BorderLineMap& rMap = bHorizontal ? maHorizontalBorders : maVerticalBorders;
+
+ if( (nEdgeX >= 0) && (nEdgeX < sal::static_int_cast<sal_Int32>(rMap.size())) &&
+ (nEdgeY >= 0) && (nEdgeY < sal::static_int_cast<sal_Int32>(rMap[nEdgeX].size())) )
+ {
+ return rMap[nEdgeX][nEdgeY] != 0;
+ }
+ else
+ {
+ OSL_ENSURE( false, "sdr::table::TableLayouter::getBorderLine(), invalid edge!" );
+ }
+
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+
+/** returns the requested borderline in rpBorderLine or a null pointer if there is no border at this edge */
+SvxBorderLine* TableLayouter::getBorderLine( sal_Int32 nEdgeX, sal_Int32 nEdgeY, bool bHorizontal )const
+{
+ SvxBorderLine* pLine = 0;
+
+ const BorderLineMap& rMap = bHorizontal ? maHorizontalBorders : maVerticalBorders;
+
+ if( (nEdgeX >= 0) && (nEdgeX < sal::static_int_cast<sal_Int32>(rMap.size())) &&
+ (nEdgeY >= 0) && (nEdgeY < sal::static_int_cast<sal_Int32>(rMap[nEdgeX].size())) )
+ {
+ pLine = rMap[nEdgeX][nEdgeY];
+ if( pLine == &gEmptyBorder )
+ pLine = 0;
+ }
+ else
+ {
+ OSL_ENSURE( false, "sdr::table::TableLayouter::getBorderLine(), invalid edge!" );
+ }
+
+ return pLine;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 TableLayouter::getHorizontalEdge( int nEdgeY, sal_Int32* pnMin /*= 0*/, sal_Int32* pnMax /*= 0*/ )
+{
+ sal_Int32 nRet = 0;
+ if( (nEdgeY >= 0) && (nEdgeY <= getRowCount() ) )
+ nRet = maRows[std::min((sal_Int32)nEdgeY,getRowCount()-1)].mnPos;
+
+ if( nEdgeY == getRowCount() )
+ nRet += maRows[nEdgeY - 1].mnSize;
+
+ if( pnMin )
+ {
+ if( (nEdgeY > 0) && (nEdgeY <= getRowCount() ) )
+ {
+ *pnMin = maRows[nEdgeY-1].mnPos + 600; // todo
+ }
+ else
+ {
+ *pnMin = nRet;
+ }
+ }
+
+ if( pnMax )
+ {
+ *pnMax = 0x0fffffff;
+ }
+ return nRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 TableLayouter::getVerticalEdge( int nEdgeX, sal_Int32* pnMin /*= 0*/, sal_Int32* pnMax /*= 0*/ )
+{
+ sal_Int32 nRet = 0;
+
+ const sal_Int32 nColCount = getColumnCount();
+ if( (nEdgeX >= 0) && (nEdgeX <= nColCount ) )
+ nRet = maColumns[std::min((sal_Int32)nEdgeX,nColCount-1)].mnPos;
+
+ const bool bRTL = meWritingMode == WritingMode_RL_TB;
+ if( bRTL )
+ {
+ if( (nEdgeX >= 0) && (nEdgeX < nColCount) )
+ nRet += maColumns[nEdgeX].mnSize;
+ }
+ else
+ {
+ if( nEdgeX == getColumnCount() )
+ nRet += maColumns[nEdgeX - 1].mnSize;
+ }
+
+ if( pnMin )
+ {
+ *pnMin = nRet;
+ if( bRTL )
+ {
+ if( nEdgeX < nColCount )
+ *pnMin = nRet - maColumns[nEdgeX].mnSize + getMinimumColumnWidth(nEdgeX);
+ }
+ else
+ {
+ if( (nEdgeX > 0) && (nEdgeX <= nColCount ) )
+ *pnMin = maColumns[nEdgeX-1].mnPos + getMinimumColumnWidth( nEdgeX-1 );
+ }
+ }
+
+ if( pnMax )
+ {
+ *pnMax = 0x0fffffff; // todo
+ if( bRTL )
+ {
+ if( nEdgeX > 0 )
+ *pnMax = nRet + maColumns[nEdgeX-1].mnSize - getMinimumColumnWidth( nEdgeX-1 );
+ }
+ else
+ {
+ if( (nEdgeX >= 0) && (nEdgeX < nColCount ) )
+ *pnMax = maColumns[nEdgeX].mnPos + maColumns[nEdgeX].mnSize - getMinimumColumnWidth( nEdgeX );
+ }
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------------
+
+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.
+*/
+bool findMergeOrigin( const TableModelRef& xTable, sal_Int32 nMergedX, sal_Int32 nMergedY, sal_Int32& rOriginX, sal_Int32& rOriginY )
+{
+ rOriginX = nMergedX;
+ rOriginY = nMergedY;
+
+ if( xTable.is() ) try
+ {
+ // check if this cell already the origin or not merged at all
+ Reference< XMergeableCell > xCell( xTable->getCellByPosition( nMergedX, nMergedY ), UNO_QUERY_THROW );
+ if( !xCell.is() || !xCell->isMerged() )
+ return true;
+
+ bool bCheckVert = true;
+ bool bCheckHorz = true;
+
+ sal_Int32 nMinCol = 0;
+ sal_Int32 nMinRow = 0;
+
+ sal_Int32 nStep = 1, i;
+
+ sal_Int32 nRow, nCol;
+ do
+ {
+ if( bCheckVert )
+ {
+ 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
+ {
+ bCheckVert = false;
+ }
+ }
+
+ if( bCheckHorz )
+ {
+ nCol = nMergedX - nStep;
+ if( nCol >= nMinCol )
+ {
+ 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;
+ }
+ }
+ nStep++;
+ }
+ while( bCheckVert || bCheckHorz );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("sdr::table::TableLayouter::findMergeOrigin(), exception caught!");
+ }
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 TableLayouter::getMinimumColumnWidth( sal_Int32 nColumn )
+{
+ if( isValidColumn( nColumn ) )
+ {
+ return maColumns[nColumn].mnMinSize;
+ }
+ else
+ {
+ DBG_ERROR( "TableLayouter::getMinimumColumnWidth(), column out of range!" );
+ return 0;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 TableLayouter::distribute( LayoutVector& rLayouts, sal_Int32 nDistribute )
+{
+ // break loops after 100 runs to avoid freezing office due to developer error
+ sal_Int32 nSafe = 100;
+
+ const sal_Size nCount = rLayouts.size();
+ sal_Size nIndex;
+
+ bool bConstrainsBroken = false;
+
+ do
+ {
+ // first enforce minimum size constrains on all entities
+ for( nIndex = 0; nIndex < nCount; ++nIndex )
+ {
+ Layout& rLayout = rLayouts[nIndex];
+ if( rLayout.mnSize < rLayout.mnMinSize )
+ {
+ nDistribute -= rLayout.mnMinSize - rLayout.mnSize;
+ rLayout.mnSize = rLayout.mnMinSize;
+ }
+ }
+
+ // calculate current width
+ // if nDistribute is < 0 (shrinking), entities that are already
+ // at minimum width are not counted
+ sal_Int32 nCurrentWidth = 0;
+ for( nIndex = 0; nIndex < nCount; ++nIndex )
+ {
+ Layout& rLayout = rLayouts[nIndex];
+ if( (nDistribute > 0) || (rLayout.mnSize > rLayout.mnMinSize) )
+ nCurrentWidth += rLayout.mnSize;
+ }
+
+ bConstrainsBroken = false;
+
+ // now distribute over entities
+ if( (nCurrentWidth != 0) && (nDistribute != 0) )
+ {
+ sal_Int32 nDistributed = nDistribute;
+ for( nIndex = 0; nIndex < nCount; ++nIndex )
+ {
+ Layout& rLayout = rLayouts[nIndex];
+ if( (nDistribute > 0) || (rLayout.mnSize > rLayout.mnMinSize) )
+ {
+ sal_Int32 n;
+ if( nIndex == (nCount-1) )
+ n = nDistributed; // for last entitie, use up rest
+ else
+ n = (nDistribute * rLayout.mnSize) / nCurrentWidth; //
+
+ nDistributed -= n;
+ rLayout.mnSize += n;
+
+ if( rLayout.mnSize < rLayout.mnMinSize )
+ bConstrainsBroken = true;
+ }
+ }
+ }
+ } while( bConstrainsBroken && --nSafe );
+
+ sal_Int32 nSize = 0;
+ for( nIndex = 0; nIndex < nCount; ++nIndex )
+ nSize += rLayouts[nIndex].mnSize;
+
+ return nSize;
+}
+
+// -----------------------------------------------------------------------------
+
+typedef std::vector< CellRef > MergeableCellVector;
+typedef std::vector< MergeableCellVector > MergeVector;
+typedef std::vector< sal_Int32 > Int32Vector;
+
+// -----------------------------------------------------------------------------
+
+void TableLayouter::LayoutTableWidth( Rectangle& rArea, bool bFit )
+{
+ const sal_Int32 nColCount = getColumnCount();
+ const sal_Int32 nRowCount = getRowCount();
+ if( nColCount == 0 )
+ return;
+
+ MergeVector aMergedCells( nColCount );
+ Int32Vector aOptimalColumns;
+
+ const OUString sOptimalSize( RTL_CONSTASCII_USTRINGPARAM("OptimalSize") );
+
+ if( sal::static_int_cast< sal_Int32 >( maColumns.size() ) != nColCount )
+ maColumns.resize( nColCount );
+
+ Reference< XTableColumns > xCols( mxTable->getColumns(), UNO_QUERY_THROW );
+
+ // first calculate current width and initial minimum width per column,
+ // merged cells will be counted later
+ sal_Int32 nCurrentWidth = 0;
+ sal_Int32 nCol = 0, nRow = 0;
+ for( nCol = 0; nCol < nColCount; nCol++ )
+ {
+ sal_Int32 nMinWidth = 0;
+
+ bool bIsEmpty = true; // check if all cells in this column are merged
+
+ for( nRow = 0; nRow < nRowCount; ++nRow )
+ {
+ CellRef xCell( getCell( CellPos( nCol, nRow ) ) );
+ if( xCell.is() && !xCell->isMerged() )
+ {
+ bIsEmpty = false;
+
+ sal_Int32 nColSpan = xCell->getColumnSpan();
+ if( nColSpan > 1 )
+ {
+ // merged cells will be evaluated later
+ aMergedCells[nCol+nColSpan-1].push_back( xCell );
+ }
+ else
+ {
+ nMinWidth = std::max( nMinWidth, xCell->getMinimumSize().Width );
+ }
+ }
+ }
+
+ maColumns[nCol].mnMinSize = nMinWidth;
+
+ if( bIsEmpty )
+ {
+ maColumns[nCol].mnSize = 0;
+ }
+ else
+ {
+ sal_Int32 nColWidth = 0;
+ Reference< XPropertySet > xColSet( xCols->getByIndex( nCol ), UNO_QUERY_THROW );
+ sal_Bool bOptimal = sal_False;
+ xColSet->getPropertyValue( sOptimalSize ) >>= bOptimal;
+ if( bOptimal )
+ {
+ aOptimalColumns.push_back(nCol);
+ }
+ else
+ {
+ xColSet->getPropertyValue( msSize ) >>= nColWidth;
+ }
+
+ maColumns[nCol].mnSize = nColWidth;
+
+ if( maColumns[nCol].mnSize < nMinWidth )
+ maColumns[nCol].mnSize = nMinWidth;
+
+ nCurrentWidth += maColumns[nCol].mnSize;
+ }
+ }
+
+ // if we have optimal sized rows, distribute what is given (left)
+ if( !bFit && !aOptimalColumns.empty() && (nCurrentWidth < rArea.getWidth()) )
+ {
+ sal_Int32 nLeft = rArea.getWidth() - nCurrentWidth;
+ sal_Int32 nDistribute = nLeft / aOptimalColumns.size();
+
+ Int32Vector::iterator iter( aOptimalColumns.begin() );
+ while( iter != aOptimalColumns.end() )
+ {
+ sal_Int32 nOptCol = (*iter++);
+ if( iter == aOptimalColumns.end() )
+ nDistribute = nLeft;
+
+ maColumns[nOptCol].mnSize += nDistribute;
+ nLeft -= nDistribute;
+ }
+
+ DBG_ASSERT( nLeft == 0, "svx::TableLayouter::LayoutTableWidtht(), layouting failed!" );
+ }
+
+ // now check if merged cells fit
+ for( nCol = 1; nCol < nColCount; ++nCol )
+ {
+ bool bChanges = false;
+ MergeableCellVector::iterator iter( aMergedCells[nCol].begin() );
+
+ const sal_Int32 nOldSize = maColumns[nCol].mnSize;
+
+ while( iter != aMergedCells[nCol].end() )
+ {
+ CellRef xCell( (*iter++) );
+ sal_Int32 nMinWidth = xCell->getMinimumSize().Width;
+
+ for( sal_Int32 nMCol = nCol - xCell->getColumnSpan() + 1; (nMCol > 0) && (nMCol < nCol); ++nMCol )
+ nMinWidth -= maColumns[nMCol].mnSize;
+
+ if( nMinWidth > maColumns[nCol].mnMinSize )
+ maColumns[nCol].mnMinSize = nMinWidth;
+
+ if( nMinWidth > maColumns[nCol].mnSize )
+ {
+ maColumns[nCol].mnSize = nMinWidth;
+ bChanges = true;
+ }
+ }
+
+ if( bChanges )
+ nCurrentWidth += maColumns[nCol].mnSize - nOldSize;
+ }
+
+ // now scale if wanted and needed
+ if( bFit && (nCurrentWidth != rArea.getWidth()) )
+ distribute( maColumns, rArea.getWidth() - nCurrentWidth );
+
+ // last step, update left edges
+ sal_Int32 nNewWidth = 0;
+
+ const bool bRTL = meWritingMode == WritingMode_RL_TB;
+ RangeIterator<sal_Int32> coliter( 0, nColCount, !bRTL );
+ while( coliter.next(nCol ) )
+ {
+ maColumns[nCol].mnPos = nNewWidth;
+ nNewWidth += maColumns[nCol].mnSize;
+ if( bFit )
+ {
+ Reference< XPropertySet > xColSet( xCols->getByIndex(nCol), UNO_QUERY_THROW );
+ xColSet->setPropertyValue( msSize, Any( maColumns[nCol].mnSize ) );
+ }
+ }
+
+ rArea.SetSize( Size( nNewWidth, rArea.GetHeight() ) );
+ updateCells( rArea );
+}
+
+// -----------------------------------------------------------------------------
+
+void TableLayouter::LayoutTableHeight( Rectangle& rArea, bool bFit )
+{
+ const sal_Int32 nColCount = getColumnCount();
+ const sal_Int32 nRowCount = getRowCount();
+ if( nRowCount == 0 )
+ return;
+
+ Reference< XTableRows > xRows( mxTable->getRows() );
+
+ MergeVector aMergedCells( nRowCount );
+ Int32Vector aOptimalRows;
+
+ const OUString sOptimalSize( RTL_CONSTASCII_USTRINGPARAM("OptimalSize") );
+
+ // first calculate current height and initial minimum size per column,
+ // merged cells will be counted later
+ sal_Int32 nCurrentHeight = 0;
+ sal_Int32 nCol, nRow;
+ for( nRow = 0; nRow < nRowCount; ++nRow )
+ {
+ sal_Int32 nMinHeight = 0;
+
+ bool bIsEmpty = true; // check if all cells in this row are merged
+
+ for( nCol = 0; nCol < nColCount; ++nCol )
+ {
+ CellRef xCell( getCell( CellPos( nCol, nRow ) ) );
+ if( xCell.is() && !xCell->isMerged() )
+ {
+ bIsEmpty = false;
+
+ sal_Int32 nRowSpan = xCell->getRowSpan();
+ if( nRowSpan > 1 )
+ {
+ // merged cells will be evaluated later
+ aMergedCells[nRow+nRowSpan-1].push_back( xCell );
+ }
+ else
+ {
+ nMinHeight = std::max( nMinHeight, xCell->getMinimumSize().Height );
+ }
+ }
+ }
+
+ maRows[nRow].mnMinSize = nMinHeight;
+
+ if( bIsEmpty )
+ {
+ maRows[nRow].mnSize = 0;
+ }
+ else
+ {
+ sal_Int32 nRowHeight = 0;
+ Reference< XPropertySet > xRowSet( xRows->getByIndex(nRow), UNO_QUERY_THROW );
+
+ sal_Bool bOptimal = sal_False;
+ xRowSet->getPropertyValue( sOptimalSize ) >>= bOptimal;
+ if( bOptimal )
+ {
+ aOptimalRows.push_back( nRow );
+ }
+ else
+ {
+ xRowSet->getPropertyValue( msSize ) >>= nRowHeight;
+ }
+
+ maRows[nRow].mnSize = nRowHeight;
+
+ if( maRows[nRow].mnSize < nMinHeight )
+ maRows[nRow].mnSize = nMinHeight;
+
+ nCurrentHeight += maRows[nRow].mnSize;
+ }
+ }
+
+ // if we have optimal sized rows, distribute what is given (left)
+ if( !bFit && !aOptimalRows.empty() && (nCurrentHeight < rArea.getHeight()) )
+ {
+ sal_Int32 nLeft = rArea.getHeight() - nCurrentHeight;
+ sal_Int32 nDistribute = nLeft / aOptimalRows.size();
+
+ Int32Vector::iterator iter( aOptimalRows.begin() );
+ while( iter != aOptimalRows.end() )
+ {
+ sal_Int32 nOptRow = (*iter++);
+ if( iter == aOptimalRows.end() )
+ nDistribute = nLeft;
+
+ maRows[nOptRow].mnSize += nDistribute;
+ nLeft -= nDistribute;
+
+ }
+
+ DBG_ASSERT( nLeft == 0, "svx::TableLayouter::LayoutTableHeight(), layouting failed!" );
+ }
+
+ // now check if merged cells fit
+ for( nRow = 1; nRow < nRowCount; ++nRow )
+ {
+ bool bChanges = false;
+ sal_Int32 nOldSize = maRows[nRow].mnSize;
+
+ MergeableCellVector::iterator iter( aMergedCells[nRow].begin() );
+ while( iter != aMergedCells[nRow].end() )
+ {
+ CellRef xCell( (*iter++) );
+ sal_Int32 nMinHeight = xCell->getMinimumSize().Height;
+
+ for( sal_Int32 nMRow = nRow - xCell->getRowSpan() + 1; (nMRow > 0) && (nMRow < nRow); ++nMRow )
+ nMinHeight -= maRows[nMRow].mnSize;
+
+ if( nMinHeight > maRows[nRow].mnMinSize )
+ maRows[nRow].mnMinSize = nMinHeight;
+
+ if( nMinHeight > maRows[nRow].mnSize )
+ {
+ maRows[nRow].mnSize = nMinHeight;
+ bChanges = true;
+ }
+ }
+ if( bChanges )
+ nCurrentHeight += maRows[nRow].mnSize - nOldSize;
+ }
+
+ // now scale if wanted and needed
+ if( bFit && nCurrentHeight != rArea.getHeight() )
+ distribute( maRows, rArea.getHeight() - nCurrentHeight );
+
+ // last step, update left edges
+ sal_Int32 nNewHeight = 0;
+ for( nRow = 0; nRow < nRowCount; ++nRow )
+ {
+ maRows[nRow].mnPos = nNewHeight;
+ nNewHeight += maRows[nRow].mnSize;
+
+ if( bFit )
+ {
+ Reference< XPropertySet > xRowSet( xRows->getByIndex(nRow), UNO_QUERY_THROW );
+ xRowSet->setPropertyValue( msSize, Any( maRows[nRow].mnSize ) );
+ }
+ }
+
+ rArea.SetSize( Size( rArea.GetWidth(), nNewHeight ) );
+ updateCells( rArea );
+}
+
+// -----------------------------------------------------------------------------
+
+/** try to fit the table into the given rectangle.
+ If the rectangle is to small, it will be grown to fit the table. */
+void TableLayouter::LayoutTable( Rectangle& rRectangle, bool bFitWidth, bool bFitHeight )
+{
+ if( !mxTable.is() )
+ return;
+
+ const sal_Int32 nRowCount = mxTable->getRowCount();
+ const sal_Int32 nColCount = mxTable->getColumnCount();
+
+ if( (nRowCount != getRowCount()) || (nColCount != getColumnCount()) )
+ {
+ if( static_cast< sal_Int32 >( maRows.size() ) != nRowCount )
+ maRows.resize( nRowCount );
+
+ Reference< XTableRows > xRows( mxTable->getRows() );
+ for( sal_Int32 nRow = 0; nRow < nRowCount; nRow++ )
+ maRows[nRow].clear();
+
+ if( static_cast< sal_Int32 >( maColumns.size() ) != nColCount )
+ maColumns.resize( nColCount );
+
+ for( sal_Int32 nCol = 0; nCol < nColCount; nCol++ )
+ maColumns[nCol].clear();
+ }
+
+ LayoutTableWidth( rRectangle, bFitWidth );
+ LayoutTableHeight( rRectangle, bFitHeight );
+ UpdateBorderLayout();
+}
+
+// -----------------------------------------------------------------------------
+
+void TableLayouter::updateCells( Rectangle& rRectangle )
+{
+ const sal_Int32 nColCount = getColumnCount();
+ const sal_Int32 nRowCount = getRowCount();
+
+ CellPos aPos;
+ for( aPos.mnRow = 0; aPos.mnRow < nRowCount; aPos.mnRow++ )
+ {
+ for( aPos.mnCol = 0; aPos.mnCol < nColCount; aPos.mnCol++ )
+ {
+ CellRef xCell( getCell( aPos ) );
+ if( xCell.is() )
+ {
+ basegfx::B2IRectangle aCellArea;
+ getCellArea( aPos, aCellArea );
+
+ Rectangle aCellRect;
+ aCellRect.nLeft = aCellArea.getMinX();
+ aCellRect.nRight = aCellArea.getMaxX();
+ aCellRect.nTop = aCellArea.getMinY();
+ aCellRect.nBottom = aCellArea.getMaxY();
+ aCellRect.Move( rRectangle.nLeft, rRectangle.nTop );
+ xCell->setCellRect( aCellRect );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+CellRef TableLayouter::getCell( const CellPos& rPos ) const
+{
+ CellRef xCell;
+ if( mxTable.is() ) try
+ {
+ xCell.set( dynamic_cast< Cell* >( mxTable->getCellByPosition( rPos.mnCol, rPos.mnRow ).get() ) );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "sdr::table::TableLayouter::getCell(), exception caught!" );
+ }
+ return xCell;
+}
+
+// -----------------------------------------------------------------------------
+
+bool TableLayouter::HasPriority( const SvxBorderLine* pThis, const SvxBorderLine* pOther )
+{
+ if (!pThis || ((pThis == &gEmptyBorder) && (pOther != 0)))
+ return false;
+ if (!pOther || (pOther == &gEmptyBorder))
+ return true;
+
+ sal_uInt16 nThisSize = pThis->GetOutWidth() + pThis->GetDistance() + pThis->GetInWidth();
+ sal_uInt16 nOtherSize = pOther->GetOutWidth() + pOther->GetDistance() + pOther->GetInWidth();
+
+ if (nThisSize > nOtherSize)
+ return true;
+
+ else if (nThisSize < nOtherSize)
+ {
+ return false;
+ }
+ else
+ {
+ if ( pOther->GetInWidth() && !pThis->GetInWidth() )
+ {
+ return true;
+ }
+ else if ( pThis->GetInWidth() && !pOther->GetInWidth() )
+ {
+ return false;
+ }
+ else
+ {
+ return true; //! ???
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void TableLayouter::SetBorder( sal_Int32 nCol, sal_Int32 nRow, bool bHorizontal, const SvxBorderLine* pLine )
+{
+ if( pLine == 0 )
+ pLine = &gEmptyBorder;
+
+ SvxBorderLine *pOld = bHorizontal ? maHorizontalBorders[nCol][nRow] : maVerticalBorders[nCol][nRow];
+
+ if( HasPriority( pLine, pOld ) )
+ {
+ if( (pOld != 0) && (pOld != &gEmptyBorder) )
+ delete pOld;
+
+ SvxBorderLine* pNew = ( pLine != &gEmptyBorder ) ? new SvxBorderLine(*pLine) : &gEmptyBorder;
+
+ if( bHorizontal )
+ maHorizontalBorders[nCol][nRow] = pNew;
+ else
+ maVerticalBorders[nCol][nRow] = pNew;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void TableLayouter::ClearBorderLayout()
+{
+ ClearBorderLayout(maHorizontalBorders);
+ ClearBorderLayout(maVerticalBorders);
+}
+
+// -----------------------------------------------------------------------------
+
+void TableLayouter::ClearBorderLayout(BorderLineMap& rMap)
+{
+ const sal_Int32 nColCount = rMap.size();
+
+ for( sal_Int32 nCol = 0; nCol < nColCount; nCol++ )
+ {
+ const sal_Int32 nRowCount = rMap[nCol].size();
+ for( sal_Int32 nRow = 0; nRow < nRowCount; nRow++ )
+ {
+ SvxBorderLine* pLine = rMap[nCol][nRow];
+ if( pLine )
+ {
+ if( pLine != &gEmptyBorder )
+ delete pLine;
+
+ rMap[nCol][nRow] = 0;
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void TableLayouter::ResizeBorderLayout()
+{
+ ClearBorderLayout();
+ ResizeBorderLayout(maHorizontalBorders);
+ ResizeBorderLayout(maVerticalBorders);
+}
+
+// -----------------------------------------------------------------------------
+
+void TableLayouter::ResizeBorderLayout( BorderLineMap& rMap )
+{
+ const sal_Int32 nColCount = getColumnCount() + 1;
+ const sal_Int32 nRowCount = getRowCount() + 1;
+
+ if( sal::static_int_cast<sal_Int32>(rMap.size()) != nColCount )
+ rMap.resize( nColCount );
+
+ for( sal_Int32 nCol = 0; nCol < nColCount; nCol++ )
+ {
+ if( sal::static_int_cast<sal_Int32>(rMap[nCol].size()) != nRowCount )
+ rMap[nCol].resize( nRowCount );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void TableLayouter::UpdateBorderLayout()
+{
+ // make sure old border layout is cleared and border maps have correct size
+ ResizeBorderLayout();
+
+ const sal_Int32 nColCount = getColumnCount();
+ const sal_Int32 nRowCount = getRowCount();
+
+ CellPos aPos;
+ for( aPos.mnRow = 0; aPos.mnRow < nRowCount; aPos.mnRow++ )
+ {
+ for( aPos.mnCol = 0; aPos.mnCol < nColCount; aPos.mnCol++ )
+ {
+ CellRef xCell( getCell( aPos ) );
+ if( !xCell.is() || xCell->isMerged() )
+ continue;
+
+ const SvxBoxItem* pThisAttr = (const SvxBoxItem*)xCell->GetItemSet().GetItem( SDRATTR_TABLE_BORDER );
+ OSL_ENSURE(pThisAttr,"sdr::table::TableLayouter::UpdateBorderLayout(), no border attribute?");
+
+ if( !pThisAttr )
+ continue;
+
+ const sal_Int32 nLastRow = xCell->getRowSpan() + aPos.mnRow;
+ const sal_Int32 nLastCol = xCell->getColumnSpan() + aPos.mnCol;
+
+ for( sal_Int32 nRow = aPos.mnRow; nRow < nLastRow; nRow++ )
+ {
+ SetBorder( aPos.mnCol, nRow, false, pThisAttr->GetLeft() );
+ SetBorder( nLastCol, nRow, false, pThisAttr->GetRight() );
+ }
+
+ for( sal_Int32 nCol = aPos.mnCol; nCol < nLastCol; nCol++ )
+ {
+ SetBorder( nCol, aPos.mnRow, true, pThisAttr->GetTop() );
+ SetBorder( nCol, nLastRow, true, pThisAttr->GetBottom() );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+/*
+void TableLayouter::SetLayoutToModel()
+{
+ const sal_Int32 nRowCount = getRowCount();
+ const sal_Int32 nColCount = getColumnCount();
+
+ try
+ {
+ sal_Int32 nOldSize = 0;
+
+ Reference< XIndexAccess > xRows( mxTable->getRows(), UNO_QUERY_THROW );
+ for( sal_Int32 nRow = 0; nRow < nRowCount; nRow++ )
+ {
+ Reference< XPropertySet > xRowSet( xRows->getByIndex( nRow ), UNO_QUERY_THROW );
+ xRowSet->getPropertyValue( msSize ) >>= nOldSize;
+ if( maRows[nRow].mnSize != nOldSize )
+ xRowSet->setPropertyValue( msSize, Any( maRows[nRow].mnSize ) );
+ }
+
+ for( sal_Int32 nCol = 0; nCol < nColCount; nCol++ )
+ {
+ Reference< XPropertySet > xColSet( getColumnByIndex( nCol ), UNO_QUERY_THROW );
+ xColSet->getPropertyValue( msSize ) >>= nOldSize;
+ if( maColumns[nCol].mnSize != nOldSize )
+ xColSet->setPropertyValue( msSize, Any( maColumns[nCol].mnSize ) );
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("sdr::table::TableLayouter::SetLayoutToModel(), exception caught!");
+ }
+}
+*/
+// -----------------------------------------------------------------------------
+
+void TableLayouter::DistributeColumns( ::Rectangle& rArea, sal_Int32 nFirstCol, sal_Int32 nLastCol )
+{
+ if( mxTable.is() ) try
+ {
+ const sal_Int32 nColCount = getColumnCount();
+
+ if( (nFirstCol < 0) || (nFirstCol>= nLastCol) || (nLastCol >= nColCount) )
+ return;
+
+ sal_Int32 nAllWidth = 0;
+ for( sal_Int32 nCol = nFirstCol; nCol <= nLastCol; ++nCol )
+ nAllWidth += getColumnWidth(nCol);
+
+ sal_Int32 nWidth = nAllWidth / (nLastCol-nFirstCol+1);
+
+ Reference< XTableColumns > xCols( mxTable->getColumns(), UNO_QUERY_THROW );
+
+ for( sal_Int32 nCol = nFirstCol; nCol <= nLastCol; ++nCol )
+ {
+ if( nCol == nLastCol )
+ nWidth = nAllWidth; // last column get round errors
+
+ Reference< XPropertySet > xColSet( xCols->getByIndex( nCol ), UNO_QUERY_THROW );
+ xColSet->setPropertyValue( msSize, Any( nWidth ) );
+
+ nAllWidth -= nWidth;
+ }
+
+ LayoutTable( rArea, true, false );
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ DBG_ERROR("sdr::table::TableLayouter::DistributeColumns(), exception caught!");
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void TableLayouter::DistributeRows( ::Rectangle& rArea, sal_Int32 nFirstRow, sal_Int32 nLastRow )
+{
+ if( mxTable.is() ) try
+ {
+ const sal_Int32 nRowCount = mxTable->getRowCount();
+
+ if( (nFirstRow < 0) || (nFirstRow>= nLastRow) || (nLastRow >= nRowCount) )
+ return;
+
+ sal_Int32 nAllHeight = 0;
+ sal_Int32 nMinHeight = 0;
+
+ for( sal_Int32 nRow = nFirstRow; nRow <= nLastRow; ++nRow )
+ {
+ nMinHeight = std::max( maRows[nRow].mnMinSize, nMinHeight );
+ nAllHeight += maRows[nRow].mnSize;
+ }
+
+ const sal_Int32 nRows = (nLastRow-nFirstRow+1);
+ sal_Int32 nHeight = nAllHeight / nRows;
+
+ if( nHeight < nMinHeight )
+ {
+ sal_Int32 nNeededHeight = nRows * nMinHeight;
+ rArea.nBottom += nNeededHeight - nAllHeight;
+ nHeight = nMinHeight;
+ nAllHeight = nRows * nMinHeight;
+ }
+
+ Reference< XTableRows > xRows( mxTable->getRows(), UNO_QUERY_THROW );
+ for( sal_Int32 nRow = nFirstRow; nRow <= nLastRow; ++nRow )
+ {
+ if( nRow == nLastRow )
+ nHeight = nAllHeight; // last row get round errors
+
+ Reference< XPropertySet > xRowSet( xRows->getByIndex( nRow ), UNO_QUERY_THROW );
+ xRowSet->setPropertyValue( msSize, Any( nHeight ) );
+
+ nAllHeight -= nHeight;
+ }
+
+ LayoutTable( rArea, false, true );
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ DBG_ERROR("sdr::table::TableLayouter::DistributeRows(), exception caught!");
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void TableLayouter::SetWritingMode( com::sun::star::text::WritingMode eWritingMode )
+{
+ meWritingMode = eWritingMode;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 TableLayouter::getColumnStart( sal_Int32 nColumn ) const
+{
+ if( isValidColumn(nColumn) )
+ return maColumns[nColumn].mnPos;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 TableLayouter::getRowStart( sal_Int32 nRow ) const
+{
+ if( isValidRow(nRow) )
+ return maRows[nRow].mnPos;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+/*
+sal_Int32 TableLayouter::detectInsertedOrRemovedRows()
+{
+ sal_Int32 nHeightChange = 0;
+
+ try
+ {
+ Reference< XIndexAccess > xRows( mxTable->getRows(), UNO_QUERY_THROW );
+ std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >::iterator oldIter( mxRows.begin() );
+ sal_Int32 nCount = xRows->getCount();
+ for( sal_Int32 nRow = 0; nRow < nCount; nRow++ )
+ {
+ Reference< XInterface > xRow( xRows->getByIndex(nRow), UNO_QUERY );
+
+ std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >::iterator searchIter = mxRows.end();
+ if( oldIter != mxRows.end() )
+ searchIter = std::find( oldIter,mxRows.end(), xRow );
+
+ if( searchIter == mxRows.end() )
+ {
+ // new row
+ Reference< XPropertySet > xSet( xRow, UNO_QUERY_THROW );
+ sal_Int32 nSize = 0;
+ xSet->getPropertyValue( msSize ) >>= nSize;
+ nHeightChange += nSize;
+ }
+ else if( searchIter == oldIter )
+ {
+ // no change
+ oldIter++;
+ }
+ else
+ {
+ // rows removed
+ do
+ {
+ Reference< XPropertySet > xSet( (*oldIter), UNO_QUERY_THROW );
+ sal_Int32 nSize = 0;
+ xSet->getPropertyValue( msSize ) >>= nSize;
+ nHeightChange -= nSize;
+ }
+ while( oldIter++ != searchIter );
+ }
+ }
+
+ while( oldIter != mxRows.end() )
+ {
+ // rows removed
+ Reference< XPropertySet > xSet( (*oldIter++), UNO_QUERY_THROW );
+ sal_Int32 nSize = 0;
+ xSet->getPropertyValue( msSize ) >>= nSize;
+ nHeightChange -= nSize;
+ }
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ DBG_ERROR("svx::TableLayouter::detectInsertedOrRemovedRows(), exception caught!");
+ }
+
+ return nHeightChange;
+}
+*/
+
+// -----------------------------------------------------------------------------
+
+} }
diff --git a/svx/source/table/tablelayouter.hxx b/svx/source/table/tablelayouter.hxx
new file mode 100644
index 000000000000..9c56aafb556f
--- /dev/null
+++ b/svx/source/table/tablelayouter.hxx
@@ -0,0 +1,178 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_TABLE_TABLELAYOUTER_HXX_
+#define _SVX_TABLE_TABLELAYOUTER_HXX_
+
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/text/WritingMode.hpp>
+#include <com/sun/star/table/XTable.hpp>
+#include <basegfx/range/b2irectangle.hxx>
+#include <basegfx/tuple/b2ituple.hxx>
+#include <tools/gen.hxx>
+#include <boost/shared_ptr.hpp>
+#include <vector>
+#include <map>
+
+#include "svx/svdotable.hxx"
+
+// -----------------------------------------------------------------------------
+
+class SvxBorderLine;
+
+namespace sdr { namespace table {
+
+/** returns true if the cell(nMergedCol,nMergedRow) is merged with other cells.
+ the returned cell( rOriginCol, rOriginRow ) is the origin( top left cell ) of the merge.
+*/
+bool findMergeOrigin( const TableModelRef& xTable, sal_Int32 nMergedCol, sal_Int32 nMergedRow, sal_Int32& rOriginCol, sal_Int32& rOriginRow );
+
+typedef std::vector< SvxBorderLine* > BorderLineVector;
+typedef std::vector< BorderLineVector > BorderLineMap;
+
+// -----------------------------------------------------------------------------
+// TableModel
+// -----------------------------------------------------------------------------
+
+class TableLayouter
+{
+public:
+ TableLayouter( const TableModelRef& xTableModel );
+ virtual ~TableLayouter();
+
+ /** this checks if new rows are inserted or old rows where removed.
+ This can be used to grow or shrink the table shape in this case.
+ @returns
+ the height difference
+ sal_Int32 detectInsertedOrRemovedRows();
+ */
+
+ /** try to fit the table into the given rectangle.
+ If the rectangle is to small, it will be grown to fit the table.
+
+ if bFitWidth or bFitHeight is set, the layouter tries to scale
+ the rows and/or columns to the given area. The result my be bigger
+ to fullfill constrains.
+
+ if bFitWidth or bFitHeight is set, the model is changed.
+ */
+ void LayoutTable( ::Rectangle& rRectangle, bool bFitWidth, bool bFitHeight );
+
+ /** after a call to LayoutTable, this method can be used to set the new
+ column and row sizes back to the model. */
+// void SetLayoutToModel();
+
+ void UpdateBorderLayout();
+
+ basegfx::B2ITuple getCellSize( const CellPos& rPos ) const;
+ bool getCellArea( const CellRef& xCell, basegfx::B2IRectangle& rArea ) const;
+ bool getCellArea( const CellPos& rPos, basegfx::B2IRectangle& rArea ) const;
+
+ ::sal_Int32 getRowCount() const { return static_cast< ::sal_Int32 >( maRows.size() ); }
+ ::sal_Int32 getColumnCount() const { return static_cast< ::sal_Int32 >( maColumns.size() ); }
+
+ sal_Int32 getRowHeight( sal_Int32 nRow );
+
+ // sets the layout height of the given row hard, LayoutTable must be called directly after calling this method! */
+ void setRowHeight( sal_Int32 nRow, sal_Int32 nHeight );
+
+ sal_Int32 getColumnWidth( sal_Int32 nColumn );
+
+ // sets the layout width of the given column hard, LayoutTable must be called directly after calling this method! */
+ void setColumnWidth( sal_Int32 nColumn, sal_Int32 nWidth );
+
+ sal_Int32 getMinimumColumnWidth( sal_Int32 nColumn );
+
+ sal_Int32 getColumnStart( sal_Int32 nColumn ) const;
+ sal_Int32 getRowStart( sal_Int32 nRow ) const;
+
+ /** checks if the given edge is visible.
+ Edges between merged cells are not visible.
+ */
+ bool isEdgeVisible( sal_Int32 nEdgeX, sal_Int32 nEdgeY, bool bHorizontal ) const;
+
+ /** returns the requested borderline in rpBorderLine or a null pointer if there is no border at this edge */
+ SvxBorderLine* getBorderLine( sal_Int32 nEdgeX, sal_Int32 nEdgeY, bool bHorizontal )const;
+
+ void updateCells( ::Rectangle& rRectangle );
+
+ sal_Int32 getHorizontalEdge( int nEdgeY, sal_Int32* pnMin = 0, sal_Int32* pnMax = 0 );
+ sal_Int32 getVerticalEdge( int nEdgeX , sal_Int32* pnMin = 0, sal_Int32* pnMax = 0);
+
+ void DistributeColumns( ::Rectangle& rArea, sal_Int32 nFirstCol, sal_Int32 nLastCol );
+ void DistributeRows( ::Rectangle& rArea, sal_Int32 nFirstRow, sal_Int32 nLastRow );
+
+ com::sun::star::text::WritingMode GetWritingMode() const { return meWritingMode; }
+ void SetWritingMode( com::sun::star::text::WritingMode eWritingMode );
+
+private:
+ CellRef getCell( const CellPos& rPos ) const;
+
+ void LayoutTableWidth( ::Rectangle& rArea, bool bFit );
+ void LayoutTableHeight( ::Rectangle& rArea, bool bFit );
+
+ inline bool isValidColumn( sal_Int32 nColumn ) const { return (nColumn >= 0) && (nColumn < static_cast<sal_Int32>( maColumns.size())); }
+ inline bool isValidRow( sal_Int32 nRow ) const { return (nRow >= 0) && (nRow < static_cast<sal_Int32>( maRows.size())); }
+ inline bool isValid( const CellPos& rPos ) const { return isValidColumn( rPos.mnCol ) && isValidRow( rPos.mnRow ); }
+
+ void ClearBorderLayout();
+ void ClearBorderLayout(BorderLineMap& rMap);
+ void ResizeBorderLayout();
+ void ResizeBorderLayout( BorderLineMap& rMap );
+
+ void SetBorder( sal_Int32 nCol, sal_Int32 nRow, bool bHorizontal, const SvxBorderLine* pLine );
+
+ static bool HasPriority( const SvxBorderLine* pThis, const SvxBorderLine* pOther );
+
+ struct Layout
+ {
+ sal_Int32 mnPos;
+ sal_Int32 mnSize;
+ sal_Int32 mnMinSize;
+
+ Layout() : mnPos( 0 ), mnSize( 0 ), mnMinSize( 0 ) {}
+ void clear() { mnPos = 0; mnSize = 0; mnMinSize = 0; }
+ };
+ typedef std::vector< Layout > LayoutVector;
+
+ sal_Int32 distribute( LayoutVector& rLayouts, sal_Int32 nDistribute );
+
+ TableModelRef mxTable;
+ LayoutVector maRows;
+ LayoutVector maColumns;
+
+ BorderLineMap maHorizontalBorders;
+ BorderLineMap maVerticalBorders;
+
+ com::sun::star::text::WritingMode meWritingMode;
+
+ const rtl::OUString msSize;
+};
+
+} }
+
+#endif
diff --git a/svx/source/table/tablemodel.cxx b/svx/source/table/tablemodel.cxx
new file mode 100644
index 000000000000..b62d1187e14c
--- /dev/null
+++ b/svx/source/table/tablemodel.cxx
@@ -0,0 +1,1258 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <com/sun/star/table/XMergeableCell.hpp>
+
+#include <algorithm>
+#include <boost/bind.hpp>
+
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+
+#include "cell.hxx"
+#include "cellcursor.hxx"
+#include "tablemodel.hxx"
+#include "tablerow.hxx"
+#include "tablerows.hxx"
+#include "tablecolumn.hxx"
+#include "tablecolumns.hxx"
+#include "tableundo.hxx"
+#include "svx/svdotable.hxx"
+#include "svx/svdmodel.hxx"
+#include "svx/svdstr.hrc"
+#include "svx/svdglob.hxx"
+
+//#define PLEASE_DEBUG_THE_TABLES 1
+
+using ::rtl::OUString;
+using namespace ::osl;
+using namespace ::vos;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::util;
+
+// -----------------------------------------------------------------------------
+
+namespace sdr { namespace table {
+
+// -----------------------------------------------------------------------------
+
+// removes the given range from a vector
+template< class Vec, class Iter > void remove_range( Vec& rVector, sal_Int32 nIndex, sal_Int32 nCount )
+{
+ const sal_Int32 nSize = static_cast<sal_Int32>(rVector.size());
+ if( nCount && (nIndex >= 0) && (nIndex < nSize) )
+ {
+ if( (nIndex + nCount) >= nSize )
+ {
+ // remove at end
+ rVector.resize( nIndex );
+ }
+ else
+ {
+ Iter aBegin( rVector.begin() );
+ while( nIndex-- )
+ aBegin++;
+ if( nCount == 1 )
+ {
+ rVector.erase( aBegin );
+ }
+ else
+ {
+ Iter aEnd( aBegin );
+
+ while( nCount-- )
+ aEnd++;
+ rVector.erase( aBegin, aEnd );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+/** inserts a range into a vector */
+template< class Vec, class Iter, class Entry > sal_Int32 insert_range( Vec& rVector, sal_Int32 nIndex, sal_Int32 nCount )
+{
+ if( nCount )
+ {
+ if( nIndex >= static_cast< sal_Int32 >( rVector.size() ) )
+ {
+ // append at end
+ nIndex = static_cast< sal_Int32 >( rVector.size() ); // cap to end
+ rVector.resize( nIndex + nCount );
+ }
+ else
+ {
+ // insert
+ sal_Int32 nFind = nIndex;
+ Iter aIter( rVector.begin() );
+ while( nFind-- )
+ aIter++;
+
+ Entry aEmpty;
+ rVector.insert( aIter, nCount, aEmpty );
+ }
+ }
+ return nIndex;
+}
+
+// -----------------------------------------------------------------------------
+
+TableModel::TableModel( SdrTableObj* pTableObj )
+: TableModelBase( m_aMutex )
+, mpTableObj( pTableObj )
+, mbModified( sal_False )
+, mbNotifyPending( false )
+, mnNotifyLock( 0 )
+{
+}
+
+TableModel::TableModel( SdrTableObj* pTableObj, const TableModelRef& xSourceTable )
+: TableModelBase( m_aMutex )
+, mpTableObj( pTableObj )
+, mbModified( sal_False )
+, mbNotifyPending( false )
+, mnNotifyLock( 0 )
+{
+ if( xSourceTable.is() )
+ {
+ const sal_Int32 nColCount = xSourceTable->getColumnCountImpl();
+ const sal_Int32 nRowCount = xSourceTable->getRowCountImpl();
+
+ init( nColCount, nRowCount );
+
+ sal_Int32 nRows = nRowCount;
+ while( nRows-- )
+ (*maRows[nRows]) = (*xSourceTable->maRows[nRows]);
+
+ sal_Int32 nColumns = nColCount;
+ while( nColumns-- )
+ (*maColumns[nColumns]) = (*xSourceTable->maColumns[nColumns]);
+
+ // copy cells
+ for( sal_Int32 nCol = 0; nCol < nColCount; ++nCol )
+ {
+ for( sal_Int32 nRow = 0; nRow < nRowCount; ++nRow )
+ {
+ CellRef xTargetCell( getCell( nCol, nRow ) );
+ if( xTargetCell.is() )
+ xTargetCell->cloneFrom( xSourceTable->getCell( nCol, nRow ) );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+TableModel::~TableModel()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void TableModel::init( sal_Int32 nColumns, sal_Int32 nRows )
+{
+ if( nRows < 20 )
+ maRows.reserve( 20 );
+
+ if( nColumns < 20 )
+ maColumns.reserve( 20 );
+
+ if( nRows && nColumns )
+ {
+ maColumns.resize( nColumns );
+ maRows.resize( nRows );
+
+ while( nRows-- )
+ maRows[nRows].set( new TableRow( this, nRows, nColumns ) );
+
+ while( nColumns-- )
+ maColumns[nColumns].set( new TableColumn( this, nColumns ) );
+ }
+}
+
+// -----------------------------------------------------------------------------
+// ICellRange
+// -----------------------------------------------------------------------------
+
+sal_Int32 TableModel::getLeft()
+{
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 TableModel::getTop()
+{
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 TableModel::getRight()
+{
+ return getColumnCount();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 TableModel::getBottom()
+{
+ return getRowCount();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XTable > TableModel::getTable()
+{
+ return this;
+}
+
+// -----------------------------------------------------------------------------
+
+void TableModel::UndoInsertRows( sal_Int32 nIndex, sal_Int32 nCount )
+{
+ TableModelNotifyGuard aGuard( this );
+
+ // remove the rows
+ remove_range<RowVector,RowVector::iterator>( maRows, nIndex, nCount );
+ updateRows();
+ setModified(sal_True);
+}
+
+// -----------------------------------------------------------------------------
+
+void TableModel::UndoRemoveRows( sal_Int32 nIndex, RowVector& aRows )
+{
+ TableModelNotifyGuard aGuard( this );
+
+ const sal_Int32 nCount = sal::static_int_cast< sal_Int32 >( aRows.size() );
+
+ nIndex = insert_range<RowVector,RowVector::iterator,TableRowRef>( maRows, nIndex, nCount );
+
+ for( sal_Int32 nOffset = 0; nOffset < nCount; ++nOffset )
+ maRows[nIndex+nOffset] = aRows[nOffset];
+
+ updateRows();
+ setModified(sal_True);
+}
+
+// -----------------------------------------------------------------------------
+
+void TableModel::UndoInsertColumns( sal_Int32 nIndex, sal_Int32 nCount )
+{
+ TableModelNotifyGuard aGuard( this );
+
+ // now remove the columns
+ remove_range<ColumnVector,ColumnVector::iterator>( maColumns, nIndex, nCount );
+ sal_Int32 nRows = getRowCountImpl();
+ while( nRows-- )
+ maRows[nRows]->removeColumns( nIndex, nCount );
+
+ updateColumns();
+ setModified(sal_True);
+}
+
+// -----------------------------------------------------------------------------
+
+void TableModel::UndoRemoveColumns( sal_Int32 nIndex, ColumnVector& aCols, CellVector& aCells )
+{
+ TableModelNotifyGuard aGuard( this );
+
+ const sal_Int32 nCount = sal::static_int_cast< sal_Int32 >( aCols.size() );
+
+ // assert if there are not enough cells saved
+ DBG_ASSERT( (aCols.size() * maRows.size()) == aCells.size(), "sdr::table::TableModel::UndoRemoveColumns(), invalid undo data!" );
+
+ nIndex = insert_range<ColumnVector,ColumnVector::iterator,TableColumnRef>( maColumns, nIndex, nCount );
+ for( sal_Int32 nOffset = 0; nOffset < nCount; ++nOffset )
+ maColumns[nIndex+nOffset] = aCols[nOffset];
+
+ CellVector::iterator aIter( aCells.begin() );
+
+ sal_Int32 nRows = getRowCountImpl();
+ for( sal_Int32 nRow = 0; nRow < nRows; ++nRow )
+ maRows[nRow]->insertColumns( nIndex, nCount, &aIter );
+
+ updateColumns();
+ setModified(sal_True);
+}
+
+// -----------------------------------------------------------------------------
+// XTable
+// -----------------------------------------------------------------------------
+
+Reference< XCellCursor > SAL_CALL TableModel::createCursor() throw (RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ return createCursorByRange( Reference< XCellRange >( this ) );
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XCellCursor > SAL_CALL TableModel::createCursorByRange( const Reference< XCellRange >& Range ) throw (IllegalArgumentException, RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ ICellRange* pRange = dynamic_cast< ICellRange* >( Range.get() );
+ if( (pRange == 0) || (pRange->getTable().get() != this) )
+ throw IllegalArgumentException();
+
+ TableModelRef xModel( this );
+ return new CellCursor( xModel, pRange->getLeft(), pRange->getTop(), pRange->getRight(), pRange->getBottom() );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL TableModel::getRowCount() throw (RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ return getRowCountImpl();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL TableModel::getColumnCount() throw (RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ return getColumnCountImpl();
+}
+
+// -----------------------------------------------------------------------------
+// XComponent
+// -----------------------------------------------------------------------------
+
+void TableModel::dispose() throw (RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ TableModelBase::dispose();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL TableModel::addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
+{
+ TableModelBase::addEventListener( xListener );
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL TableModel::removeEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
+{
+ TableModelBase::removeEventListener( xListener );
+}
+
+// -----------------------------------------------------------------------------
+// XModifiable
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL TableModel::isModified( ) throw (RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ return mbModified;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL TableModel::setModified( sal_Bool bModified ) throw (PropertyVetoException, RuntimeException)
+{
+ {
+ OGuard aGuard( Application::GetSolarMutex() );
+ mbModified = bModified;
+ }
+ if( bModified )
+ notifyModification();
+}
+
+// -----------------------------------------------------------------------------
+// XModifyBroadcaster
+// -----------------------------------------------------------------------------
+
+void SAL_CALL TableModel::addModifyListener( const Reference< XModifyListener >& xListener ) throw (RuntimeException)
+{
+ rBHelper.addListener( XModifyListener::static_type() , xListener );
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL TableModel::removeModifyListener( const Reference< XModifyListener >& xListener ) throw (RuntimeException)
+{
+ rBHelper.removeListener( XModifyListener::static_type() , xListener );
+}
+
+// -----------------------------------------------------------------------------
+// XColumnRowRange
+// -----------------------------------------------------------------------------
+
+Reference< XTableColumns > SAL_CALL TableModel::getColumns() throw (RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( !mxTableColumns.is() )
+ mxTableColumns.set( new TableColumns( this ) );
+ return mxTableColumns.get();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XTableRows > SAL_CALL TableModel::getRows() throw (RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( !mxTableRows.is() )
+ mxTableRows.set( new TableRows( this ) );
+ return mxTableRows.get();
+}
+
+// -----------------------------------------------------------------------------
+// XCellRange
+// -----------------------------------------------------------------------------
+
+Reference< XCell > SAL_CALL TableModel::getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) throw ( IndexOutOfBoundsException, RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ CellRef xCell( getCell( nColumn, nRow ) );
+ if( xCell.is() )
+ return xCell.get();
+
+ throw IndexOutOfBoundsException();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XCellRange > SAL_CALL TableModel::getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( (nLeft >= 0) && (nTop >= 0) && (nRight >= nLeft) && (nBottom >= nTop) && (nRight < getColumnCountImpl()) && (nBottom < getRowCountImpl() ) )
+ {
+ TableModelRef xModel( this );
+ return new CellRange( xModel, nLeft, nTop, nRight, nBottom );
+ }
+
+ throw IndexOutOfBoundsException();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XCellRange > SAL_CALL TableModel::getCellRangeByName( const OUString& /*aRange*/ ) throw (RuntimeException)
+{
+ return Reference< XCellRange >();
+}
+
+// -----------------------------------------------------------------------------
+// XPropertySet
+// -----------------------------------------------------------------------------
+
+Reference< XPropertySetInfo > SAL_CALL TableModel::getPropertySetInfo( ) throw (RuntimeException)
+{
+ Reference< XPropertySetInfo > xInfo;
+ return xInfo;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL TableModel::setPropertyValue( const ::rtl::OUString& /*aPropertyName*/, const Any& /*aValue*/ ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+Any SAL_CALL TableModel::getPropertyValue( const OUString& /*PropertyName*/ ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ return Any();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL TableModel::addPropertyChangeListener( const OUString& /*aPropertyName*/, const Reference< XPropertyChangeListener >& /*xListener*/ ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL TableModel::removePropertyChangeListener( const OUString& /*aPropertyName*/, const Reference< XPropertyChangeListener >& /*xListener*/ ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL TableModel::addVetoableChangeListener( const OUString& /*aPropertyName*/, const Reference< XVetoableChangeListener >& /*xListener*/ ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL TableModel::removeVetoableChangeListener( const OUString& /*aPropertyName*/, const Reference< XVetoableChangeListener >& /*xListener*/ ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+// XFastPropertySet
+// -----------------------------------------------------------------------------
+
+void SAL_CALL TableModel::setFastPropertyValue( ::sal_Int32 /*nHandle*/, const Any& /*aValue*/ ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+}
+
+// -----------------------------------------------------------------------------
+
+Any SAL_CALL TableModel::getFastPropertyValue( ::sal_Int32 /*nHandle*/ ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ Any aAny;
+ return aAny;
+}
+
+// -----------------------------------------------------------------------------
+// internals
+// -----------------------------------------------------------------------------
+
+sal_Int32 TableModel::getRowCountImpl() const
+{
+ return static_cast< sal_Int32 >( maRows.size() );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 TableModel::getColumnCountImpl() const
+{
+ return static_cast< sal_Int32 >( maColumns.size() );
+}
+
+// -----------------------------------------------------------------------------
+
+void TableModel::disposing()
+{
+ if( !maRows.empty() )
+ {
+ RowVector::iterator aIter( maRows.begin() );
+ while( aIter != maRows.end() )
+ (*aIter++)->dispose();
+ RowVector().swap(maRows);
+ }
+
+ if( !maColumns.empty() )
+ {
+ ColumnVector::iterator aIter( maColumns.begin() );
+ while( aIter != maColumns.end() )
+ (*aIter++)->dispose();
+ ColumnVector().swap(maColumns);
+ }
+
+ if( mxTableColumns.is() )
+ {
+ mxTableColumns->dispose();
+ mxTableColumns.clear();
+ }
+
+ if( mxTableRows.is() )
+ {
+ mxTableRows->dispose();
+ mxTableRows.clear();
+ }
+
+ mpTableObj = 0;
+}
+
+// -----------------------------------------------------------------------------
+// XBroadcaster
+// -----------------------------------------------------------------------------
+
+void TableModel::lockBroadcasts() throw (RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ ++mnNotifyLock;
+}
+// -----------------------------------------------------------------------------
+
+void TableModel::unlockBroadcasts() throw (RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ --mnNotifyLock;
+ if( mnNotifyLock <= 0 )
+ {
+ mnNotifyLock = 0;
+ if( mbNotifyPending )
+ notifyModification();
+ }
+}
+
+// -----------------------------------------------------------------------------
+#ifdef PLEASE_DEBUG_THE_TABLES
+#include <stdio.h>
+#endif
+
+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( "c:\\table.xml","w" );
+
+ const sal_Int32 nColCount = getColumnCountImpl();
+ const sal_Int32 nRowCount = getRowCountImpl();
+
+ 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 )
+ {
+ fprintf( file, "<column this=\"%lx\"/>\n\r", maColumns[nCol].get() );
+ }
+
+ // first check merged cells before and inside the removed rows
+ for( sal_Int32 nRow = 0; nRow < nRowCount; ++nRow )
+ {
+ fprintf( file, "<row this=\"%lx\">\n\r", maRows[nRow].get() );
+ for( sal_Int32 nCol = 0; nCol < nColCount; ++nCol )
+ {
+ CellRef xCell( getCell( nCol, nRow ) );
+ fprintf( file, "<cell this=\"%lx\"", xCell.get() );
+
+ sal_Int32 nRowSpan = xCell->getRowSpan();
+ sal_Int32 nColSpan = xCell->getColumnSpan();
+ sal_Bool bMerged = xCell->isMerged();
+
+ if( nColSpan != 1 )
+ fprintf( file, " column-span=\"%ld\"", nColSpan );
+ if( nRowSpan != 1 )
+ fprintf( file, " row-span=\"%ld\"", nRowSpan );
+
+ if( bMerged )
+ fprintf( file, " merged=\"true\"" );
+
+ fprintf( file, "/>" );
+ }
+ fprintf( file, "\n\r</row>\n\r" );
+ }
+
+ fprintf( file, "</table>\n\r" );
+ fclose( file );
+#endif
+}
+
+// -----------------------------------------------------------------------------
+
+CellRef TableModel::getCell( sal_Int32 nCol, sal_Int32 nRow ) const
+{
+ if( ((nRow >= 0) && (nRow < getRowCountImpl())) && (nCol >= 0) && (nCol < getColumnCountImpl()) )
+ {
+ return maRows[nRow]->maCells[nCol];
+ }
+ else
+ {
+ CellRef xRet;
+ return xRet;
+ }
+}
+
+// -----------------------------------------------------------------------------
+/*
+bool TableModel::getCellPos( const CellRef& xCell, ::sal_Int32& rnCol, ::sal_Int32& rnRow ) const
+{
+ const sal_Int32 nRowCount = getRowCount();
+ const sal_Int32 nColCount = getColumnCount();
+ for( rnRow = 0; rnRow < nRowCount; rnRow++ )
+ {
+ for( rnCol = 0; rnCol < nColCount; rnCol++ )
+ {
+ if( maRows[rnRow]->maCells[rnCol] == xCell )
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+*/
+
+// -----------------------------------------------------------------------------
+
+CellRef TableModel::createCell()
+{
+ CellRef xCell;
+ if( mpTableObj )
+ mpTableObj->createCell( xCell );
+ return xCell;
+}
+
+// -----------------------------------------------------------------------------
+
+void TableModel::insertColumns( sal_Int32 nIndex, sal_Int32 nCount )
+{
+ if( nCount && mpTableObj )
+ {
+ try
+ {
+ SdrModel* pModel = mpTableObj->GetModel();
+
+ TableModelNotifyGuard aGuard( this );
+ nIndex = insert_range<ColumnVector,ColumnVector::iterator,TableColumnRef>( maColumns, nIndex, nCount );
+
+ sal_Int32 nRows = getRowCountImpl();
+ while( nRows-- )
+ maRows[nRows]->insertColumns( nIndex, nCount );
+
+ ColumnVector aNewColumns(nCount);
+ for( sal_Int32 nOffset = 0; nOffset < nCount; ++nOffset )
+ {
+ TableColumnRef xNewCol( new TableColumn( this, nIndex+nOffset ) );
+ maColumns[nIndex+nOffset] = xNewCol;
+ aNewColumns[nOffset] = xNewCol;
+ }
+
+ const bool bUndo = pModel && mpTableObj->IsInserted() && pModel->IsUndoEnabled();
+ if( bUndo )
+ {
+ pModel->BegUndo( ImpGetResStr(STR_TABLE_INSCOL) );
+ pModel->AddUndo( pModel->GetSdrUndoFactory().CreateUndoGeoObject(*mpTableObj) );
+
+ TableModelRef xThis( this );
+
+ nRows = getRowCountImpl();
+ CellVector aNewCells( nCount * nRows );
+ CellVector::iterator aCellIter( aNewCells.begin() );
+
+ nRows = getRowCountImpl();
+ for( sal_Int32 nRow = 0; nRow < nRows; ++nRow )
+ {
+ for( sal_Int32 nOffset = 0; nOffset < nCount; ++nOffset )
+ (*aCellIter++) = getCell( nIndex + nOffset, nRow );
+ }
+
+ pModel->AddUndo( new InsertColUndo( xThis, nIndex, aNewColumns, aNewCells ) );
+ }
+
+ const sal_Int32 nRowCount = getRowCountImpl();
+ // check if cells merge over new columns
+ for( sal_Int32 nCol = 0; nCol < nIndex; ++nCol )
+ {
+ for( sal_Int32 nRow = 0; nRow < nRowCount; ++nRow )
+ {
+ CellRef xCell( getCell( nCol, nRow ) );
+ sal_Int32 nColSpan = (xCell.is() && !xCell->isMerged()) ? xCell->getColumnSpan() : 1;
+ if( (nColSpan != 1) && ((nColSpan + nCol ) > nIndex) )
+ {
+ // cell merges over newly created columns, so add the new columns to the merged cell
+ const sal_Int32 nRowSpan = xCell->getRowSpan();
+ nColSpan += nCount;
+ merge( nCol, nRow, nColSpan, nRowSpan );
+ }
+ }
+ }
+
+ if( bUndo )
+ pModel->EndUndo();
+
+ if( pModel )
+ pModel->SetChanged();
+
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("sdr::table::TableModel::insertColumns(), exception caught!");
+ }
+ updateColumns();
+ setModified(sal_True);
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void TableModel::removeColumns( sal_Int32 nIndex, sal_Int32 nCount )
+{
+ sal_Int32 nColCount = getColumnCountImpl();
+
+ if( mpTableObj && nCount && (nIndex >= 0) && (nIndex < nColCount) )
+ {
+ try
+ {
+ TableModelNotifyGuard aGuard( this );
+
+ // clip removed columns to columns actually avalaible
+ if( (nIndex + nCount) > nColCount )
+ nCount = nColCount - nIndex;
+
+ sal_Int32 nRows = getRowCountImpl();
+
+ SdrModel* pModel = mpTableObj->GetModel();
+
+ const bool bUndo = pModel && mpTableObj->IsInserted() && pModel->IsUndoEnabled();
+ if( bUndo )
+ {
+ pModel->BegUndo( ImpGetResStr(STR_UNDO_COL_DELETE) );
+ pModel->AddUndo( pModel->GetSdrUndoFactory().CreateUndoGeoObject(*mpTableObj) );
+
+ TableModelRef xThis( this );
+ ColumnVector aRemovedCols( nCount );
+ sal_Int32 nOffset;
+ for( nOffset = 0; nOffset < nCount; ++nOffset )
+ {
+ aRemovedCols[nOffset] = maColumns[nIndex+nOffset];
+ }
+
+ CellVector aRemovedCells( nCount * nRows );
+ CellVector::iterator aCellIter( aRemovedCells.begin() );
+ for( sal_Int32 nRow = 0; nRow < nRows; ++nRow )
+ {
+ for( nOffset = 0; nOffset < nCount; ++nOffset )
+ (*aCellIter++) = getCell( nIndex + nOffset, nRow );
+ }
+
+ pModel->AddUndo( new RemoveColUndo( xThis, nIndex, aRemovedCols, aRemovedCells ) );
+ }
+
+ // only rows before and inside the removed rows are considered
+ nColCount = nIndex + nCount + 1;
+
+ const sal_Int32 nRowCount = getRowCountImpl();
+
+ // first check merged cells before and inside the removed rows
+ for( sal_Int32 nCol = 0; nCol < nColCount; ++nCol )
+ {
+ for( sal_Int32 nRow = 0; nRow < nRowCount; ++nRow )
+ {
+ CellRef xCell( getCell( nCol, nRow ) );
+ sal_Int32 nColSpan = (xCell.is() && !xCell->isMerged()) ? xCell->getColumnSpan() : 1;
+ if( nColSpan <= 1 )
+ continue;
+
+ if( nCol >= nIndex )
+ {
+ // current cell is inside the removed columns
+ if( (nCol + nColSpan) > ( nIndex + nCount ) )
+ {
+ // current cells merges with columns after the removed columns
+ const sal_Int32 nRemove = nCount - nCol + nIndex;
+
+ CellRef xTargetCell( getCell( nIndex + nCount, nRow ) );
+ if( xTargetCell.is() )
+ {
+ if( bUndo )
+ xTargetCell->AddUndo();
+ xTargetCell->merge( nColSpan - nRemove, xCell->getRowSpan() );
+ xTargetCell->replaceContentAndFormating( xCell );
+ }
+ }
+ }
+ else if( nColSpan > (nIndex - nCol) )
+ {
+ // current cells spans inside the removed columns, so adjust
+ const sal_Int32 nRemove = ::std::min( nCount, nCol + nColSpan - nIndex );
+ if( bUndo )
+ xCell->AddUndo();
+ xCell->merge( nColSpan - nRemove, xCell->getRowSpan() );
+ }
+ }
+ }
+
+ // now remove the columns
+ remove_range<ColumnVector,ColumnVector::iterator>( maColumns, nIndex, nCount );
+ while( nRows-- )
+ maRows[nRows]->removeColumns( nIndex, nCount );
+
+ if( bUndo )
+ pModel->EndUndo();
+
+ if( pModel )
+ pModel->SetChanged();
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("sdr::table::TableModel::removeColumns(), exception caught!");
+ }
+
+ updateColumns();
+ setModified(sal_True);
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void TableModel::insertRows( sal_Int32 nIndex, sal_Int32 nCount )
+{
+ if( nCount && mpTableObj )
+ {
+ SdrModel* pModel = mpTableObj->GetModel();
+ const bool bUndo = pModel && mpTableObj->IsInserted() && pModel->IsUndoEnabled();
+ try
+ {
+ TableModelNotifyGuard aGuard( this );
+
+ nIndex = insert_range<RowVector,RowVector::iterator,TableRowRef>( maRows, nIndex, nCount );
+
+ RowVector aNewRows(nCount);
+ const sal_Int32 nColCount = getColumnCountImpl();
+ for( sal_Int32 nOffset = 0; nOffset < nCount; ++nOffset )
+ {
+ TableRowRef xNewRow( new TableRow( this, nIndex+nOffset, nColCount ) );
+ maRows[nIndex+nOffset] = xNewRow;
+ aNewRows[nOffset] = xNewRow;
+ }
+
+ if( bUndo )
+ {
+ pModel->BegUndo( ImpGetResStr(STR_TABLE_INSROW) );
+ pModel->AddUndo( pModel->GetSdrUndoFactory().CreateUndoGeoObject(*mpTableObj) );
+ TableModelRef xThis( this );
+ pModel->AddUndo( new InsertRowUndo( xThis, nIndex, aNewRows ) );
+ }
+
+ // check if cells merge over new columns
+ for( sal_Int32 nRow = 0; nRow < nIndex; ++nRow )
+ {
+ for( sal_Int32 nCol = 0; nCol < nColCount; ++nCol )
+ {
+ CellRef xCell( getCell( nCol, nRow ) );
+ sal_Int32 nRowSpan = (xCell.is() && !xCell->isMerged()) ? xCell->getRowSpan() : 1;
+ if( (nRowSpan > 1) && ((nRowSpan + nRow) > nIndex) )
+ {
+ // cell merges over newly created columns, so add the new columns to the merged cell
+ const sal_Int32 nColSpan = xCell->getColumnSpan();
+ nRowSpan += nCount;
+ merge( nCol, nRow, nColSpan, nRowSpan );
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("sdr::table::TableModel::insertRows(), exception caught!");
+ }
+ if( bUndo )
+ pModel->EndUndo();
+
+ if( pModel )
+ pModel->SetChanged();
+
+ updateRows();
+ setModified(sal_True);
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void TableModel::removeRows( sal_Int32 nIndex, sal_Int32 nCount )
+{
+ sal_Int32 nRowCount = getRowCountImpl();
+
+ if( mpTableObj && nCount && (nIndex >= 0) && (nIndex < nRowCount) )
+ {
+ SdrModel* pModel = mpTableObj->GetModel();
+ const bool bUndo = pModel && mpTableObj->IsInserted()&& pModel->IsUndoEnabled();
+
+ try
+ {
+ TableModelNotifyGuard aGuard( this );
+
+ // clip removed rows to rows actually avalaible
+ if( (nIndex + nCount) > nRowCount )
+ nCount = nRowCount - nIndex;
+
+ if( bUndo )
+ {
+ pModel->BegUndo( ImpGetResStr(STR_UNDO_ROW_DELETE) );
+ pModel->AddUndo( pModel->GetSdrUndoFactory().CreateUndoGeoObject(*mpTableObj) );
+
+ TableModelRef xThis( this );
+
+ RowVector aRemovedRows( nCount );
+ for( sal_Int32 nOffset = 0; nOffset < nCount; ++nOffset )
+ aRemovedRows[nOffset] = maRows[nIndex+nOffset];
+
+ pModel->AddUndo( new RemoveRowUndo( xThis, nIndex, aRemovedRows ) );
+ }
+
+ // only rows before and inside the removed rows are considered
+ nRowCount = nIndex + nCount + 1;
+
+ const sal_Int32 nColCount = getColumnCountImpl();
+
+ // first check merged cells before and inside the removed rows
+ for( sal_Int32 nRow = 0; nRow < nRowCount; ++nRow )
+ {
+ for( sal_Int32 nCol = 0; nCol < nColCount; ++nCol )
+ {
+ CellRef xCell( getCell( nCol, nRow ) );
+ sal_Int32 nRowSpan = (xCell.is() && !xCell->isMerged()) ? xCell->getRowSpan() : 1;
+ if( nRowSpan <= 1 )
+ continue;
+
+ if( nRow >= nIndex )
+ {
+ // current cell is inside the removed rows
+ if( (nRow + nRowSpan) > (nIndex + nCount) )
+ {
+ // current cells merges with rows after the removed rows
+ const sal_Int32 nRemove = nCount - nRow + nIndex;
+
+ CellRef xTargetCell( getCell( nCol, nIndex + nCount ) );
+ if( xTargetCell.is() )
+ {
+ if( bUndo )
+ xTargetCell->AddUndo();
+ xTargetCell->merge( xCell->getColumnSpan(), nRowSpan - nRemove );
+ xTargetCell->replaceContentAndFormating( xCell );
+ }
+ }
+ }
+ else if( nRowSpan > (nIndex - nRow) )
+ {
+ // current cells spans inside the removed rows, so adjust
+ const sal_Int32 nRemove = ::std::min( nCount, nRow + nRowSpan - nIndex );
+ if( bUndo )
+ xCell->AddUndo();
+ xCell->merge( xCell->getColumnSpan(), nRowSpan - nRemove );
+ }
+ }
+ }
+
+ // now remove the rows
+ remove_range<RowVector,RowVector::iterator>( maRows, nIndex, nCount );
+
+ if( bUndo )
+ pModel->EndUndo();
+
+ if( pModel )
+ pModel->SetChanged();
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("sdr::table::TableModel::removeRows(), exception caught!");
+ }
+
+ updateRows();
+ setModified(sal_True);
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+TableRowRef TableModel::getRow( sal_Int32 nRow ) const throw (IndexOutOfBoundsException)
+{
+ if( (nRow >= 0) && (nRow < getRowCountImpl()) )
+ return maRows[nRow];
+
+ throw IndexOutOfBoundsException();
+}
+
+// -----------------------------------------------------------------------------
+
+TableColumnRef TableModel::getColumn( sal_Int32 nColumn ) const throw (IndexOutOfBoundsException)
+{
+ if( (nColumn >= 0) && (nColumn < getColumnCountImpl()) )
+ return maColumns[nColumn];
+
+ throw IndexOutOfBoundsException();
+}
+
+// -----------------------------------------------------------------------------
+
+/** deletes rows and columns that are completly merged. Must be called between BegUndo/EndUndo! */
+void TableModel::optimize()
+{
+ TableModelNotifyGuard aGuard( this );
+
+ bool bWasModified = false;
+
+ if( !maRows.empty() && !maColumns.empty() )
+ {
+ sal_Int32 nCol = getColumnCountImpl() - 1;
+ while( nCol > 0 )
+ {
+ bool bEmpty = true;
+ for( sal_Int32 nRow = 0; (nRow < getRowCountImpl()) && bEmpty; nRow++ )
+ {
+ Reference< XMergeableCell > xCell( getCellByPosition( nCol, nRow ), UNO_QUERY );
+ if( xCell.is() && !xCell->isMerged() )
+ bEmpty = false;
+ }
+
+ if( bEmpty )
+ {
+ if( nCol > 0 ) try
+ {
+ const OUString sWidth( RTL_CONSTASCII_USTRINGPARAM("Width") );
+ sal_Int32 nWidth1 = 0, nWidth2 = 0;
+ Reference< XPropertySet > xSet1( static_cast< XCellRange* >( maColumns[nCol].get() ), UNO_QUERY_THROW );
+ Reference< XPropertySet > xSet2( static_cast< XCellRange* >( maColumns[nCol-1].get() ), UNO_QUERY_THROW );
+ xSet1->getPropertyValue( sWidth ) >>= nWidth1;
+ xSet2->getPropertyValue( sWidth ) >>= nWidth2;
+ nWidth1 += nWidth2;
+ xSet2->setPropertyValue( sWidth, Any( nWidth1 ) );
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ DBG_ERROR("svx::TableModel::optimize(), exception caught!");
+ }
+
+ removeColumns( nCol, 1 );
+ bWasModified = true;
+ }
+
+ nCol--;
+ }
+
+ sal_Int32 nRow = getRowCountImpl() - 1;
+ while( nRow > 0 )
+ {
+ bool bEmpty = true;
+ for( nCol = 0; (nCol < getColumnCountImpl()) && bEmpty; nCol++ )
+ {
+ Reference< XMergeableCell > xCell( getCellByPosition( nCol, nRow ), UNO_QUERY );
+ if( xCell.is() && !xCell->isMerged() )
+ bEmpty = false;
+ }
+
+ if( bEmpty )
+ {
+ if( nRow > 0 ) try
+ {
+ const OUString sHeight( RTL_CONSTASCII_USTRINGPARAM("Height") );
+ sal_Int32 nHeight1 = 0, nHeight2 = 0;
+ Reference< XPropertySet > xSet1( static_cast< XCellRange* >( maRows[nRow].get() ), UNO_QUERY_THROW );
+ Reference< XPropertySet > xSet2( static_cast< XCellRange* >( maRows[nRow-1].get() ), UNO_QUERY_THROW );
+ xSet1->getPropertyValue( sHeight ) >>= nHeight1;
+ xSet2->getPropertyValue( sHeight ) >>= nHeight2;
+ nHeight1 += nHeight2;
+ xSet2->setPropertyValue( sHeight, Any( nHeight1 ) );
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ DBG_ERROR("svx::TableModel::optimize(), exception caught!");
+ }
+
+ removeRows( nRow, 1 );
+ bWasModified = true;
+ }
+
+ nRow--;
+ }
+ }
+ if( bWasModified )
+ setModified(sal_True);
+}
+
+// -----------------------------------------------------------------------------
+
+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;
+ RowVector::iterator iter = maRows.begin();
+ while( iter != maRows.end() )
+ {
+ (*iter++)->mnRow = nRow++;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void TableModel::updateColumns()
+{
+ sal_Int32 nColumn = 0;
+ ColumnVector::iterator iter = maColumns.begin();
+ while( iter != maColumns.end() )
+ {
+ (*iter++)->mnColumn = nColumn++;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+} }
diff --git a/svx/source/table/tablemodel.hxx b/svx/source/table/tablemodel.hxx
new file mode 100644
index 000000000000..a1498c0041a6
--- /dev/null
+++ b/svx/source/table/tablemodel.hxx
@@ -0,0 +1,225 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_TABLE_TABLEMODEL_HXX_
+#define _SVX_TABLE_TABLEMODEL_HXX_
+
+#include <com/sun/star/util/XBroadcaster.hpp>
+#include <com/sun/star/table/XTable.hpp>
+#include <basegfx/range/b2irectangle.hxx>
+#include <basegfx/tuple/b2ituple.hxx>
+#include <cppuhelper/compbase2.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <comphelper/listenernotification.hxx>
+#include <tools/gen.hxx>
+#include "celltypes.hxx"
+
+// -----------------------------------------------------------------------------
+
+namespace sdr { namespace table {
+
+class SdrTableObj;
+
+// -----------------------------------------------------------------------------
+// ICellRange
+// -----------------------------------------------------------------------------
+
+/** base class for each object implementing an XCellRange */
+class ICellRange
+{
+public:
+ virtual sal_Int32 getLeft() = 0;
+ virtual sal_Int32 getTop() = 0;
+ virtual sal_Int32 getRight() = 0;
+ virtual sal_Int32 getBottom() = 0;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XTable > getTable() = 0;
+};
+
+// -----------------------------------------------------------------------------
+// TableModel
+// -----------------------------------------------------------------------------
+
+typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::table::XTable, ::com::sun::star::util::XBroadcaster > TableModelBase;
+
+class TableModel : public TableModelBase,
+ public ::comphelper::OBaseMutex,
+ public ICellRange
+{
+ friend class InsertRowUndo;
+ friend class RemoveRowUndo;
+ friend class InsertColUndo;
+ friend class RemoveColUndo;
+ friend class TableColumnUndo;
+ friend class TableRowUndo;
+ friend class TableColumn;
+ friend class TableRow;
+ friend class TableRows;
+ friend class TableColumns;
+ friend class TableModelNotifyGuard;
+
+public:
+ TableModel( SdrTableObj* pTableObj );
+ TableModel( SdrTableObj* pTableObj, const TableModelRef& xSourceTable );
+ virtual ~TableModel();
+
+ void init( sal_Int32 nColumns, sal_Int32 nRows );
+
+ SdrTableObj* getSdrTableObj() const { return mpTableObj; }
+
+ /** 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();
+ virtual sal_Int32 getRight();
+ virtual sal_Int32 getBottom();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XTable > getTable();
+
+ // XTable
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellCursor > SAL_CALL createCursor( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellCursor > SAL_CALL createCursorByRange( const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange >& Range ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getRowCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getColumnCount() throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XModifiable
+ virtual ::sal_Bool SAL_CALL isModified( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setModified( ::sal_Bool bModified ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
+
+ // XModifyBroadcaster
+ virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XColumnRowRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XTableColumns > SAL_CALL getColumns() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XTableRows > SAL_CALL getRows() throw (::com::sun::star::uno::RuntimeException);
+
+ // XCellRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > SAL_CALL getCellByPosition( ::sal_Int32 nColumn, ::sal_Int32 nRow ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL getCellRangeByPosition( ::sal_Int32 nLeft, ::sal_Int32 nTop, ::sal_Int32 nRight, ::sal_Int32 nBottom ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL getCellRangeByName( const ::rtl::OUString& aRange ) 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);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XFastPropertySet
+ virtual void SAL_CALL setFastPropertyValue( ::sal_Int32 nHandle, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue( ::sal_Int32 nHandle ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XBroadcaster
+ virtual void SAL_CALL lockBroadcasts() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL unlockBroadcasts() throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ void notifyModification();
+
+ void insertColumns( sal_Int32 nIndex, sal_Int32 nCount );
+ void removeColumns( sal_Int32 nIndex, sal_Int32 nCount );
+ void insertRows( sal_Int32 nIndex, sal_Int32 nCount );
+ void removeRows( sal_Int32 nIndex, sal_Int32 nCount );
+
+ sal_Int32 getRowCountImpl() const;
+ sal_Int32 getColumnCountImpl() const;
+
+ CellRef createCell();
+ CellRef getCell( ::sal_Int32 nCol, ::sal_Int32 nRow ) const;
+
+ void UndoInsertRows( sal_Int32 nIndex, sal_Int32 nCount );
+ void UndoRemoveRows( sal_Int32 nIndex, RowVector& aNewRows );
+
+ void UndoInsertColumns( sal_Int32 nIndex, sal_Int32 nCount );
+ void UndoRemoveColumns( sal_Int32 nIndex, ColumnVector& aNewCols, CellVector& aCells );
+
+private:
+ /** this function is called upon disposing the component
+ */
+ virtual void SAL_CALL disposing();
+
+ TableRowRef getRow( sal_Int32 nRow ) const throw (::com::sun::star::lang::IndexOutOfBoundsException);
+ TableColumnRef getColumn( sal_Int32 nColumn ) const throw (::com::sun::star::lang::IndexOutOfBoundsException);
+
+ void updateRows();
+ void updateColumns();
+
+ RowVector maRows;
+ ColumnVector maColumns;
+
+ TableColumnsRef mxTableColumns;
+ TableRowsRef mxTableRows;
+
+ SdrTableObj* mpTableObj;
+
+ sal_Bool mbModified;
+ bool mbNotifyPending;
+
+ sal_Int32 mnNotifyLock;
+};
+
+class TableModelNotifyGuard
+{
+public:
+ TableModelNotifyGuard( TableModel* pModel )
+ : mxBroadcaster( static_cast< ::com::sun::star::util::XBroadcaster* >( pModel ) )
+ {
+ if( mxBroadcaster.is() )
+ mxBroadcaster->lockBroadcasts();
+ }
+
+ TableModelNotifyGuard( ::com::sun::star::uno::XInterface* pInterface )
+ : mxBroadcaster( pInterface, ::com::sun::star::uno::UNO_QUERY )
+ {
+ if( mxBroadcaster.is() )
+ mxBroadcaster->lockBroadcasts();
+ }
+
+ ~TableModelNotifyGuard()
+ {
+ if( mxBroadcaster.is() )
+ mxBroadcaster->unlockBroadcasts();
+ }
+
+private:
+ com::sun::star::uno::Reference< ::com::sun::star::util::XBroadcaster > mxBroadcaster;
+};
+
+} }
+
+#endif
diff --git a/svx/source/table/tablerow.cxx b/svx/source/table/tablerow.cxx
new file mode 100644
index 000000000000..379d4beb37df
--- /dev/null
+++ b/svx/source/table/tablerow.cxx
@@ -0,0 +1,381 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <com/sun/star/lang/DisposedException.hpp>
+
+#include "cell.hxx"
+#include "tablerow.hxx"
+#include "tableundo.hxx"
+#include "svx/svdmodel.hxx"
+#include "svx/svdotable.hxx"
+
+// -----------------------------------------------------------------------------
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::beans;
+
+// -----------------------------------------------------------------------------
+
+namespace sdr { namespace table {
+
+const sal_Int32 Property_Height = 0;
+const sal_Int32 Property_OptimalHeight = 1;
+const sal_Int32 Property_IsVisible = 2;
+const sal_Int32 Property_IsStartOfNewPage = 3;
+
+// -----------------------------------------------------------------------------
+// TableRow
+// -----------------------------------------------------------------------------
+
+TableRow::TableRow( const TableModelRef& xTableModel, sal_Int32 nRow, sal_Int32 nColumns )
+: TableRowBase( getStaticPropertySetInfo() )
+, mxTableModel( xTableModel )
+, mnRow( nRow )
+, mnHeight( 0 )
+, mbOptimalHeight( sal_True )
+, mbIsVisible( sal_True )
+, mbIsStartOfNewPage( sal_False )
+{
+ if( nColumns < 20 )
+ maCells.reserve( 20 );
+
+ if( nColumns )
+ {
+ maCells.resize( nColumns );
+ while( nColumns-- )
+ maCells[ nColumns ] = mxTableModel->createCell();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+TableRow::~TableRow()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void TableRow::dispose()
+{
+ mxTableModel.clear();
+ if( !maCells.empty() )
+ {
+ CellVector::iterator aIter( maCells.begin() );
+ while( aIter != maCells.end() )
+ (*aIter++)->dispose();
+ CellVector().swap(maCells);
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void TableRow::throwIfDisposed() const throw (::com::sun::star::uno::RuntimeException)
+{
+ if( !mxTableModel.is() )
+ throw DisposedException();
+}
+
+// -----------------------------------------------------------------------------
+
+TableRow& TableRow::operator=( const TableRow& r )
+{
+ mnHeight = r.mnHeight;
+ mbOptimalHeight = r.mbOptimalHeight;
+ mbIsVisible = r.mbIsVisible;
+ mbIsStartOfNewPage = r.mbIsStartOfNewPage;
+ maName = r.maName;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------------
+
+void TableRow::insertColumns( sal_Int32 nIndex, sal_Int32 nCount, CellVector::iterator* pIter /* = 0 */ )
+{
+ throwIfDisposed();
+ if( nCount )
+ {
+ if( nIndex >= static_cast< sal_Int32 >( maCells.size() ) )
+ nIndex = static_cast< sal_Int32 >( maCells.size() );
+ if ( pIter )
+ maCells.insert( maCells.begin() + nIndex, *pIter, (*pIter) + nCount );
+ else
+ {
+ maCells.reserve( maCells.size() + nCount );
+ for ( sal_Int32 i = 0; i < nCount; i++ )
+ maCells.insert( maCells.begin() + nIndex + i, mxTableModel->createCell() );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void TableRow::removeColumns( sal_Int32 nIndex, sal_Int32 nCount )
+{
+ throwIfDisposed();
+ if( (nCount >= 0) && ( nIndex >= 0) )
+ {
+ if( (nIndex + nCount) < static_cast< sal_Int32 >( maCells.size() ) )
+ {
+ CellVector::iterator aBegin( maCells.begin() );
+ while( nIndex-- && (aBegin != maCells.end()) )
+ aBegin++;
+
+ if( nCount > 1 )
+ {
+ CellVector::iterator aEnd( aBegin );
+ while( nCount-- && (aEnd != maCells.end()) )
+ aEnd++;
+ maCells.erase( aBegin, aEnd );
+ }
+ else
+ {
+ maCells.erase( aBegin );
+ }
+ }
+ else
+ {
+ maCells.resize( nIndex );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+// XCellRange
+// -----------------------------------------------------------------------------
+
+Reference< XCell > SAL_CALL TableRow::getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ throwIfDisposed();
+ if( nRow != 0 )
+ throw IndexOutOfBoundsException();
+
+ return mxTableModel->getCellByPosition( nColumn, mnRow );
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XCellRange > SAL_CALL TableRow::getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ throwIfDisposed();
+ if( (nLeft >= 0 ) && (nTop == 0) && (nRight >= nLeft) && (nBottom == 0) )
+ {
+ return mxTableModel->getCellRangeByPosition( nLeft, mnRow, nRight, mnRow );
+ }
+ throw IndexOutOfBoundsException();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XCellRange > SAL_CALL TableRow::getCellRangeByName( const OUString& /*aRange*/ ) throw (RuntimeException)
+{
+ throwIfDisposed();
+ return Reference< XCellRange >();
+}
+
+// -----------------------------------------------------------------------------
+// XNamed
+// -----------------------------------------------------------------------------
+
+OUString SAL_CALL TableRow::getName() throw (RuntimeException)
+{
+ return maName;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL TableRow::setName( const OUString& aName ) throw (RuntimeException)
+{
+ maName = aName;
+}
+
+// -----------------------------------------------------------------------------
+// XFastPropertySet
+// -----------------------------------------------------------------------------
+
+void SAL_CALL TableRow::setFastPropertyValue( sal_Int32 nHandle, const Any& aValue ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, RuntimeException)
+{
+ bool bOk = false;
+ bool bChange = false;
+
+ TableRowUndo* pUndo = 0;
+
+ SdrModel* pModel = mxTableModel->getSdrTableObj()->GetModel();
+
+ const bool bUndo = mxTableModel.is() && mxTableModel->getSdrTableObj() && mxTableModel->getSdrTableObj()->IsInserted() && pModel && pModel->IsUndoEnabled();
+
+ if( bUndo )
+ {
+ TableRowRef xThis( this );
+ pUndo = new TableRowUndo( xThis );
+ }
+
+ switch( nHandle )
+ {
+ case Property_Height:
+ {
+ sal_Int32 nHeight = mnHeight;
+ bOk = aValue >>= nHeight;
+ if( bOk && (mnHeight != nHeight) )
+ {
+ mnHeight = nHeight;
+ mbOptimalHeight = mnHeight == 0;
+ bChange = true;
+ }
+ break;
+ }
+
+ case Property_OptimalHeight:
+ {
+ sal_Bool bOptimalHeight = mbOptimalHeight;
+ bOk = aValue >>= bOptimalHeight;
+ if( bOk && (mbOptimalHeight != bOptimalHeight) )
+ {
+ mbOptimalHeight = bOptimalHeight;
+ if( bOptimalHeight )
+ mnHeight = 0;
+ bChange = true;
+ }
+ break;
+ }
+ case Property_IsVisible:
+ {
+ sal_Bool bIsVisible = mbIsVisible;
+ bOk = aValue >>= bIsVisible;
+ if( bOk && (mbIsVisible != bIsVisible) )
+ {
+ mbIsVisible = bIsVisible;
+ bChange = true;
+ }
+ break;
+ }
+
+ case Property_IsStartOfNewPage:
+ {
+ sal_Bool bIsStartOfNewPage = mbIsStartOfNewPage;
+ bOk = aValue >>= bIsStartOfNewPage;
+ if( bOk && (mbIsStartOfNewPage != bIsStartOfNewPage) )
+ {
+ mbIsStartOfNewPage = bIsStartOfNewPage;
+ bChange = true;
+ }
+ break;
+ }
+ default:
+ throw UnknownPropertyException();
+ }
+ if( !bOk )
+ throw IllegalArgumentException();
+
+ if( bChange )
+ {
+ if( pUndo )
+ {
+ pModel->AddUndo( pUndo );
+ pUndo = 0;
+ }
+ mxTableModel->setModified(sal_True);
+ }
+
+ if( pUndo )
+ delete pUndo;
+}
+
+// -----------------------------------------------------------------------------
+
+Any SAL_CALL TableRow::getFastPropertyValue( sal_Int32 nHandle ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ switch( nHandle )
+ {
+ case Property_Height: return Any( mnHeight );
+ case Property_OptimalHeight: return Any( mbOptimalHeight );
+ case Property_IsVisible: return Any( mbIsVisible );
+ case Property_IsStartOfNewPage: return Any( mbIsStartOfNewPage );
+ default: throw UnknownPropertyException();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+rtl::Reference< ::comphelper::FastPropertySetInfo > TableRow::getStaticPropertySetInfo()
+{
+ static rtl::Reference< ::comphelper::FastPropertySetInfo > xInfo;
+ if( !xInfo.is() )
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !xInfo.is() )
+ {
+ comphelper::PropertyVector aProperties(6);
+
+ aProperties[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) );
+ aProperties[0].Handle = Property_Height;
+ aProperties[0].Type = ::getCppuType((const sal_Int32*)0);
+ aProperties[0].Attributes = 0;
+
+ aProperties[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "OptimalHeight" ) );
+ aProperties[1].Handle = Property_OptimalHeight;
+ aProperties[1].Type = ::getBooleanCppuType();
+ aProperties[1].Attributes = 0;
+
+ aProperties[2].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsVisible" ) );
+ aProperties[2].Handle = Property_IsVisible;
+ aProperties[2].Type = ::getBooleanCppuType();
+ aProperties[2].Attributes = 0;
+
+ aProperties[3].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsStartOfNewPage" ) );
+ aProperties[3].Handle = Property_IsStartOfNewPage;
+ aProperties[3].Type = ::getBooleanCppuType();
+ aProperties[3].Attributes = 0;
+
+ aProperties[4].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Size" ) );
+ aProperties[4].Handle = Property_Height;
+ aProperties[4].Type = ::getCppuType((const sal_Int32*)0);
+ aProperties[4].Attributes = 0;
+
+ aProperties[5].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "OptimalSize" ) );
+ aProperties[5].Handle = Property_OptimalHeight;
+ aProperties[5].Type = ::getBooleanCppuType();
+ aProperties[5].Attributes = 0;
+
+ xInfo.set( new ::comphelper::FastPropertySetInfo(aProperties) );
+ }
+ }
+
+ return xInfo;
+}
+
+// -----------------------------------------------------------------------------
+
+
+} }
diff --git a/svx/source/table/tablerow.hxx b/svx/source/table/tablerow.hxx
new file mode 100644
index 000000000000..4d1009c8f6b8
--- /dev/null
+++ b/svx/source/table/tablerow.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_TABLEROW_HXX_
+#define _SVX_TABLEROW_HXX_
+
+#include <com/sun/star/table/XCellRange.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <cppuhelper/implbase2.hxx>
+
+#include "propertyset.hxx"
+#include "tablemodel.hxx"
+
+// -----------------------------------------------------------------------------
+
+namespace sdr { namespace table {
+
+// -----------------------------------------------------------------------------
+// TableRow
+// -----------------------------------------------------------------------------
+
+typedef ::cppu::ImplInheritanceHelper2< ::comphelper::FastPropertySet, ::com::sun::star::table::XCellRange, ::com::sun::star::container::XNamed > TableRowBase;
+
+class TableRow : public TableRowBase
+{
+ friend class TableModel;
+ friend class TableRowUndo;
+public:
+ TableRow( const TableModelRef& xTableModel, sal_Int32 nRow, sal_Int32 nColumns );
+ virtual ~TableRow();
+
+ void dispose();
+ void throwIfDisposed() const throw (::com::sun::star::uno::RuntimeException);
+
+ TableRow& operator=( const TableRow& );
+
+ void insertColumns( sal_Int32 nIndex, sal_Int32 nCount, CellVector::iterator* pIter = 0 );
+ void removeColumns( sal_Int32 nIndex, sal_Int32 nCount );
+
+ // XCellRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > SAL_CALL getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL getCellRangeByName( const ::rtl::OUString& aRange ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XNamed
+ virtual ::rtl::OUString SAL_CALL getName() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XFastPropertySet
+ virtual void SAL_CALL setFastPropertyValue( ::sal_Int32 nHandle, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue( ::sal_Int32 nHandle ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ static rtl::Reference< ::comphelper::FastPropertySetInfo > getStaticPropertySetInfo();
+
+ TableModelRef mxTableModel;
+ CellVector maCells;
+ sal_Int32 mnRow;
+ sal_Int32 mnHeight;
+ sal_Bool mbOptimalHeight;
+ sal_Bool mbIsVisible;
+ sal_Bool mbIsStartOfNewPage;
+ ::rtl::OUString maName;
+};
+
+} }
+
+#endif
diff --git a/svx/source/table/tablerows.cxx b/svx/source/table/tablerows.cxx
new file mode 100644
index 000000000000..2b995dfa896d
--- /dev/null
+++ b/svx/source/table/tablerows.cxx
@@ -0,0 +1,136 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <com/sun/star/lang/DisposedException.hpp>
+
+#include "cell.hxx"
+#include "tablerow.hxx"
+#include "tablerows.hxx"
+
+// -----------------------------------------------------------------------------
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::table;
+
+// -----------------------------------------------------------------------------
+
+namespace sdr { namespace table {
+
+// -----------------------------------------------------------------------------
+// TableRows
+// -----------------------------------------------------------------------------
+
+TableRows::TableRows( const TableModelRef& xTableModel )
+: mxTableModel( xTableModel )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+TableRows::~TableRows()
+{
+ dispose();
+}
+
+// -----------------------------------------------------------------------------
+
+void TableRows::dispose()
+{
+ mxTableModel.clear();
+}
+
+// -----------------------------------------------------------------------------
+
+void TableRows::throwIfDisposed() const throw (::com::sun::star::uno::RuntimeException)
+{
+ if( !mxTableModel.is() )
+ throw DisposedException();
+}
+
+// -----------------------------------------------------------------------------
+// XTableRows
+// -----------------------------------------------------------------------------
+
+void SAL_CALL TableRows::insertByIndex( sal_Int32 nIndex, sal_Int32 nCount ) throw (RuntimeException)
+{
+ throwIfDisposed();
+ mxTableModel->insertRows( nIndex, nCount );
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL TableRows::removeByIndex( sal_Int32 nIndex, sal_Int32 nCount ) throw (RuntimeException)
+{
+ throwIfDisposed();
+ mxTableModel->removeRows( nIndex, nCount );
+}
+
+// -----------------------------------------------------------------------------
+// XIndexAccess
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL TableRows::getCount() throw (RuntimeException)
+{
+ throwIfDisposed();
+ return mxTableModel->getRowCount();
+}
+
+// -----------------------------------------------------------------------------
+
+Any SAL_CALL TableRows::getByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
+{
+ throwIfDisposed();
+ return Any( Reference< XCellRange >( static_cast< XCellRange* >( mxTableModel->getRow( Index ).get() ) ) );
+}
+
+// -----------------------------------------------------------------------------
+// XElementAccess
+// -----------------------------------------------------------------------------
+
+Type SAL_CALL TableRows::getElementType() throw (RuntimeException)
+{
+ throwIfDisposed();
+ return XCellRange::static_type();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL TableRows::hasElements() throw (RuntimeException)
+{
+ throwIfDisposed();
+ return mxTableModel->getRowCount() != 0;
+}
+
+// -----------------------------------------------------------------------------
+
+} }
diff --git a/svx/source/table/tablerows.hxx b/svx/source/table/tablerows.hxx
new file mode 100644
index 000000000000..47d5b19832f0
--- /dev/null
+++ b/svx/source/table/tablerows.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_TABLEROWS_HXX_
+#define _SVX_TABLEROWS_HXX_
+
+#include <com/sun/star/table/XTableRows.hpp>
+#include <cppuhelper/implbase1.hxx>
+
+#include "tablemodel.hxx"
+
+// -----------------------------------------------------------------------------
+
+namespace sdr { namespace table {
+
+// -----------------------------------------------------------------------------
+// TableRows
+// -----------------------------------------------------------------------------
+
+class TableRows : public ::cppu::WeakAggImplHelper1< ::com::sun::star::table::XTableRows >
+{
+public:
+ TableRows( const TableModelRef& xTableModel );
+ virtual ~TableRows();
+
+ void dispose();
+ void throwIfDisposed() const throw (::com::sun::star::uno::RuntimeException);
+
+ // XTableRows
+ virtual void SAL_CALL insertByIndex( sal_Int32 nIndex, sal_Int32 nCount ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeByIndex( sal_Int32 nIndex, sal_Int32 nCount ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // Methods
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasElements() throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ TableModelRef mxTableModel;
+};
+
+} }
+
+#endif
diff --git a/svx/source/table/tablertfexporter.cxx b/svx/source/table/tablertfexporter.cxx
new file mode 100644
index 000000000000..6fdb0f6c8be7
--- /dev/null
+++ b/svx/source/table/tablertfexporter.cxx
@@ -0,0 +1,284 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <vector>
+
+#include <com/sun/star/table/XTable.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <tools/stream.hxx>
+#include <svtools/rtfkeywd.hxx>
+#include <svtools/rtfout.hxx>
+
+#include <editeng/eeitem.hxx>
+#include <svx/sdtaitm.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/udlnitem.hxx>
+
+#include "cell.hxx"
+#include "celltypes.hxx"
+#include "svx/svdotable.hxx"
+#include "svx/svdoutl.hxx"
+#include "editeng/editeng.hxx"
+#include "editeng/outlobj.hxx"
+
+//#include <tablertfexporter.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+
+namespace sdr { namespace table {
+
+class SdrTableRtfExporter
+{
+public:
+ SdrTableRtfExporter( SvStream& rStrmP, SdrTableObj& rObj );
+ sal_uLong Write();
+ void WriteRow( const Reference< XPropertySet >& xRowSet, sal_Int32 nRow, const std::vector< sal_Int32 >& aColumnStart );
+ void WriteCell( sal_Int32 nCol, sal_Int32 nRow );
+
+private:
+ SvStream& mrStrm;
+ SdrTableObj& mrObj;
+ Reference< XTable > mxTable;
+ const OUString msSize;
+};
+
+void SdrTableObj::ExportAsRTF( SvStream& rStrm, SdrTableObj& rObj )
+{
+ SdrTableRtfExporter aEx( rStrm, rObj );
+ aEx.Write();
+}
+
+SdrTableRtfExporter::SdrTableRtfExporter( SvStream& rStrm, SdrTableObj& rObj )
+: mrStrm( rStrm )
+, mrObj( rObj )
+, mxTable( rObj.getTable() )
+, msSize( RTL_CONSTASCII_USTRINGPARAM("Size") )
+{
+}
+
+long HundMMToTwips( long nIn )
+{
+ long nRet = OutputDevice::LogicToLogic( nIn, MAP_100TH_MM, MAP_TWIP );
+ return nRet;
+}
+
+sal_uLong SdrTableRtfExporter::Write()
+{
+ mrStrm << '{' << OOO_STRING_SVTOOLS_RTF_RTF;
+ mrStrm << OOO_STRING_SVTOOLS_RTF_ANSI << RTFOutFuncs::sNewLine;
+
+ Reference< XTableColumns > xColumns( mxTable->getColumns() );
+ const sal_Int32 nColCount = xColumns->getCount();
+
+ std::vector< sal_Int32 > aColumnStart;
+ aColumnStart.reserve( nColCount );
+
+ // determine right offset of cells
+ sal_Int32 nPos = 0;
+ for( sal_Int32 nCol = 0; nCol < nColCount; nCol++ ) try
+ {
+ Reference< XPropertySet > xSet( xColumns->getByIndex(nCol), UNO_QUERY_THROW );
+ sal_Int32 nWidth = 0;
+ xSet->getPropertyValue( msSize ) >>= nWidth;
+ nPos += HundMMToTwips( nWidth );
+ aColumnStart.push_back( nPos );
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ DBG_ERROR("SdrTableRtfExporter::Write(), exception caught!");
+ }
+
+ // export rows
+ Reference< XTableRows > xRows( mxTable->getRows() );
+ const sal_Int32 nRowCount = xRows->getCount();
+
+ for( sal_Int32 nRow = 0; nRow < nRowCount; nRow++ ) try
+ {
+ Reference< XPropertySet > xRowSet( xRows->getByIndex(nRow), UNO_QUERY_THROW );
+ WriteRow( xRowSet, nRow, aColumnStart );
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ DBG_ERROR("SdrTableRtfExporter::Write(), exception caught!");
+ }
+
+ mrStrm << '}' << RTFOutFuncs::sNewLine;
+ return mrStrm.GetError();
+}
+
+void SdrTableRtfExporter::WriteRow( const Reference< XPropertySet >& xRowSet, sal_Int32 nRow, const std::vector< sal_Int32 >& aColumnStart )
+{
+ sal_Int32 nRowHeight = 0;
+ xRowSet->getPropertyValue( msSize ) >>= nRowHeight;
+
+ mrStrm << OOO_STRING_SVTOOLS_RTF_TROWD << OOO_STRING_SVTOOLS_RTF_TRGAPH << "30" << OOO_STRING_SVTOOLS_RTF_TRLEFT << "-30";
+ mrStrm << OOO_STRING_SVTOOLS_RTF_TRRH << ByteString::CreateFromInt32( nRowHeight ).GetBuffer();
+
+ const sal_Int32 nColCount = mxTable->getColumnCount();
+ for( sal_Int32 nCol = 0; nCol < nColCount; nCol++ )
+ {
+ CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
+
+ if( !xCell.is() )
+ continue;
+
+/*
+ const sal_Bool bIsMerged = xCell->isMerged();
+ const sal_Int32 nRowSpan = xCell->getRowSpan();
+ const sal_Int32 nColSpan = xCell->getColumnSpan();
+
+ const sal_Char* pChar;
+
+ if( !bIsMerged && ((nRowSpan > 1) || (nColSpan > 1)) )
+ mrStrm << OOO_STRING_SVTOOLS_RTF_CLMGF; // The first cell in a range of table cells to be merged.
+
+ SdrTextVertAdjust eVAdj = xCell->GetTextVerticalAdjust();
+ switch( eVAdj )
+ {
+ case SVX_VER_JUSTIFY_TOP: pChar = OOO_STRING_SVTOOLS_RTF_CLVERTALT; break;
+ case SVX_VER_JUSTIFY_CENTER: pChar = OOO_STRING_SVTOOLS_RTF_CLVERTALC; break;
+ case SVX_VER_JUSTIFY_BOTTOM: pChar = OOO_STRING_SVTOOLS_RTF_CLVERTALB; break;
+ case SVX_VER_JUSTIFY_STANDARD: pChar = OOO_STRING_SVTOOLS_RTF_CLVERTALB; break; //! Bottom
+ default: pChar = NULL; break;
+ }
+ if ( pChar )
+ mrStrm << pChar;
+*/
+ mrStrm << OOO_STRING_SVTOOLS_RTF_CELLX << ByteString::CreateFromInt32( aColumnStart[nCol] ).GetBuffer();
+ if ( (nCol & 0x0F) == 0x0F )
+ mrStrm << RTFOutFuncs::sNewLine; // Zeilen nicht zu lang werden lassen
+ }
+ mrStrm << OOO_STRING_SVTOOLS_RTF_PARD << OOO_STRING_SVTOOLS_RTF_PLAIN << OOO_STRING_SVTOOLS_RTF_INTBL << RTFOutFuncs::sNewLine;
+
+ sal_uLong nStrmPos = mrStrm.Tell();
+ for( sal_Int32 nCol = 0; nCol < nColCount; nCol++ )
+ {
+ WriteCell( nCol, nRow );
+ if ( mrStrm.Tell() - nStrmPos > 255 )
+ {
+ mrStrm << RTFOutFuncs::sNewLine;
+ nStrmPos = mrStrm.Tell();
+ }
+ }
+ mrStrm << OOO_STRING_SVTOOLS_RTF_ROW << RTFOutFuncs::sNewLine;
+}
+
+
+void SdrTableRtfExporter::WriteCell( sal_Int32 nCol, sal_Int32 nRow )
+{
+ CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
+
+ if( !xCell.is() || xCell->isMerged() )
+ {
+ mrStrm << OOO_STRING_SVTOOLS_RTF_CELL;
+ return ;
+ }
+
+ String aContent;
+
+ OutlinerParaObject* pParaObj = xCell->GetEditOutlinerParaObject();
+ bool bOwnParaObj = pParaObj != 0;
+
+ if( pParaObj == 0 )
+ pParaObj = xCell->GetOutlinerParaObject();
+
+ if(pParaObj)
+ {
+ // handle outliner attributes
+ SdrOutliner& rOutliner = mrObj.ImpGetDrawOutliner();
+ rOutliner.SetText(*pParaObj);
+
+ aContent = rOutliner.GetEditEngine().GetText( LINEEND_LF );
+
+ rOutliner.Clear();
+
+ if( bOwnParaObj )
+ delete pParaObj;
+ }
+
+ bool bResetPar, bResetAttr;
+ bResetPar = bResetAttr = sal_False;
+
+ SdrTextHorzAdjust eHAdj = xCell->GetTextHorizontalAdjust();
+
+ const SfxItemSet& rCellSet = xCell->GetItemSet();
+
+ const SvxWeightItem& rWeightItem = (const SvxWeightItem&) rCellSet.Get( EE_CHAR_WEIGHT );
+ const SvxPostureItem& rPostureItem = (const SvxPostureItem&) rCellSet.Get( EE_CHAR_ITALIC );
+ const SvxUnderlineItem& rUnderlineItem = (const SvxUnderlineItem&) rCellSet.Get( EE_CHAR_UNDERLINE );
+
+ const sal_Char* pChar;
+
+ switch( eHAdj )
+ {
+ case SDRTEXTHORZADJUST_CENTER: pChar = OOO_STRING_SVTOOLS_RTF_QC; break;
+ case SDRTEXTHORZADJUST_BLOCK: pChar = OOO_STRING_SVTOOLS_RTF_QJ; break;
+ case SDRTEXTHORZADJUST_RIGHT: pChar = OOO_STRING_SVTOOLS_RTF_QR; break;
+ case SDRTEXTHORZADJUST_LEFT:
+ default: pChar = OOO_STRING_SVTOOLS_RTF_QL; break;
+ }
+ mrStrm << pChar;
+
+ if ( rWeightItem.GetWeight() >= WEIGHT_BOLD )
+ { // bold
+ bResetAttr = true;
+ mrStrm << OOO_STRING_SVTOOLS_RTF_B;
+ }
+ if ( rPostureItem.GetPosture() != ITALIC_NONE )
+ { // italic
+ bResetAttr = true;
+ mrStrm << OOO_STRING_SVTOOLS_RTF_I;
+ }
+ if ( rUnderlineItem.GetLineStyle() != UNDERLINE_NONE )
+ { // underline
+ bResetAttr = true;
+ mrStrm << OOO_STRING_SVTOOLS_RTF_UL;
+ }
+
+ mrStrm << ' ';
+ RTFOutFuncs::Out_String( mrStrm, aContent );
+ mrStrm << OOO_STRING_SVTOOLS_RTF_CELL;
+
+ if ( bResetPar )
+ mrStrm << OOO_STRING_SVTOOLS_RTF_PARD << OOO_STRING_SVTOOLS_RTF_INTBL;
+ if ( bResetAttr )
+ mrStrm << OOO_STRING_SVTOOLS_RTF_PLAIN;
+}
+
+} }
+
diff --git a/svx/source/table/tablertfimporter.cxx b/svx/source/table/tablertfimporter.cxx
new file mode 100644
index 000000000000..530732796c05
--- /dev/null
+++ b/svx/source/table/tablertfimporter.cxx
@@ -0,0 +1,447 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+#include <com/sun/star/table/XTable.hpp>
+
+#include <tools/stream.hxx>
+#include <svtools/rtftoken.h>
+
+#include <editeng/eeitem.hxx>
+#include <svx/svdetc.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/outlobj.hxx>
+
+#include "cell.hxx"
+#include "celltypes.hxx"
+#include "svx/svdotable.hxx"
+#include "svx/svdoutl.hxx"
+#include "editeng/editeng.hxx"
+#include "editeng/editdata.hxx"
+#include "svx/svdmodel.hxx"
+#include "editeng/svxrtf.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+
+namespace sdr { namespace table {
+
+struct RTFCellDefault
+{
+ SfxItemSet maItemSet;
+ sal_Int32 mnCol;
+ sal_uInt16 mnTwips; // right border of the cell
+ sal_Int32 mnColSpan; // MergeCell if >1, merged cells if 0
+
+ RTFCellDefault( SfxItemPool* pPool ) : maItemSet( *pPool ), mnCol(0), mnTwips(0 ), mnColSpan(1) {}
+};
+
+typedef std::vector< boost::shared_ptr< RTFCellDefault > > RTFCellDefaultVector;
+
+struct RTFCellInfo
+{
+ SfxItemSet maItemSet;
+ sal_Int32 mnStartPara;
+ sal_Int32 mnParaCount;
+ sal_Int32 mnColSpan;
+
+ RTFCellInfo( SfxItemPool& rPool ) : maItemSet( rPool ), mnStartPara(0), mnParaCount(0), mnColSpan(0) {}
+};
+
+typedef boost::shared_ptr< RTFCellInfo > RTFCellInfoPtr;
+typedef std::vector< RTFCellInfoPtr > RTFColumnVector;
+
+typedef boost::shared_ptr< RTFColumnVector > RTFColumnVectorPtr;
+
+typedef std::vector< RTFColumnVectorPtr > RTFRowVector;
+
+class SdrTableRTFParser
+{
+public:
+ SdrTableRTFParser( SdrTableObj& rTableObj );
+ ~SdrTableRTFParser();
+
+ void Read( SvStream& rStream );
+
+ void ProcToken( ImportInfo* pInfo );
+
+ void NextRow();
+ void NextColumn();
+ void NewCellRow();
+
+ void InsertCell( ImportInfo* pInfo );
+
+ void FillTable();
+
+ DECL_LINK( RTFImportHdl, ImportInfo* );
+
+private:
+ SdrTableObj& mrTableObj;
+ SdrOutliner* mpOutliner;
+ SfxItemPool& mrItemPool;
+
+ RTFCellDefaultVector maDefaultList;
+ RTFCellDefaultVector::iterator maDefaultIterator;
+
+ int mnLastToken;
+ sal_Int32 mnLastWidth;
+ bool mbNewDef;
+
+ sal_uInt16 mnStartPara;
+
+ sal_Int32 mnColCnt;
+ sal_Int32 mnRowCnt;
+ sal_Int32 mnColMax;
+
+ std::vector< sal_Int32 > maColumnEdges;
+
+ RTFRowVector maRows;
+
+ RTFCellDefault* mpInsDefault;
+ RTFCellDefault* mpActDefault;
+ RTFCellDefault* mpDefMerge;
+
+ Reference< XTable > mxTable;
+};
+
+SdrTableRTFParser::SdrTableRTFParser( SdrTableObj& rTableObj )
+: mrTableObj( rTableObj )
+, mpOutliner( SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, rTableObj.GetModel() ) )
+, mrItemPool( rTableObj.GetModel()->GetItemPool() )
+, mnLastToken( 0 )
+, mnLastWidth( 0 )
+, mbNewDef( false )
+, mnStartPara( 0 )
+, mnColCnt( 0 )
+, mnRowCnt( 0 )
+, mnColMax( 0 )
+, mpActDefault( 0 )
+, mpDefMerge( 0 )
+, mxTable( rTableObj.getTable() )
+{
+ mpOutliner->SetUpdateMode(sal_True);
+ mpOutliner->SetStyleSheet( 0, mrTableObj.GetStyleSheet() );
+ mpInsDefault = new RTFCellDefault( &mrItemPool );
+}
+
+SdrTableRTFParser::~SdrTableRTFParser()
+{
+ delete mpOutliner;
+ delete mpInsDefault;
+}
+
+void SdrTableRTFParser::Read( SvStream& rStream )
+{
+ EditEngine& rEdit = const_cast< EditEngine& >( mpOutliner->GetEditEngine() );
+
+ Link aOldLink( rEdit.GetImportHdl() );
+ rEdit.SetImportHdl( LINK( this, SdrTableRTFParser, RTFImportHdl ) );
+ mpOutliner->Read( rStream, String(), EE_FORMAT_RTF );
+ rEdit.SetImportHdl( aOldLink );
+
+ FillTable();
+}
+
+IMPL_LINK( SdrTableRTFParser, RTFImportHdl, ImportInfo*, pInfo )
+{
+ switch ( pInfo->eState )
+ {
+ case RTFIMP_NEXTTOKEN:
+ ProcToken( pInfo );
+ break;
+ case RTFIMP_UNKNOWNATTR:
+ ProcToken( pInfo );
+ break;
+ case RTFIMP_START:
+ {
+ SvxRTFParser* pParser = (SvxRTFParser*) pInfo->pParser;
+ pParser->SetAttrPool( &mrItemPool );
+ RTFPardAttrMapIds& rMap = pParser->GetPardMap();
+ rMap.nBox = SDRATTR_TABLE_BORDER;
+ }
+ break;
+ case RTFIMP_END:
+ if ( pInfo->aSelection.nEndPos )
+ {
+ mpActDefault = NULL;
+ pInfo->nToken = RTF_PAR;
+ pInfo->aSelection.nEndPara++;
+ ProcToken( pInfo );
+ }
+ break;
+ case RTFIMP_SETATTR:
+ break;
+ case RTFIMP_INSERTTEXT:
+ break;
+ case RTFIMP_INSERTPARA:
+ break;
+ default:
+ DBG_ERRORFILE("unknown ImportInfo.eState");
+ }
+ return 0;
+}
+
+void SdrTableRTFParser::NextRow()
+{
+ ++mnRowCnt;
+}
+
+void SdrTableRTFParser::InsertCell( ImportInfo* pInfo )
+{
+ sal_Int32 nCol = mpActDefault->mnCol;
+
+ RTFCellInfoPtr xCellInfo( new RTFCellInfo(mrItemPool) );
+
+ xCellInfo->mnStartPara = mnStartPara;
+ xCellInfo->mnParaCount = pInfo->aSelection.nEndPara - 1 - mnStartPara;
+
+ if( !maRows.empty() )
+ {
+ RTFColumnVectorPtr xColumn( maRows.back() );
+
+ if( xColumn->size() <= (size_t)nCol )
+ xColumn->resize( nCol+1 );
+
+ (*xColumn)[nCol] = xCellInfo;
+ }
+
+ mnStartPara = pInfo->aSelection.nEndPara - 1;
+}
+
+void SdrTableRTFParser::FillTable()
+{
+ try
+ {
+ sal_Int32 nColCount = mxTable->getColumnCount();
+ Reference< XTableColumns > xCols( mxTable->getColumns(), UNO_QUERY_THROW );
+
+ if( nColCount < mnColMax )
+ {
+ xCols->insertByIndex( nColCount, mnColMax - nColCount );
+ nColCount = mxTable->getColumnCount();
+ }
+
+ const OUString sWidth( RTL_CONSTASCII_USTRINGPARAM("Width") );
+ sal_Int32 nCol, nLastEdge = 0;
+ for( nCol = 0; nCol < nColCount; nCol++ )
+ {
+ Reference< XPropertySet > xSet( xCols->getByIndex( nCol ), UNO_QUERY_THROW );
+ sal_Int32 nWidth = maColumnEdges[nCol] - nLastEdge;
+
+ xSet->setPropertyValue( sWidth, Any( nWidth ) );
+ nLastEdge += nWidth;
+ }
+
+ const sal_Int32 nRowCount = mxTable->getRowCount();
+ if( nRowCount < mnRowCnt )
+ {
+ Reference< XTableRows > xRows( mxTable->getRows(), UNO_QUERY_THROW );
+ xRows->insertByIndex( nRowCount, mnRowCnt - nRowCount );
+ }
+
+ for( sal_Int32 nRow = 0; nRow < (sal_Int32)maRows.size(); nRow++ )
+ {
+ RTFColumnVectorPtr xColumn( maRows[nRow] );
+ for( nCol = 0; nCol < (sal_Int32)xColumn->size(); nCol++ )
+ {
+ RTFCellInfoPtr xCellInfo( (*xColumn)[nCol] );
+
+ CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
+ if( xCell.is() && xCellInfo.get() )
+ {
+ const SfxPoolItem *pPoolItem = 0;
+ if( xCellInfo->maItemSet.GetItemState(SDRATTR_TABLE_BORDER,sal_False,&pPoolItem)==SFX_ITEM_SET)
+ xCell->SetMergedItem( *pPoolItem );
+
+ String sDebug = mpOutliner->GetText( mpOutliner->GetParagraph( xCellInfo->mnStartPara ), xCellInfo->mnParaCount );
+
+ OutlinerParaObject* pTextObject = mpOutliner->CreateParaObject( (sal_uInt16)xCellInfo->mnStartPara, (sal_uInt16)xCellInfo->mnParaCount );
+ if( pTextObject )
+ {
+ SdrOutliner& rOutliner=mrTableObj.ImpGetDrawOutliner();
+ rOutliner.SetUpdateMode(sal_True);
+ rOutliner.SetText( *pTextObject );
+ mrTableObj.NbcSetOutlinerParaObjectForText( rOutliner.CreateParaObject(), xCell.get() );
+ delete pTextObject;
+ }
+ }
+ }
+ }
+
+ Rectangle aRect( mrTableObj.GetSnapRect() );
+ aRect.nRight = aRect.nLeft + nLastEdge;
+ mrTableObj.NbcSetSnapRect( aRect );
+
+ }
+ catch( Exception& e )
+ {
+ (void)e;
+ DBG_ERROR("sdr::table::SdrTableRTFParser::InsertCell(), exception caught!" );
+ }
+}
+
+void SdrTableRTFParser::NewCellRow()
+{
+ if( mbNewDef )
+ {
+ mbNewDef = sal_False;
+
+ maRows.push_back( RTFColumnVectorPtr( new RTFColumnVector() ) );
+ }
+ mpDefMerge = NULL;
+ maDefaultIterator = maDefaultList.begin();
+
+ NextColumn();
+
+ DBG_ASSERT( mpActDefault, "NewCellRow: pActDefault==0" );
+}
+
+void SdrTableRTFParser::NextColumn()
+{
+ if( maDefaultIterator != maDefaultList.end() )
+ mpActDefault = (*maDefaultIterator++).get();
+ else
+ mpActDefault = 0;
+}
+
+long TwipsToHundMM( long nIn )
+{
+ long nRet = OutputDevice::LogicToLogic( nIn, MAP_TWIP, MAP_100TH_MM );
+ return nRet;
+}
+
+void SdrTableRTFParser::ProcToken( ImportInfo* pInfo )
+{
+ switch ( pInfo->nToken )
+ {
+ case RTF_TROWD: // denotes table row defauls, before RTF_CELLX
+ {
+ mnColCnt = 0;
+ maDefaultList.clear();
+ mpDefMerge = NULL;
+ mnLastToken = pInfo->nToken;
+ }
+ break;
+ case RTF_CLMGF: // The first cell of cells to be merged
+ {
+ mpDefMerge = mpInsDefault;
+ mnLastToken = pInfo->nToken;
+ }
+ break;
+ case RTF_CLMRG: // A cell to be merged with the preceding cell
+ {
+ if ( !mpDefMerge )
+ mpDefMerge = maDefaultList.back().get();
+ DBG_ASSERT( mpDefMerge, "RTF_CLMRG: pDefMerge==0" );
+ if( mpDefMerge )
+ mpDefMerge->mnColSpan++;
+ mpInsDefault->mnColSpan = 0;
+ mnLastToken = pInfo->nToken;
+ }
+ break;
+ case RTF_CELLX: // closes cell default
+ {
+ mbNewDef = sal_True;
+ mpInsDefault->mnCol = mnColCnt;
+ maDefaultList.push_back( boost::shared_ptr< RTFCellDefault >( mpInsDefault ) );
+
+ if( (sal_Int32)maColumnEdges.size() <= mnColCnt )
+ maColumnEdges.resize( mnColCnt + 1 );
+
+ const sal_Int32 nSize = TwipsToHundMM( pInfo->nTokenValue );
+ maColumnEdges[mnColCnt] = std::max( maColumnEdges[mnColCnt], nSize );
+
+ mpInsDefault = new RTFCellDefault( &mrItemPool );
+ if ( ++mnColCnt > mnColMax )
+ mnColMax = mnColCnt;
+ mnLastToken = pInfo->nToken;
+ }
+ break;
+ case RTF_INTBL: // before the first RTF_CELL
+ {
+ if ( mnLastToken != RTF_INTBL && mnLastToken != RTF_CELL && mnLastToken != RTF_PAR )
+ {
+ NewCellRow();
+ mnLastToken = pInfo->nToken;
+ }
+ }
+ break;
+ case RTF_CELL: // denotes the end of a cell.
+ {
+ DBG_ASSERT( mpActDefault, "RTF_CELL: pActDefault==0" );
+ if ( mbNewDef || !mpActDefault )
+ NewCellRow();
+ if ( !mpActDefault )
+ mpActDefault = mpInsDefault;
+ if ( mpActDefault->mnColSpan > 0 )
+ {
+ InsertCell(pInfo);
+ }
+ NextColumn();
+ mnLastToken = pInfo->nToken;
+ }
+ break;
+ case RTF_ROW: // means the end of a row
+ {
+ NextRow();
+ mnLastToken = pInfo->nToken;
+ }
+ break;
+ case RTF_PAR: // Paragraph
+ mnLastToken = pInfo->nToken;
+ break;
+ default:
+ { // do not set nLastToken
+ switch ( pInfo->nToken & ~(0xff | RTF_TABLEDEF) )
+ {
+ case RTF_SHADINGDEF:
+// ((SvxRTFParser*)pInfo->pParser)->ReadBackgroundAttr(pInfo->nToken, mpInsDefault->maItemSet, sal_True );
+ break;
+ case RTF_BRDRDEF:
+ ((SvxRTFParser*)pInfo->pParser)->ReadBorderAttr(pInfo->nToken, mpInsDefault->maItemSet, sal_True );
+ break;
+ }
+ }
+ }
+}
+
+void SdrTableObj::ImportAsRTF( SvStream& rStream, SdrTableObj& rObj )
+{
+ SdrTableRTFParser aParser( rObj );
+ aParser.Read( rStream );
+}
+
+} }
+
diff --git a/svx/source/table/tableundo.cxx b/svx/source/table/tableundo.cxx
new file mode 100644
index 000000000000..9b3f5e293070
--- /dev/null
+++ b/svx/source/table/tableundo.cxx
@@ -0,0 +1,559 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svx/sdr/properties/textproperties.hxx"
+#include "editeng/outlobj.hxx"
+
+#include "cell.hxx"
+#include "tableundo.hxx"
+#include "svx/svdotable.hxx"
+#include "tablerow.hxx"
+#include "tablecolumn.hxx"
+
+
+// -----------------------------------------------------------------------------
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::table;
+
+// -----------------------------------------------------------------------------
+
+namespace sdr { namespace table {
+
+CellUndo::CellUndo( const SdrObjectWeakRef& xObjRef, const CellRef& xCell )
+: SdrUndoAction( *xCell->GetModel() )
+, mxObjRef( xObjRef )
+, mxCell( xCell )
+, mbUndo( true )
+{
+ if( mxCell.is() && mxObjRef.is() )
+ {
+ getDataFromCell( maUndoData );
+ mxObjRef->AddObjectUser( *this );
+ }
+}
+
+CellUndo::~CellUndo()
+{
+ if( mxObjRef.is() )
+ mxObjRef->RemoveObjectUser( *this );
+ dispose();
+}
+
+void CellUndo::dispose()
+{
+ mxCell.clear();
+ delete maUndoData.mpProperties;
+ maUndoData.mpProperties = 0;
+ delete maRedoData.mpProperties;
+ maRedoData.mpProperties = 0;
+ delete maUndoData.mpOutlinerParaObject;
+ maUndoData.mpOutlinerParaObject = 0;
+ delete maRedoData.mpOutlinerParaObject;
+ maRedoData.mpOutlinerParaObject = 0;
+}
+
+void CellUndo::ObjectInDestruction(const SdrObject& )
+{
+ dispose();
+}
+
+void CellUndo::Undo()
+{
+ if( mxCell.is() && mbUndo )
+ {
+ if( maRedoData.mpProperties == 0 )
+ getDataFromCell( maRedoData );
+
+ setDataToCell( maUndoData );
+ mbUndo = false;
+ }
+}
+
+void CellUndo::Redo()
+{
+ if( mxCell.is() && !mbUndo )
+ {
+ setDataToCell( maRedoData );
+ mbUndo = true;
+ }
+}
+
+sal_Bool CellUndo::Merge( SfxUndoAction *pNextAction )
+{
+ CellUndo* pNext = dynamic_cast< CellUndo* >( pNextAction );
+ if( pNext && pNext->mxCell.get() == mxCell.get() )
+ {
+ return sal_True;
+ }
+ else
+ {
+ return sal_False;
+ }
+}
+
+void CellUndo::setDataToCell( const Data& rData )
+{
+ delete mxCell->mpProperties;
+ if( rData.mpProperties )
+ mxCell->mpProperties = Cell::CloneProperties( rData.mpProperties, *mxObjRef.get(), *mxCell.get() );
+ else
+ mxCell->mpProperties = 0;
+
+ if( rData.mpOutlinerParaObject )
+ mxCell->SetOutlinerParaObject( new OutlinerParaObject(*rData.mpOutlinerParaObject) );
+ else
+ mxCell->RemoveOutlinerParaObject();
+
+ mxCell->msFormula = rData.msFormula;
+ mxCell->mfValue = rData.mfValue;
+ mxCell->mnError = rData.mnError;
+ mxCell->mbMerged = rData.mbMerged;
+ mxCell->mnRowSpan = rData.mnRowSpan;
+ mxCell->mnColSpan = rData.mnColSpan;
+
+ if( mxObjRef.is() )
+ mxObjRef->ActionChanged();
+}
+
+void CellUndo::getDataFromCell( Data& rData )
+{
+ if( mxObjRef.is() && mxCell.is() )
+ {
+ if( mxCell->mpProperties )
+ rData.mpProperties = mxCell->CloneProperties( *mxObjRef.get(), *mxCell.get());
+
+ if( mxCell->GetOutlinerParaObject() )
+ rData.mpOutlinerParaObject = new OutlinerParaObject(*mxCell->GetOutlinerParaObject());
+ else
+ rData.mpOutlinerParaObject = 0;
+
+ rData.mnCellContentType = mxCell->mnCellContentType;
+
+ rData.msFormula = mxCell->msFormula;
+ rData.mfValue = mxCell->mfValue;
+ rData.mnError = mxCell->mnError;
+ rData.mbMerged = mxCell->mbMerged;
+ rData.mnRowSpan = mxCell->mnRowSpan;
+ rData.mnColSpan = mxCell->mnColSpan;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// class InsertRowUndo : public SdrUndoAction
+// -----------------------------------------------------------------------------
+
+static void Dispose( RowVector& rRows )
+{
+ RowVector::iterator aIter( rRows.begin() );
+ while( aIter != rRows.end() )
+ (*aIter++)->dispose();
+}
+
+// -----------------------------------------------------------------------------
+
+InsertRowUndo::InsertRowUndo( const TableModelRef& xTable, sal_Int32 nIndex, RowVector& aNewRows )
+: SdrUndoAction( *xTable->getSdrTableObj()->GetModel() )
+, mxTable( xTable )
+, mnIndex( nIndex )
+, mbUndo( true )
+{
+ maRows.swap( aNewRows );
+}
+
+// -----------------------------------------------------------------------------
+
+InsertRowUndo::~InsertRowUndo()
+{
+ if( !mbUndo )
+ Dispose( maRows );
+}
+
+// -----------------------------------------------------------------------------
+
+void InsertRowUndo::Undo()
+{
+ if( mxTable.is() )
+ {
+ mxTable->UndoInsertRows( mnIndex, sal::static_int_cast< sal_Int32 >( maRows.size() ) );
+ mbUndo = false;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void InsertRowUndo::Redo()
+{
+ if( mxTable.is() )
+ {
+ mxTable->UndoRemoveRows( mnIndex, maRows );
+ mbUndo = true;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// class RemoveRowUndo : public SdrUndoAction
+// -----------------------------------------------------------------------------
+
+RemoveRowUndo::RemoveRowUndo( const TableModelRef& xTable, sal_Int32 nIndex, RowVector& aRemovedRows )
+: SdrUndoAction( *xTable->getSdrTableObj()->GetModel() )
+, mxTable( xTable )
+, mnIndex( nIndex )
+, mbUndo( true )
+{
+ maRows.swap( aRemovedRows );
+}
+
+// -----------------------------------------------------------------------------
+
+RemoveRowUndo::~RemoveRowUndo()
+{
+ if( mbUndo )
+ Dispose( maRows );
+}
+
+// -----------------------------------------------------------------------------
+
+void RemoveRowUndo::Undo()
+{
+ if( mxTable.is() )
+ {
+ mxTable->UndoRemoveRows( mnIndex, maRows );
+ mbUndo = false;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void RemoveRowUndo::Redo()
+{
+ if( mxTable.is() )
+ {
+ mxTable->UndoInsertRows( mnIndex, sal::static_int_cast< sal_Int32 >( maRows.size() ) );
+ mbUndo = true;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// class InsertColUndo : public SdrUndoAction
+// -----------------------------------------------------------------------------
+
+static void Dispose( ColumnVector& rCols )
+{
+ ColumnVector::iterator aIter( rCols.begin() );
+ while( aIter != rCols.end() )
+ (*aIter++)->dispose();
+}
+
+// -----------------------------------------------------------------------------
+
+static void Dispose( CellVector& rCells )
+{
+ CellVector::iterator aIter( rCells.begin() );
+ while( aIter != rCells.end() )
+ (*aIter++)->dispose();
+}
+
+// -----------------------------------------------------------------------------
+
+InsertColUndo::InsertColUndo( const TableModelRef& xTable, sal_Int32 nIndex, ColumnVector& aNewCols, CellVector& aCells )
+: SdrUndoAction( *xTable->getSdrTableObj()->GetModel() )
+, mxTable( xTable )
+, mnIndex( nIndex )
+, mbUndo( true )
+{
+ maColumns.swap( aNewCols );
+ maCells.swap( aCells );
+}
+
+// -----------------------------------------------------------------------------
+
+InsertColUndo::~InsertColUndo()
+{
+ if( !mbUndo )
+ {
+ Dispose( maColumns );
+ Dispose( maCells );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void InsertColUndo::Undo()
+{
+ if( mxTable.is() )
+ {
+ mxTable->UndoInsertColumns( mnIndex, sal::static_int_cast< sal_Int32 >( maColumns.size() ) );
+ mbUndo = false;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void InsertColUndo::Redo()
+{
+ if( mxTable.is() )
+ {
+ mxTable->UndoRemoveColumns( mnIndex, maColumns, maCells );
+ mbUndo = true;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// class RemoveColUndo : public SdrUndoAction
+// -----------------------------------------------------------------------------
+
+RemoveColUndo::RemoveColUndo( const TableModelRef& xTable, sal_Int32 nIndex, ColumnVector& aNewCols, CellVector& aCells )
+: SdrUndoAction( *xTable->getSdrTableObj()->GetModel() )
+, mxTable( xTable )
+, mnIndex( nIndex )
+, mbUndo( true )
+{
+ maColumns.swap( aNewCols );
+ maCells.swap( aCells );
+}
+
+// -----------------------------------------------------------------------------
+
+RemoveColUndo::~RemoveColUndo()
+{
+ if( mbUndo )
+ {
+ Dispose( maColumns );
+ Dispose( maCells );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void RemoveColUndo::Undo()
+{
+ if( mxTable.is() )
+ {
+ mxTable->UndoRemoveColumns( mnIndex, maColumns, maCells );
+ mbUndo = false;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void RemoveColUndo::Redo()
+{
+ if( mxTable.is() )
+ {
+ mxTable->UndoInsertColumns( mnIndex, sal::static_int_cast< sal_Int32 >( maColumns.size() ) );
+ mbUndo = true;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// class TableColumnUndo : public SdrUndoAction
+// -----------------------------------------------------------------------------
+
+TableColumnUndo::TableColumnUndo( const TableColumnRef& xCol )
+: SdrUndoAction( *xCol->mxTableModel->getSdrTableObj()->GetModel() )
+, mxCol( xCol )
+, mbHasRedoData( false )
+{
+ getData( maUndoData );
+}
+
+// -----------------------------------------------------------------------------
+
+TableColumnUndo::~TableColumnUndo()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void TableColumnUndo::Undo()
+{
+ if( !mbHasRedoData )
+ {
+ getData( maRedoData );
+ mbHasRedoData = true;
+ }
+ setData( maUndoData );
+}
+
+// -----------------------------------------------------------------------------
+
+void TableColumnUndo::Redo()
+{
+ setData( maRedoData );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool TableColumnUndo::Merge( SfxUndoAction *pNextAction )
+{
+ TableColumnUndo* pNext = dynamic_cast< TableColumnUndo* >( pNextAction );
+ return pNext && pNext->mxCol == mxCol;
+}
+
+// -----------------------------------------------------------------------------
+
+void TableColumnUndo::setData( const Data& rData )
+{
+ mxCol->mnColumn = rData.mnColumn;
+ mxCol->mnWidth = rData.mnWidth;
+ mxCol->mbOptimalWidth = rData.mbOptimalWidth;
+ mxCol->mbIsVisible = rData.mbIsVisible;
+ mxCol->mbIsStartOfNewPage = rData.mbIsStartOfNewPage;
+ mxCol->maName = rData.maName;
+}
+
+// -----------------------------------------------------------------------------
+
+void TableColumnUndo::getData( Data& rData )
+{
+ rData.mnColumn = mxCol->mnColumn;
+ rData.mnWidth = mxCol->mnWidth;
+ rData.mbOptimalWidth = mxCol->mbOptimalWidth;
+ rData.mbIsVisible = mxCol->mbIsVisible;
+ rData.mbIsStartOfNewPage = mxCol->mbIsStartOfNewPage;
+ rData.maName = mxCol->maName;
+}
+
+// -----------------------------------------------------------------------------
+// class TableRowUndo : public SdrUndoAction
+// -----------------------------------------------------------------------------
+
+TableRowUndo::TableRowUndo( const TableRowRef& xRow )
+: SdrUndoAction( *xRow->mxTableModel->getSdrTableObj()->GetModel() )
+, mxRow( xRow )
+, mbHasRedoData( false )
+{
+ getData( maUndoData );
+}
+
+// -----------------------------------------------------------------------------
+
+TableRowUndo::~TableRowUndo()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void TableRowUndo::Undo()
+{
+ if( !mbHasRedoData )
+ {
+ getData( maRedoData );
+ mbHasRedoData = true;
+ }
+ setData( maUndoData );
+}
+
+// -----------------------------------------------------------------------------
+
+void TableRowUndo::Redo()
+{
+ setData( maRedoData );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool TableRowUndo::Merge( SfxUndoAction *pNextAction )
+{
+ TableRowUndo* pNext = dynamic_cast< TableRowUndo* >( pNextAction );
+ return pNext && pNext->mxRow == mxRow;
+}
+
+// -----------------------------------------------------------------------------
+
+void TableRowUndo::setData( const Data& rData )
+{
+ mxRow->mnRow = rData.mnRow;
+ mxRow->mnHeight = rData.mnHeight;
+ mxRow->mbOptimalHeight = rData.mbOptimalHeight;
+ mxRow->mbIsVisible = rData.mbIsVisible;
+ mxRow->mbIsStartOfNewPage = rData.mbIsStartOfNewPage;
+ mxRow->maName = rData.maName;
+ }
+
+// -----------------------------------------------------------------------------
+
+void TableRowUndo::getData( Data& rData )
+{
+ rData.mnRow = mxRow->mnRow;
+ rData.mnHeight = mxRow->mnHeight;
+ rData.mbOptimalHeight = mxRow->mbOptimalHeight;
+ rData.mbIsVisible = mxRow->mbIsVisible;
+ rData.mbIsStartOfNewPage = mxRow->mbIsStartOfNewPage;
+ rData.maName = mxRow->maName;
+}
+
+// -----------------------------------------------------------------------------
+
+TableStyleUndo::TableStyleUndo( const SdrTableObj& rTableObj )
+: SdrUndoAction( *rTableObj.GetModel() )
+, mxObjRef( const_cast< sdr::table::SdrTableObj*>( &rTableObj ) )
+{
+ getData( maUndoData );
+}
+
+void TableStyleUndo::Undo()
+{
+ if( !mbHasRedoData )
+ {
+ getData( maRedoData );
+ mbHasRedoData = true;
+ }
+ setData( maUndoData );
+}
+
+void TableStyleUndo::Redo()
+{
+ setData( maRedoData );
+}
+
+void TableStyleUndo::setData( const Data& rData )
+{
+ SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >( mxObjRef.get() );
+ if( pTableObj )
+ {
+ pTableObj->setTableStyle( rData.mxTableStyle );
+ pTableObj->setTableStyleSettings( rData.maSettings );
+ }
+}
+
+void TableStyleUndo::getData( Data& rData )
+{
+ SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >( mxObjRef.get() );
+ if( pTableObj )
+ {
+ rData.maSettings = pTableObj->getTableStyleSettings();
+ rData.mxTableStyle = pTableObj->getTableStyle();
+ }
+}
+
+} }
diff --git a/svx/source/table/tableundo.hxx b/svx/source/table/tableundo.hxx
new file mode 100644
index 000000000000..2e5fee9382d6
--- /dev/null
+++ b/svx/source/table/tableundo.hxx
@@ -0,0 +1,259 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_TABLEUNDO_HXX_
+#define _SVX_TABLEUNDO_HXX_
+
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/table/CellContentType.hpp>
+
+#include "svx/svdotable.hxx"
+#include "svx/svdobj.hxx"
+#include "svx/svdundo.hxx"
+
+#include "celltypes.hxx"
+
+namespace sdr { namespace properties {
+ class TextProperties;
+} }
+
+class OutlinerParaObject;
+
+// -----------------------------------------------------------------------------
+
+namespace sdr { namespace table {
+
+class CellUndo : public SdrUndoAction, public sdr::ObjectUser
+{
+public:
+ CellUndo( const SdrObjectWeakRef& xObjRef, const CellRef& xCell );
+ virtual ~CellUndo();
+
+ virtual void Undo();
+ virtual void Redo();
+ virtual sal_Bool Merge( SfxUndoAction *pNextAction );
+
+ void dispose();
+ virtual void ObjectInDestruction(const SdrObject& rObject);
+
+private:
+ struct Data
+ {
+ sdr::properties::TextProperties* mpProperties;
+ OutlinerParaObject* mpOutlinerParaObject;
+
+ ::com::sun::star::table::CellContentType mnCellContentType;
+
+ ::rtl::OUString msFormula;
+ double mfValue;
+ ::sal_Int32 mnError;
+ ::sal_Bool mbMerged;
+ ::sal_Int32 mnRowSpan;
+ ::sal_Int32 mnColSpan;
+
+ Data() : mpProperties(0), mpOutlinerParaObject(0) {};
+ };
+
+ void setDataToCell( const Data& rData );
+ void getDataFromCell( Data& rData );
+
+ SdrObjectWeakRef mxObjRef;
+ CellRef mxCell;
+ Data maUndoData;
+ Data maRedoData;
+ bool mbUndo;
+};
+
+// -----------------------------------------------------------------------------
+
+class InsertRowUndo : public SdrUndoAction
+{
+public:
+ InsertRowUndo( const TableModelRef& xTable, sal_Int32 nIndex, RowVector& aNewRows );
+ virtual ~InsertRowUndo();
+
+ virtual void Undo();
+ virtual void Redo();
+
+private:
+ TableModelRef mxTable;
+ sal_Int32 mnIndex;
+ RowVector maRows;
+ bool mbUndo;
+};
+
+// -----------------------------------------------------------------------------
+
+class RemoveRowUndo : public SdrUndoAction
+{
+public:
+ RemoveRowUndo( const TableModelRef& xTable, sal_Int32 nIndex, RowVector& aRemovedRows );
+ virtual ~RemoveRowUndo();
+
+ virtual void Undo();
+ virtual void Redo();
+
+private:
+ TableModelRef mxTable;
+ sal_Int32 mnIndex;
+ RowVector maRows;
+ bool mbUndo;
+};
+
+// -----------------------------------------------------------------------------
+
+class InsertColUndo : public SdrUndoAction
+{
+public:
+ InsertColUndo( const TableModelRef& xTable, sal_Int32 nIndex, ColumnVector& aNewCols, CellVector& aCells );
+ virtual ~InsertColUndo();
+
+ virtual void Undo();
+ virtual void Redo();
+
+private:
+ TableModelRef mxTable;
+ sal_Int32 mnIndex;
+ ColumnVector maColumns;
+ CellVector maCells;
+ bool mbUndo;
+};
+
+// -----------------------------------------------------------------------------
+
+class RemoveColUndo : public SdrUndoAction
+{
+public:
+ RemoveColUndo( const TableModelRef& xTable, sal_Int32 nIndex, ColumnVector& aNewCols, CellVector& aCells );
+ virtual ~RemoveColUndo();
+
+ virtual void Undo();
+ virtual void Redo();
+
+private:
+ TableModelRef mxTable;
+ sal_Int32 mnIndex;
+ ColumnVector maColumns;
+ CellVector maCells;
+ bool mbUndo;
+};
+
+// -----------------------------------------------------------------------------
+
+class TableColumnUndo : public SdrUndoAction
+{
+public:
+ TableColumnUndo( const TableColumnRef& xCol );
+ virtual ~TableColumnUndo();
+
+ virtual void Undo();
+ virtual void Redo();
+ virtual sal_Bool Merge( SfxUndoAction *pNextAction );
+
+private:
+ struct Data
+ {
+ sal_Int32 mnColumn;
+ sal_Int32 mnWidth;
+ sal_Bool mbOptimalWidth;
+ sal_Bool mbIsVisible;
+ sal_Bool mbIsStartOfNewPage;
+ ::rtl::OUString maName;
+ };
+
+ void setData( const Data& rData );
+ void getData( Data& rData );
+
+ TableColumnRef mxCol;
+ Data maUndoData;
+ Data maRedoData;
+ bool mbHasRedoData;
+};
+
+// -----------------------------------------------------------------------------
+
+class TableRowUndo : public SdrUndoAction
+{
+public:
+ TableRowUndo( const TableRowRef& xRow );
+ virtual ~TableRowUndo();
+
+ virtual void Undo();
+ virtual void Redo();
+ virtual sal_Bool Merge( SfxUndoAction *pNextAction );
+
+private:
+ struct Data
+ {
+ CellVector maCells;
+ sal_Int32 mnRow;
+ sal_Int32 mnHeight;
+ sal_Bool mbOptimalHeight;
+ sal_Bool mbIsVisible;
+ sal_Bool mbIsStartOfNewPage;
+ ::rtl::OUString maName;
+ };
+
+ void setData( const Data& rData );
+ void getData( Data& rData );
+
+ TableRowRef mxRow;
+ Data maUndoData;
+ Data maRedoData;
+ bool mbHasRedoData;
+};
+
+// -----------------------------------------------------------------------------
+
+class TableStyleUndo : public SdrUndoAction
+{
+public:
+ TableStyleUndo( const SdrTableObj& rTableObj );
+
+ virtual void Undo();
+ virtual void Redo();
+
+private:
+ SdrObjectWeakRef mxObjRef;
+
+ struct Data
+ {
+ TableStyleSettings maSettings;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > mxTableStyle;
+ };
+
+ void setData( const Data& rData );
+ void getData( Data& rData );
+
+ Data maUndoData;
+ Data maRedoData;
+ bool mbHasRedoData;
+};
+
+} }
+
+#endif
diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx
new file mode 100644
index 000000000000..63d1066e7149
--- /dev/null
+++ b/svx/source/table/viewcontactoftableobj.cxx
@@ -0,0 +1,736 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "viewcontactoftableobj.hxx"
+#include <svx/svdotable.hxx>
+#include <com/sun/star/table/XTable.hpp>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
+#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/attribute/sdrtextattribute.hxx>
+#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
+#include <editeng/borderline.hxx>
+#include <drawinglayer/primitive2d/borderlineprimitive2d.hxx>
+#include <svx/sdr/attribute/sdrfilltextattribute.hxx>
+#include <drawinglayer/attribute/sdrlineattribute.hxx>
+#include <drawinglayer/attribute/sdrshadowattribute.hxx>
+#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
+#include "cell.hxx"
+#include "tablelayouter.hxx"
+
+//////////////////////////////////////////////////////////////////////////////
+
+using namespace com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class SdrCellPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ basegfx::B2DHomMatrix maTransform;
+ attribute::SdrFillTextAttribute maSdrFTAttribute;
+
+ protected:
+ // local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
+
+ public:
+ SdrCellPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ const attribute::SdrFillTextAttribute& rSdrFTAttribute)
+ : BufferedDecompositionPrimitive2D(),
+ maTransform(rTransform),
+ maSdrFTAttribute(rSdrFTAttribute)
+ {
+ }
+
+ // data access
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ const attribute::SdrFillTextAttribute& getSdrFTAttribute() const { return maSdrFTAttribute; }
+
+ // compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ // provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+
+ Primitive2DSequence SdrCellPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const
+ {
+ // prepare unit polygon
+ Primitive2DSequence aRetval;
+ const basegfx::B2DPolyPolygon aUnitPolyPolygon(basegfx::tools::createUnitPolygon());
+
+ // add fill
+ if(!getSdrFTAttribute().getFill().isDefault())
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createPolyPolygonFillPrimitive(
+ aUnitPolyPolygon,
+ getTransform(),
+ getSdrFTAttribute().getFill(),
+ getSdrFTAttribute().getFillFloatTransGradient()));
+ }
+ else
+ {
+ // if no fill create one for HitTest and BoundRect fallback
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createHiddenGeometryPrimitives2D(
+ true,
+ aUnitPolyPolygon,
+ getTransform()));
+ }
+
+ // add text
+ if(!getSdrFTAttribute().getText().isDefault())
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
+ createTextPrimitive(
+ aUnitPolyPolygon,
+ getTransform(),
+ getSdrFTAttribute().getText(),
+ attribute::SdrLineAttribute(),
+ true,
+ false,
+ false));
+ }
+
+ return aRetval;
+ }
+
+ bool SdrCellPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+ {
+ const SdrCellPrimitive2D& rCompare = (SdrCellPrimitive2D&)rPrimitive;
+
+ return (getTransform() == rCompare.getTransform()
+ && getSdrFTAttribute() == rCompare.getSdrFTAttribute());
+ }
+
+ return false;
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(SdrCellPrimitive2D, PRIMITIVE2D_ID_SDRCELLPRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class SdrBorderlinePrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ basegfx::B2DHomMatrix maTransform;
+ SvxBorderLine maLeftLine;
+ SvxBorderLine maBottomLine;
+ SvxBorderLine maRightLine;
+ SvxBorderLine maTopLine;
+
+ // bitfield
+ unsigned mbLeftIsOutside : 1;
+ unsigned mbBottomIsOutside : 1;
+ unsigned mbRightIsOutside : 1;
+ unsigned mbTopIsOutside : 1;
+ unsigned mbInTwips : 1;
+
+ protected:
+ // local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
+
+ public:
+ SdrBorderlinePrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ const SvxBorderLine& rLeftLine,
+ const SvxBorderLine& rBottomLine,
+ const SvxBorderLine& rRightLine,
+ const SvxBorderLine& rTopLine,
+ bool bLeftIsOutside,
+ bool bBottomIsOutside,
+ bool bRightIsOutside,
+ bool bTopIsOutside,
+ bool bInTwips)
+ : BufferedDecompositionPrimitive2D(),
+ maTransform(rTransform),
+ maLeftLine(rLeftLine),
+ maBottomLine(rBottomLine),
+ maRightLine(rRightLine),
+ maTopLine(rTopLine),
+ mbLeftIsOutside(bLeftIsOutside),
+ mbBottomIsOutside(bBottomIsOutside),
+ mbRightIsOutside(bRightIsOutside),
+ mbTopIsOutside(bTopIsOutside),
+ mbInTwips(bInTwips)
+ {
+ }
+
+
+ // data access
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ const SvxBorderLine& getLeftLine() const { return maLeftLine; }
+ const SvxBorderLine& getBottomLine() const { return maBottomLine; }
+ const SvxBorderLine& getRightLine() const { return maRightLine; }
+ const SvxBorderLine& getTopLine() const { return maTopLine; }
+ bool getLeftIsOutside() const { return mbLeftIsOutside; }
+ bool getBottomIsOutside() const { return mbBottomIsOutside; }
+ bool getRightIsOutside() const { return mbRightIsOutside; }
+ bool getTopIsOutside() const { return mbTopIsOutside; }
+ bool getInTwips() const { return mbInTwips; }
+
+ // compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ // provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+
+ sal_uInt16 getBorderLineOutWidth(const SvxBorderLine& rLineA)
+ {
+ return (1 == rLineA.GetOutWidth() ? 0 : rLineA.GetOutWidth());
+ }
+
+ sal_uInt16 getBorderLineDistance(const SvxBorderLine& rLineA)
+ {
+ return (1 == rLineA.GetDistance() ? 0 : rLineA.GetDistance());
+ }
+
+ sal_uInt16 getBorderLineInWidth(const SvxBorderLine& rLineA)
+ {
+ return (1 == rLineA.GetInWidth() ? 0 : rLineA.GetInWidth());
+ }
+
+ sal_uInt16 getBorderLineWidth(const SvxBorderLine& rLineA)
+ {
+ return getBorderLineOutWidth(rLineA) + getBorderLineDistance(rLineA) + getBorderLineInWidth(rLineA);
+ }
+
+ double getInnerExtend(const SvxBorderLine& rLineA, bool bSideToUse)
+ {
+ if(!rLineA.isEmpty())
+ {
+ if(rLineA.isDouble())
+ {
+ // reduce to inner edge of associated matching line
+ return -((getBorderLineWidth(rLineA) / 2.0) - (bSideToUse ? getBorderLineOutWidth(rLineA) : getBorderLineInWidth(rLineA)));
+ }
+ else
+ {
+ // extend to overlap with single line
+ return getBorderLineWidth(rLineA) / 2.0;
+ }
+ }
+
+ return 0.0;
+ }
+
+ double getOuterExtend(const SvxBorderLine& rLineA)
+ {
+ if(!rLineA.isEmpty())
+ {
+ // extend to overlap with single line
+ return getBorderLineWidth(rLineA) / 2.0;
+ }
+
+ return 0.0;
+ }
+
+ double getChangedValue(sal_uInt16 nValue, bool bChangeToMM)
+ {
+ if(1 == nValue)
+ return 1.0;
+
+ if(bChangeToMM)
+ return nValue * (127.0 / 72.0);
+
+ return (double)nValue;
+ }
+
+ Primitive2DSequence SdrBorderlinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const
+ {
+ Primitive2DSequence xRetval(4);
+ sal_uInt32 nInsert(0);
+ const double fTwipsToMM(getInTwips() ? (127.0 / 72.0) : 1.0);
+
+ if(!getLeftLine().isEmpty())
+ {
+ // create left line from top to bottom
+ const basegfx::B2DPoint aStart(getTransform() * basegfx::B2DPoint(0.0, 0.0));
+ const basegfx::B2DPoint aEnd(getTransform() * basegfx::B2DPoint(0.0, 1.0));
+
+ if(!aStart.equal(aEnd))
+ {
+ const double fExtendIS(getInnerExtend(getTopLine(), false));
+ const double fExtendIE(getInnerExtend(getBottomLine(), true));
+ double fExtendOS(0.0);
+ double fExtendOE(0.0);
+
+ if(getLeftIsOutside())
+ {
+ if(getTopIsOutside())
+ {
+ fExtendOS = getOuterExtend(getTopLine());
+ }
+
+ if(getBottomIsOutside())
+ {
+ fExtendOE = getOuterExtend(getBottomLine());
+ }
+ }
+
+ xRetval[nInsert++] = Primitive2DReference(new BorderLinePrimitive2D(
+ aStart,
+ aEnd,
+ getChangedValue(getLeftLine().GetOutWidth(), getInTwips()),
+ getChangedValue(getLeftLine().GetDistance(), getInTwips()),
+ getChangedValue(getLeftLine().GetInWidth(), getInTwips()),
+ fExtendIS * fTwipsToMM,
+ fExtendIE * fTwipsToMM,
+ fExtendOS * fTwipsToMM,
+ fExtendOE * fTwipsToMM,
+ true,
+ getLeftIsOutside(),
+ getLeftLine().GetColor().getBColor()));
+ }
+ }
+
+ if(!getBottomLine().isEmpty())
+ {
+ // create bottom line from left to right
+ const basegfx::B2DPoint aStart(getTransform() * basegfx::B2DPoint(0.0, 1.0));
+ const basegfx::B2DPoint aEnd(getTransform() * basegfx::B2DPoint(1.0, 1.0));
+
+ if(!aStart.equal(aEnd))
+ {
+ const double fExtendIS(getInnerExtend(getLeftLine(), true));
+ const double fExtendIE(getInnerExtend(getRightLine(), false));
+ double fExtendOS(0.0);
+ double fExtendOE(0.0);
+
+ if(getBottomIsOutside())
+ {
+ if(getLeftIsOutside())
+ {
+ fExtendOS = getOuterExtend(getLeftLine());
+ }
+
+ if(getRightIsOutside())
+ {
+ fExtendOE = getOuterExtend(getRightLine());
+ }
+ }
+
+ xRetval[nInsert++] = Primitive2DReference(new BorderLinePrimitive2D(
+ aStart,
+ aEnd,
+ getChangedValue(getBottomLine().GetOutWidth(), getInTwips()),
+ getChangedValue(getBottomLine().GetDistance(), getInTwips()),
+ getChangedValue(getBottomLine().GetInWidth(), getInTwips()),
+ fExtendIS * fTwipsToMM,
+ fExtendIE * fTwipsToMM,
+ fExtendOS * fTwipsToMM,
+ fExtendOE * fTwipsToMM,
+ true,
+ getBottomIsOutside(),
+ getBottomLine().GetColor().getBColor()));
+ }
+ }
+
+ if(!getRightLine().isEmpty())
+ {
+ // create right line from top to bottom
+ const basegfx::B2DPoint aStart(getTransform() * basegfx::B2DPoint(1.0, 0.0));
+ const basegfx::B2DPoint aEnd(getTransform() * basegfx::B2DPoint(1.0, 1.0));
+
+ if(!aStart.equal(aEnd))
+ {
+ const double fExtendIS(getInnerExtend(getTopLine(), false));
+ const double fExtendIE(getInnerExtend(getBottomLine(), true));
+ double fExtendOS(0.0);
+ double fExtendOE(0.0);
+
+ if(getRightIsOutside())
+ {
+ if(getTopIsOutside())
+ {
+ fExtendOS = getOuterExtend(getTopLine());
+ }
+
+ if(getBottomIsOutside())
+ {
+ fExtendOE = getOuterExtend(getBottomLine());
+ }
+ }
+
+ xRetval[nInsert++] = Primitive2DReference(new BorderLinePrimitive2D(
+ aStart,
+ aEnd,
+ getChangedValue(getRightLine().GetOutWidth(), getInTwips()),
+ getChangedValue(getRightLine().GetDistance(), getInTwips()),
+ getChangedValue(getRightLine().GetInWidth(), getInTwips()),
+ fExtendOS * fTwipsToMM,
+ fExtendOE * fTwipsToMM,
+ fExtendIS * fTwipsToMM,
+ fExtendIE * fTwipsToMM,
+ getRightIsOutside(),
+ true,
+ getRightLine().GetColor().getBColor()));
+ }
+ }
+
+ if(!getTopLine().isEmpty())
+ {
+ // create top line from left to right
+ const basegfx::B2DPoint aStart(getTransform() * basegfx::B2DPoint(0.0, 0.0));
+ const basegfx::B2DPoint aEnd(getTransform() * basegfx::B2DPoint(1.0, 0.0));
+
+ if(!aStart.equal(aEnd))
+ {
+ const double fExtendIS(getInnerExtend(getLeftLine(), true));
+ const double fExtendIE(getInnerExtend(getRightLine(), false));
+ double fExtendOS(0.0);
+ double fExtendOE(0.0);
+
+ if(getTopIsOutside())
+ {
+ if(getLeftIsOutside())
+ {
+ fExtendOS = getOuterExtend(getLeftLine());
+ }
+
+ if(getRightIsOutside())
+ {
+ fExtendOE = getOuterExtend(getRightLine());
+ }
+ }
+
+ xRetval[nInsert++] = Primitive2DReference(new BorderLinePrimitive2D(
+ aStart,
+ aEnd,
+ getChangedValue(getTopLine().GetOutWidth(), getInTwips()),
+ getChangedValue(getTopLine().GetDistance(), getInTwips()),
+ getChangedValue(getTopLine().GetInWidth(), getInTwips()),
+ fExtendOS * fTwipsToMM,
+ fExtendOE * fTwipsToMM,
+ fExtendIS * fTwipsToMM,
+ fExtendIE * fTwipsToMM,
+ getTopIsOutside(),
+ true,
+ getTopLine().GetColor().getBColor()));
+ }
+ }
+
+ xRetval.realloc(nInsert);
+ return xRetval;
+ }
+
+ bool SdrBorderlinePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+ {
+ if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+ {
+ const SdrBorderlinePrimitive2D& rCompare = (SdrBorderlinePrimitive2D&)rPrimitive;
+
+ return (getTransform() == rCompare.getTransform()
+ && getLeftLine() == rCompare.getLeftLine()
+ && getBottomLine() == rCompare.getBottomLine()
+ && getRightLine() == rCompare.getRightLine()
+ && getTopLine() == rCompare.getTopLine()
+ && getLeftIsOutside() == rCompare.getLeftIsOutside()
+ && getBottomIsOutside() == rCompare.getBottomIsOutside()
+ && getRightIsOutside() == rCompare.getRightIsOutside()
+ && getTopIsOutside() == rCompare.getTopIsOutside()
+ && getInTwips() == rCompare.getInTwips());
+ }
+
+ return false;
+ }
+
+ // provide unique ID
+ ImplPrimitrive2DIDBlock(SdrBorderlinePrimitive2D, PRIMITIVE2D_ID_SDRBORDERLINEPRIMITIVE2D)
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace contact
+ {
+ void impGetLine(SvxBorderLine& aLine, const sdr::table::TableLayouter& rLayouter, sal_Int32 nX, sal_Int32 nY, bool bHorizontal, sal_Int32 nColCount, sal_Int32 nRowCount, bool bIsRTL)
+ {
+ if(nX >= 0 && nX <= nColCount && nY >= 0 && nY <= nRowCount)
+ {
+ const SvxBorderLine* pLine = rLayouter.getBorderLine(nX, nY, bHorizontal);
+
+ if(pLine)
+ {
+ // copy line content
+ aLine = *pLine;
+
+ // check for mirroring. This shall always be done when it is
+ // not a top- or rightmost line
+ bool bMirror(aLine.isDouble());
+
+ if(bMirror)
+ {
+ if(bHorizontal)
+ {
+ // mirror all bottom lines
+ bMirror = (0 != nY);
+ }
+ else
+ {
+ // mirror all left lines
+ bMirror = (bIsRTL ? 0 != nX : nX != nColCount);
+ }
+ }
+
+ if(bMirror)
+ {
+ aLine.SetOutWidth(pLine->GetInWidth());
+ aLine.SetInWidth(pLine->GetOutWidth());
+ }
+
+ return;
+ }
+ }
+
+ // no success, copy empty line
+ const SvxBorderLine aEmptyLine;
+ aLine = aEmptyLine;
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfTableObj::createViewIndependentPrimitive2DSequence() const
+ {
+ const sdr::table::SdrTableObj& rTableObj = GetTableObj();
+ const uno::Reference< com::sun::star::table::XTable > xTable = rTableObj.getTable();
+
+ if(xTable.is())
+ {
+ // create primitive representation for table
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+ const sal_Int32 nRowCount(xTable->getRowCount());
+ const sal_Int32 nColCount(xTable->getColumnCount());
+ const sal_Int32 nAllCount(nRowCount * nColCount);
+
+ if(nAllCount)
+ {
+ const sdr::table::TableLayouter& rTableLayouter = rTableObj.getTableLayouter();
+ const bool bIsRTL(com::sun::star::text::WritingMode_RL_TB == rTableObj.GetWritingMode());
+ sdr::table::CellPos aCellPos;
+ sdr::table::CellRef xCurrentCell;
+ basegfx::B2IRectangle aCellArea;
+
+ // create range using the model data directly. This is in SdrTextObj::aRect which i will access using
+ // GetGeoRect() to not trigger any calculations. It's the unrotated geometry.
+ const Rectangle& rObjectRectangle(rTableObj.GetGeoRect());
+ const basegfx::B2DRange aObjectRange(rObjectRectangle.Left(), rObjectRectangle.Top(), rObjectRectangle.Right(), rObjectRectangle.Bottom());
+
+ // for each cell we need potentially a cell primitive and a border primitive
+ // (e.g. single cell). Prepare sequences and input counters
+ drawinglayer::primitive2d::Primitive2DSequence xCellSequence(nAllCount);
+ drawinglayer::primitive2d::Primitive2DSequence xBorderSequence(nAllCount);
+ sal_uInt32 nCellInsert(0);
+ sal_uInt32 nBorderInsert(0);
+
+ // variables for border lines
+ SvxBorderLine aLeftLine;
+ SvxBorderLine aBottomLine;
+ SvxBorderLine aRightLine;
+ SvxBorderLine aTopLine;
+
+ // create single primitives per cell
+ for(aCellPos.mnRow = 0; aCellPos.mnRow < nRowCount; aCellPos.mnRow++)
+ {
+ for(aCellPos.mnCol = 0; aCellPos.mnCol < nColCount; aCellPos.mnCol++)
+ {
+ xCurrentCell.set(dynamic_cast< sdr::table::Cell* >(xTable->getCellByPosition(aCellPos.mnCol, aCellPos.mnRow).get()));
+
+ if(xCurrentCell.is() && !xCurrentCell->isMerged())
+ {
+ if(rTableLayouter.getCellArea(aCellPos, aCellArea))
+ {
+ // create cell transformation matrix
+ basegfx::B2DHomMatrix aCellMatrix;
+ aCellMatrix.set(0, 0, (double)aCellArea.getWidth());
+ aCellMatrix.set(1, 1, (double)aCellArea.getHeight());
+ aCellMatrix.set(0, 2, (double)aCellArea.getMinX() + aObjectRange.getMinX());
+ aCellMatrix.set(1, 2, (double)aCellArea.getMinY() + aObjectRange.getMinY());
+
+ // handle cell fillings and text
+ const SfxItemSet& rCellItemSet = xCurrentCell->GetItemSet();
+ const sal_uInt32 nTextIndex(nColCount * aCellPos.mnRow + aCellPos.mnCol);
+ const SdrText* pSdrText = rTableObj.getText(nTextIndex);
+ drawinglayer::attribute::SdrFillTextAttribute aAttribute;
+
+ 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());
+
+ aAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute(
+ rCellItemSet,
+ pSdrText,
+ &nLeft,
+ &nUpper,
+ &nRight,
+ &nLower);
+ }
+ else
+ {
+ aAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute(
+ rCellItemSet,
+ pSdrText);
+ }
+
+ // always create cell primitives for BoundRect and HitTest
+ {
+ const drawinglayer::primitive2d::Primitive2DReference xCellReference(
+ new drawinglayer::primitive2d::SdrCellPrimitive2D(
+ aCellMatrix, aAttribute));
+ xCellSequence[nCellInsert++] = xCellReference;
+ }
+
+ // handle cell borders
+ const sal_Int32 nX(bIsRTL ? nColCount - aCellPos.mnCol : aCellPos.mnCol);
+ const sal_Int32 nY(aCellPos.mnRow);
+
+ // get access values for X,Y at the cell's end
+ const sal_Int32 nXSpan(xCurrentCell->getColumnSpan());
+ const sal_Int32 nYSpan(xCurrentCell->getRowSpan());
+ const sal_Int32 nXRight(bIsRTL ? nX - nXSpan : nX + nXSpan);
+ const sal_Int32 nYBottom(nY + nYSpan);
+
+ // get basic lines
+ impGetLine(aLeftLine, rTableLayouter, nX, nY, false, nColCount, nRowCount, bIsRTL);
+ impGetLine(aBottomLine, rTableLayouter, nX, nYBottom, true, nColCount, nRowCount, bIsRTL);
+ impGetLine(aRightLine, rTableLayouter, nXRight, nY, false, nColCount, nRowCount, bIsRTL);
+ impGetLine(aTopLine, rTableLayouter, nX, nY, true, nColCount, nRowCount, bIsRTL);
+
+ // create the primtive containing all data for one cell with borders
+ xBorderSequence[nBorderInsert++] = drawinglayer::primitive2d::Primitive2DReference(
+ new drawinglayer::primitive2d::SdrBorderlinePrimitive2D(
+ aCellMatrix,
+ aLeftLine,
+ aBottomLine,
+ aRightLine,
+ aTopLine,
+ bIsRTL ? nX == nColCount : 0 == nX,
+ nRowCount == nYBottom,
+ bIsRTL ? 0 == nXRight : nXRight == nColCount,
+ 0 == nY,
+ true));
+ }
+ }
+ }
+ }
+
+ // no empty references; reallocate sequences by used count
+ xCellSequence.realloc(nCellInsert);
+ xBorderSequence.realloc(nBorderInsert);
+
+ // append to target. We want fillings and text first
+ xRetval = xCellSequence;
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, xBorderSequence);
+ }
+
+ if(xRetval.hasElements())
+ {
+ // check and create evtl. shadow for created content
+ const SfxItemSet& rObjectItemSet = rTableObj.GetMergedItemSet();
+ const drawinglayer::attribute::SdrShadowAttribute aNewShadowAttribute(
+ drawinglayer::primitive2d::createNewSdrShadowAttribute(rObjectItemSet));
+
+ if(!aNewShadowAttribute.isDefault())
+ {
+ xRetval = drawinglayer::primitive2d::createEmbeddedShadowPrimitive(xRetval, aNewShadowAttribute);
+ }
+ }
+
+ return xRetval;
+ }
+ else
+ {
+ // take unrotated snap rect (direct model data) for position and size
+ const Rectangle& rRectangle = rTableObj.GetGeoRect();
+ const basegfx::B2DRange aObjectRange(
+ rRectangle.Left(), rRectangle.Top(),
+ rRectangle.Right(), rRectangle.Bottom());
+
+ // create object matrix
+ const GeoStat& rGeoStat(rTableObj.GetGeoStat());
+ const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0);
+ const double fRotate(rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0);
+ const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ aObjectRange.getWidth(), aObjectRange.getHeight(), fShearX, fRotate,
+ aObjectRange.getMinX(), aObjectRange.getMinY()));
+
+ // credate an invisible outline for the cases where no visible content exists
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ drawinglayer::primitive2d::createHiddenGeometryPrimitives2D(
+ false,
+ aObjectMatrix));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+ }
+
+ ViewContactOfTableObj::ViewContactOfTableObj(::sdr::table::SdrTableObj& rTableObj)
+ : ViewContactOfSdrObj(rTableObj)
+ {
+ }
+
+ ViewContactOfTableObj::~ViewContactOfTableObj()
+ {
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/table/viewcontactoftableobj.hxx b/svx/source/table/viewcontactoftableobj.hxx
new file mode 100644
index 000000000000..733f28be0d3e
--- /dev/null
+++ b/svx/source/table/viewcontactoftableobj.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SDR_CONTACT_VIEWCONTACTOFTABLEOBJ_HXX
+#define _SDR_CONTACT_VIEWCONTACTOFTABLEOBJ_HXX
+
+#include <svx/sdr/contact/viewcontactofsdrobj.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sdr
+{
+ namespace table
+ {
+ class SdrTableObj;
+ }
+
+ namespace contact
+ {
+ class ViewContactOfTableObj : public ViewContactOfSdrObj
+ {
+ protected:
+ // internal access to SdrTextObj
+ ::sdr::table::SdrTableObj& GetTableObj() const
+ {
+ return (::sdr::table::SdrTableObj&)GetSdrObject();
+ }
+
+ // This method is responsible for creating the graphical visualisation data derived ONLY from
+ // the model data
+ virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
+
+ public:
+ // basic constructor, used from SdrObject.
+ ViewContactOfTableObj(::sdr::table::SdrTableObj& rTextObj);
+ virtual ~ViewContactOfTableObj();
+ };
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif
+
+// eof
diff --git a/svx/source/tbxctrls/colorwindow.hxx b/svx/source/tbxctrls/colorwindow.hxx
new file mode 100644
index 000000000000..726d0810aab2
--- /dev/null
+++ b/svx/source/tbxctrls/colorwindow.hxx
@@ -0,0 +1,48 @@
+//========================================================================
+// class SvxColorWindow_Impl --------------------------------------------------
+//========================================================================
+#ifndef __SVX_COLORWINDOW_HXX_
+#define __SVX_COLORWINDOW_HXX_
+
+#include <sfx2/tbxctrl.hxx>
+#include <svl/lstner.hxx>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/frame/XFrame.hpp>
+
+//========================================================================
+// class SvxColorWindow_Impl --------------------------------------------------
+//========================================================================
+
+class SvxColorWindow_Impl : public SfxPopupWindow
+{
+ using FloatingWindow::StateChanged;
+
+private:
+ const sal_uInt16 theSlotId;
+ ValueSet aColorSet;
+ rtl::OUString maCommand;
+
+#if _SOLAR__PRIVATE
+ DECL_LINK( SelectHdl, void * );
+#endif
+
+protected:
+ virtual void Resize();
+ virtual sal_Bool Close();
+
+public:
+ SvxColorWindow_Impl( const rtl::OUString& rCommand,
+ sal_uInt16 nSlotId,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ const String& rWndTitle,
+ Window* pParentWindow );
+ ~SvxColorWindow_Impl();
+ void StartSelection();
+
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+
+ virtual SfxPopupWindow* Clone() const;
+};
+
+#endif
diff --git a/svx/source/tbxctrls/colrctrl.cxx b/svx/source/tbxctrls/colrctrl.cxx
new file mode 100644
index 000000000000..b712bcfe04d2
--- /dev/null
+++ b/svx/source/tbxctrls/colrctrl.cxx
@@ -0,0 +1,661 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/dialogs.hrc>
+
+
+#include <tools/list.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/image.hxx>
+
+#include <svx/colrctrl.hxx>
+
+#include <svx/svdview.hxx>
+#include "svx/drawitem.hxx"
+#include <editeng/colritem.hxx>
+#include "svx/xattr.hxx"
+#include <svx/xtable.hxx>
+#include <svx/dialmgr.hxx>
+#include "svx/xexch.hxx"
+#include <vcl/svapp.hxx>
+
+SFX_IMPL_DOCKINGWINDOW( SvxColorChildWindow, SID_COLOR_CONTROL )
+
+// ------------------------
+// - SvxColorValueSetData -
+// ------------------------
+
+class SvxColorValueSetData : public TransferableHelper
+{
+private:
+
+ XFillExchangeData maData;
+
+protected:
+
+ virtual void AddSupportedFormats();
+ virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+ virtual sal_Bool WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
+
+public:
+
+ SvxColorValueSetData( const XFillAttrSetItem& rSetItem ) :
+ maData( rSetItem ) {}
+};
+
+// -----------------------------------------------------------------------------
+
+void SvxColorValueSetData::AddSupportedFormats()
+{
+ AddFormat( SOT_FORMATSTR_ID_XFA );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SvxColorValueSetData::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
+{
+ sal_Bool bRet = sal_False;
+
+ if( SotExchange::GetFormat( rFlavor ) == SOT_FORMATSTR_ID_XFA )
+ {
+ SetObject( &maData, 0, rFlavor );
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SvxColorValueSetData::WriteObject( SotStorageStreamRef& rxOStm, void*, sal_uInt32 , const ::com::sun::star::datatransfer::DataFlavor& )
+{
+ *rxOStm << maData;
+ return( rxOStm->GetError() == ERRCODE_NONE );
+}
+
+/*************************************************************************
+|*
+|* SvxColorValueSet: Ctor
+|*
+\************************************************************************/
+
+SvxColorValueSet::SvxColorValueSet( Window* _pParent, WinBits nWinStyle ) :
+ ValueSet( _pParent, nWinStyle ),
+ DragSourceHelper( this ),
+ bLeft (sal_True)
+{
+}
+
+/*************************************************************************
+|*
+|* SvxColorValueSet: Ctor
+|*
+\************************************************************************/
+
+SvxColorValueSet::SvxColorValueSet( Window* _pParent, const ResId& rResId ) :
+ ValueSet( _pParent, rResId ),
+ DragSourceHelper( this ),
+ bLeft (sal_True)
+{
+}
+
+/*************************************************************************
+|*
+|* SvxColorValueSet: MouseButtonDown
+|*
+\************************************************************************/
+
+void SvxColorValueSet::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ // Fuer Mac noch anders handlen !
+ if( rMEvt.IsLeft() )
+ {
+ bLeft = sal_True;
+ ValueSet::MouseButtonDown( rMEvt );
+ }
+ else
+ {
+ bLeft = sal_False;
+ MouseEvent aMEvt( rMEvt.GetPosPixel(),
+ rMEvt.GetClicks(),
+ rMEvt.GetMode(),
+ MOUSE_LEFT,
+ rMEvt.GetModifier() );
+ ValueSet::MouseButtonDown( aMEvt );
+ }
+
+ aDragPosPixel = GetPointerPosPixel();
+}
+
+/*************************************************************************
+|*
+|* SvxColorValueSet: MouseButtonUp
+|*
+\************************************************************************/
+
+void SvxColorValueSet::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ // Fuer Mac noch anders handlen !
+ if( rMEvt.IsLeft() )
+ {
+ bLeft = sal_True;
+ ValueSet::MouseButtonUp( rMEvt );
+ }
+ else
+ {
+ bLeft = sal_False;
+ MouseEvent aMEvt( rMEvt.GetPosPixel(),
+ rMEvt.GetClicks(),
+ rMEvt.GetMode(),
+ MOUSE_LEFT,
+ rMEvt.GetModifier() );
+ ValueSet::MouseButtonUp( aMEvt );
+ }
+ SetNoSelection();
+}
+
+/*************************************************************************
+|*
+|* Command-Event
+|*
+\************************************************************************/
+
+void SvxColorValueSet::Command(const CommandEvent& rCEvt)
+{
+ // Basisklasse
+ ValueSet::Command(rCEvt);
+}
+
+/*************************************************************************
+|*
+|* StartDrag
+|*
+\************************************************************************/
+
+void SvxColorValueSet::StartDrag( sal_Int8 , const Point& )
+{
+ Application::PostUserEvent(STATIC_LINK(this, SvxColorValueSet, ExecDragHdl));
+}
+
+/*************************************************************************
+|*
+|* Drag&Drop asynchron ausfuehren
+|*
+\************************************************************************/
+
+void SvxColorValueSet::DoDrag()
+{
+ SfxObjectShell* pDocSh = SfxObjectShell::Current();
+ sal_uInt16 nItemId = GetItemId( aDragPosPixel );
+
+ if( pDocSh && nItemId )
+ {
+ XFillAttrSetItem aXFillSetItem( &pDocSh->GetPool() );
+ SfxItemSet& rSet = aXFillSetItem.GetItemSet();
+
+ rSet.Put( XFillColorItem( GetItemText( nItemId ), GetItemColor( nItemId ) ) );
+ rSet.Put(XFillStyleItem( ( 1 == nItemId ) ? XFILL_NONE : XFILL_SOLID ) );
+
+ EndSelection();
+ ( new SvxColorValueSetData( aXFillSetItem ) )->StartDrag( this, DND_ACTION_COPY );
+ ReleaseMouse();
+ }
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_STATIC_LINK(SvxColorValueSet, ExecDragHdl, void*, EMPTYARG)
+{
+ // Als Link, damit asynchron ohne ImpMouseMoveMsg auf dem Stack auch die
+ // Farbleiste geloescht werden darf
+ pThis->DoDrag();
+ return(0);
+}
+
+/*************************************************************************
+|*
+|* Ableitung vom SfxChildWindow als "Behaelter" fuer Animator
+|*
+\************************************************************************/
+
+SvxColorChildWindow::SvxColorChildWindow( Window* _pParent,
+ sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo ) :
+ SfxChildWindow( _pParent, nId )
+{
+ SvxColorDockingWindow* pWin = new SvxColorDockingWindow( pBindings, this,
+ _pParent, SVX_RES( RID_SVXCTRL_COLOR ) );
+ pWindow = pWin;
+
+ eChildAlignment = SFX_ALIGN_BOTTOM;
+
+ pWin->Initialize( pInfo );
+}
+
+
+
+/*************************************************************************
+|*
+|* Ctor: SvxColorDockingWindow
+|*
+\************************************************************************/
+
+SvxColorDockingWindow::SvxColorDockingWindow
+(
+ SfxBindings* _pBindings,
+ SfxChildWindow* pCW,
+ Window* _pParent,
+ const ResId& rResId
+) :
+
+ SfxDockingWindow( _pBindings, pCW, _pParent, rResId ),
+
+ pColorTable ( NULL ),
+ aColorSet ( this, ResId( 1, *rResId.GetResMgr() ) ),
+ nLeftSlot ( SID_ATTR_FILL_COLOR ),
+ nRightSlot ( SID_ATTR_LINE_COLOR ),
+ nCols ( 20 ),
+ nLines ( 1 ),
+ aColorSize ( 14, 14 )
+
+{
+ FreeResource();
+
+ aColorSet.SetStyle( aColorSet.GetStyle() | WB_ITEMBORDER );
+ aColorSet.SetSelectHdl( LINK( this, SvxColorDockingWindow, SelectHdl ) );
+
+ // Get the model from the view shell. Using SfxObjectShell::Current()
+ // is unreliable when called at the wrong times.
+ SfxObjectShell* pDocSh = NULL;
+ if (_pBindings != NULL)
+ {
+ SfxDispatcher* pDispatcher = _pBindings->GetDispatcher();
+ if (pDispatcher != NULL)
+ {
+ SfxViewFrame* pFrame = pDispatcher->GetFrame();
+ if (pFrame != NULL)
+ {
+ SfxViewShell* pViewShell = pFrame->GetViewShell();
+ if (pViewShell != NULL)
+ pDocSh = pViewShell->GetObjectShell();
+ }
+ }
+ }
+
+ if ( pDocSh )
+ {
+ const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE );
+ if( pItem )
+ {
+ pColorTable = ( (SvxColorTableItem*) pItem )->GetColorTable();
+ FillValueSet();
+ }
+ }
+ aItemSize = aColorSet.CalcItemSizePixel( aColorSize );
+ aItemSize.Width() = aItemSize.Width() + aColorSize.Width();
+ aItemSize.Width() /= 2;
+ aItemSize.Height() = aItemSize.Height() + aColorSize.Height();
+ aItemSize.Height() /= 2;
+
+ SetSize();
+ aColorSet.Show();
+ StartListening( *_pBindings, sal_True );
+}
+
+
+/*************************************************************************
+|*
+|* Dtor: SvxColorDockingWindow
+|*
+\************************************************************************/
+
+SvxColorDockingWindow::~SvxColorDockingWindow()
+{
+ EndListening( GetBindings() );
+}
+
+/*************************************************************************
+|*
+|* Notify
+|*
+\************************************************************************/
+
+void SvxColorDockingWindow::Notify( SfxBroadcaster& , const SfxHint& rHint )
+{
+ const SfxPoolItemHint *pPoolItemHint = PTR_CAST(SfxPoolItemHint, &rHint);
+ if ( pPoolItemHint
+ && ( pPoolItemHint->GetObject()->ISA( SvxColorTableItem ) ) )
+ {
+ // Die Liste der Farben hat sich geaendert
+ pColorTable = ( (SvxColorTableItem*) pPoolItemHint->GetObject() )->GetColorTable();
+ FillValueSet();
+ }
+}
+
+/*************************************************************************
+|*
+|* FillValueSet
+|*
+\************************************************************************/
+
+void SvxColorDockingWindow::FillValueSet()
+{
+ if( pColorTable )
+ {
+ aColorSet.Clear();
+
+ // Erster Eintrag: unsichtbar
+ long nPtX = aColorSize.Width() - 1;
+ long nPtY = aColorSize.Height() - 1;
+ VirtualDevice aVD;
+ aVD.SetOutputSizePixel( aColorSize );
+ aVD.SetLineColor( Color( COL_BLACK ) );
+ aVD.SetBackground( Wallpaper( Color( COL_WHITE ) ) );
+ aVD.DrawLine( Point(), Point( nPtX, nPtY ) );
+ aVD.DrawLine( Point( 0, nPtY ), Point( nPtX, 0 ) );
+
+ Bitmap aBmp( aVD.GetBitmap( Point(), aColorSize ) );
+
+ aColorSet.InsertItem( (sal_uInt16)1, Image(aBmp), SVX_RESSTR( RID_SVXSTR_INVISIBLE ) );
+
+ XColorEntry* pEntry;
+ nCount = pColorTable->Count();
+
+ for( long i = 0; i < nCount; i++ )
+ {
+ pEntry = pColorTable->GetColor( i );
+ aColorSet.InsertItem( (sal_uInt16)i+2,
+ pEntry->GetColor(), pEntry->GetName() );
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* SetSize
+|*
+\************************************************************************/
+
+void SvxColorDockingWindow::SetSize()
+{
+ // Groesse fuer ValueSet berechnen
+ Size aSize = GetOutputSizePixel();
+ aSize.Width() -= 4;
+ aSize.Height() -= 4;
+
+ // Zeilen und Spalten berechnen
+ nCols = (sal_uInt16) ( aSize.Width() / aItemSize.Width() );
+ nLines = (sal_uInt16) ( (float) aSize.Height() / (float) aItemSize.Height() /*+ 0.35*/ );
+ if( nLines == 0 )
+ nLines++;
+
+ // Scrollbar setzen/entfernen
+ WinBits nBits = aColorSet.GetStyle();
+ if ( nLines * nCols >= nCount )
+ nBits &= ~WB_VSCROLL;
+ else
+ nBits |= WB_VSCROLL;
+ aColorSet.SetStyle( nBits );
+
+ // ScrollBar ?
+ long nScrollWidth = aColorSet.GetScrollWidth();
+ if( nScrollWidth > 0 )
+ {
+ // Spalten mit ScrollBar berechnen
+ nCols = (sal_uInt16) ( ( aSize.Width() - nScrollWidth ) / aItemSize.Width() );
+ }
+ aColorSet.SetColCount( nCols );
+
+ if( IsFloatingMode() )
+ aColorSet.SetLineCount( nLines );
+ else
+ {
+ aColorSet.SetLineCount( 0 ); // sonst wird LineHeight ignoriert
+ aColorSet.SetItemHeight( aItemSize.Height() );
+ }
+
+ aColorSet.SetPosSizePixel( Point( 2, 2 ), aSize );
+}
+
+/*************************************************************************
+|*
+|* SvxColorDockingWindow: Close
+|*
+\************************************************************************/
+
+sal_Bool SvxColorDockingWindow::Close()
+{
+ SfxBoolItem aItem( SID_COLOR_CONTROL, sal_False );
+ GetBindings().GetDispatcher()->Execute(
+ SID_COLOR_CONTROL, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
+ SfxDockingWindow::Close();
+ return( sal_True );
+}
+
+/*************************************************************************
+|*
+|* SelectHdl
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxColorDockingWindow, SelectHdl, void *, EMPTYARG )
+{
+ SfxDispatcher* pDispatcher = GetBindings().GetDispatcher();
+ sal_uInt16 nPos = aColorSet.GetSelectItemId();
+ Color aColor( aColorSet.GetItemColor( nPos ) );
+ String aStr( aColorSet.GetItemText( nPos ) );
+
+ if (aColorSet.IsLeftButton())
+ {
+ if ( nLeftSlot == SID_ATTR_FILL_COLOR )
+ {
+ if ( nPos == 1 ) // unsichtbar
+ {
+ XFillStyleItem aXFillStyleItem( XFILL_NONE );
+ pDispatcher->Execute( nLeftSlot, SFX_CALLMODE_RECORD, &aXFillStyleItem, 0L );
+ }
+ else
+ {
+ sal_Bool bDone = sal_False;
+
+ // Wenn wir eine DrawView haben und uns im TextEdit-Modus befinden,
+ // wird nicht die Flaechen-, sondern die Textfarbe zugewiesen
+ SfxViewShell* pViewSh = SfxViewShell::Current();
+ if ( pViewSh )
+ {
+ SdrView* pView = pViewSh->GetDrawView();
+ if ( pView && pView->IsTextEdit() )
+ {
+ SvxColorItem aTextColorItem( aColor, SID_ATTR_CHAR_COLOR );
+ pDispatcher->Execute(
+ SID_ATTR_CHAR_COLOR, SFX_CALLMODE_RECORD, &aTextColorItem, 0L );
+ bDone = sal_True;
+ }
+ }
+ if ( !bDone )
+ {
+ XFillStyleItem aXFillStyleItem( XFILL_SOLID );
+ XFillColorItem aXFillColorItem( aStr, aColor );
+ pDispatcher->Execute(
+ nLeftSlot, SFX_CALLMODE_RECORD, &aXFillColorItem, &aXFillStyleItem, 0L );
+ }
+ }
+ }
+ else if ( nPos != 1 ) // unsichtbar
+ {
+ SvxColorItem aLeftColorItem( aColor, nLeftSlot );
+ pDispatcher->Execute( nLeftSlot, SFX_CALLMODE_RECORD, &aLeftColorItem, 0L );
+ }
+ }
+ else
+ {
+ if ( nRightSlot == SID_ATTR_LINE_COLOR )
+ {
+ if( nPos == 1 ) // unsichtbar
+ {
+ XLineStyleItem aXLineStyleItem( XLINE_NONE );
+ pDispatcher->Execute( nRightSlot, SFX_CALLMODE_RECORD, &aXLineStyleItem, 0L );
+ }
+ else
+ {
+ // Sollte der LineStyle unsichtbar sein, so wird er auf SOLID gesetzt
+ SfxViewShell* pViewSh = SfxViewShell::Current();
+ if ( pViewSh )
+ {
+ SdrView* pView = pViewSh->GetDrawView();
+ if ( pView )
+ {
+ SfxItemSet aAttrSet( pView->GetModel()->GetItemPool() );
+ pView->GetAttributes( aAttrSet );
+ if ( aAttrSet.GetItemState( XATTR_LINESTYLE ) != SFX_ITEM_DONTCARE )
+ {
+ XLineStyle eXLS = (XLineStyle)
+ ( (const XLineStyleItem&)aAttrSet.Get( XATTR_LINESTYLE ) ).GetValue();
+ if ( eXLS == XLINE_NONE )
+ {
+ XLineStyleItem aXLineStyleItem( XLINE_SOLID );
+ pDispatcher->Execute( nRightSlot, SFX_CALLMODE_RECORD, &aXLineStyleItem, 0L );
+ }
+ }
+ }
+ }
+
+ XLineColorItem aXLineColorItem( aStr, aColor );
+ pDispatcher->Execute( nRightSlot, SFX_CALLMODE_RECORD, &aXLineColorItem, 0L );
+ }
+ }
+ else if ( nPos != 1 ) // unsichtbar
+ {
+ SvxColorItem aRightColorItem( aColor, nRightSlot );
+ pDispatcher->Execute( nRightSlot, SFX_CALLMODE_RECORD, &aRightColorItem, 0L );
+ }
+ }
+
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* Resizing
+|*
+\************************************************************************/
+
+
+void SvxColorDockingWindow::Resizing( Size& rNewSize )
+{
+ rNewSize.Width() -= 4;
+ rNewSize.Height() -= 4;
+
+ // Spalten und Reihen ermitteln
+ nCols = (sal_uInt16) ( (float) rNewSize.Width() / (float) aItemSize.Width() + 0.5 );
+ nLines = (sal_uInt16) ( (float) rNewSize.Height() / (float) aItemSize.Height() + 0.5 );
+ if( nLines == 0 )
+ nLines = 1;
+
+ // Scrollbar setzen/entfernen
+ WinBits nBits = aColorSet.GetStyle();
+ if ( nLines * nCols >= nCount )
+ nBits &= ~WB_VSCROLL;
+ else
+ nBits |= WB_VSCROLL;
+ aColorSet.SetStyle( nBits );
+
+ // ScrollBar ?
+ long nScrollWidth = aColorSet.GetScrollWidth();
+ if( nScrollWidth > 0 )
+ {
+ // Spalten mit ScrollBar berechnen
+ nCols = (sal_uInt16) ( ( ( (float) rNewSize.Width() - (float) nScrollWidth ) )
+ / (float) aItemSize.Width() + 0.5 );
+ }
+ if( nCols <= 1 )
+ nCols = 2;
+
+ // Max. Reihen anhand der gegebenen Spalten berechnen
+ long nMaxLines = nCount / nCols;
+ if( nCount % nCols )
+ nMaxLines++;
+
+ nLines = sal::static_int_cast< sal_uInt16 >(
+ std::min< long >( nLines, nMaxLines ) );
+
+ // Groesse des Windows setzen
+ rNewSize.Width() = nCols * aItemSize.Width() + nScrollWidth + 4;
+ rNewSize.Height() = nLines * aItemSize.Height() + 4;
+}
+
+/*************************************************************************
+|*
+|* Resize
+|*
+\************************************************************************/
+
+void SvxColorDockingWindow::Resize()
+{
+ if ( !IsFloatingMode() || !GetFloatingWindow()->IsRollUp() )
+ SetSize();
+ SfxDockingWindow::Resize();
+}
+
+
+
+void SvxColorDockingWindow::GetFocus (void)
+{
+ SfxDockingWindow::GetFocus();
+ // Grab the focus to the color value set so that it can be controlled
+ // with the keyboard.
+ aColorSet.GrabFocus();
+}
+
+long SvxColorDockingWindow::Notify( NotifyEvent& rNEvt )
+{
+ long nRet = 0;
+ if( ( rNEvt.GetType() == EVENT_KEYINPUT ) )
+ {
+ KeyEvent aKeyEvt = *rNEvt.GetKeyEvent();
+ sal_uInt16 nKeyCode = aKeyEvt.GetKeyCode().GetCode();
+ switch( nKeyCode )
+ {
+ case KEY_ESCAPE:
+ GrabFocusToDocument();
+ nRet = 1;
+ break;
+ }
+ }
+
+ return nRet ? nRet : SfxDockingWindow::Notify( rNEvt );
+}
diff --git a/svx/source/tbxctrls/colrctrl.src b/svx/source/tbxctrls/colrctrl.src
new file mode 100644
index 000000000000..023c271c5455
--- /dev/null
+++ b/svx/source/tbxctrls/colrctrl.src
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ---------------------------------------------------------------
+ //#include "colrctrl.hrc"
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+ // pragma ----------------------------------------------------------------
+
+ // RID_SVXCTRL_COLOR -----------------------------------------------------
+DockingWindow RID_SVXCTRL_COLOR
+{
+ HelpID = HID_CTRL_COLOR ;
+ Border = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Sizeable = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+ Dockable = TRUE ;
+ EnableResizing = TRUE ;
+ Size = MAP_APPFONT ( 150 , 22 ) ;
+ Text [ en-US ] = "Colors" ;
+ Control 1
+ {
+ HelpId = HID_COLOR_CTL_COLORS ;
+ Pos = MAP_APPFONT ( 2 , 2 ) ;
+ Size = MAP_APPFONT ( 146 , 18 ) ;
+ Border = FALSE ;
+ };
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx
new file mode 100644
index 000000000000..fb68c8768d49
--- /dev/null
+++ b/svx/source/tbxctrls/extrusioncontrols.cxx
@@ -0,0 +1,1052 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <string> // HACK: prevent conflict between STLPORT and Workshop headers
+
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/awt/MenuItemStyle.hpp>
+#include <com/sun/star/awt/XPopupMenuExtended.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+
+#include <vos/mutex.hxx>
+
+#include <svtools/toolbarmenu.hxx>
+#include <vcl/toolbox.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objsh.hxx>
+#include <svl/eitem.hxx>
+#include <vcl/settings.hxx>
+#include <svl/intitem.hxx>
+#include <editeng/colritem.hxx>
+#include <tools/urlobj.hxx>
+
+#include <svx/dialogs.hrc>
+#include <svx/svdtrans.hxx>
+#include <svx/sdasitm.hxx>
+#include <svx/dialmgr.hxx>
+#include "svx/extrusioncolorcontrol.hxx"
+
+//#include "chrtitem.hxx"
+#include "helpid.hrc"
+#include "extrusioncontrols.hxx"
+#include "extrusioncontrols.hrc"
+#include "colorwindow.hxx"
+#include "extrusiondepthdialog.hxx"
+
+////////////
+
+using ::rtl::OUString;
+//using ::svtools::ToolbarMenu;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::graphic;
+
+namespace svx
+{
+
+/*************************************************************************
+|*
+|* ExtrusionDirectionWindow
+|*
+\************************************************************************/
+
+static sal_Int32 gSkewList[] = { 135, 90, 45, 180, 0, -360, -135, -90, -45 };
+
+ExtrusionDirectionWindow::ExtrusionDirectionWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow )
+: ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_DIRECTION ))
+, mrController( rController )
+, maImgPerspective( SVX_RES( IMG_PERSPECTIVE ) )
+, maImgPerspectiveH( SVX_RES( IMG_PERSPECTIVE_H ) )
+, maImgParallel( SVX_RES( IMG_PARALLEL ) )
+, maImgParallelH( SVX_RES( IMG_PARALLEL_H ) )
+, msExtrusionDirection( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDirection" ) )
+, msExtrusionProjection( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionProjection" ) )
+{
+ SetHelpId( HID_MENU_EXTRUSION_DIRECTION );
+
+ sal_uInt16 i;
+ for( i = DIRECTION_NW; i <= DIRECTION_SE; i++ )
+ {
+ maImgDirection[i] = Image( SVX_RES( IMG_DIRECTION + i ) );
+ maImgDirectionH[i] = Image( SVX_RES( IMG_DIRECTION_H + i ) );
+ }
+
+ SetSelectHdl( LINK( this, ExtrusionDirectionWindow, SelectHdl ) );
+ mpDirectionSet = createEmptyValueSetControl();
+ mpDirectionSet->SetHelpId( HID_VALUESET_EXTRUSION_DIRECTION );
+
+ mpDirectionSet->SetSelectHdl( LINK( this, ExtrusionDirectionWindow, SelectHdl ) );
+ mpDirectionSet->SetColCount( 3 );
+ mpDirectionSet->EnableFullItemMode( sal_False );
+
+ bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ for( i = DIRECTION_NW; i <= DIRECTION_SE; i++ )
+ {
+ String aText( SVX_RES( STR_DIRECTION + i ) );
+ mpDirectionSet->InsertItem( i+1, bHighContrast ? maImgDirectionH[ i ] : maImgDirection[ i ], aText );
+ }
+
+ mpDirectionSet->SetOutputSizePixel( Size( 72, 72 ) );
+
+ appendEntry( 2, mpDirectionSet );
+ appendSeparator();
+ appendEntry( 0, String( SVX_RES( STR_PERSPECTIVE ) ), bHighContrast ? maImgPerspectiveH : maImgPerspective );
+ appendEntry( 1, String( SVX_RES( STR_PARALLEL ) ), bHighContrast ? maImgParallelH : maImgParallel );
+
+ SetOutputSizePixel( getMenuSize() );
+
+ FreeResource();
+
+ AddStatusListener( msExtrusionDirection );
+ AddStatusListener( msExtrusionProjection );
+}
+
+void ExtrusionDirectionWindow::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ ToolbarMenu::DataChanged( rDCEvt );
+
+ if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
+ {
+ bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ for( sal_uInt16 i = DIRECTION_NW; i <= DIRECTION_SE; i++ )
+ {
+ mpDirectionSet->SetItemImage( i+1, bHighContrast ? maImgDirectionH[ i ] : maImgDirection[ i ] );
+ }
+
+ setEntryImage( 0, bHighContrast ? maImgPerspectiveH : maImgPerspective );
+ setEntryImage( 1, bHighContrast ? maImgParallelH : maImgParallel );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ExtrusionDirectionWindow::implSetDirection( sal_Int32 nSkew, bool bEnabled )
+{
+ if( mpDirectionSet )
+ {
+ sal_uInt16 nItemId;
+ for( nItemId = DIRECTION_NW; nItemId <= DIRECTION_SE; nItemId++ )
+ {
+ if( gSkewList[nItemId] == nSkew )
+ break;
+ }
+
+ if( nItemId <= DIRECTION_SE )
+ {
+ mpDirectionSet->SelectItem( nItemId+1 );
+ }
+ else
+ {
+ mpDirectionSet->SetNoSelection();
+ }
+ }
+ enableEntry( 2, bEnabled );
+}
+
+// -----------------------------------------------------------------------
+
+void ExtrusionDirectionWindow::implSetProjection( sal_Int32 nProjection, bool bEnabled )
+{
+ checkEntry( 0, (nProjection == 0) && bEnabled );
+ checkEntry( 1, (nProjection == 1 ) && bEnabled );
+ enableEntry( 0, bEnabled );
+ enableEntry( 1, bEnabled );
+}
+
+// -----------------------------------------------------------------------
+
+void SAL_CALL ExtrusionDirectionWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException )
+{
+ if( Event.FeatureURL.Main.equals( msExtrusionDirection ) )
+ {
+ if( !Event.IsEnabled )
+ {
+ implSetDirection( -1, false );
+ }
+ else
+ {
+ sal_Int32 nValue = 0;
+ if( Event.State >>= nValue )
+ implSetDirection( nValue, true );
+ }
+ }
+ else if( Event.FeatureURL.Main.equals( msExtrusionProjection ) )
+ {
+ if( !Event.IsEnabled )
+ {
+ implSetProjection( -1, false );
+ }
+ else
+ {
+ sal_Int32 nValue = 0;
+ if( Event.State >>= nValue )
+ implSetProjection( nValue, true );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ExtrusionDirectionWindow, SelectHdl, void *, pControl )
+{
+ if ( IsInPopupMode() )
+ EndPopupMode();
+
+ if( pControl == mpDirectionSet )
+ {
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = msExtrusionDirection.copy(5);
+ aArgs[0].Value <<= (sal_Int32)gSkewList[mpDirectionSet->GetSelectItemId()-1];
+
+ mrController.dispatchCommand( msExtrusionDirection, aArgs );
+ }
+ else
+ {
+ int nProjection = getSelectedEntryId();
+ if( (nProjection >= 0) && (nProjection < 2 ) )
+ {
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = msExtrusionProjection.copy(5);
+ aArgs[0].Value <<= (sal_Int32)nProjection;
+
+ mrController.dispatchCommand( msExtrusionProjection, aArgs );
+ implSetProjection( nProjection, true );
+ }
+ }
+
+ return 0;
+}
+
+// =======================================================================
+// ExtrusionDirectionControl
+// =======================================================================
+
+ExtrusionDirectionControl::ExtrusionDirectionControl( const Reference< lang::XMultiServiceFactory >& rServiceManager )
+: svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDirectionFloater" ) ) )
+{
+}
+
+// -----------------------------------------------------------------------
+
+::Window* ExtrusionDirectionControl::createPopupWindow( ::Window* pParent )
+{
+ return new ExtrusionDirectionWindow( *this, m_xFrame, pParent );
+}
+
+// -----------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------
+
+OUString SAL_CALL ExtrusionDirectionControl_getImplementationName()
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.ExtrusionDirectionController" ));
+}
+
+// --------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL ExtrusionDirectionControl_getSupportedServiceNames() throw( RuntimeException )
+{
+ Sequence< OUString > aSNS( 1 );
+ aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ));
+ return aSNS;
+}
+
+// --------------------------------------------------------------------
+
+Reference< XInterface > SAL_CALL SAL_CALL ExtrusionDirectionControl_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException )
+{
+ return *new ExtrusionDirectionControl( rSMgr );
+}
+
+// --------------------------------------------------------------------
+
+OUString SAL_CALL ExtrusionDirectionControl::getImplementationName( ) throw (RuntimeException)
+{
+ return ExtrusionDirectionControl_getImplementationName();
+}
+
+// --------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL ExtrusionDirectionControl::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ return ExtrusionDirectionControl_getSupportedServiceNames();
+}
+
+// ####################################################################
+
+ExtrusionDepthDialog::ExtrusionDepthDialog( Window* pParent, double fDepth, FieldUnit eDefaultUnit )
+: ModalDialog( pParent, SVX_RES( RID_SVX_MDLG_EXTRUSION_DEPTH ) ),
+ maFLDepth( this, SVX_RES( FL_DEPTH ) ),
+ maMtrDepth( this, SVX_RES( MTR_DEPTH ) ),
+ maOKButton( this, SVX_RES( BTN_OK ) ),
+ maCancelButton( this, SVX_RES( BTN_CANCEL ) ),
+ maHelpButton( this, SVX_RES( BTN_HELP ) )
+{
+ bool bMetric = IsMetric( eDefaultUnit );
+ maMtrDepth.SetUnit( bMetric ? FUNIT_CM : FUNIT_INCH );
+ maMtrDepth.SetValue( (int) fDepth * 100, FUNIT_100TH_MM );
+
+ FreeResource();
+}
+
+ExtrusionDepthDialog::~ExtrusionDepthDialog()
+{
+}
+
+double ExtrusionDepthDialog::getDepth() const
+{
+// bool bMetric = IsMetric( meDefaultUnit );
+ return (double)( maMtrDepth.GetValue( FUNIT_100TH_MM ) ) / 100.0;
+}
+
+// ####################################################################
+
+double aDepthListInch[] = { 0, 1270,2540,5080,10160 };
+double aDepthListMM[] = { 0, 1000, 2500, 5000, 10000 };
+
+ExtrusionDepthWindow::ExtrusionDepthWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow )
+: ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_DEPTH ))
+, mrController( rController )
+, maImgDepth0( SVX_RES( IMG_DEPTH_0 ) )
+, maImgDepth1( SVX_RES( IMG_DEPTH_1 ) )
+, maImgDepth2( SVX_RES( IMG_DEPTH_2 ) )
+, maImgDepth3( SVX_RES( IMG_DEPTH_3 ) )
+, maImgDepth4( SVX_RES( IMG_DEPTH_4 ) )
+, maImgDepthInfinity( SVX_RES( IMG_DEPTH_INFINITY ) )
+, maImgDepth0h( SVX_RES( IMG_DEPTH_0_H ) )
+, maImgDepth1h( SVX_RES( IMG_DEPTH_1_H ) )
+, maImgDepth2h( SVX_RES( IMG_DEPTH_2_H ) )
+, maImgDepth3h( SVX_RES( IMG_DEPTH_3_H ) )
+, maImgDepth4h( SVX_RES( IMG_DEPTH_4_H ) )
+, maImgDepthInfinityh( SVX_RES( IMG_DEPTH_INFINITY_H ) )
+, mfDepth( -1.0 )
+, msExtrusionDepth( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepth" ) )
+, msMetricUnit( RTL_CONSTASCII_USTRINGPARAM( ".uno:MetricUnit" ) )
+{
+ SetHelpId( HID_MENU_EXTRUSION_DEPTH );
+
+ SetSelectHdl( LINK( this, ExtrusionDepthWindow, SelectHdl ) );
+
+ bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ String aEmpty;
+ appendEntry( 0, aEmpty, bHighContrast ? maImgDepth0h : maImgDepth0 );
+ appendEntry( 1, aEmpty, bHighContrast ? maImgDepth1h : maImgDepth1 );
+ appendEntry( 2, aEmpty, bHighContrast ? maImgDepth2h : maImgDepth2 );
+ appendEntry( 3, aEmpty, bHighContrast ? maImgDepth3h : maImgDepth3 );
+ appendEntry( 4, aEmpty, bHighContrast ? maImgDepth4h : maImgDepth4 );
+ appendEntry( 5, String( SVX_RES( STR_INFINITY ) ), bHighContrast ? maImgDepthInfinityh : maImgDepthInfinity );
+ appendEntry( 6, String( SVX_RES( STR_CUSTOM ) ) );
+
+ SetOutputSizePixel( getMenuSize() );
+
+ FreeResource();
+
+ AddStatusListener( msExtrusionDepth );
+ AddStatusListener( msMetricUnit );
+}
+
+// -----------------------------------------------------------------------
+
+void ExtrusionDepthWindow::implSetDepth( double fDepth )
+{
+ mfDepth = fDepth;
+ int i;
+ for( i = 0; i < 7; i++ )
+ {
+ if( i == 5 )
+ {
+ checkEntry( i, fDepth >= 338666 );
+ }
+ else if( i != 6 )
+ {
+ checkEntry( i, (fDepth == (IsMetric( meUnit ) ? aDepthListMM[i] : aDepthListInch[i]) ) );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ExtrusionDepthWindow::implFillStrings( FieldUnit eUnit )
+{
+ meUnit = eUnit;
+ sal_uInt16 nResource = IsMetric( eUnit ) ? RID_SVXSTR_DEPTH_0 : RID_SVXSTR_DEPTH_0_INCH;
+
+ for( int i = 0; i < 5; i++ )
+ {
+ String aStr( SVX_RES( nResource + i ) );
+ setEntryText( i, aStr );
+ };
+}
+
+// -----------------------------------------------------------------------
+
+void SAL_CALL ExtrusionDepthWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException )
+{
+ if( Event.FeatureURL.Main.equals( msExtrusionDepth ) )
+ {
+ if( !Event.IsEnabled )
+ {
+ implSetDepth( 0 );
+ }
+ else
+ {
+ double fValue = 0.0;
+ if( Event.State >>= fValue )
+ implSetDepth( fValue );
+ }
+ }
+ else if( Event.FeatureURL.Main.equals( msMetricUnit ) )
+ {
+ if( Event.IsEnabled )
+ {
+ sal_Int32 nValue = 0;
+ if( Event.State >>= nValue )
+ {
+ implFillStrings( static_cast<FieldUnit>(nValue) );
+ if( mfDepth >= 0.0 )
+ implSetDepth( mfDepth );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ExtrusionDepthWindow::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ ToolbarMenu::DataChanged( rDCEvt );
+
+ if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
+ {
+ bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ setEntryImage( 0, bHighContrast ? maImgDepth0h : maImgDepth0 );
+ setEntryImage( 1, bHighContrast ? maImgDepth1h : maImgDepth1 );
+ setEntryImage( 2, bHighContrast ? maImgDepth2h : maImgDepth2 );
+ setEntryImage( 3, bHighContrast ? maImgDepth3h : maImgDepth3 );
+ setEntryImage( 4, bHighContrast ? maImgDepth4h : maImgDepth4 );
+ setEntryImage( 5, bHighContrast ? maImgDepthInfinityh : maImgDepthInfinity );
+ }
+}
+
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ExtrusionDepthWindow, SelectHdl, void *, EMPTYARG )
+{
+ int nSelected = getSelectedEntryId();
+ if( nSelected != -1 )
+ {
+ if( nSelected == 6 )
+ {
+ if ( IsInPopupMode() )
+ EndPopupMode();
+
+ const rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepthDialog" ));
+
+ Any a;
+ Sequence< PropertyValue > aArgs( 2 );
+ aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Depth" ));
+ aArgs[0].Value <<= mfDepth;
+ aArgs[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Metric" ));
+ aArgs[1].Value <<= static_cast<sal_Int32>( meUnit );
+
+ mrController.dispatchCommand( aCommand, aArgs );
+ }
+ else
+ {
+ double fDepth;
+
+ if( nSelected == 5 )
+ {
+ fDepth = 338666.6;
+ }
+ else
+ {
+ fDepth = IsMetric( meUnit ) ? aDepthListMM[nSelected] : aDepthListInch[nSelected];
+ }
+
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = msExtrusionDepth.copy(5);
+ aArgs[0].Value <<= fDepth;
+
+ mrController.dispatchCommand( msExtrusionDepth, aArgs );
+ implSetDepth( fDepth );
+
+ if ( IsInPopupMode() )
+ EndPopupMode();
+ }
+ }
+ return 0;
+}
+
+// =======================================================================
+// ExtrusionDirectionControl
+// =======================================================================
+
+ExtrusionDepthController::ExtrusionDepthController( const Reference< lang::XMultiServiceFactory >& rServiceManager )
+: svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepthFloater" ) ) )
+{
+}
+
+// -----------------------------------------------------------------------
+
+::Window* ExtrusionDepthController::createPopupWindow( ::Window* pParent )
+{
+ return new ExtrusionDepthWindow( *this, m_xFrame, pParent );
+}
+
+
+// -----------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------
+
+OUString SAL_CALL ExtrusionDepthController_getImplementationName()
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.ExtrusionDepthController" ));
+}
+
+// --------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL ExtrusionDepthController_getSupportedServiceNames() throw( RuntimeException )
+{
+ Sequence< OUString > aSNS( 1 );
+ aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.PopupMenuController" ));
+ return aSNS;
+}
+
+// --------------------------------------------------------------------
+
+Reference< XInterface > SAL_CALL SAL_CALL ExtrusionDepthController_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException )
+{
+ return *new ExtrusionDepthController( rSMgr );
+}
+
+// --------------------------------------------------------------------
+
+OUString SAL_CALL ExtrusionDepthController::getImplementationName( ) throw (RuntimeException)
+{
+ return ExtrusionDepthController_getImplementationName();
+}
+
+// --------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL ExtrusionDepthController::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ return ExtrusionDepthController_getSupportedServiceNames();
+}
+
+
+// ####################################################################
+
+// -------------------------------------------------------------------------
+
+ExtrusionLightingWindow::ExtrusionLightingWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow )
+: ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_LIGHTING ))
+, mrController( rController )
+, maImgBright( SVX_RES( IMG_LIGHTING_BRIGHT ) )
+, maImgNormal( SVX_RES( IMG_LIGHTING_NORMAL ) )
+, maImgDim( SVX_RES( IMG_LIGHTING_DIM ) )
+, maImgBrighth( SVX_RES( IMG_LIGHTING_BRIGHT_H ) )
+, maImgNormalh( SVX_RES( IMG_LIGHTING_NORMAL_H ) )
+, maImgDimh( SVX_RES( IMG_LIGHTING_DIM_H ) )
+, mnLevel( 0 )
+, mbLevelEnabled( false )
+, mnDirection( FROM_FRONT )
+, mbDirectionEnabled( false )
+, msExtrusionLightingDirection( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingDirection" ))
+, msExtrusionLightingIntensity( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingIntensity" ))
+{
+ sal_uInt16 i;
+ for( i = FROM_TOP_LEFT; i <= FROM_BOTTOM_RIGHT; i++ )
+ {
+ if( i != FROM_FRONT )
+ {
+ maImgLightingOff[i] = Image( SVX_RES( IMG_LIGHT_OFF + i ) );
+ maImgLightingOn[i] = Image( SVX_RES( IMG_LIGHT_ON + i ) );
+ maImgLightingOffh[i] = Image( SVX_RES( IMG_LIGHT_OFF_H + i ) );
+ maImgLightingOnh[i] = Image( SVX_RES( IMG_LIGHT_ON_H + i ) );
+ }
+ maImgLightingPreview[i] = Image( SVX_RES( IMG_LIGHT_PREVIEW + i ) );
+ maImgLightingPreviewh[i] = Image( SVX_RES( IMG_LIGHT_PREVIEW_H + i ) );
+ }
+
+ SetHelpId( HID_MENU_EXTRUSION_LIGHTING );
+ SetSelectHdl( LINK( this, ExtrusionLightingWindow, SelectHdl ) );
+
+ mpLightingSet = createEmptyValueSetControl();
+ mpLightingSet->SetHelpId( HID_VALUESET_EXTRUSION_LIGHTING );
+
+ mpLightingSet->SetSelectHdl( LINK( this, ExtrusionLightingWindow, SelectHdl ) );
+ mpLightingSet->SetColCount( 3 );
+ mpLightingSet->EnableFullItemMode( sal_False );
+
+ bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ for( i = FROM_TOP_LEFT; i <= FROM_BOTTOM_RIGHT; i++ )
+ {
+ if( i != FROM_FRONT )
+ {
+ mpLightingSet->InsertItem( i+1, bHighContrast ? maImgLightingOffh[i] : maImgLightingOff[i] );
+ }
+ else
+ {
+ mpLightingSet->InsertItem( 5, bHighContrast ? maImgLightingPreviewh[FROM_FRONT] : maImgLightingPreview[FROM_FRONT] );
+ }
+ }
+ mpLightingSet->SetOutputSizePixel( Size( 72, 72 ) );
+
+ appendEntry( 3, mpLightingSet );
+ appendSeparator();
+ appendEntry( 0, String( SVX_RES( STR_BRIGHT ) ), bHighContrast ? maImgBrighth : maImgBright );
+ appendEntry( 1, String( SVX_RES( STR_NORMAL ) ), bHighContrast ? maImgNormalh : maImgNormal );
+ appendEntry( 2, String( SVX_RES( STR_DIM ) ), bHighContrast ? maImgDimh : maImgDim );
+
+ SetOutputSizePixel( getMenuSize() );
+
+ FreeResource();
+
+ AddStatusListener( msExtrusionLightingDirection );
+ AddStatusListener( msExtrusionLightingIntensity );
+}
+
+// -----------------------------------------------------------------------
+
+void ExtrusionLightingWindow::implSetIntensity( int nLevel, bool bEnabled )
+{
+ mnLevel = nLevel;
+ mbLevelEnabled = bEnabled;
+ int i = 0;
+ for( i = 0; i < 3; i++ )
+ {
+ checkEntry( i, (i == nLevel) && bEnabled );
+ enableEntry( i, bEnabled );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ExtrusionLightingWindow::implSetDirection( int nDirection, bool bEnabled )
+{
+ mnDirection = nDirection;
+ mbDirectionEnabled = bEnabled;
+
+ bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ if( !bEnabled )
+ nDirection = FROM_FRONT;
+
+ sal_uInt16 nItemId;
+ for( nItemId = FROM_TOP_LEFT; nItemId <= FROM_BOTTOM_RIGHT; nItemId++ )
+ {
+ if( nItemId == FROM_FRONT )
+ {
+ mpLightingSet->SetItemImage( nItemId + 1, bHighContrast ? maImgLightingPreviewh[ nDirection ] : maImgLightingPreview[ nDirection ] );
+ }
+ else
+ {
+ if( bHighContrast )
+ {
+ mpLightingSet->SetItemImage( nItemId + 1, (sal_uInt16)nDirection == nItemId ? maImgLightingOnh[nItemId] : maImgLightingOffh[nItemId] );
+ }
+ else
+ {
+ mpLightingSet->SetItemImage( nItemId + 1, (sal_uInt16)nDirection == nItemId ? maImgLightingOn[nItemId] : maImgLightingOff[nItemId] );
+ }
+ }
+ }
+
+ enableEntry( 3, bEnabled );
+}
+
+// -----------------------------------------------------------------------
+
+void SAL_CALL ExtrusionLightingWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException )
+{
+ if( Event.FeatureURL.Main.equals( msExtrusionLightingIntensity ) )
+ {
+ if( !Event.IsEnabled )
+ {
+ implSetIntensity( 0, false );
+ }
+ else
+ {
+ sal_Int32 nValue = 0;
+ if( Event.State >>= nValue )
+ implSetIntensity( nValue, true );
+ }
+ }
+ else if( Event.FeatureURL.Main.equals( msExtrusionLightingDirection ) )
+ {
+ if( !Event.IsEnabled )
+ {
+ implSetDirection( 0, false );
+ }
+ else
+ {
+ sal_Int32 nValue = 0;
+ if( Event.State >>= nValue )
+ implSetDirection( nValue, true );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ExtrusionLightingWindow::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ ToolbarMenu::DataChanged( rDCEvt );
+
+ if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
+ {
+ bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ implSetDirection( mnDirection, mbDirectionEnabled );
+ setEntryImage( 0, bHighContrast ? maImgBrighth : maImgBright );
+ setEntryImage( 1, bHighContrast ? maImgNormalh : maImgNormal );
+ setEntryImage( 2, bHighContrast ? maImgDimh : maImgDim );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ExtrusionLightingWindow, SelectHdl, void *, pControl )
+{
+ if ( IsInPopupMode() )
+ EndPopupMode();
+
+ if( pControl == this )
+ {
+ int nLevel = getSelectedEntryId();
+ if( nLevel >= 0 )
+ {
+ if( nLevel != 3 )
+ {
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = msExtrusionLightingIntensity.copy(5);
+ aArgs[0].Value <<= (sal_Int32)nLevel;
+
+ mrController.dispatchCommand( msExtrusionLightingIntensity, aArgs );
+
+ implSetIntensity( nLevel, true );
+ }
+ }
+ }
+ else
+ {
+ sal_Int32 nDirection = mpLightingSet->GetSelectItemId();
+
+ if( (nDirection > 0) && (nDirection < 10) )
+ {
+ nDirection--;
+
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = msExtrusionLightingDirection.copy(5);
+ aArgs[0].Value <<= (sal_Int32)nDirection;
+
+ mrController.dispatchCommand( msExtrusionLightingDirection, aArgs );
+
+ implSetDirection( nDirection, true );
+ }
+
+ }
+
+ return 0;
+}
+
+// ========================================================================
+
+ExtrusionLightingControl::ExtrusionLightingControl( const Reference< lang::XMultiServiceFactory >& rServiceManager )
+: svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDirectionFloater" ) ) )
+{
+}
+
+// -----------------------------------------------------------------------
+
+::Window* ExtrusionLightingControl::createPopupWindow( ::Window* pParent )
+{
+ return new ExtrusionLightingWindow( *this, m_xFrame, pParent );
+}
+
+// -----------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------
+
+OUString SAL_CALL ExtrusionLightingControl_getImplementationName()
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.ExtrusionLightingController" ));
+}
+
+// --------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL ExtrusionLightingControl_getSupportedServiceNames() throw( RuntimeException )
+{
+ Sequence< OUString > aSNS( 1 );
+ aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ));
+ return aSNS;
+}
+
+// --------------------------------------------------------------------
+
+Reference< XInterface > SAL_CALL SAL_CALL ExtrusionLightingControl_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException )
+{
+ return *new ExtrusionLightingControl( rSMgr );
+}
+
+// --------------------------------------------------------------------
+
+OUString SAL_CALL ExtrusionLightingControl::getImplementationName( ) throw (RuntimeException)
+{
+ return ExtrusionLightingControl_getImplementationName();
+}
+
+// --------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL ExtrusionLightingControl::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ return ExtrusionLightingControl_getSupportedServiceNames();
+}
+
+// ####################################################################
+
+ExtrusionSurfaceWindow::ExtrusionSurfaceWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow )
+: ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_SURFACE ))
+, mrController( rController )
+, maImgSurface1( SVX_RES( IMG_WIRE_FRAME ) )
+, maImgSurface2( SVX_RES( IMG_MATTE ) )
+, maImgSurface3( SVX_RES( IMG_PLASTIC ) )
+, maImgSurface4( SVX_RES( IMG_METAL ) )
+, maImgSurface1h( SVX_RES( IMG_WIRE_FRAME_H ) )
+, maImgSurface2h( SVX_RES( IMG_MATTE_H ) )
+, maImgSurface3h( SVX_RES( IMG_PLASTIC_H ) )
+, maImgSurface4h( SVX_RES( IMG_METAL_H ) )
+, msExtrusionSurface( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionSurface" ))
+{
+ bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ SetHelpId( HID_MENU_EXTRUSION_SURFACE );
+ SetSelectHdl( LINK( this, ExtrusionSurfaceWindow, SelectHdl ) );
+
+ appendEntry( 0, String( SVX_RES( STR_WIREFRAME ) ), bHighContrast ? maImgSurface1h : maImgSurface1 );
+ appendEntry( 1, String( SVX_RES( STR_MATTE ) ), bHighContrast ? maImgSurface2h : maImgSurface2 );
+ appendEntry( 2, String( SVX_RES( STR_PLASTIC ) ), bHighContrast ? maImgSurface3h : maImgSurface3 );
+ appendEntry( 3, String( SVX_RES( STR_METAL ) ), bHighContrast ? maImgSurface4h : maImgSurface4 );
+
+ SetOutputSizePixel( getMenuSize() );
+
+ FreeResource();
+
+ AddStatusListener( msExtrusionSurface );
+}
+
+// -----------------------------------------------------------------------
+
+void ExtrusionSurfaceWindow::implSetSurface( int nSurface, bool bEnabled )
+{
+// if( mpMenu )
+ {
+ int i;
+ for( i = 0; i < 4; i++ )
+ {
+ checkEntry( i, (i == nSurface) && bEnabled );
+ enableEntry( i, bEnabled );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SAL_CALL ExtrusionSurfaceWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException )
+{
+ if( Event.FeatureURL.Main.equals( msExtrusionSurface ) )
+ {
+ if( !Event.IsEnabled )
+ {
+ implSetSurface( 0, false );
+ }
+ else
+ {
+ sal_Int32 nValue = 0;
+ if( Event.State >>= nValue )
+ implSetSurface( nValue, true );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ExtrusionSurfaceWindow, SelectHdl, void *, EMPTYARG )
+{
+ if ( IsInPopupMode() )
+ EndPopupMode();
+
+ sal_Int32 nSurface = getSelectedEntryId();
+ if( nSurface >= 0 )
+ {
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = msExtrusionSurface.copy(5);
+ aArgs[0].Value <<= (sal_Int32)nSurface;
+
+ mrController.dispatchCommand( msExtrusionSurface, aArgs );
+
+ implSetSurface( nSurface, true );
+ }
+
+ return 0;
+}
+
+// ========================================================================
+
+ExtrusionSurfaceControl::ExtrusionSurfaceControl( const Reference< lang::XMultiServiceFactory >& rServiceManager )
+: svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionSurfaceFloater" ) ) )
+{
+}
+
+// -----------------------------------------------------------------------
+
+::Window* ExtrusionSurfaceControl::createPopupWindow( ::Window* pParent )
+{
+ return new ExtrusionSurfaceWindow( *this, m_xFrame, pParent );
+}
+
+// -----------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------
+
+OUString SAL_CALL ExtrusionSurfaceControl_getImplementationName()
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.ExtrusionSurfaceController" ));
+}
+
+// --------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL ExtrusionSurfaceControl_getSupportedServiceNames() throw( RuntimeException )
+{
+ Sequence< OUString > aSNS( 1 );
+ aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ));
+ return aSNS;
+}
+
+// --------------------------------------------------------------------
+
+Reference< XInterface > SAL_CALL SAL_CALL ExtrusionSurfaceControl_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException )
+{
+ return *new ExtrusionSurfaceControl( rSMgr );
+}
+
+// --------------------------------------------------------------------
+
+OUString SAL_CALL ExtrusionSurfaceControl::getImplementationName( ) throw (RuntimeException)
+{
+ return ExtrusionSurfaceControl_getImplementationName();
+}
+
+// --------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL ExtrusionSurfaceControl::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ return ExtrusionSurfaceControl_getSupportedServiceNames();
+}
+
+//========================================================================
+
+SFX_IMPL_TOOLBOX_CONTROL( ExtrusionColorControl, SvxColorItem );
+
+ExtrusionColorControl::ExtrusionColorControl(
+ sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
+: SfxToolBoxControl ( nSlotId, nId, rTbx )
+{
+ rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) );
+ mpBtnUpdater = new ToolboxButtonColorUpdater( nSlotId, nId, &GetToolBox(), TBX_UPDATER_MODE_CHAR_COLOR_NEW );
+}
+
+// -----------------------------------------------------------------------
+
+ExtrusionColorControl::~ExtrusionColorControl()
+{
+ delete mpBtnUpdater;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPopupWindowType ExtrusionColorControl::GetPopupWindowType() const
+{
+ return SFX_POPUPWINDOW_ONCLICK;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPopupWindow* ExtrusionColorControl::CreatePopupWindow()
+{
+ SvxColorWindow_Impl* pColorWin = new SvxColorWindow_Impl(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Extrusion3DColor" )),
+ SID_EXTRUSION_3D_COLOR,
+ m_xFrame,
+ SVX_RESSTR( RID_SVXSTR_EXTRUSION_COLOR ),
+ &GetToolBox() );
+ pColorWin->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_ALLOWTEAROFF );
+ pColorWin->StartSelection();
+ SetPopupWindow( pColorWin );
+ return pColorWin;
+}
+
+// -----------------------------------------------------------------------
+
+void ExtrusionColorControl::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+{
+ sal_uInt16 nId = GetId();
+ ToolBox& rTbx = GetToolBox();
+
+ if( nSID == SID_EXTRUSION_3D_COLOR )
+ {
+ const SvxColorItem* pItem = 0;
+
+ if( SFX_ITEM_DONTCARE != eState )
+ pItem = PTR_CAST( SvxColorItem, pState );
+
+ if ( pItem )
+ mpBtnUpdater->Update( pItem->GetValue());
+ }
+
+ rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState );
+ rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK );
+}
+
+}
diff --git a/svx/source/tbxctrls/extrusioncontrols.hrc b/svx/source/tbxctrls/extrusioncontrols.hrc
new file mode 100644
index 000000000000..705381cb68a6
--- /dev/null
+++ b/svx/source/tbxctrls/extrusioncontrols.hrc
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <svx/dialogs.hrc>
+
+// enum to index light images
+#define FROM_TOP_LEFT 0
+#define FROM_TOP 1
+#define FROM_TOP_RIGHT 2
+#define FROM_LEFT 3
+#define FROM_FRONT 4
+#define FROM_RIGHT 5
+#define FROM_BOTTOM_LEFT 6
+#define FROM_BOTTOM 7
+#define FROM_BOTTOM_RIGHT 8
+
+#define DIRECTION_NW 0
+#define DIRECTION_N 1
+#define DIRECTION_NE 2
+#define DIRECTION_W 3
+#define DIRECTION_NONE 4
+#define DIRECTION_E 5
+#define DIRECTION_SW 6
+#define DIRECTION_S 7
+#define DIRECTION_SE 8
+
+#define STR_PERSPECTIVE 1
+#define STR_PARALLEL 2
+#define STR_CUSTOM 3
+#define STR_INFINITY 4
+
+#define STR_BRIGHT 15
+#define STR_NORMAL 16
+#define STR_DIM 17
+
+#define STR_WIREFRAME 18
+#define STR_MATTE 19
+#define STR_PLASTIC 20
+#define STR_METAL 21
+
+#define STR_DIRECTION 30 // needs 10 resource ids
+
+#define IMG_DIRECTION 1 // needs 10 resource ids
+#define IMG_DIRECTION_H 10 // needs 10 resource ids
+
+#define IMG_DEPTH_0 19
+#define IMG_DEPTH_1 20
+#define IMG_DEPTH_2 21
+#define IMG_DEPTH_3 22
+#define IMG_DEPTH_4 23
+#define IMG_DEPTH_INFINITY 24
+
+#define IMG_DEPTH_0_H 25
+#define IMG_DEPTH_1_H 26
+#define IMG_DEPTH_2_H 27
+#define IMG_DEPTH_3_H 28
+#define IMG_DEPTH_4_H 29
+#define IMG_DEPTH_INFINITY_H 30
+
+#define IMG_PERSPECTIVE 31
+#define IMG_PERSPECTIVE_H 32
+#define IMG_PARALLEL 33
+#define IMG_PARALLEL_H 34
+
+#define IMG_WIRE_FRAME 35
+#define IMG_MATTE 36
+#define IMG_PLASTIC 37
+#define IMG_METAL 38
+
+#define IMG_WIRE_FRAME_H 39
+#define IMG_MATTE_H 40
+#define IMG_PLASTIC_H 41
+#define IMG_METAL_H 42
+
+#define IMG_LIGHT_OFF 50 // needs 10 resource ids
+#define IMG_LIGHT_ON 60 // needs 10 resource ids
+#define IMG_LIGHT_PREVIEW 70 // needs 10 resource ids
+
+#define IMG_LIGHT_OFF_H 80 // needs 10 resource ids
+#define IMG_LIGHT_ON_H 90 // needs 10 resource ids
+#define IMG_LIGHT_PREVIEW_H 100 // needs 10 resource ids
+
+#define IMG_LIGHTING_BRIGHT 110
+#define IMG_LIGHTING_NORMAL 111
+#define IMG_LIGHTING_DIM 112
+
+#define IMG_LIGHTING_BRIGHT_H 113
+#define IMG_LIGHTING_NORMAL_H 114
+#define IMG_LIGHTING_DIM_H 115
+
+#define FL_DEPTH 1
+#define MTR_DEPTH 2
+#define BTN_OK 3
+#define BTN_CANCEL 4
+#define BTN_HELP 5
+
+//
diff --git a/svx/source/tbxctrls/extrusioncontrols.hxx b/svx/source/tbxctrls/extrusioncontrols.hxx
new file mode 100644
index 000000000000..3dd8272b6940
--- /dev/null
+++ b/svx/source/tbxctrls/extrusioncontrols.hxx
@@ -0,0 +1,260 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_EXTRUSION_CONTROLS_HXX
+#define _SVX_EXTRUSION_CONTROLS_HXX
+
+#include "svx/svxdllapi.h"
+
+#include <svtools/valueset.hxx>
+#include <svtools/svtreebx.hxx>
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+
+#include <svtools/toolbarmenu.hxx>
+#include <svtools/popupwindowcontroller.hxx>
+#include <svtools/popupmenucontrollerbase.hxx>
+
+class SfxBindings;
+class SfxStatusForwarder;
+
+//========================================================================
+
+namespace svx
+{
+class ToolboxButtonColorUpdater;
+
+class ExtrusionDirectionWindow : public svtools::ToolbarMenu
+{
+public:
+ ExtrusionDirectionWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow );
+
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+private:
+ svt::ToolboxController& mrController;
+ ValueSet* mpDirectionSet;
+
+ Image maImgDirection[9];
+ Image maImgDirectionH[9];
+
+ Image maImgPerspective;
+ Image maImgPerspectiveH;
+ Image maImgParallel;
+ Image maImgParallelH;
+
+ const rtl::OUString msExtrusionDirection;
+ const rtl::OUString msExtrusionProjection;
+
+ DECL_LINK( SelectHdl, void * );
+ void FillValueSet();
+
+ void implSetDirection( sal_Int32 nSkew, bool bEnabled = true );
+ void implSetProjection( sal_Int32 nProjection, bool bEnabled = true );
+
+};
+
+//========================================================================
+
+class ExtrusionDirectionControl : public svt::PopupWindowController
+{
+public:
+ ExtrusionDirectionControl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
+
+ virtual ::Window* createPopupWindow( ::Window* pParent );
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
+
+ using svt::PopupWindowController::createPopupWindow;
+};
+
+//========================================================================
+
+class ExtrusionDepthWindow : public svtools::ToolbarMenu
+{
+private:
+ svt::ToolboxController& mrController;
+
+ Image maImgDepth0;
+ Image maImgDepth1;
+ Image maImgDepth2;
+ Image maImgDepth3;
+ Image maImgDepth4;
+ Image maImgDepthInfinity;
+
+ Image maImgDepth0h;
+ Image maImgDepth1h;
+ Image maImgDepth2h;
+ Image maImgDepth3h;
+ Image maImgDepth4h;
+ Image maImgDepthInfinityh;
+
+ FieldUnit meUnit;
+ double mfDepth;
+
+ const rtl::OUString msExtrusionDepth;
+ const rtl::OUString msMetricUnit;
+
+ DECL_LINK( SelectHdl, void * );
+
+ void implFillStrings( FieldUnit eUnit );
+ void implSetDepth( double fDepth );
+
+public:
+ ExtrusionDepthWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow );
+
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+};
+
+//========================================================================
+
+class ExtrusionDepthController : public svt::PopupWindowController
+{
+public:
+ ExtrusionDepthController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
+
+ virtual ::Window* createPopupWindow( ::Window* pParent );
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
+
+ using svt::PopupWindowController::createPopupWindow;
+};
+
+//========================================================================
+
+class ExtrusionLightingWindow : public svtools::ToolbarMenu
+{
+private:
+ svt::ToolboxController& mrController;
+ ValueSet* mpLightingSet;
+
+ Image maImgLightingOff[9];
+ Image maImgLightingOn[9];
+ Image maImgLightingPreview[9];
+
+ Image maImgLightingOffh[9];
+ Image maImgLightingOnh[9];
+ Image maImgLightingPreviewh[9];
+
+ Image maImgBright;
+ Image maImgNormal;
+ Image maImgDim;
+ Image maImgBrighth;
+ Image maImgNormalh;
+ Image maImgDimh;
+
+ int mnLevel;
+ bool mbLevelEnabled;
+ int mnDirection;
+ bool mbDirectionEnabled;
+
+ const rtl::OUString msExtrusionLightingDirection;
+ const rtl::OUString msExtrusionLightingIntensity;
+
+ void implSetIntensity( int nLevel, bool bEnabled );
+ void implSetDirection( int nDirection, bool bEnabled );
+
+ DECL_LINK( SelectHdl, void * );
+public:
+ ExtrusionLightingWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow );
+
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+};
+
+//========================================================================
+
+class ExtrusionLightingControl : public svt::PopupWindowController
+{
+public:
+ ExtrusionLightingControl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
+
+ virtual ::Window* createPopupWindow( ::Window* pParent );
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
+
+ using svt::PopupWindowController::createPopupWindow;
+};
+
+//========================================================================
+
+class ExtrusionSurfaceWindow : public svtools::ToolbarMenu
+{
+private:
+ svt::ToolboxController& mrController;
+
+ Image maImgSurface1;
+ Image maImgSurface2;
+ Image maImgSurface3;
+ Image maImgSurface4;
+ Image maImgSurface1h;
+ Image maImgSurface2h;
+ Image maImgSurface3h;
+ Image maImgSurface4h;
+
+ const rtl::OUString msExtrusionSurface;
+
+ DECL_LINK( SelectHdl, void * );
+
+ void implSetSurface( int nSurface, bool bEnabled );
+
+public:
+ ExtrusionSurfaceWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow );
+
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
+};
+
+//========================================================================
+
+class ExtrusionSurfaceControl : public svt::PopupWindowController
+{
+public:
+ ExtrusionSurfaceControl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
+
+ virtual ::Window* createPopupWindow( ::Window* pParent );
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
+
+ using svt::PopupWindowController::createPopupWindow;
+};
+
+//========================================================================
+
+}
+#endif
+
diff --git a/svx/source/tbxctrls/extrusioncontrols.src b/svx/source/tbxctrls/extrusioncontrols.src
new file mode 100644
index 000000000000..c7655b9576af
--- /dev/null
+++ b/svx/source/tbxctrls/extrusioncontrols.src
@@ -0,0 +1,801 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svx/dialogs.hrc>
+#include "extrusioncontrols.hrc"
+
+#define MASKCOLOR MaskColor = Color { Red=0xFFFF; Green=0x0000; Blue=0xFFFF; };
+
+DockingWindow RID_SVXFLOAT_EXTRUSION_DIRECTION
+{
+ HelpID = "svx:DockingWindow:RID_SVXFLOAT_EXTRUSION_DIRECTION";
+ Border = FALSE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Sizeable = FALSE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+
+ Text [ en-US ] = "Extrusion Direction" ;
+
+ Image IMG_DIRECTION + DIRECTION_NW
+ {
+ ImageBitmap = Bitmap { File = "directionnorthwest_22.bmp" ; };
+ MASKCOLOR
+ };
+ Image IMG_DIRECTION_H + DIRECTION_NW
+ {
+ ImageBitmap = Bitmap { File = "directionnorthwest_22_h.bmp" ; };
+ MASKCOLOR
+ };
+ Image IMG_DIRECTION + DIRECTION_N
+ {
+ ImageBitmap = Bitmap { File = "directionnorth_22.bmp" ; };
+ MASKCOLOR
+ };
+ Image IMG_DIRECTION_H + DIRECTION_N
+ {
+ ImageBitmap = Bitmap { File = "directionnorth_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_DIRECTION + DIRECTION_NE
+ {
+ ImageBitmap = Bitmap { File = "directionnortheast_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_DIRECTION_H + DIRECTION_NE
+ {
+ ImageBitmap = Bitmap { File = "directionnortheast_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_DIRECTION + DIRECTION_W
+ {
+ ImageBitmap = Bitmap { File = "directionwest_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_DIRECTION_H + DIRECTION_W
+ {
+ ImageBitmap = Bitmap { File = "directionwest_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_DIRECTION + DIRECTION_NONE
+ {
+ ImageBitmap = Bitmap { File = "directionstraight_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_DIRECTION_H + DIRECTION_NONE
+ {
+ ImageBitmap = Bitmap { File = "directionstraight_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_DIRECTION + DIRECTION_E
+ {
+ ImageBitmap = Bitmap { File = "directioneast_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_DIRECTION_H + DIRECTION_E
+ {
+ ImageBitmap = Bitmap { File = "directioneast_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_DIRECTION + DIRECTION_SW
+ {
+ ImageBitmap = Bitmap { File = "directionsouthwest_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_DIRECTION_H + DIRECTION_SW
+ {
+ ImageBitmap = Bitmap { File = "directionsouthwest_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_DIRECTION + DIRECTION_S
+ {
+ ImageBitmap = Bitmap { File = "directionsouth_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_DIRECTION_H + DIRECTION_S
+ {
+ ImageBitmap = Bitmap { File = "directionsouth_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_DIRECTION + DIRECTION_SE
+ {
+ ImageBitmap = Bitmap { File = "directionsoutheast_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_DIRECTION_H + DIRECTION_SE
+ {
+ ImageBitmap = Bitmap { File = "directionsoutheast_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_PERSPECTIVE
+ {
+ ImageBitmap = Bitmap { File = "perspective_16.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_PERSPECTIVE_H
+ {
+ ImageBitmap = Bitmap { File = "perspective_16_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_PARALLEL
+ {
+ ImageBitmap = Bitmap { File = "parallel_16.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_PARALLEL_H
+ {
+ ImageBitmap = Bitmap { File = "parallel_16_h.bmp"; };
+ MASKCOLOR
+ };
+
+ String STR_PERSPECTIVE
+ {
+ Text [ en-US ] = "~Perspective" ;
+ };
+
+ String STR_PARALLEL
+ {
+ Text [ en-US ] = "P~arallel" ;
+ };
+ String STR_DIRECTION + DIRECTION_NW
+ {
+ Text [ en-US ] = "Extrusion North-West";
+ };
+ String STR_DIRECTION + DIRECTION_N
+ {
+ Text [ en-US ] = "Extrusion North";
+ };
+ String STR_DIRECTION + DIRECTION_NE
+ {
+ Text [ en-US ] = "Extrusion North-East";
+ };
+ String STR_DIRECTION + DIRECTION_W
+ {
+ Text [ en-US ] = "Extrusion West";
+ };
+ String STR_DIRECTION + DIRECTION_NONE
+ {
+ Text [ en-US ] = "Extrusion Backwards";
+ };
+ String STR_DIRECTION + DIRECTION_E
+ {
+ Text [ en-US ] = "Extrusion East";
+ };
+ String STR_DIRECTION + DIRECTION_SW
+ {
+ Text [ en-US ] = "Extrusion South-West";
+ };
+ String STR_DIRECTION + DIRECTION_S
+ {
+ Text [ en-US ] = "Extrusion South";
+ };
+ String STR_DIRECTION + DIRECTION_SE
+ {
+ Text [ en-US ] = "Extrusion South-East";
+ };
+};
+
+DockingWindow RID_SVXFLOAT_EXTRUSION_DEPTH
+{
+ HelpID = "svx:DockingWindow:RID_SVXFLOAT_EXTRUSION_DEPTH";
+ Border = FALSE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Sizeable = FALSE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+
+ Text [ en-US ] = "Extrusion Depth" ;
+
+ String STR_CUSTOM
+ {
+ Text [ en-US ] = "~Custom...";
+ };
+
+ String STR_INFINITY
+ {
+ Text [ en-US ] = "~Infinity";
+ };
+
+ Image IMG_DEPTH_0
+ {
+ ImageBitmap = Bitmap { File = "extrusion0inch_16.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_DEPTH_0_H
+ {
+ ImageBitmap = Bitmap { File = "extrusion0inch_16_h.bmp"; };
+ MASKCOLOR
+ };
+
+ Image IMG_DEPTH_1
+ {
+ ImageBitmap = Bitmap { File = "extrusion05inch_16.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_DEPTH_1_H
+ {
+ ImageBitmap = Bitmap { File = "extrusion05inch_16_h.bmp"; };
+ MASKCOLOR
+ };
+
+ Image IMG_DEPTH_2
+ {
+ ImageBitmap = Bitmap { File = "extrusion1inch_16.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_DEPTH_2_H
+ {
+ ImageBitmap = Bitmap { File = "extrusion1inch_16_h.bmp"; };
+ MASKCOLOR
+ };
+
+ Image IMG_DEPTH_3
+ {
+ ImageBitmap = Bitmap { File = "extrusion2inch_16.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_DEPTH_3_H
+ {
+ ImageBitmap = Bitmap { File = "extrusion2inch_16_h.bmp"; };
+ MASKCOLOR
+ };
+
+ Image IMG_DEPTH_4
+ {
+ ImageBitmap = Bitmap { File = "extrusion4inch_16.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_DEPTH_4_H
+ {
+ ImageBitmap = Bitmap { File = "extrusion4inch_16_h.bmp"; };
+ MASKCOLOR
+ };
+
+ Image IMG_DEPTH_INFINITY
+ {
+ ImageBitmap = Bitmap { File = "extrusioninfinity_16.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_DEPTH_INFINITY_H
+ {
+ ImageBitmap = Bitmap { File = "extrusioninfinity_16_h.bmp"; };
+ MASKCOLOR
+ };
+};
+
+
+DockingWindow RID_SVXFLOAT_EXTRUSION_LIGHTING
+{
+ HelpID = "svx:DockingWindow:RID_SVXFLOAT_EXTRUSION_LIGHTING";
+ Border = FALSE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Sizeable = FALSE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+
+ Text [ en-US ] = "Extrusion Lighting" ;
+
+ Image IMG_LIGHT_OFF + FROM_TOP_LEFT
+ {
+ ImageBitmap = Bitmap { File = "lightofffromtopleft_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_OFF + FROM_TOP
+ {
+ ImageBitmap = Bitmap { File = "lightofffromtop_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_OFF + FROM_TOP_RIGHT
+ {
+ ImageBitmap = Bitmap { File = "lightofffromtopright_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_OFF + FROM_LEFT
+ {
+ ImageBitmap = Bitmap { File = "lightofffromleft_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_OFF + FROM_RIGHT
+ {
+ ImageBitmap = Bitmap { File = "lightofffromright_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_OFF + FROM_BOTTOM_LEFT
+ {
+ ImageBitmap = Bitmap { File = "lightofffrombottomleft_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_OFF + FROM_BOTTOM
+ {
+ ImageBitmap = Bitmap { File = "lightofffrombottom_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_OFF + FROM_BOTTOM_RIGHT
+ {
+ ImageBitmap = Bitmap { File = "lightofffrombottomright_22.bmp"; };
+ MASKCOLOR
+ };
+
+ Image IMG_LIGHT_OFF_H + FROM_TOP_LEFT
+ {
+ ImageBitmap = Bitmap { File = "lightofffromtopleft_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_OFF_H + FROM_TOP
+ {
+ ImageBitmap = Bitmap { File = "lightofffromtop_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_OFF_H + FROM_TOP_RIGHT
+ {
+ ImageBitmap = Bitmap { File = "lightofffromtopright_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_OFF_H + FROM_LEFT
+ {
+ ImageBitmap = Bitmap { File = "lightofffromleft_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_OFF_H + FROM_RIGHT
+ {
+ ImageBitmap = Bitmap { File = "lightofffromright_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_OFF_H + FROM_BOTTOM_LEFT
+ {
+ ImageBitmap = Bitmap { File = "lightofffrombottomleft_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_OFF_H + FROM_BOTTOM
+ {
+ ImageBitmap = Bitmap { File = "lightofffrombottom_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_OFF_H + FROM_BOTTOM_RIGHT
+ {
+ ImageBitmap = Bitmap { File = "lightofffrombottomright_22_h.bmp"; };
+ MASKCOLOR
+ };
+
+ Image IMG_LIGHT_ON + FROM_TOP_LEFT
+ {
+ ImageBitmap = Bitmap { File = "lightonfromtopleft_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_ON + FROM_TOP
+ {
+ ImageBitmap = Bitmap { File = "lightonfromtop_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_ON + FROM_TOP_RIGHT
+ {
+ ImageBitmap = Bitmap { File = "lightonfromtopright_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_ON + FROM_LEFT
+ {
+ ImageBitmap = Bitmap { File = "lightonfromleft_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_ON + FROM_RIGHT
+ {
+ ImageBitmap = Bitmap { File = "lightonfromright_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_ON + FROM_BOTTOM_LEFT
+ {
+ ImageBitmap = Bitmap { File = "lightonfrombottomleft_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_ON + FROM_BOTTOM
+ {
+ ImageBitmap = Bitmap { File = "lightonfrombottom_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_ON + FROM_BOTTOM_RIGHT
+ {
+ ImageBitmap = Bitmap { File = "lightonfrombottomright_22.bmp"; };
+ MASKCOLOR
+ };
+
+ Image IMG_LIGHT_ON_H + FROM_TOP_LEFT
+ {
+ ImageBitmap = Bitmap { File = "lightonfromtopleft_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_ON_H + FROM_TOP
+ {
+ ImageBitmap = Bitmap { File = "lightonfromtop_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_ON_H + FROM_TOP_RIGHT
+ {
+ ImageBitmap = Bitmap { File = "lightonfromtopright_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_ON_H + FROM_LEFT
+ {
+ ImageBitmap = Bitmap { File = "lightonfromleft_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_ON_H + FROM_RIGHT
+ {
+ ImageBitmap = Bitmap { File = "lightonfromright_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_ON_H + FROM_BOTTOM_LEFT
+ {
+ ImageBitmap = Bitmap { File = "lightonfrombottomleft_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_ON_H + FROM_BOTTOM
+ {
+ ImageBitmap = Bitmap { File = "lightonfrombottom_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_ON_H + FROM_BOTTOM_RIGHT
+ {
+ ImageBitmap = Bitmap { File = "lightonfrombottomright_22_h.bmp"; };
+ MASKCOLOR
+ };
+
+ Image IMG_LIGHT_PREVIEW + FROM_TOP_LEFT
+ {
+ ImageBitmap = Bitmap { File = "lightfromtopleft_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_PREVIEW + FROM_TOP
+ {
+ ImageBitmap = Bitmap { File = "lightfromtop_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_PREVIEW + FROM_TOP_RIGHT
+ {
+ ImageBitmap = Bitmap { File = "lightfromtopright_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_PREVIEW + FROM_LEFT
+ {
+ ImageBitmap = Bitmap { File = "lightfromleft_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_PREVIEW + FROM_RIGHT
+ {
+ ImageBitmap = Bitmap { File = "lightfromright_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_PREVIEW + FROM_FRONT
+ {
+ ImageBitmap = Bitmap { File = "lightfromfront_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_PREVIEW + FROM_BOTTOM_LEFT
+ {
+ ImageBitmap = Bitmap { File = "lightfrombottomleft_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_PREVIEW + FROM_BOTTOM
+ {
+ ImageBitmap = Bitmap { File = "lightfrombottom_22.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_PREVIEW + FROM_BOTTOM_RIGHT
+ {
+ ImageBitmap = Bitmap { File = "lightfrombottomright_22.bmp"; };
+ MASKCOLOR
+ };
+
+ Image IMG_LIGHT_PREVIEW_H + FROM_TOP_LEFT
+ {
+ ImageBitmap = Bitmap { File = "lightfromtopleft_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_PREVIEW_H + FROM_TOP
+ {
+ ImageBitmap = Bitmap { File = "lightfromtop_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_PREVIEW_H + FROM_TOP_RIGHT
+ {
+ ImageBitmap = Bitmap { File = "lightfromtopright_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_PREVIEW_H + FROM_LEFT
+ {
+ ImageBitmap = Bitmap { File = "lightfromleft_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_PREVIEW_H + FROM_RIGHT
+ {
+ ImageBitmap = Bitmap { File = "lightfromright_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_PREVIEW_H + FROM_FRONT
+ {
+ ImageBitmap = Bitmap { File = "lightfromfront_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_PREVIEW_H + FROM_BOTTOM_LEFT
+ {
+ ImageBitmap = Bitmap { File = "lightfrombottomleft_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_PREVIEW_H + FROM_BOTTOM
+ {
+ ImageBitmap = Bitmap { File = "lightfrombottom_22_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHT_PREVIEW_H + FROM_BOTTOM_RIGHT
+ {
+ ImageBitmap = Bitmap { File = "lightfrombottomright_22_h.bmp"; };
+ MASKCOLOR
+ };
+
+ Image IMG_LIGHTING_BRIGHT
+ {
+ ImageBitmap = Bitmap { File = "brightlit_16.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHTING_NORMAL
+ {
+ ImageBitmap = Bitmap { File = "normallit_16.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHTING_DIM
+ {
+ ImageBitmap = Bitmap { File = "dimlit_16.bmp"; };
+ MASKCOLOR
+ };
+
+ Image IMG_LIGHTING_BRIGHT_H
+ {
+ ImageBitmap = Bitmap { File = "brightlit_16_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHTING_NORMAL_H
+ {
+ ImageBitmap = Bitmap { File = "normallit_16_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_LIGHTING_DIM_H
+ {
+ ImageBitmap = Bitmap { File = "dimlit_16_h.bmp"; };
+ MASKCOLOR
+ };
+
+ String STR_BRIGHT
+ {
+ Text [ en-US ] = "~Bright";
+ };
+
+ String STR_NORMAL
+ {
+ Text [ en-US ] = "~Normal";
+ };
+
+ String STR_DIM
+ {
+ Text [ en-US ] = "~Dim";
+ };
+};
+
+DockingWindow RID_SVXFLOAT_EXTRUSION_SURFACE
+{
+ HelpID = "svx:DockingWindow:RID_SVXFLOAT_EXTRUSION_SURFACE";
+ Border = FALSE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Sizeable = FALSE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+
+ Text [ en-US ] = "Extrusion Surface" ;
+
+ String STR_WIREFRAME
+ {
+ Text [ en-US ] = "~Wire Frame";
+ };
+
+ String STR_MATTE
+ {
+ Text [ en-US ] = "~Matt";
+ };
+
+ String STR_PLASTIC
+ {
+ Text [ en-US ] = "~Plastic";
+ };
+
+ String STR_METAL
+ {
+ Text [ en-US ] = "Me~tal";
+ };
+
+ Image IMG_WIRE_FRAME
+ {
+ ImageBitmap = Bitmap { File = "wireframe_16.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_WIRE_FRAME_H
+ {
+ ImageBitmap = Bitmap { File = "wireframe_16_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_MATTE
+ {
+ ImageBitmap = Bitmap { File = "matte_16.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_MATTE_H
+ {
+ ImageBitmap = Bitmap { File = "matte_16_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_PLASTIC
+ {
+ ImageBitmap = Bitmap { File = "plastic_16.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_PLASTIC_H
+ {
+ ImageBitmap = Bitmap { File = "plastic_16_h.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_METAL
+ {
+ ImageBitmap = Bitmap { File = "metal_16.bmp"; };
+ MASKCOLOR
+ };
+ Image IMG_METAL_H
+ {
+ ImageBitmap = Bitmap { File = "metal_16_h.bmp"; };
+ MASKCOLOR
+ };
+
+};
+
+#define WIDTH 140
+#define HEIGHT (4 * 3 + 3 * 14)
+
+ModalDialog RID_SVX_MDLG_EXTRUSION_DEPTH
+{
+ HelpID = "svx:ModalDialog:RID_SVX_MDLG_EXTRUSION_DEPTH";
+ OutputSize = TRUE;
+ SVLook = TRUE ;
+ Moveable = TRUE;
+ Closeable = TRUE;
+
+ Size = MAP_APPFONT( WIDTH, HEIGHT );
+
+ Text [ en-US ] = "Extrusion Depth" ;
+
+ FixedText FL_DEPTH
+ {
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ Size = MAP_APPFONT ( WIDTH - 50 - 12 , 8 ) ;
+ Text [ en-US ] = "~Value" ;
+ };
+ MetricField MTR_DEPTH
+ {
+ //HelpId = HID_SD_CTL_FAVORITES ;
+ Border = FALSE ;
+ Pos = MAP_APPFONT ( 3 , 14 ) ;
+ Size = MAP_APPFONT ( WIDTH - 50 - 12, 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 338666 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ SpinSize = 10 ;
+ };
+ OkButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( WIDTH - 50 - 3 , 1 * 3 + 0 * 14 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ DefButton = TRUE ;
+ TabStop = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( WIDTH - 50 - 3 , 2 * 3 + 1 * 14 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( WIDTH - 50 - 3 , 3 * 3 + 2 * 14 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ TabStop = TRUE ;
+ };
+};
+
+String RID_SVXSTR_EXTRUSION_COLOR
+{
+ Text [ en-US ] = "Extrusion Color";
+};
+
+String RID_SVXSTR_DEPTH_0
+{
+ Text [ en-US ] = "~0 cm";
+};
+
+String RID_SVXSTR_DEPTH_1
+{
+ Text [ en-US ] = "~1 cm";
+};
+
+String RID_SVXSTR_DEPTH_2
+{
+ Text [ en-US ] = "~2.5 cm";
+};
+
+String RID_SVXSTR_DEPTH_3
+{
+ Text [ en-US ] = "~5 cm";
+};
+
+String RID_SVXSTR_DEPTH_4
+{
+ Text [ en-US ] = "10 ~cm";
+};
+
+String RID_SVXSTR_DEPTH_0_INCH
+{
+ Text [ en-US ] = "0 inch";
+};
+
+String RID_SVXSTR_DEPTH_1_INCH
+{
+ Text [ en-US ] = "0.~5 inch";
+};
+
+String RID_SVXSTR_DEPTH_2_INCH
+{
+ Text [ en-US ] = "~1 inch";
+};
+
+String RID_SVXSTR_DEPTH_3_INCH
+{
+ Text [ en-US ] = "~2 inch";
+};
+
+String RID_SVXSTR_DEPTH_4_INCH
+{
+ Text [ en-US ] = "~4 inch";
+};
+
+
diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx
new file mode 100644
index 000000000000..eb10f11060d4
--- /dev/null
+++ b/svx/source/tbxctrls/fillctrl.cxx
@@ -0,0 +1,846 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <string> // HACK: prevent conflict between STLPORT and Workshop headers
+#include <sfx2/app.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/viewsh.hxx>
+#include <rtl/ustring.hxx>
+
+#include <svx/dialogs.hrc>
+
+#define DELAY_TIMEOUT 300
+
+#define TMP_STR_BEGIN '['
+#define TMP_STR_END ']'
+
+#include "svx/drawitem.hxx"
+#include "svx/xattr.hxx"
+#include <svx/xtable.hxx>
+#include <svx/fillctrl.hxx>
+#include <svx/itemwin.hxx>
+#include <svx/dialmgr.hxx>
+#include "helpid.hrc"
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::lang;
+
+SFX_IMPL_TOOLBOX_CONTROL( SvxFillToolBoxControl, XFillStyleItem );
+
+/*************************************************************************
+|*
+|* SvxFillToolBoxControl
+|*
+\************************************************************************/
+
+SvxFillToolBoxControl::SvxFillToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
+ SfxToolBoxControl( nSlotId, nId, rTbx ),
+
+ pStyleItem ( NULL ),
+ pColorItem ( NULL ),
+ pGradientItem ( NULL ),
+ pHatchItem ( NULL ),
+ pBitmapItem ( NULL ),
+ pFillControl ( NULL ),
+ pFillTypeLB ( NULL ),
+ pFillAttrLB ( NULL ),
+ bUpdate ( sal_False ),
+ bIgnoreStatusUpdate( sal_False ),
+ eLastXFS ( XFILL_NONE )
+{
+ addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillColor" )));
+ addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillGradient" )));
+ addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillHatch" )));
+ addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillBitmap" )));
+ addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ColorTableState" )));
+ addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GradientListState" )));
+ addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:HatchListState" )));
+ addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:BitmapListState" )));
+}
+
+//========================================================================
+
+SvxFillToolBoxControl::~SvxFillToolBoxControl()
+{
+ delete pStyleItem;
+ delete pColorItem;
+ delete pGradientItem;
+ delete pHatchItem;
+ delete pBitmapItem;
+}
+
+//========================================================================
+
+void SvxFillToolBoxControl::StateChanged(
+
+ sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+
+{
+ bool bEnableControls = sal_False;
+
+ if ( bIgnoreStatusUpdate )
+ return;
+
+ if( eState == SFX_ITEM_DISABLED )
+ {
+ if( nSID == SID_ATTR_FILL_STYLE )
+ {
+ pFillTypeLB->Disable();
+ pFillTypeLB->SetNoSelection();
+ }
+ pFillAttrLB->Disable();
+ pFillAttrLB->SetNoSelection();
+ }
+ else
+ {
+ if ( SFX_ITEM_AVAILABLE == eState )
+ {
+ if( nSID == SID_ATTR_FILL_STYLE )
+ {
+ delete pStyleItem;
+ pStyleItem = (XFillStyleItem*) pState->Clone();
+ pFillTypeLB->Enable();
+
+ eLastXFS = pFillTypeLB->GetSelectEntryPos();
+ bUpdate = sal_True;
+
+ XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue();
+ pFillTypeLB->SelectEntryPos(
+ sal::static_int_cast< sal_uInt16 >( eXFS ) );
+ pFillAttrLB->Enable();
+ }
+ else if( pStyleItem )
+ {
+ XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue();
+
+ if( nSID == SID_ATTR_FILL_COLOR )
+ {
+ delete pColorItem;
+ pColorItem = (XFillColorItem*) pState->Clone();
+
+ if( eXFS == XFILL_SOLID )
+ bEnableControls = sal_True;
+ }
+ else if( nSID == SID_ATTR_FILL_GRADIENT )
+ {
+ delete pGradientItem;
+ pGradientItem = (XFillGradientItem*) pState->Clone();
+
+ if( eXFS == XFILL_GRADIENT )
+ bEnableControls = sal_True;
+ }
+ else if( nSID == SID_ATTR_FILL_HATCH )
+ {
+ delete pHatchItem;
+ pHatchItem = (XFillHatchItem*) pState->Clone();
+
+ if( eXFS == XFILL_HATCH )
+ bEnableControls = sal_True;
+ }
+ else if( nSID == SID_ATTR_FILL_BITMAP )
+ {
+ delete pBitmapItem;
+ pBitmapItem = (XFillBitmapItem*) pState->Clone();
+
+ if( eXFS == XFILL_BITMAP )
+ bEnableControls = sal_True;
+ }
+ }
+ if( bEnableControls )
+ {
+ //pFillTypeLB->Enable();
+ pFillAttrLB->Enable();
+
+ bUpdate = sal_True;
+ }
+
+ Update( pState );
+ }
+ else
+ {
+ // leerer oder uneindeutiger Status
+ if( nSID == SID_ATTR_FILL_STYLE )
+ {
+ pFillTypeLB->SetNoSelection();
+ pFillAttrLB->Disable();
+ pFillAttrLB->SetNoSelection();
+ bUpdate = sal_False;
+ }
+ else
+ {
+ XFillStyle eXFS = XFILL_NONE;
+ if( pStyleItem )
+ eXFS = (XFillStyle)pStyleItem->GetValue();
+ if( !pStyleItem ||
+ ( nSID == SID_ATTR_FILL_COLOR && eXFS == XFILL_SOLID ) ||
+ ( nSID == SID_ATTR_FILL_GRADIENT && eXFS == XFILL_GRADIENT ) ||
+ ( nSID == SID_ATTR_FILL_HATCH && eXFS == XFILL_HATCH ) ||
+ ( nSID == SID_ATTR_FILL_BITMAP && eXFS == XFILL_BITMAP ) )
+ {
+ pFillAttrLB->SetNoSelection();
+ //bUpdate = sal_False;
+ }
+ }
+ }
+ }
+}
+
+//========================================================================
+
+void SvxFillToolBoxControl::IgnoreStatusUpdate( sal_Bool bSet )
+{
+ bIgnoreStatusUpdate = bSet;
+}
+
+//========================================================================
+
+void SvxFillToolBoxControl::Update( const SfxPoolItem* pState )
+{
+ if ( pStyleItem && pState && bUpdate )
+ {
+ bUpdate = sal_False;
+
+ XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue();
+
+ // Pruefen, ob Fuellstil schon vorher aktiv war
+ //if( eTmpXFS != eXFS )
+ if( (XFillStyle) eLastXFS != eXFS )
+ pFillControl->SelectFillTypeHdl( NULL );
+ //eLastXFS = eXFS;
+
+ switch( eXFS )
+ {
+ case XFILL_NONE:
+ break;
+
+ case XFILL_SOLID:
+ {
+ if ( pColorItem )
+ {
+ String aString( pColorItem->GetName() );
+ ::Color aColor = pColorItem->GetColorValue();
+
+ pFillAttrLB->SelectEntry( aString );
+
+ if ( pFillAttrLB->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND ||
+ pFillAttrLB->GetSelectEntryColor() != aColor )
+ pFillAttrLB->SelectEntry( aColor );
+
+ // NEU
+ // Pruefen, ob Eintrag nicht in der Liste ist
+ if( pFillAttrLB->GetSelectEntryPos() ==
+ LISTBOX_ENTRY_NOTFOUND ||
+ pFillAttrLB->GetSelectEntryColor() != aColor )
+ {
+ sal_uInt16 nCount = pFillAttrLB->GetEntryCount();
+ String aTmpStr;
+ if( nCount > 0 )
+ {
+ //Letzter Eintrag wird auf temporaere Farbe geprueft
+ aTmpStr = pFillAttrLB->GetEntry( nCount - 1 );
+ if( aTmpStr.GetChar(0) == TMP_STR_BEGIN &&
+ aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END )
+ {
+ pFillAttrLB->RemoveEntry( nCount - 1 );
+ }
+ }
+ aTmpStr = TMP_STR_BEGIN;
+ aTmpStr += aString;
+ aTmpStr += TMP_STR_END;
+
+ //pFillAttrLB->SetUpdateMode( sal_False );
+ sal_uInt16 nPos = pFillAttrLB->InsertEntry( aColor, aTmpStr );
+ //pFillAttrLB->SetUpdateMode( sal_True );
+ pFillAttrLB->SelectEntryPos( nPos );
+ }
+ // NEU
+ }
+ else
+ pFillAttrLB->SetNoSelection();
+ }
+ break;
+
+ case XFILL_GRADIENT:
+ {
+ if ( pGradientItem )
+ {
+ String aString( pGradientItem->GetName() );
+ pFillAttrLB->SelectEntry( aString );
+ // NEU
+ // Pruefen, ob Eintrag nicht in der Liste ist
+ if( pFillAttrLB->GetSelectEntry() != aString )
+ {
+ sal_uInt16 nCount = pFillAttrLB->GetEntryCount();
+ String aTmpStr;
+ if( nCount > 0 )
+ {
+ //Letzter Eintrag wird auf temporaeren Eintrag geprueft
+ aTmpStr = pFillAttrLB->GetEntry( nCount - 1 );
+ if( aTmpStr.GetChar(0) == TMP_STR_BEGIN &&
+ aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END )
+ {
+ pFillAttrLB->RemoveEntry( nCount - 1 );
+ }
+ }
+ aTmpStr = TMP_STR_BEGIN;
+ aTmpStr += aString;
+ aTmpStr += TMP_STR_END;
+
+ XGradientEntry* pEntry = new XGradientEntry( pGradientItem->GetGradientValue(), aTmpStr );
+ String aEmptyString = String();
+ XGradientList aGradientList( aEmptyString );
+ aGradientList.Insert( pEntry );
+ aGradientList.SetDirty( sal_False );
+ Bitmap* pBmp = aGradientList.CreateBitmapForUI( 0 );
+
+ if( pBmp )
+ {
+ ( (ListBox*)pFillAttrLB )->InsertEntry( pEntry->GetName(), *pBmp );
+ pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 );
+ delete pBmp;
+ }
+
+ aGradientList.Remove( 0 );
+ delete pEntry;
+ }
+ // NEU
+ }
+ else
+ pFillAttrLB->SetNoSelection();
+ }
+ break;
+
+ case XFILL_HATCH:
+ {
+ if ( pHatchItem )
+ {
+ String aString( pHatchItem->GetName() );
+ pFillAttrLB->SelectEntry( aString );
+ // NEU
+ // Pruefen, ob Eintrag nicht in der Liste ist
+ if( pFillAttrLB->GetSelectEntry() != aString )
+ {
+ sal_uInt16 nCount = pFillAttrLB->GetEntryCount();
+ String aTmpStr;
+ if( nCount > 0 )
+ {
+ //Letzter Eintrag wird auf temporaeren Eintrag geprueft
+ aTmpStr = pFillAttrLB->GetEntry( nCount - 1 );
+ if( aTmpStr.GetChar(0) == TMP_STR_BEGIN &&
+ aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END )
+ {
+ pFillAttrLB->RemoveEntry( nCount - 1 );
+ }
+ }
+ aTmpStr = TMP_STR_BEGIN;
+ aTmpStr += aString;
+ aTmpStr += TMP_STR_END;
+
+ XHatchEntry* pEntry = new XHatchEntry( pHatchItem->GetHatchValue(), aTmpStr );
+ String aEmptyString = String();
+ XHatchList aHatchList( aEmptyString );
+ aHatchList.Insert( pEntry );
+ aHatchList.SetDirty( sal_False );
+ Bitmap* pBmp = aHatchList.CreateBitmapForUI( 0 );
+
+ if( pBmp )
+ {
+ ( (ListBox*)pFillAttrLB )->InsertEntry( pEntry->GetName(), *pBmp );
+ pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 );
+ delete pBmp;
+ }
+
+ aHatchList.Remove( 0 );
+ delete pEntry;
+ }
+ // NEU
+ }
+ else
+ pFillAttrLB->SetNoSelection();
+ }
+ break;
+
+ case XFILL_BITMAP:
+ {
+ if ( pBitmapItem )
+ // &&
+ // SfxObjectShell::Current() &&
+ // SfxObjectShell::Current()->GetItem( SID_BITMAP_LIST ) )
+ {
+ String aString( pBitmapItem->GetName() );
+ // Bitmap aBitmap( pBitmapItem->GetValue() );
+
+ // SvxBitmapListItem aItem( *(const SvxBitmapListItem*)(
+ // SfxObjectShell::Current()->GetItem( SID_BITMAP_LIST ) ) );
+ pFillAttrLB->SelectEntry( aString );
+ // NEU
+ // Pruefen, ob Eintrag nicht in der Liste ist
+ if( pFillAttrLB->GetSelectEntry() != aString )
+ {
+ sal_uInt16 nCount = pFillAttrLB->GetEntryCount();
+ String aTmpStr;
+ if( nCount > 0 )
+ {
+ //Letzter Eintrag wird auf temporaeren Eintrag geprueft
+ aTmpStr = pFillAttrLB->GetEntry( nCount - 1 );
+ if( aTmpStr.GetChar(0) == TMP_STR_BEGIN &&
+ aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END )
+ {
+ pFillAttrLB->RemoveEntry( nCount - 1 );
+ }
+ }
+ aTmpStr = TMP_STR_BEGIN;
+ aTmpStr += aString;
+ aTmpStr += TMP_STR_END;
+
+ XBitmapEntry* pEntry = new XBitmapEntry( pBitmapItem->GetBitmapValue(), aTmpStr );
+ XBitmapList aBitmapList( String::CreateFromAscii("TmpList") );
+ aBitmapList.Insert( pEntry );
+ aBitmapList.SetDirty( sal_False );
+ //Bitmap* pBmp = aBitmapList.GetBitmap( 0 );
+ //( (ListBox*)pFillAttrLB )->InsertEntry( pEntry->GetName(), *pBmp );
+ pFillAttrLB->Fill( &aBitmapList );
+ pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 );
+ aBitmapList.Remove( 0 );
+ delete pEntry;
+ }
+ // NEU
+ }
+ else
+ pFillAttrLB->SetNoSelection();
+ }
+ break;
+
+ default:
+ DBG_ERROR( "Nicht unterstuetzter Flaechentyp" );
+ break;
+ }
+ }
+
+ if( pState && pStyleItem )
+ {
+ XFillStyle eXFS = (XFillStyle) pStyleItem->GetValue();
+
+ // Die Listen haben sich geaendert ?
+ if( pState->ISA( SvxColorTableItem ) &&
+ eXFS == XFILL_SOLID )
+ {
+ ::Color aTmpColor( pFillAttrLB->GetSelectEntryColor() );
+ pFillAttrLB->Clear();
+ pFillAttrLB->Fill( ( (SvxColorTableItem*)pState )->GetColorTable() );
+ pFillAttrLB->SelectEntry( aTmpColor );
+ }
+ if( pState->ISA( SvxGradientListItem ) &&
+ eXFS == XFILL_GRADIENT )
+ {
+ String aString( pFillAttrLB->GetSelectEntry() );
+ pFillAttrLB->Clear();
+ pFillAttrLB->Fill( ( (SvxGradientListItem*)pState )->GetGradientList() );
+ pFillAttrLB->SelectEntry( aString );
+ }
+ if( pState->ISA( SvxHatchListItem ) &&
+ eXFS == XFILL_HATCH )
+ {
+ String aString( pFillAttrLB->GetSelectEntry() );
+ pFillAttrLB->Clear();
+ pFillAttrLB->Fill( ( (SvxHatchListItem*)pState )->GetHatchList() );
+ pFillAttrLB->SelectEntry( aString );
+ }
+ if( pState->ISA( SvxBitmapListItem ) &&
+ eXFS == XFILL_BITMAP )
+ {
+ String aString( pFillAttrLB->GetSelectEntry() );
+ pFillAttrLB->Clear();
+ pFillAttrLB->Fill( ( (SvxBitmapListItem*)pState )->GetBitmapList() );
+ pFillAttrLB->SelectEntry( aString );
+ }
+ }
+}
+
+//========================================================================
+
+Window* SvxFillToolBoxControl::CreateItemWindow( Window *pParent )
+{
+ if ( GetSlotId() == SID_ATTR_FILL_STYLE )
+ {
+ pFillControl = new FillControl( pParent );
+ // Damit dem FillControl das SvxFillToolBoxControl bekannt ist
+ // (und um kompatibel zu bleiben)
+ pFillControl->SetData( this );
+
+ pFillAttrLB = (SvxFillAttrBox*)pFillControl->pLbFillAttr;
+ pFillTypeLB = (SvxFillTypeBox*)pFillControl->pLbFillType;
+
+ pFillAttrLB->SetUniqueId( HID_FILL_ATTR_LISTBOX );
+ pFillTypeLB->SetUniqueId( HID_FILL_TYPE_LISTBOX );
+
+ return pFillControl;
+ }
+ return NULL;
+}
+
+/*************************************************************************
+|*
+|* FillControl
+|*
+\************************************************************************/
+
+FillControl::FillControl( Window* pParent, WinBits nStyle ) :
+ Window( pParent, nStyle | WB_DIALOGCONTROL ),
+ pLbFillType(new SvxFillTypeBox( this )),
+ aLogicalFillSize(40,80),
+ aLogicalAttrSize(50,80)
+{
+ pLbFillAttr = new SvxFillAttrBox( this );
+ Size aTypeSize(LogicToPixel(aLogicalFillSize, MAP_APPFONT));
+ Size aAttrSize(LogicToPixel(aLogicalAttrSize, MAP_APPFONT));
+ pLbFillType->SetSizePixel(aTypeSize);
+ pLbFillAttr->SetSizePixel(aAttrSize);
+ //to get the base height
+ aTypeSize = pLbFillType->GetSizePixel();
+ aAttrSize = pLbFillAttr->GetSizePixel();
+ Point aAttrPnt = pLbFillAttr->GetPosPixel();
+ SetSizePixel(
+ Size( aAttrPnt.X() + aAttrSize.Width(),
+ Max( aAttrSize.Height(), aTypeSize.Height() ) ) );
+
+ pLbFillType->SetSelectHdl( LINK( this, FillControl, SelectFillTypeHdl ) );
+ pLbFillAttr->SetSelectHdl( LINK( this, FillControl, SelectFillAttrHdl ) );
+
+ aDelayTimer.SetTimeout( DELAY_TIMEOUT );
+ aDelayTimer.SetTimeoutHdl( LINK( this, FillControl, DelayHdl ) );
+ aDelayTimer.Start();
+}
+
+//------------------------------------------------------------------------
+
+FillControl::~FillControl()
+{
+ delete pLbFillType;
+ delete pLbFillAttr;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK_INLINE_START( FillControl, DelayHdl, Timer *, EMPTYARG )
+{
+ SelectFillTypeHdl( NULL );
+ ( (SvxFillToolBoxControl*)GetData() )->updateStatus( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillStyle" )));
+// ( (SvxFillToolBoxControl*)GetData() )->GetBindings().Invalidate( SID_ATTR_FILL_STYLE );
+ return 0;
+}
+IMPL_LINK_INLINE_END( FillControl, DelayHdl, Timer *, pTimer )
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( FillControl, SelectFillTypeHdl, ListBox *, pBox )
+{
+ XFillStyle eXFS = (XFillStyle)pLbFillType->GetSelectEntryPos();
+
+ // Spaeter sollte eine Optimierung derart erfolgen, dass die
+ // Listen, bzw. Tables nur dann geloescht und wieder aufgebaut
+ // werden, wenn sich die Listen, bzw. Tables tatsaechlich geaendert
+ // haben (in den LBs natuerlich).
+
+ if ( ( pBox && !pBox->IsTravelSelect() ) || !pBox )
+ {
+ // Damit wir in folgendem Fall einen Status anzeigen koennen:
+ // Ein Typ wurde ausgewaehlt aber kein Attribut.
+ // Die Selektion hat genau die gleichen Attribute wie die vorherige.
+// SvxFillToolBoxControl* pControlerItem = (SvxFillToolBoxControl*)GetData();
+// if( pControlerItem )
+// pControlerItem->ClearCache();
+
+ pLbFillAttr->Clear();
+ SfxObjectShell* pSh = SfxObjectShell::Current();
+
+ switch( eXFS )
+ {
+ case XFILL_NONE:
+ {
+ pLbFillType->Selected();
+ SelectFillAttrHdl( pBox );
+ pLbFillAttr->Disable();
+ }
+ break;
+
+ case XFILL_SOLID:
+ {
+ if ( pSh && pSh->GetItem( SID_COLOR_TABLE ) )
+ {
+ SvxColorTableItem aItem( *(const SvxColorTableItem*)(
+ pSh->GetItem( SID_COLOR_TABLE ) ) );
+ pLbFillAttr->Enable();
+ pLbFillAttr->Fill( aItem.GetColorTable() );
+ }
+ else
+ pLbFillAttr->Disable();
+ }
+ break;
+
+ case XFILL_GRADIENT:
+ {
+ if ( pSh && pSh->GetItem( SID_GRADIENT_LIST ) )
+ {
+ SvxGradientListItem aItem( *(const SvxGradientListItem*)(
+ pSh->GetItem( SID_GRADIENT_LIST ) ) );
+ pLbFillAttr->Enable();
+ pLbFillAttr->Fill( aItem.GetGradientList() );
+ }
+ else
+ pLbFillAttr->Disable();
+ }
+ break;
+
+ case XFILL_HATCH:
+ {
+ if ( pSh && pSh->GetItem( SID_HATCH_LIST ) )
+ {
+ SvxHatchListItem aItem( *(const SvxHatchListItem*)(
+ pSh->GetItem( SID_HATCH_LIST ) ) );
+ pLbFillAttr->Enable();
+ pLbFillAttr->Fill( aItem.GetHatchList() );
+ }
+ else
+ pLbFillAttr->Disable();
+ }
+ break;
+
+ case XFILL_BITMAP:
+ {
+ if ( pSh && pSh->GetItem( SID_BITMAP_LIST ) )
+ {
+ SvxBitmapListItem aItem( *(const SvxBitmapListItem*)(
+ pSh->GetItem( SID_BITMAP_LIST ) ) );
+ pLbFillAttr->Enable();
+ pLbFillAttr->Fill( aItem.GetBitmapList() );
+ }
+ else
+ pLbFillAttr->Disable();
+ }
+ break;
+ }
+
+ if( eXFS != XFILL_NONE ) // Wurde schon erledigt
+ {
+ if ( pBox )
+ pLbFillType->Selected();
+
+ // release focus
+ if ( pBox && pLbFillType->IsRelease() )
+ {
+ SfxViewShell* pViewShell = SfxViewShell::Current();
+ if( pViewShell && pViewShell->GetWindow() )
+ pViewShell->GetWindow()->GrabFocus();
+ }
+ }
+ }
+ return 0;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( FillControl, SelectFillAttrHdl, ListBox *, pBox )
+{
+ XFillStyle eXFS = (XFillStyle)pLbFillType->GetSelectEntryPos();
+ XFillStyleItem aXFillStyleItem( eXFS );
+ sal_Bool bAction = pBox && !pLbFillAttr->IsTravelSelect();
+
+ SfxObjectShell* pSh = SfxObjectShell::Current();
+ if ( bAction )
+ {
+ Any a;
+ Sequence< PropertyValue > aArgs( 1 );
+
+ // First set the style
+ aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" ));
+ aXFillStyleItem.QueryValue( a );
+ aArgs[0].Value = a;
+ ( (SvxFillToolBoxControl*)GetData() )->IgnoreStatusUpdate( sal_True );
+ ((SvxFillToolBoxControl*)GetData())->Dispatch(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillStyle" )), aArgs );
+ ( (SvxFillToolBoxControl*)GetData() )->IgnoreStatusUpdate( sal_False );
+
+ switch( eXFS )
+ {
+ case XFILL_NONE:
+ {
+ }
+ break;
+
+ case XFILL_SOLID:
+ {
+ // NEU
+ //Eintrag wird auf temporaere Farbe geprueft
+ String aTmpStr = pLbFillAttr->GetSelectEntry();
+ if( aTmpStr.GetChar(0) == TMP_STR_BEGIN && aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END )
+ {
+ aTmpStr.Erase( aTmpStr.Len()-1, 1 );
+ aTmpStr.Erase( 0, 1 );
+ }
+
+ XFillColorItem aXFillColorItem( aTmpStr, pLbFillAttr->GetSelectEntryColor() );
+
+ aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillColor" ));
+ aXFillColorItem.QueryValue( a );
+ aArgs[0].Value = a;
+ ((SvxFillToolBoxControl*)GetData())->Dispatch( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillColor" )),
+ aArgs );
+ }
+ break;
+ case XFILL_GRADIENT:
+ {
+ sal_uInt16 nPos = pLbFillAttr->GetSelectEntryPos();
+
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_GRADIENT_LIST ) )
+ {
+ SvxGradientListItem aItem(
+ *(const SvxGradientListItem*)( pSh->GetItem( SID_GRADIENT_LIST ) ) );
+
+ if ( nPos < aItem.GetGradientList()->Count() ) // kein temp. Eintrag ?
+ {
+ XGradient aGradient = aItem.GetGradientList()->GetGradient( nPos )->GetGradient();
+ XFillGradientItem aXFillGradientItem( pLbFillAttr->GetSelectEntry(), aGradient );
+
+ aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillGradient" ));
+ aXFillGradientItem.QueryValue( a );
+ aArgs[0].Value = a;
+ ((SvxFillToolBoxControl*)GetData())->Dispatch( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillGradient" )),
+ aArgs );
+ }
+ }
+ }
+ break;
+
+ case XFILL_HATCH:
+ {
+ sal_uInt16 nPos = pLbFillAttr->GetSelectEntryPos();
+
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_HATCH_LIST ) )
+ {
+ SvxHatchListItem aItem( *(const SvxHatchListItem*)( pSh->GetItem( SID_HATCH_LIST ) ) );
+
+ if ( nPos < aItem.GetHatchList()->Count() ) // kein temp. Eintrag ?
+ {
+ XHatch aHatch = aItem.GetHatchList()->GetHatch( nPos )->GetHatch();
+ XFillHatchItem aXFillHatchItem( pLbFillAttr->GetSelectEntry(), aHatch );
+
+ aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillHatch" ));
+ aXFillHatchItem.QueryValue( a );
+ aArgs[0].Value = a;
+ ((SvxFillToolBoxControl*)GetData())->Dispatch( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillHatch" )),
+ aArgs );
+ }
+ }
+ }
+ break;
+
+ case XFILL_BITMAP:
+ {
+ sal_uInt16 nPos = pLbFillAttr->GetSelectEntryPos();
+
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_BITMAP_LIST ) )
+ {
+ SvxBitmapListItem aItem(
+ *(const SvxBitmapListItem*)( pSh->GetItem( SID_BITMAP_LIST ) ) );
+
+ if ( nPos < aItem.GetBitmapList()->Count() ) // kein temp. Eintrag ?
+ {
+ XOBitmap aXOBitmap = aItem.GetBitmapList()->GetBitmap( nPos )->GetXBitmap();
+ XFillBitmapItem aXFillBitmapItem( pLbFillAttr->GetSelectEntry(), aXOBitmap );
+
+ aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillBitmap" ));
+ aXFillBitmapItem.QueryValue( a );
+ aArgs[0].Value = a;
+ ((SvxFillToolBoxControl*)GetData())->Dispatch( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillBitmap" )),
+ aArgs );
+ }
+ }
+ }
+ break;
+ }
+
+ // release focus
+ if ( pLbFillAttr->IsRelease() && pBox )
+ {
+ SfxViewShell* pViewShell = SfxViewShell::Current();
+ if( pViewShell && pViewShell->GetWindow() )
+ {
+ pViewShell->GetWindow()->GrabFocus();
+ }
+ }
+ }
+
+ return 0;
+}
+
+//------------------------------------------------------------------------
+
+void FillControl::Resize()
+{
+ // Breite der beiden ListBoxen nicht 1/2 : 1/2, sondern 2/5 : 3/5
+ long nW = GetOutputSizePixel().Width() / 5;
+ long nH = 180;
+ long nSep = 0; // war vorher 4
+
+ pLbFillType->SetSizePixel( Size( nW * 2 - nSep, nH ) );
+ pLbFillAttr->SetPosSizePixel( Point( nW * 2 + nSep, 0 ), Size( nW * 3 - nSep, nH ) );
+}
+/* -----------------------------08.03.2002 15:04------------------------------
+
+ ---------------------------------------------------------------------------*/
+
+void FillControl::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ Size aTypeSize(LogicToPixel(aLogicalFillSize, MAP_APPFONT));
+ Size aAttrSize(LogicToPixel(aLogicalAttrSize, MAP_APPFONT));
+ pLbFillType->SetSizePixel(aTypeSize);
+ pLbFillAttr->SetSizePixel(aAttrSize);
+ //to get the base height
+ aTypeSize = pLbFillType->GetSizePixel();
+ aAttrSize = pLbFillAttr->GetSizePixel();
+ Point aAttrPnt = pLbFillAttr->GetPosPixel();
+
+ SetSizePixel(
+ Size( aAttrPnt.X() + aAttrSize.Width(),
+ Max( aAttrSize.Height(), aTypeSize.Height() ) ) );
+ }
+ Window::DataChanged( rDCEvt );
+}
+
diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx
new file mode 100644
index 000000000000..416dc09ca157
--- /dev/null
+++ b/svx/source/tbxctrls/fontworkgallery.cxx
@@ -0,0 +1,818 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <com/sun/star/text/WritingMode.hpp>
+
+#include <vcl/toolbox.hxx>
+
+#include <svl/itempool.hxx>
+
+#include <svtools/toolbarmenu.hxx>
+#include <svtools/popupwindowcontroller.hxx>
+#include <svtools/popupmenucontrollerbase.hxx>
+
+#include <sfx2/app.hxx>
+#include <sfx2/dispatch.hxx>
+
+#include <editeng/eeitem.hxx>
+#include <editeng/frmdiritem.hxx>
+
+#include <svx/fmmodel.hxx>
+#include <svx/svxids.hrc>
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/svdpage.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdoutl.hxx>
+
+#include "svx/gallery.hxx"
+#include <svx/dlgutil.hxx>
+
+#include <svx/fontworkgallery.hxx>
+#include "fontworkgallery.hrc"
+
+#include <algorithm>
+
+#include "helpid.hrc"
+
+using ::rtl::OUString;
+using ::svtools::ToolbarMenu;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::frame;
+
+namespace svx
+{
+
+const int nColCount = 4;
+const int nLineCount = 4;
+
+/*************************************************************************
+|* Svx3DWin - FloatingWindow
+\************************************************************************/
+FontWorkGalleryDialog::FontWorkGalleryDialog( SdrView* pSdrView, Window* pParent, sal_uInt16 /*nSID*/ ) :
+ ModalDialog( pParent, SVX_RES( RID_SVX_MDLG_FONTWORK_GALLERY ) ),
+ maCtlFavorites ( this, SVX_RES( CTL_FAVORITES ) ),
+ maFLFavorites ( this, SVX_RES( FL_FAVORITES ) ),
+ maOKButton ( this, SVX_RES( BTN_OK ) ),
+ maCancelButton ( this, SVX_RES( BTN_CANCEL ) ),
+ maHelpButton ( this, SVX_RES( BTN_HELP ) ),
+ mnThemeId ( 0xffff ),
+ mpSdrView ( pSdrView ),
+ mpModel ( (FmFormModel*)pSdrView->GetModel() ),
+ maStrClickToAddText ( SVX_RES( STR_CLICK_TO_ADD_TEXT ) ),
+ mppSdrObject ( NULL ),
+ mpDestModel ( NULL )
+{
+ FreeResource();
+
+ maCtlFavorites.SetDoubleClickHdl( LINK( this, FontWorkGalleryDialog, DoubleClickFavoriteHdl ) );
+ maOKButton.SetClickHdl( LINK( this, FontWorkGalleryDialog, ClickOKHdl ) );
+
+ maCtlFavorites.SetColCount( nColCount );
+ maCtlFavorites.SetLineCount( nLineCount );
+ maCtlFavorites.SetExtraSpacing( 3 );
+
+ initfavorites( GALLERY_THEME_FONTWORK, maFavoritesHorizontal );
+ fillFavorites( GALLERY_THEME_FONTWORK, maFavoritesHorizontal );
+}
+
+static void delete_bitmap( Bitmap* p ) { delete p; }
+
+// -----------------------------------------------------------------------
+FontWorkGalleryDialog::~FontWorkGalleryDialog()
+{
+ std::for_each( maFavoritesHorizontal.begin(), maFavoritesHorizontal.end(), delete_bitmap );
+}
+
+// -----------------------------------------------------------------------
+
+void FontWorkGalleryDialog::initfavorites(sal_uInt16 nThemeId, std::vector< Bitmap * >& rFavorites)
+{
+ // Ueber die Gallery werden die Favoriten eingelesen
+ sal_uIntPtr nFavCount = GalleryExplorer::GetSdrObjCount( nThemeId );
+
+ // Gallery thema locken
+ GalleryExplorer::BeginLocking(nThemeId);
+
+ sal_uInt32 nModelPos;
+ FmFormModel *pModel = NULL;
+ for( nModelPos = 0; nModelPos < nFavCount; nModelPos++ )
+ {
+ Bitmap* pThumb = new Bitmap;
+
+ if( GalleryExplorer::GetSdrObj( nThemeId, nModelPos, pModel, pThumb ) )
+ {
+/*
+ VirtualDevice aVDev;
+ Size aRenderSize( aThumbSize.Width() * 4, aThumbSize.Height() * 4 );
+ aVDev.SetOutputSizePixel( aRenderSize );
+
+ if( GalleryExplorer::DrawCentered( &aVDev, *pModel ) )
+ {
+ aThumb = aVDev.GetBitmap( Point(), aVDev.GetOutputSizePixel() );
+
+ Size aMS( 4, 4 );
+ BmpFilterParam aParam( aMS );
+ aThumb.Filter( BMP_FILTER_MOSAIC, &aParam );
+ aThumb.Scale( aThumbSize );
+ }
+*/
+ }
+
+ rFavorites.push_back( pThumb );
+ }
+
+ // Gallery thema freigeben
+ GalleryExplorer::EndLocking(nThemeId);
+}
+
+void FontWorkGalleryDialog::fillFavorites( sal_uInt16 nThemeId, std::vector< Bitmap * >& rFavorites )
+{
+ mnThemeId = nThemeId;
+
+ Size aThumbSize( maCtlFavorites.GetSizePixel() );
+ aThumbSize.Width() /= nColCount;
+ aThumbSize.Height() /= nLineCount;
+ aThumbSize.Width() -= 12;
+ aThumbSize.Height() -= 12;
+
+ std::vector< Bitmap * >::size_type nFavCount = rFavorites.size();
+
+ // ValueSet Favoriten
+ if( nFavCount > (nColCount * nLineCount) )
+ {
+ WinBits nWinBits = maCtlFavorites.GetStyle();
+ nWinBits |= WB_VSCROLL;
+ maCtlFavorites.SetStyle( nWinBits );
+ }
+
+ maCtlFavorites.Clear();
+
+ sal_uInt32 nFavorite;
+ for( nFavorite = 1; nFavorite <= nFavCount; nFavorite++ )
+ {
+ String aStr(SVX_RES(RID_SVXFLOAT3D_FAVORITE));
+ aStr += sal_Unicode(' ');
+ aStr += String::CreateFromInt32((sal_Int32)nFavorite);
+ Image aThumbImage( *rFavorites[nFavorite-1] );
+ maCtlFavorites.InsertItem( (sal_uInt16)nFavorite, aThumbImage, aStr );
+ }
+}
+
+void FontWorkGalleryDialog::changeText( SdrTextObj* pObj )
+{
+ if( pObj )
+ {
+ SdrOutliner& rOutl = mpModel->GetDrawOutliner(pObj);
+
+ sal_uInt16 nOutlMode = rOutl.GetMode();
+ Size aPaperSize = rOutl.GetPaperSize();
+ sal_Bool bUpdateMode = rOutl.GetUpdateMode();
+ rOutl.SetUpdateMode(sal_False);
+ rOutl.SetParaAttribs( 0, rOutl.GetEmptyItemSet() );
+
+ // #95114# Always set the object's StyleSheet at the Outliner to
+ // use the current objects StyleSheet. Thus it's the same as in
+ // SetText(...).
+ // #95114# Moved this implementation from where SetObjText(...) was called
+ // to inside this method to work even when outliner is fetched here.
+ rOutl.SetStyleSheet(0, pObj->GetStyleSheet());
+
+ rOutl.SetPaperSize( pObj->GetLogicRect().GetSize() );
+
+ rOutl.SetText( maStrClickToAddText, rOutl.GetParagraph( 0 ) );
+ pObj->SetOutlinerParaObject( rOutl.CreateParaObject() );
+
+ rOutl.Init( nOutlMode );
+ rOutl.SetParaAttribs( 0, rOutl.GetEmptyItemSet() );
+ rOutl.SetUpdateMode( bUpdateMode );
+ rOutl.SetPaperSize( aPaperSize );
+
+ rOutl.Clear();
+ }
+}
+
+void FontWorkGalleryDialog::SetSdrObjectRef( SdrObject** ppSdrObject, SdrModel* pModel )
+{
+ mppSdrObject = ppSdrObject;
+ mpDestModel = pModel;
+}
+
+void FontWorkGalleryDialog::insertSelectedFontwork()
+{
+ sal_uInt16 nItemId = maCtlFavorites.GetSelectItemId();
+
+ if( nItemId > 0 )
+ {
+ FmFormModel* pModel = new FmFormModel();
+ pModel->GetItemPool().FreezeIdRanges();
+
+ if( GalleryExplorer::GetSdrObj( mnThemeId, nItemId-1, pModel ) )
+ {
+ SdrPage* pPage = pModel->GetPage(0);
+ if( pPage && pPage->GetObjCount() )
+ {
+ SdrObject* pNewObject = pPage->GetObj(0)->Clone();
+
+ // center shape on current view
+ OutputDevice* pOutDev = mpSdrView->GetFirstOutputDevice();
+ if( pOutDev )
+ {
+ Rectangle aObjRect( pNewObject->GetLogicRect() );
+ Rectangle aVisArea = pOutDev->PixelToLogic(Rectangle(Point(0,0), pOutDev->GetOutputSizePixel()));
+/*
+ sal_Int32 nObjHeight = aObjRect.GetHeight();
+ VirtualDevice aVirDev( 1 ); // calculating the optimal textwidth
+ Font aFont;
+ aFont.SetHeight( nObjHeight );
+ aVirDev.SetMapMode( MAP_100TH_MM );
+ aVirDev.SetFont( aFont );
+ aObjRect.SetSize( Size( aVirDev.GetTextWidth( maStrClickToAddText ), nObjHeight ) );
+*/
+ Point aPagePos = aVisArea.Center();
+ aPagePos.X() -= aObjRect.GetWidth() / 2;
+ aPagePos.Y() -= aObjRect.GetHeight() / 2;
+ Rectangle aNewObjectRectangle(aPagePos, aObjRect.GetSize());
+ SdrPageView* pPV = mpSdrView->GetSdrPageView();
+
+ pNewObject->SetLogicRect(aNewObjectRectangle);
+ if ( mppSdrObject )
+ {
+ *mppSdrObject = pNewObject;
+ (*mppSdrObject)->SetModel( mpDestModel );
+ }
+ else if( pPV )
+ {
+ mpSdrView->InsertObjectAtView( pNewObject, *pPV );
+ // changeText( PTR_CAST( SdrTextObj, pNewObject ) );
+ }
+ }
+ }
+ }
+
+ delete pModel;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( FontWorkGalleryDialog, ClickOKHdl, void*, EMPTYARG )
+{
+ insertSelectedFontwork();
+ EndDialog( true );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( FontWorkGalleryDialog, DoubleClickFavoriteHdl, void*, EMPTYARG )
+{
+ insertSelectedFontwork();
+ EndDialog( true );
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+SFX_IMPL_TOOLBOX_CONTROL( FontWorkShapeTypeControl, SfxStringItem );
+FontWorkShapeTypeControl::FontWorkShapeTypeControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx )
+: SfxToolBoxControl( nSlotId, nId, rTbx )
+{
+ rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) );
+ rTbx.Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+FontWorkShapeTypeControl::~FontWorkShapeTypeControl()
+{
+}
+
+// -----------------------------------------------------------------------
+
+SfxPopupWindowType FontWorkShapeTypeControl::GetPopupWindowType() const
+{
+ return SFX_POPUPWINDOW_ONCLICK; //( aLastAction.getLength() == 0 ? SFX_POPUPWINDOW_ONCLICK : SFX_POPUPWINDOW_ONTIMEOUT );
+}
+
+// -----------------------------------------------------------------------
+
+SfxPopupWindow* FontWorkShapeTypeControl::CreatePopupWindow()
+{
+ rtl::OUString aSubTbxResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/fontworkshapetype" ) );
+ createAndPositionSubToolBar( aSubTbxResName );
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+void FontWorkShapeTypeControl::Select( sal_Bool )
+{
+
+}
+
+// ========================================================================
+// FontWorkAlignmentWindow
+// ========================================================================
+
+class FontWorkAlignmentWindow : public ToolbarMenu
+{
+public:
+ FontWorkAlignmentWindow( svt::ToolboxController& rController, const Reference< XFrame >& rFrame, Window* pParentWindow );
+
+ virtual void SAL_CALL statusChanged( const frame::FeatureStateEvent& Event ) throw ( RuntimeException );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+private:
+ svt::ToolboxController& mrController;
+
+ Image maImgAlgin1;
+ Image maImgAlgin2;
+ Image maImgAlgin3;
+ Image maImgAlgin4;
+ Image maImgAlgin5;
+ Image maImgAlgin1h;
+ Image maImgAlgin2h;
+ Image maImgAlgin3h;
+ Image maImgAlgin4h;
+ Image maImgAlgin5h;
+
+ const rtl::OUString msFontworkAlignment;
+
+ DECL_LINK( SelectHdl, void * );
+
+ void implSetAlignment( int nAlignmentMode, bool bEnabled );
+};
+
+FontWorkAlignmentWindow::FontWorkAlignmentWindow( svt::ToolboxController& rController, const Reference< XFrame >& rFrame, Window* pParentWindow )
+: ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_FONTWORK_ALIGNMENT ))
+, mrController( rController )
+, maImgAlgin1( SVX_RES( IMG_FONTWORK_ALIGN_LEFT_16 ) )
+, maImgAlgin2( SVX_RES( IMG_FONTWORK_ALIGN_CENTER_16 ) )
+, maImgAlgin3( SVX_RES( IMG_FONTWORK_ALIGN_RIGHT_16 ) )
+, maImgAlgin4( SVX_RES( IMG_FONTWORK_ALIGN_WORD_16 ) )
+, maImgAlgin5( SVX_RES( IMG_FONTWORK_ALIGN_STRETCH_16 ) )
+, maImgAlgin1h( SVX_RES( IMG_FONTWORK_ALIGN_LEFT_16_H ) )
+, maImgAlgin2h( SVX_RES( IMG_FONTWORK_ALIGN_CENTER_16_H ) )
+, maImgAlgin3h( SVX_RES( IMG_FONTWORK_ALIGN_RIGHT_16_H ) )
+, maImgAlgin4h( SVX_RES( IMG_FONTWORK_ALIGN_WORD_16_H ) )
+, maImgAlgin5h( SVX_RES( IMG_FONTWORK_ALIGN_STRETCH_16_H ) )
+, msFontworkAlignment( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkAlignment" ) )
+{
+ bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ SetHelpId( HID_POPUP_FONTWORK_ALIGN );
+ SetSelectHdl( LINK( this, FontWorkAlignmentWindow, SelectHdl ) );
+
+ appendEntry( 0, String( SVX_RES( STR_ALIGN_LEFT ) ), bHighContrast ? maImgAlgin1h : maImgAlgin1 );
+ appendEntry( 1, String( SVX_RES( STR_ALIGN_CENTER ) ), bHighContrast ? maImgAlgin2h : maImgAlgin2 );
+ appendEntry( 2, String( SVX_RES( STR_ALIGN_RIGHT ) ), bHighContrast ? maImgAlgin3h : maImgAlgin3 );
+ appendEntry( 3, String( SVX_RES( STR_ALIGN_WORD ) ), bHighContrast ? maImgAlgin4h : maImgAlgin4 );
+ appendEntry( 4, String( SVX_RES( STR_ALIGN_STRETCH ) ), bHighContrast ? maImgAlgin5h : maImgAlgin5 );
+
+ SetOutputSizePixel( getMenuSize() );
+
+ FreeResource();
+
+ AddStatusListener( msFontworkAlignment );
+}
+
+// -----------------------------------------------------------------------
+
+void FontWorkAlignmentWindow::implSetAlignment( int nSurface, bool bEnabled )
+{
+ int i;
+ for( i = 0; i < 5; i++ )
+ {
+ checkEntry( i, (i == nSurface) && bEnabled );
+ enableEntry( i, bEnabled );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SAL_CALL FontWorkAlignmentWindow::statusChanged( const frame::FeatureStateEvent& Event ) throw ( RuntimeException )
+{
+ if( Event.FeatureURL.Main.equals( msFontworkAlignment ) )
+ {
+ if( !Event.IsEnabled )
+ {
+ implSetAlignment( 0, false );
+ }
+ else
+ {
+ sal_Int32 nValue = 0;
+ if( Event.State >>= nValue )
+ implSetAlignment( nValue, true );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void FontWorkAlignmentWindow::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ ToolbarMenu::DataChanged( rDCEvt );
+
+ if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
+ {
+ bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ appendEntry( 0, String( SVX_RES( STR_ALIGN_LEFT ) ), bHighContrast ? maImgAlgin1h : maImgAlgin1 );
+ appendEntry( 1, String( SVX_RES( STR_ALIGN_CENTER ) ), bHighContrast ? maImgAlgin2h : maImgAlgin2 );
+ appendEntry( 2, String( SVX_RES( STR_ALIGN_RIGHT ) ), bHighContrast ? maImgAlgin3h : maImgAlgin3 );
+ appendEntry( 3, String( SVX_RES( STR_ALIGN_WORD ) ), bHighContrast ? maImgAlgin4h : maImgAlgin4 );
+ appendEntry( 4, String( SVX_RES( STR_ALIGN_STRETCH ) ), bHighContrast ? maImgAlgin5h : maImgAlgin5 );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( FontWorkAlignmentWindow, SelectHdl, void *, EMPTYARG )
+{
+ if ( IsInPopupMode() )
+ EndPopupMode();
+
+ sal_Int32 nAlignment = getSelectedEntryId();
+ if( nAlignment >= 0 )
+ {
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = msFontworkAlignment.copy(5);
+ aArgs[0].Value <<= (sal_Int32)nAlignment;
+
+ mrController.dispatchCommand( msFontworkAlignment, aArgs );
+
+ implSetAlignment( nAlignment, true );
+ }
+
+ return 0;
+}
+
+// ========================================================================
+// FontWorkAlignmentControl
+// ========================================================================
+
+class FontWorkAlignmentControl : public svt::PopupWindowController
+{
+public:
+ FontWorkAlignmentControl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
+
+ virtual ::Window* createPopupWindow( ::Window* pParent );
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
+
+ using svt::PopupWindowController::createPopupWindow;
+};
+
+
+// -----------------------------------------------------------------------
+
+FontWorkAlignmentControl::FontWorkAlignmentControl( const Reference< lang::XMultiServiceFactory >& rServiceManager )
+: svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkAlignment" ) ) )
+{
+}
+
+// -----------------------------------------------------------------------
+
+::Window* FontWorkAlignmentControl::createPopupWindow( ::Window* pParent )
+{
+ return new FontWorkAlignmentWindow( *this, m_xFrame, pParent );
+}
+
+// -----------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------
+
+OUString SAL_CALL FontWorkAlignmentControl_getImplementationName()
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.FontWorkAlignmentController" ));
+}
+
+// --------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL FontWorkAlignmentControl_getSupportedServiceNames() throw( RuntimeException )
+{
+ Sequence< OUString > aSNS( 1 );
+ aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ));
+ return aSNS;
+}
+
+// --------------------------------------------------------------------
+
+Reference< XInterface > SAL_CALL SAL_CALL FontWorkAlignmentControl_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException )
+{
+ return *new FontWorkAlignmentControl( rSMgr );
+}
+
+// --------------------------------------------------------------------
+
+OUString SAL_CALL FontWorkAlignmentControl::getImplementationName( ) throw (RuntimeException)
+{
+ return FontWorkAlignmentControl_getImplementationName();
+}
+
+// --------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL FontWorkAlignmentControl::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ return FontWorkAlignmentControl_getSupportedServiceNames();
+}
+
+
+// ####################################################################
+
+class FontWorkCharacterSpacingWindow : public ToolbarMenu
+{
+public:
+ FontWorkCharacterSpacingWindow( svt::ToolboxController& rController, const Reference< XFrame >& rFrame, Window* pParentWindow );
+
+ virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException );
+private:
+ svt::ToolboxController& mrController;
+
+ const rtl::OUString msFontworkCharacterSpacing;
+ const rtl::OUString msFontworkKernCharacterPairs;
+
+ DECL_LINK( SelectHdl, void * );
+
+ void implSetCharacterSpacing( sal_Int32 nCharacterSpacing, bool bEnabled );
+ void implSetKernCharacterPairs( sal_Bool bKernOnOff, bool bEnabled );
+
+};
+
+// -----------------------------------------------------------------------
+
+FontWorkCharacterSpacingWindow::FontWorkCharacterSpacingWindow( svt::ToolboxController& rController, const Reference< XFrame >& rFrame, Window* pParentWindow )
+: ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_FONTWORK_CHARSPACING ))
+, mrController( rController )
+, msFontworkCharacterSpacing( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkCharacterSpacing" ) )
+, msFontworkKernCharacterPairs( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkKernCharacterPairs" ) )
+{
+ SetHelpId( HID_POPUP_FONTWORK_CHARSPACE );
+ SetSelectHdl( LINK( this, FontWorkCharacterSpacingWindow, SelectHdl ) );
+
+ appendEntry( 0, String( SVX_RES( STR_CHARS_SPACING_VERY_TIGHT ) ), MIB_RADIOCHECK );
+ appendEntry( 1, String( SVX_RES( STR_CHARS_SPACING_TIGHT ) ), MIB_RADIOCHECK );
+ appendEntry( 2, String( SVX_RES( STR_CHARS_SPACING_NORMAL ) ), MIB_RADIOCHECK );
+ appendEntry( 3, String( SVX_RES( STR_CHARS_SPACING_LOOSE ) ), MIB_RADIOCHECK );
+ appendEntry( 4, String( SVX_RES( STR_CHARS_SPACING_VERY_LOOSE ) ), MIB_RADIOCHECK );
+ appendEntry( 5, String( SVX_RES( STR_CHARS_SPACING_CUSTOM ) ), MIB_RADIOCHECK );
+ appendSeparator();
+ appendEntry( 6, String( SVX_RES( STR_CHARS_SPACING_KERN_PAIRS ) ), MIB_CHECKABLE );
+
+ SetOutputSizePixel( getMenuSize() );
+
+ FreeResource();
+
+ AddStatusListener( msFontworkCharacterSpacing );
+ AddStatusListener( msFontworkKernCharacterPairs );
+}
+
+// -----------------------------------------------------------------------
+
+void FontWorkCharacterSpacingWindow::implSetCharacterSpacing( sal_Int32 nCharacterSpacing, bool bEnabled )
+{
+ sal_Int32 i;
+ for ( i = 0; i < 6; i++ )
+ {
+ checkEntry( i, sal_False );
+ enableEntry( i, bEnabled );
+ }
+ if ( nCharacterSpacing != -1 )
+ {
+ sal_Int32 nEntry;
+ switch( nCharacterSpacing )
+ {
+ case 80 : nEntry = 0; break;
+ case 90 : nEntry = 1; break;
+ case 100 : nEntry = 2; break;
+ case 120 : nEntry = 3; break;
+ case 150 : nEntry = 4; break;
+ default : nEntry = 5; break;
+ }
+ checkEntry( nEntry, bEnabled );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void FontWorkCharacterSpacingWindow::implSetKernCharacterPairs( sal_Bool, bool bEnabled )
+{
+ enableEntry( 6, bEnabled );
+ checkEntry( 6, bEnabled );
+}
+
+// -----------------------------------------------------------------------
+
+void SAL_CALL FontWorkCharacterSpacingWindow::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException )
+{
+ if( Event.FeatureURL.Main.equals( msFontworkCharacterSpacing ) )
+ {
+ if( !Event.IsEnabled )
+ {
+ implSetCharacterSpacing( 0, false );
+ }
+ else
+ {
+ sal_Int32 nValue = 0;
+ if( Event.State >>= nValue )
+ implSetCharacterSpacing( nValue, true );
+ }
+ }
+ else if( Event.FeatureURL.Main.equals( msFontworkKernCharacterPairs ) )
+ {
+ if( !Event.IsEnabled )
+ {
+ implSetKernCharacterPairs( 0, false );
+ }
+ else
+ {
+ sal_Bool bValue = sal_False;
+ if( Event.State >>= bValue )
+ implSetKernCharacterPairs( bValue, true );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( FontWorkCharacterSpacingWindow, SelectHdl, void *, EMPTYARG )
+{
+ if ( IsInPopupMode() )
+ EndPopupMode();
+
+ sal_Int32 nSelection = getSelectedEntryId();
+ sal_Int32 nCharacterSpacing;
+ switch( nSelection )
+ {
+ case 0 : nCharacterSpacing = 80; break;
+ case 1 : nCharacterSpacing = 90; break;
+ case 2 : nCharacterSpacing = 100; break;
+ case 3 : nCharacterSpacing = 120; break;
+ case 4 : nCharacterSpacing = 150; break;
+ default : nCharacterSpacing = 100; break;
+ }
+ if ( nSelection == 5 ) // custom spacing
+ {
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = msFontworkCharacterSpacing.copy(5);
+ aArgs[0].Value <<= (sal_Int32)nCharacterSpacing;
+
+ mrController.dispatchCommand( OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkCharacterSpacingDialog" )), aArgs );
+ }
+ else if ( nSelection == 6 ) // KernCharacterPairs
+ {
+ rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkKernCharacterPairs" ));
+
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = msFontworkKernCharacterPairs.copy(5);
+ aArgs[0].Value <<= (sal_Bool) sal_True;
+
+ mrController.dispatchCommand( msFontworkKernCharacterPairs, aArgs );
+
+ implSetKernCharacterPairs( sal_True, true );
+ }
+ else if( nSelection >= 0 )
+ {
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = msFontworkCharacterSpacing.copy(5);
+ aArgs[0].Value <<=( sal_Int32)nCharacterSpacing;
+
+ mrController.dispatchCommand( msFontworkCharacterSpacing, aArgs );
+
+ implSetCharacterSpacing( nCharacterSpacing, true );
+ }
+
+ return 0;
+}
+
+// ========================================================================
+// FontWorkCharacterSpacingControl
+// ========================================================================
+
+class FontWorkCharacterSpacingControl : public svt::PopupWindowController
+{
+public:
+ FontWorkCharacterSpacingControl( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
+
+ virtual ::Window* createPopupWindow( ::Window* pParent );
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
+
+ using svt::PopupWindowController::createPopupWindow;
+};
+
+
+FontWorkCharacterSpacingControl::FontWorkCharacterSpacingControl( const Reference< lang::XMultiServiceFactory >& rServiceManager )
+: svt::PopupWindowController( rServiceManager, Reference< frame::XFrame >(), OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontworkCharacterSpacingFloater" ) ) )
+{
+}
+
+// -----------------------------------------------------------------------
+
+::Window* FontWorkCharacterSpacingControl::createPopupWindow( ::Window* pParent )
+{
+ return new FontWorkCharacterSpacingWindow( *this, m_xFrame, pParent );
+}
+
+// -----------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------
+
+OUString SAL_CALL FontWorkCharacterSpacingControl_getImplementationName()
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.FontWorkCharacterSpacingController" ));
+}
+
+// --------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL FontWorkCharacterSpacingControl_getSupportedServiceNames() throw( RuntimeException )
+{
+ Sequence< OUString > aSNS( 1 );
+ aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ));
+ return aSNS;
+}
+
+// --------------------------------------------------------------------
+
+Reference< XInterface > SAL_CALL SAL_CALL FontWorkCharacterSpacingControl_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException )
+{
+ return *new FontWorkCharacterSpacingControl( rSMgr );
+}
+
+// --------------------------------------------------------------------
+
+OUString SAL_CALL FontWorkCharacterSpacingControl::getImplementationName( ) throw (RuntimeException)
+{
+ return FontWorkCharacterSpacingControl_getImplementationName();
+}
+
+// --------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL FontWorkCharacterSpacingControl::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ return FontWorkCharacterSpacingControl_getSupportedServiceNames();
+}
+
+// ========================================================================
+// FontworkCharacterSpacingDialog
+// ========================================================================
+
+FontworkCharacterSpacingDialog::FontworkCharacterSpacingDialog( Window* pParent, sal_Int32 nScale )
+: ModalDialog( pParent, SVX_RES( RID_SVX_MDLG_FONTWORK_CHARSPACING ) ),
+ maFLScale( this, SVX_RES( FT_VALUE ) ),
+ maMtrScale( this, SVX_RES( MF_VALUE ) ),
+ maOKButton( this, SVX_RES( BTN_OK ) ),
+ maCancelButton( this, SVX_RES( BTN_CANCEL ) ),
+ maHelpButton( this, SVX_RES( BTN_HELP ) )
+{
+ maMtrScale.SetValue( nScale );
+ FreeResource();
+}
+
+FontworkCharacterSpacingDialog::~FontworkCharacterSpacingDialog()
+{
+}
+
+sal_Int32 FontworkCharacterSpacingDialog::getScale() const
+{
+ return (sal_Int32)maMtrScale.GetValue();
+}
+
+}
diff --git a/svx/source/tbxctrls/fontworkgallery.src b/svx/source/tbxctrls/fontworkgallery.src
new file mode 100644
index 000000000000..98fd8c6cb5df
--- /dev/null
+++ b/svx/source/tbxctrls/fontworkgallery.src
@@ -0,0 +1,328 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "helpid.hrc"
+#include <svx/dialogs.hrc>
+#include "fontworkgallery.hrc"
+#include "svtools/controldims.hrc"
+
+#define WIDTH 256
+#define HEIGHT 256
+
+#define MASKCOLOR MaskColor = Color { Red=0xFFFF; Green=0x0000; Blue=0xFFFF; };
+
+ModalDialog RID_SVX_MDLG_FONTWORK_GALLERY
+{
+ HelpID = "svx:ModalDialog:RID_SVX_MDLG_FONTWORK_GALLERY";
+ OutputSize = TRUE;
+ SVLook = TRUE ;
+ Moveable = TRUE;
+ Closeable = TRUE;
+
+ Size = MAP_APPFONT( WIDTH, HEIGHT );
+
+ Text [ en-US ] = "Fontwork Gallery" ;
+
+ FixedLine FL_FAVORITES
+ {
+ Pos = MAP_APPFONT ( 3 , 3 ) ;
+ Size = MAP_APPFONT ( WIDTH - 6 , 8 ) ;
+ Text [ en-US ] = "Select a Fontwork style:" ;
+ };
+ Control CTL_FAVORITES
+ {
+ HelpId = HID_CTL_FONTWORK_FAVORITES ;
+ Border = FALSE ;
+ Pos = MAP_APPFONT ( 3 , 14 ) ;
+ Size = MAP_APPFONT ( WIDTH - 6,
+ HEIGHT - RSC_CD_PUSHBUTTON_HEIGHT -
+ 6 - RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ };
+ OkButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( WIDTH - 3 * RSC_CD_PUSHBUTTON_WIDTH - 9 ,
+ HEIGHT - 3 - RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH,
+ RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( WIDTH - 2 * RSC_CD_PUSHBUTTON_WIDTH - 6 ,
+ HEIGHT - 3 - RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH,
+ RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( WIDTH - 1 * RSC_CD_PUSHBUTTON_WIDTH - 3 ,
+ HEIGHT - 3 - RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH,
+ RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ };
+ String STR_CLICK_TO_ADD_TEXT
+ {
+ Text [ en-US ] = "Click to edit text" ;
+ };
+};
+
+DockingWindow RID_SVXFLOAT_FONTWORK_ALIGNMENT
+{
+ HelpID = "svx:DockingWindow:RID_SVXFLOAT_FONTWORK_ALIGNMENT";
+ Border = FALSE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Sizeable = FALSE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+
+ Text [ en-US ] = "Fontwork Alignment" ;
+
+ String STR_ALIGN_LEFT
+ {
+ Text [ en-US ] = "~Left Align";
+ };
+ String STR_ALIGN_CENTER
+ {
+ Text [ en-US ] = "~Center";
+ };
+ String STR_ALIGN_RIGHT
+ {
+ Text [ en-US ] = "~Right Align";
+ };
+ String STR_ALIGN_WORD
+ {
+ Text [ en-US ] = "~Word Justify";
+ };
+ String STR_ALIGN_STRETCH
+ {
+ Text [ en-US ] = "S~tretch Justify";
+ };
+
+ Image IMG_FONTWORK_ALIGN_LEFT_16
+ {
+ ImageBitmap = Bitmap { File = "fontworkalignleft_16.png"; };
+ MASKCOLOR
+ };
+ Image IMG_FONTWORK_ALIGN_LEFT_16_H
+ {
+ ImageBitmap = Bitmap { File = "fontworkalignleft_16_h.png"; };
+ MASKCOLOR
+ };
+ Image IMG_FONTWORK_ALIGN_LEFT_26
+ {
+ ImageBitmap = Bitmap { File = "fontworkalignleft_26.png"; };
+ MASKCOLOR
+ };
+ Image IMG_FONTWORK_ALIGN_LEFT_26_H
+ {
+ ImageBitmap = Bitmap { File = "fontworkalignleft_26_h.png"; };
+ MASKCOLOR
+ };
+ Image IMG_FONTWORK_ALIGN_CENTER_16
+ {
+ ImageBitmap = Bitmap { File = "fontworkaligncentered_16.png"; };
+ MASKCOLOR
+ };
+ Image IMG_FONTWORK_ALIGN_CENTER_16_H
+ {
+ ImageBitmap = Bitmap { File = "fontworkaligncentered_16_h.png"; };
+ MASKCOLOR
+ };
+ Image IMG_FONTWORK_ALIGN_CENTER_26
+ {
+ ImageBitmap = Bitmap { File = "fontworkaligncentered_26.png"; };
+ MASKCOLOR
+ };
+ Image IMG_FONTWORK_ALIGN_CENTER_26_H
+ {
+ ImageBitmap = Bitmap { File = "fontworkaligncentered_26_h.png"; };
+ MASKCOLOR
+ };
+ Image IMG_FONTWORK_ALIGN_RIGHT_16
+ {
+ ImageBitmap = Bitmap { File = "fontworkalignright_16.png"; };
+ MASKCOLOR
+ };
+ Image IMG_FONTWORK_ALIGN_RIGHT_16_H
+ {
+ ImageBitmap = Bitmap { File = "fontworkalignright_16_h.png"; };
+ MASKCOLOR
+ };
+ Image IMG_FONTWORK_ALIGN_RIGHT_26
+ {
+ ImageBitmap = Bitmap { File = "fontworkalignright_26.png"; };
+ MASKCOLOR
+ };
+ Image IMG_FONTWORK_ALIGN_RIGHT_26_H
+ {
+ ImageBitmap = Bitmap { File = "fontworkalignright_26_h.png"; };
+ MASKCOLOR
+ };
+ Image IMG_FONTWORK_ALIGN_WORD_16
+ {
+ ImageBitmap = Bitmap { File = "fontworkalignjustified_16.png"; };
+ MASKCOLOR
+ };
+ Image IMG_FONTWORK_ALIGN_WORD_16_H
+ {
+ ImageBitmap = Bitmap { File = "fontworkalignjustified_16_h.png"; };
+ MASKCOLOR
+ };
+ Image IMG_FONTWORK_ALIGN_WORD_26
+ {
+ ImageBitmap = Bitmap { File = "fontworkalignjustified_26.png"; };
+ MASKCOLOR
+ };
+ Image IMG_FONTWORK_ALIGN_WORD_26_H
+ {
+ ImageBitmap = Bitmap { File = "fontworkalignjustified_26_h.png"; };
+ MASKCOLOR
+ };
+ Image IMG_FONTWORK_ALIGN_STRETCH_16
+ {
+ ImageBitmap = Bitmap { File = "fontworkalignstretch_16.png"; };
+ MASKCOLOR
+ };
+ Image IMG_FONTWORK_ALIGN_STRETCH_16_H
+ {
+ ImageBitmap = Bitmap { File = "fontworkalignstretch_16_h.png"; };
+ MASKCOLOR
+ };
+ Image IMG_FONTWORK_ALIGN_STRETCH_26
+ {
+ ImageBitmap = Bitmap { File = "fontworkalignstretch_26.png"; };
+ MASKCOLOR
+ };
+ Image IMG_FONTWORK_ALIGN_STRETCH_26_H
+ {
+ ImageBitmap = Bitmap { File = "fontworkalignstretch_26_h.png"; };
+ MASKCOLOR
+ };
+};
+
+DockingWindow RID_SVXFLOAT_FONTWORK_CHARSPACING
+{
+ HelpID = "svx:DockingWindow:RID_SVXFLOAT_FONTWORK_CHARSPACING";
+ Border = FALSE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Sizeable = FALSE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+
+ Text [ en-US ] = "Fontwork Character Spacing" ;
+
+ String STR_CHARS_SPACING_VERY_TIGHT
+ {
+ Text [ en-US ] = "~Very Tight";
+ };
+ String STR_CHARS_SPACING_TIGHT
+ {
+ Text [ en-US ] = "~Tight";
+ };
+ String STR_CHARS_SPACING_NORMAL
+ {
+ Text [ en-US ] = "~Normal";
+ };
+ String STR_CHARS_SPACING_LOOSE
+ {
+ Text [ en-US ] = "~Loose";
+ };
+ String STR_CHARS_SPACING_VERY_LOOSE
+ {
+ Text [ en-US ] = "Very ~Loose";
+ };
+ String STR_CHARS_SPACING_CUSTOM
+ {
+ Text [ en-US ] = "~Custom...";
+ };
+ String STR_CHARS_SPACING_KERN_PAIRS
+ {
+ Text [ en-US ] = "~Kern Character Pairs";
+ };
+};
+
+ModalDialog RID_SVX_MDLG_FONTWORK_CHARSPACING
+{
+ HelpID = "svx:ModalDialog:RID_SVX_MDLG_FONTWORK_CHARSPACING";
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 139 , 64 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+
+ Text [ en-US ] = "Fontwork Character Spacing" ;
+
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 83 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 83 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 83 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_VALUE
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text[ en-US ] = "~Value";
+ };
+ MetricField MF_VALUE
+ {
+ HelpID = "svx:MetricField:RID_SVX_MDLG_FONTWORK_CHARSPACING:MF_VALUE";
+ Border = FALSE ;
+ Pos = MAP_APPFONT ( 6 , 17 ) ;
+ Size = MAP_APPFONT ( 32 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 500 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ Last = 100 ;
+ SpinSize = 5 ;
+ };
+};
+
diff --git a/svx/source/tbxctrls/formatpaintbrushctrl.cxx b/svx/source/tbxctrls/formatpaintbrushctrl.cxx
new file mode 100644
index 000000000000..1f6195d0da87
--- /dev/null
+++ b/svx/source/tbxctrls/formatpaintbrushctrl.cxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svx/formatpaintbrushctrl.hxx"
+
+// header for class SfxBoolItem
+#include <svl/eitem.hxx>
+
+// header for define SFX_APP
+#include <sfx2/app.hxx>
+
+// header for class ToolBox
+#include <vcl/toolbox.hxx>
+
+//.............................................................................
+namespace svx
+{
+//.............................................................................
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+
+SFX_IMPL_TOOLBOX_CONTROL( FormatPaintBrushToolBoxControl, SfxBoolItem );
+
+FormatPaintBrushToolBoxControl::FormatPaintBrushToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
+ : SfxToolBoxControl( nSlotId, nId, rTbx )
+ , m_bPersistentCopy(false)
+ , m_aDoubleClickTimer()
+{
+ sal_uIntPtr nDblClkTime = rTbx.GetSettings().GetMouseSettings().GetDoubleClickTime();
+
+ m_aDoubleClickTimer.SetTimeoutHdl( LINK(this, FormatPaintBrushToolBoxControl, WaitDoubleClickHdl) );
+ m_aDoubleClickTimer.SetTimeout(nDblClkTime);
+}
+
+// -----------------------------------------------------------------------
+
+FormatPaintBrushToolBoxControl::~FormatPaintBrushToolBoxControl()
+{
+ m_aDoubleClickTimer.Stop();
+}
+
+// -----------------------------------------------------------------------
+void FormatPaintBrushToolBoxControl::impl_executePaintBrush()
+{
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PersistentCopy" ));
+ aArgs[0].Value = makeAny( static_cast<sal_Bool>(m_bPersistentCopy) );
+ Dispatch( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormatPaintbrush" ))
+ , aArgs );
+}
+
+// -----------------------------------------------------------------------
+void FormatPaintBrushToolBoxControl::DoubleClick()
+{
+ m_aDoubleClickTimer.Stop();
+
+ m_bPersistentCopy = true;
+ this->impl_executePaintBrush();
+}
+
+// -----------------------------------------------------------------------
+void FormatPaintBrushToolBoxControl::Click()
+{
+ m_bPersistentCopy = false;
+ m_aDoubleClickTimer.Start();
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK(FormatPaintBrushToolBoxControl, WaitDoubleClickHdl, void*, EMPTYARG )
+{
+ //there was no second click during waiting
+ this->impl_executePaintBrush();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+void FormatPaintBrushToolBoxControl::Select( sal_Bool )
+{
+}
+
+// -----------------------------------------------------------------------
+void FormatPaintBrushToolBoxControl::StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState )
+{
+ if( ( eState & SFX_ITEM_SET ) == 0 )
+ m_bPersistentCopy = false;
+ SfxToolBoxControl::StateChanged( nSID, eState, pState );
+}
+
+//.............................................................................
+} //namespace svx
+//.............................................................................
diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx
new file mode 100644
index 000000000000..ebad78935d13
--- /dev/null
+++ b/svx/source/tbxctrls/grafctrl.cxx
@@ -0,0 +1,1290 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <string> // HACK: prevent conflict between STLPORT and Workshop headers
+
+#ifndef _TOOLBOX_HXX //autogen
+#include <vcl/toolbox.hxx>
+#endif
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+#include <vcl/fixed.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/intitem.hxx>
+#include <svl/eitem.hxx>
+#include <svl/whiter.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <tools/urlobj.hxx>
+#include <comphelper/processfactory.hxx>
+
+#include <svx/svxids.hrc>
+#include "grafctrl.hrc"
+#include <svx/dialogs.hrc>
+#include <editeng/brshitem.hxx>
+#include <editeng/sizeitem.hxx>
+#include <svx/sdgcpitm.hxx>
+//CHINA001 #include "../dialog/grfpage.hxx"
+#include <svx/itemwin.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdundo.hxx>
+#include <svx/svdtrans.hxx>
+#include "svx/grafctrl.hxx"
+#include "svx/tbxcolor.hxx"
+
+// namespaces
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+
+#include <svx/svxdlg.hxx> //CHINA001
+// -----------
+// - Defines -
+// -----------
+
+#define SYMBOL_TO_FIELD_OFFSET 4
+#define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
+#define TOOLBOX_NAME ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "colorbar" ) )
+
+// ----------------
+// - TbxImageItem -
+// ----------------
+
+TYPEINIT1_AUTOFACTORY( TbxImageItem, SfxUInt16Item );
+
+//---------------------------------------------------------
+
+TbxImageItem::TbxImageItem( sal_uInt16 _nWhich, sal_uInt16 nImage ) :
+ SfxUInt16Item( _nWhich, nImage )
+{
+}
+
+//---------------------------------------------------------
+
+SfxPoolItem* TbxImageItem::Clone( SfxItemPool* ) const
+{
+ return new TbxImageItem( *this );
+}
+
+//---------------------------------------------------------
+
+int TbxImageItem::operator==( const SfxPoolItem& rItem ) const
+{
+ return( ( (TbxImageItem&) rItem ).GetValue() == GetValue() );
+}
+
+// -----------------------
+// - ImplGrafMetricField -
+// -----------------------
+
+class ImplGrafMetricField : public MetricField
+{
+ using Window::Update;
+
+private:
+ Timer maTimer;
+ OUString maCommand;
+ Reference< XFrame > mxFrame;
+
+ DECL_LINK( ImplModifyHdl, Timer* );
+
+protected:
+
+ virtual void Modify();
+
+public:
+
+ ImplGrafMetricField( Window* pParent, const rtl::OUString& aCmd, const Reference< XFrame >& rFrame );
+ ~ImplGrafMetricField();
+
+ void Update( const SfxPoolItem* pItem );
+ const OUString& GetCommand() const { return maCommand; }
+};
+
+// -----------------------------------------------------------------------------
+
+ImplGrafMetricField::ImplGrafMetricField( Window* pParent, const rtl::OUString& rCmd, const Reference< XFrame >& rFrame ) :
+ MetricField( pParent, WB_BORDER | WB_SPIN | WB_REPEAT | WB_3DLOOK ),
+ maCommand( rCmd ),
+ mxFrame( rFrame )
+{
+ Size aSize( GetTextWidth( String::CreateFromAscii("-100 %") ), GetTextHeight() );
+
+ aSize.Width() += 20, aSize.Height() += 6;
+ SetSizePixel( aSize );
+
+ if ( maCommand.equalsAscii( ".uno:GrafGamma" ))
+ {
+ SetDecimalDigits( 2 );
+
+ SetMin( 10 );
+ SetFirst( 10 );
+ SetMax( 1000 );
+ SetLast( 1000 );
+ SetSpinSize( 10 );
+ }
+ else
+ {
+ const long nMinVal = ( maCommand.equalsAscii( ".uno:GrafTransparence" )) ? 0 : -100;
+
+ SetUnit( FUNIT_CUSTOM );
+ SetCustomUnitText( String::CreateFromAscii(" %") );
+ SetDecimalDigits( 0 );
+
+ SetMin( nMinVal );
+ SetFirst( nMinVal );
+ SetMax( 100 );
+ SetLast( 100 );
+ SetSpinSize( 1 );
+ }
+
+ maTimer.SetTimeout( 100 );
+ maTimer.SetTimeoutHdl( LINK( this, ImplGrafMetricField, ImplModifyHdl ) );
+}
+
+// -----------------------------------------------------------------------------
+
+ImplGrafMetricField::~ImplGrafMetricField()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void ImplGrafMetricField::Modify()
+{
+ maTimer.Start();
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( ImplGrafMetricField, ImplModifyHdl, Timer*, EMPTYARG )
+{
+ const sal_Int64 nVal = GetValue();
+
+ // Convert value to an any to be usable with dispatch API
+ Any a;
+ if ( maCommand.equalsAscii( ".uno:GrafRed" ) ||
+ maCommand.equalsAscii( ".uno:GrafGreen" ) ||
+ maCommand.equalsAscii( ".uno:GrafBlue" ) ||
+ maCommand.equalsAscii( ".uno:GrafLuminance" ) ||
+ maCommand.equalsAscii( ".uno:GrafContrast" ))
+ a = makeAny( sal_Int16( nVal ));
+ else if ( maCommand.equalsAscii( ".uno:GrafGamma" ) ||
+ maCommand.equalsAscii( ".uno:GrafTransparence" ))
+ a = makeAny( sal_Int32( nVal ));
+
+ if ( a.hasValue() )
+ {
+ INetURLObject aObj( maCommand );
+
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = aObj.GetURLPath();
+ aArgs[0].Value = a;
+
+ SfxToolBoxControl::Dispatch(
+ Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ),
+ maCommand,
+ aArgs );
+ }
+ return 0L;
+}
+
+// -----------------------------------------------------------------------------
+
+void ImplGrafMetricField::Update( const SfxPoolItem* pItem )
+{
+ if( pItem )
+ {
+ long nValue;
+
+ if ( maCommand.equalsAscii( ".uno:GrafTransparence" ))
+ nValue = ( (SfxUInt16Item*) pItem )->GetValue();
+ else if ( maCommand.equalsAscii( ".uno:GrafGamma" ))
+ nValue = ( (SfxUInt32Item*) pItem )->GetValue();
+ else
+ nValue = ( (SfxInt16Item*) pItem )->GetValue();
+
+ SetValue( nValue );
+ }
+ else
+ SetText( String() );
+}
+
+// --------------------
+// - ImplGrafControl -
+// --------------------
+
+struct CommandToRID
+{
+ const char* pCommand;
+ sal_uInt16 nResId;
+ sal_uInt16 nHCResId;
+};
+
+static sal_uInt16 ImplGetRID( const OUString& aCommand, bool bHighContrast )
+{
+ static const CommandToRID aImplCommandToResMap[] =
+ {
+ { ".uno:GrafRed", RID_SVXIMG_GRAF_RED, RID_SVXIMG_GRAF_RED_H },
+ { ".uno:GrafGreen", RID_SVXIMG_GRAF_GREEN, RID_SVXIMG_GRAF_GREEN_H },
+ { ".uno:GrafBlue", RID_SVXIMG_GRAF_BLUE, RID_SVXIMG_GRAF_BLUE_H },
+ { ".uno:GrafLuminance", RID_SVXIMG_GRAF_LUMINANCE, RID_SVXIMG_GRAF_LUMINANCE_H },
+ { ".uno:GrafContrast", RID_SVXIMG_GRAF_CONTRAST, RID_SVXIMG_GRAF_CONTRAST_H },
+ { ".uno:GrafGamma", RID_SVXIMG_GRAF_GAMMA, RID_SVXIMG_GRAF_GAMMA_H },
+ { ".uno:GrafTransparence", RID_SVXIMG_GRAF_TRANSPARENCE, RID_SVXIMG_GRAF_TRANSPARENCE_H },
+ { 0, 0, 0 }
+ };
+
+ sal_uInt16 nRID = 0;
+
+ sal_Int32 i( 0 );
+ while ( aImplCommandToResMap[ i ].pCommand )
+ {
+ if ( aCommand.equalsAscii( aImplCommandToResMap[ i ].pCommand ))
+ {
+ if ( bHighContrast )
+ nRID = aImplCommandToResMap[ i ].nHCResId;
+ else
+ nRID = aImplCommandToResMap[ i ].nResId;
+ break;
+ }
+ ++i;
+ }
+
+ return nRID;
+}
+
+// -----------------------------------------------------------------------------
+
+class ImplGrafControl : public Control
+{
+ using Window::Update;
+private:
+ FixedImage maImage;
+ ImplGrafMetricField maField;
+
+protected:
+
+ virtual void GetFocus();
+
+public:
+
+ ImplGrafControl( Window* pParent, sal_uInt16 nSlotId, const rtl::OUString& rCmd, const Reference< XFrame >& rFrame );
+ ~ImplGrafControl();
+
+ void Update( const SfxPoolItem* pItem ) { maField.Update( pItem ); }
+ void SetText( const String& rStr ) { maField.SetText( rStr ); }
+};
+
+// -----------------------------------------------------------------------------
+
+ImplGrafControl::ImplGrafControl( Window* pParent, sal_uInt16, const rtl::OUString& rCmd, const Reference< XFrame >& rFrame ) :
+ Control( pParent, WB_TABSTOP ),
+ maImage ( this ),
+ maField ( this, rCmd, rFrame )
+{
+ ResId aResId( ImplGetRID( rCmd, false ), DIALOG_MGR() ) ;
+ Image aImage( aResId );
+
+ ResId aResIdHC( ImplGetRID( rCmd, true ), DIALOG_MGR() ) ;
+ Image aImageHC( aResIdHC );
+
+ Size aImgSize( aImage.GetSizePixel() );
+ Size aFldSize( maField.GetSizePixel() );
+ long nFldY, nImgY;
+
+ maImage.SetImage( aImage );
+ maImage.SetModeImage( aImageHC, BMP_COLOR_HIGHCONTRAST );
+ maImage.SetSizePixel( aImgSize );
+ // we want to see the backbround of the toolbox, not of the FixedImage or Control
+ maImage.SetBackground( Wallpaper( COL_TRANSPARENT ) );
+ SetBackground( Wallpaper( COL_TRANSPARENT ) );
+
+ if( aImgSize.Height() > aFldSize.Height() )
+ nImgY = 0, nFldY = ( aImgSize.Height() - aFldSize.Height() ) >> 1;
+ else
+ nFldY = 0, nImgY = ( aFldSize.Height() - aImgSize.Height() ) >> 1;
+
+ long nOffset = SYMBOL_TO_FIELD_OFFSET / 2;
+ maImage.SetPosPixel( Point( nOffset, nImgY ) );
+ maField.SetPosPixel( Point( aImgSize.Width() + SYMBOL_TO_FIELD_OFFSET, nFldY ) );
+ SetSizePixel( Size( aImgSize.Width() + aFldSize.Width() + SYMBOL_TO_FIELD_OFFSET + nOffset,
+ Max( aImgSize.Height(), aFldSize.Height() ) ) );
+
+ SetBackground( Wallpaper() ); // transparent background
+
+ maImage.Show();
+
+ maField.SetHelpId( rtl::OUStringToOString( rCmd, RTL_TEXTENCODING_UTF8 ) );
+ maField.Show();
+}
+
+// -----------------------------------------------------------------------------
+
+ImplGrafControl::~ImplGrafControl()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void ImplGrafControl::GetFocus()
+{
+ maField.GrabFocus();
+}
+
+// -----------------------
+// - ImplGrafModeControl -
+// -----------------------
+
+class ImplGrafModeControl : public ListBox
+{
+ using Window::Update;
+private:
+ sal_uInt16 mnCurPos;
+ Reference< XFrame > mxFrame;
+
+ virtual void Select();
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ virtual long Notify( NotifyEvent& rNEvt );
+ void ImplReleaseFocus();
+
+public:
+
+ ImplGrafModeControl( Window* pParent, const Reference< XFrame >& rFrame );
+ ~ImplGrafModeControl();
+
+ void Update( const SfxPoolItem* pItem );
+};
+
+// -----------------------------------------------------------------------------
+
+ImplGrafModeControl::ImplGrafModeControl( Window* pParent, const Reference< XFrame >& rFrame ) :
+ ListBox( pParent, WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL ),
+ mnCurPos( 0 ),
+ mxFrame( rFrame )
+{
+ SetSizePixel( Size( 100, 260 ) );
+
+ InsertEntry( SVX_RESSTR( RID_SVXSTR_GRAFMODE_STANDARD ) );
+ InsertEntry( SVX_RESSTR( RID_SVXSTR_GRAFMODE_GREYS ) );
+ InsertEntry( SVX_RESSTR( RID_SVXSTR_GRAFMODE_MONO ) );
+ InsertEntry( SVX_RESSTR( RID_SVXSTR_GRAFMODE_WATERMARK ) );
+
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+ImplGrafModeControl::~ImplGrafModeControl()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void ImplGrafModeControl::Select()
+{
+ if ( !IsTravelSelect() )
+ {
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GrafMode" ));
+ aArgs[0].Value = makeAny( sal_Int16( GetSelectEntryPos() ));
+
+ /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call.
+ This instance may be deleted in the meantime (i.e. when a dialog is opened
+ while in Dispatch()), accessing members will crash in this case. */
+ ImplReleaseFocus();
+
+ SfxToolBoxControl::Dispatch(
+ Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GrafMode" )),
+ aArgs );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+long ImplGrafModeControl::PreNotify( NotifyEvent& rNEvt )
+{
+ sal_uInt16 nType = rNEvt.GetType();
+
+ if( EVENT_MOUSEBUTTONDOWN == nType || EVENT_GETFOCUS == nType )
+ mnCurPos = GetSelectEntryPos();
+
+ return ListBox::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+long ImplGrafModeControl::Notify( NotifyEvent& rNEvt )
+{
+ long nHandled = ListBox::Notify( rNEvt );
+
+ if( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+
+ switch( pKEvt->GetKeyCode().GetCode() )
+ {
+ case KEY_RETURN:
+ {
+ Select();
+ nHandled = 1;
+ }
+ break;
+
+ case KEY_ESCAPE:
+ {
+ SelectEntryPos( mnCurPos );
+ ImplReleaseFocus();
+ nHandled = 1;
+ }
+ break;
+ }
+ }
+
+ return nHandled;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplGrafModeControl::ImplReleaseFocus()
+{
+ if( SfxViewShell::Current() )
+ {
+ Window* pShellWnd = SfxViewShell::Current()->GetWindow();
+
+ if( pShellWnd )
+ pShellWnd->GrabFocus();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplGrafModeControl::Update( const SfxPoolItem* pItem )
+{
+ if( pItem )
+ SelectEntryPos( ((SfxUInt16Item*)pItem)->GetValue() );
+ else
+ SetNoSelection();
+}
+
+// -----------------------
+// - ImplGrafFilterPopup -
+// -----------------------
+/*
+CD!!!
+class ImplGrafFilterPopup : public SfxPopupWindow
+{
+private:
+
+ SvxGrafFilterToolBoxControl* mpParent;
+ Reference< XConfigurableUIElement > m_xToolBar;
+// SfxToolBoxManager maTbxMgr;
+ ResId maResIdWin;
+ ResId maResIdTbx;
+ WindowAlign meTbxAlign;
+ Link maSelectHdl;
+
+ DECL_LINK( TbxSelectHdl, void* );
+
+public:
+ ImplGrafFilterPopup( sal_uInt16 nId, SvxGrafFilterToolBoxControl* pParent,
+ WindowAlign eAlign,
+ const ResId& rResIdWin, const ResId& rResIdTbx,
+ SfxBindings& rBindings );
+ ~ImplGrafFilterPopup();
+
+ virtual SfxPopupWindow* Clone() const;
+ virtual void PopupModeEnd();
+
+ void StartSelection() { maTbxMgr.GetToolBox().StartSelection(); }
+ void Update();
+};
+
+// -----------------------------------------------------------------------------
+
+ImplGrafFilterPopup::ImplGrafFilterPopup( sal_uInt16 nId, SvxGrafFilterToolBoxControl* pParent,
+ WindowAlign eAlign,
+ const ResId& rResIdWin, const ResId& rResIdTbx ) :
+ SfxPopupWindow ( nId, rResIdWin ),
+ mpParent ( pParent ),
+ maTbxMgr ( this, GetBindings(), rResIdTbx ),
+ maResIdWin ( rResIdWin ),
+ maResIdTbx ( rResIdTbx ),
+ meTbxAlign ( eAlign )
+{
+ maTbxMgr.UseDefault();
+
+ maSelectHdl = maTbxMgr.GetToolBox().GetSelectHdl();
+ maTbxMgr.GetToolBox().SetSelectHdl( LINK( this, ImplGrafFilterPopup, TbxSelectHdl ) );
+
+ FreeResource();
+
+ const Size aSize( maTbxMgr.CalcWindowSizePixel() );
+ maTbxMgr.SetPosSizePixel( Point(), aSize );
+ SetOutputSizePixel( aSize );
+}
+
+// -----------------------------------------------------------------------------
+
+ImplGrafFilterPopup::~ImplGrafFilterPopup()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+SfxPopupWindow* ImplGrafFilterPopup::Clone() const
+{
+ return( new ImplGrafFilterPopup( GetId(), mpParent, meTbxAlign,
+ maResIdWin, maResIdTbx,
+ (SfxBindings&) GetBindings() ) );
+}
+
+// -----------------------------------------------------------------------------
+
+void ImplGrafFilterPopup::Update()
+{
+ ToolBox* pBox = &maTbxMgr.GetToolBox();
+ maTbxMgr.Activate( pBox );
+ maTbxMgr.Deactivate( pBox );
+}
+
+// -----------------------------------------------------------------------------
+
+void ImplGrafFilterPopup::PopupModeEnd()
+{
+ maTbxMgr.GetToolBox().EndSelection();
+ SfxPopupWindow::PopupModeEnd();
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( ImplGrafFilterPopup, TbxSelectHdl, void*, EMPTYARG )
+{
+ const sal_uInt16 nSlotId = maTbxMgr.GetToolBox().GetCurItemId();
+
+ if( IsInPopupMode() )
+ EndPopupMode();
+
+ GetBindings().GetDispatcher()->Execute( nSlotId, SFX_CALLMODE_ASYNCHRON );
+
+ return 0;
+}
+*/
+// -------------------------------
+// - SvxGrafFilterToolBoxControl -
+// -------------------------------
+
+SFX_IMPL_TOOLBOX_CONTROL( SvxGrafFilterToolBoxControl, TbxImageItem );
+
+// -----------------------------------------------------------------------------
+
+SvxGrafFilterToolBoxControl::SvxGrafFilterToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
+ SfxToolBoxControl( nSlotId, nId, rTbx )
+{
+ rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) );
+ rTbx.Invalidate();
+}
+
+// -----------------------------------------------------------------------------
+
+SvxGrafFilterToolBoxControl::~SvxGrafFilterToolBoxControl()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SvxGrafFilterToolBoxControl::StateChanged( sal_uInt16, SfxItemState eState, const SfxPoolItem* )
+{
+ GetToolBox().EnableItem( GetId(), ( eState != SFX_ITEM_DISABLED ) );
+}
+
+// -----------------------------------------------------------------------------
+
+SfxPopupWindowType SvxGrafFilterToolBoxControl::GetPopupWindowType() const
+{
+ return SFX_POPUPWINDOW_ONCLICK;
+}
+
+// -----------------------------------------------------------------------------
+
+SfxPopupWindow* SvxGrafFilterToolBoxControl::CreatePopupWindow()
+{
+ rtl::OUString aSubTbxResName(
+ RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/graffilterbar" ) );
+ createAndPositionSubToolBar( aSubTbxResName );
+
+ return NULL;
+}
+
+// -------------------------
+// - SvxGrafToolBoxControl -
+// -------------------------
+
+SFX_IMPL_TOOLBOX_CONTROL( SvxGrafToolBoxControl, SfxVoidItem );
+
+// -----------------------------------------------------------------------------
+
+SvxGrafToolBoxControl::SvxGrafToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx) :
+ SfxToolBoxControl( nSlotId, nId, rTbx )
+{
+ rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) );
+ rTbx.Invalidate();
+}
+
+// -----------------------------------------------------------------------------
+
+SvxGrafToolBoxControl::~SvxGrafToolBoxControl()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SvxGrafToolBoxControl::StateChanged( sal_uInt16, SfxItemState eState, const SfxPoolItem* pState )
+
+{
+ ImplGrafControl* pCtrl = (ImplGrafControl*) GetToolBox().GetItemWindow( GetId() );
+ DBG_ASSERT( pCtrl, "Control not found" );
+
+ if( eState == SFX_ITEM_DISABLED )
+ {
+ pCtrl->Disable();
+ pCtrl->SetText( String() );
+ }
+ else
+ {
+ pCtrl->Enable();
+
+ if( eState == SFX_ITEM_AVAILABLE )
+ pCtrl->Update( pState );
+ else
+ pCtrl->Update( NULL );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+Window* SvxGrafToolBoxControl::CreateItemWindow( Window *pParent )
+{
+ return( new ImplGrafControl( pParent, GetSlotId(), m_aCommandURL, m_xFrame ) );
+}
+
+// ----------------------------
+// - SvxGrafRedToolBoxControl -
+// ----------------------------
+
+SFX_IMPL_TOOLBOX_CONTROL( SvxGrafRedToolBoxControl, SfxInt16Item );
+
+// -----------------------------------------------------------------------------
+
+SvxGrafRedToolBoxControl::SvxGrafRedToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
+ SvxGrafToolBoxControl( nSlotId, nId, rTbx )
+{
+}
+
+// ------------------------------
+// - SvxGrafGreenToolBoxControl -
+// ------------------------------
+
+SFX_IMPL_TOOLBOX_CONTROL( SvxGrafGreenToolBoxControl, SfxInt16Item );
+
+// -----------------------------------------------------------------------------
+
+SvxGrafGreenToolBoxControl::SvxGrafGreenToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
+ SvxGrafToolBoxControl( nSlotId, nId, rTbx )
+{
+}
+
+// -----------------------------
+// - SvxGrafBlueToolBoxControl -
+// -----------------------------
+
+SFX_IMPL_TOOLBOX_CONTROL( SvxGrafBlueToolBoxControl, SfxInt16Item );
+
+// -----------------------------------------------------------------------------
+
+SvxGrafBlueToolBoxControl::SvxGrafBlueToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
+ SvxGrafToolBoxControl( nSlotId, nId, rTbx )
+{
+}
+
+// ----------------------------------
+// - SvxGrafLuminanceToolBoxControl -
+// ----------------------------------
+
+SFX_IMPL_TOOLBOX_CONTROL( SvxGrafLuminanceToolBoxControl, SfxInt16Item );
+
+// -----------------------------------------------------------------------------
+
+SvxGrafLuminanceToolBoxControl::SvxGrafLuminanceToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
+ SvxGrafToolBoxControl( nSlotId, nId, rTbx )
+{
+}
+
+// ----------------------------------
+// - SvxGrafContrastToolBoxControl -
+// ----------------------------------
+
+SFX_IMPL_TOOLBOX_CONTROL( SvxGrafContrastToolBoxControl, SfxInt16Item );
+
+// -----------------------------------------------------------------------------
+
+SvxGrafContrastToolBoxControl::SvxGrafContrastToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
+ SvxGrafToolBoxControl( nSlotId, nId, rTbx )
+{
+}
+
+// ------------------------------
+// - SvxGrafGammaToolBoxControl -
+// ------------------------------
+
+SFX_IMPL_TOOLBOX_CONTROL( SvxGrafGammaToolBoxControl, SfxUInt32Item );
+
+// -----------------------------------------------------------------------------
+
+SvxGrafGammaToolBoxControl::SvxGrafGammaToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
+ SvxGrafToolBoxControl( nSlotId, nId, rTbx )
+{
+}
+
+// -------------------------------------
+// - SvxGrafTransparenceToolBoxControl -
+// -------------------------------------
+
+SFX_IMPL_TOOLBOX_CONTROL( SvxGrafTransparenceToolBoxControl, SfxUInt16Item );
+
+// -----------------------------------------------------------------------------
+
+SvxGrafTransparenceToolBoxControl::SvxGrafTransparenceToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
+ SvxGrafToolBoxControl( nSlotId, nId, rTbx )
+{
+}
+
+// -----------------------------
+// - SvxGrafModeToolBoxControl -
+// -----------------------------
+
+SFX_IMPL_TOOLBOX_CONTROL( SvxGrafModeToolBoxControl, SfxUInt16Item );
+
+// -----------------------------------------------------------------------------
+
+SvxGrafModeToolBoxControl::SvxGrafModeToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
+ SfxToolBoxControl( nSlotId, nId, rTbx )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+SvxGrafModeToolBoxControl::~SvxGrafModeToolBoxControl()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SvxGrafModeToolBoxControl::StateChanged( sal_uInt16, SfxItemState eState, const SfxPoolItem* pState )
+
+{
+ ImplGrafModeControl* pCtrl = (ImplGrafModeControl*) GetToolBox().GetItemWindow( GetId() );
+ DBG_ASSERT( pCtrl, "Control not found" );
+
+ if( eState == SFX_ITEM_DISABLED )
+ {
+ pCtrl->Disable();
+ pCtrl->SetText( String() );
+ }
+ else
+ {
+ pCtrl->Enable();
+
+ if( eState == SFX_ITEM_AVAILABLE )
+ pCtrl->Update( pState );
+ else
+ pCtrl->Update( NULL );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+Window* SvxGrafModeToolBoxControl::CreateItemWindow( Window *pParent )
+{
+ return( new ImplGrafModeControl( pParent, m_xFrame ) );
+}
+
+// ---------------------
+// - SvxGrafAttrHelper -
+// ---------------------
+
+void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView )
+{
+ SfxItemPool& rPool = rView.GetModel()->GetItemPool();
+ SfxItemSet aSet( rPool, SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST );
+
+ const bool bUndo = rView.IsUndoEnabled();
+
+ String aUndoStr;
+
+ if( bUndo )
+ {
+ aUndoStr = rView.GetDescriptionOfMarkedObjects();
+ aUndoStr.Append( sal_Unicode(' ') );
+ }
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem;
+ sal_uInt16 nSlot = rReq.GetSlot();
+
+ if( !pArgs || SFX_ITEM_SET != pArgs->GetItemState( nSlot, sal_False, &pItem ))
+ pItem = 0;
+
+ switch( nSlot )
+ {
+ case SID_ATTR_GRAF_RED:
+ {
+ if( pItem )
+ {
+ aSet.Put( SdrGrafRedItem( ((SfxInt16Item*)pItem)->GetValue() ));
+ if( bUndo )
+ aUndoStr.Append( String( SVX_RESSTR( RID_SVXSTR_UNDO_GRAFRED ) ) );
+ }
+ }
+ break;
+
+ case SID_ATTR_GRAF_GREEN:
+ {
+ if( pItem )
+ {
+ aSet.Put( SdrGrafGreenItem( ((SfxInt16Item*)pItem)->GetValue() ));
+ if( bUndo )
+ aUndoStr.Append( String( SVX_RESSTR( RID_SVXSTR_UNDO_GRAFGREEN ) ) );
+ }
+ }
+ break;
+
+ case SID_ATTR_GRAF_BLUE:
+ {
+ if( pItem )
+ {
+ aSet.Put( SdrGrafBlueItem( ((SfxInt16Item*)pItem)->GetValue() ));
+ if( bUndo )
+ aUndoStr.Append( String( SVX_RESSTR( RID_SVXSTR_UNDO_GRAFBLUE ) ) );
+ }
+ }
+ break;
+
+ case SID_ATTR_GRAF_LUMINANCE:
+ {
+ if( pItem )
+ {
+ aSet.Put( SdrGrafLuminanceItem( ((SfxInt16Item*)pItem)->GetValue() ));
+ if( bUndo )
+ aUndoStr.Append( String( SVX_RESSTR( RID_SVXSTR_UNDO_GRAFLUMINANCE ) ) );
+ }
+ }
+ break;
+
+ case SID_ATTR_GRAF_CONTRAST:
+ {
+ if( pItem )
+ {
+ aSet.Put( SdrGrafContrastItem( ((SfxInt16Item*)pItem)->GetValue() ));
+ if( bUndo )
+ aUndoStr.Append( String( SVX_RESSTR( RID_SVXSTR_UNDO_GRAFCONTRAST ) ) );
+ }
+ }
+ break;
+
+ case SID_ATTR_GRAF_GAMMA:
+ {
+ if( pItem )
+ {
+ aSet.Put( SdrGrafGamma100Item( ((SfxUInt32Item*)pItem)->GetValue() ));
+ if( bUndo )
+ aUndoStr.Append( String( SVX_RESSTR( RID_SVXSTR_UNDO_GRAFGAMMA ) ) );
+ }
+ }
+ break;
+
+ case SID_ATTR_GRAF_TRANSPARENCE:
+ {
+ if( pItem )
+ {
+ aSet.Put( SdrGrafTransparenceItem( ((SfxUInt16Item*)pItem)->GetValue() ));
+ if( bUndo )
+ aUndoStr.Append( String( SVX_RESSTR( RID_SVXSTR_UNDO_GRAFTRANSPARENCY ) ) );
+ }
+ }
+ break;
+
+ case SID_ATTR_GRAF_MODE:
+ {
+ if( pItem )
+ {
+ aSet.Put( SdrGrafModeItem( (GraphicDrawMode) ((SfxUInt16Item*)pItem)->GetValue() ));
+ if( bUndo )
+ aUndoStr.Append( String( SVX_RESSTR( RID_SVXSTR_UNDO_GRAFMODE ) ) );
+ }
+ }
+ break;
+
+ case( SID_ATTR_GRAF_CROP ):
+ {
+ const SdrMarkList& rMarkList = rView.GetMarkedObjectList();
+
+ if( 0 < rMarkList.GetMarkCount() )
+ {
+ SdrGrafObj* pObj = (SdrGrafObj*) rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+
+ if( pObj && pObj->ISA( SdrGrafObj ) &&
+ ( pObj->GetGraphicType() != GRAPHIC_NONE ) &&
+ ( pObj->GetGraphicType() != GRAPHIC_DEFAULT ) )
+ {
+ SfxItemSet aGrfAttr( rPool, SDRATTR_GRAFCROP, SDRATTR_GRAFCROP, 0 );
+ const SfxMapUnit eOldMetric = rPool.GetMetric( 0 );
+ const MapMode aMap100( MAP_100TH_MM );
+ const MapMode aMapTwip( MAP_TWIP );
+
+ aGrfAttr.Put(pObj->GetMergedItemSet());
+ rPool.SetDefaultMetric( SFX_MAPUNIT_TWIP );
+
+ SfxItemSet aCropDlgAttr( rPool,
+ SDRATTR_GRAFCROP, SDRATTR_GRAFCROP,
+ SID_ATTR_GRAF_GRAPHIC, SID_ATTR_GRAF_GRAPHIC,
+ SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
+ SID_ATTR_GRAF_FRMSIZE, SID_ATTR_GRAF_FRMSIZE,
+ SID_ATTR_GRAF_CROP, SID_ATTR_GRAF_CROP, 0 );
+
+ aCropDlgAttr.Put( SvxBrushItem( pObj->GetGraphic(), GPOS_MM, SID_ATTR_GRAF_GRAPHIC ) );
+ aCropDlgAttr.Put( SvxSizeItem( SID_ATTR_PAGE_SIZE,
+ Size( OutputDevice::LogicToLogic(
+ Size( 200000, 200000 ), aMap100, aMapTwip ) ) ) );
+ aCropDlgAttr.Put( SvxSizeItem( SID_ATTR_GRAF_FRMSIZE, OutputDevice::LogicToLogic(
+ pObj->GetLogicRect().GetSize(), aMap100, aMapTwip ) ) );
+
+ const SdrGrafCropItem& rCrop = (const SdrGrafCropItem&) aGrfAttr.Get( SDRATTR_GRAFCROP );
+ Size aLTSize( OutputDevice::LogicToLogic(
+ Size( rCrop.GetLeft(), rCrop.GetTop() ), aMap100, aMapTwip ) );
+ Size aRBSize( OutputDevice::LogicToLogic(
+ Size( rCrop.GetRight(), rCrop.GetBottom() ), aMap100, aMapTwip ) );
+
+ aCropDlgAttr.Put( SdrGrafCropItem( aLTSize.Width(), aLTSize.Height(),
+ aRBSize.Width(), aRBSize.Height() ) );
+
+ SfxSingleTabDialog aCropDialog( SfxViewShell::Current() ? SfxViewShell::Current()->GetWindow() : NULL,
+ aCropDlgAttr, 950 );
+ const String aCropStr = SVX_RESSTR( RID_SVXSTR_GRAFCROP );
+ //CHINA001 SfxTabPage* pTabPage = SvxGrfCropPage::Create( &aCropDialog, aCropDlgAttr );
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet error!");//CHINA001
+ ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_GRFCROP );
+ DBG_ASSERT(fnCreatePage, "Dialogdiet error!");//CHINA001
+ SfxTabPage* pTabPage = (*fnCreatePage)( &aCropDialog, aCropDlgAttr );
+ //CHINA001 end
+ pTabPage->SetText( aCropStr );
+ aCropDialog.SetTabPage( pTabPage );
+
+ if( aCropDialog.Execute() == RET_OK )
+ {
+ const SfxItemSet* pOutAttr = aCropDialog.GetOutputItemSet();
+
+ if( pOutAttr )
+ {
+ aUndoStr.Append( String( SVX_RESSTR( RID_SVXSTR_UNDO_GRAFCROP ) ) );
+
+ // set crop attributes
+ if( SFX_ITEM_SET <= pOutAttr->GetItemState( SDRATTR_GRAFCROP ) )
+ {
+ const SdrGrafCropItem& rNewCrop = (const SdrGrafCropItem&) pOutAttr->Get( SDRATTR_GRAFCROP );
+
+ aLTSize = OutputDevice::LogicToLogic( Size( rNewCrop.GetLeft(), rNewCrop.GetTop() ), aMapTwip, aMap100 );
+ aRBSize = OutputDevice::LogicToLogic( Size( rNewCrop.GetRight(), rNewCrop.GetBottom() ), aMapTwip, aMap100 );
+ aSet.Put( SdrGrafCropItem( aLTSize.Width(), aLTSize.Height(), aRBSize.Width(), aRBSize.Height() ) );
+ }
+
+ // set new logic rect
+ if( SFX_ITEM_SET <= pOutAttr->GetItemState( SID_ATTR_GRAF_FRMSIZE ) )
+ {
+ Point aNewOrigin( pObj->GetLogicRect().TopLeft() );
+ const Size& rGrfSize = ( (const SvxSizeItem&) pOutAttr->Get( SID_ATTR_GRAF_FRMSIZE ) ).GetSize();
+ Size aNewGrfSize( OutputDevice::LogicToLogic( rGrfSize, aMapTwip, aMap100 ) );
+ Size aOldGrfSize( pObj->GetLogicRect().GetSize() );
+
+ Rectangle aNewRect( aNewOrigin, aNewGrfSize );
+ Point aOffset( (aNewGrfSize.Width() - aOldGrfSize.Width()) >> 1,
+ (aNewGrfSize.Height() - aOldGrfSize.Height()) >> 1 );
+
+ // #106181# rotate snap rect before setting it
+ const GeoStat& aGeo = pObj->GetGeoStat();
+
+ if (aGeo.nDrehWink!=0 || aGeo.nShearWink!=0)
+ {
+ Polygon aPol(aNewRect);
+
+ // also transform origin offset
+ if (aGeo.nShearWink!=0)
+ {
+ ShearPoly(aPol,
+ aNewRect.TopLeft(),
+ aGeo.nTan);
+ ShearPoint(aOffset, Point(0,0), aGeo.nTan);
+ }
+ if (aGeo.nDrehWink!=0)
+ {
+ RotatePoly(aPol,
+ aNewRect.TopLeft(),
+ aGeo.nSin,aGeo.nCos);
+ RotatePoint(aOffset, Point(0,0), aGeo.nSin,aGeo.nCos);
+ }
+
+ // apply offset
+ aPol.Move( -aOffset.X(), -aOffset.Y() );
+ aNewRect=aPol.GetBoundRect();
+ }
+ else
+ {
+ aNewRect.Move( -aOffset.X(), -aOffset.Y() );
+ }
+
+ if( !aSet.Count() )
+ rView.SetMarkedObjRect( aNewRect );
+ else
+ {
+ if( bUndo )
+ {
+ rView.BegUndo( aUndoStr );
+ rView.AddUndo( rView.GetModel()->GetSdrUndoFactory().CreateUndoGeoObject( *pObj ) );
+ }
+ pObj->SetSnapRect( aNewRect );
+ rView.SetAttributes( aSet );
+
+ if( bUndo )
+ rView.EndUndo();
+ aSet.ClearItem();
+ }
+ }
+ }
+ }
+
+ rPool.SetDefaultMetric( eOldMetric );
+ }
+ }
+ }
+ break;
+
+ case SID_COLOR_SETTINGS:
+ {
+ svx::ToolboxAccess aToolboxAccess( TOOLBOX_NAME );
+ aToolboxAccess.toggleToolbox();
+ rReq.Done();
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ if( aSet.Count() )
+ {
+ if( bUndo )
+ rView.BegUndo( aUndoStr );
+
+ rView.SetAttributes( aSet );
+
+ if( bUndo )
+ rView.EndUndo();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SvxGrafAttrHelper::GetGrafAttrState( SfxItemSet& rSet, SdrView& rView )
+{
+ SfxItemPool& rPool = rView.GetModel()->GetItemPool();
+ SfxItemSet aAttrSet( rPool );
+ SfxWhichIter aIter( rSet );
+ sal_uInt16 nWhich = aIter.FirstWhich();
+
+ rView.GetAttributes( aAttrSet );
+
+ while( nWhich )
+ {
+ sal_uInt16 nSlotId = SfxItemPool::IsWhich( nWhich ) ? rPool.GetSlotId( nWhich ) : nWhich;
+
+ switch( nSlotId )
+ {
+ case( SID_ATTR_GRAF_MODE ):
+ {
+ if( SFX_ITEM_AVAILABLE <= aAttrSet.GetItemState( SDRATTR_GRAFMODE ) )
+ {
+ rSet.Put( SfxUInt16Item( nSlotId,
+ sal::static_int_cast< sal_uInt16 >( ITEMVALUE( aAttrSet, SDRATTR_GRAFMODE, SdrGrafModeItem ) ) ) );
+ }
+ }
+ break;
+
+ case( SID_ATTR_GRAF_RED ):
+ {
+ if( SFX_ITEM_AVAILABLE <= aAttrSet.GetItemState( SDRATTR_GRAFRED ) )
+ {
+ rSet.Put( SfxInt16Item( nSlotId,
+ ITEMVALUE( aAttrSet, SDRATTR_GRAFRED, SdrGrafRedItem ) ) );
+ }
+ }
+ break;
+
+ case( SID_ATTR_GRAF_GREEN ):
+ {
+ if( SFX_ITEM_AVAILABLE <= aAttrSet.GetItemState( SDRATTR_GRAFGREEN ) )
+ {
+ rSet.Put( SfxInt16Item( nSlotId,
+ ITEMVALUE( aAttrSet, SDRATTR_GRAFGREEN, SdrGrafGreenItem ) ) );
+ }
+ }
+ break;
+
+ case( SID_ATTR_GRAF_BLUE ):
+ {
+ if( SFX_ITEM_AVAILABLE <= aAttrSet.GetItemState( SDRATTR_GRAFBLUE ) )
+ {
+ rSet.Put( SfxInt16Item( nSlotId,
+ ITEMVALUE( aAttrSet, SDRATTR_GRAFBLUE, SdrGrafBlueItem ) ) );
+ }
+ }
+ break;
+
+ case( SID_ATTR_GRAF_LUMINANCE ):
+ {
+ if( SFX_ITEM_AVAILABLE <= aAttrSet.GetItemState( SDRATTR_GRAFLUMINANCE ) )
+ {
+ rSet.Put( SfxInt16Item( nSlotId,
+ ITEMVALUE( aAttrSet, SDRATTR_GRAFLUMINANCE, SdrGrafLuminanceItem ) ) );
+ }
+ }
+ break;
+
+ case( SID_ATTR_GRAF_CONTRAST ):
+ {
+ if( SFX_ITEM_AVAILABLE <= aAttrSet.GetItemState( SDRATTR_GRAFCONTRAST ) )
+ {
+ rSet.Put( SfxInt16Item( nSlotId,
+ ITEMVALUE( aAttrSet, SDRATTR_GRAFCONTRAST, SdrGrafContrastItem ) ) );
+ }
+ }
+ break;
+
+ case( SID_ATTR_GRAF_GAMMA ):
+ {
+ if( SFX_ITEM_AVAILABLE <= aAttrSet.GetItemState( SDRATTR_GRAFGAMMA ) )
+ {
+ rSet.Put( SfxUInt32Item( nSlotId,
+ ITEMVALUE( aAttrSet, SDRATTR_GRAFGAMMA, SdrGrafGamma100Item ) ) );
+ }
+ }
+ break;
+
+ case( SID_ATTR_GRAF_TRANSPARENCE ):
+ {
+ if( SFX_ITEM_AVAILABLE <= aAttrSet.GetItemState( SDRATTR_GRAFTRANSPARENCE ) )
+ {
+ const SdrMarkList& rMarkList = rView.GetMarkedObjectList();
+ sal_Bool bEnable = sal_True;
+
+ for( sal_uInt16 i = 0, nCount = (sal_uInt16) rMarkList.GetMarkCount();
+ ( i < nCount ) && bEnable; i++ )
+ {
+ SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+
+ if( !pObj || !pObj->ISA( SdrGrafObj ) ||
+ ( (SdrGrafObj*) pObj )->HasGDIMetaFile() ||
+ ( (SdrGrafObj*) pObj )->IsAnimated() )
+ {
+ bEnable = sal_False;
+ }
+ }
+
+ if( bEnable )
+ rSet.Put( SfxUInt16Item( nSlotId,
+ ITEMVALUE( aAttrSet, SDRATTR_GRAFTRANSPARENCE, SdrGrafTransparenceItem ) ) );
+ else
+ rSet.DisableItem( SID_ATTR_GRAF_TRANSPARENCE );
+ }
+ }
+ break;
+
+ case( SID_ATTR_GRAF_CROP ):
+ {
+ const SdrMarkList& rMarkList = rView.GetMarkedObjectList();
+ sal_Bool bDisable = sal_True;
+
+ if( 1 == rMarkList.GetMarkCount() )
+ {
+ SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+
+ if( pObj && pObj->ISA( SdrGrafObj ) )
+ {
+ SdrGrafObj* pGrafObj = (SdrGrafObj*) pObj;
+
+ if( ( pGrafObj->GetGraphicType() != GRAPHIC_NONE ) &&
+ ( pGrafObj->GetGraphicType() != GRAPHIC_DEFAULT ) )
+ {
+ bDisable = sal_False;
+ }
+ }
+ }
+
+ if( bDisable )
+ rSet.DisableItem( nSlotId );
+ }
+ break;
+
+ case SID_COLOR_SETTINGS :
+ {
+ svx::ToolboxAccess aToolboxAccess( TOOLBOX_NAME );
+ rSet.Put( SfxBoolItem( nWhich, aToolboxAccess.isToolboxVisible() ) );
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+}
diff --git a/svx/source/tbxctrls/grafctrl.hrc b/svx/source/tbxctrls/grafctrl.hrc
new file mode 100644
index 000000000000..2da0c45c8a42
--- /dev/null
+++ b/svx/source/tbxctrls/grafctrl.hrc
@@ -0,0 +1,28 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define TBX_GRFFILTER 1
diff --git a/svx/source/tbxctrls/grafctrl.src b/svx/source/tbxctrls/grafctrl.src
new file mode 100644
index 000000000000..3ca726bfde7f
--- /dev/null
+++ b/svx/source/tbxctrls/grafctrl.src
@@ -0,0 +1,192 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "grafctrl.hrc"
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+#include <svx/svxids.hrc>
+
+FloatingWindow RID_SVXTBX_GRFFILTER
+{
+ HelpId = HID_GRFFILTER;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Text [ en-US ] = "Filters" ;
+ ToolBox TBX_GRFFILTER
+ {
+ SVLook = TRUE ;
+ MenuStrings = TRUE ;
+ Align = BOXALIGN_TOP;
+ LineCount = 3;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ Identifier = SID_GRFFILTER_INVERT ;
+ HelpID = HID_GRFFILTER_INVERT ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_GRFFILTER_SMOOTH ;
+ HelpID = HID_GRFFILTER_SMOOTH ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_GRFFILTER_SHARPEN ;
+ HelpID = HID_GRFFILTER_SHARPEN ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_GRFFILTER_REMOVENOISE ;
+ HelpID = HID_GRFFILTER_REMOVENOISE ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_BREAK ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_GRFFILTER_SOLARIZE ;
+ HelpId = HID_GRFFILTER_SOLARIZE ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_GRFFILTER_SEPIA ;
+ HelpId = HID_GRFFILTER_SEPIA ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_GRFFILTER_POSTER ;
+ HelpId = HID_GRFFILTER_POSTER ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_GRFFILTER_POPART ;
+ HelpId = HID_GRFFILTER_POPART ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_BREAK ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_GRFFILTER_SOBEL ;
+ HelpId = HID_GRFFILTER_SOBEL ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_GRFFILTER_EMBOSS ;
+ HelpId = HID_GRFFILTER_EMBOSS ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_GRFFILTER_MOSAIC ;
+ HelpId = HID_GRFFILTER_MOSAIC ;
+ };
+ };
+ };
+};
+
+// -----------
+// - Strings -
+// -----------
+
+String RID_SVXSTR_UNDO_GRAFMODE
+{
+ Text [ en-US ] = "Graphics Mode";
+};
+String RID_SVXSTR_UNDO_GRAFRED
+{
+ Text [ en-US ] = "Red";
+};
+String RID_SVXSTR_UNDO_GRAFGREEN
+{
+ Text [ en-US ] = "Green";
+};
+String RID_SVXSTR_UNDO_GRAFBLUE
+{
+ Text [ en-US ] = "Blue";
+};
+String RID_SVXSTR_UNDO_GRAFLUMINANCE
+{
+ Text [ en-US ] = "Brightness";
+};
+String RID_SVXSTR_UNDO_GRAFCONTRAST
+{
+ Text [ en-US ] = "Contrast";
+};
+String RID_SVXSTR_UNDO_GRAFGAMMA
+{
+ Text [ en-US ] = "Gamma";
+};
+String RID_SVXSTR_UNDO_GRAFTRANSPARENCY
+{
+ Text [ en-US ] = "Transparency";
+};
+String RID_SVXSTR_GRAFCROP
+{
+ Text [ en-US ] = "Crop";
+};
+
+// ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx
new file mode 100644
index 000000000000..76fd7d423324
--- /dev/null
+++ b/svx/source/tbxctrls/itemwin.cxx
@@ -0,0 +1,825 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/module.hxx>
+#include <tools/urlobj.hxx>
+
+#define _SVX_ITEMWIN_CXX
+
+#include <vcl/svapp.hxx>
+
+#include <svx/dialogs.hrc>
+
+#define DELAY_TIMEOUT 100
+
+#include <svx/xlnclit.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/xlndsit.hxx>
+#include <svx/xtable.hxx>
+#include "svx/drawitem.hxx"
+#include <svx/dialmgr.hxx>
+#include "svx/dlgutil.hxx"
+#include <svx/itemwin.hxx>
+#include "svx/linectrl.hxx"
+#include <svtools/colorcfg.hxx>
+
+#include "linectrl.hrc"
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+
+#define LOGICAL_EDIT_HEIGHT 12
+//========================================================================
+// SvxLineBox
+//========================================================================
+
+SvxLineBox::SvxLineBox( Window* pParent, const Reference< XFrame >& rFrame, WinBits nBits ) :
+ LineLB( pParent, nBits ),
+ meBmpMode ( GetSettings().GetStyleSettings().GetHighContrastMode() ? BMP_COLOR_HIGHCONTRAST : BMP_COLOR_NORMAL ),
+ nCurPos ( 0 ),
+ aLogicalSize(40,140),
+ bRelease ( sal_True ),
+ mpSh ( NULL ),
+ mxFrame ( rFrame )
+{
+ SetSizePixel( LogicToPixel( aLogicalSize, MAP_APPFONT ));
+ Show();
+
+ aDelayTimer.SetTimeout( DELAY_TIMEOUT );
+ aDelayTimer.SetTimeoutHdl( LINK( this, SvxLineBox, DelayHdl_Impl ) );
+ aDelayTimer.Start();
+}
+
+// -----------------------------------------------------------------------
+
+SvxLineBox::~SvxLineBox()
+{
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxLineBox, DelayHdl_Impl, Timer *, EMPTYARG )
+{
+ if ( GetEntryCount() == 0 )
+ {
+ mpSh = SfxObjectShell::Current();
+ FillControl();
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxLineBox::Select()
+{
+ // Call the parent's Select() member to trigger accessibility events.
+ LineLB::Select();
+
+ if ( !IsTravelSelect() )
+ {
+ XLineStyle eXLS;
+ sal_uInt16 nPos = GetSelectEntryPos();
+// SfxDispatcher* pDisp = rBindings.GetDispatcher();
+ //DBG_ASSERT( pDisp, "invalid Dispatcher" );
+
+ switch ( nPos )
+ {
+ case 0:
+ eXLS = XLINE_NONE;
+ break;
+
+ case 1:
+ eXLS = XLINE_SOLID;
+ break;
+
+ default:
+ {
+ eXLS = XLINE_DASH;
+
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND &&
+ SfxObjectShell::Current() &&
+ SfxObjectShell::Current()->GetItem( SID_DASH_LIST ) )
+ {
+ // LineDashItem wird nur geschickt, wenn es auch einen Dash besitzt.
+ // Notify k"ummert sich darum!
+ SvxDashListItem aItem( *(const SvxDashListItem*)(
+ SfxObjectShell::Current()->GetItem( SID_DASH_LIST ) ) );
+ XLineDashItem aLineDashItem( GetSelectEntry(),
+ aItem.GetDashList()->GetDash( nPos - 2 )->GetDash() );
+
+ Any a;
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LineDash" ));
+ aLineDashItem.QueryValue ( a );
+ aArgs[0].Value = a;
+ SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:LineDash" )),
+ aArgs );
+// pDisp->Execute( SID_ATTR_LINE_DASH, SFX_CALLMODE_RECORD, &aLineDashItem, 0L );
+ }
+ }
+ break;
+ }
+
+ XLineStyleItem aLineStyleItem( eXLS );
+ Any a;
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XLineStyle" ));
+ aLineStyleItem.QueryValue ( a );
+ aArgs[0].Value = a;
+ SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:XLineStyle" )),
+ aArgs );
+// pDisp->Execute( SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aLineStyleItem, 0L );
+
+ nCurPos = GetSelectEntryPos();
+ ReleaseFocus_Impl();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+long SvxLineBox::PreNotify( NotifyEvent& rNEvt )
+{
+ sal_uInt16 nType = rNEvt.GetType();
+
+ switch(nType)
+ {
+ case EVENT_MOUSEBUTTONDOWN:
+ case EVENT_GETFOCUS:
+ nCurPos = GetSelectEntryPos();
+ break;
+ case EVENT_LOSEFOCUS:
+ SelectEntryPos(nCurPos);
+ break;
+ case EVENT_KEYINPUT:
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ if( pKEvt->GetKeyCode().GetCode() == KEY_TAB)
+ {
+ bRelease = sal_False;
+ Select();
+ }
+ }
+ break;
+ }
+ return LineLB::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+long SvxLineBox::Notify( NotifyEvent& rNEvt )
+{
+ long nHandled = LineLB::Notify( rNEvt );
+
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+
+ switch ( pKEvt->GetKeyCode().GetCode() )
+ {
+ case KEY_RETURN:
+ Select();
+ nHandled = 1;
+ break;
+
+ case KEY_ESCAPE:
+ SelectEntryPos( nCurPos );
+ ReleaseFocus_Impl();
+ nHandled = 1;
+ break;
+ }
+ }
+ return nHandled;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxLineBox::ReleaseFocus_Impl()
+{
+ if(!bRelease)
+ {
+ bRelease = sal_True;
+ return;
+ }
+
+ if( SfxViewShell::Current() )
+ {
+ Window* pShellWnd = SfxViewShell::Current()->GetWindow();
+
+ if ( pShellWnd )
+ pShellWnd->GrabFocus();
+ }
+}
+/* -----------------------------08.03.2002 15:39------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxLineBox::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ SetSizePixel(LogicToPixel(aLogicalSize, MAP_APPFONT));
+ Size aDropSize( aLogicalSize.Width(), LOGICAL_EDIT_HEIGHT);
+ SetDropDownSizePixel(LogicToPixel(aDropSize, MAP_APPFONT));
+ }
+
+ LineLB::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ BmpColorMode eMode = GetSettings().GetStyleSettings().GetHighContrastMode() ? BMP_COLOR_HIGHCONTRAST : BMP_COLOR_NORMAL;
+ if( eMode != meBmpMode )
+ {
+ meBmpMode = eMode;
+ FillControl();
+ }
+ }
+}
+
+void SvxLineBox::FillControl()
+{
+ FillStyles();
+ if ( !mpSh )
+ mpSh = SfxObjectShell::Current();
+
+ if( mpSh )
+ {
+ const SvxDashListItem* pItem = (const SvxDashListItem*)( mpSh->GetItem( SID_DASH_LIST ) );
+ if ( pItem )
+ Fill( pItem->GetDashList() );
+ }
+
+
+// rBindings.Invalidate( SID_ATTR_LINE_DASH );
+}
+//========================================================================
+// SvxColorBox
+//========================================================================
+
+SvxColorBox::SvxColorBox(
+ Window* pParent,
+ const ::rtl::OUString& rCommand,
+ const Reference< XFrame >& rFrame,
+ WinBits nBits ) :
+ ColorLB( pParent, nBits ),
+ nCurPos ( 0 ),
+ aLogicalSize(45,80),
+ bRelease ( sal_True ),
+ maCommand ( rCommand ),
+ mxFrame ( rFrame )
+{
+ SetSizePixel( LogicToPixel( aLogicalSize , MAP_APPFONT));
+ Show();
+
+ SfxObjectShell* pSh = SfxObjectShell::Current();
+
+ if ( pSh )
+ {
+ const SvxColorTableItem* pItem =
+ (const SvxColorTableItem*)( pSh->GetItem( SID_COLOR_TABLE ) );
+ if(pItem)
+ Fill( pItem->GetColorTable() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxColorBox, DelayHdl_Impl, Timer *, EMPTYARG )
+{
+ SfxObjectShell* pSh = SfxObjectShell::Current();
+
+ if ( pSh )
+ {
+ const SvxColorTableItem* pItem = (const SvxColorTableItem*)( pSh->GetItem( SID_COLOR_TABLE ) );
+ if ( pItem )
+ Fill( pItem->GetColorTable() );
+// rBindings.Invalidate( nId );
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+SvxColorBox::~SvxColorBox()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SvxColorBox::Update( const XLineColorItem* pItem )
+{
+ if ( pItem )
+ SelectEntry( pItem->GetColorValue() );
+ else
+ SetNoSelection();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxColorBox::Select()
+{
+ // OJ: base class call needed here because otherwise no event is send for accessibility
+ ColorLB::Select();
+ if ( !IsTravelSelect() )
+ {
+ XLineColorItem aLineColorItem( GetSelectEntry(), GetSelectEntryColor() );
+
+ INetURLObject aObj( maCommand );
+
+ Any a;
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = aObj.GetURLPath();
+ aLineColorItem.QueryValue( a );
+ aArgs[0].Value = a;
+ SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ),
+ maCommand,
+ aArgs );
+// rBindings.GetDispatcher()->Execute( nId, SFX_CALLMODE_RECORD, &aLineColorItem, 0L );
+
+ nCurPos = GetSelectEntryPos();
+ ReleaseFocus_Impl();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+long SvxColorBox::PreNotify( NotifyEvent& rNEvt )
+{
+ sal_uInt16 nType = rNEvt.GetType();
+
+ switch(nType)
+ {
+ case EVENT_MOUSEBUTTONDOWN:
+ case EVENT_GETFOCUS:
+ nCurPos = GetSelectEntryPos();
+ break;
+ case EVENT_LOSEFOCUS:
+ SelectEntryPos(nCurPos);
+ break;
+ case EVENT_KEYINPUT:
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+
+ if( pKEvt->GetKeyCode().GetCode() == KEY_TAB)
+ {
+ bRelease = sal_False;
+ Select();
+ }
+ }
+ }
+
+ return ColorLB::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+long SvxColorBox::Notify( NotifyEvent& rNEvt )
+{
+ long nHandled = ColorLB::Notify( rNEvt );
+
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+
+ switch ( pKEvt->GetKeyCode().GetCode() )
+ {
+ case KEY_RETURN:
+ Select();
+ nHandled = 1;
+ break;
+
+ case KEY_ESCAPE:
+ SelectEntryPos( nCurPos );
+ ReleaseFocus_Impl();
+ nHandled = 1;
+ break;
+ }
+ }
+ return nHandled;
+}
+/* -----------------------------08.03.2002 15:35------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxColorBox::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ SetSizePixel(LogicToPixel(aLogicalSize, MAP_APPFONT));
+ Size aDropSize( aLogicalSize.Width(), LOGICAL_EDIT_HEIGHT);
+ SetDropDownSizePixel(LogicToPixel(aDropSize, MAP_APPFONT));
+ }
+
+ ColorLB::DataChanged( rDCEvt );
+}
+// -----------------------------------------------------------------------
+
+void SvxColorBox::ReleaseFocus_Impl()
+{
+ if(!bRelease)
+ {
+ bRelease = sal_True;
+ return;
+ }
+
+ if( SfxViewShell::Current() )
+ {
+ Window* pShellWnd = SfxViewShell::Current()->GetWindow();
+
+ if ( pShellWnd )
+ pShellWnd->GrabFocus();
+ }
+}
+
+//========================================================================
+// SvxMetricField
+//========================================================================
+
+SvxMetricField::SvxMetricField(
+ Window* pParent, const Reference< XFrame >& rFrame, WinBits nBits ) :
+ MetricField( pParent, nBits ),
+ aCurTxt( String() ),
+ mxFrame( rFrame )
+{
+ Size aSize = Size(GetTextWidth( String::CreateFromAscii("99,99mm") ),GetTextHeight());
+ aSize.Width() += 20;
+ aSize.Height() += 6;
+ SetSizePixel( aSize );
+ aLogicalSize = PixelToLogic(aSize, MAP_APPFONT);
+ SetUnit( FUNIT_MM );
+ SetDecimalDigits( 2 );
+ SetMax( 5000 );
+ SetMin( 0 );
+ SetLast( 5000 );
+ SetFirst( 0 );
+
+ eDlgUnit = SfxModule::GetCurrentFieldUnit();
+ SetFieldUnit( *this, eDlgUnit, sal_False );
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+SvxMetricField::~SvxMetricField()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SvxMetricField::Update( const XLineWidthItem* pItem )
+{
+ if ( pItem )
+ {
+ if ( pItem->GetValue() != GetCoreValue( *this, ePoolUnit ) )
+ SetMetricValue( *this, pItem->GetValue(), ePoolUnit );
+ }
+ else
+ SetText( String() );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxMetricField::Modify()
+{
+ MetricField::Modify();
+ long nTmp = GetCoreValue( *this, ePoolUnit );
+ XLineWidthItem aLineWidthItem( nTmp );
+
+ Any a;
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LineWidth" ));
+ aLineWidthItem.QueryValue( a );
+ aArgs[0].Value = a;
+ SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:LineWidth" )),
+ aArgs );
+// rBindings.GetDispatcher()->Execute( SID_ATTR_LINE_WIDTH, SFX_CALLMODE_RECORD, &aLineWidthItem, 0L );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxMetricField::ReleaseFocus_Impl()
+{
+ if( SfxViewShell::Current() )
+ {
+ Window* pShellWnd = SfxViewShell::Current()->GetWindow();
+ if ( pShellWnd )
+ pShellWnd->GrabFocus();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxMetricField::Down()
+{
+ sal_Int64 nValue = GetValue();
+ nValue -= GetSpinSize();
+
+ // Um unter OS/2 einen Sprung auf Max zu verhindern
+ if ( nValue >= GetMin() )
+ MetricField::Down();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxMetricField::Up()
+{
+ MetricField::Up();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxMetricField::SetCoreUnit( SfxMapUnit eUnit )
+{
+ ePoolUnit = eUnit;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxMetricField::RefreshDlgUnit()
+{
+ FieldUnit eTmpUnit = SfxModule::GetCurrentFieldUnit();
+ if ( eDlgUnit != eTmpUnit )
+ {
+ eDlgUnit = eTmpUnit;
+ SetFieldUnit( *this, eDlgUnit, sal_False );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+long SvxMetricField::PreNotify( NotifyEvent& rNEvt )
+{
+ sal_uInt16 nType = rNEvt.GetType();
+
+ if ( EVENT_MOUSEBUTTONDOWN == nType || EVENT_GETFOCUS == nType )
+ aCurTxt = GetText();
+
+ return MetricField::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+long SvxMetricField::Notify( NotifyEvent& rNEvt )
+{
+ long nHandled = MetricField::Notify( rNEvt );
+
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ const KeyCode& rKey = pKEvt->GetKeyCode();
+ SfxViewShell* pSh = SfxViewShell::Current();
+
+ if ( rKey.GetModifier() && rKey.GetGroup() != KEYGROUP_CURSOR && pSh )
+ pSh->KeyInput( *pKEvt );
+ else
+ {
+ bool bHandled = sal_False;
+
+ switch ( rKey.GetCode() )
+ {
+ case KEY_RETURN:
+ Reformat();
+ bHandled = sal_True;
+ break;
+
+ case KEY_ESCAPE:
+ SetText( aCurTxt );
+ bHandled = sal_True;
+ break;
+ }
+
+ if ( bHandled )
+ {
+ nHandled = 1;
+ Modify();
+ ReleaseFocus_Impl();
+ }
+ }
+ }
+ return nHandled;
+}
+/* -----------------------------08.03.2002 15:32------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxMetricField::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ SetSizePixel(LogicToPixel(aLogicalSize, MAP_APPFONT));
+ }
+
+ MetricField::DataChanged( rDCEvt );
+}
+
+//========================================================================
+// SvxFillTypeBox
+//========================================================================
+
+SvxFillTypeBox::SvxFillTypeBox( Window* pParent, WinBits nBits ) :
+ FillTypeLB( pParent, nBits | WB_TABSTOP ),
+ nCurPos ( 0 ),
+ bSelect ( sal_False ),
+ bRelease(sal_True)
+{
+ SetSizePixel( LogicToPixel( Size(40, 40 ),MAP_APPFONT ));
+ Fill();
+ SelectEntryPos( XFILL_SOLID );
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+SvxFillTypeBox::~SvxFillTypeBox()
+{
+}
+
+// -----------------------------------------------------------------------
+
+long SvxFillTypeBox::PreNotify( NotifyEvent& rNEvt )
+{
+ sal_uInt16 nType = rNEvt.GetType();
+
+ if ( EVENT_MOUSEBUTTONDOWN == nType || EVENT_GETFOCUS == nType )
+ nCurPos = GetSelectEntryPos();
+ else if ( EVENT_LOSEFOCUS == nType
+ && Application::GetFocusWindow()
+ && !IsWindowOrChild( Application::GetFocusWindow(), sal_True ) )
+ {
+ if ( !bSelect )
+ SelectEntryPos( nCurPos );
+ else
+ bSelect = sal_False;
+ }
+
+ return FillTypeLB::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+long SvxFillTypeBox::Notify( NotifyEvent& rNEvt )
+{
+ long nHandled = FillTypeLB::Notify( rNEvt );
+
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ switch ( pKEvt->GetKeyCode().GetCode() )
+ {
+ case KEY_RETURN:
+ nHandled = 1;
+ ( (Link&)GetSelectHdl() ).Call( this );
+ break;
+ case KEY_TAB:
+ bRelease = sal_False;
+ ( (Link&)GetSelectHdl() ).Call( this );
+ bRelease = sal_True;
+ break;
+
+ case KEY_ESCAPE:
+ SelectEntryPos( nCurPos );
+ ReleaseFocus_Impl();
+ nHandled = 1;
+ break;
+ }
+ }
+ return nHandled;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFillTypeBox::ReleaseFocus_Impl()
+{
+ if( SfxViewShell::Current() )
+ {
+ Window* pShellWnd = SfxViewShell::Current()->GetWindow();
+
+ if ( pShellWnd )
+ pShellWnd->GrabFocus();
+ }
+}
+
+//========================================================================
+// SvxFillAttrBox
+//========================================================================
+
+SvxFillAttrBox::SvxFillAttrBox( Window* pParent, WinBits nBits ) :
+
+ FillAttrLB( pParent, nBits | WB_TABSTOP ),
+
+ nCurPos( 0 ),
+ bRelease( sal_True )
+
+{
+ SetPosPixel( Point( 90, 0 ) );
+ SetSizePixel( LogicToPixel( Size(50, 80 ), MAP_APPFONT ));
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+SvxFillAttrBox::~SvxFillAttrBox()
+{
+}
+
+// -----------------------------------------------------------------------
+
+long SvxFillAttrBox::PreNotify( NotifyEvent& rNEvt )
+{
+ sal_uInt16 nType = rNEvt.GetType();
+
+ if ( EVENT_MOUSEBUTTONDOWN == nType || EVENT_GETFOCUS == nType )
+ nCurPos = GetSelectEntryPos();
+
+ return FillAttrLB::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+long SvxFillAttrBox::Notify( NotifyEvent& rNEvt )
+{
+ long nHandled = FillAttrLB::Notify( rNEvt );
+
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+
+ switch ( pKEvt->GetKeyCode().GetCode() )
+ {
+ case KEY_RETURN:
+ ( (Link&)GetSelectHdl() ).Call( this );
+ nHandled = 1;
+ break;
+ case KEY_TAB:
+ bRelease = sal_False;
+ GetSelectHdl().Call( this );
+ bRelease = sal_True;
+ break;
+ case KEY_ESCAPE:
+ SelectEntryPos( nCurPos );
+ ReleaseFocus_Impl();
+ nHandled = 1;
+ break;
+ }
+ }
+ return nHandled;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFillAttrBox::Select()
+{
+ FillAttrLB::Select();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFillAttrBox::ReleaseFocus_Impl()
+{
+ if( SfxViewShell::Current() )
+ {
+ Window* pShellWnd = SfxViewShell::Current()->GetWindow();
+
+ if ( pShellWnd )
+ pShellWnd->GrabFocus();
+ }
+}
diff --git a/svx/source/tbxctrls/layctrl.cxx b/svx/source/tbxctrls/layctrl.cxx
new file mode 100644
index 000000000000..ff03e87a0997
--- /dev/null
+++ b/svx/source/tbxctrls/layctrl.cxx
@@ -0,0 +1,899 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <string> // HACK: prevent conflict between STLPORT and Workshop headers
+#include <vcl/toolbox.hxx>
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <svl/intitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/app.hxx>
+
+#include <svx/dialogs.hrc>
+#include "svx/layctrl.hxx"
+#include <svx/dialmgr.hxx>
+#include <comphelper/processfactory.hxx>
+#include <svtools/colorcfg.hxx>
+
+// namespaces
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::frame;
+
+SFX_IMPL_TOOLBOX_CONTROL(SvxTableToolBoxControl,SfxUInt16Item);
+SFX_IMPL_TOOLBOX_CONTROL(SvxColumnsToolBoxControl,SfxUInt16Item);
+
+// class TableWindow -----------------------------------------------------
+
+class TableWindow : public SfxPopupWindow
+{
+private:
+ ::Color aLineColor;
+ ::Color aHighlightLineColor;
+ ::Color aFillColor;
+ ::Color aHighlightFillColor;
+ long nCol;
+ long nLine;
+ long nWidth;
+ long nHeight;
+ long nMX;
+ long nMY;
+ long nTextHeight;
+ sal_Bool bInitialKeyInput;
+ sal_Bool m_bMod1;
+ ToolBox& rTbx;
+ Reference< XFrame > mxFrame;
+ rtl::OUString maCommand;
+
+ void UpdateSize_Impl( long nNewCol, long nNewLine);
+
+public:
+ TableWindow( sal_uInt16 nSlotId,
+ const rtl::OUString& rCmd,
+ ToolBox& rParentTbx,
+ const Reference< XFrame >& rFrame );
+ ~TableWindow();
+
+ void KeyInput( const KeyEvent& rKEvt );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void Paint( const Rectangle& );
+ virtual void PopupModeEnd();
+ virtual SfxPopupWindow* Clone() const;
+
+ sal_uInt16 GetColCount() const { return (sal_uInt16)nCol; }
+ sal_uInt16 GetLineCount() const { return (sal_uInt16)nLine; }
+};
+
+// -----------------------------------------------------------------------
+
+TableWindow::TableWindow( sal_uInt16 nSlotId, const rtl::OUString& rCmd, ToolBox& rParentTbx, const Reference< XFrame >& rFrame ) :
+ SfxPopupWindow( nSlotId, rFrame, WB_SYSTEMWINDOW ),
+ bInitialKeyInput(sal_True),
+ m_bMod1(sal_False),
+ rTbx(rParentTbx),
+ mxFrame( rFrame ),
+ maCommand( rCmd )
+{
+ const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
+ svtools::ColorConfig aColorConfig;
+ aLineColor = ::Color( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
+ aHighlightLineColor = rStyles.GetHighlightTextColor();
+ aFillColor = rStyles.GetWindowColor();
+ aHighlightFillColor = rStyles.GetHighlightColor();
+
+ nTextHeight = GetTextHeight()+1;
+ SetBackground();
+ Font aFont = GetFont();
+ aFont.SetColor( aLineColor );
+ aFont.SetFillColor( aFillColor );
+ aFont.SetTransparent( sal_False );
+ SetFont( aFont );
+
+ nCol = 0;
+ nLine = 0;
+ nWidth = 5;
+ nHeight = 5;
+
+ Size aLogicSize = LogicToPixel( Size( 55, 35 ), MapMode( MAP_10TH_MM ) );
+ nMX = aLogicSize.Width();
+ nMY = aLogicSize.Height();
+ SetOutputSizePixel( Size( nMX*nWidth-1, nMY*nHeight-1+nTextHeight ) );
+}
+// -----------------------------------------------------------------------
+TableWindow::~TableWindow()
+{
+}
+// -----------------------------------------------------------------------
+
+SfxPopupWindow* TableWindow::Clone() const
+{
+ return new TableWindow( GetId(), maCommand, rTbx, mxFrame );
+}
+
+// -----------------------------------------------------------------------
+
+void TableWindow::MouseMove( const MouseEvent& rMEvt )
+{
+ SfxPopupWindow::MouseMove( rMEvt );
+ Point aPos = rMEvt.GetPosPixel();
+ Point aMousePos( aPos );
+
+ if ( rMEvt.IsEnterWindow() )
+ CaptureMouse();
+ else if ( aMousePos.X() < 0 || aMousePos.Y() < 0 )
+ {
+ nCol = 0;
+ nLine = 0;
+ ReleaseMouse();
+ Invalidate();
+ return;
+ }
+
+ long nNewCol = 0;
+ long nNewLine = 0;
+
+ if ( aPos.X() > 0 )
+ nNewCol = aPos.X() / nMX + 1;
+ if ( aPos.Y() > 0 )
+ nNewLine = aPos.Y() / nMY + 1;
+
+ if ( nNewCol > 500 )
+ nNewCol = 500;
+ if ( nNewLine > 1000 )
+ nNewLine = 1000;
+
+ UpdateSize_Impl( nNewCol, nNewLine);
+
+}
+/* -----------------------------15.05.2002 17:14------------------------------
+
+ ---------------------------------------------------------------------------*/
+void TableWindow::UpdateSize_Impl( long nNewCol, long nNewLine)
+{
+ Size aWinSize = GetOutputSizePixel();
+ Point aWinPos = GetPosPixel();
+ Point aMaxPos = OutputToScreenPixel( GetDesktopRectPixel().BottomRight() );
+ if ( (nWidth <= nNewCol) || (nHeight < nNewLine) )
+ {
+ long nOff = 0;
+
+ if ( nWidth <= nNewCol )
+ {
+ nWidth = nNewCol;
+ nWidth++;
+ }
+ if ( nHeight <= nNewLine )
+ {
+ nHeight = nNewLine;
+ nOff = 1;
+ }
+ while ( nWidth > 0 &&
+ (short)(aWinPos.X()+(nMX*nWidth-1)) >= aMaxPos.X()-3 )
+ nWidth--;
+
+ while ( nHeight > 0 &&
+ (short)(aWinPos.Y()+(nMY*nHeight-1+nTextHeight)) >=
+ aMaxPos.Y()-3 )
+ nHeight--;
+
+ if ( nNewCol > nWidth )
+ nNewCol = nWidth;
+
+ if ( nNewLine > nHeight )
+ nNewLine = nHeight;
+
+ Size _aWinSize = GetOutputSizePixel();
+ Invalidate( Rectangle( 0, _aWinSize.Height()-nTextHeight+2-nOff,
+ _aWinSize.Width(), _aWinSize.Height() ) );
+ SetOutputSizePixel( Size( nMX*nWidth-1, nMY*nHeight-1+nTextHeight ) );
+ }
+ long nMinCol = 0;
+ long nMaxCol = 0;
+ long nMinLine = 0;
+ long nMaxLine = 0;
+ if ( nNewCol < nCol )
+ {
+ nMinCol = nNewCol;
+ nMaxCol = nCol;
+ }
+ else
+ {
+ nMinCol = nCol;
+ nMaxCol = nNewCol;
+ }
+ if ( nNewLine < nLine )
+ {
+ nMinLine = nNewLine;
+ nMaxLine = nLine;
+ }
+ else
+ {
+ nMinLine = nLine;
+ nMaxLine = nNewLine;
+ }
+
+ if ( (nNewCol != nCol) || (nNewLine != nLine) )
+ {
+ Invalidate( Rectangle( 0, aWinSize.Height()-nTextHeight+2,
+ aWinSize.Width(), aWinSize.Height() ) );
+
+ if ( nNewCol != nCol )
+ {
+ Invalidate( Rectangle( nMinCol*nMX-1, 0, nMaxCol*nMX+1, nMaxLine*nMY ) );
+ nCol = nNewCol;
+ }
+ if ( nNewLine != nLine )
+ {
+ Invalidate( Rectangle( 0, nMinLine*nMY-2, nMaxCol*nMX, nMaxLine*nMY+1 ) );
+ nLine = nNewLine;
+ }
+ }
+ Update();
+}
+/* -----------------------------15.05.2002 14:22------------------------------
+
+ ---------------------------------------------------------------------------*/
+void TableWindow::KeyInput( const KeyEvent& rKEvt )
+{
+ sal_Bool bHandled = sal_False;
+ sal_uInt16 nModifier = rKEvt.GetKeyCode().GetModifier();
+ sal_uInt16 nKey = rKEvt.GetKeyCode().GetCode();
+ if(!nModifier)
+ {
+ if( KEY_UP == nKey || KEY_DOWN == nKey ||
+ KEY_LEFT == nKey || KEY_RIGHT == nKey ||
+ KEY_ESCAPE == nKey ||KEY_RETURN == nKey )
+ {
+ bHandled = sal_True;
+ long nNewCol = nCol;
+ long nNewLine = nLine;
+ switch(nKey)
+ {
+ case KEY_UP :
+ if(nNewLine > 1)
+ {
+ nNewLine--;
+ break;
+ }
+ //no break;
+ case KEY_ESCAPE:
+ EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL);
+ break;
+ case KEY_DOWN :
+ nNewLine++;
+ break;
+ case KEY_LEFT :
+
+ if(nNewCol)
+ nNewCol--;
+ break;
+ case KEY_RIGHT :
+ nNewCol++;
+ break;
+ case KEY_RETURN :
+ if(IsMouseCaptured())
+ ReleaseMouse();
+ EndPopupMode(FLOATWIN_POPUPMODEEND_CLOSEALL );
+ break;
+ }
+ //make sure that a table can initially be created
+ if(bInitialKeyInput)
+ {
+ bInitialKeyInput = sal_False;
+ if(!nNewLine)
+ nNewLine = 1;
+ if(!nNewCol)
+ nNewCol = 1;
+ }
+ UpdateSize_Impl( nNewCol, nNewLine);
+ }
+ }
+ else if(KEY_MOD1 == nModifier && KEY_RETURN == nKey)
+ {
+ m_bMod1 = sal_True;
+ if(IsMouseCaptured())
+ ReleaseMouse();
+ EndPopupMode(FLOATWIN_POPUPMODEEND_CLOSEALL );
+ }
+
+ if(!bHandled)
+ SfxPopupWindow::KeyInput(rKEvt);
+
+}
+// -----------------------------------------------------------------------
+
+void TableWindow::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ SfxPopupWindow::MouseButtonDown( rMEvt );
+ CaptureMouse();
+}
+
+// -----------------------------------------------------------------------
+
+void TableWindow::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ SfxPopupWindow::MouseButtonUp( rMEvt );
+ ReleaseMouse();
+
+ if ( IsInPopupMode() )
+ EndPopupMode( FLOATWIN_POPUPMODEEND_CLOSEALL );
+}
+
+// -----------------------------------------------------------------------
+
+void TableWindow::Paint( const Rectangle& )
+{
+ long i;
+ long nStart;
+ Size aSize = GetOutputSizePixel();
+
+ SetLineColor();
+ SetFillColor( aHighlightFillColor );
+ DrawRect( Rectangle( 0, 0, nCol*nMX-1, nLine*nMY-1 ) );
+ SetFillColor( aFillColor );
+ DrawRect( Rectangle( nCol*nMX-1, 0,
+ aSize.Width(), aSize.Height()-nTextHeight+1 ) );
+ DrawRect( Rectangle( 0, nLine*nMY-1,
+ aSize.Width(), aSize.Height()-nTextHeight+1 ) );
+
+ SetLineColor( aHighlightLineColor );
+ for ( i = 1; i < nCol; i++ )
+ DrawLine( Point( i*nMX-1, 0 ), Point( i*nMX-1, nLine*nMY-1 ) );
+ for ( i = 1; i < nLine; i++ )
+ DrawLine( Point( 0, i*nMY-1 ), Point( nCol*nMX-1, i*nMY-1 ) );
+ SetLineColor( aLineColor );
+ for ( i = 1; i <= nWidth; i++ )
+ {
+ if ( i < nCol )
+ nStart = nLine*nMY-1;
+ else
+ nStart = 0;
+ DrawLine( Point( i*nMX-1, nStart ), Point( i*nMX-1, nHeight*nMY-1 ) );
+ }
+ for ( i = 1; i <= nHeight; i++ )
+ {
+ if ( i < nLine )
+ nStart = nCol*nMX-1;
+ else
+ nStart = 0;
+ DrawLine( Point( nStart, i*nMY-1 ), Point( nWidth*nMX-1, i*nMY-1 ) );
+ }
+
+ SetLineColor();
+ String aText;
+ if ( nCol && nLine )
+ {
+ aText += String::CreateFromInt32( nCol );
+ aText.AppendAscii( " x " );
+ aText += String::CreateFromInt32( nLine );
+ if(GetId() == FN_SHOW_MULTIPLE_PAGES)
+ {
+ aText += ' ';
+ aText += String(SVX_RESSTR(RID_SVXSTR_PAGES));
+ }
+
+ }
+ else
+ aText = Button::GetStandardText( BUTTON_CANCEL );
+ Size aTextSize( GetTextWidth( aText ), GetTextHeight() );
+
+ Rectangle aClearRect( 0, aSize.Height()-nTextHeight+2, (aSize.Width()), aSize.Height() );
+ DrawRect( aClearRect );
+
+ // #i95350# force RTL output
+ if( IsRTLEnabled() && nCol && nLine )
+ aText.Insert(0x202D, 0);
+ DrawText( Point( (aSize.Width() - aTextSize.Width()) / 2, aSize.Height() - nTextHeight + 2 ), aText );
+
+ SetLineColor( aLineColor );
+ SetFillColor();
+ DrawRect( Rectangle( Point(0,0), aSize ) );
+}
+
+// -----------------------------------------------------------------------
+
+void TableWindow::PopupModeEnd()
+{
+ if ( !IsPopupModeCanceled() && nCol && nLine )
+ {
+ Window* pParent = rTbx.GetParent();
+ sal_uInt16 nId = GetId();
+ pParent->UserEvent(SVX_EVENT_COLUM_WINDOW_EXECUTE, reinterpret_cast<void*>(nId));
+
+ Reference< XDispatchProvider > xDispatchProvider( mxFrame, UNO_QUERY );
+ if ( xDispatchProvider.is() )
+ {
+ com::sun::star::util::URL aTargetURL;
+ Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance(
+ rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )),
+ UNO_QUERY );
+ aTargetURL.Complete = maCommand;
+ xTrans->parseStrict( aTargetURL );
+ Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch( aTargetURL, rtl::OUString(), 0 );
+ if ( xDispatch.is() )
+ {
+ Sequence< PropertyValue > aArgs( 2 );
+ aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Columns" ));
+ aArgs[0].Value = makeAny( sal_Int16( nCol ));
+ aArgs[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Rows" ));
+ aArgs[1].Value = makeAny( sal_Int16( nLine ));
+
+ xDispatch->dispatch( aTargetURL, aArgs );
+ }
+ }
+ }
+ else if ( IsPopupModeCanceled() )
+ ReleaseMouse();
+ SfxPopupWindow::PopupModeEnd();
+}
+
+// class ColumnsWindow ---------------------------------------------------
+
+class ColumnsWindow : public SfxPopupWindow
+{
+private:
+ ::Color aLineColor;
+ ::Color aHighlightLineColor;
+ ::Color aFillColor;
+ ::Color aHighlightFillColor;
+ long nCol;
+ long nWidth;
+ long nMX;
+ long nTextHeight;
+ sal_Bool bInitialKeyInput;
+ sal_Bool m_bMod1;
+ ToolBox& rTbx;
+ Reference< XFrame > mxFrame;
+ ::rtl::OUString maCommand;
+
+ void UpdateSize_Impl( long nNewCol );
+public:
+ ColumnsWindow( sal_uInt16 nId, const ::rtl::OUString& rCmd, ToolBox& rParentTbx, const Reference< XFrame >& rFrame );
+
+ void KeyInput( const KeyEvent& rKEvt );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void Paint( const Rectangle& );
+ virtual void PopupModeEnd();
+ virtual SfxPopupWindow* Clone() const;
+
+ sal_uInt16 GetColCount() const { return (sal_uInt16)nCol; }
+};
+
+// -----------------------------------------------------------------------
+
+ColumnsWindow::ColumnsWindow( sal_uInt16 nId, const ::rtl::OUString& rCmd, ToolBox& rParentTbx, const Reference< XFrame >& rFrame ) :
+ SfxPopupWindow( nId, rFrame, WB_SYSTEMWINDOW ),
+ bInitialKeyInput(sal_True),
+ m_bMod1(sal_False),
+ rTbx(rParentTbx),
+ mxFrame(rFrame),
+ maCommand( rCmd )
+{
+ const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
+ svtools::ColorConfig aColorConfig;
+ aLineColor = ::Color( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
+ aHighlightLineColor = rStyles.GetHighlightTextColor();
+ aFillColor = rStyles.GetWindowColor();
+ aHighlightFillColor = rStyles.GetHighlightColor();
+
+ nTextHeight = GetTextHeight()+1;
+ SetBackground();
+ Font aFont( GetFont() );
+ aFont.SetColor( aLineColor );
+ aFont.SetFillColor( aFillColor );
+ aFont.SetTransparent( sal_False );
+ SetFont( aFont );
+
+ nCol = 0;
+ nWidth = 4;
+
+ Size aLogicSize = LogicToPixel( Size( 95, 155 ), MapMode( MAP_10TH_MM ) );
+ nMX = aLogicSize.Width();
+ SetOutputSizePixel( Size( nMX*nWidth-1, aLogicSize.Height()+nTextHeight ) );
+ StartCascading();
+}
+
+// -----------------------------------------------------------------------
+
+SfxPopupWindow* ColumnsWindow::Clone() const
+{
+ return new ColumnsWindow( GetId(), maCommand, rTbx, mxFrame );
+}
+
+// -----------------------------------------------------------------------
+
+void ColumnsWindow::MouseMove( const MouseEvent& rMEvt )
+{
+ SfxPopupWindow::MouseMove( rMEvt );
+ Point aPos = rMEvt.GetPosPixel();
+ Point aMousePos = aPos;
+ Point aWinPos = GetPosPixel();
+
+ if ( rMEvt.IsEnterWindow() )
+ CaptureMouse();
+ else if ( aMousePos.X() < 0 || aMousePos.Y() < 0 )
+ {
+ nCol = 0;
+ ReleaseMouse();
+ Invalidate();
+ return;
+ }
+
+ long nNewCol = 0;
+ if ( aPos.X() > 0 )
+ nNewCol = aPos.X() / nMX + 1;
+ if ( aPos.Y() < 0 )
+ nNewCol = 0;
+ if ( nNewCol > 20 )
+ nNewCol = 20;
+ UpdateSize_Impl( nNewCol );
+}
+/* -----------------------------21.05.2002 16:16------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ColumnsWindow::UpdateSize_Impl( long nNewCol )
+{
+ Size aWinSize = GetOutputSizePixel();
+ long nMinCol = 0;
+ long nMaxCol = 0;
+ Point aWinPos;// = GetPosPixel();
+
+ if ( nWidth <= nNewCol )
+ {
+ Point aMaxPos = OutputToScreenPixel( GetDesktopRectPixel().BottomRight() );
+
+ if ( nWidth <= nNewCol )
+ {
+ nWidth = nNewCol;
+ nWidth++;
+ }
+
+ while ( nWidth > 0 &&
+ (short)(aWinPos.X()+(nMX*nWidth-1)) >= aMaxPos.X()-3 )
+ nWidth--;
+
+ if ( nNewCol > nWidth )
+ nNewCol = nWidth;
+
+ Invalidate( Rectangle( 0, aWinSize.Height()-nTextHeight+2,
+ aWinSize.Width(), aWinSize.Height() ) );
+ SetOutputSizePixel( Size( nMX*nWidth-1, aWinSize.Height() ) );
+ }
+
+
+ if ( nNewCol != nCol )
+ {
+ Invalidate( Rectangle( 0, aWinSize.Height()-nTextHeight+2,
+ aWinSize.Width(), aWinSize.Height() ) );
+
+ if ( nNewCol < nCol )
+ {
+ nMinCol = nNewCol;
+ nMaxCol = nCol;
+ }
+ else
+ {
+ nMinCol = nCol;
+ nMaxCol = nNewCol;
+ }
+
+ Invalidate( Rectangle( nMinCol*nMX-1, 0,
+ nMaxCol*nMX+1, aWinSize.Height()-nTextHeight+2 ) );
+ nCol = nNewCol;
+ }
+ Update();
+}
+// -----------------------------------------------------------------------
+
+void ColumnsWindow::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ SfxPopupWindow::MouseButtonDown( rMEvt );
+ CaptureMouse();
+}
+/* -----------------------------21.05.2002 16:11------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ColumnsWindow::KeyInput( const KeyEvent& rKEvt )
+{
+ sal_Bool bHandled = sal_False;
+ sal_uInt16 nModifier = rKEvt.GetKeyCode().GetModifier();
+ sal_uInt16 nKey = rKEvt.GetKeyCode().GetCode();
+ if(!nModifier)
+ {
+ if( KEY_LEFT == nKey || KEY_RIGHT == nKey ||
+ KEY_RETURN == nKey ||KEY_ESCAPE == nKey ||
+ KEY_UP == nKey)
+ {
+ bHandled = sal_True;
+ long nNewCol = nCol;
+ switch(nKey)
+ {
+ case KEY_LEFT :
+ if(nNewCol)
+ nNewCol--;
+ break;
+ case KEY_RIGHT :
+ nNewCol++;
+ break;
+ case KEY_RETURN :
+ if(IsMouseCaptured())
+ ReleaseMouse();
+ EndPopupMode(FLOATWIN_POPUPMODEEND_CLOSEALL );
+ break;
+ case KEY_ESCAPE :
+ case KEY_UP :
+ EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL);
+ break;
+ }
+ //make sure that a table can initially be created
+ if(bInitialKeyInput)
+ {
+ bInitialKeyInput = sal_False;
+ if(!nNewCol)
+ nNewCol = 1;
+ }
+ UpdateSize_Impl( nNewCol );
+ }
+ }
+ else if(KEY_MOD1 == nModifier && KEY_RETURN == nKey)
+ {
+ m_bMod1 = sal_True;
+ if(IsMouseCaptured())
+ ReleaseMouse();
+ EndPopupMode(FLOATWIN_POPUPMODEEND_CLOSEALL );
+ }
+ if(!bHandled)
+ SfxPopupWindow::KeyInput(rKEvt);
+}
+
+// -----------------------------------------------------------------------
+
+void ColumnsWindow::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ SfxPopupWindow::MouseButtonUp( rMEvt );
+ ReleaseMouse();
+
+ if ( IsInPopupMode() )
+ EndPopupMode( FLOATWIN_POPUPMODEEND_CLOSEALL );
+}
+
+// -----------------------------------------------------------------------
+
+void ColumnsWindow::Paint( const Rectangle& )
+{
+ long i;
+ long j;
+ long nLineWidth;
+ Size aSize = GetOutputSizePixel();
+
+ for ( i = 0; i < nWidth; i++ )
+ {
+ if ( i < nCol )
+ {
+ SetLineColor( aHighlightLineColor );
+ SetFillColor( aHighlightFillColor );
+ }
+ else
+ {
+ SetLineColor( aLineColor );
+ SetFillColor( aFillColor );
+ }
+
+ DrawRect( Rectangle( i*nMX-1, -1,
+ i*nMX+nMX, aSize.Height()-nTextHeight+1 ) );
+
+ j = 4;
+ while ( j < aSize.Height()-nTextHeight-4 )
+ {
+ if ( !(j % 16) )
+ nLineWidth = 10;
+ else
+ nLineWidth = 4;
+ DrawLine( Point( i*nMX+4, j ), Point( i*nMX+nMX-nLineWidth-4, j ) );
+ j += 4;
+ }
+ }
+
+ SetLineColor();
+ SetFillColor( aFillColor );
+ String aText;
+ if ( nCol )
+ aText = String( String::CreateFromInt32(nCol) );
+ else
+ aText = Button::GetStandardText( BUTTON_CANCEL );
+ Size aTextSize(GetTextWidth( aText ), GetTextHeight());
+ DrawText( Point( ( aSize.Width() - aTextSize.Width() ) / 2, aSize.Height() - nTextHeight + 2 ), aText );
+
+ DrawRect( Rectangle( 0, aSize.Height()-nTextHeight+2, (aSize.Width()-aTextSize.Width())/2-1, aSize.Height() ) );
+ DrawRect( Rectangle( (aSize.Width()-aTextSize.Width())/2+aTextSize.Width(), aSize.Height()-nTextHeight+2, aSize.Width(), aSize.Height() ) );
+
+ SetLineColor( aLineColor );
+ SetFillColor();
+ DrawRect( Rectangle( Point(0,0), aSize ) );
+}
+
+// -----------------------------------------------------------------------
+
+void ColumnsWindow::PopupModeEnd()
+{
+ if ( !IsPopupModeCanceled() && nCol )
+ {
+ sal_uInt16 nId = GetId();
+ Window* pParent = rTbx.GetParent();
+ pParent->UserEvent(SVX_EVENT_COLUM_WINDOW_EXECUTE, reinterpret_cast<void*>(nId));
+
+ Sequence< PropertyValue > aArgs( 2 );
+ aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Columns" ));
+ aArgs[0].Value = makeAny( sal_Int16( nCol ));
+ aArgs[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Modifier" ));
+ aArgs[1].Value = makeAny( sal_Int16( m_bMod1 ? KEY_MOD1 : 0 ));
+
+ SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ),
+ maCommand,
+ aArgs );
+ }
+ else if ( IsPopupModeCanceled() )
+ ReleaseMouse();
+ SfxPopupWindow::PopupModeEnd();
+}
+
+// class SvxTableToolBoxControl ------------------------------------------
+
+SvxTableToolBoxControl::SvxTableToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
+ SfxToolBoxControl( nSlotId, nId, rTbx ),
+ bEnabled( sal_True )
+{
+ rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) );
+ rTbx.Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+SvxTableToolBoxControl::~SvxTableToolBoxControl()
+{
+}
+
+// -----------------------------------------------------------------------
+
+SfxPopupWindowType SvxTableToolBoxControl::GetPopupWindowType() const
+{
+ return SFX_POPUPWINDOW_ONTIMEOUTANDMOVE;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPopupWindow* SvxTableToolBoxControl::CreatePopupWindow()
+{
+ if ( bEnabled )
+ {
+ ToolBox& rTbx = GetToolBox();
+ TableWindow* pWin = new TableWindow( GetSlotId(), m_aCommandURL, rTbx, m_xFrame );
+ pWin->StartPopupMode( &rTbx, FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_NOKEYCLOSE );
+ SetPopupWindow( pWin );
+ return pWin;
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPopupWindow* SvxTableToolBoxControl::CreatePopupWindowCascading()
+{
+ if ( bEnabled )
+ return new TableWindow( GetSlotId(), m_aCommandURL, GetToolBox(), m_xFrame );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxTableToolBoxControl::StateChanged( sal_uInt16, SfxItemState eState, const SfxPoolItem* pState )
+{
+ if ( pState && pState->ISA(SfxUInt16Item) )
+ {
+ sal_Int16 nValue = static_cast< const SfxUInt16Item* >( pState )->GetValue();
+ bEnabled = ( nValue != 0 );
+ }
+ else
+ bEnabled = SFX_ITEM_DISABLED != eState;
+
+ sal_uInt16 nId = GetId();
+ ToolBox& rTbx = GetToolBox();
+
+ rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState );
+ rTbx.SetItemState( nId,
+ ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK );
+}
+
+// class SvxColumnsToolBoxControl ------------------------------------------
+
+SvxColumnsToolBoxControl::SvxColumnsToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
+ SfxToolBoxControl( nSlotId, nId, rTbx )
+{
+ rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) );
+ rTbx.Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+SvxColumnsToolBoxControl::~SvxColumnsToolBoxControl()
+{
+}
+
+// -----------------------------------------------------------------------
+
+SfxPopupWindowType SvxColumnsToolBoxControl::GetPopupWindowType() const
+{
+ return SFX_POPUPWINDOW_ONTIMEOUTANDMOVE;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPopupWindow* SvxColumnsToolBoxControl::CreatePopupWindow()
+{
+ ColumnsWindow* pWin = 0;
+ if(bEnabled)
+ {
+ pWin = new ColumnsWindow( GetSlotId(), m_aCommandURL, GetToolBox(), m_xFrame );
+ pWin->StartPopupMode( &GetToolBox(),
+ FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_NOKEYCLOSE );
+ SetPopupWindow( pWin );
+ }
+ return pWin;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPopupWindow* SvxColumnsToolBoxControl::CreatePopupWindowCascading()
+{
+ ColumnsWindow* pWin = 0;
+ if(bEnabled)
+ {
+ pWin = new ColumnsWindow( GetSlotId(), m_aCommandURL, GetToolBox(), m_xFrame );
+ }
+ return pWin;
+}
+/* -----------------18.11.99 16:38-------------------
+
+ --------------------------------------------------*/
+void SvxColumnsToolBoxControl::StateChanged( sal_uInt16 nSID,
+ SfxItemState eState,
+ const SfxPoolItem* pState )
+{
+ bEnabled = SFX_ITEM_DISABLED != eState;
+ SfxToolBoxControl::StateChanged(nSID, eState, pState );
+}
diff --git a/svx/source/tbxctrls/lboxctrl.cxx b/svx/source/tbxctrls/lboxctrl.cxx
new file mode 100644
index 000000000000..9c0a5262ce7a
--- /dev/null
+++ b/svx/source/tbxctrls/lboxctrl.cxx
@@ -0,0 +1,351 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#ifdef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#include <vcl/lstbox.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/event.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/tbxctrl.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewsh.hxx>
+#include <tools/gen.hxx>
+#include <svl/intitem.hxx>
+#include <svl/eitem.hxx>
+#include <svtools/stdctrl.hxx>
+#include <svl/slstitm.hxx>
+#include <svl/stritem.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/lboxctrl.hxx>
+#ifndef _VCL_MNEMONIC_HXX_
+#include <vcl/mnemonic.hxx>
+#endif
+#include <tools/urlobj.hxx>
+
+#include <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+
+#include "lboxctrl.hrc"
+
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::frame;
+
+class SvxPopupWindowListBox;
+
+/////////////////////////////////////////////////////////////////
+
+class SvxPopupWindowListBox : public SfxPopupWindow
+{
+ using FloatingWindow::StateChanged;
+
+ FixedInfo aInfo;
+ ListBox * pListBox;
+ ToolBox & rToolBox;
+ sal_Bool bUserSel;
+ sal_uInt16 nTbxId;
+ rtl::OUString maCommandURL;
+ // disallow copy-constructor and assignment-operator
+
+ SvxPopupWindowListBox(const int& );
+ SvxPopupWindowListBox & operator = (const int& );
+
+// SvxPopupWindowListBox( sal_uInt16 nSlotId, ToolBox& rTbx, sal_uInt16 nTbxItemId );
+
+public:
+ SvxPopupWindowListBox( sal_uInt16 nSlotId, const rtl::OUString& rCommandURL, sal_uInt16 nTbxId, ToolBox& rTbx );
+ virtual ~SvxPopupWindowListBox();
+
+ // SfxPopupWindow
+ virtual SfxPopupWindow * Clone() const;
+ virtual void PopupModeEnd();
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+
+ void StartSelection();
+ inline ListBox & GetListBox() { return *pListBox; }
+ inline FixedInfo & GetInfo() { return aInfo; }
+
+ sal_Bool IsUserSelected() const { return bUserSel; }
+ void SetUserSelected( sal_Bool bVal ) { bUserSel = bVal; }
+ /*virtual*/Window* GetPreferredKeyInputWindow();
+};
+
+/////////////////////////////////////////////////////////////////
+
+SvxPopupWindowListBox::SvxPopupWindowListBox( sal_uInt16 nSlotId, const rtl::OUString& rCommandURL, sal_uInt16 nId, ToolBox& rTbx ) :
+ SfxPopupWindow( nSlotId, Reference< XFrame >(), SVX_RES( RID_SVXTBX_UNDO_REDO_CTRL ) ),
+ aInfo ( this, SVX_RES( FT_NUM_OPERATIONS ) ),
+ rToolBox ( rTbx ),
+ bUserSel ( sal_False ),
+ nTbxId ( nId ),
+ maCommandURL( rCommandURL )
+{
+ DBG_ASSERT( nSlotId == GetId(), "id mismatch" );
+ pListBox = new ListBox( this, SVX_RES( LB_SVXTBX_UNDO_REDO_CTRL ) );
+ FreeResource();
+ pListBox->EnableMultiSelection( sal_True, sal_True );
+ SetBackground( GetSettings().GetStyleSettings().GetDialogColor() );
+ AddStatusListener( rCommandURL );
+}
+
+
+SvxPopupWindowListBox::~SvxPopupWindowListBox()
+{
+ delete pListBox;
+}
+
+
+SfxPopupWindow* SvxPopupWindowListBox::Clone() const
+{
+ return new SvxPopupWindowListBox( GetId(), maCommandURL, nTbxId, rToolBox );
+}
+
+
+void SvxPopupWindowListBox::PopupModeEnd()
+{
+ rToolBox.EndSelection();
+ SfxPopupWindow::PopupModeEnd();
+ //FloatingWindow::PopupModeEnd();
+
+ if( SfxViewShell::Current() )
+ {
+ Window* pShellWnd = SfxViewShell::Current()->GetWindow();
+ if (pShellWnd)
+ pShellWnd->GrabFocus();
+ }
+}
+
+
+void SvxPopupWindowListBox::StateChanged(
+ sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+{
+ rToolBox.EnableItem( nTbxId, ( SfxToolBoxControl::GetItemState( pState ) != SFX_ITEM_DISABLED) );
+ SfxPopupWindow::StateChanged( nSID, eState, pState );
+}
+
+
+void SvxPopupWindowListBox::StartSelection()
+{
+ rToolBox.StartSelection();
+}
+
+Window* SvxPopupWindowListBox::GetPreferredKeyInputWindow()
+{
+ // allows forwarding key events in the correct window
+ // without setting the focus
+ return pListBox->GetPreferredKeyInputWindow();
+}
+
+/////////////////////////////////////////////////////////////////
+
+SFX_IMPL_TOOLBOX_CONTROL( SvxListBoxControl, SfxStringItem );
+
+
+SvxListBoxControl::SvxListBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
+ :SfxToolBoxControl( nSlotId, nId, rTbx ),
+ pPopupWin ( 0 )
+{
+ rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) );
+ rTbx.Invalidate();
+}
+
+
+SvxListBoxControl::~SvxListBoxControl()
+{
+}
+
+
+SfxPopupWindow* SvxListBoxControl::CreatePopupWindow()
+{
+ DBG_ERROR( "not implemented" );
+ return 0;
+}
+
+
+SfxPopupWindowType SvxListBoxControl::GetPopupWindowType() const
+{
+ return SFX_POPUPWINDOW_ONTIMEOUT;
+}
+
+
+void SvxListBoxControl::StateChanged(
+ sal_uInt16, SfxItemState, const SfxPoolItem* pState )
+{
+ GetToolBox().EnableItem( GetId(),
+ SFX_ITEM_DISABLED != GetItemState(pState) );
+}
+
+
+IMPL_LINK( SvxListBoxControl, PopupModeEndHdl, void *, EMPTYARG )
+{
+ if( pPopupWin && 0 == pPopupWin->GetPopupModeFlags() &&
+ pPopupWin->IsUserSelected() )
+ {
+ sal_uInt16 nCount = pPopupWin->GetListBox().GetSelectEntryCount();
+
+ INetURLObject aObj( m_aCommandURL );
+
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = aObj.GetURLPath();
+ aArgs[0].Value = makeAny( sal_Int16( nCount ));
+ SfxToolBoxControl::Dispatch( m_aCommandURL, aArgs );
+ }
+ return 0;
+}
+
+
+void SvxListBoxControl::Impl_SetInfo( sal_uInt16 nCount )
+{
+ DBG_ASSERT( pPopupWin, "NULL pointer, PopupWindow missing" );
+
+// ListBox &rListBox = pPopupWin->GetListBox();
+
+ sal_uInt16 nId;
+ if (nCount == 1)
+ nId = SID_UNDO == GetSlotId() ? RID_SVXSTR_NUM_UNDO_ACTION : RID_SVXSTR_NUM_REDO_ACTION;
+ else
+ nId = SID_UNDO == GetSlotId() ? RID_SVXSTR_NUM_UNDO_ACTIONS : RID_SVXSTR_NUM_REDO_ACTIONS;
+
+ aActionStr = String(SVX_RES(nId));
+
+ String aText( aActionStr );
+ aText.SearchAndReplaceAllAscii( "$(ARG1)", String::CreateFromInt32( nCount ) );
+ pPopupWin->GetInfo().SetText( aText );
+}
+
+
+IMPL_LINK( SvxListBoxControl, SelectHdl, void *, EMPTYARG )
+{
+ if (pPopupWin)
+ {
+ //pPopupWin->SetUserSelected( sal_False );
+
+ ListBox &rListBox = pPopupWin->GetListBox();
+ if (rListBox.IsTravelSelect())
+ Impl_SetInfo( rListBox.GetSelectEntryCount() );
+ else
+ {
+ pPopupWin->SetUserSelected( sal_True );
+ pPopupWin->EndPopupMode( 0 );
+ }
+ }
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////
+
+SFX_IMPL_TOOLBOX_CONTROL( SvxUndoRedoControl, SfxStringItem );
+
+SvxUndoRedoControl::SvxUndoRedoControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
+ : SvxListBoxControl( nSlotId, nId, rTbx )
+{
+ rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) );
+ rTbx.Invalidate();
+ aDefaultText = MnemonicGenerator::EraseAllMnemonicChars( rTbx.GetItemText( nId ) );
+}
+
+SvxUndoRedoControl::~SvxUndoRedoControl()
+{
+}
+
+void SvxUndoRedoControl::StateChanged(
+ sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+{
+ if ( nSID == SID_UNDO || nSID == SID_REDO )
+ {
+ if ( eState == SFX_ITEM_DISABLED )
+ {
+ ToolBox& rBox = GetToolBox();
+ rBox.SetQuickHelpText( GetId(), aDefaultText );
+ }
+ else if ( pState && pState->ISA( SfxStringItem ) )
+ {
+ SfxStringItem& rItem = *(SfxStringItem *)pState;
+ ToolBox& rBox = GetToolBox();
+ String aQuickHelpText = MnemonicGenerator::EraseAllMnemonicChars( rItem.GetValue() );
+ rBox.SetQuickHelpText( GetId(), aQuickHelpText );
+ }
+ SvxListBoxControl::StateChanged( nSID, eState, pState );
+ }
+ else
+ {
+ aUndoRedoList.clear();
+
+ if ( pState && pState->ISA( SfxStringListItem ) )
+ {
+ SfxStringListItem &rItem = *(SfxStringListItem *)pState;
+ const List* pLst = rItem.GetList();
+ DBG_ASSERT( pLst, "no undo actions available" );
+ if ( pLst )
+ {
+ for( long nI = 0, nEnd = pLst->Count(); nI < nEnd; ++nI )
+ aUndoRedoList.push_back( rtl::OUString( *(String *)pLst->GetObject( nI )));
+ }
+ }
+ }
+}
+
+SfxPopupWindow* SvxUndoRedoControl::CreatePopupWindow()
+{
+ DBG_ASSERT(( SID_UNDO == GetSlotId() || SID_REDO == GetSlotId() ), "mismatching ids" );
+
+ if ( m_aCommandURL.equalsAscii( ".uno:Undo" ))
+ updateStatus( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GetUndoStrings" )));
+ else
+ updateStatus( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GetRedoStrings" )));
+
+ ToolBox& rBox = GetToolBox();
+
+ pPopupWin = new SvxPopupWindowListBox( GetSlotId(), m_aCommandURL, GetId(), rBox );
+ pPopupWin->SetPopupModeEndHdl( LINK( this, SvxUndoRedoControl,
+ PopupModeEndHdl ) );
+ ListBox &rListBox = pPopupWin->GetListBox();
+ rListBox.SetSelectHdl( LINK( this, SvxUndoRedoControl, SelectHdl ) );
+
+ for( sal_uInt32 n = 0; n < aUndoRedoList.size(); n++ )
+ rListBox.InsertEntry( String( aUndoRedoList[n] ));
+
+ rListBox.SelectEntryPos( 0 );
+ aActionStr = String( SVX_RES( SID_UNDO == GetSlotId() ?
+ RID_SVXSTR_NUM_UNDO_ACTIONS : RID_SVXSTR_NUM_REDO_ACTIONS ) );
+ Impl_SetInfo( rListBox.GetSelectEntryCount() );
+
+ // move focus in floating window without
+ // closing it (GrabFocus() would close it!)
+ pPopupWin->StartPopupMode( &rBox, FLOATWIN_POPUPMODE_GRABFOCUS );
+ //pPopupWin->GetListBox().GrabFocus();
+
+ return pPopupWin;
+}
diff --git a/svx/source/tbxctrls/lboxctrl.hrc b/svx/source/tbxctrls/lboxctrl.hrc
new file mode 100644
index 000000000000..3026fee5cff3
--- /dev/null
+++ b/svx/source/tbxctrls/lboxctrl.hrc
@@ -0,0 +1,30 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define LB_SVXTBX_UNDO_REDO_CTRL 11
+#define FT_NUM_OPERATIONS 12
+
diff --git a/svx/source/tbxctrls/lboxctrl.src b/svx/source/tbxctrls/lboxctrl.src
new file mode 100644
index 000000000000..4150e07ba249
--- /dev/null
+++ b/svx/source/tbxctrls/lboxctrl.src
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svx/dialogs.hrc>
+#include <helpid.hrc>
+#include "lboxctrl.hrc"
+
+FloatingWindow RID_SVXTBX_UNDO_REDO_CTRL
+{
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 150 , 74 ) ;
+ HelpID = HID_SVXTBX_UNDO_REDO_CTRL ;
+ SysWin = TRUE;
+ Border = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ OutputSize = TRUE ;
+
+ ListBox LB_SVXTBX_UNDO_REDO_CTRL
+ {
+ HelpID = "svx:ListBox:RID_SVXTBX_UNDO_REDO_CTRL:LB_SVXTBX_UNDO_REDO_CTRL";
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 150 , 60 ) ;
+ Border = TRUE ;
+ DropDown = FALSE ;
+ OutputSize = TRUE ;
+ };
+ FixedText FT_NUM_OPERATIONS
+ {
+ Pos = MAP_APPFONT ( 6 , 64 ) ;
+ Size = MAP_APPFONT ( 138 , 10 ) ;
+ };
+};
+
+String RID_SVXSTR_NUM_UNDO_ACTIONS
+{
+ Text[ en-US ] = "Actions to undo: $(ARG1)";
+};
+
+String RID_SVXSTR_NUM_UNDO_ACTION
+{
+ Text[ en-US ] = "Actions to undo: $(ARG1)" ;
+};
+
+String RID_SVXSTR_NUM_REDO_ACTIONS
+{
+ Text[ en-US ] = "Actions to redo: $(ARG1)";
+};
+
+String RID_SVXSTR_NUM_REDO_ACTION
+{
+ Text[ en-US ] = "Actions to redo: $(ARG1)";
+};
diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx
new file mode 100644
index 000000000000..3369f1ae8eb5
--- /dev/null
+++ b/svx/source/tbxctrls/linectrl.cxx
@@ -0,0 +1,784 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <string> // HACK: prevent conflict between STLPORT and Workshop headers
+
+#ifndef _TOOLBOX_HXX //autogen
+#include <vcl/toolbox.hxx>
+#endif
+#include <sfx2/app.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objsh.hxx>
+
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+
+#include "svx/drawitem.hxx"
+#include "svx/xattr.hxx"
+#include <svx/xtable.hxx>
+#include "svx/linectrl.hxx"
+#include <svx/itemwin.hxx>
+#include <svx/dialmgr.hxx>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::lang;
+
+// Fuer Linienenden-Controller
+#define MAX_LINES 12
+
+// STATIC DATA -----------------------------------------------------------
+
+#define RESIZE_VALUE_POPUP(value_set) \
+{ \
+ Size aSize = GetOutputSizePixel(); \
+ aSize.Width() -= 4; \
+ aSize.Height() -= 4; \
+ (value_set).SetPosSizePixel( Point(2,2), aSize ); \
+}
+
+#define CALCSIZE_VALUE_POPUP(value_set,item_size) \
+{ \
+ Size aSize = (value_set).CalcWindowSizePixel( (item_size) ); \
+ aSize.Width() += 4; \
+ aSize.Height() += 4; \
+ SetOutputSizePixel( aSize ); \
+}
+
+
+SFX_IMPL_TOOLBOX_CONTROL( SvxLineStyleToolBoxControl, XLineStyleItem );
+SFX_IMPL_TOOLBOX_CONTROL( SvxLineWidthToolBoxControl, XLineWidthItem );
+SFX_IMPL_TOOLBOX_CONTROL( SvxLineColorToolBoxControl, XLineColorItem );
+SFX_IMPL_TOOLBOX_CONTROL( SvxLineEndToolBoxControl, SfxBoolItem );
+
+/*************************************************************************
+|*
+|* SvxLineStyleToolBoxControl
+|*
+\************************************************************************/
+
+SvxLineStyleToolBoxControl::SvxLineStyleToolBoxControl( sal_uInt16 nSlotId,
+ sal_uInt16 nId,
+ ToolBox& rTbx ) :
+ SfxToolBoxControl( nSlotId, nId, rTbx ),
+ pStyleItem ( NULL ),
+ pDashItem ( NULL ),
+ bUpdate ( sal_False )
+{
+ addStatusListener( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:LineDash" )));
+ addStatusListener( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DashListState" )));
+}
+
+//========================================================================
+
+SvxLineStyleToolBoxControl::~SvxLineStyleToolBoxControl()
+{
+ delete pStyleItem;
+ delete pDashItem;
+}
+
+//========================================================================
+
+void SvxLineStyleToolBoxControl::StateChanged (
+
+ sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+
+{
+ SvxLineBox* pBox = (SvxLineBox*)GetToolBox().GetItemWindow( GetId() );
+ DBG_ASSERT( pBox, "Window not found!" );
+
+ if( eState == SFX_ITEM_DISABLED )
+ {
+ pBox->Disable();
+ pBox->SetNoSelection();
+ }
+ else
+ {
+ pBox->Enable();
+
+ if ( eState == SFX_ITEM_AVAILABLE )
+ {
+ if( nSID == SID_ATTR_LINE_STYLE )
+ {
+ delete pStyleItem;
+ pStyleItem = (XLineStyleItem*)pState->Clone();
+ }
+ else if( nSID == SID_ATTR_LINE_DASH )
+ {
+ delete pDashItem;
+ pDashItem = (XLineDashItem*)pState->Clone();
+ }
+
+ bUpdate = sal_True;
+ Update( pState );
+ }
+ else if ( nSID != SID_DASH_LIST )
+ {
+ // kein oder uneindeutiger Status
+ pBox->SetNoSelection();
+ }
+ }
+}
+
+//========================================================================
+
+void SvxLineStyleToolBoxControl::Update( const SfxPoolItem* pState )
+{
+ if ( pState && bUpdate )
+ {
+ bUpdate = sal_False;
+
+ SvxLineBox* pBox = (SvxLineBox*)GetToolBox().GetItemWindow( GetId() );
+ DBG_ASSERT( pBox, "Window not found!" );
+
+ // Da der Timer unerwartet zuschlagen kann, kann es vorkommen, dass
+ // die LB noch nicht gefuellt ist. Ein ClearCache() am Control im
+ // DelayHdl() blieb ohne Erfolg.
+ if( pBox->GetEntryCount() == 0 )
+ pBox->FillControl();
+
+ XLineStyle eXLS;
+
+ if ( pStyleItem )
+ eXLS = ( XLineStyle )pStyleItem->GetValue();
+ else
+ eXLS = XLINE_NONE;
+
+ switch( eXLS )
+ {
+ case XLINE_NONE:
+ pBox->SelectEntryPos( 0 );
+ break;
+
+ case XLINE_SOLID:
+ pBox->SelectEntryPos( 1 );
+ break;
+
+ case XLINE_DASH:
+ {
+ if( pDashItem )
+ {
+ String aString( pDashItem->GetName() );
+ pBox->SelectEntry( aString );
+ }
+ else
+ pBox->SetNoSelection();
+ }
+ break;
+
+ default:
+ DBG_ERROR( "Nicht unterstuetzter Linientyp" );
+ break;
+ }
+ }
+
+ if ( pState && ( pState->ISA( SvxDashListItem ) ) )
+ {
+ // Die Liste der Linienstile hat sich geaendert
+ SvxLineBox* pBox = (SvxLineBox*)GetToolBox().GetItemWindow( GetId() );
+ DBG_ASSERT( pBox, "Window not found!" );
+
+ String aString( pBox->GetSelectEntry() );
+ pBox->Clear();
+ pBox->InsertEntry( SVX_RESSTR(RID_SVXSTR_INVISIBLE) );
+ pBox->InsertEntry( SVX_RESSTR(RID_SVXSTR_SOLID) );
+ pBox->Fill( ((SvxDashListItem*)pState )->GetDashList() );
+ pBox->SelectEntry( aString );
+ }
+}
+
+//========================================================================
+
+Window* SvxLineStyleToolBoxControl::CreateItemWindow( Window *pParent )
+{
+ return new SvxLineBox( pParent, m_xFrame );
+}
+
+/*************************************************************************
+|*
+|* SvxLineWidthToolBoxControl
+|*
+\************************************************************************/
+
+SvxLineWidthToolBoxControl::SvxLineWidthToolBoxControl(
+ sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
+ SfxToolBoxControl( nSlotId, nId, rTbx )
+{
+ addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:MetricUnit" )));
+}
+
+//========================================================================
+
+SvxLineWidthToolBoxControl::~SvxLineWidthToolBoxControl()
+{
+}
+
+//========================================================================
+
+void SvxLineWidthToolBoxControl::StateChanged(
+ sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+{
+ SvxMetricField* pFld = (SvxMetricField*)
+ GetToolBox().GetItemWindow( GetId() );
+ DBG_ASSERT( pFld, "Window not found" );
+
+ if ( nSID == SID_ATTR_METRIC )
+ {
+ pFld->RefreshDlgUnit();
+ }
+ else
+ {
+ if ( eState == SFX_ITEM_DISABLED )
+ {
+ pFld->Disable();
+ pFld->SetText( String() );
+ }
+ else
+ {
+ pFld->Enable();
+
+ if ( eState == SFX_ITEM_AVAILABLE )
+ {
+ DBG_ASSERT( pState->ISA(XLineWidthItem), "falscher ItemType" );
+
+ // Core-Unit an MetricField uebergeben
+ // Darf nicht in CreateItemWin() geschehen!
+ SfxMapUnit eUnit = SFX_MAPUNIT_100TH_MM; // CD!!! GetCoreMetric();
+ pFld->SetCoreUnit( eUnit );
+
+ pFld->Update( (const XLineWidthItem*)pState );
+ }
+ else
+ pFld->Update( NULL );
+ }
+ }
+}
+
+//========================================================================
+
+Window* SvxLineWidthToolBoxControl::CreateItemWindow( Window *pParent )
+{
+ return( new SvxMetricField( pParent, m_xFrame ) );
+}
+
+/*************************************************************************
+|*
+|* SvxLineColorToolBoxControl
+|*
+\************************************************************************/
+
+SvxLineColorToolBoxControl::SvxLineColorToolBoxControl(
+ sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
+ SfxToolBoxControl( nSlotId, nId, rTbx )
+{
+ addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ColorTableState" )));
+}
+
+//========================================================================
+
+SvxLineColorToolBoxControl::~SvxLineColorToolBoxControl()
+{
+}
+
+//========================================================================
+
+void SvxLineColorToolBoxControl::StateChanged(
+
+ sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+
+{
+ SvxColorBox* pBox = (SvxColorBox*)GetToolBox().GetItemWindow( GetId() );
+ DBG_ASSERT( pBox, "Window not found" );
+
+ if ( nSID != SID_COLOR_TABLE )
+ {
+ if ( eState == SFX_ITEM_DISABLED )
+ {
+ pBox->Disable();
+ pBox->SetNoSelection();
+ }
+ else
+ {
+ pBox->Enable();
+
+ if ( eState == SFX_ITEM_AVAILABLE )
+ {
+ DBG_ASSERT( pState->ISA(XLineColorItem), "falscher ItemTyoe" );
+ pBox->Update( (const XLineColorItem*) pState );
+ }
+ else
+ pBox->Update( NULL );
+ }
+ }
+ else
+ Update( pState );
+}
+
+//========================================================================
+
+void SvxLineColorToolBoxControl::Update( const SfxPoolItem* pState )
+{
+ if ( pState && ( pState->ISA( SvxColorTableItem ) ) )
+ {
+ SvxColorBox* pBox = (SvxColorBox*)GetToolBox().GetItemWindow( GetId() );
+
+ DBG_ASSERT( pBox, "Window not found" );
+
+ // Die Liste der Farben (ColorTable) hat sich geaendert:
+ ::Color aTmpColor( pBox->GetSelectEntryColor() );
+ pBox->Clear();
+ pBox->Fill( ( (SvxColorTableItem*)pState )->GetColorTable() );
+ pBox->SelectEntry( aTmpColor );
+ }
+}
+
+//========================================================================
+
+Window* SvxLineColorToolBoxControl::CreateItemWindow( Window *pParent )
+{
+ return new SvxColorBox( pParent, m_aCommandURL, m_xFrame );
+}
+
+/*************************************************************************
+|*
+|* SvxLineEndWindow
+|*
+\************************************************************************/
+
+SvxLineEndWindow::SvxLineEndWindow(
+ sal_uInt16 nSlotId,
+ const Reference< XFrame >& rFrame,
+ const String& rWndTitle ) :
+ SfxPopupWindow( nSlotId,
+ rFrame,
+ WinBits( WB_BORDER | WB_STDFLOATWIN | WB_SIZEABLE | WB_3DLOOK ) ),
+ pLineEndList ( NULL ),
+ aLineEndSet ( this, WinBits( WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) ),
+ nCols ( 2 ),
+ nLines ( 12 ),
+ nLineEndWidth ( 400 ),
+ bPopupMode ( sal_True ),
+ mbInResize ( false ),
+ mxFrame ( rFrame )
+{
+ SetText( rWndTitle );
+ implInit();
+}
+
+SvxLineEndWindow::SvxLineEndWindow(
+ sal_uInt16 nSlotId,
+ const Reference< XFrame >& rFrame,
+ Window* pParentWindow,
+ const String& rWndTitle ) :
+ SfxPopupWindow( nSlotId,
+ rFrame,
+ pParentWindow,
+ WinBits( WB_BORDER | WB_STDFLOATWIN | WB_SIZEABLE | WB_3DLOOK ) ),
+ pLineEndList ( NULL ),
+ aLineEndSet ( this, WinBits( WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) ),
+ nCols ( 2 ),
+ nLines ( 12 ),
+ nLineEndWidth ( 400 ),
+ bPopupMode ( sal_True ),
+ mbInResize ( false ),
+ mxFrame ( rFrame )
+{
+ SetText( rWndTitle );
+ implInit();
+}
+
+void SvxLineEndWindow::implInit()
+{
+ SfxObjectShell* pDocSh = SfxObjectShell::Current();
+ const SfxPoolItem* pItem = NULL;
+
+ SetHelpId( HID_POPUP_LINEEND );
+ aLineEndSet.SetHelpId( HID_POPUP_LINEEND_CTRL );
+
+ if ( pDocSh )
+ {
+ pItem = pDocSh->GetItem( SID_LINEEND_LIST );
+ if( pItem )
+ pLineEndList = ( (SvxLineEndListItem*) pItem )->GetLineEndList();
+
+ pItem = pDocSh->GetItem( SID_ATTR_LINEEND_WIDTH_DEFAULT );
+ if( pItem )
+ nLineEndWidth = ( (SfxUInt16Item*) pItem )->GetValue();
+ }
+ DBG_ASSERT( pLineEndList, "LineEndList wurde nicht gefunden" );
+
+ aLineEndSet.SetSelectHdl( LINK( this, SvxLineEndWindow, SelectHdl ) );
+ aLineEndSet.SetColCount( nCols );
+
+ // ValueSet mit Eintraegen der LineEndList fuellen
+ FillValueSet();
+
+ AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:LineEndListState" )));
+
+ //ChangeHelpId( HID_POPUP_LINEENDSTYLE );
+ aLineEndSet.Show();
+}
+
+SfxPopupWindow* SvxLineEndWindow::Clone() const
+{
+ return new SvxLineEndWindow( GetId(), mxFrame, GetText() );
+}
+
+// -----------------------------------------------------------------------
+
+SvxLineEndWindow::~SvxLineEndWindow()
+{
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxLineEndWindow, SelectHdl, void *, EMPTYARG )
+{
+ XLineEndItem* pLineEndItem = NULL;
+ XLineStartItem* pLineStartItem = NULL;
+ sal_uInt16 nId = aLineEndSet.GetSelectItemId();
+
+ if( nId == 1 )
+ {
+ pLineStartItem = new XLineStartItem();
+ }
+ else if( nId == 2 )
+ {
+ pLineEndItem = new XLineEndItem();
+ }
+ else if( nId % 2 ) // LinienAnfang
+ {
+ XLineEndEntry* pEntry = pLineEndList->GetLineEnd( ( nId - 1 ) / 2 - 1 );
+ pLineStartItem = new XLineStartItem( pEntry->GetName(), pEntry->GetLineEnd() );
+ }
+ else // LinienEnde
+ {
+ XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nId / 2 - 2 );
+ pLineEndItem = new XLineEndItem( pEntry->GetName(), pEntry->GetLineEnd() );
+ }
+
+ if ( IsInPopupMode() )
+ EndPopupMode();
+
+ Sequence< PropertyValue > aArgs( 1 );
+ Any a;
+
+ if ( pLineStartItem )
+ {
+ aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LineStart" ));
+ pLineStartItem->QueryValue( a );
+ aArgs[0].Value = a;
+ }
+ else
+ {
+ aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LineEnd" ));
+ pLineEndItem->QueryValue( a );
+ aArgs[0].Value = a;
+ }
+
+ /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call.
+ This instance may be deleted in the meantime (i.e. when a dialog is opened
+ while in Dispatch()), accessing members will crash in this case. */
+ aLineEndSet.SetNoSelection();
+
+ SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:LineEndStyle" )),
+ aArgs );
+
+ delete pLineEndItem;
+ delete pLineStartItem;
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxLineEndWindow::FillValueSet()
+{
+ if( pLineEndList )
+ {
+ XLineEndEntry* pEntry = NULL;
+ Bitmap* pBmp = NULL;
+ VirtualDevice aVD;
+
+ long nCount = pLineEndList->Count();
+
+ // Erster Eintrag: kein LinienEnde
+ // Temporaer wird ein Eintrag hinzugefuegt, um die UI-Bitmap zu erhalten
+ basegfx::B2DPolyPolygon aNothing;
+ pLineEndList->Insert( new XLineEndEntry( aNothing, SVX_RESSTR( RID_SVXSTR_NONE ) ) );
+ pEntry = pLineEndList->GetLineEnd( nCount );
+ pBmp = pLineEndList->GetBitmap( nCount );
+ DBG_ASSERT( pBmp, "UI-Bitmap wurde nicht erzeugt" );
+
+ aBmpSize = pBmp->GetSizePixel();
+ aVD.SetOutputSizePixel( aBmpSize, sal_False );
+ aBmpSize.Width() = aBmpSize.Width() / 2;
+ Point aPt0( 0, 0 );
+ Point aPt1( aBmpSize.Width(), 0 );
+
+ aVD.DrawBitmap( Point(), *pBmp );
+ aLineEndSet.InsertItem( 1, aVD.GetBitmap( aPt0, aBmpSize ), pEntry->GetName() );
+ aLineEndSet.InsertItem( 2, aVD.GetBitmap( aPt1, aBmpSize ), pEntry->GetName() );
+
+ delete pLineEndList->Remove( nCount );
+
+ for( long i = 0; i < nCount; i++ )
+ {
+ pEntry = pLineEndList->GetLineEnd( i );
+ DBG_ASSERT( pEntry, "Konnte auf LineEndEntry nicht zugreifen" );
+ pBmp = pLineEndList->GetBitmap( i );
+ DBG_ASSERT( pBmp, "UI-Bitmap wurde nicht erzeugt" );
+
+ aVD.DrawBitmap( aPt0, *pBmp );
+ aLineEndSet.InsertItem( (sal_uInt16)((i+1L)*2L+1L), aVD.GetBitmap( aPt0, aBmpSize ), pEntry->GetName() );
+ aLineEndSet.InsertItem( (sal_uInt16)((i+2L)*2L), aVD.GetBitmap( aPt1, aBmpSize ), pEntry->GetName() );
+ }
+ nLines = Min( (sal_uInt16)(nCount + 1), (sal_uInt16) MAX_LINES );
+ aLineEndSet.SetLineCount( nLines );
+
+ SetSize();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxLineEndWindow::Resize()
+{
+ // since we change the size inside this call, check if we
+ // are called recursive
+ if( !mbInResize )
+ {
+ mbInResize = true;
+ if ( !IsRollUp() )
+ {
+ aLineEndSet.SetColCount( nCols );
+ aLineEndSet.SetLineCount( nLines );
+
+ SetSize();
+
+ Size aSize = GetOutputSizePixel();
+ aSize.Width() -= 4;
+ aSize.Height() -= 4;
+ aLineEndSet.SetPosSizePixel( Point( 2, 2 ), aSize );
+ }
+ //SfxPopupWindow::Resize();
+ mbInResize = false;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void __EXPORT SvxLineEndWindow::Resizing( Size& rNewSize )
+{
+ Size aBitmapSize = aBmpSize; // -> Member
+ aBitmapSize.Width() += 6; //
+ aBitmapSize.Height() += 6; //
+
+ Size aItemSize = aLineEndSet.CalcItemSizePixel( aBitmapSize ); // -> Member
+ //Size aOldSize = GetOutputSizePixel(); // fuer Breite
+
+ sal_uInt16 nItemCount = aLineEndSet.GetItemCount(); // -> Member
+
+ // Spalten ermitteln
+ long nItemW = aItemSize.Width();
+ long nW = rNewSize.Width();
+ nCols = (sal_uInt16) Max( ( (sal_uIntPtr)(( nW + nItemW ) / ( nItemW * 2 ) )),
+ (sal_uIntPtr) 1L );
+ nCols *= 2;
+
+ // Reihen ermitteln
+ long nItemH = aItemSize.Height();
+ long nH = rNewSize.Height();
+ nLines = (sal_uInt16) Max( ( ( nH + nItemH / 2 ) / nItemH ), 1L );
+
+ sal_uInt16 nMaxCols = nItemCount / nLines;
+ if( nItemCount % nLines )
+ nMaxCols++;
+ if( nCols > nMaxCols )
+ nCols = nMaxCols;
+ nW = nItemW * nCols;
+
+ // Keine ungerade Anzahl von Spalten
+ if( nCols % 2 )
+ nCols--;
+ nCols = Max( nCols, (sal_uInt16) 2 );
+
+ sal_uInt16 nMaxLines = nItemCount / nCols;
+ if( nItemCount % nCols )
+ nMaxLines++;
+ if( nLines > nMaxLines )
+ nLines = nMaxLines;
+ nH = nItemH * nLines;
+
+ rNewSize.Width() = nW;
+ rNewSize.Height() = nH;
+}
+// -----------------------------------------------------------------------
+
+void SvxLineEndWindow::StartSelection()
+{
+ aLineEndSet.StartSelection();
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxLineEndWindow::Close()
+{
+ return SfxPopupWindow::Close();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxLineEndWindow::StateChanged(
+ sal_uInt16 nSID, SfxItemState, const SfxPoolItem* pState )
+{
+ if ( nSID == SID_LINEEND_LIST )
+ {
+ // Die Liste der LinienEnden (LineEndList) hat sich geaendert:
+ if ( pState && pState->ISA( SvxLineEndListItem ))
+ {
+ pLineEndList = ((SvxLineEndListItem*)pState)->GetLineEndList();
+ DBG_ASSERT( pLineEndList, "LineEndList nicht gefunden" );
+
+ aLineEndSet.Clear();
+ FillValueSet();
+
+ Size aSize = GetOutputSizePixel();
+ Resizing( aSize );
+ Resize();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxLineEndWindow::PopupModeEnd()
+{
+ if ( IsVisible() )
+ {
+ bPopupMode = sal_False;
+ SetSize();
+ }
+ SfxPopupWindow::PopupModeEnd();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxLineEndWindow::SetSize()
+{
+ //if( !bPopupMode )
+ if( !IsInPopupMode() )
+ {
+ sal_uInt16 nItemCount = aLineEndSet.GetItemCount(); // -> Member
+ sal_uInt16 nMaxLines = nItemCount / nCols; // -> Member ?
+ if( nItemCount % nCols )
+ nMaxLines++;
+
+ WinBits nBits = aLineEndSet.GetStyle();
+ if ( nLines == nMaxLines )
+ nBits &= ~WB_VSCROLL;
+ else
+ nBits |= WB_VSCROLL;
+ aLineEndSet.SetStyle( nBits );
+ }
+
+ Size aSize( aBmpSize );
+ aSize.Width() += 6;
+ aSize.Height() += 6;
+ aSize = aLineEndSet.CalcWindowSizePixel( aSize );
+ aSize.Width() += 4;
+ aSize.Height() += 4;
+ SetOutputSizePixel( aSize );
+ aSize.Height() = aBmpSize.Height();
+ aSize.Height() += 14;
+ //SetMinOutputSizePixel( aSize );
+}
+
+void SvxLineEndWindow::GetFocus (void)
+{
+ SfxPopupWindow::GetFocus();
+ // Grab the focus to the line ends value set so that it can be controlled
+ // with the keyboard.
+ aLineEndSet.GrabFocus();
+}
+
+/*************************************************************************
+|*
+|* SvxLineEndToolBoxControl
+|*
+\************************************************************************/
+
+SvxLineEndToolBoxControl::SvxLineEndToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ) :
+ SfxToolBoxControl( nSlotId, nId, rTbx )
+{
+ rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) );
+ rTbx.Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+SvxLineEndToolBoxControl::~SvxLineEndToolBoxControl()
+{
+}
+
+// -----------------------------------------------------------------------
+
+SfxPopupWindowType SvxLineEndToolBoxControl::GetPopupWindowType() const
+{
+ return SFX_POPUPWINDOW_ONCLICK;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPopupWindow* SvxLineEndToolBoxControl::CreatePopupWindow()
+{
+ SvxLineEndWindow* pLineEndWin =
+ new SvxLineEndWindow( GetId(), m_xFrame, &GetToolBox(), SVX_RESSTR( RID_SVXSTR_LINEEND ) );
+ pLineEndWin->StartPopupMode( &GetToolBox(), sal_True );
+ pLineEndWin->StartSelection();
+ SetPopupWindow( pLineEndWin );
+ return pLineEndWin;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxLineEndToolBoxControl::StateChanged( sal_uInt16, SfxItemState eState, const SfxPoolItem* )
+{
+ sal_uInt16 nId = GetId();
+ ToolBox& rTbx = GetToolBox();
+
+ rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState );
+ rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK );
+}
diff --git a/svx/source/tbxctrls/linectrl.src b/svx/source/tbxctrls/linectrl.src
new file mode 100644
index 000000000000..0265875adb7f
--- /dev/null
+++ b/svx/source/tbxctrls/linectrl.src
@@ -0,0 +1,34 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "linectrl.hrc"
+
+Bitmap RID_SVXCTRL_LINECTRL
+{
+ File = "soliline.bmp" ;
+};
+
diff --git a/svx/source/tbxctrls/subtoolboxcontrol.cxx b/svx/source/tbxctrls/subtoolboxcontrol.cxx
new file mode 100644
index 000000000000..526f32434c2e
--- /dev/null
+++ b/svx/source/tbxctrls/subtoolboxcontrol.cxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svl/intitem.hxx>
+
+#include <vcl/toolbox.hxx>
+#include <sfx2/app.hxx>
+#include <svx/subtoolboxcontrol.hxx>
+#include <svx/svxids.hrc>
+
+
+SFX_IMPL_TOOLBOX_CONTROL( SvxSubToolBoxControl, SfxUInt16Item );
+
+/**********************************************************************
+
+**********************************************************************/
+
+SvxSubToolBoxControl::SvxSubToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
+: SfxToolBoxControl( nSlotId, nId, rTbx )
+{
+ rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) );
+}
+
+/**********************************************************************
+
+**********************************************************************/
+
+SvxSubToolBoxControl::~SvxSubToolBoxControl()
+{
+}
+
+/**********************************************************************
+
+**********************************************************************/
+
+SfxPopupWindow* SvxSubToolBoxControl::CreatePopupWindow()
+{
+ const sal_Char* pResource = 0;
+ switch( GetSlotId() )
+ {
+ case SID_OPTIMIZE_TABLE:
+ pResource = "private:resource/toolbar/optimizetablebar";
+ break;
+ }
+
+ if( pResource )
+ createAndPositionSubToolBar( rtl::OUString::createFromAscii( pResource ) );
+ return NULL;
+}
+
+/**********************************************************************
+
+**********************************************************************/
+
+SfxPopupWindowType SvxSubToolBoxControl::GetPopupWindowType() const
+{
+ return SFX_POPUPWINDOW_ONCLICK;
+}
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
new file mode 100644
index 000000000000..5a4362592738
--- /dev/null
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -0,0 +1,2860 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+
+#include <string> // HACK: prevent conflict between STLPORT and Workshop headers
+#include <tools/shl.hxx>
+#include <svl/poolitem.hxx>
+#include <svl/eitem.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/bmpacc.hxx>
+#include <svtools/valueset.hxx>
+#include <svtools/ctrlbox.hxx>
+#include <svl/style.hxx>
+#include <svtools/ctrltool.hxx>
+#include <svl/stritem.hxx>
+#include <unotools/pathoptions.hxx>
+#include <sfx2/tplpitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/docfac.hxx>
+#include <sfx2/templdlg.hxx>
+#include <svl/isethint.hxx>
+#include <sfx2/querystatus.hxx>
+#include <sfx2/sfxstatuslistener.hxx>
+#include <tools/urlobj.hxx>
+#include <sfx2/childwin.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <unotools/fontoptions.hxx>
+#include <vcl/mnemonic.hxx>
+
+#include <vcl/svapp.hxx>
+#include <svl/smplhint.hxx>
+
+#define _SVX_TBCONTRL_CXX
+#include <svtools/colorcfg.hxx>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/status/ItemStatus.hpp>
+#include <com/sun/star/frame/status/FontHeight.hpp>
+
+#include <svx/dialogs.hrc>
+#include <svx/svxitems.hrc>
+#include "helpid.hrc"
+#include "svx/htmlmode.hxx"
+#include <svx/xtable.hxx>
+#include "editeng/fontitem.hxx"
+#include <editeng/fhgtitem.hxx>
+#include <editeng/brshitem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/colritem.hxx>
+#include "editeng/flstitem.hxx"
+#include "editeng/bolnitem.hxx"
+#include "svx/drawitem.hxx"
+#include <svx/tbcontrl.hxx>
+#include "svx/dlgutil.hxx"
+#include <svx/dialmgr.hxx>
+#include "colorwindow.hxx"
+#include <memory>
+
+#include <svx/tbxcolorupdate.hxx>
+#include <editeng/eerdll.hxx>
+#include <editeng/editrids.hrc>
+
+// ------------------------------------------------------------------------
+
+#define MAX_MRU_FONTNAME_ENTRIES 5
+#define LOGICAL_EDIT_HEIGHT 12
+
+// STATIC DATA -----------------------------------------------------------
+
+#ifndef DELETEZ
+#define DELETEZ(p) (delete (p), (p)=NULL)
+#endif
+// don't make more than 15 entries visible at once
+#define MAX_STYLES_ENTRIES static_cast< sal_uInt16 >( 15 )
+
+void lcl_ResizeValueSet( Window &rWin, ValueSet &rValueSet );
+void lcl_CalcSizeValueSet( Window &rWin, ValueSet &rValueSet, const Size &aItemSize );
+sal_Bool lcl_FontChangedHint( const SfxHint &rHint );
+
+// namespaces
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+
+SFX_IMPL_TOOLBOX_CONTROL( SvxStyleToolBoxControl, SfxTemplateItem );
+SFX_IMPL_TOOLBOX_CONTROL( SvxFontNameToolBoxControl, SvxFontItem );
+SFX_IMPL_TOOLBOX_CONTROL( SvxFontColorToolBoxControl, SvxColorItem );
+SFX_IMPL_TOOLBOX_CONTROL( SvxFontColorExtToolBoxControl, SvxColorItem );
+SFX_IMPL_TOOLBOX_CONTROL( SvxColorToolBoxControl, SvxColorItem );
+SFX_IMPL_TOOLBOX_CONTROL( SvxFrameToolBoxControl, SvxBoxItem );
+SFX_IMPL_TOOLBOX_CONTROL( SvxFrameLineStyleToolBoxControl, SvxLineItem );
+SFX_IMPL_TOOLBOX_CONTROL( SvxFrameLineColorToolBoxControl, SvxColorItem );
+SFX_IMPL_TOOLBOX_CONTROL( SvxReloadControllerItem, SfxBoolItem );
+SFX_IMPL_TOOLBOX_CONTROL( SvxSimpleUndoRedoController, SfxStringItem );
+
+//========================================================================
+// class SvxStyleBox_Impl -----------------------------------------------------
+//========================================================================
+
+
+class SvxStyleBox_Impl : public ComboBox
+{
+ using Window::IsVisible;
+public:
+ SvxStyleBox_Impl( Window* pParent, sal_uInt16 nSlot, const OUString& rCommand, SfxStyleFamily eFamily, const Reference< XDispatchProvider >& rDispatchProvider,
+ const Reference< XFrame >& _xFrame,const String& rClearFormatKey, const String& rMoreKey, sal_Bool bInSpecialMode );
+ ~SvxStyleBox_Impl();
+
+ void SetFamily( SfxStyleFamily eNewFamily );
+ inline sal_Bool IsVisible() { return bVisible; }
+
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ virtual long Notify( NotifyEvent& rNEvt );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ virtual void StateChanged( StateChangedType nStateChange );
+
+ inline void SetVisibilityListener( const Link& aVisListener ) { aVisibilityListener = aVisListener; }
+ inline void RemoveVisibilityListener() { aVisibilityListener = Link(); }
+
+ void SetDefaultStyle( const ::rtl::OUString& rDefault ) { sDefaultStyle = rDefault; }
+ DECL_STATIC_LINK( SvxStyleBox_Impl, FocusHdl_Impl, Control* );
+
+protected:
+ virtual void Select();
+
+private:
+ sal_uInt16 nSlotId;
+ SfxStyleFamily eStyleFamily;
+ sal_uInt16 nCurSel;
+ sal_Bool bRelease;
+ Size aLogicalSize;
+ Link aVisibilityListener;
+ sal_Bool bVisible;
+ Reference< XDispatchProvider > m_xDispatchProvider;
+ Reference< XFrame > m_xFrame;
+ OUString m_aCommand;
+ String aClearFormatKey;
+ String aMoreKey;
+ String sDefaultStyle;
+ sal_Bool bInSpecialMode;
+
+ void ReleaseFocus();
+};
+
+//========================================================================
+// class SvxFontNameBox --------------------------------------------------
+//========================================================================
+
+class SvxFontNameBox_Impl : public FontNameBox
+{
+ using Window::Update;
+private:
+ const FontList* pFontList;
+ ::std::auto_ptr<FontList> m_aOwnFontList;
+ Font aCurFont;
+ Size aLogicalSize;
+ String aCurText;
+ sal_uInt16 nFtCount;
+ sal_Bool bRelease;
+ Reference< XDispatchProvider > m_xDispatchProvider;
+ Reference< XFrame > m_xFrame;
+
+ void ReleaseFocus_Impl();
+ void EnableControls_Impl();
+
+protected:
+ virtual void Select();
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+public:
+ SvxFontNameBox_Impl( Window* pParent, const Reference< XDispatchProvider >& rDispatchProvider,const Reference< XFrame >& _xFrame
+ , WinBits nStyle = WB_SORT
+ );
+
+ void FillList();
+ void Update( const SvxFontItem* pFontItem );
+ sal_uInt16 GetListCount() { return nFtCount; }
+ void Clear() { FontNameBox::Clear(); nFtCount = 0; }
+ void Fill( const FontList* pList )
+ { FontNameBox::Fill( pList );
+ nFtCount = pList->GetFontNameCount(); }
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ virtual long Notify( NotifyEvent& rNEvt );
+ virtual Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+ inline void SetOwnFontList(::std::auto_ptr<FontList> _aOwnFontList) { m_aOwnFontList = _aOwnFontList; }
+};
+
+//========================================================================
+// class SvxFrameWindow_Impl --------------------------------------------------
+//========================================================================
+
+// fuer den SelectHdl werden die Modifier gebraucht, also
+// muss man sie im MouseButtonUp besorgen
+
+class SvxFrmValueSet_Impl : public ValueSet
+{
+ sal_uInt16 nModifier;
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+public:
+ SvxFrmValueSet_Impl(Window* pParent, WinBits nWinStyle)
+ : ValueSet(pParent, nWinStyle), nModifier(0) {}
+ sal_uInt16 GetModifier() const {return nModifier;}
+
+};
+
+void SvxFrmValueSet_Impl::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ nModifier = rMEvt.GetModifier();
+ ValueSet::MouseButtonUp(rMEvt);
+}
+
+class SvxFrameWindow_Impl : public SfxPopupWindow
+{
+ using FloatingWindow::StateChanged;
+
+private:
+ SvxFrmValueSet_Impl aFrameSet;
+ ImageList aImgList;
+ sal_Bool bParagraphMode;
+
+#if _SOLAR__PRIVATE
+ DECL_LINK( SelectHdl, void * );
+#endif
+
+protected:
+ virtual void Resize();
+ virtual sal_Bool Close();
+ virtual Window* GetPreferredKeyInputWindow();
+ virtual void GetFocus();
+
+public:
+ SvxFrameWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, Window* pParentWindow );
+ ~SvxFrameWindow_Impl();
+ void StartSelection();
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ virtual SfxPopupWindow* Clone() const;
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ inline sal_Bool IsHighContrast( void ) const;
+};
+
+inline sal_Bool SvxFrameWindow_Impl::IsHighContrast( void ) const
+{
+ return GetSettings().GetStyleSettings().GetHighContrastMode();
+}
+
+//========================================================================
+// class SvxLineWindow_Impl ---------------------------------------------------
+//========================================================================
+class SvxLineWindow_Impl : public SfxPopupWindow
+{
+private:
+ ValueSet aLineSet;
+ bool m_bIsWriter;
+
+#if _SOLAR__PRIVATE
+ void MakeLineBitmap( sal_uInt16 nNo, Bitmap& rBmp, const Size& rSize, String& rStr,
+ const ::Color& rLine, const ::Color& rBack );
+ DECL_LINK( SelectHdl, void * );
+#endif
+
+protected:
+ virtual void Resize();
+ virtual sal_Bool Close();
+ virtual Window* GetPreferredKeyInputWindow();
+ virtual void GetFocus();
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ void CreateBitmaps( void );
+public:
+ SvxLineWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, Window* pParentWindow );
+
+ void StartSelection();
+ virtual SfxPopupWindow* Clone() const;
+};
+
+//########################################################################
+// Hilfsklassen:
+//========================================================================
+// class SfxStyleControllerItem ------------------------------------------
+//========================================================================
+class SvxStyleToolBoxControl;
+
+class SfxStyleControllerItem_Impl : public SfxStatusListener
+{
+ public:
+ SfxStyleControllerItem_Impl( const Reference< XDispatchProvider >& rDispatchProvider,
+ sal_uInt16 nSlotId,
+ const rtl::OUString& rCommand,
+ SvxStyleToolBoxControl& rTbxCtl );
+
+ protected:
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+
+ private:
+ SvxStyleToolBoxControl& rControl;
+};
+
+//========================================================================
+// class SvxStyleBox_Impl -----------------------------------------------------
+//========================================================================
+
+SvxStyleBox_Impl::SvxStyleBox_Impl(
+ Window* pParent,
+ sal_uInt16 nSlot,
+ const rtl::OUString& rCommand,
+ SfxStyleFamily eFamily,
+ const Reference< XDispatchProvider >& rDispatchProvider,
+ const Reference< XFrame >& _xFrame,
+ const String& rClearFormatKey,
+ const String& rMoreKey,
+ sal_Bool bInSpec) :
+
+ ComboBox( pParent, SVX_RES( RID_SVXTBX_STYLE ) ),
+
+ nSlotId ( nSlot ),
+ eStyleFamily( eFamily ),
+ bRelease ( sal_True ),
+ bVisible(sal_False),
+ m_xDispatchProvider( rDispatchProvider ),
+ m_xFrame(_xFrame),
+ m_aCommand ( rCommand ),
+ aClearFormatKey ( rClearFormatKey ),
+ aMoreKey ( rMoreKey ),
+ bInSpecialMode ( bInSpec )
+{
+ aLogicalSize = PixelToLogic( GetSizePixel(), MAP_APPFONT );
+ EnableAutocomplete( sal_True );
+}
+
+SvxStyleBox_Impl::~SvxStyleBox_Impl()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SvxStyleBox_Impl::ReleaseFocus()
+{
+ if ( !bRelease )
+ {
+ bRelease = sal_True;
+ return;
+ }
+ if ( m_xFrame.is() && m_xFrame->getContainerWindow().is() )
+ m_xFrame->getContainerWindow()->setFocus();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxStyleBox_Impl::Select()
+{
+ // Tell base class about selection so that AT get informed about it.
+ ComboBox::Select();
+
+ if ( !IsTravelSelect() )
+ {
+ String aSelEntry( GetText() );
+ bool bDoIt = true, bClear = false;
+ if( bInSpecialMode )
+ {
+ if( aSelEntry == aClearFormatKey && GetSelectEntryPos() == 0 )
+ {
+ aSelEntry = sDefaultStyle;
+ bClear = true;
+ //not only apply default style but also call 'ClearFormatting'
+ Sequence< PropertyValue > aEmptyVals;
+ SfxToolBoxControl::Dispatch( m_xDispatchProvider, String::CreateFromAscii(".uno:ResetAttributes"),
+ aEmptyVals);
+ }
+ else if( aSelEntry == aMoreKey && GetSelectEntryPos() == ( GetEntryCount() - 1 ) )
+ {
+ SfxViewFrame* pViewFrm = SfxViewFrame::Current();
+ DBG_ASSERT( pViewFrm, "SvxStyleBox_Impl::Select(): no viewframe" );
+ pViewFrm->ShowChildWindow( SID_STYLE_DESIGNER );
+ SfxChildWindow* pChildWin = pViewFrm->GetChildWindow( SID_STYLE_DESIGNER );
+ if ( pChildWin && pChildWin->GetWindow() )
+ {
+ static_cast< SfxTemplateDialogWrapper* >( pChildWin )->SetParagraphFamily();
+ static_cast< SfxDockingWindow* >( pChildWin->GetWindow() )->AutoShow( sal_True );
+ Application::PostUserEvent(
+ STATIC_LINK( 0, SvxStyleBox_Impl, FocusHdl_Impl ), pChildWin->GetWindow() );
+ }
+ bDoIt = false;
+ }
+ }
+
+ // #i36723# after ReleaseFocus() the new entry is included into the List
+ sal_Bool bCreateNew = GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND;
+
+ /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call.
+ This instance may be deleted in the meantime (i.e. when a dialog is opened
+ while in Dispatch()), accessing members will crash in this case. */
+ ReleaseFocus();
+
+ if( bDoIt )
+ {
+ if ( bClear )
+ SetText( aSelEntry );
+ SaveValue();
+
+ Sequence< PropertyValue > aArgs( 2 );
+ aArgs[0].Value = makeAny( OUString( aSelEntry ) );
+ aArgs[1].Name = OUString::createFromAscii( "Family" );
+ aArgs[1].Value = makeAny( sal_Int16( eStyleFamily ));
+ if( bCreateNew )
+ {
+ aArgs[0].Name = OUString::createFromAscii( "Param" );
+ SfxToolBoxControl::Dispatch( m_xDispatchProvider, String::CreateFromAscii(".uno:StyleNewByExample"), aArgs);
+ }
+ else
+ {
+ aArgs[0].Name = OUString::createFromAscii( "Template" );
+ SfxToolBoxControl::Dispatch( m_xDispatchProvider, m_aCommand, aArgs );
+ }
+ }
+ }
+}
+// -----------------------------------------------------------------------
+
+void SvxStyleBox_Impl::SetFamily( SfxStyleFamily eNewFamily )
+{
+ eStyleFamily = eNewFamily;
+}
+
+// -----------------------------------------------------------------------
+
+long SvxStyleBox_Impl::PreNotify( NotifyEvent& rNEvt )
+{
+ sal_uInt16 nType = rNEvt.GetType();
+
+ if ( EVENT_MOUSEBUTTONDOWN == nType || EVENT_GETFOCUS == nType )
+ nCurSel = GetSelectEntryPos();
+ else if ( EVENT_LOSEFOCUS == nType )
+ {
+ // don't handle before our Select() is called
+ if ( !HasFocus() && !HasChildPathFocus() )
+ SetText( GetSavedValue() );
+ }
+ return ComboBox::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+long SvxStyleBox_Impl::Notify( NotifyEvent& rNEvt )
+{
+ long nHandled = 0;
+
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ sal_uInt16 nCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
+
+ switch ( nCode )
+ {
+ case KEY_RETURN:
+ case KEY_TAB:
+ {
+ if ( KEY_TAB == nCode )
+ bRelease = sal_False;
+ else
+ nHandled = 1;
+ Select();
+ break;
+ }
+
+ case KEY_ESCAPE:
+ SelectEntryPos( nCurSel );
+ ReleaseFocus();
+ nHandled = 1;
+ break;
+ }
+ }
+ return nHandled ? nHandled : ComboBox::Notify( rNEvt );
+}
+/* -----------------------------08.03.2002 13:03------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxStyleBox_Impl::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ SetSizePixel(LogicToPixel(aLogicalSize, MAP_APPFONT));
+ Size aDropSize( aLogicalSize.Width(), LOGICAL_EDIT_HEIGHT);
+ SetDropDownSizePixel(LogicToPixel(aDropSize, MAP_APPFONT));
+ }
+
+ ComboBox::DataChanged( rDCEvt );
+}
+
+void SvxStyleBox_Impl::StateChanged( StateChangedType nStateChange )
+{
+ ComboBox::StateChanged( nStateChange );
+
+ if ( nStateChange == STATE_CHANGE_VISIBLE )
+ {
+ bVisible = IsReallyVisible();
+ if ( aVisibilityListener.IsSet() )
+ aVisibilityListener.Call( this );
+ }
+ else if ( nStateChange == STATE_CHANGE_INITSHOW )
+ {
+ bVisible = sal_True;
+ if ( aVisibilityListener.IsSet() )
+ aVisibilityListener.Call( this );
+ }
+}
+
+//--------------------------------------------------------------------
+
+IMPL_STATIC_LINK( SvxStyleBox_Impl, FocusHdl_Impl, Control*, _pCtrl )
+{
+ (void)pThis;
+ if ( _pCtrl )
+ _pCtrl->GrabFocus();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool GetDocFontList_Impl( const FontList** ppFontList, SvxFontNameBox_Impl* pBox )
+{
+ sal_Bool bChanged = sal_False;
+ const SfxObjectShell* pDocSh = SfxObjectShell::Current();
+ SvxFontListItem* pFontListItem = NULL;
+
+ if ( pDocSh )
+ pFontListItem =
+ (SvxFontListItem*)pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
+ else
+ {
+ ::std::auto_ptr<FontList> aFontList(new FontList( pBox ));
+ *ppFontList = aFontList.get();
+ pBox->SetOwnFontList(aFontList);
+ bChanged = sal_True;
+ }
+
+ if ( pFontListItem )
+ {
+ const FontList* pNewFontList = pFontListItem->GetFontList();
+ DBG_ASSERT( pNewFontList, "Doc-FontList not available!" );
+
+ // keine alte Liste, aber neue Liste
+ if ( !*ppFontList && pNewFontList )
+ {
+ // => "ubernehmen
+ *ppFontList = pNewFontList;
+ bChanged = sal_True;
+ }
+ else
+ {
+ // Vergleich der Fontlisten ist nicht vollkommen
+ // wird die Fontliste am Doc geaendert, kann man hier
+ // nur ueber die Listbox Aenderungen feststellen, weil
+ // ppFontList dabei schon upgedatet wurde
+ bChanged =
+ ( ( *ppFontList != pNewFontList ) ||
+ pBox->GetListCount() != pNewFontList->GetFontNameCount() );
+ HACK(vergleich ist unvollstaendig)
+
+ if ( bChanged )
+ *ppFontList = pNewFontList;
+ }
+
+ if ( pBox )
+ pBox->Enable();
+ }
+ else if ( pBox && ( pDocSh || ( !pDocSh && !ppFontList )))
+ {
+ // Disable box only when we have a SfxObjectShell and didn't get a font list OR
+ // we don't have a SfxObjectShell and no current font list.
+ // It's possible that we currently have no SfxObjectShell, but a current font list.
+ // See #i58471: When a user set the focus into the font name combo box and opens
+ // the help window with F1. After closing the help window, we disable the font name
+ // combo box. The SfxObjectShell::Current() method returns in that case zero. But the
+ // font list hasn't changed and therefore the combo box shouldn't be disabled!
+ pBox->Disable();
+ }
+
+ // in die FontBox ggf. auch die neue Liste f"ullen
+ if ( pBox && bChanged )
+ {
+ if ( *ppFontList )
+ pBox->Fill( *ppFontList );
+ else
+ pBox->Clear();
+ }
+ return bChanged;
+}
+
+//========================================================================
+// class SvxFontNameBox_Impl --------------------------------------------------
+//========================================================================
+
+SvxFontNameBox_Impl::SvxFontNameBox_Impl( Window* pParent, const Reference< XDispatchProvider >& rDispatchProvider,const Reference< XFrame >& _xFrame, WinBits nStyle ) :
+
+ FontNameBox ( pParent, nStyle | WinBits( WB_DROPDOWN | WB_AUTOHSCROLL ) ),
+ pFontList ( NULL ),
+ aLogicalSize ( 75,160 ),
+ nFtCount ( 0 ),
+ bRelease ( sal_True ),
+ m_xDispatchProvider( rDispatchProvider ),
+ m_xFrame (_xFrame)
+{
+ SetSizePixel(LogicToPixel( aLogicalSize, MAP_APPFONT ));
+ EnableControls_Impl();
+}
+// -----------------------------------------------------------------------
+
+void SvxFontNameBox_Impl::FillList()
+{
+ // alte Selektion merken, und am Ende wieder setzen
+ Selection aOldSel = GetSelection();
+ // hat sich Doc-Fontlist geaendert?
+ GetDocFontList_Impl( &pFontList, this );
+ aCurText = GetText();
+ SetSelection( aOldSel );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontNameBox_Impl::Update( const SvxFontItem* pFontItem )
+{
+ if ( pFontItem )
+ {
+ aCurFont.SetName ( pFontItem->GetFamilyName() );
+ aCurFont.SetFamily ( pFontItem->GetFamily() );
+ aCurFont.SetStyleName ( pFontItem->GetStyleName() );
+ aCurFont.SetPitch ( pFontItem->GetPitch() );
+ aCurFont.SetCharSet ( pFontItem->GetCharSet() );
+ }
+ String aCurName = aCurFont.GetName();
+ if ( GetText() != aCurName )
+ SetText( aCurName );
+}
+
+// -----------------------------------------------------------------------
+
+long SvxFontNameBox_Impl::PreNotify( NotifyEvent& rNEvt )
+{
+ sal_uInt16 nType = rNEvt.GetType();
+
+ if ( EVENT_MOUSEBUTTONDOWN == nType || EVENT_GETFOCUS == nType )
+ {
+ EnableControls_Impl();
+ FillList();
+ }
+ return FontNameBox::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+long SvxFontNameBox_Impl::Notify( NotifyEvent& rNEvt )
+{
+ long nHandled = 0;
+
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ sal_uInt16 nCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
+
+ switch ( nCode )
+ {
+ case KEY_RETURN:
+ case KEY_TAB:
+ {
+ if ( KEY_TAB == nCode )
+ bRelease = sal_False;
+ else
+ nHandled = 1;
+ Select();
+ break;
+ }
+
+ case KEY_ESCAPE:
+ SetText( aCurText );
+ ReleaseFocus_Impl();
+ break;
+ }
+ }
+ else if ( EVENT_LOSEFOCUS == rNEvt.GetType() )
+ {
+ Window* pFocusWin = Application::GetFocusWindow();
+ if ( !HasFocus() && GetSubEdit() != pFocusWin )
+ SetText( GetSavedValue() );
+ }
+
+ return nHandled ? nHandled : FontNameBox::Notify( rNEvt );
+}
+
+// ---------------------------------------------------------------------------
+void SvxFontNameBox_Impl::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ SetSizePixel(LogicToPixel(aLogicalSize, MAP_APPFONT));
+ Size aDropSize( aLogicalSize.Width(), LOGICAL_EDIT_HEIGHT);
+ SetDropDownSizePixel(LogicToPixel(aDropSize, MAP_APPFONT));
+ }
+
+ FontNameBox::DataChanged( rDCEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontNameBox_Impl::ReleaseFocus_Impl()
+{
+ if ( !bRelease )
+ {
+ bRelease = sal_True;
+ return;
+ }
+ if ( m_xFrame.is() && m_xFrame->getContainerWindow().is() )
+ m_xFrame->getContainerWindow()->setFocus();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontNameBox_Impl::EnableControls_Impl()
+{
+ SvtFontOptions aFontOpt;
+ sal_Bool bEnable = aFontOpt.IsFontHistoryEnabled();
+ sal_uInt16 nEntries = bEnable ? MAX_MRU_FONTNAME_ENTRIES : 0;
+ if ( GetMaxMRUCount() != nEntries )
+ {
+ // refill in the next GetFocus-Handler
+ pFontList = NULL;
+ Clear();
+ SetMaxMRUCount( nEntries );
+ }
+
+ bEnable = aFontOpt.IsFontWYSIWYGEnabled();
+ EnableWYSIWYG( bEnable );
+ EnableSymbols( bEnable );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontNameBox_Impl::Select()
+{
+ FontNameBox::Select();
+
+ if ( !IsTravelSelect() )
+ {
+ if ( pFontList )
+ {
+ FontInfo aInfo( pFontList->Get( GetText(),
+ aCurFont.GetWeight(),
+ aCurFont.GetItalic() ) );
+ aCurFont = aInfo;
+
+ SvxFontItem aFontItem( aInfo.GetFamily(),
+ aInfo.GetName(),
+ aInfo.GetStyleName(),
+ aInfo.GetPitch(),
+ aInfo.GetCharSet(),
+ SID_ATTR_CHAR_FONT );
+
+ Any a;
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" ));
+ aFontItem.QueryValue( a );
+ aArgs[0].Value = a;
+
+ // #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call.
+ // This instance may be deleted in the meantime (i.e. when a dialog is opened
+ // while in Dispatch()), accessing members will crash in this case.
+ ReleaseFocus_Impl();
+
+ SfxToolBoxControl::Dispatch( m_xDispatchProvider,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharFontName" )),
+ aArgs );
+ }
+ else
+ ReleaseFocus_Impl();
+ }
+}
+
+//========================================================================
+// class SvxColorWindow_Impl --------------------------------------------------
+//========================================================================
+#ifndef WB_NO_DIRECTSELECT
+#define WB_NO_DIRECTSELECT ((WinBits)0x04000000)
+#endif
+
+#define PALETTE_X 10
+#define PALETTE_Y 11
+#define PALETTE_SIZE (PALETTE_X * PALETTE_Y)
+
+SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand,
+ sal_uInt16 nSlotId,
+ const Reference< XFrame >& rFrame,
+ const String& rWndTitle,
+ Window* pParentWindow ) :
+
+ SfxPopupWindow( nSlotId, rFrame, pParentWindow, WinBits( WB_BORDER | WB_STDFLOATWIN | WB_3DLOOK|WB_DIALOGCONTROL ) ),
+
+ theSlotId( nSlotId ),
+ aColorSet( this, WinBits( WB_ITEMBORDER | WB_NAMEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT) ),
+ maCommand( rCommand )
+
+{
+ SfxObjectShell* pDocSh = SfxObjectShell::Current();
+ const SfxPoolItem* pItem = NULL;
+ XColorTable* pColorTable = NULL;
+ sal_Bool bKillTable = sal_False;
+ const Size aSize12( 13, 13 );
+
+ if ( pDocSh )
+ if ( 0 != ( pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) )
+ pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable();
+
+ if ( !pColorTable )
+ {
+ pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() );
+ bKillTable = sal_True;
+ }
+
+ if ( SID_ATTR_CHAR_COLOR_BACKGROUND == theSlotId || SID_BACKGROUND_COLOR == theSlotId )
+ {
+ aColorSet.SetStyle( aColorSet.GetStyle() | WB_NONEFIELD );
+ aColorSet.SetText( SVX_RESSTR( RID_SVXSTR_TRANSPARENT ) );
+ }
+ else if ( SID_ATTR_CHAR_COLOR == theSlotId || SID_ATTR_CHAR_COLOR2 == theSlotId || SID_EXTRUSION_3D_COLOR == theSlotId )
+ {
+ SfxPoolItem* pDummy;
+
+ Reference< XDispatchProvider > aDisp( GetFrame()->getController(), UNO_QUERY );
+ SfxQueryStatus aQueryStatus( aDisp,
+ SID_ATTR_AUTO_COLOR_INVALID,
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AutoColorInvalid" )));
+ SfxItemState eState = aQueryStatus.QueryState( pDummy );
+ if( (SFX_ITEM_DEFAULT > eState) || ( SID_EXTRUSION_3D_COLOR == theSlotId ) )
+ {
+ aColorSet.SetStyle( aColorSet.GetStyle() | WB_NONEFIELD );
+ aColorSet.SetText( SVX_RESSTR( RID_SVXSTR_AUTOMATIC ) );
+ }
+ }
+
+ if ( pColorTable )
+ {
+ short i = 0;
+ long nCount = pColorTable->Count();
+ XColorEntry* pEntry = NULL;
+ ::Color aColWhite( COL_WHITE );
+ String aStrWhite( EditResId(RID_SVXITEMS_COLOR_WHITE) );
+
+ if ( nCount > PALETTE_SIZE )
+ // Show scrollbar if more than PALLETTE_SIZE colors are available
+ aColorSet.SetStyle( aColorSet.GetStyle() | WB_VSCROLL );
+
+ for ( i = 0; i < nCount; i++ )
+ {
+ pEntry = pColorTable->GetColor(i);
+ aColorSet.InsertItem( i+1, pEntry->GetColor(), pEntry->GetName() );
+ }
+
+ while ( i < PALETTE_SIZE )
+ {
+ // fill empty elements if less then PALLETTE_SIZE colors are available
+ aColorSet.InsertItem( i+1, aColWhite, aStrWhite );
+ i++;
+ }
+ }
+
+ aColorSet.SetSelectHdl( LINK( this, SvxColorWindow_Impl, SelectHdl ) );
+ aColorSet.SetColCount( PALETTE_X );
+ aColorSet.SetLineCount( PALETTE_Y );
+
+ lcl_CalcSizeValueSet( *this, aColorSet, aSize12 );
+
+ SetHelpId( HID_POPUP_COLOR );
+ aColorSet.SetHelpId( HID_POPUP_COLOR_CTRL );
+
+ SetText( rWndTitle );
+ aColorSet.Show();
+
+ AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ColorTableState" )));
+ if ( bKillTable )
+ delete pColorTable;
+}
+
+SvxColorWindow_Impl::~SvxColorWindow_Impl()
+{
+}
+
+void SvxColorWindow_Impl::KeyInput( const KeyEvent& rKEvt )
+{
+ aColorSet.KeyInput(rKEvt);
+}
+
+SfxPopupWindow* SvxColorWindow_Impl::Clone() const
+{
+ return new SvxColorWindow_Impl( maCommand, theSlotId, GetFrame(), GetText(), GetParent() );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxColorWindow_Impl, SelectHdl, void *, EMPTYARG )
+{
+ sal_uInt16 nItemId = aColorSet.GetSelectItemId();
+ SvxColorItem aColorItem( aColorSet.GetItemColor( nItemId ), theSlotId );
+
+ /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() calls.
+ This instance may be deleted in the meantime (i.e. when a dialog is opened
+ while in Dispatch()), accessing members will crash in this case. */
+ aColorSet.SetNoSelection();
+
+ if ( IsInPopupMode() )
+ EndPopupMode();
+
+ if ( !nItemId && ( SID_ATTR_CHAR_COLOR_BACKGROUND == theSlotId || SID_BACKGROUND_COLOR == theSlotId ) )
+ {
+ Sequence< PropertyValue > aArgs;
+ SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ),
+ maCommand,
+ aArgs );
+ }
+ else if ( !nItemId && (SID_ATTR_CHAR_COLOR == theSlotId || SID_ATTR_CHAR_COLOR2 == theSlotId || SID_EXTRUSION_3D_COLOR == theSlotId) )
+ {
+ SvxColorItem _aColorItem( COL_AUTO, theSlotId );
+ INetURLObject aObj( maCommand );
+
+ Any a;
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = aObj.GetURLPath();
+ _aColorItem.QueryValue( a );
+ aArgs[0].Value = a;
+ SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ),
+ maCommand,
+ aArgs );
+ }
+ else
+ {
+ INetURLObject aObj( maCommand );
+
+ Any a;
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = aObj.GetURLPath();
+ aColorItem.QueryValue( a );
+ aArgs[0].Value = a;
+ SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ),
+ maCommand,
+ aArgs );
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxColorWindow_Impl::Resize()
+{
+ lcl_ResizeValueSet( *this, aColorSet);
+}
+
+// -----------------------------------------------------------------------
+
+void SvxColorWindow_Impl::StartSelection()
+{
+ aColorSet.StartSelection();
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxColorWindow_Impl::Close()
+{
+ return SfxPopupWindow::Close();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxColorWindow_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+{
+ if (( SFX_ITEM_DISABLED != eState ) && pState )
+ {
+ if (( nSID == SID_COLOR_TABLE ) && ( pState->ISA( SvxColorTableItem )))
+ {
+ XColorTable* pColorTable = pState ? ((SvxColorTableItem *)pState)->GetColorTable() : NULL;
+
+ if ( pColorTable )
+ {
+ // Die Liste der Farben (ColorTable) hat sich ge"andert:
+ short i = 0;
+ long nCount = pColorTable->Count();
+ XColorEntry* pEntry = NULL;
+ ::Color aColWhite( COL_WHITE );
+ String aStrWhite( SVX_RES( RID_SVXITEMS_COLOR_WHITE ) );
+
+ // ScrollBar an oder aus
+ WinBits nBits = aColorSet.GetStyle();
+ if ( nCount > PALETTE_SIZE )
+ nBits &= ~WB_VSCROLL;
+ else
+ nBits |= WB_VSCROLL;
+ aColorSet.SetStyle( nBits );
+
+ for ( i = 0; i < nCount; ++i )
+ {
+ pEntry = pColorTable->GetColor(i);
+ aColorSet.SetItemColor( i + 1, pEntry->GetColor() );
+ aColorSet.SetItemText ( i + 1, pEntry->GetName() );
+ }
+
+ while ( i < PALETTE_SIZE )
+ {
+ aColorSet.SetItemColor( i + 1, aColWhite );
+ aColorSet.SetItemText ( i + 1, aStrWhite );
+ i++;
+ }
+ }
+ }
+ }
+}
+
+//========================================================================
+// class SvxFrameWindow_Impl --------------------------------------------------
+//========================================================================
+
+SvxFrameWindow_Impl::SvxFrameWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, Window* pParentWindow ) :
+
+ SfxPopupWindow( nId, rFrame, pParentWindow, WinBits( WB_BORDER | WB_STDFLOATWIN | WB_3DLOOK | WB_DIALOGCONTROL ) ),
+ aFrameSet ( this, WinBits( WB_ITEMBORDER | WB_DOUBLEBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) ),
+ bParagraphMode(sal_False)
+
+{
+ BindListener();
+ String sCommand(String::CreateFromAscii( ".uno:BorderReducedMode" ));
+ AddStatusListener( sCommand );
+ aImgList = ImageList( SVX_RES( IsHighContrast()? RID_SVXIL_FRAME_HC : RID_SVXIL_FRAME ) );
+
+ /*
+ * 1 2 3 4
+ * -------------------------------------
+ * NONE LEFT RIGHT LEFTRIGHT
+ * TOP BOTTOM TOPBOTTOM OUTER
+ * -------------------------------------
+ * HOR HORINNER VERINNER ALL <- kann ueber bParagraphMode
+ * abgeschaltet werden
+ */
+
+ sal_uInt16 i = 0;
+
+ for ( i=1; i<9; i++ )
+ aFrameSet.InsertItem( i, aImgList.GetImage(i) );
+
+ //bParagraphMode should have been set in StateChanged
+ if ( !bParagraphMode )
+ for ( i = 9; i < 13; i++ )
+ aFrameSet.InsertItem( i, aImgList.GetImage(i) );
+
+ aFrameSet.SetColCount( 4 );
+ aFrameSet.SetSelectHdl( LINK( this, SvxFrameWindow_Impl, SelectHdl ) );
+
+ lcl_CalcSizeValueSet( *this, aFrameSet,Size( 20, 20 ));
+
+ SetHelpId( HID_POPUP_FRAME );
+ SetText( SVX_RESSTR(RID_SVXSTR_FRAME) );
+ aFrameSet.Show();
+}
+/*-- 22.09.2004 12:27:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SvxFrameWindow_Impl::~SvxFrameWindow_Impl()
+{
+ UnbindListener();
+}
+
+SfxPopupWindow* SvxFrameWindow_Impl::Clone() const
+{
+ //! HACK: wie bekomme ich den Paragraph-Mode ??
+ return new SvxFrameWindow_Impl( GetId(), GetFrame(), GetParent() );
+}
+
+Window* SvxFrameWindow_Impl::GetPreferredKeyInputWindow()
+{
+ return &aFrameSet;
+}
+
+void SvxFrameWindow_Impl::GetFocus()
+{
+ aFrameSet.GrabFocus();
+}
+
+void SvxFrameWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SfxPopupWindow::DataChanged( rDCEvt );
+
+ if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
+ {
+ aImgList = ImageList( SVX_RES( IsHighContrast()? RID_SVXIL_FRAME_HC : RID_SVXIL_FRAME ) );
+
+ sal_uInt16 nNumOfItems = aFrameSet.GetItemCount();
+
+ for( sal_uInt16 i = 1 ; i <= nNumOfItems ; ++i )
+ aFrameSet.SetItemImage( i, aImgList.GetImage( i ) );
+ }
+}
+// -----------------------------------------------------------------------
+
+#define FRM_VALID_LEFT 0x01
+#define FRM_VALID_RIGHT 0x02
+#define FRM_VALID_TOP 0x04
+#define FRM_VALID_BOTTOM 0x08
+#define FRM_VALID_HINNER 0x10
+#define FRM_VALID_VINNER 0x20
+#define FRM_VALID_OUTER 0x0f
+#define FRM_VALID_ALL 0xff
+
+//
+// Per default bleiben ungesetzte Linien unveraendert
+// Mit Shift werden ungesetzte Linien zurueckgsetzt
+//
+IMPL_LINK( SvxFrameWindow_Impl, SelectHdl, void *, EMPTYARG )
+{
+ ::Color aColBlack( COL_BLACK );
+ SvxBoxItem aBorderOuter( SID_ATTR_BORDER_OUTER );
+ SvxBoxInfoItem aBorderInner( SID_ATTR_BORDER_INNER );
+ SvxBorderLine theDefLine;
+ SvxBorderLine *pLeft = 0,
+ *pRight = 0,
+ *pTop = 0,
+ *pBottom = 0;
+ sal_uInt16 nSel = aFrameSet.GetSelectItemId();
+ sal_uInt16 nModifier = aFrameSet.GetModifier();
+ sal_uInt8 nValidFlags = 0;
+
+ theDefLine.SetOutWidth( DEF_LINE_WIDTH_0 );
+ switch ( nSel )
+ {
+ case 1: nValidFlags |= FRM_VALID_ALL;
+ break; // NONE
+ case 2: pLeft = &theDefLine;
+ nValidFlags |= FRM_VALID_LEFT;
+ break; // LEFT
+ case 3: pRight = &theDefLine;
+ nValidFlags |= FRM_VALID_RIGHT;
+ break; // RIGHT
+ case 4: pLeft = pRight = &theDefLine;
+ nValidFlags |= FRM_VALID_RIGHT|FRM_VALID_LEFT;
+ break; // LEFTRIGHT
+ case 5: pTop = &theDefLine;
+ nValidFlags |= FRM_VALID_TOP;
+ break; // TOP
+ case 6: pBottom = &theDefLine;
+ nValidFlags |= FRM_VALID_BOTTOM;
+ break; // BOTTOM
+ case 7: pTop = pBottom = &theDefLine;
+ nValidFlags |= FRM_VALID_BOTTOM|FRM_VALID_TOP;
+ break; // TOPBOTTOM
+ case 8: pLeft = pRight = pTop = pBottom = &theDefLine;
+ nValidFlags |= FRM_VALID_OUTER;
+ break; // OUTER
+
+ // Tabelle innen:
+ case 9: // HOR
+ pTop = pBottom = &theDefLine;
+ aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_HORI );
+ aBorderInner.SetLine( NULL, BOXINFO_LINE_VERT );
+ nValidFlags |= FRM_VALID_HINNER|FRM_VALID_TOP|FRM_VALID_BOTTOM;
+ break;
+
+ case 10: // HORINNER
+ pLeft = pRight = pTop = pBottom = &theDefLine;
+ aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_HORI );
+ aBorderInner.SetLine( NULL, BOXINFO_LINE_VERT );
+ nValidFlags |= FRM_VALID_RIGHT|FRM_VALID_LEFT|FRM_VALID_HINNER|FRM_VALID_TOP|FRM_VALID_BOTTOM;
+ break;
+
+ case 11: // VERINNER
+ pLeft = pRight = pTop = pBottom = &theDefLine;
+ aBorderInner.SetLine( NULL, BOXINFO_LINE_HORI );
+ aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_VERT );
+ nValidFlags |= FRM_VALID_RIGHT|FRM_VALID_LEFT|FRM_VALID_VINNER|FRM_VALID_TOP|FRM_VALID_BOTTOM;
+ break;
+
+ case 12: // ALL
+ pLeft = pRight = pTop = pBottom = &theDefLine;
+ aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_HORI );
+ aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_VERT );
+ nValidFlags |= FRM_VALID_ALL;
+ break;
+
+ default:
+ break;
+ }
+ aBorderOuter.SetLine( pLeft, BOX_LINE_LEFT );
+ aBorderOuter.SetLine( pRight, BOX_LINE_RIGHT );
+ aBorderOuter.SetLine( pTop, BOX_LINE_TOP );
+ aBorderOuter.SetLine( pBottom, BOX_LINE_BOTTOM );
+
+ if(nModifier == KEY_SHIFT)
+ nValidFlags |= FRM_VALID_ALL;
+ aBorderInner.SetValid( VALID_TOP, 0 != (nValidFlags&FRM_VALID_TOP ));
+ aBorderInner.SetValid( VALID_BOTTOM, 0 != (nValidFlags&FRM_VALID_BOTTOM ));
+ aBorderInner.SetValid( VALID_LEFT, 0 != (nValidFlags&FRM_VALID_LEFT));
+ aBorderInner.SetValid( VALID_RIGHT, 0 != (nValidFlags&FRM_VALID_RIGHT ));
+ aBorderInner.SetValid( VALID_HORI, 0 != (nValidFlags&FRM_VALID_HINNER ));
+ aBorderInner.SetValid( VALID_VERT, 0 != (nValidFlags&FRM_VALID_VINNER));
+ aBorderInner.SetValid( VALID_DISTANCE, sal_True );
+ aBorderInner.SetValid( VALID_DISABLE, sal_False );
+
+ if ( IsInPopupMode() )
+ EndPopupMode();
+
+ Any a;
+ Sequence< PropertyValue > aArgs( 2 );
+ aArgs[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "OuterBorder" ));
+ aBorderOuter.QueryValue( a );
+ aArgs[0].Value = a;
+ aArgs[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "InnerBorder" ));
+ aBorderInner.QueryValue( a );
+ aArgs[1].Value = a;
+
+ /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call.
+ This instance may be deleted in the meantime (i.e. when a dialog is opened
+ while in Dispatch()), accessing members will crash in this case. */
+ aFrameSet.SetNoSelection();
+
+ SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:SetBorderStyle" )),
+ aArgs );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFrameWindow_Impl::Resize()
+{
+ lcl_ResizeValueSet( *this, aFrameSet);
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFrameWindow_Impl::StateChanged(
+
+ sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+
+{
+ if ( pState && nSID == SID_BORDER_REDUCED_MODE)
+ {
+ const SfxBoolItem* pItem = PTR_CAST( SfxBoolItem, pState );
+
+ if ( pItem )
+ {
+ bParagraphMode = (sal_Bool)pItem->GetValue();
+ //initial calls mustn't insert or remove elements
+ if(aFrameSet.GetItemCount())
+ {
+ sal_Bool bTableMode = ( aFrameSet.GetItemCount() == 12 );
+ sal_Bool bResize = sal_False;
+
+ if ( bTableMode && bParagraphMode )
+ {
+ for ( sal_uInt16 i = 9; i < 13; i++ )
+ aFrameSet.RemoveItem(i);
+ bResize = sal_True;
+ }
+ else if ( !bTableMode && !bParagraphMode )
+ {
+ for ( sal_uInt16 i = 9; i < 13; i++ )
+ aFrameSet.InsertItem( i, aImgList.GetImage(i) );
+ bResize = sal_True;
+ }
+
+ if ( bResize )
+ {
+ lcl_CalcSizeValueSet( *this, aFrameSet,Size( 20, 20 ));
+ }
+ }
+ }
+ }
+ SfxPopupWindow::StateChanged( nSID, eState, pState );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFrameWindow_Impl::StartSelection()
+{
+ aFrameSet.StartSelection();
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxFrameWindow_Impl::Close()
+{
+ return SfxPopupWindow::Close();
+}
+
+//========================================================================
+// class SvxLineWindow_Impl --------------------------------------------------
+//========================================================================
+
+SvxLineWindow_Impl::SvxLineWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, Window* pParentWindow ) :
+
+ SfxPopupWindow( nId, rFrame, pParentWindow, WinBits( WB_BORDER | WB_STDFLOATWIN | WB_3DLOOK | WB_DIALOGCONTROL ) ),
+
+ aLineSet( this, WinBits( WB_3DLOOK | WB_ITEMBORDER | WB_DOUBLEBORDER | WB_NAMEFIELD | WB_NONEFIELD | WB_NO_DIRECTSELECT ) )
+{
+ try
+ {
+ Reference< lang::XServiceInfo > xServices( rFrame->getController()->getModel(), UNO_QUERY_THROW );
+ m_bIsWriter = xServices->supportsService(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument")));
+ }
+ catch(const uno::Exception& )
+ {
+ }
+ Size aBmpSize( 55, 12 );
+ CreateBitmaps();
+
+ aLineSet.SetColCount( 2 );
+ aLineSet.SetSelectHdl( LINK( this, SvxLineWindow_Impl, SelectHdl ) );
+ aLineSet.SetText( SVX_RESSTR(STR_NONE) );
+
+ lcl_CalcSizeValueSet( *this, aLineSet, aBmpSize );
+
+ SetHelpId( HID_POPUP_LINE );
+ SetText( SVX_RESSTR(RID_SVXSTR_FRAME_STYLE) );
+ aLineSet.Show();
+}
+
+SfxPopupWindow* SvxLineWindow_Impl::Clone() const
+{
+ return new SvxLineWindow_Impl( GetId(), GetFrame(), GetParent() );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxLineWindow_Impl::MakeLineBitmap( sal_uInt16 nNo, Bitmap& rBmp, const Size& rSize, String& rStr,
+ const ::Color& rLineCol, const ::Color& rBackCol )
+{
+ VirtualDevice aVirDev( *this );
+ Rectangle aRect( Point(2,0), Size(rSize.Width()-4,0) );
+
+ // grau einfaerben und Bitmap sichern:
+ aVirDev.SetOutputSizePixel( rSize );
+ aVirDev.SetLineColor();
+ aVirDev.SetFillColor( rBackCol );
+ aVirDev.DrawRect( Rectangle( Point(0,0), rSize ) );
+ aVirDev.SetFillColor( rLineCol );
+
+ sal_uInt16 nLineWidth = 0;
+ switch ( nNo )
+ {
+ case 1: // DEF_LINE_WIDTH_0
+ aRect.Top() = 6;
+ aRect.Bottom() = 6;
+ aVirDev.DrawRect( aRect );
+ break;
+
+ case 2: // DEF_LINE_WIDTH_1
+ aRect.Top() = 5;
+ aRect.Bottom() = 6;
+ aVirDev.DrawRect( aRect );
+ nLineWidth = (sal_uInt16) DEF_LINE_WIDTH_1/20;
+ break;
+
+ case 3: // DEF_LINE_WIDTH_2
+ aRect.Top() = 5;
+ aRect.Bottom() = 7;
+ aVirDev.DrawRect( aRect );
+ nLineWidth = (sal_uInt16) DEF_LINE_WIDTH_2/20;
+ break;
+
+ case 4: // DEF_LINE_WIDTH_3
+ aRect.Top() = 4;
+ aRect.Bottom() = 7;
+ aVirDev.DrawRect( aRect );
+ aVirDev.DrawRect( Rectangle( Point(2,4), Point(37,7) ) );
+ nLineWidth = (sal_uInt16) DEF_LINE_WIDTH_3/20;
+ break;
+
+ case 5: // DEF_LINE_WIDTH_4
+ aRect.Top() = 4;
+ aRect.Bottom() = 8;
+ aVirDev.DrawRect( aRect );
+ nLineWidth = (sal_uInt16) DEF_LINE_WIDTH_4/20;
+ break;
+
+ case 6: // DEF_DOUBLE_LINE0
+ aRect.Top() = 5;
+ aRect.Bottom() = 5;
+ aVirDev.DrawRect( aRect );
+ aRect.Top() = 7;
+ aRect.Bottom() = 7;
+ aVirDev.DrawRect( aRect );
+ nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE0_OUT+DEF_DOUBLE_LINE0_IN+DEF_DOUBLE_LINE0_DIST)/20;
+ break;
+
+ case 7: // DEF_DOUBLE_LINE7
+ aRect.Top() = 4;
+ aRect.Bottom() = 4;
+ aVirDev.DrawRect( aRect );
+ aRect.Top() = 7;
+ aRect.Bottom() = 7;
+ aVirDev.DrawRect( aRect );
+ nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE7_OUT+DEF_DOUBLE_LINE7_IN+DEF_DOUBLE_LINE7_DIST)/20;
+ break;
+
+ case 8: // DEF_DOUBLE_LINE1
+ aRect.Top() = 4;
+ aRect.Bottom() = 5;
+ aVirDev.DrawRect( aRect );
+ aRect.Top() = 7;
+ aRect.Bottom() = 8;
+ aVirDev.DrawRect( aRect );
+ nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE1_OUT+DEF_DOUBLE_LINE1_IN+DEF_DOUBLE_LINE1_DIST)/20;
+ break;
+
+ case 9: // DEF_DOUBLE_LINE2
+ aRect.Top() = 3;
+ aRect.Bottom() = 5;
+ aVirDev.DrawRect( aRect );
+ aRect.Top() = 8;
+ aRect.Bottom() = 10;
+ aVirDev.DrawRect( aRect );
+ nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE2_OUT+DEF_DOUBLE_LINE2_IN+DEF_DOUBLE_LINE2_DIST)/20;
+ break;
+
+ case 10: // DEF_DOUBLE_LINE8
+ aRect.Top() = 3;
+ aRect.Bottom() = 4;
+ aVirDev.DrawRect( aRect );
+ aRect.Top() = 7;
+ aRect.Bottom() = 7;
+ aVirDev.DrawRect( aRect );
+ nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE8_OUT+DEF_DOUBLE_LINE8_IN+DEF_DOUBLE_LINE8_DIST)/20;
+ break;
+
+ case 11: // DEF_DOUBLE_LINE9
+ aRect.Top() = 3;
+ aRect.Bottom() = 5;
+ aVirDev.DrawRect( aRect );
+ aRect.Top() = 8;
+ aRect.Bottom() = 8;
+ aVirDev.DrawRect( aRect );
+ nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE9_OUT+DEF_DOUBLE_LINE9_IN+DEF_DOUBLE_LINE9_DIST)/20;
+ break;
+
+ case 12: // DEF_DOUBLE_LINE10
+ aRect.Top() = 2;
+ aRect.Bottom() = 5;
+ aVirDev.DrawRect( aRect );
+ aRect.Top() = 8;
+ aRect.Bottom() = 8;
+ aVirDev.DrawRect( aRect );
+ nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE10_OUT+DEF_DOUBLE_LINE10_IN+DEF_DOUBLE_LINE10_DIST)/20;
+ break;
+
+ case 13: // DEF_DOUBLE_LINE3
+ aRect.Top() = 4;
+ aRect.Bottom() = 5;
+ aVirDev.DrawRect( aRect );
+ aRect.Top() = 7;
+ aRect.Bottom() = 7;
+ aVirDev.DrawRect( aRect );
+ nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE3_OUT+DEF_DOUBLE_LINE3_IN+DEF_DOUBLE_LINE3_DIST)/20;
+ break;
+
+ case 14: // DEF_DOUBLE_LINE4
+ aRect.Top() = 4;
+ aRect.Bottom() = 4;
+ aVirDev.DrawRect( aRect );
+ aRect.Top() = 6;
+ aRect.Bottom() = 7;
+ aVirDev.DrawRect( aRect );
+ nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE4_OUT+DEF_DOUBLE_LINE4_IN+DEF_DOUBLE_LINE4_DIST)/20;
+ break;
+
+ case 15: // DEF_DOUBLE_LINE5
+ aRect.Top() = 3;
+ aRect.Bottom() = 5;
+ aVirDev.DrawRect( aRect );
+ aRect.Top() = 8;
+ aRect.Bottom() = 9;
+ aVirDev.DrawRect( aRect );
+ nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE5_OUT+DEF_DOUBLE_LINE5_IN+DEF_DOUBLE_LINE5_DIST)/20;
+ break;
+
+ case 16: // DEF_DOUBLE_LINE6
+ aRect.Top() = 3;
+ aRect.Bottom() = 4;
+ aVirDev.DrawRect( aRect );
+ aRect.Top() = 7;
+ aRect.Bottom() = 9;
+ aVirDev.DrawRect( aRect );
+ nLineWidth = (sal_uInt16) (DEF_DOUBLE_LINE6_OUT+DEF_DOUBLE_LINE6_IN+DEF_DOUBLE_LINE6_DIST)/20;
+ break;
+
+ default:
+ break;
+ }
+ if ( nLineWidth )
+ {
+ rStr = String::CreateFromInt32( nLineWidth );
+ rStr.AppendAscii(" pt");
+ }
+ rBmp = aVirDev.GetBitmap( Point(0,0), rSize );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxLineWindow_Impl, SelectHdl, void *, EMPTYARG )
+{
+ SvxLineItem aLineItem( SID_FRAME_LINESTYLE );
+ sal_uInt16 n1 = 0,
+ n2 = 0,
+ n3 = 0;
+ sal_Bool bSetLine = sal_True;
+
+ switch ( aLineSet.GetSelectItemId() )
+ {
+ case 1: n1 = DEF_LINE_WIDTH_0; break;
+ case 2: n1 = DEF_LINE_WIDTH_1; break;
+ case 3: n1 = DEF_LINE_WIDTH_2; break;
+ case 4: n1 = DEF_LINE_WIDTH_3; break;
+ case 5: n1 = DEF_LINE_WIDTH_4; break;
+
+ case 6: n1 = DEF_DOUBLE_LINE0_OUT;
+ n2 = DEF_DOUBLE_LINE0_IN;
+ n3 = DEF_DOUBLE_LINE0_DIST; break;
+ case 7: n1 = DEF_DOUBLE_LINE7_OUT;
+ n2 = DEF_DOUBLE_LINE7_IN;
+ n3 = DEF_DOUBLE_LINE7_DIST; break;
+ case 8: n1 = DEF_DOUBLE_LINE1_OUT;
+ n2 = DEF_DOUBLE_LINE1_IN;
+ n3 = DEF_DOUBLE_LINE1_DIST; break;
+ case 9: n1 = DEF_DOUBLE_LINE2_OUT;
+ n2 = DEF_DOUBLE_LINE2_IN;
+ n3 = DEF_DOUBLE_LINE2_DIST; break;
+ case 10: n1 = DEF_DOUBLE_LINE8_OUT;
+ n2 = DEF_DOUBLE_LINE8_IN;
+ n3 = DEF_DOUBLE_LINE8_DIST; break;
+ case 11: n1 = DEF_DOUBLE_LINE9_OUT;
+ n2 = DEF_DOUBLE_LINE9_IN;
+ n3 = DEF_DOUBLE_LINE9_DIST; break;
+ case 12: n1 = DEF_DOUBLE_LINE10_OUT;
+ n2 = DEF_DOUBLE_LINE10_IN;
+ n3 = DEF_DOUBLE_LINE10_DIST; break;
+ case 13: n1 = DEF_DOUBLE_LINE3_OUT;
+ n2 = DEF_DOUBLE_LINE3_IN;
+ n3 = DEF_DOUBLE_LINE3_DIST; break;
+ case 14: n1 = DEF_DOUBLE_LINE4_OUT;
+ n2 = DEF_DOUBLE_LINE4_IN;
+ n3 = DEF_DOUBLE_LINE4_DIST; break;
+ case 15: n1 = DEF_DOUBLE_LINE5_OUT;
+ n2 = DEF_DOUBLE_LINE5_IN;
+ n3 = DEF_DOUBLE_LINE5_DIST; break;
+ case 16: n1 = DEF_DOUBLE_LINE6_OUT;
+ n2 = DEF_DOUBLE_LINE6_IN;
+ n3 = DEF_DOUBLE_LINE6_DIST; break;
+ case 0:
+ default:
+ bSetLine = sal_False;
+ break;
+ }
+ if ( bSetLine )
+ {
+ SvxBorderLine aTmp( NULL, n1, n2, n3 );
+ aLineItem.SetLine( &aTmp );
+ }
+ else
+ aLineItem.SetLine( 0 );
+
+ if ( IsInPopupMode() )
+ EndPopupMode();
+
+ Any a;
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "LineStyle" ));
+ aLineItem.QueryValue( a, m_bIsWriter ? CONVERT_TWIPS : 0 );
+ aArgs[0].Value = a;
+
+ /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call.
+ This instance may be deleted in the meantime (i.e. when a dialog is opened
+ while in Dispatch()), accessing members will crash in this case. */
+ aLineSet.SetNoSelection();
+
+ SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:LineStyle" )),
+ aArgs );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxLineWindow_Impl::Resize()
+{
+ lcl_ResizeValueSet( *this, aLineSet);
+}
+
+// -----------------------------------------------------------------------
+
+void SvxLineWindow_Impl::StartSelection()
+{
+ aLineSet.StartSelection();
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxLineWindow_Impl::Close()
+{
+ return SfxPopupWindow::Close();
+}
+
+// -----------------------------------------------------------------------
+
+Window* SvxLineWindow_Impl::GetPreferredKeyInputWindow()
+{
+ return &aLineSet;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxLineWindow_Impl::GetFocus()
+{
+ aLineSet.GrabFocus();
+}
+
+void SvxLineWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SfxPopupWindow::DataChanged( rDCEvt );
+
+ if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
+ {
+ CreateBitmaps();
+ Invalidate();
+ }
+}
+
+void SvxLineWindow_Impl::CreateBitmaps( void )
+{
+ Size aBmpSize( 55, 12 );
+ Bitmap aBmp;
+ String aStr;
+
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+ svtools::ColorConfig aColorConfig;
+ ::Color aLineCol( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
+ ::Color aBackCol( rStyleSettings.GetWindowColor() );
+ aLineSet.Clear();
+
+ for( sal_uInt16 i = 1 ; i < 17 ; ++i )
+ {
+ MakeLineBitmap( i, aBmp, aBmpSize, aStr, aLineCol, aBackCol );
+ aLineSet.InsertItem( i, aBmp, aStr );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+//########################################################################
+// Hilfsklassen
+
+//========================================================================
+// class SfxStyleControllerItem_Impl ------------------------------------------
+//========================================================================
+
+SfxStyleControllerItem_Impl::SfxStyleControllerItem_Impl(
+ const Reference< XDispatchProvider >& rDispatchProvider,
+ sal_uInt16 nSlotId, // Family-ID
+ const rtl::OUString& rCommand, // .uno: command bound to this item
+ SvxStyleToolBoxControl& rTbxCtl ) // Controller-Instanz, dem dieses Item zugeordnet ist.
+ : SfxStatusListener( rDispatchProvider, nSlotId, rCommand ),
+ rControl( rTbxCtl )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SfxStyleControllerItem_Impl::StateChanged(
+ sal_uInt16, SfxItemState eState, const SfxPoolItem* pState )
+{
+ switch ( GetId() )
+ {
+ case SID_STYLE_FAMILY1:
+ case SID_STYLE_FAMILY2:
+ case SID_STYLE_FAMILY3:
+ case SID_STYLE_FAMILY4:
+ case SID_STYLE_FAMILY5:
+ {
+ const sal_uInt16 nIdx = GetId() - SID_STYLE_FAMILY_START;
+
+ if ( SFX_ITEM_AVAILABLE == eState )
+ {
+ const SfxTemplateItem* pStateItem =
+ PTR_CAST( SfxTemplateItem, pState );
+ DBG_ASSERT( pStateItem != NULL, "SfxTemplateItem expected" );
+ rControl.SetFamilyState( nIdx, pStateItem );
+ }
+ else
+ rControl.SetFamilyState( nIdx, NULL );
+ break;
+ }
+ }
+}
+
+//########################################################################
+
+//========================================================================
+// class SvxStyleToolBoxControl ------------------------------------------
+//========================================================================
+
+struct SvxStyleToolBoxControl::Impl
+{
+ String aClearForm;
+ String aMore;
+ ::std::vector< ::rtl::OUString > aDefaultStyles;
+ sal_Bool bListening;
+ sal_Bool bSpecModeWriter;
+ sal_Bool bSpecModeCalc;
+
+ inline Impl( void )
+ :aClearForm ( SVX_RESSTR( RID_SVXSTR_CLEARFORM ) )
+ ,aMore ( SVX_RESSTR( RID_SVXSTR_MORE ) )
+ ,bListening ( sal_False )
+ ,bSpecModeWriter ( sal_False )
+ ,bSpecModeCalc ( sal_False )
+ {
+
+
+ }
+ void InitializeStyles(Reference < frame::XModel > xModel)
+ {
+ //now convert the default style names to the localized names
+ try
+ {
+ Reference< style::XStyleFamiliesSupplier > xStylesSupplier( xModel, UNO_QUERY_THROW );
+ Reference< lang::XServiceInfo > xServices( xModel, UNO_QUERY_THROW );
+ bSpecModeWriter = xServices->supportsService(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument")));
+ if(bSpecModeWriter)
+ {
+ Reference<container::XNameAccess> xParaStyles;
+ xStylesSupplier->getStyleFamilies()->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles"))) >>=
+ xParaStyles;
+ static const sal_Char* aWriterStyles[] =
+ {
+ "Standard",
+ "Heading 1",
+ "Heading 2",
+ "Heading 3",
+ "Text body"
+ };
+ for( sal_uInt32 nStyle = 0; nStyle < sizeof( aWriterStyles ) / sizeof( sal_Char*); ++nStyle )
+ {
+ try
+ {
+ Reference< beans::XPropertySet > xStyle;
+ xParaStyles->getByName( rtl::OUString::createFromAscii( aWriterStyles[nStyle] )) >>= xStyle;
+ ::rtl::OUString sName;
+ xStyle->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DisplayName"))) >>= sName;
+ if( sName.getLength() )
+ aDefaultStyles.push_back(sName);
+ }
+ catch( const uno::Exception& )
+ {}
+ }
+
+ }
+ else if( 0 != (
+ bSpecModeCalc = xServices->supportsService(::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocument")))))
+ {
+ static const sal_Char* aCalcStyles[] =
+ {
+ "Default",
+ "Heading1",
+ "Result",
+ "Result2"
+ };
+ Reference<container::XNameAccess> xCellStyles;
+ xStylesSupplier->getStyleFamilies()->getByName(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CellStyles"))) >>=
+ xCellStyles;
+ for( sal_uInt32 nStyle = 0; nStyle < sizeof( aCalcStyles ) / sizeof( sal_Char*); ++nStyle )
+ {
+ try
+ {
+ const rtl::OUString sStyleName( rtl::OUString::createFromAscii( aCalcStyles[nStyle] ) );
+ if( xCellStyles->hasByName( sStyleName ) )
+ {
+ Reference< beans::XPropertySet > xStyle( xCellStyles->getByName( sStyleName), UNO_QUERY_THROW );
+ ::rtl::OUString sName;
+ xStyle->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DisplayName"))) >>= sName;
+ if( sName.getLength() )
+ aDefaultStyles.push_back(sName);
+ }
+ }
+ catch( const uno::Exception& )
+ {}
+ }
+ }
+ }
+ catch(const uno::Exception& )
+ {
+ DBG_ERROR("error while initializing style names");
+ }
+ }
+};
+
+
+// mapping table from bound items. BE CAREFUL this table must be in the
+// same order as the uno commands bound to the slots SID_STYLE_FAMILY1..n
+// MAX_FAMILIES must also be correctly set!
+static const char* StyleSlotToStyleCommand[MAX_FAMILIES] =
+{
+ ".uno:CharStyle",
+ ".uno:ParaStyle",
+ ".uno:FrameStyle",
+ ".uno:PageStyle",
+ ".uno:TemplateFamily5"
+};
+
+SvxStyleToolBoxControl::SvxStyleToolBoxControl(
+ sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
+ : SfxToolBoxControl ( nSlotId, nId, rTbx ),
+ pStyleSheetPool ( NULL ),
+ nActFamily ( 0xffff ),
+ bListening ( sal_False ),
+ pImpl ( new Impl )
+{
+ for ( sal_uInt16 i=0; i<MAX_FAMILIES; i++ )
+ {
+ pBoundItems[i] = 0;
+ m_xBoundItems[i] = Reference< XComponent >();
+ pFamilyState[i] = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------
+SvxStyleToolBoxControl::~SvxStyleToolBoxControl()
+{
+}
+
+// -----------------------------------------------------------------------
+void SAL_CALL SvxStyleToolBoxControl::initialize( const Sequence< Any >& aArguments )
+throw ( Exception, RuntimeException)
+{
+ SfxToolBoxControl::initialize( aArguments );
+
+ // After initialize we should have a valid frame member where we can retrieve our
+ // dispatch provider.
+ if ( m_xFrame.is() )
+ {
+ pImpl->InitializeStyles(m_xFrame->getController()->getModel());
+ Reference< XDispatchProvider > xDispatchProvider( m_xFrame->getController(), UNO_QUERY );
+ for ( sal_uInt16 i=0; i<MAX_FAMILIES; i++ )
+ {
+ pBoundItems[i] = new SfxStyleControllerItem_Impl( xDispatchProvider,
+ SID_STYLE_FAMILY_START + i,
+ OUString::createFromAscii( StyleSlotToStyleCommand[i] ),
+ *this );
+ m_xBoundItems[i] = Reference< XComponent >( static_cast< OWeakObject* >( pBoundItems[i] ), UNO_QUERY );
+ pFamilyState[i] = NULL;
+ }
+ }
+}
+
+// XComponent
+void SAL_CALL SvxStyleToolBoxControl::dispose()
+throw (::com::sun::star::uno::RuntimeException)
+{
+ SfxToolBoxControl::dispose();
+
+ for( sal_uInt16 i=0; i<MAX_FAMILIES; i++ )
+ {
+ if ( m_xBoundItems[i].is() )
+ {
+ try
+ {
+ m_xBoundItems[i]->dispose();
+ }
+ catch ( Exception& )
+ {
+ }
+
+ m_xBoundItems[i].clear();
+ pBoundItems[i] = 0;
+ }
+ DELETEZ( pFamilyState[i] );
+ }
+ pStyleSheetPool = NULL;
+ DELETEZ( pImpl );
+}
+
+// -----------------------------------------------------------------------
+void SAL_CALL SvxStyleToolBoxControl::update() throw (RuntimeException)
+{
+ // Do nothing, we will start binding our listener when we are visible.
+ // See link SvxStyleToolBoxControl::VisibilityNotification.
+ SvxStyleBox_Impl* pBox = (SvxStyleBox_Impl*)GetToolBox().GetItemWindow( GetId() );
+ if ( pBox->IsVisible() )
+ {
+ for ( int i=0; i<MAX_FAMILIES; i++ )
+ pBoundItems [i]->ReBind();
+
+ bindListener();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SfxStyleFamily SvxStyleToolBoxControl::GetActFamily()
+{
+ switch ( nActFamily-1 + SID_STYLE_FAMILY_START )
+ {
+ case SID_STYLE_FAMILY1: return SFX_STYLE_FAMILY_CHAR;
+ case SID_STYLE_FAMILY2: return SFX_STYLE_FAMILY_PARA;
+ case SID_STYLE_FAMILY3: return SFX_STYLE_FAMILY_FRAME;
+ case SID_STYLE_FAMILY4: return SFX_STYLE_FAMILY_PAGE;
+ case SID_STYLE_FAMILY5: return SFX_STYLE_FAMILY_PSEUDO;
+ default:
+ DBG_ERROR( "unknown style family" );
+ break;
+ }
+ return SFX_STYLE_FAMILY_PARA;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxStyleToolBoxControl::FillStyleBox()
+{
+ SvxStyleBox_Impl* pBox = (SvxStyleBox_Impl*)GetToolBox().GetItemWindow( GetId() );
+
+ DBG_ASSERT( pStyleSheetPool, "StyleSheetPool not found!" );
+ DBG_ASSERT( pBox, "Control not found!" );
+
+ if ( pStyleSheetPool && pBox && nActFamily!=0xffff )
+ {
+ const SfxStyleFamily eFamily = GetActFamily();
+ sal_uInt16 nCount = pStyleSheetPool->Count();
+ sal_uInt16 i = 0;
+ SfxStyleSheetBase* pStyle = NULL;
+ sal_Bool bDoFill = sal_False;
+
+ pStyleSheetPool->SetSearchMask( eFamily, SFXSTYLEBIT_USED );
+
+ //------------------------------
+ // Ueberpruefen, ob Fill noetig:
+ //------------------------------
+
+ pStyle = pStyleSheetPool->First();
+ //!!! TODO: This condition isn't right any longer, because we always show some default entries
+ //!!! so the list doesn't show the count
+ if ( nCount != pBox->GetEntryCount() )
+ {
+ bDoFill = sal_True;
+ }
+ else
+ {
+ while ( pStyle && !bDoFill )
+ {
+ bDoFill = ( pBox->GetEntry(i) != pStyle->GetName() );
+ pStyle = pStyleSheetPool->Next();
+ i++;
+ }
+ }
+
+ if ( bDoFill )
+ {
+ pBox->SetUpdateMode( sal_False );
+ pBox->Clear();
+
+ {
+ sal_uInt16 _i;
+ sal_uInt32 nCnt = pImpl->aDefaultStyles.size();
+ bool bInsert;
+
+ pStyle = pStyleSheetPool->First();
+
+ if( pImpl->bSpecModeWriter || pImpl->bSpecModeCalc )
+ {
+ while ( pStyle )
+ {
+ // sort out default styles
+ bInsert = true;
+ ::rtl::OUString aName( pStyle->GetName() );
+ for( _i = 0 ; _i < nCnt ; ++_i )
+ {
+ if( pImpl->aDefaultStyles[_i] == aName )
+ {
+ bInsert = false;
+ break;
+ }
+ }
+
+ if( bInsert )
+ pBox->InsertEntry( aName );
+ pStyle = pStyleSheetPool->Next();
+ }
+ }
+ else
+ {
+ while ( pStyle )
+ {
+ pBox->InsertEntry( pStyle->GetName() );
+ pStyle = pStyleSheetPool->Next();
+ }
+ }
+ }
+
+ if( pImpl->bSpecModeWriter || pImpl->bSpecModeCalc )
+ {
+ // insert default styles
+ sal_uInt16 _i;
+ sal_uInt32 nCnt = pImpl->aDefaultStyles.size();
+ sal_uInt16 nPos = 1;
+ for( _i = 0 ; _i < nCnt ; ++_i )
+ {
+ pBox->InsertEntry( pImpl->aDefaultStyles[_i], nPos );
+ ++nPos;
+ }
+
+ // disable sort to preserve special order
+ WinBits nWinBits = pBox->GetStyle();
+ nWinBits &= ~WB_SORT;
+ pBox->SetStyle( nWinBits );
+
+ pBox->InsertEntry( pImpl->aClearForm, 0 );
+ pBox->SetSeparatorPos( 0 );
+
+ pBox->InsertEntry( pImpl->aMore );
+
+ // enable sort again
+ nWinBits |= WB_SORT;
+ pBox->SetStyle( nWinBits );
+ }
+
+ pBox->SetUpdateMode( sal_True );
+ pBox->SetFamily( eFamily );
+
+ sal_uInt16 nLines = Min( pBox->GetEntryCount(), MAX_STYLES_ENTRIES );
+ pBox->SetDropDownLineCount( nLines );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxStyleToolBoxControl::SelectStyle( const String& rStyleName )
+{
+ SvxStyleBox_Impl* pBox = (SvxStyleBox_Impl*)GetToolBox().GetItemWindow( GetId() );
+ DBG_ASSERT( pBox, "Control not found!" );
+
+ if ( pBox )
+ {
+// String aStrSel( pBox->GetSelectEntry() );
+ String aStrSel( pBox->GetText() );
+
+ if ( rStyleName.Len() > 0 )
+ {
+ if ( rStyleName != aStrSel )
+// pBox->SelectEntry( rStyleName );
+ pBox->SetText( rStyleName );
+ }
+ else
+ pBox->SetNoSelection();
+ pBox->SaveValue();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxStyleToolBoxControl::Update()
+{
+ SfxStyleSheetBasePool* pPool = NULL;
+ SfxObjectShell* pDocShell = SfxObjectShell::Current();
+
+ if ( pDocShell )
+ pPool = pDocShell->GetStyleSheetPool();
+
+ sal_uInt16 i;
+ for ( i=0; i<MAX_FAMILIES; i++ )
+ if( pFamilyState[i] )
+ break;
+
+ if ( i==MAX_FAMILIES || !pPool )
+ {
+ pStyleSheetPool = pPool;
+ return;
+ }
+
+ //--------------------------------------------------------------------
+ const SfxTemplateItem* pItem = NULL;
+
+ if ( nActFamily == 0xffff || 0 == (pItem = pFamilyState[nActFamily-1]) )
+ // aktueller Bereich nicht innerhalb der erlaubten Bereiche
+ // oder Default
+ {
+ pStyleSheetPool = pPool;
+ nActFamily = 2;
+
+ pItem = pFamilyState[nActFamily-1];
+ if ( !pItem )
+ {
+ nActFamily++;
+ pItem = pFamilyState[nActFamily-1];
+ }
+
+ if ( !pItem )
+ {
+ DBG_WARNING( "Unknown Family" ); // can happen
+ }
+ }
+ else if ( pPool != pStyleSheetPool )
+ pStyleSheetPool = pPool;
+
+ FillStyleBox(); // entscheidet selbst, ob gefuellt werden muss
+
+ if ( pItem )
+ SelectStyle( pItem->GetStyleName() );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxStyleToolBoxControl::SetFamilyState( sal_uInt16 nIdx,
+ const SfxTemplateItem* pItem )
+{
+ DELETEZ( pFamilyState[nIdx] );
+
+ if ( pItem )
+ pFamilyState[nIdx] = new SfxTemplateItem( *pItem );
+
+ Update();
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxStyleToolBoxControl, VisibilityNotification, void*, EMPTYARG )
+{
+
+ sal_uInt16 i;
+
+ // Call ReBind() && UnBind() according to visibility
+ SvxStyleBox_Impl* pBox = (SvxStyleBox_Impl*)( GetToolBox().GetItemWindow( GetId() ));
+ if ( pBox->IsVisible() && !isBound() )
+ {
+ for ( i=0; i<MAX_FAMILIES; i++ )
+ pBoundItems [i]->ReBind();
+
+ bindListener();
+ }
+ else if ( !pBox->IsVisible() && isBound() )
+ {
+ for ( i=0; i<MAX_FAMILIES; i++ )
+ pBoundItems[i]->UnBind();
+ unbindListener();
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxStyleToolBoxControl::StateChanged(
+
+ sal_uInt16 , SfxItemState eState, const SfxPoolItem* pState )
+
+{
+ sal_uInt16 nId = GetId();
+ ToolBox& rTbx = GetToolBox();
+ SvxStyleBox_Impl* pBox = (SvxStyleBox_Impl*)(rTbx.GetItemWindow( nId ));
+ TriState eTri = STATE_NOCHECK;
+
+ DBG_ASSERT( pBox, "Control not found!" );
+
+ if ( SFX_ITEM_DISABLED == eState )
+ pBox->Disable();
+ else
+ pBox->Enable();
+
+ rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState );
+
+ switch ( eState )
+ {
+ case SFX_ITEM_AVAILABLE:
+ eTri = ((const SfxBoolItem*)pState)->GetValue()
+ ? STATE_CHECK
+ : STATE_NOCHECK;
+ break;
+
+ case SFX_ITEM_DONTCARE:
+ eTri = STATE_DONTKNOW;
+ break;
+ }
+
+ rTbx.SetItemState( nId, eTri );
+
+ if ( SFX_ITEM_DISABLED != eState )
+ Update();
+}
+
+// -----------------------------------------------------------------------
+
+Window* SvxStyleToolBoxControl::CreateItemWindow( Window *pParent )
+{
+ SvxStyleBox_Impl* pBox = new SvxStyleBox_Impl( pParent,
+ SID_STYLE_APPLY,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:StyleApply" )),
+ SFX_STYLE_FAMILY_PARA,
+ Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ),
+ m_xFrame,
+ pImpl->aClearForm,
+ pImpl->aMore,
+ pImpl->bSpecModeWriter || pImpl->bSpecModeCalc );
+ if( pImpl->aDefaultStyles.size())
+ pBox->SetDefaultStyle( pImpl->aDefaultStyles[0] );
+ // Set visibility listener to bind/unbind controller
+ pBox->SetVisibilityListener( LINK( this, SvxStyleToolBoxControl, VisibilityNotification ));
+
+ return pBox;
+}
+
+//========================================================================
+// class SvxFontNameToolBoxControl ---------------------------------------
+//========================================================================
+
+SvxFontNameToolBoxControl::SvxFontNameToolBoxControl(
+ sal_uInt16 nSlotId,
+ sal_uInt16 nId,
+ ToolBox& rTbx )
+
+ : SfxToolBoxControl( nSlotId, nId, rTbx )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontNameToolBoxControl::StateChanged(
+
+ sal_uInt16 , SfxItemState eState, const SfxPoolItem* pState )
+
+{
+ sal_uInt16 nId = GetId();
+ ToolBox& rTbx = GetToolBox();
+ SvxFontNameBox_Impl* pBox = (SvxFontNameBox_Impl*)(rTbx.GetItemWindow( nId ));
+
+ DBG_ASSERT( pBox, "Control not found!" );
+
+ if ( SFX_ITEM_DISABLED == eState )
+ {
+ pBox->Disable();
+ pBox->Update( (const SvxFontItem*)NULL );
+ }
+ else
+ {
+ pBox->Enable();
+
+ if ( SFX_ITEM_AVAILABLE == eState )
+ {
+ const SvxFontItem* pFontItem = dynamic_cast< const SvxFontItem* >( pState );
+
+ DBG_ASSERT( pFontItem, "svx::SvxFontNameToolBoxControl::StateChanged(), wrong item type!" );
+ if( pFontItem )
+ pBox->Update( pFontItem );
+ }
+ else
+ pBox->SetText( String() );
+ pBox->SaveValue();
+ }
+
+ rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState );
+}
+
+// -----------------------------------------------------------------------
+
+Window* SvxFontNameToolBoxControl::CreateItemWindow( Window *pParent )
+{
+ SvxFontNameBox_Impl* pBox = new SvxFontNameBox_Impl( pParent,
+ Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ),
+ m_xFrame,0);
+ return pBox;
+}
+
+//========================================================================
+// class SvxFontColorToolBoxControl --------------------------------------
+//========================================================================
+
+SvxFontColorToolBoxControl::SvxFontColorToolBoxControl(
+ sal_uInt16 nSlotId,
+ sal_uInt16 nId,
+ ToolBox& rTbx )
+
+ : SfxToolBoxControl( nSlotId, nId, rTbx ),
+ pBtnUpdater( new ::svx::ToolboxButtonColorUpdater(
+ nSlotId, nId, &GetToolBox(), TBX_UPDATER_MODE_CHAR_COLOR_NEW ))
+{
+ rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) );
+}
+
+// -----------------------------------------------------------------------
+
+SvxFontColorToolBoxControl::~SvxFontColorToolBoxControl()
+{
+ delete pBtnUpdater;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPopupWindowType SvxFontColorToolBoxControl::GetPopupWindowType() const
+{
+ return SFX_POPUPWINDOW_ONCLICK;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPopupWindow* SvxFontColorToolBoxControl::CreatePopupWindow()
+{
+ SvxColorWindow_Impl* pColorWin =
+ new SvxColorWindow_Impl(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Color" )),
+ SID_ATTR_CHAR_COLOR,
+ m_xFrame,
+ SVX_RESSTR( RID_SVXITEMS_EXTRAS_CHARCOLOR ),
+ &GetToolBox() );
+
+ pColorWin->StartPopupMode( &GetToolBox(),
+ FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_ALLOWTEAROFF );
+ pColorWin->StartSelection();
+ SetPopupWindow( pColorWin );
+ return pColorWin;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontColorToolBoxControl::StateChanged(
+
+ sal_uInt16 , SfxItemState eState, const SfxPoolItem* pState )
+
+{
+ sal_uInt16 nId = GetId();
+ ToolBox& rTbx = GetToolBox();
+ const SvxColorItem* pItem = 0;
+
+ if ( SFX_ITEM_DONTCARE != eState )
+ pItem = PTR_CAST( SvxColorItem, pState );
+
+ if ( pItem )
+ pBtnUpdater->Update( pItem->GetValue());
+
+ rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState );
+ rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK );
+}
+
+//========================================================================
+// class SvxColorToolBoxControl --------------------------------
+//========================================================================
+
+SvxColorToolBoxControl::SvxColorToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
+
+ SfxToolBoxControl( nSlotId, nId, rTbx )
+{
+ if ( nSlotId == SID_BACKGROUND_COLOR )
+ rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) );
+ else
+ rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) );
+ rTbx.Invalidate();
+ pBtnUpdater = new ::svx::ToolboxButtonColorUpdater( nSlotId, nId, &GetToolBox() );
+}
+
+// -----------------------------------------------------------------------
+
+SvxColorToolBoxControl::~SvxColorToolBoxControl()
+{
+ delete pBtnUpdater;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPopupWindowType SvxColorToolBoxControl::GetPopupWindowType() const
+{
+ return SFX_POPUPWINDOW_ONCLICK;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPopupWindow* SvxColorToolBoxControl::CreatePopupWindow()
+{
+ sal_uInt16 nResId = GetSlotId() == SID_BACKGROUND_COLOR ?
+ RID_SVXSTR_BACKGROUND : RID_SVXSTR_COLOR;
+ SvxColorWindow_Impl* pColorWin = new SvxColorWindow_Impl(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:BackgroundColor" )),
+ SID_BACKGROUND_COLOR,
+ m_xFrame,
+ SVX_RESSTR(nResId),
+ &GetToolBox() );
+
+ pColorWin->StartPopupMode( &GetToolBox(),
+ FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_ALLOWTEAROFF );
+ pColorWin->StartSelection();
+ SetPopupWindow( pColorWin );
+ return pColorWin;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxColorToolBoxControl::StateChanged(
+
+ sal_uInt16 , SfxItemState eState, const SfxPoolItem* pState )
+
+{
+ const SvxColorItem* pItem = 0;
+ if ( SFX_ITEM_DONTCARE != eState )
+ pItem = PTR_CAST( SvxColorItem, pState );
+
+ if ( pItem )
+ pBtnUpdater->Update( pItem->GetValue() );
+
+ sal_uInt16 nId = GetId();
+ ToolBox& rTbx = GetToolBox();
+ rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState );
+ rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK );
+}
+
+//========================================================================
+// class SvxFontColorExtToolBoxControl --------------------------------------
+//========================================================================
+
+SvxFontColorExtToolBoxControl::SvxFontColorExtToolBoxControl(
+ sal_uInt16 nSlotId,
+ sal_uInt16 nId,
+ ToolBox& rTbx ) :
+
+ SfxToolBoxControl( nSlotId, nId, rTbx ),
+ pBtnUpdater(0)
+{
+ rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) );
+ // The following commands are available at the writer module.
+ if ( SID_ATTR_CHAR_COLOR2 == nSlotId )
+ addStatusListener( OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharColorExt" )));
+ else
+ addStatusListener( OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharBackgroundExt" )));
+
+ sal_uInt16 nMode = SID_ATTR_CHAR_COLOR2 == nSlotId
+ ? TBX_UPDATER_MODE_CHAR_COLOR_NEW : TBX_UPDATER_MODE_CHAR_COLOR_NEW;
+ pBtnUpdater = new ::svx::ToolboxButtonColorUpdater( nSlotId, nId, &GetToolBox(), nMode );
+}
+
+// -----------------------------------------------------------------------
+
+SvxFontColorExtToolBoxControl::~SvxFontColorExtToolBoxControl()
+{
+ delete pBtnUpdater;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPopupWindowType SvxFontColorExtToolBoxControl::GetPopupWindowType() const
+{
+ return SFX_POPUPWINDOW_ONTIMEOUT;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPopupWindow* SvxFontColorExtToolBoxControl::CreatePopupWindow()
+{
+ SvxColorWindow_Impl* pColorWin =
+ new SvxColorWindow_Impl(
+ m_aCommandURL,
+ GetSlotId(),
+ m_xFrame,
+ SVX_RESSTR( RID_SVXITEMS_EXTRAS_CHARCOLOR ),
+ &GetToolBox() );
+
+ if ( GetSlotId() == SID_ATTR_CHAR_COLOR_BACKGROUND )
+ pColorWin->SetText( SVX_RESSTR( RID_SVXSTR_EXTRAS_CHARBACKGROUND ) );
+
+ pColorWin->StartPopupMode( &GetToolBox(),
+ FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_ALLOWTEAROFF );
+ pColorWin->StartSelection();
+ SetPopupWindow( pColorWin );
+ return pColorWin;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontColorExtToolBoxControl::StateChanged(
+
+ sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
+
+{
+ sal_uInt16 nId = GetId();
+ ToolBox& rTbx = GetToolBox();
+ const SvxColorItem* pItem = 0;
+
+ if ( nSID == SID_ATTR_CHAR_COLOR_EXT ||
+ nSID == SID_ATTR_CHAR_COLOR_BACKGROUND_EXT )
+ {
+ if ( SFX_ITEM_DONTCARE != eState )
+ {
+ const SfxBoolItem* pBool = PTR_CAST( SfxBoolItem, pState );
+ rTbx.CheckItem( nId, pBool && pBool->GetValue());
+ }
+ rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState );
+ }
+ else
+ {
+ if ( SFX_ITEM_DONTCARE != eState )
+ pItem = PTR_CAST( SvxColorItem, pState );
+
+ if ( pItem )
+ pBtnUpdater->Update( pItem->GetValue() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontColorExtToolBoxControl::Select( sal_Bool )
+{
+ OUString aCommand;
+ OUString aParamName;
+ if ( SID_ATTR_CHAR_COLOR2 == GetSlotId() )
+ {
+ aCommand = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharColorExt" ));
+ aParamName = OUString( RTL_CONSTASCII_USTRINGPARAM( "CharColorExt" ));
+ }
+ else
+ {
+ aCommand = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharBackgroundExt" ));
+ aParamName = OUString( RTL_CONSTASCII_USTRINGPARAM( "CharBackgroundExt" ));
+ }
+
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = aParamName;
+ aArgs[0].Value = makeAny( GetToolBox().IsItemChecked( GetId() ));
+ Dispatch( aCommand, aArgs );
+}
+
+//========================================================================
+// class SvxFrameToolBoxControl ------------------------------------------
+//========================================================================
+
+SvxFrameToolBoxControl::SvxFrameToolBoxControl(
+ sal_uInt16 nSlotId,
+ sal_uInt16 nId,
+ ToolBox& rTbx )
+
+ : SfxToolBoxControl( nSlotId, nId, rTbx )
+{
+ rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) );
+}
+
+// -----------------------------------------------------------------------
+
+SfxPopupWindowType SvxFrameToolBoxControl::GetPopupWindowType() const
+{
+ return SFX_POPUPWINDOW_ONCLICK;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPopupWindow* SvxFrameToolBoxControl::CreatePopupWindow()
+{
+ SvxFrameWindow_Impl* pFrameWin = new SvxFrameWindow_Impl(
+ GetSlotId(), m_xFrame, &GetToolBox() );
+
+ pFrameWin->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_GRABFOCUS | FLOATWIN_POPUPMODE_ALLOWTEAROFF );
+ pFrameWin->StartSelection();
+ SetPopupWindow( pFrameWin );
+
+ return pFrameWin;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFrameToolBoxControl::StateChanged(
+
+ sal_uInt16, SfxItemState eState, const SfxPoolItem* )
+
+{
+ sal_uInt16 nId = GetId();
+ ToolBox& rTbx = GetToolBox();
+
+ rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState );
+ rTbx.SetItemState( nId, (SFX_ITEM_DONTCARE == eState)
+ ? STATE_DONTKNOW
+ : STATE_NOCHECK );
+}
+
+//========================================================================
+// class SvxFrameLineStyleToolBoxControl ---------------------------------
+//========================================================================
+
+SvxFrameLineStyleToolBoxControl::SvxFrameLineStyleToolBoxControl(
+ sal_uInt16 nSlotId,
+ sal_uInt16 nId,
+ ToolBox& rTbx )
+
+ : SfxToolBoxControl( nSlotId, nId, rTbx )
+{
+ rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) );
+}
+
+// -----------------------------------------------------------------------
+
+SfxPopupWindowType SvxFrameLineStyleToolBoxControl::GetPopupWindowType() const
+{
+ return SFX_POPUPWINDOW_ONCLICK;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPopupWindow* SvxFrameLineStyleToolBoxControl::CreatePopupWindow()
+{
+ SvxLineWindow_Impl* pLineWin = new SvxLineWindow_Impl( GetSlotId(), m_xFrame, &GetToolBox() );
+ pLineWin->StartPopupMode( &GetToolBox(), sal_True );
+ pLineWin->StartSelection();
+ SetPopupWindow( pLineWin );
+
+ return pLineWin;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFrameLineStyleToolBoxControl::StateChanged(
+
+ sal_uInt16 , SfxItemState eState, const SfxPoolItem* )
+{
+ sal_uInt16 nId = GetId();
+ ToolBox& rTbx = GetToolBox();
+
+ rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState );
+ rTbx.SetItemState( nId, (SFX_ITEM_DONTCARE == eState)
+ ? STATE_DONTKNOW
+ : STATE_NOCHECK );
+}
+
+//========================================================================
+// class SvxFrameLineColorToolBoxControl ---------------------------------
+//========================================================================
+
+SvxFrameLineColorToolBoxControl::SvxFrameLineColorToolBoxControl(
+ sal_uInt16 nSlotId,
+ sal_uInt16 nId,
+ ToolBox& rTbx ) :
+
+ SfxToolBoxControl( nSlotId, nId, rTbx ),
+ pBtnUpdater(new ::svx::ToolboxButtonColorUpdater( nSlotId, nId, &GetToolBox() ))
+{
+ rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) );
+}
+
+// -----------------------------------------------------------------------
+
+SvxFrameLineColorToolBoxControl::~SvxFrameLineColorToolBoxControl()
+{
+
+ delete pBtnUpdater;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPopupWindowType SvxFrameLineColorToolBoxControl::GetPopupWindowType() const
+{
+ return SFX_POPUPWINDOW_ONCLICK;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPopupWindow* SvxFrameLineColorToolBoxControl::CreatePopupWindow()
+{
+ SvxColorWindow_Impl* pColorWin = new SvxColorWindow_Impl(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FrameLineColor" )),
+ SID_FRAME_LINECOLOR,
+ m_xFrame,
+ SVX_RESSTR(RID_SVXSTR_FRAME_COLOR),
+ &GetToolBox() );
+
+ pColorWin->StartPopupMode( &GetToolBox(),
+ FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_ALLOWTEAROFF );
+ pColorWin->StartSelection();
+ SetPopupWindow( pColorWin );
+ return pColorWin;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFrameLineColorToolBoxControl::StateChanged(
+
+ sal_uInt16 , SfxItemState eState, const SfxPoolItem* pState )
+
+{
+ sal_uInt16 nId = GetId();
+ ToolBox& rTbx = GetToolBox();
+ rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState );
+ rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK );
+
+ const SvxColorItem* pItem = 0;
+ if ( SFX_ITEM_DONTCARE != eState )
+ {
+ pItem = PTR_CAST( SvxColorItem, pState );
+ if ( pItem )
+ pBtnUpdater->Update( pItem->GetValue());
+ }
+}
+
+// class SvxReloadControllerItem_Impl ------------------------------------
+
+class SvxReloadControllerItem_Impl
+{
+public:
+ Image* pNormalImage;
+ Image* pSpecialImage;
+
+ SvxReloadControllerItem_Impl() :
+ pNormalImage( new Image( SVX_RES( RID_SVX_RELOAD_NORMAL ) ) ), pSpecialImage( 0 ) {}
+ ~SvxReloadControllerItem_Impl() { delete pNormalImage; delete pSpecialImage; }
+
+ Image& GetNormalImage() { return *pNormalImage; }
+ Image& GetSpecialImage()
+ {
+ if ( !pSpecialImage )
+ pSpecialImage = new Image( SVX_RES( RID_SVX_RELOAD_SPECIAL ) );
+ return *pSpecialImage;
+ }
+};
+
+// -----------------------------------------------------------------------
+
+SvxReloadControllerItem::SvxReloadControllerItem( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
+: SfxToolBoxControl( nSlotId, nId, rTbx )
+, pImpl( new SvxReloadControllerItem_Impl )
+{
+ rTbx.SetItemImage( nId, pImpl->GetNormalImage() );
+}
+
+// -----------------------------------------------------------------------
+
+SvxReloadControllerItem::~SvxReloadControllerItem()
+{
+ delete pImpl;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxReloadControllerItem::StateChanged(
+ sal_uInt16 , SfxItemState eState, const SfxPoolItem* pState )
+{
+ SfxBoolItem* pItem = PTR_CAST( SfxBoolItem, pState );
+ ToolBox& rBox = GetToolBox();
+ if( pItem )
+ {
+ rBox.SetItemImage( GetId(),
+ pItem->GetValue() ? pImpl->GetSpecialImage() :
+ pImpl->GetNormalImage() );
+ }
+ rBox.EnableItem( GetId(), eState != SFX_ITEM_DISABLED );
+}
+
+//========================================================================
+// class SvxSimpleUndoRedoController -------------------------------------
+//========================================================================
+
+SvxSimpleUndoRedoController::SvxSimpleUndoRedoController( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
+ :SfxToolBoxControl( nSlotId, nId, rTbx )
+{
+ aDefaultText = rTbx.GetItemText( nId );
+}
+
+// -----------------------------------------------------------------------
+
+SvxSimpleUndoRedoController::~SvxSimpleUndoRedoController()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSimpleUndoRedoController::StateChanged( sal_uInt16, SfxItemState eState, const SfxPoolItem* pState )
+{
+ SfxStringItem* pItem = PTR_CAST( SfxStringItem, pState );
+ ToolBox& rBox = GetToolBox();
+ if ( pItem && eState != SFX_ITEM_DISABLED )
+ {
+ ::rtl::OUString aNewText( MnemonicGenerator::EraseAllMnemonicChars( pItem->GetValue() ) );
+ rBox.SetQuickHelpText( GetId(), aNewText );
+ }
+ if ( eState == SFX_ITEM_DISABLED )
+ rBox.SetQuickHelpText( GetId(), aDefaultText );
+ rBox.EnableItem( GetId(), eState != SFX_ITEM_DISABLED );
+}
+
+//========================================================================
+
+void lcl_ResizeValueSet( Window &rWin, ValueSet &rValueSet )
+{
+ Size aSize = rWin.GetOutputSizePixel();
+ aSize.Width() -= 4;
+ aSize.Height() -= 4;
+ rValueSet.SetPosSizePixel( Point(2,2), aSize );
+}
+
+// -----------------------------------------------------------------------
+
+void lcl_CalcSizeValueSet( Window &rWin, ValueSet &rValueSet, const Size &aItemSize )
+{
+ Size aSize = rValueSet.CalcWindowSizePixel( aItemSize );
+ aSize.Width() += 4;
+ aSize.Height() += 4;
+ rWin.SetOutputSizePixel( aSize );
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool lcl_FontChangedHint( const SfxHint &rHint )
+{
+ SfxPoolItemHint *pItemHint = PTR_CAST(SfxPoolItemHint, &rHint);
+ if ( pItemHint )
+ {
+ SfxPoolItem *pItem = pItemHint->GetObject();
+ return ( pItem->Which() == SID_ATTR_CHAR_FONTLIST );
+ }
+ else
+ {
+ SfxSimpleHint* pSimpleHint = PTR_CAST(SfxSimpleHint, &rHint);
+ return pSimpleHint && ( SFX_HINT_DATACHANGED ==
+ ( pSimpleHint->GetId() & SFX_HINT_DATACHANGED ) );
+ }
+}
+// -----------------------------------------------------------------------------
+Reference< ::com::sun::star::accessibility::XAccessible > SvxFontNameBox_Impl::CreateAccessible()
+{
+ FillList();
+ return FontNameBox::CreateAccessible();
+}
diff --git a/svx/source/tbxctrls/tbcontrl.src b/svx/source/tbxctrls/tbcontrl.src
new file mode 100644
index 000000000000..f3e068f56226
--- /dev/null
+++ b/svx/source/tbxctrls/tbcontrl.src
@@ -0,0 +1,189 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ---------------------------------------------------------------
+#include <svx/dialogs.hrc>
+#include <helpid.hrc>
+ // pragma ----------------------------------------------------------------
+
+/*
+ * Bitmaps f"ur SvxFrameWindow
+ */
+
+#define MASKCOLOR MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
+
+Image RID_SVX_RELOAD_NORMAL
+{
+ ImageBitmap = Bitmap { File = "reload.bmp" ; };
+ MASKCOLOR
+};
+Image RID_SVX_RELOAD_SPECIAL
+{
+ ImageBitmap = Bitmap { File = "reloads.bmp" ; };
+ MASKCOLOR
+};
+ImageList RID_SVXIL_FRAME
+{
+ Prefix = "fr";
+ IdList = { 1 ; 2 ; 3 ; 4 ; 5 ; 6 ; 7 ; 8 ; 9 ; 10 ; 11 ; 12 ; };
+ IdCount = { 12 ; };
+ MASKCOLOR
+};
+ImageList RID_SVXIL_FRAME_HC
+{
+ Prefix = "frh";
+ IdList = { 1 ; 2 ; 3 ; 4 ; 5 ; 6 ; 7 ; 8 ; 9 ; 10 ; 11 ; 12 ; };
+ IdCount = { 12 ; };
+ MASKCOLOR
+};
+String RID_SVXSTR_TRANSPARENT
+{
+ Text [ en-US ] = "No Fill" ;
+};
+String RID_SVXSTR_FILLPATTERN
+{
+ Text [ en-US ] = "Pattern" ;
+};
+String RID_SVXSTR_FRAME
+{
+ Text [ en-US ] = "Borders" ;
+};
+String RID_SVXSTR_FRAME_STYLE
+{
+ Text [ en-US ] = "Border Style" ;
+};
+String RID_SVXSTR_FRAME_COLOR
+{
+ Text [ en-US ] = "Border Color" ;
+};
+ComboBox RID_SVXTBX_STYLE
+{
+ HelpId = HID_STYLE_LISTBOX ;
+ Size = MAP_APPFONT ( 67 , 86 ) ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ AutoHScroll = TRUE ;
+ DDExtraWidth = TRUE ;
+ Border = TRUE ;
+ Hide = TRUE ;
+};
+String RID_SVXSTR_EXTRAS_CHARBACKGROUND
+{
+ Text [ en-US ] = "Highlighting" ;
+};
+String RID_SVXSTR_BACKGROUND
+{
+ Text [ en-US ] = "Background";
+};
+String RID_SVXSTR_AUTOMATIC
+{
+ Text [ en-US ] = "Automatic";
+};
+String RID_SVXSTR_PAGES
+{
+ Text [ en-US ] = "Pages";
+};
+Image RID_SVXIMG_GRAF_RED
+{
+ ImageBitmap = Bitmap { File = "sc10865.bmp" ; };
+ MASKCOLOR
+};
+Image RID_SVXIMG_GRAF_GREEN
+{
+ ImageBitmap = Bitmap { File = "sc10866.bmp" ; };
+ MASKCOLOR
+};
+Image RID_SVXIMG_GRAF_BLUE
+{
+ ImageBitmap = Bitmap { File = "sc10867.bmp" ; };
+ MASKCOLOR
+};
+Image RID_SVXIMG_GRAF_LUMINANCE
+{
+ ImageBitmap = Bitmap { File = "sc10863.bmp" ; };
+ MASKCOLOR
+};
+Image RID_SVXIMG_GRAF_CONTRAST
+{
+ ImageBitmap = Bitmap { File = "sc10864.bmp" ; };
+ MASKCOLOR
+};
+Image RID_SVXIMG_GRAF_GAMMA
+{
+ ImageBitmap = Bitmap { File = "sc10868.bmp" ; };
+ MASKCOLOR
+};
+Image RID_SVXIMG_GRAF_TRANSPARENCE
+{
+ ImageBitmap = Bitmap { File = "sc10869.bmp" ; };
+ MASKCOLOR
+};
+Image RID_SVXIMG_GRAF_RED_H
+{
+ ImageBitmap = Bitmap { File = "sch10865.bmp" ; };
+ MASKCOLOR
+};
+Image RID_SVXIMG_GRAF_GREEN_H
+{
+ ImageBitmap = Bitmap { File = "sch10866.bmp" ; };
+ MASKCOLOR
+};
+Image RID_SVXIMG_GRAF_BLUE_H
+{
+ ImageBitmap = Bitmap { File = "sch10867.bmp" ; };
+ MASKCOLOR
+};
+Image RID_SVXIMG_GRAF_LUMINANCE_H
+{
+ ImageBitmap = Bitmap { File = "sch10863.bmp" ; };
+ MASKCOLOR
+};
+Image RID_SVXIMG_GRAF_CONTRAST_H
+{
+ ImageBitmap = Bitmap { File = "sch10864.bmp" ; };
+ MASKCOLOR
+};
+Image RID_SVXIMG_GRAF_GAMMA_H
+{
+ ImageBitmap = Bitmap { File = "sch10868.bmp" ; };
+ MASKCOLOR
+};
+Image RID_SVXIMG_GRAF_TRANSPARENCE_H
+{
+ ImageBitmap = Bitmap { File = "sch10869.bmp" ; };
+ MASKCOLOR
+};
+String RID_SVXSTR_CLEARFORM
+{
+ Text [ en-US ] = "Clear formatting";
+};
+String RID_SVXSTR_MORE
+{
+ Text [ en-US ] = "More...";
+};
+
+// ********************************************************************** EOF
+
diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx
new file mode 100644
index 000000000000..bbb00d0085a0
--- /dev/null
+++ b/svx/source/tbxctrls/tbunocontroller.cxx
@@ -0,0 +1,429 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "tbunocontroller.hxx"
+
+#include <com/sun/star/frame/status/FontHeight.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <svtools/ctrltool.hxx>
+#include <svtools/ctrlbox.hxx>
+#include <vos/mutex.hxx>
+
+#include <memory>
+
+#define LOGICAL_EDIT_HEIGHT 12
+
+using namespace ::com::sun::star;
+
+namespace svx
+{
+
+class FontHeightToolBoxControl;
+class SvxFontSizeBox_Impl : public FontSizeBox
+{
+public:
+ SvxFontSizeBox_Impl( Window* pParent,
+ const uno::Reference< frame::XDispatchProvider >& rDispatchProvider,
+ const uno::Reference< frame::XFrame >& _xFrame,
+ FontHeightToolBoxControl& rCtrl );
+
+ void statusChanged_Impl( long nHeight, bool bErase = false );
+ void UpdateFont( const ::com::sun::star::awt::FontDescriptor& rCurrentFont );
+
+ virtual long Notify( NotifyEvent& rNEvt );
+
+protected:
+ virtual void Select();
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+private:
+ FontHeightToolBoxControl* m_pCtrl;
+ String m_aCurText;
+ Size m_aLogicalSize;
+ sal_Bool m_bRelease;
+ uno::Reference< frame::XDispatchProvider > m_xDispatchProvider;
+ uno::Reference< frame::XFrame > m_xFrame;
+ uno::Reference< awt::XWindow > m_xOldFocusWindow;
+
+ void ReleaseFocus_Impl();
+};
+
+//========================================================================
+// class SvxFontSizeBox_Impl --------------------------------------------------
+//========================================================================
+
+SvxFontSizeBox_Impl::SvxFontSizeBox_Impl(
+ Window* _pParent,
+ const uno::Reference< frame::XDispatchProvider >& _rDispatchProvider,
+ const uno::Reference< frame::XFrame >& _xFrame,
+ FontHeightToolBoxControl& _rCtrl ) :
+
+ FontSizeBox( _pParent, WinBits( WB_DROPDOWN ) ),
+
+ m_pCtrl ( &_rCtrl ),
+ m_aLogicalSize ( 30,100 ),
+ m_bRelease ( sal_True ),
+ m_xDispatchProvider ( _rDispatchProvider ),
+ m_xFrame ( _xFrame )
+{
+ SetSizePixel( LogicToPixel( m_aLogicalSize, MAP_APPFONT ));
+ SetValue( 0 );
+ SetText( String() );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontSizeBox_Impl::ReleaseFocus_Impl()
+{
+ if ( !m_bRelease )
+ {
+ m_bRelease = sal_True;
+ return;
+ }
+
+ if ( m_xFrame.is() && m_xFrame->getContainerWindow().is() )
+ m_xFrame->getContainerWindow()->setFocus();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontSizeBox_Impl::Select()
+{
+ FontSizeBox::Select();
+
+ if ( !IsTravelSelect() )
+ {
+ sal_Int64 nSelVal = GetValue();
+ float fSelVal = float( nSelVal ) / 10;
+
+ uno::Sequence< beans::PropertyValue > aArgs( 1 );
+ aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontHeight.Height" ));
+ aArgs[0].Value = uno::makeAny( fSelVal );
+
+ /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call.
+ This instance may be deleted in the meantime (i.e. when a dialog is opened
+ while in Dispatch()), accessing members will crash in this case. */
+ ReleaseFocus_Impl();
+
+ m_pCtrl->dispatchCommand( aArgs );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontSizeBox_Impl::statusChanged_Impl( long nPoint, bool bErase )
+{
+ if ( !bErase )
+ {
+ // Metric Umrechnen
+ long nVal = nPoint;
+
+ // ge"andert => neuen Wert setzen
+ if ( GetValue() != nVal )
+ SetValue( nVal );
+ }
+ else
+ {
+ // Wert in der Anzeige l"oschen
+ SetValue( -1L );
+ SetText( String() );
+ }
+ SaveValue();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontSizeBox_Impl::UpdateFont( const ::com::sun::star::awt::FontDescriptor& rCurrentFont )
+{
+ // Sizes-Liste auff"ullen
+ sal_Int64 nOldVal = GetValue(); // alten Wert merken
+ const FontList* _pFontList = NULL;
+ ::std::auto_ptr<FontList> aHold( new FontList( this ));
+ _pFontList = aHold.get();
+
+ if ( rCurrentFont.Name.getLength() > 0 )
+ {
+ FontInfo _aFontInfo;
+ _aFontInfo.SetName( rCurrentFont.Name );
+ _aFontInfo.SetStyleName( rCurrentFont.StyleName );
+ _aFontInfo.SetHeight( rCurrentFont.Height );
+ Fill( &_aFontInfo, _pFontList );
+ }
+ else
+ {
+ Fill( NULL, _pFontList );
+ }
+ SetValue( nOldVal ); // alten Wert wiederherstellen
+ m_aCurText = GetText(); // zum R"ucksetzen bei ESC merken
+}
+
+// -----------------------------------------------------------------------
+
+long SvxFontSizeBox_Impl::Notify( NotifyEvent& rNEvt )
+{
+ long nHandled = 0;
+
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ sal_uInt16 nCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
+
+ switch ( nCode )
+ {
+ case KEY_RETURN:
+ case KEY_TAB:
+ {
+ if ( KEY_TAB == nCode )
+ m_bRelease = sal_False;
+ else
+ nHandled = 1;
+ Select();
+ break;
+ }
+
+ case KEY_ESCAPE:
+ SetText( m_aCurText );
+ ReleaseFocus_Impl();
+ nHandled = 1;
+ break;
+ }
+ }
+ else if( EVENT_LOSEFOCUS == rNEvt.GetType() )
+ {
+ Window* pFocusWin = Application::GetFocusWindow();
+ if(!HasFocus() && GetSubEdit() != pFocusWin)
+ SetText(GetSavedValue());
+ }
+
+ return nHandled ? nHandled : FontSizeBox::Notify( rNEvt );
+}
+
+// ---------------------------------------------------------------------------
+
+void SvxFontSizeBox_Impl::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ SetSizePixel( LogicToPixel( m_aLogicalSize, MAP_APPFONT ));
+ Size aDropSize( m_aLogicalSize.Width(), LOGICAL_EDIT_HEIGHT );
+ SetDropDownSizePixel( LogicToPixel( aDropSize, MAP_APPFONT ));
+ }
+
+ FontSizeBox::DataChanged( rDCEvt );
+}
+
+//========================================================================
+// class FontHeightToolBoxControl
+//========================================================================
+
+FontHeightToolBoxControl::FontHeightToolBoxControl(
+ const uno::Reference< lang::XMultiServiceFactory >& rServiceManager ) :
+ svt::ToolboxController( rServiceManager,
+ uno::Reference< frame::XFrame >(),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontHeight" )) ),
+ m_pBox( NULL )
+{
+ addStatusListener( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharFontName" )));
+}
+
+FontHeightToolBoxControl::~FontHeightToolBoxControl()
+{
+}
+
+// XInterface
+::com::sun::star::uno::Any SAL_CALL FontHeightToolBoxControl::queryInterface( const ::com::sun::star::uno::Type& aType )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ uno::Any a = ToolboxController::queryInterface( aType );
+ if ( a.hasValue() )
+ return a;
+
+ return ::cppu::queryInterface( aType, static_cast< lang::XServiceInfo* >( this ));
+}
+
+void SAL_CALL FontHeightToolBoxControl::acquire() throw ()
+{
+ ToolboxController::acquire();
+}
+
+void SAL_CALL FontHeightToolBoxControl::release() throw ()
+{
+ ToolboxController::release();
+}
+
+// XServiceInfo
+sal_Bool SAL_CALL FontHeightToolBoxControl::supportsService( const ::rtl::OUString& ServiceName )
+throw(uno::RuntimeException)
+{
+ const uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() );
+ const ::rtl::OUString * pArray = aSNL.getConstArray();
+
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == ServiceName )
+ return true;
+
+ return false;
+}
+
+::rtl::OUString SAL_CALL FontHeightToolBoxControl::getImplementationName()
+throw( uno::RuntimeException )
+{
+ return getImplementationName_Static();
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL FontHeightToolBoxControl::getSupportedServiceNames( )
+throw( uno::RuntimeException )
+{
+ return getSupportedServiceNames_Static();
+}
+
+uno::Sequence< ::rtl::OUString > FontHeightToolBoxControl::getSupportedServiceNames_Static()
+throw()
+{
+ uno::Sequence< ::rtl::OUString > aSNS( 1 );
+ aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ));
+ return aSNS;
+}
+
+// XComponent
+void SAL_CALL FontHeightToolBoxControl::dispose()
+throw (uno::RuntimeException)
+{
+ svt::ToolboxController::dispose();
+
+ vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+ delete m_pBox;
+ m_pBox = 0;
+}
+
+// XStatusListener
+void SAL_CALL FontHeightToolBoxControl::statusChanged(
+ const frame::FeatureStateEvent& rEvent )
+throw ( uno::RuntimeException )
+{
+ if ( m_pBox )
+ {
+ vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+ if ( rEvent.FeatureURL.Path.equalsAscii( "FontHeight" ))
+ {
+ if ( rEvent.IsEnabled )
+ {
+ m_pBox->Enable();
+ frame::status::FontHeight aFontHeight;
+ if ( rEvent.State >>= aFontHeight )
+ m_pBox->statusChanged_Impl( long( 10. * aFontHeight.Height ), false );
+ else
+ m_pBox->statusChanged_Impl( long( -1 ), true );
+ }
+ else
+ m_pBox->Disable();
+ }
+ else if ( rEvent.FeatureURL.Path.equalsAscii( "CharFontName" ))
+ {
+ if ( rEvent.State >>= m_aCurrentFont )
+ m_pBox->UpdateFont( m_aCurrentFont );
+ }
+ }
+}
+
+// XToolbarController
+void SAL_CALL FontHeightToolBoxControl::execute( sal_Int16 /*KeyModifier*/ )
+throw (::com::sun::star::uno::RuntimeException)
+{
+}
+
+void SAL_CALL FontHeightToolBoxControl::click()
+throw (::com::sun::star::uno::RuntimeException)
+{
+}
+
+void SAL_CALL FontHeightToolBoxControl::doubleClick()
+throw (::com::sun::star::uno::RuntimeException)
+{
+}
+
+uno::Reference< awt::XWindow > SAL_CALL FontHeightToolBoxControl::createPopupWindow()
+throw (::com::sun::star::uno::RuntimeException)
+{
+ return uno::Reference< awt::XWindow >();
+}
+
+uno::Reference< awt::XWindow > SAL_CALL FontHeightToolBoxControl::createItemWindow(
+ const uno::Reference< awt::XWindow >& Parent )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ uno::Reference< awt::XWindow > xItemWindow;
+ uno::Reference< awt::XWindow > xParent( Parent );
+
+ Window* pParent = VCLUnoHelper::GetWindow( xParent );
+ if ( pParent )
+ {
+ vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+ m_pBox = new SvxFontSizeBox_Impl(
+ pParent,
+ uno::Reference< frame::XDispatchProvider >( m_xFrame, uno::UNO_QUERY ),
+ m_xFrame,
+ *this );
+ xItemWindow = VCLUnoHelper::GetInterface( m_pBox );
+ }
+
+ return xItemWindow;
+}
+
+void FontHeightToolBoxControl::dispatchCommand(
+ const uno::Sequence< beans::PropertyValue >& rArgs )
+{
+ uno::Reference< frame::XDispatchProvider > xDispatchProvider( m_xFrame, uno::UNO_QUERY );
+ if ( xDispatchProvider.is() )
+ {
+ util::URL aURL;
+ uno::Reference< frame::XDispatch > xDispatch;
+ uno::Reference< util::XURLTransformer > xURLTransformer = getURLTransformer();
+
+ aURL.Complete = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontHeight" ));
+ xURLTransformer->parseStrict( aURL );
+ xDispatch = xDispatchProvider->queryDispatch( aURL, ::rtl::OUString(), 0 );
+ if ( xDispatch.is() )
+ xDispatch->dispatch( aURL, rArgs );
+ }
+}
+
+uno::Reference< uno::XInterface > SAL_CALL FontHeightToolBoxControl_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory >& rSMgr )
+{
+ return *new FontHeightToolBoxControl( rSMgr );
+}
+
+}
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
new file mode 100644
index 000000000000..f2926c38aa5b
--- /dev/null
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -0,0 +1,873 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "tbunosearchcontrollers.hxx"
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <com/sun/star/ui/XUIElement.hpp>
+#include <com/sun/star/util/URL.hpp>
+
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+
+namespace svx
+{
+
+static const ::rtl::OUString SEARCHITEM_SEARCHSTRING = ::rtl::OUString::createFromAscii("SearchItem.SearchString");
+static const ::rtl::OUString SEARCHITEM_SEARCHBACKWARD = ::rtl::OUString::createFromAscii("SearchItem.Backward");
+
+static const ::rtl::OUString COMMAND_EXECUTESEARCH = ::rtl::OUString::createFromAscii(".uno:ExecuteSearch");
+static const ::rtl::OUString COMMAND_FINDTEXT = ::rtl::OUString::createFromAscii(".uno:FindText") ;
+static const ::rtl::OUString COMMAND_DOWNSEARCH = ::rtl::OUString::createFromAscii(".uno:DownSearch");
+static const ::rtl::OUString COMMAND_UPSEARCH = ::rtl::OUString::createFromAscii(".uno:UpSearch") ;
+static const ::rtl::OUString COMMAND_APPENDSEARCHHISTORY = ::rtl::OUString::createFromAscii("AppendSearchHistory");
+
+static const ::rtl::OUString SERVICENAME_URLTRANSFORMER = ::rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer");
+static const sal_Int32 REMEMBER_SIZE = 10;
+
+void impl_executeSearch( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr, const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Sequence< css::beans::PropertyValue >& lArgs )
+{
+ css::uno::Reference< css::util::XURLTransformer > xURLTransformer( rSMgr->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY );
+ if ( xURLTransformer.is() )
+ {
+ css::util::URL aURL;
+ aURL.Complete = COMMAND_EXECUTESEARCH;
+ xURLTransformer->parseStrict(aURL);
+
+ css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider(xFrame, css::uno::UNO_QUERY);
+ if ( xDispatchProvider.is() )
+ {
+ css::uno::Reference< css::frame::XDispatch > xDispatch = xDispatchProvider->queryDispatch( aURL, ::rtl::OUString(), 0 );
+ if ( xDispatch.is() && aURL.Complete.getLength() > 0 )
+ xDispatch->dispatch( aURL, lArgs );
+ }
+ }
+}
+
+FindTextFieldControl::FindTextFieldControl( Window* pParent, WinBits nStyle,
+ css::uno::Reference< css::frame::XFrame >& xFrame,
+ css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager) :
+ ComboBox( pParent, nStyle ),
+ m_xFrame(xFrame),
+ m_xServiceManager(xServiceManager),
+ m_bToClearTextField(sal_True)
+{
+ InitControls_Impl();
+}
+
+FindTextFieldControl::~FindTextFieldControl()
+{
+}
+
+void FindTextFieldControl::InitControls_Impl()
+{
+ SetText( SVX_RESSTR( RID_SVXSTR_FINDBAR_FIND ) );
+ SetControlForeground(GetSettings().GetStyleSettings().GetDisableColor());
+
+ EnableAutocomplete(sal_True, sal_True);
+}
+
+void FindTextFieldControl::Remember_Impl(const String& rStr)
+{
+ sal_uInt16 nCount = GetEntryCount();
+
+ for (sal_uInt16 i=0; i<nCount; ++i)
+ {
+ if ( rStr == GetEntry(i))
+ return;
+ }
+
+ if (nCount == REMEMBER_SIZE)
+ RemoveEntry(REMEMBER_SIZE-1);
+
+ InsertEntry(rStr, 0);
+}
+
+void FindTextFieldControl::Modify()
+{
+ ComboBox::Modify();
+
+ SetControlForeground( GetSettings().GetStyleSettings().GetWindowTextColor() );
+}
+
+long FindTextFieldControl::PreNotify( NotifyEvent& rNEvt )
+{
+ long nRet= ComboBox::PreNotify( rNEvt );
+
+ switch ( rNEvt.GetType() )
+ {
+ case EVENT_KEYINPUT:
+ {
+ const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
+ sal_Bool bCtrl = pKeyEvent->GetKeyCode().IsMod1();
+ sal_Bool bAlt = pKeyEvent->GetKeyCode().IsMod2();
+ sal_Bool bShift = pKeyEvent->GetKeyCode().IsShift();
+ sal_uInt16 nCode = pKeyEvent->GetKeyCode().GetCode();
+
+ if ( (bCtrl && bAlt && KEY_F == nCode) || KEY_ESCAPE == nCode )
+ {
+ nRet = 1;
+ GrabFocusToDocument();
+ }
+
+ if ( KEY_RETURN == nCode )
+ {
+ Remember_Impl(GetText());
+
+ ::rtl::OUString sFindText = GetText();
+ css::uno::Sequence< css::beans::PropertyValue > lArgs(2);
+
+ lArgs[0].Name = SEARCHITEM_SEARCHSTRING;
+ lArgs[0].Value <<= sFindText;
+
+ lArgs[1].Name = SEARCHITEM_SEARCHBACKWARD;
+ if (bShift)
+ lArgs[1].Value <<= sal_True;
+ else
+ lArgs[1].Value <<= sal_False;
+
+ impl_executeSearch(m_xServiceManager, m_xFrame, lArgs);
+ nRet = 1;
+ }
+ break;
+ }
+
+ case EVENT_GETFOCUS:
+ if ( m_bToClearTextField )
+ {
+ SetText( String() );
+ m_bToClearTextField = sal_False;
+ }
+ SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
+ break;
+
+ case EVENT_LOSEFOCUS:
+ if ( GetText().Len() == 0 )
+ {
+ SetText( SVX_RESSTR( RID_SVXSTR_FINDBAR_FIND ) );
+ SetControlForeground(GetSettings().GetStyleSettings().GetDisableColor());
+ m_bToClearTextField = sal_True;
+ }
+ break;
+ }
+
+ return nRet;
+}
+
+
+//-----------------------------------------------------------------------------------------------------------
+// SearchToolbarControllersManager
+
+SearchToolbarControllersManager* SearchToolbarControllersManager::m_pInstance = 0;
+
+SearchToolbarControllersManager::SearchToolbarControllersManager()
+{
+}
+
+SearchToolbarControllersManager::~SearchToolbarControllersManager()
+{
+}
+
+SearchToolbarControllersManager* SearchToolbarControllersManager::createControllersManager()
+{
+ if (!m_pInstance)
+ m_pInstance = new SearchToolbarControllersManager();
+
+ return m_pInstance;
+}
+
+void SearchToolbarControllersManager::registryController( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& xStatusListener, const ::rtl::OUString& sCommandURL )
+{
+ SearchToolbarControllersMap::iterator pIt = aSearchToolbarControllersMap.find(xFrame);
+ if (pIt == aSearchToolbarControllersMap.end())
+ {
+ SearchToolbarControllersVec lControllers(1);
+ lControllers[0].Name = sCommandURL;
+ lControllers[0].Value <<= xStatusListener;
+ aSearchToolbarControllersMap.insert(SearchToolbarControllersMap::value_type(xFrame, lControllers));
+ }
+ else
+ {
+ sal_Int32 nSize = pIt->second.size();
+ for (sal_Int32 i=0; i<nSize; ++i)
+ {
+ if (pIt->second[i].Name.equals(sCommandURL))
+ return;
+ }
+
+ pIt->second.resize(nSize+1);
+ pIt->second[nSize].Name = sCommandURL;
+ pIt->second[nSize].Value <<= xStatusListener;
+ }
+}
+
+void SearchToolbarControllersManager::freeController( const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Reference< css::frame::XStatusListener >& /*xStatusListener*/, const ::rtl::OUString& sCommandURL )
+{
+ SearchToolbarControllersMap::iterator pIt = aSearchToolbarControllersMap.find(xFrame);
+ if (pIt != aSearchToolbarControllersMap.end())
+ {
+ for (SearchToolbarControllersVec::iterator pItCtrl=pIt->second.begin(); pItCtrl!=pIt->second.end(); ++pItCtrl)
+ {
+ if (pItCtrl->Name.equals(sCommandURL))
+ {
+ pIt->second.erase(pItCtrl);
+ break;
+ }
+ }
+
+ if (pIt->second.empty())
+ aSearchToolbarControllersMap.erase(pIt);
+ }
+}
+
+css::uno::Reference< css::frame::XStatusListener > SearchToolbarControllersManager::findController( const css::uno::Reference< css::frame::XFrame >& xFrame, const ::rtl::OUString& sCommandURL )
+{
+ css::uno::Reference< css::frame::XStatusListener > xStatusListener;
+
+ SearchToolbarControllersMap::iterator pIt = aSearchToolbarControllersMap.find(xFrame);
+ if (pIt != aSearchToolbarControllersMap.end())
+ {
+ for (SearchToolbarControllersVec::iterator pItCtrl =pIt->second.begin(); pItCtrl != pIt->second.end(); ++pItCtrl)
+ {
+ if (pItCtrl->Name.equals(sCommandURL))
+ {
+ pItCtrl->Value >>= xStatusListener;
+ break;
+ }
+ }
+ }
+
+ return xStatusListener;
+}
+
+//-----------------------------------------------------------------------------------------------------------
+// FindTextToolbarController
+
+FindTextToolbarController::FindTextToolbarController( const css::uno::Reference< css::lang::XMultiServiceFactory >& rServiceManager )
+ :svt::ToolboxController( rServiceManager,
+ css::uno::Reference< css::frame::XFrame >(),
+ COMMAND_FINDTEXT )
+{
+}
+
+FindTextToolbarController::~FindTextToolbarController()
+{
+}
+
+// XInterface
+css::uno::Any SAL_CALL FindTextToolbarController::queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException )
+{
+ css::uno::Any a = ToolboxController::queryInterface( aType );
+ if ( a.hasValue() )
+ return a;
+
+ return ::cppu::queryInterface( aType, static_cast< css::lang::XServiceInfo* >( this ) );
+}
+
+void SAL_CALL FindTextToolbarController::acquire() throw ()
+{
+ ToolboxController::acquire();
+}
+
+void SAL_CALL FindTextToolbarController::release() throw ()
+{
+ ToolboxController::release();
+}
+
+// XServiceInfo
+::rtl::OUString SAL_CALL FindTextToolbarController::getImplementationName() throw( css::uno::RuntimeException )
+{
+ return getImplementationName_Static();
+}
+
+sal_Bool SAL_CALL FindTextToolbarController::supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException )
+{
+ const css::uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() );
+ const ::rtl::OUString * pArray = aSNL.getConstArray();
+
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == ServiceName )
+ return true;
+
+ return false;
+}
+
+css::uno::Sequence< ::rtl::OUString > SAL_CALL FindTextToolbarController::getSupportedServiceNames() throw( css::uno::RuntimeException )
+{
+ return getSupportedServiceNames_Static();
+}
+
+css::uno::Sequence< ::rtl::OUString > FindTextToolbarController::getSupportedServiceNames_Static() throw()
+{
+ css::uno::Sequence< ::rtl::OUString > aSNS( 1 );
+ aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ) );
+ return aSNS;
+}
+
+// XComponent
+void SAL_CALL FindTextToolbarController::dispose() throw ( css::uno::RuntimeException )
+{
+ vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+
+ SearchToolbarControllersManager::createControllersManager()->freeController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL);
+
+ svt::ToolboxController::dispose();
+ delete m_pFindTextFieldControl;
+ m_pFindTextFieldControl = 0;
+}
+
+// XInitialization
+void SAL_CALL FindTextToolbarController::initialize( const css::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException)
+{
+ svt::ToolboxController::initialize(aArguments);
+
+ Window* pWindow = VCLUnoHelper::GetWindow( getParent() );
+ ToolBox* pToolBox = (ToolBox*)pWindow;
+ if ( pToolBox )
+ {
+ sal_uInt16 nItemCount = pToolBox->GetItemCount();
+ for ( sal_uInt16 i=0; i<nItemCount; ++i )
+ {
+ ::rtl::OUString sItemCommand = pToolBox->GetItemCommand(i);
+ if ( sItemCommand.equals( COMMAND_DOWNSEARCH ) )
+ m_nDownSearchId = i;
+ else if (sItemCommand.equals( COMMAND_UPSEARCH ))
+ m_nUpSearchId = i;
+ }
+ }
+
+ SearchToolbarControllersManager::createControllersManager()->registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL);
+}
+
+// XToolbarController
+void SAL_CALL FindTextToolbarController::execute( sal_Int16 /*KeyModifier*/ ) throw ( css::uno::RuntimeException )
+{
+}
+
+css::uno::Reference< css::awt::XWindow > SAL_CALL FindTextToolbarController::createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) throw ( css::uno::RuntimeException )
+{
+ css::uno::Reference< css::awt::XWindow > xItemWindow;
+
+ css::uno::Reference< css::awt::XWindow > xParent( Parent );
+ Window* pParent = VCLUnoHelper::GetWindow( xParent );
+ if ( pParent )
+ {
+ ToolBox* pToolbar = ( ToolBox* )pParent;
+ m_pFindTextFieldControl = new FindTextFieldControl( pToolbar, WinBits( WB_DROPDOWN | WB_VSCROLL), m_xFrame, m_xServiceManager );
+
+ Size aSize(100, m_pFindTextFieldControl->GetTextHeight() + 200);
+ m_pFindTextFieldControl->SetSizePixel( aSize );
+ m_pFindTextFieldControl->SetModifyHdl(LINK(this, FindTextToolbarController, EditModifyHdl));
+ }
+ xItemWindow = VCLUnoHelper::GetInterface( m_pFindTextFieldControl );
+
+ return xItemWindow;
+}
+
+// XStatusListener
+void SAL_CALL FindTextToolbarController::statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException )
+{
+ vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+ if ( m_bDisposed )
+ return;
+
+ ::rtl::OUString aFeatureURL = rEvent.FeatureURL.Complete;
+ if (aFeatureURL.equalsAscii("AppendSearchHistory"))
+ {
+ m_pFindTextFieldControl->Remember_Impl(m_pFindTextFieldControl->GetText());
+ }
+}
+
+IMPL_LINK( FindTextToolbarController, EditModifyHdl, void *, EMPTYARG )
+{
+ // enable or disable item DownSearch/UpSearch of findbar
+ Window* pWindow = VCLUnoHelper::GetWindow( getParent() );
+ ToolBox* pToolBox = (ToolBox*)pWindow;
+ if ( pToolBox && m_pFindTextFieldControl )
+ {
+ if (m_pFindTextFieldControl->GetText().Len()>0)
+ {
+ if ( !pToolBox->IsItemEnabled(m_nDownSearchId) )
+ pToolBox->EnableItem(m_nDownSearchId, sal_True);
+ if ( !pToolBox->IsItemEnabled(m_nUpSearchId) )
+ pToolBox->EnableItem(m_nUpSearchId, sal_True);
+ }
+ else
+ {
+ if ( pToolBox->IsItemEnabled(m_nDownSearchId) )
+ pToolBox->EnableItem(m_nDownSearchId, sal_False);
+ if ( pToolBox->IsItemEnabled(m_nUpSearchId) )
+ pToolBox->EnableItem(m_nUpSearchId, sal_False);
+ }
+ }
+
+ return 0;
+}
+
+//-----------------------------------------------------------------------------------------------------------
+// class DownSearchToolboxController
+
+DownSearchToolboxController::DownSearchToolboxController(const css::uno::Reference< css::lang::XMultiServiceFactory >& rServiceManager )
+ : svt::ToolboxController( rServiceManager,
+ css::uno::Reference< css::frame::XFrame >(),
+ COMMAND_DOWNSEARCH )
+{
+}
+
+DownSearchToolboxController::~DownSearchToolboxController()
+{
+}
+
+// XInterface
+css::uno::Any SAL_CALL DownSearchToolboxController::queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException )
+{
+ css::uno::Any a = ToolboxController::queryInterface( aType );
+ if ( a.hasValue() )
+ return a;
+
+ return ::cppu::queryInterface( aType, static_cast< css::lang::XServiceInfo* >( this ) );
+}
+
+void SAL_CALL DownSearchToolboxController::acquire() throw ()
+{
+ ToolboxController::acquire();
+}
+
+void SAL_CALL DownSearchToolboxController::release() throw ()
+{
+ ToolboxController::release();
+}
+
+// XServiceInfo
+::rtl::OUString SAL_CALL DownSearchToolboxController::getImplementationName() throw( css::uno::RuntimeException )
+{
+ return getImplementationName_Static();
+}
+
+sal_Bool SAL_CALL DownSearchToolboxController::supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException )
+{
+ const css::uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() );
+ const ::rtl::OUString * pArray = aSNL.getConstArray();
+
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == ServiceName )
+ return true;
+
+ return false;
+}
+
+css::uno::Sequence< ::rtl::OUString > SAL_CALL DownSearchToolboxController::getSupportedServiceNames() throw( css::uno::RuntimeException )
+{
+ return getSupportedServiceNames_Static();
+}
+
+css::uno::Sequence< ::rtl::OUString > DownSearchToolboxController::getSupportedServiceNames_Static() throw()
+{
+ css::uno::Sequence< ::rtl::OUString > aSNS( 1 );
+ aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ));
+ return aSNS;
+}
+
+// XComponent
+void SAL_CALL DownSearchToolboxController::dispose() throw ( css::uno::RuntimeException )
+{
+ vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+
+ SearchToolbarControllersManager::createControllersManager()->freeController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL);
+
+ svt::ToolboxController::dispose();
+}
+
+// XInitialization
+void SAL_CALL DownSearchToolboxController::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException )
+{
+ svt::ToolboxController::initialize( aArguments );
+ SearchToolbarControllersManager::createControllersManager()->registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL);
+}
+
+// XToolbarController
+void SAL_CALL DownSearchToolboxController::execute( sal_Int16 /*KeyModifier*/ ) throw ( css::uno::RuntimeException)
+{
+ if ( m_bDisposed )
+ throw css::lang::DisposedException();
+
+ ::rtl::OUString sFindText;
+ Window* pWindow = VCLUnoHelper::GetWindow( getParent() );
+ ToolBox* pToolBox = (ToolBox*)pWindow;
+ if ( pToolBox )
+ {
+ sal_uInt16 nItemCount = pToolBox->GetItemCount();
+ for ( sal_uInt16 i=0; i<nItemCount; ++i )
+ {
+ ::rtl::OUString sItemCommand = pToolBox->GetItemCommand(i);
+ if ( sItemCommand.equals( COMMAND_FINDTEXT ) )
+ {
+ Window* pItemWin = pToolBox->GetItemWindow(i);
+ if (pItemWin)
+ sFindText = pItemWin->GetText();
+ break;
+ }
+ }
+ }
+
+ css::uno::Sequence< css::beans::PropertyValue > lArgs(2);
+ lArgs[0].Name = SEARCHITEM_SEARCHSTRING;
+ lArgs[0].Value <<= sFindText;
+ lArgs[1].Name = SEARCHITEM_SEARCHBACKWARD;
+ lArgs[1].Value <<= sal_False;
+
+ impl_executeSearch(m_xServiceManager, m_xFrame, lArgs);
+
+ css::frame::FeatureStateEvent aEvent;
+ aEvent.FeatureURL.Complete = COMMAND_APPENDSEARCHHISTORY;
+ css::uno::Reference< css::frame::XStatusListener > xStatusListener = SearchToolbarControllersManager::createControllersManager()->findController(m_xFrame, COMMAND_FINDTEXT);
+ if (xStatusListener.is())
+ xStatusListener->statusChanged( aEvent );
+}
+
+// XStatusListener
+void SAL_CALL DownSearchToolboxController::statusChanged( const css::frame::FeatureStateEvent& /*rEvent*/ ) throw ( css::uno::RuntimeException )
+{
+ vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+ if ( m_bDisposed )
+ return;
+}
+
+//-----------------------------------------------------------------------------------------------------------
+// class UpSearchToolboxController
+
+UpSearchToolboxController::UpSearchToolboxController( const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager )
+ :svt::ToolboxController( rServiceManager,
+ css::uno::Reference< css::frame::XFrame >(),
+ COMMAND_UPSEARCH )
+{
+}
+
+UpSearchToolboxController::~UpSearchToolboxController()
+{
+}
+
+// XInterface
+css::uno::Any SAL_CALL UpSearchToolboxController::queryInterface( const css::uno::Type& aType ) throw ( css::uno::RuntimeException )
+{
+ css::uno::Any a = ToolboxController::queryInterface( aType );
+ if ( a.hasValue() )
+ return a;
+
+ return ::cppu::queryInterface( aType, static_cast< css::lang::XServiceInfo* >( this ) );
+}
+
+void SAL_CALL UpSearchToolboxController::acquire() throw ()
+{
+ ToolboxController::acquire();
+}
+
+void SAL_CALL UpSearchToolboxController::release() throw ()
+{
+ ToolboxController::release();
+}
+
+// XServiceInfo
+::rtl::OUString SAL_CALL UpSearchToolboxController::getImplementationName() throw( css::uno::RuntimeException )
+{
+ return getImplementationName_Static();
+}
+
+sal_Bool SAL_CALL UpSearchToolboxController::supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException )
+{
+ const css::uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() );
+ const ::rtl::OUString * pArray = aSNL.getConstArray();
+
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == ServiceName )
+ return true;
+
+ return false;
+}
+
+css::uno::Sequence< ::rtl::OUString > SAL_CALL UpSearchToolboxController::getSupportedServiceNames() throw( css::uno::RuntimeException )
+{
+ return getSupportedServiceNames_Static();
+}
+
+css::uno::Sequence< ::rtl::OUString > UpSearchToolboxController::getSupportedServiceNames_Static() throw()
+{
+ css::uno::Sequence< ::rtl::OUString > aSNS( 1 );
+ aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ) );
+ return aSNS;
+}
+
+// XComponent
+void SAL_CALL UpSearchToolboxController::dispose() throw ( css::uno::RuntimeException )
+{
+ vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+
+ SearchToolbarControllersManager::createControllersManager()->freeController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL);
+
+ svt::ToolboxController::dispose();
+}
+
+// XInitialization
+void SAL_CALL UpSearchToolboxController::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException )
+{
+ svt::ToolboxController::initialize( aArguments );
+ SearchToolbarControllersManager::createControllersManager()->registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL);
+}
+
+// XToolbarController
+void SAL_CALL UpSearchToolboxController::execute( sal_Int16 /*KeyModifier*/ ) throw ( css::uno::RuntimeException )
+{
+ if ( m_bDisposed )
+ throw css::lang::DisposedException();
+
+ ::rtl::OUString sFindText;
+ Window* pWindow = VCLUnoHelper::GetWindow( getParent() );
+ ToolBox* pToolBox = (ToolBox*)pWindow;
+ if ( pToolBox )
+ {
+ sal_uInt16 nItemCount = pToolBox->GetItemCount();
+ for ( sal_uInt16 i=0; i<nItemCount; ++i )
+ {
+ ::rtl::OUString sItemCommand = pToolBox->GetItemCommand(i);
+ if ( sItemCommand.equals( COMMAND_FINDTEXT ) )
+ {
+ Window* pItemWin = pToolBox->GetItemWindow(i);
+ if (pItemWin)
+ sFindText = pItemWin->GetText();
+ break;
+ }
+ }
+ }
+
+ css::uno::Sequence< css::beans::PropertyValue > lArgs(2);
+ lArgs[0].Name = SEARCHITEM_SEARCHSTRING;
+ lArgs[0].Value <<= sFindText;
+ lArgs[1].Name = SEARCHITEM_SEARCHBACKWARD;
+ lArgs[1].Value <<= sal_True;
+
+ impl_executeSearch(m_xServiceManager, m_xFrame, lArgs);
+
+ css::frame::FeatureStateEvent aEvent;
+ aEvent.FeatureURL.Complete = COMMAND_APPENDSEARCHHISTORY;
+ css::uno::Reference< css::frame::XStatusListener > xStatusListener = SearchToolbarControllersManager::createControllersManager()->findController(m_xFrame, COMMAND_FINDTEXT);
+ if (xStatusListener.is())
+ xStatusListener->statusChanged( aEvent );
+}
+
+// XStatusListener
+void SAL_CALL UpSearchToolboxController::statusChanged( const css::frame::FeatureStateEvent& /*rEvent*/ ) throw ( css::uno::RuntimeException )
+{
+ vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
+ if ( m_bDisposed )
+ return;
+}
+
+//-----------------------------------------------------------------------------------------------------------
+// class FindbarDispatcher
+
+FindbarDispatcher::FindbarDispatcher(const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory)
+ : m_xFactory( xFactory )
+{
+}
+
+FindbarDispatcher::~FindbarDispatcher()
+{
+ m_xFactory = NULL;
+ m_xFrame = NULL;
+}
+
+// XInterface
+css::uno::Any SAL_CALL FindbarDispatcher::queryInterface( const css::uno::Type& aType ) throw( css::uno::RuntimeException )
+{
+ css::uno::Any aReturn( ::cppu::queryInterface( aType,
+ static_cast< css::lang::XServiceInfo* >(this),
+ static_cast< css::lang::XInitialization* >(this),
+ static_cast< css::frame::XDispatchProvider* >(this),
+ static_cast< css::frame::XDispatch* >(this)) );
+
+ if ( aReturn.hasValue() )
+ return aReturn;
+
+ return OWeakObject::queryInterface( aType );
+}
+
+void SAL_CALL FindbarDispatcher::acquire() throw()
+{
+ OWeakObject::acquire();
+}
+
+void SAL_CALL FindbarDispatcher::release() throw()
+{
+ OWeakObject::release();
+}
+
+// XServiceInfo
+::rtl::OUString SAL_CALL FindbarDispatcher::getImplementationName() throw( css::uno::RuntimeException )
+{
+ return getImplementationName_Static();
+}
+
+sal_Bool SAL_CALL FindbarDispatcher::supportsService( const ::rtl::OUString& ServiceName ) throw( css::uno::RuntimeException )
+{
+ return (
+ ServiceName.equalsAscii("com.sun.star.comp.svx.FindbarDispatcher") ||
+ ServiceName.equalsAscii("com.sun.star.frame.ProtocolHandler")
+ );
+}
+
+css::uno::Sequence< ::rtl::OUString > SAL_CALL FindbarDispatcher::getSupportedServiceNames() throw( css::uno::RuntimeException )
+{
+ return getSupportedServiceNames_Static();
+}
+
+css::uno::Sequence< ::rtl::OUString > FindbarDispatcher::getSupportedServiceNames_Static() throw()
+{
+ css::uno::Sequence< ::rtl::OUString > aSNS( 2 );
+ aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.FindbarDispatcher" ));
+ aSNS.getArray()[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ProtocolHandler" ));
+ return aSNS;
+}
+
+// XInitialization
+void SAL_CALL FindbarDispatcher::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw ( css::uno::Exception, css::uno::RuntimeException )
+{
+ if ( aArguments.getLength() )
+ aArguments[0] >>= m_xFrame;
+}
+
+// XDispatchProvider
+css::uno::Reference< css::frame::XDispatch > SAL_CALL FindbarDispatcher::queryDispatch( const css::util::URL& aURL, const ::rtl::OUString& /*sTargetFrameName*/, sal_Int32 /*nSearchFlags*/ ) throw( css::uno::RuntimeException )
+{
+ css::uno::Reference< css::frame::XDispatch > xDispatch;
+
+ if ( aURL.Protocol.equalsAscii("vnd.sun.star.findbar:") )
+ xDispatch = this;
+
+ return xDispatch;
+}
+
+css::uno::Sequence < css::uno::Reference< css::frame::XDispatch > > SAL_CALL FindbarDispatcher::queryDispatches( const css::uno::Sequence < css::frame::DispatchDescriptor >& seqDescripts ) throw( css::uno::RuntimeException )
+{
+ sal_Int32 nCount = seqDescripts.getLength();
+ css::uno::Sequence < css::uno::Reference < XDispatch > > lDispatcher( nCount );
+
+ for( sal_Int32 i=0; i<nCount; ++i )
+ lDispatcher[i] = queryDispatch( seqDescripts[i].FeatureURL, seqDescripts[i].FrameName, seqDescripts[i].SearchFlags );
+
+ return lDispatcher;
+}
+
+// XDispatch
+void SAL_CALL FindbarDispatcher::dispatch( const css::util::URL& aURL, const css::uno::Sequence < css::beans::PropertyValue >& /*lArgs*/ ) throw( css::uno::RuntimeException )
+{
+ //vnd.sun.star.findbar:FocusToFindbar - set cursor to the FindTextFieldControl of the findbar
+ if ( aURL.Path.equalsAscii("FocusToFindbar") )
+ {
+ css::uno::Reference< css::beans::XPropertySet > xPropSet(m_xFrame, css::uno::UNO_QUERY);
+ if(!xPropSet.is())
+ return;
+
+ css::uno::Reference< css::frame::XLayoutManager > xLayoutManager;
+ css::uno::Any aValue = xPropSet->getPropertyValue( ::rtl::OUString::createFromAscii("LayoutManager") );
+ aValue >>= xLayoutManager;
+ if (!xLayoutManager.is())
+ return;
+
+ const ::rtl::OUString sResourceURL = ::rtl::OUString::createFromAscii("private:resource/toolbar/findbar");
+ css::uno::Reference< css::ui::XUIElement > xUIElement = xLayoutManager->getElement(sResourceURL);
+ if (!xUIElement.is())
+ return;
+
+ css::uno::Reference< css::awt::XWindow > xWindow(xUIElement->getRealInterface(), css::uno::UNO_QUERY);
+ Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
+ ToolBox* pToolBox = (ToolBox*)pWindow;
+ if ( pToolBox )
+ {
+ sal_uInt16 nItemCount = pToolBox->GetItemCount();
+ for ( sal_uInt16 i=0; i<nItemCount; ++i )
+ {
+ ::rtl::OUString sItemCommand = pToolBox->GetItemCommand(i);
+ if ( sItemCommand.equalsAscii(".uno:FindText") )
+ {
+ Window* pItemWin = pToolBox->GetItemWindow( i );
+ if ( pItemWin )
+ {
+ pItemWin->GrabFocus();
+ return;
+ }
+ }
+ }
+ }
+
+ }
+}
+
+void SAL_CALL FindbarDispatcher::addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& /*xControl*/, const css::util::URL& /*aURL*/ ) throw ( css::uno::RuntimeException )
+{
+}
+
+void SAL_CALL FindbarDispatcher::removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& /*xControl*/, const css::util::URL& /*aURL*/ ) throw ( css::uno::RuntimeException )
+{
+}
+
+//-----------------------------------------------------------------------------------------------------------
+// create Instance
+
+css::uno::Reference< css::uno::XInterface > SAL_CALL FindTextToolbarController_createInstance(
+ const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr )
+{
+ return *new FindTextToolbarController( rSMgr );
+}
+
+css::uno::Reference< css::uno::XInterface > SAL_CALL DownSearchToolboxController_createInstance(
+ const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr )
+{
+ return *new DownSearchToolboxController( rSMgr );
+}
+
+css::uno::Reference< css::uno::XInterface > SAL_CALL UpSearchToolboxController_createInstance(
+ const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr )
+{
+ return *new UpSearchToolboxController( rSMgr );
+}
+
+css::uno::Reference< css::uno::XInterface > SAL_CALL FindbarDispatcher_createInstance(
+ const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr )
+{
+ return *new FindbarDispatcher( rSMgr );
+}
+
+//-----------------------------------------------------------------------------------------------------------
+}
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.src b/svx/source/tbxctrls/tbunosearchcontrollers.src
new file mode 100644
index 000000000000..9a256ae0cabb
--- /dev/null
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.src
@@ -0,0 +1,33 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svx/dialogs.hrc>
+
+String RID_SVXSTR_FINDBAR_FIND
+{
+ Text [ en-US ] = "Find" ;
+};
diff --git a/svx/source/tbxctrls/tbxalign.cxx b/svx/source/tbxctrls/tbxalign.cxx
new file mode 100644
index 000000000000..8b509fdafc50
--- /dev/null
+++ b/svx/source/tbxctrls/tbxalign.cxx
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svl/aeitem.hxx>
+
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+
+#include "svx/tbxalign.hxx"
+#include "svx/tbxdraw.hxx"
+#include "tbxdraw.hrc"
+#include <tools/shl.hxx>
+#ifndef _SFX_IMAGEMGR_HXX
+#include <sfx2/imagemgr.hxx>
+#endif
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+
+#include <sfx2/app.hxx>
+#include <vcl/toolbox.hxx>
+
+SFX_IMPL_TOOLBOX_CONTROL(SvxTbxCtlAlign, SfxAllEnumItem);
+
+/*************************************************************************
+|*
+|* Klasse fuer SwToolbox
+|*
+\************************************************************************/
+
+SvxTbxCtlAlign::SvxTbxCtlAlign( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
+ SfxToolBoxControl( nSlotId, nId, rTbx )
+ , m_aSubTbName( RTL_CONSTASCII_USTRINGPARAM( "alignmentbar" ))
+ , m_aSubTbResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/alignmentbar" ))
+{
+ rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) );
+ rTbx.Invalidate();
+
+ m_aCommand = m_aCommandURL;
+}
+
+/*************************************************************************
+|*
+|* Wenn man ein PopupWindow erzeugen will
+|*
+\************************************************************************/
+
+SfxPopupWindowType SvxTbxCtlAlign::GetPopupWindowType() const
+{
+ return(SFX_POPUPWINDOW_ONCLICK);
+}
+
+/*************************************************************************
+|*
+|* Hier wird das Fenster erzeugt
+|* Lage der Toolbox mit GetToolBox() abfragbar
+|* rItemRect sind die Screen-Koordinaten
+|*
+\************************************************************************/
+
+SfxPopupWindow* SvxTbxCtlAlign::CreatePopupWindow()
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( GetSlotId() == SID_OBJECT_ALIGN )
+ createAndPositionSubToolBar( m_aSubTbResName );
+ return NULL;
+}
+
+//========================================================================
+// XSubToolbarController
+//========================================================================
+
+::sal_Bool SAL_CALL SvxTbxCtlAlign::opensSubToolbar() throw (::com::sun::star::uno::RuntimeException)
+{
+ // We control a sub-toolbar therefor, we have to return true.
+ return sal_True;
+}
+
+::rtl::OUString SAL_CALL SvxTbxCtlAlign::getSubToolbarName() throw (::com::sun::star::uno::RuntimeException)
+{
+ // Provide the controlled sub-toolbar name, so we are notified whenever
+ // this toolbar executes a function.
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ return m_aSubTbName;
+}
+
+void SAL_CALL SvxTbxCtlAlign::functionSelected( const ::rtl::OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException)
+{
+ // Our sub-toolbar wants to executes a function. We have to change
+ // the image of our toolbar button to reflect the new function.
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( !m_bDisposed )
+ {
+ if ( aCommand.getLength() > 0 )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame( getFrameInterface());
+ Image aImage = GetImage( xFrame, aCommand, hasBigImages(), isHighContrast() );
+ if ( !!aImage )
+ GetToolBox().SetItemImage( GetId(), aImage );
+ }
+ }
+}
+
+void SAL_CALL SvxTbxCtlAlign::updateImage() throw (::com::sun::star::uno::RuntimeException)
+{
+ // We should update the button image of our parent (toolbar). Use the stored
+ // command to set the correct current image.
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( m_aCommand.getLength() > 0 )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame( getFrameInterface());
+ Image aImage = GetImage( xFrame, m_aCommand, hasBigImages(), isHighContrast() );
+ if ( !!aImage )
+ GetToolBox().SetItemImage( GetId(), aImage );
+ }
+}
diff --git a/svx/source/tbxctrls/tbxcolor.cxx b/svx/source/tbxctrls/tbxcolor.cxx
new file mode 100644
index 000000000000..83b48b9e57b7
--- /dev/null
+++ b/svx/source/tbxctrls/tbxcolor.cxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svx/tbxcolor.hxx"
+#include <sfx2/viewfrm.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::frame;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::frame;
+
+ #define DECLARE_ASCII(s) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(s) )
+ #define TOOLBAR_RESNAME DECLARE_ASCII("private:resource/toolbar/")
+ #define PROPNAME_LAYOUTMANAGER DECLARE_ASCII("LayoutManager")
+
+ //====================================================================
+ //= ToolboxAccess
+ //====================================================================
+ ToolboxAccess::ToolboxAccess( const ::rtl::OUString& rToolboxName ) :
+
+ m_bDocking ( false ),
+ m_sToolboxResName ( TOOLBAR_RESNAME )
+
+ {
+ m_sToolboxResName += rToolboxName;
+
+ // the layout manager
+ if ( SfxViewFrame::Current() )
+ {
+ try
+ {
+ Reference< XFrame > xFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface();
+ Reference< XPropertySet > xFrameProps( xFrame, UNO_QUERY );
+ if ( xFrameProps.is() )
+ xFrameProps->getPropertyValue( PROPNAME_LAYOUTMANAGER ) >>= m_xLayouter;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "ToolboxAccess::Ctor(): exception" );
+ }
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void ToolboxAccess::toggleToolbox() const
+ {
+ try
+ {
+ Reference< XLayoutManager > xManager( m_xLayouter );
+ OSL_ENSURE( xManager. is(), "ToolboxAccess::toggleToolbox: couldn't obtain the layout manager!" );
+ if ( xManager. is() )
+ {
+ if ( xManager->isElementVisible( m_sToolboxResName ) )
+ {
+ xManager->hideElement( m_sToolboxResName );
+ xManager->destroyElement( m_sToolboxResName );
+ }
+ else
+ {
+ xManager->createElement( m_sToolboxResName );
+ xManager->showElement( m_sToolboxResName );
+ ::com::sun::star::awt::Point aPos;
+
+ if ( m_bDocking )
+ xManager->dockWindow( m_sToolboxResName,
+ ::com::sun::star::ui::DockingArea_DOCKINGAREA_BOTTOM, aPos );
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "ToolboxAccess::toggleToolbox: caught an exception!" );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ bool ToolboxAccess::isToolboxVisible() const
+ {
+ return ( m_xLayouter.is() && m_xLayouter->isElementVisible( m_sToolboxResName ) );
+ }
+
+//........................................................................
+} // namespace svx
+//........................................................................
+
diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx
new file mode 100644
index 000000000000..e218f01fac0e
--- /dev/null
+++ b/svx/source/tbxctrls/tbxcolorupdate.cxx
@@ -0,0 +1,208 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/tbxcolorupdate.hxx>
+#include <svx/svxids.hrc>
+
+#include <vcl/toolbox.hxx>
+#include <vcl/bmpacc.hxx>
+#include <tools/debug.hxx>
+
+#define IMAGE_COL_TRANSPARENT COL_LIGHTMAGENTA
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ //====================================================================
+ //= ToolboxButtonColorUpdater
+ //====================================================================
+
+ ToolboxButtonColorUpdater::ToolboxButtonColorUpdater(
+ sal_uInt16 nId,
+ sal_uInt16 nTbxBtnId,
+ ToolBox* ptrTbx,
+ sal_uInt16 nMode ) :
+ mnDrawMode ( nMode ),
+ mnBtnId ( nTbxBtnId ),
+ mnSlotId ( nId ),
+ mpTbx ( ptrTbx ),
+ maCurColor ( COL_TRANSPARENT )
+ {
+ if (mnSlotId == SID_BACKGROUND_COLOR)
+ mnDrawMode = TBX_UPDATER_MODE_CHAR_COLOR_NEW;
+ DBG_ASSERT( ptrTbx, "ToolBox not found :-(" );
+ mbWasHiContrastMode = ptrTbx ? ( ptrTbx->GetSettings().GetStyleSettings().GetHighContrastMode() ) : sal_False;
+ Update(mnSlotId == SID_ATTR_CHAR_COLOR2 ? COL_BLACK : COL_GRAY);
+ }
+
+ // -----------------------------------------------------------------------
+
+ ToolboxButtonColorUpdater::~ToolboxButtonColorUpdater()
+ {
+ }
+
+ // -----------------------------------------------------------------------
+
+ void ToolboxButtonColorUpdater::Update( const Color& rColor )
+ {
+ Image aImage( mpTbx->GetItemImage( mnBtnId ) );
+ const bool bSizeChanged = ( maBmpSize != aImage.GetSizePixel() );
+ const bool bDisplayModeChanged = ( mbWasHiContrastMode != mpTbx->GetSettings().GetStyleSettings().GetHighContrastMode() );
+ Color aColor( rColor );
+
+ // !!! #109290# Workaround for SetFillColor with COL_AUTO
+ if( aColor.GetColor() == COL_AUTO )
+ aColor = Color( COL_TRANSPARENT );
+
+ if( ( maCurColor != aColor ) || bSizeChanged || bDisplayModeChanged )
+ {
+ BitmapEx aBmpEx( aImage.GetBitmapEx() );
+ Bitmap aBmp( aBmpEx.GetBitmap() );
+ BitmapWriteAccess* pBmpAcc = aBmp.AcquireWriteAccess();
+
+ maBmpSize = aBmp.GetSizePixel();
+
+ if( pBmpAcc )
+ {
+ Bitmap aMsk;
+ BitmapWriteAccess* pMskAcc;
+ const Point aNullPnt;
+
+ if( aBmpEx.IsAlpha() )
+ pMskAcc = ( aMsk = aBmpEx.GetAlpha().GetBitmap() ).AcquireWriteAccess();
+ else if( aBmpEx.IsTransparent() )
+ pMskAcc = ( aMsk = aBmpEx.GetMask() ).AcquireWriteAccess();
+ else
+ pMskAcc = NULL;
+
+ mbWasHiContrastMode = mpTbx->GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ if( mnDrawMode == TBX_UPDATER_MODE_CHAR_COLOR_NEW && ( COL_TRANSPARENT != aColor.GetColor() ) )
+ pBmpAcc->SetLineColor( aColor );
+ else if( mpTbx->GetBackground().GetColor().IsDark() )
+ pBmpAcc->SetLineColor( Color( COL_WHITE ) );
+ else
+ pBmpAcc->SetLineColor( Color( COL_BLACK ) );
+
+ pBmpAcc->SetFillColor( maCurColor = aColor );
+
+ if( TBX_UPDATER_MODE_CHAR_COLOR_NEW == mnDrawMode || TBX_UPDATER_MODE_NONE == mnDrawMode )
+ {
+ if( TBX_UPDATER_MODE_CHAR_COLOR_NEW == mnDrawMode )
+ {
+ if( maBmpSize.Width() <= 16 )
+ maUpdRect = Rectangle( Point( 0,12 ), Size( maBmpSize.Width(), 4 ) );
+ else
+ maUpdRect = Rectangle( Point( 1, maBmpSize.Height() - 7 ), Size( maBmpSize.Width() - 2 ,6 ) );
+ }
+ else
+ {
+ if( maBmpSize.Width() <= 16 )
+ maUpdRect = Rectangle( Point( 7, 7 ), Size( 8, 8 ) );
+ else
+ maUpdRect = Rectangle( Point( maBmpSize.Width() - 12, maBmpSize.Height() - 12 ), Size( 11, 11 ) );
+ }
+
+ pBmpAcc->DrawRect( maUpdRect );
+
+ if( pMskAcc )
+ {
+ if( COL_TRANSPARENT == aColor.GetColor() )
+ {
+ pMskAcc->SetLineColor( COL_BLACK );
+ pMskAcc->SetFillColor( COL_WHITE );
+ }
+ else
+ pMskAcc->SetFillColor( COL_BLACK );
+
+ pMskAcc->DrawRect( maUpdRect );
+ }
+ }
+ else
+ {
+ DBG_ERROR( "ToolboxButtonColorUpdater::Update: TBX_UPDATER_MODE_CHAR_COLOR / TBX_UPDATER_MODE_CHAR_BACKGROUND" );
+ // !!! DrawChar( aVirDev, aColor );
+ }
+
+ aBmp.ReleaseAccess( pBmpAcc );
+
+ if( pMskAcc )
+ aMsk.ReleaseAccess( pMskAcc );
+
+ if( aBmpEx.IsAlpha() )
+ aBmpEx = BitmapEx( aBmp, AlphaMask( aMsk ) );
+ else if( aBmpEx.IsTransparent() )
+ aBmpEx = BitmapEx( aBmp, aMsk );
+ else
+ aBmpEx = aBmp;
+
+ mpTbx->SetItemImage( mnBtnId, Image( aBmpEx ) );
+ }
+ }
+ }
+
+ // -----------------------------------------------------------------------
+
+ void ToolboxButtonColorUpdater::DrawChar( VirtualDevice& rVirDev, const Color& rCol )
+ {
+ Font aOldFont = rVirDev.GetFont();
+ Font aFont = aOldFont;
+ Size aSz = aFont.GetSize();
+ aSz.Height() = maBmpSize.Height();
+ aFont.SetSize( aSz );
+ aFont.SetWeight( WEIGHT_BOLD );
+
+ if ( mnDrawMode == TBX_UPDATER_MODE_CHAR_COLOR )
+ {
+ aFont.SetColor( rCol );
+ aFont.SetFillColor( Color( IMAGE_COL_TRANSPARENT ) );
+ }
+ else
+ {
+ rVirDev.SetLineColor();
+ rVirDev.SetFillColor( rCol );
+ Rectangle aRect( Point(0,0), maBmpSize );
+ rVirDev.DrawRect( aRect );
+ aFont.SetFillColor( rCol );
+ }
+ rVirDev.SetFont( aFont );
+ Size aTxtSize(rVirDev.GetTextWidth( 'A' ), rVirDev.GetTextHeight());
+ Point aPos( ( maBmpSize.Width() - aTxtSize.Width() ) / 2,
+ ( maBmpSize.Height() - aTxtSize.Height() ) / 2 );
+
+ rVirDev.DrawText( aPos, 'A' );
+ rVirDev.SetFont( aOldFont );
+ }
+
+//........................................................................
+} // namespace svx
+//........................................................................
diff --git a/svx/source/tbxctrls/tbxdraw.hrc b/svx/source/tbxctrls/tbxdraw.hrc
new file mode 100644
index 000000000000..e7d687468118
--- /dev/null
+++ b/svx/source/tbxctrls/tbxdraw.hrc
@@ -0,0 +1,31 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <svx/dialogs.hrc>
+#include <svx/svxids.hrc>
+
+#define TBX_DRAW 1
+#define TBX_ALIGNMENT SID_OBJECT_ALIGN_LEFT
diff --git a/svx/source/tbxctrls/tbxdrctl.cxx b/svx/source/tbxctrls/tbxdrctl.cxx
new file mode 100644
index 000000000000..5943d6d0286d
--- /dev/null
+++ b/svx/source/tbxctrls/tbxdrctl.cxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <string> // HACK: prevent conflict between STLPORT and Workshop headers
+
+#include <tools/ref.hxx>
+#include <tools/shl.hxx>
+#include <svl/aeitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/imagemgr.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <vcl/toolbox.hxx>
+
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+
+#include "svx/tbxctl.hxx"
+#include "svx/tbxdraw.hxx"
+#include "svx/tbxcolor.hxx"
+#include "tbxdraw.hrc"
+#include <com/sun/star/frame/XLayoutManager.hpp>
+
+SFX_IMPL_TOOLBOX_CONTROL(SvxTbxCtlDraw, SfxAllEnumItem);
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::frame;
+
+// -----------------------------------------------------------------------
+
+SvxTbxCtlDraw::SvxTbxCtlDraw( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
+
+ SfxToolBoxControl( nSlotId, nId, rTbx ),
+
+ m_sToolboxName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/drawbar" ) )
+
+{
+ rTbx.SetItemBits( nId, TIB_CHECKABLE | rTbx.GetItemBits( nId ) );
+ rTbx.Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxTbxCtlDraw::StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState )
+{
+ GetToolBox().EnableItem( GetId(), ( eState != SFX_ITEM_DISABLED ) );
+ SfxToolBoxControl::StateChanged( nSID, eState, pState );
+
+ Reference< XLayoutManager > xLayoutMgr = getLayoutManager();
+ if ( xLayoutMgr.is() )
+ GetToolBox().CheckItem(
+ GetId(), xLayoutMgr->isElementVisible( m_sToolboxName ) != sal_False );
+}
+
+// -----------------------------------------------------------------------
+
+SfxPopupWindowType SvxTbxCtlDraw::GetPopupWindowType() const
+{
+ return SFX_POPUPWINDOW_ONCLICK;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxTbxCtlDraw::toggleToolbox()
+{
+ Reference< XLayoutManager > xLayoutMgr = getLayoutManager();
+ if ( xLayoutMgr.is() )
+ {
+ sal_Bool bCheck = sal_False;
+ if ( xLayoutMgr->isElementVisible( m_sToolboxName ) )
+ {
+ xLayoutMgr->hideElement( m_sToolboxName );
+ xLayoutMgr->destroyElement( m_sToolboxName );
+ }
+ else
+ {
+ bCheck = sal_True;
+ xLayoutMgr->createElement( m_sToolboxName );
+ xLayoutMgr->showElement( m_sToolboxName );
+ }
+
+ GetToolBox().CheckItem( GetId(), bCheck );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxTbxCtlDraw::Select( sal_Bool )
+{
+ toggleToolbox();
+}
+
diff --git a/svx/source/tbxctrls/verttexttbxctrl.cxx b/svx/source/tbxctrls/verttexttbxctrl.cxx
new file mode 100644
index 000000000000..6f437dfb791e
--- /dev/null
+++ b/svx/source/tbxctrls/verttexttbxctrl.cxx
@@ -0,0 +1,123 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/verttexttbxctrl.hxx>
+#include <svl/languageoptions.hxx>
+#include <sfx2/app.hxx>
+#include <svl/eitem.hxx>
+#include <vcl/toolbox.hxx>
+#include <rtl/ustring.hxx>
+
+SFX_IMPL_TOOLBOX_CONTROL(SvxCTLTextTbxCtrl, SfxBoolItem);
+SFX_IMPL_TOOLBOX_CONTROL(SvxVertTextTbxCtrl, SfxBoolItem);
+
+// -----------------------------27.04.01 15:50--------------------------------
+
+SvxCTLTextTbxCtrl::SvxCTLTextTbxCtrl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
+ SvxVertCTLTextTbxCtrl( nSlotId, nId, rTbx )
+{
+ SetVert(sal_False);
+ addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CTLFontState" )));
+}
+
+SvxVertTextTbxCtrl::SvxVertTextTbxCtrl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
+ SvxVertCTLTextTbxCtrl( nSlotId, nId, rTbx )
+{
+ SetVert(sal_True);
+ addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:VerticalTextState" )));
+}
+
+/* ---------------------------------------------------------------------------*/
+SvxVertCTLTextTbxCtrl::SvxVertCTLTextTbxCtrl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
+ SfxToolBoxControl( nSlotId, nId, rTbx ),
+ bCheckVertical(sal_True)
+{
+}
+
+/* -----------------------------27.04.01 15:53--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxVertCTLTextTbxCtrl::~SvxVertCTLTextTbxCtrl( )
+{
+}
+/* -----------------------------27.04.01 15:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxVertCTLTextTbxCtrl::StateChanged(
+ sal_uInt16 nSID,
+ SfxItemState eState,
+ const SfxPoolItem* pState )
+{
+ SvtLanguageOptions aLangOptions;
+ sal_Bool bCalc = sal_False;
+ sal_Bool bVisible = GetToolBox().IsItemVisible(GetId());
+ sal_Bool bEnabled = sal_False;
+ if ( nSID == SID_VERTICALTEXT_STATE )
+ bEnabled = aLangOptions.IsVerticalTextEnabled();
+ else if ( nSID == SID_CTLFONT_STATE )
+ bEnabled = aLangOptions.IsCTLFontEnabled();
+ else
+ {
+ SfxToolBoxControl::StateChanged(nSID, eState, pState);
+ return;
+ }
+
+ if(bEnabled)
+ {
+ if(!bVisible)
+ {
+ GetToolBox().ShowItem( GetId(), sal_True );
+ bCalc = sal_True;
+ }
+ }
+ else if(bVisible)
+ {
+ GetToolBox().HideItem( GetId() );
+ bCalc = sal_True;
+ }
+ if(bCalc)
+ {
+ ToolBox& rTbx = GetToolBox();
+ Window* pParent = rTbx.GetParent();
+ WindowType nWinType = pParent->GetType();
+ if(WINDOW_FLOATINGWINDOW == nWinType)
+ {
+ Size aSize(rTbx.CalcWindowSizePixel());
+ rTbx.SetPosSizePixel( Point(), aSize );
+ pParent->SetOutputSizePixel( aSize );
+ }
+ }
+}
+/* -----------------------------27.04.01 15:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+
diff --git a/svx/source/toolbars/extrusionbar.cxx b/svx/source/toolbars/extrusionbar.cxx
new file mode 100644
index 000000000000..41d4a8c824c5
--- /dev/null
+++ b/svx/source/toolbars/extrusionbar.cxx
@@ -0,0 +1,1374 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#ifndef _COM_SUN_STAR_DRAWING_ENHANCEDCUSTOMSHAPEPARAMETERPARIR_HPP_
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
+#endif
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <com/sun/star/drawing/Position3D.hpp>
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <svx/svdundo.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/objface.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/bindings.hxx>
+#include <svx/xsflclit.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/svdoashp.hxx>
+#ifndef _SVX_DIALOGS_HRC
+#include <svx/dialogs.hrc>
+#endif
+#include <svx/svdview.hxx>
+#include <editeng/colritem.hxx>
+#include "svx/chrtitem.hxx"
+
+#include <svx/extrusionbar.hxx>
+#include "extrusiondepthdialog.hxx"
+
+
+using namespace ::svx;
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::uno;
+
+/*************************************************************************
+|*
+|* Standardinterface deklarieren (Die Slotmap darf nicht leer sein, also
+|* tragen wir etwas ein, was hier (hoffentlich) nie vorkommt).
+|*
+\************************************************************************/
+
+#define ShellClass ExtrusionBar
+
+SFX_SLOTMAP(ExtrusionBar)
+{
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+};
+
+SFX_IMPL_INTERFACE(ExtrusionBar, SfxShell, SVX_RES(RID_SVX_EXTRUSION_BAR))
+{
+ SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT, SVX_RES(RID_SVX_EXTRUSION_BAR) );
+}
+
+TYPEINIT1( ExtrusionBar, SfxShell );
+
+
+/*************************************************************************
+|*
+|* Standard-Konstruktor
+|*
+\************************************************************************/
+
+ExtrusionBar::ExtrusionBar(SfxViewShell* pViewShell )
+: SfxShell(pViewShell)
+{
+ DBG_ASSERT( pViewShell, "svx::ExtrusionBar::ExtrusionBar(), I need a viewshell!" );
+ if( pViewShell )
+ SetPool(&pViewShell->GetPool());
+
+ SetHelpId( SVX_INTERFACE_EXTRUSION_BAR );
+ SetName( String( SVX_RES( RID_SVX_EXTRUSION_BAR )));
+}
+
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+ExtrusionBar::~ExtrusionBar()
+{
+ SetRepeatTarget(NULL);
+}
+
+void getLightingDirectionDefaults( const Direction3D **pLighting1Defaults, const Direction3D **pLighting2Defaults )
+{
+
+ static const Direction3D aLighting1Defaults[9] =
+ {
+ Direction3D( -50000, -50000, 10000 ),
+ Direction3D( 0, -50000, 10000 ),
+ Direction3D( 50000, -50000, 10000 ),
+ Direction3D( -50000, 0, 10000 ),
+ Direction3D( 0, 0, 10000 ),
+ Direction3D( 50000, 0, 10000 ),
+ Direction3D( -50000, 50000, 10000 ),
+ Direction3D( 0, 50000, 10000 ),
+ Direction3D( 50000, 50000, 10000 )
+ };
+
+ static const Direction3D aLighting2Defaults[9] =
+ {
+ Direction3D( 50000,0, 10000 ),
+ Direction3D( 0, 50000, 10000 ),
+ Direction3D( -50000, 0, 10000 ),
+ Direction3D( 50000, 0, 10000 ),
+ Direction3D( 0, 0, 10000 ),
+ Direction3D( -50000, 0, 10000 ),
+ Direction3D( 50000, 0, 10000 ),
+ Direction3D( 0, -50000, 10000 ),
+ Direction3D( -50000, 0, 10000 )
+ };
+
+ *pLighting1Defaults = (const Direction3D *)aLighting1Defaults;
+ *pLighting2Defaults = (const Direction3D *)aLighting2Defaults;
+};
+
+static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem& rGeometryItem, SdrObject* pObj )
+{
+ static const rtl::OUString sExtrusion( RTL_CONSTASCII_USTRINGPARAM ( "Extrusion" ) );
+ static const rtl::OUString sProjectionMode( RTL_CONSTASCII_USTRINGPARAM ( "ProjectionMode" ) );
+ static const rtl::OUString sRotateAngle( RTL_CONSTASCII_USTRINGPARAM ( "RotateAngle" ) );
+ static const rtl::OUString sViewPoint( RTL_CONSTASCII_USTRINGPARAM ( "ViewPoint" ) );
+ static const rtl::OUString sOrigin( RTL_CONSTASCII_USTRINGPARAM ( "Origin" ) );
+ static const rtl::OUString sSkew( RTL_CONSTASCII_USTRINGPARAM ( "Skew" ) );
+ static const rtl::OUString sDepth( RTL_CONSTASCII_USTRINGPARAM ( "Depth" ) );
+
+ sal_uInt16 nSID = rReq.GetSlot();
+ switch( nSID )
+ {
+ case SID_EXTRUSION_TOOGLE:
+ {
+ com::sun::star::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
+
+ if( pAny )
+ {
+ sal_Bool bOn;
+ (*pAny) >>= bOn;
+ bOn = !bOn;
+ (*pAny) <<= bOn;
+ }
+ else
+ {
+ com::sun::star::beans::PropertyValue aPropValue;
+ aPropValue.Name = sExtrusion;
+ aPropValue.Value <<= sal_True;
+ rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
+ }
+ }
+ break;
+
+ case SID_EXTRUSION_TILT_DOWN:
+ case SID_EXTRUSION_TILT_UP:
+ case SID_EXTRUSION_TILT_LEFT:
+ case SID_EXTRUSION_TILT_RIGHT:
+ {
+ sal_Bool bHorizontal = ( nSID == SID_EXTRUSION_TILT_DOWN ) || ( nSID == SID_EXTRUSION_TILT_UP );
+ sal_Int32 nDiff = ( nSID == SID_EXTRUSION_TILT_LEFT ) || ( nSID == SID_EXTRUSION_TILT_UP ) ? 5 : -5;
+ EnhancedCustomShapeParameterPair aRotateAnglePropPair;
+ double fX = 0.0;
+ double fY = 0.0;
+ aRotateAnglePropPair.First.Value <<= fX;
+ aRotateAnglePropPair.First.Type = EnhancedCustomShapeParameterType::NORMAL;
+ aRotateAnglePropPair.Second.Value <<= fY;
+ aRotateAnglePropPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL;
+ com::sun::star::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, sRotateAngle );
+ if( pAny && ( *pAny >>= aRotateAnglePropPair ) )
+ {
+ aRotateAnglePropPair.First.Value >>= fX;
+ aRotateAnglePropPair.Second.Value >>= fY;
+ }
+ if ( bHorizontal )
+ fX += nDiff;
+ else
+ fY += nDiff;
+ aRotateAnglePropPair.First.Value <<= fX;
+ aRotateAnglePropPair.Second.Value <<= fY;
+ com::sun::star::beans::PropertyValue aPropValue;
+ aPropValue.Name = sRotateAngle;
+ aPropValue.Value <<= aRotateAnglePropPair;
+ rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
+ }
+ break;
+
+ case SID_EXTRUSION_DIRECTION:
+ {
+ if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_DIRECTION ) == SFX_ITEM_SET )
+ {
+ sal_Int32 nSkew = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_EXTRUSION_DIRECTION))->GetValue();
+
+ Position3D aViewPoint( 3472, -3472, 25000 );
+ double fOriginX = 0.50;
+ double fOriginY = -0.50;
+ double fSkewAngle = nSkew;
+ double fSkew = 50.0;
+
+ switch( nSkew )
+ {
+ case 135:
+ aViewPoint.PositionY = 3472;
+ fOriginY = 0.50;
+ break;
+ case 90:
+ aViewPoint.PositionX = 0;
+ aViewPoint.PositionY = 3472;
+ fOriginX = 0;
+ fOriginY = -0.50;
+ break;
+ case 45:
+ aViewPoint.PositionX = -3472;
+ aViewPoint.PositionY = 3472;
+ fOriginX = -0.50;
+ fOriginY = 0.50;
+ break;
+ case 180:
+ aViewPoint.PositionY = 0;
+ fOriginY = 0;
+ break;
+ case 0:
+ aViewPoint.PositionX = 0;
+ aViewPoint.PositionY = 0;
+ fOriginX = 0;
+ fOriginY = 0;
+ fSkew = 0.0;
+ break;
+ case -360:
+ aViewPoint.PositionX = -3472;
+ aViewPoint.PositionY = 0;
+ fOriginX = -0.50;
+ fOriginY = 0;
+ break;
+ case -90:
+ aViewPoint.PositionX = 0;
+ fOriginX = 0;
+ break;
+ case -45:
+ aViewPoint.PositionX = -3472;
+ fOriginX = -0.50;
+ break;
+ }
+
+ com::sun::star::beans::PropertyValue aPropValue;
+
+ aPropValue.Name = sViewPoint;
+ aPropValue.Value <<= aViewPoint;
+ rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
+
+
+ EnhancedCustomShapeParameterPair aOriginPropPair;
+ aOriginPropPair.First.Value <<= fOriginX;
+ aOriginPropPair.First.Type = EnhancedCustomShapeParameterType::NORMAL;
+ aOriginPropPair.Second.Value <<= fOriginY;
+ aOriginPropPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL;
+ aPropValue.Name = sOrigin;
+ aPropValue.Value <<= aOriginPropPair;
+ rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
+
+ EnhancedCustomShapeParameterPair aSkewPropPair;
+ aSkewPropPair.First.Value <<= fSkew;
+ aSkewPropPair.First.Type = EnhancedCustomShapeParameterType::NORMAL;
+ aSkewPropPair.Second.Value <<= fSkewAngle;
+ aSkewPropPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL;
+ aPropValue.Name = sSkew;
+ aPropValue.Value <<= aSkewPropPair;
+ rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
+ }
+ }
+ break;
+ case SID_EXTRUSION_PROJECTION:
+ {
+ if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_PROJECTION ) == SFX_ITEM_SET )
+ {
+ sal_Int32 nProjection = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_EXTRUSION_PROJECTION))->GetValue();
+ ProjectionMode eProjectionMode = nProjection == 1 ? ProjectionMode_PARALLEL : ProjectionMode_PERSPECTIVE;
+ com::sun::star::beans::PropertyValue aPropValue;
+ aPropValue.Name = sProjectionMode;
+ aPropValue.Value <<= eProjectionMode;
+ rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
+ }
+ }
+ break;
+ case SID_EXTRUSION_DEPTH:
+ {
+ if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_DEPTH ) == SFX_ITEM_SET)
+ {
+ double fDepth = ((const SvxDoubleItem*)rReq.GetArgs()->GetItem(SID_EXTRUSION_DEPTH))->GetValue();
+ double fFraction = 0.0;
+ EnhancedCustomShapeParameterPair aDepthPropPair;
+ aDepthPropPair.First.Value <<= fDepth;
+ aDepthPropPair.First.Type = EnhancedCustomShapeParameterType::NORMAL;
+ aDepthPropPair.Second.Value <<= fFraction;
+ aDepthPropPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL;
+
+ com::sun::star::beans::PropertyValue aPropValue;
+ aPropValue.Name = sDepth;
+ aPropValue.Value <<= aDepthPropPair;
+ rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
+ }
+ }
+ break;
+ case SID_EXTRUSION_3D_COLOR:
+ {
+ static const rtl::OUString sExtrusionColor( RTL_CONSTASCII_USTRINGPARAM ( "Color" ) );
+
+ if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_3D_COLOR ) == SFX_ITEM_SET)
+ {
+ Color aColor( ((const SvxColorItem&)rReq.GetArgs()->Get(SID_EXTRUSION_3D_COLOR)).GetValue() );
+
+ const bool bAuto = aColor == COL_AUTO;
+
+ com::sun::star::beans::PropertyValue aPropValue;
+ aPropValue.Name = sExtrusionColor;
+ aPropValue.Value <<= bAuto ? sal_False : sal_True;
+ rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
+
+ if( bAuto )
+ {
+ pObj->ClearMergedItem( XATTR_SECONDARYFILLCOLOR );
+ }
+ else
+ {
+ pObj->SetMergedItem( XSecondaryFillColorItem( String(), aColor ) );
+ }
+ pObj->BroadcastObjectChange();
+ }
+ }
+ break;
+ case SID_EXTRUSION_SURFACE:
+ {
+ static const rtl::OUString sShadeMode( RTL_CONSTASCII_USTRINGPARAM ( "ShadeMode" ) );
+ static const rtl::OUString sSpecularity( RTL_CONSTASCII_USTRINGPARAM ( "Specularity" ) );
+ static const rtl::OUString sDiffusion( RTL_CONSTASCII_USTRINGPARAM ( "Diffusion" ) );
+ static const rtl::OUString sMetal( RTL_CONSTASCII_USTRINGPARAM ( "Metal" ) );
+
+ if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_SURFACE ) == SFX_ITEM_SET)
+ {
+ sal_Int32 nSurface = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_EXTRUSION_SURFACE))->GetValue();
+
+ ShadeMode eShadeMode( ShadeMode_FLAT );
+ sal_Bool bMetal = sal_False;
+ double fSpecularity = 0;
+ double fDiffusion = 0;
+
+ switch( nSurface )
+ {
+ case 0: // wireframe
+ eShadeMode = ShadeMode_DRAFT;
+ break;
+ case 1: // matte
+ break;
+ case 2: // plastic
+ fSpecularity = 122.0;
+ break;
+ case 3: // metal
+ bMetal = true;
+ fSpecularity = 122.0;
+ fDiffusion = 122.0;
+ break;
+ }
+
+ com::sun::star::beans::PropertyValue aPropValue;
+ aPropValue.Name = sShadeMode;
+ aPropValue.Value <<= eShadeMode;
+ rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
+
+ aPropValue.Name = sMetal;
+ aPropValue.Value <<= bMetal;
+ rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
+
+ aPropValue.Name = sSpecularity;
+ aPropValue.Value <<= fSpecularity;
+ rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
+
+ aPropValue.Name = sDiffusion;
+ aPropValue.Value <<= fDiffusion;
+ rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
+ }
+ }
+ break;
+ case SID_EXTRUSION_LIGHTING_INTENSITY:
+ {
+ static const rtl::OUString sBrightness( RTL_CONSTASCII_USTRINGPARAM ( "Brightness" ) );
+ static const rtl::OUString sLightFace( RTL_CONSTASCII_USTRINGPARAM ( "LightFace" ) );
+ static const rtl::OUString sFirstLightHarsh( RTL_CONSTASCII_USTRINGPARAM ( "FirstLightHarsh" ) );
+ static const rtl::OUString sSecondLightHarsh( RTL_CONSTASCII_USTRINGPARAM ( "SecondLightHarsh" ) );
+ static const rtl::OUString sFirstLightLevel( RTL_CONSTASCII_USTRINGPARAM ( "FirstLightLevel" ) );
+ static const rtl::OUString sSecondLightLevel( RTL_CONSTASCII_USTRINGPARAM ( "SecondLightLevel" ) );
+
+ if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_LIGHTING_INTENSITY ) == SFX_ITEM_SET)
+ {
+ sal_Int32 nLevel = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_EXTRUSION_LIGHTING_INTENSITY))->GetValue();
+
+ double fBrightness;
+ sal_Bool bHarsh2;
+ double fLevel1;
+ double fLevel2;
+
+ switch( nLevel )
+ {
+ case 0: // bright
+ fBrightness = 34.0;
+ bHarsh2 = sal_False;
+ fLevel1 = 66.0;
+ fLevel2 = 66.0;
+ break;
+ case 1: // normal
+ fBrightness = 15.0;
+ bHarsh2 = sal_False;
+ fLevel1 = 67.0;
+ fLevel2 = 37.0;
+ break;
+ case 2: // dim
+ fBrightness = 6.0;
+ bHarsh2 = sal_True;
+ fLevel1 = 79.0;
+ fLevel2 = 21.0;
+ break;
+ }
+
+ com::sun::star::beans::PropertyValue aPropValue;
+ aPropValue.Name = sBrightness;
+ aPropValue.Value <<= fBrightness;
+ rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
+
+ aPropValue.Name = sLightFace;
+ aPropValue.Value <<= sal_True;
+ rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
+
+ aPropValue.Name = sFirstLightHarsh;
+ aPropValue.Value <<= sal_True;
+ rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
+
+ aPropValue.Name = sSecondLightHarsh;
+ aPropValue.Value <<= bHarsh2;
+ rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
+
+ aPropValue.Name = sFirstLightLevel;
+ aPropValue.Value <<= fLevel1;
+ rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
+
+ aPropValue.Name = sSecondLightLevel;
+ aPropValue.Value <<= fLevel2;
+ rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
+ }
+ }
+ break;
+ case SID_EXTRUSION_LIGHTING_DIRECTION:
+ {
+ if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_LIGHTING_DIRECTION ) == SFX_ITEM_SET)
+ {
+ sal_Int32 nDirection = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_EXTRUSION_LIGHTING_DIRECTION))->GetValue();
+
+ if((nDirection >= 0) && (nDirection < 9))
+ {
+ const rtl::OUString sFirstLightDirection( RTL_CONSTASCII_USTRINGPARAM ( "FirstLightDirection" ) );
+ const rtl::OUString sSecondLightDirection( RTL_CONSTASCII_USTRINGPARAM ( "SecondLightDirection" ) );
+
+ const Direction3D * pLighting1Defaults;
+ const Direction3D * pLighting2Defaults;
+
+ getLightingDirectionDefaults( &pLighting1Defaults, &pLighting2Defaults );
+
+ com::sun::star::beans::PropertyValue aPropValue;
+ aPropValue.Name = sFirstLightDirection;
+ aPropValue.Value <<= pLighting1Defaults[nDirection];
+ rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
+
+ aPropValue.Name = sSecondLightDirection;
+ aPropValue.Value <<= pLighting2Defaults[nDirection];
+ rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
+ }
+ }
+ }
+ break;
+
+ }
+}
+
+void ExtrusionBar::execute( SdrView* pSdrView, SfxRequest& rReq, SfxBindings& rBindings )
+{
+ sal_uInt16 nSID = rReq.GetSlot();
+ sal_uInt16 nStrResId = 0;
+
+ const bool bUndo = pSdrView && pSdrView->IsUndoEnabled();
+
+ switch( nSID )
+ {
+ case SID_EXTRUSION_TOOGLE:
+ {
+ if ( !nStrResId )
+ nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ON_OFF;
+ } // PASSTROUGH
+ case SID_EXTRUSION_TILT_DOWN:
+ {
+ if ( !nStrResId )
+ nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_DOWN;
+ } // PASSTROUGH
+ case SID_EXTRUSION_TILT_UP:
+ {
+ if ( !nStrResId )
+ nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_UP;
+ } // PASSTROUGH
+ case SID_EXTRUSION_TILT_LEFT:
+ {
+ if ( !nStrResId )
+ nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_LEFT;
+ } // PASSTROUGH
+ case SID_EXTRUSION_TILT_RIGHT:
+ {
+ if ( !nStrResId )
+ nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_RIGHT;
+ } // PASSTROUGH
+ case SID_EXTRUSION_DIRECTION:
+ {
+ if ( !nStrResId )
+ nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ORIENTATION;
+ } // PASSTROUGH
+ case SID_EXTRUSION_PROJECTION:
+ {
+ if ( !nStrResId )
+ nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_PROJECTION;
+ } // PASSTROUGH
+ case SID_EXTRUSION_DEPTH:
+ {
+ if ( !nStrResId )
+ nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_DEPTH;
+ } // PASSTROUGH
+ case SID_EXTRUSION_3D_COLOR:
+ {
+ if ( !nStrResId )
+ nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_COLOR;
+ } // PASSTROUGH
+ case SID_EXTRUSION_SURFACE:
+ {
+ if ( !nStrResId )
+ nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_SURFACE;
+ } // PASSTROUGH
+ case SID_EXTRUSION_LIGHTING_INTENSITY:
+ {
+ if ( !nStrResId )
+ nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_BRIGHTNESS;
+ } // PASSTROUGH
+ case SID_EXTRUSION_LIGHTING_DIRECTION:
+ {
+ if ( !nStrResId )
+ nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_LIGHTING;
+
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
+
+ for(i=0; i<nCount; i++)
+ {
+ SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
+ if( pObj->ISA(SdrObjCustomShape) )
+ {
+ if( bUndo )
+ {
+ String aStr( SVX_RES( nStrResId ) );
+ pSdrView->BegUndo( aStr );
+ pSdrView->AddUndo( pSdrView->GetModel()->GetSdrUndoFactory().CreateUndoAttrObject( *pObj ) );
+ }
+ SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ impl_execute( pSdrView, rReq, aGeometryItem, pObj );
+ pObj->SetMergedItem( aGeometryItem );
+ pObj->BroadcastObjectChange();
+ if( bUndo )
+ pSdrView->EndUndo();
+
+ // simulate a context change:
+ // force SelectionHasChanged() being called
+ // so that extrusion bar will be visible/hidden
+ pSdrView->MarkListHasChanged();
+ }
+ }
+ }
+ break;
+
+ case SID_EXTRUSION_DEPTH_DIALOG:
+ if( rReq.GetArgs() &&
+ (rReq.GetArgs()->GetItemState( SID_EXTRUSION_DEPTH ) == SFX_ITEM_SET) &&
+ (rReq.GetArgs()->GetItemState( SID_ATTR_METRIC ) == SFX_ITEM_SET))
+ {
+ double fDepth = ((const SvxDoubleItem*)rReq.GetArgs()->GetItem(SID_EXTRUSION_DEPTH))->GetValue();
+ FieldUnit eUnit = (FieldUnit)((const SfxUInt16Item*)rReq.GetArgs()->GetItem(SID_ATTR_METRIC))->GetValue();
+
+ ExtrusionDepthDialog aDlg( 0L, fDepth, eUnit );
+ sal_uInt16 nRet = aDlg.Execute();
+ if( nRet != 0 )
+ {
+ fDepth = aDlg.getDepth();
+
+ SvxDoubleItem aItem( fDepth, SID_EXTRUSION_DEPTH );
+ SfxPoolItem* aItems[] = { &aItem, 0 };
+ rBindings.Execute( SID_EXTRUSION_DEPTH, (const SfxPoolItem**)aItems );
+ }
+ }
+ break;
+ }
+
+ if( nSID == SID_EXTRUSION_TOOGLE )
+ {
+ static sal_uInt16 SidArray[] = {
+ SID_EXTRUSION_TILT_DOWN,
+ SID_EXTRUSION_TILT_UP,
+ SID_EXTRUSION_TILT_LEFT,
+ SID_EXTRUSION_TILT_RIGHT,
+ SID_EXTRUSION_DEPTH_FLOATER,
+ SID_EXTRUSION_DIRECTION_FLOATER,
+ SID_EXTRUSION_LIGHTING_FLOATER,
+ SID_EXTRUSION_SURFACE_FLOATER,
+ SID_EXTRUSION_3D_COLOR,
+ SID_EXTRUSION_DEPTH,
+ SID_EXTRUSION_DIRECTION,
+ SID_EXTRUSION_PROJECTION,
+ SID_EXTRUSION_LIGHTING_DIRECTION,
+ SID_EXTRUSION_LIGHTING_INTENSITY,
+ SID_EXTRUSION_SURFACE,
+ 0 };
+
+ rBindings.Invalidate( SidArray );
+ }
+}
+
+void getExtrusionDirectionState( SdrView* pSdrView, SfxItemSet& rSet )
+{
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
+
+ static const rtl::OUString sExtrusion( RTL_CONSTASCII_USTRINGPARAM ( "Extrusion" ) );
+ static const rtl::OUString sViewPoint( RTL_CONSTASCII_USTRINGPARAM ( "ViewPoint" ) );
+ static const rtl::OUString sOrigin( RTL_CONSTASCII_USTRINGPARAM ( "Origin" ) );
+ static const rtl::OUString sSkew( RTL_CONSTASCII_USTRINGPARAM ( "Skew" ) );
+ static const rtl::OUString sProjectionMode( RTL_CONSTASCII_USTRINGPARAM ( "ProjectionMode" ) );
+
+ com::sun::star::uno::Any* pAny;
+
+ double fFinalSkewAngle = -1;
+ bool bHasCustomShape = false;
+
+ for(i=0;i<nCount; i++)
+ {
+ SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
+ if( pObj->ISA(SdrObjCustomShape) )
+ {
+ SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+
+ // see if this is an extruded customshape
+ if( !bHasCustomShape )
+ {
+ Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
+ if( pAny_ )
+ *pAny_ >>= bHasCustomShape;
+
+ if( !bHasCustomShape )
+ continue;
+ }
+
+ sal_Bool bParallel = sal_True;
+ Position3D aViewPoint( 3472, -3472, 25000 );
+ double fOriginX = 0.50;
+ double fOriginY = -0.50;
+ double fSkewAngle = -135;
+ double fSkew = 50.0;
+
+ pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sProjectionMode );
+ sal_Int16 nProjectionMode = sal_Int16();
+ if( pAny && ( *pAny >>= nProjectionMode ) )
+ bParallel = nProjectionMode == ProjectionMode_PARALLEL;
+
+ if( bParallel )
+ {
+ EnhancedCustomShapeParameterPair aSkewPropPair;
+ pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sSkew );
+ if( pAny && ( *pAny >>= aSkewPropPair ) )
+ {
+ aSkewPropPair.First.Value >>= fSkew;
+ aSkewPropPair.Second.Value >>= fSkewAngle;
+ }
+ if ( fSkew == 0.0 )
+ fSkewAngle = 0.0;
+ else if ( fSkewAngle == 0.0 )
+ fSkewAngle = -360.0;
+ }
+ else
+ {
+ pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sViewPoint );
+ if( pAny )
+ *pAny >>= aViewPoint;
+
+ EnhancedCustomShapeParameterPair aOriginPropPair;
+ pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sOrigin );
+ if( pAny && ( *pAny >>= aOriginPropPair ) )
+ {
+ aOriginPropPair.First.Value >>= fOriginX;
+ aOriginPropPair.Second.Value >>= fOriginY;
+ }
+ fSkewAngle = -1;
+ const double e = 0.0001;
+ if( aViewPoint.PositionX > e )
+ {
+ if( aViewPoint.PositionY > e )
+ {
+ if( (fOriginX > e ) && ( fOriginY > e ) )
+ fSkewAngle = 135.0;
+ }
+ else if( aViewPoint.PositionY < -e )
+ {
+ if( ( fOriginX > e ) && ( fOriginY < -e ) )
+ fSkewAngle = -135.0;
+ }
+ else
+ {
+ if( ( fOriginX > e ) && ( fOriginY > -e ) && ( fOriginY < e ) )
+ fSkewAngle = 180.0;
+ }
+ }
+ else if( aViewPoint.PositionX < -e )
+ {
+ if( aViewPoint.PositionY < -e )
+ {
+ if( ( fOriginX < -e ) && ( fOriginY < -e ) )
+ fSkewAngle = -45.0;
+ }
+ else if( aViewPoint.PositionY > e )
+ {
+ if( ( fOriginX < -e ) && ( fOriginY > e ) )
+ fSkewAngle = 45.0;
+ }
+ else
+ {
+ if( ( fOriginX < e ) && ( fOriginY > -e ) && ( fOriginY < e ) )
+ fSkewAngle = -360.0;
+ }
+ }
+ else
+ {
+ if( aViewPoint.PositionY < -e )
+ {
+ if( ( fOriginX > -e ) && ( fOriginX < e ) && ( fOriginY < -e ) )
+ fSkewAngle = -90.0;
+ }
+ else if( aViewPoint.PositionY > e )
+ {
+ if( ( fOriginX > -e ) && ( fOriginX < e ) && ( fOriginY > e ) )
+ fSkewAngle = 90.0;
+ }
+ else
+ {
+ if( ( fOriginX > -e ) && ( fOriginX < e ) && ( fOriginY > -e ) && ( fOriginY < e ) )
+ fSkewAngle = 0.0;
+ }
+ }
+ }
+
+ if( fFinalSkewAngle == -1.0 )
+ {
+ fFinalSkewAngle = fSkewAngle;
+ }
+ else if( fSkewAngle != fFinalSkewAngle )
+ {
+ fFinalSkewAngle = -1.0;
+ }
+
+ if( fFinalSkewAngle == -1.0 )
+ break;
+ }
+ }
+
+ if( bHasCustomShape )
+ rSet.Put( SfxInt32Item( SID_EXTRUSION_DIRECTION, (sal_Int32)fFinalSkewAngle ) );
+ else
+ rSet.DisableItem( SID_EXTRUSION_DIRECTION );
+}
+
+void getExtrusionProjectionState( SdrView* pSdrView, SfxItemSet& rSet )
+{
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
+
+ static const rtl::OUString sExtrusion( RTL_CONSTASCII_USTRINGPARAM ( "Extrusion" ) );
+ static const rtl::OUString sProjectionMode( RTL_CONSTASCII_USTRINGPARAM ( "ProjectionMode" ) );
+
+ com::sun::star::uno::Any* pAny;
+
+ sal_Int32 nFinalProjection = -1;
+ bool bHasCustomShape = false;
+
+ for(i=0;i<nCount; i++)
+ {
+ SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
+ if( pObj->ISA(SdrObjCustomShape) )
+ {
+ // see if this is an extruded customshape
+ if( !bHasCustomShape )
+ {
+ SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
+ if( pAny_ )
+ *pAny_ >>= bHasCustomShape;
+
+ if( !bHasCustomShape )
+ continue;
+ }
+
+ SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+
+ sal_Bool bParallel = sal_True;
+ pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sProjectionMode );
+ ProjectionMode eProjectionMode;
+ if( pAny && ( *pAny >>= eProjectionMode ) )
+ bParallel = eProjectionMode == ProjectionMode_PARALLEL;
+
+ if( nFinalProjection == -1 )
+ {
+ nFinalProjection = bParallel;
+ }
+ else if( nFinalProjection != bParallel )
+ {
+ nFinalProjection = -1;
+ break;
+ }
+ }
+ }
+
+ if( bHasCustomShape )
+ rSet.Put( SfxInt32Item( SID_EXTRUSION_PROJECTION, nFinalProjection ) );
+ else
+ rSet.DisableItem( SID_EXTRUSION_PROJECTION );
+}
+
+void getExtrusionSurfaceState( SdrView* pSdrView, SfxItemSet& rSet )
+{
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
+
+ static const rtl::OUString sExtrusion( RTL_CONSTASCII_USTRINGPARAM ( "Extrusion" ) );
+ static const rtl::OUString sShadeMode( RTL_CONSTASCII_USTRINGPARAM ( "ShadeMode" ) );
+ static const rtl::OUString sSpecularity( RTL_CONSTASCII_USTRINGPARAM ( "Specularity" ) );
+ static const rtl::OUString sDiffusion( RTL_CONSTASCII_USTRINGPARAM ( "Diffusion" ) );
+ static const rtl::OUString sMetal( RTL_CONSTASCII_USTRINGPARAM ( "Metal" ) );
+
+ com::sun::star::uno::Any* pAny;
+
+ sal_Int32 nFinalSurface = -1;
+ bool bHasCustomShape = false;
+
+ for(i=0;i<nCount; i++)
+ {
+ SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
+ if( pObj->ISA(SdrObjCustomShape) )
+ {
+ SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+
+ // see if this is an extruded customshape
+ if( !bHasCustomShape )
+ {
+ Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
+ if( pAny_ )
+ *pAny_ >>= bHasCustomShape;
+
+ if( !bHasCustomShape )
+ continue;
+ }
+
+ sal_Int32 nSurface = 0; // wire frame
+
+ ShadeMode eShadeMode( ShadeMode_FLAT );
+ pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sShadeMode );
+ if( pAny )
+ *pAny >>= eShadeMode;
+
+ if( eShadeMode == ShadeMode_FLAT )
+ {
+ sal_Bool bMetal = sal_False;
+ pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sMetal );
+ if( pAny )
+ *pAny >>= bMetal;
+
+ if( bMetal )
+ {
+ nSurface = 3; // metal
+ }
+ else
+ {
+ double fSpecularity = 0;
+ pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sSpecularity );
+ if( pAny )
+ *pAny >>= fSpecularity;
+
+ const double e = 0.0001;
+ if( (fSpecularity > -e) && (fSpecularity < e) )
+ {
+ nSurface = 1; // matte
+ }
+ else
+ {
+ nSurface = 2; // plastic
+ }
+ }
+ }
+
+ if( nFinalSurface == -1 )
+ {
+ nFinalSurface = nSurface;
+ }
+ else if( nFinalSurface != nSurface )
+ {
+ nFinalSurface = -1;
+ break;
+ }
+ }
+ }
+
+ if( bHasCustomShape )
+ rSet.Put( SfxInt32Item( SID_EXTRUSION_SURFACE, nFinalSurface ) );
+ else
+ rSet.DisableItem( SID_EXTRUSION_SURFACE );
+}
+
+void getExtrusionDepthState( SdrView* pSdrView, SfxItemSet& rSet )
+{
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
+
+ static const rtl::OUString sExtrusion( RTL_CONSTASCII_USTRINGPARAM ( "Extrusion" ) );
+ static const rtl::OUString sDepth( RTL_CONSTASCII_USTRINGPARAM ( "Depth" ) );
+
+ com::sun::star::uno::Any* pAny;
+
+ double fFinalDepth = -1;
+ bool bHasCustomShape = false;
+
+ for(i=0;i<nCount; i++)
+ {
+ SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
+ if( pObj->ISA(SdrObjCustomShape) )
+ {
+ SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+
+ // see if this is an extruded customshape
+ if( !bHasCustomShape )
+ {
+ Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
+ if( pAny_ )
+ *pAny_ >>= bHasCustomShape;
+
+ if( !bHasCustomShape )
+ continue;
+ }
+
+ double fDepth = 1270.0;
+ pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sDepth );
+ if( pAny )
+ {
+ EnhancedCustomShapeParameterPair aDepthPropPair;
+ if ( *pAny >>= aDepthPropPair )
+ aDepthPropPair.First.Value >>= fDepth;
+ }
+
+ if( fFinalDepth == -1 )
+ {
+ fFinalDepth = fDepth;
+ }
+ else if( fFinalDepth != fDepth )
+ {
+ fFinalDepth = -1;
+ break;
+ }
+ }
+ }
+
+ if( pSdrView->GetModel() )
+ {
+ FieldUnit eUnit = pSdrView->GetModel()->GetUIUnit();
+ rSet.Put( SfxUInt16Item( SID_ATTR_METRIC, (sal_uInt16)eUnit ) );
+ }
+
+ if( bHasCustomShape )
+ rSet.Put( SvxDoubleItem( fFinalDepth, SID_EXTRUSION_DEPTH ) );
+ else
+ rSet.DisableItem( SID_EXTRUSION_DEPTH );
+}
+
+static bool compare_direction( const Direction3D& d1, const Direction3D& d2 )
+{
+ if( ((d1.DirectionX < 0) && (d2.DirectionX < 0)) || ((d1.DirectionX == 0) && (d2.DirectionX == 0)) || ((d1.DirectionX > 0) && (d2.DirectionX > 0)) )
+ {
+ if( ((d1.DirectionY < 0) && (d2.DirectionY < 0)) || ((d1.DirectionY == 0) && (d2.DirectionY == 0)) || ((d1.DirectionY > 0) && (d2.DirectionY > 0)) )
+ {
+ if( ((d1.DirectionZ < 0) && (d2.DirectionZ < 0)) || ((d1.DirectionZ == 0) && (d2.DirectionZ == 0)) || ((d1.DirectionZ > 0) && (d2.DirectionZ > 0)) )
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+void getExtrusionLightingDirectionState( SdrView* pSdrView, SfxItemSet& rSet )
+{
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
+
+ static const rtl::OUString sExtrusion( RTL_CONSTASCII_USTRINGPARAM ( "Extrusion" ) );
+ static const rtl::OUString sFirstLightDirection( RTL_CONSTASCII_USTRINGPARAM ( "FirstLightDirection" ) );
+ static const rtl::OUString sSecondLightDirection( RTL_CONSTASCII_USTRINGPARAM ( "SecondLightDirection" ) );
+
+ const Direction3D * pLighting1Defaults;
+ const Direction3D * pLighting2Defaults;
+
+ getLightingDirectionDefaults( &pLighting1Defaults, &pLighting2Defaults );
+
+ com::sun::star::uno::Any* pAny;
+
+ int nFinalDirection = -1;
+ bool bHasCustomShape = false;
+
+ for(i=0;i<nCount; i++)
+ {
+ SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
+ if( pObj->ISA(SdrObjCustomShape) )
+ {
+ SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+
+ // see if this is an extruded customshape
+ if( !bHasCustomShape )
+ {
+ Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
+ if( pAny_ )
+ *pAny_ >>= bHasCustomShape;
+
+ if( !bHasCustomShape )
+ continue;
+ }
+
+ Direction3D aFirstLightDirection( 50000, 0, 10000 );
+ Direction3D aSecondLightDirection( -50000, 0, 10000 );
+
+ pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sFirstLightDirection );
+ if( pAny )
+ *pAny >>= aFirstLightDirection;
+
+ pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sSecondLightDirection );
+ if( pAny )
+ *pAny >>= aSecondLightDirection;
+
+ int nDirection = -1;
+
+ int j;
+ for( j = 0; j < 9; j++ )
+ {
+ if( compare_direction( aFirstLightDirection, pLighting1Defaults[j] ) &&
+ compare_direction( aSecondLightDirection, pLighting2Defaults[j] ))
+ {
+ nDirection = j;
+ break;
+ }
+ }
+
+ if( nFinalDirection == -1 )
+ {
+ nFinalDirection = nDirection;
+ }
+ else if( nDirection != nFinalDirection )
+ {
+ nFinalDirection = -1;
+ }
+
+ if( nFinalDirection == -1 )
+ break;
+ }
+ }
+
+ if( bHasCustomShape )
+ rSet.Put( SfxInt32Item( SID_EXTRUSION_LIGHTING_DIRECTION, (sal_Int32)nFinalDirection ) );
+ else
+ rSet.DisableItem( SID_EXTRUSION_LIGHTING_DIRECTION );
+}
+
+void getExtrusionLightingIntensityState( SdrView* pSdrView, SfxItemSet& rSet )
+{
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
+
+ static const rtl::OUString sExtrusion( RTL_CONSTASCII_USTRINGPARAM ( "Extrusion" ) );
+ static const rtl::OUString sBrightness( RTL_CONSTASCII_USTRINGPARAM ( "Brightness" ) );
+
+ com::sun::star::uno::Any* pAny;
+
+ int nFinalLevel = -1;
+ bool bHasCustomShape = false;
+
+ for(i=0;i<nCount; i++)
+ {
+ SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
+ if( pObj->ISA(SdrObjCustomShape) )
+ {
+ SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+
+ // see if this is an extruded customshape
+ if( !bHasCustomShape )
+ {
+ Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
+ if( pAny_ )
+ *pAny_ >>= bHasCustomShape;
+
+ if( !bHasCustomShape )
+ continue;
+ }
+
+ double fBrightness = 22178.0 / 655.36;
+ pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sBrightness );
+ if( pAny )
+ *pAny >>= fBrightness;
+
+ int nLevel;
+ if( fBrightness >= 30.0 )
+ {
+ nLevel = 0; // Bright
+ }
+ else if( fBrightness >= 10.0 )
+ {
+ nLevel = 1; // Noraml;
+ }
+ else
+ {
+ nLevel = 2; // Dim
+ }
+
+ if( nFinalLevel == -1 )
+ {
+ nFinalLevel = nLevel;
+ }
+ else if( nFinalLevel != nLevel )
+ {
+ nFinalLevel = -1;
+ break;
+ }
+ }
+ }
+
+ if( bHasCustomShape )
+ rSet.Put( SfxInt32Item( SID_EXTRUSION_LIGHTING_INTENSITY, nFinalLevel ) );
+ else
+ rSet.DisableItem( SID_EXTRUSION_LIGHTING_INTENSITY );
+}
+
+void getExtrusionColorState( SdrView* pSdrView, SfxItemSet& rSet )
+{
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
+
+ static const rtl::OUString sExtrusion( RTL_CONSTASCII_USTRINGPARAM ( "Extrusion" ) );
+ static const rtl::OUString sExtrusionColor( RTL_CONSTASCII_USTRINGPARAM ( "Color" ) );
+
+ com::sun::star::uno::Any* pAny;
+
+ bool bInit = false;
+ bool bAmbigius = false;
+ Color aFinalColor;
+ bool bHasCustomShape = false;
+
+ for(i=0;i<nCount; i++)
+ {
+ SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
+ if( pObj->ISA(SdrObjCustomShape) )
+ {
+ SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+
+ // see if this is an extruded customshape
+ if( !bHasCustomShape )
+ {
+ Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
+ if( pAny_ )
+ *pAny_ >>= bHasCustomShape;
+
+ if( !bHasCustomShape )
+ continue;
+ }
+
+ Color aColor;
+
+ bool bUseColor = false;
+ pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusionColor );
+ if( pAny )
+ *pAny >>= bUseColor;
+
+ if( bUseColor )
+ {
+ const XSecondaryFillColorItem& rItem = *(XSecondaryFillColorItem*)&(pObj->GetMergedItem( XATTR_SECONDARYFILLCOLOR ));
+ aColor = rItem.GetColorValue();
+ }
+ else
+ {
+ aColor = COL_AUTO;
+ }
+
+ if( !bInit )
+ {
+ aFinalColor = aColor;
+ bInit = true;
+ }
+ else if( aFinalColor != aColor )
+ {
+ bAmbigius = true;
+ break;
+ }
+ }
+ }
+
+ if( bAmbigius )
+ aFinalColor = COL_AUTO;
+
+ if( bHasCustomShape )
+ rSet.Put( SvxColorItem( aFinalColor, SID_EXTRUSION_3D_COLOR ) );
+ else
+ rSet.DisableItem( SID_EXTRUSION_3D_COLOR );
+}
+
+namespace svx {
+bool checkForSelectedCustomShapes( SdrView* pSdrView, bool bOnlyExtruded )
+{
+ static const rtl::OUString sExtrusion( RTL_CONSTASCII_USTRINGPARAM ( "Extrusion" ) );
+
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
+ bool bFound = false;
+
+ for(i=0;(i<nCount) && !bFound ; i++)
+ {
+ SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
+ if( pObj->ISA(SdrObjCustomShape) )
+ {
+ if( bOnlyExtruded )
+ {
+ SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ Any* pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
+ if( pAny )
+ *pAny >>= bFound;
+ }
+ else
+ {
+ bFound = true;
+ }
+ }
+ }
+
+ return bFound;
+}
+}
+
+void ExtrusionBar::getState( SdrView* pSdrView, SfxItemSet& rSet )
+{
+ if (rSet.GetItemState(SID_EXTRUSION_DIRECTION) != SFX_ITEM_UNKNOWN)
+ {
+ getExtrusionDirectionState( pSdrView, rSet );
+ }
+ if (rSet.GetItemState(SID_EXTRUSION_PROJECTION) != SFX_ITEM_UNKNOWN)
+ {
+ getExtrusionProjectionState( pSdrView, rSet );
+ }
+ const bool bOnlyExtrudedCustomShapes =
+ checkForSelectedCustomShapes( pSdrView, true );
+ if (rSet.GetItemState(SID_EXTRUSION_TILT_DOWN) != SFX_ITEM_UNKNOWN)
+ {
+ if (! bOnlyExtrudedCustomShapes)
+ rSet.DisableItem( SID_EXTRUSION_TILT_DOWN );
+ }
+ if (rSet.GetItemState(SID_EXTRUSION_TILT_DOWN) != SFX_ITEM_UNKNOWN)
+ {
+ if (! bOnlyExtrudedCustomShapes)
+ rSet.DisableItem( SID_EXTRUSION_TILT_DOWN );
+ }
+ if (rSet.GetItemState(SID_EXTRUSION_TILT_UP) != SFX_ITEM_UNKNOWN)
+ {
+ if (! bOnlyExtrudedCustomShapes)
+ rSet.DisableItem( SID_EXTRUSION_TILT_UP );
+ }
+ if (rSet.GetItemState(SID_EXTRUSION_TILT_LEFT) != SFX_ITEM_UNKNOWN)
+ {
+ if (! bOnlyExtrudedCustomShapes)
+ rSet.DisableItem( SID_EXTRUSION_TILT_LEFT );
+ }
+ if (rSet.GetItemState(SID_EXTRUSION_TILT_RIGHT) != SFX_ITEM_UNKNOWN)
+ {
+ if (! bOnlyExtrudedCustomShapes)
+ rSet.DisableItem( SID_EXTRUSION_TILT_RIGHT );
+ }
+ if (rSet.GetItemState(SID_EXTRUSION_3D_COLOR) != SFX_ITEM_UNKNOWN)
+ {
+ if (! bOnlyExtrudedCustomShapes)
+ rSet.DisableItem( SID_EXTRUSION_3D_COLOR );
+ }
+ if (rSet.GetItemState(SID_EXTRUSION_DEPTH_FLOATER) != SFX_ITEM_UNKNOWN)
+ {
+ if (! bOnlyExtrudedCustomShapes)
+ rSet.DisableItem( SID_EXTRUSION_DEPTH_FLOATER );
+ }
+ if (rSet.GetItemState(SID_EXTRUSION_DIRECTION_FLOATER) != SFX_ITEM_UNKNOWN)
+ {
+ if (! bOnlyExtrudedCustomShapes)
+ rSet.DisableItem( SID_EXTRUSION_DIRECTION_FLOATER );
+ }
+ if (rSet.GetItemState(SID_EXTRUSION_LIGHTING_FLOATER) != SFX_ITEM_UNKNOWN)
+ {
+ if (! bOnlyExtrudedCustomShapes)
+ rSet.DisableItem( SID_EXTRUSION_LIGHTING_FLOATER );
+ }
+ if (rSet.GetItemState(SID_EXTRUSION_SURFACE_FLOATER) != SFX_ITEM_UNKNOWN)
+ {
+ if(! bOnlyExtrudedCustomShapes)
+ rSet.DisableItem( SID_EXTRUSION_SURFACE_FLOATER );
+ }
+ if (rSet.GetItemState(SID_EXTRUSION_TOOGLE) != SFX_ITEM_UNKNOWN)
+ {
+ if( !checkForSelectedCustomShapes( pSdrView, false ) )
+ rSet.DisableItem( SID_EXTRUSION_TOOGLE );
+ }
+ if (rSet.GetItemState(SID_EXTRUSION_DEPTH) != SFX_ITEM_UNKNOWN)
+ {
+ getExtrusionDepthState( pSdrView, rSet );
+ }
+ if (rSet.GetItemState(SID_EXTRUSION_SURFACE) != SFX_ITEM_UNKNOWN)
+ {
+ getExtrusionSurfaceState( pSdrView, rSet );
+ }
+ if (rSet.GetItemState(SID_EXTRUSION_LIGHTING_INTENSITY) != SFX_ITEM_UNKNOWN)
+ {
+ getExtrusionLightingIntensityState( pSdrView, rSet );
+ }
+
+ if (rSet.GetItemState(SID_EXTRUSION_LIGHTING_DIRECTION) != SFX_ITEM_UNKNOWN)
+ {
+ getExtrusionLightingDirectionState( pSdrView, rSet );
+ }
+
+ if (rSet.GetItemState(SID_EXTRUSION_3D_COLOR) != SFX_ITEM_UNKNOWN)
+ {
+ getExtrusionColorState( pSdrView, rSet );
+ }
+}
diff --git a/svx/source/toolbars/extrusionbar.src b/svx/source/toolbars/extrusionbar.src
new file mode 100644
index 000000000000..dd6f3066a51e
--- /dev/null
+++ b/svx/source/toolbars/extrusionbar.src
@@ -0,0 +1,56 @@
+#include <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+
+String RID_SVX_EXTRUSION_BAR
+{
+ Text [ en-US ] = "Extrusion";
+};
+
+String RID_SVXSTR_UNDO_APPLY_EXTRUSION_ON_OFF
+{
+ Text [ en-US ] = "Apply Extrusion On/Off";
+};
+String RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_DOWN
+{
+ Text [ en-US ] = "Tilt Down";
+};
+String RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_UP
+{
+ Text [ en-US ] = "Tilt Up";
+};
+String RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_LEFT
+{
+ Text [ en-US ] = "Tilt Left";
+};
+String RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_RIGHT
+{
+ Text [ en-US ] = "Tilt Right";
+};
+String RID_SVXSTR_UNDO_APPLY_EXTRUSION_DEPTH
+{
+ Text [ en-US ] = "Change Extrusion Depth";
+};
+String RID_SVXSTR_UNDO_APPLY_EXTRUSION_ORIENTATION
+{
+ Text [ en-US ] = "Change Orientation";
+};
+String RID_SVXSTR_UNDO_APPLY_EXTRUSION_PROJECTION
+{
+ Text [ en-US ] = "Change Projection Type";
+};
+String RID_SVXSTR_UNDO_APPLY_EXTRUSION_LIGHTING
+{
+ Text [ en-US ] = "Change Lighting";
+};
+String RID_SVXSTR_UNDO_APPLY_EXTRUSION_BRIGHTNESS
+{
+ Text [ en-US ] = "Change Brightness";
+};
+String RID_SVXSTR_UNDO_APPLY_EXTRUSION_SURFACE
+{
+ Text [ en-US ] = "Change Extrusion Surface";
+};
+String RID_SVXSTR_UNDO_APPLY_EXTRUSION_COLOR
+{
+ Text [ en-US ] = "Change Extrusion Color";
+};
diff --git a/svx/source/toolbars/fontworkbar.cxx b/svx/source/toolbars/fontworkbar.cxx
new file mode 100644
index 000000000000..64367edbc85e
--- /dev/null
+++ b/svx/source/toolbars/fontworkbar.cxx
@@ -0,0 +1,641 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/svdundo.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/objface.hxx>
+#include <sfx2/viewsh.hxx>
+#include "svx/unoapi.hxx"
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
+#include <svx/dialmgr.hxx>
+#include <svx/svdoashp.hxx>
+#ifndef _SVX_DIALOGS_HRC
+#include <svx/dialogs.hrc>
+#endif
+#include <svx/svdview.hxx>
+#include <svx/sdasitm.hxx>
+#include <svx/svdoashp.hxx>
+#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
+#include <sfx2/bindings.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/charscaleitem.hxx>
+#include <editeng/kernitem.hxx>
+#include <svx/sdrpaintwindow.hxx>
+
+#include <svx/svxids.hrc>
+#include <svx/fontworkbar.hxx>
+#include "svx/fontworkgallery.hxx"
+
+using ::rtl::OUString;
+
+using namespace ::svx;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::uno;
+
+void SetAlignmentState( SdrView* pSdrView, SfxItemSet& rSet )
+{
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
+
+ sal_Int32 nAlignment = -1;
+ for( i = 0; i < nCount; i++ )
+ {
+ SdrObject* pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
+ if( pObj->ISA(SdrObjCustomShape) )
+ {
+ sal_Int32 nOldAlignment = nAlignment;
+ SdrTextHorzAdjustItem& rTextHorzAdjustItem = (SdrTextHorzAdjustItem&)pObj->GetMergedItem( SDRATTR_TEXT_HORZADJUST );
+ SdrTextFitToSizeTypeItem& rTextFitToSizeTypeItem = (SdrTextFitToSizeTypeItem&)pObj->GetMergedItem( SDRATTR_TEXT_FITTOSIZE );
+ switch ( rTextHorzAdjustItem.GetValue() )
+ {
+ case SDRTEXTHORZADJUST_LEFT : nAlignment = 0; break;
+ case SDRTEXTHORZADJUST_CENTER : nAlignment = 1; break;
+ case SDRTEXTHORZADJUST_RIGHT : nAlignment = 2; break;
+ case SDRTEXTHORZADJUST_BLOCK :
+ {
+ if ( rTextFitToSizeTypeItem.GetValue() == SDRTEXTFIT_NONE )
+ nAlignment = 3;
+ else if ( rTextFitToSizeTypeItem.GetValue() == SDRTEXTFIT_ALLLINES )
+ nAlignment = 4;
+ }
+ }
+ if ( ( nOldAlignment != -1 ) && ( nOldAlignment != nAlignment ) )
+ {
+ nAlignment = -1;
+ break;
+ }
+ }
+ }
+ rSet.Put( SfxInt32Item( SID_FONTWORK_ALIGNMENT, nAlignment ) );
+}
+
+void SetCharacterSpacingState( SdrView* pSdrView, SfxItemSet& rSet )
+{
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
+
+ sal_Int32 nCharacterSpacing = -1;
+ for( i = 0; i < nCount; i++ )
+ {
+ SdrObject* pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
+ if( pObj->ISA(SdrObjCustomShape) )
+ {
+ sal_Int32 nOldCharacterSpacing = nCharacterSpacing;
+ SvxCharScaleWidthItem& rCharScaleWidthItem = (SvxCharScaleWidthItem&)pObj->GetMergedItem( EE_CHAR_FONTWIDTH );
+ nCharacterSpacing = rCharScaleWidthItem.GetValue();
+ if ( ( nOldCharacterSpacing != -1 ) && ( nOldCharacterSpacing != nCharacterSpacing ) )
+ {
+ nCharacterSpacing = -1;
+ break;
+ }
+ }
+ }
+ rSet.Put( SfxInt32Item( SID_FONTWORK_CHARACTER_SPACING, nCharacterSpacing ) );
+}
+
+
+void SetKernCharacterPairsState( SdrView* pSdrView, SfxItemSet& rSet )
+{
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
+
+ sal_Bool bChecked = sal_False;
+ for( i = 0; i < nCount; i++ )
+ {
+ SdrObject* pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
+ if( pObj->ISA(SdrObjCustomShape) )
+ {
+ SvxKerningItem& rKerningItem = (SvxKerningItem&)pObj->GetMergedItem( EE_CHAR_KERNING );
+ if ( rKerningItem.GetValue() )
+ bChecked = sal_True;
+ }
+ }
+ rSet.Put( SfxBoolItem( SID_FONTWORK_KERN_CHARACTER_PAIRS, bChecked ) );
+}
+
+void SetFontWorkShapeTypeState( SdrView* pSdrView, SfxItemSet& rSet )
+{
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
+
+ rtl::OUString aFontWorkShapeType;
+
+ for( i = 0; i < nCount; i++ )
+ {
+ SdrObject* pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
+ if( pObj->ISA( SdrObjCustomShape ) )
+ {
+ const rtl::OUString sType( RTL_CONSTASCII_USTRINGPARAM ( "Type" ) );
+ SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ Any* pAny = aGeometryItem.GetPropertyValueByName( sType );
+ if( pAny )
+ {
+ rtl::OUString aType;
+ if ( *pAny >>= aType )
+ {
+ if ( aFontWorkShapeType.getLength() )
+ {
+ if ( !aFontWorkShapeType.equals( aType ) ) // different FontWorkShapeTypes selected ?
+ {
+ aFontWorkShapeType = rtl::OUString();
+ break;
+ }
+ }
+ aFontWorkShapeType = aType;
+ }
+ }
+ }
+ }
+ rSet.Put( SfxStringItem( SID_FONTWORK_SHAPE_TYPE, aFontWorkShapeType ) );
+}
+
+/*************************************************************************
+|*
+|* Standardinterface deklarieren (Die Slotmap darf nicht leer sein, also
+|* tragen wir etwas ein, was hier (hoffentlich) nie vorkommt).
+|*
+\************************************************************************/
+
+#define ShellClass FontworkBar
+
+SFX_SLOTMAP(FontworkBar)
+{
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+};
+
+SFX_IMPL_INTERFACE(FontworkBar, SfxShell, SVX_RES(RID_SVX_FONTWORK_BAR))
+{
+ SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT, SVX_RES(RID_SVX_FONTWORK_BAR) );
+}
+
+TYPEINIT1( FontworkBar, SfxShell );
+
+
+/*************************************************************************
+|*
+|* Standard-Konstruktor
+|*
+\************************************************************************/
+
+FontworkBar::FontworkBar(SfxViewShell* pViewShell )
+: SfxShell(pViewShell)
+{
+ DBG_ASSERT( pViewShell, "svx::FontworkBar::FontworkBar(), I need a viewshell!" );
+ if( pViewShell )
+ SetPool(&pViewShell->GetPool());
+
+ SetHelpId( SVX_INTERFACE_FONTWORK_BAR );
+ SetName( String( SVX_RES( RID_SVX_FONTWORK_BAR) ));
+}
+
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+FontworkBar::~FontworkBar()
+{
+ SetRepeatTarget(NULL);
+}
+
+static Window* ImpGetViewWin(SdrView* pView)
+{
+ if( pView )
+ {
+ const sal_uInt32 nAnz(pView->PaintWindowCount());
+ for(sal_uInt32 nNum(0L); nNum < nAnz; nNum++)
+ {
+ OutputDevice* pOut = &(pView->GetPaintWindow(nNum)->GetOutputDevice());
+
+ if(OUTDEV_WINDOW == pOut->GetOutDevType())
+ {
+ return (Window*)pOut;
+ }
+ }
+ }
+
+ return 0L;
+}
+
+namespace svx {
+bool checkForSelectedFontWork( SdrView* pSdrView, sal_uInt32& nCheckStatus )
+{
+ if ( nCheckStatus & 2 )
+ return ( nCheckStatus & 1 ) != 0;
+
+ static const rtl::OUString sTextPath( RTL_CONSTASCII_USTRINGPARAM ( "TextPath" ) );
+
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
+ sal_Bool bFound = sal_False;
+ for(i=0;(i<nCount) && !bFound ; i++)
+ {
+ SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
+ if( pObj->ISA(SdrObjCustomShape) )
+ {
+ SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ Any* pAny = aGeometryItem.GetPropertyValueByName( sTextPath, sTextPath );
+ if( pAny )
+ *pAny >>= bFound;
+ }
+ }
+ if ( bFound )
+ nCheckStatus |= 1;
+ nCheckStatus |= 2;
+ return bFound;
+}
+}
+
+static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem& rGeometryItem, SdrObject* pObj )
+{
+ static const rtl::OUString sTextPath( RTL_CONSTASCII_USTRINGPARAM ( "TextPath" ) );
+ static const rtl::OUString sSameLetterHeights( RTL_CONSTASCII_USTRINGPARAM ( "SameLetterHeights" ) );
+
+ sal_uInt16 nSID = rReq.GetSlot();
+ switch( nSID )
+ {
+ case SID_FONTWORK_SAME_LETTER_HEIGHTS:
+ {
+ com::sun::star::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( sTextPath, sSameLetterHeights );
+ if( pAny )
+ {
+ sal_Bool bOn;
+ (*pAny) >>= bOn;
+ bOn = !bOn;
+ (*pAny) <<= bOn;
+ }
+ }
+ break;
+
+ case SID_FONTWORK_ALIGNMENT:
+ {
+ if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_FONTWORK_ALIGNMENT ) == SFX_ITEM_SET )
+ {
+ sal_Int32 nValue = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_FONTWORK_ALIGNMENT))->GetValue();
+ if ( ( nValue >= 0 ) && ( nValue < 5 ) )
+ {
+ SdrFitToSizeType eFTS = SDRTEXTFIT_NONE;
+ SdrTextHorzAdjust eHorzAdjust;
+ switch ( nValue )
+ {
+ case 4 : eFTS = SDRTEXTFIT_ALLLINES; // passthrough
+ case 3 : eHorzAdjust = SDRTEXTHORZADJUST_BLOCK; break;
+ default:
+ case 0 : eHorzAdjust = SDRTEXTHORZADJUST_LEFT; break;
+ case 1 : eHorzAdjust = SDRTEXTHORZADJUST_CENTER; break;
+ case 2 : eHorzAdjust = SDRTEXTHORZADJUST_RIGHT; break;
+ }
+ pObj->SetMergedItem( SdrTextHorzAdjustItem( eHorzAdjust ) );
+ pObj->SetMergedItem( SdrTextFitToSizeTypeItem( eFTS ) );
+ pObj->BroadcastObjectChange();
+ }
+ }
+ }
+ break;
+
+ case SID_FONTWORK_CHARACTER_SPACING:
+ {
+ if( rReq.GetArgs() && ( rReq.GetArgs()->GetItemState( SID_FONTWORK_CHARACTER_SPACING ) == SFX_ITEM_SET ) )
+ {
+ sal_Int32 nCharSpacing = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_FONTWORK_CHARACTER_SPACING))->GetValue();
+ pObj->SetMergedItem( SvxCharScaleWidthItem( (sal_uInt16)nCharSpacing, EE_CHAR_FONTWIDTH ) );
+ pObj->BroadcastObjectChange();
+ }
+ }
+ break;
+
+ case SID_FONTWORK_KERN_CHARACTER_PAIRS:
+ {
+ if( rReq.GetArgs() && ( rReq.GetArgs()->GetItemState( SID_FONTWORK_KERN_CHARACTER_PAIRS ) == SFX_ITEM_SET ) )
+ {
+ // sal_Bool bKernCharacterPairs = ((const SfxBoolItem*)rReq.GetArgs()->GetItem(SID_FONTWORK_KERN_CHARACTER_PAIRS))->GetValue();
+//TODO: pObj->SetMergedItem( SvxCharScaleWidthItem( (sal_uInt16)nCharSpacing, EE_CHAR_FONTWIDTH ) );
+ pObj->BroadcastObjectChange();
+ }
+ }
+ break;
+ }
+}
+
+#include "svx/gallery.hxx"
+#include <svx/fmmodel.hxx>
+#include <svx/fmpage.hxx>
+#include <svl/itempool.hxx>
+
+void GetGeometryForCustomShape( SdrCustomShapeGeometryItem& rGeometryItem, const rtl::OUString rCustomShape )
+{
+ const rtl::OUString sType( RTL_CONSTASCII_USTRINGPARAM ( "Type" ) );
+
+ com::sun::star::beans::PropertyValue aPropVal;
+ aPropVal.Name = sType;
+ aPropVal.Value <<= rCustomShape;
+ rGeometryItem.SetPropertyValue( aPropVal );
+
+ const rtl::OUString sAdjustmentValues( RTL_CONSTASCII_USTRINGPARAM ( "AdjustmentValues" ) );
+ const rtl::OUString sCoordinateOrigin( RTL_CONSTASCII_USTRINGPARAM ( "CoordinateOrigin" ) );
+ const rtl::OUString sCoordinateSize( RTL_CONSTASCII_USTRINGPARAM ( "CoordinateSize" ) );
+ const rtl::OUString sEquations( RTL_CONSTASCII_USTRINGPARAM ( "Equations" ) );
+ const rtl::OUString sHandles( RTL_CONSTASCII_USTRINGPARAM ( "Handles" ) );
+ const rtl::OUString sPath( RTL_CONSTASCII_USTRINGPARAM ( "Path" ) );
+ rGeometryItem.ClearPropertyValue( sAdjustmentValues );
+ rGeometryItem.ClearPropertyValue( sCoordinateOrigin );
+ rGeometryItem.ClearPropertyValue( sCoordinateSize );
+ rGeometryItem.ClearPropertyValue( sEquations );
+ rGeometryItem.ClearPropertyValue( sHandles );
+ rGeometryItem.ClearPropertyValue( sPath );
+
+ /* SJ: CustomShapes that are available in the gallery are having the highest
+ priority, so we will take a look there before taking the internal default */
+
+ if ( GalleryExplorer::GetSdrObjCount( GALLERY_THEME_POWERPOINT ) )
+ {
+ std::vector< rtl::OUString > aObjList;
+ if ( GalleryExplorer::FillObjListTitle( GALLERY_THEME_POWERPOINT, aObjList ) )
+ {
+ sal_uInt16 i;
+ for ( i = 0; i < aObjList.size(); i++ )
+ {
+ if ( aObjList[ i ].equalsIgnoreAsciiCase( rCustomShape ) )
+ {
+ FmFormModel aFormModel;
+ SfxItemPool& rPool = aFormModel.GetItemPool();
+ rPool.FreezeIdRanges();
+ if ( GalleryExplorer::GetSdrObj( GALLERY_THEME_POWERPOINT, i, &aFormModel ) )
+ {
+ const SdrObject* pSourceObj = aFormModel.GetPage( 0 )->GetObj( 0 );
+ if( pSourceObj )
+ {
+ PropertyValue aPropVal_;
+ SdrCustomShapeGeometryItem& rSourceGeometry = (SdrCustomShapeGeometryItem&)pSourceObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
+ com::sun::star::uno::Any* pAny = rSourceGeometry.GetPropertyValueByName( sType );
+ if ( pAny )
+ {
+ aPropVal_.Name = sType;
+ aPropVal_.Value = *pAny;
+ rGeometryItem.SetPropertyValue( aPropVal_ );
+ }
+ pAny = rSourceGeometry.GetPropertyValueByName( sAdjustmentValues );
+ if ( pAny )
+ {
+ aPropVal_.Name = sAdjustmentValues;
+ aPropVal_.Value = *pAny;
+ rGeometryItem.SetPropertyValue( aPropVal_ );
+ }
+ pAny = rSourceGeometry.GetPropertyValueByName( sCoordinateOrigin );
+ if ( pAny )
+ {
+ aPropVal_.Name = sCoordinateOrigin;
+ aPropVal_.Value = *pAny;
+ rGeometryItem.SetPropertyValue( aPropVal_ );
+ }
+ pAny = rSourceGeometry.GetPropertyValueByName( sCoordinateSize );
+ if ( pAny )
+ {
+ aPropVal_.Name = sCoordinateSize;
+ aPropVal_.Value = *pAny;
+ rGeometryItem.SetPropertyValue( aPropVal_ );
+ }
+ pAny = rSourceGeometry.GetPropertyValueByName( sEquations );
+ if ( pAny )
+ {
+ aPropVal_.Name = sEquations;
+ aPropVal_.Value = *pAny;
+ rGeometryItem.SetPropertyValue( aPropVal_ );
+ }
+ pAny = rSourceGeometry.GetPropertyValueByName( sHandles );
+ if ( pAny )
+ {
+ aPropVal_.Name = sHandles;
+ aPropVal_.Value = *pAny;
+ rGeometryItem.SetPropertyValue( aPropVal_ );
+ }
+ pAny = rSourceGeometry.GetPropertyValueByName( sPath );
+ if ( pAny )
+ {
+ aPropVal_.Name = sPath;
+ aPropVal_.Value = *pAny;
+ rGeometryItem.SetPropertyValue( aPropVal_ );
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+
+void FontworkBar::execute( SdrView* pSdrView, SfxRequest& rReq, SfxBindings& rBindings )
+{
+ sal_uInt16 nStrResId = 0;
+
+ sal_uInt16 nSID = rReq.GetSlot();
+ switch( nSID )
+ {
+ case SID_FONTWORK_GALLERY_FLOATER:
+ {
+ FontWorkGalleryDialog aDlg( pSdrView, ImpGetViewWin(pSdrView), nSID );
+ aDlg.Execute();
+ }
+ break;
+
+ case SID_FONTWORK_SHAPE_TYPE:
+ {
+ rtl::OUString aCustomShape;
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ if ( pArgs )
+ {
+ const SfxStringItem& rItm = (const SfxStringItem&)pArgs->Get( rReq.GetSlot() );
+ aCustomShape = rItm.GetValue();
+ }
+ if ( aCustomShape.getLength() )
+ {
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ sal_uInt32 nCount = rMarkList.GetMarkCount(), i;
+ for( i = 0; i < nCount; i++ )
+ {
+ SdrObject* pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
+ if( pObj->ISA(SdrObjCustomShape) )
+ {
+ const bool bUndo = pSdrView->IsUndoEnabled();
+
+ if( bUndo )
+ {
+ String aStr( SVX_RES( RID_SVXSTR_UNDO_APPLY_FONTWORK_SHAPE ) );
+ pSdrView->BegUndo( aStr );
+ pSdrView->AddUndo( pSdrView->GetModel()->GetSdrUndoFactory().CreateUndoAttrObject( *pObj ) );
+ }
+ SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ GetGeometryForCustomShape( aGeometryItem, aCustomShape );
+ pObj->SetMergedItem( aGeometryItem );
+
+ Reference< drawing::XShape > aXShape = GetXShapeForSdrObject( (SdrObjCustomShape*)pObj );
+ if ( aXShape.is() )
+ {
+ Reference< drawing::XEnhancedCustomShapeDefaulter > xDefaulter( aXShape, UNO_QUERY );
+ if( xDefaulter.is() )
+ xDefaulter->createCustomShapeDefaults( aCustomShape );
+ }
+
+ pObj->BroadcastObjectChange();
+ if( bUndo )
+ pSdrView->EndUndo();
+ pSdrView->AdjustMarkHdl(); //HMH sal_True );
+ rBindings.Invalidate( SID_FONTWORK_SHAPE_TYPE );
+ }
+ }
+ }
+ }
+ break;
+
+ case SID_FONTWORK_CHARACTER_SPACING_DIALOG :
+ {
+ if( rReq.GetArgs() && ( rReq.GetArgs()->GetItemState( SID_FONTWORK_CHARACTER_SPACING ) == SFX_ITEM_SET ) )
+ {
+ sal_Int32 nCharSpacing = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_FONTWORK_CHARACTER_SPACING))->GetValue();
+ FontworkCharacterSpacingDialog aDlg( 0L, nCharSpacing );
+ sal_uInt16 nRet = aDlg.Execute();
+ if( nRet != 0 )
+ {
+ SfxInt32Item aItem( SID_FONTWORK_CHARACTER_SPACING, aDlg.getScale() );
+ SfxPoolItem* aItems[] = { &aItem, 0 };
+ rBindings.Execute( SID_FONTWORK_CHARACTER_SPACING, (const SfxPoolItem**)aItems );
+ }
+ }
+ }
+ break;
+
+ case SID_FONTWORK_SHAPE:
+ case SID_FONTWORK_ALIGNMENT:
+ {
+ if ( !nStrResId )
+ nStrResId = RID_SVXSTR_UNDO_APPLY_FONTWORK_ALIGNMENT;
+ } // PASSTROUGH
+ case SID_FONTWORK_CHARACTER_SPACING:
+ {
+ if ( !nStrResId )
+ nStrResId = RID_SVXSTR_UNDO_APPLY_FONTWORK_CHARACTER_SPACING;
+ } // PASSTROUGH
+ case SID_FONTWORK_KERN_CHARACTER_PAIRS:
+ {
+ if ( !nStrResId )
+ nStrResId = RID_SVXSTR_UNDO_APPLY_FONTWORK_CHARACTER_SPACING;
+ } // PASSTROUGH
+ case SID_FONTWORK_SAME_LETTER_HEIGHTS:
+ {
+ if ( !nStrResId )
+ nStrResId = RID_SVXSTR_UNDO_APPLY_FONTWORK_SAME_LETTER_HEIGHT;
+
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
+ for( i = 0; i < nCount; i++ )
+ {
+ SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
+ if( pObj->ISA(SdrObjCustomShape) )
+ {
+ const bool bUndo = pSdrView->IsUndoEnabled();
+ if( bUndo )
+ {
+ String aStr( SVX_RES( nStrResId ) );
+ pSdrView->BegUndo( aStr );
+ pSdrView->AddUndo( pSdrView->GetModel()->GetSdrUndoFactory().CreateUndoAttrObject( *pObj ) );
+ }
+ SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ impl_execute( pSdrView, rReq, aGeometryItem, pObj );
+ pObj->SetMergedItem( aGeometryItem );
+ pObj->BroadcastObjectChange();
+ if( bUndo )
+ pSdrView->EndUndo();
+ }
+ }
+ }
+ break;
+ };
+}
+
+void FontworkBar::getState( SdrView* pSdrView, SfxItemSet& rSet )
+{
+ sal_uInt32 nCheckStatus = 0;
+
+ /*
+ if ( rSet.GetItemState( SID_FONTWORK_SHAPE ) != SFX_ITEM_UNKNOWN )
+ {
+ sal_Bool bBreak = sal_True;
+ }
+ */
+ if ( rSet.GetItemState( SID_FONTWORK_ALIGNMENT_FLOATER ) != SFX_ITEM_UNKNOWN )
+ {
+ if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
+ rSet.DisableItem( SID_FONTWORK_ALIGNMENT_FLOATER );
+ }
+ if ( rSet.GetItemState( SID_FONTWORK_ALIGNMENT ) != SFX_ITEM_UNKNOWN )
+ {
+ if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
+ rSet.DisableItem( SID_FONTWORK_ALIGNMENT );
+ else
+ SetAlignmentState( pSdrView, rSet );
+ }
+ if ( rSet.GetItemState( SID_FONTWORK_CHARACTER_SPACING_FLOATER ) != SFX_ITEM_UNKNOWN )
+ {
+ if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
+ rSet.DisableItem( SID_FONTWORK_CHARACTER_SPACING_FLOATER );
+ }
+ if ( rSet.GetItemState( SID_FONTWORK_CHARACTER_SPACING ) != SFX_ITEM_UNKNOWN )
+ {
+ if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
+ rSet.DisableItem( SID_FONTWORK_CHARACTER_SPACING );
+ else
+ SetCharacterSpacingState( pSdrView, rSet );
+ }
+ if ( rSet.GetItemState( SID_FONTWORK_KERN_CHARACTER_PAIRS ) != SFX_ITEM_UNKNOWN )
+ {
+ if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
+ rSet.DisableItem( SID_FONTWORK_KERN_CHARACTER_PAIRS );
+ else
+ SetKernCharacterPairsState( pSdrView, rSet );
+ }
+ if ( rSet.GetItemState( SID_FONTWORK_SAME_LETTER_HEIGHTS ) != SFX_ITEM_UNKNOWN )
+ {
+ if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
+ rSet.DisableItem( SID_FONTWORK_SAME_LETTER_HEIGHTS );
+ }
+ if ( rSet.GetItemState( SID_FONTWORK_SHAPE_TYPE ) != SFX_ITEM_UNKNOWN )
+ {
+ if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
+ rSet.DisableItem( SID_FONTWORK_SHAPE_TYPE );
+ else
+ SetFontWorkShapeTypeState( pSdrView, rSet );
+ }
+}
diff --git a/svx/source/toolbars/fontworkbar.src b/svx/source/toolbars/fontworkbar.src
new file mode 100644
index 000000000000..a7bdd2cccada
--- /dev/null
+++ b/svx/source/toolbars/fontworkbar.src
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svx/dialogs.hrc>
+
+String RID_SVX_FONTWORK_BAR
+{
+ Text [ en-US ] = "Fontwork";
+};
+
+String RID_SVXSTR_UNDO_APPLY_FONTWORK_SHAPE
+{
+ Text [ en-US ] = "Apply Fontwork Shape";
+};
+
+String RID_SVXSTR_UNDO_APPLY_FONTWORK_SAME_LETTER_HEIGHT
+{
+ Text [ en-US ] = "Apply Fontwork Same Letter Heights";
+};
+
+String RID_SVXSTR_UNDO_APPLY_FONTWORK_ALIGNMENT
+{
+ Text [ en-US ] = "Apply Fontwork Alignment";
+};
+
+String RID_SVXSTR_UNDO_APPLY_FONTWORK_CHARACTER_SPACING
+{
+ Text [ en-US ] = "Apply Fontwork Character Spacing";
+};
diff --git a/svx/source/unodialogs/textconversiondlgs/buttongroup.hrc b/svx/source/unodialogs/textconversiondlgs/buttongroup.hrc
new file mode 100644
index 000000000000..b99403b57e1f
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/buttongroup.hrc
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _UNODIALOGS_BUTTONGROUP_HRC
+#define _UNODIALOGS_BUTTONGROUP_HRC
+
+#include "resids.hrc"
+
+#define PB_OK 1
+#define PB_CANCEL 1
+#define PB_HELP 1
+
+#define BUTTONGROUP_BUTTONWIDTH 40
+
+#define BUTTONS_OK_CANCEL_HELP( xRightPos, yTopPos, xOffset, yOffset ) \
+OKButton PB_OK \
+{ \
+ Pos = MAP_APPFONT ( xRightPos-BUTTONGROUP_BUTTONWIDTH-xOffset-xOffset , yTopPos ) ; \
+ Size = MAP_APPFONT ( BUTTONGROUP_BUTTONWIDTH , 14 ) ; \
+ TabStop = TRUE ; \
+ DefButton = TRUE ; \
+}; \
+CancelButton PB_CANCEL \
+{ \
+ Pos = MAP_APPFONT ( xRightPos-BUTTONGROUP_BUTTONWIDTH-xOffset , yTopPos+yOffset ) ; \
+ Size = MAP_APPFONT ( BUTTONGROUP_BUTTONWIDTH , 14 ) ; \
+ TabStop = TRUE ; \
+}; \
+HelpButton PB_HELP \
+{ \
+ Pos = MAP_APPFONT ( xRightPos-BUTTONGROUP_BUTTONWIDTH , yTopPos+yOffset+yOffset ) ; \
+ Size = MAP_APPFONT ( BUTTONGROUP_BUTTONWIDTH , 14 ) ; \
+ TabStop = TRUE ; \
+};
+
+#define BUTTONS_OK_CANCEL_HELP_STACKED( xRightPos ) \
+BUTTONS_OK_CANCEL_HELP( xRightPos, 6, 0, 17 )
+
+#define BUTTONS_OK_CANCEL_HELP_ABREAST( xRightPos, yTopPos ) \
+BUTTONS_OK_CANCEL_HELP( xRightPos, yTopPos, (BUTTONGROUP_BUTTONWIDTH+3), 0 )
+
+#endif
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dialogs.src b/svx/source/unodialogs/textconversiondlgs/chinese_dialogs.src
new file mode 100644
index 000000000000..9c94496a1747
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_dialogs.src
@@ -0,0 +1,293 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "chinese_dictionarydialog.hrc"
+#include "chinese_translationdialog.hrc"
+
+#include <svtools/controldims.hrc>
+
+#define DIRECTION_RADIOBUTTONS( D_XPOS, D_YPOS, D_FULLWIDTH ) \
+RadioButton RB_TO_SIMPLIFIED \
+{ \
+ Pos = MAP_APPFONT( D_XPOS, D_YPOS ); \
+ Size = MAP_APPFONT ( D_FULLWIDTH, RSC_CD_RADIOBUTTON_HEIGHT ) ; \
+ Text [ en-US ] = "~Traditional Chinese to simplified Chinese"; \
+}; \
+RadioButton RB_TO_TRADITIONAL \
+{ \
+ Pos = MAP_APPFONT( D_XPOS, D_YPOS + RSC_CD_RADIOBUTTON_HEIGHT+RSC_SP_CTRL_GROUP_Y ); \
+ Size = MAP_APPFONT ( D_FULLWIDTH, RSC_CD_RADIOBUTTON_HEIGHT ) ; \
+ Text [ en-US ] = "~Simplified Chinese to traditional Chinese"; \
+};
+
+//-----------------------------------------------------------------------------
+//defines for positions and sizes:
+
+#define FULL_WIDTH (245)
+#define FULL_HEIGHT (165)
+
+#define ROW_1 (RSC_SP_DLG_INNERBORDER_TOP)
+#define ROW_2 (ROW_1+RSC_CD_RADIOBUTTON_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+#define ROW_3 (ROW_2+RSC_CD_RADIOBUTTON_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+#define ROW_4 (ROW_3+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+#define ROW_5 (ROW_4+RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_6 (ROW_5+RSC_CD_TEXTBOX_HEIGHT+RSC_SP_CTRL_DESC_Y)
+
+#define ROW_5a (ROW_5+RSC_CD_PUSHBUTTON_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_5b (ROW_5a+RSC_CD_PUSHBUTTON_HEIGHT+RSC_SP_CTRL_DESC_Y)
+
+#define ROW_8 (FULL_HEIGHT-RSC_SP_DLG_INNERBORDER_BOTTOM-RSC_CD_PUSHBUTTON_HEIGHT)
+#define ROW_7 (ROW_8-RSC_CD_FIXEDLINE_HEIGHT-2)
+
+#define LIST_HEIGHT (ROW_7-RSC_SP_CTRL_Y-ROW_6)
+
+#define COL_WIDTH 60
+#define BUTTONCOL_WIDTH 40
+#define COL_1 (RSC_SP_DLG_INNERBORDER_LEFT+RSC_SP_FLGR_SPACE_X)
+#define COL_2 (COL_1+COL_WIDTH+1)
+#define COL_3 (COL_2+COL_WIDTH+1)
+#define COL_4 (FULL_WIDTH-RSC_SP_DLG_INNERBORDER_RIGHT-BUTTONCOL_WIDTH)
+
+#define REST_COL_WIDTH (COL_4-COL_3-RSC_SP_CTRL_GROUP_X)
+
+//-----------------------------------------------------------------------------
+
+ModalDialog DLG_CHINESEDICTIONARY
+{
+ HelpID = "svx:ModalDialog:DLG_CHINESEDICTIONARY";
+ //HelpId = ;
+ Size = MAP_APPFONT( FULL_WIDTH, FULL_HEIGHT );
+ OutputSize = TRUE;
+ Closeable = TRUE ;
+ Moveable = TRUE ;
+ SVLook = TRUE;
+
+ Text [ en-US ] = "Edit Dictionary";
+
+ DIRECTION_RADIOBUTTONS( COL_1, ROW_1, FULL_WIDTH - COL_1 - RSC_SP_DLG_INNERBORDER_RIGHT )
+
+ CheckBox CB_REVERSE
+ {
+ HelpID = "svx:CheckBox:DLG_CHINESEDICTIONARY:CB_REVERSE";
+ Pos = MAP_APPFONT ( COL_1, ROW_3 ) ;
+ Size = MAP_APPFONT ( FULL_WIDTH - COL_1 - RSC_SP_DLG_INNERBORDER_RIGHT , RSC_CD_CHECKBOX_HEIGHT ) ;
+
+ Text [ en-US ] = "Reverse mapping";
+ };
+
+ FixedText FT_TERM
+ {
+ Pos = MAP_APPFONT ( COL_1 , ROW_4 ) ;
+ Size = MAP_APPFONT ( COL_WIDTH, RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Term";
+ };
+ Edit ED_TERM
+ {
+ HelpID = "svx:Edit:DLG_CHINESEDICTIONARY:ED_TERM";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_1 , ROW_5 ) ;
+ Size = MAP_APPFONT ( COL_WIDTH , RSC_CD_TEXTBOX_HEIGHT ) ;
+ };
+
+
+ FixedText FT_MAPPING
+ {
+ Pos = MAP_APPFONT ( COL_2 , ROW_4 ) ;
+ Size = MAP_APPFONT ( COL_WIDTH, RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Mapping";
+ };
+ Edit ED_MAPPING
+ {
+ HelpID = "svx:Edit:DLG_CHINESEDICTIONARY:ED_MAPPING";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , ROW_5 ) ;
+ Size = MAP_APPFONT ( COL_WIDTH , RSC_CD_TEXTBOX_HEIGHT ) ;
+ };
+
+ FixedText FT_PROPERTY
+ {
+ Pos = MAP_APPFONT ( COL_3 , ROW_4 ) ;
+ Size = MAP_APPFONT ( REST_COL_WIDTH, RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Property";
+ };
+ ListBox LB_PROPERTY
+ {
+ HelpID = "svx:ListBox:DLG_CHINESEDICTIONARY:LB_PROPERTY";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_3 , ROW_5 ) ;
+ Size = MAP_APPFONT ( REST_COL_WIDTH , RSC_CD_TEXTBOX_HEIGHT ) ;
+ DropDown = TRUE ;
+
+ stringlist [ en-US ] =
+ {
+ < "Other" ; Default ; > ;
+ < "Foreign" ; > ;
+ < "First name" ; > ;
+ < "Last name" ; > ;
+ < "Title" ; > ;
+ < "Status" ; > ;
+ < "Place name" ; > ;
+ < "Business" ; > ;
+ < "Adjective" ; > ;
+ < "Idiom" ; > ;
+ < "Abbreviation" ; > ;
+ < "Numerical" ; > ;
+ < "Noun" ; > ;
+ < "Verb" ; > ;
+ < "Brand name" ; > ;
+ };
+ };
+
+ Control CT_MAPPINGLIST
+ {
+ Pos = MAP_APPFONT ( COL_1, ROW_6 ) ;
+ Size = MAP_APPFONT ( COL_4 - COL_1 - RSC_SP_CTRL_GROUP_X, LIST_HEIGHT ) ;
+ TabStop = TRUE ;
+ };
+
+ PushButton PB_ADD
+ {
+ HelpID = "svx:PushButton:DLG_CHINESEDICTIONARY:PB_ADD";
+ Pos = MAP_APPFONT( COL_4, ROW_5 );
+ Size = MAP_APPFONT( BUTTONCOL_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT );
+
+ Text [ en-US ] = "~Add";
+ };
+ PushButton PB_MODIFY
+ {
+ HelpID = "svx:PushButton:DLG_CHINESEDICTIONARY:PB_MODIFY";
+ Pos = MAP_APPFONT( COL_4, ROW_5a );
+ Size = MAP_APPFONT( BUTTONCOL_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT );
+
+ Text [ en-US ] = "~Modify";
+ };
+ PushButton PB_DELETE
+ {
+ HelpID = "svx:PushButton:DLG_CHINESEDICTIONARY:PB_DELETE";
+ Pos = MAP_APPFONT( COL_4, ROW_5b );
+ Size = MAP_APPFONT( BUTTONCOL_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT );
+
+ Text [ en-US ] = "~Delete";
+ };
+
+ FixedLine FL_BOTTOMLINE
+ {
+ Pos = MAP_APPFONT ( 0 , ROW_7 ) ;
+ Size = MAP_APPFONT ( FULL_WIDTH, RSC_CD_FIXEDLINE_HEIGHT ) ;
+ };
+
+ BUTTONS_OK_CANCEL_HELP_ABREAST( FULL_WIDTH - RSC_SP_DLG_INNERBORDER_RIGHT, ROW_8 )
+};
+
+//-----------------------------------------------------------------------------
+//defines for positions and sizes:
+
+#define T_FULL_WIDTH (220)
+#define T_FULL_HEIGHT (120)
+#define T_EDITBUTTON_WIDTH (75)
+
+#define T_COL_1 (RSC_SP_DLG_INNERBORDER_LEFT)
+#define T_COL_2 (T_COL_1+RSC_SP_FLGR_SPACE_X)
+#define T_COL_3 (T_COL_2+RSC_SP_CHK_TEXTINDENT)
+#define T_COL_4 (T_FULL_WIDTH-RSC_SP_DLG_INNERBORDER_RIGHT-T_EDITBUTTON_WIDTH)
+
+#define T_ROW_1 (RSC_SP_DLG_INNERBORDER_TOP)
+#define T_ROW_2 (T_ROW_1+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+#define T_ROW_3 (T_ROW_2+RSC_CD_RADIOBUTTON_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+#define T_ROW_4 (T_ROW_3+RSC_CD_RADIOBUTTON_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define T_ROW_5 (T_ROW_4+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_CTRL_Y)
+#define T_ROW_6 (T_ROW_5+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+
+#define T_ROW_8 (T_FULL_HEIGHT-RSC_SP_DLG_INNERBORDER_BOTTOM-RSC_CD_PUSHBUTTON_HEIGHT)
+#define T_ROW_7 (T_ROW_8-RSC_CD_FIXEDLINE_HEIGHT-2)
+
+//-----------------------------------------------------------------------------
+
+ModalDialog DLG_CHINESETRANSLATION
+{
+ HelpID = "svx:ModalDialog:DLG_CHINESETRANSLATION";
+ //HelpId = ;
+ Size = MAP_APPFONT( T_FULL_WIDTH, T_FULL_HEIGHT );
+ OutputSize = TRUE;
+ Closeable = TRUE ;
+ Moveable = TRUE ;
+ SVLook = TRUE;
+
+ Text [ en-US ] = "Chinese Conversion";
+
+ FixedLine FL_DIRECTION
+ {
+ Pos = MAP_APPFONT ( T_COL_1 , T_ROW_1 ) ;
+ Size = MAP_APPFONT ( T_FULL_WIDTH - T_COL_1 - RSC_SP_DLG_INNERBORDER_RIGHT, RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Conversion direction";
+ };
+
+ DIRECTION_RADIOBUTTONS( T_COL_2, T_ROW_2, (T_FULL_WIDTH - T_COL_2 - RSC_SP_DLG_INNERBORDER_RIGHT) )
+
+ CheckBox CB_USE_VARIANTS
+ {
+ HelpID = "svx:CheckBox:DLG_CHINESETRANSLATION:CB_USE_VARIANTS";
+ Pos = MAP_APPFONT( T_COL_3, T_ROW_4 );
+ Size = MAP_APPFONT ( T_FULL_WIDTH - T_COL_3 - RSC_SP_DLG_INNERBORDER_RIGHT, RSC_CD_CHECKBOX_HEIGHT ) ;
+
+ Text [ en-US ] = "~Use Taiwan, Hong Kong SAR, and Macao SAR character variants";
+ };
+
+ FixedLine FL_COMMONTERMS
+ {
+ Pos = MAP_APPFONT ( T_COL_1 , T_ROW_5 ) ;
+ Size = MAP_APPFONT ( T_FULL_WIDTH - T_COL_1 - RSC_SP_DLG_INNERBORDER_RIGHT, RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Common terms";
+ };
+
+ CheckBox CB_TRANSLATE_COMMONTERMS
+ {
+ HelpID = "svx:CheckBox:DLG_CHINESETRANSLATION:CB_TRANSLATE_COMMONTERMS";
+ Pos = MAP_APPFONT( T_COL_2, T_ROW_6 );
+ Size = MAP_APPFONT ( T_COL_4 - T_COL_2, RSC_CD_CHECKBOX_HEIGHT ) ;
+
+ Text [ en-US ] = "Translate ~common terms";
+ };
+
+ PushButton PB_EDITTERMS
+ {
+ HelpID = "svx:PushButton:DLG_CHINESETRANSLATION:PB_EDITTERMS";
+ Pos = MAP_APPFONT( T_COL_4, T_ROW_6-(RSC_CD_PUSHBUTTON_HEIGHT-RSC_CD_CHECKBOX_HEIGHT)/2 );
+ Size = MAP_APPFONT( T_EDITBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+
+ Text [ en-US ] = "~Edit Terms...";
+ };
+
+ FixedLine T_FL_BOTTOMLINE
+ {
+ Pos = MAP_APPFONT ( 0 , T_ROW_7 ) ;
+ Size = MAP_APPFONT ( T_FULL_WIDTH, RSC_CD_FIXEDLINE_HEIGHT ) ;
+ };
+
+ BUTTONS_OK_CANCEL_HELP_ABREAST( T_FULL_WIDTH - RSC_SP_DLG_INNERBORDER_RIGHT, T_ROW_8 )
+};
+
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
new file mode 100644
index 000000000000..d4e2d2272c12
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
@@ -0,0 +1,895 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "chinese_dictionarydialog.hxx"
+#include "chinese_dictionarydialog.hrc"
+#include "resid.hxx"
+#include <cppuhelper/bootstrap.hxx>
+#include <com/sun/star/i18n/TextConversionOption.hpp>
+#include <com/sun/star/linguistic2/ConversionDictionaryType.hpp>
+#include <com/sun/star/linguistic2/ConversionPropertyType.hpp>
+#include <com/sun/star/linguistic2/XConversionDictionaryList.hpp>
+#include <com/sun/star/linguistic2/XConversionPropertyType.hpp>
+#include <com/sun/star/util/XFlushable.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+// header for class HeaderBar
+#include <svtools/headbar.hxx>
+// header for define RET_OK
+#include <vcl/msgbox.hxx>
+// header for class SvtLinguConfigItem
+#include <unotools/lingucfg.hxx>
+#include <unotools/linguprops.hxx>
+// header for class IntlWrapper
+#include <unotools/intlwrapper.hxx>
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX
+#include <comphelper/processfactory.hxx>
+#endif
+// header for class Application
+#include <vcl/svapp.hxx>
+#ifndef _SVX_HELPID_HRC
+#include "helpid.hrc"
+#endif
+
+//disable compiler warning C4355: 'this' : used in base member initializer list
+#ifdef _MSC_VER
+# pragma warning (disable : 4355)
+#endif
+
+//.............................................................................
+namespace textconversiondlgs
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+#define HEADER_BAR_BITS ( HIB_LEFT | HIB_VCENTER | HIB_CLICKABLE | HIB_FIXED | HIB_FIXEDPOS )
+
+DictionaryList::DictionaryList( Window* pParent, const ResId& rResId)
+ : SvHeaderTabListBox( pParent, rResId )
+ , m_xDictionary(0)
+ , m_pHeaderBar(0)
+ , m_pPropertyTypeNameListBox(0)
+ , m_aToBeDeleted()
+ , m_nSortColumnIndex(0)
+{
+}
+
+DictionaryList::DictionaryList( Window* pParent )
+ : SvHeaderTabListBox( pParent, 0 )
+ , m_xDictionary(0)
+ , m_pHeaderBar(0)
+ , m_pPropertyTypeNameListBox(0)
+ , m_aToBeDeleted()
+ , m_nSortColumnIndex(0)
+{
+}
+
+String DictionaryList::getPropertyTypeName( sal_Int16 nConversionPropertyType ) const
+{
+ if(!m_pPropertyTypeNameListBox || !m_pPropertyTypeNameListBox->GetEntryCount())
+ return String();
+
+ sal_uInt16 nPos = static_cast<sal_uInt16>( nConversionPropertyType )-1;
+ if(nPos<m_pPropertyTypeNameListBox->GetEntryCount())
+ return m_pPropertyTypeNameListBox->GetEntry(nPos);
+ return m_pPropertyTypeNameListBox->GetEntry(0);
+}
+
+String DictionaryList::makeTabString( const DictionaryEntry& rEntry ) const
+{
+ String aStr( rEntry.m_aTerm );
+ aStr += '\t';
+ aStr += String( rEntry.m_aMapping );
+ aStr += '\t';
+ aStr += getPropertyTypeName( rEntry.m_nConversionPropertyType );
+ return aStr;
+}
+
+void DictionaryList::initDictionaryControl( const Reference< linguistic2::XConversionDictionary>& xDictionary
+ , ListBox* pPropertyTypeNameListBox )
+{
+ SetStyle( WB_VSCROLL | WB_TABSTOP );
+ SetSelectionMode( SINGLE_SELECTION );
+ SetBorderStyle( WINDOW_BORDER_MONO );
+ SetHighlightRange();
+
+ if(m_xDictionary.is())
+ return;
+
+ m_xDictionary = xDictionary;
+ m_pPropertyTypeNameListBox = pPropertyTypeNameListBox;
+}
+
+void DictionaryList::save()
+{
+ if( !m_xDictionary.is() )
+ return;
+
+ Reference< linguistic2::XConversionPropertyType > xPropertyType( m_xDictionary, uno::UNO_QUERY );
+
+ sal_Int32 nN;
+ DictionaryEntry* pE;
+
+ for( nN = m_aToBeDeleted.size(); nN--; )
+ {
+ pE = m_aToBeDeleted[nN];
+ m_xDictionary->removeEntry( pE->m_aTerm, pE->m_aMapping );
+ }
+ for( nN = GetRowCount(); nN--; )
+ {
+ pE = getEntryOnPos( nN );
+ if(pE->m_bNewEntry)
+ {
+ try
+ {
+ m_xDictionary->addEntry( pE->m_aTerm, pE->m_aMapping );
+ xPropertyType->setPropertyType( pE->m_aTerm, pE->m_aMapping, pE->m_nConversionPropertyType );
+ }
+ catch( uno::Exception& )
+ {
+
+ }
+ }
+ }
+ Reference< util::XFlushable > xFlush( m_xDictionary, uno::UNO_QUERY );
+ if( xFlush.is() )
+ xFlush->flush();
+}
+
+void DictionaryList::deleteAll()
+{
+ sal_Int32 nN;
+ for( nN = GetRowCount(); nN--; )
+ deleteEntryOnPos( nN );
+ for( nN = m_aToBeDeleted.size(); nN--; )
+ {
+ DictionaryEntry* pE = m_aToBeDeleted[nN];
+ delete pE;
+ }
+ m_aToBeDeleted.clear();
+}
+
+void DictionaryList::refillFromDictionary( sal_Int32 nTextConversionOptions )
+{
+ deleteAll();
+
+ if(!m_xDictionary.is())
+ return;
+
+ Sequence< rtl::OUString > aLeftList( m_xDictionary->getConversionEntries( linguistic2::ConversionDirection_FROM_LEFT ) );
+ sal_Int32 nCount = aLeftList.getLength();
+
+ Reference< linguistic2::XConversionPropertyType > xPropertyType( m_xDictionary, uno::UNO_QUERY );
+
+ rtl::OUString aLeft, aRight;
+ sal_Int16 nConversionPropertyType;
+
+ for(sal_Int32 nN=0; nN<nCount; nN++)
+ {
+ aLeft = aLeftList[nN];
+ Sequence< rtl::OUString > aRightList( m_xDictionary->getConversions(
+ aLeft, 0, aLeft.getLength()
+ , linguistic2::ConversionDirection_FROM_LEFT, nTextConversionOptions ) );
+
+ if(aRightList.getLength()!=1)
+ {
+ OSL_ASSERT("The Chinese Translation Dictionary should have exactly one Mapping for each term.");
+ continue;
+ }
+
+ aRight = aRightList[0];
+ nConversionPropertyType = linguistic2::ConversionPropertyType::OTHER;
+ if(xPropertyType.is())
+ nConversionPropertyType = xPropertyType->getPropertyType(aLeft, aRight);
+
+ DictionaryEntry* pEntry = new DictionaryEntry( aLeft, aRight, nConversionPropertyType );
+ SvLBoxEntry* pLBEntry = InsertEntry( makeTabString( *pEntry ) );
+ pLBEntry->SetUserData( pEntry );
+ }
+
+ if( GetEntryCount() > 0 )
+ SelectRow( 0 );
+}
+
+DictionaryEntry* DictionaryList::getFirstSelectedEntry() const
+{
+ DictionaryEntry* pRet=0;
+ for( sal_Int32 nN=GetRowCount(); nN--; )
+ {
+ if( IsRowSelected( nN ) )
+ {
+ pRet = getEntryOnPos( nN );
+ break;
+ }
+ }
+ return pRet;
+}
+
+DictionaryEntry* DictionaryList::getEntryOnPos( sal_Int32 nPos ) const
+{
+ DictionaryEntry* pEntry=0;
+ SvLBoxEntry* pLBEntry = GetEntryOnPos( nPos );
+ if(pLBEntry)
+ pEntry = (DictionaryEntry*)pLBEntry->GetUserData();
+ return pEntry;
+}
+
+DictionaryEntry* DictionaryList::getTermEntry( const rtl::OUString& rTerm ) const
+{
+ DictionaryEntry* pE = 0;
+ for( sal_Int32 nN=GetRowCount(); nN--; )
+ {
+ pE = getEntryOnPos( nN );
+ if( pE && rTerm.equals( pE->m_aTerm ) )
+ return pE;
+ }
+ return 0;
+}
+
+bool DictionaryList::hasTerm( const rtl::OUString& rTerm ) const
+{
+ return getTermEntry(rTerm) !=0 ;
+}
+
+void DictionaryList::addEntry( const rtl::OUString& rTerm, const rtl::OUString& rMapping
+ , sal_Int16 nConversionPropertyType, sal_uIntPtr nPos )
+{
+ if( hasTerm( rTerm ) )
+ return;
+
+ DictionaryEntry* pEntry = new DictionaryEntry( rTerm, rMapping, nConversionPropertyType, sal_True );
+ SvLBoxEntry* pLBEntry = InsertEntryToColumn( makeTabString( *pEntry ), nPos );
+ pLBEntry->SetUserData( pEntry );
+ SelectRow( GetEntryPos( pLBEntry ) );
+}
+
+void DictionaryList::deleteEntryOnPos( sal_Int32 nPos )
+{
+ SvLBoxEntry* pLBEntry = GetEntryOnPos( nPos );
+ DictionaryEntry* pEntry = getEntryOnPos( nPos );
+ if( pLBEntry )
+ RemoveParentKeepChilds( pLBEntry );
+ if( pEntry )
+ {
+ if( pEntry->m_bNewEntry )
+ delete pEntry;
+ else
+ m_aToBeDeleted.push_back( pEntry );
+ }
+}
+
+sal_uIntPtr DictionaryList::deleteEntries( const rtl::OUString& rTerm )
+{
+ sal_uIntPtr nPos = LIST_APPEND;
+ for( sal_Int32 nN=GetRowCount(); nN--; )
+ {
+ DictionaryEntry* pCurEntry = getEntryOnPos( nN );
+ if( rTerm.equals( pCurEntry->m_aTerm ) )
+ {
+ nPos = nN;
+ SvLBoxEntry* pCurLBEntry = GetEntryOnPos( nN );
+ RemoveParentKeepChilds( pCurLBEntry );
+ if( pCurEntry->m_bNewEntry )
+ delete pCurEntry;
+ else
+ m_aToBeDeleted.push_back( pCurEntry );
+ }
+ }
+ return nPos;
+}
+
+DictionaryList::~DictionaryList()
+{
+}
+
+void DictionaryList::activate( HeaderBar* pHeaderBar )
+{
+ if(!m_pHeaderBar)
+ {
+ m_pHeaderBar = pHeaderBar;
+
+ Point aPos = GetPosPixel();
+ Size aSize = GetSizePixel();
+ Size aHeadSize = pHeaderBar->GetSizePixel();
+
+ aPos.Y() += aHeadSize.Height();
+ SetPosSizePixel( aPos, Size( aSize.Width(), aSize.Height() - aHeadSize.Height() ) );
+ InitHeaderBar( pHeaderBar );
+ }
+ Show();
+}
+
+HeaderBar* DictionaryList::createHeaderBar( const String& rColumn1, const String& rColumn2, const String& rColumn3
+ , long nWidth1, long nWidth2, long nWidth3 )
+{
+ HeaderBar* pHeaderBar = new HeaderBar( Control::GetParent(), WB_BUTTONSTYLE | WB_BOTTOMBORDER );
+ pHeaderBar->SetPosSizePixel( GetPosPixel(), pHeaderBar->CalcWindowSizePixel() );
+
+ HeaderBarItemBits nBits = HEADER_BAR_BITS;
+ pHeaderBar->InsertItem( 1, rColumn1, nWidth1, nBits | HIB_UPARROW );
+ pHeaderBar->InsertItem( 2, rColumn2, nWidth2, nBits );
+ pHeaderBar->InsertItem( 3, rColumn3, nWidth3, nBits );
+
+ pHeaderBar->Show();
+ return pHeaderBar;
+}
+
+void DictionaryList::Resize()
+{
+ SvHeaderTabListBox::Resize();
+ Size aBoxSize = GetOutputSizePixel();
+
+ if ( !aBoxSize.Width() )
+ return;
+
+ Size aBarSize = m_pHeaderBar->GetSizePixel();
+ aBarSize.Width() = GetSizePixel().Width();
+ m_pHeaderBar->SetSizePixel( aBarSize );
+}
+
+void DictionaryList::sortByColumn( sal_uInt16 nSortColumnIndex, bool bSortAtoZ )
+{
+ m_nSortColumnIndex=nSortColumnIndex;
+ if( nSortColumnIndex<3 )
+ {
+ if(bSortAtoZ)
+ GetModel()->SetSortMode(SortAscending);
+ else
+ GetModel()->SetSortMode(SortDescending);
+
+ GetModel()->SetCompareHdl( LINK( this, DictionaryList, CompareHdl));
+ GetModel()->Resort();
+ }
+ else
+ GetModel()->SetSortMode(SortNone);
+}
+
+sal_uInt16 DictionaryList::getSortColumn() const
+{
+ return m_nSortColumnIndex;
+}
+
+IMPL_LINK( DictionaryList, CompareHdl, SvSortData*, pData )
+{
+ SvLBoxEntry* pLeft = (SvLBoxEntry*)(pData->pLeft );
+ SvLBoxEntry* pRight = (SvLBoxEntry*)(pData->pRight );
+ return (long) ColumnCompare(pLeft,pRight);
+}
+
+StringCompare DictionaryList::ColumnCompare( SvLBoxEntry* pLeft, SvLBoxEntry* pRight )
+{
+ StringCompare eCompare=COMPARE_EQUAL;
+
+ SvLBoxItem* pLeftItem = getItemAtColumn( pLeft, m_nSortColumnIndex );
+ SvLBoxItem* pRightItem = getItemAtColumn( pRight, m_nSortColumnIndex );
+
+ if(pLeftItem != NULL && pRightItem != NULL)
+ {
+ sal_uInt16 nLeftKind=pLeftItem->IsA();
+ sal_uInt16 nRightKind=pRightItem->IsA();
+
+ if(nRightKind == SV_ITEM_ID_LBOXSTRING &&
+ nLeftKind == SV_ITEM_ID_LBOXSTRING )
+ {
+ IntlWrapper aIntlWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
+ const CollatorWrapper* pCollator = aIntlWrapper.getCaseCollator();
+
+ eCompare=(StringCompare)pCollator->compareString( ((SvLBoxString*)pLeftItem)->GetText(),
+ ((SvLBoxString*)pRightItem)->GetText());
+
+ if(eCompare==COMPARE_EQUAL)
+ eCompare=COMPARE_LESS;
+ }
+ }
+ return eCompare;
+}
+
+SvLBoxItem* DictionaryList::getItemAtColumn( SvLBoxEntry* pEntry, sal_uInt16 nColumn ) const
+{
+ SvLBoxItem* pItem = NULL;
+ if( pEntry )
+ {
+ sal_uInt16 nCount = pEntry->ItemCount();
+ nColumn++;
+ if( nTreeFlags & TREEFLAG_CHKBTN )
+ nColumn++;
+ if( nColumn < nCount )
+ pItem = pEntry->GetItem( nColumn );
+ }
+ return pItem;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+DictionaryEntry::DictionaryEntry( const rtl::OUString& rTerm, const rtl::OUString& rMapping
+ , sal_Int16 nConversionPropertyType
+ , sal_Bool bNewEntry )
+ : m_aTerm( rTerm )
+ , m_aMapping( rMapping )
+ , m_nConversionPropertyType( nConversionPropertyType )
+ , m_bNewEntry( bNewEntry )
+{
+ if( m_nConversionPropertyType == 0 )
+ m_nConversionPropertyType = 1;
+}
+
+DictionaryEntry::~DictionaryEntry()
+{
+}
+
+bool DictionaryEntry::operator==( const DictionaryEntry& rE ) const
+{
+ return m_aTerm == rE.m_aTerm
+ && m_aMapping == rE.m_aMapping
+ && m_nConversionPropertyType == rE.m_nConversionPropertyType;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+ChineseDictionaryDialog::ChineseDictionaryDialog( Window* pParent )
+ : ModalDialog( pParent, TextConversionDlgs_ResId( DLG_CHINESEDICTIONARY ) )
+ , m_nTextConversionOptions( i18n::TextConversionOption::NONE )
+ , m_aRB_To_Simplified( this, TextConversionDlgs_ResId( RB_TO_SIMPLIFIED ) )
+ , m_aRB_To_Traditional( this, TextConversionDlgs_ResId( RB_TO_TRADITIONAL ) )
+ , m_aCB_Reverse( this, TextConversionDlgs_ResId( CB_REVERSE ) )
+ , m_aFT_Term( this, TextConversionDlgs_ResId( FT_TERM ) )
+ , m_aED_Term( this, TextConversionDlgs_ResId( ED_TERM ) )
+ , m_aFT_Mapping( this, TextConversionDlgs_ResId( FT_MAPPING ) )
+ , m_aED_Mapping( this, TextConversionDlgs_ResId( ED_MAPPING ) )
+ , m_aFT_Property( this, TextConversionDlgs_ResId( FT_PROPERTY ) )
+ , m_aLB_Property( this, TextConversionDlgs_ResId( LB_PROPERTY ) )
+ , m_pHeaderBar( 0 )
+ , m_aCT_DictionaryToSimplified( this, TextConversionDlgs_ResId( CT_MAPPINGLIST ) )
+ , m_aCT_DictionaryToTraditional( this )
+ , m_aPB_Add( this, TextConversionDlgs_ResId( PB_ADD ) )
+ , m_aPB_Modify( this, TextConversionDlgs_ResId( PB_MODIFY ) )
+ , m_aPB_Delete( this, TextConversionDlgs_ResId( PB_DELETE ) )
+ , m_aFL_Bottomline( this, TextConversionDlgs_ResId( FL_BOTTOMLINE ) )
+ , m_aBP_OK( this, TextConversionDlgs_ResId( PB_OK ) )
+ , m_aBP_Cancel( this, TextConversionDlgs_ResId( PB_CANCEL ) )
+ , m_aBP_Help( this, TextConversionDlgs_ResId( PB_HELP ) )
+ , m_xContext( 0 )
+ , m_xFactory( 0 )
+{
+ FreeResource();
+
+ m_aRB_To_Simplified.SetHelpId( HID_SVX_CHINESE_DICTIONARY_RB_CONVERSION_TO_SIMPLIFIED );
+ m_aRB_To_Traditional.SetHelpId( HID_SVX_CHINESE_DICTIONARY_RB_CONVERSION_TO_TRADITIONAL );
+
+ m_aCB_Reverse.SetHelpId( HID_SVX_CHINESE_DICTIONARY_CB_REVERSE );
+
+ m_aCT_DictionaryToSimplified.SetHelpId( HID_SVX_CHINESE_DICTIONARY_LB_TO_SIMPLIFIED );
+ m_aCT_DictionaryToTraditional.SetHelpId( HID_SVX_CHINESE_DICTIONARY_LB_TO_TRADITIONAL );
+
+ SvtLinguConfig aLngCfg;
+ sal_Bool bValue = sal_Bool();
+ Any aAny( aLngCfg.GetProperty( rtl::OUString::createFromAscii( UPN_IS_REVERSE_MAPPING ) ) );
+ if( aAny >>= bValue )
+ m_aCB_Reverse.Check( bValue );
+
+ m_aLB_Property.SetDropDownLineCount( m_aLB_Property.GetEntryCount() );
+ m_aLB_Property.SelectEntryPos(0);
+
+ Reference< linguistic2::XConversionDictionary > xDictionary_To_Simplified(0);
+ Reference< linguistic2::XConversionDictionary > xDictionary_To_Traditional(0);
+ //get dictionaries
+ {
+ if(!m_xContext.is())
+ m_xContext = Reference< XComponentContext >( ::cppu::defaultBootstrap_InitialComponentContext() );
+ if(m_xContext.is())
+ m_xFactory = Reference< lang::XMultiComponentFactory >( m_xContext->getServiceManager() );
+ if(m_xFactory.is())
+ {
+ Reference< linguistic2::XConversionDictionaryList > xDictionaryList(
+ m_xFactory->createInstanceWithContext(
+ rtl::OUString::createFromAscii("com.sun.star.linguistic2.ConversionDictionaryList")
+ , m_xContext), uno::UNO_QUERY);
+ if( xDictionaryList.is() )
+ {
+ Reference< container::XNameContainer > xContainer( xDictionaryList->getDictionaryContainer() );
+ if(xContainer.is())
+ {
+ try
+ {
+ rtl::OUString aNameTo_Simplified( rtl::OUString::createFromAscii("ChineseT2S") );
+ rtl::OUString aNameTo_Traditional( rtl::OUString::createFromAscii("ChineseS2T") );
+ lang::Locale aLocale;
+ aLocale.Language = rtl::OUString::createFromAscii("zh");
+
+ if( xContainer->hasByName( aNameTo_Simplified ) )
+ xDictionary_To_Simplified = Reference< linguistic2::XConversionDictionary >(
+ xContainer->getByName( aNameTo_Simplified ), UNO_QUERY );
+ else
+ {
+ aLocale.Country = rtl::OUString::createFromAscii("TW");
+ xDictionary_To_Simplified = Reference< linguistic2::XConversionDictionary >(
+ xDictionaryList->addNewDictionary( aNameTo_Simplified
+ , aLocale, linguistic2::ConversionDictionaryType::SCHINESE_TCHINESE
+ ), UNO_QUERY );
+ }
+ if (xDictionary_To_Simplified.is())
+ xDictionary_To_Simplified->setActive( sal_True );
+
+
+ if( xContainer->hasByName( aNameTo_Traditional ) )
+ xDictionary_To_Traditional = Reference< linguistic2::XConversionDictionary >(
+ xContainer->getByName( aNameTo_Traditional ), UNO_QUERY );
+ else
+ {
+ aLocale.Country = rtl::OUString::createFromAscii("CN");
+ xDictionary_To_Traditional = Reference< linguistic2::XConversionDictionary >(
+ xDictionaryList->addNewDictionary( aNameTo_Traditional
+ , aLocale, linguistic2::ConversionDictionaryType::SCHINESE_TCHINESE
+ ), UNO_QUERY );
+ }
+ if (xDictionary_To_Traditional.is())
+ xDictionary_To_Traditional->setActive( sal_True );
+
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+ }
+ }
+ }
+
+ //init HeaderBar and set tabs
+ {
+ String aColumn1( OutputDevice::GetNonMnemonicString( m_aFT_Term.GetText() ) );
+ String aColumn2( OutputDevice::GetNonMnemonicString( m_aFT_Mapping.GetText() ) );
+ String aColumn3( OutputDevice::GetNonMnemonicString( m_aFT_Property.GetText() ) );
+
+ long nWidth1 = m_aED_Mapping.GetPosPixel().X() - m_aED_Term.GetPosPixel().X();
+ long nWidth2 = m_aLB_Property.GetPosPixel().X() - m_aED_Mapping.GetPosPixel().X();
+ long nWidth3 = m_aLB_Property.GetSizePixel().Width();
+
+ m_pHeaderBar = m_aCT_DictionaryToSimplified.createHeaderBar( aColumn1, aColumn2, aColumn3, nWidth1, nWidth2, nWidth3 );
+ if(m_pHeaderBar)
+ m_pHeaderBar->SetHelpId( HID_SVX_CHINESE_DICTIONARY_LB_HEADER );
+
+ long pTabs[] = { 3, 0, nWidth1, nWidth1 + nWidth2 };
+ m_aCT_DictionaryToSimplified.SetTabs( &pTabs[0], MAP_PIXEL );
+ m_aCT_DictionaryToTraditional.SetTabs( &pTabs[0], MAP_PIXEL );
+ }
+
+ //init dictionary controls
+ m_aCT_DictionaryToTraditional.SetPosPixel( m_aCT_DictionaryToSimplified.GetPosPixel() );
+ m_aCT_DictionaryToTraditional.SetSizePixel( m_aCT_DictionaryToSimplified.GetSizePixel() );
+
+ m_aCT_DictionaryToSimplified.initDictionaryControl( xDictionary_To_Simplified, &m_aLB_Property );
+ m_aCT_DictionaryToTraditional.initDictionaryControl( xDictionary_To_Traditional, &m_aLB_Property );
+
+ //
+ updateAfterDirectionChange();
+
+ //set hdl
+ if(m_pHeaderBar)
+ m_pHeaderBar->SetSelectHdl( LINK( this, ChineseDictionaryDialog, HeaderBarClick ) );
+
+ m_aED_Term.SetModifyHdl( LINK( this, ChineseDictionaryDialog, EditFieldsHdl ) );
+ m_aED_Mapping.SetModifyHdl( LINK( this, ChineseDictionaryDialog, EditFieldsHdl ) );
+ m_aLB_Property.SetSelectHdl( LINK( this, ChineseDictionaryDialog, EditFieldsHdl ) );
+
+ m_aRB_To_Simplified.SetClickHdl( LINK( this, ChineseDictionaryDialog, DirectionHdl ) );
+ m_aRB_To_Traditional.SetClickHdl( LINK( this, ChineseDictionaryDialog, DirectionHdl ) );
+
+ m_aCT_DictionaryToSimplified.SetSelectHdl( LINK( this, ChineseDictionaryDialog, MappingSelectHdl ));
+ m_aCT_DictionaryToTraditional.SetSelectHdl( LINK( this, ChineseDictionaryDialog, MappingSelectHdl ));
+
+ m_aPB_Add.SetClickHdl( LINK( this, ChineseDictionaryDialog, AddHdl ) );
+ m_aPB_Modify.SetClickHdl( LINK( this, ChineseDictionaryDialog, ModifyHdl ) );
+ m_aPB_Delete.SetClickHdl( LINK( this, ChineseDictionaryDialog, DeleteHdl ) );
+}
+
+ChineseDictionaryDialog::~ChineseDictionaryDialog()
+{
+ m_xContext=0;
+ m_xFactory=0;
+ delete m_pHeaderBar;
+}
+
+void ChineseDictionaryDialog::setDirectionAndTextConversionOptions( bool bDirectionToSimplified, sal_Int32 nTextConversionOptions /*i18n::TextConversionOption*/ )
+{
+ if( bDirectionToSimplified == bool(m_aRB_To_Simplified.IsChecked())
+ && nTextConversionOptions == m_nTextConversionOptions )
+ return;
+
+ m_nTextConversionOptions = nTextConversionOptions;
+
+ if( bDirectionToSimplified )
+ m_aRB_To_Simplified.Check();
+ else
+ m_aRB_To_Traditional.Check();
+ updateAfterDirectionChange();
+}
+
+IMPL_LINK( ChineseDictionaryDialog, DirectionHdl, void*, EMPTYARG )
+{
+ updateAfterDirectionChange();
+ return 0;
+}
+
+void ChineseDictionaryDialog::updateAfterDirectionChange()
+{
+ Reference< linguistic2::XConversionDictionary > xDictionary(0);
+
+ if( m_aRB_To_Simplified.IsChecked() )
+ {
+ m_aCT_DictionaryToSimplified.activate( m_pHeaderBar );
+ m_aCT_DictionaryToTraditional.Hide();
+ xDictionary = m_aCT_DictionaryToSimplified.m_xDictionary;
+ }
+ else
+ {
+ m_aCT_DictionaryToTraditional.activate( m_pHeaderBar );
+ m_aCT_DictionaryToSimplified.Hide();
+ xDictionary = m_aCT_DictionaryToTraditional.m_xDictionary;
+ }
+
+ updateButtons();
+}
+
+IMPL_LINK( ChineseDictionaryDialog, EditFieldsHdl, Control*, EMPTYARG )
+{
+ updateButtons();
+ return 0;
+}
+IMPL_LINK( ChineseDictionaryDialog, MappingSelectHdl, void*, EMPTYARG )
+{
+ DictionaryEntry* pE = getActiveDictionary().getFirstSelectedEntry();
+ if(pE)
+ {
+ m_aED_Term.SetText( pE->m_aTerm );
+ m_aED_Mapping.SetText( pE->m_aMapping );
+ sal_Int16 nPos = pE->m_nConversionPropertyType-1;
+ if( nPos<0 || nPos>=m_aLB_Property.GetEntryCount() )
+ nPos=0;
+ if( m_aLB_Property.GetEntryCount() )
+ m_aLB_Property.SelectEntryPos(nPos);
+ }
+
+ updateButtons();
+ return 0;
+}
+
+bool ChineseDictionaryDialog::isEditFieldsHaveContent() const
+{
+ return m_aED_Term.GetText().Len() && m_aED_Mapping.GetText().Len();
+}
+
+bool ChineseDictionaryDialog::isEditFieldsContentEqualsSelectedListContent() const
+{
+ DictionaryEntry* pE = getActiveDictionary().getFirstSelectedEntry();
+ if( pE )
+ {
+ if( pE->m_aTerm != rtl::OUString( m_aED_Term.GetText() ) )
+ return false;
+ if( pE->m_aMapping != rtl::OUString( m_aED_Mapping.GetText() ) )
+ return false;
+ if( pE->m_nConversionPropertyType != m_aLB_Property.GetSelectEntryPos()+1 )
+ return false;
+ return true;
+ }
+ return false;
+}
+
+const DictionaryList& ChineseDictionaryDialog::getActiveDictionary() const
+{
+ if( m_aRB_To_Traditional.IsChecked() )
+ return m_aCT_DictionaryToTraditional;
+ return m_aCT_DictionaryToSimplified;
+}
+
+DictionaryList& ChineseDictionaryDialog::getActiveDictionary()
+{
+ if( m_aRB_To_Traditional.IsChecked() )
+ return m_aCT_DictionaryToTraditional;
+ return m_aCT_DictionaryToSimplified;
+}
+
+const DictionaryList& ChineseDictionaryDialog::getReverseDictionary() const
+{
+ if( m_aRB_To_Traditional.IsChecked() )
+ return m_aCT_DictionaryToSimplified;
+ return m_aCT_DictionaryToTraditional;
+}
+
+DictionaryList& ChineseDictionaryDialog::getReverseDictionary()
+{
+ if( m_aRB_To_Traditional.IsChecked() )
+ return m_aCT_DictionaryToSimplified;
+ return m_aCT_DictionaryToTraditional;
+}
+
+void ChineseDictionaryDialog::updateButtons()
+{
+ bool bAdd = isEditFieldsHaveContent() && !getActiveDictionary().hasTerm( m_aED_Term.GetText() );
+ m_aPB_Add.Enable( bAdd );
+
+ m_aPB_Delete.Enable( !bAdd && getActiveDictionary().GetSelectedRowCount()>0 );
+
+// DictionaryEntry* pFirstSelectedEntry = getActiveDictionary().getFirstSelectedEntry();
+
+ bool bModify = false;
+ {
+ DictionaryEntry* pFirstSelectedEntry = getActiveDictionary().getFirstSelectedEntry();
+ bModify = !bAdd && getActiveDictionary().GetSelectedRowCount()==1
+ && pFirstSelectedEntry && pFirstSelectedEntry->m_aTerm.equals( m_aED_Term.GetText() );
+ if( bModify && isEditFieldsContentEqualsSelectedListContent() )
+ bModify = false;
+ }
+ m_aPB_Modify.Enable( bModify );
+}
+
+IMPL_LINK( ChineseDictionaryDialog, AddHdl, void*, EMPTYARG )
+{
+ if( !isEditFieldsHaveContent() )
+ return 0;
+
+ sal_Int16 nConversionPropertyType = m_aLB_Property.GetSelectEntryPos()+1;
+
+ getActiveDictionary().addEntry( m_aED_Term.GetText(), m_aED_Mapping.GetText(), nConversionPropertyType );
+
+ if( m_aCB_Reverse.IsChecked() )
+ {
+ getReverseDictionary().deleteEntries( m_aED_Mapping.GetText() );
+ getReverseDictionary().addEntry( m_aED_Mapping.GetText(), m_aED_Term.GetText(), nConversionPropertyType );
+ }
+
+ updateButtons();
+ return 0;
+}
+IMPL_LINK( ChineseDictionaryDialog, ModifyHdl, void*, EMPTYARG )
+{
+ rtl::OUString aTerm( m_aED_Term.GetText() );
+ rtl::OUString aMapping( m_aED_Mapping.GetText() );
+ sal_Int16 nConversionPropertyType = m_aLB_Property.GetSelectEntryPos()+1;
+
+ DictionaryList& rActive = getActiveDictionary();
+ DictionaryList& rReverse = getReverseDictionary();
+
+ DictionaryEntry* pE = rActive.getFirstSelectedEntry();
+ if( pE->m_aTerm != aTerm )
+ return 0;
+
+ if( pE )
+ {
+ if( pE->m_aMapping != aMapping || pE->m_nConversionPropertyType != nConversionPropertyType )
+ {
+ if( m_aCB_Reverse.IsChecked() )
+ {
+ sal_uIntPtr nPos = rReverse.deleteEntries( pE->m_aMapping );
+ nPos = rReverse.deleteEntries( aMapping );
+ rReverse.addEntry( aMapping, aTerm, nConversionPropertyType, nPos );
+ }
+
+ sal_uIntPtr nPos = rActive.deleteEntries( aTerm );
+ rActive.addEntry( aTerm, aMapping, nConversionPropertyType, nPos );
+ }
+ }
+
+ updateButtons();
+ return 0;
+}
+
+IMPL_LINK( ChineseDictionaryDialog, DeleteHdl, void*, EMPTYARG )
+{
+ DictionaryList& rActive = getActiveDictionary();
+ DictionaryList& rReverse = getReverseDictionary();
+
+ if( rActive.GetSelectedRowCount()>0)
+ {
+ DictionaryEntry* pEntry;
+
+ rtl::OUString aMapping;
+ for( sal_Int32 nN=rActive.GetRowCount(); nN--; )
+ {
+ if( rActive.IsRowSelected( nN ) )
+ {
+ pEntry = rActive.getEntryOnPos( nN );
+ if(pEntry)
+ {
+ aMapping = pEntry->m_aMapping;
+ rActive.deleteEntryOnPos( nN );
+ if( m_aCB_Reverse.IsChecked() )
+ rReverse.deleteEntries( aMapping );
+ }
+ break;
+ }
+ }
+ }
+
+ updateButtons();
+ return 0;
+}
+
+short ChineseDictionaryDialog::Execute()
+{
+ sal_Int32 nTextConversionOptions = m_nTextConversionOptions;
+ if(m_nTextConversionOptions | i18n::TextConversionOption::USE_CHARACTER_VARIANTS )
+ nTextConversionOptions = nTextConversionOptions^i18n::TextConversionOption::USE_CHARACTER_VARIANTS ;
+
+ m_aCT_DictionaryToSimplified.refillFromDictionary( nTextConversionOptions );
+ m_aCT_DictionaryToTraditional.refillFromDictionary( m_nTextConversionOptions );
+
+ short nRet = ModalDialog::Execute();
+
+ if( nRet == RET_OK )
+ {
+ //save settings to configuration
+ SvtLinguConfig aLngCfg;
+ Any aAny;
+ aAny <<= sal_Bool( !!m_aCB_Reverse.IsChecked() );
+ aLngCfg.SetProperty( rtl::OUString::createFromAscii( UPN_IS_REVERSE_MAPPING ), aAny );
+
+ m_aCT_DictionaryToSimplified.save();
+ m_aCT_DictionaryToTraditional.save();
+ }
+
+ m_aCT_DictionaryToSimplified.deleteAll();
+ m_aCT_DictionaryToTraditional.deleteAll();
+
+ return nRet;
+}
+
+IMPL_LINK( ChineseDictionaryDialog, HeaderBarClick, void*, EMPTYARG )
+{
+ if(m_pHeaderBar)
+ {
+ sal_uInt16 nId = m_pHeaderBar->GetCurItemId();
+ HeaderBarItemBits nBits = m_pHeaderBar->GetItemBits(nId);
+ if( nBits & HIB_CLICKABLE )
+ {
+ //set new arrow positions in headerbar
+ m_pHeaderBar->SetItemBits( getActiveDictionary().getSortColumn()+1, HEADER_BAR_BITS );
+ if( nBits & HIB_UPARROW )
+ m_pHeaderBar->SetItemBits( nId, HEADER_BAR_BITS | HIB_DOWNARROW );
+ else
+ m_pHeaderBar->SetItemBits( nId, HEADER_BAR_BITS | HIB_UPARROW );
+
+ //sort lists
+ nBits = m_pHeaderBar->GetItemBits(nId);
+ bool bSortAtoZ = nBits & HIB_UPARROW;
+ getActiveDictionary().sortByColumn(nId-1,bSortAtoZ);
+ getReverseDictionary().sortByColumn(nId-1,bSortAtoZ);
+ }
+ }
+ return 0;
+}
+
+//.............................................................................
+} //end namespace
+//.............................................................................
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hrc b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hrc
new file mode 100644
index 000000000000..5c4c8e2bf049
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hrc
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TEXTCONVERSIONDLGS_CHINESE_DICTIONARYDLG_HRC
+#define _TEXTCONVERSIONDLGS_CHINESE_DICTIONARYDLG_HRC
+
+#include "resids.hrc"
+#include "buttongroup.hrc"
+#include "chinese_direction_ids.hrc"
+
+#define ED_TERM 1
+#define ED_MAPPING 2
+
+#define LB_PROPERTY 1
+
+#define CB_REVERSE 1
+
+#define FT_TERM 1
+#define FT_MAPPING 2
+#define FT_PROPERTY 3
+
+#define CT_MAPPINGLIST 1
+
+#define PB_ADD 1
+#define PB_MODIFY 2
+#define PB_DELETE 3
+
+#define FL_BOTTOMLINE 1
+
+#endif
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx
new file mode 100644
index 000000000000..31b77aa32f04
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx
@@ -0,0 +1,201 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _TEXTCONVERSIONDLGS_CHINESE_DICTIONARYDLG_HXX
+#define _TEXTCONVERSIONDLGS_CHINESE_DICTIONARYDLG_HXX
+
+#include <vcl/dialog.hxx>
+// header for class FixedLine
+#include <vcl/fixed.hxx>
+// header for class RadioButton
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+// header for class Edit
+#include <vcl/edit.hxx>
+// header for class ListBox
+#include <vcl/lstbox.hxx>
+// header for class SvHeaderTabListBox
+#include <svtools/svtabbx.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
+#include <com/sun/star/linguistic2/XConversionDictionary.hpp>
+
+#include <vector>
+
+//.............................................................................
+namespace textconversiondlgs
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+struct DictionaryEntry
+{
+ DictionaryEntry( const rtl::OUString& rTerm, const rtl::OUString& rMapping
+ , sal_Int16 nConversionPropertyType //linguistic2::ConversionPropertyType
+ , sal_Bool bNewEntry = sal_False );
+
+ virtual ~DictionaryEntry();
+
+ bool operator==( const DictionaryEntry& rE ) const;
+
+ rtl::OUString m_aTerm;
+ rtl::OUString m_aMapping;
+ sal_Int16 m_nConversionPropertyType; //linguistic2::ConversionPropertyType
+
+ sal_Bool m_bNewEntry;
+};
+
+class DictionaryList : public SvHeaderTabListBox
+{
+public:
+ DictionaryList( Window* pParent, const ResId& );
+ DictionaryList( Window* pParent );
+ virtual ~DictionaryList();
+
+ HeaderBar* createHeaderBar( const String& rColumn1, const String& rColumn2, const String& rColumn3
+ , long nWidth1, long nWidth2, long nWidth3 );
+
+ void initDictionaryControl( const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XConversionDictionary>& xDictionary
+ , ListBox* pPropertyTypeNameListBox );
+ void activate( HeaderBar* pHeaderBar );
+ void deleteAll();
+ void refillFromDictionary( sal_Int32 nTextConversionOptions /*i18n::TextConversionOption*/ );
+ void save();
+
+ DictionaryEntry* getTermEntry( const rtl::OUString& rTerm ) const;
+ bool hasTerm( const rtl::OUString& rTerm ) const;
+
+ void addEntry( const rtl::OUString& rTerm, const rtl::OUString& rMapping
+ , sal_Int16 nConversionPropertyType /*linguistic2::ConversionPropertyType*/, sal_uIntPtr nPos = LIST_APPEND );
+ sal_uIntPtr deleteEntries( const rtl::OUString& rTerm ); //return lowest position of deleted entries or LIST_APPEND if no entry was deleted
+ void deleteEntryOnPos( sal_Int32 nPos );
+ DictionaryEntry* getEntryOnPos( sal_Int32 nPos ) const;
+ DictionaryEntry* getFirstSelectedEntry() const;
+
+ void sortByColumn( sal_uInt16 nSortColumnIndex, bool bSortAtoZ );
+ sal_uInt16 getSortColumn() const;
+
+ virtual void Resize();
+
+private:
+ String getPropertyTypeName( sal_Int16 nConversionPropertyType /*linguistic2::ConversionPropertyType*/ ) const;
+ String makeTabString( const DictionaryEntry& rEntry ) const;
+
+ DECL_LINK( CompareHdl, SvSortData* );
+ StringCompare ColumnCompare( SvLBoxEntry* pLeft, SvLBoxEntry* pRight );
+ SvLBoxItem* getItemAtColumn( SvLBoxEntry* pEntry, sal_uInt16 nColumn ) const;
+
+public:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XConversionDictionary> m_xDictionary;
+
+private:
+ HeaderBar* m_pHeaderBar;
+ ListBox* m_pPropertyTypeNameListBox;
+
+ std::vector< DictionaryEntry* > m_aToBeDeleted;
+
+ sal_uInt16 m_nSortColumnIndex;
+};
+
+class ChineseDictionaryDialog : public ModalDialog
+{
+public:
+ ChineseDictionaryDialog( Window* pParent );
+ virtual ~ChineseDictionaryDialog();
+
+ //this method should be called once before calling execute
+ void setDirectionAndTextConversionOptions( bool bDirectionToSimplified, sal_Int32 nTextConversionOptions /*i18n::TextConversionOption*/ );
+
+ virtual short Execute();
+
+private:
+ DECL_LINK( DirectionHdl, void* );
+ DECL_LINK( EditFieldsHdl, Control* );
+ DECL_LINK( MappingSelectHdl, void* );
+ DECL_LINK( AddHdl, void* );
+ DECL_LINK( ModifyHdl, void* );
+ DECL_LINK( DeleteHdl, void* );
+ DECL_LINK( HeaderBarClick, void* );
+
+ void updateAfterDirectionChange();
+ void updateButtons();
+
+ bool isEditFieldsHaveContent() const;
+ bool isEditFieldsContentEqualsSelectedListContent() const;
+
+ DictionaryList& getActiveDictionary();
+ DictionaryList& getReverseDictionary();
+
+ const DictionaryList& getActiveDictionary() const;
+ const DictionaryList& getReverseDictionary() const;
+
+private:
+ sal_Int32 m_nTextConversionOptions; //i18n::TextConversionOption
+
+ RadioButton m_aRB_To_Simplified;
+ RadioButton m_aRB_To_Traditional;
+
+ CheckBox m_aCB_Reverse;
+
+ FixedText m_aFT_Term;
+ Edit m_aED_Term;
+
+ FixedText m_aFT_Mapping;
+ Edit m_aED_Mapping;
+
+ FixedText m_aFT_Property;
+ ListBox m_aLB_Property;
+
+ HeaderBar* m_pHeaderBar;
+ DictionaryList m_aCT_DictionaryToSimplified;
+ DictionaryList m_aCT_DictionaryToTraditional;
+
+ PushButton m_aPB_Add;
+ PushButton m_aPB_Modify;
+ PushButton m_aPB_Delete;
+
+ FixedLine m_aFL_Bottomline;
+
+ OKButton m_aBP_OK;
+ CancelButton m_aBP_Cancel;
+ HelpButton m_aBP_Help;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > m_xContext;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiComponentFactory> m_xFactory;
+};
+
+//.............................................................................
+} //end namespace
+//.............................................................................
+#endif
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.src b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.src
new file mode 100644
index 000000000000..46c6a7b341d1
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.src
@@ -0,0 +1,192 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "chinese_dictionarydialog.hrc"
+#include "chinese_direction.hrc"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+//-----------------------------------------------------------------------------
+//defines for positions and sizes:
+
+#define FULL_WIDTH (245)
+#define FULL_HEIGHT (165)
+
+#define ROW_1 (RSC_SP_DLG_INNERBORDER_TOP)
+#define ROW_2 (ROW_1+RSC_CD_RADIOBUTTON_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+#define ROW_3 (ROW_2+RSC_CD_RADIOBUTTON_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+#define ROW_4 (ROW_3+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+#define ROW_5 (ROW_4+RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_6 (ROW_5+RSC_CD_TEXTBOX_HEIGHT+RSC_SP_CTRL_DESC_Y)
+
+#define ROW_5a (ROW_5+RSC_CD_PUSHBUTTON_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_5b (ROW_5a+RSC_CD_PUSHBUTTON_HEIGHT+RSC_SP_CTRL_DESC_Y)
+
+#define ROW_8 (FULL_HEIGHT-RSC_SP_DLG_INNERBORDER_BOTTOM-RSC_CD_PUSHBUTTON_HEIGHT)
+#define ROW_7 (ROW_8-RSC_CD_FIXEDLINE_HEIGHT-2)
+
+#define LIST_HEIGHT (ROW_7-RSC_SP_CTRL_Y-ROW_6)
+
+#define COL_WIDTH 60
+#define BUTTONCOL_WIDTH 40
+#define COL_1 (RSC_SP_DLG_INNERBORDER_LEFT+RSC_SP_FLGR_SPACE_X)
+#define COL_2 (COL_1+COL_WIDTH+1)
+#define COL_3 (COL_2+COL_WIDTH+1)
+#define COL_4 (FULL_WIDTH-RSC_SP_DLG_INNERBORDER_RIGHT-BUTTONCOL_WIDTH)
+
+#define REST_COL_WIDTH (COL_4-COL_3-RSC_SP_CTRL_GROUP_X)
+
+//-----------------------------------------------------------------------------
+
+ModalDialog DLG_CHINESEDICTIONARY
+{
+ HelpID = "svx:ModalDialog:DLG_CHINESEDICTIONARY";
+ //HelpId = ;
+ Size = MAP_APPFONT( FULL_WIDTH, FULL_HEIGHT );
+ OutputSize = TRUE;
+ Closeable = TRUE ;
+ Moveable = TRUE ;
+ SVLook = TRUE;
+
+ Text [ en-US ] = "Edit Dictionary";
+
+ DIRECTION_RADIOBUTTONS( COL_1, ROW_1, FULL_WIDTH - COL_1 - RSC_SP_DLG_INNERBORDER_RIGHT )
+
+ CheckBox CB_REVERSE
+ {
+ HelpID = "svx:CheckBox:DLG_CHINESEDICTIONARY:CB_REVERSE";
+ Pos = MAP_APPFONT ( COL_1, ROW_3 ) ;
+ Size = MAP_APPFONT ( FULL_WIDTH - COL_1 - RSC_SP_DLG_INNERBORDER_RIGHT , RSC_CD_CHECKBOX_HEIGHT ) ;
+
+ Text [ en-US ] = "Reverse mapping";
+ };
+
+ FixedText FT_TERM
+ {
+ Pos = MAP_APPFONT ( COL_1 , ROW_4 ) ;
+ Size = MAP_APPFONT ( COL_WIDTH, RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Term";
+ };
+ Edit ED_TERM
+ {
+ HelpID = "svx:Edit:DLG_CHINESEDICTIONARY:ED_TERM";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_1 , ROW_5 ) ;
+ Size = MAP_APPFONT ( COL_WIDTH , RSC_CD_TEXTBOX_HEIGHT ) ;
+ };
+
+
+ FixedText FT_MAPPING
+ {
+ Pos = MAP_APPFONT ( COL_2 , ROW_4 ) ;
+ Size = MAP_APPFONT ( COL_WIDTH, RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Mapping";
+ };
+ Edit ED_MAPPING
+ {
+ HelpID = "svx:Edit:DLG_CHINESEDICTIONARY:ED_MAPPING";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_2 , ROW_5 ) ;
+ Size = MAP_APPFONT ( COL_WIDTH , RSC_CD_TEXTBOX_HEIGHT ) ;
+ };
+
+ FixedText FT_PROPERTY
+ {
+ Pos = MAP_APPFONT ( COL_3 , ROW_4 ) ;
+ Size = MAP_APPFONT ( REST_COL_WIDTH, RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Text [ en-US ] = "Property";
+ };
+ ListBox LB_PROPERTY
+ {
+ HelpID = "svx:ListBox:DLG_CHINESEDICTIONARY:LB_PROPERTY";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( COL_3 , ROW_5 ) ;
+ Size = MAP_APPFONT ( REST_COL_WIDTH , RSC_CD_TEXTBOX_HEIGHT ) ;
+ DropDown = TRUE ;
+
+ stringlist [ en-US ] =
+ {
+ < "Other" ; Default ; > ;
+ < "Foreign" ; > ;
+ < "First name" ; > ;
+ < "Last name" ; > ;
+ < "Title" ; > ;
+ < "Status" ; > ;
+ < "Place name" ; > ;
+ < "Business" ; > ;
+ < "Adjective" ; > ;
+ < "Idiom" ; > ;
+ < "Abbreviation" ; > ;
+ < "Numerical" ; > ;
+ < "Noun" ; > ;
+ < "Verb" ; > ;
+ < "Brand name" ; > ;
+ };
+ };
+
+ Control CT_MAPPINGLIST
+ {
+ Pos = MAP_APPFONT ( COL_1, ROW_6 ) ;
+ Size = MAP_APPFONT ( COL_4 - COL_1 - RSC_SP_CTRL_GROUP_X, LIST_HEIGHT ) ;
+ TabStop = TRUE ;
+ };
+
+ PushButton PB_ADD
+ {
+ HelpID = "svx:PushButton:DLG_CHINESEDICTIONARY:PB_ADD";
+ Pos = MAP_APPFONT( COL_4, ROW_5 );
+ Size = MAP_APPFONT( BUTTONCOL_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT );
+
+ Text [ en-US ] = "~Add";
+ };
+ PushButton PB_MODIFY
+ {
+ HelpID = "svx:PushButton:DLG_CHINESEDICTIONARY:PB_MODIFY";
+ Pos = MAP_APPFONT( COL_4, ROW_5a );
+ Size = MAP_APPFONT( BUTTONCOL_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT );
+
+ Text [ en-US ] = "~Modify";
+ };
+ PushButton PB_DELETE
+ {
+ HelpID = "svx:PushButton:DLG_CHINESEDICTIONARY:PB_DELETE";
+ Pos = MAP_APPFONT( COL_4, ROW_5b );
+ Size = MAP_APPFONT( BUTTONCOL_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT );
+
+ Text [ en-US ] = "~Delete";
+ };
+
+ FixedLine FL_BOTTOMLINE
+ {
+ Pos = MAP_APPFONT ( 0 , ROW_7 ) ;
+ Size = MAP_APPFONT ( FULL_WIDTH, RSC_CD_FIXEDLINE_HEIGHT ) ;
+ };
+
+ BUTTONS_OK_CANCEL_HELP_ABREAST( FULL_WIDTH - RSC_SP_DLG_INNERBORDER_RIGHT, ROW_8 )
+};
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_direction_ids.hrc b/svx/source/unodialogs/textconversiondlgs/chinese_direction_ids.hrc
new file mode 100644
index 000000000000..4545ef26fc5b
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_direction_ids.hrc
@@ -0,0 +1,34 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _TEXTCONVERSIONDLGS_CHINESE_DIRECTION_IDS_HXX
+#define _TEXTCONVERSIONDLGS_CHINESE_DIRECTION_IDS_HXX
+
+#define RB_TO_SIMPLIFIED 1
+#define RB_TO_TRADITIONAL 2
+
+#endif
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_direction_tmpl.hrc b/svx/source/unodialogs/textconversiondlgs/chinese_direction_tmpl.hrc
new file mode 100644
index 000000000000..e2b67ab7df9f
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_direction_tmpl.hrc
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _TEXTCONVERSIONDLGS_CHINESE_DIRECTION_HRC
+#define _TEXTCONVERSIONDLGS_CHINESE_DIRECTION_HRC
+
+#include "chinese_direction_ids.hrc"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+#define DIRECTION_RADIOBUTTONS( D_XPOS, D_YPOS, D_FULLWIDTH ) \
+RadioButton RB_TO_SIMPLIFIED \
+{ \
+ Pos = MAP_APPFONT( D_XPOS, D_YPOS ); \
+ Size = MAP_APPFONT ( D_FULLWIDTH, RSC_CD_RADIOBUTTON_HEIGHT ) ; \
+ Text [ en-US ] = "~Traditional Chinese to simplified Chinese"; \
+}; \
+RadioButton RB_TO_TRADITIONAL \
+{ \
+ Pos = MAP_APPFONT( D_XPOS, D_YPOS + RSC_CD_RADIOBUTTON_HEIGHT+RSC_SP_CTRL_GROUP_Y ); \
+ Size = MAP_APPFONT ( D_FULLWIDTH, RSC_CD_RADIOBUTTON_HEIGHT ) ; \
+ Text [ en-US ] = "~Simplified Chinese to traditional Chinese"; \
+};
+
+#endif
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
new file mode 100644
index 000000000000..68a5b59974fc
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx
@@ -0,0 +1,285 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "chinese_translation_unodialog.hxx"
+#include "chinese_translationdialog.hxx"
+#include <osl/mutex.hxx>
+#include <vos/mutex.hxx>
+// header for class Application
+#include <vcl/svapp.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+// header for define RET_CANCEL
+#include <vcl/msgbox.hxx>
+
+// header for class OImplementationId
+#include <cppuhelper/typeprovider.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+
+//.............................................................................
+namespace textconversiondlgs
+{
+//.............................................................................
+using namespace ::com::sun::star;
+
+#define SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.comp.linguistic2.ChineseTranslationDialog")
+#define SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.linguistic2.ChineseTranslationDialog")
+
+#define C2U(cChar) rtl::OUString::createFromAscii(cChar)
+
+ChineseTranslation_UnoDialog::ChineseTranslation_UnoDialog( const uno::Reference< uno::XComponentContext >& xContext )
+ : m_xCC( xContext )
+ , m_xParentWindow( 0 )
+ , m_pDialog( 0 )
+ , m_bDisposed(sal_False)
+ , m_bInDispose(sal_False)
+ , m_aContainerMutex()
+ , m_aDisposeEventListeners(m_aContainerMutex)
+{
+}
+
+ChineseTranslation_UnoDialog::~ChineseTranslation_UnoDialog()
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ impl_DeleteDialog();
+}
+
+void ChineseTranslation_UnoDialog::impl_DeleteDialog()
+{
+ if( m_pDialog )
+ {
+ if(m_pDialog->IsInExecute())
+ m_pDialog->EndDialog(RET_CANCEL);
+ delete m_pDialog;
+ m_pDialog = 0;
+ }
+}
+//-------------------------------------------------------------------------
+// lang::XServiceInfo
+
+::rtl::OUString SAL_CALL ChineseTranslation_UnoDialog::getImplementationName() throw( uno::RuntimeException )
+{
+ return getImplementationName_Static();
+}
+
+::rtl::OUString ChineseTranslation_UnoDialog::getImplementationName_Static()
+{
+ return SERVICE_IMPLEMENTATION_NAME;
+}
+
+sal_Bool SAL_CALL ChineseTranslation_UnoDialog::supportsService( const ::rtl::OUString& ServiceName ) throw( uno::RuntimeException )
+{
+ uno::Sequence< ::rtl::OUString > aSNL = getSupportedServiceNames();
+ const ::rtl::OUString* pArray = aSNL.getArray();
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ {
+ if( pArray[ i ] == ServiceName )
+ return sal_True;
+ }
+ return sal_False;
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL ChineseTranslation_UnoDialog::getSupportedServiceNames() throw( uno::RuntimeException )
+{
+ return getSupportedServiceNames_Static();
+}
+
+uno::Sequence< rtl::OUString > ChineseTranslation_UnoDialog::getSupportedServiceNames_Static()
+{
+ uno::Sequence< rtl::OUString > aSNS( 1 );
+ aSNS.getArray()[ 0 ] = SERVICE_NAME;
+ return aSNS;
+}
+
+//-------------------------------------------------------------------------
+// ui::dialogs::XExecutableDialog
+
+void SAL_CALL ChineseTranslation_UnoDialog::setTitle( const ::rtl::OUString& ) throw(uno::RuntimeException)
+{
+ //not implemented - fell free to do so, if you do need this
+}
+
+//-------------------------------------------------------------------------
+void SAL_CALL ChineseTranslation_UnoDialog::initialize( const uno::Sequence< uno::Any >& aArguments ) throw(uno::Exception, uno::RuntimeException)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ if( m_bDisposed || m_bInDispose )
+ return;
+
+ const uno::Any* pArguments = aArguments.getConstArray();
+ for(sal_Int32 i=0; i<aArguments.getLength(); ++i, ++pArguments)
+ {
+ beans::PropertyValue aProperty;
+ if(*pArguments >>= aProperty)
+ {
+ if( aProperty.Name.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "ParentWindow" ) ) == 0 )
+ {
+ aProperty.Value >>= m_xParentWindow;
+ }
+ }
+ }
+}
+
+//-------------------------------------------------------------------------
+sal_Int16 SAL_CALL ChineseTranslation_UnoDialog::execute() throw(uno::RuntimeException)
+{
+ sal_Int16 nRet = ui::dialogs::ExecutableDialogResults::CANCEL;
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ if( m_bDisposed || m_bInDispose )
+ return nRet;
+
+ if( !m_pDialog )
+ {
+ Window* pParent = NULL;
+ if( m_xParentWindow.is() )
+ {
+ VCLXWindow* pImplementation = VCLXWindow::GetImplementation(m_xParentWindow);
+ if (pImplementation)
+ pParent = pImplementation->GetWindow();
+ }
+ uno::Reference< XComponent > xComp( this );
+ m_pDialog = new ChineseTranslationDialog( pParent );
+ }
+ if( !m_pDialog )
+ return nRet;
+ nRet = m_pDialog->Execute();
+ if(nRet==RET_OK)
+ nRet=ui::dialogs::ExecutableDialogResults::OK;
+ }
+ return nRet;
+}
+
+//-------------------------------------------------------------------------
+// lang::XComponent
+
+void SAL_CALL ChineseTranslation_UnoDialog::dispose() throw (uno::RuntimeException)
+{
+ lang::EventObject aEvt;
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ if( m_bDisposed || m_bInDispose )
+ return;
+ m_bInDispose = true;
+
+ impl_DeleteDialog();
+ m_xParentWindow = 0;
+ m_bDisposed = true;
+
+ aEvt.Source = static_cast< XComponent * >( this );
+ }
+ if( m_aDisposeEventListeners.getLength() )
+ m_aDisposeEventListeners.disposeAndClear( aEvt );
+}
+
+void SAL_CALL ChineseTranslation_UnoDialog::addEventListener( const uno::Reference< lang::XEventListener > & xListener ) throw (uno::RuntimeException)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ if( m_bDisposed || m_bInDispose )
+ return;
+ m_aDisposeEventListeners.addInterface( xListener );
+}
+
+void SAL_CALL ChineseTranslation_UnoDialog::removeEventListener( const uno::Reference< lang::XEventListener > & xListener ) throw (uno::RuntimeException)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ if( m_bDisposed || m_bInDispose )
+ return;
+ m_aDisposeEventListeners.removeInterface( xListener );
+}
+
+//-------------------------------------------------------------------------
+// XPropertySet
+
+uno::Reference< beans::XPropertySetInfo > SAL_CALL ChineseTranslation_UnoDialog::getPropertySetInfo( ) throw (uno::RuntimeException)
+{
+ return 0;
+}
+void SAL_CALL ChineseTranslation_UnoDialog::setPropertyValue( const ::rtl::OUString&, const uno::Any& ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ //only read only properties
+ throw beans::PropertyVetoException();
+}
+uno::Any SAL_CALL ChineseTranslation_UnoDialog::getPropertyValue( const ::rtl::OUString& rPropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ uno::Any aRet;
+
+ sal_Bool bDirectionToSimplified = sal_True;
+ sal_Bool bUseCharacterVariants = sal_False;
+ sal_Bool bTranslateCommonTerms = sal_False;
+
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex());
+ if( m_bDisposed || m_bInDispose || !m_pDialog )
+ return aRet;
+ m_pDialog->getSettings( bDirectionToSimplified, bUseCharacterVariants, bTranslateCommonTerms );
+ }
+
+ if( rPropertyName.equals( C2U("IsDirectionToSimplified") ) )
+ {
+ aRet <<= bDirectionToSimplified;
+ }
+ else if( rPropertyName.equals( C2U("IsUseCharacterVariants") ) )
+ {
+ aRet <<= bUseCharacterVariants;
+ }
+ else if( rPropertyName.equals( C2U("IsTranslateCommonTerms") ) )
+ {
+ aRet <<= bTranslateCommonTerms;
+ }
+ else
+ {
+ throw beans::UnknownPropertyException();
+ }
+ return aRet;
+
+}
+void SAL_CALL ChineseTranslation_UnoDialog::addPropertyChangeListener( const ::rtl::OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ //only not bound properties -> ignore listener
+}
+void SAL_CALL ChineseTranslation_UnoDialog::removePropertyChangeListener( const ::rtl::OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ //only not bound properties -> ignore listener
+}
+void SAL_CALL ChineseTranslation_UnoDialog::addVetoableChangeListener( const ::rtl::OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ //only not bound properties -> ignore listener
+}
+void SAL_CALL ChineseTranslation_UnoDialog::removeVetoableChangeListener( const ::rtl::OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ //only not bound properties -> ignore listener
+}
+
+//.............................................................................
+} //end namespace
+//.............................................................................
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx
new file mode 100644
index 000000000000..f6811c4e0160
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.hxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _TEXTCONVERSIONDLGS_CHINESE_TRANSLATION_UNODIALOG_HXX
+#define _TEXTCONVERSIONDLGS_CHINESE_TRANSLATION_UNODIALOG_HXX
+
+#include <cppuhelper/component.hxx>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <cppuhelper/implbase5.hxx>
+
+//.............................................................................
+namespace textconversiondlgs
+{
+//.............................................................................
+
+//-------------------------------------------------------------------------
+/** This class provides the chinese translation dialog as an uno component.
+
+It can be created via lang::XMultiComponentFactory::createInstanceWithContext
+with servicename "com.sun.star.linguistic2.ChineseTranslationDialog"
+or implemenation name "com.sun.star.comp.linguistic2.ChineseTranslationDialog"
+
+It can be initialized via the XInitialization interface with the following single parameter:
+PropertyValue-Parameter: Name="ParentWindow" Type="awt::XWindow".
+
+It can be executed via the ui::dialogs::XExecutableDialog interface.
+
+Made settings can be retrieved via beans::XPropertySet interface.
+Following properties are available (read only and not bound):
+1) Name="IsDirectionToSimplified" Type="sal_Bool"
+2) Name="IsUseCharacterVariants" Type="sal_Bool"
+3) Name="IsTranslateCommonTerms" Type="sal_Bool"
+
+The dialog gets this information from the registry on execute and writes it back to the registry if ended with OK.
+*/
+
+class ChineseTranslationDialog;
+
+class ChineseTranslation_UnoDialog : public ::cppu::WeakImplHelper5 <
+ ::com::sun::star::ui::dialogs::XExecutableDialog
+ , ::com::sun::star::lang::XInitialization
+ , ::com::sun::star::beans::XPropertySet
+ , ::com::sun::star::lang::XComponent
+ , ::com::sun::star::lang::XServiceInfo
+ >
+ // ,public ::com::sun::star::uno::XWeak // implemented by WeakImplHelper(optional interface)
+ // ,public ::com::sun::star::uno::XInterface // implemented by WeakImplHelper(optional interface)
+ // ,public ::com::sun::star::lang::XTypeProvider // implemented by WeakImplHelper
+{
+public:
+ ChineseTranslation_UnoDialog( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& xContext );
+ virtual ~ChineseTranslation_UnoDialog();
+
+ // lang::XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
+
+ static ::rtl::OUString getImplementationName_Static();
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static();
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ create( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext) throw(::com::sun::star::uno::Exception)
+ {
+ return (::cppu::OWeakObject *)new ChineseTranslation_UnoDialog( xContext );
+ }
+
+ // lang::XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // ui::dialogs::XExecutableDialog
+ virtual void SAL_CALL setTitle( const ::rtl::OUString& aTitle ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL execute( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // beans::XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // lang::XComponent
+ virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ //no default constructor
+ ChineseTranslation_UnoDialog();
+
+ void impl_DeleteDialog();
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext> m_xCC;
+ com::sun::star::uno::Reference<
+ com::sun::star::awt::XWindow > m_xParentWindow;
+
+ ChineseTranslationDialog* m_pDialog;
+
+ sal_Bool m_bDisposed; ///Dispose call ready.
+ sal_Bool m_bInDispose;///In dispose call
+ osl::Mutex m_aContainerMutex;
+ cppu::OInterfaceContainerHelper m_aDisposeEventListeners;
+};
+
+//.............................................................................
+} //end namespace
+//.............................................................................
+#endif
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx
new file mode 100644
index 000000000000..7888884b6d78
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx
@@ -0,0 +1,201 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "chinese_translationdialog.hxx"
+#include "chinese_translationdialog.hrc"
+#include "resid.hxx"
+#include "chinese_dictionarydialog.hxx"
+#include <com/sun/star/i18n/TextConversionOption.hpp>
+// header for define RET_OK
+#include <vcl/msgbox.hxx>
+// header for class SvtLinguConfigItem
+#include <unotools/lingucfg.hxx>
+#include <unotools/linguprops.hxx>
+#ifndef _SVX_HELPID_HRC
+#include "helpid.hrc"
+#endif
+
+//disable compiler warning C4355: 'this' : used in base member initializer list
+#ifdef _MSC_VER
+# pragma warning (disable : 4355)
+#endif
+
+//.............................................................................
+namespace textconversiondlgs
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+ChineseTranslationDialog::ChineseTranslationDialog( Window* pParent )
+ : ModalDialog( pParent, TextConversionDlgs_ResId( DLG_CHINESETRANSLATION ) )
+ , m_aFL_Direction( this, TextConversionDlgs_ResId( FL_DIRECTION ) )
+ , m_aRB_To_Simplified( this, TextConversionDlgs_ResId( RB_TO_SIMPLIFIED ) )
+ , m_aRB_To_Traditional( this, TextConversionDlgs_ResId( RB_TO_TRADITIONAL ) )
+ , m_aCB_Use_Variants( this, TextConversionDlgs_ResId( CB_USE_VARIANTS ) )
+ , m_aFL_Commonterms( this, TextConversionDlgs_ResId( FL_COMMONTERMS ) )
+ , m_aCB_Translate_Commonterms( this, TextConversionDlgs_ResId( CB_TRANSLATE_COMMONTERMS ) )
+ , m_aPB_Editterms( this, TextConversionDlgs_ResId( PB_EDITTERMS ) )
+ , m_aFL_Bottomline( this, TextConversionDlgs_ResId( T_FL_BOTTOMLINE ) )
+ , m_aBP_OK( this, TextConversionDlgs_ResId( PB_OK ) )
+ , m_aBP_Cancel( this, TextConversionDlgs_ResId( PB_CANCEL ) )
+ , m_aBP_Help( this, TextConversionDlgs_ResId( PB_HELP ) )
+ , m_pDictionaryDialog(0)
+{
+ FreeResource();
+
+ m_aRB_To_Simplified.SetHelpId( HID_SVX_CHINESE_TRANSLATION_RB_CONVERSION_TO_SIMPLIFIED );
+ m_aRB_To_Traditional.SetHelpId( HID_SVX_CHINESE_TRANSLATION_RB_CONVERSION_TO_TRADITIONAL );
+ m_aCB_Use_Variants.SetHelpId( HID_SVX_CHINESE_TRANSLATION_CB_USE_VARIANTS );
+
+ SvtLinguConfig aLngCfg;
+ sal_Bool bValue = sal_Bool();
+ Any aAny( aLngCfg.GetProperty( rtl::OUString::createFromAscii( UPN_IS_DIRECTION_TO_SIMPLIFIED ) ) );
+ aAny >>= bValue;
+ if( bValue )
+ m_aRB_To_Simplified.Check();
+ else
+ m_aRB_To_Traditional.Check();
+
+ aAny = aLngCfg.GetProperty( rtl::OUString::createFromAscii( UPN_IS_USE_CHARACTER_VARIANTS ) );
+ if( aAny >>= bValue )
+ m_aCB_Use_Variants.Check( bValue );
+
+ // #117820# (search for other occurences!)
+ // disable and hide that checkbox until it is decided if it is needed or not.
+ // If it is to be removed later the respective code needs to be removed as
+ // well, otherwise we just have to remove the next lines again.
+ m_aCB_Use_Variants.Check( sal_False );
+ m_aCB_Use_Variants.Enable( sal_False );
+ m_aCB_Use_Variants.Show( sal_False );
+
+ aAny = aLngCfg.GetProperty( rtl::OUString::createFromAscii( UPN_IS_TRANSLATE_COMMON_TERMS ) );
+ if( aAny >>= bValue )
+ m_aCB_Translate_Commonterms.Check( bValue );
+
+ m_aPB_Editterms.SetClickHdl( LINK( this, ChineseTranslationDialog, DictionaryHdl ) );
+ m_aRB_To_Simplified.SetClickHdl( LINK( this, ChineseTranslationDialog, DirectionHdl ) );
+ m_aRB_To_Traditional.SetClickHdl( LINK( this, ChineseTranslationDialog, DirectionHdl ) );
+ m_aCB_Translate_Commonterms.SetClickHdl( LINK( this, ChineseTranslationDialog, CommonTermsHdl ) );
+ m_aBP_OK.SetClickHdl( LINK( this, ChineseTranslationDialog, OkHdl ) );
+
+ impl_UpdateVariantsCheckBox();
+}
+
+ChineseTranslationDialog::~ChineseTranslationDialog()
+{
+ if(m_pDictionaryDialog)
+ {
+ if(m_pDictionaryDialog->IsInExecute())
+ m_pDictionaryDialog->EndDialog();
+ delete m_pDictionaryDialog;
+ }
+}
+
+void ChineseTranslationDialog::getSettings( sal_Bool& rbDirectionToSimplified
+ , sal_Bool& rbUseCharacterVariants
+ , sal_Bool& rbTranslateCommonTerms ) const
+{
+ rbDirectionToSimplified = m_aRB_To_Simplified.IsChecked();
+ rbUseCharacterVariants = m_aCB_Use_Variants.IsChecked();
+ rbTranslateCommonTerms = m_aCB_Translate_Commonterms.IsChecked();
+}
+
+void ChineseTranslationDialog::impl_UpdateVariantsCheckBox()
+{
+// #117820# (search for other occurences!)
+// m_aCB_Use_Variants.Enable( m_aRB_To_Traditional.IsChecked() );
+}
+
+IMPL_LINK( ChineseTranslationDialog, DirectionHdl, void*, EMPTYARG )
+{
+ impl_UpdateVariantsCheckBox();
+ return 0;
+}
+
+IMPL_LINK( ChineseTranslationDialog, CommonTermsHdl, void*, EMPTYARG )
+{
+// #117820# (search for other occurences!)
+// if( m_aCB_Translate_Commonterms.IsChecked() && m_aRB_To_Traditional.IsChecked() )
+// m_aCB_Use_Variants.Check( true );
+ return 0;
+}
+
+IMPL_LINK( ChineseTranslationDialog, OkHdl, void*, EMPTYARG )
+{
+ //save settings to configuration
+ SvtLinguConfig aLngCfg;
+ Any aAny;
+ aAny <<= sal_Bool( !!m_aRB_To_Simplified.IsChecked() );
+ aLngCfg.SetProperty( rtl::OUString::createFromAscii( UPN_IS_DIRECTION_TO_SIMPLIFIED ), aAny );
+ aAny <<= sal_Bool( !!m_aCB_Use_Variants.IsChecked() );
+ aLngCfg.SetProperty( rtl::OUString::createFromAscii( UPN_IS_USE_CHARACTER_VARIANTS ), aAny );
+ aAny <<= sal_Bool( !!m_aCB_Translate_Commonterms.IsChecked() );
+ aLngCfg.SetProperty( rtl::OUString::createFromAscii( UPN_IS_TRANSLATE_COMMON_TERMS ), aAny );
+
+ EndDialog( RET_OK );
+ return 0;
+}
+
+IMPL_LINK( ChineseTranslationDialog, DictionaryHdl, void*, EMPTYARG )
+{
+ if( !m_pDictionaryDialog )
+ {
+ m_pDictionaryDialog = new ChineseDictionaryDialog(this);
+ }
+ if( m_pDictionaryDialog )
+ {
+ if( m_pDictionaryDialog->IsInExecute() )
+ {
+ if( !m_pDictionaryDialog->IsReallyVisible() )
+ {
+ m_pDictionaryDialog->ToTop();
+ m_pDictionaryDialog->GrabFocusToFirstControl();
+ }
+ }
+ else
+ {
+ sal_Int32 nTextConversionOptions = i18n::TextConversionOption::NONE;
+ if( !m_aCB_Translate_Commonterms.IsChecked() )
+ nTextConversionOptions = nTextConversionOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
+ if( m_aCB_Use_Variants.IsChecked() )
+ nTextConversionOptions = nTextConversionOptions | i18n::TextConversionOption::USE_CHARACTER_VARIANTS;
+
+ m_pDictionaryDialog->setDirectionAndTextConversionOptions( m_aRB_To_Simplified.IsChecked(), nTextConversionOptions );
+ m_pDictionaryDialog->Execute();
+ }
+ }
+ return 0;
+}
+
+//.............................................................................
+} //end namespace
+//.............................................................................
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hrc b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hrc
new file mode 100644
index 000000000000..f7607cf087dd
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hrc
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TEXTCONVERSIONDLGS_CHINESE_TRANSLATIONDLG_HRC
+#define _TEXTCONVERSIONDLGS_CHINESE_TRANSLATIONDLG_HRC
+
+#include "resids.hrc"
+#include "buttongroup.hrc"
+#include "chinese_direction_ids.hrc"
+
+#define PB_EDITTERMS 1
+
+#define CB_USE_VARIANTS 1
+#define CB_TRANSLATE_COMMONTERMS 2
+
+#define FL_DIRECTION 1
+#define FL_COMMONTERMS 2
+#define T_FL_BOTTOMLINE 3
+
+#endif
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx
new file mode 100644
index 000000000000..9d046d120e68
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _TEXTCONVERSIONDLGS_CHINESE_TRANSLATIONDLG_HXX
+#define _TEXTCONVERSIONDLGS_CHINESE_TRANSLATIONDLG_HXX
+
+#include <vcl/dialog.hxx>
+// header for class FixedLine
+#include <vcl/fixed.hxx>
+// header for class RadioButton
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+
+//.............................................................................
+namespace textconversiondlgs
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+class ChineseDictionaryDialog;
+
+class ChineseTranslationDialog : public ModalDialog
+{
+public:
+ ChineseTranslationDialog( Window* pParent );
+ virtual ~ChineseTranslationDialog();
+
+ void getSettings( sal_Bool& rbDirectionToSimplified
+ , sal_Bool& rbUseCharacterVariants
+ , sal_Bool& rbTranslateCommonTerms ) const;
+
+private:
+ DECL_LINK( DictionaryHdl, void* );
+ DECL_LINK( DirectionHdl, void* );
+ DECL_LINK( CommonTermsHdl, void* );
+ DECL_LINK( OkHdl, void* );
+ void impl_UpdateVariantsCheckBox();
+
+private:
+ FixedLine m_aFL_Direction;
+
+ RadioButton m_aRB_To_Simplified;
+ RadioButton m_aRB_To_Traditional;
+ CheckBox m_aCB_Use_Variants;
+
+ FixedLine m_aFL_Commonterms;
+
+ CheckBox m_aCB_Translate_Commonterms;
+ PushButton m_aPB_Editterms;
+
+ FixedLine m_aFL_Bottomline;
+
+ OKButton m_aBP_OK;
+ CancelButton m_aBP_Cancel;
+ HelpButton m_aBP_Help;
+
+ ChineseDictionaryDialog* m_pDictionaryDialog;
+};
+
+//.............................................................................
+} //end namespace
+//.............................................................................
+#endif
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src
new file mode 100644
index 000000000000..b99d3e7c745a
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src
@@ -0,0 +1,121 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "chinese_translationdialog.hrc"
+#include "chinese_direction.hrc"
+
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+
+//-----------------------------------------------------------------------------
+//defines for positions and sizes:
+
+#define FULL_WIDTH (220)
+#define FULL_HEIGHT (120)
+#define EDITBUTTON_WIDTH (75)
+
+#define COL_1 (RSC_SP_DLG_INNERBORDER_LEFT)
+#define COL_2 (COL_1+RSC_SP_FLGR_SPACE_X)
+#define COL_3 (COL_2+RSC_SP_CHK_TEXTINDENT)
+#define COL_4 (FULL_WIDTH-RSC_SP_DLG_INNERBORDER_RIGHT-EDITBUTTON_WIDTH)
+
+#define ROW_1 (RSC_SP_DLG_INNERBORDER_TOP)
+#define ROW_2 (ROW_1+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+#define ROW_3 (ROW_2+RSC_CD_RADIOBUTTON_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+#define ROW_4 (ROW_3+RSC_CD_RADIOBUTTON_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_5 (ROW_4+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_CTRL_Y)
+#define ROW_6 (ROW_5+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+
+#define ROW_8 (FULL_HEIGHT-RSC_SP_DLG_INNERBORDER_BOTTOM-RSC_CD_PUSHBUTTON_HEIGHT)
+#define ROW_7 (ROW_8-RSC_CD_FIXEDLINE_HEIGHT-2)
+
+//-----------------------------------------------------------------------------
+
+ModalDialog DLG_CHINESETRANSLATION
+{
+ HelpID = "svx:ModalDialog:DLG_CHINESETRANSLATION";
+ //HelpId = ;
+ Size = MAP_APPFONT( FULL_WIDTH, FULL_HEIGHT );
+ OutputSize = TRUE;
+ Closeable = TRUE ;
+ Moveable = TRUE ;
+ SVLook = TRUE;
+
+ Text [ en-US ] = "Chinese Conversion";
+
+ FixedLine FL_DIRECTION
+ {
+ Pos = MAP_APPFONT ( COL_1 , ROW_1 ) ;
+ Size = MAP_APPFONT ( FULL_WIDTH - COL_1 - RSC_SP_DLG_INNERBORDER_RIGHT, RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Conversion direction";
+ };
+
+ DIRECTION_RADIOBUTTONS( COL_2, ROW_2, (FULL_WIDTH - COL_2 - RSC_SP_DLG_INNERBORDER_RIGHT) )
+
+ CheckBox CB_USE_VARIANTS
+ {
+ HelpID = "svx:CheckBox:DLG_CHINESETRANSLATION:CB_USE_VARIANTS";
+ Pos = MAP_APPFONT( COL_3, ROW_4 );
+ Size = MAP_APPFONT ( FULL_WIDTH - COL_3 - RSC_SP_DLG_INNERBORDER_RIGHT, RSC_CD_CHECKBOX_HEIGHT ) ;
+
+ Text [ en-US ] = "~Use Taiwan, Hong Kong SAR, and Macao SAR character variants";
+ };
+
+ FixedLine FL_COMMONTERMS
+ {
+ Pos = MAP_APPFONT ( COL_1 , ROW_5 ) ;
+ Size = MAP_APPFONT ( FULL_WIDTH - COL_1 - RSC_SP_DLG_INNERBORDER_RIGHT, RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Common terms";
+ };
+
+ CheckBox CB_TRANSLATE_COMMONTERMS
+ {
+ HelpID = "svx:CheckBox:DLG_CHINESETRANSLATION:CB_TRANSLATE_COMMONTERMS";
+ Pos = MAP_APPFONT( COL_2, ROW_6 );
+ Size = MAP_APPFONT ( COL_4 - COL_2, RSC_CD_CHECKBOX_HEIGHT ) ;
+
+ Text [ en-US ] = "Translate ~common terms";
+ };
+
+ PushButton PB_EDITTERMS
+ {
+ HelpID = "svx:PushButton:DLG_CHINESETRANSLATION:PB_EDITTERMS";
+ Pos = MAP_APPFONT( COL_4, ROW_6-(RSC_CD_PUSHBUTTON_HEIGHT-RSC_CD_CHECKBOX_HEIGHT)/2 );
+ Size = MAP_APPFONT( EDITBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+
+ Text [ en-US ] = "~Edit Terms...";
+ };
+
+ FixedLine FL_BOTTOMLINE
+ {
+ Pos = MAP_APPFONT ( 0 , ROW_7 ) ;
+ Size = MAP_APPFONT ( FULL_WIDTH, RSC_CD_FIXEDLINE_HEIGHT ) ;
+ };
+
+ BUTTONS_OK_CANCEL_HELP_ABREAST( FULL_WIDTH - RSC_SP_DLG_INNERBORDER_RIGHT, ROW_8 )
+};
diff --git a/svx/source/unodialogs/textconversiondlgs/resid.cxx b/svx/source/unodialogs/textconversiondlgs/resid.cxx
new file mode 100644
index 000000000000..43a5acc043f6
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/resid.cxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "resid.hxx"
+#include <tools/resmgr.hxx>
+
+//.............................................................................
+namespace textconversiondlgs
+{
+//.............................................................................
+
+static ResMgr* getTextConversionResMgr()
+{
+ static ResMgr* pMgr = NULL;
+ if( ! pMgr )
+ pMgr = ResMgr::CreateResMgr( "textconversiondlgs" );
+ return pMgr;
+}
+TextConversionDlgs_ResId::TextConversionDlgs_ResId(sal_uInt16 nId)
+ : ResId( nId, *getTextConversionResMgr() )
+{
+}
+
+//.............................................................................
+} //end namespace
+//.............................................................................
diff --git a/svx/source/unodialogs/textconversiondlgs/resid.hxx b/svx/source/unodialogs/textconversiondlgs/resid.hxx
new file mode 100644
index 000000000000..d2891870a649
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/resid.hxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TEXTCONVERSIONDLGS_RESID_HXX
+#define _TEXTCONVERSIONDLGS_RESID_HXX
+
+#include <tools/resid.hxx>
+
+//.............................................................................
+namespace textconversiondlgs
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class TextConversionDlgs_ResId : public ResId
+{
+ public:
+ TextConversionDlgs_ResId(sal_uInt16 nId);
+};
+
+//.............................................................................
+} //end namespace
+//.............................................................................
+#endif
diff --git a/svx/source/unodialogs/textconversiondlgs/resids.hrc b/svx/source/unodialogs/textconversiondlgs/resids.hrc
new file mode 100644
index 000000000000..0c2e3965295d
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/resids.hrc
@@ -0,0 +1,33 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TEXTCONVERSIONDLGS_RESID_HRC
+#define _TEXTCONVERSIONDLGS_RESID_HRC
+
+#define DLG_CHINESETRANSLATION 300
+#define DLG_CHINESEDICTIONARY 301
+
+#endif
diff --git a/svx/source/unodialogs/textconversiondlgs/services.cxx b/svx/source/unodialogs/textconversiondlgs/services.cxx
new file mode 100644
index 000000000000..e0e8a8effb7f
--- /dev/null
+++ b/svx/source/unodialogs/textconversiondlgs/services.cxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "chinese_translation_unodialog.hxx"
+#include <cppuhelper/implementationentry.hxx>
+
+static struct ::cppu::ImplementationEntry g_entries_unodialogs_chinesetranslation[] =
+{
+ {
+ ::textconversiondlgs::ChineseTranslation_UnoDialog::create
+ , ::textconversiondlgs::ChineseTranslation_UnoDialog::getImplementationName_Static
+ , ::textconversiondlgs::ChineseTranslation_UnoDialog::getSupportedServiceNames_Static
+ , ::cppu::createSingleComponentFactory
+ , 0
+ , 0
+ }
+ ,{ 0, 0, 0, 0, 0, 0 }
+};
+
+// component exports
+extern "C"
+{
+//==================================================================================================
+SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+//==================================================================================================
+SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
+{
+ return ::cppu::component_getFactoryHelper(
+ pImplName, pServiceManager, pRegistryKey , g_entries_unodialogs_chinesetranslation );
+}
+}
+//=========================================================================
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
new file mode 100644
index 000000000000..eb9a7cb8128f
--- /dev/null
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -0,0 +1,1283 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <vector>
+#include <vos/mutex.hxx>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/document/XMimeTypeInfo.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/graphic/XGraphicRenderer.hpp>
+#include <com/sun/star/task/XStatusIndicator.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <com/sun/star/task/XInteractionContinuation.hpp>
+
+#include <comphelper/interaction.hxx>
+#include <framework/interaction.hxx>
+#include <com/sun/star/drawing/GraphicFilterRequest.hpp>
+#include <com/sun/star/util/URL.hpp>
+#include <cppuhelper/implbase4.hxx>
+#include <osl/diagnose.h>
+#include <osl/mutex.hxx>
+#include <vcl/metaact.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/virdev.hxx>
+#include <svtools/FilterConfigItem.hxx>
+#include <svl/outstrm.hxx>
+#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/sdr/contact/viewcontactofsdrobj.hxx>
+#include <editeng/numitem.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdograf.hxx>
+#include "svx/xoutbmp.hxx"
+#include "svtools/filter.hxx"
+#include "svx/unoapi.hxx"
+#include <svx/svdpage.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/fmview.hxx>
+#include <svx/fmmodel.hxx>
+#include <svx/unopage.hxx>
+#include <svx/pageitem.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/svdoutl.hxx>
+#include <editeng/flditem.hxx>
+
+#include "boost/scoped_ptr.hpp"
+
+#define MAX_EXT_PIX 2048
+
+using namespace ::comphelper;
+using namespace ::osl;
+using namespace ::vos;
+using ::rtl::OUString;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::task;
+#include <svx/sdr/contact/viewobjectcontactredirector.hxx>
+#include <svx/sdr/contact/viewobjectcontact.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+
+// #i102251#
+#include <editeng/editstat.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svx
+{
+ struct ExportSettings
+ {
+ OUString maFilterName;
+ OUString maMediaType;
+ URL maURL;
+ com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > mxOutputStream;
+ com::sun::star::uno::Reference< com::sun::star::graphic::XGraphicRenderer > mxGraphicRenderer;
+ com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > mxStatusIndicator;
+ com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > mxInteractionHandler;
+
+ sal_Int32 mnWidth;
+ sal_Int32 mnHeight;
+ sal_Bool mbExportOnlyBackground;
+ sal_Bool mbVerboseComments;
+ sal_Bool mbScrollText;
+ sal_Bool mbUseHighContrast;
+ sal_Bool mbTranslucent;
+
+ Sequence< PropertyValue > maFilterData;
+
+ Fraction maScaleX;
+ Fraction maScaleY;
+
+ ExportSettings( SdrModel* pDoc );
+ };
+
+ ExportSettings::ExportSettings( SdrModel* pDoc )
+ : mnWidth( 0 )
+ , mnHeight( 0 )
+ , mbExportOnlyBackground( false )
+ , mbVerboseComments( false )
+ , mbScrollText( false )
+ , mbUseHighContrast( false )
+ , mbTranslucent( sal_False )
+ , maScaleX( 1, 1 )
+ , maScaleY( 1, 1 )
+ {
+ if( pDoc )
+ {
+ maScaleX = pDoc->GetScaleFraction();
+ maScaleY = pDoc->GetScaleFraction();
+ }
+ }
+
+ /** implements a component to export shapes or pages to external graphic formats.
+
+ @implements com.sun.star.drawing.GraphicExportFilter
+ */
+ class GraphicExporter : public WeakImplHelper4< XFilter, XExporter, XServiceInfo, XMimeTypeInfo >
+ {
+ public:
+ GraphicExporter();
+ virtual ~GraphicExporter();
+
+ // XFilter
+ virtual sal_Bool SAL_CALL filter( const Sequence< PropertyValue >& aDescriptor ) throw(RuntimeException);
+ virtual void SAL_CALL cancel( ) throw(RuntimeException);
+
+ // XExporter
+ virtual void SAL_CALL setSourceDocument( const Reference< XComponent >& xDoc ) throw(IllegalArgumentException, RuntimeException);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw(RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(RuntimeException);
+
+ // XMimeTypeInfo
+ virtual sal_Bool SAL_CALL supportsMimeType( const ::rtl::OUString& MimeTypeName ) throw (RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedMimeTypeNames( ) throw (RuntimeException);
+
+ VirtualDevice* CreatePageVDev( SdrPage* pPage, sal_uIntPtr nWidthPixel, sal_uIntPtr nHeightPixel ) const;
+
+ DECL_LINK( CalcFieldValueHdl, EditFieldInfo* );
+
+ void ParseSettings( const Sequence< PropertyValue >& aDescriptor, ExportSettings& rSettings );
+ bool GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, sal_Bool bVectorType );
+
+ private:
+ Reference< XShape > mxShape;
+ Reference< XDrawPage > mxPage;
+ Reference< XShapes > mxShapes;
+
+ SvxDrawPage* mpUnoPage;
+
+ Link maOldCalcFieldValueHdl;
+ sal_Int32 mnPageNumber;
+ SdrPage* mpCurrentPage;
+ SdrModel* mpDoc;
+ };
+
+ SVX_DLLPUBLIC Reference< XInterface > SAL_CALL GraphicExporter_createInstance(const Reference< XMultiServiceFactory > & )
+ throw( Exception )
+ {
+ return (XWeak*)new GraphicExporter();
+ }
+
+ SVX_DLLPUBLIC Sequence< OUString > SAL_CALL GraphicExporter_getSupportedServiceNames()
+ throw()
+ {
+ Sequence< OUString > aSupportedServiceNames( 1 );
+ aSupportedServiceNames[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.GraphicExportFilter" ) );
+ return aSupportedServiceNames;
+ }
+
+ SVX_DLLPUBLIC OUString SAL_CALL GraphicExporter_getImplementationName()
+ throw()
+ {
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Draw.GraphicExporter" ) );
+ }
+
+ /** creates a bitmap that is optionaly transparent from a metafile
+ */
+ BitmapEx GetBitmapFromMetaFile( const GDIMetaFile& rMtf, sal_Bool bTransparent, const Size* pSize )
+ {
+ 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.GetBitmap(aParameters));
+
+ aMaskBmp.Convert(BMP_CONVERSION_1BIT_THRESHOLD);
+ aBmpEx = BitmapEx(aGraphic.GetBitmap(aParameters), aMaskBmp);
+ }
+ else
+ {
+ aBmpEx = BitmapEx(aGraphic.GetBitmap(aParameters));
+ }
+
+ aBmpEx.SetPrefMapMode( rMtf.GetPrefMapMode() );
+ aBmpEx.SetPrefSize( rMtf.GetPrefSize() );
+
+ return aBmpEx;
+ }
+
+ Size* CalcSize( sal_Int32 nWidth, sal_Int32 nHeight, const Size& aBoundSize, Size& aOutSize )
+ {
+ if( (nWidth == 0) && (nHeight == 0) )
+ return NULL;
+
+ if( (nWidth == 0) && (nHeight != 0) && (aBoundSize.Height() != 0) )
+ {
+ nWidth = ( nHeight * aBoundSize.Width() ) / aBoundSize.Height();
+ }
+ else if( (nWidth != 0) && (nHeight == 0) && (aBoundSize.Width() != 0) )
+ {
+ nHeight = ( nWidth * aBoundSize.Height() ) / aBoundSize.Width();
+ }
+
+ aOutSize.Width() = nWidth;
+ aOutSize.Height() = nHeight;
+
+ return &aOutSize;
+ }
+}
+
+class ImplExportCheckVisisbilityRedirector : public ::sdr::contact::ViewObjectContactRedirector
+{
+public:
+ ImplExportCheckVisisbilityRedirector( SdrPage* pCurrentPage );
+ virtual ~ImplExportCheckVisisbilityRedirector();
+
+ virtual drawinglayer::primitive2d::Primitive2DSequence createRedirectedPrimitive2DSequence(
+ const sdr::contact::ViewObjectContact& rOriginal,
+ const sdr::contact::DisplayInfo& rDisplayInfo);
+
+private:
+ SdrPage* mpCurrentPage;
+};
+
+ImplExportCheckVisisbilityRedirector::ImplExportCheckVisisbilityRedirector( SdrPage* pCurrentPage )
+: ViewObjectContactRedirector(), mpCurrentPage( pCurrentPage )
+{
+}
+
+ImplExportCheckVisisbilityRedirector::~ImplExportCheckVisisbilityRedirector()
+{
+}
+
+drawinglayer::primitive2d::Primitive2DSequence ImplExportCheckVisisbilityRedirector::createRedirectedPrimitive2DSequence(
+ const sdr::contact::ViewObjectContact& rOriginal,
+ const sdr::contact::DisplayInfo& rDisplayInfo)
+{
+ SdrObject* pObject = rOriginal.GetViewContact().TryToGetSdrObject();
+
+ if(pObject)
+ {
+ SdrPage* pPage = mpCurrentPage;
+ if( pPage == 0 )
+ pPage = pObject->GetPage();
+
+ if( (pPage == 0) || pPage->checkVisibility(rOriginal, rDisplayInfo, false) )
+ {
+ return ::sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo);
+ }
+
+ return drawinglayer::primitive2d::Primitive2DSequence();
+ }
+ else
+ {
+ // not an object, maybe a page
+ return ::sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo);
+ }
+}
+
+using namespace ::svx;
+
+GraphicExporter::GraphicExporter()
+: mpUnoPage( NULL ), mnPageNumber(-1), mpCurrentPage(0), mpDoc( NULL )
+{
+}
+
+GraphicExporter::~GraphicExporter()
+{
+}
+
+IMPL_LINK(GraphicExporter, CalcFieldValueHdl, EditFieldInfo*, pInfo)
+{
+ if( pInfo )
+ {
+ if( mpCurrentPage )
+ {
+ pInfo->SetSdrPage( mpCurrentPage );
+ }
+ else if( mnPageNumber != -1 )
+ {
+ const SvxFieldData* pField = pInfo->GetField().GetField();
+ if( pField && pField->ISA( SvxPageField ) )
+ {
+ String aPageNumValue;
+ sal_Bool bUpper = sal_False;
+
+ switch(mpDoc->GetPageNumType())
+ {
+ case SVX_CHARS_UPPER_LETTER:
+ aPageNumValue += (sal_Unicode)(char)((mnPageNumber - 1) % 26 + 'A');
+ break;
+ case SVX_CHARS_LOWER_LETTER:
+ aPageNumValue += (sal_Unicode)(char)((mnPageNumber - 1) % 26 + 'a');
+ break;
+ case SVX_ROMAN_UPPER:
+ bUpper = sal_True;
+ case SVX_ROMAN_LOWER:
+ aPageNumValue += SvxNumberFormat::CreateRomanString(mnPageNumber, bUpper);
+ break;
+ case SVX_NUMBER_NONE:
+ aPageNumValue.Erase();
+ aPageNumValue += sal_Unicode(' ');
+ break;
+ default:
+ aPageNumValue += String::CreateFromInt32( (sal_Int32)mnPageNumber );
+ }
+
+ pInfo->SetRepresentation( aPageNumValue );
+
+ return(0);
+ }
+ }
+ }
+
+ long nRet = maOldCalcFieldValueHdl.Call( pInfo );
+
+ if( pInfo && mpCurrentPage )
+ pInfo->SetSdrPage( 0 );
+
+ return nRet;
+}
+
+/** creates an virtual device for the given page
+
+ @return the returned VirtualDevice is owned by the caller
+*/
+VirtualDevice* GraphicExporter::CreatePageVDev( SdrPage* pPage, sal_uIntPtr nWidthPixel, sal_uIntPtr nHeightPixel ) const
+{
+ VirtualDevice* pVDev = new VirtualDevice();
+ MapMode aMM( MAP_100TH_MM );
+
+ Point aPoint( 0, 0 );
+ Size aPageSize(pPage->GetSize());
+
+ // use scaling?
+ if( nWidthPixel )
+ {
+ const Fraction aFrac( (long) nWidthPixel, pVDev->LogicToPixel( aPageSize, aMM ).Width() );
+
+ aMM.SetScaleX( aFrac );
+
+ if( nHeightPixel == 0 )
+ aMM.SetScaleY( aFrac );
+ }
+
+ if( nHeightPixel )
+ {
+ const Fraction aFrac( (long) nHeightPixel, pVDev->LogicToPixel( aPageSize, aMM ).Height() );
+
+ if( nWidthPixel == 0 )
+ aMM.SetScaleX( aFrac );
+
+ aMM.SetScaleY( aFrac );
+ }
+
+ pVDev->SetMapMode( aMM );
+#ifdef DBG_UTIL
+ sal_Bool bAbort = !
+#endif
+ pVDev->SetOutputSize(aPageSize);
+ DBG_ASSERT(!bAbort, "virt. Device nicht korrekt erzeugt");
+
+ SdrView* pView = new SdrView(mpDoc, pVDev);
+ pView->SetPageVisible( sal_False );
+ pView->SetBordVisible( sal_False );
+ pView->SetGridVisible( sal_False );
+ pView->SetHlplVisible( sal_False );
+ pView->SetGlueVisible( sal_False );
+ pView->ShowSdrPage(pPage);
+ Region aRegion (Rectangle( aPoint, aPageSize ) );
+
+ ImplExportCheckVisisbilityRedirector aRedirector( mpCurrentPage );
+
+ pView->CompleteRedraw(pVDev, aRegion, &aRedirector);
+
+ delete pView;
+ return pVDev;
+}
+
+void GraphicExporter::ParseSettings( const Sequence< PropertyValue >& aDescriptor, ExportSettings& rSettings )
+{
+ sal_Int32 nArgs = aDescriptor.getLength();
+ const PropertyValue* pValues = aDescriptor.getConstArray();
+ while( nArgs-- )
+ {
+ if( pValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FilterName" ) ) )
+ {
+ pValues->Value >>= rSettings.maFilterName;
+ }
+ else if( pValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MediaType" ) ) )
+ {
+ pValues->Value >>= rSettings.maMediaType;
+ }
+ else if( pValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "URL" ) ) )
+ {
+ if( !( pValues->Value >>= rSettings.maURL ) )
+ {
+ pValues->Value >>= rSettings.maURL.Complete;
+ }
+ }
+ else if( pValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "OutputStream" ) ) )
+ {
+ pValues->Value >>= rSettings.mxOutputStream;
+ }
+ else if( pValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "GraphicRenderer" ) ) )
+ {
+ pValues->Value >>= rSettings.mxGraphicRenderer;
+ }
+ else if ( pValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StatusIndicator" ) ) )
+ {
+ pValues->Value >>= rSettings.mxStatusIndicator;
+ }
+ else if ( pValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "InteractionHandler" ) ) )
+ {
+ pValues->Value >>= rSettings.mxInteractionHandler;
+ }
+ else if( pValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Width" ) ) ) // for compatibility reasons, deprecated
+ {
+ pValues->Value >>= rSettings.mnWidth;
+ }
+ else if( pValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Height" ) ) ) // for compatibility reasons, deprecated
+ {
+ pValues->Value >>= rSettings.mnHeight;
+ }
+ else if( pValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ExportOnlyBackground" ) ) ) // for compatibility reasons, deprecated
+ {
+ pValues->Value >>= rSettings.mbExportOnlyBackground;
+ }
+ else if ( pValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FilterData" ) ) )
+ {
+ pValues->Value >>= rSettings.maFilterData;
+
+ sal_Int32 nFilterArgs = rSettings.maFilterData.getLength();
+ PropertyValue* pDataValues = rSettings.maFilterData.getArray();
+ while( nFilterArgs-- )
+ {
+ if( pDataValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Translucent" ) ) )
+ {
+ if ( !( pDataValues->Value >>= rSettings.mbTranslucent ) ) // SJ: TODO: The GIF Transparency is stored as int32 in
+ { // configuration files, this has to be changed to boolean
+ sal_Int32 nTranslucent = 0;
+ if ( pDataValues->Value >>= nTranslucent )
+ rSettings.mbTranslucent = nTranslucent != 0;
+ }
+ }
+ else if( pDataValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PixelWidth" ) ) )
+ {
+ pDataValues->Value >>= rSettings.mnWidth;
+ }
+ else if( pDataValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PixelHeight" ) ) )
+ {
+ pDataValues->Value >>= rSettings.mnHeight;
+ }
+ else if( pDataValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Width" ) ) ) // for compatibility reasons, deprecated
+ {
+ pDataValues->Value >>= rSettings.mnWidth;
+ pDataValues->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PixelWidth" ) );
+ }
+ else if( pDataValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Height" ) ) ) // for compatibility reasons, deprecated
+ {
+ pDataValues->Value >>= rSettings.mnHeight;
+ pDataValues->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PixelHeight" ) );
+ }
+ else if( pDataValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ExportOnlyBackground" ) ) )
+ {
+ pDataValues->Value >>= rSettings.mbExportOnlyBackground;
+ }
+ else if( pDataValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "HighContrast" ) ) )
+ {
+ pDataValues->Value >>= rSettings.mbUseHighContrast;
+ }
+ else if( pDataValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PageNumber" ) ) )
+ {
+ pDataValues->Value >>= mnPageNumber;
+ }
+ else if( pDataValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "VerboseComments" ) ) )
+ {
+ // #110496# Read flag for verbose metafile comments
+ pDataValues->Value >>= rSettings.mbVerboseComments;
+ }
+ else if( pDataValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ScrollText" ) ) )
+ {
+ // #110496# Read flag solitary scroll text metafile
+ pDataValues->Value >>= rSettings.mbScrollText;
+ }
+ else if( pDataValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CurrentPage" ) ) )
+ {
+ Reference< XDrawPage > xPage;
+ pDataValues->Value >>= xPage;
+ if( xPage.is() )
+ {
+ SvxDrawPage* pUnoPage = SvxDrawPage::getImplementation( xPage );
+ if( pUnoPage && pUnoPage->GetSdrPage() )
+ mpCurrentPage = pUnoPage->GetSdrPage();
+ }
+ }
+ else if( pDataValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ScaleXNumerator" ) ) )
+ {
+ sal_Int32 nVal = 1;
+ if( pDataValues->Value >>= nVal )
+ rSettings.maScaleX = Fraction( nVal, rSettings.maScaleX.GetDenominator() );
+ }
+ else if( pDataValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ScaleXDenominator" ) ) )
+ {
+ sal_Int32 nVal = 1;
+ if( pDataValues->Value >>= nVal )
+ rSettings.maScaleX = Fraction( rSettings.maScaleX.GetNumerator(), nVal );
+ }
+ else if( pDataValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ScaleYNumerator" ) ) )
+ {
+ sal_Int32 nVal = 1;
+ if( pDataValues->Value >>= nVal )
+ rSettings.maScaleY = Fraction( nVal, rSettings.maScaleY.GetDenominator() );
+ }
+ else if( pDataValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ScaleYDenominator" ) ) )
+ {
+ sal_Int32 nVal = 1;
+ if( pDataValues->Value >>= nVal )
+ rSettings.maScaleY = Fraction( rSettings.maScaleY.GetNumerator(), nVal );
+ }
+
+ pDataValues++;
+ }
+ }
+
+ pValues++;
+ }
+
+ // putting the StatusIndicator that we got from the MediaDescriptor into our local FilterData copy
+ if ( rSettings.mxStatusIndicator.is() )
+ {
+ rtl::OUString sStatusIndicator( RTL_CONSTASCII_USTRINGPARAM( "StatusIndicator" ) );
+ int i = rSettings.maFilterData.getLength();
+ rSettings.maFilterData.realloc( i + 1 );
+ rSettings.maFilterData[ i ].Name = sStatusIndicator;
+ rSettings.maFilterData[ i ].Value <<= rSettings.mxStatusIndicator;
+ }
+}
+
+bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, sal_Bool bVectorType )
+{
+ if( !mpDoc || !mpUnoPage )
+ return false;
+
+ SdrPage* pPage = mpUnoPage->GetSdrPage();
+ if( !pPage )
+ return false;
+
+ VirtualDevice aVDev;
+ const MapMode aMap( mpDoc->GetScaleUnit(), Point(), rSettings.maScaleX, rSettings.maScaleY );
+
+ SdrOutliner& rOutl=mpDoc->GetDrawOutliner(NULL);
+ maOldCalcFieldValueHdl = rOutl.GetCalcFieldValueHdl();
+ rOutl.SetCalcFieldValueHdl( LINK(this, GraphicExporter, CalcFieldValueHdl) );
+ rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor() );
+
+ // #i102251#
+ const sal_uInt32 nOldCntrl(rOutl.GetControlWord());
+ sal_uInt32 nCntrl = nOldCntrl & ~EE_CNTRL_ONLINESPELLING;
+ rOutl.SetControlWord(nCntrl);
+
+ SdrObject* pTempBackgroundShape = 0;
+ std::vector< SdrObject* > aShapes;
+ bool bRet = true;
+
+ // export complete page?
+ if ( !mxShape.is() )
+ {
+ if( rSettings.mbExportOnlyBackground )
+ {
+ const SdrPageProperties* pCorrectProperties = pPage->getCorrectSdrPageProperties();
+
+ if(pCorrectProperties)
+ {
+ pTempBackgroundShape = new SdrRectObj(Rectangle(Point(0,0), pPage->GetSize()));
+ pTempBackgroundShape->SetMergedItemSet(pCorrectProperties->GetItemSet());
+ pTempBackgroundShape->SetMergedItem(XLineStyleItem(XLINE_NONE));
+ pTempBackgroundShape->NbcSetStyleSheet(pCorrectProperties->GetStyleSheet(), true);
+ aShapes.push_back(pTempBackgroundShape);
+ }
+ }
+ else
+ {
+ const Size aSize( pPage->GetSize() );
+
+ // generate a bitmap to convert it to a pixel format.
+ // For gif pictures there can also be a vector format used (bTranslucent)
+ if ( !bVectorType && !rSettings.mbTranslucent )
+ {
+ long nWidthPix = 0;
+ long nHeightPix = 0;
+ if ( rSettings.mnWidth > 0 && rSettings.mnHeight > 0 )
+ {
+ nWidthPix = rSettings.mnWidth;
+ nHeightPix = rSettings.mnHeight;
+ }
+ else
+ {
+ const Size aSizePix( Application::GetDefaultDevice()->LogicToPixel( aSize, aMap ) );
+ if (aSizePix.Width() > MAX_EXT_PIX || aSizePix.Height() > MAX_EXT_PIX)
+ {
+ if (aSizePix.Width() > MAX_EXT_PIX)
+ nWidthPix = MAX_EXT_PIX;
+ else
+ nWidthPix = aSizePix.Width();
+ if (aSizePix.Height() > MAX_EXT_PIX)
+ nHeightPix = MAX_EXT_PIX;
+ else
+ nHeightPix = aSizePix.Height();
+
+ double fWidthDif = aSizePix.Width() / nWidthPix;
+ double fHeightDif = aSizePix.Height() / nHeightPix;
+
+ if (fWidthDif > fHeightDif)
+ nHeightPix = static_cast<long>(aSizePix.Height() / fWidthDif);
+ else
+ nWidthPix = static_cast<long>(aSizePix.Width() / fHeightDif);
+ }
+ else
+ {
+ nWidthPix = aSizePix.Width();
+ nHeightPix = aSizePix.Height();
+ }
+ }
+
+ boost::scoped_ptr< SdrView > pLocalView;
+ if( PTR_CAST( FmFormModel, mpDoc ) )
+ {
+ pLocalView.reset( new FmFormView( PTR_CAST( FmFormModel, mpDoc ), &aVDev ) );
+ }
+ else
+ {
+ pLocalView.reset( new SdrView( mpDoc, &aVDev ) );
+ }
+
+
+ VirtualDevice* pVDev = CreatePageVDev( pPage, nWidthPix, nHeightPix );
+
+ if( pVDev )
+ {
+ aGraphic = pVDev->GetBitmap( Point(), pVDev->GetOutputSize() );
+ aGraphic.SetPrefMapMode( aMap );
+ aGraphic.SetPrefSize( aSize );
+ delete pVDev;
+ }
+ }
+ // create a metafile to export a vector format
+ else
+ {
+ GDIMetaFile aMtf;
+
+ aVDev.SetMapMode( aMap );
+ if( rSettings.mbUseHighContrast )
+ aVDev.SetDrawMode( aVDev.GetDrawMode() | DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT );
+ aVDev.EnableOutput( sal_False );
+ aMtf.Record( &aVDev );
+ Size aNewSize;
+
+ // create a view
+ SdrView* pView;
+
+ if( PTR_CAST( FmFormModel, mpDoc ) )
+ {
+ pView = new FmFormView( PTR_CAST( FmFormModel, mpDoc ), &aVDev );
+ }
+ else
+ {
+ pView = new SdrView( mpDoc, &aVDev );
+ }
+
+ pView->SetBordVisible( sal_False );
+ pView->SetPageVisible( sal_False );
+ pView->ShowSdrPage( pPage );
+
+ if ( pView && pPage )
+ {
+ pView->SetBordVisible( sal_False );
+ pView->SetPageVisible( sal_False );
+ pView->ShowSdrPage( pPage );
+
+ const Point aNewOrg( pPage->GetLftBorder(), pPage->GetUppBorder() );
+ aNewSize = Size( aSize.Width() - pPage->GetLftBorder() - pPage->GetRgtBorder(),
+ aSize.Height() - pPage->GetUppBorder() - pPage->GetLwrBorder() );
+ const Rectangle aClipRect( aNewOrg, aNewSize );
+ MapMode aVMap( aMap );
+
+ aVDev.Push();
+ aVMap.SetOrigin( Point( -aNewOrg.X(), -aNewOrg.Y() ) );
+ aVDev.SetRelativeMapMode( aVMap );
+ aVDev.IntersectClipRegion( aClipRect );
+
+ // Use new StandardCheckVisisbilityRedirector
+ ImplExportCheckVisisbilityRedirector aRedirector( mpCurrentPage );
+
+ pView->CompleteRedraw(&aVDev, Region(Rectangle(Point(), aNewSize)), &aRedirector);
+
+ aVDev.Pop();
+
+ aMtf.Stop();
+ aMtf.WindStart();
+ aMtf.SetPrefMapMode( aMap );
+ aMtf.SetPrefSize( aNewSize );
+
+ // AW: Here the current version was filtering out the META_CLIPREGION_ACTIONs
+ // from the metafile. I asked some other developers why this was done, but no
+ // one knew a direct reason. Since it's in for long time, it may be an old
+ // piece of code. MetaFiles save and load ClipRegions with polygons with preserving
+ // the polygons, so a resolution-indepent roundtrip is supported. Removed this
+ // code since it destroys some MetaFiles where ClipRegions are used. Anyways,
+ // just filtering them out is a hack, at least the encapsulated content would need
+ // to be clipped geometrically.
+ aGraphic = Graphic(aMtf);
+ }
+
+ if ( pView )
+ {
+ pView->HideSdrPage();
+ delete pView;
+ }
+
+ if( rSettings.mbTranslucent )
+ {
+ Size aOutSize;
+ aGraphic = GetBitmapFromMetaFile( aGraphic.GetGDIMetaFile(), sal_True, CalcSize( rSettings.mnWidth, rSettings.mnHeight, aNewSize, aOutSize ) );
+ }
+ }
+ }
+ }
+
+ // export only single shape or shape collection
+ else
+ {
+ // build list of SdrObject
+ if( mxShapes.is() )
+ {
+ Reference< XShape > xShape;
+ const sal_Int32 nCount = mxShapes->getCount();
+
+ for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ mxShapes->getByIndex( nIndex ) >>= xShape;
+ SdrObject* pObj = GetSdrObjectFromXShape( xShape );
+ if( pObj )
+ aShapes.push_back( pObj );
+ }
+ }
+ else
+ {
+ // only one shape
+ SdrObject* pObj = GetSdrObjectFromXShape( mxShape );
+ if( pObj )
+ aShapes.push_back( pObj );
+ }
+
+ if( 0 == aShapes.size() )
+ bRet = false;
+ }
+
+ if( bRet && aShapes.size() )
+ {
+ // special treatment for only one SdrGrafObj that has text
+ sal_Bool bSingleGraphic = sal_False;
+
+ if( 1 == aShapes.size() )
+ {
+ if( !bVectorType )
+ {
+ SdrObject* pObj = aShapes.front();
+ if( pObj && pObj->ISA( SdrGrafObj ) && !( (SdrGrafObj*) pObj )->HasText() )
+ {
+ aGraphic = ( (SdrGrafObj*) pObj )->GetTransformedGraphic();
+ if ( aGraphic.GetType() == GRAPHIC_BITMAP )
+ {
+ Size aSizePixel( aGraphic.GetSizePixel() );
+ if( rSettings.mnWidth && rSettings.mnHeight &&
+ ( ( rSettings.mnWidth != aSizePixel.Width() ) ||
+ ( rSettings.mnHeight != aSizePixel.Height() ) ) )
+ {
+ BitmapEx aBmpEx( aGraphic.GetBitmapEx() );
+ aBmpEx.Scale( Size( rSettings.mnWidth, rSettings.mnHeight ) );
+ aGraphic = aBmpEx;
+ }
+ }
+ bSingleGraphic = sal_True;
+ }
+ }
+ else if( rSettings.mbScrollText )
+ {
+ SdrObject* pObj = aShapes.front();
+ if( pObj && pObj->ISA( SdrTextObj )
+ && ( (SdrTextObj*) pObj )->HasText() )
+ {
+ Rectangle aScrollRectangle;
+ Rectangle aPaintRectangle;
+
+ const boost::scoped_ptr< GDIMetaFile > pMtf(
+ ( (SdrTextObj*) pObj )->GetTextScrollMetaFileAndRectangle(
+ aScrollRectangle, aPaintRectangle ) );
+
+ // take the larger one of the two rectangles (that
+ // should be the bound rect of the retrieved
+ // metafile)
+ Rectangle aTextRect;
+
+ if( aScrollRectangle.IsInside( aPaintRectangle ) )
+ aTextRect = aScrollRectangle;
+ else
+ aTextRect = aPaintRectangle;
+
+ // setup pref size and mapmode
+ pMtf->SetPrefSize( aTextRect.GetSize() );
+
+ // set actual origin (mtf is at actual shape
+ // output position)
+ MapMode aLocalMapMode( aMap );
+ aLocalMapMode.SetOrigin(
+ Point( -aPaintRectangle.Left(),
+ -aPaintRectangle.Top() ) );
+ pMtf->SetPrefMapMode( aLocalMapMode );
+
+ pMtf->AddAction( new MetaCommentAction(
+ "XTEXT_SCROLLRECT", 0,
+ reinterpret_cast<sal_uInt8 const*>(&aScrollRectangle),
+ sizeof( Rectangle ) ) );
+ pMtf->AddAction( new MetaCommentAction(
+ "XTEXT_PAINTRECT", 0,
+ reinterpret_cast<sal_uInt8 const*>(&aPaintRectangle),
+ sizeof( Rectangle ) ) );
+
+ aGraphic = Graphic( *pMtf );
+
+ bSingleGraphic = sal_True;
+ }
+ }
+ }
+
+ if( !bSingleGraphic )
+ {
+ // create a metafile for all shapes
+ VirtualDevice aOut;
+
+ // calculate bound rect for all shapes
+ Rectangle aBound;
+
+ {
+ std::vector< SdrObject* >::iterator aIter = aShapes.begin();
+ const std::vector< SdrObject* >::iterator aEnd = aShapes.end();
+
+ while( aIter != aEnd )
+ {
+ SdrObject* pObj = (*aIter++);
+ Rectangle aR1(pObj->GetCurrentBoundRect());
+ if (aBound.IsEmpty())
+ aBound=aR1;
+ else
+ aBound.Union(aR1);
+ }
+ }
+
+ aOut.EnableOutput( sal_False );
+ aOut.SetMapMode( aMap );
+ if( rSettings.mbUseHighContrast )
+ aOut.SetDrawMode( aVDev.GetDrawMode() | DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT );
+
+ GDIMetaFile aMtf;
+ aMtf.Clear();
+ aMtf.Record( &aOut );
+
+ MapMode aOutMap( aMap );
+ aOutMap.SetOrigin( Point( -aBound.TopLeft().X(), -aBound.TopLeft().Y() ) );
+ aOut.SetRelativeMapMode( aOutMap );
+
+ sdr::contact::DisplayInfo aDisplayInfo;
+
+ if(mpCurrentPage)
+ {
+ if(mpCurrentPage->TRG_HasMasterPage() && pPage->IsMasterPage())
+ {
+ // MasterPage is processed as another page's SubContent
+ aDisplayInfo.SetProcessLayers(mpCurrentPage->TRG_GetMasterPageVisibleLayers());
+ aDisplayInfo.SetSubContentActive(true);
+ }
+ }
+
+ if(aShapes.size())
+ {
+ // more effective way to paint a vector of SdrObjects. Hand over the processed page
+ // to have it in the
+ sdr::contact::ObjectContactOfObjListPainter aMultiObjectPainter(aOut, aShapes, mpCurrentPage);
+ ImplExportCheckVisisbilityRedirector aCheckVisibilityRedirector(mpCurrentPage);
+ aMultiObjectPainter.SetViewObjectContactRedirector(&aCheckVisibilityRedirector);
+
+ aMultiObjectPainter.ProcessDisplay(aDisplayInfo);
+ }
+
+ aMtf.Stop();
+ aMtf.WindStart();
+
+ const Size aExtSize( aOut.PixelToLogic( Size( 0, 0 ) ) );
+ Size aBoundSize( aBound.GetWidth() + ( aExtSize.Width() ),
+ aBound.GetHeight() + ( aExtSize.Height() ) );
+
+ aMtf.SetPrefMapMode( aMap );
+ aMtf.SetPrefSize( aBoundSize );
+
+ if( !bVectorType )
+ {
+ Size aOutSize;
+ aGraphic = GetBitmapFromMetaFile( aMtf, rSettings.mbTranslucent, CalcSize( rSettings.mnWidth, rSettings.mnHeight, aBoundSize, aOutSize ) );
+ }
+ else
+ {
+ aGraphic = aMtf;
+ }
+ }
+ }
+
+ if(pTempBackgroundShape)
+ {
+ SdrObject::Free(pTempBackgroundShape);
+ }
+
+ rOutl.SetCalcFieldValueHdl( maOldCalcFieldValueHdl );
+
+ // #i102251#
+ rOutl.SetControlWord(nOldCntrl);
+
+ return bRet;
+
+}
+
+// XFilter
+sal_Bool SAL_CALL GraphicExporter::filter( const Sequence< PropertyValue >& aDescriptor )
+ throw(RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpUnoPage )
+ return sal_False;
+
+ GraphicFilter* pFilter = GraphicFilter::GetGraphicFilter();
+
+ if( NULL == pFilter || NULL == mpUnoPage->GetSdrPage() || NULL == mpDoc )
+ return sal_False;
+
+ // get the arguments from the descriptor
+ ExportSettings aSettings( mpDoc );
+ ParseSettings( aDescriptor, aSettings );
+
+ const sal_uInt16 nFilter = aSettings.maMediaType.getLength()
+ ? pFilter->GetExportFormatNumberForMediaType( aSettings.maMediaType )
+ : pFilter->GetExportFormatNumberForShortName( aSettings.maFilterName );
+ sal_Bool bVectorType = !pFilter->IsExportPixelFormat( nFilter );
+
+ // create the output stuff
+ Graphic aGraphic;
+
+ sal_uInt16 nStatus = GetGraphic( aSettings, aGraphic, bVectorType ) ? GRFILTER_OK : GRFILTER_FILTERERROR;
+
+ if( nStatus == GRFILTER_OK )
+ {
+ // export graphic only if it has a size
+ const Size aGraphSize( aGraphic.GetPrefSize() );
+ if ( ( aGraphSize.Width() == 0 ) || ( aGraphSize.Height() == 0 ) )
+ {
+ nStatus = GRFILTER_FILTERERROR;
+ }
+ else
+ {
+ // now we have a graphic, so export it
+ if( aSettings.mxGraphicRenderer.is() )
+ {
+ // render graphic directly into given renderer
+ aSettings.mxGraphicRenderer->render( aGraphic.GetXGraphic() );
+ }
+ else if( aSettings.mxOutputStream.is() )
+ {
+ // TODO: Either utilize optional XSeekable functionality for the
+ // SvOutputStream, or adapt the graphic filter to not seek anymore.
+ SvMemoryStream aStream( 1024, 1024 );
+
+ nStatus = pFilter->ExportGraphic( aGraphic, String(), aStream, nFilter, &aSettings.maFilterData );
+
+ // copy temp stream to XOutputStream
+ SvOutputStream aOutputStream( aSettings.mxOutputStream );
+ aStream.Seek(0);
+ aOutputStream << aStream;
+ }
+ else
+ {
+ INetURLObject aURLObject( aSettings.maURL.Complete );
+ DBG_ASSERT( aURLObject.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+
+ nStatus = XOutBitmap::ExportGraphic( aGraphic, aURLObject, *pFilter, nFilter, &aSettings.maFilterData );
+ }
+ }
+ }
+
+ if ( aSettings.mxInteractionHandler.is() && ( nStatus != GRFILTER_OK ) )
+ {
+ Any aInteraction;
+ Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > lContinuations(1);
+ ::comphelper::OInteractionApprove* pApprove = new ::comphelper::OInteractionApprove();
+ lContinuations[0] = Reference< XInteractionContinuation >(static_cast< XInteractionContinuation* >(pApprove), UNO_QUERY);
+
+ GraphicFilterRequest aErrorCode;
+ aErrorCode.ErrCode = nStatus;
+ aInteraction <<= aErrorCode;
+ aSettings.mxInteractionHandler->handle( framework::InteractionRequest::CreateRequest( aInteraction, lContinuations ) );
+ }
+ return nStatus == GRFILTER_OK;
+}
+
+void SAL_CALL GraphicExporter::cancel()
+ throw(RuntimeException)
+{
+}
+
+// XExporter
+
+/** the source 'document' could be a XDrawPage, a XShape or a generic XShapes */
+void SAL_CALL GraphicExporter::setSourceDocument( const Reference< lang::XComponent >& xComponent )
+ throw(IllegalArgumentException, RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ mxShapes = NULL;
+ mpUnoPage = NULL;
+
+ try
+ {
+ // any break inside this one loop while will throw a IllegalArgumentException
+ do
+ {
+ mxPage = Reference< XDrawPage >::query( xComponent );
+ mxShapes = Reference< XShapes >::query( xComponent );
+ mxShape = Reference< XShape >::query( xComponent );
+
+ // Step 1: try a generic XShapes
+ if( !mxPage.is() && !mxShape.is() && mxShapes.is() )
+ {
+ // we do not support empty shape collections
+ if( 0 == mxShapes->getCount() )
+ break;
+
+ // get first shape to detect corresponding page and model
+ mxShapes->getByIndex(0) >>= mxShape;
+ }
+ else
+ {
+ mxShapes = NULL;
+ }
+
+ // Step 2: try a shape
+ if( mxShape.is() )
+ {
+ if( NULL == GetSdrObjectFromXShape( mxShape ) )
+ break;
+
+ // get page for this shape
+ Reference< XChild > xChild( mxShape, UNO_QUERY );
+ if( !xChild.is() )
+ break;
+
+ Reference< XInterface > xInt;
+ do
+ {
+ xInt = xChild->getParent();
+ mxPage = Reference< XDrawPage >::query( xInt );
+ if( !mxPage.is() )
+ xChild = Reference< XChild >::query( xInt );
+ }
+ while( !mxPage.is() && xChild.is() );
+
+ if( !mxPage.is() )
+ break;
+ }
+
+ // Step 3: check the page
+ if( !mxPage.is() )
+ break;
+
+ mpUnoPage = SvxDrawPage::getImplementation( mxPage );
+
+ if( NULL == mpUnoPage || NULL == mpUnoPage->GetSdrPage() )
+ break;
+
+ mpDoc = mpUnoPage->GetSdrPage()->GetModel();
+
+ // Step 4: If we got a generic XShapes test all contained shapes
+ // if they belong to the same XDrawPage
+
+ if( mxShapes.is() )
+ {
+ SdrPage* pPage = mpUnoPage->GetSdrPage();
+ SdrObject* pObj;
+ Reference< XShape > xShape;
+
+ sal_Bool bOk = sal_True;
+
+ const sal_Int32 nCount = mxShapes->getCount();
+
+ // test all but the first shape if they have the same page than
+ // the first shape
+ for( sal_Int32 nIndex = 1; bOk && ( nIndex < nCount ); nIndex++ )
+ {
+ mxShapes->getByIndex( nIndex ) >>= xShape;
+ pObj = GetSdrObjectFromXShape( xShape );
+ bOk = pObj && pObj->GetPage() == pPage;
+ }
+
+ if( !bOk )
+ break;
+ }
+
+ // no errors so far
+ return;
+ }
+ while( 0 );
+ }
+ catch( Exception& )
+ {
+ }
+
+ throw IllegalArgumentException();
+}
+
+// XServiceInfo
+OUString SAL_CALL GraphicExporter::getImplementationName( )
+ throw(RuntimeException)
+{
+ return GraphicExporter_getImplementationName();
+}
+
+sal_Bool SAL_CALL GraphicExporter::supportsService( const OUString& ServiceName )
+ throw(RuntimeException)
+{
+ Sequence< OUString > aSeq( GraphicExporter_getSupportedServiceNames() );
+ sal_Int32 nArgs = aSeq.getLength();
+ const OUString* pService = aSeq.getConstArray();
+ while( nArgs-- )
+ if( *pService++ == ServiceName )
+ return sal_True;
+
+ return sal_False;
+}
+
+Sequence< OUString > SAL_CALL GraphicExporter::getSupportedServiceNames( )
+ throw(RuntimeException)
+{
+ return GraphicExporter_getSupportedServiceNames();
+}
+
+// XMimeTypeInfo
+sal_Bool SAL_CALL GraphicExporter::supportsMimeType( const OUString& MimeTypeName ) throw (RuntimeException)
+{
+ const String aMimeTypeName( MimeTypeName );
+
+ GraphicFilter* pFilter = GraphicFilter::GetGraphicFilter();
+ sal_uInt16 nCount = pFilter->GetExportFormatCount();
+ sal_uInt16 nFilter;
+ for( nFilter = 0; nFilter < nCount; nFilter++ )
+ {
+ if( aMimeTypeName.Equals( pFilter->GetExportFormatMediaType( nFilter ) ) )
+ {
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+Sequence< OUString > SAL_CALL GraphicExporter::getSupportedMimeTypeNames( ) throw (RuntimeException)
+{
+ GraphicFilter* pFilter = GraphicFilter::GetGraphicFilter();
+ sal_uInt16 nCount = pFilter->GetExportFormatCount();
+ sal_uInt16 nFilter;
+ sal_uInt16 nFound = 0;
+
+ Sequence< OUString > aSeq( nCount );
+ OUString* pStr = aSeq.getArray();
+
+ for( nFilter = 0; nFilter < nCount; nFilter++ )
+ {
+ OUString aMimeType( pFilter->GetExportFormatMediaType( nFilter ) );
+ if( aMimeType.getLength() )
+ {
+ *pStr++ = aMimeType;
+ nFound++;
+ }
+ }
+
+ if( nFound < nCount )
+ aSeq.realloc( nFound );
+
+ return aSeq;
+}
+
+Graphic SvxGetGraphicForShape( SdrObject& rShape, bool bVector )
+{
+ Graphic aGraphic;
+ try
+ {
+ rtl::Reference< GraphicExporter > xExporter( new GraphicExporter() );
+ Reference< XComponent > xComp( rShape.getUnoShape(), UNO_QUERY_THROW );
+ xExporter->setSourceDocument( xComp );
+ ExportSettings aSettings( rShape.GetModel() );
+ xExporter->GetGraphic( aSettings, aGraphic, bVector );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("SvxGetGraphicForShape(), exception caught!");
+ }
+ return aGraphic;
+}
+
diff --git a/svx/source/unodraw/UnoGraphicExporter.hxx b/svx/source/unodraw/UnoGraphicExporter.hxx
new file mode 100644
index 000000000000..ebf0ac7a7a9c
--- /dev/null
+++ b/svx/source/unodraw/UnoGraphicExporter.hxx
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_UNOGRAPHICEXPORTER_HXX_
+#define _SVX_UNOGRAPHICEXPORTER_HXX_
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+namespace svx
+{
+ SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL GraphicExporter_createInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr) throw( ::com::sun::star::uno::Exception );
+ SVX_DLLPUBLIC ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL GraphicExporter_getSupportedServiceNames() throw();
+ SVX_DLLPUBLIC ::rtl::OUString SAL_CALL GraphicExporter_getImplementationName() throw();
+}
+
+#endif
diff --git a/svx/source/unodraw/UnoNameItemTable.cxx b/svx/source/unodraw/UnoNameItemTable.cxx
new file mode 100644
index 000000000000..69ee2502c27d
--- /dev/null
+++ b/svx/source/unodraw/UnoNameItemTable.cxx
@@ -0,0 +1,341 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <set>
+#include <svl/itempool.hxx>
+#include <svl/itemset.hxx>
+#include <svl/style.hxx>
+#include <comphelper/stl_types.hxx>
+
+#include <svx/svdmodel.hxx>
+#include "UnoNameItemTable.hxx"
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include "svx/unoapi.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::vos;
+
+SvxUnoNameItemTable::SvxUnoNameItemTable( SdrModel* pModel, sal_uInt16 nWhich, sal_uInt8 nMemberId ) throw()
+: mpModel( pModel ),
+ mpModelPool( pModel ? &pModel->GetItemPool() : NULL ),
+ mnWhich( nWhich ), mnMemberId( nMemberId )
+{
+ if( pModel )
+ StartListening( *pModel );
+}
+
+SvxUnoNameItemTable::~SvxUnoNameItemTable() throw()
+{
+ if( mpModel )
+ EndListening( *mpModel );
+ dispose();
+}
+
+bool SvxUnoNameItemTable::isValid( const NameOrIndex* pItem ) const
+{
+ return pItem && (pItem->GetName().Len() != 0);
+}
+
+void SvxUnoNameItemTable::dispose()
+{
+ ItemPoolVector::iterator aIter = maItemSetVector.begin();
+ const ItemPoolVector::iterator aEnd = maItemSetVector.end();
+
+ while( aIter != aEnd )
+ {
+ delete (*aIter++);
+ }
+
+ maItemSetVector.clear();
+}
+
+void SvxUnoNameItemTable::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw()
+{
+ const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
+
+ if( pSdrHint && HINT_MODELCLEARED == pSdrHint->GetKind() )
+ dispose();
+}
+
+sal_Bool SAL_CALL SvxUnoNameItemTable::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException)
+{
+ uno::Sequence< OUString > aSNL( getSupportedServiceNames() );
+ const OUString * pArray = aSNL.getConstArray();
+
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == ServiceName )
+ return sal_True;
+
+ return sal_False;
+}
+
+void SAL_CALL SvxUnoNameItemTable::ImplInsertByName( const OUString& aName, const uno::Any& aElement )
+{
+ SfxItemSet* mpInSet = new SfxItemSet( *mpModelPool, mnWhich, mnWhich );
+ maItemSetVector.push_back( mpInSet );
+
+ NameOrIndex* pNewItem = createItem();
+ pNewItem->SetName( String( aName ) );
+ pNewItem->PutValue( aElement, mnMemberId );
+ mpInSet->Put( *pNewItem, mnWhich );
+ delete pNewItem;
+}
+
+// XNameContainer
+void SAL_CALL SvxUnoNameItemTable::insertByName( const OUString& aApiName, const uno::Any& aElement )
+ throw( lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( hasByName( aApiName ) )
+ throw container::ElementExistException();
+
+ String aName;
+ SvxUnogetInternalNameForItem( mnWhich, aApiName, aName );
+
+ ImplInsertByName( aName, aElement );
+}
+
+
+
+void SAL_CALL SvxUnoNameItemTable::removeByName( const OUString& aApiName )
+ throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ // a little quickfix for 2.0 to let applications clear api
+ // created items that are not used
+ if( aApiName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("~clear~") ) )
+ {
+ dispose();
+ return;
+ }
+
+ String Name;
+ SvxUnogetInternalNameForItem( mnWhich, aApiName, Name );
+
+ ItemPoolVector::iterator aIter = maItemSetVector.begin();
+ const ItemPoolVector::iterator aEnd = maItemSetVector.end();
+
+ NameOrIndex *pItem;
+ const String aSearchName( Name );
+
+ while( aIter != aEnd )
+ {
+ pItem = (NameOrIndex *)&((*aIter)->Get( mnWhich ) );
+ if( pItem->GetName() == aSearchName )
+ {
+ delete (*aIter);
+ maItemSetVector.erase( aIter );
+ return;
+ }
+ aIter++;
+ }
+
+ if( !hasByName( Name ) )
+ throw container::NoSuchElementException();
+}
+
+// XNameReplace
+void SAL_CALL SvxUnoNameItemTable::replaceByName( const OUString& aApiName, const uno::Any& aElement )
+ throw( lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ String aName;
+ SvxUnogetInternalNameForItem( mnWhich, aApiName, aName );
+
+ ItemPoolVector::iterator aIter = maItemSetVector.begin();
+ const ItemPoolVector::iterator aEnd = maItemSetVector.end();
+
+ NameOrIndex *pItem;
+ const String aSearchName( aName );
+
+ while( aIter != aEnd )
+ {
+ pItem = (NameOrIndex *)&((*aIter)->Get( mnWhich ) );
+ if( pItem->GetName() == aSearchName )
+ {
+ NameOrIndex* pNewItem = createItem();
+ pNewItem->SetName( aSearchName );
+ if( !pNewItem->PutValue( aElement, mnMemberId ) || !isValid( pNewItem ) )
+ throw lang::IllegalArgumentException();
+
+ (*aIter)->Put( *pNewItem );
+ return;
+ }
+ aIter++;
+ }
+
+ // if it is not in our own sets, modify the pool!
+ sal_Bool bFound = sal_False;
+
+ sal_uInt32 nSurrogate;
+ sal_uInt32 nCount = mpModelPool ? mpModelPool->GetItemCount2( mnWhich ) : 0;
+ for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
+ {
+ pItem = (NameOrIndex*)mpModelPool->GetItem2( mnWhich, nSurrogate);
+ if( pItem && pItem->GetName() == aSearchName )
+ {
+ pItem->PutValue( aElement, mnMemberId );
+ bFound = sal_True;
+ break;
+ }
+ }
+
+ if( bFound )
+ ImplInsertByName( aName, aElement );
+ else
+ throw container::NoSuchElementException();
+
+ if( !hasByName( aName ) )
+ throw container::NoSuchElementException();
+}
+
+// XNameAccess
+uno::Any SAL_CALL SvxUnoNameItemTable::getByName( const OUString& aApiName )
+ throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ String aName;
+ SvxUnogetInternalNameForItem( mnWhich, aApiName, aName );
+
+ uno::Any aAny;
+
+ if( mpModelPool && aName.Len() != 0 )
+ {
+ const String aSearchName( aName );
+ NameOrIndex *pItem;
+ sal_uInt32 nSurrogate;
+
+ sal_uInt32 nSurrogateCount = mpModelPool ? mpModelPool->GetItemCount2( mnWhich ) : 0;
+ for( nSurrogate = 0; nSurrogate < nSurrogateCount; nSurrogate++ )
+ {
+ pItem = (NameOrIndex*)mpModelPool->GetItem2( mnWhich, nSurrogate );
+
+ if( isValid( pItem ) && (pItem->GetName() == aSearchName) )
+ {
+ pItem->QueryValue( aAny, mnMemberId );
+ return aAny;
+ }
+ }
+ }
+
+ throw container::NoSuchElementException();
+}
+
+uno::Sequence< OUString > SAL_CALL SvxUnoNameItemTable::getElementNames( )
+ throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ std::set< OUString, comphelper::UStringLess > aNameSet;
+
+ NameOrIndex *pItem;
+ OUString aApiName;
+
+ const sal_uInt32 nSurrogateCount = mpModelPool ? mpModelPool->GetItemCount2( mnWhich ) : 0;
+ sal_uInt32 nSurrogate;
+ for( nSurrogate = 0; nSurrogate < nSurrogateCount; nSurrogate++ )
+ {
+ pItem = (NameOrIndex*)mpModelPool->GetItem2( mnWhich, nSurrogate );
+
+ if( !isValid( pItem ) )
+ continue;
+
+ SvxUnogetApiNameForItem( mnWhich, pItem->GetName(), aApiName );
+ aNameSet.insert( aApiName );
+ }
+
+ uno::Sequence< OUString > aSeq( aNameSet.size() );
+ OUString* pNames = aSeq.getArray();
+
+ std::set< OUString, comphelper::UStringLess >::iterator aIter( aNameSet.begin() );
+ const std::set< OUString, comphelper::UStringLess >::iterator aEnd( aNameSet.end() );
+
+ while( aIter != aEnd )
+ {
+ *pNames++ = *aIter++;
+ }
+
+ return aSeq;
+}
+
+sal_Bool SAL_CALL SvxUnoNameItemTable::hasByName( const OUString& aApiName )
+ throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ String aName;
+ SvxUnogetInternalNameForItem( mnWhich, aApiName, aName );
+
+ if( aName.Len() == 0 )
+ return sal_False;
+
+ const String aSearchName( aName );
+ sal_uInt32 nSurrogate;
+
+ const NameOrIndex *pItem;
+
+ sal_uInt32 nCount = mpModelPool ? mpModelPool->GetItemCount2( mnWhich ) : 0;
+ for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
+ {
+ pItem = (NameOrIndex*)mpModelPool->GetItem2( mnWhich, nSurrogate );
+ if( isValid( pItem ) && (pItem->GetName() == aSearchName) )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+sal_Bool SAL_CALL SvxUnoNameItemTable::hasElements( )
+ throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ const NameOrIndex *pItem;
+
+ sal_uInt32 nSurrogate;
+ const sal_uInt32 nSurrogateCount = mpModelPool ? mpModelPool->GetItemCount2( mnWhich ) : 0;
+ for( nSurrogate = 0; nSurrogate < nSurrogateCount; nSurrogate++ )
+ {
+ pItem = (NameOrIndex*)mpModelPool->GetItem2( mnWhich, nSurrogate );
+
+ if( isValid( pItem ) )
+ return sal_True;
+ }
+
+ return sal_False;
+}
diff --git a/svx/source/unodraw/UnoNameItemTable.hxx b/svx/source/unodraw/UnoNameItemTable.hxx
new file mode 100644
index 000000000000..995b58fb0cc0
--- /dev/null
+++ b/svx/source/unodraw/UnoNameItemTable.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_UNONAMEITEMTABLE_HXX_
+#define _SVX_UNONAMEITEMTABLE_HXX_
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+
+#include <cppuhelper/implbase2.hxx>
+
+#include <vector>
+#include <svl/lstner.hxx>
+#include <svx/xit.hxx>
+
+#include <svx/xdef.hxx>
+
+class SdrModel;
+class SfxItemPool;
+class SfxItemSet;
+
+typedef std::vector< SfxItemSet* > ItemPoolVector;
+class SvxUnoNameItemTable : public cppu::WeakImplHelper2< com::sun::star::container::XNameContainer, com::sun::star::lang::XServiceInfo >,
+ public SfxListener
+{
+private:
+ SdrModel* mpModel;
+ SfxItemPool* mpModelPool;
+ sal_uInt16 mnWhich;
+ sal_uInt8 mnMemberId;
+
+ ItemPoolVector maItemSetVector;
+
+ void SAL_CALL ImplInsertByName( const rtl::OUString& aName, const com::sun::star::uno::Any& aElement );
+
+public:
+ SvxUnoNameItemTable( SdrModel* pModel, sal_uInt16 nWhich, sal_uInt8 nMemberId ) throw();
+ virtual ~SvxUnoNameItemTable() throw();
+
+ virtual NameOrIndex* createItem() const throw() = 0;
+ virtual bool isValid( const NameOrIndex* pItem ) const;
+
+ void dispose();
+
+ // SfxListener
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) throw ();
+
+ // XServiceInfo
+ virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) throw( com::sun::star::uno::RuntimeException);
+
+ // XNameContainer
+ virtual void SAL_CALL insertByName( const rtl::OUString& aName, const com::sun::star::uno::Any& aElement ) throw( com::sun::star::lang::IllegalArgumentException, com::sun::star::container::ElementExistException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeByName( const rtl::OUString& Name ) throw( com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException);
+
+ // XNameReplace
+ virtual void SAL_CALL replaceByName( const rtl::OUString& aName, const com::sun::star::uno::Any& aElement ) throw( com::sun::star::lang::IllegalArgumentException, com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException);
+
+ // XNameAccess
+ virtual com::sun::star::uno::Any SAL_CALL getByName( const rtl::OUString& aName ) throw( com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException);
+ virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getElementNames( ) throw( com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasByName( const rtl::OUString& aName ) throw( com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual sal_Bool SAL_CALL hasElements( ) throw( com::sun::star::uno::RuntimeException);
+};
+
+#endif // _SVX_UNONAMEITEMTABLE_HXX_
diff --git a/svx/source/unodraw/UnoNamespaceMap.cxx b/svx/source/unodraw/UnoNamespaceMap.cxx
new file mode 100644
index 000000000000..c504a46f29f3
--- /dev/null
+++ b/svx/source/unodraw/UnoNamespaceMap.cxx
@@ -0,0 +1,314 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <set>
+
+#include "svx/UnoNamespaceMap.hxx"
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+#ifndef _CPPUHELPER_IMPLBASE3_HXX_
+#include <cppuhelper/implbase2.hxx>
+#endif
+#include <osl/diagnose.h>
+#include <osl/mutex.hxx>
+#include <comphelper/stl_types.hxx>
+#include <svl/itempool.hxx>
+#include "svx/unoapi.hxx"
+#include "editeng/xmlcnitm.hxx"
+
+
+using namespace ::comphelper;
+using namespace ::osl;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+
+namespace svx
+{
+ /** implements a component to export namespaces of all SvXMLAttrContainerItem inside
+ one or two pools with a variable count of which ids.
+ */
+ class NamespaceMap : public WeakImplHelper2< XNameAccess, XServiceInfo >
+ {
+ private:
+ sal_uInt16* mpWhichIds;
+ SfxItemPool* mpPool;
+
+ public:
+ NamespaceMap( sal_uInt16* pWhichIds, SfxItemPool* pPool );
+ virtual ~NamespaceMap();
+
+ // XNameAccess
+ virtual Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (NoSuchElementException, WrappedTargetException, RuntimeException);
+ virtual Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (RuntimeException);
+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (RuntimeException);
+
+ // XElementAccess
+ virtual Type SAL_CALL getElementType( ) throw (RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw (RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(RuntimeException);
+ virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(RuntimeException);
+ };
+
+ Reference< XInterface > SAL_CALL NamespaceMap_createInstance( sal_uInt16* pWhichIds, SfxItemPool* pPool1, SfxItemPool* )
+ {
+ return (XWeak*)new NamespaceMap( pWhichIds, pPool1 );
+ }
+
+ Reference< XInterface > SAL_CALL NamespaceMap_createInstance( sal_uInt16* pWhichIds, SfxItemPool* pPool )
+ {
+ return (XWeak*)new NamespaceMap( pWhichIds, pPool );
+ }
+
+ Sequence< ::rtl::OUString > SAL_CALL NamespaceMap_getSupportedServiceNames()
+ throw()
+ {
+ Sequence< ::rtl::OUString > aSupportedServiceNames( 1 );
+ aSupportedServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.NamespaceMap" ) );
+ return aSupportedServiceNames;
+ }
+
+ ::rtl::OUString SAL_CALL NamespaceMap_getImplementationName()
+ throw()
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Svx.NamespaceMap" ) );
+ }
+
+
+
+ class NamespaceIteratorImpl
+ {
+ private:
+ SfxItemPool* mpPool;
+
+ sal_uInt16* mpWhichId;
+
+ sal_uInt32 mnItemCount;
+ sal_uInt32 mnItem;
+
+ const SvXMLAttrContainerItem* mpCurrentAttr;
+ sal_uInt16 mnCurrentAttr;
+
+ public:
+
+ NamespaceIteratorImpl( sal_uInt16* pWhichIds, SfxItemPool* pPool );
+
+ sal_Bool next( ::rtl::OUString& rPrefix, ::rtl::OUString& rURL );
+ };
+}
+
+using namespace ::svx;
+
+// -------------
+
+NamespaceIteratorImpl::NamespaceIteratorImpl( sal_uInt16* pWhichIds, SfxItemPool* pPool )
+{
+ mpPool = pPool;
+ mpCurrentAttr = NULL;
+ mnCurrentAttr = 0;
+
+ mpWhichId = pWhichIds;
+
+ mnItem = 0;
+ mnItemCount = (mpWhichId && (0 != *mpWhichId) && mpPool) ? mpPool->GetItemCount2( *mpWhichId ) : 0;
+}
+
+sal_Bool NamespaceIteratorImpl::next( ::rtl::OUString& rPrefix, ::rtl::OUString& rURL )
+{
+ // we still need to process the current attribute
+ if( mpCurrentAttr && (mnCurrentAttr != USHRT_MAX) )
+ {
+ rPrefix = mpCurrentAttr->GetPrefix( mnCurrentAttr );
+ rURL = mpCurrentAttr->GetNamespace( mnCurrentAttr );
+
+ mnCurrentAttr = mpCurrentAttr->GetNextNamespaceIndex( mnCurrentAttr );
+ return sal_True;
+ }
+
+ // we need the next namespace item
+ mpCurrentAttr = NULL;
+
+ const SfxPoolItem* pItem = 0;
+ // look for the next available item in the current pool
+ while( (mnItem < mnItemCount) && ( NULL == (pItem = mpPool->GetItem2( *mpWhichId, mnItem ) ) ) )
+ mnItem++;
+
+ // are we finished with the current whichid?
+ if( mnItem == mnItemCount )
+ {
+ mpWhichId++;
+
+ // are we finished with the current pool?
+ if( 0 != *mpWhichId )
+ {
+ mnItem = 0;
+ mnItemCount = (mpWhichId && (0 != *mpWhichId) && mpPool) ? mpPool->GetItemCount2( *mpWhichId ) : 0;
+ return next( rPrefix, rURL );
+ }
+
+ pItem = NULL;
+ }
+
+ if( pItem )
+ {
+ mnItem++;
+
+ // get that item and see if there namespaces inside
+ const SvXMLAttrContainerItem *pUnknown = (const SvXMLAttrContainerItem *)pItem;
+ if( (pUnknown->GetAttrCount() > 0) )
+ {
+ mpCurrentAttr = pUnknown;
+ mnCurrentAttr = pUnknown->GetFirstNamespaceIndex();
+ }
+ return next( rPrefix, rURL );
+ }
+
+ return false;
+}
+
+// -------------
+
+NamespaceMap::NamespaceMap( sal_uInt16* pWhichIds, SfxItemPool* pPool )
+: mpWhichIds( pWhichIds ), mpPool( pPool )
+{
+}
+
+NamespaceMap::~NamespaceMap()
+{
+}
+
+// XNameAccess
+Any SAL_CALL NamespaceMap::getByName( const ::rtl::OUString& aName ) throw (NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ NamespaceIteratorImpl aIter( mpWhichIds, mpPool );
+
+ ::rtl::OUString aPrefix;
+ ::rtl::OUString aURL;
+
+ sal_Bool bFound;
+
+ do
+ {
+ bFound = aIter.next( aPrefix, aURL );
+ }
+ while( bFound && (aPrefix != aName ) );
+
+ if( !bFound )
+ throw NoSuchElementException();
+
+ return makeAny( aURL );
+}
+
+Sequence< ::rtl::OUString > SAL_CALL NamespaceMap::getElementNames() throw (RuntimeException)
+{
+ NamespaceIteratorImpl aIter( mpWhichIds, mpPool );
+
+ ::rtl::OUString aPrefix;
+ ::rtl::OUString aURL;
+
+ std::set< ::rtl::OUString, comphelper::UStringLess > aPrefixSet;
+
+ while( aIter.next( aPrefix, aURL ) )
+ aPrefixSet.insert( aPrefix );
+
+ Sequence< ::rtl::OUString > aSeq( aPrefixSet.size() );
+ ::rtl::OUString* pPrefixes = aSeq.getArray();
+
+ std::set< ::rtl::OUString, comphelper::UStringLess >::iterator aPrefixIter( aPrefixSet.begin() );
+ const std::set< ::rtl::OUString, comphelper::UStringLess >::iterator aEnd( aPrefixSet.end() );
+
+ while( aPrefixIter != aEnd )
+ {
+ *pPrefixes++ = *aPrefixIter++;
+ }
+
+ return aSeq;
+}
+
+sal_Bool SAL_CALL NamespaceMap::hasByName( const ::rtl::OUString& aName ) throw (RuntimeException)
+{
+ NamespaceIteratorImpl aIter( mpWhichIds, mpPool );
+
+ ::rtl::OUString aPrefix;
+ ::rtl::OUString aURL;
+
+ sal_Bool bFound;
+
+ do
+ {
+ bFound = aIter.next( aPrefix, aURL );
+ }
+ while( bFound && (aPrefix != aName ) );
+
+ return bFound;
+}
+
+// XElementAccess
+Type SAL_CALL NamespaceMap::getElementType() throw (RuntimeException)
+{
+ return ::getCppuType( (const ::rtl::OUString*) 0 );
+}
+
+sal_Bool SAL_CALL NamespaceMap::hasElements() throw (RuntimeException)
+{
+ NamespaceIteratorImpl aIter( mpWhichIds, mpPool );
+
+ ::rtl::OUString aPrefix;
+ ::rtl::OUString aURL;
+
+ return aIter.next( aPrefix, aURL );
+}
+
+// XServiceInfo
+::rtl::OUString SAL_CALL NamespaceMap::getImplementationName( )
+ throw(RuntimeException)
+{
+ return NamespaceMap_getImplementationName();
+}
+
+sal_Bool SAL_CALL NamespaceMap::supportsService( const ::rtl::OUString& )
+ throw(RuntimeException)
+{
+ return sal_True;
+}
+
+Sequence< ::rtl::OUString > SAL_CALL NamespaceMap::getSupportedServiceNames( )
+ throw(RuntimeException)
+{
+ return NamespaceMap_getSupportedServiceNames();
+}
diff --git a/svx/source/unodraw/XPropertyTable.cxx b/svx/source/unodraw/XPropertyTable.cxx
new file mode 100644
index 000000000000..4a54b30c6caa
--- /dev/null
+++ b/svx/source/unodraw/XPropertyTable.cxx
@@ -0,0 +1,743 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svx/XPropertyTable.hxx"
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/drawing/LineDash.hpp>
+#include <com/sun/star/awt/Gradient.hpp>
+#include <com/sun/star/drawing/Hatch.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include <cppuhelper/implbase2.hxx>
+#include "unopolyhelper.hxx"
+#include <svx/xdef.hxx>
+
+#include "svx/unoapi.hxx"
+#include <editeng/unoprnms.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+using namespace com::sun::star;
+using namespace ::cppu;
+using namespace ::rtl;
+using namespace ::vos;
+
+class SvxUnoXPropertyTable : public WeakImplHelper2< container::XNameContainer, lang::XServiceInfo >
+{
+private:
+ XPropertyTable* mpTable;
+ XPropertyList* mpList;
+ sal_Int16 mnWhich;
+
+ long getCount() const { return mpList ? mpList->Count() : (mpTable?mpTable->Count():0); }
+ XPropertyEntry* get( long index ) const;
+public:
+ SvxUnoXPropertyTable( sal_Int16 nWhich, XPropertyList* pList ) throw();
+ SvxUnoXPropertyTable( sal_Int16 nWhich, XPropertyTable* pTable ) throw();
+
+ virtual ~SvxUnoXPropertyTable() throw();
+
+ virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw() = 0;
+ virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw() = 0;
+
+ // XServiceInfo
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( uno::RuntimeException);
+
+ // XNameContainer
+ virtual void SAL_CALL insertByName( const OUString& aName, const uno::Any& aElement ) throw( lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual void SAL_CALL removeByName( const OUString& Name ) throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
+
+ // XNameReplace
+ virtual void SAL_CALL replaceByName( const OUString& aName, const uno::Any& aElement ) throw( lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
+
+ // XNameAccess
+ virtual uno::Any SAL_CALL getByName( const OUString& aName ) throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual uno::Sequence< OUString > SAL_CALL getElementNames( ) throw( uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw( uno::RuntimeException);
+
+ // XElementAccess
+ virtual sal_Bool SAL_CALL hasElements( ) throw( uno::RuntimeException);
+};
+
+SvxUnoXPropertyTable::SvxUnoXPropertyTable( sal_Int16 nWhich, XPropertyTable* pTable ) throw()
+: mpTable( pTable ), mpList( NULL ), mnWhich( nWhich )
+{
+}
+
+SvxUnoXPropertyTable::SvxUnoXPropertyTable( sal_Int16 nWhich, XPropertyList* pList ) throw()
+: mpTable( NULL ), mpList( pList ), mnWhich( nWhich )
+{
+}
+
+SvxUnoXPropertyTable::~SvxUnoXPropertyTable() throw()
+{
+}
+
+XPropertyEntry* SvxUnoXPropertyTable::get( long index ) const
+{
+ if( mpTable )
+ return mpTable->Get( index, 0 );
+ else if( mpList )
+ return mpList->Get( index, 0 );
+ else
+ return NULL;
+}
+
+// XServiceInfo
+sal_Bool SAL_CALL SvxUnoXPropertyTable::supportsService( const OUString& ServiceName )
+ throw( uno::RuntimeException)
+{
+ const uno::Sequence< OUString > aServices( getSupportedServiceNames() );
+ const OUString* pServices = aServices.getConstArray();
+ const sal_Int32 nCount = aServices.getLength();
+ sal_Int32 i;
+ for( i = 0; i < nCount; i++ )
+ {
+ if( *pServices++ == ServiceName )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+// XNameContainer
+void SAL_CALL SvxUnoXPropertyTable::insertByName( const OUString& aName, const uno::Any& aElement )
+ throw( lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( NULL == mpList && NULL == mpTable )
+ throw lang::IllegalArgumentException();
+
+ if( hasByName( aName ) )
+ throw container::ElementExistException();
+
+ String aInternalName;
+ SvxUnogetInternalNameForItem( mnWhich, aName, aInternalName );
+
+ XPropertyEntry* pNewEntry = getEntry( aInternalName, aElement );
+ if( NULL == pNewEntry )
+ throw lang::IllegalArgumentException();
+
+ if( mpList )
+ mpList->Insert( pNewEntry );
+ else
+ mpTable->Insert( mpTable->Count(), pNewEntry );
+}
+
+void SAL_CALL SvxUnoXPropertyTable::removeByName( const OUString& Name )
+ throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ String aInternalName;
+ SvxUnogetInternalNameForItem( mnWhich, Name, aInternalName );
+
+ const long nCount = getCount();
+ long i;
+ XPropertyEntry* pEntry;
+ for( i = 0; i < nCount; i++ )
+ {
+ pEntry = get( i );
+ if( pEntry && pEntry->GetName() == aInternalName )
+ {
+ if( mpList )
+ delete mpList->Remove( i, 0 );
+ else
+ delete mpTable->Remove( i, 0 );
+ return;
+ }
+ }
+
+ throw container::NoSuchElementException();
+}
+
+// XNameReplace
+void SAL_CALL SvxUnoXPropertyTable::replaceByName( const OUString& aName, const uno::Any& aElement )
+ throw( lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ String aInternalName;
+ SvxUnogetInternalNameForItem( mnWhich, aName, aInternalName );
+
+ const long nCount = getCount();
+ long i;
+ XPropertyEntry* pEntry;
+ for( i = 0; i < nCount; i++ )
+ {
+ pEntry = get( i );
+ if( pEntry && pEntry->GetName() == aInternalName )
+ {
+ XPropertyEntry* pNewEntry = getEntry( aInternalName, aElement );
+ if( NULL == pNewEntry )
+ throw lang::IllegalArgumentException();
+
+ if( mpList )
+ delete mpList->Replace( pNewEntry, i );
+ else
+ delete mpTable->Replace( i, pNewEntry );
+ return;
+ }
+ }
+
+ throw container::NoSuchElementException();
+}
+
+// XNameAccess
+uno::Any SAL_CALL SvxUnoXPropertyTable::getByName( const OUString& aName )
+ throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ String aInternalName;
+ SvxUnogetInternalNameForItem( mnWhich, aName, aInternalName );
+
+ const long nCount = getCount();
+ long i;
+ XPropertyEntry* pEntry;
+ for( i = 0; i < nCount; i++ )
+ {
+ pEntry = get( i );
+
+ if( pEntry && pEntry->GetName() == aInternalName )
+ return getAny( pEntry );
+ }
+
+ throw container::NoSuchElementException();
+}
+
+uno::Sequence< OUString > SAL_CALL SvxUnoXPropertyTable::getElementNames()
+ throw( uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ const long nCount = getCount();
+ uno::Sequence< OUString > aNames( nCount );
+ OUString* pNames = aNames.getArray();
+ long i;
+ XPropertyEntry* pEntry;
+ for( i = 0; i < nCount; i++ )
+ {
+ pEntry = get( i );
+
+ if( pEntry )
+ {
+ SvxUnogetApiNameForItem( mnWhich, pEntry->GetName(), *pNames );
+ pNames++;
+ }
+ }
+
+ return aNames;
+}
+
+sal_Bool SAL_CALL SvxUnoXPropertyTable::hasByName( const OUString& aName )
+ throw( uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ String aInternalName;
+ SvxUnogetInternalNameForItem( mnWhich, aName, aInternalName );
+
+ const long nCount = mpList?mpList->Count():0;
+ long i;
+ XPropertyEntry* pEntry;
+ for( i = 0; i < nCount; i++ )
+ {
+ pEntry = get( i );
+ if( pEntry && pEntry->GetName() == aInternalName )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+// XElementAccess
+sal_Bool SAL_CALL SvxUnoXPropertyTable::hasElements( )
+ throw( uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ return getCount() != 0;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+class SvxUnoXColorTable : public SvxUnoXPropertyTable
+{
+public:
+ SvxUnoXColorTable( XPropertyTable* pTable ) throw() : SvxUnoXPropertyTable( XATTR_LINECOLOR, pTable ) {};
+
+ // SvxUnoXPropertyTable
+ virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw();
+ virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw();
+
+ // XElementAccess
+ virtual uno::Type SAL_CALL getElementType() throw( uno::RuntimeException );
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw( uno::RuntimeException );
+ virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw( uno::RuntimeException);
+};
+
+uno::Reference< uno::XInterface > SAL_CALL SvxUnoXColorTable_createInstance( XPropertyTable* pTable ) throw()
+{
+ return (OWeakObject*) new SvxUnoXColorTable( pTable );
+}
+
+// SvxUnoXPropertyTable
+uno::Any SvxUnoXColorTable::getAny( const XPropertyEntry* pEntry ) const throw()
+{
+ uno::Any aAny;
+ aAny <<= (sal_Int32)((XColorEntry*)pEntry)->GetColor().GetColor();
+ return aAny;
+}
+
+XPropertyEntry* SvxUnoXColorTable::getEntry( const OUString& rName, const uno::Any& rAny ) const throw()
+{
+ sal_Int32 nColor = 0;
+ if( !(rAny >>= nColor) )
+ return NULL;
+
+ const Color aColor( (ColorData)nColor );
+ const String aName( rName );
+ return new XColorEntry( aColor, aName );
+}
+
+// XElementAccess
+uno::Type SAL_CALL SvxUnoXColorTable::getElementType()
+ throw( uno::RuntimeException )
+{
+ return ::getCppuType((const sal_Int32*)0);
+}
+
+// XServiceInfo
+OUString SAL_CALL SvxUnoXColorTable::getImplementationName( ) throw( uno::RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxUnoXColorTable" ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SvxUnoXColorTable::getSupportedServiceNames( ) throw( uno::RuntimeException)
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.ColorTable" ) );
+ uno::Sequence< OUString > aServices( &aServiceName, 1 );
+ return aServices;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+class SvxUnoXLineEndTable : public SvxUnoXPropertyTable
+{
+public:
+ SvxUnoXLineEndTable( XPropertyList* pTable ) throw() : SvxUnoXPropertyTable( XATTR_LINEEND, pTable ) {};
+
+ // SvxUnoXPropertyTable
+ virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw();
+ virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw();
+
+ // XElementAccess
+ virtual uno::Type SAL_CALL getElementType() throw( uno::RuntimeException );
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw( uno::RuntimeException );
+ virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw( uno::RuntimeException);
+};
+
+uno::Reference< uno::XInterface > SAL_CALL SvxUnoXLineEndTable_createInstance( XPropertyList* pTable ) throw()
+{
+ return (OWeakObject*)new SvxUnoXLineEndTable( pTable );
+}
+
+// SvxUnoXPropertyTable
+uno::Any SvxUnoXLineEndTable::getAny( const XPropertyEntry* pEntry ) const throw()
+{
+
+ uno::Any aAny;
+ drawing::PolyPolygonBezierCoords aBezier;
+ SvxConvertB2DPolyPolygonToPolyPolygonBezier( ((XLineEndEntry*)pEntry)->GetLineEnd(), aBezier );
+ aAny <<= aBezier;
+ return aAny;
+}
+
+XPropertyEntry* SvxUnoXLineEndTable::getEntry( const OUString& rName, const uno::Any& rAny ) const throw()
+{
+
+ if( !rAny.getValue() || rAny.getValueType() != ::getCppuType((const drawing::PolyPolygonBezierCoords*)0) )
+ return NULL;
+
+ basegfx::B2DPolyPolygon aPolyPolygon;
+ drawing::PolyPolygonBezierCoords* pCoords = (drawing::PolyPolygonBezierCoords*)rAny.getValue();
+ if( pCoords->Coordinates.getLength() > 0 )
+ aPolyPolygon = SvxConvertPolyPolygonBezierToB2DPolyPolygon( pCoords );
+
+ // #86265# make sure polygon is closed
+ aPolyPolygon.setClosed(true);
+
+ const String aName( rName );
+ return new XLineEndEntry( aPolyPolygon, aName );
+}
+
+// XElementAccess
+uno::Type SAL_CALL SvxUnoXLineEndTable::getElementType()
+ throw( uno::RuntimeException )
+{
+ return ::getCppuType((const drawing::PolyPolygonBezierCoords*)0);
+}
+
+// XServiceInfo
+OUString SAL_CALL SvxUnoXLineEndTable::getImplementationName( ) throw( uno::RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxUnoXLineEndTable" ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SvxUnoXLineEndTable::getSupportedServiceNames( ) throw( uno::RuntimeException)
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.LineEndTable" ) );
+ uno::Sequence< OUString > aServices( &aServiceName, 1 );
+ return aServices;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+class SvxUnoXDashTable : public SvxUnoXPropertyTable
+{
+public:
+ SvxUnoXDashTable( XPropertyList* pTable ) throw() : SvxUnoXPropertyTable( XATTR_LINEDASH, pTable ) {};
+
+ // SvxUnoXPropertyTable
+ virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw();
+ virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw();
+
+ // XElementAccess
+ virtual uno::Type SAL_CALL getElementType() throw( uno::RuntimeException );
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw( uno::RuntimeException );
+ virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw( uno::RuntimeException);
+};
+
+uno::Reference< uno::XInterface > SAL_CALL SvxUnoXDashTable_createInstance( XPropertyList* pTable ) throw()
+{
+ return (OWeakObject*)new SvxUnoXDashTable( pTable );
+}
+
+// SvxUnoXPropertyTable
+uno::Any SvxUnoXDashTable::getAny( const XPropertyEntry* pEntry ) const throw()
+{
+ const XDash& rXD = ((XDashEntry*)pEntry)->GetDash();
+
+ drawing::LineDash aLineDash;
+
+ aLineDash.Style = (::com::sun::star::drawing::DashStyle)((sal_uInt16)rXD.GetDashStyle());
+ aLineDash.Dots = rXD.GetDots();
+ aLineDash.DotLen = rXD.GetDotLen();
+ aLineDash.Dashes = rXD.GetDashes();
+ aLineDash.DashLen = rXD.GetDashLen();
+ aLineDash.Distance = rXD.GetDistance();
+
+ uno::Any aAny;
+ aAny <<= aLineDash;
+ return aAny;
+}
+
+XPropertyEntry* SvxUnoXDashTable::getEntry( const OUString& rName, const uno::Any& rAny ) const throw()
+{
+ drawing::LineDash aLineDash;
+ if(!(rAny >>= aLineDash))
+ return NULL;
+
+ XDash aXDash;
+
+ aXDash.SetDashStyle((XDashStyle)((sal_uInt16)(aLineDash.Style)));
+ aXDash.SetDots(aLineDash.Dots);
+ aXDash.SetDotLen(aLineDash.DotLen);
+ aXDash.SetDashes(aLineDash.Dashes);
+ aXDash.SetDashLen(aLineDash.DashLen);
+ aXDash.SetDistance(aLineDash.Distance);
+
+ const String aName( rName );
+ return new XDashEntry( aXDash, aName );
+}
+
+// XElementAccess
+uno::Type SAL_CALL SvxUnoXDashTable::getElementType()
+ throw( uno::RuntimeException )
+{
+ return ::getCppuType((const drawing::LineDash*)0);
+}
+
+// XServiceInfo
+OUString SAL_CALL SvxUnoXDashTable::getImplementationName( ) throw( uno::RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxUnoXDashTable" ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SvxUnoXDashTable::getSupportedServiceNames( ) throw( uno::RuntimeException)
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DashTable" ) );
+ uno::Sequence< OUString > aServices( &aServiceName, 1 );
+ return aServices;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+class SvxUnoXHatchTable : public SvxUnoXPropertyTable
+{
+public:
+ SvxUnoXHatchTable( XPropertyList* pTable ) throw() : SvxUnoXPropertyTable( XATTR_FILLHATCH, pTable ) {};
+
+ // SvxUnoXPropertyTable
+ virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw();
+ virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw();
+
+ // XElementAccess
+ virtual uno::Type SAL_CALL getElementType() throw( uno::RuntimeException );
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw( uno::RuntimeException );
+ virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw( uno::RuntimeException);
+};
+
+uno::Reference< uno::XInterface > SAL_CALL SvxUnoXHatchTable_createInstance( XPropertyList* pTable ) throw()
+{
+ return (OWeakObject*)new SvxUnoXHatchTable( pTable );
+}
+
+// SvxUnoXPropertyTable
+uno::Any SvxUnoXHatchTable::getAny( const XPropertyEntry* pEntry ) const throw()
+{
+ const XHatch& aHatch = ((XHatchEntry*)pEntry)->GetHatch();
+
+ drawing::Hatch aUnoHatch;
+
+ aUnoHatch.Style = (drawing::HatchStyle)aHatch.GetHatchStyle();
+ aUnoHatch.Color = aHatch.GetColor().GetColor();
+ aUnoHatch.Distance = aHatch.GetDistance();
+ aUnoHatch.Angle = aHatch.GetAngle();
+
+ uno::Any aAny;
+ aAny <<= aUnoHatch;
+ return aAny;
+}
+
+XPropertyEntry* SvxUnoXHatchTable::getEntry( const OUString& rName, const uno::Any& rAny ) const throw()
+{
+ drawing::Hatch aUnoHatch;
+ if(!(rAny >>= aUnoHatch))
+ return NULL;
+
+ XHatch aXHatch;
+ aXHatch.SetHatchStyle( (XHatchStyle)aUnoHatch.Style );
+ aXHatch.SetColor( aUnoHatch.Color );
+ aXHatch.SetDistance( aUnoHatch.Distance );
+ aXHatch.SetAngle( aUnoHatch.Angle );
+
+ const String aName( rName );
+ return new XHatchEntry( aXHatch, aName );
+}
+
+// XElementAccess
+uno::Type SAL_CALL SvxUnoXHatchTable::getElementType()
+ throw( uno::RuntimeException )
+{
+ return ::getCppuType((const drawing::Hatch*)0);
+}
+
+// XServiceInfo
+OUString SAL_CALL SvxUnoXHatchTable::getImplementationName( ) throw( uno::RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxUnoXHatchTable" ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SvxUnoXHatchTable::getSupportedServiceNames( ) throw( uno::RuntimeException)
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.HatchTable" ) );
+ uno::Sequence< OUString > aServices( &aServiceName, 1 );
+ return aServices;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+class SvxUnoXGradientTable : public SvxUnoXPropertyTable
+{
+public:
+ SvxUnoXGradientTable( XPropertyList* pTable ) throw() : SvxUnoXPropertyTable( XATTR_FILLGRADIENT, pTable ) {};
+
+ // SvxUnoXPropertyTable
+ virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw();
+ virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw();
+
+ // XElementAccess
+ virtual uno::Type SAL_CALL getElementType() throw( uno::RuntimeException );
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw( uno::RuntimeException );
+ virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw( uno::RuntimeException);
+};
+
+uno::Reference< uno::XInterface > SAL_CALL SvxUnoXGradientTable_createInstance( XPropertyList* pTable ) throw()
+{
+ return (OWeakObject*)new SvxUnoXGradientTable( pTable );
+}
+
+// SvxUnoXPropertyTable
+uno::Any SvxUnoXGradientTable::getAny( const XPropertyEntry* pEntry ) const throw()
+{
+ const XGradient& aXGradient = ((XGradientEntry*)pEntry)->GetGradient();
+ awt::Gradient aGradient;
+
+ aGradient.Style = (awt::GradientStyle) aXGradient.GetGradientStyle();
+ aGradient.StartColor = (sal_Int32)aXGradient.GetStartColor().GetColor();
+ aGradient.EndColor = (sal_Int32)aXGradient.GetEndColor().GetColor();
+ aGradient.Angle = (short)aXGradient.GetAngle();
+ aGradient.Border = aXGradient.GetBorder();
+ aGradient.XOffset = aXGradient.GetXOffset();
+ aGradient.YOffset = aXGradient.GetYOffset();
+ aGradient.StartIntensity = aXGradient.GetStartIntens();
+ aGradient.EndIntensity = aXGradient.GetEndIntens();
+ aGradient.StepCount = aXGradient.GetSteps();
+
+ uno::Any aAny;
+ aAny <<= aGradient;
+ return aAny;
+}
+
+XPropertyEntry* SvxUnoXGradientTable::getEntry( const OUString& rName, const uno::Any& rAny ) const throw()
+{
+ awt::Gradient aGradient;
+ if(!(rAny >>= aGradient))
+ return NULL;
+
+ XGradient aXGradient;
+
+ aXGradient.SetGradientStyle( (XGradientStyle) aGradient.Style );
+ aXGradient.SetStartColor( aGradient.StartColor );
+ aXGradient.SetEndColor( aGradient.EndColor );
+ aXGradient.SetAngle( aGradient.Angle );
+ aXGradient.SetBorder( aGradient.Border );
+ aXGradient.SetXOffset( aGradient.XOffset );
+ aXGradient.SetYOffset( aGradient.YOffset );
+ aXGradient.SetStartIntens( aGradient.StartIntensity );
+ aXGradient.SetEndIntens( aGradient.EndIntensity );
+ aXGradient.SetSteps( aGradient.StepCount );
+
+ const String aName( rName );
+ return new XGradientEntry( aXGradient, aName );
+}
+
+// XElementAccess
+uno::Type SAL_CALL SvxUnoXGradientTable::getElementType()
+ throw( uno::RuntimeException )
+{
+ return ::getCppuType((const awt::Gradient*)0);
+}
+
+// XServiceInfo
+OUString SAL_CALL SvxUnoXGradientTable::getImplementationName( ) throw( uno::RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxUnoXGradientTable" ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SvxUnoXGradientTable::getSupportedServiceNames( ) throw( uno::RuntimeException)
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.GradientTable" ) );
+ uno::Sequence< OUString > aServices( &aServiceName, 1 );
+ return aServices;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+class SvxUnoXBitmapTable : public SvxUnoXPropertyTable
+{
+public:
+ SvxUnoXBitmapTable( XPropertyList* pTable ) throw() : SvxUnoXPropertyTable( XATTR_FILLBITMAP, pTable ) {};
+
+ // SvxUnoXPropertyTable
+ virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw();
+ virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw();
+
+ // XElementAccess
+ virtual uno::Type SAL_CALL getElementType() throw( uno::RuntimeException );
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw( uno::RuntimeException );
+ virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw( uno::RuntimeException);
+};
+
+uno::Reference< uno::XInterface > SAL_CALL SvxUnoXBitmapTable_createInstance( XPropertyList* pTable ) throw()
+{
+ return (OWeakObject*)new SvxUnoXBitmapTable( pTable );
+}
+
+// SvxUnoXPropertyTable
+uno::Any SvxUnoXBitmapTable::getAny( const XPropertyEntry* pEntry ) const throw()
+{
+ OUString aURL( RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX));
+ aURL += OUString::createFromAscii( ((XBitmapEntry*)pEntry)->GetXBitmap().GetGraphicObject().GetUniqueID().GetBuffer() );
+
+ uno::Any aAny;
+ aAny <<= aURL;
+ return aAny;
+}
+
+XPropertyEntry* SvxUnoXBitmapTable::getEntry( const OUString& rName, const uno::Any& rAny ) const throw()
+{
+ OUString aURL;
+ if(!(rAny >>= aURL))
+ return NULL;
+
+ GraphicObject aGrafObj( GraphicObject::CreateGraphicObjectFromURL( aURL ) );
+ XOBitmap aBMP( aGrafObj );
+
+ const String aName( rName );
+ return new XBitmapEntry( aBMP, aName );
+}
+
+// XElementAccess
+uno::Type SAL_CALL SvxUnoXBitmapTable::getElementType()
+ throw( uno::RuntimeException )
+{
+ return ::getCppuType((const OUString*)0);
+}
+
+// XServiceInfo
+OUString SAL_CALL SvxUnoXBitmapTable::getImplementationName( ) throw( uno::RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxUnoXBitmapTable" ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SvxUnoXBitmapTable::getSupportedServiceNames( ) throw( uno::RuntimeException)
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.BitmapTable" ) );
+ uno::Sequence< OUString > aServices( &aServiceName, 1 );
+ return aServices;
+}
diff --git a/svx/source/unodraw/gluepts.cxx b/svx/source/unodraw/gluepts.cxx
new file mode 100644
index 000000000000..ab09bbfb475b
--- /dev/null
+++ b/svx/source/unodraw/gluepts.cxx
@@ -0,0 +1,548 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <com/sun/star/container/XIdentifierContainer.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#ifndef _COM_SUN_STAR_DRAWING_GLUEPOINT2_HDL_
+#include <com/sun/star/drawing/GluePoint2.hpp>
+#endif
+
+#include <cppuhelper/implbase2.hxx>
+
+#include <svx/svdmodel.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdglue.hxx>
+#include <svx/svdpage.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+using namespace ::cppu;
+
+const sal_uInt16 NON_USER_DEFINED_GLUE_POINTS = 4;
+
+class SvxUnoGluePointAccess : public WeakImplHelper2< container::XIndexContainer, container::XIdentifierContainer >
+{
+private:
+ SdrObjectWeakRef mpObject;
+
+public:
+ SvxUnoGluePointAccess( SdrObject* pObject ) throw();
+ virtual ~SvxUnoGluePointAccess() 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);
+
+ // XIdentifierReplace
+ virtual void SAL_CALL replaceByIdentifer( sal_Int32 Identifier, const uno::Any& aElement ) throw (lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
+
+ // XIdentifierReplace
+ virtual uno::Any SAL_CALL getByIdentifier( sal_Int32 Identifier ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual uno::Sequence< sal_Int32 > SAL_CALL getIdentifiers( ) throw (uno::RuntimeException);
+
+ /* deprecated */
+ // XIndexContainer
+ virtual void SAL_CALL insertByIndex( sal_Int32 Index, const uno::Any& Element ) throw(lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual void SAL_CALL removeByIndex( sal_Int32 Index ) throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException);
+
+ /* deprecated */
+ // XIndexReplace
+ virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const uno::Any& Element ) throw(lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException);
+
+ /* deprecated */
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount( ) throw(uno::RuntimeException);
+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException);
+
+ // XElementAccess
+ virtual uno::Type SAL_CALL getElementType( ) throw( uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw( uno::RuntimeException);
+};
+
+static void convert( const SdrGluePoint& rSdrGlue, drawing::GluePoint2& rUnoGlue ) throw()
+{
+ rUnoGlue.Position.X = rSdrGlue.GetPos().X();
+ rUnoGlue.Position.Y = rSdrGlue.GetPos().Y();
+ rUnoGlue.IsRelative = rSdrGlue.IsPercent();
+
+ switch( rSdrGlue.GetAlign() )
+ {
+ case SDRVERTALIGN_TOP|SDRHORZALIGN_LEFT:
+ rUnoGlue.PositionAlignment = drawing::Alignment_TOP_LEFT;
+ break;
+ case SDRHORZALIGN_CENTER|SDRVERTALIGN_TOP:
+ rUnoGlue.PositionAlignment = drawing::Alignment_TOP;
+ break;
+ case SDRVERTALIGN_TOP|SDRHORZALIGN_RIGHT:
+ rUnoGlue.PositionAlignment = drawing::Alignment_TOP_RIGHT;
+ break;
+ case SDRHORZALIGN_CENTER|SDRVERTALIGN_CENTER:
+ rUnoGlue.PositionAlignment = drawing::Alignment_CENTER;
+ break;
+ case SDRHORZALIGN_RIGHT|SDRVERTALIGN_CENTER:
+ rUnoGlue.PositionAlignment = drawing::Alignment_RIGHT;
+ break;
+ case SDRHORZALIGN_LEFT|SDRVERTALIGN_BOTTOM:
+ rUnoGlue.PositionAlignment = drawing::Alignment_BOTTOM_LEFT;
+ break;
+ case SDRHORZALIGN_CENTER|SDRVERTALIGN_BOTTOM:
+ rUnoGlue.PositionAlignment = drawing::Alignment_BOTTOM;
+ break;
+ case SDRHORZALIGN_RIGHT|SDRVERTALIGN_BOTTOM:
+ rUnoGlue.PositionAlignment = drawing::Alignment_BOTTOM_RIGHT;
+ break;
+// case SDRHORZALIGN_LEFT:
+ default:
+ rUnoGlue.PositionAlignment = drawing::Alignment_LEFT;
+ break;
+ }
+
+ switch( rSdrGlue.GetEscDir() )
+ {
+ case SDRESC_LEFT:
+ rUnoGlue.Escape = drawing::EscapeDirection_LEFT;
+ break;
+ case SDRESC_RIGHT:
+ rUnoGlue.Escape = drawing::EscapeDirection_RIGHT;
+ break;
+ case SDRESC_TOP:
+ rUnoGlue.Escape = drawing::EscapeDirection_UP;
+ break;
+ case SDRESC_BOTTOM:
+ rUnoGlue.Escape = drawing::EscapeDirection_DOWN;
+ break;
+ case SDRESC_HORZ:
+ rUnoGlue.Escape = drawing::EscapeDirection_HORIZONTAL;
+ break;
+ case SDRESC_VERT:
+ rUnoGlue.Escape = drawing::EscapeDirection_VERTICAL;
+ break;
+// case SDRESC_SMART:
+ default:
+ rUnoGlue.Escape = drawing::EscapeDirection_SMART;
+ break;
+ }
+}
+
+static void convert( const drawing::GluePoint2& rUnoGlue, SdrGluePoint& rSdrGlue ) throw()
+{
+ rSdrGlue.SetPos( Point( rUnoGlue.Position.X, rUnoGlue.Position.Y ) );
+ rSdrGlue.SetPercent( rUnoGlue.IsRelative );
+
+ switch( rUnoGlue.PositionAlignment )
+ {
+ case drawing::Alignment_TOP_LEFT:
+ rSdrGlue.SetAlign( SDRVERTALIGN_TOP|SDRHORZALIGN_LEFT );
+ break;
+ case drawing::Alignment_TOP:
+ rSdrGlue.SetAlign( SDRHORZALIGN_CENTER|SDRVERTALIGN_TOP );
+ break;
+ case drawing::Alignment_TOP_RIGHT:
+ rSdrGlue.SetAlign( SDRVERTALIGN_TOP|SDRHORZALIGN_RIGHT );
+ break;
+ case drawing::Alignment_CENTER:
+ rSdrGlue.SetAlign( SDRHORZALIGN_CENTER|SDRVERTALIGN_CENTER );
+ break;
+ case drawing::Alignment_RIGHT:
+ rSdrGlue.SetAlign( SDRHORZALIGN_RIGHT|SDRVERTALIGN_CENTER );
+ break;
+ case drawing::Alignment_BOTTOM_LEFT:
+ rSdrGlue.SetAlign( SDRHORZALIGN_LEFT|SDRVERTALIGN_BOTTOM );
+ break;
+ case drawing::Alignment_BOTTOM:
+ rSdrGlue.SetAlign( SDRHORZALIGN_CENTER|SDRVERTALIGN_BOTTOM );
+ break;
+ case drawing::Alignment_BOTTOM_RIGHT:
+ rSdrGlue.SetAlign( SDRHORZALIGN_RIGHT|SDRVERTALIGN_BOTTOM );
+ break;
+// case SDRHORZALIGN_LEFT:
+ default:
+ rSdrGlue.SetAlign( SDRHORZALIGN_LEFT );
+ break;
+ }
+ switch( rUnoGlue.Escape )
+ {
+ case drawing::EscapeDirection_LEFT:
+ rSdrGlue.SetEscDir(SDRESC_LEFT);
+ break;
+ case drawing::EscapeDirection_RIGHT:
+ rSdrGlue.SetEscDir(SDRESC_RIGHT);
+ break;
+ case drawing::EscapeDirection_UP:
+ rSdrGlue.SetEscDir(SDRESC_TOP);
+ break;
+ case drawing::EscapeDirection_DOWN:
+ rSdrGlue.SetEscDir(SDRESC_BOTTOM);
+ break;
+ case drawing::EscapeDirection_HORIZONTAL:
+ rSdrGlue.SetEscDir(SDRESC_HORZ);
+ break;
+ case drawing::EscapeDirection_VERTICAL:
+ rSdrGlue.SetEscDir(SDRESC_VERT);
+ break;
+// case drawing::EscapeDirection_SMART:
+ default:
+ rSdrGlue.SetEscDir(SDRESC_SMART);
+ break;
+ }
+}
+
+SvxUnoGluePointAccess::SvxUnoGluePointAccess( SdrObject* pObject ) throw()
+: mpObject( pObject )
+{
+}
+
+SvxUnoGluePointAccess::~SvxUnoGluePointAccess() throw()
+{
+}
+
+// XIdentifierContainer
+sal_Int32 SAL_CALL SvxUnoGluePointAccess::insert( const uno::Any& aElement ) throw (lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( mpObject.is() )
+ {
+ SdrGluePointList* pList = mpObject->ForceGluePointList();
+ if( pList )
+ {
+ // second, insert the new glue point
+ drawing::GluePoint2 aUnoGlue;
+
+ if( aElement >>= aUnoGlue )
+ {
+ SdrGluePoint aSdrGlue;
+ convert( aUnoGlue, aSdrGlue );
+ sal_uInt16 nId = pList->Insert( aSdrGlue );
+
+ // only repaint, no objectchange
+ mpObject->ActionChanged();
+ // mpObject->BroadcastObjectChange();
+
+ return (sal_Int32)((*pList)[nId].GetId() + NON_USER_DEFINED_GLUE_POINTS) - 1;
+ }
+
+ throw lang::IllegalArgumentException();
+ }
+ }
+
+ return -1;
+}
+
+void SAL_CALL SvxUnoGluePointAccess::removeByIdentifier( sal_Int32 Identifier ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( mpObject.is() && ( Identifier >= NON_USER_DEFINED_GLUE_POINTS ))
+ {
+ const sal_uInt16 nId = (sal_uInt16)(Identifier - NON_USER_DEFINED_GLUE_POINTS) + 1;
+
+ SdrGluePointList* pList = const_cast<SdrGluePointList*>(mpObject->GetGluePointList());
+ const sal_uInt16 nCount = pList ? pList->GetCount() : 0;
+ sal_uInt16 i;
+
+ for( i = 0; i < nCount; i++ )
+ {
+ if( (*pList)[i].GetId() == nId )
+ {
+ pList->Delete( i );
+
+ // only repaint, no objectchange
+ mpObject->ActionChanged();
+ // mpObject->BroadcastObjectChange();
+
+ return;
+ }
+ }
+ }
+
+ throw container::NoSuchElementException();
+}
+
+// XIdentifierReplace
+void SAL_CALL SvxUnoGluePointAccess::replaceByIdentifer( sal_Int32 Identifier, const uno::Any& aElement ) throw (lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( mpObject.is() && mpObject->IsNode() )
+ {
+ struct drawing::GluePoint2 aGluePoint;
+ if( (Identifier < NON_USER_DEFINED_GLUE_POINTS) || !(aElement >>= aGluePoint))
+ throw lang::IllegalArgumentException();
+
+ const sal_uInt16 nId = (sal_uInt16)( Identifier - NON_USER_DEFINED_GLUE_POINTS ) + 1;
+
+ SdrGluePointList* pList = const_cast< SdrGluePointList* >( mpObject->GetGluePointList() );
+ const sal_uInt16 nCount = pList ? pList->GetCount() : 0;
+ sal_uInt16 i;
+ for( i = 0; i < nCount; i++ )
+ {
+ if( (*pList)[i].GetId() == nId )
+ {
+ // change the glue point
+ SdrGluePoint& rTempPoint = (*pList)[i];
+ convert( aGluePoint, rTempPoint );
+
+ // only repaint, no objectchange
+ mpObject->ActionChanged();
+ // mpObject->BroadcastObjectChange();
+
+ return;
+ }
+ }
+
+ throw container::NoSuchElementException();
+ }
+}
+
+// XIdentifierAccess
+uno::Any SAL_CALL SvxUnoGluePointAccess::getByIdentifier( sal_Int32 Identifier ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( mpObject.is() && mpObject->IsNode() )
+ {
+ struct drawing::GluePoint2 aGluePoint;
+
+ if( Identifier < NON_USER_DEFINED_GLUE_POINTS ) // default glue point?
+ {
+ SdrGluePoint aTempPoint = mpObject->GetVertexGluePoint( (sal_uInt16)Identifier );
+ aGluePoint.IsUserDefined = sal_False;
+ convert( aTempPoint, aGluePoint );
+ return uno::makeAny( aGluePoint );
+ }
+ else
+ {
+ const sal_uInt16 nId = (sal_uInt16)( Identifier - NON_USER_DEFINED_GLUE_POINTS ) + 1;
+
+ const SdrGluePointList* pList = mpObject->GetGluePointList();
+ const sal_uInt16 nCount = pList ? pList->GetCount() : 0;
+ for( sal_uInt16 i = 0; i < nCount; i++ )
+ {
+ const SdrGluePoint& rTempPoint = (*pList)[i];
+ if( rTempPoint.GetId() == nId )
+ {
+ // #i38892#
+ if(rTempPoint.IsUserDefined())
+ {
+ aGluePoint.IsUserDefined = sal_True;
+ }
+
+ convert( rTempPoint, aGluePoint );
+ return uno::makeAny( aGluePoint );
+ }
+ }
+ }
+ }
+
+ throw lang::IndexOutOfBoundsException();
+}
+
+uno::Sequence< sal_Int32 > SAL_CALL SvxUnoGluePointAccess::getIdentifiers() throw (uno::RuntimeException)
+{
+ if( mpObject.is() )
+ {
+ const SdrGluePointList* pList = mpObject->GetGluePointList();
+ const sal_uInt16 nCount = pList ? pList->GetCount() : 0;
+
+ sal_uInt16 i;
+
+ 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 < nCount; i++ )
+ *pIdentifier++ = (sal_Int32) ( (*pList)[i].GetId() + NON_USER_DEFINED_GLUE_POINTS ) - 1;
+
+ return aIdSequence;
+ }
+ else
+ {
+ uno::Sequence< sal_Int32 > aEmpty;
+ return aEmpty;
+ }
+}
+
+/* deprecated */
+
+// XIndexContainer
+void SAL_CALL SvxUnoGluePointAccess::insertByIndex( sal_Int32, const uno::Any& Element )
+ throw(lang::IllegalArgumentException, lang::IndexOutOfBoundsException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( mpObject.is() )
+ {
+ SdrGluePointList* pList = mpObject->ForceGluePointList();
+ if( pList )
+ {
+ SdrGluePoint aSdrGlue;
+ drawing::GluePoint2 aUnoGlue;
+
+ if( Element >>= aUnoGlue )
+ {
+ convert( aUnoGlue, aSdrGlue );
+ pList->Insert( aSdrGlue );
+
+ // only repaint, no objectchange
+ mpObject->ActionChanged();
+ // mpObject->BroadcastObjectChange();
+
+ return;
+ }
+
+ throw lang::IllegalArgumentException();
+ }
+ }
+
+ throw lang::IndexOutOfBoundsException();
+}
+
+void SAL_CALL SvxUnoGluePointAccess::removeByIndex( sal_Int32 Index )
+ throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( mpObject.is() )
+ {
+ SdrGluePointList* pList = mpObject->ForceGluePointList();
+ if( pList )
+ {
+ Index -= 4;
+ if( Index >= 0 && Index < pList->GetCount() )
+ {
+ pList->Delete( (sal_uInt16)Index );
+
+ // only repaint, no objectchange
+ mpObject->ActionChanged();
+ // mpObject->BroadcastObjectChange();
+
+ return;
+ }
+ }
+ }
+
+ throw lang::IndexOutOfBoundsException();
+}
+
+// XIndexReplace
+void SAL_CALL SvxUnoGluePointAccess::replaceByIndex( sal_Int32 Index, const uno::Any& Element )
+ throw(lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ drawing::GluePoint2 aUnoGlue;
+ if(!(Element >>= aUnoGlue))
+ throw lang::IllegalArgumentException();
+
+ Index -= 4;
+ if( mpObject.is() && Index >= 0 )
+ {
+ SdrGluePointList* pList = const_cast< SdrGluePointList* >( mpObject->GetGluePointList() );
+ if( pList && Index < pList->GetCount() )
+ {
+ SdrGluePoint& rGlue = (*pList)[(sal_uInt16)Index];
+ convert( aUnoGlue, rGlue );
+
+ // only repaint, no objectchange
+ mpObject->ActionChanged();
+ // mpObject->BroadcastObjectChange();
+ }
+ }
+
+ throw lang::IndexOutOfBoundsException();
+}
+
+// XIndexAccess
+sal_Int32 SAL_CALL SvxUnoGluePointAccess::getCount()
+ throw(uno::RuntimeException)
+{
+ sal_Int32 nCount = 0;
+ if( mpObject.is() )
+ {
+ // each node has a default of 4 glue points
+ // and any number of user defined glue points
+ if( mpObject->IsNode() )
+ {
+ nCount += 4;
+
+ const SdrGluePointList* pList = mpObject->GetGluePointList();
+ if( pList )
+ nCount += pList->GetCount();
+ }
+ }
+
+ return nCount;
+}
+
+uno::Any SAL_CALL SvxUnoGluePointAccess::getByIndex( sal_Int32 Index )
+ throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( Index >= 0 && mpObject.is() && mpObject->IsNode() )
+ {
+ struct drawing::GluePoint2 aGluePoint;
+
+ if( Index < 4 ) // default glue point?
+ {
+ SdrGluePoint aTempPoint = mpObject->GetVertexGluePoint( (sal_uInt16)Index );
+ aGluePoint.IsUserDefined = sal_False;
+ convert( aTempPoint, aGluePoint );
+ uno::Any aAny;
+ aAny <<= aGluePoint;
+ return aAny;
+ }
+ else
+ {
+ Index -= 4;
+ const SdrGluePointList* pList = mpObject->GetGluePointList();
+ if( pList && Index < pList->GetCount() )
+ {
+ const SdrGluePoint& rTempPoint = (*pList)[(sal_uInt16)Index];
+ aGluePoint.IsUserDefined = sal_True;
+ convert( rTempPoint, aGluePoint );
+ uno::Any aAny;
+ aAny <<= aGluePoint;
+ return aAny;
+ }
+ }
+ }
+
+ throw lang::IndexOutOfBoundsException();
+}
+
+// XElementAccess
+uno::Type SAL_CALL SvxUnoGluePointAccess::getElementType()
+ throw( uno::RuntimeException)
+{
+ return ::getCppuType((const struct drawing::GluePoint2*)0);
+}
+
+sal_Bool SAL_CALL SvxUnoGluePointAccess::hasElements()
+ throw( uno::RuntimeException)
+{
+ return mpObject.is() && mpObject->IsNode();
+}
+
+/**
+ * Create a SvxUnoGluePointAccess
+ */
+uno::Reference< uno::XInterface > SAL_CALL SvxUnoGluePointAccess_createInstance( SdrObject* pObject )
+{
+ return *new SvxUnoGluePointAccess(pObject);
+}
diff --git a/svx/source/unodraw/recoveryui.cxx b/svx/source/unodraw/recoveryui.cxx
new file mode 100644
index 000000000000..a945105a5eba
--- /dev/null
+++ b/svx/source/unodraw/recoveryui.cxx
@@ -0,0 +1,399 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+//===============================================
+// includes
+#include "recoveryui.hxx"
+#include "docrecovery.hxx"
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/frame/XFramesSupplier.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <osl/file.hxx>
+#include <rtl/bootstrap.hxx>
+#include <comphelper/configurationhelper.hxx>
+
+#include <vcl/svapp.hxx>
+
+//===============================================
+// const
+
+#define IMPLEMENTATIONNAME_RECOVERYUI ::rtl::OUString::createFromAscii("com.sun.star.comp.svx.RecoveryUI")
+#define SERVICENAME_RECOVERYUI ::rtl::OUString::createFromAscii("com.sun.star.dialog.RecoveryUI")
+
+//===============================================
+// namespace
+
+namespace svx
+{
+
+namespace css = ::com::sun::star;
+namespace svxdr = ::svx::DocRecovery;
+
+using namespace ::rtl;
+using namespace ::osl;
+
+//===============================================
+RecoveryUI::RecoveryUI(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
+ : m_xSMGR (xSMGR )
+ , m_pParentWindow(0 )
+ , m_eJob (RecoveryUI::E_JOB_UNKNOWN)
+{
+}
+
+//===============================================
+RecoveryUI::~RecoveryUI()
+{
+}
+
+//===============================================
+::rtl::OUString SAL_CALL RecoveryUI::getImplementationName()
+ throw(css::uno::RuntimeException)
+{
+ return RecoveryUI::st_getImplementationName();
+}
+
+//===============================================
+sal_Bool SAL_CALL RecoveryUI::supportsService(const ::rtl::OUString& sServiceName)
+ throw(css::uno::RuntimeException)
+{
+ const css::uno::Sequence< ::rtl::OUString > lServices = RecoveryUI::st_getSupportedServiceNames();
+ sal_Int32 c = lServices.getLength();
+ sal_Int32 i = 0;
+ for (i=0; i<c; ++i)
+ {
+ const ::rtl::OUString& sSupportedService = lServices[i];
+ if (sSupportedService.equals(sServiceName))
+ return sal_True;
+ }
+ return sal_False;
+}
+
+//===============================================
+css::uno::Sequence< ::rtl::OUString > SAL_CALL RecoveryUI::getSupportedServiceNames()
+ throw(css::uno::RuntimeException)
+{
+ return RecoveryUI::st_getSupportedServiceNames();
+}
+
+//===============================================
+css::uno::Any SAL_CALL RecoveryUI::dispatchWithReturnValue(const css::util::URL& aURL,
+ const css::uno::Sequence< css::beans::PropertyValue >& )
+ throw(css::uno::RuntimeException)
+{
+ // Internaly we use VCL ... every call into vcl based code must
+ // be guarded by locking the global solar mutex.
+ ::vos::OGuard aSolarLock(&Application::GetSolarMutex());
+
+ css::uno::Any aRet;
+ RecoveryUI::EJob eJob = impl_classifyJob(aURL);
+ // TODO think about outside arguments
+
+ switch(eJob)
+ {
+ case RecoveryUI::E_DO_EMERGENCY_SAVE :
+ {
+ sal_Bool bRet = impl_doEmergencySave();
+ aRet <<= bRet;
+ break;
+ }
+
+ case RecoveryUI::E_DO_RECOVERY :
+ impl_doRecovery();
+ break;
+
+ case RecoveryUI::E_DO_CRASHREPORT :
+ impl_doCrashReport();
+ break;
+
+ default :
+ break;
+ }
+
+ return aRet;
+}
+
+//===============================================
+void SAL_CALL RecoveryUI::dispatch(const css::util::URL& aURL ,
+ const css::uno::Sequence< css::beans::PropertyValue >& lArguments)
+ throw(css::uno::RuntimeException)
+{
+ // recycle this method :-)
+ dispatchWithReturnValue(aURL, lArguments);
+}
+
+//===============================================
+void SAL_CALL RecoveryUI::addStatusListener(const css::uno::Reference< css::frame::XStatusListener >&, const css::util::URL& ) throw(css::uno::RuntimeException)
+{
+ // TODO
+ OSL_ENSURE(sal_False, "RecoveryUI::addStatusListener()\nNot implemented yet!");
+}
+
+//===============================================
+void SAL_CALL RecoveryUI::removeStatusListener(const css::uno::Reference< css::frame::XStatusListener >&, const css::util::URL& )
+ throw(css::uno::RuntimeException)
+{
+ // TODO
+ OSL_ENSURE(sal_False, "RecoveryUI::removeStatusListener()\nNot implemented yet!");
+}
+
+//===============================================
+::rtl::OUString RecoveryUI::st_getImplementationName()
+{
+ static ::rtl::OUString IMPLEMENTATIONNAME = IMPLEMENTATIONNAME_RECOVERYUI;
+ return IMPLEMENTATIONNAME;
+}
+
+//===============================================
+css::uno::Sequence< ::rtl::OUString > RecoveryUI::st_getSupportedServiceNames()
+{
+ css::uno::Sequence< ::rtl::OUString > lServiceNames(1); lServiceNames.getArray() [0] = SERVICENAME_RECOVERYUI;
+ return lServiceNames;
+}
+
+//===============================================
+css::uno::Reference< css::uno::XInterface > SAL_CALL RecoveryUI::st_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
+{
+ RecoveryUI* pNew = new RecoveryUI(xSMGR);
+ return css::uno::Reference< css::uno::XInterface >(static_cast< css::lang::XServiceInfo* >(pNew));
+}
+
+//===============================================
+
+static OUString GetCrashConfigDir()
+{
+
+#if defined(WNT) || defined(OS2)
+ OUString ustrValue = OUString::createFromAscii("${$BRAND_BASE_DIR/program/bootstrap.ini:UserInstallation}");
+#elif defined(MACOSX)
+ OUString ustrValue = OUString::createFromAscii("~");
+#else
+ OUString ustrValue = OUString::createFromAscii("$SYSUSERCONFIG");
+#endif
+ Bootstrap::expandMacros( ustrValue );
+
+#if defined(WNT) || defined(OS2)
+ ustrValue += OUString::createFromAscii("/user/crashdata");
+#endif
+ return ustrValue;
+}
+
+//===============================================
+
+#if defined(WNT) || defined(OS2)
+#define LCKFILE "crashdat.lck"
+#else
+#define LCKFILE ".crash_report_unsent"
+#endif
+
+
+static OUString GetUnsentURL()
+{
+ OUString aURL = GetCrashConfigDir();
+
+ aURL += OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
+ aURL += OUString( RTL_CONSTASCII_USTRINGPARAM( LCKFILE ) );
+
+ return aURL;
+}
+
+//===============================================
+
+static bool new_crash_pending()
+{
+ OUString aUnsentURL = GetUnsentURL();
+ File aFile( aUnsentURL );
+
+ if ( FileBase::E_None == aFile.open( OpenFlag_Read ) )
+ {
+ aFile.close();
+ return true;
+ }
+
+ return false;
+}
+//===============================================
+
+static bool delete_pending_crash()
+{
+ OUString aUnsentURL = GetUnsentURL();
+ return ( FileBase::E_None == File::remove( aUnsentURL ) );
+}
+
+RecoveryUI::EJob RecoveryUI::impl_classifyJob(const css::util::URL& aURL)
+{
+ m_eJob = RecoveryUI::E_JOB_UNKNOWN;
+ if (aURL.Protocol.equals(RECOVERY_CMDPART_PROTOCOL))
+ {
+ if (aURL.Path.equals(RECOVERY_CMDPART_DO_EMERGENCY_SAVE))
+ m_eJob = RecoveryUI::E_DO_EMERGENCY_SAVE;
+ else
+ if (aURL.Path.equals(RECOVERY_CMDPART_DO_RECOVERY))
+ m_eJob = RecoveryUI::E_DO_RECOVERY;
+ else
+ if (aURL.Path.equals(RECOVERY_CMDPART_DO_CRASHREPORT))
+ m_eJob = RecoveryUI::E_DO_CRASHREPORT;
+ }
+
+ return m_eJob;
+}
+
+//===============================================
+sal_Bool RecoveryUI::impl_doEmergencySave()
+{
+ // create core service, which implements the real "emergency save" algorithm.
+ svxdr::RecoveryCore* pCore = new svxdr::RecoveryCore(m_xSMGR, sal_True);
+ css::uno::Reference< css::frame::XStatusListener > xCore(pCore);
+
+ // create all needed dialogs for this operation
+ // and bind it to the used core service
+ svxdr::TabDialog4Recovery* pWizard = new svxdr::TabDialog4Recovery(m_pParentWindow);
+ svxdr::IExtendedTabPage* pPage1 = new svxdr::SaveDialog (pWizard, pCore );
+ pWizard->addTabPage(pPage1);
+
+ // start the wizard
+ short nRet = pWizard->Execute();
+
+ delete pPage1 ;
+ delete pWizard;
+
+ return (nRet==DLG_RET_OK_AUTOLUNCH);
+}
+
+//===============================================
+void RecoveryUI::impl_doRecovery()
+{
+ sal_Bool bRecoveryOnly( sal_False );
+
+ ::rtl::OUString CFG_PACKAGE_RECOVERY( RTL_CONSTASCII_USTRINGPARAM ( "org.openoffice.Office.Recovery/" ));
+ ::rtl::OUString CFG_PATH_CRASHREPORTER( RTL_CONSTASCII_USTRINGPARAM( "CrashReporter" ));
+ ::rtl::OUString CFG_ENTRY_ENABLED( RTL_CONSTASCII_USTRINGPARAM ( "Enabled" ));
+
+ sal_Bool bCrashRepEnabled( sal_True );
+ css::uno::Any aVal = ::comphelper::ConfigurationHelper::readDirectKey(
+ m_xSMGR,
+ CFG_PACKAGE_RECOVERY,
+ CFG_PATH_CRASHREPORTER,
+ CFG_ENTRY_ENABLED,
+ ::comphelper::ConfigurationHelper::E_READONLY);
+ aVal >>= bCrashRepEnabled;
+ bRecoveryOnly = !bCrashRepEnabled;
+
+ // create core service, which implements the real "emergency save" algorithm.
+ svxdr::RecoveryCore* pCore = new svxdr::RecoveryCore(m_xSMGR, sal_False);
+ css::uno::Reference< css::frame::XStatusListener > xCore(pCore);
+
+ // create all needed dialogs for this operation
+ // and bind it to the used core service
+ svxdr::TabDialog4Recovery* pWizard = new svxdr::TabDialog4Recovery (m_pParentWindow);
+ svxdr::IExtendedTabPage* pPage1 = new svxdr::RecoveryDialog (pWizard, pCore );
+ svxdr::IExtendedTabPage* pPage2 = 0;
+ svxdr::IExtendedTabPage* pPage3 = 0;
+
+ pWizard->addTabPage(pPage1);
+ if ( !bRecoveryOnly && new_crash_pending() )
+ {
+ pPage2 = new svxdr::ErrorRepWelcomeDialog(pWizard );
+ pPage3 = new svxdr::ErrorRepSendDialog (pWizard );
+ pWizard->addTabPage(pPage2);
+ pWizard->addTabPage(pPage3);
+ }
+
+ // start the wizard
+ pWizard->Execute();
+
+ impl_showAllRecoveredDocs();
+
+ delete pPage3 ;
+ delete pPage2 ;
+ delete pPage1 ;
+ delete pWizard;
+
+ delete_pending_crash();
+}
+
+//===============================================
+
+void RecoveryUI::impl_doCrashReport()
+{
+ if ( new_crash_pending() )
+ {
+ svxdr::TabDialog4Recovery* pWizard = new svxdr::TabDialog4Recovery (m_pParentWindow );
+ svxdr::IExtendedTabPage* pPage1 = new svxdr::ErrorRepWelcomeDialog(pWizard, sal_False);
+ svxdr::IExtendedTabPage* pPage2 = new svxdr::ErrorRepSendDialog (pWizard );
+ pWizard->addTabPage(pPage1);
+ pWizard->addTabPage(pPage2);
+
+ // start the wizard
+ pWizard->Execute();
+
+ delete pPage2 ;
+ delete pPage1 ;
+ delete pWizard;
+
+ delete_pending_crash();
+ }
+}
+
+//===============================================
+void RecoveryUI::impl_showAllRecoveredDocs()
+{
+ css::uno::Reference< css::frame::XFramesSupplier > xDesktop(
+ m_xSMGR->createInstance(SERVICENAME_DESKTOP),
+ css::uno::UNO_QUERY_THROW);
+
+ css::uno::Reference< css::container::XIndexAccess > xTaskContainer(
+ xDesktop->getFrames(),
+ css::uno::UNO_QUERY_THROW);
+
+ sal_Int32 c = xTaskContainer->getCount();
+ sal_Int32 i = 0;
+ for (i=0; i<c; ++i)
+ {
+ try
+ {
+ css::uno::Reference< css::frame::XFrame > xTask;
+ xTaskContainer->getByIndex(i) >>= xTask;
+ if (!xTask.is())
+ continue;
+
+ css::uno::Reference< css::awt::XWindow > xWindow = xTask->getContainerWindow();
+ if (!xWindow.is())
+ continue;
+
+ xWindow->setVisible(sal_True);
+ }
+ catch(const css::uno::RuntimeException& exRun)
+ { throw exRun; }
+ catch(const css::uno::Exception&)
+ { continue; }
+ }
+}
+
+} // namespace svx
diff --git a/svx/source/unodraw/shapeimpl.hxx b/svx/source/unodraw/shapeimpl.hxx
new file mode 100644
index 000000000000..d59d13e94795
--- /dev/null
+++ b/svx/source/unodraw/shapeimpl.hxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_SHAPEIMPL_HXX
+#define _SVX_SHAPEIMPL_HXX
+
+#include <svx/unoshape.hxx>
+
+class SvGlobalName;
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+class SvxShapeCaption : public SvxShapeText
+{
+public:
+ SvxShapeCaption( SdrObject* pObj ) throw();
+ virtual ~SvxShapeCaption() throw();
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+class SvxPluginShape : public SvxOle2Shape
+{
+protected:
+ // overide these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+public:
+ SvxPluginShape( SdrObject* pObj ) throw();
+ virtual ~SvxPluginShape() throw();
+
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage = NULL );
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+class SvxAppletShape : public SvxOle2Shape
+{
+protected:
+ // overide these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+public:
+ SvxAppletShape( SdrObject* pObj ) throw();
+ virtual ~SvxAppletShape() throw();
+
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage = NULL );
+};
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+class SvxFrameShape : public SvxOle2Shape
+{
+protected:
+ // overide these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+public:
+ SvxFrameShape( SdrObject* pObj ) throw();
+ virtual ~SvxFrameShape() throw();
+
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage = NULL ) throw ();
+};
+
+
+// ====================================================================
+
+class SvxTableShape : public SvxShape
+{
+protected:
+ // overide these for special property handling in subcasses. Return true if property is handled
+ virtual bool setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual bool getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void lock();
+ virtual void unlock();
+
+public:
+
+ SvxTableShape( SdrObject* pObj ) throw();
+ virtual ~SvxTableShape() throw();
+};
+
+#endif
+
+
diff --git a/svx/source/unodraw/shapepropertynotifier.cxx b/svx/source/unodraw/shapepropertynotifier.cxx
new file mode 100644
index 000000000000..408587d31822
--- /dev/null
+++ b/svx/source/unodraw/shapepropertynotifier.cxx
@@ -0,0 +1,207 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svx/shapepropertynotifier.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/beans/XPropertySet.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/stl_types.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <cppuhelper/weak.hxx>
+#include <tools/diagnose_ex.h>
+
+#include <hash_map>
+
+namespace
+{
+
+ struct ShapePropertyHash
+ {
+ size_t operator()( ::svx::ShapeProperty __x ) const
+ {
+ return size_t( __x );
+ }
+ };
+}
+
+//........................................................................
+namespace svx
+{
+//........................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::beans::PropertyChangeEvent;
+ using ::com::sun::star::beans::XPropertyChangeListener;
+ using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::beans::XPropertySet;
+ /** === end UNO using === **/
+
+ typedef ::std::hash_map< ShapeProperty, PPropertyValueProvider, ShapePropertyHash > PropertyProviders;
+
+ typedef ::cppu::OMultiTypeInterfaceContainerHelperVar < ::rtl::OUString
+ , ::comphelper::UStringHash
+ , ::comphelper::UStringEqual
+ > PropertyChangeListenerContainer;
+
+ //====================================================================
+ //= IPropertyValueProvider
+ //====================================================================
+ IPropertyValueProvider::~IPropertyValueProvider()
+ {
+ }
+
+ //====================================================================
+ //= PropertyChangeNotifier_Data
+ //====================================================================
+ struct PropertyChangeNotifier_Data
+ {
+ ::cppu::OWeakObject& m_rContext;
+ PropertyProviders m_aProviders;
+ PropertyChangeListenerContainer m_aPropertyChangeListeners;
+
+ PropertyChangeNotifier_Data( ::cppu::OWeakObject& _rContext, ::osl::Mutex& _rMutex )
+ :m_rContext( _rContext )
+ ,m_aPropertyChangeListeners( _rMutex )
+ {
+ }
+ };
+ //====================================================================
+ //= PropertyValueProvider
+ //====================================================================
+ //--------------------------------------------------------------------
+ ::rtl::OUString PropertyValueProvider::getPropertyName() const
+ {
+ return m_sPropertyName;
+ }
+
+ //--------------------------------------------------------------------
+ void PropertyValueProvider::getCurrentValue( Any& _out_rValue ) const
+ {
+ Reference< XPropertySet > xContextProps( const_cast< PropertyValueProvider* >( this )->m_rContext, UNO_QUERY_THROW );
+ _out_rValue = xContextProps->getPropertyValue( getPropertyName() );
+ }
+
+ //====================================================================
+ //= PropertyChangeNotifier
+ //====================================================================
+ //--------------------------------------------------------------------
+ PropertyChangeNotifier::PropertyChangeNotifier( ::cppu::OWeakObject& _rOwner, ::osl::Mutex& _rMutex )
+ :m_pData( new PropertyChangeNotifier_Data( _rOwner, _rMutex ) )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ PropertyChangeNotifier::~PropertyChangeNotifier()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ void PropertyChangeNotifier::registerProvider( const ShapeProperty _eProperty, const PPropertyValueProvider _pProvider )
+ {
+ ENSURE_OR_THROW( _eProperty != eInvalidShapeProperty, "Illegal ShapeProperty value!" );
+ ENSURE_OR_THROW( !!_pProvider, "NULL factory not allowed." );
+
+ OSL_ENSURE( m_pData->m_aProviders.find( _eProperty ) == m_pData->m_aProviders.end(),
+ "PropertyChangeNotifier::registerProvider: factory for this ID already present!" );
+
+ m_pData->m_aProviders[ _eProperty ] = _pProvider;
+ }
+
+ //--------------------------------------------------------------------
+ void PropertyChangeNotifier::notifyPropertyChange( const ShapeProperty _eProperty ) const
+ {
+ ENSURE_OR_THROW( _eProperty != eInvalidShapeProperty, "Illegal ShapeProperty value!" );
+
+ PropertyProviders::const_iterator provPos = m_pData->m_aProviders.find( _eProperty );
+ OSL_ENSURE( provPos != m_pData->m_aProviders.end(), "PropertyChangeNotifier::notifyPropertyChange: no factory!" );
+ if ( provPos == m_pData->m_aProviders.end() )
+ return;
+
+ ::rtl::OUString sPropertyName( provPos->second->getPropertyName() );
+
+ ::cppu::OInterfaceContainerHelper* pPropListeners = m_pData->m_aPropertyChangeListeners.getContainer( sPropertyName );
+ ::cppu::OInterfaceContainerHelper* pAllListeners = m_pData->m_aPropertyChangeListeners.getContainer( ::rtl::OUString() );
+ if ( !pPropListeners && !pAllListeners )
+ return;
+
+ try
+ {
+ PropertyChangeEvent aEvent;
+ aEvent.Source = m_pData->m_rContext;
+ // Handle/OldValue not supported
+ aEvent.PropertyName = provPos->second->getPropertyName();
+ provPos->second->getCurrentValue( aEvent.NewValue );
+
+ if ( pPropListeners )
+ pPropListeners->notifyEach( &XPropertyChangeListener::propertyChange, aEvent );
+ if ( pAllListeners )
+ pAllListeners->notifyEach( &XPropertyChangeListener::propertyChange, aEvent );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void PropertyChangeNotifier::addPropertyChangeListener( const ::rtl::OUString& _rPropertyName, const Reference< XPropertyChangeListener >& _rxListener )
+ {
+ m_pData->m_aPropertyChangeListeners.addInterface( _rPropertyName, _rxListener );
+ }
+
+ //--------------------------------------------------------------------
+ void PropertyChangeNotifier::removePropertyChangeListener( const ::rtl::OUString& _rPropertyName, const Reference< XPropertyChangeListener >& _rxListener )
+ {
+ m_pData->m_aPropertyChangeListeners.removeInterface( _rPropertyName, _rxListener );
+ }
+
+ //--------------------------------------------------------------------
+ void PropertyChangeNotifier::disposing()
+ {
+ EventObject aEvent;
+ aEvent.Source = m_pData->m_rContext;
+ m_pData->m_aPropertyChangeListeners.disposeAndClear( aEvent );
+ }
+
+//........................................................................
+} // namespace svx
+//........................................................................
diff --git a/svx/source/unodraw/tableshape.cxx b/svx/source/unodraw/tableshape.cxx
new file mode 100644
index 000000000000..9bedf71db64d
--- /dev/null
+++ b/svx/source/unodraw/tableshape.cxx
@@ -0,0 +1,194 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "shapeimpl.hxx"
+#include "svx/unoshprp.hxx"
+#include "svx/svdotable.hxx"
+#include <svx/svdpool.hxx>
+
+///////////////////////////////////////////////////////////////////////
+
+using ::rtl::OUString;
+
+using namespace ::osl;
+using namespace ::cppu;
+using namespace ::sdr::table;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+
+SvxTableShape::SvxTableShape( SdrObject* pObj ) throw()
+: SvxShape( pObj, aSvxMapProvider.GetMap(SVXMAP_TABLE), aSvxMapProvider.GetPropertySet(SVXMAP_TABLE, SdrObject::GetGlobalDrawObjectItemPool()) )
+{
+ SetShapeType( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.TableShape" ) ) );
+}
+
+//----------------------------------------------------------------------
+SvxTableShape::~SvxTableShape() throw()
+{
+}
+
+//----------------------------------------------------------------------
+
+bool SvxTableShape::setPropertyValueImpl(
+ const ::rtl::OUString& rName,
+ const SfxItemPropertySimpleEntry* pProperty,
+ const ::com::sun::star::uno::Any& rValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ switch( pProperty->nWID )
+ {
+ case OWN_ATTR_TABLETEMPLATE:
+ {
+ Reference< XIndexAccess > xTemplate;
+
+ if( !(rValue >>= xTemplate) )
+ throw IllegalArgumentException();
+
+ if( mpObj.is() )
+ static_cast< sdr::table::SdrTableObj* >( mpObj.get() )->setTableStyle(xTemplate);
+
+ return true;
+ }
+ case OWN_ATTR_TABLETEMPLATE_FIRSTROW:
+ case OWN_ATTR_TABLETEMPLATE_LASTROW:
+ case OWN_ATTR_TABLETEMPLATE_FIRSTCOLUMN:
+ case OWN_ATTR_TABLETEMPLATE_LASTCOLUMN:
+ case OWN_ATTR_TABLETEMPLATE_BANDINGROWS:
+ case OWN_ATTR_TABLETEMPLATE_BANDINGCOULUMNS:
+ {
+ if( mpObj.is() )
+ {
+ TableStyleSettings aSettings( static_cast< sdr::table::SdrTableObj* >( mpObj.get() )->getTableStyleSettings() );
+
+ switch( pProperty->nWID )
+ {
+ case OWN_ATTR_TABLETEMPLATE_FIRSTROW: rValue >>= aSettings.mbUseFirstRow; break;
+ case OWN_ATTR_TABLETEMPLATE_LASTROW: rValue >>= aSettings.mbUseLastRow; break;
+ case OWN_ATTR_TABLETEMPLATE_FIRSTCOLUMN: rValue >>= aSettings.mbUseFirstColumn; break;
+ case OWN_ATTR_TABLETEMPLATE_LASTCOLUMN: rValue >>= aSettings.mbUseLastColumn; break;
+ case OWN_ATTR_TABLETEMPLATE_BANDINGROWS: rValue >>= aSettings.mbUseRowBanding; break;
+ case OWN_ATTR_TABLETEMPLATE_BANDINGCOULUMNS: rValue >>= aSettings.mbUseColumnBanding; break;
+ }
+
+ static_cast< sdr::table::SdrTableObj* >( mpObj.get() )->setTableStyleSettings(aSettings);
+ }
+
+ return true;
+ }
+ default:
+ {
+ return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
+ }
+ }
+}
+
+extern Graphic SvxGetGraphicForShape( SdrObject& rShape, bool bVector );
+
+bool SvxTableShape::getPropertyValueImpl(
+ const ::rtl::OUString& rName,
+ const SfxItemPropertySimpleEntry* pProperty,
+ ::com::sun::star::uno::Any& rValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ switch( pProperty->nWID )
+ {
+ case OWN_ATTR_OLEMODEL:
+ {
+ if( mpObj.is() )
+ {
+ rValue <<= static_cast< sdr::table::SdrTableObj* >( mpObj.get() )->getTable();
+ }
+ return true;
+ }
+ case OWN_ATTR_TABLETEMPLATE:
+ {
+ if( mpObj.is() )
+ {
+ rValue <<= static_cast< sdr::table::SdrTableObj* >( mpObj.get() )->getTableStyle();
+ }
+ return true;
+ }
+ case OWN_ATTR_BITMAP:
+ {
+ if( mpObj.is() )
+ {
+ Graphic aGraphic( SvxGetGraphicForShape( *mpObj.get(), true ) );
+ rValue <<= aGraphic.GetXGraphic();
+ }
+ return true;
+ }
+ case OWN_ATTR_TABLETEMPLATE_FIRSTROW:
+ case OWN_ATTR_TABLETEMPLATE_LASTROW:
+ case OWN_ATTR_TABLETEMPLATE_FIRSTCOLUMN:
+ case OWN_ATTR_TABLETEMPLATE_LASTCOLUMN:
+ case OWN_ATTR_TABLETEMPLATE_BANDINGROWS:
+ case OWN_ATTR_TABLETEMPLATE_BANDINGCOULUMNS:
+ {
+ if( mpObj.is() )
+ {
+ TableStyleSettings aSettings( static_cast< sdr::table::SdrTableObj* >( mpObj.get() )->getTableStyleSettings() );
+
+ switch( pProperty->nWID )
+ {
+ case OWN_ATTR_TABLETEMPLATE_FIRSTROW: rValue <<= aSettings.mbUseFirstRow; break;
+ case OWN_ATTR_TABLETEMPLATE_LASTROW: rValue <<= aSettings.mbUseLastRow; break;
+ case OWN_ATTR_TABLETEMPLATE_FIRSTCOLUMN: rValue <<= aSettings.mbUseFirstColumn; break;
+ case OWN_ATTR_TABLETEMPLATE_LASTCOLUMN: rValue <<= aSettings.mbUseLastColumn; break;
+ case OWN_ATTR_TABLETEMPLATE_BANDINGROWS: rValue <<= aSettings.mbUseRowBanding; break;
+ case OWN_ATTR_TABLETEMPLATE_BANDINGCOULUMNS: rValue <<= aSettings.mbUseColumnBanding; break;
+ }
+ }
+
+ return true;
+ }
+ default:
+ {
+ return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
+ }
+ }
+}
+
+void SvxTableShape::lock()
+{
+ SvxShape::lock();
+ if( mpObj.is() )
+ static_cast< sdr::table::SdrTableObj* >( mpObj.get() )->uno_lock();
+}
+
+void SvxTableShape::unlock()
+{
+ if( mpObj.is() )
+ static_cast< sdr::table::SdrTableObj* >( mpObj.get() )->uno_unlock();
+ SvxShape::unlock();
+}
+
diff --git a/svx/source/unodraw/unobtabl.cxx b/svx/source/unodraw/unobtabl.cxx
new file mode 100644
index 000000000000..793e9a6d858b
--- /dev/null
+++ b/svx/source/unodraw/unobtabl.cxx
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svl/itempool.hxx>
+#include <vcl/cvtgrf.hxx>
+#include <svl/itemset.hxx>
+#include <svx/xit.hxx>
+#include "UnoNameItemTable.hxx"
+
+#include <svx/xbtmpit.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/xflhtit.hxx>
+#include "svx/unoapi.hxx"
+#include <svx/unomid.hxx>
+#include <editeng/unoprnms.hxx>
+#include "svx/unofill.hxx"
+#include <editeng/memberids.hrc>
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+using namespace ::cppu;
+
+class SvxUnoBitmapTable : public SvxUnoNameItemTable
+{
+public:
+ SvxUnoBitmapTable( SdrModel* pModel ) throw();
+ virtual ~SvxUnoBitmapTable() throw();
+
+ virtual NameOrIndex* createItem() const throw();
+ virtual bool isValid( const NameOrIndex* pItem ) const;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw( uno::RuntimeException );
+ virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw( uno::RuntimeException);
+
+ // XElementAccess
+ virtual uno::Type SAL_CALL getElementType( ) throw( uno::RuntimeException);
+};
+
+SvxUnoBitmapTable::SvxUnoBitmapTable( SdrModel* pModel ) throw()
+: SvxUnoNameItemTable( pModel, XATTR_FILLBITMAP, MID_GRAFURL )
+{
+}
+
+SvxUnoBitmapTable::~SvxUnoBitmapTable() throw()
+{
+}
+
+bool SvxUnoBitmapTable::isValid( const NameOrIndex* pItem ) const
+{
+ if( SvxUnoNameItemTable::isValid( pItem ) )
+ {
+ const XFillBitmapItem* pBitmapItem = dynamic_cast< const XFillBitmapItem* >( pItem );
+ if( pBitmapItem )
+ {
+ const GraphicObject& rGraphic = pBitmapItem->GetBitmapValue().GetGraphicObject();
+ return rGraphic.GetSizeBytes() > 0;
+ }
+ }
+
+ return false;
+}
+
+OUString SAL_CALL SvxUnoBitmapTable::getImplementationName() throw( uno::RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoBitmapTable") );
+}
+
+uno::Sequence< OUString > SAL_CALL SvxUnoBitmapTable::getSupportedServiceNames( )
+ throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aSNS( 1 );
+ aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.BitmapTable" ));
+ return aSNS;
+}
+
+NameOrIndex* SvxUnoBitmapTable::createItem() const throw()
+{
+ return new XFillBitmapItem();
+}
+
+// XElementAccess
+uno::Type SAL_CALL SvxUnoBitmapTable::getElementType( )
+ throw( uno::RuntimeException )
+{
+ return ::getCppuType( (const ::rtl::OUString*)0 );
+}
+
+/**
+ * Create a bitmaptable
+ */
+uno::Reference< uno::XInterface > SAL_CALL SvxUnoBitmapTable_createInstance( SdrModel* pModel )
+{
+ return *new SvxUnoBitmapTable(pModel);
+}
+
diff --git a/svx/source/unodraw/unoctabl.cxx b/svx/source/unodraw/unoctabl.cxx
new file mode 100644
index 000000000000..6b54a1458307
--- /dev/null
+++ b/svx/source/unodraw/unoctabl.cxx
@@ -0,0 +1,393 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <unotools/pathoptions.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <cppuhelper/implbase2.hxx>
+
+#include "../customshapes/EnhancedCustomShapeEngine.hxx"
+
+#include <svx/xtable.hxx>
+#include "svx/unoshcol.hxx"
+#include "recoveryui.hxx"
+#include "svx/xmlgrhlp.hxx"
+#include "tbunocontroller.hxx"
+#include "tbunosearchcontrollers.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+using namespace ::cppu;
+
+class SvxUnoColorTable : public WeakImplHelper2< container::XNameContainer, lang::XServiceInfo >
+{
+private:
+ XColorTable* pTable;
+
+public:
+ SvxUnoColorTable() throw();
+ virtual ~SvxUnoColorTable() throw();
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw( uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( uno::RuntimeException);
+ virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw( uno::RuntimeException);
+
+ static OUString getImplementationName_Static() throw()
+ {
+ return OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.SvxUnoColorTable"));
+ }
+
+ static uno::Sequence< OUString > getSupportedServiceNames_Static(void) throw();
+
+ // XNameContainer
+ virtual void SAL_CALL insertByName( const OUString& aName, const uno::Any& aElement ) throw( lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual void SAL_CALL removeByName( const OUString& Name ) throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
+
+ // XNameReplace
+ virtual void SAL_CALL replaceByName( const OUString& aName, const uno::Any& aElement ) throw( lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
+
+ // XNameAccess
+ virtual uno::Any SAL_CALL getByName( const OUString& aName ) throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
+
+ virtual uno::Sequence< OUString > SAL_CALL getElementNames( ) throw( uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw( uno::RuntimeException);
+
+ // XElementAccess
+ virtual uno::Type SAL_CALL getElementType( ) throw( uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw( uno::RuntimeException);
+};
+
+SvxUnoColorTable::SvxUnoColorTable() throw()
+{
+ pTable = new XColorTable( SvtPathOptions().GetPalettePath() );
+}
+
+SvxUnoColorTable::~SvxUnoColorTable() throw()
+{
+ delete pTable;
+}
+
+sal_Bool SAL_CALL SvxUnoColorTable::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException)
+{
+ uno::Sequence< OUString > aSNL( getSupportedServiceNames() );
+ const OUString * pArray = aSNL.getConstArray();
+
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == ServiceName )
+ return sal_True;
+
+ return sal_False;
+}
+
+OUString SAL_CALL SvxUnoColorTable::getImplementationName() throw( uno::RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoColorTable") );
+}
+
+uno::Sequence< OUString > SAL_CALL SvxUnoColorTable::getSupportedServiceNames( )
+ throw( uno::RuntimeException )
+{
+ return getSupportedServiceNames_Static();
+}
+
+uno::Sequence< OUString > SvxUnoColorTable::getSupportedServiceNames_Static(void) throw()
+{
+ uno::Sequence< OUString > aSNS( 1 );
+ aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ColorTable" ));
+ return aSNS;
+}
+
+// XNameContainer
+void SAL_CALL SvxUnoColorTable::insertByName( const OUString& aName, const uno::Any& aElement )
+ throw( lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ if( hasByName( aName ) )
+ throw container::ElementExistException();
+
+ sal_Int32 nColor = 0;
+ if( !(aElement >>= nColor) )
+ throw lang::IllegalArgumentException();
+
+ if( pTable )
+ {
+ XColorEntry* pEntry = new XColorEntry( Color( (ColorData)nColor ), aName );
+ pTable->Insert( pTable->Count(), pEntry );
+ }
+}
+
+void SAL_CALL SvxUnoColorTable::removeByName( const OUString& Name )
+ throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ long nIndex = pTable ? ((XPropertyTable*)pTable)->Get( Name ) : -1;
+ if( nIndex == -1 )
+ throw container::NoSuchElementException();
+
+ pTable->Remove( nIndex );
+}
+
+// XNameReplace
+void SAL_CALL SvxUnoColorTable::replaceByName( const OUString& aName, const uno::Any& aElement )
+ throw( lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ sal_Int32 nColor = 0;
+ if( !(aElement >>= nColor) )
+ throw lang::IllegalArgumentException();
+
+ long nIndex = pTable ? ((XPropertyTable*)pTable)->Get( aName ) : -1;
+ if( nIndex == -1 )
+ throw container::NoSuchElementException();
+
+ XColorEntry* pEntry = new XColorEntry( Color( (ColorData)nColor ), aName );
+ delete pTable->Replace( nIndex, pEntry );
+}
+
+// XNameAccess
+uno::Any SAL_CALL SvxUnoColorTable::getByName( const OUString& aName )
+ throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ long nIndex = pTable ? ((XPropertyTable*)pTable)->Get( aName ) : -1;
+ if( nIndex == -1 )
+ throw container::NoSuchElementException();
+
+ XColorEntry* pEntry = ((XColorTable*)pTable)->GetColor( nIndex );
+ return uno::Any( (sal_Int32) pEntry->GetColor().GetRGBColor() );
+}
+
+uno::Sequence< OUString > SAL_CALL SvxUnoColorTable::getElementNames( )
+ throw( uno::RuntimeException )
+{
+ const long nCount = pTable ? pTable->Count() : 0;
+
+ uno::Sequence< OUString > aSeq( nCount );
+ OUString* pStrings = aSeq.getArray();
+
+ for( long nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ XColorEntry* pEntry = pTable->GetColor( (long)nIndex );
+ pStrings[nIndex] = pEntry->GetName();
+ }
+
+ return aSeq;
+}
+
+sal_Bool SAL_CALL SvxUnoColorTable::hasByName( const OUString& aName )
+ throw( uno::RuntimeException )
+{
+ long nIndex = pTable ? ((XPropertyTable*)pTable)->Get( aName ) : -1;
+ return nIndex != -1;
+}
+
+// XElementAccess
+uno::Type SAL_CALL SvxUnoColorTable::getElementType( )
+ throw( uno::RuntimeException )
+{
+ return ::getCppuType((const sal_Int32*)0);
+}
+
+sal_Bool SAL_CALL SvxUnoColorTable::hasElements( )
+ throw( uno::RuntimeException )
+{
+ return pTable && pTable->Count() != 0;
+}
+
+/**
+ * Create a colortable
+ */
+uno::Reference< uno::XInterface > SAL_CALL SvxUnoColorTable_createInstance(const uno::Reference< lang::XMultiServiceFactory > & ) throw(uno::Exception)
+{
+ return *new SvxUnoColorTable();
+}
+uno::Reference< uno::XInterface > SAL_CALL create_EnhancedCustomShapeEngine( const uno::Reference< lang::XMultiServiceFactory >& rxFact ) throw(uno::Exception)
+{
+ return *new EnhancedCustomShapeEngine( rxFact );
+}
+
+//
+// export this service
+//
+
+#include "UnoGraphicExporter.hxx"
+#include "unogalthemeprovider.hxx"
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include "sal/types.h"
+#include "osl/diagnose.h"
+#include "cppuhelper/factory.hxx"
+#include "uno/lbnames.h"
+#include <svx/sdr/primitive2d/primitiveFactory2d.hxx>
+
+/*
+namespace svx
+{
+extern OUString SAL_CALL ExtrusionDepthController_getImplementationName();
+extern uno::Reference< uno::XInterface > SAL_CALL ExtrusionDepthController_createInstance(const uno::Reference< lang::XMultiServiceFactory > &) throw( uno::RuntimeException );
+extern uno::Sequence< OUString > SAL_CALL ExtrusionDepthController_getSupportedServiceNames() throw( uno::RuntimeException );
+}
+*/
+
+extern "C"
+{
+
+SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment (
+ const sal_Char ** ppEnvTypeName, uno_Environment ** )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory (
+ const sal_Char * pImplName, void * pServiceManager, void * )
+{
+ void * pRet = 0;
+ if( pServiceManager )
+ {
+ uno::Reference< lang::XSingleServiceFactory > xFactory;
+
+ if( rtl_str_compare( pImplName, "com.sun.star.drawing.SvxUnoColorTable" ) == 0 )
+ {
+ xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
+ SvxUnoColorTable::getImplementationName_Static(),
+ SvxUnoColorTable_createInstance,
+ SvxUnoColorTable::getSupportedServiceNames_Static() );
+ }
+ else if ( rtl_str_compare( pImplName, "com.sun.star.drawing.EnhancedCustomShapeEngine" ) == 0 )
+ {
+ xFactory = createSingleFactory( reinterpret_cast< NMSP_LANG::XMultiServiceFactory* >( pServiceManager ),
+ EnhancedCustomShapeEngine_getImplementationName(),
+ create_EnhancedCustomShapeEngine,
+ EnhancedCustomShapeEngine_getSupportedServiceNames() );
+ }
+ else if( rtl_str_compare( pImplName, "com.sun.star.drawing.SvxShapeCollection" ) == 0 )
+ {
+ xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
+ SvxShapeCollection::getImplementationName_Static(),
+ SvxShapeCollection_createInstance,
+ SvxShapeCollection::getSupportedServiceNames_Static() );
+ }
+ else if( svx::RecoveryUI::st_getImplementationName().equalsAscii( pImplName ) )
+ {
+ xFactory = ::cppu::createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
+ svx::RecoveryUI::st_getImplementationName(),
+ svx::RecoveryUI::st_createInstance,
+ svx::RecoveryUI::st_getSupportedServiceNames() );
+ }
+ else if( svx::GraphicExporter_getImplementationName().equalsAscii( pImplName ) )
+ {
+ xFactory = ::cppu::createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
+ svx::GraphicExporter_getImplementationName(),
+ svx::GraphicExporter_createInstance,
+ svx::GraphicExporter_getSupportedServiceNames() );
+ }
+ else if ( svx::FontHeightToolBoxControl::getImplementationName_Static().equalsAscii( pImplName ) )
+ {
+ xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
+ svx::FontHeightToolBoxControl::getImplementationName_Static(),
+ svx::FontHeightToolBoxControl_createInstance,
+ svx::FontHeightToolBoxControl::getSupportedServiceNames_Static() );
+ }
+ else if ( svx::FindTextToolbarController::getImplementationName_Static().equalsAscii( pImplName ) )
+ {
+ xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
+ svx::FindTextToolbarController::getImplementationName_Static(),
+ svx::FindTextToolbarController_createInstance,
+ svx::FindTextToolbarController::getSupportedServiceNames_Static() );
+ }
+ else if ( svx::DownSearchToolboxController::getImplementationName_Static().equalsAscii( pImplName ) )
+ {
+ xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
+ svx::DownSearchToolboxController::getImplementationName_Static(),
+ svx::DownSearchToolboxController_createInstance,
+ svx::DownSearchToolboxController::getSupportedServiceNames_Static() );
+ }
+ else if ( svx::UpSearchToolboxController::getImplementationName_Static().equalsAscii( pImplName ) )
+ {
+ xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
+ svx::UpSearchToolboxController::getImplementationName_Static(),
+ svx::UpSearchToolboxController_createInstance,
+ svx::UpSearchToolboxController::getSupportedServiceNames_Static() );
+ }
+ else if ( svx::FindbarDispatcher::getImplementationName_Static().equalsAscii( pImplName ) )
+ {
+ xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
+ svx::FindbarDispatcher::getImplementationName_Static(),
+ svx::FindbarDispatcher_createInstance,
+ svx::FindbarDispatcher::getSupportedServiceNames_Static() );
+ }
+ else if( ::unogallery::GalleryThemeProvider_getImplementationName().equalsAscii( pImplName ) )
+ {
+ xFactory = ::cppu::createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
+ ::unogallery::GalleryThemeProvider_getImplementationName(),
+ ::unogallery::GalleryThemeProvider_createInstance,
+ ::unogallery::GalleryThemeProvider_getSupportedServiceNames() );
+ }
+ else if( drawinglayer::primitive2d::PrimitiveFactory2D::getImplementationName_Static().equalsAscii( pImplName ) )
+ {
+ // XPrimitiveFactory2D
+ xFactory = ::cppu::createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
+ drawinglayer::primitive2d::PrimitiveFactory2D::getImplementationName_Static(),
+ drawinglayer::primitive2d::XPrimitiveFactory2DProvider_createInstance,
+ drawinglayer::primitive2d::PrimitiveFactory2D::getSupportedServiceNames_Static() );
+ }
+ else if( ::svx::SvXMLGraphicImportHelper_getImplementationName().equalsAscii( pImplName ) )
+ {
+ xFactory = ::cppu::createSingleFactory(
+ reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
+ ::svx::SvXMLGraphicImportHelper_getImplementationName(),
+ ::svx::SvXMLGraphicImportHelper_createInstance,
+ ::svx::SvXMLGraphicImportHelper_getSupportedServiceNames() );
+ }
+ else if( ::svx::SvXMLGraphicExportHelper_getImplementationName().equalsAscii( pImplName ) )
+ {
+ xFactory = ::cppu::createSingleFactory(
+ reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
+ ::svx::SvXMLGraphicExportHelper_getImplementationName(),
+ ::svx::SvXMLGraphicExportHelper_createInstance,
+ ::svx::SvXMLGraphicExportHelper_getSupportedServiceNames() );
+ }
+/*
+ else if( ::svx::ExtrusionDepthController_getImplementationName().equalsAscii( pImplName ) )
+ {
+ xFactory = ::cppu::createSingleFactory(
+ reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),
+ ::svx::ExtrusionDepthController_getImplementationName(),
+ ::svx::ExtrusionDepthController_createInstance,
+ ::svx::ExtrusionDepthController_getSupportedServiceNames() );
+ }
+*/
+ if( xFactory.is())
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+
+ return pRet;
+}
+
+}
diff --git a/svx/source/unodraw/unodraw.src b/svx/source/unodraw/unodraw.src
new file mode 100644
index 000000000000..1e8fcf12d9ad
--- /dev/null
+++ b/svx/source/unodraw/unodraw.src
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svx/dialogs.hrc>
+
+Bitmap RID_UNODRAW_OBJECTS
+{
+ File = "objects.bmp" ;
+};
+Bitmap RID_UNODRAW_OLE2
+{
+ File = "ole.bmp" ;
+};
+Bitmap RID_UNODRAW_GRAPHICS
+{
+ File = "graphic.bmp" ;
+};
+
diff --git a/svx/source/unodraw/unodtabl.cxx b/svx/source/unodraw/unodtabl.cxx
new file mode 100644
index 000000000000..9c7637c4d5a9
--- /dev/null
+++ b/svx/source/unodraw/unodtabl.cxx
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <com/sun/star/drawing/LineDash.hpp>
+#include <svl/itempool.hxx>
+#include <svl/itemset.hxx>
+
+#include <vector>
+#include "UnoNameItemTable.hxx"
+#include <svx/xlndsit.hxx>
+#include <svx/unomid.hxx>
+
+#include <svx/xdash.hxx>
+#include <svx/svdmodel.hxx>
+#include "svx/unofill.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+using namespace ::cppu;
+
+class SvxUnoDashTable : public SvxUnoNameItemTable
+{
+public:
+ SvxUnoDashTable( SdrModel* pModel ) throw();
+ virtual ~SvxUnoDashTable() throw();
+
+ virtual NameOrIndex* createItem() const throw();
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw( uno::RuntimeException );
+ virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw( uno::RuntimeException);
+
+ // XElementAccess
+ virtual uno::Type SAL_CALL getElementType( ) throw( uno::RuntimeException);
+};
+
+SvxUnoDashTable::SvxUnoDashTable( SdrModel* pModel ) throw()
+: SvxUnoNameItemTable( pModel, XATTR_LINEDASH, MID_LINEDASH )
+{
+}
+
+SvxUnoDashTable::~SvxUnoDashTable() throw()
+{
+}
+
+OUString SAL_CALL SvxUnoDashTable::getImplementationName() throw( uno::RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoDashTable") );
+}
+
+uno::Sequence< OUString > SAL_CALL SvxUnoDashTable::getSupportedServiceNames( )
+ throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aSNS( 1 );
+ aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DashTable" ));
+ return aSNS;
+}
+
+NameOrIndex* SvxUnoDashTable::createItem() const throw()
+{
+ XLineDashItem* pNewItem = new XLineDashItem();
+ pNewItem->SetWhich( XATTR_LINEDASH ); // set which id for pooling
+ return pNewItem;
+}
+
+// XElementAccess
+uno::Type SAL_CALL SvxUnoDashTable::getElementType( )
+ throw( uno::RuntimeException )
+{
+ return ::getCppuType((const struct drawing::LineDash*)0);
+}
+
+/**
+ * Create a gradienttable
+ */
+uno::Reference< uno::XInterface > SAL_CALL SvxUnoDashTable_createInstance( SdrModel* pModel )
+{
+ return *new SvxUnoDashTable(pModel);
+}
+
+
+
diff --git a/svx/source/unodraw/unogtabl.cxx b/svx/source/unodraw/unogtabl.cxx
new file mode 100644
index 000000000000..bbb575a06410
--- /dev/null
+++ b/svx/source/unodraw/unogtabl.cxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <com/sun/star/awt/Gradient.hpp>
+#include <svl/itempool.hxx>
+#include <svl/itemset.hxx>
+#include "UnoNameItemTable.hxx"
+
+#include <svx/xgrad.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/xdef.hxx>
+#include <svx/xflgrit.hxx>
+#include "svx/unofill.hxx"
+#include <svx/unomid.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+using namespace ::cppu;
+
+class SvxUnoGradientTable : public SvxUnoNameItemTable
+{
+public:
+ SvxUnoGradientTable( SdrModel* pModel ) throw();
+ virtual ~SvxUnoGradientTable() throw();
+
+ virtual NameOrIndex* createItem() const throw();
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw( uno::RuntimeException );
+ virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw( uno::RuntimeException);
+
+ // XElementAccess
+ virtual uno::Type SAL_CALL getElementType( ) throw( uno::RuntimeException);
+};
+
+SvxUnoGradientTable::SvxUnoGradientTable( SdrModel* pModel ) throw()
+ : SvxUnoNameItemTable( pModel, XATTR_FILLGRADIENT, MID_FILLGRADIENT )
+{
+}
+
+SvxUnoGradientTable::~SvxUnoGradientTable() throw()
+{
+}
+
+OUString SAL_CALL SvxUnoGradientTable::getImplementationName() throw( uno::RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoGradientTable") );
+}
+
+uno::Sequence< OUString > SAL_CALL SvxUnoGradientTable::getSupportedServiceNames( )
+ throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aSNS( 1 );
+ aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GradientTable" ));
+ return aSNS;
+}
+
+
+// XNameContainer
+NameOrIndex* SvxUnoGradientTable::createItem() const throw()
+{
+ return new XFillGradientItem();
+}
+
+// XElementAccess
+uno::Type SAL_CALL SvxUnoGradientTable::getElementType( )
+ throw( uno::RuntimeException )
+{
+ return ::getCppuType((const struct awt::Gradient*)0);
+}
+
+/**
+ * Create a gradienttable
+ */
+uno::Reference< uno::XInterface > SAL_CALL SvxUnoGradientTable_createInstance( SdrModel* pModel )
+{
+ return *new SvxUnoGradientTable(pModel);
+}
+
+
+
diff --git a/svx/source/unodraw/unohtabl.cxx b/svx/source/unodraw/unohtabl.cxx
new file mode 100644
index 000000000000..64fbdae052a0
--- /dev/null
+++ b/svx/source/unodraw/unohtabl.cxx
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <com/sun/star/drawing/Hatch.hpp>
+#include <svl/itempool.hxx>
+#include <svl/itemset.hxx>
+#include "UnoNameItemTable.hxx"
+
+#include <svx/xhatch.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/xdef.hxx>
+#include <svx/xflhtit.hxx>
+#include <svx/unomid.hxx>
+#include "svx/unofill.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+using namespace ::cppu;
+
+class SvxUnoHatchTable : public SvxUnoNameItemTable
+{
+public:
+ SvxUnoHatchTable( SdrModel* pModel ) throw();
+ virtual ~SvxUnoHatchTable() throw();
+
+ virtual NameOrIndex* createItem() const throw();
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw( uno::RuntimeException );
+ virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw( uno::RuntimeException);
+
+ // XElementAccess
+ virtual uno::Type SAL_CALL getElementType( ) throw( uno::RuntimeException);
+};
+
+SvxUnoHatchTable::SvxUnoHatchTable( SdrModel* pModel ) throw()
+: SvxUnoNameItemTable( pModel, XATTR_FILLHATCH, MID_FILLHATCH )
+{
+}
+
+SvxUnoHatchTable::~SvxUnoHatchTable() throw()
+{
+}
+
+OUString SAL_CALL SvxUnoHatchTable::getImplementationName() throw( uno::RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoHatchTable") );
+}
+
+uno::Sequence< OUString > SAL_CALL SvxUnoHatchTable::getSupportedServiceNames( )
+ throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aSNS( 1 );
+ aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.HatchTable" ));
+ return aSNS;
+}
+
+NameOrIndex* SvxUnoHatchTable::createItem() const throw()
+{
+ return new XFillHatchItem();
+}
+
+// XElementAccess
+uno::Type SAL_CALL SvxUnoHatchTable::getElementType( )
+ throw( uno::RuntimeException )
+{
+ return ::getCppuType((const struct drawing::Hatch*)0);
+}
+
+/**
+ * Create a hatchtable
+ */
+uno::Reference< uno::XInterface > SAL_CALL SvxUnoHatchTable_createInstance( SdrModel* pModel )
+{
+ return *new SvxUnoHatchTable(pModel);
+}
+
+
+
diff --git a/svx/source/unodraw/unomlstr.cxx b/svx/source/unodraw/unomlstr.cxx
new file mode 100644
index 000000000000..2519a2c36d1c
--- /dev/null
+++ b/svx/source/unodraw/unomlstr.cxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/svdobj.hxx>
+// header for class OGuard
+#include <vos/mutex.hxx>
+// header for class Application
+#include <vcl/svapp.hxx>
+
+#include "unomlstr.hxx"
+
+using namespace ::com::sun::star;
+
+SvxUnoShapeModifyListener::SvxUnoShapeModifyListener( SdrObject* pObj ) throw()
+{
+ mpObj = pObj;
+}
+
+SvxUnoShapeModifyListener::~SvxUnoShapeModifyListener() throw()
+{
+}
+
+// ::com::sun::star::util::XModifyListener
+void SAL_CALL SvxUnoShapeModifyListener::modified(const lang::EventObject& ) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if( mpObj )
+ {
+ mpObj->SetChanged();
+ mpObj->BroadcastObjectChange();
+ }
+}
+
+// ::com::sun::star::lang::XEventListener
+void SvxUnoShapeModifyListener::disposing(const lang::EventObject& ) throw( uno::RuntimeException )
+{
+ invalidate();
+}
+
+// internal
+void SvxUnoShapeModifyListener::invalidate() throw()
+{
+ mpObj = NULL;
+}
+
+
diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx
new file mode 100644
index 000000000000..016128488ab4
--- /dev/null
+++ b/svx/source/unodraw/unomod.cxx
@@ -0,0 +1,778 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#define _SVX_USE_UNOGLOBALS_
+#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
+#include <com/sun/star/lang/NoSupportException.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <tools/list.hxx>
+#include <svl/itemprop.hxx>
+#include <svtools/unoevent.hxx>
+#include <comphelper/sequence.hxx>
+#include <comphelper/serviceinfohelper.hxx>
+
+#include <cppuhelper/implbase2.hxx>
+#include <svx/unofill.hxx>
+#include <editeng/unonrule.hxx>
+#include <svtools/unoimap.hxx>
+#include <svx/fmdpage.hxx>
+#include <svx/fmmodel.hxx>
+#include <svx/fmpage.hxx>
+#include <sfx2/sfx.hrc>
+#include <svx/unoapi.hxx>
+
+#include <svx/svdmodel.hxx>
+#include "svx/globl3d.hxx"
+#include <svx/svdtypes.hxx>
+#include <svx/unoprov.hxx>
+#include <svx/unopage.hxx>
+#include <editeng/unofield.hxx>
+#include <svx/unomod.hxx>
+#include <svx/unomodel.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/unoshape.hxx>
+
+extern UHashMapEntry pSdrShapeIdentifierMap[];
+
+//-////////////////////////////////////////////////////////////////////
+
+using namespace ::rtl;
+using namespace ::osl;
+using namespace ::vos;
+using namespace ::com::sun::star;
+
+//-////////////////////////////////////////////////////////////////////
+
+#define QUERYINT( xint ) \
+ if( rType == ::getCppuType((const uno::Reference< xint >*)0) ) \
+ aAny <<= uno::Reference< xint >(this)
+
+#define ITYPE( xint ) \
+ ::getCppuType((const uno::Reference< xint >*)0)
+
+//-////////////////////////////////////////////////////////////////////
+
+#ifndef SVX_LIGHT
+
+class SvxUnoDrawPagesAccess : public ::cppu::WeakImplHelper2< ::com::sun::star::drawing::XDrawPages, ::com::sun::star::lang::XServiceInfo >
+{
+private:
+ SvxUnoDrawingModel& mrModel;
+
+public:
+ SvxUnoDrawPagesAccess( SvxUnoDrawingModel& rMyModel ) throw();
+ virtual ~SvxUnoDrawPagesAccess() throw();
+
+ // XDrawPages
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL insertNewByIndex( sal_Int32 nIndex ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ;
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+};
+#endif
+//-////////////////////////////////////////////////////////////////////
+
+#ifndef SVX_LIGHT
+const SvEventDescription* ImplGetSupportedMacroItems()
+{
+ static const SvEventDescription aMacroDescriptionsImpl[] =
+ {
+ { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" },
+ { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" },
+ { 0, NULL }
+ };
+
+ return aMacroDescriptionsImpl;
+}
+#endif
+
+//-////////////////////////////////////////////////////////////////////
+
+/** fills the given EventObject from the given SdrHint.
+ @returns
+ true if the SdrHint could be translated to an EventObject<br>
+ false if not
+*/
+sal_Bool SvxUnoDrawMSFactory::createEvent( const SdrModel* pDoc, const SdrHint* pSdrHint, ::com::sun::star::document::EventObject& aEvent )
+{
+ const SdrObject* pObj = NULL;
+ const SdrPage* pPage = NULL;
+
+ switch( pSdrHint->GetKind() )
+ {
+// case HINT_LAYERCHG: // Layerdefinition geaendert
+// case HINT_LAYERORDERCHG: // Layerreihenfolge geaendert (Insert/Remove/ChangePos)
+// case HINT_LAYERSETCHG: // Layerset geaendert
+// case HINT_LAYERSETORDERCHG: // Layersetreihenfolge geaendert (Insert/Remove/ChangePos)
+
+// #115423#
+// case HINT_PAGECHG: // Page geaendert
+// aEvent.EventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageModified" ) );
+// pPage = pSdrHint->GetPage();
+// break;
+ case HINT_PAGEORDERCHG: // Reihenfolge der Seiten (Zeichenseiten oder Masterpages) geaendert (Insert/Remove/ChangePos)
+ aEvent.EventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageOrderModified" ) );
+ pPage = pSdrHint->GetPage();
+ break;
+ case HINT_OBJCHG: // Objekt geaendert
+ aEvent.EventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "ShapeModified" ) );
+ pObj = pSdrHint->GetObject();
+ break;
+ case HINT_OBJINSERTED: // Neues Zeichenobjekt eingefuegt
+ aEvent.EventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "ShapeInserted" ) );
+ pObj = pSdrHint->GetObject();
+ break;
+ case HINT_OBJREMOVED: // Zeichenobjekt aus Liste entfernt
+ aEvent.EventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "ShapeRemoved" ) );
+ pObj = pSdrHint->GetObject();
+ break;
+// HINT_DEFAULTTABCHG, // Default Tabulatorweite geaendert
+// HINT_DEFFONTHGTCHG, // Default FontHeight geaendert
+// HINT_SWITCHTOPAGE, // #94278# UNDO/REDO at an object evtl. on another page
+// HINT_OBJLISTCLEAR // Is called before an SdrObjList will be cleared
+ default:
+ return sal_False;
+ }
+
+ if( pObj )
+ aEvent.Source = const_cast<SdrObject*>(pObj)->getUnoShape();
+ else if( pPage )
+ aEvent.Source = const_cast<SdrPage*>(pPage)->getUnoPage();
+ else
+ aEvent.Source = (const_cast<SdrModel*>(pDoc))->getUnoModel();
+
+ return sal_True;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawMSFactory::createInstance( const OUString& ServiceSpecifier )
+ throw( uno::Exception, uno::RuntimeException )
+{
+ const OUString aDrawingPrefix( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.") );
+
+ if( ServiceSpecifier.compareTo( aDrawingPrefix, aDrawingPrefix.getLength() ) == 0 )
+ {
+ sal_uInt32 nType = aSdrShapeIdentifierMap.getId( ServiceSpecifier );
+ if( nType != UHASHMAP_NOTFOUND )
+ {
+ sal_uInt16 nT = (sal_uInt16)(nType & ~E3D_INVENTOR_FLAG);
+ sal_uInt32 nI = (nType & E3D_INVENTOR_FLAG)?E3dInventor:SdrInventor;
+
+ return uno::Reference< uno::XInterface >( (drawing::XShape*) SvxDrawPage::CreateShapeByTypeAndInventor( nT, nI ) );
+ }
+ }
+
+ uno::Reference< uno::XInterface > xRet( createTextField( ServiceSpecifier ) );
+ if( !xRet.is() )
+ throw lang::ServiceNotRegisteredException();
+
+ return xRet;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawMSFactory::createTextField( const ::rtl::OUString& ServiceSpecifier ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+{
+ return SvxUnoTextCreateTextField( ServiceSpecifier );
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawMSFactory::createInstanceWithArguments( const OUString&, const uno::Sequence< ::com::sun::star::uno::Any >& )
+ throw( uno::Exception, uno::RuntimeException )
+{
+ throw lang::NoSupportException();
+}
+
+uno::Sequence< OUString > SAL_CALL SvxUnoDrawMSFactory::getAvailableServiceNames()
+ throw( uno::RuntimeException )
+{
+ UHashMapEntry* pMap = pSdrShapeIdentifierMap;
+
+ sal_uInt32 nCount = 0;
+ while (pMap->aIdentifier.getLength())
+ {
+ pMap++;
+ nCount++;
+ }
+
+ uno::Sequence< OUString > aSeq( nCount );
+ OUString* pStrings = aSeq.getArray();
+
+ pMap = pSdrShapeIdentifierMap;
+ sal_uInt32 nIdx = 0;
+ while(pMap->aIdentifier.getLength())
+ {
+ pStrings[nIdx] = pMap->aIdentifier;
+ pMap++;
+ nIdx++;
+ }
+
+ return aSeq;
+}
+
+uno::Sequence< OUString > SvxUnoDrawMSFactory::concatServiceNames( uno::Sequence< OUString >& rServices1, uno::Sequence< OUString >& rServices2 ) throw()
+{
+ const sal_Int32 nLen1 = rServices1.getLength();
+ const sal_Int32 nLen2 = rServices2.getLength();
+
+ uno::Sequence< OUString > aSeq( nLen1+nLen2 );
+ OUString* pStrings = aSeq.getArray();
+
+ sal_Int32 nIdx;
+ OUString* pStringDst = pStrings;
+ const OUString* pStringSrc = rServices1.getArray();
+
+ for( nIdx = 0; nIdx < nLen1; nIdx++ )
+ *pStringDst++ = *pStringSrc++;
+
+ pStringSrc = rServices2.getArray();
+
+ for( nIdx = 0; nIdx < nLen2; nIdx++ )
+ *pStringDst++ = *pStringSrc++;
+
+ return aSeq;
+}
+
+
+#ifndef SVX_LIGHT
+
+///
+SvxUnoDrawingModel::SvxUnoDrawingModel( SdrModel* pDoc ) throw()
+: mpDoc( pDoc )
+{
+}
+
+SvxUnoDrawingModel::~SvxUnoDrawingModel() throw()
+{
+}
+
+uno::Any SAL_CALL SvxUnoDrawingModel::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+
+ QUERYINT(lang::XServiceInfo);
+ else QUERYINT(lang::XMultiServiceFactory);
+ else QUERYINT(drawing::XDrawPagesSupplier);
+ else QUERYINT(com::sun::star::ucb::XAnyCompareFactory);
+ else
+ return SfxBaseModel::queryInterface( rType );
+
+ return aAny;
+}
+
+void SAL_CALL SvxUnoDrawingModel::acquire() throw ( )
+{
+ SfxBaseModel::acquire();
+}
+
+void SAL_CALL SvxUnoDrawingModel::release() throw ( )
+{
+ SfxBaseModel::release();
+}
+
+// XTypeProvider
+uno::Sequence< uno::Type > SAL_CALL SvxUnoDrawingModel::getTypes( ) throw(uno::RuntimeException)
+{
+ if( maTypeSequence.getLength() == 0 )
+ {
+ const uno::Sequence< uno::Type > aBaseTypes( SfxBaseModel::getTypes() );
+ const sal_Int32 nBaseTypes = aBaseTypes.getLength();
+ const uno::Type* pBaseTypes = aBaseTypes.getConstArray();
+
+ const sal_Int32 nOwnTypes = 4; // !DANGER! Keep this updated!
+
+ maTypeSequence.realloc( nBaseTypes + nOwnTypes );
+ uno::Type* pTypes = maTypeSequence.getArray();
+
+ *pTypes++ = ITYPE(lang::XServiceInfo);
+ *pTypes++ = ITYPE(lang::XMultiServiceFactory);
+ *pTypes++ = ITYPE(drawing::XDrawPagesSupplier);
+ *pTypes++ = ITYPE(com::sun::star::ucb::XAnyCompareFactory);
+
+ for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ )
+ *pTypes++ = *pBaseTypes++;
+ }
+
+ return maTypeSequence;
+}
+
+uno::Sequence< sal_Int8 > SAL_CALL SvxUnoDrawingModel::getImplementationId( ) throw(uno::RuntimeException)
+{
+ static uno::Sequence< sal_Int8 > aId;
+ if( aId.getLength() == 0 )
+ {
+ aId.realloc( 16 );
+ rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
+ }
+ return aId;
+}
+
+void SAL_CALL SvxUnoDrawingModel::lockControllers( )
+ throw(uno::RuntimeException)
+{
+ if( mpDoc )
+ mpDoc->setLock( sal_True );
+}
+
+void SAL_CALL SvxUnoDrawingModel::unlockControllers( )
+ throw(uno::RuntimeException)
+{
+ if( mpDoc && mpDoc->isLocked() )
+ {
+ mpDoc->setLock( sal_False );
+ }
+}
+
+sal_Bool SAL_CALL SvxUnoDrawingModel::hasControllersLocked( )
+ throw(uno::RuntimeException)
+{
+ return mpDoc && mpDoc->isLocked();
+}
+
+// XDrawPagesSupplier
+uno::Reference< drawing::XDrawPages > SAL_CALL SvxUnoDrawingModel::getDrawPages()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ uno::Reference< drawing::XDrawPages > xDrawPages( mxDrawPagesAccess );
+
+ if( !xDrawPages.is() )
+ mxDrawPagesAccess = xDrawPages = (drawing::XDrawPages*)new SvxUnoDrawPagesAccess(*this);
+
+ return xDrawPages;
+}
+
+// XMultiServiceFactory ( SvxFmMSFactory )
+uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawingModel::createInstance( const OUString& aServiceSpecifier )
+ throw(uno::Exception, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.DashTable") ) )
+ {
+ if( !mxDashTable.is() )
+ mxDashTable = SvxUnoDashTable_createInstance( mpDoc );
+ return mxDashTable;
+ }
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GradientTable") ) )
+ {
+ if( !mxGradientTable.is() )
+ mxGradientTable = SvxUnoGradientTable_createInstance( mpDoc );
+ return mxGradientTable;
+ }
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.HatchTable") ) )
+ {
+ if( !mxHatchTable.is() )
+ mxHatchTable = SvxUnoHatchTable_createInstance( mpDoc );
+ return mxHatchTable;
+ }
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.BitmapTable") ) )
+ {
+ if( !mxBitmapTable.is() )
+ mxBitmapTable = SvxUnoBitmapTable_createInstance( mpDoc );
+ return mxBitmapTable;
+ }
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TransparencyGradientTable") ) )
+ {
+ if( !mxTransGradientTable.is() )
+ mxTransGradientTable = SvxUnoTransGradientTable_createInstance( mpDoc );
+ return mxTransGradientTable;
+ }
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.MarkerTable") ) )
+ {
+ if( !mxMarkerTable.is() )
+ mxMarkerTable = SvxUnoMarkerTable_createInstance( mpDoc );
+ return mxMarkerTable;
+ }
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.NumberingRules" ) ) )
+ {
+ return uno::Reference< uno::XInterface >( SvxCreateNumRule( mpDoc ), uno::UNO_QUERY );
+ }
+
+ if( aServiceSpecifier.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.image.ImageMapRectangleObject") ) )
+ {
+ return SvUnoImageMapRectangleObject_createInstance( ImplGetSupportedMacroItems() );
+ }
+
+ if( aServiceSpecifier.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.image.ImageMapCircleObject") ) )
+ {
+ return SvUnoImageMapCircleObject_createInstance( ImplGetSupportedMacroItems() );
+ }
+
+ if( aServiceSpecifier.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.image.ImageMapPolygonObject") ) )
+ {
+ return SvUnoImageMapPolygonObject_createInstance( ImplGetSupportedMacroItems() );
+ }
+
+ if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextField.DateTime") ) )
+ {
+ return (::cppu::OWeakObject * )new SvxUnoTextField( ID_EXT_DATEFIELD );
+ }
+
+ uno::Reference< uno::XInterface > xRet;
+
+ const String aType( aServiceSpecifier );
+ if( aType.EqualsAscii( "com.sun.star.presentation.", 0, 26 ) )
+ {
+ SvxShape* pShape = NULL;
+
+ sal_uInt16 nType = OBJ_TEXT;
+ // create a shape wrapper
+ if( aType.EqualsAscii( "TitleTextShape", 26, 14 ) )
+ {
+ nType = OBJ_TEXT;
+ }
+ else if( aType.EqualsAscii( "OutlinerShape", 26, 13 ) )
+ {
+ nType = OBJ_TEXT;
+ }
+ else if( aType.EqualsAscii( "SubtitleShape", 26, 13 ) )
+ {
+ nType = OBJ_TEXT;
+ }
+ else if( aType.EqualsAscii( "GraphicObjectShape", 26, 18 ) )
+ {
+ nType = OBJ_GRAF;
+ }
+ else if( aType.EqualsAscii( "PageShape", 26, 9 ) )
+ {
+ nType = OBJ_PAGE;
+ }
+ else if( aType.EqualsAscii( "OLE2Shape", 26, 9 ) )
+ {
+ nType = OBJ_OLE2;
+ }
+ else if( aType.EqualsAscii( "ChartShape", 26, 10 ) )
+ {
+ nType = OBJ_OLE2;
+ }
+ else if( aType.EqualsAscii( "TableShape", 26, 10 ) )
+ {
+ nType = OBJ_OLE2;
+ }
+ else if( aType.EqualsAscii( "OrgChartShape", 26, 13 ) )
+ {
+ nType = OBJ_OLE2;
+ }
+ else if( aType.EqualsAscii( "NotesShape", 26, 10 ) )
+ {
+ nType = OBJ_TEXT;
+ }
+ else if( aType.EqualsAscii( "HandoutShape", 26, 12 ) )
+ {
+ nType = OBJ_PAGE;
+ }
+ else if( aType.EqualsAscii( "FooterShape", 26, 12 ) )
+ {
+ nType = OBJ_TEXT;
+ }
+ else if( aType.EqualsAscii( "HeaderShape", 26, 12 ) )
+ {
+ nType = OBJ_TEXT;
+ }
+ else if( aType.EqualsAscii( "SlideNumberShape", 26, 17 ) )
+ {
+ nType = OBJ_TEXT;
+ }
+ else if( aType.EqualsAscii( "DateTimeShape", 26, 17 ) )
+ {
+ nType = OBJ_TEXT;
+ }
+ else if( aType.EqualsAscii( "TableShape", 26, 10 ) )
+ {
+ nType = OBJ_TABLE;
+ }
+ else
+ {
+ throw lang::ServiceNotRegisteredException();
+ }
+
+ // create the API wrapper
+ pShape = CreateSvxShapeByTypeAndInventor( nType, SdrInventor );
+
+ // set shape type
+ if( pShape )
+ pShape->SetShapeType(aServiceSpecifier);
+
+ xRet = (uno::XWeak*)pShape;
+ }
+ else
+ {
+ xRet = SvxFmMSFactory::createInstance( aServiceSpecifier );
+ }
+
+ return xRet;
+}
+
+uno::Sequence< OUString > SAL_CALL SvxUnoDrawingModel::getAvailableServiceNames()
+ throw(uno::RuntimeException)
+{
+ const uno::Sequence< OUString > aSNS_ORG( SvxFmMSFactory::getAvailableServiceNames() );
+
+ uno::Sequence< OUString > aSNS( 21 );
+
+ sal_uInt16 i = 0;
+
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DashTable"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GradientTable"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.HatchTable"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.BitmapTable"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.TransparencyGradientTable"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.MarkerTable"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.NumberingRules"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.image.ImageMapRectangleObject"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.image.ImageMapCircleObject"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.image.ImageMapPolygonObject"));
+
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.TitleTextShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OutlinerShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.SubtitleShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.GraphicObjectShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.ChartShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PageShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OLE2Shape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.TableShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OrgChartShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.NotesShape"));
+ aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.HandoutShape"));
+
+ DBG_ASSERT( i == aSNS.getLength(), "Sequence overrun!" );
+
+ return comphelper::concatSequences( aSNS_ORG, aSNS );
+}
+
+// lang::XServiceInfo
+OUString SAL_CALL SvxUnoDrawingModel::getImplementationName()
+ throw(uno::RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoDrawingModel"));
+}
+
+sal_Bool SAL_CALL SvxUnoDrawingModel::supportsService( const OUString& ServiceName )
+ throw(uno::RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+uno::Sequence< OUString > SAL_CALL SvxUnoDrawingModel::getSupportedServiceNames() throw(uno::RuntimeException)
+{
+ OUString aSN( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocument"));
+ uno::Sequence< OUString > aSeq( &aSN, 1 );
+ return aSeq;
+}
+
+// XAnyCompareFactory
+uno::Reference< com::sun::star::ucb::XAnyCompare > SAL_CALL SvxUnoDrawingModel::createAnyCompareByName( const OUString& )
+ throw(uno::RuntimeException)
+{
+ return SvxCreateNumRuleCompare();
+}
+
+//=============================================================================
+// class SvxUnoDrawPagesAccess
+//=============================================================================
+
+SvxUnoDrawPagesAccess::SvxUnoDrawPagesAccess( SvxUnoDrawingModel& rMyModel ) throw()
+: mrModel(rMyModel)
+{
+}
+
+SvxUnoDrawPagesAccess::~SvxUnoDrawPagesAccess() throw()
+{
+}
+
+// XIndexAccess
+sal_Int32 SAL_CALL SvxUnoDrawPagesAccess::getCount()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ sal_Int32 nCount = 0;
+
+ if( mrModel.mpDoc )
+ nCount = mrModel.mpDoc->GetPageCount();
+
+ return( nCount );
+}
+
+uno::Any SAL_CALL SvxUnoDrawPagesAccess::getByIndex( sal_Int32 Index )
+ throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ uno::Any aAny;
+
+ if( mrModel.mpDoc )
+ {
+ if( (Index < 0) || (Index >= mrModel.mpDoc->GetPageCount() ) )
+ throw lang::IndexOutOfBoundsException();
+
+ SdrPage* pPage = mrModel.mpDoc->GetPage( (sal_uInt16)Index );
+ if( pPage )
+ {
+ uno::Reference< uno::XInterface > xPage( pPage->mxUnoPage );
+
+ if( !xPage.is() )
+ {
+ if( PTR_CAST( FmFormModel, mrModel.mpDoc ) )
+ xPage = (drawing::XDrawPage*)new SvxFmDrawPage( pPage );
+ else
+ xPage = (drawing::XDrawPage*)new SvxDrawPage( pPage );
+
+ pPage->mxUnoPage = xPage;
+ }
+
+ aAny <<= xPage;
+ }
+ }
+ return aAny;
+}
+
+// XElementAccess
+uno::Type SAL_CALL SvxUnoDrawPagesAccess::getElementType()
+ throw(uno::RuntimeException)
+{
+ return ITYPE( drawing::XDrawPage );
+}
+
+sal_Bool SAL_CALL SvxUnoDrawPagesAccess::hasElements()
+ throw(uno::RuntimeException)
+{
+ return getCount() > 0;
+}
+
+// XDrawPages
+
+/******************************************************************************
+* Erzeugt eine neue Seite mit Model an der angegebennen Position und gibt die *
+* dazugehoerige SdDrawPage zurueck. *
+******************************************************************************/
+uno::Reference< drawing::XDrawPage > SAL_CALL SvxUnoDrawPagesAccess::insertNewByIndex( sal_Int32 nIndex )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ uno::Reference< drawing::XDrawPage > xDrawPage;
+
+ if( mrModel.mpDoc )
+ {
+ SdrPage* pPage;
+
+ if( PTR_CAST( FmFormModel, mrModel.mpDoc ) )
+ pPage = new FmFormPage(*(FmFormModel*)mrModel.mpDoc, NULL);
+ else
+ pPage = new SdrPage(*mrModel.mpDoc);
+
+ mrModel.mpDoc->InsertPage( pPage, (sal_uInt16)nIndex );
+ xDrawPage = uno::Reference< drawing::XDrawPage >::query( pPage->getUnoPage() );
+ }
+
+ return xDrawPage;
+}
+
+void SAL_CALL SvxUnoDrawPagesAccess::remove( const uno::Reference< drawing::XDrawPage >& xPage )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ sal_uInt16 nPageCount = mrModel.mpDoc->GetPageCount();
+ if( nPageCount > 1 )
+ {
+ // pPage von xPage besorgen und dann die Id (nPos )ermitteln
+ SvxDrawPage* pSvxPage = SvxDrawPage::getImplementation( xPage );
+ if( pSvxPage )
+ {
+ SdrPage* pPage = pSvxPage->GetSdrPage();
+ if(pPage)
+ {
+ sal_uInt16 nPage = pPage->GetPageNum();
+ mrModel.mpDoc->DeletePage( nPage );
+ }
+ }
+ }
+}
+
+// XServiceInfo
+sal_Char pSvxUnoDrawPagesAccessService[sizeof("com.sun.star.drawing.DrawPages")] = "com.sun.star.drawing.DrawPages";
+
+OUString SAL_CALL SvxUnoDrawPagesAccess::getImplementationName( ) throw(uno::RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxUnoDrawPagesAccess" ) );
+}
+
+sal_Bool SAL_CALL SvxUnoDrawPagesAccess::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException)
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( pSvxUnoDrawPagesAccessService ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SvxUnoDrawPagesAccess::getSupportedServiceNames( ) throw(uno::RuntimeException)
+{
+ OUString aService( RTL_CONSTASCII_USTRINGPARAM( pSvxUnoDrawPagesAccessService ) );
+ uno::Sequence< OUString > aSeq( &aService, 1 );
+ return aSeq;
+}
+#include <editeng/unonrule.hxx>
+com::sun::star::uno::Reference< com::sun::star::container::XIndexReplace > SvxCreateNumRule( SdrModel* pModel ) throw()
+{
+ SvxNumRule* pDefaultRule = NULL;
+ if( pModel )
+ {
+ SvxNumBulletItem* pItem = (SvxNumBulletItem*) pModel->GetItemPool().GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET);
+ if( pItem )
+ {
+ pDefaultRule = pItem->GetNumRule();
+ }
+ }
+
+ if( pDefaultRule )
+ {
+ return SvxCreateNumRule( pDefaultRule );
+ }
+ else
+ {
+ SvxNumRule aTempRule( 0, 10, false );
+ return SvxCreateNumRule( &aTempRule );
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+
+#endif
diff --git a/svx/source/unodraw/unomtabl.cxx b/svx/source/unodraw/unomtabl.cxx
new file mode 100644
index 000000000000..a46b535a9baf
--- /dev/null
+++ b/svx/source/unodraw/unomtabl.cxx
@@ -0,0 +1,482 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <set>
+#include <comphelper/stl_types.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/drawing/PointSequence.hpp>
+#include <svl/style.hxx>
+
+#include <cppuhelper/implbase2.hxx>
+#include <svl/itempool.hxx>
+#include <svl/itemset.hxx>
+#include <svl/lstner.hxx>
+#include <svx/xlnedit.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/xdef.hxx>
+#include <svx/xflhtit.hxx>
+
+#include <vector>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+
+#include "svx/unofill.hxx"
+
+#include "svx/unoapi.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::vos;
+
+typedef std::vector< SfxItemSet* > ItemPoolVector;
+
+class SvxUnoMarkerTable : public WeakImplHelper2< container::XNameContainer, lang::XServiceInfo >,
+ public SfxListener
+{
+private:
+ SdrModel* mpModel;
+ SfxItemPool* mpModelPool;
+
+ ItemPoolVector maItemSetVector;
+
+public:
+ SvxUnoMarkerTable( SdrModel* pModel ) throw();
+ virtual ~SvxUnoMarkerTable() throw();
+
+ void dispose();
+
+ // SfxListener
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) throw ();
+
+ void SAL_CALL ImplInsertByName( const OUString& aName, const uno::Any& aElement );
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw( uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( uno::RuntimeException);
+ virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw( uno::RuntimeException);
+
+ // XNameContainer
+ virtual void SAL_CALL insertByName( const OUString& aName, const uno::Any& aElement ) throw( lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual void SAL_CALL removeByName( const OUString& Name ) throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
+
+ // XNameReplace
+ virtual void SAL_CALL replaceByName( const OUString& aName, const uno::Any& aElement ) throw( lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
+
+ // XNameAccess
+ virtual uno::Any SAL_CALL getByName( const OUString& aName ) throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual uno::Sequence< OUString > SAL_CALL getElementNames( ) throw( uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw( uno::RuntimeException);
+
+ // XElementAccess
+ virtual uno::Type SAL_CALL getElementType( ) throw( uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw( uno::RuntimeException);
+};
+
+SvxUnoMarkerTable::SvxUnoMarkerTable( SdrModel* pModel ) throw()
+: mpModel( pModel ),
+ mpModelPool( pModel ? &pModel->GetItemPool() : (SfxItemPool*)NULL )
+{
+ if( pModel )
+ StartListening( *pModel );
+}
+
+SvxUnoMarkerTable::~SvxUnoMarkerTable() throw()
+{
+ if( mpModel )
+ EndListening( *mpModel );
+ dispose();
+}
+
+void SvxUnoMarkerTable::dispose()
+{
+ ItemPoolVector::iterator aIter = maItemSetVector.begin();
+ const ItemPoolVector::iterator aEnd = maItemSetVector.end();
+
+ while( aIter != aEnd )
+ {
+ delete (*aIter++);
+ }
+
+ maItemSetVector.clear();
+}
+
+// SfxListener
+void SvxUnoMarkerTable::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw()
+{
+ const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
+
+ if( pSdrHint && HINT_MODELCLEARED == pSdrHint->GetKind() )
+ dispose();
+}
+
+sal_Bool SAL_CALL SvxUnoMarkerTable::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException)
+{
+ uno::Sequence< OUString > aSNL( getSupportedServiceNames() );
+ const OUString * pArray = aSNL.getConstArray();
+
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == ServiceName )
+ return sal_True;
+
+ return sal_False;
+}
+
+OUString SAL_CALL SvxUnoMarkerTable::getImplementationName() throw( uno::RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoMarkerTable") );
+}
+
+uno::Sequence< OUString > SAL_CALL SvxUnoMarkerTable::getSupportedServiceNames( )
+ throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aSNS( 1 );
+ aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.MarkerTable" ));
+ return aSNS;
+}
+
+void SAL_CALL SvxUnoMarkerTable::ImplInsertByName( const OUString& aName, const uno::Any& aElement )
+{
+ SfxItemSet* mpInSet = new SfxItemSet( *mpModelPool, XATTR_LINESTART, XATTR_LINEEND );
+ maItemSetVector.push_back( mpInSet );
+
+ XLineEndItem aEndMarker;
+ aEndMarker.SetName( String( aName ) );
+ aEndMarker.PutValue( aElement );
+
+ mpInSet->Put( aEndMarker, XATTR_LINEEND );
+
+ XLineStartItem aStartMarker;
+ aStartMarker.SetName( String( aName ) );
+ aStartMarker.PutValue( aElement );
+
+ mpInSet->Put( aStartMarker, XATTR_LINESTART );
+}
+
+// XNameContainer
+void SAL_CALL SvxUnoMarkerTable::insertByName( const OUString& aApiName, const uno::Any& aElement )
+ throw( lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( hasByName( aApiName ) )
+ throw container::ElementExistException();
+
+ String aName;
+ SvxUnogetInternalNameForItem( XATTR_LINEEND, aApiName, aName );
+
+ ImplInsertByName( aName, aElement );
+}
+
+void SAL_CALL SvxUnoMarkerTable::removeByName( const OUString& aApiName )
+ throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ // a little quickfix for 2.0 to let applications clear api
+ // created items that are not used
+ if( aApiName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("~clear~") ) )
+ {
+ dispose();
+ return;
+ }
+
+ String Name;
+ SvxUnogetInternalNameForItem( XATTR_LINEEND, aApiName, Name );
+
+ ItemPoolVector::iterator aIter = maItemSetVector.begin();
+ const ItemPoolVector::iterator aEnd = maItemSetVector.end();
+
+ NameOrIndex *pItem;
+ const String aSearchName( Name );
+
+ while( aIter != aEnd )
+ {
+ pItem = (NameOrIndex *)&((*aIter)->Get( XATTR_LINEEND ) );
+ if( pItem->GetName() == aSearchName )
+ {
+ delete (*aIter);
+ maItemSetVector.erase( aIter );
+ return;
+ }
+ aIter++;
+ }
+
+ if( !hasByName( Name ) )
+ throw container::NoSuchElementException();
+}
+
+// XNameReplace
+void SAL_CALL SvxUnoMarkerTable::replaceByName( const OUString& aApiName, const uno::Any& aElement )
+ throw( lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ String aName;
+ SvxUnogetInternalNameForItem( XATTR_LINEEND, aApiName, aName );
+
+ ItemPoolVector::iterator aIter = maItemSetVector.begin();
+ const ItemPoolVector::iterator aEnd = maItemSetVector.end();
+
+ NameOrIndex *pItem;
+ const String aSearchName( aName );
+
+ while( aIter != aEnd )
+ {
+ pItem = (NameOrIndex *)&((*aIter)->Get( XATTR_LINEEND ) );
+ if( pItem->GetName() == aSearchName )
+ {
+ XLineEndItem aEndMarker;
+ aEndMarker.SetName( aSearchName );
+ if( !aEndMarker.PutValue( aElement ) )
+ throw lang::IllegalArgumentException();
+
+ (*aIter)->Put( aEndMarker, XATTR_LINEEND );
+
+ XLineStartItem aStartMarker;
+ aStartMarker.SetName( aSearchName );
+ aStartMarker.PutValue( aElement );
+
+ (*aIter)->Put( aStartMarker, XATTR_LINESTART );
+ return;
+ }
+ aIter++;
+ }
+
+ // if it is not in our own sets, modify the pool!
+ sal_Bool bFound = sal_False;
+
+ sal_uInt32 nSurrogate;
+ const sal_uInt32 nStartCount = mpModelPool ? mpModelPool->GetItemCount2( XATTR_LINESTART ) : 0;
+ for( nSurrogate = 0; nSurrogate < nStartCount; nSurrogate++ )
+ {
+ pItem = (NameOrIndex*)mpModelPool->GetItem2( XATTR_LINESTART, nSurrogate);
+ if( pItem && pItem->GetName() == aSearchName )
+ {
+ pItem->PutValue( aElement );
+ bFound = sal_True;
+ break;
+ }
+ }
+
+ const sal_uInt32 nEndCount = mpModelPool ? mpModelPool->GetItemCount2( XATTR_LINEEND ) : 0;
+ for( nSurrogate = 0; nSurrogate < nEndCount; nSurrogate++ )
+ {
+ pItem = (NameOrIndex*)mpModelPool->GetItem2( XATTR_LINEEND, nSurrogate);
+ if( pItem && pItem->GetName() == aSearchName )
+ {
+ pItem->PutValue( aElement );
+ bFound = sal_True;
+ break;
+ }
+ }
+
+ if( bFound )
+ ImplInsertByName( aName, aElement );
+ else
+ throw container::NoSuchElementException();
+}
+
+static sal_Bool getByNameFromPool( const String& rSearchName, SfxItemPool* pPool, sal_uInt16 nWhich, uno::Any& rAny )
+{
+ NameOrIndex *pItem;
+ const sal_uInt32 nSurrogateCount = pPool ? pPool->GetItemCount2( nWhich ) : 0;
+ for( sal_uInt32 nSurrogate = 0; nSurrogate < nSurrogateCount; nSurrogate++ )
+ {
+ pItem = (NameOrIndex*)pPool->GetItem2( nWhich, nSurrogate );
+
+ if( pItem && pItem->GetName() == rSearchName )
+ {
+ pItem->QueryValue( rAny, 0 );
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+// XNameAccess
+uno::Any SAL_CALL SvxUnoMarkerTable::getByName( const OUString& aApiName )
+ throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ String aName;
+ SvxUnogetInternalNameForItem( XATTR_LINEEND, aApiName, aName );
+
+ uno::Any aAny;
+
+ if( mpModelPool && aName.Len() != 0 )
+ {
+ do
+ {
+ const String aSearchName( aName );
+ if( getByNameFromPool( aSearchName, mpModelPool, XATTR_LINESTART, aAny ) )
+ break;
+
+ if( getByNameFromPool( aSearchName, mpModelPool, XATTR_LINEEND, aAny ) )
+ break;
+
+ throw container::NoSuchElementException();
+ }
+ while(0);
+ }
+
+ return aAny;
+}
+
+static void createNamesForPool( SfxItemPool* pPool, sal_uInt16 nWhich, std::set< OUString, comphelper::UStringLess >& rNameSet )
+{
+ const sal_uInt32 nSuroCount = pPool->GetItemCount2( nWhich );
+ sal_uInt32 nSurrogate;
+
+ NameOrIndex* pItem;
+ OUString aName;
+
+ for( nSurrogate = 0; nSurrogate < nSuroCount; nSurrogate++ )
+ {
+ pItem = (NameOrIndex*)pPool->GetItem2( nWhich, nSurrogate );
+
+ if( pItem == NULL || pItem->GetName().Len() == 0 )
+ continue;
+
+ SvxUnogetApiNameForItem( XATTR_LINEEND, pItem->GetName(), aName );
+ rNameSet.insert( aName );
+ }
+}
+
+uno::Sequence< OUString > SAL_CALL SvxUnoMarkerTable::getElementNames()
+ throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ std::set< OUString, comphelper::UStringLess > aNameSet;
+
+ // search model pool for line starts
+ createNamesForPool( mpModelPool, XATTR_LINESTART, aNameSet );
+
+ // search model pool for line ends
+ createNamesForPool( mpModelPool, XATTR_LINEEND, aNameSet );
+
+ uno::Sequence< OUString > aSeq( aNameSet.size() );
+ OUString* pNames = aSeq.getArray();
+
+ std::set< OUString, comphelper::UStringLess >::iterator aIter( aNameSet.begin() );
+ const std::set< OUString, comphelper::UStringLess >::iterator aEnd( aNameSet.end() );
+
+ while( aIter != aEnd )
+ {
+ *pNames++ = *aIter++;
+ }
+
+ return aSeq;
+}
+
+sal_Bool SAL_CALL SvxUnoMarkerTable::hasByName( const OUString& aName )
+ throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( aName.getLength() == 0 )
+ return sal_False;
+
+ String aSearchName;
+
+ NameOrIndex *pItem;
+
+ SvxUnogetInternalNameForItem( XATTR_LINESTART, aName, aSearchName );
+ sal_uInt32 nStartCount = mpModelPool ? mpModelPool->GetItemCount2( XATTR_LINESTART ) : 0;
+ sal_uInt32 nSurrogate;
+ for( nSurrogate = 0; nSurrogate < nStartCount; nSurrogate++ )
+ {
+ pItem = (NameOrIndex*)mpModelPool->GetItem2( XATTR_LINESTART, nSurrogate);
+ if( pItem && pItem->GetName() == aSearchName )
+ return sal_True;
+ }
+
+ SvxUnogetInternalNameForItem( XATTR_LINEEND, aName, aSearchName );
+ sal_uInt32 nEndCount = mpModelPool ? mpModelPool->GetItemCount2( XATTR_LINEEND ) : 0;
+ for( nSurrogate = 0; nSurrogate < nEndCount; nSurrogate++ )
+ {
+ pItem = (NameOrIndex*)mpModelPool->GetItem2( XATTR_LINEEND, nSurrogate);
+ if( pItem && pItem->GetName() == aSearchName )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+// XElementAccess
+uno::Type SAL_CALL SvxUnoMarkerTable::getElementType( )
+ throw( uno::RuntimeException )
+{
+ return ::getCppuType((const drawing::PointSequence*)0);
+}
+
+sal_Bool SAL_CALL SvxUnoMarkerTable::hasElements( )
+ throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ NameOrIndex *pItem;
+
+ const sal_uInt32 nStartCount = mpModelPool ? mpModelPool->GetItemCount2( XATTR_LINESTART ) : 0;
+ sal_uInt32 nSurrogate;
+ for( nSurrogate = 0; nSurrogate < nStartCount; nSurrogate++ )
+ {
+ pItem = (NameOrIndex*)mpModelPool->GetItem2( XATTR_LINESTART, nSurrogate);
+ if( pItem && pItem->GetName().Len() != 0 )
+ return sal_True;
+ }
+
+ const sal_uInt32 nEndCount = mpModelPool ? mpModelPool->GetItemCount2( XATTR_LINEEND ) : 0;
+ for( nSurrogate = 0; nSurrogate < nEndCount; nSurrogate++ )
+ {
+ pItem = (NameOrIndex*)mpModelPool->GetItem2( XATTR_LINEEND, nSurrogate);
+ if( pItem && pItem->GetName().Len() != 0 )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+/**
+ * Create a hatchtable
+ */
+uno::Reference< uno::XInterface > SAL_CALL SvxUnoMarkerTable_createInstance( SdrModel* pModel )
+{
+ return *new SvxUnoMarkerTable(pModel);
+}
+
+
+
diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx
new file mode 100644
index 000000000000..3602158722a9
--- /dev/null
+++ b/svx/source/unodraw/unopage.cxx
@@ -0,0 +1,1006 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#define _SVX_USE_UNOGLOBALS_
+#include <com/sun/star/document/EventObject.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <vos/mutex.hxx>
+#include <osl/mutex.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sot/clsids.hxx>
+#include <comphelper/serviceinfohelper.hxx>
+
+#include <rtl/uuid.h>
+#include <rtl/memory.h>
+#include <sfx2/objsh.hxx>
+#include <svx/svdpool.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/unopage.hxx>
+#include "shapeimpl.hxx"
+#include "svx/globl3d.hxx"
+#include <svx/polysc3d.hxx>
+#include <svx/unoprov.hxx>
+#include <svx/svdopath.hxx>
+#include "svx/unoapi.hxx"
+#include <svx/svdomeas.hxx>
+#include <svx/extrud3d.hxx>
+#include <svx/lathe3d.hxx>
+#include <vcl/svapp.hxx>
+#include <tools/diagnose_ex.h>
+
+using ::rtl::OUString;
+using namespace ::vos;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::drawing;
+
+#define INTERFACE_TYPE( xint ) \
+ ::getCppuType((const Reference< xint >*)0)
+
+#define QUERYINT( xint ) \
+ if( rType == ::getCppuType((const Reference< xint >*)0) ) \
+ aAny <<= Reference< xint >(this)
+
+DECLARE_LIST( SvxDrawPageList, SvxDrawPage * )
+
+
+/**********************************************************************
+* class SvxDrawPage *
+**********************************************************************/
+
+UNO3_GETIMPLEMENTATION_IMPL( SvxDrawPage );
+DBG_NAME(SvxDrawPage)
+SvxDrawPage::SvxDrawPage( SdrPage* pInPage ) throw()
+: mrBHelper( getMutex() )
+, mpPage( pInPage )
+, mpModel( 0 )
+{
+ DBG_CTOR(SvxDrawPage,NULL);
+ // Am Broadcaster anmelden
+ if( mpPage )
+ mpModel = mpPage->GetModel();
+ if( mpModel )
+ StartListening( *mpModel );
+
+
+ // Erzeugen der (hidden) ::com::sun::star::sdbcx::View
+ mpView = new SdrView( mpModel );
+ if( mpView )
+ mpView->SetDesignMode(sal_True);
+}
+
+//----------------------------------------------------------------------
+// Ctor fuer SvxDrawPage_NewInstance()
+//----------------------------------------------------------------------
+SvxDrawPage::SvxDrawPage() throw()
+: mrBHelper( getMutex() )
+, mpPage( NULL )
+, mpModel( NULL )
+, mpView( NULL )
+{
+ DBG_CTOR(SvxDrawPage,NULL);
+}
+
+//----------------------------------------------------------------------
+SvxDrawPage::~SvxDrawPage() throw()
+{
+ DBG_ASSERT( mrBHelper.bDisposed, "SvxDrawPage must be disposed!" );
+ if( !mrBHelper.bDisposed )
+ {
+ acquire();
+ dispose();
+ }
+ DBG_DTOR(SvxDrawPage,NULL);
+}
+
+//----------------------------------------------------------------------
+
+// XInterface
+void SvxDrawPage::release() throw()
+{
+/*
+ uno::Reference< uno::XInterface > x( xDelegator );
+ if (! x.is())
+ {
+ if (osl_decrementInterlockedCount( &m_refCount ) == 0)
+ {
+ if (! mrBHelper.bDisposed)
+ {
+ uno::Reference< uno::XInterface > xHoldAlive( (uno::XWeak*)this );
+ // First dispose
+ try
+ {
+ dispose();
+ }
+ catch(::com::sun::star::uno::Exception&)
+ {
+ // release should not throw exceptions
+ }
+
+ // only the alive ref holds the object
+ OSL_ASSERT( m_refCount == 1 );
+ // destroy the object if xHoldAlive decrement the refcount to 0
+ return;
+ }
+ }
+ // restore the reference count
+ osl_incrementInterlockedCount( &m_refCount );
+ }
+*/
+ OWeakAggObject::release();
+}
+
+//----------------------------------------------------------------------
+
+SvxDrawPage* SvxDrawPage::GetPageForSdrPage( SdrPage* mpPage ) throw()
+{
+ return getImplementation( mpPage->getUnoPage() );
+}
+
+// XComponent
+void SvxDrawPage::disposing() throw()
+{
+ if( mpModel )
+ {
+ EndListening( *mpModel );
+ mpModel = NULL;
+ }
+
+ if( mpView )
+ {
+ delete mpView;
+ mpView = NULL;
+ }
+ mpPage = 0;
+}
+
+//----------------------------------------------------------------------
+// XComponent
+//----------------------------------------------------------------------
+
+void SvxDrawPage::dispose()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ // An frequently programming error is to release the last
+ // reference to this object in the disposing message.
+ // Make it rubust, hold a self Reference.
+ uno::Reference< lang::XComponent > xSelf( this );
+
+ // Guard dispose against multible threading
+ // Remark: It is an error to call dispose more than once
+ sal_Bool bDoDispose = sal_False;
+ {
+ osl::MutexGuard aGuard( mrBHelper.rMutex );
+ if( !mrBHelper.bDisposed && !mrBHelper.bInDispose )
+ {
+ // only one call go into this section
+ mrBHelper.bInDispose = sal_True;
+ bDoDispose = sal_True;
+ }
+ }
+
+ // Do not hold the mutex because we are broadcasting
+ if( bDoDispose )
+ {
+ // Create an event with this as sender
+ try
+ {
+ uno::Reference< uno::XInterface > xSource( uno::Reference< uno::XInterface >::query( (lang::XComponent *)this ) );
+ ::com::sun::star::document::EventObject aEvt;
+ aEvt.Source = xSource;
+ // inform all listeners to release this object
+ // The listener container are automaticly cleared
+ mrBHelper.aLC.disposeAndClear( aEvt );
+ // notify subclasses to do their dispose
+ disposing();
+ }
+ catch(::com::sun::star::uno::Exception& e)
+ {
+ // catch exception and throw again but signal that
+ // the object was disposed. Dispose should be called
+ // only once.
+ mrBHelper.bDisposed = sal_True;
+ mrBHelper.bInDispose = sal_False;
+ throw e;
+ }
+
+ // the values bDispose and bInDisposing must set in this order.
+ // No multithread call overcome the "!rBHelper.bDisposed && !rBHelper.bInDispose" guard.
+ mrBHelper.bDisposed = sal_True;
+ mrBHelper.bInDispose = sal_False;
+ }
+
+}
+
+//----------------------------------------------------------------------
+
+void SAL_CALL SvxDrawPage::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mpModel == 0 )
+ throw lang::DisposedException();
+
+ mrBHelper.addListener( ::getCppuType( &aListener ) , aListener );
+}
+
+//----------------------------------------------------------------------
+
+void SAL_CALL SvxDrawPage::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mpModel == 0 )
+ throw lang::DisposedException();
+
+ mrBHelper.removeListener( ::getCppuType( &aListener ) , aListener );
+}
+
+//----------------------------------------------------------------------
+// SfxListener
+//----------------------------------------------------------------------
+
+void SvxDrawPage::Notify( SfxBroadcaster&, const SfxHint& /*rHint*/ )
+{
+/*
+ if( mpModel )
+ {
+ const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
+ if( pSdrHint )
+ {
+ switch( pSdrHint->GetKind() )
+ {
+ case HINT_MODELCLEARED:
+ dispose();
+ break;
+ default:
+ break;
+ }
+ }
+ }
+*/
+}
+
+//----------------------------------------------------------------------
+// ::com::sun::star::drawing::XShapes
+//----------------------------------------------------------------------
+
+void SAL_CALL SvxDrawPage::add( const uno::Reference< drawing::XShape >& xShape )
+ throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if ( ( mpModel == NULL ) || ( mpPage == NULL ) )
+ throw lang::DisposedException();
+
+ SvxShape* pShape = SvxShape::getImplementation( xShape );
+
+ if( NULL == pShape )
+ return;
+
+ SdrObject *pObj = pShape->GetSdrObject();
+
+ if(!pObj)
+ {
+ pObj = CreateSdrObject( xShape );
+ ENSURE_OR_RETURN_VOID( pObj != NULL, "SvxDrawPage::add: no SdrObject was created!" );
+ }
+ else if ( !pObj->IsInserted() )
+ {
+ pObj->SetModel(mpModel);
+ mpPage->InsertObject( pObj );
+ }
+
+ pShape->Create( pObj, this );
+ OSL_ENSURE( pShape->GetSdrObject() == pObj, "SvxDrawPage::add: shape does not know about its newly created SdrObject!" );
+
+ mpModel->SetChanged();
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SvxDrawPage::remove( const Reference< drawing::XShape >& xShape )
+ throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( (mpModel == 0) || (mpPage == 0) )
+ throw lang::DisposedException();
+
+ SvxShape* pShape = SvxShape::getImplementation( xShape );
+
+ if(pShape)
+ {
+ SdrObject* pObj = pShape->GetSdrObject();
+ if(pObj)
+ {
+ // SdrObject aus der Page loeschen
+ sal_uInt32 nCount = mpPage->GetObjCount();
+ for( sal_uInt32 nNum = 0; nNum < nCount; nNum++ )
+ {
+ if(mpPage->GetObj(nNum) == pObj)
+ {
+ OSL_VERIFY( mpPage->RemoveObject( nNum ) == pObj );
+ SdrObject::Free( pObj );
+ break;
+ }
+ }
+ }
+ }
+
+ if( mpModel )
+ mpModel->SetChanged();
+}
+
+//----------------------------------------------------------------------
+// ::com::sun::star::container::XIndexAccess
+//----------------------------------------------------------------------
+
+sal_Int32 SAL_CALL SvxDrawPage::getCount()
+ throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( (mpModel == 0) || (mpPage == 0) )
+ throw lang::DisposedException();
+
+ return( (sal_Int32) mpPage->GetObjCount() );
+}
+
+//----------------------------------------------------------------------
+uno::Any SAL_CALL SvxDrawPage::getByIndex( sal_Int32 Index )
+ throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( (mpModel == 0) || (mpPage == 0) )
+ throw lang::DisposedException();
+
+ if ( Index < 0 || Index >= (sal_Int32)mpPage->GetObjCount() )
+ throw lang::IndexOutOfBoundsException();
+
+ SdrObject* pObj = mpPage->GetObj( Index );
+ if( pObj == NULL )
+ throw uno::RuntimeException();
+
+
+ return makeAny(Reference< drawing::XShape >( pObj->getUnoShape(), uno::UNO_QUERY ));
+}
+
+
+//----------------------------------------------------------------------
+// ::com::sun::star::container::XElementAccess
+//----------------------------------------------------------------------
+
+uno::Type SAL_CALL SvxDrawPage::getElementType()
+ throw( uno::RuntimeException )
+{
+ return INTERFACE_TYPE( drawing::XShape );
+}
+
+//----------------------------------------------------------------------
+sal_Bool SAL_CALL SvxDrawPage::hasElements()
+ throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( (mpModel == 0) || (mpPage == 0) )
+ throw lang::DisposedException();
+
+ return mpPage && mpPage->GetObjCount()>0;
+}
+
+namespace
+{
+ void lcl_markSdrObjectOfShape( const Reference< drawing::XShape >& _rxShape, SdrView& _rView, SdrPageView& _rPageView )
+ {
+ SvxShape* pShape = SvxShape::getImplementation( _rxShape );
+ if ( !pShape )
+ return;
+
+ SdrObject* pObj = pShape->GetSdrObject();
+ if ( !pObj )
+ return;
+
+ _rView.MarkObj( pObj, &_rPageView );
+ }
+}
+
+//----------------------------------------------------------------------
+// ACHTUNG: _SelectObjectsInView selektiert die ::com::sun::star::drawing::Shapes nur in der angegebennen
+// SdrPageView. Dies muß nicht die sichtbare SdrPageView sein.
+//----------------------------------------------------------------------
+void SvxDrawPage::_SelectObjectsInView( const Reference< drawing::XShapes > & aShapes, SdrPageView* pPageView ) throw ()
+{
+ DBG_ASSERT(pPageView,"SdrPageView ist NULL! [CL]");
+ DBG_ASSERT(mpView, "SdrView ist NULL! [CL]");
+
+ if(pPageView!=NULL && mpView!=NULL)
+ {
+ mpView->UnmarkAllObj( pPageView );
+
+ long nCount = aShapes->getCount();
+ for( long i = 0; i < nCount; i++ )
+ {
+ uno::Any aAny( aShapes->getByIndex(i) );
+ Reference< drawing::XShape > xShape;
+ if( aAny >>= xShape )
+ lcl_markSdrObjectOfShape( xShape, *mpView, *pPageView );
+ }
+ }
+}
+
+//----------------------------------------------------------------------
+// ACHTUNG: _SelectObjectInView selektiert das Shape *nur* in der angegebennen
+// SdrPageView. Dies muß nicht die sichtbare SdrPageView sein.
+//----------------------------------------------------------------------
+void SvxDrawPage::_SelectObjectInView( const Reference< drawing::XShape > & xShape, SdrPageView* pPageView ) throw()
+{
+ DBG_ASSERT(pPageView,"SdrPageView ist NULL! [CL]");
+ DBG_ASSERT(mpView, "SdrView ist NULL! [CL]");
+
+ if(pPageView!=NULL && mpView != NULL)
+ {
+ mpView->UnmarkAllObj( pPageView );
+ lcl_markSdrObjectOfShape( xShape, *mpView, *pPageView );
+ }
+}
+
+//----------------------------------------------------------------------
+Reference< drawing::XShapeGroup > SAL_CALL SvxDrawPage::group( const Reference< drawing::XShapes >& xShapes )
+ throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( (mpModel == 0) || (mpPage == 0) )
+ throw lang::DisposedException();
+
+ DBG_ASSERT(mpPage,"SdrPage ist NULL! [CL]");
+ DBG_ASSERT(mpView, "SdrView ist NULL! [CL]");
+
+ Reference< ::com::sun::star::drawing::XShapeGroup > xShapeGroup;
+ if(mpPage==NULL||mpView==NULL||!xShapes.is())
+ return xShapeGroup;
+
+ SdrPageView* pPageView = mpView->ShowSdrPage( mpPage );
+
+ _SelectObjectsInView( xShapes, pPageView );
+
+ mpView->GroupMarked();
+
+ mpView->AdjustMarkHdl();
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+ if( rMarkList.GetMarkCount() == 1 )
+ {
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ if( pObj )
+ xShapeGroup = Reference< drawing::XShapeGroup >::query( pObj->getUnoShape() );
+ }
+
+ mpView->HideSdrPage();
+
+ if( mpModel )
+ mpModel->SetChanged();
+
+ return xShapeGroup;
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SvxDrawPage::ungroup( const Reference< drawing::XShapeGroup >& aGroup )
+ throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( (mpModel == 0) || (mpPage == 0) )
+ throw lang::DisposedException();
+
+ DBG_ASSERT(mpPage,"SdrPage ist NULL! [CL]");
+ DBG_ASSERT(mpView, "SdrView ist NULL! [CL]");
+
+ if(mpPage==NULL||mpView==NULL||!aGroup.is())
+ return;
+
+ SdrPageView* pPageView = mpView->ShowSdrPage( mpPage );
+
+ Reference< drawing::XShape > xShape( aGroup, UNO_QUERY );
+ _SelectObjectInView( xShape, pPageView );
+ mpView->UnGroupMarked();
+
+ mpView->HideSdrPage();
+
+ if( mpModel )
+ mpModel->SetChanged();
+}
+
+//----------------------------------------------------------------------
+SdrObject *SvxDrawPage::_CreateSdrObject( const Reference< drawing::XShape > & xShape ) throw()
+{
+ sal_uInt16 nType;
+ sal_uInt32 nInventor;
+
+ GetTypeAndInventor( nType, nInventor, xShape->getShapeType() );
+ SdrObject* pNewObj = 0;
+
+ if( nType != 0 )
+ {
+ awt::Size aSize = xShape->getSize();
+ aSize.Width += 1;
+ aSize.Height += 1;
+ awt::Point aPos = xShape->getPosition();
+ Rectangle aRect( Point( aPos.X, aPos.Y ), Size( aSize.Width, aSize.Height ) );
+
+ // special cases
+ if( nInventor == SdrInventor )
+ {
+ switch( nType )
+ {
+ case OBJ_MEASURE:
+ {
+ pNewObj = new SdrMeasureObj( aRect.TopLeft(), aRect.BottomRight() );
+ break;
+ }
+ case OBJ_LINE:
+ {
+ basegfx::B2DPolygon aPoly;
+ aPoly.append(basegfx::B2DPoint(aRect.Left(), aRect.Top()));
+ aPoly.append(basegfx::B2DPoint(aRect.Right(), aRect.Bottom()));
+ pNewObj = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPoly));
+ break;
+ }
+ }
+ }
+
+ if( pNewObj == NULL )
+ pNewObj = SdrObjFactory::MakeNewObject( nInventor, nType, mpPage );
+
+ if(pNewObj)
+ {
+ pNewObj->SetSnapRect(aRect);
+
+ if( pNewObj->ISA(E3dPolyScene))
+ {
+ // Szene initialisieren
+ E3dScene* pScene = (E3dScene*)pNewObj;
+
+ double fW = (double)aSize.Width;
+ double fH = (double)aSize.Height;
+
+ Camera3D aCam(pScene->GetCamera());
+ aCam.SetAutoAdjustProjection(sal_False);
+ aCam.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
+ basegfx::B3DPoint aLookAt;
+ basegfx::B3DPoint aCamPos(0.0, 0.0, 10000.0);
+ aCam.SetPosAndLookAt(aCamPos, aLookAt);
+ aCam.SetFocalLength(100.0);
+ aCam.SetDefaults(aCamPos, aLookAt, 10000.0);
+ pScene->SetCamera(aCam);
+
+ pScene->SetRectsDirty();
+ }
+ else if(pNewObj->ISA(E3dExtrudeObj))
+ {
+ E3dExtrudeObj* pObj = (E3dExtrudeObj*)pNewObj;
+ basegfx::B2DPolygon aNewPolygon;
+ aNewPolygon.append(basegfx::B2DPoint(0.0, 0.0));
+ aNewPolygon.append(basegfx::B2DPoint(0.0, 1.0));
+ aNewPolygon.append(basegfx::B2DPoint(1.0, 0.0));
+ aNewPolygon.setClosed(true);
+ pObj->SetExtrudePolygon(basegfx::B2DPolyPolygon(aNewPolygon));
+
+ // #107245# pObj->SetExtrudeCharacterMode(sal_True);
+ pObj->SetMergedItem(Svx3DCharacterModeItem(sal_True));
+ }
+ else if(pNewObj->ISA(E3dLatheObj))
+ {
+ E3dLatheObj* pObj = (E3dLatheObj*)pNewObj;
+ basegfx::B2DPolygon aNewPolygon;
+ aNewPolygon.append(basegfx::B2DPoint(0.0, 0.0));
+ aNewPolygon.append(basegfx::B2DPoint(0.0, 1.0));
+ aNewPolygon.append(basegfx::B2DPoint(1.0, 0.0));
+ aNewPolygon.setClosed(true);
+ pObj->SetPolyPoly2D(basegfx::B2DPolyPolygon(aNewPolygon));
+
+ // #107245# pObj->SetLatheCharacterMode(sal_True);
+ pObj->SetMergedItem(Svx3DCharacterModeItem(sal_True));
+ }
+ }
+ }
+
+ return pNewObj;
+}
+
+//----------------------------------------------------------------------
+void SvxDrawPage::GetTypeAndInventor( sal_uInt16& rType, sal_uInt32& rInventor, const OUString& aName ) const throw()
+{
+ sal_uInt32 nTempType = aSdrShapeIdentifierMap.getId( aName );
+
+ if( nTempType == UHASHMAP_NOTFOUND )
+ {
+ if( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TableShape")) ||
+ aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TableShape")) )
+ {
+ rInventor = SdrInventor;
+ rType = OBJ_TABLE;
+ }
+ else if( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.MediaShape" )) )
+ {
+ rInventor = SdrInventor;
+ rType = OBJ_MEDIA;
+ }
+ }
+ else if(nTempType & E3D_INVENTOR_FLAG)
+ {
+ rInventor = E3dInventor;
+ rType = (sal_uInt16)(nTempType & ~E3D_INVENTOR_FLAG);
+ }
+ else
+ {
+ rInventor = SdrInventor;
+ rType = (sal_uInt16)nTempType;
+
+ switch( rType )
+ {
+ case OBJ_FRAME:
+ case OBJ_OLE2_PLUGIN:
+ case OBJ_OLE2_APPLET:
+ rType = OBJ_OLE2;
+ break;
+ }
+ }
+}
+
+//----------------------------------------------------------------------
+SvxShape* SvxDrawPage::CreateShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt32 nInventor, SdrObject *pObj, SvxDrawPage *mpPage ) throw()
+{
+ SvxShape* pRet = NULL;
+ switch( nInventor )
+ {
+ case E3dInventor:
+ {
+ switch( nType )
+ {
+ case E3D_SCENE_ID :
+ case E3D_POLYSCENE_ID :
+ pRet = new Svx3DSceneObject( pObj, mpPage );
+ break;
+ case E3D_CUBEOBJ_ID :
+ pRet = new Svx3DCubeObject( pObj );
+ break;
+ case E3D_SPHEREOBJ_ID :
+ pRet = new Svx3DSphereObject( pObj );
+ break;
+ case E3D_LATHEOBJ_ID :
+ pRet = new Svx3DLatheObject( pObj );
+ break;
+ case E3D_EXTRUDEOBJ_ID :
+ pRet = new Svx3DExtrudeObject( pObj );
+ break;
+ case E3D_POLYGONOBJ_ID :
+ pRet = new Svx3DPolygonObject( pObj );
+ break;
+ default: // unbekanntes 3D-Objekt auf der Page
+ pRet = new SvxShape( pObj );
+ break;
+ }
+ break;
+ }
+ case SdrInventor:
+ {
+ switch( nType )
+ {
+// case OBJ_NONE:
+// break;
+ case OBJ_GRUP:
+ pRet = new SvxShapeGroup( pObj, mpPage );
+ break;
+ case OBJ_LINE:
+ pRet = new SvxShapePolyPolygon( pObj , PolygonKind_LINE );
+ break;
+ case OBJ_RECT:
+ pRet = new SvxShapeRect( pObj );
+ break;
+ case OBJ_CIRC:
+ case OBJ_SECT:
+ case OBJ_CARC:
+ case OBJ_CCUT:
+ pRet = new SvxShapeCircle( pObj );
+ break;
+ case OBJ_POLY:
+ pRet = new SvxShapePolyPolygon( pObj , PolygonKind_POLY );
+ break;
+ case OBJ_PLIN:
+ pRet = new SvxShapePolyPolygon( pObj , PolygonKind_PLIN );
+ break;
+ case OBJ_SPLNLINE:
+ case OBJ_PATHLINE:
+ pRet = new SvxShapePolyPolygonBezier( pObj , PolygonKind_PATHLINE );
+ break;
+ case OBJ_SPLNFILL:
+ case OBJ_PATHFILL:
+ pRet = new SvxShapePolyPolygonBezier( pObj , PolygonKind_PATHFILL );
+ break;
+ case OBJ_FREELINE:
+ pRet = new SvxShapePolyPolygonBezier( pObj , PolygonKind_FREELINE );
+ break;
+ case OBJ_FREEFILL:
+ pRet = new SvxShapePolyPolygonBezier( pObj , PolygonKind_FREEFILL );
+ break;
+ case OBJ_CAPTION:
+ pRet = new SvxShapeCaption( pObj );
+ break;
+ case OBJ_TITLETEXT:
+ case OBJ_OUTLINETEXT:
+ case OBJ_TEXT:
+ pRet = new SvxShapeText( pObj );
+ break;
+ case OBJ_GRAF:
+ pRet = new SvxGraphicObject( pObj );
+ break;
+ case OBJ_FRAME:
+ pRet = new SvxFrameShape( pObj );
+ break;
+ case OBJ_OLE2_APPLET:
+ pRet = new SvxAppletShape( pObj );
+ break;
+ case OBJ_OLE2_PLUGIN:
+ pRet = new SvxPluginShape( pObj );
+ break;
+ case OBJ_OLE2:
+ {
+ if( pObj && !pObj->IsEmptyPresObj() && mpPage )
+ {
+ SdrPage* pSdrPage = mpPage->GetSdrPage();
+ if( pSdrPage )
+ {
+ SdrModel* pSdrModel = pSdrPage->GetModel();
+ if( pSdrModel )
+ {
+ ::comphelper::IEmbeddedHelper *pPersist = pSdrModel->GetPersist();
+ if( pPersist )
+ {
+ uno::Reference < embed::XEmbeddedObject > xObject = pPersist->getEmbeddedObjectContainer().
+ GetEmbeddedObject( static_cast< SdrOle2Obj* >( pObj )->GetPersistName() );
+
+ // TODO CL->KA: Why is this not working anymore?
+ if( xObject.is() )
+ {
+ SvGlobalName aClassId( xObject->getClassID() );
+
+ const SvGlobalName aAppletClassId( SO3_APPLET_CLASSID );
+ const SvGlobalName aPluginClassId( SO3_PLUGIN_CLASSID );
+ const SvGlobalName aIFrameClassId( SO3_IFRAME_CLASSID );
+
+ if( aPluginClassId == aClassId )
+ {
+ pRet = new SvxPluginShape( pObj );
+ nType = OBJ_OLE2_PLUGIN;
+ }
+ else if( aAppletClassId == aClassId )
+ {
+ pRet = new SvxAppletShape( pObj );
+ nType = OBJ_OLE2_APPLET;
+ }
+ else if( aIFrameClassId == aClassId )
+ {
+ pRet = new SvxFrameShape( pObj );
+ nType = OBJ_FRAME;
+ }
+ }
+ }
+ }
+ }
+ }
+ if( pRet == NULL )
+ {
+ pRet = new SvxOle2Shape( pObj, aSvxMapProvider.GetMap(SVXMAP_OLE2), aSvxMapProvider.GetPropertySet(SVXMAP_OLE2, SdrObject::GetGlobalDrawObjectItemPool()) );
+ }
+ }
+ break;
+ case OBJ_EDGE:
+ pRet = new SvxShapeConnector( pObj );
+ break;
+ case OBJ_PATHPOLY:
+ pRet = new SvxShapePolyPolygon( pObj , PolygonKind_PATHPOLY );
+ break;
+ case OBJ_PATHPLIN:
+ pRet = new SvxShapePolyPolygon( pObj , PolygonKind_PATHPLIN );
+ break;
+ case OBJ_PAGE:
+ pRet = new SvxShape( pObj, aSvxMapProvider.GetMap(SVXMAP_PAGE), aSvxMapProvider.GetPropertySet(SVXMAP_PAGE, SdrObject::GetGlobalDrawObjectItemPool()) );
+ break;
+ case OBJ_MEASURE:
+ pRet = new SvxShapeDimensioning( pObj );
+ break;
+// case OBJ_DUMMY:
+// break;
+ case OBJ_UNO:
+ pRet = new SvxShapeControl( pObj );
+ break;
+ case OBJ_CUSTOMSHAPE:
+ pRet = new SvxCustomShape( pObj );
+ break;
+ case OBJ_MEDIA:
+ pRet = new SvxMediaShape( pObj );
+ break;
+ case OBJ_TABLE:
+ pRet = new SvxTableShape( pObj );
+ break;
+ default: // unbekanntes 2D-Objekt auf der Page
+ DBG_ERROR("Nicht implementierter Starone-Shape erzeugt! [CL]");
+ pRet = new SvxShapeText( pObj );
+ break;
+ }
+ break;
+ }
+ default: // Unbekannter Inventor
+ {
+ DBG_ERROR("AW: Unknown Inventor in SvxDrawPage::_CreateShape()");
+ break;
+ }
+ }
+
+ if(pRet)
+ {
+ sal_uInt32 nObjId = nType;
+
+ if( nInventor == E3dInventor )
+ nObjId |= E3D_INVENTOR_FLAG;
+
+ switch(nObjId)
+ {
+ case OBJ_CCUT: // Kreisabschnitt
+ case OBJ_CARC: // Kreisbogen
+ case OBJ_SECT: // Kreissektor
+ nObjId = OBJ_CIRC;
+ break;
+
+ case E3D_SCENE_ID | E3D_INVENTOR_FLAG:
+ nObjId = E3D_POLYSCENE_ID | E3D_INVENTOR_FLAG;
+ break;
+
+ case OBJ_TITLETEXT:
+ case OBJ_OUTLINETEXT:
+ nObjId = OBJ_TEXT;
+ break;
+ }
+
+ pRet->setShapeKind(nObjId);
+ }
+
+ return pRet;
+}
+
+//----------------------------------------------------------------------
+Reference< drawing::XShape > SvxDrawPage::_CreateShape( SdrObject *pObj ) const throw()
+{
+ Reference< drawing::XShape > xShape( CreateShapeByTypeAndInventor(pObj->GetObjIdentifier(),
+ pObj->GetObjInventor(),
+ pObj,
+ (SvxDrawPage*)this));
+ return xShape;
+}
+
+//----------------------------------------------------------------------
+SdrObject *SvxDrawPage::CreateSdrObject( const Reference< drawing::XShape > & xShape ) throw()
+{
+ SdrObject* pObj = _CreateSdrObject( xShape );
+ if( pObj && !pObj->IsInserted() )
+ mpPage->InsertObject( pObj );
+
+ return pObj;
+}
+
+//----------------------------------------------------------------------
+// ::com::sun::star::lang::XServiceInfo
+//----------------------------------------------------------------------
+OUString SAL_CALL SvxDrawPage::getImplementationName() throw( uno::RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxDrawPage"));
+}
+
+sal_Bool SAL_CALL SvxDrawPage::supportsService( const OUString& ServiceName )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+uno::Sequence< OUString > SAL_CALL SvxDrawPage::getSupportedServiceNames() throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aSeq( 1 );
+ aSeq.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ShapeCollection" ));
+ return aSeq;
+}
+
+SvxShape* CreateSvxShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt32 nInventor ) throw()
+{
+ return SvxDrawPage::CreateShapeByTypeAndInventor( nType, nInventor );
+}
+
+void SvxDrawPage::ChangeModel( SdrModel* pNewModel )
+{
+ if( pNewModel != mpModel )
+ {
+ if( mpModel )
+ EndListening( *mpModel );
+
+ if( pNewModel )
+ StartListening( *pNewModel );
+
+ mpModel = pNewModel;
+
+ if( mpView )
+ {
+ delete mpView;
+ mpView = new SdrView( mpModel );
+ if( mpView )
+ mpView->SetDesignMode(sal_True);
+ }
+ }
+}
+
+/** returns a StarOffice API wrapper for the given SdrPage */
+uno::Reference< drawing::XDrawPage > GetXDrawPageForSdrPage( SdrPage* pPage ) throw ()
+{
+ if(pPage)
+ {
+ uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
+
+ return xDrawPage;
+ }
+
+ return uno::Reference< drawing::XDrawPage >();
+}
+
+/** returns the SdrObject from the given StarOffice API wrapper */
+SdrPage* GetSdrPageFromXDrawPage( uno::Reference< drawing::XDrawPage > xDrawPage ) throw()
+{
+ if(xDrawPage.is())
+ {
+ SvxDrawPage* pDrawPage = SvxDrawPage::getImplementation( xDrawPage );
+
+ if(pDrawPage)
+ {
+ return pDrawPage->GetSdrPage();
+ }
+ }
+
+ return NULL;
+}
+
+// eof
diff --git a/svx/source/unodraw/unopool.cxx b/svx/source/unodraw/unopool.cxx
new file mode 100644
index 000000000000..fd682129b184
--- /dev/null
+++ b/svx/source/unodraw/unopool.cxx
@@ -0,0 +1,430 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYSTATE_HDL_
+#include <com/sun/star/beans/PropertyState.hpp>
+#endif
+
+#include <comphelper/propertysetinfo.hxx>
+#include <rtl/uuid.h>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include "svx/unopool.hxx"
+#include <svx/svdmodel.hxx>
+#include <svx/svdpool.hxx>
+#include <svx/unoprov.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/unoshprp.hxx>
+#include <svx/xflbstit.hxx>
+#include <svx/xflbmtit.hxx>
+#include <svx/unopage.hxx>
+#include <svx/svdetc.hxx>
+#include <editeng/editeng.hxx>
+
+#include "svx/unoapi.hxx"
+#include <memory>
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+using namespace ::cppu;
+
+SvxUnoDrawPool::SvxUnoDrawPool( SdrModel* pModel, sal_Int32 nServiceId ) throw()
+: PropertySetHelper( SvxPropertySetInfoPool::getOrCreate( nServiceId ) ), mpModel( pModel )
+{
+ init();
+}
+
+/* deprecated */
+SvxUnoDrawPool::SvxUnoDrawPool( SdrModel* pModel ) throw()
+: PropertySetHelper( SvxPropertySetInfoPool::getOrCreate( SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS ) ), mpModel( pModel )
+{
+ init();
+}
+
+SvxUnoDrawPool::~SvxUnoDrawPool() throw()
+{
+ SfxItemPool::Free(mpDefaultsPool);
+}
+
+void SvxUnoDrawPool::init()
+{
+ mpDefaultsPool = new SdrItemPool();
+ SfxItemPool* pOutlPool=EditEngine::CreatePool();
+ mpDefaultsPool->SetSecondaryPool(pOutlPool);
+
+ SdrModel::SetTextDefaults( mpDefaultsPool, SdrEngineDefaults::GetFontHeight() );
+ mpDefaultsPool->SetDefaultMetric((SfxMapUnit)SdrEngineDefaults::GetMapUnit());
+ mpDefaultsPool->FreezeIdRanges();
+}
+
+SfxItemPool* SvxUnoDrawPool::getModelPool( sal_Bool bReadOnly ) throw()
+{
+ if( mpModel )
+ {
+ return &mpModel->GetItemPool();
+ }
+ else
+ {
+ if( bReadOnly )
+ return mpDefaultsPool;
+ else
+ return NULL;
+ }
+}
+
+void SvxUnoDrawPool::getAny( SfxItemPool* pPool, const comphelper::PropertyMapEntry* pEntry, uno::Any& rValue )
+ throw(beans::UnknownPropertyException)
+{
+ switch( pEntry->mnHandle )
+ {
+ case OWN_ATTR_FILLBMP_MODE:
+ {
+ XFillBmpStretchItem* pStretchItem = (XFillBmpStretchItem*)&pPool->GetDefaultItem(XATTR_FILLBMP_STRETCH);
+ XFillBmpTileItem* pTileItem = (XFillBmpTileItem*)&pPool->GetDefaultItem(XATTR_FILLBMP_TILE);
+ if( pTileItem && pTileItem->GetValue() )
+ {
+ rValue <<= drawing::BitmapMode_REPEAT;
+ }
+ else if( pStretchItem && pStretchItem->GetValue() )
+ {
+ rValue <<= drawing::BitmapMode_STRETCH;
+ }
+ else
+ {
+ rValue <<= drawing::BitmapMode_NO_REPEAT;
+ }
+ break;
+ }
+ default:
+ {
+ const SfxMapUnit eMapUnit = pPool ? pPool->GetMetric((sal_uInt16)pEntry->mnHandle) : SFX_MAPUNIT_100TH_MM;
+
+ sal_uInt8 nMemberId = pEntry->mnMemberId & (~SFX_METRIC_ITEM);
+ if( eMapUnit == SFX_MAPUNIT_100TH_MM )
+ nMemberId &= (~CONVERT_TWIPS);
+
+ // DVO, OD 10.10.2003 #i18732#
+ // Assure, that ID is a Which-ID (it could be a Slot-ID.)
+ // Thus, convert handle to Which-ID.
+ pPool->GetDefaultItem( pPool->GetWhich( (sal_uInt16)pEntry->mnHandle ) ).QueryValue( rValue, nMemberId );
+ }
+ }
+
+
+ // check for needed metric translation
+ const SfxMapUnit eMapUnit = pPool->GetMetric((sal_uInt16)pEntry->mnHandle);
+ if(pEntry->mnMemberId & SFX_METRIC_ITEM && eMapUnit != SFX_MAPUNIT_100TH_MM)
+ {
+ SvxUnoConvertToMM( eMapUnit, rValue );
+ }
+ // convert int32 to correct enum type if needed
+ else if ( pEntry->mpType->getTypeClass() == uno::TypeClass_ENUM && rValue.getValueType() == ::getCppuType((const sal_Int32*)0) )
+ {
+ sal_Int32 nEnum;
+ rValue >>= nEnum;
+
+ rValue.setValue( &nEnum, *pEntry->mpType );
+ }
+}
+
+void SvxUnoDrawPool::putAny( SfxItemPool* pPool, const comphelper::PropertyMapEntry* pEntry, const uno::Any& rValue )
+ throw(beans::UnknownPropertyException, lang::IllegalArgumentException)
+{
+ uno::Any aValue( rValue );
+
+ const SfxMapUnit eMapUnit = pPool->GetMetric((sal_uInt16)pEntry->mnHandle);
+ if(pEntry->mnMemberId & SFX_METRIC_ITEM && eMapUnit != SFX_MAPUNIT_100TH_MM)
+ {
+ SvxUnoConvertFromMM( eMapUnit, aValue );
+ }
+
+ // DVO, OD 10.10.2003 #i18732#
+ // Assure, that ID is a Which-ID (it could be a Slot-ID.)
+ // Thus, convert handle to Which-ID.
+ const sal_uInt16 nWhich = pPool->GetWhich( (sal_uInt16)pEntry->mnHandle );
+ switch( nWhich )
+ {
+ case OWN_ATTR_FILLBMP_MODE:
+ do
+ {
+ drawing::BitmapMode eMode;
+ if(!(aValue >>= eMode) )
+ {
+ sal_Int32 nMode = 0;
+ if(!(aValue >>= nMode))
+ throw lang::IllegalArgumentException();
+
+ eMode = (drawing::BitmapMode)nMode;
+ }
+
+ pPool->SetPoolDefaultItem( XFillBmpStretchItem( eMode == drawing::BitmapMode_STRETCH ) );
+ pPool->SetPoolDefaultItem( XFillBmpTileItem( eMode == drawing::BitmapMode_REPEAT ) );
+ return;
+ }
+ while(0);
+
+ default:
+ {
+ ::std::auto_ptr<SfxPoolItem> pNewItem( pPool->GetDefaultItem( nWhich ).Clone() );
+ sal_uInt8 nMemberId = pEntry->mnMemberId & (~SFX_METRIC_ITEM);
+ if( !pPool || (pPool->GetMetric(nWhich) == SFX_MAPUNIT_100TH_MM) )
+ nMemberId &= (~CONVERT_TWIPS);
+
+ if( !pNewItem->PutValue( aValue, nMemberId ) )
+ throw lang::IllegalArgumentException();
+
+ pPool->SetPoolDefaultItem( *pNewItem );
+ }
+ }
+}
+
+void SvxUnoDrawPool::_setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const uno::Any* pValues )
+ throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException )
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ SfxItemPool* pPool = getModelPool( sal_False );
+
+ DBG_ASSERT( pPool, "I need a SfxItemPool!" );
+ if( NULL == pPool )
+ throw beans::UnknownPropertyException();
+
+ while( *ppEntries )
+ putAny( pPool, *ppEntries++, *pValues++ );
+}
+
+void SvxUnoDrawPool::_getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, uno::Any* pValue )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException )
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ SfxItemPool* pPool = getModelPool( sal_True );
+
+ DBG_ASSERT( pPool, "I need a SfxItemPool!" );
+ if( NULL == pPool )
+ throw beans::UnknownPropertyException();
+
+ while( *ppEntries )
+ getAny( pPool, *ppEntries++, *pValue++ );
+}
+
+void SvxUnoDrawPool::_getPropertyStates( const comphelper::PropertyMapEntry** ppEntries, beans::PropertyState* pStates )
+ throw(beans::UnknownPropertyException )
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ SfxItemPool* pPool = getModelPool( sal_True );
+
+ if( pPool && pPool != mpDefaultsPool )
+ {
+ while( *ppEntries )
+ {
+ // OD 13.10.2003 #i18732#
+ // Assure, that ID is a Which-ID (it could be a Slot-ID.)
+ // Thus, convert handle to Which-ID.
+ const sal_uInt16 nWhich = pPool->GetWhich( ((sal_uInt16)(*ppEntries)->mnHandle) );
+
+ switch( nWhich )
+ {
+ case OWN_ATTR_FILLBMP_MODE:
+ {
+ // use method <IsStaticDefaultItem(..)> instead of using
+ // probably incompatible item pool <mpDefaultPool>.
+ if ( IsStaticDefaultItem( &(pPool->GetDefaultItem( XATTR_FILLBMP_STRETCH )) ) ||
+ IsStaticDefaultItem( &(pPool->GetDefaultItem( XATTR_FILLBMP_TILE )) ) )
+ {
+ *pStates = beans::PropertyState_DEFAULT_VALUE;
+ }
+ else
+ {
+ *pStates = beans::PropertyState_DIRECT_VALUE;
+ }
+ }
+ break;
+ default:
+ // OD 13.10.2003 #i18732# - correction:
+ // use method <IsStaticDefaultItem(..)> instead of using probably
+ // incompatible item pool <mpDefaultPool>.
+ const SfxPoolItem& r1 = pPool->GetDefaultItem( nWhich );
+ //const SfxPoolItem& r2 = mpDefaultPool->GetDefaultItem( nWhich );
+
+ if ( IsStaticDefaultItem( &r1 ) )
+ {
+ *pStates = beans::PropertyState_DEFAULT_VALUE;
+ }
+ else
+ {
+ *pStates = beans::PropertyState_DIRECT_VALUE;
+ }
+ }
+
+ pStates++;
+ ppEntries++;
+ }
+ }
+ else
+ {
+ // as long as we have no model, all properties are default
+ while( *ppEntries++ )
+ *pStates++ = beans::PropertyState_DEFAULT_VALUE;
+ return;
+ }
+}
+
+void SvxUnoDrawPool::_setPropertyToDefault( const comphelper::PropertyMapEntry* pEntry )
+ throw(beans::UnknownPropertyException )
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ SfxItemPool* pPool = getModelPool( sal_True );
+
+ // OD 10.10.2003 #i18732#
+ // Assure, that ID is a Which-ID (it could be a Slot-ID.)
+ // Thus, convert handle to Which-ID.
+ const sal_uInt16 nWhich = pPool->GetWhich( (sal_uInt16)pEntry->mnHandle );
+ if ( pPool && pPool != mpDefaultsPool )
+ {
+ // OD 13.10.2003 #i18732# - use method <ResetPoolDefaultItem(..)>
+ // instead of using probably incompatible item pool <mpDefaultsPool>.
+ pPool->ResetPoolDefaultItem( nWhich );
+ }
+}
+
+uno::Any SvxUnoDrawPool::_getPropertyDefault( const comphelper::PropertyMapEntry* pEntry )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException )
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ // OD 13.10.2003 #i18732# - use method <GetPoolDefaultItem(..)> instead of
+ // using probably incompatible item pool <mpDefaultsPool>
+ uno::Any aAny;
+ SfxItemPool* pPool = getModelPool( sal_True );
+ const sal_uInt16 nWhich = pPool->GetWhich( (sal_uInt16)pEntry->mnHandle );
+ const SfxPoolItem *pItem = pPool->GetPoolDefaultItem ( nWhich );
+ pItem->QueryValue( aAny, pEntry->mnMemberId );
+
+ return aAny;
+}
+
+// XInterface
+
+uno::Any SAL_CALL SvxUnoDrawPool::queryInterface( const uno::Type & rType )
+ throw( uno::RuntimeException )
+{
+ return OWeakAggObject::queryInterface( rType );
+}
+
+uno::Any SAL_CALL SvxUnoDrawPool::queryAggregation( const uno::Type & rType )
+ throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+
+ if( rType == ::getCppuType((const uno::Reference< lang::XServiceInfo >*)0) )
+ aAny <<= uno::Reference< lang::XServiceInfo >(this);
+ else if( rType == ::getCppuType((const uno::Reference< lang::XTypeProvider >*)0) )
+ aAny <<= uno::Reference< lang::XTypeProvider >(this);
+ else if( rType == ::getCppuType((const uno::Reference< beans::XPropertySet >*)0) )
+ aAny <<= uno::Reference< beans::XPropertySet >(this);
+ else if( rType == ::getCppuType((const uno::Reference< beans::XPropertyState >*)0) )
+ aAny <<= uno::Reference< beans::XPropertyState >(this);
+ else if( rType == ::getCppuType((const uno::Reference< beans::XMultiPropertySet >*)0) )
+ aAny <<= uno::Reference< beans::XMultiPropertySet >(this);
+ else
+ aAny <<= OWeakAggObject::queryAggregation( rType );
+
+ return aAny;
+}
+
+void SAL_CALL SvxUnoDrawPool::acquire() throw ( )
+{
+ OWeakAggObject::acquire();
+}
+
+void SAL_CALL SvxUnoDrawPool::release() throw ( )
+{
+ OWeakAggObject::release();
+}
+
+uno::Sequence< uno::Type > SAL_CALL SvxUnoDrawPool::getTypes()
+ throw (uno::RuntimeException)
+{
+ uno::Sequence< uno::Type > aTypes( 6 );
+ uno::Type* pTypes = aTypes.getArray();
+
+ *pTypes++ = ::getCppuType((const uno::Reference< uno::XAggregation>*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo>*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XTypeProvider>*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertySet>*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertyState>*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XMultiPropertySet>*)0);
+
+ return aTypes;
+}
+
+uno::Sequence< sal_Int8 > SAL_CALL SvxUnoDrawPool::getImplementationId()
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ static uno::Sequence< sal_Int8 > aId;
+ if( aId.getLength() == 0 )
+ {
+ aId.realloc( 16 );
+ rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
+ }
+ return aId;
+}
+
+// XServiceInfo
+
+sal_Bool SAL_CALL SvxUnoDrawPool::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException)
+{
+ uno::Sequence< OUString > aSNL( getSupportedServiceNames() );
+ const OUString * pArray = aSNL.getConstArray();
+
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == ServiceName )
+ return sal_True;
+
+ return sal_False;
+}
+
+OUString SAL_CALL SvxUnoDrawPool::getImplementationName() throw( uno::RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoDrawPool") );
+}
+
+uno::Sequence< OUString > SAL_CALL SvxUnoDrawPool::getSupportedServiceNames( )
+ throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aSNS( 1 );
+ aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Defaults" ));
+ return aSNS;
+}
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx
new file mode 100644
index 000000000000..a4abc4e23d88
--- /dev/null
+++ b/svx/source/unodraw/unoprov.cxx
@@ -0,0 +1,1428 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#define _SVX_USE_UNOGLOBALS_
+
+#include <com/sun/star/table/XTable.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <com/sun/star/util/MeasureUnit.hpp>
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include <com/sun/star/media/ZoomLevel.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <tools/fldunit.hxx>
+#include <tools/shl.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <comphelper/propertysetinfo.hxx>
+#include <svx/dialmgr.hxx>
+#include "svx/unoapi.hxx"
+#include <editeng/unotext.hxx>
+#include <svx/unoshprp.hxx>
+#include <editeng/editeng.hxx>
+#include "svx/globl3d.hxx"
+#include <svx/dialogs.hrc>
+#include <svx/svdpool.hxx>
+#include <svx/svdobj.hxx>
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans::PropertyAttribute;
+using ::com::sun::star::drawing::TextVerticalAdjust;
+
+SfxItemPropertyMapEntry* ImplGetSvxShapePropertyMap()
+{
+ static SfxItemPropertyMapEntry aShapePropertyMap_Impl[] =
+ {
+ EDGERADIUS_PROPERTIES
+ FILL_PROPERTIES
+ LINE_PROPERTIES
+ LINE_PROPERTIES_START_END
+ SHAPE_DESCRIPTOR_PROPERTIES
+ MISC_OBJ_PROPERTIES
+ LINKTARGET_PROPERTIES
+ SHADOW_PROPERTIES
+ TEXT_PROPERTIES
+ // #FontWork#
+ FONTWORK_PROPERTIES
+ CUSTOMSHAPE_PROPERTIES
+ { MAP_CHAR_LEN("UserDefinedAttributes"), SDRATTR_XMLATTRIBUTES, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {0,0,0,0,0,0}
+
+ };
+
+ return aShapePropertyMap_Impl;
+}
+
+SfxItemPropertyMapEntry* ImplGetSvxTextShapePropertyMap()
+{
+ static SfxItemPropertyMapEntry aTextShapePropertyMap_Impl[] =
+ {
+ EDGERADIUS_PROPERTIES
+ FILL_PROPERTIES
+ LINE_PROPERTIES
+ LINE_PROPERTIES_START_END
+ SHAPE_DESCRIPTOR_PROPERTIES
+ MISC_OBJ_PROPERTIES_NO_SHEAR
+ LINKTARGET_PROPERTIES
+ SHADOW_PROPERTIES
+ TEXT_PROPERTIES
+ // #FontWork#
+ FONTWORK_PROPERTIES
+ CUSTOMSHAPE_PROPERTIES
+ { MAP_CHAR_LEN("UserDefinedAttributes"), SDRATTR_XMLATTRIBUTES, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {0,0,0,0,0,0}
+
+ };
+
+ return aTextShapePropertyMap_Impl;
+}
+
+SfxItemPropertyMapEntry* ImplGetSvxConnectorPropertyMap()
+{
+ static SfxItemPropertyMapEntry aConnectorPropertyMap_Impl[] =
+ {
+ SPECIAL_CONNECTOR_PROPERTIES
+ EDGERADIUS_PROPERTIES
+ FILL_PROPERTIES
+ LINE_PROPERTIES
+ LINE_PROPERTIES_START_END
+ SHAPE_DESCRIPTOR_PROPERTIES
+ MISC_OBJ_PROPERTIES
+ LINKTARGET_PROPERTIES
+ SHADOW_PROPERTIES
+ TEXT_PROPERTIES
+ // #FontWork#
+ FONTWORK_PROPERTIES
+ { MAP_CHAR_LEN("UserDefinedAttributes"), SDRATTR_XMLATTRIBUTES, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {0,0,0,0,0,0}
+
+ };
+
+ return aConnectorPropertyMap_Impl;
+}
+
+SfxItemPropertyMapEntry* ImplGetSvxDimensioningPropertyMap()
+{
+ static SfxItemPropertyMapEntry aDimensioningPropertyMap_Impl[] =
+ {
+ SPECIAL_DIMENSIONING_PROPERTIES
+ EDGERADIUS_PROPERTIES
+ FILL_PROPERTIES
+ LINE_PROPERTIES
+ LINE_PROPERTIES_START_END
+ SHAPE_DESCRIPTOR_PROPERTIES
+ MISC_OBJ_PROPERTIES
+ LINKTARGET_PROPERTIES
+ SHADOW_PROPERTIES
+ TEXT_PROPERTIES
+ // #FontWork#
+ FONTWORK_PROPERTIES
+ { MAP_CHAR_LEN("UserDefinedAttributes"), SDRATTR_XMLATTRIBUTES, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {0,0,0,0,0,0}
+
+ };
+
+ return aDimensioningPropertyMap_Impl;
+}
+
+SfxItemPropertyMapEntry* ImplGetSvxCirclePropertyMap()
+{
+ static SfxItemPropertyMapEntry aCirclePropertyMap_Impl[] =
+ {
+ SPECIAL_CIRCLE_PROPERTIES
+ EDGERADIUS_PROPERTIES
+ FILL_PROPERTIES
+ LINE_PROPERTIES
+ LINE_PROPERTIES_START_END
+ SHAPE_DESCRIPTOR_PROPERTIES
+ MISC_OBJ_PROPERTIES
+ LINKTARGET_PROPERTIES
+ SHADOW_PROPERTIES
+ TEXT_PROPERTIES
+ // #FontWork#
+ FONTWORK_PROPERTIES
+ CUSTOMSHAPE_PROPERTIES
+ { MAP_CHAR_LEN("UserDefinedAttributes"), SDRATTR_XMLATTRIBUTES, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {0,0,0,0,0,0}
+
+ };
+
+ return aCirclePropertyMap_Impl;
+}
+
+SfxItemPropertyMapEntry* ImplGetSvxPolyPolygonPropertyMap()
+{
+ static SfxItemPropertyMapEntry aPolyPolygonPropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN("Geometry"), OWN_ATTR_BASE_GEOMETRY, SEQTYPE(::getCppuType((const ::com::sun::star::drawing::PointSequenceSequence*)0)), 0, 0 },
+ SPECIAL_POLYGON_PROPERTIES
+ SPECIAL_POLYPOLYGON_PROPERTIES
+ FILL_PROPERTIES
+ LINE_PROPERTIES
+ LINE_PROPERTIES_START_END
+ SHAPE_DESCRIPTOR_PROPERTIES
+ MISC_OBJ_PROPERTIES
+ LINKTARGET_PROPERTIES
+ SHADOW_PROPERTIES
+ TEXT_PROPERTIES
+ // #FontWork#
+ FONTWORK_PROPERTIES
+ CUSTOMSHAPE_PROPERTIES
+ { MAP_CHAR_LEN("UserDefinedAttributes"), SDRATTR_XMLATTRIBUTES, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {0,0,0,0,0,0}
+
+ };
+
+ return aPolyPolygonPropertyMap_Impl;
+}
+
+SfxItemPropertyMapEntry* ImplGetSvxPolyPolygonBezierPropertyMap()
+{
+ static SfxItemPropertyMapEntry aPolyPolygonBezierPropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN("Geometry"), OWN_ATTR_BASE_GEOMETRY, &::getCppuType((const ::com::sun::star::drawing::PolyPolygonBezierCoords*)0), 0, 0 },
+ SPECIAL_POLYGON_PROPERTIES
+ SPECIAL_POLYPOLYGONBEZIER_PROPERTIES
+ FILL_PROPERTIES
+ LINE_PROPERTIES
+ LINE_PROPERTIES_START_END
+ SHAPE_DESCRIPTOR_PROPERTIES
+ MISC_OBJ_PROPERTIES
+ LINKTARGET_PROPERTIES
+ SHADOW_PROPERTIES
+ TEXT_PROPERTIES
+ // #FontWork#
+ FONTWORK_PROPERTIES
+ CUSTOMSHAPE_PROPERTIES
+ { MAP_CHAR_LEN("UserDefinedAttributes"), SDRATTR_XMLATTRIBUTES, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {0,0,0,0,0,0}
+
+ };
+
+ return aPolyPolygonBezierPropertyMap_Impl;
+}
+
+SfxItemPropertyMapEntry* ImplGetSvxGraphicObjectPropertyMap()
+{
+ static SfxItemPropertyMapEntry aGraphicObjectPropertyMap_Impl[] =
+ {
+ SPECIAL_GRAPHOBJ_PROPERTIES
+
+ // #i25616#
+ FILL_PROPERTIES
+
+ LINE_PROPERTIES
+ LINE_PROPERTIES_START_END
+ SHAPE_DESCRIPTOR_PROPERTIES
+ MISC_OBJ_PROPERTIES_NO_SHEAR
+ LINKTARGET_PROPERTIES
+ SHADOW_PROPERTIES
+ TEXT_PROPERTIES
+ // #FontWork#
+ FONTWORK_PROPERTIES
+ { MAP_CHAR_LEN("IsMirrored"), OWN_ATTR_MIRRORED , &::getCppuBooleanType(), 0, 0},
+ { MAP_CHAR_LEN("UserDefinedAttributes"), SDRATTR_XMLATTRIBUTES, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {MAP_CHAR_LEN("GraphicStream"), OWN_ATTR_GRAPHIC_STREAM, &::com::sun::star::io::XInputStream::static_type(), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ {0,0,0,0,0,0}
+
+ };
+
+ return aGraphicObjectPropertyMap_Impl;
+}
+
+SfxItemPropertyMapEntry* ImplGetSvx3DSceneObjectPropertyMap()
+{
+ static SfxItemPropertyMapEntry a3DSceneObjectPropertyMap_Impl[] =
+ {
+ SPECIAL_3DSCENEOBJECT_PROPERTIES
+ FILL_PROPERTIES
+ LINE_PROPERTIES
+ LINE_PROPERTIES_START_END
+ SHAPE_DESCRIPTOR_PROPERTIES
+ MISC_OBJ_PROPERTIES
+ LINKTARGET_PROPERTIES
+ SHADOW_PROPERTIES
+ {0,0,0,0,0,0}
+
+ };
+
+ return a3DSceneObjectPropertyMap_Impl;
+}
+
+SfxItemPropertyMapEntry* ImplGetSvx3DCubeObjectPropertyMap()
+{
+ static SfxItemPropertyMapEntry a3DCubeObjectPropertyMap_Impl[] =
+ {
+ SPECIAL_3DCUBEOBJECT_PROPERTIES
+ MISC_3D_OBJ_PROPERTIES
+ FILL_PROPERTIES
+ LINE_PROPERTIES
+ LINE_PROPERTIES_START_END
+ SHAPE_DESCRIPTOR_PROPERTIES
+ MISC_OBJ_PROPERTIES
+ LINKTARGET_PROPERTIES
+ SHADOW_PROPERTIES
+ { MAP_CHAR_LEN("UserDefinedAttributes"), SDRATTR_XMLATTRIBUTES, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {0,0,0,0,0,0}
+
+ };
+
+ return a3DCubeObjectPropertyMap_Impl;
+}
+
+SfxItemPropertyMapEntry* ImplGetSvx3DSphereObjectPropertyMap()
+{
+ static SfxItemPropertyMapEntry a3DSphereObjectPropertyMap_Impl[] =
+ {
+ SPECIAL_3DSPHEREOBJECT_PROPERTIES
+ MISC_3D_OBJ_PROPERTIES
+ FILL_PROPERTIES
+ LINE_PROPERTIES
+ LINE_PROPERTIES_START_END
+ SHAPE_DESCRIPTOR_PROPERTIES
+ MISC_OBJ_PROPERTIES
+ LINKTARGET_PROPERTIES
+ SHADOW_PROPERTIES
+ { MAP_CHAR_LEN("UserDefinedAttributes"), SDRATTR_XMLATTRIBUTES, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {0,0,0,0,0,0}
+
+ };
+ return a3DSphereObjectPropertyMap_Impl;
+}
+
+SfxItemPropertyMapEntry* ImplGetSvx3DLatheObjectPropertyMap()
+{
+ static SfxItemPropertyMapEntry a3DLatheObjectPropertyMap_Impl[] =
+ {
+ SPECIAL_3DLATHEOBJECT_PROPERTIES
+
+ // #107245# New 3D properties which are possible for lathe and extrude 3d objects
+ SPECIAL_3DLATHEANDEXTRUDEOBJ_PROPERTIES
+
+ SPECIAL_3DBACKSCALE_PROPERTIES
+ MISC_3D_OBJ_PROPERTIES
+ FILL_PROPERTIES
+ LINE_PROPERTIES
+ LINE_PROPERTIES_START_END
+ SHAPE_DESCRIPTOR_PROPERTIES
+ MISC_OBJ_PROPERTIES
+ LINKTARGET_PROPERTIES
+ SHADOW_PROPERTIES
+ { MAP_CHAR_LEN("UserDefinedAttributes"), SDRATTR_XMLATTRIBUTES, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {0,0,0,0,0,0}
+
+ };
+
+ return a3DLatheObjectPropertyMap_Impl;
+}
+
+SfxItemPropertyMapEntry* ImplGetSvx3DExtrudeObjectPropertyMap()
+{
+ static SfxItemPropertyMapEntry a3DExtrudeObjectPropertyMap_Impl[] =
+ {
+ SPECIAL_3DEXTRUDEOBJECT_PROPERTIES
+
+ // #107245# New 3D properties which are possible for lathe and extrude 3d objects
+ SPECIAL_3DLATHEANDEXTRUDEOBJ_PROPERTIES
+
+ SPECIAL_3DBACKSCALE_PROPERTIES
+ MISC_3D_OBJ_PROPERTIES
+ FILL_PROPERTIES
+ LINE_PROPERTIES
+ LINE_PROPERTIES_START_END
+ SHAPE_DESCRIPTOR_PROPERTIES
+ MISC_OBJ_PROPERTIES
+ LINKTARGET_PROPERTIES
+ SHADOW_PROPERTIES
+ { MAP_CHAR_LEN("UserDefinedAttributes"), SDRATTR_XMLATTRIBUTES, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {0,0,0,0,0,0}
+
+ };
+
+ return a3DExtrudeObjectPropertyMap_Impl;
+}
+
+SfxItemPropertyMapEntry* ImplGetSvx3DPolygonObjectPropertyMap()
+{
+ static SfxItemPropertyMapEntry a3DPolygonObjectPropertyMap_Impl[] =
+ {
+ SPECIAL_3DPOLYGONOBJECT_PROPERTIES
+ MISC_3D_OBJ_PROPERTIES
+ FILL_PROPERTIES
+ LINE_PROPERTIES
+ LINE_PROPERTIES_START_END
+ SHAPE_DESCRIPTOR_PROPERTIES
+ MISC_OBJ_PROPERTIES
+ LINKTARGET_PROPERTIES
+ SHADOW_PROPERTIES
+ { MAP_CHAR_LEN("UserDefinedAttributes"), SDRATTR_XMLATTRIBUTES, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {0,0,0,0,0,0}
+
+ };
+
+ return a3DPolygonObjectPropertyMap_Impl;
+}
+
+SfxItemPropertyMapEntry* ImplGetSvxAllPropertyMap()
+{
+ static SfxItemPropertyMapEntry aAllPropertyMap_Impl[] =
+ {
+ SHADOW_PROPERTIES
+ LINE_PROPERTIES
+ LINE_PROPERTIES_START_END
+ FILL_PROPERTIES
+ EDGERADIUS_PROPERTIES
+ TEXT_PROPERTIES
+ // #FontWork#
+ FONTWORK_PROPERTIES
+ SHAPE_DESCRIPTOR_PROPERTIES
+ MISC_OBJ_PROPERTIES
+ LINKTARGET_PROPERTIES
+ SPECIAL_CONNECTOR_PROPERTIES
+ SPECIAL_DIMENSIONING_PROPERTIES
+ SPECIAL_CIRCLE_PROPERTIES
+ SPECIAL_POLYGON_PROPERTIES
+ SPECIAL_POLYPOLYGON_PROPERTIES
+ SPECIAL_POLYPOLYGONBEZIER_PROPERTIES
+ SPECIAL_GRAPHOBJ_PROPERTIES
+ SPECIAL_3DSCENEOBJECT_PROPERTIES
+ MISC_3D_OBJ_PROPERTIES
+ SPECIAL_3DCUBEOBJECT_PROPERTIES
+ SPECIAL_3DSPHEREOBJECT_PROPERTIES
+ SPECIAL_3DLATHEOBJECT_PROPERTIES
+ SPECIAL_3DEXTRUDEOBJECT_PROPERTIES
+
+ // #107245# New 3D properties which are possible for lathe and extrude 3d objects
+ SPECIAL_3DLATHEANDEXTRUDEOBJ_PROPERTIES
+
+ SPECIAL_3DBACKSCALE_PROPERTIES
+ SPECIAL_3DPOLYGONOBJECT_PROPERTIES
+ CUSTOMSHAPE_PROPERTIES
+ { MAP_CHAR_LEN("UserDefinedAttributes"), SDRATTR_XMLATTRIBUTES, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {0,0,0,0,0,0}
+
+ };
+
+ return aAllPropertyMap_Impl;
+}
+
+SfxItemPropertyMapEntry* ImplGetSvxGroupPropertyMap()
+{
+ static SfxItemPropertyMapEntry aGroupPropertyMap_Impl[] =
+ {
+ SHAPE_DESCRIPTOR_PROPERTIES
+ MISC_OBJ_PROPERTIES
+ LINKTARGET_PROPERTIES
+ {0,0,0,0,0,0}
+
+ };
+
+ return aGroupPropertyMap_Impl;
+}
+
+SfxItemPropertyMapEntry* ImplGetSvxOle2PropertyMap()
+{
+ static SfxItemPropertyMapEntry aOle2PropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN("Transformation"), OWN_ATTR_TRANSFORMATION , &::getCppuType((const struct com::sun::star::drawing::HomogenMatrix3*)0), 0, 0 }, \
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_ZORDER), OWN_ATTR_ZORDER , &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_LAYERID), SDRATTR_LAYERID , &::getCppuType((const sal_Int16*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_LAYERNAME),SDRATTR_LAYERNAME , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), OWN_ATTR_LDBITMAP , &::getCppuType(( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), OWN_ATTR_LDNAME , &::getCppuType(( const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_OLE2_METAFILE), OWN_ATTR_METAFILE , SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int8>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN("ThumbnailGraphicURL"), OWN_ATTR_THUMBNAIL , &::getCppuType(( const ::rtl::OUString*)0), 0, 0 },
+ { MAP_CHAR_LEN("Model"), OWN_ATTR_OLEMODEL , &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN("EmbeddedObject"), OWN_ATTR_OLE_EMBEDDED_OBJECT , &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN("EmbeddedObjectNoNewClient"),OWN_ATTR_OLE_EMBEDDED_OBJECT_NONEWCLIENT, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject >*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN("OriginalSize"), OWN_ATTR_OLESIZE , &::getCppuType(( const ::com::sun::star::awt::Size*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN("CLSID"), OWN_ATTR_CLSID , &::getCppuType(( const ::rtl::OUString*)0), 0, 0 },
+ { MAP_CHAR_LEN("IsInternal"), OWN_ATTR_INTERNAL_OLE , &::getBooleanCppuType() , ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN("VisibleArea"), OWN_ATTR_OLE_VISAREA , &::getCppuType((const ::com::sun::star::awt::Rectangle*)0), 0, 0},
+ { MAP_CHAR_LEN("Aspect"), OWN_ATTR_OLE_ASPECT , &::getCppuType((const sal_Int64*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_MOVEPROTECT), SDRATTR_OBJMOVEPROTECT, &::getBooleanCppuType(),0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_SIZEPROTECT), SDRATTR_OBJSIZEPROTECT, &::getBooleanCppuType(),0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_OLE2_PERSISTNAME), OWN_ATTR_PERSISTNAME , &::getCppuType(( const ::rtl::OUString*)0), 0, 0 },
+ { MAP_CHAR_LEN("LinkURL"), OWN_ATTR_OLE_LINKURL , &::getCppuType(( const ::rtl::OUString*)0), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_BOUNDRECT), OWN_ATTR_BOUNDRECT, &::getCppuType((const ::com::sun::star::awt::Rectangle*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_GRAPHOBJ_GRAPHIC), OWN_ATTR_VALUE_GRAPHIC , &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic>*)0), 0, 0},
+ // #i68101#
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_TITLE), OWN_ATTR_MISC_OBJ_TITLE , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_DESCRIPTION), OWN_ATTR_MISC_OBJ_DESCRIPTION , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ {0,0,0,0,0,0}
+
+ };
+
+ return aOle2PropertyMap_Impl;
+}
+
+SfxItemPropertyMapEntry* ImplGetSvxPluginPropertyMap()
+{
+ static SfxItemPropertyMapEntry aPluginPropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN("PluginMimeType"), OWN_ATTR_PLUGIN_MIMETYPE , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ { MAP_CHAR_LEN("PluginURL"), OWN_ATTR_PLUGIN_URL , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ { MAP_CHAR_LEN("PluginCommands"), OWN_ATTR_PLUGIN_COMMANDS , SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >*)0)), 0, 0},
+ { MAP_CHAR_LEN("Transformation"), OWN_ATTR_TRANSFORMATION , &::getCppuType((const struct com::sun::star::drawing::HomogenMatrix3*)0), 0, 0 }, \
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_ZORDER), OWN_ATTR_ZORDER , &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_LAYERID), SDRATTR_LAYERID , &::getCppuType((const sal_Int16*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_LAYERNAME),SDRATTR_LAYERNAME , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), OWN_ATTR_LDBITMAP , &::getCppuType(( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), OWN_ATTR_LDNAME , &::getCppuType(( const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_OLE2_METAFILE), OWN_ATTR_METAFILE , SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int8>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN("ThumbnailGraphicURL"), OWN_ATTR_THUMBNAIL , &::getCppuType(( const ::rtl::OUString*)0), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_MOVEPROTECT), SDRATTR_OBJMOVEPROTECT, &::getBooleanCppuType(),0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_SIZEPROTECT), SDRATTR_OBJSIZEPROTECT, &::getBooleanCppuType(),0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_OLE2_PERSISTNAME), OWN_ATTR_PERSISTNAME , &::getCppuType(( const ::rtl::OUString*)0), 0, 0 },
+ { MAP_CHAR_LEN("LinkURL"), OWN_ATTR_OLE_LINKURL , &::getCppuType(( const ::rtl::OUString*)0), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_BOUNDRECT), OWN_ATTR_BOUNDRECT, &::getCppuType((const ::com::sun::star::awt::Rectangle*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN("VisibleArea"), OWN_ATTR_OLE_VISAREA , &::getCppuType((const ::com::sun::star::awt::Rectangle*)0), 0, 0},
+ // #i68101#
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_TITLE), OWN_ATTR_MISC_OBJ_TITLE , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_DESCRIPTION), OWN_ATTR_MISC_OBJ_DESCRIPTION , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ {0,0,0,0,0,0}
+
+ };
+
+ return aPluginPropertyMap_Impl;
+}
+
+SfxItemPropertyMapEntry* ImplGetSvxFramePropertyMap()
+{
+ //TODO/LATER: new properties for ScrollingMode and DefaultBorder
+ static SfxItemPropertyMapEntry aFramePropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN("FrameURL"), OWN_ATTR_FRAME_URL , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ { MAP_CHAR_LEN("FrameName"), OWN_ATTR_FRAME_NAME , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ { MAP_CHAR_LEN("FrameIsAutoScroll"), OWN_ATTR_FRAME_ISAUTOSCROLL , &::getBooleanCppuType() , ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},
+ { MAP_CHAR_LEN("FrameIsBorder"), OWN_ATTR_FRAME_ISBORDER , &::getBooleanCppuType() , 0, 0},
+ { MAP_CHAR_LEN("FrameMarginWidth"), OWN_ATTR_FRAME_MARGIN_WIDTH , &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN("FrameMarginHeight"), OWN_ATTR_FRAME_MARGIN_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN("Transformation"), OWN_ATTR_TRANSFORMATION , &::getCppuType((const struct com::sun::star::drawing::HomogenMatrix3*)0), 0, 0 }, \
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_ZORDER), OWN_ATTR_ZORDER , &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_LAYERID), SDRATTR_LAYERID , &::getCppuType((const sal_Int16*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_LAYERNAME),SDRATTR_LAYERNAME , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), OWN_ATTR_LDBITMAP , &::getCppuType(( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), OWN_ATTR_LDNAME , &::getCppuType(( const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_OLE2_METAFILE), OWN_ATTR_METAFILE , SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int8>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN("ThumbnailGraphicURL"), OWN_ATTR_THUMBNAIL , &::getCppuType(( const ::rtl::OUString*)0), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_MOVEPROTECT), SDRATTR_OBJMOVEPROTECT, &::getBooleanCppuType(),0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_SIZEPROTECT), SDRATTR_OBJSIZEPROTECT, &::getBooleanCppuType(),0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_OLE2_PERSISTNAME), OWN_ATTR_PERSISTNAME , &::getCppuType(( const ::rtl::OUString*)0), 0, 0 },
+ { MAP_CHAR_LEN("LinkURL"), OWN_ATTR_OLE_LINKURL , &::getCppuType(( const ::rtl::OUString*)0), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_BOUNDRECT), OWN_ATTR_BOUNDRECT, &::getCppuType((const ::com::sun::star::awt::Rectangle*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN("VisibleArea"), OWN_ATTR_OLE_VISAREA , &::getCppuType((const ::com::sun::star::awt::Rectangle*)0), 0, 0},
+ // #i68101#
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_TITLE), OWN_ATTR_MISC_OBJ_TITLE , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_DESCRIPTION), OWN_ATTR_MISC_OBJ_DESCRIPTION , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ {0,0,0,0,0,0}
+
+ };
+
+ return aFramePropertyMap_Impl;
+}
+
+SfxItemPropertyMapEntry* ImplGetSvxAppletPropertyMap()
+{
+ static SfxItemPropertyMapEntry aAppletPropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN("AppletCodeBase"), OWN_ATTR_APPLET_CODEBASE , &::getCppuType(( const ::rtl::OUString*)0), 0, 0},
+ { MAP_CHAR_LEN("AppletName"), OWN_ATTR_APPLET_NAME , &::getCppuType(( const ::rtl::OUString*)0), 0, 0},
+ { MAP_CHAR_LEN("AppletCode"), OWN_ATTR_APPLET_CODE , &::getCppuType(( const ::rtl::OUString*)0), 0, 0},
+ { MAP_CHAR_LEN("AppletCommands"), OWN_ATTR_APPLET_COMMANDS , SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >*)0)), 0, 0},
+ { MAP_CHAR_LEN("AppletDocBase"), OWN_ATTR_APPLET_DOCBASE , &::getCppuType(( const ::rtl::OUString*)0), 0, 0},
+ { MAP_CHAR_LEN("AppletIsScript"), OWN_ATTR_APPLET_ISSCRIPT , &::getBooleanCppuType(), 0, 0 },
+ { MAP_CHAR_LEN("Transformation"), OWN_ATTR_TRANSFORMATION , &::getCppuType((const struct com::sun::star::drawing::HomogenMatrix3*)0), 0, 0 }, \
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_ZORDER), OWN_ATTR_ZORDER , &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_LAYERID), SDRATTR_LAYERID , &::getCppuType((const sal_Int16*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_LAYERNAME),SDRATTR_LAYERNAME , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), OWN_ATTR_LDBITMAP , &::getCppuType(( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), OWN_ATTR_LDNAME , &::getCppuType(( const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_OLE2_METAFILE), OWN_ATTR_METAFILE , SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int8>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN("ThumbnailGraphicURL"), OWN_ATTR_THUMBNAIL , &::getCppuType(( const ::rtl::OUString*)0), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_MOVEPROTECT), SDRATTR_OBJMOVEPROTECT, &::getBooleanCppuType(),0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_SIZEPROTECT), SDRATTR_OBJSIZEPROTECT, &::getBooleanCppuType(),0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_OLE2_PERSISTNAME), OWN_ATTR_PERSISTNAME , &::getCppuType(( const ::rtl::OUString*)0), 0, 0 },
+ { MAP_CHAR_LEN("LinkURL"), OWN_ATTR_OLE_LINKURL , &::getCppuType(( const ::rtl::OUString*)0), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_BOUNDRECT), OWN_ATTR_BOUNDRECT, &::getCppuType((const ::com::sun::star::awt::Rectangle*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN("VisibleArea"), OWN_ATTR_OLE_VISAREA , &::getCppuType((const ::com::sun::star::awt::Rectangle*)0), 0, 0},
+ // #i68101#
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_TITLE), OWN_ATTR_MISC_OBJ_TITLE , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_DESCRIPTION), OWN_ATTR_MISC_OBJ_DESCRIPTION , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ {0,0,0,0,0,0}
+
+ };
+
+ return aAppletPropertyMap_Impl;
+}
+
+SfxItemPropertyMapEntry* ImplGetSvxControlShapePropertyMap()
+{
+ static SfxItemPropertyMapEntry aControlPropertyMap_Impl[] =
+ {
+ // the following properties are mapped to the XControl Model of this shape
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTNAME), 0, &::getCppuType((const ::rtl::OUString*)0), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTSTYLENAME), 0, &::getCppuType((const ::rtl::OUString*)0), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTFAMILY), 0, &::getCppuType((const sal_Int16*)0), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTCHARSET), 0, &::getCppuType((const sal_Int16*)0), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_HEIGHT), 0, &::getCppuType((const float*)0), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTPITCH), 0, &::getCppuType((const sal_Int16*)0), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_POSTURE), 0, &::getCppuType((const ::com::sun::star::awt::FontSlant*)0),0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_WEIGHT), 0, &::getCppuType((const float*)0), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_UNDERLINE), 0, &::getCppuType((const sal_Int16*)0), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_STRIKEOUT), 0, &::getCppuType((const sal_Int16*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_COLOR), 0, &::getCppuType((const sal_Int32*)0), 0, 0 },
+ { MAP_CHAR_LEN("CharRelief"), 0, &::getCppuType((const sal_Int16*)0), 0, 0 },
+ { MAP_CHAR_LEN("CharUnderlineColor"), 0, &::getCppuType((const sal_Int32*)0), 0, 0 },
+ { MAP_CHAR_LEN("CharKerning"), 0, &::getCppuType((const sal_Int16*)0), 0, 0 },
+ { MAP_CHAR_LEN("CharWordMode"), 0, &::getBooleanCppuType(), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_ADJUST), 0, &::getCppuType((const sal_Int16*)0), 0, 0 },
+ { MAP_CHAR_LEN("TextVerticalAdjust"), 0, &::getCppuType((const TextVerticalAdjust*)0), MAYBEVOID, 0 },
+ { MAP_CHAR_LEN("ControlBackground"), 0, &::getCppuType((const sal_Int32*)0), 0, 0 },
+ { MAP_CHAR_LEN("ControlBorder"), 0, &::getCppuType((const sal_Int16*)0), 0, 0 },
+ { MAP_CHAR_LEN("ControlBorderColor"), 0, &::getCppuType((const sal_Int32*)0), 0, 0 },
+ { MAP_CHAR_LEN("ControlSymbolColor"), 0, &::getCppuType((const sal_Int16*)0), 0, 0 },
+ { MAP_CHAR_LEN("ImageScaleMode"), 0, &::getCppuType((const sal_Int16*)0), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_MOVEPROTECT), SDRATTR_OBJMOVEPROTECT, &::getBooleanCppuType(),0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_SIZEPROTECT), SDRATTR_OBJSIZEPROTECT, &::getBooleanCppuType(),0, 0},
+ { MAP_CHAR_LEN("ControlTextEmphasis"), 0, &::getCppuType((const sal_Int16*)0), 0, 0 },
+ { MAP_CHAR_LEN("ControlWritingMode"), 0, &::cppu::UnoType< sal_Int16 >::get(), 0, 0},
+ // the following properties are handled by SvxShape
+ { MAP_CHAR_LEN("Transformation"), OWN_ATTR_TRANSFORMATION , &::getCppuType((const struct com::sun::star::drawing::HomogenMatrix3*)0), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_ZORDER), OWN_ATTR_ZORDER , &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_LAYERID), SDRATTR_LAYERID , &::getCppuType((const sal_Int16*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_LAYERNAME),SDRATTR_LAYERNAME , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), OWN_ATTR_LDBITMAP , &::getCppuType(( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), OWN_ATTR_LDNAME , &::getCppuType(( const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN("UserDefinedAttributes"), SDRATTR_XMLATTRIBUTES, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_BOUNDRECT), OWN_ATTR_BOUNDRECT, &::getCppuType((const ::com::sun::star::awt::Rectangle*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ // #i68101#
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_TITLE), OWN_ATTR_MISC_OBJ_TITLE , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_DESCRIPTION), OWN_ATTR_MISC_OBJ_DESCRIPTION , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ // #i112587#
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_PRINTABLE), SDRATTR_OBJPRINTABLE , &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN("Visible"), SDRATTR_OBJVISIBLE , &::getBooleanCppuType(), 0, 0},
+ {0,0,0,0,0,0}
+ };
+
+ return aControlPropertyMap_Impl;
+}
+
+SfxItemPropertyMapEntry* ImplGetSvxPageShapePropertyMap()
+{
+ static SfxItemPropertyMapEntry aPageShapePropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN("PageNumber"), OWN_ATTR_PAGE_NUMBER , &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN("Transformation"), OWN_ATTR_TRANSFORMATION , &::getCppuType((const struct com::sun::star::drawing::HomogenMatrix3*)0), 0, 0 }, \
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_ZORDER), OWN_ATTR_ZORDER , &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_LAYERID), SDRATTR_LAYERID , &::getCppuType((const sal_Int16*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_LAYERNAME),SDRATTR_LAYERNAME , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), OWN_ATTR_LDBITMAP , &::getCppuType(( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), OWN_ATTR_LDNAME , &::getCppuType(( const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_MOVEPROTECT), SDRATTR_OBJMOVEPROTECT, &::getBooleanCppuType(),0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_SIZEPROTECT), SDRATTR_OBJSIZEPROTECT, &::getBooleanCppuType(),0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_BOUNDRECT), OWN_ATTR_BOUNDRECT, &::getCppuType((const ::com::sun::star::awt::Rectangle*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ // #i68101#
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_TITLE), OWN_ATTR_MISC_OBJ_TITLE , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_DESCRIPTION), OWN_ATTR_MISC_OBJ_DESCRIPTION , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ {0,0,0,0,0,0}
+
+ };
+
+ return aPageShapePropertyMap_Impl;
+}
+
+SfxItemPropertyMapEntry* ImplGetSvxCaptionPropertyMap()
+{
+ static SfxItemPropertyMapEntry aCaptionPropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN("CaptionPoint"), OWN_ATTR_CAPTION_POINT, &::getCppuType((const com::sun::star::awt::Point*)0), 0, 0 },
+ { MAP_CHAR_LEN("CaptionType"), SDRATTR_CAPTIONTYPE, &::getCppuType((const sal_Int16*)0), 0, 0},
+ { MAP_CHAR_LEN("CaptionIsFixedAngle"), SDRATTR_CAPTIONFIXEDANGLE, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN("CaptionAngle"), SDRATTR_CAPTIONANGLE, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN("CaptionGap"), SDRATTR_CAPTIONGAP, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM},
+ { MAP_CHAR_LEN("CaptionEscapeDirection"), SDRATTR_CAPTIONESCDIR, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN("CaptionIsEscapeRelative"), SDRATTR_CAPTIONESCISREL, &::getBooleanCppuType(), 0, 0},
+ { MAP_CHAR_LEN("CaptionEscapeRelative"), SDRATTR_CAPTIONESCREL, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN("CaptionEscapeAbsolute"), SDRATTR_CAPTIONESCABS, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM},
+ { MAP_CHAR_LEN("CaptionLineLength"), SDRATTR_CAPTIONLINELEN, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM},
+ { MAP_CHAR_LEN("CaptionIsFitLineLength"), SDRATTR_CAPTIONFITLINELEN, &::getBooleanCppuType(), 0, 0},
+ EDGERADIUS_PROPERTIES
+ FILL_PROPERTIES
+ LINE_PROPERTIES
+ LINE_PROPERTIES_START_END
+ SHAPE_DESCRIPTOR_PROPERTIES
+ MISC_OBJ_PROPERTIES
+ LINKTARGET_PROPERTIES
+ SHADOW_PROPERTIES
+ TEXT_PROPERTIES
+ // #FontWork#
+ FONTWORK_PROPERTIES
+ { MAP_CHAR_LEN("UserDefinedAttributes"), SDRATTR_XMLATTRIBUTES, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {0,0,0,0,0,0}
+
+ };
+
+ return aCaptionPropertyMap_Impl;
+}
+
+SfxItemPropertyMapEntry* ImplGetSvxCustomShapePropertyMap()
+{
+ static SfxItemPropertyMapEntry aCustomShapePropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN("CustomShapeEngine"), SDRATTR_CUSTOMSHAPE_ENGINE, &::getCppuType((const ::rtl::OUString*)0), 0, 0 },
+ { MAP_CHAR_LEN("CustomShapeData"), SDRATTR_CUSTOMSHAPE_DATA, &::getCppuType((const ::rtl::OUString*)0), 0, 0 },
+ { MAP_CHAR_LEN("CustomShapeGeometry"), SDRATTR_CUSTOMSHAPE_GEOMETRY, SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >*)0)), 0, 0 },
+ { MAP_CHAR_LEN("CustomShapeGraphicURL"), SDRATTR_CUSTOMSHAPE_REPLACEMENT_URL, &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ CUSTOMSHAPE_PROPERTIES
+ FILL_PROPERTIES
+ LINE_PROPERTIES
+ LINE_PROPERTIES_START_END
+ SHAPE_DESCRIPTOR_PROPERTIES
+ MISC_OBJ_PROPERTIES
+ LINKTARGET_PROPERTIES
+ SHADOW_PROPERTIES
+ TEXT_PROPERTIES
+ {MAP_CHAR_LEN("UserDefinedAttributes"), SDRATTR_XMLATTRIBUTES, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
+ {0,0,0,0,0,0}
+
+ };
+ return aCustomShapePropertyMap_Impl;
+}
+
+SfxItemPropertyMapEntry* ImplGetSvxMediaShapePropertyMap()
+{
+ static SfxItemPropertyMapEntry aMediaShapePropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_ZORDER), OWN_ATTR_ZORDER, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_LAYERID), SDRATTR_LAYERID, &::getCppuType((const sal_Int16*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_LAYERNAME), SDRATTR_LAYERNAME, &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), OWN_ATTR_LDBITMAP, &::getCppuType(( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), OWN_ATTR_LDNAME, &::getCppuType(( const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN("Transformation"), OWN_ATTR_TRANSFORMATION, &::getCppuType((const struct com::sun::star::drawing::HomogenMatrix3*)0), 0, 0 },
+ { MAP_CHAR_LEN("MediaURL"), OWN_ATTR_MEDIA_URL, &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ { MAP_CHAR_LEN("PreferredSize"), OWN_ATTR_MEDIA_PREFERREDSIZE, &::getCppuType((const ::com::sun::star::awt::Size*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN("Loop"), OWN_ATTR_MEDIA_LOOP, &::getCppuType((const sal_Bool*)0), 0, 0},
+ { MAP_CHAR_LEN("Mute"), OWN_ATTR_MEDIA_MUTE, &::getCppuType((const sal_Bool*)0), 0, 0},
+ { MAP_CHAR_LEN("VolumeDB"), OWN_ATTR_MEDIA_VOLUMEDB, &::getCppuType((const sal_Int16*)0), 0, 0},
+ { MAP_CHAR_LEN("Zoom"), OWN_ATTR_MEDIA_ZOOM, &::getCppuType((const ::com::sun::star::media::ZoomLevel*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_MOVEPROTECT), SDRATTR_OBJMOVEPROTECT, &::getBooleanCppuType(),0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_SIZEPROTECT), SDRATTR_OBJSIZEPROTECT, &::getBooleanCppuType(),0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_BOUNDRECT), OWN_ATTR_BOUNDRECT, &::getCppuType((const ::com::sun::star::awt::Rectangle*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ // #i68101#
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_TITLE), OWN_ATTR_MISC_OBJ_TITLE , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_DESCRIPTION), OWN_ATTR_MISC_OBJ_DESCRIPTION , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ {0,0,0,0,0,0}
+
+ };
+
+ return aMediaShapePropertyMap_Impl;
+}
+
+SfxItemPropertyMapEntry* ImplGetSvxTableShapePropertyMap()
+{
+ static SfxItemPropertyMapEntry aTableShapePropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_ZORDER), OWN_ATTR_ZORDER, &::getCppuType((const sal_Int32*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_LAYERID), SDRATTR_LAYERID, &::getCppuType((const sal_Int16*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_LAYERNAME), SDRATTR_LAYERNAME, &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), OWN_ATTR_LDBITMAP, &::com::sun::star::awt::XBitmap::static_type(), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), OWN_ATTR_LDNAME, &::getCppuType(( const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN("Transformation"), OWN_ATTR_TRANSFORMATION, &::getCppuType((const struct com::sun::star::drawing::HomogenMatrix3*)0), 0, 0 },
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_MOVEPROTECT), SDRATTR_OBJMOVEPROTECT, &::getBooleanCppuType(),0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_SIZEPROTECT), SDRATTR_OBJSIZEPROTECT, &::getBooleanCppuType(),0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_BOUNDRECT), OWN_ATTR_BOUNDRECT, &::getCppuType((const ::com::sun::star::awt::Rectangle*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_TITLE), OWN_ATTR_MISC_OBJ_TITLE , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_DESCRIPTION), OWN_ATTR_MISC_OBJ_DESCRIPTION , &::getCppuType((const ::rtl::OUString*)0), 0, 0},
+ { MAP_CHAR_LEN("Model"), OWN_ATTR_OLEMODEL , &::com::sun::star::table::XTable::static_type(), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+ { MAP_CHAR_LEN("TableTemplate"), OWN_ATTR_TABLETEMPLATE , &::com::sun::star::container::XIndexAccess::static_type(), 0, 0},
+ { MAP_CHAR_LEN("UseFirstRowStyle"), OWN_ATTR_TABLETEMPLATE_FIRSTROW, &::getBooleanCppuType(),0, 0},
+ { MAP_CHAR_LEN("UseLastRowStyle"), OWN_ATTR_TABLETEMPLATE_LASTROW, &::getBooleanCppuType(),0, 0},
+ { MAP_CHAR_LEN("UseFirstColumnStyle"), OWN_ATTR_TABLETEMPLATE_FIRSTCOLUMN, &::getBooleanCppuType(),0, 0},
+ { MAP_CHAR_LEN("UseLastColumnStyle"), OWN_ATTR_TABLETEMPLATE_LASTCOLUMN, &::getBooleanCppuType(),0, 0},
+ { MAP_CHAR_LEN("UseBandingRowStyle"), OWN_ATTR_TABLETEMPLATE_BANDINGROWS, &::getBooleanCppuType(),0, 0},
+ { MAP_CHAR_LEN("UseBandingColumnStyle"), OWN_ATTR_TABLETEMPLATE_BANDINGCOULUMNS, &::getBooleanCppuType(),0, 0},
+ { MAP_CHAR_LEN("ReplacementGraphic"), OWN_ATTR_BITMAP, &::com::sun::star::graphic::XGraphic::static_type(), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+
+ {0,0,0,0,0,0}
+ };
+
+ return aTableShapePropertyMap_Impl;
+}
+
+comphelper::PropertyMapEntry* ImplGetSvxDrawingDefaultsPropertyMap()
+{
+ static comphelper::PropertyMapEntry aSvxDrawingDefaultsPropertyMap_Impl[] =
+ {
+ SHADOW_PROPERTIES
+ LINE_PROPERTIES_DEFAULTS
+ FILL_PROPERTIES_BMP
+ FILL_PROPERTIES_DEFAULTS
+ EDGERADIUS_PROPERTIES
+ TEXT_PROPERTIES_DEFAULTS
+ CONNECTOR_PROPERTIES
+ SPECIAL_DIMENSIONING_PROPERTIES_DEFAULTS
+ MISC_3D_OBJ_PROPERTIES
+ SPECIAL_3DBACKSCALE_PROPERTIES
+ {0,0,0,0,0,0}
+
+ };
+
+ return aSvxDrawingDefaultsPropertyMap_Impl;
+}
+
+// OD 13.10.2003 #i18732#
+comphelper::PropertyMapEntry* ImplGetAdditionalWriterDrawingDefaultsPropertyMap()
+{
+ static comphelper::PropertyMapEntry aSvxAdditionalDefaultsPropertyMap_Impl[] =
+ {
+ { MAP_CHAR_LEN("IsFollowingTextFlow"), SID_SW_FOLLOW_TEXT_FLOW, &::getBooleanCppuType(), 0, 0},
+ {0,0,0,0,0,0}
+
+ };
+
+ return aSvxAdditionalDefaultsPropertyMap_Impl;
+}
+
+// ---------------------------------------------------------------------
+
+SvxUnoPropertyMapProvider aSvxMapProvider;
+
+UHashMapEntry pSdrShapeIdentifierMap[] =
+{
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.RectangleShape"), OBJ_RECT ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.EllipseShape"), OBJ_CIRC ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.ControlShape"), OBJ_UNO ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.ConnectorShape"), OBJ_EDGE ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.MeasureShape"), OBJ_MEASURE ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.LineShape"), OBJ_LINE ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.PolyPolygonShape"), OBJ_POLY ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.PolyLineShape"), OBJ_PLIN ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.OpenBezierShape"), OBJ_PATHLINE ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.ClosedBezierShape"), OBJ_PATHFILL ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.OpenFreeHandShape"), OBJ_FREELINE ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.ClosedFreeHandShape"), OBJ_FREEFILL ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.PolyPolygonPathShape"), OBJ_PATHPOLY ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.PolyLinePathShape"), OBJ_PATHPLIN ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GraphicObjectShape"), OBJ_GRAF ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GroupShape"), OBJ_GRUP ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TextShape"), OBJ_TEXT ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.OLE2Shape"), OBJ_OLE2 ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.PageShape"), OBJ_PAGE ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.CaptionShape"), OBJ_CAPTION ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.FrameShape"), OBJ_FRAME ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.PluginShape"), OBJ_OLE2_PLUGIN ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.AppletShape"), OBJ_OLE2_APPLET ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.CustomShape"), OBJ_CUSTOMSHAPE ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.MediaShape"), OBJ_MEDIA ),
+
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DSceneObject"), E3D_POLYSCENE_ID | E3D_INVENTOR_FLAG ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DCubeObject"), E3D_CUBEOBJ_ID | E3D_INVENTOR_FLAG ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DSphereObject"), E3D_SPHEREOBJ_ID | E3D_INVENTOR_FLAG ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DLatheObject"), E3D_LATHEOBJ_ID | E3D_INVENTOR_FLAG ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DExtrudeObject"), E3D_EXTRUDEOBJ_ID | E3D_INVENTOR_FLAG ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DPolygonObject"), E3D_POLYGONOBJ_ID | E3D_INVENTOR_FLAG ),
+ UHashMapEntry (RTL_CONSTASCII_STRINGPARAM(""), 0 )
+};
+
+// ---------------------------------------------------------------------
+
+UHashMap aSdrShapeIdentifierMap( pSdrShapeIdentifierMap );
+
+/***********************************************************************
+* class UHashMap *
+***********************************************************************/
+
+UHashMap::UHashMap( UHashMapEntry* pMap )
+{
+ while( pMap->aIdentifier.getLength() )
+ {
+ OUString aStr( pMap->aIdentifier );
+ size_t nHash = aStr.hashCode() & (HASHARRAYSIZE-1);
+
+ m_aHashList[nHash].Insert(pMap);
+ pMap++;
+ }
+}
+
+// ---------------------------------------------------------------------
+
+sal_uInt32 UHashMap::getId( const OUString& rCompareString )
+{
+ size_t nHash = rCompareString.hashCode() & (HASHARRAYSIZE-1);
+
+ UHashMapEntryList& rList = m_aHashList[nHash];
+
+ UHashMapEntry * pMap = rList.First();
+
+ while(pMap)
+ {
+ if( rCompareString == pMap->aIdentifier )
+ return pMap->nId;
+
+ pMap = rList.Next();
+ }
+
+ return UHASHMAP_NOTFOUND;
+}
+
+/***********************************************************************
+* class SvxUnoPropertyMapProvider *
+***********************************************************************/
+
+EXTERN_C
+#if defined( PM2 ) && (!defined( CSET ) && !defined ( MTW ) && !defined( WTC ))
+int _stdcall
+#else
+#ifdef WNT
+int _cdecl
+#else
+int
+#endif
+#endif
+Svx_CompareMap(const void* pSmaller, const void* pBigger )
+{
+ int nDiff = strcmp( ((const SfxItemPropertyMapEntry*)pSmaller)->pName,
+ ((const SfxItemPropertyMapEntry*)pBigger)->pName );
+ return nDiff;
+}
+
+// ---------------------------------------------------------------------
+
+SvxUnoPropertyMapProvider::SvxUnoPropertyMapProvider()
+{
+ for(sal_uInt16 i=0;i<SVXMAP_END; i++)
+ {
+ aSetArr[i] = 0;
+ aMapArr[i] = 0;
+ }
+}
+
+SvxUnoPropertyMapProvider::~SvxUnoPropertyMapProvider()
+{
+ for(sal_uInt16 i=0;i<SVXMAP_END; i++)
+ delete aSetArr[i];
+}
+
+// ---------------------------------------------------------------------
+
+/*void SvxUnoPropertyMapProvider::Sort(sal_uInt16 nId)
+{
+ SfxItemPropertyMapEntry* pTemp = aMapArr[nId];
+ sal_uInt16 i = 0;
+ while(pTemp[i].pName) { i++; }
+ qsort(aMapArr[nId], i, sizeof(SfxItemPropertyMapEntry), Svx_CompareMap);
+}*/
+
+// ---------------------------------------------------------------------
+
+const SfxItemPropertyMapEntry* SvxUnoPropertyMapProvider::GetMap(sal_uInt16 nPropertyId)
+{
+ DBG_ASSERT(nPropertyId < SVXMAP_END, "Id ?" );
+ if(!aMapArr[nPropertyId]) {
+ switch(nPropertyId) {
+ case SVXMAP_SHAPE: aMapArr[SVXMAP_SHAPE]=ImplGetSvxShapePropertyMap(); break;
+ case SVXMAP_CONNECTOR: aMapArr[SVXMAP_CONNECTOR]=ImplGetSvxConnectorPropertyMap(); break;
+ case SVXMAP_DIMENSIONING: aMapArr[SVXMAP_DIMENSIONING]=ImplGetSvxDimensioningPropertyMap(); break;
+ case SVXMAP_CIRCLE: aMapArr[SVXMAP_CIRCLE]=ImplGetSvxCirclePropertyMap(); break;
+ case SVXMAP_POLYPOLYGON: aMapArr[SVXMAP_POLYPOLYGON]=ImplGetSvxPolyPolygonPropertyMap(); break;
+ case SVXMAP_POLYPOLYGONBEZIER: aMapArr[SVXMAP_POLYPOLYGONBEZIER]=ImplGetSvxPolyPolygonBezierPropertyMap(); break;
+ case SVXMAP_GRAPHICOBJECT: aMapArr[SVXMAP_GRAPHICOBJECT]=ImplGetSvxGraphicObjectPropertyMap(); break;
+ case SVXMAP_3DSCENEOBJECT: aMapArr[SVXMAP_3DSCENEOBJECT]=ImplGetSvx3DSceneObjectPropertyMap(); break;
+ case SVXMAP_3DCUBEOBJEKT: aMapArr[SVXMAP_3DCUBEOBJEKT]=ImplGetSvx3DCubeObjectPropertyMap(); break;
+ case SVXMAP_3DSPHEREOBJECT: aMapArr[SVXMAP_3DSPHEREOBJECT]=ImplGetSvx3DSphereObjectPropertyMap(); break;
+ case SVXMAP_3DLATHEOBJECT: aMapArr[SVXMAP_3DLATHEOBJECT]=ImplGetSvx3DLatheObjectPropertyMap(); break;
+ case SVXMAP_3DEXTRUDEOBJECT: aMapArr[SVXMAP_3DEXTRUDEOBJECT]=ImplGetSvx3DExtrudeObjectPropertyMap(); break;
+ case SVXMAP_3DPOLYGONOBJECT: aMapArr[SVXMAP_3DPOLYGONOBJECT]=ImplGetSvx3DPolygonObjectPropertyMap(); break;
+ case SVXMAP_ALL: aMapArr[SVXMAP_ALL]=ImplGetSvxAllPropertyMap(); break;
+ case SVXMAP_GROUP: aMapArr[SVXMAP_GROUP]=ImplGetSvxGroupPropertyMap(); break;
+ case SVXMAP_CAPTION: aMapArr[SVXMAP_CAPTION]=ImplGetSvxCaptionPropertyMap(); break;
+ case SVXMAP_OLE2: aMapArr[SVXMAP_OLE2]=ImplGetSvxOle2PropertyMap(); break;
+ case SVXMAP_PLUGIN: aMapArr[SVXMAP_PLUGIN]=ImplGetSvxPluginPropertyMap(); break;
+ case SVXMAP_FRAME: aMapArr[SVXMAP_FRAME]=ImplGetSvxFramePropertyMap(); break;
+ case SVXMAP_APPLET: aMapArr[SVXMAP_APPLET]=ImplGetSvxAppletPropertyMap(); break;
+ case SVXMAP_CONTROL: aMapArr[SVXMAP_CONTROL]=ImplGetSvxControlShapePropertyMap(); break;
+ case SVXMAP_TEXT: aMapArr[SVXMAP_TEXT]=ImplGetSvxTextShapePropertyMap(); break;
+ case SVXMAP_CUSTOMSHAPE: aMapArr[SVXMAP_CUSTOMSHAPE]=ImplGetSvxCustomShapePropertyMap(); break;
+ case SVXMAP_MEDIA: aMapArr[SVXMAP_MEDIA]=ImplGetSvxMediaShapePropertyMap(); break;
+ case SVXMAP_TABLE: aMapArr[SVXMAP_TABLE]=ImplGetSvxTableShapePropertyMap(); break;
+ case SVXMAP_PAGE: aMapArr[SVXMAP_PAGE] = ImplGetSvxPageShapePropertyMap(); break;
+
+ default:
+ DBG_ERROR( "Unknown property map for SvxUnoPropertyMapProvider!" );
+ }
+// Sort(nPropertyId);
+ }
+ return aMapArr[nPropertyId];
+}
+const SvxItemPropertySet* SvxUnoPropertyMapProvider::GetPropertySet(sal_uInt16 nPropertyId, SfxItemPool& rPool)
+{
+ if( !aSetArr[nPropertyId] )
+ aSetArr[nPropertyId] = new SvxItemPropertySet( GetMap( nPropertyId ), rPool );
+ return aSetArr[nPropertyId];
+}
+
+// #####################################################################
+
+/** maps the API constant MeasureUnit to a vcl MapUnit enum.
+ Returns false if conversion is not supported.
+
+ @cl: for warnings01 I found out that this method never worked so I thin
+ it is not used at all
+sal_Bool SvxMeasureUnitToMapUnit( const short eApi, int& eVcl ) throw()
+{
+ switch( eVcl )
+ {
+ case util::MeasureUnit::MM_100TH: eVcl = MAP_100TH_MM; break;
+ case util::MeasureUnit::MM_10TH: eVcl = MAP_10TH_MM; break;
+ case util::MeasureUnit::MM: eVcl = MAP_MM; break;
+ case util::MeasureUnit::CM: eVcl = MAP_CM; break;
+ case util::MeasureUnit::INCH_1000TH: eVcl = MAP_1000TH_INCH; break;
+ case util::MeasureUnit::INCH_100TH: eVcl = MAP_100TH_INCH; break;
+ case util::MeasureUnit::INCH_10TH: eVcl = MAP_10TH_INCH; break;
+ case util::MeasureUnit::INCH: eVcl = MAP_INCH; break;
+ case util::MeasureUnit::POINT: eVcl = MAP_POINT; break;
+ case util::MeasureUnit::TWIP: eVcl = MAP_TWIP; break;
+ case util::MeasureUnit::PERCENT: eVcl = MAP_RELATIVE; break;
+ default:
+ return false;
+ }
+
+ return true;
+}
+*/
+
+/** maps the vcl MapUnit enum to a API constant MeasureUnit.
+ Returns false if conversion is not supported.
+*/
+sal_Bool SvxMapUnitToMeasureUnit( const short eVcl, short& eApi ) throw()
+{
+ switch( eVcl )
+ {
+ case MAP_100TH_MM: eApi = util::MeasureUnit::MM_100TH; break;
+ case MAP_10TH_MM: eApi = util::MeasureUnit::MM_10TH; break;
+ case MAP_MM: eApi = util::MeasureUnit::MM; break;
+ case MAP_CM: eApi = util::MeasureUnit::CM; break;
+ case MAP_1000TH_INCH: eApi = util::MeasureUnit::INCH_1000TH; break;
+ case MAP_100TH_INCH: eApi = util::MeasureUnit::INCH_100TH; break;
+ case MAP_10TH_INCH: eApi = util::MeasureUnit::INCH_10TH; break;
+ case MAP_INCH: eApi = util::MeasureUnit::INCH; break;
+ case MAP_POINT: eApi = util::MeasureUnit::POINT; break;
+ case MAP_TWIP: eApi = util::MeasureUnit::TWIP; break;
+ case MAP_RELATIVE: eApi = util::MeasureUnit::PERCENT; break;
+ default:
+ return false;
+ }
+
+ return true;
+}
+
+/** maps the API constant MeasureUnit to a vcl MapUnit enum.
+ Returns false if conversion is not supported.
+*/
+
+sal_Bool SvxMeasureUnitToFieldUnit( const short eApi, short& eVcl ) throw()
+{
+ switch( eApi )
+ {
+ case util::MeasureUnit::MM: eVcl = FUNIT_MM; break;
+ case util::MeasureUnit::CM: eVcl = FUNIT_CM; break;
+ case util::MeasureUnit::M: eVcl = FUNIT_M; break;
+ case util::MeasureUnit::KM: eVcl = FUNIT_KM; break;
+ case util::MeasureUnit::TWIP: eVcl = FUNIT_TWIP; break;
+ case util::MeasureUnit::POINT: eVcl = FUNIT_POINT; break;
+ case util::MeasureUnit::PICA: eVcl = FUNIT_PICA; break;
+ case util::MeasureUnit::INCH: eVcl = FUNIT_INCH; break;
+ case util::MeasureUnit::FOOT: eVcl = FUNIT_FOOT; break;
+ case util::MeasureUnit::MILE: eVcl = FUNIT_MILE; break;
+ case util::MeasureUnit::PERCENT: eVcl = FUNIT_PERCENT; break;
+ case util::MeasureUnit::MM_100TH: eVcl = FUNIT_100TH_MM; break;
+ default:
+ return sal_False;
+ }
+
+ return sal_True;
+}
+
+/** maps the vcl MapUnit enum to a API constant MeasureUnit.
+ Returns false if conversion is not supported.
+*/
+sal_Bool SvxFieldUnitToMeasureUnit( const short eVcl, short& eApi ) throw()
+{
+ switch( eVcl )
+ {
+ case FUNIT_MM: eApi = util::MeasureUnit::MM; break;
+ case FUNIT_CM: eApi = util::MeasureUnit::CM; break;
+ case FUNIT_M: eApi = util::MeasureUnit::M; break;
+ case FUNIT_KM: eApi = util::MeasureUnit::KM; break;
+ case FUNIT_TWIP: eApi = util::MeasureUnit::TWIP; break;
+ case FUNIT_POINT: eApi = util::MeasureUnit::POINT; break;
+ case FUNIT_PICA: eApi = util::MeasureUnit::PICA; break;
+ case FUNIT_INCH: eApi = util::MeasureUnit::INCH; break;
+ case FUNIT_FOOT: eApi = util::MeasureUnit::FOOT; break;
+ case FUNIT_MILE: eApi = util::MeasureUnit::MILE; break;
+ case FUNIT_PERCENT: eApi = util::MeasureUnit::PERCENT; break;
+ case FUNIT_100TH_MM: eApi = util::MeasureUnit::MM_100TH; break;
+ default:
+ return sal_False;
+ }
+
+ return sal_True;
+}
+
+bool SvxUnoGetResourceRanges( const short nWhich, int& nApiResIds, int& nIntResIds, int& nCount ) throw()
+{
+ switch( nWhich )
+ {
+ case XATTR_FILLBITMAP:
+ nApiResIds = RID_SVXSTR_BMP_DEF_START;
+ nIntResIds = RID_SVXSTR_BMP_START;
+ nCount = RID_SVXSTR_BMP_DEF_END - RID_SVXSTR_BMP_DEF_START + 1;
+ break;
+
+ case XATTR_LINEDASH:
+ nApiResIds = RID_SVXSTR_DASH_DEF_START;
+ nIntResIds = RID_SVXSTR_DASH_START;
+ nCount = RID_SVXSTR_DASH_DEF_END - RID_SVXSTR_DASH_DEF_START + 1;
+ break;
+
+ case XATTR_LINESTART:
+ case XATTR_LINEEND:
+ nApiResIds = RID_SVXSTR_LEND_DEF_START;
+ nIntResIds = RID_SVXSTR_LEND_START;
+ nCount = RID_SVXSTR_LEND_DEF_END - RID_SVXSTR_LEND_DEF_START + 1;
+ break;
+
+ case XATTR_FILLGRADIENT:
+ nApiResIds = RID_SVXSTR_GRDT_DEF_START;
+ nIntResIds = RID_SVXSTR_GRDT_START;
+ nCount = RID_SVXSTR_GRDT_DEF_END - RID_SVXSTR_GRDT_DEF_START + 1;
+ break;
+
+ case XATTR_FILLHATCH:
+ nApiResIds = RID_SVXSTR_HATCH_DEF_START;
+ nIntResIds = RID_SVXSTR_HATCH_START;
+ nCount = RID_SVXSTR_HATCH_DEF_END - RID_SVXSTR_HATCH_DEF_START + 1;
+ break;
+
+ case XATTR_FILLFLOATTRANSPARENCE:
+ nApiResIds = RID_SVXSTR_TRASNGR_DEF_START;
+ nIntResIds = RID_SVXSTR_TRASNGR_START;
+ nCount = RID_SVXSTR_TRASNGR_DEF_END - RID_SVXSTR_TRASNGR_DEF_START + 1;
+ break;
+
+ default:
+ return sal_False;
+ }
+
+ return sal_True;
+}
+
+/*sal_Int16 SvxUnoGetWhichIdForNamedProperty( const ::rtl::OUString & rPropName )
+{
+ sal_Int16 nWhich = 0;
+
+ const SfxItemPropertyMapEntry* pMap = aSvxMapProvider.GetMap( SVXMAP_SHAPE );
+ if( pMap )
+ {
+ const SfxItemPropertyMapEntry* pFound = SfxItemPropertyMapEntry::getByName( pMap, rPropName );
+ if( pFound )
+ nWhich = pFound->nWID;
+ }
+
+ return nWhich;
+} */
+
+bool SvxUnoConvertResourceString( int nSourceResIds, int nDestResIds, int nCount, String& rString ) throw()
+{
+ // first, calculate the search string length without an optional number behind the name
+ xub_StrLen nLength = rString.Len();
+ while( nLength > 0 )
+ {
+ const sal_Unicode nChar = rString.GetChar( nLength - 1 );
+ if( (nChar < '0') || (nChar > '9') )
+ break;
+
+ nLength--;
+ }
+
+ // if we cut off a number, also cut of some spaces
+ if( nLength != rString.Len() )
+ {
+ while( nLength > 0 )
+ {
+ const sal_Unicode nChar = rString.GetChar( nLength - 1 );
+ if( nChar != ' ' )
+ break;
+
+ nLength--;
+ }
+ }
+
+ const String aShortString( rString.Copy( 0, nLength ) );
+
+ int i;
+ for( i = 0; i < nCount; i++ )
+ {
+ sal_uInt16 nResId = (sal_uInt16)(nSourceResIds + i);
+ const ResId aRes( SVX_RES(nResId));
+ const String aCompare( aRes );
+ if( aShortString == aCompare )
+ {
+ sal_uInt16 nNewResId = (sal_uInt16)(nDestResIds + i);
+ ResId aNewRes( SVX_RES( nNewResId ));
+ rString.Replace( 0, aShortString.Len(), String( aNewRes ) );
+ return sal_True;
+ }
+ else if( rString == aCompare )
+ {
+ sal_uInt16 nNewResId = (sal_uInt16)(nDestResIds + i);
+ ResId aNewRes( SVX_RES( nNewResId ));
+ rString = String( aNewRes );
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+static sal_uInt16 __READONLY_DATA SvxUnoColorNameDefResId[] =
+{
+ RID_SVXSTR_BLUEGREY_DEF,
+ RID_SVXSTR_BLACK_DEF,
+ RID_SVXSTR_BLUE_DEF,
+ RID_SVXSTR_GREEN_DEF,
+ RID_SVXSTR_CYAN_DEF,
+ RID_SVXSTR_RED_DEF,
+ RID_SVXSTR_MAGENTA_DEF,
+ RID_SVXSTR_BROWN_DEF,
+ RID_SVXSTR_GREY_DEF,
+ RID_SVXSTR_LIGHTGREY_DEF,
+ RID_SVXSTR_LIGHTBLUE_DEF,
+ RID_SVXSTR_LIGHTGREEN_DEF,
+ RID_SVXSTR_LIGHTCYAN_DEF,
+ RID_SVXSTR_LIGHTRED_DEF,
+ RID_SVXSTR_LIGHTMAGENTA_DEF,
+ RID_SVXSTR_YELLOW_DEF,
+ RID_SVXSTR_WHITE_DEF,
+ RID_SVXSTR_ORANGE_DEF,
+ RID_SVXSTR_VIOLET_DEF,
+ RID_SVXSTR_BORDEAUX_DEF,
+ RID_SVXSTR_PALE_YELLOW_DEF,
+ RID_SVXSTR_PALE_GREEN_DEF,
+ RID_SVXSTR_DKVIOLET_DEF,
+ RID_SVXSTR_SALMON_DEF,
+ RID_SVXSTR_SEABLUE_DEF,
+ RID_SVXSTR_COLOR_SUN_DEF,
+ RID_SVXSTR_COLOR_CHART_DEF
+};
+
+static sal_uInt16 __READONLY_DATA SvxUnoColorNameResId[] =
+{
+ RID_SVXSTR_BLUEGREY,
+ RID_SVXSTR_BLACK,
+ RID_SVXSTR_BLUE,
+ RID_SVXSTR_GREEN,
+ RID_SVXSTR_CYAN,
+ RID_SVXSTR_RED,
+ RID_SVXSTR_MAGENTA,
+ RID_SVXSTR_BROWN,
+ RID_SVXSTR_GREY,
+ RID_SVXSTR_LIGHTGREY,
+ RID_SVXSTR_LIGHTBLUE,
+ RID_SVXSTR_LIGHTGREEN,
+ RID_SVXSTR_LIGHTCYAN,
+ RID_SVXSTR_LIGHTRED,
+ RID_SVXSTR_LIGHTMAGENTA,
+ RID_SVXSTR_YELLOW,
+ RID_SVXSTR_WHITE,
+ RID_SVXSTR_ORANGE,
+ RID_SVXSTR_VIOLET,
+ RID_SVXSTR_BORDEAUX,
+ RID_SVXSTR_PALE_YELLOW,
+ RID_SVXSTR_PALE_GREEN,
+ RID_SVXSTR_DKVIOLET,
+ RID_SVXSTR_SALMON,
+ RID_SVXSTR_SEABLUE,
+ RID_SVXSTR_COLOR_SUN,
+ RID_SVXSTR_COLOR_CHART
+};
+
+bool SvxUnoConvertResourceString( sal_uInt16* pSourceResIds, sal_uInt16* pDestResIds, int nCount, String& rString ) throw()
+{
+ int i = 0;
+
+ for( i = 0; i < nCount; i++ )
+ {
+ String aStrDefName = SVX_RESSTR( pSourceResIds[i] );
+ if( rString.Search( aStrDefName ) == 0 )
+ {
+ String aReplace = SVX_RESSTR( pDestResIds[i] );
+ rString.Replace( 0, aStrDefName.Len(), aReplace );
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/** if the given name is a predefined name for the current language it is replaced by
+ the corresponding api name.
+*/
+void SvxUnogetApiNameForItem( const sal_Int16 nWhich, const String& rInternalName, rtl::OUString& rApiName ) throw()
+{
+#ifndef SVX_LIGHT
+ String aNew = rInternalName;
+
+ if( nWhich == XATTR_LINECOLOR )
+ {
+ if( SvxUnoConvertResourceString( (sal_uInt16*)SvxUnoColorNameResId, (sal_uInt16*)SvxUnoColorNameDefResId, sizeof( SvxUnoColorNameResId ) / sizeof( sal_uInt16 ), aNew ) )
+ {
+ rApiName = aNew;
+ return;
+ }
+ }
+ else
+ {
+ int nApiResIds;
+ int nIntResIds;
+ int nCount;
+
+ if( SvxUnoGetResourceRanges( nWhich, nApiResIds, nIntResIds, nCount ) )
+ {
+ if(SvxUnoConvertResourceString( nIntResIds, nApiResIds, nCount, aNew ) )
+ {
+ rApiName = aNew;
+ return;
+ }
+ }
+ }
+#endif
+
+ // just use previous name, if nothing else was found.
+ rApiName = rInternalName;
+}
+
+/** if the given name is a predefined api name it is replaced by the predefined name
+ for the current language.
+*/
+void SvxUnogetInternalNameForItem( const sal_Int16 nWhich, const rtl::OUString& rApiName, String& rInternalName ) throw()
+{
+#ifndef SVX_LIGHT
+ String aNew = rApiName;
+
+ if( nWhich == XATTR_LINECOLOR )
+ {
+ if( SvxUnoConvertResourceString( (sal_uInt16*)SvxUnoColorNameDefResId, (sal_uInt16*)SvxUnoColorNameResId, sizeof( SvxUnoColorNameResId ) / sizeof( sal_uInt16 ), aNew ) )
+ {
+ rInternalName = aNew;
+ return;
+ }
+ }
+ else
+ {
+ int nApiResIds;
+ int nIntResIds;
+ int nCount;
+
+ if( SvxUnoGetResourceRanges( nWhich, nApiResIds, nIntResIds, nCount ) )
+ {
+ if(SvxUnoConvertResourceString( nApiResIds, nIntResIds, nCount, aNew ) )
+ {
+ rInternalName = aNew;
+ return;
+ }
+ }
+ }
+#endif // !SVX_LIGHT
+
+ // just use previous name, if nothing else was found.
+ rInternalName = rApiName;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+comphelper::PropertySetInfo* SvxPropertySetInfoPool::getOrCreate( sal_Int32 nServiceId ) throw()
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ if( nServiceId > SVXUNO_SERVICEID_LASTID )
+ {
+ DBG_ERROR( "unknown service id!" );
+ return NULL;
+ }
+
+ if( mpInfos[ nServiceId ] == NULL )
+ {
+ mpInfos[nServiceId] = new comphelper::PropertySetInfo();
+ mpInfos[nServiceId]->acquire();
+
+ switch( nServiceId )
+ {
+ case SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS:
+ mpInfos[SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS]->add( ImplGetSvxDrawingDefaultsPropertyMap() );
+ break;
+ case SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS_WRITER:
+ mpInfos[SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS_WRITER]->add( ImplGetSvxDrawingDefaultsPropertyMap() );
+ mpInfos[SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS_WRITER]->remove( OUString( RTL_CONSTASCII_USTRINGPARAM( UNO_NAME_EDIT_PARA_IS_HANGING_PUNCTUATION ) ) );
+ // OD 13.10.2003 #i18732# - add property map for writer item 'IsFollowingTextFlow'
+ mpInfos[SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS_WRITER]->add( ImplGetAdditionalWriterDrawingDefaultsPropertyMap() );
+ break;
+
+ default:
+ DBG_ERROR( "unknown service id!" );
+ }
+ }
+
+ return mpInfos[ nServiceId ];
+}
+
+comphelper::PropertySetInfo* SvxPropertySetInfoPool::mpInfos[SVXUNO_SERVICEID_LASTID+1] = { NULL };
+
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
new file mode 100644
index 000000000000..17709c6197ce
--- /dev/null
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -0,0 +1,2157 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#define _SVX_USE_UNOGLOBALS_
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
+#include <com/sun/star/awt/TextAlign.hpp> //added by BerryJia for fixing Bug102407 2002-11-4
+#include <com/sun/star/style/ParagraphAdjust.hpp> //added by BerryJia for fixing Bug102407 2002-11-4
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#include <com/sun/star/drawing/PointSequence.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <tools/urlobj.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <svtools/fltcall.hxx>
+#include <svtools/filter.hxx>
+
+#include <boost/scoped_ptr.hpp>
+#include <svx/svdpool.hxx>
+#include <rtl/uuid.h>
+#include <rtl/memory.h>
+#include <tools/urlobj.hxx>
+
+#include <editeng/unoprnms.hxx>
+#include <svx/unoshape.hxx>
+#include <svx/unopage.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdouno.hxx>
+#include "shapeimpl.hxx"
+#include "svx/unoshprp.hxx"
+#include <svx/svdoashp.hxx>
+#include "unopolyhelper.hxx"
+
+// #i29181#
+#include "svx/svdviter.hxx"
+#include <svx/svdview.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+
+using ::rtl::OUString;
+using namespace ::osl;
+using namespace ::vos;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+
+#define INTERFACE_TYPE( xint ) \
+ ::getCppuType((const Reference< xint >*)0)
+
+#define QUERYINT( xint ) \
+ if( rType == ::getCppuType((const Reference< xint >*)0) ) \
+ aAny <<= Reference< xint >(this)
+
+class GDIMetaFile;
+class SvStream;
+sal_Bool ConvertGDIMetaFileToWMF( const GDIMetaFile & rMTF, SvStream & rTargetStream,
+ FilterConfigItem* pFilterConfigItem = NULL, sal_Bool bPlaceable = sal_True );
+
+/***********************************************************************
+* class SvxShapeGroup *
+***********************************************************************/
+
+SvxShapeGroup::SvxShapeGroup( SdrObject* pObj, SvxDrawPage* pDrawPage ) throw() :
+ SvxShape( pObj, aSvxMapProvider.GetMap(SVXMAP_GROUP), aSvxMapProvider.GetPropertySet(SVXMAP_GROUP, SdrObject::GetGlobalDrawObjectItemPool()) ),
+ mxPage( pDrawPage )
+{
+}
+
+//----------------------------------------------------------------------
+SvxShapeGroup::~SvxShapeGroup() throw()
+{
+}
+
+//----------------------------------------------------------------------
+void SvxShapeGroup::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage )
+{
+ SvxShape::Create( pNewObj, pNewPage );
+ mxPage = pNewPage;
+}
+
+//----------------------------------------------------------------------
+uno::Any SAL_CALL SvxShapeGroup::queryInterface( const uno::Type & rType )
+ throw(uno::RuntimeException)
+{
+ return SvxShape::queryInterface( rType );
+}
+
+uno::Any SAL_CALL SvxShapeGroup::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+
+ QUERYINT( drawing::XShapeGroup );
+ else QUERYINT( drawing::XShapes );
+ else QUERYINT( container::XIndexAccess );
+ else QUERYINT( container::XElementAccess );
+ else
+ return SvxShape::queryAggregation( rType );
+
+ return aAny;
+}
+
+void SAL_CALL SvxShapeGroup::acquire() throw ( )
+{
+ SvxShape::acquire();
+}
+
+void SAL_CALL SvxShapeGroup::release() throw ( )
+{
+ SvxShape::release();
+}
+
+uno::Sequence< uno::Type > SAL_CALL SvxShapeGroup::getTypes()
+ throw (uno::RuntimeException)
+{
+ return SvxShape::getTypes();
+}
+
+uno::Sequence< sal_Int8 > SAL_CALL SvxShapeGroup::getImplementationId()
+ throw (uno::RuntimeException)
+{
+ static uno::Sequence< sal_Int8 > aId;
+ if( aId.getLength() == 0 )
+ {
+ aId.realloc( 16 );
+ rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
+ }
+ return aId;
+}
+
+// ::com::sun::star::drawing::XShape
+
+//----------------------------------------------------------------------
+OUString SAL_CALL SvxShapeGroup::getShapeType()
+ throw( uno::RuntimeException )
+{
+ return SvxShape::getShapeType();
+}
+
+//------------------------------------------------------------------1----
+awt::Point SAL_CALL SvxShapeGroup::getPosition() throw(uno::RuntimeException)
+{
+ return SvxShape::getPosition();
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SvxShapeGroup::setPosition( const awt::Point& Position ) throw(uno::RuntimeException)
+{
+ SvxShape::setPosition(Position);
+}
+
+//----------------------------------------------------------------------
+
+awt::Size SAL_CALL SvxShapeGroup::getSize() throw(uno::RuntimeException)
+{
+ return SvxShape::getSize();
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SvxShapeGroup::setSize( const awt::Size& rSize )
+ throw(beans::PropertyVetoException, uno::RuntimeException)
+{
+ SvxShape::setSize( rSize );
+}
+
+// drawing::XShapeGroup
+
+//----------------------------------------------------------------------
+void SAL_CALL SvxShapeGroup::enterGroup( ) throw(uno::RuntimeException)
+{
+ // Todo
+// pDrView->EnterMarkedGroup();
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SvxShapeGroup::leaveGroup( ) throw(uno::RuntimeException)
+{
+ // Todo
+// pDrView->LeaveOneGroup();
+}
+
+//----------------------------------------------------------------------
+
+// XShapes
+void SAL_CALL SvxShapeGroup::add( const uno::Reference< drawing::XShape >& xShape )
+ throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ SvxShape* pShape = SvxShape::getImplementation( xShape );
+
+ if( mpObj.is()&& mxPage.is() && pShape )
+ {
+ SdrObject* pSdrShape = pShape->GetSdrObject();
+ if( pSdrShape == NULL )
+ pSdrShape = mxPage->_CreateSdrObject( xShape );
+
+ if( pSdrShape->IsInserted() )
+ pSdrShape->GetObjList()->RemoveObject( pSdrShape->GetOrdNum() );
+
+ mpObj->GetSubList()->InsertObject( pSdrShape );
+ pSdrShape->SetModel(mpObj->GetModel());
+
+ // #85922# It makes no sense to set the layer asked
+ // from the group object since these is an iteration
+ // over the contained objects. In consequence, this
+ // statement erases all layer information from the draw
+ // objects. Layers need to be set at draw objects directly
+ // and have nothing to do with grouping at all.
+ // pSdrShape->SetLayer(pObject->GetLayer());
+
+ // Establish connection between new SdrObject and its wrapper before
+ // inserting the new shape into the group. There a new wrapper
+ // would be created when this connection would not already exist.
+ if(pShape)
+ pShape->Create( pSdrShape, mxPage.get() );
+
+ if( mpModel )
+ mpModel->SetChanged();
+ }
+ else
+ {
+ DBG_ERROR("could not add XShape to group shape!");
+ }
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SvxShapeGroup::remove( const uno::Reference< drawing::XShape >& xShape )
+ throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ SdrObject* pSdrShape = NULL;
+ SvxShape* pShape = SvxShape::getImplementation( xShape );
+
+ if( pShape )
+ pSdrShape = pShape->GetSdrObject();
+
+ if( !mpObj.is() || pSdrShape == NULL || pSdrShape->GetObjList()->GetOwnerObj() != mpObj.get() )
+ throw uno::RuntimeException();
+
+ SdrObjList& rList = *pSdrShape->GetObjList();
+
+ const sal_uInt32 nObjCount = rList.GetObjCount();
+ sal_uInt32 nObjNum = 0;
+ while( nObjNum < nObjCount )
+ {
+ if(rList.GetObj( nObjNum ) == pSdrShape )
+ break;
+ nObjNum++;
+ }
+
+ if( nObjNum < nObjCount )
+ {
+ // #i29181#
+ // If the SdrObject which is about to be deleted is in any selection,
+ // deselect it first.
+ SdrViewIter aIter( pSdrShape );
+
+ for ( SdrView* pView = aIter.FirstView(); pView; pView = aIter.NextView() )
+ {
+ if(CONTAINER_ENTRY_NOTFOUND != pView->TryToFindMarkedObject(pSdrShape))
+ {
+ pView->MarkObj(pSdrShape, pView->GetSdrPageView(), sal_True, sal_False);
+ }
+ }
+
+ SdrObject* pObject = rList.NbcRemoveObject( nObjNum );
+ SdrObject::Free( pObject );
+ }
+ else
+ {
+ DBG_ASSERT( 0, "Fatality! SdrObject is not belonging to its SdrObjList! [CL]" );
+ }
+
+ if( mpModel )
+ mpModel->SetChanged();
+}
+
+// XIndexAccess
+
+//----------------------------------------------------------------------
+sal_Int32 SAL_CALL SvxShapeGroup::getCount() throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ sal_Int32 nRetval = 0;
+
+ if(mpObj.is() && mpObj->GetSubList())
+ nRetval = mpObj->GetSubList()->GetObjCount();
+ else
+ throw uno::RuntimeException();
+
+ return nRetval;
+}
+
+//----------------------------------------------------------------------
+uno::Any SAL_CALL SvxShapeGroup::getByIndex( sal_Int32 Index )
+ throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( !mpObj.is() || mpObj->GetSubList() == NULL )
+ throw uno::RuntimeException();
+
+ if( mpObj->GetSubList()->GetObjCount() <= (sal_uInt32)Index )
+ throw lang::IndexOutOfBoundsException();
+
+ SdrObject* pDestObj = mpObj->GetSubList()->GetObj( Index );
+
+ if(pDestObj == NULL)
+ throw lang::IndexOutOfBoundsException();
+
+ Reference< drawing::XShape > xShape( pDestObj->getUnoShape(), uno::UNO_QUERY );
+ return uno::makeAny( xShape );
+}
+
+// ::com::sun::star::container::XElementAccess
+
+//----------------------------------------------------------------------
+uno::Type SAL_CALL SvxShapeGroup::getElementType() throw( uno::RuntimeException )
+{
+ return ::getCppuType(( const Reference< drawing::XShape >*)0);
+}
+
+//----------------------------------------------------------------------
+sal_Bool SAL_CALL SvxShapeGroup::hasElements() throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ return mpObj.is() && mpObj->GetSubList() && (mpObj->GetSubList()->GetObjCount() > 0);
+}
+
+//----------------------------------------------------------------------
+// ::com::sun::star::lang::XServiceInfo
+
+uno::Sequence< OUString > SAL_CALL SvxShapeGroup::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ return SvxShape::getSupportedServiceNames();
+}
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+SvxShapeConnector::SvxShapeConnector( SdrObject* pObj ) throw() :
+ SvxShapeText( pObj, aSvxMapProvider.GetMap(SVXMAP_CONNECTOR), aSvxMapProvider.GetPropertySet(SVXMAP_CONNECTOR, SdrObject::GetGlobalDrawObjectItemPool()) )
+{
+}
+
+//----------------------------------------------------------------------
+SvxShapeConnector::~SvxShapeConnector() throw()
+{
+}
+
+//----------------------------------------------------------------------
+
+uno::Any SAL_CALL SvxShapeConnector::queryInterface( const uno::Type & rType )
+ throw(uno::RuntimeException)
+{
+ return SvxShapeText::queryInterface( rType );
+}
+
+uno::Any SAL_CALL SvxShapeConnector::queryAggregation( const uno::Type & rType )
+ throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+
+ QUERYINT( drawing::XConnectorShape );
+ else
+ return SvxShapeText::queryAggregation( rType );
+
+ return aAny;
+}
+
+void SAL_CALL SvxShapeConnector::acquire() throw ( )
+{
+ SvxShapeText::acquire();
+}
+
+void SAL_CALL SvxShapeConnector::release() throw ( )
+{
+ SvxShapeText::release();
+}
+// XTypeProvider
+
+uno::Sequence< uno::Type > SAL_CALL SvxShapeConnector::getTypes()
+ throw (uno::RuntimeException)
+{
+ return SvxShape::getTypes();
+}
+
+uno::Sequence< sal_Int8 > SAL_CALL SvxShapeConnector::getImplementationId()
+ throw (uno::RuntimeException)
+{
+ static uno::Sequence< sal_Int8 > aId;
+ if( aId.getLength() == 0 )
+ {
+ aId.realloc( 16 );
+ rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
+ }
+ return aId;
+}
+
+// ::com::sun::star::drawing::XShape
+
+//----------------------------------------------------------------------
+OUString SAL_CALL SvxShapeConnector::getShapeType()
+ throw( uno::RuntimeException )
+{
+ return SvxShapeText::getShapeType();
+}
+
+//------------------------------------------------------------------1----
+awt::Point SAL_CALL SvxShapeConnector::getPosition() throw(uno::RuntimeException)
+{
+ return SvxShapeText::getPosition();
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SvxShapeConnector::setPosition( const awt::Point& Position ) throw(uno::RuntimeException)
+{
+ SvxShapeText::setPosition(Position);
+}
+
+//----------------------------------------------------------------------
+
+awt::Size SAL_CALL SvxShapeConnector::getSize() throw(uno::RuntimeException)
+{
+ return SvxShapeText::getSize();
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SvxShapeConnector::setSize( const awt::Size& rSize )
+ throw(beans::PropertyVetoException, uno::RuntimeException)
+{
+ SvxShapeText::setSize( rSize );
+}
+
+//----------------------------------------------------------------------
+
+// XConnectorShape
+
+void SAL_CALL SvxShapeConnector::connectStart( const uno::Reference< drawing::XConnectableShape >& xShape, drawing::ConnectionType ) throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ Reference< drawing::XShape > xRef( xShape, UNO_QUERY );
+ SvxShape* pShape = SvxShape::getImplementation( xRef );
+
+ if( pShape )
+ mpObj->ConnectToNode( sal_True, pShape->mpObj.get() );
+
+ if( mpModel )
+ mpModel->SetChanged();
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SvxShapeConnector::connectEnd( const uno::Reference< drawing::XConnectableShape >& xShape, drawing::ConnectionType )
+ throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ Reference< drawing::XShape > xRef( xShape, UNO_QUERY );
+ SvxShape* pShape = SvxShape::getImplementation( xRef );
+
+ if( mpObj.is() && pShape )
+ mpObj->ConnectToNode( sal_False, pShape->mpObj.get() );
+
+ if( mpModel )
+ mpModel->SetChanged();
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SvxShapeConnector::disconnectBegin( const uno::Reference< drawing::XConnectableShape >& )
+ throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if(mpObj.is())
+ mpObj->DisconnectFromNode( sal_True );
+
+ if( mpModel )
+ mpModel->SetChanged();
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SvxShapeConnector::disconnectEnd( const uno::Reference< drawing::XConnectableShape >& )
+ throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if(mpObj.is())
+ mpObj->DisconnectFromNode( sal_False );
+
+ if( mpModel )
+ mpModel->SetChanged();
+}
+
+//----------------------------------------------------------------------
+// ::com::sun::star::lang::XServiceInfo
+//----------------------------------------------------------------------
+uno::Sequence< OUString > SAL_CALL SvxShapeConnector::getSupportedServiceNames() throw( uno::RuntimeException )
+{
+ return SvxShapeText::getSupportedServiceNames();
+}
+
+/***********************************************************************
+* class SvxShapeControl *
+***********************************************************************/
+DBG_NAME(SvxShapeControl)
+
+SvxShapeControl::SvxShapeControl( SdrObject* pObj ) throw() :
+ SvxShapeText( pObj, aSvxMapProvider.GetMap(SVXMAP_CONTROL), aSvxMapProvider.GetPropertySet(SVXMAP_CONTROL, SdrObject::GetGlobalDrawObjectItemPool()) )
+{
+ DBG_CTOR(SvxShapeControl,NULL);
+ setShapeKind( OBJ_UNO );
+}
+
+//----------------------------------------------------------------------
+SvxShapeControl::~SvxShapeControl() throw()
+{
+ DBG_DTOR(SvxShapeControl,NULL);
+}
+
+//----------------------------------------------------------------------
+uno::Any SAL_CALL SvxShapeControl::queryInterface( const uno::Type & rType )
+ throw(uno::RuntimeException)
+{
+ return SvxShapeText::queryInterface( rType );
+}
+
+uno::Any SAL_CALL SvxShapeControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+
+ QUERYINT( drawing::XControlShape );
+ else
+ return SvxShapeText::queryAggregation( rType );
+
+ return aAny;
+}
+
+void SAL_CALL SvxShapeControl::acquire() throw ( )
+{
+ SvxShapeText::acquire();
+}
+
+void SAL_CALL SvxShapeControl::release() throw ( )
+{
+ SvxShapeText::release();
+}
+// XTypeProvider
+
+uno::Sequence< uno::Type > SAL_CALL SvxShapeControl::getTypes()
+ throw (uno::RuntimeException)
+{
+ return SvxShape::getTypes();
+}
+
+uno::Sequence< sal_Int8 > SAL_CALL SvxShapeControl::getImplementationId()
+ throw (uno::RuntimeException)
+{
+ static uno::Sequence< sal_Int8 > aId;
+ if( aId.getLength() == 0 )
+ {
+ aId.realloc( 16 );
+ rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
+ }
+ return aId;
+}
+
+// ::com::sun::star::drawing::XShape
+
+//----------------------------------------------------------------------
+OUString SAL_CALL SvxShapeControl::getShapeType()
+ throw( uno::RuntimeException )
+{
+ return SvxShapeText::getShapeType();
+}
+
+//------------------------------------------------------------------1----
+awt::Point SAL_CALL SvxShapeControl::getPosition() throw(uno::RuntimeException)
+{
+ return SvxShapeText::getPosition();
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SvxShapeControl::setPosition( const awt::Point& Position ) throw(uno::RuntimeException)
+{
+ SvxShapeText::setPosition(Position);
+}
+
+//----------------------------------------------------------------------
+
+awt::Size SAL_CALL SvxShapeControl::getSize() throw(uno::RuntimeException)
+{
+ return SvxShapeText::getSize();
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SvxShapeControl::setSize( const awt::Size& rSize )
+ throw(beans::PropertyVetoException, uno::RuntimeException)
+{
+ SvxShapeText::setSize( rSize );
+}
+
+//----------------------------------------------------------------------
+// XControlShape
+
+Reference< awt::XControlModel > SAL_CALL SvxShapeControl::getControl()
+ throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ Reference< awt::XControlModel > xModel;
+
+ SdrUnoObj* pUnoObj = dynamic_cast< SdrUnoObj * >(mpObj.get());
+ if( pUnoObj )
+ xModel = pUnoObj->GetUnoControlModel();
+
+ return xModel;
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SvxShapeControl::setControl( const Reference< awt::XControlModel >& xControl )
+ throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ SdrUnoObj* pUnoObj = dynamic_cast< SdrUnoObj * >(mpObj.get());
+ if( pUnoObj )
+ pUnoObj->SetUnoControlModel( xControl );
+
+ if( mpModel )
+ mpModel->SetChanged();
+}
+
+// XServiceInfo
+uno::Sequence< OUString > SAL_CALL SvxShapeControl::getSupportedServiceNames() throw( uno::RuntimeException )
+{
+ return SvxShapeText::getSupportedServiceNames();
+}
+
+static struct
+{
+ const sal_Char* mpAPIName;
+ sal_uInt16 mnAPINameLen;
+
+ const sal_Char* mpFormName;
+ sal_uInt16 mnFormNameLen;
+}
+SvxShapeControlPropertyMapping[] =
+{
+ // Warning: The first entry must be FontSlant because the any needs to be converted
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_POSTURE), MAP_CHAR_LEN("FontSlant") }, // const sal_Int16 => ::com::sun::star::awt::FontSlant
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTNAME), MAP_CHAR_LEN("FontName") },
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTSTYLENAME), MAP_CHAR_LEN("FontStyleName") },
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTFAMILY), MAP_CHAR_LEN("FontFamily") },
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTCHARSET), MAP_CHAR_LEN("FontCharset") },
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_HEIGHT), MAP_CHAR_LEN("FontHeight") },
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTPITCH), MAP_CHAR_LEN("FontPitch" ) },
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_WEIGHT), MAP_CHAR_LEN("FontWeight" ) },
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_UNDERLINE), MAP_CHAR_LEN("FontUnderline") },
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_STRIKEOUT), MAP_CHAR_LEN("FontStrikeout") },
+ { MAP_CHAR_LEN("CharKerning"), MAP_CHAR_LEN("FontKerning") },
+ { MAP_CHAR_LEN("CharWordMode"), MAP_CHAR_LEN("FontWordLineMode" ) },
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_COLOR), MAP_CHAR_LEN("TextColor") },
+ { MAP_CHAR_LEN("CharRelief"), MAP_CHAR_LEN("FontRelief") },
+ { MAP_CHAR_LEN("CharUnderlineColor"), MAP_CHAR_LEN("TextLineColor") },
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_ADJUST), MAP_CHAR_LEN("Align") },
+ { MAP_CHAR_LEN("TextVerticalAdjust"), MAP_CHAR_LEN("VerticalAlign") },
+ { MAP_CHAR_LEN("ControlBackground"), MAP_CHAR_LEN("BackgroundColor") },
+ { MAP_CHAR_LEN("ControlSymbolColor"), MAP_CHAR_LEN("SymbolColor") },
+ { MAP_CHAR_LEN("ControlBorder"), MAP_CHAR_LEN("Border") },
+ { MAP_CHAR_LEN("ControlBorderColor"), MAP_CHAR_LEN("BorderColor") },
+ { MAP_CHAR_LEN("ControlTextEmphasis"), MAP_CHAR_LEN("FontEmphasisMark") },
+ { MAP_CHAR_LEN("ImageScaleMode"), MAP_CHAR_LEN("ScaleMode") },
+ { MAP_CHAR_LEN("ControlWritingMode"), MAP_CHAR_LEN("WritingMode") },
+ { NULL,0, NULL, 0 }
+};
+
+namespace
+{
+ static bool lcl_convertPropertyName( const OUString& rApiName, OUString& rInternalName )
+ {
+ sal_uInt16 i = 0;
+ while( SvxShapeControlPropertyMapping[i].mpAPIName )
+ {
+ if( rApiName.reverseCompareToAsciiL( SvxShapeControlPropertyMapping[i].mpAPIName, SvxShapeControlPropertyMapping[i].mnAPINameLen ) == 0 )
+ {
+ rInternalName = OUString( SvxShapeControlPropertyMapping[i].mpFormName, SvxShapeControlPropertyMapping[i].mnFormNameLen, RTL_TEXTENCODING_ASCII_US );
+ }
+ ++i;
+ }
+ return rInternalName.getLength() > 0;
+ }
+
+ struct EnumConversionMap
+ {
+ sal_Int16 nAPIValue;
+ sal_Int16 nFormValue;
+ };
+
+ EnumConversionMap aMapAdjustToAlign[] =
+ {
+ // note that order matters:
+ // lcl_convertTextAlignmentToParaAdjustment and lcl_convertParaAdjustmentToTextAlignment search this map from the _beginning_
+ // and use the first matching entry
+ {style::ParagraphAdjust_LEFT, (sal_Int16)awt::TextAlign::LEFT},
+ {style::ParagraphAdjust_CENTER, (sal_Int16)awt::TextAlign::CENTER},
+ {style::ParagraphAdjust_RIGHT, (sal_Int16)awt::TextAlign::RIGHT},
+ {style::ParagraphAdjust_BLOCK, (sal_Int16)awt::TextAlign::RIGHT},
+ {style::ParagraphAdjust_STRETCH, (sal_Int16)awt::TextAlign::LEFT},
+ {-1,-1}
+ };
+
+ static void lcl_mapFormToAPIValue( Any& _rValue, const EnumConversionMap* _pMap )
+ {
+ sal_Int16 nValue = sal_Int16();
+ OSL_VERIFY( _rValue >>= nValue );
+
+ const EnumConversionMap* pEntry = _pMap;
+ while ( pEntry && ( pEntry->nFormValue != -1 ) )
+ {
+ if ( nValue == pEntry->nFormValue )
+ {
+ _rValue <<= pEntry->nAPIValue;
+ return;
+ }
+ ++pEntry;
+ }
+ }
+
+ static void lcl_mapAPIToFormValue( Any& _rValue, const EnumConversionMap* _pMap )
+ {
+ sal_Int32 nValue = 0;
+ OSL_VERIFY( _rValue >>= nValue );
+
+ const EnumConversionMap* pEntry = _pMap;
+ while ( pEntry && ( pEntry->nAPIValue != -1 ) )
+ {
+ if ( nValue == pEntry->nAPIValue )
+ {
+ _rValue <<= pEntry->nFormValue;
+ return;
+ }
+ ++pEntry;
+ }
+ }
+
+ static void lcl_convertTextAlignmentToParaAdjustment( Any& rValue )
+ {
+ lcl_mapFormToAPIValue( rValue, aMapAdjustToAlign );
+ }
+
+ static void lcl_convertParaAdjustmentToTextAlignment( Any& rValue )
+ {
+ lcl_mapAPIToFormValue( rValue, aMapAdjustToAlign );
+ }
+
+ void convertVerticalAdjustToVerticalAlign( Any& _rValue ) SAL_THROW( ( lang::IllegalArgumentException ) )
+ {
+ if ( !_rValue.hasValue() )
+ return;
+
+ drawing::TextVerticalAdjust eAdjust = drawing::TextVerticalAdjust_TOP;
+ style::VerticalAlignment eAlign = style::VerticalAlignment_TOP;
+ if ( !( _rValue >>= eAdjust ) )
+ throw lang::IllegalArgumentException();
+ switch ( eAdjust )
+ {
+ case drawing::TextVerticalAdjust_TOP: eAlign = style::VerticalAlignment_TOP; break;
+ case drawing::TextVerticalAdjust_BOTTOM: eAlign = style::VerticalAlignment_BOTTOM; break;
+ default: eAlign = style::VerticalAlignment_MIDDLE; break;
+ }
+ _rValue <<= eAlign;
+ }
+
+ void convertVerticalAlignToVerticalAdjust( Any& _rValue )
+ {
+ if ( !_rValue.hasValue() )
+ return;
+ style::VerticalAlignment eAlign = style::VerticalAlignment_TOP;
+ drawing::TextVerticalAdjust eAdjust = drawing::TextVerticalAdjust_TOP;
+ OSL_VERIFY( _rValue >>= eAlign );
+ switch ( eAlign )
+ {
+ case style::VerticalAlignment_TOP: eAdjust = drawing::TextVerticalAdjust_TOP; break;
+ case style::VerticalAlignment_BOTTOM: eAdjust = drawing::TextVerticalAdjust_BOTTOM; break;
+ default: eAdjust = drawing::TextVerticalAdjust_CENTER; break;
+ }
+ _rValue <<= eAdjust;
+ }
+}
+
+void SAL_CALL SvxShapeControl::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, com::sun::star::beans::PropertyVetoException, com::sun::star::lang::IllegalArgumentException)
+{
+ OUString aFormsName;
+ if ( lcl_convertPropertyName( aPropertyName, aFormsName ) )
+ {
+ uno::Reference< beans::XPropertySet > xControl( getControl(), uno::UNO_QUERY );
+ if( xControl.is() )
+ {
+ uno::Reference< beans::XPropertySetInfo > xInfo( xControl->getPropertySetInfo() );
+ if( xInfo.is() && xInfo->hasPropertyByName( aFormsName ) )
+ {
+ uno::Any aConvertedValue( aValue );
+ if ( aFormsName.equalsAscii( "FontSlant" ) )
+ {
+ awt::FontSlant nSlant;
+ if( !(aValue >>= nSlant ) )
+ throw lang::IllegalArgumentException();
+ aConvertedValue <<= (sal_Int16)nSlant;
+ }
+ else if ( aFormsName.equalsAscii( "Align" ) )
+ {
+ lcl_convertParaAdjustmentToTextAlignment( aConvertedValue );
+ }
+ else if ( aFormsName.equalsAscii( "VerticalAlign" ) )
+ {
+ convertVerticalAdjustToVerticalAlign( aConvertedValue );
+ }
+
+ xControl->setPropertyValue( aFormsName, aConvertedValue );
+ }
+ }
+ }
+ else
+ {
+ SvxShape::setPropertyValue( aPropertyName, aValue );
+ }
+}
+
+uno::Any SAL_CALL SvxShapeControl::getPropertyValue( const OUString& aPropertyName )
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OUString aFormsName;
+ if ( lcl_convertPropertyName( aPropertyName, aFormsName ) )
+ {
+ uno::Reference< beans::XPropertySet > xControl( getControl(), uno::UNO_QUERY );
+
+ uno::Any aValue;
+ if( xControl.is() )
+ {
+ uno::Reference< beans::XPropertySetInfo > xInfo( xControl->getPropertySetInfo() );
+ if( xInfo.is() && xInfo->hasPropertyByName( aFormsName ) )
+ {
+ aValue = xControl->getPropertyValue( aFormsName );
+ if ( aFormsName.equalsAscii( "FontSlant" ) )
+ {
+ awt::FontSlant eSlant = awt::FontSlant_NONE;
+ sal_Int16 nSlant = sal_Int16();
+ if ( aValue >>= nSlant )
+ {
+ eSlant = (awt::FontSlant)nSlant;
+ }
+ else
+ {
+ OSL_VERIFY( aValue >>= eSlant );
+ }
+ aValue <<= eSlant;
+ }
+ else if ( aFormsName.equalsAscii( "Align" ) )
+ {
+ lcl_convertTextAlignmentToParaAdjustment( aValue );
+ }
+ else if ( aFormsName.equalsAscii( "VerticalAlign" ) )
+ {
+ convertVerticalAlignToVerticalAdjust( aValue );
+ }
+ }
+ }
+
+ return aValue;
+ }
+ else
+ {
+ return SvxShape::getPropertyValue( aPropertyName );
+ }
+
+}
+
+// XPropertyState
+beans::PropertyState SAL_CALL SvxShapeControl::getPropertyState( const ::rtl::OUString& PropertyName ) throw( beans::UnknownPropertyException, uno::RuntimeException )
+{
+ OUString aFormsName;
+ if ( lcl_convertPropertyName( PropertyName, aFormsName ) )
+ {
+ uno::Reference< beans::XPropertyState > xControl( getControl(), uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xPropSet( getControl(), uno::UNO_QUERY );
+
+ if( xControl.is() && xPropSet.is() )
+ {
+ uno::Reference< beans::XPropertySetInfo > xInfo( xPropSet->getPropertySetInfo() );
+ if( xInfo.is() && xInfo->hasPropertyByName( aFormsName ) )
+ {
+ return xControl->getPropertyState( aFormsName );
+ }
+ }
+
+ return beans::PropertyState_DEFAULT_VALUE;
+ }
+ else
+ {
+ return SvxShape::getPropertyState( PropertyName );
+ }
+}
+
+void SAL_CALL SvxShapeControl::setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw( beans::UnknownPropertyException, uno::RuntimeException )
+{
+ OUString aFormsName;
+ if ( lcl_convertPropertyName( PropertyName, aFormsName ) )
+ {
+ uno::Reference< beans::XPropertyState > xControl( getControl(), uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xPropSet( getControl(), uno::UNO_QUERY );
+
+ if( xControl.is() && xPropSet.is() )
+ {
+ uno::Reference< beans::XPropertySetInfo > xInfo( xPropSet->getPropertySetInfo() );
+ if( xInfo.is() && xInfo->hasPropertyByName( aFormsName ) )
+ {
+ xControl->setPropertyToDefault( aFormsName );
+ }
+ }
+ }
+ else
+ {
+ SvxShape::setPropertyToDefault( PropertyName );
+ }
+}
+
+uno::Any SAL_CALL SvxShapeControl::getPropertyDefault( const ::rtl::OUString& aPropertyName )
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ OUString aFormsName;
+ if ( lcl_convertPropertyName( aPropertyName, aFormsName ) )
+ {
+ uno::Reference< beans::XPropertyState > xControl( getControl(), uno::UNO_QUERY );
+
+ if( xControl.is() )
+ {
+ Any aDefault( xControl->getPropertyDefault( aFormsName ) );
+ if ( aFormsName.equalsAscii( "FontSlant" ) )
+ {
+ sal_Int16 nSlant( 0 );
+ aDefault >>= nSlant;
+ aDefault <<= (awt::FontSlant)nSlant;
+ }
+ else if ( aFormsName.equalsAscii( "Align" ) )
+ {
+ lcl_convertTextAlignmentToParaAdjustment( aDefault );
+ }
+ else if ( aFormsName.equalsAscii( "VerticalAlign" ) )
+ {
+ convertVerticalAlignToVerticalAdjust( aDefault );
+ }
+ return aDefault;
+ }
+
+ throw beans::UnknownPropertyException();
+ }
+ else
+ {
+ return SvxShape::getPropertyDefault( aPropertyName );
+ }
+}
+
+
+/***********************************************************************
+* class SvxShapeDimensioning *
+***********************************************************************/
+
+//----------------------------------------------------------------------
+SvxShapeDimensioning::SvxShapeDimensioning( SdrObject* pObj ) throw()
+: SvxShapeText( pObj, aSvxMapProvider.GetMap(SVXMAP_DIMENSIONING), aSvxMapProvider.GetPropertySet(SVXMAP_DIMENSIONING, SdrObject::GetGlobalDrawObjectItemPool()) )
+{
+}
+
+//----------------------------------------------------------------------
+SvxShapeDimensioning::~SvxShapeDimensioning() throw()
+{
+}
+
+// ::com::sun::star::lang::XServiceInfo
+uno::Sequence< OUString > SAL_CALL SvxShapeDimensioning::getSupportedServiceNames() throw( uno::RuntimeException )
+{
+ return SvxShapeText::getSupportedServiceNames();
+}
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+//----------------------------------------------------------------------
+SvxShapeCircle::SvxShapeCircle( SdrObject* pObj ) throw()
+: SvxShapeText( pObj, aSvxMapProvider.GetMap(SVXMAP_CIRCLE), aSvxMapProvider.GetPropertySet(SVXMAP_CIRCLE, SdrObject::GetGlobalDrawObjectItemPool()) )
+{
+}
+
+//----------------------------------------------------------------------
+SvxShapeCircle::~SvxShapeCircle() throw()
+{
+}
+
+// ::com::sun::star::lang::XServiceInfo
+// XServiceInfo
+uno::Sequence< OUString > SAL_CALL SvxShapeCircle::getSupportedServiceNames() throw( uno::RuntimeException )
+{
+ return SvxShapeText::getSupportedServiceNames();
+}
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+#include <svx/svdopath.hxx>
+
+//----------------------------------------------------------------------
+SvxShapePolyPolygon::SvxShapePolyPolygon( SdrObject* pObj , drawing::PolygonKind eNew )
+ throw( com::sun::star::beans::PropertyVetoException, com::sun::star::lang::IllegalArgumentException)
+: SvxShapeText( pObj, aSvxMapProvider.GetMap(SVXMAP_POLYPOLYGON), aSvxMapProvider.GetPropertySet(SVXMAP_POLYPOLYGON, SdrObject::GetGlobalDrawObjectItemPool()) )
+, mePolygonKind( eNew )
+{
+}
+
+//----------------------------------------------------------------------
+SvxShapePolyPolygon::~SvxShapePolyPolygon() throw()
+{
+}
+
+basegfx::B2DPolyPolygon SAL_CALL ImplSvxPointSequenceSequenceToB2DPolyPolygon( const drawing::PointSequenceSequence* pOuterSequence) throw()
+{
+ basegfx::B2DPolyPolygon aRetval;
+
+ // Zeiger auf innere sequences holen
+ const drawing::PointSequence* pInnerSequence = pOuterSequence->getConstArray();
+ const drawing::PointSequence* pInnerSeqEnd = pInnerSequence + pOuterSequence->getLength();
+
+ for(;pInnerSequence != pInnerSeqEnd; ++pInnerSequence)
+ {
+ // Neues Polygon vorbereiten
+ basegfx::B2DPolygon aNewPolygon;
+
+ // Zeiger auf Arrays holen
+ const awt::Point* pArray = pInnerSequence->getConstArray();
+ const awt::Point* pArrayEnd = pArray + pInnerSequence->getLength();
+
+ for(;pArray != pArrayEnd;++pArray)
+ {
+ aNewPolygon.append(basegfx::B2DPoint(pArray->X, pArray->Y));
+ }
+
+ // check for closed state flag
+ basegfx::tools::checkClosed(aNewPolygon);
+
+ // Neues Teilpolygon einfuegen
+ aRetval.append(aNewPolygon);
+ }
+
+ return aRetval;
+}
+
+//----------------------------------------------------------------------
+
+bool SvxShapePolyPolygon::setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ switch( pProperty->nWID )
+ {
+ case OWN_ATTR_VALUE_POLYPOLYGON:
+ {
+ if( rValue.getValue() && (rValue.getValueType() == ::getCppuType(( const drawing::PointSequenceSequence*)0) ) )
+ {
+ basegfx::B2DPolyPolygon aNewPolyPolygon(ImplSvxPointSequenceSequenceToB2DPolyPolygon( (drawing::PointSequenceSequence*)rValue.getValue()));
+ SetPolygon(aNewPolyPolygon);
+ return true;
+ }
+ break;
+ }
+ case OWN_ATTR_BASE_GEOMETRY:
+ {
+ if( rValue.getValue() && (rValue.getValueType() == ::getCppuType(( const drawing::PointSequenceSequence*)0)))
+ {
+ if( mpObj.is() )
+ {
+ basegfx::B2DPolyPolygon aNewPolyPolygon;
+ basegfx::B2DHomMatrix aNewHomogenMatrix;
+
+ mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
+ aNewPolyPolygon = ImplSvxPointSequenceSequenceToB2DPolyPolygon((drawing::PointSequenceSequence*)rValue.getValue());
+ mpObj->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
+ }
+ return true;
+ }
+ break;
+ }
+ case OWN_ATTR_VALUE_POLYGON:
+ {
+ if( rValue.getValue() && (rValue.getValueType() == ::getCppuType(( const drawing::PointSequenceSequence*)0) ))
+ {
+ drawing::PointSequence* pSequence = (drawing::PointSequence*)rValue.getValue();
+
+ // Neues Polygon vorbereiten
+ basegfx::B2DPolygon aNewPolygon;
+
+ // Zeiger auf Arrays holen
+ // Zeiger auf Arrays holen
+ const awt::Point* pArray = pSequence->getConstArray();
+ const awt::Point* pArrayEnd = pArray + pSequence->getLength();
+
+ for(;pArray != pArrayEnd;++pArray)
+ {
+ aNewPolygon.append(basegfx::B2DPoint(pArray->X, pArray->Y));
+ }
+
+ // check for closed state flag
+ basegfx::tools::checkClosed(aNewPolygon);
+
+ // Polygon setzen
+ SetPolygon(basegfx::B2DPolyPolygon(aNewPolygon));
+ return true;
+ }
+ break;
+ }
+ default:
+ return SvxShapeText::setPropertyValueImpl( rName, pProperty, rValue );
+ }
+
+ throw lang::IllegalArgumentException();
+}
+
+void SAL_CALL B2DPolyPolygonToSvxPointSequenceSequence( const basegfx::B2DPolyPolygon& rPolyPoly, drawing::PointSequenceSequence& rRetval )
+{
+ if( (sal_uInt32)rRetval.getLength() != rPolyPoly.count() )
+ rRetval.realloc( rPolyPoly.count() );
+
+ // Zeiger auf aeussere Arrays holen
+ drawing::PointSequence* pOuterSequence = rRetval.getArray();
+
+ for(sal_uInt32 a(0L); a < rPolyPoly.count(); a++)
+ {
+ // Einzelpolygon holen
+ const basegfx::B2DPolygon aPoly(rPolyPoly.getB2DPolygon(a));
+
+ // #i75974# take closed stae into account, the API polygon still uses the old closed definition
+ // with last/first point are identical (cannot hold information about open polygons with identical
+ // first and last point, though)
+ const sal_uInt32 nPointCount(aPoly.count());
+ const bool bIsClosed(aPoly.isClosed());
+
+ // Platz in Arrays schaffen
+ pOuterSequence->realloc(bIsClosed ? nPointCount + 1 : nPointCount);
+
+ // Pointer auf arrays holen
+ awt::Point* pInnerSequence = pOuterSequence->getArray();
+
+ for(sal_uInt32 b(0L); b < nPointCount; b++)
+ {
+ const basegfx::B2DPoint aPoint(aPoly.getB2DPoint(b));
+ *pInnerSequence = awt::Point( basegfx::fround(aPoint.getX()), basegfx::fround(aPoint.getY()) );
+ pInnerSequence++;
+ }
+
+ // #i75974# copy first point
+ if(bIsClosed)
+ {
+ *pInnerSequence = *pOuterSequence->getArray();
+ }
+
+ pOuterSequence++;
+ }
+}
+
+//----------------------------------------------------------------------
+
+bool SvxShapePolyPolygon::getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ switch( pProperty->nWID )
+ {
+ case OWN_ATTR_VALUE_POLYPOLYGON:
+ {
+ // PolyPolygon in eine struct PolyPolygon packen
+ const basegfx::B2DPolyPolygon& rPolyPoly = GetPolygon();
+ drawing::PointSequenceSequence aRetval( rPolyPoly.count() );
+
+ B2DPolyPolygonToSvxPointSequenceSequence( rPolyPoly, aRetval );
+
+ rValue <<= aRetval;
+ break;
+ }
+ case OWN_ATTR_BASE_GEOMETRY:
+ {
+ // pack a PolyPolygon in struct PolyPolygon
+ basegfx::B2DPolyPolygon aNewPolyPolygon;
+ basegfx::B2DHomMatrix aNewHomogenMatrix;
+
+ if(mpObj.is())
+ mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
+
+ drawing::PointSequenceSequence aRetval(aNewPolyPolygon.count());
+ B2DPolyPolygonToSvxPointSequenceSequence(aNewPolyPolygon, aRetval);
+ rValue <<= aRetval;
+ break;
+ }
+ case OWN_ATTR_VALUE_POLYGON:
+ {
+ // PolyPolygon in eine struct PolyPolygon packen
+ const basegfx::B2DPolyPolygon& rPolyPoly = GetPolygon();
+
+ sal_Int32 nCount = 0;
+ if( rPolyPoly.count() > 0 )
+ nCount = rPolyPoly.getB2DPolygon(0L).count();
+
+ drawing::PointSequence aRetval( nCount );
+
+ if( nCount > 0 )
+ {
+ // Einzelpolygon holen
+ const basegfx::B2DPolygon aPoly(rPolyPoly.getB2DPolygon(0L));
+
+ // Pointer auf arrays holen
+ awt::Point* pSequence = aRetval.getArray();
+
+ for(sal_Int32 b=0;b<nCount;b++)
+ {
+ const basegfx::B2DPoint aPoint(aPoly.getB2DPoint(b));
+ *pSequence++ = awt::Point( basegfx::fround(aPoint.getX()), basegfx::fround(aPoint.getY()) );
+ }
+ }
+
+ rValue <<= aRetval;
+ break;
+ }
+ case OWN_ATTR_VALUE_POLYGONKIND:
+ {
+ rValue <<= GetPolygonKind();
+ break;
+ }
+ default:
+ return SvxShapeText::getPropertyValueImpl( rName, pProperty, rValue );
+ }
+
+ return true;
+}
+
+//----------------------------------------------------------------------
+drawing::PolygonKind SvxShapePolyPolygon::GetPolygonKind() const throw()
+{
+ return mePolygonKind;
+}
+
+//----------------------------------------------------------------------
+void SvxShapePolyPolygon::SetPolygon(const basegfx::B2DPolyPolygon& rNew) throw()
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if(mpObj.is())
+ ((SdrPathObj*)mpObj.get())->SetPathPoly(rNew);
+}
+
+//----------------------------------------------------------------------
+basegfx::B2DPolyPolygon SvxShapePolyPolygon::GetPolygon() const throw()
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if(mpObj.is())
+ {
+ return ((SdrPathObj*)mpObj.get())->GetPathPoly();
+ }
+ else
+ {
+ return basegfx::B2DPolyPolygon();
+ }
+}
+
+// ::com::sun::star::lang::XServiceInfo
+uno::Sequence< OUString > SAL_CALL SvxShapePolyPolygon::getSupportedServiceNames() throw( uno::RuntimeException )
+{
+ return SvxShapeText::getSupportedServiceNames();
+}
+
+/***********************************************************************
+* class SvxShapePolyPolygonBezier *
+***********************************************************************/
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/drawing/FlagSequence.hpp>
+//----------------------------------------------------------------------
+SvxShapePolyPolygonBezier::SvxShapePolyPolygonBezier( SdrObject* pObj , drawing::PolygonKind eNew ) throw()
+: SvxShapeText( pObj, aSvxMapProvider.GetMap(SVXMAP_POLYPOLYGONBEZIER), aSvxMapProvider.GetPropertySet(SVXMAP_POLYPOLYGONBEZIER, SdrObject::GetGlobalDrawObjectItemPool()) )
+, mePolygonKind( eNew )
+{
+}
+
+//----------------------------------------------------------------------
+SvxShapePolyPolygonBezier::~SvxShapePolyPolygonBezier() throw()
+{
+}
+
+basegfx::B2DPolyPolygon SvxConvertPolyPolygonBezierToB2DPolyPolygon(const drawing::PolyPolygonBezierCoords* pSourcePolyPolygon)
+ throw( IllegalArgumentException )
+{
+ const sal_Int32 nOuterSequenceCount(pSourcePolyPolygon->Coordinates.getLength());
+ basegfx::B2DPolyPolygon aNewPolyPolygon;
+
+ if(pSourcePolyPolygon->Flags.getLength() != nOuterSequenceCount)
+ {
+ throw IllegalArgumentException();
+ }
+
+ // get pointers to inner sequence
+ const drawing::PointSequence* pInnerSequence = pSourcePolyPolygon->Coordinates.getConstArray();
+ const drawing::FlagSequence* pInnerSequenceFlags = pSourcePolyPolygon->Flags.getConstArray();
+
+ for(sal_Int32 a(0); a < nOuterSequenceCount; a++)
+ {
+ const sal_Int32 nInnerSequenceCount(pInnerSequence->getLength());
+
+ if(pInnerSequenceFlags->getLength() != nInnerSequenceCount)
+ {
+ throw IllegalArgumentException();
+ }
+
+ // prepare new polygon
+ basegfx::B2DPolygon aNewPolygon;
+ const awt::Point* pArray = pInnerSequence->getConstArray();
+ const drawing::PolygonFlags* pArrayFlags = pInnerSequenceFlags->getConstArray();
+
+ // get first point and flag
+ basegfx::B2DPoint aNewCoordinatePair(pArray->X, pArray->Y); pArray++;
+ XPolyFlags ePolyFlag((XPolyFlags)((sal_uInt16)*pArrayFlags)); pArrayFlags++;
+ basegfx::B2DPoint aControlA;
+ basegfx::B2DPoint aControlB;
+
+ // first point is not allowed to be a control point
+ if(XPOLY_CONTROL == ePolyFlag)
+ {
+ throw IllegalArgumentException();
+ }
+
+ // add first point as start point
+ aNewPolygon.append(aNewCoordinatePair);
+
+ for(sal_Int32 b(1); b < nInnerSequenceCount;)
+ {
+ // prepare loop
+ bool bControlA(false);
+ bool bControlB(false);
+
+ // get next point and flag
+ aNewCoordinatePair = basegfx::B2DPoint(pArray->X, pArray->Y);
+ ePolyFlag = XPolyFlags((XPolyFlags)((sal_uInt16)*pArrayFlags));
+ pArray++; pArrayFlags++; b++;
+
+ if(b < nInnerSequenceCount && XPOLY_CONTROL == ePolyFlag)
+ {
+ aControlA = aNewCoordinatePair;
+ bControlA = true;
+
+ // get next point and flag
+ aNewCoordinatePair = basegfx::B2DPoint(pArray->X, pArray->Y);
+ ePolyFlag = XPolyFlags((XPolyFlags)((sal_uInt16)*pArrayFlags));
+ pArray++; pArrayFlags++; b++;
+ }
+
+ if(b < nInnerSequenceCount && XPOLY_CONTROL == ePolyFlag)
+ {
+ aControlB = aNewCoordinatePair;
+ bControlB = true;
+
+ // get next point and flag
+ aNewCoordinatePair = basegfx::B2DPoint(pArray->X, pArray->Y);
+ ePolyFlag = XPolyFlags((XPolyFlags)((sal_uInt16)*pArrayFlags));
+ pArray++; pArrayFlags++; b++;
+ }
+
+ // two or no control points are consumed, another one would be an error.
+ // It's also an error if only one control point was read
+ if(XPOLY_CONTROL == ePolyFlag || bControlA != bControlB)
+ {
+ throw IllegalArgumentException();
+ }
+
+ // the previous writes used the B2DPolyPoygon -> PolyPolygon converter
+ // which did not create minimal PolyPolygons, but created all control points
+ // as null vectors (identical points). Because of the former P(CA)(CB)-norm of
+ // B2DPolygon and it's unused sign of being the zero-vector and CA and CB being
+ // relative to P, an empty edge was exported as P == CA == CB. Luckily, the new
+ // export format can be read without errors by the old OOo-versions, so we need only
+ // to correct here at read and do not need to export a wrong but compatible version
+ // for the future.
+ if(bControlA
+ && aControlA.equal(aControlB)
+ && aControlA.equal(aNewPolygon.getB2DPoint(aNewPolygon.count() - 1)))
+ {
+ bControlA = bControlB = false;
+ }
+
+ if(bControlA)
+ {
+ // add bezier edge
+ aNewPolygon.appendBezierSegment(aControlA, aControlB, aNewCoordinatePair);
+ }
+ else
+ {
+ // add edge
+ aNewPolygon.append(aNewCoordinatePair);
+ }
+ }
+
+ // next sequence
+ pInnerSequence++;
+ pInnerSequenceFlags++;
+
+ // #i72807# API import uses old line start/end-equal definition for closed,
+ // so we need to correct this to closed state here
+ basegfx::tools::checkClosed(aNewPolygon);
+
+ // add new subpolygon
+ aNewPolyPolygon.append(aNewPolygon);
+ }
+
+ return aNewPolyPolygon;
+}
+
+//----------------------------------------------------------------------
+
+bool SvxShapePolyPolygonBezier::setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ switch( pProperty->nWID )
+ {
+ case OWN_ATTR_VALUE_POLYPOLYGONBEZIER:
+ {
+ if( rValue.getValue() && (rValue.getValueType() == ::getCppuType(( const drawing::PolyPolygonBezierCoords*)0) ) )
+ {
+ basegfx::B2DPolyPolygon aNewPolyPolygon(SvxConvertPolyPolygonBezierToB2DPolyPolygon( (drawing::PolyPolygonBezierCoords*)rValue.getValue()));
+ SetPolygon(aNewPolyPolygon);
+ return true;
+ }
+ break;
+ }
+ case OWN_ATTR_BASE_GEOMETRY:
+ {
+ if( rValue.getValue() && (rValue.getValueType() == ::getCppuType(( const drawing::PolyPolygonBezierCoords*)0)) )
+ {
+ if( mpObj.is() )
+ {
+ basegfx::B2DPolyPolygon aNewPolyPolygon;
+ basegfx::B2DHomMatrix aNewHomogenMatrix;
+
+ mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
+ aNewPolyPolygon = SvxConvertPolyPolygonBezierToB2DPolyPolygon((drawing::PolyPolygonBezierCoords*)rValue.getValue());
+ mpObj->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
+ }
+ return true;
+ }
+ break;
+ }
+ default:
+ return SvxShapeText::setPropertyValueImpl( rName, pProperty, rValue );
+ }
+
+ throw IllegalArgumentException();
+}
+
+void SvxConvertB2DPolyPolygonToPolyPolygonBezier( const basegfx::B2DPolyPolygon& rPolyPoly, drawing::PolyPolygonBezierCoords& rRetval )
+{
+ // use PolyPolygon converter as base. Since PolyPolygonBezierCoords uses
+ // integer coordinates, this is no precision loss at all.
+ const PolyPolygon aPolyPoly(rPolyPoly);
+
+ // Polygone innerhalb vrobereiten
+ rRetval.Coordinates.realloc((sal_Int32)aPolyPoly.Count());
+ rRetval.Flags.realloc((sal_Int32)aPolyPoly.Count());
+
+ // Zeiger auf aeussere Arrays holen
+ drawing::PointSequence* pOuterSequence = rRetval.Coordinates.getArray();
+ drawing::FlagSequence* pOuterFlags = rRetval.Flags.getArray();
+
+ for(sal_uInt16 a=0;a<aPolyPoly.Count();a++)
+ {
+ // Einzelpolygon holen
+ const Polygon& rPoly = aPolyPoly[a];
+
+ // Platz in Arrays schaffen
+ pOuterSequence->realloc((sal_Int32)rPoly.GetSize());
+ pOuterFlags->realloc((sal_Int32)rPoly.GetSize());
+
+ // Pointer auf arrays holen
+ awt::Point* pInnerSequence = pOuterSequence->getArray();
+ drawing::PolygonFlags* pInnerFlags = pOuterFlags->getArray();
+
+ for(sal_uInt16 b=0;b<rPoly.GetSize();b++)
+ {
+ *pInnerSequence++ = awt::Point( rPoly[b].X(), rPoly[b].Y() );
+ *pInnerFlags++ = (drawing::PolygonFlags)((sal_uInt16)rPoly.GetFlags(b));
+ }
+
+ pOuterSequence++;
+ pOuterFlags++;
+ }
+}
+
+//----------------------------------------------------------------------
+
+bool SvxShapePolyPolygonBezier::getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ switch( pProperty->nWID )
+ {
+ case OWN_ATTR_VALUE_POLYPOLYGONBEZIER:
+ {
+ // PolyPolygon in eine struct PolyPolygon packen
+ const basegfx::B2DPolyPolygon& rPolyPoly = GetPolygon();
+ drawing::PolyPolygonBezierCoords aRetval;
+ SvxConvertB2DPolyPolygonToPolyPolygonBezier(rPolyPoly, aRetval );
+
+ rValue <<= aRetval;
+ break;
+ }
+ case OWN_ATTR_BASE_GEOMETRY:
+ {
+ // PolyPolygon in eine struct PolyPolygon packen
+ basegfx::B2DPolyPolygon aNewPolyPolygon;
+ basegfx::B2DHomMatrix aNewHomogenMatrix;
+ mpObj.get()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
+ drawing::PolyPolygonBezierCoords aRetval;
+ SvxConvertB2DPolyPolygonToPolyPolygonBezier(aNewPolyPolygon, aRetval);
+
+ rValue <<= aRetval;
+ break;
+ }
+ case OWN_ATTR_VALUE_POLYGONKIND:
+ {
+ rValue <<= mePolygonKind;
+ break;
+ }
+ default:
+ return SvxShapeText::getPropertyValueImpl( rName, pProperty, rValue );
+ }
+ return true;
+}
+
+//----------------------------------------------------------------------
+drawing::PolygonKind SvxShapePolyPolygonBezier::GetPolygonKind() const throw()
+{
+ return mePolygonKind;
+}
+
+//----------------------------------------------------------------------
+void SvxShapePolyPolygonBezier::SetPolygon(const basegfx::B2DPolyPolygon& rNew) throw()
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if(mpObj.is())
+ static_cast<SdrPathObj*>(mpObj.get())->SetPathPoly(rNew);
+}
+
+//----------------------------------------------------------------------
+basegfx::B2DPolyPolygon SvxShapePolyPolygonBezier::GetPolygon() const throw()
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if(mpObj.is())
+ {
+ return static_cast<SdrPathObj*>(mpObj.get())->GetPathPoly();
+ }
+ else
+ {
+ return basegfx::B2DPolyPolygon();
+ }
+}
+
+
+// ::com::sun::star::lang::XServiceInfo
+uno::Sequence< OUString > SAL_CALL SvxShapePolyPolygonBezier::getSupportedServiceNames() throw( uno::RuntimeException )
+{
+ return SvxShapeText::getSupportedServiceNames();
+}
+
+/***********************************************************************
+* class SvxGraphicObject *
+***********************************************************************/
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <vcl/cvtgrf.hxx>
+#include <svx/svdograf.hxx>
+#ifndef SVX_LIGHT
+#ifndef _SFXDOCFILE_HXX
+#include <sfx2/docfile.hxx>
+#endif
+#include <sfx2/app.hxx>
+#include <sfx2/fcontnr.hxx>
+#endif
+
+#include "toolkit/unohlp.hxx"
+
+//----------------------------------------------------------------------
+SvxGraphicObject::SvxGraphicObject( SdrObject* pObj ) throw()
+: SvxShapeText( pObj, aSvxMapProvider.GetMap(SVXMAP_GRAPHICOBJECT), aSvxMapProvider.GetPropertySet(SVXMAP_GRAPHICOBJECT, SdrObject::GetGlobalDrawObjectItemPool()) )
+{
+}
+
+//----------------------------------------------------------------------
+SvxGraphicObject::~SvxGraphicObject() throw()
+{
+}
+
+//----------------------------------------------------------------------
+
+bool SvxGraphicObject::setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ bool bOk = false;
+ switch( pProperty->nWID )
+ {
+ case OWN_ATTR_VALUE_FILLBITMAP:
+ {
+ if( rValue.getValue() )
+ {
+ if( rValue.getValueType() == ::getCppuType(( const uno::Sequence< sal_Int8 >*)0) )
+ {
+ uno::Sequence<sal_Int8>* pSeq( (uno::Sequence<sal_Int8>*)rValue.getValue() );
+ SvMemoryStream aMemStm;
+ Graphic aGraphic;
+
+ aMemStm.SetBuffer( (char*)pSeq->getConstArray(), pSeq->getLength(), sal_False, pSeq->getLength() );
+
+ if( GraphicConverter::Import( aMemStm, aGraphic ) == ERRCODE_NONE )
+ {
+ static_cast<SdrGrafObj*>(mpObj.get())->SetGraphic(aGraphic);
+ bOk = true;
+ }
+ }
+ }
+ else if( (rValue.getValueType() == awt::XBitmap::static_type()) || (rValue.getValueType() == graphic::XGraphic::static_type()))
+ {
+ Reference< graphic::XGraphic> xGraphic( rValue, UNO_QUERY );
+ if( xGraphic.is() )
+ {
+ ((SdrGrafObj*)mpObj.get())->SetGraphic(Graphic(xGraphic));
+ bOk = true;
+ }
+ else
+ {
+ // Bitmap in das Objekt packen
+ Reference< awt::XBitmap > xBmp( rValue, UNO_QUERY );
+ if( xBmp.is() )
+ {
+ // Bitmap einsetzen
+ Graphic aGraphic(VCLUnoHelper::GetBitmap( xBmp ));
+ ((SdrGrafObj*)mpObj.get())->SetGraphic(aGraphic);
+ bOk = true;
+ }
+ }
+ }
+ break;
+ }
+ case OWN_ATTR_GRAFURL:
+ {
+ OUString aURL;
+ if( rValue >>= aURL )
+ {
+ if( aURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) == 0 )
+ {
+ // graphic manager url
+ aURL = aURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 );
+ String aTmpStr(aURL);
+ ByteString aUniqueID( aTmpStr, RTL_TEXTENCODING_UTF8 );
+ GraphicObject aGrafObj( aUniqueID );
+
+ // #101808# since loading a graphic can cause a reschedule of the office
+ // it is possible that our shape is removed while where in this
+ // method.
+ if( mpObj.is() )
+ {
+ static_cast<SdrGrafObj*>(mpObj.get())->ReleaseGraphicLink();
+ static_cast<SdrGrafObj*>(mpObj.get())->SetGraphicObject( aGrafObj );
+ }
+ }
+ else if( aURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPKGPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPKGPREFIX ) ) != 0 )
+ {
+ // normal link
+ String aFilterName;
+ const SfxFilter* pSfxFilter = NULL;
+ SfxMedium aSfxMedium( aURL, STREAM_READ | STREAM_SHARE_DENYNONE, sal_False );
+
+ SFX_APP()->GetFilterMatcher().GuessFilter( aSfxMedium, &pSfxFilter, SFX_FILTER_IMPORT, SFX_FILTER_NOTINSTALLED | SFX_FILTER_EXECUTABLE );
+
+ if( !pSfxFilter )
+ {
+ INetURLObject aURLObj( aURL );
+
+ if( aURLObj.GetProtocol() == INET_PROT_NOT_VALID )
+ {
+ String aValidURL;
+
+ if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aURL, aValidURL ) )
+ aURLObj = INetURLObject( aValidURL );
+ }
+
+ if( aURLObj.GetProtocol() != INET_PROT_NOT_VALID )
+ {
+ GraphicFilter* pGrfFilter = GraphicFilter::GetGraphicFilter();
+ aFilterName = pGrfFilter->GetImportFormatName( pGrfFilter->GetImportFormatNumberForShortName( aURLObj.getExtension() ) );
+ }
+ }
+ else
+ aFilterName = pSfxFilter->GetFilterName();
+
+ // #101808# since loading a graphic can cause a reschedule of the office
+ // it is possible that our shape is removed while where in this
+ // method.
+ if( mpObj.is() )
+ static_cast<SdrGrafObj*>(mpObj.get())->SetGraphicLink( aURL, aFilterName );
+
+ }
+ bOk = true;
+ }
+ break;
+ }
+
+ case OWN_ATTR_GRAFSTREAMURL:
+ {
+ OUString aStreamURL;
+
+ if( rValue >>= aStreamURL )
+ {
+ if( aStreamURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPKGPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPKGPREFIX ) ) != 0 )
+ aStreamURL = OUString();
+
+ if( mpObj.is() )
+ {
+ static_cast<SdrGrafObj*>(mpObj.get())->SetGrafStreamURL( aStreamURL );
+ static_cast<SdrGrafObj*>(mpObj.get())->ForceSwapOut();
+ }
+ bOk = true;
+ }
+ break;
+ }
+
+ case OWN_ATTR_VALUE_GRAPHIC:
+ {
+ Reference< graphic::XGraphic > xGraphic( rValue, uno::UNO_QUERY );
+ if( xGraphic.is() )
+ {
+ static_cast< SdrGrafObj*>( mpObj.get() )->SetGraphic( xGraphic );
+ bOk = true;
+ }
+ break;
+ }
+ default:
+ return SvxShapeText::setPropertyValueImpl( rName, pProperty, rValue );
+ }
+
+ if( !bOk )
+ throw lang::IllegalArgumentException();
+
+ if( mpModel )
+ mpModel->SetChanged();
+
+ return true;
+}
+
+//----------------------------------------------------------------------
+
+bool SvxGraphicObject::getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ switch( pProperty->nWID )
+ {
+ case OWN_ATTR_VALUE_FILLBITMAP:
+ {
+ sal_Bool bSwapped = static_cast< SdrGrafObj* >( mpObj.get() )->IsSwappedOut();
+ const Graphic& rGraphic = static_cast< SdrGrafObj*>( mpObj.get() )->GetGraphic();
+
+ if(rGraphic.GetType() != GRAPHIC_GDIMETAFILE)
+ {
+ // Objekt in eine Bitmap packen
+ Reference< ::com::sun::star::awt::XBitmap > xBitmap( VCLUnoHelper::CreateBitmap(static_cast< SdrGrafObj*>( mpObj.get() )->GetGraphic().GetBitmapEx()) );
+ rValue <<= xBitmap;
+ }
+ else
+ {
+ SvMemoryStream aDestStrm( 65535, 65535 );
+
+ ConvertGDIMetaFileToWMF( rGraphic.GetGDIMetaFile(), aDestStrm, NULL, sal_False );
+ const uno::Sequence<sal_Int8> aSeq(
+ static_cast< const sal_Int8* >(aDestStrm.GetData()),
+ aDestStrm.GetEndOfData());
+ rValue <<= aSeq;
+ }
+ if ( bSwapped )
+ static_cast< SdrGrafObj* >( mpObj.get() )->ForceSwapOut();
+ break;
+ }
+
+ case OWN_ATTR_GRAFURL:
+ {
+ if( static_cast< SdrGrafObj*>( mpObj.get() )->IsLinkedGraphic() )
+ {
+ rValue <<= OUString( static_cast< SdrGrafObj*>( mpObj.get() )->GetFileName() );
+ }
+ else
+ {
+ sal_Bool bSwapped = static_cast< SdrGrafObj* >( mpObj.get() )->IsSwappedOut();
+ const GraphicObject& rGrafObj = static_cast< SdrGrafObj*>( mpObj.get() )->GetGraphicObject(true);
+ OUString aURL( RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX));
+ aURL += OUString::createFromAscii( rGrafObj.GetUniqueID().GetBuffer() );
+ rValue <<= aURL;
+ if ( bSwapped )
+ static_cast< SdrGrafObj* >( mpObj.get() )->ForceSwapOut();
+ }
+ break;
+ }
+
+ case OWN_ATTR_GRAFSTREAMURL:
+ {
+ const OUString aStreamURL( ( (SdrGrafObj*) mpObj.get() )->GetGrafStreamURL() );
+ if( aStreamURL.getLength() )
+ rValue <<= aStreamURL;
+ break;
+ }
+
+ case OWN_ATTR_VALUE_GRAPHIC:
+ {
+ sal_Bool bSwapped = static_cast< SdrGrafObj* >( mpObj.get() )->IsSwappedOut();
+ Reference< graphic::XGraphic > xGraphic( static_cast< SdrGrafObj* >( mpObj.get() )->GetGraphic().GetXGraphic() );
+ rValue <<= xGraphic;
+ if ( bSwapped )
+ static_cast< SdrGrafObj* >( mpObj.get() )->ForceSwapOut();
+ break;
+ }
+
+ case OWN_ATTR_GRAPHIC_STREAM:
+ {
+ rValue <<= static_cast< SdrGrafObj* >( mpObj.get() )->getInputStream();
+ break;
+ }
+ default:
+ return SvxShapeText::getPropertyValueImpl(rName, pProperty,rValue);
+ }
+
+ return true;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+SvxShapeCaption::SvxShapeCaption( SdrObject* pObj ) throw()
+: SvxShapeText( pObj, aSvxMapProvider.GetMap(SVXMAP_CAPTION), aSvxMapProvider.GetPropertySet(SVXMAP_CAPTION, SdrObject::GetGlobalDrawObjectItemPool()) )
+{
+}
+
+SvxShapeCaption::~SvxShapeCaption() throw()
+{
+}
+
+/***********************************************************************
+* class SvxCustomShape *
+***********************************************************************/
+
+SvxCustomShape::SvxCustomShape( SdrObject* pObj ) throw() :
+ SvxShapeText( pObj, aSvxMapProvider.GetMap( SVXMAP_CUSTOMSHAPE ), aSvxMapProvider.GetPropertySet(SVXMAP_CUSTOMSHAPE, SdrObject::GetGlobalDrawObjectItemPool()) )
+{
+}
+
+//----------------------------------------------------------------------
+SvxCustomShape::~SvxCustomShape() throw()
+{
+}
+
+//----------------------------------------------------------------------
+
+void SvxCustomShape::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage )
+{
+ SvxShapeText::Create( pNewObj, pNewPage );
+}
+
+//----------------------------------------------------------------------
+
+uno::Any SAL_CALL SvxCustomShape::queryInterface( const uno::Type & rType )
+ throw(uno::RuntimeException)
+{
+ return SvxShapeText::queryInterface( rType );
+}
+
+uno::Any SAL_CALL SvxCustomShape::queryAggregation( const uno::Type & rType )
+ throw(uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aReturn = SvxShapeText::queryAggregation( rType );
+ if ( !aReturn.hasValue() )
+ aReturn = ::cppu::queryInterface(rType, static_cast<drawing::XEnhancedCustomShapeDefaulter*>(this) );
+ return aReturn;
+}
+
+void SAL_CALL SvxCustomShape::acquire() throw ( )
+{
+ SvxShapeText::acquire();
+}
+
+void SAL_CALL SvxCustomShape::release() throw ( )
+{
+ SvxShapeText::release();
+}
+
+//----------------------------------------------------------------------
+
+uno::Sequence< uno::Type > SAL_CALL SvxCustomShape::getTypes()
+ throw (uno::RuntimeException)
+{
+ return SvxShapeText::getTypes();
+}
+
+uno::Sequence< sal_Int8 > SAL_CALL SvxCustomShape::getImplementationId()
+ throw (uno::RuntimeException)
+{
+ static uno::Sequence< sal_Int8 > aId;
+ if( aId.getLength() == 0 )
+ {
+ aId.realloc( 16 );
+ rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
+ }
+ return aId;
+}
+
+// ::com::sun::star::drawing::XShape
+
+//----------------------------------------------------------------------
+OUString SAL_CALL SvxCustomShape::getShapeType()
+ throw( uno::RuntimeException )
+{
+ return SvxShape::getShapeType();
+}
+
+//------------------------------------------------------------------1----
+awt::Point SAL_CALL SvxCustomShape::getPosition() throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ if ( mpModel && mpObj.is() )
+ {
+ SdrAShapeObjGeoData aCustomShapeGeoData;
+ ((SdrObjCustomShape*)mpObj.get())->SaveGeoData( aCustomShapeGeoData );
+
+ sal_Bool bMirroredX = sal_False;
+ sal_Bool bMirroredY = sal_False;
+
+ if ( mpObj.is() )
+ {
+ bMirroredX = ( ((SdrObjCustomShape*)mpObj.get())->IsMirroredX() );
+ bMirroredY = ( ((SdrObjCustomShape*)mpObj.get())->IsMirroredY() );
+ }
+ // get aRect, this is the unrotated snaprect
+ Rectangle aRect(((SdrObjCustomShape*)mpObj.get())->GetLogicRect());
+ Rectangle aRectangle( aRect );
+
+ if ( bMirroredX || bMirroredY )
+ { // we have to retrieve the unmirrored rect
+
+ GeoStat aNewGeo( aCustomShapeGeoData.aGeo );
+ if ( bMirroredX )
+ {
+ Polygon aPol( Rect2Poly( aRect, aNewGeo ) );
+ Rectangle aBoundRect( aPol.GetBoundRect() );
+
+ Point aRef1( ( aBoundRect.Left() + aBoundRect.Right() ) >> 1, aBoundRect.Top() );
+ Point aRef2( aRef1.X(), aRef1.Y() + 1000 );
+ sal_uInt16 i;
+ sal_uInt16 nPntAnz=aPol.GetSize();
+ for (i=0; i<nPntAnz; i++)
+ {
+ MirrorPoint(aPol[i],aRef1,aRef2);
+ }
+ // Polygon wenden und etwas schieben
+ Polygon aPol0(aPol);
+ aPol[0]=aPol0[1];
+ aPol[1]=aPol0[0];
+ aPol[2]=aPol0[3];
+ aPol[3]=aPol0[2];
+ aPol[4]=aPol0[1];
+ Poly2Rect(aPol,aRectangle,aNewGeo);
+ }
+ if ( bMirroredY )
+ {
+ Polygon aPol( Rect2Poly( aRectangle, aNewGeo ) );
+ Rectangle aBoundRect( aPol.GetBoundRect() );
+
+ Point aRef1( aBoundRect.Left(), ( aBoundRect.Top() + aBoundRect.Bottom() ) >> 1 );
+ Point aRef2( aRef1.X() + 1000, aRef1.Y() );
+ sal_uInt16 i;
+ sal_uInt16 nPntAnz=aPol.GetSize();
+ for (i=0; i<nPntAnz; i++)
+ {
+ MirrorPoint(aPol[i],aRef1,aRef2);
+ }
+ // Polygon wenden und etwas schieben
+ Polygon aPol0(aPol);
+ aPol[0]=aPol0[1];
+ aPol[1]=aPol0[0];
+ aPol[2]=aPol0[3];
+ aPol[3]=aPol0[2];
+ aPol[4]=aPol0[1];
+ Poly2Rect( aPol, aRectangle, aNewGeo );
+ }
+ }
+ Point aPt( aRectangle.TopLeft() );
+
+ if( mpModel->IsWriter() )
+ aPt -= mpObj->GetAnchorPos();
+
+ ForceMetricTo100th_mm(aPt);
+ return ::com::sun::star::awt::Point( aPt.X(), aPt.Y() );
+ }
+ else
+ return SvxShape::getPosition();
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SvxCustomShape::setPosition( const awt::Point& Position ) throw(uno::RuntimeException)
+{
+ SvxShapeText::setPosition(Position);
+}
+
+//----------------------------------------------------------------------
+
+awt::Size SAL_CALL SvxCustomShape::getSize() throw(uno::RuntimeException)
+{
+ return SvxShapeText::getSize();
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SvxCustomShape::setSize( const awt::Size& rSize )
+ throw(beans::PropertyVetoException, uno::RuntimeException)
+{
+ SvxShapeText::setSize( rSize );
+}
+
+//----------------------------------------------------------------------
+
+//----------------------------------------------------------------------
+void SAL_CALL SvxCustomShape::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, com::sun::star::beans::PropertyVetoException, com::sun::star::lang::IllegalArgumentException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ SdrObject* pObject = mpObj.get();
+
+ sal_Bool bCustomShapeGeometry = pObject && aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CustomShapeGeometry" ) );
+
+ sal_Bool bMirroredX = sal_False;
+ sal_Bool bMirroredY = sal_False;
+
+ if ( bCustomShapeGeometry )
+ {
+ bMirroredX = ( ((SdrObjCustomShape*)pObject)->IsMirroredX() );
+ bMirroredY = ( ((SdrObjCustomShape*)pObject)->IsMirroredY() );
+ }
+
+ SvxShape::setPropertyValue( aPropertyName, aValue );
+
+ if ( bCustomShapeGeometry )
+ {
+ ((SdrObjCustomShape*)pObject)->MergeDefaultAttributes(0);
+ Rectangle aRect( pObject->GetSnapRect() );
+
+ // #i38892#
+ bool bNeedsMirrorX = ((SdrObjCustomShape*)pObject)->IsMirroredX() != bMirroredX;
+ bool bNeedsMirrorY = ((SdrObjCustomShape*)pObject)->IsMirroredY() != bMirroredY;
+
+ boost::scoped_ptr< SdrGluePointList > pListCopy;
+ if( bNeedsMirrorX || bNeedsMirrorY )
+ {
+ const SdrGluePointList* pList = pObject->GetGluePointList();
+ if( pList )
+ pListCopy.reset( new SdrGluePointList(*pList) );
+ }
+
+ if ( bNeedsMirrorX )
+ {
+ Point aTop( ( aRect.Left() + aRect.Right() ) >> 1, aRect.Top() );
+ Point aBottom( aTop.X(), aTop.Y() + 1000 );
+ pObject->NbcMirror( aTop, aBottom );
+ // NbcMirroring is flipping the current mirror state,
+ // so we have to set the correct state again
+ ((SdrObjCustomShape*)pObject)->SetMirroredX( bMirroredX ? sal_False : sal_True );
+ }
+ if ( bNeedsMirrorY )
+ {
+ Point aLeft( aRect.Left(), ( aRect.Top() + aRect.Bottom() ) >> 1 );
+ Point aRight( aLeft.X() + 1000, aLeft.Y() );
+ pObject->NbcMirror( aLeft, aRight );
+ // NbcMirroring is flipping the current mirror state,
+ // so we have to set the correct state again
+ ((SdrObjCustomShape*)pObject)->SetMirroredY( bMirroredY ? sal_False : sal_True );
+ }
+
+ if( pListCopy )
+ {
+ SdrGluePointList* pNewList = const_cast< SdrGluePointList* >( pObject->GetGluePointList() );
+ if(pNewList)
+ *pNewList = *pListCopy;
+ }
+ }
+}
+
+bool SvxCustomShape::getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ switch( pProperty->nWID )
+ {
+ case SDRATTR_ROTATEANGLE:
+ {
+ double fAngle = static_cast<SdrObjCustomShape*>(mpObj.get())->GetObjectRotation();
+ fAngle *= 100;
+ rValue <<= (sal_Int32)fAngle;
+ return true;
+ }
+ default:
+ return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
+ }
+}
+//----------------------------------------------------------------------
+
+void SvxCustomShape::createCustomShapeDefaults( const rtl::OUString& rValueType ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ((SdrObjCustomShape*)mpObj.get())->MergeDefaultAttributes( &rValueType );
+}
diff --git a/svx/source/unodraw/unoshap3.cxx b/svx/source/unodraw/unoshap3.cxx
new file mode 100644
index 000000000000..be20ca4421e3
--- /dev/null
+++ b/svx/source/unodraw/unoshap3.cxx
@@ -0,0 +1,1210 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#define _SVX_USE_UNOGLOBALS_
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+#include <com/sun/star/drawing/Position3D.hpp>
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/drawing/DoubleSequence.hpp>
+#include <com/sun/star/drawing/CameraGeometry.hpp>
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <comphelper/serviceinfohelper.hxx>
+
+#include <rtl/uuid.h>
+#include <rtl/memory.h>
+#include <svx/svdpool.hxx>
+#include <svx/unoshape.hxx>
+#include <svx/unopage.hxx>
+#include <editeng/unoprnms.hxx>
+#include <svx/polysc3d.hxx>
+#include "svx/globl3d.hxx"
+#include <svx/cube3d.hxx>
+#include <svx/sphere3d.hxx>
+#include <svx/lathe3d.hxx>
+#include <svx/extrud3d.hxx>
+#include <svx/polygn3d.hxx>
+#include "svx/unoshprp.hxx"
+#include "svx/svdmodel.hxx"
+#include <basegfx/polygon/b3dpolygon.hxx>
+#include <basegfx/polygon/b3dpolygontools.hxx>
+#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+
+using ::rtl::OUString;
+using namespace ::vos;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+
+#define INTERFACE_TYPE( xint ) \
+ ::getCppuType((const Reference< xint >*)0)
+
+#define QUERYINT( xint ) \
+ if( rType == ::getCppuType((const Reference< xint >*)0) ) \
+ aAny <<= Reference< xint >(this)
+
+/***********************************************************************
+* class Svx3DSceneObject *
+***********************************************************************/
+
+//----------------------------------------------------------------------
+Svx3DSceneObject::Svx3DSceneObject( SdrObject* pObj, SvxDrawPage* pDrawPage ) throw()
+: SvxShape( pObj, aSvxMapProvider.GetMap(SVXMAP_3DSCENEOBJECT), aSvxMapProvider.GetPropertySet(SVXMAP_3DSCENEOBJECT, SdrObject::GetGlobalDrawObjectItemPool()) )
+, mxPage( pDrawPage )
+{
+}
+
+//----------------------------------------------------------------------
+Svx3DSceneObject::~Svx3DSceneObject() throw()
+{
+}
+
+//----------------------------------------------------------------------
+void Svx3DSceneObject::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage )
+{
+ SvxShape::Create( pNewObj, pNewPage );
+ mxPage = pNewPage;
+}
+
+//----------------------------------------------------------------------
+uno::Any SAL_CALL Svx3DSceneObject::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+
+ QUERYINT( drawing::XShapes );
+ else QUERYINT( container::XIndexAccess );
+ else QUERYINT( container::XElementAccess );
+ else
+ return SvxShape::queryAggregation( rType );
+
+ return aAny;
+}
+
+uno::Any SAL_CALL Svx3DSceneObject::queryInterface( const uno::Type & rType ) throw( uno::RuntimeException )
+{
+ return SvxShape::queryInterface( rType );
+}
+
+void SAL_CALL Svx3DSceneObject::acquire() throw ( )
+{
+ SvxShape::acquire();
+}
+
+void SAL_CALL Svx3DSceneObject::release() throw ( )
+{
+ SvxShape::release();
+}
+
+// XTypeProvider
+
+uno::Sequence< uno::Type > SAL_CALL Svx3DSceneObject::getTypes()
+ throw (uno::RuntimeException)
+{
+
+ return SvxShape::getTypes();
+}
+
+uno::Sequence< sal_Int8 > SAL_CALL Svx3DSceneObject::getImplementationId()
+ throw (uno::RuntimeException)
+{
+ static uno::Sequence< sal_Int8 > aId;
+ if( aId.getLength() == 0 )
+ {
+ aId.realloc( 16 );
+ rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
+ }
+ return aId;
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL Svx3DSceneObject::add( const Reference< drawing::XShape >& xShape )
+ throw( uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ SvxShape* pShape = SvxShape::getImplementation( xShape );
+
+ if(!mpObj.is() || !mxPage.is() || pShape == NULL || NULL != pShape->GetSdrObject() )
+ throw uno::RuntimeException();
+
+ SdrObject* pSdrShape = mxPage->_CreateSdrObject( xShape );
+ if( pSdrShape->ISA(E3dObject) )
+ {
+ mpObj->GetSubList()->NbcInsertObject( pSdrShape );
+
+ if(pShape)
+ pShape->Create( pSdrShape, mxPage.get() );
+ }
+ else
+ {
+ SdrObject::Free( pSdrShape );
+ throw uno::RuntimeException();
+ }
+
+ if( mpModel )
+ mpModel->SetChanged();
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL Svx3DSceneObject::remove( const Reference< drawing::XShape >& xShape )
+ throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ SvxShape* pShape = SvxShape::getImplementation( xShape );
+
+ if(!mpObj.is() || pShape == NULL)
+ throw uno::RuntimeException();
+
+ SdrObject* pSdrShape = pShape->GetSdrObject();
+ if(pSdrShape == NULL || pSdrShape->GetObjList()->GetOwnerObj() != mpObj.get())
+ {
+ throw uno::RuntimeException();
+ }
+ else
+ {
+ SdrObjList& rList = *pSdrShape->GetObjList();
+
+ const sal_uInt32 nObjCount = rList.GetObjCount();
+ sal_uInt32 nObjNum = 0;
+ while( nObjNum < nObjCount )
+ {
+ if(rList.GetObj( nObjNum ) == pSdrShape )
+ break;
+ nObjNum++;
+ }
+
+ if( nObjNum < nObjCount )
+ {
+ SdrObject* pObject = rList.NbcRemoveObject( nObjNum );
+ SdrObject::Free( pObject );
+ }
+ else
+ {
+ DBG_ASSERT( 0, "Fatality! SdrObject is not belonging to its SdrObjList! [CL]" );
+ }
+ }
+}
+
+//----------------------------------------------------------------------
+sal_Int32 SAL_CALL Svx3DSceneObject::getCount()
+ throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ sal_Int32 nRetval = 0;
+
+ if(mpObj.is() && mpObj->ISA(E3dPolyScene) && mpObj->GetSubList())
+ nRetval = mpObj->GetSubList()->GetObjCount();
+ return nRetval;
+}
+
+//----------------------------------------------------------------------
+
+uno::Any SAL_CALL Svx3DSceneObject::getByIndex( sal_Int32 Index )
+ throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( !mpObj.is() || mpObj->GetSubList() == NULL )
+ throw uno::RuntimeException();
+
+ if( mpObj->GetSubList()->GetObjCount() <= (sal_uInt32)Index )
+ throw lang::IndexOutOfBoundsException();
+
+ SdrObject* pDestObj = mpObj->GetSubList()->GetObj( Index );
+ if(pDestObj == NULL)
+ throw lang::IndexOutOfBoundsException();
+
+ Reference< drawing::XShape > xShape( pDestObj->getUnoShape(), uno::UNO_QUERY );
+ uno::Any aAny;
+ aAny <<= xShape;
+ return aAny;
+}
+
+//----------------------------------------------------------------------
+// ::com::sun::star::container::XElementAccess
+
+uno::Type SAL_CALL Svx3DSceneObject::getElementType()
+ throw( uno::RuntimeException )
+{
+ return ::getCppuType(( const Reference< drawing::XShape>*)0);
+}
+
+//----------------------------------------------------------------------
+sal_Bool SAL_CALL Svx3DSceneObject::hasElements()
+ throw( uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ return mpObj.is() && mpObj->GetSubList() && (mpObj->GetSubList()->GetObjCount() > 0);
+}
+
+//----------------------------------------------------------------------
+
+static bool ConvertHomogenMatrixToObject( E3dObject* pObject, const Any& rValue )
+{
+ drawing::HomogenMatrix m;
+ if( rValue >>= m )
+ {
+ basegfx::B3DHomMatrix aMat;
+ aMat.set(0, 0, m.Line1.Column1);
+ aMat.set(0, 1, m.Line1.Column2);
+ aMat.set(0, 2, m.Line1.Column3);
+ aMat.set(0, 3, m.Line1.Column4);
+ aMat.set(1, 0, m.Line2.Column1);
+ aMat.set(1, 1, m.Line2.Column2);
+ aMat.set(1, 2, m.Line2.Column3);
+ aMat.set(1, 3, m.Line2.Column4);
+ aMat.set(2, 0, m.Line3.Column1);
+ aMat.set(2, 1, m.Line3.Column2);
+ aMat.set(2, 2, m.Line3.Column3);
+ aMat.set(2, 3, m.Line3.Column4);
+ aMat.set(3, 0, m.Line4.Column1);
+ aMat.set(3, 1, m.Line4.Column2);
+ aMat.set(3, 2, m.Line4.Column3);
+ aMat.set(3, 3, m.Line4.Column4);
+ pObject->SetTransform(aMat);
+ return true;
+ }
+ return false;
+}
+
+static void ConvertObjectToHomogenMatric( E3dObject* pObject, Any& rValue )
+{
+ drawing::HomogenMatrix aHomMat;
+ const basegfx::B3DHomMatrix& rMat = pObject->GetTransform();
+ aHomMat.Line1.Column1 = rMat.get(0, 0);
+ aHomMat.Line1.Column2 = rMat.get(0, 1);
+ aHomMat.Line1.Column3 = rMat.get(0, 2);
+ aHomMat.Line1.Column4 = rMat.get(0, 3);
+ aHomMat.Line2.Column1 = rMat.get(1, 0);
+ aHomMat.Line2.Column2 = rMat.get(1, 1);
+ aHomMat.Line2.Column3 = rMat.get(1, 2);
+ aHomMat.Line2.Column4 = rMat.get(1, 3);
+ aHomMat.Line3.Column1 = rMat.get(2, 0);
+ aHomMat.Line3.Column2 = rMat.get(2, 1);
+ aHomMat.Line3.Column3 = rMat.get(2, 2);
+ aHomMat.Line3.Column4 = rMat.get(2, 3);
+ aHomMat.Line4.Column1 = rMat.get(3, 0);
+ aHomMat.Line4.Column2 = rMat.get(3, 1);
+ aHomMat.Line4.Column3 = rMat.get(3, 2);
+ aHomMat.Line4.Column4 = rMat.get(3, 3);
+ rValue <<= aHomMat;
+}
+
+//----------------------------------------------------------------------
+#include <svx/svditer.hxx>
+
+struct ImpRememberTransAndRect
+{
+ basegfx::B3DHomMatrix maMat;
+ Rectangle maRect;
+};
+
+bool Svx3DSceneObject::setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ switch( pProperty->nWID )
+ {
+ case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
+ {
+ // Transformationsmatrix in das Objekt packen
+ if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
+ return true;
+ break;
+ }
+ case OWN_ATTR_3D_VALUE_CAMERA_GEOMETRY:
+ {
+ // set CameraGeometry at scene
+ E3dScene* pScene = static_cast< E3dScene* >( mpObj.get() );
+ drawing::CameraGeometry aCamGeo;
+
+ if(rValue >>= aCamGeo)
+ {
+ basegfx::B3DPoint aVRP(aCamGeo.vrp.PositionX, aCamGeo.vrp.PositionY, aCamGeo.vrp.PositionZ);
+ basegfx::B3DVector aVPN(aCamGeo.vpn.DirectionX, aCamGeo.vpn.DirectionY, aCamGeo.vpn.DirectionZ);
+ basegfx::B3DVector aVUP(aCamGeo.vup.DirectionX, aCamGeo.vup.DirectionY, aCamGeo.vup.DirectionZ);
+
+ // rescue scene transformation
+ ImpRememberTransAndRect aSceneTAR;
+ aSceneTAR.maMat = pScene->GetTransform();
+ aSceneTAR.maRect = pScene->GetSnapRect();
+
+ // rescue object transformations
+ SdrObjListIter aIter(*pScene->GetSubList(), IM_DEEPWITHGROUPS);
+ List aObjTrans;
+ while(aIter.IsMore())
+ {
+ E3dObject* p3DObj = (E3dObject*)aIter.Next();
+ basegfx::B3DHomMatrix* pNew = new basegfx::B3DHomMatrix;
+ *pNew = p3DObj->GetTransform();
+ aObjTrans.Insert(pNew, LIST_APPEND);
+ }
+
+ // reset object transformations
+ aIter.Reset();
+ while(aIter.IsMore())
+ {
+ E3dObject* p3DObj = (E3dObject*)aIter.Next();
+ p3DObj->NbcSetTransform(basegfx::B3DHomMatrix());
+ }
+
+ // reset scene transformation and make a complete recalc
+ pScene->NbcSetTransform(basegfx::B3DHomMatrix());
+
+ // fill old camera from new parameters
+ Camera3D aCam(pScene->GetCamera());
+ const basegfx::B3DRange& rVolume = pScene->GetBoundVolume();
+ double fW = rVolume.getWidth();
+ double fH = rVolume.getHeight();
+
+ const SfxItemSet& rSceneSet = pScene->GetMergedItemSet();
+ double fCamPosZ =
+ (double)((const SfxUInt32Item&)rSceneSet.Get(SDRATTR_3DSCENE_DISTANCE)).GetValue();
+ double fCamFocal =
+ (double)((const SfxUInt32Item&)rSceneSet.Get(SDRATTR_3DSCENE_FOCAL_LENGTH)).GetValue();
+
+ aCam.SetAutoAdjustProjection(sal_False);
+ aCam.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
+ basegfx::B3DPoint aLookAt;
+ basegfx::B3DPoint aCamPos(0.0, 0.0, fCamPosZ);
+ aCam.SetPosAndLookAt(aCamPos, aLookAt);
+ aCam.SetFocalLength(fCamFocal / 100.0);
+ aCam.SetDefaults(basegfx::B3DPoint(0.0, 0.0, fCamPosZ), aLookAt, fCamFocal / 100.0);
+ aCam.SetDeviceWindow(Rectangle(0, 0, (long)fW, (long)fH));
+
+ // set at scene
+ pScene->SetCamera(aCam);
+
+ // #91047# use imported VRP, VPN and VUP (if used)
+ sal_Bool bVRPUsed(!aVRP.equal(basegfx::B3DPoint(0.0, 0.0, 1.0)));
+ sal_Bool bVPNUsed(!aVPN.equal(basegfx::B3DVector(0.0, 0.0, 1.0)));
+ sal_Bool bVUPUsed(!aVUP.equal(basegfx::B3DVector(0.0, 1.0, 0.0)));
+
+ if(bVRPUsed || bVPNUsed || bVUPUsed)
+ {
+ pScene->GetCameraSet().SetViewportValues(aVRP, aVPN, aVUP);
+ }
+
+ // set object transformations again at objects
+ aIter.Reset();
+ sal_uInt32 nIndex(0L);
+ while(aIter.IsMore())
+ {
+ E3dObject* p3DObj = (E3dObject*)aIter.Next();
+ basegfx::B3DHomMatrix* pMat = (basegfx::B3DHomMatrix*)aObjTrans.GetObject(nIndex++);
+ p3DObj->NbcSetTransform(*pMat);
+ delete pMat;
+ }
+
+ // set scene transformation again at scene
+ pScene->NbcSetTransform(aSceneTAR.maMat);
+ pScene->NbcSetSnapRect(aSceneTAR.maRect);
+
+ return true;
+ }
+ break;
+ }
+ default:
+ return SvxShape::setPropertyValueImpl(rName, pProperty, rValue);
+ }
+
+ throw IllegalArgumentException();
+}
+
+//----------------------------------------------------------------------
+
+bool Svx3DSceneObject::getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ switch( pProperty->nWID )
+ {
+ case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
+ {
+ // Objekt in eine homogene 4x4 Matrix packen
+ ConvertObjectToHomogenMatric( static_cast< E3dObject* >( mpObj.get() ), rValue );
+ break;
+ }
+ case OWN_ATTR_3D_VALUE_CAMERA_GEOMETRY:
+ {
+ // get CameraGeometry from scene
+ E3dScene* pScene = static_cast< E3dScene* >( mpObj.get() );
+ drawing::CameraGeometry aCamGeo;
+
+ // fill Vectors from scene camera
+ B3dCamera& aCameraSet = pScene->GetCameraSet();
+ basegfx::B3DPoint aVRP(aCameraSet.GetVRP());
+ basegfx::B3DVector aVPN(aCameraSet.GetVPN());
+ basegfx::B3DVector aVUP(aCameraSet.GetVUV());
+
+ // transfer to structure
+ aCamGeo.vrp.PositionX = aVRP.getX();
+ aCamGeo.vrp.PositionY = aVRP.getY();
+ aCamGeo.vrp.PositionZ = aVRP.getZ();
+ aCamGeo.vpn.DirectionX = aVPN.getX();
+ aCamGeo.vpn.DirectionY = aVPN.getY();
+ aCamGeo.vpn.DirectionZ = aVPN.getZ();
+ aCamGeo.vup.DirectionX = aVUP.getX();
+ aCamGeo.vup.DirectionY = aVUP.getY();
+ aCamGeo.vup.DirectionZ = aVUP.getZ();
+
+ rValue <<= aCamGeo;
+ break;
+ }
+ default:
+ return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
+ }
+
+ return true;
+}
+
+// ::com::sun::star::lang::XServiceInfo
+uno::Sequence< OUString > SAL_CALL Svx3DSceneObject::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ uno::Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.drawing.Shape3DScene" );
+ return aSeq;
+}
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+//----------------------------------------------------------------------
+Svx3DCubeObject::Svx3DCubeObject( SdrObject* pObj ) throw()
+: SvxShape( pObj, aSvxMapProvider.GetMap(SVXMAP_3DCUBEOBJEKT), aSvxMapProvider.GetPropertySet(SVXMAP_3DCUBEOBJEKT, SdrObject::GetGlobalDrawObjectItemPool()) )
+{
+}
+
+//----------------------------------------------------------------------
+Svx3DCubeObject::~Svx3DCubeObject() throw()
+{
+}
+
+//----------------------------------------------------------------------
+bool Svx3DCubeObject::setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ switch( pProperty->nWID )
+ {
+ case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
+ {
+ // Transformationsmatrix in das Objekt packen
+ if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
+ return true;
+ break;
+ }
+ case OWN_ATTR_3D_VALUE_POSITION:
+ {
+ // Position in das Objekt packen
+ drawing::Position3D aUnoPos;
+ if( rValue >>= aUnoPos )
+ {
+ basegfx::B3DPoint aPos(aUnoPos.PositionX, aUnoPos.PositionY, aUnoPos.PositionZ);
+ static_cast< E3dCubeObj* >( mpObj.get() )->SetCubePos(aPos);
+ return true;
+ }
+ break;
+ }
+ case OWN_ATTR_3D_VALUE_SIZE:
+ {
+ // Groesse in das Objekt packen
+ drawing::Direction3D aDirection;
+ if( rValue >>= aDirection )
+ {
+ basegfx::B3DVector aSize(aDirection.DirectionX, aDirection.DirectionY, aDirection.DirectionZ);
+ static_cast< E3dCubeObj* >( mpObj.get() )->SetCubeSize(aSize);
+ return true;
+ }
+ break;
+ }
+ case OWN_ATTR_3D_VALUE_POS_IS_CENTER:
+ {
+ sal_Bool bNew = sal_False;
+ // sal_Bool bPosIsCenter in das Objekt packen
+ if( rValue >>= bNew )
+ {
+ static_cast< E3dCubeObj* >( mpObj.get() )->SetPosIsCenter(bNew);
+ return true;
+ }
+ break;
+ }
+ default:
+ return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
+ }
+
+ throw IllegalArgumentException();
+}
+
+//----------------------------------------------------------------------
+
+bool Svx3DCubeObject::getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ switch( pProperty->nWID )
+ {
+ case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
+ {
+ // Transformation in eine homogene Matrix packen
+ ConvertObjectToHomogenMatric( static_cast< E3dObject* >( mpObj.get() ), rValue );
+ break;
+ }
+ case OWN_ATTR_3D_VALUE_POSITION:
+ {
+ // Position packen
+ const basegfx::B3DPoint& rPos = ((E3dCubeObj*)mpObj.get())->GetCubePos();
+ drawing::Position3D aPos;
+
+ aPos.PositionX = rPos.getX();
+ aPos.PositionY = rPos.getY();
+ aPos.PositionZ = rPos.getZ();
+
+ rValue <<= aPos;
+ break;
+ }
+ case OWN_ATTR_3D_VALUE_SIZE:
+ {
+ // Groesse packen
+ const basegfx::B3DVector& rSize = static_cast<E3dCubeObj*>(mpObj.get())->GetCubeSize();
+ drawing::Direction3D aDir;
+
+ aDir.DirectionX = rSize.getX();
+ aDir.DirectionY = rSize.getY();
+ aDir.DirectionZ = rSize.getZ();
+
+ rValue <<= aDir;
+ break;
+ }
+ case OWN_ATTR_3D_VALUE_POS_IS_CENTER:
+ {
+ rValue <<= static_cast<E3dCubeObj*>(mpObj.get())->GetPosIsCenter();
+ break;
+ }
+ default:
+ return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
+ }
+
+ return true;
+}
+
+// ::com::sun::star::lang::XServiceInfo
+uno::Sequence< OUString > SAL_CALL Svx3DCubeObject::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ uno::Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 2, "com.sun.star.drawing.Shape3D",
+ "com.sun.star.drawing.Shape3DCube");
+ return aSeq;
+}
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+//----------------------------------------------------------------------
+Svx3DSphereObject::Svx3DSphereObject( SdrObject* pObj ) throw()
+: SvxShape( pObj, aSvxMapProvider.GetMap(SVXMAP_3DSPHEREOBJECT), aSvxMapProvider.GetPropertySet(SVXMAP_3DSPHEREOBJECT, SdrObject::GetGlobalDrawObjectItemPool()) )
+{
+}
+
+//----------------------------------------------------------------------
+Svx3DSphereObject::~Svx3DSphereObject() throw()
+{
+}
+
+//----------------------------------------------------------------------
+
+bool Svx3DSphereObject::setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ switch( pProperty->nWID )
+ {
+ case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
+ {
+ // Transformationsmatrix in das Objekt packen
+ if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
+ return true;
+ break;
+ }
+
+ case OWN_ATTR_3D_VALUE_POSITION:
+ {
+ // Position in das Objekt packen
+ drawing::Position3D aUnoPos;
+ if( rValue >>= aUnoPos )
+ {
+ basegfx::B3DPoint aPos(aUnoPos.PositionX, aUnoPos.PositionY, aUnoPos.PositionZ);
+ static_cast<E3dSphereObj*>(mpObj.get())->SetCenter(aPos);
+ return true;
+ }
+ break;
+ }
+
+ case OWN_ATTR_3D_VALUE_SIZE:
+ {
+ // Groesse in das Objekt packen
+ drawing::Direction3D aDir;
+ if( rValue >>= aDir )
+ {
+ basegfx::B3DVector aPos(aDir.DirectionX, aDir.DirectionY, aDir.DirectionZ);
+ static_cast<E3dSphereObj*>(mpObj.get())->SetSize(aPos);
+ return true;
+ }
+ break;
+ }
+ default:
+ return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
+ }
+
+ throw IllegalArgumentException();
+}
+
+//----------------------------------------------------------------------
+
+bool Svx3DSphereObject::getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ switch( pProperty->nWID )
+ {
+ case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
+ {
+ // Transformation in eine homogene Matrix packen
+ ConvertObjectToHomogenMatric( static_cast< E3dObject* >( mpObj.get() ), rValue );
+ break;
+ }
+ case OWN_ATTR_3D_VALUE_POSITION:
+ {
+ // Position packen
+ const basegfx::B3DPoint& rPos = ((E3dSphereObj*)mpObj.get())->Center();
+ drawing::Position3D aPos;
+
+ aPos.PositionX = rPos.getX();
+ aPos.PositionY = rPos.getY();
+ aPos.PositionZ = rPos.getZ();
+
+ rValue <<= aPos;
+ break;
+ }
+ case OWN_ATTR_3D_VALUE_SIZE:
+ {
+ // Groesse packen
+ const basegfx::B3DVector& rSize = ((E3dSphereObj*)mpObj.get())->Size();
+ drawing::Direction3D aDir;
+
+ aDir.DirectionX = rSize.getX();
+ aDir.DirectionY = rSize.getY();
+ aDir.DirectionZ = rSize.getZ();
+
+ rValue <<= aDir;
+ break;
+ }
+ default:
+ return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
+ }
+
+ return true;
+}
+
+// ::com::sun::star::lang::XServiceInfo
+uno::Sequence< OUString > SAL_CALL Svx3DSphereObject::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ uno::Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 2, "com.sun.star.drawing.Shape3D",
+ "com.sun.star.drawing.Shape3DSphere");
+ return aSeq;
+}
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+//----------------------------------------------------------------------
+Svx3DLatheObject::Svx3DLatheObject( SdrObject* pObj ) throw()
+: SvxShape( pObj, aSvxMapProvider.GetMap(SVXMAP_3DLATHEOBJECT), aSvxMapProvider.GetPropertySet(SVXMAP_3DLATHEOBJECT, SdrObject::GetGlobalDrawObjectItemPool()) )
+{
+}
+
+//----------------------------------------------------------------------
+Svx3DLatheObject::~Svx3DLatheObject() throw()
+{
+}
+
+bool PolyPolygonShape3D_to_B3dPolyPolygon(
+ const Any& rValue,
+ basegfx::B3DPolyPolygon& rResultPolygon,
+ bool bCorrectPolygon)
+{
+ drawing::PolyPolygonShape3D aSourcePolyPolygon;
+ if( !(rValue >>= aSourcePolyPolygon) )
+ return false;
+
+ sal_Int32 nOuterSequenceCount = aSourcePolyPolygon.SequenceX.getLength();
+ if(nOuterSequenceCount != aSourcePolyPolygon.SequenceY.getLength() || nOuterSequenceCount != aSourcePolyPolygon.SequenceZ.getLength())
+ return false;
+
+ drawing::DoubleSequence* pInnerSequenceX = aSourcePolyPolygon.SequenceX.getArray();
+ drawing::DoubleSequence* pInnerSequenceY = aSourcePolyPolygon.SequenceY.getArray();
+ drawing::DoubleSequence* pInnerSequenceZ = aSourcePolyPolygon.SequenceZ.getArray();
+ for(sal_Int32 a(0L);a<nOuterSequenceCount;a++)
+ {
+ sal_Int32 nInnerSequenceCount = pInnerSequenceX->getLength();
+ if(nInnerSequenceCount != pInnerSequenceY->getLength() || nInnerSequenceCount != pInnerSequenceZ->getLength())
+ {
+ return false;
+ }
+ basegfx::B3DPolygon aNewPolygon;
+ double* pArrayX = pInnerSequenceX->getArray();
+ double* pArrayY = pInnerSequenceY->getArray();
+ double* pArrayZ = pInnerSequenceZ->getArray();
+ for(sal_Int32 b(0L);b<nInnerSequenceCount;b++)
+ {
+ aNewPolygon.append(basegfx::B3DPoint(*pArrayX++,*pArrayY++,*pArrayZ++));
+ }
+ pInnerSequenceX++;
+ pInnerSequenceY++;
+ pInnerSequenceZ++;
+
+ // #i101520# correction is needed for imported polygons of old format,
+ // see callers
+ if(bCorrectPolygon)
+ {
+ basegfx::tools::checkClosed(aNewPolygon);
+ }
+
+ rResultPolygon.append(aNewPolygon);
+ }
+ return true;
+}
+
+static void B3dPolyPolygon_to_PolyPolygonShape3D( const basegfx::B3DPolyPolygon& rSourcePolyPolygon, Any& rValue )
+{
+ drawing::PolyPolygonShape3D aRetval;
+ aRetval.SequenceX.realloc(rSourcePolyPolygon.count());
+ aRetval.SequenceY.realloc(rSourcePolyPolygon.count());
+ aRetval.SequenceZ.realloc(rSourcePolyPolygon.count());
+ drawing::DoubleSequence* pOuterSequenceX = aRetval.SequenceX.getArray();
+ drawing::DoubleSequence* pOuterSequenceY = aRetval.SequenceY.getArray();
+ drawing::DoubleSequence* pOuterSequenceZ = aRetval.SequenceZ.getArray();
+ for(sal_uInt32 a(0L);a<rSourcePolyPolygon.count();a++)
+ {
+ const basegfx::B3DPolygon aPoly(rSourcePolyPolygon.getB3DPolygon(a));
+ sal_Int32 nPointCount(aPoly.count());
+ if(aPoly.isClosed()) nPointCount++;
+ pOuterSequenceX->realloc(nPointCount);
+ pOuterSequenceY->realloc(nPointCount);
+ pOuterSequenceZ->realloc(nPointCount);
+ double* pInnerSequenceX = pOuterSequenceX->getArray();
+ double* pInnerSequenceY = pOuterSequenceY->getArray();
+ double* pInnerSequenceZ = pOuterSequenceZ->getArray();
+ for(sal_uInt32 b(0L);b<aPoly.count();b++)
+ {
+ const basegfx::B3DPoint aPoint(aPoly.getB3DPoint(b));
+ *pInnerSequenceX++ = aPoint.getX();
+ *pInnerSequenceY++ = aPoint.getY();
+ *pInnerSequenceZ++ = aPoint.getZ();
+ }
+ if(aPoly.isClosed())
+ {
+ const basegfx::B3DPoint aPoint(aPoly.getB3DPoint(0L));
+ *pInnerSequenceX++ = aPoint.getX();
+ *pInnerSequenceY++ = aPoint.getY();
+ *pInnerSequenceZ++ = aPoint.getZ();
+ }
+ pOuterSequenceX++;
+ pOuterSequenceY++;
+ pOuterSequenceZ++;
+ }
+ rValue <<= aRetval;
+}
+
+//----------------------------------------------------------------------
+
+bool Svx3DLatheObject::setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ switch( pProperty->nWID )
+ {
+ case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
+ {
+ // Transformationsmatrix in das Objekt packen
+ if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
+ return true;
+ break;
+ }
+ case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
+ {
+ // Polygondefinition in das Objekt packen
+ basegfx::B3DPolyPolygon aNewB3DPolyPolygon;
+
+ // #i101520# Probably imported
+ if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, true ) )
+ {
+ // #105127# SetPolyPoly3D sets the Svx3DVerticalSegmentsItem to the number
+ // of points of the polygon. Thus, value gets lost. To avoid this, rescue
+ // item here and re-set after setting the polygon.
+ const sal_uInt32 nPrevVerticalSegs(static_cast<E3dLatheObj*>(mpObj.get())->GetVerticalSegments());
+
+ // Polygon setzen
+ const basegfx::B3DHomMatrix aIdentity;
+ const basegfx::B2DPolyPolygon aB2DPolyPolygon(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(aNewB3DPolyPolygon, aIdentity));
+ static_cast<E3dLatheObj*>(mpObj.get())->SetPolyPoly2D(aB2DPolyPolygon);
+ const sal_uInt32 nPostVerticalSegs(static_cast<E3dLatheObj*>(mpObj.get())->GetVerticalSegments());
+
+ if(nPrevVerticalSegs != nPostVerticalSegs)
+ {
+ // restore the vertical segment count
+ static_cast<E3dLatheObj*>(mpObj.get())->SetMergedItem(Svx3DVerticalSegmentsItem(nPrevVerticalSegs));
+ }
+ return true;
+ }
+ break;
+ }
+ default:
+ return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
+ }
+
+ throw IllegalArgumentException();
+}
+
+//----------------------------------------------------------------------
+bool Svx3DLatheObject::getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ switch( pProperty->nWID )
+ {
+ case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
+ {
+ // Transformation in eine homogene Matrix packen
+ drawing::HomogenMatrix aHomMat;
+ basegfx::B3DHomMatrix aMat = static_cast<E3dObject*>(mpObj.get())->GetTransform();
+
+ // pack evtl. transformed matrix to output
+ aHomMat.Line1.Column1 = aMat.get(0, 0);
+ aHomMat.Line1.Column2 = aMat.get(0, 1);
+ aHomMat.Line1.Column3 = aMat.get(0, 2);
+ aHomMat.Line1.Column4 = aMat.get(0, 3);
+ aHomMat.Line2.Column1 = aMat.get(1, 0);
+ aHomMat.Line2.Column2 = aMat.get(1, 1);
+ aHomMat.Line2.Column3 = aMat.get(1, 2);
+ aHomMat.Line2.Column4 = aMat.get(1, 3);
+ aHomMat.Line3.Column1 = aMat.get(2, 0);
+ aHomMat.Line3.Column2 = aMat.get(2, 1);
+ aHomMat.Line3.Column3 = aMat.get(2, 2);
+ aHomMat.Line3.Column4 = aMat.get(2, 3);
+ aHomMat.Line4.Column1 = aMat.get(3, 0);
+ aHomMat.Line4.Column2 = aMat.get(3, 1);
+ aHomMat.Line4.Column3 = aMat.get(3, 2);
+ aHomMat.Line4.Column4 = aMat.get(3, 3);
+
+ rValue <<= aHomMat;
+ break;
+ }
+ case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
+ {
+ const basegfx::B2DPolyPolygon& rPolyPoly = static_cast<E3dLatheObj*>(mpObj.get())->GetPolyPoly2D();
+ const basegfx::B3DPolyPolygon aB3DPolyPolygon(basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(rPolyPoly));
+
+ B3dPolyPolygon_to_PolyPolygonShape3D(aB3DPolyPolygon, rValue);
+ break;
+ }
+ default:
+ return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
+ }
+
+ return true;
+}
+
+// ::com::sun::star::lang::XServiceInfo
+uno::Sequence< OUString > SAL_CALL Svx3DLatheObject::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ uno::Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 2, "com.sun.star.drawing.Shape3D",
+ "com.sun.star.drawing.Shape3DLathe");
+ return aSeq;
+}
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+Svx3DExtrudeObject::Svx3DExtrudeObject( SdrObject* pObj ) throw()
+: SvxShape( pObj, aSvxMapProvider.GetMap(SVXMAP_3DEXTRUDEOBJECT), aSvxMapProvider.GetPropertySet(SVXMAP_3DEXTRUDEOBJECT, SdrObject::GetGlobalDrawObjectItemPool()) )
+{
+}
+
+//----------------------------------------------------------------------
+Svx3DExtrudeObject::~Svx3DExtrudeObject() throw()
+{
+}
+
+//----------------------------------------------------------------------
+
+bool Svx3DExtrudeObject::setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ switch( pProperty->nWID )
+ {
+ case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
+ {
+ // Transformationsmatrix in das Objekt packen
+ if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
+ return true;
+ break;
+ }
+
+ case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
+ {
+ // Polygondefinition in das Objekt packen
+ basegfx::B3DPolyPolygon aNewB3DPolyPolygon;
+
+ // #i101520# Probably imported
+ if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, true ) )
+ {
+ // Polygon setzen
+ const basegfx::B3DHomMatrix aIdentity;
+ const basegfx::B2DPolyPolygon aB2DPolyPolygon(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(aNewB3DPolyPolygon, aIdentity));
+ static_cast<E3dExtrudeObj*>(mpObj.get())->SetExtrudePolygon(aB2DPolyPolygon);
+ return true;
+ }
+ break;
+ }
+ default:
+ return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
+ }
+
+ throw IllegalArgumentException();
+}
+
+//----------------------------------------------------------------------
+
+bool Svx3DExtrudeObject::getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ switch( pProperty->nWID )
+ {
+ case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
+ {
+ // Transformation in eine homogene Matrix packen
+ drawing::HomogenMatrix aHomMat;
+ basegfx::B3DHomMatrix aMat = ((E3dObject*)mpObj.get())->GetTransform();
+
+ // pack evtl. transformed matrix to output
+ aHomMat.Line1.Column1 = aMat.get(0, 0);
+ aHomMat.Line1.Column2 = aMat.get(0, 1);
+ aHomMat.Line1.Column3 = aMat.get(0, 2);
+ aHomMat.Line1.Column4 = aMat.get(0, 3);
+ aHomMat.Line2.Column1 = aMat.get(1, 0);
+ aHomMat.Line2.Column2 = aMat.get(1, 1);
+ aHomMat.Line2.Column3 = aMat.get(1, 2);
+ aHomMat.Line2.Column4 = aMat.get(1, 3);
+ aHomMat.Line3.Column1 = aMat.get(2, 0);
+ aHomMat.Line3.Column2 = aMat.get(2, 1);
+ aHomMat.Line3.Column3 = aMat.get(2, 2);
+ aHomMat.Line3.Column4 = aMat.get(2, 3);
+ aHomMat.Line4.Column1 = aMat.get(3, 0);
+ aHomMat.Line4.Column2 = aMat.get(3, 1);
+ aHomMat.Line4.Column3 = aMat.get(3, 2);
+ aHomMat.Line4.Column4 = aMat.get(3, 3);
+
+ rValue <<= aHomMat;
+ break;
+ }
+
+ case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
+ {
+ // Polygondefinition packen
+ const basegfx::B2DPolyPolygon& rPolyPoly = static_cast<E3dExtrudeObj*>(mpObj.get())->GetExtrudePolygon();
+ const basegfx::B3DPolyPolygon aB3DPolyPolygon(basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(rPolyPoly));
+
+ B3dPolyPolygon_to_PolyPolygonShape3D(aB3DPolyPolygon, rValue);
+ break;
+ }
+ default:
+ return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
+ }
+
+ return true;
+}
+
+// ::com::sun::star::lang::XServiceInfo
+uno::Sequence< OUString > SAL_CALL Svx3DExtrudeObject::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ uno::Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 2, "com.sun.star.drawing.Shape3D",
+ "com.sun.star.drawing.Shape3DExtrude");
+ return aSeq;
+}
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+//----------------------------------------------------------------------
+Svx3DPolygonObject::Svx3DPolygonObject( SdrObject* pObj ) throw()
+: SvxShape( pObj, aSvxMapProvider.GetMap(SVXMAP_3DPOLYGONOBJECT), aSvxMapProvider.GetPropertySet(SVXMAP_3DPOLYGONOBJECT, SdrObject::GetGlobalDrawObjectItemPool()) )
+{
+}
+
+//----------------------------------------------------------------------
+Svx3DPolygonObject::~Svx3DPolygonObject() throw()
+{
+}
+
+//----------------------------------------------------------------------
+bool Svx3DPolygonObject::setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ switch( pProperty->nWID )
+ {
+ case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
+ {
+ // Transformationsmatrix in das Objekt packen
+ if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
+ return true;
+ break;
+ }
+
+ case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
+ {
+ // Polygondefinition in das Objekt packen
+ basegfx::B3DPolyPolygon aNewB3DPolyPolygon;
+
+ // #i101520# Direct API data (e.g. from chart)
+ if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, false ) )
+ {
+ // Polygon setzen
+ static_cast<E3dPolygonObj*>(mpObj.get())->SetPolyPolygon3D(aNewB3DPolyPolygon);
+ return true;
+ }
+ break;
+ }
+ case OWN_ATTR_3D_VALUE_NORMALSPOLYGON3D:
+ {
+ // Normalendefinition in das Objekt packen
+ basegfx::B3DPolyPolygon aNewB3DPolyPolygon;
+
+ // #i101520# Direct API data (e.g. from chart)
+ if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, false ) )
+ {
+ // Polygon setzen
+ static_cast<E3dPolygonObj*>(mpObj.get())->SetPolyNormals3D(aNewB3DPolyPolygon);
+ return true;
+ }
+ break;
+ }
+ case OWN_ATTR_3D_VALUE_TEXTUREPOLYGON3D:
+ {
+ // Texturdefinition in das Objekt packen
+ basegfx::B3DPolyPolygon aNewB3DPolyPolygon;
+
+ // #i101520# Direct API data (e.g. from chart)
+ if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, false ) )
+ {
+ // Polygon setzen
+ const basegfx::B3DHomMatrix aIdentity;
+ const basegfx::B2DPolyPolygon aB2DPolyPolygon(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(aNewB3DPolyPolygon, aIdentity));
+ static_cast<E3dPolygonObj*>(mpObj.get())->SetPolyTexture2D(aB2DPolyPolygon);
+ return true;
+ }
+ break;
+ }
+ case OWN_ATTR_3D_VALUE_LINEONLY:
+ {
+ sal_Bool bNew = sal_False;
+ if( rValue >>= bNew )
+ {
+ static_cast<E3dPolygonObj*>(mpObj.get())->SetLineOnly(bNew);
+ return true;
+ }
+ break;
+ }
+ default:
+ return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
+ }
+
+ throw IllegalArgumentException();
+}
+
+//----------------------------------------------------------------------
+bool Svx3DPolygonObject::getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ switch( pProperty->nWID )
+ {
+ case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
+ {
+ ConvertObjectToHomogenMatric( static_cast< E3dObject* >( mpObj.get() ), rValue );
+ break;
+ }
+
+ case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
+ {
+ B3dPolyPolygon_to_PolyPolygonShape3D(static_cast<E3dPolygonObj*>(mpObj.get())->GetPolyPolygon3D(),rValue);
+ break;
+ }
+
+ case OWN_ATTR_3D_VALUE_NORMALSPOLYGON3D:
+ {
+ B3dPolyPolygon_to_PolyPolygonShape3D(static_cast<E3dPolygonObj*>(mpObj.get())->GetPolyNormals3D(),rValue);
+ break;
+ }
+
+ case OWN_ATTR_3D_VALUE_TEXTUREPOLYGON3D:
+ {
+ // Texturdefinition packen
+ const basegfx::B2DPolyPolygon& rPolyPoly = static_cast<E3dPolygonObj*>(mpObj.get())->GetPolyTexture2D();
+ const basegfx::B3DPolyPolygon aB3DPolyPolygon(basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(rPolyPoly));
+
+ B3dPolyPolygon_to_PolyPolygonShape3D(aB3DPolyPolygon,rValue);
+ break;
+ }
+
+ case OWN_ATTR_3D_VALUE_LINEONLY:
+ {
+ rValue <<= (sal_Bool)static_cast<E3dPolygonObj*>(mpObj.get())->GetLineOnly();
+ break;
+ }
+
+ default:
+ return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
+ }
+
+ return true;
+}
+
+// ::com::sun::star::lang::XServiceInfo
+uno::Sequence< OUString > SAL_CALL Svx3DPolygonObject::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 2, "com.sun.star.drawing.Shape3D",
+ "com.sun.star.drawing.Shape3DPolygon");
+ return aSeq;
+}
+
+// eof
diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx
new file mode 100644
index 000000000000..9f906dc59a39
--- /dev/null
+++ b/svx/source/unodraw/unoshap4.cxx
@@ -0,0 +1,996 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <com/sun/star/util/XModifiable.hpp>
+#include <com/sun/star/embed/XLinkageSupport.hpp>
+#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+
+#define _SVX_USE_UNOGLOBALS_
+
+#include <vcl/virdev.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/svdomedia.hxx>
+#include <svx/svdpool.hxx>
+#ifndef SVX_LIGHT
+#ifndef _SOT_CLSIDS_HXX
+#include <sot/clsids.hxx>
+#endif
+#include <sfx2/frmdescr.hxx>
+#endif
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+
+#include <toolkit/helper/vclunohelper.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/docfile.hxx>
+
+#include <sot/storage.hxx>
+#include <sot/exchange.hxx>
+#include <svtools/FilterConfigItem.hxx>
+
+#include <svx/svdmodel.hxx>
+#include "shapeimpl.hxx"
+
+#include <svx/unoshprp.hxx>
+
+#include "svx/unoapi.hxx"
+#include "svx/svdpagv.hxx"
+#include "svx/svdview.hxx"
+#include "svx/svdglob.hxx"
+#include "svx/svdstr.hrc"
+
+///////////////////////////////////////////////////////////////////////
+
+extern sal_Bool ConvertGDIMetaFileToWMF( const GDIMetaFile & rMTF, SvStream & rTargetStream, FilterConfigItem* pFilterConfigItem = NULL, sal_Bool bPlaceable = sal_True );
+
+///////////////////////////////////////////////////////////////////////
+
+using namespace ::osl;
+using namespace ::vos;
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+
+///////////////////////////////////////////////////////////////////////
+SvxOle2Shape::SvxOle2Shape( SdrObject* pObject ) throw()
+: SvxShape( pObject, aSvxMapProvider.GetMap(SVXMAP_OLE2), aSvxMapProvider.GetPropertySet(SVXMAP_OLE2, SdrObject::GetGlobalDrawObjectItemPool()) )
+{
+}
+
+SvxOle2Shape::SvxOle2Shape( SdrObject* pObject, const SfxItemPropertyMapEntry* pPropertyMap, const SvxItemPropertySet* pPropertySet ) throw ()
+: SvxShape( pObject, pPropertyMap, pPropertySet )
+{
+}
+
+SvxOle2Shape::~SvxOle2Shape() throw()
+{
+}
+
+::com::sun::star::uno::Any SAL_CALL SvxOle2Shape::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return SvxShape::queryAggregation( rType );
+}
+
+//XPropertySet
+bool SvxOle2Shape::setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ switch( pProperty->nWID )
+ {
+/*
+ case OWN_ATTR_CLSID:
+ {
+ OUString aCLSID;
+ if( rValue >>= aCLSID )
+ {
+ // init an ole object with a global name
+ SdrOle2Obj* pOle2 = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
+ if( pOle2 )
+ {
+ uno::Reference < embed::XEmbeddedObject > xObj = pOle2->GetObjRef();
+ if ( !xObj.is() )
+ {
+ SvGlobalName aClassName;
+ if( aClassName.MakeId( aCLSID ) )
+ {
+ SfxObjectShell* pPersist = mpModel->GetPersist();
+ ::rtl::OUString aPersistName;
+ Any aAny( getPropertyValue( OUString::createFromAscii( UNO_NAME_OLE2_PERSISTNAME ) ) );
+ aAny >>= aPersistName;
+
+ //TODO/LATER: how to cope with creation failure?!
+ xObj = pPersist->GetEmbeddedObjectContainer().CreateEmbeddedObject( aClassName.GetByteSequence(), aPersistName );
+ if( xObj.is() )
+ {
+ aAny <<= aPersistName;
+ setPropertyValue( OUString::createFromAscii( UNO_NAME_OLE2_PERSISTNAME ), aAny );
+ pOle2->SetObjRef( xObj );
+
+ Rectangle aRect = pOle2->GetLogicRect();
+ awt::Size aSz;
+ Size aSize( pOle2->GetLogicRect().GetSize() );
+ aSz.Width = aSize.Width();
+ aSz.Height = aSize.Height();
+ xObj->setVisualAreaSize( pOle2->GetAspect(), aSz );
+ }
+ }
+ }
+ }
+ return true;
+ }
+ break;
+ }
+*/
+ case OWN_ATTR_OLE_VISAREA:
+ {
+ // TODO/LATER: seems to make no sence for iconified object
+
+ awt::Rectangle aVisArea;
+ if( (rValue >>= aVisArea) && mpObj->ISA(SdrOle2Obj))
+ {
+ Size aTmp( aVisArea.X + aVisArea.Width, aVisArea.Y + aVisArea.Height );
+ uno::Reference < embed::XEmbeddedObject > xObj = ((SdrOle2Obj*)mpObj.get())->GetObjRef();
+ if( xObj.is() )
+ {
+ try
+ {
+ MapUnit aMapUnit( MAP_100TH_MM ); // the API handles with MAP_100TH_MM map mode
+ MapUnit aObjUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( embed::Aspects::MSOLE_CONTENT ) );
+ aTmp = OutputDevice::LogicToLogic( aTmp, aMapUnit, aObjUnit );
+ xObj->setVisualAreaSize( embed::Aspects::MSOLE_CONTENT, awt::Size( aTmp.Width(), aTmp.Height() ) );
+ }
+ catch( uno::Exception& )
+ {
+ OSL_ENSURE( sal_False, "Couldn't set the visual area for the object!\n" );
+ }
+ }
+
+ return true;
+ }
+ break;
+ }
+ case OWN_ATTR_OLE_ASPECT:
+ {
+ sal_Int64 nAspect = 0;
+ if( rValue >>= nAspect )
+ {
+ static_cast<SdrOle2Obj*>(mpObj.get())->SetAspect( nAspect );
+ return true;
+ }
+ break;
+ }
+ case OWN_ATTR_CLSID:
+ {
+ OUString aCLSID;
+ if( rValue >>= aCLSID )
+ {
+ // init a ole object with a global name
+ SvGlobalName aClassName;
+ if( aClassName.MakeId( aCLSID ) )
+ {
+ if( createObject( aClassName ) )
+ return true;
+ }
+ }
+ break;
+ }
+ case OWN_ATTR_THUMBNAIL:
+ {
+ OUString aURL;
+ if( rValue >>= aURL )
+ {
+ GraphicObject aGrafObj( GraphicObject::CreateGraphicObjectFromURL( aURL ) );
+ static_cast<SdrOle2Obj*>(mpObj.get())->SetGraphic( &aGrafObj.GetGraphic() );
+ return true;
+ }
+ break;
+ }
+ case OWN_ATTR_VALUE_GRAPHIC:
+ {
+ uno::Reference< graphic::XGraphic > xGraphic( rValue, uno::UNO_QUERY );
+ if( xGraphic.is() )
+ {
+ SdrOle2Obj* pOle = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
+ if( pOle )
+ {
+ GraphicObject aGrafObj( xGraphic );
+ const Graphic aGraphic( aGrafObj.GetGraphic() );
+ pOle->SetGraphicToObj( aGraphic, rtl::OUString() );
+ }
+ return true;
+ }
+ break;
+ }
+ case OWN_ATTR_PERSISTNAME:
+ {
+ OUString aPersistName;
+ if( rValue >>= aPersistName )
+ {
+ static_cast<SdrOle2Obj*>(mpObj.get())->SetPersistName( aPersistName );
+ return true;
+ }
+ break;
+ }
+ case OWN_ATTR_OLE_LINKURL:
+ {
+ OUString aLinkURL;
+ if( rValue >>= aLinkURL )
+ {
+ createLink( aLinkURL );
+ return true;
+ }
+ break;
+ }
+ default:
+ return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
+ }
+
+ throw IllegalArgumentException();
+}
+
+bool SvxOle2Shape::getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ switch( pProperty->nWID )
+ {
+ case OWN_ATTR_CLSID:
+ {
+ OUString aCLSID;
+ SvGlobalName aClassName = GetClassName_Impl(aCLSID);
+ rValue <<= aCLSID;
+ break;
+ }
+
+ case OWN_ATTR_INTERNAL_OLE:
+ {
+ rtl::OUString sCLSID;
+ rValue <<= SotExchange::IsInternal( GetClassName_Impl(sCLSID) );
+ break;
+ }
+
+ case OWN_ATTR_METAFILE:
+ {
+ SdrOle2Obj* pObj = dynamic_cast<SdrOle2Obj*>(mpObj.get());
+ if( pObj )
+ {
+ Graphic* pGraphic = pObj->GetGraphic();
+ if( pGraphic )
+ {
+ sal_Bool bIsWMF = sal_False;
+ if ( pGraphic->IsLink() )
+ {
+ GfxLink aLnk = pGraphic->GetLink();
+ if ( aLnk.GetType() == GFX_LINK_TYPE_NATIVE_WMF )
+ {
+ bIsWMF = sal_True;
+ uno::Sequence<sal_Int8> aSeq((sal_Int8*)aLnk.GetData(), (sal_Int32) aLnk.GetDataSize());
+ rValue <<= aSeq;
+ }
+ }
+ if ( !bIsWMF )
+ {
+ GDIMetaFile aMtf;
+ if ( pGraphic->GetType() != GRAPHIC_BITMAP )
+ aMtf = pObj->GetGraphic()->GetGDIMetaFile();
+ else
+ {
+ VirtualDevice aVirDev;
+ aMtf.Record( &aVirDev );
+ pGraphic->Draw( &aVirDev, Point(), pGraphic->GetPrefSize() );
+ aMtf.Stop();
+ aMtf.SetPrefSize( pGraphic->GetPrefSize() );
+ aMtf.SetPrefMapMode( pGraphic->GetPrefMapMode() );
+ }
+ SvMemoryStream aDestStrm( 65535, 65535 );
+ ConvertGDIMetaFileToWMF( aMtf, aDestStrm, NULL, sal_False );
+ const uno::Sequence<sal_Int8> aSeq(
+ static_cast< const sal_Int8* >(aDestStrm.GetData()),
+ aDestStrm.GetEndOfData());
+ rValue <<= aSeq;
+ }
+ }
+ }
+ else
+ {
+ rValue = GetBitmap( sal_True );
+ }
+ break;
+ }
+
+ case OWN_ATTR_OLE_VISAREA:
+ {
+ awt::Rectangle aVisArea;
+ if( mpObj->ISA(SdrOle2Obj))
+ {
+ MapMode aMapMode( MAP_100TH_MM ); // the API uses this map mode
+ Size aTmp = ((SdrOle2Obj*)mpObj.get())->GetOrigObjSize( &aMapMode ); // get the size in the requested map mode
+ aVisArea = awt::Rectangle( 0, 0, aTmp.Width(), aTmp.Height() );
+ }
+
+ rValue <<= aVisArea;
+ break;
+ }
+
+ case OWN_ATTR_OLESIZE:
+ {
+ Size aTmp( static_cast<SdrOle2Obj*>(mpObj.get())->GetOrigObjSize() );
+ rValue <<= awt::Size( aTmp.Width(), aTmp.Height() );
+ break;
+ }
+
+ case OWN_ATTR_OLE_ASPECT:
+ {
+ rValue <<= static_cast<SdrOle2Obj*>(mpObj.get())->GetAspect();
+ break;
+ }
+
+ case OWN_ATTR_OLEMODEL:
+ case OWN_ATTR_OLE_EMBEDDED_OBJECT:
+ case OWN_ATTR_OLE_EMBEDDED_OBJECT_NONEWCLIENT:
+ {
+ SdrOle2Obj* pObj = dynamic_cast<SdrOle2Obj*>( mpObj.get() );
+ if( pObj )
+ {
+ uno::Reference < embed::XEmbeddedObject > xObj( pObj->GetObjRef() );
+ if ( xObj.is()
+ && ( pProperty->nWID == OWN_ATTR_OLE_EMBEDDED_OBJECT || pProperty->nWID == OWN_ATTR_OLE_EMBEDDED_OBJECT_NONEWCLIENT || svt::EmbeddedObjectRef::TryRunningState( xObj ) ) )
+ {
+ // Discussed with CL fue to the before GetPaintingPageView
+ // usage. Removed it, former fallback is used now
+ if ( pProperty->nWID == OWN_ATTR_OLEMODEL || pProperty->nWID == OWN_ATTR_OLE_EMBEDDED_OBJECT )
+ {
+#ifdef DBG_UTIL
+ const sal_Bool bSuccess(pObj->AddOwnLightClient());
+ OSL_ENSURE( bSuccess, "An object without client is provided!" );
+#else
+ pObj->AddOwnLightClient();
+#endif
+ }
+
+ if ( pProperty->nWID == OWN_ATTR_OLEMODEL )
+ rValue <<= pObj->GetObjRef()->getComponent();
+ else
+ rValue <<= xObj;
+ }
+ }
+ break;
+ }
+
+ case OWN_ATTR_VALUE_GRAPHIC:
+ {
+ uno::Reference< graphic::XGraphic > xGraphic;
+ Graphic* pGraphic = static_cast<SdrOle2Obj*>( mpObj.get() )->GetGraphic();
+ if( pGraphic )
+ xGraphic = pGraphic->GetXGraphic();
+ rValue <<= xGraphic;
+ break;
+ }
+
+ case OWN_ATTR_THUMBNAIL:
+ {
+ OUString aURL;
+ SdrOle2Obj* pOle = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
+ if( pOle )
+ {
+ Graphic* pGraphic = pOle->GetGraphic();
+
+ // if there isn't already a preview graphic set, check if we need to generate
+ // one if model says so
+ if( pGraphic == NULL && !pOle->IsEmptyPresObj() && mpModel->IsSaveOLEPreview() )
+ pGraphic = pOle->GetGraphic();
+
+ if( pGraphic )
+ {
+ GraphicObject aObj( *pGraphic );
+ aURL = OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX));
+ aURL += OUString::createFromAscii( aObj.GetUniqueID().GetBuffer() );
+ }
+ }
+ rValue <<= aURL;
+ break;
+ }
+ case OWN_ATTR_PERSISTNAME:
+ {
+ OUString aPersistName;
+ SdrOle2Obj* pOle = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
+
+ if( pOle )
+ {
+ aPersistName = pOle->GetPersistName();
+ if( aPersistName.getLength() )
+ {
+ ::comphelper::IEmbeddedHelper *pPersist = mpObj->GetModel()->GetPersist();
+ if( (NULL == pPersist) || !pPersist->getEmbeddedObjectContainer().HasEmbeddedObject( pOle->GetPersistName() ) )
+ aPersistName = OUString();
+ }
+ }
+
+ rValue <<= aPersistName;
+ break;
+ }
+ case OWN_ATTR_OLE_LINKURL:
+ {
+ OUString aLinkURL;
+ SdrOle2Obj* pOle = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
+
+ if( pOle )
+ {
+ uno::Reference< embed::XLinkageSupport > xLink( pOle->GetObjRef(), uno::UNO_QUERY );
+ if ( xLink.is() && xLink->isLink() )
+ aLinkURL = xLink->getLinkURL();
+ }
+
+ rValue <<= aLinkURL;
+ break;
+ }
+ default:
+ return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
+ }
+
+ return true;
+}
+
+sal_Bool SvxOle2Shape::createObject( const SvGlobalName &aClassName )
+{
+ DBG_TESTSOLARMUTEX();
+
+ SdrOle2Obj* pOle2Obj = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
+ if ( !pOle2Obj || !pOle2Obj->IsEmpty() )
+ return sal_False;
+
+ // create storage and inplace object
+ ::comphelper::IEmbeddedHelper* pPersist = mpModel->GetPersist();
+ ::rtl::OUString aPersistName;
+ OUString aTmpStr;
+ if( getPropertyValue( OUString::createFromAscii( UNO_NAME_OLE2_PERSISTNAME ) ) >>= aTmpStr )
+ aPersistName = aTmpStr;
+
+ //TODO/LATER: how to cope with creation failure?!
+ uno::Reference < embed::XEmbeddedObject > xObj( pPersist->getEmbeddedObjectContainer().CreateEmbeddedObject( aClassName.GetByteSequence(), aPersistName ) );
+ if( xObj.is() )
+ {
+ Rectangle aRect = pOle2Obj->GetLogicRect();
+ if ( aRect.GetWidth() == 100 && aRect.GetHeight() == 100 )
+ {
+ // TODO/LATER: is it possible that this method is used to create an iconified object?
+ // default size
+ try
+ {
+ awt::Size aSz = xObj->getVisualAreaSize( pOle2Obj->GetAspect() );
+ aRect.SetSize( Size( aSz.Width, aSz.Height ) );
+ }
+ catch( embed::NoVisualAreaSizeException& )
+ {}
+ pOle2Obj->SetLogicRect( aRect );
+ }
+ else
+ {
+ awt::Size aSz;
+ Size aSize = pOle2Obj->GetLogicRect().GetSize();
+ aSz.Width = aSize.Width();
+ aSz.Height = aSize.Height();
+ xObj->setVisualAreaSize( pOle2Obj->GetAspect(), aSz );
+ }
+
+ // connect the object after the visual area is set
+ setPropertyValue( OUString::createFromAscii( UNO_NAME_OLE2_PERSISTNAME ), Any( aTmpStr = aPersistName ) );
+
+ // the object is inserted during setting of PersistName property usually
+ if( pOle2Obj->IsEmpty() )
+ pOle2Obj->SetObjRef( xObj );
+ }
+
+ return xObj.is();
+}
+
+sal_Bool SvxOle2Shape::createLink( const ::rtl::OUString& aLinkURL )
+{
+ DBG_TESTSOLARMUTEX();
+
+ SdrOle2Obj* pOle2Obj = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
+ if ( !pOle2Obj || !pOle2Obj->IsEmpty() )
+ return sal_False;
+
+ ::rtl::OUString aPersistName;
+
+ ::comphelper::IEmbeddedHelper* pPersist = mpModel->GetPersist();
+
+ uno::Sequence< beans::PropertyValue > aMediaDescr( 1 );
+ aMediaDescr[0].Name = ::rtl::OUString::createFromAscii( "URL" );
+ aMediaDescr[0].Value <<= aLinkURL;
+
+ uno::Reference< task::XInteractionHandler > xInteraction = pPersist->getInteractionHandler();
+ if ( xInteraction.is() )
+ {
+ aMediaDescr.realloc( 2 );
+ aMediaDescr[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" ) );
+ aMediaDescr[1].Value <<= xInteraction;
+ }
+
+ //TODO/LATER: how to cope with creation failure?!
+ uno::Reference< embed::XEmbeddedObject > xObj =
+ pPersist->getEmbeddedObjectContainer().InsertEmbeddedLink( aMediaDescr , aPersistName );
+
+ if( xObj.is() )
+ {
+ Rectangle aRect = pOle2Obj->GetLogicRect();
+ if ( aRect.GetWidth() == 100 && aRect.GetHeight() == 100 )
+ {
+ // default size
+ try
+ {
+ awt::Size aSz = xObj->getVisualAreaSize( pOle2Obj->GetAspect() );
+ aRect.SetSize( Size( aSz.Width, aSz.Height ) );
+ }
+ catch( embed::NoVisualAreaSizeException& )
+ {}
+ pOle2Obj->SetLogicRect( aRect );
+ }
+ else
+ {
+ awt::Size aSz;
+ Size aSize = pOle2Obj->GetLogicRect().GetSize();
+ aSz.Width = aSize.Width();
+ aSz.Height = aSize.Height();
+ xObj->setVisualAreaSize( pOle2Obj->GetAspect(), aSz );
+ }
+
+ // connect the object after the visual area is set
+ setPropertyValue( OUString::createFromAscii( UNO_NAME_OLE2_PERSISTNAME ), uno::makeAny( aPersistName ) );
+
+ // the object is inserted during setting of PersistName property usually
+ if ( pOle2Obj->IsEmpty() )
+ pOle2Obj->SetObjRef( xObj );
+ }
+
+ return xObj.is();
+}
+
+void SvxOle2Shape::resetModifiedState()
+{
+ ::comphelper::IEmbeddedHelper* pPersist = mpModel ? mpModel->GetPersist() : 0;
+ if( pPersist && !pPersist->isEnableSetModified() )
+ {
+ SdrOle2Obj* pOle = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
+ if( pOle && !pOle->IsEmpty() )
+ {
+ uno::Reference < util::XModifiable > xMod( pOle->GetObjRef(), uno::UNO_QUERY );
+ if( xMod.is() )
+ // TODO/MBA: what's this?!
+ xMod->setModified( sal_False );
+ }
+ }
+}
+
+const SvGlobalName SvxOle2Shape::GetClassName_Impl(rtl::OUString& rHexCLSID)
+{
+ DBG_TESTSOLARMUTEX();
+ SvGlobalName aClassName;
+ SdrOle2Obj* pOle2Obj = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
+
+ if( pOle2Obj )
+ {
+ rHexCLSID = rtl::OUString();
+
+ if( pOle2Obj->IsEmpty() )
+ {
+ ::comphelper::IEmbeddedHelper* pPersist = mpModel->GetPersist();
+ if( pPersist )
+ {
+ uno::Reference < embed::XEmbeddedObject > xObj =
+ pPersist->getEmbeddedObjectContainer().GetEmbeddedObject( pOle2Obj->GetPersistName() );
+ if ( xObj.is() )
+ {
+ aClassName = SvGlobalName( xObj->getClassID() );
+ rHexCLSID = aClassName.GetHexName();
+ }
+ }
+ }
+
+ if (!rHexCLSID.getLength())
+ {
+ uno::Reference < embed::XEmbeddedObject > xObj( pOle2Obj->GetObjRef() );
+ if ( xObj.is() )
+ {
+ aClassName = SvGlobalName( xObj->getClassID() );
+ rHexCLSID = aClassName.GetHexName();
+ }
+ }
+ }
+
+ return aClassName;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+SvxAppletShape::SvxAppletShape( SdrObject* pObject ) throw()
+: SvxOle2Shape( pObject, aSvxMapProvider.GetMap(SVXMAP_APPLET), aSvxMapProvider.GetPropertySet(SVXMAP_APPLET, SdrObject::GetGlobalDrawObjectItemPool()) )
+{
+ SetShapeType( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.AppletShape" ) ) );
+}
+
+SvxAppletShape::~SvxAppletShape() throw()
+{
+}
+
+void SvxAppletShape::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage )
+{
+ SvxShape::Create( pNewObj, pNewPage );
+ const SvGlobalName aAppletClassId( SO3_APPLET_CLASSID );
+ createObject(aAppletClassId);
+ SetShapeType( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.AppletShape" ) ) );
+}
+
+void SAL_CALL SvxAppletShape::setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ SvxShape::setPropertyValue( aPropertyName, rValue );
+ resetModifiedState();
+}
+
+void SAL_CALL SvxAppletShape::setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ SvxShape::setPropertyValues( aPropertyNames, rValues );
+ resetModifiedState();
+}
+
+bool SvxAppletShape::setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ if( (pProperty->nWID >= OWN_ATTR_APPLET_DOCBASE) && (pProperty->nWID <= OWN_ATTR_APPLET_ISSCRIPT) )
+ {
+ if ( svt::EmbeddedObjectRef::TryRunningState( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef() ) )
+ {
+ uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef()->getComponent(), uno::UNO_QUERY );
+ if( xSet.is() )
+ {
+ // allow exceptions to pass through
+ xSet->setPropertyValue( rName, rValue );
+ }
+ }
+ return true;
+ }
+ else
+ {
+ return SvxOle2Shape::setPropertyValueImpl( rName, pProperty, rValue );
+ }
+}
+
+bool SvxAppletShape::getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ if( (pProperty->nWID >= OWN_ATTR_APPLET_DOCBASE) && (pProperty->nWID <= OWN_ATTR_APPLET_ISSCRIPT) )
+ {
+ if ( svt::EmbeddedObjectRef::TryRunningState( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef() ) )
+ {
+ uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef()->getComponent(), uno::UNO_QUERY );
+ if( xSet.is() )
+ {
+ rValue = xSet->getPropertyValue( rName );
+ }
+ }
+ return true;
+ }
+ else
+ {
+ return SvxOle2Shape::getPropertyValueImpl( rName, pProperty, rValue );
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+
+SvxPluginShape::SvxPluginShape( SdrObject* pObject ) throw()
+: SvxOle2Shape( pObject, aSvxMapProvider.GetMap(SVXMAP_PLUGIN), aSvxMapProvider.GetPropertySet(SVXMAP_PLUGIN, SdrObject::GetGlobalDrawObjectItemPool()) )
+{
+ SetShapeType( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.PluginShape" ) ) );
+}
+
+SvxPluginShape::~SvxPluginShape() throw()
+{
+}
+
+void SvxPluginShape::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage )
+{
+ SvxShape::Create( pNewObj, pNewPage );
+ const SvGlobalName aPluginClassId( SO3_PLUGIN_CLASSID );
+ createObject(aPluginClassId);
+ SetShapeType( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.PluginShape" ) ) );
+}
+
+void SAL_CALL SvxPluginShape::setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ SvxShape::setPropertyValue( aPropertyName, rValue );
+ resetModifiedState();
+}
+
+void SAL_CALL SvxPluginShape::setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ SvxOle2Shape::setPropertyValues( aPropertyNames, rValues );
+ resetModifiedState();
+}
+
+bool SvxPluginShape::setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ if( (pProperty->nWID >= OWN_ATTR_PLUGIN_MIMETYPE) && (pProperty->nWID <= OWN_ATTR_PLUGIN_COMMANDS) )
+ {
+ if( svt::EmbeddedObjectRef::TryRunningState( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef() ) )
+ {
+ uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef()->getComponent(), uno::UNO_QUERY );
+ if( xSet.is() )
+ {
+ // allow exceptions to pass through
+ xSet->setPropertyValue( rName, rValue );
+ }
+ }
+ return true;
+ }
+ else
+ {
+ return SvxOle2Shape::setPropertyValueImpl( rName, pProperty, rValue );
+ }
+}
+
+bool SvxPluginShape::getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ if( (pProperty->nWID >= OWN_ATTR_PLUGIN_MIMETYPE) && (pProperty->nWID <= OWN_ATTR_PLUGIN_COMMANDS) )
+ {
+ if( svt::EmbeddedObjectRef::TryRunningState( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef() ) )
+ {
+ uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef()->getComponent(), uno::UNO_QUERY );
+ if( xSet.is() )
+ {
+ rValue <<= xSet->getPropertyValue( rName );
+ }
+ }
+ return true;
+ }
+ else
+ {
+ return SvxOle2Shape::getPropertyValueImpl( rName, pProperty, rValue );
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+
+SvxFrameShape::SvxFrameShape( SdrObject* pObject ) throw()
+: SvxOle2Shape( pObject, aSvxMapProvider.GetMap(SVXMAP_FRAME), aSvxMapProvider.GetPropertySet(SVXMAP_FRAME, SdrObject::GetGlobalDrawObjectItemPool()) )
+{
+ SetShapeType( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.FrameShape" ) ) );
+}
+
+SvxFrameShape::~SvxFrameShape() throw()
+{
+}
+
+void SvxFrameShape::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage ) throw ()
+{
+ SvxShape::Create( pNewObj, pNewPage );
+ const SvGlobalName aIFrameClassId( SO3_IFRAME_CLASSID );
+ createObject(aIFrameClassId);
+ SetShapeType( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.FrameShape" ) ) );
+}
+
+void SAL_CALL SvxFrameShape::setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ SvxShape::setPropertyValue( aPropertyName, rValue );
+ resetModifiedState();
+}
+
+void SAL_CALL SvxFrameShape::setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ SvxOle2Shape::setPropertyValues( aPropertyNames, rValues );
+ resetModifiedState();
+}
+
+bool SvxFrameShape::setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ if( (pProperty->nWID >= OWN_ATTR_FRAME_URL) && (pProperty->nWID <= OWN_ATTR_FRAME_MARGIN_HEIGHT) )
+ {
+ if( svt::EmbeddedObjectRef::TryRunningState( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef() ) )
+ {
+ uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef()->getComponent(), uno::UNO_QUERY );
+ if( xSet.is() )
+ {
+ // allow exceptions to pass through
+ xSet->setPropertyValue( rName, rValue );
+ }
+ }
+ return true;
+ }
+ else
+ {
+ return SvxOle2Shape::setPropertyValueImpl( rName, pProperty, rValue );
+ }
+}
+
+bool SvxFrameShape::getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ if( (pProperty->nWID >= OWN_ATTR_FRAME_URL) && (pProperty->nWID <= OWN_ATTR_FRAME_MARGIN_HEIGHT) )
+ {
+ if( svt::EmbeddedObjectRef::TryRunningState( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef() ) )
+ {
+ uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef()->getComponent(), uno::UNO_QUERY );
+ if( xSet.is() )
+ {
+ rValue <<= xSet->getPropertyValue( rName );
+ }
+ }
+ return true;
+ }
+ else
+ {
+ return SvxOle2Shape::getPropertyValueImpl( rName, pProperty, rValue );
+ }
+}
+
+/***********************************************************************
+* *
+***********************************************************************/
+
+SvxMediaShape::SvxMediaShape( SdrObject* pObj ) throw()
+: SvxShape( pObj, aSvxMapProvider.GetMap(SVXMAP_MEDIA), aSvxMapProvider.GetPropertySet(SVXMAP_MEDIA, SdrObject::GetGlobalDrawObjectItemPool()) )
+{
+ SetShapeType( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.MediaShape" ) ) );
+}
+
+//----------------------------------------------------------------------
+SvxMediaShape::~SvxMediaShape() throw()
+{
+}
+
+//----------------------------------------------------------------------
+
+bool SvxMediaShape::setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ if( (pProperty->nWID >= OWN_ATTR_MEDIA_URL) && (pProperty->nWID <= OWN_ATTR_MEDIA_ZOOM) )
+ {
+ SdrMediaObj* pMedia = static_cast< SdrMediaObj* >( mpObj.get() );
+ ::avmedia::MediaItem aItem;
+ bool bOk = false;
+
+ switch( pProperty->nWID )
+ {
+ case OWN_ATTR_MEDIA_URL:
+ {
+ OUString aURL;
+ if( rValue >>= aURL )
+ {
+ bOk = true;
+ aItem.setURL( aURL );
+ }
+ }
+ break;
+
+ case( OWN_ATTR_MEDIA_LOOP ):
+ {
+ sal_Bool bLoop = sal_Bool();
+
+ if( rValue >>= bLoop )
+ {
+ bOk = true;
+ aItem.setLoop( bLoop );
+ }
+ }
+ break;
+
+ case( OWN_ATTR_MEDIA_MUTE ):
+ {
+ sal_Bool bMute = sal_Bool();
+
+ if( rValue >>= bMute )
+ {
+ bOk = true;
+ aItem.setMute( bMute );
+ }
+ }
+ break;
+
+ case( OWN_ATTR_MEDIA_VOLUMEDB ):
+ {
+ sal_Int16 nVolumeDB = sal_Int16();
+
+ if( rValue >>= nVolumeDB )
+ {
+ bOk = true;
+ aItem.setVolumeDB( nVolumeDB );
+ }
+ }
+ break;
+
+ case( OWN_ATTR_MEDIA_ZOOM ):
+ {
+ ::com::sun::star::media::ZoomLevel eLevel;
+
+ if( rValue >>= eLevel )
+ {
+ bOk = true;
+ aItem.setZoom( eLevel );
+ }
+ }
+ break;
+
+ default:
+ DBG_ERROR("SvxMediaShape::setPropertyValueImpl(), unknown argument!");
+ }
+
+ if( bOk )
+ {
+ pMedia->setMediaProperties( aItem );
+ return true;
+ }
+ }
+ else
+ {
+ return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
+ }
+
+ throw IllegalArgumentException();
+}
+
+//----------------------------------------------------------------------
+
+bool SvxMediaShape::getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ if( ( pProperty->nWID >= OWN_ATTR_MEDIA_URL ) && ( pProperty->nWID <= OWN_ATTR_MEDIA_ZOOM ) )
+ {
+ SdrMediaObj* pMedia = static_cast< SdrMediaObj* >( mpObj.get() );
+ const ::avmedia::MediaItem aItem( pMedia->getMediaProperties() );
+
+ switch( pProperty->nWID )
+ {
+ case OWN_ATTR_MEDIA_URL:
+ rValue <<= aItem.getURL();
+ break;
+
+ case( OWN_ATTR_MEDIA_LOOP ):
+ rValue <<= (sal_Bool) aItem.isLoop();
+ break;
+
+ case( OWN_ATTR_MEDIA_MUTE ):
+ rValue <<= (sal_Bool) aItem.isMute();
+ break;
+
+ case( OWN_ATTR_MEDIA_VOLUMEDB ):
+ rValue <<= (sal_Int16) aItem.getVolumeDB();
+ break;
+
+ case( OWN_ATTR_MEDIA_ZOOM ):
+ rValue <<= aItem.getZoom();
+ break;
+
+ default:
+ DBG_ERROR("SvxMediaShape::getPropertyValueImpl(), unknown property!");
+ }
+ return true;
+ }
+ else
+ {
+ return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
+ }
+}
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
new file mode 100644
index 000000000000..73872e2e4b0a
--- /dev/null
+++ b/svx/source/unodraw/unoshape.cxx
@@ -0,0 +1,4661 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#define _SVX_USE_UNOGLOBALS_
+#include <cppuhelper/typeprovider.hxx>
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/drawing/CircleKind.hpp>
+#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
+#include <vcl/svapp.hxx>
+#include <svl/itemprop.hxx>
+#include <svtools/fltcall.hxx>
+#include <vos/mutex.hxx>
+#include <editeng/unotext.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdoole2.hxx>
+#include <osl/mutex.hxx>
+#include <comphelper/extract.hxx>
+#include "svx/shapepropertynotifier.hxx"
+#include <comphelper/serviceinfohelper.hxx>
+#include <toolkit/unohlp.hxx>
+#include <comphelper/serviceinfohelper.hxx>
+#include <rtl/uuid.h>
+#include <rtl/memory.h>
+#include <vcl/gfxlink.hxx>
+#include <vcl/virdev.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/viewsh.hxx>
+#include "svx/svdopage.hxx"
+#include "svx/xflbstit.hxx"
+#include "svx/xflbmtit.hxx"
+#include "svx/xlnstit.hxx"
+#include "svx/xlnedit.hxx"
+#include "svx/svdogrp.hxx"
+#include "svx/scene3d.hxx"
+#include "svx/svdmodel.hxx"
+#include "svx/globl3d.hxx"
+#include "svx/fmglob.hxx"
+#include "svx/unopage.hxx"
+#include "svx/view3d.hxx"
+#include "svx/unoshape.hxx"
+#include "svx/svxids.hrc"
+#include "svx/unoshtxt.hxx"
+#include "svx/svdpage.hxx"
+#include "svx/unoshprp.hxx"
+#include "svx/sxciaitm.hxx" // todo: remove
+#include "svx/svdograf.hxx"
+#include "svx/unoapi.hxx"
+#include "svx/svdomeas.hxx"
+#include "svx/svdpagv.hxx"
+#include "svx/svdpool.hxx"
+#include <tools/shl.hxx> //
+#include "svx/dialmgr.hxx" // not nice, we need our own resources some day
+#include "svx/dialogs.hrc" //
+#include "svx/svdocapt.hxx"
+#include <svx/obj3d.hxx>
+#include <tools/diagnose_ex.h>
+#include "svx/xflftrit.hxx"
+#include "svx/xtable.hxx"
+#include "svx/xbtmpit.hxx"
+#include "svx/xflgrit.hxx"
+#include "svx/xflhtit.hxx"
+#include "svx/xlnedit.hxx"
+#include "svx/xlnstit.hxx"
+#include "svx/xlndsit.hxx"
+#include "svx/svdglob.hxx"
+#include "svx/svdstr.hrc"
+#include "svx/unomaster.hxx"
+#include <editeng/outlobj.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
+#include <vector>
+
+// #i68523#
+#include "svx/lathe3d.hxx"
+#include "svx/extrud3d.hxx"
+#include "unopolyhelper.hxx"
+
+#include <comphelper/scopeguard.hxx>
+#include <boost/bind.hpp>
+
+using ::rtl::OUString;
+using namespace ::osl;
+using namespace ::vos;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using ::svx::PropertyValueProvider;
+using ::svx::IPropertyValueProvider;
+
+#define QUERYINT( xint ) \
+ if( rType == ::getCppuType((const uno::Reference< xint >*)0) ) \
+ aAny <<= uno::Reference< xint >(this)
+
+class GDIMetaFile;
+class SvStream;
+sal_Bool ConvertGDIMetaFileToWMF( const GDIMetaFile & rMTF, SvStream & rTargetStream,
+ FilterConfigItem* pFilterConfigItem = NULL, sal_Bool bPlaceable = sal_True );
+
+uno::Reference< uno::XInterface > SAL_CALL SvxUnoGluePointAccess_createInstance( SdrObject* pObject );
+
+/***********************************************************************
+* class SvxShapeImpl *
+***********************************************************************/
+
+struct SvxShapeImpl
+{
+ SvxShape& mrAntiImpl;
+ SfxItemSet* mpItemSet;
+ sal_uInt32 mnObjId;
+ SvxShapeMaster* mpMaster;
+ bool mbHasSdrObjectOwnership;
+ bool mbDisposing;
+
+ /** CL, OD 2005-07-19 #i52126# - this is initially 0 and set when
+ * a SvxShape::Create() call is executed. It is then set to the created
+ * SdrObject so a multiple call to SvxShape::Create() with same SdrObject
+ * is prohibited.
+ */
+ ::tools::WeakReference< SdrObject > mpCreatedObj;
+
+ // for xComponent
+ ::cppu::OInterfaceContainerHelper maDisposeListeners;
+ ::svx::PropertyChangeNotifier maPropertyNotifier;
+
+ SvxShapeImpl( SvxShape& _rAntiImpl, ::osl::Mutex& _rMutex )
+ :mrAntiImpl( _rAntiImpl )
+ ,mpItemSet( NULL )
+ ,mnObjId( 0 )
+ ,mpMaster( NULL )
+ ,mbHasSdrObjectOwnership( false )
+ ,mbDisposing( false )
+ ,mpCreatedObj()
+ ,maDisposeListeners( _rMutex )
+ ,maPropertyNotifier( _rAntiImpl, _rMutex )
+ {
+ }
+};
+
+/**********************************************************************/
+class ShapePositionProvider : public PropertyValueProvider
+{
+public:
+ ShapePositionProvider( const SvxShapeImpl& _shapeImpl )
+ :PropertyValueProvider( _shapeImpl.mrAntiImpl, "Position" )
+ {
+ }
+
+protected:
+ virtual void getCurrentValue( Any& _out_rCurrentValue ) const
+ {
+ _out_rCurrentValue <<= static_cast< SvxShape& >( getContext() ).getPosition();
+ }
+};
+
+//----------------------------------------------------------------------
+class ShapeSizeProvider : public PropertyValueProvider
+{
+public:
+ ShapeSizeProvider( const SvxShapeImpl& _shapeImpl )
+ :PropertyValueProvider( _shapeImpl.mrAntiImpl, "Size" )
+ {
+ }
+
+protected:
+ virtual void getCurrentValue( Any& _out_rCurrentValue ) const
+ {
+ _out_rCurrentValue <<= static_cast< SvxShape& >( getContext() ).getSize();
+ }
+};
+
+/***********************************************************************
+* class SvxShape *
+***********************************************************************/
+
+DBG_NAME(SvxShape)
+
+SvxShape::SvxShape( SdrObject* pObject ) throw()
+: maSize(100,100)
+, mpImpl( new SvxShapeImpl( *this, maMutex ) )
+, mbIsMultiPropertyCall(false)
+, mpPropSet(aSvxMapProvider.GetPropertySet(SVXMAP_SHAPE, SdrObject::GetGlobalDrawObjectItemPool()))
+, maPropMapEntries(aSvxMapProvider.GetMap(SVXMAP_SHAPE))
+, mpObj(pObject)
+, mpModel(NULL)
+, mnLockCount(0)
+{
+ DBG_CTOR(SvxShape,NULL);
+ impl_construct();
+}
+
+//----------------------------------------------------------------------
+SvxShape::SvxShape( SdrObject* pObject, const SfxItemPropertyMapEntry* pEntries, const SvxItemPropertySet* pPropertySet ) throw()
+: maSize(100,100)
+, mpImpl( new SvxShapeImpl( *this, maMutex ) )
+, mbIsMultiPropertyCall(false)
+, mpPropSet(pPropertySet)
+, maPropMapEntries(pEntries)
+, mpObj(pObject)
+, mpModel(NULL)
+, mnLockCount(0)
+{
+ DBG_CTOR(SvxShape,NULL);
+ impl_construct();
+}
+
+//----------------------------------------------------------------------
+SvxShape::SvxShape() throw()
+: maSize(100,100)
+, mpImpl( new SvxShapeImpl( *this, maMutex ) )
+, mbIsMultiPropertyCall(false)
+, mpPropSet(aSvxMapProvider.GetPropertySet(SVXMAP_SHAPE, SdrObject::GetGlobalDrawObjectItemPool()))
+, maPropMapEntries(aSvxMapProvider.GetMap(SVXMAP_SHAPE))
+, mpObj(NULL)
+, mpModel(NULL)
+, mnLockCount(0)
+{
+ DBG_CTOR(SvxShape,NULL);
+ impl_construct();
+}
+
+//----------------------------------------------------------------------
+SvxShape::~SvxShape() throw()
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ DBG_ASSERT( mnLockCount == 0, "Locked shape was disposed!" );
+
+ if ( mpModel )
+ EndListening( *mpModel );
+
+ if ( mpImpl->mpMaster )
+ mpImpl->mpMaster->dispose();
+
+ if ( mpObj.is() )
+ mpObj->setUnoShape( NULL, SdrObject::GrantXShapeAccess() );
+
+ if( HasSdrObjectOwnership() && mpObj.is() )
+ {
+ mpImpl->mbHasSdrObjectOwnership = false;
+ SdrObject* pObject = mpObj.get();
+ SdrObject::Free( pObject );
+ }
+
+ delete mpImpl, mpImpl = NULL;
+
+ DBG_DTOR(SvxShape,NULL);
+}
+
+//----------------------------------------------------------------------
+
+void SvxShape::TakeSdrObjectOwnership()
+{
+ mpImpl->mbHasSdrObjectOwnership = true;
+}
+
+//----------------------------------------------------------------------
+
+bool SvxShape::HasSdrObjectOwnership() const
+{
+ if ( !mpImpl->mbHasSdrObjectOwnership )
+ return false;
+
+ OSL_ENSURE( mpObj.is(), "SvxShape::HasSdrObjectOwnership: have the ownership of an object which I don't know!" );
+ return mpObj.is();
+}
+
+//----------------------------------------------------------------------
+
+void SvxShape::setShapeKind( sal_uInt32 nKind )
+{
+ mpImpl->mnObjId = nKind;
+}
+
+//----------------------------------------------------------------------
+
+sal_uInt32 SvxShape::getShapeKind() const
+{
+ return mpImpl->mnObjId;
+}
+
+//----------------------------------------------------------------------
+
+void SvxShape::setMaster( SvxShapeMaster* pMaster )
+{
+ mpImpl->mpMaster = pMaster;
+}
+
+SvxShapeMaster* SvxShape::getMaster()
+{
+ return mpImpl->mpMaster;
+}
+
+const SvxShapeMaster* SvxShape::getMaster() const
+{
+ return mpImpl->mpMaster;
+}
+
+//----------------------------------------------------------------------
+
+uno::Any SAL_CALL SvxShape::queryAggregation( const uno::Type& rType ) throw (uno::RuntimeException)
+{
+ if( mpImpl->mpMaster )
+ {
+ uno::Any aAny;
+ if( mpImpl->mpMaster->queryAggregation( rType, aAny ) )
+ return aAny;
+ }
+
+ return SvxShape_UnoImplHelper::queryAggregation(rType);
+}
+
+//----------------------------------------------------------------------
+const ::com::sun::star::uno::Sequence< sal_Int8 > & SvxShape::getUnoTunnelId() throw()
+{
+ static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = 0;
+ if( !pSeq )
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !pSeq )
+ {
+ static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+ return *pSeq;
+}
+
+//----------------------------------------------------------------------
+SvxShape* SvxShape::getImplementation( const uno::Reference< uno::XInterface >& xInt )
+{
+ uno::Reference< lang::XUnoTunnel > xUT( xInt, ::com::sun::star::uno::UNO_QUERY );
+ if( xUT.is() )
+ return reinterpret_cast<SvxShape*>(sal::static_int_cast<sal_uIntPtr>(xUT->getSomething( SvxShape::getUnoTunnelId())));
+ else
+ return NULL;
+}
+
+//----------------------------------------------------------------------
+sal_Int64 SAL_CALL SvxShape::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException) \
+{
+ if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+//----------------------------------------------------------------------
+SvxShape* SvxShape::GetShapeForSdrObj( SdrObject* pObj ) throw()
+{
+ return getImplementation( pObj->getUnoShape() );
+}
+
+//----------------------------------------------------------------------
+::svx::PropertyChangeNotifier& SvxShape::getShapePropertyChangeNotifier()
+{
+ return mpImpl->maPropertyNotifier;
+}
+
+//----------------------------------------------------------------------
+void SvxShape::impl_construct()
+{
+ mpImpl->maPropertyNotifier.registerProvider( ::svx::eShapePosition,
+ ::svx::PPropertyValueProvider( new ShapePositionProvider( *mpImpl ) ) );
+ mpImpl->maPropertyNotifier.registerProvider( ::svx::eShapeSize,
+ ::svx::PPropertyValueProvider( new ShapeSizeProvider( *mpImpl ) ) );
+
+ if ( mpObj.is() )
+ impl_initFromSdrObject();
+}
+
+//----------------------------------------------------------------------
+void SvxShape::impl_initFromSdrObject()
+{
+ DBG_TESTSOLARMUTEX();
+ OSL_PRECOND( mpObj.is(), "SvxShape::impl_initFromSdrObject: not to be called without SdrObject!" );
+ if ( !mpObj.is() )
+ return;
+
+ osl_incrementInterlockedCount( &m_refCount );
+ {
+ mpObj->setUnoShape( *this, SdrObject::GrantXShapeAccess() );
+ }
+ osl_decrementInterlockedCount( &m_refCount );
+
+ mpModel = mpObj->GetModel();
+
+ // #i40944#
+ // Do not simply return when no model but do the type corrections
+ // following below.
+ if(mpModel)
+ {
+ StartListening( *mpModel );
+ }
+
+ const sal_uInt32 nInventor = mpObj->GetObjInventor();
+
+ // is it one of ours (svx) ?
+ if( nInventor == SdrInventor || nInventor == E3dInventor || nInventor == FmFormInventor )
+ {
+ if(nInventor == FmFormInventor)
+ {
+ mpImpl->mnObjId = OBJ_UNO;
+ }
+ else
+ {
+ mpImpl->mnObjId = mpObj->GetObjIdentifier();
+ if( nInventor == E3dInventor )
+ mpImpl->mnObjId |= E3D_INVENTOR_FLAG;
+ }
+
+ switch(mpImpl->mnObjId)
+ {
+ case OBJ_CCUT: // Kreisabschnitt
+ case OBJ_CARC: // Kreisbogen
+ case OBJ_SECT: // Kreissektor
+ mpImpl->mnObjId = OBJ_CIRC;
+ break;
+
+ case E3D_SCENE_ID | E3D_INVENTOR_FLAG:
+ mpImpl->mnObjId = E3D_POLYSCENE_ID | E3D_INVENTOR_FLAG;
+ break;
+ }
+ }
+}
+
+//----------------------------------------------------------------------
+void SvxShape::Create( SdrObject* pNewObj, SvxDrawPage* /*pNewPage*/ )
+{
+ DBG_TESTSOLARMUTEX();
+
+ OSL_PRECOND( pNewObj, "SvxShape::Create: invalid new object!" );
+ if ( !pNewObj )
+ return;
+
+ SdrObject* pCreatedObj = mpImpl->mpCreatedObj.get();
+ OSL_ENSURE( ( pCreatedObj == NULL ) || ( pCreatedObj == pNewObj ),
+ "SvxShape::Create: the same shape used for two different objects?! Strange ..." );
+
+ // --> CL, OD 2005-07-19 #i52126# - correct condition
+ if ( pCreatedObj != pNewObj )
+ // <--
+ {
+ DBG_ASSERT( pNewObj->GetModel(), "no model for SdrObject?" );
+ // --> CL, OD 2005-07-19 #i52126#
+ mpImpl->mpCreatedObj = pNewObj;
+ // <--
+
+ if( mpObj.is() && mpObj->GetModel() )
+ {
+ EndListening( *mpObj->GetModel() );
+ }
+
+ mpObj.reset( pNewObj );
+
+ OSL_ENSURE( !mbIsMultiPropertyCall, "SvxShape::Create: hmm?" );
+ // this was previously set in impl_initFromSdrObject, but I think it was superfluous
+ // (it definitely was in the other context where it was called, but I strongly suppose
+ // it was also superfluous when called from here)
+ impl_initFromSdrObject();
+
+ ObtainSettingsFromPropertySet( *mpPropSet );
+
+ // save user call
+ SdrObjUserCall* pUser = mpObj->GetUserCall();
+ mpObj->SetUserCall(NULL);
+
+ setPosition( maPosition );
+ setSize( maSize );
+
+ // restore user call after we set the initial size
+ mpObj->SetUserCall( pUser );
+
+ // if this shape was already named, use this name
+ if( maShapeName.getLength() )
+ {
+ mpObj->SetName( maShapeName );
+ maShapeName = OUString();
+ }
+ }
+}
+
+//----------------------------------------------------------------------
+
+void SvxShape::ChangeModel( SdrModel* pNewModel )
+{
+ DBG_TESTSOLARMUTEX();
+ if( mpObj.is() && mpObj->GetModel() )
+ {
+ if( mpObj->GetModel() != pNewModel )
+ {
+ EndListening( *mpObj->GetModel() );
+ }
+ }
+
+ // --> CL, OD 2005-07-19 #i52126# - always listen to new model
+ if( pNewModel )
+ {
+ StartListening( *pNewModel );
+ }
+ // <--
+
+ // HACK #i53696# ChangeModel should be virtual, but it isn't. can't change that for 2.0.1
+ SvxShapeText* pShapeText = dynamic_cast< SvxShapeText* >( this );
+ if( pShapeText )
+ {
+ SvxTextEditSource* pTextEditSource = dynamic_cast< SvxTextEditSource* >( pShapeText->GetEditSource() );
+ if( pTextEditSource )
+ pTextEditSource->ChangeModel( pNewModel );
+ }
+
+ mpModel = pNewModel;
+
+ if( mpImpl->mpMaster )
+ mpImpl->mpMaster->modelChanged( pNewModel );
+}
+
+//----------------------------------------------------------------------
+
+void SvxShape::ForceMetricToItemPoolMetric(Pair& rPoint) const throw()
+{
+ DBG_TESTSOLARMUTEX();
+ if(mpModel)
+ {
+ SfxMapUnit eMapUnit = mpModel->GetItemPool().GetMetric(0);
+ if(eMapUnit != SFX_MAPUNIT_100TH_MM)
+ {
+ switch(eMapUnit)
+ {
+ case SFX_MAPUNIT_TWIP :
+ {
+ rPoint.A() = MM_TO_TWIPS(rPoint.A());
+ rPoint.B() = MM_TO_TWIPS(rPoint.B());
+ break;
+ }
+ default:
+ {
+ DBG_ERROR("AW: Missing unit translation to PoolMetric!");
+ }
+ }
+ }
+ }
+}
+
+//----------------------------------------------------------------------
+// --> OD 2010-02-19 #i108851# - reintroduction of fix for issue i59051
+void SvxShape::ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon) const throw()
+{
+ DBG_TESTSOLARMUTEX();
+ if(mpModel)
+ {
+ SfxMapUnit eMapUnit = mpModel->GetItemPool().GetMetric(0);
+ if(eMapUnit != SFX_MAPUNIT_100TH_MM)
+ {
+ switch(eMapUnit)
+ {
+ case SFX_MAPUNIT_TWIP :
+ {
+ basegfx::B2DHomMatrix aTransform;
+ const double fMMToTWIPS(72.0 / 127.0);
+
+ aTransform.scale(fMMToTWIPS, fMMToTWIPS);
+ rPolyPolygon.transform(aTransform);
+ break;
+ }
+ default:
+ {
+ DBG_ERROR("Missing unit translation to PoolMetric!");
+ }
+ }
+ }
+ }
+}
+// <--
+
+//----------------------------------------------------------------------
+void SvxShape::ForceMetricTo100th_mm(Pair& rPoint) const throw()
+{
+ DBG_TESTSOLARMUTEX();
+ SfxMapUnit eMapUnit = SFX_MAPUNIT_100TH_MM;
+ if(mpModel)
+ {
+ eMapUnit = mpModel->GetItemPool().GetMetric(0);
+ if(eMapUnit != SFX_MAPUNIT_100TH_MM)
+ {
+ switch(eMapUnit)
+ {
+ case SFX_MAPUNIT_TWIP :
+ {
+ rPoint.A() = TWIPS_TO_MM(rPoint.A());
+ rPoint.B() = TWIPS_TO_MM(rPoint.B());
+ break;
+ }
+ default:
+ {
+ DBG_ERROR("AW: Missing unit translation to 100th mm!");
+ }
+ }
+ }
+ }
+}
+
+//----------------------------------------------------------------------
+// --> OD 2010-02-19 #i108851# - reintroduction of fix for issue i59051
+void SvxShape::ForceMetricTo100th_mm(basegfx::B2DPolyPolygon& rPolyPolygon) const throw()
+{
+ DBG_TESTSOLARMUTEX();
+ SfxMapUnit eMapUnit = SFX_MAPUNIT_100TH_MM;
+ if(mpModel)
+ {
+ eMapUnit = mpModel->GetItemPool().GetMetric(0);
+ if(eMapUnit != SFX_MAPUNIT_100TH_MM)
+ {
+ switch(eMapUnit)
+ {
+ case SFX_MAPUNIT_TWIP :
+ {
+ basegfx::B2DHomMatrix aTransform;
+ const double fTWIPSToMM(127.0 / 72.0);
+ aTransform.scale(fTWIPSToMM, fTWIPSToMM);
+ rPolyPolygon.transform(aTransform);
+ break;
+ }
+ default:
+ {
+ DBG_ERROR("Missing unit translation to 100th mm!");
+ }
+ }
+ }
+ }
+}
+// <--
+//----------------------------------------------------------------------
+
+
+//----------------------------------------------------------------------
+void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet,
+ SfxItemSet& rSet, uno::Reference< beans::XPropertySet > xSet, const SfxItemPropertyMap* pMap )
+{
+ if(rPropSet.AreThereOwnUsrAnys())
+ {
+ const SfxItemPropertyMap* pSrc = rPropSet.getPropertyMap();
+ PropertyEntryVector_t aSrcPropVector = pSrc->getPropertyEntries();
+ PropertyEntryVector_t::const_iterator aSrcIt = aSrcPropVector.begin();
+ while(aSrcIt != aSrcPropVector.end())
+ {
+ if(aSrcIt->nWID)
+ {
+ uno::Any* pUsrAny = rPropSet.GetUsrAnyForID(aSrcIt->nWID);
+ if(pUsrAny)
+ {
+ // Aequivalenten Eintrag in pDst suchen
+ const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( aSrcIt->sName );
+ if(pEntry)
+ {
+ // entry found
+ if(pEntry->nWID >= OWN_ATTR_VALUE_START && pEntry->nWID <= OWN_ATTR_VALUE_END)
+ {
+ // Special ID im PropertySet, kann nur direkt am
+ // Objekt gesetzt werden+
+ xSet->setPropertyValue( aSrcIt->sName, *pUsrAny);
+ }
+ else
+ {
+ if(rSet.GetPool()->IsWhich(pEntry->nWID))
+ rSet.Put(rSet.GetPool()->GetDefaultItem(pEntry->nWID));
+ // setzen
+ SvxItemPropertySet_setPropertyValue(rPropSet, pEntry, *pUsrAny, rSet);
+ }
+ }
+ }
+ }
+
+ // next entry
+ ++aSrcIt;
+ }
+ const_cast< SvxItemPropertySet& >(rPropSet).ClearAllUsrAny();
+ }
+}
+
+
+void SvxShape::ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet)
+{
+ DBG_TESTSOLARMUTEX();
+ if(mpObj.is() && rPropSet.AreThereOwnUsrAnys() && mpModel)
+ {
+ SfxItemSet aSet( mpModel->GetItemPool(), SDRATTR_START, SDRATTR_END, 0);
+ Reference< beans::XPropertySet > xShape( (OWeakObject*)this, UNO_QUERY );
+ SvxItemPropertySet_ObtainSettingsFromPropertySet(rPropSet, aSet, xShape, mpPropSet->getPropertyMap() );
+
+ mpObj->SetMergedItemSetAndBroadcast(aSet);
+
+ mpObj->ApplyNotPersistAttr( aSet );
+ }
+}
+
+//----------------------------------------------------------------------
+
+uno::Any SvxShape::GetBitmap( sal_Bool bMetaFile /* = sal_False */ ) const throw()
+{
+ DBG_TESTSOLARMUTEX();
+ uno::Any aAny;
+
+ if( !mpObj.is() || mpModel == NULL || !mpObj->IsInserted() || NULL == mpObj->GetPage() )
+ return aAny;
+
+ VirtualDevice aVDev;
+ aVDev.SetMapMode(MapMode(MAP_100TH_MM));
+
+ SdrModel* pModel = mpObj->GetModel();
+ SdrPage* pPage = mpObj->GetPage();
+
+ E3dView* pView = new E3dView( pModel, &aVDev );
+ pView->hideMarkHandles();
+ SdrPageView* pPageView = pView->ShowSdrPage(pPage);
+
+ SdrObject *pTempObj = mpObj.get();
+ pView->MarkObj(pTempObj,pPageView);
+
+ Rectangle aRect(pTempObj->GetCurrentBoundRect());
+ aRect.Justify();
+ Size aSize(aRect.GetSize());
+
+ GDIMetaFile aMtf( pView->GetAllMarkedMetaFile() );
+ if( bMetaFile )
+ {
+ SvMemoryStream aDestStrm( 65535, 65535 );
+ ConvertGDIMetaFileToWMF( aMtf, aDestStrm, NULL, sal_False );
+ const uno::Sequence<sal_Int8> aSeq(
+ static_cast< const sal_Int8* >(aDestStrm.GetData()),
+ aDestStrm.GetEndOfData());
+ aAny.setValue( &aSeq, ::getCppuType((const uno::Sequence< sal_Int8 >*)0) );
+ }
+ else
+ {
+ Graphic aGraph(aMtf);
+ aGraph.SetPrefSize(aSize);
+ aGraph.SetPrefMapMode(MAP_100TH_MM);
+
+ Reference< awt::XBitmap > xBmp( aGraph.GetXGraphic(), UNO_QUERY );
+ aAny <<= xBmp;
+ }
+
+ pView->UnmarkAll();
+ delete pView;
+
+ return aAny;
+}
+
+//----------------------------------------------------------------------
+
+uno::Sequence< uno::Type > SAL_CALL SvxShape::getTypes()
+ throw (uno::RuntimeException)
+{
+ if( mpImpl->mpMaster )
+ {
+ return mpImpl->mpMaster->getTypes();
+ }
+ else
+ {
+ return _getTypes();
+ }
+}
+
+//----------------------------------------------------------------------
+
+uno::Sequence< uno::Type > SAL_CALL SvxShape::_getTypes()
+ throw(uno::RuntimeException)
+{
+ switch( mpImpl->mnObjId )
+ {
+ // shapes without text
+ case OBJ_OLE2:
+ case OBJ_PAGE:
+ case OBJ_FRAME:
+ case OBJ_OLE2_PLUGIN:
+ case OBJ_OLE2_APPLET:
+ case E3D_CUBEOBJ_ID|E3D_INVENTOR_FLAG:
+ case E3D_SPHEREOBJ_ID|E3D_INVENTOR_FLAG:
+ case E3D_LATHEOBJ_ID|E3D_INVENTOR_FLAG:
+ case E3D_EXTRUDEOBJ_ID|E3D_INVENTOR_FLAG:
+ case E3D_POLYGONOBJ_ID|E3D_INVENTOR_FLAG:
+ case OBJ_MEDIA:
+ {
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypeSequence;
+
+ if( aTypeSequence.getLength() == 0 )
+ {
+ // Ready for multithreading; get global mutex for first call of this method only! see before
+ MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
+
+ // Control these pointer again ... it can be, that another instance will be faster then these!
+ if( aTypeSequence.getLength() == 0 )
+ {
+ aTypeSequence.realloc( 12 );
+ uno::Type* pTypes = aTypeSequence.getArray();
+
+ *pTypes++ = ::getCppuType((const uno::Reference< drawing::XShape >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XComponent >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertySet >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XMultiPropertySet >*)0);
+// *pTypes++ = ::getCppuType((const uno::Reference< beans::XTolerantMultiPropertySet >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertyState >*)0);
+ *pTypes++ = beans::XMultiPropertyStates::static_type();
+ *pTypes++ = ::getCppuType((const uno::Reference< drawing::XGluePointsSupplier >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< container::XChild >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XTypeProvider >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XUnoTunnel >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< container::XNamed >*)0);
+ }
+ }
+ return aTypeSequence;
+ }
+ // group shape
+ case OBJ_GRUP:
+ {
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypeSequence;
+
+ if( aTypeSequence.getLength() == 0 )
+ {
+ // Ready for multithreading; get global mutex for first call of this method only! see before
+ MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
+
+ // Control these pointer again ... it can be, that another instance will be faster then these!
+ if( aTypeSequence.getLength() == 0 )
+ {
+ aTypeSequence.realloc( 14 );
+ uno::Type* pTypes = aTypeSequence.getArray();
+
+ *pTypes++ = ::getCppuType((const uno::Reference< drawing::XShape >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XComponent >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertySet >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XMultiPropertySet >*)0);
+// *pTypes++ = ::getCppuType((const uno::Reference< beans::XTolerantMultiPropertySet >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertyState >*)0);
+ *pTypes++ = beans::XMultiPropertyStates::static_type();
+ *pTypes++ = ::getCppuType((const uno::Reference< drawing::XGluePointsSupplier >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< container::XChild >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XTypeProvider >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XUnoTunnel >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< container::XNamed >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< drawing::XShapes>*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< drawing::XShapeGroup>*)0);
+ }
+ }
+ return aTypeSequence;
+ }
+ // connector shape
+ case OBJ_EDGE:
+ {
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypeSequence;
+
+ if( aTypeSequence.getLength() == 0 )
+ {
+ // Ready for multithreading; get global mutex for first call of this method only! see before
+ MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
+
+ // Control these pointer again ... it can be, that another instance will be faster then these!
+ if( aTypeSequence.getLength() == 0 )
+ {
+ aTypeSequence.realloc( 17 );
+ uno::Type* pTypes = aTypeSequence.getArray();
+
+ *pTypes++ = ::getCppuType((const uno::Reference< drawing::XShape >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XComponent >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertySet >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XMultiPropertySet >*)0);
+// *pTypes++ = ::getCppuType((const uno::Reference< beans::XTolerantMultiPropertySet >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertyState >*)0);
+ *pTypes++ = beans::XMultiPropertyStates::static_type();
+ *pTypes++ = ::getCppuType((const uno::Reference< drawing::XGluePointsSupplier >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< container::XChild >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XTypeProvider >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XUnoTunnel >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< container::XNamed >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< drawing::XConnectorShape>*)0);
+ // from SvxUnoTextBase::getTypes()
+ *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextAppend >*)0);
+ *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextCopy >*)0);
+ *pTypes++ = ::getCppuType(( const uno::Reference< container::XEnumerationAccess >*)0);
+ *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeMover >*)0);
+ }
+ }
+ return aTypeSequence;
+ }
+ // control shape
+ case OBJ_UNO:
+ {
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypeSequence;
+
+ if( aTypeSequence.getLength() == 0 )
+ {
+ // Ready for multithreading; get global mutex for first call of this method only! see before
+ MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
+
+ // Control these pointer again ... it can be, that another instance will be faster then these!
+ if( aTypeSequence.getLength() == 0 )
+ {
+ aTypeSequence.realloc( 13 );
+ uno::Type* pTypes = aTypeSequence.getArray();
+
+ *pTypes++ = ::getCppuType((const uno::Reference< drawing::XShape >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XComponent >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertySet >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XMultiPropertySet >*)0);
+// *pTypes++ = ::getCppuType((const uno::Reference< beans::XTolerantMultiPropertySet >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertyState >*)0);
+ *pTypes++ = beans::XMultiPropertyStates::static_type();
+ *pTypes++ = ::getCppuType((const uno::Reference< drawing::XGluePointsSupplier >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< container::XChild >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XTypeProvider >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XUnoTunnel >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< container::XNamed >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< drawing::XControlShape>*)0);
+ }
+ }
+ return aTypeSequence;
+ }
+ // 3d scene shape
+ case E3D_POLYSCENE_ID|E3D_INVENTOR_FLAG:
+ {
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypeSequence;
+
+ if( aTypeSequence.getLength() == 0 )
+ {
+ // Ready for multithreading; get global mutex for first call of this method only! see before
+ MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
+
+ // Control these pointer again ... it can be, that another instance will be faster then these!
+ if( aTypeSequence.getLength() == 0 )
+ {
+ aTypeSequence.realloc( 13 );
+ uno::Type* pTypes = aTypeSequence.getArray();
+
+ *pTypes++ = ::getCppuType((const uno::Reference< drawing::XShape >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XComponent >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertySet >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XMultiPropertySet >*)0);
+// *pTypes++ = ::getCppuType((const uno::Reference< beans::XTolerantMultiPropertySet >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertyState >*)0);
+ *pTypes++ = beans::XMultiPropertyStates::static_type();
+ *pTypes++ = ::getCppuType((const uno::Reference< drawing::XGluePointsSupplier >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< container::XChild >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XTypeProvider >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XUnoTunnel >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< container::XNamed >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< drawing::XShapes>*)0);
+ }
+ }
+ return aTypeSequence;
+ }
+ case OBJ_CUSTOMSHAPE:
+ {
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypeSequence;
+
+ if( aTypeSequence.getLength() == 0 )
+ {
+ // Ready for multithreading; get global mutex for first call of this method only! see before
+ MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
+
+ // Control these pointer again ... it can be, that another instance will be faster then these!
+ if( aTypeSequence.getLength() == 0 )
+ {
+ aTypeSequence.realloc( 16 );
+ uno::Type* pTypes = aTypeSequence.getArray();
+
+ *pTypes++ = ::getCppuType((const uno::Reference< drawing::XShape >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XComponent >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertySet >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XMultiPropertySet >*)0);
+// *pTypes++ = ::getCppuType((const uno::Reference< beans::XTolerantMultiPropertySet >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertyState >*)0);
+ *pTypes++ = beans::XMultiPropertyStates::static_type();
+ *pTypes++ = ::getCppuType((const uno::Reference< drawing::XGluePointsSupplier >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< container::XChild >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XTypeProvider >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XUnoTunnel >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< container::XNamed >*)0);
+ // from SvxUnoTextBase::getTypes()
+ *pTypes++ = ::getCppuType(( const uno::Reference< text::XText >*)0);
+ *pTypes++ = ::getCppuType(( const uno::Reference< container::XEnumerationAccess >*)0);
+ *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeMover >*)0);
+ *pTypes++ = ::getCppuType(( const uno::Reference< drawing::XEnhancedCustomShapeDefaulter >*)0);
+ }
+ }
+ return aTypeSequence;
+ }
+ // shapes with text
+ case OBJ_RECT:
+ case OBJ_CIRC:
+ case OBJ_MEASURE:
+ case OBJ_LINE:
+ case OBJ_POLY:
+ case OBJ_PLIN:
+ case OBJ_PATHLINE:
+ case OBJ_PATHFILL:
+ case OBJ_FREELINE:
+ case OBJ_FREEFILL:
+ case OBJ_PATHPOLY:
+ case OBJ_PATHPLIN:
+ case OBJ_GRAF:
+ case OBJ_TEXT:
+ case OBJ_CAPTION:
+ case OBJ_TABLE:
+ default:
+ {
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > aTypeSequence;
+
+ if( aTypeSequence.getLength() == 0 )
+ {
+ // Ready for multithreading; get global mutex for first call of this method only! see before
+ MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
+
+ // Control these pointer again ... it can be, that another instance will be faster then these!
+ if( aTypeSequence.getLength() == 0 )
+ {
+ aTypeSequence.realloc( 16 );
+ uno::Type* pTypes = aTypeSequence.getArray();
+
+ *pTypes++ = ::getCppuType((const uno::Reference< drawing::XShape >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XComponent >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertySet >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XMultiPropertySet >*)0);
+// *pTypes++ = ::getCppuType((const uno::Reference< beans::XTolerantMultiPropertySet >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertyState >*)0);
+ *pTypes++ = beans::XMultiPropertyStates::static_type();
+ *pTypes++ = ::getCppuType((const uno::Reference< drawing::XGluePointsSupplier >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< container::XChild >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XTypeProvider >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XUnoTunnel >*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< container::XNamed >*)0);
+ // from SvxUnoTextBase::getTypes()
+ *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextAppend >*)0);
+ *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextCopy >*)0);
+ *pTypes++ = ::getCppuType(( const uno::Reference< container::XEnumerationAccess >*)0);
+ *pTypes++ = ::getCppuType(( const uno::Reference< text::XTextRangeMover >*)0);
+ }
+ }
+ return aTypeSequence;
+ }
+ }
+}
+
+//----------------------------------------------------------------------
+
+uno::Sequence< sal_Int8 > SAL_CALL SvxShape::getImplementationId()
+ throw (uno::RuntimeException)
+{
+ static ::cppu::OImplementationId* pID = NULL ;
+
+ if ( pID == NULL )
+ {
+ // Ready for multithreading; get global mutex for first call of this method only! see before
+ MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
+
+ // Control these pointer again ... it can be, that another instance will be faster then these!
+ if ( pID == NULL )
+ {
+ // Create a new static ID ...
+ static ::cppu::OImplementationId aID( sal_False ) ;
+ // ... and set his address to static pointer!
+ pID = &aID ;
+ }
+ }
+
+ return pID->getImplementationId() ;
+}
+
+//----------------------------------------------------------------------
+
+Reference< uno::XInterface > SvxShape_NewInstance()
+{
+ return uno::Reference< uno::XInterface >(static_cast< OWeakObject* >( new SvxShape() ) );
+}
+
+//----------------------------------------------------------------------
+
+void SvxShape::onUserCall(SdrUserCallType /*_eUserCall*/, const Rectangle& /*_rNewBoundRect*/ )
+{
+ // obsolete, not called anymore
+}
+
+//----------------------------------------------------------------------
+// SfxListener
+//----------------------------------------------------------------------
+
+void SvxShape::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw()
+{
+ DBG_TESTSOLARMUTEX();
+ if( !mpObj.is() )
+ return;
+
+ // #i55919# HINT_OBJCHG is only interesting if it's for this object
+
+ const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
+ if (!pSdrHint || ( /* (pSdrHint->GetKind() != HINT_OBJREMOVED) && */
+ (pSdrHint->GetKind() != HINT_MODELCLEARED) &&
+ // #110094#-9 (pSdrHint->GetKind() != HINT_OBJLISTCLEAR) &&
+ ((pSdrHint->GetKind() != HINT_OBJCHG || pSdrHint->GetObject() != mpObj.get() ))))
+ return;
+
+ uno::Reference< uno::XInterface > xSelf( mpObj->getWeakUnoShape() );
+ if( !xSelf.is() )
+ {
+ mpObj.reset( NULL );
+ return;
+ }
+
+ sal_Bool bClearMe = sal_False;
+
+ switch( pSdrHint->GetKind() )
+ {
+ case HINT_OBJCHG:
+ {
+ updateShapeKind();
+ break;
+ }
+ case HINT_MODELCLEARED:
+ {
+ bClearMe = sal_True;
+ mpModel = NULL;
+ break;
+ }
+ default:
+ break;
+ };
+
+ if( bClearMe )
+ {
+ if( !HasSdrObjectOwnership() )
+ mpObj.reset( NULL );
+ if ( !mpImpl->mbDisposing )
+ dispose();
+ }
+}
+
+// XShape
+
+//----------------------------------------------------------------------
+// The "*LogicRectHack" functions also existed in sch, and those
+// duplicate symbols cause Bad Things To Happen (TM) #i9462#.
+// Prefixing with 'svx' and marking static to make sure name collisions
+// do not occur.
+
+static sal_Bool svx_needLogicRectHack( SdrObject* pObj )
+{
+ if( pObj->GetObjInventor() == SdrInventor)
+ {
+ switch(pObj->GetObjIdentifier())
+ {
+ case OBJ_GRUP:
+ case OBJ_LINE:
+ case OBJ_POLY:
+ case OBJ_PLIN:
+ case OBJ_PATHLINE:
+ case OBJ_PATHFILL:
+ case OBJ_FREELINE:
+ case OBJ_FREEFILL:
+ case OBJ_SPLNLINE:
+ case OBJ_SPLNFILL:
+ case OBJ_EDGE:
+ case OBJ_PATHPOLY:
+ case OBJ_PATHPLIN:
+ case OBJ_MEASURE:
+ return sal_True;
+ }
+ }
+ return sal_False;
+}
+
+//----------------------------------------------------------------------
+
+static Rectangle svx_getLogicRectHack( SdrObject* pObj )
+{
+ if(svx_needLogicRectHack(pObj))
+ {
+ return pObj->GetSnapRect();
+ }
+ else
+ {
+ return pObj->GetLogicRect();
+ }
+}
+
+//----------------------------------------------------------------------
+
+static void svx_setLogicRectHack( SdrObject* pObj, const Rectangle& rRect )
+{
+ if(svx_needLogicRectHack(pObj))
+ {
+ pObj->SetSnapRect( rRect );
+ }
+ else
+ {
+ pObj->SetLogicRect( rRect );
+ }
+}
+
+//----------------------------------------------------------------------
+
+awt::Point SAL_CALL SvxShape::getPosition() throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mpObj.is() && mpModel)
+ {
+ Rectangle aRect( svx_getLogicRectHack(mpObj.get()) );
+ Point aPt( aRect.Left(), aRect.Top() );
+
+ // Position is relativ to anchor, so recalc to absolut position
+ if( mpModel->IsWriter() )
+ aPt -= mpObj->GetAnchorPos();
+
+ ForceMetricTo100th_mm(aPt);
+ return ::com::sun::star::awt::Point( aPt.X(), aPt.Y() );
+ }
+ else
+ {
+ return maPosition;
+ }
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SvxShape::setPosition( const awt::Point& Position ) throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mpObj.is() && mpModel )
+ {
+ // do NOT move 3D objects, this would change the homogen
+ // transformation matrix
+ if(!mpObj->ISA(E3dCompoundObject))
+ {
+ Rectangle aRect( svx_getLogicRectHack(mpObj.get()) );
+ Point aLocalPos( Position.X, Position.Y );
+ ForceMetricToItemPoolMetric(aLocalPos);
+
+ // Position ist absolut, relativ zum Anker stellen
+ if( mpModel->IsWriter() )
+ aLocalPos += mpObj->GetAnchorPos();
+
+ long nDX = aLocalPos.X() - aRect.Left();
+ long nDY = aLocalPos.Y() - aRect.Top();
+
+ mpObj->Move( Size( nDX, nDY ) );
+ mpModel->SetChanged();
+ }
+ }
+
+ maPosition = Position;
+}
+
+//----------------------------------------------------------------------
+awt::Size SAL_CALL SvxShape::getSize() throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mpObj.is() && mpModel)
+ {
+ Rectangle aRect( svx_getLogicRectHack(mpObj.get()) );
+ Size aObjSize( aRect.getWidth(), aRect.getHeight() );
+ ForceMetricTo100th_mm(aObjSize);
+ return ::com::sun::star::awt::Size( aObjSize.getWidth(), aObjSize.getHeight() );
+ }
+ else
+ return maSize;
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SvxShape::setSize( const awt::Size& rSize )
+ throw(beans::PropertyVetoException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mpObj.is() && mpModel)
+ {
+ Rectangle aRect( svx_getLogicRectHack(mpObj.get()) );
+ Size aLocalSize( rSize.Width, rSize.Height );
+ ForceMetricToItemPoolMetric(aLocalSize);
+
+ if(mpObj->GetObjInventor() == SdrInventor && mpObj->GetObjIdentifier() == OBJ_MEASURE )
+ {
+ Fraction aWdt(aLocalSize.Width(),aRect.Right()-aRect.Left());
+ Fraction aHgt(aLocalSize.Height(),aRect.Bottom()-aRect.Top());
+ Point aPt = mpObj->GetSnapRect().TopLeft();
+ mpObj->Resize(aPt,aWdt,aHgt);
+ }
+ else
+ {
+ //aRect.SetSize(aLocalSize); // this call substract 1 // http://www.openoffice.org/issues/show_bug.cgi?id=83193
+ if ( !aLocalSize.Width() )
+ {
+ aRect.Right() = RECT_EMPTY;
+ }
+ else
+ aRect.setWidth(aLocalSize.Width());
+ if ( !aLocalSize.Height() )
+ {
+ aRect.Bottom() = RECT_EMPTY;
+ }
+ else
+ aRect.setHeight(aLocalSize.Height());
+
+ svx_setLogicRectHack( mpObj.get(), aRect );
+ }
+
+ mpModel->SetChanged();
+ }
+ maSize = rSize;
+}
+
+//----------------------------------------------------------------------
+
+// XNamed
+OUString SAL_CALL SvxShape::getName( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ if( mpObj.is() )
+ {
+ return mpObj->GetName();
+ }
+ else
+ {
+ return maShapeName;
+ }
+}
+
+//----------------------------------------------------------------------
+
+void SAL_CALL SvxShape::setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ if( mpObj.is() )
+ {
+ mpObj->SetName( aName );
+ }
+ else
+ {
+ maShapeName = aName;
+ }
+}
+
+// XShapeDescriptor
+
+//----------------------------------------------------------------------
+OUString SAL_CALL SvxShape::getShapeType() throw(uno::RuntimeException)
+{
+ if( 0 == maShapeType.getLength() )
+ {
+ UHashMapEntry* pMap = pSdrShapeIdentifierMap;
+ while ( ( pMap->nId != mpImpl->mnObjId ) && pMap->aIdentifier.getLength() )
+ ++pMap;
+
+ if ( pMap->aIdentifier.getLength() )
+ {
+ return pMap->aIdentifier;
+ }
+ else
+ {
+ DBG_ERROR("[CL] unknown SdrObjekt identifier");
+ }
+ }
+
+ return maShapeType;
+}
+
+// XComponent
+
+//----------------------------------------------------------------------
+void SAL_CALL SvxShape::dispose() throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mpImpl->mbDisposing )
+ return; // caught a recursion
+
+ mpImpl->mbDisposing = true;
+
+ lang::EventObject aEvt;
+ aEvt.Source = *(OWeakAggObject*) this;
+ mpImpl->maDisposeListeners.disposeAndClear(aEvt);
+ mpImpl->maPropertyNotifier.disposing();
+
+ if ( mpObj.is() )
+ {
+ bool bFreeSdrObject = false;
+
+ if ( mpObj->IsInserted() && mpObj->GetPage() )
+ {
+ OSL_ENSURE( HasSdrObjectOwnership(), "SvxShape::dispose: is the below code correct?" );
+ // normally, we are allowed to free the SdrObject only if we have its ownership.
+ // Why isn't this checked here?
+
+ SdrPage* pPage = mpObj->GetPage();
+ // SdrObject aus der Page loeschen
+ sal_uInt32 nCount = pPage->GetObjCount();
+ for ( sal_uInt32 nNum = 0; nNum < nCount; ++nNum )
+ {
+ if ( pPage->GetObj( nNum ) == mpObj.get() )
+ {
+ OSL_VERIFY( pPage->RemoveObject( nNum ) == mpObj.get() );
+ bFreeSdrObject = true;
+ break;
+ }
+ }
+ }
+
+ mpObj->setUnoShape( NULL, SdrObject::GrantXShapeAccess() );
+
+ if ( bFreeSdrObject )
+ {
+ // in case we have the ownership of the SdrObject, a Free
+ // would do nothing. So ensure the ownership is reset.
+ mpImpl->mbHasSdrObjectOwnership = false;
+ SdrObject* pObject = mpObj.get();
+ SdrObject::Free( pObject );
+ }
+ }
+
+ if( mpModel )
+ {
+ EndListening( *mpModel );
+ mpModel = NULL;
+ }
+}
+
+//----------------------------------------------------------------------
+
+void SAL_CALL SvxShape::addEventListener( const Reference< lang::XEventListener >& xListener )
+ throw(uno::RuntimeException)
+{
+ mpImpl->maDisposeListeners.addInterface(xListener);
+}
+
+//----------------------------------------------------------------------
+
+void SAL_CALL SvxShape::removeEventListener( const Reference< lang::XEventListener >& aListener ) throw(uno::RuntimeException)
+{
+ mpImpl->maDisposeListeners.removeInterface(aListener);
+}
+
+// XPropertySet
+
+//----------------------------------------------------------------------
+
+Reference< beans::XPropertySetInfo > SAL_CALL
+ SvxShape::getPropertySetInfo() throw(uno::RuntimeException)
+{
+ if( mpImpl->mpMaster )
+ {
+ return mpImpl->mpMaster->getPropertySetInfo();
+ }
+ else
+ {
+ return _getPropertySetInfo();
+ }
+}
+
+Reference< beans::XPropertySetInfo > SAL_CALL
+ SvxShape::_getPropertySetInfo() throw(uno::RuntimeException)
+{
+ return mpPropSet->getPropertySetInfo();
+}
+
+//----------------------------------------------------------------------
+
+void SAL_CALL SvxShape::addPropertyChangeListener( const OUString& _propertyName, const Reference< beans::XPropertyChangeListener >& _listener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( maMutex );
+ mpImpl->maPropertyNotifier.addPropertyChangeListener( _propertyName, _listener );
+}
+
+//----------------------------------------------------------------------
+
+void SAL_CALL SvxShape::removePropertyChangeListener( const OUString& _propertyName, const Reference< beans::XPropertyChangeListener >& _listener ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( maMutex );
+ mpImpl->maPropertyNotifier.removePropertyChangeListener( _propertyName, _listener );
+}
+
+//----------------------------------------------------------------------
+
+void SAL_CALL SvxShape::addVetoableChangeListener( const OUString& , const Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE( false, "SvxShape::addVetoableChangeListener: don't have any vetoable properties, so why ...?" );
+}
+
+//----------------------------------------------------------------------
+
+void SAL_CALL SvxShape::removeVetoableChangeListener( const OUString& , const Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE( false, "SvxShape::removeVetoableChangeListener: don't have any vetoable properties, so why ...?" );
+}
+
+//----------------------------------------------------------------------
+
+sal_Bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const OUString& rName )
+{
+ SfxItemSet aSet( mpModel->GetItemPool(), (sal_uInt16)nWID, (sal_uInt16)nWID );
+
+ if( SetFillAttribute( nWID, rName, aSet, mpModel ) )
+ {
+ //mpObj->SetItemSetAndBroadcast(aSet);
+ mpObj->SetMergedItemSetAndBroadcast(aSet);
+
+ return sal_True;
+ }
+ else
+ {
+ return sal_False;
+ }
+}
+
+//----------------------------------------------------------------------
+
+sal_Bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const ::rtl::OUString& rName, SfxItemSet& rSet, SdrModel* pModel )
+{
+ // check if an item with the given name and which id is inside the models
+ // pool or the stylesheet pool, if found its puttet in the itemse
+ if( !SetFillAttribute( nWID, rName, rSet ) )
+ {
+ // we did not find such item in one of the pools, so we check
+ // the property lists that are loaded for the model for items
+ // that support such.
+ String aStrName;
+ SvxUnogetInternalNameForItem( (sal_Int16)nWID, rName, aStrName );
+
+ switch( nWID )
+ {
+ case XATTR_FILLBITMAP:
+ {
+ XBitmapList* pBitmapList = pModel->GetBitmapList();
+
+ if( !pBitmapList )
+ return sal_False;
+
+ long nPos = ((XPropertyList*)pBitmapList)->Get(aStrName);
+ if( nPos == -1 )
+ return sal_False;
+
+ XBitmapEntry* pEntry = pBitmapList->GetBitmap( nPos );
+ XFillBitmapItem aBmpItem;
+ aBmpItem.SetWhich( XATTR_FILLBITMAP );
+ aBmpItem.SetName( rName );
+ aBmpItem.SetBitmapValue( pEntry->GetXBitmap() );
+ rSet.Put( aBmpItem );
+ break;
+ }
+ case XATTR_FILLGRADIENT:
+ {
+ XGradientList* pGradientList = pModel->GetGradientList();
+
+ if( !pGradientList )
+ return sal_False;
+
+ long nPos = ((XPropertyList*)pGradientList)->Get(aStrName);
+ if( nPos == -1 )
+ return sal_False;
+
+ XGradientEntry* pEntry = pGradientList->GetGradient( nPos );
+ XFillGradientItem aGrdItem;
+ aGrdItem.SetWhich( XATTR_FILLGRADIENT );
+ aGrdItem.SetName( rName );
+ aGrdItem.SetGradientValue( pEntry->GetGradient() );
+ rSet.Put( aGrdItem );
+ break;
+ }
+ case XATTR_FILLHATCH:
+ {
+ XHatchList* pHatchList = pModel->GetHatchList();
+
+ if( !pHatchList )
+ return sal_False;
+
+ long nPos = ((XPropertyList*)pHatchList)->Get(aStrName);
+ if( nPos == -1 )
+ return sal_False;
+
+ XHatchEntry* pEntry = pHatchList->GetHatch( nPos );
+ XFillHatchItem aHatchItem;
+ aHatchItem.SetWhich( XATTR_FILLHATCH );
+ aHatchItem.SetName( rName );
+ aHatchItem.SetHatchValue( pEntry->GetHatch() );
+ rSet.Put( aHatchItem );
+ break;
+ }
+ case XATTR_LINEEND:
+ case XATTR_LINESTART:
+ {
+ XLineEndList* pLineEndList = pModel->GetLineEndList();
+
+ if( !pLineEndList )
+ return sal_False;
+
+ long nPos = ((XPropertyList*)pLineEndList)->Get(aStrName);
+ if( nPos == -1 )
+ return sal_False;
+
+ XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos );
+ if( XATTR_LINEEND == nWID )
+ {
+ XLineEndItem aLEItem;
+ aLEItem.SetWhich( XATTR_LINEEND );
+ aLEItem.SetName( rName );
+ aLEItem.SetLineEndValue( pEntry->GetLineEnd() );
+ rSet.Put( aLEItem );
+ }
+ else
+ {
+ XLineStartItem aLSItem;
+ aLSItem.SetWhich( XATTR_LINESTART );
+ aLSItem.SetName( rName );
+ aLSItem.SetLineStartValue( pEntry->GetLineEnd() );
+ rSet.Put( aLSItem );
+ }
+
+ break;
+ }
+ case XATTR_LINEDASH:
+ {
+ XDashList* pDashList = pModel->GetDashList();
+
+ if( !pDashList )
+ return sal_False;
+
+ long nPos = ((XPropertyList*)pDashList)->Get(aStrName);
+ if( nPos == -1 )
+ return sal_False;
+
+ XDashEntry* pEntry = pDashList->GetDash( nPos );
+ XLineDashItem aDashItem;
+ aDashItem.SetWhich( XATTR_LINEDASH );
+ aDashItem.SetName( rName );
+ aDashItem.SetDashValue( pEntry->GetDash() );
+ rSet.Put( aDashItem );
+ break;
+ }
+ default:
+ return sal_False;
+ }
+ }
+
+ return sal_True;
+}
+
+//----------------------------------------------------------------------
+
+sal_Bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const OUString& rName, SfxItemSet& rSet )
+{
+ String aName;
+ SvxUnogetInternalNameForItem( (sal_Int16)nWID, rName, aName );
+
+ if( aName.Len() == 0 )
+ {
+ switch( nWID )
+ {
+ case XATTR_LINEEND:
+ case XATTR_LINESTART:
+ {
+ const String aEmpty;
+ const basegfx::B2DPolyPolygon aEmptyPoly;
+ if( nWID == XATTR_LINEEND )
+ rSet.Put( XLineEndItem( aEmpty, aEmptyPoly ) );
+ else
+ rSet.Put( XLineStartItem( aEmpty, aEmptyPoly ) );
+
+ return sal_True;
+ }
+ case XATTR_FILLFLOATTRANSPARENCE:
+ {
+ // #85953# Set a disabled XFillFloatTransparenceItem
+ rSet.Put(XFillFloatTransparenceItem());
+
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+ }
+
+ const SfxItemPool* pPool = rSet.GetPool();
+
+ const String aSearchName( aName );
+ const sal_uInt32 nCount = pPool->GetItemCount2((sal_uInt16)nWID);
+ const NameOrIndex* pItem;
+
+ for( sal_uInt32 nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
+ {
+ pItem = (NameOrIndex*)pPool->GetItem2((sal_uInt16)nWID, nSurrogate);
+ if( pItem && ( pItem->GetName() == aSearchName ) )
+ {
+ rSet.Put( *pItem );
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+//----------------------------------------------------------------------
+
+// static
+/* os: unused function
+ uno::Any SAL_CALL SvxShape::GetFillAttributeByName(
+ const ::rtl::OUString& rPropertyName, const ::rtl::OUString& rName, SdrModel* pModel )
+{
+ uno::Any aResult;
+ DBG_ASSERT( pModel, "Invalid Model in GetFillAttributeByName()" );
+ if( ! pModel )
+ return aResult;
+
+ sal_Int16 nWhich = SvxUnoGetWhichIdForNamedProperty( rPropertyName );
+
+ // search pool for item
+ const SfxItemPool& rPool = pModel->GetItemPool();
+
+ const String aSearchName( rName );
+ const sal_uInt32 nCount = rPool.GetItemCount((sal_uInt16)nWhich);
+ const NameOrIndex* pItem = 0;
+ bool bFound = false;
+
+ for( sal_uInt32 nSurrogate = 0; ! bFound && nSurrogate < nCount; nSurrogate++ )
+ {
+ pItem = (NameOrIndex*)rPool.GetItem((sal_uInt16)nWhich, nSurrogate);
+ if( pItem && ( pItem->GetName() == aSearchName ) )
+ {
+ bFound = true;
+ }
+ }
+
+ // check the property lists that are loaded for the model for items that
+ // support such.
+ String aStrName;
+ SvxUnogetInternalNameForItem( nWhich, rName, aStrName );
+
+ switch( nWhich )
+ {
+ case XATTR_FILLBITMAP:
+ {
+ XFillBitmapItem aBmpItem;
+ if( ! bFound )
+ {
+ XBitmapList* pBitmapList = pModel->GetBitmapList();
+
+ if( !pBitmapList )
+ break;
+
+ long nPos = ((XPropertyList*)pBitmapList)->Get(aStrName);
+ if( nPos == -1 )
+ break;
+
+ XBitmapEntry* pEntry = pBitmapList->GetBitmap( nPos );
+ aBmpItem.SetWhich( XATTR_FILLBITMAP );
+ aBmpItem.SetName( rName );
+ aBmpItem.SetBitmapValue( pEntry->GetXBitmap() );
+ pItem = & aBmpItem;
+ }
+ DBG_ASSERT( pItem, "Invalid Item" );
+ if( pItem )
+ pItem->QueryValue( aResult ); // default: XBitmap. MID_GRAFURL instead?
+ }
+ break;
+
+ case XATTR_FILLGRADIENT:
+ {
+ XFillGradientItem aGrdItem;
+ if( ! bFound )
+ {
+ XGradientList* pGradientList = pModel->GetGradientList();
+
+ if( !pGradientList )
+ break;
+
+ long nPos = ((XPropertyList*)pGradientList)->Get(aStrName);
+ if( nPos == -1 )
+ break;
+
+ XGradientEntry* pEntry = pGradientList->GetGradient( nPos );
+ aGrdItem.SetWhich( XATTR_FILLGRADIENT );
+ aGrdItem.SetName( rName );
+ aGrdItem.SetGradientValue( pEntry->GetGradient() );
+ pItem = & aGrdItem;
+ }
+ DBG_ASSERT( pItem, "Invalid Item" );
+ if( pItem )
+ pItem->QueryValue( aResult, MID_FILLGRADIENT );
+ }
+ break;
+
+ case XATTR_FILLHATCH:
+ {
+ XFillHatchItem aHatchItem;
+ if( ! bFound )
+ {
+ XHatchList* pHatchList = pModel->GetHatchList();
+
+ if( !pHatchList )
+ break;
+
+ long nPos = ((XPropertyList*)pHatchList)->Get(aStrName);
+ if( nPos == -1 )
+ break;
+
+ XHatchEntry* pEntry = pHatchList->GetHatch( nPos );
+ aHatchItem.SetWhich( XATTR_FILLHATCH );
+ aHatchItem.SetName( rName );
+ aHatchItem.SetHatchValue( pEntry->GetHatch() );
+ pItem = & aHatchItem;
+ }
+ DBG_ASSERT( pItem, "Invalid Item" );
+ if( pItem )
+ pItem->QueryValue( aResult, MID_FILLHATCH );
+ }
+ break;
+
+ case XATTR_LINEEND:
+ case XATTR_LINESTART:
+ {
+ if( ! bFound )
+ {
+ XLineEndList* pLineEndList = pModel->GetLineEndList();
+
+ if( !pLineEndList )
+ break;
+
+ long nPos = ((XPropertyList*)pLineEndList)->Get(aStrName);
+ if( nPos == -1 )
+ break;
+
+ XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos );
+ if( nWhich == XATTR_LINEEND )
+ {
+ XLineEndItem aLEItem;
+ aLEItem.SetWhich( XATTR_LINEEND );
+ aLEItem.SetName( rName );
+ aLEItem.SetLineEndValue( pEntry->GetLineEnd() );
+ aLEItem.QueryValue( aResult );
+ }
+ else
+ {
+ XLineStartItem aLSItem;
+ aLSItem.SetWhich( XATTR_LINESTART );
+ aLSItem.SetName( rName );
+ aLSItem.SetLineStartValue( pEntry->GetLineEnd() );
+ aLSItem.QueryValue( aResult );
+ }
+ }
+ else
+ {
+ DBG_ASSERT( pItem, "Invalid Item" );
+ if( pItem )
+ pItem->QueryValue( aResult );
+ }
+ }
+ break;
+
+ case XATTR_LINEDASH:
+ {
+ XLineDashItem aDashItem;
+ if( ! bFound )
+ {
+ XDashList* pDashList = pModel->GetDashList();
+
+ if( !pDashList )
+ break;
+
+ long nPos = ((XPropertyList*)pDashList)->Get(aStrName);
+ if( nPos == -1 )
+ break;
+
+ XDashEntry* pEntry = pDashList->GetDash( nPos );
+ aDashItem.SetWhich( XATTR_LINEDASH );
+ aDashItem.SetName( rName );
+ aDashItem.SetDashValue( pEntry->GetDash() );
+ pItem = & aDashItem;
+ }
+ DBG_ASSERT( pItem, "Invalid Item" );
+ if( pItem )
+ pItem->QueryValue( aResult, MID_LINEDASH );
+ }
+ break;
+ }
+
+ return aResult;
+} */
+
+//----------------------------------------------------------------------
+
+void SAL_CALL SvxShape::setPropertyValue( const OUString& rPropertyName, const uno::Any& rVal )
+ throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( mpImpl->mpMaster )
+ {
+ mpImpl->mpMaster->setPropertyValue( rPropertyName, rVal );
+ }
+ else
+ {
+ _setPropertyValue( rPropertyName, rVal );
+ }
+}
+
+void SAL_CALL SvxShape::_setPropertyValue( const OUString& rPropertyName, const uno::Any& rVal )
+ throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(rPropertyName);
+
+ if( mpObj.is() && mpModel )
+ {
+ if( pMap == NULL )
+ throw beans::UnknownPropertyException();
+
+ if( (pMap->nFlags & beans::PropertyAttribute::READONLY ) != 0 )
+ throw beans::PropertyVetoException();
+
+ mpModel->SetChanged();
+
+ if(!setPropertyValueImpl( rPropertyName, pMap, rVal ) )
+ {
+ DBG_ASSERT( pMap->nWID == SDRATTR_TEXTDIRECTION || pMap->nWID < SDRATTR_NOTPERSIST_FIRST || pMap->nWID > SDRATTR_NOTPERSIST_LAST, "Not persist item not handled!" );
+ DBG_ASSERT( pMap->nWID < OWN_ATTR_VALUE_START || pMap->nWID > OWN_ATTR_VALUE_END, "Not item property not handled!" );
+
+ sal_Bool bIsNotPersist = pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST && pMap->nWID != SDRATTR_TEXTDIRECTION;
+
+ if( pMap->nWID == SDRATTR_ECKENRADIUS )
+ {
+ sal_Int32 nCornerRadius = 0;
+ if( !(rVal >>= nCornerRadius) || (nCornerRadius < 0) || (nCornerRadius > 5000000))
+ throw IllegalArgumentException();
+ }
+
+ SfxItemSet* pSet;
+ if( mbIsMultiPropertyCall && !bIsNotPersist )
+ {
+ if( mpImpl->mpItemSet == NULL )
+ {
+ pSet = mpImpl->mpItemSet = mpObj->GetMergedItemSet().Clone();
+ }
+ else
+ {
+ pSet = mpImpl->mpItemSet;
+ }
+ }
+ else
+ {
+ pSet = new SfxItemSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID);
+ }
+
+ if( pSet->GetItemState( pMap->nWID ) != SFX_ITEM_SET )
+ pSet->Put(mpObj->GetMergedItem(pMap->nWID));
+
+ if( !SvxUnoTextRangeBase::SetPropertyValueHelper( *pSet, pMap, rVal, *pSet ))
+ {
+ if( pSet->GetItemState( pMap->nWID ) != SFX_ITEM_SET )
+ {
+ if(bIsNotPersist)
+ {
+ // Not-Persistant Attribute, hole diese extra
+ mpObj->TakeNotPersistAttr(*pSet, sal_False);
+ }
+ }
+
+ if( pSet->GetItemState( pMap->nWID ) != SFX_ITEM_SET )
+ {
+ // Default aus ItemPool holen
+ if(mpModel->GetItemPool().IsWhich(pMap->nWID))
+ pSet->Put(mpModel->GetItemPool().GetDefaultItem(pMap->nWID));
+ }
+
+ if( pSet->GetItemState( pMap->nWID ) == SFX_ITEM_SET )
+ {
+ SvxItemPropertySet_setPropertyValue( *mpPropSet, pMap, rVal, *pSet );
+ }
+ }
+
+ if(bIsNotPersist)
+ {
+ // Not-Persist Attribute extra setzen
+ mpObj->ApplyNotPersistAttr( *pSet );
+ delete pSet;
+ }
+ else
+ {
+ // if we have a XMultiProperty call then the item set
+ // will be set in setPropertyValues later
+ if( !mbIsMultiPropertyCall )
+ {
+ mpObj->SetMergedItemSetAndBroadcast( *pSet );
+
+ delete pSet;
+ }
+ }
+ return;
+ }
+ }
+ else
+ {
+ // since we have no actual sdr object right now
+ // remember all properties in a list. These
+ // properties will be set when the sdr object is
+ // created
+
+ if(pMap && pMap->nWID)
+// Fixme: We should throw a UnknownPropertyException here.
+// But since this class is aggregated from classes
+// that support additional properties that we don't
+// know here we silently store *all* properties, even
+// if they may be not supported after creation
+ mpPropSet->setPropertyValue( pMap, rVal );
+ }
+}
+
+//----------------------------------------------------------------------
+
+uno::Any SAL_CALL SvxShape::getPropertyValue( const OUString& PropertyName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if ( mpImpl->mpMaster )
+ return mpImpl->mpMaster->getPropertyValue( PropertyName );
+ else
+ return _getPropertyValue( PropertyName );
+}
+
+//----------------------------------------------------------------------
+
+uno::Any SvxShape::_getPropertyValue( const OUString& PropertyName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
+
+ uno::Any aAny;
+ if( mpObj.is() && mpModel )
+ {
+ if(pMap == NULL )
+ throw beans::UnknownPropertyException();
+
+ if( !getPropertyValueImpl( PropertyName, pMap, aAny ) )
+ {
+ DBG_ASSERT( pMap->nWID == SDRATTR_TEXTDIRECTION || (pMap->nWID < SDRATTR_NOTPERSIST_FIRST || pMap->nWID > SDRATTR_NOTPERSIST_LAST), "Not persist item not handled!" );
+ DBG_ASSERT( pMap->nWID < OWN_ATTR_VALUE_START || pMap->nWID > OWN_ATTR_VALUE_END, "Not item property not handled!" );
+
+ SfxItemSet aSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID);
+ aSet.Put(mpObj->GetMergedItem(pMap->nWID));
+
+ if(SvxUnoTextRangeBase::GetPropertyValueHelper( aSet, pMap, aAny ))
+ return aAny;
+
+ if(!aSet.Count())
+ {
+ if(pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST)
+ {
+ // Not-Persistant Attribute, hole diese extra
+ mpObj->TakeNotPersistAttr(aSet, sal_False);
+ }
+ }
+
+ if(!aSet.Count())
+ {
+ // Default aus ItemPool holen
+ if(mpModel->GetItemPool().IsWhich(pMap->nWID))
+ aSet.Put(mpModel->GetItemPool().GetDefaultItem(pMap->nWID));
+ }
+
+ if(aSet.Count())
+ aAny = GetAnyForItem( aSet, pMap );
+ }
+ }
+ else
+ {
+
+// Fixme: we should return default values for OWN_ATTR !
+
+ if(pMap && pMap->nWID)
+// FixMe: see setPropertyValue
+ aAny = mpPropSet->getPropertyValue( pMap );
+
+ }
+ return aAny;
+}
+
+//----------------------------------------------------------------------
+
+// XMultiPropertySet
+void SAL_CALL SvxShape::setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ const sal_Int32 nCount = aPropertyNames.getLength();
+ const OUString* pNames = aPropertyNames.getConstArray();
+
+ const uno::Any* pValues = aValues.getConstArray();
+
+ // make sure mbIsMultiPropertyCall and mpImpl->mpItemSet are
+ // reseted even when an execption is thrown
+ const ::comphelper::ScopeGuard aGuard( boost::bind( &SvxShape::endSetPropertyValues, this ) );
+
+ mbIsMultiPropertyCall = sal_True;
+
+ if( mpImpl->mpMaster )
+ {
+ for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pNames++, pValues++ )
+ {
+ try
+ {
+ setPropertyValue( *pNames, *pValues );
+ }
+ catch( beans::UnknownPropertyException& e )
+ {
+ (void)e;
+ }
+ catch( uno::Exception& ex )
+ {
+ (void)ex;
+ }
+ }
+ }
+ else
+ {
+ uno::Reference< beans::XPropertySet > xSet;
+ queryInterface( ::getCppuType( (const uno::Reference< beans::XPropertySet >*) 0) ) >>= xSet;
+
+ for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pNames++, pValues++ )
+ {
+ try
+ {
+ xSet->setPropertyValue( *pNames, *pValues );
+ }
+ catch( beans::UnknownPropertyException& e )
+ {
+ (void)e;
+ }
+ catch( uno::Exception& ex )
+ {
+ (void)ex;
+ }
+ }
+ }
+
+ if( mpImpl->mpItemSet && mpObj.is() )
+ mpObj->SetMergedItemSetAndBroadcast( *mpImpl->mpItemSet );
+}
+
+//----------------------------------------------------------------------
+
+void SvxShape::endSetPropertyValues()
+{
+ mbIsMultiPropertyCall = sal_False;
+ if( mpImpl->mpItemSet )
+ {
+ delete mpImpl->mpItemSet;
+ mpImpl->mpItemSet = 0;
+ }
+}
+
+//----------------------------------------------------------------------
+
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL SvxShape::getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException)
+{
+ const sal_Int32 nCount = aPropertyNames.getLength();
+ const OUString* pNames = aPropertyNames.getConstArray();
+
+ uno::Sequence< uno::Any > aRet( nCount );
+ uno::Any* pValue = aRet.getArray();;
+
+ if( mpImpl->mpMaster )
+ {
+ for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pValue++, pNames++ )
+ {
+ try
+ {
+ *pValue = getPropertyValue( *pNames );
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR( "SvxShape::getPropertyValues, unknown property asked" );
+ }
+ }
+ }
+ else
+ {
+ uno::Reference< beans::XPropertySet > xSet;
+ queryInterface( ::getCppuType( (const uno::Reference< beans::XPropertySet >*) 0) ) >>= xSet;
+
+ for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++, pValue++, pNames++ )
+ {
+ try
+ {
+ *pValue = xSet->getPropertyValue( *pNames );
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR( "SvxShape::getPropertyValues, unknown property asked" );
+ }
+ }
+ }
+
+ return aRet;
+}
+
+void SAL_CALL SvxShape::addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& ) throw (::com::sun::star::uno::RuntimeException)
+{
+}
+
+void SAL_CALL SvxShape::removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& ) throw (::com::sun::star::uno::RuntimeException)
+{
+}
+
+void SAL_CALL SvxShape::firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& ) throw (::com::sun::star::uno::RuntimeException)
+{
+}
+
+//----------------------------------------------------------------------
+
+uno::Any SvxShape::GetAnyForItem( SfxItemSet& aSet, const SfxItemPropertySimpleEntry* pMap ) const
+{
+ DBG_TESTSOLARMUTEX();
+ uno::Any aAny;
+
+ switch(pMap->nWID)
+ {
+ case SDRATTR_CIRCSTARTANGLE:
+ {
+ const SfxPoolItem* pPoolItem=NULL;
+ if(aSet.GetItemState(SDRATTR_CIRCSTARTANGLE,sal_False,&pPoolItem)==SFX_ITEM_SET)
+ {
+ sal_Int32 nAngle = ((SdrCircStartAngleItem*)pPoolItem)->GetValue();
+ aAny <<= nAngle;
+ }
+ break;
+ }
+
+ case SDRATTR_CIRCENDANGLE:
+ {
+ const SfxPoolItem* pPoolItem=NULL;
+ if (aSet.GetItemState(SDRATTR_CIRCENDANGLE,sal_False,&pPoolItem)==SFX_ITEM_SET)
+ {
+ sal_Int32 nAngle = ((SdrCircEndAngleItem*)pPoolItem)->GetValue();
+ aAny <<= nAngle;
+ }
+ break;
+ }
+
+ case SDRATTR_CIRCKIND:
+ {
+ if( mpObj->GetObjInventor() == SdrInventor)
+ {
+ drawing::CircleKind eKind;
+ switch(mpObj->GetObjIdentifier())
+ {
+ case OBJ_CIRC: // Kreis, Ellipse
+ eKind = drawing::CircleKind_FULL;
+ break;
+ case OBJ_CCUT: // Kreisabschnitt
+ eKind = drawing::CircleKind_CUT;
+ break;
+ case OBJ_CARC: // Kreisbogen
+ eKind = drawing::CircleKind_ARC;
+ break;
+ case OBJ_SECT: // Kreissektor
+ eKind = drawing::CircleKind_SECTION;
+ break;
+ }
+ aAny <<= eKind;
+ }
+ break;
+ }
+ default:
+ {
+ // Hole Wert aus ItemSet
+ aAny = SvxItemPropertySet_getPropertyValue( *mpPropSet, pMap, aSet );
+
+ if( *pMap->pType != aAny.getValueType() )
+ {
+ // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
+ if( ( *pMap->pType == ::getCppuType((const sal_Int16*)0)) && aAny.getValueType() == ::getCppuType((const sal_Int32*)0) )
+ {
+ sal_Int32 nValue = 0;
+ aAny >>= nValue;
+ aAny <<= (sal_Int16)nValue;
+ }
+ else
+ {
+ DBG_ERROR("SvxShape::GetAnyForItem() Returnvalue has wrong Type!" );
+ }
+ }
+
+ }
+ }
+
+ return aAny;
+}
+
+//----------------------------------------------------------------------
+
+// XPropertyState
+beans::PropertyState SAL_CALL SvxShape::getPropertyState( const OUString& PropertyName )
+ throw(beans::UnknownPropertyException, uno::RuntimeException)
+{
+ if( mpImpl->mpMaster )
+ {
+ return mpImpl->mpMaster->getPropertyState( PropertyName );
+ }
+ else
+ {
+ return _getPropertyState( PropertyName );
+ }
+}
+
+beans::PropertyState SAL_CALL SvxShape::_getPropertyState( const OUString& PropertyName )
+ throw(beans::UnknownPropertyException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
+
+ if( !mpObj.is() || pMap == NULL )
+ throw beans::UnknownPropertyException();
+
+ beans::PropertyState eState;
+ if( !getPropertyStateImpl( pMap, eState ) )
+ {
+ const SfxItemSet& rSet = mpObj->GetMergedItemSet();
+
+ switch( rSet.GetItemState( pMap->nWID, sal_False ) )
+ {
+ case SFX_ITEM_READONLY:
+ case SFX_ITEM_SET:
+ eState = beans::PropertyState_DIRECT_VALUE;
+ break;
+ case SFX_ITEM_DEFAULT:
+ eState = beans::PropertyState_DEFAULT_VALUE;
+ break;
+// case SFX_ITEM_UNKNOWN:
+// case SFX_ITEM_DONTCARE:
+// case SFX_ITEM_DISABLED:
+ default:
+ eState = beans::PropertyState_AMBIGUOUS_VALUE;
+ break;
+ }
+
+ // if a item is set, this doesn't mean we want it :)
+ if( ( beans::PropertyState_DIRECT_VALUE == eState ) )
+ {
+ switch( pMap->nWID )
+ {
+ // the following items are disabled by changing the
+ // fill style or the line style. so there is no need
+ // to export items without names which should be empty
+ case XATTR_FILLBITMAP:
+ case XATTR_FILLGRADIENT:
+ case XATTR_FILLHATCH:
+ case XATTR_LINEDASH:
+ {
+ NameOrIndex* pItem = (NameOrIndex*)rSet.GetItem((sal_uInt16)pMap->nWID);
+ if( ( pItem == NULL ) || ( pItem->GetName().Len() == 0) )
+ eState = beans::PropertyState_DEFAULT_VALUE;
+ }
+ break;
+
+ // #i36115#
+ // If e.g. the LineStart is on NONE and thus the string has length 0, it still
+ // may be a hard attribute covering the set LineStart of the parent (Style).
+ // #i37644#
+ // same is for fill float transparency
+ case XATTR_LINEEND:
+ case XATTR_LINESTART:
+ case XATTR_FILLFLOATTRANSPARENCE:
+ {
+ NameOrIndex* pItem = (NameOrIndex*)rSet.GetItem((sal_uInt16)pMap->nWID);
+ if( ( pItem == NULL ) )
+ eState = beans::PropertyState_DEFAULT_VALUE;
+ }
+ break;
+ }
+ }
+ }
+ return eState;
+}
+
+//----------------------------------------------------------------------
+
+bool SvxShape::setPropertyValueImpl( const ::rtl::OUString&, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ switch( pProperty->nWID )
+ {
+ case OWN_ATTR_CAPTION_POINT:
+ {
+ awt::Point aPnt;
+ if( rValue >>= aPnt )
+ {
+ Point aVclPoint( aPnt.X, aPnt.Y );
+
+ // #90763# position is relative to top left, make it absolute
+ basegfx::B2DPolyPolygon aNewPolyPolygon;
+ basegfx::B2DHomMatrix aNewHomogenMatrix;
+ mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
+
+ aVclPoint.X() += basegfx::fround(aNewHomogenMatrix.get(0, 2));
+ aVclPoint.Y() += basegfx::fround(aNewHomogenMatrix.get(1, 2));
+
+ // #88657# metric of pool maybe twips (writer)
+ ForceMetricToItemPoolMetric(aVclPoint);
+
+ // #88491# position relative to anchor
+ if( mpModel->IsWriter() )
+ {
+ aVclPoint += mpObj->GetAnchorPos();
+ }
+
+ ((SdrCaptionObj*)mpObj.get())->SetTailPos(aVclPoint);
+
+ return true;
+ }
+ break;
+ }
+ case OWN_ATTR_TRANSFORMATION:
+ {
+ drawing::HomogenMatrix3 aMatrix;
+ if(rValue >>= aMatrix)
+ {
+ basegfx::B2DPolyPolygon aNewPolyPolygon;
+ basegfx::B2DHomMatrix aNewHomogenMatrix;
+
+ mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
+
+ aNewHomogenMatrix.set(0, 0, aMatrix.Line1.Column1);
+ aNewHomogenMatrix.set(0, 1, aMatrix.Line1.Column2);
+ aNewHomogenMatrix.set(0, 2, aMatrix.Line1.Column3);
+ aNewHomogenMatrix.set(1, 0, aMatrix.Line2.Column1);
+ aNewHomogenMatrix.set(1, 1, aMatrix.Line2.Column2);
+ aNewHomogenMatrix.set(1, 2, aMatrix.Line2.Column3);
+ aNewHomogenMatrix.set(2, 0, aMatrix.Line3.Column1);
+ aNewHomogenMatrix.set(2, 1, aMatrix.Line3.Column2);
+ aNewHomogenMatrix.set(2, 2, aMatrix.Line3.Column3);
+
+ mpObj->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
+ return true;
+ }
+ break;
+ }
+
+ case OWN_ATTR_ZORDER:
+ {
+ sal_Int32 nNewOrdNum = 0;
+ if(rValue >>= nNewOrdNum)
+ {
+ SdrObjList* pObjList = mpObj->GetObjList();
+ if( pObjList )
+ {
+#ifdef DBG_UTIL
+ SdrObject* pCheck =
+#endif
+ pObjList->SetObjectOrdNum( mpObj->GetOrdNum(), (sal_uIntPtr)nNewOrdNum );
+ DBG_ASSERT( pCheck == mpObj.get(), "GetOrdNum() failed!" );
+ }
+ return true;
+ }
+ break;
+ }
+ case OWN_ATTR_FRAMERECT:
+ {
+ awt::Rectangle aUnoRect;
+ if(rValue >>= aUnoRect)
+ {
+ Point aTopLeft( aUnoRect.X, aUnoRect.Y );
+ Size aObjSize( aUnoRect.Width, aUnoRect.Height );
+ ForceMetricToItemPoolMetric(aTopLeft);
+ ForceMetricToItemPoolMetric(aObjSize);
+ Rectangle aRect;
+ aRect.SetPos(aTopLeft);
+ aRect.SetSize(aObjSize);
+ mpObj->SetSnapRect(aRect);
+ return true;
+ }
+ break;
+ }
+ case OWN_ATTR_MIRRORED:
+ {
+ sal_Bool bMirror = sal_Bool();
+ if(rValue >>= bMirror )
+ {
+ SdrGrafObj* pObj = dynamic_cast< SdrGrafObj* >( mpObj.get() );
+ if( pObj )
+ pObj->SetMirrored(bMirror);
+ return true;
+ }
+ break;
+ }
+ case OWN_ATTR_EDGE_START_OBJ:
+ case OWN_ATTR_EDGE_END_OBJ:
+ case OWN_ATTR_GLUEID_HEAD:
+ case OWN_ATTR_GLUEID_TAIL:
+ case OWN_ATTR_EDGE_START_POS:
+ case OWN_ATTR_EDGE_END_POS:
+ case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
+ {
+ SdrEdgeObj* pEdgeObj = dynamic_cast< SdrEdgeObj* >(mpObj.get());
+ if(pEdgeObj)
+ {
+ switch(pProperty->nWID)
+ {
+ case OWN_ATTR_EDGE_START_OBJ:
+ case OWN_ATTR_EDGE_END_OBJ:
+ {
+ Reference< drawing::XShape > xShape;
+ if( rValue >>= xShape )
+ {
+ SdrObject* pNode = GetSdrObjectFromXShape( xShape );
+ if( pNode )
+ {
+ pEdgeObj->ConnectToNode( pProperty->nWID == OWN_ATTR_EDGE_START_OBJ, pNode );
+ pEdgeObj->setGluePointIndex( pProperty->nWID == OWN_ATTR_EDGE_START_OBJ, -1 );
+ return true;
+ }
+ }
+ break;
+ }
+
+ case OWN_ATTR_EDGE_START_POS:
+ case OWN_ATTR_EDGE_END_POS:
+ {
+ awt::Point aUnoPoint;
+ if( rValue >>= aUnoPoint )
+ {
+ Point aPoint( aUnoPoint.X, aUnoPoint.Y );
+
+ // --> OD 2010-02-19 #i108851# - reintroduction of fix for issue i59051
+ // perform metric change before applying anchor position,
+ // because the anchor position is in pool metric.
+ ForceMetricToItemPoolMetric( aPoint );
+ // <--
+ if( mpModel->IsWriter() )
+ aPoint += mpObj->GetAnchorPos();
+
+ pEdgeObj->SetTailPoint( pProperty->nWID == OWN_ATTR_EDGE_START_POS, aPoint );
+ return true;
+ }
+ break;
+ }
+
+ case OWN_ATTR_GLUEID_HEAD:
+ case OWN_ATTR_GLUEID_TAIL:
+ {
+ sal_Int32 nId = 0;
+ if( rValue >>= nId )
+ {
+ pEdgeObj->setGluePointIndex( pProperty->nWID == OWN_ATTR_GLUEID_HEAD, nId );
+ return true;
+ }
+ break;
+ }
+ case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
+ {
+ drawing::PolyPolygonBezierCoords aPolyPoly;
+ if ( rValue >>= aPolyPoly )
+ {
+ basegfx::B2DPolyPolygon aNewPolyPolygon( SvxConvertPolyPolygonBezierToB2DPolyPolygon( &aPolyPoly ) );
+ // --> OD 2010-02-19 #i108851# - reintroduction of fix for issue i59051
+ ForceMetricToItemPoolMetric( aNewPolyPolygon );
+ // <--
+ if( mpModel->IsWriter() )
+ {
+ Point aPoint( mpObj->GetAnchorPos() );
+ aNewPolyPolygon.transform(basegfx::tools::createTranslateB2DHomMatrix(aPoint.X(), aPoint.Y()));
+ }
+ pEdgeObj->SetEdgeTrackPath( aNewPolyPolygon );
+ return true;
+ }
+ }
+ }
+ }
+ break;
+ }
+ case OWN_ATTR_MEASURE_START_POS:
+ case OWN_ATTR_MEASURE_END_POS:
+ {
+ SdrMeasureObj* pMeasureObj = dynamic_cast< SdrMeasureObj* >(mpObj.get());
+ awt::Point aUnoPoint;
+ if(pMeasureObj && ( rValue >>= aUnoPoint ) )
+ {
+ Point aPoint( aUnoPoint.X, aUnoPoint.Y );
+
+ // --> OD 2010-02-19 #i108851# - reintroduction of fix for issue i59051
+ ForceMetricToItemPoolMetric( aPoint );
+ // <--
+ if( mpModel->IsWriter() )
+ aPoint += mpObj->GetAnchorPos();
+
+ pMeasureObj->NbcSetPoint( aPoint, pProperty->nWID == OWN_ATTR_MEASURE_START_POS ? 0L : 1L );
+ pMeasureObj->SetChanged();
+ pMeasureObj->BroadcastObjectChange();
+ return true;
+ }
+ break;
+ }
+ case OWN_ATTR_FILLBMP_MODE:
+ {
+ drawing::BitmapMode eMode;
+ if(!(rValue >>= eMode) )
+ {
+ sal_Int32 nMode = 0;
+ if(!(rValue >>= nMode))
+ break;
+
+ eMode = (drawing::BitmapMode)nMode;
+ }
+ mpObj->SetMergedItem( XFillBmpStretchItem( eMode == drawing::BitmapMode_STRETCH ) );
+ mpObj->SetMergedItem( XFillBmpTileItem( eMode == drawing::BitmapMode_REPEAT ) );
+ return true;
+ }
+
+ case SDRATTR_LAYERID:
+ {
+ sal_Int16 nLayerId = sal_Int16();
+ if( rValue >>= nLayerId )
+ {
+ SdrLayer* pLayer = mpModel->GetLayerAdmin().GetLayerPerID((unsigned char)nLayerId);
+ if( pLayer )
+ {
+ mpObj->SetLayer((unsigned char)nLayerId);
+ return true;
+ }
+ }
+ break;
+ }
+
+ case SDRATTR_LAYERNAME:
+ {
+ OUString aLayerName;
+ if( rValue >>= aLayerName )
+ {
+ const SdrLayer* pLayer=mpModel->GetLayerAdmin().GetLayer(aLayerName, sal_True);
+ if( pLayer != NULL )
+ {
+ mpObj->SetLayer( pLayer->GetID() );
+ return true;
+ }
+ }
+ break;
+ }
+ case SDRATTR_ROTATEANGLE:
+ {
+ sal_Int32 nAngle = 0;
+ if( rValue >>= nAngle )
+ {
+ Point aRef1(mpObj->GetSnapRect().Center());
+ nAngle -= mpObj->GetRotateAngle();
+ if (nAngle!=0)
+ {
+ double nSin=sin(nAngle*nPi180);
+ double nCos=cos(nAngle*nPi180);
+ mpObj->Rotate(aRef1,nAngle,nSin,nCos);
+ }
+ return true;
+ }
+
+ break;
+ }
+
+ case SDRATTR_SHEARANGLE:
+ {
+ sal_Int32 nShear = 0;
+ if( rValue >>= nShear )
+ {
+ nShear -= mpObj->GetShearAngle();
+ if(nShear != 0 )
+ {
+ Point aRef1(mpObj->GetSnapRect().Center());
+ double nTan=tan(nShear*nPi180);
+ mpObj->Shear(aRef1,nShear,nTan,sal_False);
+ return true;
+ }
+ }
+
+ break;
+ }
+
+ case SDRATTR_OBJMOVEPROTECT:
+ {
+ sal_Bool bMoveProtect = sal_Bool();
+ if( rValue >>= bMoveProtect )
+ {
+ mpObj->SetMoveProtect(bMoveProtect);
+ return true;
+ }
+ break;
+ }
+ case SDRATTR_OBJECTNAME:
+ {
+ OUString aName;
+ if( rValue >>= aName )
+ {
+ mpObj->SetName( aName );
+ return true;
+ }
+ break;
+ }
+
+ // #i68101#
+ case OWN_ATTR_MISC_OBJ_TITLE:
+ {
+ OUString aTitle;
+ if( rValue >>= aTitle )
+ {
+ mpObj->SetTitle( aTitle );
+ return true;
+ }
+ break;
+ }
+ case OWN_ATTR_MISC_OBJ_DESCRIPTION:
+ {
+ OUString aDescription;
+ if( rValue >>= aDescription )
+ {
+ mpObj->SetDescription( aDescription );
+ return true;
+ }
+ break;
+ }
+
+ case SDRATTR_OBJPRINTABLE:
+ {
+ sal_Bool bPrintable = sal_Bool();
+ if( rValue >>= bPrintable )
+ {
+ mpObj->SetPrintable(bPrintable);
+ return true;
+ }
+ break;
+ }
+ case SDRATTR_OBJVISIBLE:
+ {
+ sal_Bool bVisible = sal_Bool();
+ if( rValue >>= bVisible )
+ {
+ mpObj->SetVisible(bVisible);
+ return true;
+ }
+ break;
+ }
+ case SDRATTR_OBJSIZEPROTECT:
+ {
+ sal_Bool bResizeProtect = sal_Bool();
+ if( rValue >>= bResizeProtect )
+ {
+ mpObj->SetResizeProtect(bResizeProtect);
+ return true;
+ }
+ break;
+ }
+ case OWN_ATTR_PAGE_NUMBER:
+ {
+ sal_Int32 nPageNum = 0;
+ if( (rValue >>= nPageNum) && ( nPageNum >= 0 ) && ( nPageNum <= 0xffff ) )
+ {
+ SdrPageObj* pPageObj = dynamic_cast< SdrPageObj* >(mpObj.get());
+ if( pPageObj )
+ {
+ SdrModel* pModel = pPageObj->GetModel();
+ SdrPage* pNewPage = 0L;
+ const sal_uInt16 nDestinationPageNum((sal_uInt16)((nPageNum << 1L) - 1L));
+
+ if(pModel)
+ {
+ if(nDestinationPageNum < pModel->GetPageCount())
+ {
+ pNewPage = pModel->GetPage(nDestinationPageNum);
+ }
+ }
+
+ pPageObj->SetReferencedPage(pNewPage);
+ }
+
+ return true;
+ }
+ break;
+ }
+ case XATTR_FILLBITMAP:
+ case XATTR_FILLGRADIENT:
+ case XATTR_FILLHATCH:
+ case XATTR_FILLFLOATTRANSPARENCE:
+ case XATTR_LINEEND:
+ case XATTR_LINESTART:
+ case XATTR_LINEDASH:
+ {
+ if( pProperty->nMemberId == MID_NAME )
+ {
+ OUString aApiName;
+ if( rValue >>= aApiName )
+ {
+ if( SetFillAttribute( pProperty->nWID, aApiName ) )
+ return true;
+ }
+ break;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ default:
+ {
+ return false;
+ }
+ }
+ throw lang::IllegalArgumentException();
+}
+
+//----------------------------------------------------------------------
+
+bool SvxShape::getPropertyValueImpl( const ::rtl::OUString&, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ switch( pProperty->nWID )
+ {
+/*
+ case OWN_ATTR_HASLEVELS:
+ {
+ rValue <<= SvxTextEditSource::hasLevels( mpObj.get() );
+ break;
+ }
+*/
+ case OWN_ATTR_CAPTION_POINT:
+ {
+ Point aVclPoint = ((SdrCaptionObj*)mpObj.get())->GetTailPos();
+
+ // #88491# make pos relative to anchor
+ if( mpModel->IsWriter() )
+ {
+ aVclPoint -= mpObj->GetAnchorPos();
+ }
+
+ // #88657# metric of pool maybe twips (writer)
+ ForceMetricTo100th_mm(aVclPoint);
+
+ // #90763# pos is absolute, make it relative to top left
+ basegfx::B2DPolyPolygon aNewPolyPolygon;
+ basegfx::B2DHomMatrix aNewHomogenMatrix;
+ mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
+
+ aVclPoint.X() -= basegfx::fround(aNewHomogenMatrix.get(0, 2));
+ aVclPoint.Y() -= basegfx::fround(aNewHomogenMatrix.get(1, 2));
+
+ awt::Point aPnt( aVclPoint.X(), aVclPoint.Y() );
+ rValue <<= aPnt;
+ break;
+ }
+
+ case OWN_ATTR_TRANSFORMATION:
+ {
+ basegfx::B2DPolyPolygon aNewPolyPolygon;
+ basegfx::B2DHomMatrix aNewHomogenMatrix;
+ mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
+ drawing::HomogenMatrix3 aMatrix;
+
+ aMatrix.Line1.Column1 = aNewHomogenMatrix.get(0, 0);
+ aMatrix.Line1.Column2 = aNewHomogenMatrix.get(0, 1);
+ aMatrix.Line1.Column3 = aNewHomogenMatrix.get(0, 2);
+ aMatrix.Line2.Column1 = aNewHomogenMatrix.get(1, 0);
+ aMatrix.Line2.Column2 = aNewHomogenMatrix.get(1, 1);
+ aMatrix.Line2.Column3 = aNewHomogenMatrix.get(1, 2);
+ aMatrix.Line3.Column1 = aNewHomogenMatrix.get(2, 0);
+ aMatrix.Line3.Column2 = aNewHomogenMatrix.get(2, 1);
+ aMatrix.Line3.Column3 = aNewHomogenMatrix.get(2, 2);
+
+ rValue <<= aMatrix;
+
+ break;
+ }
+
+ case OWN_ATTR_ZORDER:
+ {
+ rValue <<= (sal_Int32)mpObj->GetOrdNum();
+ break;
+ }
+
+ case OWN_ATTR_BITMAP:
+ {
+ rValue = GetBitmap();
+ if(!rValue.hasValue())
+ throw uno::RuntimeException();
+
+ break;
+ }
+
+ case OWN_ATTR_ISFONTWORK:
+ {
+ rValue <<= (sal_Bool)(mpObj->ISA(SdrTextObj) && ((SdrTextObj*)mpObj.get())->IsFontwork());
+ break;
+ }
+
+ case OWN_ATTR_FRAMERECT:
+ {
+ Rectangle aRect( mpObj->GetSnapRect() );
+ Point aTopLeft( aRect.TopLeft() );
+ Size aObjSize( aRect.GetWidth(), aRect.GetHeight() );
+ ForceMetricTo100th_mm(aTopLeft);
+ ForceMetricTo100th_mm(aObjSize);
+ ::com::sun::star::awt::Rectangle aUnoRect(
+ aTopLeft.X(), aTopLeft.Y(),
+ aObjSize.getWidth(), aObjSize.getHeight() );
+ rValue <<= aUnoRect;
+ break;
+ }
+
+ case OWN_ATTR_BOUNDRECT:
+ {
+ Rectangle aRect( mpObj->GetCurrentBoundRect() );
+ Point aTopLeft( aRect.TopLeft() );
+ Size aObjSize( aRect.GetWidth(), aRect.GetHeight() );
+ ForceMetricTo100th_mm(aTopLeft);
+ ForceMetricTo100th_mm(aObjSize);
+ ::com::sun::star::awt::Rectangle aUnoRect(
+ aTopLeft.X(), aTopLeft.Y(),
+ aObjSize.getWidth(), aObjSize.getHeight() );
+ rValue <<= aUnoRect;
+ break;
+ }
+
+ case OWN_ATTR_LDNAME:
+ {
+ OUString aName( mpObj->GetName() );
+ rValue <<= aName;
+ break;
+ }
+
+ case OWN_ATTR_LDBITMAP:
+ {
+ sal_uInt16 nId;
+ if( mpObj->GetObjInventor() == SdrInventor && mpObj->GetObjIdentifier() == OBJ_OLE2 )
+ {
+ nId = RID_UNODRAW_OLE2;
+ }
+ else if( mpObj->GetObjInventor() == SdrInventor && mpObj->GetObjIdentifier() == OBJ_GRAF )
+ {
+ nId = RID_UNODRAW_GRAPHICS;
+ }
+ else
+ {
+ nId = RID_UNODRAW_OBJECTS;
+ }
+
+ BitmapEx aBmp( SVX_RES(nId) );
+ Reference< awt::XBitmap > xBmp( VCLUnoHelper::CreateBitmap( aBmp ) );
+
+ rValue <<= xBmp;
+ break;
+ }
+
+ case OWN_ATTR_MIRRORED:
+ {
+ sal_Bool bMirror = sal_False;
+ if( mpObj.is() && mpObj->ISA(SdrGrafObj) )
+ bMirror = ((SdrGrafObj*)mpObj.get())->IsMirrored();
+
+ rValue <<= bMirror;
+ }
+
+ case OWN_ATTR_EDGE_START_OBJ:
+ case OWN_ATTR_EDGE_START_POS:
+ case OWN_ATTR_EDGE_END_POS:
+ case OWN_ATTR_EDGE_END_OBJ:
+ case OWN_ATTR_GLUEID_HEAD:
+ case OWN_ATTR_GLUEID_TAIL:
+ case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
+ {
+ SdrEdgeObj* pEdgeObj = dynamic_cast<SdrEdgeObj*>(mpObj.get());
+ if(pEdgeObj)
+ {
+ switch(pProperty->nWID)
+ {
+ case OWN_ATTR_EDGE_START_OBJ:
+ case OWN_ATTR_EDGE_END_OBJ:
+ {
+ SdrObject* pNode = pEdgeObj->GetConnectedNode(pProperty->nWID == OWN_ATTR_EDGE_START_OBJ);
+ if(pNode)
+ {
+ Reference< drawing::XShape > xShape( GetXShapeForSdrObject( pNode ) );
+ if(xShape.is())
+ rValue <<= xShape;
+
+ }
+ break;
+ }
+
+ case OWN_ATTR_EDGE_START_POS:
+ case OWN_ATTR_EDGE_END_POS:
+ {
+ Point aPoint( pEdgeObj->GetTailPoint( pProperty->nWID == OWN_ATTR_EDGE_START_POS ) );
+ if( mpModel->IsWriter() )
+ aPoint -= mpObj->GetAnchorPos();
+
+ ForceMetricTo100th_mm( aPoint );
+ awt::Point aUnoPoint( aPoint.X(), aPoint.Y() );
+
+ rValue <<= aUnoPoint;
+ break;
+ }
+ case OWN_ATTR_GLUEID_HEAD:
+ case OWN_ATTR_GLUEID_TAIL:
+ {
+ rValue <<= pEdgeObj->getGluePointIndex( pProperty->nWID == OWN_ATTR_GLUEID_HEAD );
+ break;
+ }
+ case OWN_ATTR_EDGE_POLYPOLYGONBEZIER:
+ {
+ basegfx::B2DPolyPolygon aPolyPoly( pEdgeObj->GetEdgeTrackPath() );
+ if( mpModel->IsWriter() )
+ {
+ Point aPoint( mpObj->GetAnchorPos() );
+ aPolyPoly.transform(basegfx::tools::createTranslateB2DHomMatrix(-aPoint.X(), -aPoint.Y()));
+ }
+ // --> OD 2010-02-19 #i108851# - reintroduction of fix for issue 59051
+ ForceMetricTo100th_mm( aPolyPoly );
+ // <--
+ drawing::PolyPolygonBezierCoords aRetval;
+ SvxConvertB2DPolyPolygonToPolyPolygonBezier( aPolyPoly, aRetval);
+ rValue <<= aRetval;
+ break;
+ }
+ }
+ }
+ break;
+ }
+
+ case OWN_ATTR_MEASURE_START_POS:
+ case OWN_ATTR_MEASURE_END_POS:
+ {
+ SdrMeasureObj* pMeasureObj = dynamic_cast<SdrMeasureObj*>(mpObj.get());
+ if(pMeasureObj)
+ {
+ Point aPoint( pMeasureObj->GetPoint( pProperty->nWID == OWN_ATTR_MEASURE_START_POS ? 0 : 1 ) );
+ if( mpModel->IsWriter() )
+ aPoint -= mpObj->GetAnchorPos();
+
+ // --> OD 2010-02-19 #i108851# - reintroduction of fix for issue 59051
+ ForceMetricTo100th_mm( aPoint );
+ // <--
+ awt::Point aUnoPoint( aPoint.X(), aPoint.Y() );
+
+ rValue <<= aUnoPoint;
+ break;
+ }
+ break;
+ }
+
+ case OWN_ATTR_FILLBMP_MODE:
+ {
+ const SfxItemSet& rObjItemSet = mpObj->GetMergedItemSet();
+
+ XFillBmpStretchItem* pStretchItem = (XFillBmpStretchItem*)&rObjItemSet.Get(XATTR_FILLBMP_STRETCH);
+ XFillBmpTileItem* pTileItem = (XFillBmpTileItem*)&rObjItemSet.Get(XATTR_FILLBMP_TILE);
+
+ if( pTileItem && pTileItem->GetValue() )
+ {
+ rValue <<= drawing::BitmapMode_REPEAT;
+ }
+ else if( pStretchItem && pStretchItem->GetValue() )
+ {
+ rValue <<= drawing::BitmapMode_STRETCH;
+ }
+ else
+ {
+ rValue <<= drawing::BitmapMode_NO_REPEAT;
+ }
+ break;
+ }
+ case SDRATTR_LAYERID:
+ rValue <<= (sal_Int16)mpObj->GetLayer();
+ break;
+
+ case SDRATTR_LAYERNAME:
+ {
+ SdrLayer* pLayer = mpModel->GetLayerAdmin().GetLayerPerID(mpObj->GetLayer());
+ if( pLayer )
+ {
+ OUString aName( pLayer->GetName() );
+ rValue <<= aName;
+ }
+ break;
+ }
+
+ case SDRATTR_ROTATEANGLE:
+ rValue <<= mpObj->GetRotateAngle();
+ break;
+
+ case SDRATTR_SHEARANGLE:
+ rValue <<= mpObj->GetShearAngle();
+ break;
+
+ case SDRATTR_OBJMOVEPROTECT:
+ rValue = uno::makeAny( (sal_Bool) mpObj->IsMoveProtect() );
+ break;
+
+ case SDRATTR_OBJECTNAME:
+ {
+ OUString aName( mpObj->GetName() );
+ rValue <<= aName;
+ break;
+ }
+
+ // #i68101#
+ case OWN_ATTR_MISC_OBJ_TITLE:
+ {
+ OUString aTitle( mpObj->GetTitle() );
+ rValue <<= aTitle;
+ break;
+ }
+
+ case OWN_ATTR_MISC_OBJ_DESCRIPTION:
+ {
+ OUString aDescription( mpObj->GetDescription() );
+ rValue <<= aDescription;
+ break;
+ }
+
+ case SDRATTR_OBJPRINTABLE:
+ rValue <<= static_cast<sal_Bool>( mpObj->IsPrintable() );
+ break;
+
+ case SDRATTR_OBJVISIBLE:
+ rValue <<= static_cast<sal_Bool>( mpObj->IsVisible() );
+ break;
+
+ case SDRATTR_OBJSIZEPROTECT:
+ rValue <<= static_cast<sal_Bool>( mpObj->IsResizeProtect() );
+ break;
+
+ case OWN_ATTR_PAGE_NUMBER:
+ {
+ SdrPageObj* pPageObj = dynamic_cast<SdrPageObj*>(mpObj.get());
+ if(pPageObj)
+ {
+ SdrPage* pPage = pPageObj->GetReferencedPage();
+ sal_Int32 nPageNumber = (pPage) ? pPage->GetPageNum() : 0L;
+ nPageNumber++;
+ nPageNumber >>= 1;
+ rValue <<= nPageNumber;
+ }
+ break;
+ }
+
+ case OWN_ATTR_UINAME_SINGULAR:
+ {
+ String aTmp;
+ mpObj->TakeObjNameSingul( aTmp );
+ rValue <<= OUString( aTmp );
+ break;
+ }
+
+ case OWN_ATTR_UINAME_PLURAL:
+ {
+ String aTmp;
+ mpObj->TakeObjNamePlural( aTmp );
+ rValue <<= OUString( aTmp );
+ break;
+ }
+ case OWN_ATTR_METAFILE:
+ {
+ SdrOle2Obj* pObj = dynamic_cast<SdrOle2Obj*>(mpObj.get());
+ if( pObj )
+ {
+ Graphic* pGraphic = pObj->GetGraphic();
+ if( pGraphic )
+ {
+ sal_Bool bIsWMF = sal_False;
+ if ( pGraphic->IsLink() )
+ {
+ GfxLink aLnk = pGraphic->GetLink();
+ if ( aLnk.GetType() == GFX_LINK_TYPE_NATIVE_WMF )
+ {
+ bIsWMF = sal_True;
+ uno::Sequence<sal_Int8> aSeq((sal_Int8*)aLnk.GetData(), (sal_Int32) aLnk.GetDataSize());
+ rValue <<= aSeq;
+ }
+ }
+ if ( !bIsWMF )
+ {
+ GDIMetaFile aMtf;
+ if ( pGraphic->GetType() != GRAPHIC_BITMAP )
+ aMtf = pObj->GetGraphic()->GetGDIMetaFile();
+ else
+ {
+ VirtualDevice aVirDev;
+ aMtf.Record( &aVirDev );
+ pGraphic->Draw( &aVirDev, Point(), pGraphic->GetPrefSize() );
+ aMtf.Stop();
+ aMtf.SetPrefSize( pGraphic->GetPrefSize() );
+ aMtf.SetPrefMapMode( pGraphic->GetPrefMapMode() );
+ }
+ SvMemoryStream aDestStrm( 65535, 65535 );
+ ConvertGDIMetaFileToWMF( aMtf, aDestStrm, NULL, sal_False );
+ const uno::Sequence<sal_Int8> aSeq(
+ static_cast< const sal_Int8* >(aDestStrm.GetData()),
+ aDestStrm.GetEndOfData());
+ rValue <<= aSeq;
+ }
+ }
+ }
+ else
+ {
+ rValue = GetBitmap( sal_True );
+ }
+ break;
+ }
+
+
+ default:
+ return false;
+ }
+ return true;
+}
+
+//----------------------------------------------------------------------
+
+bool SvxShape::getPropertyStateImpl( const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::beans::PropertyState& rState ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
+{
+ if( pProperty->nWID == OWN_ATTR_FILLBMP_MODE )
+ {
+ const SfxItemSet& rSet = mpObj->GetMergedItemSet();
+
+ if( rSet.GetItemState( XATTR_FILLBMP_STRETCH, false ) == SFX_ITEM_SET ||
+ rSet.GetItemState( XATTR_FILLBMP_TILE, false ) == SFX_ITEM_SET )
+ {
+ rState = beans::PropertyState_DIRECT_VALUE;
+ }
+ else
+ {
+ rState = beans::PropertyState_AMBIGUOUS_VALUE;
+ }
+ }
+ else if((( pProperty->nWID >= OWN_ATTR_VALUE_START && pProperty->nWID <= OWN_ATTR_VALUE_END ) ||
+ ( pProperty->nWID >= SDRATTR_NOTPERSIST_FIRST && pProperty->nWID <= SDRATTR_NOTPERSIST_LAST )) && ( pProperty->nWID != SDRATTR_TEXTDIRECTION ) )
+ {
+ rState = beans::PropertyState_DIRECT_VALUE;
+ }
+ else
+ {
+ return false;
+ }
+
+ return true;
+}
+
+//----------------------------------------------------------------------
+
+bool SvxShape::setPropertyToDefaultImpl( const SfxItemPropertySimpleEntry* pProperty ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
+{
+ if( pProperty->nWID == OWN_ATTR_FILLBMP_MODE )
+ {
+ mpObj->ClearMergedItem( XATTR_FILLBMP_STRETCH );
+ mpObj->ClearMergedItem( XATTR_FILLBMP_TILE );
+ return true;
+ }
+ else if((pProperty->nWID >= OWN_ATTR_VALUE_START && pProperty->nWID <= OWN_ATTR_VALUE_END ) ||
+ ( pProperty->nWID >= SDRATTR_NOTPERSIST_FIRST && pProperty->nWID <= SDRATTR_NOTPERSIST_LAST ))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+//----------------------------------------------------------------------
+
+uno::Sequence< beans::PropertyState > SAL_CALL SvxShape::getPropertyStates( const uno::Sequence< OUString >& aPropertyName )
+ throw(beans::UnknownPropertyException, uno::RuntimeException)
+{
+ const sal_Int32 nCount = aPropertyName.getLength();
+ const OUString* pNames = aPropertyName.getConstArray();
+
+ uno::Sequence< beans::PropertyState > aRet( nCount );
+ beans::PropertyState* pState = aRet.getArray();
+
+ if( mpImpl->mpMaster )
+ {
+ for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++ )
+ pState[nIdx] = getPropertyState( pNames[nIdx] );
+
+ }
+ else
+ {
+ for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++ )
+ pState[nIdx] = getPropertyState( pNames[nIdx] );
+ }
+
+ return aRet;
+}
+
+//----------------------------------------------------------------------
+
+void SAL_CALL SvxShape::setPropertyToDefault( const OUString& PropertyName )
+ throw(beans::UnknownPropertyException, uno::RuntimeException)
+{
+ if( mpImpl->mpMaster )
+ {
+ mpImpl->mpMaster->setPropertyToDefault( PropertyName );
+ }
+ else
+ {
+ _setPropertyToDefault( PropertyName );
+ }
+}
+
+void SAL_CALL SvxShape::_setPropertyToDefault( const OUString& PropertyName )
+ throw(beans::UnknownPropertyException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ const SfxItemPropertySimpleEntry* pProperty = mpPropSet->getPropertyMapEntry(PropertyName);
+
+ if( !mpObj.is() || mpModel == NULL || pProperty == NULL )
+ throw beans::UnknownPropertyException();
+
+ if( !setPropertyToDefaultImpl( pProperty ) )
+ {
+ mpObj->ClearMergedItem( pProperty->nWID );
+ }
+
+ mpModel->SetChanged();
+}
+
+//----------------------------------------------------------------------
+
+uno::Any SAL_CALL SvxShape::getPropertyDefault( const OUString& aPropertyName )
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( mpImpl->mpMaster )
+ {
+ return mpImpl->mpMaster->getPropertyDefault( aPropertyName );
+ }
+ else
+ {
+ return _getPropertyDefault( aPropertyName );
+ }
+}
+
+uno::Any SAL_CALL SvxShape::_getPropertyDefault( const OUString& aPropertyName )
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(aPropertyName);
+
+ if( !mpObj.is() || pMap == NULL || mpModel == NULL )
+ throw beans::UnknownPropertyException();
+
+ if(( pMap->nWID >= OWN_ATTR_VALUE_START && pMap->nWID <= OWN_ATTR_VALUE_END ) ||
+ ( pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST ))
+ {
+ return getPropertyValue( aPropertyName );
+ }
+
+ // Default aus ItemPool holen
+ if(!mpModel->GetItemPool().IsWhich(pMap->nWID))
+ throw beans::UnknownPropertyException();
+
+ SfxItemSet aSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID);
+ aSet.Put(mpModel->GetItemPool().GetDefaultItem(pMap->nWID));
+
+ return GetAnyForItem( aSet, pMap );
+}
+
+// XMultiPropertyStates
+void SvxShape::setAllPropertiesToDefault() throw (uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( !mpObj.is() )
+ throw lang::DisposedException();
+ mpObj->ClearMergedItem(); // nWhich == 0 => all
+
+ if(mpObj->ISA(SdrGrafObj))
+ {
+ // defaults for graphic objects have changed:
+ mpObj->SetMergedItem( XFillStyleItem( XFILL_NONE ) );
+ mpObj->SetMergedItem( XLineStyleItem( XLINE_NONE ) );
+ }
+
+ // #i68523# special handling for Svx3DCharacterModeItem, this is not saved
+ // but needs to be sal_True in svx, pool default (false) in sch. Since sch
+ // does not load lathe or extrude objects, it is possible to set the items
+ // here.
+ // For other solution possibilities, see task description.
+ if(mpObj->ISA(E3dLatheObj) || mpObj->ISA(E3dExtrudeObj))
+ {
+ mpObj->SetMergedItem(Svx3DCharacterModeItem(true));
+ }
+
+ mpModel->SetChanged();
+}
+
+void SvxShape::setPropertiesToDefault(
+ const uno::Sequence<OUString>& aPropertyNames )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ for ( sal_Int32 pos = 0; pos < aPropertyNames.getLength(); ++pos )
+ setPropertyToDefault( aPropertyNames[pos] );
+}
+
+uno::Sequence<uno::Any> SvxShape::getPropertyDefaults(
+ const uno::Sequence<OUString>& aPropertyNames )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ ::std::vector<uno::Any> ret;
+ for ( sal_Int32 pos = 0; pos < aPropertyNames.getLength(); ++pos )
+ ret.push_back( getPropertyDefault( aPropertyNames[pos] ) );
+ return uno::Sequence<uno::Any>( &ret[0], ret.size() );
+}
+
+//----------------------------------------------------------------------
+
+//----------------------------------------------------------------------
+// XServiceInfo
+//----------------------------------------------------------------------
+OUString SAL_CALL SvxShape::getImplementationName()
+ throw(uno::RuntimeException)
+{
+ static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM("SvxShape") );
+ return aServiceName;
+}
+
+#define STAR_NAMESPACE "com.sun.star."
+
+const char* sUNO_service_style_ParagraphProperties = STAR_NAMESPACE "style.ParagraphProperties";
+const char* sUNO_service_style_ParagraphPropertiesComplex = STAR_NAMESPACE "style.ParagraphPropertiesComplex";
+const char* sUNO_service_style_ParagraphPropertiesAsian = STAR_NAMESPACE "style.ParagraphPropertiesAsian";
+const char* sUNO_service_style_CharacterProperties = STAR_NAMESPACE "style.CharacterProperties";
+const char* sUNO_service_style_CharacterPropertiesComplex = STAR_NAMESPACE "style.CharacterPropertiesComplex";
+const char* sUNO_service_style_CharacterPropertiesAsian = STAR_NAMESPACE "style.CharacterPropertiesAsian";
+
+const char* sUNO_service_drawing_FillProperties = STAR_NAMESPACE "drawing.FillProperties";
+const char* sUNO_service_drawing_TextProperties = STAR_NAMESPACE "drawing.TextProperties";
+const char* sUNO_service_drawing_LineProperties = STAR_NAMESPACE "drawing.LineProperties";
+const char* sUNO_service_drawing_ConnectorProperties = STAR_NAMESPACE "drawing.ConnectorProperties";
+const char* sUNO_service_drawing_MeasureProperties = STAR_NAMESPACE "drawing.MeasureProperties";
+const char* sUNO_service_drawing_ShadowProperties = STAR_NAMESPACE "drawing.ShadowProperties";
+
+const char* sUNO_service_drawing_RotationDescriptor = STAR_NAMESPACE "drawing.RotationDescriptor";
+
+const char* sUNO_service_drawing_Text = STAR_NAMESPACE "drawing.Text";
+const char* sUNO_service_drawing_GroupShape = STAR_NAMESPACE "drawing.GroupShape";
+
+const char* sUNO_service_drawing_CustomShapeProperties = STAR_NAMESPACE "drawing.CustomShapeProperties";
+const char* sUNO_service_drawing_CustomShape = STAR_NAMESPACE "drawing.CustomShape";
+
+const char* sUNO_service_drawing_PolyPolygonDescriptor = STAR_NAMESPACE "drawing.PolyPolygonDescriptor";
+const char* sUNO_service_drawing_PolyPolygonBezierDescriptor= STAR_NAMESPACE "drawing.PolyPolygonBezierDescriptor";
+
+const char* sUNO_service_drawing_LineShape = STAR_NAMESPACE "drawing.LineShape";
+const char* sUNO_service_drawing_Shape = STAR_NAMESPACE "drawing.Shape";
+const char* sUNO_service_drawing_RectangleShape = STAR_NAMESPACE "drawing.RectangleShape";
+const char* sUNO_service_drawing_EllipseShape = STAR_NAMESPACE "drawing.EllipseShape";
+const char* sUNO_service_drawing_PolyPolygonShape = STAR_NAMESPACE "drawing.PolyPolygonShape";
+const char* sUNO_service_drawing_PolyLineShape = STAR_NAMESPACE "drawing.PolyLineShape";
+const char* sUNO_service_drawing_OpenBezierShape = STAR_NAMESPACE "drawing.OpenBezierShape";
+const char* sUNO_service_drawing_ClosedBezierShape = STAR_NAMESPACE "drawing.ClosedBezierShape";
+const char* sUNO_service_drawing_TextShape = STAR_NAMESPACE "drawing.TextShape";
+const char* sUNO_service_drawing_GraphicObjectShape = STAR_NAMESPACE "drawing.GraphicObjectShape";
+const char* sUNO_service_drawing_OLE2Shape = STAR_NAMESPACE "drawing.OLE2Shape";
+const char* sUNO_service_drawing_PageShape = STAR_NAMESPACE "drawing.PageShape";
+const char* sUNO_service_drawing_CaptionShape = STAR_NAMESPACE "drawing.CaptionShape";
+const char* sUNO_service_drawing_MeasureShape = STAR_NAMESPACE "drawing.MeasureShape";
+const char* sUNO_service_drawing_FrameShape = STAR_NAMESPACE "drawing.FrameShape";
+const char* sUNO_service_drawing_ControlShape = STAR_NAMESPACE "drawing.ControlShape";
+const char* sUNO_service_drawing_ConnectorShape = STAR_NAMESPACE "drawing.ConnectorShape";
+const char* sUNO_service_drawing_MediaShape = STAR_NAMESPACE "drawing.MediaShape";
+
+
+uno::Sequence< OUString > SAL_CALL SvxShape::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ if( mpImpl->mpMaster )
+ {
+ return mpImpl->mpMaster->getSupportedServiceNames();
+ }
+ else
+ {
+ return _getSupportedServiceNames();
+ }
+}
+
+uno::Sequence< OUString > SAL_CALL SvxShape::_getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mpObj.is() && mpObj->GetObjInventor() == SdrInventor)
+ {
+ const sal_uInt16 nIdent = mpObj->GetObjIdentifier();
+
+ switch(nIdent)
+ {
+ case OBJ_GRUP:
+ {
+ static uno::Sequence< OUString > *pSeq = 0;
+ if( 0 == pSeq )
+ {
+// OGuard aGuard( Application::GetSolarMutex() );
+// if( 0 == pSeq )
+ {
+ static uno::Sequence< OUString > SvxShape_GroupServices;
+
+ comphelper::ServiceInfoHelper::addToSequence( SvxShape_GroupServices, 2,
+ sUNO_service_drawing_GroupShape,
+ sUNO_service_drawing_Shape );
+
+ pSeq = &SvxShape_GroupServices;
+ }
+ }
+
+ return *pSeq;
+ }
+ case OBJ_CUSTOMSHAPE:
+ {
+ static uno::Sequence< OUString > *pSeq = 0;
+ if( 0 == pSeq )
+ {
+// OGuard aGuard( Application::GetSolarMutex() );
+// if( 0 == pSeq )
+ {
+ static uno::Sequence< OUString > SvxShape_CustomShapeServices;
+
+ comphelper::ServiceInfoHelper::addToSequence( SvxShape_CustomShapeServices, 13,
+ sUNO_service_drawing_CustomShape,
+ sUNO_service_drawing_Shape,
+ sUNO_service_drawing_CustomShapeProperties,
+ sUNO_service_drawing_FillProperties,
+ sUNO_service_drawing_LineProperties,
+ sUNO_service_drawing_Text,
+ sUNO_service_drawing_TextProperties,
+ sUNO_service_style_ParagraphProperties,
+ sUNO_service_style_ParagraphPropertiesComplex,
+ sUNO_service_style_ParagraphPropertiesAsian,
+ sUNO_service_style_CharacterProperties,
+ sUNO_service_style_CharacterPropertiesComplex,
+ sUNO_service_style_CharacterPropertiesAsian,
+ sUNO_service_drawing_ShadowProperties,
+ sUNO_service_drawing_RotationDescriptor);
+ pSeq = &SvxShape_CustomShapeServices;
+ }
+ }
+ return *pSeq;
+ }
+ case OBJ_LINE:
+ {
+ static uno::Sequence< OUString > *pSeq = 0;
+ if( 0 == pSeq )
+ {
+// OGuard aGuard( Application::GetSolarMutex() );
+// if( 0 == pSeq )
+ {
+ static uno::Sequence< OUString > SvxShape_LineServices;
+
+ comphelper::ServiceInfoHelper::addToSequence( SvxShape_LineServices,14,
+ sUNO_service_drawing_LineShape,
+
+ sUNO_service_drawing_Shape,
+ sUNO_service_drawing_LineProperties,
+
+ sUNO_service_drawing_Text,
+ sUNO_service_drawing_TextProperties,
+ sUNO_service_style_ParagraphProperties,
+ sUNO_service_style_ParagraphPropertiesComplex,
+ sUNO_service_style_ParagraphPropertiesAsian,
+ sUNO_service_style_CharacterProperties,
+ sUNO_service_style_CharacterPropertiesComplex,
+ sUNO_service_style_CharacterPropertiesAsian,
+
+ sUNO_service_drawing_PolyPolygonDescriptor,
+ sUNO_service_drawing_ShadowProperties,
+ sUNO_service_drawing_RotationDescriptor);
+
+ pSeq = &SvxShape_LineServices;
+ }
+ }
+ return *pSeq;
+ }
+
+ case OBJ_RECT:
+ {
+ static uno::Sequence< OUString > *pSeq = 0;
+ if( 0 == pSeq )
+ {
+// OGuard aGuard( Application::GetSolarMutex() );
+// if( 0 == pSeq )
+ {
+ static uno::Sequence< OUString > SvxShape_RectServices;
+
+ comphelper::ServiceInfoHelper::addToSequence( SvxShape_RectServices,14,
+ sUNO_service_drawing_RectangleShape,
+
+ sUNO_service_drawing_Shape,
+ sUNO_service_drawing_FillProperties,
+ sUNO_service_drawing_LineProperties,
+ sUNO_service_drawing_Text,
+ sUNO_service_drawing_TextProperties,
+ sUNO_service_style_ParagraphProperties,
+ sUNO_service_style_ParagraphPropertiesComplex,
+ sUNO_service_style_ParagraphPropertiesAsian,
+ sUNO_service_style_CharacterProperties,
+ sUNO_service_style_CharacterPropertiesComplex,
+ sUNO_service_style_CharacterPropertiesAsian,
+
+ sUNO_service_drawing_ShadowProperties,
+ sUNO_service_drawing_RotationDescriptor);
+ pSeq = &SvxShape_RectServices;
+ }
+
+ }
+ return *pSeq;
+ }
+
+ case OBJ_CIRC:
+ case OBJ_SECT:
+ case OBJ_CARC:
+ case OBJ_CCUT:
+ {
+ static uno::Sequence< OUString > *pSeq = 0;
+ if( 0 == pSeq )
+ {
+// OGuard aGuard( Application::GetSolarMutex() );
+// if( 0 == pSeq )
+ {
+ static uno::Sequence< OUString > SvxShape_CircServices;
+
+ comphelper::ServiceInfoHelper::addToSequence( SvxShape_CircServices,14,
+ sUNO_service_drawing_EllipseShape,
+
+ sUNO_service_drawing_Shape,
+ sUNO_service_drawing_FillProperties,
+ sUNO_service_drawing_LineProperties,
+
+ sUNO_service_drawing_Text,
+ sUNO_service_drawing_TextProperties,
+ sUNO_service_style_ParagraphProperties,
+ sUNO_service_style_ParagraphPropertiesComplex,
+ sUNO_service_style_ParagraphPropertiesAsian,
+ sUNO_service_style_CharacterProperties,
+ sUNO_service_style_CharacterPropertiesComplex,
+ sUNO_service_style_CharacterPropertiesAsian,
+
+ sUNO_service_drawing_ShadowProperties,
+ sUNO_service_drawing_RotationDescriptor);
+
+ pSeq = &SvxShape_CircServices;
+ }
+ }
+
+ return *pSeq;
+ }
+
+ case OBJ_PATHPLIN:
+ case OBJ_PLIN:
+ {
+ static uno::Sequence< OUString > *pSeq = 0;
+ if( 0 == pSeq )
+ {
+// OGuard aGuard( Application::GetSolarMutex() );
+// if( 0 == pSeq )
+ {
+ static uno::Sequence< OUString > SvxShape_PathServices;
+ comphelper::ServiceInfoHelper::addToSequence( SvxShape_PathServices,14,
+ sUNO_service_drawing_PolyLineShape,
+
+ sUNO_service_drawing_Shape,
+ sUNO_service_drawing_LineProperties,
+
+ sUNO_service_drawing_PolyPolygonDescriptor,
+
+ sUNO_service_drawing_Text,
+ sUNO_service_drawing_TextProperties,
+ sUNO_service_style_ParagraphProperties,
+ sUNO_service_style_ParagraphPropertiesComplex,
+ sUNO_service_style_ParagraphPropertiesAsian,
+ sUNO_service_style_CharacterProperties,
+ sUNO_service_style_CharacterPropertiesComplex,
+ sUNO_service_style_CharacterPropertiesAsian,
+
+ sUNO_service_drawing_ShadowProperties,
+ sUNO_service_drawing_RotationDescriptor);
+ pSeq = &SvxShape_PathServices;
+ }
+ }
+ return *pSeq;
+ }
+
+ case OBJ_PATHPOLY:
+ case OBJ_POLY:
+ {
+ static uno::Sequence< OUString > *pSeq = 0;
+ if( 0 == pSeq )
+ {
+// OGuard aGuard( Application::GetSolarMutex() );
+// if( 0 == pSeq )
+ {
+ static uno::Sequence< OUString > SvxShape_PolyServices;
+ comphelper::ServiceInfoHelper::addToSequence( SvxShape_PolyServices,15,
+ sUNO_service_drawing_PolyPolygonShape,
+
+ sUNO_service_drawing_Shape,
+ sUNO_service_drawing_LineProperties,
+ sUNO_service_drawing_FillProperties,
+
+ sUNO_service_drawing_PolyPolygonDescriptor,
+
+ sUNO_service_drawing_Text,
+ sUNO_service_drawing_TextProperties,
+ sUNO_service_style_ParagraphProperties,
+ sUNO_service_style_ParagraphPropertiesComplex,
+ sUNO_service_style_ParagraphPropertiesAsian,
+ sUNO_service_style_CharacterProperties,
+ sUNO_service_style_CharacterPropertiesComplex,
+ sUNO_service_style_CharacterPropertiesAsian,
+
+ sUNO_service_drawing_ShadowProperties,
+ sUNO_service_drawing_RotationDescriptor);
+
+ pSeq = &SvxShape_PolyServices;
+ }
+ }
+ return *pSeq;
+ }
+
+ case OBJ_FREELINE:
+ case OBJ_PATHLINE:
+ {
+ static uno::Sequence< OUString > *pSeq = 0;
+ if( 0 == pSeq )
+ {
+// OGuard aGuard( Application::GetSolarMutex() );
+// if( 0 == pSeq )
+ {
+ static uno::Sequence< OUString > SvxShape_FreeLineServices;
+
+ comphelper::ServiceInfoHelper::addToSequence( SvxShape_FreeLineServices,15,
+ sUNO_service_drawing_OpenBezierShape,
+
+ sUNO_service_drawing_Shape,
+ sUNO_service_drawing_LineProperties,
+ sUNO_service_drawing_FillProperties,
+
+ sUNO_service_drawing_PolyPolygonBezierDescriptor,
+
+ sUNO_service_drawing_Text,
+ sUNO_service_drawing_TextProperties,
+ sUNO_service_style_ParagraphProperties,
+ sUNO_service_style_ParagraphPropertiesComplex,
+ sUNO_service_style_ParagraphPropertiesAsian,
+ sUNO_service_style_CharacterProperties,
+ sUNO_service_style_CharacterPropertiesComplex,
+ sUNO_service_style_CharacterPropertiesAsian,
+
+ sUNO_service_drawing_ShadowProperties,
+ sUNO_service_drawing_RotationDescriptor);
+
+ pSeq = &SvxShape_FreeLineServices;
+ }
+ }
+
+ return *pSeq;
+ }
+
+ case OBJ_FREEFILL:
+ case OBJ_PATHFILL:
+ {
+ static uno::Sequence< OUString > *pSeq = 0;
+ if( 0 == pSeq )
+ {
+// OGuard aGuard( Application::GetSolarMutex() );
+// if( 0 == pSeq )
+ {
+ static uno::Sequence< OUString > SvxShape_FreeFillServices;
+ comphelper::ServiceInfoHelper::addToSequence( SvxShape_FreeFillServices,15,
+ sUNO_service_drawing_ClosedBezierShape,
+
+ sUNO_service_drawing_Shape,
+ sUNO_service_drawing_LineProperties,
+ sUNO_service_drawing_FillProperties,
+
+ sUNO_service_drawing_PolyPolygonBezierDescriptor,
+
+ sUNO_service_drawing_Text,
+ sUNO_service_drawing_TextProperties,
+ sUNO_service_style_ParagraphProperties,
+ sUNO_service_style_ParagraphPropertiesComplex,
+ sUNO_service_style_ParagraphPropertiesAsian,
+ sUNO_service_style_CharacterProperties,
+ sUNO_service_style_CharacterPropertiesComplex,
+ sUNO_service_style_CharacterPropertiesAsian,
+
+ sUNO_service_drawing_ShadowProperties,
+ sUNO_service_drawing_RotationDescriptor);
+
+ pSeq = &SvxShape_FreeFillServices;
+ }
+ }
+ return *pSeq;
+ }
+
+ case OBJ_OUTLINETEXT:
+ case OBJ_TITLETEXT:
+ case OBJ_TEXT:
+ {
+ static uno::Sequence< OUString > *pSeq = 0;
+ if( 0 == pSeq )
+ {
+// OGuard aGuard( Application::GetSolarMutex() );
+// if( 0 == pSeq )
+ {
+ static uno::Sequence< OUString > SvxShape_TextServices;
+ comphelper::ServiceInfoHelper::addToSequence( SvxShape_TextServices,14,
+ sUNO_service_drawing_TextShape,
+
+ sUNO_service_drawing_Shape,
+ sUNO_service_drawing_FillProperties,
+ sUNO_service_drawing_LineProperties,
+
+ sUNO_service_drawing_Text,
+ sUNO_service_drawing_TextProperties,
+ sUNO_service_style_ParagraphProperties,
+ sUNO_service_style_ParagraphPropertiesComplex,
+ sUNO_service_style_ParagraphPropertiesAsian,
+ sUNO_service_style_CharacterProperties,
+ sUNO_service_style_CharacterPropertiesComplex,
+ sUNO_service_style_CharacterPropertiesAsian,
+
+ sUNO_service_drawing_ShadowProperties,
+ sUNO_service_drawing_RotationDescriptor);
+
+ pSeq = &SvxShape_TextServices;
+ }
+ }
+ return *pSeq;
+ }
+
+ case OBJ_GRAF:
+ {
+ static uno::Sequence< OUString > *pSeq = 0;
+ if( 0 == pSeq )
+ {
+// OGuard aGuard( Application::GetSolarMutex() );
+// if( 0 == pSeq )
+ {
+ static uno::Sequence< OUString > SvxShape_GrafServices;
+ comphelper::ServiceInfoHelper::addToSequence( SvxShape_GrafServices, 12,
+ sUNO_service_drawing_GraphicObjectShape,
+
+ sUNO_service_drawing_Shape,
+
+ sUNO_service_drawing_Text,
+ sUNO_service_drawing_TextProperties,
+ sUNO_service_style_ParagraphProperties,
+ sUNO_service_style_ParagraphPropertiesComplex,
+ sUNO_service_style_ParagraphPropertiesAsian,
+ sUNO_service_style_CharacterProperties,
+ sUNO_service_style_CharacterPropertiesComplex,
+ sUNO_service_style_CharacterPropertiesAsian,
+
+ sUNO_service_drawing_ShadowProperties,
+ sUNO_service_drawing_RotationDescriptor);
+
+ pSeq = &SvxShape_GrafServices;
+ }
+ }
+ return *pSeq;
+ }
+
+ case OBJ_OLE2:
+ {
+ static uno::Sequence< OUString > *pSeq = 0;
+ if( 0 == pSeq )
+ {
+// OGuard aGuard( Application::GetSolarMutex() );
+// if( 0 == pSeq )
+ {
+ static uno::Sequence< OUString > SvxShape_Ole2Services;
+
+ comphelper::ServiceInfoHelper::addToSequence( SvxShape_Ole2Services, 2,
+ sUNO_service_drawing_OLE2Shape,
+ sUNO_service_drawing_Shape);
+
+ pSeq = &SvxShape_Ole2Services;
+ }
+ }
+ return *pSeq;
+ }
+
+ case OBJ_CAPTION:
+ {
+ static uno::Sequence< OUString > *pSeq = 0;
+ if( 0 == pSeq )
+ {
+// OGuard aGuard( Application::GetSolarMutex() );
+// if( 0 == pSeq )
+ {
+ static uno::Sequence< OUString > SvxShape_CaptionServices;
+
+ comphelper::ServiceInfoHelper::addToSequence( SvxShape_CaptionServices,14,
+ sUNO_service_drawing_CaptionShape,
+
+ sUNO_service_drawing_Shape,
+ sUNO_service_drawing_FillProperties,
+ sUNO_service_drawing_LineProperties,
+
+ sUNO_service_drawing_Text,
+ sUNO_service_drawing_TextProperties,
+ sUNO_service_style_ParagraphProperties,
+ sUNO_service_style_ParagraphPropertiesComplex,
+ sUNO_service_style_ParagraphPropertiesAsian,
+ sUNO_service_style_CharacterProperties,
+ sUNO_service_style_CharacterPropertiesComplex,
+ sUNO_service_style_CharacterPropertiesAsian,
+
+ sUNO_service_drawing_ShadowProperties,
+ sUNO_service_drawing_RotationDescriptor);
+
+ pSeq = &SvxShape_CaptionServices;
+ }
+ }
+
+ return *pSeq;
+ }
+
+ case OBJ_PAGE:
+ {
+ static uno::Sequence< OUString > *pSeq = 0;
+ if( 0 == pSeq )
+ {
+// OGuard aGuard( Application::GetSolarMutex() );
+// if( 0 == pSeq )
+ {
+ static uno::Sequence< OUString > SvxShape_PageServices;
+
+ comphelper::ServiceInfoHelper::addToSequence( SvxShape_PageServices, 2,
+ sUNO_service_drawing_PageShape,
+ sUNO_service_drawing_Shape );
+
+ pSeq = &SvxShape_PageServices;
+ }
+ }
+
+ return *pSeq;
+ }
+
+ case OBJ_MEASURE:
+ {
+ static uno::Sequence< OUString > *pSeq = 0;
+ if( 0 == pSeq )
+ {
+// OGuard aGuard( Application::GetSolarMutex() );
+// if( 0 == pSeq )
+ {
+ static uno::Sequence< OUString > SvxShape_MeasureServices;
+ comphelper::ServiceInfoHelper::addToSequence( SvxShape_MeasureServices,15,
+ sUNO_service_drawing_MeasureShape,
+
+ sUNO_service_drawing_MeasureProperties,
+
+ sUNO_service_drawing_Shape,
+ sUNO_service_drawing_LineProperties,
+
+ sUNO_service_drawing_Text,
+ sUNO_service_drawing_TextProperties,
+ sUNO_service_style_ParagraphProperties,
+ sUNO_service_style_ParagraphPropertiesComplex,
+ sUNO_service_style_ParagraphPropertiesAsian,
+ sUNO_service_style_CharacterProperties,
+ sUNO_service_style_CharacterPropertiesComplex,
+ sUNO_service_style_CharacterPropertiesAsian,
+
+ sUNO_service_drawing_PolyPolygonDescriptor,
+ sUNO_service_drawing_ShadowProperties,
+ sUNO_service_drawing_RotationDescriptor);
+
+ pSeq = &SvxShape_MeasureServices;
+ }
+ }
+
+ return *pSeq;
+ }
+
+ case OBJ_FRAME:
+ {
+ static uno::Sequence< OUString > *pSeq = 0;
+ if( 0 == pSeq )
+ {
+// OGuard aGuard( Application::GetSolarMutex() );
+// if( 0 == pSeq )
+ {
+ static uno::Sequence< OUString > SvxShape_FrameServices;
+
+ comphelper::ServiceInfoHelper::addToSequence( SvxShape_FrameServices, 2,
+ sUNO_service_drawing_FrameShape,
+ sUNO_service_drawing_Shape );
+
+ pSeq = &SvxShape_FrameServices;
+ }
+ }
+
+ return *pSeq;
+ }
+
+ case OBJ_UNO:
+ {
+ static uno::Sequence< OUString > *pSeq = 0;
+ if( 0 == pSeq )
+ {
+// OGuard _aGuard( Application::GetSolarMutex() );
+// if( 0 == pSeq )
+ {
+ static uno::Sequence< OUString > SvxShape_UnoServices;
+ comphelper::ServiceInfoHelper::addToSequence( SvxShape_UnoServices, 2,
+ sUNO_service_drawing_ControlShape,
+ sUNO_service_drawing_Shape );
+
+ pSeq = &SvxShape_UnoServices;
+ }
+ }
+ return *pSeq;
+ }
+
+ case OBJ_EDGE:
+ {
+ static uno::Sequence< OUString > *pSeq = 0;
+ if( 0 == pSeq )
+ {
+// OGuard aGuard( Application::GetSolarMutex() );
+// if( 0 == pSeq )
+ {
+ static uno::Sequence< OUString > SvxShape_EdgeServices;
+
+ comphelper::ServiceInfoHelper::addToSequence( SvxShape_EdgeServices,15,
+ sUNO_service_drawing_ConnectorShape,
+ sUNO_service_drawing_ConnectorProperties,
+
+ sUNO_service_drawing_Shape,
+ sUNO_service_drawing_LineProperties,
+
+ sUNO_service_drawing_Text,
+ sUNO_service_drawing_TextProperties,
+ sUNO_service_style_ParagraphProperties,
+ sUNO_service_style_ParagraphPropertiesComplex,
+ sUNO_service_style_ParagraphPropertiesAsian,
+ sUNO_service_style_CharacterProperties,
+ sUNO_service_style_CharacterPropertiesComplex,
+ sUNO_service_style_CharacterPropertiesAsian,
+
+ sUNO_service_drawing_PolyPolygonDescriptor,
+ sUNO_service_drawing_ShadowProperties,
+ sUNO_service_drawing_RotationDescriptor);
+
+ pSeq = &SvxShape_EdgeServices;
+ }
+ }
+ return *pSeq;
+ }
+ case OBJ_MEDIA:
+ {
+ static uno::Sequence< OUString > *pSeq = 0;
+ if( 0 == pSeq )
+ {
+// OGuard aGuard( Application::GetSolarMutex() );
+// if( 0 == pSeq )
+ {
+ static uno::Sequence< OUString > SvxShape_MediaServices;
+
+ comphelper::ServiceInfoHelper::addToSequence( SvxShape_MediaServices, 2,
+ sUNO_service_drawing_MediaShape,
+ sUNO_service_drawing_Shape);
+
+ pSeq = &SvxShape_MediaServices;
+ }
+ }
+ return *pSeq;
+ }
+ }
+ }
+ else if( mpObj.is() && mpObj->GetObjInventor() == FmFormInventor)
+ {
+#if OSL_DEBUG_LEVEL > 0
+ const sal_uInt16 nIdent = mpObj->GetObjIdentifier();
+ OSL_ENSURE( nIdent == OBJ_UNO, "SvxShape::_getSupportedServiceNames: FmFormInventor, but no UNO object?" );
+#endif
+ static uno::Sequence< OUString > *pSeq = 0;
+ if( 0 == pSeq )
+ {
+// OGuard aGuard( Application::GetSolarMutex() );
+// if( 0 == pSeq )
+ {
+ static uno::Sequence< OUString > SvxShape_UnoServices;
+ comphelper::ServiceInfoHelper::addToSequence( SvxShape_UnoServices, 2,
+ sUNO_service_drawing_ControlShape,
+ sUNO_service_drawing_Shape );
+
+ pSeq = &SvxShape_UnoServices;
+ }
+ }
+ return *pSeq;
+ }
+ OSL_ENSURE( false, "SvxShape::_getSupportedServiceNames: could not determine object type!" );
+ uno::Sequence< OUString > aSeq;
+ return aSeq;
+}
+
+//----------------------------------------------------------------------
+sal_Bool SAL_CALL SvxShape::supportsService( const OUString& ServiceName ) throw ( uno::RuntimeException )
+{
+ Sequence< OUString > SupportedServices( getSupportedServiceNames() );
+ const ::rtl::OUString * pArray = SupportedServices.getConstArray();
+ const sal_Int32 nCount = SupportedServices.getLength();
+ sal_Int32 i;
+ for( i = 0; i < nCount; i++ )
+ if( *pArray++ == ServiceName )
+ return sal_True;
+ return sal_False;
+}
+
+//----------------------------------------------------------------------
+
+// XGluePointsSupplier
+uno::Reference< container::XIndexContainer > SAL_CALL SvxShape::getGluePoints()
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ uno::Reference< container::XIndexContainer > xGluePoints( mxGluePoints );
+
+ if( mpObj.is() && !xGluePoints.is() )
+ {
+ uno::Reference< container::XIndexContainer > xNew( SvxUnoGluePointAccess_createInstance( mpObj.get() ), uno::UNO_QUERY );
+ mxGluePoints = xGluePoints = xNew;
+ }
+
+ return xGluePoints;
+}
+
+//----------------------------------------------------------------------
+
+// XChild
+uno::Reference< uno::XInterface > SAL_CALL SvxShape::getParent( )
+ throw(uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mpObj.is() && mpObj->GetObjList() )
+ {
+ SdrObjList* pObjList = mpObj->GetObjList();
+
+ switch( pObjList->GetListKind() )
+ {
+ case SDROBJLIST_GROUPOBJ:
+ if( pObjList->GetOwnerObj()->ISA( SdrObjGroup ) )
+ return PTR_CAST( SdrObjGroup, pObjList->GetOwnerObj())->getUnoShape();
+ else if( pObjList->GetOwnerObj()->ISA( E3dScene ) )
+ return PTR_CAST( E3dScene, pObjList->GetOwnerObj())->getUnoShape();
+ break;
+ case SDROBJLIST_DRAWPAGE:
+ case SDROBJLIST_MASTERPAGE:
+ return PTR_CAST( SdrPage, pObjList )->getUnoPage();
+ default:
+ DBG_ERROR( "SvxShape::getParent( ): unexpected SdrObjListKind" );
+ break;
+ }
+ }
+
+ uno::Reference< uno::XInterface > xParent;
+ return xParent;
+}
+
+//----------------------------------------------------------------------
+
+void SAL_CALL SvxShape::setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& )
+ throw(lang::NoSupportException, uno::RuntimeException)
+{
+ throw lang::NoSupportException();
+}
+
+//----------------------------------------------------------------------
+
+/** called from the XActionLockable interface methods on initial locking */
+void SvxShape::lock()
+{
+}
+
+//----------------------------------------------------------------------
+
+/** called from the XActionLockable interface methods on final unlock */
+void SvxShape::unlock()
+{
+}
+
+//----------------------------------------------------------------------
+
+// XActionLockable
+sal_Bool SAL_CALL SvxShape::isActionLocked( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ return mnLockCount != 0;
+}
+
+//----------------------------------------------------------------------
+
+void SAL_CALL SvxShape::addActionLock( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ DBG_ASSERT( mnLockCount < 0xffff, "lock overflow in SvxShape!" );
+ mnLockCount++;
+
+ if( mnLockCount == 1 )
+ lock();
+}
+
+//----------------------------------------------------------------------
+
+void SAL_CALL SvxShape::removeActionLock( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ DBG_ASSERT( mnLockCount > 0, "lock underflow in SvxShape!" );
+ mnLockCount--;
+
+ if( mnLockCount == 0 )
+ unlock();
+}
+
+//----------------------------------------------------------------------
+
+void SAL_CALL SvxShape::setActionLocks( sal_Int16 nLock ) throw (::com::sun::star::uno::RuntimeException )
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( (mnLockCount == 0) && (nLock != 0) )
+ unlock();
+
+ if( (mnLockCount != 0) && (nLock == 0) )
+ lock();
+
+ mnLockCount = (sal_uInt16)nLock;
+}
+
+//----------------------------------------------------------------------
+
+sal_Int16 SAL_CALL SvxShape::resetActionLocks( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mnLockCount != 0 )
+ unlock();
+
+ sal_Int16 nOldLocks = (sal_Int16)mnLockCount;
+ mnLockCount = 0;
+
+ return nOldLocks;
+}
+
+//----------------------------------------------------------------------
+
+/** since polygon shapes can change theire kind during editing, we have
+ to recheck it here.
+ Circle shapes also change theire kind, but theire all treated equal
+ so no update is necessary.
+*/
+void SvxShape::updateShapeKind()
+{
+ switch( mpImpl->mnObjId )
+ {
+ case OBJ_LINE:
+ case OBJ_POLY:
+ case OBJ_PLIN:
+ case OBJ_PATHLINE:
+ case OBJ_PATHFILL:
+ case OBJ_FREELINE:
+ case OBJ_FREEFILL:
+ case OBJ_PATHPOLY:
+ case OBJ_PATHPLIN:
+ {
+ const sal_uInt32 nId = mpObj->GetObjIdentifier();
+
+ if( nId != mpImpl->mnObjId )
+ {
+ mpImpl->mnObjId = nId;
+
+ }
+ break;
+ }
+ };
+}
+
+/***********************************************************************
+* class SvxShapeText *
+***********************************************************************/
+SvxShapeText::SvxShapeText() throw ()
+: SvxShape(NULL, aSvxMapProvider.GetMap(SVXMAP_TEXT), aSvxMapProvider.GetPropertySet(SVXMAP_TEXT, SdrObject::GetGlobalDrawObjectItemPool()) ), SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
+{
+}
+
+//----------------------------------------------------------------------
+SvxShapeText::SvxShapeText( SdrObject* pObject ) throw ()
+: SvxShape( pObject, aSvxMapProvider.GetMap(SVXMAP_TEXT), aSvxMapProvider.GetPropertySet(SVXMAP_TEXT, SdrObject::GetGlobalDrawObjectItemPool()) ), SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
+{
+ if( pObject && pObject->GetModel() )
+ SetEditSource( new SvxTextEditSource( pObject, 0, static_cast< uno::XWeak * >( this ) ) );
+}
+
+//----------------------------------------------------------------------
+SvxShapeText::SvxShapeText( SdrObject* pObject, const SfxItemPropertyMapEntry* pPropertyMap, const SvxItemPropertySet* pPropertySet ) throw ()
+: SvxShape( pObject, pPropertyMap, pPropertySet ), SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() )
+{
+ if( pObject && pObject->GetModel() )
+ SetEditSource( new SvxTextEditSource( pObject, 0, static_cast< uno::XWeak * >( this ) ) );
+}
+
+//----------------------------------------------------------------------
+SvxShapeText::~SvxShapeText() throw ()
+{
+ // check if only this instance is registered at the ranges
+ DBG_ASSERT( (NULL == GetEditSource()) || (GetEditSource()->getRanges().size()==1),
+ "svx::SvxShapeText::~SvxShapeText(), text shape with living text ranges destroyed!");
+}
+
+void SvxShapeText::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage )
+{
+ if( pNewObj && (NULL == GetEditSource()))
+ SetEditSource( new SvxTextEditSource( pNewObj, 0, static_cast< uno::XWeak* >(this) ) );
+
+ SvxShape::Create( pNewObj, pNewPage );
+}
+
+// XInterface
+//----------------------------------------------------------------------
+uno::Any SAL_CALL SvxShapeText::queryInterface( const uno::Type & rType )
+ throw( uno::RuntimeException )
+{
+ return SvxShape::queryInterface( rType );
+}
+
+//----------------------------------------------------------------------
+
+uno::Any SAL_CALL SvxShapeText::queryAggregation( const uno::Type & rType )
+ throw( uno::RuntimeException )
+{
+ uno::Any aAny( SvxShape::queryAggregation( rType ) );
+ if( aAny.hasValue() )
+ return aAny;
+
+ return SvxUnoTextBase::queryAggregation( rType );
+}
+
+//----------------------------------------------------------------------
+
+void SAL_CALL SvxShapeText::acquire() throw()
+{
+ SvxShape::acquire();
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SvxShapeText::release() throw()
+{
+ SvxShape::release();
+}
+
+// XServiceInfo
+//----------------------------------------------------------------------
+OUString SAL_CALL SvxShapeText::getImplementationName() throw( uno::RuntimeException )
+{
+ static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM("SvxShapeText") );
+ return aServiceName;
+}
+
+//----------------------------------------------------------------------
+uno::Sequence< OUString > SAL_CALL SvxShapeText::getSupportedServiceNames() throw( uno::RuntimeException )
+{
+ return SvxShape::getSupportedServiceNames();
+}
+
+//----------------------------------------------------------------------
+sal_Bool SAL_CALL SvxShapeText::supportsService( const OUString& ServiceName ) throw ( uno::RuntimeException )
+{
+ return SvxShape::supportsService(ServiceName);
+}
+
+ // XTypeProvider
+//----------------------------------------------------------------------
+uno::Sequence< uno::Type > SAL_CALL SvxShapeText::getTypes()
+ throw( uno::RuntimeException )
+{
+ return SvxShape::getTypes();
+}
+
+sal_Int64 SAL_CALL SvxShapeText::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException) \
+{
+ const sal_Int64 nReturn = SvxShape::getSomething( rId );
+ if( nReturn )
+ return nReturn;
+
+ return SvxUnoTextBase::getSomething( rId );
+}
+
+//----------------------------------------------------------------------
+uno::Sequence< sal_Int8 > SAL_CALL SvxShapeText::getImplementationId()
+ throw( uno::RuntimeException )
+{
+ static ::cppu::OImplementationId* pID = NULL ;
+
+ if ( pID == NULL )
+ {
+ // Ready for multithreading; get global mutex for first call of this method only! see before
+ MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ;
+
+ // Control these pointer again ... it can be, that another instance will be faster then these!
+ if ( pID == NULL )
+ {
+ // Create a new static ID ...
+ static ::cppu::OImplementationId aID( sal_False ) ;
+ // ... and set his address to static pointer!
+ pID = &aID ;
+ }
+ }
+
+ return pID->getImplementationId() ;
+}
+
+//----------------------------------------------------------------------
+
+/** called from the XActionLockable interface methods on initial locking */
+void SvxShapeText::lock()
+{
+ SvxTextEditSource* pEditSource = (SvxTextEditSource*)GetEditSource();
+ if( pEditSource )
+ pEditSource->lock();
+}
+
+//----------------------------------------------------------------------
+
+/** called from the XActionLockable interface methods on final unlock */
+void SvxShapeText::unlock()
+{
+ SvxTextEditSource* pEditSource = (SvxTextEditSource*)GetEditSource();
+ if( pEditSource )
+ pEditSource->unlock();
+}
+
+// ::com::sun::star::text::XTextRange
+uno::Reference< text::XTextRange > SAL_CALL SvxShapeText::getStart() throw(uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
+ if( pForwarder )
+ ::GetSelection( maSelection, pForwarder );
+ return SvxUnoTextBase::getStart();
+
+}
+
+uno::Reference< text::XTextRange > SAL_CALL SvxShapeText::getEnd() throw(uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
+ if( pForwarder )
+ ::GetSelection( maSelection, pForwarder );
+ return SvxUnoTextBase::getEnd();
+}
+
+OUString SAL_CALL SvxShapeText::getString() throw(uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
+ if( pForwarder )
+ ::GetSelection( maSelection, pForwarder );
+ return SvxUnoTextBase::getString();
+}
+
+
+void SAL_CALL SvxShapeText::setString( const OUString& aString ) throw(uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
+ if( pForwarder )
+ ::GetSelection( maSelection, pForwarder );
+ SvxUnoTextBase::setString( aString );
+}
+
+// overide these for special property handling in subcasses. Return true if property is handled
+bool SvxShapeText::setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ // HACK-fix #99090#
+ // since SdrTextObj::SetVerticalWriting exchanges
+ // SDRATTR_TEXT_AUTOGROWWIDTH and SDRATTR_TEXT_AUTOGROWHEIGHT,
+ // we have to set the textdirection here
+
+ if( pProperty->nWID == SDRATTR_TEXTDIRECTION )
+ {
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mpObj.get() );
+ if( pTextObj )
+ {
+ com::sun::star::text::WritingMode eMode;
+ if( rValue >>= eMode )
+ {
+ pTextObj->SetVerticalWriting( eMode == com::sun::star::text::WritingMode_TB_RL );
+ }
+ }
+ return true;
+ }
+ return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
+}
+
+bool SvxShapeText::getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ if( pProperty->nWID == SDRATTR_TEXTDIRECTION )
+ {
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mpObj.get() );
+ if( pTextObj && pTextObj->IsVerticalWriting() )
+ rValue <<= com::sun::star::text::WritingMode_TB_RL;
+ else
+ rValue <<= com::sun::star::text::WritingMode_LR_TB;
+ return true;
+ }
+
+ return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
+}
+
+bool SvxShapeText::getPropertyStateImpl( const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::beans::PropertyState& rState ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
+{
+ return SvxShape::getPropertyStateImpl( pProperty, rState );
+}
+
+bool SvxShapeText::setPropertyToDefaultImpl( const SfxItemPropertySimpleEntry* pProperty ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
+{
+ return SvxShape::setPropertyToDefaultImpl( pProperty );
+}
+
+/***********************************************************************
+* class SvxShapeRect *
+***********************************************************************/
+DBG_NAME(SvxShapeRect)
+SvxShapeRect::SvxShapeRect( SdrObject* pObj ) throw()
+: SvxShapeText( pObj, aSvxMapProvider.GetMap(SVXMAP_SHAPE), aSvxMapProvider.GetPropertySet(SVXMAP_SHAPE, SdrObject::GetGlobalDrawObjectItemPool()))
+{
+ DBG_CTOR(SvxShapeRect,NULL);
+}
+
+SvxShapeRect::~SvxShapeRect() throw()
+{
+ DBG_DTOR(SvxShapeRect,NULL);
+}
+
+uno::Any SAL_CALL SvxShapeRect::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException)
+{
+ return SvxShapeText::queryInterface( rType );
+}
+
+uno::Any SAL_CALL SvxShapeRect::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
+{
+ return SvxShapeText::queryAggregation( rType );
+}
+
+void SAL_CALL SvxShapeRect::acquire() throw()
+{
+ OWeakAggObject::acquire();
+}
+
+void SAL_CALL SvxShapeRect::release() throw()
+{
+ OWeakAggObject::release();
+}
+//----------------------------------------------------------------------
+// XServiceInfo
+//----------------------------------------------------------------------
+uno::Sequence< OUString > SvxShapeRect::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ return SvxShape::getSupportedServiceNames();
+}
+
+/** returns a StarOffice API wrapper for the given SdrObject */
+uno::Reference< drawing::XShape > GetXShapeForSdrObject( SdrObject* pObj ) throw ()
+{
+ uno::Reference< drawing::XShape > xShape( pObj->getUnoShape(), uno::UNO_QUERY );
+ return xShape;
+}
+
+/** returns the SdrObject from the given StarOffice API wrapper */
+SdrObject* GetSdrObjectFromXShape( uno::Reference< drawing::XShape > xShape ) throw()
+{
+ SvxShape* pShape = SvxShape::getImplementation( xShape );
+ return pShape ? pShape->GetSdrObject() : 0;
+}
+
+//----------------------------------------------------------------------
+
+SdrObject* SdrObject::getSdrObjectFromXShape( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xInt )
+{
+ SvxShape* pSvxShape = SvxShape::getImplementation( xInt );
+ return pSvxShape ? pSvxShape->GetSdrObject() : 0;
+}
+
+uno::Any SvxItemPropertySet_getPropertyValue( const SvxItemPropertySet& rPropSet, const SfxItemPropertySimpleEntry* pMap, const SfxItemSet& rSet )
+{
+ if(!pMap || !pMap->nWID)
+ return uno::Any();
+
+ // Check is for items that store either metric values if thei are positiv or percentage if thei are negativ.
+ bool bDontConvertNegativeValues = ( pMap->nWID == XATTR_FILLBMP_SIZEX || pMap->nWID == XATTR_FILLBMP_SIZEY );
+ return rPropSet.getPropertyValue( pMap, rSet, (pMap->nWID != SDRATTR_XMLATTRIBUTES), bDontConvertNegativeValues );
+}
+
+void SvxItemPropertySet_setPropertyValue( const SvxItemPropertySet& rPropSet, const SfxItemPropertySimpleEntry* pMap, const uno::Any& rVal, SfxItemSet& rSet )
+{
+ if(!pMap || !pMap->nWID)
+ return;
+
+ bool bDontConvertNegativeValues = ( pMap->nWID == XATTR_FILLBMP_SIZEX || pMap->nWID == XATTR_FILLBMP_SIZEY );
+ rPropSet.setPropertyValue( pMap, rVal, rSet, bDontConvertNegativeValues );
+}
diff --git a/svx/source/unodraw/unoshcol.cxx b/svx/source/unodraw/unoshcol.cxx
new file mode 100644
index 000000000000..f42e06cd8619
--- /dev/null
+++ b/svx/source/unodraw/unoshcol.cxx
@@ -0,0 +1,258 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <com/sun/star/document/EventObject.hpp>
+
+#include "svx/unoshcol.hxx"
+#include <svx/unoprov.hxx>
+#include <comphelper/serviceinfohelper.hxx>
+
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::drawing;
+
+/***********************************************************************
+* *
+***********************************************************************/
+SvxShapeCollection::SvxShapeCollection() throw()
+: maShapeContainer( maMutex ), mrBHelper( maMutex )
+{
+}
+
+//----------------------------------------------------------------------
+SvxShapeCollection::~SvxShapeCollection() throw()
+{
+}
+
+
+//----------------------------------------------------------------------
+Reference< uno::XInterface > SvxShapeCollection_NewInstance() throw()
+{
+ Reference< drawing::XShapes > xShapes( new SvxShapeCollection() );
+ Reference< uno::XInterface > xRef( xShapes, UNO_QUERY );
+ return xRef;
+}
+
+// XInterface
+void SvxShapeCollection::release() throw()
+{
+ uno::Reference< uno::XInterface > x( xDelegator );
+ if (! x.is())
+ {
+ if (osl_decrementInterlockedCount( &m_refCount ) == 0)
+ {
+ if (! mrBHelper.bDisposed)
+ {
+ uno::Reference< uno::XInterface > xHoldAlive( (uno::XWeak*)this );
+ // First dispose
+ try
+ {
+ dispose();
+ }
+ catch(::com::sun::star::uno::Exception&)
+ {
+ // release should not throw exceptions
+ }
+
+ // only the alive ref holds the object
+ OSL_ASSERT( m_refCount == 1 );
+ // destroy the object if xHoldAlive decrement the refcount to 0
+ return;
+ }
+ }
+ // restore the reference count
+ osl_incrementInterlockedCount( &m_refCount );
+ }
+ OWeakAggObject::release();
+}
+
+// XComponent
+void SvxShapeCollection::disposing() throw()
+{
+ maShapeContainer.clear();
+}
+
+// XComponent
+void SvxShapeCollection::dispose()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ // An frequently programming error is to release the last
+ // reference to this object in the disposing message.
+ // Make it rubust, hold a self Reference.
+ uno::Reference< lang::XComponent > xSelf( this );
+
+ // Guard dispose against multible threading
+ // Remark: It is an error to call dispose more than once
+ sal_Bool bDoDispose = sal_False;
+ {
+ osl::MutexGuard aGuard( mrBHelper.rMutex );
+ if( !mrBHelper.bDisposed && !mrBHelper.bInDispose )
+ {
+ // only one call go into this section
+ mrBHelper.bInDispose = sal_True;
+ bDoDispose = sal_True;
+ }
+ }
+
+ // Do not hold the mutex because we are broadcasting
+ if( bDoDispose )
+ {
+ // Create an event with this as sender
+ try
+ {
+ uno::Reference< uno::XInterface > xSource( uno::Reference< uno::XInterface >::query( (lang::XComponent *)this ) );
+ document::EventObject aEvt;
+ aEvt.Source = xSource;
+ // inform all listeners to release this object
+ // The listener container are automaticly cleared
+ mrBHelper.aLC.disposeAndClear( aEvt );
+ // notify subclasses to do their dispose
+ disposing();
+ }
+ catch(::com::sun::star::uno::Exception& e)
+ {
+ // catch exception and throw again but signal that
+ // the object was disposed. Dispose should be called
+ // only once.
+ mrBHelper.bDisposed = sal_True;
+ mrBHelper.bInDispose = sal_False;
+ throw e;
+ }
+
+ // the values bDispose and bInDisposing must set in this order.
+ // No multithread call overcome the "!rBHelper.bDisposed && !rBHelper.bInDispose" guard.
+ mrBHelper.bDisposed = sal_True;
+ mrBHelper.bInDispose = sal_False;
+ }
+ else
+ {
+ // in a multithreaded environment, it can't be avoided, that dispose is called twice.
+ // However this condition is traced, because it MAY indicate an error.
+ OSL_TRACE( "OComponentHelper::dispose() - dispose called twice" );
+ }
+}
+
+// XComponent
+void SAL_CALL SvxShapeCollection::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ mrBHelper.addListener( ::getCppuType( &aListener ) , aListener );
+}
+
+// XComponent
+void SAL_CALL SvxShapeCollection::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ mrBHelper.removeListener( ::getCppuType( &aListener ) , aListener );
+}
+
+// XShapes
+//----------------------------------------------------------------------
+void SAL_CALL SvxShapeCollection::add( const Reference< drawing::XShape >& xShape ) throw( uno::RuntimeException )
+{
+ maShapeContainer.addInterface( xShape );
+}
+
+//----------------------------------------------------------------------
+void SAL_CALL SvxShapeCollection::remove( const uno::Reference< drawing::XShape >& xShape ) throw( uno::RuntimeException )
+{
+ maShapeContainer.removeInterface( xShape );
+}
+
+//----------------------------------------------------------------------
+sal_Int32 SAL_CALL SvxShapeCollection::getCount() throw( uno::RuntimeException )
+{
+ return maShapeContainer.getLength();
+}
+
+//----------------------------------------------------------------------
+uno::Any SAL_CALL SvxShapeCollection::getByIndex( sal_Int32 Index )
+ throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ if( Index < 0 || Index >= getCount() )
+ throw lang::IndexOutOfBoundsException();
+
+ uno::Sequence< Reference< uno::XInterface> > xElements( maShapeContainer.getElements() );
+
+
+ return uno::makeAny( Reference< XShape>(static_cast< drawing::XShape* >( xElements.getArray()[Index].get())) );
+}
+
+// XElementAccess
+
+//----------------------------------------------------------------------
+uno::Type SAL_CALL SvxShapeCollection::getElementType() throw( uno::RuntimeException )
+{
+ return ::getCppuType(( const Reference< drawing::XShape >*)0);
+}
+
+//----------------------------------------------------------------------
+sal_Bool SAL_CALL SvxShapeCollection::hasElements() throw( uno::RuntimeException )
+{
+ return getCount() != 0;
+}
+
+//----------------------------------------------------------------------
+// XServiceInfo
+//----------------------------------------------------------------------
+::rtl::OUString SAL_CALL SvxShapeCollection::getImplementationName()
+ throw( uno::RuntimeException )
+{
+ return getImplementationName_Static();
+}
+
+::rtl::OUString SvxShapeCollection::getImplementationName_Static()
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.SvxShapeCollection") );
+}
+
+sal_Bool SAL_CALL SvxShapeCollection::supportsService( const ::rtl::OUString& ServiceName )
+ throw( uno::RuntimeException )
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL SvxShapeCollection::getSupportedServiceNames() throw( uno::RuntimeException )
+{
+ return getSupportedServiceNames_Static();
+}
+
+uno::Sequence< ::rtl::OUString > SvxShapeCollection::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aSeq(2);
+ aSeq.getArray()[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Shapes") );
+ aSeq.getArray()[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ShapeCollection") );
+ return aSeq;
+}
+
+Reference< XInterface > SAL_CALL SvxShapeCollection_createInstance( const Reference< ::com::sun::star::lang::XMultiServiceFactory >& )
+{
+ return *( new SvxShapeCollection() );
+}
diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx
new file mode 100644
index 000000000000..2d82868512c5
--- /dev/null
+++ b/svx/source/unodraw/unoshtxt.cxx
@@ -0,0 +1,1155 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <com/sun/star/uno/XInterface.hpp>
+#include <vcl/svapp.hxx>
+
+#include <svx/unoshtxt.hxx>
+#include <editeng/unoedhlp.hxx>
+#include <svl/lstner.hxx>
+#include <rtl/ref.hxx>
+#include <osl/mutex.hxx>
+#include <svl/hint.hxx>
+#include <svl/style.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdetc.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/unoforou.hxx>
+#include <editeng/unoviwou.hxx>
+#include <editeng/outlobj.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/svdpage.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/editobj.hxx>
+
+#include <editeng/unotext.hxx>
+#include <com/sun/star/linguistic2/XLinguServiceManager.hpp>
+#include <comphelper/processfactory.hxx>
+#include <vos/mutex.hxx>
+#include <svx/sdrpaintwindow.hxx>
+
+using namespace ::osl;
+using namespace ::vos;
+using namespace ::rtl;
+
+using ::com::sun::star::uno::XInterface;
+
+namespace css = ::com::sun::star;
+
+
+//------------------------------------------------------------------------
+// SvxTextEditSourceImpl
+//------------------------------------------------------------------------
+
+/** @descr
+ <p>This class essentially provides the text and view forwarders. If
+ no SdrView is given, this class handles the UNO objects, which are
+ currently not concerned with view issues. In this case,
+ GetViewForwarder() always returns NULL and the underlying
+ EditEngine of the SvxTextForwarder is a background one (i.e. not
+ the official DrawOutliner, but one created exclusively for this
+ object, with no relation to a view).
+ </p>
+
+ <p>If a SdrView is given at construction time, the caller is
+ responsible for destroying this object when the view becomes
+ invalid (the views cannot notify). If GetViewForwarder(sal_True)
+ is called, the underlying shape is put into edit mode, the view
+ forwarder returned encapsulates the OutlinerView and the next call
+ to GetTextForwarder() yields a forwarder encapsulating the actual
+ DrawOutliner. Thus, changes on that Outliner are immediately
+ reflected on the screen. If the object leaves edit mode, the old
+ behaviour is restored.</p>
+ */
+class SvxTextEditSourceImpl : public SfxListener, public SfxBroadcaster, public sdr::ObjectUser
+{
+private:
+ oslInterlockedCount maRefCount;
+
+ SdrObject* mpObject;
+ SdrText* mpText;
+ SdrView* mpView;
+ const Window* mpWindow;
+ SdrModel* mpModel;
+ SdrOutliner* mpOutliner;
+ SvxOutlinerForwarder* mpTextForwarder;
+ SvxDrawOutlinerViewForwarder* mpViewForwarder; // if non-NULL, use GetViewModeTextForwarder text forwarder
+ css::uno::Reference< css::linguistic2::XLinguServiceManager > m_xLinguServiceManager;
+ Point maTextOffset;
+ sal_Bool mbDataValid;
+ sal_Bool mbDestroyed;
+ sal_Bool mbIsLocked;
+ sal_Bool mbNeedsUpdate;
+ sal_Bool mbOldUndoMode;
+ sal_Bool mbForwarderIsEditMode; // have to reflect that, since ENDEDIT can happen more often
+ sal_Bool mbShapeIsEditMode; // #104157# only true, if HINT_BEGEDIT was received
+ sal_Bool mbNotificationsDisabled; // prevent EditEngine/Outliner notifications (e.g. when setting up forwarder)
+
+ XInterface* mpOwner;
+ SvxUnoTextRangeBaseList maTextRanges;
+
+ SvxTextForwarder* GetBackgroundTextForwarder();
+ SvxTextForwarder* GetEditModeTextForwarder();
+ SvxDrawOutlinerViewForwarder* CreateViewForwarder();
+
+ void SetupOutliner();
+
+ sal_Bool HasView() const { return mpView ? sal_True : sal_False; }
+ sal_Bool IsEditMode() const
+ {
+ SdrTextObj* pTextObj = PTR_CAST( SdrTextObj, mpObject );
+ return mbShapeIsEditMode && pTextObj && pTextObj->IsTextEditActive() ? sal_True : sal_False;
+ }
+
+ void dispose();
+
+public:
+ SvxTextEditSourceImpl( SdrObject* pObject, SdrText* pText, XInterface* pOwner );
+ SvxTextEditSourceImpl( SdrObject& rObject, SdrText* pText, SdrView& rView, const Window& rWindow );
+ ~SvxTextEditSourceImpl();
+
+ void SAL_CALL acquire();
+ void SAL_CALL release();
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ SvxEditSource* Clone() const;
+ SvxTextForwarder* GetTextForwarder();
+ SvxEditViewForwarder* GetEditViewForwarder( sal_Bool );
+ void UpdateData();
+
+ void addRange( SvxUnoTextRangeBase* pNewRange );
+ void removeRange( SvxUnoTextRangeBase* pOldRange );
+ const SvxUnoTextRangeBaseList& getRanges() const;
+
+ SdrObject* GetSdrObject() const { return mpObject; }
+
+ void lock();
+ void unlock();
+
+ sal_Bool IsValid() const;
+
+ Rectangle GetVisArea();
+ Point LogicToPixel( const Point&, const MapMode& rMapMode );
+ Point PixelToLogic( const Point&, const MapMode& rMapMode );
+
+ DECL_LINK( NotifyHdl, EENotify* );
+
+ virtual void ObjectInDestruction(const SdrObject& rObject);
+
+ void ChangeModel( SdrModel* pNewModel );
+
+ void UpdateOutliner();
+};
+
+//------------------------------------------------------------------------
+
+SvxTextEditSourceImpl::SvxTextEditSourceImpl( SdrObject* pObject, SdrText* pText, XInterface* pOwner )
+ : maRefCount ( 0 ),
+ mpObject ( pObject ),
+ mpText ( pText ),
+ mpView ( NULL ),
+ mpWindow ( NULL ),
+ mpModel ( pObject ? pObject->GetModel() : NULL ),
+ mpOutliner ( NULL ),
+ mpTextForwarder ( NULL ),
+ mpViewForwarder ( NULL ),
+ mbDataValid ( sal_False ),
+ mbDestroyed ( sal_False ),
+ mbIsLocked ( sal_False ),
+ mbNeedsUpdate ( sal_False ),
+ mbOldUndoMode ( sal_False ),
+ mbForwarderIsEditMode ( sal_False ),
+ mbShapeIsEditMode ( sal_False ),
+ mbNotificationsDisabled ( sal_False ),
+ mpOwner( pOwner )
+{
+ DBG_ASSERT( mpObject, "invalid pObject!" );
+
+ if( !mpText )
+ {
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mpObject );
+ if( pTextObj )
+ mpText = pTextObj->getText( 0 );
+ }
+
+ if( mpModel )
+ StartListening( *mpModel );
+
+ if( mpObject )
+ mpObject->AddObjectUser( *this );
+}
+
+//------------------------------------------------------------------------
+
+SvxTextEditSourceImpl::SvxTextEditSourceImpl( SdrObject& rObject, SdrText* pText, SdrView& rView, const Window& rWindow )
+ : maRefCount ( 0 ),
+ mpObject ( &rObject ),
+ mpText ( pText ),
+ mpView ( &rView ),
+ mpWindow ( &rWindow ),
+ mpModel ( rObject.GetModel() ),
+ mpOutliner ( NULL ),
+ mpTextForwarder ( NULL ),
+ mpViewForwarder ( NULL ),
+ mbDataValid ( sal_False ),
+ mbDestroyed ( sal_False ),
+ mbIsLocked ( sal_False ),
+ mbNeedsUpdate ( sal_False ),
+ mbOldUndoMode ( sal_False ),
+ mbForwarderIsEditMode ( sal_False ),
+ mbShapeIsEditMode ( sal_True ),
+ mbNotificationsDisabled ( sal_False ),
+ mpOwner(0)
+{
+ if( !mpText )
+ {
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mpObject );
+ if( pTextObj )
+ mpText = pTextObj->getText( 0 );
+ }
+
+ if( mpModel )
+ StartListening( *mpModel );
+ if( mpView )
+ StartListening( *mpView );
+ if( mpObject )
+ mpObject->AddObjectUser( *this );
+
+ // #104157# Init edit mode state from shape info (IsTextEditActive())
+ mbShapeIsEditMode = IsEditMode();
+}
+
+//------------------------------------------------------------------------
+
+SvxTextEditSourceImpl::~SvxTextEditSourceImpl()
+{
+ DBG_ASSERT( mbIsLocked == sal_False, "text edit source was not unlocked before dispose!" );
+ if( mpObject )
+ mpObject->RemoveObjectUser( *this );
+
+ dispose();
+}
+
+//------------------------------------------------------------------------
+
+void SvxTextEditSourceImpl::addRange( SvxUnoTextRangeBase* pNewRange )
+{
+ if( pNewRange )
+ if( std::find( maTextRanges.begin(), maTextRanges.end(), pNewRange ) == maTextRanges.end() )
+ maTextRanges.push_back( pNewRange );
+}
+
+//------------------------------------------------------------------------
+
+void SvxTextEditSourceImpl::removeRange( SvxUnoTextRangeBase* pOldRange )
+{
+ if( pOldRange )
+ maTextRanges.remove( pOldRange );
+}
+
+//------------------------------------------------------------------------
+
+const SvxUnoTextRangeBaseList& SvxTextEditSourceImpl::getRanges() const
+{
+ return maTextRanges;
+}
+
+//------------------------------------------------------------------------
+
+void SAL_CALL SvxTextEditSourceImpl::acquire()
+{
+ osl_incrementInterlockedCount( &maRefCount );
+}
+
+//------------------------------------------------------------------------
+
+void SAL_CALL SvxTextEditSourceImpl::release()
+{
+ if( ! osl_decrementInterlockedCount( &maRefCount ) )
+ delete this;
+}
+
+void SvxTextEditSourceImpl::ChangeModel( SdrModel* pNewModel )
+{
+ if( mpModel != pNewModel )
+ {
+ if( mpModel )
+ EndListening( *mpModel );
+
+ if( mpOutliner )
+ {
+ if( mpModel )
+ mpModel->disposeOutliner( mpOutliner );
+ else
+ delete mpOutliner;
+ mpOutliner = 0;
+ }
+
+ if( mpView )
+ {
+ EndListening( *mpView );
+ mpView = 0;
+ }
+
+ mpWindow = 0;
+ m_xLinguServiceManager.clear();
+ mpOwner = 0;
+
+ mpModel = pNewModel;
+
+ if( mpTextForwarder )
+ {
+ delete mpTextForwarder;
+ mpTextForwarder = 0;
+ }
+
+ if( mpViewForwarder )
+ {
+ delete mpViewForwarder;
+ mpViewForwarder = 0;
+ }
+
+ if( mpModel )
+ StartListening( *mpModel );
+ }
+}
+
+//------------------------------------------------------------------------
+
+void SvxTextEditSourceImpl::Notify( SfxBroadcaster&, const SfxHint& rHint )
+{
+ // #i105988 keep reference to this object
+ rtl::Reference< SvxTextEditSourceImpl > xThis( this );
+
+ const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
+ const SvxViewHint* pViewHint = PTR_CAST( SvxViewHint, &rHint );
+
+ if( pViewHint )
+ {
+ switch( pViewHint->GetHintType() )
+ {
+ case SvxViewHint::SVX_HINT_VIEWCHANGED:
+ Broadcast( *pViewHint );
+ break;
+ }
+ }
+ else if( pSdrHint )
+ {
+ switch( pSdrHint->GetKind() )
+ {
+ case HINT_OBJCHG:
+ {
+ mbDataValid = sal_False; // Text muss neu geholt werden
+
+ if( HasView() )
+ {
+ // #104157# Update maTextOffset, object has changed
+ // #105196#, #105203#: Cannot call that // here,
+ // since TakeTextRect() (called from there) //
+ // changes outliner content.
+ // UpdateOutliner();
+
+ // #101029# Broadcast object changes, as they might change visible attributes
+ SvxViewHint aHint(SvxViewHint::SVX_HINT_VIEWCHANGED);
+ Broadcast( aHint );
+ }
+ break;
+ }
+
+ case HINT_BEGEDIT:
+ if( mpObject == pSdrHint->GetObject() )
+ {
+ // invalidate old forwarder
+ if( !mbForwarderIsEditMode )
+ {
+ delete mpTextForwarder;
+ mpTextForwarder = NULL;
+ }
+
+ // register as listener - need to broadcast state change messages
+ if( mpView && mpView->GetTextEditOutliner() )
+ mpView->GetTextEditOutliner()->SetNotifyHdl( LINK(this, SvxTextEditSourceImpl, NotifyHdl) );
+
+ // #104157# Only now we're really in edit mode
+ mbShapeIsEditMode = sal_True;
+
+ Broadcast( *pSdrHint );
+ }
+ break;
+
+ case HINT_ENDEDIT:
+ if( mpObject == pSdrHint->GetObject() )
+ {
+ Broadcast( *pSdrHint );
+
+ // #104157# We're no longer in edit mode
+ mbShapeIsEditMode = sal_False;
+
+ // remove as listener - outliner might outlive ourselves
+ if( mpView && mpView->GetTextEditOutliner() )
+ mpView->GetTextEditOutliner()->SetNotifyHdl( Link() );
+
+ // destroy view forwarder, OutlinerView no longer
+ // valid (no need for UpdateData(), it's been
+ // synched on SdrEndTextEdit)
+ delete mpViewForwarder;
+ mpViewForwarder = NULL;
+
+ // #100424# Invalidate text forwarder, we might
+ // not be called again before entering edit mode a
+ // second time! Then, the old outliner might be
+ // invalid.
+ if( mbForwarderIsEditMode )
+ {
+ mbForwarderIsEditMode = sal_False;
+ delete mpTextForwarder;
+ mpTextForwarder = NULL;
+ }
+ }
+ break;
+
+ case HINT_MODELCLEARED:
+ dispose();
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+/* this is a callback from the attached SdrObject when it is actually deleted */
+void SvxTextEditSourceImpl::ObjectInDestruction(const SdrObject&)
+{
+ mpObject = 0;
+ dispose();
+ Broadcast( SfxSimpleHint( SFX_HINT_DYING ) );
+}
+
+/* unregister at all objects and set all references to 0 */
+void SvxTextEditSourceImpl::dispose()
+{
+ if( mpTextForwarder )
+ {
+ delete mpTextForwarder;
+ mpTextForwarder = 0;
+ }
+
+ if( mpViewForwarder )
+ {
+ delete mpViewForwarder;
+ mpViewForwarder = 0;
+ }
+
+ if( mpOutliner )
+ {
+ if( mpModel )
+ {
+ mpModel->disposeOutliner( mpOutliner );
+ }
+ else
+ {
+ delete mpOutliner;
+ }
+ mpOutliner = 0;
+ }
+
+ if( mpModel )
+ {
+ EndListening( *mpModel );
+ mpModel = 0;
+ }
+
+ if( mpView )
+ {
+ EndListening( *mpView );
+ mpView = 0;
+ }
+
+ if( mpObject )
+ {
+ mpObject->RemoveObjectUser( *this );
+ mpObject = 0;
+ }
+ mpWindow = 0;
+}
+
+//------------------------------------------------------------------------
+
+void SvxTextEditSourceImpl::SetupOutliner()
+{
+ // #101029#
+ // only for UAA edit source: setup outliner equivalently as in
+ // SdrTextObj::Paint(), such that formatting equals screen
+ // layout
+ if( mpObject && mpOutliner )
+ {
+ SdrTextObj* pTextObj = PTR_CAST( SdrTextObj, mpObject );
+ Rectangle aPaintRect;
+ if( pTextObj )
+ {
+ Rectangle aBoundRect( pTextObj->GetCurrentBoundRect() );
+ pTextObj->SetupOutlinerFormatting( *mpOutliner, aPaintRect );
+
+ // #101029# calc text offset from shape anchor
+ maTextOffset = aPaintRect.TopLeft() - aBoundRect.TopLeft();
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+
+void SvxTextEditSourceImpl::UpdateOutliner()
+{
+ // #104157#
+ // only for UAA edit source: update outliner equivalently as in
+ // SdrTextObj::Paint(), such that formatting equals screen
+ // layout
+ if( mpObject && mpOutliner )
+ {
+ SdrTextObj* pTextObj = PTR_CAST( SdrTextObj, mpObject );
+ Rectangle aPaintRect;
+ if( pTextObj )
+ {
+ Rectangle aBoundRect( pTextObj->GetCurrentBoundRect() );
+ pTextObj->UpdateOutlinerFormatting( *mpOutliner, aPaintRect );
+
+ // #101029# calc text offset from shape anchor
+ maTextOffset = aPaintRect.TopLeft() - aBoundRect.TopLeft();
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+
+
+
+SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder()
+{
+ sal_Bool bCreated = sal_False;
+
+ // #99840#: prevent EE/Outliner notifications during setup
+ mbNotificationsDisabled = sal_True;
+
+ if (!mpTextForwarder)
+ {
+ if( mpOutliner == NULL )
+ {
+ SdrTextObj* pTextObj = PTR_CAST( SdrTextObj, mpObject );
+ sal_uInt16 nOutlMode = OUTLINERMODE_TEXTOBJECT;
+ if( pTextObj && pTextObj->IsTextFrame() && pTextObj->GetTextKind() == OBJ_OUTLINETEXT )
+ nOutlMode = OUTLINERMODE_OUTLINEOBJECT;
+
+ mpOutliner = mpModel->createOutliner( nOutlMode );
+
+ // #109151# Do the setup after outliner creation, would be useless otherwise
+ if( HasView() )
+ {
+ // #101029#, #104157# Setup outliner _before_ filling it
+ SetupOutliner();
+ }
+
+ mpOutliner->SetTextObjNoInit( pTextObj );
+/*
+ mpOutliner = SdrMakeOutliner( nOutlMode, pModel );
+ Outliner& aDrawOutliner = pModel->GetDrawOutliner();
+ mpOutliner->SetCalcFieldValueHdl( aDrawOutliner.GetCalcFieldValueHdl() );
+*/
+ if( mbIsLocked )
+ {
+ ((EditEngine*)&(mpOutliner->GetEditEngine()))->SetUpdateMode( sal_False );
+ mbOldUndoMode = ((EditEngine*)&(mpOutliner->GetEditEngine()))->IsUndoEnabled();
+ ((EditEngine*)&(mpOutliner->GetEditEngine()))->EnableUndo( sal_False );
+ }
+
+// -
+ if ( !m_xLinguServiceManager.is() )
+ {
+ css::uno::Reference< css::lang::XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ m_xLinguServiceManager = css::uno::Reference< css::linguistic2::XLinguServiceManager >(
+ xMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.linguistic2.LinguServiceManager" ))), css::uno::UNO_QUERY );
+ }
+
+ if ( m_xLinguServiceManager.is() )
+ {
+ css::uno::Reference< css::linguistic2::XHyphenator > xHyphenator( m_xLinguServiceManager->getHyphenator(), css::uno::UNO_QUERY );
+ if( xHyphenator.is() )
+ mpOutliner->SetHyphenator( xHyphenator );
+ }
+// -
+ }
+
+
+ mpTextForwarder = new SvxOutlinerForwarder( *mpOutliner, (mpObject->GetObjInventor() == SdrInventor) && (mpObject->GetObjIdentifier() == OBJ_OUTLINETEXT) );
+ // delay listener subscription and UAA initialization until Outliner is fully setup
+ bCreated = sal_True;
+
+ mbForwarderIsEditMode = sal_False;
+ }
+
+ if( mpObject && mpText && !mbDataValid && mpObject->IsInserted() && mpObject->GetPage() )
+ {
+ mpTextForwarder->flushCache();
+
+ OutlinerParaObject* pOutlinerParaObject = NULL;
+ SdrTextObj* pTextObj = PTR_CAST( SdrTextObj, mpObject );
+ if( pTextObj && pTextObj->getActiveText() == mpText )
+ pOutlinerParaObject = pTextObj->GetEditOutlinerParaObject(); // Get the OutlinerParaObject if text edit is active
+ bool bOwnParaObj(false);
+
+ if( pOutlinerParaObject )
+ bOwnParaObj = true; // text edit active
+ else
+ pOutlinerParaObject = mpText->GetOutlinerParaObject();
+
+ if( pOutlinerParaObject && ( bOwnParaObj || !mpObject->IsEmptyPresObj() || mpObject->GetPage()->IsMasterPage() ) )
+ {
+ mpOutliner->SetText( *pOutlinerParaObject );
+
+ // #91254# put text to object and set EmptyPresObj to FALSE
+ if( mpText && bOwnParaObj && pOutlinerParaObject && mpObject->IsEmptyPresObj() && pTextObj->IsRealyEdited() )
+ {
+ mpObject->SetEmptyPresObj( sal_False );
+ static_cast< SdrTextObj* >( mpObject)->NbcSetOutlinerParaObjectForText( pOutlinerParaObject, mpText );
+
+ // #i103982# Here, due to mpObject->NbcSetOutlinerParaObjectForText, we LOSE ownership of the
+ // OPO, so do NOT delete it when leaving this method (!)
+ bOwnParaObj = false;
+ }
+ }
+ else
+ {
+ sal_Bool bVertical = pOutlinerParaObject ? pOutlinerParaObject->IsVertical() : sal_False;
+
+ // set objects style sheet on empty outliner
+ SfxStyleSheetPool* pPool = (SfxStyleSheetPool*)mpObject->GetModel()->GetStyleSheetPool();
+ if( pPool )
+ mpOutliner->SetStyleSheetPool( pPool );
+
+ SfxStyleSheet* pStyleSheet = mpObject->GetPage()->GetTextStyleSheetForObject( mpObject );
+ if( pStyleSheet )
+ mpOutliner->SetStyleSheet( 0, pStyleSheet );
+
+ if( bVertical )
+ mpOutliner->SetVertical( sal_True );
+ }
+
+ // evtually we have to set the border attributes
+ if (mpOutliner->GetParagraphCount()==1)
+ {
+ // if we only have one paragraph we check if it is empty
+ XubString aStr( mpOutliner->GetText( mpOutliner->GetParagraph( 0 ) ) );
+
+ if(!aStr.Len())
+ {
+ // its empty, so we have to force the outliner to initialise itself
+ mpOutliner->SetText( String(), mpOutliner->GetParagraph( 0 ) );
+
+ if(mpObject->GetStyleSheet())
+ mpOutliner->SetStyleSheet( 0, mpObject->GetStyleSheet());
+ }
+ }
+
+ mbDataValid = sal_True;
+
+ if( bOwnParaObj )
+ delete pOutlinerParaObject;
+ }
+
+ if( bCreated && mpOutliner && HasView() )
+ {
+ // register as listener - need to broadcast state change messages
+ // registration delayed until outliner is completely set up
+ mpOutliner->SetNotifyHdl( LINK(this, SvxTextEditSourceImpl, NotifyHdl) );
+ }
+
+ // #99840#: prevent EE/Outliner notifications during setup
+ mbNotificationsDisabled = sal_False;
+
+ return mpTextForwarder;
+}
+
+//------------------------------------------------------------------------
+
+SvxTextForwarder* SvxTextEditSourceImpl::GetEditModeTextForwarder()
+{
+ if( !mpTextForwarder && HasView() )
+ {
+ SdrOutliner* pEditOutliner = mpView->GetTextEditOutliner();
+
+ if( pEditOutliner )
+ {
+ mpTextForwarder = new SvxOutlinerForwarder( *pEditOutliner, (mpObject->GetObjInventor() == SdrInventor) && (mpObject->GetObjIdentifier() == OBJ_OUTLINETEXT) );
+ mbForwarderIsEditMode = sal_True;
+ }
+ }
+
+ return mpTextForwarder;
+}
+
+//------------------------------------------------------------------------
+
+SvxTextForwarder* SvxTextEditSourceImpl::GetTextForwarder()
+{
+ if( mbDestroyed || mpObject == NULL )
+ return NULL;
+
+ if( mpModel == NULL )
+ mpModel = mpObject->GetModel();
+
+ if( mpModel == NULL )
+ return NULL;
+
+ // distinguish the cases
+ // a) connected to view, maybe edit mode is active, can work directly on the EditOutliner
+ // b) background Outliner, reflect changes into ParaOutlinerObject (this is exactly the old UNO code)
+ if( HasView() )
+ {
+ if( IsEditMode() != mbForwarderIsEditMode )
+ {
+ // forwarder mismatch - create new
+ delete mpTextForwarder;
+ mpTextForwarder = NULL;
+ }
+
+ if( IsEditMode() )
+ return GetEditModeTextForwarder();
+ else
+ return GetBackgroundTextForwarder();
+ }
+ else
+ return GetBackgroundTextForwarder();
+}
+
+//------------------------------------------------------------------------
+
+SvxDrawOutlinerViewForwarder* SvxTextEditSourceImpl::CreateViewForwarder()
+{
+ if( mpView->GetTextEditOutlinerView() && mpObject )
+ {
+ // register as listener - need to broadcast state change messages
+ mpView->GetTextEditOutliner()->SetNotifyHdl( LINK(this, SvxTextEditSourceImpl, NotifyHdl) );
+
+ SdrTextObj* pTextObj = PTR_CAST( SdrTextObj, mpObject );
+ if( pTextObj )
+ {
+ Rectangle aBoundRect( pTextObj->GetCurrentBoundRect() );
+ OutlinerView& rOutlView = *mpView->GetTextEditOutlinerView();
+
+ return new SvxDrawOutlinerViewForwarder( rOutlView, aBoundRect.TopLeft() );
+ }
+ }
+
+ return NULL;
+}
+
+SvxEditViewForwarder* SvxTextEditSourceImpl::GetEditViewForwarder( sal_Bool bCreate )
+{
+ if( mbDestroyed || mpObject == NULL )
+ return NULL;
+
+ if( mpModel == NULL )
+ mpModel = mpObject->GetModel();
+
+ if( mpModel == NULL )
+ return NULL;
+
+ // shall we delete?
+ if( mpViewForwarder )
+ {
+ if( !IsEditMode() )
+ {
+ // destroy all forwarders (no need for UpdateData(),
+ // it's been synched on SdrEndTextEdit)
+ delete mpViewForwarder;
+ mpViewForwarder = NULL;
+ }
+ }
+ // which to create? Directly in edit mode, create new, or none?
+ else if( mpView )
+ {
+ if( IsEditMode() )
+ {
+ // create new view forwarder
+ mpViewForwarder = CreateViewForwarder();
+ }
+ else if( bCreate )
+ {
+ // dispose old text forwarder
+ UpdateData();
+
+ delete mpTextForwarder;
+ mpTextForwarder = NULL;
+
+ // enter edit mode
+ mpView->SdrEndTextEdit();
+
+ if(mpView->SdrBeginTextEdit(mpObject, 0L, 0L, sal_False, (SdrOutliner*)0L, 0L, sal_False, sal_False))
+ {
+ SdrTextObj* pTextObj = PTR_CAST( SdrTextObj, mpObject );
+ if( pTextObj->IsTextEditActive() )
+ {
+ // create new view forwarder
+ mpViewForwarder = CreateViewForwarder();
+ }
+ else
+ {
+ // failure. Somehow, SdrBeginTextEdit did not set
+ // our SdrTextObj into edit mode
+ mpView->SdrEndTextEdit();
+ }
+ }
+ }
+ }
+
+ return mpViewForwarder;
+}
+
+//------------------------------------------------------------------------
+
+void SvxTextEditSourceImpl::UpdateData()
+{
+ // if we have a view and in edit mode, we're working with the
+ // DrawOutliner. Thus, all changes made on the text forwarder are
+ // reflected on the view and committed to the model on
+ // SdrEndTextEdit(). Thus, no need for explicit updates here.
+ if( !HasView() || !IsEditMode() )
+ {
+ if( mbIsLocked )
+ {
+ mbNeedsUpdate = sal_True;
+ }
+ else
+ {
+ if( mpOutliner && mpObject && mpText && !mbDestroyed )
+ {
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mpObject );
+ if( pTextObj )
+ {
+ if( mpOutliner->GetParagraphCount() != 1 || mpOutliner->GetEditEngine().GetTextLen( 0 ) )
+ {
+ if( mpOutliner->GetParagraphCount() > 1 )
+ {
+ if( pTextObj && pTextObj->IsTextFrame() && pTextObj->GetTextKind() == OBJ_TITLETEXT )
+ {
+ while( mpOutliner->GetParagraphCount() > 1 )
+ {
+ ESelection aSel( 0,mpOutliner->GetEditEngine().GetTextLen( 0 ), 1,0 );
+ mpOutliner->QuickInsertLineBreak( aSel );
+ }
+ }
+ }
+
+ pTextObj->NbcSetOutlinerParaObjectForText( mpOutliner->CreateParaObject(), mpText );
+ }
+ else
+ {
+ pTextObj->NbcSetOutlinerParaObjectForText( NULL,mpText );
+ }
+ }
+
+ if( mpObject->IsEmptyPresObj() )
+ mpObject->SetEmptyPresObj(sal_False);
+ }
+ }
+ }
+}
+
+void SvxTextEditSourceImpl::lock()
+{
+ mbIsLocked = sal_True;
+ if( mpOutliner )
+ {
+ ((EditEngine*)&(mpOutliner->GetEditEngine()))->SetUpdateMode( sal_False );
+ mbOldUndoMode = ((EditEngine*)&(mpOutliner->GetEditEngine()))->IsUndoEnabled();
+ ((EditEngine*)&(mpOutliner->GetEditEngine()))->EnableUndo( sal_False );
+ }
+}
+
+void SvxTextEditSourceImpl::unlock()
+{
+ mbIsLocked = sal_False;
+
+ if( mbNeedsUpdate )
+ {
+ UpdateData();
+ mbNeedsUpdate = sal_False;
+ }
+
+ if( mpOutliner )
+ {
+ ((EditEngine*)&(mpOutliner->GetEditEngine()))->SetUpdateMode( sal_True );
+ ((EditEngine*)&(mpOutliner->GetEditEngine()))->EnableUndo( mbOldUndoMode );
+ }
+}
+
+sal_Bool SvxTextEditSourceImpl::IsValid() const
+{
+ return mpView && mpWindow ? sal_True : sal_False;
+}
+
+Rectangle SvxTextEditSourceImpl::GetVisArea()
+{
+ if( IsValid() )
+ {
+ SdrPaintWindow* pPaintWindow = mpView->FindPaintWindow(*mpWindow);
+ Rectangle aVisArea;
+
+ if(pPaintWindow)
+ {
+ aVisArea = pPaintWindow->GetVisibleArea();
+ }
+
+ // offset vis area by edit engine left-top position
+ SdrTextObj* pTextObj = PTR_CAST( SdrTextObj, mpObject );
+ if( pTextObj )
+ {
+ Rectangle aAnchorRect;
+ pTextObj->TakeTextAnchorRect( aAnchorRect );
+ aVisArea.Move( -aAnchorRect.Left(), -aAnchorRect.Top() );
+
+ MapMode aMapMode(mpWindow->GetMapMode());
+ aMapMode.SetOrigin(Point());
+ return mpWindow->LogicToPixel( aVisArea, aMapMode );
+ }
+ }
+
+ return Rectangle();
+}
+
+Point SvxTextEditSourceImpl::LogicToPixel( const Point& rPoint, const MapMode& rMapMode )
+{
+ // #101029#: The responsibilities of ViewForwarder happen to be
+ // somewhat mixed in this case. On the one hand, we need the
+ // different interface queries on the SvxEditSource interface,
+ // since we need both VisAreas. On the other hand, if an
+ // EditViewForwarder exists, maTextOffset does not remain static,
+ // but may change with every key press.
+ if( IsEditMode() )
+ {
+ SvxEditViewForwarder* pForwarder = GetEditViewForwarder(sal_False);
+
+ if( pForwarder )
+ return pForwarder->LogicToPixel( rPoint, rMapMode );
+ }
+ else if( IsValid() && mpModel )
+ {
+ // #101029#
+ Point aPoint1( rPoint );
+ aPoint1.X() += maTextOffset.X();
+ aPoint1.Y() += maTextOffset.Y();
+
+ Point aPoint2( OutputDevice::LogicToLogic( aPoint1, rMapMode,
+ MapMode(mpModel->GetScaleUnit()) ) );
+ MapMode aMapMode(mpWindow->GetMapMode());
+ aMapMode.SetOrigin(Point());
+ return mpWindow->LogicToPixel( aPoint2, aMapMode );
+ }
+
+ return Point();
+}
+
+Point SvxTextEditSourceImpl::PixelToLogic( const Point& rPoint, const MapMode& rMapMode )
+{
+ // #101029#: The responsibilities of ViewForwarder happen to be
+ // somewhat mixed in this case. On the one hand, we need the
+ // different interface queries on the SvxEditSource interface,
+ // since we need both VisAreas. On the other hand, if an
+ // EditViewForwarder exists, maTextOffset does not remain static,
+ // but may change with every key press.
+ if( IsEditMode() )
+ {
+ SvxEditViewForwarder* pForwarder = GetEditViewForwarder(sal_False);
+
+ if( pForwarder )
+ return pForwarder->PixelToLogic( rPoint, rMapMode );
+ }
+ else if( IsValid() && mpModel )
+ {
+ MapMode aMapMode(mpWindow->GetMapMode());
+ aMapMode.SetOrigin(Point());
+ Point aPoint1( mpWindow->PixelToLogic( rPoint, aMapMode ) );
+ Point aPoint2( OutputDevice::LogicToLogic( aPoint1,
+ MapMode(mpModel->GetScaleUnit()),
+ rMapMode ) );
+ // #101029#
+ aPoint2.X() -= maTextOffset.X();
+ aPoint2.Y() -= maTextOffset.Y();
+
+ return aPoint2;
+ }
+
+ return Point();
+}
+
+IMPL_LINK(SvxTextEditSourceImpl, NotifyHdl, EENotify*, aNotify)
+{
+ if( aNotify && !mbNotificationsDisabled )
+ {
+ ::std::auto_ptr< SfxHint > aHint( SvxEditSourceHelper::EENotification2Hint( aNotify) );
+
+ if( aHint.get() )
+ Broadcast( *aHint.get() );
+ }
+
+ return 0;
+}
+
+//------------------------------------------------------------------------
+
+// --------------------------------------------------------------------
+// SvxTextEditSource
+// --------------------------------------------------------------------
+
+SvxTextEditSource::SvxTextEditSource( SdrObject* pObject, SdrText* pText, XInterface* pOwner )
+{
+ mpImpl = new SvxTextEditSourceImpl( pObject, pText, pOwner );
+ mpImpl->acquire();
+}
+
+// --------------------------------------------------------------------
+SvxTextEditSource::SvxTextEditSource( SdrObject& rObj, SdrText* pText, SdrView& rView, const Window& rWindow )
+{
+ mpImpl = new SvxTextEditSourceImpl( rObj, pText, rView, rWindow );
+ mpImpl->acquire();
+}
+
+// --------------------------------------------------------------------
+
+SvxTextEditSource::SvxTextEditSource( SvxTextEditSourceImpl* pImpl )
+{
+ mpImpl = pImpl;
+ mpImpl->acquire();
+}
+
+//------------------------------------------------------------------------
+SvxTextEditSource::~SvxTextEditSource()
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+
+ mpImpl->release();
+}
+
+//------------------------------------------------------------------------
+SvxEditSource* SvxTextEditSource::Clone() const
+{
+ return new SvxTextEditSource( mpImpl );
+}
+
+//------------------------------------------------------------------------
+SvxTextForwarder* SvxTextEditSource::GetTextForwarder()
+{
+ return mpImpl->GetTextForwarder();
+}
+
+//------------------------------------------------------------------------
+SvxEditViewForwarder* SvxTextEditSource::GetEditViewForwarder( sal_Bool bCreate )
+{
+ return mpImpl->GetEditViewForwarder( bCreate );
+}
+
+//------------------------------------------------------------------------
+SvxViewForwarder* SvxTextEditSource::GetViewForwarder()
+{
+ return this;
+}
+
+//------------------------------------------------------------------------
+void SvxTextEditSource::UpdateData()
+{
+ mpImpl->UpdateData();
+}
+
+SfxBroadcaster& SvxTextEditSource::GetBroadcaster() const
+{
+ return *mpImpl;
+}
+
+SdrObject* SvxTextEditSource::GetSdrObject() const
+{
+ return mpImpl->GetSdrObject();
+}
+
+void SvxTextEditSource::lock()
+{
+ mpImpl->lock();
+}
+
+void SvxTextEditSource::unlock()
+{
+ mpImpl->unlock();
+}
+
+sal_Bool SvxTextEditSource::IsValid() const
+{
+ return mpImpl->IsValid();
+}
+
+Rectangle SvxTextEditSource::GetVisArea() const
+{
+ return mpImpl->GetVisArea();
+}
+
+Point SvxTextEditSource::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const
+{
+ return mpImpl->LogicToPixel( rPoint, rMapMode );
+}
+
+Point SvxTextEditSource::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const
+{
+ return mpImpl->PixelToLogic( rPoint, rMapMode );
+}
+
+void SvxTextEditSource::addRange( SvxUnoTextRangeBase* pNewRange )
+{
+ mpImpl->addRange( pNewRange );
+}
+
+void SvxTextEditSource::removeRange( SvxUnoTextRangeBase* pOldRange )
+{
+ mpImpl->removeRange( pOldRange );
+}
+
+const SvxUnoTextRangeBaseList& SvxTextEditSource::getRanges() const
+{
+ return mpImpl->getRanges();
+}
+
+void SvxTextEditSource::ChangeModel( SdrModel* pNewModel )
+{
+ mpImpl->ChangeModel( pNewModel );
+}
+
+void SvxTextEditSource::UpdateOutliner()
+{
+ mpImpl->UpdateOutliner();
+}
diff --git a/svx/source/unodraw/unottabl.cxx b/svx/source/unodraw/unottabl.cxx
new file mode 100644
index 000000000000..0f277467bd1f
--- /dev/null
+++ b/svx/source/unodraw/unottabl.cxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <com/sun/star/awt/Gradient.hpp>
+#include <svl/itempool.hxx>
+#include <svl/itemset.hxx>
+#include <svx/xgrad.hxx>
+#include <svx/xflftrit.hxx>
+
+#include <svx/svdmodel.hxx>
+#include <svx/xflhtit.hxx>
+#include "svx/unofill.hxx"
+#include <svx/unomid.hxx>
+#include "UnoNameItemTable.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+using namespace ::cppu;
+
+class SvxUnoTransGradientTable : public SvxUnoNameItemTable
+{
+public:
+ SvxUnoTransGradientTable( SdrModel* pModel ) throw();
+ virtual ~SvxUnoTransGradientTable() throw();
+
+ virtual NameOrIndex* createItem() const throw();
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw( uno::RuntimeException );
+ virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw( uno::RuntimeException);
+
+ // XElementAccess
+ virtual uno::Type SAL_CALL getElementType( ) throw( uno::RuntimeException);
+};
+
+SvxUnoTransGradientTable::SvxUnoTransGradientTable( SdrModel* pModel ) throw()
+: SvxUnoNameItemTable( pModel, XATTR_FILLFLOATTRANSPARENCE, MID_FILLGRADIENT )
+{
+}
+
+SvxUnoTransGradientTable::~SvxUnoTransGradientTable() throw()
+{
+}
+
+OUString SAL_CALL SvxUnoTransGradientTable::getImplementationName() throw( uno::RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoTransGradientTable") );
+}
+
+uno::Sequence< OUString > SAL_CALL SvxUnoTransGradientTable::getSupportedServiceNames( )
+ throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aSNS( 1 );
+ aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.TransparencyGradientTable" ));
+ return aSNS;
+}
+
+NameOrIndex* SvxUnoTransGradientTable::createItem() const throw()
+{
+ XFillFloatTransparenceItem* pNewItem = new XFillFloatTransparenceItem();
+ pNewItem->SetEnabled( sal_True );
+ return pNewItem;
+}
+
+// XElementAccess
+uno::Type SAL_CALL SvxUnoTransGradientTable::getElementType( )
+ throw( uno::RuntimeException )
+{
+ return ::getCppuType((const struct awt::Gradient*)0);
+}
+
+/**
+ * Create a hatchtable
+ */
+uno::Reference< uno::XInterface > SAL_CALL SvxUnoTransGradientTable_createInstance( SdrModel* pModel )
+{
+ return *new SvxUnoTransGradientTable(pModel);
+}
+
+
+
diff --git a/svx/source/unogallery/unogalitem.cxx b/svx/source/unogallery/unogalitem.cxx
new file mode 100644
index 000000000000..ac90eb5ee362
--- /dev/null
+++ b/svx/source/unogallery/unogalitem.cxx
@@ -0,0 +1,485 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "unogalitem.hxx"
+#include "unogaltheme.hxx"
+#include "svx/galtheme.hxx"
+#include "svx/galmisc.hxx"
+#include <svx/fmmodel.hxx>
+#include <rtl/uuid.h>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/graph.hxx>
+#include <svl/itemprop.hxx>
+#include <svl/itempool.hxx>
+#include "galobj.hxx"
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYSTATE_HDL_
+#include <com/sun/star/beans/PropertyState.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HDL_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+#include <com/sun/star/gallery/GalleryItemType.hpp>
+
+#define UNOGALLERY_GALLERYITEMTYPE 1
+#define UNOGALLERY_URL 2
+#define UNOGALLERY_TITLE 3
+#define UNOGALLERY_THUMBNAIL 4
+#define UNOGALLERY_GRAPHIC 5
+#define UNOGALLERY_DRAWING 6
+
+using namespace ::com::sun::star;
+
+namespace unogallery {
+
+// -----------------
+// - GalleryItem -
+// -----------------
+
+GalleryItem::GalleryItem( ::unogallery::GalleryTheme& rTheme, const GalleryObject& rObject ) :
+ ::comphelper::PropertySetHelper( createPropertySetInfo() ),
+ mpTheme( &rTheme ),
+ mpGalleryObject( &rObject )
+{
+ mpTheme->implRegisterGalleryItem( *this );
+}
+
+// ------------------------------------------------------------------------------
+
+GalleryItem::~GalleryItem()
+ throw()
+{
+ if( mpTheme )
+ mpTheme->implDeregisterGalleryItem( *this );
+}
+
+// ------------------------------------------------------------------------------
+
+bool GalleryItem::isValid() const
+{
+ return( mpTheme != NULL );
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Any SAL_CALL GalleryItem::queryAggregation( const uno::Type & rType )
+ throw( uno::RuntimeException )
+{
+ uno::Any aAny;
+
+ if( rType == ::getCppuType((const uno::Reference< lang::XServiceInfo >*)0) )
+ aAny <<= uno::Reference< lang::XServiceInfo >(this);
+ else if( rType == ::getCppuType((const uno::Reference< lang::XTypeProvider >*)0) )
+ aAny <<= uno::Reference< lang::XTypeProvider >(this);
+ else if( rType == ::getCppuType((const uno::Reference< gallery::XGalleryItem >*)0) )
+ aAny <<= uno::Reference< gallery::XGalleryItem >(this);
+ else if( rType == ::getCppuType((const uno::Reference< beans::XPropertySet >*)0) )
+ aAny <<= uno::Reference< beans::XPropertySet >(this);
+ else if( rType == ::getCppuType((const uno::Reference< beans::XPropertyState >*)0) )
+ aAny <<= uno::Reference< beans::XPropertyState >(this);
+ else if( rType == ::getCppuType((const uno::Reference< beans::XMultiPropertySet >*)0) )
+ aAny <<= uno::Reference< beans::XMultiPropertySet >(this);
+ else
+ aAny <<= OWeakAggObject::queryAggregation( rType );
+
+ return aAny;
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Any SAL_CALL GalleryItem::queryInterface( const uno::Type & rType )
+ throw( uno::RuntimeException )
+{
+ return OWeakAggObject::queryInterface( rType );
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL GalleryItem::acquire()
+ throw()
+{
+ OWeakAggObject::acquire();
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL GalleryItem::release()
+ throw()
+{
+ OWeakAggObject::release();
+}
+
+// ------------------------------------------------------------------------------
+
+::rtl::OUString GalleryItem::getImplementationName_Static()
+ throw()
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.gallery.GalleryItem" ) );
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Sequence< ::rtl::OUString > GalleryItem::getSupportedServiceNames_Static()
+ throw()
+{
+ uno::Sequence< ::rtl::OUString > aSeq( 1 );
+
+ aSeq.getArray()[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.gallery.GalleryItem" ) );
+
+ return aSeq;
+}
+
+// ------------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL GalleryItem::getImplementationName()
+ throw( uno::RuntimeException )
+{
+ return getImplementationName_Static();
+}
+
+// ------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL GalleryItem::supportsService( const ::rtl::OUString& ServiceName )
+ throw( uno::RuntimeException )
+{
+ uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() );
+ const ::rtl::OUString* pArray = aSNL.getConstArray();
+
+ for( int i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == ServiceName )
+ return true;
+
+ return false;
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Sequence< ::rtl::OUString > SAL_CALL GalleryItem::getSupportedServiceNames()
+ throw( uno::RuntimeException )
+{
+ return getSupportedServiceNames_Static();
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Sequence< uno::Type > SAL_CALL GalleryItem::getTypes()
+ throw(uno::RuntimeException)
+{
+ uno::Sequence< uno::Type > aTypes( 6 );
+ uno::Type* pTypes = aTypes.getArray();
+
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo>*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XTypeProvider>*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< gallery::XGalleryItem>*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertySet>*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertyState>*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< beans::XMultiPropertySet>*)0);
+
+ return aTypes;
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Sequence< sal_Int8 > SAL_CALL GalleryItem::getImplementationId()
+ throw(uno::RuntimeException)
+{
+ const vos::OGuard aGuard( Application::GetSolarMutex() );
+ static uno::Sequence< sal_Int8 > aId;
+
+ if( aId.getLength() == 0 )
+ {
+ aId.realloc( 16 );
+ rtl_createUuid( reinterpret_cast< sal_uInt8* >( aId.getArray() ), 0, sal_True );
+ }
+
+ return aId;
+}
+
+// ------------------------------------------------------------------------------
+
+sal_Int8 SAL_CALL GalleryItem::getType()
+ throw (uno::RuntimeException)
+{
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ sal_Int8 nRet = gallery::GalleryItemType::EMPTY;
+
+ if( isValid() )
+ {
+ switch( implGetObject()->eObjKind )
+ {
+ case( SGA_OBJ_SOUND ):
+ case( SGA_OBJ_VIDEO ):
+ nRet = gallery::GalleryItemType::MEDIA;
+ break;
+
+ case( SGA_OBJ_SVDRAW ):
+ nRet = gallery::GalleryItemType::DRAWING;
+ break;
+
+ default:
+ nRet = gallery::GalleryItemType::GRAPHIC;
+ break;
+ }
+ }
+
+ return nRet;
+}
+
+// ------------------------------------------------------------------------------
+
+::comphelper::PropertySetInfo* GalleryItem::createPropertySetInfo()
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ ::comphelper::PropertySetInfo* pRet = new ::comphelper::PropertySetInfo();
+
+ static ::comphelper::PropertyMapEntry aEntries[] =
+ {
+ { MAP_CHAR_LEN( "GalleryItemType" ), UNOGALLERY_GALLERYITEMTYPE, &::getCppuType( (const sal_Int8*)(0)),
+ beans::PropertyAttribute::READONLY, 0 },
+
+ { MAP_CHAR_LEN( "URL" ), UNOGALLERY_URL, &::getCppuType( (const ::rtl::OUString*)(0)),
+ beans::PropertyAttribute::READONLY, 0 },
+
+ { MAP_CHAR_LEN( "Title" ), UNOGALLERY_TITLE, &::getCppuType( (const ::rtl::OUString*)(0)),
+ 0, 0 },
+
+ { MAP_CHAR_LEN( "Thumbnail" ), UNOGALLERY_THUMBNAIL, &::getCppuType( (const uno::Reference< graphic::XGraphic >*)(0)),
+ beans::PropertyAttribute::READONLY, 0 },
+
+ { MAP_CHAR_LEN( "Graphic" ), UNOGALLERY_GRAPHIC, &::getCppuType( (const uno::Reference< graphic::XGraphic >*)(0)),
+ beans::PropertyAttribute::READONLY, 0 },
+
+ { MAP_CHAR_LEN( "Drawing" ), UNOGALLERY_DRAWING, &::getCppuType( (const uno::Reference< lang::XComponent >*)(0) ),
+ beans::PropertyAttribute::READONLY, 0 },
+
+ { 0,0,0,0,0,0}
+ };
+
+ pRet->acquire();
+ pRet->add( aEntries );
+
+ return pRet;
+}
+
+// ------------------------------------------------------------------------------
+
+void GalleryItem::_setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const uno::Any* pValues )
+ throw( beans::UnknownPropertyException,
+ beans::PropertyVetoException,
+ lang::IllegalArgumentException,
+ lang::WrappedTargetException )
+{
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ while( *ppEntries )
+ {
+ if( UNOGALLERY_TITLE == (*ppEntries)->mnHandle )
+ {
+ ::rtl::OUString aNewTitle;
+
+ if( *pValues >>= aNewTitle )
+ {
+ ::GalleryTheme* pGalTheme = ( isValid() ? mpTheme->implGetTheme() : NULL );
+
+ if( pGalTheme )
+ {
+ SgaObject* pObj = pGalTheme->ImplReadSgaObject( const_cast< GalleryObject* >( implGetObject() ) );
+
+ if( pObj )
+ {
+ if( ::rtl::OUString( pObj->GetTitle() ) != aNewTitle )
+ {
+ pObj->SetTitle( aNewTitle );
+ pGalTheme->InsertObject( *pObj );
+ }
+
+ delete pObj;
+ }
+ }
+ }
+ else
+ {
+ throw lang::IllegalArgumentException();
+ }
+ }
+
+ ++ppEntries;
+ ++pValues;
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+void GalleryItem::_getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, uno::Any* pValue )
+ throw( beans::UnknownPropertyException,
+ lang::WrappedTargetException )
+{
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ while( *ppEntries )
+ {
+ switch( (*ppEntries)->mnHandle )
+ {
+ case( UNOGALLERY_GALLERYITEMTYPE ):
+ {
+ *pValue <<= sal_Int8( getType() );
+ }
+ break;
+
+ case( UNOGALLERY_URL ):
+ {
+ ::GalleryTheme* pGalTheme = ( isValid() ? mpTheme->implGetTheme() : NULL );
+
+ if( pGalTheme )
+ *pValue <<= ::rtl::OUString( implGetObject()->aURL.GetMainURL( INetURLObject::NO_DECODE ) );
+ }
+ break;
+
+ case( UNOGALLERY_TITLE ):
+ {
+ ::GalleryTheme* pGalTheme = ( isValid() ? mpTheme->implGetTheme() : NULL );
+
+ if( pGalTheme )
+ {
+ SgaObject* pObj = pGalTheme->AcquireObject( pGalTheme->ImplGetGalleryObjectPos( implGetObject() ) );
+
+ if( pObj )
+ {
+ *pValue <<= ::rtl::OUString( pObj->GetTitle() );
+ pGalTheme->ReleaseObject( pObj );
+ }
+ }
+ }
+ break;
+
+ case( UNOGALLERY_THUMBNAIL ):
+ {
+ ::GalleryTheme* pGalTheme = ( isValid() ? mpTheme->implGetTheme() : NULL );
+
+ if( pGalTheme )
+ {
+ SgaObject* pObj = pGalTheme->AcquireObject( pGalTheme->ImplGetGalleryObjectPos( implGetObject() ) );
+
+ if( pObj )
+ {
+ Graphic aThumbnail;
+
+ if( pObj->IsThumbBitmap() )
+ aThumbnail = pObj->GetThumbBmp();
+ else
+ aThumbnail = pObj->GetThumbMtf();
+
+ *pValue <<= aThumbnail.GetXGraphic();
+ pGalTheme->ReleaseObject( pObj );
+ }
+ }
+ }
+ break;
+
+ case( UNOGALLERY_GRAPHIC ):
+ {
+ ::GalleryTheme* pGalTheme = ( isValid() ? mpTheme->implGetTheme() : NULL );
+ Graphic aGraphic;
+
+ if( pGalTheme && pGalTheme->GetGraphic( pGalTheme->ImplGetGalleryObjectPos( implGetObject() ), aGraphic ) )
+ *pValue <<= aGraphic.GetXGraphic();
+ }
+ break;
+
+ case( UNOGALLERY_DRAWING ):
+ {
+ if( gallery::GalleryItemType::DRAWING == getType() )
+ {
+ ::GalleryTheme* pGalTheme = ( isValid() ? mpTheme->implGetTheme() : NULL );
+ FmFormModel* pModel = new FmFormModel;
+
+ pModel->GetItemPool().FreezeIdRanges();
+
+ if( pGalTheme && pGalTheme->GetModel( pGalTheme->ImplGetGalleryObjectPos( implGetObject() ), *pModel ) )
+ {
+ uno::Reference< lang::XComponent > xDrawing( new GalleryDrawingModel( pModel ) );
+
+ pModel->setUnoModel( uno::Reference< uno::XInterface >::query( xDrawing ) );
+ *pValue <<= xDrawing;
+ }
+ else
+ delete pModel;
+ }
+ }
+ break;
+ }
+
+ ++ppEntries;
+ ++pValue;
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+const ::GalleryObject* GalleryItem::implGetObject() const
+{
+ return mpGalleryObject;
+}
+
+// ------------------------------------------------------------------------------
+
+void GalleryItem::implSetInvalid()
+{
+ if( mpTheme )
+ {
+ mpTheme = NULL;
+ mpGalleryObject = NULL;
+ }
+}
+
+// -----------------------
+// - GalleryDrawingModel -
+// -----------------------
+
+GalleryDrawingModel::GalleryDrawingModel( SdrModel* pDoc )
+ throw() :
+ SvxUnoDrawingModel( pDoc )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+GalleryDrawingModel::~GalleryDrawingModel()
+ throw()
+{
+ delete GetDoc();
+}
+
+// -----------------------------------------------------------------------------
+
+UNO3_GETIMPLEMENTATION_IMPL( GalleryDrawingModel );
+
+}
diff --git a/svx/source/unogallery/unogalitem.hxx b/svx/source/unogallery/unogalitem.hxx
new file mode 100644
index 000000000000..a48f83a49313
--- /dev/null
+++ b/svx/source/unogallery/unogalitem.hxx
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_UNOGALITEM_HXX
+#define _SVX_UNOGALITEM_HXX
+
+#include <svx/unomodel.hxx>
+#include <comphelper/servicehelper.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/gallery/XGalleryItem.hpp>
+#include <comphelper/propertysethelper.hxx>
+#ifndef _COMPHELPER_PROPERTYSETINFO_HXX_
+#include <comphelper/propertysetinfo.hxx>
+#endif
+
+class GalleryTheme;
+struct GalleryObject;
+namespace unogallery { class GalleryTheme; }
+
+namespace unogallery {
+
+// ---------------
+// - GalleryItem -
+// ---------------
+
+class GalleryItem : public ::cppu::OWeakAggObject,
+ public ::com::sun::star::lang::XServiceInfo,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::com::sun::star::gallery::XGalleryItem,
+ public ::comphelper::PropertySetHelper
+{
+ friend class ::unogallery::GalleryTheme;
+
+public:
+
+ GalleryItem( ::unogallery::GalleryTheme& rTheme, const GalleryObject& rObject );
+ ~GalleryItem() throw();
+
+ bool isValid() const;
+
+ static ::rtl::OUString getImplementationName_Static() throw();
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw();
+
+protected:
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ 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();
+
+ // XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
+
+ // XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XGalleryItem
+ virtual ::sal_Int8 SAL_CALL getType( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // PropertySetHelper
+ virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
+ virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::uno::Any* pValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException );
+
+protected:
+
+ ::comphelper::PropertySetInfo* createPropertySetInfo();
+
+private:
+
+ ::unogallery::GalleryTheme* mpTheme;
+ const ::GalleryObject* mpGalleryObject;
+
+ const ::GalleryObject* implGetObject() const;
+ void implSetInvalid();
+
+ // not available
+ GalleryItem();
+ GalleryItem( const GalleryItem& );
+ GalleryItem& operator=( const GalleryItem& );
+};
+
+// -----------------------
+// - GalleryDrawingModel -
+// -----------------------
+
+class GalleryDrawingModel : public SvxUnoDrawingModel
+{
+public:
+
+ GalleryDrawingModel( SdrModel* pDoc ) throw();
+ virtual ~GalleryDrawingModel() throw();
+
+ UNO3_GETIMPLEMENTATION_DECL( GalleryDrawingModel )
+};
+
+}
+
+#endif
diff --git a/svx/source/unogallery/unogaltheme.cxx b/svx/source/unogallery/unogaltheme.cxx
new file mode 100644
index 000000000000..1145be7e3f5e
--- /dev/null
+++ b/svx/source/unogallery/unogaltheme.cxx
@@ -0,0 +1,433 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <algorithm>
+
+#include "unogaltheme.hxx"
+#include "unogalitem.hxx"
+#include "svx/galtheme.hxx"
+#include "svx/gallery1.hxx"
+#include "svx/galmisc.hxx"
+#include <svx/fmmodel.hxx>
+#include <rtl/uuid.h>
+#include <vos/mutex.hxx>
+#ifndef _SV_SVAPP_HXX_
+#include <vcl/svapp.hxx>
+#endif
+#include <unotools/pathoptions.hxx>
+
+using namespace ::com::sun::star;
+
+namespace unogallery {
+
+// -----------------
+// - GalleryTheme -
+// -----------------
+
+GalleryTheme::GalleryTheme( const ::rtl::OUString& rThemeName )
+{
+ mpGallery = ::Gallery::GetGalleryInstance();
+ mpTheme = ( mpGallery ? mpGallery->AcquireTheme( rThemeName, *this ) : NULL );
+
+ if( mpGallery )
+ StartListening( *mpGallery );
+}
+
+// ------------------------------------------------------------------------------
+
+GalleryTheme::~GalleryTheme()
+{
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ DBG_ASSERT( !mpTheme || mpGallery, "Theme is living without Gallery" );
+
+ implReleaseItems( NULL );
+
+ if( mpGallery )
+ {
+ EndListening( *mpGallery );
+
+ if( mpTheme )
+ mpGallery->ReleaseTheme( mpTheme, *this );
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+::rtl::OUString GalleryTheme::getImplementationName_Static()
+ throw()
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.gallery.GalleryTheme" ) );
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Sequence< ::rtl::OUString > GalleryTheme::getSupportedServiceNames_Static()
+ throw()
+{
+ uno::Sequence< ::rtl::OUString > aSeq( 1 );
+
+ aSeq.getArray()[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.gallery.GalleryTheme" ) );
+
+ return aSeq;
+}
+
+// ------------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL GalleryTheme::getImplementationName()
+ throw( uno::RuntimeException )
+{
+ return getImplementationName_Static();
+}
+
+// ------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL GalleryTheme::supportsService( const ::rtl::OUString& ServiceName )
+ throw( uno::RuntimeException )
+{
+ uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() );
+ const ::rtl::OUString* pArray = aSNL.getConstArray();
+
+ for( int i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == ServiceName )
+ return true;
+
+ return false;
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Sequence< ::rtl::OUString > SAL_CALL GalleryTheme::getSupportedServiceNames()
+ throw( uno::RuntimeException )
+{
+ return getSupportedServiceNames_Static();
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Sequence< uno::Type > SAL_CALL GalleryTheme::getTypes()
+ throw(uno::RuntimeException)
+{
+ uno::Sequence< uno::Type > aTypes( 5 );
+ uno::Type* pTypes = aTypes.getArray();
+
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo>*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XTypeProvider>*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< container::XElementAccess>*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< container::XIndexAccess>*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< gallery::XGalleryTheme>*)0);
+
+ return aTypes;
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Sequence< sal_Int8 > SAL_CALL GalleryTheme::getImplementationId()
+ throw(uno::RuntimeException)
+{
+ const vos::OGuard aGuard( Application::GetSolarMutex() );
+ static uno::Sequence< sal_Int8 > aId;
+
+ if( aId.getLength() == 0 )
+ {
+ aId.realloc( 16 );
+ rtl_createUuid( reinterpret_cast< sal_uInt8* >( aId.getArray() ), 0, sal_True );
+ }
+
+ return aId;
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Type SAL_CALL GalleryTheme::getElementType()
+ throw (uno::RuntimeException)
+{
+ return ::getCppuType( (const uno::Reference< gallery::XGalleryItem >*) 0);
+}
+
+// ------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL GalleryTheme::hasElements()
+ throw (uno::RuntimeException)
+{
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ return( ( mpTheme != NULL ) && ( mpTheme->GetObjectCount() > 0 ) );
+}
+
+// ------------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL GalleryTheme::getCount()
+ throw (uno::RuntimeException)
+{
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ return( mpTheme ? mpTheme->GetObjectCount() : 0 );
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Any SAL_CALL GalleryTheme::getByIndex( ::sal_Int32 nIndex )
+ throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ uno::Any aRet;
+
+ if( mpTheme )
+ {
+ if( ( nIndex < 0 ) || ( nIndex >= getCount() ) )
+ {
+ throw lang::IndexOutOfBoundsException();
+ }
+ else
+ {
+ const GalleryObject* pObj = mpTheme->ImplGetGalleryObject( nIndex );
+
+ if( pObj )
+ aRet = uno::makeAny( uno::Reference< gallery::XGalleryItem >( new GalleryItem( *this, *pObj ) ) );
+ }
+ }
+
+ return aRet;
+}
+
+// ------------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL GalleryTheme::getName( )
+ throw (uno::RuntimeException)
+{
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ ::rtl::OUString aRet;
+
+ if( mpTheme )
+ aRet = mpTheme->GetName();
+
+ return aRet;
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL GalleryTheme::update( )
+ throw (uno::RuntimeException)
+{
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mpTheme )
+ {
+ const Link aDummyLink;
+ mpTheme->Actualize( aDummyLink );
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+::sal_Int32 SAL_CALL GalleryTheme::insertURLByIndex(
+ const ::rtl::OUString& rURL, ::sal_Int32 nIndex )
+ throw (lang::WrappedTargetException, uno::RuntimeException)
+{
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ sal_Int32 nRet = -1;
+
+ if( mpTheme )
+ {
+ try
+ {
+ const INetURLObject aURL( rURL );
+
+ nIndex = ::std::max( ::std::min( nIndex, getCount() ), sal_Int32( 0 ) );
+
+ if( ( aURL.GetProtocol() != INET_PROT_NOT_VALID ) && mpTheme->InsertURL( aURL, nIndex ) )
+ {
+ const GalleryObject* pObj = mpTheme->ImplGetGalleryObject( aURL );
+
+ if( pObj )
+ nRet = mpTheme->ImplGetGalleryObjectPos( pObj );
+ }
+ }
+ catch( ... )
+ {
+ }
+ }
+
+ return nRet;
+}
+
+// ------------------------------------------------------------------------------
+
+::sal_Int32 SAL_CALL GalleryTheme::insertGraphicByIndex(
+ const uno::Reference< graphic::XGraphic >& rxGraphic, sal_Int32 nIndex )
+ throw (lang::WrappedTargetException, uno::RuntimeException)
+{
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ sal_Int32 nRet = -1;
+
+ if( mpTheme )
+ {
+ try
+ {
+ const Graphic aGraphic( rxGraphic );
+
+ nIndex = ::std::max( ::std::min( nIndex, getCount() ), sal_Int32( 0 ) );
+
+ if( mpTheme->InsertGraphic( aGraphic, nIndex ) )
+ nRet = nIndex;
+ }
+ catch( ... )
+ {
+ }
+ }
+
+ return nRet;
+}
+
+// ------------------------------------------------------------------------------
+
+::sal_Int32 SAL_CALL GalleryTheme::insertDrawingByIndex(
+ const uno::Reference< lang::XComponent >& Drawing, sal_Int32 nIndex )
+ throw (lang::WrappedTargetException, uno::RuntimeException)
+{
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ sal_Int32 nRet = -1;
+
+ if( mpTheme )
+ {
+ GalleryDrawingModel* pModel = GalleryDrawingModel::getImplementation( Drawing );
+
+ if( pModel && pModel->GetDoc() && pModel->GetDoc()->ISA( FmFormModel ) )
+ {
+ nIndex = ::std::max( ::std::min( nIndex, getCount() ), sal_Int32( 0 ) );
+
+ if( mpTheme->InsertModel( *static_cast< FmFormModel* >( pModel->GetDoc() ), nIndex ) )
+ nRet = nIndex;
+ }
+ }
+
+ return nRet;
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL GalleryTheme::removeByIndex( sal_Int32 nIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ if( mpTheme )
+ {
+ if( ( nIndex < 0 ) || ( nIndex >= getCount() ) )
+ throw lang::IndexOutOfBoundsException();
+ else
+ mpTheme->RemoveObject( nIndex );
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+void GalleryTheme::Notify( SfxBroadcaster&, const SfxHint& rHint )
+{
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ const GalleryHint& rGalleryHint = static_cast< const GalleryHint& >( rHint );
+
+ switch( rGalleryHint.GetType() )
+ {
+ case( GALLERY_HINT_CLOSE_THEME ):
+ {
+ DBG_ASSERT( !mpTheme || mpGallery, "Theme is living without Gallery" );
+
+ implReleaseItems( NULL );
+
+ if( mpGallery && mpTheme )
+ {
+ mpGallery->ReleaseTheme( mpTheme, *this );
+ mpTheme = NULL;
+ }
+ }
+ break;
+
+ case( GALLERY_HINT_CLOSE_OBJECT ):
+ {
+ GalleryObject* pObj = reinterpret_cast< GalleryObject* >( rGalleryHint.GetData1() );
+
+ if( pObj )
+ implReleaseItems( pObj );
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+void GalleryTheme::implReleaseItems( GalleryObject* pObj )
+{
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ for( GalleryItemList::iterator aIter = maItemList.begin(); aIter != maItemList.end(); )
+ {
+ if( !pObj || ( (*aIter)->implGetObject() == pObj ) )
+ {
+ (*aIter)->implSetInvalid();
+ aIter = maItemList.erase( aIter );
+ }
+ else
+ ++aIter;
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+::GalleryTheme* GalleryTheme::implGetTheme() const
+{
+ return mpTheme;
+}
+
+// ------------------------------------------------------------------------------
+
+void GalleryTheme::implRegisterGalleryItem( ::unogallery::GalleryItem& rItem )
+{
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+// DBG_ASSERT( maItemList.find( &rItem ) == maItemList.end(), "Item already registered" );
+ maItemList.push_back( &rItem );
+}
+
+// ------------------------------------------------------------------------------
+
+void GalleryTheme::implDeregisterGalleryItem( ::unogallery::GalleryItem& rItem )
+{
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+// DBG_ASSERT( maItemList.find( &rItem ) != maItemList.end(), "Item is not registered" );
+ maItemList.remove( &rItem );
+}
+
+}
diff --git a/svx/source/unogallery/unogaltheme.hxx b/svx/source/unogallery/unogaltheme.hxx
new file mode 100644
index 000000000000..376d4dfb08a9
--- /dev/null
+++ b/svx/source/unogallery/unogaltheme.hxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_UNOGALTHEME_HXX
+#define _SVX_UNOGALTHEME_HXX
+
+#include <list>
+
+#include <cppuhelper/implbase1.hxx>
+#include <svl/lstner.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/gallery/XGalleryTheme.hpp>
+
+class Gallery;
+class GalleryTheme;
+struct GalleryObject;
+namespace unogallery { class GalleryItem; }
+
+namespace unogallery {
+
+// ----------------
+// - GalleryTheme -
+// ----------------
+
+class GalleryTheme : public ::cppu::WeakImplHelper1< ::com::sun::star::gallery::XGalleryTheme >,
+ public SfxListener
+{
+ friend class ::unogallery::GalleryItem;
+
+public:
+
+ GalleryTheme( const ::rtl::OUString& rThemeName );
+ ~GalleryTheme();
+
+ static ::rtl::OUString getImplementationName_Static() throw();
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw();
+
+protected:
+
+ // XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
+
+ // XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasElements() throw (::com::sun::star::uno::RuntimeException);
+
+ // XIndexAccess
+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XGalleryThemes
+ virtual ::rtl::OUString SAL_CALL getName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL update( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL insertURLByIndex( const ::rtl::OUString& URL, ::sal_Int32 Index ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL insertGraphicByIndex( const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& Graphic, ::sal_Int32 Index ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL insertDrawingByIndex( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& Drawing, ::sal_Int32 Index ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // SfxListener
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+private:
+
+ typedef ::std::list< ::unogallery::GalleryItem* > GalleryItemList;
+
+ GalleryItemList maItemList;
+ ::Gallery* mpGallery;
+ ::GalleryTheme* mpTheme;
+
+ ::GalleryTheme* implGetTheme() const;
+
+ void implReleaseItems( GalleryObject* pObj );
+
+ void implRegisterGalleryItem( ::unogallery::GalleryItem& rItem );
+ void implDeregisterGalleryItem( ::unogallery::GalleryItem& rItem );
+};
+
+}
+
+#endif
diff --git a/svx/source/unogallery/unogalthemeprovider.cxx b/svx/source/unogallery/unogalthemeprovider.cxx
new file mode 100644
index 000000000000..d6204da54eb8
--- /dev/null
+++ b/svx/source/unogallery/unogalthemeprovider.cxx
@@ -0,0 +1,316 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "unogalthemeprovider.hxx"
+#include "unogaltheme.hxx"
+#include "svx/gallery1.hxx"
+#include <rtl/uuid.h>
+#include <vos/mutex.hxx>
+#ifndef _SV_SVAPP_HXX_
+#include <vcl/svapp.hxx>
+#endif
+#include <unotools/pathoptions.hxx>
+#include <com/sun/star/gallery/XGalleryTheme.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+using namespace ::com::sun::star;
+
+namespace unogallery {
+
+// --------------------
+// - Helper functions -
+// --------------------
+
+uno::Reference< uno::XInterface > SAL_CALL GalleryThemeProvider_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & )
+ throw( uno::Exception )
+{
+ return *( new GalleryThemeProvider() );
+}
+
+// -----------------------------------------------------------------------------
+
+uno::Sequence< ::rtl::OUString > SAL_CALL GalleryThemeProvider_getSupportedServiceNames()
+ throw()
+{
+ return GalleryThemeProvider::getSupportedServiceNames_Static();
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL GalleryThemeProvider_getImplementationName()
+ throw()
+{
+ return GalleryThemeProvider::getImplementationName_Static();
+}
+
+// -----------------
+// - GalleryThemeProvider -
+// -----------------
+
+GalleryThemeProvider::GalleryThemeProvider() :
+ mbHiddenThemes( sal_False )
+{
+ mpGallery = ::Gallery::GetGalleryInstance();
+}
+
+// ------------------------------------------------------------------------------
+
+GalleryThemeProvider::~GalleryThemeProvider()
+{
+}
+
+// ------------------------------------------------------------------------------
+
+SVX_DLLPUBLIC ::rtl::OUString GalleryThemeProvider::getImplementationName_Static()
+ throw()
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.gallery.GalleryThemeProvider" ) );
+}
+
+// ------------------------------------------------------------------------------
+
+SVX_DLLPUBLIC uno::Sequence< ::rtl::OUString > GalleryThemeProvider::getSupportedServiceNames_Static()
+ throw()
+{
+ uno::Sequence< ::rtl::OUString > aSeq( 1 );
+
+ aSeq.getArray()[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.gallery.GalleryThemeProvider" ) );
+
+ return aSeq;
+}
+
+// ------------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL GalleryThemeProvider::getImplementationName()
+ throw( uno::RuntimeException )
+{
+ return getImplementationName_Static();
+}
+
+// ------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL GalleryThemeProvider::supportsService( const ::rtl::OUString& ServiceName )
+ throw( uno::RuntimeException )
+{
+ uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() );
+ const ::rtl::OUString* pArray = aSNL.getConstArray();
+
+ for( int i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == ServiceName )
+ return true;
+
+ return false;
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Sequence< ::rtl::OUString > SAL_CALL GalleryThemeProvider::getSupportedServiceNames()
+ throw( uno::RuntimeException )
+{
+ return getSupportedServiceNames_Static();
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Sequence< uno::Type > SAL_CALL GalleryThemeProvider::getTypes()
+ throw(uno::RuntimeException)
+{
+ uno::Sequence< uno::Type > aTypes( 6 );
+ uno::Type* pTypes = aTypes.getArray();
+
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo>*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XTypeProvider>*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< lang::XInitialization>*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< container::XElementAccess>*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< container::XNameAccess>*)0);
+ *pTypes++ = ::getCppuType((const uno::Reference< gallery::XGalleryThemeProvider>*)0);
+
+ return aTypes;
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Sequence< sal_Int8 > SAL_CALL GalleryThemeProvider::getImplementationId()
+ throw(uno::RuntimeException)
+{
+ const vos::OGuard aGuard( Application::GetSolarMutex() );
+ static uno::Sequence< sal_Int8 > aId;
+
+ if( aId.getLength() == 0 )
+ {
+ aId.realloc( 16 );
+ rtl_createUuid( reinterpret_cast< sal_uInt8* >( aId.getArray() ), 0, sal_True );
+ }
+
+ return aId;
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL GalleryThemeProvider::initialize( const uno::Sequence< uno::Any >& rArguments )
+ throw ( uno::Exception, uno::RuntimeException )
+{
+ uno::Sequence< beans::PropertyValue > aParams;
+ sal_Int32 i;
+
+ for( i = 0; i < rArguments.getLength(); ++i )
+ {
+ if( rArguments[ i ] >>= aParams )
+ break;
+ }
+
+ for( i = 0; i < aParams.getLength(); ++i )
+ {
+ const beans::PropertyValue& rProp = aParams[ i ];
+
+ if( rProp.Name.equalsAscii( "ProvideHiddenThemes" ) )
+ rProp.Value >>= mbHiddenThemes;
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Type SAL_CALL GalleryThemeProvider::getElementType()
+ throw (uno::RuntimeException)
+{
+ return ::getCppuType( (const uno::Reference< gallery::XGalleryTheme >*) 0);
+}
+
+// ------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL GalleryThemeProvider::hasElements()
+ throw (uno::RuntimeException)
+{
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ return( ( mpGallery != NULL ) && ( mpGallery->GetThemeCount() > 0 ) );
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Any SAL_CALL GalleryThemeProvider::getByName( const ::rtl::OUString& rName )
+ throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ uno::Any aRet;
+
+ if( !mpGallery || !mpGallery->HasTheme( rName ) )
+ {
+ throw container::NoSuchElementException();
+ }
+ else
+ {
+ aRet = uno::makeAny( uno::Reference< gallery::XGalleryTheme >( new ::unogallery::GalleryTheme( rName ) ) );
+ }
+
+ return aRet;
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Sequence< ::rtl::OUString > SAL_CALL GalleryThemeProvider::getElementNames()
+ throw (uno::RuntimeException)
+{
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ sal_uInt32 i = 0, nCount = ( mpGallery ? mpGallery->GetThemeCount() : 0 ), nRealCount = 0;
+ uno::Sequence< ::rtl::OUString > aSeq( nCount );
+
+ for( ; i < nCount; ++i )
+ {
+ const GalleryThemeEntry* pEntry = mpGallery->GetThemeInfo( i );
+
+ if( mbHiddenThemes || !pEntry->IsHidden() )
+ aSeq[ nRealCount++ ] = pEntry->GetThemeName();
+ }
+
+ aSeq.realloc( nRealCount );
+
+ return aSeq;
+}
+
+// ------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL GalleryThemeProvider::hasByName( const ::rtl::OUString& rName )
+ throw (uno::RuntimeException)
+{
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ sal_Bool bRet = sal_False;
+
+ if( mpGallery && mpGallery->HasTheme( rName ) )
+ bRet = ( mbHiddenThemes || !mpGallery->GetThemeInfo( rName )->IsHidden() );
+
+ return( bRet );
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Reference< gallery::XGalleryTheme > SAL_CALL GalleryThemeProvider::insertNewByName( const ::rtl::OUString& rThemeName )
+ throw (container::ElementExistException, uno::RuntimeException)
+{
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ uno::Reference< gallery::XGalleryTheme > xRet;
+
+ if( mpGallery )
+ {
+ if( mpGallery->HasTheme( rThemeName ) )
+ {
+ throw container::ElementExistException();
+ }
+ else if( mpGallery->CreateTheme( rThemeName ) )
+ {
+ xRet = new ::unogallery::GalleryTheme( rThemeName );
+ }
+ }
+
+ return xRet;
+}
+
+// ------------------------------------------------------------------------------
+
+void SAL_CALL GalleryThemeProvider::removeByName( const ::rtl::OUString& rName )
+ throw (container::NoSuchElementException, uno::RuntimeException)
+{
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ if( !mpGallery ||
+ !mpGallery->HasTheme( rName ) ||
+ ( !mbHiddenThemes && mpGallery->GetThemeInfo( rName )->IsHidden() ) )
+ {
+ throw container::NoSuchElementException();
+ }
+ else
+ {
+ mpGallery->RemoveTheme( rName );
+ }
+}
+
+}
diff --git a/svx/source/xml/xmleohlp.cxx b/svx/source/xml/xmleohlp.cxx
new file mode 100644
index 000000000000..fdeda1dd726b
--- /dev/null
+++ b/svx/source/xml/xmleohlp.cxx
@@ -0,0 +1,819 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <stdio.h>
+#include <com/sun/star/io/XStream.hpp>
+#include <com/sun/star/embed/XTransactedObject.hpp>
+#include <com/sun/star/embed/XEmbedObjectCreator.hpp>
+#include <com/sun/star/embed/XEmbedObjectFactory.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#ifndef _COM_SUN_STAR_EMBED_XEMBED_PERSIST_HPP_
+#include <com/sun/star/embed/XEmbedPersist.hpp>
+#endif
+#include <com/sun/star/embed/EntryInitModes.hpp>
+#include <com/sun/star/embed/EmbedStates.hpp>
+#include <com/sun/star/embed/Aspects.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <tools/debug.hxx>
+#include <unotools/streamwrap.hxx>
+#include <unotools/tempfile.hxx>
+
+#include <svtools/embedhlp.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/storagehelper.hxx>
+#include <comphelper/embeddedobjectcontainer.hxx>
+
+#ifndef _SO_CLSIDS_HXX
+#include <sot/clsids.hxx>
+#endif
+#include <map>
+#include "svx/xmleohlp.hxx"
+
+// -----------
+// - Defines -
+// -----------
+
+using namespace ::osl;
+using namespace ::cppu;
+using namespace ::utl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+
+#define XML_CONTAINERSTORAGE_NAME_60 "Pictures"
+#define XML_CONTAINERSTORAGE_NAME "ObjectReplacements"
+#define XML_EMBEDDEDOBJECT_URL_BASE "vnd.sun.star.EmbeddedObject:"
+#define XML_EMBEDDEDOBJECTGRAPHIC_URL_BASE "vnd.sun.star.GraphicObject:"
+
+// -----------------------------------------------------------------------------
+
+// -----------------------------------------------------------------------------
+
+class OutputStorageWrapper_Impl : public ::cppu::WeakImplHelper1<XOutputStream>
+{
+ ::osl::Mutex maMutex;
+ Reference < XOutputStream > xOut;
+ TempFile aTempFile;
+ sal_Bool bStreamClosed : 1;
+ SvStream* pStream;
+
+public:
+ OutputStorageWrapper_Impl();
+ virtual ~OutputStorageWrapper_Impl();
+
+// stario::XOutputStream
+ virtual void SAL_CALL writeBytes(const Sequence< sal_Int8 >& aData) throw(NotConnectedException, BufferSizeExceededException, RuntimeException);
+ virtual void SAL_CALL flush() throw(NotConnectedException, BufferSizeExceededException, RuntimeException);
+ virtual void SAL_CALL closeOutput() throw(NotConnectedException, BufferSizeExceededException, RuntimeException);
+
+ SvStream* GetStream();
+};
+
+OutputStorageWrapper_Impl::OutputStorageWrapper_Impl()
+ : bStreamClosed( sal_False )
+ , pStream(0)
+{
+ aTempFile.EnableKillingFile();
+ pStream = aTempFile.GetStream( STREAM_READWRITE );
+ xOut = new OOutputStreamWrapper( *pStream );
+}
+
+OutputStorageWrapper_Impl::~OutputStorageWrapper_Impl()
+{
+}
+
+SvStream *OutputStorageWrapper_Impl::GetStream()
+{
+ if( bStreamClosed )
+ return pStream;
+ return NULL;
+}
+
+void SAL_CALL OutputStorageWrapper_Impl::writeBytes(
+ const Sequence< sal_Int8 >& aData)
+ throw(NotConnectedException, BufferSizeExceededException, RuntimeException)
+{
+ MutexGuard aGuard( maMutex );
+ xOut->writeBytes( aData );
+}
+
+void SAL_CALL OutputStorageWrapper_Impl::flush()
+ throw(NotConnectedException, BufferSizeExceededException, RuntimeException)
+{
+ MutexGuard aGuard( maMutex );
+ xOut->flush();
+}
+
+void SAL_CALL OutputStorageWrapper_Impl::closeOutput()
+ throw(NotConnectedException, BufferSizeExceededException, RuntimeException)
+{
+ MutexGuard aGuard( maMutex );
+ xOut->closeOutput();
+ bStreamClosed = sal_True;
+}
+
+// -----------------------------------------------------------------------------
+
+struct OUStringLess
+{
+ bool operator() ( const ::rtl::OUString& r1, const ::rtl::OUString& r2 ) const
+ {
+ return (r1 < r2) != sal_False;
+ }
+};
+
+// -----------------------------------------------------------------------------
+
+// -----------------------------
+// - SvXMLEmbeddedObjectHelper -
+// -----------------------------
+DBG_NAME(SvXMLEmbeddedObjectHelper)
+SvXMLEmbeddedObjectHelper::SvXMLEmbeddedObjectHelper() :
+ WeakComponentImplHelper2< XEmbeddedObjectResolver, XNameAccess >( maMutex ),
+ maReplacementGraphicsContainerStorageName( RTL_CONSTASCII_USTRINGPARAM(XML_CONTAINERSTORAGE_NAME) ),
+ maReplacementGraphicsContainerStorageName60( RTL_CONSTASCII_USTRINGPARAM(XML_CONTAINERSTORAGE_NAME_60) ),
+ mpDocPersist( 0 ),
+ meCreateMode( EMBEDDEDOBJECTHELPER_MODE_READ ),
+ mpStreamMap( 0 )
+{
+ DBG_CTOR(SvXMLEmbeddedObjectHelper,NULL);
+}
+
+SvXMLEmbeddedObjectHelper::SvXMLEmbeddedObjectHelper( ::comphelper::IEmbeddedHelper& rDocPersist, SvXMLEmbeddedObjectHelperMode eCreateMode ) :
+ WeakComponentImplHelper2< XEmbeddedObjectResolver, XNameAccess >( maMutex ),
+ maReplacementGraphicsContainerStorageName( RTL_CONSTASCII_USTRINGPARAM(XML_CONTAINERSTORAGE_NAME) ),
+ maReplacementGraphicsContainerStorageName60( RTL_CONSTASCII_USTRINGPARAM(XML_CONTAINERSTORAGE_NAME_60) ),
+ mpDocPersist( 0 ),
+ meCreateMode( EMBEDDEDOBJECTHELPER_MODE_READ ),
+ mpStreamMap( 0 )
+{
+ DBG_CTOR(SvXMLEmbeddedObjectHelper,NULL);
+ Init( 0, rDocPersist, eCreateMode );
+}
+
+
+// -----------------------------------------------------------------------------
+
+SvXMLEmbeddedObjectHelper::~SvXMLEmbeddedObjectHelper()
+{
+ DBG_DTOR(SvXMLEmbeddedObjectHelper,NULL);
+ if( mpStreamMap )
+ {
+ SvXMLEmbeddedObjectHelper_Impl::iterator aIter = mpStreamMap->begin();
+ SvXMLEmbeddedObjectHelper_Impl::iterator aEnd = mpStreamMap->end();
+ for( ; aIter != aEnd; aIter++ )
+ {
+ if( aIter->second )
+ {
+ aIter->second->release();
+ aIter->second = 0;
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SvXMLEmbeddedObjectHelper::disposing()
+{
+ Flush();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SvXMLEmbeddedObjectHelper::ImplGetStorageNames(
+ const ::rtl::OUString& rURLStr,
+ ::rtl::OUString& rContainerStorageName,
+ ::rtl::OUString& rObjectStorageName,
+ sal_Bool bInternalToExternal,
+ sal_Bool *pGraphicRepl,
+ sal_Bool *pOasisFormat ) const
+{
+ // internal URL: vnd.sun.star.EmbeddedObject:<object-name>
+ // or: vnd.sun.star.EmbeddedObject:<path>/<object-name>
+ // internal replacement images:
+ // vnd.sun.star.EmbeddedObjectGraphic:<object-name>
+ // or: vnd.sun.star.EmbeddedObjectGraphic:<path>/<object-name>
+ // external URL: ./<path>/<object-name>
+ // or: <path>/<object-name>
+ // or: <object-name>
+ // currently, path may only consist of a single directory name
+ // it is also possible to have additional arguments at the end of URL: <main URL>[?<name>=<value>[,<name>=<value>]*]
+
+ if( pGraphicRepl )
+ *pGraphicRepl = sal_False;
+
+ if( pOasisFormat )
+ *pOasisFormat = sal_True; // the default value
+
+ if( !rURLStr.getLength() )
+ return sal_False;
+
+ // get rid of arguments
+ sal_Int32 nPos = rURLStr.indexOf( '?' );
+ ::rtl::OUString aURLNoPar;
+ if ( nPos == -1 )
+ aURLNoPar = rURLStr;
+ else
+ {
+ aURLNoPar = rURLStr.copy( 0, nPos );
+
+ // check the arguments
+ nPos++;
+ while( nPos >= 0 && nPos < rURLStr.getLength() )
+ {
+ ::rtl::OUString aToken = rURLStr.getToken( 0, ',', nPos );
+ if ( aToken.equalsIgnoreAsciiCase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "oasis=false" ) ) ) )
+ {
+ if ( pOasisFormat )
+ *pOasisFormat = sal_False;
+ break;
+ }
+ else
+ {
+ DBG_ASSERT( sal_False, "invalid arguments was found in URL!" );
+ }
+ }
+ }
+
+ if( bInternalToExternal )
+ {
+ nPos = aURLNoPar.indexOf( ':' );
+ if( -1 == nPos )
+ return sal_False;
+ sal_Bool bObjUrl =
+ 0 == aURLNoPar.compareToAscii( XML_EMBEDDEDOBJECT_URL_BASE,
+ sizeof( XML_EMBEDDEDOBJECT_URL_BASE ) -1 );
+ sal_Bool bGrUrl = !bObjUrl &&
+ 0 == aURLNoPar.compareToAscii( XML_EMBEDDEDOBJECTGRAPHIC_URL_BASE,
+ sizeof( XML_EMBEDDEDOBJECTGRAPHIC_URL_BASE ) -1 );
+ if( !(bObjUrl || bGrUrl) )
+ return sal_False;
+
+ sal_Int32 nPathStart = nPos + 1;
+ nPos = aURLNoPar.lastIndexOf( '/' );
+ if( -1 == nPos )
+ {
+ rContainerStorageName = ::rtl::OUString();
+ rObjectStorageName = aURLNoPar.copy( nPathStart );
+ }
+ else if( nPos > nPathStart )
+ {
+ rContainerStorageName = aURLNoPar.copy( nPathStart, nPos-nPathStart);
+ rObjectStorageName = aURLNoPar.copy( nPos+1 );
+ }
+ else
+ return sal_False;
+
+ if( bGrUrl )
+ {
+ sal_Bool bOASIS = mxRootStorage.is() &&
+ ( SotStorage::GetVersion( mxRootStorage ) > SOFFICE_FILEFORMAT_60 );
+ rContainerStorageName = bOASIS
+ ? maReplacementGraphicsContainerStorageName
+ : maReplacementGraphicsContainerStorageName60;
+
+ if( pGraphicRepl )
+ *pGraphicRepl = sal_True;
+ }
+
+
+ }
+ else
+ {
+ DBG_ASSERT( '#' != aURLNoPar[0], "invalid object URL" );
+
+ sal_Int32 _nPos = aURLNoPar.lastIndexOf( '/' );
+ if( -1 == _nPos )
+ {
+ rContainerStorageName = ::rtl::OUString();
+ rObjectStorageName = aURLNoPar;
+ }
+ else
+ {
+ //eliminate 'superfluous' slashes at start and end
+ //#i103076# load objects with all allowed xlink:href syntaxes
+ {
+ //eliminate './' at start
+ sal_Int32 nStart = 0;
+ sal_Int32 nCount = aURLNoPar.getLength();
+ if( 0 == aURLNoPar.compareToAscii( "./", 2 ) )
+ {
+ nStart = 2;
+ nCount -= 2;
+ }
+
+ //eliminate '/' at end
+ sal_Int32 nEnd = aURLNoPar.lastIndexOf( '/' );
+ if( nEnd == aURLNoPar.getLength()-1 && nEnd != (nStart-1) )
+ nCount--;
+
+ aURLNoPar = aURLNoPar.copy( nStart, nCount );
+ }
+
+ _nPos = aURLNoPar.lastIndexOf( '/' );
+ if( _nPos >= 0 )
+ rContainerStorageName = aURLNoPar.copy( 0, _nPos );
+ rObjectStorageName = aURLNoPar.copy( _nPos+1 );
+ }
+ }
+
+ if( -1 != rContainerStorageName.indexOf( '/' ) )
+ {
+ DBG_ERROR( "SvXMLEmbeddedObjectHelper: invalid path name" );
+ return sal_False;
+ }
+
+ return sal_True;
+}
+
+
+// -----------------------------------------------------------------------------
+
+uno::Reference < embed::XStorage > SvXMLEmbeddedObjectHelper::ImplGetContainerStorage(
+ const ::rtl::OUString& rStorageName )
+{
+ DBG_ASSERT( -1 == rStorageName.indexOf( '/' ) &&
+ -1 == rStorageName.indexOf( '\\' ),
+ "nested embedded storages aren't supported" );
+ if( !mxContainerStorage.is() ||
+ ( rStorageName != maCurContainerStorageName ) )
+ {
+ if( mxContainerStorage.is() &&
+ maCurContainerStorageName.getLength() > 0 &&
+ EMBEDDEDOBJECTHELPER_MODE_WRITE == meCreateMode )
+ {
+ uno::Reference < embed::XTransactedObject > xTrans( mxContainerStorage, uno::UNO_QUERY );
+ if ( xTrans.is() )
+ xTrans->commit();
+ }
+
+ if( rStorageName.getLength() > 0 && mxRootStorage.is() )
+ {
+ sal_Int32 nMode = EMBEDDEDOBJECTHELPER_MODE_WRITE == meCreateMode
+ ? ::embed::ElementModes::READWRITE
+ : ::embed::ElementModes::READ;
+ mxContainerStorage = mxRootStorage->openStorageElement( rStorageName,
+ nMode );
+ }
+ else
+ {
+ mxContainerStorage = mxRootStorage;
+ }
+ maCurContainerStorageName = rStorageName;
+ }
+
+ return mxContainerStorage;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SvXMLEmbeddedObjectHelper::ImplReadObject(
+ const ::rtl::OUString& rContainerStorageName,
+ ::rtl::OUString& rObjName,
+ const SvGlobalName *pClassId,
+ SvStream* pTemp )
+{
+ (void)pClassId;
+
+ uno::Reference < embed::XStorage > xDocStor( mpDocPersist->getStorage() );
+ uno::Reference < embed::XStorage > xCntnrStor( ImplGetContainerStorage( rContainerStorageName ) );
+
+ if( !xCntnrStor.is() && !pTemp )
+ return sal_False;
+
+ String aSrcObjName( rObjName );
+ comphelper::EmbeddedObjectContainer& rContainer = mpDocPersist->getEmbeddedObjectContainer();
+
+ // Is the object name unique?
+ // if the object is already instantiated by GetEmbeddedObject
+ // that means that the duplication is being loaded
+ sal_Bool bDuplicate = rContainer.HasInstantiatedEmbeddedObject( rObjName );
+ DBG_ASSERT( !bDuplicate, "An object in the document is referenced twice!" );
+
+ if( xDocStor != xCntnrStor || pTemp || bDuplicate )
+ {
+ // TODO/LATER: make this alltogether a method in the EmbeddedObjectContainer
+
+ // create a unique name for the duplicate object
+ if( bDuplicate )
+ rObjName = rContainer.CreateUniqueObjectName();
+
+ if( pTemp )
+ {
+ try
+ {
+ pTemp->Seek( 0 );
+ uno::Reference < io::XStream > xStm = xDocStor->openStreamElement( rObjName,
+ embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE );
+ SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( xStm );
+ *pTemp >> *pStream;
+ delete pStream;
+
+ // TODO/LATER: what to do when other types of objects are based on substream persistence?
+ // This is an ole object
+ uno::Reference< beans::XPropertySet > xProps( xStm, uno::UNO_QUERY_THROW );
+ xProps->setPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ),
+ uno::makeAny( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.sun.star.oleobject" ) ) ) );
+
+ xStm->getOutputStream()->closeOutput();
+ }
+ catch ( uno::Exception& )
+ {
+ return sal_False;
+ }
+ }
+ else
+ {
+ try
+ {
+ xCntnrStor->copyElementTo( aSrcObjName, xDocStor, rObjName );
+ }
+ catch ( uno::Exception& )
+ {
+ return sal_False;
+ }
+ }
+ }
+
+ // make object known to the container
+ // TODO/LATER: could be done a little bit more efficient!
+ ::rtl::OUString aName( rObjName );
+
+ // TODO/LATER: The provided pClassId is ignored for now.
+ // The stream contains OLE storage internally and this storage already has a class id specifying the
+ // server that was used to create the object. pClassId could be used to specify the server that should
+ // be used for the next opening, but this information seems to be out of the file format responsibility
+ // area.
+ rContainer.GetEmbeddedObject( aName );
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString SvXMLEmbeddedObjectHelper::ImplInsertEmbeddedObjectURL(
+ const ::rtl::OUString& rURLStr )
+{
+ ::rtl::OUString sRetURL;
+
+ ::rtl::OUString aContainerStorageName, aObjectStorageName;
+ if( !ImplGetStorageNames( rURLStr, aContainerStorageName,
+ aObjectStorageName,
+ EMBEDDEDOBJECTHELPER_MODE_WRITE == meCreateMode ) )
+ return sRetURL;
+
+ if( EMBEDDEDOBJECTHELPER_MODE_READ == meCreateMode )
+ {
+ OutputStorageWrapper_Impl *pOut = 0;
+ SvXMLEmbeddedObjectHelper_Impl::iterator aIter;
+
+ if( mpStreamMap )
+ {
+ aIter = mpStreamMap->find( rURLStr );
+ if( aIter != mpStreamMap->end() && aIter->second )
+ pOut = aIter->second;
+ }
+
+ SvGlobalName aClassId, *pClassId = 0;
+ sal_Int32 nPos = aObjectStorageName.lastIndexOf( '!' );
+ if( -1 != nPos && aClassId.MakeId( aObjectStorageName.copy( nPos+1 ) ) )
+ {
+ aObjectStorageName = aObjectStorageName.copy( 0, nPos );
+ pClassId = &aClassId;
+ }
+
+ ImplReadObject( aContainerStorageName, aObjectStorageName, pClassId, pOut ? pOut->GetStream() : 0 );
+ sRetURL = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(XML_EMBEDDEDOBJECT_URL_BASE) );
+ sRetURL += aObjectStorageName;
+
+ if( pOut )
+ {
+ mpStreamMap->erase( aIter );
+ pOut->release();
+ }
+ }
+ else
+ {
+ // Objects are written using ::comphelper::IEmbeddedHelper::SaveAs
+ sRetURL = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("./") );
+ if( aContainerStorageName.getLength() )
+ {
+ sRetURL += aContainerStorageName;
+ sRetURL += ::rtl::OUString( '/' );
+ }
+ sRetURL += aObjectStorageName;
+ }
+
+ return sRetURL;
+}
+
+// -----------------------------------------------------------------------------
+
+uno::Reference< io::XInputStream > SvXMLEmbeddedObjectHelper::ImplGetReplacementImage(
+ const uno::Reference< embed::XEmbeddedObject >& xObj )
+{
+ uno::Reference< io::XInputStream > xStream;
+
+ if( xObj.is() )
+ {
+ try
+ {
+ sal_Bool bSwitchBackToLoaded = sal_False;
+ sal_Int32 nCurState = xObj->getCurrentState();
+ if ( nCurState == embed::EmbedStates::LOADED || nCurState == embed::EmbedStates::RUNNING )
+ {
+ // means that the object is not active
+ // copy replacement image from old to new container
+ ::rtl::OUString aMediaType;
+ xStream = mpDocPersist->getEmbeddedObjectContainer().GetGraphicStream( xObj, &aMediaType );
+ }
+
+ if ( !xStream.is() )
+ {
+ // the image must be regenerated
+ // TODO/LATER: another aspect could be used
+ if ( nCurState == embed::EmbedStates::LOADED )
+ bSwitchBackToLoaded = sal_True;
+
+ ::rtl::OUString aMediaType;
+ xStream = svt::EmbeddedObjectRef::GetGraphicReplacementStream(
+ embed::Aspects::MSOLE_CONTENT,
+ xObj,
+ &aMediaType );
+ }
+
+ if ( bSwitchBackToLoaded )
+ // switch back to loaded state; that way we have a minimum cache confusion
+ xObj->changeState( embed::EmbedStates::LOADED );
+ }
+ catch( uno::Exception& )
+ {}
+ }
+
+ return xStream;
+}
+
+// -----------------------------------------------------------------------------
+
+void SvXMLEmbeddedObjectHelper::Init(
+ const uno::Reference < embed::XStorage >& rRootStorage,
+ ::comphelper::IEmbeddedHelper& rPersist,
+ SvXMLEmbeddedObjectHelperMode eCreateMode )
+{
+ mxRootStorage = rRootStorage;
+ mpDocPersist = &rPersist;
+ meCreateMode = eCreateMode;
+}
+
+// -----------------------------------------------------------------------------
+
+SvXMLEmbeddedObjectHelper* SvXMLEmbeddedObjectHelper::Create(
+ const uno::Reference < embed::XStorage >& rRootStorage,
+ ::comphelper::IEmbeddedHelper& rDocPersist,
+ SvXMLEmbeddedObjectHelperMode eCreateMode,
+ sal_Bool bDirect )
+{
+ (void)bDirect;
+
+ SvXMLEmbeddedObjectHelper* pThis = new SvXMLEmbeddedObjectHelper;
+
+ pThis->acquire();
+ pThis->Init( rRootStorage, rDocPersist, eCreateMode );
+
+ return pThis;
+}
+
+SvXMLEmbeddedObjectHelper* SvXMLEmbeddedObjectHelper::Create(
+ ::comphelper::IEmbeddedHelper& rDocPersist,
+ SvXMLEmbeddedObjectHelperMode eCreateMode )
+{
+ SvXMLEmbeddedObjectHelper* pThis = new SvXMLEmbeddedObjectHelper;
+
+ pThis->acquire();
+ pThis->Init( 0, rDocPersist, eCreateMode );
+
+ return pThis;
+}
+
+// -----------------------------------------------------------------------------
+
+void SvXMLEmbeddedObjectHelper::Destroy(
+ SvXMLEmbeddedObjectHelper* pSvXMLEmbeddedObjectHelper )
+{
+ if( pSvXMLEmbeddedObjectHelper )
+ {
+ pSvXMLEmbeddedObjectHelper->dispose();
+ pSvXMLEmbeddedObjectHelper->release();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SvXMLEmbeddedObjectHelper::Flush()
+{
+ if( mxTempStorage.is() )
+ {
+ Reference < XComponent > xComp( mxTempStorage, UNO_QUERY );
+ xComp->dispose();
+ }
+}
+
+// XGraphicObjectResolver: alien objects!
+::rtl::OUString SAL_CALL SvXMLEmbeddedObjectHelper::resolveEmbeddedObjectURL( const ::rtl::OUString& aURL )
+ throw(RuntimeException)
+{
+ MutexGuard aGuard( maMutex );
+
+ return ImplInsertEmbeddedObjectURL( aURL );
+}
+
+// XNameAccess: alien objects!
+Any SAL_CALL SvXMLEmbeddedObjectHelper::getByName(
+ const ::rtl::OUString& rURLStr )
+ throw (NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ MutexGuard aGuard( maMutex );
+ Any aRet;
+ if( EMBEDDEDOBJECTHELPER_MODE_READ == meCreateMode )
+ {
+ Reference < XOutputStream > xStrm;
+ if( mpStreamMap )
+ {
+ SvXMLEmbeddedObjectHelper_Impl::iterator aIter =
+ mpStreamMap->find( rURLStr );
+ if( aIter != mpStreamMap->end() && aIter->second )
+ xStrm = aIter->second;
+ }
+ if( !xStrm.is() )
+ {
+ OutputStorageWrapper_Impl *pOut = new OutputStorageWrapper_Impl;
+ pOut->acquire();
+ if( !mpStreamMap )
+ mpStreamMap = new SvXMLEmbeddedObjectHelper_Impl;
+ (*mpStreamMap)[rURLStr] = pOut;
+ xStrm = pOut;
+ }
+
+ aRet <<= xStrm;
+ }
+ else
+ {
+ sal_Bool bGraphicRepl = sal_False;
+ sal_Bool bOasisFormat = sal_True;
+ Reference < XInputStream > xStrm;
+ ::rtl::OUString aContainerStorageName, aObjectStorageName;
+ if( ImplGetStorageNames( rURLStr, aContainerStorageName,
+ aObjectStorageName,
+ sal_True,
+ &bGraphicRepl,
+ &bOasisFormat ) )
+ {
+ try
+ {
+ comphelper::EmbeddedObjectContainer& rContainer =
+ mpDocPersist->getEmbeddedObjectContainer();
+
+ Reference < embed::XEmbeddedObject > xObj = rContainer.GetEmbeddedObject( aObjectStorageName );
+ DBG_ASSERT( xObj.is(), "Didn't get object" );
+
+ if( xObj.is() )
+ {
+ if( bGraphicRepl )
+ {
+ xStrm = ImplGetReplacementImage( xObj );
+ }
+ else
+ {
+ Reference < embed::XEmbedPersist > xPersist( xObj, UNO_QUERY );
+ if( xPersist.is() )
+ {
+ if( !mxTempStorage.is() )
+ mxTempStorage =
+ comphelper::OStorageHelper::GetTemporaryStorage();
+ Sequence < beans::PropertyValue > aDummy( 0 ), aEmbDescr( 1 );
+ aEmbDescr[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StoreVisualReplacement" ) );
+ aEmbDescr[0].Value <<= (sal_Bool)(!bOasisFormat);
+ if ( !bOasisFormat )
+ {
+ ::rtl::OUString aMimeType;
+ uno::Reference< io::XInputStream > xGrInStream = ImplGetReplacementImage( xObj );
+ if ( xGrInStream.is() )
+ {
+ aEmbDescr.realloc( 2 );
+ aEmbDescr[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VisualReplacement" ) );
+ aEmbDescr[1].Value <<= xGrInStream;
+ }
+ }
+
+ xPersist->storeToEntry( mxTempStorage, aObjectStorageName,
+ aDummy, aEmbDescr );
+ Reference < io::XStream > xStream =
+ mxTempStorage->openStreamElement(
+ aObjectStorageName,
+ embed::ElementModes::READ);
+ if( xStream.is() )
+ xStrm = xStream->getInputStream();
+ }
+ }
+ }
+ }
+ catch ( uno::Exception& )
+ {
+ }
+ }
+
+ aRet <<= xStrm;
+ }
+
+ return aRet;
+}
+
+Sequence< ::rtl::OUString > SAL_CALL SvXMLEmbeddedObjectHelper::getElementNames()
+ throw (RuntimeException)
+{
+ MutexGuard aGuard( maMutex );
+ return Sequence< ::rtl::OUString >(0);
+}
+
+sal_Bool SAL_CALL SvXMLEmbeddedObjectHelper::hasByName( const ::rtl::OUString& rURLStr )
+ throw (RuntimeException)
+{
+ MutexGuard aGuard( maMutex );
+ if( EMBEDDEDOBJECTHELPER_MODE_READ == meCreateMode )
+ {
+ return sal_True;
+ }
+ else
+ {
+ ::rtl::OUString aContainerStorageName, aObjectStorageName;
+ if( !ImplGetStorageNames( rURLStr, aContainerStorageName,
+ aObjectStorageName,
+ sal_True ) )
+ return sal_False;
+
+ comphelper::EmbeddedObjectContainer& rContainer = mpDocPersist->getEmbeddedObjectContainer();
+ return aObjectStorageName.getLength() > 0 &&
+ rContainer.HasEmbeddedObject( aObjectStorageName );
+ }
+}
+
+// XNameAccess
+Type SAL_CALL SvXMLEmbeddedObjectHelper::getElementType()
+ throw (RuntimeException)
+{
+ MutexGuard aGuard( maMutex );
+ if( EMBEDDEDOBJECTHELPER_MODE_READ == meCreateMode )
+ return ::getCppuType((const Reference<XOutputStream>*)0);
+ else
+ return ::getCppuType((const Reference<XInputStream>*)0);
+}
+
+sal_Bool SAL_CALL SvXMLEmbeddedObjectHelper::hasElements()
+ throw (RuntimeException)
+{
+ MutexGuard aGuard( maMutex );
+ if( EMBEDDEDOBJECTHELPER_MODE_READ == meCreateMode )
+ {
+ return sal_True;
+ }
+ else
+ {
+ comphelper::EmbeddedObjectContainer& rContainer = mpDocPersist->getEmbeddedObjectContainer();
+ return rContainer.HasEmbeddedObjects();
+ }
+}
+
diff --git a/svx/source/xml/xmlexport.cxx b/svx/source/xml/xmlexport.cxx
new file mode 100644
index 000000000000..c3b5bc5e55d0
--- /dev/null
+++ b/svx/source/xml/xmlexport.cxx
@@ -0,0 +1,283 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include <com/sun/star/xml/sax/InputSource.hpp>
+#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/document/XImporter.hpp>
+#include <comphelper/processfactory.hxx>
+#include <unotools/streamwrap.hxx>
+#include <sot/storage.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/xmleohlp.hxx>
+#include <svx/xmlgrhlp.hxx>
+
+#include <svx/unomodel.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const uno::Reference<io::XOutputStream>& xOut, const Reference< lang::XComponent >& xComponent )
+{
+ return SvxDrawingLayerExport( pModel, xOut, xComponent, "com.sun.star.comp.DrawingLayer.XMLExporter" );
+}
+
+sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const uno::Reference<io::XOutputStream>& xOut, const Reference< lang::XComponent >& xComponent, const char* pExportService )
+{
+ sal_Bool bDocRet = xOut.is();
+
+ Reference< document::XGraphicObjectResolver > xGraphicResolver;
+ SvXMLGraphicHelper *pGraphicHelper = 0;
+
+ Reference< document::XEmbeddedObjectResolver > xObjectResolver;
+ SvXMLEmbeddedObjectHelper *pObjectHelper = 0;
+
+ Reference< lang::XComponent > xSourceDoc( xComponent );
+ try
+ {
+ if( !xSourceDoc.is() )
+ {
+ xSourceDoc = new SvxUnoDrawingModel( pModel );
+ pModel->setUnoModel( Reference< XInterface >::query( xSourceDoc ) );
+ }
+
+ uno::Reference< lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() );
+ if( !xServiceFactory.is() )
+ {
+ DBG_ERROR( "got no service manager" );
+ bDocRet = sal_False;
+ }
+
+ if( bDocRet )
+ {
+ uno::Reference< uno::XInterface > xWriter( xServiceFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" ) ) ) );
+ if( !xWriter.is() )
+ {
+ DBG_ERROR( "com.sun.star.xml.sax.Writer service missing" );
+ bDocRet = sal_False;
+ }
+
+ ::comphelper::IEmbeddedHelper *pPersist = pModel->GetPersist();
+ if( pPersist )
+ {
+ pObjectHelper = SvXMLEmbeddedObjectHelper::Create( *pPersist, EMBEDDEDOBJECTHELPER_MODE_WRITE );
+ xObjectResolver = pObjectHelper;
+ }
+
+ pGraphicHelper = SvXMLGraphicHelper::Create( GRAPHICHELPER_MODE_WRITE );
+ xGraphicResolver = pGraphicHelper;
+
+ if( bDocRet )
+ {
+ uno::Reference<xml::sax::XDocumentHandler> xHandler( xWriter, uno::UNO_QUERY );
+
+ // doc export
+ uno::Reference< io::XActiveDataSource > xDocSrc( xWriter, uno::UNO_QUERY );
+ xDocSrc->setOutputStream( xOut );
+
+ uno::Sequence< uno::Any > aArgs( xObjectResolver.is() ? 3 : 2 );
+ aArgs[0] <<= xHandler;
+ aArgs[1] <<= xGraphicResolver;
+ if( xObjectResolver.is() )
+ aArgs[2] <<= xObjectResolver;
+
+ uno::Reference< document::XFilter > xFilter( xServiceFactory->createInstanceWithArguments( OUString::createFromAscii( pExportService ), aArgs ), uno::UNO_QUERY );
+ if( !xFilter.is() )
+ {
+ DBG_ERROR( "com.sun.star.comp.Draw.XMLExporter service missing" );
+ bDocRet = sal_False;
+ }
+
+ if( bDocRet )
+ {
+ uno::Reference< document::XExporter > xExporter( xFilter, uno::UNO_QUERY );
+ if( xExporter.is() )
+ {
+ xExporter->setSourceDocument( xSourceDoc );
+
+ uno::Sequence< beans::PropertyValue > aDescriptor( 0 );
+ bDocRet = xFilter->filter( aDescriptor );
+ }
+ }
+ }
+ }
+ }
+ catch(uno::Exception e)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ bDocRet = sal_False;
+ }
+
+ if( pGraphicHelper )
+ SvXMLGraphicHelper::Destroy( pGraphicHelper );
+ xGraphicResolver = 0;
+
+ if( pObjectHelper )
+ SvXMLEmbeddedObjectHelper::Destroy( pObjectHelper );
+ xObjectResolver = 0;
+
+ return bDocRet;
+}
+
+sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const uno::Reference<io::XOutputStream>& xOut )
+{
+ Reference< lang::XComponent > xComponent;
+ return SvxDrawingLayerExport( pModel, xOut, xComponent );
+}
+
+//-////////////////////////////////////////////////////////////////////
+
+sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference<io::XInputStream>& xInputStream, const Reference< lang::XComponent >& xComponent )
+{
+ return SvxDrawingLayerImport( pModel, xInputStream, xComponent, "com.sun.star.comp.Draw.XMLOasisImporter" );
+}
+
+sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference<io::XInputStream>& xInputStream, const Reference< lang::XComponent >& xComponent, const char* pImportService )
+{
+ sal_uInt32 nRet = 0;
+
+ Reference< document::XGraphicObjectResolver > xGraphicResolver;
+ SvXMLGraphicHelper *pGraphicHelper = 0;
+
+ Reference< document::XEmbeddedObjectResolver > xObjectResolver;
+ SvXMLEmbeddedObjectHelper *pObjectHelper = 0;
+
+ Reference< lang::XComponent > xTargetDocument( xComponent );
+ if( !xTargetDocument.is() )
+ {
+ xTargetDocument = new SvxUnoDrawingModel( pModel );
+ pModel->setUnoModel( Reference< XInterface >::query( xTargetDocument ) );
+ }
+
+ Reference< frame::XModel > xTargetModel( xTargetDocument, UNO_QUERY );
+
+ try
+ {
+ // Get service factory
+ Reference< lang::XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory();
+ DBG_ASSERT( xServiceFactory.is(), "XMLReader::Read: got no service manager" );
+
+ if( !xServiceFactory.is() )
+ nRet = 1;
+
+ if( 0 == nRet )
+ {
+ if ( xTargetModel.is() )
+ xTargetModel->lockControllers();
+
+ // -------------------------------------
+
+ pGraphicHelper = SvXMLGraphicHelper::Create( GRAPHICHELPER_MODE_READ );
+ xGraphicResolver = pGraphicHelper;
+
+ ::comphelper::IEmbeddedHelper *pPersist = pModel->GetPersist();
+ if( pPersist )
+ {
+ pObjectHelper = SvXMLEmbeddedObjectHelper::Create(
+ *pPersist,
+ EMBEDDEDOBJECTHELPER_MODE_READ );
+ xObjectResolver = pObjectHelper;
+ }
+ }
+
+ // -------------------------------------
+
+ if( 0 == nRet )
+ {
+
+ // parse
+ // prepare ParserInputSrouce
+ xml::sax::InputSource aParserInput;
+ aParserInput.aInputStream = xInputStream;
+
+ // get parser
+ Reference< xml::sax::XParser > xParser( xServiceFactory->createInstance( OUString::createFromAscii("com.sun.star.xml.sax.Parser") ), UNO_QUERY );
+ DBG_ASSERT( xParser.is(), "Can't create parser" );
+
+ // prepare filter arguments
+ Sequence<Any> aFilterArgs( 2 );
+ Any *pArgs = aFilterArgs.getArray();
+ *pArgs++ <<= xGraphicResolver;
+ *pArgs++ <<= xObjectResolver;
+
+ // get filter
+ Reference< xml::sax::XDocumentHandler > xFilter( xServiceFactory->createInstanceWithArguments( OUString::createFromAscii( pImportService ), aFilterArgs), UNO_QUERY );
+ DBG_ASSERT( xFilter.is(), "Can't instantiate filter component." );
+
+ nRet = 1;
+ if( xParser.is() && xFilter.is() )
+ {
+ // connect parser and filter
+ xParser->setDocumentHandler( xFilter );
+
+ // connect model and filter
+ uno::Reference < document::XImporter > xImporter( xFilter, UNO_QUERY );
+ xImporter->setTargetDocument( xTargetDocument );
+
+ // finally, parser the stream
+ xParser->parseStream( aParserInput );
+
+ nRet = 0;
+ }
+ }
+ }
+ catch( uno::Exception& r )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ if( pGraphicHelper )
+ SvXMLGraphicHelper::Destroy( pGraphicHelper );
+ xGraphicResolver = 0;
+
+ if( pObjectHelper )
+ SvXMLEmbeddedObjectHelper::Destroy( pObjectHelper );
+ xObjectResolver = 0;
+
+ if ( xTargetModel.is() )
+ xTargetModel->unlockControllers();
+
+ return nRet == 0;
+}
+
+sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference<io::XInputStream>& xInputStream )
+{
+ Reference< lang::XComponent > xComponent;
+ return SvxDrawingLayerImport( pModel, xInputStream, xComponent );
+}
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
new file mode 100644
index 000000000000..7889fcc0f5ff
--- /dev/null
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -0,0 +1,1163 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <com/sun/star/embed/XTransactedObject.hpp>
+#ifndef _COM_SUN_STAR_EMBED_ElementModes_HPP_
+#include <com/sun/star/embed/ElementModes.hpp>
+#endif
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <cppuhelper/compbase4.hxx>
+
+#include <unotools/ucbstreamhelper.hxx>
+#include <unotools/streamwrap.hxx>
+#include <unotools/tempfile.hxx>
+#include <tools/debug.hxx>
+#include <vcl/cvtgrf.hxx>
+#include <vcl/gfxlink.hxx>
+#include <vcl/metaact.hxx>
+#include <tools/zcodec.hxx>
+
+#include "svtools/filter.hxx"
+#include "svx/xmlgrhlp.hxx"
+
+#include <algorithm>
+
+// -----------
+// - Defines -
+// -----------
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::io;
+
+using ::com::sun::star::lang::XMultiServiceFactory;
+
+#define XML_GRAPHICSTORAGE_NAME "Pictures"
+#define XML_PACKAGE_URL_BASE "vnd.sun.star.Package:"
+#define XML_GRAPHICOBJECT_URL_BASE "vnd.sun.star.GraphicObject:"
+
+// ---------------------------
+// - SvXMLGraphicInputStream -
+// ---------------------------
+
+const MetaCommentAction* ImplCheckForEPS( GDIMetaFile& rMtf )
+{
+ static ByteString aComment( (const sal_Char*)"EPSReplacementGraphic" );
+ const MetaCommentAction* pComment = NULL;
+
+ if ( ( rMtf.GetActionCount() >= 2 )
+ && ( rMtf.FirstAction()->GetType() == META_EPS_ACTION )
+ && ( ((const MetaAction*)rMtf.GetAction( 1 ))->GetType() == META_COMMENT_ACTION )
+ && ( ((const MetaCommentAction*)rMtf.GetAction( 1 ))->GetComment() == aComment ) )
+ pComment = (const MetaCommentAction*)rMtf.GetAction( 1 );
+
+ return pComment;
+}
+
+class SvXMLGraphicInputStream : public::cppu::WeakImplHelper1< XInputStream >
+{
+private:
+
+ virtual sal_Int32 SAL_CALL readBytes( Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead) throw(NotConnectedException, BufferSizeExceededException, RuntimeException);
+ virtual sal_Int32 SAL_CALL readSomeBytes(Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead) throw(NotConnectedException, BufferSizeExceededException, RuntimeException);
+ virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip) throw(NotConnectedException, BufferSizeExceededException, RuntimeException);
+ virtual sal_Int32 SAL_CALL available() throw(NotConnectedException, RuntimeException);
+ virtual void SAL_CALL closeInput() throw(NotConnectedException, RuntimeException);
+
+private:
+
+ ::utl::TempFile maTmp;
+ Reference< XInputStream > mxStmWrapper;
+
+ // not available
+ SvXMLGraphicInputStream();
+ SvXMLGraphicInputStream( const SvXMLGraphicInputStream& );
+ SvXMLGraphicInputStream& operator==( SvXMLGraphicInputStream& );
+
+public:
+
+ SvXMLGraphicInputStream( const ::rtl::OUString& rGraphicId );
+ virtual ~SvXMLGraphicInputStream();
+
+ sal_Bool Exists() const { return mxStmWrapper.is(); }
+};
+
+// -----------------------------------------------------------------------------
+
+SvXMLGraphicInputStream::SvXMLGraphicInputStream( const ::rtl::OUString& rGraphicId )
+{
+ String aGraphicId( rGraphicId );
+ GraphicObject aGrfObject( ByteString( aGraphicId, RTL_TEXTENCODING_ASCII_US ) );
+
+ maTmp.EnableKillingFile();
+
+ if( aGrfObject.GetType() != GRAPHIC_NONE )
+ {
+ SvStream* pStm = ::utl::UcbStreamHelper::CreateStream( maTmp.GetURL(), STREAM_WRITE | STREAM_TRUNC );
+
+ if( pStm )
+ {
+ Graphic aGraphic( (Graphic&) aGrfObject.GetGraphic() );
+ const GfxLink aGfxLink( aGraphic.GetLink() );
+ sal_Bool bRet = sal_False;
+
+ if( aGfxLink.GetDataSize() && aGfxLink.GetData() )
+ {
+ pStm->Write( aGfxLink.GetData(), aGfxLink.GetDataSize() );
+ bRet = ( pStm->GetError() == 0 );
+ }
+ else
+ {
+ if( aGraphic.GetType() == GRAPHIC_BITMAP )
+ {
+ GraphicFilter* pFilter = GraphicFilter::GetGraphicFilter();
+ String aFormat;
+
+ if( aGraphic.IsAnimated() )
+ aFormat = String( RTL_CONSTASCII_USTRINGPARAM( "gif" ) );
+ else
+ aFormat = String( RTL_CONSTASCII_USTRINGPARAM( "png" ) );
+
+ bRet = ( pFilter->ExportGraphic( aGraphic, String(), *pStm, pFilter->GetExportFormatNumberForShortName( aFormat ) ) == 0 );
+ }
+ else if( aGraphic.GetType() == GRAPHIC_GDIMETAFILE )
+ {
+ pStm->SetVersion( SOFFICE_FILEFORMAT_8 );
+ pStm->SetCompressMode( COMPRESSMODE_ZBITMAP );
+ ( (GDIMetaFile&) aGraphic.GetGDIMetaFile() ).Write( *pStm );
+ bRet = ( pStm->GetError() == 0 );
+ }
+ }
+
+ if( bRet )
+ {
+ pStm->Seek( 0 );
+ mxStmWrapper = new ::utl::OInputStreamWrapper( pStm, sal_True );
+ }
+ else
+ delete pStm;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+SvXMLGraphicInputStream::~SvXMLGraphicInputStream()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL SvXMLGraphicInputStream::readBytes( Sequence< sal_Int8 >& rData, sal_Int32 nBytesToRead )
+ throw( NotConnectedException, BufferSizeExceededException, RuntimeException )
+{
+ if( !mxStmWrapper.is() )
+ throw NotConnectedException();
+
+ return mxStmWrapper->readBytes( rData, nBytesToRead );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL SvXMLGraphicInputStream::readSomeBytes( Sequence< sal_Int8 >& rData, sal_Int32 nMaxBytesToRead )
+ throw( NotConnectedException, BufferSizeExceededException, RuntimeException )
+{
+ if( !mxStmWrapper.is() )
+ throw NotConnectedException() ;
+
+ return mxStmWrapper->readSomeBytes( rData, nMaxBytesToRead );
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SvXMLGraphicInputStream::skipBytes( sal_Int32 nBytesToSkip )
+ throw( NotConnectedException, BufferSizeExceededException, RuntimeException )
+{
+ if( !mxStmWrapper.is() )
+ throw NotConnectedException() ;
+
+ mxStmWrapper->skipBytes( nBytesToSkip );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL SvXMLGraphicInputStream::available() throw( NotConnectedException, RuntimeException )
+{
+ if( !mxStmWrapper.is() )
+ throw NotConnectedException() ;
+
+ return mxStmWrapper->available();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SvXMLGraphicInputStream::closeInput() throw( NotConnectedException, RuntimeException )
+{
+ if( !mxStmWrapper.is() )
+ throw NotConnectedException() ;
+
+ mxStmWrapper->closeInput();
+}
+
+// ----------------------------
+// - SvXMLGraphicOutputStream -
+// ----------------------------
+
+class SvXMLGraphicOutputStream : public::cppu::WeakImplHelper1< XOutputStream >
+{
+private:
+
+ // XOutputStream
+ virtual void SAL_CALL writeBytes( const Sequence< sal_Int8 >& rData ) throw( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException );
+ virtual void SAL_CALL flush() throw( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException );
+ virtual void SAL_CALL closeOutput() throw( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException );
+
+private:
+
+ ::utl::TempFile* mpTmp;
+ SvStream* mpOStm;
+ Reference< XOutputStream > mxStmWrapper;
+ GraphicObject maGrfObj;
+ sal_Bool mbClosed;
+
+ // not available
+ SvXMLGraphicOutputStream( const SvXMLGraphicOutputStream& );
+ SvXMLGraphicOutputStream& operator==( SvXMLGraphicOutputStream& );
+
+public:
+
+ SvXMLGraphicOutputStream();
+ virtual ~SvXMLGraphicOutputStream();
+
+ sal_Bool Exists() const { return mxStmWrapper.is(); }
+ const GraphicObject& GetGraphicObject();
+};
+
+// -----------------------------------------------------------------------------
+
+SvXMLGraphicOutputStream::SvXMLGraphicOutputStream() :
+ mpTmp( new ::utl::TempFile ),
+ mbClosed( sal_False )
+{
+ mpTmp->EnableKillingFile();
+
+ mpOStm = ::utl::UcbStreamHelper::CreateStream( mpTmp->GetURL(), STREAM_WRITE | STREAM_TRUNC );
+
+ if( mpOStm )
+ mxStmWrapper = new ::utl::OOutputStreamWrapper( *mpOStm );
+}
+
+// -----------------------------------------------------------------------------
+
+SvXMLGraphicOutputStream::~SvXMLGraphicOutputStream()
+{
+ delete mpTmp;
+ delete mpOStm;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SvXMLGraphicOutputStream::writeBytes( const Sequence< sal_Int8 >& rData )
+ throw( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException )
+{
+ if( !mxStmWrapper.is() )
+ throw NotConnectedException() ;
+
+ mxStmWrapper->writeBytes( rData );
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SvXMLGraphicOutputStream::flush()
+ throw( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException )
+{
+ if( !mxStmWrapper.is() )
+ throw NotConnectedException() ;
+
+ mxStmWrapper->flush();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SvXMLGraphicOutputStream::closeOutput()
+ throw( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException )
+{
+ if( !mxStmWrapper.is() )
+ throw NotConnectedException() ;
+
+ mxStmWrapper->closeOutput();
+ mxStmWrapper = Reference< XOutputStream >();
+
+ mbClosed = sal_True;
+}
+
+// ------------------------------------------------------------------------------
+
+const GraphicObject& SvXMLGraphicOutputStream::GetGraphicObject()
+{
+ if( mbClosed && ( maGrfObj.GetType() == GRAPHIC_NONE ) && mpOStm )
+ {
+ Graphic aGraphic;
+
+ mpOStm->Seek( 0 );
+ sal_uInt16 nFormat = GRFILTER_FORMAT_DONTKNOW;
+ sal_uInt16 pDeterminedFormat = GRFILTER_FORMAT_DONTKNOW;
+ GraphicFilter::GetGraphicFilter()->ImportGraphic( aGraphic, String(), *mpOStm ,nFormat,&pDeterminedFormat );
+
+ if (pDeterminedFormat == GRFILTER_FORMAT_DONTKNOW)
+ {
+ //Read the first two byte to check whether it is a gzipped stream, is so it may be in wmz or emz format
+ //unzip them and try again
+
+ sal_uInt8 sFirstBytes[ 2 ];
+
+ mpOStm->Seek( STREAM_SEEK_TO_END );
+ sal_uIntPtr nStreamLen = mpOStm->Tell();
+ mpOStm->Seek( 0 );
+
+ if ( !nStreamLen )
+ {
+ SvLockBytes* pLockBytes = mpOStm->GetLockBytes();
+ if ( pLockBytes )
+ pLockBytes->SetSynchronMode( sal_True );
+
+ mpOStm->Seek( STREAM_SEEK_TO_END );
+ nStreamLen = mpOStm->Tell();
+ mpOStm->Seek( 0 );
+ }
+ if( nStreamLen >= 2 )
+ {
+ //read two byte
+ mpOStm->Read( sFirstBytes, 2 );
+
+ if( sFirstBytes[0] == 0x1f && sFirstBytes[1] == 0x8b )
+ {
+ SvMemoryStream* pDest = new SvMemoryStream;
+ ZCodec aZCodec( 0x8000, 0x8000 );
+ aZCodec.BeginCompression(ZCODEC_GZ_LIB);
+ mpOStm->Seek( 0 );
+ aZCodec.Decompress( *mpOStm, *pDest );
+
+ if (aZCodec.EndCompression() && pDest )
+ {
+ pDest->Seek( STREAM_SEEK_TO_END );
+ sal_uIntPtr nStreamLen_ = pDest->Tell();
+ if (nStreamLen_)
+ {
+ pDest->Seek(0L);
+ GraphicFilter::GetGraphicFilter()->ImportGraphic( aGraphic, String(), *pDest ,nFormat,&pDeterminedFormat );
+ }
+ }
+ delete pDest;
+ }
+ }
+ }
+
+ maGrfObj = aGraphic;
+ if( maGrfObj.GetType() != GRAPHIC_NONE )
+ {
+ delete mpOStm, mpOStm = NULL;
+ delete mpTmp, mpTmp = NULL;
+ }
+ }
+
+ return maGrfObj;
+}
+
+// ----------------------
+// - SvXMLGraphicHelper -
+// ----------------------
+
+SvXMLGraphicHelper::SvXMLGraphicHelper( SvXMLGraphicHelperMode eCreateMode ) :
+ ::cppu::WeakComponentImplHelper2< ::com::sun::star::document::XGraphicObjectResolver,
+ ::com::sun::star::document::XBinaryStreamResolver >( maMutex )
+{
+ Init( NULL, eCreateMode, sal_False );
+}
+
+SvXMLGraphicHelper::SvXMLGraphicHelper() :
+ ::cppu::WeakComponentImplHelper2< ::com::sun::star::document::XGraphicObjectResolver,
+ ::com::sun::star::document::XBinaryStreamResolver >( maMutex )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+SvXMLGraphicHelper::~SvXMLGraphicHelper()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SvXMLGraphicHelper::disposing()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SvXMLGraphicHelper::ImplGetStreamNames( const ::rtl::OUString& rURLStr,
+ ::rtl::OUString& rPictureStorageName,
+ ::rtl::OUString& rPictureStreamName )
+{
+ String aURLStr( rURLStr );
+ sal_Bool bRet = sal_False;
+
+ if( aURLStr.Len() )
+ {
+ aURLStr = aURLStr.GetToken( aURLStr.GetTokenCount( ':' ) - 1, ':' );
+ const sal_uInt32 nTokenCount = aURLStr.GetTokenCount( '/' );
+
+ if( 1 == nTokenCount )
+ {
+ rPictureStorageName = String( RTL_CONSTASCII_USTRINGPARAM( XML_GRAPHICSTORAGE_NAME ) );
+ rPictureStreamName = aURLStr;
+ bRet = sal_True;
+ }
+ else if( 2 == nTokenCount )
+ {
+ rPictureStorageName = aURLStr.GetToken( 0, '/' );
+
+ DBG_ASSERT( rPictureStorageName.getLength() &&
+ rPictureStorageName.getStr()[ 0 ] != '#',
+ "invalid relative URL" );
+
+ rPictureStreamName = aURLStr.GetToken( 1, '/' );
+ bRet = sal_True;
+ }
+ else
+ {
+ DBG_ERROR( "SvXMLGraphicHelper::ImplInsertGraphicURL: invalid scheme" );
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+uno::Reference < embed::XStorage > SvXMLGraphicHelper::ImplGetGraphicStorage( const ::rtl::OUString& rStorageName )
+{
+ uno::Reference < embed::XStorage > xRetStorage;
+ if( mxRootStorage.is() )
+ {
+ try
+ {
+ xRetStorage = mxRootStorage->openStorageElement(
+ maCurStorageName = rStorageName,
+ ( GRAPHICHELPER_MODE_WRITE == meCreateMode )
+ ? embed::ElementModes::READWRITE
+ : embed::ElementModes::READ );
+ }
+ catch ( uno::Exception& )
+ {
+ }
+ //#i43196# try again to open the storage element - this time readonly
+ if(!xRetStorage.is())
+ {
+ try
+ {
+ xRetStorage = mxRootStorage->openStorageElement( maCurStorageName = rStorageName, embed::ElementModes::READ );
+ }
+ catch ( uno::Exception& )
+ {
+ }
+ }
+ }
+
+ return xRetStorage;
+}
+
+// -----------------------------------------------------------------------------
+
+SvxGraphicHelperStream_Impl SvXMLGraphicHelper::ImplGetGraphicStream( const ::rtl::OUString& rPictureStorageName,
+ const ::rtl::OUString& rPictureStreamName,
+ sal_Bool bTruncate )
+{
+ SvxGraphicHelperStream_Impl aRet;
+ aRet.xStorage = ImplGetGraphicStorage( rPictureStorageName );
+
+ if( aRet.xStorage.is() )
+ {
+ sal_Int32 nMode = embed::ElementModes::READ;
+ if ( GRAPHICHELPER_MODE_WRITE == meCreateMode )
+ {
+ nMode = embed::ElementModes::READWRITE;
+ if ( bTruncate )
+ nMode |= embed::ElementModes::TRUNCATE;
+ }
+
+ aRet.xStream = aRet.xStorage->openStreamElement( rPictureStreamName, nMode );
+ if( aRet.xStream.is() && ( GRAPHICHELPER_MODE_WRITE == meCreateMode ) )
+ {
+//REMOVE ::rtl::OUString aPropName( RTL_CONSTASCII_USTRINGPARAM("Encrypted") );
+ ::rtl::OUString aPropName( RTL_CONSTASCII_USTRINGPARAM("UseCommonStoragePasswordEncryption") );
+ uno::Reference < beans::XPropertySet > xProps( aRet.xStream, uno::UNO_QUERY );
+ xProps->setPropertyValue( aPropName, uno::makeAny( sal_True) );
+ }
+ }
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+String SvXMLGraphicHelper::ImplGetGraphicMimeType( const String& rFileName ) const
+{
+ struct XMLGraphicMimeTypeMapper
+ {
+ const char* pExt;
+ const char* pMimeType;
+ };
+
+ static XMLGraphicMimeTypeMapper aMapper[] =
+ {
+ { "gif", "image/gif" },
+ { "png", "image/png" },
+ { "jpg", "image/jpeg" },
+ { "tif", "image/tiff" }
+ };
+
+ String aMimeType;
+
+ if( ( rFileName.Len() >= 4 ) && ( rFileName.GetChar( rFileName.Len() - 4 ) == '.' ) )
+ {
+ const ByteString aExt( rFileName.Copy( rFileName.Len() - 3 ), RTL_TEXTENCODING_ASCII_US );
+
+ for( long i = 0, nCount = sizeof( aMapper ) / sizeof( aMapper[ 0 ] ); ( i < nCount ) && !aMimeType.Len(); i++ )
+ if( aExt == aMapper[ i ].pExt )
+ aMimeType = String( aMapper[ i ].pMimeType, RTL_TEXTENCODING_ASCII_US );
+ }
+
+ return aMimeType;
+}
+
+// -----------------------------------------------------------------------------
+
+Graphic SvXMLGraphicHelper::ImplReadGraphic( const ::rtl::OUString& rPictureStorageName,
+ const ::rtl::OUString& rPictureStreamName )
+{
+ Graphic aGraphic;
+ SvxGraphicHelperStream_Impl aStream( ImplGetGraphicStream( rPictureStorageName, rPictureStreamName, sal_False ) );
+ if( aStream.xStream.is() )
+ {
+ SvStream* pStream = utl::UcbStreamHelper::CreateStream( aStream.xStream );
+ GraphicFilter::GetGraphicFilter()->ImportGraphic( aGraphic, String(), *pStream );
+ delete pStream;
+ }
+
+ return aGraphic;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SvXMLGraphicHelper::ImplWriteGraphic( const ::rtl::OUString& rPictureStorageName,
+ const ::rtl::OUString& rPictureStreamName,
+ const ::rtl::OUString& rGraphicId )
+{
+ String aGraphicId( rGraphicId );
+ GraphicObject aGrfObject( ByteString( aGraphicId, RTL_TEXTENCODING_ASCII_US ) );
+ sal_Bool bRet = sal_False;
+
+ if( aGrfObject.GetType() != GRAPHIC_NONE )
+ {
+ SvxGraphicHelperStream_Impl aStream( ImplGetGraphicStream( rPictureStorageName, rPictureStreamName, sal_False ) );
+ if( aStream.xStream.is() )
+ {
+ Graphic aGraphic( (Graphic&) aGrfObject.GetGraphic() );
+ const GfxLink aGfxLink( aGraphic.GetLink() );
+ const ::rtl::OUString aMimeType( ImplGetGraphicMimeType( rPictureStreamName ) );
+ uno::Any aAny;
+ uno::Reference < beans::XPropertySet > xProps( aStream.xStream, uno::UNO_QUERY );
+
+ // set stream properties (MediaType/Compression)
+ if( aMimeType.getLength() )
+ {
+ aAny <<= aMimeType;
+ xProps->setPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ), aAny );
+ }
+
+ const sal_Bool bCompressed = ( ( 0 == aMimeType.getLength() ) || ( aMimeType == ::rtl::OUString::createFromAscii( "image/tiff" ) ) );
+ aAny <<= bCompressed;
+ xProps->setPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "Compressed" ) ), aAny );
+
+ SvStream* pStream = utl::UcbStreamHelper::CreateStream( aStream.xStream );
+ if( aGfxLink.GetDataSize() && aGfxLink.GetData() )
+ pStream->Write( aGfxLink.GetData(), aGfxLink.GetDataSize() );
+ else
+ {
+ if( aGraphic.GetType() == GRAPHIC_BITMAP )
+ {
+ GraphicFilter* pFilter = GraphicFilter::GetGraphicFilter();
+ String aFormat;
+
+ if( aGraphic.IsAnimated() )
+ aFormat = String( RTL_CONSTASCII_USTRINGPARAM( "gif" ) );
+ else
+ aFormat = String( RTL_CONSTASCII_USTRINGPARAM( "png" ) );
+
+ bRet = ( pFilter->ExportGraphic( aGraphic, String(), *pStream,
+ pFilter->GetExportFormatNumberForShortName( aFormat ) ) == 0 );
+ }
+ else if( aGraphic.GetType() == GRAPHIC_GDIMETAFILE )
+ {
+ pStream->SetVersion( SOFFICE_FILEFORMAT_8 );
+ pStream->SetCompressMode( COMPRESSMODE_ZBITMAP );
+
+ // 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() );
+ const MetaCommentAction* pComment = ImplCheckForEPS( rMtf );
+ if ( pComment )
+ {
+ sal_uInt32 nSize = pComment->GetDataSize();
+ const sal_uInt8* pData = pComment->GetData();
+ if ( nSize && pData )
+ pStream->Write( pData, nSize );
+
+ const MetaEPSAction* pAct = ( (const MetaEPSAction*)rMtf.FirstAction() );
+ const GfxLink& rLink = pAct->GetLink();
+
+ pStream->Write( rLink.GetData(), rLink.GetDataSize() );
+ }
+ else
+ rMtf.Write( *pStream );
+
+ bRet = ( pStream->GetError() == 0 );
+ }
+ }
+ uno::Reference < embed::XTransactedObject > xStorage(
+ aStream.xStorage, uno::UNO_QUERY);
+ delete pStream;
+ aStream.xStream->getOutputStream()->closeOutput();
+ if( xStorage.is() )
+ xStorage->commit();
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void SvXMLGraphicHelper::ImplInsertGraphicURL( const ::rtl::OUString& rURLStr, sal_uInt32 nInsertPos, rtl::OUString& rRequestedFileName )
+{
+ rtl::OUString aURLString( rURLStr );
+ ::rtl::OUString aPictureStorageName, aPictureStreamName;
+ if( ( maURLSet.find( aURLString ) != maURLSet.end() ) )
+ {
+ URLPairVector::iterator aIter( maGrfURLs.begin() ), aEnd( maGrfURLs.end() );
+ while( aIter != aEnd )
+ {
+ if( aURLString == (*aIter).first )
+ {
+ maGrfURLs[ nInsertPos ].second = (*aIter).second;
+ aIter = aEnd;
+ }
+ else
+ aIter++;
+ }
+ }
+ else if( ImplGetStreamNames( aURLString, aPictureStorageName, aPictureStreamName ) )
+ {
+ URLPair& rURLPair = maGrfURLs[ nInsertPos ];
+
+ if( GRAPHICHELPER_MODE_READ == meCreateMode )
+ {
+ const GraphicObject aObj( ImplReadGraphic( aPictureStorageName, aPictureStreamName ) );
+
+ if( aObj.GetType() != GRAPHIC_NONE )
+ {
+ const static ::rtl::OUString aBaseURL( RTL_CONSTASCII_USTRINGPARAM( XML_GRAPHICOBJECT_URL_BASE ) );
+
+ maGrfObjs.push_back( aObj );
+ rURLPair.second = aBaseURL;
+ rURLPair.second += String( aObj.GetUniqueID().GetBuffer(), RTL_TEXTENCODING_ASCII_US );
+ }
+ else
+ rURLPair.second = String();
+ }
+ else
+ {
+ const String aGraphicObjectId( aPictureStreamName );
+ const ByteString aAsciiObjectID( aGraphicObjectId, RTL_TEXTENCODING_ASCII_US );
+ const GraphicObject aGrfObject( aAsciiObjectID );
+ if( aGrfObject.GetType() != GRAPHIC_NONE )
+ {
+ 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 ): 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:
+ aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".grf" ) );
+ break;
+ }
+ }
+ else
+ {
+ if( aGrfObject.GetType() == GRAPHIC_BITMAP )
+ {
+ if( aGrfObject.IsAnimated() )
+ aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".gif" ) );
+ else
+ 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 ) )
+ aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".eps" ) );
+ else
+ 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 = sPictures;
+ rURLPair.second += aStreamName;
+ }
+#if OSL_DEBUG_LEVEL > 0
+ else
+ {
+ ByteString sMessage = "graphic object with ID '";
+ sMessage += aAsciiObjectID;
+ sMessage += "' has an unknown type";
+ OSL_ENSURE( false, sMessage.GetBuffer() );
+ }
+#endif
+ }
+
+ maURLSet.insert( aURLString );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SvXMLGraphicHelper::Init( const uno::Reference < embed::XStorage >& rXMLStorage,
+ SvXMLGraphicHelperMode eCreateMode,
+ sal_Bool bDirect )
+{
+ mxRootStorage = rXMLStorage;
+ meCreateMode = eCreateMode;
+ mbDirect = ( ( GRAPHICHELPER_MODE_READ == meCreateMode ) ? bDirect : sal_True );
+}
+
+// -----------------------------------------------------------------------------
+
+SvXMLGraphicHelper* SvXMLGraphicHelper::Create( const uno::Reference < embed::XStorage >& rXMLStorage,
+ SvXMLGraphicHelperMode eCreateMode,
+ sal_Bool bDirect )
+{
+ SvXMLGraphicHelper* pThis = new SvXMLGraphicHelper;
+
+ pThis->acquire();
+ pThis->Init( rXMLStorage, eCreateMode, bDirect );
+
+ return pThis;
+}
+
+// -----------------------------------------------------------------------------
+
+SvXMLGraphicHelper* SvXMLGraphicHelper::Create( SvXMLGraphicHelperMode eCreateMode )
+{
+ SvXMLGraphicHelper* pThis = new SvXMLGraphicHelper;
+
+ pThis->acquire();
+ pThis->Init( NULL, eCreateMode, sal_False );
+
+ return pThis;
+}
+
+// -----------------------------------------------------------------------------
+
+void SvXMLGraphicHelper::Destroy( SvXMLGraphicHelper* pSvXMLGraphicHelper )
+{
+ if( pSvXMLGraphicHelper )
+ {
+ pSvXMLGraphicHelper->dispose();
+ pSvXMLGraphicHelper->release();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+// XGraphicObjectResolver
+::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, aRequestedFileName );
+
+ return maGrfURLs[ nIndex ].second;
+}
+
+// -----------------------------------------------------------------------------
+
+// XBinaryStreamResolver
+Reference< XInputStream > SAL_CALL SvXMLGraphicHelper::getInputStream( const ::rtl::OUString& rURL )
+ throw( RuntimeException )
+{
+ Reference< XInputStream > xRet;
+ ::rtl::OUString aPictureStorageName, aGraphicId;
+
+
+ if( ( GRAPHICHELPER_MODE_WRITE == meCreateMode ) &&
+ ImplGetStreamNames( rURL, aPictureStorageName, aGraphicId ) )
+ {
+ SvXMLGraphicInputStream* pInputStream = new SvXMLGraphicInputStream( aGraphicId );
+
+ if( pInputStream->Exists() )
+ xRet = pInputStream;
+ else
+ delete pInputStream;
+ }
+
+ return xRet;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XOutputStream > SAL_CALL SvXMLGraphicHelper::createOutputStream()
+ throw( RuntimeException )
+{
+ Reference< XOutputStream > xRet;
+
+ if( GRAPHICHELPER_MODE_READ == meCreateMode )
+ {
+ SvXMLGraphicOutputStream* pOutputStream = new SvXMLGraphicOutputStream;
+
+ if( pOutputStream->Exists() )
+ maGrfStms.push_back( xRet = pOutputStream );
+ else
+ delete pOutputStream;
+ }
+
+ return xRet;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL SvXMLGraphicHelper::resolveOutputStream( const Reference< XOutputStream >& rxBinaryStream )
+ throw( RuntimeException )
+{
+ ::rtl::OUString aRet;
+
+ if( ( GRAPHICHELPER_MODE_READ == meCreateMode ) && rxBinaryStream.is() )
+ {
+ if( ::std::find( maGrfStms.begin(), maGrfStms.end(), rxBinaryStream ) != maGrfStms.end() )
+ {
+ SvXMLGraphicOutputStream* pOStm = static_cast< SvXMLGraphicOutputStream* >( rxBinaryStream.get() );
+
+ if( pOStm )
+ {
+ const GraphicObject& rGrfObj = pOStm->GetGraphicObject();
+ const ::rtl::OUString aId( ::rtl::OUString::createFromAscii( rGrfObj.GetUniqueID().GetBuffer() ) );
+
+ if( aId.getLength() )
+ {
+ aRet = ::rtl::OUString::createFromAscii( XML_GRAPHICOBJECT_URL_BASE );
+ aRet += aId;
+ }
+ }
+ }
+ }
+
+ return aRet;
+}
+
+
+// --------------------------------------------------------------------------------
+
+// for instantiation via service manager
+namespace svx
+{
+
+namespace impl
+{
+typedef ::cppu::WeakComponentImplHelper4<
+ lang::XInitialization,
+ document::XGraphicObjectResolver,
+ document::XBinaryStreamResolver,
+ lang::XServiceInfo >
+ SvXMLGraphicImportExportHelper_Base;
+class MutexContainer
+{
+public:
+ virtual ~MutexContainer();
+
+protected:
+ mutable ::osl::Mutex m_aMutex;
+};
+MutexContainer::~MutexContainer()
+{}
+} // namespace impl
+
+class SvXMLGraphicImportExportHelper :
+ public impl::MutexContainer,
+ public impl::SvXMLGraphicImportExportHelper_Base
+{
+public:
+ SvXMLGraphicImportExportHelper( SvXMLGraphicHelperMode eMode );
+
+protected:
+ // is called from WeakComponentImplHelper when XComponent::dispose() was
+ // called from outside
+ virtual void SAL_CALL disposing();
+
+ // ____ XInitialization ____
+ // one argument is allowed, which is the XStorage
+ virtual void SAL_CALL initialize( const Sequence< Any >& aArguments )
+ throw (Exception,
+ RuntimeException);
+
+ // ____ XGraphicObjectResolver ____
+ virtual ::rtl::OUString SAL_CALL resolveGraphicObjectURL( const ::rtl::OUString& aURL )
+ throw (RuntimeException);
+
+ // ____ XBinaryStreamResolver ____
+ virtual Reference< io::XInputStream > SAL_CALL getInputStream( const ::rtl::OUString& aURL )
+ throw (RuntimeException);
+ virtual Reference< io::XOutputStream > SAL_CALL createOutputStream()
+ throw (RuntimeException);
+ virtual ::rtl::OUString SAL_CALL resolveOutputStream( const Reference< io::XOutputStream >& aBinaryStream )
+ throw (RuntimeException);
+
+ // ____ XServiceInfo ____
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (RuntimeException);
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
+ throw (RuntimeException);
+ virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
+ throw (RuntimeException);
+
+private:
+ SvXMLGraphicHelperMode m_eGraphicHelperMode;
+ Reference< XGraphicObjectResolver > m_xGraphicObjectResolver;
+ Reference< XBinaryStreamResolver > m_xBinaryStreamResolver;
+};
+
+SvXMLGraphicImportExportHelper::SvXMLGraphicImportExportHelper( SvXMLGraphicHelperMode eMode ) :
+ impl::SvXMLGraphicImportExportHelper_Base( m_aMutex ),
+ m_eGraphicHelperMode( eMode )
+{}
+
+void SAL_CALL SvXMLGraphicImportExportHelper::disposing()
+{
+ Reference< XComponent > xComp( m_xGraphicObjectResolver, UNO_QUERY );
+ OSL_ASSERT( xComp.is());
+ if( xComp.is())
+ xComp->dispose();
+ // m_xBinaryStreamResolver is a reference to the same object => don't call
+ // dispose() again
+}
+
+// ____ XInitialization ____
+void SAL_CALL SvXMLGraphicImportExportHelper::initialize(
+ const Sequence< Any >& aArguments )
+ throw (Exception, RuntimeException)
+{
+ Reference< embed::XStorage > xStorage;
+ if( aArguments.getLength() > 0 )
+ aArguments[0] >>= xStorage;
+
+ SvXMLGraphicHelper * pHelper( SvXMLGraphicHelper::Create( xStorage, m_eGraphicHelperMode ));
+ m_xGraphicObjectResolver.set( pHelper );
+ m_xBinaryStreamResolver.set( pHelper );
+ // SvXMLGraphicHelper::Create calls acquire. Since we have two references
+ // now it is safe (and necessary) to undo this acquire
+ pHelper->release();
+}
+
+// ____ XGraphicObjectResolver ____
+::rtl::OUString SAL_CALL SvXMLGraphicImportExportHelper::resolveGraphicObjectURL( const ::rtl::OUString& aURL )
+ throw (uno::RuntimeException)
+{
+ return m_xGraphicObjectResolver->resolveGraphicObjectURL( aURL );
+}
+
+
+// ____ XBinaryStreamResolver ____
+Reference< io::XInputStream > SAL_CALL SvXMLGraphicImportExportHelper::getInputStream( const ::rtl::OUString& aURL )
+ throw (uno::RuntimeException)
+{
+ return m_xBinaryStreamResolver->getInputStream( aURL );
+}
+Reference< io::XOutputStream > SAL_CALL SvXMLGraphicImportExportHelper::createOutputStream()
+ throw (uno::RuntimeException)
+{
+ return m_xBinaryStreamResolver->createOutputStream();
+}
+::rtl::OUString SAL_CALL SvXMLGraphicImportExportHelper::resolveOutputStream( const Reference< io::XOutputStream >& aBinaryStream )
+ throw (uno::RuntimeException)
+{
+ return m_xBinaryStreamResolver->resolveOutputStream( aBinaryStream );
+}
+
+// ____ XServiceInfo ____
+::rtl::OUString SAL_CALL SvXMLGraphicImportExportHelper::getImplementationName()
+ throw (uno::RuntimeException)
+{
+ if( m_eGraphicHelperMode == GRAPHICHELPER_MODE_READ )
+ return SvXMLGraphicImportHelper_getImplementationName();
+ return SvXMLGraphicExportHelper_getImplementationName();
+}
+::sal_Bool SAL_CALL SvXMLGraphicImportExportHelper::supportsService( const ::rtl::OUString& ServiceName )
+ throw (uno::RuntimeException)
+{
+ Sequence< ::rtl::OUString > aServiceNames( getSupportedServiceNames());
+ const ::rtl::OUString * pBegin = aServiceNames.getConstArray();
+ const ::rtl::OUString * pEnd = pBegin + aServiceNames.getLength();
+ return (::std::find( pBegin, pEnd, ServiceName ) != pEnd);
+}
+Sequence< ::rtl::OUString > SAL_CALL SvXMLGraphicImportExportHelper::getSupportedServiceNames()
+ throw (uno::RuntimeException)
+{
+ if( m_eGraphicHelperMode == GRAPHICHELPER_MODE_READ )
+ return SvXMLGraphicImportHelper_getSupportedServiceNames();
+ return SvXMLGraphicExportHelper_getSupportedServiceNames();
+}
+
+// import
+Reference< XInterface > SAL_CALL SvXMLGraphicImportHelper_createInstance(const Reference< XMultiServiceFactory > & /* rSMgr */ )
+ throw( Exception )
+{
+ return static_cast< XWeak* >( new SvXMLGraphicImportExportHelper( GRAPHICHELPER_MODE_READ ));
+}
+::rtl::OUString SAL_CALL SvXMLGraphicImportHelper_getImplementationName()
+ throw()
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Svx.GraphicImportHelper" ));
+}
+Sequence< ::rtl::OUString > SAL_CALL SvXMLGraphicImportHelper_getSupportedServiceNames()
+ throw()
+{
+ // XGraphicObjectResolver and XBinaryStreamResolver are not part of any service
+ Sequence< ::rtl::OUString > aSupportedServiceNames( 2 );
+ aSupportedServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.GraphicObjectResolver" ) );
+ aSupportedServiceNames[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.BinaryStreamResolver" ) );
+ return aSupportedServiceNames;
+}
+
+// export
+Reference< XInterface > SAL_CALL SvXMLGraphicExportHelper_createInstance(const Reference< XMultiServiceFactory > & /* rSMgr */ )
+ throw( Exception )
+{
+ return static_cast< XWeak* >( new SvXMLGraphicImportExportHelper( GRAPHICHELPER_MODE_WRITE ));
+}
+::rtl::OUString SAL_CALL SvXMLGraphicExportHelper_getImplementationName()
+ throw()
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Svx.GraphicExportHelper" ));
+}
+Sequence< ::rtl::OUString > SAL_CALL SvXMLGraphicExportHelper_getSupportedServiceNames()
+ throw()
+{
+ // XGraphicObjectResolver and XBinaryStreamResolver are not part of any service
+ Sequence< ::rtl::OUString > aSupportedServiceNames( 2 );
+ aSupportedServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.GraphicObjectResolver" ) );
+ aSupportedServiceNames[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.BinaryStreamResolver" ) );
+ return aSupportedServiceNames;
+}
+
+} // namespace svx
+
diff --git a/svx/source/xml/xmlxtexp.cxx b/svx/source/xml/xmlxtexp.cxx
new file mode 100644
index 000000000000..4441e22dbcc0
--- /dev/null
+++ b/svx/source/xml/xmlxtexp.cxx
@@ -0,0 +1,492 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <tools/debug.hxx>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/drawing/LineDash.hpp>
+#include <com/sun/star/awt/Gradient.hpp>
+#include <com/sun/star/drawing/Hatch.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <sfx2/docfile.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include "xmloff/nmspmap.hxx"
+
+#include "xmloff/xmltoken.hxx"
+#include "xmloff/xmlmetae.hxx"
+#include "xmloff/DashStyle.hxx"
+#include "xmloff/GradientStyle.hxx"
+#include "xmloff/HatchStyle.hxx"
+#include "xmloff/ImageStyle.hxx"
+#include "xmloff/MarkerStyle.hxx"
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/embed/XTransactedObject.hpp>
+#include <comphelper/processfactory.hxx>
+#include <unotools/streamwrap.hxx>
+#include "svx/xmlgrhlp.hxx"
+
+#include "xmlxtexp.hxx"
+
+#include <comphelper/storagehelper.hxx>
+
+using namespace com::sun::star;
+using namespace com::sun::star::container;
+using namespace com::sun::star::document;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::awt;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::xml::sax;
+using namespace ::xmloff::token;
+using namespace ::rtl;
+using namespace cppu;
+
+using com::sun::star::embed::XTransactedObject;
+
+class SvxXMLTableEntryExporter
+{
+public:
+ SvxXMLTableEntryExporter( SvXMLExport& rExport ) : mrExport( rExport ) {}
+ virtual ~SvxXMLTableEntryExporter();
+
+ virtual void exportEntry( const OUString& rStrName, const Any& rValue ) = 0;
+
+protected:
+ SvXMLExport& mrExport;
+};
+
+class SvxXMLColorEntryExporter : public SvxXMLTableEntryExporter
+{
+public:
+ SvxXMLColorEntryExporter( SvXMLExport& rExport );
+ virtual ~SvxXMLColorEntryExporter();
+
+ virtual void exportEntry( const OUString& rStrName, const Any& rValue );
+};
+
+class SvxXMLLineEndEntryExporter : public SvxXMLTableEntryExporter
+{
+public:
+ SvxXMLLineEndEntryExporter( SvXMLExport& rExport );
+ SvxXMLLineEndEntryExporter();
+ virtual ~SvxXMLLineEndEntryExporter();
+
+ virtual void exportEntry( const OUString& rStrName, const Any& rValue );
+private:
+ XMLMarkerStyleExport maMarkerStyle;
+};
+
+class SvxXMLDashEntryExporter : public SvxXMLTableEntryExporter
+{
+public:
+ SvxXMLDashEntryExporter( SvXMLExport& rExport );
+ virtual ~SvxXMLDashEntryExporter();
+
+ virtual void exportEntry( const OUString& rStrName, const Any& rValue );
+
+private:
+ XMLDashStyleExport maDashStyle;
+};
+
+class SvxXMLHatchEntryExporter : public SvxXMLTableEntryExporter
+{
+public:
+ SvxXMLHatchEntryExporter( SvXMLExport& rExport );
+ virtual ~SvxXMLHatchEntryExporter();
+
+ virtual void exportEntry( const OUString& rStrName, const Any& rValue );
+private:
+ XMLHatchStyleExport maHatchStyle;
+};
+
+class SvxXMLGradientEntryExporter : public SvxXMLTableEntryExporter
+{
+public:
+ SvxXMLGradientEntryExporter( SvXMLExport& rExport );
+ virtual ~SvxXMLGradientEntryExporter();
+
+ virtual void exportEntry( const OUString& rStrName, const Any& rValue );
+private:
+ XMLGradientStyleExport maGradientStyle;
+};
+
+class SvxXMLBitmapEntryExporter : public SvxXMLTableEntryExporter
+{
+public:
+ SvxXMLBitmapEntryExporter( SvXMLExport& rExport );
+ virtual ~SvxXMLBitmapEntryExporter();
+
+ virtual void exportEntry( const OUString& rStrName, const Any& rValue );
+
+private:
+ XMLImageStyle maImageStyle;
+};
+
+///////////////////////////////////////////////////////////////////////
+
+// #110680#
+SvxXMLXTableExportComponent::SvxXMLXTableExportComponent(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
+ const OUString& rFileName,
+ const uno::Reference<xml::sax::XDocumentHandler> & rHandler,
+ const uno::Reference<container::XNameContainer >& xTable,
+ uno::Reference<document::XGraphicObjectResolver >& xGrfResolver )
+: SvXMLExport( xServiceFactory, rFileName, rHandler, NULL, MAP_100TH_MM),
+ mxTable( xTable )
+{
+
+ _GetNamespaceMap().Add( GetXMLToken(XML_NP_OOO), GetXMLToken(XML_N_OOO), XML_NAMESPACE_OOO );
+ _GetNamespaceMap().Add( GetXMLToken(XML_NP_OFFICE), GetXMLToken(XML_N_OFFICE), XML_NAMESPACE_OFFICE );
+ _GetNamespaceMap().Add( GetXMLToken(XML_NP_DRAW), GetXMLToken(XML_N_DRAW), XML_NAMESPACE_DRAW );
+ _GetNamespaceMap().Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK );
+ _GetNamespaceMap().Add( GetXMLToken(XML_NP_SVG), GetXMLToken(XML_N_SVG), XML_NAMESPACE_SVG );
+ SetGraphicResolver( xGrfResolver );
+ setExportFlags( 0 );
+}
+
+SvxXMLXTableExportComponent::~SvxXMLXTableExportComponent()
+{
+}
+
+sal_Bool SvxXMLXTableExportComponent::save( const OUString& rURL, const uno::Reference<container::XNameContainer >& xTable ) throw()
+{
+ uno::Reference < embed::XStorage > xStorage;
+ SfxMedium* pMedium = NULL;
+ sal_Bool bRet = sal_False;
+
+ uno::Reference< XGraphicObjectResolver > xGrfResolver;
+ SvXMLGraphicHelper* pGraphicHelper = 0;
+
+ try
+ {
+ do
+ {
+ uno::Reference < io::XOutputStream > xOut;
+ uno::Reference < io::XStream > xStream;
+
+ sal_Bool bNeedStorage = xTable->getElementType() == ::getCppuType((const OUString*)0);
+
+ uno::Reference< lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() );
+ if( !xServiceFactory.is() )
+ {
+ DBG_ERROR( "got no service manager" );
+ return sal_False;
+ }
+
+ uno::Reference< uno::XInterface > xWriter( xServiceFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" ) ) ) );
+ if( !xWriter.is() )
+ {
+ DBG_ERROR( "com.sun.star.xml.sax.Writer service missing" );
+ return sal_False;
+ }
+
+ uno::Reference<xml::sax::XDocumentHandler> xHandler( xWriter, uno::UNO_QUERY );
+
+ if( bNeedStorage )
+ {
+ xStorage =
+ ::comphelper::OStorageHelper::GetStorageFromURL( rURL, embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE );
+
+ if( !xStorage.is() )
+ {
+ DBG_ERROR( "no storage!" );
+ break;
+ }
+
+ OUString sMetaName( RTL_CONSTASCII_USTRINGPARAM( "Content.xml" ) );
+ xStream = xStorage->openStreamElement( sMetaName, embed::ElementModes::WRITE );
+ pGraphicHelper = SvXMLGraphicHelper::Create( xStorage, GRAPHICHELPER_MODE_WRITE );
+ xGrfResolver = pGraphicHelper;
+ xOut = xStream->getOutputStream();
+ }
+ else
+ {
+ pMedium = new SfxMedium( rURL, STREAM_WRITE | STREAM_TRUNC, sal_True );
+ pMedium->IsRemote();
+
+ SvStream* pStream = pMedium->GetOutStream();
+ if( NULL == pStream )
+ {
+ DBG_ERROR( "no output stream!" );
+ break;
+ }
+
+ xOut = new utl::OOutputStreamWrapper( *pStream );
+ }
+
+ uno::Reference<io::XActiveDataSource> xMetaSrc( xWriter, uno::UNO_QUERY );
+ xMetaSrc->setOutputStream( xOut );
+
+ const OUString aName;
+
+ // #110680#
+ // SvxXMLXTableExportComponent aExporter( aName, xHandler, xTable, xGrfResolver );
+ SvxXMLXTableExportComponent aExporter( xServiceFactory, aName, xHandler, xTable, xGrfResolver );
+
+ bRet = aExporter.exportTable();
+
+ }
+ while( 0 );
+
+ if( pGraphicHelper )
+ SvXMLGraphicHelper::Destroy( pGraphicHelper );
+
+ if( xStorage.is() )
+ {
+ uno::Reference< XTransactedObject > xTrans( xStorage, UNO_QUERY );
+ if( xTrans.is() )
+ xTrans->commit();
+
+ uno::Reference< XComponent > xComp( xStorage, UNO_QUERY );
+ if( xComp.is() )
+ xStorage->dispose();
+ }
+ }
+ catch( uno::Exception& )
+ {
+ bRet = sal_False;
+ }
+
+ if( pMedium )
+ {
+ pMedium->Commit();
+ delete pMedium;
+ }
+
+ return bRet;
+}
+
+sal_Bool SvxXMLXTableExportComponent::exportTable() throw()
+{
+ sal_Bool bRet = sal_False;
+
+ try
+ {
+ GetDocHandler()->startDocument();
+
+ // export namespaces
+ sal_uInt16 nPos = GetNamespaceMap().GetFirstKey();
+ while( USHRT_MAX != nPos )
+ {
+ GetAttrList().AddAttribute( GetNamespaceMap().GetAttrNameByKey( nPos ), GetNamespaceMap().GetNameByKey( nPos ) );
+ nPos = GetNamespaceMap().GetNextKey( nPos );
+ }
+
+ do
+ {
+ if( !mxTable.is() )
+ break;
+
+ char const* pEleName;
+ Type aExportType = mxTable->getElementType();
+ SvxXMLTableEntryExporter* pExporter = NULL;
+
+ if( aExportType == ::getCppuType((const sal_Int32*)0) )
+ {
+ pExporter = new SvxXMLColorEntryExporter(*this);
+ pEleName = "color-table";
+ }
+ else if( aExportType == ::getCppuType((const drawing::PolyPolygonBezierCoords*)0) )
+ {
+ pExporter = new SvxXMLLineEndEntryExporter(*this);
+ pEleName = "marker-table";
+ }
+ else if( aExportType == ::getCppuType((const drawing::LineDash*)0) )
+ {
+ pExporter = new SvxXMLDashEntryExporter(*this);
+ pEleName = "dash-table";
+ }
+ else if( aExportType == ::getCppuType((const drawing::Hatch*)0) )
+ {
+ pExporter = new SvxXMLHatchEntryExporter(*this);
+ pEleName = "hatch-table";
+ }
+ else if( aExportType == ::getCppuType((const awt::Gradient*)0))
+ {
+ pExporter = new SvxXMLGradientEntryExporter(*this);
+ pEleName = "gradient-table";
+ }
+ else if( aExportType == ::getCppuType((const OUString*)0))
+ {
+ pExporter = new SvxXMLBitmapEntryExporter(*this);
+ pEleName = "bitmap-table";
+ }
+ else
+ {
+ DBG_ERROR( "unknown type for export");
+ break;
+ }
+
+ SvXMLElementExport aElem( *this, XML_NAMESPACE_OOO, pEleName, sal_True, sal_True );
+
+ Sequence< OUString > aNames = mxTable->getElementNames();
+ const sal_Int32 nCount = aNames.getLength();
+ const OUString* pNames = aNames.getConstArray();
+ Any aAny;
+
+ sal_Int32 nIndex;
+ for( nIndex = 0; nIndex < nCount; nIndex++, pNames++ )
+ {
+ aAny = mxTable->getByName( *pNames );
+ pExporter->exportEntry( *pNames, aAny );
+ }
+
+ bRet = sal_True;
+ }
+ while(0);
+
+ GetDocHandler()->endDocument();
+ }
+ catch( Exception e )
+ {
+ bRet = sal_False;
+ }
+
+ return bRet;
+}
+
+// methods without content:
+void SvxXMLXTableExportComponent::_ExportAutoStyles() {}
+void SvxXMLXTableExportComponent::_ExportMasterStyles() {}
+void SvxXMLXTableExportComponent::_ExportContent() {}
+
+///////////////////////////////////////////////////////////////////////
+
+SvxXMLTableEntryExporter::~SvxXMLTableEntryExporter()
+{
+}
+
+///////////////////////////////////////////////////////////////////////
+
+SvxXMLColorEntryExporter::SvxXMLColorEntryExporter( SvXMLExport& rExport )
+: SvxXMLTableEntryExporter( rExport )
+{
+}
+
+SvxXMLColorEntryExporter::~SvxXMLColorEntryExporter()
+{
+}
+
+void SvxXMLColorEntryExporter::exportEntry( const OUString& rStrName, const Any& rValue )
+{
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, rStrName );
+
+ sal_Int32 nColor = 0;
+ rValue >>= nColor;
+
+ OUStringBuffer aOut;
+ mrExport.GetMM100UnitConverter().convertColor( aOut, nColor );
+ mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_COLOR, aOut.makeStringAndClear() );
+
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, XML_COLOR, sal_True, sal_True );
+}
+
+///////////////////////////////////////////////////////////////////////
+
+SvxXMLLineEndEntryExporter::SvxXMLLineEndEntryExporter( SvXMLExport& rExport )
+: SvxXMLTableEntryExporter( rExport ), maMarkerStyle( rExport )
+{
+}
+
+SvxXMLLineEndEntryExporter::~SvxXMLLineEndEntryExporter()
+{
+}
+
+void SvxXMLLineEndEntryExporter::exportEntry( const OUString& rStrName, const Any& rValue )
+{
+ maMarkerStyle.exportXML( rStrName, rValue );
+}
+
+///////////////////////////////////////////////////////////////////////
+
+SvxXMLDashEntryExporter::SvxXMLDashEntryExporter( SvXMLExport& rExport )
+: SvxXMLTableEntryExporter( rExport ), maDashStyle( rExport )
+{
+}
+
+SvxXMLDashEntryExporter::~SvxXMLDashEntryExporter()
+{
+}
+
+void SvxXMLDashEntryExporter::exportEntry( const OUString& rStrName, const Any& rValue )
+{
+ maDashStyle.exportXML( rStrName, rValue );
+}
+
+///////////////////////////////////////////////////////////////////////
+
+SvxXMLHatchEntryExporter::SvxXMLHatchEntryExporter( SvXMLExport& rExport )
+: SvxXMLTableEntryExporter( rExport ), maHatchStyle( rExport )
+{
+}
+
+SvxXMLHatchEntryExporter::~SvxXMLHatchEntryExporter()
+{
+}
+
+void SvxXMLHatchEntryExporter::exportEntry( const OUString& rStrName, const Any& rValue )
+{
+ maHatchStyle.exportXML( rStrName, rValue );
+}
+
+///////////////////////////////////////////////////////////////////////
+
+SvxXMLGradientEntryExporter::SvxXMLGradientEntryExporter( SvXMLExport& rExport )
+: SvxXMLTableEntryExporter( rExport ), maGradientStyle( rExport )
+{
+}
+
+SvxXMLGradientEntryExporter::~SvxXMLGradientEntryExporter()
+{
+}
+
+void SvxXMLGradientEntryExporter::exportEntry( const OUString& rStrName, const Any& rValue )
+{
+ maGradientStyle.exportXML( rStrName, rValue );
+}
+
+///////////////////////////////////////////////////////////////////////
+
+SvxXMLBitmapEntryExporter::SvxXMLBitmapEntryExporter( SvXMLExport& rExport )
+: SvxXMLTableEntryExporter( rExport )
+{
+}
+
+SvxXMLBitmapEntryExporter::~SvxXMLBitmapEntryExporter()
+{
+}
+
+void SvxXMLBitmapEntryExporter::exportEntry( const OUString& rStrName, const Any& rValue )
+{
+ maImageStyle.exportXML( rStrName, rValue, mrExport );
+}
diff --git a/svx/source/xml/xmlxtimp.cxx b/svx/source/xml/xmlxtimp.cxx
new file mode 100644
index 000000000000..b9cd5443f259
--- /dev/null
+++ b/svx/source/xml/xmlxtimp.cxx
@@ -0,0 +1,488 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <tools/debug.hxx>
+#include <com/sun/star/document/XGraphicObjectResolver.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/io/XActiveDataControl.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/drawing/LineDash.hpp>
+#include <com/sun/star/awt/Gradient.hpp>
+#include <com/sun/star/drawing/Hatch.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#ifndef _COM_SUN_STAR_IO_XSEEKABLE_HDL_
+#include <com/sun/star/io/XSeekable.hdl>
+#endif
+#include <comphelper/processfactory.hxx>
+#include <unotools/streamwrap.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <sfx2/docfile.hxx>
+#include <xmloff/xmluconv.hxx>
+#include "xmloff/xmlnmspe.hxx"
+#include "xmloff/nmspmap.hxx"
+
+#include "xmloff/xmltoken.hxx"
+#include "xmloff/xmlmetae.hxx"
+#include "xmloff/DashStyle.hxx"
+#include "xmloff/GradientStyle.hxx"
+#include "xmloff/HatchStyle.hxx"
+#include "xmloff/ImageStyle.hxx"
+#include "xmloff/MarkerStyle.hxx"
+#include <xmloff/xmlictxt.hxx>
+#include "svx/xmlgrhlp.hxx"
+#include "xmloff/attrlist.hxx"
+
+#include "xmlxtimp.hxx"
+
+using namespace com::sun::star;
+using namespace com::sun::star::container;
+using namespace com::sun::star::document;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::awt;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::xml::sax;
+using namespace ::rtl;
+using namespace ::xmloff::token;
+using namespace cppu;
+
+sal_Char __READONLY_DATA sXML_np__office[] = "__office";
+sal_Char __READONLY_DATA sXML_np__office_ooo[] = "___office";
+sal_Char __READONLY_DATA sXML_np__draw[] = "__draw";
+sal_Char __READONLY_DATA sXML_np__draw_ooo[] = "___draw";
+sal_Char __READONLY_DATA sXML_np__ooo[] = "__ooo";
+sal_Char __READONLY_DATA sXML_np__xlink[] = "__xlink";
+
+///////////////////////////////////////////////////////////////////////
+
+enum SvxXMLTableImportContextEnum { stice_unknown, stice_color, stice_marker, stice_dash, stice_hatch, stice_gradient, stice_bitmap };
+
+///////////////////////////////////////////////////////////////////////
+
+class SvxXMLTableImportContext : public SvXMLImportContext
+{
+public:
+ SvxXMLTableImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const uno::Reference< XAttributeList >& xAttrList, SvxXMLTableImportContextEnum eContext, const uno::Reference< XNameContainer >& xTable,
+ sal_Bool bOOoFormat );
+ virtual ~SvxXMLTableImportContext();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList );
+
+ SvxXMLXTableImport& getImport() const { return *(SvxXMLXTableImport*)&GetImport(); }
+
+protected:
+ void importColor( sal_uInt16 nPrfx, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList, Any& rAny, OUString& rName );
+ void importMarker( sal_uInt16 nPrfx, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList, Any& rAny, OUString& rName );
+ void importDash( sal_uInt16 nPrfx, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList, Any& rAny, OUString& rName );
+ void importHatch( sal_uInt16 nPrfx, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList, Any& rAny, OUString& rName );
+ void importGradient( sal_uInt16 nPrfx, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList, Any& rAny, OUString& rName );
+ void importBitmap( sal_uInt16 nPrfx, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList, Any& rAny, OUString& rName );
+
+private:
+ uno::Reference< XNameContainer > mxTable;
+ SvxXMLTableImportContextEnum meContext;
+ sal_Bool mbOOoFormat;
+};
+
+///////////////////////////////////////////////////////////////////////
+
+SvxXMLTableImportContext::SvxXMLTableImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const uno::Reference< XAttributeList >&, SvxXMLTableImportContextEnum eContext, const uno::Reference< XNameContainer >& xTable, sal_Bool bOOoFormat )
+: SvXMLImportContext( rImport, nPrfx, rLName ), mxTable( xTable ), meContext( eContext ),
+ mbOOoFormat( bOOoFormat )
+{
+}
+
+SvxXMLTableImportContext::~SvxXMLTableImportContext()
+{
+}
+
+SvXMLImportContext *SvxXMLTableImportContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< XAttributeList >& rAttrList )
+{
+ if( XML_NAMESPACE_DRAW == nPrefix )
+ {
+ uno::Reference< XAttributeList > xAttrList( rAttrList );
+ if( mbOOoFormat &&
+ (stice_dash == meContext || stice_hatch == meContext ||
+ stice_bitmap == meContext) )
+ {
+ SvXMLAttributeList *pAttrList = new SvXMLAttributeList( rAttrList );
+ xAttrList = pAttrList;
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix_ =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ if( XML_NAMESPACE_XLINK == nPrefix_ &&
+ stice_bitmap == meContext &&
+ IsXMLToken( aLocalName, XML_HREF ) )
+ {
+ const OUString rValue = xAttrList->getValueByIndex( i );
+ if( rValue.getLength() && '#' == rValue[0] )
+ pAttrList->SetValueByIndex( i, rValue.copy( 1 ) );
+ }
+ else if( XML_NAMESPACE_DRAW == nPrefix_ &&
+ ( ( stice_dash == meContext &&
+ (IsXMLToken( aLocalName, XML_DOTS1_LENGTH ) ||
+ IsXMLToken( aLocalName, XML_DOTS2_LENGTH ) ||
+ IsXMLToken( aLocalName, XML_DISTANCE )) ) ||
+ ( stice_hatch == meContext &&
+ IsXMLToken( aLocalName, XML_HATCH_DISTANCE ) ) ) )
+ {
+ const OUString rValue = xAttrList->getValueByIndex( i );
+ sal_Int32 nPos = rValue.getLength();
+ while( nPos && rValue[nPos-1] <= ' ' )
+ --nPos;
+ if( nPos > 2 &&
+ ('c'==rValue[nPos-2] || 'C'==rValue[nPos-2]) &&
+ ('h'==rValue[nPos-1] || 'H'==rValue[nPos-1]) )
+ {
+ pAttrList->SetValueByIndex( i, rValue.copy( 0, nPos-2 ) );
+ }
+ }
+ }
+ }
+ try
+ {
+ Any aAny;
+ OUString aName;
+
+ switch( meContext )
+ {
+ case stice_color:
+ importColor( nPrefix, rLocalName, xAttrList, aAny, aName );
+ break;
+ case stice_marker:
+ importMarker( nPrefix, rLocalName, xAttrList, aAny, aName );
+ break;
+ case stice_dash:
+ importDash( nPrefix, rLocalName, xAttrList, aAny, aName );
+ break;
+ case stice_hatch:
+ importHatch( nPrefix, rLocalName, xAttrList, aAny, aName );
+ break;
+ case stice_gradient:
+ importGradient( nPrefix, rLocalName, xAttrList, aAny, aName );
+ break;
+ case stice_bitmap:
+ importBitmap( nPrefix, rLocalName, xAttrList, aAny, aName );
+ break;
+ case stice_unknown:
+ break;
+ }
+
+ if( aName.getLength() && aAny.hasValue() )
+ {
+ if( mxTable->hasByName( aName ) )
+ {
+ mxTable->replaceByName( aName, aAny );
+ }
+ else
+ {
+ mxTable->insertByName( aName, aAny );
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+
+ return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+}
+
+void SvxXMLTableImportContext::importColor( sal_uInt16 nPrfx, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList, Any& rAny, OUString& rName )
+{
+ (void)nPrfx;
+ (void)rLocalName;
+
+ const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rFullAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( rFullAttrName, &aLocalName );
+
+
+ if( XML_NAMESPACE_DRAW == nPrefix )
+ {
+ if( aLocalName == GetXMLToken(XML_NAME) )
+ {
+ rName = xAttrList->getValueByIndex( i );
+ }
+ else if( aLocalName == GetXMLToken(XML_COLOR) )
+ {
+ Color aColor;
+ SvXMLUnitConverter::convertColor(aColor, xAttrList->getValueByIndex( i ));
+ rAny <<= (sal_Int32)aColor.GetColor();
+ }
+ }
+ }
+}
+
+void SvxXMLTableImportContext::importMarker( sal_uInt16 nPrfx, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList, Any& rAny, OUString& rName )
+{
+ (void)nPrfx;
+ (void)rLocalName;
+
+ try
+ {
+ XMLMarkerStyleImport aMarkerStyle( GetImport() );
+ aMarkerStyle.importXML( xAttrList, rAny, rName );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("SvxXMLTableImportContext::importMarker(), exception caught!");
+ }
+}
+
+void SvxXMLTableImportContext::importDash( sal_uInt16 nPrfx, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList, Any& rAny, OUString& rName )
+{
+ (void)nPrfx;
+ (void)rLocalName;
+
+ try
+ {
+ XMLDashStyleImport aDashStyle( GetImport() );
+ aDashStyle.importXML( xAttrList, rAny, rName );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("SvxXMLTableImportContext::importDash(), exception caught!");
+ }
+}
+
+void SvxXMLTableImportContext::importHatch( sal_uInt16 nPrfx, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList, Any& rAny, OUString& rName )
+{
+ (void)nPrfx;
+ (void)rLocalName;
+
+ try
+ {
+ XMLHatchStyleImport aHatchStyle( GetImport() );
+ aHatchStyle.importXML( xAttrList, rAny, rName );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("SvxXMLTableImportContext::importHatch(), exception caught!");
+ }
+}
+
+void SvxXMLTableImportContext::importGradient( sal_uInt16 nPrfx, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList, Any& rAny, OUString& rName )
+{
+ (void)nPrfx;
+ (void)rLocalName;
+
+ try
+ {
+ XMLGradientStyleImport aGradientStyle( GetImport() );
+ aGradientStyle.importXML( xAttrList, rAny, rName );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("SvxXMLTableImportContext::importGradient(), exception caught!");
+ }
+}
+
+void SvxXMLTableImportContext::importBitmap( sal_uInt16 nPrfx, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList, Any& rAny, OUString& rName )
+{
+ (void)nPrfx;
+ (void)rLocalName;
+
+ try
+ {
+ XMLImageStyle aImageStyle;
+ aImageStyle.importXML( xAttrList, rAny, rName, GetImport() );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR("SvxXMLTableImportContext::importBitmap(), exception caught!");
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+
+// #110680#
+SvxXMLXTableImport::SvxXMLXTableImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
+ const uno::Reference< XNameContainer > & rTable,
+ uno::Reference< XGraphicObjectResolver >& xGrfResolver )
+: SvXMLImport(xServiceFactory, 0),
+ mrTable( rTable )
+{
+ SetGraphicResolver( xGrfResolver );
+
+ GetNamespaceMap().Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__ooo ) ), GetXMLToken(XML_N_OOO), XML_NAMESPACE_OOO );
+ GetNamespaceMap().Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__office ) ), GetXMLToken(XML_N_OFFICE), XML_NAMESPACE_OFFICE );
+ GetNamespaceMap().Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__draw ) ), GetXMLToken(XML_N_DRAW), XML_NAMESPACE_DRAW );
+ GetNamespaceMap().Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__xlink ) ), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK );
+
+ // OOo namespaces for reading OOo 1.1 files
+ GetNamespaceMap().Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__office_ooo ) ),
+ GetXMLToken(XML_N_OFFICE_OOO),
+ XML_NAMESPACE_OFFICE );
+ GetNamespaceMap().Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__draw_ooo ) ),
+ GetXMLToken(XML_N_DRAW_OOO),
+ XML_NAMESPACE_DRAW );
+}
+
+SvxXMLXTableImport::~SvxXMLXTableImport() throw ()
+{
+}
+
+sal_Bool SvxXMLXTableImport::load( const OUString& rUrl, const uno::Reference< XNameContainer >& xTable ) throw()
+{
+ sal_Bool bRet = sal_True;
+
+ uno::Reference< XGraphicObjectResolver > xGrfResolver;
+ SvXMLGraphicHelper* pGraphicHelper = 0;
+
+ try
+ {
+ do
+ {
+ SfxMedium aMedium( rUrl, STREAM_READ | STREAM_NOCREATE, sal_True );
+
+ uno::Reference<lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() );
+ if( !xServiceFactory.is() )
+ {
+ DBG_ERROR( "SvxXMLXTableImport::load: got no service manager" );
+ break;
+ }
+
+ uno::Reference< xml::sax::XParser > xParser( xServiceFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Parser" ) ) ), uno::UNO_QUERY_THROW );
+ uno::Reference < io::XStream > xIStm;
+ uno::Reference< io::XActiveDataSource > xSource;
+
+ xml::sax::InputSource aParserInput;
+ aParserInput.sSystemId = aMedium.GetName();
+
+ if( aMedium.IsStorage() )
+ {
+ uno::Reference < embed::XStorage > xStorage( aMedium.GetStorage( sal_False ), uno::UNO_QUERY_THROW );
+
+ const String aContentStmName( RTL_CONSTASCII_USTRINGPARAM( "Content.xml" ) );
+ xIStm.set( xStorage->openStreamElement( aContentStmName, embed::ElementModes::READ ), uno::UNO_QUERY_THROW );
+ if( !xIStm.is() )
+ {
+ DBG_ERROR( "could not open Content stream" );
+ break;
+ }
+
+ aParserInput.aInputStream = xIStm->getInputStream();
+ pGraphicHelper = SvXMLGraphicHelper::Create( xStorage, GRAPHICHELPER_MODE_READ );
+ xGrfResolver = pGraphicHelper;
+ }
+ else
+ {
+ aParserInput.aInputStream = aMedium.GetInputStream();
+ uno::Reference< io::XSeekable > xSeek( aParserInput.aInputStream, uno::UNO_QUERY_THROW );
+ xSeek->seek( 0 );
+ }
+
+ if( xSource.is() )
+ {
+ uno::Reference< io::XActiveDataControl > xSourceControl( xSource, UNO_QUERY_THROW );
+ xSourceControl->start();
+ }
+
+ // #110680#
+ // uno::Reference< XDocumentHandler > xHandler( new SvxXMLXTableImport( xTable, xGrfResolver ) );
+ uno::Reference< XDocumentHandler > xHandler( new SvxXMLXTableImport( xServiceFactory, xTable, xGrfResolver ) );
+
+ xParser->setDocumentHandler( xHandler );
+ xParser->parseStream( aParserInput );
+ }
+ while(0);
+
+ if( pGraphicHelper )
+ SvXMLGraphicHelper::Destroy( pGraphicHelper );
+ }
+ catch( uno::Exception& )
+ {
+// CL: I disabled this assertion since its an error, but it happens
+// each time you load a document with property tables that are not
+// on the current machine. Maybe a better fix would be to place
+// a file exists check before importing...
+// DBG_ERROR("svx::SvxXMLXTableImport::load(), exception caught!");
+ bRet = sal_False;
+ }
+
+ return bRet;
+}
+
+SvXMLImportContext *SvxXMLXTableImport::CreateContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< XAttributeList >& xAttrList )
+{
+ if( XML_NAMESPACE_OOO == nPrefix ||
+ XML_NAMESPACE_OFFICE == nPrefix )
+ {
+ sal_Bool bOOoFormat = (XML_NAMESPACE_OFFICE == nPrefix);
+ Type aType = mrTable->getElementType();
+
+ if( rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "color-table" ) ) )
+ {
+ if( aType == ::getCppuType((const sal_Int32*)0) )
+ return new SvxXMLTableImportContext( *this, nPrefix, rLocalName, xAttrList, stice_color, mrTable, bOOoFormat );
+ }
+ else if( rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "marker-table" ) ) )
+ {
+ if( aType == ::getCppuType((const drawing::PolyPolygonBezierCoords*)0) )
+ return new SvxXMLTableImportContext( *this, nPrefix, rLocalName, xAttrList, stice_marker, mrTable, bOOoFormat );
+ }
+ else if( rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "dash-table" ) ) )
+ {
+ if( aType == ::getCppuType((const drawing::LineDash*)0) )
+ return new SvxXMLTableImportContext( *this, nPrefix, rLocalName, xAttrList, stice_dash, mrTable, bOOoFormat );
+ }
+ else if( rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "hatch-table" ) ) )
+ {
+ if( aType == ::getCppuType((const drawing::Hatch*)0) )
+ return new SvxXMLTableImportContext( *this, nPrefix, rLocalName, xAttrList, stice_hatch, mrTable, bOOoFormat );
+ }
+ else if( rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "gradient-table" ) ) )
+ {
+ if( aType == ::getCppuType((const awt::Gradient*)0))
+ return new SvxXMLTableImportContext( *this, nPrefix, rLocalName, xAttrList, stice_gradient, mrTable, bOOoFormat );
+ }
+ else if( rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "bitmap-table" ) ) )
+ {
+ if( aType == ::getCppuType((const OUString*)0))
+ return new SvxXMLTableImportContext( *this, nPrefix, rLocalName, xAttrList, stice_bitmap, mrTable, bOOoFormat );
+ }
+ }
+
+ return new SvXMLImportContext( *this, nPrefix, rLocalName );
+}
+
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
new file mode 100644
index 000000000000..e8958bf82479
--- /dev/null
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -0,0 +1,768 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <sot/factory.hxx>
+#include <tools/urlobj.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <vcl/bmpacc.hxx>
+#include <tools/poly.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/wrkwin.hxx>
+#include <svl/solar.hrc>
+#include <sfx2/docfile.hxx>
+#include <sfx2/app.hxx>
+#include "svx/xoutbmp.hxx"
+#include <svtools/FilterConfigItem.hxx>
+#include <svtools/filter.hxx>
+
+// -----------
+// - Defines -
+// -----------
+
+#define FORMAT_BMP String(RTL_CONSTASCII_USTRINGPARAM("bmp"))
+#define FORMAT_GIF String(RTL_CONSTASCII_USTRINGPARAM("gif"))
+#define FORMAT_JPG String(RTL_CONSTASCII_USTRINGPARAM("jpg"))
+#define FORMAT_PNG String(RTL_CONSTASCII_USTRINGPARAM("png"))
+
+// --------------
+// - XOutBitmap -
+// --------------
+
+GraphicFilter* XOutBitmap::pGrfFilter = NULL;
+
+// -----------------------------------------------------------------------------
+
+BitmapEx XOutBitmap::CreateQuickDrawBitmapEx( const Graphic& rGraphic, const OutputDevice& rCompDev,
+ const MapMode& rMapMode, const Size& rLogSize,
+ const Point& rPoint, const Size& rSize )
+{
+ BitmapEx aRetBmp;
+
+ if( rGraphic.IsAlpha() )
+ aRetBmp = rGraphic.GetBitmapEx();
+ else
+ {
+ VirtualDevice aVDev( rCompDev );
+ MapMode aMap( rMapMode );
+
+ aMap.SetOrigin( Point() );
+ aVDev.SetMapMode( aMap );
+
+ Point aPoint( aVDev.LogicToPixel( rPoint ) );
+ Size aOldSize( aVDev.LogicToPixel( rSize ) );
+ Size aAbsSize( aOldSize );
+ Size aQSizePix( aVDev.LogicToPixel( rLogSize ) );
+
+ aVDev.SetMapMode( MapMode() );
+
+ if( aOldSize.Width() < 0 )
+ aAbsSize.Width() = -aAbsSize.Width();
+
+ if( aOldSize.Height() < 0 )
+ aAbsSize.Height() = -aAbsSize.Height();
+
+ if( aVDev.SetOutputSizePixel( aAbsSize ) )
+ {
+ Point aNewOrg( -aPoint.X(), -aPoint.Y() );
+ const Point aNullPoint;
+
+ // horizontale Spiegelung ggf. beruecksichtigen
+ if( aOldSize.Width() < 0 )
+ {
+ aNewOrg.X() -= aOldSize.Width();
+
+ // und jetzt noch einen abziehen
+ aNewOrg.X()--;
+ }
+
+ // vertikale Spiegelung ggf. beruecksichtigen
+ if( rSize.Height() < 0 )
+ {
+ aNewOrg.Y() -= aOldSize.Height();
+
+ // und jetzt noch einen abziehen
+ aNewOrg.Y()--;
+ }
+
+ if( rGraphic.GetType() != GRAPHIC_BITMAP )
+ {
+ rGraphic.Draw( &aVDev, aNewOrg, aQSizePix );
+
+ const Bitmap aBmp( aVDev.GetBitmap( aNullPoint, aAbsSize ) );
+ Bitmap aMask;
+
+ Graphic( rGraphic.GetGDIMetaFile().GetMonochromeMtf( COL_BLACK ) ).Draw( &aVDev, aNewOrg, aQSizePix );
+ aMask = aVDev.GetBitmap( aNullPoint, aAbsSize );
+ aRetBmp = BitmapEx( aBmp, aMask );
+ }
+ else
+ {
+ Bitmap aBmp( rGraphic.GetBitmap() );
+
+// UNX has got problems with 1x1 bitmaps which are transparent (KA 02.11.1998)
+#ifdef UNX
+ const Size aBmpSize( aBmp.GetSizePixel() );
+ sal_Bool bFullTrans = sal_False;
+
+ if( aBmpSize.Width() == 1 && aBmpSize.Height() == 1 && rGraphic.IsTransparent() )
+ {
+ Bitmap aTrans( rGraphic.GetBitmapEx().GetMask() );
+ BitmapReadAccess* pMAcc = aBmp.AcquireReadAccess();
+
+ if( pMAcc )
+ {
+ if( pMAcc->GetColor( 0, 0 ) == BitmapColor( Color( COL_WHITE ) ) )
+ bFullTrans = sal_True;
+
+ aTrans.ReleaseAccess( pMAcc );
+ }
+ }
+
+ if( !bFullTrans )
+#endif // UNX
+
+ {
+ DitherBitmap( aBmp );
+ aVDev.DrawBitmap( aNewOrg, aQSizePix, aBmp );
+ aBmp = aVDev.GetBitmap( aNullPoint, aAbsSize );
+
+ if( !rGraphic.IsTransparent() )
+ aRetBmp = BitmapEx( aBmp );
+ else
+ {
+ Bitmap aTrans( rGraphic.GetBitmapEx().GetMask() );
+
+ if( !aTrans )
+ aRetBmp = BitmapEx( aBmp, rGraphic.GetBitmapEx().GetTransparentColor() );
+ else
+ {
+ aVDev.DrawBitmap( aNewOrg, aQSizePix, aTrans );
+ aRetBmp = BitmapEx( aBmp, aVDev.GetBitmap( Point(), aAbsSize ) );
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return aRetBmp;
+}
+
+// ------------------------------------------------------------------------
+
+void XOutBitmap::DrawQuickDrawBitmapEx( OutputDevice* pOutDev, const Point& rPt,
+ const Size& rSize, const BitmapEx& rBmpEx )
+{
+ const Size aBmpSizePix( rBmpEx.GetSizePixel() );
+ const Size aSizePix( pOutDev->LogicToPixel( rSize ) );
+
+ if ( ( aSizePix.Width() - aBmpSizePix.Width() ) || ( aSizePix.Height() - aBmpSizePix.Height() ) )
+ rBmpEx.Draw( pOutDev, rPt, rSize );
+ else
+ rBmpEx.Draw( pOutDev, rPt );
+}
+
+// ------------------------------------------------------------------------
+
+void XOutBitmap::DrawTiledBitmapEx( OutputDevice* pOutDev,
+ const Point& rStartPt, const Size& rGrfSize,
+ const Rectangle& rTileRect, const BitmapEx& rBmpEx )
+{
+ Rectangle aClipRect( pOutDev->LogicToPixel( pOutDev->GetClipRegion().GetBoundRect() ) );
+ Rectangle aPixRect( pOutDev->LogicToPixel( rTileRect ) );
+ const Size aPixSize( pOutDev->LogicToPixel( rGrfSize ) );
+ const Point aPixPoint( pOutDev->LogicToPixel( rStartPt ) );
+ Point aOrg;
+ const long nWidth = aPixSize.Width();
+ const long nHeight = aPixSize.Height();
+ long nXPos = aPixPoint.X() + ( ( aPixRect.Left() - aPixPoint.X() ) / nWidth ) * nWidth;
+ long nYPos = aPixPoint.Y() + ( ( aPixRect.Top() - aPixPoint.Y() ) / nHeight ) * nHeight;
+ const long nBottom = aPixRect.Bottom();
+ const long nRight = aPixRect.Right();
+ const long nLeft = nXPos;
+ const sal_Bool bNoSize = ( aPixSize == rBmpEx.GetSizePixel() );
+
+ pOutDev->Push();
+ pOutDev->SetMapMode( MapMode() );
+
+ // ggf. neue ClipRegion berechnen und setzen
+ if ( pOutDev->IsClipRegion() )
+ aPixRect.Intersection( aClipRect );
+
+ pOutDev->SetClipRegion( aPixRect );
+
+ while( nYPos <= nBottom )
+ {
+ while( nXPos <= nRight )
+ {
+ if ( bNoSize )
+ rBmpEx.Draw( pOutDev, Point( nXPos, nYPos ) );
+ else
+ rBmpEx.Draw( pOutDev, Point( nXPos, nYPos ), aPixSize );
+
+ nXPos += nWidth;
+ }
+
+ nXPos = nLeft;
+ nYPos += nHeight;
+ }
+
+ pOutDev->Pop();
+}
+
+// ------------------------------------------------------------------------
+
+Animation XOutBitmap::MirrorAnimation( const Animation& rAnimation, sal_Bool bHMirr, sal_Bool bVMirr )
+{
+ Animation aNewAnim( rAnimation );
+
+ if( bHMirr || bVMirr )
+ {
+ const Size& rGlobalSize = aNewAnim.GetDisplaySizePixel();
+ sal_uIntPtr nMirrorFlags = 0L;
+
+ if( bHMirr )
+ nMirrorFlags |= BMP_MIRROR_HORZ;
+
+ if( bVMirr )
+ nMirrorFlags |= BMP_MIRROR_VERT;
+
+ for( sal_uInt16 i = 0, nCount = aNewAnim.Count(); i < nCount; i++ )
+ {
+ AnimationBitmap aAnimBmp( aNewAnim.Get( i ) );
+
+ // BitmapEx spiegeln
+ aAnimBmp.aBmpEx.Mirror( nMirrorFlags );
+
+ // Die Positionen innerhalb der Gesamtbitmap
+ // muessen natuerlich auch angepasst werden
+ if( bHMirr )
+ aAnimBmp.aPosPix.X() = rGlobalSize.Width() - aAnimBmp.aPosPix.X() -
+ aAnimBmp.aSizePix.Width();
+
+ if( bVMirr )
+ aAnimBmp.aPosPix.Y() = rGlobalSize.Height() - aAnimBmp.aPosPix.Y() -
+ aAnimBmp.aSizePix.Height();
+
+ aNewAnim.Replace( aAnimBmp, i );
+ }
+ }
+
+ return aNewAnim;
+}
+
+// ------------------------------------------------------------------------
+
+Graphic XOutBitmap::MirrorGraphic( const Graphic& rGraphic, const sal_uIntPtr nMirrorFlags )
+{
+ Graphic aRetGraphic;
+
+ if( nMirrorFlags )
+ {
+ if( rGraphic.IsAnimated() )
+ {
+ aRetGraphic = MirrorAnimation( rGraphic.GetAnimation(),
+ ( nMirrorFlags & BMP_MIRROR_HORZ ) == BMP_MIRROR_HORZ,
+ ( nMirrorFlags & BMP_MIRROR_VERT ) == BMP_MIRROR_VERT );
+ }
+ else
+ {
+ if( rGraphic.IsTransparent() )
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ aBmpEx.Mirror( nMirrorFlags );
+ aRetGraphic = aBmpEx;
+ }
+ else
+ {
+ Bitmap aBmp( rGraphic.GetBitmap() );
+
+ aBmp.Mirror( nMirrorFlags );
+ aRetGraphic = aBmp;
+ }
+ }
+ }
+ else
+ aRetGraphic = rGraphic;
+
+ return aRetGraphic;
+}
+
+// ------------------------------------------------------------------------
+
+sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, String& rFileName,
+ const String& rFilterName, const sal_uIntPtr nFlags,
+ const Size* pMtfSize_100TH_MM )
+{
+ if( rGraphic.GetType() != GRAPHIC_NONE )
+ {
+ INetURLObject aURL( rFileName );
+ Graphic aGraphic;
+ String aExt;
+ GraphicFilter* pFilter = GraphicFilter::GetGraphicFilter();
+ sal_uInt16 nErr = GRFILTER_FILTERERROR, nFilter = GRFILTER_FORMAT_NOTFOUND;
+ sal_Bool bTransparent = rGraphic.IsTransparent(), bAnimated = rGraphic.IsAnimated();
+
+ DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "XOutBitmap::WriteGraphic(...): invalid URL" );
+
+ // calculate correct file name
+ if( !( nFlags & XOUTBMP_DONT_EXPAND_FILENAME ) )
+ {
+ String aName( aURL.getBase() );
+ aName += '_';
+ aName += String(aURL.getExtension());
+ aName += '_';
+ String aStr( String::CreateFromInt32( rGraphic.GetChecksum(), 16 ) );
+ if ( aStr.GetChar(0) == '-' )
+ aStr.SetChar(0,'m');
+ aName += aStr;
+ aURL.setBase( aName );
+ }
+
+ if( ( nFlags & XOUTBMP_USE_NATIVE_IF_POSSIBLE ) &&
+ !( nFlags & XOUTBMP_MIRROR_HORZ ) &&
+ !( nFlags & XOUTBMP_MIRROR_VERT ) &&
+ ( rGraphic.GetType() != GRAPHIC_GDIMETAFILE ) && rGraphic.IsLink() )
+ {
+ // try to write native link
+ const GfxLink aGfxLink( ( (Graphic&) rGraphic ).GetLink() );
+
+ switch( aGfxLink.GetType() )
+ {
+ case( GFX_LINK_TYPE_NATIVE_GIF ): aExt = FORMAT_GIF; break;
+ case( GFX_LINK_TYPE_NATIVE_JPG ): aExt = FORMAT_JPG; break;
+ case( GFX_LINK_TYPE_NATIVE_PNG ): aExt = FORMAT_PNG; break;
+
+ default:
+ break;
+ }
+
+ if( aExt.Len() )
+ {
+ aURL.setExtension( aExt );
+ rFileName = aURL.GetMainURL( INetURLObject::NO_DECODE );
+
+ SfxMedium aMedium( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE | STREAM_SHARE_DENYNONE | STREAM_TRUNC, sal_True );
+ SvStream* pOStm = aMedium.GetOutStream();
+
+ if( pOStm && aGfxLink.GetDataSize() && aGfxLink.GetData() )
+ {
+ pOStm->Write( aGfxLink.GetData(), aGfxLink.GetDataSize() );
+ aMedium.Commit();
+
+ if( !aMedium.GetError() )
+ nErr = GRFILTER_OK;
+ }
+ }
+ }
+
+ if( GRFILTER_OK != nErr )
+ {
+ String aFilter( rFilterName );
+ sal_Bool bWriteTransGrf = ( aFilter.EqualsIgnoreCaseAscii( "transgrf" ) ) ||
+ ( aFilter.EqualsIgnoreCaseAscii( "gif" ) ) ||
+ ( nFlags & XOUTBMP_USE_GIF_IF_POSSIBLE ) ||
+ ( ( nFlags & XOUTBMP_USE_GIF_IF_SENSIBLE ) && ( bAnimated || bTransparent ) );
+
+ // get filter and extension
+ if( bWriteTransGrf )
+ aFilter = FORMAT_GIF;
+
+ nFilter = pFilter->GetExportFormatNumberForShortName( aFilter );
+
+ if( GRFILTER_FORMAT_NOTFOUND == nFilter )
+ {
+ nFilter = pFilter->GetExportFormatNumberForShortName( FORMAT_JPG );
+
+ if( GRFILTER_FORMAT_NOTFOUND == nFilter )
+ nFilter = pFilter->GetExportFormatNumberForShortName( FORMAT_BMP );
+ }
+
+ if( GRFILTER_FORMAT_NOTFOUND != nFilter )
+ {
+ aExt = pFilter->GetExportFormatShortName( nFilter ).ToLowerAscii();
+
+ if( bWriteTransGrf )
+ {
+ if( bAnimated )
+ aGraphic = rGraphic;
+ else
+ {
+ if( pMtfSize_100TH_MM && ( rGraphic.GetType() != GRAPHIC_BITMAP ) )
+ {
+ VirtualDevice aVDev;
+ const Size aSize( aVDev.LogicToPixel( *pMtfSize_100TH_MM, MAP_100TH_MM ) );
+
+ if( aVDev.SetOutputSizePixel( aSize ) )
+ {
+ const Wallpaper aWallpaper( aVDev.GetBackground() );
+ const Point aPt;
+
+ aVDev.SetBackground( Wallpaper( Color( COL_BLACK ) ) );
+ aVDev.Erase();
+ rGraphic.Draw( &aVDev, aPt, aSize );
+
+ const Bitmap aBitmap( aVDev.GetBitmap( aPt, aSize ) );
+
+ aVDev.SetBackground( aWallpaper );
+ aVDev.Erase();
+ rGraphic.Draw( &aVDev, aPt, aSize );
+
+ aVDev.SetRasterOp( ROP_XOR );
+ aVDev.DrawBitmap( aPt, aSize, aBitmap );
+ aGraphic = BitmapEx( aBitmap, aVDev.GetBitmap( aPt, aSize ) );
+ }
+ else
+ aGraphic = rGraphic.GetBitmapEx();
+ }
+ else
+ aGraphic = rGraphic.GetBitmapEx();
+ }
+ }
+ else
+ {
+ if( pMtfSize_100TH_MM && ( rGraphic.GetType() != GRAPHIC_BITMAP ) )
+ {
+ VirtualDevice aVDev;
+ const Size aSize( aVDev.LogicToPixel( *pMtfSize_100TH_MM, MAP_100TH_MM ) );
+
+ if( aVDev.SetOutputSizePixel( aSize ) )
+ {
+ rGraphic.Draw( &aVDev, Point(), aSize );
+ aGraphic = aVDev.GetBitmap( Point(), aSize );
+ }
+ else
+ aGraphic = rGraphic.GetBitmap();
+ }
+ else
+ aGraphic = rGraphic.GetBitmap();
+ }
+
+ // mirror?
+ if( ( nFlags & XOUTBMP_MIRROR_HORZ ) || ( nFlags & XOUTBMP_MIRROR_VERT ) )
+ aGraphic = MirrorGraphic( aGraphic, nFlags );
+
+ if( ( GRFILTER_FORMAT_NOTFOUND != nFilter ) && ( aGraphic.GetType() != GRAPHIC_NONE ) )
+ {
+ aURL.setExtension( aExt );
+ rFileName = aURL.GetMainURL( INetURLObject::NO_DECODE );
+ nErr = ExportGraphic( aGraphic, aURL, *pFilter, nFilter, NULL );
+ }
+ }
+ }
+
+ return nErr;
+ }
+ else
+ {
+ return GRFILTER_OK;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+#ifdef _MSC_VER
+#pragma optimize ( "", off )
+#endif
+
+sal_uInt16 XOutBitmap::ExportGraphic( const Graphic& rGraphic, const INetURLObject& rURL,
+ GraphicFilter& rFilter, const sal_uInt16 nFormat,
+ const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >* pFilterData )
+{
+ DBG_ASSERT( rURL.GetProtocol() != INET_PROT_NOT_VALID, "XOutBitmap::ExportGraphic(...): invalid URL" );
+
+ SfxMedium aMedium( rURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE | STREAM_SHARE_DENYNONE | STREAM_TRUNC, sal_True );
+ SvStream* pOStm = aMedium.GetOutStream();
+ sal_uInt16 nRet = GRFILTER_IOERROR;
+
+ if( pOStm )
+ {
+ pGrfFilter = &rFilter;
+
+ nRet = rFilter.ExportGraphic( rGraphic, rURL.GetMainURL( INetURLObject::NO_DECODE ), *pOStm, nFormat, pFilterData );
+
+ pGrfFilter = NULL;
+ aMedium.Commit();
+
+ if( aMedium.GetError() && ( GRFILTER_OK == nRet ) )
+ nRet = GRFILTER_IOERROR;
+ }
+
+ return nRet;
+}
+
+#ifdef _MSC_VER
+#pragma optimize ( "", on )
+#endif
+
+// ------------------------------------------------------------------------
+
+Bitmap XOutBitmap::DetectEdges( const Bitmap& rBmp, const sal_uInt8 cThreshold )
+{
+ const Size aSize( rBmp.GetSizePixel() );
+ Bitmap aRetBmp;
+ sal_Bool bRet = sal_False;
+
+ if( ( aSize.Width() > 2L ) && ( aSize.Height() > 2L ) )
+ {
+ Bitmap aWorkBmp( rBmp );
+
+ if( aWorkBmp.Convert( BMP_CONVERSION_8BIT_GREYS ) )
+ {
+ Bitmap aDstBmp( aSize, 1 );
+ BitmapReadAccess* pReadAcc = aWorkBmp.AcquireReadAccess();
+ BitmapWriteAccess* pWriteAcc = aDstBmp.AcquireWriteAccess();
+
+ if( pReadAcc && pWriteAcc )
+ {
+ const long nWidth = aSize.Width();
+ const long nWidth2 = nWidth - 2L;
+ const long nHeight = aSize.Height();
+ const long nHeight2 = nHeight - 2L;
+ const long lThres2 = (long) cThreshold * cThreshold;
+ const BitmapColor aWhite = (sal_uInt8) pWriteAcc->GetBestMatchingColor( Color( COL_WHITE ) );
+ const BitmapColor aBlack = (sal_uInt8) pWriteAcc->GetBestMatchingColor( Color( COL_BLACK ) );
+ long nSum1;
+ long nSum2;
+ long lGray;
+
+ // Rand mit Weiss init.
+ pWriteAcc->SetLineColor( Color( COL_WHITE) );
+ pWriteAcc->DrawLine( Point(), Point( nWidth - 1L, 0L ) );
+ pWriteAcc->DrawLine( Point( nWidth - 1L, 0L ), Point( nWidth - 1L, nHeight - 1L ) );
+ pWriteAcc->DrawLine( Point( nWidth - 1L, nHeight - 1L ), Point( 0L, nHeight - 1L ) );
+ pWriteAcc->DrawLine( Point( 0, nHeight - 1L ), Point() );
+
+ for( long nY = 0L, nY1 = 1L, nY2 = 2; nY < nHeight2; nY++, nY1++, nY2++ )
+ {
+ for( long nX = 0L, nXDst = 1L, nXTmp; nX < nWidth2; nX++, nXDst++ )
+ {
+ nXTmp = nX;
+
+ nSum1 = -( nSum2 = lGray = (sal_uInt8) pReadAcc->GetPixel( nY, nXTmp++ ) );
+ nSum2 += ( (long) (sal_uInt8) pReadAcc->GetPixel( nY, nXTmp++ ) ) << 1;
+ nSum1 += ( lGray = pReadAcc->GetPixel( nY, nXTmp ) );
+ nSum2 += lGray;
+
+ nSum1 += ( (long) (sal_uInt8) pReadAcc->GetPixel( nY1, nXTmp ) ) << 1;
+ nSum1 -= ( (long) (sal_uInt8) pReadAcc->GetPixel( nY1, nXTmp -= 2 ) ) << 1;
+
+ nSum1 += ( lGray = -(long) (sal_uInt8) pReadAcc->GetPixel( nY2, nXTmp++ ) );
+ nSum2 += lGray;
+ nSum2 -= ( (long) (sal_uInt8) pReadAcc->GetPixel( nY2, nXTmp++ ) ) << 1;
+ nSum1 += ( lGray = (long) (sal_uInt8) pReadAcc->GetPixel( nY2, nXTmp ) );
+ nSum2 -= lGray;
+
+ if( ( nSum1 * nSum1 + nSum2 * nSum2 ) < lThres2 )
+ pWriteAcc->SetPixel( nY1, nXDst, aWhite );
+ else
+ pWriteAcc->SetPixel( nY1, nXDst, aBlack );
+ }
+ }
+
+ bRet = sal_True;
+ }
+
+ aWorkBmp.ReleaseAccess( pReadAcc );
+ aDstBmp.ReleaseAccess( pWriteAcc );
+
+ if( bRet )
+ aRetBmp = aDstBmp;
+ }
+ }
+
+ if( !aRetBmp )
+ aRetBmp = rBmp;
+ else
+ {
+ aRetBmp.SetPrefMapMode( rBmp.GetPrefMapMode() );
+ aRetBmp.SetPrefSize( rBmp.GetPrefSize() );
+ }
+
+ return aRetBmp;
+};
+
+// ------------------------------------------------------------------------
+
+Polygon XOutBitmap::GetCountour( const Bitmap& rBmp, const sal_uIntPtr nFlags,
+ const sal_uInt8 cEdgeDetectThreshold, const Rectangle* pWorkRectPixel )
+{
+ Bitmap aWorkBmp;
+ Polygon aRetPoly;
+ Point aTmpPoint;
+ Rectangle aWorkRect( aTmpPoint, rBmp.GetSizePixel() );
+
+ if( pWorkRectPixel )
+ aWorkRect.Intersection( *pWorkRectPixel );
+
+ aWorkRect.Justify();
+
+ if( ( aWorkRect.GetWidth() > 4 ) && ( aWorkRect.GetHeight() > 4 ) )
+ {
+ // falls Flag gesetzt, muessen wir Kanten detektieren
+ if( nFlags & XOUTBMP_CONTOUR_EDGEDETECT )
+ aWorkBmp = DetectEdges( rBmp, cEdgeDetectThreshold );
+ else
+ aWorkBmp = rBmp;
+
+ BitmapReadAccess* pAcc = aWorkBmp.AcquireReadAccess();
+
+ if( pAcc )
+ {
+ const Size& rPrefSize = aWorkBmp.GetPrefSize();
+ const long nWidth = pAcc->Width();
+ const long nHeight = pAcc->Height();
+ const double fFactorX = (double) rPrefSize.Width() / nWidth;
+ const double fFactorY = (double) rPrefSize.Height() / nHeight;
+ const long nStartX1 = aWorkRect.Left() + 1L;
+ const long nEndX1 = aWorkRect.Right();
+ const long nStartX2 = nEndX1 - 1L;
+// const long nEndX2 = nStartX1 - 1L;
+ const long nStartY1 = aWorkRect.Top() + 1L;
+ const long nEndY1 = aWorkRect.Bottom();
+ const long nStartY2 = nEndY1 - 1L;
+// const long nEndY2 = nStartY1 - 1L;
+ Point* pPoints1 = NULL;
+ Point* pPoints2 = NULL;
+ long nX, nY;
+ sal_uInt16 nPolyPos = 0;
+ const BitmapColor aBlack = pAcc->GetBestMatchingColor( Color( COL_BLACK ) );
+
+ if( nFlags & XOUTBMP_CONTOUR_VERT )
+ {
+ pPoints1 = new Point[ nWidth ];
+ pPoints2 = new Point[ nWidth ];
+
+ for( nX = nStartX1; nX < nEndX1; nX++ )
+ {
+ nY = nStartY1;
+
+ // zunaechst Zeile von Links nach Rechts durchlaufen
+ while( nY < nEndY1 )
+ {
+ if( aBlack == pAcc->GetPixel( nY, nX ) )
+ {
+ pPoints1[ nPolyPos ] = Point( nX, nY );
+ nY = nStartY2;
+
+ // diese Schleife wird immer gebreaked da hier ja min. ein Pixel ist
+ while( sal_True )
+ {
+ if( aBlack == pAcc->GetPixel( nY, nX ) )
+ {
+ pPoints2[ nPolyPos ] = Point( nX, nY );
+ break;
+ }
+
+ nY--;
+ }
+
+ nPolyPos++;
+ break;
+ }
+
+ nY++;
+ }
+ }
+ }
+ else
+ {
+ pPoints1 = new Point[ nHeight ];
+ pPoints2 = new Point[ nHeight ];
+
+ for ( nY = nStartY1; nY < nEndY1; nY++ )
+ {
+ nX = nStartX1;
+
+ // zunaechst Zeile von Links nach Rechts durchlaufen
+ while( nX < nEndX1 )
+ {
+ if( aBlack == pAcc->GetPixel( nY, nX ) )
+ {
+ pPoints1[ nPolyPos ] = Point( nX, nY );
+ nX = nStartX2;
+
+ // diese Schleife wird immer gebreaked da hier ja min. ein Pixel ist
+ while( sal_True )
+ {
+ if( aBlack == pAcc->GetPixel( nY, nX ) )
+ {
+ pPoints2[ nPolyPos ] = Point( nX, nY );
+ break;
+ }
+
+ nX--;
+ }
+
+ nPolyPos++;
+ break;
+ }
+
+ nX++;
+ }
+ }
+ }
+
+ const sal_uInt16 nNewSize1 = nPolyPos << 1;
+
+ aRetPoly = Polygon( nPolyPos, pPoints1 );
+ aRetPoly.SetSize( nNewSize1 + 1 );
+ aRetPoly[ nNewSize1 ] = aRetPoly[ 0 ];
+
+ for( sal_uInt16 j = nPolyPos; nPolyPos < nNewSize1; )
+ aRetPoly[ nPolyPos++ ] = pPoints2[ --j ];
+
+ if( ( fFactorX != 0. ) && ( fFactorY != 0. ) )
+ aRetPoly.Scale( fFactorX, fFactorY );
+
+ delete[] pPoints1;
+ delete[] pPoints2;
+ }
+ }
+
+ return aRetPoly;
+};
+
+// ----------------
+// - DitherBitmap -
+// ----------------
+
+sal_Bool DitherBitmap( Bitmap& rBitmap )
+{
+ sal_Bool bRet = sal_False;
+
+ if( ( rBitmap.GetBitCount() >= 8 ) && ( Application::GetDefaultDevice()->GetColorCount() < 257 ) )
+ bRet = rBitmap.Dither( BMP_DITHER_FLOYD );
+ else
+ bRet = sal_False;
+
+ return bRet;
+}
diff --git a/svx/source/xoutdev/_xpoly.cxx b/svx/source/xoutdev/_xpoly.cxx
new file mode 100644
index 000000000000..3dd39fc10347
--- /dev/null
+++ b/svx/source/xoutdev/_xpoly.cxx
@@ -0,0 +1,2135 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <osl/endian.h>
+#include <tools/stream.hxx>
+#include <tools/debug.hxx>
+#include <tools/poly.hxx>
+
+#include <svx/xpoly.hxx>
+#include "xpolyimp.hxx"
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <vcl/salbtype.hxx> // FRound
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/numeric/ftools.hxx>
+
+#define GLOBALOVERFLOW
+
+DBG_NAME(XPolygon);
+DBG_NAME(XPolyPolygon);
+
+/*************************************************************************
+|*
+|* ImpXPolygon::ImpXPolygon()
+|*
+|* Beschreibung
+|* Ersterstellung 08.11.94
+|* Letzte Aenderung 12.01.95 ESO
+|*
+*************************************************************************/
+
+ImpXPolygon::ImpXPolygon( sal_uInt16 nInitSize, sal_uInt16 _nResize )
+{
+ pPointAry = NULL;
+ pFlagAry = NULL;
+ bDeleteOldPoints = sal_False;
+ nSize = 0;
+ nResize = _nResize;
+ nPoints = 0;
+ nRefCount = 1;
+
+ Resize( nInitSize );
+}
+
+/*************************************************************************
+|*
+|* ImpXPolygon::ImpXPolygon()
+|*
+|* Beschreibung
+|* Ersterstellung 08.11.94
+|* Letzte Aenderung 12.01.95 ESO
+|*
+*************************************************************************/
+
+ImpXPolygon::ImpXPolygon( const ImpXPolygon& rImpXPoly )
+{
+ ( (ImpXPolygon&) rImpXPoly ).CheckPointDelete();
+
+ pPointAry = NULL;
+ pFlagAry = NULL;
+ bDeleteOldPoints = sal_False;
+ nSize = 0;
+ ImpXPolygon::nResize = rImpXPoly.nResize;
+ nPoints = 0;
+ nRefCount = 1;
+
+ Resize( rImpXPoly.nSize );
+
+ // Kopieren
+ nPoints = rImpXPoly.nPoints;
+ memcpy( pPointAry, rImpXPoly.pPointAry, nSize*sizeof( Point ) );
+ memcpy( pFlagAry, rImpXPoly.pFlagAry, nSize );
+}
+
+/*************************************************************************
+|*
+|* ImpXPolygon::~ImpXPolygon()
+|*
+|* Beschreibung
+|* Ersterstellung 08.11.94
+|* Letzte Aenderung 12.01.95 ESO
+|*
+*************************************************************************/
+
+ImpXPolygon::~ImpXPolygon()
+{
+ delete[] (char*) pPointAry;
+ delete[] pFlagAry;
+ if ( bDeleteOldPoints )
+ delete[] (char*) pOldPointAry;
+}
+
+/*************************************************************************
+|*
+|* ImpXPolygon::operator==()
+|*
+|* Ersterstellung Joe 26-09-95
+|* Letzte Aenderung
+|*
+*************************************************************************/
+
+
+bool ImpXPolygon::operator==(const ImpXPolygon& rImpXPoly) const
+{
+ return nPoints==rImpXPoly.nPoints &&
+ (nPoints==0 ||
+ (memcmp(pPointAry,rImpXPoly.pPointAry,nPoints*sizeof(Point))==0 &&
+ memcmp(pFlagAry,rImpXPoly.pFlagAry,nPoints)==0));
+}
+
+/*************************************************************************
+|*
+|* ImpXPolygon::Resize()
+|*
+|* !!! Polygongroesse aendern - wenn bDeletePoints sal_False, dann den
+|* Point-Array nicht loeschen, sondern in pOldPointAry sichern und
+|* das Flag bDeleteOldPoints setzen. Beim naechsten Zugriff wird
+|* das Array dann geloescht.
+|* Damit wird verhindert, dass bei XPoly[n] = XPoly[0] durch ein
+|* Resize der fuer den rechten Ausdruck verwendete Point-Array
+|* vorzeitig geloescht wird.
+|* Ersterstellung 08.11.94
+|* Letzte Aenderung 12.01.95 ESO
+|*
+*************************************************************************/
+
+void ImpXPolygon::Resize( sal_uInt16 nNewSize, sal_Bool bDeletePoints )
+{
+ if( nNewSize == nSize )
+ return;
+
+ sal_uInt8* pOldFlagAry = pFlagAry;
+ sal_uInt16 nOldSize = nSize;
+
+ CheckPointDelete();
+ pOldPointAry = pPointAry;
+
+ // Neue Groesse auf vielfaches von nResize runden, sofern Objekt
+ // nicht neu angelegt wurde (nSize != 0)
+ if ( nSize != 0 && nNewSize > nSize )
+ {
+ DBG_ASSERT(nResize, "Resize-Versuch trotz nResize = 0 !");
+ nNewSize = nSize + ((nNewSize-nSize-1) / nResize + 1) * nResize;
+ }
+ // Punkt Array erzeugen
+ nSize = nNewSize;
+ pPointAry = (Point*)new char[ nSize*sizeof( Point ) ];
+ memset( pPointAry, 0, nSize*sizeof( Point ) );
+
+ // Flag Array erzeugen
+ pFlagAry = new sal_uInt8[ nSize ];
+ memset( pFlagAry, 0, nSize );
+
+ // Eventuell umkopieren
+ if( nOldSize )
+ {
+ if( nOldSize < nSize )
+ {
+ memcpy( pPointAry, pOldPointAry, nOldSize*sizeof( Point ) );
+ memcpy( pFlagAry, pOldFlagAry, nOldSize );
+ }
+ else
+ {
+ memcpy( pPointAry, pOldPointAry, nSize*sizeof( Point ) );
+ memcpy( pFlagAry, pOldFlagAry, nSize );
+
+ // Anzahl der gueltigen Punkte anpassen
+ if( nPoints > nSize )
+ nPoints = nSize;
+ }
+ if ( bDeletePoints ) delete[] (char*) pOldPointAry;
+ else bDeleteOldPoints = sal_True;
+ delete[] pOldFlagAry;
+ }
+}
+
+
+/*************************************************************************
+|*
+|* ImpXPolygon::InsertSpace()
+|*
+|* Beschreibung
+|* Ersterstellung 08.11.94
+|* Letzte Aenderung 29.03.95 ESO
+|*
+*************************************************************************/
+
+void ImpXPolygon::InsertSpace( sal_uInt16 nPos, sal_uInt16 nCount )
+{
+ CheckPointDelete();
+
+ if ( nPos > nPoints )
+ nPos = nPoints;
+
+ // Wenn Polygon zu klein dann groesser machen
+ if( (nPoints + nCount) > nSize )
+ Resize( nPoints + nCount );
+
+ // Wenn nicht hinter dem letzten Punkt eingefuegt wurde,
+ // den Rest nach hinten schieben
+ if( nPos < nPoints )
+ {
+ sal_uInt16 nMove = nPoints - nPos;
+ memmove( &pPointAry[nPos+nCount], &pPointAry[nPos],
+ nMove * sizeof(Point) );
+ memmove( &pFlagAry[nPos+nCount], &pFlagAry[nPos], nMove );
+ }
+ memset( &pPointAry[nPos], 0, nCount * sizeof( Point ) );
+ memset( &pFlagAry [nPos], 0, nCount );
+
+ nPoints = nPoints + nCount;
+}
+
+
+/*************************************************************************
+|*
+|* ImpXPolygon::Remove()
+|*
+|* Beschreibung
+|* Ersterstellung 08.11.94
+|* Letzte Aenderung 12.01.94 ESO
+|*
+*************************************************************************/
+
+void ImpXPolygon::Remove( sal_uInt16 nPos, sal_uInt16 nCount )
+{
+ CheckPointDelete();
+
+ if( (nPos + nCount) <= nPoints )
+ {
+ sal_uInt16 nMove = nPoints - nPos - nCount;
+
+ if( nMove )
+ {
+ memmove( &pPointAry[nPos], &pPointAry[nPos+nCount],
+ nMove * sizeof(Point) );
+ memmove( &pFlagAry[nPos], &pFlagAry[nPos+nCount], nMove );
+ }
+ memset( &pPointAry[nPoints - nCount], 0, nCount * sizeof( Point ) );
+ memset( &pFlagAry [nPoints - nCount], 0, nCount );
+ nPoints = nPoints - nCount;
+ }
+}
+
+
+/*************************************************************************
+|*
+|* XPolygon::XPolygon()
+|*
+|* Beschreibung
+|* Ersterstellung 08.11.94
+|* Letzte Aenderung 08.11.94
+|*
+*************************************************************************/
+
+XPolygon::XPolygon( sal_uInt16 nSize, sal_uInt16 nResize )
+{
+ DBG_CTOR(XPolygon,NULL);
+ pImpXPolygon = new ImpXPolygon( nSize, nResize );
+}
+
+/*************************************************************************
+|*
+|* XPolygon::XPolygon()
+|*
+|* Beschreibung
+|* Ersterstellung 08.11.94
+|* Letzte Aenderung 08.11.94
+|*
+*************************************************************************/
+
+XPolygon::XPolygon( const XPolygon& rXPoly )
+{
+ DBG_CTOR(XPolygon,NULL);
+ pImpXPolygon = rXPoly.pImpXPolygon;
+ pImpXPolygon->nRefCount++;
+}
+
+/*************************************************************************
+|*
+|* XPolygon::XPolygon()
+|*
+|* XPolygon aus einem Standardpolygon erstellen
+|* Ersterstellung 18.01.95 ESO
+|* Letzte Aenderung 18.01.95 ESO
+|*
+*************************************************************************/
+
+XPolygon::XPolygon( const Polygon& rPoly )
+{
+ DBG_CTOR(XPolygon,NULL);
+
+ sal_uInt16 nSize = rPoly.GetSize();
+ pImpXPolygon = new ImpXPolygon( nSize );
+ pImpXPolygon->nPoints = nSize;
+
+ for( sal_uInt16 i = 0; i < nSize; i++ )
+ {
+ pImpXPolygon->pPointAry[i] = rPoly[i];
+ pImpXPolygon->pFlagAry[i] = (sal_uInt8) rPoly.GetFlags( i );
+ }
+}
+
+/*************************************************************************
+|*
+|* XPolygon::XPolygon()
+|*
+|* Rechteck (auch mit abgerundeten Ecken) als Bezierpolygon erzeugen
+|* Ersterstellung 09.01.95 ESO
+|* Letzte Aenderung 09.01.95 ESO
+|*
+*************************************************************************/
+
+XPolygon::XPolygon(const Rectangle& rRect, long nRx, long nRy)
+{
+ DBG_CTOR(XPolygon,NULL);
+ pImpXPolygon = new ImpXPolygon(17);
+ long nWh = (rRect.GetWidth() - 1) / 2;
+ long nHh = (rRect.GetHeight() - 1) / 2;
+
+ if ( nRx > nWh ) nRx = nWh;
+ if ( nRy > nHh ) nRy = nHh;
+
+ // Rx negativ, damit Umlauf im Uhrzeigersinn erfolgt
+ nRx = -nRx;
+
+ // Faktor fuer Kontrollpunkte der Bezierkurven: 8/3 * (sin(45g) - 0.5)
+ long nXHdl = (long)(0.552284749 * nRx);
+ long nYHdl = (long)(0.552284749 * nRy);
+ sal_uInt16 nPos = 0;
+
+ if ( nRx && nRy )
+ {
+ Point aCenter;
+
+ for (sal_uInt16 nQuad = 0; nQuad < 4; nQuad++)
+ {
+ switch ( nQuad )
+ {
+ case 0: aCenter = rRect.TopLeft();
+ aCenter.X() -= nRx;
+ aCenter.Y() += nRy;
+ break;
+ case 1: aCenter = rRect.TopRight();
+ aCenter.X() += nRx;
+ aCenter.Y() += nRy;
+ break;
+ case 2: aCenter = rRect.BottomRight();
+ aCenter.X() += nRx;
+ aCenter.Y() -= nRy;
+ break;
+ case 3: aCenter = rRect.BottomLeft();
+ aCenter.X() -= nRx;
+ aCenter.Y() -= nRy;
+ break;
+ }
+ GenBezArc(aCenter, nRx, nRy, nXHdl, nYHdl, 0, 900, nQuad, nPos);
+ pImpXPolygon->pFlagAry[nPos ] = (sal_uInt8) XPOLY_SMOOTH;
+ pImpXPolygon->pFlagAry[nPos+3] = (sal_uInt8) XPOLY_SMOOTH;
+ nPos += 4;
+ }
+ }
+ else
+ {
+ pImpXPolygon->pPointAry[nPos++] = rRect.TopLeft();
+ pImpXPolygon->pPointAry[nPos++] = rRect.TopRight();
+ pImpXPolygon->pPointAry[nPos++] = rRect.BottomRight();
+ pImpXPolygon->pPointAry[nPos++] = rRect.BottomLeft();
+ }
+ pImpXPolygon->pPointAry[nPos] = pImpXPolygon->pPointAry[0];
+ pImpXPolygon->nPoints = nPos + 1;
+}
+
+/*************************************************************************
+|*
+|* XPolygon::XPolygon()
+|*
+|* Ellipsen(bogen) als Bezierpolygon erzeugen
+|* Ersterstellung 09.01.95
+|* Letzte Aenderung 09.01.95
+|*
+*************************************************************************/
+
+XPolygon::XPolygon(const Point& rCenter, long nRx, long nRy,
+ sal_uInt16 nStartAngle, sal_uInt16 nEndAngle, sal_Bool bClose)
+{
+ DBG_CTOR(XPolygon,NULL);
+ pImpXPolygon = new ImpXPolygon(17);
+
+ nStartAngle %= 3600;
+ if ( nEndAngle > 3600 ) nEndAngle %= 3600;
+ sal_Bool bFull = (nStartAngle == 0 && nEndAngle == 3600);
+
+ // Faktor fuer Kontrollpunkte der Bezierkurven: 8/3 * (sin(45g) - 0.5)
+ long nXHdl = (long)(0.552284749 * nRx);
+ long nYHdl = (long)(0.552284749 * nRy);
+ sal_uInt16 nPos = 0;
+ sal_Bool bLoopEnd = sal_False;
+
+ do
+ {
+ sal_uInt16 nA1, nA2;
+ sal_uInt16 nQuad = nStartAngle / 900;
+ if ( nQuad == 4 ) nQuad = 0;
+ bLoopEnd = CheckAngles(nStartAngle, nEndAngle, nA1, nA2);
+ GenBezArc(rCenter, nRx, nRy, nXHdl, nYHdl, nA1, nA2, nQuad, nPos);
+ nPos += 3;
+ if ( !bLoopEnd )
+ pImpXPolygon->pFlagAry[nPos] = (sal_uInt8) XPOLY_SMOOTH;
+
+ } while ( !bLoopEnd );
+
+ // Wenn kein Vollkreis, dann ggf. Enden mit Mittelpunkt verbinden
+ if ( !bFull && bClose )
+ pImpXPolygon->pPointAry[++nPos] = rCenter;
+
+ if ( bFull )
+ {
+ pImpXPolygon->pFlagAry[0 ] = (sal_uInt8) XPOLY_SMOOTH;
+ pImpXPolygon->pFlagAry[nPos] = (sal_uInt8) XPOLY_SMOOTH;
+ }
+ pImpXPolygon->nPoints = nPos + 1;
+}
+
+/*************************************************************************
+|*
+|* XPolygon::~XPolygon()
+|*
+|* Beschreibung
+|* Ersterstellung 08.11.94
+|* Letzte Aenderung 08.11.94
+|*
+*************************************************************************/
+
+XPolygon::~XPolygon()
+{
+ DBG_DTOR(XPolygon,NULL);
+ if( pImpXPolygon->nRefCount > 1 )
+ pImpXPolygon->nRefCount--;
+ else
+ delete pImpXPolygon;
+}
+
+/*************************************************************************
+|*
+|* XPolygon::CheckReference()
+|*
+|* Referenzzaehler desImpXPoly pruefen und ggf. von diesem abkoppeln
+|* Ersterstellung 17.01.95 ESO
+|* Letzte Aenderung 17.01.95 ESO
+|*
+*************************************************************************/
+
+void XPolygon::CheckReference()
+{
+ if( pImpXPolygon->nRefCount > 1 )
+ {
+ pImpXPolygon->nRefCount--;
+ pImpXPolygon = new ImpXPolygon( *pImpXPolygon );
+ }
+}
+
+/*************************************************************************
+|*
+|* XPolygon::SetSize()
+|*
+|* Beschreibung
+|* Ersterstellung 08.11.94
+|* Letzte Aenderung 08.11.94
+|*
+*************************************************************************/
+
+void XPolygon::SetSize( sal_uInt16 nNewSize )
+{
+ CheckReference();
+ pImpXPolygon->Resize( nNewSize );
+}
+
+/*************************************************************************
+|*
+|* XPolygon::GetSize()
+|*
+|* Beschreibung
+|* Ersterstellung 08.11.94
+|* Letzte Aenderung 12.01.95 ESO
+|*
+*************************************************************************/
+
+sal_uInt16 XPolygon::GetSize() const
+{
+ pImpXPolygon->CheckPointDelete();
+ return pImpXPolygon->nSize;
+}
+
+/*************************************************************************
+|*
+|* XPolygon::SetPointCount()
+|*
+|* Beschreibung
+|* Ersterstellung 08.11.94
+|* Letzte Aenderung 12.01.95 ESO
+|*
+*************************************************************************/
+
+void XPolygon::SetPointCount( sal_uInt16 nPoints )
+{
+ pImpXPolygon->CheckPointDelete();
+ CheckReference();
+
+ if( pImpXPolygon->nSize < nPoints )
+ pImpXPolygon->Resize( nPoints );
+
+ if ( nPoints < pImpXPolygon->nPoints )
+ {
+ sal_uInt16 nSize = pImpXPolygon->nPoints - nPoints;
+ memset( &pImpXPolygon->pPointAry[nPoints], 0, nSize * sizeof( Point ) );
+ memset( &pImpXPolygon->pFlagAry [nPoints], 0, nSize );
+ }
+ pImpXPolygon->nPoints = nPoints;
+}
+
+/*************************************************************************
+|*
+|* XPolygon::GetPointCount()
+|*
+|* Beschreibung
+|* Ersterstellung 08.11.94
+|* Letzte Aenderung 12.01.95 ESO
+|*
+*************************************************************************/
+
+sal_uInt16 XPolygon::GetPointCount() const
+{
+ pImpXPolygon->CheckPointDelete();
+ return pImpXPolygon->nPoints;
+}
+
+/*************************************************************************
+|*
+|* XPolygon::Insert()
+|*
+|* Beschreibung
+|* Ersterstellung 08.11.94
+|* Letzte Aenderung 08.11.94
+|*
+*************************************************************************/
+
+void XPolygon::Insert( sal_uInt16 nPos, const Point& rPt, XPolyFlags eFlags )
+{
+ CheckReference();
+ if (nPos>pImpXPolygon->nPoints) nPos=pImpXPolygon->nPoints;
+ pImpXPolygon->InsertSpace( nPos, 1 );
+ pImpXPolygon->pPointAry[nPos] = rPt;
+ pImpXPolygon->pFlagAry[nPos] = (sal_uInt8)eFlags;
+}
+
+/*************************************************************************
+|*
+|* XPolygon::Insert()
+|*
+|* Beschreibung
+|* Ersterstellung 08.11.94
+|* Letzte Aenderung 08.11.94
+|*
+*************************************************************************/
+
+void XPolygon::Insert( sal_uInt16 nPos, const XPolygon& rXPoly )
+{
+ CheckReference();
+ if (nPos>pImpXPolygon->nPoints) nPos=pImpXPolygon->nPoints;
+
+ sal_uInt16 nPoints = rXPoly.GetPointCount();
+
+ pImpXPolygon->InsertSpace( nPos, nPoints );
+
+ memcpy( &(pImpXPolygon->pPointAry[nPos]),
+ rXPoly.pImpXPolygon->pPointAry,
+ nPoints*sizeof( Point ) );
+ memcpy( &(pImpXPolygon->pFlagAry[nPos]),
+ rXPoly.pImpXPolygon->pFlagAry,
+ nPoints );
+}
+
+/*************************************************************************
+|*
+|* XPolygon::Insert()
+|*
+|* Beschreibung
+|* Ersterstellung 08.11.94
+|* Letzte Aenderung 08.11.94
+|*
+*************************************************************************/
+
+void XPolygon::Insert( sal_uInt16 nPos, const Polygon& rPoly )
+{
+ CheckReference();
+ if (nPos>pImpXPolygon->nPoints) nPos=pImpXPolygon->nPoints;
+
+ sal_uInt16 nPoints = rPoly.GetSize();
+
+ pImpXPolygon->InsertSpace( nPos, nPoints );
+
+ sal_uInt16 i;
+ for( i=0; i < nPoints; i++ )
+ pImpXPolygon->pPointAry[i] = rPoly[i];
+
+ // Die Flags sind durch das InsertSpace bereits auf 0 gesetzt
+}
+
+/*************************************************************************
+|*
+|* XPolygon::Remove()
+|*
+|* Beschreibung
+|* Ersterstellung 08.11.94
+|* Letzte Aenderung 08.11.94
+|*
+*************************************************************************/
+
+void XPolygon::Remove( sal_uInt16 nPos, sal_uInt16 nCount )
+{
+ CheckReference();
+ pImpXPolygon->Remove( nPos, nCount );
+}
+
+/*************************************************************************
+|*
+|* XPolygon::Move()
+|*
+|* Beschreibung
+|* Ersterstellung 09.11.94
+|* Letzte Aenderung 09.11.94
+|*
+*************************************************************************/
+
+void XPolygon::Move( long nHorzMove, long nVertMove )
+{
+ if ( !nHorzMove && !nVertMove )
+ return;
+
+ CheckReference();
+
+ // Punkte verschieben
+ sal_uInt16 nCount = pImpXPolygon->nPoints;
+ for ( sal_uInt16 i = 0; i < nCount; i++ )
+ {
+ Point* pPt = &(pImpXPolygon->pPointAry[i]);
+ pPt->X() += nHorzMove;
+ pPt->Y() += nVertMove;
+ }
+}
+
+/*************************************************************************
+|*
+|* XPolygon::GetBoundRect()
+|*
+|* Beschreibung
+|* Ersterstellung 09.11.94
+|* Letzte Aenderung 12.01.95 ESO
+|*
+*************************************************************************/
+
+Rectangle XPolygon::GetBoundRect() const
+{
+ pImpXPolygon->CheckPointDelete();
+ Rectangle aRetval;
+
+ if(pImpXPolygon->nPoints)
+ {
+ // #i37709#
+ // For historical reasons the control points are not part of the
+ // BoundRect. This makes it necessary to subdivide the polygon to
+ // get a relatively correct BoundRect. Numerically, this is not
+ // correct and never was.
+
+ const basegfx::B2DRange aPolygonRange(basegfx::tools::getRange(getB2DPolygon()));
+ aRetval = Rectangle(
+ FRound(aPolygonRange.getMinX()), FRound(aPolygonRange.getMinY()),
+ FRound(aPolygonRange.getMaxX()), FRound(aPolygonRange.getMaxY()));
+ }
+
+ return aRetval;
+}
+
+/*************************************************************************
+|*
+|* XPolygon::operator[]()
+|*
+|* Beschreibung
+|* Ersterstellung 08.11.94
+|* Letzte Aenderung 12.01.95
+|*
+*************************************************************************/
+
+const Point& XPolygon::operator[]( sal_uInt16 nPos ) const
+{
+ DBG_ASSERT(nPos < pImpXPolygon->nPoints, "Ungueltiger Index bei const-Arrayzugriff auf XPolygon");
+
+ pImpXPolygon->CheckPointDelete();
+ return pImpXPolygon->pPointAry[nPos];
+}
+
+/*************************************************************************
+|*
+|* XPolygon::operator[]()
+|*
+|* Beschreibung
+|* Ersterstellung 08.11.94
+|* Letzte Aenderung 12.01.95 ESO
+|*
+*************************************************************************/
+
+Point& XPolygon::operator[]( sal_uInt16 nPos )
+{
+ pImpXPolygon->CheckPointDelete();
+ CheckReference();
+
+ if( nPos >= pImpXPolygon->nSize )
+ {
+ DBG_ASSERT(pImpXPolygon->nResize, "Ungueltiger Index bei Arrayzugriff auf XPolygon");
+ pImpXPolygon->Resize(nPos + 1, sal_False);
+ }
+ if( nPos >= pImpXPolygon->nPoints )
+ pImpXPolygon->nPoints = nPos + 1;
+
+ return pImpXPolygon->pPointAry[nPos];
+}
+
+/*************************************************************************
+|*
+|* XPolygon::operator=()
+|*
+|* Beschreibung Zuweisungsoperator
+|* Ersterstellung ESO 22.11.94
+|* Letzte Aenderung ESO 12.01.95
+|*
+*************************************************************************/
+
+XPolygon& XPolygon::operator=( const XPolygon& rXPoly )
+{
+ pImpXPolygon->CheckPointDelete();
+
+ rXPoly.pImpXPolygon->nRefCount++;
+
+ if( pImpXPolygon->nRefCount > 1 )
+ pImpXPolygon->nRefCount--;
+ else
+ delete pImpXPolygon;
+
+ pImpXPolygon = rXPoly.pImpXPolygon;
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* XPolygon::operator==()
+|*
+|* Beschreibung Gleichheitsoperator
+|* Ersterstellung ESO 22.11.94
+|* Letzte Aenderung Joe 26.09.95
+|*
+*************************************************************************/
+
+sal_Bool XPolygon::operator==( const XPolygon& rXPoly ) const
+{
+ pImpXPolygon->CheckPointDelete();
+ if (rXPoly.pImpXPolygon==pImpXPolygon) return sal_True;
+ return *rXPoly.pImpXPolygon == *pImpXPolygon;
+}
+
+/*************************************************************************
+|*
+|* XPolygon::operator!=()
+|*
+|* Beschreibung Ungleichheitsoperator
+|* Ersterstellung ESO 22.11.94
+|* Letzte Aenderung Joe 26.09.95
+|*
+*************************************************************************/
+
+sal_Bool XPolygon::operator!=( const XPolygon& rXPoly ) const
+{
+ pImpXPolygon->CheckPointDelete();
+ if (rXPoly.pImpXPolygon==pImpXPolygon) return sal_False;
+ return *rXPoly.pImpXPolygon != *pImpXPolygon;
+}
+
+/*************************************************************************
+|*
+|* XPolygon::GetFlags()
+|*
+|* Flags fuer den Punkt an der Position nPos zurueckgeben
+|* Ersterstellung ESO 11.11.94
+|* Letzte Aenderung ESO 12.01.95
+|*
+*************************************************************************/
+
+XPolyFlags XPolygon::GetFlags( sal_uInt16 nPos ) const
+{
+ pImpXPolygon->CheckPointDelete();
+ return (XPolyFlags) pImpXPolygon->pFlagAry[nPos];
+}
+
+/*************************************************************************
+|*
+|* XPolygon::SetFlags()
+|*
+|* Flags fuer den Punkt an der Position nPos setzen
+|* Ersterstellung ESO 11.11.94
+|* Letzte Aenderung ESO 12.01.95
+|*
+*************************************************************************/
+
+void XPolygon::SetFlags( sal_uInt16 nPos, XPolyFlags eFlags )
+{
+ pImpXPolygon->CheckPointDelete();
+ CheckReference();
+ pImpXPolygon->pFlagAry[nPos] = (sal_uInt8) eFlags;
+}
+
+/*************************************************************************
+|*
+|* XPolygon::IsControl()
+|*
+|* Kurzform zur Abfrage des CONTROL-Flags
+|* Ersterstellung ESO 09.01.95
+|* Letzte Aenderung ESO 12.01.95
+|*
+*************************************************************************/
+
+sal_Bool XPolygon::IsControl(sal_uInt16 nPos) const
+{
+ return ( (XPolyFlags) pImpXPolygon->pFlagAry[nPos] == XPOLY_CONTROL );
+}
+
+/*************************************************************************
+|*
+|* XPolygon::IsSmooth()
+|*
+|* Kurzform zur Abfrage von SMOOTH- und SYMMTR-Flag
+|* Ersterstellung ESO 18.04.95
+|* Letzte Aenderung ESO 18.04.95
+|*
+*************************************************************************/
+
+sal_Bool XPolygon::IsSmooth(sal_uInt16 nPos) const
+{
+ XPolyFlags eFlag = (XPolyFlags) pImpXPolygon->pFlagAry[nPos];
+ return ( eFlag == XPOLY_SMOOTH || eFlag == XPOLY_SYMMTR );
+}
+
+/*************************************************************************
+|*
+|* XPolygon::CalcDistance()
+|*
+|* Abstand zwischen zwei Punkten berechnen
+|* Ersterstellung ESO 09.01.95
+|* Letzte Aenderung ESO 09.01.95
+|*
+*************************************************************************/
+
+double XPolygon::CalcDistance(sal_uInt16 nP1, sal_uInt16 nP2)
+{
+ const Point& rP1 = pImpXPolygon->pPointAry[nP1];
+ const Point& rP2 = pImpXPolygon->pPointAry[nP2];
+ double fDx = rP2.X() - rP1.X();
+ double fDy = rP2.Y() - rP1.Y();
+ return sqrt(fDx * fDx + fDy * fDy);
+}
+
+/*************************************************************************
+|*
+|* XPolygon::SubdivideBezier()
+|*
+|* Bezierkurve unterteilen
+|* Ersterstellung ESO 09.01.95
+|* Letzte Aenderung ESO 09.01.95
+|*
+*************************************************************************/
+
+void XPolygon::SubdivideBezier(sal_uInt16 nPos, sal_Bool bCalcFirst, double fT)
+{
+ Point* pPoints = pImpXPolygon->pPointAry;
+ double fT2 = fT * fT;
+ double fT3 = fT * fT2;
+ double fU = 1.0 - fT;
+ double fU2 = fU * fU;
+ double fU3 = fU * fU2;
+ sal_uInt16 nIdx = nPos;
+ short nPosInc, nIdxInc;
+
+ if ( bCalcFirst )
+ {
+ nPos += 3;
+ nPosInc = -1;
+ nIdxInc = 0;
+ }
+ else
+ {
+ nPosInc = 1;
+ nIdxInc = 1;
+ }
+ pPoints[nPos].X() = (long) (fU3 * pPoints[nIdx ].X() +
+ fT * fU2 * pPoints[nIdx+1].X() * 3 +
+ fT2 * fU * pPoints[nIdx+2].X() * 3 +
+ fT3 * pPoints[nIdx+3].X());
+ pPoints[nPos].Y() = (long) (fU3 * pPoints[nIdx ].Y() +
+ fT * fU2 * pPoints[nIdx+1].Y() * 3 +
+ fT2 * fU * pPoints[nIdx+2].Y() * 3 +
+ fT3 * pPoints[nIdx+3].Y());
+ nPos = nPos + nPosInc;
+ nIdx = nIdx + nIdxInc;
+ pPoints[nPos].X() = (long) (fU2 * pPoints[nIdx ].X() +
+ fT * fU * pPoints[nIdx+1].X() * 2 +
+ fT2 * pPoints[nIdx+2].X());
+ pPoints[nPos].Y() = (long) (fU2 * pPoints[nIdx ].Y() +
+ fT * fU * pPoints[nIdx+1].Y() * 2 +
+ fT2 * pPoints[nIdx+2].Y());
+ nPos = nPos + nPosInc;
+ nIdx = nIdx + nIdxInc;
+ pPoints[nPos].X() = (long) (fU * pPoints[nIdx ].X() +
+ fT * pPoints[nIdx+1].X());
+ pPoints[nPos].Y() = (long) (fU * pPoints[nIdx ].Y() +
+ fT * pPoints[nIdx+1].Y());
+}
+
+/************************************************************************/
+
+void XPolygon::GenBezArc(const Point& rCenter, long nRx, long nRy,
+ long nXHdl, long nYHdl, sal_uInt16 nStart, sal_uInt16 nEnd,
+ sal_uInt16 nQuad, sal_uInt16 nFirst)
+{
+ Point* pPoints = pImpXPolygon->pPointAry;
+ pPoints[nFirst ] = rCenter;
+ pPoints[nFirst+3] = rCenter;
+
+ if ( nQuad == 1 || nQuad == 2 )
+ {
+ nRx = -nRx; nXHdl = -nXHdl;
+ }
+ if ( nQuad == 0 || nQuad == 1 )
+ {
+ nRy = -nRy; nYHdl = -nYHdl;
+ }
+
+ if ( nQuad == 0 || nQuad == 2 )
+ {
+ pPoints[nFirst].X() += nRx; pPoints[nFirst+3].Y() += nRy;
+ }
+ else
+ {
+ pPoints[nFirst].Y() += nRy; pPoints[nFirst+3].X() += nRx;
+ }
+ pPoints[nFirst+1] = pPoints[nFirst];
+ pPoints[nFirst+2] = pPoints[nFirst+3];
+
+ if ( nQuad == 0 || nQuad == 2 )
+ {
+ pPoints[nFirst+1].Y() += nYHdl; pPoints[nFirst+2].X() += nXHdl;
+ }
+ else
+ {
+ pPoints[nFirst+1].X() += nXHdl; pPoints[nFirst+2].Y() += nYHdl;
+ }
+ if ( nStart > 0 )
+ SubdivideBezier(nFirst, sal_False, (double)nStart / 900);
+ if ( nEnd < 900 )
+ SubdivideBezier(nFirst, sal_True, (double)(nEnd-nStart) / (900-nStart));
+ SetFlags(nFirst+1, XPOLY_CONTROL);
+ SetFlags(nFirst+2, XPOLY_CONTROL);
+}
+
+/************************************************************************/
+
+sal_Bool XPolygon::CheckAngles(sal_uInt16& nStart, sal_uInt16 nEnd, sal_uInt16& nA1, sal_uInt16& nA2)
+{
+ if ( nStart == 3600 ) nStart = 0;
+ if ( nEnd == 0 ) nEnd = 3600;
+ sal_uInt16 nStPrev = nStart;
+ sal_uInt16 nMax = (nStart / 900 + 1) * 900;
+ sal_uInt16 nMin = nMax - 900;
+
+ if ( nEnd >= nMax || nEnd <= nStart ) nA2 = 900;
+ else nA2 = nEnd - nMin;
+ nA1 = nStart - nMin;
+ nStart = nMax;
+
+ // sal_True zurueck, falls letztes Segment berechnet wurde
+ return (nStPrev < nEnd && nStart >= nEnd);
+}
+
+/*************************************************************************
+|*
+|* XPolygon::CalcSmoothJoin()
+|*
+|* glatten Uebergang zu einer Bezierkurve berechnen, indem der
+|* entsprechende Punkt auf die Verbindungslinie von zwei anderen
+|* Punkten projiziert wird
+|* Center = End- bzw. Anfangspunkt der Bezierkurve
+|* Drag = der bewegte Punkt, der die Verschiebung von Pnt vorgibt
+|* Pnt = der zu modifizierende Punkt
+|* Wenn Center am Anfang bzw. Ende des Polygons liegt, wird Pnt
+|* auf die entgegengesetzte Seite verlegt
+|* Ersterstellung ESO 09.01.95
+|* Letzte Aenderung ESO 18.04.95
+|*
+\************************************************************************/
+
+void XPolygon::CalcSmoothJoin(sal_uInt16 nCenter, sal_uInt16 nDrag, sal_uInt16 nPnt)
+{
+ CheckReference();
+
+// sal_uInt16 nMaxPnt = pImpXPolygon->nPoints - 1;
+
+// if ( nCenter == nMaxPnt ) nPnt = 1;
+// else if ( nCenter == 0 ) nPnt = nMaxPnt - 1;
+
+ // Wenn nPnt kein Control-Punkt, d.h. nicht verschiebbar, dann
+ // statt dessen nDrag auf der Achse nCenter-nPnt verschieben
+ if ( !IsControl(nPnt) )
+ {
+ sal_uInt16 nTmp = nDrag;
+ nDrag = nPnt;
+ nPnt = nTmp;
+ }
+ Point* pPoints = pImpXPolygon->pPointAry;
+ Point aDiff = pPoints[nDrag] - pPoints[nCenter];
+ double fDiv = CalcDistance(nCenter, nDrag);
+
+ if ( fDiv )
+ {
+ double fRatio = CalcDistance(nCenter, nPnt) / fDiv;
+ // bei SMOOTH bisherige Laenge beibehalten
+ if ( GetFlags(nCenter) == XPOLY_SMOOTH || !IsControl(nDrag) )
+ {
+ aDiff.X() = (long) (fRatio * aDiff.X());
+ aDiff.Y() = (long) (fRatio * aDiff.Y());
+ }
+ pPoints[nPnt] = pPoints[nCenter] - aDiff;
+ }
+}
+
+/*************************************************************************
+|*
+|* XPolygon::CalcTangent()
+|*
+|* Tangente fuer den Uebergang zwischen zwei Bezierkurven berechnen
+|* Center = End- bzw. Anfangspunkt der Bezierkurven
+|* Prev = vorheriger Zugpunkt
+|* Next = naechster Zugpunkt
+|* Ersterstellung ESO 09.01.95
+|* Letzte Aenderung ESO 18.04.95
+|*
+\************************************************************************/
+
+void XPolygon::CalcTangent(sal_uInt16 nCenter, sal_uInt16 nPrev, sal_uInt16 nNext)
+{
+ CheckReference();
+
+ double fAbsLen = CalcDistance(nNext, nPrev);
+
+ if ( fAbsLen )
+ {
+ const Point& rCenter = pImpXPolygon->pPointAry[nCenter];
+ Point& rNext = pImpXPolygon->pPointAry[nNext];
+ Point& rPrev = pImpXPolygon->pPointAry[nPrev];
+ Point aDiff = rNext - rPrev;
+ double fNextLen = CalcDistance(nCenter, nNext) / fAbsLen;
+ double fPrevLen = CalcDistance(nCenter, nPrev) / fAbsLen;
+
+ // bei SYMMTR gleiche Laenge fuer beide Seiten
+ if ( GetFlags(nCenter) == XPOLY_SYMMTR )
+ {
+ fPrevLen = (fNextLen + fPrevLen) / 2;
+ fNextLen = fPrevLen;
+ }
+ rNext.X() = rCenter.X() + (long) (fNextLen * aDiff.X());
+ rNext.Y() = rCenter.Y() + (long) (fNextLen * aDiff.Y());
+ rPrev.X() = rCenter.X() - (long) (fPrevLen * aDiff.X());
+ rPrev.Y() = rCenter.Y() - (long) (fPrevLen * aDiff.Y());
+ }
+}
+
+/*************************************************************************
+|*
+|* XPolygon::PointsToBezier()
+|*
+|* wandelt vier Polygonpunkte in eine Bezierkurve durch diese Punkte um
+|* Ersterstellung ESO 09.01.95
+|* Letzte Aenderung ESO 09.01.95
+|*
+\************************************************************************/
+
+void XPolygon::PointsToBezier(sal_uInt16 nFirst)
+{
+ double nFullLength, nPart1Length, nPart2Length;
+ double fX0, fY0, fX1, fY1, fX2, fY2, fX3, fY3;
+ double fTx1, fTx2, fTy1, fTy2;
+ double fT1, fU1, fT2, fU2, fV;
+ Point* pPoints = pImpXPolygon->pPointAry;
+
+ if ( nFirst > pImpXPolygon->nPoints - 4 || IsControl(nFirst) ||
+ IsControl(nFirst+1) || IsControl(nFirst+2) || IsControl(nFirst+3) )
+ return;
+
+ CheckReference();
+
+ fTx1 = pPoints[nFirst+1].X();
+ fTy1 = pPoints[nFirst+1].Y();
+ fTx2 = pPoints[nFirst+2].X();
+ fTy2 = pPoints[nFirst+2].Y();
+ fX0 = pPoints[nFirst ].X();
+ fY0 = pPoints[nFirst ].Y();
+ fX3 = pPoints[nFirst+3].X();
+ fY3 = pPoints[nFirst+3].Y();
+
+ nPart1Length = CalcDistance(nFirst, nFirst+1);
+ nPart2Length = nPart1Length + CalcDistance(nFirst+1, nFirst+2);
+ nFullLength = nPart2Length + CalcDistance(nFirst+2, nFirst+3);
+ if ( nFullLength < 20 )
+ return;
+
+ if ( nPart2Length == nFullLength )
+ nPart2Length -= 1;
+ if ( nPart1Length == nFullLength )
+ nPart1Length = nPart2Length - 1;
+ if ( nPart1Length <= 0 )
+ nPart1Length = 1;
+ if ( nPart2Length <= 0 || nPart2Length == nPart1Length )
+ nPart2Length = nPart1Length + 1;
+
+ fT1 = nPart1Length / nFullLength;
+ fU1 = 1.0 - fT1;
+ fT2 = nPart2Length / nFullLength;
+ fU2 = 1.0 - fT2;
+ fV = 3 * (1.0 - (fT1 * fU2) / (fT2 * fU1));
+
+ fX1 = fTx1 / (fT1 * fU1 * fU1) - fTx2 * fT1 / (fT2 * fT2 * fU1 * fU2);
+ fX1 /= fV;
+ fX1 -= fX0 * ( fU1 / fT1 + fU2 / fT2) / 3;
+ fX1 += fX3 * ( fT1 * fT2 / (fU1 * fU2)) / 3;
+
+ fY1 = fTy1 / (fT1 * fU1 * fU1) - fTy2 * fT1 / (fT2 * fT2 * fU1 * fU2);
+ fY1 /= fV;
+ fY1 -= fY0 * ( fU1 / fT1 + fU2 / fT2) / 3;
+ fY1 += fY3 * ( fT1 * fT2 / (fU1 * fU2)) / 3;
+
+ fX2 = fTx2 / (fT2 * fT2 * fU2 * 3) - fX0 * fU2 * fU2 / ( fT2 * fT2 * 3);
+ fX2 -= fX1 * fU2 / fT2;
+ fX2 -= fX3 * fT2 / (fU2 * 3);
+
+ fY2 = fTy2 / (fT2 * fT2 * fU2 * 3) - fY0 * fU2 * fU2 / ( fT2 * fT2 * 3);
+ fY2 -= fY1 * fU2 / fT2;
+ fY2 -= fY3 * fT2 / (fU2 * 3);
+
+ pPoints[nFirst+1] = Point((long) fX1, (long) fY1);
+ pPoints[nFirst+2] = Point((long) fX2, (long) fY2);
+ SetFlags(nFirst+1, XPOLY_CONTROL);
+ SetFlags(nFirst+2, XPOLY_CONTROL);
+}
+
+/*************************************************************************
+|*
+|* XPolygon::Translate()
+|*
+|* Polygon auf den uebergebenen Punkt verschieben
+|* Ersterstellung ESO 17.01.95
+|* Letzte Aenderung ESO 17.01.95
+|*
+*************************************************************************/
+
+void XPolygon::Translate(const Point& rTrans)
+{
+ pImpXPolygon->CheckPointDelete();
+ CheckReference();
+
+ sal_uInt16 nPntCnt = pImpXPolygon->nPoints;
+
+ for (sal_uInt16 i = 0; i < nPntCnt; i++)
+ pImpXPolygon->pPointAry[i] += rTrans;
+}
+
+/*************************************************************************
+|*
+|* XPolygon::Rotate()
+|*
+|* Alle Punkte um den Punkt rCenter drehen, Sinus und Cosinus
+|* muessen uebergeben werden
+|* Ersterstellung ESO 09.01.95
+|* Letzte Aenderung ESO 17.01.95
+|*
+*************************************************************************/
+
+void XPolygon::Rotate(const Point& rCenter, double fSin, double fCos)
+{
+ pImpXPolygon->CheckPointDelete();
+ CheckReference();
+
+ long nX;
+ long nY;
+ long nNewX;
+ long nNewY;
+ long nCenterX = rCenter.X();
+ long nCenterY = rCenter.Y();
+
+ sal_uInt16 nPntCnt = pImpXPolygon->nPoints;
+
+ for (sal_uInt16 i = 0; i < nPntCnt; i++)
+ {
+ Point *pPt = &(pImpXPolygon->pPointAry[i]);
+ nX = pPt->X()-nCenterX;
+ nY = pPt->Y()-nCenterY;
+ nNewX = (long)floor(fCos * nX + fSin * nY + 0.5);
+ nNewY = -(long)floor(fSin * nX - fCos * nY + 0.5);
+ pPt->X() = nNewX + nCenterX;
+ pPt->Y() = nNewY + nCenterY;
+
+ /* und so stand das in einem anderen File auf T:
+ dass ich am 29-11-1995 gegettet habe. Joe M.
+ sal_uInt16 nPntCnt = pImpXPolygon->nPoints;
+
+ for (sal_uInt16 i = 0; i < nPntCnt; i++)
+ {
+ Point P = pImpXPolygon->pPointAry[i] - rCenter;
+ long X = P.X();
+ long Y = P.Y();
+ P.X() = (long)floor(fCos * X + fSin * Y + 0.5);
+ P.Y() = -(long)floor(fSin * X - fCos * Y + 0.5);
+ pImpXPolygon->pPointAry[i] = P + rCenter;
+ */
+ }
+}
+
+/*************************************************************************
+|*
+|* XPolygon::Rotate()
+|*
+|* Alle Punkte um den Punkt rCenter mit dem Winkel nAngle drehen
+|* Winkel in 10tel Grad, Wertebereich 0 - 3600
+|* Ersterstellung ESO 17.01.95
+|* Letzte Aenderung ESO 17.01.95
+|*
+*************************************************************************/
+
+void XPolygon::Rotate(const Point& rCenter, sal_uInt16 nAngle)
+{
+ nAngle %= 3600;
+
+ if ( nAngle != 0 )
+ {
+ double fAngle = F_PI * nAngle / 1800;
+ double fSin = sin(fAngle);
+ double fCos = cos(fAngle);
+ Rotate(rCenter, fSin, fCos);
+ }
+}
+
+/*************************************************************************
+|*
+|* XPolygon::Scale()
+|*
+|* XPolygon in X- und/oder Y-Richtung skalieren
+|* Ersterstellung ESO 01.02.95
+|* Letzte Aenderung ESO 01.02.95
+|*
+*************************************************************************/
+
+void XPolygon::Scale(double fSx, double fSy)
+{
+ pImpXPolygon->CheckPointDelete();
+ CheckReference();
+
+ sal_uInt16 nPntCnt = pImpXPolygon->nPoints;
+
+ for (sal_uInt16 i = 0; i < nPntCnt; i++)
+ {
+ Point& rPnt = pImpXPolygon->pPointAry[i];
+ rPnt.X() = (long)(fSx * rPnt.X());
+ rPnt.Y() = (long)(fSy * rPnt.Y());
+ }
+}
+
+/*************************************************************************
+|*
+|* XPolygon::SlantX()
+|*
+|* XPolygon in X-Richtung um einen beliebigen Winkel kippen,
+|* bezogen auf eine Referenz-Y-Koordinate
+|* Ersterstellung ESO 01.02.95
+|* Letzte Aenderung ESO 01.02.95
+|*
+*************************************************************************/
+
+void XPolygon::SlantX(long nYRef, double fSin, double fCos)
+{
+ pImpXPolygon->CheckPointDelete();
+ CheckReference();
+
+ sal_uInt16 nPntCnt = pImpXPolygon->nPoints;
+
+ for (sal_uInt16 i = 0; i < nPntCnt; i++)
+ {
+ Point& rPnt = pImpXPolygon->pPointAry[i];
+ long nDy = rPnt.Y() - nYRef;
+ rPnt.X() += (long)(fSin * nDy);
+ rPnt.Y() = nYRef + (long)(fCos * nDy);
+ }
+}
+
+/*************************************************************************
+|*
+|* XPolygon::SlantY()
+|*
+|* XPolygon in Y-Richtung um einen beliebigen Winkel kippen,
+|* bezogen auf eine Referenz-X-Koordinate
+|* Ersterstellung ESO 01.02.95
+|* Letzte Aenderung ESO 01.02.95
+|*
+*************************************************************************/
+
+void XPolygon::SlantY(long nXRef, double fSin, double fCos)
+{
+ pImpXPolygon->CheckPointDelete();
+ CheckReference();
+
+ sal_uInt16 nPntCnt = pImpXPolygon->nPoints;
+
+ for (sal_uInt16 i = 0; i < nPntCnt; i++)
+ {
+ Point& rPnt = pImpXPolygon->pPointAry[i];
+ long nDx = rPnt.X() - nXRef;
+ rPnt.X() = nXRef + (long)(fCos * nDx);
+ rPnt.Y() -= (long)(fSin * nDx);
+ }
+}
+
+/*************************************************************************
+|*
+|* XPolygon::Distort()
+|*
+|* XPolygon verzerren, indem die Koordinaten relativ zu einem
+|* Referenzrechteck in ein beliebiges Viereck skaliert werden
+|* Zuordnung der Viereck-Punkte im Polygon zum Referenzrechteck:
+|* 0: links oben 0----1
+|* 1: rechts oben | |
+|* 2: rechts unten 3----2
+|* 3: links unten
+|* Ersterstellung ESO 07.07.95
+|* Letzte Aenderung ESO 07.07.95
+|*
+*************************************************************************/
+
+void XPolygon::Distort(const Rectangle& rRefRect,
+ const XPolygon& rDistortedRect)
+{
+ pImpXPolygon->CheckPointDelete();
+ CheckReference();
+
+ long Xr, Wr, X1, X2, X3, X4;
+ long Yr, Hr, Y1, Y2, Y3, Y4;
+ double fTx, fTy, fUx, fUy;
+
+ Xr = rRefRect.Left();
+ Yr = rRefRect.Top();
+ Wr = rRefRect.GetWidth();
+ Hr = rRefRect.GetHeight();
+
+ if ( Wr && Hr )
+ {
+ DBG_ASSERT(rDistortedRect.pImpXPolygon->nPoints >= 4,
+ "Distort-Rechteck zu klein");
+
+ X1 = rDistortedRect[0].X();
+ Y1 = rDistortedRect[0].Y();
+ X2 = rDistortedRect[1].X();
+ Y2 = rDistortedRect[1].Y();
+ X3 = rDistortedRect[3].X();
+ Y3 = rDistortedRect[3].Y();
+ X4 = rDistortedRect[2].X();
+ Y4 = rDistortedRect[2].Y();
+
+ sal_uInt16 nPntCnt = pImpXPolygon->nPoints;
+
+ for (sal_uInt16 i = 0; i < nPntCnt; i++)
+ {
+ Point& rPnt = pImpXPolygon->pPointAry[i];
+
+ fTx = (double)(rPnt.X() - Xr) / Wr;
+ fTy = (double)(rPnt.Y() - Yr) / Hr;
+ fUx = 1.0 - fTx;
+ fUy = 1.0 - fTy;
+
+ rPnt.X() = (long) ( fUy * (fUx * X1 + fTx * X2) +
+ fTy * (fUx * X3 + fTx * X4) );
+ rPnt.Y() = (long) ( fUx * (fUy * Y1 + fTy * Y3) +
+ fTx * (fUy * Y2 + fTy * Y4) );
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Bestimme den linken, unteren Punkt des Polygons und richte das
+|* Polygon so aus, dass dieser Punkt auf dem Index 0 liegt
+|*
+\************************************************************************/
+
+void XPolygon::Rotate20()
+{
+ pImpXPolygon->CheckPointDelete();
+ CheckReference();
+
+ double fMinY = pImpXPolygon->pPointAry->Y();
+ double fMinX = pImpXPolygon->pPointAry->X();
+ long nPntCnt = pImpXPolygon->nPoints;
+ long nIndex0 = 0;
+
+ for (long nPoints = 1;
+ nPoints < nPntCnt;
+ nPoints ++)
+ {
+ Point &rPnt = pImpXPolygon->pPointAry[nPoints];
+
+ if ((rPnt.X () < fMinX) || (fMinX == rPnt.X ()) &&
+ (fMinY >= rPnt.Y ()))
+ {
+ fMinX = rPnt.X ();
+ fMinY = rPnt.Y ();
+ nIndex0 = nPoints;
+ }
+ }
+
+ if (nIndex0 < nPntCnt)
+ {
+ Point *pTemp = new Point [nIndex0];
+ memcpy (pTemp, pImpXPolygon->pPointAry, nIndex0 * sizeof (Point));
+ memcpy (pImpXPolygon->pPointAry, &pImpXPolygon->pPointAry [nIndex0], (nPntCnt - nIndex0) * sizeof (Point));
+ memcpy (&pImpXPolygon->pPointAry [nIndex0], pTemp, nIndex0 * sizeof (Point));
+ delete[] pTemp;
+ }
+}
+
+basegfx::B2DPolygon XPolygon::getB2DPolygon() const
+{
+ // #i74631# use tools Polygon class for conversion to not have the code doubled
+ // here. This needs one more conversion but avoids different convertors in
+ // the long run
+ DBG_ASSERT(pImpXPolygon != 0, "XPolygon::getB2DPolygon(): XPolygon has no implementation incarnated (!)");
+ const Polygon aSource(GetPointCount(), pImpXPolygon->pPointAry, pImpXPolygon->pFlagAry);
+
+ return aSource.getB2DPolygon();
+}
+
+XPolygon::XPolygon(const basegfx::B2DPolygon& rPolygon)
+{
+ // #i74631# use tools Polygon class for conversion to not have the code doubled
+ // here. This needs one more conversion but avoids different convertors in
+ // the long run
+ DBG_CTOR(XPolygon,NULL);
+
+ const Polygon aSource(rPolygon);
+ sal_uInt16 nSize = aSource.GetSize();
+ pImpXPolygon = new ImpXPolygon( nSize );
+ pImpXPolygon->nPoints = nSize;
+
+ for( sal_uInt16 i = 0; i < nSize; i++ )
+ {
+ pImpXPolygon->pPointAry[i] = aSource[i];
+ pImpXPolygon->pFlagAry[i] = (sal_uInt8) aSource.GetFlags( i );
+ }
+}
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//+--------------- XPolyPolygon -----------------------------------------+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+/*************************************************************************
+|*
+|* ImpXPolyPolygon::ImpXPolyPolygon()
+|*
+|* Beschreibung Erzeugt das XPolygon-Array
+|* Ersterstellung CL 09.11.94
+|* Letzte Aenderung MM 09.11.94
+|*
+*************************************************************************/
+
+ImpXPolyPolygon::ImpXPolyPolygon( const ImpXPolyPolygon& rImpXPolyPoly ) :
+ aXPolyList( rImpXPolyPoly.aXPolyList )
+{
+ nRefCount = 1;
+
+ // Einzelne Elemente duplizieren
+ XPolygon* pXPoly = aXPolyList.First();
+ while ( pXPoly )
+ {
+ aXPolyList.Replace( new XPolygon( *(aXPolyList.GetCurObject()) ) );
+ pXPoly = aXPolyList.Next();
+ }
+}
+
+
+/*************************************************************************
+|*
+|* ImpXPolyPolygon::~ImpXPolyPolygon()
+|*
+|* Beschreibung Loescht das Polygon-Array
+|* Ersterstellung CL 09.06.93
+|* Letzte Aenderung CL 09.06.93
+|*
+*************************************************************************/
+
+ImpXPolyPolygon::~ImpXPolyPolygon()
+{
+ XPolygon* pXPoly = aXPolyList.First();
+ while( pXPoly )
+ {
+ delete pXPoly;
+ pXPoly = aXPolyList.Next();
+ }
+}
+
+/*************************************************************************
+|*
+|* ImpXPolyPolygon::operator==()
+|*
+|* Ersterstellung Joe 26-09-95
+|* Letzte Aenderung
+|*
+*************************************************************************/
+
+
+bool ImpXPolyPolygon::operator==(const ImpXPolyPolygon& rImpXPolyPoly) const
+{
+ sal_uInt16 nAnz=(sal_uInt16)aXPolyList.Count();
+ const XPolygonList& rCmpList=rImpXPolyPoly.aXPolyList;
+ if (nAnz!=(sal_uInt16)rCmpList.Count()) return sal_False;
+ bool bEq=true;
+ for (sal_uInt16 i=nAnz; i>0 && bEq;) {
+ i--;
+ bEq= *aXPolyList.GetObject(i) == *rCmpList.GetObject(i);
+ }
+ return bEq;
+}
+
+/*************************************************************************
+|*
+|* XPolyPolygon::XPolyPolygon()
+|*
+|* Beschreibung POLY.SDW
+|* Ersterstellung CL 27.01.93
+|* Letzte Aenderung CL 27.01.93
+|*
+*************************************************************************/
+
+XPolyPolygon::XPolyPolygon( sal_uInt16 nInitSize, sal_uInt16 nResize )
+{
+ DBG_CTOR(XPolyPolygon,NULL);
+ pImpXPolyPolygon = new ImpXPolyPolygon( nInitSize, nResize );
+}
+
+
+/*************************************************************************
+|*
+|* XPolyPolygon::XPolyPolygon()
+|*
+|* Beschreibung POLY.SDW
+|* Ersterstellung CL 27.01.93
+|* Letzte Aenderung CL 27.01.93
+|*
+*************************************************************************/
+
+XPolyPolygon::XPolyPolygon( const XPolygon& rXPoly )
+{
+ DBG_CTOR(XPolyPolygon,NULL);
+ pImpXPolyPolygon = new ImpXPolyPolygon;
+ pImpXPolyPolygon->aXPolyList.Insert( new XPolygon( rXPoly ) );
+}
+
+/*************************************************************************
+|*
+|* XPolyPolygon::XPolyPolygon()
+|*
+|* Beschreibung POLY.SDW
+|* Ersterstellung CL 27.01.93
+|* Letzte Aenderung CL 27.01.93
+|*
+*************************************************************************/
+
+XPolyPolygon::XPolyPolygon( const XPolyPolygon& rXPolyPoly )
+{
+ DBG_CTOR(XPolyPolygon,NULL);
+ pImpXPolyPolygon = rXPolyPoly.pImpXPolyPolygon;
+ pImpXPolyPolygon->nRefCount++;
+}
+
+/*************************************************************************
+|*
+|* XPolyPolygon::XPolyPolygon()
+|*
+|* XPolyPolygon aus einen Standard-PolyPolygon erzeugen
+|* Ersterstellung 18.01.95 ESO
+|* Letzte Aenderung 18.01.95 ESO
+|*
+*************************************************************************/
+
+XPolyPolygon::XPolyPolygon( const PolyPolygon& rPolyPoly )
+{
+ DBG_CTOR(XPolyPolygon,NULL);
+ pImpXPolyPolygon = new ImpXPolyPolygon;
+
+ for (sal_uInt16 i = 0; i < rPolyPoly.Count(); i++)
+ pImpXPolyPolygon->aXPolyList.Insert(
+ new XPolygon(rPolyPoly.GetObject(i)) );
+}
+
+/*************************************************************************
+|*
+|* XPolyPolygon::~XPolyPolygon()
+|*
+|* Beschreibung POLY.SDW
+|* Ersterstellung CL 27.01.93
+|* Letzte Aenderung CL 27.01.93
+|*
+*************************************************************************/
+
+XPolyPolygon::~XPolyPolygon()
+{
+ DBG_DTOR(XPolyPolygon,NULL);
+ if( pImpXPolyPolygon->nRefCount > 1 )
+ pImpXPolyPolygon->nRefCount--;
+ else
+ delete pImpXPolyPolygon;
+}
+
+/*************************************************************************
+|*
+|* XPolygon::CheckReference()
+|*
+|* Referenzzaehler desImpXPolyPoly pruefen und ggf. von diesem abkoppeln
+|* Ersterstellung 18.01.95 ESO
+|* Letzte Aenderung 18.01.95 ESO
+|*
+*************************************************************************/
+
+void XPolyPolygon::CheckReference()
+{
+ if( pImpXPolyPolygon->nRefCount > 1 )
+ {
+ pImpXPolyPolygon->nRefCount--;
+ pImpXPolyPolygon = new ImpXPolyPolygon( *pImpXPolyPolygon );
+ }
+}
+
+/*************************************************************************
+|*
+|* XPolyPolygon::Insert()
+|*
+|* Beschreibung POLY.SDW
+|* Ersterstellung CL 27.01.93
+|* Letzte Aenderung CL 27.01.93
+|*
+*************************************************************************/
+
+void XPolyPolygon::Insert( const XPolygon& rXPoly, sal_uInt16 nPos )
+{
+ CheckReference();
+ XPolygon* pXPoly = new XPolygon( rXPoly );
+ pImpXPolyPolygon->aXPolyList.Insert( pXPoly, nPos );
+}
+
+/*************************************************************************
+|*
+|* XPolyPolygon::Insert()
+|*
+|* saemtliche XPolygone aus einem XPolyPolygon einfuegen
+|* Ersterstellung 18.01.95 ESO
+|* Letzte Aenderung 18.01.95 ESO
+|*
+*************************************************************************/
+
+void XPolyPolygon::Insert( const XPolyPolygon& rXPolyPoly, sal_uInt16 nPos )
+{
+ CheckReference();
+
+ for (sal_uInt16 i = 0; i < rXPolyPoly.Count(); i++)
+ {
+ XPolygon* pXPoly = new XPolygon(rXPolyPoly[i]);
+ pImpXPolyPolygon->aXPolyList.Insert(pXPoly, nPos);
+ if ( nPos != XPOLYPOLY_APPEND )
+ nPos++;
+ }
+}
+
+/*************************************************************************
+|*
+|* XPolyPolygon::Remove()
+|*
+|* Beschreibung POLY.SDW
+|* Ersterstellung CL 27.01.93
+|* Letzte Aenderung CL 27.01.93
+|*
+*************************************************************************/
+
+XPolygon XPolyPolygon::Remove( sal_uInt16 nPos )
+{
+ CheckReference();
+ XPolygon* pTmpXPoly = pImpXPolyPolygon->aXPolyList.Remove( nPos );
+ XPolygon aXPoly( *pTmpXPoly );
+ delete pTmpXPoly;
+ return aXPoly;
+}
+
+
+/*************************************************************************
+|*
+|* XPolyPolygon::Replace()
+|*
+|* Beschreibung POLY.SDW
+|* Ersterstellung CL 27.01.93
+|* Letzte Aenderung CL 27.01.93
+|*
+*************************************************************************/
+
+XPolygon XPolyPolygon::Replace( const XPolygon& rXPoly, sal_uInt16 nPos )
+{
+ CheckReference();
+ XPolygon* pXPoly = new XPolygon( rXPoly );
+ XPolygon* pTmpXPoly = pImpXPolyPolygon->aXPolyList.Replace( pXPoly, nPos );
+ XPolygon aXPoly( *pTmpXPoly );
+ delete pTmpXPoly;
+ return aXPoly;
+}
+
+
+/*************************************************************************
+|*
+|* XPolyPolygon::GetObject()
+|*
+|* Beschreibung POLY.SDW
+|* Ersterstellung CL 27.01.93
+|* Letzte Aenderung CL 27.01.93
+|*
+*************************************************************************/
+
+const XPolygon& XPolyPolygon::GetObject( sal_uInt16 nPos ) const
+{
+ return *(pImpXPolyPolygon->aXPolyList.GetObject( nPos ));
+}
+
+
+/*************************************************************************
+|*
+|* XPolyPolygon::Clear()
+|*
+|* Beschreibung POLY.SDW
+|* Ersterstellung CL 27.01.93
+|* Letzte Aenderung TH 17.10.94
+|*
+*************************************************************************/
+
+void XPolyPolygon::Clear()
+{
+ if ( pImpXPolyPolygon->nRefCount > 1 )
+ {
+ pImpXPolyPolygon->nRefCount--;
+ pImpXPolyPolygon = new ImpXPolyPolygon();
+ }
+ else
+ {
+ XPolygon* pXPoly = pImpXPolyPolygon->aXPolyList.First();
+ while( pXPoly )
+ {
+ delete pXPoly;
+ pXPoly = pImpXPolyPolygon->aXPolyList.Next();
+ }
+ pImpXPolyPolygon->aXPolyList.Clear();
+ }
+}
+
+
+/*************************************************************************
+|*
+|* XPolyPolygon::Count()
+|*
+|* Beschreibung
+|* Ersterstellung CL 27.01.93
+|* Letzte Aenderung CL 27.01.93
+|*
+*************************************************************************/
+
+sal_uInt16 XPolyPolygon::Count() const
+{
+ return (sal_uInt16)(pImpXPolyPolygon->aXPolyList.Count());
+}
+
+
+/*************************************************************************
+|*
+|* XPolyPolygon::Move()
+|*
+|* Beschreibung POLY.SDW
+|* Ersterstellung TH 04.10.94
+|* Letzte Aenderung TH 04.10.94
+|*
+*************************************************************************/
+
+void XPolyPolygon::Move( long nHorzMove, long nVertMove )
+{
+ // Diese Abfrage sollte man fuer die DrawEngine durchfuehren
+ if ( !nHorzMove && !nVertMove )
+ return;
+
+ // Referenzcounter beruecksichtigen
+ CheckReference();
+
+ // Punkte verschieben
+ XPolygon* pXPoly = pImpXPolyPolygon->aXPolyList.First();
+ while( pXPoly )
+ {
+ pXPoly->Move( nHorzMove, nVertMove );
+ pXPoly = pImpXPolyPolygon->aXPolyList.Next();
+ }
+}
+
+/*************************************************************************
+|*
+|* XPolyPolygon::GetBoundRect()
+|*
+|* Beschreibung POLY.SDW
+|* Ersterstellung TH 04.10.94
+|* Letzte Aenderung TH 04.10.94
+|*
+*************************************************************************/
+
+Rectangle XPolyPolygon::GetBoundRect() const
+{
+ sal_uInt16 nXPoly = (sal_uInt16)pImpXPolyPolygon->aXPolyList.Count();
+ Rectangle aRect;
+
+ for ( sal_uInt16 n = 0; n < nXPoly; n++ )
+ {
+ const XPolygon* pXPoly = pImpXPolyPolygon->aXPolyList.GetObject( n );
+ aRect.Union( pXPoly->GetBoundRect() );
+ }
+
+ return aRect;
+}
+
+
+/*************************************************************************
+|*
+|* XPolyPolygon::operator[]()
+|*
+|* Beschreibung POLY.SDW
+|* Ersterstellung TH 28.10.94
+|* Letzte Aenderung TH 28.10.94
+|*
+*************************************************************************/
+
+XPolygon& XPolyPolygon::operator[]( sal_uInt16 nPos )
+{
+ CheckReference();
+ return *(pImpXPolyPolygon->aXPolyList.GetObject( nPos ));
+}
+
+/*************************************************************************
+|*
+|* XPolyPolygon::operator=()
+|*
+|* Beschreibung POLY.SDW
+|* Ersterstellung CL 27.01.93
+|* Letzte Aenderung CL 27.01.93
+|*
+*************************************************************************/
+
+XPolyPolygon& XPolyPolygon::operator=( const XPolyPolygon& rXPolyPoly )
+{
+ rXPolyPoly.pImpXPolyPolygon->nRefCount++;
+
+ if( pImpXPolyPolygon->nRefCount > 1 )
+ pImpXPolyPolygon->nRefCount--;
+ else
+ delete pImpXPolyPolygon;
+
+ pImpXPolyPolygon = rXPolyPoly.pImpXPolyPolygon;
+ return *this;
+}
+
+
+/*************************************************************************
+|*
+|* XPolyPolygon::operator==()
+|*
+|* Beschreibung POLY.SDW
+|* Ersterstellung CL 27.01.93
+|* Letzte Aenderung Joe 27.01.93
+|*
+*************************************************************************/
+
+sal_Bool XPolyPolygon::operator==( const XPolyPolygon& rXPolyPoly ) const
+{
+ if (pImpXPolyPolygon==rXPolyPoly.pImpXPolyPolygon) return sal_True;
+ return *pImpXPolyPolygon == *rXPolyPoly.pImpXPolyPolygon;
+}
+
+
+/*************************************************************************
+|*
+|* XPolyPolygon::operator!=()
+|*
+|* Beschreibung POLY.SDW
+|* Ersterstellung CL 27.01.93
+|* Letzte Aenderung Joe 27.01.93
+|*
+*************************************************************************/
+
+sal_Bool XPolyPolygon::operator!=( const XPolyPolygon& rXPolyPoly ) const
+{
+ if (pImpXPolyPolygon==rXPolyPoly.pImpXPolyPolygon) return sal_False;
+ return *pImpXPolyPolygon != *rXPolyPoly.pImpXPolyPolygon;
+}
+
+/*************************************************************************
+|*
+|* XPolyPolygon::Translate()
+|*
+|* Alle Polygone auf den uebergebenen Punkt verschieben
+|* Ersterstellung ESO 25.01.95
+|* Letzte Aenderung ESO 25.01.95
+|*
+*************************************************************************/
+
+void XPolyPolygon::Translate(const Point& rTrans)
+{
+ CheckReference();
+
+ for (sal_uInt16 i = 0; i < Count(); i++)
+ pImpXPolyPolygon->aXPolyList.GetObject(i)->Translate(rTrans);
+}
+
+/*************************************************************************
+|*
+|* XPolyPolygon::Rotate()
+|*
+|* Alle Polygone um den Punkt rCenter drehen, Sinus und Cosinus
+|* muessen uebergeben werden
+|* Ersterstellung ESO 25.01.95
+|* Letzte Aenderung ESO 25.01.95
+|*
+*************************************************************************/
+
+void XPolyPolygon::Rotate(const Point& rCenter, double fSin, double fCos)
+{
+ CheckReference();
+
+ for (sal_uInt16 i = 0; i < Count(); i++)
+ pImpXPolyPolygon->aXPolyList.GetObject(i)->Rotate(rCenter, fSin, fCos);
+}
+
+/*************************************************************************
+|*
+|* Bestimme den linken, unteren Punkt des Polygons und richte das
+|* Polygon so aus, dass dieser Punkt auf dem Index 0 liegt
+|*
+\************************************************************************/
+
+void XPolyPolygon::Rotate20()
+{
+ CheckReference();
+
+ for (sal_uInt16 i = 0; i < Count(); i++)
+ pImpXPolyPolygon->aXPolyList.GetObject(i)->Rotate20();
+}
+
+/*************************************************************************
+|*
+|* XPolyPolygon::Rotate()
+|*
+|* Alle Poylgone um den Punkt rCenter mit dem Winkel nAngle drehen
+|* Winkel in 10tel Grad, Wertebereich 0 - 3600
+|* Ersterstellung ESO 25.01.95
+|* Letzte Aenderung ESO 25.01.95
+|*
+*************************************************************************/
+
+void XPolyPolygon::Rotate(const Point& rCenter, sal_uInt16 nAngle)
+{
+ nAngle %= 3600;
+
+ if ( nAngle != 0 )
+ {
+ double fAngle = F_PI * nAngle / 1800;
+ double fSin = sin(fAngle);
+ double fCos = cos(fAngle);
+ Rotate(rCenter, fSin, fCos);
+ }
+}
+
+/*************************************************************************
+|*
+|* XPolyPolygon::Scale()
+|*
+|* Alle Polygone in X- und/oder Y-Richtung skalieren
+|* Ersterstellung ESO 01.02.95
+|* Letzte Aenderung ESO 01.02.95
+|*
+*************************************************************************/
+
+void XPolyPolygon::Scale(double fSx, double fSy)
+{
+ CheckReference();
+
+ for (sal_uInt16 i = 0; i < Count(); i++)
+ pImpXPolyPolygon->aXPolyList.GetObject(i)->Scale(fSx, fSy);
+}
+
+/*************************************************************************
+|*
+|* XPolyPolygon::SlantX()
+|*
+|* Alle Polygone in X-Richtung um einen beliebigen Winkel kippen,
+|* bezogen auf eine Referenz-Y-Koordinate
+|* Ersterstellung ESO 01.02.95
+|* Letzte Aenderung ESO 01.02.95
+|*
+*************************************************************************/
+
+void XPolyPolygon::SlantX(long nYRef, double fSin, double fCos)
+{
+ CheckReference();
+
+ for (sal_uInt16 i = 0; i < Count(); i++)
+ pImpXPolyPolygon->aXPolyList.GetObject(i)->SlantX(nYRef, fSin, fCos);
+}
+
+/*************************************************************************
+|*
+|* XPolyPolygon::SlantY()
+|*
+|* Alle Polygone in Y-Richtung um einen beliebigen Winkel kippen,
+|* bezogen auf eine Referenz-X-Koordinate
+|* Ersterstellung ESO 01.02.95
+|* Letzte Aenderung ESO 01.02.95
+|*
+*************************************************************************/
+
+void XPolyPolygon::SlantY(long nXRef, double fSin, double fCos)
+{
+ CheckReference();
+
+ for (sal_uInt16 i = 0; i < Count(); i++)
+ pImpXPolyPolygon->aXPolyList.GetObject(i)->SlantY(nXRef, fSin, fCos);
+}
+
+/*************************************************************************
+|*
+|* XPolygon::Distort()
+|*
+|* XPolygon verzerren, indem die Koordinaten relativ zu einem
+|* Referenzrechteck in ein beliebiges Viereck skaliert werden
+|* Zuordnung der Viereck-Punkte im Polygon zum Referenzrechteck:
+|* 0: links oben 0----1
+|* 1: rechts oben | |
+|* 2: rechts unten 3----2
+|* 3: links unten
+|* Ersterstellung ESO 07.07.95
+|* Letzte Aenderung ESO 07.07.95
+|*
+*************************************************************************/
+
+void XPolyPolygon::Distort(const Rectangle& rRefRect,
+ const XPolygon& rDistortedRect)
+{
+ CheckReference();
+
+ for (sal_uInt16 i = 0; i < Count(); i++)
+ pImpXPolyPolygon->aXPolyList.GetObject(i)->Distort(rRefRect,
+ rDistortedRect);
+}
+
+basegfx::B2DPolyPolygon XPolyPolygon::getB2DPolyPolygon() const
+{
+ basegfx::B2DPolyPolygon aRetval;
+
+ for(sal_uInt16 a(0L); a < Count(); a++)
+ {
+ const XPolygon& rPoly = (*this)[a];
+ aRetval.append(rPoly.getB2DPolygon());
+ }
+
+ return aRetval;
+}
+
+XPolyPolygon::XPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon)
+{
+ DBG_CTOR(XPolyPolygon,NULL);
+ pImpXPolyPolygon = new ImpXPolyPolygon( 16, 16 );
+
+ for(sal_uInt32 a(0L); a < rPolyPolygon.count(); a++)
+ {
+ basegfx::B2DPolygon aCandidate = rPolyPolygon.getB2DPolygon(a);
+ XPolygon aNewPoly(aCandidate);
+ Insert(aNewPoly);
+ }
+}
+
+// eof
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
new file mode 100644
index 000000000000..fedc43d228f5
--- /dev/null
+++ b/svx/source/xoutdev/xattr.cxx
@@ -0,0 +1,5778 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/drawing/Hatch.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/LineDash.hpp>
+#include <com/sun/star/drawing/DashStyle.hpp>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/drawing/PointSequence.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/awt/Gradient.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <svl/itempool.hxx>
+#include <editeng/memberids.hrc>
+#include <tools/stream.hxx>
+
+#include "svx/unoapi.hxx"
+#include <svl/style.hxx>
+#include "unopolyhelper.hxx"
+
+#include <tools/bigint.hxx>
+#include <svl/itemset.hxx>
+#include <svx/dialogs.hrc>
+#include "svx/svdstr.hrc"
+#include "svx/xattr.hxx"
+#include <svx/xtable.hxx>
+#include <svx/dialmgr.hxx>
+#include <editeng/itemtype.hxx>
+#include <svx/xdef.hxx>
+#include <svx/unomid.hxx>
+#include <svx/svdmodel.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+
+#include <stdio.h>
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+#define GLOBALOVERFLOW
+
+#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
+#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L))
+
+/************************************************************************/
+
+#define VCLTOSVCOL( rCol ) (sal_uInt16)((((sal_uInt16)(rCol))<<8)|(rCol))
+
+/************************************************************************/
+
+XubString aNameOrIndexEmptyString;
+
+TYPEINIT1_AUTOFACTORY(NameOrIndex, SfxStringItem);
+
+/*************************************************************************
+|*
+|*
+|*
+\*************************************************************************/
+
+long ScaleMetricValue( long nVal, long nMul, long nDiv )
+{
+ BigInt aVal( nVal );
+
+ aVal *= nMul;
+
+ if ( aVal.IsNeg() != ( nDiv < 0 ) )
+ aVal-=nDiv/2; // fuer korrektes Runden
+ else
+ aVal+=nDiv/2; // fuer korrektes Runden
+
+ aVal/=nDiv;
+
+ return long( aVal );
+}
+
+/*************************************************************************
+|*
+|* NameOrIndex::NameOrIndex(sal_uInt16 nWhich, sal_Int32 nIndex)
+|*
+|* Beschreibung
+|* Ersterstellung 14.11.94
+|* Letzte Aenderung 14.11.94
+|*
+*************************************************************************/
+
+NameOrIndex::NameOrIndex(sal_uInt16 _nWhich, sal_Int32 nIndex) :
+ SfxStringItem(_nWhich, aNameOrIndexEmptyString),
+ nPalIndex(nIndex)
+{
+}
+
+/*************************************************************************
+|*
+|* NameOrIndex::NameOrIndex(sal_uInt16 nWhich, const String& rName)
+|*
+|* Beschreibung
+|* Ersterstellung 14.11.94
+|* Letzte Aenderung 14.11.94
+|*
+*************************************************************************/
+
+NameOrIndex::NameOrIndex(sal_uInt16 _nWhich, const XubString& rName) :
+ SfxStringItem(_nWhich, rName),
+ nPalIndex(-1)
+{
+}
+
+/*************************************************************************
+|*
+|* NameOrIndex::NameOrIndex(sal_uInt16 nWhich, SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 14.11.94
+|* Letzte Aenderung 14.11.94
+|*
+*************************************************************************/
+
+NameOrIndex::NameOrIndex(sal_uInt16 _nWhich, SvStream& rIn) :
+ SfxStringItem(_nWhich, rIn)
+{
+ rIn >> nPalIndex;
+}
+
+/*************************************************************************
+|*
+|* NameOrIndex::NameOrIndex(const NameOrIndex& rNameOrIndex)
+|*
+|* Beschreibung
+|* Ersterstellung 14.11.94
+|* Letzte Aenderung 14.11.94
+|*
+*************************************************************************/
+
+NameOrIndex::NameOrIndex(const NameOrIndex& rNameOrIndex) :
+ SfxStringItem(rNameOrIndex),
+ nPalIndex(rNameOrIndex.nPalIndex)
+{
+}
+
+/*************************************************************************
+|*
+|* int NameOrIndex::operator==(const SfxPoolItem& rItem) const
+|*
+|* Beschreibung
+|* Ersterstellung 14.11.94
+|* Letzte Aenderung 14.11.94
+|*
+*************************************************************************/
+
+int NameOrIndex::operator==(const SfxPoolItem& rItem) const
+{
+ return ( SfxStringItem::operator==(rItem) &&
+ ((const NameOrIndex&) rItem).nPalIndex == nPalIndex );
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* NameOrIndex::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 14.11.94
+|* Letzte Aenderung 14.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* NameOrIndex::Clone(SfxItemPool* /*pPool*/) const
+{
+
+ return new NameOrIndex(*this);
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* NameOrIndex::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 14.11.94
+|* Letzte Aenderung 14.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* NameOrIndex::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new NameOrIndex(Which(), rIn);
+}
+
+/*************************************************************************
+|*
+|* SvStream* NameOrIndex::Store(SvStream& rIn) const
+|*
+|* Beschreibung
+|* Ersterstellung 14.11.94
+|* Letzte Aenderung 14.11.94
+|*
+*************************************************************************/
+
+SvStream& NameOrIndex::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
+{
+ SfxStringItem::Store( rOut, nItemVersion );
+ rOut << nPalIndex;
+ return rOut;
+}
+
+/** this static checks if the given NameOrIndex item has a unique name for its value.
+ The returned String is a unique name for an item with this value in both given pools.
+ Argument pPool2 can be null.
+ If returned string equals NameOrIndex->GetName(), the name was already unique.
+*/
+String NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uInt16 nWhich, const SfxItemPool* pPool1, const SfxItemPool* /*pPool2*/, SvxCompareValueFunc pCompareValueFunc, sal_uInt16 nPrefixResId, XPropertyList* pDefaults )
+{
+ sal_Bool bForceNew = sal_False;
+
+ String aUniqueName;
+ SvxUnogetInternalNameForItem( nWhich, pCheckItem->GetName(), aUniqueName );
+
+ // 2. if we have a name check if there is already an item with the
+ // same name in the documents pool with a different line end or start
+
+ if( aUniqueName.Len() && pPool1 )
+ {
+ const sal_uInt32 nCount = pPool1->GetItemCount2( nWhich );
+
+ const NameOrIndex *pItem;
+ for( sal_uInt32 nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
+ {
+ pItem = (NameOrIndex*)pPool1->GetItem2( nWhich, nSurrogate );
+
+ if( pItem && ( pItem->GetName() == pCheckItem->GetName() ) )
+ {
+ // if there is already an item with the same name and the same
+ // value its ok to set it
+ if( !pCompareValueFunc( pItem, pCheckItem ) )
+ {
+ // same name but different value, we need a new name for this item
+ aUniqueName = String();
+ bForceNew = sal_True;
+ }
+ break;
+ }
+ }
+ }
+
+ // if we have no name yet, find existing item with same conent or
+ // create a unique name
+ if( aUniqueName.Len() == 0 )
+ {
+ sal_Int32 nUserIndex = 1;
+ const ResId aRes(SVX_RES(nPrefixResId));
+ String aUser( aRes );
+ aUser += sal_Unicode( ' ' );
+
+ if( pDefaults )
+ {
+ const int nCount = pDefaults->Count();
+ int nIndex;
+ for( nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ XPropertyEntry* pEntry = pDefaults->Get( nIndex, 0 );
+ if( pEntry )
+ {
+ bool bFound = false;
+
+ switch( nWhich )
+ {
+ case XATTR_FILLBITMAP:
+ bFound = (((XFillBitmapItem*)pCheckItem)->GetBitmapValue().GetGraphicObject().GetUniqueID() ==
+ ((XBitmapEntry*)pEntry)->GetXBitmap().GetGraphicObject().GetUniqueID());
+ break;
+ case XATTR_LINEDASH:
+ bFound = (((XLineDashItem*)pCheckItem)->GetDashValue() == ((XDashEntry*)pEntry) ->GetDash());
+ break;
+ case XATTR_LINESTART:
+ bFound = (((XLineStartItem*)pCheckItem)->GetLineStartValue() == ((XLineEndEntry*)pEntry)->GetLineEnd());
+ break;
+ case XATTR_LINEEND:
+ bFound = (((XLineEndItem*)pCheckItem)->GetLineEndValue() == ((XLineEndEntry*)pEntry)->GetLineEnd());
+ break;
+ case XATTR_FILLGRADIENT:
+ bFound = (((XFillGradientItem*)pCheckItem)->GetGradientValue() == ((XGradientEntry*)pEntry)->GetGradient());
+ break;
+ case XATTR_FILLHATCH:
+ bFound = (((XFillHatchItem*)pCheckItem)->GetHatchValue() == ((XHatchEntry*)pEntry)->GetHatch());
+ break;
+ }
+
+ if( bFound )
+ {
+ aUniqueName = pEntry->GetName();
+ break;
+ }
+ else
+ {
+ sal_Int32 nThisIndex = pEntry->GetName().Copy( aUser.Len() ).ToInt32();
+ if( nThisIndex >= nUserIndex )
+ nUserIndex = nThisIndex + 1;
+ }
+ }
+ }
+ }
+
+ if( (aUniqueName.Len() == 0) && pPool1 )
+ {
+ const sal_uInt32 nCount = pPool1->GetItemCount2( nWhich );
+ const NameOrIndex *pItem;
+ for( sal_uInt32 nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
+ {
+ pItem = (NameOrIndex*)pPool1->GetItem2( nWhich, nSurrogate );
+
+ if( pItem && pItem->GetName().Len() )
+ {
+ if( !bForceNew && pCompareValueFunc( pItem, pCheckItem ) )
+ return pItem->GetName();
+
+ if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 )
+ {
+ sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32();
+ if( nThisIndex >= nUserIndex )
+ nUserIndex = nThisIndex + 1;
+ }
+ }
+ }
+ aUniqueName = aUser;
+ aUniqueName += String::CreateFromInt32( nUserIndex );
+ }
+ }
+
+ return aUniqueName;
+}
+
+//*************************************************************************
+
+// -------------------
+// class XColorItem
+// -------------------
+TYPEINIT1_AUTOFACTORY(XColorItem, NameOrIndex);
+
+/*************************************************************************
+|*
+|* XColorItem::XColorItem(sal_uInt16 nWhich, sal_Int32 nIndex, const Color& rTheColor)
+|*
+\************************************************************************/
+
+XColorItem::XColorItem(sal_uInt16 _nWhich, sal_Int32 nIndex, const Color& rTheColor) :
+ NameOrIndex(_nWhich, nIndex),
+ aColor(rTheColor)
+{
+}
+
+/*************************************************************************
+|*
+|* XColorItem::XColorItem(sal_uInt16 nWhich, const String& rName, const Color& rTheColor)
+|*
+\************************************************************************/
+
+XColorItem::XColorItem(sal_uInt16 _nWhich, const XubString& rName, const Color& rTheColor) :
+ NameOrIndex(_nWhich, rName),
+ aColor(rTheColor)
+{
+}
+
+/*************************************************************************
+|*
+|* XColorItem::XColorItem(const XColorItem& rItem)
+|*
+\************************************************************************/
+
+XColorItem::XColorItem(const XColorItem& rItem) :
+ NameOrIndex(rItem),
+ aColor(rItem.aColor)
+{
+}
+
+/*************************************************************************
+|*
+|* XColorItem::XColorItem(sal_uInt16 nWhich, SvStream& rIn)
+|*
+\************************************************************************/
+
+XColorItem::XColorItem(sal_uInt16 _nWhich, SvStream& rIn) :
+ NameOrIndex(_nWhich, rIn)
+{
+ if (!IsIndex())
+ {
+ rIn >> aColor;
+ }
+}
+
+/*************************************************************************
+|*
+|* XColorItem::Clone(SfxItemPool* pPool) const
+|*
+\************************************************************************/
+
+SfxPoolItem* XColorItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XColorItem(*this);
+}
+
+/*************************************************************************
+|*
+|* int XColorItem::operator==(const SfxPoolItem& rItem) const
+|*
+\************************************************************************/
+
+int XColorItem::operator==(const SfxPoolItem& rItem) const
+{
+ return ( NameOrIndex::operator==(rItem) &&
+ ((const XColorItem&) rItem).aColor == aColor );
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XColorItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+\************************************************************************/
+
+SfxPoolItem* XColorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XColorItem(Which(), rIn);
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XColorItem::Store(SvStream& rOut) const
+|*
+\************************************************************************/
+
+SvStream& XColorItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
+{
+ NameOrIndex::Store( rOut, nItemVersion );
+
+ if ( !IsIndex() )
+ {
+ rOut << aColor;
+ }
+
+ return rOut;
+}
+
+/*************************************************************************
+|*
+|* const XColor& XColorItem::GetColorValue(const XColorTable* pTable) const
+|*
+\************************************************************************/
+
+const Color& XColorItem::GetColorValue(const XColorTable* pTable) const
+{
+ if (!IsIndex())
+ return aColor;
+ else
+ return pTable->GetColor(GetIndex())->GetColor();
+
+}
+
+sal_Bool XColorItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (sal_Int32)GetColorValue().GetRGBColor();
+ return sal_True;
+}
+
+sal_Bool XColorItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ sal_Int32 nValue = 0;
+ rVal >>= nValue;
+ SetColorValue( nValue );
+
+ return sal_True;
+}
+
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// Linienattribute
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//---------------------
+// class XLineStyleItem
+//---------------------
+TYPEINIT1_AUTOFACTORY(XLineStyleItem, SfxEnumItem);
+
+/*************************************************************************
+|*
+|* XLineStyleItem::XLineStyleItem(XLineStyle eTheLineStyle)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 18.11.94
+|*
+*************************************************************************/
+
+XLineStyleItem::XLineStyleItem(XLineStyle eTheLineStyle) :
+ SfxEnumItem(XATTR_LINESTYLE, sal::static_int_cast< sal_uInt16 >(eTheLineStyle))
+{
+}
+
+/*************************************************************************
+|*
+|* XLineStyleItem::XLineStyleItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XLineStyleItem::XLineStyleItem(SvStream& rIn) :
+ SfxEnumItem(XATTR_LINESTYLE, rIn)
+{
+}
+
+/*************************************************************************
+|*
+|* XLineStyleItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 09.11.94
+|* Letzte Aenderung 09.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XLineStyleItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XLineStyleItem( *this );
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XLineStyleItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XLineStyleItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XLineStyleItem(rIn);
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation XLineStyleItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ rText.Erase();
+
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ return ePres;
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ {
+ sal_uInt16 nId = 0;
+
+ switch( (sal_uInt16)GetValue() )
+ {
+ case XLINE_NONE:
+ nId = RID_SVXSTR_INVISIBLE;
+ break;
+ case XLINE_SOLID:
+ nId = RID_SVXSTR_SOLID;
+ break;
+ }
+
+ if ( nId )
+ rText = SVX_RESSTR( nId );
+ return ePres;
+ }
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+sal_Bool XLineStyleItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ ::com::sun::star::drawing::LineStyle eLS = (::com::sun::star::drawing::LineStyle)GetValue();
+ rVal <<= eLS;
+ return sal_True;
+}
+
+sal_Bool XLineStyleItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ ::com::sun::star::drawing::LineStyle eLS;
+ if(!(rVal >>= eLS ))
+ {
+ // also try an int (for Basic)
+ sal_Int32 nLS = 0;
+ if(!(rVal >>= nLS))
+ return sal_False;
+ eLS = (::com::sun::star::drawing::LineStyle)nLS;
+ }
+
+ SetValue( sal::static_int_cast< sal_uInt16 >( eLS ) );
+ return sal_True;
+}
+
+//------------------------------------------------------------------------
+
+sal_uInt16 XLineStyleItem::GetValueCount() const
+{
+ return 3;
+}
+
+
+// ------------
+// class XDash
+// ------------
+/*************************************************************************
+|*
+|* XDash::XDash(XDashStyle, sal_uInt16, sal_uIntPtr, sal_uInt16, sal_uIntPtr, sal_uIntPtr)
+|*
+|* Beschreibung
+|* Ersterstellung 21.11.94
+|* Letzte Aenderung 21.11.94
+|*
+*************************************************************************/
+
+XDash::XDash(XDashStyle eTheDash, sal_uInt16 nTheDots, sal_uIntPtr nTheDotLen,
+ sal_uInt16 nTheDashes, sal_uIntPtr nTheDashLen, sal_uIntPtr nTheDistance) :
+ eDash(eTheDash),
+ nDots(nTheDots),
+ nDotLen(nTheDotLen),
+ nDashes(nTheDashes),
+ nDashLen(nTheDashLen),
+ nDistance(nTheDistance)
+{
+}
+
+/*************************************************************************
+|*
+|* int XDash::operator==(const SfxPoolItem& rItem) const
+|*
+|* Beschreibung
+|* Ersterstellung 29.11.94
+|* Letzte Aenderung 29.11.94
+|*
+*************************************************************************/
+
+bool XDash::operator==(const XDash& rDash) const
+{
+ return ( eDash == rDash.eDash &&
+ nDots == rDash.nDots &&
+ nDotLen == rDash.nDotLen &&
+ nDashes == rDash.nDashes &&
+ nDashLen == rDash.nDashLen &&
+ nDistance == rDash.nDistance );
+}
+
+// XDash is translated into an array of doubles which describe the lengths of the
+// dashes, dots and empty passages. It returns the complete length of the full DashDot
+// sequence and fills the given vetor of doubles accordingly (also resizing, so deleting it).
+static double SMALLEST_DASH_WIDTH(26.95);
+double XDash::CreateDotDashArray(::std::vector< double >& rDotDashArray, double fLineWidth) const
+{
+ double fFullDotDashLen(0.0);
+ const sal_uInt16 nNumDotDashArray = (GetDots() + GetDashes()) * 2;
+ rDotDashArray.resize( nNumDotDashArray, 0.0 );
+ sal_uInt16 a;
+ sal_uInt16 nIns(0);
+ double fDashDotDistance = (double)GetDistance();
+ double fSingleDashLen = (double)GetDashLen();
+ double fSingleDotLen = (double)GetDotLen();
+
+ if(GetDashStyle() == XDASH_RECTRELATIVE || GetDashStyle() == XDASH_ROUNDRELATIVE)
+ {
+ if(fLineWidth != 0.0)
+ {
+ double fFactor = fLineWidth / 100.0;
+
+ if(GetDashes())
+ {
+ if(GetDashLen())
+ {
+ // is a dash
+ fSingleDashLen *= fFactor;
+ }
+ else
+ {
+ // is a dot
+ fSingleDashLen = fLineWidth;
+ }
+ }
+
+ if(GetDots())
+ {
+ if(GetDotLen())
+ {
+ // is a dash
+ fSingleDotLen *= fFactor;
+ }
+ else
+ {
+ // is a dot
+ fSingleDotLen = fLineWidth;
+ }
+ }
+
+ if(GetDashes() || GetDots())
+ {
+ if(GetDistance())
+ {
+ fDashDotDistance *= fFactor;
+ }
+ else
+ {
+ fDashDotDistance = fLineWidth;
+ }
+ }
+ }
+ else
+ {
+ if(GetDashes())
+ {
+ if(GetDashLen())
+ {
+ // is a dash
+ fSingleDashLen = (SMALLEST_DASH_WIDTH * fSingleDashLen) / 100.0;
+ }
+ else
+ {
+ // is a dot
+ fSingleDashLen = SMALLEST_DASH_WIDTH;
+ }
+ }
+
+ if(GetDots())
+ {
+ if(GetDotLen())
+ {
+ // is a dash
+ fSingleDotLen = (SMALLEST_DASH_WIDTH * fSingleDotLen) / 100.0;
+ }
+ else
+ {
+ // is a dot
+ fSingleDotLen = SMALLEST_DASH_WIDTH;
+ }
+ }
+
+ if(GetDashes() || GetDots())
+ {
+ if(GetDistance())
+ {
+ // dash as distance
+ fDashDotDistance = (SMALLEST_DASH_WIDTH * fDashDotDistance) / 100.0;
+ }
+ else
+ {
+ // dot as distance
+ fDashDotDistance = SMALLEST_DASH_WIDTH;
+ }
+ }
+ }
+ }
+ else
+ {
+ // smallest dot size compare value
+ double fDotCompVal(fLineWidth != 0.0 ? fLineWidth : SMALLEST_DASH_WIDTH);
+
+ // absolute values
+ if(GetDashes())
+ {
+ if(GetDashLen())
+ {
+ // is a dash
+ if(fSingleDashLen < SMALLEST_DASH_WIDTH)
+ {
+ fSingleDashLen = SMALLEST_DASH_WIDTH;
+ }
+ }
+ else
+ {
+ // is a dot
+ if(fSingleDashLen < fDotCompVal)
+ {
+ fSingleDashLen = fDotCompVal;
+ }
+ }
+ }
+
+ if(GetDots())
+ {
+ if(GetDotLen())
+ {
+ // is a dash
+ if(fSingleDotLen < SMALLEST_DASH_WIDTH)
+ {
+ fSingleDotLen = SMALLEST_DASH_WIDTH;
+ }
+ }
+ else
+ {
+ // is a dot
+ if(fSingleDotLen < fDotCompVal)
+ {
+ fSingleDotLen = fDotCompVal;
+ }
+ }
+ }
+
+ if(GetDashes() || GetDots())
+ {
+ if(GetDistance())
+ {
+ // dash as distance
+ if(fDashDotDistance < SMALLEST_DASH_WIDTH)
+ {
+ fDashDotDistance = SMALLEST_DASH_WIDTH;
+ }
+ }
+ else
+ {
+ // dot as distance
+ if(fDashDotDistance < fDotCompVal)
+ {
+ fDashDotDistance = fDotCompVal;
+ }
+ }
+ }
+ }
+
+ for(a=0;a<GetDots();a++)
+ {
+ rDotDashArray[nIns++] = fSingleDotLen;
+ fFullDotDashLen += fSingleDotLen;
+ rDotDashArray[nIns++] = fDashDotDistance;
+ fFullDotDashLen += fDashDotDistance;
+ }
+
+ for(a=0;a<GetDashes();a++)
+ {
+ rDotDashArray[nIns++] = fSingleDashLen;
+ fFullDotDashLen += fSingleDashLen;
+ rDotDashArray[nIns++] = fDashDotDistance;
+ fFullDotDashLen += fDashDotDistance;
+ }
+
+ return fFullDotDashLen;
+}
+
+// -------------------
+// class XLineDashItem
+// -------------------
+TYPEINIT1_AUTOFACTORY(XLineDashItem, NameOrIndex);
+
+/*************************************************************************
+|*
+|* XLineDashItem::XLineDashItem(sal_Int32 nIndex, const XDash& rTheDash)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XLineDashItem::XLineDashItem(sal_Int32 nIndex, const XDash& rTheDash) :
+ NameOrIndex(XATTR_LINEDASH, nIndex),
+ aDash(rTheDash)
+{
+}
+
+/*************************************************************************
+|*
+|* XLineDashItem::XLineDashItem(const String& rName, const XDash& rTheDash)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XLineDashItem::XLineDashItem(const XubString& rName, const XDash& rTheDash) :
+ NameOrIndex(XATTR_LINEDASH, rName),
+ aDash(rTheDash)
+{
+}
+
+/*************************************************************************
+|*
+|* XLineDashItem::XLineDashItem(const XLineDashItem& rItem)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XLineDashItem::XLineDashItem(const XLineDashItem& rItem) :
+ NameOrIndex(rItem),
+ aDash(rItem.aDash)
+{
+}
+
+/*************************************************************************
+|*
+|* XLineDashItem::XLineDashItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XLineDashItem::XLineDashItem(SvStream& rIn) :
+ NameOrIndex(XATTR_LINEDASH, rIn)
+{
+ if (!IsIndex())
+ {
+ sal_uInt16 nSTemp;
+ sal_uInt32 nLTemp;
+ sal_Int32 nITemp;
+
+ rIn >> nITemp; aDash.SetDashStyle((XDashStyle)nITemp);
+ rIn >> nSTemp; aDash.SetDots(nSTemp);
+ rIn >> nLTemp; aDash.SetDotLen(nLTemp);
+ rIn >> nSTemp; aDash.SetDashes(nSTemp);
+ rIn >> nLTemp; aDash.SetDashLen(nLTemp);
+ rIn >> nLTemp; aDash.SetDistance(nLTemp);
+ }
+}
+
+//*************************************************************************
+
+XLineDashItem::XLineDashItem(SfxItemPool* /*pPool*/, const XDash& rTheDash)
+: NameOrIndex( XATTR_LINEDASH, -1 ),
+ aDash(rTheDash)
+{
+}
+
+//*************************************************************************
+
+XLineDashItem::XLineDashItem(SfxItemPool* /*pPool*/)
+: NameOrIndex(XATTR_LINEDASH, -1 )
+{
+}
+
+/*************************************************************************
+|*
+|* XLineDashItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XLineDashItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XLineDashItem(*this);
+}
+
+/*************************************************************************
+|*
+|* int XLineDashItem::operator==(const SfxPoolItem& rItem) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+int XLineDashItem::operator==(const SfxPoolItem& rItem) const
+{
+ return ( NameOrIndex::operator==(rItem) &&
+ aDash == ((const XLineDashItem&) rItem).aDash );
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XLineDashItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XLineDashItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XLineDashItem(rIn);
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XLineDashItem::Store(SvStream& rOut) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SvStream& XLineDashItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
+{
+ NameOrIndex::Store( rOut, nItemVersion );
+
+ if (!IsIndex())
+ {
+ rOut << (sal_Int32) aDash.GetDashStyle();
+ rOut << aDash.GetDots();
+ rOut << (sal_uInt32) aDash.GetDotLen();
+ rOut << aDash.GetDashes();
+ rOut << (sal_uInt32) aDash.GetDashLen();
+ rOut << (sal_uInt32) aDash.GetDistance();
+ }
+
+ return rOut;
+}
+
+/*************************************************************************
+|*
+|* const XDash& XLineDashItem::GetValue(const XDashTable* pTable) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 18.11.94
+|*
+*************************************************************************/
+
+const XDash& XLineDashItem::GetDashValue(const XDashTable* pTable) const // GetValue -> GetDashValue
+{
+ if (!IsIndex())
+ return aDash;
+ else
+ return pTable->GetDash(GetIndex())->GetDash();
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation XLineDashItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return ePres;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText = GetName();
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+//------------------------------------------------------------------------
+
+FASTBOOL XLineDashItem::HasMetrics() const
+{
+ return sal_True;
+}
+
+//------------------------------------------------------------------------
+
+FASTBOOL XLineDashItem::ScaleMetrics(long nMul, long nDiv)
+{
+ aDash.SetDotLen( ScaleMetricValue( aDash.GetDotLen(), nMul, nDiv ) );
+ aDash.SetDashLen( ScaleMetricValue( aDash.GetDashLen(), nMul, nDiv ) );
+ aDash.SetDistance( ScaleMetricValue( aDash.GetDistance(), nMul, nDiv ) );
+ return sal_True;
+}
+
+sal_Bool XLineDashItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+
+ switch ( nMemberId )
+ {
+ case 0:
+ {
+ uno::Sequence< beans::PropertyValue > aPropSeq( 2 );
+
+ ::com::sun::star::drawing::LineDash aLineDash;
+
+ const XDash& rXD = GetDashValue();
+ aLineDash.Style = (::com::sun::star::drawing::DashStyle)((sal_uInt16)rXD.GetDashStyle());
+ aLineDash.Dots = rXD.GetDots();
+ aLineDash.DotLen = rXD.GetDotLen();
+ aLineDash.Dashes = rXD.GetDashes();
+ aLineDash.DashLen = rXD.GetDashLen();
+ aLineDash.Distance = rXD.GetDistance();
+
+ rtl::OUString aApiName;
+ SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
+ aPropSeq[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ));
+ aPropSeq[0].Value = uno::makeAny( aApiName );
+ aPropSeq[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LineDash" ));
+ aPropSeq[1].Value = uno::makeAny( aLineDash );
+ rVal = uno::makeAny( aPropSeq );
+ break;
+ }
+
+ case MID_NAME:
+ {
+ rtl::OUString aApiName;
+ SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
+ rVal <<= aApiName;
+ break;
+ }
+
+ case MID_LINEDASH:
+ {
+ const XDash& rXD = GetDashValue();
+
+ ::com::sun::star::drawing::LineDash aLineDash;
+
+ aLineDash.Style = (::com::sun::star::drawing::DashStyle)((sal_uInt16)rXD.GetDashStyle());
+ aLineDash.Dots = rXD.GetDots();
+ aLineDash.DotLen = rXD.GetDotLen();
+ aLineDash.Dashes = rXD.GetDashes();
+ aLineDash.DashLen = rXD.GetDashLen();
+ aLineDash.Distance = rXD.GetDistance();
+
+ rVal <<= aLineDash;
+ break;
+ }
+
+ case MID_LINEDASH_STYLE:
+ {
+ const XDash& rXD = GetDashValue();
+ rVal <<= (::com::sun::star::drawing::DashStyle)((sal_Int16)rXD.GetDashStyle());
+ break;
+ }
+
+ case MID_LINEDASH_DOTS:
+ {
+ const XDash& rXD = GetDashValue();
+ rVal <<= rXD.GetDots();
+ break;
+ }
+
+ case MID_LINEDASH_DOTLEN:
+ {
+ const XDash& rXD = GetDashValue();
+ rVal <<= rXD.GetDotLen();
+ break;
+ }
+
+ case MID_LINEDASH_DASHES:
+ {
+ const XDash& rXD = GetDashValue();
+ rVal <<= rXD.GetDashes();
+ break;
+ }
+
+ case MID_LINEDASH_DASHLEN:
+ {
+ const XDash& rXD = GetDashValue();
+ rVal <<= rXD.GetDashLen();
+ break;
+ }
+
+ case MID_LINEDASH_DISTANCE:
+ {
+ const XDash& rXD = GetDashValue();
+ rVal <<= rXD.GetDistance();
+ break;
+ }
+
+ default: DBG_ERROR("Wrong MemberId!"); return sal_False;
+ }
+
+ return sal_True;
+}
+
+sal_Bool XLineDashItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
+{
+// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+
+ switch ( nMemberId )
+ {
+ case 0:
+ {
+ uno::Sequence< beans::PropertyValue > aPropSeq;
+ ::com::sun::star::drawing::LineDash aLineDash;
+ rtl::OUString aName;
+ sal_Bool bLineDash( sal_False );
+
+ if ( rVal >>= aPropSeq )
+ {
+ for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ )
+ {
+ if ( aPropSeq[n].Name.equalsAsciiL( "Name", 4 ))
+ aPropSeq[n].Value >>= aName;
+ else if ( aPropSeq[n].Name.equalsAsciiL( "LineDash", 8 ))
+ {
+ if ( aPropSeq[n].Value >>= aLineDash )
+ bLineDash = sal_True;
+ }
+ }
+
+ SetName( aName );
+ if ( bLineDash )
+ {
+ XDash aXDash;
+
+ aXDash.SetDashStyle((XDashStyle)((sal_uInt16)(aLineDash.Style)));
+ aXDash.SetDots(aLineDash.Dots);
+ aXDash.SetDotLen(aLineDash.DotLen);
+ aXDash.SetDashes(aLineDash.Dashes);
+ aXDash.SetDashLen(aLineDash.DashLen);
+ aXDash.SetDistance(aLineDash.Distance);
+
+ if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
+ aXDash.SetDots(1);
+
+ SetDashValue( aXDash );
+ }
+
+ return sal_True;
+ }
+
+ return sal_False;
+ }
+
+ case MID_NAME:
+ {
+ rtl::OUString aName;
+ if (!(rVal >>= aName))
+ return sal_False;
+ SetName( aName );
+ break;
+ }
+
+ case MID_LINEDASH:
+ {
+ ::com::sun::star::drawing::LineDash aLineDash;
+ if(!(rVal >>= aLineDash))
+ return sal_False;
+
+ XDash aXDash;
+
+ aXDash.SetDashStyle((XDashStyle)((sal_uInt16)(aLineDash.Style)));
+ aXDash.SetDots(aLineDash.Dots);
+ aXDash.SetDotLen(aLineDash.DotLen);
+ aXDash.SetDashes(aLineDash.Dashes);
+ aXDash.SetDashLen(aLineDash.DashLen);
+ aXDash.SetDistance(aLineDash.Distance);
+
+ if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
+ aXDash.SetDots(1);
+
+ SetDashValue( aXDash );
+ break;
+ }
+
+ case MID_LINEDASH_STYLE:
+ {
+ sal_Int16 nVal = sal_Int16();
+ if(!(rVal >>= nVal))
+ return sal_False;
+
+ XDash aXDash = GetDashValue();
+ aXDash.SetDashStyle((XDashStyle)((sal_uInt16)(nVal)));
+
+ if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
+ aXDash.SetDots(1);
+
+ SetDashValue( aXDash );
+
+ break;
+ }
+
+ case MID_LINEDASH_DOTS:
+ case MID_LINEDASH_DASHES:
+ {
+ sal_Int16 nVal = sal_Int16();
+ if(!(rVal >>= nVal))
+ return sal_False;
+
+ XDash aXDash = GetDashValue();
+ if ( nMemberId == MID_LINEDASH_DOTS )
+ aXDash.SetDots( nVal );
+ else
+ aXDash.SetDashes( nVal );
+
+ if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
+ aXDash.SetDots(1);
+
+ SetDashValue( aXDash );
+ break;
+ }
+
+ case MID_LINEDASH_DOTLEN:
+ case MID_LINEDASH_DASHLEN:
+ case MID_LINEDASH_DISTANCE:
+ {
+ sal_Int32 nVal = 0;
+ if(!(rVal >>= nVal))
+ return sal_False;
+
+ XDash aXDash = GetDashValue();
+ if ( nMemberId == MID_LINEDASH_DOTLEN )
+ aXDash.SetDotLen( nVal );
+ else if ( nMemberId == MID_LINEDASH_DASHLEN )
+ aXDash.SetDashLen( nVal );
+ else
+ aXDash.SetDistance( nVal );
+
+ if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
+ aXDash.SetDots(1);
+
+ SetDashValue( aXDash );
+ break;
+ }
+ }
+
+ return sal_True;
+}
+
+sal_Bool XLineDashItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
+{
+ return ((XLineDashItem*)p1)->GetDashValue() == ((XLineDashItem*)p2)->GetDashValue();
+}
+
+XLineDashItem* XLineDashItem::checkForUniqueItem( SdrModel* pModel ) const
+{
+ if( pModel )
+ {
+ const String aUniqueName = NameOrIndex::CheckNamedItem( this,
+ XATTR_LINEDASH,
+ &pModel->GetItemPool(),
+ pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL,
+ XLineDashItem::CompareValueFunc,
+ RID_SVXSTR_DASH11,
+ pModel->GetDashList() );
+
+ // if the given name is not valid, replace it!
+ if( aUniqueName != GetName() )
+ {
+ return new XLineDashItem( aUniqueName, aDash );
+ }
+ }
+
+ return (XLineDashItem*)this;
+}
+
+// -------------------
+// class XLineWidthItem
+// -------------------
+TYPEINIT1_AUTOFACTORY(XLineWidthItem, SfxMetricItem);
+
+/*************************************************************************
+|*
+|* XLineWidthItem::XLineWidthItem(long nWidth)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 18.11.94
+|*
+*************************************************************************/
+
+XLineWidthItem::XLineWidthItem(long nWidth) :
+ SfxMetricItem(XATTR_LINEWIDTH, nWidth)
+{
+}
+
+/*************************************************************************
+|*
+|* XLineWidthItem::XLineWidthItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XLineWidthItem::XLineWidthItem(SvStream& rIn) :
+ SfxMetricItem(XATTR_LINEWIDTH, rIn)
+{
+}
+
+/*************************************************************************
+|*
+|* XLineWidthItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XLineWidthItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XLineWidthItem(*this);
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XLineWidthItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XLineWidthItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XLineWidthItem(rIn);
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation XLineWidthItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit eCoreUnit,
+ SfxMapUnit ePresUnit,
+ XubString& rText, const IntlWrapper * pIntl
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return ePres;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText = GetMetricText( (long) GetValue(),
+ eCoreUnit, ePresUnit, pIntl);
+ rText += SVX_RESSTR( GetMetricId( ePresUnit) );
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+sal_Bool XLineWidthItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+ sal_Int32 nValue = GetValue();
+ if( 0 != (nMemberId&CONVERT_TWIPS) )
+ nValue = TWIP_TO_MM100(nValue);
+
+ rVal <<= nValue;
+ return sal_True;
+}
+
+sal_Bool XLineWidthItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
+{
+ sal_Int32 nValue = 0;
+ rVal >>= nValue;
+ if( 0 != (nMemberId&CONVERT_TWIPS) )
+ nValue = MM100_TO_TWIP(nValue);
+
+ SetValue( nValue );
+ return sal_True;
+}
+
+// -------------------
+// class XLineColorItem
+// -------------------
+TYPEINIT1_AUTOFACTORY(XLineColorItem, XColorItem);
+
+/*************************************************************************
+|*
+|* XLineColorItem::XLineColorItem(sal_Int32 nIndex, const Color& rTheColor)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XLineColorItem::XLineColorItem(sal_Int32 nIndex, const Color& rTheColor) :
+ XColorItem(XATTR_LINECOLOR, nIndex, rTheColor)
+{
+}
+
+/*************************************************************************
+|*
+|* XLineColorItem::XLineColorItem(const XubString& rName, const Color& rTheColor)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XLineColorItem::XLineColorItem(const XubString& rName, const Color& rTheColor) :
+ XColorItem(XATTR_LINECOLOR, rName, rTheColor)
+{
+}
+
+/*************************************************************************
+|*
+|* XLineColorItem::XLineColorItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XLineColorItem::XLineColorItem(SvStream& rIn) :
+ XColorItem(XATTR_LINECOLOR, rIn)
+{
+}
+
+/*************************************************************************
+|*
+|* XLineColorItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XLineColorItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XLineColorItem(*this);
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XLineColorItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XLineColorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XLineColorItem(rIn);
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation XLineColorItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return ePres;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText = GetName();
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+sal_Bool XLineColorItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (sal_Int32)GetColorValue().GetRGBColor();
+ return sal_True;
+}
+
+sal_Bool XLineColorItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ sal_Int32 nValue = 0;
+ if(!(rVal >>= nValue))
+ return sal_False;
+
+ SetColorValue( nValue );
+ return sal_True;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// tooling for simple spooling B2DPolygon to file and back
+
+namespace
+{
+ void streamOutB2DPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon, SvStream& rOut)
+ {
+ const sal_uInt32 nPolygonCount(rPolyPolygon.count());
+ rOut << nPolygonCount;
+
+ for(sal_uInt32 a(0L); a < nPolygonCount; a++)
+ {
+ const basegfx::B2DPolygon aCandidate(rPolyPolygon.getB2DPolygon(a));
+ const sal_uInt32 nPointCount(aCandidate.count());
+ const sal_uInt8 bClosed(aCandidate.isClosed() ? 1 : 0);
+ const sal_uInt8 bControlPoints(aCandidate.areControlPointsUsed() ? 1 : 0);
+ rOut << nPointCount;
+ rOut << bClosed;
+ rOut << bControlPoints;
+
+ for(sal_uInt32 b(0L); b < nPointCount; b++)
+ {
+ const basegfx::B2DPoint aPoint(aCandidate.getB2DPoint(b));
+ rOut << aPoint.getX();
+ rOut << aPoint.getY();
+
+ if(bControlPoints)
+ {
+ const sal_uInt8 bEdgeIsCurve(aCandidate.isPrevControlPointUsed(b) || aCandidate.isNextControlPointUsed(b) ? 1 : 0);
+ rOut << bEdgeIsCurve;
+
+ if(bEdgeIsCurve)
+ {
+ const basegfx::B2DVector aControlVectorA(aCandidate.getPrevControlPoint(b));
+ rOut << aControlVectorA.getX();
+ rOut << aControlVectorA.getY();
+
+ const basegfx::B2DVector aControlVectorB(aCandidate.getNextControlPoint(b));
+ rOut << aControlVectorB.getX();
+ rOut << aControlVectorB.getY();
+ }
+ }
+ }
+ }
+ }
+
+ basegfx::B2DPolyPolygon streamInB2DPolyPolygon(SvStream& rIn)
+ {
+ basegfx::B2DPolyPolygon aRetval;
+ sal_uInt32 nPolygonCount;
+ rIn >> nPolygonCount;
+
+ for(sal_uInt32 a(0L); a < nPolygonCount; a++)
+ {
+ sal_uInt32 nPointCount;
+ sal_uInt8 bClosed;
+ sal_uInt8 bControlPoints;
+
+ rIn >> nPointCount;
+ rIn >> bClosed;
+ rIn >> bControlPoints;
+
+ basegfx::B2DPolygon aCandidate;
+ aCandidate.setClosed(0 != bClosed);
+
+ for(sal_uInt32 b(0L); b < nPointCount; b++)
+ {
+ double fX, fY;
+ rIn >> fX;
+ rIn >> fY;
+ aCandidate.append(basegfx::B2DPoint(fX, fY));
+
+ if(0 != bControlPoints)
+ {
+ sal_uInt8 bEdgeIsCurve;
+ rIn >> bEdgeIsCurve;
+
+ if(0 != bEdgeIsCurve)
+ {
+ rIn >> fX;
+ rIn >> fY;
+ aCandidate.setPrevControlPoint(b, basegfx::B2DVector(fX, fY));
+
+ rIn >> fX;
+ rIn >> fY;
+ aCandidate.setNextControlPoint(b, basegfx::B2DVector(fX, fY));
+ }
+ }
+ }
+
+ aRetval.append(aCandidate);
+ }
+
+ return aRetval;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// -----------------------
+// class XLineStartItem
+// -----------------------
+TYPEINIT1_AUTOFACTORY(XLineStartItem, NameOrIndex);
+
+/*************************************************************************
+|*
+|* XLineStartItem::XLineStartItem(sal_Int32 nIndex)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 18.11.94
+|*
+*************************************************************************/
+
+XLineStartItem::XLineStartItem(sal_Int32 nIndex)
+: NameOrIndex(XATTR_LINESTART, nIndex)
+{
+}
+
+/*************************************************************************
+|*
+|* XLineStartItem::XLineStartItem(const XubString& rName,
+|* const basegfx::B2DPolyPolygon& rXPolygon)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 18.11.94
+|*
+*************************************************************************/
+
+XLineStartItem::XLineStartItem(const XubString& rName, const basegfx::B2DPolyPolygon& rPolyPolygon)
+: NameOrIndex(XATTR_LINESTART, rName),
+ maPolyPolygon(rPolyPolygon)
+{
+}
+
+/*************************************************************************
+|*
+|* XLineStartItem::XLineStartItem(const XLineStartItem& rItem)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 17.11.94
+|*
+*************************************************************************/
+
+XLineStartItem::XLineStartItem(const XLineStartItem& rItem)
+: NameOrIndex(rItem),
+ maPolyPolygon(rItem.maPolyPolygon)
+{
+}
+
+/*************************************************************************
+|*
+|* XLineStartItem::XLineStartItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 17.11.94
+|*
+*************************************************************************/
+
+XLineStartItem::XLineStartItem(SvStream& rIn) :
+ NameOrIndex(XATTR_LINESTART, rIn)
+{
+ if (!IsIndex())
+ {
+ maPolyPolygon = streamInB2DPolyPolygon(rIn);
+ }
+}
+
+//*************************************************************************
+
+XLineStartItem::XLineStartItem(SfxItemPool* /*pPool*/, const basegfx::B2DPolyPolygon& rPolyPolygon)
+: NameOrIndex( XATTR_LINESTART, -1 ),
+ maPolyPolygon(rPolyPolygon)
+{
+}
+
+//*************************************************************************
+
+XLineStartItem::XLineStartItem(SfxItemPool* /*pPool*/)
+: NameOrIndex(XATTR_LINESTART, -1 )
+{
+}
+
+/*************************************************************************
+|*
+|* XLineStartItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XLineStartItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XLineStartItem(*this);
+}
+
+/*************************************************************************
+|*
+|* int XLineStartItem::operator==(const SfxPoolItem& rItem) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 18.11.94
+|*
+*************************************************************************/
+
+int XLineStartItem::operator==(const SfxPoolItem& rItem) const
+{
+ return ( NameOrIndex::operator==(rItem) && ((const XLineStartItem&) rItem).maPolyPolygon == maPolyPolygon );
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XLineStartItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XLineStartItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XLineStartItem(rIn);
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XLineStartItem::Store(SvStream& rOut) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 18.11.94
+|*
+*************************************************************************/
+
+SvStream& XLineStartItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
+{
+ NameOrIndex::Store( rOut, nItemVersion );
+
+ if (!IsIndex())
+ {
+ streamOutB2DPolyPolygon(maPolyPolygon, rOut);
+ }
+
+ return rOut;
+}
+
+/*************************************************************************
+|*
+|* const basegfx::B2DPolyPolygon& XLineStartItem::GetValue(const XLineEndTable* pTable)
+|* const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 18.11.94
+|*
+*************************************************************************/
+
+basegfx::B2DPolyPolygon XLineStartItem::GetLineStartValue(const XLineEndTable* pTable) const
+{
+ if (!IsIndex())
+ {
+ return maPolyPolygon;
+ }
+ else
+ {
+ return pTable->GetLineEnd(GetIndex())->GetLineEnd();
+ }
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation XLineStartItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return ePres;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText = GetName();
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+sal_Bool XLineStartItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+ if( nMemberId == MID_NAME )
+ {
+ rtl::OUString aApiName;
+ SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
+ rVal <<= aApiName;
+ }
+ else
+ {
+ com::sun::star::drawing::PolyPolygonBezierCoords aBezier;
+ SvxConvertB2DPolyPolygonToPolyPolygonBezier( maPolyPolygon, aBezier );
+ rVal <<= aBezier;
+ }
+
+ return sal_True;
+}
+
+sal_Bool XLineStartItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
+{
+// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+ if( nMemberId == MID_NAME )
+ {
+ return sal_False;
+ }
+ else
+ {
+ maPolyPolygon.clear();
+
+ if( rVal.hasValue() && rVal.getValue() )
+ {
+ if( rVal.getValueType() != ::getCppuType((const com::sun::star::drawing::PolyPolygonBezierCoords*)0) )
+ return sal_False;
+
+ com::sun::star::drawing::PolyPolygonBezierCoords* pCoords = (com::sun::star::drawing::PolyPolygonBezierCoords*)rVal.getValue();
+ if( pCoords->Coordinates.getLength() > 0 )
+ {
+ maPolyPolygon = SvxConvertPolyPolygonBezierToB2DPolyPolygon( pCoords );
+ // #i72807# close line start/end polygons hard
+ // maPolyPolygon.setClosed(true);
+ }
+ }
+ }
+
+ return sal_True;
+}
+
+/** this function searches in both the models pool and the styles pool for XLineStartItem
+ and XLineEndItem with the same value or name and returns an item with the value of
+ this item and a unique name for an item with this value. */
+XLineStartItem* XLineStartItem::checkForUniqueItem( SdrModel* pModel ) const
+{
+ if( pModel )
+ {
+ XLineStartItem* pTempItem = NULL;
+ const XLineStartItem* pLineStartItem = this;
+
+ String aUniqueName( GetName() );
+
+ if( !maPolyPolygon.count() )
+ {
+ // if the polygon is empty, check if the name is empty
+ if( aUniqueName.Len() == 0 )
+ return (XLineStartItem*)this;
+
+ // force empty name for empty polygons
+ return new XLineStartItem( String(), maPolyPolygon );
+ }
+
+ if( maPolyPolygon.count() > 1L )
+ {
+ // check if the polygon is closed
+ if(!maPolyPolygon.isClosed())
+ {
+ // force a closed polygon
+ basegfx::B2DPolyPolygon aNew(maPolyPolygon);
+ aNew.setClosed(true);
+ pTempItem = new XLineStartItem( aUniqueName, aNew );
+ pLineStartItem = pTempItem;
+ }
+ }
+
+ sal_Bool bForceNew = sal_False;
+
+ // 2. if we have a name check if there is already an item with the
+ // same name in the documents pool with a different line end or start
+
+ sal_uInt32 nCount, nSurrogate;
+
+ const SfxItemPool* pPool1 = &pModel->GetItemPool();
+ if( aUniqueName.Len() && pPool1 )
+ {
+ nCount = pPool1->GetItemCount2( XATTR_LINESTART );
+
+ for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
+ {
+ const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate );
+
+ if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
+ {
+ // if there is already an item with the same name and the same
+ // value its ok to set it
+ if( pItem->GetLineStartValue() != pLineStartItem->GetLineStartValue() )
+ {
+ // same name but different value, we need a new name for this item
+ aUniqueName = String();
+ bForceNew = sal_True;
+ }
+ break;
+ }
+ }
+
+ if( !bForceNew )
+ {
+ nCount = pPool1->GetItemCount2( XATTR_LINEEND );
+
+ for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
+ {
+ const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate );
+
+ if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
+ {
+ // if there is already an item with the same name and the same
+ // value its ok to set it
+ if( pItem->GetLineEndValue() != pLineStartItem->GetLineStartValue() )
+ {
+ // same name but different value, we need a new name for this item
+ aUniqueName = String();
+ bForceNew = sal_True;
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ const SfxItemPool* pPool2 = pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL;
+ if( aUniqueName.Len() && pPool2)
+ {
+ nCount = pPool2->GetItemCount2( XATTR_LINESTART );
+ for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
+ {
+ const XLineStartItem* pItem = (const XLineStartItem*)pPool2->GetItem2( XATTR_LINESTART, nSurrogate );
+
+ if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
+ {
+ // if there is already an item with the same name and the same
+ // value its ok to set it
+ if( pItem->GetLineStartValue() != pLineStartItem->GetLineStartValue() )
+ {
+ // same name but different value, we need a new name for this item
+ aUniqueName = String();
+ bForceNew = sal_True;
+ }
+ break;
+ }
+ }
+
+ if( !bForceNew )
+ {
+ nCount = pPool2->GetItemCount2( XATTR_LINEEND );
+ for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
+ {
+ const XLineEndItem* pItem = (const XLineEndItem*)pPool2->GetItem2( XATTR_LINEEND, nSurrogate );
+
+ if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
+ {
+ // if there is already an item with the same name and the same
+ // value its ok to set it
+ if( pItem->GetLineEndValue() != pLineStartItem->GetLineStartValue() )
+ {
+ // same name but different value, we need a new name for this item
+ aUniqueName = String();
+ bForceNew = sal_True;
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ // if we have no name yet, find existing item with same conent or
+ // create a unique name
+ if( aUniqueName.Len() == 0 )
+ {
+ sal_Bool bFoundExisting = sal_False;
+
+ sal_Int32 nUserIndex = 1;
+ const ResId aRes(SVX_RES(RID_SVXSTR_LINEEND));
+ const String aUser( aRes );
+
+ if( pPool1 )
+ {
+ nCount = pPool1->GetItemCount2( XATTR_LINESTART );
+ sal_uInt32 nSurrogate2;
+
+ for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
+ {
+ const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate2 );
+
+ if( pItem && pItem->GetName().Len() )
+ {
+ if( !bForceNew && pItem->GetLineStartValue() == pLineStartItem->GetLineStartValue() )
+ {
+ aUniqueName = pItem->GetName();
+ bFoundExisting = sal_True;
+ break;
+ }
+
+ if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 )
+ {
+ sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32();
+ if( nThisIndex >= nUserIndex )
+ nUserIndex = nThisIndex + 1;
+ }
+ }
+ }
+
+ nCount = pPool1->GetItemCount2( XATTR_LINEEND );
+ for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
+ {
+ const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate2 );
+
+ if( pItem && pItem->GetName().Len() )
+ {
+ if( !bForceNew && pItem->GetLineEndValue() == pLineStartItem->GetLineStartValue() )
+ {
+ aUniqueName = pItem->GetName();
+ bFoundExisting = sal_True;
+ break;
+ }
+
+ if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 )
+ {
+ sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32();
+ if( nThisIndex >= nUserIndex )
+ nUserIndex = nThisIndex + 1;
+ }
+ }
+ }
+ }
+
+ if( !bFoundExisting )
+ {
+ aUniqueName = aUser;
+ aUniqueName += sal_Unicode(' ');
+ aUniqueName += String::CreateFromInt32( nUserIndex );
+ }
+ }
+
+ // if the given name is not valid, replace it!
+ if( aUniqueName != GetName() || pTempItem )
+ {
+ if( pTempItem )
+ {
+ pTempItem->SetName( aUniqueName );
+ return pTempItem;
+ }
+ else
+ {
+ return new XLineStartItem( aUniqueName, maPolyPolygon );
+ }
+ }
+ }
+
+ return (XLineStartItem*)this;
+}
+
+// ---------------------
+// class XLineEndItem
+// ---------------------
+TYPEINIT1_AUTOFACTORY(XLineEndItem, NameOrIndex);
+
+/*************************************************************************
+|*
+|* XLineEndItem::XLineEndItem(sal_Int32 nIndex)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 18.11.94
+|*
+*************************************************************************/
+
+XLineEndItem::XLineEndItem(sal_Int32 nIndex)
+: NameOrIndex(XATTR_LINEEND, nIndex)
+{
+}
+
+/*************************************************************************
+|*
+|* XLineEndItem::XLineEndItem(const XubString& rName,
+|* const basegfx::B2DPolyPolygon& rXPolygon)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 18.11.94
+|*
+*************************************************************************/
+
+XLineEndItem::XLineEndItem(const XubString& rName, const basegfx::B2DPolyPolygon& rPolyPolygon)
+: NameOrIndex(XATTR_LINEEND, rName),
+ maPolyPolygon(rPolyPolygon)
+{
+}
+
+/*************************************************************************
+|*
+|* XLineEndItem::XLineEndItem(const XLineEndItem& rItem)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 18.11.94
+|*
+*************************************************************************/
+
+XLineEndItem::XLineEndItem(const XLineEndItem& rItem)
+: NameOrIndex(rItem),
+ maPolyPolygon(rItem.maPolyPolygon)
+{
+}
+
+/*************************************************************************
+|*
+|* XLineEndItem::XLineEndItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 17.11.94
+|*
+*************************************************************************/
+
+XLineEndItem::XLineEndItem(SvStream& rIn) :
+ NameOrIndex(XATTR_LINEEND, rIn)
+{
+ if (!IsIndex())
+ {
+ maPolyPolygon = streamInB2DPolyPolygon(rIn);
+ }
+}
+
+//*************************************************************************
+
+XLineEndItem::XLineEndItem(SfxItemPool* /*pPool*/, const basegfx::B2DPolyPolygon& rPolyPolygon)
+: NameOrIndex( XATTR_LINEEND, -1 ),
+ maPolyPolygon(rPolyPolygon)
+{
+}
+
+//*************************************************************************
+
+XLineEndItem::XLineEndItem(SfxItemPool* /*pPool*/)
+: NameOrIndex(XATTR_LINEEND, -1 )
+{
+}
+
+/*************************************************************************
+|*
+|* XLineEndItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XLineEndItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XLineEndItem(*this);
+}
+
+/*************************************************************************
+|*
+|* int XLineEndItem::operator==(const SfxPoolItem& rItem) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 17.11.94
+|*
+*************************************************************************/
+
+int XLineEndItem::operator==(const SfxPoolItem& rItem) const
+{
+ return ( NameOrIndex::operator==(rItem) && ((const XLineEndItem&) rItem).maPolyPolygon == maPolyPolygon );
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XLineEndItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XLineEndItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XLineEndItem(rIn);
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XLineEndItem::Store(SvStream& rOut) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 17.11.94
+|*
+*************************************************************************/
+
+SvStream& XLineEndItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
+{
+ NameOrIndex::Store( rOut, nItemVersion );
+
+ if (!IsIndex())
+ {
+ streamOutB2DPolyPolygon(maPolyPolygon, rOut);
+ }
+
+ return rOut;
+}
+
+/*************************************************************************
+|*
+|* const basegfx::B2DPolyPolygon& XLineEndItem::GetValue(const XLineEndTable* pTable) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 18.11.94
+|*
+*************************************************************************/
+
+basegfx::B2DPolyPolygon XLineEndItem::GetLineEndValue(const XLineEndTable* pTable) const
+{
+ if (!IsIndex())
+ {
+ return maPolyPolygon;
+ }
+ else
+ {
+ return pTable->GetLineEnd(GetIndex())->GetLineEnd();
+ }
+}
+
+
+/** this function searches in both the models pool and the styles pool for XLineStartItem
+ and XLineEndItem with the same value or name and returns an item with the value of
+ this item and a unique name for an item with this value. */
+XLineEndItem* XLineEndItem::checkForUniqueItem( SdrModel* pModel ) const
+{
+ if( pModel )
+ {
+ XLineEndItem* pTempItem = NULL;
+ const XLineEndItem* pLineEndItem = this;
+
+ String aUniqueName( GetName() );
+
+ if( !maPolyPolygon.count() )
+ {
+ // if the polygon is empty, check if the name is empty
+ if( aUniqueName.Len() == 0 )
+ return (XLineEndItem*)this;
+
+ // force empty name for empty polygons
+ return new XLineEndItem( String(), maPolyPolygon );
+ }
+
+ if( maPolyPolygon.count() > 1L )
+ {
+ // check if the polygon is closed
+ if(!maPolyPolygon.isClosed())
+ {
+ // force a closed polygon
+ basegfx::B2DPolyPolygon aNew(maPolyPolygon);
+ aNew.setClosed(true);
+ pTempItem = new XLineEndItem( aUniqueName, aNew );
+ pLineEndItem = pTempItem;
+ }
+ }
+
+ sal_Bool bForceNew = sal_False;
+
+ // 2. if we have a name check if there is already an item with the
+ // same name in the documents pool with a different line end or start
+
+ sal_uInt16 nCount, nSurrogate;
+
+ const SfxItemPool* pPool1 = &pModel->GetItemPool();
+ if( aUniqueName.Len() && pPool1 )
+ {
+ nCount = pPool1->GetItemCount2( XATTR_LINESTART );
+
+ for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
+ {
+ const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate );
+
+ if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
+ {
+ // if there is already an item with the same name and the same
+ // value its ok to set it
+ if( pItem->GetLineStartValue() != pLineEndItem->GetLineEndValue() )
+ {
+ // same name but different value, we need a new name for this item
+ aUniqueName = String();
+ bForceNew = sal_True;
+ }
+ break;
+ }
+ }
+
+ if( !bForceNew )
+ {
+ nCount = pPool1->GetItemCount2( XATTR_LINEEND );
+
+ for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
+ {
+ const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate );
+
+ if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
+ {
+ // if there is already an item with the same name and the same
+ // value its ok to set it
+ if( pItem->GetLineEndValue() != pLineEndItem->GetLineEndValue() )
+ {
+ // same name but different value, we need a new name for this item
+ aUniqueName = String();
+ bForceNew = sal_True;
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ const SfxItemPool* pPool2 = pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL;
+ if( aUniqueName.Len() && pPool2)
+ {
+ nCount = pPool2->GetItemCount2( XATTR_LINESTART );
+ for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
+ {
+ const XLineStartItem* pItem = (const XLineStartItem*)pPool2->GetItem2( XATTR_LINESTART, nSurrogate );
+
+ if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
+ {
+ // if there is already an item with the same name and the same
+ // value its ok to set it
+ if( pItem->GetLineStartValue() != pLineEndItem->GetLineEndValue() )
+ {
+ // same name but different value, we need a new name for this item
+ aUniqueName = String();
+ bForceNew = sal_True;
+ }
+ break;
+ }
+ }
+
+ if( !bForceNew )
+ {
+ nCount = pPool2->GetItemCount2( XATTR_LINEEND );
+ for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
+ {
+ const XLineEndItem* pItem = (const XLineEndItem*)pPool2->GetItem2( XATTR_LINEEND, nSurrogate );
+
+ if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
+ {
+ // if there is already an item with the same name and the same
+ // value its ok to set it
+ if( pItem->GetLineEndValue() != pLineEndItem->GetLineEndValue() )
+ {
+ // same name but different value, we need a new name for this item
+ aUniqueName = String();
+ bForceNew = sal_True;
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ // if we have no name yet, find existing item with same conent or
+ // create a unique name
+ if( aUniqueName.Len() == 0 )
+ {
+ sal_Bool bFoundExisting = sal_False;
+
+ sal_Int32 nUserIndex = 1;
+ const ResId aRes(SVX_RES(RID_SVXSTR_LINEEND));
+ const String aUser( aRes );
+
+ if( pPool1 )
+ {
+ nCount = pPool1->GetItemCount2( XATTR_LINESTART );
+ sal_uInt32 nSurrogate2;
+
+ for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
+ {
+ const XLineStartItem* pItem = (const XLineStartItem*)pPool1->GetItem2( XATTR_LINESTART, nSurrogate2 );
+
+ if( pItem && pItem->GetName().Len() )
+ {
+ if( !bForceNew && pItem->GetLineStartValue() == pLineEndItem->GetLineEndValue() )
+ {
+ aUniqueName = pItem->GetName();
+ bFoundExisting = sal_True;
+ break;
+ }
+
+ if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 )
+ {
+ sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32();
+ if( nThisIndex >= nUserIndex )
+ nUserIndex = nThisIndex + 1;
+ }
+ }
+ }
+
+ nCount = pPool1->GetItemCount2( XATTR_LINEEND );
+ for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
+ {
+ const XLineEndItem* pItem = (const XLineEndItem*)pPool1->GetItem2( XATTR_LINEEND, nSurrogate2 );
+
+ if( pItem && pItem->GetName().Len() )
+ {
+ if( !bForceNew && pItem->GetLineEndValue() == pLineEndItem->GetLineEndValue() )
+ {
+ aUniqueName = pItem->GetName();
+ bFoundExisting = sal_True;
+ break;
+ }
+
+ if( pItem->GetName().CompareTo( aUser, aUser.Len() ) == 0 )
+ {
+ sal_Int32 nThisIndex = pItem->GetName().Copy( aUser.Len() ).ToInt32();
+ if( nThisIndex >= nUserIndex )
+ nUserIndex = nThisIndex + 1;
+ }
+ }
+ }
+ }
+
+ if( !bFoundExisting )
+ {
+ aUniqueName = aUser;
+ aUniqueName += sal_Unicode(' ');
+ aUniqueName += String::CreateFromInt32( nUserIndex );
+ }
+ }
+
+ // if the given name is not valid, replace it!
+ if( aUniqueName != GetName() || pTempItem )
+ {
+ if( pTempItem )
+ {
+ pTempItem->SetName( aUniqueName );
+ return pTempItem;
+ }
+ else
+ {
+ return new XLineEndItem( aUniqueName, maPolyPolygon );
+ }
+ }
+ }
+
+ return (XLineEndItem*)this;
+}
+
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation XLineEndItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return ePres;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText = GetName();
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+sal_Bool XLineEndItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+ if( nMemberId == MID_NAME )
+ {
+ rtl::OUString aApiName;
+ SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
+ rVal <<= aApiName;
+ }
+ else
+ {
+ com::sun::star::drawing::PolyPolygonBezierCoords aBezier;
+ SvxConvertB2DPolyPolygonToPolyPolygonBezier( maPolyPolygon, aBezier );
+ rVal <<= aBezier;
+ }
+ return sal_True;
+}
+
+sal_Bool XLineEndItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
+{
+// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+ if( nMemberId == MID_NAME )
+ {
+ return sal_False;
+ }
+ else
+ {
+ maPolyPolygon.clear();
+
+ if( rVal.hasValue() && rVal.getValue() )
+ {
+ if( rVal.getValueType() != ::getCppuType((const com::sun::star::drawing::PolyPolygonBezierCoords*)0) )
+ return sal_False;
+
+ com::sun::star::drawing::PolyPolygonBezierCoords* pCoords = (com::sun::star::drawing::PolyPolygonBezierCoords*)rVal.getValue();
+ if( pCoords->Coordinates.getLength() > 0 )
+ {
+ maPolyPolygon = SvxConvertPolyPolygonBezierToB2DPolyPolygon( pCoords );
+ // #i72807# close line start/end polygons hard
+ // maPolyPolygon.setClosed(true);
+ }
+ }
+ }
+
+ return sal_True;
+}
+
+// ----------------------------
+// class XLineStartWidthItem
+// ----------------------------
+TYPEINIT1_AUTOFACTORY(XLineStartWidthItem, SfxMetricItem);
+
+/*************************************************************************
+|*
+|* XLineStartWidthItem::XLineStartWidthItem(sal_Int32 nWidth)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 18.11.94
+|*
+*************************************************************************/
+
+XLineStartWidthItem::XLineStartWidthItem(long nWidth) :
+ SfxMetricItem(XATTR_LINESTARTWIDTH, nWidth)
+{
+}
+
+/*************************************************************************
+|*
+|* XLineStartWidthItem::XLineStartWidthItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XLineStartWidthItem::XLineStartWidthItem(SvStream& rIn) :
+ SfxMetricItem(XATTR_LINESTARTWIDTH, rIn)
+{
+}
+
+/*************************************************************************
+|*
+|* XLineStartWidthItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XLineStartWidthItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XLineStartWidthItem(*this);
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XLineStartWidthItem::Create(SvStream& rIn, sal_uInt16 nVer)
+|* const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XLineStartWidthItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XLineStartWidthItem(rIn);
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation XLineStartWidthItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit eCoreUnit,
+ SfxMapUnit ePresUnit,
+ XubString& rText, const IntlWrapper * pIntl
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return ePres;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText = GetMetricText( (long) GetValue(),
+ eCoreUnit, ePresUnit, pIntl);
+ rText += SVX_RESSTR( GetMetricId( ePresUnit) );
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+sal_Bool XLineStartWidthItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (sal_Int32)GetValue();
+ return sal_True;
+}
+
+sal_Bool XLineStartWidthItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ sal_Int32 nValue = 0;
+ rVal >>= nValue;
+ SetValue( nValue );
+ return sal_True;
+}
+
+
+
+// --------------------------
+// class XLineEndWidthItem
+// --------------------------
+TYPEINIT1_AUTOFACTORY(XLineEndWidthItem, SfxMetricItem);
+
+/*************************************************************************
+|*
+|* XLineEndWidthItem::XLineEndWidthItem(long nWidth)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XLineEndWidthItem::XLineEndWidthItem(long nWidth) :
+ SfxMetricItem(XATTR_LINEENDWIDTH, nWidth)
+{
+}
+
+/*************************************************************************
+|*
+|* XLineEndWidthItem::XLineEndWidthItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XLineEndWidthItem::XLineEndWidthItem(SvStream& rIn) :
+ SfxMetricItem(XATTR_LINEENDWIDTH, rIn)
+{
+}
+
+/*************************************************************************
+|*
+|* XLineEndWidthItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XLineEndWidthItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XLineEndWidthItem(*this);
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XLineEndWidthItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XLineEndWidthItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XLineEndWidthItem(rIn);
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation XLineEndWidthItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit eCoreUnit,
+ SfxMapUnit ePresUnit,
+ XubString& rText, const IntlWrapper *pIntl
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return ePres;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText = GetMetricText( (long) GetValue(),
+ eCoreUnit, ePresUnit, pIntl);
+ rText += SVX_RESSTR( GetMetricId( ePresUnit) );
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+sal_Bool XLineEndWidthItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (sal_Int32)GetValue();
+ return sal_True;
+}
+
+sal_Bool XLineEndWidthItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ sal_Int32 nValue = 0;
+ rVal >>= nValue;
+ SetValue( nValue );
+ return sal_True;
+}
+
+
+// -----------------------------
+// class XLineStartCenterItem
+// -----------------------------
+TYPEINIT1_AUTOFACTORY(XLineStartCenterItem, SfxBoolItem);
+
+/*************************************************************************
+|*
+|* XLineStartCenterItem::XLineStartCenterItem(sal_Bool bStartCenter)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XLineStartCenterItem::XLineStartCenterItem(sal_Bool bStartCenter) :
+ SfxBoolItem(XATTR_LINESTARTCENTER, bStartCenter)
+{
+}
+
+/*************************************************************************
+|*
+|* XLineStartCenterItem::XLineStartCenterItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XLineStartCenterItem::XLineStartCenterItem(SvStream& rIn) :
+ SfxBoolItem(XATTR_LINESTARTCENTER, rIn)
+{
+}
+
+/*************************************************************************
+|*
+|* XLineStartCenterItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XLineStartCenterItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XLineStartCenterItem(*this);
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XLineStartCenterItem::Create(SvStream& rIn, sal_uInt16 nVer)
+|* const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XLineStartCenterItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XLineStartCenterItem(rIn);
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation XLineStartCenterItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return ePres;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText = XubString( ResId( GetValue() ? RID_SVXSTR_CENTERED :
+ RID_SVXSTR_NOTCENTERED, DIALOG_MGR() ) );
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+sal_Bool XLineStartCenterItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ sal_Bool bValue = GetValue();
+ rVal.setValue( &bValue, ::getCppuBooleanType() );
+ return sal_True;
+}
+
+sal_Bool XLineStartCenterItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ if( !rVal.hasValue() || rVal.getValueType() != ::getCppuBooleanType() )
+ return sal_False;
+
+ SetValue( *(sal_Bool*)rVal.getValue() );
+ return sal_True;
+}
+
+
+// ---------------------------
+// class XLineEndCenterItem
+// ---------------------------
+TYPEINIT1_AUTOFACTORY(XLineEndCenterItem, SfxBoolItem);
+
+/*************************************************************************
+|*
+|* XLineEndCenterItem::XLineEndCenterItem(sal_Bool bEndCenter)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XLineEndCenterItem::XLineEndCenterItem(sal_Bool bEndCenter) :
+ SfxBoolItem(XATTR_LINEENDCENTER, bEndCenter)
+{
+}
+
+/*************************************************************************
+|*
+|* XLineEndCenterItem::XLineEndCenterItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XLineEndCenterItem::XLineEndCenterItem(SvStream& rIn) :
+ SfxBoolItem(XATTR_LINEENDCENTER, rIn)
+{
+}
+
+/*************************************************************************
+|*
+|* XLineEndCenterItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XLineEndCenterItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XLineEndCenterItem(*this);
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XLineEndCenterItem::Create(SvStream& rIn, sal_uInt16 nVer)
+|* const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XLineEndCenterItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XLineEndCenterItem(rIn);
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation XLineEndCenterItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return ePres;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText = XubString( ResId( GetValue() ? RID_SVXSTR_CENTERED :
+ RID_SVXSTR_NOTCENTERED, DIALOG_MGR() ) );
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+sal_Bool XLineEndCenterItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ sal_Bool bValue = GetValue();
+ rVal.setValue( &bValue, ::getCppuBooleanType() );
+ return sal_True;
+}
+
+sal_Bool XLineEndCenterItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ if( !rVal.hasValue() || rVal.getValueType() != ::getCppuBooleanType() )
+ return sal_False;
+
+ SetValue( *(sal_Bool*)rVal.getValue() );
+ return sal_True;
+}
+
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// Fuellattribute
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+// --------------------
+// class XFillStyleItem
+// --------------------
+TYPEINIT1_AUTOFACTORY(XFillStyleItem, SfxEnumItem);
+
+/*************************************************************************
+|*
+|* XFillStyleItem::XFillStyleItem(XFillStyle eFillStyle)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XFillStyleItem::XFillStyleItem(XFillStyle eFillStyle) :
+ SfxEnumItem(XATTR_FILLSTYLE, sal::static_int_cast< sal_uInt16 >(eFillStyle))
+{
+}
+
+/*************************************************************************
+|*
+|* XFillStyleItem::XFillStyleItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XFillStyleItem::XFillStyleItem(SvStream& rIn) :
+ SfxEnumItem(XATTR_FILLSTYLE, rIn)
+{
+}
+
+/*************************************************************************
+|*
+|* XFillStyleItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 09.11.94
+|* Letzte Aenderung 09.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillStyleItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XFillStyleItem( *this );
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XFillStyleItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillStyleItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFillStyleItem(rIn);
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation XFillStyleItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ rText.Erase();
+
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ return ePres;
+
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ sal_uInt16 nId = 0;
+
+ switch( (sal_uInt16)GetValue() )
+ {
+ case XFILL_NONE:
+ nId = RID_SVXSTR_INVISIBLE;
+ break;
+ case XFILL_SOLID:
+ nId = RID_SVXSTR_SOLID;
+ break;
+ case XFILL_GRADIENT:
+ nId = RID_SVXSTR_GRADIENT;
+ break;
+ case XFILL_HATCH:
+ nId = RID_SVXSTR_HATCH;
+ break;
+ case XFILL_BITMAP:
+ nId = RID_SVXSTR_BITMAP;
+ break;
+ }
+
+ if ( nId )
+ rText = SVX_RESSTR( nId );
+ return ePres;
+ }
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+//------------------------------------------------------------------------
+
+sal_uInt16 XFillStyleItem::GetValueCount() const
+{
+ return 5;
+}
+
+// -----------------------------------------------------------------------
+sal_Bool XFillStyleItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ ::com::sun::star::drawing::FillStyle eFS = (::com::sun::star::drawing::FillStyle)GetValue();
+
+ rVal <<= eFS;
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------
+sal_Bool XFillStyleItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ ::com::sun::star::drawing::FillStyle eFS;
+ if(!(rVal >>= eFS))
+ {
+ // also try an int (for Basic)
+ sal_Int32 nFS = 0;
+ if(!(rVal >>= nFS))
+ return sal_False;
+ eFS = (::com::sun::star::drawing::FillStyle)nFS;
+ }
+
+ SetValue( sal::static_int_cast< sal_uInt16 >( eFS ) );
+
+ return sal_True;
+}
+
+
+// -------------------
+// class XFillColorItem
+// -------------------
+TYPEINIT1_AUTOFACTORY(XFillColorItem, XColorItem);
+
+/*************************************************************************
+|*
+|* XFillColorItem::XFillColorItem(sal_Int32 nIndex, const Color& rTheColor)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XFillColorItem::XFillColorItem(sal_Int32 nIndex, const Color& rTheColor) :
+ XColorItem(XATTR_FILLCOLOR, nIndex, rTheColor)
+{
+}
+
+/*************************************************************************
+|*
+|* XFillColorItem::XFillColorItem(const XubString& rName, const Color& rTheColor)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XFillColorItem::XFillColorItem(const XubString& rName, const Color& rTheColor) :
+ XColorItem(XATTR_FILLCOLOR, rName, rTheColor)
+{
+}
+
+/*************************************************************************
+|*
+|* XFillColorItem::XFillColorItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XFillColorItem::XFillColorItem(SvStream& rIn) :
+ XColorItem(XATTR_FILLCOLOR, rIn)
+{
+}
+
+/*************************************************************************
+|*
+|* XFillColorItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillColorItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XFillColorItem(*this);
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XFillColorItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillColorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFillColorItem(rIn);
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation XFillColorItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return ePres;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText = GetName();
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool XFillColorItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (sal_Int32)GetColorValue().GetRGBColor();
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool XFillColorItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ sal_Int32 nValue = 0;
+ if(!(rVal >>= nValue ))
+ return sal_False;
+
+ SetColorValue( nValue );
+ return sal_True;
+}
+
+// -----------------------------
+// class XSecondaryFillColorItem
+// -----------------------------
+TYPEINIT1_AUTOFACTORY(XSecondaryFillColorItem, XColorItem);
+
+XSecondaryFillColorItem::XSecondaryFillColorItem(sal_Int32 nIndex, const Color& rTheColor) :
+ XColorItem(XATTR_SECONDARYFILLCOLOR, nIndex, rTheColor)
+{
+}
+
+XSecondaryFillColorItem::XSecondaryFillColorItem(const XubString& rName, const Color& rTheColor) :
+ XColorItem(XATTR_SECONDARYFILLCOLOR, rName, rTheColor)
+{
+}
+
+XSecondaryFillColorItem::XSecondaryFillColorItem( SvStream& rIn ) :
+ XColorItem(XATTR_SECONDARYFILLCOLOR, rIn)
+{
+}
+
+SfxPoolItem* XSecondaryFillColorItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XSecondaryFillColorItem(*this);
+}
+
+SfxPoolItem* XSecondaryFillColorItem::Create( SvStream& rIn, sal_uInt16 nVer ) const
+{
+ if ( nVer >= 2 )
+ return new XSecondaryFillColorItem( rIn );
+ else
+ return new XSecondaryFillColorItem( String(), Color(0,184,255) );
+}
+sal_uInt16 XSecondaryFillColorItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/ ) const
+{
+ return 2;
+}
+SfxItemPresentation XSecondaryFillColorItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return ePres;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText = GetName();
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+// ----------------
+// class XGradient
+// ----------------
+
+/*************************************************************************
+|*
+|* XGradient::XGradient()
+|*
+*************************************************************************/
+
+XGradient::XGradient() :
+ eStyle( XGRAD_LINEAR ),
+ aStartColor( Color( COL_BLACK ) ),
+ aEndColor( Color( COL_WHITE ) ),
+ nAngle( 0 ),
+ nBorder( 0 ),
+ nOfsX( 50 ),
+ nOfsY( 50 ),
+ nIntensStart( 100 ),
+ nIntensEnd( 100 ),
+ nStepCount( 0 )
+{
+}
+
+/*************************************************************************
+|*
+|* XGradient::XGradient(XGradientStyle, const Color&, const Color&,
+|* long, sal_uInt16, sal_uInt16, sal_uInt16)
+|*
+|* Beschreibung
+|* Ersterstellung 21.11.94
+|* Letzte Aenderung 21.11.94
+|*
+*************************************************************************/
+
+XGradient::XGradient(const Color& rStart, const Color& rEnd,
+ XGradientStyle eTheStyle, long nTheAngle, sal_uInt16 nXOfs,
+ sal_uInt16 nYOfs, sal_uInt16 nTheBorder,
+ sal_uInt16 nStartIntens, sal_uInt16 nEndIntens,
+ sal_uInt16 nSteps) :
+ eStyle(eTheStyle),
+ aStartColor(rStart),
+ aEndColor(rEnd),
+ nAngle(nTheAngle),
+ nBorder(nTheBorder),
+ nOfsX(nXOfs),
+ nOfsY(nYOfs),
+ nIntensStart(nStartIntens),
+ nIntensEnd(nEndIntens),
+ nStepCount(nSteps)
+{
+}
+
+/*************************************************************************
+|*
+|* int XGradient::operator==(const SfxPoolItem& rItem) const
+|*
+|* Beschreibung
+|* Ersterstellung 29.11.94
+|* Letzte Aenderung 29.11.94
+|*
+*************************************************************************/
+
+bool XGradient::operator==(const XGradient& rGradient) const
+{
+ return ( eStyle == rGradient.eStyle &&
+ aStartColor == rGradient.aStartColor &&
+ aEndColor == rGradient.aEndColor &&
+ nAngle == rGradient.nAngle &&
+ nBorder == rGradient.nBorder &&
+ nOfsX == rGradient.nOfsX &&
+ nOfsY == rGradient.nOfsY &&
+ nIntensStart == rGradient.nIntensStart &&
+ nIntensEnd == rGradient.nIntensEnd &&
+ nStepCount == rGradient.nStepCount );
+}
+
+
+// -----------------------
+// class XFillGradientItem
+// -----------------------
+TYPEINIT1_AUTOFACTORY(XFillGradientItem, NameOrIndex);
+
+/*************************************************************************
+|*
+|* XFillGradientItem::XFillGradientItem(sal_Int32 nIndex,
+|* const XGradient& rTheGradient)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XFillGradientItem::XFillGradientItem(sal_Int32 nIndex,
+ const XGradient& rTheGradient) :
+ NameOrIndex(XATTR_FILLGRADIENT, nIndex),
+ aGradient(rTheGradient)
+{
+}
+
+/*************************************************************************
+|*
+|* XFillGradientItem::XFillGradientItem(const XubString& rName,
+|* const XGradient& rTheGradient)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XFillGradientItem::XFillGradientItem(const XubString& rName,
+ const XGradient& rTheGradient) :
+ NameOrIndex(XATTR_FILLGRADIENT, rName),
+ aGradient(rTheGradient)
+{
+}
+
+/*************************************************************************
+|*
+|* XFillGradientItem::XFillGradientItem(const XFillGradientItem& rItem)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XFillGradientItem::XFillGradientItem(const XFillGradientItem& rItem) :
+ NameOrIndex(rItem),
+ aGradient(rItem.aGradient)
+{
+}
+
+/*************************************************************************
+|*
+|* XFillGradientItem::XFillGradientItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XFillGradientItem::XFillGradientItem(SvStream& rIn, sal_uInt16 nVer) :
+ NameOrIndex(XATTR_FILLGRADIENT, rIn),
+ aGradient(COL_BLACK, COL_WHITE)
+{
+ if (!IsIndex())
+ {
+ sal_uInt16 nUSTemp;
+ sal_uInt16 nRed;
+ sal_uInt16 nGreen;
+ sal_uInt16 nBlue;
+ sal_Int16 nITemp;
+ sal_Int32 nLTemp;
+
+ rIn >> nITemp; aGradient.SetGradientStyle((XGradientStyle)nITemp);
+ rIn >> nRed;
+ rIn >> nGreen;
+ rIn >> nBlue;
+ Color aCol;
+ aCol = Color( (sal_uInt8)( nRed >> 8 ), (sal_uInt8)( nGreen >> 8 ), (sal_uInt8)( nBlue >> 8 ) );
+ aGradient.SetStartColor( aCol );
+
+ rIn >> nRed;
+ rIn >> nGreen;
+ rIn >> nBlue;
+ aCol = Color( (sal_uInt8)( nRed >> 8 ), (sal_uInt8)( nGreen >> 8 ), (sal_uInt8)( nBlue >> 8 ) );
+ aGradient.SetEndColor(aCol);
+ rIn >> nLTemp; aGradient.SetAngle(nLTemp);
+ rIn >> nUSTemp; aGradient.SetBorder(nUSTemp);
+ rIn >> nUSTemp; aGradient.SetXOffset(nUSTemp);
+ rIn >> nUSTemp; aGradient.SetYOffset(nUSTemp);
+ rIn >> nUSTemp; aGradient.SetStartIntens(nUSTemp);
+ rIn >> nUSTemp; aGradient.SetEndIntens(nUSTemp);
+
+ // bei neueren Versionen wird zusaetzlich
+ // die Schrittweite mit eingelesen
+ if (nVer >= 1)
+ {
+ rIn >> nUSTemp; aGradient.SetSteps(nUSTemp);
+ }
+ }
+}
+
+//*************************************************************************
+
+XFillGradientItem::XFillGradientItem(SfxItemPool* /*pPool*/, const XGradient& rTheGradient)
+: NameOrIndex( XATTR_FILLGRADIENT, -1 ),
+ aGradient(rTheGradient)
+{
+}
+
+//*************************************************************************
+
+XFillGradientItem::XFillGradientItem(SfxItemPool* /*pPool*/)
+: NameOrIndex(XATTR_FILLGRADIENT, -1 )
+{
+}
+
+/*************************************************************************
+|*
+|* XFillGradientItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillGradientItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XFillGradientItem(*this);
+}
+
+/*************************************************************************
+|*
+|* int XFillGradientItem::operator==(const SfxPoolItem& rItem) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+int XFillGradientItem::operator==(const SfxPoolItem& rItem) const
+{
+ return ( NameOrIndex::operator==(rItem) &&
+ aGradient == ((const XFillGradientItem&) rItem).aGradient );
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XFillGradientItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillGradientItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+{
+ return new XFillGradientItem(rIn, nVer);
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XFillGradientItem::Store(SvStream& rOut) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SvStream& XFillGradientItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
+{
+ NameOrIndex::Store( rOut, nItemVersion );
+
+ if (!IsIndex())
+ {
+ rOut << (sal_Int16)aGradient.GetGradientStyle();
+
+ sal_uInt16 nTmp;
+
+ nTmp = VCLTOSVCOL( aGradient.GetStartColor().GetRed() ); rOut << nTmp;
+ nTmp = VCLTOSVCOL( aGradient.GetStartColor().GetGreen() ); rOut << nTmp;
+ nTmp = VCLTOSVCOL( aGradient.GetStartColor().GetBlue() ); rOut << nTmp;
+ nTmp = VCLTOSVCOL( aGradient.GetEndColor().GetRed() ); rOut << nTmp;
+ nTmp = VCLTOSVCOL( aGradient.GetEndColor().GetGreen() ); rOut << nTmp;
+ nTmp = VCLTOSVCOL( aGradient.GetEndColor().GetBlue() ); rOut << nTmp;
+
+ rOut << (sal_Int32) aGradient.GetAngle();
+ rOut << aGradient.GetBorder();
+ rOut << aGradient.GetXOffset();
+ rOut << aGradient.GetYOffset();
+ rOut << aGradient.GetStartIntens();
+ rOut << aGradient.GetEndIntens();
+ rOut << aGradient.GetSteps();
+ }
+
+ return rOut;
+}
+
+/*************************************************************************
+|*
+|* const XGradient& XFillGradientItem::GetValue(const XGradientTable* pTable)
+|* const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 18.11.94
+|*
+*************************************************************************/
+
+const XGradient& XFillGradientItem::GetGradientValue(const XGradientTable* pTable) const // GetValue -> GetGradientValue
+{
+ if (!IsIndex())
+ return aGradient;
+ else
+ return pTable->GetGradient(GetIndex())->GetGradient();
+}
+
+
+/*************************************************************************
+|*
+|* sal_uInt16 XFillGradientItem::GetVersion() const
+|*
+|* Beschreibung
+|* Ersterstellung 01.11.95
+|* Letzte Aenderung 01.11.95
+|*
+*************************************************************************/
+
+sal_uInt16 XFillGradientItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/) const
+{
+ // !!! this version number also represents the version number of superclasses
+ // !!! (e.g. XFillFloatTransparenceItem); if you make any changes here,
+ // !!! the superclass is also affected
+ return 1;
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation XFillGradientItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return ePres;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText = GetName();
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+// -----------------------------------------------------------------------
+sal_Bool XFillGradientItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+ //sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ case 0:
+ {
+ uno::Sequence< beans::PropertyValue > aPropSeq( 2 );
+
+ ::com::sun::star::awt::Gradient aGradient2;
+
+ const XGradient& aXGradient = GetGradientValue();
+ aGradient2.Style = (::com::sun::star::awt::GradientStyle) aXGradient.GetGradientStyle();
+ aGradient2.StartColor = (sal_Int32)aXGradient.GetStartColor().GetColor();
+ aGradient2.EndColor = (sal_Int32)aXGradient.GetEndColor().GetColor();
+ aGradient2.Angle = (short)aXGradient.GetAngle();
+ aGradient2.Border = aXGradient.GetBorder();
+ aGradient2.XOffset = aXGradient.GetXOffset();
+ aGradient2.YOffset = aXGradient.GetYOffset();
+ aGradient2.StartIntensity = aXGradient.GetStartIntens();
+ aGradient2.EndIntensity = aXGradient.GetEndIntens();
+ aGradient2.StepCount = aXGradient.GetSteps();
+
+ rtl::OUString aApiName;
+ SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
+ aPropSeq[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ));
+ aPropSeq[0].Value = uno::makeAny( aApiName );
+ aPropSeq[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillGradient" ));
+ aPropSeq[1].Value = uno::makeAny( aGradient2 );
+ rVal = uno::makeAny( aPropSeq );
+ break;
+ }
+
+ case MID_FILLGRADIENT:
+ {
+ const XGradient& aXGradient = GetGradientValue();
+ ::com::sun::star::awt::Gradient aGradient2;
+
+ aGradient2.Style = (::com::sun::star::awt::GradientStyle) aXGradient.GetGradientStyle();
+ aGradient2.StartColor = (sal_Int32)aXGradient.GetStartColor().GetColor();
+ aGradient2.EndColor = (sal_Int32)aXGradient.GetEndColor().GetColor();
+ aGradient2.Angle = (short)aXGradient.GetAngle();
+ aGradient2.Border = aXGradient.GetBorder();
+ aGradient2.XOffset = aXGradient.GetXOffset();
+ aGradient2.YOffset = aXGradient.GetYOffset();
+ aGradient2.StartIntensity = aXGradient.GetStartIntens();
+ aGradient2.EndIntensity = aXGradient.GetEndIntens();
+ aGradient2.StepCount = aXGradient.GetSteps();
+
+ rVal <<= aGradient2;
+ break;
+ }
+
+ case MID_NAME:
+ {
+ rtl::OUString aApiName;
+ SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
+ rVal <<= aApiName;
+ break;
+ }
+
+ case MID_GRADIENT_STYLE: rVal <<= (sal_Int16)GetGradientValue().GetGradientStyle(); break;
+ case MID_GRADIENT_STARTCOLOR: rVal <<= (sal_Int32)GetGradientValue().GetStartColor().GetColor(); break;
+ case MID_GRADIENT_ENDCOLOR: rVal <<= (sal_Int32)GetGradientValue().GetEndColor().GetColor(); break;
+ case MID_GRADIENT_ANGLE: rVal <<= (sal_Int16)GetGradientValue().GetAngle(); break;
+ case MID_GRADIENT_BORDER: rVal <<= GetGradientValue().GetBorder(); break;
+ case MID_GRADIENT_XOFFSET: rVal <<= GetGradientValue().GetXOffset(); break;
+ case MID_GRADIENT_YOFFSET: rVal <<= GetGradientValue().GetYOffset(); break;
+ case MID_GRADIENT_STARTINTENSITY: rVal <<= GetGradientValue().GetStartIntens(); break;
+ case MID_GRADIENT_ENDINTENSITY: rVal <<= GetGradientValue().GetEndIntens(); break;
+ case MID_GRADIENT_STEPCOUNT: rVal <<= GetGradientValue().GetSteps(); break;
+
+ default: DBG_ERROR("Wrong MemberId!"); return sal_False;
+ }
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------
+sal_Bool XFillGradientItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
+{
+// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+
+ switch ( nMemberId )
+ {
+ case 0:
+ {
+ uno::Sequence< beans::PropertyValue > aPropSeq;
+ ::com::sun::star::awt::Gradient aGradient2;
+ rtl::OUString aName;
+ bool bGradient( false );
+
+ if ( rVal >>= aPropSeq )
+ {
+ for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ )
+ {
+ if ( aPropSeq[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Name" )))
+ aPropSeq[n].Value >>= aName;
+ else if ( aPropSeq[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FillGradient" )))
+ {
+ if ( aPropSeq[n].Value >>= aGradient2 )
+ bGradient = true;
+ }
+ }
+
+ SetName( aName );
+ if ( bGradient )
+ {
+ XGradient aXGradient;
+
+ aXGradient.SetGradientStyle( (XGradientStyle) aGradient2.Style );
+ aXGradient.SetStartColor( aGradient2.StartColor );
+ aXGradient.SetEndColor( aGradient2.EndColor );
+ aXGradient.SetAngle( aGradient2.Angle );
+ aXGradient.SetBorder( aGradient2.Border );
+ aXGradient.SetXOffset( aGradient2.XOffset );
+ aXGradient.SetYOffset( aGradient2.YOffset );
+ aXGradient.SetStartIntens( aGradient2.StartIntensity );
+ aXGradient.SetEndIntens( aGradient2.EndIntensity );
+ aXGradient.SetSteps( aGradient2.StepCount );
+
+ SetGradientValue( aXGradient );
+ }
+
+ return sal_True;
+ }
+
+ return sal_False;
+ }
+
+ case MID_NAME:
+ {
+ rtl::OUString aName;
+ if (!(rVal >>= aName ))
+ return sal_False;
+ SetName( aName );
+ break;
+ }
+
+ case MID_FILLGRADIENT:
+ {
+ ::com::sun::star::awt::Gradient aGradient2;
+ if(!(rVal >>= aGradient2))
+ return sal_False;
+
+ XGradient aXGradient;
+
+ aXGradient.SetGradientStyle( (XGradientStyle) aGradient2.Style );
+ aXGradient.SetStartColor( aGradient2.StartColor );
+ aXGradient.SetEndColor( aGradient2.EndColor );
+ aXGradient.SetAngle( aGradient2.Angle );
+ aXGradient.SetBorder( aGradient2.Border );
+ aXGradient.SetXOffset( aGradient2.XOffset );
+ aXGradient.SetYOffset( aGradient2.YOffset );
+ aXGradient.SetStartIntens( aGradient2.StartIntensity );
+ aXGradient.SetEndIntens( aGradient2.EndIntensity );
+ aXGradient.SetSteps( aGradient2.StepCount );
+
+ SetGradientValue( aXGradient );
+ break;
+ }
+
+ case MID_GRADIENT_STARTCOLOR:
+ case MID_GRADIENT_ENDCOLOR:
+ {
+ sal_Int32 nVal = 0;
+ if(!(rVal >>= nVal ))
+ return sal_False;
+
+ XGradient aXGradient = GetGradientValue();
+
+ if ( nMemberId == MID_GRADIENT_STARTCOLOR )
+ aXGradient.SetStartColor( nVal );
+ else
+ aXGradient.SetEndColor( nVal );
+ SetGradientValue( aXGradient );
+ break;
+ }
+
+ case MID_GRADIENT_STYLE:
+ case MID_GRADIENT_ANGLE:
+ case MID_GRADIENT_BORDER:
+ case MID_GRADIENT_STARTINTENSITY:
+ case MID_GRADIENT_ENDINTENSITY:
+ case MID_GRADIENT_STEPCOUNT:
+ case MID_GRADIENT_XOFFSET:
+ case MID_GRADIENT_YOFFSET:
+ {
+ sal_Int16 nVal = sal_Int16();
+ if(!(rVal >>= nVal ))
+ return sal_False;
+
+ XGradient aXGradient = GetGradientValue();
+
+ switch ( nMemberId )
+ {
+ case MID_GRADIENT_STYLE:
+ aXGradient.SetGradientStyle( (XGradientStyle)nVal ); break;
+ case MID_GRADIENT_ANGLE:
+ aXGradient.SetAngle( nVal ); break;
+ case MID_GRADIENT_BORDER:
+ aXGradient.SetBorder( nVal ); break;
+ case MID_GRADIENT_STARTINTENSITY:
+ aXGradient.SetStartIntens( nVal ); break;
+ case MID_GRADIENT_ENDINTENSITY:
+ aXGradient.SetEndIntens( nVal ); break;
+ case MID_GRADIENT_STEPCOUNT:
+ aXGradient.SetSteps( nVal ); break;
+ case MID_GRADIENT_XOFFSET:
+ aXGradient.SetXOffset( nVal ); break;
+ case MID_GRADIENT_YOFFSET:
+ aXGradient.SetYOffset( nVal ); break;
+ }
+
+ SetGradientValue( aXGradient );
+ break;
+ }
+ }
+
+ return sal_True;
+}
+
+sal_Bool XFillGradientItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
+{
+ return ((XFillGradientItem*)p1)->GetGradientValue() == ((XFillGradientItem*)p2)->GetGradientValue();
+}
+
+XFillGradientItem* XFillGradientItem::checkForUniqueItem( SdrModel* pModel ) const
+{
+ if( pModel )
+ {
+ const String aUniqueName = NameOrIndex::CheckNamedItem( this,
+ XATTR_FILLGRADIENT,
+ &pModel->GetItemPool(),
+ pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL,
+ XFillGradientItem::CompareValueFunc,
+ RID_SVXSTR_GRADIENT,
+ pModel->GetGradientList() );
+
+ // if the given name is not valid, replace it!
+ if( aUniqueName != GetName() )
+ {
+ return new XFillGradientItem( aUniqueName, aGradient );
+ }
+ }
+
+ return (XFillGradientItem*)this;
+}
+
+// ----------------------------------
+// class XFillFloatTransparenceItem -
+// ----------------------------------
+
+TYPEINIT1_AUTOFACTORY( XFillFloatTransparenceItem, XFillGradientItem );
+
+// -----------------------------------------------------------------------------
+
+XFillFloatTransparenceItem::XFillFloatTransparenceItem() :
+ bEnabled( sal_False )
+{
+ SetWhich( XATTR_FILLFLOATTRANSPARENCE );
+}
+
+//------------------------------------------------------------------------
+
+XFillFloatTransparenceItem::XFillFloatTransparenceItem( sal_Int32 nIndex, const XGradient& rGradient, sal_Bool bEnable ) :
+ XFillGradientItem ( nIndex, rGradient ),
+ bEnabled ( bEnable )
+{
+ SetWhich( XATTR_FILLFLOATTRANSPARENCE );
+}
+
+//------------------------------------------------------------------------
+
+XFillFloatTransparenceItem::XFillFloatTransparenceItem(const XubString& rName, const XGradient& rGradient, sal_Bool bEnable ) :
+ XFillGradientItem ( rName, rGradient ),
+ bEnabled ( bEnable )
+{
+ SetWhich( XATTR_FILLFLOATTRANSPARENCE );
+}
+
+//------------------------------------------------------------------------
+
+XFillFloatTransparenceItem::XFillFloatTransparenceItem( const XFillFloatTransparenceItem& rItem ) :
+ XFillGradientItem ( rItem ),
+ bEnabled ( rItem.bEnabled )
+{
+ SetWhich( XATTR_FILLFLOATTRANSPARENCE );
+}
+
+//------------------------------------------------------------------------
+
+//XFillFloatTransparenceItem::XFillFloatTransparenceItem( SvStream& rIn, sal_uInt16 nVer ) :
+// XFillGradientItem ( rIn, nVer )
+//{
+// SetWhich( XATTR_FILLFLOATTRANSPARENCE );
+// rIn >> bEnabled;
+//}
+
+//*************************************************************************
+
+XFillFloatTransparenceItem::XFillFloatTransparenceItem(SfxItemPool* /*pPool*/, const XGradient& rTheGradient, sal_Bool bEnable )
+: XFillGradientItem ( -1, rTheGradient ),
+ bEnabled ( bEnable )
+{
+ SetWhich( XATTR_FILLFLOATTRANSPARENCE );
+}
+
+//*************************************************************************
+
+XFillFloatTransparenceItem::XFillFloatTransparenceItem(SfxItemPool* /*pPool*/)
+{
+ SetWhich( XATTR_FILLFLOATTRANSPARENCE );
+}
+
+//------------------------------------------------------------------------
+
+int XFillFloatTransparenceItem::operator==( const SfxPoolItem& rItem ) const
+{
+ return ( NameOrIndex::operator==(rItem) ) &&
+ ( GetGradientValue() == ((const XFillGradientItem&)rItem).GetGradientValue() ) &&
+ ( bEnabled == ( (XFillFloatTransparenceItem&) rItem ).bEnabled );
+}
+
+//------------------------------------------------------------------------
+
+SfxPoolItem* XFillFloatTransparenceItem::Clone( SfxItemPool* /*pPool*/) const
+{
+ return new XFillFloatTransparenceItem( *this );
+}
+
+//------------------------------------------------------------------------
+
+//SfxPoolItem* XFillFloatTransparenceItem::Create( SvStream& rIn, sal_uInt16 nVer ) const
+//{
+// return( ( 0 == nVer ) ? Clone( NULL ) : new XFillFloatTransparenceItem( rIn, nVer ) );
+//}
+
+//------------------------------------------------------------------------
+
+//SvStream& XFillFloatTransparenceItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
+//{
+// XFillGradientItem::Store( rOut, nItemVersion );
+// rOut << bEnabled;
+// return rOut;
+//}
+
+//------------------------------------------------------------------------
+
+sal_uInt16 XFillFloatTransparenceItem::GetVersion( sal_uInt16 nFileFormatVersion ) const
+{
+ // !!! if version number of this object must be increased, please !!!
+ // !!! increase version number of base class XFillGradientItem !!!
+ return XFillGradientItem::GetVersion( nFileFormatVersion );
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool XFillFloatTransparenceItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+ return XFillGradientItem::QueryValue( rVal, nMemberId );
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool XFillFloatTransparenceItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
+{
+ return XFillGradientItem::PutValue( rVal, nMemberId );
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation XFillFloatTransparenceItem::GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreUnit, SfxMapUnit ePresUnit,
+ XubString& rText,
+ const IntlWrapper * pIntlWrapper ) const
+{
+ return XFillGradientItem::GetPresentation( ePres, eCoreUnit, ePresUnit, rText, pIntlWrapper );
+}
+
+sal_Bool XFillFloatTransparenceItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
+{
+ return ((XFillFloatTransparenceItem*)p1)->IsEnabled() == ((XFillFloatTransparenceItem*)p2)->IsEnabled() &&
+ ((XFillFloatTransparenceItem*)p1)->GetGradientValue() == ((XFillFloatTransparenceItem*)p2)->GetGradientValue();
+}
+
+XFillFloatTransparenceItem* XFillFloatTransparenceItem::checkForUniqueItem( SdrModel* pModel ) const
+{
+ // #85953# unique name only necessary when enabled
+ if(IsEnabled())
+ {
+ if( pModel )
+ {
+ const String aUniqueName = NameOrIndex::CheckNamedItem( this,
+ XATTR_FILLFLOATTRANSPARENCE,
+ &pModel->GetItemPool(),
+ pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL,
+ XFillFloatTransparenceItem::CompareValueFunc,
+ RID_SVXSTR_TRASNGR0,
+ NULL );
+
+ // if the given name is not valid, replace it!
+ if( aUniqueName != GetName() )
+ {
+ return new XFillFloatTransparenceItem( aUniqueName, GetGradientValue(), sal_True );
+ }
+ }
+ }
+ else
+ {
+ // #85953# if disabled, force name to empty string
+ if(GetName().Len())
+ {
+ return new XFillFloatTransparenceItem(String(), GetGradientValue(), sal_False);
+ }
+ }
+
+ return (XFillFloatTransparenceItem*)this;
+}
+
+// -------------
+// class XHatch
+// -------------
+
+/*************************************************************************
+|*
+|* XHatch::XHatch(XHatchStyle, const Color&, long, long)
+|*
+|* Beschreibung
+|* Ersterstellung 21.11.94
+|* Letzte Aenderung 21.11.94
+|*
+*************************************************************************/
+
+XHatch::XHatch(const Color& rCol, XHatchStyle eTheStyle, long nTheDistance,
+ long nTheAngle) :
+ eStyle(eTheStyle),
+ aColor(rCol),
+ nDistance(nTheDistance),
+ nAngle(nTheAngle)
+{
+}
+
+/*************************************************************************
+|*
+|* int XHatch::operator==(const SfxPoolItem& rItem) const
+|*
+|* Beschreibung
+|* Ersterstellung 29.11.94
+|* Letzte Aenderung 29.11.94
+|*
+*************************************************************************/
+
+bool XHatch::operator==(const XHatch& rHatch) const
+{
+ return ( eStyle == rHatch.eStyle &&
+ aColor == rHatch.aColor &&
+ nDistance == rHatch.nDistance &&
+ nAngle == rHatch.nAngle );
+}
+
+
+// -----------------------
+// class XFillHatchItem
+// -----------------------
+TYPEINIT1_AUTOFACTORY(XFillHatchItem, NameOrIndex);
+
+/*************************************************************************
+|*
+|* XFillHatchItem::XFillHatchItem(sal_Int32 nIndex,
+|* const XHatch& rTheHatch)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XFillHatchItem::XFillHatchItem(sal_Int32 nIndex,
+ const XHatch& rTheHatch) :
+ NameOrIndex(XATTR_FILLHATCH, nIndex),
+ aHatch(rTheHatch)
+{
+}
+
+/*************************************************************************
+|*
+|* XFillHatchItem::XFillHatchItem(const XubString& rName,
+|* const XHatch& rTheHatch)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XFillHatchItem::XFillHatchItem(const XubString& rName,
+ const XHatch& rTheHatch) :
+ NameOrIndex(XATTR_FILLHATCH, rName),
+ aHatch(rTheHatch)
+{
+}
+
+/*************************************************************************
+|*
+|* XFillHatchItem::XFillHatchItem(const XFillHatchItem& rItem)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XFillHatchItem::XFillHatchItem(const XFillHatchItem& rItem) :
+ NameOrIndex(rItem),
+ aHatch(rItem.aHatch)
+{
+}
+
+/*************************************************************************
+|*
+|* XFillHatchItem::XFillHatchItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+XFillHatchItem::XFillHatchItem(SvStream& rIn) :
+ NameOrIndex(XATTR_FILLHATCH, rIn),
+ aHatch(COL_BLACK)
+{
+ if (!IsIndex())
+ {
+ sal_uInt16 nRed;
+ sal_uInt16 nGreen;
+ sal_uInt16 nBlue;
+ sal_Int16 nITemp;
+ sal_Int32 nLTemp;
+
+ rIn >> nITemp; aHatch.SetHatchStyle((XHatchStyle)nITemp);
+ rIn >> nRed;
+ rIn >> nGreen;
+ rIn >> nBlue;
+
+ Color aCol;
+ aCol = Color( (sal_uInt8)( nRed >> 8 ), (sal_uInt8)( nGreen >> 8 ), (sal_uInt8)( nBlue >> 8 ) );
+ aHatch.SetColor(aCol);
+ rIn >> nLTemp; aHatch.SetDistance(nLTemp);
+ rIn >> nLTemp; aHatch.SetAngle(nLTemp);
+ }
+}
+
+//*************************************************************************
+
+XFillHatchItem::XFillHatchItem(SfxItemPool* /*pPool*/, const XHatch& rTheHatch)
+: NameOrIndex( XATTR_FILLHATCH, -1 ),
+ aHatch(rTheHatch)
+{
+}
+
+//*************************************************************************
+
+XFillHatchItem::XFillHatchItem(SfxItemPool* /*pPool*/)
+: NameOrIndex(XATTR_FILLHATCH, -1 )
+{
+}
+
+/*************************************************************************
+|*
+|* XFillHatchItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillHatchItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XFillHatchItem(*this);
+}
+
+/*************************************************************************
+|*
+|* int XFillHatchItem::operator==(const SfxPoolItem& rItem) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+int XFillHatchItem::operator==(const SfxPoolItem& rItem) const
+{
+ return ( NameOrIndex::operator==(rItem) &&
+ aHatch == ((const XFillHatchItem&) rItem).aHatch );
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XFillHatchItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillHatchItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFillHatchItem(rIn);
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XFillHatchItem::Store(SvStream& rOut) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 15.11.94
+|*
+*************************************************************************/
+
+SvStream& XFillHatchItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
+{
+ NameOrIndex::Store( rOut, nItemVersion );
+
+ if (!IsIndex())
+ {
+ rOut << (sal_Int16)aHatch.GetHatchStyle();
+
+ sal_uInt16 nTmp;
+ nTmp = VCLTOSVCOL( aHatch.GetColor().GetRed() ); rOut << nTmp;
+ nTmp = VCLTOSVCOL( aHatch.GetColor().GetGreen() ); rOut << nTmp;
+ nTmp = VCLTOSVCOL( aHatch.GetColor().GetBlue() ); rOut << nTmp;
+
+ rOut << (sal_Int32) aHatch.GetDistance();
+ rOut << (sal_Int32) aHatch.GetAngle();
+ }
+
+ return rOut;
+}
+
+/*************************************************************************
+|*
+|* const XHatch& XFillHatchItem::GetValue(const XHatchTable* pTable) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 18.11.94
+|*
+*************************************************************************/
+
+const XHatch& XFillHatchItem::GetHatchValue(const XHatchTable* pTable) const // GetValue -> GetHatchValue
+{
+ if (!IsIndex())
+ return aHatch;
+ else
+ return pTable->GetHatch(GetIndex())->GetHatch();
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation XFillHatchItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return ePres;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText = GetName();
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+//------------------------------------------------------------------------
+
+FASTBOOL XFillHatchItem::HasMetrics() const
+{
+ return sal_True;
+}
+
+//------------------------------------------------------------------------
+
+FASTBOOL XFillHatchItem::ScaleMetrics(long nMul, long nDiv)
+{
+ aHatch.SetDistance( ScaleMetricValue( aHatch.GetDistance(), nMul, nDiv ) );
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------
+sal_Bool XFillHatchItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+
+ switch ( nMemberId )
+ {
+ case 0:
+ {
+ uno::Sequence< beans::PropertyValue > aPropSeq( 2 );
+
+ ::com::sun::star::drawing::Hatch aUnoHatch;
+
+ aUnoHatch.Style = (::com::sun::star::drawing::HatchStyle)aHatch.GetHatchStyle();
+ aUnoHatch.Color = aHatch.GetColor().GetColor();
+ aUnoHatch.Distance = aHatch.GetDistance();
+ aUnoHatch.Angle = aHatch.GetAngle();
+
+ rtl::OUString aApiName;
+ SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
+ aPropSeq[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ));
+ aPropSeq[0].Value = uno::makeAny( aApiName );
+ aPropSeq[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillHatch" ));
+ aPropSeq[1].Value = uno::makeAny( aUnoHatch );
+ rVal = uno::makeAny( aPropSeq );
+ break;
+ }
+
+ case MID_FILLHATCH:
+ {
+ ::com::sun::star::drawing::Hatch aUnoHatch;
+
+ aUnoHatch.Style = (::com::sun::star::drawing::HatchStyle)aHatch.GetHatchStyle();
+ aUnoHatch.Color = aHatch.GetColor().GetColor();
+ aUnoHatch.Distance = aHatch.GetDistance();
+ aUnoHatch.Angle = aHatch.GetAngle();
+ rVal <<= aUnoHatch;
+ break;
+ }
+
+ case MID_NAME:
+ {
+ rtl::OUString aApiName;
+ SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
+ rVal <<= aApiName;
+ break;
+ }
+
+ case MID_HATCH_STYLE:
+ rVal <<= (::com::sun::star::drawing::HatchStyle)aHatch.GetHatchStyle(); break;
+ case MID_HATCH_COLOR:
+ rVal <<= (sal_Int32)aHatch.GetColor().GetColor(); break;
+ case MID_HATCH_DISTANCE:
+ rVal <<= aHatch.GetDistance(); break;
+ case MID_HATCH_ANGLE:
+ rVal <<= aHatch.GetAngle(); break;
+
+ default: DBG_ERROR("Wrong MemberId!"); return sal_False;
+ }
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------
+sal_Bool XFillHatchItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
+{
+// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+
+ switch ( nMemberId )
+ {
+ case 0:
+ {
+ uno::Sequence< beans::PropertyValue > aPropSeq;
+ ::com::sun::star::drawing::Hatch aUnoHatch;
+ rtl::OUString aName;
+ bool bHatch( false );
+
+ if ( rVal >>= aPropSeq )
+ {
+ for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ )
+ {
+ if ( aPropSeq[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Name" )))
+ aPropSeq[n].Value >>= aName;
+ else if ( aPropSeq[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FillHatch" )))
+ {
+ if ( aPropSeq[n].Value >>= aUnoHatch )
+ bHatch = true;
+ }
+ }
+
+ SetName( aName );
+ if ( bHatch )
+ {
+ aHatch.SetHatchStyle( (XHatchStyle)aUnoHatch.Style );
+ aHatch.SetColor( aUnoHatch.Color );
+ aHatch.SetDistance( aUnoHatch.Distance );
+ aHatch.SetAngle( aUnoHatch.Angle );
+ }
+
+ return sal_True;
+ }
+
+ return sal_False;
+ }
+
+ case MID_FILLHATCH:
+ {
+ ::com::sun::star::drawing::Hatch aUnoHatch;
+ if(!(rVal >>= aUnoHatch))
+ return sal_False;
+
+ aHatch.SetHatchStyle( (XHatchStyle)aUnoHatch.Style );
+ aHatch.SetColor( aUnoHatch.Color );
+ aHatch.SetDistance( aUnoHatch.Distance );
+ aHatch.SetAngle( aUnoHatch.Angle );
+ break;
+ }
+
+ case MID_NAME:
+ {
+ rtl::OUString aName;
+ if (!(rVal >>= aName ))
+ return sal_False;
+ SetName( aName );
+ break;
+ }
+
+ case MID_HATCH_STYLE:
+ {
+ sal_Int16 nVal = sal_Int16();
+ if (!(rVal >>= nVal ))
+ return sal_False;
+ aHatch.SetHatchStyle( (XHatchStyle)nVal );
+ break;
+ }
+
+ case MID_HATCH_COLOR:
+ case MID_HATCH_DISTANCE:
+ case MID_HATCH_ANGLE:
+ {
+ sal_Int32 nVal = 0;
+ if (!(rVal >>= nVal ))
+ return sal_False;
+
+ if ( nMemberId == MID_HATCH_COLOR )
+ aHatch.SetColor( nVal );
+ else if ( nMemberId == MID_HATCH_DISTANCE )
+ aHatch.SetDistance( nVal );
+ else
+ aHatch.SetAngle( nVal );
+ break;
+ }
+
+ default: DBG_ERROR("Wrong MemberId!"); return sal_False;
+ }
+
+ return sal_True;
+}
+
+sal_Bool XFillHatchItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
+{
+ return ((XFillHatchItem*)p1)->GetHatchValue() == ((XFillHatchItem*)p2)->GetHatchValue();
+}
+
+XFillHatchItem* XFillHatchItem::checkForUniqueItem( SdrModel* pModel ) const
+{
+ if( pModel )
+ {
+ const String aUniqueName = NameOrIndex::CheckNamedItem( this,
+ XATTR_FILLHATCH,
+ &pModel->GetItemPool(),
+ pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL,
+ XFillHatchItem::CompareValueFunc,
+ RID_SVXSTR_HATCH10,
+ pModel->GetHatchList() );
+
+ // if the given name is not valid, replace it!
+ if( aUniqueName != GetName() )
+ {
+ return new XFillHatchItem( aUniqueName, aHatch );
+ }
+ }
+
+ return (XFillHatchItem*)this;
+}
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// FormText-Attribute
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//-------------------------
+// class XFormTextStyleItem
+//-------------------------
+TYPEINIT1_AUTOFACTORY(XFormTextStyleItem, SfxEnumItem);
+
+/*************************************************************************
+|*
+|* XFormTextStyleItem::XFormTextStyleItem()
+|*
+|* Beschreibung
+|* Ersterstellung 02.02.95 ESO
+|* Letzte Aenderung 02.02.95 ESO
+|*
+*************************************************************************/
+
+XFormTextStyleItem::XFormTextStyleItem(XFormTextStyle eTheStyle) :
+ SfxEnumItem(XATTR_FORMTXTSTYLE, sal::static_int_cast< sal_uInt16 >(eTheStyle))
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextStyleItem::XFormTextStyleItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 02.02.95 ESO
+|* Letzte Aenderung 02.02.95 ESO
+|*
+*************************************************************************/
+
+XFormTextStyleItem::XFormTextStyleItem(SvStream& rIn) :
+ SfxEnumItem(XATTR_FORMTXTSTYLE, rIn)
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextStyleItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 02.02.95 ESO
+|* Letzte Aenderung 02.02.95 ESO
+|*
+*************************************************************************/
+
+SfxPoolItem* XFormTextStyleItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XFormTextStyleItem( *this );
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XFormTextStyleItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 02.02.95 ESO
+|* Letzte Aenderung 02.02.95 ESO
+|*
+*************************************************************************/
+
+SfxPoolItem* XFormTextStyleItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFormTextStyleItem(rIn);
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\*************************************************************************/
+
+sal_uInt16 XFormTextStyleItem::GetValueCount() const
+{
+ return 5;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\*************************************************************************/
+
+// #FontWork#
+sal_Bool XFormTextStyleItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (sal_Int32)GetValue();
+ return sal_True;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\*************************************************************************/
+
+// #FontWork#
+sal_Bool XFormTextStyleItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ sal_Int32 nValue = 0;
+ rVal >>= nValue;
+ SetValue(sal::static_int_cast< sal_uInt16 >(nValue));
+
+ return sal_True;
+}
+
+//-------------------------
+// class XFormTextAdjustItem
+//-------------------------
+TYPEINIT1_AUTOFACTORY(XFormTextAdjustItem, SfxEnumItem);
+
+/*************************************************************************
+|*
+|* XFormTextAdjustItem::XFormTextAdjustItem()
+|*
+|* Beschreibung
+|* Ersterstellung 02.02.95 ESO
+|* Letzte Aenderung 02.02.95 ESO
+|*
+*************************************************************************/
+
+XFormTextAdjustItem::XFormTextAdjustItem(XFormTextAdjust eTheAdjust) :
+ SfxEnumItem(XATTR_FORMTXTADJUST, sal::static_int_cast< sal_uInt16 >(eTheAdjust))
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextAdjustItem::XFormTextAdjustItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 02.02.95 ESO
+|* Letzte Aenderung 02.02.95 ESO
+|*
+*************************************************************************/
+
+XFormTextAdjustItem::XFormTextAdjustItem(SvStream& rIn) :
+ SfxEnumItem(XATTR_FORMTXTADJUST, rIn)
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextAdjustItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 02.02.95 ESO
+|* Letzte Aenderung 02.02.95 ESO
+|*
+*************************************************************************/
+
+SfxPoolItem* XFormTextAdjustItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XFormTextAdjustItem( *this );
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XFormTextAdjustItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 02.02.95 ESO
+|* Letzte Aenderung 02.02.95 ESO
+|*
+*************************************************************************/
+
+SfxPoolItem* XFormTextAdjustItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFormTextAdjustItem(rIn);
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\*************************************************************************/
+
+sal_uInt16 XFormTextAdjustItem::GetValueCount() const
+{
+ return 4;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\*************************************************************************/
+
+// #FontWork#
+sal_Bool XFormTextAdjustItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (sal_Int32)GetValue();
+ return sal_True;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\*************************************************************************/
+
+// #FontWork#
+sal_Bool XFormTextAdjustItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ sal_Int32 nValue = 0;
+ rVal >>= nValue;
+ SetValue(sal::static_int_cast< sal_uInt16 >(nValue));
+
+ return sal_True;
+}
+
+//----------------------------
+// class XFormTextDistanceItem
+//----------------------------
+TYPEINIT1_AUTOFACTORY(XFormTextDistanceItem, SfxMetricItem);
+
+/*************************************************************************
+|*
+|* XFormTextDistanceItem::XFormTextDistanceItem()
+|*
+|* Beschreibung
+|* Ersterstellung 02.02.95 ESO
+|* Letzte Aenderung 02.02.95 ESO
+|*
+*************************************************************************/
+
+XFormTextDistanceItem::XFormTextDistanceItem(long nDist) :
+ SfxMetricItem(XATTR_FORMTXTDISTANCE, nDist)
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextDistanceItem::XFormTextDistanceItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 02.02.95 ESO
+|* Letzte Aenderung 02.02.95 ESO
+|*
+*************************************************************************/
+
+XFormTextDistanceItem::XFormTextDistanceItem(SvStream& rIn) :
+ SfxMetricItem(XATTR_FORMTXTDISTANCE, rIn)
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextDistanceItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 02.02.95 ESO
+|* Letzte Aenderung 02.02.95 ESO
+|*
+*************************************************************************/
+
+SfxPoolItem* XFormTextDistanceItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XFormTextDistanceItem(*this);
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XFormTextDistanceItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 02.02.95 ESO
+|* Letzte Aenderung 02.02.95 ESO
+|*
+*************************************************************************/
+
+SfxPoolItem* XFormTextDistanceItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFormTextDistanceItem(rIn);
+}
+
+//-------------------------
+// class XFormTextStartItem
+//-------------------------
+TYPEINIT1_AUTOFACTORY(XFormTextStartItem, SfxMetricItem);
+
+/*************************************************************************
+|*
+|* XFormTextStartItem::XFormTextStartItem(long nStart)
+|*
+|* Beschreibung
+|* Ersterstellung 02.02.95 ESO
+|* Letzte Aenderung 02.02.95 ESO
+|*
+*************************************************************************/
+
+XFormTextStartItem::XFormTextStartItem(long nStart) :
+ SfxMetricItem(XATTR_FORMTXTSTART, nStart)
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextStartItem::XFormTextStartItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 02.02.95 ESO
+|* Letzte Aenderung 02.02.95 ESO
+|*
+*************************************************************************/
+
+XFormTextStartItem::XFormTextStartItem(SvStream& rIn) :
+ SfxMetricItem(XATTR_FORMTXTSTART, rIn)
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextStartItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 02.02.95 ESO
+|* Letzte Aenderung 02.02.95 ESO
+|*
+*************************************************************************/
+
+SfxPoolItem* XFormTextStartItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XFormTextStartItem(*this);
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XFormTextStartItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 02.02.95 ESO
+|* Letzte Aenderung 02.02.95 ESO
+|*
+*************************************************************************/
+
+SfxPoolItem* XFormTextStartItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFormTextStartItem(rIn);
+}
+
+// -------------------------
+// class XFormTextMirrorItem
+// -------------------------
+TYPEINIT1_AUTOFACTORY(XFormTextMirrorItem, SfxBoolItem);
+
+/*************************************************************************
+|*
+|* XFormTextMirrorItem::XFormTextMirrorItem(sal_Bool bMirror)
+|*
+|* Ersterstellung 06.02.95 ESO
+|* Letzte Aenderung 06.02.95 ESO
+|*
+*************************************************************************/
+
+XFormTextMirrorItem::XFormTextMirrorItem(sal_Bool bMirror) :
+ SfxBoolItem(XATTR_FORMTXTMIRROR, bMirror)
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextMirrorItem::XFormTextMirrorItem(SvStream& rIn)
+|*
+|* Ersterstellung 06.02.95 ESO
+|* Letzte Aenderung 06.02.95 ESO
+|*
+*************************************************************************/
+
+XFormTextMirrorItem::XFormTextMirrorItem(SvStream& rIn) :
+ SfxBoolItem(XATTR_FORMTXTMIRROR, rIn)
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextMirrorItem::Clone(SfxItemPool* pPool) const
+|*
+|* Ersterstellung 06.02.95 ESO
+|* Letzte Aenderung 06.02.95 ESO
+|*
+*************************************************************************/
+
+SfxPoolItem* XFormTextMirrorItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XFormTextMirrorItem(*this);
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XFormTextMirrorItem::Create(SvStream& rIn, sal_uInt16 nVer)
+|* const
+|*
+|* Ersterstellung 06.02.95 ESO
+|* Letzte Aenderung 06.02.95 ESO
+|*
+*************************************************************************/
+
+SfxPoolItem* XFormTextMirrorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFormTextMirrorItem(rIn);
+}
+
+
+// --------------------------
+// class XFormTextOutlineItem
+// --------------------------
+TYPEINIT1_AUTOFACTORY(XFormTextOutlineItem, SfxBoolItem);
+
+/*************************************************************************
+|*
+|* XFormTextOutlineItem::XFormTextOutlineItem()
+|*
+|* Ersterstellung 27.06.95 ESO
+|* Letzte Aenderung 27.06.95 ESO
+|*
+*************************************************************************/
+
+XFormTextOutlineItem::XFormTextOutlineItem(sal_Bool bOutline) :
+ SfxBoolItem(XATTR_FORMTXTOUTLINE, bOutline)
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextOutlineItem::XFormTextOutlineItem(SvStream& rIn)
+|*
+|* Ersterstellung 27.06.95 ESO
+|* Letzte Aenderung 27.06.95 ESO
+|*
+*************************************************************************/
+
+XFormTextOutlineItem::XFormTextOutlineItem(SvStream& rIn) :
+ SfxBoolItem(XATTR_FORMTXTOUTLINE, rIn)
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextOutlineItem::Clone(SfxItemPool* pPool) const
+|*
+|* Ersterstellung 27.06.95 ESO
+|* Letzte Aenderung 27.06.95 ESO
+|*
+*************************************************************************/
+
+SfxPoolItem* XFormTextOutlineItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XFormTextOutlineItem(*this);
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XFormTextOutlineItem::Create(SvStream& rIn, sal_uInt16 nVer)
+|* const
+|*
+|* Ersterstellung 27.06.95 ESO
+|* Letzte Aenderung 27.06.95 ESO
+|*
+*************************************************************************/
+
+SfxPoolItem* XFormTextOutlineItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFormTextOutlineItem(rIn);
+}
+
+//--------------------------
+// class XFormTextShadowItem
+//--------------------------
+TYPEINIT1_AUTOFACTORY(XFormTextShadowItem, SfxEnumItem);
+
+/*************************************************************************
+|*
+|* XFormTextShadowItem::XFormTextShadowItem()
+|*
+|* Beschreibung
+|* Ersterstellung 27.06.95
+|* Letzte Aenderung 27.06.95
+|*
+*************************************************************************/
+
+XFormTextShadowItem::XFormTextShadowItem(XFormTextShadow eFormTextShadow) :
+ SfxEnumItem(
+ XATTR_FORMTXTSHADOW, sal::static_int_cast< sal_uInt16 >(eFormTextShadow))
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextShadowItem::XFormTextShadowItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 27.06.95
+|* Letzte Aenderung 27.06.95
+|*
+*************************************************************************/
+
+XFormTextShadowItem::XFormTextShadowItem(SvStream& rIn) :
+ SfxEnumItem(XATTR_FORMTXTSHADOW, rIn)
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextShadowItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 27.06.95
+|* Letzte Aenderung 27.06.95
+|*
+*************************************************************************/
+
+SfxPoolItem* XFormTextShadowItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XFormTextShadowItem( *this );
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XFormTextShadowItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 27.06.95
+|* Letzte Aenderung 27.06.95
+|*
+*************************************************************************/
+
+SfxPoolItem* XFormTextShadowItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFormTextShadowItem(rIn);
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\*************************************************************************/
+
+sal_uInt16 XFormTextShadowItem::GetValueCount() const
+{
+ return 3;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\*************************************************************************/
+
+// #FontWork#
+sal_Bool XFormTextShadowItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (sal_Int32)GetValue();
+ return sal_True;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\*************************************************************************/
+
+// #FontWork#
+sal_Bool XFormTextShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ sal_Int32 nValue = 0;
+ rVal >>= nValue;
+ SetValue(sal::static_int_cast< sal_uInt16 >(nValue));
+
+ return sal_True;
+}
+
+// -------------------------------
+// class XFormTextShadowColorItem
+// -------------------------------
+TYPEINIT1_AUTOFACTORY(XFormTextShadowColorItem, XColorItem);
+
+/*************************************************************************
+|*
+|* XFormTextShadowColorItem::XFormTextShadowColorItem()
+|*
+|* Beschreibung
+|* Ersterstellung 27.06.95
+|* Letzte Aenderung 27.06.95
+|*
+*************************************************************************/
+
+XFormTextShadowColorItem::XFormTextShadowColorItem(sal_Int32 nIndex,
+ const Color& rTheColor) :
+ XColorItem(XATTR_FORMTXTSHDWCOLOR, nIndex, rTheColor)
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextShadowColorItem::XFormTextShadowColorItem(const XubString& rName, const Color& rTheColor)
+|*
+|* Beschreibung
+|* Ersterstellung 27.06.95
+|* Letzte Aenderung 27.06.95
+|*
+*************************************************************************/
+
+XFormTextShadowColorItem::XFormTextShadowColorItem(const XubString& rName,
+ const Color& rTheColor) :
+ XColorItem(XATTR_FORMTXTSHDWCOLOR, rName, rTheColor)
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextShadowColorItem::XFormTextShadowColorItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 27.06.95
+|* Letzte Aenderung 27.06.95
+|*
+*************************************************************************/
+
+XFormTextShadowColorItem::XFormTextShadowColorItem(SvStream& rIn) :
+ XColorItem(XATTR_FORMTXTSHDWCOLOR, rIn)
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextShadowColorItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 27.06.95
+|* Letzte Aenderung 27.06.95
+|*
+*************************************************************************/
+
+SfxPoolItem* XFormTextShadowColorItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XFormTextShadowColorItem(*this);
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XFormTextShadowColorItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 27.06.95
+|* Letzte Aenderung 27.06.95
+|*
+*************************************************************************/
+
+SfxPoolItem* XFormTextShadowColorItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFormTextShadowColorItem(rIn);
+}
+
+//------------------------------
+// class XFormTextShadowXValItem
+//------------------------------
+TYPEINIT1_AUTOFACTORY(XFormTextShadowXValItem, SfxMetricItem);
+
+/*************************************************************************
+|*
+|* XFormTextShadowXValItem::XFormTextShadowXValItem(long)
+|*
+|* Beschreibung
+|* Ersterstellung 28.06.95 ESO
+|* Letzte Aenderung 28.06.95 ESO
+|*
+*************************************************************************/
+
+XFormTextShadowXValItem::XFormTextShadowXValItem(long nVal) :
+ SfxMetricItem(XATTR_FORMTXTSHDWXVAL, nVal)
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextShadowXValItem::XFormTextShadowXValItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 28.06.95 ESO
+|* Letzte Aenderung 28.06.95 ESO
+|*
+*************************************************************************/
+
+XFormTextShadowXValItem::XFormTextShadowXValItem(SvStream& rIn) :
+ SfxMetricItem(XATTR_FORMTXTSHDWXVAL, rIn)
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextShadowXValItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 28.06.95 ESO
+|* Letzte Aenderung 28.06.95 ESO
+|*
+*************************************************************************/
+
+SfxPoolItem* XFormTextShadowXValItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XFormTextShadowXValItem(*this);
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XFormTextShadowXValItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 28.06.95 ESO
+|* Letzte Aenderung 28.06.95 ESO
+|*
+*************************************************************************/
+
+SfxPoolItem* XFormTextShadowXValItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFormTextShadowXValItem(rIn);
+}
+
+//------------------------------
+// class XFormTextShadowYValItem
+//------------------------------
+TYPEINIT1_AUTOFACTORY(XFormTextShadowYValItem, SfxMetricItem);
+
+/*************************************************************************
+|*
+|* XFormTextShadowYValItem::XFormTextShadowYValItem(long)
+|*
+|* Beschreibung
+|* Ersterstellung 28.06.95 ESO
+|* Letzte Aenderung 28.06.95 ESO
+|*
+*************************************************************************/
+
+XFormTextShadowYValItem::XFormTextShadowYValItem(long nVal) :
+ SfxMetricItem(XATTR_FORMTXTSHDWYVAL, nVal)
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextShadowYValItem::XFormTextShadowYValItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 28.06.95 ESO
+|* Letzte Aenderung 28.06.95 ESO
+|*
+*************************************************************************/
+
+XFormTextShadowYValItem::XFormTextShadowYValItem(SvStream& rIn) :
+ SfxMetricItem(XATTR_FORMTXTSHDWYVAL, rIn)
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextShadowYValItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 28.06.95 ESO
+|* Letzte Aenderung 28.06.95 ESO
+|*
+*************************************************************************/
+
+SfxPoolItem* XFormTextShadowYValItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XFormTextShadowYValItem(*this);
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XFormTextShadowYValItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 28.06.95 ESO
+|* Letzte Aenderung 28.06.95 ESO
+|*
+*************************************************************************/
+
+SfxPoolItem* XFormTextShadowYValItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFormTextShadowYValItem(rIn);
+}
+
+//---------------------------
+// class XFormTextStdFormItem
+//---------------------------
+TYPEINIT1_AUTOFACTORY(XFormTextStdFormItem, SfxEnumItem);
+
+/*************************************************************************
+|*
+|* XFormTextStdFormItem::XFormTextStdFormItem()
+|*
+|* Beschreibung
+|* Ersterstellung 27.06.95
+|* Letzte Aenderung 27.06.95
+|*
+*************************************************************************/
+
+XFormTextStdFormItem::XFormTextStdFormItem(XFormTextStdForm eFormTextStdForm) :
+ SfxEnumItem(
+ XATTR_FORMTXTSTDFORM, sal::static_int_cast< sal_uInt16 >(eFormTextStdForm))
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextStdFormItem::XFormTextStdFormItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 27.06.95
+|* Letzte Aenderung 27.06.95
+|*
+*************************************************************************/
+
+XFormTextStdFormItem::XFormTextStdFormItem(SvStream& rIn) :
+ SfxEnumItem(XATTR_FORMTXTSTDFORM, rIn)
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextStdFormItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 27.06.95
+|* Letzte Aenderung 27.06.95
+|*
+*************************************************************************/
+
+SfxPoolItem* XFormTextStdFormItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XFormTextStdFormItem( *this );
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XFormTextStdFormItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 27.06.95
+|* Letzte Aenderung 27.06.95
+|*
+*************************************************************************/
+
+SfxPoolItem* XFormTextStdFormItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFormTextStdFormItem(rIn);
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\*************************************************************************/
+
+sal_uInt16 XFormTextStdFormItem::GetValueCount() const
+{
+ return 3;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\*************************************************************************/
+
+// #FontWork#
+sal_Bool XFormTextStdFormItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ rVal <<= (sal_Int32)GetValue();
+ return sal_True;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\*************************************************************************/
+
+// #FontWork#
+sal_Bool XFormTextStdFormItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ sal_Int32 nValue = 0;
+ rVal >>= nValue;
+ SetValue(sal::static_int_cast< sal_uInt16 >(nValue));
+
+ return sal_True;
+}
+
+// --------------------------
+// class XFormTextHideFormItem
+// --------------------------
+TYPEINIT1_AUTOFACTORY(XFormTextHideFormItem, SfxBoolItem);
+
+/*************************************************************************
+|*
+|* XFormTextHideFormItem::XFormTextHideFormItem()
+|*
+|* Ersterstellung 27.06.95 ESO
+|* Letzte Aenderung 27.06.95 ESO
+|*
+*************************************************************************/
+
+XFormTextHideFormItem::XFormTextHideFormItem(sal_Bool bHide) :
+ SfxBoolItem(XATTR_FORMTXTHIDEFORM, bHide)
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextHideFormItem::XFormTextHideFormItem(SvStream& rIn)
+|*
+|* Ersterstellung 27.06.95 ESO
+|* Letzte Aenderung 27.06.95 ESO
+|*
+*************************************************************************/
+
+XFormTextHideFormItem::XFormTextHideFormItem(SvStream& rIn) :
+ SfxBoolItem(XATTR_FORMTXTHIDEFORM, rIn)
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextHideFormItem::Clone(SfxItemPool* pPool) const
+|*
+|* Ersterstellung 27.06.95 ESO
+|* Letzte Aenderung 27.06.95 ESO
+|*
+*************************************************************************/
+
+SfxPoolItem* XFormTextHideFormItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XFormTextHideFormItem(*this);
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XFormTextHideFormItem::Create(SvStream& rIn, sal_uInt16 nVer)
+|* const
+|*
+|* Ersterstellung 27.06.95 ESO
+|* Letzte Aenderung 27.06.95 ESO
+|*
+*************************************************************************/
+
+SfxPoolItem* XFormTextHideFormItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFormTextHideFormItem(rIn);
+}
+
+
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// SetItems
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+TYPEINIT1(XLineAttrSetItem, SfxSetItem);
+
+/*************************************************************************
+|*
+|* Konstruktoren fuer Linienattribute-SetItem
+|*
+\************************************************************************/
+
+XLineAttrSetItem::XLineAttrSetItem( SfxItemSet* pItemSet ) :
+ SfxSetItem( XATTRSET_LINE, pItemSet)
+{
+}
+
+/************************************************************************/
+
+XLineAttrSetItem::XLineAttrSetItem( SfxItemPool* pItemPool ) :
+ SfxSetItem( XATTRSET_LINE,
+ new SfxItemSet( *pItemPool, XATTR_LINE_FIRST, XATTR_LINE_LAST))
+{
+}
+
+/************************************************************************/
+
+XLineAttrSetItem::XLineAttrSetItem( const XLineAttrSetItem& rLineAttr ) :
+ SfxSetItem( rLineAttr )
+{
+}
+
+/************************************************************************/
+
+XLineAttrSetItem::XLineAttrSetItem( const XLineAttrSetItem& rLineAttr,
+ SfxItemPool* pItemPool) :
+ SfxSetItem( rLineAttr, pItemPool )
+{
+}
+
+/*************************************************************************
+|*
+|* Clone-Funktion
+|*
+\************************************************************************/
+
+SfxPoolItem* XLineAttrSetItem::Clone( SfxItemPool* pPool ) const
+{
+ return new XLineAttrSetItem( *this, pPool );
+}
+
+/*************************************************************************
+|*
+|* SetItem aus Stream erzeugen
+|*
+\************************************************************************/
+
+SfxPoolItem* XLineAttrSetItem::Create( SvStream& rStream, sal_uInt16 /*nVersion*/) const
+{
+ SfxItemSet *pSet2 = new SfxItemSet( *GetItemSet().GetPool(),
+ XATTR_LINE_FIRST, XATTR_LINE_LAST);
+ pSet2->Load( rStream );
+ return new XLineAttrSetItem( pSet2 );
+}
+
+/*************************************************************************
+|*
+|* SetItem in Stream speichern
+|*
+\************************************************************************/
+
+SvStream& XLineAttrSetItem::Store( SvStream& rStream, sal_uInt16 nItemVersion ) const
+{
+ return SfxSetItem::Store( rStream, nItemVersion );
+}
+
+
+TYPEINIT1(XFillAttrSetItem, SfxSetItem);
+
+/*************************************************************************
+|*
+|* Konstruktoren fuer Fuellattribute-SetItem
+|*
+\************************************************************************/
+
+XFillAttrSetItem::XFillAttrSetItem( SfxItemSet* pItemSet ) :
+ SfxSetItem( XATTRSET_FILL, pItemSet)
+{
+}
+
+/************************************************************************/
+
+XFillAttrSetItem::XFillAttrSetItem( SfxItemPool* pItemPool ) :
+ SfxSetItem( XATTRSET_FILL,
+ new SfxItemSet( *pItemPool, XATTR_FILL_FIRST, XATTR_FILL_LAST))
+{
+}
+
+/************************************************************************/
+
+XFillAttrSetItem::XFillAttrSetItem( const XFillAttrSetItem& rFillAttr ) :
+ SfxSetItem( rFillAttr )
+{
+}
+
+/************************************************************************/
+
+XFillAttrSetItem::XFillAttrSetItem( const XFillAttrSetItem& rFillAttr,
+ SfxItemPool* pItemPool ) :
+ SfxSetItem( rFillAttr, pItemPool )
+{
+}
+
+/*************************************************************************
+|*
+|* Clone-Funktion
+|*
+\************************************************************************/
+
+SfxPoolItem* XFillAttrSetItem::Clone( SfxItemPool* pPool ) const
+{
+ return new XFillAttrSetItem( *this, pPool );
+}
+
+/*************************************************************************
+|*
+|* SetItem aus Stream erzeugen
+|*
+\************************************************************************/
+
+SfxPoolItem* XFillAttrSetItem::Create( SvStream& rStream, sal_uInt16 /*nVersion*/) const
+{
+ SfxItemSet *pSet2 = new SfxItemSet( *GetItemSet().GetPool(),
+ XATTR_FILL_FIRST, XATTR_FILL_LAST);
+ pSet2->Load( rStream );
+ return new XFillAttrSetItem( pSet2 );
+}
+
+/*************************************************************************
+|*
+|* SetItem in Stream speichern
+|*
+\************************************************************************/
+
+SvStream& XFillAttrSetItem::Store( SvStream& rStream, sal_uInt16 nItemVersion ) const
+{
+ return SfxSetItem::Store( rStream, nItemVersion );
+}
+
+// eof
+
diff --git a/svx/source/xoutdev/xattr2.cxx b/svx/source/xoutdev/xattr2.cxx
new file mode 100644
index 000000000000..cd82db743f4d
--- /dev/null
+++ b/svx/source/xoutdev/xattr2.cxx
@@ -0,0 +1,1712 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+
+#include <com/sun/star/drawing/LineJoint.hpp>
+#include <com/sun/star/uno/Any.hxx>
+
+#include <svx/dialogs.hrc>
+#include "svx/xattr.hxx"
+#include <svx/xtable.hxx>
+#include <svx/dialmgr.hxx>
+#include <editeng/itemtype.hxx>
+#include <svx/xdef.hxx>
+
+#define GLOBALOVERFLOW
+
+/************************************************************************/
+
+//------------------------------
+// class XLineTransparenceItem
+//------------------------------
+TYPEINIT1_AUTOFACTORY(XLineTransparenceItem, SfxUInt16Item);
+
+/*************************************************************************
+|*
+|* XLineTransparenceItem::XLineTransparenceItem(sal_uInt16)
+|*
+|* Beschreibung
+|* Ersterstellung 07.11.95 KA
+|* Letzte Aenderung 07.11.95 KA
+|*
+*************************************************************************/
+
+XLineTransparenceItem::XLineTransparenceItem(sal_uInt16 nLineTransparence) :
+ SfxUInt16Item(XATTR_LINETRANSPARENCE, nLineTransparence)
+{
+}
+
+/*************************************************************************
+|*
+|* XLineTransparenceItem::XLineTransparenceItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 07.11.95 KA
+|* Letzte Aenderung 07.11.95 KA
+|*
+*************************************************************************/
+
+XLineTransparenceItem::XLineTransparenceItem(SvStream& rIn) :
+ SfxUInt16Item(XATTR_LINETRANSPARENCE, rIn)
+{
+}
+
+/*************************************************************************
+|*
+|* XLineTransparenceItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 07.11.95 KA
+|* Letzte Aenderung 07.11.95 KA
+|*
+*************************************************************************/
+
+SfxPoolItem* XLineTransparenceItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XLineTransparenceItem(*this);
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XLineTransparenceItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 07.11.95 KA
+|* Letzte Aenderung 07.11.95 KA
+|*
+*************************************************************************/
+
+SfxPoolItem* XLineTransparenceItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XLineTransparenceItem(rIn);
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation XLineTransparenceItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ rText.Erase();
+
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ return ePres;
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText = XubString( ResId( RID_SVXSTR_TRANSPARENCE, DIALOG_MGR() ) );
+ rText.AppendAscii(": ");
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ rText += XubString( UniString::CreateFromInt32((sal_uInt16) GetValue()) );
+ rText += sal_Unicode('%');
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+//-----------------------
+// class XLineJointItem -
+//-----------------------
+
+TYPEINIT1_AUTOFACTORY(XLineJointItem, SfxEnumItem);
+
+// -----------------------------------------------------------------------------
+
+XLineJointItem::XLineJointItem( XLineJoint eLineJoint ) :
+ SfxEnumItem(XATTR_LINEJOINT, sal::static_int_cast< sal_uInt16 >(eLineJoint))
+{
+}
+
+// -----------------------------------------------------------------------------
+
+XLineJointItem::XLineJointItem( SvStream& rIn ) :
+ SfxEnumItem( XATTR_LINEJOINT, rIn )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+sal_uInt16 XLineJointItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/) const
+{
+ return 1;
+}
+
+// -----------------------------------------------------------------------------
+
+SfxPoolItem* XLineJointItem::Create( SvStream& rIn, sal_uInt16 nVer ) const
+{
+ XLineJointItem* pRet = new XLineJointItem( rIn );
+
+ if(nVer < 1)
+ pRet->SetValue(XLINEJOINT_ROUND);
+
+ return pRet;
+}
+
+// -----------------------------------------------------------------------------
+
+SfxPoolItem* XLineJointItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XLineJointItem( *this );
+}
+
+// -----------------------------------------------------------------------------
+
+SfxItemPresentation XLineJointItem::GetPresentation( SfxItemPresentation ePres, SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/, XubString& rText, const IntlWrapper*) const
+{
+ rText.Erase();
+
+ switch( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE: return ePres;
+
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ {
+ sal_uInt16 nId = 0;
+
+ switch( GetValue() )
+ {
+ case( XLINEJOINT_NONE ):
+ nId = RID_SVXSTR_LINEJOINT_NONE;
+ break;
+
+ case( XLINEJOINT_MIDDLE ):
+ nId = RID_SVXSTR_LINEJOINT_MIDDLE;
+ break;
+
+
+ case( XLINEJOINT_BEVEL ):
+ nId = RID_SVXSTR_LINEJOINT_BEVEL;
+ break;
+
+
+ case( XLINEJOINT_MITER ):
+ nId = RID_SVXSTR_LINEJOINT_MITER;
+ break;
+
+
+ case( XLINEJOINT_ROUND ):
+ nId = RID_SVXSTR_LINEJOINT_ROUND;
+ break;
+ }
+
+ if( nId )
+ rText = SVX_RESSTR( nId );
+
+ return ePres;
+ }
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool XLineJointItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
+{
+ ::com::sun::star::drawing::LineJoint eJoint = ::com::sun::star::drawing::LineJoint_NONE;
+
+ switch( GetValue() )
+ {
+ case XLINEJOINT_NONE:
+ break;
+ case XLINEJOINT_MIDDLE:
+ eJoint = ::com::sun::star::drawing::LineJoint_MIDDLE;
+ break;
+ case XLINEJOINT_BEVEL:
+ eJoint = ::com::sun::star::drawing::LineJoint_BEVEL;
+ break;
+ case XLINEJOINT_MITER:
+ eJoint = ::com::sun::star::drawing::LineJoint_MITER;
+ break;
+ case XLINEJOINT_ROUND:
+ eJoint = ::com::sun::star::drawing::LineJoint_ROUND;
+ break;
+ default:
+ DBG_ERROR( "Unknown LineJoint enum value!" );
+ }
+
+ rVal <<= eJoint;
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool XLineJointItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
+{
+ XLineJoint eJoint = XLINEJOINT_NONE;
+ ::com::sun::star::drawing::LineJoint eUnoJoint;
+
+ if(!(rVal >>= eUnoJoint))
+ {
+ // also try an int (for Basic)
+ sal_Int32 nLJ = 0;
+ if(!(rVal >>= nLJ))
+ return sal_False;
+ eUnoJoint = (::com::sun::star::drawing::LineJoint)nLJ;
+ }
+
+ switch( eUnoJoint )
+ {
+ case ::com::sun::star::drawing::LineJoint_MIDDLE:
+ eJoint = XLINEJOINT_MIDDLE;
+ break;
+ case ::com::sun::star::drawing::LineJoint_BEVEL:
+ eJoint = XLINEJOINT_BEVEL;
+ break;
+ case ::com::sun::star::drawing::LineJoint_MITER:
+ eJoint = XLINEJOINT_MITER;
+ break;
+ case ::com::sun::star::drawing::LineJoint_ROUND:
+ eJoint = XLINEJOINT_ROUND;
+ break;
+ default:
+ break;
+ }
+
+ SetValue( sal::static_int_cast< sal_uInt16 >( eJoint ) );
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_uInt16 XLineJointItem::GetValueCount() const
+{
+ // don't forget to update the api interface also
+ return 5;
+}
+
+//------------------------------
+// class XFillTransparenceItem
+//------------------------------
+TYPEINIT1_AUTOFACTORY(XFillTransparenceItem, SfxUInt16Item);
+
+/*************************************************************************
+|*
+|* XFillTransparenceItem::XFillTransparenceItem(sal_uInt16)
+|*
+|* Beschreibung
+|* Ersterstellung 07.11.95 KA
+|* Letzte Aenderung 07.11.95 KA
+|*
+*************************************************************************/
+
+XFillTransparenceItem::XFillTransparenceItem(sal_uInt16 nFillTransparence) :
+ SfxUInt16Item(XATTR_FILLTRANSPARENCE, nFillTransparence)
+{
+}
+
+/*************************************************************************
+|*
+|* XFillTransparenceItem::XFillTransparenceItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 07.11.95 KA
+|* Letzte Aenderung 07.11.95 KA
+|*
+*************************************************************************/
+
+XFillTransparenceItem::XFillTransparenceItem(SvStream& rIn) :
+ SfxUInt16Item(XATTR_FILLTRANSPARENCE, rIn)
+{
+}
+
+/*************************************************************************
+|*
+|* XFillTransparenceItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 07.11.95 KA
+|* Letzte Aenderung 07.11.95 KA
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillTransparenceItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XFillTransparenceItem(*this);
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XFillTransparenceItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 07.11.95 KA
+|* Letzte Aenderung 07.11.95 KA
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillTransparenceItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFillTransparenceItem(rIn);
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation XFillTransparenceItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ rText.Erase();
+
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ return ePres;
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText = XubString( ResId( RID_SVXSTR_TRANSPARENCE, DIALOG_MGR() ) );
+ rText.AppendAscii(": ");
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ rText += XubString( UniString::CreateFromInt32((sal_uInt16) GetValue() ));
+ rText += sal_Unicode('%');
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+//------------------------------
+// class XFormTextShadowTranspItem
+//------------------------------
+TYPEINIT1_AUTOFACTORY(XFormTextShadowTranspItem, SfxUInt16Item);
+
+/*************************************************************************
+|*
+|* XFormTextShadowTranspItem::XFormTextShadowTranspItem(sal_uInt16)
+|*
+|* Beschreibung
+|* Ersterstellung 09.11.95 KA
+|* Letzte Aenderung 09.11.95 KA
+|*
+*************************************************************************/
+
+XFormTextShadowTranspItem::XFormTextShadowTranspItem(sal_uInt16 nShdwTransparence) :
+ SfxUInt16Item(XATTR_FORMTXTSHDWTRANSP, nShdwTransparence)
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextShadowTranspItem::XFormTextShadowTranspItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 09.11.95 KA
+|* Letzte Aenderung 09.11.95 KA
+|*
+*************************************************************************/
+
+XFormTextShadowTranspItem::XFormTextShadowTranspItem(SvStream& rIn) :
+ SfxUInt16Item(XATTR_FORMTXTSHDWTRANSP, rIn)
+{
+}
+
+/*************************************************************************
+|*
+|* XFormTextShadowTranspItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 09.11.95 KA
+|* Letzte Aenderung 09.11.95 KA
+|*
+*************************************************************************/
+
+SfxPoolItem* XFormTextShadowTranspItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XFormTextShadowTranspItem(*this);
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XFormTextShadowTranspItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 09.11.95 KA
+|* Letzte Aenderung 09.11.95 KA
+|*
+*************************************************************************/
+
+SfxPoolItem* XFormTextShadowTranspItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFormTextShadowTranspItem(rIn);
+}
+
+
+//------------------------------
+// class XFillGradientStepCountItem
+//------------------------------
+TYPEINIT1_AUTOFACTORY(XGradientStepCountItem, SfxUInt16Item);
+
+/*************************************************************************
+|*
+|* XGradientStepCountItem::XGradientStepCountItem( sal_uInt16 )
+|*
+|* Beschreibung
+|* Ersterstellung 23.01.96 KA
+|* Letzte Aenderung 23.01.96 KA
+|*
+*************************************************************************/
+
+XGradientStepCountItem::XGradientStepCountItem( sal_uInt16 nStepCount ) :
+ SfxUInt16Item( XATTR_GRADIENTSTEPCOUNT, nStepCount )
+{
+}
+
+/*************************************************************************
+|*
+|* XGradientStepCountItem::XGradientStepCountItem( SvStream& rIn )
+|*
+|* Beschreibung
+|* Ersterstellung 23.01.96 KA
+|* Letzte Aenderung 23.01.96 KA
+|*
+*************************************************************************/
+
+XGradientStepCountItem::XGradientStepCountItem( SvStream& rIn ) :
+ SfxUInt16Item( XATTR_GRADIENTSTEPCOUNT, rIn )
+{
+}
+
+/*************************************************************************
+|*
+|* XGradientStepCountItem::Clone( SfxItemPool* pPool ) const
+|*
+|* Beschreibung
+|* Ersterstellung 23.01.96 KA
+|* Letzte Aenderung 23.01.96 KA
+|*
+*************************************************************************/
+
+SfxPoolItem* XGradientStepCountItem::Clone( SfxItemPool* /*pPool*/) const
+{
+ return new XGradientStepCountItem( *this );
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XGradientStepCountItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 23.01.96 KA
+|* Letzte Aenderung 23.01.96 KA
+|*
+*************************************************************************/
+
+SfxPoolItem* XGradientStepCountItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XGradientStepCountItem( rIn );
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation XGradientStepCountItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ rText.Erase();
+
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ return ePres;
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+// rText = XubString( ResId( RID_SVXSTR_GRADIENTSTEPCOUNT, DIALOG_MGR() ) );
+// rText += ": ";
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ rText += XubString( UniString::CreateFromInt32((sal_uInt16) GetValue() ));
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+
+//------------------------------
+// class XFillBmpTileItem
+//------------------------------
+TYPEINIT1_AUTOFACTORY( XFillBmpTileItem, SfxBoolItem );
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+XFillBmpTileItem::XFillBmpTileItem( sal_Bool bTile ) :
+ SfxBoolItem( XATTR_FILLBMP_TILE, bTile )
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+XFillBmpTileItem::XFillBmpTileItem( SvStream& rIn ) :
+ SfxBoolItem( XATTR_FILLBMP_TILE, rIn )
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillBmpTileItem::Clone( SfxItemPool* /*pPool*/) const
+{
+ return new XFillBmpTileItem( *this );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillBmpTileItem::Create( SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFillBmpTileItem( rIn );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+SfxItemPresentation XFillBmpTileItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ rText.Erase();
+
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ return ePres;
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+
+//------------------------------
+// class XFillBmpTilePosItem
+//------------------------------
+TYPEINIT1_AUTOFACTORY( XFillBmpPosItem, SfxEnumItem );
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+XFillBmpPosItem::XFillBmpPosItem( RECT_POINT eRP ) :
+ SfxEnumItem( XATTR_FILLBMP_POS, sal::static_int_cast< sal_uInt16 >( eRP ) )
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+XFillBmpPosItem::XFillBmpPosItem( SvStream& rIn ) :
+ SfxEnumItem( XATTR_FILLBMP_POS, rIn )
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillBmpPosItem::Clone( SfxItemPool* /*pPool*/) const
+{
+ return new XFillBmpPosItem( *this );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillBmpPosItem::Create( SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFillBmpPosItem( rIn );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+SfxItemPresentation XFillBmpPosItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ rText.Erase();
+
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ return ePres;
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+/******************************************************************************
+|*
+|*
+|*
+\******************************************************************************/
+
+sal_uInt16 XFillBmpPosItem::GetValueCount() const
+{
+ return 9;
+}
+
+
+//------------------------------
+// class XFillBmpTileSizeXItem
+//------------------------------
+TYPEINIT1_AUTOFACTORY( XFillBmpSizeXItem, SfxMetricItem );
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+XFillBmpSizeXItem::XFillBmpSizeXItem( long nSizeX ) :
+ SfxMetricItem( XATTR_FILLBMP_SIZEX, nSizeX )
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+XFillBmpSizeXItem::XFillBmpSizeXItem( SvStream& rIn ) :
+ SfxMetricItem( XATTR_FILLBMP_SIZEX, rIn )
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillBmpSizeXItem::Clone( SfxItemPool* /*pPool*/) const
+{
+ return new XFillBmpSizeXItem( *this );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillBmpSizeXItem::Create( SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFillBmpSizeXItem( rIn );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+SfxItemPresentation XFillBmpSizeXItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ rText.Erase();
+
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ return ePres;
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Beschreibung
+|* Ersterstellung 05.11.96 KA
+|* Letzte Aenderung 05.11.96 KA
+|*
+\*************************************************************************/
+
+FASTBOOL XFillBmpSizeXItem::HasMetrics() const
+{
+ return GetValue() > 0L;
+}
+
+
+//------------------------------
+// class XFillBmpTileSizeYItem
+//------------------------------
+TYPEINIT1_AUTOFACTORY( XFillBmpSizeYItem, SfxMetricItem );
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+XFillBmpSizeYItem::XFillBmpSizeYItem( long nSizeY ) :
+ SfxMetricItem( XATTR_FILLBMP_SIZEY, nSizeY )
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+XFillBmpSizeYItem::XFillBmpSizeYItem( SvStream& rIn ) :
+ SfxMetricItem( XATTR_FILLBMP_SIZEY, rIn )
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillBmpSizeYItem::Clone( SfxItemPool* /*pPool*/) const
+{
+ return new XFillBmpSizeYItem( *this );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillBmpSizeYItem::Create( SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFillBmpSizeYItem( rIn );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+SfxItemPresentation XFillBmpSizeYItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ rText.Erase();
+
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ return ePres;
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Beschreibung
+|* Ersterstellung 05.11.96 KA
+|* Letzte Aenderung 05.11.96 KA
+|*
+\*************************************************************************/
+
+FASTBOOL XFillBmpSizeYItem::HasMetrics() const
+{
+ return GetValue() > 0L;
+}
+
+
+//------------------------------
+// class XFillBmpTileLogItem
+//------------------------------
+TYPEINIT1_AUTOFACTORY( XFillBmpSizeLogItem, SfxBoolItem );
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+XFillBmpSizeLogItem::XFillBmpSizeLogItem( sal_Bool bLog ) :
+ SfxBoolItem( XATTR_FILLBMP_SIZELOG, bLog )
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+XFillBmpSizeLogItem::XFillBmpSizeLogItem( SvStream& rIn ) :
+ SfxBoolItem( XATTR_FILLBMP_SIZELOG, rIn )
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillBmpSizeLogItem::Clone( SfxItemPool* /*pPool*/) const
+{
+ return new XFillBmpSizeLogItem( *this );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillBmpSizeLogItem::Create( SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFillBmpSizeLogItem( rIn );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+SfxItemPresentation XFillBmpSizeLogItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ rText.Erase();
+
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ return ePres;
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+
+//------------------------------
+// class XFillBmpTileOffXItem
+//------------------------------
+TYPEINIT1_AUTOFACTORY( XFillBmpTileOffsetXItem, SfxUInt16Item );
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+XFillBmpTileOffsetXItem::XFillBmpTileOffsetXItem( sal_uInt16 nOffX ) :
+ SfxUInt16Item( XATTR_FILLBMP_TILEOFFSETX, nOffX )
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+XFillBmpTileOffsetXItem::XFillBmpTileOffsetXItem( SvStream& rIn ) :
+ SfxUInt16Item( XATTR_FILLBMP_TILEOFFSETX, rIn )
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillBmpTileOffsetXItem::Clone( SfxItemPool* /*pPool*/) const
+{
+ return new XFillBmpTileOffsetXItem( *this );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillBmpTileOffsetXItem::Create( SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFillBmpTileOffsetXItem( rIn );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+SfxItemPresentation XFillBmpTileOffsetXItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ rText.Erase();
+
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ return ePres;
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+
+//------------------------------
+// class XFillBmpTileOffYItem
+//------------------------------
+TYPEINIT1_AUTOFACTORY( XFillBmpTileOffsetYItem, SfxUInt16Item );
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+XFillBmpTileOffsetYItem::XFillBmpTileOffsetYItem( sal_uInt16 nOffY ) :
+ SfxUInt16Item( XATTR_FILLBMP_TILEOFFSETY, nOffY )
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+XFillBmpTileOffsetYItem::XFillBmpTileOffsetYItem( SvStream& rIn ) :
+ SfxUInt16Item( XATTR_FILLBMP_TILEOFFSETY, rIn )
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillBmpTileOffsetYItem::Clone( SfxItemPool* /*pPool*/) const
+{
+ return new XFillBmpTileOffsetYItem( *this );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillBmpTileOffsetYItem::Create( SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFillBmpTileOffsetYItem( rIn );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+SfxItemPresentation XFillBmpTileOffsetYItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ rText.Erase();
+
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ return ePres;
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+
+//------------------------------
+// class XFillBmpStretchItem
+//------------------------------
+TYPEINIT1_AUTOFACTORY( XFillBmpStretchItem, SfxBoolItem );
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+XFillBmpStretchItem::XFillBmpStretchItem( sal_Bool bStretch ) :
+ SfxBoolItem( XATTR_FILLBMP_STRETCH, bStretch )
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+XFillBmpStretchItem::XFillBmpStretchItem( SvStream& rIn ) :
+ SfxBoolItem( XATTR_FILLBMP_STRETCH, rIn )
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillBmpStretchItem::Clone( SfxItemPool* /*pPool*/) const
+{
+ return new XFillBmpStretchItem( *this );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillBmpStretchItem::Create( SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFillBmpStretchItem( rIn );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung 28.02.96 KA
+|* Letzte Aenderung 28.02.96 KA
+|*
+*************************************************************************/
+
+SfxItemPresentation XFillBmpStretchItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ rText.Erase();
+
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ return ePres;
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+
+//------------------------------
+// class XFillBmpTileOffPosXItem
+//------------------------------
+TYPEINIT1_AUTOFACTORY( XFillBmpPosOffsetXItem, SfxUInt16Item );
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung KA 29.04.96
+|* Letzte Aenderung KA 29.04.96
+|*
+*************************************************************************/
+
+XFillBmpPosOffsetXItem::XFillBmpPosOffsetXItem( sal_uInt16 nOffPosX ) :
+ SfxUInt16Item( XATTR_FILLBMP_POSOFFSETX, nOffPosX )
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung KA 29.04.96
+|* Letzte Aenderung KA 29.04.96
+|*
+*************************************************************************/
+
+XFillBmpPosOffsetXItem::XFillBmpPosOffsetXItem( SvStream& rIn ) :
+ SfxUInt16Item( XATTR_FILLBMP_POSOFFSETX, rIn )
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung KA 29.04.96
+|* Letzte Aenderung KA 29.04.96
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillBmpPosOffsetXItem::Clone( SfxItemPool* /*pPool*/) const
+{
+ return new XFillBmpPosOffsetXItem( *this );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung KA 29.04.96
+|* Letzte Aenderung KA 29.04.96
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillBmpPosOffsetXItem::Create( SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFillBmpPosOffsetXItem( rIn );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung KA 29.04.96
+|* Letzte Aenderung KA 29.04.96
+|*
+*************************************************************************/
+
+SfxItemPresentation XFillBmpPosOffsetXItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ rText.Erase();
+
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ return ePres;
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+
+//------------------------------
+// class XFillBmpTileOffPosYItem
+//------------------------------
+TYPEINIT1_AUTOFACTORY( XFillBmpPosOffsetYItem, SfxUInt16Item );
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung KA 29.04.96
+|* Letzte Aenderung KA 29.04.96
+|*
+*************************************************************************/
+
+XFillBmpPosOffsetYItem::XFillBmpPosOffsetYItem( sal_uInt16 nOffPosY ) :
+ SfxUInt16Item( XATTR_FILLBMP_POSOFFSETY, nOffPosY )
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung KA 29.04.96
+|* Letzte Aenderung KA 29.04.96
+|*
+*************************************************************************/
+
+XFillBmpPosOffsetYItem::XFillBmpPosOffsetYItem( SvStream& rIn ) :
+ SfxUInt16Item( XATTR_FILLBMP_POSOFFSETY, rIn )
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung KA 29.04.96
+|* Letzte Aenderung KA 29.04.96
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillBmpPosOffsetYItem::Clone( SfxItemPool* /*pPool*/) const
+{
+ return new XFillBmpPosOffsetYItem( *this );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung KA 29.04.96
+|* Letzte Aenderung KA 29.04.96
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillBmpPosOffsetYItem::Create( SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFillBmpPosOffsetYItem( rIn );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+|* Beschreibung
+|* Ersterstellung KA 29.04.96
+|* Letzte Aenderung KA 29.04.96
+|*
+*************************************************************************/
+
+SfxItemPresentation XFillBmpPosOffsetYItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ rText.Erase();
+
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ return ePres;
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+//--------------------------
+// class XFillBackgroundItem
+//--------------------------
+TYPEINIT1_AUTOFACTORY(XFillBackgroundItem, SfxBoolItem);
+
+/*************************************************************************
+|*
+|* XFillBackgroundItem::XFillBackgroundItem( sal_Bool )
+|*
+|* Beschreibung
+|* Ersterstellung 19.11.96 KA
+|* Letzte Aenderung
+|*
+*************************************************************************/
+
+XFillBackgroundItem::XFillBackgroundItem( sal_Bool bFill ) :
+ SfxBoolItem( XATTR_FILLBACKGROUND, bFill )
+{
+}
+
+/*************************************************************************
+|*
+|* XFillBackgroundItem::XFillBackgroundItem( SvStream& rIn )
+|*
+|* Beschreibung
+|* Ersterstellung 23.01.96 KA
+|* Letzte Aenderung 23.01.96 KA
+|*
+*************************************************************************/
+
+XFillBackgroundItem::XFillBackgroundItem( SvStream& rIn ) :
+ SfxBoolItem( XATTR_FILLBACKGROUND, rIn )
+{
+}
+
+/*************************************************************************
+|*
+|* XFillBackgroundItem::Clone( SfxItemPool* pPool ) const
+|*
+|* Beschreibung
+|* Ersterstellung 23.01.96 KA
+|* Letzte Aenderung 23.01.96 KA
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillBackgroundItem::Clone( SfxItemPool* /*pPool*/) const
+{
+ return new XFillBackgroundItem( *this );
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XFillBackgroundItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 23.01.96 KA
+|* Letzte Aenderung 23.01.96 KA
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillBackgroundItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
+{
+ return new XFillBackgroundItem( rIn );
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation XFillBackgroundItem::GetPresentation( SfxItemPresentation ePres, SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/, XubString& rText, const IntlWrapper*) const
+{
+ rText.Erase();
+
+ switch( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ return ePres;
+
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+
+
diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx
new file mode 100644
index 000000000000..874cb35d3e30
--- /dev/null
+++ b/svx/source/xoutdev/xattrbmp.cxx
@@ -0,0 +1,894 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <tools/stream.hxx>
+#include <vcl/window.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/bitmapex.hxx>
+#include <toolkit/unohlp.hxx>
+#include <svl/style.hxx>
+#include <editeng/memberids.hrc>
+
+#include <svx/dialogs.hrc>
+#include "svx/xattr.hxx"
+#include <svx/xtable.hxx>
+#include <svx/xdef.hxx>
+#include <svx/unomid.hxx>
+#include <editeng/unoprnms.hxx>
+
+#include "svx/unoapi.hxx"
+#include <svx/svdmodel.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+#define GLOBALOVERFLOW
+
+using namespace ::com::sun::star;
+
+// ---------------
+// class XOBitmap
+// ---------------
+
+/*************************************************************************
+|*
+|* XOBitmap::XOBitmap()
+|*
+|* Beschreibung
+|* Ersterstellung 27.07.95
+|* Letzte Aenderung 27.07.95
+|*
+*************************************************************************/
+
+XOBitmap::XOBitmap() :
+ eType ( XBITMAP_NONE ),
+ eStyle ( XBITMAP_STRETCH ),
+ pPixelArray ( NULL ),
+ bGraphicDirty ( sal_False )
+{
+}
+
+/*************************************************************************
+|*
+|* XOBitmap::XOBitmap( Bitmap aBitmap, XBitmapStyle eStyle = XBITMAP_TILE )
+|*
+|* Beschreibung
+|* Ersterstellung 26.07.95
+|* Letzte Aenderung 26.07.95
+|*
+*************************************************************************/
+
+XOBitmap::XOBitmap( const Bitmap& rBmp, XBitmapStyle eInStyle ) :
+ eType ( XBITMAP_IMPORT ),
+ eStyle ( eInStyle ),
+ aGraphicObject ( rBmp ),
+ pPixelArray ( NULL ),
+ bGraphicDirty ( sal_False )
+{
+}
+
+/*************************************************************************
+|*
+|* XOBitmap::XOBitmap( Bitmap aBitmap, XBitmapStyle eStyle = XBITMAP_TILE )
+|*
+|* Beschreibung
+|* Ersterstellung 26.07.95
+|* Letzte Aenderung 26.07.95
+|*
+*************************************************************************/
+
+XOBitmap::XOBitmap( const GraphicObject& rGraphicObject, XBitmapStyle eInStyle ) :
+ eType ( XBITMAP_IMPORT ),
+ eStyle ( eInStyle ),
+ aGraphicObject ( rGraphicObject ),
+ pPixelArray ( NULL ),
+ bGraphicDirty ( sal_False )
+{
+}
+
+/*************************************************************************
+|*
+|* XOBitmap::XOBitmap( sal_uInt16* pArray, const Color& aPixelColor,
+|* const Color& aBckgrColor, const Size& rSize = Size( 8, 8 ),
+|* XBitmapStyle eStyle = XBITMAP_TILE )
+|*
+|* Beschreibung
+|* Ersterstellung 26.07.95
+|* Letzte Aenderung 26.07.95
+|*
+*************************************************************************/
+
+XOBitmap::XOBitmap( const sal_uInt16* pArray, const Color& rPixelColor,
+ const Color& rBckgrColor, const Size& rSize,
+ XBitmapStyle eInStyle ) :
+ eStyle ( eInStyle ),
+ pPixelArray ( NULL ),
+ aArraySize ( rSize ),
+ aPixelColor ( rPixelColor ),
+ aBckgrColor ( rBckgrColor ),
+ bGraphicDirty ( sal_True )
+
+{
+ if( aArraySize.Width() == 8 && aArraySize.Height() == 8 )
+ {
+ eType = XBITMAP_8X8;
+ pPixelArray = new sal_uInt16[ 64 ];
+
+ for( sal_uInt16 i = 0; i < 64; i++ )
+ *( pPixelArray + i ) = *( pArray + i );
+ }
+ else
+ {
+ DBG_ASSERT( 0, "Nicht unterstuetzte Bitmapgroesse" );
+ }
+}
+
+/*************************************************************************
+|*
+|* XOBitmap::XOBitmap( const XOBitmap& rXBmp )
+|*
+|* Beschreibung
+|* Ersterstellung 27.07.95
+|* Letzte Aenderung 27.07.95
+|*
+*************************************************************************/
+
+XOBitmap::XOBitmap( const XOBitmap& rXBmp ) :
+ pPixelArray ( NULL )
+{
+ eType = rXBmp.eType;
+ eStyle = rXBmp.eStyle;
+ aGraphicObject = rXBmp.aGraphicObject;
+ aArraySize = rXBmp.aArraySize;
+ aPixelColor = rXBmp.aPixelColor;
+ aBckgrColor = rXBmp.aBckgrColor;
+ bGraphicDirty = rXBmp.bGraphicDirty;
+
+ if( rXBmp.pPixelArray )
+ {
+ if( eType == XBITMAP_8X8 )
+ {
+ pPixelArray = new sal_uInt16[ 64 ];
+
+ for( sal_uInt16 i = 0; i < 64; i++ )
+ *( pPixelArray + i ) = *( rXBmp.pPixelArray + i );
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* XOBitmap::XOBitmap( Bitmap aBitmap, XBitmapStyle eStyle = XBITMAP_TILE )
+|*
+|* Beschreibung
+|* Ersterstellung 26.07.95
+|* Letzte Aenderung 26.07.95
+|*
+*************************************************************************/
+
+XOBitmap::~XOBitmap()
+{
+ if( pPixelArray )
+ delete []pPixelArray;
+}
+
+/*************************************************************************
+|*
+|* XOBitmap& XOBitmap::operator=( const XOBitmap& rXBmp )
+|*
+|* Beschreibung
+|* Ersterstellung 27.07.95
+|* Letzte Aenderung 27.07.95
+|*
+*************************************************************************/
+
+XOBitmap& XOBitmap::operator=( const XOBitmap& rXBmp )
+{
+ eType = rXBmp.eType;
+ eStyle = rXBmp.eStyle;
+ aGraphicObject = rXBmp.aGraphicObject;
+ aArraySize = rXBmp.aArraySize;
+ aPixelColor = rXBmp.aPixelColor;
+ aBckgrColor = rXBmp.aBckgrColor;
+ bGraphicDirty = rXBmp.bGraphicDirty;
+
+ if( rXBmp.pPixelArray )
+ {
+ if( eType == XBITMAP_8X8 )
+ {
+ pPixelArray = new sal_uInt16[ 64 ];
+
+ for( sal_uInt16 i = 0; i < 64; i++ )
+ *( pPixelArray + i ) = *( rXBmp.pPixelArray + i );
+ }
+ }
+ return( *this );
+}
+
+/*************************************************************************
+|*
+|* int XOBitmap::operator==( const XOBitmap& rXOBitmap ) const
+|*
+|* Beschreibung
+|* Ersterstellung 26.07.95
+|* Letzte Aenderung 26.07.95
+|*
+*************************************************************************/
+
+int XOBitmap::operator==( const XOBitmap& rXOBitmap ) const
+{
+ if( eType != rXOBitmap.eType ||
+ eStyle != rXOBitmap.eStyle ||
+ aGraphicObject != rXOBitmap.aGraphicObject ||
+ aArraySize != rXOBitmap.aArraySize ||
+ aPixelColor != rXOBitmap.aPixelColor ||
+ aBckgrColor != rXOBitmap.aBckgrColor ||
+ bGraphicDirty != rXOBitmap.bGraphicDirty )
+ {
+ return( sal_False );
+ }
+
+ if( pPixelArray && rXOBitmap.pPixelArray )
+ {
+ sal_uInt16 nCount = (sal_uInt16) ( aArraySize.Width() * aArraySize.Height() );
+ for( sal_uInt16 i = 0; i < nCount; i++ )
+ {
+ if( *( pPixelArray + i ) != *( rXOBitmap.pPixelArray + i ) )
+ return( sal_False );
+ }
+ }
+ return( sal_True );
+}
+
+/*************************************************************************
+|*
+|* void SetPixelArray( const sal_uInt16* pArray )
+|*
+|* Beschreibung
+|* Ersterstellung 27.07.95
+|* Letzte Aenderung 27.07.95
+|*
+*************************************************************************/
+
+void XOBitmap::SetPixelArray( const sal_uInt16* pArray )
+{
+ if( eType == XBITMAP_8X8 )
+ {
+ if( pPixelArray )
+ delete []pPixelArray;
+
+ pPixelArray = new sal_uInt16[ 64 ];
+
+ for( sal_uInt16 i = 0; i < 64; i++ )
+ *( pPixelArray + i ) = *( pArray + i );
+
+ bGraphicDirty = sal_True;
+ }
+ else
+ {
+ DBG_ASSERT( 0, "Nicht unterstuetzter Bitmaptyp" );
+ }
+}
+
+/*************************************************************************
+|*
+|* Bitmap XOBitmap::GetBitmap()
+|*
+|* Beschreibung
+|* Ersterstellung 26.07.95
+|* Letzte Aenderung 26.07.95
+|*
+*************************************************************************/
+
+Bitmap XOBitmap::GetBitmap() const
+{
+ return GetGraphicObject().GetGraphic().GetBitmap();
+}
+
+/*************************************************************************
+|*
+|* Bitmap XOBitmap::GetGraphicObject()
+|*
+|* Beschreibung
+|* Ersterstellung
+|* Letzte Aenderung
+|*
+*************************************************************************/
+
+const GraphicObject& XOBitmap::GetGraphicObject() const
+{
+ if( bGraphicDirty )
+ ( (XOBitmap*) this )->Array2Bitmap();
+
+ return aGraphicObject;
+}
+
+/*************************************************************************
+|*
+|* void XOBitmap::Bitmap2Array()
+|*
+|* Beschreibung Umwandlung der Bitmap in Array, Hinter- u.
+|* Vordergrundfarbe
+|* Ersterstellung 27.07.95
+|* Letzte Aenderung 27.07.95
+|*
+*************************************************************************/
+
+void XOBitmap::Bitmap2Array()
+{
+ VirtualDevice aVD;
+ sal_Bool bPixelColor = sal_False;
+ const Bitmap aBitmap( GetBitmap() );
+ const sal_uInt16 nLines = 8; // von Type abhaengig
+
+ if( !pPixelArray )
+ pPixelArray = new sal_uInt16[ nLines * nLines ];
+
+ aVD.SetOutputSizePixel( aBitmap.GetSizePixel() );
+ aVD.DrawBitmap( Point(), aBitmap );
+ aPixelColor = aBckgrColor = aVD.GetPixel( Point() );
+
+ // Aufbau des Arrays und Ermittlung der Vorder-, bzw.
+ // Hintergrundfarbe
+ for( sal_uInt16 i = 0; i < nLines; i++ )
+ {
+ for( sal_uInt16 j = 0; j < nLines; j++ )
+ {
+ if ( aVD.GetPixel( Point( j, i ) ) == aBckgrColor )
+ *( pPixelArray + j + i * nLines ) = 0;
+ else
+ {
+ *( pPixelArray + j + i * nLines ) = 1;
+ if( !bPixelColor )
+ {
+ aPixelColor = aVD.GetPixel( Point( j, i ) );
+ bPixelColor = sal_True;
+ }
+ }
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* void XOBitmap::Array2Bitmap()
+|*
+|* Beschreibung Umwandlung des Arrays, Hinter- u.
+|* Vordergrundfarbe in eine Bitmap
+|* Ersterstellung 27.07.95
+|* Letzte Aenderung 27.07.95
+|*
+*************************************************************************/
+
+void XOBitmap::Array2Bitmap()
+{
+ VirtualDevice aVD;
+ sal_uInt16 nLines = 8; // von Type abhaengig
+
+ if( !pPixelArray )
+ return;
+
+ aVD.SetOutputSizePixel( Size( nLines, nLines ) );
+
+ // Aufbau der Bitmap
+ for( sal_uInt16 i = 0; i < nLines; i++ )
+ {
+ for( sal_uInt16 j = 0; j < nLines; j++ )
+ {
+ if( *( pPixelArray + j + i * nLines ) == 0 )
+ aVD.DrawPixel( Point( j, i ), aBckgrColor );
+ else
+ aVD.DrawPixel( Point( j, i ), aPixelColor );
+ }
+ }
+
+ aGraphicObject = GraphicObject( aVD.GetBitmap( Point(), Size( nLines, nLines ) ) );
+ bGraphicDirty = sal_False;
+}
+
+// -----------------------
+// class XFillBitmapItem
+// -----------------------
+TYPEINIT1_AUTOFACTORY(XFillBitmapItem, NameOrIndex);
+
+/*************************************************************************
+|*
+|* XFillBitmapItem::XFillBitmapItem(long nIndex,
+|* const Bitmap& rTheBitmap)
+|*
+|* Beschreibung
+|* Ersterstellung 17.11.94
+|* Letzte Aenderung 17.11.94
+|*
+*************************************************************************/
+
+XFillBitmapItem::XFillBitmapItem(long nIndex,
+ const XOBitmap& rTheBitmap) :
+ NameOrIndex( XATTR_FILLBITMAP, nIndex ),
+ aXOBitmap( rTheBitmap )
+{
+}
+
+/*************************************************************************
+|*
+|* XFillBitmapItem::XFillBitmapItem(const XubString& rName,
+|* const Bitmap& rTheBitmap)
+|*
+|* Beschreibung
+|* Ersterstellung 17.11.94
+|* Letzte Aenderung 17.11.94
+|*
+*************************************************************************/
+
+XFillBitmapItem::XFillBitmapItem(const XubString& rName,
+ const XOBitmap& rTheBitmap) :
+ NameOrIndex( XATTR_FILLBITMAP, rName ),
+ aXOBitmap( rTheBitmap )
+{
+}
+
+/*************************************************************************
+|*
+|* XFillBitmapItem::XFillBitmapItem(const XFillBitmapItem& rItem)
+|*
+|* Beschreibung
+|* Ersterstellung 17.11.94
+|* Letzte Aenderung 17.11.94
+|*
+*************************************************************************/
+
+XFillBitmapItem::XFillBitmapItem(const XFillBitmapItem& rItem) :
+ NameOrIndex( rItem ),
+ aXOBitmap( rItem.aXOBitmap )
+{
+}
+
+/*************************************************************************
+|*
+|* XFillBitmapItem::XFillBitmapItem(SvStream& rIn)
+|*
+|* Beschreibung
+|* Ersterstellung 17.11.94
+|* Letzte Aenderung 26.07.94
+|*
+*************************************************************************/
+
+XFillBitmapItem::XFillBitmapItem( SvStream& rIn, sal_uInt16 nVer ) :
+ NameOrIndex( XATTR_FILLBITMAP, rIn )
+{
+ if( nVer == 0 )
+ {
+ if (!IsIndex())
+ {
+ // Behandlung der alten Bitmaps
+ Bitmap aBmp;
+
+ rIn >> aBmp;
+
+ aXOBitmap.SetBitmap( aBmp );
+ aXOBitmap.SetBitmapStyle( XBITMAP_TILE );
+
+ if( aBmp.GetSizePixel().Width() == 8 &&
+ aBmp.GetSizePixel().Height() == 8 )
+ {
+ aXOBitmap.SetBitmapType( XBITMAP_8X8 );
+ aXOBitmap.Bitmap2Array();
+ }
+ else
+ aXOBitmap.SetBitmapType( XBITMAP_IMPORT );
+ }
+ }
+ else if( nVer == 1 )
+ {
+ if (!IsIndex())
+ {
+ sal_Int16 iTmp;
+ rIn >> iTmp;
+ aXOBitmap.SetBitmapStyle( (XBitmapStyle) iTmp );
+ rIn >> iTmp;
+ aXOBitmap.SetBitmapType( (XBitmapType) iTmp );
+
+ if( aXOBitmap.GetBitmapType() == XBITMAP_IMPORT )
+ {
+ Bitmap aBmp;
+ rIn >> aBmp;
+ aXOBitmap.SetBitmap( aBmp );
+ }
+ else if( aXOBitmap.GetBitmapType() == XBITMAP_8X8 )
+ {
+ sal_uInt16* pArray = new sal_uInt16[ 64 ];
+ Color aColor;
+
+ for( sal_uInt16 i = 0; i < 64; i++ )
+ rIn >> *( pArray + i );
+ aXOBitmap.SetPixelArray( pArray );
+
+ rIn >> aColor;
+ aXOBitmap.SetPixelColor( aColor );
+ rIn >> aColor;
+ aXOBitmap.SetBackgroundColor( aColor );
+
+ delete []pArray;
+ }
+ }
+ }
+
+ // #81908# force bitmap to exist
+ aXOBitmap.GetBitmap();
+}
+
+//*************************************************************************
+
+XFillBitmapItem::XFillBitmapItem( SfxItemPool* /*pPool*/, const XOBitmap& rTheBitmap )
+: NameOrIndex( XATTR_FILLBITMAP, -1 ),
+ aXOBitmap( rTheBitmap )
+{
+}
+
+//*************************************************************************
+
+XFillBitmapItem::XFillBitmapItem( SfxItemPool* /*pPool*/)
+: NameOrIndex(XATTR_FILLBITMAP, -1 )
+{
+}
+
+/*************************************************************************
+|*
+|* XFillBitmapItem::Clone(SfxItemPool* pPool) const
+|*
+|* Beschreibung
+|* Ersterstellung 17.11.94
+|* Letzte Aenderung 17.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillBitmapItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new XFillBitmapItem(*this);
+}
+
+/*************************************************************************
+|*
+|* int XFillBitmapItem::operator==(const SfxPoolItem& rItem) const
+|*
+|* Beschreibung
+|* Ersterstellung 17.11.94
+|* Letzte Aenderung 26.07.95
+|*
+*************************************************************************/
+
+int XFillBitmapItem::operator==(const SfxPoolItem& rItem) const
+{
+ return ( NameOrIndex::operator==(rItem) &&
+ aXOBitmap == ((const XFillBitmapItem&) rItem).aXOBitmap );
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XFillBitmapItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+|*
+|* Beschreibung
+|* Ersterstellung 17.11.94
+|* Letzte Aenderung 17.11.94
+|*
+*************************************************************************/
+
+SfxPoolItem* XFillBitmapItem::Create(SvStream& rIn, sal_uInt16 nVer) const
+{
+ return new XFillBitmapItem( rIn, nVer );
+}
+
+/*************************************************************************
+|*
+|* SfxPoolItem* XFillBitmapItem::Store(SvStream& rOut) const
+|*
+|* Beschreibung
+|* Ersterstellung 17.11.94
+|* Letzte Aenderung 26.07.94
+|*
+*************************************************************************/
+
+SvStream& XFillBitmapItem::Store( SvStream& rOut, sal_uInt16 nItemVersion ) const
+{
+ NameOrIndex::Store( rOut, nItemVersion );
+
+ if (!IsIndex())
+ {
+ rOut << (sal_Int16) aXOBitmap.GetBitmapStyle();
+ if( !aXOBitmap.GetBitmap() )
+ rOut << (sal_Int16) XBITMAP_NONE;
+ else
+ {
+ rOut << (sal_Int16) aXOBitmap.GetBitmapType();
+ if( aXOBitmap.GetBitmapType() == XBITMAP_IMPORT )
+ {
+ const sal_uInt16 nOldComprMode = rOut.GetCompressMode();
+ sal_uInt16 nNewComprMode = nOldComprMode;
+
+ if( rOut.GetVersion() >= SOFFICE_FILEFORMAT_50 )
+ nNewComprMode |= COMPRESSMODE_ZBITMAP;
+ else
+ nNewComprMode &= ~COMPRESSMODE_ZBITMAP;
+
+ rOut.SetCompressMode( nNewComprMode );
+ rOut << aXOBitmap.GetBitmap();
+ rOut.SetCompressMode( nOldComprMode );
+ }
+ else if( aXOBitmap.GetBitmapType() == XBITMAP_8X8 )
+ {
+ sal_uInt16* pArray = aXOBitmap.GetPixelArray();
+ for( sal_uInt16 i = 0; i < 64; i++ )
+ rOut << (sal_uInt16) *( pArray + i );
+
+ rOut << aXOBitmap.GetPixelColor();
+ rOut << aXOBitmap.GetBackgroundColor();
+ }
+ }
+ }
+
+ return rOut;
+}
+
+/*************************************************************************
+|*
+|* const Bitmap& XFillBitmapItem::GetValue(const XBitmapTable* pTable) const
+|*
+|* Beschreibung
+|* Ersterstellung 15.11.94
+|* Letzte Aenderung 26.07.94
+|*
+*************************************************************************/
+
+const XOBitmap& XFillBitmapItem::GetBitmapValue(const XBitmapTable* pTable) const // GetValue -> GetBitmapValue
+{
+ if (!IsIndex())
+ return aXOBitmap;
+ else
+ return pTable->GetBitmap(GetIndex())->GetXBitmap();
+}
+
+
+/*************************************************************************
+|*
+|* sal_uInt16 XFillBitmapItem::GetVersion() const
+|*
+|* Beschreibung
+|* Ersterstellung 26.07.95
+|* Letzte Aenderung 26.07.95
+|*
+*************************************************************************/
+
+sal_uInt16 XFillBitmapItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/) const
+{
+ // 2. Version
+ return( 1 );
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation XFillBitmapItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return ePres;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText += GetName();
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool XFillBitmapItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+
+ // needed for MID_NAME
+ ::rtl::OUString aApiName;
+ // needed for complete item (MID 0)
+ ::rtl::OUString aInternalName;
+
+ ::rtl::OUString aURL;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > xBmp;
+
+ if( nMemberId == MID_NAME )
+ {
+ SvxUnogetApiNameForItem( Which(), GetName(), aApiName );
+ }
+ else if( nMemberId == 0 )
+ {
+ aInternalName = GetName();
+ }
+
+ if( nMemberId == MID_GRAFURL ||
+ nMemberId == 0 )
+ {
+ XOBitmap aLocalXOBitmap( GetBitmapValue() );
+ aURL = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX));
+ aURL += ::rtl::OUString::createFromAscii( aLocalXOBitmap.GetGraphicObject().GetUniqueID().GetBuffer() );
+ }
+ if( nMemberId == MID_BITMAP ||
+ nMemberId == 0 )
+ {
+ XOBitmap aLocalXOBitmap( GetBitmapValue() );
+ Bitmap aBmp( aLocalXOBitmap.GetBitmap() );
+ BitmapEx aBmpEx( aBmp );
+
+ xBmp.set( VCLUnoHelper::CreateBitmap( aBmpEx ) );
+ }
+
+ if( nMemberId == MID_NAME )
+ rVal <<= aApiName;
+ else if( nMemberId == MID_GRAFURL )
+ rVal <<= aURL;
+ else if( nMemberId == MID_BITMAP )
+ rVal <<= xBmp;
+ else
+ {
+ // member-id 0 => complete item (e.g. for toolbars)
+ DBG_ASSERT( nMemberId == 0, "invalid member-id" );
+ uno::Sequence< beans::PropertyValue > aPropSeq( 3 );
+
+ aPropSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ));
+ aPropSeq[0].Value = uno::makeAny( aInternalName );
+ aPropSeq[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillBitmapURL" ));
+ aPropSeq[1].Value = uno::makeAny( aURL );
+ aPropSeq[2].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Bitmap" ));
+ aPropSeq[2].Value = uno::makeAny( xBmp );
+
+ rVal <<= aPropSeq;
+ }
+
+ return sal_True;
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool XFillBitmapItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
+{
+// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+
+ ::rtl::OUString aName;
+ ::rtl::OUString aURL;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > xBmp;
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > xGraphic;
+
+ bool bSetName = false;
+ bool bSetURL = false;
+ bool bSetBitmap = false;
+
+ if( nMemberId == MID_NAME )
+ bSetName = (rVal >>= aName);
+ else if( nMemberId == MID_GRAFURL )
+ bSetURL = (rVal >>= aURL);
+ else if( nMemberId == MID_BITMAP )
+ {
+ bSetBitmap = (rVal >>= xBmp);
+ if ( !bSetBitmap )
+ bSetBitmap = (rVal >>= xGraphic );
+ }
+ else
+ {
+ DBG_ASSERT( nMemberId == 0, "invalid member-id" );
+ uno::Sequence< beans::PropertyValue > aPropSeq;
+ if( rVal >>= aPropSeq )
+ {
+ for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ )
+ {
+ if( aPropSeq[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Name" )))
+ bSetName = (aPropSeq[n].Value >>= aName);
+ else if( aPropSeq[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FillBitmapURL" )))
+ bSetURL = (aPropSeq[n].Value >>= aURL);
+ else if( aPropSeq[n].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Bitmap" )))
+ bSetBitmap = (aPropSeq[n].Value >>= xBmp);
+ }
+ }
+ }
+
+ if( bSetName )
+ {
+ SetName( aName );
+ }
+ if( bSetURL )
+ {
+ GraphicObject aGrafObj( GraphicObject::CreateGraphicObjectFromURL( aURL ) );
+ XOBitmap aBMP( aGrafObj );
+ SetBitmapValue( aBMP );
+ }
+ if( bSetBitmap )
+ {
+ Bitmap aInput;
+ if ( xBmp.is() )
+ {
+ BitmapEx aInputEx( VCLUnoHelper::GetBitmap( xBmp ) );
+ aInput = aInputEx.GetBitmap();
+ }
+ else if ( xGraphic.is() )
+ {
+ Graphic aGraphic( xGraphic );
+ aInput = aGraphic.GetBitmap();
+ }
+
+ // note: aXOBitmap is the member bitmap
+ aXOBitmap.SetBitmap( aInput );
+ aXOBitmap.SetBitmapType(XBITMAP_IMPORT);
+
+ if(aInput.GetSizePixel().Width() == 8
+ && aInput.GetSizePixel().Height() == 8
+ && aInput.GetColorCount() == 2)
+ {
+ aXOBitmap.Bitmap2Array();
+ aXOBitmap.SetBitmapType(XBITMAP_8X8);
+ aXOBitmap.SetPixelSize(aInput.GetSizePixel());
+ }
+ }
+
+ return (bSetName || bSetURL || bSetBitmap);
+}
+
+sal_Bool XFillBitmapItem::CompareValueFunc( const NameOrIndex* p1, const NameOrIndex* p2 )
+{
+ return ((XFillBitmapItem*)p1)->GetBitmapValue().GetGraphicObject().GetUniqueID() ==
+ ((XFillBitmapItem*)p2)->GetBitmapValue().GetGraphicObject().GetUniqueID();
+}
+
+XFillBitmapItem* XFillBitmapItem::checkForUniqueItem( SdrModel* pModel ) const
+{
+ if( pModel )
+ {
+ const String aUniqueName = NameOrIndex::CheckNamedItem( this,
+ XATTR_FILLBITMAP,
+ &pModel->GetItemPool(),
+ pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL,
+ XFillBitmapItem::CompareValueFunc,
+ RID_SVXSTR_BMP21,
+ pModel->GetBitmapList() );
+
+ // if the given name is not valid, replace it!
+ if( aUniqueName != GetName() )
+ {
+ return new XFillBitmapItem( aUniqueName, aXOBitmap );
+ }
+ }
+
+ return (XFillBitmapItem*)this;
+}
diff --git a/svx/source/xoutdev/xexch.cxx b/svx/source/xoutdev/xexch.cxx
new file mode 100644
index 000000000000..052bc4c8d25a
--- /dev/null
+++ b/svx/source/xoutdev/xexch.cxx
@@ -0,0 +1,204 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <sot/formats.hxx>
+#include <tools/vcompat.hxx>
+#include <svx/xflasit.hxx>
+#include <svx/xfillit0.hxx>
+#ifndef _SFXIPOOL_HXX
+#include <svl/itempool.hxx>
+#endif
+#include <svl/whiter.hxx>
+#ifndef _SFXIPOOL_HXX
+#include <svl/itempool.hxx>
+#endif
+#include <svl/itemset.hxx>
+#include <svx/xdef.hxx>
+#include "svx/xexch.hxx"
+
+
+TYPEINIT1_AUTOFACTORY( XFillExchangeData, SvDataCopyStream );
+
+
+/*************************************************************************
+|*
+|* Default-Ctor (Fuer Assign())
+|*
+*************************************************************************/
+XFillExchangeData::XFillExchangeData() :
+ pXFillAttrSetItem( NULL ),
+ pPool( NULL )
+{
+}
+
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+*************************************************************************/
+XFillExchangeData::XFillExchangeData( const XFillAttrSetItem rXFillAttrSetItem ) :
+ pXFillAttrSetItem( (XFillAttrSetItem*) rXFillAttrSetItem.Clone( rXFillAttrSetItem.GetItemSet().GetPool() ) ),
+ pPool( rXFillAttrSetItem.GetItemSet().GetPool() )
+{
+}
+
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+*************************************************************************/
+XFillExchangeData::~XFillExchangeData()
+{
+ delete pXFillAttrSetItem;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+*************************************************************************/
+sal_uIntPtr XFillExchangeData::RegisterClipboardFormatName()
+{
+ return( SOT_FORMATSTR_ID_XFA );
+}
+
+/******************************************************************************
+|*
+|* Binaer-Export (z.Z. ohne Versionsverwaltung, da nicht persistent!)
+|*
+\******************************************************************************/
+
+SvStream& operator<<( SvStream& rOStm, const XFillExchangeData& rData )
+{
+ if( rData.pXFillAttrSetItem )
+ {
+ SfxWhichIter aIter( rData.pXFillAttrSetItem->GetItemSet() );
+ sal_uInt16 nWhich = aIter.FirstWhich();
+ const SfxPoolItem* pItem;
+ sal_uInt32 nItemCount = 0;
+ sal_Size nFirstPos = rOStm.Tell();
+
+ rOStm << nItemCount;
+
+ while( nWhich )
+ {
+ if( SFX_ITEM_SET == rData.pXFillAttrSetItem->GetItemSet().GetItemState( nWhich, sal_False, &pItem ) )
+ {
+ VersionCompat aCompat( rOStm, STREAM_WRITE );
+ const sal_uInt16 nItemVersion2 = pItem->GetVersion( (sal_uInt16) rOStm.GetVersion() );
+
+ rOStm << nWhich << nItemVersion2;
+ pItem->Store( rOStm, nItemVersion2 );
+
+ nItemCount++;
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+
+ const sal_uIntPtr nLastPos = rOStm.Tell();
+ rOStm.Seek( nFirstPos );
+ rOStm << nItemCount;
+ rOStm.Seek( nLastPos );
+ }
+
+ return rOStm;
+}
+
+
+/******************************************************************************
+|*
+|* Binaer-Import (z.Z. ohne Versionsverwaltung, da nicht persistent!)
+|*
+\******************************************************************************/
+
+SvStream& operator>>( SvStream& rIStm, XFillExchangeData& rData )
+{
+ DBG_ASSERT( rData.pPool, "XFillExchangeData has no pool" );
+
+ SfxItemSet* pSet = new SfxItemSet ( *rData.pPool, XATTR_FILL_FIRST, XATTR_FILL_LAST );
+ SfxPoolItem* pNewItem;
+ sal_uInt32 nItemCount = 0;
+ sal_uInt16 nWhich, nItemVersion;
+
+ rIStm >> nItemCount;
+
+ if( nItemCount > ( XATTR_FILL_LAST - XATTR_FILL_FIRST + 1 ) )
+ nItemCount = ( XATTR_FILL_LAST - XATTR_FILL_FIRST + 1 );
+
+ for( sal_uInt32 i = 0; i < nItemCount; i++ )
+ {
+ VersionCompat aCompat( rIStm, STREAM_READ );
+
+ rIStm >> nWhich >> nItemVersion;
+
+ if( nWhich )
+ {
+ pNewItem = rData.pPool->GetDefaultItem( nWhich ).Create( rIStm, nItemVersion );
+
+ if( pNewItem )
+ {
+ pSet->Put( *pNewItem );
+ delete pNewItem;
+ }
+ }
+ }
+
+ delete rData.pXFillAttrSetItem;
+ rData.pXFillAttrSetItem = new XFillAttrSetItem( pSet );
+ rData.pPool = rData.pXFillAttrSetItem->GetItemSet().GetPool();
+
+ return rIStm;
+}
+
+/*************************************************************************
+|*
+|* XBitmap& XBitmap::operator=( const XBitmap& rXBmp )
+|*
+*************************************************************************/
+
+XFillExchangeData& XFillExchangeData::operator=( const XFillExchangeData& rData )
+{
+ delete pXFillAttrSetItem;
+
+ if( rData.pXFillAttrSetItem )
+ pXFillAttrSetItem = (XFillAttrSetItem*) rData.pXFillAttrSetItem->Clone( pPool = rData.pXFillAttrSetItem->GetItemSet().GetPool() );
+ else
+ {
+ pPool = NULL;
+ pXFillAttrSetItem = NULL;
+ }
+
+ return( *this );
+}
diff --git a/svx/source/xoutdev/xpool.cxx b/svx/source/xoutdev/xpool.cxx
new file mode 100644
index 000000000000..305b181a65a2
--- /dev/null
+++ b/svx/source/xoutdev/xpool.cxx
@@ -0,0 +1,235 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/xtable.hxx>
+#include "svx/xattr.hxx"
+#include <svx/xpool.hxx>
+#include <svx/svdattr.hxx>
+#include <svx/svxids.hrc>
+#include <svl/itemset.hxx>
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+XOutdevItemPool::XOutdevItemPool(
+ SfxItemPool* _pMaster,
+ sal_uInt16 nAttrStart,
+ sal_uInt16 nAttrEnd,
+ sal_Bool bLoadRefCounts)
+: SfxItemPool(String("XOutdevItemPool", gsl_getSystemTextEncoding()), nAttrStart, nAttrEnd, 0L, 0L, bLoadRefCounts)
+{
+ // prepare some defaults
+ const XubString aNullStr;
+ const Bitmap aNullBmp;
+ const basegfx::B2DPolyPolygon aNullPol;
+ const Color aNullLineCol(RGB_Color(COL_DEFAULT_SHAPE_STROKE));
+ const Color aNullFillCol(RGB_Color(COL_DEFAULT_SHAPE_FILLING));
+ const Color aNullShadowCol(RGB_Color(COL_LIGHTGRAY));
+ const XDash aNullDash;
+ const XGradient aNullGrad(aNullLineCol, RGB_Color(COL_WHITE));
+ const XHatch aNullHatch(aNullLineCol);
+
+ // get master pointer, evtl. add myself to the end of the pools
+ if(!_pMaster)
+ {
+ _pMaster = this;
+ }
+ else
+ {
+ SfxItemPool* pParent = _pMaster;
+
+ while(pParent->GetSecondaryPool())
+ {
+ pParent = pParent->GetSecondaryPool();
+ }
+
+ pParent->SetSecondaryPool(this);
+ }
+
+ // prepare PoolDefaults
+ mppLocalPoolDefaults = new SfxPoolItem*[GetLastWhich() - GetFirstWhich() + 1];
+
+ mppLocalPoolDefaults[XATTR_LINESTYLE -XATTR_START] = new XLineStyleItem;
+ mppLocalPoolDefaults[XATTR_LINEDASH -XATTR_START] = new XLineDashItem(this,aNullDash);
+ mppLocalPoolDefaults[XATTR_LINEWIDTH -XATTR_START] = new XLineWidthItem;
+ mppLocalPoolDefaults[XATTR_LINECOLOR -XATTR_START] = new XLineColorItem(aNullStr,aNullLineCol);
+ mppLocalPoolDefaults[XATTR_LINESTART -XATTR_START] = new XLineStartItem(this,aNullPol);
+ mppLocalPoolDefaults[XATTR_LINEEND -XATTR_START] = new XLineEndItem (this,aNullPol);
+ mppLocalPoolDefaults[XATTR_LINESTARTWIDTH -XATTR_START] = new XLineStartWidthItem;
+ mppLocalPoolDefaults[XATTR_LINEENDWIDTH -XATTR_START] = new XLineEndWidthItem;
+ mppLocalPoolDefaults[XATTR_LINESTARTCENTER -XATTR_START] = new XLineStartCenterItem;
+ mppLocalPoolDefaults[XATTR_LINEENDCENTER -XATTR_START] = new XLineEndCenterItem;
+ mppLocalPoolDefaults[XATTR_LINETRANSPARENCE -XATTR_START] = new XLineTransparenceItem;
+ mppLocalPoolDefaults[XATTR_LINEJOINT -XATTR_START] = new XLineJointItem;
+ mppLocalPoolDefaults[XATTR_FILLSTYLE -XATTR_START] = new XFillStyleItem;
+ mppLocalPoolDefaults[XATTR_FILLCOLOR -XATTR_START] = new XFillColorItem (aNullStr,aNullFillCol);
+ mppLocalPoolDefaults[XATTR_FILLGRADIENT -XATTR_START] = new XFillGradientItem(this,aNullGrad);
+ mppLocalPoolDefaults[XATTR_FILLHATCH -XATTR_START] = new XFillHatchItem (this,aNullHatch);
+ mppLocalPoolDefaults[XATTR_FILLBITMAP -XATTR_START] = new XFillBitmapItem (this,aNullBmp);
+ mppLocalPoolDefaults[XATTR_FILLTRANSPARENCE -XATTR_START] = new XFillTransparenceItem;
+ mppLocalPoolDefaults[XATTR_GRADIENTSTEPCOUNT -XATTR_START] = new XGradientStepCountItem;
+ mppLocalPoolDefaults[XATTR_FILLBMP_TILE -XATTR_START] = new XFillBmpTileItem;
+ mppLocalPoolDefaults[XATTR_FILLBMP_POS -XATTR_START] = new XFillBmpPosItem;
+ mppLocalPoolDefaults[XATTR_FILLBMP_SIZEX -XATTR_START] = new XFillBmpSizeXItem;
+ mppLocalPoolDefaults[XATTR_FILLBMP_SIZEY -XATTR_START] = new XFillBmpSizeYItem;
+ mppLocalPoolDefaults[XATTR_FILLBMP_SIZELOG -XATTR_START] = new XFillBmpSizeLogItem;
+ mppLocalPoolDefaults[XATTR_FILLBMP_TILEOFFSETX -XATTR_START] = new XFillBmpTileOffsetXItem;
+ mppLocalPoolDefaults[XATTR_FILLBMP_TILEOFFSETY -XATTR_START] = new XFillBmpTileOffsetYItem;
+ mppLocalPoolDefaults[XATTR_FILLBMP_STRETCH -XATTR_START] = new XFillBmpStretchItem;
+ mppLocalPoolDefaults[XATTR_FILLBMP_POSOFFSETX -XATTR_START] = new XFillBmpPosOffsetXItem;
+ mppLocalPoolDefaults[XATTR_FILLBMP_POSOFFSETY -XATTR_START] = new XFillBmpPosOffsetYItem;
+ mppLocalPoolDefaults[XATTR_FILLFLOATTRANSPARENCE -XATTR_START] = new XFillFloatTransparenceItem( this, aNullGrad, sal_False );
+ mppLocalPoolDefaults[XATTR_SECONDARYFILLCOLOR -XATTR_START] = new XSecondaryFillColorItem(aNullStr, aNullFillCol);
+ mppLocalPoolDefaults[XATTR_FILLBACKGROUND -XATTR_START] = new XFillBackgroundItem;
+ mppLocalPoolDefaults[XATTR_FORMTXTSTYLE -XATTR_START] = new XFormTextStyleItem;
+ mppLocalPoolDefaults[XATTR_FORMTXTADJUST -XATTR_START] = new XFormTextAdjustItem;
+ mppLocalPoolDefaults[XATTR_FORMTXTDISTANCE -XATTR_START] = new XFormTextDistanceItem;
+ mppLocalPoolDefaults[XATTR_FORMTXTSTART -XATTR_START] = new XFormTextStartItem;
+ mppLocalPoolDefaults[XATTR_FORMTXTMIRROR -XATTR_START] = new XFormTextMirrorItem;
+ mppLocalPoolDefaults[XATTR_FORMTXTOUTLINE -XATTR_START] = new XFormTextOutlineItem;
+ mppLocalPoolDefaults[XATTR_FORMTXTSHADOW -XATTR_START] = new XFormTextShadowItem;
+ mppLocalPoolDefaults[XATTR_FORMTXTSHDWCOLOR -XATTR_START] = new XFormTextShadowColorItem(aNullStr,aNullShadowCol);
+ mppLocalPoolDefaults[XATTR_FORMTXTSHDWXVAL -XATTR_START] = new XFormTextShadowXValItem;
+ mppLocalPoolDefaults[XATTR_FORMTXTSHDWYVAL -XATTR_START] = new XFormTextShadowYValItem;
+ mppLocalPoolDefaults[XATTR_FORMTXTSTDFORM -XATTR_START] = new XFormTextStdFormItem;
+ mppLocalPoolDefaults[XATTR_FORMTXTHIDEFORM -XATTR_START] = new XFormTextHideFormItem;
+ mppLocalPoolDefaults[XATTR_FORMTXTSHDWTRANSP -XATTR_START] = new XFormTextShadowTranspItem;
+
+ // create SetItems
+ SfxItemSet* pSet=new SfxItemSet(*_pMaster, XATTR_LINE_FIRST, XATTR_LINE_LAST);
+ mppLocalPoolDefaults[XATTRSET_LINE - XATTR_START] = new XLineAttrSetItem(pSet);
+ pSet=new SfxItemSet(*_pMaster, XATTR_FILL_FIRST, XATTR_FILL_LAST);
+ mppLocalPoolDefaults[XATTRSET_FILL - XATTR_START] = new XFillAttrSetItem(pSet);
+
+ // create ItemInfos
+ mpLocalItemInfos = new SfxItemInfo[GetLastWhich() - GetFirstWhich() + 1];
+ for(sal_uInt16 i(GetFirstWhich()); i <= GetLastWhich(); i++)
+ {
+ mpLocalItemInfos[i - XATTR_START]._nSID = 0;
+ mpLocalItemInfos[i - XATTR_START]._nFlags = SFX_ITEM_POOLABLE;
+ }
+
+ mpLocalItemInfos[XATTR_LINESTYLE -XATTR_START]._nSID = SID_ATTR_LINE_STYLE;
+ mpLocalItemInfos[XATTR_LINEDASH -XATTR_START]._nSID = SID_ATTR_LINE_DASH;
+ mpLocalItemInfos[XATTR_LINEWIDTH -XATTR_START]._nSID = SID_ATTR_LINE_WIDTH;
+ mpLocalItemInfos[XATTR_LINECOLOR -XATTR_START]._nSID = SID_ATTR_LINE_COLOR;
+ mpLocalItemInfos[XATTR_LINESTART -XATTR_START]._nSID = SID_ATTR_LINE_START;
+ mpLocalItemInfos[XATTR_LINEEND -XATTR_START]._nSID = SID_ATTR_LINE_END;
+ mpLocalItemInfos[XATTR_LINESTARTWIDTH -XATTR_START]._nSID = SID_ATTR_LINE_STARTWIDTH;
+ mpLocalItemInfos[XATTR_LINEENDWIDTH -XATTR_START]._nSID = SID_ATTR_LINE_ENDWIDTH;
+ mpLocalItemInfos[XATTR_LINESTARTCENTER -XATTR_START]._nSID = SID_ATTR_LINE_STARTCENTER;
+ mpLocalItemInfos[XATTR_LINEENDCENTER -XATTR_START]._nSID = SID_ATTR_LINE_ENDCENTER;
+ mpLocalItemInfos[XATTR_FILLSTYLE -XATTR_START]._nSID = SID_ATTR_FILL_STYLE;
+ mpLocalItemInfos[XATTR_FILLCOLOR -XATTR_START]._nSID = SID_ATTR_FILL_COLOR;
+ mpLocalItemInfos[XATTR_FILLGRADIENT -XATTR_START]._nSID = SID_ATTR_FILL_GRADIENT;
+ mpLocalItemInfos[XATTR_FILLHATCH -XATTR_START]._nSID = SID_ATTR_FILL_HATCH;
+ mpLocalItemInfos[XATTR_FILLBITMAP -XATTR_START]._nSID = SID_ATTR_FILL_BITMAP;
+ mpLocalItemInfos[XATTR_FORMTXTSTYLE -XATTR_START]._nSID = SID_FORMTEXT_STYLE;
+ mpLocalItemInfos[XATTR_FORMTXTADJUST -XATTR_START]._nSID = SID_FORMTEXT_ADJUST;
+ mpLocalItemInfos[XATTR_FORMTXTDISTANCE -XATTR_START]._nSID = SID_FORMTEXT_DISTANCE;
+ mpLocalItemInfos[XATTR_FORMTXTSTART -XATTR_START]._nSID = SID_FORMTEXT_START;
+ mpLocalItemInfos[XATTR_FORMTXTMIRROR -XATTR_START]._nSID = SID_FORMTEXT_MIRROR;
+ mpLocalItemInfos[XATTR_FORMTXTOUTLINE -XATTR_START]._nSID = SID_FORMTEXT_OUTLINE;
+ mpLocalItemInfos[XATTR_FORMTXTSHADOW -XATTR_START]._nSID = SID_FORMTEXT_SHADOW;
+ mpLocalItemInfos[XATTR_FORMTXTSHDWCOLOR -XATTR_START]._nSID = SID_FORMTEXT_SHDWCOLOR;
+ mpLocalItemInfos[XATTR_FORMTXTSHDWXVAL -XATTR_START]._nSID = SID_FORMTEXT_SHDWXVAL;
+ mpLocalItemInfos[XATTR_FORMTXTSHDWYVAL -XATTR_START]._nSID = SID_FORMTEXT_SHDWYVAL;
+ mpLocalItemInfos[XATTR_FORMTXTSTDFORM -XATTR_START]._nSID = SID_FORMTEXT_STDFORM;
+ mpLocalItemInfos[XATTR_FORMTXTHIDEFORM -XATTR_START]._nSID = SID_FORMTEXT_HIDEFORM;
+
+ // if it's my own creation level, set Defaults and ItemInfos
+ if(XATTR_START == GetFirstWhich() && XATTR_END == GetLastWhich())
+ {
+ SetDefaults(mppLocalPoolDefaults);
+ SetItemInfos(mpLocalItemInfos);
+ }
+}
+
+/*************************************************************************
+|*
+|* copy ctor, sorgt dafuer, dass die static defaults gecloned werden
+|* (Parameter 2 = sal_True)
+|*
+\************************************************************************/
+
+XOutdevItemPool::XOutdevItemPool(const XOutdevItemPool& rPool)
+: SfxItemPool(rPool, sal_True),
+ mppLocalPoolDefaults(0L),
+ mpLocalItemInfos(0L)
+{
+}
+
+/*************************************************************************
+|*
+|* Clone()
+|*
+\************************************************************************/
+
+SfxItemPool* XOutdevItemPool::Clone() const
+{
+ return new XOutdevItemPool(*this);
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+XOutdevItemPool::~XOutdevItemPool()
+{
+ Delete();
+
+ // remove own static defaults
+ if(mppLocalPoolDefaults)
+ {
+ SfxPoolItem** ppDefaultItem = mppLocalPoolDefaults;
+ for(sal_uInt16 i(GetLastWhich() - GetFirstWhich() + 1); i; --i, ++ppDefaultItem)
+ {
+ if ( *ppDefaultItem ) //Teile schon von abgel. Klasse abgeraeumt!
+ {
+ SetRefCount( **ppDefaultItem, 0 );
+ delete *ppDefaultItem;
+ }
+ }
+
+ delete[] mppLocalPoolDefaults;
+ }
+
+ if(mpLocalItemInfos)
+ {
+ delete[] mpLocalItemInfos;
+ }
+}
+
+// eof
diff --git a/svx/source/xoutdev/xtabbtmp.cxx b/svx/source/xoutdev/xtabbtmp.cxx
new file mode 100644
index 000000000000..07a1e5bf3ad9
--- /dev/null
+++ b/svx/source/xoutdev/xtabbtmp.cxx
@@ -0,0 +1,294 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#ifndef SVX_LIGHT
+
+#include <com/sun/star/container/XNameContainer.hpp>
+#include "svx/XPropertyTable.hxx"
+#include <unotools/ucbstreamhelper.hxx>
+
+#include "xmlxtexp.hxx"
+#include "xmlxtimp.hxx"
+
+#endif
+
+#include <tools/urlobj.hxx>
+#include <vcl/virdev.hxx>
+#include <svl/itemset.hxx>
+#include <sfx2/docfile.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <svx/xtable.hxx>
+#include <svx/xpool.hxx>
+
+#define GLOBALOVERFLOW
+
+using namespace com::sun::star;
+using namespace rtl;
+
+sal_Unicode const pszExtBitmap[] = {'s','o','b'};
+
+static char const aChckBitmap[] = { 0x04, 0x00, 'S','O','B','L'}; // very old
+static char const aChckBitmap0[] = { 0x04, 0x00, 'S','O','B','0'}; // old
+static char const aChckBitmap1[] = { 0x04, 0x00, 'S','O','B','1'}; // = 5.2
+static char const aChckXML[] = { 'P', 'K', 0x03, 0x04 }; // = 6.0
+
+// -------------------
+// class XBitmapTable
+// -------------------
+
+/*************************************************************************
+|*
+|* XBitmapTable::XBitmapTable()
+|*
+*************************************************************************/
+
+XBitmapTable::XBitmapTable( const String& rPath,
+ XOutdevItemPool* pInPool,
+ sal_uInt16 nInitSize, sal_uInt16 nReSize ) :
+ XPropertyTable( rPath, pInPool, nInitSize, nReSize)
+{
+ pBmpTable = new Table( nInitSize, nReSize );
+}
+
+/************************************************************************/
+
+XBitmapTable::~XBitmapTable()
+{
+}
+
+/************************************************************************/
+
+XBitmapEntry* XBitmapTable::Replace(long nIndex, XBitmapEntry* pEntry )
+{
+ return (XBitmapEntry*) XPropertyTable::Replace(nIndex, pEntry);
+}
+
+/************************************************************************/
+
+XBitmapEntry* XBitmapTable::Remove(long nIndex)
+{
+ return (XBitmapEntry*) XPropertyTable::Remove(nIndex, 0);
+}
+
+/************************************************************************/
+
+XBitmapEntry* XBitmapTable::GetBitmap(long nIndex) const
+{
+ return (XBitmapEntry*) XPropertyTable::Get(nIndex, 0);
+}
+
+/************************************************************************/
+
+sal_Bool XBitmapTable::Load()
+{
+ return( sal_False );
+}
+
+/************************************************************************/
+
+sal_Bool XBitmapTable::Save()
+{
+ return( sal_False );
+}
+
+/************************************************************************/
+
+sal_Bool XBitmapTable::Create()
+{
+ return( sal_False );
+}
+
+/************************************************************************/
+
+sal_Bool XBitmapTable::CreateBitmapsForUI()
+{
+ return( sal_False );
+}
+
+/************************************************************************/
+
+Bitmap* XBitmapTable::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/)
+{
+ return( NULL );
+}
+
+// ------------------
+// class XBitmapList
+// ------------------
+
+/*************************************************************************
+|*
+|* XBitmapList::XBitmapList()
+|*
+*************************************************************************/
+
+XBitmapList::XBitmapList( const String& rPath,
+ XOutdevItemPool* pInPool,
+ sal_uInt16 nInitSize, sal_uInt16 nReSize ) :
+ XPropertyList( rPath, pInPool, nInitSize, nReSize)
+{
+ // pBmpList = new List( nInitSize, nReSize );
+}
+
+/************************************************************************/
+
+XBitmapList::~XBitmapList()
+{
+}
+
+/************************************************************************/
+
+XBitmapEntry* XBitmapList::Replace(XBitmapEntry* pEntry, long nIndex )
+{
+ return (XBitmapEntry*) XPropertyList::Replace(pEntry, nIndex);
+}
+
+/************************************************************************/
+
+XBitmapEntry* XBitmapList::Remove(long nIndex)
+{
+ return (XBitmapEntry*) XPropertyList::Remove(nIndex, 0);
+}
+
+/************************************************************************/
+
+XBitmapEntry* XBitmapList::GetBitmap(long nIndex) const
+{
+ return (XBitmapEntry*) XPropertyList::Get(nIndex, 0);
+}
+
+/************************************************************************/
+
+sal_Bool XBitmapList::Load()
+{
+ if( bListDirty )
+ {
+ bListDirty = sal_False;
+
+ INetURLObject aURL( aPath );
+
+ if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
+ {
+ DBG_ASSERT( !aPath.Len(), "invalid URL" );
+ return sal_False;
+ }
+
+ aURL.Append( aName );
+
+ if( !aURL.getExtension().getLength() )
+ aURL.setExtension( rtl::OUString( pszExtBitmap, 3 ) );
+
+ uno::Reference< container::XNameContainer > xTable( SvxUnoXBitmapTable_createInstance( this ), uno::UNO_QUERY );
+ return SvxXMLXTableImport::load( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable );
+ }
+ return( sal_False );
+}
+
+/************************************************************************/
+
+sal_Bool XBitmapList::Save()
+{
+ INetURLObject aURL( aPath );
+
+ if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
+ {
+ DBG_ASSERT( !aPath.Len(), "invalid URL" );
+ return sal_False;
+ }
+
+ aURL.Append( aName );
+
+ if( !aURL.getExtension().getLength() )
+ aURL.setExtension( rtl::OUString( pszExtBitmap, 3 ) );
+
+ uno::Reference< container::XNameContainer > xTable( SvxUnoXBitmapTable_createInstance( this ), uno::UNO_QUERY );
+ return SvxXMLXTableExportComponent::save( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable );
+}
+
+/************************************************************************/
+// Umgestellt am 27.07.95 auf XBitmap
+
+sal_Bool XBitmapList::Create()
+{
+ // Array der Bitmap
+ //-----------------------
+ // 00 01 02 03 04 05 06 07
+ // 08 09 10 11 12 13 14 15
+ // 16 17 18 19 20 21 22 23
+ // 24 25 26 27 28 29 30 31
+ // 32 33 34 35 36 37 38 39
+ // 40 41 42 43 44 45 46 47
+ // 48 49 50 51 52 53 54 55
+ // 56 57 58 59 60 61 62 63
+
+ String aStr( SVX_RES( RID_SVXSTR_BITMAP ) );
+ Color aColWhite( RGB_Color( COL_WHITE ) );
+ xub_StrLen nLen;
+ sal_uInt16 aArray[64];
+
+ memset( aArray, 0, sizeof( aArray ) );
+ aStr.AppendAscii(" 1");
+ nLen = aStr.Len() - 1;
+ Insert( new XBitmapEntry( XOBitmap( aArray, aColWhite, aColWhite ), aStr ) );
+
+ aArray[ 0] = 1; aArray[ 9] = 1; aArray[18] = 1; aArray[27] = 1;
+ aArray[36] = 1; aArray[45] = 1; aArray[54] = 1; aArray[63] = 1;
+ aStr.SetChar(nLen, sal_Unicode('2'));
+ Insert( new XBitmapEntry( XOBitmap( aArray, RGB_Color( COL_BLACK ), aColWhite ), aStr ) );
+
+ aArray[ 7] = 1; aArray[14] = 1; aArray[21] = 1; aArray[28] = 1;
+ aArray[35] = 1; aArray[42] = 1; aArray[49] = 1; aArray[56] = 1;
+ aStr.SetChar(nLen, sal_Unicode('3'));
+ Insert( new XBitmapEntry( XOBitmap( aArray, RGB_Color( COL_LIGHTRED ), aColWhite ), aStr ) );
+
+ aArray[24] = 1; aArray[25] = 1; aArray[26] = 1;
+ aArray[29] = 1; aArray[30] = 1; aArray[31] = 1;
+ aStr.SetChar(nLen, sal_Unicode('4'));
+ Insert( new XBitmapEntry( XOBitmap( aArray, RGB_Color( COL_LIGHTBLUE ), aColWhite ), aStr ) );
+
+ return( sal_True );
+}
+
+/************************************************************************/
+
+sal_Bool XBitmapList::CreateBitmapsForUI()
+{
+ return( sal_False );
+}
+
+/************************************************************************/
+
+Bitmap* XBitmapList::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/)
+{
+ return( NULL );
+}
+
+// eof
diff --git a/svx/source/xoutdev/xtabcolr.cxx b/svx/source/xoutdev/xtabcolr.cxx
new file mode 100644
index 000000000000..7411904b6303
--- /dev/null
+++ b/svx/source/xoutdev/xtabcolr.cxx
@@ -0,0 +1,548 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#ifndef SVX_LIGHT
+
+#include <com/sun/star/container/XNameContainer.hpp>
+#include "svx/XPropertyTable.hxx"
+#include <unotools/ucbstreamhelper.hxx>
+
+#include <unotools/pathoptions.hxx>
+
+#include "xmlxtexp.hxx"
+#include "xmlxtimp.hxx"
+
+#endif
+
+#include <sfx2/docfile.hxx>
+#include <tools/urlobj.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <svx/xtable.hxx>
+#include <svx/xpool.hxx>
+
+#define GLOBALOVERFLOW
+
+using namespace com::sun::star;
+using namespace rtl;
+
+sal_Unicode const pszExtColor[] = {'s','o','c'};
+
+static char const aChckColor[] = { 0x04, 0x00, 'S','O','C','L'}; // < 5.2
+static char const aChckColor0[] = { 0x04, 0x00, 'S','O','C','0'}; // = 5.2
+static char const aChckXML[] = { '<', '?', 'x', 'm', 'l' }; // = 6.0
+
+// ------------------
+// class XColorTable
+// ------------------
+
+static XColorTable* pTable=0;
+
+/*************************************************************************
+|*
+|* XColorTable::XColorTable()
+|*
+*************************************************************************/
+
+XColorTable::XColorTable( const String& rPath,
+ XOutdevItemPool* pInPool,
+ sal_uInt16 nInitSize, sal_uInt16 nReSize ) :
+ XPropertyTable( rPath, pInPool, nInitSize, nReSize)
+{
+ // ColorTable braucht keine eigene BmpTable
+ // pBmpTable = new Table( nInitSize, nReSize );
+}
+
+/************************************************************************/
+
+XColorTable::~XColorTable()
+{
+}
+
+XColorTable* XColorTable::GetStdColorTable()
+{
+ if ( !pTable )
+ pTable = new XColorTable( SvtPathOptions().GetPalettePath() );
+ return pTable;
+}
+
+/************************************************************************/
+
+XColorEntry* XColorTable::Replace(long nIndex, XColorEntry* pEntry )
+{
+ return (XColorEntry*) XPropertyTable::Replace(nIndex, pEntry);
+}
+
+/************************************************************************/
+
+XColorEntry* XColorTable::Remove(long nIndex)
+{
+ return (XColorEntry*) XPropertyTable::Remove(nIndex, 0);
+}
+
+/************************************************************************/
+
+XColorEntry* XColorTable::GetColor(long nIndex) const
+{
+ return (XColorEntry*) XPropertyTable::Get(nIndex, 0);
+}
+
+/************************************************************************/
+
+sal_Bool XColorTable::Load()
+{
+ if( bTableDirty )
+ {
+ bTableDirty = sal_False;
+
+ INetURLObject aURL( aPath );
+
+ if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
+ {
+ DBG_ASSERT( !aPath.Len(), "invalid URL" );
+ return sal_False;
+ }
+
+ aURL.Append( aName );
+
+ if( !aURL.getExtension().getLength() )
+ aURL.setExtension( rtl::OUString( pszExtColor, 3 ) );
+
+ uno::Reference< container::XNameContainer > xTable( SvxUnoXColorTable_createInstance( this ), uno::UNO_QUERY );
+ return SvxXMLXTableImport::load( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable );
+ }
+ return( sal_False );
+}
+
+/************************************************************************/
+
+sal_Bool XColorTable::Save()
+{
+ INetURLObject aURL( aPath );
+
+ if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
+ {
+ DBG_ASSERT( !aPath.Len(), "invalid URL" );
+ return sal_False;
+ }
+
+ aURL.Append( aName );
+
+ if( !aURL.getExtension().getLength() )
+ aURL.setExtension( rtl::OUString( pszExtColor, 3 ) );
+
+ uno::Reference< container::XNameContainer > xTable( SvxUnoXColorTable_createInstance( this ), uno::UNO_QUERY );
+ return SvxXMLXTableExportComponent::save( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable );
+}
+
+/************************************************************************/
+
+sal_Bool XColorTable::Create()
+{
+ XubString aStr;
+ xub_StrLen nLen;
+ ResMgr& rRes = DIALOG_MGR();
+
+ static sal_uInt16 __READONLY_DATA aResId[] =
+ {
+ RID_SVXSTR_BLACK,
+ RID_SVXSTR_BLUE,
+ RID_SVXSTR_GREEN,
+ RID_SVXSTR_CYAN,
+ RID_SVXSTR_RED,
+ RID_SVXSTR_MAGENTA,
+ RID_SVXSTR_BROWN,
+ RID_SVXSTR_GREY,
+ RID_SVXSTR_LIGHTGREY,
+ RID_SVXSTR_LIGHTBLUE,
+ RID_SVXSTR_LIGHTGREEN,
+ RID_SVXSTR_LIGHTCYAN,
+ RID_SVXSTR_LIGHTRED,
+ RID_SVXSTR_LIGHTMAGENTA,
+ RID_SVXSTR_YELLOW,
+ RID_SVXSTR_WHITE
+ };
+
+ // MT: COL_XXX ist in VCL kein enum mehr!!!
+ // COL_WHITE ist seeeehr gross! ( => Zugriff ueber das obige Array hinweg )
+ // Mit der unteren Schleife gibt es keinen Absturtz, aber es ist
+ // alles schwarz, weil alles kleine Werte.
+ // Ausserdem ist die ganze Vorgehensweise laut MM sehr unperformant
+ // => lieber gleich Stringlisten laden.
+
+ // BM: ifndef VCL part removed (deprecated)
+
+ static ColorData __READONLY_DATA aColTab[] =
+ {
+ COL_BLACK,
+ COL_BLUE,
+ COL_GREEN,
+ COL_CYAN,
+ COL_RED,
+ COL_MAGENTA,
+ COL_BROWN,
+ COL_GRAY,
+ COL_LIGHTGRAY,
+ COL_LIGHTBLUE,
+ COL_LIGHTGREEN,
+ COL_LIGHTCYAN,
+ COL_LIGHTRED,
+ COL_LIGHTMAGENTA,
+ COL_YELLOW,
+ COL_WHITE
+ };
+
+ for( sal_uInt16 n = 0; n < 16; ++n )
+ {
+ Insert( n, new XColorEntry( Color( aColTab[n] ),
+ String( ResId( aResId[ n ], rRes )) ) );
+ }
+
+ aStr = SVX_RESSTR( RID_SVXSTR_GREY );
+ aStr.AppendAscii(" 80%");
+ nLen = aStr.Len() - 3;
+ Insert(16, new XColorEntry( Color( 51, 51, 51 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('7'));
+ Insert(17, new XColorEntry( Color( 76, 76, 76 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('6'));
+ Insert(18, new XColorEntry( Color(102,102,102 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('4'));
+ Insert(19, new XColorEntry( Color(153,153,153 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('3'));
+ Insert(20, new XColorEntry( Color(179,179,179 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('2'));
+ Insert(21, new XColorEntry( Color(204,204,204 ), aStr ) );
+ // BM: new 15%
+ aStr.SetChar(nLen, sal_Unicode('1'));
+ aStr.SetChar(nLen + 1, sal_Unicode('5'));
+ Insert(22, new XColorEntry( Color(217,217,217 ), aStr ) );
+ aStr.SetChar(nLen + 1, sal_Unicode('0'));
+ Insert(23, new XColorEntry( Color(230,230,230 ), aStr ) );
+ Insert(24, new XColorEntry( Color(230,230,255 ), SVX_RESSTR( RID_SVXSTR_BLUEGREY ) ) );
+
+ aStr = SVX_RESSTR( RID_SVXSTR_RED );
+ aStr.AppendAscii(" 1");
+ nLen = aStr.Len() - 1;
+ Insert(25, new XColorEntry( Color(255, 51,102 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('2'));
+ Insert(26, new XColorEntry( Color(220, 35, 0 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('3'));
+ Insert(27, new XColorEntry( Color(184, 71, 0 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('4'));
+ Insert(28, new XColorEntry( Color(255, 51, 51 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('5'));
+ Insert(29, new XColorEntry( Color(235, 97, 61 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('6'));
+ Insert(30, new XColorEntry( Color(184, 71, 71 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('7'));
+ Insert(31, new XColorEntry( Color(184, 0, 71 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('8'));
+ Insert(32, new XColorEntry( Color(153, 40, 76 ), aStr ) );
+
+ aStr = SVX_RESSTR( RID_SVXSTR_MAGENTA );
+ aStr.AppendAscii(" 1");
+ nLen = aStr.Len() - 1;
+ Insert(33, new XColorEntry( Color(148, 0,107 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('2'));
+ Insert(34, new XColorEntry( Color(148, 71,107 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('3'));
+ Insert(35, new XColorEntry( Color(148, 71,148 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('4'));
+ Insert(36, new XColorEntry( Color(153,102,204 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('5'));
+ Insert(37, new XColorEntry( Color(107, 71,148 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('6'));
+ Insert(38, new XColorEntry( Color(107, 35,148 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('7'));
+ Insert(39, new XColorEntry( Color(107, 0,148 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('8'));
+ Insert(40, new XColorEntry( Color( 94, 17,166 ), aStr ) );
+
+ aStr = SVX_RESSTR( RID_SVXSTR_BLUE );
+ aStr.AppendAscii(" 1");
+ nLen = aStr.Len() - 1;
+ Insert(41, new XColorEntry( Color( 40, 0,153 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('2'));
+ Insert(42, new XColorEntry( Color( 71, 0,184 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('3'));
+ Insert(43, new XColorEntry( Color( 35, 0,220 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('4'));
+ Insert(44, new XColorEntry( Color( 35, 35,220 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('5'));
+ Insert(45, new XColorEntry( Color( 0, 71,255 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('6'));
+ Insert(46, new XColorEntry( Color( 0,153,255 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('7'));
+ Insert(47, new XColorEntry( Color( 0,184,255 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('8'));
+ Insert(48, new XColorEntry( Color(153,204,255 ), aStr ) );
+ //Insert(48, new XColorEntry( Color( 46,215,255 ), aStr ) );
+
+ aStr = SVX_RESSTR( RID_SVXSTR_CYAN );
+ aStr.AppendAscii(" 1");
+ nLen = aStr.Len() - 1;
+ Insert(49, new XColorEntry( Color( 0,220,255 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('2'));
+ Insert(50, new XColorEntry( Color( 0,204,204 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('3'));
+ Insert(51, new XColorEntry( Color( 35,184,220 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('4'));
+ Insert(52, new XColorEntry( Color( 71,184,184 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('5'));
+ Insert(53, new XColorEntry( Color( 51,163,163 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('6'));
+ Insert(54, new XColorEntry( Color( 25,138,138 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('7'));
+ Insert(55, new XColorEntry( Color( 0,107,107 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('8'));
+ Insert(56, new XColorEntry( Color( 0, 74, 74 ), aStr ) );
+
+ aStr = SVX_RESSTR( RID_SVXSTR_GREEN );
+ aStr.AppendAscii(" 1");
+ nLen = aStr.Len() - 1;
+ Insert(57, new XColorEntry( Color( 53, 94, 0 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('2'));
+ Insert(58, new XColorEntry( Color( 92,133, 38 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('3'));
+ Insert(59, new XColorEntry( Color(125,166, 71 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('4'));
+ Insert(60, new XColorEntry( Color(148,189, 94 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('5'));
+ Insert(61, new XColorEntry( Color( 0,174, 0 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('6'));
+ Insert(62, new XColorEntry( Color( 51,204,102 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('7'));
+ Insert(63, new XColorEntry( Color( 61,235, 61 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('8'));
+ Insert(64, new XColorEntry( Color( 35,255, 35 ), aStr ) );
+
+ aStr = SVX_RESSTR( RID_SVXSTR_YELLOW );
+ aStr.AppendAscii(" 1");
+ nLen = aStr.Len() - 1;
+ Insert(65, new XColorEntry( Color(230,255, 0 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('2'));
+ Insert(66, new XColorEntry( Color(255,255,153 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('3'));
+ Insert(67, new XColorEntry( Color(255,255,102 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('4'));
+ Insert(68, new XColorEntry( Color(230,230, 76 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('5'));
+ Insert(69, new XColorEntry( Color(204,204, 0 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('6'));
+ Insert(70, new XColorEntry( Color(179,179, 0 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('7'));
+ Insert(71, new XColorEntry( Color(128,128, 25 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('8'));
+ Insert(72, new XColorEntry( Color(102,102, 0 ), aStr ) );
+
+ aStr = SVX_RESSTR( RID_SVXSTR_BROWN );
+ aStr.AppendAscii(" 1");
+ nLen = aStr.Len() - 1;
+ Insert(73, new XColorEntry( Color( 76, 25, 0 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('2'));
+ Insert(74, new XColorEntry( Color(102, 51, 0 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('3'));
+ Insert(75, new XColorEntry( Color(128, 76, 25 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('4'));
+ Insert(76, new XColorEntry( Color(153,102, 51 ), aStr ) );
+
+ aStr = SVX_RESSTR( RID_SVXSTR_ORANGE );
+ aStr.AppendAscii(" 1");
+ nLen = aStr.Len() - 1;
+ Insert(77, new XColorEntry( Color(204,102, 51 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('2'));
+ Insert(78, new XColorEntry( Color(255,102, 51 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('3'));
+ Insert(79, new XColorEntry( Color(255,153,102 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('4'));
+ Insert(80, new XColorEntry( Color(255,204,153 ), aStr ) );
+
+ // new chart colors
+ aStr = SVX_RESSTR( RID_SVXSTR_VIOLET );
+ Insert( 81, new XColorEntry( Color( 0x99, 0x99, 0xff ), aStr ) );
+
+ aStr = SVX_RESSTR( RID_SVXSTR_BORDEAUX );
+ Insert( 82, new XColorEntry( Color( 0x99, 0x33, 0x66 ), aStr ) );
+
+ aStr = SVX_RESSTR( RID_SVXSTR_PALE_YELLOW );
+ Insert( 83, new XColorEntry( Color( 0xff, 0xff, 0xcc ), aStr ) );
+
+ aStr = SVX_RESSTR( RID_SVXSTR_PALE_GREEN );
+ Insert( 84, new XColorEntry( Color( 0xcc, 0xff, 0xff ), aStr ) );
+
+ aStr = SVX_RESSTR( RID_SVXSTR_DKVIOLET );
+ Insert( 85, new XColorEntry( Color( 0x66, 0x00, 0x66 ), aStr ) );
+
+ aStr = SVX_RESSTR( RID_SVXSTR_SALMON );
+ Insert( 86, new XColorEntry( Color( 0xff, 0x80, 0x80 ), aStr ) );
+
+ aStr = SVX_RESSTR( RID_SVXSTR_SEABLUE );
+ Insert( 87, new XColorEntry( Color( 0x00, 0x66, 0xcc ), aStr ) );
+
+ // Sun colors
+ aStr = SVX_RESSTR( RID_SVXSTR_COLOR_SUN );
+ aStr.AppendAscii(" 1");
+ nLen = aStr.Len() - 1;
+ Insert( 88, new XColorEntry( Color( 0x33, 0x33, 0x66 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('2'));
+ Insert( 89, new XColorEntry( Color( 0x66, 0x66, 0x99 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('3'));
+ Insert( 90, new XColorEntry( Color( 0x99, 0x99, 0xcc ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('4'));
+ Insert( 91, new XColorEntry( Color( 0xcc, 0xcc, 0xff ), aStr ) );
+
+ // Chart default colors
+ aStr = SVX_RESSTR( RID_SVXSTR_COLOR_CHART );
+ aStr.AppendAscii(" 1");
+ nLen = aStr.Len() - 1;
+ Insert( 92, new XColorEntry( Color( 0x00, 0x45, 0x86 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('2'));
+ Insert( 93, new XColorEntry( Color( 0xff, 0x42, 0x0e ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('3'));
+ Insert( 94, new XColorEntry( Color( 0xff, 0xd3, 0x20 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('4'));
+ Insert( 95, new XColorEntry( Color( 0x57, 0x9d, 0x1c ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('5'));
+ Insert( 96, new XColorEntry( Color( 0x7e, 0x00, 0x21 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('6'));
+ Insert( 97, new XColorEntry( Color( 0x83, 0xca, 0xff ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('7'));
+ Insert( 98, new XColorEntry( Color( 0x31, 0x40, 0x04 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('8'));
+ Insert( 99, new XColorEntry( Color( 0xae, 0xcf, 0x00 ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('9'));
+ Insert( 100, new XColorEntry( Color( 0x4b, 0x1f, 0x6f ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('1'));
+ aStr.AppendAscii("0");
+ nLen = aStr.Len() - 1;
+ Insert( 101, new XColorEntry( Color( 0xff, 0x95, 0x0e ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('1'));
+ Insert( 102, new XColorEntry( Color( 0xc5, 0x00, 0x0b ), aStr ) );
+ aStr.SetChar(nLen, sal_Unicode('2'));
+ Insert( 103, new XColorEntry( Color( 0x00, 0x84, 0xd1 ), aStr ) );
+
+ return( Count() == 104 );
+}
+
+/************************************************************************/
+
+sal_Bool XColorTable::CreateBitmapsForUI()
+{
+ return( sal_False );
+}
+
+/************************************************************************/
+
+Bitmap* XColorTable::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/)
+{
+ return( NULL );
+}
+
+// --------------------
+// class XColorList
+// --------------------
+
+/*************************************************************************
+|*
+|* XColorList::XColorList()
+|*
+*************************************************************************/
+
+XColorList::XColorList( const String& rPath,
+ XOutdevItemPool* pInPool,
+ sal_uInt16 nInitSize, sal_uInt16 nReSize ) :
+ XPropertyList( rPath, pInPool, nInitSize, nReSize)
+{
+ // pBmpList = new List( nInitSize, nReSize );
+}
+
+/************************************************************************/
+
+XColorList::~XColorList()
+{
+}
+
+/************************************************************************/
+
+XColorEntry* XColorList::Replace(XColorEntry* pEntry, long nIndex )
+{
+ return (XColorEntry*) XPropertyList::Replace(pEntry, nIndex);
+}
+
+/************************************************************************/
+
+XColorEntry* XColorList::Remove(long nIndex)
+{
+ return (XColorEntry*) XPropertyList::Remove(nIndex, 0);
+}
+
+/************************************************************************/
+
+XColorEntry* XColorList::GetColor(long nIndex) const
+{
+ return (XColorEntry*) XPropertyList::Get(nIndex, 0);
+}
+
+/************************************************************************/
+
+sal_Bool XColorList::Load()
+{
+ return( sal_False );
+}
+
+/************************************************************************/
+
+sal_Bool XColorList::Save()
+{
+ return( sal_False );
+}
+
+/************************************************************************/
+
+sal_Bool XColorList::Create()
+{
+ return( sal_False );
+}
+
+/************************************************************************/
+
+sal_Bool XColorList::CreateBitmapsForUI()
+{
+ return( sal_False );
+}
+
+/************************************************************************/
+
+Bitmap* XColorList::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/)
+{
+ return( NULL );
+}
+
+// eof
diff --git a/svx/source/xoutdev/xtabdash.cxx b/svx/source/xoutdev/xtabdash.cxx
new file mode 100644
index 000000000000..dd6bf8f17d19
--- /dev/null
+++ b/svx/source/xoutdev/xtabdash.cxx
@@ -0,0 +1,378 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#ifndef SVX_LIGHT
+
+#include <com/sun/star/container/XNameContainer.hpp>
+#include "svx/XPropertyTable.hxx"
+#include <unotools/ucbstreamhelper.hxx>
+
+#include "xmlxtexp.hxx"
+#include "xmlxtimp.hxx"
+
+#endif
+#include <vcl/svapp.hxx>
+
+#include <tools/urlobj.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/window.hxx>
+#include <svl/itemset.hxx>
+#include <sfx2/docfile.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <svx/xtable.hxx>
+#include <svx/xpool.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svx/xlndsit.hxx>
+#include <svx/xflclit.hxx>
+
+#include <svx/svdorect.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+using namespace com::sun::star;
+using namespace rtl;
+
+#define GLOBALOVERFLOW
+
+sal_Unicode const pszExtDash[] = {'s','o','d'};
+char const aChckDash[] = { 0x04, 0x00, 'S','O','D','L'}; // < 5.2
+char const aChckDash0[] = { 0x04, 0x00, 'S','O','D','0'}; // = 5.2
+char const aChckXML[] = { '<', '?', 'x', 'm', 'l' }; // = 6.0
+
+// -----------------
+// class XDashTable
+// -----------------
+
+/*************************************************************************
+|*
+|* XDashTable::XDashTable()
+|*
+*************************************************************************/
+
+XDashTable::XDashTable( const String& rPath,
+ XOutdevItemPool* pInPool,
+ sal_uInt16 nInitSize, sal_uInt16 nReSize ) :
+ XPropertyTable( rPath, pInPool, nInitSize, nReSize)
+{
+ pBmpTable = new Table( nInitSize, nReSize );
+}
+
+/************************************************************************/
+
+XDashTable::~XDashTable()
+{
+}
+
+/************************************************************************/
+
+XDashEntry* XDashTable::Replace(long nIndex, XDashEntry* pEntry )
+{
+ return (XDashEntry*) XPropertyTable::Replace(nIndex, pEntry);
+}
+
+/************************************************************************/
+
+XDashEntry* XDashTable::Remove(long nIndex)
+{
+ return (XDashEntry*) XPropertyTable::Remove(nIndex, 0);
+}
+
+/************************************************************************/
+
+XDashEntry* XDashTable::GetDash(long nIndex) const
+{
+ return (XDashEntry*) XPropertyTable::Get(nIndex, 0);
+}
+
+/************************************************************************/
+
+sal_Bool XDashTable::Load()
+{
+ return( sal_False );
+}
+
+/************************************************************************/
+
+sal_Bool XDashTable::Save()
+{
+ return( sal_False );
+}
+
+/************************************************************************/
+
+sal_Bool XDashTable::Create()
+{
+ return( sal_False );
+}
+
+/************************************************************************/
+
+sal_Bool XDashTable::CreateBitmapsForUI()
+{
+ return( sal_False );
+}
+
+/************************************************************************/
+
+Bitmap* XDashTable::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/)
+{
+ return( NULL );
+}
+
+// ----------------
+// class XDashList
+// ----------------
+
+class impXDashList
+{
+private:
+ VirtualDevice* mpVirtualDevice;
+ SdrModel* mpSdrModel;
+ SdrObject* mpBackgroundObject;
+ SdrObject* mpLineObject;
+
+public:
+ impXDashList(VirtualDevice* pV, SdrModel* pM, SdrObject* pB, SdrObject* pL)
+ : mpVirtualDevice(pV),
+ mpSdrModel(pM),
+ mpBackgroundObject(pB),
+ mpLineObject(pL)
+ {}
+
+ ~impXDashList()
+ {
+ delete mpVirtualDevice;
+ SdrObject::Free(mpBackgroundObject);
+ SdrObject::Free(mpLineObject);
+ delete mpSdrModel;
+ }
+
+ VirtualDevice* getVirtualDevice() const { return mpVirtualDevice; }
+ SdrObject* getBackgroundObject() const { return mpBackgroundObject; }
+ SdrObject* getLineObject() const { return mpLineObject; }
+};
+
+void XDashList::impCreate()
+{
+ if(!mpData)
+ {
+ const Point aZero(0, 0);
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+
+ VirtualDevice* pVirDev = new VirtualDevice;
+ OSL_ENSURE(0 != pVirDev, "XDashList: no VirtualDevice created!" );
+ pVirDev->SetMapMode(MAP_100TH_MM);
+ const Size aSize(pVirDev->PixelToLogic(Size(BITMAP_WIDTH * 2, BITMAP_HEIGHT)));
+ pVirDev->SetOutputSize(aSize);
+ pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode()
+ ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
+ : DRAWMODE_DEFAULT);
+
+ SdrModel* pSdrModel = new SdrModel();
+ OSL_ENSURE(0 != pSdrModel, "XDashList: no SdrModel created!" );
+ pSdrModel->GetItemPool().FreezeIdRanges();
+
+ const Rectangle aBackgroundSize(aZero, aSize);
+ SdrObject* pBackgroundObject = new SdrRectObj(aBackgroundSize);
+ OSL_ENSURE(0 != pBackgroundObject, "XDashList: no BackgroundObject created!" );
+ pBackgroundObject->SetModel(pSdrModel);
+ pBackgroundObject->SetMergedItem(XFillStyleItem(XFILL_SOLID));
+ pBackgroundObject->SetMergedItem(XLineStyleItem(XLINE_NONE));
+ pBackgroundObject->SetMergedItem(XFillColorItem(String(), rStyleSettings.GetFieldColor()));
+
+ const basegfx::B2DPoint aStart(0, aSize.Height() / 2);
+ const basegfx::B2DPoint aEnd(aSize.Width(), aSize.Height() / 2);
+ basegfx::B2DPolygon aPolygon;
+ aPolygon.append(aStart);
+ aPolygon.append(aEnd);
+ SdrObject* pLineObject = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPolygon));
+ OSL_ENSURE(0 != pLineObject, "XDashList: no LineObject created!" );
+ pLineObject->SetModel(pSdrModel);
+ pLineObject->SetMergedItem(XLineStyleItem(XLINE_DASH));
+ pLineObject->SetMergedItem(XLineColorItem(String(), rStyleSettings.GetFieldTextColor()));
+ pLineObject->SetMergedItem(XLineWidthItem(30));
+
+ mpData = new impXDashList(pVirDev, pSdrModel, pBackgroundObject, pLineObject);
+ OSL_ENSURE(0 != mpData, "XDashList: data creation went wrong!" );
+ }
+}
+
+void XDashList::impDestroy()
+{
+ if(mpData)
+ {
+ delete mpData;
+ mpData = 0;
+ }
+}
+
+XDashList::XDashList(const String& rPath, XOutdevItemPool* pInPool, sal_uInt16 nInitSize, sal_uInt16 nReSize)
+: XPropertyList(rPath, pInPool, nInitSize, nReSize),
+ mpData(0)
+{
+ pBmpList = new List(nInitSize, nReSize);
+}
+
+XDashList::~XDashList()
+{
+ impDestroy();
+}
+
+XDashEntry* XDashList::Replace(XDashEntry* pEntry, long nIndex )
+{
+ return (XDashEntry*) XPropertyList::Replace(pEntry, nIndex);
+}
+
+XDashEntry* XDashList::Remove(long nIndex)
+{
+ return (XDashEntry*) XPropertyList::Remove(nIndex, 0);
+}
+
+XDashEntry* XDashList::GetDash(long nIndex) const
+{
+ return (XDashEntry*) XPropertyList::Get(nIndex, 0);
+}
+
+sal_Bool XDashList::Load()
+{
+ if( bListDirty )
+ {
+ bListDirty = sal_False;
+
+ INetURLObject aURL( aPath );
+
+ if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
+ {
+ DBG_ASSERT( !aPath.Len(), "invalid URL" );
+ return sal_False;
+ }
+
+ aURL.Append( aName );
+
+ if( !aURL.getExtension().getLength() )
+ aURL.setExtension( rtl::OUString( pszExtDash, 3 ) );
+
+ uno::Reference< container::XNameContainer > xTable( SvxUnoXDashTable_createInstance( this ), uno::UNO_QUERY );
+ return SvxXMLXTableImport::load( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable );
+ }
+ return( sal_False );
+}
+
+sal_Bool XDashList::Save()
+{
+ INetURLObject aURL( aPath );
+
+ if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
+ {
+ DBG_ASSERT( !aPath.Len(), "invalid URL" );
+ return sal_False;
+ }
+
+ aURL.Append( aName );
+
+ if( !aURL.getExtension().getLength() )
+ aURL.setExtension( rtl::OUString( pszExtDash, 3 ) );
+
+ uno::Reference< container::XNameContainer > xTable( SvxUnoXDashTable_createInstance( this ), uno::UNO_QUERY );
+ return SvxXMLXTableExportComponent::save( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable );
+}
+
+sal_Bool XDashList::Create()
+{
+ XubString aStr( SVX_RES( RID_SVXSTR_LINESTYLE ) );
+ xub_StrLen nLen;
+
+ aStr.AppendAscii(" 1");
+ nLen = aStr.Len() - 1;
+ Insert(new XDashEntry(XDash(XDASH_RECT,1, 50,1, 50, 50),aStr));
+ aStr.SetChar(nLen, sal_Unicode('2'));
+ Insert(new XDashEntry(XDash(XDASH_RECT,1,500,1,500,500),aStr));
+ aStr.SetChar(nLen, sal_Unicode('3'));
+ Insert(new XDashEntry(XDash(XDASH_RECT,2, 50,3,250,120),aStr));
+
+ return( sal_True );
+}
+
+sal_Bool XDashList::CreateBitmapsForUI()
+{
+ impCreate();
+
+ for( long i = 0; i < Count(); i++)
+ {
+ Bitmap* pBmp = CreateBitmapForUI( i, sal_False );
+ DBG_ASSERT( pBmp, "XDashList: Bitmap(UI) konnte nicht erzeugt werden!" );
+
+ if( pBmp )
+ pBmpList->Insert( pBmp, i );
+ }
+
+ impDestroy();
+
+ return( sal_True );
+}
+
+Bitmap* XDashList::CreateBitmapForUI( long nIndex, sal_Bool bDelete )
+{
+ impCreate();
+ VirtualDevice* pVD = mpData->getVirtualDevice();
+ SdrObject* pLine = mpData->getLineObject();
+
+ pLine->SetMergedItem(XLineStyleItem(XLINE_DASH));
+ pLine->SetMergedItem(XLineDashItem(String(), GetDash(nIndex)->GetDash()));
+
+ sdr::contact::SdrObjectVector aObjectVector;
+ aObjectVector.push_back(mpData->getBackgroundObject());
+ aObjectVector.push_back(pLine);
+ sdr::contact::ObjectContactOfObjListPainter aPainter(*pVD, aObjectVector, 0);
+ sdr::contact::DisplayInfo aDisplayInfo;
+
+ aPainter.ProcessDisplay(aDisplayInfo);
+
+ const Point aZero(0, 0);
+ Bitmap* pBitmap = new Bitmap(pVD->GetBitmap(aZero, pVD->GetOutputSize()));
+
+ if(bDelete)
+ {
+ impDestroy();
+ }
+
+ return pBitmap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/xoutdev/xtabgrdt.cxx b/svx/source/xoutdev/xtabgrdt.cxx
new file mode 100644
index 000000000000..02b35fb27f33
--- /dev/null
+++ b/svx/source/xoutdev/xtabgrdt.cxx
@@ -0,0 +1,372 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#ifndef SVX_LIGHT
+
+#include <com/sun/star/container/XNameContainer.hpp>
+#include "svx/XPropertyTable.hxx"
+#include <unotools/ucbstreamhelper.hxx>
+
+#include "xmlxtexp.hxx"
+#include "xmlxtimp.hxx"
+
+#endif
+
+#include <tools/urlobj.hxx>
+#include <vcl/virdev.hxx>
+#include <svl/itemset.hxx>
+#include <sfx2/docfile.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <svx/xtable.hxx>
+#include <svx/xpool.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xflgrit.hxx>
+
+#include <svx/svdorect.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <vcl/svapp.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xgrscit.hxx>
+
+#define GLOBALOVERFLOW
+
+using namespace com::sun::star;
+using namespace rtl;
+
+sal_Unicode const pszExtGradient[] = {'s','o','g'};
+
+char const aChckGradient[] = { 0x04, 0x00, 'S','O','G','L'}; // < 5.2
+char const aChckGradient0[] = { 0x04, 0x00, 'S','O','G','0'}; // = 5.2
+char const aChckXML[] = { '<', '?', 'x', 'm', 'l' }; // = 6.0
+
+// ---------------------
+// class XGradientTable
+// ---------------------
+
+/*************************************************************************
+|*
+|* XGradientTable::XGradientTable()
+|*
+*************************************************************************/
+
+XGradientTable::XGradientTable( const String& rPath,
+ XOutdevItemPool* pInPool,
+ sal_uInt16 nInitSize, sal_uInt16 nReSize ) :
+ XPropertyTable( rPath, pInPool, nInitSize, nReSize)
+{
+ pBmpTable = new Table( nInitSize, nReSize );
+}
+
+/************************************************************************/
+
+XGradientTable::~XGradientTable()
+{
+}
+
+/************************************************************************/
+
+XGradientEntry* XGradientTable::Replace(long nIndex, XGradientEntry* pEntry )
+{
+ return (XGradientEntry*) XPropertyTable::Replace(nIndex, pEntry);
+}
+
+/************************************************************************/
+
+XGradientEntry* XGradientTable::Remove(long nIndex)
+{
+ return (XGradientEntry*) XPropertyTable::Remove(nIndex, 0);
+}
+
+/************************************************************************/
+
+XGradientEntry* XGradientTable::GetGradient(long nIndex) const
+{
+ return (XGradientEntry*) XPropertyTable::Get(nIndex, 0);
+}
+
+/************************************************************************/
+
+sal_Bool XGradientTable::Load()
+{
+ return( sal_False );
+}
+
+/************************************************************************/
+
+sal_Bool XGradientTable::Save()
+{
+ return( sal_False );
+}
+
+/************************************************************************/
+
+sal_Bool XGradientTable::Create()
+{
+ return( sal_False );
+}
+
+/************************************************************************/
+
+sal_Bool XGradientTable::CreateBitmapsForUI()
+{
+ return( sal_False );
+}
+
+/************************************************************************/
+
+Bitmap* XGradientTable::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/)
+{
+ return( NULL );
+}
+
+// --------------------
+// class XGradientList
+// --------------------
+
+class impXGradientList
+{
+private:
+ VirtualDevice* mpVirtualDevice;
+ SdrModel* mpSdrModel;
+ SdrObject* mpBackgroundObject;
+
+public:
+ impXGradientList(VirtualDevice* pV, SdrModel* pM, SdrObject* pB)
+ : mpVirtualDevice(pV),
+ mpSdrModel(pM),
+ mpBackgroundObject(pB)
+ {}
+
+ ~impXGradientList()
+ {
+ delete mpVirtualDevice;
+ SdrObject::Free(mpBackgroundObject);
+ delete mpSdrModel;
+ }
+
+ VirtualDevice* getVirtualDevice() const { return mpVirtualDevice; }
+ SdrObject* getBackgroundObject() const { return mpBackgroundObject; }
+};
+
+void XGradientList::impCreate()
+{
+ if(!mpData)
+ {
+ const Point aZero(0, 0);
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+
+ VirtualDevice* pVirDev = new VirtualDevice;
+ OSL_ENSURE(0 != pVirDev, "XGradientList: no VirtualDevice created!" );
+ pVirDev->SetMapMode(MAP_100TH_MM);
+ const Size aSize(pVirDev->PixelToLogic(Size(BITMAP_WIDTH, BITMAP_HEIGHT)));
+ pVirDev->SetOutputSize(aSize);
+ pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode()
+ ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
+ : DRAWMODE_DEFAULT);
+
+ SdrModel* pSdrModel = new SdrModel();
+ OSL_ENSURE(0 != pSdrModel, "XGradientList: no SdrModel created!" );
+ pSdrModel->GetItemPool().FreezeIdRanges();
+
+ const Size aSinglePixel(pVirDev->PixelToLogic(Size(1, 1)));
+ const Rectangle aBackgroundSize(aZero, Size(aSize.getWidth() - aSinglePixel.getWidth(), aSize.getHeight() - aSinglePixel.getHeight()));
+ SdrObject* pBackgroundObject = new SdrRectObj(aBackgroundSize);
+ OSL_ENSURE(0 != pBackgroundObject, "XGradientList: no BackgroundObject created!" );
+ pBackgroundObject->SetModel(pSdrModel);
+ pBackgroundObject->SetMergedItem(XFillStyleItem(XFILL_GRADIENT));
+ pBackgroundObject->SetMergedItem(XLineStyleItem(XLINE_SOLID));
+ pBackgroundObject->SetMergedItem(XLineColorItem(String(), Color(COL_BLACK)));
+ pBackgroundObject->SetMergedItem(XGradientStepCountItem(sal_uInt16((BITMAP_WIDTH + BITMAP_HEIGHT) / 3)));
+
+ mpData = new impXGradientList(pVirDev, pSdrModel, pBackgroundObject);
+ OSL_ENSURE(0 != mpData, "XGradientList: data creation went wrong!" );
+ }
+}
+
+void XGradientList::impDestroy()
+{
+ if(mpData)
+ {
+ delete mpData;
+ mpData = 0;
+ }
+}
+
+XGradientList::XGradientList( const String& rPath, XOutdevItemPool* pInPool, sal_uInt16 nInitSize, sal_uInt16 nReSize)
+: XPropertyList(rPath, pInPool, nInitSize, nReSize),
+ mpData(0)
+{
+ pBmpList = new List(nInitSize, nReSize);
+}
+
+XGradientList::~XGradientList()
+{
+ if(mpData)
+ {
+ delete mpData;
+ mpData = 0;
+ }
+}
+
+XGradientEntry* XGradientList::Replace(XGradientEntry* pEntry, long nIndex )
+{
+ return( (XGradientEntry*) XPropertyList::Replace( pEntry, nIndex ) );
+}
+
+XGradientEntry* XGradientList::Remove(long nIndex)
+{
+ return( (XGradientEntry*) XPropertyList::Remove( nIndex, 0 ) );
+}
+
+XGradientEntry* XGradientList::GetGradient(long nIndex) const
+{
+ return( (XGradientEntry*) XPropertyList::Get( nIndex, 0 ) );
+}
+
+sal_Bool XGradientList::Load()
+{
+ if( bListDirty )
+ {
+ bListDirty = sal_False;
+
+ INetURLObject aURL( aPath );
+
+ if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
+ {
+ DBG_ASSERT( !aPath.Len(), "invalid URL" );
+ return sal_False;
+ }
+
+ aURL.Append( aName );
+
+ if( !aURL.getExtension().getLength() )
+ aURL.setExtension( rtl::OUString( pszExtGradient, 3 ) );
+
+ uno::Reference< container::XNameContainer > xTable( SvxUnoXGradientTable_createInstance( this ), uno::UNO_QUERY );
+ return SvxXMLXTableImport::load( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable );
+
+ }
+ return( sal_False );
+}
+
+sal_Bool XGradientList::Save()
+{
+ INetURLObject aURL( aPath );
+
+ if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
+ {
+ DBG_ASSERT( !aPath.Len(), "invalid URL" );
+ return sal_False;
+ }
+
+ aURL.Append( aName );
+
+ if( !aURL.getExtension().getLength() )
+ aURL.setExtension( rtl::OUString( pszExtGradient, 3 ) );
+
+ uno::Reference< container::XNameContainer > xTable( SvxUnoXGradientTable_createInstance( this ), uno::UNO_QUERY );
+ return SvxXMLXTableExportComponent::save( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable );
+}
+
+sal_Bool XGradientList::Create()
+{
+ XubString aStr( SVX_RES( RID_SVXSTR_GRADIENT ) );
+ xub_StrLen nLen;
+
+ aStr.AppendAscii(" 1");
+ nLen = aStr.Len() - 1;
+ Insert(new XGradientEntry(XGradient(RGB_Color(COL_BLACK ),RGB_Color(COL_WHITE ),XGRAD_LINEAR , 0,10,10, 0,100,100),aStr));
+ aStr.SetChar(nLen, sal_Unicode('2'));
+ Insert(new XGradientEntry(XGradient(RGB_Color(COL_BLUE ),RGB_Color(COL_RED ),XGRAD_AXIAL , 300,20,20,10,100,100),aStr));
+ aStr.SetChar(nLen, sal_Unicode('3'));
+ Insert(new XGradientEntry(XGradient(RGB_Color(COL_RED ),RGB_Color(COL_YELLOW ),XGRAD_RADIAL , 600,30,30,20,100,100),aStr));
+ aStr.SetChar(nLen, sal_Unicode('4'));
+ Insert(new XGradientEntry(XGradient(RGB_Color(COL_YELLOW ),RGB_Color(COL_GREEN ),XGRAD_ELLIPTICAL, 900,40,40,30,100,100),aStr));
+ aStr.SetChar(nLen, sal_Unicode('5'));
+ Insert(new XGradientEntry(XGradient(RGB_Color(COL_GREEN ),RGB_Color(COL_MAGENTA),XGRAD_SQUARE , 1200,50,50,40,100,100),aStr));
+ aStr.SetChar(nLen, sal_Unicode('6'));
+ Insert(new XGradientEntry(XGradient(RGB_Color(COL_MAGENTA),RGB_Color(COL_YELLOW ),XGRAD_RECT , 1900,60,60,50,100,100),aStr));
+
+ return( sal_True );
+}
+
+sal_Bool XGradientList::CreateBitmapsForUI()
+{
+ impCreate();
+
+ for( long i = 0; i < Count(); i++)
+ {
+ Bitmap* pBmp = CreateBitmapForUI( i, sal_False );
+ DBG_ASSERT( pBmp, "XGradientList: Bitmap(UI) konnte nicht erzeugt werden!" );
+
+ if( pBmp )
+ pBmpList->Insert( pBmp, i );
+ }
+
+ impDestroy();
+
+ return( sal_False );
+}
+
+Bitmap* XGradientList::CreateBitmapForUI( long nIndex, sal_Bool bDelete )
+{
+ impCreate();
+ VirtualDevice* pVD = mpData->getVirtualDevice();
+ SdrObject* pBackgroundObject = mpData->getBackgroundObject();
+
+ const SfxItemSet& rItemSet = pBackgroundObject->GetMergedItemSet();
+ pBackgroundObject->SetMergedItem(XFillStyleItem(XFILL_GRADIENT));
+ pBackgroundObject->SetMergedItem(XFillGradientItem(rItemSet.GetPool(), GetGradient(nIndex)->GetGradient()));
+
+ sdr::contact::SdrObjectVector aObjectVector;
+ aObjectVector.push_back(pBackgroundObject);
+ sdr::contact::ObjectContactOfObjListPainter aPainter(*pVD, aObjectVector, 0);
+ sdr::contact::DisplayInfo aDisplayInfo;
+
+ aPainter.ProcessDisplay(aDisplayInfo);
+
+ const Point aZero(0, 0);
+ Bitmap* pBitmap = new Bitmap(pVD->GetBitmap(aZero, pVD->GetOutputSize()));
+
+ if(bDelete)
+ {
+ impDestroy();
+ }
+
+ return pBitmap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/xoutdev/xtabhtch.cxx b/svx/source/xoutdev/xtabhtch.cxx
new file mode 100644
index 000000000000..b62909fda71a
--- /dev/null
+++ b/svx/source/xoutdev/xtabhtch.cxx
@@ -0,0 +1,374 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#ifndef SVX_LIGHT
+
+#include <com/sun/star/container/XNameContainer.hpp>
+#include "svx/XPropertyTable.hxx"
+#include <unotools/ucbstreamhelper.hxx>
+#include <vcl/svapp.hxx>
+
+#include "xmlxtexp.hxx"
+#include "xmlxtimp.hxx"
+
+#endif
+
+#include <tools/urlobj.hxx>
+#include <vcl/virdev.hxx>
+#include <svl/itemset.hxx>
+#include <sfx2/docfile.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <svx/xtable.hxx>
+#include <svx/xpool.hxx>
+#include "svx/dlgutil.hxx"
+#include <svx/xflhtit.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xfillit0.hxx>
+
+#include <svx/svdorect.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <svx/xlnclit.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+
+sal_Unicode const pszExtHatch[] = {'s','o','h'};
+
+char const aChckHatch[] = { 0x04, 0x00, 'S','O','H','L'}; // < 5.2
+char const aChckHatch0[] = { 0x04, 0x00, 'S','O','H','0'}; // = 5.2
+char const aChckXML[] = { '<', '?', 'x', 'm', 'l' }; // = 6.0
+
+// ------------------
+// class XHatchTable
+// ------------------
+
+/*************************************************************************
+|*
+|* XHatchTable::XHatchTable()
+|*
+*************************************************************************/
+
+XHatchTable::XHatchTable( const String& rPath,
+ XOutdevItemPool* pInPool,
+ sal_uInt16 nInitSize, sal_uInt16 nReSize ) :
+ XPropertyTable( rPath, pInPool, nInitSize, nReSize)
+{
+ pBmpTable = new Table( nInitSize, nReSize );
+}
+
+/************************************************************************/
+
+XHatchTable::~XHatchTable()
+{
+}
+
+/************************************************************************/
+
+XHatchEntry* XHatchTable::Replace(long nIndex, XHatchEntry* pEntry )
+{
+ return (XHatchEntry*) XPropertyTable::Replace(nIndex, pEntry);
+}
+
+/************************************************************************/
+
+XHatchEntry* XHatchTable::Remove(long nIndex)
+{
+ return (XHatchEntry*) XPropertyTable::Remove(nIndex, 0);
+}
+
+/************************************************************************/
+
+XHatchEntry* XHatchTable::GetHatch(long nIndex) const
+{
+ return (XHatchEntry*) XPropertyTable::Get(nIndex, 0);
+}
+
+/************************************************************************/
+
+sal_Bool XHatchTable::Load()
+{
+ return( sal_False );
+}
+
+/************************************************************************/
+
+sal_Bool XHatchTable::Save()
+{
+ return( sal_False );
+}
+
+/************************************************************************/
+
+sal_Bool XHatchTable::Create()
+{
+ return( sal_False );
+}
+
+/************************************************************************/
+
+sal_Bool XHatchTable::CreateBitmapsForUI()
+{
+ return( sal_False );
+}
+
+/************************************************************************/
+
+Bitmap* XHatchTable::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/)
+{
+ return( NULL );
+}
+
+// -----------------
+// class XHatchList
+// -----------------
+
+class impXHatchList
+{
+private:
+ VirtualDevice* mpVirtualDevice;
+ SdrModel* mpSdrModel;
+ SdrObject* mpBackgroundObject;
+ SdrObject* mpHatchObject;
+
+public:
+ impXHatchList(VirtualDevice* pV, SdrModel* pM, SdrObject* pB, SdrObject* pH)
+ : mpVirtualDevice(pV),
+ mpSdrModel(pM),
+ mpBackgroundObject(pB),
+ mpHatchObject(pH)
+ {}
+
+ ~impXHatchList()
+ {
+ delete mpVirtualDevice;
+ SdrObject::Free(mpBackgroundObject);
+ SdrObject::Free(mpHatchObject);
+ delete mpSdrModel;
+ }
+
+ VirtualDevice* getVirtualDevice() const { return mpVirtualDevice; }
+ SdrObject* getBackgroundObject() const { return mpBackgroundObject; }
+ SdrObject* getHatchObject() const { return mpHatchObject; }
+};
+
+void XHatchList::impCreate()
+{
+ if(!mpData)
+ {
+ const Point aZero(0, 0);
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+
+ VirtualDevice* pVirDev = new VirtualDevice;
+ OSL_ENSURE(0 != pVirDev, "XDashList: no VirtualDevice created!" );
+ pVirDev->SetMapMode(MAP_100TH_MM);
+ const Size aSize(pVirDev->PixelToLogic(Size(BITMAP_WIDTH, BITMAP_HEIGHT)));
+ pVirDev->SetOutputSize(aSize);
+ pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode()
+ ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
+ : DRAWMODE_DEFAULT);
+
+ SdrModel* pSdrModel = new SdrModel();
+ OSL_ENSURE(0 != pSdrModel, "XDashList: no SdrModel created!" );
+ pSdrModel->GetItemPool().FreezeIdRanges();
+
+ const Size aSinglePixel(pVirDev->PixelToLogic(Size(1, 1)));
+ const Rectangle aBackgroundSize(aZero, Size(aSize.getWidth() - aSinglePixel.getWidth(), aSize.getHeight() - aSinglePixel.getHeight()));
+ SdrObject* pBackgroundObject = new SdrRectObj(aBackgroundSize);
+ OSL_ENSURE(0 != pBackgroundObject, "XDashList: no BackgroundObject created!" );
+ pBackgroundObject->SetModel(pSdrModel);
+ pBackgroundObject->SetMergedItem(XFillStyleItem(XFILL_SOLID));
+ pBackgroundObject->SetMergedItem(XFillColorItem(String(), rStyleSettings.GetFieldColor()));
+ pBackgroundObject->SetMergedItem(XLineStyleItem(XLINE_SOLID));
+ pBackgroundObject->SetMergedItem(XLineColorItem(String(), Color(COL_BLACK)));
+
+ SdrObject* pHatchObject = new SdrRectObj(aBackgroundSize);
+ OSL_ENSURE(0 != pHatchObject, "XDashList: no HatchObject created!" );
+ pHatchObject->SetModel(pSdrModel);
+ pHatchObject->SetMergedItem(XFillStyleItem(XFILL_HATCH));
+ pHatchObject->SetMergedItem(XLineStyleItem(XLINE_NONE));
+
+ mpData = new impXHatchList(pVirDev, pSdrModel, pBackgroundObject, pHatchObject);
+ OSL_ENSURE(0 != mpData, "XDashList: data creation went wrong!" );
+ }
+}
+
+void XHatchList::impDestroy()
+{
+ if(mpData)
+ {
+ delete mpData;
+ mpData = 0;
+ }
+}
+
+XHatchList::XHatchList(const String& rPath, XOutdevItemPool* pInPool, sal_uInt16 nInitSize, sal_uInt16 nReSize)
+: XPropertyList(rPath, pInPool, nInitSize, nReSize),
+ mpData(0)
+{
+ pBmpList = new List(nInitSize, nReSize);
+}
+
+XHatchList::~XHatchList()
+{
+ if(mpData)
+ {
+ delete mpData;
+ mpData = 0;
+ }
+}
+
+XHatchEntry* XHatchList::Replace(XHatchEntry* pEntry, long nIndex )
+{
+ return (XHatchEntry*) XPropertyList::Replace(pEntry, nIndex);
+}
+
+XHatchEntry* XHatchList::Remove(long nIndex)
+{
+ return (XHatchEntry*) XPropertyList::Remove(nIndex, 0);
+}
+
+XHatchEntry* XHatchList::GetHatch(long nIndex) const
+{
+ return (XHatchEntry*) XPropertyList::Get(nIndex, 0);
+}
+
+sal_Bool XHatchList::Load()
+{
+ if( bListDirty )
+ {
+ bListDirty = sal_False;
+
+ INetURLObject aURL( aPath );
+
+ if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
+ {
+ DBG_ASSERT( !aPath.Len(), "invalid URL" );
+ return sal_False;
+ }
+
+ aURL.Append( aName );
+
+ if( !aURL.getExtension().getLength() )
+ aURL.setExtension( rtl::OUString( pszExtHatch, 3 ) );
+
+ uno::Reference< container::XNameContainer > xTable( SvxUnoXHatchTable_createInstance( this ), uno::UNO_QUERY );
+ return SvxXMLXTableImport::load( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable );
+ }
+ return( sal_False );
+}
+
+sal_Bool XHatchList::Save()
+{
+ INetURLObject aURL( aPath );
+
+ if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
+ {
+ DBG_ASSERT( !aPath.Len(), "invalid URL" );
+ return sal_False;
+ }
+
+ aURL.Append( aName );
+
+ if( !aURL.getExtension().getLength() )
+ aURL.setExtension( rtl::OUString( pszExtHatch, 3 ) );
+
+ uno::Reference< container::XNameContainer > xTable( SvxUnoXHatchTable_createInstance( this ), uno::UNO_QUERY );
+ return SvxXMLXTableExportComponent::save( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable );
+}
+
+sal_Bool XHatchList::Create()
+{
+ XubString aStr( SVX_RES( RID_SVXSTR_HATCH ) );
+ xub_StrLen nLen;
+
+ aStr.AppendAscii(" 1");
+ nLen = aStr.Len() - 1;
+ Insert(new XHatchEntry(XHatch(RGB_Color(COL_BLACK),XHATCH_SINGLE,100, 0),aStr));
+ aStr.SetChar(nLen, sal_Unicode('2'));
+ Insert(new XHatchEntry(XHatch(RGB_Color(COL_RED ),XHATCH_DOUBLE, 80,450),aStr));
+ aStr.SetChar(nLen, sal_Unicode('3'));
+ Insert(new XHatchEntry(XHatch(RGB_Color(COL_BLUE ),XHATCH_TRIPLE,120, 0),aStr));
+
+ return( sal_True );
+}
+
+sal_Bool XHatchList::CreateBitmapsForUI()
+{
+ impCreate();
+
+ for( long i = 0; i < Count(); i++)
+ {
+ Bitmap* pBmp = CreateBitmapForUI( i, sal_False );
+ DBG_ASSERT( pBmp, "XHatchList: Bitmap(UI) konnte nicht erzeugt werden!" );
+
+ if( pBmp )
+ pBmpList->Insert( pBmp, i );
+ }
+
+ impDestroy();
+
+ return( sal_True );
+}
+
+Bitmap* XHatchList::CreateBitmapForUI( long nIndex, sal_Bool bDelete )
+{
+ impCreate();
+ VirtualDevice* pVD = mpData->getVirtualDevice();
+ SdrObject* pHatchObject = mpData->getHatchObject();
+
+ pHatchObject->SetMergedItem(XFillStyleItem(XFILL_HATCH));
+ pHatchObject->SetMergedItem(XFillHatchItem(String(), GetHatch(nIndex)->GetHatch()));
+
+ sdr::contact::SdrObjectVector aObjectVector;
+ aObjectVector.push_back(mpData->getBackgroundObject());
+ aObjectVector.push_back(pHatchObject);
+ sdr::contact::ObjectContactOfObjListPainter aPainter(*pVD, aObjectVector, 0);
+ sdr::contact::DisplayInfo aDisplayInfo;
+
+ aPainter.ProcessDisplay(aDisplayInfo);
+
+ const Point aZero(0, 0);
+ Bitmap* pBitmap = new Bitmap(pVD->GetBitmap(aZero, pVD->GetOutputSize()));
+
+ if(bDelete)
+ {
+ impDestroy();
+ }
+
+ return pBitmap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/xoutdev/xtable.cxx b/svx/source/xoutdev/xtable.cxx
new file mode 100644
index 000000000000..e0e0a1c7aa69
--- /dev/null
+++ b/svx/source/xoutdev/xtable.cxx
@@ -0,0 +1,511 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/xtable.hxx>
+#include <svx/xpool.hxx>
+
+#define GLOBALOVERFLOW
+
+// Vergleichsstrings
+sal_Unicode __FAR_DATA pszStandard[] = { 's', 't', 'a', 'n', 'd', 'a', 'r', 'd', 0 };
+
+// Konvertiert in echte RGB-Farben, damit in den Listboxen
+// endlich mal richtig selektiert werden kann.
+Color RGB_Color( ColorData nColorName )
+{
+ Color aColor( nColorName );
+ Color aRGBColor( aColor.GetRed(), aColor.GetGreen(), aColor.GetBlue() );
+ return aRGBColor;
+}
+
+// ---------------------
+// class XPropertyTable
+// ---------------------
+
+/*************************************************************************
+|*
+|* XPropertyTable::XPropertyTable()
+|*
+*************************************************************************/
+
+XPropertyTable::XPropertyTable( const String& rPath,
+ XOutdevItemPool* pInPool,
+ sal_uInt16 nInitSize, sal_uInt16 nReSize ) :
+ aName ( pszStandard, 8 ),
+ aPath ( rPath ),
+ pXPool ( pInPool ),
+ aTable ( nInitSize, nReSize ),
+ pBmpTable ( NULL ),
+ bTableDirty ( sal_True ),
+ bBitmapsDirty ( sal_True ),
+ bOwnPool ( sal_False )
+{
+ if( !pXPool )
+ {
+ bOwnPool = sal_True;
+ pXPool = new XOutdevItemPool;
+ DBG_ASSERT( pXPool, "XOutPool konnte nicht erzeugt werden!" );
+ }
+}
+
+/*************************************************************************
+|*
+|* XPropertyTable::XPropertyTable( SvStraem& )
+|*
+*************************************************************************/
+
+XPropertyTable::XPropertyTable( SvStream& /*rIn*/) :
+ pBmpTable ( NULL )
+{
+}
+
+/*************************************************************************
+|*
+|* XPropertyTable::~XPropertyTable()
+|*
+*************************************************************************/
+
+XPropertyTable::~XPropertyTable()
+{
+ XPropertyEntry* pEntry = (XPropertyEntry*)aTable.First();
+ Bitmap* pBitmap = NULL;
+ for (sal_uIntPtr nIndex = 0; nIndex < aTable.Count(); nIndex++)
+ {
+ delete pEntry;
+ pEntry = (XPropertyEntry*)aTable.Next();
+ }
+ // Hier wird die Bitmaptabelle geloescht
+ if( pBmpTable )
+ {
+ pBitmap = (Bitmap*) pBmpTable->First();
+
+ for( sal_uIntPtr nIndex = 0; nIndex < pBmpTable->Count(); nIndex++ )
+ {
+ delete pBitmap;
+ pBitmap = (Bitmap*) pBmpTable->Next();
+ }
+ delete pBmpTable;
+ pBmpTable = NULL;
+ }
+ // Eigener Pool wird geloescht
+ if( bOwnPool && pXPool )
+ {
+ SfxItemPool::Free(pXPool);
+ }
+}
+
+/*************************************************************************
+|*
+|* XPropertyTable::Clear()
+|*
+*************************************************************************/
+
+void XPropertyTable::Clear()
+{
+ aTable.Clear();
+ if( pBmpTable )
+ pBmpTable->Clear();
+}
+
+/************************************************************************/
+
+long XPropertyTable::Count() const
+{
+ if( bTableDirty )
+ {
+ // ( (XPropertyTable*) this )->bTableDirty = sal_False; <- im Load()
+ if( !( (XPropertyTable*) this )->Load() )
+ ( (XPropertyTable*) this )->Create();
+ }
+ return( aTable.Count() );
+}
+
+/*************************************************************************
+|*
+|* XPropertyEntry* XPropertyTable::Get()
+|*
+*************************************************************************/
+
+XPropertyEntry* XPropertyTable::Get( long nIndex, sal_uInt16 /*nDummy*/) const
+{
+ if( bTableDirty )
+ {
+ // ( (XPropertyTable*) this )->bTableDirty = sal_False; <- im Load()
+ if( !( (XPropertyTable*) this )->Load() )
+ ( (XPropertyTable*) this )->Create();
+ }
+ return (XPropertyEntry*) aTable.GetObject( (sal_uIntPtr) nIndex );
+}
+
+/*************************************************************************
+|*
+|* long XPropertyTable::Get(const String& rName)
+|*
+*************************************************************************/
+
+long XPropertyTable::Get(const XubString& rName)
+{
+ if( bTableDirty )
+ {
+ // bTableDirty = sal_False;
+ if( !Load() )
+ Create();
+ }
+ long nPos = 0;
+ XPropertyEntry* pEntry = (XPropertyEntry*)aTable.First();
+ while (pEntry && pEntry->GetName() != rName)
+ {
+ nPos++;
+ pEntry = (XPropertyEntry*)aTable.Next();
+ }
+ if (!pEntry) nPos = -1;
+ return nPos;
+}
+
+/*************************************************************************
+|*
+|* Bitmap* XPropertyTable::GetBitmap()
+|*
+*************************************************************************/
+
+Bitmap* XPropertyTable::GetBitmap( long nIndex ) const
+{
+ if( pBmpTable )
+ {
+ if( bBitmapsDirty )
+ {
+ ( (XPropertyTable*) this )->bBitmapsDirty = sal_False;
+ ( (XPropertyTable*) this )->CreateBitmapsForUI();
+ }
+
+ if( pBmpTable->Count() >= (sal_uIntPtr) nIndex )
+ return (Bitmap*) pBmpTable->GetObject( (sal_uIntPtr) nIndex );
+ }
+ return( NULL );
+}
+
+/*************************************************************************
+|*
+|* void XPropertyTable::Insert()
+|*
+*************************************************************************/
+
+sal_Bool XPropertyTable::Insert( long nIndex, XPropertyEntry* pEntry )
+{
+ sal_Bool bReturn = aTable.Insert( (sal_uIntPtr) nIndex, pEntry );
+
+ if( pBmpTable && !bBitmapsDirty )
+ {
+ Bitmap* pBmp = CreateBitmapForUI( (sal_uIntPtr) nIndex );
+ pBmpTable->Insert( (sal_uIntPtr) nIndex, pBmp );
+ }
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* void XPropertyTable::Replace()
+|*
+*************************************************************************/
+
+XPropertyEntry* XPropertyTable::Replace( long nIndex, XPropertyEntry* pEntry )
+{
+ XPropertyEntry* pOldEntry = (XPropertyEntry*) aTable.Replace( (sal_uIntPtr) nIndex, pEntry );
+
+ if( pBmpTable && !bBitmapsDirty )
+ {
+ Bitmap* pBmp = CreateBitmapForUI( (sal_uIntPtr) nIndex );
+ Bitmap* pOldBmp = (Bitmap*) pBmpTable->Replace( (sal_uIntPtr) nIndex, pBmp );
+ if( pOldBmp )
+ delete pOldBmp;
+ }
+ return pOldEntry;
+}
+
+/*************************************************************************
+|*
+|* void XPropertyTable::Remove()
+|*
+*************************************************************************/
+
+XPropertyEntry* XPropertyTable::Remove( long nIndex, sal_uInt16 /*nDummy*/)
+{
+ if( pBmpTable && !bBitmapsDirty )
+ {
+ Bitmap* pOldBmp = (Bitmap*) pBmpTable->Remove( (sal_uIntPtr) nIndex );
+ if( pOldBmp )
+ delete pOldBmp;
+ }
+ return (XPropertyEntry*) aTable.Remove((sal_uIntPtr)nIndex);
+}
+
+/************************************************************************/
+
+void XPropertyTable::SetName( const String& rString )
+{
+ if(rString.Len())
+ {
+ aName = rString;
+ }
+}
+
+// --------------------
+// class XPropertyList
+// --------------------
+
+
+/*************************************************************************
+|*
+|* XPropertyList::XPropertyList()
+|*
+*************************************************************************/
+
+XPropertyList::XPropertyList( const String& rPath,
+ XOutdevItemPool* pInPool,
+ sal_uInt16 nInitSize, sal_uInt16 nReSize ) :
+ aName ( pszStandard, 8 ),
+ aPath ( rPath ),
+ pXPool ( pInPool ),
+ aList ( nInitSize, nReSize ),
+ pBmpList ( NULL ),
+ bListDirty ( sal_True ),
+ bBitmapsDirty ( sal_True ),
+ bOwnPool ( sal_False )
+{
+ if( !pXPool )
+ {
+ bOwnPool = sal_True;
+ pXPool = new XOutdevItemPool;
+ DBG_ASSERT( pXPool, "XOutPool konnte nicht erzeugt werden!" );
+ }
+}
+
+/*************************************************************************
+|*
+|* XPropertyList::XPropertyList( SvStraem& )
+|*
+*************************************************************************/
+
+XPropertyList::XPropertyList( SvStream& /*rIn*/) :
+ pBmpList ( NULL )
+{
+}
+
+/*************************************************************************
+|*
+|* XPropertyList::~XPropertyList()
+|*
+*************************************************************************/
+
+XPropertyList::~XPropertyList()
+{
+ XPropertyEntry* pEntry = (XPropertyEntry*)aList.First();
+ Bitmap* pBitmap = NULL;
+ for( sal_uIntPtr nIndex = 0; nIndex < aList.Count(); nIndex++ )
+ {
+ delete pEntry;
+ pEntry = (XPropertyEntry*)aList.Next();
+ }
+
+ if( pBmpList )
+ {
+ pBitmap = (Bitmap*) pBmpList->First();
+
+ for( sal_uIntPtr nIndex = 0; nIndex < pBmpList->Count(); nIndex++ )
+ {
+ delete pBitmap;
+ pBitmap = (Bitmap*) pBmpList->Next();
+ }
+ delete pBmpList;
+ pBmpList = NULL;
+ }
+
+ if( bOwnPool && pXPool )
+ {
+ SfxItemPool::Free(pXPool);
+ }
+}
+
+/*************************************************************************
+|*
+|* XPropertyList::Clear()
+|*
+*************************************************************************/
+
+void XPropertyList::Clear()
+{
+ aList.Clear();
+ if( pBmpList )
+ pBmpList->Clear();
+}
+
+/************************************************************************/
+
+long XPropertyList::Count() const
+{
+ if( bListDirty )
+ {
+ // ( (XPropertyList*) this )->bListDirty = sal_False; <- im Load()
+ if( !( (XPropertyList*) this )->Load() )
+ ( (XPropertyList*) this )->Create();
+ }
+ return( aList.Count() );
+}
+
+/*************************************************************************
+|*
+|* XPropertyEntry* XPropertyList::Get()
+|*
+*************************************************************************/
+
+XPropertyEntry* XPropertyList::Get( long nIndex, sal_uInt16 /*nDummy*/) const
+{
+ if( bListDirty )
+ {
+ // ( (XPropertyList*) this )->bListDirty = sal_False; <- im Load()
+ if( !( (XPropertyList*) this )->Load() )
+ ( (XPropertyList*) this )->Create();
+ }
+ return (XPropertyEntry*) aList.GetObject( (sal_uIntPtr) nIndex );
+}
+
+/*************************************************************************
+|*
+|* XPropertyList::Get()
+|*
+*************************************************************************/
+
+long XPropertyList::Get(const XubString& rName)
+{
+ if( bListDirty )
+ {
+ //bListDirty = sal_False;
+ if( !Load() )
+ Create();
+ }
+ long nPos = 0;
+ XPropertyEntry* pEntry = (XPropertyEntry*)aList.First();
+ while (pEntry && pEntry->GetName() != rName)
+ {
+ nPos++;
+ pEntry = (XPropertyEntry*)aList.Next();
+ }
+ if (!pEntry) nPos = -1;
+ return nPos;
+}
+
+/*************************************************************************
+|*
+|* Bitmap* XPropertyList::GetBitmap()
+|*
+*************************************************************************/
+
+Bitmap* XPropertyList::GetBitmap( long nIndex ) const
+{
+ if( pBmpList )
+ {
+ if( bBitmapsDirty )
+ {
+ ( (XPropertyList*) this )->bBitmapsDirty = sal_False;
+ ( (XPropertyList*) this )->CreateBitmapsForUI();
+ }
+ if( pBmpList->Count() >= (sal_uIntPtr) nIndex )
+ return (Bitmap*) pBmpList->GetObject( (sal_uIntPtr) nIndex );
+ }
+ return( NULL );
+}
+
+/*************************************************************************
+|*
+|* void XPropertyList::Insert()
+|*
+*************************************************************************/
+
+void XPropertyList::Insert( XPropertyEntry* pEntry, long nIndex )
+{
+ aList.Insert( pEntry, (sal_uIntPtr) nIndex );
+
+ if( pBmpList && !bBitmapsDirty )
+ {
+ Bitmap* pBmp = CreateBitmapForUI(
+ (sal_uIntPtr) nIndex < aList.Count() ? nIndex : aList.Count() - 1 );
+ pBmpList->Insert( pBmp, (sal_uIntPtr) nIndex );
+ }
+}
+
+/*************************************************************************
+|*
+|* void XPropertyList::Replace()
+|*
+*************************************************************************/
+
+XPropertyEntry* XPropertyList::Replace( XPropertyEntry* pEntry, long nIndex )
+{
+ XPropertyEntry* pOldEntry = (XPropertyEntry*) aList.Replace( pEntry, (sal_uIntPtr) nIndex );
+
+ if( pBmpList && !bBitmapsDirty )
+ {
+ Bitmap* pBmp = CreateBitmapForUI( (sal_uIntPtr) nIndex );
+ Bitmap* pOldBmp = (Bitmap*) pBmpList->Replace( pBmp, (sal_uIntPtr) nIndex );
+ if( pOldBmp )
+ delete pOldBmp;
+ }
+ return pOldEntry;
+}
+
+/*************************************************************************
+|*
+|* void XPropertyList::Remove()
+|*
+*************************************************************************/
+
+XPropertyEntry* XPropertyList::Remove( long nIndex, sal_uInt16 /*nDummy*/)
+{
+ if( pBmpList && !bBitmapsDirty )
+ {
+ Bitmap* pOldBmp = (Bitmap*) pBmpList->Remove( (sal_uIntPtr) nIndex );
+ if( pOldBmp )
+ delete pOldBmp;
+ }
+ return (XPropertyEntry*) aList.Remove( (sal_uIntPtr) nIndex );
+}
+
+/************************************************************************/
+
+void XPropertyList::SetName( const String& rString )
+{
+ if(rString.Len())
+ {
+ aName = rString;
+ }
+}
+
+
+
diff --git a/svx/source/xoutdev/xtablend.cxx b/svx/source/xoutdev/xtablend.cxx
new file mode 100644
index 000000000000..4a984b2a5bfb
--- /dev/null
+++ b/svx/source/xoutdev/xtablend.cxx
@@ -0,0 +1,395 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#ifndef SVX_LIGHT
+
+#include <com/sun/star/container/XNameContainer.hpp>
+#include "svx/XPropertyTable.hxx"
+#include <unotools/ucbstreamhelper.hxx>
+
+#include "xmlxtexp.hxx"
+#include "xmlxtimp.hxx"
+
+#endif
+#include <tools/urlobj.hxx>
+#include <vcl/virdev.hxx>
+
+#ifndef _SV_APP_HXX
+#include <vcl/svapp.hxx>
+#endif
+#include <svl/itemset.hxx>
+#include <sfx2/docfile.hxx>
+
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+
+#include <svx/xtable.hxx>
+#include <svx/xpool.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xlnstwit.hxx>
+#include <svx/xlnedwit.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/xlnedit.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+
+#include <svx/svdorect.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+
+#define GLOBALOVERFLOW
+
+using namespace com::sun::star;
+using namespace rtl;
+
+sal_Unicode const pszExtLineEnd[] = {'s','o','e'};
+
+static char const aChckLEnd[] = { 0x04, 0x00, 'S','O','E','L'}; // < 5.2
+static char const aChckLEnd0[] = { 0x04, 0x00, 'S','O','E','0'}; // = 5.2
+static char const aChckXML[] = { '<', '?', 'x', 'm', 'l' }; // = 6.0
+
+// --------------------
+// class XLineEndTable
+// --------------------
+
+/*************************************************************************
+|*
+|* XLineEndTable::XLineEndTable()
+|*
+*************************************************************************/
+
+XLineEndTable::XLineEndTable( const String& rPath,
+ XOutdevItemPool* pInPool,
+ sal_uInt16 nInitSize, sal_uInt16 nReSize ) :
+ XPropertyTable( rPath, pInPool, nInitSize, nReSize)
+{
+ pBmpTable = new Table( nInitSize, nReSize );
+}
+
+/************************************************************************/
+
+XLineEndTable::~XLineEndTable()
+{
+}
+
+/************************************************************************/
+
+XLineEndEntry* XLineEndTable::Replace(long nIndex, XLineEndEntry* pEntry )
+{
+ return (XLineEndEntry*) XPropertyTable::Replace(nIndex, pEntry);
+}
+
+/************************************************************************/
+
+XLineEndEntry* XLineEndTable::Remove(long nIndex)
+{
+ return (XLineEndEntry*) XPropertyTable::Remove(nIndex, 0);
+}
+
+/************************************************************************/
+
+XLineEndEntry* XLineEndTable::GetLineEnd(long nIndex) const
+{
+ return (XLineEndEntry*) XPropertyTable::Get(nIndex, 0);
+}
+
+/************************************************************************/
+
+sal_Bool XLineEndTable::Load()
+{
+ return( sal_False );
+}
+
+/************************************************************************/
+
+sal_Bool XLineEndTable::Save()
+{
+ return( sal_False );
+}
+
+/************************************************************************/
+
+sal_Bool XLineEndTable::Create()
+{
+ return( sal_False );
+}
+
+/************************************************************************/
+
+Bitmap* XLineEndTable::CreateBitmapForUI( long /*nIndex*/, sal_Bool /*bDelete*/)
+{
+ return( NULL );
+}
+
+/************************************************************************/
+
+sal_Bool XLineEndTable::CreateBitmapsForUI()
+{
+ return( sal_False );
+}
+
+// --------------------
+// class XLineEndList
+// --------------------
+
+class impXLineEndList
+{
+private:
+ VirtualDevice* mpVirtualDevice;
+ SdrModel* mpSdrModel;
+ SdrObject* mpBackgroundObject;
+ SdrObject* mpLineObject;
+
+public:
+ impXLineEndList(VirtualDevice* pV, SdrModel* pM, SdrObject* pB, SdrObject* pL)
+ : mpVirtualDevice(pV),
+ mpSdrModel(pM),
+ mpBackgroundObject(pB),
+ mpLineObject(pL)
+ {}
+
+ ~impXLineEndList()
+ {
+ delete mpVirtualDevice;
+ SdrObject::Free(mpBackgroundObject);
+ SdrObject::Free(mpLineObject);
+ delete mpSdrModel;
+ }
+
+ VirtualDevice* getVirtualDevice() const { return mpVirtualDevice; }
+ SdrObject* getBackgroundObject() const { return mpBackgroundObject; }
+ SdrObject* getLineObject() const { return mpLineObject; }
+};
+
+void XLineEndList::impCreate()
+{
+ if(!mpData)
+ {
+ const Point aZero(0, 0);
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+
+ VirtualDevice* pVirDev = new VirtualDevice;
+ OSL_ENSURE(0 != pVirDev, "XLineEndList: no VirtualDevice created!" );
+ pVirDev->SetMapMode(MAP_100TH_MM);
+ const Size aSize(pVirDev->PixelToLogic(Size(BITMAP_WIDTH * 2, BITMAP_HEIGHT)));
+ pVirDev->SetOutputSize(aSize);
+ pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode()
+ ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
+ : DRAWMODE_DEFAULT);
+
+ SdrModel* pSdrModel = new SdrModel();
+ OSL_ENSURE(0 != pSdrModel, "XLineEndList: no SdrModel created!" );
+ pSdrModel->GetItemPool().FreezeIdRanges();
+
+ const Rectangle aBackgroundSize(aZero, aSize);
+ SdrObject* pBackgroundObject = new SdrRectObj(aBackgroundSize);
+ OSL_ENSURE(0 != pBackgroundObject, "XLineEndList: no BackgroundObject created!" );
+ pBackgroundObject->SetModel(pSdrModel);
+ pBackgroundObject->SetMergedItem(XFillStyleItem(XFILL_SOLID));
+ pBackgroundObject->SetMergedItem(XLineStyleItem(XLINE_NONE));
+ pBackgroundObject->SetMergedItem(XFillColorItem(String(), rStyleSettings.GetFieldColor()));
+
+ const basegfx::B2DPoint aStart(0, aSize.Height() / 2);
+ const basegfx::B2DPoint aEnd(aSize.Width(), aSize.Height() / 2);
+ basegfx::B2DPolygon aPolygon;
+ aPolygon.append(aStart);
+ aPolygon.append(aEnd);
+ SdrObject* pLineObject = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPolygon));
+ OSL_ENSURE(0 != pLineObject, "XLineEndList: no LineObject created!" );
+ pLineObject->SetModel(pSdrModel);
+ pLineObject->SetMergedItem(XLineStartWidthItem(aSize.Height()));
+ pLineObject->SetMergedItem(XLineEndWidthItem(aSize.Height()));
+ pLineObject->SetMergedItem(XLineColorItem(String(), rStyleSettings.GetFieldTextColor()));
+
+ mpData = new impXLineEndList(pVirDev, pSdrModel, pBackgroundObject, pLineObject);
+ OSL_ENSURE(0 != mpData, "XLineEndList: data creation went wrong!" );
+ }
+}
+
+void XLineEndList::impDestroy()
+{
+ if(mpData)
+ {
+ delete mpData;
+ mpData = 0;
+ }
+}
+
+XLineEndList::XLineEndList(const String& rPath, XOutdevItemPool* _pXPool, sal_uInt16 nInitSize, sal_uInt16 nReSize)
+: XPropertyList(rPath, _pXPool, nInitSize, nReSize),
+ mpData(0)
+{
+ pBmpList = new List(nInitSize, nReSize);
+}
+
+XLineEndList::~XLineEndList()
+{
+ impDestroy();
+}
+
+XLineEndEntry* XLineEndList::Replace(XLineEndEntry* pEntry, long nIndex )
+{
+ return (XLineEndEntry*) XPropertyList::Replace(pEntry, nIndex);
+}
+
+XLineEndEntry* XLineEndList::Remove(long nIndex)
+{
+ return (XLineEndEntry*) XPropertyList::Remove(nIndex, 0);
+}
+
+XLineEndEntry* XLineEndList::GetLineEnd(long nIndex) const
+{
+ return (XLineEndEntry*) XPropertyList::Get(nIndex, 0);
+}
+
+sal_Bool XLineEndList::Load()
+{
+ if( bListDirty )
+ {
+ bListDirty = sal_False;
+
+ INetURLObject aURL( aPath );
+
+ if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
+ {
+ DBG_ASSERT( !aPath.Len(), "invalid URL" );
+ return sal_False;
+ }
+
+ aURL.Append( aName );
+
+ if( !aURL.getExtension().getLength() )
+ aURL.setExtension( rtl::OUString( pszExtLineEnd, 3 ) );
+
+ uno::Reference< container::XNameContainer > xTable( SvxUnoXLineEndTable_createInstance( this ), uno::UNO_QUERY );
+ return SvxXMLXTableImport::load( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable );
+ }
+ return( sal_False );
+}
+
+sal_Bool XLineEndList::Save()
+{
+ INetURLObject aURL( aPath );
+
+ if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
+ {
+ DBG_ASSERT( !aPath.Len(), "invalid URL" );
+ return sal_False;
+ }
+
+ aURL.Append( aName );
+
+ if( !aURL.getExtension().getLength() )
+ aURL.setExtension( rtl::OUString( pszExtLineEnd, 3 ) );
+
+ uno::Reference< container::XNameContainer > xTable( SvxUnoXLineEndTable_createInstance( this ), uno::UNO_QUERY );
+ return SvxXMLXTableExportComponent::save( aURL.GetMainURL( INetURLObject::NO_DECODE ), xTable );
+}
+
+sal_Bool XLineEndList::Create()
+{
+ basegfx::B2DPolygon aTriangle;
+ aTriangle.append(basegfx::B2DPoint(10.0, 0.0));
+ aTriangle.append(basegfx::B2DPoint(0.0, 30.0));
+ aTriangle.append(basegfx::B2DPoint(20.0, 30.0));
+ aTriangle.setClosed(true);
+ Insert( new XLineEndEntry( basegfx::B2DPolyPolygon(aTriangle), SVX_RESSTR( RID_SVXSTR_ARROW ) ) );
+
+ basegfx::B2DPolygon aSquare;
+ aSquare.append(basegfx::B2DPoint(0.0, 0.0));
+ aSquare.append(basegfx::B2DPoint(10.0, 0.0));
+ aSquare.append(basegfx::B2DPoint(10.0, 10.0));
+ aSquare.append(basegfx::B2DPoint(0.0, 10.0));
+ aSquare.setClosed(true);
+ Insert( new XLineEndEntry( basegfx::B2DPolyPolygon(aSquare), SVX_RESSTR( RID_SVXSTR_SQUARE ) ) );
+
+ basegfx::B2DPolygon aCircle(basegfx::tools::createPolygonFromCircle(basegfx::B2DPoint(0.0, 0.0), 100.0));
+ Insert( new XLineEndEntry( basegfx::B2DPolyPolygon(aCircle), SVX_RESSTR( RID_SVXSTR_CIRCLE ) ) );
+
+ return( sal_True );
+}
+
+sal_Bool XLineEndList::CreateBitmapsForUI()
+{
+ impCreate();
+
+ for( long i = 0; i < Count(); i++)
+ {
+ Bitmap* pBmp = CreateBitmapForUI( i, sal_False );
+ OSL_ENSURE(0 != pBmp, "XLineEndList: Bitmap(UI) could not be created!" );
+
+ if( pBmp )
+ pBmpList->Insert( pBmp, i );
+ }
+
+ impDestroy();
+
+ return( sal_True );
+}
+
+Bitmap* XLineEndList::CreateBitmapForUI( long nIndex, sal_Bool bDelete )
+{
+ impCreate();
+ VirtualDevice* pVD = mpData->getVirtualDevice();
+ SdrObject* pLine = mpData->getLineObject();
+
+ pLine->SetMergedItem(XLineStyleItem(XLINE_SOLID));
+ pLine->SetMergedItem(XLineStartItem(String(), GetLineEnd(nIndex)->GetLineEnd()));
+ pLine->SetMergedItem(XLineEndItem(String(), GetLineEnd(nIndex)->GetLineEnd()));
+
+ sdr::contact::SdrObjectVector aObjectVector;
+ aObjectVector.push_back(mpData->getBackgroundObject());
+ aObjectVector.push_back(pLine);
+ sdr::contact::ObjectContactOfObjListPainter aPainter(*pVD, aObjectVector, 0);
+ sdr::contact::DisplayInfo aDisplayInfo;
+
+ aPainter.ProcessDisplay(aDisplayInfo);
+
+ const Point aZero(0, 0);
+ Bitmap* pBitmap = new Bitmap(pVD->GetBitmap(aZero, pVD->GetOutputSize()));
+
+ if(bDelete)
+ {
+ impDestroy();
+ }
+
+ return pBitmap;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/uiconfig/layout/delzip b/svx/uiconfig/layout/delzip
new file mode 100644
index 000000000000..7b4d68d70fca
--- /dev/null
+++ b/svx/uiconfig/layout/delzip
@@ -0,0 +1 @@
+empty \ No newline at end of file
diff --git a/svx/uiconfig/layout/layout.mk b/svx/uiconfig/layout/layout.mk
new file mode 100644
index 000000000000..f6bea876d898
--- /dev/null
+++ b/svx/uiconfig/layout/layout.mk
@@ -0,0 +1,33 @@
+# TODO: move to solenv/inc
+# copies: sw/uiconfig/layout svx/uiconfig/layout
+
+TRALAY=tralay
+XML_DEST=$(DLLDEST)
+XML_LANGS=$(alllangiso)
+
+ALL_XMLS=$(foreach,i,$(XML_FILES) $(XML_DEST)/$i) $(foreach,i,$(XML_LANGS) $(foreach,j,$(XML_FILES) $(XML_DEST)/$i/$j))
+
+# Must remove the -j (no duplicate base file names) flag
+ZIPUPDATE=-u
+XML_ZIP = $(PRJNAME)-layout
+
+ALLTAR: $(XML_ZIP)
+
+$(XML_ZIP): $(ALL_XMLS)
+
+ZIP1DIR=$(XML_DEST)
+ZIP1TARGET=$(XML_ZIP)
+ZIP1LIST=$(ALL_XMLS:s@$(XML_DEST)/@@)
+
+$(foreach,i,$(XML_LANGS) $(XML_DEST)/$i/%.xml): %.xml
+ -$(MKDIR) $(@:d)
+ @echo $(foreach,i,$(XML_LANGS) $(XML_DEST)/$i/%.xml): %.xml
+ $(TRALAY) -m localize.sdf -o $(XML_DEST) -l $(XML_LANGS:f:t" -l ") $<
+
+$(XML_DEST)/%.xml: %.xml
+ -$(MKDIR) $(@:d)
+ $(COPY) $< $@
+
+# Don't want to overwrite filled localize.sdf with empty template
+template.sdf:
+ $(foreach,i,$(XML_FILES) $(TRALAY) -l en-US $i) > $@
diff --git a/svx/uiconfig/layout/makefile.mk b/svx/uiconfig/layout/makefile.mk
new file mode 100644
index 000000000000..e75ae5e8d255
--- /dev/null
+++ b/svx/uiconfig/layout/makefile.mk
@@ -0,0 +1,46 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=../..
+PRJNAME=svx
+TARGET=layout
+
+.INCLUDE : settings.mk
+
+.IF "$(ENABLE_LAYOUT)" == "TRUE"
+
+all: ALLTAR
+
+XML_FILES=zoom.xml
+
+.INCLUDE : layout.mk
+
+.ELSE # ENABLE_LAYOUT != TRUE
+all .PHONY:
+.ENDIF # ENABLE_LAYOUT != TRUE
+
+.INCLUDE : target.mk
diff --git a/svx/uiconfig/layout/zoom.xml b/svx/uiconfig/layout/zoom.xml
new file mode 100644
index 000000000000..78e30ee11dfd
--- /dev/null
+++ b/svx/uiconfig/layout/zoom.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated xml files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="RID_SVXDLG_ZOOM" _title="Zoom &amp; View Layout" optimumsize="true"
+ help-id="SID_ATTR_ZOOM"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox spacing="5" border="5">
+ <hbox spacing="0" border="0">
+ <vbox spacing="5" border="5">
+ <fixedline id="FL_ZOOM" _text="Zoom factor" cnt:expand="true"/>
+ <radiobutton radiogroup="zoom" id="BTN_OPTIMAL" _label="Optimal"/>
+ <radiobutton radiogroup="zoom" id="BTN_WHOLE_PAGE" _label="Whole Page"/>
+ <radiobutton radiogroup="zoom" id="BTN_PAGE_WIDTH" _label="Page Width"/>
+ <radiobutton radiogroup="zoom" id="BTN_100" _label="100 %"/>
+ <hbox cnt:expand="false" cnt:fill="true">
+ <align cnt:expand="false" cnt:fill="true">
+ <radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom" id="BTN_USER" _label="Variable"/>
+ </align>
+ <flow cnt:padding="10" cnt:expand="false"/>
+ <metricfield id="ED_USER" value-step="1"
+ repeat="true" has_border="true" spin="true"
+ _text="100%" unit="11" custom-unit-text="%"
+ right="true"
+ cnt:expand="false"/>
+ </hbox>
+ </vbox>
+ <vbox spacing="5" border="5">
+ <fixedline id="FL_VIEWLAYOUT" _text="View layout" cnt:expand="true"/>
+ <radiobutton radiogroup="zoom" id="BTN_AUTOMATIC" _label="~Automatic"/>
+ <radiobutton radiogroup="zoom" id="BTN_SINGLE" _label="~Single page"/>
+ <hbox cnt:expand="false" cnt:fill="true">
+ <align cnt:expand="false" cnt:fill="true">
+ <radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom" id="BTN_COLUMNS" _label="~Columns"/>
+ </align>
+ <flow cnt:padding="10" cnt:expand="false"/>
+ <metricfield id="ED_COLUMNS" value-step="1"
+ repeat="true" has_border="true" spin="true"
+ _text="100%"
+ right="true"
+ spin-value-min="1"
+ spin-value="1"
+ cnt:expand="false"/>
+ </hbox>
+ <hbox><flow cnt:expand="false" cnt:padding="10"/><checkbox id="CHK_BOOK" _label="~Book mode"/></hbox>
+ </vbox>
+ </hbox>
+ <fixedline cnt:padding="1" id="FL_BOTTOM"/>
+ <dialogbuttonhbox border="5" spacing="5">
+ <flow/>
+ <okbutton id="BTN_ZOOM_OK"/>
+ <cancelbutton id="BTN_ZOOM_CANCEL"/>
+ <helpbutton id="BTN_ZOOM_HELP"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/svx/util/gal.dxp b/svx/util/gal.dxp
new file mode 100644
index 000000000000..e8f2e0a94819
--- /dev/null
+++ b/svx/util/gal.dxp
@@ -0,0 +1,20 @@
+CreateLoader
+Gallery_GetPath
+Gallery_GetPathAsString
+Gallery_GetFilterName
+Gallery_GetGraphic
+Gallery_GetVCDrawModel
+Gallery_IsLinkage
+Gallery_FillThemeList
+Gallery_FillObjList
+Gallery_InsertURL
+Gallery_GetObjCount
+Gallery_GetGraphicObj
+Gallery_InsertGraphicObj
+Gallery_GetSdrObjCount
+Gallery_GetSdrObj
+Gallery_InsertSdrObj
+Gallery_GetThemeNameFromId
+Gallery_BeginLocking
+Gallery_EndLocking
+component_getFactory
diff --git a/svx/util/hidother.hrc b/svx/util/hidother.hrc
new file mode 100644
index 000000000000..68bb57a274b3
--- /dev/null
+++ b/svx/util/hidother.hrc
@@ -0,0 +1,27 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define HID_INTERFACE_BASIDE_VIEWSH 451
diff --git a/svx/util/hidother.src b/svx/util/hidother.src
new file mode 100644
index 000000000000..e3c1f72cce4d
--- /dev/null
+++ b/svx/util/hidother.src
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "../inc/helpid.hrc" // HID_XXX
+#include "../inc/fmhelp.hrc"
+
+/* #define HID_AUTOCORR_HELP_CHGNONBRKSPACE HID_AUTOCORR_HELP_START+20 */
+/* hidspecial HID_AUTOCORR_HELP_CHGNONBRKSPACE { HelpID = HID_AUTOCORR_HELP_CHGNONBRKSPACE;}; */
+
+hidspecial HID_FIELD_SEL { HelpID =HID_FIELD_SEL ;};
+hidspecial HID_FIELD_SEL_WIN { HelpID =HID_FIELD_SEL_WIN ;};
+hidspecial HID_FILL_ATTR_LISTBOX { HelpID = HID_FILL_ATTR_LISTBOX ;};
+hidspecial HID_FILL_TYPE_LISTBOX { HelpID = HID_FILL_TYPE_LISTBOX ;};
+hidspecial HID_FILTER_NAVIGATOR { HelpID =HID_FILTER_NAVIGATOR ;};
+hidspecial HID_FILTER_NAVIGATOR_WIN { HelpID =HID_FILTER_NAVIGATOR_WIN ;};
+hidspecial HID_FORM_NAVIGATOR { HelpID =HID_FORM_NAVIGATOR ;};
+hidspecial HID_FORM_NAVIGATOR_WIN { HelpID =HID_FORM_NAVIGATOR_WIN ;};
+hidspecial HID_GALLERY_ICONVIEW { HelpID = HID_GALLERY_ICONVIEW ;};
+hidspecial HID_GALLERY_LISTVIEW { HelpID = HID_GALLERY_LISTVIEW ;};
+hidspecial HID_GALLERY_NEWTHEME { HelpID = HID_GALLERY_NEWTHEME ;};
+hidspecial HID_GALLERY_PREVIEW { HelpID = HID_GALLERY_PREVIEW; };
+hidspecial HID_GALLERY_THEMELIST { HelpID = HID_GALLERY_THEMELIST ;};
+hidspecial HID_GALLERY_TITLE { HelpID = HID_GALLERY_TITLE; };
+hidspecial HID_GALLERY_WINDOW { HelpID = HID_GALLERY_WINDOW; };
+hidspecial HID_GRID_NUMBEROFRECORDS { HelpID = HID_GRID_NUMBEROFRECORDS ;};
+hidspecial HID_GRID_TRAVEL_ABSOLUTE { HelpID = HID_GRID_TRAVEL_ABSOLUTE ;};
+hidspecial HID_GRID_TRAVEL_FIRST { HelpID = HID_GRID_TRAVEL_FIRST ;};
+hidspecial HID_GRID_TRAVEL_LAST { HelpID = HID_GRID_TRAVEL_LAST ;};
+hidspecial HID_GRID_TRAVEL_NEW { HelpID = HID_GRID_TRAVEL_NEW ;};
+hidspecial HID_GRID_TRAVEL_NEXT { HelpID = HID_GRID_TRAVEL_NEXT ;};
+hidspecial HID_GRID_TRAVEL_PREV { HelpID = HID_GRID_TRAVEL_PREV ;};
+hidspecial HID_POPUP_COLOR { HelpID = HID_POPUP_COLOR; };
+hidspecial HID_POPUP_COLOR_CTRL { HelpID = HID_POPUP_COLOR_CTRL; };
+hidspecial HID_POPUP_FRAME { HelpID = HID_POPUP_FRAME; };
+hidspecial HID_POPUP_LINE { HelpID = HID_POPUP_LINE ; };
+hidspecial HID_POPUP_LINEEND { HelpId = HID_POPUP_LINEEND ;};
+hidspecial HID_POPUP_LINEEND_CTRL { HelpId = HID_POPUP_LINEEND_CTRL ;};
+hidspecial HID_REDLINING_FILTER_CB_ACTION { HelpID = HID_REDLINING_FILTER_CB_ACTION; };
+hidspecial HID_REDLINING_TABCONTROL { HelpID = HID_REDLINING_TABCONTROL; };
+hidspecial HID_REDLINING_VIEW_DG_VIEW_HEADER { HelpID = HID_REDLINING_VIEW_DG_VIEW_HEADER; };
+hidspecial HID_REDLINING_VIEW_DG_VIEW_TABLE { HelpID = HID_REDLINING_VIEW_DG_VIEW_TABLE ; };
+hidspecial HID_SVX_CHINESE_DICTIONARY_CB_REVERSE { HelpId = HID_SVX_CHINESE_DICTIONARY_CB_REVERSE; };
+hidspecial HID_SVX_CHINESE_DICTIONARY_LB_HEADER { HelpId = HID_SVX_CHINESE_DICTIONARY_LB_HEADER; };
+hidspecial HID_SVX_CHINESE_DICTIONARY_LB_TO_SIMPLIFIED { HelpId = HID_SVX_CHINESE_DICTIONARY_LB_TO_SIMPLIFIED; };
+hidspecial HID_SVX_CHINESE_DICTIONARY_LB_TO_TRADITIONAL { HelpId = HID_SVX_CHINESE_DICTIONARY_LB_TO_TRADITIONAL; };
+hidspecial HID_SVX_CHINESE_DICTIONARY_RB_CONVERSION_TO_SIMPLIFIED { HelpId = HID_SVX_CHINESE_DICTIONARY_RB_CONVERSION_TO_SIMPLIFIED; };
+hidspecial HID_SVX_CHINESE_DICTIONARY_RB_CONVERSION_TO_TRADITIONAL { HelpId = HID_SVX_CHINESE_DICTIONARY_RB_CONVERSION_TO_TRADITIONAL; };
+hidspecial HID_SVX_CHINESE_TRANSLATION_CB_USE_VARIANTS { HelpId = HID_SVX_CHINESE_TRANSLATION_CB_USE_VARIANTS; };
+hidspecial HID_SVX_CHINESE_TRANSLATION_RB_CONVERSION_TO_SIMPLIFIED { HelpId = HID_SVX_CHINESE_TRANSLATION_RB_CONVERSION_TO_SIMPLIFIED; };
+hidspecial HID_SVX_CHINESE_TRANSLATION_RB_CONVERSION_TO_TRADITIONAL { HelpId = HID_SVX_CHINESE_TRANSLATION_RB_CONVERSION_TO_TRADITIONAL; };
+hidspecial UID_FORMPROPBROWSER_FRAME { HelpID = UID_FORMPROPBROWSER_FRAME ;};
diff --git a/svx/util/svx.component b/svx/util/svx.component
new file mode 100644
index 000000000000..5907d69fef50
--- /dev/null
+++ b/svx/util/svx.component
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.Draw.GraphicExporter">
+ <service name="com.sun.star.drawing.GraphicExportFilter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Svx.GraphicExportHelper">
+ <service name="com.sun.star.document.BinaryStreamResolver"/>
+ <service name="com.sun.star.document.GraphicObjectResolver"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Svx.GraphicImportHelper">
+ <service name="com.sun.star.document.BinaryStreamResolver"/>
+ <service name="com.sun.star.document.GraphicObjectResolver"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.gallery.GalleryThemeProvider">
+ <service name="com.sun.star.gallery.GalleryThemeProvider"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.graphic.PrimitiveFactory2D">
+ <service name="com.sun.star.graphic.PrimitiveFactory2D"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.svx.Impl.FindbarDispatcher">
+ <service name="com.sun.star.comp.svx.FindbarDispatcher"/>
+ <service name="com.sun.star.frame.ProtocolHandler"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.svx.RecoveryUI">
+ <service name="com.sun.star.dialog.RecoveryUI"/>
+ </implementation>
+ <implementation name="com.sun.star.drawing.EnhancedCustomShapeEngine">
+ <service name="com.sun.star.drawing.CustomShapeEngine"/>
+ </implementation>
+ <implementation name="com.sun.star.drawing.SvxShapeCollection">
+ <service name="com.sun.star.drawing.ShapeCollection"/>
+ </implementation>
+ <implementation name="com.sun.star.drawing.SvxUnoColorTable">
+ <service name="com.sun.star.drawing.ColorTable"/>
+ </implementation>
+ <implementation name="com.sun.star.svx.DownSearchToolboxController">
+ <service name="com.sun.star.frame.ToolbarController"/>
+ </implementation>
+ <implementation name="com.sun.star.svx.FindTextToolboxController">
+ <service name="com.sun.star.frame.ToolbarController"/>
+ </implementation>
+ <implementation name="com.sun.star.svx.FontHeightToolBoxController">
+ <service name="com.sun.star.frame.ToolbarController"/>
+ </implementation>
+ <implementation name="com.sun.star.svx.UpSearchToolboxController">
+ <service name="com.sun.star.frame.ToolbarController"/>
+ </implementation>
+</component>
diff --git a/svx/util/svx.dxp b/svx/util/svx.dxp
new file mode 100644
index 000000000000..f0e1c69934bc
--- /dev/null
+++ b/svx/util/svx.dxp
@@ -0,0 +1,2 @@
+component_getImplementationEnvironment
+component_getFactory
diff --git a/svx/util/svxcore.component b/svx/util/svxcore.component
new file mode 100644
index 000000000000..2f829cb52a77
--- /dev/null
+++ b/svx/util/svxcore.component
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.svx.ExtrusionDepthController">
+ <service name="com.sun.star.frame.PopupMenuController"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.svx.ExtrusionDirectionController">
+ <service name="com.sun.star.frame.ToolbarController"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.svx.ExtrusionLightingController">
+ <service name="com.sun.star.frame.ToolbarController"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.svx.ExtrusionSurfaceController">
+ <service name="com.sun.star.frame.ToolbarController"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.svx.FontWorkAlignmentController">
+ <service name="com.sun.star.frame.ToolbarController"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.svx.FontWorkCharacterSpacingController">
+ <service name="com.sun.star.frame.ToolbarController"/>
+ </implementation>
+</component>
diff --git a/svx/util/svxpch.cxx b/svx/util/svxpch.cxx
new file mode 100644
index 000000000000..b8f6b92b38db
--- /dev/null
+++ b/svx/util/svxpch.cxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <thread.hxx>
+#include <sysdep.hxx>
+#if defined(WNT)
+#include <svwin.h>
+#endif
+#include <tlintl.hxx>
+#include <tlfsys.hxx>
+#include <tlbigint.hxx>
+
+#include <sysdep.hxx>
+#include <sv.hxx>
+#include <svtool.hxx>
+#define _ANIMATION
+#include <svgraph.hxx>
+#include <svsystem.hxx>
+#include <svcontnr.hxx>
+#include <sfx.hxx>
+#include <sfxitems.hxx>
+#include <sfxipool.hxx>
+#include <sfxiiter.hxx>
+#include <sfxdoc.hxx>
+#include <sfxview.hxx>
+#include <sfxdlg.hxx>
+#include <sfxstyle.hxx>
+#include <editeng/svxenum.hxx>
+#include <sbx.hxx>
+#include <hmwrap.hxx>
+#include <mail.hxx>
+#include <urlobj.hxx>
+#include <inet.hxx>
+#include <inetui.hxx>
+#include <svtruler.hxx>
+
+#include <limits.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <sfx.hrc>
+
diff --git a/svx/util/textconversiondlgs.component b/svx/util/textconversiondlgs.component
new file mode 100644
index 000000000000..184743583645
--- /dev/null
+++ b/svx/util/textconversiondlgs.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.linguistic2.ChineseTranslationDialog">
+ <service name="com.sun.star.linguistic2.ChineseTranslationDialog"/>
+ </implementation>
+</component>
diff --git a/svx/workben/edittest.cxx b/svx/workben/edittest.cxx
new file mode 100644
index 000000000000..9b2f4f2e2aac
--- /dev/null
+++ b/svx/workben/edittest.cxx
@@ -0,0 +1,1795 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <editeng/editeng.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/editview.hxx>
+#include <editeng/editobj.hxx>
+#include <editeng/editstat.hxx>
+#include <eerdll.hxx>
+#include <editeng/flditem.hxx>
+#include <tools/urlobj.hxx>
+#include <svx/svxacorr.hxx>
+#include <tools/fsys.hxx>
+#include <svx/xpoly.hxx>
+#include <svtools/filedlg.hxx>
+
+#include <vcl/window.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/font.hxx>
+#include <vcl/sound.hxx>
+#include <vcl/print.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/help.hxx>
+#include <vcl/scrbar.hxx>
+#include <vcl/wrkwin.hxx>
+#include <vcl/msgbox.hxx>
+
+#include <dialdll.hxx>
+
+
+#define SERVICE_SIMPLEREGISTRY "com.sun.star.registry.SimpleRegistry"
+#include <comphelper/processfactory.hxx>
+#include <comphelper/regpathhelper.hxx>
+#include <cppuhelper/servicefactory.hxx>
+#include <cppuhelper/bootstrap.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/registry/XSimpleRegistry.hpp>
+#include <sfx2/sfxuno.hxx>
+
+// SVX
+#include <editeng/lrspitem.hxx>
+#include <editeng/shdditem.hxx>
+#include <editeng/cntritem.hxx>
+#include <editeng/crsditem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/lspcitem.hxx>
+#include <editeng/escpitem.hxx>
+#include <editeng/kernitem.hxx>
+#include <editeng/akrnitem.hxx>
+#include <editeng/wrlmitem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/adjitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/fontitem.hxx>
+#include <fwdtitem.hxx>
+
+// SVTOOLS
+#include <svl/undo.hxx>
+#include <svl/itemset.hxx>
+#include <svl/itempool.hxx>
+#include <svl/poolitem.hxx>
+#include <svtools/printdlg.hxx>
+
+#include <osl/file.hxx>
+#include <osl/process.h>
+#include <rtl/bootstrap.hxx>
+
+#define TB_LEFT 1
+#define TB_RIGHT 2
+#define TB_CENTER 3
+#define TB_UNDO 4
+#define TB_REDO 5
+#define TB_FONT1 6
+#define TB_FONT2 7
+#define TB_ITALIC 8
+#define TB_BOLD 9
+#define TB_UNDERLINE 10
+#define TB_BLACK 11
+#define TB_GREEN 12
+#define TB_OPEN 13
+#define TB_SAVE 14
+#define TB_SBL 15
+#define TB_SBSA 16
+#define TB_LR 17
+#define TB_DRAW 18
+#define TB_DEFTAB 19
+#define TB_OPEN2 20
+#define TB_SAVE2 21
+#define TB_STDSEL 33
+#define TB_MOVE 34
+#define TB_PARATTR1 35
+#define TB_ROTATE 38
+#define TB_RED 43
+#define TB_FLAT 46
+#define TB_BINOBJ1 47
+#define TB_BINOBJ3 49
+#define TB_BINOBJ4 50
+#define TB_BINOBJ1b 51
+#define TB_BINOBJ2b 52
+#define TB_ATTRIBS 54
+#define TB_IDLE 55
+#define TB_BLOCK 56
+#define TB_CLONEBIN 57
+#define TB_INSERT 58
+#define TB_PKERN 59
+#define TB_KERN 60
+#define TB_SUPER 61
+#define TB_SUB 62
+#define TB_PRINT 63
+#define TB_FONT 64
+#define TB_COLORS 65
+#define TB_WLM 66
+#define TB_OUTL 67
+#define TB_INSFLD 68
+#define TB_UPDFLD 69
+#define TB_ONLINESPELL 70
+#define TB_REDLINES 71
+#define TB_AUTOCORRECT 72
+#define TB_POLY 73
+#define TB_HYPH 74
+
+// VARS...
+short nRotation = 0;
+USHORT nZoom = 100;
+sal_Bool bURLClicked = sal_False;
+
+using namespace ::com::sun::star::connection;
+using namespace ::vos;
+using namespace ::rtl;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::registry;
+using namespace ::com::sun::star::lang;
+
+
+
+Reference< XMultiServiceFactory > createApplicationServiceManager()
+{
+ Reference< XMultiServiceFactory > xMS;
+ try
+ {
+ Reference< XComponentContext > xComponentContext = ::cppu::defaultBootstrap_InitialComponentContext();
+ if ( xComponentContext.is() )
+ xMS = xMS.query( xComponentContext->getServiceManager() );
+ }
+ catch( ::com::sun::star::uno::Exception& )
+ {
+ }
+
+ return xMS;
+}
+
+// --- class EditApp -------------------------------------------------
+
+SV_DECL_PTRARR_DEL( StringList, String*, 0, 4 );
+SV_IMPL_PTRARR( StringList, String* );
+StringList aSimpleHistory;
+
+class EditApp : public Application
+{
+public:
+ virtual void Main();
+};
+
+class MyEditEngine : public EditEngine
+{
+public:
+ MyEditEngine( SfxItemPool* pPool ) : EditEngine( pPool ) { ; }
+ virtual String CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rTxtColor, Color*& rFldColor );
+ virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, USHORT nPos );
+ virtual void FieldSelected( const SvxFieldItem& rField, USHORT nPara, USHORT nPos );
+};
+
+XubString __EXPORT MyEditEngine::CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor )
+{
+ const SvxFieldData* pField = rField.GetField();
+ if ( !pField )
+ return String( RTL_CONSTASCII_USTRINGPARAM( "<Empty>" ) );
+
+ if ( pField->ISA( SvxDateField ) )
+ return ((const SvxDateField*)pField)->GetFormatted( LANGUAGE_SYSTEM, LANGUAGE_SYSTEM );
+ else if ( pField->ISA( SvxURLField ) )
+ {
+ const SvxURLField* pURL = (const SvxURLField*)pField;
+ if ( !bURLClicked )
+ {
+ delete rpTxtColor;
+ rpTxtColor = new Color( COL_BLUE );
+ }
+ else
+ {
+ delete rpTxtColor;
+ rpTxtColor = new Color( COL_RED );
+ delete rpFldColor;
+ rpFldColor = new Color( COL_YELLOW );
+ }
+ if ( pURL->GetFormat() == SVXURLFORMAT_URL )
+ return pURL->GetURL();
+ return pURL->GetRepresentation();
+ }
+ return String( RTL_CONSTASCII_USTRINGPARAM( "???" ) );
+}
+
+void __EXPORT MyEditEngine::FieldClicked( const SvxFieldItem& rField, USHORT nPara, USHORT nPos )
+{
+ EditEngine::FieldClicked( rField, nPara, nPos ); // Falls URL
+ const SvxFieldData* pField = rField.GetField();
+ if ( !pField )
+ return;
+
+ if ( pField->ISA( SvxURLField ) )
+ {
+ bURLClicked = TRUE;
+ UpdateFields();
+ }
+ else
+ Sound::Beep();
+}
+
+void __EXPORT MyEditEngine::FieldSelected( const SvxFieldItem& rField, USHORT nPara, USHORT nPos )
+{
+ const SvxFieldData* pField = rField.GetField();
+ if ( !pField )
+ return;
+
+ InfoBox( 0, String( RTL_CONSTASCII_USTRINGPARAM( "Feld selektiert!" ) ) ).Execute();
+}
+
+
+class MyView : public WorkWindow
+{
+private:
+ EditEngine* pEditEngine;
+ EditView* pEditView;
+
+public:
+ MyView( Window* pParent, EditEngine* pEditEngine );
+ ~MyView();
+
+ virtual void Paint( const Rectangle& );
+ virtual void Resize();
+ virtual void KeyInput( const KeyEvent& rKeyEvt );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+ BOOL Drop( const DropEvent& rEvt );
+ BOOL QueryDrop( DropEvent& rEvt );
+};
+
+MyView::MyView( Window* pParent, EditEngine* pEE ) : WorkWindow( pParent, WinBits( WB_STDWORK ) )
+{
+ pEditEngine = pEE;
+ pEditView = new EditView( pEditEngine, this );
+ pEditEngine->InsertView( pEditView );
+ SetText( String( RTL_CONSTASCII_USTRINGPARAM( "Another View..." ) ) );
+// EnableDrop();
+ SetBackgroundBrush( Brush( Color( COL_LIGHTBLUE ) ) );
+ Show();
+}
+
+MyView::~MyView()
+{
+ pEditEngine->RemoveView( pEditView );
+ delete pEditView;
+}
+
+void __EXPORT MyView::Paint( const Rectangle& rRec )
+{
+ pEditView->Paint( rRec );
+}
+
+void __EXPORT MyView::Resize()
+{
+ Size aPaperSz( GetOutputSize() );
+// aPaperSz.Width() /= 2;
+// aPaperSz.Height() /= 2;
+ pEditView->SetOutputArea( Rectangle( Point( 0,0 ), aPaperSz ) );
+ pEditView->SetVisArea( Rectangle( Point( 0,0 ), aPaperSz ) );
+ Invalidate();
+ pEditView->ShowCursor();
+}
+
+ // --- MyView::KeyInput() --------------------------------------
+void __EXPORT MyView::KeyInput( const KeyEvent& rKEvt )
+{
+ pEditView->PostKeyEvent( rKEvt );
+}
+
+void __EXPORT MyView::MouseMove( const MouseEvent& rMEvt )
+{
+ Point aPos = PixelToLogic( rMEvt.GetPosPixel() );
+ if ( pEditView->GetOutputArea().IsInside( aPos ) )
+ SetPointer( pEditView->GetPointer() );
+ else
+ SetPointer( Pointer() );
+
+
+ pEditView->MouseMove( rMEvt );
+}
+
+void __EXPORT MyView::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ pEditView->MouseButtonDown( rMEvt );
+}
+
+void __EXPORT MyView::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ pEditView->MouseButtonUp( rMEvt );
+}
+
+void __EXPORT MyView::Command( const CommandEvent& rCEvt )
+{
+ if ( rCEvt.GetCommand() == COMMAND_STARTDRAG )
+ pEditView->Command(rCEvt);
+}
+
+BOOL __EXPORT MyView::Drop( const DropEvent& rEvt )
+{
+ return pEditView->Drop( rEvt );
+}
+
+BOOL __EXPORT MyView::QueryDrop( DropEvent& rEvt )
+{
+ return pEditView->QueryDrop( rEvt );
+}
+
+// --- class EditMainWindow --------------------------------------------
+DECLARE_LIST( ViewList, MyView* );
+
+class EditViewWindow : public Window
+{
+private:
+ MyEditEngine* pEditEngine;
+ EditView* pEditView;
+ Pointer aStdPtr;
+ Pointer aURLPtr;
+ WorkWindow* pTmpWindow;
+ ViewList aViewList;
+
+ XubString aTestStr;
+
+
+public:
+ EditViewWindow( Window* pParent );
+ ~EditViewWindow();
+
+ virtual void Paint( const Rectangle& );
+ virtual void Resize();
+ virtual void KeyInput( const KeyEvent& rKeyEvt );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+ void MarkOutputArea();
+ BOOL Drop( const DropEvent& rEvt );
+ BOOL QueryDrop( DropEvent& rEvt );
+
+ EditView* GetEditView() { return pEditView; }
+};
+
+class EditMainWindow : public WorkWindow
+{
+private:
+ ToolBox aToolBox;
+ ScrollBar aHScrollBar;
+ ScrollBar aVScrollBar;
+ EditViewWindow aViewWin;
+ Printer* pPrinter;
+
+ WorkWindow* pTmpWindow;
+
+ EditTextObject* pRTFObj;
+ EditTextObject* pBinObj;
+
+ FileDialog* pFileDialogBox;
+ FileDialog* pFileDialogBox2;
+
+
+protected:
+ void SetScrollBars();
+ void SetScrollBarRanges();
+ void CreatePolygon();
+
+ virtual void GetFocus();
+
+public:
+ EditMainWindow();
+ ~EditMainWindow();
+
+ virtual void Resize();
+
+ DECL_LINK( TBSelect, ToolBox * );
+ void UpdateToolBox();
+
+ DECL_LINK( HScrollHdl, ScrollBar * );
+ DECL_LINK( VScrollHdl, ScrollBar * );
+ DECL_LINK( ShowStatus, EditStatus * );
+ void SetTitle();
+};
+
+
+EditMainWindow::~EditMainWindow()
+{
+ delete pRTFObj;
+ delete pBinObj;
+ delete pFileDialogBox;
+ delete pFileDialogBox2;
+ delete pTmpWindow;
+ delete pPrinter;
+}
+
+EditMainWindow::EditMainWindow() :
+ WorkWindow( NULL, WB_APP | WB_STDWORK | WB_SVLOOK | WB_CLIPCHILDREN ) ,
+ aViewWin( this ),
+ aToolBox( this, WinBits( WB_BORDER | WB_SVLOOK | WB_SCROLL | WB_LINESPACING ) ),
+ aHScrollBar( this, WinBits( WB_HSCROLL | WB_DRAG ) ),
+ aVScrollBar( this, WinBits( WB_VSCROLL | WB_DRAG ) )
+{
+ pRTFObj = 0;
+ pBinObj = 0;
+
+ pFileDialogBox = new FileDialog( this, WinBits( WB_OPEN | WB_SVLOOK ) );
+ pFileDialogBox->SetText( String( RTL_CONSTASCII_USTRINGPARAM( "Open" ) ) );
+ pFileDialogBox->AddFilter( String( RTL_CONSTASCII_USTRINGPARAM( "Text" )), String( RTL_CONSTASCII_USTRINGPARAM( "*.txt" ) ) );
+ pFileDialogBox->AddFilter( String( RTL_CONSTASCII_USTRINGPARAM( "Rich Text Format" ) ), String( RTL_CONSTASCII_USTRINGPARAM( "*.rtf" ) ) );
+ pFileDialogBox->AddFilter( String( RTL_CONSTASCII_USTRINGPARAM( "HTML" ) ), String( RTL_CONSTASCII_USTRINGPARAM( "*.htm;*.html" ) ) );
+ pFileDialogBox->SetCurFilter( String( RTL_CONSTASCII_USTRINGPARAM( "Rich Text Format" ) ) );
+
+ pFileDialogBox2 = new FileDialog( this, WinBits( WB_SAVEAS| WB_SVLOOK ) );
+ pFileDialogBox2->SetText( String( RTL_CONSTASCII_USTRINGPARAM( "Save" ) ) );
+ pFileDialogBox2->AddFilter( String( RTL_CONSTASCII_USTRINGPARAM( "Text" ) ), String( RTL_CONSTASCII_USTRINGPARAM( "*.txt" ) ) );
+ pFileDialogBox2->AddFilter( String( RTL_CONSTASCII_USTRINGPARAM( "Rich Text Format" ) ), String( RTL_CONSTASCII_USTRINGPARAM( "*.rtf" ) ) );
+ pFileDialogBox2->AddFilter( String( RTL_CONSTASCII_USTRINGPARAM( "HTML" ) ), String( RTL_CONSTASCII_USTRINGPARAM( "*.htm" ) ) );
+ pFileDialogBox2->SetCurFilter( String( RTL_CONSTASCII_USTRINGPARAM( "Rich Text Format" ) ) );
+
+ pPrinter = new Printer;
+ pPrinter->SetMapMode( MAP_100TH_MM );
+ aViewWin.SetMapMode( pPrinter->GetMapMode() );
+ aViewWin.GetEditView()->GetEditEngine()->SetRefDevice( pPrinter );
+
+
+
+ pTmpWindow = new WorkWindow( this, WB_STDWORK );
+
+ aToolBox.SetButtonType( BUTTON_TEXT );
+ aToolBox.SetLineCount( 4 );
+
+ {
+ aToolBox.InsertItem( TB_OPEN, String( RTL_CONSTASCII_USTRINGPARAM( "Open" ) ) );
+ aToolBox.InsertItem( TB_SAVE, String( RTL_CONSTASCII_USTRINGPARAM( "Save" ) ) );
+ aToolBox.InsertItem( TB_PRINT, String( RTL_CONSTASCII_USTRINGPARAM( "Print" ) ) );
+ aToolBox.InsertSeparator();
+ aToolBox.InsertItem( TB_LEFT, String( RTL_CONSTASCII_USTRINGPARAM( "L" ) ) );
+ aToolBox.InsertItem( TB_CENTER, String( RTL_CONSTASCII_USTRINGPARAM( "C" ) ) );
+ aToolBox.InsertItem( TB_RIGHT, String( RTL_CONSTASCII_USTRINGPARAM( "R" ) ) );
+ aToolBox.InsertItem( TB_BLOCK, String( RTL_CONSTASCII_USTRINGPARAM( "B" ) ) );
+ aToolBox.InsertSeparator();
+ aToolBox.InsertItem( TB_UNDO, String( RTL_CONSTASCII_USTRINGPARAM( "Undo" ) ) );
+ aToolBox.InsertItem( TB_REDO, String( RTL_CONSTASCII_USTRINGPARAM( "Redo" ) ) );
+ aToolBox.InsertSeparator();
+ aToolBox.InsertItem( TB_FONT1, String( RTL_CONSTASCII_USTRINGPARAM( "Font1" ) ) );
+ aToolBox.InsertItem( TB_FONT2, String( RTL_CONSTASCII_USTRINGPARAM( "Font2" ) ) );
+ aToolBox.InsertItem( TB_DEFTAB, String( RTL_CONSTASCII_USTRINGPARAM( "DefTab" ) ) );
+ aToolBox.InsertBreak();
+ aToolBox.InsertItem( TB_OPEN2, String( RTL_CONSTASCII_USTRINGPARAM( "Read" ) ) );
+ aToolBox.InsertItem( TB_SAVE2, String( RTL_CONSTASCII_USTRINGPARAM( "Write" ) ) );
+ aToolBox.InsertSeparator();
+ aToolBox.InsertItem( TB_FONT, String( RTL_CONSTASCII_USTRINGPARAM( "XXX" ) ) );
+ aToolBox.InsertItem( TB_ITALIC, String( RTL_CONSTASCII_USTRINGPARAM( "K" ) ) );
+ aToolBox.InsertItem( TB_BOLD, String( RTL_CONSTASCII_USTRINGPARAM( "F" ) ) );
+ aToolBox.InsertItem( TB_UNDERLINE, String( RTL_CONSTASCII_USTRINGPARAM( "U" ) ) );
+ aToolBox.InsertItem( TB_SUPER, String( RTL_CONSTASCII_USTRINGPARAM( "SP" ) ) );
+ aToolBox.InsertItem( TB_SUB, String( RTL_CONSTASCII_USTRINGPARAM( "SB" ) ) );
+ aToolBox.InsertItem( TB_PKERN, String( RTL_CONSTASCII_USTRINGPARAM( "PK" ) ) );
+ aToolBox.InsertItem( TB_KERN, String( RTL_CONSTASCII_USTRINGPARAM( "TK" ) ) );
+ aToolBox.InsertItem( TB_WLM, String( RTL_CONSTASCII_USTRINGPARAM( "W!" ) ) );
+ aToolBox.InsertSeparator();
+ aToolBox.InsertItem( TB_BLACK, String( RTL_CONSTASCII_USTRINGPARAM( "Black" ) ) );
+ aToolBox.InsertItem( TB_GREEN, String( RTL_CONSTASCII_USTRINGPARAM( "Green" ) ) );
+ aToolBox.InsertItem( TB_RED, String( RTL_CONSTASCII_USTRINGPARAM( "Red" ) ) );
+ aToolBox.InsertSeparator();
+ aToolBox.InsertItem( TB_SBL, String( RTL_CONSTASCII_USTRINGPARAM( "SBL" ) ) );
+ aToolBox.InsertItem( TB_SBSA, String( RTL_CONSTASCII_USTRINGPARAM( "SBSA" ) ) );
+ aToolBox.InsertItem( TB_LR, String( RTL_CONSTASCII_USTRINGPARAM( "LR" ) ) );
+ aToolBox.InsertSeparator();
+ aToolBox.InsertItem( TB_DRAW, String( RTL_CONSTASCII_USTRINGPARAM( "Draw!" ) ) );
+ aToolBox.InsertItem( TB_ROTATE, String( RTL_CONSTASCII_USTRINGPARAM( "Rotate!" ) ) );
+ aToolBox.InsertItem( TB_MOVE, String( RTL_CONSTASCII_USTRINGPARAM( "Move->2" ) ) );
+ aToolBox.InsertItem( TB_PARATTR1, String( RTL_CONSTASCII_USTRINGPARAM( "ParaAttr0" ) ) );
+ aToolBox.InsertItem( TB_ATTRIBS, String( RTL_CONSTASCII_USTRINGPARAM( "GetAttribs" ) ) );
+ aToolBox.InsertSeparator();
+ aToolBox.InsertItem( TB_INSFLD, String( RTL_CONSTASCII_USTRINGPARAM( "InsFld" ) ) );
+ aToolBox.InsertItem( TB_UPDFLD, String( RTL_CONSTASCII_USTRINGPARAM( "UpdFld" ) ) );
+ }
+ aToolBox.InsertBreak();
+ {
+ aToolBox.InsertItem( TB_ONLINESPELL, String( RTL_CONSTASCII_USTRINGPARAM( "Spell" ) ) );
+ aToolBox.InsertItem( TB_REDLINES, String( RTL_CONSTASCII_USTRINGPARAM( "RedLine" ) ) );
+ aToolBox.InsertItem( TB_AUTOCORRECT, String( RTL_CONSTASCII_USTRINGPARAM( "Auto*" ) ) );
+ aToolBox.InsertItem( TB_HYPH, String( RTL_CONSTASCII_USTRINGPARAM( "Hyph" ) ) );
+ aToolBox.InsertItem( TB_STDSEL, String( RTL_CONSTASCII_USTRINGPARAM( "StdSel" ) ) );
+ aToolBox.InsertItem( TB_FLAT, String( RTL_CONSTASCII_USTRINGPARAM( "FlatMode" ) ) );
+ aToolBox.InsertItem( TB_OUTL, String( RTL_CONSTASCII_USTRINGPARAM( "Ocomphelper" ) ) );
+ aToolBox.InsertItem( TB_POLY, String( RTL_CONSTASCII_USTRINGPARAM( "Poly" ) ) );
+ aToolBox.InsertItem( TB_COLORS, String( RTL_CONSTASCII_USTRINGPARAM( "Colors" ) ));
+ aToolBox.InsertItem( TB_IDLE, String( RTL_CONSTASCII_USTRINGPARAM( "Idle!" ) ) );
+ aToolBox.InsertItem( TB_INSERT, String( RTL_CONSTASCII_USTRINGPARAM( "Insert" ) ) );
+ aToolBox.InsertSeparator();
+ aToolBox.InsertItem( TB_BINOBJ1, String( RTL_CONSTASCII_USTRINGPARAM( ">BINObj" ) ) );
+ aToolBox.InsertItem( TB_BINOBJ1b, String( RTL_CONSTASCII_USTRINGPARAM( ">>BINObj" ) ) );
+ aToolBox.InsertItem( TB_BINOBJ2b, String( RTL_CONSTASCII_USTRINGPARAM( "<<BINObj" ) ) );
+ aToolBox.InsertItem( TB_CLONEBIN, String( RTL_CONSTASCII_USTRINGPARAM( "Clone" ) ) );
+ aToolBox.InsertSeparator();
+ aToolBox.InsertItem( TB_BINOBJ3, String( RTL_CONSTASCII_USTRINGPARAM( "StoreBin" ) ) );
+ aToolBox.InsertItem( TB_BINOBJ4, String( RTL_CONSTASCII_USTRINGPARAM( "CreatBin" ) ) );
+ }
+
+ aToolBox.SetPosPixel( Point( 0, 0 ) );
+ aToolBox.SetSelectHdl( LINK( this, EditMainWindow, TBSelect ) );
+
+ SetBackgroundBrush( Brush( Color( COL_LIGHTGRAY ) ) );
+
+ SetPen( PEN_NULL );
+ Show();
+
+ aVScrollBar.SetScrollHdl ( LINK( this, EditMainWindow, VScrollHdl ) );
+ aVScrollBar.SetLineSize( 300 );
+ aVScrollBar.SetPageSize( 2000 );
+ aHScrollBar.SetScrollHdl ( LINK( this, EditMainWindow, HScrollHdl ) );
+ aHScrollBar.SetLineSize( 300 );
+ aHScrollBar.SetPageSize( 2000 );
+ aHScrollBar.Enable();
+ aVScrollBar.Enable();
+
+ aViewWin.GetEditView()->GetEditEngine()->SetStatusEventHdl( LINK( this, EditMainWindow, ShowStatus ) );
+
+ SetTitle();
+
+ UpdateToolBox();
+ aToolBox.Show();
+ aViewWin.Show();
+}
+
+void EditMainWindow::SetTitle()
+{
+ String aHeading( String( RTL_CONSTASCII_USTRINGPARAM( "SvEdit! - Zoom " ) ) );
+ aHeading += String::CreateFromInt32(nZoom);
+ aHeading += '%';
+ EditEngine* pEditEngine = aViewWin.GetEditView()->GetEditEngine();
+ if ( pEditEngine->GetControlWord() & EE_CNTRL_STRETCHING )
+ {
+ USHORT nX, nY;
+ pEditEngine->GetGlobalCharStretching( nX, nY );
+ aHeading += String( RTL_CONSTASCII_USTRINGPARAM( ", Stretch=(" ) );
+ aHeading += String::CreateFromInt32(nX);
+ aHeading += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) );
+ aHeading += String::CreateFromInt32(nY);
+ aHeading += ')';
+ }
+ SetText( aHeading );
+}
+
+void EditMainWindow::UpdateToolBox()
+{
+ EditView* pEditView = aViewWin.GetEditView();
+ EditEngine* pEditEngine = pEditView->GetEditEngine();
+ SfxItemSet aCurSet( pEditView->GetAttribs() );
+
+ ULONG nControl = pEditEngine->GetControlWord();
+ aToolBox.EnableItem( TB_UNDO, (BOOL)pEditEngine->GetUndoManager().GetUndoActionCount() );
+ aToolBox.EnableItem( TB_REDO, (BOOL)pEditEngine->GetUndoManager().GetRedoActionCount() );
+ aToolBox.EnableItem( TB_BINOBJ2b, (BOOL)(long)pBinObj );
+ aToolBox.EnableItem( TB_MOVE, pEditEngine->GetParagraphCount() > 3 );
+ aToolBox.CheckItem( TB_ONLINESPELL, nControl & EE_CNTRL_ONLINESPELLING ? TRUE : FALSE );
+ aToolBox.CheckItem( TB_AUTOCORRECT, nControl & EE_CNTRL_AUTOCORRECT ? TRUE : FALSE );
+// aToolBox.CheckItem( TB_HYPH, nControl & EE_CNTRL_HYPHENATE ? TRUE : FALSE );
+ aToolBox.CheckItem( TB_REDLINES, nControl & EE_CNTRL_NOREDLINES ? FALSE : TRUE );
+ aToolBox.CheckItem( TB_STDSEL, pEditView->GetSelectionMode() == EE_SELMODE_STD );
+ aToolBox.CheckItem( TB_FLAT, pEditEngine->IsFlatMode() );
+ aToolBox.CheckItem( TB_OUTL, ( nControl & EE_CNTRL_OUTLINER ) ? TRUE : FALSE );
+ aToolBox.CheckItem( TB_POLY, pEditEngine->GetPolygon() ? TRUE : FALSE );
+ aToolBox.CheckItem( TB_COLORS, ( nControl & EE_CNTRL_NOCOLORS ) ? FALSE : TRUE );
+ aToolBox.CheckItem( TB_IDLE, pEditEngine->IsIdleFormatterEnabled() );
+ aToolBox.CheckItem( TB_INSERT, pEditView->IsInsertMode() );
+
+ for ( USHORT nWhich = EE_ITEMS_START; nWhich <= EE_ITEMS_END; nWhich++)
+ {
+// if ( aCurSet.GetItemState( nWhich ) == SFX_ITEM_OFF )
+// ;
+// else if ( aCurSet.GetItemState( nWhich ) == SFX_ITEM_DONTCARE )
+// ;
+// else if ( aCurSet.GetItemState( nWhich ) == SFX_ITEM_ON )
+ {
+ const SfxPoolItem& rItem = aCurSet.Get( nWhich );
+ switch ( nWhich )
+ {
+ case EE_PARA_HYPHENATE:
+ aToolBox.CheckItem( TB_HYPH, ((SfxBoolItem&)rItem).GetValue() != 0 );
+ break;
+ case EE_PARA_LRSPACE:
+ aToolBox.CheckItem( TB_LR, ((SvxLRSpaceItem&)rItem).GetTxtLeft() != 0 );
+ break;
+ case EE_PARA_ULSPACE:
+ aToolBox.CheckItem( TB_SBSA, ((SvxULSpaceItem&)rItem).GetUpper() != 0 );
+ break;
+ case EE_PARA_SBL:
+ aToolBox.CheckItem( TB_SBL, ((SvxLineSpacingItem&)rItem).GetPropLineSpace() != 100 );
+ break;
+ case EE_PARA_JUST:
+ {
+ SvxAdjust e = ((SvxAdjustItem&)rItem).GetAdjust();
+ aToolBox.CheckItem( TB_LEFT, e == SVX_ADJUST_LEFT );
+ aToolBox.CheckItem( TB_RIGHT, e == SVX_ADJUST_RIGHT);
+ aToolBox.CheckItem( TB_CENTER, e == SVX_ADJUST_CENTER);
+ aToolBox.CheckItem( TB_BLOCK, e == SVX_ADJUST_BLOCK );
+ }
+ break;
+ case EE_PARA_TABS:
+ break;
+ case EE_CHAR_COLOR:
+ {
+ Color aColor( ((SvxColorItem&)rItem).GetValue() );
+ aToolBox.CheckItem( TB_BLACK, aColor == COL_BLACK );
+ aToolBox.CheckItem( TB_GREEN, aColor == COL_GREEN );
+ aToolBox.CheckItem( TB_RED, aColor == COL_RED );
+ }
+ break;
+ case EE_CHAR_FONTINFO:
+ {
+ FontFamily e = ((SvxFontItem&)rItem).GetFamily();
+ aToolBox.CheckItem( TB_FONT1, e == FAMILY_ROMAN );
+ aToolBox.CheckItem( TB_FONT2, e == FAMILY_SWISS );
+ }
+ break;
+ case EE_CHAR_FONTHEIGHT:
+ break;
+ case EE_CHAR_WEIGHT:
+ {
+ FontWeight e = ((SvxWeightItem&)rItem).GetWeight();
+ aToolBox.CheckItem( TB_BOLD, e == WEIGHT_BOLD );
+ }
+ break;
+ case EE_CHAR_UNDERLINE:
+ {
+ aToolBox.CheckItem( TB_UNDERLINE, ((SvxUnderlineItem&)rItem).GetLineStyle() );
+ }
+ break;
+ case EE_CHAR_WLM:
+ {
+ aToolBox.CheckItem( TB_WLM, ((SvxWordLineModeItem&)rItem).GetValue() );
+ }
+ break;
+ case EE_CHAR_PAIRKERNING:
+ {
+ aToolBox.CheckItem( TB_PKERN, ((SvxAutoKernItem&)rItem).GetValue() );
+ }
+ break;
+ case EE_CHAR_KERNING:
+ {
+ aToolBox.CheckItem( TB_KERN, (BOOL)((SvxKerningItem&)rItem).GetValue() );
+ }
+ break;
+ case EE_CHAR_ESCAPEMENT:
+ {
+ aToolBox.CheckItem( TB_SUPER, ((SvxEscapementItem&)rItem).GetEsc() > 0 );
+ aToolBox.CheckItem( TB_SUB, ((SvxEscapementItem&)rItem).GetEsc() < 0 );
+ }
+ break;
+ case EE_CHAR_STRIKEOUT:
+ break;
+ case EE_CHAR_ITALIC:
+ {
+ FontItalic e = ((SvxPostureItem&)rItem).GetPosture();
+ aToolBox.CheckItem( TB_ITALIC, e == ITALIC_NORMAL );
+ }
+ break;
+ case EE_CHAR_OUTLINE:
+ break;
+ case EE_CHAR_SHADOW:
+ break;
+ }
+ }
+ }
+}
+
+IMPL_LINK( EditMainWindow, TBSelect, ToolBox *, p )
+{
+ EditView* pEditView = aViewWin.GetEditView();
+ EditEngine* pEditEngine = pEditView->GetEditEngine();
+ USHORT nId = aToolBox.GetCurItemId();
+ BOOL bChecked = aToolBox.IsItemChecked( nId );
+ SfxPoolItem* pNewItem = 0;
+ switch ( nId )
+ {
+ case TB_LEFT: pNewItem = new SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST );
+ break;
+ case TB_RIGHT: pNewItem = new SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST );
+ break;
+ case TB_CENTER: pNewItem = new SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST );
+ break;
+ case TB_BLOCK: pNewItem = new SvxAdjustItem( SVX_ADJUST_BLOCK, EE_PARA_JUST );
+ break;
+ case TB_HYPH: pNewItem = new SfxBoolItem( EE_PARA_HYPHENATE, !bChecked );
+ break;
+ case TB_UNDO: pEditView->Undo();
+ pEditView->ShowCursor();
+ break;
+ case TB_REDO: pEditView->Redo();
+ pEditView->ShowCursor();
+ break;
+ case TB_ONLINESPELL: {
+ ULONG nControl = pEditView->GetEditEngine()->GetControlWord();
+ if ( bChecked )
+ nControl = nControl & ~EE_CNTRL_ONLINESPELLING;
+ else
+ nControl = nControl | EE_CNTRL_ONLINESPELLING;
+ pEditView->GetEditEngine()->SetControlWord( nControl );
+ }
+ break;
+ case TB_REDLINES: {
+ ULONG nControl = pEditView->GetEditEngine()->GetControlWord();
+ if ( !bChecked )
+ nControl = nControl & ~EE_CNTRL_NOREDLINES;
+ else
+ nControl = nControl | EE_CNTRL_NOREDLINES;
+ pEditView->GetEditEngine()->SetControlWord( nControl );
+ }
+ break;
+ case TB_AUTOCORRECT: {
+ ULONG nControl = pEditView->GetEditEngine()->GetControlWord();
+ if ( bChecked )
+ nControl = nControl & ~EE_CNTRL_AUTOCORRECT;
+ else
+ nControl = nControl | EE_CNTRL_AUTOCORRECT;
+ pEditView->GetEditEngine()->SetControlWord( nControl );
+ }
+ break;
+ case TB_STDSEL: if ( bChecked )
+ pEditView->SetSelectionMode( EE_SELMODE_TXTONLY );
+ else
+ pEditView->SetSelectionMode( EE_SELMODE_STD );
+ break;
+ case TB_FLAT: pEditEngine->SetFlatMode( !pEditEngine->IsFlatMode() );
+ break;
+ case TB_COLORS: {
+ ULONG nControl = pEditView->GetEditEngine()->GetControlWord();
+ if ( bChecked )
+ nControl = nControl | EE_CNTRL_NOCOLORS;
+ else
+ nControl = nControl & ~EE_CNTRL_NOCOLORS;
+ pEditView->GetEditEngine()->SetControlWord( nControl );
+ }
+// aViewWin.Invalidate();
+ pEditView->GetEditEngine()->Draw( pEditView->GetWindow(), pEditView->GetOutputArea(), pEditView->GetVisArea().TopLeft() );
+ break;
+ case TB_OUTL: {
+ ULONG nControl = pEditView->GetEditEngine()->GetControlWord();
+ if ( !bChecked )
+ nControl = nControl | EE_CNTRL_OUTLINER;
+ else
+ nControl = nControl & ~EE_CNTRL_OUTLINER;
+ pEditView->GetEditEngine()->SetControlWord( nControl );
+ }
+ break;
+ case TB_POLY: {
+ if ( !bChecked )
+ CreatePolygon();
+ else
+ pEditView->GetEditEngine()->ClearPolygon();
+ }
+ break;
+ case TB_IDLE: pEditEngine->EnableIdleFormatter( !pEditEngine->IsIdleFormatterEnabled() );
+ break;
+ case TB_INSFLD: {
+ static BYTE nFld = 0;
+ if ( nFld > 2 )
+ nFld = 0;
+ if ( nFld == 0 )
+ {
+ SvxFieldItem aFld( SvxURLField( String( RTL_CONSTASCII_USTRINGPARAM( "www.mopo.de" ) ), String( RTL_CONSTASCII_USTRINGPARAM( "Bla" ) ), SVXURLFORMAT_REPR ), EE_FEATURE_FIELD );
+ pEditView->InsertField( aFld );
+ }
+ else if ( nFld == 1 )
+ pEditView->InsertField( SvxFieldItem( SvxURLField( String( RTL_CONSTASCII_USTRINGPARAM( "www.mopo.de" ) ), String( RTL_CONSTASCII_USTRINGPARAM( "Morgenpost" ) ), SVXURLFORMAT_URL ), EE_FEATURE_FIELD ) );
+ else if ( nFld == 2 )
+ pEditView->InsertField( SvxFieldItem( SvxDateField( Date( 1,1,1995 ), SVXDATETYPE_FIX, SVXDATEFORMAT_D ), EE_FEATURE_FIELD ) );
+
+ nFld++;
+ }
+ break;
+ case TB_UPDFLD: pEditEngine->UpdateFields();
+ break;
+ case TB_INSERT: pEditView->SetInsertMode( !pEditView->IsInsertMode() );
+ break;
+ case TB_FONT1: pNewItem = new SvxFontItem( FAMILY_ROMAN, String( RTL_CONSTASCII_USTRINGPARAM( "Times New Roman" ) ), String(), PITCH_DONTKNOW, RTL_TEXTENCODING_MS_1252, EE_CHAR_FONTINFO );
+ break;
+ case TB_FONT2: pNewItem = new SvxFontItem( FAMILY_SWISS, String( RTL_CONSTASCII_USTRINGPARAM( "Helv" ) ), String(), PITCH_DONTKNOW, RTL_TEXTENCODING_MS_1252, EE_CHAR_FONTINFO );
+ break;
+/*
+ case TB_FONT:
+ {
+ FontDialog* pDlg = new FontDialog( this, WB_SVLOOK );
+ pDlg->SetPrinter( pPrinter );
+ Font aFont = pEditEngine->CreateFontFromItemSet( pEditView->GetAttribs() );
+ MapMode aPntMode( MAP_POINT );
+ MapMode aCurrent( aViewWin.GetMapMode() );
+ Size aSz( aViewWin.LogicToLogic( aFont.GetSize(), &aCurrent, &aPntMode ) );
+ aSz.Width() *= 10;
+ aSz.Height() *= 10;
+ aFont.SetSize( aSz );
+ pDlg->SetSelectFont( aFont );
+ if ( pDlg->Execute() )
+ {
+ Font aNewFont( pDlg->GetSelectFont() );
+ aSz = aViewWin.LogicToLogic( aNewFont.GetSize(), &aPntMode, &aCurrent );
+ aSz.Width() /= 10;
+ aSz.Height() /= 10;
+ aNewFont.SetSize( aSz );
+
+ SfxItemSet aSet( pEditEngine->GetEmptyItemSet() );
+
+ pEditEngine->SetFontInfoInItemSet( aSet, aNewFont );
+ pEditView->SetAttribs( aSet );
+ }
+ delete pDlg;
+ }
+ break;
+*/
+ case TB_BOLD: if ( bChecked )
+ pNewItem = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT);
+ else
+ pNewItem = new SvxWeightItem( WEIGHT_BOLD, EE_CHAR_WEIGHT);
+ break;
+ case TB_ITALIC: if ( bChecked )
+ pNewItem = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC );
+ else
+ pNewItem = new SvxPostureItem( ITALIC_NORMAL, EE_CHAR_ITALIC );
+ break;
+ case TB_UNDERLINE: if ( bChecked )
+ pNewItem = new SvxUnderlineItem( UNDERLINE_NONE, EE_CHAR_UNDERLINE );
+ else
+ pNewItem = new SvxUnderlineItem( UNDERLINE_SINGLE, EE_CHAR_UNDERLINE );
+ break;
+ case TB_WLM: pNewItem = new SvxWordLineModeItem( !bChecked, EE_CHAR_WLM );
+ break;
+ case TB_PKERN: pNewItem = new SvxAutoKernItem( !bChecked, EE_CHAR_PAIRKERNING );
+ break;
+ case TB_KERN: if ( bChecked )
+ pNewItem = new SvxKerningItem( 0, EE_CHAR_KERNING );
+ else
+ pNewItem = new SvxKerningItem( 100, EE_CHAR_KERNING);
+ break;
+ case TB_SUPER: if ( bChecked )
+ pNewItem = new SvxEscapementItem( SVX_ESCAPEMENT_OFF, EE_CHAR_ESCAPEMENT);
+ else
+// pNewItem = new SvxEscapementItem( SVX_ESCAPEMENT_SUPERSCRIPT, EE_CHAR_ESCAPEMENT);
+ pNewItem = new SvxEscapementItem( 50, 100, EE_CHAR_ESCAPEMENT );
+ break;
+ case TB_SUB: if ( bChecked )
+ pNewItem = new SvxEscapementItem( SVX_ESCAPEMENT_OFF, EE_CHAR_ESCAPEMENT);
+ else
+// pNewItem = new SvxEscapementItem( SVX_ESCAPEMENT_SUBSCRIPT, EE_CHAR_ESCAPEMENT);
+ pNewItem = new SvxEscapementItem( -50, 100, EE_CHAR_ESCAPEMENT );
+ break;
+ case TB_GREEN: pNewItem = new SvxColorItem( Color(COL_GREEN), EE_CHAR_COLOR);
+ break;
+ case TB_RED: pNewItem = new SvxColorItem( Color(COL_RED), EE_CHAR_COLOR);
+ break;
+ case TB_BLACK: pNewItem = new SvxColorItem( Color(COL_BLACK), EE_CHAR_COLOR);
+ break;
+ case TB_SBL: pNewItem = new SvxLineSpacingItem( 0, EE_PARA_SBL );
+ if ( bChecked )
+ {
+ ((SvxLineSpacingItem*)pNewItem)->SetInterLineSpace( 0 );
+ }
+ else
+ {
+ ((SvxLineSpacingItem*)pNewItem)->SetPropLineSpace( 150 );
+ }
+ break;
+ case TB_SBSA: pNewItem = new SvxULSpaceItem( EE_PARA_ULSPACE );
+ if ( !bChecked )
+ {
+ ((SvxULSpaceItem*)pNewItem)->SetUpper( 400 );
+ ((SvxULSpaceItem*)pNewItem)->SetLower( 400 );
+ }
+ break;
+ case TB_LR: pNewItem = new SvxLRSpaceItem( EE_PARA_LRSPACE );
+ if ( !bChecked )
+ {
+ ((SvxLRSpaceItem*)pNewItem)->SetTxtLeft( 1000 );
+ ((SvxLRSpaceItem*)pNewItem)->SetTxtFirstLineOfst( -500 );
+ ((SvxLRSpaceItem*)pNewItem)->SetRight( 500 );
+ }
+ break;
+ case TB_DEFTAB: if ( bChecked )
+ pEditEngine->SetDefTab( 2000 );
+ else
+ pEditEngine->SetDefTab( 600 );
+ pEditView->ShowCursor();
+ aToolBox.CheckItem( nId, !bChecked );
+ break;
+ case TB_DRAW: {
+ pTmpWindow->SetMapMode( aViewWin.GetMapMode() );
+ pTmpWindow->SetBackgroundBrush( Brush( Color( COL_GRAY ) ) );
+ pTmpWindow->SetFillInBrush( Brush( Color( COL_LIGHTGRAY ) ) );
+ pTmpWindow->Show();
+ pTmpWindow->Invalidate();
+ pTmpWindow->Update();
+ pTmpWindow->DrawText( Point( 20, 20 ), String( RTL_CONSTASCII_USTRINGPARAM( "It's a Test..." ) ) );
+ Rectangle aRect( Point( 500, 500 ), Size( 10000, 4000 ) );
+ pTmpWindow->DrawRect( aRect );
+ pEditEngine->Draw( pTmpWindow, aRect, Point( 0, 0 ) );
+ nRotation = 0;
+ }
+ break;
+ case TB_ROTATE: {
+ nRotation += 100;
+ if ( nRotation == 3600 )
+ nRotation = 0;
+ pTmpWindow->SetMapMode( aViewWin.GetMapMode() );
+ pTmpWindow->SetBackgroundBrush( Brush( Color( COL_LIGHTGRAY ) ) );
+ pTmpWindow->SetFillInBrush( Brush( Color( COL_LIGHTGRAY ) ) );
+ pTmpWindow->Show();
+ pTmpWindow->Invalidate();
+ pTmpWindow->Update();
+ pTmpWindow->DrawText( Point( 20, 20 ), String( RTL_CONSTASCII_USTRINGPARAM( "It's a Test..." ) ) );
+ Rectangle aRect( Point( 500, 500 ), Size( 10000, 4000 ) );
+ pEditEngine->Draw( pTmpWindow, Point( 2000, 4000 ), nRotation );
+ }
+ break;
+
+ case TB_MOVE:
+ {
+ ESelection aESel = pEditView->GetSelection();
+ USHORT nStartPara = Min( aESel.nStartPara, aESel.nEndPara );
+ USHORT nEndPara = Max( aESel.nStartPara, aESel.nEndPara );
+ pEditView->MoveParagraphs( Range(nStartPara,nEndPara), 2 );
+ }
+ break;
+ case TB_PARATTR1:
+ {
+ pEditEngine->SetUpdateMode( FALSE );
+ USHORT nPara = 0;
+ SfxItemSet aSet( pEditEngine->GetEmptyItemSet() );
+ aSet.Put( SvxFontItem( FAMILY_DECORATIVE, String( RTL_CONSTASCII_USTRINGPARAM( "StarBats" ) ), String(),PITCH_DONTKNOW, RTL_TEXTENCODING_MS_1252, EE_CHAR_FONTINFO ) );
+ aSet.Put( SvxColorItem( Color(COL_MAGENTA), EE_CHAR_COLOR ) );
+ aSet.Put( SvxFontHeightItem(600, 100, EE_CHAR_FONTHEIGHT) );
+ aSet.Put( SvxPostureItem( ITALIC_NORMAL, EE_CHAR_ITALIC ) );
+ aSet.Put( SvxLRSpaceItem( 0, 0, 1000, 0, EE_PARA_LRSPACE ) );
+ pEditView->SetParaAttribs( aSet, nPara );
+ pEditEngine->SetUpdateMode( TRUE );
+ pEditView->ShowCursor();
+ }
+ break;
+ case TB_BINOBJ1:
+ {
+ delete pBinObj;
+ pBinObj = pEditEngine->CreateTextObject();
+ }
+ break;
+ case TB_BINOBJ1b:
+ {
+ delete pBinObj;
+ pBinObj = pEditView->CreateTextObject();
+ }
+ break;
+ case TB_CLONEBIN:
+ {
+ if ( pBinObj )
+ {
+ EditTextObject* p = pBinObj->Clone();
+ delete pBinObj;
+ pBinObj = p;
+ }
+ }
+ break;
+ case TB_BINOBJ2b:
+ {
+ if ( pBinObj )
+ {
+ pEditView->InsertText( *pBinObj );
+ }
+ }
+ break;
+ case TB_BINOBJ3:
+ {
+ if ( !pFileDialogBox2->Execute() )
+ return FALSE;
+ DirEntry aDirEntry( pFileDialogBox2->GetPath() );
+ SvFileStream aStrm( aDirEntry.GetFull(), STREAM_WRITE | STREAM_TRUNC );
+ EditTextObject* pTmpObj = pEditEngine->CreateTextObject();
+ pTmpObj->Store( aStrm );
+ DBG_ASSERT( !aStrm.GetError(), "Store: Error!" );
+ delete pTmpObj;
+ }
+ break;
+ case TB_BINOBJ4:
+ {
+ if ( !pFileDialogBox->Execute() )
+ return FALSE;
+ DirEntry aDirEntry( pFileDialogBox->GetPath() );
+ SvFileStream aStrm( aDirEntry.GetFull(), STREAM_READ );
+ delete pBinObj;
+ pBinObj = EditTextObject::Create( aStrm );
+// EditTextObject* pTmpObj = pEditEngine->CreateTextObject( aStrm );
+// pEditEngine->SetText( *pTmpObj );
+// pEditView->ShowCursor();
+// delete pTmpObj;
+ }
+ break;
+ case TB_OPEN:
+ case TB_OPEN2:
+ {
+ if ( !pFileDialogBox->Execute() )
+ return FALSE;
+ DirEntry aDirEntry( pFileDialogBox->GetPath() );
+ aDirEntry.ToAbs();
+ String aFileName( aDirEntry.GetFull() );
+ SvFileStream aStrm( aFileName, STREAM_READ );
+ if ( aStrm.GetError() )
+ InfoBox( 0, String( RTL_CONSTASCII_USTRINGPARAM( "StreamError!" ) ) ).Execute();
+ Application::EnterWait();
+ if ( nId == TB_OPEN )
+ {
+ if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "rtf" ) )
+ pEditEngine->Read( aStrm, EE_FORMAT_RTF );
+ if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "htm" ) )
+ pEditEngine->Read( aStrm, EE_FORMAT_HTML );
+ if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "html" ) )
+ pEditEngine->Read( aStrm, EE_FORMAT_HTML );
+ else if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "bin" ) )
+ pEditEngine->Read( aStrm, EE_FORMAT_BIN );
+ else
+ pEditEngine->Read( aStrm, EE_FORMAT_TEXT );
+
+ pEditView->ShowCursor();
+ }
+ else
+ {
+ if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "rtf" ) )
+ pEditView->Read( aStrm, EE_FORMAT_RTF );
+ else if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "bin" ) )
+ pEditView->Read( aStrm, EE_FORMAT_BIN );
+ else if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "html" ) )
+ pEditView->Read( aStrm, EE_FORMAT_HTML );
+ else if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "htm" ) )
+ pEditView->Read( aStrm, EE_FORMAT_HTML );
+ else
+ pEditView->Read( aStrm, EE_FORMAT_TEXT );
+ }
+
+ Application::LeaveWait();
+
+ }
+ break;
+ case TB_PRINT:
+ {
+ pPrinter->SetPageQueueSize( 1 );
+ PrintDialog aPrnDlg( this );
+ aPrnDlg.SetPrinter( pPrinter );
+ if ( aPrnDlg.Execute() )
+ {
+ pPrinter->StartJob( String( RTL_CONSTASCII_USTRINGPARAM( "SvEdit - PrinterTest" ) ) );
+ pPrinter->StartPage();
+ Size aSz( pEditEngine->CalcTextWidth(), pEditEngine->GetTextHeight() );
+ Pen aPen( PEN_SOLID );
+ aPen.SetColor( Color( COL_BLACK ) );
+ pPrinter->SetPen( aPen );
+ Rectangle aR( Point( 2000, 4000 ), aSz );
+ pPrinter->DrawRect( aR );
+ // So folgt auf IIISi, 75DPI kein Ausdruck!
+// pPrinter->SetClipRegion( Region( aR ) );
+ pEditEngine->Draw( pPrinter, Point( 2000, 4000 ), nRotation );
+// pPrinter->SetClipRegion();
+ pPrinter->EndPage();
+ pPrinter->EndJob();
+ }
+ }
+ break;
+ case TB_SAVE:
+ case TB_SAVE2:
+ {
+ if ( !pFileDialogBox2->Execute() )
+ return FALSE;
+ DirEntry aDirEntry( pFileDialogBox2->GetPath() );
+// DirEntry aDirEntry( String( RTL_CONSTASCII_USTRINGPARAM( "d:\\xxx.rtf" ) ) );
+ SvFileStream aStrm( aDirEntry.GetFull(), STREAM_WRITE | STREAM_TRUNC );
+ Application::EnterWait();
+ if ( nId == TB_SAVE )
+ {
+ if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "rtf") )
+ pEditEngine->Write( aStrm, EE_FORMAT_RTF );
+ else if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "bin" ) )
+ pEditEngine->Write( aStrm, EE_FORMAT_BIN );
+ else if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "html" ) )
+ pEditEngine->Write( aStrm, EE_FORMAT_HTML );
+ else if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "htm" ) )
+ pEditEngine->Write( aStrm, EE_FORMAT_HTML );
+ else
+ pEditEngine->Write( aStrm, EE_FORMAT_TEXT );
+ }
+ else
+ {
+ if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "rtf" ) )
+ pEditView->Write( aStrm, EE_FORMAT_RTF );
+ else if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "bin" ) )
+ pEditView->Write( aStrm, EE_FORMAT_BIN );
+ else if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "html" ) )
+ pEditView->Write( aStrm, EE_FORMAT_HTML );
+ else if ( aDirEntry.GetExtension().EqualsIgnoreCaseAscii( "htm" ) )
+ pEditView->Write( aStrm, EE_FORMAT_HTML );
+ else
+ pEditView->Write( aStrm, EE_FORMAT_TEXT );
+ }
+ Application::LeaveWait();
+ }
+ break;
+ case TB_ATTRIBS:
+ {
+ SfxItemSet aCurSet = pEditView->GetAttribs();
+ XubString aDebStr( String( RTL_CONSTASCII_USTRINGPARAM( "Attribute in Selektion:" ) ) );
+ aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "\nVorlage:" ) );
+ XubString aStyle;
+// pEditView->GetStyleSheet( aStyle, eFam );
+ aDebStr += aStyle;
+ for ( USHORT nWhich = EE_ITEMS_START; nWhich <= EE_ITEMS_END; nWhich++)
+ {
+ aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "\n" ) );
+ aDebStr += String::CreateFromInt32( nWhich );
+ aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "\t" ) );
+ if ( aCurSet.GetItemState( nWhich ) == SFX_ITEM_OFF )
+ aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "---" ) );
+ else if ( aCurSet.GetItemState( nWhich ) == SFX_ITEM_DONTCARE )
+ aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "XXX" ) );
+ else if ( aCurSet.GetItemState( nWhich ) == SFX_ITEM_ON )
+ {
+ const SfxPoolItem& rItem = aCurSet.Get( nWhich );
+ switch ( nWhich )
+ {
+ case EE_PARA_LRSPACE:
+ aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "FI=" ) );
+ aDebStr += String::CreateFromInt32( ((SvxLRSpaceItem&)rItem).GetTxtFirstLineOfst() );
+ aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( ", LI=" ) );
+ aDebStr += String::CreateFromInt32( ((SvxLRSpaceItem&)rItem).GetTxtLeft() );
+ aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( ", RI=" ) );
+ aDebStr += String::CreateFromInt32( ((SvxLRSpaceItem&)rItem).GetRight() );
+ break;
+ case EE_PARA_ULSPACE:
+ aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "SB=" ) );
+ aDebStr += String::CreateFromInt32( ((SvxULSpaceItem&)rItem).GetUpper() );
+ aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( ", SA=" ) );
+ aDebStr += String::CreateFromInt32( ((SvxULSpaceItem&)rItem).GetLower() );
+ break;
+ case EE_PARA_SBL:
+ aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "SBL=" ) );
+ aDebStr += String::CreateFromInt32( ((SvxLineSpacingItem&)rItem).GetInterLineSpace() );
+ break;
+ case EE_PARA_JUST:
+ aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "SvxAdust=" ) );
+ aDebStr += String::CreateFromInt32( (USHORT)((SvxAdjustItem&)rItem).GetAdjust() );
+ break;
+ case EE_PARA_TABS:
+ aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "Tabs = ?" ) );
+ break;
+ case EE_CHAR_COLOR:
+ {
+ aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "Color= " ) );
+ Color aColor( ((SvxColorItem&)rItem).GetValue() );
+ aDebStr += String::CreateFromInt32( aColor.GetRed() );
+ aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) );
+ aDebStr += String::CreateFromInt32( aColor.GetGreen() );
+ aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) );
+ aDebStr += String::CreateFromInt32( aColor.GetBlue() );
+ }
+ break;
+ case EE_CHAR_FONTINFO:
+ aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "Font=" ) );
+ aDebStr += ((SvxFontItem&)rItem).GetFamilyName();
+ break;
+ case EE_CHAR_FONTHEIGHT:
+ aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "Groesse=" ) );
+ aDebStr += String::CreateFromInt32( ((SvxFontHeightItem&)rItem).GetHeight() );
+ break;
+ case EE_CHAR_WEIGHT:
+ aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "FontWeight=" ) );
+ aDebStr += String::CreateFromInt32( ((SvxWeightItem&)rItem).GetWeight() );
+ break;
+ case EE_CHAR_UNDERLINE:
+ aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "FontUnderline=" ) );
+ aDebStr += String::CreateFromInt32( ((SvxUnderlineItem&)rItem).GetLineStyle() );
+ break;
+ case EE_CHAR_WLM:
+ aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "WordLineMode=" ) );
+ aDebStr += String::CreateFromInt32( ((SvxWordLineModeItem&)rItem).GetValue() );
+ break;
+ case EE_CHAR_STRIKEOUT:
+ aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "FontStrikeout=" ) );
+ aDebStr += String::CreateFromInt32( ((SvxCrossedOutItem&)rItem).GetStrikeout() );
+ break;
+ case EE_CHAR_ITALIC:
+ aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "FontPosture=" ) );
+ aDebStr += String::CreateFromInt32( ((SvxPostureItem&)rItem).GetPosture() );
+ break;
+ case EE_CHAR_OUTLINE:
+ aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "FontOutline=" ) );
+ aDebStr += String::CreateFromInt32( ((SvxContourItem&)rItem).GetValue() );
+ break;
+ case EE_CHAR_SHADOW:
+ aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "FontShadowed=" ) );
+ aDebStr += String::CreateFromInt32( ((SvxShadowedItem&)rItem).GetValue() );
+ break;
+ }
+ }
+ else
+ aDebStr += String( RTL_CONSTASCII_USTRINGPARAM( "?" ) );
+ }
+ InfoBox( 0, aDebStr ).Execute();
+ }
+ break;
+ }
+
+ if ( pNewItem )
+ {
+ SfxItemSet aSet = pEditView->GetEmptyItemSet();
+ aSet.Put( *pNewItem );
+ pEditView->SetAttribs( aSet );
+ delete pNewItem;
+ }
+ UpdateToolBox();
+ return 0;
+}
+
+void EditMainWindow::CreatePolygon()
+{
+ EditView* pEditView = aViewWin.GetEditView();
+ Size aSz = pEditView->GetWindow()->GetOutputSize();
+ Point aOffset( aSz.Width()/8, aSz.Height()/8 );
+ aSz.Width() *= 3;
+ aSz.Width() /= 4;
+ aSz.Height() *= 3;
+ aSz.Height() /= 4;
+ Polygon aPoly( 5 );
+ aPoly.SetPoint( Point( aSz.Width()/2, 0 ), 0 );
+ aPoly.SetPoint( Point( aSz.Width(), aSz.Height()/3 ), 1 );
+ aPoly.SetPoint( Point( aSz.Width()/2, aSz.Height() ), 2 );
+ aPoly.SetPoint( Point( 0, aSz.Height()/2 ), 3 );
+ aPoly.SetPoint( Point( aSz.Width()/2, 0 ), 4 );
+ PolyPolygon aPPoly( aPoly );
+ pEditView->GetEditEngine()->SetPolygon( aPPoly );
+ pEditView->SetOutputArea( Rectangle( aOffset, aSz ) );
+ ULONG nWord = pEditView->GetControlWord();
+ nWord &= ~(EV_CNTRL_AUTOSCROLL);
+ pEditView->SetControlWord( nWord );
+ aViewWin.Invalidate();
+}
+
+void __EXPORT EditMainWindow::GetFocus()
+{
+ aViewWin.GrabFocus();
+}
+
+IMPL_LINK_INLINE_START( EditMainWindow, HScrollHdl, ScrollBar *, pScrl )
+{
+ EditView* pEditView = aViewWin.GetEditView();
+ pEditView->Scroll( -pScrl->GetDelta(), 0, RGCHK_PAPERSZ1 );
+ return 0;
+}
+IMPL_LINK_INLINE_END( EditMainWindow, HScrollHdl, ScrollBar *, pScrl )
+
+IMPL_LINK_INLINE_START( EditMainWindow, VScrollHdl, ScrollBar *, pScrl )
+{
+ EditView* pEditView = aViewWin.GetEditView();
+ pEditView->Scroll( 0, -pScrl->GetDelta(), RGCHK_PAPERSZ1 );
+ return 0;
+}
+IMPL_LINK_INLINE_END( EditMainWindow, VScrollHdl, ScrollBar *, pScrl )
+
+void EditMainWindow::SetScrollBarRanges()
+{
+ EditView* pEditView = aViewWin.GetEditView();
+ long y = pEditView->GetEditEngine()->GetTextHeight();
+ long x = pEditView->GetEditEngine()->GetPaperSize().Width();
+
+ aHScrollBar.SetRange( Range( 0, x ) );
+ aVScrollBar.SetRange( Range( 0, y ) );
+}
+
+void EditMainWindow::SetScrollBars()
+{
+ EditView* pEditView = aViewWin.GetEditView();
+ Size aSz = GetOutputSizePixel();
+ Size aRealSz( aSz );
+ long nScrollbarWidthPixel = aVScrollBar.GetSizePixel().Width();
+ long nTBHeight = aToolBox.GetSizePixel().Height();
+ aSz.Height() -= nTBHeight;
+ Size aOrgSz( aSz );
+
+ // VScroll...
+ aSz.Height() += 2;
+ Point aPoint( ( aSz.Width()- nScrollbarWidthPixel+1 ), -1+nTBHeight);
+ aSz.Width() = nScrollbarWidthPixel;
+ aVScrollBar.SetPosSizePixel( aPoint, aSz );
+
+ // HScroll...
+ aSz = aOrgSz;
+ Point aPoint2( 0, aRealSz.Height()-aHScrollBar.GetSizePixel().Height()+1 ); // TB-Height schon drin!
+ aSz.Width() -= aVScrollBar.GetSizePixel().Width();
+ aSz.Width() += 2;
+
+ aSz.Height() = nScrollbarWidthPixel;
+ aHScrollBar.SetPosSizePixel( aPoint2, aSz );
+
+ aHScrollBar.SetVisibleSize( pEditView->GetOutputArea().GetWidth() );
+ aVScrollBar.SetVisibleSize( pEditView->GetOutputArea().GetHeight() );
+
+ SetScrollBarRanges();
+
+ aVScrollBar.Show();
+ aHScrollBar.Show();
+}
+
+void __EXPORT EditMainWindow::Resize()
+{
+ long nBorder = aVScrollBar.GetSizePixel().Width();
+ long nExtra = 10;
+ Size aTBSz = aToolBox.CalcWindowSizePixel();
+ Size aOutSzPixel( GetOutputSizePixel() );
+ aToolBox.SetSizePixel( Size( aOutSzPixel.Width(), aTBSz.Height()) );
+
+ aViewWin.SetSizePixel( Size( aOutSzPixel.Width()-nBorder-2*nExtra, aOutSzPixel.Height()-aTBSz.Height()-2*nExtra-nBorder) );
+
+ aViewWin.SetPosPixel( Point( nExtra, aTBSz.Height()+nExtra ) );
+
+ SetScrollBars();
+
+ EditView* pEditView = aViewWin.GetEditView();
+ if ( pEditView && pEditView->GetEditEngine()->GetPolygon() )
+ CreatePolygon();
+}
+
+IMPL_LINK( EditMainWindow, ShowStatus, EditStatus *, pStat )
+{
+ EditView* pEditView = aViewWin.GetEditView();
+ EditEngine* pEditEngine = pEditView->GetEditEngine();
+ if ( ( pStat->GetStatusWord() & EE_STAT_TEXTWIDTHCHANGED ) || ( pStat->GetStatusWord() & EE_STAT_TEXTHEIGHTCHANGED ) )
+ {
+ aViewWin.MarkOutputArea();
+ if ( pEditEngine->GetTextHeight() < (ULONG)pEditView->GetOutputArea().GetHeight() )
+ {
+ // Wird durch RGCHK_PAPERSZ1 'geklippt'
+ if ( !( pEditEngine->GetControlWord() & EE_CNTRL_AUTOPAGESIZE) )
+ pEditView->Scroll( -(long)pEditEngine->CalcTextWidth(), -(long)pEditEngine->GetTextHeight(), RGCHK_PAPERSZ1 );
+ }
+ SetScrollBarRanges();
+ }
+ if ( pStat->GetStatusWord() & EE_STAT_HSCROLL )
+ aHScrollBar.SetThumbPos( pEditView->GetVisArea().Left() );
+ if ( pStat->GetStatusWord() & EE_STAT_VSCROLL )
+ aVScrollBar.SetThumbPos( pEditView->GetVisArea().Top() );
+
+ return 0;
+}
+
+
+EditViewWindow::~EditViewWindow()
+{
+ // erst die angemeldeten Views zerstoeren
+ // (melden sich selbst ab)
+ MyView* pView = aViewList.First();
+ while ( pView )
+ {
+ delete pView;
+ pView = aViewList.Next();
+ }
+
+ pEditEngine->RemoveView( pEditView );
+ delete pEditView;
+ // Beim Zerstoeren der Styles am Ende, EditEngine noch nicht kaputt,
+ // wird der Handler gerufen, ich zerstore hier aber schon die View!
+ pEditEngine->SetStatusEventHdl( Link() );
+// SvxAutoCorrect* pAutoCorrekt = pEditEngine->GetAutoCorrect();
+// pEditEngine->SetAutoCorrect( 0 );
+// delete pAutoCorrekt;
+ delete pEditEngine;
+}
+
+EditViewWindow::EditViewWindow( Window* pParent ) :
+ Window( pParent ), aURLPtr( POINTER_HAND )
+{
+ SetBackgroundBrush( Brush( Color( COL_WHITE ) ) );
+ SetMapMode( MAP_100TH_MM );
+// EnableDrop();
+
+ SfxItemPool* pPool = EditEngine::CreatePool();
+ Font aFont = GetSettings().GetStyleSettings().GetAppFont();
+ MapMode aPntMode( MAP_POINT );
+ MapMode aCurrent( GetMapMode() );
+ Size aSz( LogicToLogic( Size( 12, 0 ), &aPntMode, &aCurrent ) );
+ aFont.SetName( String( RTL_CONSTASCII_USTRINGPARAM( "Times New Roman" ) ) );
+ pPool->SetPoolDefaultItem( SvxFontItem( aFont.GetFamily(), aFont.GetName(), String(),aFont.GetPitch(), aFont.GetCharSet(), EE_CHAR_FONTINFO ) );
+ pPool->SetPoolDefaultItem( SvxFontHeightItem( aSz.Width(), 100, EE_CHAR_FONTHEIGHT ) );
+ pEditEngine = new MyEditEngine( pPool );
+
+ Size aPaperSz( 10000,8000 );
+ pEditEngine->SetPaperSize( aPaperSz );
+
+ pEditView = new EditView( pEditEngine, this );
+ pEditView->SetBackgroundColor( Color( COL_WHITE ) );
+ pEditView->SetOutputArea( Rectangle( Point( 100, 100 ), aPaperSz ) );
+ pEditEngine->SetDefaultLanguage( LANGUAGE_ENGLISH );
+ pEditEngine->InsertView( pEditView );
+
+ SetPosSizePixel( Point( 10, 10 ), Size( 600, 400 ) );
+ SetPen( PEN_NULL );
+ Show();
+
+ // Feldbefehle grau hinterlegen
+ ULONG n = pEditEngine->GetControlWord();
+ n = n | (EE_CNTRL_MARKFIELDS|EE_CNTRL_AUTOCOMPLETE);
+ pEditEngine->SetControlWord( n );
+
+ // Test: Autozentrierung
+// ULONG n = pEditEngine->GetControlWord();
+// n = n | EE_CNTRL_AUTOPAGESIZE;
+// pEditEngine->SetControlWord( n );
+
+ // OneLineSpeling
+#ifdef WNT
+// pEditEngine->CreateSpeller( DirEntry( String( RTL_CONSTASCII_USTRINGPARAM( "n:\\offenv\\wnti" ) ) ),
+// DirEntry( String( RTL_CONSTASCII_USTRINGPARAM( "n:\\offenv\\wnti" ) ) ) );
+// pEditEngine->GetSpeller()->SetActualLanguage( LANGUAGE_GERMAN );
+// pEditEngine->GetSpeller()->SetDefaultLanguage( LANGUAGE_GERMAN );
+// pEditEngine->GetSpeller()->SetMinTrail( 2 );
+
+ // AutoCorrect wird nie zerstoert
+// pEditEngine->SetAutoCorrect( new SvxAutoCorrect( String( RTL_CONSTASCII_USTRINGPARAM( "d:\\prj\\office\\autotext\\autocorr.dat" ) ) ) );
+#endif
+}
+
+void __EXPORT EditViewWindow::Paint( const Rectangle& rRec )
+{
+ if ( pEditView->GetEditEngine()->GetPolygon() )
+ {
+ // Die Punkte des Polygons beziehen sich auf die View...
+ MapMode aMapMode( GetMapMode() );
+ aMapMode.SetOrigin( pEditView->GetOutputArea().TopLeft() );
+ SetMapMode( aMapMode );
+ DrawPolyPolygon( *pEditView->GetEditEngine()->GetPolygon() );
+ aMapMode.SetOrigin( Point() );
+ SetMapMode( aMapMode );
+ }
+ pEditView->Paint( rRec );
+ MarkOutputArea();
+}
+
+void EditViewWindow::MarkOutputArea()
+{
+ static Rectangle aCurFrame;
+ Rectangle aOutArea( pEditView->GetOutputArea() );
+ aOutArea = LogicToPixel( aOutArea );
+ aOutArea.Left()--;
+ aOutArea.Right()++;
+ aOutArea.Top()--;
+ aOutArea.Bottom()++;
+ aOutArea = PixelToLogic( aOutArea );
+ SetPen( Pen( Color( COL_RED ) ) );
+ SetFillInBrush( Brush( BRUSH_NULL ) );
+ DrawRect( aOutArea );
+ if ( !aCurFrame.IsEmpty() )
+ {
+ if ( aCurFrame.Left() < aOutArea.Left() )
+ Invalidate( Rectangle( aCurFrame.TopLeft(), Size( aOutArea.Left()-aCurFrame.Left(), aCurFrame.GetHeight() ) ) );
+ if ( aCurFrame.Right() > aOutArea.Right() )
+ {
+ long nW = aCurFrame.Right() - aOutArea.Right();
+ Point aPos( aCurFrame.TopRight() );
+ aPos.X() -= nW;
+ Invalidate( Rectangle( aPos, Size( nW, aCurFrame.GetHeight() ) ) );
+ }
+ if ( aCurFrame.Top() < aOutArea.Top() )
+ Invalidate( Rectangle( aCurFrame.TopLeft(), Size( aCurFrame.GetWidth(), aOutArea.Top() - aCurFrame.Top() ) ) );
+ if ( aCurFrame.Bottom() > aOutArea.Bottom() )
+ {
+ long nH = aCurFrame.Bottom() - aOutArea.Bottom();
+ Point aPos( aCurFrame.BottomLeft() );
+ aPos.Y() -= nH;
+ Invalidate( Rectangle( aPos, Size( aCurFrame.GetWidth(), nH ) ) );
+ }
+ }
+ aCurFrame = aOutArea;
+}
+
+void __EXPORT EditViewWindow::Resize()
+{
+ Size aPaperSz( GetOutputSize() );
+ pEditView->SetOutputArea( Rectangle( Point(0,0), aPaperSz ) );
+ pEditEngine->SetPaperSize( Size( aPaperSz.Width()*1, aPaperSz.Height()*1 ) );
+ pEditView->ShowCursor();
+ Invalidate();
+}
+
+void __EXPORT EditViewWindow::KeyInput( const KeyEvent& rKEvt )
+{
+ sal_Unicode nCharCode = rKEvt.GetCharCode();
+
+ USHORT nCode = rKEvt.GetKeyCode().GetCode();
+ // Auswertung fuer besondere Einstellungen....
+ if ( ( nCode == KEY_A) && rKEvt.GetKeyCode().IsMod1() )
+ pEditView->SetSelection( ESelection( 0, 0, 0xFFFF, 0xFFFF ) );
+ else if ( ( nCode == KEY_R ) && rKEvt.GetKeyCode().IsMod2() )
+ Invalidate();
+ else if ( ( nCode == KEY_L ) && rKEvt.GetKeyCode().IsMod2() )
+ {
+ ULONG n = pEditEngine->GetControlWord();
+ n = n | EE_CNTRL_ONECHARPERLINE;
+ pEditEngine->SetControlWord( n );
+ pEditEngine->QuickFormatDoc();
+ }
+ else if ( ( nCode == KEY_Z ) && rKEvt.GetKeyCode().IsMod2() )
+ {
+ pEditView->RemoveAttribs();
+ }
+ else if ( ( nCode == KEY_V ) && rKEvt.GetKeyCode().IsMod2() )
+ {
+ pEditEngine->SetVertical( TRUE );
+ Invalidate();
+ }
+ else if ( ( ( nCode == KEY_ADD ) || ( nCode == KEY_SUBTRACT ) )&& rKEvt.GetKeyCode().IsMod2() )
+ {
+ short nDiff = ( nCode == KEY_ADD ) ? (+5) : (-5);
+ if ( nZoom > 1000 )
+ nDiff *= 20;
+ if ( nZoom <= 25 )
+ nDiff /= 5;
+ if ( ( nZoom + nDiff ) > 0 )
+ nZoom += nDiff;
+ MapMode aMapMode( MAP_100TH_MM, Point(0,0), Fraction(nZoom,100), Fraction(nZoom,100) );
+ SetMapMode( aMapMode );
+ ((EditMainWindow*)GetParent())->SetTitle();
+
+ if ( rKEvt.GetKeyCode().IsMod1() )
+ {
+ InfoBox( 0, String( RTL_CONSTASCII_USTRINGPARAM( "ChangingRefMapMode..." ) ) ).Execute();
+ pEditEngine->SetRefMapMode( aMapMode );
+ }
+ Invalidate();
+ }
+ else if ( rKEvt.GetKeyCode().IsMod2() &&
+ ( ( nCode == KEY_UP) || ( nCode == KEY_DOWN ) ||
+ ( nCode == KEY_LEFT ) || ( nCode == KEY_RIGHT ) ) )
+ {
+ if( rKEvt.GetKeyCode().IsMod1() )
+ {
+ ULONG nCtrl = pEditEngine->GetControlWord();
+ if ( ! ( nCtrl & EE_CNTRL_STRETCHING ) )
+ {
+ nCtrl |= EE_CNTRL_STRETCHING;
+ pEditEngine->SetControlWord( nCtrl );
+ }
+ USHORT nX, nY;
+ pEditEngine->GetGlobalCharStretching( nX, nY );
+ if ( ( nCode == KEY_DOWN ) && ( nY > 5 ) )
+ nY += 5;
+ else if ( nCode == KEY_UP )
+ nY -= 5;
+ else if ( nCode == KEY_RIGHT )
+ nX += 5;
+ else if ( ( nCode == KEY_LEFT ) && ( nX > 5 ) )
+ nX -= 5;
+ pEditEngine->SetGlobalCharStretching( nX, nY );
+ ((EditMainWindow*)GetParent())->SetTitle();
+ }
+ else // ZeichenAttr
+ {
+ SfxItemSet aAttrs( pEditView->GetAttribs() );
+ SfxItemSet aNewAttrs( pEditEngine->GetEmptyItemSet() );
+ const SvxFontWidthItem& rItem = (const SvxFontWidthItem&)aAttrs.Get( EE_CHAR_FONTWIDTH );
+ USHORT nProp = rItem.GetProp();
+ if ( nCode == KEY_RIGHT )
+ nProp += 5;
+ else if ( ( nCode == KEY_LEFT ) && ( nProp > 5 ) )
+ nProp -= 5;
+ aNewAttrs.Put( SvxFontWidthItem( 0, nProp, EE_CHAR_FONTWIDTH ) );
+ pEditView->SetAttribs( aNewAttrs );
+ }
+ }
+ else if ( ( nCode == KEY_O ) && rKEvt.GetKeyCode().IsMod2() )
+ {
+ MapMode aMapMode( GetMapMode() );
+ aMapMode.SetOrigin( Point( 41, 41 ) );
+ SetMapMode( aMapMode );
+ Invalidate();
+ }
+ else if ( ( nCode == KEY_B ) && rKEvt.GetKeyCode().IsMod2() )
+ {
+ SfxItemSet aSet = pEditView->GetEmptyItemSet();
+ aSet.Put( SvxFontHeightItem(800, 100, EE_CHAR_FONTHEIGHT) );
+ pEditView->SetAttribs( aSet );
+ }
+ else if ( ( nCode == KEY_P ) && rKEvt.GetKeyCode().IsMod2() )
+ {
+// ESelection aSel = pEditView->GetSelection();
+// for ( ULONG n = aSel.nStartPara; n <= aSel.nEndPara; n++ )
+// {
+// InfoBox( 0, pEditEngine->GetText( n ) ).Execute();
+// }
+ InfoBox( 0, pEditView->GetSelected() ).Execute();
+
+ }
+ else if ( rKEvt.GetKeyCode().IsMod2() &&
+ ( nCode >= KEY_1 ) && ( nCode <= KEY_9 ) )
+ {
+ ULONG nEECtrl = pEditEngine->GetControlWord();
+ nEECtrl = nEECtrl | EE_CNTRL_AUTOPAGESIZE;
+ pEditEngine->SetControlWord( nEECtrl );
+
+ ULONG nEVCtrl = pEditView->GetControlWord();
+ nEVCtrl |= EV_CNTRL_AUTOSIZE;
+ pEditView->SetControlWord( nEVCtrl );
+
+ pEditView->SetAnchorMode( (EVAnchorMode)(nCode-KEY_1) );
+ pEditView->SetOutputArea( Rectangle( Point(0,0), GetOutputSize() ) );
+ pEditEngine->SetMaxAutoPaperSize( GetOutputSize() );
+ pEditEngine->SetPaperSize( Size( 0, 0 ) );
+ }
+ else if ( rKEvt.GetKeyCode().IsMod2() && ( nCode == KEY_0 ) )
+ {
+ ULONG nEVCtrl = pEditView->GetControlWord();
+ nEVCtrl = nEVCtrl | EV_CNTRL_AUTOSIZE;
+ pEditView->SetControlWord( nEVCtrl );
+
+ Size aOutSz( GetOutputSize() );
+ Size aPaperSz( aOutSz.Width() / 2, 0 );
+ pEditView->SetOutputArea( Rectangle( Point(), aPaperSz ) );
+ pEditEngine->SetPaperSize( aPaperSz );
+ // Max-Height wird bei View verwendet,
+ // MinSize/MaxSize nur, wenn AUTOPAGESIZE ( KEY_1 - KEY_9 )
+ pEditEngine->SetMaxAutoPaperSize( Size( aOutSz.Width() / 2, aOutSz.Height() / 2 ) );
+ pEditEngine->SetMinAutoPaperSize( Size( aOutSz.Width() / 8, aOutSz.Height() / 8 ) );
+ }
+ else if ( ( nCode == KEY_J ) && rKEvt.GetKeyCode().IsMod2() )
+ {
+ Size aTextSz( pEditEngine->CalcTextWidth(), pEditEngine->GetTextHeight() );
+ Rectangle aRect( pEditView->GetOutputArea().TopLeft(), aTextSz );
+ Brush aTmpBrush( Color( COL_LIGHTBLUE ), BRUSH_25 );
+ Brush aOldBrush( GetFillInBrush() );
+ SetFillInBrush( aTmpBrush );
+ DrawRect( aRect );
+ SetFillInBrush( aOldBrush );
+ pEditView->Paint( aRect );
+ }
+ else if ( ( nCode == KEY_H ) && rKEvt.GetKeyCode().IsMod2() )
+ {
+ Push();
+ Size aSz( pEditEngine->CalcTextWidth(), pEditEngine->GetTextHeight() );
+ Pen aPen( PEN_SOLID );
+ Brush aBrush( Color( COL_GRAY ), BRUSH_SOLID );
+ aPen.SetColor( Color( COL_BLACK ) );
+ SetPen( aPen );
+ SetFillInBrush( aBrush );
+ Rectangle aR( pEditView->GetOutputArea().TopLeft(), aSz );
+ DrawRect( aR );
+ Pop();
+ pEditEngine->Draw( this, pEditView->GetOutputArea() );
+ pEditView->ShowCursor( TRUE, TRUE );
+ }
+
+ // Eingabe an EditEngine...
+ else
+ {
+ BOOL bDone = pEditView->PostKeyEvent( rKEvt );
+ if ( !bDone )
+ Window::KeyInput( rKEvt );
+ }
+
+ ((EditMainWindow*)GetParent())->UpdateToolBox();
+}
+
+void __EXPORT EditViewWindow::MouseMove( const MouseEvent& rMEvt )
+{
+ Point aPos = PixelToLogic( rMEvt.GetPosPixel() );
+ if ( pEditView->GetOutputArea().IsInside( aPos ) )
+ {
+ const SvxFieldItem* pField = pEditView->GetFieldUnderMousePointer();
+ if ( pField )
+ SetPointer( aURLPtr );
+ else
+ SetPointer( pEditView->GetPointer() );
+
+// aPos -= pEditView->GetOutputArea().TopLeft();
+// aPos += pEditView->GetVisArea().TopLeft();
+// if ( pEditView->GetEditEngine()->IsTextPos( aPos, PixelToLogic( Size( 5, 0 ) ).Width() ) )
+// SetPointer( pEditView->GetPointer() );
+// else
+// SetPointer( Pointer( POINTER_REFHAND ) );
+
+ }
+ else
+ SetPointer( aStdPtr );
+
+// static long x = 0;
+// x++;
+// DBG_ASSERT( x < 1000, String( RTL_CONSTASCII_USTRINGPARAM( "?" ) ) );
+ pEditView->MouseMove( rMEvt );
+}
+
+void __EXPORT EditViewWindow::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ GrabFocus();
+ pEditView->MouseButtonDown( rMEvt );
+}
+
+void __EXPORT EditViewWindow::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ pEditView->MouseButtonUp( rMEvt );
+ ((EditMainWindow*)GetParent())->UpdateToolBox();
+}
+
+void __EXPORT EditViewWindow::Command( const CommandEvent& rCEvt )
+{
+ if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
+ {
+ if( pEditView->IsWrongSpelledWordAtPos( rCEvt.GetMousePosPixel() ) )
+ pEditView->ExecuteSpellPopup( rCEvt.GetMousePosPixel() );
+ }
+ else
+ pEditView->Command(rCEvt);
+
+}
+
+BOOL __EXPORT EditViewWindow::Drop( const DropEvent& rEvt )
+{
+ return pEditView->Drop( rEvt );
+}
+
+BOOL __EXPORT EditViewWindow::QueryDrop( DropEvent& rEvt )
+{
+ return pEditView->QueryDrop( rEvt );
+}
+
+// --- aEditApp ------------------------------------------------------
+
+void __EXPORT EditApp::Main()
+{
+#ifdef WNT
+ SvFactory::Init();
+#endif
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr = createApplicationServiceManager();
+ ::comphelper::setProcessServiceFactory( xSMgr );
+
+ EditDLL aEditDll;
+ SvxGlobalItemData aItemData;
+ SvxFieldItem::GetClassManager().SV_CLASS_REGISTER( SvxDateField );
+ SvxFieldItem::GetClassManager().SV_CLASS_REGISTER( SvxURLField );
+
+ Help::EnableQuickHelp();
+
+ EditMainWindow aWindow;
+ Execute();
+}
+
+EditApp aEditApp;
diff --git a/svx/workben/makefile.mk b/svx/workben/makefile.mk
new file mode 100644
index 000000000000..4aa0a098f00a
--- /dev/null
+++ b/svx/workben/makefile.mk
@@ -0,0 +1,72 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=SVX
+TARGET=edittest
+TARGETTYPE=GUI
+LIBTARGET=NO
+
+ENABLE_EXCEPTIONS=TRUE
+
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+OBJFILES= $(OBJ)$/edittest.obj
+
+APP1TARGET= $(TARGET)
+APP1OBJS= $(OBJFILES)
+APP1LIBS= $(LB)$/svx.lib
+APP1STDLIBS=$(TOOLSLIB) \
+ $(VOSLIB) \
+ $(SO2LIB) \
+ $(SVTOOLLIB) \
+ $(SVLLIB) \
+ $(COMPHELPERLIB) \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(SALLIB) \
+ $(SFXLIB) \
+ $(SOTLIB) \
+ $(VCLLIB)
+
+
+#.IF "$(COM)"=="GCC"
+#ADDOPTFILES=$(OBJ)$/edittest.obj
+#add_cflagscxx="-frtti -fexceptions"
+#.ENDIF
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/svx/workben/msview/makefile.mk b/svx/workben/msview/makefile.mk
new file mode 100644
index 000000000000..ee4d384399d7
--- /dev/null
+++ b/svx/workben/msview/makefile.mk
@@ -0,0 +1,72 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=svx
+TARGET=msview
+LIBTARGET=NO
+TARGETTYPE=GUI
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+
+# --- Files --------------------------------------------------------
+
+OBJFILES= $(OBJ)$/msview.obj \
+ $(OBJ)$/xmlconfig.obj
+EXCEPTIONSFILES=$(OBJ)$/msview.obj \
+ $(OBJ)$/xmlconfig.obj
+
+APP1NOSAL= TRUE
+APP1TARGET= $(TARGET)
+APP1OBJS= $(OBJFILES)
+
+APP1STDLIBS= $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(COMPHELPERLIB) \
+ $(UCBHELPERLIB) \
+ $(UNOTOOLSLIB) \
+ $(TKLIB) \
+ $(VCLLIB) \
+ $(TOOLSLIB) \
+ $(SVTOOLLIB) \
+ $(SALLIB) \
+ $(VOSLIB) \
+ $(SOTLIB) \
+ $(VCLLIB) \
+ $(SVXLIB) \
+ $(SFXLIB)
+
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/svx/workben/msview/msview.cxx b/svx/workben/msview/msview.cxx
new file mode 100644
index 000000000000..baee57ad75dc
--- /dev/null
+++ b/svx/workben/msview/msview.cxx
@@ -0,0 +1,1224 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <vector>
+#include <map>
+#include <algorithm>
+#include <boost/shared_ptr.hpp>
+#include <sot/storage.hxx>
+#ifndef _SVTOOLS_HRC
+#include <svtools/svtools.hrc>
+#endif
+
+#include <sal/main.h>
+#include <vcl/event.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/wrkwin.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/button.hxx>
+#include <vcl/lstbox.hxx>
+#include <svtools/filectrl.hxx>
+#include <tools/urlobj.hxx>
+#include <osl/file.hxx>
+#include <vcl/unohelp2.hxx>
+#include <svtools/svtreebx.hxx>
+#include <svtools/svmedit.hxx>
+#include <sfx2/filedlghelper.hxx>
+
+#include <toolkit/unohlp.hxx>
+
+#include <tools/stream.hxx>
+#include <tools/resmgr.hxx>
+
+#include <comphelper/processfactory.hxx>
+#include <cppuhelper/servicefactory.hxx>
+#include <cppuhelper/bootstrap.hxx>
+
+#include <ucbhelper/contentbroker.hxx>
+#include <ucbhelper/configurationkeys.hxx>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/awt/XWindowPeer.hpp>
+#include <com/sun/star/awt/XToolkit.hpp>
+#include <com/sun/star/awt/WindowDescriptor.hpp>
+#include <com/sun/star/awt/WindowAttribute.hpp>
+#include <svx/msdffdef.hxx>
+
+#include <unotools/localfilehelper.hxx>
+
+#include "xmlconfig.hxx"
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star;
+
+///////////////////////////////////////////////////////////////////////
+
+enum CompareStatus { CMP_NOTYET = 0, CMP_EQUAL = 1, CMP_NOTEQUAL = 2, CMP_NOTAVAILABLE = 3 };
+static ColorData gColors[] = { COL_BLACK, COL_GREEN, COL_RED, COL_CYAN };
+
+class Atom
+{
+public:
+ ~Atom();
+
+ /** imports this atom and its child atoms */
+ static Atom* import( const DffRecordHeader& rRootRecordHeader, SvStream& rStCtrl );
+ static Atom* import( UINT16 nRecType, SvStream& rStCtrl );
+
+ inline const DffRecordHeader& getHeader() const;
+
+ /** returns true if at least one atim with the given nRecType is found */
+ inline bool hasChildAtom( sal_uInt16 nRecType ) const;
+
+ /** returns true if at least one atim with the given nRecType and nRecInstnace is found */
+ inline bool hasChildAtom( sal_uInt16 nRecType, sal_uInt16 nRecInstance ) const;
+
+ /** returns the first child atom with nRecType or NULL */
+ inline const Atom* findFirstChildAtom( sal_uInt16 nRecType ) const;
+
+ /** returns the next child atom after pLast with nRecType or NULL */
+ const Atom* findNextChildAtom( sal_uInt16 nRecType, const Atom* pLast ) const;
+
+ /** returns the first child atom with nRecType and nRecInstance or NULL */
+ inline const Atom* findFirstChildAtom( sal_uInt16 nRecType, sal_uInt16 nRecInstance ) const;
+
+ /** returns the next child atom after pLast with nRecType and nRecInstance or NULL */
+ const Atom* findNextChildAtom( sal_uInt16 nRecType, sal_uInt16 nRecInstance, const Atom* pLast ) const;
+
+ /** returns the first child atom or NULL */
+ inline const Atom* findFirstChildAtom() const;
+
+ /** returns the next child atom after pLast or NULL */
+ inline const Atom* findNextChildAtom( const Atom* pLast ) const;
+
+ /** returns true if this atom is a container */
+ inline bool isContainer() const;
+
+ /** seeks to the contents of this atom */
+ inline bool seekToContent() const;
+
+ /** returns the record type */
+ inline sal_uInt16 getType() const;
+
+ /** returns the record instance */
+ inline sal_uInt16 getInstance() const;
+
+ /** returns the record length */
+ inline sal_uInt32 getLength() const;
+
+ SvStream& getStream() const { return mrStream; }
+
+ bool operator==( const Atom& rAtom ) const;
+
+ CompareStatus getCompareStatus() const { return meStatus; }
+
+ void compare( Atom* pAtom );
+ bool compareContent( Atom& rAtom );
+
+ Atom* getCompareAtom() const { return mpCompareAtom; }
+ void setCompareAtom( Atom* pAtom ) { mpCompareAtom = pAtom; }
+
+private:
+ Atom( const DffRecordHeader& rRecordHeader, SvStream& rStCtrl );
+
+ // statics for compare
+ static Atom* skipAtoms( Atom* pContainer, Atom* pAtom, Atom* pSkipTo );
+ static Atom* findFirstEqualAtom( Atom* pCompare, Atom* pContainer, Atom* pSearch, int& nDistance );
+
+ SvStream& mrStream;
+ DffRecordHeader maRecordHeader;
+ Atom* mpFirstChild;
+ Atom* mpNextAtom;
+
+ CompareStatus meStatus;
+ Atom* mpCompareAtom;
+};
+
+bool Atom::operator==( const Atom& rAtom ) const
+{
+ return ( maRecordHeader.nRecType == rAtom.maRecordHeader.nRecType ) &&
+ ( maRecordHeader.nRecVer == rAtom.maRecordHeader.nRecVer ) &&
+ ( maRecordHeader.nRecInstance == rAtom.maRecordHeader.nRecInstance );
+}
+
+bool Atom::compareContent( Atom& rAtom )
+{
+ if( maRecordHeader.nRecLen == rAtom.maRecordHeader.nRecLen )
+ {
+ seekToContent();
+ rAtom.seekToContent();
+
+ SvStream& rStream1 = getStream();
+ SvStream& rStream2 = rAtom.getStream();
+
+ const int nBufferSize = 1024;
+ boost::shared_ptr< char > buffer1( new char[nBufferSize] );
+ boost::shared_ptr< char > buffer2( new char[nBufferSize] );
+
+ sal_uInt32 nLength = maRecordHeader.nRecLen;
+ sal_Size nRead = 0;
+ while( nLength )
+ {
+ sal_Size nRead = (nBufferSize < nLength) ? nBufferSize : nLength;
+ nRead = rStream1.Read( (void*)buffer1.get(), nRead );
+ if( nRead == 0 )
+ break;
+ if( rStream2.Read( (void*)buffer2.get(), nRead ) != nRead )
+ break;
+ if( memcmp( (void*)buffer1.get(), (void*)buffer2.get(), nRead ) != 0 )
+ break;
+
+ nLength -= nRead;
+ }
+
+ return nLength == 0;
+ }
+
+ return false;
+}
+
+inline bool Atom::hasChildAtom( sal_uInt16 nRecType ) const
+{
+ return findFirstChildAtom( nRecType ) != NULL;
+}
+
+inline bool Atom::hasChildAtom( sal_uInt16 nRecType, sal_uInt16 nRecInstance ) const
+{
+ return findFirstChildAtom( nRecType, nRecInstance ) != NULL;
+}
+
+inline const Atom* Atom::findFirstChildAtom( sal_uInt16 nRecType ) const
+{
+ return findNextChildAtom( nRecType, NULL );
+}
+
+inline const DffRecordHeader& Atom::getHeader() const
+{
+ return maRecordHeader;
+}
+
+inline const Atom* Atom::findFirstChildAtom( sal_uInt16 nRecType, sal_uInt16 nRecInstance ) const
+{
+ return findNextChildAtom( nRecType, nRecInstance, NULL );
+}
+
+inline const Atom* Atom::findFirstChildAtom() const
+{
+ return mpFirstChild;
+}
+
+inline const Atom* Atom::findNextChildAtom( const Atom* pLast ) const
+{
+ return pLast ? pLast->mpNextAtom : pLast;
+}
+
+inline bool Atom::isContainer() const
+{
+ return (bool)maRecordHeader.IsContainer();
+}
+
+inline bool Atom::seekToContent() const
+{
+ maRecordHeader.SeekToContent( mrStream );
+ return mrStream.GetError() == 0;
+}
+
+inline sal_uInt16 Atom::getType() const
+{
+ return maRecordHeader.nRecType;
+}
+
+inline sal_uInt16 Atom::getInstance() const
+{
+ return maRecordHeader.nRecInstance;
+}
+
+inline sal_uInt32 Atom::getLength() const
+{
+ return maRecordHeader.nRecLen;
+}
+
+Atom::Atom( const DffRecordHeader& rRecordHeader, SvStream& rStream )
+: maRecordHeader( rRecordHeader ),
+ mrStream( rStream ),
+ mpFirstChild( 0 ),
+ mpNextAtom( 0 ),
+ meStatus( CMP_NOTYET ),
+ mpCompareAtom( 0 )
+{
+ // check if we need to force this to a container
+ if( maRecordHeader.nRecVer != DFF_PSFLAG_CONTAINER )
+ {
+ AtomConfig* pAtomConfig = dynamic_cast< AtomConfig* >( gAtomConfigMap[ maRecordHeader.nRecType ].get() );
+ if( pAtomConfig && pAtomConfig->isContainer() )
+ {
+ maRecordHeader.nRecVer = DFF_PSFLAG_CONTAINER;
+ }
+ }
+
+ if( isContainer() )
+ {
+ if( seekToContent() )
+ {
+ DffRecordHeader aChildHeader;
+
+ Atom* pLastAtom = NULL;
+
+ while( (mrStream.GetError() == 0 ) && ( mrStream.Tell() < maRecordHeader.GetRecEndFilePos() ) )
+ {
+ mrStream >> aChildHeader;
+
+ if( mrStream.GetError() == 0 )
+ {
+ Atom* pAtom = new Atom( aChildHeader, mrStream );
+
+ if( pLastAtom )
+ pLastAtom->mpNextAtom = pAtom;
+ if( mpFirstChild == NULL )
+ mpFirstChild = pAtom;
+
+ pLastAtom = pAtom;
+ }
+ }
+ }
+ }
+
+ maRecordHeader.SeekToEndOfRecord( mrStream );
+}
+
+Atom::~Atom()
+{
+ Atom* pChild = mpFirstChild;
+ while( pChild )
+ {
+ Atom* pNextChild = pChild->mpNextAtom;
+ delete pChild;
+ pChild = pNextChild;
+ }
+}
+
+/** imports this atom and its child atoms */
+Atom* Atom::import( const DffRecordHeader& rRootRecordHeader, SvStream& rStCtrl )
+{
+ Atom* pRootAtom = new Atom( rRootRecordHeader, rStCtrl );
+
+ if( rStCtrl.GetError() == 0 )
+ {
+ return pRootAtom;
+ }
+ else
+ {
+ delete pRootAtom;
+ return NULL;
+ }
+}
+
+/** imports this atom and its child atoms */
+Atom* Atom::import( UINT16 nRecType, SvStream& rStCtrl )
+{
+ rStCtrl.Seek( STREAM_SEEK_TO_END );
+ sal_Size nStreamLength = rStCtrl.Tell();
+ rStCtrl.Seek( STREAM_SEEK_TO_BEGIN );
+
+ DffRecordHeader aRootRecordHeader;
+ aRootRecordHeader.nRecVer = DFF_PSFLAG_CONTAINER;
+ aRootRecordHeader.nRecInstance = 0;
+ aRootRecordHeader.nImpVerInst = 0;
+ aRootRecordHeader.nRecType = nRecType;
+ aRootRecordHeader.nRecLen = nStreamLength;
+ aRootRecordHeader.nFilePos = 0;
+
+ return import( aRootRecordHeader, rStCtrl );
+}
+
+/** returns the next child atom after pLast with nRecType or NULL */
+const Atom* Atom::findNextChildAtom( sal_uInt16 nRecType, const Atom* pLast ) const
+{
+ Atom* pChild = pLast != NULL ? pLast->mpNextAtom : mpFirstChild;
+ while( pChild && pChild->maRecordHeader.nRecType != nRecType )
+ {
+ pChild = pChild->mpNextAtom;
+ }
+
+ return pChild;
+}
+
+/** returns the next child atom after pLast with nRecType and nRecInstance or NULL */
+const Atom* Atom::findNextChildAtom( sal_uInt16 nRecType, sal_uInt16 nRecInstance, const Atom* pLast ) const
+{
+ const Atom* pChild = pLast != NULL ? pLast->mpNextAtom : mpFirstChild;
+ while( pChild && (pChild->maRecordHeader.nRecType != nRecType) && (pChild->maRecordHeader.nRecInstance != nRecInstance) )
+ {
+ pChild = findNextChildAtom( pChild );
+ }
+
+ return pChild;
+}
+
+Atom* Atom::findFirstEqualAtom( Atom* pCompare, Atom* pContainer, Atom* pSearch, int& nDistance )
+{
+ nDistance = 0;
+ Atom* pRet = 0;
+
+ while( pSearch )
+ {
+ if( *pSearch == *pCompare )
+ return pSearch;
+
+ pSearch = const_cast< Atom* >( pContainer->findNextChildAtom( pSearch ) );
+ nDistance++;
+ }
+
+ return 0;
+}
+
+Atom* Atom::skipAtoms( Atom* pContainer, Atom* pAtom, Atom* pSkipTo )
+{
+ while( pAtom && (pAtom != pSkipTo) )
+ {
+ pAtom->meStatus = CMP_NOTAVAILABLE;
+ pAtom = const_cast< Atom* >( pContainer->findNextChildAtom( pAtom ) );
+ }
+
+ return pAtom;
+}
+
+void Atom::compare( Atom* pAtom )
+{
+ if( pAtom )
+ {
+ if( meStatus == CMP_NOTYET )
+ {
+ mpCompareAtom = pAtom;
+ pAtom->mpCompareAtom = this;
+
+ mpCompareAtom = pAtom;
+ pAtom->mpCompareAtom = this;
+
+ meStatus = pAtom->meStatus = ( *this == *pAtom ) ? CMP_EQUAL : CMP_NOTEQUAL;
+ }
+
+ if(meStatus == CMP_EQUAL)
+ {
+ if( isContainer() )
+ {
+ /** returns the first child atom or NULL */
+ Atom* pChildAtom1 = const_cast< Atom* >( findFirstChildAtom() );
+
+ if( pChildAtom1 && (pChildAtom1->meStatus == CMP_NOTYET) )
+ {
+ Atom* pChildAtom2 = const_cast< Atom* >( pAtom->findFirstChildAtom() );
+ while( pChildAtom1 && pChildAtom2 )
+ {
+ if( !(*pChildAtom1 == *pChildAtom2) )
+ {
+ int nDistance1;
+ int nDistance2;
+
+ Atom* pFind1 = findFirstEqualAtom( pChildAtom1, pAtom, const_cast< Atom* >( pAtom->findNextChildAtom( pChildAtom2 )), nDistance1 );
+ Atom* pFind2 = findFirstEqualAtom( pChildAtom2, this, const_cast< Atom* >(findNextChildAtom( pChildAtom1 )), nDistance2 );
+
+ if( pFind1 && (!pFind2 || (nDistance1 < nDistance2) ) )
+ {
+ pChildAtom2 = skipAtoms( pAtom, pChildAtom2, pFind1 );
+ }
+ else if( pFind2 )
+ {
+ pChildAtom1 = skipAtoms( this, pChildAtom1, pFind2 );
+ }
+ else
+ {
+ pChildAtom1 = skipAtoms( this, pChildAtom1, 0 );
+ pChildAtom2 = skipAtoms( pAtom, pChildAtom2, 0 );
+ }
+ }
+
+ if( pChildAtom1 && pChildAtom2 )
+ {
+ pChildAtom1->mpCompareAtom = pChildAtom2;
+ pChildAtom2->mpCompareAtom = pChildAtom1;
+
+ pChildAtom1->meStatus = pChildAtom2->meStatus =
+ (pChildAtom1->isContainer() || pChildAtom1->compareContent( *pChildAtom2 )) ?
+ CMP_EQUAL : CMP_NOTEQUAL;
+
+ pChildAtom1 = const_cast< Atom* >( findNextChildAtom( pChildAtom1 ) );
+ pChildAtom2 = const_cast< Atom* >( pAtom->findNextChildAtom( pChildAtom2 ) );
+ }
+ }
+ }
+ }
+ else
+ {
+ if( !compareContent( *pAtom ) )
+ {
+ meStatus = pAtom->meStatus = CMP_NOTEQUAL;
+ }
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////
+
+class AtomBoxString : public SvLBoxString
+{
+public:
+ AtomBoxString( SvLBoxEntry* pEntry, const String& rStr )
+ : SvLBoxString( pEntry, 0, rStr )
+ { }
+
+ ~AtomBoxString() { }
+
+ void Paint( const Point& rPos, SvLBox& rOutDev, USHORT nViewDataEntryFlags, SvLBoxEntry* pEntry )
+ {
+ Color aOldTextColor = rOutDev.GetTextColor();
+
+ if( pEntry && pEntry->GetUserData() )
+ {
+ Atom* pAtom = static_cast<Atom*>( pEntry->GetUserData() );
+ rOutDev.SetTextColor( Color( gColors[ pAtom->getCompareStatus() ] ) );
+ }
+
+ SvLBoxString::Paint( rPos, rOutDev, nViewDataEntryFlags, pEntry );
+
+ rOutDev.SetTextColor( aOldTextColor );
+
+/*
+ Color aOldFillColor = rOutDev.GetFillColor();
+
+ SvTreeListBox* pTreeBox = static_cast< SvTreeListBox* >( &rOutDev );
+ long nX = pTreeBox->GetSizePixel().Width();
+
+ ScrollBar* pVScroll = pTreeBox->GetVScroll();
+ if ( pVScroll->IsVisible() )
+ {
+ nX -= pVScroll->GetSizePixel().Width();
+ }
+
+ SvViewDataItem* pItem = rOutDev.GetViewDataItem( pEntry, this );
+ nX -= pItem->aSize.Height();
+
+ long nSize = pItem->aSize.Height() / 2;
+ long nHalfSize = nSize / 2;
+ long nY = rPos.Y() + nHalfSize;
+
+ if ( aOldFillColor == COL_WHITE )
+ {
+ rOutDev.SetFillColor( Color( COL_BLACK ) );
+ }
+ else
+ {
+ rOutDev.SetFillColor( Color( COL_WHITE ) );
+ }
+
+ long n = 0;
+ while ( n <= nHalfSize )
+ {
+ rOutDev.DrawRect( Rectangle( nX+n, nY+n, nX+n, nY+nSize-n ) );
+ n++;
+ }
+
+ rOutDev.SetFillColor( aOldFillColor );
+*/
+ }
+
+private:
+ Image* mpImage;
+};
+
+
+//////////////////////////////////////////////////////////////////////
+
+class AtomContainerTreeListBox : public SvTreeListBox
+{
+public:
+ AtomContainerTreeListBox( Window* pParent );
+ ~AtomContainerTreeListBox();
+
+ void SetRootAtom( const Atom* pAtom );
+
+
+ void SetCollapsingHdl(const Link& rNewHdl){maCollapsingHdl=rNewHdl;}
+ const Link& GetCollapsingHdl() const { return maCollapsingHdl; }
+
+ void SetExpandingHdl(const Link& rNewHdl){maExpandingHdl=rNewHdl;}
+ const Link& GetExpandingHdl() const { return maExpandingHdl; }
+
+ virtual BOOL Expand( SvLBoxEntry* pParent );
+ virtual BOOL Collapse( SvLBoxEntry* pParent );
+
+ SvLBoxEntry* findAtom( Atom* pAtom );
+
+ virtual void InitEntry(SvLBoxEntry*,const XubString&,const Image&,const Image&);
+ virtual void SetTabs();
+
+private:
+ void InsertAtom( const Atom* pAtom, SvLBoxEntry* pParent = 0 );
+ const Atom* mpRootAtom;
+ ResMgr* mpResMgr;
+ Image maImgFolder;
+ Image maImgAtom;
+ Image maImgExpanded;
+ Image maImgCollapsed;
+ bool mbRecursiveGuard;
+ Link maCollapsingHdl;
+ Link maExpandingHdl;
+};
+
+typedef std::pair< AtomContainerTreeListBox*, SvLBoxEntry* > AtomContainerEntryPair;
+
+AtomContainerTreeListBox::AtomContainerTreeListBox( Window* pParent )
+: SvTreeListBox( pParent, WB_HASBUTTONS|WB_HASLINES|WB_HASBUTTONSATROOT|WB_3DLOOK|WB_BORDER ),
+ mpRootAtom( 0 ), mbRecursiveGuard( false )
+{
+ mpResMgr = ResMgr::CreateResMgr( "svt" );
+ maImgCollapsed = Image( ResId( RID_IMG_TREENODE_COLLAPSED, mpResMgr ) );
+ maImgExpanded = Image( ResId( RID_IMG_TREENODE_EXPANDED, mpResMgr ) );
+
+// SetDefaultExpandedEntryBmp( aExpanded );
+// SetDefaultCollapsedEntryBmp(aCollapsed );
+
+ maImgFolder = Image( ResId( IMG_SVT_FOLDER, mpResMgr ) );
+ maImgAtom = Image( ResId( IMG_SVT_DOCTEMPLATE_DOCINFO_SMALL, mpResMgr ) );
+}
+
+AtomContainerTreeListBox::~AtomContainerTreeListBox()
+{
+}
+
+void AtomContainerTreeListBox::SetTabs()
+{
+ if( IsEditingActive() )
+ EndEditing( TRUE );
+
+ ClearTabList();
+
+ short nIndent = 0; GetIndent();
+ long nNodeWidthPixel = maImgCollapsed.GetSizePixel().Width();
+ long nContextWidthDIV2 = nNodeWidthPixel >> 1;
+
+ long nStartPos = 2 + ( nIndent + nContextWidthDIV2 );
+ AddTab( nStartPos, SV_LBOXTAB_DYNAMIC | SV_LBOXTAB_ADJUST_CENTER );
+ nStartPos += nNodeWidthPixel + 5;
+ AddTab( nStartPos, SV_LBOXTAB_DYNAMIC | SV_LBOXTAB_ADJUST_CENTER | SV_LBOXTAB_SHOW_SELECTION );
+ nStartPos += nContextWidthDIV2 + 5;
+ AddTab( nStartPos, SV_LBOXTAB_DYNAMIC|SV_LBOXTAB_ADJUST_LEFT | SV_LBOXTAB_SHOW_SELECTION );
+}
+
+void AtomContainerTreeListBox::InitEntry(SvLBoxEntry* pEntry,const XubString& aStr,const Image& aCollEntryBmp,const Image& aExpEntryBmp)
+{
+ pEntry->AddItem( new SvLBoxContextBmp( pEntry,0, aCollEntryBmp,aExpEntryBmp, SVLISTENTRYFLAG_EXPANDED ) );
+ pEntry->AddItem( new SvLBoxContextBmp( pEntry,0, maImgAtom, maImgAtom, SVLISTENTRYFLAG_EXPANDED ) );
+ pEntry->AddItem( new AtomBoxString( pEntry, aStr ) );
+}
+
+SvLBoxEntry* AtomContainerTreeListBox::findAtom( Atom* pAtom )
+{
+ SvLBoxEntry* pEntry = First();
+ while( pEntry )
+ {
+ if( pEntry->GetUserData() == pAtom )
+ return pEntry;
+
+ pEntry = Next( pEntry );
+ }
+
+ return 0;
+}
+
+BOOL AtomContainerTreeListBox::Expand( SvLBoxEntry* pParent )
+{
+ BOOL bRet = FALSE;
+ if( !mbRecursiveGuard )
+ {
+ mbRecursiveGuard = true;
+ AtomContainerEntryPair aPair( this, pParent );
+ maExpandingHdl.Call( &aPair);
+
+ bRet = SvTreeListBox::Expand( pParent );
+ mbRecursiveGuard = false;
+ }
+ return bRet;
+}
+
+BOOL AtomContainerTreeListBox::Collapse( SvLBoxEntry* pParent )
+{
+ BOOL bRet = FALSE;
+ if( !mbRecursiveGuard )
+ {
+ mbRecursiveGuard = true;
+ AtomContainerEntryPair aPair( this, pParent );
+ maCollapsingHdl.Call( &aPair);
+
+ bRet = SvTreeListBox::Collapse( pParent );
+ mbRecursiveGuard = false;
+ }
+ return bRet;
+}
+
+void AtomContainerTreeListBox::SetRootAtom( const Atom* pAtom )
+{
+ mpRootAtom = pAtom;
+ InsertAtom( mpRootAtom );
+}
+
+void AtomContainerTreeListBox::InsertAtom( const Atom* pAtom, SvLBoxEntry* pParent /* = 0 */ )
+{
+ if( pAtom )
+ {
+ const DffRecordHeader& rHeader = pAtom->getHeader();
+
+ char buffer[1024];
+
+ rtl::OUString aText;
+ AtomConfig* pAtomConfig = dynamic_cast< AtomConfig*>( gAtomConfigMap[rHeader.nRecType].get() );
+
+ if( pAtomConfig )
+ aText = pAtomConfig->getName();
+
+ if( !aText.getLength() )
+ {
+ sprintf( buffer, "unknown_0x%04x", rHeader.nRecType );
+ aText += rtl::OUString::createFromAscii( buffer );
+ }
+
+ sprintf( buffer, " (I: %lu L: %lu)", (UINT32)rHeader.nRecVer, (UINT32)rHeader.nRecLen );
+ aText += String( rtl::OUString::createFromAscii( buffer ) );
+
+ SvLBoxEntry* pEntry = 0;
+ if( pAtom->isContainer() && pAtom->findFirstChildAtom() )
+ {
+ pEntry = InsertEntry( aText, maImgExpanded, maImgCollapsed, pParent );
+
+ /** returns the first child atom or NULL */
+ const Atom* pChildAtom = pAtom->findFirstChildAtom();
+
+ while( pChildAtom )
+ {
+ InsertAtom( pChildAtom, pEntry );
+ pChildAtom = pAtom->findNextChildAtom( pChildAtom );
+ }
+ }
+ else
+ {
+ pEntry = InsertEntry( aText, pParent );
+ }
+
+ if( pEntry )
+ {
+ pEntry->SetUserData( (void*)pAtom );
+
+ if( pAtom->isContainer() )
+ {
+ SvLBoxContextBmp* pBoxBmp = dynamic_cast< SvLBoxContextBmp* >( pEntry->GetItem( pEntry->ItemCount() - 2 ) );
+ if( pBoxBmp )
+ {
+ pBoxBmp->SetBitmap1( pEntry, maImgFolder );
+ pBoxBmp->SetBitmap2( pEntry, maImgFolder );
+ }
+ }
+
+/*
+ pEntry->ReplaceItem(
+ new AtomBoxString( pEntry, aText, pImage ),
+ pEntry->ItemCount() - 1 );
+*/
+ }
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+
+extern void load_config( const OUString& rPath );
+
+class PPTDocument
+{
+public:
+ PPTDocument( const rtl::OUString& rFilePath );
+ ~PPTDocument();
+
+ Atom* getRootAtom() const;
+
+private:
+ void Load( const rtl::OUString& rFilePath );
+
+ Atom* mpAtom;
+ SvStream* mpDocStream;
+ SotStorageRef maStorage;
+};
+
+typedef boost::shared_ptr< PPTDocument > PPTDocumentPtr;
+
+PPTDocument::PPTDocument(const rtl::OUString& rFilePath)
+: mpAtom(0), mpDocStream(0)
+{
+ Load( rFilePath );
+}
+
+PPTDocument::~PPTDocument()
+{
+ delete mpAtom;
+ delete mpDocStream;
+}
+
+void PPTDocument::Load( const rtl::OUString& rFilePath )
+{
+ maStorage = new SotStorage( rFilePath, STREAM_STD_READ );
+ if( !maStorage->GetError() )
+ {
+ mpDocStream = maStorage->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM("PowerPoint Document") ), STREAM_STD_READ );
+ if( mpDocStream )
+ {
+ DffRecordHeader aRecordHeader;
+ *mpDocStream >> aRecordHeader;
+
+ mpAtom = Atom::import( 65530, *mpDocStream );
+ }
+ }
+}
+
+Atom* PPTDocument::getRootAtom() const
+{
+ return mpAtom;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+class MSViewerWorkWindow : public WorkWindow
+{
+public:
+ MSViewerWorkWindow();
+ ~MSViewerWorkWindow();
+
+ PPTDocumentPtr Load();
+ void onView();
+ void onCompare();
+ void onClose();
+
+ void View( const PPTDocumentPtr& pDocument, int nPane );
+ void Compare( const PPTDocumentPtr& pDocument1, const PPTDocumentPtr& pDocument2 );
+
+ virtual void Resize();
+
+private:
+ void Sync( AtomContainerEntryPair* pPair, int nAction );
+
+ AtomContainerTreeListBox* mpListBox[2];
+ MultiLineEdit* mpEdit[2];
+ PPTDocumentPtr mpDocument[2];
+ MenuBar* mpMenuBar;
+ PopupMenu* mpFileMenu;
+ bool mbSelectHdlGuard;
+ DECL_LINK( implSelectHdl, AtomContainerTreeListBox* );
+ DECL_LINK( implExpandingHdl, AtomContainerEntryPair* );
+ DECL_LINK( implCollapsingHdl, AtomContainerEntryPair* );
+ DECL_LINK( implMenuHdl, Menu* );
+};
+
+// -----------------------------------------------------------------------
+
+void MSViewerWorkWindow::onView()
+{
+ PPTDocumentPtr pDocument( Load() );
+ if( pDocument.get() )
+ {
+ onClose();
+ View( pDocument, 0 );
+ }
+}
+
+void MSViewerWorkWindow::onClose()
+{
+}
+
+void MSViewerWorkWindow::onCompare()
+{
+ PPTDocumentPtr pDocument1( Load() );
+ if( pDocument1.get() )
+ {
+ PPTDocumentPtr pDocument2( Load() );
+ if( pDocument2.get() )
+ {
+ onClose();
+ Compare( pDocument1, pDocument2 );
+ }
+ }
+}
+
+void MSViewerWorkWindow::Compare( const PPTDocumentPtr& pDocument1, const PPTDocumentPtr& pDocument2 )
+{
+ if( pDocument1.get() && pDocument2.get() )
+ {
+ Atom* pAtom1 = pDocument1->getRootAtom();
+ Atom* pAtom2 = pDocument2->getRootAtom();
+ pAtom1->setCompareAtom( pAtom2 );
+ pAtom2->setCompareAtom( pAtom1 );
+ }
+
+ View( pDocument1, 0 );
+ View( pDocument2, 1 );
+}
+
+void MSViewerWorkWindow::View( const PPTDocumentPtr& pDocument, int nPane )
+{
+ if( ((nPane != 0) && (nPane != 1)) || (pDocument.get() == 0) )
+ return;
+
+ mpDocument[nPane] = pDocument;
+
+ mpListBox[nPane]->SetRootAtom( pDocument->getRootAtom() );
+ mpListBox[nPane]->Expand( mpListBox[nPane]->GetEntry(0) );
+ mpListBox[nPane]->Show();
+ mpEdit[nPane]->Show();
+ Resize();
+}
+
+
+PPTDocumentPtr MSViewerWorkWindow::Load()
+{
+ ::sfx2::FileDialogHelper aDlg( ::sfx2::FILEOPEN_SIMPLE, 0 );
+ String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.ppt" ) );
+ aDlg.AddFilter( aStrFilterType, aStrFilterType );
+// INetURLObject aFile( SvtPathOptions().GetPalettePath() );
+// aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) );
+
+ PPTDocumentPtr pDocument;
+ if ( aDlg.Execute() == ERRCODE_NONE )
+ {
+ pDocument.reset( new PPTDocument( aDlg.GetPath() ) );
+ }
+
+ return pDocument;
+}
+
+// -----------------------------------------------------------------------
+
+MSViewerWorkWindow::MSViewerWorkWindow() :
+ WorkWindow( 0, WB_APP | WB_STDWORK | WB_3DLOOK ),mbSelectHdlGuard(false)
+{
+ Size aOutputSize( 400, 600 );
+ SetOutputSizePixel( aOutputSize );
+ SetText( String( RTL_CONSTASCII_USTRINGPARAM( "MSViewer" ) ) );
+
+ Size aOutSize( GetOutputSizePixel() );
+
+ Font aFont( String( RTL_CONSTASCII_USTRINGPARAM( "Courier" ) ), GetFont().GetSize() );
+
+ mpMenuBar = new MenuBar();
+ mpMenuBar->InsertItem( 1, String( RTL_CONSTASCII_USTRINGPARAM("~File" ) ) );
+ mpFileMenu = new PopupMenu();
+ mpFileMenu->InsertItem( 2, String( RTL_CONSTASCII_USTRINGPARAM("~View" ) ) );
+ mpFileMenu->InsertItem( 3, String( RTL_CONSTASCII_USTRINGPARAM("~Compare" ) ) );
+ mpFileMenu->InsertSeparator();
+ mpFileMenu->InsertItem( 4, String( RTL_CONSTASCII_USTRINGPARAM("~Quit" ) ) );
+ mpFileMenu->SetSelectHdl( LINK( this, MSViewerWorkWindow, implMenuHdl ) );
+
+ mpMenuBar->SetPopupMenu( 1, mpFileMenu );
+ SetMenuBar( mpMenuBar );
+ int nPane;
+ for( nPane = 0; nPane < 2; nPane++ )
+ {
+ mpListBox[nPane] = new AtomContainerTreeListBox( this );
+ mpListBox[nPane]->SetSelectHdl( LINK( this, MSViewerWorkWindow, implSelectHdl ) );
+ mpListBox[nPane]->SetExpandingHdl( LINK( this, MSViewerWorkWindow, implExpandingHdl ) );
+ mpListBox[nPane]->SetCollapsingHdl( LINK( this, MSViewerWorkWindow, implCollapsingHdl ) );
+
+ mpEdit[nPane] = new MultiLineEdit(this, WB_3DLOOK | WB_BORDER | WB_LEFT | WB_TOP | WB_READONLY | WB_HSCROLL | WB_VSCROLL );
+ mpEdit[nPane]->SetReadOnly( TRUE );
+ mpEdit[nPane]->SetReadOnly( TRUE );
+ mpEdit[nPane]->SetControlFont( aFont );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static String GetAtomText( const Atom* pAtom )
+{
+ String aText;
+ if( pAtom )
+ {
+ const DffRecordHeader& rHeader = pAtom->getHeader();
+ char buffer[512];
+ sprintf( buffer, "Version = %lu\n\rInstance = %lu\n\rVersionInstance = %lu\n\rLength = %lu\n\r",
+ (UINT32)rHeader.nRecVer,
+ (UINT32)rHeader.nRecInstance,
+ (UINT32)rHeader.nImpVerInst,
+ (UINT32)rHeader.nRecLen );
+ aText = rtl::OUString::createFromAscii( buffer );
+ if( pAtom->isContainer() )
+ {
+
+ }
+ else
+ {
+ pAtom->seekToContent();
+ AtomConfig* pAtomConfig = dynamic_cast< AtomConfig* >( gAtomConfigMap[pAtom->getType()].get() );
+ if( pAtomConfig )
+ {
+ sal_Size nLength = pAtom->getLength();
+ aText += String( pAtomConfig->format( pAtom->getStream(), nLength ) );
+ }
+ else
+ {
+ sal_Size nLength = pAtom->getLength();
+ aText += String( ElementConfig::dump_hex( pAtom->getStream(), nLength ) );
+ }
+ }
+ }
+
+ return aText;
+}
+
+IMPL_LINK(MSViewerWorkWindow,implSelectHdl, AtomContainerTreeListBox*, pListBox )
+{
+ int nPane = (pListBox == mpListBox[1]) ? 1 : 0;
+ SvLBoxEntry* pEntry = mpListBox[nPane]->FirstSelected();
+ if( pEntry && pEntry->GetUserData() )
+ {
+ Atom* pAtom = static_cast<Atom*>( pEntry->GetUserData() );
+ mpEdit[nPane]->SetText( GetAtomText( pAtom ) );
+
+ if(!mbSelectHdlGuard)
+ {
+ mbSelectHdlGuard = true;
+ // select other
+ AtomContainerEntryPair aPair( pListBox, pEntry );
+ Sync( &aPair, 2 );
+ mbSelectHdlGuard = false;
+ }
+ }
+ return 0;
+}
+
+void MSViewerWorkWindow::Sync( AtomContainerEntryPair* pPair, int nAction )
+{
+ if( mpDocument[0].get() && mpDocument[1].get() && pPair->first && pPair->second )
+ {
+ AtomContainerTreeListBox* pDestinationListBox = (pPair->first == mpListBox[0]) ? mpListBox[1] : mpListBox[0];
+
+ Atom* pAtom = static_cast<Atom*>(pPair->second->GetUserData());
+ if( pAtom && pAtom->getCompareAtom() )
+ {
+ SvLBoxEntry* pEntry = pDestinationListBox->findAtom( pAtom->getCompareAtom() );
+
+ if(pEntry )
+ {
+ if( nAction == 0 )
+ {
+ pDestinationListBox->Expand( pEntry );
+ }
+ else if( nAction == 1 )
+ {
+ pDestinationListBox->Collapse( pEntry );
+ }
+ else
+ {
+ pDestinationListBox->Select( pEntry );
+ }
+ }
+ }
+ }
+}
+
+IMPL_LINK(MSViewerWorkWindow, implExpandingHdl, AtomContainerEntryPair*, pPair )
+{
+ SvLBoxEntry* pEntry = pPair->second;
+ if( pEntry && pEntry->GetUserData() )
+ {
+ Atom* pAtom = static_cast<Atom*>( pEntry->GetUserData() );
+ pAtom->compare( pAtom->getCompareAtom() );
+ }
+
+ Sync( pPair, 0 );
+
+ return 0;
+}
+
+IMPL_LINK(MSViewerWorkWindow, implCollapsingHdl, AtomContainerEntryPair*, pPair )
+{
+ Sync( pPair, 1 );
+
+ return 0;
+}
+
+IMPL_LINK( MSViewerWorkWindow, implMenuHdl, Menu*, pMenu )
+{
+ if( pMenu )
+ {
+ USHORT nId = pMenu->GetCurItemId();
+ switch( nId )
+ {
+ case 2: onView(); break;
+ case 3: onCompare(); break;
+ case 4: Application::Quit(); break;
+ }
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+MSViewerWorkWindow::~MSViewerWorkWindow()
+{
+ int nPane;
+ for( nPane = 0; nPane < 2; nPane++ )
+ {
+ delete mpListBox[nPane];
+ delete mpEdit[nPane];
+ }
+
+ delete mpFileMenu;
+ delete mpMenuBar;
+}
+
+// -----------------------------------------------------------------------
+
+void MSViewerWorkWindow::Resize()
+{
+ int nPaneCount = ((mpDocument[0].get() != 0) ? 1 : 0) + ((mpDocument[1].get() != 0) ? 1 : 0);
+
+ Size aOutputSize( GetOutputSizePixel() );
+ int nHeight = aOutputSize.Height() >> 1;
+ if( nPaneCount )
+ {
+ int nWidth = aOutputSize.Width();
+ if( nPaneCount == 2 )
+ nWidth >>= 1;
+
+ int nPosX = 0;
+
+ int nPane;
+ for( nPane = 0; nPane < 2; nPane++ )
+ {
+ mpListBox[nPane]->SetPosSizePixel( nPosX,0, nWidth, nHeight );
+ mpEdit[nPane]->SetPosSizePixel( nPosX, nHeight, nWidth, aOutputSize.Height() - nHeight );
+ nPosX += nWidth;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+// -----------------------------------------------------------------------
+
+ SAL_IMPLEMENT_MAIN()
+{
+ if( argc > 3 )
+ return 0;
+
+ uno::Reference< lang::XMultiServiceFactory > xMSF;
+ try
+ {
+ uno::Reference< uno::XComponentContext > xCtx( cppu::defaultBootstrap_InitialComponentContext() );
+ if ( !xCtx.is() )
+ {
+ DBG_ERROR( "Error creating initial component context!" );
+ return -1;
+ }
+
+ xMSF = uno::Reference< lang::XMultiServiceFactory >(xCtx->getServiceManager(), uno::UNO_QUERY );
+
+ if ( !xMSF.is() )
+ {
+ DBG_ERROR( "No service manager!" );
+ return -1;
+ }
+
+ // Init UCB
+ uno::Sequence< uno::Any > aArgs( 2 );
+ aArgs[ 0 ] <<= rtl::OUString::createFromAscii( UCB_CONFIGURATION_KEY1_LOCAL );
+ aArgs[ 1 ] <<= rtl::OUString::createFromAscii( UCB_CONFIGURATION_KEY2_OFFICE );
+ sal_Bool bSuccess = ::ucb::ContentBroker::initialize( xMSF, aArgs );
+ if ( !bSuccess )
+ {
+ DBG_ERROR( "Error creating UCB!" );
+ return -1;
+ }
+
+ }
+ catch ( uno::Exception const & )
+ {
+ DBG_ERROR( "Exception during creation of initial component context!" );
+ return -1;
+ }
+ comphelper::setProcessServiceFactory( xMSF );
+
+ InitVCL( xMSF );
+
+ String aConfigURL;
+ if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( Application::GetAppFileName(), aConfigURL ) )
+ {
+ INetURLObject aURL( aConfigURL );
+
+ aURL.removeSegment();
+ aURL.removeFinalSlash();
+ aURL.Append( String( RTL_CONSTASCII_USTRINGPARAM( "msview.xml" ) ) );
+
+ load_config( aURL.GetMainURL( INetURLObject::NO_DECODE ) );
+ }
+
+ {
+ MSViewerWorkWindow aMainWindow;
+
+ if( argc >= 2 )
+ {
+ const rtl::OUString aFile1( rtl::OUString::createFromAscii(argv[1]) );
+ PPTDocumentPtr pDocument1( new PPTDocument( aFile1 ) );
+
+ if( argc == 3 )
+ {
+ const rtl::OUString aFile2( rtl::OUString::createFromAscii(argv[2]) );
+
+ PPTDocumentPtr pDocument2;
+ pDocument2.reset( new PPTDocument( aFile2 ) );
+ aMainWindow.Compare( pDocument1, pDocument2 );
+ }
+ else
+ {
+ aMainWindow.View( pDocument1, 0 );
+ }
+ }
+
+ aMainWindow.Show();
+
+ Application::Execute();
+ }
+
+ DeInitVCL();
+
+ return 0;
+}
diff --git a/svx/workben/msview/msview.xml b/svx/workben/msview/msview.xml
new file mode 100644
index 000000000000..6daffa62be2d
--- /dev/null
+++ b/svx/workben/msview/msview.xml
@@ -0,0 +1,294 @@
+<?xml version='1.0'?>
+<config>
+<atom name="Unknown" id="0"/>
+<atom name="SubatomCompleted" id="1"/>
+<atom name="IRRAtom" id="2"/>
+<atom name="PSS" id="3"/>
+<atom name="SubatomException" id="4"/>
+<atom name="ClientSignal1" id="6"/>
+<atom name="ClientSignal2" id="7"/>
+<atom name="PowerPointStateInfoAtom" id="10"/>
+<atom name="Document" id="1000"/>
+<atom name="DocumentAtom" id="1001"/>
+<atom name="EndDocument" id="1002"/>
+<atom name="SlidePersist" id="1003"/>
+<atom name="SlideBase" id="1004"/>
+<atom name="SlideBaseAtom" id="1005"/>
+<atom name="Slide" id="1006"/>
+<atom name="SlideAtom" id="1007"/>
+<atom name="Notes" id="1008"/>
+<atom name="NotesAtom" id="1009"/>
+<atom name="Environment" id="1010"/>
+<atom name="SlidePersistAtom" id="1011"/>
+<atom name="Scheme" id="1012"/>
+<atom name="SchemeAtom" id="1013"/>
+<atom name="DocViewInfo" id="1014"/>
+<atom name="SslideLayoutAtom" id="1015"/>
+<atom name="MainMaster" id="1016"/>
+<atom name="SSSlideInfoAtom" id="1017"/>
+<atom name="SlideViewInfo" id="1018"/>
+<atom name="GuideAtom" id="1019"/>
+<atom name="ViewInfo" id="1020"/>
+<atom name="ViewInfoAtom" id="1021"/>
+<atom name="SlideViewInfoAtom" id="1022"/>
+<atom name="VBAInfo" id="1023"/>
+<atom name="VBAInfoAtom" id="1024"/>
+<atom name="SSDocInfoAtom" id="1025"/>
+<atom name="Summary" id="1026"/>
+<atom name="Texture" id="1027"/>
+<atom name="VBASlideInfo" id="1028"/>
+<atom name="VBASlideInfoAtom" id="1029"/>
+<atom name="DocRoutingSlip" id="1030"/>
+<atom name="OutlineViewInfo" id="1031"/>
+<atom name="SorterViewInfo" id="1032"/>
+<atom name="ExObjList" id="1033"/>
+<atom name="ExObjListAtom" id="1034"/>
+<atom name="PPDrawingGroup" id="1035"/>
+<atom name="PPDrawing" id="1036"/>
+<atom name="NewlyAddedAtomByXP1037 " id="1037"/>
+<atom name="NamedShows" id="1040"/>
+<atom name="NamedShow" id="1041"/>
+<atom name="NamedShowSlides" id="1042"/>
+<atom name="List" id="2000"/>
+<atom name="FontCollection" id="2005"/>
+<atom name="ListPlaceholder" id="2017"/>
+<atom name="BookmarkCollection" id="2019"/>
+<atom name="SoundCollection" id="2020"/>
+<atom name="SoundCollAtom" id="2021"/>
+<atom name="Sound" id="2022"/>
+<atom name="SoundData" id="2023"/>
+<atom name="BookmarkSeedAtom" id="2025"/>
+<atom name="GuideList" id="2026"/>
+<atom name="RunArray" id="2028"/>
+<atom name="RunArrayAtom" id="2029"/>
+<atom name="ArrayElementAtom" id="2030"/>
+<atom name="Int4ArrayAtom" id="2031"/>
+<atom name="ColorSchemeAtom" id="2032"/>
+<!--<atom name="ExtendedBuGraatom" id="4041"/>-->
+<atom name="ExtendedBuGraAtom" id="2041"/>
+<atom name="OEShape" id="3008"/>
+<atom name="ExObjRefAtom" id="3009"/>
+<atom name="OEPlaceholderAtom" id="3011"/>
+<atom name="GrColor" id="3020"/>
+<atom name="GrectAtom" id="3025"/>
+<atom name="GratioAtom" id="3031"/>
+<atom name="Gscaling" id="3032"/>
+<atom name="GpointAtom" id="3034"/>
+<atom name="OEShapeAtom" id="3035"/>
+<atom name="OutlineTextRefAtom" id="3998"/>
+<atom name="TextHeaderAtom" id="3999"/>
+<atom name="TextCharsAtom" id="4000"/>
+<atom name="StyleTextPropAtom" id="4001"/>
+<atom name="BaseTextPropAtom" id="4002"/>
+<atom name="TxMasterStyleAtom" id="4003"/>
+<atom name="TxCFStyleAtom" id="4004"/>
+<atom name="TxPFStyleAtom" id="4005"/>
+<atom name="TextRulerAtom" id="4006"/>
+<atom name="TextBookmarkAtom" id="4007"/>
+<atom name="TextBytesAtom" id="4008"/>
+<atom name="TxSIStyleAtom" id="4009"/>
+<atom name="TextSpecInfoAtom" id="4010"/>
+<atom name="DefaultRulerAtom" id="4011"/>
+<atom name="ExtendedParagraphAtom" id="4012"/>
+<atom name="ExtendedParagraphMasterAtom" id="4013"/>
+<atom name="ExtendedPresRuleatom" id="4014"/>
+<atom name="ExtendedParagraphHeaderAtom" id="4015"/>
+<atom name="NewlyAddedAtom4016" id="4016"/>
+<atom name="FontEntityAtom" id="4023"/>
+<atom name="FontEmbedData" id="4024"/>
+<atom name="TypeFace" id="4025"/>
+<atom name="CString" id="4026">
+ <element name="unistring" type="unistring"/>
+</atom>
+<atom name="ExternalObject" id="4027"/>
+<atom name="MetaFile" id="4033"/>
+<atom name="ExOleObj" id="4034"/>
+<atom name="ExOleObjAtom" id="4035"/>
+<atom name="ExPlainLinkAtom" id="4036"/>
+<atom name="CorePict" id="4037"/>
+<atom name="CorePictAtom" id="4038"/>
+<atom name="ExPlainAtom" id="4039"/>
+<atom name="SrKinsoku" id="4040"/>
+<atom name="Handout" id="4041"/>
+<atom name="ExEmbed" id="4044"/>
+<atom name="ExEmbedAtom" id="4045"/>
+<atom name="ExLink" id="4046"/>
+<atom name="ExLinkAtom_old" id="4047"/>
+<atom name="BookmarkEntityAtom" id="4048"/>
+<atom name="ExLinkAtom" id="4049"/>
+<atom name="SrKinsokuAtom" id="4050"/>
+<atom name="ExHyperlinkAtom" id="4051"/>
+<atom name="ExPlain" id="4053"/>
+<atom name="ExPlainLink" id="4054"/>
+<atom name="ExHyperlink" id="4055"/>
+<atom name="SlideNumberMCAtom" id="4056"/>
+<atom name="HeadersFooters" id="4057"/>
+<atom name="HeadersFootersAtom" id="4058"/>
+<atom name="RecolorEntryAtom" id="4062"/>
+<atom name="TxInteractiveInfoAtom" id="4063"/>
+<atom name="EmFormatAtom" id="4065"/>
+<atom name="CharFormatAtom" id="4066"/>
+<atom name="ParaFormatAtom" id="4067"/>
+<atom name="MasterText" id="4068"/>
+<atom name="RecolorInfoAtom" id="4071"/>
+<atom name="ExQuickTime" id="4073"/>
+<atom name="ExQuickTimeMovie" id="4074"/>
+<atom name="ExQuickTimeMovieData" id="4075"/>
+<atom name="ExSubscription" id="4076"/>
+<atom name="ExSubscriptionSection" id="4077"/>
+<atom name="ExControl" id="4078"/>
+<atom name="ExControlAtom" id="4091"/>
+<atom name="SlideListWithText" id="4080"/>
+<atom name="AnimationInfoAtom" id="4081"/>
+<atom name="InteractiveInfo" id="4082"/>
+<atom name="InteractiveInfoAtom" id="4083"/>
+<atom name="SlideList" id="4084"/>
+<atom name="UserEditAtom" id="4085"/>
+<atom name="CurrentUserAtom" id="4086"/>
+<atom name="DateTimeMCAtom" id="4087"/>
+<atom name="GenericDateMCAtom" id="4088"/>
+<atom name="HeaderMCAtom" id="4089"/>
+<atom name="FooterMCAtom" id="4090"/>
+<atom name="ExMediaAtom" id="4100"/>
+<atom name="ExVideo" id="4101"/>
+<atom name="ExAviMovie" id="4102"/>
+<atom name="ExMCIMovie" id="4103"/>
+<atom name="ExMIDIAudio" id="4109"/>
+<atom name="ExCDAudio" id="4110"/>
+<atom name="ExWAVAudioEmbedded" id="4111"/>
+<atom name="ExWAVAudioLink" id="4112"/>
+<atom name="ExOleObjStg" id="4113"/>
+<atom name="ExCDAudioAtom" id="4114"/>
+<atom name="ExWAVAudioEmbeddedAtom" id="4115"/>
+<atom name="AnimationInfo" id="4116"/>
+<atom name="RTFDateTimeMCAtom" id="4117"/>
+<atom name="ProgTags" id="5000"/>
+<atom name="ProgStringTag" id="5001"/>
+<atom name="ProgBinaryTag" id="5002"/>
+<container name="BinaryTagData" id="5003"/>
+<atom name="PrintOptions" id="6000"/>
+<atom name="PersistPtrFullBlock" id="6001"/>
+<atom name="PersistPtrIncrementalBlock" id="6002"/>
+<atom name="NewlyAddedAtomByPPT2000_6010" id="6010"/>
+<atom name="NewlyAddedAtomByPPT2000_6011" id="6011"/>
+
+<!-- animations-->
+<atom name="AnimEvent" id="0xf125"/>
+<atom name="AnimNode" id="0xf127">
+<element name="U1" type="uint"/>
+<element name="Restart" type="uint">
+ <value name="always" value="1"/>
+ <value name="whenOff" value="2"/>
+ <value name="never" value="3"/>
+</element>
+<element name="GroupType" type="uint"/>
+<element name="Fill" type="uint">
+ <value name="remove" value="1"/>
+ <value name="freeze" value="2"/>
+ <value name="hold" value="3"/>
+</element>
+<element name="U3" type="uint"/>
+<element name="U4" type="uint"/>
+<element name="Duration" type="uint"/>
+<element name="NodeType" type="uint"/>
+</atom>
+<atom name="AnimTrigger" id="0xf128">
+ <element name="U1" type="uint"/>
+ <element name="Trigger" type="uint">
+ <value name="NONE" value="0"/>
+ <value name="ON_BEGIN" value="1"/>
+ <value name="ON_END" value="2"/>
+ <value name="BEGIN_EVENT" value="3"/>
+ <value name="END_EVENT" value="4"/>
+ <value name="ON_CLICK" value="5"/>
+ <value name="ON_DBL_CLICK" value="6"/>
+ <value name="ON_MOUSE_ENTER" value="7"/>
+ <value name="ON_MOUSE_LEAVE" value="8"/>
+ <value name="ON_NEXT" value="9"/>
+ <value name="ON_PREV" value="10"/>
+ <value name="ON_STOP_AUDIO" value="11"/>
+ </element>
+ <element name="U3" type="uint"/>
+ <element name="Begin" type="uint"/>
+</atom>
+<atom name="AnimValue" id="0xf129">
+ <switch type="uint">
+ <case value="0">
+ <element name="repeat" type="float"/>
+ </case>
+ <case value="3">
+ <element name="accelerate" type="float"/>
+ </case>
+ <case value="4">
+ <element name="decelerate" type="float"/>
+ </case>
+ <case value="5">
+ <element name="autoreverse" type="uint"/>
+ </case>
+ </switch>
+</atom>
+<atom name="AnimateTarget" id="0xf12a"/>
+<atom name="Animate" id="0xf12b"/>
+<atom name="AnimateColor" id="0xf12c"/>
+<atom name="AnimateFilter" id="0xf12d"/>
+<atom name="AnimateMotion" id="0xf12e"/>
+<atom name="AnimateRotation" id="0xf12f"/>
+<atom name="AnimateScale" id="0xf130"/>
+<atom name="AnimateSet" id="0xf131"/>
+<atom name="AnimCommand" id="0xf132"/>
+<atom name="AnimateTargetSettings" id="0xf133"/>
+<atom name="AnimateData" id="0xf134"/>
+<atom name="AnimateColorData" id="0xf135"/>
+<atom name="AnimateFilterData" id="0xf136"/>
+<atom name="AnimateMotionData" id="0xf137"/>
+<atom name="AnimateScaleData" id="0xf139"/>
+<atom name="AnimateSetData" id="0xf13a"/>
+<atom name="CommandData" id="0xf13b"/>
+<atom name="AnimateTargetElement" id="0xf13c"/>
+<atom name="AnimPropertySet" id="0xf13d"/>
+<atom name="AnimateAttributeNames" id="0xf13e"/>
+<atom name="AnimKeyPoints" id="0xf13f"/>
+<atom name="AnimIteration" id="0xf140"/>
+<atom name="AnimAction" id="0xf141"/>
+<atom name="AnimAttributeValue" id="0xf142">
+ <switch type="byte">
+ <case value="0">
+ <element name="byte" type="byte"/>
+ </case>
+ <case value="1">
+ <element name="uint" type="uint"/>
+ </case>
+ <case value="2">
+ <element name="float" type="float"/>
+ </case>
+ <case value="3">
+ <element name="unistring" type="unistring"/>
+ </case>
+ </switch>
+</atom>
+<atom name="AnimKeyTime" id="0xf143"/>
+<atom name="AnimGroup" id="0xf144"/>
+<atom name="AnimSubGoup" id="0xf145"/>
+<atom name="AnimateRotationData" id="0xf138"/>
+<atom name="AnimReference" id="0x2afb">
+ <element name="RefMode" type="uint">
+ <value name="as-whole" value="0"/>
+ <value name="only-background" value="6"/>
+ <value name="only-text" value="8"/>
+ <value name="text-portion" value="2"/>
+ </element>
+ <element name="RefType" type="uint">
+ <value name="shape" value="1"/>
+ <value name="sound" value="2"/>
+ <value name="audio" value="3"/>
+ <value name="video" value="4"/>
+ </element>
+ <element name="RefId" type="uint"/>
+ <element name="Begin" type="uint"/>
+ <element name="End" type="uint"/>
+</atom>
+
+<!-- internal-->
+<atom name="PowerPoint Document" id="65530"/>
+
+</config>
diff --git a/svx/workben/msview/xmlconfig.cxx b/svx/workben/msview/xmlconfig.cxx
new file mode 100644
index 000000000000..92ac7a402851
--- /dev/null
+++ b/svx/workben/msview/xmlconfig.cxx
@@ -0,0 +1,575 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
+#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/io/IOException.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/processfactory.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <unotools/streamwrap.hxx>
+#include <tools/debug.hxx>
+#include "comphelper/anytostring.hxx"
+#include "cppuhelper/exc_hlp.hxx"
+#include "rtl/ref.hxx"
+
+#include <svx/msdffimp.hxx>
+
+#include "xmlconfig.hxx"
+
+#include <stdio.h>
+#include <ctype.h>
+#include <stack>
+
+using ::rtl::OUString;
+using ::com::sun::star::io::XInputStream;
+using ::com::sun::star::io::IOException;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+
+///////////////////////////////////////////////////////////////////////
+
+AtomConfigMap gAtomConfigMap;
+
+///////////////////////////////////////////////////////////////////////
+
+class ConfigHandler : public ::cppu::WeakAggImplHelper1<XDocumentHandler>
+{
+public:
+ // XDocumentHandler
+ virtual void SAL_CALL startDocument(void) throw( SAXException, RuntimeException );
+ virtual void SAL_CALL endDocument(void) throw( SAXException, RuntimeException );
+ virtual void SAL_CALL startElement(const OUString& aName, const Reference< XAttributeList > & xAttribs) throw( SAXException, RuntimeException );
+ virtual void SAL_CALL endElement(const OUString& aName) throw( SAXException, RuntimeException );
+ virtual void SAL_CALL characters(const OUString& aChars) throw( SAXException, RuntimeException );
+ virtual void SAL_CALL ignorableWhitespace(const OUString& aWhitespaces) throw( SAXException, RuntimeException );
+ virtual void SAL_CALL processingInstruction(const OUString& aTarget, const OUString& aData) throw( SAXException, RuntimeException );
+ virtual void SAL_CALL setDocumentLocator(const Reference< XLocator > & xLocator) throw( SAXException, RuntimeException );
+
+private:
+ void errorThrow( const OUString& rErrorMessage ) throw (SAXException );
+ ElementConfigType parseType( const OUString& rErrorMessage ) throw ( SAXException );
+ void addElement( ElementConfigPtr& rElementConfig ) throw ( SAXException );
+ OUString getAttribute( const Reference< XAttributeList > & xAttribs, const sal_Char* pName ) throw( SAXException );
+
+ ElementConfigPtr importAtomConfig( const Reference< XAttributeList > & xAttribs, bool bIsContainer ) throw( SAXException );
+ ElementConfigPtr importElementConfig( const Reference< XAttributeList > & xAttribs ) throw( SAXException );
+ ElementConfigPtr importSwitchConfig( const Reference< XAttributeList > & xAttribs ) throw( SAXException );
+ ElementConfigPtr importCaseConfig( const Reference< XAttributeList > & xAttribs ) throw( SAXException );
+ ElementConfigPtr importValueElementConfig( const Reference< XAttributeList > & xAttribs ) throw( SAXException );
+
+ std::stack< ElementConfigPtr > maElementStack;
+};
+
+void ConfigHandler::errorThrow( const OUString& rErrorMessage ) throw (SAXException )
+{
+ Reference< XInterface > aContext;
+ Any aWrappedException;
+ throw SAXException(rErrorMessage, aContext, aWrappedException);
+}
+
+ElementConfigType ConfigHandler::parseType( const OUString& sType ) throw (SAXException )
+{
+ if( sType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("uint") ) )
+ {
+ return ECT_UINT;
+ }
+ else if( sType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("byte") ) )
+ {
+ return ECT_BYTE;
+ }
+ else if( sType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("unistring") ) )
+ {
+ return ECT_UNISTRING;
+ }
+ else if( sType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("float") ) )
+ {
+ return ETC_FLOAT;
+ }
+ else if( sType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("hexdump") ) )
+ {
+ }
+ else
+ {
+ OUString aMessage( RTL_CONSTASCII_USTRINGPARAM( "unknown type: " ) );
+ aMessage += sType;
+ errorThrow( aMessage );
+ }
+
+ return ECT_HEXDUMP;
+}
+
+void ConfigHandler::addElement( ElementConfigPtr& rElementConfig ) throw ( SAXException )
+{
+ ElementConfigContainer* pParent = dynamic_cast< ElementConfigContainer* >( maElementStack.top().get() );
+
+ if( !pParent )
+ errorThrow( OUString( RTL_CONSTASCII_USTRINGPARAM( "illegal parent for element" ) ) );
+
+
+ pParent->addElementConfig( rElementConfig );
+}
+
+OUString ConfigHandler::getAttribute( const Reference< XAttributeList > & xAttribs, const sal_Char* pName ) throw( SAXException )
+{
+ OUString aName( OUString::createFromAscii( pName ) );
+
+ const sal_Int16 nAttrCount = xAttribs.is() ? xAttribs->getLength() : 0;
+ sal_Int16 i;
+ for(i=0; i < nAttrCount; i++)
+ {
+ if( xAttribs->getNameByIndex( i ) == aName )
+ return xAttribs->getValueByIndex( i );
+ }
+
+ OUString aMessage( RTL_CONSTASCII_USTRINGPARAM( "missing required attribute: ") );
+ aMessage += aName;
+ errorThrow( aMessage );
+
+ return OUString();
+}
+
+void SAL_CALL ConfigHandler::startDocument(void) throw( SAXException, RuntimeException )
+{
+}
+
+void SAL_CALL ConfigHandler::endDocument(void) throw( SAXException, RuntimeException )
+{
+}
+
+void SAL_CALL ConfigHandler::startElement(const OUString& aName, const Reference< XAttributeList > & xAttribs) throw( SAXException, RuntimeException )
+{
+ ElementConfigPtr pElement;
+
+ if( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "config" ) ) )
+ {
+ return;
+ }
+
+ if( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "container" ) ) )
+ {
+ pElement = importAtomConfig( xAttribs, true );
+ }
+ else if( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "atom" ) ) )
+ {
+ pElement = importAtomConfig( xAttribs, false );
+ }
+ else if( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "element" ) ) )
+ {
+ pElement = importElementConfig( xAttribs );
+ }
+ else if( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "value" ) ) )
+ {
+ pElement = importValueElementConfig( xAttribs );
+ }
+ else if( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "switch" ) ) )
+ {
+ pElement = importSwitchConfig( xAttribs );
+ }
+ else if( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "case" ) ) )
+ {
+ pElement = importCaseConfig( xAttribs );
+ }
+
+ if( !pElement.get() )
+ {
+ OUString aMessage( OUString( RTL_CONSTASCII_USTRINGPARAM("unknown config element: ")) );
+ aMessage += aName;
+ errorThrow( aMessage );
+ }
+
+ maElementStack.push( pElement );
+}
+
+sal_Int32 toInt( const OUString& rText )
+{
+ if( rText.compareToAscii("0x",2) == 0)
+ {
+ sal_Int32 nValue = 0;
+ const sal_Unicode *p = rText;
+ p += 2;
+ sal_Int32 nLength = rText.getLength() - 2;
+ while( (nLength--) > 0 )
+ {
+ nValue <<= 4;
+ if( *p >= '0' && *p <= '9' )
+ {
+ nValue += *p - '0';
+ }
+ else if( *p >= 'a' && *p <= 'f' )
+ {
+ nValue += *p - ('a' - 10);
+ }
+ else if( *p >= 'A' && *p <= 'F' )
+ {
+ nValue += *p - ('A' - 10 );
+ }
+ p++;
+ }
+
+ return nValue;
+ }
+ else
+ {
+ return rText.toInt32();
+ }
+}
+
+ElementConfigPtr ConfigHandler::importAtomConfig( const Reference< XAttributeList > & xAttribs, bool bIsContainer ) throw (SAXException)
+{
+ if( !maElementStack.empty() )
+ errorThrow( OUString( RTL_CONSTASCII_USTRINGPARAM("atom elements must be root" ) ) );
+
+ ElementConfigPtr aPtr( new AtomConfig( getAttribute(xAttribs,"name"), bIsContainer ) );
+ gAtomConfigMap[ (UINT16)toInt(getAttribute(xAttribs,"id"))] = aPtr;
+ return aPtr;
+}
+
+ElementConfigPtr ConfigHandler::importElementConfig( const Reference< XAttributeList > & xAttribs ) throw (SAXException)
+{
+ ElementConfigType nType = parseType( getAttribute( xAttribs, "type" ) );
+ ElementConfigPtr pElementConfig( new ElementConfigContainer( getAttribute( xAttribs, "name" ), nType ) );
+ addElement( pElementConfig );
+ return pElementConfig;
+}
+
+ElementConfigPtr ConfigHandler::importValueElementConfig( const Reference< XAttributeList > & xAttribs ) throw (SAXException)
+{
+ ElementConfigPtr pElementConfig( new ElementValueConfig( getAttribute( xAttribs, "name" ), getAttribute( xAttribs, "value" ) ) );
+ addElement( pElementConfig );
+ return pElementConfig;
+}
+
+ElementConfigPtr ConfigHandler::importSwitchConfig( const Reference< XAttributeList > & xAttribs ) throw (SAXException)
+{
+ ElementConfigType nType = parseType( getAttribute( xAttribs, "type" ) );
+ ElementConfigPtr pElementConfig( new SwitchElementConfig( nType ) );
+ addElement( pElementConfig );
+ return pElementConfig;
+}
+
+ElementConfigPtr ConfigHandler::importCaseConfig( const Reference< XAttributeList > & xAttribs ) throw (SAXException)
+{
+ ElementConfigPtr pElementConfig( new CaseElementConfig( getAttribute( xAttribs, "value" ) ) );
+ addElement( pElementConfig );
+ return pElementConfig;
+}
+
+void SAL_CALL ConfigHandler::endElement(const OUString& aName) throw( SAXException, RuntimeException )
+{
+ if( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "config" ) ) )
+ {
+ return;
+ }
+
+ maElementStack.pop();
+}
+
+void SAL_CALL ConfigHandler::characters(const OUString& aChars) throw( SAXException, RuntimeException )
+{
+}
+
+void SAL_CALL ConfigHandler::ignorableWhitespace(const OUString& aWhitespaces) throw( SAXException, RuntimeException )
+{
+}
+
+void SAL_CALL ConfigHandler::processingInstruction(const OUString& aTarget, const OUString& aData) throw( SAXException, RuntimeException )
+{
+}
+
+void SAL_CALL ConfigHandler::setDocumentLocator(const Reference< XLocator > & xLocator) throw( SAXException, RuntimeException )
+{
+}
+
+void load_config( const OUString& rPath )
+{
+ try
+ {
+ // create stream
+ SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( rPath, STREAM_READ );
+ Reference<XInputStream> xInputStream( new utl::OInputStreamWrapper( pIStm, sal_True ) );
+
+ // prepare ParserInputSrouce
+ InputSource aParserInput;
+ aParserInput.sSystemId = rPath;
+ aParserInput.aInputStream = xInputStream;
+
+ // get parser
+ Reference< XParser > xParser(
+ comphelper::getProcessServiceFactory()->createInstance(
+ OUString::createFromAscii("com.sun.star.xml.sax.Parser") ),
+ UNO_QUERY_THROW );
+
+ // get filter
+ ConfigHandler* pConfigHandler = new ConfigHandler();
+ Reference< XDocumentHandler > xFilter( pConfigHandler );
+
+ // connect parser and filter
+ xParser->setDocumentHandler( xFilter );
+
+ // finally, parser the stream
+ xParser->parseStream( aParserInput );
+ }
+ catch( Exception& r )
+ {
+ DBG_ERROR(
+ (rtl::OString("load_config(), "
+ "exception caught: ") +
+ rtl::OUStringToOString(
+ comphelper::anyToString( cppu::getCaughtException() ),
+ RTL_TEXTENCODING_UTF8 )).getStr() );
+
+ (void)r;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////
+
+rtl::OUString ElementConfig::format( SvStream& rStream, sal_Size& nLength ) const
+{
+ OUString aRet;
+ if( maName.getLength() )
+ {
+ aRet += maName;
+ aRet += OUString( RTL_CONSTASCII_USTRINGPARAM( " = " ) );
+ }
+
+ switch( mnType )
+ {
+ case ECT_BYTE: aRet += dump_byte( rStream, nLength ); break;
+ case ECT_UINT: aRet += dump_uint( rStream, nLength ); break;
+ case ECT_UNISTRING: aRet += dump_unistring( rStream, nLength ); break;
+ case ETC_FLOAT: aRet += dump_float( rStream, nLength ); break;
+ case ECT_HEXDUMP:
+ default: aRet += dump_hex( rStream, nLength ); break;
+ }
+
+ return aRet;
+}
+
+rtl::OUString ElementConfig::dump_hex( SvStream& rStream, sal_Size& nLength )
+{
+ char buffer[128];
+ OUString aOut, aEmpty;
+ OUString aHex, aAscii;
+ sal_Char c;
+ int nRow = 0;
+ while( nLength && (rStream.GetError() == 0) )
+ {
+ rStream >> c;
+ nLength--;
+
+ unsigned int i = c;
+ i &= 0xff;
+ sprintf( buffer, "%02x ", i );
+ aHex += OUString::createFromAscii( buffer );
+
+ if( !isprint( c ) )
+ c = '.';
+
+ aAscii += OUString( (sal_Unicode) c );
+ nRow++;
+
+ if( (nRow == 16) || (nLength==0) )
+ {
+ while( aHex.getLength() < (16*3) )
+ aHex += OUString( RTL_CONSTASCII_USTRINGPARAM(" ") );
+ aOut += aHex;
+ aOut += aAscii;
+ aOut += OUString( RTL_CONSTASCII_USTRINGPARAM( "\n\r" ) );
+ aHex = aEmpty;
+ aAscii = aEmpty;
+ nRow = 0;
+ }
+ }
+
+ aOut += aHex;
+ aOut += aAscii;
+
+ return aOut;
+}
+
+rtl::OUString ElementConfig::dump_byte( SvStream& rStream, sal_Size& nLength )
+{
+ OUString aRet;
+ if( nLength >= sizeof(sal_Char) )
+ {
+ sal_Char c;
+ rStream >> c;
+
+ char buffer[128];
+ sprintf( buffer, "%u", (int)c );
+ aRet += OUString::createFromAscii( buffer );
+ nLength -= sizeof(sal_Char);
+ }
+
+ return aRet;
+}
+
+rtl::OUString ElementConfig::dump_uint( SvStream& rStream, sal_Size& nLength )
+{
+ OUString aRet;
+ if( nLength >= sizeof( sal_uInt32 ) )
+ {
+ sal_uInt32 c;
+ rStream >> c;
+
+ char buffer[128];
+ sprintf( buffer, "%u", c );
+ aRet += OUString::createFromAscii( buffer );
+ nLength-= sizeof( sal_uInt32 );
+ }
+
+ return aRet;
+}
+
+rtl::OUString ElementConfig::dump_unistring( SvStream& rStream, sal_Size& nLength )
+{
+ String aString;
+ SvxMSDffManager::MSDFFReadZString( rStream, aString, nLength, sal_True );
+ nLength = 0;
+ return aString;
+}
+
+rtl::OUString ElementConfig::dump_float( SvStream& rStream, sal_Size& nLength )
+{
+ OUString aRet;
+ if( nLength >= sizeof( float ) )
+ {
+ float c;
+ rStream >> c;
+
+ char buffer[128];
+ sprintf( buffer, "%g", (double)c );
+ aRet += OUString::createFromAscii( buffer );
+ nLength-= sizeof( float );
+ }
+
+ return aRet;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+rtl::OUString ElementConfigContainer::format( SvStream& rStream, sal_Size& nLength ) const
+{
+ OUString aRet;
+
+ if( getType() == ETC_CONTAINER )
+ {
+
+ ElementConfigList::const_iterator aIter( maElementConfigList.begin() );
+ const ElementConfigList::const_iterator aEnd( maElementConfigList.end() );
+ while( (aIter != aEnd) && (nLength > 0) )
+ {
+ aRet += (*aIter++)->format( rStream, nLength );
+ if( (aIter != aEnd) || (nLength != 0) )
+ aRet += OUString( RTL_CONSTASCII_USTRINGPARAM( "\n\r" ) );
+ }
+
+ if( nLength )
+ aRet += ElementConfig::dump_hex( rStream, nLength );
+ }
+ else
+ {
+ aRet = getName();
+ if( aRet.getLength() )
+ aRet += OUString( RTL_CONSTASCII_USTRINGPARAM( " = " ) );
+
+ OUString aValue;
+ switch( getType() )
+ {
+ case ECT_BYTE: aValue = dump_byte( rStream, nLength ); break;
+ case ECT_UINT: aValue = dump_uint( rStream, nLength ); break;
+ case ECT_UNISTRING: aValue = dump_unistring( rStream, nLength ); break;
+ case ETC_FLOAT: aValue = dump_float( rStream, nLength ); break;
+ case ECT_HEXDUMP:
+ default: aValue = dump_hex( rStream, nLength ); break;
+ }
+
+ if( aValue.getLength() )
+ {
+ if( !maElementConfigList.empty() )
+ {
+ ElementConfigList::const_iterator aIter( maElementConfigList.begin() );
+ const ElementConfigList::const_iterator aEnd( maElementConfigList.end() );
+ while( (aIter != aEnd) && (nLength > 0) )
+ {
+ ElementValueConfig* pValue = dynamic_cast< ElementValueConfig* >( (*aIter++).get() );
+ if( pValue && pValue->getValue() == aValue )
+ {
+ aValue = pValue->getName();
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ aValue = OUString( RTL_CONSTASCII_USTRINGPARAM("<empty!?>") );
+ }
+
+ aRet += aValue;
+ }
+
+ return aRet;
+}
+
+///////////////////////////////////////////////////////////////////////
+
+rtl::OUString SwitchElementConfig::format( SvStream& rStream, sal_Size& nLength ) const
+{
+ OUString aValue;
+
+ switch( getType() )
+ {
+ case ECT_BYTE: aValue = dump_byte( rStream, nLength ); break;
+ case ECT_UINT: aValue = dump_uint( rStream, nLength ); break;
+ case ETC_FLOAT: aValue = dump_float( rStream, nLength ); break;
+ case ECT_UNISTRING: aValue = dump_unistring( rStream, nLength ); break;
+ }
+
+ if( aValue.getLength() )
+ {
+ ElementConfigList::const_iterator aIter( maElementConfigList.begin() );
+ const ElementConfigList::const_iterator aEnd( maElementConfigList.end() );
+ while( (aIter != aEnd) && (nLength > 0) )
+ {
+ CaseElementConfig* pCase = dynamic_cast< CaseElementConfig* >( (*aIter++).get() );
+ if( pCase && pCase->getValue() == aValue )
+ return pCase->format( rStream, nLength );
+ }
+ }
+
+ return ElementConfig::dump_hex( rStream, nLength );
+}
+
diff --git a/svx/workben/msview/xmlconfig.hxx b/svx/workben/msview/xmlconfig.hxx
new file mode 100644
index 000000000000..d3d4eeb937e8
--- /dev/null
+++ b/svx/workben/msview/xmlconfig.hxx
@@ -0,0 +1,108 @@
+#ifndef _XMLCONFIG_HXX_
+#define _XMLCONFIG_HXX_
+
+#include <map>
+#include <list>
+#include <boost/shared_ptr.hpp>
+
+///////////////////////////////////////////////////////////////////////
+
+enum ElementConfigType { ECT_HEXDUMP, ECT_BYTE, ECT_UINT, ECT_UNISTRING, ETC_FLOAT, ETC_CONTAINER };
+
+class ElementConfig
+{
+public:
+ ElementConfig() : mnType( ECT_HEXDUMP ) {}
+ ElementConfig( const rtl::OUString& rName, ElementConfigType rType ) : maName( rName ), mnType( rType ) {}
+ ElementConfig( const rtl::OUString& rName ) : maName( rName ) {}
+ ElementConfig( ElementConfigType rType ) : mnType( rType ) {}
+
+ virtual rtl::OUString format( SvStream& rStream, sal_Size& nLength ) const;
+
+ const rtl::OUString& getName() const { return maName; }
+ ElementConfigType getType() const { return mnType; }
+
+ static rtl::OUString dump_hex( SvStream& rStream, sal_Size& nLength );
+ static rtl::OUString dump_byte( SvStream& rStream, sal_Size& nLength );
+ static rtl::OUString dump_uint( SvStream& rStream, sal_Size& nLength );
+ static rtl::OUString dump_unistring( SvStream& rStream, sal_Size& nLength );
+ static rtl::OUString dump_float( SvStream& rStream, sal_Size& nLength );
+private:
+ rtl::OUString maName;
+ ElementConfigType mnType;
+};
+typedef boost::shared_ptr< ElementConfig > ElementConfigPtr;
+typedef std::list< ElementConfigPtr > ElementConfigList;
+
+///////////////////////////////////////////////////////////////////////
+
+class ElementValueConfig : public ElementConfig
+{
+public:
+ ElementValueConfig( const rtl::OUString& rName, const rtl::OUString& rValue ) : ElementConfig( rName ), maValue( rValue ) {}
+
+ const rtl::OUString& getValue() const { return maValue; }
+
+private:
+ rtl::OUString maValue;
+};
+
+///////////////////////////////////////////////////////////////////////
+
+class ElementConfigContainer : public ElementConfig
+{
+public:
+ ElementConfigContainer() : ElementConfig( ETC_CONTAINER ) {}
+ ElementConfigContainer( const ::rtl::OUString& rName, ElementConfigType rType ) : ElementConfig( rName, rType ) {}
+ ElementConfigContainer( const ::rtl::OUString& rName ) : ElementConfig( rName, ETC_CONTAINER ) {}
+ ElementConfigContainer( ElementConfigType rType ) : ElementConfig( rType ) {}
+
+ virtual rtl::OUString format( SvStream& rStream, sal_Size& nLength ) const;
+
+ void addElementConfig( ElementConfigPtr p ) { maElementConfigList.push_back( p ); }
+
+protected:
+ ElementConfigList maElementConfigList;
+};
+
+///////////////////////////////////////////////////////////////////////
+
+class CaseElementConfig : public ElementConfigContainer
+{
+public:
+ CaseElementConfig( const rtl::OUString& rValue ) : maValue( rValue ) {}
+
+ const rtl::OUString& getValue() const { return maValue; }
+
+private:
+ rtl::OUString maValue;
+};
+
+///////////////////////////////////////////////////////////////////////
+
+class SwitchElementConfig : public ElementConfigContainer
+{
+public:
+ SwitchElementConfig( ElementConfigType rType ) : ElementConfigContainer( rType ) {}
+
+ virtual rtl::OUString format( SvStream& rStream, sal_Size& nLength ) const;
+};
+
+///////////////////////////////////////////////////////////////////////
+
+class AtomConfig : public ElementConfigContainer
+{
+public:
+ AtomConfig( const ::rtl::OUString& rName, bool bIsContainer ) : ElementConfigContainer( rName ), mbIsContainer( bIsContainer ) {}
+
+ bool isContainer() const { return mbIsContainer; }
+
+protected:
+ bool mbIsContainer;
+};
+
+typedef std::map< UINT16, ElementConfigPtr > AtomConfigMap;
+
+extern AtomConfigMap gAtomConfigMap;
+
+#endif
diff --git a/svx/xml/AccessibleControlShape.xml b/svx/xml/AccessibleControlShape.xml
new file mode 100644
index 000000000000..cc889988363b
--- /dev/null
+++ b/svx/xml/AccessibleControlShape.xml
@@ -0,0 +1,40 @@
+<?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>svx</module-name>
+<component-description>
+
+<author>Andre Fischer</author>
+<name>AccessibleControlShape</name>
+
+<description>This component represents the accessbility object of control
+shapes. This is an accessible object where the accessible context is
+implemented by another object. Furthermore, this context may be replaced by
+another during runtime. For more detailed information see the documentation
+of the supported services and the link to the general accessibility
+documentation.</description>
+
+<reference-docu xlink-href="http://ui.openoffice.org/accessibility"
+title="Link to a general description of UNO accessibility"/>
+
+<loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+<language>c++</language>
+<status value="alpha"/>
+
+<supported-service>com.sun.star.drawing.AccessibleShape</supported-service>
+<supported-service>com.sun.star.accessibility.Accessible</supported-service>
+<supported-service>com.sun.star.accessibility.AccessibleContext</supported-service>
+
+<type>com.sun.star.accessibility.XAccessible</type>
+<type>com.sun.star.accessibility.XAccessibleContext</type>
+<type>com.sun.star.accessibility.XAccessibleEventBroadcaster</type>
+<type>com.sun.star.accessibility.XAccessibleComponent</type>
+<type>com.sun.star.accessibility.XAccessibleExtendedComponent</type>
+<type>com.sun.star.lang.XTypeProvider</type>
+<type>com.sun.star.lang.XServiceInfo</type>
+<type>com.sun.star.lang.XComponent</type>
+<type>com.sun.star.document.XEventListener</type>
+<type>com.sun.star.lang.XUnoTunnel</type>
+
+</component-description>
+</module-description>
diff --git a/svx/xml/AccessibleEditableTextPara.xml b/svx/xml/AccessibleEditableTextPara.xml
new file mode 100644
index 000000000000..affb15f4dd55
--- /dev/null
+++ b/svx/xml/AccessibleEditableTextPara.xml
@@ -0,0 +1,37 @@
+<?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>svx</module-name>
+<component-description>
+
+<author>Andre Fischer</author>
+<name>AccessibleEditableTextPara</name>
+
+<description>This component represents the accessbility object for an
+editable text paragraph. For more detailed
+information see the documentation of the supported services and the link
+to the general accessibility documentation.</description>
+
+<reference-docu xlink-href="http://ui.openoffice.org/accessibility"
+title="Link to a general description of UNO accessibility"/>
+
+<loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+<language>c++</language>
+<status value="alpha"/>
+
+<supported-service>com.sun.star.text.AccessibleParagraphView</supported-service>
+<supported-service>com.sun.star.accessibility.Accessible</supported-service>
+<supported-service>com.sun.star.accessibility.AccessibleContext</supported-service>
+
+<type>com.sun.star.accessibility.XAccessible</type>
+<type>com.sun.star.accessibility.XAccessibleContext</type>
+<type>com.sun.star.accessibility.XAccessibleEventBroadcaster</type>
+<type>com.sun.star.accessibility.XAccessibleComponent</type>
+<type>com.sun.star.accessibility.XAccessibleEditableText</type>
+<type>com.sun.star.accessibility.XAccessibleHyperext</type>
+<type>com.sun.star.accessibility.XAccessibleTextAttributes</type>
+<type>com.sun.star.lang.XTypeProvider</type>
+<type>com.sun.star.lang.XServiceInfo</type>
+
+</component-description>
+</module-description>
diff --git a/svx/xml/AccessibleGraphicShape.xml b/svx/xml/AccessibleGraphicShape.xml
new file mode 100644
index 000000000000..74e41df3a77d
--- /dev/null
+++ b/svx/xml/AccessibleGraphicShape.xml
@@ -0,0 +1,41 @@
+<?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>svx</module-name>
+<component-description>
+
+<author>Andre Fischer</author>
+<name>AccessibleGraphicShape</name>
+
+<description>Derived from AccessibleShape this component supports the
+additional com.sun.star.accessibility.XAccessibleImage interface in
+order to supply more detailed information about accessible images. For more
+detailed information see the documentation of the base component
+AccessibleShape, the supported services, and the link to the general
+accessibility documentation.</description>
+
+<reference-docu xlink-href="http://ui.openoffice.org/accessibility"
+title="Link to a general description of UNO accessibility"/>
+
+<loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+<language>c++</language>
+<status value="alpha"/>
+
+<supported-service>com.sun.star.drawing.AccessibleShape</supported-service>
+<supported-service>com.sun.star.accessibility.Accessible</supported-service>
+<supported-service>com.sun.star.accessibility.AccessibleContext</supported-service>
+
+<type>com.sun.star.accessibility.XAccessible</type>
+<type>com.sun.star.accessibility.XAccessibleContext</type>
+<type>com.sun.star.accessibility.XAccessibleEventBroadcaster</type>
+<type>com.sun.star.accessibility.XAccessibleComponent</type>
+<type>com.sun.star.accessibility.XAccessibleExtendedComponent</type>
+<type>com.sun.star.accessibility.XAccessibleImage</type>
+<type>com.sun.star.lang.XTypeProvider</type>
+<type>com.sun.star.lang.XServiceInfo</type>
+<type>com.sun.star.lang.XComponent</type>
+<type>com.sun.star.document.XEventListener</type>
+<type>com.sun.star.lang.XUnoTunnel</type>
+
+</component-description>
+</module-description>
diff --git a/svx/xml/AccessibleImageBullet.xml b/svx/xml/AccessibleImageBullet.xml
new file mode 100644
index 000000000000..c6a2afdba95e
--- /dev/null
+++ b/svx/xml/AccessibleImageBullet.xml
@@ -0,0 +1,34 @@
+<?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>svx</module-name>
+<component-description>
+
+<author>Andre Fischer</author>
+<name>AccessibleImageBullet</name>
+
+<description>This component represents the accessbility object for an
+image bullet within a text paragraph. For more detailed
+information see the documentation of the supported services and the link
+to the general accessibility documentation.</description>
+
+<reference-docu xlink-href="http://ui.openoffice.org/accessibility"
+title="Link to a general description of UNO accessibility"/>
+
+<loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+<language>c++</language>
+<status value="alpha"/>
+
+<supported-service>com.sun.star.text.AccessibleImageBullet</supported-service>
+<supported-service>com.sun.star.accessibility.Accessible</supported-service>
+<supported-service>com.sun.star.accessibility.AccessibleContext</supported-service>
+
+<type>com.sun.star.accessibility.XAccessible</type>
+<type>com.sun.star.accessibility.XAccessibleContext</type>
+<type>com.sun.star.accessibility.XAccessibleEventBroadcaster</type>
+<type>com.sun.star.accessibility.XAccessibleComponent</type>
+<type>com.sun.star.lang.XTypeProvider</type>
+<type>com.sun.star.lang.XServiceInfo</type>
+
+</component-description>
+</module-description>
diff --git a/svx/xml/AccessibleOLEShape.xml b/svx/xml/AccessibleOLEShape.xml
new file mode 100644
index 000000000000..27a9cafd4669
--- /dev/null
+++ b/svx/xml/AccessibleOLEShape.xml
@@ -0,0 +1,41 @@
+<?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>svx</module-name>
+<component-description>
+
+<author>Andre Fischer</author>
+<name>AccessibleOLEShape</name>
+
+<description>Derived from AccessibleShape this component supports the
+additional com.sun.star.accessibility.XAccessibleAction interface in
+order to supply more detailed information about accessible OLE shapes. For
+more detailed information see the documentation of the base component
+AccessibleShape, the supported services, and the link to the general
+accessibility documentation.</description>
+
+<reference-docu xlink-href="http://ui.openoffice.org/accessibility"
+title="Link to a general description of UNO accessibility"/>
+
+<loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+<language>c++</language>
+<status value="alpha"/>
+
+<supported-service>com.sun.star.drawing.AccessibleShape</supported-service>
+<supported-service>com.sun.star.accessibility.Accessible</supported-service>
+<supported-service>com.sun.star.accessibility.AccessibleContext</supported-service>
+
+<type>com.sun.star.accessibility.XAccessible</type>
+<type>com.sun.star.accessibility.XAccessibleContext</type>
+<type>com.sun.star.accessibility.XAccessibleEventBroadcaster</type>
+<type>com.sun.star.accessibility.XAccessibleComponent</type>
+<type>com.sun.star.accessibility.XAccessibleExtendedComponent</type>
+<type>com.sun.star.accessibility.XAccessibleAction</type>
+<type>com.sun.star.lang.XTypeProvider</type>
+<type>com.sun.star.lang.XServiceInfo</type>
+<type>com.sun.star.lang.XComponent</type>
+<type>com.sun.star.document.XEventListener</type>
+<type>com.sun.star.lang.XUnoTunnel</type>
+
+</component-description>
+</module-description>
diff --git a/svx/xml/AccessibleShape.xml b/svx/xml/AccessibleShape.xml
new file mode 100644
index 000000000000..6469448e5479
--- /dev/null
+++ b/svx/xml/AccessibleShape.xml
@@ -0,0 +1,39 @@
+<?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>svx</module-name>
+<component-description>
+
+<author>Andre Fischer</author>
+<name>AccessibleShape</name>
+
+<description>This component represents the accessbility object of generic
+shapes. There is a list of derived components that are used for special
+shapes and which support additional interfaces. For more detailed
+information see the documentation of the supported services and the link
+to the general accessibility documentation.</description>
+
+<reference-docu xlink-href="http://ui.openoffice.org/accessibility"
+title="Link to a general description of UNO accessibility"/>
+
+<loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+<language>c++</language>
+<status value="alpha"/>
+
+<supported-service>com.sun.star.drawing.AccessibleShape</supported-service>
+<supported-service>com.sun.star.accessibility.Accessible</supported-service>
+<supported-service>com.sun.star.accessibility.AccessibleContext</supported-service>
+
+<type>com.sun.star.accessibility.XAccessible</type>
+<type>com.sun.star.accessibility.XAccessibleContext</type>
+<type>com.sun.star.accessibility.XAccessibleEventBroadcaster</type>
+<type>com.sun.star.accessibility.XAccessibleComponent</type>
+<type>com.sun.star.accessibility.XAccessibleExtendedComponent</type>
+<type>com.sun.star.lang.XTypeProvider</type>
+<type>com.sun.star.lang.XServiceInfo</type>
+<type>com.sun.star.lang.XComponent</type>
+<type>com.sun.star.document.XEventListener</type>
+<type>com.sun.star.lang.XUnoTunnel</type>
+
+</component-description>
+</module-description>
diff --git a/svx/xml/SvxDrawPage.xml b/svx/xml/SvxDrawPage.xml
new file mode 100644
index 000000000000..29ea110a0094
--- /dev/null
+++ b/svx/xml/SvxDrawPage.xml
@@ -0,0 +1,16 @@
+<?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>svx</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SvxDrawPage</name>
+ <description>
+ This component implements the basic functionality for a drawing page
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com::sun::star::drawing::DrawPage</supported-service>
+ </component-description>
+</module-description>
diff --git a/svx/xml/SvxGraphCtrlAccessibleContext.xml b/svx/xml/SvxGraphCtrlAccessibleContext.xml
new file mode 100644
index 000000000000..ad436f5dc297
--- /dev/null
+++ b/svx/xml/SvxGraphCtrlAccessibleContext.xml
@@ -0,0 +1,19 @@
+<?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>svx</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.ui.SvxGraphCtrlAccessibleContext</name>
+ <description>
+ This component implements the basic accessibility context to a GraphControl. A GraphControl displays
+ a drawing-layer model, for example in the ImageMap dialog.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>::com::sun::star::accessibility::Accessible</supported-service>
+ <supported-service>::com::sun::star::accessibility::AccessibleContext</supported-service>
+ <supported-service>::com::sun::star::drawing::AccessibleGraphControl</supported-service>
+ </component-description>
+</module-description>
diff --git a/svx/xml/SvxGraphicExporter.xml b/svx/xml/SvxGraphicExporter.xml
new file mode 100644
index 000000000000..6a4d9fef2f47
--- /dev/null
+++ b/svx/xml/SvxGraphicExporter.xml
@@ -0,0 +1,16 @@
+<?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>svx</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.Draw.GraphicExporter</name>
+ <description>
+ this Component implements a com.sun.star.drawing.GraphicExportFilter service.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com.sun.star.drawing.GraphicExportFilter</supported-service>
+ </component-description>
+</module-description>
diff --git a/svx/xml/SvxGraphicObject.xml b/svx/xml/SvxGraphicObject.xml
new file mode 100644
index 000000000000..7c756ad3e06e
--- /dev/null
+++ b/svx/xml/SvxGraphicObject.xml
@@ -0,0 +1,16 @@
+<?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>svx</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SvxGraphicObject</name>
+ <description>
+ This component provides access to a graphic object.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com.sun.star.drawing.GraphicObjectShape</supported-service>
+ </component-description>
+</module-description>
diff --git a/svx/xml/SvxShape.xml b/svx/xml/SvxShape.xml
new file mode 100644
index 000000000000..6cf5e00a1ac1
--- /dev/null
+++ b/svx/xml/SvxShape.xml
@@ -0,0 +1,16 @@
+<?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>svx</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SvxShape</name>
+ <description>
+ This component provides access to a basic shape.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com.sun.star.drawing.TextShape</supported-service>
+ </component-description>
+</module-description>
diff --git a/svx/xml/SvxShapeCircle.xml b/svx/xml/SvxShapeCircle.xml
new file mode 100644
index 000000000000..fc37a09e93e3
--- /dev/null
+++ b/svx/xml/SvxShapeCircle.xml
@@ -0,0 +1,16 @@
+<?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>svx</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SvxShapeCircle</name>
+ <description>
+ This component provides access to a circle shape.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com.sun.star.drawing.EllipseShape</supported-service>
+ </component-description>
+</module-description>
diff --git a/svx/xml/SvxShapeCollection.xml b/svx/xml/SvxShapeCollection.xml
new file mode 100644
index 000000000000..ad9781dfd367
--- /dev/null
+++ b/svx/xml/SvxShapeCollection.xml
@@ -0,0 +1,16 @@
+<?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>svx</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SvxShapeCollection</name>
+ <description>
+ This component provides to a collection of shapes.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com.sun.star.drawing.Shapes</supported-service>
+ </component-description>
+</module-description>
diff --git a/svx/xml/SvxShapeConnector.xml b/svx/xml/SvxShapeConnector.xml
new file mode 100644
index 000000000000..e80596b91d60
--- /dev/null
+++ b/svx/xml/SvxShapeConnector.xml
@@ -0,0 +1,16 @@
+<?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>svx</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SvxShapeConnector</name>
+ <description>
+ This component provides to a connector shape.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com.sun.star.drawing.ConnectorShape</supported-service>
+ </component-description>
+</module-description>
diff --git a/svx/xml/SvxShapeControl.xml b/svx/xml/SvxShapeControl.xml
new file mode 100644
index 000000000000..c2c95e1abed7
--- /dev/null
+++ b/svx/xml/SvxShapeControl.xml
@@ -0,0 +1,16 @@
+<?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>svx</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SvxShapeControl</name>
+ <description>
+ This component provides access to a control shape.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com.sun.star.drawing.ControlShape</supported-service>
+ </component-description>
+</module-description>
diff --git a/svx/xml/SvxShapeDimensioning.xml b/svx/xml/SvxShapeDimensioning.xml
new file mode 100644
index 000000000000..4a3096010771
--- /dev/null
+++ b/svx/xml/SvxShapeDimensioning.xml
@@ -0,0 +1,16 @@
+<?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>svx</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SvxShapeDimensioning</name>
+ <description>
+ This component provides access to a dimensioning shape.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com.sun.star.drawing.MeasureShape</supported-service>
+ </component-description>
+</module-description>
diff --git a/svx/xml/SvxShapeGroup.xml b/svx/xml/SvxShapeGroup.xml
new file mode 100644
index 000000000000..e24fa8c703aa
--- /dev/null
+++ b/svx/xml/SvxShapeGroup.xml
@@ -0,0 +1,16 @@
+<?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>svx</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SvxShapeGroup</name>
+ <description>
+ This component provides a group shape.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com.sun.star.drawing.GroupShape</supported-service>
+ </component-description>
+</module-description>
diff --git a/svx/xml/SvxShapePolyPolygon.xml b/svx/xml/SvxShapePolyPolygon.xml
new file mode 100644
index 000000000000..203bc1df98f5
--- /dev/null
+++ b/svx/xml/SvxShapePolyPolygon.xml
@@ -0,0 +1,16 @@
+<?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>svx</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SvxShapePolyPolygon</name>
+ <description>
+ This component provides a poly polygon shape.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com.sun.star.drawing.PolyPolygonShape</supported-service>
+ </component-description>
+</module-description>
diff --git a/svx/xml/SvxShapePolyPolygonBezier.xml b/svx/xml/SvxShapePolyPolygonBezier.xml
new file mode 100644
index 000000000000..aadabb6df6f7
--- /dev/null
+++ b/svx/xml/SvxShapePolyPolygonBezier.xml
@@ -0,0 +1,16 @@
+<?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>svx</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SvxShapePolyPolygonBezier</name>
+ <description>
+ This component provides access to a poly polygon bezier shape.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com::sun::star::drawing::PolyPolygonBezierShape</supported-service>
+ </component-description>
+</module-description>
diff --git a/svx/xml/SvxUnoNumberingRules.xml b/svx/xml/SvxUnoNumberingRules.xml
new file mode 100644
index 000000000000..fe5b13ed490e
--- /dev/null
+++ b/svx/xml/SvxUnoNumberingRules.xml
@@ -0,0 +1,16 @@
+<?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>svx</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SvxUnoNumberingRules</name>
+ <description>
+ This component provides access to a anumbering rule
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com::sun::star::text::NumberingRules</supported-service>
+ </component-description>
+</module-description>
diff --git a/svx/xml/SvxUnoText.xml b/svx/xml/SvxUnoText.xml
new file mode 100644
index 000000000000..c3b26aa74321
--- /dev/null
+++ b/svx/xml/SvxUnoText.xml
@@ -0,0 +1,16 @@
+<?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>svx</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SvxUnoText</name>
+ <description>
+ This component provides access to the text based on the edit engine or the outliner.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com::sun::star::text::Text</supported-service>
+ </component-description>
+</module-description>
diff --git a/svx/xml/SvxUnoTextContent.xml b/svx/xml/SvxUnoTextContent.xml
new file mode 100644
index 000000000000..2732d480b5ec
--- /dev/null
+++ b/svx/xml/SvxUnoTextContent.xml
@@ -0,0 +1,16 @@
+<?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>svx</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SvxUnoTextContent</name>
+ <description>
+ This component provides access to the paragraph contend inside the text of an edit engine or outliner.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com::sun::star::text::Paragraph</supported-service>
+ </component-description>
+</module-description>
diff --git a/svx/xml/SvxUnoTextContentEnum.xml b/svx/xml/SvxUnoTextContentEnum.xml
new file mode 100644
index 000000000000..ecbc78b5d3d3
--- /dev/null
+++ b/svx/xml/SvxUnoTextContentEnum.xml
@@ -0,0 +1,16 @@
+<?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>svx</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SvxUnoTextContentEnum</name>
+ <description>
+ This component provides access to the paragraph insides an edit engine or outliner
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com::sun::star::container::XEnumeration</supported-service>
+ </component-description>
+</module-description>
diff --git a/svx/xml/SvxUnoTextCursor.xml b/svx/xml/SvxUnoTextCursor.xml
new file mode 100644
index 000000000000..fbebd7cf17a5
--- /dev/null
+++ b/svx/xml/SvxUnoTextCursor.xml
@@ -0,0 +1,16 @@
+<?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>svx</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SvxUnoTextCursor</name>
+ <description>
+ This component provides an implementation of a text cursor for the edit engine or outliner.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com::sun::star::text::TextCursor</supported-service>
+ </component-description>
+</module-description>
diff --git a/svx/xml/SvxUnoTextField.xml b/svx/xml/SvxUnoTextField.xml
new file mode 100644
index 000000000000..fa64d6b1230c
--- /dev/null
+++ b/svx/xml/SvxUnoTextField.xml
@@ -0,0 +1,16 @@
+<?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>svx</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SvxUnoTextField</name>
+ <description>
+ This component provides access to a text field text content for edit engine and outliner
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com::sun::star::text::TextField</supported-service>
+ </component-description>
+</module-description>
diff --git a/svx/xml/SvxUnoTextRange.xml b/svx/xml/SvxUnoTextRange.xml
new file mode 100644
index 000000000000..04b4610fb5d5
--- /dev/null
+++ b/svx/xml/SvxUnoTextRange.xml
@@ -0,0 +1,16 @@
+<?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>svx</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SvxUnoTextRange</name>
+ <description>
+ This component provides access to a simple text range in an edit engine or outliner.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com::sun::star::text::TextRange</supported-service>
+ </component-description>
+</module-description>
diff --git a/svx/xml/SvxUnoTextRangeEnumeration.xml b/svx/xml/SvxUnoTextRangeEnumeration.xml
new file mode 100644
index 000000000000..c8fc25adf539
--- /dev/null
+++ b/svx/xml/SvxUnoTextRangeEnumeration.xml
@@ -0,0 +1,16 @@
+<?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>svx</module-name>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>com.sun.star.comp.office.SvxUnoTextRangeEnumeration</name>
+ <description>
+ This component provides access to an enumeration of text ranges.
+</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final"/>
+ <supported-service>com.sun.star.text.TextPortionEnumeration</supported-service>
+ </component-description>
+</module-description>